@surething/cockpit 1.0.267 → 1.0.268

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 (208) hide show
  1. package/.next-prod/BUILD_ID +1 -1
  2. package/.next-prod/app-path-routes-manifest.json +4 -4
  3. package/.next-prod/build-manifest.json +2 -2
  4. package/.next-prod/cockpit-build.json +1 -1
  5. package/.next-prod/prerender-manifest.json +4 -4
  6. package/.next-prod/server/app/_global-error/page.js.nft.json +1 -1
  7. package/.next-prod/server/app/_global-error/page_client-reference-manifest.js +1 -1
  8. package/.next-prod/server/app/_global-error.html +1 -1
  9. package/.next-prod/server/app/_global-error.rsc +1 -1
  10. package/.next-prod/server/app/_global-error.segments/_full.segment.rsc +1 -1
  11. package/.next-prod/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  12. package/.next-prod/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  13. package/.next-prod/server/app/_not-found/page.js +1 -1
  14. package/.next-prod/server/app/_not-found/page.js.nft.json +1 -1
  15. package/.next-prod/server/app/_not-found/page_client-reference-manifest.js +1 -1
  16. package/.next-prod/server/app/_not-found.html +2 -2
  17. package/.next-prod/server/app/_not-found.rsc +2 -2
  18. package/.next-prod/server/app/_not-found.segments/_full.segment.rsc +2 -2
  19. package/.next-prod/server/app/_not-found.segments/_index.segment.rsc +2 -2
  20. package/.next-prod/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  21. package/.next-prod/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  22. package/.next-prod/server/app/api/agent/test/route.js.nft.json +1 -1
  23. package/.next-prod/server/app/api/bash/route.js.nft.json +1 -1
  24. package/.next-prod/server/app/api/chat/codex/route.js.nft.json +1 -1
  25. package/.next-prod/server/app/api/chat/deepseek/route.js.nft.json +1 -1
  26. package/.next-prod/server/app/api/chat/glm/route.js.nft.json +1 -1
  27. package/.next-prod/server/app/api/chat/kimi/route.js.nft.json +1 -1
  28. package/.next-prod/server/app/api/chat/ollama/route.js.nft.json +1 -1
  29. package/.next-prod/server/app/api/chat/route.js.nft.json +1 -1
  30. package/.next-prod/server/app/api/chat/stop/route.js.nft.json +1 -1
  31. package/.next-prod/server/app/api/claude-stats/route.js.nft.json +1 -1
  32. package/.next-prod/server/app/api/commands/route.js.nft.json +1 -1
  33. package/.next-prod/server/app/api/comments/route.js.nft.json +1 -1
  34. package/.next-prod/server/app/api/db/columns/route.js.nft.json +1 -1
  35. package/.next-prod/server/app/api/db/connect/route.js.nft.json +1 -1
  36. package/.next-prod/server/app/api/db/disconnect/route.js.nft.json +1 -1
  37. package/.next-prod/server/app/api/db/export/route.js.nft.json +1 -1
  38. package/.next-prod/server/app/api/db/query/route.js.nft.json +1 -1
  39. package/.next-prod/server/app/api/db/schemas/route.js.nft.json +1 -1
  40. package/.next-prod/server/app/api/deepseek/balance/route.js.nft.json +1 -1
  41. package/.next-prod/server/app/api/deepseek/credentials/route.js.nft.json +1 -1
  42. package/.next-prod/server/app/api/deepseek/models/route.js.nft.json +1 -1
  43. package/.next-prod/server/app/api/dev/spans/route.js.nft.json +1 -1
  44. package/.next-prod/server/app/api/extension/version/route.js.nft.json +1 -1
  45. package/.next-prod/server/app/api/file/route.js.nft.json +1 -1
  46. package/.next-prod/server/app/api/files/blame/route.js.nft.json +1 -1
  47. package/.next-prod/server/app/api/files/clipboard/route.js.nft.json +1 -1
  48. package/.next-prod/server/app/api/files/copy/route.js.nft.json +1 -1
  49. package/.next-prod/server/app/api/files/delete/route.js.nft.json +1 -1
  50. package/.next-prod/server/app/api/files/expanded/route.js.nft.json +1 -1
  51. package/.next-prod/server/app/api/files/index/route.js.nft.json +1 -1
  52. package/.next-prod/server/app/api/files/init/route.js.nft.json +1 -1
  53. package/.next-prod/server/app/api/files/paste/route.js.nft.json +1 -1
  54. package/.next-prod/server/app/api/files/read/route.js.nft.json +1 -1
  55. package/.next-prod/server/app/api/files/readdir/route.js.nft.json +1 -1
  56. package/.next-prod/server/app/api/files/recent/route.js.nft.json +1 -1
  57. package/.next-prod/server/app/api/files/save/route.js.nft.json +1 -1
  58. package/.next-prod/server/app/api/files/search/route.js.nft.json +1 -1
  59. package/.next-prod/server/app/api/files/stat/route.js.nft.json +1 -1
  60. package/.next-prod/server/app/api/files/text/route.js.nft.json +1 -1
  61. package/.next-prod/server/app/api/git/blob/route.js.nft.json +1 -1
  62. package/.next-prod/server/app/api/git/branch-diff/route.js.nft.json +1 -1
  63. package/.next-prod/server/app/api/git/branches/route.js.nft.json +1 -1
  64. package/.next-prod/server/app/api/git/commit-diff/route.js.nft.json +1 -1
  65. package/.next-prod/server/app/api/git/commits/route.js +1 -1
  66. package/.next-prod/server/app/api/git/commits/route.js.nft.json +1 -1
  67. package/.next-prod/server/app/api/git/current-branch/route.js.nft.json +1 -1
  68. package/.next-prod/server/app/api/git/diff/route.js.nft.json +1 -1
  69. package/.next-prod/server/app/api/git/discard/route.js.nft.json +1 -1
  70. package/.next-prod/server/app/api/git/stage/route.js.nft.json +1 -1
  71. package/.next-prod/server/app/api/git/status/route.js.nft.json +1 -1
  72. package/.next-prod/server/app/api/git/unstage/route.js.nft.json +1 -1
  73. package/.next-prod/server/app/api/git/worktree/route.js.nft.json +1 -1
  74. package/.next-prod/server/app/api/glm/credentials/route.js.nft.json +1 -1
  75. package/.next-prod/server/app/api/glm/models/route.js.nft.json +1 -1
  76. package/.next-prod/server/app/api/glm/usage/route.js.nft.json +1 -1
  77. package/.next-prod/server/app/api/global-state/route.js.nft.json +1 -1
  78. package/.next-prod/server/app/api/health/route.js.nft.json +1 -1
  79. package/.next-prod/server/app/api/html-apps/[id]/route.js.nft.json +1 -1
  80. package/.next-prod/server/app/api/html-apps/route.js.nft.json +1 -1
  81. package/.next-prod/server/app/api/jupyter/load/route.js.nft.json +1 -1
  82. package/.next-prod/server/app/api/jupyter/save/route.js.nft.json +1 -1
  83. package/.next-prod/server/app/api/jupyter/shutdown/route.js.nft.json +1 -1
  84. package/.next-prod/server/app/api/kimi/credentials/route.js.nft.json +1 -1
  85. package/.next-prod/server/app/api/kimi/models/route.js.nft.json +1 -1
  86. package/.next-prod/server/app/api/kimi/usage/route.js.nft.json +1 -1
  87. package/.next-prod/server/app/api/lsp/definition/route.js.nft.json +1 -1
  88. package/.next-prod/server/app/api/lsp/hover/route.js.nft.json +1 -1
  89. package/.next-prod/server/app/api/lsp/references/route.js.nft.json +1 -1
  90. package/.next-prod/server/app/api/lsp/status/route.js.nft.json +1 -1
  91. package/.next-prod/server/app/api/lsp/warmup/route.js.nft.json +1 -1
  92. package/.next-prod/server/app/api/mysql/columns/route.js.nft.json +1 -1
  93. package/.next-prod/server/app/api/mysql/connect/route.js.nft.json +1 -1
  94. package/.next-prod/server/app/api/mysql/disconnect/route.js.nft.json +1 -1
  95. package/.next-prod/server/app/api/mysql/export/route.js.nft.json +1 -1
  96. package/.next-prod/server/app/api/mysql/query/route.js.nft.json +1 -1
  97. package/.next-prod/server/app/api/mysql/schemas/route.js.nft.json +1 -1
  98. package/.next-prod/server/app/api/neo4j/connect/route.js.nft.json +1 -1
  99. package/.next-prod/server/app/api/neo4j/disconnect/route.js.nft.json +1 -1
  100. package/.next-prod/server/app/api/neo4j/query/route.js.nft.json +1 -1
  101. package/.next-prod/server/app/api/neo4j/schema/route.js.nft.json +1 -1
  102. package/.next-prod/server/app/api/note/route.js.nft.json +1 -1
  103. package/.next-prod/server/app/api/ollama/config/route.js.nft.json +1 -1
  104. package/.next-prod/server/app/api/ollama/models/route.js.nft.json +1 -1
  105. package/.next-prod/server/app/api/ollama/start/route.js.nft.json +1 -1
  106. package/.next-prod/server/app/api/open-cursor/route.js.nft.json +1 -1
  107. package/.next-prod/server/app/api/open-vscode/route.js.nft.json +1 -1
  108. package/.next-prod/server/app/api/pick-folder/route.js.nft.json +1 -1
  109. package/.next-prod/server/app/api/pinned-sessions/route.js.nft.json +1 -1
  110. package/.next-prod/server/app/api/project-settings/route.js.nft.json +1 -1
  111. package/.next-prod/server/app/api/project-state/route.js.nft.json +1 -1
  112. package/.next-prod/server/app/api/projectGraph/affected/route.js.nft.json +1 -1
  113. package/.next-prod/server/app/api/projectGraph/callees/route.js.nft.json +1 -1
  114. package/.next-prod/server/app/api/projectGraph/callers/route.js.nft.json +1 -1
  115. package/.next-prod/server/app/api/projectGraph/coedit/route.js.nft.json +1 -1
  116. package/.next-prod/server/app/api/projectGraph/context/route.js.nft.json +1 -1
  117. package/.next-prod/server/app/api/projectGraph/file/route.js.nft.json +1 -1
  118. package/.next-prod/server/app/api/projectGraph/file-functions/route.js.nft.json +1 -1
  119. package/.next-prod/server/app/api/projectGraph/impact/route.js.nft.json +1 -1
  120. package/.next-prod/server/app/api/projectGraph/related/route.js.nft.json +1 -1
  121. package/.next-prod/server/app/api/projectGraph/risk/route.js.nft.json +1 -1
  122. package/.next-prod/server/app/api/projectGraph/search/route.js.nft.json +1 -1
  123. package/.next-prod/server/app/api/projects/route.js.nft.json +1 -1
  124. package/.next-prod/server/app/api/prompts/config/route.js.nft.json +1 -1
  125. package/.next-prod/server/app/api/push/public-key/route.js.nft.json +1 -1
  126. package/.next-prod/server/app/api/push/subscribe/route.js.nft.json +1 -1
  127. package/.next-prod/server/app/api/push/unsubscribe/route.js.nft.json +1 -1
  128. package/.next-prod/server/app/api/redis/command/route.js.nft.json +1 -1
  129. package/.next-prod/server/app/api/redis/connect/route.js.nft.json +1 -1
  130. package/.next-prod/server/app/api/redis/delete/route.js.nft.json +1 -1
  131. package/.next-prod/server/app/api/redis/disconnect/route.js.nft.json +1 -1
  132. package/.next-prod/server/app/api/redis/get/route.js.nft.json +1 -1
  133. package/.next-prod/server/app/api/redis/keys/route.js.nft.json +1 -1
  134. package/.next-prod/server/app/api/redis/set/route.js.nft.json +1 -1
  135. package/.next-prod/server/app/api/restart/route.js.nft.json +1 -1
  136. package/.next-prod/server/app/api/review/[id]/comments/route.js.nft.json +1 -1
  137. package/.next-prod/server/app/api/review/[id]/replies/route.js.nft.json +1 -1
  138. package/.next-prod/server/app/api/review/[id]/route.js.nft.json +1 -1
  139. package/.next-prod/server/app/api/review/identify/route.js.nft.json +1 -1
  140. package/.next-prod/server/app/api/review/order/route.js.nft.json +1 -1
  141. package/.next-prod/server/app/api/review/route.js.nft.json +1 -1
  142. package/.next-prod/server/app/api/review/share-info/route.js.nft.json +1 -1
  143. package/.next-prod/server/app/api/review/users/route.js.nft.json +1 -1
  144. package/.next-prod/server/app/api/scheduled-tasks/route.js +1 -1
  145. package/.next-prod/server/app/api/scheduled-tasks/route.js.nft.json +1 -1
  146. package/.next-prod/server/app/api/services/config/route.js.nft.json +1 -1
  147. package/.next-prod/server/app/api/services/scripts/route.js.nft.json +1 -1
  148. package/.next-prod/server/app/api/session/[sessionId]/fork/route.js.nft.json +1 -1
  149. package/.next-prod/server/app/api/session/[sessionId]/history/route.js.nft.json +1 -1
  150. package/.next-prod/server/app/api/session-by-path/route.js.nft.json +1 -1
  151. package/.next-prod/server/app/api/sessions/projects/[encodedPath]/route.js.nft.json +1 -1
  152. package/.next-prod/server/app/api/sessions/projects/route.js.nft.json +1 -1
  153. package/.next-prod/server/app/api/sessions/route.js.nft.json +1 -1
  154. package/.next-prod/server/app/api/settings/route.js.nft.json +1 -1
  155. package/.next-prod/server/app/api/shutdown/route.js.nft.json +1 -1
  156. package/.next-prod/server/app/api/skills/[id]/route.js.nft.json +1 -1
  157. package/.next-prod/server/app/api/skills/content/route.js.nft.json +1 -1
  158. package/.next-prod/server/app/api/skills/route.js.nft.json +1 -1
  159. package/.next-prod/server/app/api/snapshots/blob/route.js.nft.json +1 -1
  160. package/.next-prod/server/app/api/snapshots/diff/route.js.nft.json +1 -1
  161. package/.next-prod/server/app/api/snapshots/route.js.nft.json +1 -1
  162. package/.next-prod/server/app/api/terminal/aliases/route.js.nft.json +1 -1
  163. package/.next-prod/server/app/api/terminal/autocomplete/route.js.nft.json +1 -1
  164. package/.next-prod/server/app/api/terminal/bubble-order/route.js.nft.json +1 -1
  165. package/.next-prod/server/app/api/terminal/env/route.js.nft.json +1 -1
  166. package/.next-prod/server/app/api/terminal/history/route.js.nft.json +1 -1
  167. package/.next-prod/server/app/api/update/route.js.nft.json +1 -1
  168. package/.next-prod/server/app/api/update-state/route.js.nft.json +1 -1
  169. package/.next-prod/server/app/api/version/route.js.nft.json +1 -1
  170. package/.next-prod/server/app/apps/[...path]/route.js.nft.json +1 -1
  171. package/.next-prod/server/app/favicon.ico/route.js.nft.json +1 -1
  172. package/.next-prod/server/app/m/page.js +1 -1
  173. package/.next-prod/server/app/m/page.js.nft.json +1 -1
  174. package/.next-prod/server/app/m/page_client-reference-manifest.js +1 -1
  175. package/.next-prod/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  176. package/.next-prod/server/app/page.js +1 -1
  177. package/.next-prod/server/app/page.js.nft.json +1 -1
  178. package/.next-prod/server/app/page_client-reference-manifest.js +1 -1
  179. package/.next-prod/server/app/project/page.js +1 -1
  180. package/.next-prod/server/app/project/page.js.nft.json +1 -1
  181. package/.next-prod/server/app/project/page_client-reference-manifest.js +1 -1
  182. package/.next-prod/server/app/review/[id]/page.js +1 -1
  183. package/.next-prod/server/app/review/[id]/page.js.nft.json +1 -1
  184. package/.next-prod/server/app/review/[id]/page_client-reference-manifest.js +1 -1
  185. package/.next-prod/server/app-paths-manifest.json +4 -4
  186. package/.next-prod/server/chunks/3286.js +2 -2
  187. package/.next-prod/server/chunks/{3641.js → 3583.js} +1 -1
  188. package/.next-prod/server/chunks/5750.js +6 -5
  189. package/.next-prod/server/chunks/6548.js +1 -1
  190. package/.next-prod/server/chunks/9830.js +1 -1
  191. package/.next-prod/server/middleware-build-manifest.js +1 -1
  192. package/.next-prod/server/pages/404.html +2 -2
  193. package/.next-prod/server/pages/500.html +1 -1
  194. package/.next-prod/server/server-reference-manifest.json +1 -1
  195. package/.next-prod/static/chunks/{33372-5305e3772ba46050.js → 33372-a2d65ba0d112fc24.js} +13 -12
  196. package/.next-prod/static/chunks/{46784-ff535f686b295919.js → 46784-24ed72109d7c318b.js} +1 -1
  197. package/.next-prod/static/chunks/{5504-583edbefcb22ed17.js → 87834-dfec736663e6aac2.js} +2 -2
  198. package/.next-prod/static/chunks/app/{layout-65e8647a35bd5ef0.js → layout-9585d7901d2a6c15.js} +1 -1
  199. package/.next-prod/static/chunks/app/{page-6931b763a22d95be.js → page-340e8a5ca67a0dad.js} +1 -1
  200. package/.next-prod/static/chunks/app/project/{page-6931b763a22d95be.js → page-340e8a5ca67a0dad.js} +1 -1
  201. package/.next-prod/trace +15 -15
  202. package/.next-prod/trace-build +1 -1
  203. package/dist/{chunk-SAKRITIQ.mjs → chunk-6EMR3NZV.mjs} +6 -3
  204. package/dist/scheduledTasks.mjs +14 -7
  205. package/dist/wsServer.mjs +1 -1
  206. package/package.json +3 -3
  207. /package/.next-prod/static/{U8R610UNAk7MWsuSmrm28 → MM6vZhLQFwtUo_vz7BSfe}/_buildManifest.js +0 -0
  208. /package/.next-prod/static/{U8R610UNAk7MWsuSmrm28 → MM6vZhLQFwtUo_vz7BSfe}/_ssgManifest.js +0 -0
@@ -1,4 +1,4 @@
1
- exports.id=5750,exports.ids=[5750],exports.modules={208:(a,b,c)=>{"use strict";c.d(b,{A:()=>g});var d=c(529);let e=JSON.parse('{"common":{"save":"Save","cancel":"Cancel","delete":"Delete","close":"Close","minimize":"Minimize","copy":"Copy","edit":"Edit","file":"File","codeMap":"Code Map","diff":"Diff","confirm":"Confirm","loading":"Loading...","search":"Search","refresh":"Refresh","retry":"Retry","submit":"Submit","copied":"Copied","saved":"Saved","failed":"Failed","noMatch":"No matches","noData":"No data","done":"Done","justNow":"just now","minutesAgo":"{{count}}m ago","hoursAgo":"{{count}}h ago","daysAgo":"{{count}}d ago","monthsAgo":"{{count}}mo ago","yearsAgo":"{{count}}y ago","saveFailed":"Save failed","copyFailed":"Copy failed","deleteFailed":"Delete failed","operationFailed":"Operation failed","copiedPath":"Path copied","copyPath":"Copy path","openInConsole":"Open in Console bubble","copyAbsPath":"Copy absolute path","loadMore":"Load more","noResult":"No results","selected":"Selected","selectAll":"Select all","hint":"Notice","confirmBtn":"OK","cancelBtn":"Cancel","preview":"Preview","readable":"Readable","previous":"Previous","next":"Next","all":"All","input":"Input","result":"Result","line":"Line","lines":"lines","running":"Running","connecting":"Connecting","connected":"Connected","connectionFailed":"Connection failed","builtin":"Built-in","global":"Global","project":"Project","current":"Current","code":"Code"},"htmlApps":{"title":"HTML Apps","addTooltip":"Add to HTML panel","added":"Added to HTML panel","alreadyAdded":"Already added","addFailed":"Failed to add","add":"Add","adding":"Adding...","addHtmlApp":"Add HTML app","searchPlaceholder":"Search HTML apps...","pathLabel":"Absolute path to the .html file","invalid":"Invalid","builtin":"Built-in","noDescription":"No description","emptyNoApps":"No custom HTML apps yet.","emptyCreatePrefix":"Use","emptyCreateSuffix":"in chat to create a new app.","addExisting":"add an existing HTML file","viewDocs":"view docs","emptyNoMatch":"No HTML apps match your search."},"skills":{"addTooltip":"Add to Skills panel","added":"Added to Skills panel","alreadyAdded":"Already added","addFailed":"Failed to add","title":"Skills","searchPlaceholder":"Search skills...","clearSearch":"Clear","addSkill":"Add Skill","emptyNoSkills":"No skills yet.","emptyIntroPrefix":"Use","emptyIntroSuffix":"in chat to distil a reusable workflow into a SKILL.md file.","emptyNoMatch":"No skills match your search.","viewDocs":"view docs","pathLabel":"Absolute path to SKILL.md","pathPlaceholder":"/Users/you/.../skills/foo/SKILL.md","add":"Add","adding":"Adding...","invalid":"Invalid","copyPath":"Copy path","noDescription":"No description","previewTitle":"Skill Preview","source":"Source","cannotRead":"File cannot be read."},"toast":{"savedSuccess":"Saved","saveFailed":"Save failed","copiedName":"Copied: {{name}}","copyFailed":"Copy failed","deleteFailed":"Delete failed","operationFailed":"Operation failed","staged":"Staged","stageFailed":"Stage failed","unstaged":"Unstaged","unstageFailed":"Unstage failed","stagedNFiles":"Staged {{count}} files","unstagedNFiles":"Unstaged {{count}} files","discardFailed":"Discard failed","discardedNFiles":"Discarded changes in {{count}} files","deletedFile":"File deleted","discardedChanges":"Changes discarded","pastedFile":"Pasted: {{name}}","pasteFailed":"Paste failed","noFileToPaste":"No file to paste","createdFile":"Created: {{name}}","createFailed":"Create failed","movedToTrash":"Moved to trash: {{name}}","copiedPageUrl":"Page URL copied","copiedDirPath":"Directory path copied","switchedToBranch":"Switched to {{branch}}","switchBranchFailed":"Branch switch failed","loadBranchFailed":"Failed to load branches","copiedCommand":"Copied: {{command}}","copiedMessage":"Message copied","forkFailed":"Failed to fork session","excerptFailed":"Failed to excerpt this turn","copiedUrl":"URL copied","copiedOutput":"Output copied","copiedCmd":"Command copied","copiedComment":"Comment copied","copiedAllComments":"All comments copied","copiedFileContent":"File content copied","copiedQA":"Copied {{count}} Q&A","copiedAllQA":"All Q&A copied","sentQA":"Sent to AI","readFileFailed":"Failed to read file","fileOutsideProject":"File is outside this project — only Markdown, CSV and images can be previewed","reviewCreated":"Review created, link copied","reviewUpdated":"Review updated, link copied","reviewCreateFailed":"Failed to create review","sharingClosed":"Sharing disabled","sharingCloseFailed":"Failed to disable sharing","linkCopied":"Link copied","addCommentFailed":"Failed to add comment","deleteCommentFailed":"Failed to delete comment","editCommentFailed":"Failed to edit comment","addReplyFailed":"Failed to add reply","deleteReplyFailed":"Failed to delete reply","editReplyFailed":"Failed to edit reply","disconnected":"Disconnected: {{id}}","pluginReloading":"Reloading extension...","worktreeCreateSuccess":"Worktree created: {{name}}","worktreeCreateFailed":"Failed to create worktree","worktreeLoadFailed":"Failed to load worktree list","worktreeDeleted":"Worktree deleted","worktreeDeleteFailed":"Failed to delete worktree","worktreeLocked":"Locked","worktreeUnlocked":"Unlocked"},"workspace":{"selectProject":"Select a project to start","searchProjectPath":"Search project path...","loadingProjects":"Loading projects...","projectNotFound":"No projects found","sessions":"{{count}} sessions","loadingSessions":"Loading sessions...","noSessions":"No sessions","loadingText":"Loading...","openProject":"Open Project","expandSidebar":"Expand sidebar","collapseSidebar":"Collapse sidebar","notes":"Notes","skills":"Skills","apps":"Apps","settings":"Settings","help":"Help","updateAvailable":"v{{version}} available","copyUpgradeCommand":"Copy cockpit update","updateNow":"Update now","updating":"Updating…","updateComplete":"Update complete","updateFailed":"Update failed","updateCardPreparing":"Preparing update…","updateCardInstalling":"Downloading and installing","updateCardRepairing":"Repairing native dependency","updateCardUpToDate":"Already on the latest version, v{{version}}","updateCardCopyFix":"Copy fix command","updateCardFixCopied":"Fix command copied","updateCardRollingBack":"Install failed, rolling back","updateCardRestarting":"Restarting Cockpit…","updateCardDone":"Updated to v{{version}}","updateCardElapsed":"{{seconds}}s elapsed","updateCardBaseline":"last time ~{{seconds}}s","updateCardNoLiveStatus":"Live status unavailable; the update is still running","updateCardRolledBack":"Rolled back to the previous version; Cockpit is usable.","updateCardManualHint":"You can retry from a terminal:","updateCardLogHint":"Log: {{path}}","updateRestartNote":"Cockpit will restart in the background.","viewChangelog":"View changelog","serverRestarted":"Cockpit was updated in the background.","reloadNow":"Reload","upgradeCommandCopied":"Copied `cockpit update`","projectNotes":"Project Notes","closeProject":"Close project"},"mobile":{"useDesktop":"Desktop","messagePlaceholder":"Message…","send":"Send","stop":"Stop","enableNotifications":"Enable notifications","disableNotifications":"Disable notifications","notifyError":"Could not enable notifications"},"sessions":{"recentSessions":"Recent Sessions","favorites":"Favorite Sessions","noFavorites":"No favorite sessions yet. Click the star in the tab bar to add.","addFavorite":"Add to favorites","removeFavorite":"Remove from favorites","runningCount":"{{count}} running","unreadCount":"{{count}} unread","noSessions":"No sessions yet","running":"Running","done":"Done","editTitle":"Edit title","projectSessions":"Project Sessions","browseAllSessions":"Browse all sessions","sessionList":"Session List","search":"Search","searchSessions":"Search sessions...","searchRecentSessions":"Search recent sessions","loadSessionsFailed":"Failed to load sessions","loadingSessions":"Loading sessions...","noMatchingSessions":"No matching sessions","noSessionsYet":"No sessions yet","projectList":"Project List","openFolder":"Open Folder","selectingFolder":"Selecting...","loadingHistory":"Loading history..."},"scheduledTasks":{"title":"Scheduled Tasks","aboutToTrigger":"About to trigger","secondsLater":"in {{count}}s","minutesLater":"in {{count}}m","hoursMinutesLater":"in {{h}}h {{m}}m","hoursLater":"in {{h}}h","onceType":"Once ({{minutes}}min)","everyNMinutes":"Every {{minutes}}min","completed":"Completed","paused":"Paused","activeCount":"{{running}} active","pausedCount":"{{paused}} paused","noScheduledTasks":"No scheduled tasks. Click the clock button in the chat input to create one.","lastResult":"Last","runNow":"Run now","resume":"Resume","pause":"Pause","completedCount":"Completed ({{count}})","groupPendingReview":"Finished \xb7 to review","groupUpcoming":"Running \xb7 upcoming","openSession":"Open session","selectTaskHint":"Select a task on the left to preview its session messages","noTaskMessages":"No messages in this task\'s session yet","success":"Success","failure":"Failed","createTask":"Create Scheduled Task","editTask":"Edit Scheduled Task","sendMessage":"Message","messagePlaceholder":"Enter message to send...","taskFile":"Task File","taskFilePlaceholder":"/Users/you/project/tasks/daily-report.md","taskFileHint":"Absolute path. On each fire the agent reads this file first and acts on what it describes — edits take effect on the next run.","taskFilePromptHeader":"Read this task file first, then act accordingly:","type":"Type","once":"Once","interval":"Interval","quickSelect":"Quick Select","customCron":"Custom Cron Expression","customMinutes":"Custom minutes","cronPlaceholder":"e.g. 0 9 * * 1-5 (weekdays at 9am)","cronFormat":"Format: min hour day month weekday (e.g. 0 9 * * 1-5)","minutesPlaceholder":"Minutes","limitTimeRange":"Limit execution time range","to":"to","saveBtn":"Save ({{modKey}}↩)","createBtn":"Create ({{modKey}}↩)","5minLater":"In 5 minutes","15minLater":"In 15 minutes","30minLater":"In 30 minutes","1hourLater":"In 1 hour","every15min":"Every 15 min","every30min":"Every 30 min","every1hour":"Every 1 hour","every2hours":"Every 2 hours","daily9am":"Daily 09:00","daily6pm":"Daily 18:00","weeklyMon9am":"Mon 09:00","monthly1st9am":"1st of month 09:00"},"cron":{"everyNMinutes":"Every {{n}} minutes","everyNHours":"Every {{n}} hours","everyMinute":"Every minute","everyHourAtMin":"Every hour at minute {{m}}","hourlyEveryMin":"{{h}}:xx every minute","daily":"Daily at {{time}}","weekdays":"Weekdays","weekends":"Weekends","dowSun":"Sun","dowMon":"Mon","dowTue":"Tue","dowWed":"Wed","dowThu":"Thu","dowFri":"Fri","dowSat":"Sat","monthPrefix":"","dayOfMonth":"","dayRange":"{{a}}th to {{b}}th","weekdayPrefix":"","weekdayRange":"{{a}} to {{b}}"},"blockViewer":{"empty":{"body":"Select a file in the left tree to see its code map.","hint":"or press ⌘K to search."},"fileMode":{"loading":"Loading…","notFound":"This file is not indexed (unsupported language or beyond the file cap)."},"buildProgress":{"listing":"Listing files…","contexts":"Reading project config…","parsing":"Parsing files","resolving":"Resolving imports…","edges":"Building call graph…","done":"Finishing up…"},"search":{"tooltip":"Search (⌘K)","hint":"Start typing to search","noResults":"No matches","files":"Files","symbols":"Symbols"},"viewerToggle":{"toBlock":"Show code map","toCode":"Back to code view"},"toc":{"title":"this file","empty":"No functions detected.","notIndexed":"File not in project graph (unsupported language / not in git tracked set / file cap reached)."},"history":{"title":"history","empty":"Click an input or output pin to begin tracing.","clear":"Clear history"},"refresh":"Rebuild project graph","retry":"Retry"},"blockDiffViewer":{"loading":"Building code map…","unsupported":"Code map diff is not available for this file type.","unsupportedHint":"Switch back to the regular diff view to read it.","error":"Code map diff failed: {{message}}","noBlockChanges":"No code-map changes (formatting / whitespace only).","noBefore":"(new)","noAfter":"(removed)","kind":{"added":"added","deleted":"deleted","modified":"modified"}},"fileBrowser":{"directoryTree":"Tree","searchTab":"Search","recentTab":"Recent","changesTab":"Status","historyTab":"History","searchFiles":"Search files...","clear":"Clear","exactMatchOn":"Exact match (on)","exactMatchOff":"Exact match (off)","refreshTree":"Refresh directory tree","collapseAll":"Collapse all directories","searchFileContent":"Search file contents...","caseSensitive":"Case sensitive","wholeWord":"Whole word","regex":"Regex","fileTypes":"File types (ts,tsx)","compareMode":"Compare","compareModeOff":"Close branch comparison","compareModeOn":"Compare with selected branch","createFile":"New File","createFileIn":"New File (in {{path}}/)","fileName":"File name...","noRecentFiles":"No recent files","stagingArea":"Staged ({{count}})","changesSummary_one":"{{count}} change","changesSummary_other":"{{count}} changes","noChanges":"No changes in working tree","refreshChanges":"Refresh changes","unstageAll":"Unstage all","noStagedFiles":"No staged files","unstageNFiles":"Unstage {{count}} files","unstageFile":"Unstage","workspace":"Workspace ({{count}})","discardAll":"Discard all","stageAll":"Stage all","noUnstagedChanges":"No unstaged changes","discardNFiles":"Discard changes in {{count}} files","stageNFiles":"Stage {{count}} files","discardChanges":"Discard changes","stageFile":"Stage file","loadingDiff":"Loading diff...","noDiffFiles":"No diff files","nFilesChanged":"{{count}} files changed (vs {{branch}})","loadingCommits":"Loading commits...","noCommits":"No commits","allLoaded":"All {{count}} records loaded","locateInTree":"Locate in directory tree","unsaved":"Unsaved","saveBeforeSwitch":"Current file has unsaved changes. Save before switching?","saveAndSwitch":"Save and switch","closeEdit":"Close edit (ESC)","closeBtn":"Close","copyFileContent":"Copy file content","toggleJsonReadable":"Toggle JSON readable mode","previewMarkdown":"Preview Markdown","exitPreview":"Exit Preview","collapseAllJson":"Fold","expandAllJson":"Full","viewBlame":"View line-by-line change history","viewDiff":"View changes against HEAD","exitDiff":"Exit Diff","diffLoadFailed":"Failed to load diff","editFile":"Edit file","backToPreview":"Back to preview","cannotPreview":"Cannot preview this file","selectFileToPreview":"Select a file to preview","staged":"Staged","unstaged":"Unstaged","selectFileToViewDiff":"Select a file to view diff","loadingDiffContent":"Loading diff...","clickCompareToLoad":"Click \\"Compare\\" to load branch diff","selectCommitToView":"Select a commit to view details","confirmDelete":"Confirm Delete","confirmDeleteMessage":"Move <file>{{name}}</file> to trash?","nFilesNMatches":"{{files}} files, {{matches}} matches","resultsTruncated":"Results truncated","noContentSearchResults":"No results","enterKeywordToSearch":"Enter keyword to search file contents","searchMinChars":"Search requires at least 2 characters"},"csv":{"table":"Table","raw":"Raw","empty":"Empty table","summary":"{{rows}} rows \xb7 {{cols}} columns","summaryFiltered":"{{rows}} / {{total}} rows matched \xb7 {{cols}} columns","loadMore":"Load more ({{shown}} / {{total}} shown)","filterPlaceholder":"Filter rows…","filterColumn":"Filter column","clearFilter":"Clear filter","allColumns":"All columns","noMatch":"No matching rows","sortHint":"Click to sort (asc / desc / off)"},"codeViewer":{"fileModifiedExternally":"File was modified externally. Saving will overwrite external changes.","useDiskVersion":"Use disk version","forceOverwrite":"Force overwrite","searchPlaceholder":"Search...","caseSensitive":"Case sensitive","wholeWordMatch":"Whole word match","unsavedConfirm":"You have unsaved changes. Close anyway?","discardChanges":"Discard changes","continueEditing":"Continue editing","unsavedExitConfirm":"You have unsaved changes. Exit edit mode?","clickToViewDetails":"Click to view details","clickToViewCommit":"Click to view commit details","nComments":"{{count}} comments","searchChat":"Search chat...","prevShiftEnter":"Previous (Shift+Enter)","nextEnter":"Next (Enter)","closeEsc":"Close (Esc)"},"chat":{"startConversation":"Start a conversation","loadMoreHistory":"Load more...","scrollUpForMore":"↑ Scroll up to load more history","jumpToStart":"Jump to start","jumpToLatest":"Jump to latest","jumpToPrevUserMessage":"Previous user message","jumpToNextUserMessage":"Next user message","copyMessage":"Copy message","copyImage":"Copy image","copiedImage":"Image copied","forkSession":"Fork session from here","excerptTurn":"Excerpt this turn to a new session","imageN":"Image {{index}}","imagePreview":"Image preview","toolCalls":"{{count}} tool calls","collapse":"▲ Collapse","expand":"▼ Expand","subagent":"Subagent","subagentEmpty":"No subagent transcript found","subagentViewTitle":"View subagent transcript","workflowRun":"Run details","workflowViewTitle":"View workflow run details","workflowEmpty":"No workflow run journal found","workflowAgents":"agents","workflowViewAgent":"View","workflowUngrouped":"Ungrouped","viewQuestions":"View questions","viewAllFileChanges":"View all file changes","requestFailed":"Request failed","cannotReadStream":"Cannot read response stream","errorRetry":"An error occurred, please retry","placeholder":"Type a message, Enter to send (Shift+Enter for new line, paste images; start a line with / (main session) or @ (subagent) for commands, multiple allowed)","placeholderDisabled":"Generating... you can keep typing (ESC to cancel; if stuck, cancel and resend \'continue\')","imageSizeLimit":"Image size exceeds limit (max 5MB), current: {{size}}MB","viewGitChanges":"View Git changes","viewAllComments":"View all comments","userMessages":"User messages","projectNotes":"Project Notes","scheduledTasks":"Scheduled Tasks","quickPrompts":"Quick Prompts","globalPrompts":"Global Prompts","projectPrompts":"Project Prompts","noQuickPrompts":"No quick prompts yet","addQuickPrompt":"Add quick prompt","quickPromptPlaceholder":"One-line prompt — Enter to save, Esc to cancel","context":"Context","output":"Output","copiedCommandTooltip":"Copied!","copyCommandTooltip":"Copy command: {{command}}","executedCommand":"Executed `{{command}}`{{exitInfo}}, output:\\n```\\n{{output}}\\n```","executedCommandFailed":"Failed to execute `{{command}}`: {{error}}","executionMode":"Execution Mode","checkBalance":"Check balance","balanceFailed":"Query failed — check the API key","balanceNeedsKey":"Set a DeepSeek API key first","balanceUnavailable":"Account is not available for requests","balanceEmpty":"No balance returned","openUsagePage":"Open DeepSeek usage console","checkQuota":"Check quota","quotaFailed":"Quota unavailable — check the API key","quotaNeedsKey":"Set an API key first","quotaEmpty":"No quota returned","quotaResetAt":"Resets {{time}}","openProviderConsole":"Open the provider console","planMode":"Plan mode","planModeDesc":"read-only \xb7 plan first, no edits","planModeOn":"Plan mode on — read-only; send a task to get a plan","planModeOff":"Plan mode off","planModeHint":"Plan mode: read-only exploration that produces a plan without editing. Uncheck and resend to implement.","noHistory":"Independent task","noHistoryDesc":"no history sent","noHistoryHint":"Independent task: each message is sent to the model on its own, with no prior conversation. The transcript above still records everything.","planTitle":"Plan (awaiting your review)","approvePlan":"Approve & run","planApproveHint":"No approval dialog here — click to exit plan mode and execute","approvePlanPrompt":"Approved — proceed with the plan above."},"console":{"enterCommandOrUrl":"Enter a command or URL to start","emptyIntro":"Type any of the following in the input bar to create a bubble:","bubbleCommand":"Command","bubbleInteractive":"Interactive","bubbleBrowser":"Browser","bubbleBrowserNoteIframe":"Some sites block iframe embedding — install Cockpit Bridge under Settings → Browser Extension before opening.","bubbleBrowserNoteCookie":"If a logged-in site first shows as signed out, refresh a few times to restore it.","bubbleDatabase":"Database","bubbleNotebook":"Notebook","loadingMore":"Loading...","loadMoreHistory":"Load more history","quickCommands":"Quick Commands","singleColumn":"Single column","dualColumn":"Dual column","envVars":"Environment Variables","launchShell":"Launch interactive shell","htmlApps":"HTML apps","inputPlaceholder":"Enter command or URL and press Enter... (↑↓ history, Tab complete)","scopeProject":"Project","scopeGlobal":"Global","tabSwitchEscClose":"Tab to switch \xb7 Esc to close","copyOutput":"Copy output","copyCommand":"Copy command","rerun":"Re-run","deleteRecord":"Delete record","searchPlaceholder":"Search...","searchMode":"Search","filterMode":"Filter","prevShiftEnter":"Previous (Shift+Enter)","nextEnter":"Next (Enter)","loadingTerminal":"Loading terminal...","clickToInput":"Click terminal area to type","stdinPlaceholder":"stdin input...","runningText":"Running...","exitCode":"Exit code: {{code}}","totalLines":"{{count}} lines total","globalCommands":"Global Commands","projectCommands":"Project Commands","noCustomCommands":"No custom commands yet","namePlaceholder":"Name","commandPlaceholder":"Command","restoreTooltip":"Restore ({{modKey}}M / ESC)","screenshotting":"Screenshotting...","outputFileDeleted":"[Output file deleted]"},"browser":{"blankPage":"Blank page","copyUrl":"Copy URL","openInNewWindow":"Open in new window","exitMaximize":"Exit maximize ({{modKey}}M)","maximize":"Maximize ({{modKey}}M)","pageLoadFailed":"Page load failed","clickToWake":"Click to wake","sleeping":"Sleeping","loadingPage":"Loading...","loadFailed":"Load failed"},"database":{"connectionFailed":"Connection failed","connected":"Connected","connecting":"Connecting...","refreshTableList":"Refresh table list","filterTable":"T Tables","filterView":"V Views","noTables":"No tables","tabStructure":"Structure","tabData":"Data","tabSql":"SQL","filterActive":"Filter: {{count}} cols","clearAllFilters":"Clear all filters","deleteNRows":"Delete {{count}} rows","confirmDeleteRows":"Confirm delete?","copyCsvSelected":"Copy selected rows as CSV","copyCsvAll":"Export all as CSV","copyJsonSelected":"Copy selected rows as JSON","copyJsonAll":"Export all as JSON","copyCSV":"Copy CSV","CSV":"CSV","copyJSON":"Copy JSON","JSON":"JSON","selectTable":"Select a table","selectTableToView":"Select a table to view structure","selectTableForData":"Select a table to view data","columns":"Columns","colName":"Name","colType":"Type","colNullable":"Nullable","colDefault":"Default","primaryKey":"Primary Key","foreignKeys":"Foreign Keys","indexes":"Indexes","enable":"Enable","commaValues":"Comma-separated values","likePattern":"%pattern%","valuePlaceholder":"Value","apply":"Apply","clearFilter":"Clear","addRow":"+ Add Row","totalRows":"{{count}} rows","rowsAffected":"{{command}} — {{count}} rows affected ({{duration}}ms)","queryRows":"{{count}} rows ({{duration}}ms)","resultTruncated":"[Results truncated to 1000 rows]","sqlPlaceholder":"Enter SQL... ({{modKey}}Enter to execute)","executing":"Executing...","execute":"▶ Execute","deleteRowsFailed":"{{count}} rows failed to delete","inputParams":"Input Parameters","resultLabel":"Result"},"mysql":{"connectionFailed":"Connection failed","connected":"Connected","connecting":"Connecting...","refreshTableList":"Refresh table list","filterTable":"T Tables","filterView":"V Views","noTables":"No tables","tabStructure":"Structure","tabData":"Data","tabSql":"SQL","filterActive":"Filter: {{count}} cols","clearAllFilters":"Clear all filters","deleteNRows":"Delete {{count}} rows","confirmDeleteRows":"Confirm delete?","copyCsvSelected":"Copy selected rows as CSV","copyCsvAll":"Export all as CSV","copyJsonSelected":"Copy selected rows as JSON","copyJsonAll":"Export all as JSON","copyCSV":"Copy CSV","CSV":"CSV","copyJSON":"Copy JSON","JSON":"JSON","selectTable":"Select a table","selectTableToView":"Select a table to view structure","selectTableForData":"Select a table to view data","columns":"Columns","colName":"Name","colType":"Type","colNullable":"Nullable","colDefault":"Default","primaryKey":"Primary Key","foreignKeys":"Foreign Keys","indexes":"Indexes","enable":"Enable","commaValues":"Comma-separated values","likePattern":"%pattern%","valuePlaceholder":"Value","apply":"Apply","clearFilter":"Clear","addRow":"+ Add Row","totalRows":"{{count}} rows","rowsAffected":"{{command}} — {{count}} rows affected ({{duration}}ms)","queryRows":"{{count}} rows ({{duration}}ms)","resultTruncated":"[Results truncated to 1000 rows]","sqlPlaceholder":"Enter SQL... ({{modKey}}Enter to execute)","executing":"Executing...","execute":"▶ Execute","deleteRowsFailed":"{{count}} rows failed to delete"},"redis":{"neverExpires":"Never expires","expired":"Expired","loadFailed":"Load failed","deleteFailed":"Delete failed","saveFailed":"Save failed","scanPlaceholder":"SCAN pattern...","scanSearch":"Search (SCAN)","noKeys":"No keys","loadMore":"Load more...","tabData":"Data","tabInfo":"Info","tabCli":"CLI","selectKey":"Select a key","keyNotExist":"Key does not exist","unsupportedType":"Unsupported type: {{type}}","nItems":"{{total}} items","showingN":"showing {{count}}","nMembers":"{{total}} members","nEntries":"{{total}} entries","cliHint":"Enter Redis commands, e.g. PING, GET key, KEYS *","cliPlaceholder":"Enter command..."},"git":{"switchBranch":"Switch branch","searchBranch":"Search branches...","noBranches":"No branches available","noMatchingBranches":"No matching branches","localBranches":"Local Branches","remoteBranches":"Remote Branches","branchNotFound":"Branch not found","selectBranch":"Select branch...","currentBranch":"Current","notGitRepo":"Current directory is not a Git repository","cannotGetBranches":"Cannot get branch info","getBranchesFailed":"Failed to get branch info","discardAllConfirm":"Discard changes in {{count}} workspace files? This cannot be undone.","worktree":{"title":"Git Worktree","count":"{{count}} worktrees","selectBranch":"Select branch","addWorktree":"+ Add Worktree","confirmDelete":"Confirm Delete","confirmDeleteMsg":"Delete this worktree?","path":"Path:","branch":"Branch:","locked":"Locked","unlock":"Unlock","lock":"Lock","searchBranch":"Search branches...","noBranches":"No available branches"}},"comments":{"addComment":"Add Comment","lineRange":"Line {{start}}-{{end}}","inputPlaceholder":"Enter comment...","newComment":"New comment {{range}}","commentPlaceholder":"Enter comment... ({{modKey}}Enter to submit, Esc to cancel)","nComments":"{{count}} comments","allComments":"All Comments","copyAllComments":"Copy all comments","noComments":"No comments yet","clearAll":"Clear all","totalComments":"{{count}} comments total","aiReply":"AI Reply","noContent":"(no content)","linesCount":"({{count}} lines)","codeRef":"Here are my annotated comments and references:","note":"Note: {{content}}","submitting":"Submitting...","enterSubmit":"Enter to submit \xb7 Shift+Enter for new line","submitComment":"Submit Comment","askAI":"Ask AI","inputQuestion":"Enter your question...","aiGenerating":"Generating, please wait...","enterSend":"Enter to send \xb7 Shift+Enter for new line","sendToAI":"Send to AI","aiResponding":"AI is responding..."},"fileContextMenu":{"createFile":"New File","copyFile":"Copy File","copyFolder":"Copy Folder","pasteHere":"Paste Here","deleteFile":"Delete File","deleteFolder":"Delete Folder","copyRelativePath":"Copy Relative Path","copyAbsolutePath":"Copy Absolute Path","copyRelativeDirPath":"Copy Relative Dir Path","copyAbsoluteDirPath":"Copy Absolute Dir Path","copyFileName":"Copy File Name","copyFolderName":"Copy Folder Name"},"settings":{"title":"Settings","theme":"Theme","themeLight":"Light","themeDark":"Dark","themeSystem":"System","browserExtension":"Browser Extension","extensionInstalled":"Cockpit Bridge installed","extensionNotInstalled":"Cockpit Bridge not installed","extensionDescription":"After installing the Chrome extension, link navigation in iframes will be intercepted: new tab links create new bubbles, page navigation updates the current bubble.","installSteps":"Installation steps:","step1":"1. Open Chrome and navigate to","step2":"2. Enable \\"Developer mode\\" in the top-right corner","step3":"3. Click \\"Load unpacked\\"","step4mac":"4. Press <kbd>Cmd+Shift+G</kbd> → paste the path below → Enter","copyExtensionPath":"Copy extension directory path","reloadExtension":"Reload extension","about":"About","language":"Language","languageAuto":"System","switchDark":"Switch to dark","switchLight":"Switch to light","agentsBundled":"bundled"},"editor":{"placeholder":"Write something... Type / for commands","noteTitle":"{{name}} - Notes","noteUntitled":"Notes","saving":"Saving...","conflictReloaded":"This note was changed elsewhere. Loaded the latest version; your recent unsaved edits were discarded.","linkPlaceholder":"Enter URL...","confirmLink":"Confirm","removeLink":"Remove link","heading1":"Heading 1","heading2":"Heading 2","heading3":"Heading 3","bold":"Bold","italic":"Italic","strikethrough":"Strikethrough","inlineCode":"Inline code","link":"Link","bulletList":"Bullet list","orderedList":"Ordered list","taskList":"Task list","blockquote":"Blockquote","codeBlock":"Code block","table":"Table","horizontalRule":"Horizontal rule","insertRowAbove":"Insert row above","insertRowBelow":"Insert row below","insertColumnLeft":"Insert column left","insertColumnRight":"Insert column right","deleteRow":"Delete row","deleteColumn":"Delete column","deleteTable":"Delete table","deleteCodeBlock":"Delete code block","toc":"TOC","expandToc":"Expand TOC","collapseToc":"Collapse TOC"},"slashCommands":{"heading1":"Heading 1","heading1Desc":"Large heading","heading2":"Heading 2","heading2Desc":"Medium heading","heading3":"Heading 3","heading3Desc":"Small heading","bulletList":"Bullet List","bulletListDesc":"Bulleted list","orderedList":"Ordered List","orderedListDesc":"Numbered list","taskList":"Task List","taskListDesc":"Checkable task list","blockquote":"Blockquote","blockquoteDesc":"Quote block","codeBlock":"Code Block","codeBlockDesc":"Code snippet","table":"Table","tableDesc":"Insert 3\xd73 table","horizontalRule":"Divider","horizontalRuleDesc":"Horizontal divider","link":"Link","linkDesc":"Insert hyperlink"},"commands":{"qa":"Enter requirements clarification mode","fx":"Enter bug evidence-chain analysis mode","ex":"Enter structured analysis & discussion mode","go":"Enter landing mode: MVP staged implementation","cg":"Enter CodeGraph exploration mode","plan":"Enable plan mode \xb7 /plan <task> to plan it \xb7 /plan off to disable"},"review":{"reviewManagement":"Review Management","allReviews":"All Reviews","noOpenReviews":"No open reviews","viewComments":"View comments","nComments":"{{count}} comments","nDocs":"{{count}} docs","nReviews":"{{count}} reviews","docList":"Document List","allReviewsList":"All Reviews","expandList":"Expand list","collapseList":"Collapse list","closeReview":"Close review","reopenReview":"Reopen","deleteReview":"Delete review","noOpenDocs":"No open documents","noReviews":"No reviews","sharing":"Sharing","notShared":"Not shared","closeSharing":"Disable sharing","enableSharing":"Enable sharing","view":"View","setNickname":"Set your nickname","nicknameHint":"Other reviewers will see this name","nicknamePlaceholder":"Enter nickname","skipForNow":"Skip for now","identitySettings":"Identity Settings","reviewNickname":"Review Nickname","random":"Random","selectTextToComment":"Select text to add comment","selectTextHint":"Select text on the left to add a comment","prevComment":"Previous","nextComment":"Next","commentsCount":"{{count}} comments","commentsNavCount":"{{current}}/{{total}} comments","allCommentsTitle":"All Comments","commentsCountBrief":"{{count}}","closedCount":"{{count}} closed","copyAllComments":"Copy all comments","noComments":"No comments yet","closedComments":"Closed ({{count}})","closedLabel":"Closed","moreReplies":"+{{count}} replies","copyComment":"Copy comment","reopen":"Reopen","closeComment":"Close comment","editComment":"Edit comment","deleteComment":"Delete comment","edited":"(edited)","editReply":"Edit reply","deleteReply":"Delete reply","reply":"Reply","replyPlaceholder":"Add a reply...","selectedText":"Selected text","addCommentPlaceholder":"Add a comment...","enterSubmitHint":"Enter to submit, Shift+Enter for new line","commentBtn":"Comment","reviewNotExist":"Review does not exist or has been deleted","loadFailed":"Load failed","networkError":"Network error","reviewNotFound":"Review not found","checkLink":"Please check the link","updatedAt":"Updated {{date}}","active":"Active","closed":"Closed","viewAllComments":"View all comments","viewCommentBtn":"View Comments","copyLink":"Copy Link","reviewSummary":"Review Comments Summary — {{title}}","totalNComments":"{{count}} comments total","quoteRef":"Quote: \\"{{text}}\\"","commentAuthor":"Comment ({{author}}): {{content}}","replyAuthor":" ↳ {{author}}: {{content}}"},"markdown":{"copied":"✓ Copied","copy":"Copy"},"imagePreview":{"previewImage":"Preview image","deleteImage":"Delete image","copyImage":"Copy image","copiedImage":"Image copied"},"tokenStats":{"title":"Claude Code Token Stats","activeHours":"Active Hours Distribution","hourSessions":"{{h}}:00 — {{count}} sessions","messages":"Messages","toolCalls":"Tool Calls","activityTrend":"Activity Trend","byModel":"By Model","tokenUsage":"Token Usage","equivalentCost":"Equivalent Cost","modelCostDetail":"Model Cost Details","model":"Model","share":"Share","total":"Total","totalSessions":"Total Sessions","totalMessages":"Total Messages","equivalentApiCost":"Equivalent API Cost","longestSession":"Longest Session","firstUse":"First Use","notFound":"~/.claude/stats-cache.json not found","day":"Day","week":"Week","month":"Month"},"toolCall":{"inputParams":"Input Parameters","resultLabel":"Result","inputParamsTitle":"View input parameters","resultTitle":"View result","input":"Input","result":"Result","foldedLines":"... ({{count}} lines)"},"fileEditor":{"unsavedConfirm":"You have unsaved changes. Close anyway?","discardChanges":"Discard changes","continueEditing":"Continue editing","externallyModified":"File was modified externally. Saving will overwrite external changes.","useDiskVersion":"Use disk version","forceOverwrite":"Force overwrite"},"quickFileOpen":{"placeholder":"Type file name to open...","noMatch":"No matching files","recent":"Recent","selectHint":"Select","openHint":"Open","closeHint":"Close"},"envManager":{"title":"Environment Variables","tabScope":"Current Tab Only","globalScope":"Global Environment Variables","varNamePlaceholder":"Variable name (e.g. NODE_ENV)","varValuePlaceholder":"Value (e.g. production)","valuePlaceholder":"Value","noVars":"No environment variables yet. Add one to get started."},"aliasManager":{"title":"Command Aliases","description":"Set shortcut aliases for common commands (global)","aliasPlaceholder":"Alias (e.g. ll)","commandPlaceholder":"Full command (e.g. ls -la)","fullCommandPlaceholder":"Full command","usage":"Usage tip:","usageDesc":"Type an alias to execute the corresponding full command","noAliases":"No command aliases yet. Add one to get started."},"diffViewer":{"fileChanges":"File Changes ({{count}})","toggleFileTree":"Toggle file tree","selectFileToView":"Select a file to view changes","sideBySide":"Side by side","unified":"Unified","viewSplit":"Split","viewUnified":"Unified","previewFile":"Preview file","copiedAll":"Full text copied","compact":"Compact","full":"Full","gap":{"hidden":"{{count}} lines hidden","more":"\xb7\xb7\xb7 more +{{count}} \xb7\xb7\xb7","expandUp":"Expand {{count}} lines up","expandDown":"Expand {{count}} lines down"},"loadingSnapshots":"Loading snapshots…","noChanges":"No file changes detected in this turn","notViewable":"Binary or oversized file — diff not viewable","externalChange":"Concurrent change from another session/process","reconstructed":"reconstructed","reconstructedHint":"Rebuilt from tool-call parameters — not a disk snapshot","truncated":"Too many files — list truncated","imageBefore":"Before","imageAfter":"After","imageAdded":"Added","imageDeleted":"Deleted","imageLoadFailed":"Failed to load image","imageUnavailable":"Image not present in either revision"},"commitDetail":{"title":"Commit Details","hash":"Hash:","author":"Author:","date":"Date:","files":"Files:","nChanges":"{{count}} changes","loadingFiles":"Loading files...","noFileChanges":"No file changes","loadingDiff":"Loading diff...","selectFileToView":"Select a file to view diff"},"askQuestion":{"title":"Questions","nQuestions":"{{count}} questions","checkedN":"{{count}} checked","copyChecked":"Copy {{count}} checked Q&A","copyAll":"Copy all Q&A","sendChecked":"Send {{count}} checked Q&A to AI","sendAll":"Send all Q&A to AI","sendNoChat":"No active chat session","checkToCopy":"Check to copy","custom":"Custom","customPlaceholder":"Enter custom answer...","notSelected":"(not selected)"},"tabBar":{"closeTab":"Close tab","closeAll":"Close all tabs","newTab":"New tab"},"tabManagerTopBar":{"copyPageUrl":"Copy page URL","copyDirPath":"Copy directory path","refreshProject":"Refresh project","openInVSCode":"Open in VS Code","openInCursor":"Open in Cursor","aliasesGlobal":"Command Aliases (Global)","tokenStats":"Token Stats","openSurething":"Open Surething"},"hoverTooltip":{"findReferences":"Find References","search":"Search"},"todoViewer":{"title":"Task List","progress":"{{completed}} / {{total}} done"},"userMessages":{"title":"User Messages","noMessages":"No user messages"},"shortIdBadge":{"clickToDisconnect":"Click to disconnect","clickToRegister":"Click to register and copy CLI command","setTitle":"Name this bubble (so /cc can find it later)","setTitlePlaceholder":"set title","editTitle":"Edit title","titleSet":"Title: {{title}}","dialogTitle":"Name this bubble","dialogPlaceholder":"e.g. alloydb proxy, staging admin"},"api":{"pathForbidden":"Operation not allowed on this path","deleteForbidden":"Delete not allowed on this path","notAFolder":"Target is not a folder","imageTooLarge":"Image too large to preview","cannotPreviewBinary":"Cannot preview binary file","fileTooLarge":"File too large to preview (over 10MB)","fileModifiedExternally":"File was modified externally","pickFolderPrompt":"Select project folder"},"confirm":{"title":"Notice","ok":"OK","cancel":"Cancel"},"floatingToolbar":{"addComment":"Add Comment","sendToAI":"Send to AI","search":"Search"},"quickReply":{"optionA":"A","optionB":"B","optionC":"C","optionD":"D","allRecommended":"Rest recommended","thisOne":"This one","notThis":"Not this","why":"Why?","elaborate":"Say more","example":"Give an example","start":"Do it","continue":"Continue","ok":"OK","done":"Done","edit":"Edit quick replies","editTitle":"Edit quick replies","editHint":"One line per row; separate phrases with commas. Each phrase is sent to the chat exactly as written.","editPlaceholder":"This one, Not this\\nWhy?, Say more","restoreDefault":"Restore defaults","save":"Save","cancel":"Cancel","customizedFor":"Customizing the {{lang}} phrases — the other language is unaffected.","langEn":"English","langZh":"Chinese","saveFailed":"Failed to save quick replies"},"searchResults":{"title":"Search Results","nMatches":"({{count}} matches)","searching":"Searching...","noResults":"No matches","scopeSelected":"Selected","scopeAll":"All"},"references":{"title":"References","searching":"Searching...","notFound":"No references found"},"gitFileTree":{"noFiles":"No files"},"deps":{"action":"Dependencies","none":"none","symbolMessage":"Analyse the dependencies of {{name}} ({{path}}:{{lines}}).\\n\\nCallers: {{callers}}\\nCalls: {{callees}}\\nExternal: {{externals}}\\n\\nExplain which modules it is coupled to, and which of those dependencies could be narrowed."},"explain":{"action":"Explain","fileMessage":"Explain {{path}}","symbolMessage":"Explain {{name}} ({{path}}:{{lines}})","selectionMessage":"Explain","commitFileMessage":"Explain what git commit {{hash}} changed in {{path}}","compareFileMessage":"Explain the git changes to {{path}} in {{base}}..HEAD","stagedFileMessage":"Explain the git staged changes to {{path}}","unstagedFileMessage":"Explain the git working tree changes to {{path}}"},"reviewUtils":{"adjectives":["Happy","Brave","Quiet","Bright","Gentle","Agile","Free","Clear","Flying","Relaxed","Lively","Wise","Calm","Alert","Composed","Steady","Cheerful","Warm","Bold","Poised"],"nouns":["Panda","Dolphin","Crane","Snow Leopard","Skylark","Squirrel","Flying Fish","Deer","Bluebird","Silver Fox","Owl","Dragonfly","Firefly","Sea Turtle","Butterfly","Monkey","Red-crowned Crane","Antelope","Swallow","Penguin"]}}'),f=JSON.parse('{"common":{"save":"保存","cancel":"取消","delete":"删除","close":"关闭","minimize":"最小化","copy":"复制","edit":"编辑","file":"文件","codeMap":"代码地图","diff":"Diff","confirm":"确认","loading":"加载中...","search":"搜索","refresh":"刷新","retry":"重试","submit":"提交","copied":"已复制","saved":"已保存","failed":"失败","noMatch":"无匹配","noData":"无数据","done":"完成","justNow":"刚刚","minutesAgo":"{{count}}分钟前","hoursAgo":"{{count}}小时前","daysAgo":"{{count}}天前","monthsAgo":"{{count}}个月前","yearsAgo":"{{count}}年前","saveFailed":"保存失败","copyFailed":"复制失败","deleteFailed":"删除失败","operationFailed":"操作失败","copiedPath":"已复制路径","copyPath":"复制路径","openInConsole":"在 Console 气泡打开","copyAbsPath":"复制绝对路径","loadMore":"加载更多","noResult":"无匹配结果","selected":"已选择","selectAll":"全选","hint":"提示","confirmBtn":"确定","cancelBtn":"取消","preview":"预览","readable":"可读","previous":"上一个","next":"下一个","all":"全部","input":"输入","result":"结果","line":"行","lines":"行","running":"运行中","connecting":"连接中","connected":"已连接","connectionFailed":"连接失败","builtin":"内置","global":"全局","project":"项目","current":"当前","code":"代码"},"htmlApps":{"title":"HTML 应用","addTooltip":"添加到 HTML 面板","added":"已添加到 HTML 面板","alreadyAdded":"已添加过","addFailed":"添加失败","add":"添加","adding":"添加中...","addHtmlApp":"添加 HTML 应用","searchPlaceholder":"搜索 HTML 应用...","pathLabel":".html 文件的绝对路径","invalid":"无效","builtin":"内置","noDescription":"无描述","emptyNoApps":"还没有自定义 HTML 应用。","emptyCreatePrefix":"在聊天里使用","emptyCreateSuffix":"创建新应用。","addExisting":"添加已有 HTML 文件","viewDocs":"查看文档","emptyNoMatch":"没有匹配的 HTML 应用。"},"skills":{"addTooltip":"添加到 Skills 面板","added":"已添加到 Skills 面板","alreadyAdded":"已添加过","addFailed":"添加失败","title":"Skills","searchPlaceholder":"搜索 skills...","clearSearch":"清除","addSkill":"添加 Skill","emptyNoSkills":"还没有 skill。","emptyIntroPrefix":"在聊天里使用","emptyIntroSuffix":"把可复用经验整理成 SKILL.md。","emptyNoMatch":"没有匹配的 skill。","viewDocs":"查看文档","pathLabel":"SKILL.md 的绝对路径","pathPlaceholder":"/Users/you/.../skills/foo/SKILL.md","add":"添加","adding":"添加中...","invalid":"无效","copyPath":"复制路径","noDescription":"无描述","previewTitle":"Skill 预览","source":"源码","cannotRead":"无法读取文件。"},"toast":{"savedSuccess":"已保存","saveFailed":"保存失败","copiedName":"已复制: {{name}}","copyFailed":"复制失败","deleteFailed":"删除失败","operationFailed":"操作失败","staged":"已暂存","stageFailed":"暂存失败","unstaged":"已取消暂存","unstageFailed":"取消暂存失败","stagedNFiles":"已暂存 {{count}} 个文件","unstagedNFiles":"已取消暂存 {{count}} 个文件","discardFailed":"放弃变更失败","discardedNFiles":"已放弃 {{count}} 个文件的变更","deletedFile":"已删除文件","discardedChanges":"已放弃变更","pastedFile":"已粘贴: {{name}}","pasteFailed":"粘贴失败","noFileToPaste":"没有可粘贴的文件","createdFile":"已创建文件: {{name}}","createFailed":"创建失败","movedToTrash":"已移动到回收站: {{name}}","copiedPageUrl":"已复制页面地址","copiedDirPath":"已复制目录路径","switchedToBranch":"已切换到 {{branch}}","switchBranchFailed":"切换分支失败","loadBranchFailed":"加载分支列表失败","copiedCommand":"已复制: {{command}}","copiedMessage":"已复制消息","forkFailed":"分叉会话失败","excerptFailed":"摘录本轮失败","copiedUrl":"已复制网址","copiedOutput":"已复制输出","copiedCmd":"已复制命令","copiedComment":"已复制评论","copiedAllComments":"已复制全部评论","copiedFileContent":"已复制文件内容","copiedQA":"已复制 {{count}} 个问答","copiedAllQA":"已复制所有问答","sentQA":"已发送给 AI","readFileFailed":"读取文件失败","fileOutsideProject":"文件在当前项目之外,仅支持预览 Markdown、CSV 和图片","reviewCreated":"评审已创建,链接已复制","reviewUpdated":"评审已更新,链接已复制","reviewCreateFailed":"创建评审失败","sharingClosed":"已关闭分享","sharingCloseFailed":"关闭分享失败","linkCopied":"链接已复制","addCommentFailed":"添加评论失败","deleteCommentFailed":"删除评论失败","editCommentFailed":"编辑评论失败","addReplyFailed":"添加回复失败","deleteReplyFailed":"删除回复失败","editReplyFailed":"编辑回复失败","disconnected":"已断开: {{id}}","pluginReloading":"插件重载中...","worktreeCreateSuccess":"Worktree 创建成功: {{name}}","worktreeCreateFailed":"创建 worktree 失败","worktreeLoadFailed":"加载 worktree 列表失败","worktreeDeleted":"Worktree 已删除","worktreeDeleteFailed":"删除 worktree 失败","worktreeLocked":"已锁定","worktreeUnlocked":"已解锁"},"workspace":{"selectProject":"选择一个项目开始","searchProjectPath":"搜索项目路径...","loadingProjects":"加载项目中...","projectNotFound":"未找到项目","sessions":"{{count}} 会话","loadingSessions":"加载会话...","noSessions":"无会话记录","loadingText":"加载中...","openProject":"打开项目","expandSidebar":"展开侧边栏","collapseSidebar":"折叠侧边栏","notes":"笔记","skills":"技能","apps":"应用","settings":"设置","help":"帮助","updateAvailable":"新版本 v{{version}} 可用","copyUpgradeCommand":"复制 cockpit update","updateNow":"立即更新","updating":"正在更新…","updateComplete":"更新完成","updateFailed":"更新失败","updateCardPreparing":"正在准备更新…","updateCardInstalling":"正在下载并安装","updateCardRepairing":"正在修复原生依赖","updateCardUpToDate":"已是最新版本 v{{version}}","updateCardCopyFix":"复制修复命令","updateCardFixCopied":"已复制修复命令","updateCardRollingBack":"安装失败,正在回滚","updateCardRestarting":"正在重启 Cockpit…","updateCardDone":"已更新到 v{{version}}","updateCardElapsed":"已用 {{seconds}} 秒","updateCardBaseline":"上次约 {{seconds}} 秒","updateCardNoLiveStatus":"暂时读不到实时状态,更新仍在进行","updateCardRolledBack":"已回滚到原版本,Cockpit 可正常使用。","updateCardManualHint":"可在终端手动重试:","updateCardLogHint":"日志:{{path}}","updateRestartNote":"Cockpit 将在后台重启。","viewChangelog":"查看变更日志","serverRestarted":"Cockpit 已在后台更新。","reloadNow":"刷新","upgradeCommandCopied":"已复制 `cockpit update`","projectNotes":"项目笔记","closeProject":"关闭项目"},"mobile":{"useDesktop":"桌面版","messagePlaceholder":"发消息…","send":"发送","stop":"停止","enableNotifications":"开启通知","disableNotifications":"关闭通知","notifyError":"无法开启通知"},"sessions":{"recentSessions":"最近会话","favorites":"收藏会话","noFavorites":"暂无收藏会话,在 Tab 栏点击星标可添加","addFavorite":"收藏此会话","removeFavorite":"取消收藏","runningCount":"{{count}} 运行中","unreadCount":"{{count}} 未读","noSessions":"暂无会话记录","running":"运行中","done":"完成","editTitle":"编辑标题","projectSessions":"项目会话","browseAllSessions":"浏览所有会话","sessionList":"会话列表","search":"搜索","searchSessions":"搜索会话...","searchRecentSessions":"搜索最近会话","loadSessionsFailed":"加载会话失败","loadingSessions":"加载会话中...","noMatchingSessions":"未找到匹配的会话","noSessionsYet":"暂无会话","projectList":"项目列表","openFolder":"打开文件夹","selectingFolder":"选择中...","loadingHistory":"加载历史消息..."},"scheduledTasks":{"title":"定时任务","aboutToTrigger":"即将触发","secondsLater":"{{count}}秒后","minutesLater":"{{count}}分钟后","hoursMinutesLater":"{{h}}小时{{m}}分后","hoursLater":"{{h}}小时后","onceType":"一次性 ({{minutes}}分钟)","everyNMinutes":"每{{minutes}}分钟","completed":"已完成","paused":"已暂停","activeCount":"{{running}} 个活跃","pausedCount":"{{paused}} 个暂停","noScheduledTasks":"暂无定时任务,在聊天输入栏点击时钟按钮创建","lastResult":"上次","runNow":"立即运行","resume":"恢复","pause":"暂停","completedCount":"已完成 ({{count}})","groupPendingReview":"运行完成待查看","groupUpcoming":"运行中 \xb7 待运行","openSession":"打开会话","selectTaskHint":"选择左侧任务,查看它的会话消息","noTaskMessages":"该任务的会话暂无消息","success":"成功","failure":"失败","createTask":"创建定时任务","editTask":"编辑定时任务","sendMessage":"发送消息","messagePlaceholder":"输入要发送的消息...","taskFile":"任务文件","taskFilePlaceholder":"/Users/you/project/tasks/daily-report.md","taskFileHint":"填写绝对路径。触发时会让 agent 先读取该文件,再按其中描述执行——文件内容改动下次触发即生效。","taskFilePromptHeader":"请先读取以下任务文件,再据此执行:","type":"类型","once":"一次性","interval":"周期","quickSelect":"快捷选择","customCron":"自定义 Cron 表达式","customMinutes":"自定义分钟数","cronPlaceholder":"例: 0 9 * * 1-5 (工作日9点)","cronFormat":"格式:分 时 日 月 星期(如 0 9 * * 1-5)","minutesPlaceholder":"分钟数","limitTimeRange":"限制执行时段","to":"至","saveBtn":"保存 ({{modKey}}↩)","createBtn":"创建 ({{modKey}}↩)","5minLater":"5 分钟后","15minLater":"15 分钟后","30minLater":"30 分钟后","1hourLater":"1 小时后","every15min":"每 15 分钟","every30min":"每 30 分钟","every1hour":"每 1 小时","every2hours":"每 2 小时","daily9am":"每天 09:00","daily6pm":"每天 18:00","weeklyMon9am":"每周一 09:00","monthly1st9am":"每月 1 号 09:00"},"cron":{"everyNMinutes":"每 {{n}} 分钟","everyNHours":"每 {{n}} 小时整点","everyMinute":"每分钟","everyHourAtMin":"每小时第 {{m}} 分","hourlyEveryMin":"{{h}} 点每分钟","daily":"每天 {{time}}","weekdays":"工作日","weekends":"周末","dowSun":"日","dowMon":"一","dowTue":"二","dowWed":"三","dowThu":"四","dowFri":"五","dowSat":"六","monthPrefix":"月","dayOfMonth":"号","dayRange":"{{a}}号到{{b}}号","weekdayPrefix":"周","weekdayRange":"周{{a}}到周{{b}}"},"blockViewer":{"empty":{"body":"在左侧文件树选择一个文件,查看它的代码地图。","hint":"或按 ⌘K 搜索。"},"fileMode":{"loading":"加载中…","notFound":"该文件未索引(不支持的语言或超出文件上限)。"},"buildProgress":{"listing":"正在扫描文件…","contexts":"正在读取项目配置…","parsing":"正在解析文件","resolving":"正在解析引用关系…","edges":"正在构建调用图…","done":"即将完成…"},"search":{"tooltip":"搜索 (⌘K)","hint":"开始输入以搜索","noResults":"未找到匹配","files":"文件","symbols":"符号"},"viewerToggle":{"toBlock":"显示代码地图","toCode":"返回代码视图"},"toc":{"title":"本文件","empty":"未检测到函数。","notIndexed":"该文件未被项目图收录(扩展未支持 / 不在 git 跟踪集 / 超出文件上限)。"},"history":{"title":"历史","empty":"点击左右两侧的 pin 开始追踪调用链。","clear":"清空历史"},"refresh":"重新构建项目图","retry":"重试"},"blockDiffViewer":{"loading":"正在生成代码地图…","unsupported":"该文件类型暂不支持代码地图 diff","unsupportedHint":"切回常规 diff 视图查看。","error":"代码地图 diff 失败:{{message}}","noBlockChanges":"代码地图无变化(仅格式或空白)。","noBefore":"(新增)","noAfter":"(已删除)","kind":{"added":"新增","deleted":"删除","modified":"修改"}},"fileBrowser":{"directoryTree":"目录树","searchTab":"搜索","recentTab":"最近","changesTab":"变更","historyTab":"历史","searchFiles":"搜索文件...","clear":"清除","exactMatchOn":"全词匹配(已开启)","exactMatchOff":"全词匹配(已关闭)","refreshTree":"刷新目录树","collapseAll":"折叠所有目录","searchFileContent":"搜索文件内容...","caseSensitive":"区分大小写","wholeWord":"完整词","regex":"正则","fileTypes":"文件类型 (ts,tsx)","compareMode":"对比","compareModeOff":"关闭分支对比","compareModeOn":"与选定分支对比","createFile":"新建文件","createFileIn":"新建文件 (在 {{path}}/)","fileName":"文件名...","noRecentFiles":"暂无最近浏览的文件","stagingArea":"暂存区 ({{count}})","changesSummary_one":"{{count}} 个变更","changesSummary_other":"{{count}} 个变更","noChanges":"工作区无变更","refreshChanges":"刷新变更列表","unstageAll":"全部取消","noStagedFiles":"无暂存的文件","unstageNFiles":"取消暂存 {{count}} 个文件","unstageFile":"取消暂存","workspace":"工作区 ({{count}})","discardAll":"放弃所有","stageAll":"全部暂存","noUnstagedChanges":"无未暂存的变更","discardNFiles":"放弃 {{count}} 个文件的变更","stageNFiles":"暂存 {{count}} 个文件","discardChanges":"放弃变更","stageFile":"暂存文件","loadingDiff":"加载对比文件中...","noDiffFiles":"无差异文件","nFilesChanged":"{{count}} 个文件变更(vs {{branch}})","loadingCommits":"加载提交记录中...","noCommits":"无提交记录","allLoaded":"已加载全部 {{count}} 条记录","locateInTree":"在目录树中定位","unsaved":"未保存","saveBeforeSwitch":"当前文件有未保存的修改,是否保存后切换?","saveAndSwitch":"保存并切换","closeEdit":"关闭编辑 (ESC)","closeBtn":"关闭","copyFileContent":"复制文件内容","toggleJsonReadable":"切换 JSON 可读模式","previewMarkdown":"预览 Markdown 渲染效果","exitPreview":"退出预览","collapseAllJson":"折叠","expandAllJson":"展开","viewBlame":"查看每行代码的修改记录","viewDiff":"查看相对 HEAD 的改动","exitDiff":"退出 Diff","diffLoadFailed":"加载差异失败","editFile":"编辑文件","backToPreview":"返回预览","cannotPreview":"无法预览此文件","selectFileToPreview":"选择文件以预览","staged":"已暂存","unstaged":"未暂存","selectFileToViewDiff":"选择文件查看差异","loadingDiffContent":"加载差异中...","clickCompareToLoad":"点击「对比」加载分支差异","selectCommitToView":"选择提交查看详情","confirmDelete":"确认删除","confirmDeleteMessage":"确定要将 <file>{{name}}</file> 移动到回收站吗?","nFilesNMatches":"{{files}} 个文件,{{matches}} 处匹配","resultsTruncated":"结果已截断","noContentSearchResults":"无匹配结果","enterKeywordToSearch":"输入关键词搜索文件内容","searchMinChars":"搜索内容至少需要 2 个字符"},"csv":{"table":"表格","raw":"原始内容","empty":"空表格","summary":"{{rows}} 行 \xb7 {{cols}} 列","summaryFiltered":"匹配 {{rows}} / {{total}} 行 \xb7 {{cols}} 列","loadMore":"加载更多(已显示 {{shown}} / {{total}})","filterPlaceholder":"筛选内容…","filterColumn":"筛选列","clearFilter":"清除筛选","allColumns":"全部列","noMatch":"没有匹配的行","sortHint":"点击排序(升序 / 降序 / 取消)"},"codeViewer":{"fileModifiedExternally":"文件已被外部修改,保存将覆盖外部更改","useDiskVersion":"使用磁盘版本","forceOverwrite":"强制覆盖","searchPlaceholder":"搜索...","caseSensitive":"区分大小写","wholeWordMatch":"全字匹配","unsavedConfirm":"有未保存的修改,确定关闭?","discardChanges":"放弃修改","continueEditing":"继续编辑","unsavedExitConfirm":"有未保存的修改,确定退出编辑模式?","clickToViewDetails":"点击查看详情","clickToViewCommit":"点击查看 commit 详情","nComments":"{{count}} 条评论","searchChat":"搜索聊天内容...","prevShiftEnter":"上一个 (Shift+Enter)","nextEnter":"下一个 (Enter)","closeEsc":"关闭 (Esc)"},"chat":{"startConversation":"开始对话吧","loadMoreHistory":"加载更多...","scrollUpForMore":"↑ 向上滚动加载更多历史","jumpToStart":"跳转到开始","jumpToLatest":"跳转到最新","jumpToPrevUserMessage":"上一条用户消息","jumpToNextUserMessage":"下一条用户消息","copyMessage":"复制消息","copyImage":"复制图片","copiedImage":"已复制图片","forkSession":"从此处分叉会话","excerptTurn":"摘录本轮到新会话","imageN":"图片 {{index}}","imagePreview":"图片预览","toolCalls":"{{count}} 个工具调用","collapse":"▲ 收起","expand":"▼ 展开","subagent":"子代理","subagentEmpty":"未找到子代理消息记录","subagentViewTitle":"查看子代理执行过程","workflowRun":"运行详情","workflowViewTitle":"查看工作流运行详情","workflowEmpty":"未找到工作流运行记录","workflowAgents":"个代理","workflowViewAgent":"查看","workflowUngrouped":"未分组","viewQuestions":"查看提问","viewAllFileChanges":"查看所有文件变更","requestFailed":"请求失败","cannotReadStream":"无法读取响应流","errorRetry":"发生错误,请重试","placeholder":"输入消息,Enter 发送(Shift+Enter 换行,可粘贴图片;行首 /(主会话)或 @(子代理)唤起命令,支持多行多命令)","placeholderDisabled":"生成中... 可继续输入 (ESC 取消;卡住太久可取消后重发「继续」)","imageSizeLimit":"图片大小超过限制(最大 5MB),当前大小: {{size}}MB","viewGitChanges":"查看 Git 变更","viewAllComments":"查看所有评论","userMessages":"用户消息列表","projectNotes":"项目笔记","scheduledTasks":"定时任务","quickPrompts":"快捷 Prompt","globalPrompts":"全局 Prompt","projectPrompts":"项目 Prompt","noQuickPrompts":"暂无快捷 Prompt","addQuickPrompt":"新增快捷 Prompt","quickPromptPlaceholder":"输入一句话 Prompt,Enter 保存,Esc 取消","context":"上下文","output":"输出","copiedCommandTooltip":"已复制!","copyCommandTooltip":"复制命令: {{command}}","executedCommand":"执行了 `{{command}}`{{exitInfo}},输出:\\n```\\n{{output}}\\n```","executedCommandFailed":"执行 `{{command}}` 失败:{{error}}","executionMode":"执行模式","checkBalance":"查询余额","balanceFailed":"查询失败,请检查 API Key","balanceNeedsKey":"请先配置 DeepSeek API Key","balanceUnavailable":"账户当前不可用","balanceEmpty":"接口未返回余额","openUsagePage":"打开 DeepSeek 用量控制台","checkQuota":"查询额度","quotaFailed":"额度查询失败,请检查 API Key","quotaNeedsKey":"请先设置 API Key","quotaEmpty":"未返回额度信息","quotaResetAt":"{{time}} 重置","openProviderConsole":"打开服务商控制台","planMode":"计划模式","planModeDesc":"只读\xb7先出计划不改代码","planModeOn":"已开启计划模式——只读;发一个任务即可拿到计划","planModeOff":"已关闭计划模式","planModeHint":"计划模式:只读探索、产出计划但不改文件。取消勾选后重发才会实现。","noHistory":"独立任务","noHistoryDesc":"不发送历史","noHistoryHint":"独立任务:每条消息单独发给模型,不带之前的对话。上方的会话记录照常保留。","planTitle":"计划(待你确认)","approvePlan":"批准并执行","planApproveHint":"本环境无审批弹窗,点此退出计划模式并执行","approvePlanPrompt":"已批准,按上述计划开始执行。"},"console":{"enterCommandOrUrl":"输入命令或网址开始使用","emptyIntro":"在下方输入框输入以下内容,即可创建对应气泡:","bubbleCommand":"命令","bubbleInteractive":"交互终端","bubbleBrowser":"浏览器","bubbleBrowserNoteIframe":"部分网站会拦截 iframe 嵌入,请在「设置 → 浏览器插件」安装 Cockpit Bridge 后再打开。","bubbleBrowserNoteCookie":"已登录的网站若首次显示未登录,多刷新几次即可恢复。","bubbleDatabase":"数据库","bubbleNotebook":"笔记本","loadingMore":"加载中...","loadMoreHistory":"加载更多历史","quickCommands":"快捷命令","singleColumn":"单列布局","dualColumn":"双列布局","envVars":"环境变量","launchShell":"启动交互终端","htmlApps":"HTML 应用","inputPlaceholder":"输入命令或网址并按 Enter... (↑↓ 历史, Tab 补全)","scopeProject":"项目","scopeGlobal":"全局","tabSwitchEscClose":"Tab 切换 \xb7 Esc 关闭","copyOutput":"复制输出","copyCommand":"复制命令","rerun":"重新运行","deleteRecord":"删除记录","searchPlaceholder":"搜索...","searchMode":"搜索","filterMode":"过滤","prevShiftEnter":"上一个 (Shift+Enter)","nextEnter":"下一个 (Enter)","loadingTerminal":"加载终端...","clickToInput":"点击终端区域输入","stdinPlaceholder":"stdin 输入...","runningText":"运行中...","exitCode":"退出代码: {{code}}","totalLines":"共 {{count}} 行","globalCommands":"全局命令","projectCommands":"项目命令","noCustomCommands":"暂无自定义命令","namePlaceholder":"名称","commandPlaceholder":"命令","restoreTooltip":"还原 ({{modKey}}M / ESC)","screenshotting":"截图中...","outputFileDeleted":"[输出文件已删除]"},"browser":{"blankPage":"空白页","copyUrl":"复制网址","openInNewWindow":"在新窗口打开","exitMaximize":"退出最大化 ({{modKey}}M)","maximize":"最大化 ({{modKey}}M)","pageLoadFailed":"页面加载失败","clickToWake":"点击唤醒","sleeping":"已休眠","loadingPage":"加载中...","loadFailed":"加载失败"},"database":{"connectionFailed":"连接失败","connected":"已连接","connecting":"连接中...","refreshTableList":"刷新表列表","filterTable":"T 表","filterView":"V 视图","noTables":"无表","tabStructure":"结构","tabData":"数据","tabSql":"SQL","filterActive":"筛选: {{count}}列","clearAllFilters":"清除所有筛选","deleteNRows":"删除 {{count}} 行","confirmDeleteRows":"确认删除?","copyCsvSelected":"复制选中行为 CSV","copyCsvAll":"导出全表 CSV","copyJsonSelected":"复制选中行为 JSON","copyJsonAll":"导出全表 JSON","copyCSV":"复制 CSV","CSV":"CSV","copyJSON":"复制 JSON","JSON":"JSON","selectTable":"选择左侧表格","selectTableToView":"选择表以查看结构","selectTableForData":"选择表以查看数据","columns":"列","colName":"名称","colType":"类型","colNullable":"可空","colDefault":"默认值","primaryKey":"主键","foreignKeys":"外键","indexes":"索引","enable":"启用","commaValues":"逗号分隔多值","likePattern":"%pattern%","valuePlaceholder":"值","apply":"应用","clearFilter":"清除","addRow":"+ 新增行","totalRows":"{{count}} 行","rowsAffected":"{{command}} — {{count}} 行受影响 ({{duration}}ms)","queryRows":"{{count}} 行 ({{duration}}ms)","resultTruncated":"[结果已截断至1000行]","sqlPlaceholder":"输入 SQL... ({{modKey}}Enter 执行)","executing":"执行中...","execute":"▶ 执行","deleteRowsFailed":"{{count}} 行删除失败","inputParams":"输入参数","resultLabel":"结果"},"mysql":{"connectionFailed":"连接失败","connected":"已连接","connecting":"连接中...","refreshTableList":"刷新表列表","filterTable":"T 表","filterView":"V 视图","noTables":"无表","tabStructure":"结构","tabData":"数据","tabSql":"SQL","filterActive":"筛选: {{count}}列","clearAllFilters":"清除所有筛选","deleteNRows":"删除 {{count}} 行","confirmDeleteRows":"确认删除?","copyCsvSelected":"复制选中行为 CSV","copyCsvAll":"导出全表 CSV","copyJsonSelected":"复制选中行为 JSON","copyJsonAll":"导出全表 JSON","copyCSV":"复制 CSV","CSV":"CSV","copyJSON":"复制 JSON","JSON":"JSON","selectTable":"选择左侧表格","selectTableToView":"选择表以查看结构","selectTableForData":"选择表以查看数据","columns":"列","colName":"名称","colType":"类型","colNullable":"可空","colDefault":"默认值","primaryKey":"主键","foreignKeys":"外键","indexes":"索引","enable":"启用","commaValues":"逗号分隔多值","likePattern":"%pattern%","valuePlaceholder":"值","apply":"应用","clearFilter":"清除","addRow":"+ 新增行","totalRows":"{{count}} 行","rowsAffected":"{{command}} — {{count}} 行受影响 ({{duration}}ms)","queryRows":"{{count}} 行 ({{duration}}ms)","resultTruncated":"[结果已截断至1000行]","sqlPlaceholder":"输入 SQL... ({{modKey}}Enter 执行)","executing":"执行中...","execute":"▶ 执行","deleteRowsFailed":"{{count}} 行删除失败"},"redis":{"neverExpires":"永不过期","expired":"已过期","loadFailed":"加载失败","deleteFailed":"删除失败","saveFailed":"保存失败","scanPlaceholder":"SCAN 模式...","scanSearch":"搜索 (SCAN)","noKeys":"无 key","loadMore":"加载更多...","tabData":"数据","tabInfo":"信息","tabCli":"CLI","selectKey":"选择左侧 Key","keyNotExist":"Key 不存在","unsupportedType":"不支持的类型: {{type}}","nItems":"{{total}} items","showingN":"显示 {{count}}","nMembers":"{{total}} members","nEntries":"{{total}} entries","cliHint":"输入 Redis 命令,如 PING, GET key, KEYS *","cliPlaceholder":"输入命令..."},"git":{"switchBranch":"切换分支","searchBranch":"搜索分支...","noBranches":"无可切换分支","noMatchingBranches":"无匹配分支","localBranches":"本地分支","remoteBranches":"远程分支","branchNotFound":"未找到分支","selectBranch":"选择分支...","currentBranch":"当前","notGitRepo":"当前目录不是 Git 仓库","cannotGetBranches":"无法获取分支信息","getBranchesFailed":"获取分支信息失败","discardAllConfirm":"确定要放弃工作区的 {{count}} 个文件的变更吗?此操作不可恢复。","worktree":{"title":"Git Worktree","count":"{{count}} 个 worktree","selectBranch":"选择分支","addWorktree":"+ 添加 Worktree","confirmDelete":"确认删除","confirmDeleteMsg":"确定要删除 worktree 吗?","path":"路径:","branch":"分支:","locked":"已锁定","unlock":"解锁","lock":"锁定","searchBranch":"搜索分支...","noBranches":"无可用分支"}},"comments":{"addComment":"添加评论","lineRange":"行 {{start}}-{{end}}","inputPlaceholder":"输入评论...","newComment":"新评论 {{range}}","commentPlaceholder":"输入评论... ({{modKey}}Enter 提交, Esc 取消)","nComments":"{{count}} 条评论","allComments":"所有评论","copyAllComments":"复制全部评论","noComments":"暂无评论","clearAll":"清空所有","totalComments":"共 {{count}} 条评论","aiReply":"AI 回复","noContent":"(无内容)","linesCount":"({{count}} 行)","codeRef":"以下是我标注的评论和引用:","note":"备注: {{content}}","submitting":"提交中...","enterSubmit":"Enter 提交 \xb7 Shift+Enter 换行","submitComment":"提交评论","askAI":"提问 AI","inputQuestion":"输入你的问题...","aiGenerating":"正在生成中,请稍候...","enterSend":"Enter 发送 \xb7 Shift+Enter 换行","sendToAI":"发送 AI","aiResponding":"AI 正在响应中..."},"fileContextMenu":{"createFile":"新建文件","copyFile":"复制文件","copyFolder":"复制文件夹","pasteHere":"粘贴到此处","deleteFile":"删除文件","deleteFolder":"删除文件夹","copyRelativePath":"复制相对路径","copyAbsolutePath":"复制绝对路径","copyRelativeDirPath":"复制相对文件夹路径","copyAbsoluteDirPath":"复制绝对文件夹路径","copyFileName":"复制文件名","copyFolderName":"复制文件夹名"},"settings":{"title":"设置","theme":"主题","themeLight":"浅色","themeDark":"深色","themeSystem":"跟随系统","browserExtension":"浏览器插件","extensionInstalled":"Cockpit Bridge 已安装","extensionNotInstalled":"Cockpit Bridge 未安装","extensionDescription":"安装 Chrome 插件后,iframe 内的链接跳转将被拦截:新标签链接创建新气泡,页面内导航更新当前气泡。","installSteps":"安装步骤:","step1":"1. 打开 Chrome 地址栏输入","step2":"2. 开启右上角「开发者模式」","step3":"3. 点击「加载已解压的扩展程序」","step4mac":"4. 按 <kbd>Cmd+Shift+G</kbd> → 粘贴下方路径 → 回车","copyExtensionPath":"复制插件目录路径","reloadExtension":"重载插件","about":"关于","language":"语言","languageAuto":"跟随系统","switchDark":"切换暗色","switchLight":"切换亮色","agentsBundled":"内置"},"editor":{"placeholder":"写点什么... 输入 / 打开快捷命令","noteTitle":"{{name}} - 笔记","noteUntitled":"笔记","saving":"保存中...","conflictReloaded":"笔记已被其他地方修改,已加载最新版本,刚才未保存的编辑已丢弃","linkPlaceholder":"输入链接地址...","confirmLink":"确认","removeLink":"移除链接","heading1":"标题 1","heading2":"标题 2","heading3":"标题 3","bold":"粗体","italic":"斜体","strikethrough":"删除线","inlineCode":"行内代码","link":"链接","bulletList":"无序列表","orderedList":"有序列表","taskList":"待办列表","blockquote":"引用","codeBlock":"代码块","table":"表格","horizontalRule":"分割线","insertRowAbove":"在上方插入行","insertRowBelow":"在下方插入行","insertColumnLeft":"在左侧插入列","insertColumnRight":"在右侧插入列","deleteRow":"删除当前行","deleteColumn":"删除当前列","deleteTable":"删除表格","deleteCodeBlock":"删除代码块","toc":"目录","expandToc":"展开目录","collapseToc":"收起目录"},"slashCommands":{"heading1":"标题 1","heading1Desc":"大标题","heading2":"标题 2","heading2Desc":"中标题","heading3":"标题 3","heading3Desc":"小标题","bulletList":"无序列表","bulletListDesc":"项目符号列表","orderedList":"有序列表","orderedListDesc":"编号列表","taskList":"待办列表","taskListDesc":"可勾选的任务列表","blockquote":"引用","blockquoteDesc":"引用块","codeBlock":"代码块","codeBlockDesc":"代码片段","table":"表格","tableDesc":"插入 3\xd73 表格","horizontalRule":"分割线","horizontalRuleDesc":"水平分割线","link":"链接","linkDesc":"插入超链接"},"commands":{"qa":"进入需求澄清讨论模式","fx":"进入 bug 证据链分析模式","ex":"进入结构化分析讨论模式","go":"进入连续落地(MVP)模式","cg":"进入 CodeGraph 探索模式","plan":"开启计划模式 \xb7 /plan <任务> 直接规划该任务 \xb7 /plan off 关闭"},"review":{"reviewManagement":"评审管理","allReviews":"所有评审","noOpenReviews":"暂无开放评审","viewComments":"查看评论","nComments":"{{count}} 条评论","nDocs":"{{count}} 文档","nReviews":"{{count}} 评审","docList":"文档列表","allReviewsList":"所有评审","expandList":"展开列表","collapseList":"折叠列表","closeReview":"关闭评审","reopenReview":"重新开放","deleteReview":"删除评审","noOpenDocs":"暂无开放文档","noReviews":"暂无评审","sharing":"分享中","notShared":"未分享","closeSharing":"关闭分享","enableSharing":"开启分享评审","view":"查看","setNickname":"设置你的昵称","nicknameHint":"其他评审人将看到这个名字","nicknamePlaceholder":"输入昵称","skipForNow":"下次再说","identitySettings":"身份设置","reviewNickname":"评审昵称","random":"随机","selectTextToComment":"选中左侧文本添加评论","selectTextHint":"选中左侧文本即可添加评论","prevComment":"上一条","nextComment":"下一条","commentsCount":"{{count}} 条评论","commentsNavCount":"{{current}}/{{total}} 条评论","allCommentsTitle":"全部评论","commentsCountBrief":"{{count}} 条","closedCount":"{{count}} 条已关闭","copyAllComments":"复制全部评论","noComments":"暂无评论","closedComments":"已关闭 ({{count}})","closedLabel":"已关闭","moreReplies":"+{{count}} 条回复","copyComment":"复制评论","reopen":"重开","closeComment":"关闭评论","editComment":"编辑评论","deleteComment":"删除评论","edited":"(已编辑)","editReply":"编辑回复","deleteReply":"删除回复","reply":"回复","replyPlaceholder":"添加回复...","selectedText":"选中文本","addCommentPlaceholder":"添加评论...","enterSubmitHint":"Enter 提交,Shift+Enter 换行","commentBtn":"评论","reviewNotExist":"评审不存在或已被删除","loadFailed":"加载失败","networkError":"网络错误","reviewNotFound":"评审不存在","checkLink":"请检查链接是否正确","updatedAt":"更新于 {{date}}","active":"开放中","closed":"已关闭","viewAllComments":"查看全部评论","viewCommentBtn":"查看评论","copyLink":"复制链接","reviewSummary":"评审评论汇总 — {{title}}","totalNComments":"共 {{count}} 条评论","quoteRef":"引用: \\"{{text}}\\"","commentAuthor":"评论 ({{author}}): {{content}}","replyAuthor":" ↳ {{author}}: {{content}}"},"markdown":{"copied":"✓ 已复制","copy":"复制"},"imagePreview":{"previewImage":"预览图片","deleteImage":"删除图片","copyImage":"复制图片","copiedImage":"已复制图片"},"tokenStats":{"title":"Claude Code Token 统计","activeHours":"活跃时段分布","hourSessions":"{{h}}:00 — {{count}} 次会话","messages":"消息","toolCalls":"工具调用","activityTrend":"活动趋势","byModel":"按模型","tokenUsage":"Token 用量","equivalentCost":"等效费用","modelCostDetail":"模型费用明细","model":"模型","share":"占比","total":"合计","totalSessions":"总会话","totalMessages":"总消息","equivalentApiCost":"等效 API 费用","longestSession":"最长会话","firstUse":"首次使用","notFound":"未找到 ~/.claude/stats-cache.json","day":"日","week":"周","month":"月"},"toolCall":{"inputParams":"输入参数","resultLabel":"结果","inputParamsTitle":"查看输入参数","resultTitle":"查看结果","input":"输入","result":"结果","foldedLines":"... ({{count}} 行)"},"fileEditor":{"unsavedConfirm":"有未保存的修改,确定关闭?","discardChanges":"放弃修改","continueEditing":"继续编辑","externallyModified":"文件已被外部修改,保存将覆盖外部更改","useDiskVersion":"使用磁盘版本","forceOverwrite":"强制覆盖"},"quickFileOpen":{"placeholder":"输入文件名快速打开...","noMatch":"没有匹配的文件","recent":"最近","selectHint":"选择","openHint":"打开","closeHint":"关闭"},"envManager":{"title":"环境变量管理","tabScope":"当前 Tab 专用","globalScope":"全局环境变量","varNamePlaceholder":"变量名(如 NODE_ENV)","varValuePlaceholder":"值(如 production)","valuePlaceholder":"值","noVars":"还没有环境变量,添加一个试试"},"aliasManager":{"title":"命令别名管理","description":"为常用命令设置快捷别名(全局生效)","aliasPlaceholder":"别名(如 ll)","commandPlaceholder":"完整命令(如 ls -la)","fullCommandPlaceholder":"完整命令","usage":"使用提示:","usageDesc":"输入别名即可执行对应的完整命令","noAliases":"还没有命令别名,添加一个试试"},"diffViewer":{"fileChanges":"文件变更 ({{count}})","toggleFileTree":"切换文件目录","selectFileToView":"选择左侧文件查看变更","sideBySide":"并列对比","unified":"统一对比","viewSplit":"双栏","viewUnified":"单栏","previewFile":"预览文件","copiedAll":"已复制全文","compact":"精简","full":"全文","gap":{"hidden":"已隐藏 {{count}} 行","more":"\xb7\xb7\xb7 更多 +{{count}} \xb7\xb7\xb7","expandUp":"向上展开 {{count}} 行","expandDown":"向下展开 {{count}} 行"},"loadingSnapshots":"正在加载快照…","noChanges":"本轮未检测到文件变更","notViewable":"二进制或超大文件,无法展示 diff","externalChange":"同期其他会话/外部进程的变更","reconstructed":"参数重建","reconstructedHint":"由工具调用参数重建,非磁盘快照","truncated":"文件过多,仅显示部分","imageBefore":"变更前","imageAfter":"变更后","imageAdded":"新增","imageDeleted":"已删除","imageLoadFailed":"图片加载失败","imageUnavailable":"该版本无此图片"},"commitDetail":{"title":"提交详情","hash":"哈希:","author":"作者:","date":"日期:","files":"文件:","nChanges":"{{count}} 个变更","loadingFiles":"加载文件中...","noFileChanges":"无文件变更","loadingDiff":"加载差异中...","selectFileToView":"选择文件查看差异"},"askQuestion":{"title":"提问","nQuestions":"{{count}} 个问题","checkedN":"已勾选 {{count}}","copyChecked":"复制勾选的 {{count}} 个问答","copyAll":"复制所有问答","sendChecked":"发送勾选的 {{count}} 个问答给 AI","sendAll":"发送所有问答给 AI","sendNoChat":"没有可用的聊天会话","checkToCopy":"勾选以复制","custom":"自定义","customPlaceholder":"输入自定义回答...","notSelected":"(未选择)"},"tabBar":{"closeTab":"关闭标签","closeAll":"关闭所有标签","newTab":"新建标签"},"tabManagerTopBar":{"copyPageUrl":"复制页面地址","copyDirPath":"复制目录路径","refreshProject":"刷新当前项目","openInVSCode":"在 VS Code 中打开","openInCursor":"在 Cursor 中打开","aliasesGlobal":"命令别名(全局)","tokenStats":"Token 统计","openSurething":"打开 Surething"},"hoverTooltip":{"findReferences":"查找引用","search":"搜索"},"todoViewer":{"title":"任务列表","progress":"{{completed}} / {{total}} 完成"},"userMessages":{"title":"用户消息列表","noMessages":"暂无用户消息"},"shortIdBadge":{"clickToDisconnect":"点击断开连接","clickToRegister":"点击注册并复制 CLI 命令","setTitle":"给这个气泡命名(便于 /cc 通过 connection list 找到它)","setTitlePlaceholder":"设置标题","editTitle":"编辑标题","titleSet":"标题:{{title}}","dialogTitle":"给气泡命名","dialogPlaceholder":"例如:alloydb 代理、预发管理后台"},"api":{"pathForbidden":"不允许操作此路径","deleteForbidden":"不允许删除此路径","notAFolder":"目标不是文件夹","imageTooLarge":"图片文件过大,无法预览","cannotPreviewBinary":"无法预览二进制文件","fileTooLarge":"文件过大,无法预览(超过 10MB)","fileModifiedExternally":"文件已被外部修改","pickFolderPrompt":"选择项目文件夹"},"confirm":{"title":"提示","ok":"确定","cancel":"取消"},"floatingToolbar":{"addComment":"添加评论","sendToAI":"发送 AI","search":"搜索"},"quickReply":{"optionA":"A","optionB":"B","optionC":"C","optionD":"D","allRecommended":"其他按推荐","thisOne":"就这个","notThis":"不要这样","why":"为什么","elaborate":"展开说","example":"举个例子","start":"开始做","continue":"继续","ok":"OK","done":"做完了","edit":"编辑快捷短语","editTitle":"编辑快捷短语","editHint":"一行对应面板的一行,行内用逗号分隔。每个短语会原样发送到对话。","editPlaceholder":"就这个,不要这样\\n为什么,展开说","restoreDefault":"恢复默认","save":"保存","cancel":"取消","customizedFor":"当前编辑的是{{lang}}短语,另一种语言不受影响。","langEn":"英文","langZh":"中文","saveFailed":"保存快捷短语失败"},"searchResults":{"title":"搜索结果","nMatches":"({{count}} 处匹配)","searching":"搜索中...","noResults":"无匹配结果","scopeSelected":"选中","scopeAll":"全部"},"references":{"title":"引用","searching":"搜索中...","notFound":"未找到引用"},"gitFileTree":{"noFiles":"无文件"},"deps":{"action":"依赖关系","none":"无","symbolMessage":"分析 {{name}} ({{path}}:{{lines}}) 的依赖关系。\\n\\n调用者:{{callers}}\\n调用了:{{callees}}\\n外部依赖:{{externals}}\\n\\n请说明它耦合在哪些模块上,以及哪些依赖是可以收敛掉的。"},"explain":{"action":"解释一下","fileMessage":"解释一下 {{path}}","symbolMessage":"解释一下 {{name}} ({{path}}:{{lines}})","selectionMessage":"解释一下","commitFileMessage":"解释一下 git commit {{hash}} 对 {{path}} 的改动","compareFileMessage":"解释一下 git {{base}}..HEAD 中 {{path}} 的改动","stagedFileMessage":"解释一下 git 暂存区中 {{path}} 的改动","unstagedFileMessage":"解释一下 git 工作区中 {{path}} 的改动"},"reviewUtils":{"adjectives":["快乐","勇敢","安静","明亮","温柔","灵巧","自由","清澈","飞翔","悠闲","活泼","聪慧","淡定","机敏","从容","坚定","爽朗","和煦","奔放","沉稳"],"nouns":["熊猫","海豚","白鹤","雪豹","云雀","松鼠","飞鱼","梅花鹿","青鸟","银狐","猫头鹰","蜻蜓","萤火虫","海龟","蝴蝶","金丝猴","丹顶鹤","羚羊","燕子","企鹅"]}}');d.Ay.isInitialized||d.Ay.init({resources:{en:{translation:e},zh:{translation:f}},lng:"en",fallbackLng:"en",interpolation:{escapeValue:!1}});let g=d.Ay},2122:(a,b,c)=>{"use strict";c.d(b,{J:()=>bm});var d=c(48249),e=c(67484),f=c(44384),g=c(46674),h=c(15273),i=c(62956),j=c(82594),k=c(10316),l=c(72419),m=c(44218),n=c(7833),o=c(34678);function p(a){let b=function(a){let b=0xffffffff;for(let c=0;c<a.length;c++){b^=a.charCodeAt(c);for(let a=0;a<8;a++)b=b>>>1^(1&b?0xedb88320:0)}return(0xffffffff^b)>>>0}(a),c="",d=b;for(let a=0;a<4;a++)c+=String.fromCharCode(97+d%26),d=Math.floor(d/26);return c}var q=c(29939),r=c(33281),s=c(74429);function t({open:a,anchorRef:b,initialValue:c,onCancel:g,onSave:h}){let{t:i}=(0,f.Bd)(),[j,k]=(0,e.useState)(c),[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)(null),p=(0,e.useRef)(null),q=(0,e.useRef)(null);if((0,e.useCallback)(()=>{let a=b.current;if(!a)return;let c=a.getBoundingClientRect(),d=q.current?.offsetHeight??0,e=c.bottom+4;if(d&&e+d>window.innerHeight-8){let a=c.top-4-d;a>=8&&(e=a)}let f=c.left;o({top:e,left:f=Math.max(f=Math.min(f,window.innerWidth-260-8),8)})},[b]),!a||"u"<typeof document)return null;let r=async()=>{if(!l){m(!0);try{await h(j.trim())}finally{m(!1)}}};return(0,s.createPortal)((0,d.jsxs)("div",{ref:q,style:{top:n?.top??0,left:n?.left??0,width:260,visibility:n?"visible":"hidden"},className:"fixed z-[100] rounded-lg border border-border bg-card p-3 shadow-lv3",children:[(0,d.jsx)("div",{className:"mb-2 text-sm font-medium text-foreground",children:i("shortIdBadge.dialogTitle")}),(0,d.jsx)("input",{ref:p,type:"text",value:j,onChange:a=>k(a.target.value.slice(0,64)),onKeyDown:a=>{"Enter"!==a.key||a.nativeEvent.isComposing||229===a.keyCode||(a.preventDefault(),r())},placeholder:i("shortIdBadge.dialogPlaceholder"),maxLength:64,className:"w-full rounded border border-border bg-background px-2 py-1.5 text-sm font-mono outline-none focus:border-brand"}),(0,d.jsxs)("div",{className:"mt-3 flex justify-end gap-2 text-sm",children:[(0,d.jsx)("button",{onClick:g,className:"rounded px-3 py-1 text-muted-foreground hover:bg-hover",disabled:l,children:i("common.cancel")}),(0,d.jsx)("button",{onClick:()=>void r(),className:"rounded bg-brand px-3 py-1 text-white hover:opacity-90 disabled:opacity-50",disabled:l,children:l?"…":i("common.save")})]})]}),document.body)}var u=c(23328);let v=(0,e.memo)(function({shortId:a,type:b,onRegister:c,onUnregister:g,fullId:h,projectCwd:i,tabId:j}){let{t:k}=(0,f.Bd)(),[l,m]=(0,e.useState)(!1),[o,p]=(0,e.useState)(""),[s,v]=(0,e.useState)(!1),w=(0,e.useRef)(null);(0,e.useEffect)(()=>{if(!h||!i||!j)return;let a=!1;return r.t4.runPromiseExit((0,u.MR)(i,j)).then(b=>{if(a||"Success"!==b._tag)return;let c=b.value[h];"string"==typeof c&&p(c)}),()=>{a=!0}},[h,i,j]),(0,q.h)({url:"/ws/global-state",enabled:!!h&&!!i&&!!j,onMessage:a=>{"console-delta"!==a.type||"rename"!==a.op||a.cwd!==i||a.tabId!==j||a.titles&&h&&Object.prototype.hasOwnProperty.call(a.titles,h)&&p(a.titles[h]??"")}});let x=(0,e.useCallback)(async d=>{if(d.stopPropagation(),l)await g(),m(!1),(0,n.oR)(k("toast.disconnected",{id:a}));else{await c(),m(!0);let d=`cockpit ${b} ${a}`;navigator.clipboard.writeText(d),(0,n.oR)(k("toast.copiedCommand",{command:d}))}},[l,a,b,c,g,k]),y=!!(h&&i&&j),z=(0,e.useCallback)(a=>{a.stopPropagation(),y&&v(!0)},[y]),A=(0,e.useCallback)(async a=>{h&&i&&j&&("Success"===(await r.t4.runPromiseExit((0,u.y8)(i,j,h,a)))._tag&&p(a),v(!1))},[h,i,j]);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("button",{onClick:x,onDoubleClick:a=>a.stopPropagation(),className:"inline-flex items-center gap-1 text-[10px] font-mono leading-none px-1.5 py-0.5 rounded flex-shrink-0 transition-colors bg-muted/60 hover:bg-muted text-muted-foreground",title:l?k("shortIdBadge.clickToDisconnect"):k("shortIdBadge.clickToRegister"),children:[(0,d.jsx)("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${l?"bg-green-500":"bg-muted-foreground/40"}`}),a]}),y&&(o?(0,d.jsxs)("span",{className:"inline-flex items-center gap-0.5 text-[10px] leading-none flex-shrink-0 text-muted-foreground",title:k("shortIdBadge.titleSet",{title:o})||o,children:[(0,d.jsx)("span",{className:"px-1 py-0.5 rounded bg-muted/40 max-w-[120px] truncate",children:o}),(0,d.jsx)("button",{ref:w,onClick:z,className:"opacity-50 hover:opacity-100 transition-opacity","aria-label":k("shortIdBadge.editTitle"),title:k("shortIdBadge.editTitle"),children:"✎"})]}):(0,d.jsxs)("button",{ref:w,onClick:z,className:"inline-flex items-center gap-0.5 text-[10px] leading-none flex-shrink-0 text-muted-foreground/50 hover:text-muted-foreground italic transition-colors",title:k("shortIdBadge.setTitle"),children:["(",k("shortIdBadge.setTitlePlaceholder"),") ✎"]})),(0,d.jsx)(t,{open:s,anchorRef:w,initialValue:o,onCancel:()=>v(!1),onSave:A})]})});var w=c(28602),x=c(79606);let y=(0,e.lazy)(()=>c.e(8764).then(c.bind(c,98764)).then(a=>({default:a.XtermRenderer}))),z={c:"\x03",d:"\x04",z:"\x1a",l:"\f",a:"\x01",e:"\x05",u:"\x15",w:"\x17"},A=/\x1b\[[0-9;]*m/g;function B({output:a,query:b,mode:c,currentIdx:f,matchListRef:g}){let h=(0,e.useRef)(null);h.current||(h.current=new o.v,h.current.use_classes=!0);let i=a.split("\n"),j=b.toLowerCase(),k=0;return g.current=[],(0,d.jsx)("pre",{className:"text-sm font-mono whitespace-pre-wrap break-words select-text",children:i.map((a,b)=>{let e=a.replace(A,""),i=e.toLowerCase().includes(j);if("filter"===c&&!i)return null;if(!i){let c=h.current.ansi_to_html(a);return(0,d.jsx)("div",{dangerouslySetInnerHTML:{__html:c}},b)}let l=[],m=0,n=e.toLowerCase(),o=0;for(;o<n.length;){let a=n.indexOf(j,o);if(-1===a)break;a>m&&l.push((0,d.jsx)("span",{children:e.slice(m,a)},`t${m}`));let b=k++,c=b===f;l.push((0,d.jsx)("mark",{ref:a=>{g.current[b]=a},className:c?"bg-brand/40 text-foreground":"bg-yellow-300/40 text-foreground",children:e.slice(a,a+j.length)},`m${a}`)),o=m=a+j.length}return m<e.length&&l.push((0,d.jsx)("span",{children:e.slice(m)},`t${m}`)),(0,d.jsx)("div",{children:l},b)})})}let C=(0,e.memo)(function({commandId:a,tabId:b,projectCwd:c,command:q,output:s,exitCode:t,isRunning:A,selected:C,onSelect:D,onInterrupt:E,onStdin:F,onDelete:G,onRerun:H,timestamp:I,usePty:J,subscribePtyOutput:K,subscribePtyReset:L,subscribePtyRefresh:M,onPtyResize:N,onToggleMaximize:O,maximized:P,expandedHeight:Q,bubbleContentHeight:R,onTitleMouseDown:S}){let{t:T}=(0,f.Bd)(),U=(0,e.useRef)(null),V=(0,e.useRef)(null),W=(0,e.useRef)(!0),X=(0,e.useRef)(null),Y=(0,e.useRef)(null),Z=(a=>{if(!a)return"";let b=new Date(a);if(isNaN(b.getTime()))return"";let c=String(b.getMonth()+1).padStart(2,"0"),d=String(b.getDate()).padStart(2,"0"),e=String(b.getHours()).padStart(2,"0"),f=String(b.getMinutes()).padStart(2,"0");return`${c}-${d} ${e}:${f}`})(I),$=a&&b?p(b+a):void 0,[_,aa]=(0,e.useState)(!1),[ab,ac]=(0,e.useState)(""),ad=(0,e.useRef)(null),ae=(0,e.useRef)(null);(0,e.useEffect)(()=>{if(!K||!a)return;let b=()=>ad.current?K(a,ad.current.write):null,c=b();if(c)return c;let d=setInterval(()=>{(c=b())&&clearInterval(d)},50);return()=>{clearInterval(d),c?.()}},[K,a]),(0,e.useEffect)(()=>{if(!L||!a)return;let b=()=>ad.current?L(a,ad.current.reset):null,c=b();if(c)return c;let d=setInterval(()=>{(c=b())&&clearInterval(d)},50);return()=>{clearInterval(d),c?.()}},[L,a]),(0,e.useEffect)(()=>{if(!M||!a)return;let b=()=>ad.current?M(a,ad.current.refresh):null,c=b();if(c)return c;let d=setInterval(()=>{(c=b())&&clearInterval(d)},50);return()=>{clearInterval(d),c?.()}},[M,a]);let[af,ag]=(0,e.useState)(!1),[ah,ai]=(0,e.useState)(""),[aj,ak]=(0,e.useState)("search"),[al,am]=(0,e.useState)(0),an=(0,e.useRef)([]),ao=(0,e.useRef)(null),ap=(0,e.useRef)(0);(0,e.useEffect)(()=>{ao.current||(ao.current=new o.v,ao.current.use_classes=!0)},[]),(0,e.useLayoutEffect)(()=>{let a=V.current;if(a&&ao.current){if(s.length<ap.current&&(ao.current=new o.v,ao.current.use_classes=!0,ap.current=0,a.innerHTML=""),s.length>ap.current){let b=s.slice(ap.current),c=ao.current.ansi_to_html(b);ap.current=s.length,a.insertAdjacentHTML("beforeend",c)}if(U.current){let a=U.current.scrollHeight>U.current.clientHeight;aa(a),a&&(U.current.scrollTop=U.current.scrollHeight)}}},[s]),(0,e.useEffect)(()=>(A&&W.current&&U.current&&(null!==X.current&&cancelAnimationFrame(X.current),X.current=requestAnimationFrame(()=>{U.current&&(U.current.scrollTop=U.current.scrollHeight),X.current=null})),()=>{null!==X.current&&cancelAnimationFrame(X.current)}),[s,A]),(0,e.useEffect)(()=>{if(!P)return;let a=a=>{"Escape"===a.key&&(a.preventDefault(),a.stopPropagation(),O?.())};return document.addEventListener("keydown",a,!0),()=>document.removeEventListener("keydown",a,!0)},[P,O]);let aq=s?s.split("\n").length:0,ar=(0,e.useCallback)(()=>{ag(!0),requestAnimationFrame(()=>ae.current?.focus())},[]),as=(0,e.useCallback)(()=>{ag(!1),ai(""),am(0),ad.current?.clearSearch()},[]),at=(0,e.useCallback)(a=>{a.trim()&&(J?ad.current?.findNext(a):am(a=>{let b=a+1,c=an.current[b];return c?(c.scrollIntoView({block:"nearest"}),b):(an.current[0]?.scrollIntoView({block:"nearest"}),0)}))},[J]),au=(0,e.useCallback)(a=>{a.trim()&&(J?ad.current?.findPrevious(a):am(a=>{let b=a-1;if(b>=0)return an.current[b]?.scrollIntoView({block:"nearest"}),b;let c=an.current.length-1;return c>=0&&an.current[c]?.scrollIntoView({block:"nearest"}),Math.max(c,0)}))},[J]);(0,e.useEffect)(()=>{if(!C)return;let a=a=>{if((a.metaKey||a.ctrlKey)&&"f"===a.key){a.preventDefault(),a.stopPropagation(),ar();return}if("Escape"===a.key&&af){a.preventDefault(),a.stopPropagation(),as();return}};return document.addEventListener("keydown",a,!0),()=>document.removeEventListener("keydown",a,!0)},[C,af,ar,as]);let av=P&&Q?Q-41:R??360;return(0,d.jsx)("div",{className:"flex flex-col items-start",children:(0,d.jsxs)("div",{className:`w-full bg-card text-foreground dark:text-slate-11 relative overflow-hidden border transition-colors cursor-pointer ${P?"rounded-none border-0":"rounded-2xl rounded-bl-md rounded-br-md"} ${P?"":C?"border-brand":"border-brand/30"}`,onClick:D,children:[P?(0,d.jsxs)("div",{onDoubleClick:()=>O?.(),className:"flex items-center gap-2 px-3 py-2 border-b border-border bg-card",style:{height:41,flexShrink:0},children:[(0,d.jsx)("span",{className:"text-[10px] font-mono leading-none px-1 py-0.5 rounded bg-muted text-muted-foreground",children:">_"}),(0,d.jsx)("span",{className:"flex-1 text-xs text-muted-foreground truncate font-mono",children:q}),A&&(0,d.jsxs)("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,d.jsx)("span",{className:"inline-block w-2 h-2 bg-green-500 rounded-full animate-pulse"}),T("console.runningText")]}),A&&E&&(0,d.jsx)("button",{onClick:E,className:"text-xs px-3 py-1 rounded-md font-medium bg-destructive text-destructive-foreground transition-all duration-150 hover:bg-destructive/80 hover:shadow-lv2 active:scale-95 active:bg-destructive/70 cursor-pointer select-none",children:"Ctrl+C"}),(0,d.jsx)("button",{onClick:()=>O?.(),className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-hover transition-colors",title:T("console.restoreTooltip",{modKey:(0,w.Mu)()}),children:(0,d.jsx)(g.A,{className:"w-4 h-4"})})]}):(0,d.jsxs)("div",{"data-drag-handle":!0,onMouseDown:()=>S?.(),onDoubleClick:a=>{a.stopPropagation(),O?.()},className:`flex items-center gap-2 px-4 py-1.5 border-b text-xs transition-colors cursor-grab active:cursor-grabbing ${C?"border-brand":"border-brand/30"}`,children:[(0,d.jsx)("span",{className:"text-[10px] font-mono leading-none px-1 py-0.5 rounded flex-shrink-0 bg-muted text-muted-foreground",children:">_"}),$&&a&&b&&(0,d.jsx)(v,{shortId:$,type:"terminal",onRegister:()=>{r.t4.runFork((0,u.Ok)({tabId:b,commandId:a,command:q,projectCwd:c}).pipe(x.orElse(()=>x.void)))},onUnregister:()=>{r.t4.runFork((0,u.jO)({commandId:a}).pipe(x.orElse(()=>x.void)))},fullId:a,projectCwd:c,tabId:b}),(0,d.jsx)("span",{className:"font-mono text-foreground truncate",children:q}),(0,d.jsx)("button",{onClick:a=>{a.stopPropagation(),navigator.clipboard.writeText(q),(0,n.oR)(T("toast.copiedCmd"))},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:T("console.copyCommand"),children:(0,d.jsx)(h.A,{className:"w-3.5 h-3.5"})}),(0,d.jsx)("span",{className:"flex-1"}),_&&!A&&(0,d.jsx)("span",{className:"text-muted-foreground flex-shrink-0",children:T("console.totalLines",{count:aq})}),s&&(0,d.jsx)("button",{onClick:a=>{let b;a.stopPropagation(),b=s.replace(/\x1b\[[0-9;]*m/g,""),navigator.clipboard.writeText(b),(0,n.oR)(T("toast.copiedOutput"))},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:T("console.copyOutput"),children:(0,d.jsx)(i.A,{className:"w-3.5 h-3.5"})}),H&&(0,d.jsx)("button",{onClick:a=>{a.stopPropagation(),H()},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:T("console.rerun"),children:(0,d.jsx)(j.A,{className:"w-3.5 h-3.5"})}),G&&(0,d.jsx)("button",{onClick:a=>{a.stopPropagation(),G()},className:"p-0.5 rounded text-destructive hover:text-destructive/80 transition-colors flex-shrink-0",title:T("console.deleteRecord"),children:(0,d.jsx)(g.A,{className:"w-3.5 h-3.5"})})]}),af&&(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-border bg-card",style:{flexShrink:0},children:[(0,d.jsx)(k.A,{className:"w-3.5 h-3.5 text-muted-foreground flex-shrink-0"}),(0,d.jsx)("input",{ref:ae,value:ah,onChange:a=>{let b=a.target.value;ai(b),am(0),J&&(b.trim()?ad.current?.findNext(b):ad.current?.clearSearch())},onKeyDown:a=>{"Enter"===a.key&&(a.preventDefault(),a.shiftKey?au(ah):at(ah))},placeholder:T("console.searchPlaceholder"),className:"flex-1 bg-transparent text-sm text-foreground outline-none",autoComplete:"off",spellCheck:"false"}),!J&&(0,d.jsxs)("div",{className:"flex items-center gap-0.5 text-xs flex-shrink-0",children:[(0,d.jsx)("button",{onClick:()=>ak("search"),className:`px-1.5 py-0.5 rounded transition-colors ${"search"===aj?"bg-brand/20 text-brand":"text-muted-foreground hover:text-foreground"}`,children:T("console.searchMode")}),(0,d.jsx)("button",{onClick:()=>ak("filter"),className:`px-1.5 py-0.5 rounded transition-colors ${"filter"===aj?"bg-brand/20 text-brand":"text-muted-foreground hover:text-foreground"}`,children:T("console.filterMode")})]}),(0,d.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,d.jsx)("button",{onClick:()=>au(ah),className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-hover transition-colors",title:T("console.prevShiftEnter"),children:(0,d.jsx)(l.A,{className:"w-3.5 h-3.5"})}),(0,d.jsx)("button",{onClick:()=>at(ah),className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-hover transition-colors",title:T("console.nextEnter"),children:(0,d.jsx)(m.A,{className:"w-3.5 h-3.5"})})]}),(0,d.jsx)("button",{onClick:as,className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-hover transition-colors",children:(0,d.jsx)(g.A,{className:"w-3.5 h-3.5"})})]}),J?(0,d.jsxs)("div",{className:"relative group",style:{height:av,overflow:"hidden"},children:[(0,d.jsx)(e.Suspense,{fallback:(0,d.jsx)("div",{className:"px-4 py-2 text-xs text-muted-foreground",style:{height:av},children:T("console.loadingTerminal")}),children:(0,d.jsx)(y,{ref:ad,output:s,isRunning:A,onInput:F,onResize:N,maximized:P,height:av,directWrite:!!K})}),!A&&(0,d.jsx)("div",{className:"absolute inset-0 bg-background/50 pointer-events-none"}),!A&&H&&(0,d.jsx)("div",{className:"absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",onClick:a=>{a.stopPropagation(),H()},children:(0,d.jsxs)("div",{className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-tooltip text-tooltip-foreground text-xs",children:[(0,d.jsx)(j.A,{className:"w-3.5 h-3.5"}),T("console.rerun")]})})]}):(0,d.jsx)("div",{ref:U,className:"overflow-auto px-4 py-2",style:{height:av},onScroll:()=>{if(U.current){let{scrollTop:a,scrollHeight:b,clientHeight:c}=U.current;W.current=b-a-c<50}},children:af&&ah.trim()?(0,d.jsx)(B,{output:s,query:ah,mode:aj,currentIdx:al,matchListRef:an}):(0,d.jsx)("pre",{ref:V,className:"text-sm font-mono whitespace-pre-wrap break-words select-text"})}),A&&!P&&(0,d.jsxs)("div",{className:"border-t border-border px-4 py-2 flex items-center gap-2",onClick:a=>a.stopPropagation(),children:[(0,d.jsx)("span",{className:"inline-block w-2 h-2 bg-green-500 rounded-full animate-pulse flex-shrink-0"}),J?(0,d.jsx)("span",{className:"text-xs text-muted-foreground flex-1",children:T("console.clickToInput")}):F?(0,d.jsx)("input",{ref:Y,value:ab,onChange:a=>ac(a.target.value),onKeyDown:a=>{if(a.ctrlKey&&!a.metaKey&&!a.altKey){let b=z[a.key.toLowerCase()];if(b){a.preventDefault(),a.stopPropagation(),F(b);return}}"Enter"!==a.key||a.nativeEvent.isComposing||(a.preventDefault(),F(ab+"\n"),ac("")),"Tab"===a.key&&(a.preventDefault(),F(" "))},placeholder:T("console.stdinPlaceholder"),className:"flex-1 min-w-0 bg-transparent text-xs font-mono text-foreground outline-none",autoComplete:"off",spellCheck:"false"}):(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:T("console.runningText")}),E&&(0,d.jsx)("button",{onClick:E,className:"flex-shrink-0 text-xs text-destructive hover:brightness-125 transition-colors cursor-pointer select-none",children:"Ctrl+C"}),Z&&(0,d.jsx)("span",{className:"text-[11px] text-muted-foreground flex-shrink-0",children:Z})]}),!A&&void 0!==t&&!P&&(0,d.jsxs)("div",{className:"border-t border-border px-4 py-2 flex items-center gap-2 text-xs text-muted-foreground",children:[(0,d.jsx)("span",{className:`inline-block w-2 h-2 rounded-full ${0===t?"bg-green-500":"bg-red-500"}`}),(0,d.jsx)("span",{children:T("console.exitCode",{code:t})}),(0,d.jsx)("span",{className:"flex-1"}),Z&&(0,d.jsx)("span",{className:"text-[11px] flex-shrink-0",children:Z})]})]})})});var D=c(64676);let E=new Map;function F(a){E.set(a.type,a)}function G(a){return E.get(a)}function H(a){for(let b of E.values())if(b.match(a))return b;return null}c(57031),c(88214);var I=c(71192);let J=(a,b)=>x.tryPromise({try:async()=>{let c=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)});if(!c.ok)throw Error(`HTTP ${c.status}`)},catch:b=>new I.uV({message:`POST ${a} failed`,cause:b})}),K=(a,b)=>r.t4.runPromise(J(`/api/${a}/disconnect`,{id:b}).pipe(x.orElse(()=>x.void))),L=a=>r.t4.runPromise(J("/api/browser/unregister",{id:a}).pipe(x.orElse(()=>x.void))),M=a=>r.t4.runPromise(a.pipe(x.catchAll(a=>x.sync(()=>{if(a.cause instanceof Error)throw a.cause;throw Error(a.message)})))),N=(a,b)=>{if(a&&"object"==typeof a&&"error"in a){let b=a.error;if("string"==typeof b&&b.length>0)return b;if(b&&"object"==typeof b){let a=b.message;if("string"==typeof a&&a.length>0)return a;let c=b._tag;if("string"==typeof c&&c.length>0)return c}}return`HTTP ${b}`},O=(a,b)=>M(x.tryPromise({try:async()=>{let c=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),d=await c.json();if(!c.ok)throw Error(N(d,c.status));return d},catch:b=>new I.uV({message:`POST ${a} failed`,cause:b})})),P=(a,b)=>M(x.tryPromise({try:async()=>{let c=new URLSearchParams(b),d=await fetch(`${a}?${c}`),e=await d.json();if(!d.ok)throw Error(N(e,d.status));return e},catch:b=>new I.uV({message:`GET ${a} failed`,cause:b})})),Q=(a,b)=>M(x.tryPromise({try:async()=>{let c=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)});if(!c.ok)throw Error(`HTTP ${c.status}`);return c.blob()},catch:b=>new I.uV({message:`POST blob ${a} failed`,cause:b})}));var R=c(15105);function S(a){let b=a.trim().toLowerCase();return b.startsWith("http://")||b.startsWith("https://")}async function T(a){let b=(0,R.f)()?.id??null;return!!b&&new Promise(c=>{try{let d=globalThis.chrome?.runtime;if(!d?.sendMessage)return void c(!1);let e=setTimeout(()=>c(!1),2e3);d.sendMessage(b,{type:"prepare-iframe",url:a},a=>{clearTimeout(e),c(a?.ok??!1)})}catch{c(!1)}})}function U({url:a,id:b,selected:c,maximized:g,expandedHeight:h,bubbleContentHeight:i,onSelect:j,onClose:k,onToggleMaximize:l,onNewTab:m,timestamp:o,onTitleMouseDown:q,initialSleeping:r,onSleep:s,onWake:t,projectCwd:u,tabId:x}){let{t:y,i18n:z}=(0,f.Bd)(),[A,B]=(0,e.useState)(!1),[C,E]=(0,e.useState)(null),[F,G]=(0,e.useState)(a),[H,I]=(0,e.useState)(null),[J,K]=(0,e.useState)(r??!1),M=(0,e.useRef)(null),N=(0,e.useRef)(null),O=(0,e.useRef)(null);(0,e.useRef)(!0),(0,e.useCallback)(()=>{J||(K(!0),I(null),s?.(b))},[J,b,s]),(0,e.useCallback)(()=>{M.current&&(clearTimeout(M.current),M.current=null)},[]);let{shortId:P,connected:Q,connect:R,disconnect:V}=function(a,b,c){let d=(0,e.useMemo)(()=>p(a),[a]),[f,g]=(0,e.useState)(!1),h=(0,e.useRef)(null);(0,e.useRef)([]),(0,e.useRef)(null),(0,e.useRef)(!1),(0,e.useRef)(c);let i=(0,e.useRef)([]);(0,e.useCallback)(a=>{let c=b.current;if(!c?.contentWindow){let b=h.current;b&&b.readyState===WebSocket.OPEN&&b.send(JSON.stringify({type:"browser:cmd-result",reqId:a.reqId,ok:!1,error:"iframe not available (page may be sleeping)"}));return}c.contentWindow.postMessage({type:"cockpit:cmd",reqId:a.reqId,action:a.action,params:a.params},"*")},[b]);let j=(0,e.useCallback)(()=>f&&h.current?.readyState===WebSocket.OPEN?Promise.resolve():new Promise(a=>{i.current.push(a),f||g(!0)}),[f]);return{shortId:d,connected:f,connect:j,disconnect:(0,e.useCallback)(()=>{g(!1)},[])}}(b,O,!!H&&!J&&!A);(0,e.useRef)(Q).current=Q;let W=(0,e.useCallback)(()=>{if(K(!1),t?.(b),!S(a))return void I((0,D.Kx)(a)?(0,D.hE)(a,u):(0,D.Xe)(a,u));let c=function(a){if(!a)return a;try{let b=new URL(a);return b.searchParams.set("_cockpit","1"),b.toString()}catch{let b=a.includes("?")?"&":"?";return`${a}${b}_cockpit=1`}}(a);!function(a){try{let b=new URL(a).hostname;return"localhost"===b||"127.0.0.1"===b}catch{return!1}}(a)?T(a).then(()=>I(c)):I(c)},[a,b,t,u]),X=(0,e.useCallback)(()=>{B(!1);let a=O.current?.contentWindow;if(!a)return;let b=document.documentElement.classList.contains("dark");a.postMessage({type:"THEME_CHANGE",theme:b?"dark":"light"},"*"),a.postMessage({type:"cockpit:language-change",lang:z.language},"*")},[z]),Y=(0,e.useCallback)(()=>{B(!1),E(y("browser.pageLoadFailed"))},[]),Z=(0,e.useCallback)(()=>{if(J)return void W();let a=N.current?.querySelector("iframe");if(a&&H){B(!0),E(null);let b=a.src;a.src="",setTimeout(()=>{a.src=b},0)}},[J,W,H]),$=(0,e.useCallback)(()=>{if(!F)return;let a=S(F)?F:(0,D.Kx)(F)?(0,D.hE)(F,u):(0,D.Xe)(F,u);window.open((0,D.PB)(a,window.location.origin),"_blank")},[F,u]),_=function(a){if(!a)return"";try{let b=new URL(a);return b.port?`${b.hostname}:${b.port}`:b.hostname}catch{return a.split("/").pop()||a}}(F);return(0,d.jsx)("div",{className:"flex flex-col items-start",children:(0,d.jsxs)("div",{className:`w-full bg-accent text-foreground
1
+ exports.id=5750,exports.ids=[5750],exports.modules={208:(a,b,c)=>{"use strict";c.d(b,{A:()=>g});var d=c(529);let e=JSON.parse('{"common":{"save":"Save","cancel":"Cancel","delete":"Delete","close":"Close","minimize":"Minimize","copy":"Copy","edit":"Edit","file":"File","codeMap":"Code Map","diff":"Diff","confirm":"Confirm","loading":"Loading...","search":"Search","refresh":"Refresh","retry":"Retry","submit":"Submit","copied":"Copied","saved":"Saved","failed":"Failed","noMatch":"No matches","noData":"No data","done":"Done","justNow":"just now","minutesAgo":"{{count}}m ago","hoursAgo":"{{count}}h ago","daysAgo":"{{count}}d ago","monthsAgo":"{{count}}mo ago","yearsAgo":"{{count}}y ago","saveFailed":"Save failed","copyFailed":"Copy failed","deleteFailed":"Delete failed","operationFailed":"Operation failed","copiedPath":"Path copied","copyPath":"Copy path","openInConsole":"Open in Console bubble","copyAbsPath":"Copy absolute path","loadMore":"Load more","noResult":"No results","selected":"Selected","selectAll":"Select all","hint":"Notice","confirmBtn":"OK","cancelBtn":"Cancel","preview":"Preview","readable":"Readable","previous":"Previous","next":"Next","all":"All","input":"Input","result":"Result","line":"Line","lines":"lines","running":"Running","connecting":"Connecting","connected":"Connected","connectionFailed":"Connection failed","builtin":"Built-in","global":"Global","project":"Project","current":"Current","code":"Code"},"htmlApps":{"title":"HTML Apps","addTooltip":"Add to HTML panel","added":"Added to HTML panel","alreadyAdded":"Already added","addFailed":"Failed to add","add":"Add","adding":"Adding...","addHtmlApp":"Add HTML app","searchPlaceholder":"Search HTML apps...","pathLabel":"Absolute path to the .html file","invalid":"Invalid","builtin":"Built-in","noDescription":"No description","emptyNoApps":"No custom HTML apps yet.","emptyCreatePrefix":"Use","emptyCreateSuffix":"in chat to create a new app.","addExisting":"add an existing HTML file","viewDocs":"view docs","emptyNoMatch":"No HTML apps match your search."},"skills":{"addTooltip":"Add to Skills panel","added":"Added to Skills panel","alreadyAdded":"Already added","addFailed":"Failed to add","title":"Skills","searchPlaceholder":"Search skills...","clearSearch":"Clear","addSkill":"Add Skill","emptyNoSkills":"No skills yet.","emptyIntroPrefix":"Use","emptyIntroSuffix":"in chat to distil a reusable workflow into a SKILL.md file.","emptyNoMatch":"No skills match your search.","viewDocs":"view docs","pathLabel":"Absolute path to SKILL.md","pathPlaceholder":"/Users/you/.../skills/foo/SKILL.md","add":"Add","adding":"Adding...","invalid":"Invalid","copyPath":"Copy path","noDescription":"No description","previewTitle":"Skill Preview","source":"Source","cannotRead":"File cannot be read."},"toast":{"savedSuccess":"Saved","saveFailed":"Save failed","copiedName":"Copied: {{name}}","copyFailed":"Copy failed","deleteFailed":"Delete failed","operationFailed":"Operation failed","staged":"Staged","stageFailed":"Stage failed","unstaged":"Unstaged","unstageFailed":"Unstage failed","stagedNFiles":"Staged {{count}} files","unstagedNFiles":"Unstaged {{count}} files","discardFailed":"Discard failed","discardedNFiles":"Discarded changes in {{count}} files","deletedFile":"File deleted","discardedChanges":"Changes discarded","pastedFile":"Pasted: {{name}}","pasteFailed":"Paste failed","noFileToPaste":"No file to paste","createdFile":"Created: {{name}}","createFailed":"Create failed","movedToTrash":"Moved to trash: {{name}}","copiedPageUrl":"Page URL copied","copiedDirPath":"Directory path copied","switchedToBranch":"Switched to {{branch}}","switchBranchFailed":"Branch switch failed","loadBranchFailed":"Failed to load branches","copiedCommand":"Copied: {{command}}","copiedMessage":"Message copied","forkFailed":"Failed to fork session","excerptFailed":"Failed to excerpt this turn","copiedUrl":"URL copied","copiedOutput":"Output copied","copiedCmd":"Command copied","copiedComment":"Comment copied","copiedAllComments":"All comments copied","copiedFileContent":"File content copied","copiedQA":"Copied {{count}} Q&A","copiedAllQA":"All Q&A copied","sentQA":"Sent to AI","readFileFailed":"Failed to read file","fileOutsideProject":"File is outside this project — only Markdown, CSV and images can be previewed","reviewCreated":"Review created, link copied","reviewUpdated":"Review updated, link copied","reviewCreateFailed":"Failed to create review","sharingClosed":"Sharing disabled","sharingCloseFailed":"Failed to disable sharing","linkCopied":"Link copied","addCommentFailed":"Failed to add comment","deleteCommentFailed":"Failed to delete comment","editCommentFailed":"Failed to edit comment","addReplyFailed":"Failed to add reply","deleteReplyFailed":"Failed to delete reply","editReplyFailed":"Failed to edit reply","disconnected":"Disconnected: {{id}}","pluginReloading":"Reloading extension...","worktreeCreateSuccess":"Worktree created: {{name}}","worktreeCreateFailed":"Failed to create worktree","worktreeLoadFailed":"Failed to load worktree list","worktreeDeleted":"Worktree deleted","worktreeDeleteFailed":"Failed to delete worktree","worktreeLocked":"Locked","worktreeUnlocked":"Unlocked"},"workspace":{"selectProject":"Select a project to start","searchProjectPath":"Search project path...","loadingProjects":"Loading projects...","projectNotFound":"No projects found","sessions":"{{count}} sessions","loadingSessions":"Loading sessions...","noSessions":"No sessions","loadingText":"Loading...","openProject":"Open Project","expandSidebar":"Expand sidebar","collapseSidebar":"Collapse sidebar","notes":"Notes","skills":"Skills","apps":"Apps","settings":"Settings","help":"Help","updateAvailable":"v{{version}} available","copyUpgradeCommand":"Copy cockpit update","updateNow":"Update now","updating":"Updating…","updateComplete":"Update complete","updateFailed":"Update failed","updateCardPreparing":"Preparing update…","updateCardInstalling":"Downloading and installing","updateCardRepairing":"Repairing native dependency","updateCardUpToDate":"Already on the latest version, v{{version}}","updateCardCopyFix":"Copy fix command","updateCardFixCopied":"Fix command copied","updateCardRollingBack":"Install failed, rolling back","updateCardRestarting":"Restarting Cockpit…","updateCardDone":"Updated to v{{version}}","updateCardElapsed":"{{seconds}}s elapsed","updateCardBaseline":"last time ~{{seconds}}s","updateCardNoLiveStatus":"Live status unavailable; the update is still running","updateCardRolledBack":"Rolled back to the previous version; Cockpit is usable.","updateCardManualHint":"You can retry from a terminal:","updateCardLogHint":"Log: {{path}}","updateRestartNote":"Cockpit will restart in the background.","viewChangelog":"View changelog","serverRestarted":"Cockpit was updated in the background.","reloadNow":"Reload","upgradeCommandCopied":"Copied `cockpit update`","projectNotes":"Project Notes","closeProject":"Close project"},"mobile":{"useDesktop":"Desktop","messagePlaceholder":"Message…","send":"Send","stop":"Stop","enableNotifications":"Enable notifications","disableNotifications":"Disable notifications","notifyError":"Could not enable notifications"},"sessions":{"recentSessions":"Recent Sessions","favorites":"Favorite Sessions","noFavorites":"No favorite sessions yet. Click the star in the tab bar to add.","addFavorite":"Add to favorites","removeFavorite":"Remove from favorites","runningCount":"{{count}} running","unreadCount":"{{count}} unread","noSessions":"No sessions yet","running":"Running","done":"Done","editTitle":"Edit title","projectSessions":"Project Sessions","browseAllSessions":"Browse all sessions","sessionList":"Session List","search":"Search","searchSessions":"Search sessions...","searchRecentSessions":"Search recent sessions","loadSessionsFailed":"Failed to load sessions","loadingSessions":"Loading sessions...","noMatchingSessions":"No matching sessions","noSessionsYet":"No sessions yet","projectList":"Project List","openFolder":"Open Folder","selectingFolder":"Selecting...","loadingHistory":"Loading history..."},"scheduledTasks":{"title":"Scheduled Tasks","aboutToTrigger":"About to trigger","secondsLater":"in {{count}}s","minutesLater":"in {{count}}m","hoursMinutesLater":"in {{h}}h {{m}}m","hoursLater":"in {{h}}h","onceType":"Once ({{minutes}}min)","everyNMinutes":"Every {{minutes}}min","completed":"Completed","paused":"Paused","activeCount":"{{running}} active","pausedCount":"{{paused}} paused","noScheduledTasks":"No scheduled tasks. Click the clock button in the chat input to create one.","lastResult":"Last","runNow":"Run now","resume":"Resume","pause":"Pause","completedCount":"Completed ({{count}})","groupPendingReview":"Finished \xb7 to review","groupUpcoming":"Running \xb7 upcoming","openSession":"Open session","selectTaskHint":"Select a task on the left to preview its session messages","noTaskMessages":"No messages in this task\'s session yet","success":"Success","failure":"Failed","createTask":"Create Scheduled Task","editTask":"Edit Scheduled Task","sendMessage":"Message","messagePlaceholder":"Enter message to send...","taskFile":"Task File","taskFilePlaceholder":"/Users/you/project/tasks/daily-report.md","taskFileHint":"Absolute path. On each fire the agent reads this file first and acts on what it describes — edits take effect on the next run.","taskFilePromptHeader":"Read this task file first, then act accordingly:","type":"Type","once":"Once","interval":"Interval","quickSelect":"Quick Select","customCron":"Custom Cron Expression","customMinutes":"Custom minutes","cronPlaceholder":"e.g. 0 9 * * 1-5 (weekdays at 9am)","cronFormat":"Format: min hour day month weekday (e.g. 0 9 * * 1-5)","minutesPlaceholder":"Minutes","limitTimeRange":"Limit execution time range","to":"to","saveBtn":"Save ({{modKey}}↩)","createBtn":"Create ({{modKey}}↩)","5minLater":"In 5 minutes","15minLater":"In 15 minutes","30minLater":"In 30 minutes","1hourLater":"In 1 hour","every15min":"Every 15 min","every30min":"Every 30 min","every1hour":"Every 1 hour","every2hours":"Every 2 hours","daily9am":"Daily 09:00","daily6pm":"Daily 18:00","weeklyMon9am":"Mon 09:00","monthly1st9am":"1st of month 09:00"},"cron":{"everyNMinutes":"Every {{n}} minutes","everyNHours":"Every {{n}} hours","everyMinute":"Every minute","everyHourAtMin":"Every hour at minute {{m}}","hourlyEveryMin":"{{h}}:xx every minute","daily":"Daily at {{time}}","weekdays":"Weekdays","weekends":"Weekends","dowSun":"Sun","dowMon":"Mon","dowTue":"Tue","dowWed":"Wed","dowThu":"Thu","dowFri":"Fri","dowSat":"Sat","monthPrefix":"","dayOfMonth":"","dayRange":"{{a}}th to {{b}}th","weekdayPrefix":"","weekdayRange":"{{a}} to {{b}}"},"blockViewer":{"empty":{"body":"Select a file in the left tree to see its code map.","hint":"or press ⌘K to search."},"fileMode":{"loading":"Loading…","notFound":"This file is not indexed (unsupported language or beyond the file cap)."},"buildProgress":{"listing":"Listing files…","contexts":"Reading project config…","parsing":"Parsing files","resolving":"Resolving imports…","edges":"Building call graph…","done":"Finishing up…"},"search":{"tooltip":"Search (⌘K)","hint":"Start typing to search","noResults":"No matches","files":"Files","symbols":"Symbols"},"viewerToggle":{"toBlock":"Show code map","toCode":"Back to code view"},"toc":{"title":"this file","empty":"No functions detected.","notIndexed":"File not in project graph (unsupported language / not in git tracked set / file cap reached)."},"history":{"title":"history","empty":"Click an input or output pin to begin tracing.","clear":"Clear history"},"refresh":"Rebuild project graph","retry":"Retry"},"blockDiffViewer":{"loading":"Building code map…","unsupported":"Code map diff is not available for this file type.","unsupportedHint":"Switch back to the regular diff view to read it.","error":"Code map diff failed: {{message}}","noBlockChanges":"No code-map changes (formatting / whitespace only).","noBefore":"(new)","noAfter":"(removed)","kind":{"added":"added","deleted":"deleted","modified":"modified"}},"fileBrowser":{"directoryTree":"Tree","searchTab":"Search","recentTab":"Recent","changesTab":"Status","historyTab":"History","searchFiles":"Search files...","clear":"Clear","exactMatchOn":"Exact match (on)","exactMatchOff":"Exact match (off)","refreshTree":"Refresh directory tree","collapseAll":"Collapse all directories","searchFileContent":"Search file contents...","caseSensitive":"Case sensitive","wholeWord":"Whole word","regex":"Regex","fileTypes":"File types (ts,tsx)","compareMode":"Compare","compareModeOff":"Close branch comparison","compareModeOn":"Compare with selected branch","createFile":"New File","createFileIn":"New File (in {{path}}/)","fileName":"File name...","noRecentFiles":"No recent files","stagingArea":"Staged ({{count}})","changesSummary_one":"{{count}} change","changesSummary_other":"{{count}} changes","noChanges":"No changes in working tree","refreshChanges":"Refresh changes","unstageAll":"Unstage all","noStagedFiles":"No staged files","unstageNFiles":"Unstage {{count}} files","unstageFile":"Unstage","workspace":"Workspace ({{count}})","discardAll":"Discard all","stageAll":"Stage all","noUnstagedChanges":"No unstaged changes","discardNFiles":"Discard changes in {{count}} files","stageNFiles":"Stage {{count}} files","discardChanges":"Discard changes","stageFile":"Stage file","loadingDiff":"Loading diff...","noDiffFiles":"No diff files","nFilesChanged":"{{count}} files changed (vs {{branch}})","loadingCommits":"Loading commits...","noCommits":"No commits","allLoaded":"All {{count}} records loaded","locateInTree":"Locate in directory tree","unsaved":"Unsaved","saveBeforeSwitch":"Current file has unsaved changes. Save before switching?","saveAndSwitch":"Save and switch","closeEdit":"Close edit (ESC)","closeBtn":"Close","copyFileContent":"Copy file content","toggleJsonReadable":"Toggle JSON readable mode","previewMarkdown":"Preview Markdown","exitPreview":"Exit Preview","collapseAllJson":"Fold","expandAllJson":"Full","viewBlame":"View line-by-line change history","viewDiff":"View changes against HEAD","exitDiff":"Exit Diff","diffLoadFailed":"Failed to load diff","editFile":"Edit file","backToPreview":"Back to preview","cannotPreview":"Cannot preview this file","selectFileToPreview":"Select a file to preview","staged":"Staged","unstaged":"Unstaged","selectFileToViewDiff":"Select a file to view diff","loadingDiffContent":"Loading diff...","clickCompareToLoad":"Click \\"Compare\\" to load branch diff","selectCommitToView":"Select a commit to view details","confirmDelete":"Confirm Delete","confirmDeleteMessage":"Move <file>{{name}}</file> to trash?","nFilesNMatches":"{{files}} files, {{matches}} matches","resultsTruncated":"Results truncated","noContentSearchResults":"No results","enterKeywordToSearch":"Enter keyword to search file contents","searchMinChars":"Search requires at least 2 characters"},"csv":{"table":"Table","raw":"Raw","empty":"Empty table","summary":"{{rows}} rows \xb7 {{cols}} columns","summaryFiltered":"{{rows}} / {{total}} rows matched \xb7 {{cols}} columns","loadMore":"Load more ({{shown}} / {{total}} shown)","filterPlaceholder":"Filter rows…","filterColumn":"Filter column","clearFilter":"Clear filter","allColumns":"All columns","noMatch":"No matching rows","sortHint":"Click to sort (asc / desc / off)"},"codeViewer":{"fileModifiedExternally":"File was modified externally. Saving will overwrite external changes.","useDiskVersion":"Use disk version","forceOverwrite":"Force overwrite","searchPlaceholder":"Search...","caseSensitive":"Case sensitive","wholeWordMatch":"Whole word match","unsavedConfirm":"You have unsaved changes. Close anyway?","discardChanges":"Discard changes","continueEditing":"Continue editing","unsavedExitConfirm":"You have unsaved changes. Exit edit mode?","clickToViewDetails":"Click to view details","clickToViewCommit":"Click to view commit details","nComments":"{{count}} comments","searchChat":"Search chat...","prevShiftEnter":"Previous (Shift+Enter)","nextEnter":"Next (Enter)","closeEsc":"Close (Esc)"},"chat":{"startConversation":"Start a conversation","loadMoreHistory":"Load more...","scrollUpForMore":"↑ Scroll up to load more history","jumpToStart":"Jump to start","jumpToLatest":"Jump to latest","jumpToPrevUserMessage":"Previous user message","jumpToNextUserMessage":"Next user message","copyMessage":"Copy message","copyImage":"Copy image","copiedImage":"Image copied","forkSession":"Fork session from here","excerptTurn":"Excerpt this turn to a new session","imageN":"Image {{index}}","imagePreview":"Image preview","toolCalls":"{{count}} tool calls","collapse":"▲ Collapse","expand":"▼ Expand","subagent":"Subagent","subagentEmpty":"No subagent transcript found","subagentViewTitle":"View subagent transcript","workflowRun":"Run details","workflowViewTitle":"View workflow run details","workflowEmpty":"No workflow run journal found","workflowAgents":"agents","workflowViewAgent":"View","workflowUngrouped":"Ungrouped","viewQuestions":"View questions","viewAllFileChanges":"View all file changes","requestFailed":"Request failed","cannotReadStream":"Cannot read response stream","errorRetry":"An error occurred, please retry","placeholder":"Type a message, Enter to send (Shift+Enter for new line, paste images; start a line with / (main session) or @ (subagent) for commands, multiple allowed)","placeholderDisabled":"Generating... you can keep typing (ESC to cancel; if stuck, cancel and resend \'continue\')","imageSizeLimit":"Image size exceeds limit (max 5MB), current: {{size}}MB","viewGitChanges":"View Git changes","viewAllComments":"View all comments","userMessages":"User messages","projectNotes":"Project Notes","scheduledTasks":"Scheduled Tasks","quickPrompts":"Quick Prompts","globalPrompts":"Global Prompts","projectPrompts":"Project Prompts","noQuickPrompts":"No quick prompts yet","addQuickPrompt":"Add quick prompt","quickPromptPlaceholder":"One-line prompt — Enter to save, Esc to cancel","insertQuickPrompt":"Insert into input (without sending)","context":"Context","output":"Output","copiedCommandTooltip":"Copied!","copyCommandTooltip":"Copy command: {{command}}","executedCommand":"Executed `{{command}}`{{exitInfo}}, output:\\n```\\n{{output}}\\n```","executedCommandFailed":"Failed to execute `{{command}}`: {{error}}","executionMode":"Execution Mode","checkBalance":"Check balance","balanceFailed":"Query failed — check the API key","balanceNeedsKey":"Set a DeepSeek API key first","balanceUnavailable":"Account is not available for requests","balanceEmpty":"No balance returned","openUsagePage":"Open DeepSeek usage console","checkQuota":"Check quota","quotaFailed":"Quota unavailable — check the API key","quotaNeedsKey":"Set an API key first","quotaEmpty":"No quota returned","quotaResetAt":"Resets {{time}}","openProviderConsole":"Open the provider console","planMode":"Plan mode","planModeDesc":"read-only \xb7 plan first, no edits","planModeOn":"Plan mode on — read-only; send a task to get a plan","planModeOff":"Plan mode off","planModeHint":"Plan mode: read-only exploration that produces a plan without editing. Uncheck and resend to implement.","noHistory":"Independent task","noHistoryDesc":"no history sent","noHistoryHint":"Independent task: each message is sent to the model on its own, with no prior conversation. The transcript above still records everything.","planTitle":"Plan (awaiting your review)","approvePlan":"Approve & run","planApproveHint":"No approval dialog here — click to exit plan mode and execute","approvePlanPrompt":"Approved — proceed with the plan above."},"console":{"enterCommandOrUrl":"Enter a command or URL to start","emptyIntro":"Type any of the following in the input bar to create a bubble:","bubbleCommand":"Command","bubbleInteractive":"Interactive","bubbleBrowser":"Browser","bubbleBrowserNoteIframe":"Some sites block iframe embedding — install Cockpit Bridge under Settings → Browser Extension before opening.","bubbleBrowserNoteCookie":"If a logged-in site first shows as signed out, refresh a few times to restore it.","bubbleDatabase":"Database","bubbleNotebook":"Notebook","loadingMore":"Loading...","loadMoreHistory":"Load more history","quickCommands":"Quick Commands","singleColumn":"Single column","dualColumn":"Dual column","envVars":"Environment Variables","launchShell":"Launch interactive shell","htmlApps":"HTML apps","inputPlaceholder":"Enter command or URL and press Enter... (↑↓ history, Tab complete)","scopeProject":"Project","scopeGlobal":"Global","tabSwitchEscClose":"Tab to switch \xb7 Esc to close","copyOutput":"Copy output","copyCommand":"Copy command","rerun":"Re-run","deleteRecord":"Delete record","searchPlaceholder":"Search...","searchMode":"Search","filterMode":"Filter","prevShiftEnter":"Previous (Shift+Enter)","nextEnter":"Next (Enter)","loadingTerminal":"Loading terminal...","clickToInput":"Click terminal area to type","stdinPlaceholder":"stdin input...","runningText":"Running...","exitCode":"Exit code: {{code}}","totalLines":"{{count}} lines total","globalCommands":"Global Commands","projectCommands":"Project Commands","noCustomCommands":"No custom commands yet","namePlaceholder":"Name","commandPlaceholder":"Command","restoreTooltip":"Restore ({{modKey}}M / ESC)","screenshotting":"Screenshotting...","outputFileDeleted":"[Output file deleted]"},"browser":{"blankPage":"Blank page","copyUrl":"Copy URL","openInNewWindow":"Open in new window","exitMaximize":"Exit maximize ({{modKey}}M)","maximize":"Maximize ({{modKey}}M)","pageLoadFailed":"Page load failed","clickToWake":"Click to wake","sleeping":"Sleeping","loadingPage":"Loading...","loadFailed":"Load failed"},"database":{"connectionFailed":"Connection failed","connected":"Connected","connecting":"Connecting...","refreshTableList":"Refresh table list","filterTable":"T Tables","filterView":"V Views","noTables":"No tables","tabStructure":"Structure","tabData":"Data","tabSql":"SQL","filterActive":"Filter: {{count}} cols","clearAllFilters":"Clear all filters","deleteNRows":"Delete {{count}} rows","confirmDeleteRows":"Confirm delete?","copyCsvSelected":"Copy selected rows as CSV","copyCsvAll":"Export all as CSV","copyJsonSelected":"Copy selected rows as JSON","copyJsonAll":"Export all as JSON","copyCSV":"Copy CSV","CSV":"CSV","copyJSON":"Copy JSON","JSON":"JSON","selectTable":"Select a table","selectTableToView":"Select a table to view structure","selectTableForData":"Select a table to view data","columns":"Columns","colName":"Name","colType":"Type","colNullable":"Nullable","colDefault":"Default","primaryKey":"Primary Key","foreignKeys":"Foreign Keys","indexes":"Indexes","enable":"Enable","commaValues":"Comma-separated values","likePattern":"%pattern%","valuePlaceholder":"Value","apply":"Apply","clearFilter":"Clear","addRow":"+ Add Row","totalRows":"{{count}} rows","rowsAffected":"{{command}} — {{count}} rows affected ({{duration}}ms)","queryRows":"{{count}} rows ({{duration}}ms)","resultTruncated":"[Results truncated to 1000 rows]","sqlPlaceholder":"Enter SQL... ({{modKey}}Enter to execute)","executing":"Executing...","execute":"▶ Execute","deleteRowsFailed":"{{count}} rows failed to delete","inputParams":"Input Parameters","resultLabel":"Result"},"mysql":{"connectionFailed":"Connection failed","connected":"Connected","connecting":"Connecting...","refreshTableList":"Refresh table list","filterTable":"T Tables","filterView":"V Views","noTables":"No tables","tabStructure":"Structure","tabData":"Data","tabSql":"SQL","filterActive":"Filter: {{count}} cols","clearAllFilters":"Clear all filters","deleteNRows":"Delete {{count}} rows","confirmDeleteRows":"Confirm delete?","copyCsvSelected":"Copy selected rows as CSV","copyCsvAll":"Export all as CSV","copyJsonSelected":"Copy selected rows as JSON","copyJsonAll":"Export all as JSON","copyCSV":"Copy CSV","CSV":"CSV","copyJSON":"Copy JSON","JSON":"JSON","selectTable":"Select a table","selectTableToView":"Select a table to view structure","selectTableForData":"Select a table to view data","columns":"Columns","colName":"Name","colType":"Type","colNullable":"Nullable","colDefault":"Default","primaryKey":"Primary Key","foreignKeys":"Foreign Keys","indexes":"Indexes","enable":"Enable","commaValues":"Comma-separated values","likePattern":"%pattern%","valuePlaceholder":"Value","apply":"Apply","clearFilter":"Clear","addRow":"+ Add Row","totalRows":"{{count}} rows","rowsAffected":"{{command}} — {{count}} rows affected ({{duration}}ms)","queryRows":"{{count}} rows ({{duration}}ms)","resultTruncated":"[Results truncated to 1000 rows]","sqlPlaceholder":"Enter SQL... ({{modKey}}Enter to execute)","executing":"Executing...","execute":"▶ Execute","deleteRowsFailed":"{{count}} rows failed to delete"},"redis":{"neverExpires":"Never expires","expired":"Expired","loadFailed":"Load failed","deleteFailed":"Delete failed","saveFailed":"Save failed","scanPlaceholder":"SCAN pattern...","scanSearch":"Search (SCAN)","noKeys":"No keys","loadMore":"Load more...","tabData":"Data","tabInfo":"Info","tabCli":"CLI","selectKey":"Select a key","keyNotExist":"Key does not exist","unsupportedType":"Unsupported type: {{type}}","nItems":"{{total}} items","showingN":"showing {{count}}","nMembers":"{{total}} members","nEntries":"{{total}} entries","cliHint":"Enter Redis commands, e.g. PING, GET key, KEYS *","cliPlaceholder":"Enter command..."},"git":{"switchBranch":"Switch branch","searchBranch":"Search branches...","noBranches":"No branches available","noMatchingBranches":"No matching branches","localBranches":"Local Branches","remoteBranches":"Remote Branches","branchNotFound":"Branch not found","selectBranch":"Select branch...","currentBranch":"Current","notGitRepo":"Current directory is not a Git repository","cannotGetBranches":"Cannot get branch info","getBranchesFailed":"Failed to get branch info","discardAllConfirm":"Discard changes in {{count}} workspace files? This cannot be undone.","worktree":{"title":"Git Worktree","count":"{{count}} worktrees","selectBranch":"Select branch","addWorktree":"+ Add Worktree","confirmDelete":"Confirm Delete","confirmDeleteMsg":"Delete this worktree?","path":"Path:","branch":"Branch:","locked":"Locked","unlock":"Unlock","lock":"Lock","searchBranch":"Search branches...","noBranches":"No available branches"}},"comments":{"addComment":"Add Comment","lineRange":"Line {{start}}-{{end}}","inputPlaceholder":"Enter comment...","newComment":"New comment {{range}}","commentPlaceholder":"Enter comment... ({{modKey}}Enter to submit, Esc to cancel)","nComments":"{{count}} comments","allComments":"All Comments","copyAllComments":"Copy all comments","noComments":"No comments yet","clearAll":"Clear all","totalComments":"{{count}} comments total","aiReply":"AI Reply","noContent":"(no content)","linesCount":"({{count}} lines)","codeRef":"Here are my annotated comments and references:","note":"Note: {{content}}","submitting":"Submitting...","enterSubmit":"Enter to submit \xb7 Shift+Enter for new line","submitComment":"Submit Comment","askAI":"Ask AI","inputQuestion":"Enter your question...","aiGenerating":"Generating, please wait...","enterSend":"Enter to send \xb7 Shift+Enter for new line","sendToAI":"Send to AI","aiResponding":"AI is responding..."},"fileContextMenu":{"createFile":"New File","copyFile":"Copy File","copyFolder":"Copy Folder","pasteHere":"Paste Here","deleteFile":"Delete File","deleteFolder":"Delete Folder","copyRelativePath":"Copy Relative Path","copyAbsolutePath":"Copy Absolute Path","copyRelativeDirPath":"Copy Relative Dir Path","copyAbsoluteDirPath":"Copy Absolute Dir Path","copyFileName":"Copy File Name","copyFolderName":"Copy Folder Name"},"settings":{"title":"Settings","theme":"Theme","themeLight":"Light","themeDark":"Dark","themeSystem":"System","browserExtension":"Browser Extension","extensionInstalled":"Cockpit Bridge installed","extensionNotInstalled":"Cockpit Bridge not installed","extensionDescription":"After installing the Chrome extension, link navigation in iframes will be intercepted: new tab links create new bubbles, page navigation updates the current bubble.","installSteps":"Installation steps:","step1":"1. Open Chrome and navigate to","step2":"2. Enable \\"Developer mode\\" in the top-right corner","step3":"3. Click \\"Load unpacked\\"","step4mac":"4. Press <kbd>Cmd+Shift+G</kbd> → paste the path below → Enter","copyExtensionPath":"Copy extension directory path","reloadExtension":"Reload extension","about":"About","language":"Language","languageAuto":"System","switchDark":"Switch to dark","switchLight":"Switch to light","agentsBundled":"bundled"},"editor":{"placeholder":"Write something... Type / for commands","noteTitle":"{{name}} - Notes","noteUntitled":"Notes","saving":"Saving...","conflictReloaded":"This note was changed elsewhere. Loaded the latest version; your recent unsaved edits were discarded.","linkPlaceholder":"Enter URL...","confirmLink":"Confirm","removeLink":"Remove link","heading1":"Heading 1","heading2":"Heading 2","heading3":"Heading 3","bold":"Bold","italic":"Italic","strikethrough":"Strikethrough","inlineCode":"Inline code","link":"Link","bulletList":"Bullet list","orderedList":"Ordered list","taskList":"Task list","blockquote":"Blockquote","codeBlock":"Code block","table":"Table","horizontalRule":"Horizontal rule","insertRowAbove":"Insert row above","insertRowBelow":"Insert row below","insertColumnLeft":"Insert column left","insertColumnRight":"Insert column right","deleteRow":"Delete row","deleteColumn":"Delete column","deleteTable":"Delete table","deleteCodeBlock":"Delete code block","toc":"TOC","expandToc":"Expand TOC","collapseToc":"Collapse TOC"},"slashCommands":{"heading1":"Heading 1","heading1Desc":"Large heading","heading2":"Heading 2","heading2Desc":"Medium heading","heading3":"Heading 3","heading3Desc":"Small heading","bulletList":"Bullet List","bulletListDesc":"Bulleted list","orderedList":"Ordered List","orderedListDesc":"Numbered list","taskList":"Task List","taskListDesc":"Checkable task list","blockquote":"Blockquote","blockquoteDesc":"Quote block","codeBlock":"Code Block","codeBlockDesc":"Code snippet","table":"Table","tableDesc":"Insert 3\xd73 table","horizontalRule":"Divider","horizontalRuleDesc":"Horizontal divider","link":"Link","linkDesc":"Insert hyperlink"},"commands":{"qa":"Enter requirements clarification mode","fx":"Enter bug evidence-chain analysis mode","ex":"Enter structured analysis & discussion mode","go":"Enter landing mode: MVP staged implementation","cg":"Enter CodeGraph exploration mode","plan":"Enable plan mode \xb7 /plan <task> to plan it \xb7 /plan off to disable"},"review":{"reviewManagement":"Review Management","allReviews":"All Reviews","noOpenReviews":"No open reviews","viewComments":"View comments","nComments":"{{count}} comments","nDocs":"{{count}} docs","nReviews":"{{count}} reviews","docList":"Document List","allReviewsList":"All Reviews","expandList":"Expand list","collapseList":"Collapse list","closeReview":"Close review","reopenReview":"Reopen","deleteReview":"Delete review","noOpenDocs":"No open documents","noReviews":"No reviews","sharing":"Sharing","notShared":"Not shared","closeSharing":"Disable sharing","enableSharing":"Enable sharing","view":"View","setNickname":"Set your nickname","nicknameHint":"Other reviewers will see this name","nicknamePlaceholder":"Enter nickname","skipForNow":"Skip for now","identitySettings":"Identity Settings","reviewNickname":"Review Nickname","random":"Random","selectTextToComment":"Select text to add comment","selectTextHint":"Select text on the left to add a comment","prevComment":"Previous","nextComment":"Next","commentsCount":"{{count}} comments","commentsNavCount":"{{current}}/{{total}} comments","allCommentsTitle":"All Comments","commentsCountBrief":"{{count}}","closedCount":"{{count}} closed","copyAllComments":"Copy all comments","noComments":"No comments yet","closedComments":"Closed ({{count}})","closedLabel":"Closed","moreReplies":"+{{count}} replies","copyComment":"Copy comment","reopen":"Reopen","closeComment":"Close comment","editComment":"Edit comment","deleteComment":"Delete comment","edited":"(edited)","editReply":"Edit reply","deleteReply":"Delete reply","reply":"Reply","replyPlaceholder":"Add a reply...","selectedText":"Selected text","addCommentPlaceholder":"Add a comment...","enterSubmitHint":"Enter to submit, Shift+Enter for new line","commentBtn":"Comment","reviewNotExist":"Review does not exist or has been deleted","loadFailed":"Load failed","networkError":"Network error","reviewNotFound":"Review not found","checkLink":"Please check the link","updatedAt":"Updated {{date}}","active":"Active","closed":"Closed","viewAllComments":"View all comments","viewCommentBtn":"View Comments","copyLink":"Copy Link","reviewSummary":"Review Comments Summary — {{title}}","totalNComments":"{{count}} comments total","quoteRef":"Quote: \\"{{text}}\\"","commentAuthor":"Comment ({{author}}): {{content}}","replyAuthor":" ↳ {{author}}: {{content}}"},"markdown":{"copied":"✓ Copied","copy":"Copy"},"imagePreview":{"previewImage":"Preview image","deleteImage":"Delete image","copyImage":"Copy image","copiedImage":"Image copied"},"tokenStats":{"title":"Claude Code Token Stats","activeHours":"Active Hours Distribution","hourSessions":"{{h}}:00 — {{count}} sessions","messages":"Messages","toolCalls":"Tool Calls","activityTrend":"Activity Trend","byModel":"By Model","tokenUsage":"Token Usage","equivalentCost":"Equivalent Cost","modelCostDetail":"Model Cost Details","model":"Model","share":"Share","total":"Total","totalSessions":"Total Sessions","totalMessages":"Total Messages","equivalentApiCost":"Equivalent API Cost","longestSession":"Longest Session","firstUse":"First Use","notFound":"~/.claude/stats-cache.json not found","day":"Day","week":"Week","month":"Month"},"toolCall":{"inputParams":"Input Parameters","resultLabel":"Result","inputParamsTitle":"View input parameters","resultTitle":"View result","input":"Input","result":"Result","foldedLines":"... ({{count}} lines)"},"fileEditor":{"unsavedConfirm":"You have unsaved changes. Close anyway?","discardChanges":"Discard changes","continueEditing":"Continue editing","externallyModified":"File was modified externally. Saving will overwrite external changes.","useDiskVersion":"Use disk version","forceOverwrite":"Force overwrite"},"quickFileOpen":{"placeholder":"Type file name to open...","noMatch":"No matching files","recent":"Recent","selectHint":"Select","openHint":"Open","closeHint":"Close"},"envManager":{"title":"Environment Variables","tabScope":"Current Tab Only","globalScope":"Global Environment Variables","varNamePlaceholder":"Variable name (e.g. NODE_ENV)","varValuePlaceholder":"Value (e.g. production)","valuePlaceholder":"Value","noVars":"No environment variables yet. Add one to get started."},"aliasManager":{"title":"Command Aliases","description":"Set shortcut aliases for common commands (global)","aliasPlaceholder":"Alias (e.g. ll)","commandPlaceholder":"Full command (e.g. ls -la)","fullCommandPlaceholder":"Full command","usage":"Usage tip:","usageDesc":"Type an alias to execute the corresponding full command","noAliases":"No command aliases yet. Add one to get started."},"diffViewer":{"fileChanges":"File Changes ({{count}})","toggleFileTree":"Toggle file tree","selectFileToView":"Select a file to view changes","sideBySide":"Side by side","unified":"Unified","viewSplit":"Split","viewUnified":"Unified","previewFile":"Preview file","copiedAll":"Full text copied","compact":"Compact","full":"Full","gap":{"hidden":"{{count}} lines hidden","more":"\xb7\xb7\xb7 more +{{count}} \xb7\xb7\xb7","expandUp":"Expand {{count}} lines up","expandDown":"Expand {{count}} lines down"},"loadingSnapshots":"Loading snapshots…","noChanges":"No file changes detected in this turn","notViewable":"Binary or oversized file — diff not viewable","externalChange":"Concurrent change from another session/process","reconstructed":"reconstructed","reconstructedHint":"Rebuilt from tool-call parameters — not a disk snapshot","truncated":"Too many files — list truncated","imageBefore":"Before","imageAfter":"After","imageAdded":"Added","imageDeleted":"Deleted","imageLoadFailed":"Failed to load image","imageUnavailable":"Image not present in either revision"},"commitDetail":{"title":"Commit Details","hash":"Hash:","author":"Author:","date":"Date:","files":"Files:","nChanges":"{{count}} changes","loadingFiles":"Loading files...","noFileChanges":"No file changes","loadingDiff":"Loading diff...","selectFileToView":"Select a file to view diff"},"askQuestion":{"title":"Questions","nQuestions":"{{count}} questions","checkedN":"{{count}} checked","copyChecked":"Copy {{count}} checked Q&A","copyAll":"Copy all Q&A","sendChecked":"Send {{count}} checked Q&A to AI","sendAll":"Send all Q&A to AI","sendNoChat":"No active chat session","checkToCopy":"Check to copy","custom":"Custom","customPlaceholder":"Enter custom answer...","notSelected":"(not selected)"},"tabBar":{"closeTab":"Close tab","closeAll":"Close all tabs","newTab":"New tab"},"tabManagerTopBar":{"copyPageUrl":"Copy page URL","copyDirPath":"Copy directory path","refreshProject":"Refresh project","openInVSCode":"Open in VS Code","openInCursor":"Open in Cursor","aliasesGlobal":"Command Aliases (Global)","tokenStats":"Token Stats","openSurething":"Open Surething"},"hoverTooltip":{"findReferences":"Find References","search":"Search"},"todoViewer":{"title":"Task List","progress":"{{completed}} / {{total}} done"},"userMessages":{"title":"User Messages","noMessages":"No user messages"},"shortIdBadge":{"clickToDisconnect":"Click to disconnect","clickToRegister":"Click to register and copy CLI command","setTitle":"Name this bubble (so /cc can find it later)","setTitlePlaceholder":"set title","editTitle":"Edit title","titleSet":"Title: {{title}}","dialogTitle":"Name this bubble","dialogPlaceholder":"e.g. alloydb proxy, staging admin"},"api":{"pathForbidden":"Operation not allowed on this path","deleteForbidden":"Delete not allowed on this path","notAFolder":"Target is not a folder","imageTooLarge":"Image too large to preview","cannotPreviewBinary":"Cannot preview binary file","fileTooLarge":"File too large to preview (over 10MB)","fileModifiedExternally":"File was modified externally","pickFolderPrompt":"Select project folder"},"confirm":{"title":"Notice","ok":"OK","cancel":"Cancel"},"floatingToolbar":{"addComment":"Add Comment","sendToAI":"Send to AI","search":"Search"},"quickReply":{"optionA":"A","optionB":"B","optionC":"C","optionD":"D","allRecommended":"Rest recommended","thisOne":"This one","notThis":"Not this","why":"Why?","elaborate":"Say more","example":"Give an example","start":"Do it","continue":"Continue","ok":"OK","done":"Done","edit":"Edit quick replies","editTitle":"Edit quick replies","editHint":"One line per row; separate phrases with commas. Each phrase is sent to the chat exactly as written.","editPlaceholder":"This one, Not this\\nWhy?, Say more","restoreDefault":"Restore defaults","save":"Save","cancel":"Cancel","customizedFor":"Customizing the {{lang}} phrases — the other language is unaffected.","langEn":"English","langZh":"Chinese","saveFailed":"Failed to save quick replies"},"searchResults":{"title":"Search Results","nMatches":"({{count}} matches)","searching":"Searching...","noResults":"No matches","scopeSelected":"Selected","scopeAll":"All"},"references":{"title":"References","searching":"Searching...","notFound":"No references found"},"gitFileTree":{"noFiles":"No files"},"deps":{"action":"Dependencies","none":"none","symbolMessage":"Analyse the dependencies of {{name}} ({{path}}:{{lines}}).\\n\\nCallers: {{callers}}\\nCalls: {{callees}}\\nExternal: {{externals}}\\n\\nExplain which modules it is coupled to, and which of those dependencies could be narrowed."},"explain":{"action":"Explain","fileMessage":"Explain {{path}}","symbolMessage":"Explain {{name}} ({{path}}:{{lines}})","selectionMessage":"Explain","commitFileMessage":"Explain what git commit {{hash}} changed in {{path}}","compareFileMessage":"Explain the git changes to {{path}} in {{base}}..HEAD","stagedFileMessage":"Explain the git staged changes to {{path}}","unstagedFileMessage":"Explain the git working tree changes to {{path}}"},"reviewUtils":{"adjectives":["Happy","Brave","Quiet","Bright","Gentle","Agile","Free","Clear","Flying","Relaxed","Lively","Wise","Calm","Alert","Composed","Steady","Cheerful","Warm","Bold","Poised"],"nouns":["Panda","Dolphin","Crane","Snow Leopard","Skylark","Squirrel","Flying Fish","Deer","Bluebird","Silver Fox","Owl","Dragonfly","Firefly","Sea Turtle","Butterfly","Monkey","Red-crowned Crane","Antelope","Swallow","Penguin"]}}'),f=JSON.parse('{"common":{"save":"保存","cancel":"取消","delete":"删除","close":"关闭","minimize":"最小化","copy":"复制","edit":"编辑","file":"文件","codeMap":"代码地图","diff":"Diff","confirm":"确认","loading":"加载中...","search":"搜索","refresh":"刷新","retry":"重试","submit":"提交","copied":"已复制","saved":"已保存","failed":"失败","noMatch":"无匹配","noData":"无数据","done":"完成","justNow":"刚刚","minutesAgo":"{{count}}分钟前","hoursAgo":"{{count}}小时前","daysAgo":"{{count}}天前","monthsAgo":"{{count}}个月前","yearsAgo":"{{count}}年前","saveFailed":"保存失败","copyFailed":"复制失败","deleteFailed":"删除失败","operationFailed":"操作失败","copiedPath":"已复制路径","copyPath":"复制路径","openInConsole":"在 Console 气泡打开","copyAbsPath":"复制绝对路径","loadMore":"加载更多","noResult":"无匹配结果","selected":"已选择","selectAll":"全选","hint":"提示","confirmBtn":"确定","cancelBtn":"取消","preview":"预览","readable":"可读","previous":"上一个","next":"下一个","all":"全部","input":"输入","result":"结果","line":"行","lines":"行","running":"运行中","connecting":"连接中","connected":"已连接","connectionFailed":"连接失败","builtin":"内置","global":"全局","project":"项目","current":"当前","code":"代码"},"htmlApps":{"title":"HTML 应用","addTooltip":"添加到 HTML 面板","added":"已添加到 HTML 面板","alreadyAdded":"已添加过","addFailed":"添加失败","add":"添加","adding":"添加中...","addHtmlApp":"添加 HTML 应用","searchPlaceholder":"搜索 HTML 应用...","pathLabel":".html 文件的绝对路径","invalid":"无效","builtin":"内置","noDescription":"无描述","emptyNoApps":"还没有自定义 HTML 应用。","emptyCreatePrefix":"在聊天里使用","emptyCreateSuffix":"创建新应用。","addExisting":"添加已有 HTML 文件","viewDocs":"查看文档","emptyNoMatch":"没有匹配的 HTML 应用。"},"skills":{"addTooltip":"添加到 Skills 面板","added":"已添加到 Skills 面板","alreadyAdded":"已添加过","addFailed":"添加失败","title":"Skills","searchPlaceholder":"搜索 skills...","clearSearch":"清除","addSkill":"添加 Skill","emptyNoSkills":"还没有 skill。","emptyIntroPrefix":"在聊天里使用","emptyIntroSuffix":"把可复用经验整理成 SKILL.md。","emptyNoMatch":"没有匹配的 skill。","viewDocs":"查看文档","pathLabel":"SKILL.md 的绝对路径","pathPlaceholder":"/Users/you/.../skills/foo/SKILL.md","add":"添加","adding":"添加中...","invalid":"无效","copyPath":"复制路径","noDescription":"无描述","previewTitle":"Skill 预览","source":"源码","cannotRead":"无法读取文件。"},"toast":{"savedSuccess":"已保存","saveFailed":"保存失败","copiedName":"已复制: {{name}}","copyFailed":"复制失败","deleteFailed":"删除失败","operationFailed":"操作失败","staged":"已暂存","stageFailed":"暂存失败","unstaged":"已取消暂存","unstageFailed":"取消暂存失败","stagedNFiles":"已暂存 {{count}} 个文件","unstagedNFiles":"已取消暂存 {{count}} 个文件","discardFailed":"放弃变更失败","discardedNFiles":"已放弃 {{count}} 个文件的变更","deletedFile":"已删除文件","discardedChanges":"已放弃变更","pastedFile":"已粘贴: {{name}}","pasteFailed":"粘贴失败","noFileToPaste":"没有可粘贴的文件","createdFile":"已创建文件: {{name}}","createFailed":"创建失败","movedToTrash":"已移动到回收站: {{name}}","copiedPageUrl":"已复制页面地址","copiedDirPath":"已复制目录路径","switchedToBranch":"已切换到 {{branch}}","switchBranchFailed":"切换分支失败","loadBranchFailed":"加载分支列表失败","copiedCommand":"已复制: {{command}}","copiedMessage":"已复制消息","forkFailed":"分叉会话失败","excerptFailed":"摘录本轮失败","copiedUrl":"已复制网址","copiedOutput":"已复制输出","copiedCmd":"已复制命令","copiedComment":"已复制评论","copiedAllComments":"已复制全部评论","copiedFileContent":"已复制文件内容","copiedQA":"已复制 {{count}} 个问答","copiedAllQA":"已复制所有问答","sentQA":"已发送给 AI","readFileFailed":"读取文件失败","fileOutsideProject":"文件在当前项目之外,仅支持预览 Markdown、CSV 和图片","reviewCreated":"评审已创建,链接已复制","reviewUpdated":"评审已更新,链接已复制","reviewCreateFailed":"创建评审失败","sharingClosed":"已关闭分享","sharingCloseFailed":"关闭分享失败","linkCopied":"链接已复制","addCommentFailed":"添加评论失败","deleteCommentFailed":"删除评论失败","editCommentFailed":"编辑评论失败","addReplyFailed":"添加回复失败","deleteReplyFailed":"删除回复失败","editReplyFailed":"编辑回复失败","disconnected":"已断开: {{id}}","pluginReloading":"插件重载中...","worktreeCreateSuccess":"Worktree 创建成功: {{name}}","worktreeCreateFailed":"创建 worktree 失败","worktreeLoadFailed":"加载 worktree 列表失败","worktreeDeleted":"Worktree 已删除","worktreeDeleteFailed":"删除 worktree 失败","worktreeLocked":"已锁定","worktreeUnlocked":"已解锁"},"workspace":{"selectProject":"选择一个项目开始","searchProjectPath":"搜索项目路径...","loadingProjects":"加载项目中...","projectNotFound":"未找到项目","sessions":"{{count}} 会话","loadingSessions":"加载会话...","noSessions":"无会话记录","loadingText":"加载中...","openProject":"打开项目","expandSidebar":"展开侧边栏","collapseSidebar":"折叠侧边栏","notes":"笔记","skills":"技能","apps":"应用","settings":"设置","help":"帮助","updateAvailable":"新版本 v{{version}} 可用","copyUpgradeCommand":"复制 cockpit update","updateNow":"立即更新","updating":"正在更新…","updateComplete":"更新完成","updateFailed":"更新失败","updateCardPreparing":"正在准备更新…","updateCardInstalling":"正在下载并安装","updateCardRepairing":"正在修复原生依赖","updateCardUpToDate":"已是最新版本 v{{version}}","updateCardCopyFix":"复制修复命令","updateCardFixCopied":"已复制修复命令","updateCardRollingBack":"安装失败,正在回滚","updateCardRestarting":"正在重启 Cockpit…","updateCardDone":"已更新到 v{{version}}","updateCardElapsed":"已用 {{seconds}} 秒","updateCardBaseline":"上次约 {{seconds}} 秒","updateCardNoLiveStatus":"暂时读不到实时状态,更新仍在进行","updateCardRolledBack":"已回滚到原版本,Cockpit 可正常使用。","updateCardManualHint":"可在终端手动重试:","updateCardLogHint":"日志:{{path}}","updateRestartNote":"Cockpit 将在后台重启。","viewChangelog":"查看变更日志","serverRestarted":"Cockpit 已在后台更新。","reloadNow":"刷新","upgradeCommandCopied":"已复制 `cockpit update`","projectNotes":"项目笔记","closeProject":"关闭项目"},"mobile":{"useDesktop":"桌面版","messagePlaceholder":"发消息…","send":"发送","stop":"停止","enableNotifications":"开启通知","disableNotifications":"关闭通知","notifyError":"无法开启通知"},"sessions":{"recentSessions":"最近会话","favorites":"收藏会话","noFavorites":"暂无收藏会话,在 Tab 栏点击星标可添加","addFavorite":"收藏此会话","removeFavorite":"取消收藏","runningCount":"{{count}} 运行中","unreadCount":"{{count}} 未读","noSessions":"暂无会话记录","running":"运行中","done":"完成","editTitle":"编辑标题","projectSessions":"项目会话","browseAllSessions":"浏览所有会话","sessionList":"会话列表","search":"搜索","searchSessions":"搜索会话...","searchRecentSessions":"搜索最近会话","loadSessionsFailed":"加载会话失败","loadingSessions":"加载会话中...","noMatchingSessions":"未找到匹配的会话","noSessionsYet":"暂无会话","projectList":"项目列表","openFolder":"打开文件夹","selectingFolder":"选择中...","loadingHistory":"加载历史消息..."},"scheduledTasks":{"title":"定时任务","aboutToTrigger":"即将触发","secondsLater":"{{count}}秒后","minutesLater":"{{count}}分钟后","hoursMinutesLater":"{{h}}小时{{m}}分后","hoursLater":"{{h}}小时后","onceType":"一次性 ({{minutes}}分钟)","everyNMinutes":"每{{minutes}}分钟","completed":"已完成","paused":"已暂停","activeCount":"{{running}} 个活跃","pausedCount":"{{paused}} 个暂停","noScheduledTasks":"暂无定时任务,在聊天输入栏点击时钟按钮创建","lastResult":"上次","runNow":"立即运行","resume":"恢复","pause":"暂停","completedCount":"已完成 ({{count}})","groupPendingReview":"运行完成待查看","groupUpcoming":"运行中 \xb7 待运行","openSession":"打开会话","selectTaskHint":"选择左侧任务,查看它的会话消息","noTaskMessages":"该任务的会话暂无消息","success":"成功","failure":"失败","createTask":"创建定时任务","editTask":"编辑定时任务","sendMessage":"发送消息","messagePlaceholder":"输入要发送的消息...","taskFile":"任务文件","taskFilePlaceholder":"/Users/you/project/tasks/daily-report.md","taskFileHint":"填写绝对路径。触发时会让 agent 先读取该文件,再按其中描述执行——文件内容改动下次触发即生效。","taskFilePromptHeader":"请先读取以下任务文件,再据此执行:","type":"类型","once":"一次性","interval":"周期","quickSelect":"快捷选择","customCron":"自定义 Cron 表达式","customMinutes":"自定义分钟数","cronPlaceholder":"例: 0 9 * * 1-5 (工作日9点)","cronFormat":"格式:分 时 日 月 星期(如 0 9 * * 1-5)","minutesPlaceholder":"分钟数","limitTimeRange":"限制执行时段","to":"至","saveBtn":"保存 ({{modKey}}↩)","createBtn":"创建 ({{modKey}}↩)","5minLater":"5 分钟后","15minLater":"15 分钟后","30minLater":"30 分钟后","1hourLater":"1 小时后","every15min":"每 15 分钟","every30min":"每 30 分钟","every1hour":"每 1 小时","every2hours":"每 2 小时","daily9am":"每天 09:00","daily6pm":"每天 18:00","weeklyMon9am":"每周一 09:00","monthly1st9am":"每月 1 号 09:00"},"cron":{"everyNMinutes":"每 {{n}} 分钟","everyNHours":"每 {{n}} 小时整点","everyMinute":"每分钟","everyHourAtMin":"每小时第 {{m}} 分","hourlyEveryMin":"{{h}} 点每分钟","daily":"每天 {{time}}","weekdays":"工作日","weekends":"周末","dowSun":"日","dowMon":"一","dowTue":"二","dowWed":"三","dowThu":"四","dowFri":"五","dowSat":"六","monthPrefix":"月","dayOfMonth":"号","dayRange":"{{a}}号到{{b}}号","weekdayPrefix":"周","weekdayRange":"周{{a}}到周{{b}}"},"blockViewer":{"empty":{"body":"在左侧文件树选择一个文件,查看它的代码地图。","hint":"或按 ⌘K 搜索。"},"fileMode":{"loading":"加载中…","notFound":"该文件未索引(不支持的语言或超出文件上限)。"},"buildProgress":{"listing":"正在扫描文件…","contexts":"正在读取项目配置…","parsing":"正在解析文件","resolving":"正在解析引用关系…","edges":"正在构建调用图…","done":"即将完成…"},"search":{"tooltip":"搜索 (⌘K)","hint":"开始输入以搜索","noResults":"未找到匹配","files":"文件","symbols":"符号"},"viewerToggle":{"toBlock":"显示代码地图","toCode":"返回代码视图"},"toc":{"title":"本文件","empty":"未检测到函数。","notIndexed":"该文件未被项目图收录(扩展未支持 / 不在 git 跟踪集 / 超出文件上限)。"},"history":{"title":"历史","empty":"点击左右两侧的 pin 开始追踪调用链。","clear":"清空历史"},"refresh":"重新构建项目图","retry":"重试"},"blockDiffViewer":{"loading":"正在生成代码地图…","unsupported":"该文件类型暂不支持代码地图 diff","unsupportedHint":"切回常规 diff 视图查看。","error":"代码地图 diff 失败:{{message}}","noBlockChanges":"代码地图无变化(仅格式或空白)。","noBefore":"(新增)","noAfter":"(已删除)","kind":{"added":"新增","deleted":"删除","modified":"修改"}},"fileBrowser":{"directoryTree":"目录树","searchTab":"搜索","recentTab":"最近","changesTab":"变更","historyTab":"历史","searchFiles":"搜索文件...","clear":"清除","exactMatchOn":"全词匹配(已开启)","exactMatchOff":"全词匹配(已关闭)","refreshTree":"刷新目录树","collapseAll":"折叠所有目录","searchFileContent":"搜索文件内容...","caseSensitive":"区分大小写","wholeWord":"完整词","regex":"正则","fileTypes":"文件类型 (ts,tsx)","compareMode":"对比","compareModeOff":"关闭分支对比","compareModeOn":"与选定分支对比","createFile":"新建文件","createFileIn":"新建文件 (在 {{path}}/)","fileName":"文件名...","noRecentFiles":"暂无最近浏览的文件","stagingArea":"暂存区 ({{count}})","changesSummary_one":"{{count}} 个变更","changesSummary_other":"{{count}} 个变更","noChanges":"工作区无变更","refreshChanges":"刷新变更列表","unstageAll":"全部取消","noStagedFiles":"无暂存的文件","unstageNFiles":"取消暂存 {{count}} 个文件","unstageFile":"取消暂存","workspace":"工作区 ({{count}})","discardAll":"放弃所有","stageAll":"全部暂存","noUnstagedChanges":"无未暂存的变更","discardNFiles":"放弃 {{count}} 个文件的变更","stageNFiles":"暂存 {{count}} 个文件","discardChanges":"放弃变更","stageFile":"暂存文件","loadingDiff":"加载对比文件中...","noDiffFiles":"无差异文件","nFilesChanged":"{{count}} 个文件变更(vs {{branch}})","loadingCommits":"加载提交记录中...","noCommits":"无提交记录","allLoaded":"已加载全部 {{count}} 条记录","locateInTree":"在目录树中定位","unsaved":"未保存","saveBeforeSwitch":"当前文件有未保存的修改,是否保存后切换?","saveAndSwitch":"保存并切换","closeEdit":"关闭编辑 (ESC)","closeBtn":"关闭","copyFileContent":"复制文件内容","toggleJsonReadable":"切换 JSON 可读模式","previewMarkdown":"预览 Markdown 渲染效果","exitPreview":"退出预览","collapseAllJson":"折叠","expandAllJson":"展开","viewBlame":"查看每行代码的修改记录","viewDiff":"查看相对 HEAD 的改动","exitDiff":"退出 Diff","diffLoadFailed":"加载差异失败","editFile":"编辑文件","backToPreview":"返回预览","cannotPreview":"无法预览此文件","selectFileToPreview":"选择文件以预览","staged":"已暂存","unstaged":"未暂存","selectFileToViewDiff":"选择文件查看差异","loadingDiffContent":"加载差异中...","clickCompareToLoad":"点击「对比」加载分支差异","selectCommitToView":"选择提交查看详情","confirmDelete":"确认删除","confirmDeleteMessage":"确定要将 <file>{{name}}</file> 移动到回收站吗?","nFilesNMatches":"{{files}} 个文件,{{matches}} 处匹配","resultsTruncated":"结果已截断","noContentSearchResults":"无匹配结果","enterKeywordToSearch":"输入关键词搜索文件内容","searchMinChars":"搜索内容至少需要 2 个字符"},"csv":{"table":"表格","raw":"原始内容","empty":"空表格","summary":"{{rows}} 行 \xb7 {{cols}} 列","summaryFiltered":"匹配 {{rows}} / {{total}} 行 \xb7 {{cols}} 列","loadMore":"加载更多(已显示 {{shown}} / {{total}})","filterPlaceholder":"筛选内容…","filterColumn":"筛选列","clearFilter":"清除筛选","allColumns":"全部列","noMatch":"没有匹配的行","sortHint":"点击排序(升序 / 降序 / 取消)"},"codeViewer":{"fileModifiedExternally":"文件已被外部修改,保存将覆盖外部更改","useDiskVersion":"使用磁盘版本","forceOverwrite":"强制覆盖","searchPlaceholder":"搜索...","caseSensitive":"区分大小写","wholeWordMatch":"全字匹配","unsavedConfirm":"有未保存的修改,确定关闭?","discardChanges":"放弃修改","continueEditing":"继续编辑","unsavedExitConfirm":"有未保存的修改,确定退出编辑模式?","clickToViewDetails":"点击查看详情","clickToViewCommit":"点击查看 commit 详情","nComments":"{{count}} 条评论","searchChat":"搜索聊天内容...","prevShiftEnter":"上一个 (Shift+Enter)","nextEnter":"下一个 (Enter)","closeEsc":"关闭 (Esc)"},"chat":{"startConversation":"开始对话吧","loadMoreHistory":"加载更多...","scrollUpForMore":"↑ 向上滚动加载更多历史","jumpToStart":"跳转到开始","jumpToLatest":"跳转到最新","jumpToPrevUserMessage":"上一条用户消息","jumpToNextUserMessage":"下一条用户消息","copyMessage":"复制消息","copyImage":"复制图片","copiedImage":"已复制图片","forkSession":"从此处分叉会话","excerptTurn":"摘录本轮到新会话","imageN":"图片 {{index}}","imagePreview":"图片预览","toolCalls":"{{count}} 个工具调用","collapse":"▲ 收起","expand":"▼ 展开","subagent":"子代理","subagentEmpty":"未找到子代理消息记录","subagentViewTitle":"查看子代理执行过程","workflowRun":"运行详情","workflowViewTitle":"查看工作流运行详情","workflowEmpty":"未找到工作流运行记录","workflowAgents":"个代理","workflowViewAgent":"查看","workflowUngrouped":"未分组","viewQuestions":"查看提问","viewAllFileChanges":"查看所有文件变更","requestFailed":"请求失败","cannotReadStream":"无法读取响应流","errorRetry":"发生错误,请重试","placeholder":"输入消息,Enter 发送(Shift+Enter 换行,可粘贴图片;行首 /(主会话)或 @(子代理)唤起命令,支持多行多命令)","placeholderDisabled":"生成中... 可继续输入 (ESC 取消;卡住太久可取消后重发「继续」)","imageSizeLimit":"图片大小超过限制(最大 5MB),当前大小: {{size}}MB","viewGitChanges":"查看 Git 变更","viewAllComments":"查看所有评论","userMessages":"用户消息列表","projectNotes":"项目笔记","scheduledTasks":"定时任务","quickPrompts":"快捷 Prompt","globalPrompts":"全局 Prompt","projectPrompts":"项目 Prompt","noQuickPrompts":"暂无快捷 Prompt","addQuickPrompt":"新增快捷 Prompt","quickPromptPlaceholder":"输入一句话 Prompt,Enter 保存,Esc 取消","insertQuickPrompt":"填入输入框(不发送)","context":"上下文","output":"输出","copiedCommandTooltip":"已复制!","copyCommandTooltip":"复制命令: {{command}}","executedCommand":"执行了 `{{command}}`{{exitInfo}},输出:\\n```\\n{{output}}\\n```","executedCommandFailed":"执行 `{{command}}` 失败:{{error}}","executionMode":"执行模式","checkBalance":"查询余额","balanceFailed":"查询失败,请检查 API Key","balanceNeedsKey":"请先配置 DeepSeek API Key","balanceUnavailable":"账户当前不可用","balanceEmpty":"接口未返回余额","openUsagePage":"打开 DeepSeek 用量控制台","checkQuota":"查询额度","quotaFailed":"额度查询失败,请检查 API Key","quotaNeedsKey":"请先设置 API Key","quotaEmpty":"未返回额度信息","quotaResetAt":"{{time}} 重置","openProviderConsole":"打开服务商控制台","planMode":"计划模式","planModeDesc":"只读\xb7先出计划不改代码","planModeOn":"已开启计划模式——只读;发一个任务即可拿到计划","planModeOff":"已关闭计划模式","planModeHint":"计划模式:只读探索、产出计划但不改文件。取消勾选后重发才会实现。","noHistory":"独立任务","noHistoryDesc":"不发送历史","noHistoryHint":"独立任务:每条消息单独发给模型,不带之前的对话。上方的会话记录照常保留。","planTitle":"计划(待你确认)","approvePlan":"批准并执行","planApproveHint":"本环境无审批弹窗,点此退出计划模式并执行","approvePlanPrompt":"已批准,按上述计划开始执行。"},"console":{"enterCommandOrUrl":"输入命令或网址开始使用","emptyIntro":"在下方输入框输入以下内容,即可创建对应气泡:","bubbleCommand":"命令","bubbleInteractive":"交互终端","bubbleBrowser":"浏览器","bubbleBrowserNoteIframe":"部分网站会拦截 iframe 嵌入,请在「设置 → 浏览器插件」安装 Cockpit Bridge 后再打开。","bubbleBrowserNoteCookie":"已登录的网站若首次显示未登录,多刷新几次即可恢复。","bubbleDatabase":"数据库","bubbleNotebook":"笔记本","loadingMore":"加载中...","loadMoreHistory":"加载更多历史","quickCommands":"快捷命令","singleColumn":"单列布局","dualColumn":"双列布局","envVars":"环境变量","launchShell":"启动交互终端","htmlApps":"HTML 应用","inputPlaceholder":"输入命令或网址并按 Enter... (↑↓ 历史, Tab 补全)","scopeProject":"项目","scopeGlobal":"全局","tabSwitchEscClose":"Tab 切换 \xb7 Esc 关闭","copyOutput":"复制输出","copyCommand":"复制命令","rerun":"重新运行","deleteRecord":"删除记录","searchPlaceholder":"搜索...","searchMode":"搜索","filterMode":"过滤","prevShiftEnter":"上一个 (Shift+Enter)","nextEnter":"下一个 (Enter)","loadingTerminal":"加载终端...","clickToInput":"点击终端区域输入","stdinPlaceholder":"stdin 输入...","runningText":"运行中...","exitCode":"退出代码: {{code}}","totalLines":"共 {{count}} 行","globalCommands":"全局命令","projectCommands":"项目命令","noCustomCommands":"暂无自定义命令","namePlaceholder":"名称","commandPlaceholder":"命令","restoreTooltip":"还原 ({{modKey}}M / ESC)","screenshotting":"截图中...","outputFileDeleted":"[输出文件已删除]"},"browser":{"blankPage":"空白页","copyUrl":"复制网址","openInNewWindow":"在新窗口打开","exitMaximize":"退出最大化 ({{modKey}}M)","maximize":"最大化 ({{modKey}}M)","pageLoadFailed":"页面加载失败","clickToWake":"点击唤醒","sleeping":"已休眠","loadingPage":"加载中...","loadFailed":"加载失败"},"database":{"connectionFailed":"连接失败","connected":"已连接","connecting":"连接中...","refreshTableList":"刷新表列表","filterTable":"T 表","filterView":"V 视图","noTables":"无表","tabStructure":"结构","tabData":"数据","tabSql":"SQL","filterActive":"筛选: {{count}}列","clearAllFilters":"清除所有筛选","deleteNRows":"删除 {{count}} 行","confirmDeleteRows":"确认删除?","copyCsvSelected":"复制选中行为 CSV","copyCsvAll":"导出全表 CSV","copyJsonSelected":"复制选中行为 JSON","copyJsonAll":"导出全表 JSON","copyCSV":"复制 CSV","CSV":"CSV","copyJSON":"复制 JSON","JSON":"JSON","selectTable":"选择左侧表格","selectTableToView":"选择表以查看结构","selectTableForData":"选择表以查看数据","columns":"列","colName":"名称","colType":"类型","colNullable":"可空","colDefault":"默认值","primaryKey":"主键","foreignKeys":"外键","indexes":"索引","enable":"启用","commaValues":"逗号分隔多值","likePattern":"%pattern%","valuePlaceholder":"值","apply":"应用","clearFilter":"清除","addRow":"+ 新增行","totalRows":"{{count}} 行","rowsAffected":"{{command}} — {{count}} 行受影响 ({{duration}}ms)","queryRows":"{{count}} 行 ({{duration}}ms)","resultTruncated":"[结果已截断至1000行]","sqlPlaceholder":"输入 SQL... ({{modKey}}Enter 执行)","executing":"执行中...","execute":"▶ 执行","deleteRowsFailed":"{{count}} 行删除失败","inputParams":"输入参数","resultLabel":"结果"},"mysql":{"connectionFailed":"连接失败","connected":"已连接","connecting":"连接中...","refreshTableList":"刷新表列表","filterTable":"T 表","filterView":"V 视图","noTables":"无表","tabStructure":"结构","tabData":"数据","tabSql":"SQL","filterActive":"筛选: {{count}}列","clearAllFilters":"清除所有筛选","deleteNRows":"删除 {{count}} 行","confirmDeleteRows":"确认删除?","copyCsvSelected":"复制选中行为 CSV","copyCsvAll":"导出全表 CSV","copyJsonSelected":"复制选中行为 JSON","copyJsonAll":"导出全表 JSON","copyCSV":"复制 CSV","CSV":"CSV","copyJSON":"复制 JSON","JSON":"JSON","selectTable":"选择左侧表格","selectTableToView":"选择表以查看结构","selectTableForData":"选择表以查看数据","columns":"列","colName":"名称","colType":"类型","colNullable":"可空","colDefault":"默认值","primaryKey":"主键","foreignKeys":"外键","indexes":"索引","enable":"启用","commaValues":"逗号分隔多值","likePattern":"%pattern%","valuePlaceholder":"值","apply":"应用","clearFilter":"清除","addRow":"+ 新增行","totalRows":"{{count}} 行","rowsAffected":"{{command}} — {{count}} 行受影响 ({{duration}}ms)","queryRows":"{{count}} 行 ({{duration}}ms)","resultTruncated":"[结果已截断至1000行]","sqlPlaceholder":"输入 SQL... ({{modKey}}Enter 执行)","executing":"执行中...","execute":"▶ 执行","deleteRowsFailed":"{{count}} 行删除失败"},"redis":{"neverExpires":"永不过期","expired":"已过期","loadFailed":"加载失败","deleteFailed":"删除失败","saveFailed":"保存失败","scanPlaceholder":"SCAN 模式...","scanSearch":"搜索 (SCAN)","noKeys":"无 key","loadMore":"加载更多...","tabData":"数据","tabInfo":"信息","tabCli":"CLI","selectKey":"选择左侧 Key","keyNotExist":"Key 不存在","unsupportedType":"不支持的类型: {{type}}","nItems":"{{total}} items","showingN":"显示 {{count}}","nMembers":"{{total}} members","nEntries":"{{total}} entries","cliHint":"输入 Redis 命令,如 PING, GET key, KEYS *","cliPlaceholder":"输入命令..."},"git":{"switchBranch":"切换分支","searchBranch":"搜索分支...","noBranches":"无可切换分支","noMatchingBranches":"无匹配分支","localBranches":"本地分支","remoteBranches":"远程分支","branchNotFound":"未找到分支","selectBranch":"选择分支...","currentBranch":"当前","notGitRepo":"当前目录不是 Git 仓库","cannotGetBranches":"无法获取分支信息","getBranchesFailed":"获取分支信息失败","discardAllConfirm":"确定要放弃工作区的 {{count}} 个文件的变更吗?此操作不可恢复。","worktree":{"title":"Git Worktree","count":"{{count}} 个 worktree","selectBranch":"选择分支","addWorktree":"+ 添加 Worktree","confirmDelete":"确认删除","confirmDeleteMsg":"确定要删除 worktree 吗?","path":"路径:","branch":"分支:","locked":"已锁定","unlock":"解锁","lock":"锁定","searchBranch":"搜索分支...","noBranches":"无可用分支"}},"comments":{"addComment":"添加评论","lineRange":"行 {{start}}-{{end}}","inputPlaceholder":"输入评论...","newComment":"新评论 {{range}}","commentPlaceholder":"输入评论... ({{modKey}}Enter 提交, Esc 取消)","nComments":"{{count}} 条评论","allComments":"所有评论","copyAllComments":"复制全部评论","noComments":"暂无评论","clearAll":"清空所有","totalComments":"共 {{count}} 条评论","aiReply":"AI 回复","noContent":"(无内容)","linesCount":"({{count}} 行)","codeRef":"以下是我标注的评论和引用:","note":"备注: {{content}}","submitting":"提交中...","enterSubmit":"Enter 提交 \xb7 Shift+Enter 换行","submitComment":"提交评论","askAI":"提问 AI","inputQuestion":"输入你的问题...","aiGenerating":"正在生成中,请稍候...","enterSend":"Enter 发送 \xb7 Shift+Enter 换行","sendToAI":"发送 AI","aiResponding":"AI 正在响应中..."},"fileContextMenu":{"createFile":"新建文件","copyFile":"复制文件","copyFolder":"复制文件夹","pasteHere":"粘贴到此处","deleteFile":"删除文件","deleteFolder":"删除文件夹","copyRelativePath":"复制相对路径","copyAbsolutePath":"复制绝对路径","copyRelativeDirPath":"复制相对文件夹路径","copyAbsoluteDirPath":"复制绝对文件夹路径","copyFileName":"复制文件名","copyFolderName":"复制文件夹名"},"settings":{"title":"设置","theme":"主题","themeLight":"浅色","themeDark":"深色","themeSystem":"跟随系统","browserExtension":"浏览器插件","extensionInstalled":"Cockpit Bridge 已安装","extensionNotInstalled":"Cockpit Bridge 未安装","extensionDescription":"安装 Chrome 插件后,iframe 内的链接跳转将被拦截:新标签链接创建新气泡,页面内导航更新当前气泡。","installSteps":"安装步骤:","step1":"1. 打开 Chrome 地址栏输入","step2":"2. 开启右上角「开发者模式」","step3":"3. 点击「加载已解压的扩展程序」","step4mac":"4. 按 <kbd>Cmd+Shift+G</kbd> → 粘贴下方路径 → 回车","copyExtensionPath":"复制插件目录路径","reloadExtension":"重载插件","about":"关于","language":"语言","languageAuto":"跟随系统","switchDark":"切换暗色","switchLight":"切换亮色","agentsBundled":"内置"},"editor":{"placeholder":"写点什么... 输入 / 打开快捷命令","noteTitle":"{{name}} - 笔记","noteUntitled":"笔记","saving":"保存中...","conflictReloaded":"笔记已被其他地方修改,已加载最新版本,刚才未保存的编辑已丢弃","linkPlaceholder":"输入链接地址...","confirmLink":"确认","removeLink":"移除链接","heading1":"标题 1","heading2":"标题 2","heading3":"标题 3","bold":"粗体","italic":"斜体","strikethrough":"删除线","inlineCode":"行内代码","link":"链接","bulletList":"无序列表","orderedList":"有序列表","taskList":"待办列表","blockquote":"引用","codeBlock":"代码块","table":"表格","horizontalRule":"分割线","insertRowAbove":"在上方插入行","insertRowBelow":"在下方插入行","insertColumnLeft":"在左侧插入列","insertColumnRight":"在右侧插入列","deleteRow":"删除当前行","deleteColumn":"删除当前列","deleteTable":"删除表格","deleteCodeBlock":"删除代码块","toc":"目录","expandToc":"展开目录","collapseToc":"收起目录"},"slashCommands":{"heading1":"标题 1","heading1Desc":"大标题","heading2":"标题 2","heading2Desc":"中标题","heading3":"标题 3","heading3Desc":"小标题","bulletList":"无序列表","bulletListDesc":"项目符号列表","orderedList":"有序列表","orderedListDesc":"编号列表","taskList":"待办列表","taskListDesc":"可勾选的任务列表","blockquote":"引用","blockquoteDesc":"引用块","codeBlock":"代码块","codeBlockDesc":"代码片段","table":"表格","tableDesc":"插入 3\xd73 表格","horizontalRule":"分割线","horizontalRuleDesc":"水平分割线","link":"链接","linkDesc":"插入超链接"},"commands":{"qa":"进入需求澄清讨论模式","fx":"进入 bug 证据链分析模式","ex":"进入结构化分析讨论模式","go":"进入连续落地(MVP)模式","cg":"进入 CodeGraph 探索模式","plan":"开启计划模式 \xb7 /plan <任务> 直接规划该任务 \xb7 /plan off 关闭"},"review":{"reviewManagement":"评审管理","allReviews":"所有评审","noOpenReviews":"暂无开放评审","viewComments":"查看评论","nComments":"{{count}} 条评论","nDocs":"{{count}} 文档","nReviews":"{{count}} 评审","docList":"文档列表","allReviewsList":"所有评审","expandList":"展开列表","collapseList":"折叠列表","closeReview":"关闭评审","reopenReview":"重新开放","deleteReview":"删除评审","noOpenDocs":"暂无开放文档","noReviews":"暂无评审","sharing":"分享中","notShared":"未分享","closeSharing":"关闭分享","enableSharing":"开启分享评审","view":"查看","setNickname":"设置你的昵称","nicknameHint":"其他评审人将看到这个名字","nicknamePlaceholder":"输入昵称","skipForNow":"下次再说","identitySettings":"身份设置","reviewNickname":"评审昵称","random":"随机","selectTextToComment":"选中左侧文本添加评论","selectTextHint":"选中左侧文本即可添加评论","prevComment":"上一条","nextComment":"下一条","commentsCount":"{{count}} 条评论","commentsNavCount":"{{current}}/{{total}} 条评论","allCommentsTitle":"全部评论","commentsCountBrief":"{{count}} 条","closedCount":"{{count}} 条已关闭","copyAllComments":"复制全部评论","noComments":"暂无评论","closedComments":"已关闭 ({{count}})","closedLabel":"已关闭","moreReplies":"+{{count}} 条回复","copyComment":"复制评论","reopen":"重开","closeComment":"关闭评论","editComment":"编辑评论","deleteComment":"删除评论","edited":"(已编辑)","editReply":"编辑回复","deleteReply":"删除回复","reply":"回复","replyPlaceholder":"添加回复...","selectedText":"选中文本","addCommentPlaceholder":"添加评论...","enterSubmitHint":"Enter 提交,Shift+Enter 换行","commentBtn":"评论","reviewNotExist":"评审不存在或已被删除","loadFailed":"加载失败","networkError":"网络错误","reviewNotFound":"评审不存在","checkLink":"请检查链接是否正确","updatedAt":"更新于 {{date}}","active":"开放中","closed":"已关闭","viewAllComments":"查看全部评论","viewCommentBtn":"查看评论","copyLink":"复制链接","reviewSummary":"评审评论汇总 — {{title}}","totalNComments":"共 {{count}} 条评论","quoteRef":"引用: \\"{{text}}\\"","commentAuthor":"评论 ({{author}}): {{content}}","replyAuthor":" ↳ {{author}}: {{content}}"},"markdown":{"copied":"✓ 已复制","copy":"复制"},"imagePreview":{"previewImage":"预览图片","deleteImage":"删除图片","copyImage":"复制图片","copiedImage":"已复制图片"},"tokenStats":{"title":"Claude Code Token 统计","activeHours":"活跃时段分布","hourSessions":"{{h}}:00 — {{count}} 次会话","messages":"消息","toolCalls":"工具调用","activityTrend":"活动趋势","byModel":"按模型","tokenUsage":"Token 用量","equivalentCost":"等效费用","modelCostDetail":"模型费用明细","model":"模型","share":"占比","total":"合计","totalSessions":"总会话","totalMessages":"总消息","equivalentApiCost":"等效 API 费用","longestSession":"最长会话","firstUse":"首次使用","notFound":"未找到 ~/.claude/stats-cache.json","day":"日","week":"周","month":"月"},"toolCall":{"inputParams":"输入参数","resultLabel":"结果","inputParamsTitle":"查看输入参数","resultTitle":"查看结果","input":"输入","result":"结果","foldedLines":"... ({{count}} 行)"},"fileEditor":{"unsavedConfirm":"有未保存的修改,确定关闭?","discardChanges":"放弃修改","continueEditing":"继续编辑","externallyModified":"文件已被外部修改,保存将覆盖外部更改","useDiskVersion":"使用磁盘版本","forceOverwrite":"强制覆盖"},"quickFileOpen":{"placeholder":"输入文件名快速打开...","noMatch":"没有匹配的文件","recent":"最近","selectHint":"选择","openHint":"打开","closeHint":"关闭"},"envManager":{"title":"环境变量管理","tabScope":"当前 Tab 专用","globalScope":"全局环境变量","varNamePlaceholder":"变量名(如 NODE_ENV)","varValuePlaceholder":"值(如 production)","valuePlaceholder":"值","noVars":"还没有环境变量,添加一个试试"},"aliasManager":{"title":"命令别名管理","description":"为常用命令设置快捷别名(全局生效)","aliasPlaceholder":"别名(如 ll)","commandPlaceholder":"完整命令(如 ls -la)","fullCommandPlaceholder":"完整命令","usage":"使用提示:","usageDesc":"输入别名即可执行对应的完整命令","noAliases":"还没有命令别名,添加一个试试"},"diffViewer":{"fileChanges":"文件变更 ({{count}})","toggleFileTree":"切换文件目录","selectFileToView":"选择左侧文件查看变更","sideBySide":"并列对比","unified":"统一对比","viewSplit":"双栏","viewUnified":"单栏","previewFile":"预览文件","copiedAll":"已复制全文","compact":"精简","full":"全文","gap":{"hidden":"已隐藏 {{count}} 行","more":"\xb7\xb7\xb7 更多 +{{count}} \xb7\xb7\xb7","expandUp":"向上展开 {{count}} 行","expandDown":"向下展开 {{count}} 行"},"loadingSnapshots":"正在加载快照…","noChanges":"本轮未检测到文件变更","notViewable":"二进制或超大文件,无法展示 diff","externalChange":"同期其他会话/外部进程的变更","reconstructed":"参数重建","reconstructedHint":"由工具调用参数重建,非磁盘快照","truncated":"文件过多,仅显示部分","imageBefore":"变更前","imageAfter":"变更后","imageAdded":"新增","imageDeleted":"已删除","imageLoadFailed":"图片加载失败","imageUnavailable":"该版本无此图片"},"commitDetail":{"title":"提交详情","hash":"哈希:","author":"作者:","date":"日期:","files":"文件:","nChanges":"{{count}} 个变更","loadingFiles":"加载文件中...","noFileChanges":"无文件变更","loadingDiff":"加载差异中...","selectFileToView":"选择文件查看差异"},"askQuestion":{"title":"提问","nQuestions":"{{count}} 个问题","checkedN":"已勾选 {{count}}","copyChecked":"复制勾选的 {{count}} 个问答","copyAll":"复制所有问答","sendChecked":"发送勾选的 {{count}} 个问答给 AI","sendAll":"发送所有问答给 AI","sendNoChat":"没有可用的聊天会话","checkToCopy":"勾选以复制","custom":"自定义","customPlaceholder":"输入自定义回答...","notSelected":"(未选择)"},"tabBar":{"closeTab":"关闭标签","closeAll":"关闭所有标签","newTab":"新建标签"},"tabManagerTopBar":{"copyPageUrl":"复制页面地址","copyDirPath":"复制目录路径","refreshProject":"刷新当前项目","openInVSCode":"在 VS Code 中打开","openInCursor":"在 Cursor 中打开","aliasesGlobal":"命令别名(全局)","tokenStats":"Token 统计","openSurething":"打开 Surething"},"hoverTooltip":{"findReferences":"查找引用","search":"搜索"},"todoViewer":{"title":"任务列表","progress":"{{completed}} / {{total}} 完成"},"userMessages":{"title":"用户消息列表","noMessages":"暂无用户消息"},"shortIdBadge":{"clickToDisconnect":"点击断开连接","clickToRegister":"点击注册并复制 CLI 命令","setTitle":"给这个气泡命名(便于 /cc 通过 connection list 找到它)","setTitlePlaceholder":"设置标题","editTitle":"编辑标题","titleSet":"标题:{{title}}","dialogTitle":"给气泡命名","dialogPlaceholder":"例如:alloydb 代理、预发管理后台"},"api":{"pathForbidden":"不允许操作此路径","deleteForbidden":"不允许删除此路径","notAFolder":"目标不是文件夹","imageTooLarge":"图片文件过大,无法预览","cannotPreviewBinary":"无法预览二进制文件","fileTooLarge":"文件过大,无法预览(超过 10MB)","fileModifiedExternally":"文件已被外部修改","pickFolderPrompt":"选择项目文件夹"},"confirm":{"title":"提示","ok":"确定","cancel":"取消"},"floatingToolbar":{"addComment":"添加评论","sendToAI":"发送 AI","search":"搜索"},"quickReply":{"optionA":"A","optionB":"B","optionC":"C","optionD":"D","allRecommended":"其他按推荐","thisOne":"就这个","notThis":"不要这样","why":"为什么","elaborate":"展开说","example":"举个例子","start":"开始做","continue":"继续","ok":"OK","done":"做完了","edit":"编辑快捷短语","editTitle":"编辑快捷短语","editHint":"一行对应面板的一行,行内用逗号分隔。每个短语会原样发送到对话。","editPlaceholder":"就这个,不要这样\\n为什么,展开说","restoreDefault":"恢复默认","save":"保存","cancel":"取消","customizedFor":"当前编辑的是{{lang}}短语,另一种语言不受影响。","langEn":"英文","langZh":"中文","saveFailed":"保存快捷短语失败"},"searchResults":{"title":"搜索结果","nMatches":"({{count}} 处匹配)","searching":"搜索中...","noResults":"无匹配结果","scopeSelected":"选中","scopeAll":"全部"},"references":{"title":"引用","searching":"搜索中...","notFound":"未找到引用"},"gitFileTree":{"noFiles":"无文件"},"deps":{"action":"依赖关系","none":"无","symbolMessage":"分析 {{name}} ({{path}}:{{lines}}) 的依赖关系。\\n\\n调用者:{{callers}}\\n调用了:{{callees}}\\n外部依赖:{{externals}}\\n\\n请说明它耦合在哪些模块上,以及哪些依赖是可以收敛掉的。"},"explain":{"action":"解释一下","fileMessage":"解释一下 {{path}}","symbolMessage":"解释一下 {{name}} ({{path}}:{{lines}})","selectionMessage":"解释一下","commitFileMessage":"解释一下 git commit {{hash}} 对 {{path}} 的改动","compareFileMessage":"解释一下 git {{base}}..HEAD 中 {{path}} 的改动","stagedFileMessage":"解释一下 git 暂存区中 {{path}} 的改动","unstagedFileMessage":"解释一下 git 工作区中 {{path}} 的改动"},"reviewUtils":{"adjectives":["快乐","勇敢","安静","明亮","温柔","灵巧","自由","清澈","飞翔","悠闲","活泼","聪慧","淡定","机敏","从容","坚定","爽朗","和煦","奔放","沉稳"],"nouns":["熊猫","海豚","白鹤","雪豹","云雀","松鼠","飞鱼","梅花鹿","青鸟","银狐","猫头鹰","蜻蜓","萤火虫","海龟","蝴蝶","金丝猴","丹顶鹤","羚羊","燕子","企鹅"]}}');d.Ay.isInitialized||d.Ay.init({resources:{en:{translation:e},zh:{translation:f}},lng:"en",fallbackLng:"en",interpolation:{escapeValue:!1}});let g=d.Ay},2122:(a,b,c)=>{"use strict";c.d(b,{J:()=>bm});var d=c(48249),e=c(67484),f=c(44384),g=c(46674),h=c(15273),i=c(62956),j=c(82594),k=c(10316),l=c(72419),m=c(44218),n=c(7833),o=c(34678);function p(a){let b=function(a){let b=0xffffffff;for(let c=0;c<a.length;c++){b^=a.charCodeAt(c);for(let a=0;a<8;a++)b=b>>>1^(1&b?0xedb88320:0)}return(0xffffffff^b)>>>0}(a),c="",d=b;for(let a=0;a<4;a++)c+=String.fromCharCode(97+d%26),d=Math.floor(d/26);return c}var q=c(29939),r=c(33281),s=c(74429);function t({open:a,anchorRef:b,initialValue:c,onCancel:g,onSave:h}){let{t:i}=(0,f.Bd)(),[j,k]=(0,e.useState)(c),[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)(null),p=(0,e.useRef)(null),q=(0,e.useRef)(null);if((0,e.useCallback)(()=>{let a=b.current;if(!a)return;let c=a.getBoundingClientRect(),d=q.current?.offsetHeight??0,e=c.bottom+4;if(d&&e+d>window.innerHeight-8){let a=c.top-4-d;a>=8&&(e=a)}let f=c.left;o({top:e,left:f=Math.max(f=Math.min(f,window.innerWidth-260-8),8)})},[b]),!a||"u"<typeof document)return null;let r=async()=>{if(!l){m(!0);try{await h(j.trim())}finally{m(!1)}}};return(0,s.createPortal)((0,d.jsxs)("div",{ref:q,style:{top:n?.top??0,left:n?.left??0,width:260,visibility:n?"visible":"hidden"},className:"fixed z-[100] rounded-lg border border-border bg-card p-3 shadow-lv3",children:[(0,d.jsx)("div",{className:"mb-2 text-sm font-medium text-foreground",children:i("shortIdBadge.dialogTitle")}),(0,d.jsx)("input",{ref:p,type:"text",value:j,onChange:a=>k(a.target.value.slice(0,64)),onKeyDown:a=>{"Enter"!==a.key||a.nativeEvent.isComposing||229===a.keyCode||(a.preventDefault(),r())},placeholder:i("shortIdBadge.dialogPlaceholder"),maxLength:64,className:"w-full rounded border border-border bg-background px-2 py-1.5 text-sm font-mono outline-none focus:border-brand"}),(0,d.jsxs)("div",{className:"mt-3 flex justify-end gap-2 text-sm",children:[(0,d.jsx)("button",{onClick:g,className:"rounded px-3 py-1 text-muted-foreground hover:bg-hover",disabled:l,children:i("common.cancel")}),(0,d.jsx)("button",{onClick:()=>void r(),className:"rounded bg-brand px-3 py-1 text-white hover:opacity-90 disabled:opacity-50",disabled:l,children:l?"…":i("common.save")})]})]}),document.body)}var u=c(23328);let v=(0,e.memo)(function({shortId:a,type:b,onRegister:c,onUnregister:g,fullId:h,projectCwd:i,tabId:j}){let{t:k}=(0,f.Bd)(),[l,m]=(0,e.useState)(!1),[o,p]=(0,e.useState)(""),[s,v]=(0,e.useState)(!1),w=(0,e.useRef)(null);(0,e.useEffect)(()=>{if(!h||!i||!j)return;let a=!1;return r.t4.runPromiseExit((0,u.MR)(i,j)).then(b=>{if(a||"Success"!==b._tag)return;let c=b.value[h];"string"==typeof c&&p(c)}),()=>{a=!0}},[h,i,j]),(0,q.h)({url:"/ws/global-state",enabled:!!h&&!!i&&!!j,onMessage:a=>{"console-delta"!==a.type||"rename"!==a.op||a.cwd!==i||a.tabId!==j||a.titles&&h&&Object.prototype.hasOwnProperty.call(a.titles,h)&&p(a.titles[h]??"")}});let x=(0,e.useCallback)(async d=>{if(d.stopPropagation(),l)await g(),m(!1),(0,n.oR)(k("toast.disconnected",{id:a}));else{await c(),m(!0);let d=`cockpit ${b} ${a}`;navigator.clipboard.writeText(d),(0,n.oR)(k("toast.copiedCommand",{command:d}))}},[l,a,b,c,g,k]),y=!!(h&&i&&j),z=(0,e.useCallback)(a=>{a.stopPropagation(),y&&v(!0)},[y]),A=(0,e.useCallback)(async a=>{h&&i&&j&&("Success"===(await r.t4.runPromiseExit((0,u.y8)(i,j,h,a)))._tag&&p(a),v(!1))},[h,i,j]);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("button",{onClick:x,onDoubleClick:a=>a.stopPropagation(),className:"inline-flex items-center gap-1 text-[10px] font-mono leading-none px-1.5 py-0.5 rounded flex-shrink-0 transition-colors bg-muted/60 hover:bg-muted text-muted-foreground",title:l?k("shortIdBadge.clickToDisconnect"):k("shortIdBadge.clickToRegister"),children:[(0,d.jsx)("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${l?"bg-green-500":"bg-muted-foreground/40"}`}),a]}),y&&(o?(0,d.jsxs)("span",{className:"inline-flex items-center gap-0.5 text-[10px] leading-none flex-shrink-0 text-muted-foreground",title:k("shortIdBadge.titleSet",{title:o})||o,children:[(0,d.jsx)("span",{className:"px-1 py-0.5 rounded bg-muted/40 max-w-[120px] truncate",children:o}),(0,d.jsx)("button",{ref:w,onClick:z,className:"opacity-50 hover:opacity-100 transition-opacity","aria-label":k("shortIdBadge.editTitle"),title:k("shortIdBadge.editTitle"),children:"✎"})]}):(0,d.jsxs)("button",{ref:w,onClick:z,className:"inline-flex items-center gap-0.5 text-[10px] leading-none flex-shrink-0 text-muted-foreground/50 hover:text-muted-foreground italic transition-colors",title:k("shortIdBadge.setTitle"),children:["(",k("shortIdBadge.setTitlePlaceholder"),") ✎"]})),(0,d.jsx)(t,{open:s,anchorRef:w,initialValue:o,onCancel:()=>v(!1),onSave:A})]})});var w=c(28602),x=c(79606);let y=(0,e.lazy)(()=>c.e(8764).then(c.bind(c,98764)).then(a=>({default:a.XtermRenderer}))),z={c:"\x03",d:"\x04",z:"\x1a",l:"\f",a:"\x01",e:"\x05",u:"\x15",w:"\x17"},A=/\x1b\[[0-9;]*m/g;function B({output:a,query:b,mode:c,currentIdx:f,matchListRef:g}){let h=(0,e.useRef)(null);h.current||(h.current=new o.v,h.current.use_classes=!0);let i=a.split("\n"),j=b.toLowerCase(),k=0;return g.current=[],(0,d.jsx)("pre",{className:"text-sm font-mono whitespace-pre-wrap break-words select-text",children:i.map((a,b)=>{let e=a.replace(A,""),i=e.toLowerCase().includes(j);if("filter"===c&&!i)return null;if(!i){let c=h.current.ansi_to_html(a);return(0,d.jsx)("div",{dangerouslySetInnerHTML:{__html:c}},b)}let l=[],m=0,n=e.toLowerCase(),o=0;for(;o<n.length;){let a=n.indexOf(j,o);if(-1===a)break;a>m&&l.push((0,d.jsx)("span",{children:e.slice(m,a)},`t${m}`));let b=k++,c=b===f;l.push((0,d.jsx)("mark",{ref:a=>{g.current[b]=a},className:c?"bg-brand/40 text-foreground":"bg-yellow-300/40 text-foreground",children:e.slice(a,a+j.length)},`m${a}`)),o=m=a+j.length}return m<e.length&&l.push((0,d.jsx)("span",{children:e.slice(m)},`t${m}`)),(0,d.jsx)("div",{children:l},b)})})}let C=(0,e.memo)(function({commandId:a,tabId:b,projectCwd:c,command:q,output:s,exitCode:t,isRunning:A,selected:C,onSelect:D,onInterrupt:E,onStdin:F,onDelete:G,onRerun:H,timestamp:I,usePty:J,subscribePtyOutput:K,subscribePtyReset:L,subscribePtyRefresh:M,onPtyResize:N,onToggleMaximize:O,maximized:P,expandedHeight:Q,bubbleContentHeight:R,onTitleMouseDown:S}){let{t:T}=(0,f.Bd)(),U=(0,e.useRef)(null),V=(0,e.useRef)(null),W=(0,e.useRef)(!0),X=(0,e.useRef)(null),Y=(0,e.useRef)(null),Z=(a=>{if(!a)return"";let b=new Date(a);if(isNaN(b.getTime()))return"";let c=String(b.getMonth()+1).padStart(2,"0"),d=String(b.getDate()).padStart(2,"0"),e=String(b.getHours()).padStart(2,"0"),f=String(b.getMinutes()).padStart(2,"0");return`${c}-${d} ${e}:${f}`})(I),$=a&&b?p(b+a):void 0,[_,aa]=(0,e.useState)(!1),[ab,ac]=(0,e.useState)(""),ad=(0,e.useRef)(null),ae=(0,e.useRef)(null);(0,e.useEffect)(()=>{if(!K||!a)return;let b=()=>ad.current?K(a,ad.current.write):null,c=b();if(c)return c;let d=setInterval(()=>{(c=b())&&clearInterval(d)},50);return()=>{clearInterval(d),c?.()}},[K,a]),(0,e.useEffect)(()=>{if(!L||!a)return;let b=()=>ad.current?L(a,ad.current.reset):null,c=b();if(c)return c;let d=setInterval(()=>{(c=b())&&clearInterval(d)},50);return()=>{clearInterval(d),c?.()}},[L,a]),(0,e.useEffect)(()=>{if(!M||!a)return;let b=()=>ad.current?M(a,ad.current.refresh):null,c=b();if(c)return c;let d=setInterval(()=>{(c=b())&&clearInterval(d)},50);return()=>{clearInterval(d),c?.()}},[M,a]);let[af,ag]=(0,e.useState)(!1),[ah,ai]=(0,e.useState)(""),[aj,ak]=(0,e.useState)("search"),[al,am]=(0,e.useState)(0),an=(0,e.useRef)([]),ao=(0,e.useRef)(null),ap=(0,e.useRef)(0);(0,e.useEffect)(()=>{ao.current||(ao.current=new o.v,ao.current.use_classes=!0)},[]),(0,e.useLayoutEffect)(()=>{let a=V.current;if(a&&ao.current){if(s.length<ap.current&&(ao.current=new o.v,ao.current.use_classes=!0,ap.current=0,a.innerHTML=""),s.length>ap.current){let b=s.slice(ap.current),c=ao.current.ansi_to_html(b);ap.current=s.length,a.insertAdjacentHTML("beforeend",c)}if(U.current){let a=U.current.scrollHeight>U.current.clientHeight;aa(a),a&&(U.current.scrollTop=U.current.scrollHeight)}}},[s]),(0,e.useEffect)(()=>(A&&W.current&&U.current&&(null!==X.current&&cancelAnimationFrame(X.current),X.current=requestAnimationFrame(()=>{U.current&&(U.current.scrollTop=U.current.scrollHeight),X.current=null})),()=>{null!==X.current&&cancelAnimationFrame(X.current)}),[s,A]),(0,e.useEffect)(()=>{if(!P)return;let a=a=>{"Escape"===a.key&&(a.preventDefault(),a.stopPropagation(),O?.())};return document.addEventListener("keydown",a,!0),()=>document.removeEventListener("keydown",a,!0)},[P,O]);let aq=s?s.split("\n").length:0,ar=(0,e.useCallback)(()=>{ag(!0),requestAnimationFrame(()=>ae.current?.focus())},[]),as=(0,e.useCallback)(()=>{ag(!1),ai(""),am(0),ad.current?.clearSearch()},[]),at=(0,e.useCallback)(a=>{a.trim()&&(J?ad.current?.findNext(a):am(a=>{let b=a+1,c=an.current[b];return c?(c.scrollIntoView({block:"nearest"}),b):(an.current[0]?.scrollIntoView({block:"nearest"}),0)}))},[J]),au=(0,e.useCallback)(a=>{a.trim()&&(J?ad.current?.findPrevious(a):am(a=>{let b=a-1;if(b>=0)return an.current[b]?.scrollIntoView({block:"nearest"}),b;let c=an.current.length-1;return c>=0&&an.current[c]?.scrollIntoView({block:"nearest"}),Math.max(c,0)}))},[J]);(0,e.useEffect)(()=>{if(!C)return;let a=a=>{if((a.metaKey||a.ctrlKey)&&"f"===a.key){a.preventDefault(),a.stopPropagation(),ar();return}if("Escape"===a.key&&af){a.preventDefault(),a.stopPropagation(),as();return}};return document.addEventListener("keydown",a,!0),()=>document.removeEventListener("keydown",a,!0)},[C,af,ar,as]);let av=P&&Q?Q-41:R??360;return(0,d.jsx)("div",{className:"flex flex-col items-start",children:(0,d.jsxs)("div",{className:`w-full bg-card text-foreground dark:text-slate-11 relative overflow-hidden border transition-colors cursor-pointer ${P?"rounded-none border-0":"rounded-2xl rounded-bl-md rounded-br-md"} ${P?"":C?"border-brand":"border-brand/30"}`,onClick:D,children:[P?(0,d.jsxs)("div",{onDoubleClick:()=>O?.(),className:"flex items-center gap-2 px-3 py-2 border-b border-border bg-card",style:{height:41,flexShrink:0},children:[(0,d.jsx)("span",{className:"text-[10px] font-mono leading-none px-1 py-0.5 rounded bg-muted text-muted-foreground",children:">_"}),(0,d.jsx)("span",{className:"flex-1 text-xs text-muted-foreground truncate font-mono",children:q}),A&&(0,d.jsxs)("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,d.jsx)("span",{className:"inline-block w-2 h-2 bg-green-500 rounded-full animate-pulse"}),T("console.runningText")]}),A&&E&&(0,d.jsx)("button",{onClick:E,className:"text-xs px-3 py-1 rounded-md font-medium bg-destructive text-destructive-foreground transition-all duration-150 hover:bg-destructive/80 hover:shadow-lv2 active:scale-95 active:bg-destructive/70 cursor-pointer select-none",children:"Ctrl+C"}),(0,d.jsx)("button",{onClick:()=>O?.(),className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-hover transition-colors",title:T("console.restoreTooltip",{modKey:(0,w.Mu)()}),children:(0,d.jsx)(g.A,{className:"w-4 h-4"})})]}):(0,d.jsxs)("div",{"data-drag-handle":!0,onMouseDown:()=>S?.(),onDoubleClick:a=>{a.stopPropagation(),O?.()},className:`flex items-center gap-2 px-4 py-1.5 border-b text-xs transition-colors cursor-grab active:cursor-grabbing ${C?"border-brand":"border-brand/30"}`,children:[(0,d.jsx)("span",{className:"text-[10px] font-mono leading-none px-1 py-0.5 rounded flex-shrink-0 bg-muted text-muted-foreground",children:">_"}),$&&a&&b&&(0,d.jsx)(v,{shortId:$,type:"terminal",onRegister:()=>{r.t4.runFork((0,u.Ok)({tabId:b,commandId:a,command:q,projectCwd:c}).pipe(x.orElse(()=>x.void)))},onUnregister:()=>{r.t4.runFork((0,u.jO)({commandId:a}).pipe(x.orElse(()=>x.void)))},fullId:a,projectCwd:c,tabId:b}),(0,d.jsx)("span",{className:"font-mono text-foreground truncate",children:q}),(0,d.jsx)("button",{onClick:a=>{a.stopPropagation(),navigator.clipboard.writeText(q),(0,n.oR)(T("toast.copiedCmd"))},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:T("console.copyCommand"),children:(0,d.jsx)(h.A,{className:"w-3.5 h-3.5"})}),(0,d.jsx)("span",{className:"flex-1"}),_&&!A&&(0,d.jsx)("span",{className:"text-muted-foreground flex-shrink-0",children:T("console.totalLines",{count:aq})}),s&&(0,d.jsx)("button",{onClick:a=>{let b;a.stopPropagation(),b=s.replace(/\x1b\[[0-9;]*m/g,""),navigator.clipboard.writeText(b),(0,n.oR)(T("toast.copiedOutput"))},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:T("console.copyOutput"),children:(0,d.jsx)(i.A,{className:"w-3.5 h-3.5"})}),H&&(0,d.jsx)("button",{onClick:a=>{a.stopPropagation(),H()},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:T("console.rerun"),children:(0,d.jsx)(j.A,{className:"w-3.5 h-3.5"})}),G&&(0,d.jsx)("button",{onClick:a=>{a.stopPropagation(),G()},className:"p-0.5 rounded text-destructive hover:text-destructive/80 transition-colors flex-shrink-0",title:T("console.deleteRecord"),children:(0,d.jsx)(g.A,{className:"w-3.5 h-3.5"})})]}),af&&(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-border bg-card",style:{flexShrink:0},children:[(0,d.jsx)(k.A,{className:"w-3.5 h-3.5 text-muted-foreground flex-shrink-0"}),(0,d.jsx)("input",{ref:ae,value:ah,onChange:a=>{let b=a.target.value;ai(b),am(0),J&&(b.trim()?ad.current?.findNext(b):ad.current?.clearSearch())},onKeyDown:a=>{"Enter"===a.key&&(a.preventDefault(),a.shiftKey?au(ah):at(ah))},placeholder:T("console.searchPlaceholder"),className:"flex-1 bg-transparent text-sm text-foreground outline-none",autoComplete:"off",spellCheck:"false"}),!J&&(0,d.jsxs)("div",{className:"flex items-center gap-0.5 text-xs flex-shrink-0",children:[(0,d.jsx)("button",{onClick:()=>ak("search"),className:`px-1.5 py-0.5 rounded transition-colors ${"search"===aj?"bg-brand/20 text-brand":"text-muted-foreground hover:text-foreground"}`,children:T("console.searchMode")}),(0,d.jsx)("button",{onClick:()=>ak("filter"),className:`px-1.5 py-0.5 rounded transition-colors ${"filter"===aj?"bg-brand/20 text-brand":"text-muted-foreground hover:text-foreground"}`,children:T("console.filterMode")})]}),(0,d.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,d.jsx)("button",{onClick:()=>au(ah),className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-hover transition-colors",title:T("console.prevShiftEnter"),children:(0,d.jsx)(l.A,{className:"w-3.5 h-3.5"})}),(0,d.jsx)("button",{onClick:()=>at(ah),className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-hover transition-colors",title:T("console.nextEnter"),children:(0,d.jsx)(m.A,{className:"w-3.5 h-3.5"})})]}),(0,d.jsx)("button",{onClick:as,className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-hover transition-colors",children:(0,d.jsx)(g.A,{className:"w-3.5 h-3.5"})})]}),J?(0,d.jsxs)("div",{className:"relative group",style:{height:av,overflow:"hidden"},children:[(0,d.jsx)(e.Suspense,{fallback:(0,d.jsx)("div",{className:"px-4 py-2 text-xs text-muted-foreground",style:{height:av},children:T("console.loadingTerminal")}),children:(0,d.jsx)(y,{ref:ad,output:s,isRunning:A,onInput:F,onResize:N,maximized:P,height:av,directWrite:!!K})}),!A&&(0,d.jsx)("div",{className:"absolute inset-0 bg-background/50 pointer-events-none"}),!A&&H&&(0,d.jsx)("div",{className:"absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",onClick:a=>{a.stopPropagation(),H()},children:(0,d.jsxs)("div",{className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-tooltip text-tooltip-foreground text-xs",children:[(0,d.jsx)(j.A,{className:"w-3.5 h-3.5"}),T("console.rerun")]})})]}):(0,d.jsx)("div",{ref:U,className:"overflow-auto px-4 py-2",style:{height:av},onScroll:()=>{if(U.current){let{scrollTop:a,scrollHeight:b,clientHeight:c}=U.current;W.current=b-a-c<50}},children:af&&ah.trim()?(0,d.jsx)(B,{output:s,query:ah,mode:aj,currentIdx:al,matchListRef:an}):(0,d.jsx)("pre",{ref:V,className:"text-sm font-mono whitespace-pre-wrap break-words select-text"})}),A&&!P&&(0,d.jsxs)("div",{className:"border-t border-border px-4 py-2 flex items-center gap-2",onClick:a=>a.stopPropagation(),children:[(0,d.jsx)("span",{className:"inline-block w-2 h-2 bg-green-500 rounded-full animate-pulse flex-shrink-0"}),J?(0,d.jsx)("span",{className:"text-xs text-muted-foreground flex-1",children:T("console.clickToInput")}):F?(0,d.jsx)("input",{ref:Y,value:ab,onChange:a=>ac(a.target.value),onKeyDown:a=>{if(a.ctrlKey&&!a.metaKey&&!a.altKey){let b=z[a.key.toLowerCase()];if(b){a.preventDefault(),a.stopPropagation(),F(b);return}}"Enter"!==a.key||a.nativeEvent.isComposing||(a.preventDefault(),F(ab+"\n"),ac("")),"Tab"===a.key&&(a.preventDefault(),F(" "))},placeholder:T("console.stdinPlaceholder"),className:"flex-1 min-w-0 bg-transparent text-xs font-mono text-foreground outline-none",autoComplete:"off",spellCheck:"false"}):(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:T("console.runningText")}),E&&(0,d.jsx)("button",{onClick:E,className:"flex-shrink-0 text-xs text-destructive hover:brightness-125 transition-colors cursor-pointer select-none",children:"Ctrl+C"}),Z&&(0,d.jsx)("span",{className:"text-[11px] text-muted-foreground flex-shrink-0",children:Z})]}),!A&&void 0!==t&&!P&&(0,d.jsxs)("div",{className:"border-t border-border px-4 py-2 flex items-center gap-2 text-xs text-muted-foreground",children:[(0,d.jsx)("span",{className:`inline-block w-2 h-2 rounded-full ${0===t?"bg-green-500":"bg-red-500"}`}),(0,d.jsx)("span",{children:T("console.exitCode",{code:t})}),(0,d.jsx)("span",{className:"flex-1"}),Z&&(0,d.jsx)("span",{className:"text-[11px] flex-shrink-0",children:Z})]})]})})});var D=c(64676);let E=new Map;function F(a){E.set(a.type,a)}function G(a){return E.get(a)}function H(a){for(let b of E.values())if(b.match(a))return b;return null}c(57031),c(88214);var I=c(71192);let J=(a,b)=>x.tryPromise({try:async()=>{let c=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)});if(!c.ok)throw Error(`HTTP ${c.status}`)},catch:b=>new I.uV({message:`POST ${a} failed`,cause:b})}),K=(a,b)=>r.t4.runPromise(J(`/api/${a}/disconnect`,{id:b}).pipe(x.orElse(()=>x.void))),L=a=>r.t4.runPromise(J("/api/browser/unregister",{id:a}).pipe(x.orElse(()=>x.void))),M=a=>r.t4.runPromise(a.pipe(x.catchAll(a=>x.sync(()=>{if(a.cause instanceof Error)throw a.cause;throw Error(a.message)})))),N=(a,b)=>{if(a&&"object"==typeof a&&"error"in a){let b=a.error;if("string"==typeof b&&b.length>0)return b;if(b&&"object"==typeof b){let a=b.message;if("string"==typeof a&&a.length>0)return a;let c=b._tag;if("string"==typeof c&&c.length>0)return c}}return`HTTP ${b}`},O=(a,b)=>M(x.tryPromise({try:async()=>{let c=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),d=await c.json();if(!c.ok)throw Error(N(d,c.status));return d},catch:b=>new I.uV({message:`POST ${a} failed`,cause:b})})),P=(a,b)=>M(x.tryPromise({try:async()=>{let c=new URLSearchParams(b),d=await fetch(`${a}?${c}`),e=await d.json();if(!d.ok)throw Error(N(e,d.status));return e},catch:b=>new I.uV({message:`GET ${a} failed`,cause:b})})),Q=(a,b)=>M(x.tryPromise({try:async()=>{let c=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)});if(!c.ok)throw Error(`HTTP ${c.status}`);return c.blob()},catch:b=>new I.uV({message:`POST blob ${a} failed`,cause:b})}));var R=c(15105);function S(a){let b=a.trim().toLowerCase();return b.startsWith("http://")||b.startsWith("https://")}async function T(a){let b=(0,R.f)()?.id??null;return!!b&&new Promise(c=>{try{let d=globalThis.chrome?.runtime;if(!d?.sendMessage)return void c(!1);let e=setTimeout(()=>c(!1),2e3);d.sendMessage(b,{type:"prepare-iframe",url:a},a=>{clearTimeout(e),c(a?.ok??!1)})}catch{c(!1)}})}function U({url:a,id:b,selected:c,maximized:g,expandedHeight:h,bubbleContentHeight:i,onSelect:j,onClose:k,onToggleMaximize:l,onNewTab:m,timestamp:o,onTitleMouseDown:q,initialSleeping:r,onSleep:s,onWake:t,projectCwd:u,tabId:x}){let{t:y,i18n:z}=(0,f.Bd)(),[A,B]=(0,e.useState)(!1),[C,E]=(0,e.useState)(null),[F,G]=(0,e.useState)(a),[H,I]=(0,e.useState)(null),[J,K]=(0,e.useState)(r??!1),M=(0,e.useRef)(null),N=(0,e.useRef)(null),O=(0,e.useRef)(null);(0,e.useRef)(!0),(0,e.useCallback)(()=>{J||(K(!0),I(null),s?.(b))},[J,b,s]),(0,e.useCallback)(()=>{M.current&&(clearTimeout(M.current),M.current=null)},[]);let{shortId:P,connected:Q,connect:R,disconnect:V}=function(a,b,c){let d=(0,e.useMemo)(()=>p(a),[a]),[f,g]=(0,e.useState)(!1),h=(0,e.useRef)(null);(0,e.useRef)([]),(0,e.useRef)(null),(0,e.useRef)(!1),(0,e.useRef)(c);let i=(0,e.useRef)([]);(0,e.useCallback)(a=>{let c=b.current;if(!c?.contentWindow){let b=h.current;b&&b.readyState===WebSocket.OPEN&&b.send(JSON.stringify({type:"browser:cmd-result",reqId:a.reqId,ok:!1,error:"iframe not available (page may be sleeping)"}));return}c.contentWindow.postMessage({type:"cockpit:cmd",reqId:a.reqId,action:a.action,params:a.params},"*")},[b]);let j=(0,e.useCallback)(()=>f&&h.current?.readyState===WebSocket.OPEN?Promise.resolve():new Promise(a=>{i.current.push(a),f||g(!0)}),[f]);return{shortId:d,connected:f,connect:j,disconnect:(0,e.useCallback)(()=>{g(!1)},[])}}(b,O,!!H&&!J&&!A);(0,e.useRef)(Q).current=Q;let W=(0,e.useCallback)(()=>{if(K(!1),t?.(b),!S(a))return void I((0,D.Kx)(a)?(0,D.hE)(a,u):(0,D.Xe)(a,u));let c=function(a){if(!a)return a;try{let b=new URL(a);return b.searchParams.set("_cockpit","1"),b.toString()}catch{let b=a.includes("?")?"&":"?";return`${a}${b}_cockpit=1`}}(a);!function(a){try{let b=new URL(a).hostname;return"localhost"===b||"127.0.0.1"===b}catch{return!1}}(a)?T(a).then(()=>I(c)):I(c)},[a,b,t,u]),X=(0,e.useCallback)(()=>{B(!1);let a=O.current?.contentWindow;if(!a)return;let b=document.documentElement.classList.contains("dark");a.postMessage({type:"THEME_CHANGE",theme:b?"dark":"light"},"*"),a.postMessage({type:"cockpit:language-change",lang:z.language},"*")},[z]),Y=(0,e.useCallback)(()=>{B(!1),E(y("browser.pageLoadFailed"))},[]),Z=(0,e.useCallback)(()=>{if(J)return void W();let a=N.current?.querySelector("iframe");if(a&&H){B(!0),E(null);let b=a.src;a.src="",setTimeout(()=>{a.src=b},0)}},[J,W,H]),$=(0,e.useCallback)(()=>{if(!F)return;let a=S(F)?F:(0,D.Kx)(F)?(0,D.hE)(F,u):(0,D.Xe)(F,u);window.open((0,D.PB)(a,window.location.origin),"_blank")},[F,u]),_=function(a){if(!a)return"";try{let b=new URL(a);return b.port?`${b.hostname}:${b.port}`:b.hostname}catch{return a.split("/").pop()||a}}(F);return(0,d.jsx)("div",{className:"flex flex-col items-start",children:(0,d.jsxs)("div",{className:`w-full bg-accent text-foreground
2
2
  relative transition-colors cursor-pointer
3
3
  ${g?"rounded-none overflow-visible border-0":"border overflow-hidden rounded-2xl rounded-bl-md rounded-br-md"}
4
4
  ${g?"":c?"border-brand":"border-brand/30"}`,onClick:g?void 0:j,children:[g?(0,d.jsxs)("div",{onDoubleClick:l,className:"flex items-center gap-2 px-3 py-2 border-b border-border bg-card",style:{height:41},children:[(0,d.jsx)("span",{className:"text-[10px] font-mono leading-none px-1 py-0.5 rounded flex-shrink-0 bg-muted text-muted-foreground",children:(0,d.jsx)("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9"})})}),P&&(0,d.jsx)(v,{shortId:P,type:"browser",onRegister:()=>R(),onUnregister:async()=>{V(),await L(P)},fullId:b,projectCwd:u,tabId:x}),(0,d.jsx)("span",{className:"text-xs text-muted-foreground truncate font-mono",children:F||y("browser.blankPage")}),F&&(0,d.jsx)("button",{onClick:a=>{a.stopPropagation(),navigator.clipboard.writeText(F),(0,n.oR)(y("toast.copiedUrl"))},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:y("browser.copyUrl"),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),(0,d.jsx)("span",{className:"flex-1"}),A&&(0,d.jsx)("span",{className:"inline-block w-3 h-3 border border-brand border-t-transparent rounded-full animate-spin flex-shrink-0"}),(0,d.jsx)("button",{onClick:Z,className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:y("common.refresh"),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}),(0,d.jsx)("button",{onClick:$,className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:y("browser.openInNewWindow"),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})}),(0,d.jsx)("button",{onClick:l,className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:y("browser.exitMaximize",{modKey:(0,w.Mu)()}),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 3v3a2 2 0 01-2 2H3m18 0h-3a2 2 0 01-2-2V3m0 18v-3a2 2 0 012-2h3M3 16h3a2 2 0 012 2v3"})})})]}):(0,d.jsxs)("div",{"data-drag-handle":!0,onMouseDown:()=>q?.(),onDoubleClick:a=>{a.stopPropagation(),l()},className:`flex items-center gap-2 px-4 py-1.5 border-b text-xs transition-colors cursor-grab active:cursor-grabbing
@@ -37,15 +37,16 @@ Error: ${c.message}`,exitCode:1,isRunning:!1,pid:void 0}:d))}},[f,B,l,z,c,a,V,aa
37
37
  ${a.path}`,children:a.icon?(0,e.jsx)("span",{className:"text-base leading-none",children:a.icon}):(0,e.jsx)(r.A,{className:"w-4 h-4"})})}function w({collapsed:a,previews:b,activePath:c,onOpenApps:d,onShowPreview:h}){let{t:i}=(0,g.Bd)(),[j,k]=(0,f.useState)(null),l=(0,f.useRef)(null),m=b.length>4,n=m?b.slice(0,3):b.slice(0,4),o=m?b.slice(3):[],p=(0,e.jsxs)("button",{type:"button",onClick:()=>{d(),k(null)},className:"w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left text-muted-foreground hover:text-foreground hover:bg-hover transition-colors",title:i("htmlApps.title"),children:[(0,e.jsx)("span",{className:"h-7 w-7 flex-shrink-0 rounded-md border border-border/70 bg-transparent flex items-center justify-center",children:(0,e.jsx)(u,{className:"w-4 h-4"})}),(0,e.jsx)("span",{className:"min-w-0 flex-1",children:(0,e.jsx)("span",{className:"block text-xs font-medium truncate",children:i("htmlApps.title")})})]},"html-apps-list"),q=a=>{h(a),k(null)},t=a=>(0,e.jsxs)("div",{className:"max-h-[19.75rem] overflow-y-auto p-1.5 space-y-1",children:[p,a.map(a=>(0,e.jsxs)("button",{type:"button",onClick:()=>q(a),className:`w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left hover:bg-hover transition-colors ${c===a.path?"text-brand":"text-muted-foreground hover:text-foreground"}`,title:a.path,children:[(0,e.jsx)("span",{className:"h-7 w-7 flex-shrink-0 rounded-md border border-border/70 bg-transparent flex items-center justify-center",children:a.icon?(0,e.jsx)("span",{className:"text-base leading-none",children:a.icon}):(0,e.jsx)(r.A,{className:"w-4 h-4"})}),(0,e.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,e.jsx)("span",{className:"block text-xs font-medium truncate",children:a.title}),(0,e.jsx)("span",{className:"block text-[10px] font-mono text-muted-foreground truncate",children:a.path})]})]},a.path))]});return a?(0,e.jsxs)("div",{ref:l,className:"relative p-2 border-t border-border",children:[(0,e.jsx)("button",{type:"button",onClick:()=>k(a=>"collapsed"===a?null:"collapsed"),className:`w-full h-8 rounded-md border bg-transparent text-muted-foreground hover:text-brand hover:border-brand/70 transition-colors flex items-center justify-center ${c?"border-brand/80 text-brand":"border-border/70"}`,title:i("htmlApps.title"),children:(0,e.jsx)(u,{className:"w-4 h-4"})}),"collapsed"===j&&(0,e.jsx)("div",{className:"absolute left-full bottom-0 ml-2 w-64 rounded-lg border border-border bg-card shadow-lv3 z-50",children:t(b)})]}):(0,e.jsx)("div",{ref:l,className:"p-2 border-t border-border",children:(0,e.jsxs)("div",{className:"grid grid-cols-5 gap-1.5",children:[(0,e.jsx)("button",{type:"button",onClick:d,className:"h-8 w-8 rounded-md border border-border/70 bg-transparent text-muted-foreground hover:text-brand hover:border-brand/70 active:scale-95 transition-all flex items-center justify-center",title:i("htmlApps.title"),children:(0,e.jsx)(u,{className:"w-4 h-4"})}),n.map(a=>(0,e.jsx)(v,{item:a,active:c===a.path,onClick:()=>q(a)},a.path)),m&&(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsx)("button",{type:"button",onClick:()=>k(a=>"more"===a?null:"more"),className:"h-8 w-8 rounded-md border border-border/70 bg-transparent text-muted-foreground hover:text-brand hover:border-brand/70 transition-colors flex items-center justify-center",title:i("common.loadMore"),children:(0,e.jsx)(s.A,{className:"w-4 h-4"})}),"more"===j&&(0,e.jsx)("div",{className:"absolute left-0 bottom-full mb-2 w-64 rounded-lg border border-border bg-card shadow-lv3 z-50",children:t(o)})]})]})})}function x({projects:a,activeIndex:b,collapsed:c,currentCwd:d,onSelectProject:r,onRemoveProject:s,onReorderProjects:t,onToggleCollapse:u,onOpenSessionBrowser:v,onOpenSettings:y,onOpenNote:z,onOpenSkills:A,onOpenApps:B,htmlAppPreviews:C,activeHtmlAppPreviewPath:D,onShowHtmlAppPreview:E,onSwitchProject:F,onResolveSessionNumbers:G,sessionOrders:H,sessionNumbers:I}){let{t:J,i18n:K}=(0,g.Bd)(),{latest:L,hasUpdate:M}=(0,p.r)(),[N,O]=(0,f.useState)(!1),P=(0,f.useRef)(null),Q=(0,f.useCallback)(()=>{navigator.clipboard.writeText("cockpit update"),(0,n.oR)(J("workspace.upgradeCommandCopied")),O(!1)},[J]),{isUpdating:R,start:S}=(0,q.P)(),T=(0,f.useCallback)(()=>{O(!1),S()},[S]),{pinnedSessions:U,unpinSession:V,updateTitle:W,reorder:X}=(0,l.P)(),{tasks:Y,unreadCount:Z,reload:$,pauseTask:_,resumeTask:aa,triggerTask:ab,deleteTask:ac,updateTask:ad,markRead:ae}=(0,m.nS)(),[af,ag]=(0,f.useState)(null),[ah,ai]=(0,f.useState)(null),[aj,ak]=(0,f.useState)([]);(0,f.useRef)(aj);let al=(0,f.useRef)($),am=(0,f.useCallback)(a=>{try{if("task-fired"===a.type)return void al.current();let{data:b}=a;if(!b)return;ak(b.sessions||[])}catch{}},[]);(0,o.h)({url:"/ws/global-state",onMessage:am});let an=new Set(aj.filter(a=>"loading"===a.status).map(a=>a.cwd)),ao=new Set(aj.filter(a=>"unread"===a.status).map(a=>a.cwd)),ap=(0,f.useMemo)(()=>{let b=new Map;for(let c of a){let a=H[c.cwd]??[],d=aj.filter(a=>a.cwd===c.cwd&&("loading"===a.status||"unread"===a.status)).map(b=>({session:b,position:a.indexOf(b.sessionId)})).sort((a,b)=>a.position>=0&&b.position>=0?a.position-b.position:a.position>=0?-1:b.position>=0?1:b.session.lastActive-a.session.lastActive).slice(0,3).map(({session:a,position:b})=>({sessionId:a.sessionId,label:b>=0?String(b+1):"\xb7",status:"loading"===a.status?"loading":"unread"}));d.length>0&&b.set(c.cwd,d)}return b},[a,aj,H]),aq=(0,f.useCallback)(a=>{ag(a)},[]),ar=(0,f.useCallback)((a,b)=>{a.preventDefault(),null!==af&&af!==b&&ai(b)},[af]),as=(0,f.useCallback)(b=>{if(null!==af&&af!==b){let c=[...a],[d]=c.splice(af,1);c.splice(b,0,d),t(c)}ag(null),ai(null)},[af,a,t]),at=(0,f.useCallback)(()=>{ag(null),ai(null)},[]);return(0,e.jsxs)("div",{className:`h-full bg-card border-r border-border flex flex-col transition-all duration-200 ${c?"w-12":"w-56"}`,children:[(0,e.jsxs)("div",{className:"group p-2 border-b border-border relative",children:[(0,e.jsxs)("button",{className:`w-full flex items-center gap-2 px-2 py-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-hover transition-colors ${c?"justify-center":""}`,onClick:v,title:c?J("workspace.openProject"):void 0,children:[(0,e.jsx)("svg",{className:"w-5 h-5 flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:(0,e.jsx)("path",{d:"M12 10v6m3-3H9m-4 7h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})}),!c&&(0,e.jsx)("span",{className:"text-sm",children:J("workspace.openProject")})]}),c?(0,e.jsx)("button",{className:"absolute inset-0 m-2 flex items-center justify-center px-2 py-2 rounded-lg bg-popover shadow-lv1 text-foreground transition z-10 opacity-0 group-hover:opacity-100 [@media(hover:none)]:opacity-100",onClick:u,title:J("workspace.expandSidebar"),children:(0,e.jsx)("svg",{className:"w-5 h-5 flex-shrink-0 rotate-180",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}):(0,e.jsx)("button",{className:"absolute top-1/2 -translate-y-1/2 right-2 p-2 rounded-lg bg-popover shadow-lv1 text-foreground transition z-10 opacity-0 group-hover:opacity-100 [@media(hover:none)]:opacity-100",onClick:u,title:J("workspace.collapseSidebar"),children:(0,e.jsx)("svg",{className:"w-5 h-5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})})]}),(0,e.jsx)("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:a.map((a,d)=>{var f;let g;return(0,e.jsx)("div",{draggable:!0,onDragStart:()=>aq(d),onDragOver:a=>ar(a,d),onDrop:()=>as(d),onDragEnd:at,className:`${ah===d?"border-t-2 border-brand":""} ${af===d?"opacity-50":""}`,children:(0,e.jsx)(h.ProjectItem,{index:d,name:(g=(f=a.cwd).split("/").filter(Boolean))[g.length-1]||f,cwd:a.cwd,isActive:d===b,collapsed:c,hasUnread:ao.has(a.cwd),isLoading:an.has(a.cwd),sessionBadges:ap.get(a.cwd),onClick:()=>r(d),onSelectSession:b=>F(a.cwd,b),onRemove:()=>s(d),onOpenNote:()=>z(a.cwd)})},a.cwd)})}),(0,e.jsx)(w,{collapsed:c,previews:C,activePath:D,onOpenApps:B,onShowPreview:E}),(0,e.jsxs)("div",{className:"p-2 border-t border-border space-y-1",children:[(0,e.jsx)(i.e,{currentCwd:d,onSwitchProject:F,onResolveSessionNumbers:G,collapsed:c,sessions:aj}),(0,e.jsx)(j._,{collapsed:c,pinnedSessions:U,sessionNumbers:I,currentCwd:d,onSwitchProject:F,onUnpin:V,onUpdateTitle:W,onReorder:X}),(0,e.jsx)(k.I,{collapsed:c,tasks:Y,unreadCount:Z,sessionNumbers:I,onSwitchProject:F,onPause:_,onResume:aa,onTrigger:ab,onDelete:ac,onMarkRead:ae,onUpdateTask:ad}),(0,e.jsxs)("button",{className:`w-full flex items-center gap-2 px-2 py-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-hover transition-colors ${c?"justify-center":""}`,onClick:()=>z(),title:c?J("workspace.notes"):void 0,children:[(0,e.jsx)("svg",{className:"w-5 h-5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})}),!c&&(0,e.jsx)("span",{className:"text-sm",children:J("workspace.notes")})]}),(0,e.jsxs)("button",{className:`w-full flex items-center gap-2 px-2 py-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-hover transition-colors ${c?"justify-center":""}`,onClick:A,title:c?J("workspace.skills"):void 0,children:[(0,e.jsx)("svg",{className:"w-5 h-5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 3l1.9 4.8L19 9l-4.1 3.1L16 18l-4-2.8L8 18l1.1-5.9L5 9l5.1-1.2L12 3z"})}),!c&&(0,e.jsx)("span",{className:"text-sm",children:J("workspace.skills")})]}),(0,e.jsxs)("div",{className:`relative flex items-center gap-2 px-2 py-2 rounded-lg cursor-pointer text-muted-foreground hover:text-foreground hover:bg-hover transition-colors ${c?"justify-center":""}`,onClick:y,title:J("workspace.settings"),children:[(0,e.jsxs)("div",{className:"relative flex-shrink-0",children:[(0,e.jsxs)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),c&&M&&(0,e.jsx)("span",{className:"absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-red-500",title:L?J("workspace.updateAvailable",{version:L}):void 0})]}),!c&&(0,e.jsx)("span",{className:"flex-1 text-sm",children:J("workspace.settings")}),!c&&M&&L&&(0,e.jsxs)("div",{ref:P,className:"relative -mr-2",children:[(0,e.jsxs)("button",{type:"button",onClick:a=>{a.stopPropagation(),O(a=>!a)},className:"px-1.5 py-0.5 rounded text-xs font-mono font-medium text-brand hover:bg-brand/10 transition-colors",title:J("workspace.updateAvailable",{version:L}),"aria-label":J("workspace.updateAvailable",{version:L}),children:["v",L]}),N&&(0,e.jsxs)("div",{className:"absolute left-full bottom-full ml-2 mb-1 w-56 rounded-lg border border-border bg-popover shadow-lv2 p-2 z-50",onClick:a=>a.stopPropagation(),children:[(0,e.jsx)("div",{className:"text-xs text-muted-foreground mb-2 px-1",children:J("workspace.updateAvailable",{version:L})}),(0,e.jsxs)("button",{type:"button",onClick:T,disabled:R,className:"w-full flex items-center gap-2 px-2 py-1.5 rounded text-sm text-left\n hover:bg-hover transition-colors disabled:opacity-60 disabled:cursor-default",children:[R?(0,e.jsxs)("svg",{className:"w-3.5 h-3.5 flex-shrink-0 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[(0,e.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:4}),(0,e.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"})]}):(0,e.jsx)("svg",{className:"w-3.5 h-3.5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),(0,e.jsx)("span",{className:"flex-1",children:R?J("workspace.updating"):J("workspace.updateNow")})]}),(0,e.jsxs)("button",{type:"button",onClick:Q,className:"w-full flex items-center gap-2 px-2 py-1.5 rounded text-sm text-left hover:bg-hover transition-colors",children:[(0,e.jsxs)("svg",{className:"w-3.5 h-3.5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,e.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2}),(0,e.jsx)("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2})]}),(0,e.jsx)("span",{className:"flex-1",children:J("workspace.copyUpgradeCommand")})]}),(0,e.jsxs)("a",{href:`https://opencockpit.dev/${K.language?.startsWith("zh")?"zh":"en"}/changelog/`,target:"_blank",rel:"noopener",onClick:()=>O(!1),className:"w-full flex items-center gap-2 px-2 py-1.5 rounded text-sm hover:bg-hover transition-colors",children:[(0,e.jsx)("svg",{className:"w-3.5 h-3.5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),(0,e.jsx)("span",{className:"flex-1",children:J("workspace.viewChangelog")}),(0,e.jsx)("svg",{className:"w-3 h-3 flex-shrink-0 text-muted-foreground",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})]})]}),!c&&(0,e.jsx)("a",{href:`https://opencockpit.dev/${K.language?.startsWith("zh")?"zh":"en"}/docs/get-started/quickstart/`,target:"_blank",rel:"noopener",className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-hover transition-colors",onClick:a=>a.stopPropagation(),title:J("workspace.help"),"aria-label":J("workspace.help"),children:(0,e.jsxs)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,e.jsx)("circle",{cx:"12",cy:"12",r:"10",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2}),(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),(0,e.jsx)("line",{x1:"12",y1:"17",x2:"12.01",y2:"17",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2})]})})]})]})]})}[h,i,j,k]=t.then?(await t)():t,d()}catch(a){d(a)}})},9804:(a,b,c)=>{"use strict";function d(a,b){for(let c of a){if(c.path===b)return c;if(c.children){let a=d(c.children,b);if(a)return a}}return null}function e(a,b){if(!a)return"";let c=d(b,a);if(c?.isDirectory)return a;let e=a.split("/");return e.pop(),e.join("/")}function f(a){let b=[];for(let c of a){let a=c.split("/"),d=b;for(let b=0;b<a.length;b++){let c=a[b],e=b===a.length-1,f=a.slice(0,b+1).join("/"),g=d.find(a=>a.name===c);g||(g={name:c,path:f,isDirectory:!e,children:e?void 0:[]},d.push(g)),!e&&g.children&&(d=g.children)}}let c=a=>{a.sort((a,b)=>a.isDirectory&&!b.isDirectory?-1:!a.isDirectory&&b.isDirectory?1:a.name.localeCompare(b.name)),a.forEach(a=>{a.children&&c(a.children)})};return c(b),b}function g(a){let b=[],c=a=>{for(let d of a)d.isDirectory&&(b.push(d.path),d.children&&c(d.children))};return c(a),b}c.d(b,{B_:()=>o,HR:()=>function a(b,c){if(0===c.length)return b;let d=new Map(c.map(a=>[a.path,a]));return b.map(b=>{let c=d.get(b.path);return c&&b.isDirectory?void 0===b.children&&void 0!==c.children?{...b,children:c.children}:void 0!==b.children&&void 0!==c.children?{...b,children:a(b.children,c.children)}:b:b})},KH:()=>k,MB:()=>d,S7:()=>e,fw:()=>l,q3:()=>j,r6:()=>m,tE:()=>n,tW:()=>g,u:()=>i,v3:()=>f});let h=new Set(["png","jpg","jpeg","gif","svg","webp","ico","bmp","avif"]);function i(a){let b=a.split(".").pop()?.toLowerCase();return h.has(b||"")}function j(a,b,c=!1){let d=new Set;if(!b)return d;let e=b.toLowerCase(),f=a=>{if(d.add(a.path),a.children)for(let b of a.children)f(b)},g=(a,b)=>{let h=a.name.toLowerCase(),i=c?h===e:h.includes(e);if(i&&a.children)return f(a),b.forEach(a=>d.add(a)),!0;let j=!1;if(a.children)for(let c of a.children)g(c,[...b,a.path])&&(j=!0);return(!!i||!!j)&&(d.add(a.path),b.forEach(a=>d.add(a)),!0)};for(let b of a)g(b,[]);return d}function k(a,b,c=!1){let d=new Set;if(!b)return d;let e=b.toLowerCase();for(let b of a){let a=b.split("/");for(let b=0;b<a.length;b++){let f=a[b].toLowerCase();if(c?f===e:f.includes(e)){for(let b=0;b<=a.length-1;b++)d.add(a.slice(0,b+1).join("/"));break}}}return d}function l(a){let b=Math.floor(Math.floor((Date.now()-1e3*a)/1e3)/60),c=Math.floor(b/60),d=Math.floor(c/24),e=Math.floor(d/30),f=Math.floor(d/365);return f>0?`${f}y ago`:e>0?`${e}mo ago`:d>0?`${d}d ago`:c>0?`${c}h ago`:b>0?`${b}m ago`:"just now"}function m(a){let b=new Date(a),c=new Date,d=b.getFullYear()===c.getFullYear(),e=String(b.getMonth()+1).padStart(2,"0"),f=String(b.getDate()).padStart(2,"0"),g=String(b.getHours()).padStart(2,"0"),h=String(b.getMinutes()).padStart(2,"0");return d?`${e}-${f} ${g}:${h}`:`${b.getFullYear()}-${e}-${f} ${g}:${h}`}let n=()=>{},o=50},12568:(a,b,c)=>{"use strict";c.d(b,{ReviewDropdown:()=>o});var d=c(48249),e=c(67484),f=c(44384),g=c(29939),h=c(61130),i=c(79606),j=c(33281),k=c(83120);let l="review-last-viewed";function m(){try{return JSON.parse(localStorage.getItem(l)||"{}")}catch{return{}}}function n(a,b){if(!a.lastCommentAt)return!1;let c=b[a.id];return!c||a.lastCommentAt>c}function o({cwd:a}){let{t:b}=(0,f.Bd)(),[c,p]=(0,e.useState)(!1),[q,r]=(0,e.useState)([]),[s,t]=(0,e.useState)(!1),[u,v]=(0,e.useState)(null),[w,x]=(0,e.useState)({}),[y,z]=(0,e.useState)({open:!1,comments:[],title:"",userNameMap:{}}),A=(0,e.useRef)(null),B=(0,e.useRef)(null),[C,D]=(0,e.useState)(null),E=(0,e.useCallback)(async()=>{t(!0);let a=await j.t4.runPromiseExit((0,k.Y_)());"Success"===a._tag&&r(a.value.reviews??[]),t(!1)},[]),F=(0,e.useCallback)(a=>{let{data:b}=a;Array.isArray(b)&&b.some(a=>"review"===a.type)&&E()},[E]);(0,g.h)({url:`/ws/watch?cwd=${encodeURIComponent(a||"/")}`,onMessage:F,enabled:!!a});let G=(0,e.useMemo)(()=>q.filter(a=>a.active),[q]),H=(0,e.useMemo)(()=>G.some(a=>n(a,w)),[G,w]),I=(0,e.useCallback)(a=>{let b;(b=m())[a]=Date.now(),localStorage.setItem(l,JSON.stringify(b)),x(m()),window.open(`${window.location.origin}/review/${a}`,"_blank")},[]),J=(0,e.useCallback)(async(a,b)=>{a.stopPropagation();let[c,d]=await Promise.all([j.t4.runPromiseExit((0,k.JK)(b)),j.t4.runPromiseExit((0,k.BL)())]);if("Success"!==c._tag)return;let e=c.value.review,f={};if("Success"===d._tag)for(let[a,b]of Object.entries(d.value.users))f[a]=b.name;z({open:!0,comments:e.comments||[],title:e.title??"",userNameMap:f})},[]),K=(0,e.useCallback)((a,b)=>{B.current=b,a.dataTransfer.effectAllowed="move";let c=a.currentTarget;requestAnimationFrame(()=>c.classList.add("opacity-30"))},[]),L=(0,e.useCallback)(a=>{B.current=null,D(null),a.currentTarget instanceof HTMLElement&&a.currentTarget.classList.remove("opacity-30")},[]),M=(0,e.useCallback)((a,b)=>{a.preventDefault(),a.dataTransfer.dropEffect="move",B.current&&B.current!==b&&D(b)},[]),N=(0,e.useCallback)((a,b)=>{a.preventDefault(),D(null);let c=B.current;B.current=null,c&&c!==b&&r(a=>{let d=[...a],e=d.findIndex(a=>a.id===c),f=d.findIndex(a=>a.id===b);if(-1===e||-1===f)return a;let[g]=d.splice(e,1);d.splice(f,0,g);let h=d.map(a=>a.id);return j.t4.runFork((0,k.z1)(h).pipe(i.orElse(()=>i.void))),d})},[]);return(0,d.jsxs)("div",{ref:A,className:"relative",children:[(0,d.jsxs)("button",{onClick:()=>p(a=>!a),className:`relative p-2 rounded-lg transition-colors ${c?"text-foreground bg-accent":"text-muted-foreground hover:text-foreground hover:bg-hover"}`,title:b("review.reviewManagement"),children:[(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})}),H&&(0,d.jsx)("span",{className:"absolute top-1 right-1 w-2 h-2 bg-red-500 rounded-full"})]}),c&&(0,d.jsxs)("div",{className:"absolute right-0 top-full mt-1 w-64 bg-popover border border-border rounded-lg shadow-lv3 z-50 overflow-hidden",children:[(0,d.jsxs)("div",{className:"px-3 py-2 border-b border-border flex items-center justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:b("review.allReviews")}),(0,d.jsx)("span",{className:"text-xs text-muted-foreground/60 ml-1.5",children:G.length})]}),(0,d.jsx)("button",{onClick:E,className:"p-0.5 text-muted-foreground hover:text-foreground rounded transition-colors",title:b("common.refresh"),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})})]}),(0,d.jsx)("div",{className:"max-h-80 overflow-y-auto",children:s&&0===q.length?(0,d.jsx)("div",{className:"px-3 py-4 text-xs text-muted-foreground/50 text-center",children:b("common.loading")}):0===G.length?(0,d.jsx)("div",{className:"px-3 py-4 text-xs text-muted-foreground/50 text-center",children:b("review.noOpenReviews")}):G.map(a=>{let c,e,f,g,h,i=n(a,w);return(0,d.jsxs)("div",{draggable:!0,onDragStart:b=>K(b,a.id),onDragEnd:L,onDragOver:b=>M(b,a.id),onDrop:b=>N(b,a.id),onMouseEnter:b=>{let c=b.currentTarget.getBoundingClientRect();v({id:a.id,text:a.title,top:c.top+c.height/2,left:c.left})},onMouseLeave:()=>v(b=>b?.id===a.id?null:b),onClick:()=>I(a.id),className:`group px-3 py-2 cursor-pointer border-b transition-colors ${C===a.id?"border-b-brand border-t border-t-transparent":"border-b-border/50"} hover:bg-hover`,children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,d.jsx)("span",{className:`w-1.5 h-1.5 rounded-full flex-shrink-0 ${i?"bg-red-500":"bg-green-500"}`}),(0,d.jsx)("span",{className:`text-xs truncate flex-1 ${i?"font-medium text-foreground":""}`,children:a.title}),a.commentCount>0&&(0,d.jsx)("button",{onClick:b=>J(b,a.id),className:"flex-shrink-0 p-0.5 rounded text-muted-foreground/0 group-hover:text-muted-foreground/60 hover:!text-brand hover:!bg-brand/10 transition-colors",title:b("review.viewComments"),children:(0,d.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,d.jsx)("path",{d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})})})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground/50 mt-0.5 pl-3",children:[(0,d.jsx)("span",{children:(e=String((c=new Date(a.updatedAt||a.createdAt)).getMonth()+1).padStart(2,"0"),f=String(c.getDate()).padStart(2,"0"),g=String(c.getHours()).padStart(2,"0"),h=String(c.getMinutes()).padStart(2,"0"),`${e}-${f} ${g}:${h}`)}),a.commentCount>0&&(0,d.jsx)("span",{children:b("review.nComments",{count:a.commentCount})})]})]},a.id)})})]}),u&&c&&(0,d.jsx)("div",{className:"fixed z-[60] px-2 py-1 text-xs bg-popover text-popover-foreground border border-border rounded shadow-lv2 whitespace-nowrap pointer-events-none",style:{top:u.top,left:u.left-8,transform:"translate(-100%, -50%)"},children:u.text}),(0,d.jsx)(h.ReviewCommentsListModal,{isOpen:y.open,onClose:()=>z(a=>({...a,open:!1})),comments:y.comments,reviewTitle:y.title,userNameMap:y.userNameMap})]})}},13054:(a,b,c)=>{"use strict";c.d(b,{P_:()=>l,Q_:()=>m,nS:()=>o});var d=c(67484),e=c(57031),f=c(88214),g=c(79606),h=c(208),i=c(33281),j=c(71192);let k=(a,b,c)=>g.tryPromise({try:async()=>{let d=await fetch(a,{method:b,headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!d.ok)throw Error(`HTTP ${d.status}`);return await d.json()},catch:c=>new j.uV({message:`${b} ${a} failed`,cause:c})});function l(a){return a.split("/").pop()||a}function m(a){return a.resolvedPrompt||a.message||a.taskFile||""}function n(){(0,e.F)(f.n.ScheduledTasksChanged,{}),document.querySelectorAll("iframe").forEach(a=>{try{a.contentWindow?.postMessage({type:"SCHEDULED_TASKS_CHANGED"},"*")}catch{}})}function o(){let[a,b]=(0,d.useState)([]),[c,e]=(0,d.useState)(0),f=(0,d.useCallback)(()=>{let a;i.t4.runPromise((a="/api/scheduled-tasks",g.tryPromise({try:async()=>{let b=await fetch(a);if(!b.ok)throw Error(`HTTP ${b.status}`);return await b.json()},catch:b=>new j.uV({message:`fetch ${a} failed`,cause:b})})).pipe(g.match({onSuccess:a=>{b(a.tasks??[]),e(a.unreadCount??0)},onFailure:()=>{}})))},[]),l=(0,d.useCallback)(async a=>{let b=await i.t4.runPromiseExit(k("/api/scheduled-tasks","POST",{language:h.A.language,...a}));if("Success"!==b._tag)return null;let c=b.value;return c.task?(f(),n(),c.task):null},[f]),m=(0,d.useCallback)(async a=>{await i.t4.runPromise(k("/api/scheduled-tasks","PATCH",a).pipe(g.asVoid).pipe(g.orElse(()=>g.void))),f(),n()},[f]),o=(0,d.useCallback)(a=>m({id:a,action:"pause"}),[m]),p=(0,d.useCallback)(a=>m({id:a,action:"resume"}),[m]),q=(0,d.useCallback)(async a=>{await i.t4.runPromise(k("/api/scheduled-tasks","DELETE",{id:a}).pipe(g.asVoid).pipe(g.orElse(()=>g.void))),f(),n()},[f]),r=(0,d.useCallback)((a,b)=>m({id:a,action:"update",fields:{...b,language:h.A.language}}),[m]),s=(0,d.useCallback)(a=>m({id:a,action:"trigger"}),[m]),t=(0,d.useCallback)(a=>m({id:a,action:"markRead"}),[m]);return{tasks:a,unreadCount:c,reload:f,createTask:l,pauseTask:o,resumeTask:p,triggerTask:s,deleteTask:q,updateTask:r,markRead:t,markAllRead:(0,d.useCallback)(()=>m({action:"markAllRead"}),[m]),reorderTasks:(0,d.useCallback)(a=>m({action:"reorder",fields:{orderedIds:a}}),[m])}}},13512:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{d:()=>o,o:()=>n});var e=c(67484),f=c(36043),g=c(74754),h=c(91579),i=c(208),j=c(7031),k=c(38896),l=c(36984),m=c(37690);function n(a,b){let c,d=document.createTreeWalker(a,NodeFilter.SHOW_TEXT),e=b,f=null;for(;c=d.nextNode();){f=c;let a=c.textContent.length;if(e<=a)return{node:c,offset:e};e-=a}return f?{node:f,offset:f.textContent.length}:null}function o({content:a,filePath:b,showSearch:c=!0,cwd:d,enableComments:n=!1,scrollToLine:p=null,scrollToLineAlign:q="center",onScrollToLineComplete:r,visibleLineRef:s,onContentSearch:t}){let[u,v]=(0,e.useState)(!1),w=(0,e.useRef)(null),x=(0,e.useRef)(null),y=(0,e.useRef)(null),z=(0,j.r)(),[A,B]=(0,e.useState)(!1),[C,D]=(0,e.useState)(null);(0,e.useRef)(null);let[E,F]=(0,e.useState)(!1),[G,H]=(0,e.useState)(""),[I,J]=(0,e.useState)(!1),[K,L]=(0,e.useState)(!1),[M,N]=(0,e.useState)(0),[O,P]=(0,e.useState)(0),Q=(0,e.useRef)(!1),[R,S]=(0,e.useState)(null),T=(0,e.useRef)(!1),U=(0,e.useRef)(null),[V,W]=(0,e.useState)(null),[X,Y]=(0,e.useState)(null),Z=(0,e.useMemo)(()=>a.split("\n"),[a]),[$,_]=(0,e.useState)(null),aa=n&&!!d,{toolbarRef:ab,bumpRef:ac,clearToolbar:ad}=(0,m.L)({enabled:aa,container:$,resolveLineRange:a=>{if(!document.contains(a))return null;let b=a.nodeType===Node.TEXT_NODE?a.parentElement:a,c=b?.closest("[data-line]");if(!c)return null;let d=parseInt(c.getAttribute("data-line")||"0",10);return!Number.isFinite(d)||d<=0?null:{start:d,end:d}},buildLineSnapshot:({start:a,end:b})=>Z.slice(a-1,b).join("\n")}),ae=(0,e.useRef)(null),[af,ag]=(0,e.useState)(0),{comments:ah,addComment:ai,updateComment:aj,deleteComment:ak,refresh:al}=(0,g._)({cwd:d||"",filePath:b}),am=(0,k.C)(Z,b),an=(0,e.useMemo)(()=>{let a=new Map;for(let b of ah){let c=b.endLine;a.has(c)||a.set(c,[]),a.get(c).push(b)}return a},[ah]),ao=(0,e.useMemo)(()=>{let a=new Set;for(let b of ah)for(let c=b.startLine;c<=b.endLine;c++)a.add(c);return a},[ah]),ap=(0,e.useMemo)(()=>(0,l.Np)(Z,G,I,K),[Z,G,I,K]),aq=(0,e.useMemo)(()=>{let a=[];for(let b=0;b<Z.length;b++)a.push({type:"code",lineIndex:b});return a},[Z.length]),ar=(0,f.Te)({count:aq.length,getScrollElement:()=>w.current,estimateSize:()=>20,overscan:10}),as=(0,e.useCallback)(()=>{0!==ap.length&&(N(a=>(a+1)%ap.length),P(a=>a+1))},[ap.length]),at=(0,e.useCallback)(()=>{0!==ap.length&&(N(a=>(a-1+ap.length)%ap.length),P(a=>a+1))},[ap.length]);(0,e.useRef)(p).current=p;let au=(0,e.useCallback)(a=>{"Enter"===a.key&&(a.preventDefault(),a.shiftKey?at():as()),"Escape"===a.key&&(F(!1),H(""))},[as,at]),av=(0,e.useCallback)((a,b)=>{aa&&(b.stopPropagation(),S({comment:a,x:b.clientX,y:b.clientY}),ad(),W(null),Y(null))},[aa,ad]),aw=(0,e.useCallback)(()=>{let a=ab.current;a&&(W({x:a.x,y:a.y,range:a.range,selectedText:a.selectedText,lineSnapshot:a.lineSnapshot}),ad())},[ad,ab]),ax=(0,e.useCallback)(()=>{let a=ab.current;a&&(Y({x:a.x,y:a.y,range:a.range,selectedText:a.selectedText,lineSnapshot:a.lineSnapshot}),ad())},[ad,ab]),ay=(0,e.useCallback)(()=>{let a=ab.current;a&&z&&(ad(),(0,h.Ff)(z.sendMessage,{filePath:b,startLine:a.range.start,endLine:a.range.end,codeContent:a.lineSnapshot},i.A.t("explain.selectionMessage")))},[z,b,ad,ab]),az=(0,e.useCallback)(()=>{let a=ab.current;if(!a||!t)return;let b=a.selectedText.trim();ad(),b&&t(b)},[t,ad,ab]),aA=(0,e.useCallback)(async a=>{V&&(await ai(V.range.start,V.range.end,a,V.selectedText),W(null))},[V,ai]),aB=(0,e.useCallback)(async(a,c)=>{if(z&&d)try{let e=await (0,h.$3)(d),f=[];for(let a of e)f.push({filePath:a.filePath,startLine:a.startLine,endLine:a.endLine,codeContent:a.codeContent,note:a.content||void 0});f.push({filePath:b,startLine:a.range.start,endLine:a.range.end,codeContent:a.lineSnapshot});let g=(0,h.Gw)(f,c);z.sendMessage(g),await (0,h.RP)(d),al()}catch(a){console.error("Failed to send to AI:",a)}},[z,b,d,al]),aC=(0,e.useCallback)(a=>{X&&aB(X,a)},[X,aB]),aD=(0,e.useCallback)(a=>{V&&aB(V,a)},[V,aB]),aE=(0,e.useCallback)((a,b,c)=>{let d=Z[a];if(!d)return b;let e=[];if(G&&ap.length>0)for(let b of ap.filter(b=>b.lineIndex===a)){let c=ap[M]?.lineIndex===a&&ap[M]?.startCol===b.startCol;e.push({start:b.startCol,end:b.endCol,cls:c?"hl-cur":"hl-m"})}if(c&&!G&&c.length>=1){let a=c.toLowerCase(),b=d.toLowerCase(),f=0;for(;-1!==(f=b.indexOf(a,f));)e.push({start:f,end:f+c.length,cls:"hl-kw"}),f+=1}if(0===e.length)return b;if(e.sort((a,b)=>a.start-b.start||a.end-b.end),e.length>l.ZR){let a=e.findIndex(a=>"hl-cur"===a.cls),b=e.slice(0,l.ZR);a>=l.ZR&&(b[b.length-1]=e[a]),e=b}let f=[],g=0;for(let a of e){if(a.start<g)continue;a.start>g&&f.push((0,l.ZD)(d.substring(g,a.start)));let b=(0,l.ZD)(d.substring(a.start,a.end));f.push(`<span class="${a.cls}">${b}</span>`),g=a.end}g<d.length&&f.push((0,l.ZD)(d.substring(g)));let h=(0,l.ZD)(d);if(b!==h){let a=b;for(let b of e){let c=d.substring(b.start,b.end),e=(0,l.ZD)(c),f=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),g=RegExp(`(?<=>)([^<]*?)(${f})`,""),h=`$1<span class="${b.cls}">${e}</span>`,i=a.replace(g,h);i.length>a.length+200||(a=i)}return a}return f.join("")},[G,ap,M,Z]);return{parentRef:w,containerRef:x,searchInputRef:y,floatingToolbarRef:ab,suppressHoverRef:T,savedSelectionRef:U,highlightedLines:am,isMounted:u,cmdHeld:A,flashLine:C,isSearchVisible:E,searchQuery:G,caseSensitive:I,wholeWord:K,currentMatchIndex:M,viewingComment:R,bumpToolbarRef:ac,addCommentInput:V,sendToAIInput:X,aiBridge:z,commentsEnabled:aa,comments:ah,updateComment:aj,deleteComment:ak,lines:Z,matches:ap,rowData:aq,virtualizer:ar,commentsByEndLine:an,linesWithComments:ao,setIsSearchVisible:F,setSearchQuery:H,suppressMatchScrollRef:Q,setCaseSensitive:J,setWholeWord:L,setViewingComment:S,setAddCommentInput:W,setSendToAIInput:Y,goToNextMatch:as,goToPrevMatch:at,handleSearchKeyDown:au,handleCommentBubbleClick:av,handleToolbarAddComment:aw,handleToolbarSendToAI:ax,handleToolbarExplain:ay,handleToolbarSearch:az,handleCommentSubmit:aA,handleSendToAISubmit:aC,handleCommentSendToAI:aD,getHighlightedLineHtml:aE,inlineBlameLineRef:ae,inlineBlameVersion:af}}d()}catch(a){d(a)}})},15105:(a,b,c)=>{"use strict";c.d(b,{G:()=>l,f:()=>m});var d=c(67484);function e(){if("u"<typeof document)return null;let a=document.querySelector('meta[name="cockpit-bridge"]');if(!a)return null;let b=a.dataset.id,c=a.dataset.version;return b?{id:b,version:c||"unknown"}:null}let f=null,g=new Set;function h(){g.forEach(a=>a())}function i(a){g.add(a);let b=e();return b&&!f&&(f=b,Promise.resolve().then(h)),()=>{g.delete(a)}}function j(){return f}function k(){return null}if("u">typeof document&&(f=e()),"u">typeof MutationObserver&&"u">typeof document){let a=new MutationObserver(()=>{let a=e();a&&(!f||a.id!==f.id||a.version!==f.version)&&(f=a,h())}),b=document.head||document.documentElement;b&&a.observe(b,{childList:!0})}function l(){return(0,d.useSyncExternalStore)(i,j,k)}function m(){return f??e()}},15466:(a,b,c)=>{"use strict";function d(a){return a.trim().toLowerCase().replace(/[\s]+/g,"-").replace(/[^\w一-鿿぀-ヿ가-힯-]/g,"").replace(/-{2,}/g,"-").replace(/^-+|-+$/g,"")}function e(a,b){if(!a)return!1;let c=b;try{c=decodeURIComponent(b)}catch{}let e=d(c);if(!e)return!1;for(let b of a.querySelectorAll("h1, h2, h3, h4, h5, h6"))if(d(b.textContent||"")===e)return b.scrollIntoView({behavior:"smooth",block:"start"}),!0;return!1}c.d(b,{O:()=>e})},15578:(a,b,c)=>{"use strict";c.d(b,{S:()=>g,q:()=>f});let d=[/(^|\/)__tests__\//,/(^|\/)tests?\//,/\.(test|spec)\.[^/]+$/],e=[/\.(md|mdx)$/i,/(^|\/)docs\//,/(^|\/)README[^/]*$/i,/(^|\/)LICENSE[^/]*$/i,/(^|\/)CHANGELOG[^/]*$/i];function f(a){return d.some(b=>b.test(a))?"test":e.some(b=>b.test(a))?"docs":null}function g(a){if(0===a.length)return null;let b=f(a[0]);return null===b?null:a.every(a=>f(a)===b)?b:null}},15790:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{x:()=>k});var e=c(48249),f=c(67484),g=c(44384);c(33281);var h=c(2929);c(81206);var i=c(13054),j=a([h]);function k({task:a,onOpenSession:b}){let{t:c}=(0,g.Bd)(),{cwd:d,sessionId:j}=a,[l,m]=(0,f.useState)(null);(0,f.useRef)(void 0);let n=(0,f.useRef)(null),o=(0,f.useRef)(null),p=(0,f.useRef)(!0),[q,r]=(0,f.useState)(!0),s=(0,f.useCallback)(()=>{let a=n.current;if(!a)return;let b=a.scrollTop+a.clientHeight>=a.scrollHeight-40;p.current=b,r(b||a.scrollTop<=40)},[]);return(0,e.jsxs)("div",{className:"flex-1 flex flex-col h-full min-w-0",children:[(0,e.jsx)("div",{className:"flex items-center gap-2 px-4 py-2.5 border-b border-border flex-shrink-0",children:(0,e.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,e.jsx)("div",{className:"text-xs font-medium text-foreground truncate","data-tooltip":d,children:(0,i.P_)(d)}),(0,e.jsx)("div",{className:"text-[11px] text-muted-foreground truncate","data-tooltip":(0,i.Q_)(a),children:(0,i.Q_)(a)})]})}),(0,e.jsxs)("div",{className:"relative flex-1 min-h-0 flex",children:[(0,e.jsx)("div",{ref:n,onScroll:s,className:"flex-1 overflow-y-auto px-4 py-3",children:null===l||0===l.length?(0,e.jsx)("div",{className:"text-xs text-muted-foreground text-center py-6",children:c(null===l?"common.loading":"scheduledTasks.noTaskMessages")}):(0,e.jsx)("div",{ref:o,className:"[&_a]:pointer-events-none",children:l.map(a=>(0,e.jsx)(h.s,{message:a,cwd:d,disableOverlays:!0},a.id))})}),(0,e.jsx)("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 flex justify-center pb-4",children:(0,e.jsxs)("button",{onClick:b,className:`flex items-center gap-1.5 px-5 py-2.5 rounded-full bg-brand text-white text-sm font-medium shadow-lv3 hover:bg-brand/90 transition-opacity ${q?"opacity-100 pointer-events-auto":"opacity-0"}`,title:c("scheduledTasks.openSession"),children:[(0,e.jsx)("span",{children:c("scheduledTasks.openSession")}),(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M14 5l7 7-7 7M3 12h18"})})]})})]})]})}h=(j.then?(await j)():j)[0],d()}catch(a){d(a)}})},15819:(a,b,c)=>{"use strict";c.d(b,{aO:()=>d,iG:()=>e,jL:()=>f});let d="relative w-full max-w-[calc((100vw_-_28rem)*0.9)] h-[90vh] mx-4 bg-card rounded-lg shadow-lv3 flex flex-col overflow-hidden",e="relative w-full max-w-[calc((100vw_-_14rem)*0.9)] h-[90vh] mx-4 bg-card rounded-lg shadow-lv3 flex flex-col overflow-hidden",f="grid grid-cols-[repeat(auto-fill,minmax(320px,1fr))] gap-3"},16618:(a,b,c)=>{"use strict";function d(a){let b=0xdeadbeef,c=0x41c6ce57;for(let d=0;d<a.length;d++){let e=a.charCodeAt(d);b=Math.imul(b^e,0x9e3779b1),c=Math.imul(c^e,0x5f356495)}return b=Math.imul(b^b>>>16,0x85ebca6b)^Math.imul(c^c>>>13,0xc2b2ae35),(0x100000000*(2097151&(c=Math.imul(c^c>>>16,0x85ebca6b)^Math.imul(b^b>>>13,0xc2b2ae35)))+(b>>>0)>>>0).toString(16)}function e(a){return a.replace(/\s+/g," ").trim()}function f(a,b){return a?`${a}>${b}`:b}function g(a){let b=a.childForFieldName("name");if(b)return b.text;for(let b=0;b<a.namedChildCount;b++){let c=a.namedChild(b);if(c&&("identifier"===c.type||"type_identifier"===c.type||"property_identifier"===c.type))return c.text}return"<anonymous>"}function h(a,b,c,g,i=[],j){return{qualifiedName:f(g,b),name:b,kind:c,startLine:a.startPosition.row+1,endLine:a.endPosition.row+1,contentHash:d(e(a.text)),children:i,params:j}}function i(a){let b=a.childForFieldName("parameter");if(b)return[b.text];let c=a.childForFieldName("parameters");if(!c)return;let d=[];for(let a=0;a<c.namedChildCount;a++){let b=c.namedChild(a);b&&d.push(function a(b){switch(b.type){case"required_parameter":case"optional_parameter":{let c=b.childForFieldName("pattern");return c?a(c):b.text}case"assignment_pattern":{let c=b.childForFieldName("left");return c?a(c):b.text}case"default_parameter":case"typed_default_parameter":{let a=b.childForFieldName("name");return a?a.text:b.text}case"typed_parameter":for(let a=0;a<b.namedChildCount;a++){let c=b.namedChild(a);if(c?.type==="identifier")return c.text}return b.text;default:return b.text}}(b))}return d}function j(a){let b=[],c=function(a){let b=[],c=-1,f=-1;for(let d=0;d<a.namedChildCount;d++){let e=a.namedChild(d);if(e){if("import_statement"===e.type||"export_statement"===e.type&&null!==e.childForFieldName("source")||"import_from_statement"===e.type||"future_import_statement"===e.type)b.push(e),c<0&&(c=e.startPosition.row+1),f=e.endPosition.row+1;else if(c>=0)break}}return c<0?null:{qualifiedName:"__imports__",name:"imports",kind:"unknown",startLine:c,endLine:f,contentHash:d(e(b.map(a=>a.text).join("\n"))),children:[]}}(a);c&&b.push(c);for(let c=0;c<a.namedChildCount;c++){let j=a.namedChild(c);j&&b.push(...function a(b,c,j=!1){switch(b.type){case"export_statement":case"export_default_declaration":{let d=[];for(let e=0;e<b.namedChildCount;e++){let f=b.namedChild(e);f&&d.push(...a(f,c,!0))}return d}case"function_declaration":case"generator_function_declaration":case"function_definition":return[h(b,g(b),"function",c,[],i(b))];case"class_declaration":case"abstract_class_declaration":{let a=g(b),d=f(c,a),e=function(a,b){if(!a)return[];let c=[];for(let d=0;d<a.namedChildCount;d++){let e=a.namedChild(d);if(e){if("method_definition"===e.type)c.push(h(e,g(e),"method",b,[],i(e)));else if("public_field_definition"===e.type){let a=e.childForFieldName("value");a&&("arrow_function"===a.type||"function_expression"===a.type)&&c.push(h(e,g(e),"method",b,[],i(a)))}}}return c}(b.childForFieldName("body"),d);return[h(b,a,"class",c,e)]}case"interface_declaration":return[h(b,g(b),"interface",c)];case"type_alias_declaration":return[h(b,g(b),"type",c)];case"enum_declaration":return[h(b,g(b),"enum",c)];case"lexical_declaration":case"variable_declaration":return function(a,b){let c=[];for(let d=0;d<a.namedChildCount;d++){let e=a.namedChild(d);if(!e||"variable_declarator"!==e.type)continue;let f=e.childForFieldName("name"),j=e.childForFieldName("value");if(!f)continue;let k=f.text,l=j&&("arrow_function"===j.type||"function_expression"===j.type),m=l&&j?i(j):void 0;if(c.push(h(a,k,l?"function":"const",b,[],m)),j&&"object"===j.type&&!l){let a=b?`${b}>${k}`:k;for(let b=0;b<j.namedChildCount;b++){let d=j.namedChild(b);if(d){if("pair"===d.type){let b=d.childForFieldName("key"),e=d.childForFieldName("value");if(!b||!e||"property_identifier"!==b.type&&"identifier"!==b.type||"arrow_function"!==e.type&&"function_expression"!==e.type)continue;c.push(h(d,b.text,"method",a,[],i(e)))}else if("method_definition"===d.type){let b=g(d);b&&c.push(h(d,b,"method",a,[],i(d)))}}}}}return c}(b,c);case"class_definition":{let a=g(b),j=f(c,a),k=function a(b,c){if(!b)return[];let j=[];for(let k=0;k<b.namedChildCount;k++){let l=b.namedChild(k);if(l){if("function_definition"===l.type)j.push(h(l,g(l),"method",c,[],i(l)));else if("decorated_definition"===l.type){let b=l.childForFieldName("definition");if(b?.type==="function_definition")j.push({...h(b,g(b),"method",c,[],i(b)),startLine:l.startPosition.row+1,contentHash:d(e(l.text))});else if(b?.type==="class_definition"){let i=g(b),k=f(c,i),m=a(b.childForFieldName("body"),k);j.push({...h(b,i,"class",c,m),startLine:l.startPosition.row+1,contentHash:d(e(l.text))})}}else if("class_definition"===l.type){let b=g(l),d=f(c,b),e=a(l.childForFieldName("body"),d);j.push(h(l,b,"class",c,e))}}}return j}(b.childForFieldName("body"),j);return[h(b,a,"class",c,k)]}case"decorated_definition":{let f=b.childForFieldName("definition");if(!f)return[];return a(f,c,!1).map(a=>({...a,startLine:b.startPosition.row+1,contentHash:d(e(b.text))}))}case"expression_statement":{let a=[];for(let g=0;g<b.namedChildCount;g++){let h=b.namedChild(g);if(h?.type==="assignment"){let g=function(a,b,c){let g=b.childForFieldName("left");if(!g||"identifier"!==g.type)return null;let h=g.text;return{qualifiedName:f(c,h),name:h,kind:"const",startLine:a.startPosition.row+1,endLine:a.endPosition.row+1,contentHash:d(e(a.text)),children:[]}}(b,h,c);g&&a.push(g)}}return a.push(...function(a,b){let c=null;for(let b=0;b<a.namedChildCount;b++){let d=a.namedChild(b);if(d){if("call_expression"===d.type){c=d;break}if("await_expression"===d.type){for(let a=0;a<d.namedChildCount;a++){let b=d.namedChild(a);if(b?.type==="call_expression"){c=b;break}}break}}}if(!c)return[];let d=c.childForFieldName("function"),e=c.childForFieldName("arguments");if(!d||!e)return[];let f=null,g=[];for(let a=0;a<e.namedChildCount;a++){let b=e.namedChild(a);if(b){if(null===f&&("string"===b.type||"template_string"===b.type)){let a=b.text;f=a.length>=2&&/^["'`]/.test(a)?a.slice(1,-1):a}("arrow_function"===b.type||"function_expression"===b.type)&&g.push(b)}}if(0===g.length||!f)return[];let j=function a(b){if("identifier"===b.type)return b.text;if("member_expression"===b.type){let a=b.childForFieldName("property");return a?.text??""}if("call_expression"===b.type){let c=b.childForFieldName("function");return c?a(c):""}return""}(d),k=j?`${j} ${f}`:f;return g.map((a,c)=>h(a,g.length>1?`${k} #${c+1}`:k,"function",b,[],i(a)))}(b,c)),a}default:return[]}}(j,void 0,!1))}return b.push(...function(a,b){let c=a.text.split("\n"),f=c.length;if(0===f)return[];let g=new Uint8Array(f+2);for(let a of b){let b=Math.max(1,a.startLine),c=Math.min(f,a.endLine);for(let a=b;a<=c;a++)g[a]=1}let h=[],i=(a,b)=>{let f=!1;for(let d=a;d<=b;d++){let a=c[d-1];if(a&&a.trim().length>0){f=!0;break}}if(!f)return;let g=c.slice(a-1,b).join("\n");h.push({qualifiedName:`__code_${a}_${b}__`,name:"code",kind:"unknown",startLine:a,endLine:b,contentHash:d(e(g)),children:[]})},j=-1;for(let a=1;a<=f;a++)g[a]?j>=0&&(i(j,a-1),j=-1):j<0&&(j=a);return j>=0&&i(j,f),h}(a,b)),b}c.d(b,{Hs:()=>j})},16665:(a,b,c)=>{Promise.resolve().then(c.bind(c,55632)),Promise.resolve().then(c.bind(c,99829)),Promise.resolve().then(c.bind(c,24943)),Promise.resolve().then(c.bind(c,74837)),Promise.resolve().then(c.bind(c,85906)),Promise.resolve().then(c.bind(c,72399)),Promise.resolve().then(c.bind(c,25702)),Promise.resolve().then(c.bind(c,47938)),Promise.resolve().then(c.bind(c,19562)),Promise.resolve().then(c.bind(c,83022)),Promise.resolve().then(c.bind(c,6612)),Promise.resolve().then(c.bind(c,93448)),Promise.resolve().then(c.bind(c,65395)),Promise.resolve().then(c.bind(c,84747))},17966:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{i:()=>m});var e=c(32580),f=c(16618),g=c(84398),h=c(4263),i=a([h]);function j(a){return a.qualifiedName.startsWith("__code_")||a.qualifiedName.startsWith("__heading_")}function k(a){return!j(a)&&"__file__"!==a.qualifiedName}async function l(a,b){if(!a)return[];let c=(0,g.k)(b);if(!c)return null;let d=(await (0,h.$)(c)).parse(a);if(!d)return null;try{return(0,f.Hs)(d.rootNode)}finally{d.delete()}}async function m(a,b,c,d,f){let h=new Set;if(a!==b)for(let c of(0,e.X)(d?"":a,f?"":b))"added"===c.type&&void 0!==c.newLineNum&&h.add(c.newLineNum);if(!(0,g.k)(c))return{addedLines:h};let[i,m]=await Promise.all([l(d?"":a,c),l(f?"":b,c)]),n=m??[],o=function(a,b){let c=new Map;for(let b of a)c.set(b.qualifiedName,b);let d=new Map;for(let a of b)d.set(a.qualifiedName,a);let e=[];for(let a of b){let b=c.get(a.qualifiedName);b?b.contentHash!==a.contentHash&&e.push({id:`mod:${a.qualifiedName}`,changeKind:"modified",qname:a.qualifiedName}):e.push({id:`add:${a.qualifiedName}`,changeKind:"added",qname:a.qualifiedName})}for(let b of a)d.has(b.qualifiedName)||e.push({id:`del:${b.qualifiedName}`,changeKind:"deleted",qname:b.qualifiedName});return e}((i??[]).filter(k),n.filter(k)),p=new Set;for(let a of o)"deleted"!==a.changeKind&&p.add(a.qname);for(let a of function(a,b){if(0===b.size)return[];let c=[];for(let d of a)if(j(d)){for(let a of b)if(a>=d.startLine&&a<=d.endLine){c.push(d.qualifiedName);break}}return c}(n,h))p.add(a);return{changedQnames:p,addedLines:h}}h=(i.then?(await i)():i)[0],d()}catch(a){d(a)}})},18479:(a,b,c)=>{"use strict";c.d(b,{se:()=>h,xK:()=>g});var d=c(79606),e=c(71192);let f=a=>d.tryPromise({try:async()=>{let b=await fetch(a);if(!b.ok)throw Error(`HTTP ${b.status}`);return await b.json()},catch:b=>new e.uV({message:`GET ${a} failed`,cause:b})}),g=(a,b,c,e)=>f(`/api/snapshots?cwd=${encodeURIComponent(a)}&toolIds=${encodeURIComponent(b.join(","))}${c?`&sessionKey=${encodeURIComponent(c)}`:""}${e?`&runId=${encodeURIComponent(e)}`:""}`).pipe(d.map(a=>a.commits??[])),h=(a,b,c,e)=>g(a,b,c,e).pipe(d.flatMap(b=>d.all(b.map(b=>{let c;return c=b.hash,f(`/api/snapshots/diff?cwd=${encodeURIComponent(a)}&commit=${encodeURIComponent(c)}`)}),{concurrency:4})))},18499:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{_:()=>l});var e=c(48249),f=c(67484),g=c(44384);c(79606),c(33281);var h=c(74228),i=c(32753);c(41224);var j=c(50508),k=a([j]);j=(k.then?(await k)():k)[0];let m=(a,b)=>`${a}
38
38
  ${b}`;function l({collapsed:a,pinnedSessions:b,sessionNumbers:c,currentCwd:d,onSwitchProject:k,onUnpin:n,onUpdateTitle:o,onReorder:p}){let{t:q}=(0,g.Bd)(),[r,s]=(0,f.useState)(!1),t=(0,f.useRef)(null),[u,v]=(0,f.useState)(null),[w,x]=(0,f.useState)(""),y=(0,f.useRef)(null),z=(0,j.o$)(),{show:A,hide:B}=z,[C,D]=(0,f.useState)(null),[E,F]=(0,f.useState)(null),[G,H]=(0,f.useState)({}),I=(0,f.useCallback)(a=>{u||(k(a.cwd,a.sessionId),s(!1))},[k,u]),J=(0,f.useCallback)((a,b)=>{b.stopPropagation(),B(),v(a.sessionId),x(a.customTitle||"")},[B]),K=(0,f.useCallback)(()=>{u&&w.trim()&&o(u,w.trim()),v(null)},[u,w,o]),L=(0,f.useCallback)(a=>{B(),D(a)},[B]),M=(0,f.useCallback)((a,b)=>{a.preventDefault(),F(b)},[]),N=(0,f.useCallback)(a=>{if(null===C||C===a){D(null),F(null);return}let c=[...b],[d]=c.splice(C,1);c.splice(a,0,d),p(c),D(null),F(null)},[C,b,p]),O=(0,f.useCallback)(()=>{D(null),F(null)},[]);return(0,e.jsxs)("div",{className:"relative",ref:t,children:[(0,e.jsxs)("button",{onClick:()=>s(!r),className:`relative flex items-center gap-2 px-2 py-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-hover transition-colors ${a?"w-full justify-center":"w-full"}`,title:a?q("sessions.favorites"):void 0,children:[(0,e.jsx)("svg",{className:"w-5 h-5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.197-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.784-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z"})}),!a&&(0,e.jsx)("span",{className:"text-sm flex-1 text-left",children:q("sessions.favorites")}),a&&b.length>0&&(0,e.jsx)("span",{className:"absolute -top-1 -right-1 min-w-[18px] h-[18px] px-1 text-muted-foreground text-xs font-medium rounded-full flex items-center justify-center bg-popover border border-border",children:b.length})]}),r&&(0,e.jsxs)("div",{className:"absolute left-full bottom-0 ml-2 w-80 max-h-[450px] bg-popover border border-border rounded-lg shadow-lv2 z-50 flex flex-col",children:[(0,e.jsx)("div",{className:"px-3 py-2 border-b border-border bg-muted/50 flex-shrink-0 rounded-t-lg",children:(0,e.jsx)("span",{className:"text-sm font-medium",children:q("sessions.favorites")})}),(0,e.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto",children:0===b.length?(0,e.jsx)("div",{className:"px-3 py-4 text-sm text-muted-foreground text-center",children:q("sessions.noFavorites")}):b.map((a,f)=>{let g=G[m(a.cwd,a.sessionId)],k=u===a.sessionId;return(0,e.jsxs)("div",{draggable:!0,onDragStart:()=>L(f),onDragOver:a=>M(a,f),onDrop:()=>N(f),onDragEnd:O,onClick:()=>I(a),onMouseEnter:b=>{k||A(g??{cwd:a.cwd,sessionId:a.sessionId,title:a.customTitle},b)},onMouseLeave:B,className:`group w-full px-3 py-2 text-left hover:bg-hover transition-colors flex items-start gap-2 cursor-pointer ${f!==b.length-1?"border-b border-border/50":""} ${d===a.cwd?"bg-accent/50":""} ${C===f?"opacity-50":""} ${E===f?"border-t-2 border-brand":""}`,children:[(0,e.jsx)("span",{className:"mt-1.5 text-muted-foreground/30 flex-shrink-0 cursor-grab",children:(0,e.jsxs)("svg",{className:"w-3 h-3",viewBox:"0 0 10 16",fill:"currentColor",children:[(0,e.jsx)("circle",{cx:"3",cy:"2",r:"1.5"}),(0,e.jsx)("circle",{cx:"7",cy:"2",r:"1.5"}),(0,e.jsx)("circle",{cx:"3",cy:"8",r:"1.5"}),(0,e.jsx)("circle",{cx:"7",cy:"8",r:"1.5"}),(0,e.jsx)("circle",{cx:"3",cy:"14",r:"1.5"}),(0,e.jsx)("circle",{cx:"7",cy:"14",r:"1.5"})]})}),(0,e.jsx)(j.KO,{status:g?.status,className:"mt-1.5"}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(i.S,{engine:g?.engine}),(0,e.jsx)("span",{className:"font-medium text-sm truncate",children:(0,j.Qr)(a.cwd)}),g?.lastActive?(0,e.jsx)("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:(0,j.fw)(q,g.lastActive)}):null,(0,e.jsx)(h.l,{coordinate:c?.[m(a.cwd,a.sessionId)],status:(0,h.S)(g?.status),statusLabel:(0,j.Mm)(q,g?.status),className:"ml-auto"})]}),k?(0,e.jsx)("input",{ref:y,type:"text",value:w,onChange:a=>x(a.target.value),onKeyDown:a=>{a.nativeEvent.isComposing||("Enter"===a.key&&K(),"Escape"===a.key&&v(null))},onBlur:K,onClick:a=>a.stopPropagation(),className:"w-full text-xs px-1 py-0.5 border border-border rounded bg-card text-foreground focus:outline-none focus:ring-1 focus:ring-ring mt-0.5"}):(0,e.jsx)("div",{className:"text-xs font-medium text-foreground truncate",children:a.customTitle||g?.title||a.sessionId.slice(0,8)}),!k&&g?.lastUserMessage&&(0,e.jsx)("div",{className:"text-xs text-foreground/80 truncate",children:g.lastUserMessage})]}),!k&&(0,e.jsxs)("div",{className:"flex-shrink-0 flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity mt-0.5",children:[(0,e.jsx)("button",{onClick:b=>J(a,b),className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground",title:q("sessions.editTitle"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})})}),(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),B(),n(a.sessionId)},className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-destructive",title:q("sessions.removeFavorite"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]},a.sessionId)})})]}),(0,e.jsx)(j.LD,{...z})]})}d()}catch(a){d(a)}})},18921:(a,b,c)=>{"use strict";c.d(b,{_:()=>i,o:()=>h});var d=c(67484),e=c.n(d),f=c(208);let g="json-search-highlight-style";function h(a){let[b,c]=(0,d.useState)(!1),[e,f]=(0,d.useState)(""),[h,i]=(0,d.useState)(!1),[j,k]=(0,d.useState)(0),[l,m]=(0,d.useState)(0),n=(0,d.useRef)(null),o=(0,d.useRef)([]);(0,d.useCallback)(()=>{let b;CSS.highlights?.delete("json-search"),CSS.highlights?.delete("json-search-current"),o.current=[];let c=a.current;if(!c||!e){k(0),m(0);return}!function(){if(document.getElementById(g))return;let a=document.createElement("style");a.id=g,a.textContent="::highlight(json-search){background:var(--highlight)}::highlight(json-search-current){background:var(--highlight-current)}",document.head.appendChild(a)}();let d=c.textContent||"",f=h?e:e.toLowerCase(),i=h?d:d.toLowerCase(),j=[],l=0;for(;l<i.length;){let a=i.indexOf(f,l);if(-1===a)break;j.push([a,a+f.length]),l=a+1}if(0===j.length){k(0),m(0);return}let n=document.createTreeWalker(c,NodeFilter.SHOW_TEXT),p=0,q=0,r=[],s=null,t=0;for(;(b=n.nextNode())&&q<j.length;){let a=b.textContent?.length||0,c=p,d=p+a;for(;q<j.length;){let[a,e]=j[q];if(a>=d)break;if(!s)if(a>=c)(s=document.createRange()).setStart(b,a-c),t=e;else break;if(t<=d)s.setEnd(b,t-c),r.push(s),s=null,q++;else break}p=d}o.current=r,k(r.length),m(a=>r.length>0?Math.min(a,r.length-1):0),CSS.highlights&&r.length>0&&CSS.highlights.set("json-search",new Highlight(...r))},[a,e,h]);let p=(0,d.useCallback)((a,b)=>{let c=a.getBoundingClientRect();(b.top<c.top||b.bottom>c.bottom)&&(a.scrollTop+=b.top-c.top-c.height/2+b.height/2)},[]);(0,d.useCallback)(b=>{CSS.highlights?.delete("json-search-current");let c=o.current[b];if(!c||!CSS.highlights)return;CSS.highlights.set("json-search-current",new Highlight(c));let d=c.getBoundingClientRect(),e=a.current?.parentElement;e&&p(e,d)},[a,p]);let q=(0,d.useCallback)(()=>{0!==j&&m(a=>(a+1)%j)},[j]),r=(0,d.useCallback)(()=>{0!==j&&m(a=>(a-1+j)%j)},[j]),s=(0,d.useCallback)(()=>{c(!0),setTimeout(()=>n.current?.focus(),0)},[]),t=(0,d.useCallback)(()=>{c(!1),f(""),m(0)},[]),u=(0,d.useCallback)(a=>{"Enter"===a.key&&(a.preventDefault(),a.shiftKey?r():q()),"Escape"===a.key&&(a.preventDefault(),t())},[q,r,t]);return{isVisible:b,query:e,setQuery:f,caseSensitive:h,setCaseSensitive:i,matchCount:j,currentIndex:l,searchInputRef:n,open:s,close:t,goToNext:q,goToPrev:r,handleKeyDown:u}}function i({search:a}){return a.isVisible?e().createElement("div",{className:"flex-shrink-0 flex items-center gap-2 px-3 py-2 bg-secondary border-b border-border"},e().createElement("input",{ref:a.searchInputRef,type:"text",value:a.query,onChange:b=>a.setQuery(b.target.value),onKeyDown:a.handleKeyDown,placeholder:f.A.t("codeViewer.searchPlaceholder"),className:"flex-1 max-w-xs px-2 py-1 text-sm border border-border rounded bg-card text-foreground focus:outline-none focus:ring-2 focus:ring-ring"}),e().createElement("button",{onClick:()=>a.setCaseSensitive(a=>!a),className:`px-2 py-1 text-xs font-mono rounded border transition-colors ${a.caseSensitive?"bg-brand text-white border-brand":"border-border text-muted-foreground hover:bg-accent"}`,title:f.A.t("codeViewer.caseSensitive")},"Aa"),e().createElement("span",{className:"text-xs text-muted-foreground"},a.matchCount>0?`${a.currentIndex+1}/${a.matchCount}`:f.A.t("common.noMatch")),e().createElement("button",{onClick:a.goToPrev,disabled:0===a.matchCount,className:"p-1 rounded hover:bg-accent disabled:opacity-50",title:f.A.t("common.previous")},e().createElement("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 15l7-7 7 7"}))),e().createElement("button",{onClick:a.goToNext,disabled:0===a.matchCount,className:"p-1 rounded hover:bg-accent disabled:opacity-50",title:f.A.t("common.next")},e().createElement("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"}))),e().createElement("button",{onClick:a.close,className:"p-1 rounded hover:bg-accent",title:f.A.t("common.close")},e().createElement("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})))):null}},18946:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{X:()=>i});var e=c(48249),f=c(67484),g=c(58554),h=a([g]);function i({tabId:a,cwd:b,sessionId:c,engine:d,onEngineChange:h,ollamaModel:j,onOllamaModelChange:k,deepseekModel:l,onDeepseekModelChange:m,kimiModel:n,onKimiModelChange:o,glmModel:p,onGlmModelChange:q,claudeModel:r,onClaudeModelChange:s,claudeEffort:t,onClaudeEffortChange:u,claudeContextWindow:v,onClaudeContextWindowChange:w,claudeFastMode:x,onClaudeFastModeChange:y,claudeThinking:z,onClaudeThinkingChange:A,codexModel:B,onCodexModelChange:C,codexReasoningEffort:D,onCodexReasoningEffortChange:E,planMode:F,onPlanModeChange:G,noHistory:H,onNoHistoryChange:I,isActive:J,refreshSignal:K,onStateChange:L,onShowGitStatus:M,onOpenNote:N,onCreateScheduledTask:O,onOpenSession:P,onContentSearch:Q,onShowFileDiff:R,onOpenFileLink:S}){let T=(0,f.useCallback)(b=>{L(a,{isLoading:b})},[a,L]),U=(0,f.useCallback)(b=>{L(a,{sessionId:b})},[a,L]),V=(0,f.useCallback)(b=>{L(a,{title:b})},[a,L]),W=(0,f.useCallback)(b=>{h?.(a,b)},[a,h]),X=(0,f.useCallback)(b=>{k?.(a,b)},[a,k]),Y=(0,f.useCallback)(b=>{m?.(a,b)},[a,m]),Z=(0,f.useCallback)(b=>{o?.(a,b)},[a,o]),$=(0,f.useCallback)(b=>{q?.(a,b)},[a,q]),_=(0,f.useCallback)(b=>{s?.(a,b)},[a,s]),aa=(0,f.useCallback)(b=>{u?.(a,b)},[a,u]),ab=(0,f.useCallback)(b=>{w?.(a,b)},[a,w]),ac=(0,f.useCallback)(b=>{y?.(a,b)},[a,y]),ad=(0,f.useCallback)(b=>{A?.(a,b)},[a,A]),ae=(0,f.useCallback)(b=>{C?.(a,b)},[a,C]),af=(0,f.useCallback)(b=>{E?.(a,b)},[a,E]),ag=(0,f.useCallback)(b=>{G?.(a,b)},[a,G]),ah=(0,f.useCallback)(b=>{I?.(a,b)},[a,I]);return(0,e.jsx)(g.r,{tabId:a,initialCwd:b,initialSessionId:c,engine:d,onEngineChange:W,ollamaModel:j,onOllamaModelChange:X,deepseekModel:l,onDeepseekModelChange:Y,kimiModel:n,onKimiModelChange:Z,glmModel:p,onGlmModelChange:$,claudeModel:r,onClaudeModelChange:_,claudeEffort:t,onClaudeEffortChange:aa,claudeContextWindow:v,onClaudeContextWindowChange:ab,claudeFastMode:x,onClaudeFastModeChange:ac,claudeThinking:z,onClaudeThinkingChange:ad,codexModel:B,onCodexModelChange:ae,codexReasoningEffort:D,onCodexReasoningEffortChange:af,planMode:F,onPlanModeChange:ag,noHistory:H,onNoHistoryChange:ah,hideHeader:!0,hideSidebar:!0,isActive:J,refreshSignal:K,onLoadingChange:T,onSessionIdChange:U,onTitleChange:V,onShowGitStatus:M,onOpenNote:N,onCreateScheduledTask:O,onOpenSession:P,onContentSearch:Q,onShowFileDiff:R,onOpenFileLink:S})}g=(h.then?(await h)():h)[0],d()}catch(a){d(a)}})},19545:(a,b,c)=>{"use strict";c.d(b,{Qe:()=>f,up:()=>e});var d=c(208);function e(a){return a.storage.markdown.getMarkdown()}function f(){return[{label:d.A.t("slashCommands.heading1"),icon:"H1",description:d.A.t("slashCommands.heading1Desc"),action:a=>a.chain().focus().toggleHeading({level:1}).run()},{label:d.A.t("slashCommands.heading2"),icon:"H2",description:d.A.t("slashCommands.heading2Desc"),action:a=>a.chain().focus().toggleHeading({level:2}).run()},{label:d.A.t("slashCommands.heading3"),icon:"H3",description:d.A.t("slashCommands.heading3Desc"),action:a=>a.chain().focus().toggleHeading({level:3}).run()},{label:d.A.t("slashCommands.bulletList"),icon:"•",description:d.A.t("slashCommands.bulletListDesc"),action:a=>a.chain().focus().toggleBulletList().run()},{label:d.A.t("slashCommands.orderedList"),icon:"1.",description:d.A.t("slashCommands.orderedListDesc"),action:a=>a.chain().focus().toggleOrderedList().run()},{label:d.A.t("slashCommands.taskList"),icon:"☑",description:d.A.t("slashCommands.taskListDesc"),action:a=>a.chain().focus().toggleTaskList().run()},{label:d.A.t("slashCommands.blockquote"),icon:"❝",description:d.A.t("slashCommands.blockquoteDesc"),action:a=>a.chain().focus().toggleBlockquote().run()},{label:d.A.t("slashCommands.codeBlock"),icon:"<>",description:d.A.t("slashCommands.codeBlockDesc"),action:a=>a.chain().focus().toggleCodeBlock().run()},{label:d.A.t("slashCommands.table"),icon:"▦",description:d.A.t("slashCommands.tableDesc"),action:a=>a.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run()},{label:d.A.t("slashCommands.horizontalRule"),icon:"──",description:d.A.t("slashCommands.horizontalRuleDesc"),action:a=>a.chain().focus().setHorizontalRule().run()},{label:d.A.t("slashCommands.link"),icon:"\uD83D\uDD17",description:d.A.t("slashCommands.linkDesc"),action:a=>{window.dispatchEvent(new CustomEvent("tiptap-insert-link"))}}]}f()},19562:(a,b,c)=>{"use strict";c.d(b,{SettingsModal:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call SettingsModal() from the server but SettingsModal is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/SettingsModal.tsx","SettingsModal")},19593:(a,b,c)=>{"use strict";c.d(b,{C0:()=>m});var d=c(48249),e=c(67484),f=c(10316),g=c(46674),h=c(72419),i=c(44218),j=c(44384);let k=/^-?[\d,]*\.?\d+%?$/;function l(a){return k.test(a)?parseFloat(a.replace(/,/g,"")):NaN}function m({content:a,filePath:b,className:c="",action:n}){let{t:o}=(0,j.Bd)(),[p,q]=(0,e.useState)(500),[r,s]=(0,e.useState)(""),[t,u]=(0,e.useState)(-1),[v,w]=(0,e.useState)(null),{header:x,body:y,columnCount:z}=(0,e.useMemo)(()=>{let c=(function(a,b){let c=[],d=[],e="",f=!1,g=!1,h=()=>{d.push(e),c.push(d),d=[],e="",g=!1};for(let c=0;c<a.length;c++){let i=a[c];if(f){if('"'!==i){e+=i;continue}'"'===a[c+1]?(e+='"',c++):f=!1;continue}if('"'===i&&""===e){f=!0,g=!0;continue}if(i===b){d.push(e),e="",g=!0;continue}if("\r"===i){"\n"===a[c+1]&&c++,h();continue}if("\n"===i){h();continue}e+=i,g=!0}return(g||""!==e||d.length>0)&&h(),c})(a,function(a,b){if(b&&/\.tsv$/i.test(b))return" ";let c=a.slice(0,65536),d={",":0,";":0," ":0,"|":0},e=!1,f=0;for(let a=0;a<c.length&&f<5;a++){let b=c[a];if('"'===b){e=!e;continue}if(!e){if("\n"===b){f++;continue}b in d&&d[b]++}}let g=Object.entries(d).sort((a,b)=>b[1]-a[1])[0];return g[1]>0?g[0]:","}(a,b)).filter(a=>a.length>1||""!==a[0]),d=c.reduce((a,b)=>Math.max(a,b.length),0),e=c.slice(1).map((a,b)=>({index:b,cells:a}));return{header:c[0]??[],body:e,columnCount:d}},[a,b]),A=(0,e.useMemo)(()=>{let a=r.trim().toLowerCase();return a?y.filter(b=>t>=0?(b.cells[t]??"").toLowerCase().includes(a):b.cells.some(b=>b.toLowerCase().includes(a))):y},[y,r,t]),B=(0,e.useMemo)(()=>{if(!v)return A;let a="asc"===v.dir?1:-1;return[...A].sort((b,c)=>(function(a,b,c){if(""===a||""===b)return a===b?0:""===a?1:-1;let d=l(a),e=l(b);return isNaN(d)||isNaN(e)?a.localeCompare(b,void 0,{numeric:!0})*c:(d-e)*c})(b.cells[v.col]??"",c.cells[v.col]??"",a))},[A,v]),C=(0,e.useCallback)(a=>{w(b=>b&&b.col===a?"asc"===b.dir?{col:a,dir:"desc"}:null:{col:a,dir:"asc"})},[]);if(0===z)return(0,d.jsx)("div",{className:`flex items-center justify-center ${c}`,children:(0,d.jsx)("span",{className:"text-sm text-muted-foreground",children:o("csv.empty")})});let D=B.slice(0,p);return(0,d.jsxs)("div",{className:`flex flex-col min-h-0 ${c}`,children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 border-b border-border flex-shrink-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 flex-1 min-w-0 px-1.5 py-0.5 rounded border border-border bg-card focus-within:border-brand transition-colors",children:[(0,d.jsx)(f.A,{className:"w-3.5 h-3.5 text-muted-foreground flex-shrink-0","aria-hidden":!0}),(0,d.jsx)("input",{value:r,onChange:a=>s(a.target.value),placeholder:o("csv.filterPlaceholder"),className:"flex-1 min-w-0 bg-transparent text-xs text-foreground placeholder:text-muted-foreground outline-none"}),r&&(0,d.jsx)("button",{onClick:()=>s(""),className:"text-muted-foreground hover:text-foreground flex-shrink-0",title:o("csv.clearFilter"),children:(0,d.jsx)(g.A,{className:"w-3.5 h-3.5"})})]}),(0,d.jsxs)("select",{value:t,onChange:a=>u(Number(a.target.value)),className:"text-xs bg-card text-muted-foreground border border-border rounded px-1 py-1 max-w-[10rem] flex-shrink-0",title:o("csv.filterColumn"),children:[(0,d.jsx)("option",{value:-1,children:o("csv.allColumns")}),Array.from({length:z},(a,b)=>(0,d.jsx)("option",{value:b,children:x[b]||`#${b+1}`},b))]}),n&&(0,d.jsx)("button",{onClick:n.onClick,className:"text-xs px-2 py-1 rounded border border-border text-muted-foreground hover:text-foreground hover:bg-hover transition-colors flex-shrink-0",children:n.label})]}),(0,d.jsxs)("div",{className:"flex-1 overflow-auto",children:[(0,d.jsxs)("table",{className:"text-xs border-collapse w-max min-w-full",children:[(0,d.jsx)("thead",{className:"sticky top-0 z-10",children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{className:"sticky left-0 z-20 bg-accent border-b border-r border-border px-2 py-1.5 text-right font-normal text-muted-foreground select-none",children:"#"}),Array.from({length:z},(a,b)=>(0,d.jsx)("th",{onClick:()=>C(b),className:"bg-accent border-b border-border px-2 py-1.5 text-left font-medium text-foreground whitespace-nowrap cursor-pointer select-none hover:bg-hover",title:o("csv.sortHint"),children:(0,d.jsxs)("span",{className:"inline-flex items-center gap-1",children:[x[b]??"",v?.col===b&&("asc"===v.dir?(0,d.jsx)(h.A,{className:"w-3 h-3 text-brand","aria-hidden":!0}):(0,d.jsx)(i.A,{className:"w-3 h-3 text-brand","aria-hidden":!0}))]})},b))]})}),(0,d.jsx)("tbody",{children:D.map(a=>(0,d.jsxs)("tr",{className:"hover:bg-hover",children:[(0,d.jsx)("td",{className:"sticky left-0 bg-card border-b border-r border-border px-2 py-1 text-right text-muted-foreground tabular-nums select-none",children:a.index+1}),Array.from({length:z},(b,c)=>{let e=a.cells[c]??"";return(0,d.jsx)("td",{title:e.length>60?e:void 0,className:`border-b border-border px-2 py-1 max-w-[28rem] truncate text-foreground ${k.test(e)?"text-right tabular-nums":""}`,children:e},c)})]},a.index))})]}),0===D.length&&(0,d.jsx)("div",{className:"p-4 text-xs text-muted-foreground",children:o("csv.noMatch")})]}),(0,d.jsxs)("div",{className:"flex items-center gap-3 px-3 py-1.5 border-t border-border text-xs text-muted-foreground flex-shrink-0",children:[(0,d.jsx)("span",{children:A.length===y.length?o("csv.summary",{rows:y.length,cols:z}):o("csv.summaryFiltered",{rows:A.length,total:y.length,cols:z})}),D.length<B.length&&(0,d.jsx)("button",{onClick:()=>q(a=>a+500),className:"px-1.5 py-0.5 rounded hover:bg-hover hover:text-foreground transition-colors",children:o("csv.loadMore",{shown:D.length,total:B.length})})]})]})}},20291:(a,b,c)=>{"use strict";c.d(b,{p:()=>i});var d=c(67484),e=c(208),f=c(79606),g=c(33281),h=c(71192);function i({cwd:a,onSearchComplete:b}){let[c,j]=(0,d.useState)(""),[k,l]=(0,d.useState)([]),[m,n]=(0,d.useState)(!1),[o,p]=(0,d.useState)(null),[q,r]=(0,d.useState)(new Set),[s,t]=(0,d.useState)({caseSensitive:!1,wholeWord:!1,regex:!1,fileType:""}),[u,v]=(0,d.useState)(null),w=(0,d.useRef)(null),x=(0,d.useCallback)(async c=>{let d=c.trim();if(!d){l([]),v(null);return}if(d.length<2)return void p(e.A.t("fileBrowser.searchMinChars"));n(!0),p(null);let i=new URLSearchParams({cwd:a,q:c,caseSensitive:String(s.caseSensitive),wholeWord:String(s.wholeWord),regex:String(s.regex),fileType:s.fileType}),j=f.tryPromise({try:async()=>{let a=await fetch(`/api/files/search?${i}`),b=await a.json();if(b.error)throw Error(b.error);return b},catch:a=>new h.uV({message:"content search failed",cause:a})});await g.t4.runPromise(j.pipe(f.match({onSuccess:a=>{l(a.results),v({totalFiles:a.totalFiles,totalMatches:a.totalMatches,truncated:a.truncated}),r(new Set(a.results.map(a=>a.path))),a.results.length>0&&b?.()},onFailure:a=>{p(a.cause instanceof Error?a.cause.message:"Search failed"),l([])}}))),n(!1)},[a,s,b]);return{contentSearchQuery:c,setContentSearchQuery:j,contentSearchResults:k,isSearching:m,searchError:o,searchExpandedPaths:q,searchOptions:s,setSearchOptions:t,searchStats:u,contentSearchInputRef:w,performContentSearch:x,handleSearchToggle:(0,d.useCallback)(a=>{r(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[])}}},20586:(a,b,c)=>{"use strict";c.d(b,{Do:()=>m,Sz:()=>n,VO:()=>l,wI:()=>o});var d=c(48249),e=c(67484),f=c.n(e),g=c(44384),h=c(7122),i=c(61591);function j({status:a}){let{label:b,className:c}={added:{label:"A",className:"text-green-11"},untracked:{label:"A",className:"text-green-11"},modified:{label:"M",className:"text-amber-11"},deleted:{label:"D",className:"text-red-11"},renamed:{label:"R",className:"text-brand"}}[a]||{label:"?",className:"text-muted-foreground"};return(0,d.jsx)("span",{className:`text-xs font-bold ${c}`,children:b})}let k=f().memo(function a({node:b,level:c,selectedPath:f,expandedPaths:g,onSelect:h,onToggle:k,onContextMenu:l,showChanges:m=!1,renderActions:n}){let o=f===b.path,p=g.has(b.path),q=(0,e.useCallback)(()=>{b.isDirectory?k(b.path):h(b)},[b,h,k]),r=(0,e.useCallback)(a=>{a.preventDefault(),a.stopPropagation(),l(a,b.path,b.isDirectory)},[b.path,b.isDirectory,l]);return b.isDirectory?(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"flex items-center gap-1 py-0.5 px-2 pr-3 hover:bg-hover cursor-pointer whitespace-nowrap group",style:{paddingLeft:`${12*c+8}px`},onClick:q,onContextMenu:r,children:[(0,d.jsx)("span",{className:"text-foreground-subtle text-xs",children:p?"▼":"▶"}),(0,d.jsx)("span",{className:"text-sm text-foreground flex-1 truncate","data-tooltip":b.path,children:b.name}),n&&n(b)]}),p&&b.children.map(b=>(0,d.jsx)(a,{node:b,level:c+1,selectedPath:f,expandedPaths:g,onSelect:h,onToggle:k,onContextMenu:l,showChanges:m,renderActions:n},b.path))]}):(0,d.jsxs)("div",{className:`flex items-center gap-1.5 py-0.5 px-2 pr-3 cursor-pointer whitespace-nowrap group ${o?"bg-brand/10":"hover:bg-hover"}`,style:{paddingLeft:`${12*c+8}px`},onClick:q,onContextMenu:r,children:[(0,d.jsx)(i.o,{name:b.name,size:16,className:"flex-shrink-0"}),(0,d.jsx)("span",{className:`text-sm flex-1 truncate ${o?"text-brand":"text-foreground"}`,"data-tooltip":b.path,children:b.name}),b.status&&(0,d.jsx)(j,{status:b.status}),m&&void 0!==b.additions&&void 0!==b.deletions&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("span",{className:"text-xs text-green-11",children:["+",b.additions]}),(0,d.jsxs)("span",{className:"text-xs text-red-11",children:["-",b.deletions]})]}),n&&n(b)]})});function l({files:a,selectedPath:b,expandedPaths:c,onSelect:e,onToggle:f,cwd:i,showChanges:j=!1,renderActions:m,emptyMessage:n,className:o,onExplain:p,explainDisabled:q}){let{t:r}=(0,g.Bd)(),s=n??r("gitFileTree.noFiles"),{contextMenu:t,showContextMenu:u,hideContextMenu:v}=(0,h.Ee)();return 0===a.length?(0,d.jsx)("div",{className:"px-3 py-2 text-xs text-foreground-subtle",children:s}):(0,d.jsxs)("div",{className:o||"py-1",children:[a.map(a=>(0,d.jsx)(k,{node:a,level:0,selectedPath:b,expandedPaths:c,onSelect:e,onToggle:f,onContextMenu:u,showChanges:j,renderActions:m},a.path)),t&&(0,d.jsx)(h.ft,{x:t.x,y:t.y,path:t.path,cwd:i,isDirectory:t.isDirectory,onClose:v,onExplain:p,explainDisabled:q})]})}function m(a){let b=[];for(let c of a){let a=c.path.split("/"),d=b;for(let b=0;b<a.length;b++){let e=a[b],f=b===a.length-1,g=a.slice(0,b+1).join("/"),h=d.find(a=>a.name===e);h||(h={name:e,path:g,isDirectory:!f,children:[],...f&&{status:c.status,additions:c.additions,deletions:c.deletions,oldPath:c.oldPath,file:c}},d.push(h)),f||(d=h.children)}}let c=a=>{a.sort((a,b)=>a.isDirectory&&!b.isDirectory?-1:!a.isDirectory&&b.isDirectory?1:a.name.localeCompare(b.name)),a.forEach(a=>c(a.children))};return c(b),b}function n(a){let b=[],c=a=>{for(let d of a)d.isDirectory&&(b.push(d.path),c(d.children))};return c(a),b}function o(a){let b=[],c=a=>{if(a.isDirectory)for(let b of a.children)c(b);else b.push(a)};return c(a),b}},21482:(a,b,c)=>{"use strict";c.d(b,{D:()=>h});var d=c(48249),e=c(67484),f=c(44384),g=c(46674);function h({results:a,loading:b,totalMatches:c,onSelect:i,onClose:j,scope:k,onScopeChange:l,selectedPath:m}){let{t:n}=(0,f.Bd)(),o=function(){let[a,b]=(0,e.useState)(new Map),[c,d]=(0,e.useState)(!1);return(0,e.useRef)(0),a}(),p="selected"===k?a.filter(a=>a.path===m):a,q=p.reduce((a,b)=>a+b.matches.length,0);return(0,d.jsxs)("div",{className:"border-t border-border bg-card flex flex-col",style:{height:"300px"},children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-3 py-1.5 bg-card/50 border-b border-border flex-shrink-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,d.jsxs)("span",{className:"text-xs font-medium text-foreground truncate",children:[n("searchResults.title")," ",!b&&n("searchResults.nMatches",{count:"selected"===k?q:c})]}),(0,d.jsxs)("div",{className:"flex items-center rounded border border-border overflow-hidden text-xs flex-shrink-0",children:[(0,d.jsx)("button",{onClick:()=>l("selected"),className:`px-2 py-0.5 ${"selected"===k?"bg-brand/15 text-brand":"text-muted-foreground hover:bg-hover"}`,children:n("searchResults.scopeSelected")}),(0,d.jsx)("button",{onClick:()=>l("all"),className:`px-2 py-0.5 border-l border-border ${"all"===k?"bg-brand/15 text-brand":"text-muted-foreground hover:bg-hover"}`,children:n("searchResults.scopeAll")})]})]}),(0,d.jsx)("button",{onClick:j,className:"p-0.5 rounded hover:bg-hover text-muted-foreground flex-shrink-0",children:(0,d.jsx)(g.A,{className:"w-3.5 h-3.5"})})]}),(0,d.jsx)("div",{className:"flex-1 overflow-auto",children:b?(0,d.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:n("searchResults.searching")}):0===p.length?(0,d.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:n("searchResults.noResults")}):p.map(a=>(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"px-3 py-1 text-xs text-muted-foreground font-medium bg-card sticky top-0",children:a.path}),a.matches.map((b,c)=>{let e=`${a.path}:${b.lineNumber}`,f=o.get(e);return(0,d.jsxs)("button",{onClick:()=>i(a.path,b.lineNumber),className:"w-full text-left px-3 py-0.5 hover:bg-hover flex items-baseline gap-2 group",children:[(0,d.jsx)("span",{className:"text-sm text-muted-foreground font-mono font-variant-tabular flex-shrink-0 w-10 text-right",children:b.lineNumber}),f?(0,d.jsx)("span",{className:"text-sm font-mono truncate",dangerouslySetInnerHTML:{__html:f}}):(0,d.jsx)("span",{className:"text-sm font-mono text-foreground truncate",children:b.content||""})]},`${b.lineNumber}-${c}`)})]},a.path))})]})}c(36984)},21538:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{n:()=>u});var e=c(48249),f=c(67484),g=c(44384),h=c(35208),i=c(39238),j=c(74691),k=c(60333),l=c(20586),m=c(46242),n=c(9804),o=c(33281),p=c(85655),q=c(60591),r=c(18921),s=c(7031);c(57063);var t=a([h,i]);function u({isOpen:a,onClose:b,commit:c,cwd:d,embedded:t=!1,initialFilePath:v,onContentSearch:w}){let{t:x}=(0,g.Bd)(),[y,z]=(0,f.useState)([]),[A,B]=(0,f.useState)([]),[C,D]=(0,f.useState)(new Set),[E,F]=(0,f.useState)(null),[G,H]=(0,f.useState)(null),[I,J]=(0,f.useState)(!1),[K,L]=(0,f.useState)(!1),[M,N]=(0,f.useState)(null),[O,P]=(0,f.useState)(null),[Q,R]=(0,f.useState)("compact"),[S,T]=(0,f.useState)("unified"),U=(0,f.useRef)(null),V=(0,r.o)(U),W=(0,s.r)(),X=c?.shortHash,Y=(0,f.useCallback)(a=>{X&&W?.sendMessage(x("explain.commitFileMessage",{hash:X,path:a}))},[W,x,X]),Z=(0,f.useCallback)(a=>{c&&(F(a),L(!0),o.t4.runPromiseExit((0,p.Zi)(d,c.hash,a.path)).then(a=>{"Success"===a._tag?H(a.value):console.error(a.cause),L(!1)}))},[d,c]),$=(0,f.useCallback)(a=>{D(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),_=(0,f.useMemo)(()=>{if(!c)return"";if(c.date){var a;let b,d,e,f,g,h,i;return a=c.date,b=new Date(a),d=new Date,e=b.getFullYear()===d.getFullYear(),f=String(b.getMonth()+1).padStart(2,"0"),g=String(b.getDate()).padStart(2,"0"),h=String(b.getHours()).padStart(2,"0"),i=String(b.getMinutes()).padStart(2,"0"),e?`${f}-${g} ${h}:${i}`:`${b.getFullYear()}-${f}-${g} ${h}:${i}`}return c.time?new Date(1e3*c.time).toLocaleString():""},[c]);if(!a||!c)return null;let aa=!!G&&(!0===G.isImage||(0,n.u)(G.filePath)),ab=(0,e.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,e.jsxs)("div",{className:"px-4 py-3 border-b border-border flex-shrink-0",children:[(0,e.jsx)("div",{className:"text-sm font-medium text-foreground mb-2",children:c.subject}),c.body&&(0,e.jsx)("div",{className:"text-xs text-muted-foreground whitespace-pre-wrap mb-3 max-h-32 overflow-y-auto border-l-2 border-border pl-3",children:c.body}),(0,e.jsxs)("div",{className:"flex flex-wrap gap-4 text-xs text-muted-foreground",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)("span",{className:"text-foreground-subtle",children:x("commitDetail.hash")}),(0,e.jsx)("span",{className:"font-mono bg-accent px-1.5 py-0.5 rounded",children:c.hash})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)("span",{className:"text-foreground-subtle",children:x("commitDetail.author")}),(0,e.jsx)("span",{children:c.author}),(0,e.jsxs)("span",{className:"text-foreground-subtle",children:["<",c.authorEmail,">"]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)("span",{className:"text-foreground-subtle",children:x("commitDetail.date")}),(0,e.jsx)("span",{children:_}),c.relativeDate&&(0,e.jsxs)("span",{className:"text-foreground-subtle",children:["(",c.relativeDate,")"]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)("span",{className:"text-foreground-subtle",children:x("commitDetail.files")}),(0,e.jsx)("span",{children:x("commitDetail.nChanges",{count:y.length})})]}),!aa&&(0,e.jsxs)("div",{className:"ml-auto flex items-center gap-2",children:[(0,e.jsx)(j.y,{value:Q,onChange:R}),(0,e.jsx)(k.q,{value:S,onChange:T})]})]})]}),(0,e.jsxs)("div",{className:"flex-1 flex overflow-hidden",children:[(0,e.jsx)("div",{className:"w-72 flex-shrink-0 border-r border-border overflow-y-auto overflow-x-hidden",children:I?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:x("commitDetail.loadingFiles")}):(0,e.jsx)(l.VO,{files:A,selectedPath:E?.path||null,expandedPaths:C,onSelect:a=>a.file&&Z(a.file),onToggle:$,cwd:d,showChanges:!0,emptyMessage:x("commitDetail.noFileChanges"),className:"py-1",onExplain:W&&X?Y:void 0,explainDisabled:W?.isLoading})}),(0,e.jsx)("div",{className:"flex-1 overflow-hidden",children:K?(0,e.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground text-sm",children:x("commitDetail.loadingDiff")}):G?aa?(0,e.jsx)(m.M,{cwd:d,filePath:G.filePath,oldRev:G.oldRev??(G.isNew?null:`${c.hash}^1`),newRev:G.newRev??(G.isDeleted?null:c.hash)}):"unified"===S?(0,e.jsx)(h.xU,{oldContent:G.oldContent,newContent:G.newContent,filePath:G.filePath,cwd:d,enableComments:!0,compact:"compact"===Q,onPreview:G.isDeleted?void 0:(0,q.aR)(G.filePath)?()=>P({content:G.newContent,filePath:G.filePath}):G.filePath.endsWith(".json")?()=>N({content:G.newContent,filePath:G.filePath}):void 0,previewLabel:(0,q.aR)(G.filePath)?x("common.preview"):x("common.readable"),onContentSearch:w}):(0,e.jsx)(h.xZ,{oldContent:G.oldContent,newContent:G.newContent,filePath:G.filePath,isNew:G.isNew,isDeleted:G.isDeleted,cwd:d,enableComments:!0,compact:"compact"===Q,onPreview:G.isDeleted?void 0:(0,q.aR)(G.filePath)?()=>P({content:G.newContent,filePath:G.filePath}):G.filePath.endsWith(".json")?()=>N({content:G.newContent,filePath:G.filePath}):void 0,previewLabel:(0,q.aR)(G.filePath)?x("common.preview"):x("common.readable"),onContentSearch:w}):(0,e.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground text-sm",children:x("commitDetail.selectFileToView")})})]})]}),ac=M&&(0,e.jsx)("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-scrim",onClick:()=>N(null),children:(0,e.jsxs)("div",{className:"bg-card rounded-lg shadow-lv3 w-full max-w-[90%] h-[90%] flex flex-col",onClick:a=>a.stopPropagation(),children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border flex-shrink-0",children:[(0,e.jsx)("span",{className:"text-sm text-muted-foreground font-mono truncate",children:M.filePath}),(0,e.jsx)("button",{onClick:()=>N(null),className:"p-1 text-muted-foreground hover:text-foreground hover:bg-hover rounded transition-colors",children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsx)(r._,{search:V}),(0,e.jsx)("div",{className:"flex-1 overflow-auto px-6 py-4 bg-secondary",children:(0,e.jsx)("pre",{ref:U,className:"whitespace-pre-wrap break-words font-mono text-foreground",style:{fontSize:"0.8125rem",lineHeight:"1.5"},children:(0,q.xb)(M.content)})})]})}),ad=O&&(0,e.jsx)(i.N,{filePath:O.filePath,content:O.content,cwd:d,onClose:()=>P(null)});return t?(0,e.jsxs)("div",{className:"bg-card w-full h-full flex flex-col relative",children:[(0,e.jsx)("button",{onClick:b,className:"absolute top-2 right-2 z-10 p-1 text-foreground-subtle hover:text-foreground hover:bg-hover rounded transition-colors",title:x("common.close"),children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),ab,ac,ad]}):(0,e.jsx)("div",{className:"fixed inset-0 z-[60] bg-scrim",onClick:b,children:(0,e.jsxs)("div",{className:"bg-card w-full h-full flex flex-col",onClick:a=>a.stopPropagation(),children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,e.jsx)("h3",{className:"text-sm font-medium text-foreground",children:x("commitDetail.title")}),(0,e.jsx)("button",{onClick:b,className:"p-1 text-foreground-subtle hover:text-foreground hover:bg-hover rounded transition-colors",children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),ab,ac,ad]})})}[h,i]=t.then?(await t)():t,d()}catch(a){d(a)}})},21672:(a,b,c)=>{"use strict";c.d(b,{D:()=>h});var d=c(48249),e=c(67484),f=c(44384),g=c(46674);function h({references:a,loading:b,onSelect:c,onClose:i}){let{t:j}=(0,f.Bd)(),k=function(){let[a,b]=(0,e.useState)(new Map),[c,d]=(0,e.useState)(!1);return(0,e.useRef)(0),a}(),l=[],m=new Map;for(let b=0;b<a.length;b++){let c=a[b],d=m.get(c.file);void 0===d&&(d=l.length,m.set(c.file,d),l.push({file:c.file,items:[]})),l[d].items.push({ref:c,idx:b})}return(0,d.jsxs)("div",{className:"border-t border-border bg-card flex flex-col",style:{height:"300px"},children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-3 py-1.5 bg-card/50 border-b border-border flex-shrink-0",children:[(0,d.jsxs)("span",{className:"text-xs font-medium text-foreground",children:[j("references.title")," ",!b&&`(${a.length})`]}),(0,d.jsx)("button",{onClick:i,className:"p-0.5 rounded hover:bg-hover text-muted-foreground",children:(0,d.jsx)(g.A,{className:"w-3.5 h-3.5"})})]}),(0,d.jsx)("div",{className:"flex-1 overflow-auto",children:b?(0,d.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:j("references.searching")}):0===a.length?(0,d.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:j("references.notFound")}):l.map(({file:a,items:b})=>(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"px-3 py-1 text-xs text-muted-foreground font-medium bg-card sticky top-0",children:a}),b.map(({ref:a,idx:b})=>(0,d.jsxs)("button",{onClick:()=>c(a),className:"w-full text-left px-3 py-0.5 hover:bg-hover flex items-baseline gap-2 group",children:[(0,d.jsx)("span",{className:"text-sm text-muted-foreground font-mono font-variant-tabular flex-shrink-0 w-10 text-right",children:a.line}),k.has(b)?(0,d.jsx)("span",{className:"text-sm font-mono truncate",dangerouslySetInnerHTML:{__html:k.get(b)}}):(0,d.jsx)("span",{className:"text-sm font-mono text-foreground truncate",children:a.lineText||""})]},`${a.line}-${a.column}-${b}`))]},a))})]})}c(36984)},23328:(a,b,c)=>{"use strict";c.d(b,{AJ:()=>q,Cb:()=>C,D0:()=>y,DN:()=>l,Jn:()=>j,MR:()=>m,Ok:()=>v,QF:()=>i,SN:()=>r,UV:()=>B,Vv:()=>t,Yj:()=>A,Yn:()=>z,bv:()=>s,cm:()=>n,cv:()=>u,jO:()=>w,tp:()=>x,uc:()=>p,y8:()=>o});var d=c(79606),e=c(71192);let f=a=>d.tryPromise({try:async()=>{let b=await fetch(a);if(!b.ok)throw Error(`HTTP ${b.status}`);return await b.json()},catch:b=>new e.uV({message:`fetch ${a} failed`,cause:b})}),g=(a,b)=>d.tryPromise({try:async()=>{let c=await fetch(a,b);if(!c.ok)throw Error(`HTTP ${c.status}`)},catch:c=>new e.uV({message:`${b.method} ${a} failed`,cause:c})}),h=(a,b)=>g(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),i=(a,b)=>d.gen(function*(){let c=new URLSearchParams({cwd:a});return b&&c.set("tabId",b),(yield*f(`/api/terminal/env?${c}`)).env||{}}),j=()=>f("/api/terminal/aliases").pipe(d.map(a=>a.aliases||{})),k=(a,b)=>`/api/terminal/bubble-order?cwd=${encodeURIComponent(a)}&tabId=${encodeURIComponent(b)}`,l=(a,b)=>f(k(a,b)).pipe(d.map(a=>a.order||[])),m=(a,b)=>f(k(a,b)).pipe(d.map(a=>a.titles||{})),n=(a,b,c,d)=>h("/api/terminal/bubble-order",{cwd:a,tabId:b,order:c,sourceId:d}),o=(a,b,c,d)=>h("/api/terminal/bubble-order",{cwd:a,tabId:b,titles:{[c]:d}}),p=(a,b,c,d=100)=>f(`/api/terminal/history?cwd=${encodeURIComponent(a)}&tabId=${encodeURIComponent(b)}&page=${c}&pageSize=${d}`),q=(a,b,c,d)=>h("/api/terminal/history",{cwd:a,tabId:b,entry:c,sourceId:d}),r=(a,b,c,d)=>g(`/api/terminal/history?cwd=${encodeURIComponent(a)}&tabId=${encodeURIComponent(b)}&commandId=${encodeURIComponent(c)}${d?`&sourceId=${encodeURIComponent(d)}`:""}`,{method:"DELETE"}),s=(a,b,c,d,e)=>g("/api/terminal/history",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,tabId:b,id:c,fields:d,sourceId:e})}),t=a=>h("/api/terminal/env",a),u=a=>h("/api/terminal/aliases",{aliases:a}),v=a=>h("/api/terminal/register",a),w=a=>h("/api/terminal/unregister",a),x=a=>d.tryPromise({try:async()=>{let b=await fetch("/api/terminal/autocomplete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!b.ok)throw Error(`HTTP ${b.status}`);return await b.json()},catch:a=>new e.uV({message:"POST /api/terminal/autocomplete failed",cause:a})}),y=a=>f(`/api/project-settings?cwd=${encodeURIComponent(a)}`),z=a=>h("/api/project-settings",a),A=()=>f("/api/services/config?scope=global"),B=a=>f(`/api/services/config?cwd=${encodeURIComponent(a)}`),C=a=>{let b;return b="/api/services/config",d.tryPromise({try:async()=>{let c=await fetch(b,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!c.ok)throw Error(`HTTP ${c.status}`);return await c.json()},catch:a=>new e.uV({message:`POST ${b} failed`,cause:a})})}},23700:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{f:()=>m});var e=c(48249),f=c(67484),g=c(44384),h=c(44256),i=c(33281),j=c(2929),k=c(81206),l=a([j]);function m({cwd:a,sessionId:b,toolCall:c,workflowRef:d,onClose:l}){let{t:n}=(0,g.Bd)(),[o,p]=(0,f.useState)(null),[q,r]=(0,f.useState)(null),[s,t]=(0,f.useState)(!1),u=(0,f.useRef)(void 0),v=d?!!d.running:!c?.result;(0,f.useCallback)(async()=>{let e=await i.t4.runPromiseExit((0,k.z)({cwd:a,sessionId:b,...d?{workflowId:d.runId,workflowAgentId:d.agentId}:{toolUseId:c?.id},ifFingerprint:u.current}));if(t(!0),"Success"!==e._tag||!e.value)return;let f=e.value;f.fingerprint&&(u.current=f.fingerprint),!f.notModified&&(f.messages&&p(f.messages),f.subagent&&r(f.subagent))},[a,b,c?.id,d?.runId,d?.agentId]);let w=(0,f.useRef)(null),x=(0,f.useRef)(!0),y="string"==typeof c?.input?.description?c.input.description:"",z=d?d.label||"":[q?.agentType,y].filter(Boolean).join(" \xb7 ");return(0,e.jsx)(h.ZL,{children:(0,e.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-scrim p-4",onClick:l,children:(0,e.jsxs)("div",{className:"bg-card rounded-lg shadow-lv3 w-full max-w-[90%] h-[90vh] flex flex-col",onClick:a=>a.stopPropagation(),children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-border flex-shrink-0",children:[(0,e.jsx)("span",{className:"text-base",children:"\uD83E\uDD16"}),(0,e.jsx)("span",{className:"font-medium text-sm text-foreground flex-shrink-0",children:n("chat.subagent")}),z&&(0,e.jsx)("span",{className:"text-xs text-muted-foreground truncate flex-1 min-w-0","data-tooltip":z,children:z}),(0,e.jsxs)("span",{className:"ml-auto flex items-center gap-2 flex-shrink-0",children:[v&&(0,e.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-brand border-t-transparent rounded-full animate-spin"}),(0,e.jsx)("button",{onClick:l,className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-hover transition-colors",title:n("common.close"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),(0,e.jsx)("div",{ref:w,onScroll:()=>{let a=w.current;a&&(x.current=a.scrollTop+a.clientHeight>=a.scrollHeight-40)},className:"flex-1 overflow-y-auto px-4 py-3",children:null===o?(0,e.jsx)("div",{className:"text-xs text-muted-foreground text-center py-4",children:n(s?"chat.subagentEmpty":"common.loading")}):o.map(b=>(0,e.jsx)(j.s,{message:b,cwd:a},b.id))})]})})})}j=(l.then?(await l)():l)[0],d()}catch(a){d(a)}})},23734:(a,b,c)=>{"use strict";c.d(b,{R:()=>e,d:()=>f});var d=c(28031);let e=(a,b)=>({id:a,legacyType:b??a.replace(/-/g,"_").toUpperCase()}),f=d.Io("@cockpit/IframeBus")},23860:(a,b,c)=>{"use strict";c.d(b,{F:()=>e});var d=c(67484);function e(){let[a,b]=(0,d.useState)(()=>"u"<typeof document||"visible"===document.visibilityState);return a}},23881:(a,b,c)=>{"use strict";c.d(b,{s:()=>i});var d=c(48249),e=c(67484),f=c(44384);function g(a){return a.replace(/^\([^)]+\)\s*/,"")}function h(a){let b=g(a),c=b.match(/^(?:function|const|let|var|class|interface|type|enum|async function)\s+([a-zA-Z_$][\w$]*)/);if(c)return c[1];let d=a.match(/\([^)]+\)\s+(?:[\w$]+\.)*([a-zA-Z_$][\w$]*)/);if(d)return d[1];let e=b.match(/([a-zA-Z_$][\w$]*)/);return e?e[1]:b.split(/[(\s:]/)[0]}let i=(0,e.forwardRef)(function({displayString:a,documentation:b,x:c,y:i,container:j,onMouseEnter:k,onMouseLeave:l,onFindReferences:m,onSearch:n,onExplain:o,explainDisabled:p},q){let{t:r}=(0,f.Bd)(),s=(0,e.useRef)(null);(0,e.useImperativeHandle)(q,()=>s.current,[]);let t=j.getBoundingClientRect(),u=c-t.left,v=i-t.top,w=(0,e.useMemo)(()=>g(a),[a]),x=(0,e.useMemo)(()=>(function(a){let b,c=/\b(const|let|var|function|class|interface|type|enum|import|export|async|await|return|new|typeof|keyof|extends|implements|readonly|static|public|private|protected|abstract|declare|namespace|module|void|never|undefined|null|true|false|any|unknown|string|number|boolean|bigint|symbol|object)\b/g,e=[],f=0,g=0,h=/\b(const|let|var|function|class|interface|type|enum|import|export|async|await|return|new|typeof|keyof|extends|implements|readonly|static|public|private|protected|abstract|declare|namespace|module|void|never|undefined|null|true|false|any|unknown|string|number|boolean|bigint|symbol|object)\b|"[^"]*"|'[^']*'|\b\d+\b/g;for(;null!==(b=h.exec(a));){b.index>f&&e.push((0,d.jsx)("span",{className:"text-foreground",children:a.slice(f,b.index)},g++));let h=b[0];/^["']/.test(h)?e.push((0,d.jsx)("span",{className:"text-green-11",children:h},g++)):/^\d+$/.test(h)?e.push((0,d.jsx)("span",{className:"text-orange-11",children:h},g++)):c.test(h)?(c.lastIndex=0,e.push((0,d.jsx)("span",{className:"text-violet-11",children:h},g++))):e.push((0,d.jsx)("span",{className:"text-foreground",children:h},g++)),f=b.index+h.length}return f<a.length&&e.push((0,d.jsx)("span",{className:"text-foreground",children:a.slice(f)},g++)),e})(w),[w]);return(0,e.useEffect)(()=>{if(!s.current)return;let a=s.current,b=j.getBoundingClientRect(),d=a.getBoundingClientRect(),e=c-b.left,f=i-b.top;e+d.width>b.width-8&&(e=b.width-d.width-8),e<8&&(e=8),f+d.height>b.height-8&&(f=f-d.height-24),a.style.left=`${e}px`,a.style.top=`${f}px`},[c,i,j]),(0,d.jsxs)("div",{ref:s,className:"absolute z-[200] max-w-lg bg-card border border-border rounded-lg shadow-lv3 px-3 py-2 pointer-events-none",style:{left:u,top:v},children:[(0,d.jsx)("pre",{className:"font-mono text-xs whitespace-pre-wrap break-all leading-relaxed",children:x}),b&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"border-t border-border my-1"}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground whitespace-pre-wrap",children:b})]}),(m||n||o)&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"border-t border-border my-1.5"}),(0,d.jsxs)("div",{className:"flex items-center gap-3 pointer-events-auto",onMouseEnter:k,onMouseLeave:l,children:[m&&(0,d.jsx)("button",{onClick:m,className:"text-[11px] text-brand hover:underline cursor-pointer",children:r("hoverTooltip.findReferences")}),n&&(0,d.jsx)("button",{onClick:()=>n(h(a)),className:"text-[11px] text-brand hover:underline cursor-pointer",children:r("hoverTooltip.search")}),o&&(0,d.jsx)("button",{onClick:()=>o(h(a)),disabled:p,title:p?r("comments.aiResponding"):void 0,className:"text-[11px] text-brand hover:underline cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed disabled:no-underline",children:r("explain.action")})]})]})]})})},24680:(a,b,c)=>{"use strict";c.d(b,{l:()=>h});var d=c(48249),e=c(67484),f=c(44384),g=c(72529);function h({content:a,containerRef:b,width:c="w-80"}){let{t:i}=(0,f.Bd)(),j=(0,e.useMemo)(()=>(function(a){let b=[],c=a.split("\n"),d=!1;for(let a=0;a<c.length;a++){let e=c[a];if(e.trimStart().startsWith("```")){d=!d;continue}if(d)continue;let f=/^(#{1,6})\s+(.+)$/.exec(e);f&&b.push({level:f[1].length,text:f[2].replace(/\s*#+\s*$/,"").replace(/\\([!-\/:-@[-`{-~])/g,"$1"),sourceLine:a+1})}return b})(a),[a]),[k,l]=(0,e.useState)(!1),[m,n]=(0,e.useState)(null),o=(0,e.useCallback)(a=>{let c=b.current;if(!c)return;let d=c.querySelector(`h1[data-source-start="${a}"], h2[data-source-start="${a}"], h3[data-source-start="${a}"], h4[data-source-start="${a}"], h5[data-source-start="${a}"], h6[data-source-start="${a}"]`);d&&d.scrollIntoView({behavior:"smooth",block:"start"})},[b]);return 0===j.length?null:(0,d.jsxs)("div",{className:`border-r border-border flex-shrink-0 flex flex-col transition-[width] duration-200 ${k?"w-8":c}`,children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-2 py-1.5 border-b border-border flex-shrink-0",children:[!k&&(0,d.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:i("editor.toc")}),(0,d.jsx)("button",{onClick:()=>l(a=>!a),className:"p-0.5 text-muted-foreground hover:text-foreground hover:bg-hover rounded transition-colors",title:i(k?"editor.expandToc":"editor.collapseToc"),children:(0,d.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:k?(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"}):(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})})]}),!k&&(0,d.jsx)("nav",{className:"flex-1 overflow-y-auto py-1",children:j.map((a,b)=>(0,d.jsx)(g.m,{content:a.text,delay:400,children:(0,d.jsx)("button",{onClick:()=>o(a.sourceLine),className:`block w-full text-left text-sm py-1 px-2 truncate transition-colors hover:bg-hover ${m===a.sourceLine?"text-brand font-medium bg-brand/5":"text-muted-foreground"}`,style:{paddingLeft:`${(a.level-1)*12+8}px`},children:a.text})},b))})]})}},24724:(a,b,c)=>{"use strict";c.d(b,{h:()=>l});var d=c(48249),e=c(67484),f=c.n(e),g=c(36043),h=c(7122),i=c(61591);let j={M:{text:"text-amber-11",bg:"bg-amber-9/20"},A:{text:"text-green-11",bg:"bg-green-9/20"},D:{text:"text-red-11",bg:"bg-red-9/20"},R:{text:"text-blue-11",bg:"bg-blue-9/20"}},k=f().memo(function({item:a,isSelected:b,isExpanded:c,isLoading:f,onSelect:g,onToggle:h,onContextMenu:k,renderActions:l}){let{node:m,level:n,gitStatus:o,hasChangedChildren:p}=a,q=o?j[o]:null,r=(0,e.useCallback)(()=>{m.isDirectory?h(m.path):g(m.path)},[m.isDirectory,m.path,g,h]),s=(0,e.useCallback)(a=>{k(a,m.path,m.isDirectory)},[m.path,m.isDirectory,k]),t=!m.isDirectory&&(".env"===m.name||m.name.startsWith(".env.")),u=o?q.text:p?"text-amber-11":t?"text-yellow-600 dark:text-yellow-500":b&&!m.isDirectory?"text-brand":"text-foreground";return(0,d.jsxs)("div",{className:`flex items-center gap-1.5 py-0.5 px-2 cursor-pointer hover:bg-hover ${b?"bg-brand/10":""}`,style:{paddingLeft:`${12*n+8}px`},onClick:r,onContextMenu:s,children:[m.isDirectory?f?(0,d.jsxs)("svg",{className:"w-4 h-4 flex-shrink-0 text-muted-foreground animate-spin",viewBox:"0 0 16 16",fill:"none",children:[(0,d.jsx)("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5",opacity:"0.3"}),(0,d.jsx)("path",{d:"M14 8a6 6 0 0 0-6-6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}):(0,d.jsx)("svg",{className:`w-4 h-4 flex-shrink-0 text-muted-foreground transition-transform ${c?"rotate-90":""}`,viewBox:"0 0 16 16",fill:"none",children:(0,d.jsx)("path",{d:"M6 4 L10 8 L6 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}):(0,d.jsx)(i.o,{name:m.name,size:16,className:"flex-shrink-0 ml-4"}),(0,d.jsx)("span",{className:`text-sm truncate flex-1 ${u}`,"data-tooltip":m.isSymlink&&m.symlinkTarget?`${m.path} → ${m.symlinkTarget}`:m.path,children:m.name}),m.isSymlink&&(0,d.jsx)("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:"→"}),o&&(0,d.jsx)("span",{className:`text-xs font-mono px-1 rounded ${q.text} ${q.bg} flex-shrink-0`,children:o}),m.isDirectory&&p&&(0,d.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-9 flex-shrink-0"}),l?.(m)]})});function l({files:a,selectedPath:b,expandedPaths:c,matchedPaths:f=null,gitStatusMap:i=null,loadingDirs:j,onSelect:m,onToggle:n,cwd:o,shouldScrollToSelected:p=!1,onScrolledToSelected:q,className:r,renderActions:s,onCreateFile:t,onDelete:u,onRefresh:v,onCopyFile:w,onPaste:x,onExplain:y,explainDisabled:z}){let A=(0,e.useRef)(null),{contextMenu:B,showContextMenu:C,hideContextMenu:D}=(0,h.Ee)(),E=(0,e.useMemo)(()=>(function a(b,c,d,e=null,f=0){let g=[];for(let h of b){if(null!==d&&!d.has(h.path))continue;let b=e?.get(h.path),i=h.isDirectory?function(a,b){if(!b)return!1;let c=a+"/";for(let a of b.keys())if(a.startsWith(c))return!0;return!1}(h.path,e):void 0;g.push({node:h,level:f,gitStatus:b,hasChangedChildren:i}),h.isDirectory&&h.children&&c.has(h.path)&&g.push(...a(h.children,c,d,e,f+1))}return g})(a,c,f,i),[a,c,f,i]),F=(0,g.Te)({count:E.length,getScrollElement:()=>A.current,estimateSize:()=>26,overscan:10});return((0,e.useRef)(q).current=q,0===E.length)?(0,d.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:"No files"}):(0,d.jsxs)("div",{ref:A,className:r||"h-full overflow-y-auto",style:{willChange:"transform"},children:[(0,d.jsx)("div",{style:{height:`${F.getTotalSize()}px`,width:"100%",position:"relative"},children:F.getVirtualItems().map(a=>{let e=E[a.index];return(0,d.jsx)("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:`${a.size}px`,transform:`translateY(${a.start}px)`},children:(0,d.jsx)(k,{item:e,isSelected:b===e.node.path,isExpanded:c.has(e.node.path),isLoading:j?.has(e.node.path),onSelect:m,onToggle:n,onContextMenu:C,renderActions:s})},e.node.path)})}),B&&(0,d.jsx)(h.ft,{x:B.x,y:B.y,path:B.path,cwd:o,isDirectory:B.isDirectory,onClose:D,onCreateFile:t,onDelete:u,onRefresh:v,onCopyFile:w,onPaste:x,onExplain:y,explainDisabled:z})]})}},24943:(a,b,c)=>{"use strict";c.d(b,{NoteModal:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call NoteModal() from the server but NoteModal is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/NoteModal.tsx","NoteModal")},25414:(a,b,c)=>{"use strict";function d(a,b,c){return b?a?c?`${a.replace(/\n+$/,"")}
39
39
 
40
- ${b}`:a+b:b:a}function e(a,b,c=!1){let d=a||[];if(!b)return d;let f=d[d.length-1];return c||f?.type!=="text"?[...d,{type:"text",text:b}]:[...d.slice(0,-1),{type:"text",text:f.text+b}]}function f(a,b,c){let{engine:f,assistantId:g}=c;if("stream_event"===b.type){let c=b.event;if(c?.type==="content_block_delta"&&c.delta?.type==="text_delta"&&c.delta.text){let b=c.delta.text;return a.map(a=>a.id===g?{...a,content:d(a.content||"",b,!!a.pendingTextBreak),parts:e(a.parts,b,!!a.pendingTextBreak),pendingTextBreak:!1}:a)}return a}if("assistant"===b.type){let c=b.message?.content;if(!Array.isArray(c))return a;let h=a,i=b.message?.model==="<synthetic>";if("codex"===f||"ollama"===f||i){let a=c.filter(a=>"text"===a.type&&a.text).map(a=>a.text).join("");a&&(h=h.map(b=>b.id===g?{...b,content:d(b.content||"",a,!!b.pendingTextBreak),parts:e(b.parts,a,!!b.pendingTextBreak),pendingTextBreak:!1}:b))}for(let a of c)if(a.name){let b={id:a.id||`tool-${g}-${a.name}`,name:a.name,input:a.input||{},isLoading:!0};h=h.map(a=>a.id!==g||a.toolCalls?.some(a=>a.id===b.id)?a:{...a,toolCalls:[...a.toolCalls||[],b],parts:function(a,b){let c=a||[];return c.some(a=>"tool"===a.type&&a.id===b)?c:[...c,{type:"tool",id:b}]}(a.parts,b.id),pendingTextBreak:!0})}return h}if("user"===b.type){let c=b.message?.content;if(!Array.isArray(c))return a;let d=a;for(let a of c)if(a.tool_use_id){let b=a.tool_use_id,c="string"==typeof a.content?a.content:JSON.stringify(a.content);d=d.map(a=>a.id===g?{...a,toolCalls:a.toolCalls?.map(a=>a.id===b?{...a,result:c,isLoading:!1}:a)}:a)}return d}if("error"===b.type){let c=b.error||"An error occurred. Please try again.",f=`⚠️ ${c}`;return a.map(a=>a.id===g?{...a,content:d(a.content||"",f,!0),parts:e(a.parts,f,!0),isStreaming:!1}:a)}if("result"===b.type){let c="string"==typeof b.result?b.result.trim():"";return a.map(a=>a.id===g?{...a,content:!a.content&&c?c:a.content,parts:!a.content&&c?e(a.parts,c):a.parts,isStreaming:!1,toolCalls:a.toolCalls?.map(a=>({...a,isLoading:!1}))}:a)}return a}c.d(b,{F:()=>f})},25419:(a,b,c)=>{"use strict";c.d(b,{K:()=>f});var d=c(79606),e=c(71192);let f=(a,b)=>{let c,f;return c=`/api/files/text?cwd=${encodeURIComponent(a)}&path=${encodeURIComponent(b)}`,f={cache:"no-store"},d.tryPromise({try:async()=>{let a=await fetch(c,f),b=null;try{b=await a.json()}catch{}return{status:a.status,ok:a.ok,data:b}},catch:a=>new e.uV({message:`GET ${c} failed`,cause:a})})}},25608:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{ProjectItem:()=>n});var e=c(48249),f=c(67484),g=c(44384),h=c(33281),i=c(40311),j=c(29939),k=c(85655);function l({number:a,status:b,isActive:c}){return(0,e.jsx)("span",{className:`flex h-[18px] w-[18px] flex-shrink-0 items-center justify-center rounded-[4px] border font-mono text-[10px] font-medium leading-none tabular-nums transition-colors ${(0,i.c)(b,c)}`,"aria-hidden":"true",children:a})}function m({badge:a,onSelect:b}){return(0,e.jsx)("button",{type:"button",onClick:c=>{c.stopPropagation(),b(a.sessionId)},className:`flex h-4 w-4 flex-shrink-0 items-center justify-center rounded-full border font-mono text-[9px] font-medium leading-none tabular-nums transition-transform hover:scale-125 ${(0,i.c)(a.status,!1)}`,title:a.label,children:a.label})}let a=[],o=()=>{};function n({index:b,name:c,cwd:d,isActive:i,collapsed:p,hasUnread:q,isLoading:r,sessionBadges:s,onClick:t,onSelectSession:u,onRemove:v,onOpenNote:w}){let{t:x}=(0,g.Bd)(),[y,z]=(0,f.useState)(!1),[A,B]=(0,f.useState)(null),C=(0,f.useCallback)(()=>{h.t4.runPromiseExit((0,k.ue)(d)).then(a=>{"Success"===a._tag&&B(a.value.branch)})},[d]),D=(0,f.useCallback)(a=>{a?.type==="watch"&&Array.isArray(a.data)&&a.data.some(a=>"git"===a.type)&&C()},[C]);(0,j.h)({url:`/ws/watch?cwd=${encodeURIComponent(d)}`,onMessage:D});let E=s??a,F=A?p?`${c} \xb7 ${A}`:A:d;return(0,e.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1 rounded-lg cursor-pointer transition-colors relative ${p?"justify-center":""} ${i?"bg-accent text-foreground":"text-muted-foreground hover:bg-secondary hover:text-foreground"}`,onClick:t,onMouseEnter:()=>z(!0),onMouseLeave:()=>z(!1),"data-tooltip":F,children:[(0,e.jsx)(l,{number:b+1,status:p?r?"loading":q&&!i?"unread":"normal":"normal",isActive:i}),!p&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:`flex-1 truncate text-sm ${i?"text-brand":""}`,children:c}),y&&(0,e.jsxs)("div",{className:"flex items-center gap-0.5 flex-shrink-0",children:[w&&(0,e.jsx)("button",{className:"p-1 rounded hover:bg-hover text-muted-foreground hover:text-foreground transition-colors",onClick:a=>{a.stopPropagation(),w()},title:x("workspace.projectNotes"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),(0,e.jsx)("button",{className:"p-1 rounded hover:bg-red-500/20 text-muted-foreground hover:text-red-11 transition-colors",onClick:a=>{a.stopPropagation(),v()},title:x("workspace.closeProject"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),E.length>0?(0,e.jsx)("div",{className:"flex items-center gap-1 flex-shrink-0",children:E.map(a=>(0,e.jsx)(m,{badge:a,onSelect:u??o},a.sessionId))}):i?(0,e.jsx)("span",{className:"w-2 h-2 rounded-full bg-brand flex-shrink-0"}):null]})]})}d()}catch(a){d(a)}})},25667:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{r:()=>j});var e=c(48249),f=c(67484),g=c(83721);c(33281),c(85655);var h=c(17966),i=a([h]);function j({cwd:a,filePath:b,oldContent:c,newContent:d,isNew:h=!1,isDeleted:i=!1,changedFiles:k,fileGitStatusMap:l,enableComments:m=!1,compact:n=!0,onContentSearch:o,onSwitchToCode:p,headerExtraLeft:q,headerExtraRight:r}){let[s,t]=(0,f.useState)(b),[u,v]=(0,f.useState)(null);return(0,e.jsx)(g.O,{cwd:a,highlightedFilePath:b,changedFiles:k,enableComments:m,qnameFilter:n?u?.changedQnames:void 0,qnameFilterFile:s,accentQnames:u?.changedQnames,accentFile:s,addedLines:u?.addedLines,addedLinesFile:s,onFocalChange:a=>a&&t(a),onContentSearch:o,onSwitchToCode:p,headerExtraLeft:q,headerExtraRight:r})}h=(i.then?(await i)():i)[0],d()}catch(a){d(a)}})},25702:(a,b,c)=>{"use strict";c.d(b,{Providers:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call Providers() from the server but Providers is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/Providers.tsx","Providers")},26362:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{T:()=>q});var e=c(48249),f=c(67484),g=c(74429),h=c(74754),i=c(91579),j=c(208),k=c(7122),l=c(7031),m=c(41051),n=c(42140),o=c(70596),p=c(37690);function q({cwd:a,enableComments:b=!1,filePath:c,diffLines:d,containerEl:r,onContentSearch:s}){let t=(0,k.iN)(),u=(0,l.r)(),v=b&&!!a,{comments:w,addComment:x,updateComment:y,deleteComment:z,refresh:A}=(0,h._)({cwd:a||"",filePath:c}),[B,C]=(0,f.useState)(null),{toolbarRef:D,bumpRef:E,clearToolbar:F}=(0,p.L)({enabled:v,container:r,resolveLineRange:a=>{if(!document.contains(a))return null;let b=a.nodeType===Node.TEXT_NODE?a.parentElement:a,c=b?.closest("[data-new-line]");if(!c)return null;let d=parseInt(c.getAttribute("data-new-line")||"0",10);return!Number.isFinite(d)||d<=0?null:{start:d,end:d}},buildLineSnapshot:({start:a,end:b})=>{let c=[],e=0;for(let f of d)("unchanged"===f.type||"added"===f.type)&&++e>=a&&e<=b&&c.push(f.content);return c.join("\n")}}),[G,H]=(0,f.useState)(null),[I,J]=(0,f.useState)(null),[K,L]=(0,f.useState)(!1),M=(0,f.useMemo)(()=>{let a=new Set;for(let b of w)for(let c=b.startLine;c<=b.endLine;c++)a.add(c);return a},[w]),N=(0,f.useMemo)(()=>{let a=new Map;for(let b of w){let c=b.endLine;a.has(c)||a.set(c,[]),a.get(c).push(b)}return a},[w]),O=(0,f.useCallback)((a,b)=>{b.stopPropagation(),C({comment:a,x:b.clientX,y:b.clientY}),F(),H(null),J(null)},[F]),P=(0,f.useCallback)(()=>{let a=D.current;a&&(H({x:a.x,y:a.y,range:a.range,selectedText:a.selectedText,lineSnapshot:a.lineSnapshot}),F())},[F,D]),Q=(0,f.useCallback)(()=>{let a=D.current;a&&(J({x:a.x,y:a.y,range:a.range,selectedText:a.selectedText,lineSnapshot:a.lineSnapshot}),F())},[F,D]),R=(0,f.useCallback)(()=>{let a=D.current;a&&u&&(F(),(0,i.Ff)(u.sendMessage,{filePath:c,startLine:a.range.start,endLine:a.range.end,codeContent:a.lineSnapshot},j.A.t("explain.selectionMessage")))},[u,c,F,D]),S=(0,f.useCallback)(()=>{let a=D.current;if(!a||!s)return;let b=a.selectedText.trim();F(),b&&s(b)},[s,F,D]),T=(0,f.useCallback)(async(b,d)=>{if(u&&a)try{let e=await (0,i.$3)(a),f=[];for(let a of e)f.push({filePath:a.filePath,startLine:a.startLine,endLine:a.endLine,codeContent:a.codeContent,note:a.content||void 0});f.push({filePath:c,startLine:b.range.start,endLine:b.range.end,codeContent:b.lineSnapshot});let g=(0,i.Gw)(f,d);u.sendMessage(g),await (0,i.RP)(a),A()}catch(a){console.error("Failed to send to AI:",a)}},[u,c,a,A]),U=(0,f.useCallback)(a=>{I&&T(I,a)},[I,T]),V=(0,f.useCallback)(a=>{G&&T(G,a)},[G,T]),W=(0,f.useCallback)(async a=>{G&&(await x(G.range.start,G.range.end,a,G.selectedText),H(null))},[G,x]),X=K&&t?(0,g.createPortal)((0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(m.fS,{floatingToolbarRef:D,bumpRef:E,container:t,onAddComment:P,onSendToAI:Q,onSearch:s?S:void 0,onExplain:u?R:void 0,isChatLoading:u?.isLoading??!1}),G&&(0,e.jsx)(n.t,{x:G.x,y:G.y,range:G.range,filePath:c,lineSnapshot:G.lineSnapshot,container:t,onSubmit:W,onSendToAI:u?V:void 0,onClose:()=>H(null),isChatLoading:u?.isLoading}),I&&(0,e.jsx)(n.G,{x:I.x,y:I.y,range:I.range,filePath:c,lineSnapshot:I.lineSnapshot,container:t,onSubmit:U,onClose:()=>J(null),isChatLoading:u?.isLoading}),B&&(0,e.jsx)(o.t,{x:B.x,y:B.y,comment:B.comment,container:t,onClose:()=>C(null),onUpdateComment:y,onDeleteComment:z})]}),t):null;return{commentsEnabled:v,linesWithComments:M,commentsByEndLine:N,handleCommentBubbleClick:O,addCommentRange:G?.range??null,sendToAIRange:I?.range??null,commentPortal:X}}d()}catch(a){d(a)}})},28602:(a,b,c)=>{"use strict";function d(){return!("u"<typeof navigator)&&(/Mac|iPhone|iPad/.test(navigator.platform||"")||navigator.userAgentData?.platform==="macOS")}function e(){return d()?"⌘":"Ctrl+"}c.d(b,{L:()=>d,Mu:()=>e}),process.platform,process.platform,process.platform},28797:(a,b,c)=>{"use strict";function d(a){let b=a.split(".").pop()?.toLowerCase();return b?["ts","tsx","js","jsx","mjs","cjs"].includes(b)?"typescript":["py","pyi"].includes(b)?"python":null:null}c.d(b,{c:()=>d})},29412:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{g:()=>o});var e=c(48249),f=c(67484),g=c(44384),h=c(7833),i=c(15819),j=c(77156),k=c(59336),l=c(2633),m=c(33281),n=a([l]);function o({isOpen:a,onClose:b}){let{t:c,i18n:d}=(0,g.Bd)(),[n,q]=(0,f.useState)([]),[r,s]=(0,f.useState)(!1),[t,u]=(0,f.useState)(""),[v,w]=(0,f.useState)(!1),[x,y]=(0,f.useState)(""),[z,A]=(0,f.useState)(!1),[B,C]=(0,f.useState)(null),D=(0,f.useRef)(null),E=(0,f.useCallback)(async()=>{s(!0);let a=await m.t4.runPromiseExit((0,j.Hy)());"Success"===a._tag?q(a.value):console.error("Failed to load skills",a.cause),s(!1)},[]),F=(0,f.useMemo)(()=>{let a=t.trim().toLowerCase();return a?n.filter(b=>b.name.toLowerCase().includes(a)||b.description.toLowerCase().includes(a)||b.path.toLowerCase().includes(a)):n},[n,t]),G=d.resolvedLanguage?.startsWith("zh")?"https://opencockpit.dev/zh/docs/agent/skills/":"https://opencockpit.dev/en/docs/agent/skills/",H=(0,f.useCallback)(async()=>{let a=x.trim();if(!a)return;A(!0);let b=await m.t4.runPromiseExit((0,j.L5)(a));if("Success"===b._tag)(0,h.oR)(b.value.alreadyExists?c("skills.alreadyAdded"):c("skills.added"),b.value.alreadyExists?"info":"success"),y(""),w(!1),await E(),b.value.alreadyExists||(0,k.k)();else{let a="Fail"===b.cause._tag?b.cause.error:null,d=a?.cause,e=d instanceof Error?d.message:c("skills.addFailed");(0,h.oR)(e,"error")}A(!1)},[x,E,c]),I=(0,f.useCallback)(async a=>{let b=await m.t4.runPromiseExit((0,j.hp)(a));"Success"===b._tag?(q(b=>b.filter(b=>b.id!==a)),(0,k.k)()):(0,h.oR)(c("common.deleteFailed"),"error")},[c]),J=(0,f.useCallback)(async a=>{try{await navigator.clipboard.writeText(a),(0,h.oR)(c("common.copiedPath"),"success")}catch{(0,h.oR)(c("common.copyFailed"),"error")}},[c]);return a?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,e.jsx)("div",{className:"absolute inset-0 bg-scrim",onClick:b}),(0,e.jsxs)("div",{className:i.aO,children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border flex-shrink-0",children:[(0,e.jsx)("h2",{className:"text-sm font-medium text-foreground",children:c("skills.title")}),(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsx)("input",{ref:D,type:"text",value:t,onChange:a=>u(a.target.value),placeholder:c("skills.searchPlaceholder"),className:"px-2 py-1 pr-6 text-xs border border-border rounded bg-card text-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent"}),t&&(0,e.jsx)("button",{onClick:()=>{u(""),D.current?.focus()},className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-foreground-subtle hover:text-foreground rounded-sm transition-colors",title:c("skills.clearSearch"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsxs)("button",{onClick:()=>w(!0),className:"flex items-center gap-1.5 px-2.5 py-1 text-xs rounded-md border border-border text-muted-foreground hover:text-foreground hover:bg-hover transition-colors",children:[(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),c("skills.addSkill")]}),(0,e.jsx)("button",{onClick:b,className:"p-1 text-foreground-subtle hover:text-foreground hover:bg-hover rounded transition-colors",title:c("common.close"),children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),(0,e.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:r?(0,e.jsx)("div",{className:"text-center text-muted-foreground py-8 text-sm",children:c("common.loading")}):0===F.length?(0,e.jsx)("div",{className:"text-center text-muted-foreground py-8 text-sm space-y-2",children:0===n.length?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("p",{children:c("skills.emptyNoSkills")}),(0,e.jsxs)("p",{children:[c("skills.emptyIntroPrefix")," ",(0,e.jsx)("code",{className:"px-1.5 py-0.5 rounded bg-muted text-foreground font-mono text-xs",children:"/skillify"})," ",c("skills.emptyIntroSuffix")]}),(0,e.jsxs)("p",{children:[(0,e.jsx)("button",{type:"button",onClick:()=>w(!0),className:"text-brand hover:underline",children:c("skills.addSkill")})," \xb7 ",(0,e.jsx)("a",{href:G,target:"_blank",rel:"noreferrer",className:"text-brand hover:underline",children:c("skills.viewDocs")})]})]}):c("skills.emptyNoMatch")}):(0,e.jsx)("div",{className:i.jL,children:F.map(a=>(0,e.jsx)(p,{skill:a,onPreview:()=>C(a.id),onDelete:()=>I(a.id),onCopyPath:()=>J(a.path)},a.id))})})]})]}),v&&(0,e.jsxs)("div",{className:"fixed inset-0 z-[60] flex items-center justify-center",children:[(0,e.jsx)("div",{className:"absolute inset-0 bg-scrim",onClick:()=>{z||(w(!1),y(""))}}),(0,e.jsxs)("div",{className:"relative bg-card rounded-lg shadow-lv3 w-full max-w-lg mx-4 p-5",children:[(0,e.jsx)("h3",{className:"text-sm font-medium text-foreground mb-3",children:c("skills.addSkill")}),(0,e.jsx)("label",{className:"block text-xs text-muted-foreground mb-1",children:c("skills.pathLabel")}),(0,e.jsx)("input",{type:"text",value:x,onChange:a=>y(a.target.value),onKeyDown:a=>{"Enter"!==a.key||z||H()},placeholder:c("skills.pathPlaceholder"),autoFocus:!0,className:"w-full px-3 py-2 text-sm font-mono border border-border rounded-md bg-card text-foreground focus:outline-none focus:ring-2 focus:ring-ring"}),(0,e.jsxs)("div",{className:"flex justify-end gap-2 mt-4",children:[(0,e.jsx)("button",{onClick:()=>{w(!1),y("")},disabled:z,className:"px-3 py-1.5 text-sm rounded-md border border-border text-muted-foreground hover:text-foreground hover:bg-hover transition-colors disabled:opacity-50",children:c("common.cancel")}),(0,e.jsx)("button",{onClick:H,disabled:z||!x.trim(),className:"px-3 py-1.5 text-sm rounded-md bg-brand text-white hover:bg-teal-10 transition-colors disabled:opacity-50",children:z?c("skills.adding"):c("skills.add")})]})]})]}),B&&(0,e.jsx)(l.d,{skillId:B,onClose:()=>C(null)})]}):null}function p({skill:a,onPreview:b,onDelete:c,onCopyPath:d}){let{t:h}=(0,g.Bd)(),[i,j]=(0,f.useState)(!1);return(0,e.jsxs)("div",{className:`group flex flex-col h-full border border-border rounded-lg p-3 hover:border-brand hover:shadow-lv2 transition-all ${a.valid?"":"opacity-60"}`,children:[(0,e.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,e.jsx)("div",{className:"w-9 h-9 flex-shrink-0 flex items-center justify-center rounded-md bg-brand/10 text-brand text-lg",children:a.icon?(0,e.jsx)("span",{children:a.icon}):(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 3l1.9 4.8L19 9l-4.1 3.1L16 18l-4-2.8L8 18l1.1-5.9L5 9l5.1-1.2L12 3z"})})}),(0,e.jsxs)("span",{className:"font-mono text-sm font-medium text-foreground truncate flex-1 min-w-0","data-tooltip":`/${a.name}`,children:["/",a.name]}),!a.valid&&(0,e.jsx)("span",{className:"flex-shrink-0 text-xs px-1.5 py-0.5 rounded bg-red-9/15 text-red-11",children:h("skills.invalid")}),(0,e.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0 opacity-0 group-hover:opacity-100 focus-within:opacity-100 transition-opacity",children:[(0,e.jsx)("button",{onClick:b,disabled:!a.valid,className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-hover rounded transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:h("common.preview"),children:(0,e.jsxs)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]})}),i?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{onClick:()=>{j(!1),c()},className:"px-2 py-1 text-xs rounded bg-red-9 text-white hover:bg-red-10",children:h("common.confirm")}),(0,e.jsx)("button",{onClick:()=>j(!1),className:"px-2 py-1 text-xs rounded border border-border text-muted-foreground hover:text-foreground",children:h("common.cancel")})]}):(0,e.jsx)("button",{onClick:()=>j(!0),className:"p-1.5 text-muted-foreground hover:text-red-11 hover:bg-red-9/10 rounded transition-colors",title:h("common.delete"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6M1 7h22M9 7V4a1 1 0 011-1h4a1 1 0 011 1v3"})})})]})]}),(0,e.jsxs)("div",{className:"font-mono text-xs text-muted-foreground mt-2 break-all",children:[a.path,(0,e.jsx)("button",{onClick:d,className:"inline-flex align-middle ml-1 p-0.5 hover:text-foreground hover:bg-hover rounded transition-colors",title:h("skills.copyPath"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground mt-2 pt-2 border-t border-border/60 break-words whitespace-pre-wrap",children:a.description||(0,e.jsx)("span",{className:"italic opacity-60",children:h("skills.noDescription")})}),a.argumentHint&&(0,e.jsx)("div",{className:"font-mono text-xs text-muted-foreground mt-1 truncate","data-tooltip":a.argumentHint,children:a.argumentHint})]})}l=(n.then?(await n)():n)[0],d()}catch(a){d(a)}})},29491:(a,b,c)=>{"use strict";c.d(b,{I18nProvider:()=>g});var d=c(48249);c(67484);var e=c(44384),f=c(208);function g({children:a}){return(0,d.jsx)(e.xC,{i18n:f.A,children:a})}c(33281),c(65484)},29939:(a,b,c)=>{"use strict";c.d(b,{D:()=>h,h:()=>i});var d=c(67484),e=c(88055),f=c(21586);e.EV(f.YA(1),1.5).pipe(e.gP(e.ji(f.YA(10))),e.y$(e.t5(10))),e.EV(f.ne(200),2).pipe(e.gP(e.ji(f.YA(5))),e.y$(e.t5(5))),e.EV(f.YA(1),2).pipe(e.et,e.gP(e.ji(f.YA(30))),e.y$(e.t5(8))),e.ji(f.YA(30)),e.ji(f.YA(1)),e.ji(f.YA(30)),f.ne(50),e.BW;let g=new Set;function h(a){return g.add(a),()=>{g.delete(a)}}function i({url:a,onMessage:b,enabled:c=!0}){(0,d.useRef)(b)}},30337:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,15098,23)),Promise.resolve().then(c.t.bind(c,47644,23)),Promise.resolve().then(c.t.bind(c,33859,23)),Promise.resolve().then(c.t.bind(c,98099,23)),Promise.resolve().then(c.t.bind(c,16237,23)),Promise.resolve().then(c.t.bind(c,98562,23)),Promise.resolve().then(c.t.bind(c,36675,23))},30458:(a,b,c)=>{"use strict";c.d(b,{E:()=>j});var d=c(48249),e=c(67484),f=c(44384),g=c(208),h=c(28602);let i={once:[{labelKey:"scheduledTasks.5minLater",value:5},{labelKey:"scheduledTasks.15minLater",value:15},{labelKey:"scheduledTasks.30minLater",value:30},{labelKey:"scheduledTasks.1hourLater",value:60}],interval:[{labelKey:"scheduledTasks.every15min",value:15},{labelKey:"scheduledTasks.every30min",value:30},{labelKey:"scheduledTasks.every1hour",value:60},{labelKey:"scheduledTasks.every2hours",value:120}],cron:[{labelKey:"scheduledTasks.daily9am",value:"0 9 * * *"},{labelKey:"scheduledTasks.daily6pm",value:"0 18 * * *"},{labelKey:"scheduledTasks.weeklyMon9am",value:"0 9 * * 1"},{labelKey:"scheduledTasks.monthly1st9am",value:"0 9 1 * *"}]};function j({onClose:a,onCreate:b,editTask:c,onUpdate:k}){let{t:l}=(0,f.Bd)(),m=!!c,[n,o]=(0,e.useState)(c?.type||"once"),[p,q]=(0,e.useState)(c?.message||""),[r,s]=(0,e.useState)(c?.taskFile?"file":"message"),[t,u]=(0,e.useState)(c?.taskFile||""),[v,w]=(0,e.useState)(c?String(c.delayMinutes||c.intervalMinutes||""):""),[x,y]=(0,e.useState)(c?.cron||""),[z,A]=(0,e.useState)(c?.activeFrom||"09:00"),[B,C]=(0,e.useState)(c?.activeTo||"18:00"),[D,E]=(0,e.useState)(!!(c?.activeFrom&&c?.activeTo)),[F,G]=(0,e.useState)(null),H=(0,e.useRef)(null),I=(0,e.useRef)(null),J=(0,e.useCallback)(()=>{let d="file"===r,e=d?{message:"",taskFile:t.trim()}:{message:p.trim(),taskFile:""};if(d?!e.taskFile:!e.message)return;let f=null;if("once"===n){let a=F||parseInt(v,10);if(!a||a<=0)return;f={...e,type:"once",delayMinutes:a}}else if("interval"===n){let a=F||parseInt(v,10);if(!a||a<=0)return;f={...e,type:"interval",intervalMinutes:a,...D?{activeFrom:z,activeTo:B}:{}}}else if("cron"===n){let a=F||x.trim();if(!a)return;f={...e,type:"cron",cron:a}}f&&(m&&c&&k?k(c.id,f):b(f),a())},[p,r,t,n,F,v,x,D,z,B,b,a,m,c,k]);return(0,d.jsxs)("div",{ref:H,className:`w-[28rem] max-w-[calc(100vw-1.5rem)] bg-popover border border-border rounded-lg shadow-lv2 z-50 ${m?"":"absolute bottom-full left-0 mb-2"}`,onKeyDown:b=>{"Escape"===b.key?a():"Enter"===b.key&&(b.metaKey||b.ctrlKey)&&J()},children:[(0,d.jsx)("div",{className:"px-3 py-2 border-b border-border bg-muted/50 rounded-t-lg",children:(0,d.jsx)("span",{className:"text-sm font-medium",children:m?l("scheduledTasks.editTask"):l("scheduledTasks.createTask")})}),(0,d.jsxs)("div",{className:"p-4 space-y-4 max-h-[min(52rem,calc(100vh-3rem))] overflow-y-auto",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"flex gap-1 mb-1.5",children:["message","file"].map(a=>(0,d.jsx)("button",{onClick:()=>s(a),className:`px-2 py-1 text-xs rounded transition-colors ${r===a?"bg-brand text-white":"bg-muted text-muted-foreground hover:text-foreground"}`,children:"message"===a?l("scheduledTasks.sendMessage"):l("scheduledTasks.taskFile")},a))}),"message"===r?(0,d.jsx)("textarea",{ref:I,value:p,onChange:a=>q(a.target.value),placeholder:l("scheduledTasks.messagePlaceholder"),rows:5,className:"w-full px-2 py-1.5 text-sm border border-border rounded bg-card text-foreground focus:outline-none focus:ring-1 focus:ring-ring resize-y min-h-[6rem]"}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("input",{type:"text",value:t,onChange:a=>u(a.target.value),placeholder:l("scheduledTasks.taskFilePlaceholder"),className:"w-full px-2 py-1.5 text-sm font-mono border border-border rounded bg-card text-foreground focus:outline-none focus:ring-1 focus:ring-ring"}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:l("scheduledTasks.taskFileHint")})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-muted-foreground mb-1 block",children:l("scheduledTasks.type")}),(0,d.jsx)("div",{className:"flex gap-1",children:["once","interval","cron"].map(a=>(0,d.jsx)("button",{onClick:()=>{o(a),G(null),w(""),y("")},className:`flex-1 px-2 py-1 text-xs rounded transition-colors ${n===a?"bg-brand text-white":"bg-muted text-muted-foreground hover:text-foreground"}`,children:"once"===a?l("scheduledTasks.once"):"interval"===a?l("scheduledTasks.interval"):"Cron"},a))})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-muted-foreground mb-1 block",children:l("scheduledTasks.quickSelect")}),(0,d.jsx)("div",{className:"grid grid-cols-2 gap-1",children:i[n].map(a=>(0,d.jsx)("button",{onClick:()=>{G(a.value),"cron"===n?y(String(a.value)):w(String(a.value))},className:`px-2 py-1 text-xs rounded border transition-colors ${F===a.value?"border-brand bg-brand/10 text-brand":"border-border text-muted-foreground hover:text-foreground hover:border-foreground/30"}`,children:l(a.labelKey)},a.labelKey))})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-muted-foreground mb-1 block",children:"cron"===n?l("scheduledTasks.customCron"):l("scheduledTasks.customMinutes")}),"cron"===n?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("input",{type:"text",value:x,onChange:a=>{y(a.target.value),G(null)},placeholder:l("scheduledTasks.cronPlaceholder"),className:"w-full px-2 py-1.5 text-sm border border-border rounded bg-card text-foreground focus:outline-none focus:ring-1 focus:ring-ring font-mono"}),x.trim()&&(0,d.jsx)("div",{className:"mt-1 text-xs text-muted-foreground",children:function(a){let b=g.A.t,c=a.trim().split(/\s+/);if(5!==c.length)return null;let[d,e,f,h,i]=c,j={0:b("cron.dowSun"),1:b("cron.dowMon"),2:b("cron.dowTue"),3:b("cron.dowWed"),4:b("cron.dowThu"),5:b("cron.dowFri"),6:b("cron.dowSat")},k={1:`1${b("cron.monthPrefix")}`,2:`2${b("cron.monthPrefix")}`,3:`3${b("cron.monthPrefix")}`,4:`4${b("cron.monthPrefix")}`,5:`5${b("cron.monthPrefix")}`,6:`6${b("cron.monthPrefix")}`,7:`7${b("cron.monthPrefix")}`,8:`8${b("cron.monthPrefix")}`,9:`9${b("cron.monthPrefix")}`,10:`10${b("cron.monthPrefix")}`,11:`11${b("cron.monthPrefix")}`,12:`12${b("cron.monthPrefix")}`};try{let a="";if(d.includes("/")||e.includes("/")){if("*"===e&&d.includes("/"))return b("cron.everyNMinutes",{n:d.split("/")[1]});if("0"===d&&e.includes("/"))return b("cron.everyNHours",{n:e.split("/")[1]});return null}let c=parseInt(e,10),g=parseInt(d,10);if(isNaN(c)&&"*"!==e||isNaN(g)&&"*"!==d)return null;a="*"===e&&"*"===d?b("cron.everyMinute"):"*"===e?b("cron.everyHourAtMin",{m:g}):"*"===d?b("cron.hourlyEveryMin",{h:c}):`${String(c).padStart(2,"0")}:${String(g).padStart(2,"0")}`;let l=[];if("*"!==h){let a=h.split(",").map(a=>k[a]||`${a}${b("cron.monthPrefix")}`);l.push(a.join(", "))}if("*"!==f)if(f.includes("-")){let[a,c]=f.split("-");l.push(b("cron.dayRange",{a,b:c}))}else f.includes(",")?l.push(f.split(",").map(a=>`${a}${b("cron.dayOfMonth")}`).join(", ")):l.push(`${f}${b("cron.dayOfMonth")}`);if("*"!==i)if("1-5"===i)l.push(b("cron.weekdays"));else if("0,6"===i||"6,0"===i)l.push(b("cron.weekends"));else{let a=i.split(",").map(a=>{if(a.includes("-")){let[c,d]=a.split("-");return b("cron.weekdayRange",{a:j[c]||c,b:j[d]||d})}return`${b("cron.weekdayPrefix")}${j[a]||a}`});l.push(a.join(", "))}if(0===l.length&&"*"===f&&"*"===h&&"*"===i)return b("cron.daily",{time:a});return`${l.join(" ")} ${a}`}catch{return null}}(x.trim())||(0,d.jsx)("span",{className:"text-destructive",children:l("scheduledTasks.cronFormat")})})]}):(0,d.jsx)("input",{type:"number",value:v,onChange:a=>{w(a.target.value),G(null)},placeholder:l("scheduledTasks.minutesPlaceholder"),min:1,className:"w-full px-2 py-1.5 text-sm border border-border rounded bg-card text-foreground focus:outline-none focus:ring-1 focus:ring-ring"})]}),"interval"===n&&(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"flex items-center gap-2 text-xs text-muted-foreground mb-1 cursor-pointer",children:[(0,d.jsx)("input",{type:"checkbox",checked:D,onChange:a=>E(a.target.checked),className:"rounded border-border"}),l("scheduledTasks.limitTimeRange")]}),D&&(0,d.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,d.jsx)("input",{type:"time",value:z,onChange:a=>A(a.target.value),className:"flex-1 px-2 py-1 text-sm border border-border rounded bg-card text-foreground focus:outline-none focus:ring-1 focus:ring-ring"}),(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:l("scheduledTasks.to")}),(0,d.jsx)("input",{type:"time",value:B,onChange:a=>C(a.target.value),className:"flex-1 px-2 py-1 text-sm border border-border rounded bg-card text-foreground focus:outline-none focus:ring-1 focus:ring-ring"})]})]}),(0,d.jsx)("button",{onClick:J,disabled:!(("file"===r?!!t.trim():!!p.trim())&&("once"===n||"interval"===n?!!(F||v&&parseInt(v,10)>0):"cron"===n&&!!(F||x.trim()))),className:"w-full py-1.5 text-sm font-medium rounded bg-brand text-white hover:bg-brand/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:m?l("scheduledTasks.saveBtn",{modKey:(0,h.Mu)()}):l("scheduledTasks.createBtn",{modKey:(0,h.Mu)()})})]})]})}},32459:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{e:()=>m});var e=c(48249),f=c(67484),g=c(44384),h=c(82795),i=c(32753),j=c(74228),k=c(50508),l=a([k]);function m({currentCwd:a,onSwitchProject:b,onResolveSessionNumbers:c,collapsed:d,sessions:l}){let{t:n}=(0,g.Bd)(),[o,p]=(0,f.useState)(!1),[q,r]=(0,f.useState)(!1),[s,t]=(0,f.useState)({}),u=(0,f.useRef)(0),v=(0,f.useRef)(null),w=(0,k.o$)(),{show:x,hide:y}=w,z=(0,f.useCallback)(a=>{b(a.cwd,a.sessionId),p(!1)},[b]),A=(0,f.useCallback)(()=>{let a=!o;if(p(a),a){let a=++u.current;t({}),c().then(b=>{u.current===a&&t(b)})}else u.current+=1},[o,c]),B=l.filter(a=>"loading"===a.status).length,C=l.filter(a=>"unread"===a.status).length;return(0,e.jsxs)("div",{className:"relative",ref:v,children:[(0,e.jsxs)("button",{onClick:A,className:`relative flex items-center gap-2 px-2 py-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-hover transition-colors ${d?"w-full justify-center":"w-full"}`,title:d?n("sessions.recentSessions"):void 0,children:[(0,e.jsx)("svg",{className:"w-5 h-5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),!d&&(0,e.jsx)("span",{className:"text-sm flex-1 text-left",children:n("sessions.recentSessions")}),B>0&&(0,e.jsx)("span",{className:`min-w-[18px] h-[18px] px-1 text-foreground text-xs font-medium rounded-full flex items-center justify-center bg-orange-11/20 animate-pulse ${d?"absolute -top-1 -right-1":""}`,children:B}),C>0&&(0,e.jsx)("span",{className:`min-w-[18px] h-[18px] px-1 text-foreground text-xs font-medium rounded-full flex items-center justify-center bg-red-9/55 ${d&&!B?"absolute -top-1 -right-1":""}`,children:C})]}),o&&(0,e.jsxs)("div",{className:"absolute left-full bottom-0 ml-2 w-80 h-[600px] bg-popover border border-border rounded-lg shadow-lv2 z-50 flex flex-col",children:[(0,e.jsxs)("div",{className:"px-3 py-2 border-b border-border bg-muted/50 flex-shrink-0 rounded-t-lg flex items-center",children:[(0,e.jsx)("span",{className:"text-sm font-medium",children:n("sessions.recentSessions")}),B>0&&(0,e.jsxs)("span",{className:"ml-2 text-xs text-orange-11",children:["(",n("sessions.runningCount",{count:B}),")"]}),C>0&&(0,e.jsxs)("span",{className:"ml-2 text-xs text-red-11",children:["(",n("sessions.unreadCount",{count:C}),")"]}),(0,e.jsxs)("button",{onClick:()=>{p(!1),r(!0)},className:"ml-auto flex items-center gap-1 p-1 -mr-1 text-muted-foreground hover:text-foreground hover:bg-hover rounded transition-colors",title:n("sessions.searchRecentSessions"),children:[(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"m21 21-4.35-4.35m2.35-5.4a7.75 7.75 0 1 1-15.5 0 7.75 7.75 0 0 1 15.5 0Z"})}),(0,e.jsx)("span",{className:"text-xs",children:n("sessions.search")})]})]}),(0,e.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto",children:0===l.length?(0,e.jsx)("div",{className:"px-3 py-4 text-sm text-muted-foreground text-center",children:n("sessions.noSessions")}):l.map((b,c)=>(0,e.jsxs)("button",{onClick:()=>z(b),onMouseEnter:a=>x(b,a),onMouseLeave:y,className:`w-full px-3 py-2 text-left hover:bg-hover transition-colors flex items-start gap-2 ${c!==l.length-1?"border-b border-border/50":""} ${a===b.cwd?"bg-accent/50":""}`,children:[(0,e.jsx)(k.KO,{status:b.status,className:"mt-1.5"}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(i.S,{engine:b.engine}),(0,e.jsx)("span",{className:"font-medium text-sm truncate",children:(0,k.Qr)(b.cwd)}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:(0,k.fw)(n,b.lastActive)}),(0,e.jsx)(j.l,{coordinate:s[`${b.cwd}
41
- ${b.sessionId}`],status:(0,j.S)(b.status),statusLabel:(0,k.Mm)(n,b.status),className:"ml-auto"})]}),b.title&&(0,e.jsx)("div",{className:"text-xs font-medium text-foreground truncate","data-tooltip":b.title,children:b.title}),b.lastUserMessage&&(0,e.jsx)("div",{className:"text-xs text-foreground/80 truncate",children:b.lastUserMessage})]})]},`${b.cwd}-${b.sessionId}`))})]}),(0,e.jsx)(k.LD,{...w}),(0,e.jsx)(h.e,{isOpen:q,onClose:()=>r(!1),onSwitchProject:b,sessionNumbers:s})]})}k=(l.then?(await l)():l)[0],d()}catch(a){d(a)}})},32465:(a,b,c)=>{"use strict";c.d(b,{Y:()=>m});var d=c(48249),e=c(67484),f=c(44384),g=c(76592),h=c(46674),i=c(59347),j=c(24520),k=c(33281),l=c(23328);function m({onClose:a,onSave:b}){let{t:c}=(0,f.Bd)(),[n,o]=(0,e.useState)({}),[p,q]=(0,e.useState)(""),[r,s]=(0,e.useState)(""),[t,u]=(0,e.useState)(!0);(0,e.useCallback)(async()=>{u(!0);let a=await k.t4.runPromiseExit((0,l.Jn)());"Success"===a._tag?o(a.value):console.error("Failed to load aliases:",a.cause),u(!1)},[]);let v=()=>{p.trim()&&r.trim()&&(o(a=>({...a,[p.trim()]:r.trim()})),q(""),s(""))},w=async()=>{let c=await k.t4.runPromiseExit((0,l.cv)(n));"Success"===c._tag?(b(n),a()):console.error("Failed to save aliases:",c.cause)};return(0,d.jsx)("div",{className:"absolute inset-0 bg-scrim flex items-center justify-center z-50",children:(0,d.jsxs)("div",{className:"bg-background border border-border rounded-lg shadow-lv3 w-full max-w-2xl max-h-[80vh] flex flex-col m-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,d.jsxs)("div",{children:[(0,d.jsxs)("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[(0,d.jsx)(g.A,{className:"w-5 h-5"}),c("aliasManager.title")]}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:c("aliasManager.description")})]}),(0,d.jsx)("button",{onClick:a,className:"p-1 rounded hover:bg-hover transition-colors",children:(0,d.jsx)(h.A,{className:"w-5 h-5"})})]}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:t?(0,d.jsx)("div",{className:"flex items-center justify-center h-32 text-muted-foreground",children:c("common.loading")}):(0,d.jsxs)("div",{className:"space-y-3",children:[Object.entries(n).map(([a,b])=>(0,d.jsxs)("div",{className:"flex items-start gap-2 group",children:[(0,d.jsxs)("div",{className:"flex-1 grid grid-cols-2 gap-2",children:[(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("div",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground text-sm",children:"$"}),(0,d.jsx)("input",{type:"text",value:a,disabled:!0,className:"w-full pl-7 pr-3 py-2 rounded-lg border border-input bg-muted text-sm font-mono"})]}),(0,d.jsx)("input",{type:"text",value:b,onChange:b=>{var c;return c=b.target.value,void o(b=>({...b,[a]:c}))},placeholder:c("aliasManager.fullCommandPlaceholder"),className:"w-full px-3 py-2 rounded-lg border border-input bg-background text-sm font-mono focus:outline-none focus:ring-2 focus:ring-brand focus:border-transparent"})]}),(0,d.jsx)("button",{onClick:()=>{o(b=>{let c={...b};return delete c[a],c})},className:"p-2 rounded-lg text-destructive hover:bg-destructive/10 transition-colors opacity-0 group-hover:opacity-100",children:(0,d.jsx)(i.A,{className:"w-4 h-4"})})]},a)),(0,d.jsxs)("div",{className:"flex items-start gap-2 pt-2 border-t border-border",children:[(0,d.jsxs)("div",{className:"flex-1 grid grid-cols-2 gap-2",children:[(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("div",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground text-sm",children:"$"}),(0,d.jsx)("input",{type:"text",value:p,onChange:a=>q(a.target.value),placeholder:c("aliasManager.aliasPlaceholder"),className:"w-full pl-7 pr-3 py-2 rounded-lg border border-input bg-background text-sm font-mono focus:outline-none focus:ring-2 focus:ring-brand focus:border-transparent",onKeyDown:a=>{"Enter"!==a.key||a.nativeEvent.isComposing||(a.preventDefault(),v())}})]}),(0,d.jsx)("input",{type:"text",value:r,onChange:a=>s(a.target.value),placeholder:c("aliasManager.commandPlaceholder"),className:"w-full px-3 py-2 rounded-lg border border-input bg-background text-sm font-mono focus:outline-none focus:ring-2 focus:ring-brand focus:border-transparent",onKeyDown:a=>{"Enter"!==a.key||a.nativeEvent.isComposing||(a.preventDefault(),v())}})]}),(0,d.jsx)("button",{onClick:v,disabled:!p.trim()||!r.trim(),className:"p-2 rounded-lg bg-brand text-brand-foreground hover:bg-brand/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:(0,d.jsx)(j.A,{className:"w-4 h-4"})})]}),(0,d.jsxs)("div",{className:"mt-4 p-3 bg-accent rounded-lg",children:[(0,d.jsxs)("p",{className:"text-sm text-muted-foreground",children:[(0,d.jsx)("strong",{children:c("aliasManager.usage")}),c("aliasManager.usageDesc")]}),(0,d.jsxs)("div",{className:"mt-2 space-y-1 text-xs text-muted-foreground",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("code",{className:"px-1.5 py-0.5 bg-background rounded",children:"$ ll"}),(0,d.jsx)("span",{children:"→"}),(0,d.jsx)("code",{className:"px-1.5 py-0.5 bg-background rounded",children:"ls -la"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("code",{className:"px-1.5 py-0.5 bg-background rounded",children:"$ gs"}),(0,d.jsx)("span",{children:"→"}),(0,d.jsx)("code",{className:"px-1.5 py-0.5 bg-background rounded",children:"git status"})]})]})]}),0===Object.keys(n).length&&(0,d.jsx)("div",{className:"text-center py-8 text-muted-foreground text-sm",children:c("aliasManager.noAliases")})]})}),(0,d.jsxs)("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-border",children:[(0,d.jsx)("button",{onClick:a,className:"px-4 py-2 rounded-lg text-sm hover:bg-hover transition-colors",children:c("common.cancel")}),(0,d.jsx)("button",{onClick:w,className:"px-4 py-2 rounded-lg text-sm bg-brand text-brand-foreground hover:bg-brand/90 transition-colors",children:c("common.save")})]})]})})}},32580:(a,b,c)=>{"use strict";function d(a,b){let c=a.split("\n"),d=b.split("\n"),e=[],f=c.length,g=d.length,h=Array(f+1).fill(null).map(()=>Array(g+1).fill(0));for(let a=1;a<=f;a++)for(let b=1;b<=g;b++)c[a-1]===d[b-1]?h[a][b]=h[a-1][b-1]+1:h[a][b]=Math.max(h[a-1][b],h[a][b-1]);let i=f,j=g,k=[];for(;i>0||j>0;)i>0&&j>0&&c[i-1]===d[j-1]?(k.push({type:"unchanged",content:c[i-1],oldLineNum:i,newLineNum:j}),i--,j--):j>0&&(0===i||h[i][j-1]>=h[i-1][j])?(k.push({type:"added",content:d[j-1],newLineNum:j}),j--):(k.push({type:"removed",content:c[i-1],oldLineNum:i}),i--);for(;k.length>0;)e.push(k.pop());return e}c.d(b,{X:()=>d})},32753:(a,b,c)=>{"use strict";c.d(b,{S:()=>f});var d=c(48249),e=c(63565);function f({engine:a,tooltip:b,size:c="md"}){let g=a||"claude";return(0,e.ch)(g)?(0,d.jsx)("span",{className:"shrink-0 inline-flex items-center","data-tooltip":b??e.H[g],children:(0,d.jsx)(e.eV,{engine:g,className:"sm"===c?"h-3 w-3":"h-3.5 w-3.5"})}):(0,d.jsx)("span",{className:"shrink-0 px-1 py-0.5 text-[10px] leading-none font-medium rounded bg-muted text-muted-foreground","data-tooltip":b??g,children:g})}},33281:(a,b,c)=>{"use strict";c.d(b,{t4:()=>J});var d=c(95753),e=c(88512),f=c(79606),g=c(28582),h=c(61808);let i=d.Um(h.j9,h.dl((a=>{switch((a??"").toLowerCase()){case"all":return g.u8;case"trace":return g.Cn;case"debug":return g.y;case"info":default:return g.R2;case"warning":case"warn":return g.N5;case"error":return g.$D;case"fatal":return g.Lj;case"none":return g.NV}})(process.env.COCKPIT_LOG_LEVEL)));var j=c(1239),k=c(69063);let l=globalThis,m=l.__cockpitSpanRing??={buffer:[],index:new Map},n=a=>{let b="abcdef0123456789",c="";for(let d=0;d<a;d++)c+=b.charAt(Math.floor(Math.random()*b.length));return c};class o{constructor(a,b,c,d,e,f){this.name=a,this.parent=b,this.context=c,this.startTime=e,this.kind=f,this._tag="Span",this.sampled=!0,this.attributes=new Map,this.events=[],this.traceId=j.Ru(b)?b.value.traceId:n(32),this.spanId=n(16),this.status={_tag:"Started",startTime:e},this.links=Array.from(d),function(a){if(m.buffer.push(a),m.index.set(a.spanId,m.buffer.length-1),m.buffer.length>500){m.buffer.shift(),m.index.clear();for(let a=0;a<m.buffer.length;a++)m.index.set(m.buffer[a].spanId,a)}}(function(a,b,c,d,e,f){return{traceId:b,spanId:a,parentSpanId:c,name:d,kind:e,startTimeNs:f.toString(),endTimeNs:null,durationMs:null,attributes:{},events:[],status:"started"}}(this.spanId,this.traceId,function(a){return j.Ru(a)?a.value.spanId:null}(b),a,f,e))}end(a,b){this.status={_tag:"Ended",endTime:a,exit:b,startTime:this.status.startTime},function(a,b,c){let d=m.index.get(a);if(void 0===d)return;let e=m.buffer[d];if(!e)return;let f=Number(b-BigInt(e.startTimeNs))/1e6;m.buffer[d]={...e,endTimeNs:b.toString(),durationMs:Math.round(100*f)/100,status:"Success"===c._tag?"ok":"error",errorMessage:"Failure"===c._tag?function(a){if(a instanceof Error)return a.message;if("string"==typeof a)return a;try{return JSON.stringify(a)}catch{return String(a)}}(c.cause):void 0}}(this.spanId,a,"Success"===b._tag?{_tag:"Success"}:{_tag:"Failure",cause:b.cause})}attribute(a,b){this.attributes.set(a,b),function(a,b,c){let d=m.index.get(a);if(void 0===d)return;let e=m.buffer[d];e&&(m.buffer[d]={...e,attributes:{...e.attributes,[b]:c}})}(this.spanId,a,b)}event(a,b,c){this.events.push([a,b,c??{}]),function(a,b,c,d){let e=m.index.get(a);if(void 0===e)return;let f=m.buffer[e];f&&(m.buffer[e]={...f,events:[...f.events,{name:b,timeNs:c.toString(),attributes:d}]})}(this.spanId,a,b,c)}addLinks(a){this.links.push(...a)}}let p=k.L8({span:(a,b,c,d,e,f)=>new o(a,b,c,d,e,f),context:a=>a()}),q=d.Py(k.sh,p);d.Ie;var r=c(66473);let s=r.eu("dev","prod")("COCKPIT_ENV").pipe(r.IQ("prod")),t=r.Yj("COCKPIT_HOST").pipe(r.IQ("127.0.0.1")),u=r.nd("COCKPIT_PORT").pipe(r.NW(()=>r.nd("PORT")),r.IQ(3457)),v=r.uK(r.Yj("COCKPIT_OPEN_PROJECT")).pipe(r.Tj(a=>"Some"===a._tag?a.value:void 0)),w=r.zM("COCKPIT_NO_OPEN").pipe(r.IQ(!1)),x=r.Yj("COCKPIT_LOG_LEVEL").pipe(r.IQ("info")),y=r.nd("COCKPIT_SNAPSHOT_KEEP_DAYS").pipe(r.IQ(7)),z=r.nd("COCKPIT_SNAPSHOT_REPO_TTL_DAYS").pipe(r.IQ(30)),A=r.nd("COCKPIT_SNAPSHOT_MAX_FILE_KB").pipe(r.IQ(2048)),B=r.nd("COCKPIT_SESSION_KEEP_DAYS").pipe(r.IQ(30));f.gen(function*(){let a=yield*s,b=yield*t,c=yield*u,d=yield*v,e=yield*w,g=yield*x,h=yield*y,i=yield*z,j=yield*A,k=yield*B,l=yield*f.sync(()=>{let a="u">typeof process?process.env:void 0,b=a?.HOME||a?.USERPROFILE||".",c=a?.COCKPIT_HOME;return c?c.replace(/^~(?=$|\/)/,b):b+"/.cockpit"});return{env:a,host:b,port:3457===c&&"dev"===a?3456:c,cockpitDir:l,openProject:d,openBrowser:!e,logLevel:g,logFile:l+"/logs/cockpit.log",snapshotKeepDays:h,snapshotRepoTtlDays:i,snapshotMaxFileKb:j,sessionKeepDays:k}}).pipe(f.orDie);let C=d.Ie;var D=c(7846),E=c(55805),F=c(23734);let G=d.P1(F.d,f.gen(function*(){let a=yield*D.dT();return yield*f.acquireRelease(f.sync(()=>b=>{f.runFork(D.mk(a,b))}),a=>f.sync(()=>{})),F.d.of({publish:(a,b)=>f.sync(()=>{}),subscribe:b=>E.qdp(a).pipe(E.pbD(a=>{var c;return c=a.data,!!c&&"object"==typeof c&&(c.topic===b.id||c.type===b.legacyType)}),E.TjK(a=>((a,b)=>{if(a.topic===b.id)return a.msg;let{type:c,...d}=a;return d})(a.data,b)))})})),H=d.Um(i,q,C),I=d.Um(H,G),J=e.L8(I);f.void},34001:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{NoteModal:()=>G});var e=c(48249),f=c(67484),g=c(44384),h=c(208),i=c(13191),j=c(63229),k=c(19043),l=c(48197),m=c(9731),n=c(44551),o=c(53116),p=c(16512),q=c(56444),r=c(11537),s=c(73555),t=c(1370),u=c(80118),v=c(54727),w=c(19545),x=c(92451),y=c(83179),z=c(33281),A=c(79606),B=c(7833),C=c(65484),D=c(43321),E=c(43037),F=c(39031);function G({isOpen:a,onClose:b,projectCwd:c,projectName:d}){let{t:H}=(0,g.Bd)(),[I,J]=(0,f.useState)(!0),[K,L]=(0,f.useState)(!1),M=(0,f.useRef)(null),N=(0,f.useRef)(!1),O=(0,f.useRef)(void 0),[P,Q]=(0,f.useState)(null),R=(0,f.useRef)(null),S=(0,f.useCallback)(async a=>{let b=(0,D.D)(a);L(!0);let d=await z.t4.runPromiseExit((0,C.Cq)(c,b,O.current).pipe(A.tapError(a=>A.sync(()=>console.error("Failed to save note:",a)))));if("Success"===d._tag){let a=d.value;a.conflict?(V.current?.commands.setContent(a.content,{emitUpdate:!1}),O.current=a.mtime,N.current=!1,(0,B.oR)(H("editor.conflictReloaded"),"info")):(O.current=a.mtime,N.current=!1)}L(!1)},[c,H]),T=(0,f.useCallback)(a=>{N.current=!0,M.current&&clearTimeout(M.current),M.current=setTimeout(()=>{S(a)},5e3)},[S]),U=(0,i.hG)({immediatelyRender:!1,extensions:[j.A.configure({heading:!1,link:!1}),u.R.configure({levels:[1,2,3]}),v.y,k.A.configure({placeholder:()=>h.A.t("editor.placeholder")}),l.XI.configure({resizable:!0}),m.H,n.n,o.A,p._,r.Ay.configure({autolink:!0,linkOnPaste:!0,openOnClick:!1,HTMLAttributes:{class:"tiptap-link",target:"_blank",rel:"noopener noreferrer"}}),q.$H.configure({nested:!0}),E.E3,F.IS,s.o.configure({html:!0,transformCopiedText:!1,transformPastedText:!0})],editorProps:{attributes:{class:"tiptap-editor focus:outline-none min-h-[60vh] px-6 py-4"},clipboardTextSerializer:a=>a.content.textBetween(0,a.content.size,"\n").replace(/\n+$/,""),transformCopied:a=>{let b=a=>!!a&&a.isTextblock&&0===a.content.size,c=a.content,{openStart:d,openEnd:e}=a;for(;c.childCount>1&&b(c.lastChild);)c=c.cut(0,c.size-c.lastChild.nodeSize),e=0;for(;c.childCount>1&&b(c.firstChild);)c=c.cut(c.firstChild.nodeSize),d=0;return new t.Ji(c,d,e)},handleClick:(a,b,c)=>{if(c.metaKey||c.ctrlKey){let c=a.state.doc.resolve(b).marks().find(a=>"link"===a.type.name)?.attrs;if(c?.href)return window.open(c.href,"_blank","noopener,noreferrer"),!0}return!1},handleKeyDown:(a,b)=>{if("Backspace"===b.key&&V.current){let a=V.current;if(a.isActive("codeBlock")){let{$from:b}=a.state.selection,c=b.node(b.depth);if("codeBlock"===c.type.name&&""===c.textContent)return a.chain().focus().toggleCodeBlock().run(),!0}}return"/"!==b.key||P||setTimeout(()=>{if(!V.current)return;let{from:a}=V.current.state.selection,b=V.current.state.doc.textBetween(Math.max(0,a-1),a,"\n");if("/"===b){R.current=a;let b=V.current.view.coordsAtPos(a);Q({query:"",position:{top:b.bottom+4,left:b.left}})}},0),!1}},onUpdate:({editor:a})=>{let b=(0,w.up)(a);if(T(b),null!==R.current){let{from:b}=a.state.selection;if(b<R.current)Q(null),R.current=null;else{let c=a.state.doc.textBetween(R.current,b,"\n");c.includes(" ")||c.includes("\n")?(Q(null),R.current=null):Q(a=>a?{...a,query:c}:null)}}}}),V=(0,f.useRef)(null),W=(0,f.useCallback)(()=>{if(M.current&&(clearTimeout(M.current),M.current=null),N.current&&U){let a=(0,w.up)(U);S(a)}Q(null),R.current=null,b()},[U,S,b]);return a?(0,e.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,e.jsx)("div",{className:"absolute inset-0 bg-scrim",onClick:W}),(0,e.jsxs)("div",{className:"relative bg-card rounded-lg shadow-lv3 w-full max-w-6xl h-[90vh] mx-4 flex flex-col overflow-hidden",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border flex-shrink-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("h2",{className:"text-sm font-medium text-foreground",children:d?H("editor.noteTitle",{name:d}):H("editor.noteUntitled")}),K&&(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:H("editor.saving")})]}),(0,e.jsx)("button",{onClick:W,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-hover rounded transition-colors",children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsx)(y.NoteToolbar,{editor:U}),(0,e.jsx)("div",{className:"flex-1 overflow-y-auto",children:I?(0,e.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:(0,e.jsx)("span",{children:H("common.loading")})}):(0,e.jsx)(i.$Z,{editor:U})})]}),P&&U&&(0,e.jsx)(x.U,{editor:U,query:P.query,position:P.position,onClose:()=>{Q(null),R.current=null}})]}):null}d()}catch(a){d(a)}})},34728:(a,b,c)=>{"use strict";c.d(b,{U:()=>j});var d=c(67484),e=c(44384),f=c(7833),g=c(77156),h=c(59336),i=c(33281);function j(){let{t:a}=(0,e.Bd)();return(0,d.useCallback)(async b=>{let c=await i.t4.runPromiseExit((0,g.L5)(b));if("Success"===c._tag)c.value.alreadyExists?(0,f.oR)(a("skills.alreadyAdded"),"info"):((0,f.oR)(a("skills.added"),"success"),(0,h.k)());else{let b="Fail"===c.cause._tag?c.cause.error:null,d=b?.cause,e=d instanceof Error?d.message:a("skills.addFailed");(0,f.oR)(e,"error")}},[a])}},35208:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{xU:()=>u,xZ:()=>t});var e=c(48249),f=c(67484),g=c(44384),h=c(36043),i=c(32580),j=c(73414),k=c(7833),l=c(38896),m=c(36984),n=c(74542),o=c(26362),p=c(89719),q=a([o]);function r(a){return(0,f.useCallback)((b,c)=>{if(!a||c<=0)return;let d=(0,p.A)(b,b.currentTarget);d&&a(c,d.column,d.rect)},[a])}function s(a){return a.params?`${a.name}(${a.params.join(", ")})`:a.name}function t({oldContent:a,newContent:b,filePath:c,isNew:d=!1,isDeleted:p=!1,cwd:q,enableComments:u=!1,onPreview:v,previewLabel:w,onContentSearch:x,targetLine:y,compact:z=!1,symbols:A,onTokenHover:B,onTokenHoverLeave:C,onTokenHoverCancel:D}){let{t:E}=(0,g.Bd)(),F=r(B),G=w??E("common.preview"),H=(0,f.useMemo)(()=>(0,i.X)(a,b),[a,b]),I=(0,f.useRef)(null),J=(0,f.useRef)(null),K=(0,f.useRef)(null);(0,f.useRef)(!1);let[L,M]=(0,f.useState)(null),{commentsEnabled:N,linesWithComments:O,commentsByEndLine:P,handleCommentBubbleClick:Q,addCommentRange:R,sendToAIRange:S,commentPortal:T}=(0,o.T)({cwd:q,enableComments:u,filePath:c,diffLines:H,containerEl:L,onContentSearch:x}),{leftLines:U,rightLines:V}=(0,f.useMemo)(()=>{let a=[],b=[],c=0,d=0;for(let e=0;e<H.length;e++){let f=H[e];if("unchanged"===f.type){for(;a.length<b.length;)a.push({lineNum:0,content:"",type:"unchanged",originalIdx:-1});for(;b.length<a.length;)b.push({lineNum:0,content:"",type:"unchanged",originalIdx:-1});c++,d++,a.push({lineNum:c,content:f.content,type:"unchanged",originalIdx:e}),b.push({lineNum:d,content:f.content,type:"unchanged",originalIdx:e})}else"removed"===f.type?(c++,a.push({lineNum:c,content:f.content,type:"removed",originalIdx:e})):"added"===f.type&&(d++,b.push({lineNum:d,content:f.content,type:"added",originalIdx:e}))}for(;a.length<b.length;)a.push({lineNum:0,content:"",type:"unchanged",originalIdx:-1});for(;b.length<a.length;)b.push({lineNum:0,content:"",type:"unchanged",originalIdx:-1});return{leftLines:a,rightLines:b}},[H]),W=(0,f.useMemo)(()=>H.map(a=>a.content),[H]),X=(0,l.C)(W,c),[Y,Z]=(0,f.useState)(()=>new Map),$=(0,f.useMemo)(()=>A??[],[A]),{rows:_,gaps:aa}=(0,f.useMemo)(()=>z?(0,j.pU)(U,V,Y,$):{rows:U.map((a,b)=>({kind:"diff",idx:b})),gaps:[]},[z,U,U,V,Y,$]),ab=(0,f.useCallback)((a,b)=>{let c=aa.find(b=>b.id===a);c&&Z(d=>{let e=d.get(a)??{topRevealed:0,bottomRevealed:0},f=c.endIdx-c.startIdx+1-e.topRevealed-e.bottomRevealed;if(f<=0)return d;let g=Math.min(j.YO,f),h="up"===b?{...e,topRevealed:e.topRevealed+g}:{...e,bottomRevealed:e.bottomRevealed+g};return new Map(d).set(a,h)})},[aa]);(0,f.useCallback)(a=>{for(let b of aa)if(a>=b.startIdx&&a<=b.endIdx)return b.id;return null},[aa]);let ac=(0,f.useCallback)(a=>_[a]?.kind==="gap-label"?28:20,[_]),ad=(0,f.useCallback)(a=>{let b=_[a];if(!b)return a;if("gap-label"===b.kind)return`gl:${b.gapId}`;if("gap-expand"===b.kind)return`ge:${b.gapId}:${b.direction}`;let c=U[b.idx],d=V[b.idx];return`d:${c?.lineNum??"x"}:${c?.type??"x"}:${d?.lineNum??"x"}:${d?.type??"x"}`},[_,U,V]),ae=(0,h.Te)({count:_.length,getScrollElement:()=>I.current,estimateSize:ac,getItemKey:ad,overscan:20}),af=d?"w-1/4":p?"w-3/4":"w-1/2",ag=d?"w-3/4":p?"w-1/4":"w-1/2",ah=(0,f.useMemo)(()=>_.map(a=>{if("diff"!==a.kind)return{type:"unchanged"};let b=U[a.idx],c=V[a.idx];return"removed"===b.type?{type:"removed"}:c?.type==="added"?{type:"added"}:{type:"unchanged"}}),[_,U,V]),ai=ae.getTotalSize(),aj=ae.getVirtualItems();return(0,e.jsxs)("div",{className:"font-mono flex flex-col h-full text-sm",children:[(0,e.jsxs)("div",{className:"flex flex-shrink-0 border-b border-border",children:[(0,e.jsx)("div",{className:`${af} min-w-0 px-2 py-1 bg-accent text-muted-foreground text-center text-xs font-medium border-r border-border`,children:d?"(New File)":p?"Deleted":"Old"}),(0,e.jsxs)("div",{className:`${ag} min-w-0 px-2 py-1 bg-accent text-muted-foreground text-xs font-medium relative`,children:[(0,e.jsx)("span",{className:"block text-center",children:p?"(Deleted)":"New"}),(0,e.jsxs)("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-2",children:[v&&(0,e.jsx)("button",{onClick:v,className:"text-muted-foreground hover:text-foreground transition-colors",children:G}),!p&&b&&(0,e.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(b),(0,k.oR)(E("diffViewer.copiedAll"))},className:"text-muted-foreground hover:text-foreground transition-colors",children:E("common.copy")})]})]}),(0,e.jsx)("div",{className:"w-4 flex-shrink-0 bg-accent"})]}),(0,e.jsxs)("div",{className:"flex-1 min-h-0 flex",children:[(0,e.jsx)("div",{ref:I,className:"flex-1 overflow-y-auto overflow-x-hidden",children:(0,e.jsxs)("div",{className:"flex",style:{height:`${ai}px`},children:[(0,e.jsx)("div",{ref:J,className:`${af} overflow-x-auto border-r border-border`,children:(0,e.jsx)("div",{className:"min-w-max h-full",style:{position:"relative"},children:aj.map(a=>{let b=_[a.index];if("gap-expand"===b.kind||"gap-label"===b.kind){let c="gap-label"===b.kind;return(0,e.jsx)("div",{ref:ae.measureElement,"data-index":a.index,style:{position:"absolute",top:0,left:0,width:"100%",height:`${Math.max(a.size,ac(a.index))}px`,transform:`translateY(${a.start}px)`},className:c?"bg-accent border-y border-border":""},a.key)}let c=U[b.idx];return(0,e.jsxs)("div",{ref:ae.measureElement,"data-index":a.index,"data-row-idx":b.idx,style:{position:"absolute",top:0,left:0,minWidth:"100%",width:"max-content",height:`${Math.max(a.size,ac(a.index))}px`,transform:`translateY(${a.start}px)`},className:`flex ${"removed"===c.type?"bg-red-9/15 dark:bg-red-9/25":""}`,children:[(0,e.jsx)("span",{className:"w-10 flex-shrink-0 text-right pr-2 text-foreground-subtle select-none border-r border-border",children:c.lineNum||""}),(0,e.jsx)("span",{className:"whitespace-pre pl-2",dangerouslySetInnerHTML:{__html:c.originalIdx>=0&&X[c.originalIdx]||(0,m.ZD)(c.content||" ")}})]},a.key)})})}),(0,e.jsx)("div",{ref:K,className:`${ag} overflow-x-auto`,children:(0,e.jsx)("div",{className:"min-w-max h-full",style:{position:"relative"},children:aj.map(a=>{let b=_[a.index];if("gap-expand"===b.kind)return(0,e.jsx)("button",{ref:ae.measureElement,"data-index":a.index,type:"button",onClick:()=>ab(b.gapId,b.direction),style:{position:"absolute",top:0,left:0,width:"100%",height:`${Math.max(a.size,ac(a.index))}px`,transform:`translateY(${a.start}px)`},className:"flex items-center justify-center text-[11px] text-foreground/50 hover:bg-hover hover:text-brand active:bg-brand/15 transition-colors duration-100 cursor-pointer focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-brand/60",title:E("up"===b.direction?"diffViewer.gap.expandUp":"diffViewer.gap.expandDown",{count:b.revealCount}),"aria-label":E("up"===b.direction?"diffViewer.gap.expandUp":"diffViewer.gap.expandDown",{count:b.revealCount}),children:(0,e.jsx)("span",{className:"select-none",children:E("diffViewer.gap.more",{count:b.revealCount})})},a.key);if("gap-label"===b.kind)return(0,e.jsxs)("div",{ref:ae.measureElement,"data-index":a.index,"data-gap-id":b.gapId,style:{position:"absolute",top:0,left:0,width:"100%",height:`${Math.max(a.size,ac(a.index))}px`,transform:`translateY(${a.start}px)`},className:"flex items-center justify-center gap-2 px-3 text-[11px] text-foreground/80 bg-accent border-y border-border min-w-0 select-none",children:[(0,e.jsx)("span",{className:"flex-shrink-0",children:E("diffViewer.gap.hidden",{count:b.hiddenCount})}),b.enclosingFn&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"opacity-50 flex-shrink-0",children:"\xb7"}),(0,e.jsx)("span",{className:"truncate min-w-0 font-medium","data-tooltip":s(b.enclosingFn),children:s(b.enclosingFn)})]})]},a.key);let c=V[b.idx],d=c?.lineNum||0,f=d>0&&O.has(d),g=P.get(d),h=g?.[0],i=R&&d>=R.start&&d<=R.end,j=S&&d>=S.start&&d<=S.end,k=i||j;return(0,e.jsxs)("div",{ref:ae.measureElement,"data-index":a.index,"data-new-line":d||void 0,"data-row-idx":b.idx,style:{position:"absolute",top:0,left:0,minWidth:"100%",width:"max-content",height:`${Math.max(a.size,ac(a.index))}px`,transform:`translateY(${a.start}px)`},className:`flex ${k?"bg-blue-9/20":f?"bg-amber-9/10":c?.type==="added"?"bg-green-9/15 dark:bg-green-9/25":""}`,children:[(0,e.jsxs)("span",{className:`flex-shrink-0 flex items-center gap-0.5 pr-1 text-foreground-subtle select-none border-r border-border ${k?"bg-blue-9/30":""}`,style:{width:N?"52px":"40px"},children:[N&&d>0&&f&&h&&(0,e.jsx)("button",{onClick:a=>Q(h,a),className:"w-4 h-4 flex items-center justify-center rounded hover:bg-hover text-amber-9",title:E("codeViewer.nComments",{count:g?.length}),children:(0,e.jsx)("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",children:(0,e.jsx)("path",{fillRule:"evenodd",d:"M18 10c0 3.866-3.582 7-8 7a8.841 8.841 0 01-4.083-.98L2 17l1.338-3.123C2.493 12.767 2 11.434 2 10c0-3.866 3.582-7 8-7s8 3.134 8 7zM7 9H5v2h2V9zm8 0h-2v2h2V9zM9 9h2v2H9V9z",clipRule:"evenodd"})})}),N&&d>0&&!f&&(0,e.jsx)("span",{className:"w-4"}),(0,e.jsx)("span",{className:"flex-1 text-right pr-1",children:d||""})]}),(0,e.jsx)("span",{className:"whitespace-pre pl-2",onMouseOver:B?a=>F(a,d):void 0,onMouseLeave:B?C:void 0,onMouseDown:B?D:void 0,dangerouslySetInnerHTML:{__html:c?.originalIdx>=0&&X[c.originalIdx]||(0,m.ZD)(c?.content||" ")}})]},a.key)})})})]})}),(0,e.jsx)(n.b,{lines:ah,containerRef:I})]}),T]})}function u({oldContent:a,newContent:b,filePath:c,cwd:d,enableComments:p=!1,onPreview:q,previewLabel:s,onContentSearch:t,compact:v=!1,onTokenHover:w,onTokenHoverLeave:x,onTokenHoverCancel:y}){let{t:z}=(0,g.Bd)(),A=r(w),B=s??z("common.preview"),C=(0,f.useMemo)(()=>(0,i.X)(a,b),[a,b]),D=(0,f.useRef)(null),E=(0,f.useMemo)(()=>C.map(a=>a.content),[C]),F=(0,l.C)(E,c),[G,H]=(0,f.useState)(null),{commentsEnabled:I,linesWithComments:J,commentsByEndLine:K,handleCommentBubbleClick:L,addCommentRange:M,sendToAIRange:N,commentPortal:O}=(0,o.T)({cwd:d,enableComments:p,filePath:c,diffLines:C,containerEl:G,onContentSearch:t}),[P,Q]=(0,f.useState)(()=>new Set),R=(0,f.useMemo)(()=>v?function(a,b){let c=a.length,d=Array(c).fill(!1);for(let b=0;b<c;b++){if("unchanged"===a[b].type)continue;let e=Math.max(0,b-j.aj),f=Math.min(c-1,b+j.aj);for(let a=e;a<=f;a++)d[a]=!0}let e=[],f=0,g=0;for(;g<c;){if(d[g]){e.push({kind:"line",line:a[g],index:g}),g++;continue}let h=g;for(;h<c&&!d[h];)h++;let i=f++;if(b.has(i))for(let b=g;b<h;b++)e.push({kind:"line",line:a[b],index:b});else e.push({kind:"gap",id:i,count:h-g});g=h}return e}(C,P):C.map((a,b)=>({kind:"line",line:a,index:b})),[v,C,P]),S=(0,f.useCallback)(a=>{let b=R[a];if(!b)return a;if("gap"===b.kind)return`gap:${b.id}`;let c=b.line;return`${c.type}:${c.oldLineNum??"x"}:${c.newLineNum??"x"}`},[R]),T=(0,h.Te)({count:R.length,getScrollElement:()=>D.current,estimateSize:()=>20,getItemKey:S,overscan:20}),U=(0,f.useMemo)(()=>R.map(a=>"gap"===a.kind?{type:"unchanged"}:{type:a.line.type}),[R]);return(0,e.jsxs)("div",{className:"font-mono flex flex-col h-full text-sm",children:[(q||b)&&(0,e.jsxs)("div",{className:"flex-shrink-0 flex items-center justify-end gap-2 px-2 py-1 border-b border-border bg-accent text-xs",children:[q&&(0,e.jsx)("button",{onClick:q,className:"text-muted-foreground hover:text-foreground transition-colors",children:B}),b&&(0,e.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(b),(0,k.oR)(z("diffViewer.copiedAll"))},className:"text-muted-foreground hover:text-foreground transition-colors",children:z("common.copy")}),(0,e.jsx)("div",{className:"w-4 flex-shrink-0"})]}),(0,e.jsxs)("div",{className:"flex-1 min-h-0 flex",children:[(0,e.jsx)("div",{ref:D,className:"flex-1 min-w-0 overflow-auto",children:(0,e.jsx)("div",{style:{height:`${T.getTotalSize()}px`,position:"relative"},children:T.getVirtualItems().map(a=>{let b=R[a.index];if(!b)return null;let c={position:"absolute",top:0,left:0,minWidth:"100%",width:"max-content",height:`${a.size}px`,transform:`translateY(${a.start}px)`};if("gap"===b.kind){let d=z("diffViewer.gap.hidden",{count:b.count});return(0,e.jsx)("div",{style:c,onClick:()=>Q(a=>new Set(a).add(b.id)),className:"flex items-center cursor-pointer bg-slate-2 hover:bg-hover border-y border-border text-xs text-foreground-subtle select-none","data-tooltip":d,children:(0,e.jsx)("span",{className:"w-full text-center",children:d})},a.key)}let d=b.line,f="removed"!==d.type?d.newLineNum??0:0,g=f>0&&J.has(f),h=K.get(f),i=h?.[0],j=M&&f>=M.start&&f<=M.end,k=N&&f>=N.start&&f<=N.end;return(0,e.jsxs)("div",{style:c,"data-new-line":f||void 0,className:`flex ${j||k?"bg-blue-9/20":g?"bg-amber-9/10":"removed"===d.type?"bg-red-9/15 dark:bg-red-9/25":"added"===d.type?"bg-green-9/15 dark:bg-green-9/25":""}`,children:[I&&(0,e.jsx)("span",{className:"w-5 flex-shrink-0 flex items-center justify-center select-none",children:f>0&&g&&i&&(0,e.jsx)("button",{onClick:a=>L(i,a),className:"w-4 h-4 flex items-center justify-center rounded hover:bg-hover text-amber-9",title:z("codeViewer.nComments",{count:h?.length}),children:(0,e.jsx)("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",children:(0,e.jsx)("path",{fillRule:"evenodd",d:"M18 10c0 3.866-3.582 7-8 7a8.841 8.841 0 01-4.083-.98L2 17l1.338-3.123C2.493 12.767 2 11.434 2 10c0-3.866 3.582-7 8-7s8 3.134 8 7zM7 9H5v2h2V9zm8 0h-2v2h2V9zM9 9h2v2H9V9z",clipRule:"evenodd"})})})}),(0,e.jsx)("span",{className:"w-10 flex-shrink-0 text-right pr-2 text-foreground-subtle select-none border-r border-border",children:"added"!==d.type?d.oldLineNum:""}),(0,e.jsx)("span",{className:"w-10 flex-shrink-0 text-right pr-2 text-foreground-subtle select-none border-r border-border",children:"removed"!==d.type?d.newLineNum:""}),(0,e.jsx)("span",{className:`w-6 flex-shrink-0 text-center select-none ${"removed"===d.type?"text-red-11":"added"===d.type?"text-green-11":"text-foreground-subtle"}`,children:"removed"===d.type?"-":"added"===d.type?"+":" "}),(0,e.jsx)("span",{className:"flex-1 whitespace-pre pl-1",onMouseOver:w?a=>A(a,f):void 0,onMouseLeave:w?x:void 0,onMouseDown:w?y:void 0,dangerouslySetInnerHTML:{__html:F[b.index]||(0,m.ZD)(d.content||" ")}})]},a.key)})})}),(0,e.jsx)(n.b,{lines:U,containerRef:D})]}),O]})}o=(q.then?(await q)():q)[0],d()}catch(a){d(a)}})},35606:(a,b,c)=>{"use strict";function d(a,b){switch(a){case"codex":return`codex resume ${b}`;case"kimi":case"glm":case"deepseek":case"ollama":return`${a} ${b}`;default:return`claude -r ${b}`}}c.d(b,{X:()=>d})},35857:(a,b,c)=>{"use strict";function d(){}c.d(b,{N:()=>d})},36688:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{x:()=>k});var e=c(48249),f=c(67484),g=c(44256),h=c(7122),i=c(73887),j=a([i]);function k({filePath:a,content:b,cwd:c,onClose:d,zClassName:j="z-50"}){let[l,m]=(0,f.useState)(null);return(0,e.jsx)(g.ZL,{children:(0,e.jsx)("div",{className:`fixed inset-0 ${j} flex items-center justify-center bg-scrim p-0 md:p-4`,onClick:d,children:(0,e.jsx)("div",{ref:m,className:"bg-card shadow-lv3 w-full h-full rounded-none md:max-w-[90%] md:h-[90vh] md:rounded-lg flex flex-col relative",onClick:a=>a.stopPropagation(),children:(0,e.jsx)(h.SU,{container:l,children:(0,e.jsx)(i.M,{content:b,filePath:a,cwd:c,onClose:d})})})})})}i=(j.then?(await j)():j)[0],d()}catch(a){d(a)}})},36702:(a,b,c)=>{"use strict";c.d(b,{V:()=>x});var d=c(48249),e=c(67484),f=c(44384),g=c(44256),h=c(7833);function i({image:a,onClose:b}){let{t:c}=(0,f.Bd)(),e=async b=>{b.stopPropagation();try{var d;if(!navigator.clipboard?.write||"u"<typeof ClipboardItem)throw Error("Clipboard image write is unavailable");let b=await (d=a.preview,new Promise((a,b)=>{let c=new Image;c.onload=()=>{let d=document.createElement("canvas");d.width=c.naturalWidth,d.height=c.naturalHeight;let e=d.getContext("2d");e?(e.drawImage(c,0,0),d.toBlob(c=>{c?a(c):b(Error("Could not encode image"))},"image/png")):b(Error("Canvas is unavailable"))},c.onerror=()=>b(Error("Could not load image")),c.src=d}));await navigator.clipboard.write([new ClipboardItem({"image/png":b})]),(0,h.oR)(c("imagePreview.copiedImage"),"success")}catch{(0,h.oR)(c("common.copyFailed"),"error")}},j=(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80",onClick:b,children:[(0,d.jsxs)("div",{className:"absolute top-4 right-4 flex items-center gap-2",children:[(0,d.jsx)("button",{type:"button",onClick:e,className:"w-10 h-10 flex items-center justify-center text-white/80 hover:text-white bg-black/40 hover:bg-black/60 rounded-full transition-colors",title:c("imagePreview.copyImage"),children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7V5a2 2 0 0 1 2-2h7a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-2M7 7h6a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z"})})}),(0,d.jsx)("button",{type:"button",onClick:b,className:"w-10 h-10 flex items-center justify-center text-white/80 hover:text-white bg-black/40 hover:bg-black/60 rounded-full transition-colors",title:c("common.close"),children:(0,d.jsx)("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,d.jsx)("img",{src:a.preview,alt:c("imagePreview.previewImage"),className:"max-w-[90vw] max-h-[90vh] object-contain",onClick:a=>a.stopPropagation()})]});return(0,d.jsx)(g.ZL,{children:j})}function j({images:a,onRemove:b,disabled:c}){let{t:g}=(0,f.Bd)(),[h,k]=(0,e.useState)(null);return 0===a.length?null:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"flex flex-wrap gap-2 p-2 border-b border-border",children:a.map(a=>(0,d.jsxs)("div",{className:"relative group w-16 h-16 rounded-lg overflow-hidden border border-border cursor-pointer",onClick:()=>k(a),children:[(0,d.jsx)("img",{src:a.preview,alt:g("imagePreview.previewImage"),className:"w-full h-full object-cover hover:opacity-90 transition-opacity"}),(0,d.jsx)("button",{onClick:c=>{c.stopPropagation(),b(a.id)},className:"absolute top-0 right-0 w-5 h-5 bg-black/60 hover:bg-black/80 text-white text-xs flex items-center justify-center rounded-bl-lg opacity-0 group-hover:opacity-100 transition-opacity",title:g("imagePreview.deleteImage"),children:"✕"})]},a.id))}),h&&(0,d.jsx)(i,{image:h,onClose:()=>k(null)})]})}var k=c(30458),l=c(24520),m=c(33999),n=c(74118),o=c(12625),p=c(46674),q=c(72529),r=c(33281),s=c(41224);function t({initialValue:a,placeholder:b,onCommit:c,onCancel:f}){let[g,h]=(0,e.useState)(a),i=(0,e.useCallback)(a=>{if("Enter"!==a.key||a.nativeEvent.isComposing)"Escape"===a.key&&(a.preventDefault(),a.stopPropagation(),f());else{a.preventDefault(),a.stopPropagation();let b=g.trim();b&&c(b)}},[g,c,f]);return(0,d.jsx)("input",{type:"text",value:g,onChange:a=>h(a.target.value),onKeyDown:i,placeholder:b,autoFocus:!0,className:"w-full min-w-0 px-2 py-1 mb-1 text-xs rounded border border-input bg-background focus:outline-none focus:ring-1 focus:ring-ring"})}function u({label:a,prompts:b,isAdding:c,onStartAdd:g,onCancelAdd:h,onAdd:i,onUpdate:j,onDelete:k,onReorder:r,onSelect:s}){let{t:v}=(0,f.Bd)(),[w,x]=(0,e.useState)(null),[y,z]=(0,e.useState)(null),[A,B]=(0,e.useState)(null),C=(0,e.useCallback)(()=>{z(null),B(null)},[]),D=(0,e.useCallback)((a,b)=>{a.preventDefault(),B(b)},[]),E=(0,e.useCallback)(a=>{if(null===y||y===a)return void C();let c=[...b],[d]=c.splice(y,1);c.splice(a,0,d),C(),x(null),r(c)},[y,b,r,C]);return(0,d.jsxs)("div",{className:"p-2",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,d.jsx)("span",{className:"text-xs font-medium text-muted-foreground px-1",children:a}),(0,d.jsx)("button",{type:"button",onClick:()=>{x(null),g()},className:"p-0.5 text-muted-foreground hover:text-foreground rounded",title:v("chat.addQuickPrompt"),children:(0,d.jsx)(l.A,{className:"w-3.5 h-3.5"})})]}),c&&(0,d.jsx)(t,{initialValue:"",placeholder:v("chat.quickPromptPlaceholder"),onCommit:i,onCancel:h}),0===b.length&&!c&&(0,d.jsx)("div",{className:"text-xs text-muted-foreground px-1 py-1",children:v("chat.noQuickPrompts")}),b.map((a,b)=>w===b?(0,d.jsx)(t,{initialValue:a,placeholder:v("chat.quickPromptPlaceholder"),onCommit:a=>{x(null),j(b,a)},onCancel:()=>x(null)},`edit-${b}`):(0,d.jsxs)("div",{draggable:!0,onDragStart:()=>z(b),onDragOver:a=>D(a,b),onDrop:()=>E(b),onDragEnd:C,className:`flex items-center group min-w-0 rounded transition-opacity ${y===b?"opacity-50":""} ${A===b&&y!==b?"border-t-2 border-brand":""}`,children:[(0,d.jsx)(m.A,{className:"w-3 h-3 flex-shrink-0 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity cursor-grab"}),(0,d.jsx)(q.m,{content:a,children:(0,d.jsxs)("button",{type:"button",onClick:()=>s(a),className:"flex-1 min-w-0 flex items-center gap-2 px-2 py-1.5 text-left text-sm rounded hover:bg-hover transition-colors",children:[(0,d.jsx)(n.A,{className:"w-3 h-3 flex-shrink-0 text-muted-foreground"}),(0,d.jsx)("span",{className:"truncate",children:a})]})}),(0,d.jsx)("button",{type:"button",onClick:()=>x(b),className:"p-1 text-muted-foreground hover:text-foreground rounded opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0",title:v("common.edit"),children:(0,d.jsx)(o.A,{className:"w-3 h-3"})}),(0,d.jsx)("button",{type:"button",onClick:()=>{x(null),k(b)},className:"p-1 text-muted-foreground hover:text-destructive rounded opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0",title:v("common.delete"),children:(0,d.jsx)(p.A,{className:"w-3 h-3"})})]},b))]})}function v({cwd:a,anchorRef:b,onClose:c,onSelect:g}){let{t:h}=(0,f.Bd)(),[i,j]=(0,e.useState)([]),[k,l]=(0,e.useState)([]),[m,n]=(0,e.useState)(null),o=(0,e.useCallback)(async(b,c)=>{let d="global"===b?j:l;d(c);let e=await r.t4.runPromiseExit((0,s.tY)("global"===b?{scope:"global",prompts:c}:{cwd:a,prompts:c}));"Failure"===e._tag?console.error(`Failed to save ${b} prompts:`,e.cause):e.value?.prompts&&d(e.value.prompts)},[a]),p=(0,e.useCallback)(a=>{c(),g(a)},[c,g]);return(0,d.jsxs)("div",{className:"absolute bottom-full left-0 mb-2 w-80 max-w-[calc(100vw-1.5rem)] bg-popover border border-border rounded-lg shadow-lv2 z-50 max-h-[70vh] overflow-y-auto",children:[(0,d.jsx)(u,{label:h("chat.globalPrompts"),prompts:i,isAdding:"global"===m,onStartAdd:()=>n("global"),onCancelAdd:()=>n(null),onAdd:a=>{o("global",[...i,a]),n(null)},onUpdate:(a,b)=>o("global",i.map((c,d)=>d===a?b:c)),onDelete:a=>o("global",i.filter((b,c)=>c!==a)),onReorder:a=>o("global",a),onSelect:p}),a&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"border-t border-border"}),(0,d.jsx)(u,{label:h("chat.projectPrompts"),prompts:k,isAdding:"project"===m,onStartAdd:()=>n("project"),onCancelAdd:()=>n(null),onAdd:a=>{o("project",[...k,a]),n(null)},onUpdate:(a,b)=>o("project",k.map((c,d)=>d===a?b:c)),onDelete:a=>o("project",k.filter((b,c)=>c!==a)),onReorder:a=>o("project",a),onSelect:p})]})]})}var w=c(59336);let x=(0,e.memo)(function({onSend:a,disabled:b,cwd:c,engine:g,onShowGitStatus:h,onShowComments:i,onShowUserMessages:l,onOpenNote:m,onCreateScheduledTask:n}){let{t:o}=(0,f.Bd)(),[p,q]=(0,e.useState)(""),[t,u]=(0,e.useState)(0),[x,y]=(0,e.useState)([]),[z,A]=(0,e.useState)([]),[B,C]=(0,e.useState)([]),[D,E]=(0,e.useState)(!1),[F,G]=(0,e.useState)(!1),[H,I]=(0,e.useState)(0),[J,K]=(0,e.useState)(!1),L=(0,e.useRef)(null),M=(0,e.useRef)(null),N=(0,e.useRef)(null),O=(0,e.useCallback)(()=>{let a=L.current;if(!a)return;a.style.height="auto";let b=Math.max(38,Math.min(a.scrollHeight,200));a.style.height=`${b}px`},[]);(0,e.useLayoutEffect)(()=>{O()},[p,O]),(0,e.useEffect)(()=>{r.t4.runPromiseExit((0,s.M5)()).then(a=>{"Success"===a._tag?A(a.value):console.error("Failed to load commands:",a.cause)})},[]);let P=(0,e.useCallback)(async()=>{let a=await r.t4.runPromiseExit((0,s.l1)());if("Success"===a._tag){let b=a.value.skills??a.value;C((Array.isArray(b)?b:[]).filter(a=>a.valid&&!!a.name).map(a=>({name:`/${a.name}`,description:a.description||"",source:"skill",skillPath:a.path,argumentHint:a.argumentHint})))}else console.error("Failed to load skills:",a.cause)},[]);(0,e.useEffect)(()=>(P(),(0,w.U)(P)),[P]);let Q=(0,e.useMemo)(()=>{let a=0===t?0:p.lastIndexOf("\n",t-1)+1,b=p.indexOf("\n",t),c=-1===b?p.length:b;return{text:p.slice(a,c),start:a,end:c}},[p,t]),R=(0,e.useMemo)(()=>{let a=Q.text.match(/^\s*([/@])([a-zA-Z0-9-]*)$/);return a?{marker:a[1],verb:a[2].toLowerCase()}:null},[Q.text]),S=(0,e.useMemo)(()=>g&&"claude"!==g?[]:[{name:"/plan",description:"Enable plan mode (read-only). /plan <task> to plan a task; /plan off to disable.",source:"builtin",argumentHint:"[task|off]"}],[g]),T=(0,e.useMemo)(()=>{if(!R)return[];let{verb:a}=R,b=b=>b.name.slice(1).toLowerCase().startsWith(a);return[...S.filter(b),...z.filter(b),...B.filter(b)]},[R,S,z,B]),U=!J&&!!R&&T.length>0,V=(0,e.useRef)(p);(0,e.useLayoutEffect)(()=>{V.current!==p&&(queueMicrotask(()=>I(0)),J&&queueMicrotask(()=>K(!1)),V.current=p)},[p,J]),(0,e.useLayoutEffect)(()=>{if(U&&M.current){let a=M.current.children[H];a&&a.scrollIntoView({block:"nearest"})}},[H,U]);let W=(0,e.useCallback)(()=>{let c=p.trim();(c||x.length>0)&&!b&&(a(c,x.length>0?x:void 0),q(""),y([]),L.current&&(L.current.style.height="auto"))},[p,x,b,a]),X=(0,e.useCallback)(c=>{b||a(c)},[b,a]),Y=(0,e.useCallback)(a=>{let b=R?.marker??"/",c=`${b}${a.name.slice(1)} `,d=p.slice(0,Q.start),e=d+c+p.slice(Q.end),f=d.length+c.length;q(e),u(f),requestAnimationFrame(()=>{let a=L.current;a&&(a.focus(),a.setSelectionRange(f,f))})},[p,Q,R]),Z=(0,e.useCallback)(a=>{if(!a.nativeEvent.isComposing){if(U&&T.length>0){if("ArrowDown"===a.key){a.preventDefault(),I(a=>(a+1)%T.length);return}if("ArrowUp"===a.key){a.preventDefault(),I(a=>(a-1+T.length)%T.length);return}if("Enter"===a.key){a.preventDefault(),Y(T[H]);return}if("Escape"===a.key){a.preventDefault(),K(!0);return}if("Tab"===a.key){a.preventDefault(),Y(T[H]);return}}"Enter"!==a.key||a.shiftKey||a.nativeEvent.isComposing||(a.preventDefault(),W())}},[U,T,H,Y,W]),$=(0,e.useCallback)(a=>{let b=a.clipboardData?.items;if(!b)return;let c=["image/png","image/jpeg","image/webp","image/gif"];for(let d of Array.from(b)){let b=c.find(a=>d.type===a);if(b){a.preventDefault();let c=d.getAsFile();if(!c)continue;if(c.size>5242880){alert(o("chat.imageSizeLimit",{size:(c.size/1024/1024).toFixed(2)}));continue}let e=new FileReader;e.onload=a=>{let c=a.target?.result;if(!c)return;let d=c.replace(/^data:image\/\w+;base64,/,""),e={id:`img-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,data:d,preview:c,media_type:b};y(a=>[...a,e])},e.readAsDataURL(c)}}},[o]),_=(0,e.useCallback)(a=>{y(b=>b.filter(b=>b.id!==a))},[]);return(0,d.jsxs)("div",{className:"border-t border-border bg-card relative",children:[(0,d.jsx)(j,{images:x,onRemove:_,disabled:b}),U&&T.length>0&&(0,d.jsx)("div",{ref:M,className:"absolute bottom-full left-0 right-0 mx-4 mb-2 max-h-64 overflow-y-auto bg-card border border-border rounded-lg shadow-lv2",children:T.map((a,b)=>{let c=b>0?T[b-1]:null,e="skill"===a.source&&(!c||"skill"!==c.source),f="skill"!==a.source&&0===b;return(0,d.jsxs)("div",{children:[f&&(0,d.jsx)("div",{className:"px-4 py-1 text-[10px] uppercase tracking-wider text-muted-foreground bg-muted/40",children:"Commands"}),e&&(0,d.jsx)("div",{className:"px-4 py-1 text-[10px] uppercase tracking-wider text-muted-foreground bg-muted/40",children:"Skills"}),(0,d.jsxs)("div",{onClick:()=>Y(a),className:`px-4 py-2 cursor-pointer ${b===H?"bg-brand/10":"hover:bg-hover"}`,children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("span",{className:"font-mono text-sm font-medium text-foreground",children:(R?.marker??"/")+a.name.slice(1)}),(0,d.jsx)("span",{className:"flex-1 text-sm text-muted-foreground truncate",children:"builtin"===a.source?o(`commands.${a.name.slice(1)}`,{defaultValue:a.description}):a.description}),(0,d.jsx)("span",{className:`text-xs px-1.5 py-0.5 rounded ${(a=>{switch(a){case"builtin":return"bg-brand/15 text-brand dark:bg-brand/25 dark:text-teal-11";case"skill":return"bg-purple-9/15 text-purple-11 dark:bg-purple-9/25 dark:text-purple-11"}})(a.source)}`,children:(a=>{switch(a){case"builtin":return o("common.builtin");case"skill":return"Skill"}})(a.source)})]}),"skill"===a.source&&a.argumentHint&&(0,d.jsx)("div",{className:"font-mono text-xs text-muted-foreground mt-0.5 pl-0 truncate",children:a.argumentHint})]})]},a.name)})}),(0,d.jsxs)("div",{className:"flex gap-2 items-end p-4",children:[h&&(0,d.jsx)("button",{onClick:h,className:"p-2 text-brand hover:text-teal-10 hover:bg-brand/10 active:bg-brand/20 active:scale-95 rounded-lg transition-all",title:o("chat.viewGitChanges"),children:(0,d.jsxs)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,d.jsx)("circle",{cx:"6",cy:"6",r:"2",strokeWidth:2}),(0,d.jsx)("circle",{cx:"18",cy:"6",r:"2",strokeWidth:2}),(0,d.jsx)("circle",{cx:"6",cy:"18",r:"2",strokeWidth:2}),(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 8v10M18 8v4c0 2-2 4-6 4"})]})}),i&&(0,d.jsx)("button",{onClick:i,className:"p-2 text-amber-11 hover:text-amber-10 hover:bg-amber-9/10 active:bg-amber-9/20 active:scale-95 rounded-lg transition-all",title:o("chat.viewAllComments"),children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})})}),l&&(0,d.jsx)("button",{onClick:l,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-hover active:bg-muted active:scale-95 rounded-lg transition-all",title:o("chat.userMessages"),children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})}),m&&(0,d.jsx)("button",{onClick:m,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-hover active:bg-muted active:scale-95 rounded-lg transition-all",title:o("chat.projectNotes"),children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),n&&(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("button",{onClick:()=>E(!D),className:`p-2 rounded-lg transition-all ${D?"text-brand bg-brand/10":"text-muted-foreground hover:text-foreground hover:bg-hover active:bg-muted active:scale-95"}`,title:o("chat.scheduledTasks"),children:(0,d.jsxs)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"10",strokeWidth:2}),(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6l4 2"})]})}),D&&(0,d.jsx)(k.E,{onClose:()=>E(!1),onCreate:n})]}),(0,d.jsxs)("div",{className:"relative",ref:N,children:[(0,d.jsx)("button",{onClick:()=>G(!F),className:`p-2 rounded-lg transition-all ${F?"text-brand bg-brand/10":"text-muted-foreground hover:text-foreground hover:bg-hover active:bg-muted active:scale-95"}`,title:o("chat.quickPrompts"),children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})})}),F&&(0,d.jsx)(v,{cwd:c,anchorRef:N,onClose:()=>G(!1),onSelect:X})]}),(0,d.jsx)("textarea",{ref:L,value:p,onChange:a=>{q(a.target.value),u(a.target.selectionStart??a.target.value.length)},onSelect:a=>u(a.currentTarget.selectionStart??0),onKeyDown:Z,onPaste:$,placeholder:b?o("chat.placeholderDisabled"):o("chat.placeholder"),rows:1,className:"flex-1 resize-none px-4 py-2 border border-border rounded-lg focus:outline-none focus:ring-2 focus:ring-ring bg-card text-foreground"})]})]})})},36984:(a,b,c)=>{"use strict";c.d(b,{Np:()=>k,ZD:()=>h,ZR:()=>i,b8:()=>j,kS:()=>f,sQ:()=>g});let d=null,e=["typescript","tsx","javascript","jsx","html","css","scss","json","yaml","python","go","rust","java","ruby","php","bash","shell","markdown","sql","c","cpp","swift","kotlin","dart","lua","graphql","xml"];function f(){return d||(d=Promise.resolve().then(c.bind(c,78908)).then(({createHighlighter:a})=>a({themes:["github-dark","github-light"],langs:[...e]}))),d}function g(a){let b=a.split("/").pop()?.toLowerCase()||"",c=b.split(".").pop()?.toLowerCase();if(".env"===b||b.startsWith(".env.")||"dockerfile"===b||b.startsWith("dockerfile.")||"makefile"===b)return"bash";let d={ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",mjs:"javascript",cjs:"javascript",html:"html",htm:"html",css:"css",scss:"scss",json:"json",yaml:"yaml",yml:"yaml",xml:"xml",py:"python",go:"go",rs:"rust",java:"java",kt:"kotlin",rb:"ruby",php:"php",cs:"cpp",cpp:"cpp",c:"c",h:"c",sh:"bash",bash:"bash",zsh:"bash",md:"markdown",mdx:"markdown",sql:"sql",swift:"swift",dart:"dart",lua:"lua",graphql:"graphql",gql:"graphql",toml:"yaml",sass:"scss",less:"css",scala:"java",r:"python",vim:"bash",env:"bash"}[c||""]||"text";return e.includes(d)?d:"text"}function h(a){return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}let i=2e3;function j(a){return a.length>i?h(a.map(a=>a.content).join("")):a.map(a=>a.color?`<span style="color:${a.color}">${h(a.content)}</span>`:h(a.content)).join("")}function k(a,b,c,d){if(!b)return[];let e=[],f=c?b:b.toLowerCase();for(let b=0;b<a.length;b++){let g=c?a[b]:a[b].toLowerCase(),h=0;for(;;){let a=g.indexOf(f,h);if(-1===a)break;let c=a+f.length;if(d){let d=a>0?g[a-1]:" ",f=c<g.length?g[c]:" ",h=!/\w/.test(d),i=!/\w/.test(f);h&&i&&e.push({lineIndex:b,startCol:a,endCol:c})}else e.push({lineIndex:b,startCol:a,endCol:c});h=a+1}}return e}},37129:(a,b,c)=>{"use strict";c.d(b,{useTabState:()=>l});var d=c(67484),e=c(23860),f=c(29939);c(57031),c(88214);var g=c(79606),h=c(33281),i=c(37388);let j=/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:\.jsonl)?$/i;function k(a){let b=a.match(j);return b?.[1]??a}function l({initialCwd:a,initialSessionId:b,activeView:c}){(0,d.useRef)(!1);let j=(0,d.useRef)(!0),[m,n]=(0,d.useState)(!1);(0,d.useCallback)(()=>{j.current=!1,n(!0)},[]);let o=(0,d.useRef)(c),p=(0,e.F)(),q=(0,d.useRef)(p),[r,s]=(0,d.useState)(()=>[{id:`tab-${Date.now()}`,cwd:a,sessionId:b,title:b?`Session ${b.slice(0,6)}...`:"New Chat"}]),[t,u]=(0,d.useState)(r[0]?.id??""),[v,w]=(0,d.useState)(new Set),x=(0,d.useRef)(r),y=(0,d.useRef)(t),z=(0,d.useRef)(new Set),A=(0,d.useCallback)((b,c)=>{a&&b&&h.t4.runFork((0,i.KJ)(a,b,c).pipe(g.catchAll(()=>g.void)))},[a]),[B,C]=(0,d.useState)(null),[D,E]=(0,d.useState)(null),F=(0,d.useCallback)(b=>{a&&h.t4.runPromise((0,i.n8)(a).pipe(g.catchAll(()=>g.succeed(null)))).then(c=>{if(!c)return;let d=c.engines||{},e={};for(let[a,b]of Object.entries(d))e["codex"===b?k(a):a]=b;let f=[];for(let a of c.sessions||[]){let b="codex"===d[a]?k(a):a;f.includes(b)||f.push(b)}let g=c.ollamaModels||{},h=c.deepseekModels||{},i=c.kimiModels||{},j=c.glmModels||{},l=c.claudeModels||{},m=c.claudeEfforts||{},n=c.claudeContextWindows||{},o=c.claudeFastModes||{},p=c.claudeThinkings||{},q=c.codexModels||{},r=c.codexReasoningEfforts||{},t=c.planModes||{},v=c.noHistories||{},w=x.current,z=new Set(b),A=w.filter(a=>!a.sessionId||!z.has(a.sessionId)),B=new Set(A.map(a=>a.sessionId).filter(Boolean)),C=f.filter(a=>!B.has(a));if(A.length===w.length&&0===C.length)return;let D=[...A,...C.map((b,c)=>({id:`tab-${Date.now()}-sync-${c}`,cwd:a,sessionId:b,title:`Session ${b.slice(0,6)}...`,engine:e[b]||void 0,ollamaModel:g[b]||void 0,deepseekModel:h[b]||void 0,kimiModel:i[b]||void 0,glmModel:j[b]||void 0,claudeModel:l[b]||void 0,claudeEffort:m[b]||void 0,claudeContextWindow:n[b]||void 0,claudeFastMode:o[b]??void 0,claudeThinking:p[b]??void 0,codexModel:q[b]||void 0,codexReasoningEffort:r[b]||void 0,planMode:t[b]||void 0,noHistory:v[b]||void 0}))];0===D.length&&(D=[{id:`tab-${Date.now()}`,cwd:a,title:"New Chat"}]),s(D),D.some(a=>a.id===y.current)||u(D[D.length-1].id)})},[a]);(0,f.h)({url:"/ws/global-state",enabled:!!a,onMessage:b=>{j.current||!a||"project-state-changed"===b.type&&b.cwd===a&&F(b.closedSessionIds??[])}});let G=(0,d.useCallback)((a,b,c,d)=>{let{engine:e,ollamaModel:f,deepseekModel:g,kimiModel:h,glmModel:i,claudeModel:j,claudeEffort:k,claudeContextWindow:l,claudeFastMode:m,claudeThinking:n,codexModel:o,codexReasoningEffort:p,planMode:q,noHistory:r,appendToEnd:v=!1}=d??{},w={id:`tab-${Date.now()}`,cwd:a,sessionId:b,title:c||(b?`Session ${b.slice(0,6)}...`:"New Chat"),engine:e,ollamaModel:f,deepseekModel:g,kimiModel:h,glmModel:i,claudeModel:j,claudeEffort:k,claudeContextWindow:l,claudeFastMode:m,claudeThinking:n,codexModel:o,codexReasoningEffort:p,planMode:q,noHistory:r};s(a=>{if(v)return[...a,w];let b=a.findIndex(a=>a.id===t);if(-1===b)return[...a,w];let c=[...a];return c.splice(b+1,0,w),c}),u(w.id)},[t]),H=(0,d.useCallback)(b=>{let c=x.current.find(a=>a.id===b);c?.sessionId&&z.current.add(c.sessionId),s(c=>{let d=c.filter(a=>a.id!==b);if(b===t&&d.length>0&&u(d[d.length-1].id),0===d.length){let b={id:`tab-${Date.now()}`,cwd:a,title:"New Chat"};return u(b.id),[b]}return d})},[t,a]),I=(0,d.useCallback)(()=>{x.current.forEach(a=>{a.sessionId&&z.current.add(a.sessionId)});let b={id:`tab-${Date.now()}`,cwd:a,title:"New Chat"};u(b.id),s([b])},[a]),J=(0,d.useCallback)((b,c)=>{let d=r.find(a=>a.sessionId===b);d?u(d.id):a?h.t4.runPromise((0,i.n8)(a).pipe(g.catchAll(()=>g.succeed(null)))).then(d=>{let e=x.current.find(a=>a.sessionId===b);e?u(e.id):G(a,b,c,{engine:d?.engines?.[b],ollamaModel:d?.ollamaModels?.[b],deepseekModel:d?.deepseekModels?.[b],kimiModel:d?.kimiModels?.[b],glmModel:d?.glmModels?.[b],claudeModel:d?.claudeModels?.[b],claudeEffort:d?.claudeEfforts?.[b],claudeContextWindow:d?.claudeContextWindows?.[b],claudeFastMode:d?.claudeFastModes?.[b],claudeThinking:d?.claudeThinkings?.[b],codexModel:d?.codexModels?.[b],codexReasoningEffort:d?.codexReasoningEfforts?.[b],planMode:d?.planModes?.[b],noHistory:d?.noHistories?.[b],appendToEnd:!0})}):G(a,b,c,{appendToEnd:!0})},[r,a,G]),K=(0,d.useCallback)(()=>{G(a,void 0,void 0,{appendToEnd:!0})},[a,G]),L=(0,d.useCallback)(()=>{G(a,void 0,"New Codex Chat",{engine:"codex",appendToEnd:!0})},[a,G]),M=(0,d.useCallback)(()=>{G(a,void 0,"New Kimi Chat",{engine:"kimi",kimiModel:"k3",appendToEnd:!0})},[a,G]),N=(0,d.useCallback)(()=>{G(a,void 0,"New GLM Chat",{engine:"glm",glmModel:"glm-5.3",appendToEnd:!0})},[a,G]),O=(0,d.useCallback)(b=>{G(a,void 0,b?`New Ollama (${b})`:"New Ollama Chat",{engine:"ollama",ollamaModel:b,appendToEnd:!0})},[a,G]),P=(0,d.useCallback)((a,b)=>{s(c=>c.map(c=>c.id===a&&c.engine!==b?{...c,engine:b}:c))},[]),Q=(0,d.useCallback)((a,b)=>{s(c=>c.map(c=>c.id===a?{...c,ollamaModel:b}:c))},[]),R=(0,d.useCallback)(()=>{G(a,void 0,"New DeepSeek Chat",{engine:"deepseek",deepseekModel:"deepseek-v4-flash",appendToEnd:!0})},[a,G]),S=(0,d.useCallback)((a,b)=>{s(c=>c.map(c=>c.id===a?{...c,deepseekModel:b}:c))},[]),T=(0,d.useCallback)((a,b)=>{s(c=>c.map(c=>c.id===a?{...c,kimiModel:b}:c))},[]),U=(0,d.useCallback)((a,b)=>{s(c=>c.map(c=>c.id===a?{...c,glmModel:b}:c))},[]),V=(0,d.useCallback)((a,b)=>{s(c=>c.map(c=>c.id===a?{...c,claudeModel:b}:c))},[]),W=(0,d.useCallback)((a,b)=>{s(c=>c.map(c=>c.id===a?{...c,claudeEffort:b}:c))},[]),X=(0,d.useCallback)((a,b)=>{s(c=>c.map(c=>c.id===a?{...c,claudeContextWindow:b}:c))},[]),Y=(0,d.useCallback)((a,b)=>{s(c=>c.map(c=>c.id===a?{...c,claudeFastMode:b}:c))},[]),Z=(0,d.useCallback)((a,b)=>{s(c=>c.map(c=>c.id===a?{...c,claudeThinking:b}:c))},[]),$=(0,d.useCallback)((a,b)=>{s(c=>c.map(c=>c.id===a?{...c,codexModel:b}:c))},[]),_=(0,d.useCallback)((a,b)=>{s(c=>c.map(c=>c.id===a?{...c,codexReasoningEffort:b}:c))},[]),aa=(0,d.useCallback)((a,b)=>{s(c=>c.map(c=>c.id===a?{...c,planMode:b}:c))},[]),ab=(0,d.useCallback)((a,b)=>{s(c=>c.map(c=>c.id===a?{...c,noHistory:b}:c))},[]),ac=(0,d.useCallback)((b,c)=>{let d=x.current.find(a=>a.id===y.current);G(a,b,c,{engine:d?.engine,ollamaModel:d?.ollamaModel,deepseekModel:d?.deepseekModel,kimiModel:d?.kimiModel,glmModel:d?.glmModel,claudeModel:d?.claudeModel,claudeEffort:d?.claudeEffort,claudeContextWindow:d?.claudeContextWindow,claudeFastMode:d?.claudeFastMode,claudeThinking:d?.claudeThinking,codexModel:d?.codexModel,codexReasoningEffort:d?.codexReasoningEffort})},[a,G]),ad=(0,d.useCallback)((a,b)=>{s(c=>{let d=c.find(b=>b.id===a);if(d?.isLoading&&!1===b.isLoading){let c=!o.current||"agent"===o.current;if(a===t&&c&&q.current){let a=d.sessionId||b.sessionId;a&&A(a,"normal")}else w(b=>new Set(b).add(a))}return c.map(c=>c.id===a?{...c,...b}:c)})},[t,A]),ae=(0,d.useCallback)(a=>{u(a),w(b=>{if(!b.has(a))return b;let c=new Set(b);c.delete(a);let d=x.current.find(b=>b.id===a);return d?.sessionId&&(A(d.sessionId,"normal"),h.t4.runFork((0,i.M2)(d.sessionId).pipe(g.catchAll(()=>g.void)))),c})},[A]),af=(0,d.useCallback)(a=>{C(a)},[]),ag=(0,d.useCallback)((a,b)=>{a.preventDefault(),null!==B&&B!==b&&E(b)},[B]),ah=(0,d.useCallback)(a=>{null!==B&&B!==a&&s(b=>{let c=[...b],[d]=c.splice(B,1);return c.splice(a,0,d),c}),C(null),E(null)},[B]),ai=(0,d.useCallback)(()=>{C(null),E(null)},[]),aj=r.find(a=>a.id===t);return{tabs:r,activeTabId:t,activeTab:aj,unreadTabs:v,dragTabIndex:B,dragOverTabIndex:D,addTab:G,closeTab:H,closeAllTabs:I,switchTab:ae,handleSelectSession:J,handleNewTab:K,handleNewCodexTab:L,handleNewKimiTab:M,handleNewGlmTab:N,handleNewOllamaTab:O,handleNewDeepseekTab:R,handleOpenSession:ac,updateTabState:ad,updateTabEngine:P,updateTabOllamaModel:Q,updateTabDeepseekModel:S,updateTabKimiModel:T,updateTabGlmModel:U,updateTabClaudeModel:V,updateTabClaudeEffort:W,updateTabClaudeContextWindow:X,updateTabClaudeFastMode:Y,updateTabClaudeThinking:Z,updateTabCodexModel:$,updateTabCodexReasoningEffort:_,updateTabPlanMode:aa,updateTabNoHistory:ab,handleTabDragStart:af,handleTabDragOver:ag,handleTabDrop:ah,handleTabDragEnd:ai}}},37202:(a,b,c)=>{"use strict";c.d(b,{M:()=>n,O:()=>l});var d=c(48249),e=c(67484),f=c(44384),g=c(74429),h=c(74228);let i=[],j=[];function k(){j.forEach(a=>a())}function l(a){let b=`session-toast-${Date.now()}-${Math.random().toString(36).slice(2,6)}`;i=[...i,{...a,id:b}],k()}function m(a){i=i.filter(b=>b.id!==a),k()}function n({onNavigate:a}){let b=function(){let[,a]=(0,e.useState)(0);return i}();return 0===b.length?null:(0,g.createPortal)((0,d.jsx)("div",{className:"fixed bottom-4 left-4 z-[100] flex flex-col gap-2 pointer-events-none",children:b.map(b=>(0,d.jsx)(o,{item:b,onNavigate:a,onRemove:m},b.id))}),document.body)}function o({item:a,onNavigate:b,onRemove:c}){let{t:g}=(0,f.Bd)(),[i,j]=(0,e.useState)(!1),k=(0,e.useRef)(void 0),l=(0,e.useCallback)(()=>{j(!0),setTimeout(()=>c(a.id),300)},[a.id,c]),m=(0,e.useCallback)(()=>{clearTimeout(k.current),b(a.cwd,a.sessionId),c(a.id)},[a,b,c]),n=(0,e.useCallback)(()=>{clearTimeout(k.current)},[]),p=(0,e.useCallback)(()=>{k.current=setTimeout(l,2e3)},[l]);return(0,d.jsxs)("div",{className:`group pointer-events-auto relative bg-popover border border-border rounded-lg shadow-lv3 px-3 py-3 min-h-[84px] min-w-[260px] max-w-[340px] cursor-pointer transition-all ${i?"opacity-0 -translate-x-4":"opacity-100 translate-x-0"}`,style:{animation:i?void 0:"slideInLeft 0.3s ease-out"},onClick:m,onMouseEnter:n,onMouseLeave:p,children:[(0,d.jsx)("div",{className:"pointer-events-none absolute inset-0 rounded-lg bg-hover opacity-0 group-hover:opacity-100 transition-opacity"}),(0,d.jsxs)("div",{className:"relative flex items-start gap-2",children:[(0,d.jsx)("svg",{className:"w-4 h-4 text-green-9 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),(0,d.jsx)("span",{className:"text-sm font-medium text-foreground truncate",children:a.projectName}),(0,d.jsx)("span",{className:"text-xs text-green-11 flex-shrink-0",children:g("common.done")}),(0,d.jsx)(h.l,{projectNumber:a.projectNumber,sessionNumber:a.sessionNumber,className:"ml-auto"}),(0,d.jsx)("button",{onClick:a=>{a.stopPropagation(),l()},className:"p-0.5 text-muted-foreground hover:text-foreground rounded transition-colors",children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),a.message&&(0,d.jsx)("div",{className:"relative text-xs text-muted-foreground line-clamp-2 break-words mt-1 ml-6",children:a.message})]})}},37388:(a,b,c)=>{"use strict";c.d(b,{KJ:()=>h,M2:()=>i,ej:()=>g,n8:()=>f});var d=c(79606),e=c(71192);let f=a=>d.tryPromise({try:async()=>{let b=await fetch(`/api/project-state?cwd=${encodeURIComponent(a)}`);if(!b.ok)throw Error(`HTTP ${b.status}`);return await b.json()},catch:a=>new e.uV({message:"loadProjectState failed",cause:a})}),g=a=>d.tryPromise({try:async()=>{let b=await fetch("/api/project-state",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!b.ok)throw Error(`HTTP ${b.status}`)},catch:a=>new e.uV({message:"saveProjectState failed",cause:a})}),h=(a,b,c)=>d.tryPromise({try:async()=>{let d=await fetch("/api/global-state",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,sessionId:b,status:c})});if(!d.ok)throw Error(`HTTP ${d.status}`)},catch:a=>new e.uV({message:"updateSessionStatus failed",cause:a})}),i=a=>d.tryPromise({try:async()=>{let b=await fetch("/api/scheduled-tasks",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"markReadBySessionId",fields:{sessionId:a}})});if(!b.ok)throw Error(`HTTP ${b.status}`)},catch:a=>new e.uV({message:"markScheduledTasksReadBySession failed",cause:a})})},37690:(a,b,c)=>{"use strict";c.d(b,{L:()=>e});var d=c(67484);function e({enabled:a,container:b,resolveLineRange:c,buildLineSnapshot:f,dragThresholdPx:g=5}){let h=(0,d.useRef)(null),i=(0,d.useRef)(()=>{}),j=(0,d.useRef)(c),k=(0,d.useRef)(f),l=(0,d.useRef)(g);return j.current=c,k.current=f,l.current=g,{toolbarRef:h,bumpRef:i,clearToolbar:()=>{h.current&&(h.current=null,i.current())}}}},37701:(a,b,c)=>{"use strict";c.d(b,{Fe:()=>d,Ff:()=>h,Z8:()=>g,wL:()=>e});let d=a=>a?.toLowerCase().startsWith("zh")?"zh":"en",e=(a,b)=>{if(!a||"object"!=typeof a)return null;let c=a.quickReplies;return c&&"object"==typeof c?(a=>{if(!Array.isArray(a))return null;let b=[];for(let c of a.slice(0,12)){if(!Array.isArray(c))continue;let a=[];for(let b of c.slice(0,8)){if("string"!=typeof b)continue;let c=b.trim().slice(0,200);c&&a.push(c)}a.length&&b.push(a)}return b.length?b:null})(c[b]):null},f=/[,,]/,g=a=>a.split("\n").map(a=>a.split(f).map(a=>a.trim().slice(0,200)).filter(Boolean).slice(0,8)).filter(a=>a.length>0).slice(0,12),h=(a,b)=>a.map(a=>a.join("zh"===b?",":", ")).join("\n")},38878:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{TabManagerTopBar:()=>u});var e=c(48249),f=c(67484),g=c(94192),h=c(12568),i=c(7833),j=c(44384),k=c(57031),l=c(88214),m=c(79606),n=c(33281),o=c(85655),p=c(35606),q=c(65484);function r({className:a}){return(0,e.jsxs)("svg",{className:a,fill:"none",viewBox:"0 0 100 100","aria-hidden":"true",children:[(0,e.jsx)("path",{fill:"#0065A9",d:"M96.461 10.796 75.857.876a6.23 6.23 0 0 0-7.107 1.207l-67.451 61.5a4.167 4.167 0 0 0 .004 6.162l5.51 5.009a4.167 4.167 0 0 0 5.32.236l81.228-61.62c2.725-2.067 6.639-.124 6.639 3.297v-.24a6.25 6.25 0 0 0-3.539-5.63Z"}),(0,e.jsx)("path",{fill:"#007ACC",d:"m96.461 89.204-20.604 9.92a6.229 6.229 0 0 1-7.107-1.207l-67.451-61.5a4.167 4.167 0 0 1 .004-6.162l5.51-5.009a4.167 4.167 0 0 1 5.32-.236l81.228 61.62c2.725 2.067 6.639.124 6.639-3.297v.24a6.25 6.25 0 0 0-3.539 5.63Z"}),(0,e.jsx)("path",{fill:"#1F9CF0",d:"M75.858 99.126a6.232 6.232 0 0 1-7.108-1.21c2.306 2.307 6.25.674 6.25-2.588V4.672c0-3.262-3.944-4.895-6.25-2.589a6.232 6.232 0 0 1 7.108-1.21l20.6 9.908A6.25 6.25 0 0 1 100 16.413v67.174a6.25 6.25 0 0 1-3.541 5.633l-20.601 9.906Z"})]})}function s({className:a}){return(0,e.jsx)("svg",{className:a,viewBox:"0 0 466.73 532.09",fill:"currentColor","aria-hidden":"true",children:(0,e.jsx)("path",{d:"M457.43,125.94L244.42,2.96c-6.84-3.95-15.28-3.95-22.12,0L9.3,125.94c-5.75,3.32-9.3,9.46-9.3,16.11v247.99c0,6.65,3.55,12.79,9.3,16.11l213.01,122.98c6.84,3.95,15.28,3.95,22.12,0l213.01-122.98c5.75-3.32,9.3-9.46,9.3-16.11v-247.99c0-6.65-3.55-12.79-9.3-16.11h-.01ZM444.05,151.99l-205.63,356.16c-1.39,2.4-5.06,1.42-5.06-1.36v-233.21c0-4.66-2.49-8.97-6.53-11.31L24.87,145.67c-2.4-1.39-1.42-5.06,1.36-5.06h411.26c5.84,0,9.49,6.33,6.57,11.39h-.01Z"})})}function t({cwd:a,currentBranch:b,onSwitched:c}){let{t:d}=(0,j.Bd)(),[g,h]=(0,f.useState)(!1),[k,l]=(0,f.useState)([]),[m,p]=(0,f.useState)(!1),[r,s]=(0,f.useState)(!1),[u,v]=(0,f.useState)(""),w=(0,f.useRef)(null),x=(0,f.useRef)(null),y=(0,f.useCallback)(async()=>{p(!0);let b=await n.t4.runPromiseExit((0,o.r4)(a));if("Success"===b._tag){let a=b.value,c=a.local??[],d=a.remote??[],e=[...c,...d.filter(a=>!c.includes(a.replace(/^origin\//,"")))];l(e)}else(0,i.oR)(d("toast.loadBranchFailed"),"error");p(!1)},[a,d]),z=(0,f.useCallback)(()=>{h(!0),v(""),y()},[y]),A=(0,f.useCallback)(()=>{h(!1)},[]),B=async b=>{s(!0);let e=await n.t4.runPromiseExit((0,q.Kl)({action:"checkout",cwd:a,path:a,branch:b}));if("Success"===e._tag){let a=b.replace(/^origin\//,"");(0,i.oR)(d("toast.switchedToBranch",{branch:a}),"success"),A(),c()}else{let a="Fail"===e.cause._tag?e.cause.error:null,b=a?.cause,c=b instanceof Error?b.message:d("toast.switchBranchFailed");(0,i.oR)(c,"error")}s(!1)},C=k.filter(a=>a!==b&&a.toLowerCase().includes(u.toLowerCase()));return(0,e.jsxs)("div",{className:"relative",ref:w,children:[(0,e.jsx)("button",{onClick:g?A:z,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-hover rounded transition-colors",title:d("git.switchBranch"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4"})})}),g&&(0,e.jsxs)("div",{className:"absolute top-full left-0 mt-1 w-64 bg-popover border border-border rounded-lg shadow-lv2 z-50 overflow-hidden",children:[(0,e.jsx)("div",{className:"p-2 border-b border-border",children:(0,e.jsx)("input",{ref:x,type:"text",value:u,onChange:a=>v(a.target.value),placeholder:d("git.searchBranch"),className:"w-full px-2.5 py-1.5 text-sm bg-muted rounded border-none outline-none",onKeyDown:a=>{"Escape"===a.key&&A()}})}),(0,e.jsx)("div",{className:"max-h-60 overflow-y-auto p-1",children:m?(0,e.jsx)("div",{className:"text-xs text-muted-foreground text-center py-4",children:d("common.loading")}):0===C.length?(0,e.jsx)("div",{className:"text-xs text-muted-foreground text-center py-4",children:u?d("git.noMatchingBranches"):d("git.noBranches")}):C.map(a=>(0,e.jsx)("button",{onClick:()=>B(a),disabled:r,className:"w-full text-left px-2.5 py-1.5 text-sm rounded hover:bg-hover transition-colors truncate disabled:opacity-50",children:(0,e.jsx)("span",{className:a.startsWith("origin/")?"text-muted-foreground":"text-foreground",children:a})},a))})]})]})}function u({initialCwd:a,activeTab:b,isGitRepo:c,currentBranch:d,onOpenWorktree:f,onOpenAliasManager:o,onBranchSwitched:v}){let{t:w}=(0,j.Bd)(),x=b?.sessionId?(0,p.X)(b.engine,b.sessionId):null;return(0,e.jsx)("div",{className:"border-b border-border bg-card shrink-0",children:(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 relative",children:[(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("img",{src:"/icons/icon-72x72.png",alt:"Cockpit",className:"w-6 h-6 cursor-pointer",title:w("tabManagerTopBar.copyPageUrl"),onClick:()=>{navigator.clipboard.writeText(window.location.href).then(()=>{(0,i.oR)(w("toast.copiedPageUrl"),"success")})}}),a?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"text-sm text-foreground max-w-md truncate cursor-help","data-tooltip":`CWD: ${a}`,children:a}),(0,e.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(a),(0,i.oR)(w("toast.copiedDirPath"))},className:"p-1 text-muted-foreground hover:text-foreground hover:bg-hover rounded transition-colors",title:w("tabManagerTopBar.copyDirPath"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]}):(0,e.jsx)("h1",{className:"text-lg font-semibold text-foreground",children:"Cockpit"})]}),c&&a&&(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsxs)("button",{onClick:f,className:"flex items-center gap-1.5 px-2 py-1.5 text-muted-foreground hover:text-foreground hover:bg-hover rounded-lg transition-colors",title:"Git Worktrees",children:[(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 17h8m0 0l-4-4m4 4l-4 4M3 7v6a4 4 0 004 4h5"})}),(0,e.jsx)("span",{className:"text-sm",children:d||"main"})]}),(0,e.jsx)(t,{cwd:a,currentBranch:d,onSwitched:()=>v?.()})]})]}),(0,e.jsx)("div",{className:"absolute left-1/2 -translate-x-1/2",children:(0,e.jsx)(g.gT,{})}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(h.ReviewDropdown,{cwd:a}),(0,e.jsx)("button",{onClick:()=>window.location.reload(),className:"p-2 text-muted-foreground hover:text-foreground hover:bg-hover rounded-lg transition-colors",title:w("tabManagerTopBar.refreshProject"),children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}),(0,e.jsx)("button",{onClick:()=>{b?.cwd&&n.t4.runFork((0,q.em)(b.cwd).pipe(m.orElse(()=>m.void)))},className:"p-2 text-muted-foreground hover:text-foreground hover:bg-hover rounded-lg transition-colors",title:w("tabManagerTopBar.openInVSCode"),children:(0,e.jsx)(r,{className:"w-4 h-4"})}),(0,e.jsx)("button",{onClick:()=>{b?.cwd&&n.t4.runFork((0,q.Q1)(b.cwd).pipe(m.orElse(()=>m.void)))},className:"p-2 text-muted-foreground hover:text-foreground hover:bg-hover rounded-lg transition-colors",title:w("tabManagerTopBar.openInCursor"),children:(0,e.jsx)(s,{className:"w-4 h-4"})}),x&&(0,e.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(x).then(()=>{(0,i.oR)(w("toast.copiedCommand",{command:x}),"success")})},className:"p-2 text-muted-foreground hover:text-foreground hover:bg-hover rounded-lg transition-colors",title:w("chat.copyCommandTooltip",{command:x}),children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),(0,e.jsx)("button",{onClick:o,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-hover rounded-lg transition-colors",title:w("tabManagerTopBar.aliasesGlobal"),children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M16 12h-6m-4 0a8 8 0 1116 0 8 8 0 01-16 0zm4 0h.01"})})}),(0,e.jsx)("button",{onClick:()=>(0,k.F)(l.n.OpenTokenStats,{}),className:"p-2 text-muted-foreground hover:text-foreground hover:bg-hover rounded-lg transition-colors",title:w("tabManagerTopBar.tokenStats"),children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"})})}),(0,e.jsx)("button",{onClick:()=>window.open("https://surething.io?from=cockpit","_blank"),className:"p-2 text-muted-foreground hover:text-foreground hover:bg-hover rounded-lg transition-colors",title:w("tabManagerTopBar.openSurething"),children:(0,e.jsx)("img",{src:"https://surething.io/logo.png?from=cockpit",alt:"Surething",className:"w-5 h-5 rounded-sm"})})]})]})})}d()}catch(a){d(a)}})},38896:(a,b,c)=>{"use strict";c.d(b,{C:()=>f});var d=c(67484),e=c(36984);function f(a,b){let[c,f]=(0,d.useState)(null),[g,h]=(0,d.useState)(!1),i=(0,d.useMemo)(()=>a.join("\n"),[a]),j=`${i}:${b}:${g}`;return(0,d.useMemo)(()=>c&&c.key===j?c.html:a.map(a=>(0,e.ZD)(a||" ")),[a,j,c])}},39031:(a,b,c)=>{"use strict";c.d(b,{IS:()=>h});var d=c(32891),e=c(10259),f=c(87748);let g=new Set(["taskItem","listItem"]),h=d.YY.create({name:"dropShellCleanup",addProseMirrorPlugins:()=>[new e.k_({key:new e.hs("dropShellCleanup"),appendTransaction(a,b,c){let d=[];if(a.forEach((b,c)=>{let e;if("drop"!==b.getMeta("uiEvent")||!b.docChanged)return;let g=(e=[],b.steps.forEach((a,c)=>{a instanceof f.Ln&&(0!==a.slice.size||a.from>=a.to||e.push(b.mapping.slice(c+1).map(a.from)))}),e);for(let b=c+1;b<a.length;b++)g=g.map(c=>a[b].mapping.map(c));d.push(...g)}),0===d.length)return null;let e=c.tr,h=!1;for(let a of d){let b=function(a,b){if(b<0||b>a.content.size)return null;let c=a.resolve(b);for(let a=c.depth;a>0;a--){var d;if(d=c.node(a),!g.has(d.type.name)||1!==d.childCount||null===d.firstChild||!d.firstChild.isTextblock||0!==d.firstChild.content.size)continue;let b=a;for(;b>1&&1===c.node(b-1).childCount;)b--;return{from:c.before(b),to:c.after(b)}}return null}(e.doc,e.mapping.map(a));if(b)try{e.delete(b.from,b.to),h=!0}catch{}}return h?e:null}})]})},39238:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{N:()=>r});var e=c(48249),f=c(67484),g=c(44384),h=c(44256),i=c(7833),j=c(64825),k=c(66400),l=c(86588),m=c(64676),n=c(40893),o=c(6478),p=c(48587),q=a([p]);function r({filePath:a,content:b,cwd:c,onClose:d,onContentSearch:q}){let{t:s}=(0,g.Bd)(),t=(0,o.P)(),[u,v]=(0,f.useState)("preview");return(0,e.jsx)(h.ZL,{children:(0,e.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-scrim p-0 md:p-4",onClick:d,children:(0,e.jsxs)("div",{className:"bg-card shadow-lv3 w-full h-full rounded-none md:max-w-[90%] md:h-[90vh] md:rounded-lg flex flex-col relative overflow-hidden",onClick:a=>a.stopPropagation(),children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3 px-4 py-2 border-b border-border flex-shrink-0",children:[(0,e.jsxs)("span",{className:"text-sm text-muted-foreground truncate min-w-0 flex-1 cursor-pointer hover:text-foreground transition-colors",style:{direction:"rtl",textAlign:"left"},"data-tooltip":a,onClick:()=>{navigator.clipboard.writeText(a),(0,i.oR)(s("common.copiedPath"))},children:["‎",a]}),(0,e.jsx)("button",{onClick:()=>v(a=>"preview"===a?"source":"preview"),className:`px-1.5 py-0.5 text-xs rounded transition-colors flex-shrink-0 ${"preview"===u?"bg-brand text-white":"text-muted-foreground hover:bg-hover"}`,children:"preview"===u?s("fileBrowser.exitPreview"):s("common.preview")}),(0,e.jsx)("button",{onClick:()=>t(a),title:s("htmlApps.addTooltip"),className:"text-muted-foreground hover:text-foreground px-1.5 py-0.5 rounded hover:bg-hover transition-colors flex-shrink-0",children:(0,e.jsx)(j.A,{className:"w-4 h-4"})}),(0,e.jsx)("button",{onClick:()=>{window.dispatchEvent(new CustomEvent("console-open-browser",{detail:{url:a}})),d()},title:s("common.openInConsole"),className:"text-muted-foreground hover:text-foreground px-1.5 py-0.5 rounded hover:bg-hover transition-colors flex-shrink-0",children:(0,e.jsx)(k.A,{className:"w-4 h-4"})}),(0,e.jsx)("button",{onClick:()=>{let b=(0,m.Xe)(a,c);window.open((0,m.PB)(b,window.location.origin),"_blank")},title:s("browser.openInNewWindow"),className:"text-muted-foreground hover:text-foreground px-1.5 py-0.5 rounded hover:bg-hover transition-colors flex-shrink-0",children:(0,e.jsx)(l.A,{className:"w-4 h-4"})}),(0,e.jsx)("button",{onClick:d,className:"text-muted-foreground hover:text-foreground px-1.5 py-0.5 rounded hover:bg-hover transition-colors flex-shrink-0",children:"✕"})]}),(0,e.jsx)("div",{className:"flex-1 overflow-hidden",children:"preview"===u?(0,e.jsx)(n.O,{content:b,filePath:a,cwd:c,onContentSearch:q?a=>{q(a),d()}:void 0}):(0,e.jsx)(p.y,{entryPath:a,entryContent:b,cwd:c})})]})})})}p=(q.then?(await q)():q)[0],d()}catch(a){d(a)}})},39247:(a,b,c)=>{"use strict";c.d(b,{h:()=>e});let d=new Set(["Read","Grep","Glob","LS","WebSearch","WebFetch","NotebookRead","TodoRead","AskUserQuestion","ExitPlanMode","TodoWrite","Skill"]),e=a=>!d.has(a)},40159:(a,b,c)=>{"use strict";c.d(b,{S:()=>l,j:()=>k});var d=c(48249),e=c(67484),f=c(44384),g=c(208),h=c(44256),i=c(89719);function j({blame:a,onClick:b}){let{t:c}=(0,f.Bd)(),i=(0,e.useRef)(null),k=(0,e.useRef)(null),l=(0,h.F2)(),m=(0,e.useRef)(!1),n=(0,e.useRef)(!1),o=(0,e.useRef)(null),p=(0,e.useRef)(null),q=(0,e.useRef)(null),r=(0,e.useRef)(a),s=(0,e.useRef)(b),t=(0,e.useCallback)(()=>{let a,b=k.current,c=i.current;if(!b||!c)return;let d=c.getBoundingClientRect(),e=b.getBoundingClientRect(),f=l?.getBoundingClientRect(),g=f?.left??0,h=f?.top??0,j=f?.width??window.innerWidth,m=f?.height??window.innerHeight,n=d.left-g;n+e.width>j-8&&(n=j-e.width-8),n<8&&(n=8);let o=d.top-h,p=d.bottom-h;(a=o-e.height-4<0?p+4:o-e.height-4)+e.height>m-8&&(a=m-e.height-8),b.style.left=`${n}px`,b.style.top=`${a}px`},[l]),u=(0,e.useCallback)(()=>{o.current&&(clearTimeout(o.current),o.current=null),p.current&&(clearTimeout(p.current),p.current=null),m.current=!1,n.current=!1,k.current&&(k.current.style.display="none"),q.current&&(document.removeEventListener("mousedown",q.current.down),document.removeEventListener("mouseup",q.current.up),q.current=null)},[]),v=(0,e.useCallback)(()=>{let a=k.current;if(!a||m.current)return;m.current=!0,a.style.left="-9999px",a.style.top="-9999px",a.style.display="block",requestAnimationFrame(()=>requestAnimationFrame(t));let b=0,c=0,d=a=>{b=a.clientX,c=a.clientY},e=a=>{if(!(Math.abs(a.clientX-b)>5||Math.abs(a.clientY-c)>5)){let b;b=a.target,k.current?.contains(b)||i.current?.contains(b)||u()}};document.addEventListener("mousedown",d),document.addEventListener("mouseup",e),q.current={down:d,up:e}},[t,u]),w=(0,e.useCallback)(()=>{if(o.current&&clearTimeout(o.current),p.current&&(clearTimeout(p.current),p.current=null),m.current)return;let a=window.getSelection();(!a||a.isCollapsed)&&(o.current=setTimeout(v,500))},[v]),x=(0,e.useCallback)(()=>{o.current&&(clearTimeout(o.current),o.current=null),m.current&&(p.current=setTimeout(()=>{n.current||u()},200))},[u]),y=(0,e.useCallback)(()=>{n.current=!0,p.current&&(clearTimeout(p.current),p.current=null)},[]),z=(0,e.useCallback)(()=>{n.current=!1,u()},[u]),A=(0,e.useCallback)(a=>{a.stopPropagation();let b=window.getSelection();b&&b.toString().length>0&&k.current?.contains(b.anchorNode)||(s.current?.(r.current),u())},[u]),B=a.message.split("\n")[0]||"",C=a.message.split("\n").slice(1).join("\n").trim();return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("span",{ref:i,className:"select-none text-xs text-muted-foreground/50 ml-6 cursor-default hover:text-muted-foreground/80",onMouseEnter:w,onMouseLeave:x,children:[a.author.split(" ")[0],", ",function(a){let b=g.A.t,c=Math.floor((Date.now()-1e3*a)/1e3);if(c<60)return b("common.justNow");let d=Math.floor(c/60);if(d<60)return b("common.minutesAgo",{count:d});let e=Math.floor(d/60);if(e<24)return b("common.hoursAgo",{count:e});let f=Math.floor(e/24);if(f<30)return b("common.daysAgo",{count:f});let h=Math.floor(f/30);return h<12?b("common.monthsAgo",{count:h}):b("common.yearsAgo",{count:Math.floor(h/12)})}(a.time)," \xb7 ",B]}),(0,d.jsx)(h.ZL,{children:(0,d.jsxs)("div",{ref:k,className:"fixed z-[9999] bg-card border border-border rounded-lg shadow-lv3 p-3 text-xs text-foreground whitespace-pre-wrap max-w-md select-text",style:{display:"none",minWidth:280,cursor:"text"},"data-inline-blame-tip":"",onMouseEnter:y,onMouseLeave:z,children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,d.jsx)("span",{className:"font-mono text-brand",children:a.hash}),(0,d.jsx)("span",{className:"text-muted-foreground",children:a.author}),(0,d.jsx)("span",{className:"text-muted-foreground/60",children:new Date(1e3*a.time).toLocaleString()})]}),(0,d.jsx)("div",{className:"font-medium",children:B}),C&&(0,d.jsx)("div",{className:"mt-1 text-muted-foreground",children:C}),(0,d.jsx)("div",{className:"mt-2 text-[11px] text-brand border-t border-border pt-2 cursor-pointer hover:underline",onClick:A,children:c("codeViewer.clickToViewDetails")})]})})]})}let k=[{bg:"rgba(59, 130, 246, 0.15)",border:"rgb(59, 130, 246)"},{bg:"rgba(16, 185, 129, 0.15)",border:"rgb(16, 185, 129)"},{bg:"rgba(245, 158, 11, 0.15)",border:"rgb(245, 158, 11)"},{bg:"rgba(239, 68, 68, 0.15)",border:"rgb(239, 68, 68)"},{bg:"rgba(168, 85, 247, 0.15)",border:"rgb(168, 85, 247)"},{bg:"rgba(236, 72, 153, 0.15)",border:"rgb(236, 72, 153)"},{bg:"rgba(20, 184, 166, 0.15)",border:"rgb(20, 184, 166)"},{bg:"rgba(249, 115, 22, 0.15)",border:"rgb(249, 115, 22)"}],l=(0,e.memo)(function({virtualKey:a,lineNum:b,highlightedHtml:c,hasComments:g,firstComment:h,lineCommentsCount:k,isInRange:l,showLineNumbers:m,lineNumChars:n,commentsEnabled:o,virtualItemSize:p,virtualItemStart:q,onCommentBubbleClick:r,onCmdClick:s,onTokenHover:t,onTokenHoverLeave:u,flashLine:v,blameLine:w,showBlameInfo:x,blameAuthorColor:y,isBlameHovered:z,onBlameClick:A,onBlameMouseEnter:B,onBlameMouseLeave:C,inlineBlameData:D,onInlineBlameClick:E,isCursorLine:F,cursorCol:G}){let{t:H}=(0,f.Bd)(),I=(0,e.useMemo)(()=>F&&null!=G?function(a,b){let c=0,d=0;for(;d<a.length;){if("<"===a[d]){let b=a.indexOf(">",d);if(-1!==b){d=b+1;continue}}if(c===b){let b;if("&"===a[d]){let c=a.indexOf(";",d);b=-1!==c&&c-d<10?c+1:d+1}else b=d+1;let c=a.substring(d,b);return a.substring(0,d)+'<span class="vi-char-cursor">'+c+"</span>"+a.substring(b)}if("&"===a[d]){let b=a.indexOf(";",d);d=-1!==b&&b-d<10?b+1:d+1}else d++;c++}return a+'<span class="vi-char-cursor"> </span>'}(c,G):c,[c,F,G]),J=(0,e.useCallback)(a=>{if(!a.metaKey||!s)return;a.preventDefault(),a.stopPropagation();let c=a.currentTarget,d=(0,i.j)(a,c);window.getSelection()?.removeAllRanges(),s(b,d)},[b,s]),K=(0,e.useCallback)(a=>{if(!t)return;let c=(0,i.A)(a,a.currentTarget);c&&t(b,c.column,c.rect)},[b,t]),L=(0,e.useCallback)(()=>{w&&A&&A(w)},[w,A]),M=(0,e.useCallback)(a=>{w&&B&&B(w,a)},[w,B]);return(0,d.jsxs)("div",{"data-line":b,style:{position:"absolute",top:0,left:0,width:"100%",height:`${p}px`,transform:`translateY(${q}px)`,backgroundColor:z&&y?y.bg:void 0},className:`flex ${v===b?"flash-line":""} ${F?"vi-cursor-line":""} ${l?"bg-blue-9/20":g?"bg-amber-9/10":"hover:bg-hover"}`,children:[(0,d.jsxs)("div",{className:"flex shrink-0 sticky left-0 z-[2] bg-card",style:{backgroundImage:z&&y?`linear-gradient(${y.bg}, ${y.bg})`:void 0},children:[w&&y&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"w-1 flex-shrink-0",style:{backgroundColor:y.border}}),(0,d.jsx)("div",{className:"w-48 flex-shrink-0 px-2 flex items-center gap-2 border-r border-border text-muted-foreground cursor-pointer hover:bg-hover",onMouseEnter:M,onMouseLeave:C,onClick:L,title:H("codeViewer.clickToViewCommit"),children:x?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"font-medium",style:{color:y.border},children:w.hash}),(0,d.jsx)("span",{className:"truncate flex-1",children:w.author.split(" ")[0]})]}):null})]}),m&&(0,d.jsxs)("span",{className:`flex-shrink-0 flex items-center justify-end gap-0.5 pr-2 select-none border-r border-border font-variant-tabular ${l?"bg-blue-9/30 text-blue-11":"bg-card/50 text-foreground-subtle"}`,children:[o&&g&&h&&(0,d.jsx)("button",{onClick:a=>r(h,a),className:"w-4 h-4 flex items-center justify-center rounded hover:bg-hover text-amber-9",title:H("codeViewer.nComments",{count:k}),children:(0,d.jsx)("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",children:(0,d.jsx)("path",{fillRule:"evenodd",d:"M18 10c0 3.866-3.582 7-8 7a8.841 8.841 0 01-4.083-.98L2 17l1.338-3.123C2.493 12.767 2 11.434 2 10c0-3.866 3.582-7 8-7s8 3.134 8 7zM7 9H5v2h2V9zm8 0h-2v2h2V9zM9 9h2v2H9V9z",clipRule:"evenodd"})})}),o&&!g&&(0,d.jsx)("span",{className:"w-4"}),(0,d.jsx)("span",{className:"text-right",style:{minWidth:`${n}ch`},children:b})]})]}),(0,d.jsxs)("span",{className:"flex-1 px-3 whitespace-pre select-text",onClick:J,onMouseOver:K,onMouseLeave:u,"data-code-content":!0,children:[(0,d.jsx)("span",{dangerouslySetInnerHTML:{__html:I}}),D&&(0,d.jsx)(j,{blame:D,onClick:E})]})]},a)})},40311:(a,b,c)=>{"use strict";function d(a,b){return"loading"===a?"border-transparent bg-orange-11/20 text-foreground animate-pulse":"unread"===a?"border-transparent bg-red-9/55 text-foreground":b?"border-transparent bg-brand/15 text-brand":"border-transparent bg-muted-foreground/15 text-muted-foreground"}c.d(b,{c:()=>d})},40699:(a,b,c)=>{"use strict";c.d(b,{u:()=>h});var d=c(67484),e=c(29939),f=c(85943),g=c(25414);function h(a,b,c,h,i){let j=(0,d.useRef)(null),k=(0,d.useRef)(0),l=(0,d.useRef)(0),m=(0,d.useRef)(!1),n=(0,d.useRef)(!1),o=(0,d.useRef)(!1),p=(0,d.useRef)(void 0),q=()=>{let a=`live-asst-${++k.current}`;return j.current=a,b(b=>[...b,{id:a,role:"assistant",content:"",isStreaming:!0,runId:p.current}]),a},r=a=>{let c=a=>{i?.onLiveOutputTokens?.({outputTokens:Math.max(0,Math.round(a))})},d=a=>{!m.current&&"string"==typeof a&&a&&(l.current+=(0,f.r)(a),c(l.current))};if("system"===a.type&&"init"===a.subtype){let a=n.current;o.current=!0,a||(l.current=0,m.current=!1,i?.onLiveOutputTokens?.(null),i?.onRunStartedAt?.(Date.now())),q();return}if("usage_update"===a.type){"number"==typeof a.output_tokens&&Number.isFinite(a.output_tokens)&&(m.current=!0,l.current=Math.max(l.current,Math.round(a.output_tokens)),c(l.current));return}if("stream_event"===a.type){let b=a.event;b?.type==="content_block_delta"&&b.delta?.type==="text_delta"&&d(b.delta.text)}if("system"===a.type&&"task_notification"===a.subtype){if(!o.current){let c=`live-tasknotif-${a.task_id||++k.current}`,d=`<task-notification>
40
+ ${b}`:a+b:b:a}function e(a,b,c=!1){let d=a||[];if(!b)return d;let f=d[d.length-1];return c||f?.type!=="text"?[...d,{type:"text",text:b}]:[...d.slice(0,-1),{type:"text",text:f.text+b}]}function f(a,b,c){let{engine:f,assistantId:g}=c;if("stream_event"===b.type){let c=b.event;if(c?.type==="content_block_delta"&&c.delta?.type==="text_delta"&&c.delta.text){let b=c.delta.text;return a.map(a=>a.id===g?{...a,content:d(a.content||"",b,!!a.pendingTextBreak),parts:e(a.parts,b,!!a.pendingTextBreak),pendingTextBreak:!1}:a)}return a}if("assistant"===b.type){let c=b.message?.content;if(!Array.isArray(c))return a;let h=a,i=b.message?.model==="<synthetic>";if("codex"===f||"ollama"===f||i){let a=c.filter(a=>"text"===a.type&&a.text).map(a=>a.text).join("");a&&(h=h.map(b=>b.id===g?{...b,content:d(b.content||"",a,!!b.pendingTextBreak),parts:e(b.parts,a,!!b.pendingTextBreak),pendingTextBreak:!1}:b))}for(let a of c)if(a.name){let b={id:a.id||`tool-${g}-${a.name}`,name:a.name,input:a.input||{},isLoading:!0};h=h.map(a=>a.id!==g||a.toolCalls?.some(a=>a.id===b.id)?a:{...a,toolCalls:[...a.toolCalls||[],b],parts:function(a,b){let c=a||[];return c.some(a=>"tool"===a.type&&a.id===b)?c:[...c,{type:"tool",id:b}]}(a.parts,b.id),pendingTextBreak:!0})}return h}if("user"===b.type){let c=b.message?.content;if(!Array.isArray(c))return a;let d=a;for(let a of c)if(a.tool_use_id){let b=a.tool_use_id,c="string"==typeof a.content?a.content:JSON.stringify(a.content);d=d.map(a=>a.id===g?{...a,toolCalls:a.toolCalls?.map(a=>a.id===b?{...a,result:c,isLoading:!1}:a)}:a)}return d}if("error"===b.type){let c=b.error||"An error occurred. Please try again.",f=`⚠️ ${c}`;return a.map(a=>a.id===g?{...a,content:d(a.content||"",f,!0),parts:e(a.parts,f,!0),isStreaming:!1}:a)}if("result"===b.type){let c="string"==typeof b.result?b.result.trim():"";return a.map(a=>a.id===g?{...a,content:!a.content&&c?c:a.content,parts:!a.content&&c?e(a.parts,c):a.parts,isStreaming:!1,toolCalls:a.toolCalls?.map(a=>({...a,isLoading:!1}))}:a)}return a}c.d(b,{F:()=>f})},25419:(a,b,c)=>{"use strict";c.d(b,{K:()=>f});var d=c(79606),e=c(71192);let f=(a,b)=>{let c,f;return c=`/api/files/text?cwd=${encodeURIComponent(a)}&path=${encodeURIComponent(b)}`,f={cache:"no-store"},d.tryPromise({try:async()=>{let a=await fetch(c,f),b=null;try{b=await a.json()}catch{}return{status:a.status,ok:a.ok,data:b}},catch:a=>new e.uV({message:`GET ${c} failed`,cause:a})})}},25608:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{ProjectItem:()=>n});var e=c(48249),f=c(67484),g=c(44384),h=c(33281),i=c(40311),j=c(29939),k=c(85655);function l({number:a,status:b,isActive:c}){return(0,e.jsx)("span",{className:`flex h-[18px] w-[18px] flex-shrink-0 items-center justify-center rounded-[4px] border font-mono text-[10px] font-medium leading-none tabular-nums transition-colors ${(0,i.c)(b,c)}`,"aria-hidden":"true",children:a})}function m({badge:a,onSelect:b}){return(0,e.jsx)("button",{type:"button",onClick:c=>{c.stopPropagation(),b(a.sessionId)},className:`flex h-4 w-4 flex-shrink-0 items-center justify-center rounded-full border font-mono text-[9px] font-medium leading-none tabular-nums transition-transform hover:scale-125 ${(0,i.c)(a.status,!1)}`,title:a.label,children:a.label})}let a=[],o=()=>{};function n({index:b,name:c,cwd:d,isActive:i,collapsed:p,hasUnread:q,isLoading:r,sessionBadges:s,onClick:t,onSelectSession:u,onRemove:v,onOpenNote:w}){let{t:x}=(0,g.Bd)(),[y,z]=(0,f.useState)(!1),[A,B]=(0,f.useState)(null),C=(0,f.useCallback)(()=>{h.t4.runPromiseExit((0,k.ue)(d)).then(a=>{"Success"===a._tag&&B(a.value.branch)})},[d]),D=(0,f.useCallback)(a=>{a?.type==="watch"&&Array.isArray(a.data)&&a.data.some(a=>"git"===a.type)&&C()},[C]);(0,j.h)({url:`/ws/watch?cwd=${encodeURIComponent(d)}`,onMessage:D});let E=s??a,F=A?p?`${c} \xb7 ${A}`:A:d;return(0,e.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1 rounded-lg cursor-pointer transition-colors relative ${p?"justify-center":""} ${i?"bg-accent text-foreground":"text-muted-foreground hover:bg-secondary hover:text-foreground"}`,onClick:t,onMouseEnter:()=>z(!0),onMouseLeave:()=>z(!1),"data-tooltip":F,children:[(0,e.jsx)(l,{number:b+1,status:p?r?"loading":q&&!i?"unread":"normal":"normal",isActive:i}),!p&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:`flex-1 truncate text-sm ${i?"text-brand":""}`,children:c}),y&&(0,e.jsxs)("div",{className:"flex items-center gap-0.5 flex-shrink-0",children:[w&&(0,e.jsx)("button",{className:"p-1 rounded hover:bg-hover text-muted-foreground hover:text-foreground transition-colors",onClick:a=>{a.stopPropagation(),w()},title:x("workspace.projectNotes"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),(0,e.jsx)("button",{className:"p-1 rounded hover:bg-red-500/20 text-muted-foreground hover:text-red-11 transition-colors",onClick:a=>{a.stopPropagation(),v()},title:x("workspace.closeProject"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),E.length>0?(0,e.jsx)("div",{className:"flex items-center gap-1 flex-shrink-0",children:E.map(a=>(0,e.jsx)(m,{badge:a,onSelect:u??o},a.sessionId))}):i?(0,e.jsx)("span",{className:"w-2 h-2 rounded-full bg-brand flex-shrink-0"}):null]})]})}d()}catch(a){d(a)}})},25667:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{r:()=>j});var e=c(48249),f=c(67484),g=c(83721);c(33281),c(85655);var h=c(17966),i=a([h]);function j({cwd:a,filePath:b,oldContent:c,newContent:d,isNew:h=!1,isDeleted:i=!1,changedFiles:k,fileGitStatusMap:l,enableComments:m=!1,compact:n=!0,onContentSearch:o,onSwitchToCode:p,headerExtraLeft:q,headerExtraRight:r}){let[s,t]=(0,f.useState)(b),[u,v]=(0,f.useState)(null);return(0,e.jsx)(g.O,{cwd:a,highlightedFilePath:b,changedFiles:k,enableComments:m,qnameFilter:n?u?.changedQnames:void 0,qnameFilterFile:s,accentQnames:u?.changedQnames,accentFile:s,addedLines:u?.addedLines,addedLinesFile:s,onFocalChange:a=>a&&t(a),onContentSearch:o,onSwitchToCode:p,headerExtraLeft:q,headerExtraRight:r})}h=(i.then?(await i)():i)[0],d()}catch(a){d(a)}})},25702:(a,b,c)=>{"use strict";c.d(b,{Providers:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call Providers() from the server but Providers is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/Providers.tsx","Providers")},26362:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{T:()=>q});var e=c(48249),f=c(67484),g=c(74429),h=c(74754),i=c(91579),j=c(208),k=c(7122),l=c(7031),m=c(41051),n=c(42140),o=c(70596),p=c(37690);function q({cwd:a,enableComments:b=!1,filePath:c,diffLines:d,containerEl:r,onContentSearch:s}){let t=(0,k.iN)(),u=(0,l.r)(),v=b&&!!a,{comments:w,addComment:x,updateComment:y,deleteComment:z,refresh:A}=(0,h._)({cwd:a||"",filePath:c}),[B,C]=(0,f.useState)(null),{toolbarRef:D,bumpRef:E,clearToolbar:F}=(0,p.L)({enabled:v,container:r,resolveLineRange:a=>{if(!document.contains(a))return null;let b=a.nodeType===Node.TEXT_NODE?a.parentElement:a,c=b?.closest("[data-new-line]");if(!c)return null;let d=parseInt(c.getAttribute("data-new-line")||"0",10);return!Number.isFinite(d)||d<=0?null:{start:d,end:d}},buildLineSnapshot:({start:a,end:b})=>{let c=[],e=0;for(let f of d)("unchanged"===f.type||"added"===f.type)&&++e>=a&&e<=b&&c.push(f.content);return c.join("\n")}}),[G,H]=(0,f.useState)(null),[I,J]=(0,f.useState)(null),[K,L]=(0,f.useState)(!1),M=(0,f.useMemo)(()=>{let a=new Set;for(let b of w)for(let c=b.startLine;c<=b.endLine;c++)a.add(c);return a},[w]),N=(0,f.useMemo)(()=>{let a=new Map;for(let b of w){let c=b.endLine;a.has(c)||a.set(c,[]),a.get(c).push(b)}return a},[w]),O=(0,f.useCallback)((a,b)=>{b.stopPropagation(),C({comment:a,x:b.clientX,y:b.clientY}),F(),H(null),J(null)},[F]),P=(0,f.useCallback)(()=>{let a=D.current;a&&(H({x:a.x,y:a.y,range:a.range,selectedText:a.selectedText,lineSnapshot:a.lineSnapshot}),F())},[F,D]),Q=(0,f.useCallback)(()=>{let a=D.current;a&&(J({x:a.x,y:a.y,range:a.range,selectedText:a.selectedText,lineSnapshot:a.lineSnapshot}),F())},[F,D]),R=(0,f.useCallback)(()=>{let a=D.current;a&&u&&(F(),(0,i.Ff)(u.sendMessage,{filePath:c,startLine:a.range.start,endLine:a.range.end,codeContent:a.lineSnapshot},j.A.t("explain.selectionMessage")))},[u,c,F,D]),S=(0,f.useCallback)(()=>{let a=D.current;if(!a||!s)return;let b=a.selectedText.trim();F(),b&&s(b)},[s,F,D]),T=(0,f.useCallback)(async(b,d)=>{if(u&&a)try{let e=await (0,i.$3)(a),f=[];for(let a of e)f.push({filePath:a.filePath,startLine:a.startLine,endLine:a.endLine,codeContent:a.codeContent,note:a.content||void 0});f.push({filePath:c,startLine:b.range.start,endLine:b.range.end,codeContent:b.lineSnapshot});let g=(0,i.Gw)(f,d);u.sendMessage(g),await (0,i.RP)(a),A()}catch(a){console.error("Failed to send to AI:",a)}},[u,c,a,A]),U=(0,f.useCallback)(a=>{I&&T(I,a)},[I,T]),V=(0,f.useCallback)(a=>{G&&T(G,a)},[G,T]),W=(0,f.useCallback)(async a=>{G&&(await x(G.range.start,G.range.end,a,G.selectedText),H(null))},[G,x]),X=K&&t?(0,g.createPortal)((0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(m.fS,{floatingToolbarRef:D,bumpRef:E,container:t,onAddComment:P,onSendToAI:Q,onSearch:s?S:void 0,onExplain:u?R:void 0,isChatLoading:u?.isLoading??!1}),G&&(0,e.jsx)(n.t,{x:G.x,y:G.y,range:G.range,filePath:c,lineSnapshot:G.lineSnapshot,container:t,onSubmit:W,onSendToAI:u?V:void 0,onClose:()=>H(null),isChatLoading:u?.isLoading}),I&&(0,e.jsx)(n.G,{x:I.x,y:I.y,range:I.range,filePath:c,lineSnapshot:I.lineSnapshot,container:t,onSubmit:U,onClose:()=>J(null),isChatLoading:u?.isLoading}),B&&(0,e.jsx)(o.t,{x:B.x,y:B.y,comment:B.comment,container:t,onClose:()=>C(null),onUpdateComment:y,onDeleteComment:z})]}),t):null;return{commentsEnabled:v,linesWithComments:M,commentsByEndLine:N,handleCommentBubbleClick:O,addCommentRange:G?.range??null,sendToAIRange:I?.range??null,commentPortal:X}}d()}catch(a){d(a)}})},28602:(a,b,c)=>{"use strict";function d(){return!("u"<typeof navigator)&&(/Mac|iPhone|iPad/.test(navigator.platform||"")||navigator.userAgentData?.platform==="macOS")}function e(){return d()?"⌘":"Ctrl+"}c.d(b,{L:()=>d,Mu:()=>e}),process.platform,process.platform,process.platform},28797:(a,b,c)=>{"use strict";function d(a){let b=a.split(".").pop()?.toLowerCase();return b?["ts","tsx","js","jsx","mjs","cjs"].includes(b)?"typescript":["py","pyi"].includes(b)?"python":null:null}c.d(b,{c:()=>d})},29412:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{g:()=>o});var e=c(48249),f=c(67484),g=c(44384),h=c(7833),i=c(15819),j=c(77156),k=c(59336),l=c(2633),m=c(33281),n=a([l]);function o({isOpen:a,onClose:b}){let{t:c,i18n:d}=(0,g.Bd)(),[n,q]=(0,f.useState)([]),[r,s]=(0,f.useState)(!1),[t,u]=(0,f.useState)(""),[v,w]=(0,f.useState)(!1),[x,y]=(0,f.useState)(""),[z,A]=(0,f.useState)(!1),[B,C]=(0,f.useState)(null),D=(0,f.useRef)(null),E=(0,f.useCallback)(async()=>{s(!0);let a=await m.t4.runPromiseExit((0,j.Hy)());"Success"===a._tag?q(a.value):console.error("Failed to load skills",a.cause),s(!1)},[]),F=(0,f.useMemo)(()=>{let a=t.trim().toLowerCase();return a?n.filter(b=>b.name.toLowerCase().includes(a)||b.description.toLowerCase().includes(a)||b.path.toLowerCase().includes(a)):n},[n,t]),G=d.resolvedLanguage?.startsWith("zh")?"https://opencockpit.dev/zh/docs/agent/skills/":"https://opencockpit.dev/en/docs/agent/skills/",H=(0,f.useCallback)(async()=>{let a=x.trim();if(!a)return;A(!0);let b=await m.t4.runPromiseExit((0,j.L5)(a));if("Success"===b._tag)(0,h.oR)(b.value.alreadyExists?c("skills.alreadyAdded"):c("skills.added"),b.value.alreadyExists?"info":"success"),y(""),w(!1),await E(),b.value.alreadyExists||(0,k.k)();else{let a="Fail"===b.cause._tag?b.cause.error:null,d=a?.cause,e=d instanceof Error?d.message:c("skills.addFailed");(0,h.oR)(e,"error")}A(!1)},[x,E,c]),I=(0,f.useCallback)(async a=>{let b=await m.t4.runPromiseExit((0,j.hp)(a));"Success"===b._tag?(q(b=>b.filter(b=>b.id!==a)),(0,k.k)()):(0,h.oR)(c("common.deleteFailed"),"error")},[c]),J=(0,f.useCallback)(async a=>{try{await navigator.clipboard.writeText(a),(0,h.oR)(c("common.copiedPath"),"success")}catch{(0,h.oR)(c("common.copyFailed"),"error")}},[c]);return a?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,e.jsx)("div",{className:"absolute inset-0 bg-scrim",onClick:b}),(0,e.jsxs)("div",{className:i.aO,children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border flex-shrink-0",children:[(0,e.jsx)("h2",{className:"text-sm font-medium text-foreground",children:c("skills.title")}),(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsx)("input",{ref:D,type:"text",value:t,onChange:a=>u(a.target.value),placeholder:c("skills.searchPlaceholder"),className:"px-2 py-1 pr-6 text-xs border border-border rounded bg-card text-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent"}),t&&(0,e.jsx)("button",{onClick:()=>{u(""),D.current?.focus()},className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-foreground-subtle hover:text-foreground rounded-sm transition-colors",title:c("skills.clearSearch"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsxs)("button",{onClick:()=>w(!0),className:"flex items-center gap-1.5 px-2.5 py-1 text-xs rounded-md border border-border text-muted-foreground hover:text-foreground hover:bg-hover transition-colors",children:[(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),c("skills.addSkill")]}),(0,e.jsx)("button",{onClick:b,className:"p-1 text-foreground-subtle hover:text-foreground hover:bg-hover rounded transition-colors",title:c("common.close"),children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),(0,e.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:r?(0,e.jsx)("div",{className:"text-center text-muted-foreground py-8 text-sm",children:c("common.loading")}):0===F.length?(0,e.jsx)("div",{className:"text-center text-muted-foreground py-8 text-sm space-y-2",children:0===n.length?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("p",{children:c("skills.emptyNoSkills")}),(0,e.jsxs)("p",{children:[c("skills.emptyIntroPrefix")," ",(0,e.jsx)("code",{className:"px-1.5 py-0.5 rounded bg-muted text-foreground font-mono text-xs",children:"/skillify"})," ",c("skills.emptyIntroSuffix")]}),(0,e.jsxs)("p",{children:[(0,e.jsx)("button",{type:"button",onClick:()=>w(!0),className:"text-brand hover:underline",children:c("skills.addSkill")})," \xb7 ",(0,e.jsx)("a",{href:G,target:"_blank",rel:"noreferrer",className:"text-brand hover:underline",children:c("skills.viewDocs")})]})]}):c("skills.emptyNoMatch")}):(0,e.jsx)("div",{className:i.jL,children:F.map(a=>(0,e.jsx)(p,{skill:a,onPreview:()=>C(a.id),onDelete:()=>I(a.id),onCopyPath:()=>J(a.path)},a.id))})})]})]}),v&&(0,e.jsxs)("div",{className:"fixed inset-0 z-[60] flex items-center justify-center",children:[(0,e.jsx)("div",{className:"absolute inset-0 bg-scrim",onClick:()=>{z||(w(!1),y(""))}}),(0,e.jsxs)("div",{className:"relative bg-card rounded-lg shadow-lv3 w-full max-w-lg mx-4 p-5",children:[(0,e.jsx)("h3",{className:"text-sm font-medium text-foreground mb-3",children:c("skills.addSkill")}),(0,e.jsx)("label",{className:"block text-xs text-muted-foreground mb-1",children:c("skills.pathLabel")}),(0,e.jsx)("input",{type:"text",value:x,onChange:a=>y(a.target.value),onKeyDown:a=>{"Enter"!==a.key||z||H()},placeholder:c("skills.pathPlaceholder"),autoFocus:!0,className:"w-full px-3 py-2 text-sm font-mono border border-border rounded-md bg-card text-foreground focus:outline-none focus:ring-2 focus:ring-ring"}),(0,e.jsxs)("div",{className:"flex justify-end gap-2 mt-4",children:[(0,e.jsx)("button",{onClick:()=>{w(!1),y("")},disabled:z,className:"px-3 py-1.5 text-sm rounded-md border border-border text-muted-foreground hover:text-foreground hover:bg-hover transition-colors disabled:opacity-50",children:c("common.cancel")}),(0,e.jsx)("button",{onClick:H,disabled:z||!x.trim(),className:"px-3 py-1.5 text-sm rounded-md bg-brand text-white hover:bg-teal-10 transition-colors disabled:opacity-50",children:z?c("skills.adding"):c("skills.add")})]})]})]}),B&&(0,e.jsx)(l.d,{skillId:B,onClose:()=>C(null)})]}):null}function p({skill:a,onPreview:b,onDelete:c,onCopyPath:d}){let{t:h}=(0,g.Bd)(),[i,j]=(0,f.useState)(!1);return(0,e.jsxs)("div",{className:`group flex flex-col h-full border border-border rounded-lg p-3 hover:border-brand hover:shadow-lv2 transition-all ${a.valid?"":"opacity-60"}`,children:[(0,e.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,e.jsx)("div",{className:"w-9 h-9 flex-shrink-0 flex items-center justify-center rounded-md bg-brand/10 text-brand text-lg",children:a.icon?(0,e.jsx)("span",{children:a.icon}):(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 3l1.9 4.8L19 9l-4.1 3.1L16 18l-4-2.8L8 18l1.1-5.9L5 9l5.1-1.2L12 3z"})})}),(0,e.jsxs)("span",{className:"font-mono text-sm font-medium text-foreground truncate flex-1 min-w-0","data-tooltip":`/${a.name}`,children:["/",a.name]}),!a.valid&&(0,e.jsx)("span",{className:"flex-shrink-0 text-xs px-1.5 py-0.5 rounded bg-red-9/15 text-red-11",children:h("skills.invalid")}),(0,e.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0 opacity-0 group-hover:opacity-100 focus-within:opacity-100 transition-opacity",children:[(0,e.jsx)("button",{onClick:b,disabled:!a.valid,className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-hover rounded transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:h("common.preview"),children:(0,e.jsxs)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]})}),i?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{onClick:()=>{j(!1),c()},className:"px-2 py-1 text-xs rounded bg-red-9 text-white hover:bg-red-10",children:h("common.confirm")}),(0,e.jsx)("button",{onClick:()=>j(!1),className:"px-2 py-1 text-xs rounded border border-border text-muted-foreground hover:text-foreground",children:h("common.cancel")})]}):(0,e.jsx)("button",{onClick:()=>j(!0),className:"p-1.5 text-muted-foreground hover:text-red-11 hover:bg-red-9/10 rounded transition-colors",title:h("common.delete"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6M1 7h22M9 7V4a1 1 0 011-1h4a1 1 0 011 1v3"})})})]})]}),(0,e.jsxs)("div",{className:"font-mono text-xs text-muted-foreground mt-2 break-all",children:[a.path,(0,e.jsx)("button",{onClick:d,className:"inline-flex align-middle ml-1 p-0.5 hover:text-foreground hover:bg-hover rounded transition-colors",title:h("skills.copyPath"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground mt-2 pt-2 border-t border-border/60 break-words whitespace-pre-wrap",children:a.description||(0,e.jsx)("span",{className:"italic opacity-60",children:h("skills.noDescription")})}),a.argumentHint&&(0,e.jsx)("div",{className:"font-mono text-xs text-muted-foreground mt-1 truncate","data-tooltip":a.argumentHint,children:a.argumentHint})]})}l=(n.then?(await n)():n)[0],d()}catch(a){d(a)}})},29491:(a,b,c)=>{"use strict";c.d(b,{I18nProvider:()=>g});var d=c(48249);c(67484);var e=c(44384),f=c(208);function g({children:a}){return(0,d.jsx)(e.xC,{i18n:f.A,children:a})}c(33281),c(65484)},29939:(a,b,c)=>{"use strict";c.d(b,{D:()=>h,h:()=>i});var d=c(67484),e=c(88055),f=c(21586);e.EV(f.YA(1),1.5).pipe(e.gP(e.ji(f.YA(10))),e.y$(e.t5(10))),e.EV(f.ne(200),2).pipe(e.gP(e.ji(f.YA(5))),e.y$(e.t5(5))),e.EV(f.YA(1),2).pipe(e.et,e.gP(e.ji(f.YA(30))),e.y$(e.t5(8))),e.ji(f.YA(30)),e.ji(f.YA(1)),e.ji(f.YA(30)),f.ne(50),e.BW;let g=new Set;function h(a){return g.add(a),()=>{g.delete(a)}}function i({url:a,onMessage:b,enabled:c=!0}){(0,d.useRef)(b)}},30337:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,15098,23)),Promise.resolve().then(c.t.bind(c,47644,23)),Promise.resolve().then(c.t.bind(c,33859,23)),Promise.resolve().then(c.t.bind(c,98099,23)),Promise.resolve().then(c.t.bind(c,16237,23)),Promise.resolve().then(c.t.bind(c,98562,23)),Promise.resolve().then(c.t.bind(c,36675,23))},30458:(a,b,c)=>{"use strict";c.d(b,{E:()=>k});var d=c(48249),e=c(67484),f=c(44384),g=c(208),h=c(28602),i=c(71697);let j={once:[{labelKey:"scheduledTasks.5minLater",value:5},{labelKey:"scheduledTasks.15minLater",value:15},{labelKey:"scheduledTasks.30minLater",value:30},{labelKey:"scheduledTasks.1hourLater",value:60}],interval:[{labelKey:"scheduledTasks.every15min",value:15},{labelKey:"scheduledTasks.every30min",value:30},{labelKey:"scheduledTasks.every1hour",value:60},{labelKey:"scheduledTasks.every2hours",value:120}],cron:[{labelKey:"scheduledTasks.daily9am",value:"0 9 * * *"},{labelKey:"scheduledTasks.daily6pm",value:"0 18 * * *"},{labelKey:"scheduledTasks.weeklyMon9am",value:"0 9 * * 1"},{labelKey:"scheduledTasks.monthly1st9am",value:"0 9 1 * *"}]};function k({onClose:a,onCreate:b,editTask:c,onUpdate:l}){let{t:m}=(0,f.Bd)(),n=!!c,[o,p]=(0,e.useState)(c?.type||"once"),[q,r]=(0,e.useState)(c?.message||""),[s,t]=(0,e.useState)(c?.taskFile?"file":"message"),[u,v]=(0,e.useState)(c?.taskFile||""),[w,x]=(0,e.useState)(c?String(c.delayMinutes||c.intervalMinutes||""):""),[y,z]=(0,e.useState)(c?.cron||""),[A,B]=(0,e.useState)(c?.activeFrom||"09:00"),[C,D]=(0,e.useState)(c?.activeTo||"18:00"),[E,F]=(0,e.useState)(!!(c?.activeFrom&&c?.activeTo)),[G,H]=(0,e.useState)(null),I=(0,e.useRef)(null),J=(0,e.useRef)(null),K=(0,i.n)({value:q,onChange:r,textareaRef:J}),L=(0,e.useCallback)(()=>{let d="file"===s,e=d?{message:"",taskFile:u.trim()}:{message:q.trim(),taskFile:""};if(d?!e.taskFile:!e.message)return;let f=null;if("once"===o){let a=G||parseInt(w,10);if(!a||a<=0)return;f={...e,type:"once",delayMinutes:a}}else if("interval"===o){let a=G||parseInt(w,10);if(!a||a<=0)return;f={...e,type:"interval",intervalMinutes:a,...E?{activeFrom:A,activeTo:C}:{}}}else if("cron"===o){let a=G||y.trim();if(!a)return;f={...e,type:"cron",cron:a}}f&&(n&&c&&l?l(c.id,f):b(f),a())},[q,s,u,o,G,w,y,E,A,C,b,a,n,c,l]);return(0,d.jsxs)("div",{ref:I,className:`w-[28rem] max-w-[calc(100vw-1.5rem)] bg-popover border border-border rounded-lg shadow-lv2 z-50 ${n?"":"absolute bottom-full left-0 mb-2"}`,onKeyDown:b=>{"Escape"===b.key?a():"Enter"===b.key&&(b.metaKey||b.ctrlKey)&&L()},children:[(0,d.jsx)("div",{className:"px-3 py-2 border-b border-border bg-muted/50 rounded-t-lg",children:(0,d.jsx)("span",{className:"text-sm font-medium",children:n?m("scheduledTasks.editTask"):m("scheduledTasks.createTask")})}),(0,d.jsxs)("div",{className:"p-4 space-y-4 max-h-[min(52rem,calc(100vh-3rem))] overflow-y-auto",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"flex gap-1 mb-1.5",children:["message","file"].map(a=>(0,d.jsx)("button",{onClick:()=>t(a),className:`px-2 py-1 text-xs rounded transition-colors ${s===a?"bg-brand text-white":"bg-muted text-muted-foreground hover:text-foreground"}`,children:"message"===a?m("scheduledTasks.sendMessage"):m("scheduledTasks.taskFile")},a))}),"message"===s?(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("textarea",{ref:J,value:q,onChange:a=>{r(a.target.value),K.trackCaret(a.target)},onSelect:a=>K.trackCaret(a.currentTarget),onKeyDown:a=>{K.handleKeyDown(a)},placeholder:m("scheduledTasks.messagePlaceholder"),rows:5,className:"w-full px-2 py-1.5 text-sm border border-border rounded bg-card text-foreground focus:outline-none focus:ring-1 focus:ring-ring resize-y min-h-[6rem]"}),(0,d.jsx)(i.V,{ac:K,className:"absolute top-full left-0 right-0 mt-1 max-h-48 z-10"})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("input",{type:"text",value:u,onChange:a=>v(a.target.value),placeholder:m("scheduledTasks.taskFilePlaceholder"),className:"w-full px-2 py-1.5 text-sm font-mono border border-border rounded bg-card text-foreground focus:outline-none focus:ring-1 focus:ring-ring"}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:m("scheduledTasks.taskFileHint")})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-muted-foreground mb-1 block",children:m("scheduledTasks.type")}),(0,d.jsx)("div",{className:"flex gap-1",children:["once","interval","cron"].map(a=>(0,d.jsx)("button",{onClick:()=>{p(a),H(null),x(""),z("")},className:`flex-1 px-2 py-1 text-xs rounded transition-colors ${o===a?"bg-brand text-white":"bg-muted text-muted-foreground hover:text-foreground"}`,children:"once"===a?m("scheduledTasks.once"):"interval"===a?m("scheduledTasks.interval"):"Cron"},a))})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-muted-foreground mb-1 block",children:m("scheduledTasks.quickSelect")}),(0,d.jsx)("div",{className:"grid grid-cols-2 gap-1",children:j[o].map(a=>(0,d.jsx)("button",{onClick:()=>{H(a.value),"cron"===o?z(String(a.value)):x(String(a.value))},className:`px-2 py-1 text-xs rounded border transition-colors ${G===a.value?"border-brand bg-brand/10 text-brand":"border-border text-muted-foreground hover:text-foreground hover:border-foreground/30"}`,children:m(a.labelKey)},a.labelKey))})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-muted-foreground mb-1 block",children:"cron"===o?m("scheduledTasks.customCron"):m("scheduledTasks.customMinutes")}),"cron"===o?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("input",{type:"text",value:y,onChange:a=>{z(a.target.value),H(null)},placeholder:m("scheduledTasks.cronPlaceholder"),className:"w-full px-2 py-1.5 text-sm border border-border rounded bg-card text-foreground focus:outline-none focus:ring-1 focus:ring-ring font-mono"}),y.trim()&&(0,d.jsx)("div",{className:"mt-1 text-xs text-muted-foreground",children:function(a){let b=g.A.t,c=a.trim().split(/\s+/);if(5!==c.length)return null;let[d,e,f,h,i]=c,j={0:b("cron.dowSun"),1:b("cron.dowMon"),2:b("cron.dowTue"),3:b("cron.dowWed"),4:b("cron.dowThu"),5:b("cron.dowFri"),6:b("cron.dowSat")},k={1:`1${b("cron.monthPrefix")}`,2:`2${b("cron.monthPrefix")}`,3:`3${b("cron.monthPrefix")}`,4:`4${b("cron.monthPrefix")}`,5:`5${b("cron.monthPrefix")}`,6:`6${b("cron.monthPrefix")}`,7:`7${b("cron.monthPrefix")}`,8:`8${b("cron.monthPrefix")}`,9:`9${b("cron.monthPrefix")}`,10:`10${b("cron.monthPrefix")}`,11:`11${b("cron.monthPrefix")}`,12:`12${b("cron.monthPrefix")}`};try{let a="";if(d.includes("/")||e.includes("/")){if("*"===e&&d.includes("/"))return b("cron.everyNMinutes",{n:d.split("/")[1]});if("0"===d&&e.includes("/"))return b("cron.everyNHours",{n:e.split("/")[1]});return null}let c=parseInt(e,10),g=parseInt(d,10);if(isNaN(c)&&"*"!==e||isNaN(g)&&"*"!==d)return null;a="*"===e&&"*"===d?b("cron.everyMinute"):"*"===e?b("cron.everyHourAtMin",{m:g}):"*"===d?b("cron.hourlyEveryMin",{h:c}):`${String(c).padStart(2,"0")}:${String(g).padStart(2,"0")}`;let l=[];if("*"!==h){let a=h.split(",").map(a=>k[a]||`${a}${b("cron.monthPrefix")}`);l.push(a.join(", "))}if("*"!==f)if(f.includes("-")){let[a,c]=f.split("-");l.push(b("cron.dayRange",{a,b:c}))}else f.includes(",")?l.push(f.split(",").map(a=>`${a}${b("cron.dayOfMonth")}`).join(", ")):l.push(`${f}${b("cron.dayOfMonth")}`);if("*"!==i)if("1-5"===i)l.push(b("cron.weekdays"));else if("0,6"===i||"6,0"===i)l.push(b("cron.weekends"));else{let a=i.split(",").map(a=>{if(a.includes("-")){let[c,d]=a.split("-");return b("cron.weekdayRange",{a:j[c]||c,b:j[d]||d})}return`${b("cron.weekdayPrefix")}${j[a]||a}`});l.push(a.join(", "))}if(0===l.length&&"*"===f&&"*"===h&&"*"===i)return b("cron.daily",{time:a});return`${l.join(" ")} ${a}`}catch{return null}}(y.trim())||(0,d.jsx)("span",{className:"text-destructive",children:m("scheduledTasks.cronFormat")})})]}):(0,d.jsx)("input",{type:"number",value:w,onChange:a=>{x(a.target.value),H(null)},placeholder:m("scheduledTasks.minutesPlaceholder"),min:1,className:"w-full px-2 py-1.5 text-sm border border-border rounded bg-card text-foreground focus:outline-none focus:ring-1 focus:ring-ring"})]}),"interval"===o&&(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"flex items-center gap-2 text-xs text-muted-foreground mb-1 cursor-pointer",children:[(0,d.jsx)("input",{type:"checkbox",checked:E,onChange:a=>F(a.target.checked),className:"rounded border-border"}),m("scheduledTasks.limitTimeRange")]}),E&&(0,d.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,d.jsx)("input",{type:"time",value:A,onChange:a=>B(a.target.value),className:"flex-1 px-2 py-1 text-sm border border-border rounded bg-card text-foreground focus:outline-none focus:ring-1 focus:ring-ring"}),(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:m("scheduledTasks.to")}),(0,d.jsx)("input",{type:"time",value:C,onChange:a=>D(a.target.value),className:"flex-1 px-2 py-1 text-sm border border-border rounded bg-card text-foreground focus:outline-none focus:ring-1 focus:ring-ring"})]})]}),(0,d.jsx)("button",{onClick:L,disabled:!(("file"===s?!!u.trim():!!q.trim())&&("once"===o||"interval"===o?!!(G||w&&parseInt(w,10)>0):"cron"===o&&!!(G||y.trim()))),className:"w-full py-1.5 text-sm font-medium rounded bg-brand text-white hover:bg-brand/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:n?m("scheduledTasks.saveBtn",{modKey:(0,h.Mu)()}):m("scheduledTasks.createBtn",{modKey:(0,h.Mu)()})})]})]})}},32459:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{e:()=>m});var e=c(48249),f=c(67484),g=c(44384),h=c(82795),i=c(32753),j=c(74228),k=c(50508),l=a([k]);function m({currentCwd:a,onSwitchProject:b,onResolveSessionNumbers:c,collapsed:d,sessions:l}){let{t:n}=(0,g.Bd)(),[o,p]=(0,f.useState)(!1),[q,r]=(0,f.useState)(!1),[s,t]=(0,f.useState)({}),u=(0,f.useRef)(0),v=(0,f.useRef)(null),w=(0,k.o$)(),{show:x,hide:y}=w,z=(0,f.useCallback)(a=>{b(a.cwd,a.sessionId),p(!1)},[b]),A=(0,f.useCallback)(()=>{let a=!o;if(p(a),a){let a=++u.current;t({}),c().then(b=>{u.current===a&&t(b)})}else u.current+=1},[o,c]),B=l.filter(a=>"loading"===a.status).length,C=l.filter(a=>"unread"===a.status).length;return(0,e.jsxs)("div",{className:"relative",ref:v,children:[(0,e.jsxs)("button",{onClick:A,className:`relative flex items-center gap-2 px-2 py-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-hover transition-colors ${d?"w-full justify-center":"w-full"}`,title:d?n("sessions.recentSessions"):void 0,children:[(0,e.jsx)("svg",{className:"w-5 h-5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),!d&&(0,e.jsx)("span",{className:"text-sm flex-1 text-left",children:n("sessions.recentSessions")}),B>0&&(0,e.jsx)("span",{className:`min-w-[18px] h-[18px] px-1 text-foreground text-xs font-medium rounded-full flex items-center justify-center bg-orange-11/20 animate-pulse ${d?"absolute -top-1 -right-1":""}`,children:B}),C>0&&(0,e.jsx)("span",{className:`min-w-[18px] h-[18px] px-1 text-foreground text-xs font-medium rounded-full flex items-center justify-center bg-red-9/55 ${d&&!B?"absolute -top-1 -right-1":""}`,children:C})]}),o&&(0,e.jsxs)("div",{className:"absolute left-full bottom-0 ml-2 w-80 h-[600px] bg-popover border border-border rounded-lg shadow-lv2 z-50 flex flex-col",children:[(0,e.jsxs)("div",{className:"px-3 py-2 border-b border-border bg-muted/50 flex-shrink-0 rounded-t-lg flex items-center",children:[(0,e.jsx)("span",{className:"text-sm font-medium",children:n("sessions.recentSessions")}),B>0&&(0,e.jsxs)("span",{className:"ml-2 text-xs text-orange-11",children:["(",n("sessions.runningCount",{count:B}),")"]}),C>0&&(0,e.jsxs)("span",{className:"ml-2 text-xs text-red-11",children:["(",n("sessions.unreadCount",{count:C}),")"]}),(0,e.jsxs)("button",{onClick:()=>{p(!1),r(!0)},className:"ml-auto flex items-center gap-1 p-1 -mr-1 text-muted-foreground hover:text-foreground hover:bg-hover rounded transition-colors",title:n("sessions.searchRecentSessions"),children:[(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"m21 21-4.35-4.35m2.35-5.4a7.75 7.75 0 1 1-15.5 0 7.75 7.75 0 0 1 15.5 0Z"})}),(0,e.jsx)("span",{className:"text-xs",children:n("sessions.search")})]})]}),(0,e.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto",children:0===l.length?(0,e.jsx)("div",{className:"px-3 py-4 text-sm text-muted-foreground text-center",children:n("sessions.noSessions")}):l.map((b,c)=>(0,e.jsxs)("button",{onClick:()=>z(b),onMouseEnter:a=>x(b,a),onMouseLeave:y,className:`w-full px-3 py-2 text-left hover:bg-hover transition-colors flex items-start gap-2 ${c!==l.length-1?"border-b border-border/50":""} ${a===b.cwd?"bg-accent/50":""}`,children:[(0,e.jsx)(k.KO,{status:b.status,className:"mt-1.5"}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(i.S,{engine:b.engine}),(0,e.jsx)("span",{className:"font-medium text-sm truncate",children:(0,k.Qr)(b.cwd)}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:(0,k.fw)(n,b.lastActive)}),(0,e.jsx)(j.l,{coordinate:s[`${b.cwd}
41
+ ${b.sessionId}`],status:(0,j.S)(b.status),statusLabel:(0,k.Mm)(n,b.status),className:"ml-auto"})]}),b.title&&(0,e.jsx)("div",{className:"text-xs font-medium text-foreground truncate","data-tooltip":b.title,children:b.title}),b.lastUserMessage&&(0,e.jsx)("div",{className:"text-xs text-foreground/80 truncate",children:b.lastUserMessage})]})]},`${b.cwd}-${b.sessionId}`))})]}),(0,e.jsx)(k.LD,{...w}),(0,e.jsx)(h.e,{isOpen:q,onClose:()=>r(!1),onSwitchProject:b,sessionNumbers:s})]})}k=(l.then?(await l)():l)[0],d()}catch(a){d(a)}})},32465:(a,b,c)=>{"use strict";c.d(b,{Y:()=>m});var d=c(48249),e=c(67484),f=c(44384),g=c(76592),h=c(46674),i=c(59347),j=c(24520),k=c(33281),l=c(23328);function m({onClose:a,onSave:b}){let{t:c}=(0,f.Bd)(),[n,o]=(0,e.useState)({}),[p,q]=(0,e.useState)(""),[r,s]=(0,e.useState)(""),[t,u]=(0,e.useState)(!0);(0,e.useCallback)(async()=>{u(!0);let a=await k.t4.runPromiseExit((0,l.Jn)());"Success"===a._tag?o(a.value):console.error("Failed to load aliases:",a.cause),u(!1)},[]);let v=()=>{p.trim()&&r.trim()&&(o(a=>({...a,[p.trim()]:r.trim()})),q(""),s(""))},w=async()=>{let c=await k.t4.runPromiseExit((0,l.cv)(n));"Success"===c._tag?(b(n),a()):console.error("Failed to save aliases:",c.cause)};return(0,d.jsx)("div",{className:"absolute inset-0 bg-scrim flex items-center justify-center z-50",children:(0,d.jsxs)("div",{className:"bg-background border border-border rounded-lg shadow-lv3 w-full max-w-2xl max-h-[80vh] flex flex-col m-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,d.jsxs)("div",{children:[(0,d.jsxs)("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[(0,d.jsx)(g.A,{className:"w-5 h-5"}),c("aliasManager.title")]}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:c("aliasManager.description")})]}),(0,d.jsx)("button",{onClick:a,className:"p-1 rounded hover:bg-hover transition-colors",children:(0,d.jsx)(h.A,{className:"w-5 h-5"})})]}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:t?(0,d.jsx)("div",{className:"flex items-center justify-center h-32 text-muted-foreground",children:c("common.loading")}):(0,d.jsxs)("div",{className:"space-y-3",children:[Object.entries(n).map(([a,b])=>(0,d.jsxs)("div",{className:"flex items-start gap-2 group",children:[(0,d.jsxs)("div",{className:"flex-1 grid grid-cols-2 gap-2",children:[(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("div",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground text-sm",children:"$"}),(0,d.jsx)("input",{type:"text",value:a,disabled:!0,className:"w-full pl-7 pr-3 py-2 rounded-lg border border-input bg-muted text-sm font-mono"})]}),(0,d.jsx)("input",{type:"text",value:b,onChange:b=>{var c;return c=b.target.value,void o(b=>({...b,[a]:c}))},placeholder:c("aliasManager.fullCommandPlaceholder"),className:"w-full px-3 py-2 rounded-lg border border-input bg-background text-sm font-mono focus:outline-none focus:ring-2 focus:ring-brand focus:border-transparent"})]}),(0,d.jsx)("button",{onClick:()=>{o(b=>{let c={...b};return delete c[a],c})},className:"p-2 rounded-lg text-destructive hover:bg-destructive/10 transition-colors opacity-0 group-hover:opacity-100",children:(0,d.jsx)(i.A,{className:"w-4 h-4"})})]},a)),(0,d.jsxs)("div",{className:"flex items-start gap-2 pt-2 border-t border-border",children:[(0,d.jsxs)("div",{className:"flex-1 grid grid-cols-2 gap-2",children:[(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("div",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground text-sm",children:"$"}),(0,d.jsx)("input",{type:"text",value:p,onChange:a=>q(a.target.value),placeholder:c("aliasManager.aliasPlaceholder"),className:"w-full pl-7 pr-3 py-2 rounded-lg border border-input bg-background text-sm font-mono focus:outline-none focus:ring-2 focus:ring-brand focus:border-transparent",onKeyDown:a=>{"Enter"!==a.key||a.nativeEvent.isComposing||(a.preventDefault(),v())}})]}),(0,d.jsx)("input",{type:"text",value:r,onChange:a=>s(a.target.value),placeholder:c("aliasManager.commandPlaceholder"),className:"w-full px-3 py-2 rounded-lg border border-input bg-background text-sm font-mono focus:outline-none focus:ring-2 focus:ring-brand focus:border-transparent",onKeyDown:a=>{"Enter"!==a.key||a.nativeEvent.isComposing||(a.preventDefault(),v())}})]}),(0,d.jsx)("button",{onClick:v,disabled:!p.trim()||!r.trim(),className:"p-2 rounded-lg bg-brand text-brand-foreground hover:bg-brand/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:(0,d.jsx)(j.A,{className:"w-4 h-4"})})]}),(0,d.jsxs)("div",{className:"mt-4 p-3 bg-accent rounded-lg",children:[(0,d.jsxs)("p",{className:"text-sm text-muted-foreground",children:[(0,d.jsx)("strong",{children:c("aliasManager.usage")}),c("aliasManager.usageDesc")]}),(0,d.jsxs)("div",{className:"mt-2 space-y-1 text-xs text-muted-foreground",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("code",{className:"px-1.5 py-0.5 bg-background rounded",children:"$ ll"}),(0,d.jsx)("span",{children:"→"}),(0,d.jsx)("code",{className:"px-1.5 py-0.5 bg-background rounded",children:"ls -la"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("code",{className:"px-1.5 py-0.5 bg-background rounded",children:"$ gs"}),(0,d.jsx)("span",{children:"→"}),(0,d.jsx)("code",{className:"px-1.5 py-0.5 bg-background rounded",children:"git status"})]})]})]}),0===Object.keys(n).length&&(0,d.jsx)("div",{className:"text-center py-8 text-muted-foreground text-sm",children:c("aliasManager.noAliases")})]})}),(0,d.jsxs)("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-border",children:[(0,d.jsx)("button",{onClick:a,className:"px-4 py-2 rounded-lg text-sm hover:bg-hover transition-colors",children:c("common.cancel")}),(0,d.jsx)("button",{onClick:w,className:"px-4 py-2 rounded-lg text-sm bg-brand text-brand-foreground hover:bg-brand/90 transition-colors",children:c("common.save")})]})]})})}},32580:(a,b,c)=>{"use strict";function d(a,b){let c=a.split("\n"),d=b.split("\n"),e=[],f=c.length,g=d.length,h=Array(f+1).fill(null).map(()=>Array(g+1).fill(0));for(let a=1;a<=f;a++)for(let b=1;b<=g;b++)c[a-1]===d[b-1]?h[a][b]=h[a-1][b-1]+1:h[a][b]=Math.max(h[a-1][b],h[a][b-1]);let i=f,j=g,k=[];for(;i>0||j>0;)i>0&&j>0&&c[i-1]===d[j-1]?(k.push({type:"unchanged",content:c[i-1],oldLineNum:i,newLineNum:j}),i--,j--):j>0&&(0===i||h[i][j-1]>=h[i-1][j])?(k.push({type:"added",content:d[j-1],newLineNum:j}),j--):(k.push({type:"removed",content:c[i-1],oldLineNum:i}),i--);for(;k.length>0;)e.push(k.pop());return e}c.d(b,{X:()=>d})},32753:(a,b,c)=>{"use strict";c.d(b,{S:()=>f});var d=c(48249),e=c(63565);function f({engine:a,tooltip:b,size:c="md"}){let g=a||"claude";return(0,e.ch)(g)?(0,d.jsx)("span",{className:"shrink-0 inline-flex items-center","data-tooltip":b??e.H[g],children:(0,d.jsx)(e.eV,{engine:g,className:"sm"===c?"h-3 w-3":"h-3.5 w-3.5"})}):(0,d.jsx)("span",{className:"shrink-0 px-1 py-0.5 text-[10px] leading-none font-medium rounded bg-muted text-muted-foreground","data-tooltip":b??g,children:g})}},33281:(a,b,c)=>{"use strict";c.d(b,{t4:()=>J});var d=c(95753),e=c(88512),f=c(79606),g=c(28582),h=c(61808);let i=d.Um(h.j9,h.dl((a=>{switch((a??"").toLowerCase()){case"all":return g.u8;case"trace":return g.Cn;case"debug":return g.y;case"info":default:return g.R2;case"warning":case"warn":return g.N5;case"error":return g.$D;case"fatal":return g.Lj;case"none":return g.NV}})(process.env.COCKPIT_LOG_LEVEL)));var j=c(1239),k=c(69063);let l=globalThis,m=l.__cockpitSpanRing??={buffer:[],index:new Map},n=a=>{let b="abcdef0123456789",c="";for(let d=0;d<a;d++)c+=b.charAt(Math.floor(Math.random()*b.length));return c};class o{constructor(a,b,c,d,e,f){this.name=a,this.parent=b,this.context=c,this.startTime=e,this.kind=f,this._tag="Span",this.sampled=!0,this.attributes=new Map,this.events=[],this.traceId=j.Ru(b)?b.value.traceId:n(32),this.spanId=n(16),this.status={_tag:"Started",startTime:e},this.links=Array.from(d),function(a){if(m.buffer.push(a),m.index.set(a.spanId,m.buffer.length-1),m.buffer.length>500){m.buffer.shift(),m.index.clear();for(let a=0;a<m.buffer.length;a++)m.index.set(m.buffer[a].spanId,a)}}(function(a,b,c,d,e,f){return{traceId:b,spanId:a,parentSpanId:c,name:d,kind:e,startTimeNs:f.toString(),endTimeNs:null,durationMs:null,attributes:{},events:[],status:"started"}}(this.spanId,this.traceId,function(a){return j.Ru(a)?a.value.spanId:null}(b),a,f,e))}end(a,b){this.status={_tag:"Ended",endTime:a,exit:b,startTime:this.status.startTime},function(a,b,c){let d=m.index.get(a);if(void 0===d)return;let e=m.buffer[d];if(!e)return;let f=Number(b-BigInt(e.startTimeNs))/1e6;m.buffer[d]={...e,endTimeNs:b.toString(),durationMs:Math.round(100*f)/100,status:"Success"===c._tag?"ok":"error",errorMessage:"Failure"===c._tag?function(a){if(a instanceof Error)return a.message;if("string"==typeof a)return a;try{return JSON.stringify(a)}catch{return String(a)}}(c.cause):void 0}}(this.spanId,a,"Success"===b._tag?{_tag:"Success"}:{_tag:"Failure",cause:b.cause})}attribute(a,b){this.attributes.set(a,b),function(a,b,c){let d=m.index.get(a);if(void 0===d)return;let e=m.buffer[d];e&&(m.buffer[d]={...e,attributes:{...e.attributes,[b]:c}})}(this.spanId,a,b)}event(a,b,c){this.events.push([a,b,c??{}]),function(a,b,c,d){let e=m.index.get(a);if(void 0===e)return;let f=m.buffer[e];f&&(m.buffer[e]={...f,events:[...f.events,{name:b,timeNs:c.toString(),attributes:d}]})}(this.spanId,a,b,c)}addLinks(a){this.links.push(...a)}}let p=k.L8({span:(a,b,c,d,e,f)=>new o(a,b,c,d,e,f),context:a=>a()}),q=d.Py(k.sh,p);d.Ie;var r=c(66473);let s=r.eu("dev","prod")("COCKPIT_ENV").pipe(r.IQ("prod")),t=r.Yj("COCKPIT_HOST").pipe(r.IQ("127.0.0.1")),u=r.nd("COCKPIT_PORT").pipe(r.NW(()=>r.nd("PORT")),r.IQ(3457)),v=r.uK(r.Yj("COCKPIT_OPEN_PROJECT")).pipe(r.Tj(a=>"Some"===a._tag?a.value:void 0)),w=r.zM("COCKPIT_NO_OPEN").pipe(r.IQ(!1)),x=r.Yj("COCKPIT_LOG_LEVEL").pipe(r.IQ("info")),y=r.nd("COCKPIT_SNAPSHOT_KEEP_DAYS").pipe(r.IQ(7)),z=r.nd("COCKPIT_SNAPSHOT_REPO_TTL_DAYS").pipe(r.IQ(30)),A=r.nd("COCKPIT_SNAPSHOT_MAX_FILE_KB").pipe(r.IQ(2048)),B=r.nd("COCKPIT_SESSION_KEEP_DAYS").pipe(r.IQ(30));f.gen(function*(){let a=yield*s,b=yield*t,c=yield*u,d=yield*v,e=yield*w,g=yield*x,h=yield*y,i=yield*z,j=yield*A,k=yield*B,l=yield*f.sync(()=>{let a="u">typeof process?process.env:void 0,b=a?.HOME||a?.USERPROFILE||".",c=a?.COCKPIT_HOME;return c?c.replace(/^~(?=$|\/)/,b):b+"/.cockpit"});return{env:a,host:b,port:3457===c&&"dev"===a?3456:c,cockpitDir:l,openProject:d,openBrowser:!e,logLevel:g,logFile:l+"/logs/cockpit.log",snapshotKeepDays:h,snapshotRepoTtlDays:i,snapshotMaxFileKb:j,sessionKeepDays:k}}).pipe(f.orDie);let C=d.Ie;var D=c(7846),E=c(55805),F=c(23734);let G=d.P1(F.d,f.gen(function*(){let a=yield*D.dT();return yield*f.acquireRelease(f.sync(()=>b=>{f.runFork(D.mk(a,b))}),a=>f.sync(()=>{})),F.d.of({publish:(a,b)=>f.sync(()=>{}),subscribe:b=>E.qdp(a).pipe(E.pbD(a=>{var c;return c=a.data,!!c&&"object"==typeof c&&(c.topic===b.id||c.type===b.legacyType)}),E.TjK(a=>((a,b)=>{if(a.topic===b.id)return a.msg;let{type:c,...d}=a;return d})(a.data,b)))})})),H=d.Um(i,q,C),I=d.Um(H,G),J=e.L8(I);f.void},34001:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{NoteModal:()=>G});var e=c(48249),f=c(67484),g=c(44384),h=c(208),i=c(13191),j=c(63229),k=c(19043),l=c(48197),m=c(9731),n=c(44551),o=c(53116),p=c(16512),q=c(56444),r=c(11537),s=c(73555),t=c(1370),u=c(80118),v=c(54727),w=c(19545),x=c(92451),y=c(83179),z=c(33281),A=c(79606),B=c(7833),C=c(65484),D=c(43321),E=c(43037),F=c(39031);function G({isOpen:a,onClose:b,projectCwd:c,projectName:d}){let{t:H}=(0,g.Bd)(),[I,J]=(0,f.useState)(!0),[K,L]=(0,f.useState)(!1),M=(0,f.useRef)(null),N=(0,f.useRef)(!1),O=(0,f.useRef)(void 0),[P,Q]=(0,f.useState)(null),R=(0,f.useRef)(null),S=(0,f.useCallback)(async a=>{let b=(0,D.D)(a);L(!0);let d=await z.t4.runPromiseExit((0,C.Cq)(c,b,O.current).pipe(A.tapError(a=>A.sync(()=>console.error("Failed to save note:",a)))));if("Success"===d._tag){let a=d.value;a.conflict?(V.current?.commands.setContent(a.content,{emitUpdate:!1}),O.current=a.mtime,N.current=!1,(0,B.oR)(H("editor.conflictReloaded"),"info")):(O.current=a.mtime,N.current=!1)}L(!1)},[c,H]),T=(0,f.useCallback)(a=>{N.current=!0,M.current&&clearTimeout(M.current),M.current=setTimeout(()=>{S(a)},5e3)},[S]),U=(0,i.hG)({immediatelyRender:!1,extensions:[j.A.configure({heading:!1,link:!1}),u.R.configure({levels:[1,2,3]}),v.y,k.A.configure({placeholder:()=>h.A.t("editor.placeholder")}),l.XI.configure({resizable:!0}),m.H,n.n,o.A,p._,r.Ay.configure({autolink:!0,linkOnPaste:!0,openOnClick:!1,HTMLAttributes:{class:"tiptap-link",target:"_blank",rel:"noopener noreferrer"}}),q.$H.configure({nested:!0}),E.E3,F.IS,s.o.configure({html:!0,transformCopiedText:!1,transformPastedText:!0})],editorProps:{attributes:{class:"tiptap-editor focus:outline-none min-h-[60vh] px-6 py-4"},clipboardTextSerializer:a=>a.content.textBetween(0,a.content.size,"\n").replace(/\n+$/,""),transformCopied:a=>{let b=a=>!!a&&a.isTextblock&&0===a.content.size,c=a.content,{openStart:d,openEnd:e}=a;for(;c.childCount>1&&b(c.lastChild);)c=c.cut(0,c.size-c.lastChild.nodeSize),e=0;for(;c.childCount>1&&b(c.firstChild);)c=c.cut(c.firstChild.nodeSize),d=0;return new t.Ji(c,d,e)},handleClick:(a,b,c)=>{if(c.metaKey||c.ctrlKey){let c=a.state.doc.resolve(b).marks().find(a=>"link"===a.type.name)?.attrs;if(c?.href)return window.open(c.href,"_blank","noopener,noreferrer"),!0}return!1},handleKeyDown:(a,b)=>{if("Backspace"===b.key&&V.current){let a=V.current;if(a.isActive("codeBlock")){let{$from:b}=a.state.selection,c=b.node(b.depth);if("codeBlock"===c.type.name&&""===c.textContent)return a.chain().focus().toggleCodeBlock().run(),!0}}return"/"!==b.key||P||setTimeout(()=>{if(!V.current)return;let{from:a}=V.current.state.selection,b=V.current.state.doc.textBetween(Math.max(0,a-1),a,"\n");if("/"===b){R.current=a;let b=V.current.view.coordsAtPos(a);Q({query:"",position:{top:b.bottom+4,left:b.left}})}},0),!1}},onUpdate:({editor:a})=>{let b=(0,w.up)(a);if(T(b),null!==R.current){let{from:b}=a.state.selection;if(b<R.current)Q(null),R.current=null;else{let c=a.state.doc.textBetween(R.current,b,"\n");c.includes(" ")||c.includes("\n")?(Q(null),R.current=null):Q(a=>a?{...a,query:c}:null)}}}}),V=(0,f.useRef)(null),W=(0,f.useCallback)(()=>{if(M.current&&(clearTimeout(M.current),M.current=null),N.current&&U){let a=(0,w.up)(U);S(a)}Q(null),R.current=null,b()},[U,S,b]);return a?(0,e.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,e.jsx)("div",{className:"absolute inset-0 bg-scrim",onClick:W}),(0,e.jsxs)("div",{className:"relative bg-card rounded-lg shadow-lv3 w-full max-w-6xl h-[90vh] mx-4 flex flex-col overflow-hidden",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border flex-shrink-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("h2",{className:"text-sm font-medium text-foreground",children:d?H("editor.noteTitle",{name:d}):H("editor.noteUntitled")}),K&&(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:H("editor.saving")})]}),(0,e.jsx)("button",{onClick:W,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-hover rounded transition-colors",children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsx)(y.NoteToolbar,{editor:U}),(0,e.jsx)("div",{className:"flex-1 overflow-y-auto",children:I?(0,e.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:(0,e.jsx)("span",{children:H("common.loading")})}):(0,e.jsx)(i.$Z,{editor:U})})]}),P&&U&&(0,e.jsx)(x.U,{editor:U,query:P.query,position:P.position,onClose:()=>{Q(null),R.current=null}})]}):null}d()}catch(a){d(a)}})},34728:(a,b,c)=>{"use strict";c.d(b,{U:()=>j});var d=c(67484),e=c(44384),f=c(7833),g=c(77156),h=c(59336),i=c(33281);function j(){let{t:a}=(0,e.Bd)();return(0,d.useCallback)(async b=>{let c=await i.t4.runPromiseExit((0,g.L5)(b));if("Success"===c._tag)c.value.alreadyExists?(0,f.oR)(a("skills.alreadyAdded"),"info"):((0,f.oR)(a("skills.added"),"success"),(0,h.k)());else{let b="Fail"===c.cause._tag?c.cause.error:null,d=b?.cause,e=d instanceof Error?d.message:a("skills.addFailed");(0,f.oR)(e,"error")}},[a])}},35208:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{xU:()=>u,xZ:()=>t});var e=c(48249),f=c(67484),g=c(44384),h=c(36043),i=c(32580),j=c(73414),k=c(7833),l=c(38896),m=c(36984),n=c(74542),o=c(26362),p=c(89719),q=a([o]);function r(a){return(0,f.useCallback)((b,c)=>{if(!a||c<=0)return;let d=(0,p.A)(b,b.currentTarget);d&&a(c,d.column,d.rect)},[a])}function s(a){return a.params?`${a.name}(${a.params.join(", ")})`:a.name}function t({oldContent:a,newContent:b,filePath:c,isNew:d=!1,isDeleted:p=!1,cwd:q,enableComments:u=!1,onPreview:v,previewLabel:w,onContentSearch:x,targetLine:y,compact:z=!1,symbols:A,onTokenHover:B,onTokenHoverLeave:C,onTokenHoverCancel:D}){let{t:E}=(0,g.Bd)(),F=r(B),G=w??E("common.preview"),H=(0,f.useMemo)(()=>(0,i.X)(a,b),[a,b]),I=(0,f.useRef)(null),J=(0,f.useRef)(null),K=(0,f.useRef)(null);(0,f.useRef)(!1);let[L,M]=(0,f.useState)(null),{commentsEnabled:N,linesWithComments:O,commentsByEndLine:P,handleCommentBubbleClick:Q,addCommentRange:R,sendToAIRange:S,commentPortal:T}=(0,o.T)({cwd:q,enableComments:u,filePath:c,diffLines:H,containerEl:L,onContentSearch:x}),{leftLines:U,rightLines:V}=(0,f.useMemo)(()=>{let a=[],b=[],c=0,d=0;for(let e=0;e<H.length;e++){let f=H[e];if("unchanged"===f.type){for(;a.length<b.length;)a.push({lineNum:0,content:"",type:"unchanged",originalIdx:-1});for(;b.length<a.length;)b.push({lineNum:0,content:"",type:"unchanged",originalIdx:-1});c++,d++,a.push({lineNum:c,content:f.content,type:"unchanged",originalIdx:e}),b.push({lineNum:d,content:f.content,type:"unchanged",originalIdx:e})}else"removed"===f.type?(c++,a.push({lineNum:c,content:f.content,type:"removed",originalIdx:e})):"added"===f.type&&(d++,b.push({lineNum:d,content:f.content,type:"added",originalIdx:e}))}for(;a.length<b.length;)a.push({lineNum:0,content:"",type:"unchanged",originalIdx:-1});for(;b.length<a.length;)b.push({lineNum:0,content:"",type:"unchanged",originalIdx:-1});return{leftLines:a,rightLines:b}},[H]),W=(0,f.useMemo)(()=>H.map(a=>a.content),[H]),X=(0,l.C)(W,c),[Y,Z]=(0,f.useState)(()=>new Map),$=(0,f.useMemo)(()=>A??[],[A]),{rows:_,gaps:aa}=(0,f.useMemo)(()=>z?(0,j.pU)(U,V,Y,$):{rows:U.map((a,b)=>({kind:"diff",idx:b})),gaps:[]},[z,U,U,V,Y,$]),ab=(0,f.useCallback)((a,b)=>{let c=aa.find(b=>b.id===a);c&&Z(d=>{let e=d.get(a)??{topRevealed:0,bottomRevealed:0},f=c.endIdx-c.startIdx+1-e.topRevealed-e.bottomRevealed;if(f<=0)return d;let g=Math.min(j.YO,f),h="up"===b?{...e,topRevealed:e.topRevealed+g}:{...e,bottomRevealed:e.bottomRevealed+g};return new Map(d).set(a,h)})},[aa]);(0,f.useCallback)(a=>{for(let b of aa)if(a>=b.startIdx&&a<=b.endIdx)return b.id;return null},[aa]);let ac=(0,f.useCallback)(a=>_[a]?.kind==="gap-label"?28:20,[_]),ad=(0,f.useCallback)(a=>{let b=_[a];if(!b)return a;if("gap-label"===b.kind)return`gl:${b.gapId}`;if("gap-expand"===b.kind)return`ge:${b.gapId}:${b.direction}`;let c=U[b.idx],d=V[b.idx];return`d:${c?.lineNum??"x"}:${c?.type??"x"}:${d?.lineNum??"x"}:${d?.type??"x"}`},[_,U,V]),ae=(0,h.Te)({count:_.length,getScrollElement:()=>I.current,estimateSize:ac,getItemKey:ad,overscan:20}),af=d?"w-1/4":p?"w-3/4":"w-1/2",ag=d?"w-3/4":p?"w-1/4":"w-1/2",ah=(0,f.useMemo)(()=>_.map(a=>{if("diff"!==a.kind)return{type:"unchanged"};let b=U[a.idx],c=V[a.idx];return"removed"===b.type?{type:"removed"}:c?.type==="added"?{type:"added"}:{type:"unchanged"}}),[_,U,V]),ai=ae.getTotalSize(),aj=ae.getVirtualItems();return(0,e.jsxs)("div",{className:"font-mono flex flex-col h-full text-sm",children:[(0,e.jsxs)("div",{className:"flex flex-shrink-0 border-b border-border",children:[(0,e.jsx)("div",{className:`${af} min-w-0 px-2 py-1 bg-accent text-muted-foreground text-center text-xs font-medium border-r border-border`,children:d?"(New File)":p?"Deleted":"Old"}),(0,e.jsxs)("div",{className:`${ag} min-w-0 px-2 py-1 bg-accent text-muted-foreground text-xs font-medium relative`,children:[(0,e.jsx)("span",{className:"block text-center",children:p?"(Deleted)":"New"}),(0,e.jsxs)("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-2",children:[v&&(0,e.jsx)("button",{onClick:v,className:"text-muted-foreground hover:text-foreground transition-colors",children:G}),!p&&b&&(0,e.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(b),(0,k.oR)(E("diffViewer.copiedAll"))},className:"text-muted-foreground hover:text-foreground transition-colors",children:E("common.copy")})]})]}),(0,e.jsx)("div",{className:"w-4 flex-shrink-0 bg-accent"})]}),(0,e.jsxs)("div",{className:"flex-1 min-h-0 flex",children:[(0,e.jsx)("div",{ref:I,className:"flex-1 overflow-y-auto overflow-x-hidden",children:(0,e.jsxs)("div",{className:"flex",style:{height:`${ai}px`},children:[(0,e.jsx)("div",{ref:J,className:`${af} overflow-x-auto border-r border-border`,children:(0,e.jsx)("div",{className:"min-w-max h-full",style:{position:"relative"},children:aj.map(a=>{let b=_[a.index];if("gap-expand"===b.kind||"gap-label"===b.kind){let c="gap-label"===b.kind;return(0,e.jsx)("div",{ref:ae.measureElement,"data-index":a.index,style:{position:"absolute",top:0,left:0,width:"100%",height:`${Math.max(a.size,ac(a.index))}px`,transform:`translateY(${a.start}px)`},className:c?"bg-accent border-y border-border":""},a.key)}let c=U[b.idx];return(0,e.jsxs)("div",{ref:ae.measureElement,"data-index":a.index,"data-row-idx":b.idx,style:{position:"absolute",top:0,left:0,minWidth:"100%",width:"max-content",height:`${Math.max(a.size,ac(a.index))}px`,transform:`translateY(${a.start}px)`},className:`flex ${"removed"===c.type?"bg-red-9/15 dark:bg-red-9/25":""}`,children:[(0,e.jsx)("span",{className:"w-10 flex-shrink-0 text-right pr-2 text-foreground-subtle select-none border-r border-border",children:c.lineNum||""}),(0,e.jsx)("span",{className:"whitespace-pre pl-2",dangerouslySetInnerHTML:{__html:c.originalIdx>=0&&X[c.originalIdx]||(0,m.ZD)(c.content||" ")}})]},a.key)})})}),(0,e.jsx)("div",{ref:K,className:`${ag} overflow-x-auto`,children:(0,e.jsx)("div",{className:"min-w-max h-full",style:{position:"relative"},children:aj.map(a=>{let b=_[a.index];if("gap-expand"===b.kind)return(0,e.jsx)("button",{ref:ae.measureElement,"data-index":a.index,type:"button",onClick:()=>ab(b.gapId,b.direction),style:{position:"absolute",top:0,left:0,width:"100%",height:`${Math.max(a.size,ac(a.index))}px`,transform:`translateY(${a.start}px)`},className:"flex items-center justify-center text-[11px] text-foreground/50 hover:bg-hover hover:text-brand active:bg-brand/15 transition-colors duration-100 cursor-pointer focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-brand/60",title:E("up"===b.direction?"diffViewer.gap.expandUp":"diffViewer.gap.expandDown",{count:b.revealCount}),"aria-label":E("up"===b.direction?"diffViewer.gap.expandUp":"diffViewer.gap.expandDown",{count:b.revealCount}),children:(0,e.jsx)("span",{className:"select-none",children:E("diffViewer.gap.more",{count:b.revealCount})})},a.key);if("gap-label"===b.kind)return(0,e.jsxs)("div",{ref:ae.measureElement,"data-index":a.index,"data-gap-id":b.gapId,style:{position:"absolute",top:0,left:0,width:"100%",height:`${Math.max(a.size,ac(a.index))}px`,transform:`translateY(${a.start}px)`},className:"flex items-center justify-center gap-2 px-3 text-[11px] text-foreground/80 bg-accent border-y border-border min-w-0 select-none",children:[(0,e.jsx)("span",{className:"flex-shrink-0",children:E("diffViewer.gap.hidden",{count:b.hiddenCount})}),b.enclosingFn&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"opacity-50 flex-shrink-0",children:"\xb7"}),(0,e.jsx)("span",{className:"truncate min-w-0 font-medium","data-tooltip":s(b.enclosingFn),children:s(b.enclosingFn)})]})]},a.key);let c=V[b.idx],d=c?.lineNum||0,f=d>0&&O.has(d),g=P.get(d),h=g?.[0],i=R&&d>=R.start&&d<=R.end,j=S&&d>=S.start&&d<=S.end,k=i||j;return(0,e.jsxs)("div",{ref:ae.measureElement,"data-index":a.index,"data-new-line":d||void 0,"data-row-idx":b.idx,style:{position:"absolute",top:0,left:0,minWidth:"100%",width:"max-content",height:`${Math.max(a.size,ac(a.index))}px`,transform:`translateY(${a.start}px)`},className:`flex ${k?"bg-blue-9/20":f?"bg-amber-9/10":c?.type==="added"?"bg-green-9/15 dark:bg-green-9/25":""}`,children:[(0,e.jsxs)("span",{className:`flex-shrink-0 flex items-center gap-0.5 pr-1 text-foreground-subtle select-none border-r border-border ${k?"bg-blue-9/30":""}`,style:{width:N?"52px":"40px"},children:[N&&d>0&&f&&h&&(0,e.jsx)("button",{onClick:a=>Q(h,a),className:"w-4 h-4 flex items-center justify-center rounded hover:bg-hover text-amber-9",title:E("codeViewer.nComments",{count:g?.length}),children:(0,e.jsx)("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",children:(0,e.jsx)("path",{fillRule:"evenodd",d:"M18 10c0 3.866-3.582 7-8 7a8.841 8.841 0 01-4.083-.98L2 17l1.338-3.123C2.493 12.767 2 11.434 2 10c0-3.866 3.582-7 8-7s8 3.134 8 7zM7 9H5v2h2V9zm8 0h-2v2h2V9zM9 9h2v2H9V9z",clipRule:"evenodd"})})}),N&&d>0&&!f&&(0,e.jsx)("span",{className:"w-4"}),(0,e.jsx)("span",{className:"flex-1 text-right pr-1",children:d||""})]}),(0,e.jsx)("span",{className:"whitespace-pre pl-2",onMouseOver:B?a=>F(a,d):void 0,onMouseLeave:B?C:void 0,onMouseDown:B?D:void 0,dangerouslySetInnerHTML:{__html:c?.originalIdx>=0&&X[c.originalIdx]||(0,m.ZD)(c?.content||" ")}})]},a.key)})})})]})}),(0,e.jsx)(n.b,{lines:ah,containerRef:I})]}),T]})}function u({oldContent:a,newContent:b,filePath:c,cwd:d,enableComments:p=!1,onPreview:q,previewLabel:s,onContentSearch:t,compact:v=!1,onTokenHover:w,onTokenHoverLeave:x,onTokenHoverCancel:y}){let{t:z}=(0,g.Bd)(),A=r(w),B=s??z("common.preview"),C=(0,f.useMemo)(()=>(0,i.X)(a,b),[a,b]),D=(0,f.useRef)(null),E=(0,f.useMemo)(()=>C.map(a=>a.content),[C]),F=(0,l.C)(E,c),[G,H]=(0,f.useState)(null),{commentsEnabled:I,linesWithComments:J,commentsByEndLine:K,handleCommentBubbleClick:L,addCommentRange:M,sendToAIRange:N,commentPortal:O}=(0,o.T)({cwd:d,enableComments:p,filePath:c,diffLines:C,containerEl:G,onContentSearch:t}),[P,Q]=(0,f.useState)(()=>new Set),R=(0,f.useMemo)(()=>v?function(a,b){let c=a.length,d=Array(c).fill(!1);for(let b=0;b<c;b++){if("unchanged"===a[b].type)continue;let e=Math.max(0,b-j.aj),f=Math.min(c-1,b+j.aj);for(let a=e;a<=f;a++)d[a]=!0}let e=[],f=0,g=0;for(;g<c;){if(d[g]){e.push({kind:"line",line:a[g],index:g}),g++;continue}let h=g;for(;h<c&&!d[h];)h++;let i=f++;if(b.has(i))for(let b=g;b<h;b++)e.push({kind:"line",line:a[b],index:b});else e.push({kind:"gap",id:i,count:h-g});g=h}return e}(C,P):C.map((a,b)=>({kind:"line",line:a,index:b})),[v,C,P]),S=(0,f.useCallback)(a=>{let b=R[a];if(!b)return a;if("gap"===b.kind)return`gap:${b.id}`;let c=b.line;return`${c.type}:${c.oldLineNum??"x"}:${c.newLineNum??"x"}`},[R]),T=(0,h.Te)({count:R.length,getScrollElement:()=>D.current,estimateSize:()=>20,getItemKey:S,overscan:20}),U=(0,f.useMemo)(()=>R.map(a=>"gap"===a.kind?{type:"unchanged"}:{type:a.line.type}),[R]);return(0,e.jsxs)("div",{className:"font-mono flex flex-col h-full text-sm",children:[(q||b)&&(0,e.jsxs)("div",{className:"flex-shrink-0 flex items-center justify-end gap-2 px-2 py-1 border-b border-border bg-accent text-xs",children:[q&&(0,e.jsx)("button",{onClick:q,className:"text-muted-foreground hover:text-foreground transition-colors",children:B}),b&&(0,e.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(b),(0,k.oR)(z("diffViewer.copiedAll"))},className:"text-muted-foreground hover:text-foreground transition-colors",children:z("common.copy")}),(0,e.jsx)("div",{className:"w-4 flex-shrink-0"})]}),(0,e.jsxs)("div",{className:"flex-1 min-h-0 flex",children:[(0,e.jsx)("div",{ref:D,className:"flex-1 min-w-0 overflow-auto",children:(0,e.jsx)("div",{style:{height:`${T.getTotalSize()}px`,position:"relative"},children:T.getVirtualItems().map(a=>{let b=R[a.index];if(!b)return null;let c={position:"absolute",top:0,left:0,minWidth:"100%",width:"max-content",height:`${a.size}px`,transform:`translateY(${a.start}px)`};if("gap"===b.kind){let d=z("diffViewer.gap.hidden",{count:b.count});return(0,e.jsx)("div",{style:c,onClick:()=>Q(a=>new Set(a).add(b.id)),className:"flex items-center cursor-pointer bg-slate-2 hover:bg-hover border-y border-border text-xs text-foreground-subtle select-none","data-tooltip":d,children:(0,e.jsx)("span",{className:"w-full text-center",children:d})},a.key)}let d=b.line,f="removed"!==d.type?d.newLineNum??0:0,g=f>0&&J.has(f),h=K.get(f),i=h?.[0],j=M&&f>=M.start&&f<=M.end,k=N&&f>=N.start&&f<=N.end;return(0,e.jsxs)("div",{style:c,"data-new-line":f||void 0,className:`flex ${j||k?"bg-blue-9/20":g?"bg-amber-9/10":"removed"===d.type?"bg-red-9/15 dark:bg-red-9/25":"added"===d.type?"bg-green-9/15 dark:bg-green-9/25":""}`,children:[I&&(0,e.jsx)("span",{className:"w-5 flex-shrink-0 flex items-center justify-center select-none",children:f>0&&g&&i&&(0,e.jsx)("button",{onClick:a=>L(i,a),className:"w-4 h-4 flex items-center justify-center rounded hover:bg-hover text-amber-9",title:z("codeViewer.nComments",{count:h?.length}),children:(0,e.jsx)("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",children:(0,e.jsx)("path",{fillRule:"evenodd",d:"M18 10c0 3.866-3.582 7-8 7a8.841 8.841 0 01-4.083-.98L2 17l1.338-3.123C2.493 12.767 2 11.434 2 10c0-3.866 3.582-7 8-7s8 3.134 8 7zM7 9H5v2h2V9zm8 0h-2v2h2V9zM9 9h2v2H9V9z",clipRule:"evenodd"})})})}),(0,e.jsx)("span",{className:"w-10 flex-shrink-0 text-right pr-2 text-foreground-subtle select-none border-r border-border",children:"added"!==d.type?d.oldLineNum:""}),(0,e.jsx)("span",{className:"w-10 flex-shrink-0 text-right pr-2 text-foreground-subtle select-none border-r border-border",children:"removed"!==d.type?d.newLineNum:""}),(0,e.jsx)("span",{className:`w-6 flex-shrink-0 text-center select-none ${"removed"===d.type?"text-red-11":"added"===d.type?"text-green-11":"text-foreground-subtle"}`,children:"removed"===d.type?"-":"added"===d.type?"+":" "}),(0,e.jsx)("span",{className:"flex-1 whitespace-pre pl-1",onMouseOver:w?a=>A(a,f):void 0,onMouseLeave:w?x:void 0,onMouseDown:w?y:void 0,dangerouslySetInnerHTML:{__html:F[b.index]||(0,m.ZD)(d.content||" ")}})]},a.key)})})}),(0,e.jsx)(n.b,{lines:U,containerRef:D})]}),O]})}o=(q.then?(await q)():q)[0],d()}catch(a){d(a)}})},35606:(a,b,c)=>{"use strict";function d(a,b){switch(a){case"codex":return`codex resume ${b}`;case"kimi":case"glm":case"deepseek":case"ollama":return`${a} ${b}`;default:return`claude -r ${b}`}}c.d(b,{X:()=>d})},35857:(a,b,c)=>{"use strict";function d(){}c.d(b,{N:()=>d})},36688:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{x:()=>k});var e=c(48249),f=c(67484),g=c(44256),h=c(7122),i=c(73887),j=a([i]);function k({filePath:a,content:b,cwd:c,onClose:d,zClassName:j="z-50"}){let[l,m]=(0,f.useState)(null);return(0,e.jsx)(g.ZL,{children:(0,e.jsx)("div",{className:`fixed inset-0 ${j} flex items-center justify-center bg-scrim p-0 md:p-4`,onClick:d,children:(0,e.jsx)("div",{ref:m,className:"bg-card shadow-lv3 w-full h-full rounded-none md:max-w-[90%] md:h-[90vh] md:rounded-lg flex flex-col relative",onClick:a=>a.stopPropagation(),children:(0,e.jsx)(h.SU,{container:l,children:(0,e.jsx)(i.M,{content:b,filePath:a,cwd:c,onClose:d})})})})})}i=(j.then?(await j)():j)[0],d()}catch(a){d(a)}})},36702:(a,b,c)=>{"use strict";c.d(b,{V:()=>y});var d=c(48249),e=c(67484),f=c(44384),g=c(44256),h=c(7833);function i({image:a,onClose:b}){let{t:c}=(0,f.Bd)(),e=async b=>{b.stopPropagation();try{var d;if(!navigator.clipboard?.write||"u"<typeof ClipboardItem)throw Error("Clipboard image write is unavailable");let b=await (d=a.preview,new Promise((a,b)=>{let c=new Image;c.onload=()=>{let d=document.createElement("canvas");d.width=c.naturalWidth,d.height=c.naturalHeight;let e=d.getContext("2d");e?(e.drawImage(c,0,0),d.toBlob(c=>{c?a(c):b(Error("Could not encode image"))},"image/png")):b(Error("Canvas is unavailable"))},c.onerror=()=>b(Error("Could not load image")),c.src=d}));await navigator.clipboard.write([new ClipboardItem({"image/png":b})]),(0,h.oR)(c("imagePreview.copiedImage"),"success")}catch{(0,h.oR)(c("common.copyFailed"),"error")}},j=(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80",onClick:b,children:[(0,d.jsxs)("div",{className:"absolute top-4 right-4 flex items-center gap-2",children:[(0,d.jsx)("button",{type:"button",onClick:e,className:"w-10 h-10 flex items-center justify-center text-white/80 hover:text-white bg-black/40 hover:bg-black/60 rounded-full transition-colors",title:c("imagePreview.copyImage"),children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7V5a2 2 0 0 1 2-2h7a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-2M7 7h6a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Z"})})}),(0,d.jsx)("button",{type:"button",onClick:b,className:"w-10 h-10 flex items-center justify-center text-white/80 hover:text-white bg-black/40 hover:bg-black/60 rounded-full transition-colors",title:c("common.close"),children:(0,d.jsx)("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,d.jsx)("img",{src:a.preview,alt:c("imagePreview.previewImage"),className:"max-w-[90vw] max-h-[90vh] object-contain",onClick:a=>a.stopPropagation()})]});return(0,d.jsx)(g.ZL,{children:j})}function j({images:a,onRemove:b,disabled:c}){let{t:g}=(0,f.Bd)(),[h,k]=(0,e.useState)(null);return 0===a.length?null:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"flex flex-wrap gap-2 p-2 border-b border-border",children:a.map(a=>(0,d.jsxs)("div",{className:"relative group w-16 h-16 rounded-lg overflow-hidden border border-border cursor-pointer",onClick:()=>k(a),children:[(0,d.jsx)("img",{src:a.preview,alt:g("imagePreview.previewImage"),className:"w-full h-full object-cover hover:opacity-90 transition-opacity"}),(0,d.jsx)("button",{onClick:c=>{c.stopPropagation(),b(a.id)},className:"absolute top-0 right-0 w-5 h-5 bg-black/60 hover:bg-black/80 text-white text-xs flex items-center justify-center rounded-bl-lg opacity-0 group-hover:opacity-100 transition-opacity",title:g("imagePreview.deleteImage"),children:"✕"})]},a.id))}),h&&(0,d.jsx)(i,{image:h,onClose:()=>k(null)})]})}var k=c(30458),l=c(24520),m=c(33999),n=c(74118),o=c(3623),p=c(12625),q=c(46674),r=c(72529),s=c(33281),t=c(41224);function u({initialValue:a,placeholder:b,onCommit:c,onCancel:f}){let[g,h]=(0,e.useState)(a),i=(0,e.useCallback)(a=>{if("Enter"!==a.key||a.nativeEvent.isComposing)"Escape"===a.key&&(a.preventDefault(),a.stopPropagation(),f());else{a.preventDefault(),a.stopPropagation();let b=g.trim();b&&c(b)}},[g,c,f]);return(0,d.jsx)("input",{type:"text",value:g,onChange:a=>h(a.target.value),onKeyDown:i,placeholder:b,autoFocus:!0,className:"w-full min-w-0 px-2 py-1 mb-1 text-xs rounded border border-input bg-background focus:outline-none focus:ring-1 focus:ring-ring"})}function v({label:a,prompts:b,isAdding:c,onStartAdd:g,onCancelAdd:h,onAdd:i,onUpdate:j,onDelete:k,onReorder:s,onSelect:t,onInsert:w}){let{t:x}=(0,f.Bd)(),[y,z]=(0,e.useState)(null),[A,B]=(0,e.useState)(null),[C,D]=(0,e.useState)(null),E=(0,e.useCallback)(()=>{B(null),D(null)},[]),F=(0,e.useCallback)((a,b)=>{a.preventDefault(),D(b)},[]),G=(0,e.useCallback)(a=>{if(null===A||A===a)return void E();let c=[...b],[d]=c.splice(A,1);c.splice(a,0,d),E(),z(null),s(c)},[A,b,s,E]);return(0,d.jsxs)("div",{className:"p-2",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,d.jsx)("span",{className:"text-xs font-medium text-muted-foreground px-1",children:a}),(0,d.jsx)("button",{type:"button",onClick:()=>{z(null),g()},className:"p-0.5 text-muted-foreground hover:text-foreground rounded",title:x("chat.addQuickPrompt"),children:(0,d.jsx)(l.A,{className:"w-3.5 h-3.5"})})]}),c&&(0,d.jsx)(u,{initialValue:"",placeholder:x("chat.quickPromptPlaceholder"),onCommit:i,onCancel:h}),0===b.length&&!c&&(0,d.jsx)("div",{className:"text-xs text-muted-foreground px-1 py-1",children:x("chat.noQuickPrompts")}),b.map((a,b)=>y===b?(0,d.jsx)(u,{initialValue:a,placeholder:x("chat.quickPromptPlaceholder"),onCommit:a=>{z(null),j(b,a)},onCancel:()=>z(null)},`edit-${b}`):(0,d.jsxs)("div",{draggable:!0,onDragStart:()=>B(b),onDragOver:a=>F(a,b),onDrop:()=>G(b),onDragEnd:E,className:`flex items-center group min-w-0 rounded transition-opacity ${A===b?"opacity-50":""} ${C===b&&A!==b?"border-t-2 border-brand":""}`,children:[(0,d.jsx)(m.A,{className:"w-3 h-3 flex-shrink-0 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity cursor-grab"}),(0,d.jsx)(r.m,{content:a,children:(0,d.jsxs)("button",{type:"button",onClick:()=>t(a),className:"flex-1 min-w-0 flex items-center gap-2 px-2 py-1.5 text-left text-sm rounded hover:bg-hover transition-colors",children:[(0,d.jsx)(n.A,{className:"w-3 h-3 flex-shrink-0 text-muted-foreground"}),(0,d.jsx)("span",{className:"truncate",children:a})]})}),(0,d.jsx)("button",{type:"button",onClick:()=>w(a),className:"p-1 text-muted-foreground hover:text-foreground rounded opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0",title:x("chat.insertQuickPrompt"),children:(0,d.jsx)(o.A,{className:"w-3 h-3"})}),(0,d.jsx)("button",{type:"button",onClick:()=>z(b),className:"p-1 text-muted-foreground hover:text-foreground rounded opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0",title:x("common.edit"),children:(0,d.jsx)(p.A,{className:"w-3 h-3"})}),(0,d.jsx)("button",{type:"button",onClick:()=>{z(null),k(b)},className:"p-1 text-muted-foreground hover:text-destructive rounded opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0",title:x("common.delete"),children:(0,d.jsx)(q.A,{className:"w-3 h-3"})})]},b))]})}function w({cwd:a,anchorRef:b,onClose:c,onSelect:g,onInsert:h}){let{t:i}=(0,f.Bd)(),[j,k]=(0,e.useState)([]),[l,m]=(0,e.useState)([]),[n,o]=(0,e.useState)(null),p=(0,e.useCallback)(async(b,c)=>{let d="global"===b?k:m;d(c);let e=await s.t4.runPromiseExit((0,t.tY)("global"===b?{scope:"global",prompts:c}:{cwd:a,prompts:c}));"Failure"===e._tag?console.error(`Failed to save ${b} prompts:`,e.cause):e.value?.prompts&&d(e.value.prompts)},[a]),q=(0,e.useCallback)(a=>{c(),g(a)},[c,g]),r=(0,e.useCallback)(a=>{c(),h(a)},[c,h]);return(0,d.jsxs)("div",{className:"absolute bottom-full left-0 mb-2 w-80 max-w-[calc(100vw-1.5rem)] bg-popover border border-border rounded-lg shadow-lv2 z-50 max-h-[70vh] overflow-y-auto",children:[(0,d.jsx)(v,{label:i("chat.globalPrompts"),prompts:j,isAdding:"global"===n,onStartAdd:()=>o("global"),onCancelAdd:()=>o(null),onAdd:a=>{p("global",[...j,a]),o(null)},onUpdate:(a,b)=>p("global",j.map((c,d)=>d===a?b:c)),onDelete:a=>p("global",j.filter((b,c)=>c!==a)),onReorder:a=>p("global",a),onSelect:q,onInsert:r}),a&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"border-t border-border"}),(0,d.jsx)(v,{label:i("chat.projectPrompts"),prompts:l,isAdding:"project"===n,onStartAdd:()=>o("project"),onCancelAdd:()=>o(null),onAdd:a=>{p("project",[...l,a]),o(null)},onUpdate:(a,b)=>p("project",l.map((c,d)=>d===a?b:c)),onDelete:a=>p("project",l.filter((b,c)=>c!==a)),onReorder:a=>p("project",a),onSelect:q,onInsert:r})]})]})}var x=c(71697);let y=(0,e.memo)(function({onSend:a,disabled:b,cwd:c,engine:g,onShowGitStatus:h,onShowComments:i,onShowUserMessages:l,onOpenNote:m,onCreateScheduledTask:n}){let{t:o}=(0,f.Bd)(),[p,q]=(0,e.useState)(""),[r,s]=(0,e.useState)([]),[t,u]=(0,e.useState)(!1),[v,y]=(0,e.useState)(!1),z=(0,e.useRef)(null),A=(0,e.useRef)(null),B=(0,e.useCallback)(()=>{let a=z.current;if(!a)return;a.style.height="auto";let b=Math.max(38,Math.min(a.scrollHeight,200));a.style.height=`${b}px`},[]);(0,e.useLayoutEffect)(()=>{B()},[p,B]);let C=(0,e.useMemo)(()=>g&&"claude"!==g?[]:[{name:"/plan",description:"Enable plan mode (read-only). /plan <task> to plan a task; /plan off to disable.",source:"builtin",argumentHint:"[task|off]"}],[g]),D=(0,x.n)({value:p,onChange:q,textareaRef:z,extraCommands:C}),E=(0,e.useCallback)(()=>{let c=p.trim();(c||r.length>0)&&!b&&(a(c,r.length>0?r:void 0),q(""),s([]),z.current&&(z.current.style.height="auto"))},[p,r,b,a]),F=(0,e.useCallback)(c=>{b||a(c)},[b,a]),G=(0,e.useCallback)(a=>{q(b=>{let c=b.replace(/\s+$/,"");return c?`${c}
42
+ ${a}`:a}),requestAnimationFrame(()=>{let a=z.current;a&&(a.focus(),a.setSelectionRange(a.value.length,a.value.length))})},[]),H=(0,e.useCallback)(a=>{a.nativeEvent.isComposing||!D.handleKeyDown(a)&&("Enter"!==a.key||a.shiftKey||a.nativeEvent.isComposing||(a.preventDefault(),E()))},[D,E]),I=(0,e.useCallback)(a=>{let b=a.clipboardData?.items;if(!b)return;let c=["image/png","image/jpeg","image/webp","image/gif"];for(let d of Array.from(b)){let b=c.find(a=>d.type===a);if(b){a.preventDefault();let c=d.getAsFile();if(!c)continue;if(c.size>5242880){alert(o("chat.imageSizeLimit",{size:(c.size/1024/1024).toFixed(2)}));continue}let e=new FileReader;e.onload=a=>{let c=a.target?.result;if(!c)return;let d=c.replace(/^data:image\/\w+;base64,/,""),e={id:`img-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,data:d,preview:c,media_type:b};s(a=>[...a,e])},e.readAsDataURL(c)}}},[o]),J=(0,e.useCallback)(a=>{s(b=>b.filter(b=>b.id!==a))},[]);return(0,d.jsxs)("div",{className:"border-t border-border bg-card relative",children:[(0,d.jsx)(j,{images:r,onRemove:J,disabled:b}),(0,d.jsx)(x.V,{ac:D,className:"absolute bottom-full left-0 right-0 mx-4 mb-2 max-h-64"}),(0,d.jsxs)("div",{className:"flex gap-2 items-end p-4",children:[h&&(0,d.jsx)("button",{onClick:h,className:"p-2 text-brand hover:text-teal-10 hover:bg-brand/10 active:bg-brand/20 active:scale-95 rounded-lg transition-all",title:o("chat.viewGitChanges"),children:(0,d.jsxs)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,d.jsx)("circle",{cx:"6",cy:"6",r:"2",strokeWidth:2}),(0,d.jsx)("circle",{cx:"18",cy:"6",r:"2",strokeWidth:2}),(0,d.jsx)("circle",{cx:"6",cy:"18",r:"2",strokeWidth:2}),(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 8v10M18 8v4c0 2-2 4-6 4"})]})}),i&&(0,d.jsx)("button",{onClick:i,className:"p-2 text-amber-11 hover:text-amber-10 hover:bg-amber-9/10 active:bg-amber-9/20 active:scale-95 rounded-lg transition-all",title:o("chat.viewAllComments"),children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})})}),l&&(0,d.jsx)("button",{onClick:l,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-hover active:bg-muted active:scale-95 rounded-lg transition-all",title:o("chat.userMessages"),children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})}),m&&(0,d.jsx)("button",{onClick:m,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-hover active:bg-muted active:scale-95 rounded-lg transition-all",title:o("chat.projectNotes"),children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),n&&(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("button",{onClick:()=>u(!t),className:`p-2 rounded-lg transition-all ${t?"text-brand bg-brand/10":"text-muted-foreground hover:text-foreground hover:bg-hover active:bg-muted active:scale-95"}`,title:o("chat.scheduledTasks"),children:(0,d.jsxs)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"10",strokeWidth:2}),(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6l4 2"})]})}),t&&(0,d.jsx)(k.E,{onClose:()=>u(!1),onCreate:n})]}),(0,d.jsxs)("div",{className:"relative",ref:A,children:[(0,d.jsx)("button",{onClick:()=>y(!v),className:`p-2 rounded-lg transition-all ${v?"text-brand bg-brand/10":"text-muted-foreground hover:text-foreground hover:bg-hover active:bg-muted active:scale-95"}`,title:o("chat.quickPrompts"),children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})})}),v&&(0,d.jsx)(w,{cwd:c,anchorRef:A,onClose:()=>y(!1),onSelect:F,onInsert:G})]}),(0,d.jsx)("textarea",{ref:z,value:p,onChange:a=>{q(a.target.value),D.trackCaret(a.target)},onSelect:a=>D.trackCaret(a.currentTarget),onKeyDown:H,onPaste:I,placeholder:b?o("chat.placeholderDisabled"):o("chat.placeholder"),rows:1,className:"flex-1 resize-none px-4 py-2 border border-border rounded-lg focus:outline-none focus:ring-2 focus:ring-ring bg-card text-foreground"})]})]})})},36984:(a,b,c)=>{"use strict";c.d(b,{Np:()=>k,ZD:()=>h,ZR:()=>i,b8:()=>j,kS:()=>f,sQ:()=>g});let d=null,e=["typescript","tsx","javascript","jsx","html","css","scss","json","yaml","python","go","rust","java","ruby","php","bash","shell","markdown","sql","c","cpp","swift","kotlin","dart","lua","graphql","xml"];function f(){return d||(d=Promise.resolve().then(c.bind(c,78908)).then(({createHighlighter:a})=>a({themes:["github-dark","github-light"],langs:[...e]}))),d}function g(a){let b=a.split("/").pop()?.toLowerCase()||"",c=b.split(".").pop()?.toLowerCase();if(".env"===b||b.startsWith(".env.")||"dockerfile"===b||b.startsWith("dockerfile.")||"makefile"===b)return"bash";let d={ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",mjs:"javascript",cjs:"javascript",html:"html",htm:"html",css:"css",scss:"scss",json:"json",yaml:"yaml",yml:"yaml",xml:"xml",py:"python",go:"go",rs:"rust",java:"java",kt:"kotlin",rb:"ruby",php:"php",cs:"cpp",cpp:"cpp",c:"c",h:"c",sh:"bash",bash:"bash",zsh:"bash",md:"markdown",mdx:"markdown",sql:"sql",swift:"swift",dart:"dart",lua:"lua",graphql:"graphql",gql:"graphql",toml:"yaml",sass:"scss",less:"css",scala:"java",r:"python",vim:"bash",env:"bash"}[c||""]||"text";return e.includes(d)?d:"text"}function h(a){return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}let i=2e3;function j(a){return a.length>i?h(a.map(a=>a.content).join("")):a.map(a=>a.color?`<span style="color:${a.color}">${h(a.content)}</span>`:h(a.content)).join("")}function k(a,b,c,d){if(!b)return[];let e=[],f=c?b:b.toLowerCase();for(let b=0;b<a.length;b++){let g=c?a[b]:a[b].toLowerCase(),h=0;for(;;){let a=g.indexOf(f,h);if(-1===a)break;let c=a+f.length;if(d){let d=a>0?g[a-1]:" ",f=c<g.length?g[c]:" ",h=!/\w/.test(d),i=!/\w/.test(f);h&&i&&e.push({lineIndex:b,startCol:a,endCol:c})}else e.push({lineIndex:b,startCol:a,endCol:c});h=a+1}}return e}},37129:(a,b,c)=>{"use strict";c.d(b,{useTabState:()=>l});var d=c(67484),e=c(23860),f=c(29939);c(57031),c(88214);var g=c(79606),h=c(33281),i=c(37388);let j=/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:\.jsonl)?$/i;function k(a){let b=a.match(j);return b?.[1]??a}function l({initialCwd:a,initialSessionId:b,activeView:c}){(0,d.useRef)(!1);let j=(0,d.useRef)(!0),[m,n]=(0,d.useState)(!1);(0,d.useCallback)(()=>{j.current=!1,n(!0)},[]);let o=(0,d.useRef)(c),p=(0,e.F)(),q=(0,d.useRef)(p),[r,s]=(0,d.useState)(()=>[{id:`tab-${Date.now()}`,cwd:a,sessionId:b,title:b?`Session ${b.slice(0,6)}...`:"New Chat"}]),[t,u]=(0,d.useState)(r[0]?.id??""),[v,w]=(0,d.useState)(new Set),x=(0,d.useRef)(r),y=(0,d.useRef)(t),z=(0,d.useRef)(new Set),A=(0,d.useCallback)((b,c)=>{a&&b&&h.t4.runFork((0,i.KJ)(a,b,c).pipe(g.catchAll(()=>g.void)))},[a]),[B,C]=(0,d.useState)(null),[D,E]=(0,d.useState)(null),F=(0,d.useCallback)(b=>{a&&h.t4.runPromise((0,i.n8)(a).pipe(g.catchAll(()=>g.succeed(null)))).then(c=>{if(!c)return;let d=c.engines||{},e={};for(let[a,b]of Object.entries(d))e["codex"===b?k(a):a]=b;let f=[];for(let a of c.sessions||[]){let b="codex"===d[a]?k(a):a;f.includes(b)||f.push(b)}let g=c.ollamaModels||{},h=c.deepseekModels||{},i=c.kimiModels||{},j=c.glmModels||{},l=c.claudeModels||{},m=c.claudeEfforts||{},n=c.claudeContextWindows||{},o=c.claudeFastModes||{},p=c.claudeThinkings||{},q=c.codexModels||{},r=c.codexReasoningEfforts||{},t=c.planModes||{},v=c.noHistories||{},w=x.current,z=new Set(b),A=w.filter(a=>!a.sessionId||!z.has(a.sessionId)),B=new Set(A.map(a=>a.sessionId).filter(Boolean)),C=f.filter(a=>!B.has(a));if(A.length===w.length&&0===C.length)return;let D=[...A,...C.map((b,c)=>({id:`tab-${Date.now()}-sync-${c}`,cwd:a,sessionId:b,title:`Session ${b.slice(0,6)}...`,engine:e[b]||void 0,ollamaModel:g[b]||void 0,deepseekModel:h[b]||void 0,kimiModel:i[b]||void 0,glmModel:j[b]||void 0,claudeModel:l[b]||void 0,claudeEffort:m[b]||void 0,claudeContextWindow:n[b]||void 0,claudeFastMode:o[b]??void 0,claudeThinking:p[b]??void 0,codexModel:q[b]||void 0,codexReasoningEffort:r[b]||void 0,planMode:t[b]||void 0,noHistory:v[b]||void 0}))];0===D.length&&(D=[{id:`tab-${Date.now()}`,cwd:a,title:"New Chat"}]),s(D),D.some(a=>a.id===y.current)||u(D[D.length-1].id)})},[a]);(0,f.h)({url:"/ws/global-state",enabled:!!a,onMessage:b=>{j.current||!a||"project-state-changed"===b.type&&b.cwd===a&&F(b.closedSessionIds??[])}});let G=(0,d.useCallback)((a,b,c,d)=>{let{engine:e,ollamaModel:f,deepseekModel:g,kimiModel:h,glmModel:i,claudeModel:j,claudeEffort:k,claudeContextWindow:l,claudeFastMode:m,claudeThinking:n,codexModel:o,codexReasoningEffort:p,planMode:q,noHistory:r,appendToEnd:v=!1}=d??{},w={id:`tab-${Date.now()}`,cwd:a,sessionId:b,title:c||(b?`Session ${b.slice(0,6)}...`:"New Chat"),engine:e,ollamaModel:f,deepseekModel:g,kimiModel:h,glmModel:i,claudeModel:j,claudeEffort:k,claudeContextWindow:l,claudeFastMode:m,claudeThinking:n,codexModel:o,codexReasoningEffort:p,planMode:q,noHistory:r};s(a=>{if(v)return[...a,w];let b=a.findIndex(a=>a.id===t);if(-1===b)return[...a,w];let c=[...a];return c.splice(b+1,0,w),c}),u(w.id)},[t]),H=(0,d.useCallback)(b=>{let c=x.current.find(a=>a.id===b);c?.sessionId&&z.current.add(c.sessionId),s(c=>{let d=c.filter(a=>a.id!==b);if(b===t&&d.length>0&&u(d[d.length-1].id),0===d.length){let b={id:`tab-${Date.now()}`,cwd:a,title:"New Chat"};return u(b.id),[b]}return d})},[t,a]),I=(0,d.useCallback)(()=>{x.current.forEach(a=>{a.sessionId&&z.current.add(a.sessionId)});let b={id:`tab-${Date.now()}`,cwd:a,title:"New Chat"};u(b.id),s([b])},[a]),J=(0,d.useCallback)((b,c)=>{let d=r.find(a=>a.sessionId===b);d?u(d.id):a?h.t4.runPromise((0,i.n8)(a).pipe(g.catchAll(()=>g.succeed(null)))).then(d=>{let e=x.current.find(a=>a.sessionId===b);e?u(e.id):G(a,b,c,{engine:d?.engines?.[b],ollamaModel:d?.ollamaModels?.[b],deepseekModel:d?.deepseekModels?.[b],kimiModel:d?.kimiModels?.[b],glmModel:d?.glmModels?.[b],claudeModel:d?.claudeModels?.[b],claudeEffort:d?.claudeEfforts?.[b],claudeContextWindow:d?.claudeContextWindows?.[b],claudeFastMode:d?.claudeFastModes?.[b],claudeThinking:d?.claudeThinkings?.[b],codexModel:d?.codexModels?.[b],codexReasoningEffort:d?.codexReasoningEfforts?.[b],planMode:d?.planModes?.[b],noHistory:d?.noHistories?.[b],appendToEnd:!0})}):G(a,b,c,{appendToEnd:!0})},[r,a,G]),K=(0,d.useCallback)(()=>{G(a,void 0,void 0,{appendToEnd:!0})},[a,G]),L=(0,d.useCallback)(()=>{G(a,void 0,"New Codex Chat",{engine:"codex",appendToEnd:!0})},[a,G]),M=(0,d.useCallback)(()=>{G(a,void 0,"New Kimi Chat",{engine:"kimi",kimiModel:"k3",appendToEnd:!0})},[a,G]),N=(0,d.useCallback)(()=>{G(a,void 0,"New GLM Chat",{engine:"glm",glmModel:"glm-5.3",appendToEnd:!0})},[a,G]),O=(0,d.useCallback)(b=>{G(a,void 0,b?`New Ollama (${b})`:"New Ollama Chat",{engine:"ollama",ollamaModel:b,appendToEnd:!0})},[a,G]),P=(0,d.useCallback)((a,b)=>{s(c=>c.map(c=>c.id===a&&c.engine!==b?{...c,engine:b}:c))},[]),Q=(0,d.useCallback)((a,b)=>{s(c=>c.map(c=>c.id===a?{...c,ollamaModel:b}:c))},[]),R=(0,d.useCallback)(()=>{G(a,void 0,"New DeepSeek Chat",{engine:"deepseek",deepseekModel:"deepseek-v4-flash",appendToEnd:!0})},[a,G]),S=(0,d.useCallback)((a,b)=>{s(c=>c.map(c=>c.id===a?{...c,deepseekModel:b}:c))},[]),T=(0,d.useCallback)((a,b)=>{s(c=>c.map(c=>c.id===a?{...c,kimiModel:b}:c))},[]),U=(0,d.useCallback)((a,b)=>{s(c=>c.map(c=>c.id===a?{...c,glmModel:b}:c))},[]),V=(0,d.useCallback)((a,b)=>{s(c=>c.map(c=>c.id===a?{...c,claudeModel:b}:c))},[]),W=(0,d.useCallback)((a,b)=>{s(c=>c.map(c=>c.id===a?{...c,claudeEffort:b}:c))},[]),X=(0,d.useCallback)((a,b)=>{s(c=>c.map(c=>c.id===a?{...c,claudeContextWindow:b}:c))},[]),Y=(0,d.useCallback)((a,b)=>{s(c=>c.map(c=>c.id===a?{...c,claudeFastMode:b}:c))},[]),Z=(0,d.useCallback)((a,b)=>{s(c=>c.map(c=>c.id===a?{...c,claudeThinking:b}:c))},[]),$=(0,d.useCallback)((a,b)=>{s(c=>c.map(c=>c.id===a?{...c,codexModel:b}:c))},[]),_=(0,d.useCallback)((a,b)=>{s(c=>c.map(c=>c.id===a?{...c,codexReasoningEffort:b}:c))},[]),aa=(0,d.useCallback)((a,b)=>{s(c=>c.map(c=>c.id===a?{...c,planMode:b}:c))},[]),ab=(0,d.useCallback)((a,b)=>{s(c=>c.map(c=>c.id===a?{...c,noHistory:b}:c))},[]),ac=(0,d.useCallback)((b,c)=>{let d=x.current.find(a=>a.id===y.current);G(a,b,c,{engine:d?.engine,ollamaModel:d?.ollamaModel,deepseekModel:d?.deepseekModel,kimiModel:d?.kimiModel,glmModel:d?.glmModel,claudeModel:d?.claudeModel,claudeEffort:d?.claudeEffort,claudeContextWindow:d?.claudeContextWindow,claudeFastMode:d?.claudeFastMode,claudeThinking:d?.claudeThinking,codexModel:d?.codexModel,codexReasoningEffort:d?.codexReasoningEffort})},[a,G]),ad=(0,d.useCallback)((a,b)=>{s(c=>{let d=c.find(b=>b.id===a);if(d?.isLoading&&!1===b.isLoading){let c=!o.current||"agent"===o.current;if(a===t&&c&&q.current){let a=d.sessionId||b.sessionId;a&&A(a,"normal")}else w(b=>new Set(b).add(a))}return c.map(c=>c.id===a?{...c,...b}:c)})},[t,A]),ae=(0,d.useCallback)(a=>{u(a),w(b=>{if(!b.has(a))return b;let c=new Set(b);c.delete(a);let d=x.current.find(b=>b.id===a);return d?.sessionId&&(A(d.sessionId,"normal"),h.t4.runFork((0,i.M2)(d.sessionId).pipe(g.catchAll(()=>g.void)))),c})},[A]),af=(0,d.useCallback)(a=>{C(a)},[]),ag=(0,d.useCallback)((a,b)=>{a.preventDefault(),null!==B&&B!==b&&E(b)},[B]),ah=(0,d.useCallback)(a=>{null!==B&&B!==a&&s(b=>{let c=[...b],[d]=c.splice(B,1);return c.splice(a,0,d),c}),C(null),E(null)},[B]),ai=(0,d.useCallback)(()=>{C(null),E(null)},[]),aj=r.find(a=>a.id===t);return{tabs:r,activeTabId:t,activeTab:aj,unreadTabs:v,dragTabIndex:B,dragOverTabIndex:D,addTab:G,closeTab:H,closeAllTabs:I,switchTab:ae,handleSelectSession:J,handleNewTab:K,handleNewCodexTab:L,handleNewKimiTab:M,handleNewGlmTab:N,handleNewOllamaTab:O,handleNewDeepseekTab:R,handleOpenSession:ac,updateTabState:ad,updateTabEngine:P,updateTabOllamaModel:Q,updateTabDeepseekModel:S,updateTabKimiModel:T,updateTabGlmModel:U,updateTabClaudeModel:V,updateTabClaudeEffort:W,updateTabClaudeContextWindow:X,updateTabClaudeFastMode:Y,updateTabClaudeThinking:Z,updateTabCodexModel:$,updateTabCodexReasoningEffort:_,updateTabPlanMode:aa,updateTabNoHistory:ab,handleTabDragStart:af,handleTabDragOver:ag,handleTabDrop:ah,handleTabDragEnd:ai}}},37202:(a,b,c)=>{"use strict";c.d(b,{M:()=>n,O:()=>l});var d=c(48249),e=c(67484),f=c(44384),g=c(74429),h=c(74228);let i=[],j=[];function k(){j.forEach(a=>a())}function l(a){let b=`session-toast-${Date.now()}-${Math.random().toString(36).slice(2,6)}`;i=[...i,{...a,id:b}],k()}function m(a){i=i.filter(b=>b.id!==a),k()}function n({onNavigate:a}){let b=function(){let[,a]=(0,e.useState)(0);return i}();return 0===b.length?null:(0,g.createPortal)((0,d.jsx)("div",{className:"fixed bottom-4 left-4 z-[100] flex flex-col gap-2 pointer-events-none",children:b.map(b=>(0,d.jsx)(o,{item:b,onNavigate:a,onRemove:m},b.id))}),document.body)}function o({item:a,onNavigate:b,onRemove:c}){let{t:g}=(0,f.Bd)(),[i,j]=(0,e.useState)(!1),k=(0,e.useRef)(void 0),l=(0,e.useCallback)(()=>{j(!0),setTimeout(()=>c(a.id),300)},[a.id,c]),m=(0,e.useCallback)(()=>{clearTimeout(k.current),b(a.cwd,a.sessionId),c(a.id)},[a,b,c]),n=(0,e.useCallback)(()=>{clearTimeout(k.current)},[]),p=(0,e.useCallback)(()=>{k.current=setTimeout(l,2e3)},[l]);return(0,d.jsxs)("div",{className:`group pointer-events-auto relative bg-popover border border-border rounded-lg shadow-lv3 px-3 py-3 min-h-[84px] min-w-[260px] max-w-[340px] cursor-pointer transition-all ${i?"opacity-0 -translate-x-4":"opacity-100 translate-x-0"}`,style:{animation:i?void 0:"slideInLeft 0.3s ease-out"},onClick:m,onMouseEnter:n,onMouseLeave:p,children:[(0,d.jsx)("div",{className:"pointer-events-none absolute inset-0 rounded-lg bg-hover opacity-0 group-hover:opacity-100 transition-opacity"}),(0,d.jsxs)("div",{className:"relative flex items-start gap-2",children:[(0,d.jsx)("svg",{className:"w-4 h-4 text-green-9 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),(0,d.jsx)("span",{className:"text-sm font-medium text-foreground truncate",children:a.projectName}),(0,d.jsx)("span",{className:"text-xs text-green-11 flex-shrink-0",children:g("common.done")}),(0,d.jsx)(h.l,{projectNumber:a.projectNumber,sessionNumber:a.sessionNumber,className:"ml-auto"}),(0,d.jsx)("button",{onClick:a=>{a.stopPropagation(),l()},className:"p-0.5 text-muted-foreground hover:text-foreground rounded transition-colors",children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),a.message&&(0,d.jsx)("div",{className:"relative text-xs text-muted-foreground line-clamp-2 break-words mt-1 ml-6",children:a.message})]})}},37388:(a,b,c)=>{"use strict";c.d(b,{KJ:()=>h,M2:()=>i,ej:()=>g,n8:()=>f});var d=c(79606),e=c(71192);let f=a=>d.tryPromise({try:async()=>{let b=await fetch(`/api/project-state?cwd=${encodeURIComponent(a)}`);if(!b.ok)throw Error(`HTTP ${b.status}`);return await b.json()},catch:a=>new e.uV({message:"loadProjectState failed",cause:a})}),g=a=>d.tryPromise({try:async()=>{let b=await fetch("/api/project-state",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!b.ok)throw Error(`HTTP ${b.status}`)},catch:a=>new e.uV({message:"saveProjectState failed",cause:a})}),h=(a,b,c)=>d.tryPromise({try:async()=>{let d=await fetch("/api/global-state",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,sessionId:b,status:c})});if(!d.ok)throw Error(`HTTP ${d.status}`)},catch:a=>new e.uV({message:"updateSessionStatus failed",cause:a})}),i=a=>d.tryPromise({try:async()=>{let b=await fetch("/api/scheduled-tasks",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"markReadBySessionId",fields:{sessionId:a}})});if(!b.ok)throw Error(`HTTP ${b.status}`)},catch:a=>new e.uV({message:"markScheduledTasksReadBySession failed",cause:a})})},37690:(a,b,c)=>{"use strict";c.d(b,{L:()=>e});var d=c(67484);function e({enabled:a,container:b,resolveLineRange:c,buildLineSnapshot:f,dragThresholdPx:g=5}){let h=(0,d.useRef)(null),i=(0,d.useRef)(()=>{}),j=(0,d.useRef)(c),k=(0,d.useRef)(f),l=(0,d.useRef)(g);return j.current=c,k.current=f,l.current=g,{toolbarRef:h,bumpRef:i,clearToolbar:()=>{h.current&&(h.current=null,i.current())}}}},37701:(a,b,c)=>{"use strict";c.d(b,{Fe:()=>d,Ff:()=>h,Z8:()=>g,wL:()=>e});let d=a=>a?.toLowerCase().startsWith("zh")?"zh":"en",e=(a,b)=>{if(!a||"object"!=typeof a)return null;let c=a.quickReplies;return c&&"object"==typeof c?(a=>{if(!Array.isArray(a))return null;let b=[];for(let c of a.slice(0,12)){if(!Array.isArray(c))continue;let a=[];for(let b of c.slice(0,8)){if("string"!=typeof b)continue;let c=b.trim().slice(0,200);c&&a.push(c)}a.length&&b.push(a)}return b.length?b:null})(c[b]):null},f=/[,,]/,g=a=>a.split("\n").map(a=>a.split(f).map(a=>a.trim().slice(0,200)).filter(Boolean).slice(0,8)).filter(a=>a.length>0).slice(0,12),h=(a,b)=>a.map(a=>a.join("zh"===b?",":", ")).join("\n")},38878:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{TabManagerTopBar:()=>u});var e=c(48249),f=c(67484),g=c(94192),h=c(12568),i=c(7833),j=c(44384),k=c(57031),l=c(88214),m=c(79606),n=c(33281),o=c(85655),p=c(35606),q=c(65484);function r({className:a}){return(0,e.jsxs)("svg",{className:a,fill:"none",viewBox:"0 0 100 100","aria-hidden":"true",children:[(0,e.jsx)("path",{fill:"#0065A9",d:"M96.461 10.796 75.857.876a6.23 6.23 0 0 0-7.107 1.207l-67.451 61.5a4.167 4.167 0 0 0 .004 6.162l5.51 5.009a4.167 4.167 0 0 0 5.32.236l81.228-61.62c2.725-2.067 6.639-.124 6.639 3.297v-.24a6.25 6.25 0 0 0-3.539-5.63Z"}),(0,e.jsx)("path",{fill:"#007ACC",d:"m96.461 89.204-20.604 9.92a6.229 6.229 0 0 1-7.107-1.207l-67.451-61.5a4.167 4.167 0 0 1 .004-6.162l5.51-5.009a4.167 4.167 0 0 1 5.32-.236l81.228 61.62c2.725 2.067 6.639.124 6.639-3.297v.24a6.25 6.25 0 0 0-3.539 5.63Z"}),(0,e.jsx)("path",{fill:"#1F9CF0",d:"M75.858 99.126a6.232 6.232 0 0 1-7.108-1.21c2.306 2.307 6.25.674 6.25-2.588V4.672c0-3.262-3.944-4.895-6.25-2.589a6.232 6.232 0 0 1 7.108-1.21l20.6 9.908A6.25 6.25 0 0 1 100 16.413v67.174a6.25 6.25 0 0 1-3.541 5.633l-20.601 9.906Z"})]})}function s({className:a}){return(0,e.jsx)("svg",{className:a,viewBox:"0 0 466.73 532.09",fill:"currentColor","aria-hidden":"true",children:(0,e.jsx)("path",{d:"M457.43,125.94L244.42,2.96c-6.84-3.95-15.28-3.95-22.12,0L9.3,125.94c-5.75,3.32-9.3,9.46-9.3,16.11v247.99c0,6.65,3.55,12.79,9.3,16.11l213.01,122.98c6.84,3.95,15.28,3.95,22.12,0l213.01-122.98c5.75-3.32,9.3-9.46,9.3-16.11v-247.99c0-6.65-3.55-12.79-9.3-16.11h-.01ZM444.05,151.99l-205.63,356.16c-1.39,2.4-5.06,1.42-5.06-1.36v-233.21c0-4.66-2.49-8.97-6.53-11.31L24.87,145.67c-2.4-1.39-1.42-5.06,1.36-5.06h411.26c5.84,0,9.49,6.33,6.57,11.39h-.01Z"})})}function t({cwd:a,currentBranch:b,onSwitched:c}){let{t:d}=(0,j.Bd)(),[g,h]=(0,f.useState)(!1),[k,l]=(0,f.useState)([]),[m,p]=(0,f.useState)(!1),[r,s]=(0,f.useState)(!1),[u,v]=(0,f.useState)(""),w=(0,f.useRef)(null),x=(0,f.useRef)(null),y=(0,f.useCallback)(async()=>{p(!0);let b=await n.t4.runPromiseExit((0,o.r4)(a));if("Success"===b._tag){let a=b.value,c=a.local??[],d=a.remote??[],e=[...c,...d.filter(a=>!c.includes(a.replace(/^origin\//,"")))];l(e)}else(0,i.oR)(d("toast.loadBranchFailed"),"error");p(!1)},[a,d]),z=(0,f.useCallback)(()=>{h(!0),v(""),y()},[y]),A=(0,f.useCallback)(()=>{h(!1)},[]),B=async b=>{s(!0);let e=await n.t4.runPromiseExit((0,q.Kl)({action:"checkout",cwd:a,path:a,branch:b}));if("Success"===e._tag){let a=b.replace(/^origin\//,"");(0,i.oR)(d("toast.switchedToBranch",{branch:a}),"success"),A(),c()}else{let a="Fail"===e.cause._tag?e.cause.error:null,b=a?.cause,c=b instanceof Error?b.message:d("toast.switchBranchFailed");(0,i.oR)(c,"error")}s(!1)},C=k.filter(a=>a!==b&&a.toLowerCase().includes(u.toLowerCase()));return(0,e.jsxs)("div",{className:"relative",ref:w,children:[(0,e.jsx)("button",{onClick:g?A:z,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-hover rounded transition-colors",title:d("git.switchBranch"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4"})})}),g&&(0,e.jsxs)("div",{className:"absolute top-full left-0 mt-1 w-64 bg-popover border border-border rounded-lg shadow-lv2 z-50 overflow-hidden",children:[(0,e.jsx)("div",{className:"p-2 border-b border-border",children:(0,e.jsx)("input",{ref:x,type:"text",value:u,onChange:a=>v(a.target.value),placeholder:d("git.searchBranch"),className:"w-full px-2.5 py-1.5 text-sm bg-muted rounded border-none outline-none",onKeyDown:a=>{"Escape"===a.key&&A()}})}),(0,e.jsx)("div",{className:"max-h-60 overflow-y-auto p-1",children:m?(0,e.jsx)("div",{className:"text-xs text-muted-foreground text-center py-4",children:d("common.loading")}):0===C.length?(0,e.jsx)("div",{className:"text-xs text-muted-foreground text-center py-4",children:u?d("git.noMatchingBranches"):d("git.noBranches")}):C.map(a=>(0,e.jsx)("button",{onClick:()=>B(a),disabled:r,className:"w-full text-left px-2.5 py-1.5 text-sm rounded hover:bg-hover transition-colors truncate disabled:opacity-50",children:(0,e.jsx)("span",{className:a.startsWith("origin/")?"text-muted-foreground":"text-foreground",children:a})},a))})]})]})}function u({initialCwd:a,activeTab:b,isGitRepo:c,currentBranch:d,onOpenWorktree:f,onOpenAliasManager:o,onBranchSwitched:v}){let{t:w}=(0,j.Bd)(),x=b?.sessionId?(0,p.X)(b.engine,b.sessionId):null;return(0,e.jsx)("div",{className:"border-b border-border bg-card shrink-0",children:(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 relative",children:[(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("img",{src:"/icons/icon-72x72.png",alt:"Cockpit",className:"w-6 h-6 cursor-pointer",title:w("tabManagerTopBar.copyPageUrl"),onClick:()=>{navigator.clipboard.writeText(window.location.href).then(()=>{(0,i.oR)(w("toast.copiedPageUrl"),"success")})}}),a?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"text-sm text-foreground max-w-md truncate cursor-help","data-tooltip":`CWD: ${a}`,children:a}),(0,e.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(a),(0,i.oR)(w("toast.copiedDirPath"))},className:"p-1 text-muted-foreground hover:text-foreground hover:bg-hover rounded transition-colors",title:w("tabManagerTopBar.copyDirPath"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]}):(0,e.jsx)("h1",{className:"text-lg font-semibold text-foreground",children:"Cockpit"})]}),c&&a&&(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsxs)("button",{onClick:f,className:"flex items-center gap-1.5 px-2 py-1.5 text-muted-foreground hover:text-foreground hover:bg-hover rounded-lg transition-colors",title:"Git Worktrees",children:[(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 17h8m0 0l-4-4m4 4l-4 4M3 7v6a4 4 0 004 4h5"})}),(0,e.jsx)("span",{className:"text-sm",children:d||"main"})]}),(0,e.jsx)(t,{cwd:a,currentBranch:d,onSwitched:()=>v?.()})]})]}),(0,e.jsx)("div",{className:"absolute left-1/2 -translate-x-1/2",children:(0,e.jsx)(g.gT,{})}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(h.ReviewDropdown,{cwd:a}),(0,e.jsx)("button",{onClick:()=>window.location.reload(),className:"p-2 text-muted-foreground hover:text-foreground hover:bg-hover rounded-lg transition-colors",title:w("tabManagerTopBar.refreshProject"),children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}),(0,e.jsx)("button",{onClick:()=>{b?.cwd&&n.t4.runFork((0,q.em)(b.cwd).pipe(m.orElse(()=>m.void)))},className:"p-2 text-muted-foreground hover:text-foreground hover:bg-hover rounded-lg transition-colors",title:w("tabManagerTopBar.openInVSCode"),children:(0,e.jsx)(r,{className:"w-4 h-4"})}),(0,e.jsx)("button",{onClick:()=>{b?.cwd&&n.t4.runFork((0,q.Q1)(b.cwd).pipe(m.orElse(()=>m.void)))},className:"p-2 text-muted-foreground hover:text-foreground hover:bg-hover rounded-lg transition-colors",title:w("tabManagerTopBar.openInCursor"),children:(0,e.jsx)(s,{className:"w-4 h-4"})}),x&&(0,e.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(x).then(()=>{(0,i.oR)(w("toast.copiedCommand",{command:x}),"success")})},className:"p-2 text-muted-foreground hover:text-foreground hover:bg-hover rounded-lg transition-colors",title:w("chat.copyCommandTooltip",{command:x}),children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),(0,e.jsx)("button",{onClick:o,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-hover rounded-lg transition-colors",title:w("tabManagerTopBar.aliasesGlobal"),children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M16 12h-6m-4 0a8 8 0 1116 0 8 8 0 01-16 0zm4 0h.01"})})}),(0,e.jsx)("button",{onClick:()=>(0,k.F)(l.n.OpenTokenStats,{}),className:"p-2 text-muted-foreground hover:text-foreground hover:bg-hover rounded-lg transition-colors",title:w("tabManagerTopBar.tokenStats"),children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"})})}),(0,e.jsx)("button",{onClick:()=>window.open("https://surething.io?from=cockpit","_blank"),className:"p-2 text-muted-foreground hover:text-foreground hover:bg-hover rounded-lg transition-colors",title:w("tabManagerTopBar.openSurething"),children:(0,e.jsx)("img",{src:"https://surething.io/logo.png?from=cockpit",alt:"Surething",className:"w-5 h-5 rounded-sm"})})]})]})})}d()}catch(a){d(a)}})},38896:(a,b,c)=>{"use strict";c.d(b,{C:()=>f});var d=c(67484),e=c(36984);function f(a,b){let[c,f]=(0,d.useState)(null),[g,h]=(0,d.useState)(!1),i=(0,d.useMemo)(()=>a.join("\n"),[a]),j=`${i}:${b}:${g}`;return(0,d.useMemo)(()=>c&&c.key===j?c.html:a.map(a=>(0,e.ZD)(a||" ")),[a,j,c])}},39031:(a,b,c)=>{"use strict";c.d(b,{IS:()=>h});var d=c(32891),e=c(10259),f=c(87748);let g=new Set(["taskItem","listItem"]),h=d.YY.create({name:"dropShellCleanup",addProseMirrorPlugins:()=>[new e.k_({key:new e.hs("dropShellCleanup"),appendTransaction(a,b,c){let d=[];if(a.forEach((b,c)=>{let e;if("drop"!==b.getMeta("uiEvent")||!b.docChanged)return;let g=(e=[],b.steps.forEach((a,c)=>{a instanceof f.Ln&&(0!==a.slice.size||a.from>=a.to||e.push(b.mapping.slice(c+1).map(a.from)))}),e);for(let b=c+1;b<a.length;b++)g=g.map(c=>a[b].mapping.map(c));d.push(...g)}),0===d.length)return null;let e=c.tr,h=!1;for(let a of d){let b=function(a,b){if(b<0||b>a.content.size)return null;let c=a.resolve(b);for(let a=c.depth;a>0;a--){var d;if(d=c.node(a),!g.has(d.type.name)||1!==d.childCount||null===d.firstChild||!d.firstChild.isTextblock||0!==d.firstChild.content.size)continue;let b=a;for(;b>1&&1===c.node(b-1).childCount;)b--;return{from:c.before(b),to:c.after(b)}}return null}(e.doc,e.mapping.map(a));if(b)try{e.delete(b.from,b.to),h=!0}catch{}}return h?e:null}})]})},39238:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{N:()=>r});var e=c(48249),f=c(67484),g=c(44384),h=c(44256),i=c(7833),j=c(64825),k=c(66400),l=c(86588),m=c(64676),n=c(40893),o=c(6478),p=c(48587),q=a([p]);function r({filePath:a,content:b,cwd:c,onClose:d,onContentSearch:q}){let{t:s}=(0,g.Bd)(),t=(0,o.P)(),[u,v]=(0,f.useState)("preview");return(0,e.jsx)(h.ZL,{children:(0,e.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-scrim p-0 md:p-4",onClick:d,children:(0,e.jsxs)("div",{className:"bg-card shadow-lv3 w-full h-full rounded-none md:max-w-[90%] md:h-[90vh] md:rounded-lg flex flex-col relative overflow-hidden",onClick:a=>a.stopPropagation(),children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3 px-4 py-2 border-b border-border flex-shrink-0",children:[(0,e.jsxs)("span",{className:"text-sm text-muted-foreground truncate min-w-0 flex-1 cursor-pointer hover:text-foreground transition-colors",style:{direction:"rtl",textAlign:"left"},"data-tooltip":a,onClick:()=>{navigator.clipboard.writeText(a),(0,i.oR)(s("common.copiedPath"))},children:["‎",a]}),(0,e.jsx)("button",{onClick:()=>v(a=>"preview"===a?"source":"preview"),className:`px-1.5 py-0.5 text-xs rounded transition-colors flex-shrink-0 ${"preview"===u?"bg-brand text-white":"text-muted-foreground hover:bg-hover"}`,children:"preview"===u?s("fileBrowser.exitPreview"):s("common.preview")}),(0,e.jsx)("button",{onClick:()=>t(a),title:s("htmlApps.addTooltip"),className:"text-muted-foreground hover:text-foreground px-1.5 py-0.5 rounded hover:bg-hover transition-colors flex-shrink-0",children:(0,e.jsx)(j.A,{className:"w-4 h-4"})}),(0,e.jsx)("button",{onClick:()=>{window.dispatchEvent(new CustomEvent("console-open-browser",{detail:{url:a}})),d()},title:s("common.openInConsole"),className:"text-muted-foreground hover:text-foreground px-1.5 py-0.5 rounded hover:bg-hover transition-colors flex-shrink-0",children:(0,e.jsx)(k.A,{className:"w-4 h-4"})}),(0,e.jsx)("button",{onClick:()=>{let b=(0,m.Xe)(a,c);window.open((0,m.PB)(b,window.location.origin),"_blank")},title:s("browser.openInNewWindow"),className:"text-muted-foreground hover:text-foreground px-1.5 py-0.5 rounded hover:bg-hover transition-colors flex-shrink-0",children:(0,e.jsx)(l.A,{className:"w-4 h-4"})}),(0,e.jsx)("button",{onClick:d,className:"text-muted-foreground hover:text-foreground px-1.5 py-0.5 rounded hover:bg-hover transition-colors flex-shrink-0",children:"✕"})]}),(0,e.jsx)("div",{className:"flex-1 overflow-hidden",children:"preview"===u?(0,e.jsx)(n.O,{content:b,filePath:a,cwd:c,onContentSearch:q?a=>{q(a),d()}:void 0}):(0,e.jsx)(p.y,{entryPath:a,entryContent:b,cwd:c})})]})})})}p=(q.then?(await q)():q)[0],d()}catch(a){d(a)}})},39247:(a,b,c)=>{"use strict";c.d(b,{h:()=>e});let d=new Set(["Read","Grep","Glob","LS","WebSearch","WebFetch","NotebookRead","TodoRead","AskUserQuestion","ExitPlanMode","TodoWrite","Skill"]),e=a=>!d.has(a)},40159:(a,b,c)=>{"use strict";c.d(b,{S:()=>l,j:()=>k});var d=c(48249),e=c(67484),f=c(44384),g=c(208),h=c(44256),i=c(89719);function j({blame:a,onClick:b}){let{t:c}=(0,f.Bd)(),i=(0,e.useRef)(null),k=(0,e.useRef)(null),l=(0,h.F2)(),m=(0,e.useRef)(!1),n=(0,e.useRef)(!1),o=(0,e.useRef)(null),p=(0,e.useRef)(null),q=(0,e.useRef)(null),r=(0,e.useRef)(a),s=(0,e.useRef)(b),t=(0,e.useCallback)(()=>{let a,b=k.current,c=i.current;if(!b||!c)return;let d=c.getBoundingClientRect(),e=b.getBoundingClientRect(),f=l?.getBoundingClientRect(),g=f?.left??0,h=f?.top??0,j=f?.width??window.innerWidth,m=f?.height??window.innerHeight,n=d.left-g;n+e.width>j-8&&(n=j-e.width-8),n<8&&(n=8);let o=d.top-h,p=d.bottom-h;(a=o-e.height-4<0?p+4:o-e.height-4)+e.height>m-8&&(a=m-e.height-8),b.style.left=`${n}px`,b.style.top=`${a}px`},[l]),u=(0,e.useCallback)(()=>{o.current&&(clearTimeout(o.current),o.current=null),p.current&&(clearTimeout(p.current),p.current=null),m.current=!1,n.current=!1,k.current&&(k.current.style.display="none"),q.current&&(document.removeEventListener("mousedown",q.current.down),document.removeEventListener("mouseup",q.current.up),q.current=null)},[]),v=(0,e.useCallback)(()=>{let a=k.current;if(!a||m.current)return;m.current=!0,a.style.left="-9999px",a.style.top="-9999px",a.style.display="block",requestAnimationFrame(()=>requestAnimationFrame(t));let b=0,c=0,d=a=>{b=a.clientX,c=a.clientY},e=a=>{if(!(Math.abs(a.clientX-b)>5||Math.abs(a.clientY-c)>5)){let b;b=a.target,k.current?.contains(b)||i.current?.contains(b)||u()}};document.addEventListener("mousedown",d),document.addEventListener("mouseup",e),q.current={down:d,up:e}},[t,u]),w=(0,e.useCallback)(()=>{if(o.current&&clearTimeout(o.current),p.current&&(clearTimeout(p.current),p.current=null),m.current)return;let a=window.getSelection();(!a||a.isCollapsed)&&(o.current=setTimeout(v,500))},[v]),x=(0,e.useCallback)(()=>{o.current&&(clearTimeout(o.current),o.current=null),m.current&&(p.current=setTimeout(()=>{n.current||u()},200))},[u]),y=(0,e.useCallback)(()=>{n.current=!0,p.current&&(clearTimeout(p.current),p.current=null)},[]),z=(0,e.useCallback)(()=>{n.current=!1,u()},[u]),A=(0,e.useCallback)(a=>{a.stopPropagation();let b=window.getSelection();b&&b.toString().length>0&&k.current?.contains(b.anchorNode)||(s.current?.(r.current),u())},[u]),B=a.message.split("\n")[0]||"",C=a.message.split("\n").slice(1).join("\n").trim();return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("span",{ref:i,className:"select-none text-xs text-muted-foreground/50 ml-6 cursor-default hover:text-muted-foreground/80",onMouseEnter:w,onMouseLeave:x,children:[a.author.split(" ")[0],", ",function(a){let b=g.A.t,c=Math.floor((Date.now()-1e3*a)/1e3);if(c<60)return b("common.justNow");let d=Math.floor(c/60);if(d<60)return b("common.minutesAgo",{count:d});let e=Math.floor(d/60);if(e<24)return b("common.hoursAgo",{count:e});let f=Math.floor(e/24);if(f<30)return b("common.daysAgo",{count:f});let h=Math.floor(f/30);return h<12?b("common.monthsAgo",{count:h}):b("common.yearsAgo",{count:Math.floor(h/12)})}(a.time)," \xb7 ",B]}),(0,d.jsx)(h.ZL,{children:(0,d.jsxs)("div",{ref:k,className:"fixed z-[9999] bg-card border border-border rounded-lg shadow-lv3 p-3 text-xs text-foreground whitespace-pre-wrap max-w-md select-text",style:{display:"none",minWidth:280,cursor:"text"},"data-inline-blame-tip":"",onMouseEnter:y,onMouseLeave:z,children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,d.jsx)("span",{className:"font-mono text-brand",children:a.hash}),(0,d.jsx)("span",{className:"text-muted-foreground",children:a.author}),(0,d.jsx)("span",{className:"text-muted-foreground/60",children:new Date(1e3*a.time).toLocaleString()})]}),(0,d.jsx)("div",{className:"font-medium",children:B}),C&&(0,d.jsx)("div",{className:"mt-1 text-muted-foreground",children:C}),(0,d.jsx)("div",{className:"mt-2 text-[11px] text-brand border-t border-border pt-2 cursor-pointer hover:underline",onClick:A,children:c("codeViewer.clickToViewDetails")})]})})]})}let k=[{bg:"rgba(59, 130, 246, 0.15)",border:"rgb(59, 130, 246)"},{bg:"rgba(16, 185, 129, 0.15)",border:"rgb(16, 185, 129)"},{bg:"rgba(245, 158, 11, 0.15)",border:"rgb(245, 158, 11)"},{bg:"rgba(239, 68, 68, 0.15)",border:"rgb(239, 68, 68)"},{bg:"rgba(168, 85, 247, 0.15)",border:"rgb(168, 85, 247)"},{bg:"rgba(236, 72, 153, 0.15)",border:"rgb(236, 72, 153)"},{bg:"rgba(20, 184, 166, 0.15)",border:"rgb(20, 184, 166)"},{bg:"rgba(249, 115, 22, 0.15)",border:"rgb(249, 115, 22)"}],l=(0,e.memo)(function({virtualKey:a,lineNum:b,highlightedHtml:c,hasComments:g,firstComment:h,lineCommentsCount:k,isInRange:l,showLineNumbers:m,lineNumChars:n,commentsEnabled:o,virtualItemSize:p,virtualItemStart:q,onCommentBubbleClick:r,onCmdClick:s,onTokenHover:t,onTokenHoverLeave:u,flashLine:v,blameLine:w,showBlameInfo:x,blameAuthorColor:y,isBlameHovered:z,onBlameClick:A,onBlameMouseEnter:B,onBlameMouseLeave:C,inlineBlameData:D,onInlineBlameClick:E,isCursorLine:F,cursorCol:G}){let{t:H}=(0,f.Bd)(),I=(0,e.useMemo)(()=>F&&null!=G?function(a,b){let c=0,d=0;for(;d<a.length;){if("<"===a[d]){let b=a.indexOf(">",d);if(-1!==b){d=b+1;continue}}if(c===b){let b;if("&"===a[d]){let c=a.indexOf(";",d);b=-1!==c&&c-d<10?c+1:d+1}else b=d+1;let c=a.substring(d,b);return a.substring(0,d)+'<span class="vi-char-cursor">'+c+"</span>"+a.substring(b)}if("&"===a[d]){let b=a.indexOf(";",d);d=-1!==b&&b-d<10?b+1:d+1}else d++;c++}return a+'<span class="vi-char-cursor"> </span>'}(c,G):c,[c,F,G]),J=(0,e.useCallback)(a=>{if(!a.metaKey||!s)return;a.preventDefault(),a.stopPropagation();let c=a.currentTarget,d=(0,i.j)(a,c);window.getSelection()?.removeAllRanges(),s(b,d)},[b,s]),K=(0,e.useCallback)(a=>{if(!t)return;let c=(0,i.A)(a,a.currentTarget);c&&t(b,c.column,c.rect)},[b,t]),L=(0,e.useCallback)(()=>{w&&A&&A(w)},[w,A]),M=(0,e.useCallback)(a=>{w&&B&&B(w,a)},[w,B]);return(0,d.jsxs)("div",{"data-line":b,style:{position:"absolute",top:0,left:0,width:"100%",height:`${p}px`,transform:`translateY(${q}px)`,backgroundColor:z&&y?y.bg:void 0},className:`flex ${v===b?"flash-line":""} ${F?"vi-cursor-line":""} ${l?"bg-blue-9/20":g?"bg-amber-9/10":"hover:bg-hover"}`,children:[(0,d.jsxs)("div",{className:"flex shrink-0 sticky left-0 z-[2] bg-card",style:{backgroundImage:z&&y?`linear-gradient(${y.bg}, ${y.bg})`:void 0},children:[w&&y&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"w-1 flex-shrink-0",style:{backgroundColor:y.border}}),(0,d.jsx)("div",{className:"w-48 flex-shrink-0 px-2 flex items-center gap-2 border-r border-border text-muted-foreground cursor-pointer hover:bg-hover",onMouseEnter:M,onMouseLeave:C,onClick:L,title:H("codeViewer.clickToViewCommit"),children:x?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"font-medium",style:{color:y.border},children:w.hash}),(0,d.jsx)("span",{className:"truncate flex-1",children:w.author.split(" ")[0]})]}):null})]}),m&&(0,d.jsxs)("span",{className:`flex-shrink-0 flex items-center justify-end gap-0.5 pr-2 select-none border-r border-border font-variant-tabular ${l?"bg-blue-9/30 text-blue-11":"bg-card/50 text-foreground-subtle"}`,children:[o&&g&&h&&(0,d.jsx)("button",{onClick:a=>r(h,a),className:"w-4 h-4 flex items-center justify-center rounded hover:bg-hover text-amber-9",title:H("codeViewer.nComments",{count:k}),children:(0,d.jsx)("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",children:(0,d.jsx)("path",{fillRule:"evenodd",d:"M18 10c0 3.866-3.582 7-8 7a8.841 8.841 0 01-4.083-.98L2 17l1.338-3.123C2.493 12.767 2 11.434 2 10c0-3.866 3.582-7 8-7s8 3.134 8 7zM7 9H5v2h2V9zm8 0h-2v2h2V9zM9 9h2v2H9V9z",clipRule:"evenodd"})})}),o&&!g&&(0,d.jsx)("span",{className:"w-4"}),(0,d.jsx)("span",{className:"text-right",style:{minWidth:`${n}ch`},children:b})]})]}),(0,d.jsxs)("span",{className:"flex-1 px-3 whitespace-pre select-text",onClick:J,onMouseOver:K,onMouseLeave:u,"data-code-content":!0,children:[(0,d.jsx)("span",{dangerouslySetInnerHTML:{__html:I}}),D&&(0,d.jsx)(j,{blame:D,onClick:E})]})]},a)})},40311:(a,b,c)=>{"use strict";function d(a,b){return"loading"===a?"border-transparent bg-orange-11/20 text-foreground animate-pulse":"unread"===a?"border-transparent bg-red-9/55 text-foreground":b?"border-transparent bg-brand/15 text-brand":"border-transparent bg-muted-foreground/15 text-muted-foreground"}c.d(b,{c:()=>d})},40699:(a,b,c)=>{"use strict";c.d(b,{u:()=>h});var d=c(67484),e=c(29939),f=c(85943),g=c(25414);function h(a,b,c,h,i){let j=(0,d.useRef)(null),k=(0,d.useRef)(0),l=(0,d.useRef)(0),m=(0,d.useRef)(!1),n=(0,d.useRef)(!1),o=(0,d.useRef)(!1),p=(0,d.useRef)(void 0),q=()=>{let a=`live-asst-${++k.current}`;return j.current=a,b(b=>[...b,{id:a,role:"assistant",content:"",isStreaming:!0,runId:p.current}]),a},r=a=>{let c=a=>{i?.onLiveOutputTokens?.({outputTokens:Math.max(0,Math.round(a))})},d=a=>{!m.current&&"string"==typeof a&&a&&(l.current+=(0,f.r)(a),c(l.current))};if("system"===a.type&&"init"===a.subtype){let a=n.current;o.current=!0,a||(l.current=0,m.current=!1,i?.onLiveOutputTokens?.(null),i?.onRunStartedAt?.(Date.now())),q();return}if("usage_update"===a.type){"number"==typeof a.output_tokens&&Number.isFinite(a.output_tokens)&&(m.current=!0,l.current=Math.max(l.current,Math.round(a.output_tokens)),c(l.current));return}if("stream_event"===a.type){let b=a.event;b?.type==="content_block_delta"&&b.delta?.type==="text_delta"&&d(b.delta.text)}if("system"===a.type&&"task_notification"===a.subtype){if(!o.current){let c=`live-tasknotif-${a.task_id||++k.current}`,d=`<task-notification>
42
43
  `+(a.task_id?`<task-id>${a.task_id}</task-id>
43
44
  `:"")+(a.status?`<status>${a.status}</status>
44
45
  `:"")+(a.summary?`<summary>${a.summary}</summary>
45
46
  `:"")+(a.output_file?`<output-file>${a.output_file}</output-file>
46
47
  `:"")+"</task-notification>";b(b=>[...b,{id:c,role:"system",content:a.summary||"",systemEvent:{kind:"task-notification",...a.status?{status:a.status}:{},detail:d}}])}return}if("user"===a.type&&a._human){let c=a.message?.content,d="string"==typeof c?c:Array.isArray(c)?c.map(a=>a?.text||"").join(""):"",e="string"==typeof a._turnId?a._turnId:null;e&&(p.current=e);let f="number"==typeof a._ts?a._ts:null,g=e?`live-user-${e}`:`live-user-${++k.current}`;b(a=>{if(e&&a.some(a=>a.id===g))return a;for(let b=a.length-1;b>=0;b--){if("user"!==a[b].role)continue;let c=a[b].timestamp?Date.parse(a[b].timestamp):NaN;if(null===f||Number.isNaN(c)){if(a[b].content===d)return a}else if(c>=f)return a;break}return[...a,{id:g,role:"user",content:d}]});return}if("result"===a.type&&(o.current=!1,n.current=!0),"assistant"===a.type&&Array.isArray(a.message?.content))for(let b of a.message.content)b.text?d(b.text):b.name&&d(`${b.name} ${JSON.stringify(b.input??{})}`);if("user"===a.type&&Array.isArray(a.message?.content))for(let b of a.message.content)d("string"==typeof b.content?b.content:JSON.stringify(b.content??""));let e=j.current??q();b(b=>(0,g.F)(b,a,{engine:h,assistantId:e}))};(0,e.h)({url:a?`/ws/session-stream?sessionId=${encodeURIComponent(a)}`:"/ws/session-stream",enabled:c&&!!a,onMessage:a=>{if("run-snapshot"===a.type&&Array.isArray(a.events)){if("string"==typeof a.runId&&a.runId&&(p.current=a.runId),"running"!==a.status){i?.onRunningChange?.(!1),i?.onLiveOutputTokens?.(null),i?.onRunStartedAt?.(null),l.current=0,m.current=!1,n.current=!1;return}let c=a.events.find(a=>a?.type==="user"&&a?._human),d=c?.message?.content,e="string"==typeof d?d:"",f=new Set,g=new Set;for(let b of a.events){let a=b?.uuid;if("string"==typeof a&&f.add(a),b?.type==="assistant"&&Array.isArray(b.message?.content))for(let a of b.message.content)a?.name&&"string"==typeof a.id&&g.add(a.id)}let h="number"==typeof a.startedAt?a.startedAt:null;b(a=>{let b=a.filter(a=>!("string"==typeof a.id&&a.id.startsWith("live-"))),c=b[b.length-1],d=c?.timestamp?Date.parse(c.timestamp):NaN;if(null!==h&&!Number.isNaN(d)){let a=b.length;for(;a>0;){let c=b[a-1],d=c.timestamp?Date.parse(c.timestamp):NaN;if(!Number.isNaN(d)&&d>=h)a--;else break}return a<b.length?b.slice(0,a):b}if(!e)return b;let i=-1;for(let a=b.length-1;a>=0;a--)if("user"===b[a].role){b[a].content===e&&(i=a);break}return -1===i?b:b.slice(i+1).every(a=>"assistant"===a.role&&("string"==typeof a.id&&f.has(a.id)||!!a.toolCalls?.length&&a.toolCalls.every(a=>g.has(a.id))))?b.slice(0,i):b}),j.current=null,k.current=0,l.current=0,m.current=!1,n.current=!1,o.current=!1;let q="number"==typeof a.outputTokens&&Number.isFinite(a.outputTokens)?Math.max(0,Math.round(a.outputTokens)):null;for(let b of(null!==q&&(l.current=q,m.current=!0,i?.onLiveOutputTokens?.({outputTokens:q})),a.events))r(b);i?.onRunningChange?.(!0),i?.onRunStartedAt?.("number"==typeof a.startedAt?a.startedAt:Date.now())}else if("run-event"===a.type&&a.message){if("run-ended"===a.message.type){i?.onRunningChange?.(!1),i?.onLiveOutputTokens?.(null),i?.onRunStartedAt?.(null),l.current=0,m.current=!1,n.current=!1,i?.onComplete?.();return}r(a.message),i?.onRunningChange?.(!0)}else"run-idle"===a.type&&(i?.onRunningChange?.(!1),i?.onLiveOutputTokens?.(null),i?.onRunStartedAt?.(null),l.current=0,m.current=!1,n.current=!1)}})}},40893:(a,b,c)=>{"use strict";c.d(b,{O:()=>m});var d=c(48249),e=c(67484),f=c(7031),g=c(41051),h=c(42140),i=c(64676),j=c(74754),k=c(91579),l=c(208);function m({content:a,filePath:b,cwd:c,onContentSearch:n,reloadKey:o=0}){let p=(0,f.r)(),q=!!c,r=(0,e.useMemo)(()=>(0,i.qF)(b,c)?{mode:"url",url:(0,i.Xe)(b,c)}:{mode:"srcdoc",html:a??""},[a,b,c]),{addComment:s,refresh:t}=(0,j._)({cwd:c||"",filePath:b}),[u,v]=(0,e.useState)(null),w=(0,e.useRef)(null),x=(0,e.useRef)(null),y=(0,e.useRef)(()=>{}),[z,A]=(0,e.useState)(null),[B,C]=(0,e.useState)(null),D=(0,e.useRef)(!1),E=(0,e.useCallback)(()=>{x.current&&(x.current=null,y.current())},[]),F=(0,e.useCallback)(()=>{let a=w.current,b=a?.contentWindow;if(b){let a=document.documentElement.classList.contains("dark");b.postMessage({type:"THEME_CHANGE",theme:a?"dark":"light"},"*"),b.postMessage({type:"cockpit:language-change",lang:l.A.language},"*")}if(!q)return;let c=a?.contentDocument;a&&c&&(c.addEventListener("mouseup",b=>{if(D.current)return;let c=a.contentWindow?.getSelection(),d=c&&!c.isCollapsed?c.toString().trim():"";if(!d)return void E();let e=a.getBoundingClientRect();x.current={x:e.left+b.clientX,y:e.top+b.clientY,range:{start:0,end:0},selectedText:d,lineSnapshot:d},y.current()}),c.addEventListener("mousedown",()=>{E(),A(null),C(null)}),c.addEventListener("scroll",()=>E(),{capture:!0,passive:!0}))},[q,E]),G=(0,e.useCallback)(()=>{let a=x.current;a&&(A({x:a.x,y:a.y,text:a.selectedText}),E(),w.current?.contentWindow?.getSelection()?.removeAllRanges())},[E]),H=(0,e.useCallback)(()=>{let a=x.current;a&&(C({x:a.x,y:a.y,text:a.selectedText}),E(),w.current?.contentWindow?.getSelection()?.removeAllRanges())},[E]),I=(0,e.useCallback)(()=>{let a=x.current;a&&p&&(E(),w.current?.contentWindow?.getSelection()?.removeAllRanges(),(0,k.Ff)(p.sendMessage,{filePath:b,startLine:0,endLine:0,codeContent:a.selectedText},l.A.t("explain.selectionMessage")))},[p,b,E]),J=(0,e.useCallback)(()=>{let a=x.current;if(!a||!n)return;let b=a.selectedText.trim();E(),w.current?.contentWindow?.getSelection()?.removeAllRanges(),b&&n(b)},[n,E]),K=(0,e.useCallback)(async a=>{z&&(await s(0,0,a,z.text),A(null))},[z,s]),L=(0,e.useCallback)(async(a,d)=>{if(p&&c)try{let e=(await (0,k.$3)(c)).map(a=>({filePath:a.filePath,startLine:a.startLine,endLine:a.endLine,codeContent:a.codeContent,note:a.content||void 0}));e.push({filePath:b,startLine:0,endLine:0,codeContent:a});let f=(0,k.Gw)(e,d);p.sendMessage(f),await (0,k.RP)(c),t()}catch(a){console.error("[HtmlAppFrame] send to AI failed:",a)}},[p,c,b,t]),M=(0,e.useCallback)(a=>{B&&L(B.text,a)},[B,L]),N=(0,e.useCallback)(a=>{z&&L(z.text,a)},[z,L]);return(0,d.jsxs)("div",{ref:v,className:"relative h-full w-full bg-white",children:[(0,d.jsx)("iframe",{ref:w,..."url"===r.mode?{src:r.url}:{srcDoc:r.html},title:b,className:"h-full w-full border-0",onLoad:F},`${b}:${o}`),q&&u&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(g.fS,{floatingToolbarRef:x,bumpRef:y,container:u,onAddComment:G,onSendToAI:H,onSearch:n?J:void 0,onExplain:p?I:void 0,isChatLoading:p?.isLoading}),z&&(0,d.jsx)(h.t,{x:z.x,y:z.y,range:{start:0,end:0},filePath:b,lineSnapshot:z.text,container:u,onSubmit:K,onSendToAI:p?N:void 0,onClose:()=>A(null),isChatLoading:p?.isLoading}),B&&(0,d.jsx)(h.G,{x:B.x,y:B.y,range:{start:0,end:0},filePath:b,lineSnapshot:B.text,container:u,onSubmit:M,onClose:()=>C(null),isChatLoading:p?.isLoading})]})]})}},41051:(a,b,c)=>{"use strict";c.d(b,{SZ:()=>g,fS:()=>j});var d=c(48249),e=c(67484),f=c(44384);let g=[["quickReply.optionA","quickReply.optionB","quickReply.optionC","quickReply.optionD"],["quickReply.allRecommended","quickReply.thisOne","quickReply.notThis"],["quickReply.why","quickReply.elaborate","quickReply.example"],["quickReply.start","quickReply.continue","quickReply.ok","quickReply.done"]];function h({rows:a,placeAbove:b,onHeight:c,onPick:g,onEdit:i,onMouseEnter:j,onMouseLeave:k}){let{t:l}=(0,f.Bd)(),m=(0,e.useRef)(null);return(0,d.jsxs)("div",{ref:m,className:`absolute ${b?"bottom-full mb-1":"top-full mt-1"} left-0 z-[201] flex flex-col gap-1 bg-card border border-border rounded-lg shadow-lv3 p-1.5`,onMouseEnter:j,onMouseLeave:k,children:[i&&(0,d.jsx)("button",{className:"absolute top-0.5 right-0.5 p-1 text-muted-foreground hover:text-brand transition-colors",onClick:i,title:l("quickReply.edit"),"aria-label":l("quickReply.edit"),children:(0,d.jsx)("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),a.map((a,b)=>(0,d.jsx)("div",{className:`flex items-center gap-1${i&&0===b?" pr-5":""}`,children:a.map((a,c)=>(0,d.jsx)("button",{className:"px-2 py-1 text-xs whitespace-nowrap border border-border text-foreground rounded hover:border-brand hover:bg-hover transition-colors",onClick:()=>g(a),children:a},`${b}:${c}:${a}`))},b))]})}function i({x:a,y:b,visible:c,container:j,onAddComment:k,onSendToAI:l,onSearch:m,onExplain:n,onQuickReply:o,quickReplyRows:p,onEditQuickReplies:q,isChatLoading:r}){let{t:s}=(0,f.Bd)(),t=(0,e.useRef)(null),[u,v]=(0,e.useState)({w:0,h:0}),[w,x]=(0,e.useState)(0),[y,z]=(0,e.useState)(null),A=(0,e.useRef)(null),B=(0,e.useCallback)(a=>{x(b=>b===a?b:a)},[]),C=(0,e.useCallback)(()=>{A.current&&(clearTimeout(A.current),A.current=null)},[]),D=(0,e.useCallback)(a=>{C(),z(a)},[C]),E=(0,e.useCallback)(()=>{C(),A.current=setTimeout(()=>z(null),150)},[C]),F=j.getBoundingClientRect(),G=a-F.left,H=Math.max(0,b-F.top-40),I=Math.max(0,Math.min(G+8,F.width-u.w-8)),J=w>0&&H+u.h+8+w>F.height,K=(0,e.useMemo)(()=>p??g.map(a=>a.map(a=>s(a))),[p,s]),L=a=>o&&y===a?(0,d.jsx)(h,{rows:K,onEdit:q,placeAbove:J,onHeight:B,onPick:b=>{z(null),o(a,b)},onMouseEnter:C,onMouseLeave:E}):null;return(0,d.jsxs)("div",{ref:t,className:"floating-toolbar absolute z-[200] flex items-center gap-1.5 bg-card border border-border rounded-lg shadow-lv3 p-1.5",style:{left:I,top:H,visibility:c?"visible":"hidden",pointerEvents:c?"auto":"none"},children:[(0,d.jsxs)("div",{className:"relative",onMouseEnter:()=>D("comment"),onMouseLeave:E,children:[(0,d.jsx)("button",{className:"px-3 py-1.5 text-xs font-medium border border-brand text-brand rounded-md hover:bg-brand/10 transition-colors",onClick:k,children:s("floatingToolbar.addComment")}),L("comment")]}),(0,d.jsxs)("div",{className:"relative",onMouseEnter:()=>{r||D("ai")},onMouseLeave:E,children:[(0,d.jsx)("button",{className:"px-3 py-1.5 text-xs font-medium border border-brand text-brand rounded-md hover:bg-brand/10 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",onClick:l,disabled:r,title:r?s("comments.aiResponding"):void 0,children:s("floatingToolbar.sendToAI")}),L("ai")]}),n&&(0,d.jsx)("button",{className:"px-3 py-1.5 text-xs font-medium border border-brand text-brand rounded-md hover:bg-brand/10 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",onClick:n,disabled:r,title:r?s("comments.aiResponding"):void 0,children:s("explain.action")}),m&&(0,d.jsx)("button",{className:"px-3 py-1.5 text-xs font-medium border border-brand text-brand rounded-md hover:bg-brand/10 transition-colors",onClick:m,children:s("floatingToolbar.search")})]})}let j=(0,e.memo)(function({floatingToolbarRef:a,bumpRef:b,container:c,onAddComment:f,onSendToAI:g,onSearch:h,onExplain:j,onQuickReply:k,quickReplyRows:l,onEditQuickReplies:m,isChatLoading:n}){let[o,p]=(0,e.useState)(0),q=(0,e.useMemo)(()=>a.current,[o]);return(0,d.jsx)(i,{x:q?.x??0,y:q?.y??0,visible:!!q,container:c,onAddComment:f,onSendToAI:g,onSearch:h,onExplain:j,onQuickReply:k,quickReplyRows:l,onEditQuickReplies:m,isChatLoading:n})})},41224:(a,b,c)=>{"use strict";c.d(b,{Cr:()=>C,F4:()=>q,Fi:()=>n,Hw:()=>k,JC:()=>u,M5:()=>s,Ny:()=>l,QW:()=>x,XO:()=>D,Zr:()=>w,an:()=>B,dM:()=>p,dQ:()=>m,em:()=>j,he:()=>o,l1:()=>t,n_:()=>v,qD:()=>A,tY:()=>F,td:()=>i,tf:()=>E,yS:()=>r,z2:()=>y});var d=c(79606),e=c(71192);let f=(a,b)=>d.tryPromise({try:async()=>{let c=await fetch(a,b);if(!c.ok)throw Error(`HTTP ${c.status}`);return await c.json()},catch:c=>new e.uV({message:`${b?.method??"GET"} ${a} failed`,cause:c})}),g=(a,b)=>f(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),h=(a,b)=>f(a,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),i=()=>f("/api/settings"),j=a=>h("/api/settings",a),k=a=>f(`/api/${a}/credentials`),l=a=>f(`/api/${a}/credentials?reveal=1`),m=(a,b)=>h(`/api/${a}/credentials`,{apiKey:b}),n=a=>f(`/api/${a}/models`),o=()=>f("/api/deepseek/balance"),p=a=>f(`/api/${a}/usage`),q=()=>f("/api/ollama/config"),r=a=>h("/api/ollama/config",a),s=()=>f("/api/commands"),t=()=>f("/api/skills"),u=a=>g("/api/bash",a),v=a=>d.tryPromise({try:async()=>{let b=await fetch("/api/session-by-path",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});return b.ok?await b.json():null},catch:a=>new e.uV({message:"POST /api/session-by-path failed",cause:a})}),w=(a,b)=>g(`/api/session/${encodeURIComponent(a)}/fork`,b),x=a=>f(`/api/sessions/projects/${encodeURIComponent(a)}`),y=()=>f("/api/global-state").pipe(d.map(a=>a.sessions??[])),z=()=>d.tryPromise({try:async()=>{let a=await fetch("/api/ollama/models");return 503===a.status?{_tag:"not-running"}:a.ok?{_tag:"ok",models:(await a.json()).models??[]}:{_tag:"error",message:"Failed to fetch models"}},catch:a=>new e.uV({message:"fetch ollama models failed",cause:a})}),A=a=>d.gen(function*(){let b=yield*z();if("not-running"!==b._tag)return b;a&&(yield*d.sync(a));let c=yield*d.tryPromise({try:async()=>{let a=await fetch("/api/ollama/start",{method:"POST"}),b=await a.json().catch(()=>({}));return 404===a.status?{_tag:"not-installed",message:b.message||"Ollama is not installed"}:a.ok?{_tag:"started"}:{_tag:"error",message:"Failed to start Ollama"}},catch:a=>new e.uV({message:"start ollama failed",cause:a})});if("not-installed"===c._tag)return{_tag:"not-installed",message:c.message};if("error"===c._tag)return{_tag:"error",message:c.message};let f=yield*z();return"not-running"===f._tag?{_tag:"error",message:"Ollama started but cannot fetch models"}:f}),B=a=>f(`/api/file?path=${encodeURIComponent(a)}`),C=()=>f("/api/claude-stats"),D=()=>f("/api/prompts/config?scope=global"),E=a=>f(`/api/prompts/config?cwd=${encodeURIComponent(a)}`),F=a=>g("/api/prompts/config",a)},41357:(a,b,c)=>{"use strict";c.d(b,{H:()=>e});var d=c(67484);function e({cwd:a,selectedPath:b,gitStatusMap:c,renameOldPaths:f,isText:g,refreshKey:h}){let i=b?c?.get(b):void 0,j=g&&("M"===i||"R"===i),[k,l]=(0,d.useState)(null),[m,n]=(0,d.useState)(!1),[o,p]=(0,d.useState)(()=>new Set);(0,d.useRef)(new Set);let q=j&&!!b&&o.has(b);return{canDiff:j,showDiff:q,toggleDiff:(0,d.useCallback)(()=>{b&&p(a=>{let c=new Set(a);return c.has(b)?c.delete(b):c.add(b),c})},[b]),diff:k,isLoadingDiff:m}}c(79606),c(33281),c(85655)},42140:(a,b,c)=>{"use strict";c.d(b,{G:()=>h,t:()=>g});var d=c(48249),e=c(67484),f=c(44384);function g({x:a,y:b,range:c,filePath:h,lineSnapshot:i,container:j,onSubmit:k,onSendToAI:l,onClose:m,isChatLoading:n}){let{t:o}=(0,f.Bd)(),[p,q]=(0,e.useState)(""),[r,s]=(0,e.useState)(!1),t=(0,e.useRef)(null),u=(0,e.useRef)(null),[v,w]=(0,e.useState)({x:0,y:0}),x=i?.split("\n").slice(0,5).join("\n"),y=!!i&&i.split("\n").length>5,z=()=>{!r&&p.trim()&&(s(!0),k(p.trim()))};return(0,d.jsxs)("div",{ref:t,className:"absolute z-[200] w-[640px] bg-card border border-border rounded-lg shadow-lv2 overflow-hidden",style:{left:v.x,top:v.y},children:[(0,d.jsxs)("div",{className:"px-3 py-2 bg-amber-9/10 border-b border-border",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-xs font-medium text-amber-11",children:o("comments.addComment")}),(c.start>0||c.end>0)&&(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:o("comments.lineRange",{start:c.start,end:c.end})})]}),h&&(0,d.jsx)("div",{className:"mt-1 text-xs text-muted-foreground truncate",children:h})]}),i&&(0,d.jsx)("div",{className:"px-3 py-2 border-b border-border max-h-24 overflow-hidden",children:(0,d.jsxs)("pre",{className:"text-xs font-mono text-muted-foreground whitespace-pre-wrap break-all",children:[x,y&&(0,d.jsx)("span",{className:"text-muted-foreground/50",children:"..."})]})}),(0,d.jsxs)("div",{className:"p-2",children:[(0,d.jsx)("textarea",{ref:u,value:p,onChange:a=>q(a.target.value),placeholder:o("comments.inputPlaceholder"),className:"w-full px-2 py-1.5 text-sm border border-border rounded bg-card resize-none focus:outline-none focus:ring-1 focus:ring-ring disabled:opacity-50 disabled:cursor-not-allowed",rows:2,disabled:r,onKeyDown:a=>{"Enter"!==a.key||a.shiftKey||a.nativeEvent.isComposing||(a.preventDefault(),z()),"Escape"!==a.key||r||m()}}),(0,d.jsxs)("div",{className:"mt-1 flex items-center justify-between gap-2",children:[(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:o(r?"comments.submitting":"comments.enterSubmit")}),(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("button",{className:"px-3 py-1 text-xs font-medium border border-amber-11 text-amber-11 rounded-md hover:bg-amber-9/10 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",onClick:z,disabled:r||!p.trim(),children:o("comments.submitComment")}),l&&(0,d.jsx)("button",{className:"px-3 py-1 text-xs font-medium border border-brand text-brand rounded-md hover:bg-brand/10 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",onClick:()=>{!r&&!n&&l&&p.trim()&&(s(!0),l(p.trim()),m())},disabled:r||n||!p.trim(),title:n?o("comments.aiResponding"):void 0,children:o("comments.sendToAI")})]})]})]})]})}function h({x:a,y:b,range:c,filePath:g,lineSnapshot:i,container:j,onSubmit:k,onClose:l,isChatLoading:m}){let{t:n}=(0,f.Bd)(),[o,p]=(0,e.useState)(""),q=(0,e.useRef)(null),r=(0,e.useRef)(null),[s,t]=(0,e.useState)({x:0,y:0}),u=i?.split("\n").slice(0,5).join("\n"),v=!!i&&i.split("\n").length>5;return(0,d.jsxs)("div",{ref:q,className:"absolute z-[200] w-[640px] bg-card border border-border rounded-lg shadow-lv2 overflow-hidden",style:{left:s.x,top:s.y},children:[(0,d.jsxs)("div",{className:"px-3 py-2 bg-brand/10 border-b border-border",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-xs font-medium text-brand",children:n("comments.askAI")}),(c.start>0||c.end>0)&&(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:n("comments.lineRange",{start:c.start,end:c.end})})]}),g&&(0,d.jsx)("div",{className:"mt-1 text-xs text-muted-foreground truncate",children:g})]}),i&&(0,d.jsx)("div",{className:"px-3 py-2 border-b border-border max-h-24 overflow-hidden",children:(0,d.jsxs)("pre",{className:"text-xs font-mono text-muted-foreground whitespace-pre-wrap break-all",children:[u,v&&(0,d.jsx)("span",{className:"text-muted-foreground/50",children:"..."})]})}),(0,d.jsxs)("div",{className:"p-2",children:[(0,d.jsx)("textarea",{ref:r,value:o,onChange:a=>p(a.target.value),placeholder:n("comments.inputQuestion"),className:"w-full px-2 py-1.5 text-sm border border-border rounded bg-card resize-none focus:outline-none focus:ring-1 focus:ring-ring disabled:opacity-50 disabled:cursor-not-allowed",rows:2,disabled:m,onKeyDown:a=>{"Enter"===a.key&&!a.shiftKey&&!a.nativeEvent.isComposing&&(a.preventDefault(),!m&&o.trim()&&(k(o.trim()),l())),"Escape"===a.key&&l()}}),(0,d.jsx)("div",{className:"mt-1 text-xs text-muted-foreground",children:n(m?"comments.aiGenerating":"comments.enterSend")})]})]})}},42390:(a,b,c)=>{"use strict";c.d(b,{P:()=>f});var d=c(67484),e=c(4325);function f(){let a=(0,d.useSyncExternalStore)(e.N4,e.fX,e.fX),b=(0,d.useCallback)(()=>{(0,e._I)()},[]);return{isUpdating:a.visible&&"done"!==a.stage&&"failed"!==a.stage,start:b}}},42910:(a,b,c)=>{"use strict";c.d(b,{Z:()=>k});var d=c(48249),e=c(67484),f=c(44256),g=c(63565),h=c(33281),i=c(41224);let j={deepseek:{label:"DeepSeek",apiKeysUrl:"https://platform.deepseek.com/api_keys",modelsEndpoint:"/v1/models"},kimi:{label:"Kimi",apiKeysUrl:"https://www.kimi.com/code/console",modelsEndpoint:"/coding/v1/models"},glm:{label:"GLM",apiKeysUrl:"https://bigmodel.cn/apikey/platform",modelsEndpoint:"/coding/paas/v4/models",regions:[{id:"cn",label:"中国大陆",hint:"open.bigmodel.cn"},{id:"global",label:"International",hint:"api.z.ai"}]}};function k({engine:a,currentModel:b,onModelChange:c,onHasKeyChange:l}){let m=j[a],[n,o]=(0,e.useState)(!1),[p,q]=(0,e.useState)(!1),[r,s]=(0,e.useState)(""),[t,u]=(0,e.useState)(""),[v,w]=(0,e.useState)(!1),[x,y]=(0,e.useState)(!1),[z,A]=(0,e.useState)(!1),[B,C]=(0,e.useState)(null),[D,E]=(0,e.useState)(!1),[F,G]=(0,e.useState)([]),[H,I]=(0,e.useState)(null),[J,K]=(0,e.useState)(null),L=(0,e.useRef)(null),M=(0,e.useRef)(null),N=(0,e.useRef)(null),O=(0,e.useRef)(null);(0,e.useRef)(b),(0,e.useRef)(c),(0,e.useRef)(l);let[P,Q]=(0,e.useState)({top:0,left:0}),R=(0,f.F2)(),S=(0,e.useCallback)(async()=>{y(!0),C(null),I(null);let[d,e]=await Promise.all([h.t4.runPromiseExit((0,i.Hw)(a)),h.t4.runPromiseExit((0,i.td)())]);if("Failure"===d._tag){C("Failed to load settings"),y(!1);return}q(d.value.hasKey),s(d.value.maskedKey),u(""),w(!1);let f="Success"===e._tag?e.value:void 0,g=f?.engines?.[a],j=g?.builtinModel;m.regions&&K(g?.region??("en"===f?.language?"global":"cn"));let k=[];if(d.value.hasKey){let b=await h.t4.runPromiseExit((0,i.Fi)(a));"Success"===b._tag?k=b.value.models:I("Failed to load models — check the API key")}G(k);let l=k.map(a=>a.id),n=j&&l.includes(j)?j:l[0];!n||b&&l.includes(b)||c(n),y(!1)},[a,b,c,m.regions]),T=(0,e.useCallback)(async b=>{let c=await h.t4.runPromiseExit((0,i.td)()),d=("Success"===c._tag?c.value:{}).engines||{},e={...d,[a]:{...d[a]||{},builtinModel:b}};if("Failure"===(await h.t4.runPromiseExit((0,i.em)({engines:e})))._tag)throw Error("Failed to save settings")},[a]),U=(0,e.useCallback)(async b=>{K(b);let c=await h.t4.runPromiseExit((0,i.td)()),d=("Success"===c._tag?c.value:{}).engines||{};"Failure"===(await h.t4.runPromiseExit((0,i.em)({engines:{...d,[a]:{...d[a]||{},region:b}}})))._tag?C("Failed to save region"):S()},[a,S]),V=async()=>{let b=t.trim();if(!b)return;A(!0),C(null);let c=await h.t4.runPromiseExit((0,i.dQ)(a,b));"Failure"===c._tag?C("Save failed"):(q(c.value.hasKey),s(c.value.maskedKey),u(""),w(!1),S()),A(!1)},W=async()=>{A(!0),C(null);let b=await h.t4.runPromiseExit((0,i.dQ)(a,""));"Failure"===b._tag?C("Clear failed"):(q(b.value.hasKey),s(b.value.maskedKey),u(""),w(!1),G([])),A(!1)},X=async()=>{let b=await h.t4.runPromiseExit((0,i.Ny)(a));if("Failure"===b._tag||!b.value.apiKey)return void C("Copy failed");try{await navigator.clipboard.writeText(b.value.apiKey)}catch{C("Clipboard unavailable");return}C(null),E(!0),O.current&&clearTimeout(O.current),O.current=setTimeout(()=>E(!1),1500)},Y=async a=>{c(a);try{await T(a)}catch{}},Z=p?b||"Select model":"Set API key",$=p?void 0:g.Aw,_=b||"",aa=n?(0,d.jsx)(f.ZL,{children:(0,d.jsx)("div",{ref:M,className:`${g.ys} min-w-[280px]`,style:{top:P.top,left:P.left},children:x?(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 text-xs text-muted-foreground",children:[(0,d.jsx)("span",{className:"w-3 h-3 border border-brand border-t-transparent rounded-full animate-spin"}),"Loading..."]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"px-3 py-1.5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1 mb-1.5",children:[(0,d.jsx)("span",{className:"text-[11px] font-medium text-muted-foreground",children:"API Key"}),(0,d.jsx)("a",{href:m.apiKeysUrl,target:"_blank",rel:"noopener","data-testid":`${a}-api-keys-link`,title:`Open ${m.label} API keys page`,"aria-label":`Open ${m.label} API keys page`,className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-hover transition-colors",children:(0,d.jsx)("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})})]}),p&&!v?(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("code",{className:"flex-1 min-w-0 truncate text-xs px-2 py-1 rounded bg-secondary text-foreground font-mono",children:r}),(0,d.jsx)("button",{onClick:X,"data-testid":`${a}-copy-api-key`,title:D?"Copied":"Copy API key","aria-label":"Copy API key",className:`p-1 rounded transition-colors ${D?"text-green-11":"text-muted-foreground hover:text-foreground hover:bg-hover"}`,disabled:z,children:D?(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),(0,d.jsx)("button",{onClick:()=>{w(!0),u(""),setTimeout(()=>N.current?.focus(),0)},className:"text-[11px] px-2 py-1 rounded bg-secondary hover:bg-hover text-foreground transition-colors",disabled:z,children:"Edit"}),(0,d.jsx)("button",{onClick:W,className:"text-[11px] px-2 py-1 rounded text-red-11 hover:bg-red-500/10 transition-colors",disabled:z,children:"Clear"})]}):(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("input",{ref:N,type:"password",value:t,onChange:a=>u(a.target.value),onKeyDown:a=>{"Enter"===a.key&&V()},placeholder:"sk-...",className:`flex-1 min-w-0 text-xs px-2 py-1 rounded bg-secondary text-foreground border border-border focus:outline-none font-mono ${g.Fx}`,autoFocus:!0}),(0,d.jsx)("button",{onClick:V,disabled:z||!t.trim(),className:`text-[11px] px-2 py-1 rounded transition-colors disabled:opacity-40 disabled:cursor-not-allowed ${g.$T}`,children:z?"Saving...":"Save"}),p&&(0,d.jsx)("button",{onClick:()=>{w(!1),u("")},className:"text-[11px] px-2 py-1 rounded text-muted-foreground hover:text-foreground transition-colors",children:"Cancel"})]}),B&&(0,d.jsx)("div",{className:"mt-1 text-[11px] text-red-11",children:B})]}),(0,d.jsx)("div",{className:"my-1 border-t border-border"}),m.regions&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"px-3 py-1.5",children:[(0,d.jsx)("div",{className:"text-[11px] font-medium text-muted-foreground mb-1.5",children:"Region"}),(0,d.jsx)("div",{className:"inline-flex rounded-md border border-border overflow-hidden text-xs",role:"group","data-testid":`${a}-region-toggle`,children:m.regions.map(b=>(0,d.jsx)("button",{type:"button","data-testid":`${a}-region-${b.id}`,onClick:()=>U(b.id),title:b.hint,className:`px-2 py-0.5 ${J===b.id?"bg-brand text-white":"bg-transparent text-muted-foreground hover:bg-hover"}`,children:b.label},b.id))})]}),(0,d.jsx)("div",{className:"my-1 border-t border-border"})]}),(0,d.jsxs)("div",{className:"px-3 py-1.5",children:[(0,d.jsx)("div",{className:"text-[11px] font-medium text-muted-foreground mb-1.5",children:"Model"}),H&&(0,d.jsx)("div",{className:"mb-1 text-[11px] text-red-11",children:H}),!H&&0===F.length&&(0,d.jsx)("div",{className:"mb-1 text-[11px] text-muted-foreground",children:p?`No models returned by ${m.modelsEndpoint}`:"Save an API key to list models"}),(0,d.jsx)("div",{className:"flex flex-col gap-0.5",children:F.map(a=>{var b;let c=_===a.id,e=(b=a.contextTokens)&&!(b<=0)?b>=1048576?`${Math.round(b/1048576)}M`:`${Math.round(b/1024)}K`:null;return(0,d.jsxs)("button",{onClick:()=>Y(a.id),className:`flex items-center gap-2 px-2 py-1 text-xs rounded transition-colors ${c?g.yI:"text-foreground hover:bg-hover"}`,children:[(0,d.jsx)(g.hG,{selected:c}),(0,d.jsx)("span",{className:"truncate",children:a.id}),a.label&&a.label!==a.id&&(0,d.jsx)("span",{className:"truncate text-[10px] text-muted-foreground",children:a.label}),e&&(0,d.jsx)("span",{className:"ml-auto pl-2 text-[10px] text-muted-foreground flex-shrink-0",children:e})]},a.id)})})]})]})})}):null;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(g.XY,{buttonRef:L,label:Z,labelClassName:$,title:`Configure ${m.label}`,onClick:()=>{if(!n){if(L.current){let a=L.current.getBoundingClientRect(),b=R?.getBoundingClientRect(),c=b?.left??0,d=b?.top??0;Q({top:a.bottom+4-d,left:a.left-c})}S()}o(a=>!a)},icon:(0,d.jsx)(g.eV,{engine:a}),testId:`${a}-config-picker`}),aa]})}},43037:(a,b,c)=>{"use strict";c.d(b,{E3:()=>g});var d=c(32891);function e(a){return a.classList.contains("task-list-item")}let f=/^\s*\[\/\]\s?/,g=d.YY.create({name:"markdownTaskListFix",addStorage:()=>({markdown:{parse:{updateDOM(a){var b;for(let c of Array.from(a.querySelectorAll("li"))){if(e(c))continue;let a=c.parentElement;a&&"UL"===a.tagName&&(b=c.textContent||"",/^\s*\[\/\]/.test(b)&&(!function(a){let b=a.ownerDocument.createTreeWalker(a,NodeFilter.SHOW_TEXT),c=b.nextNode();for(;c&&!(c.nodeValue&&""!==c.nodeValue.trim());)c=b.nextNode();c&&c.nodeValue&&(c.nodeValue=c.nodeValue.replace(f,""))}(c),c.classList.add("task-list-item"),c.setAttribute("data-type","taskItem"),c.setAttribute("data-status","doing"),a.classList.add("contains-task-list")))}!function(a){for(let b of Array.from(a.querySelectorAll("ul.contains-task-list"))){let a=Array.from(b.children).filter(a=>"LI"===a.tagName);if(0===a.length)continue;let c=function(a){let b=[];for(let c of a){let a=b[b.length-1];a&&a.isTask===c.isTask?a.items.push(c):b.push({isTask:c.isTask,items:[c]})}return b}(a.map(a=>({isTask:e(a),el:a})));if(c.length<=1){c[0]?.isTask&&b.setAttribute("data-type","taskList");continue}let d=b.ownerDocument,f=d.createDocumentFragment();for(let a of c){let b=d.createElement("ul");for(let{el:c}of(a.isTask&&(b.setAttribute("class","contains-task-list"),b.setAttribute("data-type","taskList")),a.items))b.appendChild(c);f.appendChild(b)}b.replaceWith(f)}}(a)}}}})})},43209:(a,b,c)=>{"use strict";c.d(b,{Q:()=>n});var d=c(48249),e=c(67484),f=c(44384),g=c(15819),h=c(57031),i=c(88214),j=c(33281),k=c(41224),l=c(32753),m=c(74228);function n({isOpen:a,onClose:b,cwd:c,onSelectSession:o,projectNumber:p,openSessionIds:q=[]}){let{t:r}=(0,f.Bd)(),[s,t]=(0,e.useState)([]),[u,v]=(0,e.useState)(!1),[w,x]=(0,e.useState)(null),[y,z]=(0,e.useState)(""),A=(0,e.useRef)(null);(0,e.useCallback)(async()=>{let a;if(!c)return;v(!0),x(null);let b=(a=c.replace(/[^a-zA-Z0-9]/g,"-")).length<=200?a:`${a.slice(0,200)}-${function(a){let b=0;for(let c=0;c<a.length;c++)b=(b<<5)-b+a.charCodeAt(c)|0;return Math.abs(b).toString(36)}(c)}`,d=await j.t4.runPromiseExit((0,k.QW)(b));"Success"===d._tag?t(d.value):x("Failed to load sessions"),v(!1)},[c]);let B=s.filter(a=>{if(!y)return!0;let b=y.toLowerCase();return void 0!==a.searchText?a.searchText.includes(b):a.title.toLowerCase().includes(b)||a.firstMessages.some(a=>a.toLowerCase().includes(b))||a.lastMessages.some(a=>a.toLowerCase().includes(b))});return a?(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,d.jsx)("div",{className:"absolute inset-0 bg-scrim",onClick:b}),(0,d.jsxs)("div",{className:g.iG,children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("h2",{className:"text-sm font-medium text-foreground",children:r("sessions.sessionList")}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground truncate","data-tooltip":c,children:c})]}),(0,d.jsxs)("div",{className:"flex items-center gap-3 ml-4",children:[(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("input",{ref:A,type:"text",placeholder:r("sessions.searchSessions"),value:y,onChange:a=>z(a.target.value),className:"px-2 py-1 pr-6 text-xs border border-border rounded bg-card text-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent"}),y&&(0,d.jsx)("button",{onClick:()=>{z(""),A.current?.focus()},className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-foreground-subtle hover:text-foreground rounded-sm transition-colors",title:r("fileBrowser.clear"),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,d.jsx)("button",{onClick:b,className:"p-1 text-foreground-subtle hover:text-foreground hover:bg-hover rounded transition-colors",children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),(0,d.jsxs)("div",{className:"flex-1 overflow-y-auto p-4",children:[u&&(0,d.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,d.jsxs)("svg",{className:"animate-spin h-4 w-4",fill:"none",viewBox:"0 0 24 24",children:[(0,d.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,d.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),(0,d.jsx)("span",{children:r("sessions.loadingSessions")})]})}),w&&(0,d.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,d.jsx)("div",{className:"text-xs text-red-11",children:w})}),!u&&!w&&0===B.length&&(0,d.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,d.jsx)("div",{className:"text-xs text-muted-foreground",children:r(y?"sessions.noMatchingSessions":"sessions.noSessionsYet")})}),!u&&!w&&B.length>0&&(0,d.jsx)("div",{className:g.jL,children:B.map(a=>{let e=a.path.split("/").pop()||"",f=a.sessionId||e.replace(".jsonl",""),g=q.indexOf(f);return(0,d.jsxs)("div",{onClick:()=>{let d,e;return d=a.path.split("/").pop()||"",e=a.sessionId||d.replace(".jsonl",""),void(o?(o(e,a.title),b()):(0,h.F)(i.n.OpenProject,{cwd:c,sessionId:e}))},className:"p-3 rounded border border-border hover:border-brand hover:shadow-lv2 cursor-pointer transition-all",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 mb-1",children:[(0,d.jsx)(l.S,{engine:a.engine}),(0,d.jsx)("h4",{className:"text-xs font-medium text-foreground truncate","data-tooltip":a.title,children:a.title}),p&&g>=0&&(0,d.jsx)(m.l,{projectNumber:p,sessionNumber:g+1,className:"ml-auto"})]}),(0,d.jsx)("div",{className:"text-xs text-muted-foreground mb-2",children:new Date(a.modifiedAt).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}),(0,d.jsxs)("div",{className:"space-y-0.5 text-xs",children:[a.firstMessages.map((a,b)=>(0,d.jsxs)("div",{className:"text-foreground truncate","data-tooltip":a,children:[(0,d.jsx)("span",{className:"text-foreground-subtle mr-1",children:"•"}),a]},`first-${b}`)),a.lastMessages.length>0&&(0,d.jsx)("div",{className:"text-foreground-subtle text-center py-0.5",children:"\xb7\xb7\xb7"}),a.lastMessages.map((a,b)=>(0,d.jsxs)("div",{className:"text-foreground truncate","data-tooltip":a,children:[(0,d.jsx)("span",{className:"text-foreground-subtle mr-1",children:"•"}),a]},`last-${b}`))]})]},a.path)})})]})]})]}):null}},43321:(a,b,c)=>{"use strict";c.d(b,{D:()=>f});let d=/^\s*[-*+]\s+(?:\\?\[ \\?\]|\\?\[[xX/]\\?\])\s*$/,e=/^\s*(```|~~~)/;function f(a){if(!a)return a;let b=a.split("\n"),c=[],f=!1;for(let a of b){if(e.test(a)){f=!f,c.push(a);continue}if(f){c.push(a);continue}d.test(a)||c.push(a)}let g=[],h=0,i=!1;for(let a of c){if(e.test(a)){i=!i,g.push(a),h=0;continue}if(!i&&""===a.trim()){if((h+=1)>=2)continue;g.push(a);continue}h=0,g.push(a)}return g.join("\n")}},43489:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,60440,23)),Promise.resolve().then(c.t.bind(c,84342,23)),Promise.resolve().then(c.t.bind(c,82265,23)),Promise.resolve().then(c.t.bind(c,35421,23)),Promise.resolve().then(c.t.bind(c,61335,23)),Promise.resolve().then(c.t.bind(c,70664,23)),Promise.resolve().then(c.bind(c,74661))},44256:(a,b,c)=>{"use strict";c.d(b,{F2:()=>m,ZL:()=>k,a9:()=>l});var d=c(48249),e=c(67484),f=c(74429);let g=()=>()=>{},h=()=>document.body,i=()=>null,j=(0,e.createContext)(null);function k({children:a}){let b=(0,e.useContext)(j),c=(0,e.useSyncExternalStore)(g,h,i),d=b??c;return d?(0,f.createPortal)(a,d):null}function l({children:a}){let[b,c]=(0,e.useState)(null);return(0,d.jsxs)("div",{className:"relative w-full h-full",style:{transform:"translateZ(0)"},children:[(0,d.jsx)(j.Provider,{value:b,children:a}),(0,d.jsx)("div",{ref:c,className:"absolute inset-0 pointer-events-none [&>*]:pointer-events-auto"})]})}function m(){return(0,e.useContext)(j)}},44616:(a,b,c)=>{Promise.resolve().then(c.bind(c,67045))},46242:(a,b,c)=>{"use strict";c.d(b,{M:()=>g});var d=c(48249),e=c(88018);let f=(a,b,c)=>`/api/git/blob?cwd=${encodeURIComponent(a)}&rev=${encodeURIComponent(b)}&file=${encodeURIComponent(c)}`;function g({cwd:a,filePath:b,oldRev:c,newRev:h}){return(0,d.jsx)(e.K,{filePath:b,oldSrc:c?f(a,c,b):null,newSrc:h?f(a,h,b):null})}},47276:(a,b,c)=>{"use strict";c.d(b,{m3:()=>i,mi:()=>g,ot:()=>h});var d=c(79606),e=c(71192);let f=(a,b)=>d.tryPromise({try:async()=>{let c=await fetch(a,b);if(!c.ok){let a;try{a=(await c.json()).error}catch{}throw Error(a||`HTTP ${c.status}`)}return await c.json()},catch:c=>new e.uV({message:`${b?.method??"GET"} ${a} failed`,cause:c})}),g=()=>f("/api/html-apps"),h=a=>f("/api/html-apps",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a})}),i=a=>f(`/api/html-apps/${encodeURIComponent(a)}`,{method:"DELETE"})},47604:(a,b,c)=>{"use strict";c.d(b,{f:()=>k});var d=c(48249),e=c(67484),f=c(44384),g=c(33281),h=c(63565),i=c(41224);let j={CNY:"\xa5",USD:"$"};function k({hasKey:a}){let{t:b}=(0,f.Bd)(),[c,l]=(0,e.useState)(!1),[m,n]=(0,e.useState)(null),[o,p]=(0,e.useState)(null),q=(0,e.useCallback)(async()=>{l(!0),p(null);let a=await g.t4.runPromiseExit((0,i.he)());"Failure"===a._tag?(n(null),p(b("chat.balanceFailed",{defaultValue:"Query failed — check the API key"}))):n(a.value),l(!1)},[b]),r=m?m.balances.map(a=>`${j[a.currency]??(a.currency?`${a.currency} `:"")}${a.totalBalance}`).join(" / "):"",s=!!(m&&!m.isAvailable);return(0,d.jsxs)("div",{className:"ml-auto flex items-center gap-2",children:[c&&(0,d.jsx)("span",{className:"w-3 h-3 border border-brand border-t-transparent rounded-full animate-spin"}),!c&&o&&(0,d.jsx)("span",{className:"text-xs text-red-11",children:o}),!c&&!o&&m&&(0,d.jsx)("span",{className:`text-xs font-mono ${s?"text-red-11":h.pe.deepseek}`,"data-tooltip":s?b("chat.balanceUnavailable",{defaultValue:"Account is not available for requests"}):void 0,"data-testid":"deepseek-balance-value",children:r||b("chat.balanceEmpty",{defaultValue:"No balance returned"})}),(0,d.jsx)("button",{type:"button","data-testid":"deepseek-balance-button",disabled:!a||c,onClick:q,"data-tooltip":a?void 0:b("chat.balanceNeedsKey",{defaultValue:"Set a DeepSeek API key first"}),className:"px-2 py-0.5 text-xs rounded border border-border text-muted-foreground hover:bg-hover hover:text-foreground transition-colors disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-transparent",children:b("chat.checkBalance",{defaultValue:"Check balance"})}),(0,d.jsx)("a",{href:"https://platform.deepseek.com/usage",target:"_blank",rel:"noopener","data-testid":"deepseek-usage-link",title:b("chat.openUsagePage",{defaultValue:"Open DeepSeek usage console"}),"aria-label":b("chat.openUsagePage",{defaultValue:"Open DeepSeek usage console"}),className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-hover transition-colors",children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})})]})}},47938:(a,b,c)=>{"use strict";c.d(b,{SessionBrowser:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call SessionBrowser() from the server but SessionBrowser is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/SessionBrowser.tsx","SessionBrowser")},48587:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{y:()=>k});var e=c(48249),f=c(67484),g=c(33407),h=c(62742);c(33281);var i=c(55287);c(87808),c(25419);var j=a([i]);function k({entryPath:a,entryContent:b}){let c,d=(0,f.useMemo)(()=>{let b,c;return(c=(b=a.replace(/\\/g,"/")).lastIndexOf("/"))<=0?"/":b.slice(0,c)},[a]),j=(0,f.useRef)(new Map),[l,m]=(0,f.useState)([]),[n,o]=(0,f.useState)(a),[p,q]=(0,f.useState)(!0),r=l.find(a=>a.abs===n),s=l.length>1||p;return(0,e.jsxs)("div",{className:"flex h-full",children:[s&&(0,e.jsxs)("div",{className:"w-56 flex-shrink-0 border-r border-border overflow-y-auto",children:[l.map(a=>(0,e.jsxs)("button",{onClick:()=>o(a.abs),"data-tooltip":a.rel,className:`w-full text-left px-3 py-1.5 text-xs flex items-center gap-2 min-w-0 transition-colors ${n===a.abs?"bg-accent text-foreground":"text-muted-foreground hover:bg-hover"}`,children:["image"===a.kind?(0,e.jsx)(g.A,{className:"w-3.5 h-3.5 flex-shrink-0"}):(0,e.jsx)(h.A,{className:"w-3.5 h-3.5 flex-shrink-0"}),(0,e.jsx)("span",{className:"truncate",children:a.rel})]},a.abs)),p&&(0,e.jsx)("div",{className:"px-3 py-1.5 text-xs text-muted-foreground",children:"…"})]}),(0,e.jsx)("div",{className:"flex-1 min-w-0 overflow-hidden",children:r?.kind==="image"?(0,e.jsx)("div",{className:"h-full flex items-center justify-center p-4 overflow-auto bg-background",children:(0,e.jsx)("img",{src:`/api/file?path=${encodeURIComponent(n)}&raw=true`,alt:(c=n.replace(/\\/g,"/")).slice(c.lastIndexOf("/")+1),className:"max-w-full max-h-full object-contain"})}):(0,e.jsx)(i.Cv,{content:j.current.get(n)??"",filePath:n,cwd:d},n)})]})}i=(j.then?(await j)():j)[0],d()}catch(a){d(a)}})},48830:(a,b,c)=>{"use strict";c.d(b,{n:()=>x});var d=c(48249),e=c(67484),f=c(44384),g=c(7833),h=c(15819),i=c(10316),j=c(46674),k=c(24520),l=c(50514),m=c(15273),n=c(45231),o=c(66400),p=c(86588),q=c(82594),r=c(59347),s=c(33281),t=c(64676),u=c(40893),v=c(35857),w=c(47276);function x({isOpen:a,htmlAppPreviews:b,activeHtmlAppPreviewPath:c,onShowHtmlAppPreview:r,onMinimizeHtmlAppPreview:z,onCloseHtmlAppPreview:A,onClose:B,onOpenApp:C}){let{t:D,i18n:E}=(0,f.Bd)(),[F,G]=(0,e.useState)([]),[H,I]=(0,e.useState)(!1),[J,K]=(0,e.useState)(""),[L,M]=(0,e.useState)(!1),[N,O]=(0,e.useState)(""),[P,Q]=(0,e.useState)(!1),[R,S]=(0,e.useState)({}),T=(0,e.useRef)(null),U=(0,e.useCallback)(async()=>{I(!0);let a=await s.t4.runPromiseExit((0,w.mi)());"Success"===a._tag?G(a.value):console.error("Failed to load html apps",a.cause),I(!1)},[]),V=(0,e.useCallback)(()=>{M(!1),B()},[B]),W=(0,e.useMemo)(()=>{let a=J.trim().toLowerCase();return a?F.filter(b=>b.name.toLowerCase().includes(a)||b.title.toLowerCase().includes(a)||b.description.toLowerCase().includes(a)||b.path.toLowerCase().includes(a)):F},[F,J]),X=(0,e.useMemo)(()=>F.filter(a=>!a.builtin).length,[F]),Y=J.trim().length>0,Z=E.resolvedLanguage?.startsWith("zh")?"https://opencockpit.dev/zh/docs/agent/html-apps/":"https://opencockpit.dev/en/docs/agent/html-apps/",$=(0,e.useCallback)(async()=>{let a=N.trim();if(!a)return;Q(!0);let b=await s.t4.runPromiseExit((0,w.ot)(a));if("Success"===b._tag)b.value.alreadyExists?(0,g.oR)(D("htmlApps.alreadyAdded"),"info"):((0,g.oR)(D("htmlApps.added"),"success"),(0,v.N)()),O(""),M(!1),await U();else{let a="Fail"===b.cause._tag?b.cause.error:null,c=a?.cause,d=c instanceof Error?c.message:D("htmlApps.addFailed");(0,g.oR)(d,"error")}Q(!1)},[N,U,D]),_=(0,e.useCallback)(async a=>{"Success"===(await s.t4.runPromiseExit((0,w.m3)(a)))._tag?(G(b=>b.filter(b=>b.id!==a)),(0,v.N)()):(0,g.oR)(D("common.deleteFailed"),"error")},[D]),aa=(0,e.useCallback)(a=>{C?C(a):window.dispatchEvent(new CustomEvent("console-open-browser",{detail:{url:a}})),V()},[V,C]),ab=(0,e.useCallback)(a=>{C?C(a):window.dispatchEvent(new CustomEvent("console-open-browser",{detail:{url:a}})),z()},[z,C]),ac=(0,e.useCallback)(a=>{let b=(0,t.Xe)(a);window.open((0,t.PB)(b,window.location.origin),"_blank")},[]),ad=(0,e.useCallback)(a=>{S(b=>({...b,[a]:(b[a]||0)+1}))},[]),ae=(0,e.useCallback)(async a=>{try{await navigator.clipboard.writeText(a),(0,g.oR)(D("common.copiedPath"),"success")}catch{(0,g.oR)(D("common.copyFailed"),"error")}},[D]);return(0,d.jsxs)(d.Fragment,{children:[a&&(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,d.jsx)("div",{className:"absolute inset-0 bg-scrim",onClick:V}),(0,d.jsxs)("div",{className:h.aO,children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border flex-shrink-0",children:[(0,d.jsx)("h2",{className:"text-sm font-medium text-foreground",children:D("htmlApps.title")}),(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)(i.A,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-foreground-subtle pointer-events-none"}),(0,d.jsx)("input",{ref:T,type:"text",value:J,onChange:a=>K(a.target.value),placeholder:D("htmlApps.searchPlaceholder"),className:"pl-7 pr-6 py-1 text-xs border border-border rounded bg-card text-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent"}),J&&(0,d.jsx)("button",{onClick:()=>{K(""),T.current?.focus()},className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-foreground-subtle hover:text-foreground rounded-sm transition-colors",title:D("fileBrowser.clear"),children:(0,d.jsx)(j.A,{className:"w-3.5 h-3.5"})})]}),(0,d.jsxs)("button",{onClick:()=>M(!0),className:"flex items-center gap-1.5 px-2.5 py-1 text-xs rounded-md border border-border text-muted-foreground hover:text-foreground hover:bg-hover transition-colors",title:D("htmlApps.addHtmlApp"),children:[(0,d.jsx)(k.A,{className:"w-4 h-4"})," ",D("htmlApps.add")]}),(0,d.jsx)("button",{onClick:V,className:"p-1 text-foreground-subtle hover:text-foreground hover:bg-hover rounded transition-colors",title:D("common.close"),children:(0,d.jsx)(j.A,{className:"w-5 h-5"})})]})]}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:H?(0,d.jsx)("div",{className:"text-center text-muted-foreground py-8 text-sm",children:D("common.loading")}):(0,d.jsxs)(d.Fragment,{children:[W.length>0&&(0,d.jsx)("div",{className:h.jL,children:W.map(a=>(0,d.jsx)(y,{app:a,onOpenConsole:()=>aa(a.path),onOpenExternal:()=>ac(a.path),onPreview:()=>{r({path:a.path,title:a.title,icon:a.icon}),V()},onDelete:()=>_(a.id),onCopyPath:()=>ae(a.path)},a.id))}),0===W.length&&Y&&(0,d.jsx)("div",{className:"text-center text-muted-foreground py-8 text-sm",children:D("htmlApps.emptyNoMatch")}),!Y&&0===X&&(0,d.jsxs)("div",{className:`text-center text-muted-foreground py-8 text-sm space-y-2${W.length>0?" mt-4 border-t border-border/60":""}`,children:[(0,d.jsx)("p",{children:D("htmlApps.emptyNoApps")}),(0,d.jsxs)("p",{children:[D("htmlApps.emptyCreatePrefix")," ",(0,d.jsx)("code",{className:"px-1.5 py-0.5 rounded bg-muted text-foreground font-mono text-xs",children:"/html"})," ",D("htmlApps.emptyCreateSuffix")]}),(0,d.jsxs)("p",{children:[(0,d.jsx)("button",{type:"button",onClick:()=>M(!0),className:"text-brand hover:underline",children:D("htmlApps.addExisting")})," \xb7 ",(0,d.jsx)("a",{href:Z,target:"_blank",rel:"noreferrer",className:"text-brand hover:underline",children:D("htmlApps.viewDocs")})]})]})]})})]})]}),a&&L&&(0,d.jsxs)("div",{className:"fixed inset-0 z-[60] flex items-center justify-center",children:[(0,d.jsx)("div",{className:"absolute inset-0 bg-scrim",onClick:()=>{P||(M(!1),O(""))}}),(0,d.jsxs)("div",{className:"relative bg-card rounded-lg shadow-lv3 w-full max-w-lg mx-4 p-5",children:[(0,d.jsx)("h3",{className:"text-sm font-medium text-foreground mb-3",children:D("htmlApps.addHtmlApp")}),(0,d.jsx)("label",{className:"block text-xs text-muted-foreground mb-1",children:D("htmlApps.pathLabel")}),(0,d.jsx)("input",{type:"text",value:N,onChange:a=>O(a.target.value),onKeyDown:a=>{"Enter"!==a.key||P||$()},placeholder:"/Users/you/.../report.html",autoFocus:!0,className:"w-full px-3 py-2 text-sm font-mono border border-border rounded-md bg-card text-foreground focus:outline-none focus:ring-2 focus:ring-ring"}),(0,d.jsxs)("div",{className:"flex justify-end gap-2 mt-4",children:[(0,d.jsx)("button",{onClick:()=>{M(!1),O("")},disabled:P,className:"px-3 py-1.5 text-sm rounded-md border border-border text-muted-foreground hover:text-foreground hover:bg-hover transition-colors disabled:opacity-50",children:D("common.cancel")}),(0,d.jsx)("button",{onClick:$,disabled:P||!N.trim(),className:"px-3 py-1.5 text-sm rounded-md bg-brand text-white hover:bg-teal-10 transition-colors disabled:opacity-50",children:P?D("htmlApps.adding"):D("htmlApps.add")})]})]})]}),b.map(a=>{let b=c===a.path;return(0,d.jsx)("div",{className:b?"fixed inset-0 z-[60] flex items-center justify-center bg-scrim p-0 md:p-4":"hidden",onClick:z,children:(0,d.jsxs)("div",{className:"bg-card shadow-lv3 border border-brand/30 w-full h-full md:max-w-[90%] md:h-[90vh] md:rounded-lg flex flex-col overflow-hidden",onClick:a=>a.stopPropagation(),children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3 px-4 py-2 border-b border-border flex-shrink-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[a.icon?(0,d.jsx)("span",{className:"text-base leading-none flex-shrink-0",children:a.icon}):(0,d.jsx)(l.A,{className:"w-4 h-4 flex-shrink-0"}),(0,d.jsx)("span",{className:"text-sm text-muted-foreground truncate max-w-[35%]","data-tooltip":a.title,children:a.title}),(0,d.jsx)("span",{className:"text-sm text-muted-foreground flex-shrink-0","aria-hidden":"true",children:"-"}),(0,d.jsx)("span",{className:"font-mono text-sm text-muted-foreground truncate min-w-0","data-tooltip":a.path,children:a.path}),(0,d.jsx)("button",{onClick:()=>ae(a.path),className:"text-muted-foreground hover:text-foreground p-0.5 rounded hover:bg-hover transition-colors flex-shrink-0",title:D("common.copyPath"),"aria-label":D("common.copyPath"),children:(0,d.jsx)(m.A,{className:"w-4 h-4"})})]}),(0,d.jsx)("button",{onClick:z,className:"text-muted-foreground hover:text-foreground px-1.5 py-0.5 rounded hover:bg-hover transition-colors flex-shrink-0",title:D("common.minimize"),children:(0,d.jsx)(n.A,{className:"w-4 h-4"})}),(0,d.jsx)("button",{onClick:()=>ab(a.path),className:"text-muted-foreground hover:text-foreground px-1.5 py-0.5 rounded hover:bg-hover transition-colors flex-shrink-0",title:D("common.openInConsole"),children:(0,d.jsx)(o.A,{className:"w-4 h-4"})}),(0,d.jsx)("button",{onClick:()=>ac(a.path),className:"text-muted-foreground hover:text-foreground px-1.5 py-0.5 rounded hover:bg-hover transition-colors flex-shrink-0",title:D("browser.openInNewWindow"),children:(0,d.jsx)(p.A,{className:"w-4 h-4"})}),(0,d.jsx)("button",{onClick:()=>ad(a.path),className:"text-muted-foreground hover:text-foreground px-1.5 py-0.5 rounded hover:bg-hover transition-colors flex-shrink-0",title:D("common.refresh"),children:(0,d.jsx)(q.A,{className:"w-4 h-4"})}),(0,d.jsx)("button",{onClick:()=>A(a.path),className:"text-muted-foreground hover:text-foreground px-1.5 py-0.5 rounded hover:bg-hover transition-colors flex-shrink-0",children:(0,d.jsx)(j.A,{className:"w-4 h-4"})})]}),(0,d.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,d.jsx)(u.O,{filePath:a.path,reloadKey:R[a.path]||0})})]})},a.path)})]})}function y({app:a,onOpenConsole:b,onOpenExternal:c,onPreview:g,onDelete:h,onCopyPath:i}){let{t:j}=(0,f.Bd)(),[k,l]=(0,e.useState)(!1);return(0,d.jsxs)("div",{className:`group flex flex-col h-full border border-border rounded-lg p-3 hover:border-brand hover:shadow-lv2 transition-all cursor-pointer ${a.valid?"":"opacity-60"}`,onClick:()=>a.valid&&g(),children:[(0,d.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,d.jsx)("div",{className:"w-9 h-9 flex-shrink-0 flex items-center justify-center rounded-md bg-brand/10 text-brand text-lg",children:a.icon?(0,d.jsx)("span",{children:a.icon}):(0,d.jsx)(p.A,{className:"w-5 h-5"})}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("div",{className:"text-sm font-medium text-foreground truncate","data-tooltip":a.title,children:a.title}),(0,d.jsxs)("div",{className:"font-mono text-[11px] text-muted-foreground truncate","data-tooltip":`/${a.name}`,children:["/",a.name]})]}),!a.valid&&(0,d.jsx)("span",{className:"flex-shrink-0 text-xs px-1.5 py-0.5 rounded bg-red-9/15 text-red-11",children:j("htmlApps.invalid")}),a.builtin&&(0,d.jsx)("span",{className:"flex-shrink-0 text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:j("htmlApps.builtin")}),(0,d.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0 opacity-0 group-hover:opacity-100 focus-within:opacity-100 transition-opacity",onClick:a=>a.stopPropagation(),children:[(0,d.jsx)("button",{onClick:b,disabled:!a.valid,className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-hover rounded transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:j("common.openInConsole"),children:(0,d.jsx)(o.A,{className:"w-4 h-4"})}),(0,d.jsx)("button",{onClick:c,disabled:!a.valid,className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-hover rounded transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:j("browser.openInNewWindow"),children:(0,d.jsx)(p.A,{className:"w-4 h-4"})}),a.builtin?null:k?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("button",{onClick:()=>{l(!1),h()},className:"px-2 py-1 text-xs rounded bg-red-9 text-white hover:bg-red-10",children:j("common.confirm")}),(0,d.jsx)("button",{onClick:()=>l(!1),className:"px-2 py-1 text-xs rounded border border-border text-muted-foreground hover:text-foreground",children:j("common.cancel")})]}):(0,d.jsx)("button",{onClick:()=>l(!0),className:"p-1.5 text-muted-foreground hover:text-red-11 hover:bg-red-9/10 rounded transition-colors",title:j("common.delete"),children:(0,d.jsx)(r.A,{className:"w-4 h-4"})})]})]}),(0,d.jsxs)("div",{className:"font-mono text-xs text-muted-foreground mt-2 break-all",children:[a.path,(0,d.jsx)("button",{onClick:a=>{a.stopPropagation(),i()},className:"inline-flex align-middle ml-1 p-0.5 hover:text-foreground hover:bg-hover rounded transition-colors",title:j("common.copyPath"),children:(0,d.jsx)(m.A,{className:"w-3.5 h-3.5"})})]}),(0,d.jsx)("p",{className:"text-sm text-muted-foreground mt-2 pt-2 border-t border-border/60 break-words whitespace-pre-wrap",children:a.description||(0,d.jsx)("span",{className:"italic opacity-60",children:j("htmlApps.noDescription")})})]})}},50508:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{KO:()=>i,LD:()=>m,Mm:()=>k,Qr:()=>a,fw:()=>j,o$:()=>l});var e=c(48249),f=c(67484),g=c(33281),h=c(85655);let a=a=>a.split("/").pop()||a;function i({status:a,className:b=""}){return(0,e.jsx)("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${"loading"===a?"bg-orange-11":"unread"===a?"bg-red-11":"bg-muted-foreground/30"} ${b}`})}function j(a,b){let c=Math.floor((Date.now()-b)/6e4);if(c<1)return a("common.justNow");if(c<60)return a("common.minutesAgo",{count:c});let d=Math.floor(c/60);return d<24?a("common.hoursAgo",{count:d}):a("common.daysAgo",{count:Math.floor(d/24)})}function k(a,b){return"loading"===b?a("sessions.running"):"unread"===b?a("sessions.done"):void 0}function l(){let[a,b]=(0,f.useState)(null),[c,d]=(0,f.useState)({}),e=(0,f.useCallback)((a,c)=>{let e=c.currentTarget.getBoundingClientRect(),f=e.top;f+260>window.innerHeight&&(f=Math.max(8,window.innerHeight-260-8)),b({session:a,top:f,left:e.right+8}),d(b=>a.cwd in b?b:(g.t4.runPromiseExit((0,h.ue)(a.cwd)).then(b=>{"Success"===b._tag&&d(c=>({...c,[a.cwd]:b.value.branch}))}),{...b,[a.cwd]:null}))},[]),i=(0,f.useCallback)(()=>b(null),[]);return{card:a,branch:a?c[a.session.cwd]??null:null,show:e,hide:i}}function m({card:b,branch:c}){if(!b)return null;let{session:d}=b,f=(d.firstMessages?.length??0)>0||(d.lastMessages?.length??0)>0;return(0,e.jsxs)("div",{className:"fixed z-[60] w-72 max-h-[260px] overflow-y-auto bg-popover border border-border rounded-lg shadow-lv2 p-3 pointer-events-none",style:{top:b.top,left:b.left},children:[(0,e.jsx)("div",{className:"text-xs font-medium text-foreground truncate",children:a(d.cwd)}),d.title&&(0,e.jsx)("div",{className:"text-xs font-medium text-foreground truncate mt-0.5",children:d.title}),(0,e.jsx)("div",{className:"text-[10px] text-foreground-faint truncate mt-0.5",children:d.cwd}),c&&(0,e.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground font-normal min-w-0",children:[(0,e.jsxs)("svg",{className:"w-3 h-3 flex-shrink-0 text-brand",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,e.jsx)("circle",{cx:"6",cy:"6",r:"2.5"}),(0,e.jsx)("circle",{cx:"6",cy:"18",r:"2.5"}),(0,e.jsx)("circle",{cx:"18",cy:"7",r:"2.5"}),(0,e.jsx)("path",{strokeLinecap:"round",d:"M6 8.5v7M8.5 6.5h4.5a3 3 0 013 3v0"})]}),(0,e.jsx)("span",{className:"truncate",children:c})]}),f?(0,e.jsxs)("div",{className:"space-y-0.5 text-xs border-t border-border/50 mt-2 pt-2",children:[d.firstMessages?.map((a,b)=>(0,e.jsxs)("div",{className:"text-foreground/90 truncate",children:[(0,e.jsx)("span",{className:"text-foreground-subtle mr-1",children:"•"}),a]},`f-${b}`)),(d.lastMessages?.length??0)>0&&(0,e.jsx)("div",{className:"text-foreground-subtle text-center py-0.5",children:"\xb7\xb7\xb7"}),d.lastMessages?.map((a,b)=>(0,e.jsxs)("div",{className:"text-foreground/90 truncate",children:[(0,e.jsx)("span",{className:"text-foreground-subtle mr-1",children:"•"}),a]},`l-${b}`))]}):d.lastUserMessage?(0,e.jsx)("div",{className:"text-xs text-foreground/90 border-t border-border/50 mt-2 pt-2 line-clamp-3 break-words",children:d.lastUserMessage}):null]})}d()}catch(a){d(a)}})},53036:(a,b,c)=>{"use strict";c.d(b,{I:()=>f});var d=c(48249),e=c(67484);function f(a){let{refreshKey:b,className:c="h-full flex items-center justify-center p-4 bg-secondary",imgClassName:f="max-w-full max-h-full object-contain",alt:g}=a,h="absPath"in a&&"string"==typeof a.absPath,i=h?void 0:a.cwd,j=h?void 0:a.path,k=h?a.absPath:void 0,[l,m]=(0,e.useState)({kind:"loading"});if((0,e.useRef)(0),"loading"===l.kind)return(0,d.jsx)("div",{className:c,children:(0,d.jsx)("span",{className:"inline-block w-6 h-6 border-2 border-brand border-t-transparent rounded-full animate-spin"})});if("missing"===l.kind)return(0,d.jsx)("div",{className:c,children:(0,d.jsx)("div",{className:"text-sm text-muted-foreground",children:"File not found"})});if("too-large"===l.kind)return(0,d.jsx)("div",{className:c,children:(0,d.jsxs)("div",{className:"text-sm text-muted-foreground",children:["Image too large to preview (",Math.round(l.size/1024/1024)," MB)"]})});if("error"===l.kind)return(0,d.jsx)("div",{className:c,children:(0,d.jsx)("div",{className:"text-sm text-red-11",children:l.message})});let n=h?`/api/file?path=${encodeURIComponent(k)}&raw=true`:`/api/files/read?cwd=${encodeURIComponent(i)}&path=${encodeURIComponent(j)}&v=${encodeURIComponent(l.etag)}`;return(0,d.jsx)("div",{className:c,children:(0,d.jsx)("img",{src:n,alt:g??(j||k),className:f})})}c(33281),c(87808)},53113:(a,b,c)=>{Promise.resolve().then(c.bind(c,4462)),Promise.resolve().then(c.bind(c,29491)),Promise.resolve().then(c.bind(c,34001)),Promise.resolve().then(c.bind(c,83179)),Promise.resolve().then(c.bind(c,25608)),Promise.resolve().then(c.bind(c,8077)),Promise.resolve().then(c.bind(c,5585)),Promise.resolve().then(c.bind(c,77120)),Promise.resolve().then(c.bind(c,77220)),Promise.resolve().then(c.bind(c,3588)),Promise.resolve().then(c.bind(c,77462)),Promise.resolve().then(c.bind(c,38878)),Promise.resolve().then(c.bind(c,37129)),Promise.resolve().then(c.bind(c,99033))},54727:(a,b,c)=>{"use strict";c.d(b,{y:()=>q});var d=c(32891),e=c(10259),f=c(1370);function g(a){let b=[];return a.forEach((a,c)=>b.push({node:a,start:c,end:c+a.nodeSize})),b}function h(a,b){return"heading"===a.type.name&&a.attrs.level<=b}function i(a){for(let b=a.depth;b>0;b--){let c=a.node(b).type.name;if("listItem"===c||"taskItem"===c)return b}return -1}function j(a,b,c,d,e){let f=b.slice(c,d),g=b.slice(d,e);a.replaceWith(c,e,g.content.append(f.content))}function k(a,b){let c=Math.max(0,Math.min(b,a.doc.content.size));a.setSelection(e.U3.near(a.doc.resolve(c)))}let l=new Set(["paragraph","bulletList","orderedList","taskList"]);function m(a,b,c){let{doc:d,selection:e}=a,h=e.$from,i=h.before(1),j=g(d),m=j.findIndex(a=>a.start===i);if(m<0)return!1;let n=m;for(;n>0&&l.has(j[n-1].node.type.name);)n--;let o=m;for(;o<j.length-1&&l.has(j[o+1].node.type.name);)o++;let p=[],q=-1,r="paragraph"===j[m].node.type.name?-1:h.index(1);for(let a=n;a<=o;a++){let b=j[a].node;if("paragraph"===b.type.name)a===m&&(q=p.length),p.push({kind:"paragraph",node:b});else{let c=b.type.name,d=0;b.forEach(b=>{a===m&&d===r&&(q=p.length),p.push({kind:c,node:b}),d++})}}if(q<0)return!1;let s=q+(c>0?1:-1);if(s<0||s>=p.length)return!1;if(b){let c,d,e,g=p[q];p[q]=p[s],p[s]=g;let i=function(a,b){let c=[],d=0;for(;d<a.length;){if("paragraph"===a[d].kind){c.push(a[d].node),d++;continue}let e=a[d].kind,f=[];for(;d<a.length&&a[d].kind===e;)f.push(a[d].node),d++;c.push(b.schema.nodes[e].create(null,f))}return f.FK.from(c)}(p,a),l=j[n].start,m=j[o].end,r=a.tr;r.replaceWith(l,m,i);let t=(c=0,d=0,e=-1,i.forEach(a=>{if(!(e>=0))if("paragraph"===a.type.name)c===s&&(e=d+1),c++,d+=a.nodeSize;else{let b=d+1;a.forEach(a=>{e>=0||(c===s&&(e=b+2),c++,b+=a.nodeSize)}),d+=a.nodeSize}}),e);k(r,t>=0?l+t+h.parentOffset:l),b(r.scrollIntoView())}return!0}function n(a,b,c){let d=a.selection.$from;if(1===d.depth&&"heading"===d.parent.type.name)return function(a,b,c){let{doc:d,selection:e}=a,f=e.$from.before(1),i=g(d),l=i.findIndex(a=>a.start===f);if(l<0)return!1;let m=i[l].node.attrs.level,n=l+1;for(;n<i.length&&!h(i[n].node,m);)n++;let o=i[l].start,p=i[n-1].end;if(c>0){if(n>=i.length)return!1;let c=i[n].node.attrs.level,f=n+1;for(;f<i.length&&!h(i[f].node,c);)f++;let g=i[f-1].end;if(b){let c=a.tr,f=d.slice(p,g).content.size;j(c,d,o,p,g),k(c,o+f+(e.from-o)),b(c.scrollIntoView())}return!0}if(0===l)return!1;let q=l-1;for(;q>=0&&!h(i[q].node,m);)q--;if(q<0||i[q].node.attrs.level<m)return!1;let r=i[q].start;if(b){let c=a.tr;j(c,d,r,o,p),k(c,r+(e.from-o)),b(c.scrollIntoView())}return!0}(a,b,c);let e=i(d);if(e>0){let f=d.node(e-1),g=d.index(e-1);return(c>0?g<f.childCount-1:g>0)?function(a,b,c,d){let{doc:e,selection:f}=a,g=f.$from,h=g.node(d),i=g.node(d-1),l=g.index(d-1),m=g.before(d),n=m+h.nodeSize;if(c>0){if(l>=i.childCount-1)return!1;let c=n+i.child(l+1).nodeSize;if(b){let d=a.tr,g=e.slice(n,c).content.size;j(d,e,m,n,c),k(d,m+g+(f.from-m)),b(d.scrollIntoView())}return!0}if(l<=0)return!1;let o=m-i.child(l-1).nodeSize;if(b){let c=a.tr;j(c,e,o,m,n),k(c,o+(f.from-m)),b(c.scrollIntoView())}return!0}(a,b,c,e):2===e&&m(a,b,c)}let f=d.depth>=1?d.node(d.depth-1).type.name:"doc";return"paragraph"===d.parent.type.name&&"doc"===f&&m(a,b,c)}function o(a,b){let{state:c}=a,d=c.selection.$from,e=d.parent.type.name;if("doc"===(d.depth>=1?d.node(d.depth-1).type.name:"doc")&&("heading"===e||"paragraph"===e)){let c=(("heading"===e?d.parent.attrs.level-1:3)+(b>0?1:-1)+4)%4;return 3===c?a.chain().setParagraph().run():a.chain().setHeading({level:c+1}).run()}let f=i(d);if(f>0){let c=d.node(f).type.name;return b<0?a.commands.liftListItem(c):a.commands.sinkListItem(c)}return!1}function p(a,b){let{state:c}=a,d=c.selection;if(!d.empty)return!1;let e=d.$from,f=b>0?1:-1;for(let b=e.depth;b>0;b--)if("taskItem"===e.node(b).type.name){let d=e.before(b),g=c.doc.nodeAt(d);if(!g)return!1;let h=g.attrs.status??"todo",i=(("doing"===h?2:"done"===h?3:1)+f+4)%4;if(0===i)return a.chain().toggleTaskList().run();let j=2===i?"doing":3===i?"done":"todo";return a.chain().command(({tr:a})=>{let b=a.doc.nodeAt(d);return!!b&&(a.setNodeMarkup(d,void 0,{...b.attrs,status:j}),!0)}).run()}if("paragraph"!==e.parent.type.name)return!1;let g=e.depth>=1?e.node(e.depth-1).type.name:"doc";return("doc"===g||"listItem"===g)&&(1==(0+f+4)%4?a.chain().toggleTaskList().run():a.chain().toggleTaskList().command(({tr:a})=>(function(a,b){let c=a.selection.$from;for(let d=c.depth;d>0;d--)if("taskItem"===c.node(d).type.name){let e=c.before(d),f=a.doc.nodeAt(e);f&&a.setNodeMarkup(e,void 0,{...f.attrs,status:b});break}return!0})(a,"done")).run())}let q=d.YY.create({name:"noteOrgKeymap",addKeyboardShortcuts(){return{"Alt-ArrowUp":()=>this.editor.commands.command(({state:a,dispatch:b})=>n(a,b,-1)),"Alt-ArrowDown":()=>this.editor.commands.command(({state:a,dispatch:b})=>n(a,b,1)),"Alt-ArrowLeft":()=>o(this.editor,-1),"Alt-ArrowRight":()=>o(this.editor,1),"Shift-ArrowRight":()=>p(this.editor,1),"Shift-ArrowLeft":()=>p(this.editor,-1)}}})},55287:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Cv:()=>C,XO:()=>A});var e=c(48249),f=c(67484),g=c(44384),h=c(74429),i=c(33281),j=c(87808),k=c(25419),l=c(7122),m=c(42140),n=c(38896),o=c(36984),p=c(41051),q=c(70596),r=c(40159),s=c(13512),t=c(9804),u=c(7833),v=c(83377),w=a([s]);s=(w.then?(await w)():w)[0];let B="white-space:pre;padding:0 12px;min-height:20px;line-height:20px";function x(a){let b=window.getSelection();if(!b?.rangeCount)return null;let c=b.getRangeAt(0),d=c.startContainer;for(;d&&d.parentElement!==a;)d=d.parentElement;if(!d)return null;let e=Array.from(a.children).indexOf(d);if(e<0)return null;let f=document.createRange();f.selectNodeContents(d),f.setEnd(c.startContainer,c.startOffset);let g=f.toString().length;return{line:e,offset:g}}function y(a,b){let c,d=a.children[b.line];if(!d)return;let e=document.createTreeWalker(d,NodeFilter.SHOW_TEXT),f=b.offset;for(;c=e.nextNode();){let a=c.textContent?.length||0;if(f<=a){let a=window.getSelection(),b=document.createRange();b.setStart(c,f),b.collapse(!0),a?.removeAllRanges(),a?.addRange(b);return}f-=a}let g=window.getSelection(),h=document.createRange();h.selectNodeContents(d),h.collapse(!1),g?.removeAllRanges(),g?.addRange(h)}function z(a){return a.map(a=>`<div style="${B}">${a}</div>`).join("")}let C=(0,f.forwardRef)(function({content:a,filePath:b,showLineNumbers:c=!0,showSearch:d=!0,className:n="",cwd:w,enableComments:A=!1,scrollToLine:C=null,scrollToLineAlign:D="center",onScrollToLineComplete:E,highlightKeyword:F=null,visibleLineRef:G,onCmdClick:H,onTokenHover:I,onTokenHoverLeave:J,onTokenHoverCancel:K,blameLines:L,inlineBlameLines:M,onSelectCommit:N,editable:O=!1,initialMtime:P,onEditorClose:Q,onSaved:R,onEditorStateChange:S,viMode:T=!1,onContentMutate:U,onEnterInsertMode:V,onViSave:W,viStateRef:X,initialCursorLine:Y,initialCursorCol:Z,onInitialCursorSet:$,onContentSearch:_},aa){let{t:ab}=(0,g.Bd)(),ac=(0,f.useRef)(a),ad=(0,f.useRef)(!1),[ae,af]=(0,f.useState)(!1),[ag,ah]=(0,f.useState)(!1),[ai,aj]=(0,f.useState)(()=>a.split("\n").length),ak=(0,f.useRef)(a.split("\n").length),[al,am]=(0,f.useState)({show:!1}),an=(0,f.useRef)(null),ao=(0,f.useRef)(null),ap=(0,f.useRef)(P),aq=(0,f.useRef)(null),ar=(0,f.useRef)(!1),as=(0,f.useRef)(!1),{parentRef:at,containerRef:au,searchInputRef:av,floatingToolbarRef:aw,suppressHoverRef:ax,bumpToolbarRef:ay,savedSelectionRef:az,highlightedLines:aA,isMounted:aB,cmdHeld:aC,flashLine:aD,isSearchVisible:aE,searchQuery:aF,caseSensitive:aG,wholeWord:aH,currentMatchIndex:aI,viewingComment:aJ,addCommentInput:aK,sendToAIInput:aL,aiBridge:aM,commentsEnabled:aN,updateComment:aO,deleteComment:aP,lines:aQ,matches:aR,rowData:aS,virtualizer:aT,commentsByEndLine:aU,linesWithComments:aV,setIsSearchVisible:aW,setSearchQuery:aX,setCaseSensitive:aY,setWholeWord:aZ,setViewingComment:a$,setAddCommentInput:a_,setSendToAIInput:a0,goToNextMatch:a1,goToPrevMatch:a2,handleSearchKeyDown:a3,handleCommentBubbleClick:a4,handleToolbarAddComment:a5,handleToolbarSendToAI:a6,handleToolbarExplain:a7,handleToolbarSearch:a8,handleCommentSubmit:a9,handleSendToAISubmit:ba,handleCommentSendToAI:bb,getHighlightedLineHtml:bc,suppressMatchScrollRef:bd,inlineBlameLineRef:be,inlineBlameVersion:bf}=(0,s.d)({content:a,filePath:b,showSearch:d,cwd:w,enableComments:!O&&A,scrollToLine:O?null:C,scrollToLineAlign:O?"center":D,onScrollToLineComplete:O?void 0:E,visibleLineRef:O?void 0:G,onContentSearch:_}),bg=(0,l.iN)(),bh=(0,f.useRef)(null),bi=(0,f.useRef)(null),bj=(0,f.useRef)({line:0,col:0}),bk=(0,f.useRef)({line:0,col:0}),bl=(0,v.A)({lines:aQ,enabled:T&&!O,onContentChange:a=>{bj.current={line:bk.current.line,col:bk.current.col},U?.(a)},onEnterInsert:(a,b,c)=>{let d=b;if("a"===c)d=b+1;else if("A"===c)d=(aQ[a]??"").length;else if("I"===c){let b=(aQ[a]??"").search(/\S/);d=b>=0?b:0}else("o"===c||"O"===c)&&(d=0);bj.current={line:a,col:d},V?.(a)},onSave:W,getVisibleLineCount:()=>{let a=at.current;return a?Math.floor(a.clientHeight/20):20},scrollToLine:(a,b)=>{let c=aS.findIndex(b=>"code"===b.type&&b.lineIndex===a);c>=0&&aT.scrollToIndex(c,{align:b||"auto"})},onSearchExecute:a=>{aX(a),aW(!1)},onSearchNext:a1,onSearchPrev:a2,onSearchClear:()=>{aX("")}});(0,f.useEffect)(()=>{X&&(X.current={cursorLine:bl.state.cursorLine,cursorCol:bl.state.cursorCol}),bk.current={line:bl.state.cursorLine,col:bl.state.cursorCol}},[X,bl.state.cursorLine,bl.state.cursorCol]);let bm=(0,f.useRef)(null);(0,f.useEffect)(()=>{T&&!O&&null!=Y&&b&&bm.current!==b&&(bm.current=b,bl.setCursorLine(Y-1),null!=Z&&bl.setCursorCol(Z-1),$?.())},[T,O,Y,Z,b]),(0,f.useEffect)(()=>{if(!T||O)return;let a=au.current;if(!a)return;let b=a=>{let b=a.target;"TEXTAREA"===b.tagName||"INPUT"===b.tagName||b.isContentEditable||bl.handleKeyDown(a)&&(a.preventDefault(),a.stopPropagation())};return a.addEventListener("keydown",b,!0),()=>a.removeEventListener("keydown",b,!0)},[T,O,bl.handleKeyDown]),(0,f.useEffect)(()=>{if(!T||O)return;let a=au.current;a&&"normal"===bl.state.mode&&requestAnimationFrame(()=>{let b=document.activeElement;b&&("TEXTAREA"===b.tagName||"INPUT"===b.tagName||b.isContentEditable)||a.focus()})},[T,O,bl.state.mode,a]);let bn=(0,f.useCallback)(a=>{if(!T||O)return;let b=a.target.closest("[data-line]");if(b){let c=parseInt(b.getAttribute("data-line"),10);if(!isNaN(c)){bl.setCursorLine(c-1);let d=b.querySelector("[data-code-content]");if(d){let b=document.caretRangeFromPoint(a.clientX,a.clientY);if(b&&d.contains(b.startContainer)){let a,e=document.createTreeWalker(d,NodeFilter.SHOW_TEXT),f=0;for(;a=e.nextNode();){if(a===b.startContainer){f+=b.startOffset;break}f+=a.textContent?.length||0}let g=aQ[c-1]??"";bl.setCursorCol(Math.max(0,Math.min(f,Math.max(0,g.length-1))))}}}}let c=a.target;if("TEXTAREA"===c.tagName||"INPUT"===c.tagName||c.isContentEditable)return;let d=au.current;d&&d.focus()},[T,O,bl.setCursorLine,bl.setCursorCol,aQ]),bo=(0,f.useCallback)(a=>{T&&!O&&requestAnimationFrame(()=>{let a=window.getSelection(),b=a?.toString().trim();b&&/^\S+$/.test(b)&&(bd.current=!0,aX(b))})},[T,O,aX,bd]);(0,f.useEffect)(()=>{"command"===bl.state.mode?setTimeout(()=>bh.current?.focus(),0):"search"===bl.state.mode&&setTimeout(()=>bi.current?.focus(),0)},[bl.state.mode]),(0,f.useEffect)(()=>{let a=at.current;if(!a)return;let b=()=>{(K??J)?.()};return a.addEventListener("mousedown",b),()=>a.removeEventListener("mousedown",b)},[K,J]),(0,f.useEffect)(()=>{aK||aL?(ax.current=!0,J?.()):aw.current||(ax.current=!1)},[aK,aL,J]),(0,f.useLayoutEffect)(()=>{let a=az.current;if(!a)return;let b=window.getSelection();if(b&&!b.isCollapsed)return;let c=at.current;if(!c)return;let d=c.querySelector(`[data-line="${a.startLine}"]`),e=c.querySelector(`[data-line="${a.endLine}"]`);if(!d||!e)return;let f=(0,s.o)(d,a.startOffset),g=(0,s.o)(e,a.endOffset);if(f&&g)try{let a=document.createRange();a.setStart(f.node,f.offset),a.setEnd(g.node,g.offset),b?.removeAllRanges(),b?.addRange(a)}catch{}});let bp=(0,f.useCallback)((a,b,c)=>{ax.current||I?.(a,b,c)},[I]),bq=(0,f.useCallback)((a,b)=>{ax.current||H?.(a,b)},[H]),br=Math.max(4,String(O?ai:aQ.length).length),bs=(0,f.useMemo)(()=>{let a=0;for(let b of aQ){let c=0;for(let a=0;a<b.length;a++)" "===b[a]?c+=2-c%2:c+=1;c>a&&(a=c)}return a},[aQ]);(0,f.useEffect)(()=>{if(O){ac.current=a;let b=a.split("\n").length;ak.current=b,aj(b),ad.current=!1,af(!1),am({show:!1}),ap.current=P}},[O,a,P]),(0,f.useEffect)(()=>{if(!O)return;let b=an.current;if(!b)return;let c=a.split("\n"),d=c.map((a,b)=>aA[b]||(0,o.ZD)(a||" "));b.innerHTML=z(d),requestAnimationFrame(()=>{let a,d;T?(a=Math.max(0,Math.min(bj.current.line,c.length-1)),d=bj.current.col):(a=Math.max(0,Math.min((G?.current??1)-1,c.length-1)),d=0),b.focus(),y(b,{line:a,offset:d});let e=G?.current??1;ao.current&&(ao.current.scrollTop=(e-1)*20)})},[O]),(0,f.useEffect)(()=>{O&&S?.({isDirty:ae,isSaving:ag})},[O,ae,ag,S]);let bt=(0,f.useCallback)(()=>{let a=an.current;if(!a)return ac.current;let b=[];for(let c of a.childNodes){let a=c.textContent||"";b.push(" "===a?"":a)}return b.join("\n")},[]),bu=(0,f.useCallback)(()=>{aq.current&&clearTimeout(aq.current),aq.current=setTimeout(async()=>{let a=an.current;if(a&&!as.current){ac.current=bt();try{let c=await (0,o.kS)(),d=(0,o.sQ)(b),e=document.documentElement.classList.contains("dark"),f=ac.current.split("\n"),g=c.codeToTokens(f.join("\n"),{lang:d,theme:e?"github-dark":"github-light"}).tokens.map(a=>(0,o.b8)(a)),h=x(a);ar.current=!0,a.innerHTML=z(g),ar.current=!1,h&&y(a,h)}catch{}}},300)},[b,bt]);(0,f.useEffect)(()=>{if(O)return()=>{aq.current&&clearTimeout(aq.current)}},[O]);let bv=(0,f.useCallback)(()=>{let a=an.current;if(!a)return;ad.current||(ad.current=!0,af(!0));let b=a.children.length;b!==ak.current&&(ak.current=b,aj(b))},[]),bw=(0,f.useCallback)(()=>{ar.current||as.current||(bv(),bu())},[bv,bu]),bx=(0,f.useCallback)(a=>{if(!a.nativeEvent.isComposing&&("Tab"===a.key&&(a.preventDefault(),document.execCommand("insertText",!1," ")),"Enter"===a.key)){a.preventDefault();let b=an.current;if(!b)return;let c=window.getSelection();if(!c?.rangeCount)return;let d=c.getRangeAt(0);d.deleteContents();let e=d.startContainer;for(;e&&e.parentElement!==b;)e=e.parentElement;if(!e||!(e instanceof HTMLElement))return;let f=x(b),g=Array.from(b.children).indexOf(e),h=e.textContent||"",i=f?.offset??h.length,j=h.substring(0,i),k=h.substring(i);e.innerHTML=(0,o.ZD)(j||" ");let l=document.createElement("div");l.setAttribute("style",B),l.innerHTML=(0,o.ZD)(k||" "),e.after(l),y(b,{line:g+1,offset:0}),bv(),bu()}},[bv,bu]),by=(0,f.useCallback)(a=>{a.preventDefault();let b=a.clipboardData.getData("text/plain");document.execCommand("insertText",!1,b)},[]),bz=(0,f.useCallback)(async(a=!1)=>{if(!w)return;ac.current=bt(),ah(!0);let c=await i.t4.runPromiseExit((0,j.OJ)({cwd:w,path:b,content:ac.current,expectedMtime:a?void 0:ap.current}));if("Failure"===c._tag){console.error("Error saving file:",c.cause),(0,u.oR)(ab("toast.saveFailed"),"error"),ah(!1);return}let d=c.value,e=d.data;if(409===d.status&&e?.conflict){let a=await i.t4.runPromiseExit((0,k.K)(w,b));"Success"===a._tag&&a.value.ok&&"string"==typeof a.value.data?.content?am({show:!0,diskContent:a.value.data.content}):am({show:!0}),ah(!1);return}if(!d.ok){console.error("Error saving file: status",d.status),(0,u.oR)(ab("toast.saveFailed"),"error"),ah(!1);return}let f=e?.mtime;f&&(ap.current=f),ad.current=!1,af(!1),am({show:!1}),(0,u.oR)(ab("toast.savedSuccess"),"success"),R?.(),ah(!1)},[w,b,bt,R,ab]),bA=(0,f.useCallback)(async()=>{ae&&!ag&&await bz(!1)},[ae,ag,bz]),bB=(0,f.useCallback)(async()=>{am({show:!1}),await bz(!0)},[bz]),bC=(0,f.useCallback)(()=>{if(void 0!==al.diskContent){ac.current=al.diskContent;let b=al.diskContent.split("\n").length;ak.current=b,aj(b);let c=al.diskContent!==a;ad.current=c,af(c);let d=an.current;if(d){let a=al.diskContent.split("\n");d.innerHTML=z(a.map(a=>(0,o.ZD)(a||" "))),bu()}}am({show:!1}),R?.()},[al.diskContent,a,R,bu]),bD=(0,f.useCallback)(()=>{let a=ao.current;return a?Math.floor(a.scrollTop/20)+1:G?.current??1},[G]),bE=(0,f.useCallback)(async()=>{(!ae||await (0,u.lJ)(ab("codeViewer.unsavedConfirm"),{danger:!0,confirmText:ab("codeViewer.discardChanges"),cancelText:ab("codeViewer.continueEditing")}))&&Q?.(bD())},[ae,Q,bD]);(0,f.useEffect)(()=>{if(!O)return;let a=a=>{(a.metaKey||a.ctrlKey)&&"s"===a.key&&(a.preventDefault(),bA())};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[O,bA]);let bF=(0,f.useCallback)(()=>{let a=bt();U?.(a);let b=an.current,c=b?x(b):null,d=bD();if(bl.enterNormal(),c){bl.setCursorLine(c.line);let b=a.split("\n")[c.line]??"";bl.setCursorCol(Math.max(0,Math.min(c.offset,Math.max(0,b.length-1))))}else bl.setCursorLine(Math.max(0,d-1));Q?.(d)},[bt,U,bD,Q,bl]);(0,f.useEffect)(()=>{if(!O)return;let a=a=>{let b="Escape"===a.key,c=a.ctrlKey&&"c"===a.key&&!a.metaKey&&!a.shiftKey;(b||T&&c)&&(a.preventDefault(),a.stopPropagation(),T?ad.current?(0,u.lJ)(ab("codeViewer.unsavedExitConfirm"),{danger:!0,confirmText:ab("codeViewer.discardChanges"),cancelText:ab("codeViewer.continueEditing")}).then(a=>{a&&bF()}):bF():bE())};return document.addEventListener("keydown",a,!0),()=>document.removeEventListener("keydown",a,!0)},[O,T,bE,bF]);let bG=(0,f.useCallback)(()=>{ad.current||(ad.current=!0,af(!0))},[]);(0,f.useImperativeHandle)(aa,()=>({save:bA,close:bE,markDirty:bG,get isDirty(){return ad.current},get isSaving(){return ag}}),[bA,bE,bG,ag]);let bH=!!(L&&L.length>0),bI=(0,f.useMemo)(()=>{if(!L)return new Map;let a=[...new Set(L.map(a=>a.author))],b=new Map;return a.forEach((a,c)=>{b.set(a,r.j[c%r.j.length])}),b},[L]),[bJ,bK]=(0,f.useState)(null),[bL,bM]=(0,f.useState)(null);(0,f.useEffect)(()=>{bK(null),bM(null)},[L]);let bN=(0,f.useCallback)((a,b)=>{bK(a.author);let c=b.currentTarget.getBoundingClientRect();bM({line:a,x:c.right+8,y:c.top})},[]),bO=(0,f.useCallback)(()=>{bK(null),bM(null)},[]),bP=(0,f.useCallback)(a=>{if(!N)return;let b={hash:a.hashFull,shortHash:a.hash,author:a.author,authorEmail:a.authorEmail,date:new Date(1e3*a.time).toISOString(),subject:a.message.split("\n")[0]||"",body:a.message.split("\n").slice(1).join("\n").trim(),time:a.time};N(b),bM(null)},[N]),bQ=`${br+2}ch`;return(0,e.jsxs)("div",{ref:au,className:`h-full flex flex-col outline-none ${n}`,tabIndex:0,onClick:bn,onDoubleClick:bo,children:[O&&al.show&&(0,e.jsxs)("div",{className:"px-4 py-2 bg-amber-500/15 border-b border-amber-500/30 flex items-center gap-3 flex-shrink-0",children:[(0,e.jsx)("svg",{className:"w-5 h-5 text-amber-11 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z"})}),(0,e.jsx)("span",{className:"text-sm text-foreground flex-1",children:ab("codeViewer.fileModifiedExternally")}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("button",{onClick:bC,className:"px-3 py-1 text-sm rounded border border-border hover:bg-hover transition-colors",children:ab("codeViewer.useDiskVersion")}),(0,e.jsx)("button",{onClick:bB,className:"px-3 py-1 text-sm rounded bg-amber-500 text-white hover:bg-amber-600 transition-colors",children:ab("codeViewer.forceOverwrite")})]})]}),!O&&d&&aE&&(0,e.jsxs)("div",{className:"flex-shrink-0 flex items-center gap-2 px-3 py-2 border-b border-border",children:[(0,e.jsx)("input",{ref:av,type:"text",value:aF,onChange:a=>aX(a.target.value),onKeyDown:a3,placeholder:ab("codeViewer.searchPlaceholder"),className:"flex-1 max-w-xs px-2 py-1 text-sm border border-border rounded bg-card text-foreground focus:outline-none focus:ring-2 focus:ring-ring"}),(0,e.jsx)("button",{onClick:()=>aY(!aG),className:`px-2 py-1 text-xs font-mono rounded border transition-colors ${aG?"bg-brand text-white border-brand":"border-border text-muted-foreground hover:bg-hover"}`,title:ab("codeViewer.caseSensitive"),children:"Aa"}),(0,e.jsx)("button",{onClick:()=>aZ(!aH),className:`px-2 py-1 text-xs font-mono rounded border transition-colors ${aH?"bg-brand text-white border-brand":"border-border text-muted-foreground hover:bg-hover"}`,title:ab("codeViewer.wholeWordMatch"),children:"[ab]"}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:aR.length>0?`${aI+1}/${aR.length}`:ab("common.noMatch")}),(0,e.jsx)("button",{onClick:a2,disabled:0===aR.length,className:"p-1 rounded hover:bg-hover disabled:opacity-50",title:ab("common.previous"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 15l7-7 7 7"})})}),(0,e.jsx)("button",{onClick:a1,disabled:0===aR.length,className:"p-1 rounded hover:bg-hover disabled:opacity-50",title:ab("common.next"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})}),(0,e.jsx)("button",{onClick:()=>{aW(!1),aX("")},className:"p-1 rounded hover:bg-hover",title:ab("common.close"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),O?(0,e.jsx)("div",{ref:ao,className:"flex-1 overflow-auto bg-card",children:(0,e.jsxs)("div",{className:"flex",style:{minHeight:"100%"},children:[(0,e.jsx)("div",{className:"flex-shrink-0 font-mono text-sm select-none sticky left-0 z-[2] bg-card",style:{width:bQ},children:Array.from({length:ai},(a,b)=>(0,e.jsx)("div",{className:"text-right text-muted-foreground/50 pr-3",style:{height:20,lineHeight:"20px"},children:b+1},b))}),(0,e.jsx)("div",{ref:an,contentEditable:!0,suppressContentEditableWarning:!0,onInput:bw,onKeyDown:bx,onPaste:by,onCompositionStart:()=>{as.current=!0},onCompositionEnd:()=>{as.current=!1,bw()},spellCheck:!1,autoCorrect:"off",autoCapitalize:"off",className:"flex-1 font-mono text-sm outline-none",style:{caretColor:"var(--foreground)",tabSize:2}})]})}):(0,e.jsx)("div",{ref:at,className:`flex-1 overflow-auto font-mono text-sm bg-card${aC?" cmd-held-container":""}`,children:(0,e.jsx)("div",{style:{height:`${aT.getTotalSize()}px`,minWidth:"100%",width:bH?`calc(${br+bs+10}ch + 13rem)`:`${br+bs+10}ch`,position:"relative"},children:aT.getVirtualItems().map(a=>{let b=aS[a.index];if("code"!==b.type)return null;let d=b.lineIndex,f=d+1,g=aA[d]||(0,o.ZD)(aQ[d]||""),h=bc(d,g,F),i=aV.has(f),j=aU.get(f),k=j?.[0],l=!!(aK&&f>=aK.range.start&&f<=aK.range.end),m=bf>=0?be.current:null,n=!O&&M&&m===f?M[d]??null:null,p=bH?L[d]:void 0,q=bH&&d>0?L[d-1]:void 0,s=!!p&&(!q||q.hash!==p.hash),t=p?bI.get(p.author):void 0;return(0,e.jsx)(r.S,{virtualKey:a.key,lineNum:f,highlightedHtml:h,hasComments:i,firstComment:k,lineCommentsCount:j?.length,isInRange:l,showLineNumbers:c,lineNumChars:br,commentsEnabled:aN,virtualItemSize:a.size,virtualItemStart:a.start,onCommentBubbleClick:a4,onCmdClick:bq,onTokenHover:bp,onTokenHoverLeave:J,flashLine:aD,blameLine:p,showBlameInfo:s,blameAuthorColor:t,isBlameHovered:!!(p&&bJ===p.author),onBlameClick:bP,onBlameMouseEnter:bN,onBlameMouseLeave:bO,inlineBlameData:n,onInlineBlameClick:bP,isCursorLine:T&&!O&&bl.state.cursorLine===d,cursorCol:T&&!O&&bl.state.cursorLine===d?bl.state.cursorCol:void 0},a.key)})})}),T&&(0,e.jsxs)("div",{className:"vi-status-bar flex-shrink-0 h-6 bg-card border-t border-border flex items-center px-3 text-xs font-mono select-none",children:["normal"===bl.state.mode&&(0,e.jsx)("span",{className:"text-green-11 font-medium",children:"NORMAL"}),"insert"===bl.state.mode&&(0,e.jsx)("span",{className:"text-blue-11 font-medium",children:"INSERT"}),"command"===bl.state.mode&&(0,e.jsxs)("div",{className:"flex items-center flex-1",children:[(0,e.jsx)("span",{className:"text-foreground",children:":"}),(0,e.jsx)("input",{ref:bh,value:bl.state.commandInput,onChange:a=>bl.setCommandInput(a.target.value),onKeyDown:a=>{if(a.nativeEvent.isComposing)return;let b=a.ctrlKey&&"c"===a.key&&!a.metaKey&&!a.shiftKey;("Enter"===a.key||"Escape"===a.key||b)&&(a.preventDefault(),a.stopPropagation(),bl.handleKeyDown(a.nativeEvent))},className:"flex-1 bg-transparent outline-none text-foreground ml-0.5",spellCheck:!1,autoComplete:"off"})]}),"search"===bl.state.mode&&(0,e.jsxs)("div",{className:"flex items-center flex-1",children:[(0,e.jsx)("span",{className:"text-foreground",children:"/"}),(0,e.jsx)("input",{ref:bi,value:bl.state.searchInput,onChange:a=>bl.setSearchInput(a.target.value),onKeyDown:a=>{if(a.nativeEvent.isComposing)return;let b=a.ctrlKey&&"c"===a.key&&!a.metaKey&&!a.shiftKey;("Enter"===a.key||"Escape"===a.key||b)&&(a.preventDefault(),a.stopPropagation(),bl.handleKeyDown(a.nativeEvent))},className:"flex-1 bg-transparent outline-none text-foreground ml-0.5",spellCheck:!1,autoComplete:"off"})]}),bl.state.keyBuffer&&"normal"===bl.state.mode&&(0,e.jsx)("span",{className:"ml-2 text-muted-foreground",children:bl.state.keyBuffer}),bl.state.isDirty&&("normal"===bl.state.mode||"command"===bl.state.mode)&&(0,e.jsx)("span",{className:"ml-2 text-amber-11",children:"[+]"}),(0,e.jsxs)("span",{className:"ml-auto text-muted-foreground",children:[bl.state.cursorLine+1,":",bl.state.cursorCol+1]})]}),aB&&bg&&(0,h.createPortal)((0,e.jsxs)(e.Fragment,{children:[!O&&(0,e.jsx)(p.fS,{floatingToolbarRef:aw,bumpRef:ay,container:bg,onAddComment:a5,onSendToAI:a6,onSearch:_?a8:void 0,onExplain:aM?a7:void 0,isChatLoading:aM?.isLoading}),!O&&aK&&(0,e.jsx)(m.t,{x:aK.x,y:aK.y,range:aK.range,filePath:b,lineSnapshot:aK.lineSnapshot,container:bg,onSubmit:a9,onSendToAI:aM?bb:void 0,onClose:()=>a_(null),isChatLoading:aM?.isLoading}),!O&&aL&&(0,e.jsx)(m.G,{x:aL.x,y:aL.y,range:aL.range,filePath:b,lineSnapshot:aL.lineSnapshot,container:bg,onSubmit:ba,onClose:()=>a0(null),isChatLoading:aM?.isLoading}),!O&&aJ&&(0,e.jsx)(q.t,{x:aJ.x,y:aJ.y,comment:aJ.comment,container:bg,onClose:()=>a$(null),onUpdateComment:aO,onDeleteComment:aP}),bL&&(0,e.jsxs)("div",{className:"fixed z-50 bg-card border border-border rounded-lg shadow-lv2 p-3 max-w-lg",style:{left:Math.min(bL.x,window.innerWidth-450),top:Math.max(8,Math.min(bL.y,window.innerHeight-200))},children:[(0,e.jsxs)("div",{className:"flex items-start gap-3",children:[(0,e.jsx)("div",{className:"px-2 py-0.5 rounded text-xs font-mono font-medium text-white flex-shrink-0",style:{backgroundColor:bI.get(bL.line.author)?.border||"#666"},children:bL.line.hash}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsx)("div",{className:"text-sm font-medium text-foreground",children:bL.line.author}),(0,e.jsx)("div",{className:"text-xs text-muted-foreground",children:bL.line.authorEmail})]})]}),(0,e.jsx)("div",{className:"mt-2 text-sm text-foreground whitespace-pre-wrap max-h-48 overflow-y-auto",children:bL.line.message}),(0,e.jsxs)("div",{className:"mt-2 text-xs text-muted-foreground border-t border-border pt-2",children:[(0,t.fw)(bL.line.time)," \xb7 ",new Date(1e3*bL.line.time).toLocaleString(),(0,e.jsx)("span",{className:"ml-2 text-brand",children:ab("codeViewer.clickToViewDetails")})]})]})]}),bg)]})});function A({content:a,filePath:b,className:c=""}){let d=(0,f.useMemo)(()=>a.split("\n"),[a]),g=(0,n.C)(d,b),h=Math.max(4,String(d.length).length);return(0,e.jsx)("pre",{className:`overflow-auto text-sm font-mono bg-muted p-2 ${c}`,children:d.map((a,b)=>(0,e.jsxs)("div",{className:"flex",children:[(0,e.jsx)("span",{className:"text-foreground-subtle select-none pr-4 text-right",style:{minWidth:`${h+2}ch`},children:b+1}),(0,e.jsx)("span",{className:"flex-1",dangerouslySetInnerHTML:{__html:g[b]||(0,o.ZD)(a||" ")}})]},b))})}d()}catch(a){d(a)}})},55632:(a,b,c)=>{"use strict";c.d(b,{EmptyState:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call EmptyState() from the server but EmptyState is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/EmptyState.tsx","EmptyState")},56444:(a,b,c)=>{"use strict";c.d(b,{$H:()=>i});var d=c(32891),e=c(6993);let f={todo:"doing",doing:"done",done:"todo"},g={todo:"false",doing:"mixed",done:"true"},h=/^\s*(\[([ x/])?\])\s$/,i=e.L.extend({addAttributes:()=>({status:{default:"todo",keepOnSplit:!1,parseHTML:a=>(function(a){let b=a.getAttribute("data-status");if("todo"===b||"doing"===b||"done"===b)return b;let c=a.getAttribute("data-checked");return""===c||"true"===c?"done":"todo"})(a),renderHTML:a=>({"data-status":a.status,"data-checked":"done"===a.status?"true":"false"})}}),addStorage:()=>({markdown:{serialize(a,b){var c;a.write(`${"done"===(c=b.attrs.status)?"[x]":"doing"===c?"[/]":"[ ]"} `),a.renderContent(b)}}}),addInputRules(){return[(0,d.tG)({find:h,type:this.type,getAttributes:a=>{let b=a[a.length-1];return{status:"x"===b?"done":"/"===b?"doing":"todo"}}})]},renderHTML({HTMLAttributes:a}){return["li",(0,d.KV)(this.options.HTMLAttributes,a,{"data-type":this.name}),0]},addNodeView(){return({node:a,getPos:b,editor:c})=>{let d=document.createElement("li");d.setAttribute("data-type",this.name);let e=document.createElement("label");e.classList.add("task-marker"),e.contentEditable="false";let h=document.createElement("span");h.classList.add("task-marker-box"),h.setAttribute("role","checkbox"),e.appendChild(h);let i=document.createElement("div");d.append(e,i);let j=a=>{let b=a.attrs.status??"todo";d.dataset.status=b,d.dataset.checked="done"===b?"true":"false",h.setAttribute("aria-checked",g[b])};return j(a),e.addEventListener("mousedown",a=>a.preventDefault()),e.addEventListener("click",a=>{if(a.preventDefault(),!c.isEditable||"function"!=typeof b)return;let d=b();"number"==typeof d&&c.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:a})=>{let b=a.doc.nodeAt(d);if(!b)return!1;let c=b.attrs.status??"todo";return a.setNodeMarkup(d,void 0,{...b.attrs,status:f[c]}),!0}).run()}),{dom:d,contentDOM:i,update:b=>b.type===a.type&&(j(b),!0)}}}})},57014:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{m:()=>x});var e=c(48249),f=c(67484),g=c(44384),h=c(7833),i=c(35208),j=c(74691),k=c(60333),l=c(73887),m=c(39238),n=c(60591),o=c(18921),p=c(72529),q=c(85984),r=c(65543),s=c(25667),t=c(53036),u=c(88018),v=c(9804),w=a([s,i,l,m]);[s,i,l,m]=w.then?(await w)():w;let y=(a,b,c)=>`/api/git/blob?cwd=${encodeURIComponent(a)}&rev=${encodeURIComponent(b)}&file=${encodeURIComponent(c)}`;function x({cwd:a,selected:b,diff:c,showMarkdownPreview:d,setShowMarkdownPreview:w,changedFiles:z,fileGitStatusMap:A,onContentSearch:B,locateInTree:C,jsonPreview:D,setJsonPreview:E,jsonPreviewSearch:F,jsonPreviewPreRef:G,onTokenHover:H,onTokenHoverLeave:I,onTokenHoverCancel:J}){let{t:K}=(0,g.Bd)(),L="unstaged"===b.type?{onTokenHover:H,onTokenHoverLeave:I,onTokenHoverCancel:J}:{},[M,N]=(0,f.useState)(!1),[O,P]=(0,f.useState)("file"),[Q,R]=(0,f.useState)("compact"),[S,T]=(0,f.useState)("unified"),U=b.file.path,V=b.file.oldPath||U,W=(0,v.u)(U),X=U.startsWith("/")?U:a?`${a.replace(/\/$/,"")}/${U}`:U,{state:Y}=(0,q.V)(a,U),Z=(0,f.useMemo)(()=>{if("ready"===Y.state)return Y.data.functions.filter(r._).map(a=>({name:a.name,startLine:a.startLine,endLine:a.endLine,params:a.params}))},[Y]);return(0,e.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[W||"map"!==O?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"px-4 py-2 border-b border-border flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-xs font-mono text-muted-foreground",children:U}),(0,e.jsx)(p.m,{content:K("common.copyAbsPath"),children:(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),navigator.clipboard.writeText(`${a}/${U}`),(0,h.oR)(K("common.copiedPath"))},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-hover transition-colors flex-shrink-0",children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})}),(0,e.jsx)(p.m,{content:K("fileBrowser.locateInTree"),children:(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),C(U)},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-hover transition-colors flex-shrink-0",children:(0,e.jsxs)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,e.jsx)("circle",{cx:"12",cy:"12",r:"10",strokeWidth:2}),(0,e.jsx)("circle",{cx:"12",cy:"12",r:"3",strokeWidth:2}),(0,e.jsx)("path",{strokeLinecap:"round",strokeWidth:2,d:"M12 2v4m0 12v4M2 12h4m12 0h4"})]})})}),(0,e.jsx)("span",{className:`text-xs px-1.5 py-0.5 rounded ${"staged"===b.type?"bg-green-9/15 text-green-11 dark:bg-green-9/25":"bg-amber-9/15 text-amber-11 dark:bg-amber-9/25"}`,children:"staged"===b.type?K("fileBrowser.staged"):K("fileBrowser.unstaged")}),(0,e.jsx)("div",{className:"flex-1"}),!W&&(0,e.jsx)(j.y,{value:Q,onChange:R}),!W&&"file"===O&&(0,e.jsx)(k.q,{value:S,onChange:T}),!W&&(0,e.jsx)("div",{className:"flex items-center gap-0.5 rounded border border-border overflow-hidden",children:["file","map"].map(a=>(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),P(a)},className:`px-2 py-0.5 text-xs transition-colors ${O===a?"bg-brand text-white":"text-muted-foreground hover:bg-hover"}`,children:K("file"===a?"common.file":"common.codeMap")},a))})]}),(0,e.jsx)("div",{className:"flex-1 overflow-auto",children:W?(0,e.jsx)(u.K,{filePath:U,oldSrc:c.isNew?null:y(a,"staged"===b.type?"HEAD":":0","staged"===b.type?V:U),newSrc:c.isDeleted||"staged"!==b.type?null:y(a,":0",U),newNode:c.isDeleted||"staged"===b.type?void 0:(0,e.jsx)(t.I,{cwd:a,path:U,className:"flex items-center justify-center",imgClassName:"max-w-full max-h-[60vh] object-contain",alt:U})}):"unified"===S?(0,e.jsx)(i.xU,{oldContent:c.oldContent,newContent:c.newContent,filePath:c.filePath,cwd:a,enableComments:!0,compact:"compact"===Q,onPreview:!c.isDeleted&&(0,n.e$)(U)?()=>w(!0):!c.isDeleted&&(0,n.aR)(U)?()=>N(!0):!c.isDeleted&&U.endsWith(".json")?()=>E({content:c.newContent,filePath:c.filePath}):void 0,previewLabel:U.endsWith(".json")?K("common.readable"):K("common.preview"),onContentSearch:B,...L}):(0,e.jsx)(i.xZ,{oldContent:c.oldContent,newContent:c.newContent,filePath:c.filePath,isNew:c.isNew,isDeleted:c.isDeleted,cwd:a,enableComments:!0,compact:"compact"===Q,symbols:Z,onPreview:!c.isDeleted&&(0,n.e$)(U)?()=>w(!0):!c.isDeleted&&(0,n.aR)(U)?()=>N(!0):!c.isDeleted&&U.endsWith(".json")?()=>E({content:c.newContent,filePath:c.filePath}):void 0,previewLabel:U.endsWith(".json")?K("common.readable"):K("common.preview"),onContentSearch:B,...L})})]}):(0,e.jsx)(s.r,{cwd:a,filePath:c.filePath,oldContent:c.oldContent,newContent:c.newContent,isNew:c.isNew,isDeleted:c.isDeleted,changedFiles:z,fileGitStatusMap:A,enableComments:!0,compact:"compact"===Q,onContentSearch:B,headerExtraLeft:({focalFile:b})=>{if(!b)return null;let c=A.get(b);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(p.m,{content:K("common.copyAbsPath"),children:(0,e.jsx)("button",{onClick:c=>{c.stopPropagation(),navigator.clipboard.writeText(`${a}/${b}`),(0,h.oR)(K("common.copiedPath"))},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-hover transition-colors flex-shrink-0",children:(0,e.jsx)("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})}),(0,e.jsx)(p.m,{content:K("fileBrowser.locateInTree"),children:(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),C(b)},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-hover transition-colors flex-shrink-0",children:(0,e.jsxs)("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,e.jsx)("circle",{cx:"12",cy:"12",r:"10",strokeWidth:2}),(0,e.jsx)("circle",{cx:"12",cy:"12",r:"3",strokeWidth:2}),(0,e.jsx)("path",{strokeLinecap:"round",strokeWidth:2,d:"M12 2v4m0 12v4M2 12h4m12 0h4"})]})})}),c&&(0,e.jsx)("span",{className:`text-[10px] px-1.5 py-0.5 rounded flex-shrink-0 ${"staged"===c?"bg-green-9/15 text-green-11 dark:bg-green-9/25":"bg-amber-9/15 text-amber-11 dark:bg-amber-9/25"}`,children:"staged"===c?K("fileBrowser.staged"):K("fileBrowser.unstaged")})]})},headerExtraRight:()=>(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(j.y,{value:Q,onChange:R}),(0,e.jsx)("div",{className:"flex items-center gap-0.5 rounded border border-border overflow-hidden",children:["file","map"].map(a=>(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),P(a)},className:`px-2 py-0.5 text-[11px] transition-colors ${O===a?"bg-brand text-white":"text-muted-foreground hover:bg-hover"}`,children:K("file"===a?"common.file":"common.codeMap")},a))})]})}),d&&(0,e.jsx)("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-scrim",onClick:()=>w(!1),children:(0,e.jsx)("div",{className:"bg-card rounded-lg shadow-lv3 w-full max-w-[90%] h-full flex flex-col",onClick:a=>a.stopPropagation(),children:(0,e.jsx)(l.M,{content:c.newContent,filePath:c.filePath,cwd:a,onClose:()=>w(!1)})})}),M&&(0,e.jsx)(m.N,{filePath:X,content:c.newContent,cwd:a,onClose:()=>N(!1)}),D&&(0,e.jsx)("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-scrim",onClick:()=>E(null),children:(0,e.jsxs)("div",{className:"bg-card rounded-lg shadow-lv3 w-full max-w-[90%] h-[90%] flex flex-col",onClick:a=>a.stopPropagation(),children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border flex-shrink-0",children:[(0,e.jsx)("span",{className:"text-sm text-muted-foreground font-mono truncate",children:D.filePath}),(0,e.jsx)("button",{onClick:()=>E(null),className:"p-1 text-muted-foreground hover:text-foreground hover:bg-hover rounded transition-colors",children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsx)(o._,{search:F}),(0,e.jsx)("div",{className:"flex-1 overflow-auto px-6 py-4 bg-secondary",children:(0,e.jsx)("pre",{ref:G,className:"whitespace-pre-wrap break-words font-mono text-foreground",style:{fontSize:"0.8125rem",lineHeight:"1.5"},children:(0,n.xb)(D.content)})})]})})]})}d()}catch(a){d(a)}})},57031:(a,b,c)=>{"use strict";c.d(b,{F:()=>g});var d=c(79606),e=c(23734),f=c(33281);let g=(a,b)=>{f.t4.runFork(d.flatMap(e.d,c=>c.publish(a,b)))}},57063:(a,b,c)=>{"use strict";function d(){"u">typeof document&&document.activeElement instanceof HTMLElement&&document.activeElement.blur()}function e(a,b=!0){}c.d(b,{E:()=>e,k:()=>d}),c(67484)},57632:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{e$:()=>I,vP:()=>E,zB:()=>J});var e=c(48249),f=c(67484),g=c(44384),h=c(79606),i=c(87819);c(57063);var j=c(7122),k=c(44256),l=c(67216),m=c(46674),n=c(145),o=c(20586),p=c(74691),q=c(60333),r=c(88018),s=c(35208),t=c(60591),u=c(73887),v=c(39238),w=c(18479),x=c(15578),y=c(39247),z=a([s,u,v]);[s,u,v]=z.then?(await z)():z;let K=(a,b,c)=>`/api/snapshots/blob?cwd=${encodeURIComponent(a)}&rev=${encodeURIComponent(b)}&file=${encodeURIComponent(c)}`;function A(a){return a.fullSubject||a.subject}function B(a,b,c){let d=A(a),e=d.split("\n"),f=e.length>c?e.slice(0,c).join("\n"):d,g=f.length>b?f.slice(0,b):f;return e.length>c||f.length>b?`${g.trimEnd()}…`:g}function C(a,b){if(b&&a.startsWith(b)){let c=a.slice(b.length);return c.startsWith("/")?c.slice(1):c}return a}function D(a,b){let c=[];for(let d of a)if("Edit"===d.name){let a=d.input;if(a.file_path&&"string"==typeof a.old_string&&"string"==typeof a.new_string){let e=C(a.file_path,b);c.push({key:d.id,toolName:"Edit",subject:`[Edit] ${e}`,legacy:!0,changeClass:(0,x.q)(e),files:[{path:e,status:"modified",old_string:a.old_string,new_string:a.new_string,fileClass:(0,x.q)(e)}]})}}else if("Write"===d.name){let a=d.input;if(a.file_path&&"string"==typeof a.content){let e=C(a.file_path,b);c.push({key:d.id,toolName:"Write",subject:`[Write] ${e}`,legacy:!0,changeClass:(0,x.q)(e),files:[{path:e,status:"added",old_string:"",new_string:a.content,fileClass:(0,x.q)(e)}]})}}return c}function E(a,b,c){var d;let e,f=a.map(a=>{let b=new Set(a.commit.toolFiles);return{key:a.commit.toolId??a.commit.hash,shortHash:a.commit.hash.slice(0,7),toolName:a.commit.toolName??"tool",subject:a.commit.subject,timestamp:a.commit.timestamp,truncated:!0===a.truncated,changeClass:(0,x.S)(a.files.map(a=>a.path)),files:a.files.map(a=>({path:a.path,status:a.status,additions:a.additions,deletions:a.deletions,old_string:a.oldContent??"",new_string:a.newContent??"",unviewable:!a.isImage&&(a.binary||null===a.oldContent&&null===a.newContent),isImage:a.isImage,oldRev:a.oldRev,newRev:a.newRev,external:b.size>0&&!b.has(a.path),fileClass:(0,x.q)(a.path)}))}});return d=f.length>0?f:D(b,c),e=new Map(b.map(a=>[a.id,a])),d.map(a=>{let b=function(a){if(!a)return;let b=a.input;return"string"==typeof b.description&&b.description?b.description:"string"==typeof b.command&&b.command?b.command:"string"==typeof b.prompt&&b.prompt?b.prompt:"string"==typeof b.file_path&&b.file_path?b.file_path:"string"==typeof b.notebook_path&&b.notebook_path?b.notebook_path:void 0}(e.get(a.key));return b?{...a,fullSubject:`[${a.toolName}] ${b}`}:a})}function F({additions:a,deletions:b}){return(0,e.jsxs)("span",{className:"flex items-center gap-1 font-mono",children:[(0,e.jsxs)("span",{className:"text-green-11",children:["+",a]}),(0,e.jsxs)("span",{className:"text-red-11",children:["-",b]})]})}function G({cls:a}){return(0,e.jsx)("span",{className:`text-[10px] px-1 py-px rounded flex-shrink-0 ${"test"===a?"bg-emerald-500/15 text-emerald-600 dark:text-emerald-400/80":"bg-sky-500/15 text-sky-600 dark:text-sky-400/80"}`,children:a})}function H(a){let b=new Date(1e3*a),c=new Date,d=String(b.getMonth()+1).padStart(2,"0"),e=String(b.getDate()).padStart(2,"0"),f=String(b.getHours()).padStart(2,"0"),g=String(b.getMinutes()).padStart(2,"0"),h=`${d}-${e} ${f}:${g}`;return b.getFullYear()===c.getFullYear()?h:`${b.getFullYear()}-${h}`}function I({toolCalls:a,cwd:b,sessionId:c,runId:d,onClose:k,onContentSearch:x}){let{t:z}=(0,g.Bd)(),C=(0,f.useRef)(null),[J,L]=(0,f.useState)(null),M=(0,f.useMemo)(()=>a.map(a=>a.id).filter(Boolean),[a]),N=M.join(","),[O,P]=(0,f.useState)(0),Q=(0,i.Z)(b&&M.length>0?(0,w.se)(b,M,c,d):h.succeed([]),[b,c,d,N,O]);(0,f.useMemo)(()=>a.filter(a=>(0,y.h)(a.name)).map(a=>a.id),[a]);let R=(0,f.useRef)([]),S="loading"===Q.status&&0===R.current.length,T=(0,f.useMemo)(()=>{if("success"===Q.status){let c=E(Q.data,a,b);return c.length>0&&(R.current=c),c}return"loading"===Q.status&&R.current.length>0?R.current:"loading"===Q.status?[]:D(a,b)},[Q,a,b]),[U,V]=(0,f.useState)(null),[W,X]=(0,f.useState)(null),[Y,Z]=(0,f.useState)(new Set),[$,_]=(0,f.useState)(()=>!0),[aa,ab]=(0,f.useState)("compact"),[ac,ad]=(0,f.useState)("unified"),[ae,af]=(0,f.useState)(!1),[ag,ah]=(0,f.useState)(!1),[ai,aj]=(0,f.useState)(null),ak=(0,f.useMemo)(()=>T.find(a=>a.key===U)??null,[T,U]),al=(0,f.useRef)(null),am=ak??al.current,an=(0,f.useMemo)(()=>am?(0,o.Do)(am.files):[],[am]),ao=(0,f.useMemo)(()=>am?.files.find(a=>a.path===W)??null,[am,W]),ap=(0,f.useCallback)(a=>{V(a.key),X(a.files[0]?.path??null),Z(new Set((0,o.Sz)((0,o.Do)(a.files))))},[]),aq=(0,f.useMemo)(()=>T.reduce((a,b)=>a+b.files.length,0),[T]),ar=a=>(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center text-muted-foreground text-sm",children:a});return(0,e.jsx)(j.SU,{container:J,children:(0,e.jsxs)("div",{ref:C,className:"relative bg-card shadow-lv3 w-full h-full flex flex-col rounded-lg",onClick:a=>a.stopPropagation(),children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("button",{onClick:()=>_(a=>!a),"aria-label":z("diffViewer.toggleFileTree"),className:`p-1 rounded transition-colors ${$?"text-foreground bg-accent":"text-muted-foreground hover:text-foreground hover:bg-hover"}`,children:(0,e.jsx)(l.A,{className:"w-4 h-4"})}),(0,e.jsx)("h3",{className:"text-sm font-medium text-foreground",children:z("diffViewer.fileChanges",{count:aq})})]}),(0,e.jsx)("button",{onClick:k,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-hover rounded transition-colors",children:(0,e.jsx)(m.A,{className:"w-5 h-5"})})]}),(0,e.jsxs)("div",{className:"flex-1 flex overflow-hidden",children:[$&&(0,e.jsx)("div",{className:"w-60 flex-shrink-0 border-r border-border overflow-y-auto",children:T.map(a=>{let b;return(0,e.jsxs)("div",{onClick:()=>ap(a),className:`px-3 py-2 border-b border-border cursor-pointer hover:bg-hover ${U===a.key?"bg-brand/10":""}`,children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[a.shortHash&&(0,e.jsx)("span",{className:"font-mono text-xs text-brand",children:a.shortHash}),void 0!==a.timestamp&&(0,e.jsx)("span",{className:"text-xs text-foreground-subtle",children:H(a.timestamp)}),a.changeClass&&(0,e.jsx)("span",{className:"ml-auto",children:(0,e.jsx)(G,{cls:a.changeClass})})]}),(0,e.jsx)("div",{className:"text-sm text-foreground whitespace-pre-wrap break-words mt-0.5","data-tooltip":A(a),children:B(a,320,10)}),(0,e.jsxs)("div",{className:"flex items-center gap-2 mt-0.5 text-xs text-muted-foreground",children:[(0,e.jsx)("span",{children:z("commitDetail.nChanges",{count:a.files.length})}),(b=function(a){let b=!1,c=0,d=0;for(let e of a.files)(void 0!==e.additions||void 0!==e.deletions)&&(b=!0),c+=e.additions??0,d+=e.deletions??0;return b?{additions:c,deletions:d}:null}(a))&&(b.additions>0||b.deletions>0)?(0,e.jsx)(F,{additions:b.additions,deletions:b.deletions}):null]})]},a.key)})}),(0,e.jsx)("div",{className:"flex-1 flex flex-col overflow-hidden",children:S?ar(z("diffViewer.loadingSnapshots")):0===T.length?ar(z("diffViewer.noChanges")):am?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2 border-b border-border text-xs text-muted-foreground",children:[(0,e.jsxs)("span",{className:"flex items-center gap-1 text-foreground",children:[(0,e.jsx)(n.A,{className:"w-3.5 h-3.5"}),am.toolName]}),am.shortHash&&(0,e.jsx)("span",{className:"font-mono text-brand",children:am.shortHash}),void 0!==am.timestamp&&(0,e.jsx)("span",{children:H(am.timestamp)}),(0,e.jsx)("span",{className:"flex-1 min-w-0 whitespace-pre-wrap break-words","data-tooltip":A(am),children:B(am,640,6)}),am.truncated&&(0,e.jsx)("span",{className:"text-amber-11",children:z("diffViewer.truncated")}),am.legacy&&(0,e.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/15 text-amber-600 dark:text-amber-400","data-tooltip":z("diffViewer.reconstructedHint"),children:z("diffViewer.reconstructed")}),(0,e.jsx)("div",{className:"ml-auto flex items-center gap-2",children:!ao?.isImage&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(p.y,{value:aa,onChange:ab}),(0,e.jsx)(q.q,{value:ac,onChange:ad})]})})]}),(0,e.jsxs)("div",{className:"flex-1 flex overflow-hidden",children:[$&&(0,e.jsx)("div",{className:"w-72 flex-shrink-0 border-r border-border overflow-y-auto overflow-x-hidden",children:(0,e.jsx)(o.VO,{files:an,selectedPath:W,expandedPaths:Y,onToggle:a=>Z(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c}),onSelect:a=>{!a.isDirectory&&a.file&&X(a.file.path)},cwd:b||"",showChanges:!0,renderActions:a=>{if(a.isDirectory)return null;let b=a.file;return b?(0,e.jsxs)(e.Fragment,{children:[b.fileClass&&(0,e.jsx)(G,{cls:b.fileClass}),b.external&&(0,e.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-purple-400 flex-shrink-0","data-tooltip":z("diffViewer.externalChange")})]}):null}})}),(0,e.jsx)("div",{className:"flex-1 overflow-hidden",children:ao?ao.isImage?(0,e.jsx)(r.K,{filePath:ao.path,oldSrc:b&&ao.oldRev?K(b,ao.oldRev,ao.path):null,newSrc:b&&ao.newRev?K(b,ao.newRev,ao.path):null}):ao.unviewable?(0,e.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground text-sm",children:z("diffViewer.notViewable")}):"unified"===ac?(0,e.jsx)(s.xU,{oldContent:ao.old_string,newContent:ao.new_string,filePath:ao.path,cwd:b,enableComments:!0,onContentSearch:x,compact:"compact"===aa,onPreview:"deleted"===ao.status?void 0:(0,t.e$)(ao.path)?()=>af(!0):(0,t.aR)(ao.path)?()=>ah(!0):ao.path.endsWith(".json")?()=>aj({content:ao.new_string,filePath:ao.path}):void 0,previewLabel:ao.path.endsWith(".json")?z("common.readable"):z("common.preview")}):(0,e.jsx)(s.xZ,{oldContent:ao.old_string,newContent:ao.new_string,filePath:ao.path,isNew:"added"===ao.status,isDeleted:"deleted"===ao.status,cwd:b,enableComments:!0,onContentSearch:x,compact:"compact"===aa,onPreview:"deleted"===ao.status?void 0:(0,t.e$)(ao.path)?()=>af(!0):(0,t.aR)(ao.path)?()=>ah(!0):ao.path.endsWith(".json")?()=>aj({content:ao.new_string,filePath:ao.path}):void 0,previewLabel:ao.path.endsWith(".json")?z("common.readable"):z("common.preview")}):(0,e.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground text-sm",children:z("diffViewer.selectFileToView")})})]})]}):ar(z("diffViewer.selectFileToView"))})]}),ae&&ao&&(0,e.jsx)("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-scrim p-2 md:p-4",onClick:()=>af(!1),children:(0,e.jsx)("div",{className:"bg-card rounded-lg shadow-lv3 w-full max-w-[95%] h-full flex flex-col",onClick:a=>a.stopPropagation(),children:(0,e.jsx)(u.M,{content:ao.new_string,filePath:ao.path,cwd:b||"",onClose:()=>af(!1)})})}),ag&&ao&&(0,e.jsx)(v.N,{filePath:ao.path,content:ao.new_string,cwd:b,onClose:()=>ah(!1),onContentSearch:x}),ai&&(0,e.jsx)("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-scrim p-2 md:p-4",onClick:()=>aj(null),children:(0,e.jsxs)("div",{className:"bg-card rounded-lg shadow-lv3 w-full max-w-[95%] h-full flex flex-col",onClick:a=>a.stopPropagation(),children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border flex-shrink-0",children:[(0,e.jsx)("span",{className:"text-sm text-muted-foreground font-mono truncate",children:ai.filePath}),(0,e.jsx)("button",{onClick:()=>aj(null),className:"p-1 text-muted-foreground hover:text-foreground hover:bg-hover rounded transition-colors",children:(0,e.jsx)(m.A,{className:"w-4 h-4"})})]}),(0,e.jsx)("div",{className:"flex-1 overflow-auto px-6 py-4 bg-secondary",children:(0,e.jsx)("pre",{className:"whitespace-pre-wrap break-words font-mono text-foreground",style:{fontSize:"0.8125rem",lineHeight:"1.5"},children:(0,t.xb)(ai.content)})})]})})]})})}function J({toolCalls:a,cwd:b,sessionId:c,runId:d,onClose:f,onContentSearch:g}){return(0,e.jsx)(k.ZL,{children:(0,e.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-scrim",onClick:f,children:(0,e.jsx)(I,{toolCalls:a,cwd:b,sessionId:c,runId:d,onClose:f,onContentSearch:g?a=>{f(),g(a)}:void 0})})})}d()}catch(a){d(a)}})},58554:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{r:()=>F});var e=c(48249),f=c(67484),g=c(41927),h=c(77949),i=c(7833),j=c(40699),k=c(33281),l=c(41224),m=c(57031),n=c(88214),o=c(63041),p=c(62473),q=c(86686),r=c(75513),s=c(81206),t=c(97951),u=c(99843),v=c(36702),w=c(43209),x=c(95401),y=c(42910),z=c(65139),A=c(47604),B=c(60812),C=c(84844),D=c(44384),E=a([u]);function F({tabId:a,initialCwd:b,initialSessionId:c,engine:d,onEngineChange:E,ollamaModel:G,onOllamaModelChange:H,deepseekModel:I,onDeepseekModelChange:J,kimiModel:K,onKimiModelChange:L,glmModel:M,onGlmModelChange:N,claudeModel:O,onClaudeModelChange:P,claudeEffort:Q,onClaudeEffortChange:R,claudeContextWindow:S,onClaudeContextWindowChange:T,claudeFastMode:U,onClaudeFastModeChange:V,claudeThinking:W,onClaudeThinkingChange:X,codexModel:Y,onCodexModelChange:Z,codexReasoningEffort:$,onCodexReasoningEffortChange:_,planMode:aa,onPlanModeChange:ab,noHistory:ac,onNoHistoryChange:ad,hideHeader:ae,hideSidebar:af,isActive:ag=!0,refreshSignal:ah,onLoadingChange:ai,onSessionIdChange:aj,onTitleChange:ak,onShowGitStatus:al,onOpenNote:am,onCreateScheduledTask:an,onOpenSession:ao,onContentSearch:ap,onShowFileDiff:aq,onOpenFileLink:ar,onOpenSessionBrowser:as,onOpenSettings:at}){let{t:au}=(0,D.Bd)();(0,r.nH)();let[av,aw]=(0,f.useState)([]),[ax,ay]=(0,f.useState)(null),[az,aA]=(0,f.useState)(!1),[aB,aC]=(0,f.useState)(!1),[aD,aE]=(0,f.useState)(!1),[aF,aG]=(0,f.useState)(!1),[aH,aI]=(0,f.useState)(null),[aJ,aK]=(0,f.useState)(!1),aL=aa??aJ,aM=(0,f.useCallback)(a=>{aK(a),ab?.(a)},[ab]),[aN,aO]=(0,f.useState)(!1),aP=ac??aN,aQ=(0,f.useCallback)(a=>{aO(a),ad?.(a)},[ad]),[aR,aS]=(0,f.useState)(!1),aT=(0,f.useRef)(null);(0,f.useRef)(null);let aU=(0,f.useCallback)(async a=>{if(!b)return;let c=await k.t4.runPromiseExit((0,l.n_)({cwd:b,sessionId:a}));"Success"===c._tag&&c.value&&"string"==typeof c.value.title?ak?.(c.value.title):"Failure"===c._tag&&console.error("Failed to fetch session title:",c.cause)},[b,ak]),aV=(0,f.useRef)(null),[aW,aX]=(0,f.useState)(!1),[aY,aZ]=(0,f.useState)(null),[a$,a_]=(0,f.useState)(null),a0=(0,f.useRef)(!1),{isLoadingHistory:a1,isLoadingMore:a2,hasMoreHistory:a3,loadMoreHistory:a4,loadHistoryByCwdAndSessionId:a5,loadedSessionId:a6,loadedEngine:a7}=(0,s.m)(av,aw,ax,{cwd:b,initialSessionId:c,onSessionId:ay,onTitleChange:ak,onTokenUsage:aI,liveRunningRef:a0}),a8=a7??d??void 0,a9=!a8||"claude"===a8,ba="codex"===a8,bb=O??z.BV,bc=(0,z.NR)(bb,Q),bd=(0,z.OO)(bb,S),be=Y??z.kn,bf=(0,z.oJ)(be,$),bg="deepseek"===a8||"kimi"===a8||"glm"===a8?a8:null,bh="kimi"===bg?K:"glm"===bg?M:I,bi="kimi"===bg?L:"glm"===bg?N:J,bj="ollama"===a8||null!==bg||a9||ba,{isLoading:bk,tokenUsage:bl,liveOutputTokens:bm,runningStartedAt:bn,rateLimitInfo:bo,apiRetryInfo:bp,handleSend:bq,handleStop:br}=(0,t.e)(av,aw,{sessionId:ax,cwd:b,engine:a8,planMode:aL,noHistory:aP,ollamaModel:G,engineModel:bh,claudeModel:bb,claudeEffort:bc,claudeContextWindow:bd,claudeFastMode:U,claudeThinking:W,codexModel:be,codexReasoningEffort:bf,onSessionId:ay,onFetchTitle:aU,onRunComplete:()=>aV.current?.()}),bs=(0,f.useCallback)(async(a,c)=>{let d=a.split("\n")[0];if(a9){let b=/^\/plan(?:\s+([\s\S]*))?$/.exec(a.trim());if(b){let a=(b[1]??"").trim();"off"===a.toLowerCase()?(aM(!1),(0,i.oR)(au("chat.planModeOff",{defaultValue:"Plan mode off"}),"info")):""===a?(aM(!0),(0,i.oR)(au("chat.planModeOn",{defaultValue:"Plan mode on"}),"success")):(aM(!0),bq(a,c,{permissionMode:"plan"}));return}}if(d.startsWith("!")&&d.length>1){let e=d.slice(1).trim();if(!e)return void bq(a,c);let f=a.split("\n").slice(1).join("\n").trim(),g=await k.t4.runPromiseExit((0,l.JC)({command:e,cwd:b}));if("Success"===g._tag){let a=g.value,b=[a.stdout,a.stderr].filter(Boolean).join("\n")||"(no output)",d=a.exitCode?` (exit code: ${a.exitCode})`:"",h=au("chat.executedCommand",{command:e,exitInfo:d,output:b});f&&(h+=`
47
48
 
48
- ${f}`),bq(h,c)}else bq(au("chat.executedCommandFailed",{command:e,error:g.cause}),c);return}bq(a,c)},[bq,b,au,a9,aM]),bt=(0,f.useCallback)(()=>{aM(!1),bq(au("chat.approvePlanPrompt",{defaultValue:"已批准,按上述计划开始执行。"}),void 0,{permissionMode:null})},[bq,aM,au]),bu=a6||ax,bv=ag&&!bk&&!!bu;(0,j.u)(bu,aw,bv,a8,{onRunningChange:a=>{a0.current=a,aX(a)},onLiveOutputTokens:aZ,onRunStartedAt:a_,onComplete:()=>{b&&bu&&a5(b,bu,!0,10)}}),(0,f.useRef)(ag),(0,f.useRef)(0);let bw=bl||aH,bx=bk?bm:aW?aY:null,by=bk?bn:aW?a$:null;(0,f.useRef)(!1);let bz=(0,f.useCallback)(async(a,c)=>{let d=a6??ax;if(!b||!d)return;let e=await k.t4.runPromiseExit((0,l.Zr)(d,{cwd:b,fromMessageUuid:a,scope:c}));if("Success"===e._tag&&e.value.newSessionId){let a=e.value.newSessionId;ao?ao(a,"single"===c?"Excerpt":"Fork"):(0,m.F)(n.n.OpenProject,{cwd:b,sessionId:a})}else"Failure"===e._tag&&(console.error("Fork failed:",e.cause),(0,i.oR)("single"===c?au("toast.excerptFailed",{defaultValue:"Failed to excerpt this turn"}):au("toast.forkFailed",{defaultValue:"Failed to fork session"}),"error"))},[b,a6,ax,ao,au]),bA=(0,f.useRef)(bz);bA.current=bz;let bB=(0,f.useRef)((a,b)=>bA.current(a,b)).current,bC=(0,f.useCallback)(()=>{aE(!0)},[]),bD=(0,f.useCallback)(()=>{aG(!0)},[]),bE=(0,f.useMemo)(()=>{if(an&&b&&a&&ax)return c=>{an({...c,cwd:b,tabId:a,sessionId:ax,engine:a8,..."ollama"===a8&&G&&{model:G},...bg&&bh&&{model:bh},...a9&&{model:bb},...ba&&{model:be}})}},[an,b,a,ax,a8,G,bg,bh,a9,bb,ba,be]),bF=bj?(0,e.jsxs)("label",{className:"flex items-center gap-1.5 text-xs cursor-pointer select-none",title:au("chat.noHistoryHint",{defaultValue:"Independent task: each message is sent to the model on its own, with no prior conversation. The transcript above still records everything."}),children:[(0,e.jsx)("input",{type:"checkbox","data-testid":"nohistory-toggle",checked:aP,onChange:a=>aQ(a.target.checked),className:"accent-brand"}),(0,e.jsxs)("span",{className:"flex items-center gap-1 text-foreground",children:[(0,e.jsx)(g.A,{className:"w-3.5 h-3.5"}),au("chat.noHistory",{defaultValue:"Independent task"})]}),(0,e.jsx)("span",{className:"text-muted-foreground",children:au("chat.noHistoryDesc",{defaultValue:"no history sent"})})]}):null;return(0,e.jsxs)("div",{className:`flex ${ae&&af?"h-full":"h-screen"} bg-card`,children:[(0,e.jsxs)("div",{id:"chat-screen",className:"flex-1 flex flex-col min-w-0 relative",onMouseEnter:()=>aA(!0),onMouseLeave:()=>aA(!1),children:[!ae&&(0,e.jsx)(o.e,{cwd:b,sessionId:ax,engine:a8,onOpenProjectSessions:()=>aC(!0),onOpenSessionBrowser:as,onOpenSettings:at}),(a9||ba)&&(0,e.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-border bg-card/50",children:[(0,e.jsx)(z.Yd,{engine:ba?"codex":"claude",claudeModel:bb,onClaudeModelChange:P,claudeEffort:bc,onClaudeEffortChange:R,claudeContextWindow:bd,onClaudeContextWindowChange:T,claudeFastMode:U,onClaudeFastModeChange:V,claudeThinking:W,onClaudeThinkingChange:X,codexModel:be,onCodexModelChange:Z,codexReasoningEffort:bf,onCodexReasoningEffortChange:_}),a9&&(0,e.jsxs)("label",{className:"flex items-center gap-1.5 text-xs cursor-pointer select-none",title:au("chat.planModeHint",{defaultValue:"Plan mode: read-only exploration that produces a plan without editing. Uncheck and resend to implement."}),children:[(0,e.jsx)("input",{type:"checkbox","data-testid":"planmode-toggle",checked:aL,onChange:a=>aM(a.target.checked),className:"accent-brand"}),(0,e.jsxs)("span",{className:"flex items-center gap-1 text-foreground",children:[(0,e.jsx)(h.A,{className:"w-3.5 h-3.5"}),au("chat.planMode",{defaultValue:"Plan mode"})]}),(0,e.jsx)("span",{className:"text-muted-foreground",children:au("chat.planModeDesc",{defaultValue:"read-only \xb7 plan first, no edits"})})]}),bF]}),"ollama"===a8&&(0,e.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-border bg-card/50",children:[H&&(0,e.jsx)(x.m,{currentModel:G,onModelChange:H}),bF]}),bg&&(0,e.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-border bg-card/50",children:[bi&&(0,e.jsx)(y.Z,{engine:bg,currentModel:bh,onModelChange:bi,onHasKeyChange:aS}),bF,(0,e.jsx)("div",{className:"ml-auto pl-2",children:"deepseek"===bg?(0,e.jsx)(A.f,{hasKey:aR}):(0,e.jsx)(B.J,{engine:bg,hasKey:aR})})]}),a1?(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,e.jsx)("span",{className:"text-muted-foreground",children:au("sessions.loadingHistory")})}):(0,e.jsx)(u.M,{ref:aT,messages:av,isLoading:bk||aW,liveOutputTokens:bx,runningStartedAt:by,cwd:b,sessionId:ax,engine:a8,apiRetryInfo:bp,hasMoreHistory:a3,isLoadingMore:a2,onLoadMore:a4,onFork:bB,isActive:ag,onContentSearch:ap,onShowFileDiff:aq,onOpenFileLink:ar,onApprovePlan:bt}),bw&&(0,e.jsx)(p.g,{tokenUsage:bw,rateLimitInfo:bo}),(0,e.jsx)(v.V,{onSend:bs,disabled:bk||aW,cwd:b,engine:a8,onShowGitStatus:al,onShowComments:b?bC:void 0,onShowUserMessages:bD,onOpenNote:am,onCreateScheduledTask:bE})]}),!ae&&b&&(0,e.jsx)(w.Q,{isOpen:aB,onClose:()=>aC(!1),cwd:b}),b&&(0,e.jsx)(C.i,{isOpen:aD,onClose:()=>aE(!1),cwd:b}),(0,e.jsx)(q.f,{isOpen:aF,onClose:()=>aG(!1),messages:av,onSelectMessage:a=>{aT.current?.scrollToMessage(a)}})]})}u=(E.then?(await E)():E)[0],d()}catch(a){d(a)}})},58904:(a,b,c)=>{"use strict";c.d(b,{e:()=>k});var d=c(67484),e=c(20586),f=c(7833),g=c(208),h=c(79606),i=c(33281),j=c(85655);function k({cwd:a,addToRecentFiles:b}){let[c,l]=(0,d.useState)(null),[m,n]=(0,d.useState)(!1),[o,p]=(0,d.useState)(null),[q,r]=(0,d.useState)(null),[s,t]=(0,d.useState)(null),[u,v]=(0,d.useState)(!1),[w,x]=(0,d.useState)(new Set),[y,z]=(0,d.useState)(new Set),[A,B]=(0,d.useState)([]),[C,D]=(0,d.useState)([]),E=(0,d.useMemo)(()=>{let a=new Set((0,e.Sz)(A));for(let b of w)a.delete(b);return a},[A,w]),F=(0,d.useMemo)(()=>{let a=new Set((0,e.Sz)(C));for(let b of y)a.delete(b);return a},[C,y]),[G,H]=(0,d.useState)(!1),[I,J]=(0,d.useState)(0),K=(0,d.useCallback)(async()=>{n(!0),p(null),await i.t4.runPromise((0,j.lv)(a).pipe(h.match({onSuccess:a=>{l(a);let b=(0,e.Do)(a.staged),c=(0,e.Do)(a.unstaged);B(b),D(c)},onFailure:a=>{p(a.cause instanceof Error?a.cause.message:"Unknown error")}}))),n(!1)},[a]),L=(0,d.useCallback)(a=>{x(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),M=(0,d.useCallback)(a=>{z(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),N=(0,d.useCallback)((a,c)=>{r({file:a,type:c}),b(a.path)},[b]),O=(0,d.useCallback)(async(a,b,c,d)=>{let e=await i.t4.runPromiseExit(a);"Success"===e._tag?(await K(),(0,f.oR)(b,"success")):(console.error(c,e.cause),(0,f.oR)(d,"error"))},[K]),P=(0,d.useCallback)(b=>O((0,j.Iz)(a,[b]),g.A.t("toast.staged"),"Error staging file:",g.A.t("toast.stageFailed")),[a,O]),Q=(0,d.useCallback)(b=>O((0,j.X0)(a,[b]),g.A.t("toast.unstaged"),"Error unstaging file:",g.A.t("toast.unstageFailed")),[a,O]),R=(0,d.useCallback)(async b=>{0!==b.length&&await O((0,j.Iz)(a,b),g.A.t("toast.stagedNFiles",{count:b.length}),"Error staging files:",g.A.t("toast.stageFailed"))},[a,O]),S=(0,d.useCallback)(async b=>{0!==b.length&&await O((0,j.X0)(a,b),g.A.t("toast.unstagedNFiles",{count:b.length}),"Error unstaging files:",g.A.t("toast.unstageFailed"))},[a,O]),T=(0,d.useCallback)(async b=>{if(0===b.length)return;let c=b.filter(a=>"untracked"===a.status).map(a=>a.path),d=b.filter(a=>"untracked"!==a.status).map(a=>a.path),e=h.gen(function*(){c.length>0&&(yield*(0,j.Ub)(a,c,!0)),d.length>0&&(yield*(0,j.Ub)(a,d,!1))});await O(e,g.A.t("toast.discardedNFiles",{count:b.length}),"Error discarding files:",g.A.t("toast.discardFailed"))},[a,O]),U=(0,d.useCallback)(async()=>{c?.unstaged.length&&await O((0,j.Iz)(a,c.unstaged.map(a=>a.path)),g.A.t("toast.stagedNFiles",{count:c.unstaged.length}),"Error staging all files:",g.A.t("toast.stageFailed"))},[a,c,O]),V=(0,d.useCallback)(async()=>{c?.staged.length&&await O((0,j.X0)(a,c.staged.map(a=>a.path)),g.A.t("toast.unstagedNFiles",{count:c.staged.length}),"Error unstaging all files:",g.A.t("toast.unstageFailed"))},[a,c,O]),W=(0,d.useCallback)(async b=>{let c="untracked"===b.status;await O((0,j.Ub)(a,[b.path],c),c?g.A.t("toast.deletedFile"):g.A.t("toast.discardedChanges"),"Error discarding file:",g.A.t("toast.discardFailed"))},[a,O]),X=(0,d.useCallback)(async()=>{if(!c?.unstaged.length||!await (0,f.lJ)(g.A.t("git.discardAllConfirm",{count:c.unstaged.length}),{danger:!0}))return;let b=c.unstaged.filter(a=>"untracked"===a.status).map(a=>a.path),d=c.unstaged.filter(a=>"untracked"!==a.status).map(a=>a.path),e=c.unstaged.length,i=h.gen(function*(){d.length>0&&(yield*(0,j.Ub)(a,d,!1)),b.length>0&&(yield*(0,j.Ub)(a,b,!0))});await O(i,g.A.t("toast.discardedNFiles",{count:e}),"Error discarding all:",g.A.t("toast.discardFailed"))},[a,c,O]);return{status:c,setStatus:l,statusLoading:m,statusError:o,statusSelectedFile:q,statusDiff:s,statusDiffLoading:u,stagedExpandedPaths:E,unstagedExpandedPaths:F,stagedTree:A,setStagedTree:B,unstagedTree:C,setUnstagedTree:D,showStatusDiffPreview:G,setShowStatusDiffPreview:H,fetchStatus:K,handleStagedToggle:L,handleUnstagedToggle:M,handleStatusFileSelect:N,handleStage:P,handleUnstage:Q,handleStageFiles:R,handleUnstageFiles:S,handleDiscardFiles:T,handleStageAll:U,handleUnstageAll:V,handleDiscardFile:W,handleDiscardAll:X,refreshDiff:(0,d.useCallback)(()=>J(a=>a+1),[])}}},59336:(a,b,c)=>{"use strict";function d(){}function e(a){return()=>{}}c.d(b,{U:()=>e,k:()=>d})},60333:(a,b,c)=>{"use strict";c.d(b,{q:()=>f});var d=c(48249),e=c(44384);function f({value:a,onChange:b,className:c}){let{t:g}=(0,e.Bd)();return(0,d.jsx)("div",{className:`flex items-center gap-0.5 rounded border border-border overflow-hidden ${c??""}`,children:["split","unified"].map(c=>(0,d.jsx)("button",{onClick:a=>{a.stopPropagation(),b(c)},className:`px-2 py-0.5 text-xs transition-colors ${a===c?"bg-brand text-white":"text-muted-foreground hover:bg-hover"}`,children:g("split"===c?"diffViewer.viewSplit":"diffViewer.viewUnified")},c))})}},60591:(a,b,c)=>{"use strict";c.d(b,{C6:()=>h,C_:()=>v,Hz:()=>u,WU:()=>w,Zy:()=>t,aR:()=>s,cG:()=>i,d9:()=>j,e$:()=>r,jU:()=>g,oK:()=>x,u:()=>q,xb:()=>k,zs:()=>o});var d=c(67484),e=c.n(d),f=c(208);function g(a){try{return JSON.parse(a),!0}catch{return!1}}function h(a){try{let b=JSON.parse(a);return JSON.stringify(b,null,2)}catch{return a}}let i={key:"hsl(var(--blue-11))",str:"hsl(var(--green-11))",num:"hsl(var(--violet-11))",bool:"hsl(var(--red-11))",punct:"hsl(var(--slate-11))",fold:"hsl(var(--slate-11))"},j=e().createContext({version:0,collapsed:!1});function k(a,b=i){try{let c=JSON.parse(a);return n(c,0,b)}catch{return a}}let l=(a,b)=>e().createElement("span",{style:{color:a}},b);function m({label:a,labelColor:b,value:c,indent:d,colors:g}){let h=e().useContext(j),[i,k]=e().useState(null),o=i&&i.version===h.version?i.collapsed:h.collapsed,[p,q]=e().useState({x:0,y:0}),r="string"==typeof c&&c.replace(/\\n/g,"\n").split("\n").length>3,s={onMouseDown:a=>{q({x:a.clientX,y:a.clientY})},onClick:a=>{let b=a.clientX-p.x,c=a.clientY-p.y;b*b+c*c>25||(a.stopPropagation(),k({version:h.version,collapsed:!o}))},style:{cursor:"pointer"}};if(r&&o&&"string"==typeof c){let d=c.replace(/\\n/g,"\n").split("\n")[0],h=c.replace(/\\n/g,"\n").split("\n").length;return e().createElement("span",s,l(b,a),l(g.punct,": "),l(g.str,d),l(g.fold,` ${f.A.t("toolCall.foldedLines",{count:h})}`))}let t=e().createElement(e().Fragment,null,l(b,a),l(g.punct,": "),n(c,d,g));return r?e().createElement("span",s,t):t}function n(a,b,c){let d=" ".repeat(b);if(null===a)return l(c.bool,"null");if(void 0===a)return l(c.bool,"undefined");if("string"==typeof a){let b=a.replace(/\\n/g,"\n").replace(/\n/g,"\n"+d);return l(c.str,b)}if("number"==typeof a)return l(c.num,String(a));if("boolean"==typeof a)return l(c.bool,String(a));if(Array.isArray(a))return 0===a.length?l(c.punct,"[]"):e().createElement(e().Fragment,null,l(c.punct,"["),"\n",...a.map((f,g)=>e().createElement("span",{key:g},d+" ",e().createElement(m,{label:`[${g}]`,labelColor:c.key,value:f,indent:b+1,colors:c}),g<a.length-1?e().createElement(e().Fragment,null,l(c.punct,","),"\n"):"\n")),d,l(c.punct,"]"));if("object"==typeof a){let f=Object.entries(a);return 0===f.length?l(c.punct,"{}"):e().createElement(e().Fragment,null,l(c.punct,"{"),"\n",...f.map(([a,g],h)=>e().createElement("span",{key:a},d+" ",e().createElement(m,{label:a,labelColor:c.key,value:g,indent:b+1,colors:c}),h<f.length-1?e().createElement(e().Fragment,null,l(c.punct,","),"\n"):"\n")),d,l(c.punct,"}"))}return String(a)}function o(a){try{let b=JSON.parse(a);if(b&&"string"==typeof b.file_path&&"string"==typeof b.old_string&&"string"==typeof b.new_string)return b}catch{}return null}let p=new Set([".png",".jpg",".jpeg",".gif",".webp",".svg",".bmp",".ico",".avif"]);function q(a){let b=a.slice(a.lastIndexOf(".")).toLowerCase();return p.has(b)}function r(a){return a.toLowerCase().endsWith(".md")}function s(a){let b=a.toLowerCase();return b.endsWith(".html")||b.endsWith(".htm")}function t(a){let b=a.toLowerCase();return b.endsWith(".csv")||b.endsWith(".tsv")}function u(a){return a.toLowerCase().endsWith(".json")}function v(a){return"skill.md"===a.slice(a.lastIndexOf("/")+1).toLowerCase()}function w(a,b){let c=b.startsWith("/")?[]:a.split("/").slice(0,-1);for(let a of b.replace(/^\//,"").split("/"))""!==a&&"."!==a&&(".."===a?c.pop():c.push(a));return c.join("/")}function x(a){try{let b=JSON.parse(a);if(b&&"string"==typeof b.file_path)return b.file_path}catch{let b=a.trim();if(b.startsWith("/")&&!b.includes("\n")&&b.length<500)return b}return null}},60812:(a,b,c)=>{"use strict";c.d(b,{J:()=>l});var d=c(48249),e=c(67484),f=c(44384),g=c(33281),h=c(63565),i=c(41224);let j={kimi:"https://www.kimi.com/code/console",glm:"https://bigmodel.cn/coding-plan/personal/usage"};function k(a){let b=a.remaining??"?",c=a.limit??"?";return`${a.label} ${b}/${c}`}function l({engine:a,hasKey:b}){let{t:c}=(0,f.Bd)(),[m,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(null),[q,r]=(0,e.useState)(null),s=(0,e.useCallback)(async()=>{n(!0),r(null);let b=await g.t4.runPromiseExit((0,i.dM)(a));"Failure"===b._tag?(p(null),r(c("chat.quotaFailed",{defaultValue:"Quota unavailable — check the API key"}))):p(b.value),n(!1)},[c,a]),t=o?.windows??[],u=[o?.tier,...t.map(k)].filter(Boolean).join(" \xb7 "),v=function(a){if(!a)return null;let b=new Date(a);return Number.isNaN(b.getTime())?null:`${b.getMonth()+1}/${b.getDate()} ${String(b.getHours()).padStart(2,"0")}:${String(b.getMinutes()).padStart(2,"0")}`}(t.reduce((a,b)=>b.resetTime&&(!a||b.resetTime>a)?b.resetTime:a,null)),w=t.some(a=>0===a.remaining);return(0,d.jsxs)("div",{className:"ml-auto flex items-center gap-2",children:[m&&(0,d.jsx)("span",{className:"w-3 h-3 border border-brand border-t-transparent rounded-full animate-spin"}),!m&&q&&(0,d.jsx)("span",{className:"text-xs text-red-11",children:q}),!m&&!q&&o&&(0,d.jsx)("span",{className:`text-xs font-mono ${w?"text-red-11":h.pe[a]}`,"data-tooltip":v?c("chat.quotaResetAt",{defaultValue:"Resets {{time}}",time:v}):void 0,"data-testid":`${a}-quota-value`,children:u||c("chat.quotaEmpty",{defaultValue:"No quota returned"})}),(0,d.jsx)("button",{type:"button","data-testid":`${a}-quota-button`,disabled:!b||m,onClick:s,"data-tooltip":b?void 0:c("chat.quotaNeedsKey",{defaultValue:"Set an API key first"}),className:"px-2 py-0.5 text-xs rounded border border-border text-muted-foreground hover:bg-hover hover:text-foreground transition-colors disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-transparent",children:c("chat.checkQuota",{defaultValue:"Check quota"})}),(0,d.jsx)("a",{href:j[a],target:"_blank",rel:"noopener","data-testid":`${a}-console-link`,title:c("chat.openProviderConsole",{defaultValue:"Open the provider console"}),"aria-label":c("chat.openProviderConsole",{defaultValue:"Open the provider console"}),className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-hover transition-colors",children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})})]})}},61130:(a,b,c)=>{"use strict";c.d(b,{ReviewCommentsListModal:()=>k});var d=c(48249),e=c(67484),f=c(44384),g=c(44256),h=c(7833),i=c(208);function j(a,b,c){let d=(a,c)=>b[a]||c,e=[],f=null!=c?`[${c+1}] `:"",g=a.anchor.selectedText.length>200?a.anchor.selectedText.slice(0,197)+"...":a.anchor.selectedText;for(let b of(e.push(`${f}${i.A.t("review.quoteRef",{text:g})}`),e.push(i.A.t("review.commentAuthor",{author:d(a.authorId,a.author),content:a.content})),a.replies))e.push(i.A.t("review.replyAuthor",{author:d(b.authorId,b.author),content:b.content}));return e.join("\n")}function k({isOpen:a,onClose:b,comments:c,reviewTitle:m,userNameMap:n,onCommentClick:o}){let{t:p}=(0,f.Bd)(),[q,r]=(0,e.useState)(null),[s,t]=(0,e.useState)(!1);if(!a)return null;let u=[...c].sort((a,b)=>a.anchor.startOffset-b.anchor.startOffset),v=(a,b)=>n[a]||b,w=async a=>{r(a.id);try{let b=j(a,n);await navigator.clipboard.writeText(b),(0,h.oR)(p("toast.copiedComment"))}catch{(0,h.oR)(p("toast.copyFailed"),"error")}finally{r(null)}},x=async()=>{if(0!==c.length){t(!0);try{let a=function(a,b,c){if(0===a.length)return"";let d=[...a].sort((a,b)=>a.anchor.startOffset-b.anchor.startOffset),e=[i.A.t("review.reviewSummary",{title:b}),""];return d.forEach((a,b)=>{e.push(j(a,c,b)),e.push("")}),e.push(i.A.t("review.totalNComments",{count:a.length})),e.join("\n").trim()}(c,m,n);await navigator.clipboard.writeText(a),(0,h.oR)(p("toast.copiedAllComments"))}catch{(0,h.oR)(p("toast.copyFailed"),"error")}finally{t(!1)}}},y=a=>{o?.(a),b()},z=u.filter(a=>!a.closed),A=u.filter(a=>a.closed),B=(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-scrim p-4",onClick:b,children:(0,d.jsxs)("div",{className:"w-full max-w-2xl max-h-[80vh] bg-card border border-border rounded-lg shadow-lv3 flex flex-col overflow-hidden",onClick:a=>a.stopPropagation(),children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border ",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:p("review.allCommentsTitle")}),(0,d.jsxs)("span",{className:"text-xs text-muted-foreground",children:[p("review.commentsCountBrief",{count:c.length}),A.length>0&&` (${p("review.closedCount",{count:A.length})})`]}),c.length>0&&(0,d.jsx)("button",{onClick:x,disabled:s,className:"p-1 rounded hover:bg-hover text-muted-foreground disabled:opacity-50",title:p("review.copyAllComments"),children:s?(0,d.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):(0,d.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]}),(0,d.jsx)("button",{onClick:b,className:"p-1 rounded hover:bg-hover text-muted-foreground",children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto p-3",children:0===c.length?(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[(0,d.jsx)("div",{className:"text-2xl mb-2",children:"\uD83D\uDCAC"}),(0,d.jsx)("span",{className:"text-sm",children:p("review.noComments")})]}):(0,d.jsxs)("div",{className:"space-y-2",children:[z.map((a,b)=>(0,d.jsx)(l,{comment:a,index:b,resolveAuthor:v,copyingId:q,onCopy:w,onClick:y},a.id)),A.length>0&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"text-[11px] text-muted-foreground/60 pt-2 pb-1 px-1",children:p("review.closedComments",{count:A.length})}),A.map((a,b)=>(0,d.jsx)(l,{comment:a,index:z.length+b,resolveAuthor:v,copyingId:q,onCopy:w,onClick:y,closed:!0},a.id))]})]})})]})});return(0,d.jsx)(g.ZL,{children:B})}function l({comment:a,index:b,resolveAuthor:c,copyingId:e,onCopy:f,onClick:g,closed:h}){let j=a.anchor.selectedText.length>100?a.anchor.selectedText.slice(0,97)+"...":a.anchor.selectedText;return(0,d.jsxs)("div",{className:`rounded-lg border border-border hover:border-muted-foreground/30 transition-all cursor-pointer group ${h?"opacity-50":""}`,onClick:()=>g(a.id),children:[(0,d.jsx)("div",{className:"px-3 pt-2.5 pb-1",children:(0,d.jsx)("div",{className:"text-xs bg-yellow-500/10 border-l-2 border-yellow-500 px-2 py-1 rounded-r text-muted-foreground truncate",children:j})}),(0,d.jsxs)("div",{className:"px-3 pt-1.5 pb-2 flex items-start gap-2",children:[(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-0.5",children:[(0,d.jsx)("span",{className:"w-4 h-4 rounded-full bg-brand/20 text-brand flex items-center justify-center text-[9px] font-bold flex-shrink-0",children:c(a.authorId,a.author).charAt(0)}),(0,d.jsx)("span",{className:"text-xs font-medium",children:c(a.authorId,a.author)}),(0,d.jsx)("span",{className:"text-[10px] text-muted-foreground",children:new Date(a.createdAt).toLocaleString("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"})}),h&&(0,d.jsx)("span",{className:"text-[10px] text-muted-foreground/60",children:i.A.t("review.closedLabel")})]}),(0,d.jsx)("p",{className:"text-sm text-foreground line-clamp-2 pl-6",children:a.content}),a.replies.length>0&&(0,d.jsxs)("div",{className:"pl-6 mt-1 space-y-0.5",children:[a.replies.slice(0,3).map(a=>(0,d.jsxs)("div",{className:"text-xs text-muted-foreground truncate",children:[(0,d.jsx)("span",{className:"font-medium",children:c(a.authorId,a.author)}),": ",a.content]},a.id)),a.replies.length>3&&(0,d.jsx)("div",{className:"text-[10px] text-muted-foreground/60",children:i.A.t("review.moreReplies",{count:a.replies.length-3})})]})]}),(0,d.jsx)("button",{onClick:b=>{b.stopPropagation(),f(a)},disabled:e===a.id,className:"p-1 rounded opacity-0 group-hover:opacity-100 hover:bg-hover text-muted-foreground transition-opacity disabled:opacity-50 flex-shrink-0 mt-0.5",title:i.A.t("review.copyComment"),children:e===a.id?(0,d.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):(0,d.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]})]})}},61135:()=>{},61349:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{M:()=>v});var e=c(48249),f=c(67484),g=c(44384),h=c(44256);c(33281),c(87808);var i=c(35208),j=c(55287),k=c(98356),l=c(24680),m=c(84835),n=c(7833),o=c(64676),p=c(18921),q=c(53036),r=c(60591),s=a([j,i]);function t({filePath:a}){let[b,c]=(0,f.useState)(null),[d,g]=(0,f.useState)(!0),[h,i]=(0,f.useState)(null);(0,f.useRef)(!1);let k=(0,r.e$)(a);return((0,r.u)(a),h)?(0,e.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,e.jsx)("div",{className:"text-xs text-red-11",children:h})}):d?(0,e.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,e.jsx)("span",{className:"text-sm text-muted-foreground",children:"Loading..."})}):(0,r.u)(a)?(0,e.jsx)(q.I,{absPath:a,className:"flex items-center justify-center h-full overflow-auto",imgClassName:"max-w-full max-h-full object-contain",alt:a.split("/").pop()||"image"}):b?k?(0,e.jsx)(u,{content:b,filePath:a}):(0,e.jsx)(j.Cv,{content:b,filePath:a,showLineNumbers:!0,showSearch:!0,className:"h-full"}):(0,e.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,e.jsx)("span",{className:"text-sm text-muted-foreground",children:"No content"})})}[j,i]=s.then?(await s)():s;let w=[m.W];function u({content:a,filePath:b}){let c=(0,f.useRef)(null),d=(0,f.useMemo)(()=>(0,o.J4)(b),[b]);return(0,e.jsxs)("div",{className:"h-full flex",children:[(0,e.jsx)(l.l,{content:a,containerRef:c}),(0,e.jsx)("div",{ref:c,className:"flex-1 overflow-auto p-4",children:(0,e.jsx)(k.T,{content:a,basePath:d,rehypePlugins:w})})]})}function v({title:a,content:b,toolName:c,onClose:d}){let{t:j}=(0,g.Bd)(),k=(0,r.jU)(b),l=(0,r.zs)(b),m=(0,r.oK)(b),o=!!l,q=!!m,[s,u]=(0,f.useState)(("Read"===c||"Write"===c)&&q?"file":o?"diff-unified":k?"readable":"json"),w=(0,f.useRef)(null),x=(0,p.o)(w),y=(0,e.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-scrim p-0 md:p-4",onClick:d,children:(0,e.jsxs)("div",{className:"bg-card shadow-lv3 w-full max-w-[90%] h-full md:h-[90vh] rounded-none md:rounded-lg flex flex-col transition-all",onClick:a=>a.stopPropagation(),children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium text-foreground",children:a}),m&&(0,e.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(m),(0,n.oR)(j("common.copiedPath"))},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-hover transition-colors",title:j("common.copyAbsPath"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]}),(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[k&&(0,e.jsxs)("div",{className:"flex items-center gap-1 bg-accent rounded p-0.5",children:[o&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{onClick:()=>u("diff-split"),className:`px-2 py-1 text-xs rounded transition-colors ${"diff-split"===s?"bg-card text-foreground shadow-lv1":"text-muted-foreground hover:text-foreground"}`,title:j("diffViewer.sideBySide"),children:"Split"}),(0,e.jsx)("button",{onClick:()=>u("diff-unified"),className:`px-2 py-1 text-xs rounded transition-colors ${"diff-unified"===s?"bg-card text-foreground shadow-lv1":"text-muted-foreground hover:text-foreground"}`,title:j("diffViewer.unified"),children:"Unified"})]}),q&&(0,e.jsx)("button",{onClick:()=>u("file"),className:`px-2 py-1 text-xs rounded transition-colors ${"file"===s?"bg-card text-foreground shadow-lv1":"text-muted-foreground hover:text-foreground"}`,title:j("diffViewer.previewFile"),children:"File"}),(0,e.jsx)("button",{onClick:()=>u("readable"),className:`px-2 py-1 text-xs rounded transition-colors ${"readable"===s?"bg-card text-foreground shadow-lv1":"text-muted-foreground hover:text-foreground"}`,children:j("common.readable")}),(0,e.jsx)("button",{onClick:()=>u("json"),className:`px-2 py-1 text-xs rounded transition-colors ${"json"===s?"bg-card text-foreground shadow-lv1":"text-muted-foreground hover:text-foreground"}`,children:"JSON"})]}),(0,e.jsx)("button",{onClick:d,className:"p-1 text-foreground-subtle hover:text-foreground hover:bg-hover rounded transition-colors",children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),(0,e.jsx)("div",{className:"flex-1 overflow-auto p-4",children:"file"===s&&m?(0,e.jsx)(t,{filePath:m}):"diff-unified"===s&&l?(0,e.jsx)(i.xU,{oldContent:l.old_string,newContent:l.new_string,filePath:l.file_path}):"diff-split"===s&&l?(0,e.jsx)(i.xZ,{oldContent:l.old_string,newContent:l.new_string,filePath:l.file_path}):"readable"===s&&k?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(p._,{search:x}),(0,e.jsx)("pre",{ref:w,className:"text-foreground whitespace-pre-wrap break-words",style:{fontSize:"0.8125rem"},children:(0,r.xb)(b)})]}):(0,e.jsx)("pre",{className:"text-foreground whitespace-pre-wrap break-words",style:{fontSize:"0.8125rem"},children:k?(0,r.C6)(b):b})})]})});return(0,e.jsx)(h.ZL,{children:y})}d()}catch(a){d(a)}})},61591:(a,b,c)=>{"use strict";c.d(b,{o:()=>g});var d=c(48249);c(67484);let e={ts:"#3178c6",tsx:"#3178c6",js:"#f1e05a",jsx:"#61dafb",mjs:"#f1e05a",cjs:"#f1e05a",html:"#e44d26",css:"#563d7c",scss:"#cd6799",sass:"#cd6799",less:"#1d365d",vue:"#41b883",svelte:"#ff3e00",json:"#cbcb41",yaml:"#cb171e",yml:"#cb171e",toml:"#9c4121",xml:"#e37933",env:"#ecd53f",md:"#519aba",mdx:"#519aba",txt:"#89898a",py:"#3572a5",go:"#00add8",rs:"#dea584",java:"#b07219",kt:"#a97bff",kts:"#a97bff",c:"#555555",h:"#555555",cpp:"#f34b7d",hpp:"#f34b7d",rb:"#701516",php:"#4f5d95",sh:"#89e051",bash:"#89e051",zsh:"#89e051",png:"#a074c4",jpg:"#a074c4",jpeg:"#a074c4",gif:"#a074c4",svg:"#ffb13b",webp:"#a074c4",ico:"#a074c4",lock:"#89898a",gitignore:"#f14e32",dockerfile:"#2496ed",sql:"#e38c00",graphql:"#e535ab",gql:"#e535ab",default:"#8a8a8a"},f={"package.json":"#cb3837","package-lock.json":"#cb3837","tsconfig.json":"#3178c6","jsconfig.json":"#f1e05a",".gitignore":"#f14e32",".eslintrc":"#4b32c3",".eslintrc.js":"#4b32c3",".eslintrc.json":"#4b32c3",".prettierrc":"#56b3b4",dockerfile:"#2496ed",".env":"#ecd53f",".env.local":"#ecd53f",".env.development":"#ecd53f",".env.production":"#ecd53f","readme.md":"#519aba",license:"#d4af37",makefile:"#6d8086","cargo.toml":"#dea584","go.mod":"#00add8","go.sum":"#00add8","requirements.txt":"#3572a5","yarn.lock":"#2c8ebb","pnpm-lock.yaml":"#f9ad00","vite.config.ts":"#646cff","vite.config.js":"#646cff","next.config.js":"#000000","next.config.mjs":"#000000","tailwind.config.js":"#38bdf8","tailwind.config.ts":"#38bdf8"};function g({name:a,className:b="",size:c=16}){let h,i=f[h=a.toLowerCase()]?f[h]:e[a.split(".").pop()?.toLowerCase()||""]||e.default,j=a.split(".").pop()?.toLowerCase()||"";return["ts","tsx"].includes(j)?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("rect",{x:"2",y:"2",width:"20",height:"20",rx:"2",fill:i}),(0,d.jsx)("path",{d:"M7 10h10M12 10v8",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}):["js","jsx","mjs","cjs"].includes(j)?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("rect",{x:"2",y:"2",width:"20",height:"20",rx:"2",fill:i}),(0,d.jsx)("path",{d:"M10 10v6c0 1-1 2-2 2M14 10v4c0 2 4 2 4 0v-4",stroke:"#323330",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}):"jsx"===j||"tsx"===j&&a.includes("component")?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("ellipse",{cx:"12",cy:"12",rx:"10",ry:"4",stroke:"#61dafb",strokeWidth:"1.5",fill:"none"}),(0,d.jsx)("ellipse",{cx:"12",cy:"12",rx:"10",ry:"4",stroke:"#61dafb",strokeWidth:"1.5",fill:"none",transform:"rotate(60 12 12)"}),(0,d.jsx)("ellipse",{cx:"12",cy:"12",rx:"10",ry:"4",stroke:"#61dafb",strokeWidth:"1.5",fill:"none",transform:"rotate(120 12 12)"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"2",fill:"#61dafb"})]}):"json"===j?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("path",{d:"M6 4C4 4 4 6 4 8v2c0 1-1 2-2 2 1 0 2 1 2 2v2c0 2 0 4 2 4",stroke:i,strokeWidth:"2",fill:"none",strokeLinecap:"round"}),(0,d.jsx)("path",{d:"M18 4c2 0 2 2 2 4v2c0 1 1 2 2 2-1 0-2 1-2 2v2c0 2 0 4-2 4",stroke:i,strokeWidth:"2",fill:"none",strokeLinecap:"round"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"1.5",fill:i})]}):["md","mdx"].includes(j)?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",stroke:i,strokeWidth:"1.5",fill:"none"}),(0,d.jsx)("path",{d:"M5 15V9l3 4 3-4v6M17 12l-2-3v6M17 12l2-3v6",stroke:i,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}):["py","pyi","pyx"].includes(j)?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("path",{d:"M12 4c-4 0-4 2-4 3v2h5v1H6c-2 0-3 2-3 4s1 4 3 4h2v-2c0-2 1-3 3-3h4c1 0 2-1 2-2V7c0-2-2-3-5-3z",fill:"#3572a5"}),(0,d.jsx)("path",{d:"M12 20c4 0 4-2 4-3v-2h-5v-1h7c2 0 3-2 3-4s-1-4-3-4h-2v2c0 2-1 3-3 3h-4c-1 0-2 1-2 2v4c0 2 2 3 5 3z",fill:"#ffd43b"}),(0,d.jsx)("circle",{cx:"9",cy:"7",r:"1",fill:"white"}),(0,d.jsx)("circle",{cx:"15",cy:"17",r:"1",fill:"white"})]}):"go"===j?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("ellipse",{cx:"12",cy:"12",rx:"8",ry:"6",fill:i}),(0,d.jsx)("circle",{cx:"9",cy:"11",r:"1.5",fill:"white"}),(0,d.jsx)("circle",{cx:"15",cy:"11",r:"1.5",fill:"white"}),(0,d.jsx)("circle",{cx:"9",cy:"11",r:"0.7",fill:"#333"}),(0,d.jsx)("circle",{cx:"15",cy:"11",r:"0.7",fill:"#333"})]}):"rs"===j?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"9",stroke:i,strokeWidth:"2",fill:"none"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"3",fill:i}),(0,d.jsx)("path",{d:"M12 3v3M12 18v3M3 12h3M18 12h3",stroke:i,strokeWidth:"2",strokeLinecap:"round"})]}):["png","jpg","jpeg","gif","webp","ico","bmp"].includes(j)?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2",stroke:i,strokeWidth:"1.5",fill:"none"}),(0,d.jsx)("circle",{cx:"8",cy:"9",r:"2",fill:i}),(0,d.jsx)("path",{d:"M3 16l5-5 3 3 4-4 6 6",stroke:i,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}):"svg"===j?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2",stroke:i,strokeWidth:"1.5",fill:"none"}),(0,d.jsx)("path",{d:"M7 12 Q12 6 17 12 Q12 18 7 12",stroke:i,strokeWidth:"1.5",fill:"none"})]}):"html"===j?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("path",{d:"M4 3l1.5 17L12 22l6.5-2L20 3H4z",fill:i}),(0,d.jsx)("path",{d:"M8 7h8l-.5 6-3.5 1-3.5-1-.2-2",stroke:"white",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]}):["css","scss","sass","less"].includes(j)?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("path",{d:"M4 3l1.5 17L12 22l6.5-2L20 3H4z",fill:i}),(0,d.jsx)("path",{d:"M15 8H9l.3 3h5.2l-.4 4-2.1.7-2.1-.7-.1-2",stroke:"white",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]}):["yaml","yml"].includes(j)?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:i,strokeWidth:"1.5",fill:"none"}),(0,d.jsx)("path",{d:"M7 8l3 4v5M17 8l-3 4v5",stroke:i,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}):["sh","bash","zsh","fish"].includes(j)?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",fill:"#1e1e1e",stroke:"#555",strokeWidth:"1"}),(0,d.jsx)("path",{d:"M6 9l3 3-3 3M12 15h5",stroke:i,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}):"gitignore"===j||".gitignore"===a.toLowerCase()?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"9",fill:i}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"3",fill:"white"}),(0,d.jsx)("path",{d:"M12 6v3M12 15v3M6 12h3M15 12h3",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}):"dockerfile"===j||"dockerfile"===a.toLowerCase()||a.toLowerCase().startsWith("dockerfile")?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("path",{d:"M3 12h3v3H3zM7 12h3v3H7zM11 12h3v3h-3zM7 8h3v3H7zM11 8h3v3h-3zM11 4h3v3h-3zM15 12h3v3h-3z",fill:i}),(0,d.jsx)("path",{d:"M21 13c-1-2-3-2-4-2h-1c0-1 0-2-2-3h-1v1c0 1-1 2-2 2H3c-1 3 0 6 2 8s5 3 9 3c5 0 8-2 10-6",stroke:i,strokeWidth:"1.5",fill:"none"})]}):"env"===j||a.startsWith(".env")?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:i,strokeWidth:"1.5",fill:"none"}),(0,d.jsx)("circle",{cx:"8",cy:"8",r:"2",fill:i}),(0,d.jsx)("path",{d:"M12 8h6M8 12h8M8 16h5",stroke:i,strokeWidth:"1.5",strokeLinecap:"round"})]}):"sql"===j?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("ellipse",{cx:"12",cy:"7",rx:"8",ry:"3",stroke:i,strokeWidth:"1.5",fill:"none"}),(0,d.jsx)("path",{d:"M4 7v10c0 1.7 3.6 3 8 3s8-1.3 8-3V7",stroke:i,strokeWidth:"1.5",fill:"none"}),(0,d.jsx)("path",{d:"M4 12c0 1.7 3.6 3 8 3s8-1.3 8-3",stroke:i,strokeWidth:"1.5",fill:"none"})]}):"vue"===j?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("path",{d:"M2 4h4l6 10 6-10h4L12 22 2 4z",fill:i}),(0,d.jsx)("path",{d:"M6 4h4l2 4 2-4h4l-6 10L6 4z",fill:"#35495e"})]}):(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("path",{d:"M6 3h8l5 5v13H6V3z",stroke:i,strokeWidth:"1.5",fill:"none"}),(0,d.jsx)("path",{d:"M14 3v5h5",stroke:i,strokeWidth:"1.5",fill:"none"})]})}},61632:(a,b,c)=>{"use strict";c.d(b,{y:()=>k});var d=c(67484),e=c(20586),f=c(9804),g=c(208),h=c(79606),i=c(33281),j=c(85655);function k({cwd:a,addToRecentFiles:b}){let[c,l]=(0,d.useState)(null),[m,n]=(0,d.useState)(""),[o,p]=(0,d.useState)([]),[q,r]=(0,d.useState)(null),[s,t]=(0,d.useState)([]),[u,v]=(0,d.useState)([]),[w,x]=(0,d.useState)(new Set),[y,z]=(0,d.useState)(null),[A,B]=(0,d.useState)(null),[C,D]=(0,d.useState)(!1),[E,F]=(0,d.useState)(!1),[G,H]=(0,d.useState)(!1),[I,J]=(0,d.useState)(!0),[K,L]=(0,d.useState)(!1),[M,N]=(0,d.useState)(!1),[O,P]=(0,d.useState)(null),Q=(0,d.useRef)(null),[R,S]=(0,d.useState)(null),[T,U]=(0,d.useState)(!1),[V,W]=(0,d.useState)(""),[X,Y]=(0,d.useState)(""),[Z,$]=(0,d.useState)([]),[_,aa]=(0,d.useState)([]),[ab,ac]=(0,d.useState)(new Set),[ad,ae]=(0,d.useState)(null),[af,ag]=(0,d.useState)(null),[ah,ai]=(0,d.useState)(!1),[aj,ak]=(0,d.useState)(!1),al=(0,d.useCallback)(()=>{D(!0),P(null),i.t4.runPromise((0,j.r4)(a).pipe(h.match({onSuccess:a=>{a.local&&a.current?(l(a),n(a.current),a.upstream&&W(a.upstream)):(P(g.A.t("git.cannotGetBranches")),l(null))},onFailure:a=>{console.error(a),"NotFoundError"===a._tag?P(g.A.t("git.notGitRepo")):P(g.A.t("git.getBranchesFailed")),l(null)}}))).finally(()=>D(!1))},[a]),am=(0,d.useCallback)(b=>{F(!0),r(null),t([]),v([]),z(null),B(null),J(!0),i.t4.runPromise((0,j.Bj)(a,b,f.B_).pipe(h.match({onSuccess:a=>{let b=a.commits||[];p(b),J(b.length>=f.B_)},onFailure:a=>{console.error(a)}}))).finally(()=>F(!1))},[a]),an=(0,d.useCallback)(()=>{if(G||!I||!m)return;H(!0);let b=o.length;i.t4.runPromise((0,j.Bj)(a,m,f.B_,b).pipe(h.match({onSuccess:a=>{let b=a.commits||[];b.length>0&&p(a=>[...a,...b]),J(b.length>=f.B_)},onFailure:a=>{console.error(a)}}))).finally(()=>H(!1))},[a,m,o.length,G,I]),ao=(0,d.useCallback)(a=>{let{scrollTop:b,scrollHeight:c,clientHeight:d}=a.target;c-b-d<100&&an()},[an]),ap=(0,d.useCallback)(b=>{r(b),z(null),B(null),L(!0),i.t4.runPromise((0,j.Zi)(a,b.hash).pipe(h.match({onSuccess:a=>{let b=a.files||[];t(b);let c=(0,e.Do)(b);v(c),x(new Set((0,e.Sz)(c)))},onFailure:a=>{console.error(a)}}))).finally(()=>L(!1))},[a]),aq=(0,d.useCallback)(c=>{q&&(z(c),b(c.path),N(!0),i.t4.runPromise((0,j.Zi)(a,q.hash,c.path).pipe(h.match({onSuccess:a=>B(a),onFailure:a=>{console.error(a)}}))).finally(()=>N(!1)))},[a,q,b]),ar=(0,d.useCallback)(a=>{x(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),as=(0,d.useCallback)(b=>{ai(!0),ae(null),ag(null),i.t4.runPromise((0,j.yy)(a,b).pipe(h.match({onSuccess:a=>{let b=a.files||[];$(b);let c=(0,e.Do)(b);aa(c),ac(new Set((0,e.Sz)(c)))},onFailure:a=>{console.error(a)}}))).finally(()=>ai(!1))},[a]),at=(0,d.useCallback)(c=>{ae(c),b(c.path),ak(!0),i.t4.runPromise((0,j.yy)(a,X,c.path).pipe(h.match({onSuccess:a=>ag(a),onFailure:a=>{console.error(a)}}))).finally(()=>ak(!1))},[a,X,b]),au=(0,d.useCallback)(a=>{ac(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),av=(0,d.useCallback)(a=>{if(U(a),a){let a="origin/main";Y(a),as(a)}else $([]),aa([]),ae(null),ag(null),Y("")},[V,as]);return{branches:c,selectedBranch:m,setSelectedBranch:n,commits:o,setCommits:p,selectedCommit:q,setSelectedCommit:r,historyFiles:s,historyFileTree:u,historyExpandedPaths:w,historySelectedFile:y,historyFileDiff:A,isLoadingBranches:C,isLoadingCommits:E,isLoadingMore:G,hasMoreCommits:I,setHasMoreCommits:J,isLoadingHistoryFiles:K,isLoadingHistoryDiff:M,historyError:O,commitListRef:Q,tooltipPos:R,loadBranches:al,loadCommits:am,loadMoreCommits:an,handleCommitListScroll:ao,handleSelectCommit:ap,handleSelectHistoryFile:aq,handleHistoryToggle:ar,handleCommitInfoMouseMove:(0,d.useCallback)(a=>{S({x:a.clientX,y:a.clientY})},[]),handleCommitInfoMouseLeave:(0,d.useCallback)(()=>{S(null)},[]),compareMode:T,toggleCompareMode:av,compareBaseBranch:X,setCompareBaseBranch:Y,upstreamBranch:V,compareFiles:Z,compareFileTree:_,compareExpandedPaths:ab,compareSelectedFile:ad,compareFileDiff:af,isLoadingCompareFiles:ah,isLoadingCompareDiff:aj,handleSelectCompareFile:at,handleCompareToggle:au,loadCompareFiles:as}}},62473:(a,b,c)=>{"use strict";c.d(b,{g:()=>g});var d=c(48249),e=c(67484),f=c(44384);function g({tokenUsage:a,rateLimitInfo:b}){let{t:c}=(0,f.Bd)(),[h,i]=(0,e.useState)(()=>Date.now()),j=b?.status==="rejected"?"text-red-11":b?.status==="allowed_warning"?"text-amber-11":"text-muted-foreground",k=b?.status==="rejected"?c("chat.rateLimitRejected","Rate Limited"):b?.status==="allowed_warning"?c("chat.rateLimitWarning","Approaching Limit"):null,l=a=>{if(!a)return"";let b=(a<1e12?1e3*a:a)-h;if(b<=0)return"";let c=Math.ceil(b/6e4);if(c<60)return`${c}m`;let d=Math.floor(c/60),e=c%60;return e>0?`${d}h${e}m`:`${d}h`},m=a=>a?a.replace(/_/g," "):"";return(0,d.jsx)("div",{className:"px-4 py-1.5 border-t border-border ",children:(0,d.jsxs)("div",{className:"flex items-center justify-end gap-4 text-xs text-muted-foreground",children:[b&&k&&(0,d.jsxs)("span",{className:`flex items-center gap-1 ${j}`,"data-tooltip":[b.rateLimitType&&`Type: ${m(b.rateLimitType)}`,null!=b.utilization&&`Usage: ${(100*b.utilization).toFixed(0)}%`,b.resetsAt&&`Resets in: ${l(b.resetsAt)}`,b.isUsingOverage&&"Using overage"].filter(Boolean).join(" \xb7 "),children:["rejected"===b.status?(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}):(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,d.jsxs)("span",{children:[(0,d.jsx)("strong",{children:k}),null!=b.utilization&&` ${(100*b.utilization).toFixed(0)}%`,b.resetsAt&&` \xb7 ${l(b.resetsAt)}`]})]}),b&&!k&&b.resetsAt&&(0,d.jsxs)("span",{className:"flex items-center gap-1.5","data-tooltip":[b.rateLimitType&&m(b.rateLimitType),null!=b.utilization&&`Usage: ${(100*b.utilization).toFixed(0)}%`,`Resets in: ${l(b.resetsAt)}`].filter(Boolean).join(" \xb7 "),children:[(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),null!=b.utilization?(0,d.jsxs)("span",{children:[(100*b.utilization).toFixed(0),"%"]}):(0,d.jsx)("span",{children:l(b.resetsAt)})]}),(0,d.jsxs)("span",{className:"flex items-center gap-1",children:[(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})}),(0,d.jsxs)("span",{children:[c("chat.context"),": ",(0,d.jsx)("strong",{className:"text-foreground",children:(a.inputTokens+a.cacheReadInputTokens+a.cacheCreationInputTokens).toLocaleString()})]})]}),(0,d.jsxs)("span",{className:"flex items-center gap-1",children:[(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})}),(0,d.jsxs)("span",{children:[c("chat.output"),": ",(0,d.jsx)("strong",{className:"text-foreground",children:a.outputTokens.toLocaleString()})]})]}),(a.cacheReadInputTokens>0||a.cacheCreationInputTokens>0)&&(0,d.jsxs)("span",{className:"flex items-center gap-1 text-brand",children:[(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4"})}),(0,d.jsxs)("span",{children:["Cache: ",(a.cacheReadInputTokens/(a.inputTokens+a.cacheReadInputTokens+a.cacheCreationInputTokens)*100).toFixed(0),"%"]})]}),a.totalCostUsd>0&&(0,d.jsxs)("span",{className:"flex items-center gap-1 text-green-11",children:[(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,d.jsxs)("span",{children:["$",a.totalCostUsd.toFixed(4)]})]})]})})}},63041:(a,b,c)=>{"use strict";c.d(b,{e:()=>h});var d=c(48249),e=c(67484),f=c(44384),g=c(35606);function h({cwd:a,sessionId:b,engine:c,onOpenProjectSessions:i,onOpenSessionBrowser:j,onOpenSettings:k}){let{t:l}=(0,f.Bd)(),[m,n]=(0,e.useState)(!1),o=b?(0,g.X)(c,b):null;return(0,d.jsx)("div",{className:"border-b border-border px-4 py-3 bg-card",children:(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("img",{src:"/icons/icon-72x72.png",alt:"Cockpit",className:"w-6 h-6"}),(0,d.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,d.jsx)("h1",{className:"text-lg font-semibold text-foreground",children:"Cockpit"}),(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:"One seat. One AI. Everything under control."})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[a&&(0,d.jsx)("span",{className:"text-sm text-foreground max-w-md truncate cursor-help","data-tooltip":`CWD: ${a}`,children:a}),!a&&b&&(0,d.jsxs)("span",{className:"text-xs text-muted-foreground",children:["Session: ",b.slice(0,8),"..."]}),a&&(0,d.jsx)("button",{onClick:i,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-hover rounded-lg transition-colors",title:l("sessions.projectSessions"),children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})}),(0,d.jsx)("button",{onClick:j,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-hover rounded-lg transition-colors",title:l("sessions.browseAllSessions"),children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})})}),o&&(0,d.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(o).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)})},className:`p-2 rounded-lg transition-colors ${m?"text-green-11 bg-green-500/10":"text-muted-foreground hover:text-foreground hover:bg-hover"}`,title:m?l("chat.copiedCommandTooltip"):l("chat.copyCommandTooltip",{command:o}),children:m?(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3m2 4H10m0 0l3-3m-3 3l3 3"})})}),(0,d.jsx)("button",{onClick:k,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-hover rounded-lg transition-colors",title:l("settings.title"),children:(0,d.jsxs)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})})]})]})})}},63565:(a,b,c)=>{"use strict";c.d(b,{$T:()=>n,Aw:()=>o,CX:()=>j,Fx:()=>m,H:()=>g,XY:()=>s,ch:()=>h,eV:()=>q,hG:()=>r,pe:()=>k,yI:()=>l,ys:()=>p});var d=c(48249);c(67484);var e=c(42742),f=c(44218);let g={claude:"Claude",codex:"Codex",deepseek:"DeepSeek",kimi:"Kimi",glm:"GLM",ollama:"Ollama"};function h(a){return!!a&&a in g}let i={claude:0,codex:1,deepseek:2,glm:3,kimi:4,ollama:5},j=Object.keys(i).sort((a,b)=>i[a]-i[b]),k={claude:"text-[#c6532d] dark:text-[#D97757]",codex:"text-emerald-600 dark:text-emerald-400",deepseek:"text-sky-600 dark:text-sky-400",kimi:"text-purple-600 dark:text-purple-400",glm:"text-amber-600 dark:text-amber-400",ollama:"text-violet-600 dark:text-violet-400"},l="bg-accent font-medium text-foreground",m="focus:border-brand",n="bg-brand text-white hover:bg-brand/90",o="text-rose-600 dark:text-rose-400",p="fixed z-[9999] max-h-[70vh] overflow-y-auto rounded-lg border border-border bg-popover py-2 shadow-lv2";function q({engine:a,className:b="h-3.5 w-3.5"}){return(0,d.jsx)("img",{alt:"","aria-hidden":"true",src:`/agent-icons/${a}.svg`,className:`${b} flex-shrink-0`})}function r({selected:a}){return(0,d.jsx)("span",{className:"flex h-3.5 w-3.5 flex-shrink-0 items-center justify-center text-foreground",children:a&&(0,d.jsx)(e.A,{className:"h-3.5 w-3.5"})})}function s({label:a,title:b,onClick:c,buttonRef:e,icon:g,labelClassName:h,labelMaxWidth:i="max-w-[160px]",testId:j}){return(0,d.jsxs)("button",{ref:e,type:"button",onClick:c,className:"flex items-center gap-1 rounded px-2 py-0.5 text-[11px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",title:b,"data-testid":j,children:[g,(0,d.jsx)("span",{className:`truncate ${i} ${h??""}`,children:a}),(0,d.jsx)(f.A,{className:"h-3 w-3 flex-shrink-0"})]})}},64340:(a,b,c)=>{"use strict";c.d(b,{r:()=>e});var d=c(67484);function e(){let[a,b]=(0,d.useState)(),[c,e]=(0,d.useState)(),[f,g]=(0,d.useState)(!1),h=!!a&&!!c&&function(a,b){let c=a=>a.replace(/^v/,"").split("-")[0].split(".").map(a=>parseInt(a,10)||0),d=c(a),e=c(b),f=Math.max(d.length,e.length);for(let a=0;a<f;a++){let b=d[a]??0,c=e[a]??0;if(b!==c)return b-c}return 0}(c,a)>0;return{current:a,latest:f?c??"999.0.0":c,hasUpdate:!!f||h}}c(33281),c(65484)},64676:(a,b,c)=>{"use strict";c.d(b,{J4:()=>g,Kx:()=>o,OP:()=>r,PB:()=>q,Xe:()=>k,hE:()=>p,qF:()=>h,xh:()=>m});let d=`
49
+ ${f}`),bq(h,c)}else bq(au("chat.executedCommandFailed",{command:e,error:g.cause}),c);return}bq(a,c)},[bq,b,au,a9,aM]),bt=(0,f.useCallback)(()=>{aM(!1),bq(au("chat.approvePlanPrompt",{defaultValue:"已批准,按上述计划开始执行。"}),void 0,{permissionMode:null})},[bq,aM,au]),bu=a6||ax,bv=ag&&!bk&&!!bu;(0,j.u)(bu,aw,bv,a8,{onRunningChange:a=>{a0.current=a,aX(a)},onLiveOutputTokens:aZ,onRunStartedAt:a_,onComplete:()=>{b&&bu&&a5(b,bu,!0,10)}}),(0,f.useRef)(ag),(0,f.useRef)(0);let bw=bl||aH,bx=bk?bm:aW?aY:null,by=bk?bn:aW?a$:null;(0,f.useRef)(!1);let bz=(0,f.useCallback)(async(a,c)=>{let d=a6??ax;if(!b||!d)return;let e=await k.t4.runPromiseExit((0,l.Zr)(d,{cwd:b,fromMessageUuid:a,scope:c}));if("Success"===e._tag&&e.value.newSessionId){let a=e.value.newSessionId;ao?ao(a,"single"===c?"Excerpt":"Fork"):(0,m.F)(n.n.OpenProject,{cwd:b,sessionId:a})}else"Failure"===e._tag&&(console.error("Fork failed:",e.cause),(0,i.oR)("single"===c?au("toast.excerptFailed",{defaultValue:"Failed to excerpt this turn"}):au("toast.forkFailed",{defaultValue:"Failed to fork session"}),"error"))},[b,a6,ax,ao,au]),bA=(0,f.useRef)(bz);bA.current=bz;let bB=(0,f.useRef)((a,b)=>bA.current(a,b)).current,bC=(0,f.useCallback)(()=>{aE(!0)},[]),bD=(0,f.useCallback)(()=>{aG(!0)},[]),bE=(0,f.useMemo)(()=>{if(an&&b&&a)return c=>{an({...c,cwd:b,tabId:a,sessionId:ax??crypto.randomUUID(),engine:a8,..."ollama"===a8&&G&&{model:G},...bg&&bh&&{model:bh},...a9&&{model:bb},...ba&&{model:be}})}},[an,b,a,ax,a8,G,bg,bh,a9,bb,ba,be]),bF=bj?(0,e.jsxs)("label",{className:"flex items-center gap-1.5 text-xs cursor-pointer select-none",title:au("chat.noHistoryHint",{defaultValue:"Independent task: each message is sent to the model on its own, with no prior conversation. The transcript above still records everything."}),children:[(0,e.jsx)("input",{type:"checkbox","data-testid":"nohistory-toggle",checked:aP,onChange:a=>aQ(a.target.checked),className:"accent-brand"}),(0,e.jsxs)("span",{className:"flex items-center gap-1 text-foreground",children:[(0,e.jsx)(g.A,{className:"w-3.5 h-3.5"}),au("chat.noHistory",{defaultValue:"Independent task"})]}),(0,e.jsx)("span",{className:"text-muted-foreground",children:au("chat.noHistoryDesc",{defaultValue:"no history sent"})})]}):null;return(0,e.jsxs)("div",{className:`flex ${ae&&af?"h-full":"h-screen"} bg-card`,children:[(0,e.jsxs)("div",{id:"chat-screen",className:"flex-1 flex flex-col min-w-0 relative",onMouseEnter:()=>aA(!0),onMouseLeave:()=>aA(!1),children:[!ae&&(0,e.jsx)(o.e,{cwd:b,sessionId:ax,engine:a8,onOpenProjectSessions:()=>aC(!0),onOpenSessionBrowser:as,onOpenSettings:at}),(a9||ba)&&(0,e.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-border bg-card/50",children:[(0,e.jsx)(z.Yd,{engine:ba?"codex":"claude",claudeModel:bb,onClaudeModelChange:P,claudeEffort:bc,onClaudeEffortChange:R,claudeContextWindow:bd,onClaudeContextWindowChange:T,claudeFastMode:U,onClaudeFastModeChange:V,claudeThinking:W,onClaudeThinkingChange:X,codexModel:be,onCodexModelChange:Z,codexReasoningEffort:bf,onCodexReasoningEffortChange:_}),a9&&(0,e.jsxs)("label",{className:"flex items-center gap-1.5 text-xs cursor-pointer select-none",title:au("chat.planModeHint",{defaultValue:"Plan mode: read-only exploration that produces a plan without editing. Uncheck and resend to implement."}),children:[(0,e.jsx)("input",{type:"checkbox","data-testid":"planmode-toggle",checked:aL,onChange:a=>aM(a.target.checked),className:"accent-brand"}),(0,e.jsxs)("span",{className:"flex items-center gap-1 text-foreground",children:[(0,e.jsx)(h.A,{className:"w-3.5 h-3.5"}),au("chat.planMode",{defaultValue:"Plan mode"})]}),(0,e.jsx)("span",{className:"text-muted-foreground",children:au("chat.planModeDesc",{defaultValue:"read-only \xb7 plan first, no edits"})})]}),bF]}),"ollama"===a8&&(0,e.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-border bg-card/50",children:[H&&(0,e.jsx)(x.m,{currentModel:G,onModelChange:H}),bF]}),bg&&(0,e.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-border bg-card/50",children:[bi&&(0,e.jsx)(y.Z,{engine:bg,currentModel:bh,onModelChange:bi,onHasKeyChange:aS}),bF,(0,e.jsx)("div",{className:"ml-auto pl-2",children:"deepseek"===bg?(0,e.jsx)(A.f,{hasKey:aR}):(0,e.jsx)(B.J,{engine:bg,hasKey:aR})})]}),a1?(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,e.jsx)("span",{className:"text-muted-foreground",children:au("sessions.loadingHistory")})}):(0,e.jsx)(u.M,{ref:aT,messages:av,isLoading:bk||aW,liveOutputTokens:bx,runningStartedAt:by,cwd:b,sessionId:ax,engine:a8,apiRetryInfo:bp,hasMoreHistory:a3,isLoadingMore:a2,onLoadMore:a4,onFork:bB,isActive:ag,onContentSearch:ap,onShowFileDiff:aq,onOpenFileLink:ar,onApprovePlan:bt}),bw&&(0,e.jsx)(p.g,{tokenUsage:bw,rateLimitInfo:bo}),(0,e.jsx)(v.V,{onSend:bs,disabled:bk||aW,cwd:b,engine:a8,onShowGitStatus:al,onShowComments:b?bC:void 0,onShowUserMessages:bD,onOpenNote:am,onCreateScheduledTask:bE})]}),!ae&&b&&(0,e.jsx)(w.Q,{isOpen:aB,onClose:()=>aC(!1),cwd:b}),b&&(0,e.jsx)(C.i,{isOpen:aD,onClose:()=>aE(!1),cwd:b}),(0,e.jsx)(q.f,{isOpen:aF,onClose:()=>aG(!1),messages:av,onSelectMessage:a=>{aT.current?.scrollToMessage(a)}})]})}u=(E.then?(await E)():E)[0],d()}catch(a){d(a)}})},58904:(a,b,c)=>{"use strict";c.d(b,{e:()=>k});var d=c(67484),e=c(20586),f=c(7833),g=c(208),h=c(79606),i=c(33281),j=c(85655);function k({cwd:a,addToRecentFiles:b}){let[c,l]=(0,d.useState)(null),[m,n]=(0,d.useState)(!1),[o,p]=(0,d.useState)(null),[q,r]=(0,d.useState)(null),[s,t]=(0,d.useState)(null),[u,v]=(0,d.useState)(!1),[w,x]=(0,d.useState)(new Set),[y,z]=(0,d.useState)(new Set),[A,B]=(0,d.useState)([]),[C,D]=(0,d.useState)([]),E=(0,d.useMemo)(()=>{let a=new Set((0,e.Sz)(A));for(let b of w)a.delete(b);return a},[A,w]),F=(0,d.useMemo)(()=>{let a=new Set((0,e.Sz)(C));for(let b of y)a.delete(b);return a},[C,y]),[G,H]=(0,d.useState)(!1),[I,J]=(0,d.useState)(0),K=(0,d.useCallback)(async()=>{n(!0),p(null),await i.t4.runPromise((0,j.lv)(a).pipe(h.match({onSuccess:a=>{l(a);let b=(0,e.Do)(a.staged),c=(0,e.Do)(a.unstaged);B(b),D(c)},onFailure:a=>{p(a.cause instanceof Error?a.cause.message:"Unknown error")}}))),n(!1)},[a]),L=(0,d.useCallback)(a=>{x(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),M=(0,d.useCallback)(a=>{z(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),N=(0,d.useCallback)((a,c)=>{r({file:a,type:c}),b(a.path)},[b]),O=(0,d.useCallback)(async(a,b,c,d)=>{let e=await i.t4.runPromiseExit(a);"Success"===e._tag?(await K(),(0,f.oR)(b,"success")):(console.error(c,e.cause),(0,f.oR)(d,"error"))},[K]),P=(0,d.useCallback)(b=>O((0,j.Iz)(a,[b]),g.A.t("toast.staged"),"Error staging file:",g.A.t("toast.stageFailed")),[a,O]),Q=(0,d.useCallback)(b=>O((0,j.X0)(a,[b]),g.A.t("toast.unstaged"),"Error unstaging file:",g.A.t("toast.unstageFailed")),[a,O]),R=(0,d.useCallback)(async b=>{0!==b.length&&await O((0,j.Iz)(a,b),g.A.t("toast.stagedNFiles",{count:b.length}),"Error staging files:",g.A.t("toast.stageFailed"))},[a,O]),S=(0,d.useCallback)(async b=>{0!==b.length&&await O((0,j.X0)(a,b),g.A.t("toast.unstagedNFiles",{count:b.length}),"Error unstaging files:",g.A.t("toast.unstageFailed"))},[a,O]),T=(0,d.useCallback)(async b=>{if(0===b.length)return;let c=b.filter(a=>"untracked"===a.status).map(a=>a.path),d=b.filter(a=>"untracked"!==a.status).map(a=>a.path),e=h.gen(function*(){c.length>0&&(yield*(0,j.Ub)(a,c,!0)),d.length>0&&(yield*(0,j.Ub)(a,d,!1))});await O(e,g.A.t("toast.discardedNFiles",{count:b.length}),"Error discarding files:",g.A.t("toast.discardFailed"))},[a,O]),U=(0,d.useCallback)(async()=>{c?.unstaged.length&&await O((0,j.Iz)(a,c.unstaged.map(a=>a.path)),g.A.t("toast.stagedNFiles",{count:c.unstaged.length}),"Error staging all files:",g.A.t("toast.stageFailed"))},[a,c,O]),V=(0,d.useCallback)(async()=>{c?.staged.length&&await O((0,j.X0)(a,c.staged.map(a=>a.path)),g.A.t("toast.unstagedNFiles",{count:c.staged.length}),"Error unstaging all files:",g.A.t("toast.unstageFailed"))},[a,c,O]),W=(0,d.useCallback)(async b=>{let c="untracked"===b.status;await O((0,j.Ub)(a,[b.path],c),c?g.A.t("toast.deletedFile"):g.A.t("toast.discardedChanges"),"Error discarding file:",g.A.t("toast.discardFailed"))},[a,O]),X=(0,d.useCallback)(async()=>{if(!c?.unstaged.length||!await (0,f.lJ)(g.A.t("git.discardAllConfirm",{count:c.unstaged.length}),{danger:!0}))return;let b=c.unstaged.filter(a=>"untracked"===a.status).map(a=>a.path),d=c.unstaged.filter(a=>"untracked"!==a.status).map(a=>a.path),e=c.unstaged.length,i=h.gen(function*(){d.length>0&&(yield*(0,j.Ub)(a,d,!1)),b.length>0&&(yield*(0,j.Ub)(a,b,!0))});await O(i,g.A.t("toast.discardedNFiles",{count:e}),"Error discarding all:",g.A.t("toast.discardFailed"))},[a,c,O]);return{status:c,setStatus:l,statusLoading:m,statusError:o,statusSelectedFile:q,statusDiff:s,statusDiffLoading:u,stagedExpandedPaths:E,unstagedExpandedPaths:F,stagedTree:A,setStagedTree:B,unstagedTree:C,setUnstagedTree:D,showStatusDiffPreview:G,setShowStatusDiffPreview:H,fetchStatus:K,handleStagedToggle:L,handleUnstagedToggle:M,handleStatusFileSelect:N,handleStage:P,handleUnstage:Q,handleStageFiles:R,handleUnstageFiles:S,handleDiscardFiles:T,handleStageAll:U,handleUnstageAll:V,handleDiscardFile:W,handleDiscardAll:X,refreshDiff:(0,d.useCallback)(()=>J(a=>a+1),[])}}},59336:(a,b,c)=>{"use strict";function d(){}function e(a){return()=>{}}c.d(b,{U:()=>e,k:()=>d})},60333:(a,b,c)=>{"use strict";c.d(b,{q:()=>f});var d=c(48249),e=c(44384);function f({value:a,onChange:b,className:c}){let{t:g}=(0,e.Bd)();return(0,d.jsx)("div",{className:`flex items-center gap-0.5 rounded border border-border overflow-hidden ${c??""}`,children:["split","unified"].map(c=>(0,d.jsx)("button",{onClick:a=>{a.stopPropagation(),b(c)},className:`px-2 py-0.5 text-xs transition-colors ${a===c?"bg-brand text-white":"text-muted-foreground hover:bg-hover"}`,children:g("split"===c?"diffViewer.viewSplit":"diffViewer.viewUnified")},c))})}},60591:(a,b,c)=>{"use strict";c.d(b,{C6:()=>h,C_:()=>v,Hz:()=>u,WU:()=>w,Zy:()=>t,aR:()=>s,cG:()=>i,d9:()=>j,e$:()=>r,jU:()=>g,oK:()=>x,u:()=>q,xb:()=>k,zs:()=>o});var d=c(67484),e=c.n(d),f=c(208);function g(a){try{return JSON.parse(a),!0}catch{return!1}}function h(a){try{let b=JSON.parse(a);return JSON.stringify(b,null,2)}catch{return a}}let i={key:"hsl(var(--blue-11))",str:"hsl(var(--green-11))",num:"hsl(var(--violet-11))",bool:"hsl(var(--red-11))",punct:"hsl(var(--slate-11))",fold:"hsl(var(--slate-11))"},j=e().createContext({version:0,collapsed:!1});function k(a,b=i){try{let c=JSON.parse(a);return n(c,0,b)}catch{return a}}let l=(a,b)=>e().createElement("span",{style:{color:a}},b);function m({label:a,labelColor:b,value:c,indent:d,colors:g}){let h=e().useContext(j),[i,k]=e().useState(null),o=i&&i.version===h.version?i.collapsed:h.collapsed,[p,q]=e().useState({x:0,y:0}),r="string"==typeof c&&c.replace(/\\n/g,"\n").split("\n").length>3,s={onMouseDown:a=>{q({x:a.clientX,y:a.clientY})},onClick:a=>{let b=a.clientX-p.x,c=a.clientY-p.y;b*b+c*c>25||(a.stopPropagation(),k({version:h.version,collapsed:!o}))},style:{cursor:"pointer"}};if(r&&o&&"string"==typeof c){let d=c.replace(/\\n/g,"\n").split("\n")[0],h=c.replace(/\\n/g,"\n").split("\n").length;return e().createElement("span",s,l(b,a),l(g.punct,": "),l(g.str,d),l(g.fold,` ${f.A.t("toolCall.foldedLines",{count:h})}`))}let t=e().createElement(e().Fragment,null,l(b,a),l(g.punct,": "),n(c,d,g));return r?e().createElement("span",s,t):t}function n(a,b,c){let d=" ".repeat(b);if(null===a)return l(c.bool,"null");if(void 0===a)return l(c.bool,"undefined");if("string"==typeof a){let b=a.replace(/\\n/g,"\n").replace(/\n/g,"\n"+d);return l(c.str,b)}if("number"==typeof a)return l(c.num,String(a));if("boolean"==typeof a)return l(c.bool,String(a));if(Array.isArray(a))return 0===a.length?l(c.punct,"[]"):e().createElement(e().Fragment,null,l(c.punct,"["),"\n",...a.map((f,g)=>e().createElement("span",{key:g},d+" ",e().createElement(m,{label:`[${g}]`,labelColor:c.key,value:f,indent:b+1,colors:c}),g<a.length-1?e().createElement(e().Fragment,null,l(c.punct,","),"\n"):"\n")),d,l(c.punct,"]"));if("object"==typeof a){let f=Object.entries(a);return 0===f.length?l(c.punct,"{}"):e().createElement(e().Fragment,null,l(c.punct,"{"),"\n",...f.map(([a,g],h)=>e().createElement("span",{key:a},d+" ",e().createElement(m,{label:a,labelColor:c.key,value:g,indent:b+1,colors:c}),h<f.length-1?e().createElement(e().Fragment,null,l(c.punct,","),"\n"):"\n")),d,l(c.punct,"}"))}return String(a)}function o(a){try{let b=JSON.parse(a);if(b&&"string"==typeof b.file_path&&"string"==typeof b.old_string&&"string"==typeof b.new_string)return b}catch{}return null}let p=new Set([".png",".jpg",".jpeg",".gif",".webp",".svg",".bmp",".ico",".avif"]);function q(a){let b=a.slice(a.lastIndexOf(".")).toLowerCase();return p.has(b)}function r(a){return a.toLowerCase().endsWith(".md")}function s(a){let b=a.toLowerCase();return b.endsWith(".html")||b.endsWith(".htm")}function t(a){let b=a.toLowerCase();return b.endsWith(".csv")||b.endsWith(".tsv")}function u(a){return a.toLowerCase().endsWith(".json")}function v(a){return"skill.md"===a.slice(a.lastIndexOf("/")+1).toLowerCase()}function w(a,b){let c=b.startsWith("/")?[]:a.split("/").slice(0,-1);for(let a of b.replace(/^\//,"").split("/"))""!==a&&"."!==a&&(".."===a?c.pop():c.push(a));return c.join("/")}function x(a){try{let b=JSON.parse(a);if(b&&"string"==typeof b.file_path)return b.file_path}catch{let b=a.trim();if(b.startsWith("/")&&!b.includes("\n")&&b.length<500)return b}return null}},60812:(a,b,c)=>{"use strict";c.d(b,{J:()=>l});var d=c(48249),e=c(67484),f=c(44384),g=c(33281),h=c(63565),i=c(41224);let j={kimi:"https://www.kimi.com/code/console",glm:"https://bigmodel.cn/coding-plan/personal/usage"};function k(a){let b=a.remaining??"?",c=a.limit??"?";return`${a.label} ${b}/${c}`}function l({engine:a,hasKey:b}){let{t:c}=(0,f.Bd)(),[m,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(null),[q,r]=(0,e.useState)(null),s=(0,e.useCallback)(async()=>{n(!0),r(null);let b=await g.t4.runPromiseExit((0,i.dM)(a));"Failure"===b._tag?(p(null),r(c("chat.quotaFailed",{defaultValue:"Quota unavailable — check the API key"}))):p(b.value),n(!1)},[c,a]),t=o?.windows??[],u=[o?.tier,...t.map(k)].filter(Boolean).join(" \xb7 "),v=function(a){if(!a)return null;let b=new Date(a);return Number.isNaN(b.getTime())?null:`${b.getMonth()+1}/${b.getDate()} ${String(b.getHours()).padStart(2,"0")}:${String(b.getMinutes()).padStart(2,"0")}`}(t.reduce((a,b)=>b.resetTime&&(!a||b.resetTime>a)?b.resetTime:a,null)),w=t.some(a=>0===a.remaining);return(0,d.jsxs)("div",{className:"ml-auto flex items-center gap-2",children:[m&&(0,d.jsx)("span",{className:"w-3 h-3 border border-brand border-t-transparent rounded-full animate-spin"}),!m&&q&&(0,d.jsx)("span",{className:"text-xs text-red-11",children:q}),!m&&!q&&o&&(0,d.jsx)("span",{className:`text-xs font-mono ${w?"text-red-11":h.pe[a]}`,"data-tooltip":v?c("chat.quotaResetAt",{defaultValue:"Resets {{time}}",time:v}):void 0,"data-testid":`${a}-quota-value`,children:u||c("chat.quotaEmpty",{defaultValue:"No quota returned"})}),(0,d.jsx)("button",{type:"button","data-testid":`${a}-quota-button`,disabled:!b||m,onClick:s,"data-tooltip":b?void 0:c("chat.quotaNeedsKey",{defaultValue:"Set an API key first"}),className:"px-2 py-0.5 text-xs rounded border border-border text-muted-foreground hover:bg-hover hover:text-foreground transition-colors disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-transparent",children:c("chat.checkQuota",{defaultValue:"Check quota"})}),(0,d.jsx)("a",{href:j[a],target:"_blank",rel:"noopener","data-testid":`${a}-console-link`,title:c("chat.openProviderConsole",{defaultValue:"Open the provider console"}),"aria-label":c("chat.openProviderConsole",{defaultValue:"Open the provider console"}),className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-hover transition-colors",children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})})]})}},61130:(a,b,c)=>{"use strict";c.d(b,{ReviewCommentsListModal:()=>k});var d=c(48249),e=c(67484),f=c(44384),g=c(44256),h=c(7833),i=c(208);function j(a,b,c){let d=(a,c)=>b[a]||c,e=[],f=null!=c?`[${c+1}] `:"",g=a.anchor.selectedText.length>200?a.anchor.selectedText.slice(0,197)+"...":a.anchor.selectedText;for(let b of(e.push(`${f}${i.A.t("review.quoteRef",{text:g})}`),e.push(i.A.t("review.commentAuthor",{author:d(a.authorId,a.author),content:a.content})),a.replies))e.push(i.A.t("review.replyAuthor",{author:d(b.authorId,b.author),content:b.content}));return e.join("\n")}function k({isOpen:a,onClose:b,comments:c,reviewTitle:m,userNameMap:n,onCommentClick:o}){let{t:p}=(0,f.Bd)(),[q,r]=(0,e.useState)(null),[s,t]=(0,e.useState)(!1);if(!a)return null;let u=[...c].sort((a,b)=>a.anchor.startOffset-b.anchor.startOffset),v=(a,b)=>n[a]||b,w=async a=>{r(a.id);try{let b=j(a,n);await navigator.clipboard.writeText(b),(0,h.oR)(p("toast.copiedComment"))}catch{(0,h.oR)(p("toast.copyFailed"),"error")}finally{r(null)}},x=async()=>{if(0!==c.length){t(!0);try{let a=function(a,b,c){if(0===a.length)return"";let d=[...a].sort((a,b)=>a.anchor.startOffset-b.anchor.startOffset),e=[i.A.t("review.reviewSummary",{title:b}),""];return d.forEach((a,b)=>{e.push(j(a,c,b)),e.push("")}),e.push(i.A.t("review.totalNComments",{count:a.length})),e.join("\n").trim()}(c,m,n);await navigator.clipboard.writeText(a),(0,h.oR)(p("toast.copiedAllComments"))}catch{(0,h.oR)(p("toast.copyFailed"),"error")}finally{t(!1)}}},y=a=>{o?.(a),b()},z=u.filter(a=>!a.closed),A=u.filter(a=>a.closed),B=(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-scrim p-4",onClick:b,children:(0,d.jsxs)("div",{className:"w-full max-w-2xl max-h-[80vh] bg-card border border-border rounded-lg shadow-lv3 flex flex-col overflow-hidden",onClick:a=>a.stopPropagation(),children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border ",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:p("review.allCommentsTitle")}),(0,d.jsxs)("span",{className:"text-xs text-muted-foreground",children:[p("review.commentsCountBrief",{count:c.length}),A.length>0&&` (${p("review.closedCount",{count:A.length})})`]}),c.length>0&&(0,d.jsx)("button",{onClick:x,disabled:s,className:"p-1 rounded hover:bg-hover text-muted-foreground disabled:opacity-50",title:p("review.copyAllComments"),children:s?(0,d.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):(0,d.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]}),(0,d.jsx)("button",{onClick:b,className:"p-1 rounded hover:bg-hover text-muted-foreground",children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto p-3",children:0===c.length?(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[(0,d.jsx)("div",{className:"text-2xl mb-2",children:"\uD83D\uDCAC"}),(0,d.jsx)("span",{className:"text-sm",children:p("review.noComments")})]}):(0,d.jsxs)("div",{className:"space-y-2",children:[z.map((a,b)=>(0,d.jsx)(l,{comment:a,index:b,resolveAuthor:v,copyingId:q,onCopy:w,onClick:y},a.id)),A.length>0&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"text-[11px] text-muted-foreground/60 pt-2 pb-1 px-1",children:p("review.closedComments",{count:A.length})}),A.map((a,b)=>(0,d.jsx)(l,{comment:a,index:z.length+b,resolveAuthor:v,copyingId:q,onCopy:w,onClick:y,closed:!0},a.id))]})]})})]})});return(0,d.jsx)(g.ZL,{children:B})}function l({comment:a,index:b,resolveAuthor:c,copyingId:e,onCopy:f,onClick:g,closed:h}){let j=a.anchor.selectedText.length>100?a.anchor.selectedText.slice(0,97)+"...":a.anchor.selectedText;return(0,d.jsxs)("div",{className:`rounded-lg border border-border hover:border-muted-foreground/30 transition-all cursor-pointer group ${h?"opacity-50":""}`,onClick:()=>g(a.id),children:[(0,d.jsx)("div",{className:"px-3 pt-2.5 pb-1",children:(0,d.jsx)("div",{className:"text-xs bg-yellow-500/10 border-l-2 border-yellow-500 px-2 py-1 rounded-r text-muted-foreground truncate",children:j})}),(0,d.jsxs)("div",{className:"px-3 pt-1.5 pb-2 flex items-start gap-2",children:[(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-0.5",children:[(0,d.jsx)("span",{className:"w-4 h-4 rounded-full bg-brand/20 text-brand flex items-center justify-center text-[9px] font-bold flex-shrink-0",children:c(a.authorId,a.author).charAt(0)}),(0,d.jsx)("span",{className:"text-xs font-medium",children:c(a.authorId,a.author)}),(0,d.jsx)("span",{className:"text-[10px] text-muted-foreground",children:new Date(a.createdAt).toLocaleString("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"})}),h&&(0,d.jsx)("span",{className:"text-[10px] text-muted-foreground/60",children:i.A.t("review.closedLabel")})]}),(0,d.jsx)("p",{className:"text-sm text-foreground line-clamp-2 pl-6",children:a.content}),a.replies.length>0&&(0,d.jsxs)("div",{className:"pl-6 mt-1 space-y-0.5",children:[a.replies.slice(0,3).map(a=>(0,d.jsxs)("div",{className:"text-xs text-muted-foreground truncate",children:[(0,d.jsx)("span",{className:"font-medium",children:c(a.authorId,a.author)}),": ",a.content]},a.id)),a.replies.length>3&&(0,d.jsx)("div",{className:"text-[10px] text-muted-foreground/60",children:i.A.t("review.moreReplies",{count:a.replies.length-3})})]})]}),(0,d.jsx)("button",{onClick:b=>{b.stopPropagation(),f(a)},disabled:e===a.id,className:"p-1 rounded opacity-0 group-hover:opacity-100 hover:bg-hover text-muted-foreground transition-opacity disabled:opacity-50 flex-shrink-0 mt-0.5",title:i.A.t("review.copyComment"),children:e===a.id?(0,d.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):(0,d.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]})]})}},61135:()=>{},61349:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{M:()=>v});var e=c(48249),f=c(67484),g=c(44384),h=c(44256);c(33281),c(87808);var i=c(35208),j=c(55287),k=c(98356),l=c(24680),m=c(84835),n=c(7833),o=c(64676),p=c(18921),q=c(53036),r=c(60591),s=a([j,i]);function t({filePath:a}){let[b,c]=(0,f.useState)(null),[d,g]=(0,f.useState)(!0),[h,i]=(0,f.useState)(null);(0,f.useRef)(!1);let k=(0,r.e$)(a);return((0,r.u)(a),h)?(0,e.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,e.jsx)("div",{className:"text-xs text-red-11",children:h})}):d?(0,e.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,e.jsx)("span",{className:"text-sm text-muted-foreground",children:"Loading..."})}):(0,r.u)(a)?(0,e.jsx)(q.I,{absPath:a,className:"flex items-center justify-center h-full overflow-auto",imgClassName:"max-w-full max-h-full object-contain",alt:a.split("/").pop()||"image"}):b?k?(0,e.jsx)(u,{content:b,filePath:a}):(0,e.jsx)(j.Cv,{content:b,filePath:a,showLineNumbers:!0,showSearch:!0,className:"h-full"}):(0,e.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,e.jsx)("span",{className:"text-sm text-muted-foreground",children:"No content"})})}[j,i]=s.then?(await s)():s;let w=[m.W];function u({content:a,filePath:b}){let c=(0,f.useRef)(null),d=(0,f.useMemo)(()=>(0,o.J4)(b),[b]);return(0,e.jsxs)("div",{className:"h-full flex",children:[(0,e.jsx)(l.l,{content:a,containerRef:c}),(0,e.jsx)("div",{ref:c,className:"flex-1 overflow-auto p-4",children:(0,e.jsx)(k.T,{content:a,basePath:d,rehypePlugins:w})})]})}function v({title:a,content:b,toolName:c,onClose:d}){let{t:j}=(0,g.Bd)(),k=(0,r.jU)(b),l=(0,r.zs)(b),m=(0,r.oK)(b),o=!!l,q=!!m,[s,u]=(0,f.useState)(("Read"===c||"Write"===c)&&q?"file":o?"diff-unified":k?"readable":"json"),w=(0,f.useRef)(null),x=(0,p.o)(w),y=(0,e.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-scrim p-0 md:p-4",onClick:d,children:(0,e.jsxs)("div",{className:"bg-card shadow-lv3 w-full max-w-[90%] h-full md:h-[90vh] rounded-none md:rounded-lg flex flex-col transition-all",onClick:a=>a.stopPropagation(),children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium text-foreground",children:a}),m&&(0,e.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(m),(0,n.oR)(j("common.copiedPath"))},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-hover transition-colors",title:j("common.copyAbsPath"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]}),(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[k&&(0,e.jsxs)("div",{className:"flex items-center gap-1 bg-accent rounded p-0.5",children:[o&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{onClick:()=>u("diff-split"),className:`px-2 py-1 text-xs rounded transition-colors ${"diff-split"===s?"bg-card text-foreground shadow-lv1":"text-muted-foreground hover:text-foreground"}`,title:j("diffViewer.sideBySide"),children:"Split"}),(0,e.jsx)("button",{onClick:()=>u("diff-unified"),className:`px-2 py-1 text-xs rounded transition-colors ${"diff-unified"===s?"bg-card text-foreground shadow-lv1":"text-muted-foreground hover:text-foreground"}`,title:j("diffViewer.unified"),children:"Unified"})]}),q&&(0,e.jsx)("button",{onClick:()=>u("file"),className:`px-2 py-1 text-xs rounded transition-colors ${"file"===s?"bg-card text-foreground shadow-lv1":"text-muted-foreground hover:text-foreground"}`,title:j("diffViewer.previewFile"),children:"File"}),(0,e.jsx)("button",{onClick:()=>u("readable"),className:`px-2 py-1 text-xs rounded transition-colors ${"readable"===s?"bg-card text-foreground shadow-lv1":"text-muted-foreground hover:text-foreground"}`,children:j("common.readable")}),(0,e.jsx)("button",{onClick:()=>u("json"),className:`px-2 py-1 text-xs rounded transition-colors ${"json"===s?"bg-card text-foreground shadow-lv1":"text-muted-foreground hover:text-foreground"}`,children:"JSON"})]}),(0,e.jsx)("button",{onClick:d,className:"p-1 text-foreground-subtle hover:text-foreground hover:bg-hover rounded transition-colors",children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),(0,e.jsx)("div",{className:"flex-1 overflow-auto p-4",children:"file"===s&&m?(0,e.jsx)(t,{filePath:m}):"diff-unified"===s&&l?(0,e.jsx)(i.xU,{oldContent:l.old_string,newContent:l.new_string,filePath:l.file_path}):"diff-split"===s&&l?(0,e.jsx)(i.xZ,{oldContent:l.old_string,newContent:l.new_string,filePath:l.file_path}):"readable"===s&&k?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(p._,{search:x}),(0,e.jsx)("pre",{ref:w,className:"text-foreground whitespace-pre-wrap break-words",style:{fontSize:"0.8125rem"},children:(0,r.xb)(b)})]}):(0,e.jsx)("pre",{className:"text-foreground whitespace-pre-wrap break-words",style:{fontSize:"0.8125rem"},children:k?(0,r.C6)(b):b})})]})});return(0,e.jsx)(h.ZL,{children:y})}d()}catch(a){d(a)}})},61591:(a,b,c)=>{"use strict";c.d(b,{o:()=>g});var d=c(48249);c(67484);let e={ts:"#3178c6",tsx:"#3178c6",js:"#f1e05a",jsx:"#61dafb",mjs:"#f1e05a",cjs:"#f1e05a",html:"#e44d26",css:"#563d7c",scss:"#cd6799",sass:"#cd6799",less:"#1d365d",vue:"#41b883",svelte:"#ff3e00",json:"#cbcb41",yaml:"#cb171e",yml:"#cb171e",toml:"#9c4121",xml:"#e37933",env:"#ecd53f",md:"#519aba",mdx:"#519aba",txt:"#89898a",py:"#3572a5",go:"#00add8",rs:"#dea584",java:"#b07219",kt:"#a97bff",kts:"#a97bff",c:"#555555",h:"#555555",cpp:"#f34b7d",hpp:"#f34b7d",rb:"#701516",php:"#4f5d95",sh:"#89e051",bash:"#89e051",zsh:"#89e051",png:"#a074c4",jpg:"#a074c4",jpeg:"#a074c4",gif:"#a074c4",svg:"#ffb13b",webp:"#a074c4",ico:"#a074c4",lock:"#89898a",gitignore:"#f14e32",dockerfile:"#2496ed",sql:"#e38c00",graphql:"#e535ab",gql:"#e535ab",default:"#8a8a8a"},f={"package.json":"#cb3837","package-lock.json":"#cb3837","tsconfig.json":"#3178c6","jsconfig.json":"#f1e05a",".gitignore":"#f14e32",".eslintrc":"#4b32c3",".eslintrc.js":"#4b32c3",".eslintrc.json":"#4b32c3",".prettierrc":"#56b3b4",dockerfile:"#2496ed",".env":"#ecd53f",".env.local":"#ecd53f",".env.development":"#ecd53f",".env.production":"#ecd53f","readme.md":"#519aba",license:"#d4af37",makefile:"#6d8086","cargo.toml":"#dea584","go.mod":"#00add8","go.sum":"#00add8","requirements.txt":"#3572a5","yarn.lock":"#2c8ebb","pnpm-lock.yaml":"#f9ad00","vite.config.ts":"#646cff","vite.config.js":"#646cff","next.config.js":"#000000","next.config.mjs":"#000000","tailwind.config.js":"#38bdf8","tailwind.config.ts":"#38bdf8"};function g({name:a,className:b="",size:c=16}){let h,i=f[h=a.toLowerCase()]?f[h]:e[a.split(".").pop()?.toLowerCase()||""]||e.default,j=a.split(".").pop()?.toLowerCase()||"";return["ts","tsx"].includes(j)?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("rect",{x:"2",y:"2",width:"20",height:"20",rx:"2",fill:i}),(0,d.jsx)("path",{d:"M7 10h10M12 10v8",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}):["js","jsx","mjs","cjs"].includes(j)?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("rect",{x:"2",y:"2",width:"20",height:"20",rx:"2",fill:i}),(0,d.jsx)("path",{d:"M10 10v6c0 1-1 2-2 2M14 10v4c0 2 4 2 4 0v-4",stroke:"#323330",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}):"jsx"===j||"tsx"===j&&a.includes("component")?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("ellipse",{cx:"12",cy:"12",rx:"10",ry:"4",stroke:"#61dafb",strokeWidth:"1.5",fill:"none"}),(0,d.jsx)("ellipse",{cx:"12",cy:"12",rx:"10",ry:"4",stroke:"#61dafb",strokeWidth:"1.5",fill:"none",transform:"rotate(60 12 12)"}),(0,d.jsx)("ellipse",{cx:"12",cy:"12",rx:"10",ry:"4",stroke:"#61dafb",strokeWidth:"1.5",fill:"none",transform:"rotate(120 12 12)"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"2",fill:"#61dafb"})]}):"json"===j?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("path",{d:"M6 4C4 4 4 6 4 8v2c0 1-1 2-2 2 1 0 2 1 2 2v2c0 2 0 4 2 4",stroke:i,strokeWidth:"2",fill:"none",strokeLinecap:"round"}),(0,d.jsx)("path",{d:"M18 4c2 0 2 2 2 4v2c0 1 1 2 2 2-1 0-2 1-2 2v2c0 2 0 4-2 4",stroke:i,strokeWidth:"2",fill:"none",strokeLinecap:"round"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"1.5",fill:i})]}):["md","mdx"].includes(j)?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",stroke:i,strokeWidth:"1.5",fill:"none"}),(0,d.jsx)("path",{d:"M5 15V9l3 4 3-4v6M17 12l-2-3v6M17 12l2-3v6",stroke:i,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}):["py","pyi","pyx"].includes(j)?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("path",{d:"M12 4c-4 0-4 2-4 3v2h5v1H6c-2 0-3 2-3 4s1 4 3 4h2v-2c0-2 1-3 3-3h4c1 0 2-1 2-2V7c0-2-2-3-5-3z",fill:"#3572a5"}),(0,d.jsx)("path",{d:"M12 20c4 0 4-2 4-3v-2h-5v-1h7c2 0 3-2 3-4s-1-4-3-4h-2v2c0 2-1 3-3 3h-4c-1 0-2 1-2 2v4c0 2 2 3 5 3z",fill:"#ffd43b"}),(0,d.jsx)("circle",{cx:"9",cy:"7",r:"1",fill:"white"}),(0,d.jsx)("circle",{cx:"15",cy:"17",r:"1",fill:"white"})]}):"go"===j?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("ellipse",{cx:"12",cy:"12",rx:"8",ry:"6",fill:i}),(0,d.jsx)("circle",{cx:"9",cy:"11",r:"1.5",fill:"white"}),(0,d.jsx)("circle",{cx:"15",cy:"11",r:"1.5",fill:"white"}),(0,d.jsx)("circle",{cx:"9",cy:"11",r:"0.7",fill:"#333"}),(0,d.jsx)("circle",{cx:"15",cy:"11",r:"0.7",fill:"#333"})]}):"rs"===j?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"9",stroke:i,strokeWidth:"2",fill:"none"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"3",fill:i}),(0,d.jsx)("path",{d:"M12 3v3M12 18v3M3 12h3M18 12h3",stroke:i,strokeWidth:"2",strokeLinecap:"round"})]}):["png","jpg","jpeg","gif","webp","ico","bmp"].includes(j)?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2",stroke:i,strokeWidth:"1.5",fill:"none"}),(0,d.jsx)("circle",{cx:"8",cy:"9",r:"2",fill:i}),(0,d.jsx)("path",{d:"M3 16l5-5 3 3 4-4 6 6",stroke:i,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}):"svg"===j?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2",stroke:i,strokeWidth:"1.5",fill:"none"}),(0,d.jsx)("path",{d:"M7 12 Q12 6 17 12 Q12 18 7 12",stroke:i,strokeWidth:"1.5",fill:"none"})]}):"html"===j?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("path",{d:"M4 3l1.5 17L12 22l6.5-2L20 3H4z",fill:i}),(0,d.jsx)("path",{d:"M8 7h8l-.5 6-3.5 1-3.5-1-.2-2",stroke:"white",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]}):["css","scss","sass","less"].includes(j)?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("path",{d:"M4 3l1.5 17L12 22l6.5-2L20 3H4z",fill:i}),(0,d.jsx)("path",{d:"M15 8H9l.3 3h5.2l-.4 4-2.1.7-2.1-.7-.1-2",stroke:"white",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]}):["yaml","yml"].includes(j)?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:i,strokeWidth:"1.5",fill:"none"}),(0,d.jsx)("path",{d:"M7 8l3 4v5M17 8l-3 4v5",stroke:i,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}):["sh","bash","zsh","fish"].includes(j)?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",fill:"#1e1e1e",stroke:"#555",strokeWidth:"1"}),(0,d.jsx)("path",{d:"M6 9l3 3-3 3M12 15h5",stroke:i,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}):"gitignore"===j||".gitignore"===a.toLowerCase()?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"9",fill:i}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"3",fill:"white"}),(0,d.jsx)("path",{d:"M12 6v3M12 15v3M6 12h3M15 12h3",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}):"dockerfile"===j||"dockerfile"===a.toLowerCase()||a.toLowerCase().startsWith("dockerfile")?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("path",{d:"M3 12h3v3H3zM7 12h3v3H7zM11 12h3v3h-3zM7 8h3v3H7zM11 8h3v3h-3zM11 4h3v3h-3zM15 12h3v3h-3z",fill:i}),(0,d.jsx)("path",{d:"M21 13c-1-2-3-2-4-2h-1c0-1 0-2-2-3h-1v1c0 1-1 2-2 2H3c-1 3 0 6 2 8s5 3 9 3c5 0 8-2 10-6",stroke:i,strokeWidth:"1.5",fill:"none"})]}):"env"===j||a.startsWith(".env")?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:i,strokeWidth:"1.5",fill:"none"}),(0,d.jsx)("circle",{cx:"8",cy:"8",r:"2",fill:i}),(0,d.jsx)("path",{d:"M12 8h6M8 12h8M8 16h5",stroke:i,strokeWidth:"1.5",strokeLinecap:"round"})]}):"sql"===j?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("ellipse",{cx:"12",cy:"7",rx:"8",ry:"3",stroke:i,strokeWidth:"1.5",fill:"none"}),(0,d.jsx)("path",{d:"M4 7v10c0 1.7 3.6 3 8 3s8-1.3 8-3V7",stroke:i,strokeWidth:"1.5",fill:"none"}),(0,d.jsx)("path",{d:"M4 12c0 1.7 3.6 3 8 3s8-1.3 8-3",stroke:i,strokeWidth:"1.5",fill:"none"})]}):"vue"===j?(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("path",{d:"M2 4h4l6 10 6-10h4L12 22 2 4z",fill:i}),(0,d.jsx)("path",{d:"M6 4h4l2 4 2-4h4l-6 10L6 4z",fill:"#35495e"})]}):(0,d.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",className:b,children:[(0,d.jsx)("path",{d:"M6 3h8l5 5v13H6V3z",stroke:i,strokeWidth:"1.5",fill:"none"}),(0,d.jsx)("path",{d:"M14 3v5h5",stroke:i,strokeWidth:"1.5",fill:"none"})]})}},61632:(a,b,c)=>{"use strict";c.d(b,{y:()=>k});var d=c(67484),e=c(20586),f=c(9804),g=c(208),h=c(79606),i=c(33281),j=c(85655);function k({cwd:a,addToRecentFiles:b}){let[c,l]=(0,d.useState)(null),[m,n]=(0,d.useState)(""),[o,p]=(0,d.useState)([]),[q,r]=(0,d.useState)(null),[s,t]=(0,d.useState)([]),[u,v]=(0,d.useState)([]),[w,x]=(0,d.useState)(new Set),[y,z]=(0,d.useState)(null),[A,B]=(0,d.useState)(null),[C,D]=(0,d.useState)(!1),[E,F]=(0,d.useState)(!1),[G,H]=(0,d.useState)(!1),[I,J]=(0,d.useState)(!0),[K,L]=(0,d.useState)(!1),[M,N]=(0,d.useState)(!1),[O,P]=(0,d.useState)(null),Q=(0,d.useRef)(null),[R,S]=(0,d.useState)(null),[T,U]=(0,d.useState)(!1),[V,W]=(0,d.useState)(""),[X,Y]=(0,d.useState)(""),[Z,$]=(0,d.useState)([]),[_,aa]=(0,d.useState)([]),[ab,ac]=(0,d.useState)(new Set),[ad,ae]=(0,d.useState)(null),[af,ag]=(0,d.useState)(null),[ah,ai]=(0,d.useState)(!1),[aj,ak]=(0,d.useState)(!1),al=(0,d.useCallback)(()=>{D(!0),P(null),i.t4.runPromise((0,j.r4)(a).pipe(h.match({onSuccess:a=>{a.local&&a.current?(l(a),n(a.current),a.upstream&&W(a.upstream)):(P(g.A.t("git.cannotGetBranches")),l(null))},onFailure:a=>{console.error(a),"NotFoundError"===a._tag?P(g.A.t("git.notGitRepo")):P(g.A.t("git.getBranchesFailed")),l(null)}}))).finally(()=>D(!1))},[a]),am=(0,d.useCallback)(b=>{F(!0),r(null),t([]),v([]),z(null),B(null),J(!0),i.t4.runPromise((0,j.Bj)(a,b,f.B_).pipe(h.match({onSuccess:a=>{let b=a.commits||[];p(b),J(b.length>=f.B_)},onFailure:a=>{console.error(a)}}))).finally(()=>F(!1))},[a]),an=(0,d.useCallback)(()=>{if(G||!I||!m)return;H(!0);let b=o.length;i.t4.runPromise((0,j.Bj)(a,m,f.B_,b).pipe(h.match({onSuccess:a=>{let b=a.commits||[];b.length>0&&p(a=>[...a,...b]),J(b.length>=f.B_)},onFailure:a=>{console.error(a)}}))).finally(()=>H(!1))},[a,m,o.length,G,I]),ao=(0,d.useCallback)(a=>{let{scrollTop:b,scrollHeight:c,clientHeight:d}=a.target;c-b-d<100&&an()},[an]),ap=(0,d.useCallback)(b=>{r(b),z(null),B(null),L(!0),i.t4.runPromise((0,j.Zi)(a,b.hash).pipe(h.match({onSuccess:a=>{let b=a.files||[];t(b);let c=(0,e.Do)(b);v(c),x(new Set((0,e.Sz)(c)))},onFailure:a=>{console.error(a)}}))).finally(()=>L(!1))},[a]),aq=(0,d.useCallback)(c=>{q&&(z(c),b(c.path),N(!0),i.t4.runPromise((0,j.Zi)(a,q.hash,c.path).pipe(h.match({onSuccess:a=>B(a),onFailure:a=>{console.error(a)}}))).finally(()=>N(!1)))},[a,q,b]),ar=(0,d.useCallback)(a=>{x(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),as=(0,d.useCallback)(b=>{ai(!0),ae(null),ag(null),i.t4.runPromise((0,j.yy)(a,b).pipe(h.match({onSuccess:a=>{let b=a.files||[];$(b);let c=(0,e.Do)(b);aa(c),ac(new Set((0,e.Sz)(c)))},onFailure:a=>{console.error(a)}}))).finally(()=>ai(!1))},[a]),at=(0,d.useCallback)(c=>{ae(c),b(c.path),ak(!0),i.t4.runPromise((0,j.yy)(a,X,c.path).pipe(h.match({onSuccess:a=>ag(a),onFailure:a=>{console.error(a)}}))).finally(()=>ak(!1))},[a,X,b]),au=(0,d.useCallback)(a=>{ac(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),av=(0,d.useCallback)(a=>{if(U(a),a){let a="origin/main";Y(a),as(a)}else $([]),aa([]),ae(null),ag(null),Y("")},[V,as]);return{branches:c,selectedBranch:m,setSelectedBranch:n,commits:o,setCommits:p,selectedCommit:q,setSelectedCommit:r,historyFiles:s,historyFileTree:u,historyExpandedPaths:w,historySelectedFile:y,historyFileDiff:A,isLoadingBranches:C,isLoadingCommits:E,isLoadingMore:G,hasMoreCommits:I,setHasMoreCommits:J,isLoadingHistoryFiles:K,isLoadingHistoryDiff:M,historyError:O,commitListRef:Q,tooltipPos:R,loadBranches:al,loadCommits:am,loadMoreCommits:an,handleCommitListScroll:ao,handleSelectCommit:ap,handleSelectHistoryFile:aq,handleHistoryToggle:ar,handleCommitInfoMouseMove:(0,d.useCallback)(a=>{S({x:a.clientX,y:a.clientY})},[]),handleCommitInfoMouseLeave:(0,d.useCallback)(()=>{S(null)},[]),compareMode:T,toggleCompareMode:av,compareBaseBranch:X,setCompareBaseBranch:Y,upstreamBranch:V,compareFiles:Z,compareFileTree:_,compareExpandedPaths:ab,compareSelectedFile:ad,compareFileDiff:af,isLoadingCompareFiles:ah,isLoadingCompareDiff:aj,handleSelectCompareFile:at,handleCompareToggle:au,loadCompareFiles:as}}},62473:(a,b,c)=>{"use strict";c.d(b,{g:()=>g});var d=c(48249),e=c(67484),f=c(44384);function g({tokenUsage:a,rateLimitInfo:b}){let{t:c}=(0,f.Bd)(),[h,i]=(0,e.useState)(()=>Date.now()),j=b?.status==="rejected"?"text-red-11":b?.status==="allowed_warning"?"text-amber-11":"text-muted-foreground",k=b?.status==="rejected"?c("chat.rateLimitRejected","Rate Limited"):b?.status==="allowed_warning"?c("chat.rateLimitWarning","Approaching Limit"):null,l=a=>{if(!a)return"";let b=(a<1e12?1e3*a:a)-h;if(b<=0)return"";let c=Math.ceil(b/6e4);if(c<60)return`${c}m`;let d=Math.floor(c/60),e=c%60;return e>0?`${d}h${e}m`:`${d}h`},m=a=>a?a.replace(/_/g," "):"";return(0,d.jsx)("div",{className:"px-4 py-1.5 border-t border-border ",children:(0,d.jsxs)("div",{className:"flex items-center justify-end gap-4 text-xs text-muted-foreground",children:[b&&k&&(0,d.jsxs)("span",{className:`flex items-center gap-1 ${j}`,"data-tooltip":[b.rateLimitType&&`Type: ${m(b.rateLimitType)}`,null!=b.utilization&&`Usage: ${(100*b.utilization).toFixed(0)}%`,b.resetsAt&&`Resets in: ${l(b.resetsAt)}`,b.isUsingOverage&&"Using overage"].filter(Boolean).join(" \xb7 "),children:["rejected"===b.status?(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}):(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,d.jsxs)("span",{children:[(0,d.jsx)("strong",{children:k}),null!=b.utilization&&` ${(100*b.utilization).toFixed(0)}%`,b.resetsAt&&` \xb7 ${l(b.resetsAt)}`]})]}),b&&!k&&b.resetsAt&&(0,d.jsxs)("span",{className:"flex items-center gap-1.5","data-tooltip":[b.rateLimitType&&m(b.rateLimitType),null!=b.utilization&&`Usage: ${(100*b.utilization).toFixed(0)}%`,`Resets in: ${l(b.resetsAt)}`].filter(Boolean).join(" \xb7 "),children:[(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),null!=b.utilization?(0,d.jsxs)("span",{children:[(100*b.utilization).toFixed(0),"%"]}):(0,d.jsx)("span",{children:l(b.resetsAt)})]}),(0,d.jsxs)("span",{className:"flex items-center gap-1",children:[(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})}),(0,d.jsxs)("span",{children:[c("chat.context"),": ",(0,d.jsx)("strong",{className:"text-foreground",children:(a.inputTokens+a.cacheReadInputTokens+a.cacheCreationInputTokens).toLocaleString()})]})]}),(0,d.jsxs)("span",{className:"flex items-center gap-1",children:[(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})}),(0,d.jsxs)("span",{children:[c("chat.output"),": ",(0,d.jsx)("strong",{className:"text-foreground",children:a.outputTokens.toLocaleString()})]})]}),(a.cacheReadInputTokens>0||a.cacheCreationInputTokens>0)&&(0,d.jsxs)("span",{className:"flex items-center gap-1 text-brand",children:[(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4"})}),(0,d.jsxs)("span",{children:["Cache: ",(a.cacheReadInputTokens/(a.inputTokens+a.cacheReadInputTokens+a.cacheCreationInputTokens)*100).toFixed(0),"%"]})]}),a.totalCostUsd>0&&(0,d.jsxs)("span",{className:"flex items-center gap-1 text-green-11",children:[(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,d.jsxs)("span",{children:["$",a.totalCostUsd.toFixed(4)]})]})]})})}},63041:(a,b,c)=>{"use strict";c.d(b,{e:()=>h});var d=c(48249),e=c(67484),f=c(44384),g=c(35606);function h({cwd:a,sessionId:b,engine:c,onOpenProjectSessions:i,onOpenSessionBrowser:j,onOpenSettings:k}){let{t:l}=(0,f.Bd)(),[m,n]=(0,e.useState)(!1),o=b?(0,g.X)(c,b):null;return(0,d.jsx)("div",{className:"border-b border-border px-4 py-3 bg-card",children:(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("img",{src:"/icons/icon-72x72.png",alt:"Cockpit",className:"w-6 h-6"}),(0,d.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,d.jsx)("h1",{className:"text-lg font-semibold text-foreground",children:"Cockpit"}),(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:"One seat. One AI. Everything under control."})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[a&&(0,d.jsx)("span",{className:"text-sm text-foreground max-w-md truncate cursor-help","data-tooltip":`CWD: ${a}`,children:a}),!a&&b&&(0,d.jsxs)("span",{className:"text-xs text-muted-foreground",children:["Session: ",b.slice(0,8),"..."]}),a&&(0,d.jsx)("button",{onClick:i,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-hover rounded-lg transition-colors",title:l("sessions.projectSessions"),children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})}),(0,d.jsx)("button",{onClick:j,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-hover rounded-lg transition-colors",title:l("sessions.browseAllSessions"),children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})})}),o&&(0,d.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(o).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)})},className:`p-2 rounded-lg transition-colors ${m?"text-green-11 bg-green-500/10":"text-muted-foreground hover:text-foreground hover:bg-hover"}`,title:m?l("chat.copiedCommandTooltip"):l("chat.copyCommandTooltip",{command:o}),children:m?(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3m2 4H10m0 0l3-3m-3 3l3 3"})})}),(0,d.jsx)("button",{onClick:k,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-hover rounded-lg transition-colors",title:l("settings.title"),children:(0,d.jsxs)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})})]})]})})}},63565:(a,b,c)=>{"use strict";c.d(b,{$T:()=>n,Aw:()=>o,CX:()=>j,Fx:()=>m,H:()=>g,XY:()=>s,ch:()=>h,eV:()=>q,hG:()=>r,pe:()=>k,yI:()=>l,ys:()=>p});var d=c(48249);c(67484);var e=c(42742),f=c(44218);let g={claude:"Claude",codex:"Codex",deepseek:"DeepSeek",kimi:"Kimi",glm:"GLM",ollama:"Ollama"};function h(a){return!!a&&a in g}let i={claude:0,codex:1,deepseek:2,glm:3,kimi:4,ollama:5},j=Object.keys(i).sort((a,b)=>i[a]-i[b]),k={claude:"text-[#c6532d] dark:text-[#D97757]",codex:"text-emerald-600 dark:text-emerald-400",deepseek:"text-sky-600 dark:text-sky-400",kimi:"text-purple-600 dark:text-purple-400",glm:"text-amber-600 dark:text-amber-400",ollama:"text-violet-600 dark:text-violet-400"},l="bg-accent font-medium text-foreground",m="focus:border-brand",n="bg-brand text-white hover:bg-brand/90",o="text-rose-600 dark:text-rose-400",p="fixed z-[9999] max-h-[70vh] overflow-y-auto rounded-lg border border-border bg-popover py-2 shadow-lv2";function q({engine:a,className:b="h-3.5 w-3.5"}){return(0,d.jsx)("img",{alt:"","aria-hidden":"true",src:`/agent-icons/${a}.svg`,className:`${b} flex-shrink-0`})}function r({selected:a}){return(0,d.jsx)("span",{className:"flex h-3.5 w-3.5 flex-shrink-0 items-center justify-center text-foreground",children:a&&(0,d.jsx)(e.A,{className:"h-3.5 w-3.5"})})}function s({label:a,title:b,onClick:c,buttonRef:e,icon:g,labelClassName:h,labelMaxWidth:i="max-w-[160px]",testId:j}){return(0,d.jsxs)("button",{ref:e,type:"button",onClick:c,className:"flex items-center gap-1 rounded px-2 py-0.5 text-[11px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",title:b,"data-testid":j,children:[g,(0,d.jsx)("span",{className:`truncate ${i} ${h??""}`,children:a}),(0,d.jsx)(f.A,{className:"h-3 w-3 flex-shrink-0"})]})}},64340:(a,b,c)=>{"use strict";c.d(b,{r:()=>e});var d=c(67484);function e(){let[a,b]=(0,d.useState)(),[c,e]=(0,d.useState)(),[f,g]=(0,d.useState)(!1),h=!!a&&!!c&&function(a,b){let c=a=>a.replace(/^v/,"").split("-")[0].split(".").map(a=>parseInt(a,10)||0),d=c(a),e=c(b),f=Math.max(d.length,e.length);for(let a=0;a<f;a++){let b=d[a]??0,c=e[a]??0;if(b!==c)return b-c}return 0}(c,a)>0;return{current:a,latest:f?c??"999.0.0":c,hasUpdate:!!f||h}}c(33281),c(65484)},64676:(a,b,c)=>{"use strict";c.d(b,{J4:()=>g,Kx:()=>o,OP:()=>r,PB:()=>q,Xe:()=>k,hE:()=>p,qF:()=>h,xh:()=>m});let d=`
49
50
  (function () {
50
51
  if (window.cockpit) return;
51
52
 
@@ -747,7 +748,7 @@ ${f}`),bq(h,c)}else bq(au("chat.executedCommandFailed",{command:e,error:g.cause}
747
748
  try { if (ws) ws.close(); } catch (e) {}
748
749
  });
749
750
  })();
750
- `;function e(a){return/^([/\\]|[A-Za-z]:)/.test(a)}function f(a,b){let c=a.replace(/[/\\]+$/,"");return b?`${c}/${b}`:c}function g(a,b){let c,d=(c=Math.max(a.lastIndexOf("/"),a.lastIndexOf("\\")))<0?"":0===c?"/":a.slice(0,c);return e(a)?d:b?f(b,d):d}function h(a,b){return e(a)||!!b}let i="/apps/local/",j="/apps/builtin/";function k(a,b){let c=a.trim();return i+(e(c)?c:f(b??"",c)).replace(/\\/g,"/").split("/").map(encodeURIComponent).join("/").replace(/^\//,"")}let l=/^([a-z][a-z0-9+.-]*:|\/\/|\/)/i;function m(a,b,c){let d=a.trim();if(!d||l.test(d)||!h(b,c))return a;let g=e(b)?b:f(c,b),i=d.search(/[?#]/),j=i<0?d:d.slice(0,i),m=i<0?"":d.slice(i);if(!j)return a;let n=j;try{n=decodeURIComponent(j)}catch{}return k(function(a){let b=/^[A-Za-z]:/.exec(a)?.[0]??"",c=b?a.slice(b.length):a,d=/^[/\\]/.test(c),e=[];for(let a of c.split(/[/\\]/))if(a&&"."!==a){if(".."===a){e.length&&".."!==e[e.length-1]?e.pop():d||b||e.push("..");continue}e.push(a)}return b+(d||b?"/":"")+e.join("/")}(f(g,n)))+m}let n=/\.(md|png|jpe?g|gif|webp|svg|pdf|json|csv|tsv)$/i;function o(a){return n.test(a.trim())}function p(a,b){let c=a.trim();return j+"file-viewer/index.html?file="+encodeURIComponent((e(c)?c:f(b??"",c)).replace(/\\/g,"/"))}function q(a,b){try{let c=new URL(a,b);if(!c.pathname.startsWith(j)&&!c.pathname.startsWith(i))return a;return"localhost"===c.hostname&&(c.hostname="127.0.0.1"),c.toString()}catch{return a}}function r(a,b){let c=a=>JSON.stringify(a).replace(/</g,"\\u003c"),e="<script>"+d.replaceAll("__CWD__",c(b.cwd)).replaceAll("__WS_URL__",c(b.wsUrl??""))+"<\/script>",f=a.match(/<head[^>]*>/i);if(f&&void 0!==f.index){let b=f.index+f[0].length;return a.slice(0,b)+e+a.slice(b)}let g=a.match(/<html[^>]*>/i);if(g&&void 0!==g.index){let b=g.index+g[0].length;return a.slice(0,b)+e+a.slice(b)}return e+a}},65139:(a,b,c)=>{"use strict";c.d(b,{BV:()=>h,NR:()=>t,OO:()=>v,Yd:()=>y,kn:()=>i,oJ:()=>o});var d=c(48249),e=c(67484),f=c(44256),g=c(63565);let h="claude-opus-5",i="gpt-5.6-sol",j=[{id:"low",label:"Low"},{id:"medium",label:"Medium"},{id:"high",label:"High"},{id:"xhigh",label:"Extra High"},{id:"max",label:"Max"},{id:"ultracode",label:"Ultracode"},{id:"ultrathink",label:"Ultrathink"}],k=[{id:"claude-sonnet-5",label:"Claude Sonnet 5",effort:["low","medium","high","xhigh","max","ultrathink"],defaultEffort:"high",context:["200k","1m"],defaultContext:"200k"},{id:"claude-opus-5",label:"Claude Opus 5",effort:["low","medium","high","xhigh","max","ultracode","ultrathink"],defaultEffort:"high",context:["200k","1m"],defaultContext:"1m",fast:!0},{id:"claude-fable-5",label:"Claude Fable 5",effort:["low","medium","high","xhigh","max","ultracode","ultrathink"],defaultEffort:"high",context:["200k","1m"],defaultContext:"1m"},{id:"claude-opus-4-8",label:"Claude Opus 4.8",effort:["low","medium","high","xhigh","max","ultracode","ultrathink"],defaultEffort:"high",fast:!0},{id:"claude-opus-4-7",label:"Claude Opus 4.7",effort:["low","medium","high","xhigh","max","ultrathink"],defaultEffort:"xhigh",fast:!0},{id:"claude-opus-4-6",label:"Claude Opus 4.6",effort:["low","medium","high","max","ultrathink"],defaultEffort:"high",context:["200k","1m"],defaultContext:"1m",fast:!0},{id:"claude-sonnet-4-6",label:"Claude Sonnet 4.6",effort:["low","medium","high","max","ultrathink"],defaultEffort:"high",context:["200k","1m"],defaultContext:"200k"},{id:"claude-haiku-4-5",label:"Claude Haiku 4.5",thinking:!0}],l=[{id:"minimal",label:"Minimal"},{id:"low",label:"Low"},{id:"medium",label:"Medium"},{id:"high",label:"High"},{id:"xhigh",label:"Extra High"},{id:"max",label:"Max"},{id:"ultra",label:"Ultra"}],m=[{id:"gpt-5.6-sol",label:"GPT-5.6-Sol",reasoning:["low","medium","high","xhigh","max","ultra"],defaultReasoning:"medium"},{id:"gpt-5.6-terra",label:"GPT-5.6-Terra",reasoning:["low","medium","high","xhigh","max","ultra"],defaultReasoning:"medium"},{id:"gpt-5.6-luna",label:"GPT-5.6-Luna",reasoning:["low","medium","high","xhigh","max"],defaultReasoning:"medium"}];function n(a){return m.find(b=>b.id===a)?.defaultReasoning??"low"}function o(a,b){let c=m.find(b=>b.id===a)?.reasoning;return b&&(!c||c.includes(b))?b:n(a)}function p(a,b){return a.find(a=>a.id===b)?.label??b}function q(a){return k.find(b=>b.id===a)?.fast===!0}function r(a){return k.find(b=>b.id===a)?.thinking===!0}function s(a){let b=k.find(b=>b.id===a);return b?b.defaultEffort:"high"}function t(a,b){let c=k.find(b=>b.id===a),d=c?.effort;return b&&(!c||d?.includes(b))?b:s(a)}function u(a){let b=k.find(b=>b.id===a);return b?b.defaultContext:"200k"}function v(a,b){let c=k.find(b=>b.id===a),d=c?.context;return b&&(!c||d?.includes(b))?b:u(a)}function w({value:a,selected:b,label:c,defaultValue:e,onSelect:f}){return(0,d.jsxs)("button",{type:"button",onClick:()=>f(a),className:`flex w-full items-start gap-2 px-3 py-2 text-left text-xs transition-colors ${b?g.yI:"text-muted-foreground hover:bg-hover hover:text-foreground"}`,children:[(0,d.jsx)("span",{className:"mt-0.5",children:(0,d.jsx)(g.hG,{selected:b})}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate",children:c}),(0,d.jsx)("span",{className:"shrink-0",children:e&&(0,d.jsx)("span",{className:"rounded bg-muted px-1.5 text-[10px] font-medium text-muted-foreground",children:"Default"})})]})}function x({title:a,selected:b,value:c,items:h,onSelect:i,icon:j,testId:k}){let l=(0,e.useRef)(null),m=(0,e.useRef)(null),[n,o]=(0,e.useState)(!1),[p,q]=(0,e.useState)({top:0,left:0}),r=(0,f.F2)();return(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)(g.XY,{buttonRef:l,label:c,labelMaxWidth:"max-w-[180px]",title:`${a}: ${c}`,onClick:()=>{n||(()=>{let a=l.current?.getBoundingClientRect();if(!a)return;let b=r?.getBoundingClientRect(),c=b?.left??0,d=b?.top??0;q({top:a.bottom+4-d,left:a.left-c})})(),o(a=>!a)},icon:j,testId:k}),n&&(0,d.jsx)(f.ZL,{children:(0,d.jsxs)("div",{ref:m,className:`${g.ys} min-w-[190px]`,style:{top:p.top,left:p.left},children:[(0,d.jsx)("div",{className:"px-3 pb-1 text-[11px] font-medium text-muted-foreground",children:a}),(0,d.jsx)("div",{className:"flex flex-col",children:h.map(a=>(0,d.jsx)(w,{value:a.id,selected:b===a.id,label:a.label,defaultValue:a.defaultValue,onSelect:a=>{i(a),o(!1)}},a.id))})]})})]})}function y(a){let b,c,e=a.engine??"claude",f=a.claudeModel??h,w=s(f),y=(b=k.find(a=>a.id===f)?.effort)?b.map(a=>j.find(b=>b.id===a)??{id:a,label:a}):[],z=t(f,a.claudeEffort),A=u(f),B=k.find(a=>a.id===f)?.context??[],C=v(f,a.claudeContextWindow),D=a.claudeFastMode??!1,E=a.claudeThinking??!1,F=a.codexModel??i,G=n(F),H=(c=m.find(a=>a.id===F)?.reasoning)?c.map(a=>l.find(b=>b.id===a)??{id:a,label:a}):l,I=o(F,a.codexReasoningEffort);return"claude"!==e?(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-1","data-agent-model-traits":!0,children:[(0,d.jsx)(x,{title:"Model",selected:F,value:p(m,F),items:m.map(a=>({id:a.id,label:a.label,defaultValue:a.id===i})),onSelect:b=>{a.onCodexModelChange?.(b),a.onCodexReasoningEffortChange?.(n(b))},icon:(0,d.jsx)(g.eV,{engine:"codex"}),testId:"codex-model-picker"}),(0,d.jsx)(x,{title:"Reasoning",selected:I,value:p(l,I),items:H.map(a=>({...a,defaultValue:a.id===G})),onSelect:b=>a.onCodexReasoningEffortChange?.(b),testId:"codex-reasoning-picker"})]}):(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-1","data-agent-model-traits":!0,children:[(0,d.jsx)(x,{title:"Model",selected:f,value:p(k,f),items:k.map(a=>({id:a.id,label:a.label,defaultValue:a.id===h})),onSelect:b=>{a.onClaudeModelChange?.(b);let c=s(b),d=u(b);c&&a.onClaudeEffortChange?.(c),d&&a.onClaudeContextWindowChange?.(d),q(b)||a.onClaudeFastModeChange?.(!1),r(b)||a.onClaudeThinkingChange?.(!1)},icon:(0,d.jsx)(g.eV,{engine:"claude"}),testId:"claude-model-picker"}),z&&y.length>0&&(0,d.jsx)(x,{title:"Reasoning",selected:z,value:p(j,z),items:y.map(a=>({...a,defaultValue:a.id===w})),onSelect:b=>a.onClaudeEffortChange?.(b),testId:"claude-reasoning-picker"}),C&&B.length>0&&(0,d.jsx)(x,{title:"Context Window",selected:C,value:"1m"===C?"1M":"200K",items:B.map(a=>({id:a,label:"1m"===a?"1M":"200K",defaultValue:a===A})),onSelect:b=>a.onClaudeContextWindowChange?.(b),testId:"claude-context-picker"}),q(f)&&(0,d.jsx)(x,{title:"Fast Mode",selected:D?"on":"off",value:D?"Fast On":"Fast Off",items:[{id:"on",label:"On"},{id:"off",label:"Off",defaultValue:!0}],onSelect:b=>a.onClaudeFastModeChange?.("on"===b),testId:"claude-fast-mode-picker"}),r(f)&&(0,d.jsx)(x,{title:"Thinking",selected:E?"on":"off",value:E?"Thinking On":"Thinking Off",items:[{id:"on",label:"On"},{id:"off",label:"Off",defaultValue:!0}],onSelect:b=>a.onClaudeThinkingChange?.("on"===b),testId:"claude-thinking-picker"})]})}},65395:(a,b,c)=>{"use strict";c.d(b,{useTabState:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call useTabState() from the server but useTabState is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/useTabState.ts","useTabState")},65484:(a,b,c)=>{"use strict";c.d(b,{Cq:()=>n,D0:()=>q,DZ:()=>i,H7:()=>o,It:()=>s,Kl:()=>w,M5:()=>h,Or:()=>k,Q1:()=>u,QW:()=>p,Wr:()=>j,Yn:()=>r,b2:()=>v,em:()=>t,zF:()=>m});var d=c(79606),e=c(71192);let f=(a,b)=>d.tryPromise({try:async()=>{let c=await fetch(a,b);if(!c.ok)throw Error(`HTTP ${c.status}`);return await c.json()},catch:c=>new e.uV({message:`${b?.method??"GET"} ${a} failed`,cause:c})}),g=(a,b)=>f(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),h=()=>f("/api/settings"),i=a=>f("/api/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),j=()=>f("/api/version"),k=()=>f("/api/extension/version"),l=a=>a?`/api/note?cwd=${encodeURIComponent(a)}`:"/api/note",m=a=>f(l(a)),n=(a,b,c)=>d.tryPromise({try:async()=>{let d=l(a),e=await fetch(d,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:b,baseMtime:c})});if(409===e.status){let a=await e.json();return{conflict:!0,content:a.content??"",mtime:a.mtime}}if(!e.ok)throw Error(`HTTP ${e.status}`);return{conflict:!1,mtime:(await e.json()).mtime}},catch:b=>new e.uV({message:`POST ${l(a)} failed`,cause:b})}),o=()=>f("/api/sessions/projects"),p=a=>f(`/api/sessions/projects/${encodeURIComponent(a)}`),q=a=>f(`/api/project-settings?cwd=${encodeURIComponent(a)}`),r=a=>g("/api/project-settings",a),s=()=>f("/api/pick-folder"),t=a=>g("/api/open-vscode",{cwd:a}),u=a=>g("/api/open-cursor",{cwd:a}),v=a=>f(`/api/git/worktree?cwd=${encodeURIComponent(a)}`),w=a=>g("/api/git/worktree",a)},65543:(a,b,c)=>{"use strict";c.d(b,{_:()=>e});let d=new Set(["function","class","method"]);function e(a){return d.has(a.kind)}},67045:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>e});var d=c(48249);function e({error:a,reset:b}){return(0,d.jsx)("html",{children:(0,d.jsx)("body",{children:(0,d.jsxs)("div",{style:{padding:"2rem",fontFamily:"system-ui, sans-serif"},children:[(0,d.jsx)("h2",{children:"Something went wrong"}),(0,d.jsx)("p",{style:{color:"#666"},children:a.message}),(0,d.jsx)("button",{onClick:b,style:{marginTop:"1rem",padding:"0.5rem 1rem",cursor:"pointer",borderRadius:"0.375rem",border:"1px solid #ccc",background:"#fff"},children:"Try again"})]})})})}},69424:(a,b,c)=>{"use strict";c.d(b,{$:()=>s});var d=c(48249),e=c(67484),f=c(44384),g=c(57063),h=c(7833),i=c(44256),j=c(74118),k=c(15273),l=c(46674),m=c(99941),n=c(44643),o=c(32026),p=c(11732),q=c(75513);function r(a){let b=a.input?.questions||[],c=a.input?.answers||{},d={};if(a.result)try{let b=JSON.parse(a.result);b?.answers&&(d=b.answers)}catch{}return{questions:b,answers:{...c,...d}}}function s({toolCalls:a,onClose:b}){let{t:c}=(0,f.Bd)(),t=(0,q.nH)(),[u,v]=(0,e.useState)({}),[w,x]=(0,e.useState)({}),[y,z]=(0,e.useState)({}),[A,B]=(0,e.useState)({});(0,g.E)(b);let C=a.reduce((a,b)=>{let{questions:c}=r(b);return a+c.length},0),D=Object.values(A).filter(Boolean).length,E=(0,e.useCallback)((a,b)=>{v(c=>({...c,[a]:b})),x(b=>({...b,[a]:!1}))},[]),F=(0,e.useCallback)(a=>{x(b=>{let c=!b[a];if(c){let b=y[a]||"";b&&v(c=>({...c,[a]:b}))}return{...b,[a]:c}})},[y]),G=(0,e.useCallback)((a,b)=>{z(c=>({...c,[a]:b})),b&&v(c=>({...c,[a]:b}))},[]),H=(0,e.useCallback)(a=>{B(b=>({...b,[a]:!b[a]}))},[]),I=(0,e.useCallback)(()=>{let b=D>0,d=[];return a.forEach((a,e)=>{let{questions:f}=r(a);f.forEach((a,f)=>{let g=`${e}-${f}`;if(b&&!A[g])return;let h=u[g];d.push(`Q: ${a.question}`),d.push(`A: ${h||c("askQuestion.notSelected")}`),d.push("")})}),d.join("\n").trim()},[a,u,A,D,c]),J=(0,e.useCallback)(()=>{navigator.clipboard.writeText(I()),(0,h.oR)(D>0?c("toast.copiedQA",{count:D}):c("toast.copiedAllQA"))},[I,D,c]),K=(0,e.useCallback)(()=>{t?(t.sendMessage(I()),(0,h.oR)(c("toast.sentQA")),b()):(0,h.oR)(c("askQuestion.sendNoChat"))},[t,I,b,c]),L=(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-scrim p-4",onClick:b,children:(0,d.jsxs)("div",{className:"bg-card rounded-lg shadow-lv3 w-full max-w-6xl h-[90vh] flex flex-col overflow-hidden",onClick:a=>a.stopPropagation(),children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border flex-shrink-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("h3",{className:"text-sm font-medium text-foreground",children:c("askQuestion.title")}),(0,d.jsxs)("span",{className:"text-xs text-muted-foreground",children:[c("askQuestion.nQuestions",{count:C}),D>0&&` \xb7 ${c("askQuestion.checkedN",{count:D})}`]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("button",{onClick:K,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-hover rounded transition-colors",title:D>0?c("askQuestion.sendChecked",{count:D}):c("askQuestion.sendAll"),children:(0,d.jsx)(j.A,{className:"w-4 h-4"})}),(0,d.jsx)("button",{onClick:J,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-hover rounded transition-colors",title:D>0?c("askQuestion.copyChecked",{count:D}):c("askQuestion.copyAll"),children:(0,d.jsx)(k.A,{className:"w-4 h-4"})}),(0,d.jsx)("button",{onClick:b,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-hover rounded transition-colors",children:(0,d.jsx)(l.A,{className:"w-5 h-5"})})]})]}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto px-6 py-4 space-y-6",children:a.map((b,e)=>{let{questions:f}=r(b);return f.map((b,g)=>{let h=`${e}-${g}`,i=u[h],j=w[h]||!1,k=A[h]||!1;return(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)("button",{onClick:()=>H(h),className:"mt-0.5 flex-shrink-0 p-0.5 rounded hover:bg-hover transition-colors",title:c("askQuestion.checkToCopy"),children:k?(0,d.jsx)(m.A,{className:"w-4 h-4 text-brand"}):(0,d.jsx)(n.A,{className:"w-4 h-4 text-muted-foreground"})}),b.header&&(0,d.jsx)("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-brand/10 text-brand flex-shrink-0 mt-0.5",children:b.header}),(0,d.jsx)("span",{className:"text-sm font-medium text-foreground",children:b.question})]}),(0,d.jsxs)("div",{className:"space-y-1 ml-7",children:[b.options.map((a,b)=>{let c=i===a.label&&!j;return(0,d.jsxs)("button",{onClick:()=>E(h,a.label),className:`flex items-start gap-2 px-2.5 py-1.5 rounded-md transition-colors w-full text-left cursor-pointer hover:bg-hover ${c?"bg-brand/10 hover:bg-brand/15":""}`,children:[(0,d.jsx)("div",{className:"mt-0.5 flex-shrink-0",children:c?(0,d.jsx)(o.A,{className:"w-3.5 h-3.5 text-brand"}):(0,d.jsx)("div",{className:"w-3.5 h-3.5 rounded-full border border-muted-foreground"})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("div",{className:`text-sm ${c?"text-foreground font-medium":"text-foreground"}`,children:a.label}),a.description&&(0,d.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5",children:a.description})]})]},b)}),(0,d.jsxs)("button",{onClick:()=>F(h),className:`flex items-start gap-2 px-2.5 py-1.5 rounded-md transition-colors w-full text-left cursor-pointer hover:bg-hover ${j?"bg-brand/10 hover:bg-brand/15":""}`,children:[(0,d.jsx)("div",{className:"mt-0.5 flex-shrink-0",children:j?(0,d.jsx)(o.A,{className:"w-3.5 h-3.5 text-brand"}):(0,d.jsx)("div",{className:"w-3.5 h-3.5 rounded-full border border-muted-foreground"})}),(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)(p.A,{className:"w-3.5 h-3.5 text-muted-foreground"}),(0,d.jsx)("span",{className:"text-sm text-muted-foreground",children:c("askQuestion.custom")})]})]}),j&&(0,d.jsx)("div",{className:"ml-6 mt-1",children:(0,d.jsx)("input",{type:"text",autoFocus:!0,value:y[h]||"",onChange:a=>G(h,a.target.value),placeholder:c("askQuestion.customPlaceholder"),className:"w-full px-3 py-1.5 text-sm bg-background border border-border rounded-md focus:outline-none focus:ring-1 focus:ring-brand text-foreground"})})]}),(e!==a.length-1||g!==f.length-1)&&(0,d.jsx)("div",{className:"border-b border-border/50 mt-3"})]},h)})})})]})});return(0,d.jsx)(i.ZL,{children:L})}},70151:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{g:()=>ag});var e=c(48249),f=c(67484),g=c.n(f),h=c(74429),i=c(44256),j=c(33281),k=c(87808),l=c(25419),m=c(85655),n=c(21538),o=c(35208),p=c(74691),q=c(60333),r=c(7833),s=c(24724),t=c(20586),u=c(7122),v=c(55287),w=c(60591),x=c(19593),y=c(64825),z=c(66400),A=c(86588),B=c(64676),C=c(6478),D=c(34728),E=c(9804),F=c(73887),G=c(40893),H=c(92608),I=c(94239),J=c(29939),K=c(23860),L=c(7031),M=c(83721),N=c(25667),O=c(57014),P=c(46242),Q=c(94308),R=c(53036),S=c(91975),T=c(6662),U=c(20291),V=c(58904),W=c(61632),X=c(41357),Y=c(76855),Z=c(4857),$=c(44384),_=c(18921),aa=c(28797),ab=c(23881),ac=c(21672),ad=c(21482),ae=c(94192),af=a([n,N,o,F,v,O]);[n,N,o,F,v,O]=af.then?(await af)():af;let ag=g().memo(function({onClose:a,cwd:b,initialTab:c="tree",tabSwitchTrigger:d,initialSearchQuery:g,searchQueryTrigger:af,fileOpenRequest:ag}){let ah,ai,aj,ak,al,am,{t:an}=(0,$.Bd)(),ao=(0,L.r)(),ap=(0,f.useCallback)(a=>{ao?.sendMessage(an("explain.fileMessage",{path:a}))},[ao,an]),aq=(0,f.useCallback)(a=>{ao?.sendMessage(an("explain.stagedFileMessage",{path:a}))},[ao,an]),ar=(0,f.useCallback)(a=>{ao?.sendMessage(an("explain.unstagedFileMessage",{path:a}))},[ao,an]),as=(0,C.P)(),at=(0,D.U)(),{activeView:au,onViewChange:av}=(0,ae.R8)(),[aw,ax]=(0,f.useState)(c),[ay,az]=(0,f.useState)("code"),aA=(0,f.useRef)(null),aB=(0,f.useRef)(!1),[aC,aD]=(0,f.useState)(null),[aE,aF]=(0,f.useState)(null),[aG,aH]=(0,f.useState)(!1),aI=(0,f.useRef)(1),aJ=(0,f.useRef)(null),[aK,aL]=(0,f.useState)(null),aM=(0,f.useRef)(null),[aN,aO]=(0,f.useState)({isDirty:!1,isSaving:!1}),[aP,aQ]=(0,f.useState)(!1),[aR,aS]=(0,f.useState)(null),[aT,aU]=(0,f.useState)("compact"),[aV,aW]=(0,f.useState)("unified"),[aX,aY]=(0,f.useState)("full"),[aZ,a$]=(0,f.useState)("unified"),[a_,a0]=(0,f.useState)(320),a1=(0,f.useRef)(null),a2=(0,f.useCallback)(a=>{"mouse"===a.pointerType&&0===a.button&&(a.preventDefault(),a1.current={startX:a.clientX,startWidth:a_},a.currentTarget.setPointerCapture(a.pointerId))},[a_]),a3=(0,f.useCallback)(a=>{let b=a1.current;if(!b)return;let c=b.startWidth+(a.clientX-b.startX);a0(Math.min(480,Math.max(320,c)))},[]),a4=(0,f.useCallback)(a=>{a1.current&&(a1.current=null,a.currentTarget.hasPointerCapture(a.pointerId)&&a.currentTarget.releasePointerCapture(a.pointerId))},[]),a5=(0,f.useRef)(null),a6=(0,_.o)(a5),a7=(0,f.useRef)(null),a8=(0,_.o)(a7),a9=(0,Y.Sn)(b),ba=(0,Y.Xm)(b),bb=(0,Y.po)(b),bc=(0,Z.Q)(),bd=(0,K.F)(),be=(0,T.W)({cwd:b});(0,Y.JL)(b,be.selectedPath);let bf=(0,f.useMemo)(()=>{let a=be.fileContent,b=be.selectedPath;return a&&"text"===a.type&&"string"==typeof a.content&&b&&(0,w.Hz)(b)?(0,w.xb)(a.content,w.cG):null},[be.fileContent,be.selectedPath]),[bg,bh]=(0,f.useState)({version:0,collapsed:!1}),bi=(0,U.p)({cwd:b,onSearchComplete:()=>aQ(!0)}),bj=(0,V.e)({cwd:b,addToRecentFiles:be.addToRecentFiles}),bk=(0,f.useMemo)(()=>{let a=new Set;if(bj.status){for(let b of bj.status.staged)a.add(b.path);for(let b of bj.status.unstaged)a.add(b.path)}return a},[bj.status]),bl=(0,f.useMemo)(()=>{let a=new Map;if(bj.status){for(let b of bj.status.staged)a.set(b.path,"staged");for(let b of bj.status.unstaged)a.set(b.path,"unstaged")}return a},[bj.status]),bm=(0,W.y)({cwd:b,addToRecentFiles:be.addToRecentFiles}),bn=(0,f.useCallback)(a=>{ao?.sendMessage(an("explain.compareFileMessage",{base:bm.compareBaseBranch,path:a}))},[ao,an,bm.compareBaseBranch]),bo=(0,f.useRef)(!1),bp=(0,f.useCallback)(a=>{be.setFileContent(b=>b?.type==="text"?{...b,content:a}:b),be.showEditor||(bo.current=!0,be.setShowEditor(!0))},[be]),bq=(0,f.useCallback)(a=>{be.setShowEditor(!0)},[be]),br=(0,f.useCallback)(async()=>{if(!be.fileContent||"text"!==be.fileContent.type||!be.fileContent.content)return;let a=await j.t4.runPromiseExit((0,k.OJ)({cwd:b,path:be.selectedPath,content:be.fileContent.content}));try{if("Failure"===a._tag||!a.value.ok)throw Error("Failed to save file");let b=a.value.data?.mtime;b&&be.setFileContent(a=>a?.type==="text"?{...a,mtime:b}:a),(0,r.oR)(an("toast.savedSuccess"),"success")}catch{(0,r.oR)(an("toast.saveFailed"),"error")}},[b,be]),bs=(0,f.useCallback)(()=>{if(!be.selectedPath)return;let a=aI.current,b=aJ.current;a>0&&be.updateRecentFilePosition(be.selectedPath,a,b?b.cursorLine+1:a,b?b.cursorCol+1:1)},[be]),bt=(0,f.useCallback)(async(a,b)=>{let c=a!==be.selectedPath;if(c&&be.showEditor){if(aN.isDirty&&(!await (0,r.lJ)(an("fileBrowser.saveBeforeSwitch"),{confirmText:an("fileBrowser.saveAndSwitch"),cancelText:an("common.cancel")})||(await aM.current?.save(),aM.current?.isDirty)))return;be.setShowEditor(!1)}c&&bs(),be.handleSelectFile(a,b)},[be,bs,aN.isDirty,an]),bu=(0,f.useMemo)(()=>{let a=bi.contentSearchResults;if(0===a.length)return{files:[],expandDirs:new Set,matchMap:new Map};let b=new Map,c=[];for(let d of a)b.set(d.path,d),c.push(d.path);let d=(0,E.v3)(c),e=new Set((0,E.tW)(d));return{files:d,expandDirs:e,matchMap:b}},[bi.contentSearchResults]),[bv,bw]=(0,f.useState)(new Set),bx=(0,f.useCallback)(a=>{bw(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),by=(0,f.useCallback)(a=>{if(a.isDirectory)return null;let b=bu.matchMap.get(a.path);return b?(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:b.matches.length}):null},[bu.matchMap]),bz=aP&&bi.contentSearchResults.length>0,[bA,bB]=(0,f.useState)("selected"),bC=!!be.selectedPath&&null!==(0,aa.c)(be.selectedPath),[bD,bE]=(0,f.useState)(!1),bF=(0,f.useCallback)(async(a,c)=>{if(!be.selectedPath||!bC)return;let d=await a9.goToDefinition(be.selectedPath,a,c);if(0===d.length)return;let e=d[0],f=b.endsWith("/")?b:b+"/",g=e.file.startsWith(f)?e.file.slice(f.length):e.file;bc.push({filePath:be.selectedPath,lineNumber:aI.current}),g===be.selectedPath?be.setTargetLineNumber(e.line):bt(g,e.line)},[be,b,bC,a9,bc]),bG=(0,f.useCallback)((a,b,c,d,e)=>{a&&null!==(0,aa.c)(a)&&(bE(b),ba.onTokenMouseEnter(a,c,d,e))},[ba]),bH=(0,f.useCallback)((a,b,c)=>{bC&&bG(be.selectedPath,!1,a,b,c)},[be.selectedPath,bC,bG]),bI=(0,f.useCallback)(a=>{let c=b.endsWith("/")?b:b+"/",d=a.file.startsWith(c)?a.file.slice(c.length):a.file;be.selectedPath&&bc.push({filePath:be.selectedPath,lineNumber:aI.current}),d===be.selectedPath?be.setTargetLineNumber(a.line):bt(d,a.line)},[be,b,bc]),bJ=(0,f.useMemo)(()=>{if(!bj.status)return null;let a=new Map,b=a=>{switch(a){case"modified":default:return"M";case"added":case"untracked":return"A";case"deleted":return"D";case"renamed":return"R"}};for(let c of bj.status.staged)a.set(c.path,b(c.status));for(let c of bj.status.unstaged)a.set(c.path,b(c.status));return a},[bj.status]),bK=(0,f.useMemo)(()=>{if(!bj.status)return null;let a=new Map;for(let b of bj.status.staged)"renamed"===b.status&&b.oldPath&&a.set(b.path,b.oldPath);return a},[bj.status]),bL=(0,f.useCallback)(a=>{ax("search"),bi.setContentSearchQuery(a),bi.performContentSearch(a)},[bi.setContentSearchQuery,bi.performContentSearch]),bM=(0,X.H)({cwd:b,selectedPath:be.selectedPath,gitStatusMap:bJ,renameOldPaths:bK,isText:be.fileContent?.type==="text",refreshKey:be.fileContent?.mtime}),bN="tree"===aw&&bM.showDiff,bO=(0,f.useCallback)(a=>{ax(a),be.setBlameSelectedCommit(null),"history"===a&&bm.selectedBranch&&bm.loadCommits(bm.selectedBranch)},[be,bm.selectedBranch,bm.loadCommits]);(0,f.useCallback)(()=>{if(!be.selectedPath)return;let a={filePath:be.selectedPath,lineNumber:aI.current},b=bc.goBack(a);b&&(b.filePath===be.selectedPath?be.setTargetLineNumber(b.lineNumber):bt(b.filePath,b.lineNumber))},[be,bc]),(0,f.useCallback)(()=>{if(!be.selectedPath)return;let a={filePath:be.selectedPath,lineNumber:aI.current},b=bc.goForward(a);b&&(b.filePath===be.selectedPath?be.setTargetLineNumber(b.lineNumber):bt(b.filePath,b.lineNumber))},[be,bc]);let bP=(0,f.useCallback)(async a=>{let c=a.split("/").pop()||a,d=await j.t4.runPromiseExit((0,k.__)({cwd:b,path:a}));"Success"===d._tag?(0,r.oR)(an("toast.copiedName",{name:c}),"success"):(0,r.oR)(an("toast.copyFailed"),"error")},[b,an]),bQ=(0,f.useCallback)(async a=>{let c=await j.t4.runPromiseExit((0,k.dt)());if("Success"!==c._tag||!c.value.path)return void(0,r.oR)(an("toast.noFileToPaste"),"info");let d=c.value.path,e=await j.t4.runPromiseExit((0,k.Nn)({cwd:b,targetDir:a,sourceAbsPath:d}));if("Success"===e._tag)(0,r.oR)(an("toast.pastedFile",{name:e.value.newName}),"success"),be.loadDirectory(a),be.loadFileIndex();else{let a="Fail"===e.cause._tag?e.cause.error:null,b=a?.cause,c=b instanceof Error?b.message:an("toast.pasteFailed");(0,r.oR)(c,"error")}},[b,be,an]);(0,f.useRef)(0),(0,f.useRef)(bd),(0,f.useRef)(aw),(0,f.useRef)(!1);let bR=(0,f.useRef)(bm.selectedBranch);bR.current=bm.selectedBranch;let bS=(0,f.useRef)(be.selectedPath);bS.current=be.selectedPath;let bT=(0,f.useRef)(be.fileContent?.type);bT.current=be.fileContent?.type;let bU=(0,f.useCallback)(async a=>{try{let{data:c}=a;if(!Array.isArray(c))return;let d=c.some(a=>"git"===a.type),e=c.some(a=>"file"===a.type),f=[];if((e||d)&&(f.push(j.t4.runPromise((0,k.mP)(b)).then(a=>{a.error||be.setFiles(b=>(0,E.HR)(a.files??[],b))}).catch(()=>{})),f.push(j.t4.runPromise((0,k.DZ)(b)).then(a=>{a.paths&&be.setFileIndex(a.paths)}).catch(()=>{})),f.push(j.t4.runPromise((0,k.r9)(b)).then(a=>{be.setRecentFiles(a.files??[])}).catch(()=>{}))),d||e){f.push(j.t4.runPromise((0,m.lv)(b)).then(a=>{bj.setStatus(a);let b=(0,t.Do)(a.staged),c=(0,t.Do)(a.unstaged);bj.setStagedTree(b),bj.setUnstagedTree(c)}).catch(()=>{})),bj.refreshDiff(),d&&bm.loadBranches();let a=bR.current;a&&f.push(j.t4.runPromise((0,m.Bj)(b,a,E.B_)).then(a=>{let b=a.commits??[];bm.setCommits(b),bm.setHasMoreCommits(b.length>=E.B_)}).catch(()=>{}))}let g=bS.current,h=bT.current;g&&"text"===h&&f.push(j.t4.runPromise((0,l.K)(b,g)).then(a=>{let b=a.ok?a.data:null;b&&"string"==typeof b.content&&be.setFileContent({type:"text",content:b.content,size:b.size,mtime:b.mtimeMs,...b.isSymlink?{isSymlink:!0,symlinkTarget:b.symlinkTarget}:{}})}).catch(()=>{})),await Promise.all(f)}catch(a){console.error("File watch handler error:",a)}},[b]);(0,J.h)({url:`/ws/watch?cwd=${encodeURIComponent(b)}`,onMessage:bU,enabled:bd});let bV=(0,f.useCallback)(a=>{bt(a),be.setShouldScrollToSelected(!0),ax("tree")},[be,bt]);(0,f.useRef)(bt),(0,f.useRef)(null);let{setPreviewMarkdown:bW,setShouldScrollToSelected:bX}=be,bY=(0,f.useCallback)(({focalFile:a})=>a&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{onClick:c=>{c.stopPropagation(),navigator.clipboard.writeText(`${b}/${a}`),(0,r.oR)(an("common.copiedPath"))},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-hover transition-colors flex-shrink-0",title:an("common.copyAbsPath"),children:(0,e.jsx)("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),bV(a)},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-hover transition-colors flex-shrink-0",title:an("fileBrowser.locateInTree"),children:(0,e.jsxs)("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,e.jsx)("circle",{cx:"12",cy:"12",r:"10",strokeWidth:2}),(0,e.jsx)("circle",{cx:"12",cy:"12",r:"3",strokeWidth:2}),(0,e.jsx)("path",{strokeLinecap:"round",strokeWidth:2,d:"M12 2v4m0 12v4M2 12h4m12 0h4"})]})})]}),[b,bV,an]),bZ=(0,f.useCallback)(({focalFile:a})=>"tree"===aw&&bM.canDiff&&a===be.selectedPath?(0,e.jsxs)(e.Fragment,{children:[bM.showDiff&&(0,e.jsx)(p.y,{value:aX,onChange:aY}),(0,e.jsx)("button",{onClick:bM.toggleDiff,className:`px-1.5 py-0.5 text-xs rounded transition-colors ${bM.showDiff?"bg-brand text-white":"text-muted-foreground hover:bg-hover"}`,title:bM.showDiff?an("fileBrowser.exitDiff"):an("fileBrowser.viewDiff"),children:an("common.diff")})]}):null,[aw,bM.canDiff,bM.showDiff,bM.toggleDiff,be.selectedPath,aX,an]),[b$,b_]=(0,f.useState)(null),b0=(0,f.useCallback)((a,b)=>{be.setPreviewMarkdown(!0),bV(a),b_(b),b&&setTimeout(()=>b_(null),400)},[be,bV]);return(0,e.jsxs)(u.SU,{container:aC,children:[(0,e.jsxs)("div",{ref:aA,className:"bg-card w-full h-full flex flex-col relative",children:[(0,e.jsxs)("div",{className:"flex-1 flex overflow-hidden",children:[(0,e.jsxs)("div",{className:"flex-shrink-0 flex flex-col overflow-hidden",style:{width:a_},children:[(0,e.jsxs)("div",{className:"flex border-b border-border",children:[(0,e.jsx)("button",{onClick:()=>bO("tree"),className:`flex-1 px-2 py-2 text-sm font-medium transition-colors ${"tree"===aw?"text-brand border-b-2 border-brand":"text-muted-foreground hover:text-foreground dark:hover:text-foreground"}`,children:an("fileBrowser.directoryTree")}),(0,e.jsx)("button",{onClick:()=>bO("search"),className:`flex-1 px-2 py-2 text-sm font-medium transition-colors ${"search"===aw?"text-brand border-b-2 border-brand":"text-muted-foreground hover:text-foreground dark:hover:text-foreground"}`,children:an("fileBrowser.searchTab")}),(0,e.jsx)("button",{onClick:()=>bO("recent"),className:`flex-1 px-2 py-2 text-sm font-medium transition-colors ${"recent"===aw?"text-brand border-b-2 border-brand":"text-muted-foreground hover:text-foreground dark:hover:text-foreground"}`,children:an("fileBrowser.recentTab")}),(0,e.jsx)("button",{onClick:()=>bO("status"),className:`flex-1 px-2 py-2 text-sm font-medium transition-colors ${"status"===aw?"text-brand border-b-2 border-brand":"text-muted-foreground hover:text-foreground dark:hover:text-foreground"}`,children:an("fileBrowser.changesTab")}),(0,e.jsx)("button",{onClick:()=>bO("history"),className:`flex-1 px-2 py-2 text-sm font-medium transition-colors ${"history"===aw?"text-brand border-b-2 border-brand":"text-muted-foreground hover:text-foreground dark:hover:text-foreground"}`,children:an("fileBrowser.historyTab")})]}),"tree"===aw&&(0,e.jsxs)("div",{className:"p-2 border-b border-border flex items-center gap-2",children:[(0,e.jsxs)("div",{className:"flex-1 relative",children:[(0,e.jsx)("input",{ref:be.searchInputRef,type:"text",value:be.searchQuery,onChange:a=>be.setSearchQuery(a.target.value),placeholder:an("fileBrowser.searchFiles"),className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded bg-card text-foreground focus:outline-none focus:ring-2 focus:ring-ring"}),be.searchQuery&&(0,e.jsx)("button",{onClick:()=>{be.setSearchQuery(""),be.searchInputRef.current?.focus()},className:"absolute right-1.5 top-1/2 -translate-y-1/2 p-0.5 text-foreground-subtle hover:text-foreground rounded-sm transition-colors",title:an("fileBrowser.clear"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsx)("button",{onClick:()=>be.setSearchDirExact(a=>!a),className:`px-1 py-0.5 rounded transition-colors text-xs font-mono font-bold border ${be.searchExactMatch?"border-brand text-brand bg-brand/10":"border-transparent text-muted-foreground hover:text-foreground hover:bg-hover"}`,title:be.searchExactMatch?an("fileBrowser.exactMatchOn"):an("fileBrowser.exactMatchOff"),children:"ab"}),(0,e.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,e.jsx)("button",{onClick:()=>be.loadFiles(),className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-hover rounded transition-colors",title:an("fileBrowser.refreshTree"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}),(0,e.jsx)("button",{onClick:()=>be.searchTreeExpandedPaths?be.setSearchTreeExpandedPaths(new Set):be.setExpandedPaths(new Set),className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-hover rounded transition-colors",title:an("fileBrowser.collapseAll"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 12H4"})})})]})]}),"search"===aw&&(0,e.jsxs)("div",{className:"p-2 border-b border-border space-y-2",children:[(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsxs)("div",{className:"flex-1 relative",children:[(0,e.jsx)("input",{ref:bi.contentSearchInputRef,type:"text",value:bi.contentSearchQuery,onChange:a=>bi.setContentSearchQuery(a.target.value),onKeyDown:a=>{"Enter"===a.key&&bi.performContentSearch(bi.contentSearchQuery)},placeholder:an("fileBrowser.searchFileContent"),className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded bg-card text-foreground focus:outline-none focus:ring-2 focus:ring-ring"}),bi.contentSearchQuery&&(0,e.jsx)("button",{onClick:()=>{bi.setContentSearchQuery(""),bi.contentSearchInputRef.current?.focus()},className:"absolute right-1.5 top-1/2 -translate-y-1/2 p-0.5 text-foreground-subtle hover:text-foreground rounded-sm transition-colors",title:an("fileBrowser.clear"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsx)("button",{onClick:()=>bi.performContentSearch(bi.contentSearchQuery),disabled:bi.isSearching||!bi.contentSearchQuery.trim(),className:"px-3 py-1.5 text-sm bg-brand text-white rounded hover:bg-brand/90 disabled:opacity-50 disabled:cursor-not-allowed",children:bi.isSearching?"...":an("common.search")})]}),(0,e.jsxs)("div",{className:"flex flex-wrap gap-2 text-xs",children:[(0,e.jsxs)("label",{className:"flex items-center gap-1 cursor-pointer",children:[(0,e.jsx)("input",{type:"checkbox",checked:bi.searchOptions.caseSensitive,onChange:a=>bi.setSearchOptions(b=>({...b,caseSensitive:a.target.checked})),className:"w-3 h-3"}),(0,e.jsx)("span",{className:"text-muted-foreground",children:an("fileBrowser.caseSensitive")})]}),(0,e.jsxs)("label",{className:"flex items-center gap-1 cursor-pointer",children:[(0,e.jsx)("input",{type:"checkbox",checked:bi.searchOptions.wholeWord,onChange:a=>bi.setSearchOptions(b=>({...b,wholeWord:a.target.checked})),className:"w-3 h-3"}),(0,e.jsx)("span",{className:"text-muted-foreground",children:an("fileBrowser.wholeWord")})]}),(0,e.jsxs)("label",{className:"flex items-center gap-1 cursor-pointer",children:[(0,e.jsx)("input",{type:"checkbox",checked:bi.searchOptions.regex,onChange:a=>bi.setSearchOptions(b=>({...b,regex:a.target.checked})),className:"w-3 h-3"}),(0,e.jsx)("span",{className:"text-muted-foreground",children:an("fileBrowser.regex")})]}),(0,e.jsx)("input",{type:"text",value:bi.searchOptions.fileType,onChange:a=>bi.setSearchOptions(b=>({...b,fileType:a.target.value})),placeholder:an("fileBrowser.fileTypes"),className:"w-24 px-2 py-0.5 text-xs border border-border rounded bg-card text-foreground"})]})]}),"history"===aw&&(0,e.jsx)("div",{className:"p-3 border-b border-border",children:bm.compareMode?(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsxs)("div",{className:"flex-1 min-w-0 px-3 py-1.5 text-sm border border-border rounded bg-secondary text-foreground flex items-center gap-2",children:[(0,e.jsx)("svg",{className:"w-4 h-4 text-muted-foreground flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),(0,e.jsx)("span",{className:"truncate",children:bm.branches?.current||"HEAD"}),(0,e.jsx)("span",{className:"text-xs text-green-11 flex-shrink-0",children:"HEAD"})]}),(0,e.jsx)("button",{onClick:()=>bm.toggleCompareMode(!1),className:"flex-shrink-0 px-2.5 py-1.5 text-xs font-medium rounded-lg transition-colors bg-brand text-white",title:an("fileBrowser.compareModeOff"),children:an("fileBrowser.compareMode")})]}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground flex-shrink-0 pl-1",children:"vs"}),(0,e.jsx)("div",{className:"flex-1 min-w-0",children:(0,e.jsx)(Q.e,{branches:bm.branches,selectedBranch:bm.compareBaseBranch,onSelect:a=>{bm.setCompareBaseBranch(a),bm.loadCompareFiles(a)},isLoading:bm.isLoadingBranches,pinnedBranches:["origin/main",...bm.upstreamBranch&&"origin/main"!==bm.upstreamBranch?[bm.upstreamBranch]:[]]})})]})]}):(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("div",{className:"flex-1 min-w-0",children:(0,e.jsx)(Q.e,{branches:bm.branches,selectedBranch:bm.selectedBranch,onSelect:a=>{bm.setSelectedBranch(a)},isLoading:bm.isLoadingBranches,pinnedBranches:["origin/main",...bm.upstreamBranch&&"origin/main"!==bm.upstreamBranch?[bm.upstreamBranch]:[]]})}),(0,e.jsx)("button",{onClick:()=>bm.toggleCompareMode(!0),className:"flex-shrink-0 px-2.5 py-1.5 text-xs font-medium rounded-lg transition-colors text-muted-foreground hover:text-foreground hover:bg-hover border border-border",title:an("fileBrowser.compareModeOn"),children:an("fileBrowser.compareMode")})]})}),(0,e.jsxs)("div",{className:"flex-1 overflow-hidden flex flex-col",children:[(0,e.jsxs)("div",{className:`flex-1 flex flex-col min-h-0 ${"tree"===aw?"":"hidden"}`,children:[be.creatingItem&&(0,e.jsxs)("div",{className:"px-2 py-1.5 border-b border-border flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:be.creatingItem.parentPath?an("fileBrowser.createFileIn",{path:be.creatingItem.parentPath}):an("fileBrowser.createFile")}),(0,e.jsx)("input",{type:"text",autoFocus:!0,placeholder:an("fileBrowser.fileName"),className:"flex-1 px-2 py-1 text-sm border border-border rounded bg-card text-foreground focus:outline-none focus:ring-2 focus:ring-ring",onCompositionStart:()=>{aB.current=!0},onCompositionEnd:()=>{aB.current=!1},onKeyDown:async a=>{if("Enter"===a.key){if(aB.current)return;let c=a.target.value.trim();if(!c)return;let d=be.creatingItem.parentPath,e=d?`${d}/${c}`:c,f=await j.t4.runPromiseExit((0,k.OJ)({cwd:b,path:e,content:""}));if("Success"===f._tag&&f.value.ok)(0,r.oR)(an("toast.createdFile",{name:c}),"success"),be.setCreatingItem(null),be.loadDirectory(d),be.loadFileIndex(),d&&be.setExpandedPaths(a=>new Set([...a,d])),bt(e);else if("Success"===f._tag){let a=f.value.data?.error;(0,r.oR)(a||an("toast.createFailed"),"error")}else(0,r.oR)(an("toast.createFailed"),"error")}else"Escape"===a.key&&be.setCreatingItem(null)},onBlur:()=>be.setCreatingItem(null)})]}),be.isLoadingFiles?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:an("common.loading")}):be.fileError?(0,e.jsx)("div",{className:"p-4 text-center text-red-11 text-sm",children:be.fileError}):(0,e.jsx)(s.h,{files:be.files,selectedPath:be.selectedPath,expandedPaths:be.effectiveExpandedPaths,matchedPaths:be.matchedPaths,gitStatusMap:bJ,loadingDirs:be.loadingDirs,onSelect:a=>{be.setShouldScrollToSelected(!1),bt(a)},onToggle:be.handleToggle,cwd:b,shouldScrollToSelected:be.shouldScrollToSelected,onScrolledToSelected:()=>be.setShouldScrollToSelected(!1),onCreateFile:a=>be.setCreatingItem({type:"file",parentPath:a}),onDelete:(a,b,c)=>aF({path:a,isDirectory:b,name:c}),onRefresh:()=>be.loadFiles(),onCopyFile:bP,onPaste:bQ,onExplain:ao?ap:void 0,explainDisabled:ao?.isLoading})]}),(0,e.jsx)("div",{className:`flex-1 flex flex-col min-h-0 ${"search"===aw?"":"hidden"}`,children:bi.isSearching?(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,e.jsx)("span",{className:"inline-block w-6 h-6 border-2 border-brand border-t-transparent rounded-full animate-spin"})}):bi.searchError?(0,e.jsx)("div",{className:"p-4 text-center text-red-11 text-sm",children:bi.searchError}):0===bi.contentSearchResults.length?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:bi.contentSearchQuery?an("fileBrowser.noContentSearchResults"):an("fileBrowser.enterKeywordToSearch")}):(0,e.jsxs)("div",{className:"flex-1 overflow-y-auto flex flex-col min-h-0",children:[bi.searchStats&&(0,e.jsxs)("div",{className:"px-3 py-1.5 text-xs text-muted-foreground border-b border-border flex-shrink-0",children:[an("fileBrowser.nFilesNMatches",{files:bi.searchStats.totalFiles,matches:bi.searchStats.totalMatches}),bi.searchStats.truncated&&(0,e.jsxs)("span",{className:"text-amber-11 ml-1",children:["(",an("fileBrowser.resultsTruncated"),")"]})]}),(0,e.jsx)(s.h,{files:bu.files,selectedPath:be.selectedPath,expandedPaths:bv,onSelect:a=>{let b=bu.matchMap.get(a);bt(a,b?.matches[0]?.lineNumber),aP||aQ(!0)},onToggle:bx,cwd:b,onExplain:ao?ap:void 0,explainDisabled:ao?.isLoading,renderActions:by,className:"flex-1 overflow-y-auto py-1 min-w-max"})]})}),(0,e.jsx)("div",{className:`flex-1 flex flex-col min-h-0 ${"recent"===aw?"":"hidden"}`,children:0===be.recentFiles.length?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:an("fileBrowser.noRecentFiles")}):(0,e.jsx)(s.h,{files:be.recentFilesTree,selectedPath:be.selectedPath,expandedPaths:be.recentTreeDirPaths,onSelect:bt,onToggle:E.tE,cwd:b,onExplain:ao?ap:void 0,explainDisabled:ao?.isLoading})}),(0,e.jsx)("div",{className:`flex-1 flex flex-col min-h-0 ${"status"===aw?"":"hidden"}`,children:bj.statusLoading?(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,e.jsx)("span",{className:"inline-block w-6 h-6 border-2 border-brand border-t-transparent rounded-full animate-spin"})}):bj.statusError?(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center p-4",children:(0,e.jsx)("span",{className:"text-red-11 text-sm",children:bj.statusError})}):(0,e.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[(0,e.jsxs)("div",{className:"border-b border-border",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 bg-secondary",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:an("fileBrowser.stagingArea",{count:bj.status?.staged.length||0})}),(0,e.jsx)("button",{onClick:()=>bj.fetchStatus(),className:"p-0.5 text-muted-foreground hover:text-foreground hover:bg-hover rounded transition-colors",title:an("fileBrowser.refreshChanges"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})})]}),(bj.status?.staged.length||0)>0&&(0,e.jsx)("button",{onClick:bj.handleUnstageAll,className:"text-sm text-amber-11 hover:text-amber-10 hover:underline",children:an("fileBrowser.unstageAll")})]}),(0,e.jsx)(t.VO,{files:bj.stagedTree,selectedPath:bj.statusSelectedFile?.type==="staged"?bj.statusSelectedFile.file.path:null,expandedPaths:bj.stagedExpandedPaths,onSelect:a=>a.file&&bj.handleStatusFileSelect(a.file,"staged"),onToggle:bj.handleStagedToggle,cwd:b,emptyMessage:an("fileBrowser.noStagedFiles"),className:"py-1",onExplain:ao?aq:void 0,explainDisabled:ao?.isLoading,renderActions:a=>{if(a.isDirectory){let b=(0,t.wI)(a);return 0===b.length?null:(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),bj.handleUnstageFiles(b.map(a=>a.path))},className:"opacity-0 group-hover:opacity-100 p-0.5 text-amber-11 hover:text-amber-10 hover:bg-amber-9/10 dark:hover:bg-amber-9/20 rounded transition-all",title:an("fileBrowser.unstageNFiles",{count:b.length}),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 12H4"})})})}return(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),bj.handleUnstage(a.path)},className:"opacity-0 group-hover:opacity-100 p-0.5 text-amber-11 hover:text-amber-10 hover:bg-amber-9/10 dark:hover:bg-amber-9/20 rounded transition-all",title:an("fileBrowser.unstageFile"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 12H4"})})})}})]}),(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 bg-secondary",children:[(0,e.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:an("fileBrowser.workspace",{count:bj.status?.unstaged.length||0})}),(bj.status?.unstaged.length||0)>0&&(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("button",{onClick:bj.handleDiscardAll,className:"text-sm text-red-11 hover:text-red-10 hover:underline",children:an("fileBrowser.discardAll")}),(0,e.jsx)("button",{onClick:bj.handleStageAll,className:"text-sm text-green-11 hover:text-green-10 hover:underline",children:an("fileBrowser.stageAll")})]})]}),(0,e.jsx)(t.VO,{files:bj.unstagedTree,selectedPath:bj.statusSelectedFile?.type==="unstaged"?bj.statusSelectedFile.file.path:null,expandedPaths:bj.unstagedExpandedPaths,onSelect:a=>a.file&&bj.handleStatusFileSelect(a.file,"unstaged"),onToggle:bj.handleUnstagedToggle,cwd:b,emptyMessage:an("fileBrowser.noUnstagedChanges"),className:"py-1",onExplain:ao?ar:void 0,explainDisabled:ao?.isLoading,renderActions:a=>{if(a.isDirectory){let b=(0,t.wI)(a);if(0===b.length)return null;let c=b.map(a=>a.file).filter(Boolean);return(0,e.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),bj.handleDiscardFiles(c)},className:"opacity-0 group-hover:opacity-100 p-0.5 text-red-11 hover:text-red-10 hover:bg-red-9/10 dark:hover:bg-red-9/20 rounded transition-all",title:an("fileBrowser.discardNFiles",{count:b.length}),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 10h10a8 8 0 018 8v2M3 10l6 6m-6-6l6-6"})})}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),bj.handleStageFiles(b.map(a=>a.path))},className:"opacity-0 group-hover:opacity-100 p-0.5 text-green-11 hover:text-green-10 hover:bg-green-9/10 dark:hover:bg-green-9/20 rounded transition-all",title:an("fileBrowser.stageNFiles",{count:b.length}),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})})]})}return a.file?(0,e.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),bj.handleDiscardFile(a.file)},className:"opacity-0 group-hover:opacity-100 p-0.5 text-red-11 hover:text-red-10 hover:bg-red-9/10 dark:hover:bg-red-9/20 rounded transition-all",title:an("fileBrowser.discardChanges"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 10h10a8 8 0 018 8v2M3 10l6 6m-6-6l6-6"})})}),(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),bj.handleStage(a.path)},className:"opacity-0 group-hover:opacity-100 p-0.5 text-green-11 hover:text-green-10 hover:bg-green-9/10 dark:hover:bg-green-9/20 rounded transition-all",title:an("fileBrowser.stageFile"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})})]}):null}})]})]})}),(0,e.jsx)("div",{className:`flex-1 flex flex-col min-h-0 ${"history"===aw?"":"hidden"}`,children:bm.historyError?(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,e.jsxs)("div",{className:"text-center",children:[(0,e.jsx)("svg",{className:"w-16 h-16 mx-auto text-foreground-faint mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),(0,e.jsx)("p",{className:"text-muted-foreground",children:bm.historyError})]})}):bm.compareMode?(0,e.jsx)("div",{className:"flex-1 overflow-y-auto overflow-x-hidden",children:bm.isLoadingCompareFiles?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:an("fileBrowser.loadingDiff")}):0===bm.compareFiles.length?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:an("fileBrowser.noDiffFiles")}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"px-3 py-2 border-b border-border",children:(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:an("fileBrowser.nFilesChanged",{count:bm.compareFiles.length,branch:bm.compareBaseBranch})})}),(0,e.jsx)(t.VO,{files:bm.compareFileTree,expandedPaths:bm.compareExpandedPaths,onToggle:bm.handleCompareToggle,selectedPath:bm.compareSelectedFile?.path||null,onSelect:a=>{a.file&&bm.handleSelectCompareFile(a.file)},cwd:b,showChanges:!0,onExplain:ao?bn:void 0,explainDisabled:ao?.isLoading})]})}):(0,e.jsx)("div",{ref:bm.commitListRef,className:"flex-1 overflow-y-auto",onScroll:bm.handleCommitListScroll,children:bm.isLoadingCommits?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:an("fileBrowser.loadingCommits")}):0===bm.commits.length?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:an("fileBrowser.noCommits")}):(0,e.jsxs)(e.Fragment,{children:[bm.commits.map(a=>(0,e.jsxs)("div",{onClick:()=>bm.handleSelectCommit(a),className:`px-3 py-2 border-b border-border cursor-pointer hover:bg-hover ${bm.selectedCommit?.hash===a.hash?"bg-brand/10":""}`,children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"font-mono text-xs text-brand",children:a.shortHash}),(0,e.jsxs)("span",{className:"text-xs text-foreground-subtle","data-tooltip":a.date,children:[a.relativeDate," \xb7 ",(0,E.r6)(a.date)]})]}),(0,e.jsx)("div",{className:"text-sm text-foreground truncate mt-0.5","data-tooltip":a.subject,children:a.subject}),(0,e.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5",children:a.author})]},a.hash)),bm.isLoadingMore&&(0,e.jsx)("div",{className:"p-3 text-center",children:(0,e.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-brand border-t-transparent rounded-full animate-spin"})}),!bm.hasMoreCommits&&bm.commits.length>0&&(0,e.jsx)("div",{className:"p-3 text-center text-xs text-foreground-subtle",children:an("fileBrowser.allLoaded",{count:bm.commits.length})})]})})})]})]}),(0,e.jsx)("div",{onPointerDown:a2,onPointerMove:a3,onPointerUp:a4,onPointerCancel:a4,className:"w-[5px] flex-shrink-0 relative cursor-col-resize group",children:(0,e.jsx)("div",{className:"absolute inset-y-0 left-1/2 -translate-x-1/2 w-px bg-border group-hover:bg-brand transition-colors"})}),(0,e.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[("tree"===aw||"search"===aw||"recent"===aw)&&(be.blameSelectedCommit?(0,e.jsx)(n.n,{isOpen:!0,onClose:()=>be.setBlameSelectedCommit(null),commit:be.blameSelectedCommit,cwd:b,embedded:!0,initialFilePath:be.selectedPath||void 0,onContentSearch:a=>{ax("search"),bi.setContentSearchQuery(a),bi.performContentSearch(a)}}):"map"===ay?bN&&bM.diff?(0,e.jsx)(N.r,{cwd:b,filePath:bM.diff.filePath,oldContent:bM.diff.oldContent,newContent:bM.diff.newContent,isNew:bM.diff.isNew,isDeleted:bM.diff.isDeleted,changedFiles:bk,fileGitStatusMap:bl,compact:"compact"===aX,enableComments:!0,onSwitchToCode:()=>az("code"),onContentSearch:bL,headerExtraLeft:bY,headerExtraRight:bZ}):(0,e.jsx)(M.O,{cwd:b,highlightedFilePath:be.selectedPath,changedFiles:bk,onSwitchToCode:()=>az("code"),enableComments:!0,onContentSearch:bL,headerExtraLeft:bY,headerExtraRight:bZ}):be.selectedPath?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"px-4 py-2 border-b border-border flex-shrink-0 flex items-center justify-between",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1 min-w-0",children:[(0,e.jsx)("span",{className:"text-sm text-muted-foreground truncate",children:be.selectedPath}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),navigator.clipboard.writeText(`${b}/${be.selectedPath}`),(0,r.oR)(an("common.copiedPath"))},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-hover transition-colors flex-shrink-0",title:an("common.copyAbsPath"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),bV(be.selectedPath)},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-hover transition-colors flex-shrink-0",title:an("fileBrowser.locateInTree"),children:(0,e.jsxs)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,e.jsx)("circle",{cx:"12",cy:"12",r:"10",strokeWidth:2}),(0,e.jsx)("circle",{cx:"12",cy:"12",r:"3",strokeWidth:2}),(0,e.jsx)("path",{strokeLinecap:"round",strokeWidth:2,d:"M12 2v4m0 12v4M2 12h4m12 0h4"})]})})]}),(0,e.jsx)("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:be.showEditor?(0,e.jsxs)(e.Fragment,{children:[aN.isDirty&&(0,e.jsx)("span",{className:"text-xs text-amber-11",children:an("fileBrowser.unsaved")}),(0,e.jsx)("button",{onClick:()=>aM.current?.save(),disabled:!aN.isDirty||aN.isSaving,className:`px-1.5 py-0.5 text-xs rounded transition-colors ${aN.isDirty&&!aN.isSaving?"bg-brand text-white hover:bg-brand/90":"bg-secondary text-muted-foreground cursor-not-allowed"}`,children:aN.isSaving?(0,e.jsx)("span",{className:"inline-block w-3 h-3 border-2 border-current border-t-transparent rounded-full animate-spin"}):an("common.save")}),(0,e.jsx)("button",{onClick:()=>aM.current?.close(),className:"px-1.5 py-0.5 text-xs rounded transition-colors text-muted-foreground hover:bg-hover",title:an("fileBrowser.closeEdit"),children:an("fileBrowser.closeBtn")})]}):bN?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(p.y,{value:aX,onChange:aY}),(0,e.jsx)(q.q,{value:aZ,onChange:a$}),!(0,w.e$)(be.selectedPath)&&!(0,w.aR)(be.selectedPath)&&!(0,w.Hz)(be.selectedPath)&&!(0,w.Zy)(be.selectedPath)&&(0,e.jsx)("button",{onClick:()=>az("map"),className:"px-1.5 py-0.5 text-xs rounded transition-colors text-muted-foreground hover:bg-hover",title:an("blockViewer.viewerToggle.toBlock"),children:an("common.codeMap")}),(0,e.jsx)("button",{onClick:bM.toggleDiff,className:"px-1.5 py-0.5 text-xs rounded transition-colors bg-brand text-white",children:an("fileBrowser.exitDiff")})]}):(0,e.jsxs)(e.Fragment,{children:["tree"===aw&&bM.canDiff&&(0,e.jsx)("button",{onClick:bM.toggleDiff,className:"px-1.5 py-0.5 text-xs rounded transition-colors text-muted-foreground hover:bg-hover",title:an("fileBrowser.viewDiff"),children:an("common.diff")}),be.fileContent?.type==="text"&&(0,w.e$)(be.selectedPath)&&(0,e.jsx)(H.ShareReviewToggle,{content:be.fileContent.content||"",sourceFile:be.selectedPath&&b&&be.selectedPath.startsWith(b)?be.selectedPath.slice(b.endsWith("/")?b.length:b.length+1):be.selectedPath||""}),be.fileContent?.type==="text"&&(0,w.Hz)(be.selectedPath)&&be.previewMarkdown&&!be.showBlame&&(0,e.jsx)("div",{className:"flex items-center gap-0.5 rounded border border-border overflow-hidden",children:[!0,!1].map(a=>(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),bh(b=>({version:b.version+1,collapsed:a}))},className:`px-2 py-0.5 text-xs transition-colors ${bg.collapsed===a?"bg-brand text-white":"text-muted-foreground hover:bg-hover"}`,children:an(a?"fileBrowser.collapseAllJson":"fileBrowser.expandAllJson")},String(a)))}),be.fileContent?.type==="text"&&((0,w.e$)(be.selectedPath)||(0,w.aR)(be.selectedPath)||(0,w.Hz)(be.selectedPath)||(0,w.Zy)(be.selectedPath))&&(ai=(ah=(0,w.aR)(be.selectedPath))?be.previewHtml:be.previewMarkdown,(0,e.jsx)("button",{onClick:()=>ah?be.setPreviewHtml(a=>!a):be.setPreviewMarkdown(a=>!a),className:`px-1.5 py-0.5 text-xs rounded transition-colors ${ai?"bg-brand text-white":"text-muted-foreground hover:bg-hover"}`,children:ai?an("fileBrowser.exitPreview"):an("common.preview")})),be.fileContent?.type==="text"&&(0,w.C_)(be.selectedPath||"")&&(ak=(aj=be.selectedPath||"").startsWith("/")?aj:b?`${b.replace(/\/$/,"")}/${aj}`:aj,(0,e.jsx)("button",{onClick:()=>at(ak),className:"px-1.5 py-0.5 text-xs rounded transition-colors text-muted-foreground hover:bg-hover flex items-center",title:an("skills.addTooltip"),children:(0,e.jsx)(y.A,{className:"w-3.5 h-3.5"})})),be.fileContent?.type==="text"&&(0,w.aR)(be.selectedPath)&&(am=(al=be.selectedPath||"").startsWith("/")?al:b?`${b.replace(/\/$/,"")}/${al}`:al,(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{onClick:()=>as(am),className:"px-1.5 py-0.5 text-xs rounded transition-colors text-muted-foreground hover:bg-hover flex items-center",title:an("htmlApps.addTooltip"),children:(0,e.jsx)(y.A,{className:"w-3.5 h-3.5"})}),(0,e.jsx)("button",{onClick:()=>window.dispatchEvent(new CustomEvent("console-open-browser",{detail:{url:am}})),className:"px-1.5 py-0.5 text-xs rounded transition-colors text-muted-foreground hover:bg-hover flex items-center",title:an("common.openInConsole"),children:(0,e.jsx)(z.A,{className:"w-3.5 h-3.5"})}),(0,e.jsx)("button",{onClick:()=>{let a=(0,B.Xe)(am);window.open((0,B.PB)(a,window.location.origin),"_blank")},className:"px-1.5 py-0.5 text-xs rounded transition-colors text-muted-foreground hover:bg-hover flex items-center",title:an("browser.openInNewWindow"),children:(0,e.jsx)(A.A,{className:"w-3.5 h-3.5"})})]})),be.fileContent?.type==="text"&&!(be.previewMarkdown&&((0,w.e$)(be.selectedPath)||(0,w.Hz)(be.selectedPath)||(0,w.Zy)(be.selectedPath))||be.previewHtml&&(0,w.aR)(be.selectedPath))&&(0,e.jsx)("button",{onClick:be.handleToggleBlame,disabled:be.isLoadingBlame,className:`px-1.5 py-0.5 text-xs rounded transition-colors ${be.showBlame?"bg-brand text-white":"text-muted-foreground hover:bg-hover"} disabled:opacity-50`,title:an("fileBrowser.viewBlame"),children:be.isLoadingBlame?(0,e.jsx)("span",{className:"inline-block w-3 h-3 border border-current border-t-transparent rounded-full animate-spin"}):"Blame"}),be.fileContent?.type==="text"&&!(be.previewMarkdown&&((0,w.e$)(be.selectedPath)||(0,w.Hz)(be.selectedPath)||(0,w.Zy)(be.selectedPath))||be.previewHtml&&(0,w.aR)(be.selectedPath))&&(0,e.jsx)("button",{onClick:()=>be.setShowEditor(!0),className:"px-1.5 py-0.5 text-xs rounded transition-colors text-muted-foreground hover:bg-hover",title:an("fileBrowser.editFile"),children:an("common.edit")}),be.fileContent?.type==="text"&&be.fileContent.content&&(0,e.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(be.fileContent.content),(0,r.oR)(an("toast.copiedFileContent"))},className:"px-1.5 py-0.5 text-xs rounded transition-colors text-muted-foreground hover:bg-hover",title:an("fileBrowser.copyFileContent"),children:an("common.copy")}),be.fileContent?.type==="text"&&!(0,w.e$)(be.selectedPath)&&!(0,w.aR)(be.selectedPath)&&!(0,w.Hz)(be.selectedPath)&&!(0,w.Zy)(be.selectedPath)&&(0,e.jsx)("button",{onClick:()=>az("map"),className:"px-1.5 py-0.5 text-xs rounded transition-colors text-muted-foreground hover:bg-hover",title:an("blockViewer.viewerToggle.toBlock"),children:an("common.codeMap")})]})})]}),(0,e.jsx)("div",{className:"flex-1 overflow-hidden",children:be.isLoadingContent?(0,e.jsx)("div",{className:"h-full flex items-center justify-center",children:(0,e.jsx)("span",{className:"inline-block w-6 h-6 border-2 border-brand border-t-transparent rounded-full animate-spin"})}):be.fileContent?"text"===be.fileContent.type&&"string"==typeof be.fileContent.content?bN?bM.isLoadingDiff&&!bM.diff?(0,e.jsx)("div",{className:"h-full flex items-center justify-center",children:(0,e.jsx)("span",{className:"inline-block w-6 h-6 border-2 border-brand border-t-transparent rounded-full animate-spin"})}):bM.diff?"unified"===aZ?(0,e.jsx)(o.xU,{oldContent:bM.diff.oldContent,newContent:bM.diff.newContent,filePath:bM.diff.filePath,cwd:b,enableComments:!0,compact:"compact"===aX,onContentSearch:bL,onTokenHover:(a,b,c)=>bG(bM.diff?.filePath,!0,a,b,c),onTokenHoverLeave:ba.onTokenMouseLeave,onTokenHoverCancel:ba.clearHover}):(0,e.jsx)(o.xZ,{oldContent:bM.diff.oldContent,newContent:bM.diff.newContent,filePath:bM.diff.filePath,isNew:bM.diff.isNew,isDeleted:bM.diff.isDeleted,cwd:b,enableComments:!0,compact:"compact"===aX,onContentSearch:bL,onTokenHover:(a,b,c)=>bG(bM.diff?.filePath,!0,a,b,c),onTokenHoverLeave:ba.onTokenMouseLeave,onTokenHoverCancel:ba.clearHover}):(0,e.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:(0,e.jsxs)("div",{className:"text-center",children:[(0,e.jsx)("p",{children:an("fileBrowser.diffLoadFailed")}),(0,e.jsx)("button",{onClick:bM.toggleDiff,className:"mt-2 text-brand hover:underline text-sm",children:an("fileBrowser.exitDiff")})]})}):be.showBlame&&be.blameError?(0,e.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:(0,e.jsxs)("div",{className:"text-center",children:[(0,e.jsx)("p",{className:"text-red-11",children:be.blameError}),(0,e.jsx)("button",{onClick:()=>be.setShowBlame(!1),className:"mt-2 text-brand hover:underline text-sm",children:an("fileBrowser.backToPreview")})]})}):be.showBlame&&0===be.blameLines.length&&be.isLoadingBlame?(0,e.jsx)("div",{className:"h-full flex items-center justify-center",children:(0,e.jsx)("span",{className:"inline-block w-6 h-6 border-2 border-brand border-t-transparent rounded-full animate-spin"})}):be.previewMarkdown&&(0,w.Hz)(be.selectedPath)&&!be.showBlame?(0,e.jsxs)("div",{className:"h-full flex flex-col bg-background text-foreground",children:[(0,e.jsx)(_._,{search:a6}),(0,e.jsx)("div",{className:"flex-1 overflow-auto px-6 py-4",children:(0,e.jsx)("pre",{ref:a5,className:"whitespace-pre-wrap break-words font-mono",style:{fontSize:"0.8125rem",lineHeight:"1.5"},children:(0,e.jsx)(w.d9.Provider,{value:bg,children:bf})})})]}):be.previewMarkdown&&(0,w.Zy)(be.selectedPath)&&!be.showBlame?(0,e.jsx)(x.C0,{content:be.fileContent.content,filePath:be.selectedPath,className:"h-full"}):be.previewMarkdown&&(0,w.e$)(be.selectedPath)&&!be.showBlame?(0,e.jsx)("div",{className:"h-full flex flex-col",children:(0,e.jsx)(F.M,{content:be.fileContent.content,filePath:be.selectedPath,cwd:b,embedded:!0,onLocalMdLink:b0,scrollToAnchor:b$})}):be.previewHtml&&(0,w.aR)(be.selectedPath)&&!be.showBlame?(0,e.jsx)(G.O,{content:be.fileContent.content,filePath:be.selectedPath,cwd:b,onContentSearch:a=>{ax("search"),bi.setContentSearchQuery(a),bi.performContentSearch(a)}}):(0,e.jsx)(v.Cv,{ref:aM,content:be.fileContent.content,filePath:be.selectedPath,cwd:b,enableComments:!0,scrollToLine:aK??be.targetLineNumber,scrollToLineAlign:null!=aK?"start":be.targetScrollAlign,onScrollToLineComplete:()=>{aL(null),be.setTargetLineNumber(null)},highlightKeyword:"search"===aw?bi.contentSearchQuery:null,visibleLineRef:aI,viStateRef:aJ,initialCursorLine:be.initialCursorLine,initialCursorCol:be.initialCursorCol,onInitialCursorSet:()=>{be.setInitialCursorLine(null),be.setInitialCursorCol(null)},onCmdClick:bC?bF:void 0,onTokenHover:bC?bH:void 0,onTokenHoverLeave:bC?ba.onTokenMouseLeave:void 0,onTokenHoverCancel:bC?ba.clearHover:void 0,blameLines:be.showBlame&&be.blameLines.length>0?be.blameLines:void 0,inlineBlameLines:be.blameLines.length>0?be.blameLines:void 0,onSelectCommit:be.setBlameSelectedCommit,editable:be.showEditor,initialMtime:be.fileContent.mtime,onEditorClose:a=>{be.setShowEditor(!1),aL(a)},onSaved:()=>{let a=aI.current??1;be.loadFileContent(be.selectedPath),be.setShowEditor(!1),aL(a)},onEditorStateChange:aO,viMode:!0,onContentMutate:bp,onEnterInsertMode:bq,onViSave:br,onContentSearch:a=>{ax("search"),bi.setContentSearchQuery(a),bi.performContentSearch(a)}}):"image"===be.fileContent.type&&be.selectedPath?(0,e.jsx)(R.I,{cwd:b,path:be.selectedPath,refreshKey:be.fileContent.mtime,alt:be.selectedPath}):"pdf"===be.fileContent.type&&be.selectedPath?(0,e.jsx)(S.t,{cwd:b,path:be.selectedPath,refreshKey:be.fileContent.mtime}):(0,e.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:(0,e.jsxs)("div",{className:"text-center",children:[(0,e.jsx)("svg",{className:"w-16 h-16 mx-auto text-foreground-faint mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),(0,e.jsx)("p",{children:be.fileContent.message||an("fileBrowser.cannotPreview")})]})}):(0,e.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:an("fileBrowser.selectFileToPreview")})})]}):(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:(0,e.jsxs)("div",{className:"text-center",children:[(0,e.jsx)("svg",{className:"w-16 h-16 mx-auto text-foreground-faint mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),(0,e.jsx)("p",{children:an("fileBrowser.selectFileToPreview")})]})})),"status"===aw&&(bj.statusSelectedFile&&bj.statusDiff?(0,e.jsx)(O.m,{cwd:b,selected:bj.statusSelectedFile,diff:bj.statusDiff,showMarkdownPreview:bj.showStatusDiffPreview,setShowMarkdownPreview:bj.setShowStatusDiffPreview,changedFiles:bk,fileGitStatusMap:bl,onContentSearch:a=>{ax("search"),bi.setContentSearchQuery(a),bi.performContentSearch(a)},locateInTree:bV,jsonPreview:aR,setJsonPreview:aS,jsonPreviewSearch:a8,jsonPreviewPreRef:a7,onTokenHover:(a,b,c)=>bG(bj.statusDiff?.filePath,!0,a,b,c),onTokenHoverLeave:ba.onTokenMouseLeave,onTokenHoverCancel:ba.clearHover}):(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center text-foreground-subtle",children:(0,e.jsx)("span",{children:an("fileBrowser.selectFileToViewDiff")})})),"history"===aw&&!bm.historyError&&(bm.compareMode?bm.isLoadingCompareDiff?(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center text-muted-foreground text-sm",children:an("fileBrowser.loadingDiffContent")}):bm.compareFileDiff?(0,e.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[!(0,E.u)(bm.compareFileDiff.filePath)&&(0,e.jsxs)("div",{className:"flex items-center justify-end gap-2 px-3 py-1.5 border-b border-border flex-shrink-0",children:[(0,e.jsx)(p.y,{value:aT,onChange:aU}),(0,e.jsx)(q.q,{value:aV,onChange:aW})]}),(0,e.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,E.u)(bm.compareFileDiff.filePath)?(0,e.jsx)(P.M,{cwd:b,filePath:bm.compareFileDiff.filePath,oldRev:bm.compareFileDiff.oldRev??(bm.compareFileDiff.isNew?null:bm.compareBaseBranch),newRev:bm.compareFileDiff.newRev??(bm.compareFileDiff.isDeleted?null:"HEAD")}):"unified"===aV?(0,e.jsx)(o.xU,{oldContent:bm.compareFileDiff.oldContent,newContent:bm.compareFileDiff.newContent,filePath:bm.compareFileDiff.filePath,cwd:b,enableComments:!0,compact:"compact"===aT,onPreview:!bm.compareFileDiff.isDeleted&&bm.compareFileDiff.filePath.endsWith(".json")?()=>aS({content:bm.compareFileDiff.newContent,filePath:bm.compareFileDiff.filePath}):void 0,previewLabel:an("common.readable"),onContentSearch:a=>{ax("search"),bi.setContentSearchQuery(a),bi.performContentSearch(a)}}):(0,e.jsx)(o.xZ,{oldContent:bm.compareFileDiff.oldContent,newContent:bm.compareFileDiff.newContent,filePath:bm.compareFileDiff.filePath,isNew:bm.compareFileDiff.isNew,isDeleted:bm.compareFileDiff.isDeleted,cwd:b,enableComments:!0,compact:"compact"===aT,onPreview:!bm.compareFileDiff.isDeleted&&bm.compareFileDiff.filePath.endsWith(".json")?()=>aS({content:bm.compareFileDiff.newContent,filePath:bm.compareFileDiff.filePath}):void 0,previewLabel:an("common.readable"),onContentSearch:a=>{ax("search"),bi.setContentSearchQuery(a),bi.performContentSearch(a)}})})]}):(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center text-foreground-subtle",children:(0,e.jsx)("span",{children:bm.compareFiles.length>0?an("fileBrowser.selectFileToViewDiff"):an("fileBrowser.clickCompareToLoad")})}):bm.selectedCommit?(0,e.jsx)(n.n,{isOpen:!0,onClose:()=>bm.setSelectedCommit(null),commit:bm.selectedCommit,cwd:b,embedded:!0,onContentSearch:a=>{ax("search"),bi.setContentSearchQuery(a),bi.performContentSearch(a)}}):(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center text-foreground-subtle",children:(0,e.jsx)("span",{children:an("fileBrowser.selectCommitToView")})}))]})]}),aG&&(0,e.jsx)(I.c,{files:be.files,fileIndex:be.fileIndex,recentFiles:be.recentFilePaths,onSelectFile:a=>{bt(a),be.setShouldScrollToSelected(!0),ax("tree")},onClose:()=>aH(!1)}),(bz||bb.visible)&&(0,e.jsxs)("div",{className:`flex ${bb.visible&&bz?"":"flex-col"}`,children:[bz&&(0,e.jsx)("div",{className:bb.visible?"flex-1 min-w-0 border-r border-border":"",children:(0,e.jsx)(ad.D,{results:bi.contentSearchResults,loading:bi.isSearching,totalMatches:bi.searchStats?.totalMatches??0,onSelect:(a,b)=>{be.selectedPath&&bc.push({filePath:be.selectedPath,lineNumber:aI.current}),az("code"),bt(a,b)},onClose:()=>aQ(!1),scope:bA,onScopeChange:bB,selectedPath:be.selectedPath})}),bb.visible&&(0,e.jsx)("div",{className:bz?"flex-1 min-w-0":"",children:(0,e.jsx)(ac.D,{references:bb.references,loading:bb.loading,onSelect:bI,onClose:bb.closeReferences})})]})]}),aE&&(0,e.jsx)(i.ZL,{children:(0,e.jsx)("div",{className:"fixed inset-0 z-[300] flex items-center justify-center bg-scrim",onClick:()=>aF(null),children:(0,e.jsxs)("div",{className:"bg-card border border-border rounded-lg shadow-lv3 p-4 max-w-sm w-full mx-4",onClick:a=>a.stopPropagation(),children:[(0,e.jsx)("h3",{className:"text-sm font-medium text-foreground mb-2",children:an("fileBrowser.confirmDelete")}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:an("fileBrowser.confirmDeleteMessage",{name:aE.name}).split(/<\/?file>/g).map((a,b)=>1===b?(0,e.jsx)("span",{className:"font-mono text-foreground",children:a},b):a)}),(0,e.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,e.jsx)("button",{onClick:()=>aF(null),className:"px-3 py-1.5 text-sm rounded border border-border hover:bg-hover transition-colors",children:an("common.cancel")}),(0,e.jsx)("button",{onClick:async()=>{let{path:a,name:c}=aE;aF(null);let d=await j.t4.runPromiseExit((0,k.VK)({cwd:b,path:a}));if("Success"===d._tag){(0,r.oR)(an("toast.movedToTrash",{name:c}),"success");let b=a.includes("/")?a.substring(0,a.lastIndexOf("/")):"";be.loadDirectory(b),be.loadFileIndex(),be.selectedPath===a&&bt("")}else{let a="Fail"===d.cause._tag?d.cause.error:null,b=a?.cause,c=b instanceof Error?b.message:an("toast.deleteFailed");(0,r.oR)(c,"error")}},className:"px-3 py-1.5 text-sm rounded bg-destructive text-destructive-foreground hover:bg-destructive/90 transition-colors",children:an("common.delete")})]})]})})}),ba.hoverInfo&&aC&&(0,h.createPortal)((0,e.jsx)(ab.s,{ref:ba.setTooltipEl,displayString:ba.hoverInfo.displayString,documentation:ba.hoverInfo.documentation,x:ba.hoverInfo.x,y:ba.hoverInfo.y,container:aC,onMouseEnter:ba.onCardMouseEnter,onMouseLeave:ba.onCardMouseLeave,onFindReferences:bD?void 0:()=>{let{filePath:a,line:b,column:c}=ba.hoverInfo;ba.clearHover(),bb.findReferences(a,b,c)},onSearch:a=>{ba.clearHover(),ax("search"),bi.setContentSearchQuery(a),bi.performContentSearch(a)},onExplain:ao?a=>{let{filePath:b,line:c}=ba.hoverInfo;ba.clearHover(),ao.sendMessage(an("explain.symbolMessage",{name:a,path:b,lines:String(c)}))}:void 0,explainDisabled:ao?.isLoading}),aC)]})});d()}catch(a){d(a)}})},70440:(a,b,c)=>{"use strict";function d(){return[{type:"image/x-icon",sizes:"16x16",url:"/favicon.ico?a49a3c8f7b751288"}]}c.r(b),c.d(b,{default:()=>d})},70596:(a,b,c)=>{"use strict";c.d(b,{t:()=>g});var d=c(48249),e=c(67484),f=c(44384);function g({x:a,y:b,comment:c,container:h,onClose:i,onUpdateComment:j,onDeleteComment:k}){let{t:l}=(0,f.Bd)(),[m,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(c.content),q=(0,e.useRef)(null),[r,s]=(0,e.useState)({x:0,y:0}),t=async()=>{o.trim()&&(await j(c.id,o.trim()),n(!1))},u=async()=>{await k(c.id),i()};return(0,d.jsx)("div",{ref:q,className:"absolute z-[200] w-96 bg-card border border-border rounded-lg shadow-lv2 overflow-hidden",style:{left:r.x,top:r.y},children:(0,d.jsx)("div",{className:"p-3",children:m?(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)("textarea",{value:o,onChange:a=>p(a.target.value),className:"w-full px-2 py-1.5 text-sm border border-border rounded bg-card resize-none focus:outline-none focus:ring-1 focus:ring-ring",rows:3,autoFocus:!0,onKeyDown:a=>{"Enter"!==a.key||a.shiftKey||a.nativeEvent.isComposing||(a.preventDefault(),t()),"Escape"===a.key&&(n(!1),p(c.content))}}),(0,d.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,d.jsx)("button",{onClick:()=>{n(!1),p(c.content)},className:"px-2 py-1 text-xs text-muted-foreground hover:text-foreground",children:l("common.cancel")}),(0,d.jsx)("button",{onClick:t,className:"px-2 py-1 text-xs bg-brand text-white rounded hover:bg-brand/90",children:l("common.save")})]})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:c.content}),(0,d.jsxs)("div",{className:"mt-2 flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:l("comments.lineRange",{start:c.startLine,end:c.endLine})}),(0,d.jsxs)("div",{className:"flex gap-1",children:[(0,d.jsx)("button",{onClick:()=>n(!0),className:"p-1 rounded hover:bg-hover text-muted-foreground",title:l("common.edit"),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),(0,d.jsx)("button",{onClick:u,className:"p-1 rounded hover:bg-hover text-muted-foreground hover:text-red-9",title:l("common.delete"),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]})]})]})})})}},71192:(a,b,c)=>{"use strict";c.d(b,{m_:()=>f,uV:()=>e});var d=c(81218);class e extends d.rN("AppError"){}d.rN("DBError"),d.rN("WSError"),d.rN("FSError"),d.rN("AgentError"),d.rN("ValidationError");class f extends d.rN("NotFoundError"){}d.rN("PermissionError")},72399:(a,b,c)=>{"use strict";c.d(b,{ProjectSidebar:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call ProjectSidebar() from the server but ProjectSidebar is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/ProjectSidebar.tsx","ProjectSidebar")},72529:(a,b,c)=>{"use strict";c.d(b,{m:()=>f});var d=c(48249),e=c(67484);function f({content:a,children:b,className:c}){if(c)return(0,d.jsx)("div",{"data-tooltip":a,className:c,children:b});let g=e.Children.toArray(b);if(1===g.length&&(0,e.isValidElement)(g[0])){let b=g[0];return(0,e.cloneElement)(b,{"data-tooltip":a})}return(0,d.jsx)("div",{"data-tooltip":a,style:{display:"contents"},children:b})}},73414:(a,b,c)=>{"use strict";c.d(b,{YO:()=>e,aj:()=>d,pU:()=>f});let d=3,e=20;function f(a,b,c,g=[]){let h=a.length,i=c=>"unchanged"!==a[c].type||"unchanged"!==b[c].type,j=new Set;for(let a=0;a<h;a++){if(!i(a))continue;let b=Math.max(0,a-d),c=Math.min(h-1,a+d);for(let a=b;a<=c;a++)j.add(a)}let k=[];for(let a=0;a<h;a++){if(j.has(a))continue;let b=a;for(;a<h&&!j.has(a);)a++;k.push({id:k.length,startIdx:b,endIdx:a-1}),a--}for(let a of k){let b=c.get(a.id)??{topRevealed:0,bottomRevealed:0},d=a.endIdx-a.startIdx+1,e=Math.max(0,Math.min(b.topRevealed,d)),f=Math.max(0,Math.min(b.bottomRevealed,d-e));for(let b=a.startIdx;b<a.startIdx+e;b++)j.add(b);for(let b=a.endIdx-f+1;b<=a.endIdx;b++)j.add(b)}let l=[];for(let a=0;a<h;a++){let c;if(j.has(a)){l.push({kind:"diff",idx:a});continue}let d=a;for(;a<h&&!j.has(a);)a++;let f=a-1;a--;let i=k.find(a=>a.startIdx<=d&&f<=a.endIdx);if(!i)continue;let m=f-d+1,n=Math.min(e,m);if(g.length>0&&f+1<h)for(let a=f+1;a<h;a++){let d=b[a].lineNum;if(!(d<=0)){c=function(a,b){let c=null;for(let d of a)d.startLine<=b&&b<=d.endLine&&(!c||d.endLine-d.startLine<c.endLine-c.startLine)&&(c=d);return c}(g,d)??void 0;break}}l.push({kind:"gap-expand",gapId:i.id,direction:"up",revealCount:n}),l.push({kind:"gap-label",gapId:i.id,hiddenCount:m,enclosingFn:c}),l.push({kind:"gap-expand",gapId:i.id,direction:"down",revealCount:n})}return{rows:l,gaps:k}}},73887:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{M:()=>A});var e=c(48249),f=c(67484),g=c(44384),h=c(64825),i=c(74429),j=c(7122),k=c(7833),l=c(41051),m=c(42140),n=c(70596),o=c(74754),p=c(7031),q=c(91579),r=c(208),s=c(98356),t=c(64676),u=c(84835);c(15466);var v=c(60591),w=c(34728),x=c(24680),y=c(92608),z=c(37690);let a=[u.W];function A({content:b,filePath:c,cwd:d,onClose:u,sourceFile:B,embedded:C=!1,onLocalMdLink:D,scrollToAnchor:E}){let F=B||(d&&c.startsWith(d)?c.slice(d.endsWith("/")?d.length:d.length+1):c),{t:G}=(0,g.Bd)(),H=(0,j.iN)(),I=(0,p.r)(),J=(0,w.U)(),{comments:K,addComment:L,updateComment:M,deleteComment:N,refresh:O}=(0,o._)({cwd:d,filePath:c}),[P,Q]=(0,f.useState)(!1),[R,S]=(0,f.useState)(null),[T,U]=(0,f.useState)(null),[V,W]=(0,f.useState)(null),X=(0,f.useMemo)(()=>b.split("\n"),[b]),Y=(0,f.useMemo)(()=>(0,t.J4)(c,d),[c,d]),[Z,$]=(0,f.useState)(null),_=(0,f.useRef)(null),aa=(0,f.useRef)({onLocalMdLink:D,sourceFile:F});aa.current={onLocalMdLink:D,sourceFile:F};let ab=(0,f.useRef)(a=>{let{onLocalMdLink:b,sourceFile:c}=aa.current;if(!b||/^[a-z][a-z0-9+.-]*:/i.test(a))return!1;let d=a.indexOf("#"),e=d>=0?a.slice(0,d):a,f=d>=0?a.slice(d+1):null;if(!e)return!1;let g=e;try{g=decodeURIComponent(e)}catch{}return!!(0,v.e$)(g)&&(b((0,v.WU)(c,g),f),!0)}).current,{toolbarRef:ac,bumpRef:ad,clearToolbar:ae}=(0,z.L)({enabled:!0,container:Z,resolveLineRange:a=>{let b=function(a){let b=a.nodeType===Node.TEXT_NODE?a.parentElement:a;if(!b||!("closest"in b))return null;let c=b.closest("[data-source-start]");if(!c)return null;let d=c.getAttribute("data-source-start"),e=c.getAttribute("data-source-end");return d&&e?{start:parseInt(d,10),end:parseInt(e,10)}:null}(a);return b?{start:b.start,end:b.end}:null},buildLineSnapshot:({start:a,end:b})=>{let c=Math.max(0,a-1),d=Math.min(X.length,b);return X.slice(c,d).join("\n")}}),af=(0,f.useCallback)(()=>{let a=ac.current;a&&(S({x:a.x,y:a.y,range:a.range,selectedText:a.selectedText,lineSnapshot:a.lineSnapshot}),ae())},[ae,ac]),ag=(0,f.useCallback)(()=>{let a=ac.current;a&&(U({x:a.x,y:a.y,range:a.range,selectedText:a.selectedText,lineSnapshot:a.lineSnapshot}),ae())},[ae,ac]),ah=(0,f.useCallback)(()=>{let a=ac.current;a&&I&&(ae(),(0,q.Ff)(I.sendMessage,{filePath:c,startLine:a.range.start,endLine:a.range.end,codeContent:a.lineSnapshot},r.A.t("explain.selectionMessage")))},[I,c,ae,ac]),ai=(0,f.useCallback)(async a=>{R&&(await L(R.range.start,R.range.end,a,R.selectedText),S(null))},[R,L]),aj=(0,f.useCallback)(async(a,b)=>{if(I)try{let e=await (0,q.$3)(d),f=[];for(let a of e)f.push({filePath:a.filePath,startLine:a.startLine,endLine:a.endLine,codeContent:a.codeContent,note:a.content||void 0});f.push({filePath:c,startLine:a.range.start,endLine:a.range.end,codeContent:a.lineSnapshot});let g=(0,q.Gw)(f,b);I.sendMessage(g),await (0,q.RP)(d),O()}catch(a){console.error("Failed to send to AI:",a)}},[I,c,d,O]),ak=(0,f.useCallback)(a=>{T&&aj(T,a)},[T,aj]),al=(0,f.useCallback)(a=>{R&&aj(R,a)},[R,aj]);(0,f.useMemo)(()=>{if(0===K.length)return[];let a=new Map;for(let b of K){let c=`${b.startLine}-${b.endLine}`;a.has(c)||a.set(c,[]),a.get(c).push(b)}return Array.from(a.entries()).map(([a,b])=>({key:a,startLine:b[0].startLine,endLine:b[0].endLine,comments:b}))},[K]);let[am,an]=(0,f.useState)([]);return(0,e.jsxs)(e.Fragment,{children:[!C&&(0,e.jsxs)("div",{className:"px-4 py-3 border-b border-border flex items-center justify-between gap-3 flex-shrink-0",children:[(0,e.jsxs)("span",{className:"text-sm font-medium text-foreground truncate min-w-0 flex-1 cursor-pointer hover:text-brand transition-colors",style:{direction:"rtl",textAlign:"left"},"data-tooltip":c,onClick:()=>{navigator.clipboard.writeText(c),(0,k.oR)(G("common.copiedPath"))},children:["‎",c]}),(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsx)(y.ShareReviewToggle,{content:b,sourceFile:F}),(0,v.C_)(c)&&(0,e.jsx)("button",{onClick:()=>J(c.startsWith("/")||!d?c:`${d.replace(/\/$/,"")}/${c}`),className:"p-1 text-muted-foreground hover:text-foreground hover:bg-hover rounded transition-colors",title:G("skills.addTooltip"),children:(0,e.jsx)(h.A,{className:"w-4 h-4"})}),(0,e.jsx)("button",{onClick:u,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-hover rounded transition-colors",title:G("common.close"),children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),(0,e.jsxs)("div",{className:"flex-1 flex overflow-hidden",children:[(0,e.jsx)(x.l,{content:b,containerRef:_}),(0,e.jsxs)("div",{className:"flex-1 overflow-auto relative",ref:_,children:[(0,e.jsx)("div",{className:"p-6",children:(0,e.jsx)(s.T,{content:b,basePath:Y,rehypePlugins:a,onLinkClick:ab})}),am.map(({key:a,top:b,comments:c})=>(0,e.jsx)("div",{className:"absolute right-3 cursor-pointer z-10",style:{top:b},onClick:a=>{a.stopPropagation(),W({comment:c[0],x:a.clientX,y:a.clientY})},children:(0,e.jsx)("div",{className:"w-5 h-5 rounded-full bg-amber-500/80 text-white text-xs flex items-center justify-center shadow-lv1 hover:bg-amber-500 transition-colors",children:c.length})},a))]})]}),P&&H&&(0,i.createPortal)((0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(l.fS,{floatingToolbarRef:ac,bumpRef:ad,container:H,onAddComment:af,onSendToAI:ag,onExplain:I?ah:void 0,isChatLoading:I?.isLoading}),R&&(0,e.jsx)(m.t,{x:R.x,y:R.y,range:R.range,filePath:c,lineSnapshot:R.lineSnapshot,container:H,onSubmit:ai,onSendToAI:I?al:void 0,onClose:()=>S(null),isChatLoading:I?.isLoading}),T&&(0,e.jsx)(m.G,{x:T.x,y:T.y,range:T.range,filePath:c,lineSnapshot:T.lineSnapshot,container:H,onSubmit:ak,onClose:()=>U(null),isChatLoading:I?.isLoading}),V&&(0,e.jsx)(n.t,{x:V.x,y:V.y,comment:V.comment,container:H,onClose:()=>W(null),onUpdateComment:M,onDeleteComment:N})]}),H)]})}d()}catch(a){d(a)}})},74228:(a,b,c)=>{"use strict";c.d(b,{S:()=>f,l:()=>g});var d=c(48249),e=c(40311);function f(a){return"loading"===a||"unread"===a?a:"normal"}function g({projectNumber:a,sessionNumber:b,coordinate:c,status:f="normal",statusLabel:h,className:i=""}){if(c){let[d,e]=c.split(".");a??=d,b??=e}if(null==a&&null==b)return null;let j="flex h-4 w-4 items-center justify-center border",k=[a,b].filter(a=>null!=a).join(".");return(0,d.jsxs)("span",{className:`inline-flex items-center gap-1 font-mono text-[9px] font-medium leading-none tabular-nums flex-shrink-0 ${i}`,"aria-label":h?`${k} \xb7 ${h}`:k,children:[null!=a&&(0,d.jsx)("span",{className:`${j} rounded-[4px] ${(0,e.c)("normal",!1)}`,children:a}),null!=b&&(0,d.jsx)("span",{className:`${j} rounded-full ${(0,e.c)(f,!1)}`,title:h,children:b})]})}},74542:(a,b,c)=>{"use strict";c.d(b,{b:()=>f});var d=c(48249),e=c(67484);function f({lines:a,containerRef:b}){let c=(0,e.useRef)(null),[g,h]=(0,e.useState)({top:0,height:0});if(0===a.length)return null;let i=100/a.length;return(0,d.jsxs)("div",{ref:c,className:"w-4 flex-shrink-0 bg-secondary border-l border-border relative cursor-pointer",onClick:a=>{let d=b.current,e=c.current;if(!d||!e)return;let f=e.getBoundingClientRect(),g=(a.clientY-f.top)/f.height*d.scrollHeight-d.clientHeight/2;d.scrollTo({top:Math.max(0,g),behavior:"smooth"})},children:[a.map((a,b)=>"unchanged"!==a.type&&(0,d.jsx)("div",{className:`absolute left-0 right-0 ${"removed"===a.type?"bg-red-9":"bg-green-9"}`,style:{top:`${b*i}%`,height:`${Math.max(i,.5)}%`,minHeight:"2px"}},b)),(0,d.jsx)("div",{className:"absolute left-0 right-0 bg-muted/60 border-y border-border",style:{top:`${g.top}px`,height:`${Math.max(g.height,10)}px`}})]})}},74691:(a,b,c)=>{"use strict";c.d(b,{y:()=>f});var d=c(48249),e=c(44384);function f({value:a,onChange:b,className:c}){let{t:g}=(0,e.Bd)();return(0,d.jsx)("div",{className:`flex items-center gap-0.5 rounded border border-border overflow-hidden ${c??""}`,children:["compact","full"].map(c=>(0,d.jsx)("button",{onClick:a=>{a.stopPropagation(),b(c)},className:`px-2 py-0.5 text-xs transition-colors ${a===c?"bg-brand text-white":"text-muted-foreground hover:bg-hover"}`,children:g("compact"===c?"diffViewer.compact":"diffViewer.full")},c))})}},74754:(a,b,c)=>{"use strict";c.d(b,{_:()=>g});var d=c(67484);c(91579);var e=c(33281),f=c(89800);function g({cwd:a,filePath:b}){let[c,h]=(0,d.useState)([]),[i,j]=(0,d.useState)(!1),[k,l]=(0,d.useState)(null),m=(0,d.useCallback)(async()=>{if(!a||!b)return;j(!0),l(null);let c=await e.t4.runPromiseExit((0,f.lb)(a,b));if("Success"===c._tag)h(c.value.comments??[]);else{let a="Fail"===c.cause._tag?c.cause.error:null,b=a?.cause;l(b instanceof Error?b.message:"Failed to load comments")}j(!1)},[a,b]),n=(0,d.useCallback)(async(c,d,g,i)=>{let j=await e.t4.runPromiseExit((0,f.BC)({cwd:a,filePath:b,startLine:c,endLine:d,content:g,...i?{selectedText:i}:{}}));if("Success"===j._tag&&j.value.comment){let a=j.value.comment;return h(b=>[...b,a]),a}return"Failure"===j._tag&&console.error("Failed to add comment:",j.cause),null},[a,b]),o=(0,d.useCallback)(async(b,c)=>{let d=await e.t4.runPromiseExit((0,f.vv)(a,b,c));if("Success"===d._tag&&d.value.comment){let a=d.value.comment;return h(c=>c.map(c=>c.id===b?a:c)),!0}return"Failure"===d._tag&&console.error("Failed to update comment:",d.cause),!1},[a]),p=(0,d.useCallback)(async b=>{let c=await e.t4.runPromiseExit((0,f.Tu)(a,b));return"Success"===c._tag?(h(a=>a.filter(a=>a.id!==b)),!0):(console.error("Failed to delete comment:",c.cause),!1)},[a]),q=(0,d.useCallback)(a=>c.filter(b=>a>=b.startLine&&a<=b.endLine),[c]);return{comments:c,isLoading:i,error:k,addComment:n,updateComment:o,deleteComment:p,refresh:m,getCommentsForLine:q}}},74837:(a,b,c)=>{"use strict";c.d(b,{NoteToolbar:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call NoteToolbar() from the server but NoteToolbar is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/NoteToolbar.tsx","NoteToolbar")},74991:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{I:()=>s});var e=c(48249),f=c(67484),g=c(44384),h=c(7833),i=c(15819);c(33281);var j=c(13054),k=c(30458),l=c(36688),m=c(32753),n=c(74228),o=c(15790);c(41224);var p=a([o,l]);function q(a){return a.engine||"claude"}function r(a){return a.lastFiredAt??a.createdAt}[o,l]=p.then?(await p)():p;let t=[{key:"pendingReview",labelKey:"scheduledTasks.groupPendingReview"},{key:"upcoming",labelKey:"scheduledTasks.groupUpcoming"},{key:"paused",labelKey:"scheduledTasks.paused"}];function s({collapsed:a,tasks:b,unreadCount:c,sessionNumbers:d,onSwitchProject:p,onPause:u,onResume:v,onTrigger:w,onDelete:x,onMarkRead:y,onUpdateTask:z}){let{t:A}=(0,g.Bd)(),[B,C]=(0,f.useState)(!1),[D,E]=(0,f.useState)(null),F=(0,f.useRef)(null),G=(0,f.useRef)(null),[H,I]=(0,f.useState)(null),J=(0,f.useCallback)(()=>{E(null),F.current=null,I(null)},[]),[K,L]=(0,f.useState)(null),[M,N]=(0,f.useState)(null),[O,P]=(0,f.useState)(null),Q=b.filter(a=>!a.completed),R=Q.filter(a=>!a.paused).length,S=(0,f.useMemo)(()=>(function(a){let b=[],c=[],d=[];for(let e of a)e.unread||e.completed?b.push(e):e.paused?d.push(e):c.push(e);return b.sort((a,b)=>Number(!!b.unread)-Number(!!a.unread)||r(b)-r(a)),c.sort((a,b)=>(a.nextFireTime||Number.MAX_SAFE_INTEGER)-(b.nextFireTime||Number.MAX_SAFE_INTEGER)),d.sort((a,b)=>r(b)-r(a)),{pendingReview:b,upcoming:c,paused:d}})(b),[b]),T=O?b.find(a=>a.id===O)??null:null,[,U]=(0,f.useState)(0),V=(0,f.useCallback)(()=>{L(null),N(null)},[]),W=(0,f.useCallback)(async a=>{let b=!!a.taskFile;try{await navigator.clipboard.writeText(b?a.taskFile:a.message),(0,h.oR)(A(b?"common.copiedPath":"toast.copiedMessage"),"success")}catch{(0,h.oR)(A("common.copyFailed"),"error")}},[A]),X=(0,f.useCallback)(()=>{C(!1),P(null)},[]),Y=(0,f.useCallback)(a=>{p(a.cwd,a.sessionId),a.unread&&y(a.id),X()},[p,y,X]);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("button",{onClick:()=>C(!0),className:`relative flex items-center gap-2 px-2 py-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-hover transition-colors ${a?"w-full justify-center":"w-full"}`,title:a?A("scheduledTasks.title"):void 0,children:[(0,e.jsxs)("svg",{className:"w-5 h-5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,e.jsx)("circle",{cx:"12",cy:"12",r:"10",strokeWidth:2}),(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6l4 2"})]}),!a&&(0,e.jsx)("span",{className:"text-sm flex-1 text-left",children:A("scheduledTasks.title")}),c>0?(0,e.jsx)("span",{className:`min-w-[18px] h-[18px] px-1 text-foreground text-xs font-medium rounded-full flex items-center justify-center bg-red-9/55 ${a?"absolute -top-1 -right-1":""}`,children:c}):a&&b.length>0?(0,e.jsx)("span",{className:"absolute -top-1 -right-1 min-w-[18px] h-[18px] px-1 text-muted-foreground text-xs font-medium rounded-full flex items-center justify-center bg-popover border border-border",children:b.length}):null]}),B&&(0,e.jsxs)("div",{className:"fixed inset-0 z-[70] flex items-center justify-center",children:[(0,e.jsx)("div",{className:"absolute inset-0 bg-scrim",onClick:X}),(0,e.jsxs)("div",{className:i.aO,children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,e.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[(0,e.jsx)("h2",{className:"text-sm font-medium text-foreground",children:A("scheduledTasks.title")}),Q.length>0&&(0,e.jsxs)("span",{className:"text-xs text-muted-foreground",children:[A("scheduledTasks.activeCount",{running:R}),Q.length-R>0?` \xb7 ${A("scheduledTasks.pausedCount",{paused:Q.length-R})}`:""]})]}),(0,e.jsx)("button",{onClick:X,className:"p-1 text-foreground-subtle hover:text-foreground hover:bg-hover rounded transition-colors",children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsx)("div",{className:"flex-1 flex min-h-0",children:0===b.length?(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,e.jsx)("div",{className:"text-xs text-muted-foreground",children:A("scheduledTasks.noScheduledTasks")})}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"w-full md:w-[360px] flex-shrink-0 md:border-r border-border overflow-y-auto p-3 space-y-4",children:t.map(({key:a,labelKey:b})=>{let c=S[a];return 0===c.length?null:(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"sticky top-0 z-10 -mx-3 px-3 py-1 bg-card text-[11px] font-medium text-muted-foreground",children:[A(b)," (",c.length,")"]}),(0,e.jsx)("div",{className:"mt-1 space-y-2",children:c.map(a=>{let b,c;return b=a.id===O,(0,e.jsxs)("div",{onClick:()=>P(a.id),className:`group p-3 rounded border cursor-pointer transition-all hover:border-brand hover:shadow-lv2 ${b?"border-brand bg-brand/5 shadow-lv2":a.unread?"border-brand/40 bg-brand/5":"border-border"} ${a.completed?"opacity-70":""}`,children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5 mb-1",children:[(0,e.jsx)("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${a.unread?"bg-red-11":a.completed?"bg-muted-foreground/30":a.paused?"bg-amber-11":"error"===a.lastResult?"bg-red-11":"bg-green-11"}`}),(0,e.jsx)(m.S,{engine:q(a),tooltip:(c=q(a),a.model?`${c} \xb7 ${a.model}`:c)}),(0,e.jsx)("h4",{className:"text-xs font-medium text-foreground truncate flex-1","data-tooltip":a.cwd,children:(0,j.P_)(a.cwd)}),(0,e.jsx)(n.l,{coordinate:d?.[`${a.cwd}
751
+ `;function e(a){return/^([/\\]|[A-Za-z]:)/.test(a)}function f(a,b){let c=a.replace(/[/\\]+$/,"");return b?`${c}/${b}`:c}function g(a,b){let c,d=(c=Math.max(a.lastIndexOf("/"),a.lastIndexOf("\\")))<0?"":0===c?"/":a.slice(0,c);return e(a)?d:b?f(b,d):d}function h(a,b){return e(a)||!!b}let i="/apps/local/",j="/apps/builtin/";function k(a,b){let c=a.trim();return i+(e(c)?c:f(b??"",c)).replace(/\\/g,"/").split("/").map(encodeURIComponent).join("/").replace(/^\//,"")}let l=/^([a-z][a-z0-9+.-]*:|\/\/|\/)/i;function m(a,b,c){let d=a.trim();if(!d||l.test(d)||!h(b,c))return a;let g=e(b)?b:f(c,b),i=d.search(/[?#]/),j=i<0?d:d.slice(0,i),m=i<0?"":d.slice(i);if(!j)return a;let n=j;try{n=decodeURIComponent(j)}catch{}return k(function(a){let b=/^[A-Za-z]:/.exec(a)?.[0]??"",c=b?a.slice(b.length):a,d=/^[/\\]/.test(c),e=[];for(let a of c.split(/[/\\]/))if(a&&"."!==a){if(".."===a){e.length&&".."!==e[e.length-1]?e.pop():d||b||e.push("..");continue}e.push(a)}return b+(d||b?"/":"")+e.join("/")}(f(g,n)))+m}let n=/\.(md|png|jpe?g|gif|webp|svg|pdf|json|csv|tsv)$/i;function o(a){return n.test(a.trim())}function p(a,b){let c=a.trim();return j+"file-viewer/index.html?file="+encodeURIComponent((e(c)?c:f(b??"",c)).replace(/\\/g,"/"))}function q(a,b){try{let c=new URL(a,b);if(!c.pathname.startsWith(j)&&!c.pathname.startsWith(i))return a;return"localhost"===c.hostname&&(c.hostname="127.0.0.1"),c.toString()}catch{return a}}function r(a,b){let c=a=>JSON.stringify(a).replace(/</g,"\\u003c"),e="<script>"+d.replaceAll("__CWD__",c(b.cwd)).replaceAll("__WS_URL__",c(b.wsUrl??""))+"<\/script>",f=a.match(/<head[^>]*>/i);if(f&&void 0!==f.index){let b=f.index+f[0].length;return a.slice(0,b)+e+a.slice(b)}let g=a.match(/<html[^>]*>/i);if(g&&void 0!==g.index){let b=g.index+g[0].length;return a.slice(0,b)+e+a.slice(b)}return e+a}},65139:(a,b,c)=>{"use strict";c.d(b,{BV:()=>h,NR:()=>t,OO:()=>v,Yd:()=>y,kn:()=>i,oJ:()=>o});var d=c(48249),e=c(67484),f=c(44256),g=c(63565);let h="claude-opus-5",i="gpt-5.6-sol",j=[{id:"low",label:"Low"},{id:"medium",label:"Medium"},{id:"high",label:"High"},{id:"xhigh",label:"Extra High"},{id:"max",label:"Max"},{id:"ultracode",label:"Ultracode"},{id:"ultrathink",label:"Ultrathink"}],k=[{id:"claude-sonnet-5",label:"Claude Sonnet 5",effort:["low","medium","high","xhigh","max","ultrathink"],defaultEffort:"high",context:["200k","1m"],defaultContext:"200k"},{id:"claude-opus-5",label:"Claude Opus 5",effort:["low","medium","high","xhigh","max","ultracode","ultrathink"],defaultEffort:"high",context:["200k","1m"],defaultContext:"1m",fast:!0},{id:"claude-fable-5",label:"Claude Fable 5",effort:["low","medium","high","xhigh","max","ultracode","ultrathink"],defaultEffort:"high",context:["200k","1m"],defaultContext:"1m"},{id:"claude-opus-4-8",label:"Claude Opus 4.8",effort:["low","medium","high","xhigh","max","ultracode","ultrathink"],defaultEffort:"high",fast:!0},{id:"claude-opus-4-7",label:"Claude Opus 4.7",effort:["low","medium","high","xhigh","max","ultrathink"],defaultEffort:"xhigh",fast:!0},{id:"claude-opus-4-6",label:"Claude Opus 4.6",effort:["low","medium","high","max","ultrathink"],defaultEffort:"high",context:["200k","1m"],defaultContext:"1m",fast:!0},{id:"claude-sonnet-4-6",label:"Claude Sonnet 4.6",effort:["low","medium","high","max","ultrathink"],defaultEffort:"high",context:["200k","1m"],defaultContext:"200k"},{id:"claude-haiku-4-5",label:"Claude Haiku 4.5",thinking:!0}],l=[{id:"minimal",label:"Minimal"},{id:"low",label:"Low"},{id:"medium",label:"Medium"},{id:"high",label:"High"},{id:"xhigh",label:"Extra High"},{id:"max",label:"Max"},{id:"ultra",label:"Ultra"}],m=[{id:"gpt-5.6-sol",label:"GPT-5.6-Sol",reasoning:["low","medium","high","xhigh","max","ultra"],defaultReasoning:"medium"},{id:"gpt-5.6-terra",label:"GPT-5.6-Terra",reasoning:["low","medium","high","xhigh","max","ultra"],defaultReasoning:"medium"},{id:"gpt-5.6-luna",label:"GPT-5.6-Luna",reasoning:["low","medium","high","xhigh","max"],defaultReasoning:"medium"}];function n(a){return m.find(b=>b.id===a)?.defaultReasoning??"low"}function o(a,b){let c=m.find(b=>b.id===a)?.reasoning;return b&&(!c||c.includes(b))?b:n(a)}function p(a,b){return a.find(a=>a.id===b)?.label??b}function q(a){return k.find(b=>b.id===a)?.fast===!0}function r(a){return k.find(b=>b.id===a)?.thinking===!0}function s(a){let b=k.find(b=>b.id===a);return b?b.defaultEffort:"high"}function t(a,b){let c=k.find(b=>b.id===a),d=c?.effort;return b&&(!c||d?.includes(b))?b:s(a)}function u(a){let b=k.find(b=>b.id===a);return b?b.defaultContext:"200k"}function v(a,b){let c=k.find(b=>b.id===a),d=c?.context;return b&&(!c||d?.includes(b))?b:u(a)}function w({value:a,selected:b,label:c,defaultValue:e,onSelect:f}){return(0,d.jsxs)("button",{type:"button",onClick:()=>f(a),className:`flex w-full items-start gap-2 px-3 py-2 text-left text-xs transition-colors ${b?g.yI:"text-muted-foreground hover:bg-hover hover:text-foreground"}`,children:[(0,d.jsx)("span",{className:"mt-0.5",children:(0,d.jsx)(g.hG,{selected:b})}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate",children:c}),(0,d.jsx)("span",{className:"shrink-0",children:e&&(0,d.jsx)("span",{className:"rounded bg-muted px-1.5 text-[10px] font-medium text-muted-foreground",children:"Default"})})]})}function x({title:a,selected:b,value:c,items:h,onSelect:i,icon:j,testId:k}){let l=(0,e.useRef)(null),m=(0,e.useRef)(null),[n,o]=(0,e.useState)(!1),[p,q]=(0,e.useState)({top:0,left:0}),r=(0,f.F2)();return(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)(g.XY,{buttonRef:l,label:c,labelMaxWidth:"max-w-[180px]",title:`${a}: ${c}`,onClick:()=>{n||(()=>{let a=l.current?.getBoundingClientRect();if(!a)return;let b=r?.getBoundingClientRect(),c=b?.left??0,d=b?.top??0;q({top:a.bottom+4-d,left:a.left-c})})(),o(a=>!a)},icon:j,testId:k}),n&&(0,d.jsx)(f.ZL,{children:(0,d.jsxs)("div",{ref:m,className:`${g.ys} min-w-[190px]`,style:{top:p.top,left:p.left},children:[(0,d.jsx)("div",{className:"px-3 pb-1 text-[11px] font-medium text-muted-foreground",children:a}),(0,d.jsx)("div",{className:"flex flex-col",children:h.map(a=>(0,d.jsx)(w,{value:a.id,selected:b===a.id,label:a.label,defaultValue:a.defaultValue,onSelect:a=>{i(a),o(!1)}},a.id))})]})})]})}function y(a){let b,c,e=a.engine??"claude",f=a.claudeModel??h,w=s(f),y=(b=k.find(a=>a.id===f)?.effort)?b.map(a=>j.find(b=>b.id===a)??{id:a,label:a}):[],z=t(f,a.claudeEffort),A=u(f),B=k.find(a=>a.id===f)?.context??[],C=v(f,a.claudeContextWindow),D=a.claudeFastMode??!1,E=a.claudeThinking??!1,F=a.codexModel??i,G=n(F),H=(c=m.find(a=>a.id===F)?.reasoning)?c.map(a=>l.find(b=>b.id===a)??{id:a,label:a}):l,I=o(F,a.codexReasoningEffort);return"claude"!==e?(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-1","data-agent-model-traits":!0,children:[(0,d.jsx)(x,{title:"Model",selected:F,value:p(m,F),items:m.map(a=>({id:a.id,label:a.label,defaultValue:a.id===i})),onSelect:b=>{a.onCodexModelChange?.(b),a.onCodexReasoningEffortChange?.(n(b))},icon:(0,d.jsx)(g.eV,{engine:"codex"}),testId:"codex-model-picker"}),(0,d.jsx)(x,{title:"Reasoning",selected:I,value:p(l,I),items:H.map(a=>({...a,defaultValue:a.id===G})),onSelect:b=>a.onCodexReasoningEffortChange?.(b),testId:"codex-reasoning-picker"})]}):(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-1","data-agent-model-traits":!0,children:[(0,d.jsx)(x,{title:"Model",selected:f,value:p(k,f),items:k.map(a=>({id:a.id,label:a.label,defaultValue:a.id===h})),onSelect:b=>{a.onClaudeModelChange?.(b);let c=s(b),d=u(b);c&&a.onClaudeEffortChange?.(c),d&&a.onClaudeContextWindowChange?.(d),q(b)||a.onClaudeFastModeChange?.(!1),r(b)||a.onClaudeThinkingChange?.(!1)},icon:(0,d.jsx)(g.eV,{engine:"claude"}),testId:"claude-model-picker"}),z&&y.length>0&&(0,d.jsx)(x,{title:"Reasoning",selected:z,value:p(j,z),items:y.map(a=>({...a,defaultValue:a.id===w})),onSelect:b=>a.onClaudeEffortChange?.(b),testId:"claude-reasoning-picker"}),C&&B.length>0&&(0,d.jsx)(x,{title:"Context Window",selected:C,value:"1m"===C?"1M":"200K",items:B.map(a=>({id:a,label:"1m"===a?"1M":"200K",defaultValue:a===A})),onSelect:b=>a.onClaudeContextWindowChange?.(b),testId:"claude-context-picker"}),q(f)&&(0,d.jsx)(x,{title:"Fast Mode",selected:D?"on":"off",value:D?"Fast On":"Fast Off",items:[{id:"on",label:"On"},{id:"off",label:"Off",defaultValue:!0}],onSelect:b=>a.onClaudeFastModeChange?.("on"===b),testId:"claude-fast-mode-picker"}),r(f)&&(0,d.jsx)(x,{title:"Thinking",selected:E?"on":"off",value:E?"Thinking On":"Thinking Off",items:[{id:"on",label:"On"},{id:"off",label:"Off",defaultValue:!0}],onSelect:b=>a.onClaudeThinkingChange?.("on"===b),testId:"claude-thinking-picker"})]})}},65395:(a,b,c)=>{"use strict";c.d(b,{useTabState:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call useTabState() from the server but useTabState is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/useTabState.ts","useTabState")},65484:(a,b,c)=>{"use strict";c.d(b,{Cq:()=>n,D0:()=>q,DZ:()=>i,H7:()=>o,It:()=>s,Kl:()=>w,M5:()=>h,Or:()=>k,Q1:()=>u,QW:()=>p,Wr:()=>j,Yn:()=>r,b2:()=>v,em:()=>t,zF:()=>m});var d=c(79606),e=c(71192);let f=(a,b)=>d.tryPromise({try:async()=>{let c=await fetch(a,b);if(!c.ok)throw Error(`HTTP ${c.status}`);return await c.json()},catch:c=>new e.uV({message:`${b?.method??"GET"} ${a} failed`,cause:c})}),g=(a,b)=>f(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),h=()=>f("/api/settings"),i=a=>f("/api/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),j=()=>f("/api/version"),k=()=>f("/api/extension/version"),l=a=>a?`/api/note?cwd=${encodeURIComponent(a)}`:"/api/note",m=a=>f(l(a)),n=(a,b,c)=>d.tryPromise({try:async()=>{let d=l(a),e=await fetch(d,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:b,baseMtime:c})});if(409===e.status){let a=await e.json();return{conflict:!0,content:a.content??"",mtime:a.mtime}}if(!e.ok)throw Error(`HTTP ${e.status}`);return{conflict:!1,mtime:(await e.json()).mtime}},catch:b=>new e.uV({message:`POST ${l(a)} failed`,cause:b})}),o=()=>f("/api/sessions/projects"),p=a=>f(`/api/sessions/projects/${encodeURIComponent(a)}`),q=a=>f(`/api/project-settings?cwd=${encodeURIComponent(a)}`),r=a=>g("/api/project-settings",a),s=()=>f("/api/pick-folder"),t=a=>g("/api/open-vscode",{cwd:a}),u=a=>g("/api/open-cursor",{cwd:a}),v=a=>f(`/api/git/worktree?cwd=${encodeURIComponent(a)}`),w=a=>g("/api/git/worktree",a)},65543:(a,b,c)=>{"use strict";c.d(b,{_:()=>e});let d=new Set(["function","class","method"]);function e(a){return d.has(a.kind)}},67045:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>e});var d=c(48249);function e({error:a,reset:b}){return(0,d.jsx)("html",{children:(0,d.jsx)("body",{children:(0,d.jsxs)("div",{style:{padding:"2rem",fontFamily:"system-ui, sans-serif"},children:[(0,d.jsx)("h2",{children:"Something went wrong"}),(0,d.jsx)("p",{style:{color:"#666"},children:a.message}),(0,d.jsx)("button",{onClick:b,style:{marginTop:"1rem",padding:"0.5rem 1rem",cursor:"pointer",borderRadius:"0.375rem",border:"1px solid #ccc",background:"#fff"},children:"Try again"})]})})})}},69424:(a,b,c)=>{"use strict";c.d(b,{$:()=>s});var d=c(48249),e=c(67484),f=c(44384),g=c(57063),h=c(7833),i=c(44256),j=c(74118),k=c(15273),l=c(46674),m=c(99941),n=c(44643),o=c(32026),p=c(11732),q=c(75513);function r(a){let b=a.input?.questions||[],c=a.input?.answers||{},d={};if(a.result)try{let b=JSON.parse(a.result);b?.answers&&(d=b.answers)}catch{}return{questions:b,answers:{...c,...d}}}function s({toolCalls:a,onClose:b}){let{t:c}=(0,f.Bd)(),t=(0,q.nH)(),[u,v]=(0,e.useState)({}),[w,x]=(0,e.useState)({}),[y,z]=(0,e.useState)({}),[A,B]=(0,e.useState)({});(0,g.E)(b);let C=a.reduce((a,b)=>{let{questions:c}=r(b);return a+c.length},0),D=Object.values(A).filter(Boolean).length,E=(0,e.useCallback)((a,b)=>{v(c=>({...c,[a]:b})),x(b=>({...b,[a]:!1}))},[]),F=(0,e.useCallback)(a=>{x(b=>{let c=!b[a];if(c){let b=y[a]||"";b&&v(c=>({...c,[a]:b}))}return{...b,[a]:c}})},[y]),G=(0,e.useCallback)((a,b)=>{z(c=>({...c,[a]:b})),b&&v(c=>({...c,[a]:b}))},[]),H=(0,e.useCallback)(a=>{B(b=>({...b,[a]:!b[a]}))},[]),I=(0,e.useCallback)(()=>{let b=D>0,d=[];return a.forEach((a,e)=>{let{questions:f}=r(a);f.forEach((a,f)=>{let g=`${e}-${f}`;if(b&&!A[g])return;let h=u[g];d.push(`Q: ${a.question}`),d.push(`A: ${h||c("askQuestion.notSelected")}`),d.push("")})}),d.join("\n").trim()},[a,u,A,D,c]),J=(0,e.useCallback)(()=>{navigator.clipboard.writeText(I()),(0,h.oR)(D>0?c("toast.copiedQA",{count:D}):c("toast.copiedAllQA"))},[I,D,c]),K=(0,e.useCallback)(()=>{t?(t.sendMessage(I()),(0,h.oR)(c("toast.sentQA")),b()):(0,h.oR)(c("askQuestion.sendNoChat"))},[t,I,b,c]),L=(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-scrim p-4",onClick:b,children:(0,d.jsxs)("div",{className:"bg-card rounded-lg shadow-lv3 w-full max-w-6xl h-[90vh] flex flex-col overflow-hidden",onClick:a=>a.stopPropagation(),children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border flex-shrink-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("h3",{className:"text-sm font-medium text-foreground",children:c("askQuestion.title")}),(0,d.jsxs)("span",{className:"text-xs text-muted-foreground",children:[c("askQuestion.nQuestions",{count:C}),D>0&&` \xb7 ${c("askQuestion.checkedN",{count:D})}`]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("button",{onClick:K,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-hover rounded transition-colors",title:D>0?c("askQuestion.sendChecked",{count:D}):c("askQuestion.sendAll"),children:(0,d.jsx)(j.A,{className:"w-4 h-4"})}),(0,d.jsx)("button",{onClick:J,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-hover rounded transition-colors",title:D>0?c("askQuestion.copyChecked",{count:D}):c("askQuestion.copyAll"),children:(0,d.jsx)(k.A,{className:"w-4 h-4"})}),(0,d.jsx)("button",{onClick:b,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-hover rounded transition-colors",children:(0,d.jsx)(l.A,{className:"w-5 h-5"})})]})]}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto px-6 py-4 space-y-6",children:a.map((b,e)=>{let{questions:f}=r(b);return f.map((b,g)=>{let h=`${e}-${g}`,i=u[h],j=w[h]||!1,k=A[h]||!1;return(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)("button",{onClick:()=>H(h),className:"mt-0.5 flex-shrink-0 p-0.5 rounded hover:bg-hover transition-colors",title:c("askQuestion.checkToCopy"),children:k?(0,d.jsx)(m.A,{className:"w-4 h-4 text-brand"}):(0,d.jsx)(n.A,{className:"w-4 h-4 text-muted-foreground"})}),b.header&&(0,d.jsx)("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-brand/10 text-brand flex-shrink-0 mt-0.5",children:b.header}),(0,d.jsx)("span",{className:"text-sm font-medium text-foreground",children:b.question})]}),(0,d.jsxs)("div",{className:"space-y-1 ml-7",children:[b.options.map((a,b)=>{let c=i===a.label&&!j;return(0,d.jsxs)("button",{onClick:()=>E(h,a.label),className:`flex items-start gap-2 px-2.5 py-1.5 rounded-md transition-colors w-full text-left cursor-pointer hover:bg-hover ${c?"bg-brand/10 hover:bg-brand/15":""}`,children:[(0,d.jsx)("div",{className:"mt-0.5 flex-shrink-0",children:c?(0,d.jsx)(o.A,{className:"w-3.5 h-3.5 text-brand"}):(0,d.jsx)("div",{className:"w-3.5 h-3.5 rounded-full border border-muted-foreground"})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("div",{className:`text-sm ${c?"text-foreground font-medium":"text-foreground"}`,children:a.label}),a.description&&(0,d.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5",children:a.description})]})]},b)}),(0,d.jsxs)("button",{onClick:()=>F(h),className:`flex items-start gap-2 px-2.5 py-1.5 rounded-md transition-colors w-full text-left cursor-pointer hover:bg-hover ${j?"bg-brand/10 hover:bg-brand/15":""}`,children:[(0,d.jsx)("div",{className:"mt-0.5 flex-shrink-0",children:j?(0,d.jsx)(o.A,{className:"w-3.5 h-3.5 text-brand"}):(0,d.jsx)("div",{className:"w-3.5 h-3.5 rounded-full border border-muted-foreground"})}),(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)(p.A,{className:"w-3.5 h-3.5 text-muted-foreground"}),(0,d.jsx)("span",{className:"text-sm text-muted-foreground",children:c("askQuestion.custom")})]})]}),j&&(0,d.jsx)("div",{className:"ml-6 mt-1",children:(0,d.jsx)("input",{type:"text",autoFocus:!0,value:y[h]||"",onChange:a=>G(h,a.target.value),placeholder:c("askQuestion.customPlaceholder"),className:"w-full px-3 py-1.5 text-sm bg-background border border-border rounded-md focus:outline-none focus:ring-1 focus:ring-brand text-foreground"})})]}),(e!==a.length-1||g!==f.length-1)&&(0,d.jsx)("div",{className:"border-b border-border/50 mt-3"})]},h)})})})]})});return(0,d.jsx)(i.ZL,{children:L})}},70151:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{g:()=>ag});var e=c(48249),f=c(67484),g=c.n(f),h=c(74429),i=c(44256),j=c(33281),k=c(87808),l=c(25419),m=c(85655),n=c(21538),o=c(35208),p=c(74691),q=c(60333),r=c(7833),s=c(24724),t=c(20586),u=c(7122),v=c(55287),w=c(60591),x=c(19593),y=c(64825),z=c(66400),A=c(86588),B=c(64676),C=c(6478),D=c(34728),E=c(9804),F=c(73887),G=c(40893),H=c(92608),I=c(94239),J=c(29939),K=c(23860),L=c(7031),M=c(83721),N=c(25667),O=c(57014),P=c(46242),Q=c(94308),R=c(53036),S=c(91975),T=c(6662),U=c(20291),V=c(58904),W=c(61632),X=c(41357),Y=c(76855),Z=c(4857),$=c(44384),_=c(18921),aa=c(28797),ab=c(23881),ac=c(21672),ad=c(21482),ae=c(94192),af=a([n,N,o,F,v,O]);[n,N,o,F,v,O]=af.then?(await af)():af;let ag=g().memo(function({onClose:a,cwd:b,initialTab:c="tree",tabSwitchTrigger:d,initialSearchQuery:g,searchQueryTrigger:af,fileOpenRequest:ag}){let ah,ai,aj,ak,al,am,{t:an}=(0,$.Bd)(),ao=(0,L.r)(),ap=(0,f.useCallback)(a=>{ao?.sendMessage(an("explain.fileMessage",{path:a}))},[ao,an]),aq=(0,f.useCallback)(a=>{ao?.sendMessage(an("explain.stagedFileMessage",{path:a}))},[ao,an]),ar=(0,f.useCallback)(a=>{ao?.sendMessage(an("explain.unstagedFileMessage",{path:a}))},[ao,an]),as=(0,C.P)(),at=(0,D.U)(),{activeView:au,onViewChange:av}=(0,ae.R8)(),[aw,ax]=(0,f.useState)(c),[ay,az]=(0,f.useState)("code"),aA=(0,f.useRef)(null),aB=(0,f.useRef)(!1),[aC,aD]=(0,f.useState)(null),[aE,aF]=(0,f.useState)(null),[aG,aH]=(0,f.useState)(!1),aI=(0,f.useRef)(1),aJ=(0,f.useRef)(null),[aK,aL]=(0,f.useState)(null),aM=(0,f.useRef)(null),[aN,aO]=(0,f.useState)({isDirty:!1,isSaving:!1}),[aP,aQ]=(0,f.useState)(!1),[aR,aS]=(0,f.useState)(null),[aT,aU]=(0,f.useState)("compact"),[aV,aW]=(0,f.useState)("unified"),[aX,aY]=(0,f.useState)("full"),[aZ,a$]=(0,f.useState)("unified"),[a_,a0]=(0,f.useState)(320),a1=(0,f.useRef)(null),a2=(0,f.useCallback)(a=>{"mouse"===a.pointerType&&0===a.button&&(a.preventDefault(),a1.current={startX:a.clientX,startWidth:a_},a.currentTarget.setPointerCapture(a.pointerId))},[a_]),a3=(0,f.useCallback)(a=>{let b=a1.current;if(!b)return;let c=b.startWidth+(a.clientX-b.startX);a0(Math.min(480,Math.max(320,c)))},[]),a4=(0,f.useCallback)(a=>{a1.current&&(a1.current=null,a.currentTarget.hasPointerCapture(a.pointerId)&&a.currentTarget.releasePointerCapture(a.pointerId))},[]),a5=(0,f.useRef)(null),a6=(0,_.o)(a5),a7=(0,f.useRef)(null),a8=(0,_.o)(a7),a9=(0,Y.Sn)(b),ba=(0,Y.Xm)(b),bb=(0,Y.po)(b),bc=(0,Z.Q)(),bd=(0,K.F)(),be=(0,T.W)({cwd:b});(0,Y.JL)(b,be.selectedPath);let bf=(0,f.useMemo)(()=>{let a=be.fileContent,b=be.selectedPath;return a&&"text"===a.type&&"string"==typeof a.content&&b&&(0,w.Hz)(b)?(0,w.xb)(a.content,w.cG):null},[be.fileContent,be.selectedPath]),[bg,bh]=(0,f.useState)({version:0,collapsed:!1}),bi=(0,U.p)({cwd:b,onSearchComplete:()=>aQ(!0)}),bj=(0,V.e)({cwd:b,addToRecentFiles:be.addToRecentFiles}),bk=(0,f.useMemo)(()=>{let a=new Set;if(bj.status){for(let b of bj.status.staged)a.add(b.path);for(let b of bj.status.unstaged)a.add(b.path)}return a},[bj.status]),bl=(0,f.useMemo)(()=>{let a=new Map;if(bj.status){for(let b of bj.status.staged)a.set(b.path,"staged");for(let b of bj.status.unstaged)a.set(b.path,"unstaged")}return a},[bj.status]),bm=(0,W.y)({cwd:b,addToRecentFiles:be.addToRecentFiles}),bn=(0,f.useCallback)(a=>{ao?.sendMessage(an("explain.compareFileMessage",{base:bm.compareBaseBranch,path:a}))},[ao,an,bm.compareBaseBranch]),bo=(0,f.useRef)(!1),bp=(0,f.useCallback)(a=>{be.setFileContent(b=>b?.type==="text"?{...b,content:a}:b),be.showEditor||(bo.current=!0,be.setShowEditor(!0))},[be]),bq=(0,f.useCallback)(a=>{be.setShowEditor(!0)},[be]),br=(0,f.useCallback)(async()=>{if(!be.fileContent||"text"!==be.fileContent.type||!be.fileContent.content)return;let a=await j.t4.runPromiseExit((0,k.OJ)({cwd:b,path:be.selectedPath,content:be.fileContent.content}));try{if("Failure"===a._tag||!a.value.ok)throw Error("Failed to save file");let b=a.value.data?.mtime;b&&be.setFileContent(a=>a?.type==="text"?{...a,mtime:b}:a),(0,r.oR)(an("toast.savedSuccess"),"success")}catch{(0,r.oR)(an("toast.saveFailed"),"error")}},[b,be]),bs=(0,f.useCallback)(()=>{if(!be.selectedPath)return;let a=aI.current,b=aJ.current;a>0&&be.updateRecentFilePosition(be.selectedPath,a,b?b.cursorLine+1:a,b?b.cursorCol+1:1)},[be]),bt=(0,f.useCallback)(async(a,b)=>{let c=a!==be.selectedPath;if(c&&be.showEditor){if(aN.isDirty&&(!await (0,r.lJ)(an("fileBrowser.saveBeforeSwitch"),{confirmText:an("fileBrowser.saveAndSwitch"),cancelText:an("common.cancel")})||(await aM.current?.save(),aM.current?.isDirty)))return;be.setShowEditor(!1)}c&&bs(),be.handleSelectFile(a,b)},[be,bs,aN.isDirty,an]),bu=(0,f.useMemo)(()=>{let a=bi.contentSearchResults;if(0===a.length)return{files:[],expandDirs:new Set,matchMap:new Map};let b=new Map,c=[];for(let d of a)b.set(d.path,d),c.push(d.path);let d=(0,E.v3)(c),e=new Set((0,E.tW)(d));return{files:d,expandDirs:e,matchMap:b}},[bi.contentSearchResults]),[bv,bw]=(0,f.useState)(new Set),bx=(0,f.useCallback)(a=>{bw(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),by=(0,f.useCallback)(a=>{if(a.isDirectory)return null;let b=bu.matchMap.get(a.path);return b?(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:b.matches.length}):null},[bu.matchMap]),bz=aP&&bi.contentSearchResults.length>0,[bA,bB]=(0,f.useState)("selected"),bC=!!be.selectedPath&&null!==(0,aa.c)(be.selectedPath),[bD,bE]=(0,f.useState)(!1),bF=(0,f.useCallback)(async(a,c)=>{if(!be.selectedPath||!bC)return;let d=await a9.goToDefinition(be.selectedPath,a,c);if(0===d.length)return;let e=d[0],f=b.endsWith("/")?b:b+"/",g=e.file.startsWith(f)?e.file.slice(f.length):e.file;bc.push({filePath:be.selectedPath,lineNumber:aI.current}),g===be.selectedPath?be.setTargetLineNumber(e.line):bt(g,e.line)},[be,b,bC,a9,bc]),bG=(0,f.useCallback)((a,b,c,d,e)=>{a&&null!==(0,aa.c)(a)&&(bE(b),ba.onTokenMouseEnter(a,c,d,e))},[ba]),bH=(0,f.useCallback)((a,b,c)=>{bC&&bG(be.selectedPath,!1,a,b,c)},[be.selectedPath,bC,bG]),bI=(0,f.useCallback)(a=>{let c=b.endsWith("/")?b:b+"/",d=a.file.startsWith(c)?a.file.slice(c.length):a.file;be.selectedPath&&bc.push({filePath:be.selectedPath,lineNumber:aI.current}),d===be.selectedPath?be.setTargetLineNumber(a.line):bt(d,a.line)},[be,b,bc]),bJ=(0,f.useMemo)(()=>{if(!bj.status)return null;let a=new Map,b=a=>{switch(a){case"modified":default:return"M";case"added":case"untracked":return"A";case"deleted":return"D";case"renamed":return"R"}};for(let c of bj.status.staged)a.set(c.path,b(c.status));for(let c of bj.status.unstaged)a.set(c.path,b(c.status));return a},[bj.status]),bK=(0,f.useMemo)(()=>{if(!bj.status)return null;let a=new Map;for(let b of bj.status.staged)"renamed"===b.status&&b.oldPath&&a.set(b.path,b.oldPath);return a},[bj.status]),bL=(0,f.useCallback)(a=>{ax("search"),bi.setContentSearchQuery(a),bi.performContentSearch(a)},[bi.setContentSearchQuery,bi.performContentSearch]),bM=(0,X.H)({cwd:b,selectedPath:be.selectedPath,gitStatusMap:bJ,renameOldPaths:bK,isText:be.fileContent?.type==="text",refreshKey:be.fileContent?.mtime}),bN="tree"===aw&&bM.showDiff,bO=(0,f.useCallback)(a=>{ax(a),be.setBlameSelectedCommit(null),"history"===a&&bm.selectedBranch&&bm.loadCommits(bm.selectedBranch)},[be,bm.selectedBranch,bm.loadCommits]);(0,f.useCallback)(()=>{if(!be.selectedPath)return;let a={filePath:be.selectedPath,lineNumber:aI.current},b=bc.goBack(a);b&&(b.filePath===be.selectedPath?be.setTargetLineNumber(b.lineNumber):bt(b.filePath,b.lineNumber))},[be,bc]),(0,f.useCallback)(()=>{if(!be.selectedPath)return;let a={filePath:be.selectedPath,lineNumber:aI.current},b=bc.goForward(a);b&&(b.filePath===be.selectedPath?be.setTargetLineNumber(b.lineNumber):bt(b.filePath,b.lineNumber))},[be,bc]);let bP=(0,f.useCallback)(async a=>{let c=a.split("/").pop()||a,d=await j.t4.runPromiseExit((0,k.__)({cwd:b,path:a}));"Success"===d._tag?(0,r.oR)(an("toast.copiedName",{name:c}),"success"):(0,r.oR)(an("toast.copyFailed"),"error")},[b,an]),bQ=(0,f.useCallback)(async a=>{let c=await j.t4.runPromiseExit((0,k.dt)());if("Success"!==c._tag||!c.value.path)return void(0,r.oR)(an("toast.noFileToPaste"),"info");let d=c.value.path,e=await j.t4.runPromiseExit((0,k.Nn)({cwd:b,targetDir:a,sourceAbsPath:d}));if("Success"===e._tag)(0,r.oR)(an("toast.pastedFile",{name:e.value.newName}),"success"),be.loadDirectory(a),be.loadFileIndex();else{let a="Fail"===e.cause._tag?e.cause.error:null,b=a?.cause,c=b instanceof Error?b.message:an("toast.pasteFailed");(0,r.oR)(c,"error")}},[b,be,an]);(0,f.useRef)(0),(0,f.useRef)(bd),(0,f.useRef)(aw),(0,f.useRef)(!1);let bR=(0,f.useRef)(bm.selectedBranch);bR.current=bm.selectedBranch;let bS=(0,f.useRef)(be.selectedPath);bS.current=be.selectedPath;let bT=(0,f.useRef)(be.fileContent?.type);bT.current=be.fileContent?.type;let bU=(0,f.useCallback)(async a=>{try{let{data:c}=a;if(!Array.isArray(c))return;let d=c.some(a=>"git"===a.type),e=c.some(a=>"file"===a.type),f=[];if((e||d)&&(f.push(j.t4.runPromise((0,k.mP)(b)).then(a=>{a.error||be.setFiles(b=>(0,E.HR)(a.files??[],b))}).catch(()=>{})),f.push(j.t4.runPromise((0,k.DZ)(b)).then(a=>{a.paths&&be.setFileIndex(a.paths)}).catch(()=>{})),f.push(j.t4.runPromise((0,k.r9)(b)).then(a=>{be.setRecentFiles(a.files??[])}).catch(()=>{}))),d||e){f.push(j.t4.runPromise((0,m.lv)(b)).then(a=>{bj.setStatus(a);let b=(0,t.Do)(a.staged),c=(0,t.Do)(a.unstaged);bj.setStagedTree(b),bj.setUnstagedTree(c)}).catch(()=>{})),bj.refreshDiff(),d&&bm.loadBranches();let a=bR.current;a&&f.push(j.t4.runPromise((0,m.Bj)(b,a,E.B_)).then(a=>{let b=a.commits??[];bm.setCommits(b),bm.setHasMoreCommits(b.length>=E.B_)}).catch(()=>{}))}let g=bS.current,h=bT.current;g&&"text"===h&&f.push(j.t4.runPromise((0,l.K)(b,g)).then(a=>{let b=a.ok?a.data:null;b&&"string"==typeof b.content&&be.setFileContent({type:"text",content:b.content,size:b.size,mtime:b.mtimeMs,...b.isSymlink?{isSymlink:!0,symlinkTarget:b.symlinkTarget}:{}})}).catch(()=>{})),await Promise.all(f)}catch(a){console.error("File watch handler error:",a)}},[b]);(0,J.h)({url:`/ws/watch?cwd=${encodeURIComponent(b)}`,onMessage:bU,enabled:bd});let bV=(0,f.useCallback)(a=>{bt(a),be.setShouldScrollToSelected(!0),ax("tree")},[be,bt]);(0,f.useRef)(bt),(0,f.useRef)(null);let{setPreviewMarkdown:bW,setShouldScrollToSelected:bX}=be,bY=(0,f.useCallback)(({focalFile:a})=>a&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{onClick:c=>{c.stopPropagation(),navigator.clipboard.writeText(`${b}/${a}`),(0,r.oR)(an("common.copiedPath"))},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-hover transition-colors flex-shrink-0",title:an("common.copyAbsPath"),children:(0,e.jsx)("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),bV(a)},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-hover transition-colors flex-shrink-0",title:an("fileBrowser.locateInTree"),children:(0,e.jsxs)("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,e.jsx)("circle",{cx:"12",cy:"12",r:"10",strokeWidth:2}),(0,e.jsx)("circle",{cx:"12",cy:"12",r:"3",strokeWidth:2}),(0,e.jsx)("path",{strokeLinecap:"round",strokeWidth:2,d:"M12 2v4m0 12v4M2 12h4m12 0h4"})]})})]}),[b,bV,an]),bZ=(0,f.useCallback)(({focalFile:a})=>"tree"===aw&&bM.canDiff&&a===be.selectedPath?(0,e.jsxs)(e.Fragment,{children:[bM.showDiff&&(0,e.jsx)(p.y,{value:aX,onChange:aY}),(0,e.jsx)("button",{onClick:bM.toggleDiff,className:`px-1.5 py-0.5 text-xs rounded transition-colors ${bM.showDiff?"bg-brand text-white":"text-muted-foreground hover:bg-hover"}`,title:bM.showDiff?an("fileBrowser.exitDiff"):an("fileBrowser.viewDiff"),children:an("common.diff")})]}):null,[aw,bM.canDiff,bM.showDiff,bM.toggleDiff,be.selectedPath,aX,an]),[b$,b_]=(0,f.useState)(null),b0=(0,f.useCallback)((a,b)=>{be.setPreviewMarkdown(!0),bV(a),b_(b),b&&setTimeout(()=>b_(null),400)},[be,bV]);return(0,e.jsxs)(u.SU,{container:aC,children:[(0,e.jsxs)("div",{ref:aA,className:"bg-card w-full h-full flex flex-col relative",children:[(0,e.jsxs)("div",{className:"flex-1 flex overflow-hidden",children:[(0,e.jsxs)("div",{className:"flex-shrink-0 flex flex-col overflow-hidden",style:{width:a_},children:[(0,e.jsxs)("div",{className:"flex border-b border-border",children:[(0,e.jsx)("button",{onClick:()=>bO("tree"),className:`flex-1 px-2 py-2 text-sm font-medium transition-colors ${"tree"===aw?"text-brand border-b-2 border-brand":"text-muted-foreground hover:text-foreground dark:hover:text-foreground"}`,children:an("fileBrowser.directoryTree")}),(0,e.jsx)("button",{onClick:()=>bO("search"),className:`flex-1 px-2 py-2 text-sm font-medium transition-colors ${"search"===aw?"text-brand border-b-2 border-brand":"text-muted-foreground hover:text-foreground dark:hover:text-foreground"}`,children:an("fileBrowser.searchTab")}),(0,e.jsx)("button",{onClick:()=>bO("recent"),className:`flex-1 px-2 py-2 text-sm font-medium transition-colors ${"recent"===aw?"text-brand border-b-2 border-brand":"text-muted-foreground hover:text-foreground dark:hover:text-foreground"}`,children:an("fileBrowser.recentTab")}),(0,e.jsx)("button",{onClick:()=>bO("status"),className:`flex-1 px-2 py-2 text-sm font-medium transition-colors ${"status"===aw?"text-brand border-b-2 border-brand":"text-muted-foreground hover:text-foreground dark:hover:text-foreground"}`,children:an("fileBrowser.changesTab")}),(0,e.jsx)("button",{onClick:()=>bO("history"),className:`flex-1 px-2 py-2 text-sm font-medium transition-colors ${"history"===aw?"text-brand border-b-2 border-brand":"text-muted-foreground hover:text-foreground dark:hover:text-foreground"}`,children:an("fileBrowser.historyTab")})]}),"tree"===aw&&(0,e.jsxs)("div",{className:"p-2 border-b border-border flex items-center gap-2",children:[(0,e.jsxs)("div",{className:"flex-1 relative",children:[(0,e.jsx)("input",{ref:be.searchInputRef,type:"text",value:be.searchQuery,onChange:a=>be.setSearchQuery(a.target.value),placeholder:an("fileBrowser.searchFiles"),className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded bg-card text-foreground focus:outline-none focus:ring-2 focus:ring-ring"}),be.searchQuery&&(0,e.jsx)("button",{onClick:()=>{be.setSearchQuery(""),be.searchInputRef.current?.focus()},className:"absolute right-1.5 top-1/2 -translate-y-1/2 p-0.5 text-foreground-subtle hover:text-foreground rounded-sm transition-colors",title:an("fileBrowser.clear"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsx)("button",{onClick:()=>be.setSearchDirExact(a=>!a),className:`px-1 py-0.5 rounded transition-colors text-xs font-mono font-bold border ${be.searchExactMatch?"border-brand text-brand bg-brand/10":"border-transparent text-muted-foreground hover:text-foreground hover:bg-hover"}`,title:be.searchExactMatch?an("fileBrowser.exactMatchOn"):an("fileBrowser.exactMatchOff"),children:"ab"}),(0,e.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,e.jsx)("button",{onClick:()=>be.loadFiles(),className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-hover rounded transition-colors",title:an("fileBrowser.refreshTree"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}),(0,e.jsx)("button",{onClick:()=>be.searchTreeExpandedPaths?be.setSearchTreeExpandedPaths(new Set):be.setExpandedPaths(new Set),className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-hover rounded transition-colors",title:an("fileBrowser.collapseAll"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 12H4"})})})]})]}),"search"===aw&&(0,e.jsxs)("div",{className:"p-2 border-b border-border space-y-2",children:[(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsxs)("div",{className:"flex-1 relative",children:[(0,e.jsx)("input",{ref:bi.contentSearchInputRef,type:"text",value:bi.contentSearchQuery,onChange:a=>bi.setContentSearchQuery(a.target.value),onKeyDown:a=>{"Enter"===a.key&&bi.performContentSearch(bi.contentSearchQuery)},placeholder:an("fileBrowser.searchFileContent"),className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded bg-card text-foreground focus:outline-none focus:ring-2 focus:ring-ring"}),bi.contentSearchQuery&&(0,e.jsx)("button",{onClick:()=>{bi.setContentSearchQuery(""),bi.contentSearchInputRef.current?.focus()},className:"absolute right-1.5 top-1/2 -translate-y-1/2 p-0.5 text-foreground-subtle hover:text-foreground rounded-sm transition-colors",title:an("fileBrowser.clear"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsx)("button",{onClick:()=>bi.performContentSearch(bi.contentSearchQuery),disabled:bi.isSearching||!bi.contentSearchQuery.trim(),className:"px-3 py-1.5 text-sm bg-brand text-white rounded hover:bg-brand/90 disabled:opacity-50 disabled:cursor-not-allowed",children:bi.isSearching?"...":an("common.search")})]}),(0,e.jsxs)("div",{className:"flex flex-wrap gap-2 text-xs",children:[(0,e.jsxs)("label",{className:"flex items-center gap-1 cursor-pointer",children:[(0,e.jsx)("input",{type:"checkbox",checked:bi.searchOptions.caseSensitive,onChange:a=>bi.setSearchOptions(b=>({...b,caseSensitive:a.target.checked})),className:"w-3 h-3"}),(0,e.jsx)("span",{className:"text-muted-foreground",children:an("fileBrowser.caseSensitive")})]}),(0,e.jsxs)("label",{className:"flex items-center gap-1 cursor-pointer",children:[(0,e.jsx)("input",{type:"checkbox",checked:bi.searchOptions.wholeWord,onChange:a=>bi.setSearchOptions(b=>({...b,wholeWord:a.target.checked})),className:"w-3 h-3"}),(0,e.jsx)("span",{className:"text-muted-foreground",children:an("fileBrowser.wholeWord")})]}),(0,e.jsxs)("label",{className:"flex items-center gap-1 cursor-pointer",children:[(0,e.jsx)("input",{type:"checkbox",checked:bi.searchOptions.regex,onChange:a=>bi.setSearchOptions(b=>({...b,regex:a.target.checked})),className:"w-3 h-3"}),(0,e.jsx)("span",{className:"text-muted-foreground",children:an("fileBrowser.regex")})]}),(0,e.jsx)("input",{type:"text",value:bi.searchOptions.fileType,onChange:a=>bi.setSearchOptions(b=>({...b,fileType:a.target.value})),placeholder:an("fileBrowser.fileTypes"),className:"w-24 px-2 py-0.5 text-xs border border-border rounded bg-card text-foreground"})]})]}),"history"===aw&&(0,e.jsx)("div",{className:"p-3 border-b border-border",children:bm.compareMode?(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsxs)("div",{className:"flex-1 min-w-0 px-3 py-1.5 text-sm border border-border rounded bg-secondary text-foreground flex items-center gap-2",children:[(0,e.jsx)("svg",{className:"w-4 h-4 text-muted-foreground flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),(0,e.jsx)("span",{className:"truncate",children:bm.branches?.current||"HEAD"}),(0,e.jsx)("span",{className:"text-xs text-green-11 flex-shrink-0",children:"HEAD"})]}),(0,e.jsx)("button",{onClick:()=>bm.toggleCompareMode(!1),className:"flex-shrink-0 px-2.5 py-1.5 text-xs font-medium rounded-lg transition-colors bg-brand text-white",title:an("fileBrowser.compareModeOff"),children:an("fileBrowser.compareMode")})]}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground flex-shrink-0 pl-1",children:"vs"}),(0,e.jsx)("div",{className:"flex-1 min-w-0",children:(0,e.jsx)(Q.e,{branches:bm.branches,selectedBranch:bm.compareBaseBranch,onSelect:a=>{bm.setCompareBaseBranch(a),bm.loadCompareFiles(a)},isLoading:bm.isLoadingBranches,pinnedBranches:["origin/main",...bm.upstreamBranch&&"origin/main"!==bm.upstreamBranch?[bm.upstreamBranch]:[]]})})]})]}):(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("div",{className:"flex-1 min-w-0",children:(0,e.jsx)(Q.e,{branches:bm.branches,selectedBranch:bm.selectedBranch,onSelect:a=>{bm.setSelectedBranch(a)},isLoading:bm.isLoadingBranches,pinnedBranches:["origin/main",...bm.upstreamBranch&&"origin/main"!==bm.upstreamBranch?[bm.upstreamBranch]:[]]})}),(0,e.jsx)("button",{onClick:()=>bm.toggleCompareMode(!0),className:"flex-shrink-0 px-2.5 py-1.5 text-xs font-medium rounded-lg transition-colors text-muted-foreground hover:text-foreground hover:bg-hover border border-border",title:an("fileBrowser.compareModeOn"),children:an("fileBrowser.compareMode")})]})}),(0,e.jsxs)("div",{className:"flex-1 overflow-hidden flex flex-col",children:[(0,e.jsxs)("div",{className:`flex-1 flex flex-col min-h-0 ${"tree"===aw?"":"hidden"}`,children:[be.creatingItem&&(0,e.jsxs)("div",{className:"px-2 py-1.5 border-b border-border flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:be.creatingItem.parentPath?an("fileBrowser.createFileIn",{path:be.creatingItem.parentPath}):an("fileBrowser.createFile")}),(0,e.jsx)("input",{type:"text",autoFocus:!0,placeholder:an("fileBrowser.fileName"),className:"flex-1 px-2 py-1 text-sm border border-border rounded bg-card text-foreground focus:outline-none focus:ring-2 focus:ring-ring",onCompositionStart:()=>{aB.current=!0},onCompositionEnd:()=>{aB.current=!1},onKeyDown:async a=>{if("Enter"===a.key){if(aB.current)return;let c=a.target.value.trim();if(!c)return;let d=be.creatingItem.parentPath,e=d?`${d}/${c}`:c,f=await j.t4.runPromiseExit((0,k.OJ)({cwd:b,path:e,content:""}));if("Success"===f._tag&&f.value.ok)(0,r.oR)(an("toast.createdFile",{name:c}),"success"),be.setCreatingItem(null),be.loadDirectory(d),be.loadFileIndex(),d&&be.setExpandedPaths(a=>new Set([...a,d])),bt(e);else if("Success"===f._tag){let a=f.value.data?.error;(0,r.oR)(a||an("toast.createFailed"),"error")}else(0,r.oR)(an("toast.createFailed"),"error")}else"Escape"===a.key&&be.setCreatingItem(null)},onBlur:()=>be.setCreatingItem(null)})]}),be.isLoadingFiles?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:an("common.loading")}):be.fileError?(0,e.jsx)("div",{className:"p-4 text-center text-red-11 text-sm",children:be.fileError}):(0,e.jsx)(s.h,{files:be.files,selectedPath:be.selectedPath,expandedPaths:be.effectiveExpandedPaths,matchedPaths:be.matchedPaths,gitStatusMap:bJ,loadingDirs:be.loadingDirs,onSelect:a=>{be.setShouldScrollToSelected(!1),bt(a)},onToggle:be.handleToggle,cwd:b,shouldScrollToSelected:be.shouldScrollToSelected,onScrolledToSelected:()=>be.setShouldScrollToSelected(!1),onCreateFile:a=>be.setCreatingItem({type:"file",parentPath:a}),onDelete:(a,b,c)=>aF({path:a,isDirectory:b,name:c}),onRefresh:()=>be.loadFiles(),onCopyFile:bP,onPaste:bQ,onExplain:ao?ap:void 0,explainDisabled:ao?.isLoading})]}),(0,e.jsx)("div",{className:`flex-1 flex flex-col min-h-0 ${"search"===aw?"":"hidden"}`,children:bi.isSearching?(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,e.jsx)("span",{className:"inline-block w-6 h-6 border-2 border-brand border-t-transparent rounded-full animate-spin"})}):bi.searchError?(0,e.jsx)("div",{className:"p-4 text-center text-red-11 text-sm",children:bi.searchError}):0===bi.contentSearchResults.length?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:bi.contentSearchQuery?an("fileBrowser.noContentSearchResults"):an("fileBrowser.enterKeywordToSearch")}):(0,e.jsxs)("div",{className:"flex-1 overflow-y-auto flex flex-col min-h-0",children:[bi.searchStats&&(0,e.jsxs)("div",{className:"px-3 py-1.5 text-xs text-muted-foreground border-b border-border flex-shrink-0",children:[an("fileBrowser.nFilesNMatches",{files:bi.searchStats.totalFiles,matches:bi.searchStats.totalMatches}),bi.searchStats.truncated&&(0,e.jsxs)("span",{className:"text-amber-11 ml-1",children:["(",an("fileBrowser.resultsTruncated"),")"]})]}),(0,e.jsx)(s.h,{files:bu.files,selectedPath:be.selectedPath,expandedPaths:bv,onSelect:a=>{let b=bu.matchMap.get(a);bt(a,b?.matches[0]?.lineNumber),aP||aQ(!0)},onToggle:bx,cwd:b,onExplain:ao?ap:void 0,explainDisabled:ao?.isLoading,renderActions:by,className:"flex-1 overflow-y-auto py-1 min-w-max"})]})}),(0,e.jsx)("div",{className:`flex-1 flex flex-col min-h-0 ${"recent"===aw?"":"hidden"}`,children:0===be.recentFiles.length?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:an("fileBrowser.noRecentFiles")}):(0,e.jsx)(s.h,{files:be.recentFilesTree,selectedPath:be.selectedPath,expandedPaths:be.recentTreeDirPaths,onSelect:bt,onToggle:E.tE,cwd:b,onExplain:ao?ap:void 0,explainDisabled:ao?.isLoading})}),(0,e.jsx)("div",{className:`flex-1 flex flex-col min-h-0 ${"status"===aw?"":"hidden"}`,children:bj.statusLoading?(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,e.jsx)("span",{className:"inline-block w-6 h-6 border-2 border-brand border-t-transparent rounded-full animate-spin"})}):bj.statusError?(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center p-4",children:(0,e.jsx)("span",{className:"text-red-11 text-sm",children:bj.statusError})}):(0,e.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[(0,e.jsxs)("div",{className:"border-b border-border",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 bg-secondary",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:an("fileBrowser.stagingArea",{count:bj.status?.staged.length||0})}),(0,e.jsx)("button",{onClick:()=>bj.fetchStatus(),className:"p-0.5 text-muted-foreground hover:text-foreground hover:bg-hover rounded transition-colors",title:an("fileBrowser.refreshChanges"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})})]}),(bj.status?.staged.length||0)>0&&(0,e.jsx)("button",{onClick:bj.handleUnstageAll,className:"text-sm text-amber-11 hover:text-amber-10 hover:underline",children:an("fileBrowser.unstageAll")})]}),(0,e.jsx)(t.VO,{files:bj.stagedTree,selectedPath:bj.statusSelectedFile?.type==="staged"?bj.statusSelectedFile.file.path:null,expandedPaths:bj.stagedExpandedPaths,onSelect:a=>a.file&&bj.handleStatusFileSelect(a.file,"staged"),onToggle:bj.handleStagedToggle,cwd:b,emptyMessage:an("fileBrowser.noStagedFiles"),className:"py-1",onExplain:ao?aq:void 0,explainDisabled:ao?.isLoading,renderActions:a=>{if(a.isDirectory){let b=(0,t.wI)(a);return 0===b.length?null:(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),bj.handleUnstageFiles(b.map(a=>a.path))},className:"opacity-0 group-hover:opacity-100 p-0.5 text-amber-11 hover:text-amber-10 hover:bg-amber-9/10 dark:hover:bg-amber-9/20 rounded transition-all",title:an("fileBrowser.unstageNFiles",{count:b.length}),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 12H4"})})})}return(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),bj.handleUnstage(a.path)},className:"opacity-0 group-hover:opacity-100 p-0.5 text-amber-11 hover:text-amber-10 hover:bg-amber-9/10 dark:hover:bg-amber-9/20 rounded transition-all",title:an("fileBrowser.unstageFile"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 12H4"})})})}})]}),(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 bg-secondary",children:[(0,e.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:an("fileBrowser.workspace",{count:bj.status?.unstaged.length||0})}),(bj.status?.unstaged.length||0)>0&&(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("button",{onClick:bj.handleDiscardAll,className:"text-sm text-red-11 hover:text-red-10 hover:underline",children:an("fileBrowser.discardAll")}),(0,e.jsx)("button",{onClick:bj.handleStageAll,className:"text-sm text-green-11 hover:text-green-10 hover:underline",children:an("fileBrowser.stageAll")})]})]}),(0,e.jsx)(t.VO,{files:bj.unstagedTree,selectedPath:bj.statusSelectedFile?.type==="unstaged"?bj.statusSelectedFile.file.path:null,expandedPaths:bj.unstagedExpandedPaths,onSelect:a=>a.file&&bj.handleStatusFileSelect(a.file,"unstaged"),onToggle:bj.handleUnstagedToggle,cwd:b,emptyMessage:an("fileBrowser.noUnstagedChanges"),className:"py-1",onExplain:ao?ar:void 0,explainDisabled:ao?.isLoading,renderActions:a=>{if(a.isDirectory){let b=(0,t.wI)(a);if(0===b.length)return null;let c=b.map(a=>a.file).filter(Boolean);return(0,e.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),bj.handleDiscardFiles(c)},className:"opacity-0 group-hover:opacity-100 p-0.5 text-red-11 hover:text-red-10 hover:bg-red-9/10 dark:hover:bg-red-9/20 rounded transition-all",title:an("fileBrowser.discardNFiles",{count:b.length}),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 10h10a8 8 0 018 8v2M3 10l6 6m-6-6l6-6"})})}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),bj.handleStageFiles(b.map(a=>a.path))},className:"opacity-0 group-hover:opacity-100 p-0.5 text-green-11 hover:text-green-10 hover:bg-green-9/10 dark:hover:bg-green-9/20 rounded transition-all",title:an("fileBrowser.stageNFiles",{count:b.length}),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})})]})}return a.file?(0,e.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),bj.handleDiscardFile(a.file)},className:"opacity-0 group-hover:opacity-100 p-0.5 text-red-11 hover:text-red-10 hover:bg-red-9/10 dark:hover:bg-red-9/20 rounded transition-all",title:an("fileBrowser.discardChanges"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 10h10a8 8 0 018 8v2M3 10l6 6m-6-6l6-6"})})}),(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),bj.handleStage(a.path)},className:"opacity-0 group-hover:opacity-100 p-0.5 text-green-11 hover:text-green-10 hover:bg-green-9/10 dark:hover:bg-green-9/20 rounded transition-all",title:an("fileBrowser.stageFile"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})})]}):null}})]})]})}),(0,e.jsx)("div",{className:`flex-1 flex flex-col min-h-0 ${"history"===aw?"":"hidden"}`,children:bm.historyError?(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,e.jsxs)("div",{className:"text-center",children:[(0,e.jsx)("svg",{className:"w-16 h-16 mx-auto text-foreground-faint mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),(0,e.jsx)("p",{className:"text-muted-foreground",children:bm.historyError})]})}):bm.compareMode?(0,e.jsx)("div",{className:"flex-1 overflow-y-auto overflow-x-hidden",children:bm.isLoadingCompareFiles?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:an("fileBrowser.loadingDiff")}):0===bm.compareFiles.length?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:an("fileBrowser.noDiffFiles")}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"px-3 py-2 border-b border-border",children:(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:an("fileBrowser.nFilesChanged",{count:bm.compareFiles.length,branch:bm.compareBaseBranch})})}),(0,e.jsx)(t.VO,{files:bm.compareFileTree,expandedPaths:bm.compareExpandedPaths,onToggle:bm.handleCompareToggle,selectedPath:bm.compareSelectedFile?.path||null,onSelect:a=>{a.file&&bm.handleSelectCompareFile(a.file)},cwd:b,showChanges:!0,onExplain:ao?bn:void 0,explainDisabled:ao?.isLoading})]})}):(0,e.jsx)("div",{ref:bm.commitListRef,className:"flex-1 overflow-y-auto",onScroll:bm.handleCommitListScroll,children:bm.isLoadingCommits?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:an("fileBrowser.loadingCommits")}):0===bm.commits.length?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:an("fileBrowser.noCommits")}):(0,e.jsxs)(e.Fragment,{children:[bm.commits.map(a=>(0,e.jsxs)("div",{onClick:()=>bm.handleSelectCommit(a),className:`px-3 py-2 border-b border-border cursor-pointer hover:bg-hover ${bm.selectedCommit?.hash===a.hash?"bg-brand/10":""}`,children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"font-mono text-xs text-brand",children:a.shortHash}),(0,e.jsxs)("span",{className:"text-xs text-foreground-subtle","data-tooltip":a.date,children:[a.relativeDate," \xb7 ",(0,E.r6)(a.date)]})]}),(0,e.jsx)("div",{className:"text-sm text-foreground truncate mt-0.5","data-tooltip":a.subject,children:a.subject}),(0,e.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5",children:a.author})]},a.hash)),bm.isLoadingMore&&(0,e.jsx)("div",{className:"p-3 text-center",children:(0,e.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-brand border-t-transparent rounded-full animate-spin"})}),!bm.hasMoreCommits&&bm.commits.length>0&&(0,e.jsx)("div",{className:"p-3 text-center text-xs text-foreground-subtle",children:an("fileBrowser.allLoaded",{count:bm.commits.length})})]})})})]})]}),(0,e.jsx)("div",{onPointerDown:a2,onPointerMove:a3,onPointerUp:a4,onPointerCancel:a4,className:"w-[5px] flex-shrink-0 relative cursor-col-resize group",children:(0,e.jsx)("div",{className:"absolute inset-y-0 left-1/2 -translate-x-1/2 w-px bg-border group-hover:bg-brand transition-colors"})}),(0,e.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[("tree"===aw||"search"===aw||"recent"===aw)&&(be.blameSelectedCommit?(0,e.jsx)(n.n,{isOpen:!0,onClose:()=>be.setBlameSelectedCommit(null),commit:be.blameSelectedCommit,cwd:b,embedded:!0,initialFilePath:be.selectedPath||void 0,onContentSearch:a=>{ax("search"),bi.setContentSearchQuery(a),bi.performContentSearch(a)}}):"map"===ay?bN&&bM.diff?(0,e.jsx)(N.r,{cwd:b,filePath:bM.diff.filePath,oldContent:bM.diff.oldContent,newContent:bM.diff.newContent,isNew:bM.diff.isNew,isDeleted:bM.diff.isDeleted,changedFiles:bk,fileGitStatusMap:bl,compact:"compact"===aX,enableComments:!0,onSwitchToCode:()=>az("code"),onContentSearch:bL,headerExtraLeft:bY,headerExtraRight:bZ}):(0,e.jsx)(M.O,{cwd:b,highlightedFilePath:be.selectedPath,changedFiles:bk,onSwitchToCode:()=>az("code"),enableComments:!0,onContentSearch:bL,headerExtraLeft:bY,headerExtraRight:bZ}):be.selectedPath?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"px-4 py-2 border-b border-border flex-shrink-0 flex items-center justify-between",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1 min-w-0",children:[(0,e.jsx)("span",{className:"text-sm text-muted-foreground truncate",children:be.selectedPath}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),navigator.clipboard.writeText(`${b}/${be.selectedPath}`),(0,r.oR)(an("common.copiedPath"))},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-hover transition-colors flex-shrink-0",title:an("common.copyAbsPath"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),bV(be.selectedPath)},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-hover transition-colors flex-shrink-0",title:an("fileBrowser.locateInTree"),children:(0,e.jsxs)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,e.jsx)("circle",{cx:"12",cy:"12",r:"10",strokeWidth:2}),(0,e.jsx)("circle",{cx:"12",cy:"12",r:"3",strokeWidth:2}),(0,e.jsx)("path",{strokeLinecap:"round",strokeWidth:2,d:"M12 2v4m0 12v4M2 12h4m12 0h4"})]})})]}),(0,e.jsx)("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:be.showEditor?(0,e.jsxs)(e.Fragment,{children:[aN.isDirty&&(0,e.jsx)("span",{className:"text-xs text-amber-11",children:an("fileBrowser.unsaved")}),(0,e.jsx)("button",{onClick:()=>aM.current?.save(),disabled:!aN.isDirty||aN.isSaving,className:`px-1.5 py-0.5 text-xs rounded transition-colors ${aN.isDirty&&!aN.isSaving?"bg-brand text-white hover:bg-brand/90":"bg-secondary text-muted-foreground cursor-not-allowed"}`,children:aN.isSaving?(0,e.jsx)("span",{className:"inline-block w-3 h-3 border-2 border-current border-t-transparent rounded-full animate-spin"}):an("common.save")}),(0,e.jsx)("button",{onClick:()=>aM.current?.close(),className:"px-1.5 py-0.5 text-xs rounded transition-colors text-muted-foreground hover:bg-hover",title:an("fileBrowser.closeEdit"),children:an("fileBrowser.closeBtn")})]}):bN?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(p.y,{value:aX,onChange:aY}),(0,e.jsx)(q.q,{value:aZ,onChange:a$}),!(0,w.e$)(be.selectedPath)&&!(0,w.aR)(be.selectedPath)&&!(0,w.Hz)(be.selectedPath)&&!(0,w.Zy)(be.selectedPath)&&(0,e.jsx)("button",{onClick:()=>az("map"),className:"px-1.5 py-0.5 text-xs rounded transition-colors text-muted-foreground hover:bg-hover",title:an("blockViewer.viewerToggle.toBlock"),children:an("common.codeMap")}),(0,e.jsx)("button",{onClick:bM.toggleDiff,className:"px-1.5 py-0.5 text-xs rounded transition-colors bg-brand text-white",children:an("fileBrowser.exitDiff")})]}):(0,e.jsxs)(e.Fragment,{children:["tree"===aw&&bM.canDiff&&(0,e.jsx)("button",{onClick:bM.toggleDiff,className:"px-1.5 py-0.5 text-xs rounded transition-colors text-muted-foreground hover:bg-hover",title:an("fileBrowser.viewDiff"),children:an("common.diff")}),be.fileContent?.type==="text"&&(0,w.e$)(be.selectedPath)&&(0,e.jsx)(H.ShareReviewToggle,{content:be.fileContent.content||"",sourceFile:be.selectedPath&&b&&be.selectedPath.startsWith(b)?be.selectedPath.slice(b.endsWith("/")?b.length:b.length+1):be.selectedPath||""}),be.fileContent?.type==="text"&&(0,w.Hz)(be.selectedPath)&&be.previewMarkdown&&!be.showBlame&&(0,e.jsx)("div",{className:"flex items-center gap-0.5 rounded border border-border overflow-hidden",children:[!0,!1].map(a=>(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),bh(b=>({version:b.version+1,collapsed:a}))},className:`px-2 py-0.5 text-xs transition-colors ${bg.collapsed===a?"bg-brand text-white":"text-muted-foreground hover:bg-hover"}`,children:an(a?"fileBrowser.collapseAllJson":"fileBrowser.expandAllJson")},String(a)))}),be.fileContent?.type==="text"&&((0,w.e$)(be.selectedPath)||(0,w.aR)(be.selectedPath)||(0,w.Hz)(be.selectedPath)||(0,w.Zy)(be.selectedPath))&&(ai=(ah=(0,w.aR)(be.selectedPath))?be.previewHtml:be.previewMarkdown,(0,e.jsx)("button",{onClick:()=>ah?be.setPreviewHtml(a=>!a):be.setPreviewMarkdown(a=>!a),className:`px-1.5 py-0.5 text-xs rounded transition-colors ${ai?"bg-brand text-white":"text-muted-foreground hover:bg-hover"}`,children:ai?an("fileBrowser.exitPreview"):an("common.preview")})),be.fileContent?.type==="text"&&(0,w.C_)(be.selectedPath||"")&&(ak=(aj=be.selectedPath||"").startsWith("/")?aj:b?`${b.replace(/\/$/,"")}/${aj}`:aj,(0,e.jsx)("button",{onClick:()=>at(ak),className:"px-1.5 py-0.5 text-xs rounded transition-colors text-muted-foreground hover:bg-hover flex items-center",title:an("skills.addTooltip"),children:(0,e.jsx)(y.A,{className:"w-3.5 h-3.5"})})),be.fileContent?.type==="text"&&(0,w.aR)(be.selectedPath)&&(am=(al=be.selectedPath||"").startsWith("/")?al:b?`${b.replace(/\/$/,"")}/${al}`:al,(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{onClick:()=>as(am),className:"px-1.5 py-0.5 text-xs rounded transition-colors text-muted-foreground hover:bg-hover flex items-center",title:an("htmlApps.addTooltip"),children:(0,e.jsx)(y.A,{className:"w-3.5 h-3.5"})}),(0,e.jsx)("button",{onClick:()=>window.dispatchEvent(new CustomEvent("console-open-browser",{detail:{url:am}})),className:"px-1.5 py-0.5 text-xs rounded transition-colors text-muted-foreground hover:bg-hover flex items-center",title:an("common.openInConsole"),children:(0,e.jsx)(z.A,{className:"w-3.5 h-3.5"})}),(0,e.jsx)("button",{onClick:()=>{let a=(0,B.Xe)(am);window.open((0,B.PB)(a,window.location.origin),"_blank")},className:"px-1.5 py-0.5 text-xs rounded transition-colors text-muted-foreground hover:bg-hover flex items-center",title:an("browser.openInNewWindow"),children:(0,e.jsx)(A.A,{className:"w-3.5 h-3.5"})})]})),be.fileContent?.type==="text"&&!(be.previewMarkdown&&((0,w.e$)(be.selectedPath)||(0,w.Hz)(be.selectedPath)||(0,w.Zy)(be.selectedPath))||be.previewHtml&&(0,w.aR)(be.selectedPath))&&(0,e.jsx)("button",{onClick:be.handleToggleBlame,disabled:be.isLoadingBlame,className:`px-1.5 py-0.5 text-xs rounded transition-colors ${be.showBlame?"bg-brand text-white":"text-muted-foreground hover:bg-hover"} disabled:opacity-50`,title:an("fileBrowser.viewBlame"),children:be.isLoadingBlame?(0,e.jsx)("span",{className:"inline-block w-3 h-3 border border-current border-t-transparent rounded-full animate-spin"}):"Blame"}),be.fileContent?.type==="text"&&!(be.previewMarkdown&&((0,w.e$)(be.selectedPath)||(0,w.Hz)(be.selectedPath)||(0,w.Zy)(be.selectedPath))||be.previewHtml&&(0,w.aR)(be.selectedPath))&&(0,e.jsx)("button",{onClick:()=>be.setShowEditor(!0),className:"px-1.5 py-0.5 text-xs rounded transition-colors text-muted-foreground hover:bg-hover",title:an("fileBrowser.editFile"),children:an("common.edit")}),be.fileContent?.type==="text"&&be.fileContent.content&&(0,e.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(be.fileContent.content),(0,r.oR)(an("toast.copiedFileContent"))},className:"px-1.5 py-0.5 text-xs rounded transition-colors text-muted-foreground hover:bg-hover",title:an("fileBrowser.copyFileContent"),children:an("common.copy")}),be.fileContent?.type==="text"&&!(0,w.e$)(be.selectedPath)&&!(0,w.aR)(be.selectedPath)&&!(0,w.Hz)(be.selectedPath)&&!(0,w.Zy)(be.selectedPath)&&(0,e.jsx)("button",{onClick:()=>az("map"),className:"px-1.5 py-0.5 text-xs rounded transition-colors text-muted-foreground hover:bg-hover",title:an("blockViewer.viewerToggle.toBlock"),children:an("common.codeMap")})]})})]}),(0,e.jsx)("div",{className:"flex-1 overflow-hidden",children:be.isLoadingContent?(0,e.jsx)("div",{className:"h-full flex items-center justify-center",children:(0,e.jsx)("span",{className:"inline-block w-6 h-6 border-2 border-brand border-t-transparent rounded-full animate-spin"})}):be.fileContent?"text"===be.fileContent.type&&"string"==typeof be.fileContent.content?bN?bM.isLoadingDiff&&!bM.diff?(0,e.jsx)("div",{className:"h-full flex items-center justify-center",children:(0,e.jsx)("span",{className:"inline-block w-6 h-6 border-2 border-brand border-t-transparent rounded-full animate-spin"})}):bM.diff?"unified"===aZ?(0,e.jsx)(o.xU,{oldContent:bM.diff.oldContent,newContent:bM.diff.newContent,filePath:bM.diff.filePath,cwd:b,enableComments:!0,compact:"compact"===aX,onContentSearch:bL,onTokenHover:(a,b,c)=>bG(bM.diff?.filePath,!0,a,b,c),onTokenHoverLeave:ba.onTokenMouseLeave,onTokenHoverCancel:ba.clearHover}):(0,e.jsx)(o.xZ,{oldContent:bM.diff.oldContent,newContent:bM.diff.newContent,filePath:bM.diff.filePath,isNew:bM.diff.isNew,isDeleted:bM.diff.isDeleted,cwd:b,enableComments:!0,compact:"compact"===aX,onContentSearch:bL,onTokenHover:(a,b,c)=>bG(bM.diff?.filePath,!0,a,b,c),onTokenHoverLeave:ba.onTokenMouseLeave,onTokenHoverCancel:ba.clearHover}):(0,e.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:(0,e.jsxs)("div",{className:"text-center",children:[(0,e.jsx)("p",{children:an("fileBrowser.diffLoadFailed")}),(0,e.jsx)("button",{onClick:bM.toggleDiff,className:"mt-2 text-brand hover:underline text-sm",children:an("fileBrowser.exitDiff")})]})}):be.showBlame&&be.blameError?(0,e.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:(0,e.jsxs)("div",{className:"text-center",children:[(0,e.jsx)("p",{className:"text-red-11",children:be.blameError}),(0,e.jsx)("button",{onClick:()=>be.setShowBlame(!1),className:"mt-2 text-brand hover:underline text-sm",children:an("fileBrowser.backToPreview")})]})}):be.showBlame&&0===be.blameLines.length&&be.isLoadingBlame?(0,e.jsx)("div",{className:"h-full flex items-center justify-center",children:(0,e.jsx)("span",{className:"inline-block w-6 h-6 border-2 border-brand border-t-transparent rounded-full animate-spin"})}):be.previewMarkdown&&(0,w.Hz)(be.selectedPath)&&!be.showBlame?(0,e.jsxs)("div",{className:"h-full flex flex-col bg-background text-foreground",children:[(0,e.jsx)(_._,{search:a6}),(0,e.jsx)("div",{className:"flex-1 overflow-auto px-6 py-4",children:(0,e.jsx)("pre",{ref:a5,className:"whitespace-pre-wrap break-words font-mono",style:{fontSize:"0.8125rem",lineHeight:"1.5"},children:(0,e.jsx)(w.d9.Provider,{value:bg,children:bf})})})]}):be.previewMarkdown&&(0,w.Zy)(be.selectedPath)&&!be.showBlame?(0,e.jsx)(x.C0,{content:be.fileContent.content,filePath:be.selectedPath,className:"h-full"}):be.previewMarkdown&&(0,w.e$)(be.selectedPath)&&!be.showBlame?(0,e.jsx)("div",{className:"h-full flex flex-col",children:(0,e.jsx)(F.M,{content:be.fileContent.content,filePath:be.selectedPath,cwd:b,embedded:!0,onLocalMdLink:b0,scrollToAnchor:b$})}):be.previewHtml&&(0,w.aR)(be.selectedPath)&&!be.showBlame?(0,e.jsx)(G.O,{content:be.fileContent.content,filePath:be.selectedPath,cwd:b,onContentSearch:a=>{ax("search"),bi.setContentSearchQuery(a),bi.performContentSearch(a)}}):(0,e.jsx)(v.Cv,{ref:aM,content:be.fileContent.content,filePath:be.selectedPath,cwd:b,enableComments:!0,scrollToLine:aK??be.targetLineNumber,scrollToLineAlign:null!=aK?"start":be.targetScrollAlign,onScrollToLineComplete:()=>{aL(null),be.setTargetLineNumber(null)},highlightKeyword:"search"===aw?bi.contentSearchQuery:null,visibleLineRef:aI,viStateRef:aJ,initialCursorLine:be.initialCursorLine,initialCursorCol:be.initialCursorCol,onInitialCursorSet:()=>{be.setInitialCursorLine(null),be.setInitialCursorCol(null)},onCmdClick:bC?bF:void 0,onTokenHover:bC?bH:void 0,onTokenHoverLeave:bC?ba.onTokenMouseLeave:void 0,onTokenHoverCancel:bC?ba.clearHover:void 0,blameLines:be.showBlame&&be.blameLines.length>0?be.blameLines:void 0,inlineBlameLines:be.blameLines.length>0?be.blameLines:void 0,onSelectCommit:be.setBlameSelectedCommit,editable:be.showEditor,initialMtime:be.fileContent.mtime,onEditorClose:a=>{be.setShowEditor(!1),aL(a)},onSaved:()=>{let a=aI.current??1;be.loadFileContent(be.selectedPath),be.setShowEditor(!1),aL(a)},onEditorStateChange:aO,viMode:!0,onContentMutate:bp,onEnterInsertMode:bq,onViSave:br,onContentSearch:a=>{ax("search"),bi.setContentSearchQuery(a),bi.performContentSearch(a)}}):"image"===be.fileContent.type&&be.selectedPath?(0,e.jsx)(R.I,{cwd:b,path:be.selectedPath,refreshKey:be.fileContent.mtime,alt:be.selectedPath}):"pdf"===be.fileContent.type&&be.selectedPath?(0,e.jsx)(S.t,{cwd:b,path:be.selectedPath,refreshKey:be.fileContent.mtime}):(0,e.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:(0,e.jsxs)("div",{className:"text-center",children:[(0,e.jsx)("svg",{className:"w-16 h-16 mx-auto text-foreground-faint mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),(0,e.jsx)("p",{children:be.fileContent.message||an("fileBrowser.cannotPreview")})]})}):(0,e.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:an("fileBrowser.selectFileToPreview")})})]}):(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:(0,e.jsxs)("div",{className:"text-center",children:[(0,e.jsx)("svg",{className:"w-16 h-16 mx-auto text-foreground-faint mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),(0,e.jsx)("p",{children:an("fileBrowser.selectFileToPreview")})]})})),"status"===aw&&(bj.statusSelectedFile&&bj.statusDiff?(0,e.jsx)(O.m,{cwd:b,selected:bj.statusSelectedFile,diff:bj.statusDiff,showMarkdownPreview:bj.showStatusDiffPreview,setShowMarkdownPreview:bj.setShowStatusDiffPreview,changedFiles:bk,fileGitStatusMap:bl,onContentSearch:a=>{ax("search"),bi.setContentSearchQuery(a),bi.performContentSearch(a)},locateInTree:bV,jsonPreview:aR,setJsonPreview:aS,jsonPreviewSearch:a8,jsonPreviewPreRef:a7,onTokenHover:(a,b,c)=>bG(bj.statusDiff?.filePath,!0,a,b,c),onTokenHoverLeave:ba.onTokenMouseLeave,onTokenHoverCancel:ba.clearHover}):(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center text-foreground-subtle",children:(0,e.jsx)("span",{children:an("fileBrowser.selectFileToViewDiff")})})),"history"===aw&&!bm.historyError&&(bm.compareMode?bm.isLoadingCompareDiff?(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center text-muted-foreground text-sm",children:an("fileBrowser.loadingDiffContent")}):bm.compareFileDiff?(0,e.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[!(0,E.u)(bm.compareFileDiff.filePath)&&(0,e.jsxs)("div",{className:"flex items-center justify-end gap-2 px-3 py-1.5 border-b border-border flex-shrink-0",children:[(0,e.jsx)(p.y,{value:aT,onChange:aU}),(0,e.jsx)(q.q,{value:aV,onChange:aW})]}),(0,e.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,E.u)(bm.compareFileDiff.filePath)?(0,e.jsx)(P.M,{cwd:b,filePath:bm.compareFileDiff.filePath,oldRev:bm.compareFileDiff.oldRev??(bm.compareFileDiff.isNew?null:bm.compareBaseBranch),newRev:bm.compareFileDiff.newRev??(bm.compareFileDiff.isDeleted?null:"HEAD")}):"unified"===aV?(0,e.jsx)(o.xU,{oldContent:bm.compareFileDiff.oldContent,newContent:bm.compareFileDiff.newContent,filePath:bm.compareFileDiff.filePath,cwd:b,enableComments:!0,compact:"compact"===aT,onPreview:!bm.compareFileDiff.isDeleted&&bm.compareFileDiff.filePath.endsWith(".json")?()=>aS({content:bm.compareFileDiff.newContent,filePath:bm.compareFileDiff.filePath}):void 0,previewLabel:an("common.readable"),onContentSearch:a=>{ax("search"),bi.setContentSearchQuery(a),bi.performContentSearch(a)}}):(0,e.jsx)(o.xZ,{oldContent:bm.compareFileDiff.oldContent,newContent:bm.compareFileDiff.newContent,filePath:bm.compareFileDiff.filePath,isNew:bm.compareFileDiff.isNew,isDeleted:bm.compareFileDiff.isDeleted,cwd:b,enableComments:!0,compact:"compact"===aT,onPreview:!bm.compareFileDiff.isDeleted&&bm.compareFileDiff.filePath.endsWith(".json")?()=>aS({content:bm.compareFileDiff.newContent,filePath:bm.compareFileDiff.filePath}):void 0,previewLabel:an("common.readable"),onContentSearch:a=>{ax("search"),bi.setContentSearchQuery(a),bi.performContentSearch(a)}})})]}):(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center text-foreground-subtle",children:(0,e.jsx)("span",{children:bm.compareFiles.length>0?an("fileBrowser.selectFileToViewDiff"):an("fileBrowser.clickCompareToLoad")})}):bm.selectedCommit?(0,e.jsx)(n.n,{isOpen:!0,onClose:()=>bm.setSelectedCommit(null),commit:bm.selectedCommit,cwd:b,embedded:!0,onContentSearch:a=>{ax("search"),bi.setContentSearchQuery(a),bi.performContentSearch(a)}}):(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center text-foreground-subtle",children:(0,e.jsx)("span",{children:an("fileBrowser.selectCommitToView")})}))]})]}),aG&&(0,e.jsx)(I.c,{files:be.files,fileIndex:be.fileIndex,recentFiles:be.recentFilePaths,onSelectFile:a=>{bt(a),be.setShouldScrollToSelected(!0),ax("tree")},onClose:()=>aH(!1)}),(bz||bb.visible)&&(0,e.jsxs)("div",{className:`flex ${bb.visible&&bz?"":"flex-col"}`,children:[bz&&(0,e.jsx)("div",{className:bb.visible?"flex-1 min-w-0 border-r border-border":"",children:(0,e.jsx)(ad.D,{results:bi.contentSearchResults,loading:bi.isSearching,totalMatches:bi.searchStats?.totalMatches??0,onSelect:(a,b)=>{be.selectedPath&&bc.push({filePath:be.selectedPath,lineNumber:aI.current}),az("code"),bt(a,b)},onClose:()=>aQ(!1),scope:bA,onScopeChange:bB,selectedPath:be.selectedPath})}),bb.visible&&(0,e.jsx)("div",{className:bz?"flex-1 min-w-0":"",children:(0,e.jsx)(ac.D,{references:bb.references,loading:bb.loading,onSelect:bI,onClose:bb.closeReferences})})]})]}),aE&&(0,e.jsx)(i.ZL,{children:(0,e.jsx)("div",{className:"fixed inset-0 z-[300] flex items-center justify-center bg-scrim",onClick:()=>aF(null),children:(0,e.jsxs)("div",{className:"bg-card border border-border rounded-lg shadow-lv3 p-4 max-w-sm w-full mx-4",onClick:a=>a.stopPropagation(),children:[(0,e.jsx)("h3",{className:"text-sm font-medium text-foreground mb-2",children:an("fileBrowser.confirmDelete")}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:an("fileBrowser.confirmDeleteMessage",{name:aE.name}).split(/<\/?file>/g).map((a,b)=>1===b?(0,e.jsx)("span",{className:"font-mono text-foreground",children:a},b):a)}),(0,e.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,e.jsx)("button",{onClick:()=>aF(null),className:"px-3 py-1.5 text-sm rounded border border-border hover:bg-hover transition-colors",children:an("common.cancel")}),(0,e.jsx)("button",{onClick:async()=>{let{path:a,name:c}=aE;aF(null);let d=await j.t4.runPromiseExit((0,k.VK)({cwd:b,path:a}));if("Success"===d._tag){(0,r.oR)(an("toast.movedToTrash",{name:c}),"success");let b=a.includes("/")?a.substring(0,a.lastIndexOf("/")):"";be.loadDirectory(b),be.loadFileIndex(),be.selectedPath===a&&bt("")}else{let a="Fail"===d.cause._tag?d.cause.error:null,b=a?.cause,c=b instanceof Error?b.message:an("toast.deleteFailed");(0,r.oR)(c,"error")}},className:"px-3 py-1.5 text-sm rounded bg-destructive text-destructive-foreground hover:bg-destructive/90 transition-colors",children:an("common.delete")})]})]})})}),ba.hoverInfo&&aC&&(0,h.createPortal)((0,e.jsx)(ab.s,{ref:ba.setTooltipEl,displayString:ba.hoverInfo.displayString,documentation:ba.hoverInfo.documentation,x:ba.hoverInfo.x,y:ba.hoverInfo.y,container:aC,onMouseEnter:ba.onCardMouseEnter,onMouseLeave:ba.onCardMouseLeave,onFindReferences:bD?void 0:()=>{let{filePath:a,line:b,column:c}=ba.hoverInfo;ba.clearHover(),bb.findReferences(a,b,c)},onSearch:a=>{ba.clearHover(),ax("search"),bi.setContentSearchQuery(a),bi.performContentSearch(a)},onExplain:ao?a=>{let{filePath:b,line:c}=ba.hoverInfo;ba.clearHover(),ao.sendMessage(an("explain.symbolMessage",{name:a,path:b,lines:String(c)}))}:void 0,explainDisabled:ao?.isLoading}),aC)]})});d()}catch(a){d(a)}})},70440:(a,b,c)=>{"use strict";function d(){return[{type:"image/x-icon",sizes:"16x16",url:"/favicon.ico?a49a3c8f7b751288"}]}c.r(b),c.d(b,{default:()=>d})},70596:(a,b,c)=>{"use strict";c.d(b,{t:()=>g});var d=c(48249),e=c(67484),f=c(44384);function g({x:a,y:b,comment:c,container:h,onClose:i,onUpdateComment:j,onDeleteComment:k}){let{t:l}=(0,f.Bd)(),[m,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(c.content),q=(0,e.useRef)(null),[r,s]=(0,e.useState)({x:0,y:0}),t=async()=>{o.trim()&&(await j(c.id,o.trim()),n(!1))},u=async()=>{await k(c.id),i()};return(0,d.jsx)("div",{ref:q,className:"absolute z-[200] w-96 bg-card border border-border rounded-lg shadow-lv2 overflow-hidden",style:{left:r.x,top:r.y},children:(0,d.jsx)("div",{className:"p-3",children:m?(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)("textarea",{value:o,onChange:a=>p(a.target.value),className:"w-full px-2 py-1.5 text-sm border border-border rounded bg-card resize-none focus:outline-none focus:ring-1 focus:ring-ring",rows:3,autoFocus:!0,onKeyDown:a=>{"Enter"!==a.key||a.shiftKey||a.nativeEvent.isComposing||(a.preventDefault(),t()),"Escape"===a.key&&(n(!1),p(c.content))}}),(0,d.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,d.jsx)("button",{onClick:()=>{n(!1),p(c.content)},className:"px-2 py-1 text-xs text-muted-foreground hover:text-foreground",children:l("common.cancel")}),(0,d.jsx)("button",{onClick:t,className:"px-2 py-1 text-xs bg-brand text-white rounded hover:bg-brand/90",children:l("common.save")})]})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:c.content}),(0,d.jsxs)("div",{className:"mt-2 flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:l("comments.lineRange",{start:c.startLine,end:c.endLine})}),(0,d.jsxs)("div",{className:"flex gap-1",children:[(0,d.jsx)("button",{onClick:()=>n(!0),className:"p-1 rounded hover:bg-hover text-muted-foreground",title:l("common.edit"),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),(0,d.jsx)("button",{onClick:u,className:"p-1 rounded hover:bg-hover text-muted-foreground hover:text-red-9",title:l("common.delete"),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]})]})]})})})}},71192:(a,b,c)=>{"use strict";c.d(b,{m_:()=>f,uV:()=>e});var d=c(81218);class e extends d.rN("AppError"){}d.rN("DBError"),d.rN("WSError"),d.rN("FSError"),d.rN("AgentError"),d.rN("ValidationError");class f extends d.rN("NotFoundError"){}d.rN("PermissionError")},71697:(a,b,c)=>{"use strict";c.d(b,{V:()=>j,n:()=>i});var d=c(48249),e=c(67484),f=c(44384);c(59336);var g=c(33281),h=c(41224);function i({value:a,onChange:b,textareaRef:c,extraCommands:d}){let[f,j]=(0,e.useState)(a.length),[k,l]=(0,e.useState)([]),[m,n]=(0,e.useState)([]),[o,p]=(0,e.useState)(0),[q,r]=(0,e.useState)(()=>a.length>0),s=(0,e.useRef)(null);(0,e.useCallback)(async()=>{let a=await g.t4.runPromiseExit((0,h.l1)());if("Success"===a._tag){let b=a.value.skills??a.value;n((Array.isArray(b)?b:[]).filter(a=>a.valid&&!!a.name).map(a=>({name:`/${a.name}`,description:a.description||"",source:"skill",skillPath:a.path,argumentHint:a.argumentHint})))}else console.error("Failed to load skills:",a.cause)},[]);let t=(0,e.useMemo)(()=>{let b=0===f?0:a.lastIndexOf("\n",f-1)+1,c=a.indexOf("\n",f),d=-1===c?a.length:c;return{text:a.slice(b,d),start:b,end:d}},[a,f]),u=(0,e.useMemo)(()=>{let a=t.text.match(/^\s*([/@])([a-zA-Z0-9-]*)$/);return a?{marker:a[1],verb:a[2].toLowerCase()}:null},[t.text]),v=(0,e.useMemo)(()=>{if(!u)return[];let{verb:a}=u,b=b=>b.name.slice(1).toLowerCase().startsWith(a);return[...(d??[]).filter(b),...k.filter(b),...m.filter(b)]},[u,d,k,m]),w=!q&&!!u&&v.length>0;(0,e.useRef)(a);let x=(0,e.useCallback)(a=>{j(a.selectionStart??0)},[]),y=(0,e.useCallback)(d=>{let e=u?.marker??"/",f=`${e}${d.name.slice(1)} `,g=a.slice(0,t.start),h=a.slice(t.end),i=g.length+f.length;b(g+f+h),j(i),requestAnimationFrame(()=>{let a=c.current;a&&(a.focus(),a.setSelectionRange(i,i))})},[a,t,u,b,c]),z=(0,e.useCallback)(a=>{if(a.nativeEvent.isComposing||!w||0===v.length)return!1;let b=()=>{a.preventDefault(),a.stopPropagation()};return"ArrowDown"===a.key?(b(),p(a=>(a+1)%v.length),!0):"ArrowUp"===a.key?(b(),p(a=>(a-1+v.length)%v.length),!0):"Enter"===a.key||"Tab"===a.key?(b(),y(v[o]),!0):"Escape"===a.key&&(b(),r(!0),!0)},[w,v,o,y]);return{isOpen:w,items:v,selectedIndex:o,marker:u?.marker??"/",listRef:s,selectCommand:y,handleKeyDown:z,trackCaret:x}}function j({ac:a,className:b=""}){let{t:c}=(0,f.Bd)(),{isOpen:e,items:g,selectedIndex:h,marker:i,listRef:k,selectCommand:l}=a;return e&&0!==g.length?(0,d.jsx)("div",{ref:k,className:`overflow-y-auto bg-card border border-border rounded-lg shadow-lv2 ${b}`,children:g.map((a,b)=>{let e=b>0?g[b-1]:null,f="skill"===a.source&&(!e||"skill"!==e.source),j="skill"!==a.source&&0===b;return(0,d.jsxs)("div",{children:[j&&(0,d.jsx)("div",{className:"px-4 py-1 text-[10px] uppercase tracking-wider text-muted-foreground bg-muted/40",children:"Commands"}),f&&(0,d.jsx)("div",{className:"px-4 py-1 text-[10px] uppercase tracking-wider text-muted-foreground bg-muted/40",children:"Skills"}),(0,d.jsxs)("div",{onClick:()=>l(a),className:`px-4 py-2 cursor-pointer ${b===h?"bg-brand/10":"hover:bg-hover"}`,children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("span",{className:"font-mono text-sm font-medium text-foreground",children:i+a.name.slice(1)}),(0,d.jsx)("span",{className:"flex-1 text-sm text-muted-foreground truncate",children:"builtin"===a.source?c(`commands.${a.name.slice(1)}`,{defaultValue:a.description}):a.description}),(0,d.jsx)("span",{className:`text-xs px-1.5 py-0.5 rounded ${(a=>{switch(a){case"builtin":return"bg-brand/15 text-brand dark:bg-brand/25 dark:text-teal-11";case"skill":return"bg-purple-9/15 text-purple-11 dark:bg-purple-9/25 dark:text-purple-11"}})(a.source)}`,children:(a=>{switch(a){case"builtin":return c("common.builtin");case"skill":return"Skill"}})(a.source)})]}),"skill"===a.source&&a.argumentHint&&(0,d.jsx)("div",{className:"font-mono text-xs text-muted-foreground mt-0.5 pl-0 truncate",children:a.argumentHint})]})]},a.name)})}):null}},72399:(a,b,c)=>{"use strict";c.d(b,{ProjectSidebar:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call ProjectSidebar() from the server but ProjectSidebar is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/ProjectSidebar.tsx","ProjectSidebar")},72529:(a,b,c)=>{"use strict";c.d(b,{m:()=>f});var d=c(48249),e=c(67484);function f({content:a,children:b,className:c}){if(c)return(0,d.jsx)("div",{"data-tooltip":a,className:c,children:b});let g=e.Children.toArray(b);if(1===g.length&&(0,e.isValidElement)(g[0])){let b=g[0];return(0,e.cloneElement)(b,{"data-tooltip":a})}return(0,d.jsx)("div",{"data-tooltip":a,style:{display:"contents"},children:b})}},73414:(a,b,c)=>{"use strict";c.d(b,{YO:()=>e,aj:()=>d,pU:()=>f});let d=3,e=20;function f(a,b,c,g=[]){let h=a.length,i=c=>"unchanged"!==a[c].type||"unchanged"!==b[c].type,j=new Set;for(let a=0;a<h;a++){if(!i(a))continue;let b=Math.max(0,a-d),c=Math.min(h-1,a+d);for(let a=b;a<=c;a++)j.add(a)}let k=[];for(let a=0;a<h;a++){if(j.has(a))continue;let b=a;for(;a<h&&!j.has(a);)a++;k.push({id:k.length,startIdx:b,endIdx:a-1}),a--}for(let a of k){let b=c.get(a.id)??{topRevealed:0,bottomRevealed:0},d=a.endIdx-a.startIdx+1,e=Math.max(0,Math.min(b.topRevealed,d)),f=Math.max(0,Math.min(b.bottomRevealed,d-e));for(let b=a.startIdx;b<a.startIdx+e;b++)j.add(b);for(let b=a.endIdx-f+1;b<=a.endIdx;b++)j.add(b)}let l=[];for(let a=0;a<h;a++){let c;if(j.has(a)){l.push({kind:"diff",idx:a});continue}let d=a;for(;a<h&&!j.has(a);)a++;let f=a-1;a--;let i=k.find(a=>a.startIdx<=d&&f<=a.endIdx);if(!i)continue;let m=f-d+1,n=Math.min(e,m);if(g.length>0&&f+1<h)for(let a=f+1;a<h;a++){let d=b[a].lineNum;if(!(d<=0)){c=function(a,b){let c=null;for(let d of a)d.startLine<=b&&b<=d.endLine&&(!c||d.endLine-d.startLine<c.endLine-c.startLine)&&(c=d);return c}(g,d)??void 0;break}}l.push({kind:"gap-expand",gapId:i.id,direction:"up",revealCount:n}),l.push({kind:"gap-label",gapId:i.id,hiddenCount:m,enclosingFn:c}),l.push({kind:"gap-expand",gapId:i.id,direction:"down",revealCount:n})}return{rows:l,gaps:k}}},73887:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{M:()=>A});var e=c(48249),f=c(67484),g=c(44384),h=c(64825),i=c(74429),j=c(7122),k=c(7833),l=c(41051),m=c(42140),n=c(70596),o=c(74754),p=c(7031),q=c(91579),r=c(208),s=c(98356),t=c(64676),u=c(84835);c(15466);var v=c(60591),w=c(34728),x=c(24680),y=c(92608),z=c(37690);let a=[u.W];function A({content:b,filePath:c,cwd:d,onClose:u,sourceFile:B,embedded:C=!1,onLocalMdLink:D,scrollToAnchor:E}){let F=B||(d&&c.startsWith(d)?c.slice(d.endsWith("/")?d.length:d.length+1):c),{t:G}=(0,g.Bd)(),H=(0,j.iN)(),I=(0,p.r)(),J=(0,w.U)(),{comments:K,addComment:L,updateComment:M,deleteComment:N,refresh:O}=(0,o._)({cwd:d,filePath:c}),[P,Q]=(0,f.useState)(!1),[R,S]=(0,f.useState)(null),[T,U]=(0,f.useState)(null),[V,W]=(0,f.useState)(null),X=(0,f.useMemo)(()=>b.split("\n"),[b]),Y=(0,f.useMemo)(()=>(0,t.J4)(c,d),[c,d]),[Z,$]=(0,f.useState)(null),_=(0,f.useRef)(null),aa=(0,f.useRef)({onLocalMdLink:D,sourceFile:F});aa.current={onLocalMdLink:D,sourceFile:F};let ab=(0,f.useRef)(a=>{let{onLocalMdLink:b,sourceFile:c}=aa.current;if(!b||/^[a-z][a-z0-9+.-]*:/i.test(a))return!1;let d=a.indexOf("#"),e=d>=0?a.slice(0,d):a,f=d>=0?a.slice(d+1):null;if(!e)return!1;let g=e;try{g=decodeURIComponent(e)}catch{}return!!(0,v.e$)(g)&&(b((0,v.WU)(c,g),f),!0)}).current,{toolbarRef:ac,bumpRef:ad,clearToolbar:ae}=(0,z.L)({enabled:!0,container:Z,resolveLineRange:a=>{let b=function(a){let b=a.nodeType===Node.TEXT_NODE?a.parentElement:a;if(!b||!("closest"in b))return null;let c=b.closest("[data-source-start]");if(!c)return null;let d=c.getAttribute("data-source-start"),e=c.getAttribute("data-source-end");return d&&e?{start:parseInt(d,10),end:parseInt(e,10)}:null}(a);return b?{start:b.start,end:b.end}:null},buildLineSnapshot:({start:a,end:b})=>{let c=Math.max(0,a-1),d=Math.min(X.length,b);return X.slice(c,d).join("\n")}}),af=(0,f.useCallback)(()=>{let a=ac.current;a&&(S({x:a.x,y:a.y,range:a.range,selectedText:a.selectedText,lineSnapshot:a.lineSnapshot}),ae())},[ae,ac]),ag=(0,f.useCallback)(()=>{let a=ac.current;a&&(U({x:a.x,y:a.y,range:a.range,selectedText:a.selectedText,lineSnapshot:a.lineSnapshot}),ae())},[ae,ac]),ah=(0,f.useCallback)(()=>{let a=ac.current;a&&I&&(ae(),(0,q.Ff)(I.sendMessage,{filePath:c,startLine:a.range.start,endLine:a.range.end,codeContent:a.lineSnapshot},r.A.t("explain.selectionMessage")))},[I,c,ae,ac]),ai=(0,f.useCallback)(async a=>{R&&(await L(R.range.start,R.range.end,a,R.selectedText),S(null))},[R,L]),aj=(0,f.useCallback)(async(a,b)=>{if(I)try{let e=await (0,q.$3)(d),f=[];for(let a of e)f.push({filePath:a.filePath,startLine:a.startLine,endLine:a.endLine,codeContent:a.codeContent,note:a.content||void 0});f.push({filePath:c,startLine:a.range.start,endLine:a.range.end,codeContent:a.lineSnapshot});let g=(0,q.Gw)(f,b);I.sendMessage(g),await (0,q.RP)(d),O()}catch(a){console.error("Failed to send to AI:",a)}},[I,c,d,O]),ak=(0,f.useCallback)(a=>{T&&aj(T,a)},[T,aj]),al=(0,f.useCallback)(a=>{R&&aj(R,a)},[R,aj]);(0,f.useMemo)(()=>{if(0===K.length)return[];let a=new Map;for(let b of K){let c=`${b.startLine}-${b.endLine}`;a.has(c)||a.set(c,[]),a.get(c).push(b)}return Array.from(a.entries()).map(([a,b])=>({key:a,startLine:b[0].startLine,endLine:b[0].endLine,comments:b}))},[K]);let[am,an]=(0,f.useState)([]);return(0,e.jsxs)(e.Fragment,{children:[!C&&(0,e.jsxs)("div",{className:"px-4 py-3 border-b border-border flex items-center justify-between gap-3 flex-shrink-0",children:[(0,e.jsxs)("span",{className:"text-sm font-medium text-foreground truncate min-w-0 flex-1 cursor-pointer hover:text-brand transition-colors",style:{direction:"rtl",textAlign:"left"},"data-tooltip":c,onClick:()=>{navigator.clipboard.writeText(c),(0,k.oR)(G("common.copiedPath"))},children:["‎",c]}),(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsx)(y.ShareReviewToggle,{content:b,sourceFile:F}),(0,v.C_)(c)&&(0,e.jsx)("button",{onClick:()=>J(c.startsWith("/")||!d?c:`${d.replace(/\/$/,"")}/${c}`),className:"p-1 text-muted-foreground hover:text-foreground hover:bg-hover rounded transition-colors",title:G("skills.addTooltip"),children:(0,e.jsx)(h.A,{className:"w-4 h-4"})}),(0,e.jsx)("button",{onClick:u,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-hover rounded transition-colors",title:G("common.close"),children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),(0,e.jsxs)("div",{className:"flex-1 flex overflow-hidden",children:[(0,e.jsx)(x.l,{content:b,containerRef:_}),(0,e.jsxs)("div",{className:"flex-1 overflow-auto relative",ref:_,children:[(0,e.jsx)("div",{className:"p-6",children:(0,e.jsx)(s.T,{content:b,basePath:Y,rehypePlugins:a,onLinkClick:ab})}),am.map(({key:a,top:b,comments:c})=>(0,e.jsx)("div",{className:"absolute right-3 cursor-pointer z-10",style:{top:b},onClick:a=>{a.stopPropagation(),W({comment:c[0],x:a.clientX,y:a.clientY})},children:(0,e.jsx)("div",{className:"w-5 h-5 rounded-full bg-amber-500/80 text-white text-xs flex items-center justify-center shadow-lv1 hover:bg-amber-500 transition-colors",children:c.length})},a))]})]}),P&&H&&(0,i.createPortal)((0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(l.fS,{floatingToolbarRef:ac,bumpRef:ad,container:H,onAddComment:af,onSendToAI:ag,onExplain:I?ah:void 0,isChatLoading:I?.isLoading}),R&&(0,e.jsx)(m.t,{x:R.x,y:R.y,range:R.range,filePath:c,lineSnapshot:R.lineSnapshot,container:H,onSubmit:ai,onSendToAI:I?al:void 0,onClose:()=>S(null),isChatLoading:I?.isLoading}),T&&(0,e.jsx)(m.G,{x:T.x,y:T.y,range:T.range,filePath:c,lineSnapshot:T.lineSnapshot,container:H,onSubmit:ak,onClose:()=>U(null),isChatLoading:I?.isLoading}),V&&(0,e.jsx)(n.t,{x:V.x,y:V.y,comment:V.comment,container:H,onClose:()=>W(null),onUpdateComment:M,onDeleteComment:N})]}),H)]})}d()}catch(a){d(a)}})},74228:(a,b,c)=>{"use strict";c.d(b,{S:()=>f,l:()=>g});var d=c(48249),e=c(40311);function f(a){return"loading"===a||"unread"===a?a:"normal"}function g({projectNumber:a,sessionNumber:b,coordinate:c,status:f="normal",statusLabel:h,className:i=""}){if(c){let[d,e]=c.split(".");a??=d,b??=e}if(null==a&&null==b)return null;let j="flex h-4 w-4 items-center justify-center border",k=[a,b].filter(a=>null!=a).join(".");return(0,d.jsxs)("span",{className:`inline-flex items-center gap-1 font-mono text-[9px] font-medium leading-none tabular-nums flex-shrink-0 ${i}`,"aria-label":h?`${k} \xb7 ${h}`:k,children:[null!=a&&(0,d.jsx)("span",{className:`${j} rounded-[4px] ${(0,e.c)("normal",!1)}`,children:a}),null!=b&&(0,d.jsx)("span",{className:`${j} rounded-full ${(0,e.c)(f,!1)}`,title:h,children:b})]})}},74542:(a,b,c)=>{"use strict";c.d(b,{b:()=>f});var d=c(48249),e=c(67484);function f({lines:a,containerRef:b}){let c=(0,e.useRef)(null),[g,h]=(0,e.useState)({top:0,height:0});if(0===a.length)return null;let i=100/a.length;return(0,d.jsxs)("div",{ref:c,className:"w-4 flex-shrink-0 bg-secondary border-l border-border relative cursor-pointer",onClick:a=>{let d=b.current,e=c.current;if(!d||!e)return;let f=e.getBoundingClientRect(),g=(a.clientY-f.top)/f.height*d.scrollHeight-d.clientHeight/2;d.scrollTo({top:Math.max(0,g),behavior:"smooth"})},children:[a.map((a,b)=>"unchanged"!==a.type&&(0,d.jsx)("div",{className:`absolute left-0 right-0 ${"removed"===a.type?"bg-red-9":"bg-green-9"}`,style:{top:`${b*i}%`,height:`${Math.max(i,.5)}%`,minHeight:"2px"}},b)),(0,d.jsx)("div",{className:"absolute left-0 right-0 bg-muted/60 border-y border-border",style:{top:`${g.top}px`,height:`${Math.max(g.height,10)}px`}})]})}},74691:(a,b,c)=>{"use strict";c.d(b,{y:()=>f});var d=c(48249),e=c(44384);function f({value:a,onChange:b,className:c}){let{t:g}=(0,e.Bd)();return(0,d.jsx)("div",{className:`flex items-center gap-0.5 rounded border border-border overflow-hidden ${c??""}`,children:["compact","full"].map(c=>(0,d.jsx)("button",{onClick:a=>{a.stopPropagation(),b(c)},className:`px-2 py-0.5 text-xs transition-colors ${a===c?"bg-brand text-white":"text-muted-foreground hover:bg-hover"}`,children:g("compact"===c?"diffViewer.compact":"diffViewer.full")},c))})}},74754:(a,b,c)=>{"use strict";c.d(b,{_:()=>g});var d=c(67484);c(91579);var e=c(33281),f=c(89800);function g({cwd:a,filePath:b}){let[c,h]=(0,d.useState)([]),[i,j]=(0,d.useState)(!1),[k,l]=(0,d.useState)(null),m=(0,d.useCallback)(async()=>{if(!a||!b)return;j(!0),l(null);let c=await e.t4.runPromiseExit((0,f.lb)(a,b));if("Success"===c._tag)h(c.value.comments??[]);else{let a="Fail"===c.cause._tag?c.cause.error:null,b=a?.cause;l(b instanceof Error?b.message:"Failed to load comments")}j(!1)},[a,b]),n=(0,d.useCallback)(async(c,d,g,i)=>{let j=await e.t4.runPromiseExit((0,f.BC)({cwd:a,filePath:b,startLine:c,endLine:d,content:g,...i?{selectedText:i}:{}}));if("Success"===j._tag&&j.value.comment){let a=j.value.comment;return h(b=>[...b,a]),a}return"Failure"===j._tag&&console.error("Failed to add comment:",j.cause),null},[a,b]),o=(0,d.useCallback)(async(b,c)=>{let d=await e.t4.runPromiseExit((0,f.vv)(a,b,c));if("Success"===d._tag&&d.value.comment){let a=d.value.comment;return h(c=>c.map(c=>c.id===b?a:c)),!0}return"Failure"===d._tag&&console.error("Failed to update comment:",d.cause),!1},[a]),p=(0,d.useCallback)(async b=>{let c=await e.t4.runPromiseExit((0,f.Tu)(a,b));return"Success"===c._tag?(h(a=>a.filter(a=>a.id!==b)),!0):(console.error("Failed to delete comment:",c.cause),!1)},[a]),q=(0,d.useCallback)(a=>c.filter(b=>a>=b.startLine&&a<=b.endLine),[c]);return{comments:c,isLoading:i,error:k,addComment:n,updateComment:o,deleteComment:p,refresh:m,getCommentsForLine:q}}},74837:(a,b,c)=>{"use strict";c.d(b,{NoteToolbar:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call NoteToolbar() from the server but NoteToolbar is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/NoteToolbar.tsx","NoteToolbar")},74991:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{I:()=>s});var e=c(48249),f=c(67484),g=c(44384),h=c(7833),i=c(15819);c(33281);var j=c(13054),k=c(30458),l=c(36688),m=c(32753),n=c(74228),o=c(15790);c(41224);var p=a([o,l]);function q(a){return a.engine||"claude"}function r(a){return a.lastFiredAt??a.createdAt}[o,l]=p.then?(await p)():p;let t=[{key:"pendingReview",labelKey:"scheduledTasks.groupPendingReview"},{key:"upcoming",labelKey:"scheduledTasks.groupUpcoming"},{key:"paused",labelKey:"scheduledTasks.paused"}];function s({collapsed:a,tasks:b,unreadCount:c,sessionNumbers:d,onSwitchProject:p,onPause:u,onResume:v,onTrigger:w,onDelete:x,onMarkRead:y,onUpdateTask:z}){let{t:A}=(0,g.Bd)(),[B,C]=(0,f.useState)(!1),[D,E]=(0,f.useState)(null),F=(0,f.useRef)(null),G=(0,f.useRef)(null),[H,I]=(0,f.useState)(null),J=(0,f.useCallback)(()=>{E(null),F.current=null,I(null)},[]),[K,L]=(0,f.useState)(null),[M,N]=(0,f.useState)(null),[O,P]=(0,f.useState)(null),Q=b.filter(a=>!a.completed),R=Q.filter(a=>!a.paused).length,S=(0,f.useMemo)(()=>(function(a){let b=[],c=[],d=[];for(let e of a)e.unread||e.completed?b.push(e):e.paused?d.push(e):c.push(e);return b.sort((a,b)=>Number(!!b.unread)-Number(!!a.unread)||r(b)-r(a)),c.sort((a,b)=>(a.nextFireTime||Number.MAX_SAFE_INTEGER)-(b.nextFireTime||Number.MAX_SAFE_INTEGER)),d.sort((a,b)=>r(b)-r(a)),{pendingReview:b,upcoming:c,paused:d}})(b),[b]),T=O?b.find(a=>a.id===O)??null:null,[,U]=(0,f.useState)(0),V=(0,f.useCallback)(()=>{L(null),N(null)},[]),W=(0,f.useCallback)(async a=>{let b=!!a.taskFile;try{await navigator.clipboard.writeText(b?a.taskFile:a.message),(0,h.oR)(A(b?"common.copiedPath":"toast.copiedMessage"),"success")}catch{(0,h.oR)(A("common.copyFailed"),"error")}},[A]),X=(0,f.useCallback)(()=>{C(!1),P(null)},[]),Y=(0,f.useCallback)(a=>{p(a.cwd,a.sessionId),a.unread&&y(a.id),X()},[p,y,X]);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("button",{onClick:()=>C(!0),className:`relative flex items-center gap-2 px-2 py-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-hover transition-colors ${a?"w-full justify-center":"w-full"}`,title:a?A("scheduledTasks.title"):void 0,children:[(0,e.jsxs)("svg",{className:"w-5 h-5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,e.jsx)("circle",{cx:"12",cy:"12",r:"10",strokeWidth:2}),(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6l4 2"})]}),!a&&(0,e.jsx)("span",{className:"text-sm flex-1 text-left",children:A("scheduledTasks.title")}),c>0?(0,e.jsx)("span",{className:`min-w-[18px] h-[18px] px-1 text-foreground text-xs font-medium rounded-full flex items-center justify-center bg-red-9/55 ${a?"absolute -top-1 -right-1":""}`,children:c}):a&&b.length>0?(0,e.jsx)("span",{className:"absolute -top-1 -right-1 min-w-[18px] h-[18px] px-1 text-muted-foreground text-xs font-medium rounded-full flex items-center justify-center bg-popover border border-border",children:b.length}):null]}),B&&(0,e.jsxs)("div",{className:"fixed inset-0 z-[70] flex items-center justify-center",children:[(0,e.jsx)("div",{className:"absolute inset-0 bg-scrim",onClick:X}),(0,e.jsxs)("div",{className:i.aO,children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,e.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[(0,e.jsx)("h2",{className:"text-sm font-medium text-foreground",children:A("scheduledTasks.title")}),Q.length>0&&(0,e.jsxs)("span",{className:"text-xs text-muted-foreground",children:[A("scheduledTasks.activeCount",{running:R}),Q.length-R>0?` \xb7 ${A("scheduledTasks.pausedCount",{paused:Q.length-R})}`:""]})]}),(0,e.jsx)("button",{onClick:X,className:"p-1 text-foreground-subtle hover:text-foreground hover:bg-hover rounded transition-colors",children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsx)("div",{className:"flex-1 flex min-h-0",children:0===b.length?(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,e.jsx)("div",{className:"text-xs text-muted-foreground",children:A("scheduledTasks.noScheduledTasks")})}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"w-full md:w-[360px] flex-shrink-0 md:border-r border-border overflow-y-auto p-3 space-y-4",children:t.map(({key:a,labelKey:b})=>{let c=S[a];return 0===c.length?null:(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"sticky top-0 z-10 -mx-3 px-3 py-1 bg-card text-[11px] font-medium text-muted-foreground",children:[A(b)," (",c.length,")"]}),(0,e.jsx)("div",{className:"mt-1 space-y-2",children:c.map(a=>{let b,c;return b=a.id===O,(0,e.jsxs)("div",{onClick:()=>P(a.id),className:`group p-3 rounded border cursor-pointer transition-all hover:border-brand hover:shadow-lv2 ${b?"border-brand bg-brand/5 shadow-lv2":a.unread?"border-brand/40 bg-brand/5":"border-border"} ${a.completed?"opacity-70":""}`,children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5 mb-1",children:[(0,e.jsx)("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${a.unread?"bg-red-11":a.completed?"bg-muted-foreground/30":a.paused?"bg-amber-11":"error"===a.lastResult?"bg-red-11":"bg-green-11"}`}),(0,e.jsx)(m.S,{engine:q(a),tooltip:(c=q(a),a.model?`${c} \xb7 ${a.model}`:c)}),(0,e.jsx)("h4",{className:"text-xs font-medium text-foreground truncate flex-1","data-tooltip":a.cwd,children:(0,j.P_)(a.cwd)}),(0,e.jsx)(n.l,{coordinate:d?.[`${a.cwd}
751
752
  ${a.sessionId}`]}),(0,e.jsx)("span",{className:"text-[10px] text-muted-foreground flex-shrink-0 group-hover:hidden",children:a.completed?A("scheduledTasks.completed"):a.paused?A("scheduledTasks.paused"):A("common.running")}),(0,e.jsxs)("div",{className:"flex-shrink-0 flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[a.taskFile&&(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),L(a.taskFile)},className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground",title:A("common.preview"),children:(0,e.jsxs)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]})}),(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),W(a)},className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground",title:A(a.taskFile?"common.copyPath":"common.copy"),children:(0,e.jsxs)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,e.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",strokeWidth:2}),(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]})}),(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),w(a.id)},className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-brand",title:A("scheduledTasks.runNow"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{d:"M8 5v14l11-7z"})})}),(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),F.current=b.currentTarget,E(a)},className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground",title:A("common.edit"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),a.completed?null:a.paused?(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),v(a.id)},className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-green-11",title:A("scheduledTasks.resume"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z"})})}):(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),u(a.id)},className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-amber-11",title:A("scheduledTasks.pause"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 9v6m4-6v6"})})}),(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),x(a.id)},className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-destructive",title:A("common.delete"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),(0,e.jsx)("div",{className:"text-xs text-foreground line-clamp-3 mb-1 whitespace-pre-wrap break-words","data-tooltip":(0,j.Q_)(a),children:(0,j.Q_)(a)}),(0,e.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:"truncate",children:function(a,b){if("once"===a.type)return b("scheduledTasks.onceType",{minutes:a.delayMinutes});if("interval"===a.type){let c=b("scheduledTasks.everyNMinutes",{minutes:a.intervalMinutes});return a.activeFrom&&a.activeTo?`${c} (${a.activeFrom}-${a.activeTo})`:c}return"cron"===a.type?a.cron||"cron":a.type}(a,A)}),(0,e.jsx)("span",{children:"\xb7"}),(0,e.jsx)("span",{className:"flex-shrink-0",children:a.completed?"success"===a.lastResult?A("scheduledTasks.success"):A("scheduledTasks.failure"):a.paused?A("scheduledTasks.paused"):function(a,b){if(!a)return"-";let c=a-Date.now();if(c<=0)return b("scheduledTasks.aboutToTrigger");if(c<6e4)return b("scheduledTasks.secondsLater",{count:Math.ceil(c/1e3)});if(c<36e5)return b("scheduledTasks.minutesLater",{count:Math.ceil(c/6e4)});if(c<864e5){let a=Math.floor(c/36e5),d=Math.ceil(c%36e5/6e4);return d>0?b("scheduledTasks.hoursMinutesLater",{h:a,m:d}):b("scheduledTasks.hoursLater",{h:a})}return new Date(a).toLocaleDateString("zh-CN",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}(a.nextFireTime,A)}),!a.completed&&a.lastFiredAt&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{children:"\xb7"}),(0,e.jsxs)("span",{className:"flex-shrink-0",children:[A("scheduledTasks.lastResult"),": ","success"===a.lastResult?"✓":"✗"]})]})]})]},a.id)})})]},a)})}),(0,e.jsx)("div",{className:"hidden md:flex flex-1 min-w-0",children:T?(0,e.jsx)(o.x,{task:T,onOpenSession:()=>Y(T)},T.id):(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center text-xs text-muted-foreground",children:A("scheduledTasks.selectTaskHint")})})]})})]})]}),K&&null!==M&&(0,e.jsx)(l.x,{filePath:K,content:M,cwd:K.slice(0,Math.max(0,K.lastIndexOf("/"))),onClose:V,zClassName:"z-[80]"}),D&&(0,e.jsx)("div",{ref:G,className:"fixed z-[100]",style:{top:H?.top??0,left:H?.left??0,visibility:H?"visible":"hidden"},children:(0,e.jsx)(k.E,{onClose:J,onCreate:()=>{},editTask:{id:D.id,message:D.message,taskFile:D.taskFile,type:D.type,delayMinutes:D.delayMinutes,intervalMinutes:D.intervalMinutes,activeFrom:D.activeFrom,activeTo:D.activeTo,cron:D.cron},onUpdate:(a,b)=>{z(a,b),J()}})})]})}d()}catch(a){d(a)}})},75513:(a,b,c)=>{"use strict";c.d(b,{k_:()=>h,nH:()=>i});var d=c(48249),e=c(67484),f=c(7031);let g=(0,e.createContext)(null);function h({children:a}){let b=(0,e.useRef)(new Map),c=(0,e.useRef)(null),[i,j]=(0,e.useState)(!1),k=(0,e.useCallback)((a,c)=>{b.current.set(c,a)},[]),l=(0,e.useCallback)(a=>{b.current.delete(a)},[]),m=(0,e.useCallback)(a=>{c.current=a},[]),n=(0,e.useCallback)(a=>{let d=c.current;if(!d)return void console.warn("No active tab to send message");let e=b.current.get(d);e?e(a):console.warn(`No chat sender registered for tab ${d}`)},[]),o=(0,e.useMemo)(()=>({sendMessage:n,isLoading:i,registerChat:k,unregisterChat:l,setActiveTab:m,setIsLoading:j}),[n,i,k,l,m]),p=(0,e.useMemo)(()=>({sendMessage:n,isLoading:i}),[n,i]);return(0,d.jsx)(g.Provider,{value:o,children:(0,d.jsx)(f.H,{value:p,children:a})})}function i(){return(0,e.useContext)(g)}},76537:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>q,metadata:()=>o,viewport:()=>p});var d=c(5735),e=c(30768),f=c.n(e),g=c(93868),h=c.n(g),i=c(83503),j=c.n(i),k=c(29021),l=c(33873);c(61135);var m=c(25702);let n="";try{n=(0,k.readFileSync)((0,l.join)(process.cwd(),"public","boot.js"),"utf8")}catch{}let o={title:"OpenCockpit",description:"OpenCockpit is a local-first AI development hub with chat agents, a file explorer, terminals, and browser bubbles in one swipeable workspace. One seat. One AI.",appleWebApp:{capable:!0,statusBarStyle:"default",title:"Cockpit"},icons:{icon:"/icons/icon-192x192.png",apple:"/icons/icon-192x192.png"}},p={themeColor:[{media:"(prefers-color-scheme: light)",color:"#f9f9fb"},{media:"(prefers-color-scheme: dark)",color:"#111113"}]};function q({children:a}){return(0,d.jsxs)("html",{lang:"en",suppressHydrationWarning:!0,className:"overflow-hidden",children:[(0,d.jsxs)("head",{children:[(0,d.jsx)("script",{dangerouslySetInnerHTML:{__html:n}}),(0,d.jsx)("script",{dangerouslySetInnerHTML:{__html:`window.__COCKPIT_BUILD_ID__=${JSON.stringify(process.env.COCKPIT_BUILD_ID??null)};window.__COCKPIT_FORCE_UPDATE__=${JSON.stringify("1"===process.env.COCKPIT_FORCE_UPDATE_BADGE)}`}})]}),(0,d.jsx)("body",{className:`${f().variable} ${h().variable} ${j().variable} antialiased overflow-hidden`,children:(0,d.jsx)(m.Providers,{children:a})})]})}},76855:(a,b,c)=>{"use strict";c.d(b,{Sn:()=>i,Xm:()=>j,po:()=>k,JL:()=>l});var d=c(67484);c(28797);var e=c(79606),f=c(33281),g=c(71192);let h=(a,b)=>e.tryPromise({try:async()=>{let c=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)});if(!c.ok)throw Error(`HTTP ${c.status}`);return await c.json()},catch:b=>new g.uV({message:`${a} failed`,cause:b})});function i(a){let[b,c]=(0,d.useState)(!1);return{goToDefinition:(0,d.useCallback)(async(b,d,e)=>{c(!0);let g=await f.t4.runPromiseExit(h("/api/lsp/definition",{cwd:a,filePath:b,line:d,column:e}));return(c(!1),"Success"===g._tag)?g.value.definitions??[]:(console.error("[useLSP] definition error:",g.cause),[])},[a]),loading:b}}function j(a){let[b,c]=(0,d.useState)(null),e=(0,d.useRef)(null),g=(0,d.useRef)(null),i=(0,d.useRef)(0),j=(0,d.useRef)(!1),k=(0,d.useRef)(null),l=(0,d.useRef)({x:0,y:0}),m=(0,d.useCallback)(a=>{k.current=a},[]),n=(0,d.useRef)(!1),o=(0,d.useRef)(null),p=(0,d.useCallback)(()=>{let a=k.current;a&&n.current&&(a.style.pointerEvents="none"),n.current=!1,o.current&&(k.current?.removeEventListener("mouseleave",o.current),o.current=null)},[]),q=(0,d.useCallback)(()=>{let a=k.current;if(!a||n.current)return;n.current=!0,j.current=!0,a.style.pointerEvents="auto";let b=()=>{j.current=!1,p(),i.current++,c(null)};o.current=b,a.addEventListener("mouseleave",b)},[p]),r=(0,d.useCallback)((b,d,j,k)=>{e.current&&clearTimeout(e.current),g.current&&clearTimeout(g.current);let l=++i.current;e.current=setTimeout(async()=>{let e=await f.t4.runPromiseExit(h("/api/lsp/hover",{cwd:a,filePath:b,line:d,column:j}));if(l!==i.current||"Success"!==e._tag)return;let g=e.value.hover;g&&g.displayString&&c({...g,x:k.x,y:k.y,filePath:b,line:d,column:j})},300)},[a]),s=(0,d.useCallback)(()=>{e.current&&clearTimeout(e.current),i.current++,g.current=setTimeout(function(){if(j.current)return;let a=k.current;if(a){let b=a.getBoundingClientRect(),{x:c,y:d}=l.current;if(c>=b.left&&c<=b.right&&d>=b.top&&d<=b.bottom)return void q()}c(null)},150)},[q]),t=(0,d.useCallback)(()=>{j.current=!0,g.current&&clearTimeout(g.current)},[]);return{hoverInfo:b,onTokenMouseEnter:r,onTokenMouseLeave:s,onCardMouseEnter:t,onCardMouseLeave:(0,d.useCallback)(()=>{j.current=!1,i.current++,c(null)},[]),clearHover:(0,d.useCallback)(()=>{e.current&&clearTimeout(e.current),g.current&&clearTimeout(g.current),j.current=!1,p(),i.current++,c(null)},[p]),setTooltipEl:m}}function k(a){let[b,c]=(0,d.useState)([]),[e,g]=(0,d.useState)(!1),[i,j]=(0,d.useState)(!1);return{references:b,loading:e,visible:i,findReferences:(0,d.useCallback)(async(b,d,e)=>{g(!0),j(!0);let i=await f.t4.runPromiseExit(h("/api/lsp/references",{cwd:a,filePath:b,line:d,column:e}));"Success"===i._tag?c(i.value.references??[]):(console.error("[useLSP] references error:",i.cause),c([])),g(!1)},[a]),closeReferences:(0,d.useCallback)(()=>{j(!1),c([])},[])}}function l(a,b){(0,d.useRef)(null)}},77120:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{SessionBrowser:()=>o});var e=c(48249),f=c(67484),g=c(44384),h=c(15819),i=c(57031),j=c(88214),k=c(33281),l=c(65484),m=c(74228),n=c(32753);function o({isOpen:a,onClose:b,onSelectSession:c,onAddProject:d,sessionNumbers:p={},projectNumbers:q={}}){let{t:r}=(0,g.Bd)(),[s,t]=(0,f.useState)(!1),[u,v]=(0,f.useState)([]),[w,x]=(0,f.useState)({}),[y,z]=(0,f.useState)(!1),[A,B]=(0,f.useState)(null),[C,D]=(0,f.useState)(""),E=(0,f.useRef)(null);(0,f.useCallback)(async()=>{z(!0),B(null),x({});let a=await k.t4.runPromiseExit((0,l.H7)());"Success"===a._tag?v(a.value):B("Failed to load projects"),z(!1)},[]);let F=(0,f.useCallback)(async a=>{x(b=>({...b,[a]:{...b[a],isExpanded:!0,isLoading:!0,sessions:[],error:null}}));let b=await k.t4.runPromiseExit((0,l.QW)(a));"Success"===b._tag?x(c=>({...c,[a]:{...c[a],isLoading:!1,sessions:b.value}})):x(b=>({...b,[a]:{...b[a],isLoading:!1,error:"Failed to load sessions"}}))},[]),G=(0,f.useCallback)(a=>{let b=w[a];b?.isExpanded?x(b=>({...b,[a]:{...b[a],isExpanded:!1}})):b?.sessions?.length?x(b=>({...b,[a]:{...b[a],isExpanded:!0}})):F(a)},[w,F]),H=(0,f.useCallback)(async()=>{if(s)return;t(!0);let a=await k.t4.runPromiseExit((0,l.It)());"Success"===a._tag&&a.value.folder&&d&&(d(a.value.folder),b()),t(!1)},[s,d,b]);return a?(0,e.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,e.jsx)("div",{className:"absolute inset-0 bg-scrim",onClick:b}),(0,e.jsxs)("div",{className:h.aO,children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,e.jsx)("h2",{className:"text-sm font-medium text-foreground",children:r("sessions.projectList")}),(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsx)("input",{ref:E,type:"text",placeholder:r("workspace.searchProjectPath"),value:C,onChange:a=>D(a.target.value),className:"px-2 py-1 pr-6 text-xs border border-border rounded bg-card text-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent"}),C&&(0,e.jsx)("button",{onClick:()=>{D(""),E.current?.focus()},className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-foreground-subtle hover:text-foreground rounded-sm transition-colors",title:r("fileBrowser.clear"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),d&&(0,e.jsxs)("button",{onClick:H,disabled:s,className:"flex items-center gap-1.5 px-2.5 py-1 text-xs rounded-md border border-border text-muted-foreground hover:text-foreground hover:bg-hover transition-colors disabled:opacity-50",children:[(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 10v6m3-3H9m-4 7h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})}),s?r("sessions.selectingFolder"):r("sessions.openFolder")]}),(0,e.jsx)("button",{onClick:b,className:"p-1 text-foreground-subtle hover:text-foreground hover:bg-hover rounded transition-colors",children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),(0,e.jsxs)("div",{className:"flex-1 overflow-y-auto p-4",children:[y&&(0,e.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,e.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,e.jsxs)("svg",{className:"animate-spin h-4 w-4",fill:"none",viewBox:"0 0 24 24",children:[(0,e.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,e.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),(0,e.jsx)("span",{children:r("workspace.loadingProjects")})]})}),A&&(0,e.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,e.jsx)("div",{className:"text-xs text-red-11",children:A})}),!y&&!A&&0===u.length&&(0,e.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,e.jsx)("div",{className:"text-xs text-muted-foreground",children:r("workspace.projectNotFound")})}),!y&&!A&&u.filter(a=>a.fullPath.toLowerCase().includes(C.toLowerCase())).map(a=>{let b=w[a.encodedPath]||{isExpanded:!1,isLoading:!1,sessions:[],error:null},d=q[a.fullPath];return(0,e.jsxs)("div",{className:"mb-3",children:[(0,e.jsxs)("button",{onClick:()=>G(a.encodedPath),className:"w-full flex items-center gap-2 p-2 rounded hover:bg-hover transition-colors text-left",children:[(0,e.jsx)("svg",{className:`w-3 h-3 text-muted-foreground transition-transform ${b.isExpanded?"rotate-90":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,e.jsx)("svg",{className:"w-4 h-4 text-muted-foreground",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),d&&(0,e.jsx)(m.l,{projectNumber:d}),(0,e.jsx)("span",{className:"flex-1 text-xs font-medium text-foreground truncate","data-tooltip":a.fullPath,children:a.fullPath}),(0,e.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",a.sessionCount,")"]})]}),b.isExpanded&&(0,e.jsxs)("div",{className:"ml-6 mt-2",children:[b.isLoading&&(0,e.jsxs)("div",{className:"flex items-center gap-2 p-3 text-xs text-muted-foreground",children:[(0,e.jsxs)("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[(0,e.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,e.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),(0,e.jsx)("span",{children:r("sessions.loadingSessions")})]}),b.error&&(0,e.jsx)("div",{className:"p-3 text-xs text-red-11",children:b.error}),!b.isLoading&&!b.error&&(0,e.jsx)("div",{className:h.jL,children:b.sessions.map(b=>{var d;let f=b.path.split("/").pop()||"",g=b.sessionId||f.replace(".jsonl",""),h=p[`${a.fullPath}
752
753
  ${g}`],[k,l]=h?.split(".")??[];return(0,e.jsxs)("div",{onClick:()=>{var d;let e,f;return d=a.fullPath,e=b.path.split("/").pop()||"",f=b.sessionId||e.replace(".jsonl",""),void(c?c(d,f):(0,i.F)(j.n.OpenProject,{cwd:d,sessionId:f}))},className:"p-3 rounded border border-border hover:border-brand hover:shadow-lv2 cursor-pointer transition-all",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5 mb-1",children:[(0,e.jsx)(n.S,{engine:b.engine}),(0,e.jsx)("h4",{className:"text-xs font-medium text-foreground truncate","data-tooltip":b.title,children:b.title}),h&&(0,e.jsx)(m.l,{projectNumber:k,sessionNumber:l,className:"ml-auto"})]}),(0,e.jsx)("div",{className:"text-xs text-muted-foreground mb-2",children:(d=b.modifiedAt,new Date(d).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}))}),(0,e.jsxs)("div",{className:"space-y-0.5 text-xs",children:[b.firstMessages.map((a,b)=>(0,e.jsxs)("div",{className:"text-foreground truncate","data-tooltip":a,children:[(0,e.jsx)("span",{className:"text-foreground-subtle mr-1",children:"•"}),a]},`first-${b}`)),b.lastMessages.length>0&&(0,e.jsx)("div",{className:"text-foreground-subtle text-center py-0.5",children:"\xb7\xb7\xb7"}),b.lastMessages.map((a,b)=>(0,e.jsxs)("div",{className:"text-foreground truncate","data-tooltip":a,children:[(0,e.jsx)("span",{className:"text-foreground-subtle mr-1",children:"•"}),a]},`last-${b}`))]})]},b.path)})})]})]},a.encodedPath)})]})]})]}):null}d()}catch(a){d(a)}})},77156:(a,b,c)=>{"use strict";c.d(b,{Bz:()=>j,Hy:()=>g,L5:()=>h,hp:()=>i});var d=c(79606),e=c(71192);let f=(a,b)=>d.tryPromise({try:async()=>{let c=await fetch(a,b);if(!c.ok){let a;try{a=(await c.json()).error}catch{}throw Error(a||`HTTP ${c.status}`)}return await c.json()},catch:c=>new e.uV({message:`${b?.method??"GET"} ${a} failed`,cause:c})}),g=()=>f("/api/skills"),h=a=>f("/api/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a})}),i=a=>f(`/api/skills/${encodeURIComponent(a)}`,{method:"DELETE"}),j=a=>f(`/api/skills/content?id=${encodeURIComponent(a)}`)},77220:(a,b,c)=>{"use strict";c.d(b,{SettingsModal:()=>n});var d=c(48249),e=c(67484),f=c(44384),g=c(83768),h=c(7833),i=c(28602),j=c(15105),k=c(33281),l=c(79606),m=c(65484);function n({isOpen:a,onClose:b}){let{t:c,i18n:o}=(0,f.Bd)(),{theme:p,setTheme:q}=(0,g.DP)(),r=(0,j.G)(),[s,t]=(0,e.useState)(""),[u,v]=(0,e.useState)(""),[w,x]=(0,e.useState)(null),[y,z]=(0,e.useState)("auto"),A=(0,e.useCallback)(a=>{z(a),k.t4.runFork((0,m.DZ)({language:a}).pipe(l.orElse(()=>l.void)));let b="auto"===a?navigator.language.startsWith("zh")?"zh":"en":a;o.changeLanguage(b)},[o]),B=r?"installed":"not-installed",C=r?.version??null;if(!a)return null;let D=[{value:"system",label:c("settings.themeSystem"),icon:"\uD83D\uDCBB"},{value:"light",label:c("settings.themeLight"),icon:"☀️"},{value:"dark",label:c("settings.themeDark"),icon:"\uD83C\uDF19"}];return(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,d.jsx)("div",{className:"absolute inset-0 bg-scrim",onClick:b}),(0,d.jsxs)("div",{className:"relative bg-card rounded-lg shadow-lv3 w-full max-w-2xl mx-4 overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,d.jsx)("h2",{className:"text-sm font-medium text-foreground",children:c("settings.title")}),(0,d.jsx)("button",{onClick:b,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-hover rounded transition-colors",children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,d.jsxs)("div",{className:"p-4 space-y-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"block text-sm font-medium text-foreground mb-2",children:c("settings.theme")}),(0,d.jsx)("div",{className:"grid grid-cols-3 gap-2",children:D.map(a=>(0,d.jsxs)("button",{onClick:()=>q(a.value),className:`flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors ${p===a.value?"border-brand bg-brand/10 text-brand":"border-border hover:border-slate-6 text-muted-foreground hover:text-foreground"}`,children:[(0,d.jsx)("span",{className:"text-xl",children:a.icon}),(0,d.jsx)("span",{className:"text-xs font-medium",children:a.label})]},a.value))})]}),(0,d.jsx)("div",{className:"border-t border-border"}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"block text-sm font-medium text-foreground mb-2",children:c("settings.language")}),(0,d.jsx)("div",{className:"grid grid-cols-3 gap-2",children:[{value:"auto",label:c("settings.languageAuto"),icon:"\uD83C\uDF10"},{value:"en",label:"English",icon:"\uD83C\uDDFA\uD83C\uDDF8"},{value:"zh",label:"中文",icon:"\uD83C\uDDE8\uD83C\uDDF3"}].map(a=>(0,d.jsxs)("button",{onClick:()=>A(a.value),className:`flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors ${y===a.value?"border-brand bg-brand/10 text-brand":"border-border hover:border-slate-6 text-muted-foreground hover:text-foreground"}`,children:[(0,d.jsx)("span",{className:"text-xl",children:a.icon}),(0,d.jsx)("span",{className:"text-xs font-medium",children:a.label})]},a.value))})]}),(0,d.jsx)("div",{className:"border-t border-border"}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"block text-sm font-medium text-foreground mb-2",children:c("settings.browserExtension")}),(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,d.jsx)("span",{className:`inline-block w-2 h-2 rounded-full flex-shrink-0 ${"installed"===B?"bg-green-500":"bg-slate-400"}`}),(0,d.jsxs)("span",{children:["installed"===B&&`${c("settings.extensionInstalled")}${C?` (v${C})`:""}`,"not-installed"===B&&c("settings.extensionNotInstalled")]})]}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground leading-relaxed",children:c("settings.extensionDescription")}),"installed"!==B&&(0,d.jsxs)("div",{className:"text-xs text-muted-foreground bg-muted/50 rounded-md p-2 space-y-1",children:[(0,d.jsx)("p",{className:"font-medium text-foreground",children:c("settings.installSteps")}),(0,d.jsxs)("p",{children:[c("settings.step1")," ",(0,d.jsx)("code",{className:"px-1 py-0.5 bg-muted rounded text-foreground",children:"chrome://extensions"})]}),(0,d.jsx)("p",{children:c("settings.step2")}),(0,d.jsx)("p",{children:c("settings.step3")}),(0,i.L)()&&(0,d.jsx)("p",{dangerouslySetInnerHTML:{__html:c("settings.step4mac")}})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("button",{onClick:()=>{let a=s||"chrome-extension";navigator.clipboard.writeText(a),(0,h.oR)(c("toast.copiedName",{name:a}))},className:"px-3 py-1.5 text-xs bg-brand text-white rounded-md hover:bg-brand/90 transition-colors",children:c("settings.copyExtensionPath")}),"installed"===B&&(0,d.jsx)("button",{onClick:()=>{r?.id&&window.chrome?.runtime?.sendMessage&&(window.chrome.runtime.sendMessage(r.id,{type:"reload"}),(0,h.oR)(c("toast.pluginReloading")))},className:"px-3 py-1.5 text-xs border border-border text-foreground rounded-md hover:bg-muted transition-colors",children:c("settings.reloadExtension")})]}),s&&(0,d.jsx)("p",{className:"text-[11px] text-muted-foreground font-mono truncate",children:s})]})]}),(0,d.jsx)("div",{className:"border-t border-border"}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"block text-sm font-medium text-foreground mb-2",children:c("settings.about")}),(0,d.jsxs)("div",{className:"text-xs text-muted-foreground space-y-1",children:[(0,d.jsxs)("p",{children:["Cockpit",u?` v${u}`:""]}),(w?.claude||w?.codex)&&(0,d.jsx)("p",{className:"text-muted-foreground/60",children:[w.claude&&`Claude Code ${w.claude}`,w.codex&&`Codex ${w.codex}`,c("settings.agentsBundled")].filter(Boolean).join(" \xb7 ")}),(0,d.jsx)("p",{className:"text-muted-foreground/60",children:"One seat. One AI. Everything under control."})]})]})]})]})]})}},77462:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{TabManager:()=>E});var e=c(48249),f=c(67484),g=c(44384),h=c(43209),i=c(70151),j=c(6900),k=c(2122),l=c(32465),m=c(75513),n=c(57632),o=c(79327),p=c(94192),q=c(44256),r=c(37129),s=c(38878),t=c(3588),u=c(18946),v=c(29939),w=c(98982),x=c(13054),y=c(79606),z=c(23734),A=c(88214),B=c(33281),C=c(65484);c(37388);var D=a([s,t,u,i,n]);function E({initialCwd:a,initialSessionId:b,initialView:c}){let{t:d}=(0,g.Bd)(),[D,F]=(0,f.useState)(c??"agent"),{tabs:G,activeTabId:H,activeTab:I,unreadTabs:J,dragTabIndex:K,dragOverTabIndex:L,closeTab:M,closeAllTabs:N,switchTab:O,handleSelectSession:P,handleNewTab:Q,handleNewCodexTab:R,handleNewKimiTab:S,handleNewGlmTab:T,handleNewOllamaTab:U,handleNewDeepseekTab:V,handleOpenSession:W,updateTabState:X,updateTabEngine:Y,updateTabOllamaModel:Z,updateTabDeepseekModel:$,updateTabKimiModel:_,updateTabGlmModel:aa,updateTabClaudeModel:ab,updateTabClaudeEffort:ac,updateTabClaudeContextWindow:ad,updateTabClaudeFastMode:ae,updateTabClaudeThinking:af,updateTabCodexModel:ag,updateTabCodexReasoningEffort:ah,updateTabPlanMode:ai,updateTabNoHistory:aj,handleTabDragStart:ak,handleTabDragOver:al,handleTabDrop:am,handleTabDragEnd:an}=(0,r.useTabState)({initialCwd:a,initialSessionId:b,activeView:D}),{isPinned:ao,pinSession:ap,unpinSession:aq}=(0,w.P)(),{createTask:ar}=(0,x.nS)(),as=(0,f.useCallback)(a=>{let b=G.find(b=>b.id===a);return!!b?.sessionId&&ao(b.sessionId)},[G,ao]),at=(0,f.useCallback)(b=>{let c=G.find(a=>a.id===b);c?.sessionId&&(ao(c.sessionId)?aq(c.sessionId):ap(c.sessionId,c.cwd||a||"",c.title))},[G,ao,ap,aq,a]),[au,av]=(0,f.useState)(!1),[aw,ax]=(0,f.useState)(!1),[ay,az]=(0,f.useState)(!1),[aA,aB]=(0,f.useState)(null),[aC,aD]=(0,f.useState)(!1),[aE,aF]=(0,f.useState)("tree"),[aG,aH]=(0,f.useState)(0),[aI,aJ]=(0,f.useState)(null),[aK,aL]=(0,f.useState)(0),[aM,aN]=(0,f.useState)(null),[aO,aP]=(0,f.useState)(null),[aQ,aR]=(0,f.useState)(null),[aS,aT]=(0,f.useState)(),[aU,aV]=(0,f.useState)(!1);(0,f.useRef)(null);let aW=(0,f.useCallback)(b=>{F(b),a&&(B.t4.runFork((0,C.Yn)({cwd:a,settings:{activeView:b}}).pipe(y.orElse(()=>y.void))),B.t4.runFork(y.flatMap(z.d,c=>c.publish(A.n.ViewChange,{cwd:a,view:b}))))},[a]),aX=(0,f.useCallback)(async()=>{if(!a)return;let b=await B.t4.runPromiseExit((0,C.b2)(a));if("Success"===b._tag){let c=b.value;if(aD(!!c.isGitRepo),c.isGitRepo&&c.worktrees&&c.worktrees.length>0){let b=c.worktrees.find(b=>b.path===a);b&&aB(b.branch)}}else console.error("Failed to load git info:",b.cause)},[a]),aY=(0,f.useCallback)(a=>{let{data:b}=a;Array.isArray(b)&&b.some(a=>"git"===a.type)&&aX()},[aX]);(0,v.h)({url:`/ws/watch?cwd=${encodeURIComponent(a||"")}`,onMessage:aY,enabled:!!a});let aZ=(0,f.useCallback)(()=>{aF("status"),aH(a=>a+1),aW("explorer")},[aW]),a$=(0,f.useCallback)(a=>{aJ(a),aL(a=>a+1),aW("explorer")},[aW]),a_=(0,f.useCallback)(a=>{aP(null),a$(a)},[a$]),a0=(0,f.useCallback)(()=>aW("agent"),[aW]),a1=(0,f.useCallback)((a,b,c,d,e,f)=>{aP(g=>(0,o.y)(g,{messageId:a,toolCalls:b,cwd:c,sessionId:d,runId:e},!0===f)),f||aW("explorer")},[aW]),a2=(0,f.useCallback)(a=>{aP(null),aN({...a,nonce:Date.now()}),aW("explorer")},[aW]),a3=(0,f.useCallback)(()=>{a&&B.t4.runFork(y.flatMap(z.d,b=>b.publish(A.n.OpenNote,{cwd:a})))},[a]);return(0,e.jsx)(m.k_,{children:(0,e.jsx)(p.fY,{activeView:D,onViewChange:aW,children:(0,e.jsxs)("div",{className:"flex h-screen bg-card",children:[(0,e.jsxs)("div",{className:"flex-1 flex flex-col min-w-0",children:[(0,e.jsx)(s.TabManagerTopBar,{initialCwd:a,activeTab:I,isGitRepo:aC,currentBranch:aA,onOpenWorktree:()=>ax(!0),onOpenAliasManager:()=>az(!0),onBranchSwitched:aX}),aU&&(0,e.jsxs)("div",{className:"flex items-center justify-center gap-2 py-1 bg-brand/15 text-brand text-xs font-medium border-b border-brand/20",children:[(0,e.jsx)("span",{className:"animate-pulse",children:"●"}),d("console.screenshotting")]}),a?(0,e.jsxs)(p.c0,{children:[(0,e.jsx)("div",{className:"w-1/3 h-full flex flex-col overflow-hidden",children:(0,e.jsx)(q.a9,{children:(0,e.jsxs)("div",{className:"w-full h-full flex flex-col",children:[(0,e.jsx)(t.TabBar,{tabs:G,activeTabId:H,unreadTabs:J,dragTabIndex:K,dragOverTabIndex:L,isPinned:as,onTogglePin:at,onSwitchTab:O,onCloseTab:M,onCloseAllTabs:N,onNewTab:Q,onNewCodexTab:R,onNewKimiTab:S,onNewGlmTab:T,onNewOllamaTab:U,onNewDeepseekTab:V,onOpenProjectSessions:()=>av(!0),onDragStart:ak,onDragOver:al,onDrop:am,onDragEnd:an}),(0,e.jsx)("div",{className:"flex-1 overflow-hidden relative",children:G.map(a=>(0,e.jsx)("div",{className:`h-full ${a.id===H?"block":"hidden"}`,children:(0,e.jsx)(u.X,{tabId:a.id,cwd:a.cwd,sessionId:a.sessionId,engine:a.engine,onEngineChange:Y,ollamaModel:a.ollamaModel,onOllamaModelChange:Z,deepseekModel:a.deepseekModel,onDeepseekModelChange:$,kimiModel:a.kimiModel,onKimiModelChange:_,glmModel:a.glmModel,onGlmModelChange:aa,claudeModel:a.claudeModel,onClaudeModelChange:ab,claudeEffort:a.claudeEffort,onClaudeEffortChange:ac,claudeContextWindow:a.claudeContextWindow,onClaudeContextWindowChange:ad,claudeFastMode:a.claudeFastMode,onClaudeFastModeChange:ae,claudeThinking:a.claudeThinking,onClaudeThinkingChange:af,codexModel:a.codexModel,onCodexModelChange:ag,codexReasoningEffort:a.codexReasoningEffort,onCodexReasoningEffortChange:ah,planMode:a.planMode,onPlanModeChange:ai,noHistory:a.noHistory,onNoHistoryChange:aj,isActive:a.id===H&&"agent"===D,refreshSignal:aQ,onStateChange:X,onShowGitStatus:aZ,onContentSearch:a$,onShowFileDiff:a1,onOpenFileLink:a2,onOpenNote:a3,onCreateScheduledTask:ar,onOpenSession:W})},a.id))})]})})}),(0,e.jsx)("div",{className:"w-1/3 h-full overflow-hidden relative",children:(0,e.jsxs)(q.a9,{children:[(0,e.jsx)(i.g,{onClose:a0,cwd:a,initialTab:aE,tabSwitchTrigger:aG,initialSearchQuery:aI,searchQueryTrigger:aK,fileOpenRequest:aM}),aO&&(0,e.jsx)("div",{className:"absolute inset-0 z-20 flex bg-scrim p-[4vmin]",onClick:()=>aP(null),children:(0,e.jsx)(n.e$,{toolCalls:aO.toolCalls,cwd:aO.cwd,sessionId:aO.sessionId,runId:aO.runId,onClose:()=>aP(null),onContentSearch:a_},aO.messageId)})]})}),(0,e.jsx)("div",{className:"w-1/3 h-full overflow-hidden",children:(0,e.jsx)(q.a9,{children:(0,e.jsx)(k.J,{cwd:a,tabId:"default",onOpenNote:a3})})})]}):(0,e.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,e.jsx)(t.TabBar,{tabs:G,activeTabId:H,unreadTabs:J,dragTabIndex:K,dragOverTabIndex:L,isPinned:as,onTogglePin:at,onSwitchTab:O,onCloseTab:M,onCloseAllTabs:N,onNewTab:Q,onNewCodexTab:R,onNewKimiTab:S,onNewGlmTab:T,onNewDeepseekTab:V,onDragStart:ak,onDragOver:al,onDrop:am,onDragEnd:an}),(0,e.jsx)("div",{className:"flex-1 overflow-hidden relative",children:G.map(a=>(0,e.jsx)("div",{className:`h-full ${a.id===H?"block":"hidden"}`,children:(0,e.jsx)(u.X,{tabId:a.id,cwd:a.cwd,sessionId:a.sessionId,engine:a.engine,onEngineChange:Y,ollamaModel:a.ollamaModel,onOllamaModelChange:Z,deepseekModel:a.deepseekModel,onDeepseekModelChange:$,kimiModel:a.kimiModel,onKimiModelChange:_,glmModel:a.glmModel,onGlmModelChange:aa,claudeModel:a.claudeModel,onClaudeModelChange:ab,claudeEffort:a.claudeEffort,onClaudeEffortChange:ac,claudeContextWindow:a.claudeContextWindow,onClaudeContextWindowChange:ad,claudeFastMode:a.claudeFastMode,onClaudeFastModeChange:ae,claudeThinking:a.claudeThinking,onClaudeThinkingChange:af,codexModel:a.codexModel,onCodexModelChange:ag,codexReasoningEffort:a.codexReasoningEffort,onCodexReasoningEffortChange:ah,planMode:a.planMode,onPlanModeChange:ai,noHistory:a.noHistory,onNoHistoryChange:aj,isActive:a.id===H,refreshSignal:aQ,onStateChange:X,onCreateScheduledTask:ar,onOpenSession:W})},a.id))})]})]}),a&&(0,e.jsx)(h.Q,{isOpen:au,onClose:()=>av(!1),cwd:a,onSelectSession:P,projectNumber:aS,openSessionIds:G.map(a=>a.sessionId)}),a&&aC&&(0,e.jsx)(j.x,{isOpen:aw,onClose:()=>ax(!1),cwd:a}),ay&&(0,e.jsx)(l.Y,{onClose:()=>az(!1),onSave:()=>az(!1)})]})})})}[s,t,u,i,n]=D.then?(await D)():D,d()}catch(a){d(a)}})},79327:(a,b,c)=>{"use strict";function d(a,b,c){return c?a?.messageId!==b.messageId?a:{...a,toolCalls:b.toolCalls}:b}c.d(b,{y:()=>d})},80118:(a,b,c)=>{"use strict";c.d(b,{R:()=>j});var d=c(66142),e=c(10259),f=c(37361);let g=new e.hs("headingFold");function h(a){let b=a.attrs.foldState;return"folded"===b||"children"===b?b:"expanded"}function i(a){let b=[],c=[];return a.forEach((a,d)=>{let e=d+a.nodeSize;if("heading"===a.type.name){let g=a.attrs.level;for(;c.length&&c[c.length-1].level>=g;)c.pop();let i=h(a),j=c.some(a=>"folded"===a.state),k=["note-heading"];"expanded"!==i&&k.push("is-collapsed"),j&&k.push("note-folded-hidden"),b.push(f.NZ.node(d,e,{class:k.join(" ")})),b.push(f.NZ.widget(d+1,(a,b)=>{let c;return(c=document.createElement("span")).className="note-fold-toggle",c.contentEditable="false",c.setAttribute("data-fold-state",i),c.addEventListener("mousedown",c=>{c.preventDefault(),c.stopPropagation();let d=b();if(null==d)return;let e=d-1,f=a.state.doc.nodeAt(e);f&&"heading"===f.type.name&&a.dispatch(a.state.tr.setNodeMarkup(e,void 0,{...f.attrs,foldState:"expanded"===h(f)?"folded":"expanded"}))}),c},{side:-1,key:`fold-${d}-${i}`})),c.push({level:g,state:i})}else c.some(a=>"folded"===a.state||"children"===a.state)&&b.push(f.NZ.node(d,e,{class:"note-folded-hidden"}))}),f.zF.create(a,b)}let j=d.A.extend({addAttributes(){return{...this.parent?.(),foldState:{default:"expanded",keepOnSplit:!1,parseHTML:a=>"true"===a.getAttribute("data-collapsed")?"folded":"expanded",renderHTML:a=>a.foldState&&"expanded"!==a.foldState?{"data-collapsed":"true"}:{}}}},addKeyboardShortcuts(){let a=this.name;return{Tab:()=>{var b;let c,d,e,{state:f}=this.editor,{$from:g}=f.selection;if(g.parent.type.name!==a)return!1;let i=g.before(g.depth),j=f.doc.nodeAt(i);if(!j||j.type.name!==a)return!1;let k=j.attrs.level,l=(b=f.doc,d=[],e=!1,b.forEach((b,c)=>{if(c===i){e=!0;return}if(e&&b.type.name===a){if(b.attrs.level<=k){e=!1;return}d.push(c)}}),d),m=l.length>0,n=h(j),o=null;return m?"expanded"===n?c="folded":(c="folded"===n?"children":"expanded",o="expanded"):c="expanded"===n?"folded":"expanded",this.editor.chain().command(({tr:b})=>{if(b.setNodeMarkup(i,void 0,{...j.attrs,foldState:c}),o)for(let c of l){let d=b.doc.nodeAt(c);d&&d.type.name===a&&b.setNodeMarkup(c,void 0,{...d.attrs,foldState:o})}return!0}).run()}}},addStorage:()=>({markdown:{serialize(a,b){a.write(a.repeat("#",b.attrs.level)+" "),a.renderInline(b,!1),"expanded"!==h(b)&&a.write(" \x3c!-- fold --\x3e"),a.closeBlock(b)},parse:{updateDOM(a){a.querySelectorAll("h1,h2,h3,h4,h5,h6").forEach(a=>{let b=a.lastChild;for(;b&&3===b.nodeType&&!(b.textContent||"").trim();){let c=b.previousSibling;a.removeChild(b),b=c}if(b&&8===b.nodeType&&/^\s*fold\s*$/.test(b.textContent||"")){let c=b.previousSibling;a.removeChild(b),c&&3===c.nodeType&&(c.textContent=(c.textContent||"").replace(/\s+$/,"")),a.setAttribute("data-collapsed","true")}})}}}}),addProseMirrorPlugins:()=>[new e.k_({key:g,state:{init:(a,{doc:b})=>i(b),apply:(a,b)=>a.docChanged?i(a.doc):b},props:{decorations:a=>g.getState(a)}})]})},80983:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{K:()=>n});var e=c(48249),f=c(67484),g=c(44384),h=c(7833),i=c(23700),j=c(92701),k=c(61349),l=a([k,i,j]);[k,i,j]=l.then?(await l)():l;let o={Read:"\uD83D\uDCC4",Write:"✏️",Edit:"\uD83D\uDCDD",ApplyPatch:"\uD83E\uDDE9",Bash:"\uD83D\uDCBB",Glob:"\uD83D\uDD0D",Grep:"\uD83D\uDD0E",WebFetch:"\uD83C\uDF10",WebSearch:"\uD83D\uDD0D",Workflow:"\uD83E\uDDE9",Skill:"\uD83D\uDEE0️"};function m(a){return"object"==typeof a&&null!==a}function n({toolCall:a,cwd:b,sessionId:c,disableOverlays:d=!1}){var l;let{t:p}=(0,g.Bd)(),[q,r]=(0,f.useState)(!1),[s,t]=(0,f.useState)(null),[u,v]=(0,f.useState)(!1),[w,x]=(0,f.useState)(!1),y=o[a.name]||"\uD83D\uDD27",z="Agent"===a.name||"Task"===a.name,A=z&&!!b&&!!c,B="Workflow"===a.name,C=B&&(l=a.result)?l.match(/subagents\/workflows\/(wf_[A-Za-z0-9_-]+)/)?.[1]??null:null,D=B&&!!C&&!!b&&!!c,E="Skill"===a.name,F="ApplyPatch"===a.name||z||B||E,G=a=>{if(b&&a.startsWith(b)){let c=a.slice(b.length);return c.startsWith("/")?c.slice(1):c}let c=a.split("/");return c.length>2?".../"+c.slice(-2).join("/"):a},H=(()=>{let b=a.input;if("Bash"===a.name&&b.command&&"string"==typeof b.command)return b.command;if("ApplyPatch"===a.name&&Array.isArray(b.changes)){let a=b.changes.filter(m).flatMap(a=>{let b="string"==typeof a.path?a.path:"";if(!b)return[];let c="string"==typeof a.kind&&a.kind?a.kind:"update";return`${c} ${G(b)}`});if(a.length>0)return a.join(" \xb7 ")}if(z&&b.description&&"string"==typeof b.description)return b.description;if(B){let a="string"==typeof b.name?b.name:"",c="string"==typeof b.args?b.args:"string"==typeof b.resumeFromRunId?b.resumeFromRunId:"",d=[a,c].filter(Boolean).join(" \xb7 ");if(d)return d}if(E&&"string"==typeof b.skill){let a="string"==typeof b.args?b.args:"";return[b.skill,a].filter(Boolean).join(" \xb7 ")}return"Glob"===a.name&&b.pattern&&"string"==typeof b.pattern||"Grep"===a.name&&b.pattern&&"string"==typeof b.pattern?b.pattern:"ToolSearch"===a.name&&b.query&&"string"==typeof b.query?b.query:"TaskCreate"===a.name&&b.subject&&"string"==typeof b.subject?b.subject:b.file_path&&"string"==typeof b.file_path?b.file_path:b.path&&"string"==typeof b.path?b.path:null})(),I="Glob"===a.name||"Grep"===a.name||"Bash"===a.name||"ApplyPatch"===a.name||z||B||E,J=H?I?H:G(H):null,K=b=>{let c="input"===b?p("toolCall.inputParams"):p("toolCall.resultLabel"),d="input"===b?JSON.stringify(a.input,null,2):"string"==typeof a.result?a.result:JSON.stringify(a.result,null,2);t({title:`${a.name}${J?` ${J}`:""} - ${c}`,content:d,toolName:a.name})};return(0,e.jsxs)("div",{className:"border-b border-line-1 last:border-b-0",children:[(0,e.jsxs)("button",{onClick:()=>r(!q),className:"w-full px-3 py-1.5 flex items-center gap-2 text-left hover:bg-hover transition-colors",children:[(0,e.jsx)("span",{className:"text-sm",children:y}),(0,e.jsx)("span",{className:"font-medium text-sm text-foreground flex-shrink-0",children:a.name}),J&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground truncate flex-1 min-w-0","data-tooltip":H||"",children:J}),!F&&(0,e.jsx)("span",{role:"button",tabIndex:0,onClick:a=>{a.stopPropagation(),H&&(navigator.clipboard.writeText(H),(0,h.oR)(p("common.copiedPath")))},onKeyDown:a=>{("Enter"===a.key||" "===a.key)&&(a.stopPropagation(),H&&(navigator.clipboard.writeText(H),(0,h.oR)(p("common.copiedPath"))))},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-hover transition-colors flex-shrink-0 cursor-pointer",title:p("common.copyAbsPath"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]}),(0,e.jsxs)("span",{className:"ml-auto flex items-center gap-2",children:[A&&!d&&(0,e.jsx)("span",{role:"button",tabIndex:0,onClick:a=>{a.stopPropagation(),v(!0)},onKeyDown:a=>{("Enter"===a.key||" "===a.key)&&(a.stopPropagation(),v(!0))},className:"text-xs text-brand hover:text-teal-10 cursor-pointer",title:p("chat.subagentViewTitle"),children:p("chat.subagent")}),D&&!d&&(0,e.jsx)("span",{role:"button",tabIndex:0,onClick:a=>{a.stopPropagation(),x(!0)},onKeyDown:a=>{("Enter"===a.key||" "===a.key)&&(a.stopPropagation(),x(!0))},className:"text-xs text-brand hover:text-teal-10 cursor-pointer",title:p("chat.workflowViewTitle"),children:p("chat.workflowRun")}),q&&!a.isLoading&&!d&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{role:"button",tabIndex:0,onClick:a=>{a.stopPropagation(),K("input")},onKeyDown:a=>{("Enter"===a.key||" "===a.key)&&(a.stopPropagation(),K("input"))},className:"text-xs text-brand hover:text-teal-10 cursor-pointer",title:p("toolCall.inputParamsTitle"),children:p("toolCall.input")}),a.result&&(0,e.jsx)("span",{role:"button",tabIndex:0,onClick:a=>{a.stopPropagation(),K("result")},onKeyDown:a=>{("Enter"===a.key||" "===a.key)&&(a.stopPropagation(),K("result"))},className:"text-xs text-brand hover:text-teal-10 cursor-pointer",title:p("toolCall.resultTitle"),children:p("toolCall.result")})]}),a.isLoading?(0,e.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-brand border-t-transparent rounded-full animate-spin"}):(0,e.jsx)("span",{className:"text-foreground-subtle text-xs",children:q?"▲":"▼"})]})]}),q&&(0,e.jsxs)("div",{className:"border-t border-line-1",children:[(0,e.jsxs)("div",{className:"px-3 py-2",children:[(0,e.jsx)("div",{className:"mb-1",children:(0,e.jsxs)("span",{className:"text-xs text-muted-foreground",children:[p("toolCall.inputParams"),":"]})}),(0,e.jsx)("pre",{className:"text-xs bg-accent p-2 rounded overflow-x-auto max-h-24 overflow-y-auto text-foreground",children:JSON.stringify(a.input,null,2)})]}),a.result&&(0,e.jsxs)("div",{className:"px-3 py-2 border-t border-line-1",children:[(0,e.jsx)("div",{className:"mb-1",children:(0,e.jsxs)("span",{className:"text-xs text-muted-foreground",children:[p("toolCall.resultLabel"),":"]})}),(0,e.jsx)("pre",{className:"text-xs bg-accent p-2 rounded overflow-x-auto max-h-24 overflow-y-auto text-foreground",children:"string"==typeof a.result?a.result:JSON.stringify(a.result,null,2)})]}),a.skillContent&&(0,e.jsxs)("div",{className:"px-3 py-2 border-t border-line-1",children:[(0,e.jsx)("div",{className:"mb-1",children:(0,e.jsxs)("span",{className:"text-xs text-muted-foreground",children:[p("toolCall.skillContent",{defaultValue:"Skill content"}),":"]})}),(0,e.jsx)("pre",{className:"text-xs bg-accent p-2 rounded overflow-x-auto max-h-60 overflow-y-auto text-foreground whitespace-pre-wrap",children:a.skillContent})]})]}),s&&(0,e.jsx)(k.M,{title:s.title,content:s.content,toolName:s.toolName,onClose:()=>t(null)}),u&&b&&c&&(0,e.jsx)(i.f,{cwd:b,sessionId:c,toolCall:a,onClose:()=>v(!1)}),w&&b&&c&&C&&(0,e.jsx)(j.K,{cwd:b,sessionId:c,runId:C,isRunning:!!a.isLoading,onClose:()=>x(!1)})]})}d()}catch(a){d(a)}})},81064:(a,b,c)=>{Promise.resolve().then(c.bind(c,81227))},81206:(a,b,c)=>{"use strict";c.d(b,{z:()=>h,m:()=>j});var d=c(67484),e=c(79606),f=c(33281),g=c(71192);let h=a=>e.tryPromise({try:async()=>{let b=await fetch("/api/session-by-path",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});return b.ok?await b.json():null},catch:a=>new g.uV({message:"session-by-path failed",cause:a})}),i=new Map;function j(a,b,c,{cwd:k,initialSessionId:l,onSessionId:m,onTitleChange:n,onTokenUsage:o,liveRunningRef:p}){let[q,r]=(0,d.useState)(!1),[s,t]=(0,d.useState)(!1),[u,v]=(0,d.useState)(!1),[w,x]=(0,d.useState)(void 0),[y,z]=(0,d.useState)(0),[A,B]=(0,d.useState)(null),[C,D]=(0,d.useState)(null),E=(0,d.useRef)(n);E.current=n;let F=(0,d.useRef)(o);F.current=o;let G=(0,d.useRef)(void 0),H=(0,d.useRef)(0),I=(0,d.useCallback)(async(a,c,d=!1,e,g,j=!1)=>{if(d){let a=Date.now();if(!j&&a-H.current<5e3)return;H.current=a}let k=(a,d)=>{a.fingerprint&&(G.current=a.fingerprint),void 0!==a.totalTurns&&z(a.totalTurns),void 0!==a.hasMore&&v(a.hasMore),a.messages&&a.messages.length>0&&(d?b(b=>(function(a,b){if(0===b.length)return a;let c=0;if(a.length>0&&a[0].id!==b[0].id){c=-1;for(let d=a.length-1;d>=0;d--)if(a[d].id===b[0].id){c=d;break}}if(c<0)return b;let d=a.slice(c),e=0;for(let a=0;a<Math.min(d.length,b.length)&&d[a].id===b[a].id&&d[a].content===b[a].content;a++)e=a+1;return e===d.length&&e===b.length?a:e===d.length&&e<b.length?[...a,...b.slice(e)]:[...a.slice(0,c),...d.slice(0,e),...b.slice(e)]})(b,a.messages)):p?.current||b(a.messages),B(c)),a.sessionId&&m(a.sessionId),a.engine&&D(a.engine),a.title&&E.current?.(a.title),a.usage&&F.current?.({inputTokens:a.usage.input_tokens||0,outputTokens:a.usage.output_tokens||0,cacheCreationInputTokens:a.usage.cache_creation_input_tokens||0,cacheReadInputTokens:a.usage.cache_read_input_tokens||0,totalCostUsd:0})},l=`${a}::${c}`,n=!d&&void 0===g,o=n?i.get(l):void 0;d||(o?k(o.data,!1):r(!0));try{let b={cwd:a,sessionId:c,limit:e,beforeTurnIndex:g};d&&G.current?b.ifFingerprint=G.current:o&&(b.ifFingerprint=o.fingerprint);let j=await f.t4.runPromiseExit(h(b));if("Success"===j._tag&&j.value){let a=j.value;if(a.notModified)return;if(k(a,d),n&&a.fingerprint&&a.messages&&a.messages.length>0&&(i.delete(l),i.set(l,{data:a,fingerprint:a.fingerprint}),i.size>20)){let a=i.keys().next().value;void 0!==a&&i.delete(a)}}}catch(a){console.error("Failed to load history by cwd and sessionId:",a)}finally{d||r(!1)}},[b,m]),J=(0,d.useCallback)(async()=>{if(k&&c&&!s&&u){t(!0);try{let d=void 0!==w?w:y-Math.ceil(a.filter(a=>"user"===a.role).length),e=await f.t4.runPromiseExit(h({cwd:k,sessionId:c,limit:10,beforeTurnIndex:d>0?d:void 0}));if("Success"===e._tag&&e.value){let a=e.value;if(a.messages&&a.messages.length>0){b(b=>[...a.messages,...b]);let e=a.messages.filter(a=>"user"===a.role).length;x(d-e),B(c)}void 0!==a.hasMore&&v(a.hasMore),a.fingerprint&&(G.current=a.fingerprint)}else"Failure"===e._tag&&console.error("Failed to load more history:",e.cause)}finally{t(!1)}}},[k,c,s,u,w,y,a,b]);return{isLoadingHistory:q,isLoadingMore:s,hasMoreHistory:u,loadMoreHistory:J,loadHistory:(0,d.useCallback)(async a=>{r(!0);let c=e.tryPromise({try:async()=>{let b=await fetch(`/api/session/${a}/history`);return b.ok?await b.json():null},catch:a=>new g.uV({message:"load session history failed",cause:a})}),d=await f.t4.runPromiseExit(c);"Success"===d._tag&&d.value?.messages&&d.value.messages.length>0?(b(d.value.messages),B(a)):"Failure"===d._tag&&console.error("Failed to load history:",d.cause),r(!1)},[b]),loadHistoryByCwdAndSessionId:I,loadedSessionId:A,loadedEngine:C}}},81227:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/cockpit/cockpit/src/app/global-error.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/src/app/global-error.tsx","default")},82795:(a,b,c)=>{"use strict";c.d(b,{e:()=>l});var d=c(48249),e=c(67484),f=c(44384),g=c(15819),h=c(33281),i=c(41224),j=c(32753),k=c(74228);function l({isOpen:a,onClose:b,onSwitchProject:c,sessionNumbers:m={}}){let{t:n}=(0,f.Bd)(),[o,p]=(0,e.useState)([]),[q,r]=(0,e.useState)(!1),[s,t]=(0,e.useState)(null),[u,v]=(0,e.useState)(""),w=(0,e.useRef)(null);(0,e.useCallback)(async()=>{r(!0),t(null);let a=await h.t4.runPromiseExit((0,i.z2)());"Success"===a._tag?p([...a.value]):t(n("sessions.loadSessionsFailed")),r(!1)},[n]);let x=o.filter(a=>{if(!u)return!0;let b=u.toLowerCase();return void 0!==a.searchText?a.searchText.includes(b):a.cwd.toLowerCase().includes(b)||(a.title?.toLowerCase().includes(b)??!1)||(a.lastUserMessage?.toLowerCase().includes(b)??!1)||(a.firstMessages?.some(a=>a.toLowerCase().includes(b))??!1)||(a.lastMessages?.some(a=>a.toLowerCase().includes(b))??!1)});return a?(0,d.jsxs)("div",{className:"fixed inset-0 z-[70] flex items-center justify-center",children:[(0,d.jsx)("div",{className:"absolute inset-0 bg-scrim",onClick:b}),(0,d.jsxs)("div",{className:g.aO,children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,d.jsx)("div",{className:"flex-1 min-w-0",children:(0,d.jsx)("h2",{className:"text-sm font-medium text-foreground",children:n("sessions.recentSessions")})}),(0,d.jsxs)("div",{className:"flex items-center gap-3 ml-4",children:[(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("input",{ref:w,type:"text",placeholder:n("sessions.searchSessions"),value:u,onChange:a=>v(a.target.value),className:"px-2 py-1 pr-6 text-xs border border-border rounded bg-card text-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent"}),u&&(0,d.jsx)("button",{onClick:()=>{v(""),w.current?.focus()},className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-foreground-subtle hover:text-foreground rounded-sm transition-colors",title:n("fileBrowser.clear"),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,d.jsx)("button",{onClick:b,className:"p-1 text-foreground-subtle hover:text-foreground hover:bg-hover rounded transition-colors",children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),(0,d.jsxs)("div",{className:"flex-1 overflow-y-auto p-4",children:[q&&(0,d.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,d.jsxs)("svg",{className:"animate-spin h-4 w-4",fill:"none",viewBox:"0 0 24 24",children:[(0,d.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,d.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),(0,d.jsx)("span",{children:n("sessions.loadingSessions")})]})}),s&&(0,d.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,d.jsx)("div",{className:"text-xs text-red-11",children:s})}),!q&&!s&&0===x.length&&(0,d.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,d.jsx)("div",{className:"text-xs text-muted-foreground",children:u?n("sessions.noMatchingSessions"):n("sessions.noSessions")})}),!q&&!s&&x.length>0&&(0,d.jsx)("div",{className:g.jL,children:x.map(a=>{let e;return(0,d.jsxs)("div",{onClick:()=>{c(a.cwd,a.sessionId),b()},className:"p-3 rounded border border-border hover:border-brand hover:shadow-lv2 cursor-pointer transition-all",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 mb-1",children:[(0,d.jsx)("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${"loading"===a.status?"bg-orange-9":"unread"===a.status?"bg-red-500":"bg-muted-foreground/30"}`}),(0,d.jsx)(j.S,{engine:a.engine}),(0,d.jsx)("h4",{className:"text-xs font-medium text-foreground truncate flex-1","data-tooltip":a.cwd,children:(e=a.cwd).split("/").pop()||e}),(0,d.jsx)(k.l,{coordinate:m[`${a.cwd}
753
754
  ${a.sessionId}`],status:(0,k.S)(a.status),statusLabel:"loading"===a.status?n("sessions.running"):"unread"===a.status?n("sessions.done"):void 0,className:"ml-auto"})]}),a.title&&(0,d.jsx)("div",{className:"text-xs font-medium text-foreground truncate mb-1","data-tooltip":a.title,children:a.title}),(0,d.jsx)("div",{className:"text-xs text-muted-foreground mb-2",children:new Date(a.lastActive).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}),(a.firstMessages?.length??0)>0||(a.lastMessages?.length??0)>0?(0,d.jsxs)("div",{className:"space-y-0.5 text-xs",children:[a.firstMessages?.map((a,b)=>(0,d.jsxs)("div",{className:"text-foreground truncate","data-tooltip":a,children:[(0,d.jsx)("span",{className:"text-foreground-subtle mr-1",children:"•"}),a]},`first-${b}`)),(a.lastMessages?.length??0)>0&&(0,d.jsx)("div",{className:"text-foreground-subtle text-center py-0.5",children:"\xb7\xb7\xb7"}),a.lastMessages?.map((a,b)=>(0,d.jsxs)("div",{className:"text-foreground truncate","data-tooltip":a,children:[(0,d.jsx)("span",{className:"text-foreground-subtle mr-1",children:"•"}),a]},`last-${b}`))]}):a.lastUserMessage?(0,d.jsxs)("div",{className:"text-xs text-foreground truncate","data-tooltip":a.lastUserMessage,children:[(0,d.jsx)("span",{className:"text-foreground-subtle mr-1",children:"•"}),a.lastUserMessage]}):null]},`${a.cwd}-${a.sessionId}`)})})]})]})]}):null}},83022:(a,b,c)=>{"use strict";c.d(b,{TabBar:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call TabBar() from the server but TabBar is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/TabBar.tsx","TabBar")},83120:(a,b,c)=>{"use strict";c.d(b,{BL:()=>q,Gm:()=>n,JK:()=>l,Wr:()=>o,Y8:()=>t,Y_:()=>k,_c:()=>r,bx:()=>m,dU:()=>s,i7:()=>x,jw:()=>u,mu:()=>v,vy:()=>w,z1:()=>p});var d=c(79606),e=c(71192);let f=(a,b)=>d.tryPromise({try:async()=>{let c=await fetch(a,b);if(!c.ok)throw Error(`HTTP ${c.status}`);return await c.json()},catch:c=>new e.uV({message:`${b?.method??"GET"} ${a} failed`,cause:c})}),g=(a,b)=>f(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),h=(a,b)=>f(a,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),i=(a,b)=>f(a,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),j=a=>f(a,{method:"DELETE"}),k=()=>f("/api/review"),l=a=>{let b;return b=`/api/review/${encodeURIComponent(a)}`,d.tryPromise({try:async()=>{let a=await fetch(b);if(404===a.status)throw Object.assign(Error("not found"),{__404__:!0});if(!a.ok)throw Error(`HTTP ${a.status}`);return await a.json()},catch:a=>a?.__404__?new e.m_({resource:"review",id:b}):new e.uV({message:`GET ${b} failed`,cause:a})})},m=a=>g("/api/review",a),n=(a,b)=>i(`/api/review/${encodeURIComponent(a)}`,b),o=a=>j(`/api/review/${encodeURIComponent(a)}`),p=a=>i("/api/review/order",{order:a}),q=()=>f("/api/review/users"),r=()=>f("/api/review/share-info"),s=(a,b)=>g(`/api/review/${encodeURIComponent(a)}/comments`,b),t=(a,b)=>h(`/api/review/${encodeURIComponent(a)}/comments`,b),u=(a,b)=>j(`/api/review/${encodeURIComponent(a)}/comments?commentId=${encodeURIComponent(b)}`),v=(a,b)=>g(`/api/review/${encodeURIComponent(a)}/replies`,b),w=(a,b)=>h(`/api/review/${encodeURIComponent(a)}/replies`,b),x=(a,b,c)=>j(`/api/review/${encodeURIComponent(a)}/replies?commentId=${encodeURIComponent(b)}&replyId=${encodeURIComponent(c)}`)},83179:(a,b,c)=>{"use strict";c.d(b,{NoteToolbar:()=>h});var d=c(48249),e=c(67484),f=c(44384);function g({editor:a,onClose:b,position:c}){let{t:h}=(0,f.Bd)(),[i,j]=(0,e.useState)(()=>a.getAttributes("link").href||""),k=(0,e.useRef)(null),l=()=>{let c=i.trim();if(c){let b=c.match(/^https?:\/\//)?c:`https://${c}`;a.chain().focus().extendMarkRange("link").setLink({href:b}).run()}else a.chain().focus().extendMarkRange("link").unsetLink().run();b()},m=c?{top:c.top,left:c.left}:{};return(0,d.jsxs)("div",{className:`${c?"fixed":"absolute top-full left-0 mt-1"} z-[60] bg-popover border border-border rounded-lg shadow-lv2 p-2 flex items-center gap-2`,style:m,children:[(0,d.jsx)("input",{ref:k,type:"text",value:i,onChange:a=>j(a.target.value),onKeyDown:a=>{"Enter"===a.key?(a.preventDefault(),l()):"Escape"===a.key&&(a.preventDefault(),b())},placeholder:h("editor.linkPlaceholder"),className:"bg-background border border-border rounded px-2 py-1 text-sm w-64 outline-none focus:border-brand"}),(0,d.jsx)("button",{onClick:l,className:"p-1 rounded text-sm font-medium text-brand hover:bg-brand/10 transition-colors",title:h("editor.confirmLink"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"})})}),a.isActive("link")&&(0,d.jsx)("button",{onClick:()=>{a.chain().focus().extendMarkRange("link").unsetLink().run(),b()},className:"p-1 rounded text-sm font-medium text-red-11 hover:bg-red-500/10 transition-colors",title:h("editor.removeLink"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"})})})]})}function h({editor:a}){let{t:b}=(0,f.Bd)(),[c,i]=(0,e.useState)(!1),j=(0,e.useRef)(null),[,k]=(0,e.useState)(0);if(!a)return null;let l=a=>`p-1.5 rounded text-xs font-medium transition-colors ${a?"bg-brand/15 text-brand":"text-muted-foreground hover:text-foreground hover:bg-hover"}`,m="w-px h-5 bg-border mx-0.5",n=a.isActive("table");return(0,d.jsxs)("div",{className:"flex items-center gap-0.5 px-4 py-1.5 border-b border-border flex-shrink-0 flex-wrap",children:[(0,d.jsx)("button",{className:l(a.isActive("heading",{level:1})),onClick:()=>a.chain().focus().toggleHeading({level:1}).run(),title:b("editor.heading1"),children:"H1"}),(0,d.jsx)("button",{className:l(a.isActive("heading",{level:2})),onClick:()=>a.chain().focus().toggleHeading({level:2}).run(),title:b("editor.heading2"),children:"H2"}),(0,d.jsx)("button",{className:l(a.isActive("heading",{level:3})),onClick:()=>a.chain().focus().toggleHeading({level:3}).run(),title:b("editor.heading3"),children:"H3"}),(0,d.jsx)("div",{className:m}),(0,d.jsx)("button",{className:l(a.isActive("bold")),onClick:()=>a.chain().focus().toggleBold().run(),title:b("editor.bold"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H7v14h7.04c2.09 0 3.71-1.7 3.71-3.79 0-1.52-.86-2.82-2.15-3.42zM10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3v-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z"})})}),(0,d.jsx)("button",{className:l(a.isActive("italic")),onClick:()=>a.chain().focus().toggleItalic().run(),title:b("editor.italic"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4z"})})}),(0,d.jsx)("button",{className:l(a.isActive("strike")),onClick:()=>a.chain().focus().toggleStrike().run(),title:b("editor.strikethrough"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M10 19h4v-3h-4v3zM5 4v3h5v3h4V7h5V4H5zM3 14h18v-2H3v2z"})})}),(0,d.jsx)("button",{className:l(a.isActive("code")),onClick:()=>a.chain().focus().toggleCode().run(),title:b("editor.inlineCode"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"})})}),(0,d.jsx)("div",{className:m}),(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("button",{ref:j,className:l(a.isActive("link")),onClick:()=>i(!c),title:b("editor.link"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"})})}),c&&(0,d.jsx)(g,{editor:a,onClose:()=>i(!1),position:null})]}),(0,d.jsx)("div",{className:m}),(0,d.jsx)("button",{className:l(a.isActive("bulletList")),onClick:()=>a.chain().focus().toggleBulletList().run(),title:b("editor.bulletList"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM7 19h14v-2H7v2zm0-6h14v-2H7v2zm0-8v2h14V5H7z"})})}),(0,d.jsx)("button",{className:l(a.isActive("orderedList")),onClick:()=>a.chain().focus().toggleOrderedList().run(),title:b("editor.orderedList"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z"})})}),(0,d.jsx)("button",{className:l(a.isActive("taskList")),onClick:()=>a.chain().focus().toggleTaskList().run(),title:b("editor.taskList"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14zM17.99 9l-1.41-1.42-6.59 6.59-2.58-2.57-1.42 1.41 4 3.99z"})})}),(0,d.jsx)("div",{className:m}),(0,d.jsx)("button",{className:l(a.isActive("blockquote")),onClick:()=>a.chain().focus().toggleBlockquote().run(),title:b("editor.blockquote"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z"})})}),(0,d.jsx)("button",{className:l(a.isActive("codeBlock")),onClick:()=>a.chain().focus().toggleCodeBlock().run(),title:b("editor.codeBlock"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M20 3H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H4V5h16v14zm-7.5-4.5L15 12l-2.5-2.5L11 11l1.5 1.5L11 14l1.5 1.5zM9.5 14.5L7 12l2.5-2.5L11 11 9.5 12.5 11 14l-1.5.5z"})})}),(0,d.jsx)("button",{className:l(!1),onClick:()=>a.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),title:b("editor.table"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-9 15H4v-4h7v4zm0-6H4V7h7v4zm9 6h-7v-4h7v4zm0-6h-7V7h7v4z"})})}),(0,d.jsx)("button",{className:l(!1),onClick:()=>a.chain().focus().setHorizontalRule().run(),title:b("editor.horizontalRule"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M4 11h16v2H4z"})})}),n&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:m}),(0,d.jsx)("button",{className:l(!1),onClick:()=>a.chain().focus().addRowBefore().run(),title:b("editor.insertRowAbove"),children:(0,d.jsxs)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,d.jsx)("path",{d:"M20 4H4c-1.1 0-2 .9-2 2v2h20V6c0-1.1-.9-2-2-2zm0 6H2v10c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V10zM11 17H4v-2h7v2zm0-4H4v-2h7v2zm9 4h-7v-2h7v2zm0-4h-7v-2h7v2z"}),(0,d.jsx)("path",{d:"M14 1h-4v2H8v2h2v2h4V5h2V3h-2z",opacity:".6"})]})}),(0,d.jsx)("button",{className:l(!1),onClick:()=>a.chain().focus().addRowAfter().run(),title:b("editor.insertRowBelow"),children:(0,d.jsxs)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,d.jsx)("path",{d:"M20 4H4c-1.1 0-2 .9-2 2v10h20V6c0-1.1-.9-2-2-2zM11 12H4v-2h7v2zm0-4H4V6h7v2zm9 4h-7v-2h7v2zm0-4h-7V6h7v2z"}),(0,d.jsx)("path",{d:"M14 19h-4v2H8v2h2v-2h4v2h2v-2h-2z",opacity:".6"})]})}),(0,d.jsx)("button",{className:l(!1),onClick:()=>a.chain().focus().addColumnBefore().run(),title:b("editor.insertColumnLeft"),children:(0,d.jsxs)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,d.jsx)("path",{d:"M6 4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h2V4H6zm4 0v20h10c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2H10zm7 11H10v-2h7v2zm0-4H10V9h7v2z"}),(0,d.jsx)("path",{d:"M1 14v-4h2V8h2v2h-2v4h2v2H3v-2z",opacity:".6"})]})}),(0,d.jsx)("button",{className:l(!1),onClick:()=>a.chain().focus().addColumnAfter().run(),title:b("editor.insertColumnRight"),children:(0,d.jsxs)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,d.jsx)("path",{d:"M4 4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h10V4H4zm7 11H4v-2h7v2zm0-4H4V9h7v2z"}),(0,d.jsx)("path",{d:"M18 4v20h2c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-2z"}),(0,d.jsx)("path",{d:"M21 14v-4h2V8h2v2h-2v4h2v2h-2v-2z",opacity:".6"})]})}),(0,d.jsx)("div",{className:m}),(0,d.jsx)("button",{className:"p-1.5 rounded text-xs font-medium transition-colors text-orange-11 hover:bg-orange-500/10",onClick:()=>a.chain().focus().deleteRow().run(),title:b("editor.deleteRow"),children:(0,d.jsxs)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,d.jsx)("path",{d:"M20 4H4c-1.1 0-2 .9-2 2v2h20V6c0-1.1-.9-2-2-2zm0 6H2v10c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V10zm-8 8H4v-2h8v2z"}),(0,d.jsx)("path",{d:"M15 13l-1.41 1.41L15.17 16l-1.58 1.59L15 19l1.59-1.59L18.17 19l1.42-1.41L18 16l1.59-1.59L18.17 13 16.59 14.41z",fill:"currentColor"})]})}),(0,d.jsx)("button",{className:"p-1.5 rounded text-xs font-medium transition-colors text-orange-11 hover:bg-orange-500/10",onClick:()=>a.chain().focus().deleteColumn().run(),title:b("editor.deleteColumn"),children:(0,d.jsxs)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,d.jsx)("path",{d:"M6 4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h2V4H6zm4 0v20h10c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2H10zm7 7H10V9h7v2z"}),(0,d.jsx)("path",{d:"M13 16l-1.41 1.41L13.17 19l-1.58 1.59L13 22l1.59-1.59L16.17 22l1.42-1.41L16 19l1.59-1.59L16.17 16l-1.58 1.41z",fill:"currentColor"})]})}),(0,d.jsx)("button",{className:"p-1.5 rounded text-xs font-medium transition-colors text-red-11 hover:bg-red-500/10",onClick:()=>a.chain().focus().deleteTable().run(),title:b("editor.deleteTable"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"})})})]}),a.isActive("codeBlock")&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:m}),(0,d.jsx)("button",{className:"p-1.5 rounded text-xs font-medium transition-colors text-red-11 hover:bg-red-500/10",onClick:()=>a.chain().focus().toggleCodeBlock().run(),title:b("editor.deleteCodeBlock"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"})})})]})]})}},83377:(a,b,c)=>{"use strict";c.d(b,{A:()=>e});var d=c(67484);function e({lines:a,enabled:b,onContentChange:c,onEnterInsert:f,onSave:g,getVisibleLineCount:h,scrollToLine:i,onSearchExecute:j,onSearchNext:k,onSearchPrev:l,onSearchClear:m}){let[n,o]=(0,d.useState)("normal"),[p,q]=(0,d.useState)(-1),[r,s]=(0,d.useState)(0),[t,u]=(0,d.useState)(!1),[v,w]=(0,d.useState)(""),[x,y]=(0,d.useState)(""),[z,A]=(0,d.useState)(""),[B,C]=(0,d.useState)(""),D=(0,d.useRef)([]),E=(0,d.useRef)([]),F=(0,d.useRef)([]),G=(0,d.useRef)(null),H=(0,d.useRef)(a),I=(0,d.useCallback)((a,b)=>Math.max(0,Math.min(b,Math.max(0,(H.current[a]??"").length-1))),[]);(0,d.useRef)(a.length);let J=(0,d.useCallback)(()=>{G.current&&(clearTimeout(G.current),G.current=null),w("")},[]),K=(0,d.useCallback)(()=>{G.current&&clearTimeout(G.current),G.current=setTimeout(()=>{w(""),G.current=null},500)},[]),L=(0,d.useCallback)((a,b)=>{D.current.push(b),E.current=[],u(!0),c(a.join("\n"))},[c]),M=(0,d.useCallback)((a,b)=>{let c=Math.max(0,Math.min(a,H.current.length-1));q(c),s(I(c,b??0)),i(c,"auto")},[i,I]),N=(0,d.useCallback)(a=>{q(b=>{let c=Math.max(0,Math.min(b+a,H.current.length-1));return i(c,"auto"),s(a=>Math.max(0,Math.min(a,Math.max(0,(H.current[c]??"").length-1)))),c})},[i]),O=(0,d.useCallback)(()=>{let a=H.current,b=Math.min(p,a.length-1);if(0===a.length)return;let c=a[b];F.current=[c];let d=[...a];d.splice(b,1),0===d.length&&d.push("");let e=Math.min(b,d.length-1);L(d,{lineIndex:b,oldLines:[c],newLines:[],cursorLine:b}),q(e),s(0)},[p,L]),P=(0,d.useCallback)(()=>{let a=H.current,b=Math.min(p,a.length-1);a.length>0&&(F.current=[a[b]])},[p]),Q=(0,d.useCallback)(()=>{let a=F.current;if(0===a.length)return;let b=H.current,c=Math.min(p,b.length-1)+1,d=[...b];d.splice(c,0,...a),L(d,{lineIndex:c,oldLines:[],newLines:[...a],cursorLine:p}),q(c),s(0),i(c,"auto")},[p,L,i]),R=(0,d.useCallback)(()=>{let a=H.current,b=Math.min(p,a.length-1),c=a[b];if(!c||0===c.length)return;let d=c.substring(1),e=[...a];e[b]=d,L(e,{lineIndex:b,oldLines:[c],newLines:[d],cursorLine:p})},[p,L]),S=(0,d.useCallback)(()=>{let a=D.current;if(0===a.length)return;let b=a.pop(),d=[...H.current];0===b.newLines.length&&b.oldLines.length>0?d.splice(b.lineIndex,0,...b.oldLines):0===b.oldLines.length&&b.newLines.length>0?(d.splice(b.lineIndex,b.newLines.length),0===d.length&&d.push("")):d.splice(b.lineIndex,b.newLines.length,...b.oldLines),E.current.push(b),c(d.join("\n")),q(Math.min(b.cursorLine,d.length-1)),i(Math.min(b.cursorLine,d.length-1),"auto"),0===a.length&&u(!1)},[c,i]),T=(0,d.useCallback)(()=>{let a=E.current;if(0===a.length)return;let b=a.pop(),d=[...H.current];0===b.newLines.length&&b.oldLines.length>0?(d.splice(b.lineIndex,b.oldLines.length),0===d.length&&d.push("")):0===b.oldLines.length&&b.newLines.length>0?d.splice(b.lineIndex,0,...b.newLines):d.splice(b.lineIndex,b.oldLines.length,...b.newLines),D.current.push(b),u(!0),c(d.join("\n"));let e=b.lineIndex+Math.max(0,b.newLines.length-1);q(Math.min(e,d.length-1)),i(Math.min(e,d.length-1),"auto")},[c,i]),U=(0,d.useCallback)(a=>{let b=H.current,c=Math.min(p,b.length-1);if("o"===a||"O"===a){let d="o"===a?c+1:c,e=[...b];e.splice(d,0,""),L(e,{lineIndex:d,oldLines:[],newLines:[""],cursorLine:p}),c=d,q(d)}o("insert"),f(c,r,a)},[p,r,L,f]),V=(0,d.useCallback)(()=>{o("normal"),J()},[J]),W=(0,d.useCallback)(()=>{o("command"),y("")},[]),X=(0,d.useCallback)(()=>{o("normal"),y("")},[]),Y=(0,d.useCallback)(()=>{o("search"),A("")},[]),Z=(0,d.useCallback)(()=>{o("normal"),A("")},[]),$=(0,d.useCallback)(a=>{let b=a.trim();if("w"===b){g?.(),o("normal"),y("");return}if("q"===b){o("normal"),y("");return}if("wq"===b){g?.(),o("normal"),y("");return}if("noh"===b||"nohlsearch"===b){m?.(),o("normal"),y("");return}let c=parseInt(b,10);if(!isNaN(c)&&c>0){let a=Math.min(c-1,H.current.length-1);q(a),i(a,"center"),o("normal"),y("");return}o("normal"),y("")},[g,m,i]),_=(0,d.useCallback)(a=>{if(!a){o("normal"),A("");return}C(a),j?.(a),o("normal"),A("")},[j]),aa=(0,d.useCallback)(a=>{if(!b)return!1;let c=a.ctrlKey&&"c"===a.key&&!a.metaKey&&!a.shiftKey;if("insert"===n)return("Escape"===a.key||!!c)&&(V(),!0);if("command"===n)return!a.isComposing&&("Escape"===a.key||c?X():"Enter"===a.key?$(x):"Backspace"===a.key?0===x.length?X():y(a=>a.slice(0,-1)):1!==a.key.length||a.metaKey||a.ctrlKey||y(b=>b+a.key),!0);if("search"===n)return!a.isComposing&&("Escape"===a.key||c?Z():"Enter"===a.key?_(z):"Backspace"===a.key?0===z.length?Z():A(a=>a.slice(0,-1)):1!==a.key.length||a.metaKey||a.ctrlKey||A(b=>b+a.key),!0);if(p<0&&(q(0),s(0)),a.metaKey)return!1;if(a.ctrlKey)return"d"===a.key?(N(Math.max(1,Math.floor(h()/2))),J(),!0):"u"===a.key?(N(-Math.max(1,Math.floor(h()/2))),J(),!0):"r"===a.key&&(T(),J(),!0);let d=a.key,e=v+d;if("g"===e)return w("g"),K(),!0;if("gg"===e)return M(0),J(),!0;if("d"===e)return w("d"),K(),!0;if("dd"===e)return O(),J(),!0;if("y"===e)return w("y"),K(),!0;if("yy"===e)return P(),J(),!0;if(v&&e!==d&&J(),"j"===d||"ArrowDown"===d)return N(1),!0;if("k"===d||"ArrowUp"===d)return N(-1),!0;if("h"===d||"ArrowLeft"===d)return s(a=>Math.max(0,a-1)),!0;if("l"===d||"ArrowRight"===d){let a=Math.max(0,(H.current[p]??"").length-1);return s(b=>Math.min(a,b+1)),!0}if("0"===d)return s(0),!0;if("$"===d)return s(Math.max(0,(H.current[p]??"").length-1)),!0;if("^"===d){let a=(H.current[p]??"").search(/\S/);return s(a>=0?a:0),!0}return"G"===d?(M(H.current.length-1),!0):"x"===d?(R(),!0):"p"===d?(Q(),!0):"u"===d?(S(),!0):"i"===d||"a"===d||"I"===d||"A"===d||"o"===d||"O"===d?(U(d),!0):"/"===d?(Y(),!0):"n"===d?(k?.(),!0):"N"===d?(l?.(),!0):":"===d?(W(),!0):"Escape"!==d&&1===d.length},[b,n,v,x,z,p,V,U,W,X,Y,Z,$,_,N,M,h,O,P,Q,R,S,T,J,K,k,l]);return{state:{mode:n,cursorLine:p,cursorCol:r,isDirty:t,keyBuffer:v,commandInput:x,searchInput:z,lastSearch:B},handleKeyDown:aa,enterNormal:V,enterInsert:U,setCursorLine:q,setCursorCol:s,setCommandInput:y,setSearchInput:A,setIsDirty:u,clearUndoHistory:(0,d.useCallback)(()=>{D.current=[],E.current=[]},[])}}},83721:(a,b,c)=>{"use strict";c.d(b,{O:()=>aa});var d=c(48249),e=c(67484),f=c(44384),g=c(10316),h=c(46674),i=c(80600),j=c(69924);c(33281),c(85655),c(87808);var k=c(33982),l=c(34622),m=c(34948),n=c(26875),o=c(87148),p=c(82633);function q({kind:a,qname:b,className:c}){let e=`${(function(a,b){if("__file__"===b||"__preamble__"===b||b&&b.startsWith("__heading_"))return"text-muted-foreground/60";switch(a){case"function":case"method":return"text-violet-11";case"class":return"text-amber-11";case"interface":return"text-blue-11";default:return"text-muted-foreground/60"}})(a,b)} ${c??""}`.trim();if("__file__"===b)return(0,d.jsx)(i.A,{className:e});if("__preamble__"===b)return(0,d.jsx)(k.A,{className:e});if(b&&b.startsWith("__heading_"))return(0,d.jsx)(l.A,{className:e});switch(a){case"function":case"method":return(0,d.jsx)(m.A,{className:e});case"class":return(0,d.jsx)(n.A,{className:e});case"interface":return(0,d.jsx)(o.A,{className:e});default:return(0,d.jsx)(p.A,{className:e})}}var r=c(85984),s=c(29939);function t({cwd:a}){let{t:b}=(0,f.Bd)(),[c,g]=(0,e.useState)(null),h=(0,e.useCallback)(b=>{b?.type==="graphProgress"&&b.data&&b.data.cwd===a&&g(b.data)},[a]);(0,s.h)({url:`/ws/watch?cwd=${encodeURIComponent(a)}`,onMessage:h});let i=(0,e.useRef)("");if(c?.currentFile&&(i.current=c.currentFile),!c)return(0,d.jsx)("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:b("blockViewer.fileMode.loading","Loading…")});let j=b(`blockViewer.buildProgress.${c.phase}`,u[c.phase]),k=Math.max(0,Math.min(100,Math.round(c.percent)));return(0,d.jsx)("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-8",children:(0,d.jsxs)("div",{className:"w-full max-w-md flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"flex items-baseline justify-between text-xs text-muted-foreground",children:[(0,d.jsx)("span",{children:j}),(0,d.jsx)("span",{className:"tabular-nums",children:"parsing"===c.phase&&c.filesTotal>0?`${c.filesDone} / ${c.filesTotal}`:`${k}%`})]}),(0,d.jsx)("div",{className:"h-1 w-full overflow-hidden rounded-full bg-muted",children:(0,d.jsx)("div",{className:"h-full rounded-full bg-primary transition-[width] duration-150 ease-linear",style:{width:`${k}%`}})}),(0,d.jsx)("div",{className:"h-4 truncate text-left font-mono text-[11px] leading-4 text-muted-foreground/70",dir:"rtl",title:"done"===c.phase?"":i.current,children:"done"===c.phase?"":i.current})]})})}let u={listing:"Listing files…",contexts:"Reading project config…",parsing:"Parsing files",resolving:"Resolving imports…",edges:"Building call graph…",done:"Finishing up…"};var v=c(7031),w=c(74754),x=c(91579),y=c(83768),z=c(36984),A=c(96286),B=c(72529);function C({entries:a,onSelect:b,onClear:c}){let{t:e}=(0,f.Bd)();return(0,d.jsxs)("div",{className:"flex-1 min-h-0 bg-card border-t border-border flex flex-col","data-testid":"function-history-drawer",children:[(0,d.jsxs)("div",{className:"flex-shrink-0 px-2 py-1.5 border-b border-border flex items-center justify-between gap-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground font-mono min-w-0",children:[(0,d.jsx)(A.A,{className:"w-3 h-3 flex-shrink-0"}),(0,d.jsx)("span",{className:"truncate",children:0===a.length?e("blockViewer.history.title"):`${e("blockViewer.history.title")} \xb7 ${a.length}/15`})]}),a.length>0&&(0,d.jsx)(B.m,{content:e("blockViewer.history.clear"),children:(0,d.jsx)("button",{onClick:c,className:"flex-shrink-0 text-muted-foreground hover:text-foreground p-0.5 rounded hover:bg-secondary",children:(0,d.jsx)(h.A,{className:"w-3 h-3"})})})]}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto",children:0===a.length?(0,d.jsx)("div",{className:"px-3 py-4 text-[10px] text-muted-foreground/60 italic leading-relaxed",children:e("blockViewer.history.empty")}):a.map((a,c)=>{var e;let f;return(0,d.jsx)(B.m,{content:`${a.qname} \xb7 ${a.filePath}`,children:(0,d.jsxs)("button",{onClick:()=>b(a),className:"w-full text-left px-2 py-1.5 border-b border-border/50 hover:transition-colors group flex items-start gap-1.5",children:[(0,d.jsx)(q,{kind:a.kind??"unknown",qname:a.qname,className:"w-3 h-3 mt-0.5 flex-shrink-0"}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("div",{className:"text-xs font-mono font-medium truncate",children:a.name}),(0,d.jsxs)("div",{className:"text-[10px] text-muted-foreground/70 truncate",children:[(f=(e=a.filePath).lastIndexOf("/"))>=0?e.slice(f+1):e,a.kind&&(0,d.jsxs)("span",{className:"ml-1 opacity-60",children:["\xb7 ",a.kind]})]})]})]})},`${a.filePath}::${a.qname}::${c}`)})})]})}function D(a,b){let c=a.filter(a=>a.filePath!==b.filePath||a.qname!==b.qname),d=[b,...c];return d.length>15?d.slice(0,15):d}var E=c(65543);function F({functions:a,currentQname:b,onSelect:c,notIndexed:g,onRebuild:h}){let{t:i}=(0,f.Bd)(),j=(0,e.useMemo)(()=>a.filter(E._),[a]);return(0,d.jsxs)("div",{className:"flex-1 min-h-0 bg-card flex flex-col","data-testid":"file-toc-section",children:[(0,d.jsx)("div",{className:"flex-shrink-0 px-2 py-1.5 border-b border-border text-xs text-muted-foreground font-mono truncate",children:0===j.length?i("blockViewer.toc.title"):`${i("blockViewer.toc.title")} \xb7 ${j.length}`}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto",children:0===j.length?g?(0,d.jsxs)("div",{className:"px-3 py-4 text-[10px] text-muted-foreground/80 leading-relaxed flex flex-col gap-2",children:[(0,d.jsx)("span",{className:"italic",children:i("blockViewer.toc.notIndexed")}),h&&(0,d.jsx)("button",{type:"button",onClick:h,className:"self-start px-2 py-1 rounded border border-border bg-secondary/60 hover:bg-secondary text-[10px] text-foreground transition-colors",children:i("blockViewer.refresh")})]}):(0,d.jsx)("div",{className:"px-3 py-4 text-[10px] text-muted-foreground/60 italic leading-relaxed",children:i("blockViewer.toc.empty")}):j.map(a=>{let e=b===a.qualifiedName;return(0,d.jsx)(B.m,{content:`${a.qualifiedName} \xb7 L${a.startLine}`,children:(0,d.jsxs)("button",{onClick:()=>c(a.qualifiedName,a.startLine),className:`w-full text-left px-2 py-1 transition-colors flex items-center gap-1.5 min-w-0 ${e?"bg-brand/15 hover:bg-brand/20":"hover:bg-secondary/60"}`,children:[(0,d.jsx)(q,{kind:a.kind,qname:a.qualifiedName,className:"w-3 h-3 flex-shrink-0"}),(0,d.jsx)("span",{className:`text-xs font-mono truncate ${e?"font-semibold text-brand":""}`,children:a.name})]})},a.qualifiedName)})})]})}var G=c(37690),H=c(22341);function I({comments:a,startLine:b,endLine:c,lineHeight:e,bodyTopOffset:f,onCommentClick:g}){let h=new Map;for(let d of a){if(d.endLine<b||d.endLine>c)continue;let a=h.get(d.endLine);a?a.push(d):h.set(d.endLine,[d])}return 0===h.size?null:(0,d.jsx)("div",{className:"absolute top-0 right-0 bottom-0 w-6 pointer-events-none",children:Array.from(h.entries()).map(([a,c])=>{let h=f+(a-b)*e,i=c[0],j=c.length-1;return(0,d.jsx)(B.m,{content:1===c.length?i.content:`${c.length} comments — click to view`,children:(0,d.jsxs)("button",{onClick:a=>g(i,a),className:"pointer-events-auto absolute right-1 w-4 h-4 rounded-full bg-amber-9/70 hover:bg-amber-11 text-white flex items-center justify-center shadow-lv1 transition-colors",style:{top:`${h+e/2-8}px`},children:[(0,d.jsx)(H.A,{className:"w-2.5 h-2.5"}),j>0&&(0,d.jsx)("span",{className:"absolute -top-1 -right-1 bg-amber-11 text-white rounded-full text-[8px] leading-none w-3 h-3 flex items-center justify-center",children:j+1})]})},a)})})}function J(a,b){for(let c=0;c<a.blocks.length;c++){let d=a.blocks[c];if(b>=d.startLine&&b<=d.endLine)return a.prefix[c]+(b-d.startLine)}return null}function K({addedLines:a,blockRanges:b,viewportRange:c,onJumpToLine:f}){let g,h=(0,e.useRef)(null),i=(0,e.useMemo)(()=>(function(a){let b=[...a].sort((a,b)=>a.startLine-b.startLine),c=[0];for(let a of b){let b=Math.max(0,a.endLine-a.startLine+1);c.push(c[c.length-1]+b)}return{blocks:b,prefix:c,total:c[c.length-1]}})(b),[b]),j=(0,e.useMemo)(()=>{if(i.total<=0||0===a.size)return[];let b=[];for(let c of a){let a=i.blocks.find(a=>c>=a.startLine&&c<=a.endLine);a&&b.push({line:c,qname:a.qname})}b.sort((a,b)=>a.line-b.line);let c=[],d=null;for(let a of b)d&&a.line===d.end+1&&a.qname===d.qname?d.end=a.line:(d&&c.push(d),d={start:a.line,end:a.line,qname:a.qname});return d&&c.push(d),c},[a,i]);if(i.total<=0)return null;let k=(a,b)=>{let c=J(i,a),d=J(i,b);return null===c||null===d?null:{top:c/i.total*100,heightPct:(d-c+1)/i.total*100}};return(0,d.jsxs)("div",{ref:h,onClick:a=>{let b=h.current;if(!b)return;let c=b.getBoundingClientRect();if(c.height<=0)return;let d=function(a,b){if(a.total<=0)return null;let c=Math.max(0,Math.min(a.total-1,b));for(let b=0;b<a.blocks.length;b++){let d=a.prefix[b],e=a.prefix[b+1];if(c>=d&&c<e){let e=a.blocks[b];return{qname:e.qname,line:e.startLine+Math.round(c-d)}}}return null}(i,(a.clientY-c.top)/c.height*i.total);if(!d)return;let e=d.line,g=j.find(a=>a.qname===d.qname&&e>=a.start&&e<=a.end);if(g)return void f(g.qname,e);if(j.length>0){let a=Math.max(2,Math.round(.05*i.total)),b=J(i,e);if(null!==b){let c=null,d=1/0;for(let a of j){let e=J(i,a.start),f=J(i,a.end);if(null===e||null===f)continue;let g=b<e?e-b:b>f?b-f:0;g<d&&(c=a,d=g)}if(c&&d<=a){let a=e<c.start?c.start:e>c.end?c.end:e;f(c.qname,a);return}}}let k=i.blocks.find(a=>a.qname===d.qname);k&&f(k.qname,k.startLine)},className:"w-4 flex-shrink-0 bg-secondary border-l border-border relative cursor-pointer",title:"Diff minimap — click to jump",children:[j.map(a=>{let b=k(a.start,a.end);return b?(0,d.jsx)("div",{className:"absolute left-0 right-0 bg-green-9 pointer-events-none",style:{top:`${b.top}%`,height:`${b.heightPct}%`,minHeight:"2px"}},`run:${a.qname}:${a.start}-${a.end}`):null}),c&&c.end>=c.start&&((g=k(c.start,c.end))?(0,d.jsx)("div",{className:"absolute left-0 right-0 bg-muted/60 border-y border-border pointer-events-none",style:{top:`${g.top}%`,height:`${Math.max(1.2,g.heightPct)}%`}}):null)]})}var L=c(41051),M=c(42140),N=c(70596);function O(a){let b=a.lastIndexOf("/");return b>=0?a.slice(b+1):a}let P="flex-shrink-0 h-4 leading-4 px-1.5 rounded text-[10px] text-brand hover:bg-brand/10 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent";function Q({symbol:a,fileSource:b,hasChange:c,onHighlighted:g,comments:h,onCommentClick:i,addedLines:j,upstream:k,downstream:l}){let{resolvedTheme:m}=(0,y.DP)(),{t:n}=(0,f.Bd)(),o=(0,v.r)(),p=(k?.length??0)+(l?.length??0)>0;(0,e.useMemo)(()=>(0,z.sQ)(a.filePath),[a.filePath]);let[r,s]=(0,e.useState)(null),[t,u]=(0,e.useState)(null);return(0,d.jsxs)("div",{className:"flex-1 min-w-0 bg-card border border-border rounded overflow-hidden relative",children:[(0,d.jsxs)("div",{"data-block-header":!0,className:"flex items-center gap-1.5 px-2 py-1.5 border-b border-border text-xs",children:[(0,d.jsx)(q,{kind:a.kind,qname:a.qualifiedName,className:"w-3.5 h-3.5 flex-shrink-0"}),(0,d.jsxs)("span",{className:"font-mono truncate min-w-0",children:[(0,d.jsx)("span",{className:"font-medium",children:a.name}),void 0!==a.params&&(0,d.jsxs)("span",{className:"text-muted-foreground/80",children:["(",a.params.join(", "),")"]})]}),(0,d.jsxs)("span",{className:"text-[10px] text-muted-foreground/70 flex-shrink-0",children:[a.kind," \xb7 L",a.startLine,"-",a.endLine]}),o&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("button",{onClick:()=>o.sendMessage(n("explain.symbolMessage",{name:a.name,path:a.filePath,lines:`${a.startLine}-${a.endLine}`})),disabled:o.isLoading,title:o.isLoading?n("comments.aiResponding"):void 0,className:P,children:n("explain.action")}),p&&(0,d.jsx)("button",{onClick:()=>o.sendMessage(n("deps.symbolMessage",{name:a.name,path:a.filePath,lines:`${a.startLine}-${a.endLine}`,...function(a,b,c){let d=a=>{switch(a.kind){case"cross":case"self":return`${a.external.name} (${a.external.filePath})`;case"method":return`${a.receiverName}.${a.methodName}()`;case"ext":return null}},e=a=>{let b=a.map(d).filter(a=>null!==a);return b.length?b.join(", "):c},f=new Map;for(let a of b){if("ext"!==a.kind)continue;let b=f.get(a.packageSpec);b?b.push(a.name):f.set(a.packageSpec,[a.name])}let g=[...f].map(([a,b])=>`${a} (${b.join(", ")})`);return{callers:e(a),callees:e(b),externals:g.length?g.join("; "):c}}(k??[],l??[],n("deps.none"))})),disabled:o.isLoading,title:o.isLoading?n("comments.aiResponding"):void 0,className:P,children:n("deps.action")})]}),(0,d.jsx)("span",{className:"flex-1"}),c&&(0,d.jsx)("span",{className:"flex-shrink-0 w-2 h-2 rounded-full bg-amber-11","data-tooltip":"File has uncommitted change"})]}),(0,d.jsxs)("div",{"data-block-body":!0,className:"text-[11px] font-mono px-2 py-2 overflow-auto",style:{lineHeight:`${T}px`},children:[!b&&(0,d.jsx)("span",{className:"text-muted-foreground",children:"Loading…"}),t&&(0,d.jsx)("span",{className:"text-red-11",children:t}),r&&(0,d.jsx)("div",{dangerouslySetInnerHTML:{__html:r}})]}),h&&h.length>0&&i&&(0,d.jsx)(I,{comments:h,startLine:a.startLine,endLine:a.endLine,lineHeight:T,bodyTopOffset:U+V,onCommentClick:i})]})}function R({side:a,pin:b,accent:c,onClick:e}){let f,g,h,i,j,k,l,m=b.lines.length;"ext"===b.kind?(f="bg-secondary/30 border-border/50 hover:border-muted-foreground/60",g="ext",h="text-muted-foreground/60",i=b.name,j=b.packageSpec,k="external",l=b.packageSpec):"method"===b.kind?(f="bg-secondary/30 border-border/50 hover:border-muted-foreground/60",g="method",h="text-muted-foreground/60",i=`${b.receiverName}.${b.methodName}`,j=null,k="method (unresolved)",l=m>0?`at line${m>1?"s":""} ${b.lines.join(", ")}`:""):"self"===b.kind?(f="bg-secondary/40 border-border hover:border-muted-foreground",g="self",h="text-muted-foreground/70",i=b.external.name,j=null,k="same-file",l=m>0?`at line${m>1?"s":""} ${b.lines.join(", ")}`:""):(f="in"===a?"bg-amber-9/15 border-amber-9/40 hover:border-amber-11":"bg-green-9/15 border-green-9/40 hover:border-green-11",g=a,h="in"===a?"text-amber-11":"text-green-11",i=b.external.name,j=O(b.external.filePath),k="in"===a?"caller":"callee",l=b.external.filePath);let n=c&&"ext"!==b.kind&&"method"!==b.kind?" ring-1 ring-amber-9/70 ring-offset-0":"";return(0,d.jsxs)("button",{onClick:a=>{a.stopPropagation(),e()},className:`${f}${n} w-full text-left border rounded px-1.5 py-0.5 text-[10px] font-mono cursor-pointer transition-colors flex items-center gap-1.5`,"data-tooltip":`${k} \xb7 ${i}${l?" \xb7 "+l:""}`,children:[(0,d.jsx)("span",{className:`${h} text-[9px] uppercase tracking-wider font-semibold flex-shrink-0`,children:g}),(0,d.jsxs)("span",{className:"flex-1 min-w-0 flex items-center gap-1",children:[(0,d.jsx)("span",{className:"font-medium truncate",children:i}),j&&(0,d.jsx)("span",{className:"text-muted-foreground/70 truncate shrink-[10]",children:j}),m>1&&(0,d.jsxs)("span",{className:"text-muted-foreground/60 flex-shrink-0",children:["\xb7",m,"\xd7"]})]})]})}let S="w-44 @min-[900px]:w-52 @min-[1100px]:w-60 @min-[1400px]:w-72 @min-[1800px]:w-80 @min-[2400px]:w-96",T=18,U=29,V=8;function W(a,b){switch(b.kind){case"cross":return`${a}:x:${b.external.filePath}::${b.external.qualifiedName}`;case"self":return`${a}:s:${b.external.filePath}::${b.external.qualifiedName}`;case"ext":return`${a}:e:${b.packageSpec}::${b.name}`;case"method":return`${a}:m:${b.receiverName}::${b.methodName}`}}function X(a,b){return"ext"!==a.kind&&"method"!==a.kind&&(b?.has(a.external.qualifiedName)??!1)}function Y(a){return{filePath:a.filePath,qname:a.qualifiedName,name:a.name,kind:a.kind}}function Z({symbol:a,fileSource:b,hasChange:c,upstream:e,downstream:f,onPinClick:g,onHighlighted:h,comments:i,onCommentClick:j,accentQnames:k,addedLines:l}){let m=function(a,b){if(0===a.length)return[];let c=a.map((a,c)=>{var d,e;return{i:c,line:(d=a.lines[0]??b.startLine,e=b.startLine,Math.max(e,Math.min(b.endLine,d)))}});c.sort((a,b)=>a.line-b.line||a.i-b.i);let d=Array(a.length).fill(0),e=-1/0;for(let{i:a,line:f}of c){let c=Math.max(U+V+(f-b.startLine)*T,e);d[a]=c,e=c+22}return d}(f,a);return(0,d.jsxs)("div",{"data-block-qname":a.qualifiedName,"data-start-line":a.startLine,"data-end-line":a.endLine,className:"flex gap-2 items-stretch scroll-mt-2",children:[(0,d.jsx)("div",{className:`${S} flex-shrink-0 flex flex-col gap-1 pt-1`,children:0===e.length?(0,d.jsx)("div",{className:"text-[10px] text-muted-foreground/40 italic px-1.5",children:"no callers"}):e.map(b=>(0,d.jsx)(R,{side:"in",pin:b,accent:X(b,k),onClick:()=>g(b,a)},W("in",b)))}),(0,d.jsx)(Q,{symbol:a,fileSource:b,hasChange:c,onHighlighted:h,comments:i,onCommentClick:j,addedLines:l,upstream:e,downstream:f}),(0,d.jsx)("div",{className:`${S} flex-shrink-0 relative`,children:0===f.length?(0,d.jsx)("div",{className:"text-[10px] text-muted-foreground/40 italic px-1.5 pt-1",children:"no callees"}):f.map((b,c)=>(0,d.jsx)("div",{className:"absolute left-0 right-0",style:{top:`${m[c]}px`},children:(0,d.jsx)(R,{side:"out",pin:b,accent:X(b,k),onClick:()=>g(b,a)})},W("out",b)))})]})}function $({cwd:a,onSelect:b,onClose:c}){let{t:i}=(0,f.Bd)(),[j,k]=(0,e.useState)(""),[l,m]=(0,e.useState)({files:[],symbols:[]}),[n,o]=(0,e.useState)(0),[p,q]=(0,e.useState)(!1),r=(0,e.useMemo)(()=>[...l.files,...l.symbols],[l]),s=(0,e.useCallback)(a=>{if("Escape"===a.key)return void c();if(0!==r.length){if("ArrowDown"===a.key)a.preventDefault(),o(a=>Math.min(a+1,r.length-1));else if("ArrowUp"===a.key)a.preventDefault(),o(a=>Math.max(a-1,0));else if("Enter"===a.key){a.preventDefault();let c=r[n];c&&b(c)}}},[r,n,c,b]);return(0,d.jsx)("div",{className:"absolute inset-0 bg-background/40 z-20 flex items-start justify-center pt-24",onClick:c,children:(0,d.jsxs)("div",{className:"w-[480px] max-w-[80%] bg-card border border-border rounded shadow-lv3 overflow-hidden",onClick:a=>a.stopPropagation(),children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-border",children:[(0,d.jsx)(g.A,{className:"w-4 h-4 text-muted-foreground"}),(0,d.jsx)("input",{autoFocus:!0,value:j,onChange:a=>k(a.target.value),onKeyDown:s,placeholder:i("blockViewer.search.hint","Start typing to search"),className:"flex-1 bg-transparent border-0 outline-none text-sm"}),p&&(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:"…"}),(0,d.jsx)("button",{onClick:c,className:"text-muted-foreground hover:text-foreground",children:(0,d.jsx)(h.A,{className:"w-3.5 h-3.5"})})]}),(0,d.jsxs)("div",{className:"max-h-96 overflow-y-auto",children:[0===r.length&&j&&!p&&(0,d.jsx)("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:i("blockViewer.search.noResults","No matches")}),(0,d.jsx)(_,{label:i("blockViewer.search.files","Files"),hits:l.files,startIdx:0,activeIdx:n,onSelect:b,setActive:o}),(0,d.jsx)(_,{label:i("blockViewer.search.symbols","Symbols"),hits:l.symbols,startIdx:l.files.length,activeIdx:n,onSelect:b,setActive:o})]})]})})}function _({label:a,hits:b,startIdx:c,activeIdx:e,onSelect:f,setActive:g}){return 0===b.length?null:(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"px-3 py-1 text-[10px] uppercase tracking-wider text-muted-foreground bg-secondary/40",children:a}),b.map((a,b)=>{let h=c+b,j=h===e;return(0,d.jsxs)("button",{onMouseEnter:()=>g(h),onClick:()=>f(a),className:`w-full text-left px-3 py-1.5 text-xs flex items-start gap-2 ${j?"bg-secondary":"hover:bg-secondary/60"}`,children:["file"===a.target.kind?(0,d.jsx)(i.A,{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0 text-muted-foreground"}):(0,d.jsx)(q,{kind:a.target.symbolKind,qname:a.target.qualifiedName,className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0"}),(0,d.jsxs)("div",{className:"flex-1 min-w-0 flex flex-col gap-0.5",children:[(0,d.jsx)("span",{className:"font-mono truncate",children:a.label}),a.hint&&(0,d.jsx)("span",{className:"text-[10px] text-muted-foreground truncate",children:a.hint})]})]},`${a.type}:${a.label}:${b}`)})]})}function aa({cwd:a,highlightedFilePath:b,changedFiles:c,onSwitchToCode:g,enableComments:h=!1,onContentSearch:i,onFocalChange:j,qnameFilter:k,qnameFilterFile:l,accentQnames:m,accentFile:n,addedLines:o,addedLinesFile:p,headerExtraLeft:q,headerExtraRight:s}){let{t:u}=(0,f.Bd)(),[y,z]=(0,e.useState)(null),A=y??b??null,{state:B,refresh:E}=(0,r.V)(a,A),[H,I]=(0,e.useState)(null);(0,e.useRef)(null);let[J,P]=(0,e.useState)([]),[Q,R]=(0,e.useState)(!1),[S,T]=(0,e.useState)(null),U=(0,e.useRef)(0);(0,e.useRef)(0);let[V,W]=(0,e.useState)(()=>new Set);"ready"===B.state&&B.data.filePath;let X=(0,e.useCallback)(a=>{W(b=>{if(b.has(a))return b;let c=new Set(b);return c.add(a),c})},[]),_=(0,e.useCallback)((a,b)=>{if("ext"===a.kind||"method"===a.kind){let a=b.filePath;if(!a)return;U.current+=1,T({filePath:a,qname:"__imports__",nonce:U.current});return}let c=Y(b),d=Y(a.external);P(a=>D(D(a,c),d)),z(d.filePath),U.current+=1,T({filePath:d.filePath,qname:d.qname,nonce:U.current})},[]),ad=(0,e.useCallback)(a=>{z(a.filePath),U.current+=1,T({filePath:a.filePath,qname:a.qname,nonce:U.current})},[]),ae=(0,e.useCallback)(a=>{R(!1),z(a.target.filePath),"symbol"===a.target.kind&&(U.current+=1,T({filePath:a.target.filePath,qname:a.target.qualifiedName,line:a.target.line,nonce:U.current}))},[]),af=(0,e.useCallback)((a,b)=>{A&&(U.current+=1,T({filePath:A,qname:a,line:b,nonce:U.current}))},[A]),[ag,ah]=(0,e.useState)(null),[ai,aj]=(0,e.useState)(null),ak=(0,e.useMemo)(()=>{if("ready"!==B.state||!ai)return null;let a=B.data.functions;if(0===a.length)return null;let b=(ai.start+ai.end)/2;for(let c of a)if(c.startLine<=b&&b<=c.endLine)return c.qualifiedName;let c=null;for(let b of a)b.startLine<=ai.start&&(!c||b.startLine>c.startLine)&&(c=b);return c?.qualifiedName??null},[B,ai]),al=h&&!!a&&!!A,am=(0,v.r)(),{comments:an,addComment:ao,updateComment:ap,deleteComment:aq,refresh:ar}=(0,w._)({cwd:a,filePath:A??""}),[as,at]=(0,e.useState)(null),{toolbarRef:au,bumpRef:av,clearToolbar:aw}=(0,G.L)({enabled:al,container:as,resolveLineRange:a=>{if(!document.contains(a))return null;let b=a.nodeType===Node.TEXT_NODE?a.parentElement:a,c=b?.closest("[data-line]");if(!c||!as||!as.contains(c))return null;let d=c.getAttribute("data-line");if(!d)return null;let e=parseInt(d,10);return Number.isFinite(e)?{start:e,end:e}:null},buildLineSnapshot:({start:a,end:b})=>{let c=H?.content;return c?c.split("\n").slice(a-1,b).join("\n"):""}}),[ax,ay]=(0,e.useState)(null),[az,aA]=(0,e.useState)(null),[aB,aC]=(0,e.useState)(null),aD=(0,e.useCallback)(()=>{let a=au.current;a&&(ay({x:a.x,y:a.y,range:a.range,selectedText:a.selectedText,lineSnapshot:a.lineSnapshot}),aw())},[aw,au]),aE=(0,e.useCallback)(()=>{let a=au.current;a&&(aA({x:a.x,y:a.y,range:a.range,selectedText:a.selectedText,lineSnapshot:a.lineSnapshot}),aw())},[aw,au]),aF=(0,e.useCallback)(()=>{let a=au.current;a&&am&&A&&(aw(),(0,x.Ff)(am.sendMessage,{filePath:A,startLine:a.range.start,endLine:a.range.end,codeContent:a.lineSnapshot},u("explain.selectionMessage")))},[am,A,aw,au,u]),aG=(0,e.useCallback)(()=>{let a=au.current;if(!a||!i)return;let b=a.selectedText.trim();aw(),b&&i(b)},[i,aw,au]),aH=(0,e.useCallback)(async a=>{ax&&(await ao(ax.range.start,ax.range.end,a,ax.selectedText),ay(null))},[ax,ao]),aI=(0,e.useCallback)(async(b,c)=>{if(am&&a&&A)try{let d=(await (0,x.$3)(a)).map(a=>({filePath:a.filePath,startLine:a.startLine,endLine:a.endLine,codeContent:a.codeContent,note:a.content||void 0}));d.push({filePath:A,startLine:b.range.start,endLine:b.range.end,codeContent:b.lineSnapshot});let e=(0,x.Gw)(d,c);am.sendMessage(e),await (0,x.RP)(a),ar()}catch(a){console.error("[BlockViewer] send to AI failed:",a)}},[am,a,A,ar]),aJ=(0,e.useCallback)(a=>{az&&aI(az,a)},[az,aI]),aK=(0,e.useCallback)(a=>{ax&&aI(ax,a)},[ax,aI]),aL=(0,e.useCallback)((a,b)=>{b.stopPropagation(),aC({comment:a,x:b.clientX,y:b.clientY}),aw(),ay(null),aA(null)},[aw]);if(!A)return(0,d.jsxs)("div",{className:"h-full flex flex-col",children:[(0,d.jsx)(ac,{focalFile:null,fileCount:null,onSwitchToCode:g,onSearch:()=>R(!0),onRefresh:E,refreshDisabled:!0,extraLeft:q,extraRight:s}),(0,d.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center text-sm text-muted-foreground gap-2 px-4 text-center",children:[(0,d.jsx)("span",{children:u("blockViewer.empty.body","Select a file in the left tree to see its function call graph.")}),(0,d.jsx)("span",{className:"text-xs",children:u("blockViewer.empty.hint","or press ⌘K to search.")})]}),Q&&(0,d.jsx)($,{cwd:a,onSelect:ae,onClose:()=>R(!1)})]});if("idle"===B.state||"loading"===B.state)return(0,d.jsxs)("div",{className:"h-full flex flex-col",children:[(0,d.jsx)(ac,{focalFile:A,fileCount:null,onSwitchToCode:g,onSearch:()=>R(!0),onRefresh:E,refreshDisabled:!0,extraLeft:q,extraRight:s}),(0,d.jsx)(t,{cwd:a})]});if("notFound"===B.state)return(0,d.jsxs)("div",{className:"h-full flex flex-col",children:[(0,d.jsx)(ac,{focalFile:A,fileCount:null,onSwitchToCode:g,onSearch:()=>R(!0),onRefresh:E,extraLeft:q,extraRight:s}),(0,d.jsx)("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground px-4 text-center",children:u("blockViewer.fileMode.notFound","This file is not indexed (unsupported language or beyond the file cap).")}),Q&&(0,d.jsx)($,{cwd:a,onSelect:ae,onClose:()=>R(!1)})]});if("error"===B.state)return(0,d.jsxs)("div",{className:"h-full flex flex-col",children:[(0,d.jsx)(ac,{focalFile:A,fileCount:null,onSwitchToCode:g,onSearch:()=>R(!0),onRefresh:E,extraLeft:q,extraRight:s}),(0,d.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 text-sm",children:[(0,d.jsx)("span",{className:"text-red-11",children:B.message}),(0,d.jsx)("button",{onClick:E,className:"px-3 py-1 rounded bg-secondary hover:bg-secondary/80",children:u("blockViewer.retry","Retry")})]})]});let aM=B.data,aN=aM.functions;if(0===aN.length&&H){let a=Math.max(1,H.content.split("\n").length);aN=[{filePath:aM.filePath,qualifiedName:"__file__",name:O(aM.filePath),kind:"unknown",startLine:1,endLine:a}]}let aO=l&&l===aM.filePath,aP=n&&n===aM.filePath,aQ=p&&p===aM.filePath;aO&&k&&(aN=aN.filter(a=>k.has(a.qualifiedName)));let aR=aP?m:void 0,aS=aQ?o:void 0,aT=ab(aM.upstreamCalls),aU=ab(aM.downstreamCalls),aV=new Map(aN.map(a=>[a.qualifiedName,a])),aW=new Map,aX=new Map;for(let a of aM.intraCalls){let b=aV.get(a.to),c=aV.get(a.from);if(b){let c=aW.get(a.from),d={kind:"self",external:b,lines:a.lines};c?c.push(d):aW.set(a.from,[d])}if(c){let b=aX.get(a.to),d={kind:"self",external:c,lines:a.lines};b?b.push(d):aX.set(a.to,[d])}}let aY=new Map;for(let a of aM.externalCalls??[]){let b=aY.get(a.focalQname),c={kind:"ext",name:a.external.name,packageSpec:a.external.packageSpec,lines:a.lines};b?b.push(c):aY.set(a.focalQname,[c])}let aZ=new Map;for(let a of aM.methodCalls??[]){let b=aZ.get(a.focalQname),c={kind:"method",receiverName:a.receiverName,methodName:a.methodName,lines:a.lines};b?b.push(c):aZ.set(a.focalQname,[c])}let a$=c.has(aM.filePath);return(0,d.jsxs)("div",{className:"h-full flex flex-col relative",children:[(0,d.jsx)(ac,{focalFile:A,fileCount:aM.fileCount,functionCount:aM.functions.length,upstreamCount:aM.upstreamCalls.length,downstreamCount:aM.downstreamCalls.length,onSwitchToCode:g,onSearch:()=>R(!0),onRefresh:E,extraLeft:q,extraRight:s}),(0,d.jsxs)("div",{ref:at,className:"flex-1 relative min-h-0 flex",children:[(0,d.jsxs)("div",{className:"w-56 flex-shrink-0 border-r border-border flex flex-col",children:[(0,d.jsx)(F,{functions:aN,currentQname:ak,onSelect:af,notIndexed:aM.notIndexed,onRebuild:E}),(0,d.jsx)(C,{entries:J,onSelect:ad,onClear:()=>P([])})]}),(0,d.jsx)("div",{ref:ah,className:"@container flex-1 min-w-0 overflow-auto",children:(0,d.jsx)("div",{className:"flex flex-col gap-3 p-3",children:aN.map(a=>{let b,c,e,f,g,h;return(0,d.jsx)(Z,{symbol:a,fileSource:H?.content??null,hasChange:a$,upstream:(b=aT.get(a.qualifiedName),c=aX.get(a.qualifiedName),[...(b??[]).map(a=>({kind:"cross",external:a.external,lines:a.lines})),...c??[]]),downstream:(e=aU.get(a.qualifiedName),f=aW.get(a.qualifiedName),g=aZ.get(a.qualifiedName),h=aY.get(a.qualifiedName),[...(e??[]).map(a=>({kind:"cross",external:a.external,lines:a.lines})),...f??[],...g??[],...h??[]]),onPinClick:_,onHighlighted:X,comments:al?an:void 0,onCommentClick:al?aL:void 0,accentQnames:aR,addedLines:aS},a.qualifiedName)})})}),al&&as&&(0,d.jsx)(L.fS,{floatingToolbarRef:au,bumpRef:av,container:as,onAddComment:aD,onSendToAI:aE,onSearch:i?aG:void 0,onExplain:am&&A?aF:void 0,isChatLoading:am?.isLoading}),al&&ax&&(0,d.jsx)(M.t,{x:ax.x,y:ax.y,range:ax.range,filePath:A??void 0,lineSnapshot:ax.lineSnapshot,container:as,onSubmit:aH,onSendToAI:am&&A?aK:void 0,onClose:()=>ay(null),isChatLoading:am?.isLoading}),al&&az&&A&&(0,d.jsx)(M.G,{x:az.x,y:az.y,range:az.range,filePath:A,lineSnapshot:az.lineSnapshot,container:as,onSubmit:aJ,onClose:()=>aA(null),isChatLoading:am?.isLoading}),al&&aB&&(0,d.jsx)(N.t,{x:aB.x,y:aB.y,comment:aB.comment,container:as,onClose:()=>aC(null),onUpdateComment:ap,onDeleteComment:aq}),aS&&aS.size>0&&aN.length>0&&(0,d.jsx)(K,{addedLines:aS,blockRanges:aN.map(a=>({qname:a.qualifiedName,startLine:a.startLine,endLine:a.endLine})),viewportRange:ai,onJumpToLine:af}),Q&&(0,d.jsx)($,{cwd:a,onSelect:ae,onClose:()=>R(!1)})]})]})}function ab(a){let b=new Map;for(let c of a){let a=b.get(c.focalQname);if(!a){b.set(c.focalQname,[c]);continue}a.some(a=>a.external.filePath===c.external.filePath&&a.external.qualifiedName===c.external.qualifiedName)||a.push(c)}return b}function ac({focalFile:a,fileCount:b,functionCount:c,upstreamCount:e,downstreamCount:h,onSwitchToCode:i,onSearch:k,onRefresh:l,refreshDisabled:m,extraLeft:n,extraRight:o}){let{t:p}=(0,f.Bd)(),q={focalFile:a,blockCount:c??0,upstreamCount:e??0,downstreamCount:h??0};return(0,d.jsxs)("div",{className:"flex-shrink-0 px-3 py-2 border-b border-border flex items-center justify-between gap-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 min-w-0 text-xs text-muted-foreground font-mono",children:[(0,d.jsx)("span",{className:"truncate min-w-0",children:a?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"text-foreground",children:a}),"number"==typeof c&&(0,d.jsxs)("span",{className:"ml-2",children:["\xb7 ",c," blocks"]}),"number"==typeof e&&"number"==typeof h&&(0,d.jsxs)("span",{className:"ml-2",children:["\xb7 ",e," in \xb7 ",h," out"]})]}):(0,d.jsx)("span",{children:null!==b?`${b} files`:"…"})}),n&&(0,d.jsx)("span",{className:"flex items-center gap-1 flex-shrink-0",children:n(q)})]}),(0,d.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0",children:[o&&(0,d.jsx)("span",{className:"flex items-center gap-1",children:o(q)}),(0,d.jsxs)("button",{onClick:k,className:"text-xs px-2 py-1 rounded hover:bg-secondary text-muted-foreground hover:text-foreground flex items-center gap-1","data-tooltip":p("blockViewer.search.tooltip","Search (⌘K)"),children:[(0,d.jsx)(g.A,{className:"w-3 h-3"})," ⌘K"]}),(0,d.jsx)("button",{onClick:l,disabled:m,className:"text-xs px-2 py-1 rounded hover:bg-secondary text-muted-foreground hover:text-foreground disabled:opacity-50 disabled:hover:bg-transparent","data-tooltip":p("blockViewer.refresh","Rebuild project graph"),children:(0,d.jsx)(j.A,{className:"w-3 h-3"})}),i&&(0,d.jsx)("button",{onClick:i,className:"text-xs px-2 py-1 rounded hover:bg-secondary text-muted-foreground hover:text-foreground",children:p("common.code","Code")})]})]})}},83768:(a,b,c)=>{"use strict";c.d(b,{DP:()=>g,NP:()=>i,Ql:()=>h});var d=c(48249),e=c(67484);let f=(0,e.createContext)(null);function g(){let a=(0,e.useContext)(f);if(!a)throw Error("useTheme must be used within a ThemeProvider");return a}function h(){return(0,e.useContext)(f)}function i({children:a}){let[b,c]=(0,e.useState)("system"),[g,h]=(0,e.useState)("light"),j=(0,e.useCallback)(()=>"light",[]),k=(0,e.useCallback)(a=>{let b=document.documentElement;b.classList.remove("light","dark"),b.classList.add(a),h(a);let c=document.querySelector('meta[name="theme-color"]'),d="dark"===a?"#111113":"#f9f9fb";c&&c.setAttribute("content",d)},[]),l=(0,e.useCallback)(a=>{c(a),localStorage.setItem("theme",a),k("system"===a?j():a),document.querySelectorAll("iframe").forEach(b=>{b.contentWindow?.postMessage({type:"THEME_CHANGE",theme:a},"*")})},[j,k]);return(0,d.jsx)(f.Provider,{value:{theme:b,resolvedTheme:g,setTheme:l},children:a})}},84398:(a,b,c)=>{"use strict";function d(a){let b=a.split("/").pop()?.toLowerCase()??"";switch(b.includes(".")?b.split(".").pop():""){case"ts":return"typescript";case"tsx":case"jsx":return"tsx";case"js":case"mjs":case"cjs":return"javascript";case"py":case"pyi":return"python";case"go":return"go";case"rs":return"rust";default:return null}}c.d(b,{k:()=>d})},84747:(a,b,c)=>{"use strict";c.d(b,{Workspace:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call Workspace() from the server but Workspace is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/Workspace.tsx","Workspace")},84835:(a,b,c)=>{"use strict";c.d(b,{W:()=>f});var d=c(50300);let e=new Set(["p","h1","h2","h3","h4","h5","h6","li","blockquote","pre","table","tr","hr","div","ul","ol"]);function f(){return a=>{(0,d.YR)(a,"element",a=>{if(e.has(a.tagName)&&a.position&&(a.properties||(a.properties={}),a.properties["data-source-start"]=a.position.start.line,a.properties["data-source-end"]=a.position.end.line,"pre"===a.tagName)){let b=a.children?.find(a=>"element"===a.type&&"code"===a.tagName);b&&(b.properties||(b.properties={}),b.properties["data-source-start"]=a.position.start.line,b.properties["data-source-end"]=a.position.end.line)}})}}},84844:(a,b,c)=>{"use strict";c.d(b,{i:()=>p});var d=c(48249),e=c(67484),f=c(44384),g=c(208),h=c(91579),i=c(7031),j=c(44256),k=c(7833),l=c(33281),m=c(89800),n=c(25419);function o(a){if(0===a.length)return"";let b=[g.A.t("comments.codeRef"),""],c=a.filter(a=>a.filePath===h.Un),d=a.filter(a=>a.filePath!==h.Un);for(let a of(d.length>0&&d.forEach((a,c)=>{let d=a.startLine>0||a.endLine>0?`:${a.startLine}-${a.endLine}`:"";b.push(`[${c+1}] ${a.filePath}${d}`),b.push("```"),b.push(a.codeContent),b.push("```"),a.content&&b.push(g.A.t("comments.note",{content:a.content})),b.push("")}),c)){let c=a.codeContent.split("\n").map(a=>`> ${a}`).join("\n");b.push(c),a.content&&b.push(a.content),b.push("")}return b.join("\n").trim()}function p({isOpen:a,onClose:b,cwd:c,onNavigateToComment:g}){let{t:q}=(0,f.Bd)(),r=(0,i.r)(),[s,t]=(0,e.useState)([]),[u,v]=(0,e.useState)(!1),[w,x]=(0,e.useState)(null),[y,z]=(0,e.useState)(!1),[A,B]=(0,e.useState)(!1);(0,e.useCallback)(async()=>{if(!c)return;v(!0);let a=await l.t4.runPromiseExit((0,m.$)(c));"Success"===a._tag?t(a.value.comments??[]):console.error("Failed to load comments:",a.cause),v(!1)},[c]);let C=async a=>{let b=await l.t4.runPromiseExit((0,m.Tu)(c,a));"Success"===b._tag?(t(b=>b.filter(b=>b.id!==a)),(0,h.Cm)()):console.error("Failed to delete comment:",b.cause)},D=async a=>{x(a.id);try{let b="";if(a.selectedText)b=a.selectedText;else{let d=await l.t4.runPromiseExit((0,n.K)(c,a.filePath));if("Success"!==d._tag||!d.value.ok)throw Error("Failed to read file");b=(d.value.data?.content||"").split("\n").slice(a.startLine-1,a.endLine).join("\n")}let d={filePath:a.filePath,startLine:a.startLine,endLine:a.endLine,content:a.content,codeContent:b},e=o([d]);await navigator.clipboard.writeText(e),(0,k.oR)(q("toast.copiedComment"))}catch(a){console.error("Failed to copy comment:",a)}finally{x(null)}},E=async()=>{if(0!==s.length){z(!0);try{let a=await (0,h.$3)(c),b=o(a);await navigator.clipboard.writeText(b),(0,k.oR)(q("toast.copiedAllComments"))}catch(a){console.error("Failed to copy all comments:",a)}finally{z(!1)}}},F=async()=>{if(0!==s.length&&r&&!r.isLoading&&!A){B(!0);try{let a=(await (0,h.$3)(c)).map(a=>({filePath:a.filePath,startLine:a.startLine,endLine:a.endLine,codeContent:a.codeContent,note:a.content||void 0})),d=(0,h.Gw)(a,"");r.sendMessage(d),await (0,h.RP)(c),t([]),b()}catch(a){console.error("Failed to send comments to AI:",a)}finally{B(!1)}}},G=s.reduce((a,b)=>(a[b.filePath]||(a[b.filePath]=[]),a[b.filePath].push(b),a),{});if(!a)return null;let H=(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-scrim p-4",onClick:b,children:(0,d.jsxs)("div",{className:"w-full max-w-2xl max-h-[80vh] bg-card border border-border rounded-lg shadow-lv3 flex flex-col overflow-hidden",onClick:a=>a.stopPropagation(),children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border ",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("h2",{className:"text-lg font-semibold text-foreground",children:q("comments.allComments")}),s.length>0&&(0,d.jsx)("button",{onClick:E,disabled:y,className:"p-1 rounded hover:bg-hover text-muted-foreground disabled:opacity-50",title:q("comments.copyAllComments"),children:y?(0,d.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):(0,d.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]}),(0,d.jsx)("button",{onClick:b,className:"p-1 rounded hover:bg-hover text-muted-foreground",children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:u?(0,d.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:q("common.loading")}):0===s.length?(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[(0,d.jsx)("svg",{className:"w-12 h-12 mb-3 opacity-50",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})}),(0,d.jsx)("span",{children:q("comments.noComments")})]}):(0,d.jsx)("div",{className:"space-y-4",children:Object.entries(G).map(([a,b])=>(0,d.jsxs)("div",{className:"border border-border rounded-lg overflow-hidden",children:[(0,d.jsxs)("div",{className:"px-3 py-2 border-b border-border",children:[(0,d.jsx)("span",{className:"text-sm font-medium text-foreground font-mono",children:a===h.Un?q("comments.aiReply"):a}),(0,d.jsxs)("span",{className:"ml-2 text-xs text-muted-foreground",children:["(",q("comments.nComments",{count:b.length}),")"]})]}),(0,d.jsx)("div",{className:"divide-y divide-border",children:b.map(a=>{var b;return(0,d.jsx)("div",{className:"px-3 py-2 hover:bg-hover cursor-pointer group",onClick:()=>g?.(a),children:(0,d.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[a.startLine>0||a.endLine>0?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("span",{className:"text-xs text-brand font-mono",children:[q("common.line")," ",a.startLine===a.endLine?a.startLine:`${a.startLine}-${a.endLine}`]}),(0,d.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",q("comments.linesCount",{count:a.endLine-a.startLine+1}),")"]})]}):a.selectedText?(0,d.jsxs)("span",{className:"text-xs text-muted-foreground italic truncate max-w-[200px]",children:["“",a.selectedText.slice(0,50),a.selectedText.length>50?"...":"","”"]}):null,(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:(b=a.updatedAt||a.createdAt)?new Date(b).toLocaleString("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}):""})]}),(0,d.jsx)("p",{className:"text-sm text-foreground line-clamp-2",children:a.content||(0,d.jsx)("span",{className:"text-muted-foreground italic",children:q("comments.noContent")})})]}),(0,d.jsx)("button",{onClick:b=>{b.stopPropagation(),D(a)},disabled:w===a.id,className:"p-1 rounded opacity-0 group-hover:opacity-100 hover:bg-hover text-muted-foreground transition-opacity disabled:opacity-50",title:q("common.copy"),children:w===a.id?(0,d.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):(0,d.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),(0,d.jsx)("button",{onClick:b=>{b.stopPropagation(),C(a.id)},className:"p-1 rounded opacity-0 group-hover:opacity-100 hover:bg-hover text-muted-foreground hover:text-red-9 transition-opacity",title:q("common.delete"),children:(0,d.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]})},a.id)})})]},a))})}),(0,d.jsxs)("div",{className:"px-4 py-3 border-t border-border flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-sm text-muted-foreground",children:q("comments.totalComments",{count:s.length})}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[r&&(0,d.jsx)("button",{onClick:F,disabled:0===s.length||r.isLoading||A,className:"px-3 py-1.5 text-sm bg-brand text-white rounded hover:bg-brand/90 disabled:opacity-50 disabled:cursor-not-allowed",title:r.isLoading?q("comments.aiResponding"):void 0,children:A?q("comments.submitting"):q("comments.sendToAI")}),(0,d.jsx)("button",{onClick:async()=>{0===s.length||await (0,h.RP)(c)&&t([])},disabled:0===s.length,className:"px-3 py-1.5 text-sm bg-red-9 text-white rounded hover:bg-red-10 disabled:opacity-50 disabled:cursor-not-allowed",children:q("comments.clearAll")})]})]})]})});return(0,d.jsx)(j.ZL,{children:H})}},85655:(a,b,c)=>{"use strict";c.d(b,{Bj:()=>j,CM:()=>t,FK:()=>s,Iz:()=>n,MB:()=>u,Ub:()=>p,X0:()=>o,Zi:()=>k,lv:()=>m,oh:()=>r,r4:()=>h,ue:()=>i,w2:()=>q,yy:()=>l});var d=c(79606),e=c(71192);let f=a=>d.tryPromise({try:async()=>{let b=await fetch(a);if(!b.ok){let a;try{a=(await b.json()).error}catch{}throw Error(a||`HTTP ${b.status}`)}return await b.json()},catch:b=>new e.uV({message:`fetch ${a} failed`,cause:b})}),g=(a,b)=>d.tryPromise({try:async()=>{let c=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)});if(!c.ok)throw Error(`HTTP ${c.status}`)},catch:b=>new e.uV({message:`POST ${a} failed`,cause:b})}),h=a=>f(`/api/git/branches?cwd=${encodeURIComponent(a)}`).pipe(d.flatMap(b=>"Failed to get branches"===b.error?d.fail(new e.m_({resource:"git-repo",id:a})):d.succeed(b))),i=a=>f(`/api/git/current-branch?cwd=${encodeURIComponent(a)}`),j=(a,b,c,d)=>f(`/api/git/commits?cwd=${encodeURIComponent(a)}&branch=${encodeURIComponent(b)}&limit=${c}${"number"==typeof d?`&offset=${d}`:""}`),k=(a,b,c)=>f(`/api/git/commit-diff?cwd=${encodeURIComponent(a)}&hash=${encodeURIComponent(b)}${c?`&file=${encodeURIComponent(c)}`:""}`),l=(a,b,c)=>f(`/api/git/branch-diff?cwd=${encodeURIComponent(a)}&base=${encodeURIComponent(b)}${c?`&file=${encodeURIComponent(c)}`:""}`),m=a=>f(`/api/git/status?cwd=${encodeURIComponent(a)}`),n=(a,b)=>g("/api/git/stage",{cwd:a,files:b}),o=(a,b)=>g("/api/git/unstage",{cwd:a,files:b}),p=(a,b,c)=>g("/api/git/discard",{cwd:a,files:b,isUntracked:c}),q=(a,b,c,d)=>{let e=new URLSearchParams({cwd:a,file:b,type:c});return d&&e.set("oldPath",d),f(`/api/git/diff?${e}`)},r=a=>f(`/api/git/diff?${a.toString()}`),s=a=>f(`/api/git/worktree?cwd=${encodeURIComponent(a)}`),t=a=>d.tryPromise({try:async()=>{let b=await fetch("/api/git/worktree",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),c=await b.json().catch(()=>null);if(!b.ok)throw Error(c?.error||`HTTP ${b.status}`);return c},catch:a=>new e.uV({message:"POST /api/git/worktree failed",cause:a})}),u=a=>f(`/api/projectGraph/search?${a.toString()}`)},85906:(a,b,c)=>{"use strict";c.d(b,{ProjectItem:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call ProjectItem() from the server but ProjectItem is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/ProjectItem.tsx","ProjectItem")},85943:(a,b,c)=>{"use strict";function d(a){let b=0,c=0;for(let d of a)/[\u3040-\u30ff\u3400-\u9fff\uf900-\ufaff\u{20000}-\u{2a6df}\uac00-\ud7af]/u.test(d)?b+=1:c+=1;return Math.max(1,Math.ceil(b+c/4))}c.d(b,{r:()=>d})},85984:(a,b,c)=>{"use strict";c.d(b,{V:()=>k});var d=c(67484),e=c(79606),f=c(33281),g=c(71192);let h=new Map,i=new Map;async function j(a,b,c=!1){let d=`${a}::${b}`;if(c)!function(a){if(!a){h.clear(),i.clear();return}let b=`${a}::`;for(let a of h.keys())a.startsWith(b)&&h.delete(a);for(let a of i.keys())a.startsWith(b)&&i.delete(a)}(a);else{let a=h.get(d);if(a)return a;let b=i.get(d);if(b)return b}let k=e.tryPromise({try:async()=>{let e=new URLSearchParams({cwd:a,path:b});c&&e.set("refresh","1");let f=await fetch(`/api/projectGraph/file-functions?${e}`);if(404===f.status)return"not-found";if(!f.ok)throw Error((await f.json().catch(()=>({error:`HTTP ${f.status}`}))).error||`HTTP ${f.status}`);let g=await f.json();return h.set(d,g),g},catch:a=>new g.uV({message:"fetchFileFunctions failed",cause:a})}),l=f.t4.runPromiseExit(k).then(a=>{if("Success"===a._tag)return a.value;let b="Fail"===a.cause._tag?a.cause.error:null,c=b?.cause;if(c instanceof Error)throw c;throw Error(b?.message??"fetchFileFunctions failed")}).finally(()=>i.delete(d));return i.set(d,l),l}function k(a,b){let[c,e]=(0,d.useState)({state:"idle"}),f=(0,d.useRef)(!0),g=(0,d.useCallback)((a,b,c)=>{e({state:"loading"}),j(a,b,c).then(a=>{f.current&&("not-found"===a?e({state:"notFound"}):e({state:"ready",data:a}))}).catch(a=>{f.current&&e({state:"error",message:a.message})})},[]);return{state:c,refresh:(0,d.useCallback)(()=>{a&&b&&g(a,b,!0)},[a,b,g])}}},86508:(a,b,c)=>{"use strict";c.d(b,{j:()=>j});var d=c(48249),e=c(67484),f=c(44384),g=c(57063),h=c(44256),i=c(37701);function j({initialRows:a,lang:b,isCustomized:c,onSave:k,onRestoreDefault:l,onClose:m}){let{t:n}=(0,f.Bd)(),[o,p]=(0,e.useState)(()=>(0,i.Ff)(a,b));(0,g.E)(m);let q=(0,e.useCallback)(()=>{k((0,i.Z8)(o)),m()},[o,k,m]),r=(0,e.useCallback)(()=>{l(),m()},[l,m]);return(0,d.jsx)(h.ZL,{children:(0,d.jsx)("div",{className:"fixed inset-0 z-[300] flex items-center justify-center bg-scrim p-4",onClick:m,children:(0,d.jsxs)("div",{className:"bg-card border border-border rounded-lg shadow-lv3 w-full max-w-md flex flex-col",onClick:a=>a.stopPropagation(),children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,d.jsx)("h2",{className:"text-sm font-medium text-foreground",children:n("quickReply.editTitle")}),(0,d.jsx)("button",{onClick:m,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-hover rounded transition-colors","aria-label":n("quickReply.cancel"),children:(0,d.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,d.jsxs)("div",{className:"px-4 py-3 flex flex-col gap-2",children:[(0,d.jsx)("p",{className:"text-xs text-muted-foreground",children:n("quickReply.editHint")}),(0,d.jsx)("textarea",{autoFocus:!0,value:o,onChange:a=>p(a.target.value),placeholder:n("quickReply.editPlaceholder"),rows:6,spellCheck:!1,className:"w-full px-2 py-1.5 text-xs font-mono bg-background border border-border rounded text-foreground focus:outline-none focus:border-brand resize-y"}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground",children:n("quickReply.customizedFor",{lang:n("zh"===b?"quickReply.langZh":"quickReply.langEn")})})]}),(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-t border-border",children:[(0,d.jsx)("button",{onClick:r,disabled:!c,className:"px-2 py-1 text-xs text-muted-foreground hover:text-foreground transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:n("quickReply.restoreDefault")}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("button",{onClick:m,className:"px-3 py-1.5 text-xs border border-border text-foreground rounded-md hover:bg-hover transition-colors",children:n("quickReply.cancel")}),(0,d.jsx)("button",{onClick:q,className:"px-3 py-1.5 text-xs font-medium border border-brand text-brand rounded-md hover:bg-brand/10 transition-colors",children:n("quickReply.save")})]})]})]})})})}},86686:(a,b,c)=>{"use strict";c.d(b,{f:()=>h});var d=c(48249),e=c(44384),f=c(57063),g=c(44256);function h({isOpen:a,onClose:b,messages:c,onSelectMessage:i}){let{t:j}=(0,e.Bd)();if((0,f.E)(b,a),!a)return null;let k=c.filter(a=>"user"===a.role),l=(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-scrim p-4",onClick:b,children:(0,d.jsxs)("div",{className:"bg-card rounded-lg shadow-lv3 w-full max-w-2xl max-h-[85vh] flex flex-col",onClick:a=>a.stopPropagation(),children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border shrink-0",children:[(0,d.jsx)("h3",{className:"text-sm font-medium text-foreground",children:j("userMessages.title")}),(0,d.jsx)("button",{onClick:b,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-hover rounded transition-colors",children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto",children:0===k.length?(0,d.jsx)("div",{className:"flex items-center justify-center h-32 text-muted-foreground",children:j("userMessages.noMessages")}):(0,d.jsx)("div",{className:"divide-y divide-border",children:k.map((a,c)=>{let e,f,g,h=(e=a.id.match(/^user-(\d+)/))?parseInt(e[1],10):null,j=h?(f=new Date(h),g=new Date,f.toDateString()===g.toDateString()?f.toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}):f.toLocaleDateString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})):"";return(0,d.jsx)("button",{onClick:()=>{i(a.id),b()},className:"w-full px-4 py-3 text-left hover:bg-hover transition-colors",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsxs)("span",{className:"text-xs text-muted-foreground font-mono w-6 shrink-0 pt-0.5",children:[c+1,"."]}),(0,d.jsx)("div",{className:"flex-1 min-w-0",children:(0,d.jsx)("p",{className:"text-sm text-foreground truncate",children:a.content.replace(/\s+/g," ").trim()})}),j&&(0,d.jsx)("span",{className:"text-xs text-muted-foreground shrink-0 pt-0.5",children:j})]})},a.id)})})})]})});return(0,d.jsx)(g.ZL,{children:l})}},87808:(a,b,c)=>{"use strict";c.d(b,{DZ:()=>i,Ft:()=>m,Nn:()=>t,OJ:()=>q,VK:()=>u,YW:()=>l,__:()=>s,dt:()=>r,eA:()=>p,eE:()=>n,gZ:()=>j,mP:()=>h,nM:()=>v,r6:()=>o,r9:()=>k});var d=c(79606),e=c(71192);let f=(a,b={})=>d.tryPromise({try:async()=>{let c=await fetch(a,b.init);if(b.passThroughStatuses&&b.passThroughStatuses.includes(c.status))return await c.json().catch(()=>({}));if(!c.ok){let a;try{a=(await c.json()).error}catch{}throw Error(a||`HTTP ${c.status}`)}return await c.json()},catch:b=>new e.uV({message:`GET ${a} failed`,cause:b})}),g=(a,b)=>d.tryPromise({try:async()=>{let c=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)});if(!c.ok)throw Error(`HTTP ${c.status}`)},catch:b=>new e.uV({message:`POST ${a} failed`,cause:b})}),h=a=>f(`/api/files/init?cwd=${encodeURIComponent(a)}`),i=a=>f(`/api/files/index?cwd=${encodeURIComponent(a)}`),j=(a,b)=>f(`/api/files/readdir?cwd=${encodeURIComponent(a)}&path=${encodeURIComponent(b)}`),k=a=>f(`/api/files/recent?cwd=${encodeURIComponent(a)}`),l=(a,b,c)=>g("/api/files/recent",{cwd:a,file:b,...c??{}}),m=(a,b)=>g("/api/files/expanded",{cwd:a,paths:b}),n=(a,b)=>f(`/api/files/blame?cwd=${encodeURIComponent(a)}&path=${encodeURIComponent(b)}`).pipe(d.catchAll(a=>d.succeed({error:a.message}))),o=(a,b)=>{let c,f;return c=`/api/files/stat?cwd=${encodeURIComponent(a)}&path=${encodeURIComponent(b)}`,f={cache:"no-store"},d.tryPromise({try:async()=>{let a=await fetch(c,f),b=null;try{b=await a.json()}catch{}return{status:a.status,ok:a.ok,data:b}},catch:a=>new e.uV({message:`GET ${c} failed`,cause:a})})},p=a=>f(`/api/files/text?${a.toString()}`),q=a=>d.tryPromise({try:async()=>{let b=await fetch("/api/files/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),c=null;try{c=await b.json()}catch{}return{status:b.status,ok:b.ok,data:c}},catch:a=>new e.uV({message:"POST /api/files/save failed",cause:a})}),r=()=>f("/api/files/clipboard"),s=a=>d.tryPromise({try:async()=>{let b=await fetch("/api/files/clipboard",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!b.ok)throw Error(`HTTP ${b.status}`)},catch:a=>new e.uV({message:"POST /api/files/clipboard failed",cause:a})}),t=a=>d.tryPromise({try:async()=>{let b=await fetch("/api/files/paste",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),c=await b.json().catch(()=>null);if(!b.ok)throw Error(c?.error||`HTTP ${b.status}`);return c},catch:a=>new e.uV({message:"POST /api/files/paste failed",cause:a})}),u=a=>d.tryPromise({try:async()=>{let b=await fetch("/api/files/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),c=await b.json().catch(()=>null);if(!b.ok)throw Error(c?.error||`HTTP ${b.status}`);return c},catch:a=>new e.uV({message:"POST /api/files/delete failed",cause:a})}),v=a=>f(`/api/file?path=${encodeURIComponent(a)}`)},87819:(a,b,c)=>{"use strict";c.d(b,{Z:()=>e});var d=c(67484);function e(a,b){let[c,e]=(0,d.useState)({status:"loading"});return c}c(13426),c(79883),c(1239),c(79606),c(95046),c(33281)},88018:(a,b,c)=>{"use strict";c.d(b,{K:()=>h});var d=c(48249),e=c(67484),f=c(44384);function g({label:a,labelClassName:b,src:c,node:h,alt:i}){let{t:j}=(0,f.Bd)(),[k,l]=(0,e.useState)(!1);return(0,d.jsxs)("div",{className:"flex-1 min-w-0 flex flex-col items-center gap-2",children:[(0,d.jsx)("div",{className:`text-xs font-medium ${b}`,children:a}),(0,d.jsx)("div",{className:"w-full flex-1 flex items-center justify-center rounded border border-border bg-secondary p-3 min-h-[8rem]",children:h??(k?(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:j("diffViewer.imageLoadFailed")}):(0,d.jsx)("img",{src:c,alt:i,onError:()=>l(!0),className:"max-w-full max-h-[60vh] object-contain"}))})]})}function h({filePath:a,oldSrc:b,newSrc:c,oldNode:e,newNode:i}){let{t:j}=(0,f.Bd)(),k=!!e||!!b,l=!!i||!!c;return(0,d.jsxs)("div",{className:"h-full overflow-auto p-4",children:[(0,d.jsx)("div",{className:"text-xs font-mono text-muted-foreground mb-3 truncate",children:a}),k||l?(0,d.jsxs)("div",{className:"flex flex-wrap items-stretch gap-4",children:[k&&(0,d.jsx)(g,{label:j(l?"diffViewer.imageBefore":"diffViewer.imageDeleted"),labelClassName:"text-red-11",src:b,node:e,alt:`${a} (before)`}),l&&(0,d.jsx)(g,{label:j(k?"diffViewer.imageAfter":"diffViewer.imageAdded"),labelClassName:"text-green-11",src:c,node:i,alt:`${a} (after)`})]}):(0,d.jsx)("div",{className:"text-sm text-muted-foreground",children:j("diffViewer.imageUnavailable")})]})}},88214:(a,b,c)=>{"use strict";c.d(b,{n:()=>e});var d=c(23734);let e={SessionChange:(0,d.R)("session-change"),ViewChange:(0,d.R)("view-change"),OpenNote:(0,d.R)("open-note"),LangChange:(0,d.R)("lang-change"),TabAdd:(0,d.R)("tab-add"),TabClose:(0,d.R)("tab-close"),SwitchSession:(0,d.R)("switch-session"),ProjectChange:(0,d.R)("project-change"),OpenProject:(0,d.R)("open-project"),SessionComplete:(0,d.R)("session-complete"),OpenTokenStats:(0,d.R)("open-token-stats"),PinnedSessionsChanged:(0,d.R)("pinned-sessions-changed"),ScheduledTasksChanged:(0,d.R)("scheduled-tasks-changed"),ScreenshotPrepare:(0,d.R)("screenshot-prepare"),ScreenshotDone:(0,d.R)("screenshot-done")}},89719:(a,b,c)=>{"use strict";function d(a,b){let c,d=document.caretRangeFromPoint(a.clientX,a.clientY);if(!d||!b.contains(d.startContainer))return 1;let e=d.startContainer,f=d.startOffset,g=document.createTreeWalker(b,NodeFilter.SHOW_TEXT),h=1;for(;c=g.nextNode();){if(c===e){h+=f;break}h+=c.textContent?.length||0}return h}function e(a,b){if(0!==a.buttons)return null;let c=window.getSelection();if(c&&!c.isCollapsed)return null;let e=a.target;if("SPAN"!==e.tagName||!e.style.color)return null;let f=e.getBoundingClientRect();return{column:d(a,b),rect:{x:f.left,y:f.bottom+4}}}c.d(b,{A:()=>e,j:()=>d})},89800:(a,b,c)=>{"use strict";c.d(b,{$:()=>i,BC:()=>j,Tu:()=>l,lb:()=>h,tj:()=>m,vv:()=>k});var d=c(79606),e=c(71192);let f=(a,b)=>d.tryPromise({try:async()=>{let c=await fetch(a,b);if(!c.ok)throw Error(`HTTP ${c.status}`);return await c.json()},catch:c=>new e.uV({message:`${b?.method??"GET"} ${a} failed`,cause:c})}),g=(a,b)=>d.tryPromise({try:async()=>{let c=await fetch(a,b);if(!c.ok)throw Error(`HTTP ${c.status}`)},catch:c=>new e.uV({message:`${b.method} ${a} failed`,cause:c})}),h=(a,b)=>f(`/api/comments?cwd=${encodeURIComponent(a)}${b?`&filePath=${encodeURIComponent(b)}`:""}`),i=a=>f(`/api/comments?cwd=${encodeURIComponent(a)}&all=true`),j=a=>f("/api/comments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),k=(a,b,c)=>f("/api/comments",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,id:b,content:c})}),l=(a,b)=>g(`/api/comments?cwd=${encodeURIComponent(a)}&id=${encodeURIComponent(b)}`,{method:"DELETE"}),m=a=>g(`/api/comments?cwd=${encodeURIComponent(a)}&all=true`,{method:"DELETE"})},90031:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{s:()=>m});var e=c(48249),f=c(67484),g=c(44384),h=c(44256),i=c(7833),j=c(19593),k=c(55287),l=a([k]);function m({filePath:a,content:b,onClose:c,zClassName:d="z-50"}){let{t:l}=(0,g.Bd)(),[n,o]=(0,f.useState)("table");return(0,e.jsx)(h.ZL,{children:(0,e.jsx)("div",{className:`fixed inset-0 ${d} flex items-center justify-center bg-scrim p-0 md:p-4`,onClick:c,children:(0,e.jsxs)("div",{className:"bg-card shadow-lv3 w-full h-full rounded-none md:max-w-[90%] md:h-[90vh] md:rounded-lg flex flex-col relative overflow-hidden",onClick:a=>a.stopPropagation(),children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3 px-4 py-2 border-b border-border flex-shrink-0",children:[(0,e.jsxs)("span",{className:"text-sm text-muted-foreground truncate min-w-0 flex-1 cursor-pointer hover:text-foreground transition-colors",style:{direction:"rtl",textAlign:"left"},"data-tooltip":a,onClick:()=>{navigator.clipboard.writeText(a),(0,i.oR)(l("common.copiedPath"))},children:["‎",a]}),(0,e.jsx)("div",{className:"flex items-center gap-1 bg-accent rounded p-0.5 flex-shrink-0",children:["table","raw"].map(a=>(0,e.jsx)("button",{onClick:()=>o(a),className:`px-2 py-0.5 text-xs rounded transition-colors ${n===a?"bg-card text-foreground shadow-lv1":"text-muted-foreground hover:text-foreground"}`,children:l(`csv.${a}`)},a))}),(0,e.jsx)("button",{onClick:c,className:"text-muted-foreground hover:text-foreground px-1.5 py-0.5 rounded hover:bg-hover transition-colors flex-shrink-0",children:"✕"})]}),(0,e.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:"table"===n?(0,e.jsx)(j.C0,{content:b,filePath:a,className:"h-full"}):(0,e.jsx)(k.Cv,{content:b,filePath:a,showLineNumbers:!0,showSearch:!0,className:"h-full"})})]})})})}k=(l.then?(await l)():l)[0],d()}catch(a){d(a)}})},91579:(a,b,c)=>{"use strict";c.d(b,{$3:()=>l,Cm:()=>k,Ff:()=>p,Gw:()=>o,RP:()=>m,Un:()=>n,zL:()=>j});var d=c(208),e=c(79606),f=c(33281),g=c(71192),h=c(89800);let i=new Set;function j(a){return i.add(a),()=>i.delete(a)}function k(){i.forEach(a=>a())}async function l(a){let b=await f.t4.runPromiseExit((0,h.lb)(a));if("Success"!==b._tag)throw Error("Failed to fetch comments");let c=b.value.comments??[];if(0===c.length)return[];let d=new Map;for(let a of c)a.selectedText||(d.has(a.filePath)||d.set(a.filePath,[]),d.get(a.filePath).push(a));let i=new Map;await Promise.all(Array.from(d.keys()).map(async b=>{let c=await f.t4.runPromiseExit(e.tryPromise({try:async()=>{let c=await fetch(`/api/files/text?cwd=${encodeURIComponent(a)}&path=${encodeURIComponent(b)}`);return c.ok?await c.json():null},catch:a=>new g.uV({message:`read file text ${b} failed`,cause:a})}));"Success"===c._tag&&c.value&&"string"==typeof c.value.content?i.set(b,c.value.content.split("\n")):"Failure"===c._tag&&console.error(`Failed to read file ${b}:`,c.cause)}));let j=[];for(let a of c){if(a.selectedText){j.push({...a,codeContent:a.selectedText});continue}let b=i.get(a.filePath),c="";if(b){let d=Math.max(0,a.startLine-1),e=Math.min(b.length,a.endLine);c=b.slice(d,e).join("\n")}j.push({...a,codeContent:c})}return j}async function m(a){let b=await f.t4.runPromiseExit((0,h.tj)(a));return"Success"===b._tag?(k(),!0):(console.error("Failed to clear comments:",b.cause),!1)}let n="__chat__";function o(a,b){let c=a.filter(a=>a.filePath===n),e=a.filter(a=>a.filePath!==n),f=[];for(let a of(e.length>0&&(f.push(`${d.A.t("comments.codeRef")}`,""),e.forEach((a,b)=>{let c=a.startLine>0||a.endLine>0?`:${a.startLine}-${a.endLine}`:"";f.push(`[${b+1}] ${a.filePath}${c}`),f.push("```"),f.push(a.codeContent),f.push("```"),a.note&&f.push(d.A.t("comments.note",{content:a.note})),f.push("")})),c)){let b=a.codeContent.split("\n").map(a=>`> ${a}`).join("\n");f.push(b),a.note&&f.push(a.note),f.push("")}if(b.trim()){for(;f.length>0&&""===f[f.length-1];)f.pop();f.push(b.trim())}return f.join("\n").trim()}function p(a,b,c){a(o([b],c))}},91975:(a,b,c)=>{"use strict";c.d(b,{t:()=>h});var d=c(48249),e=c(67484),f=c(36043);let g=96/72;function h({cwd:a,path:b,refreshKey:c}){let k=(0,e.useRef)(null),[l,m]=(0,e.useState)({kind:"loading"}),[n,o]=(0,e.useState)(null),[p,q]=(0,e.useState)(0),[r,s]=(0,e.useState)(null),[t,u]=(0,e.useState)(0),[v,w]=(0,e.useState)({kind:"auto"}),[x,y]=(0,e.useState)(1),[z,A]=(0,e.useState)(!0),B=(0,e.useMemo)(()=>r?.length?Math.max(...r.map(a=>a.w)):0,[r]),C=Math.min(B>0&&t>0?t/B:g,g),D="auto"===v.kind?C:v.factor*g,E=Math.round(D/g*100),F=(0,e.useMemo)(()=>r?r.map(a=>a.h*D+16):[],[r,D]),G=B*D,H=(0,e.useRef)(1);H.current=C/g;let I=(0,e.useRef)(F);I.current=F;let J=(0,f.Te)({count:p,getScrollElement:()=>k.current,estimateSize:a=>I.current[a]??0,overscan:2}),K=(0,e.useCallback)(()=>{let a=k.current;if(!a||0===p)return;let b=a.scrollTop,c=J.getVirtualItems().find(a=>a.end>b);y((c?c.index:p-1)+1)},[J,p]),L=(0,e.useCallback)(a=>{w(b=>({kind:"fixed",factor:Math.min(4,Math.max(.25,("auto"===b.kind?H.current:b.factor)*a))}))},[]),M=(0,e.useCallback)(()=>L(1.2),[L]),N=(0,e.useCallback)(()=>L(.8333333333333334),[L]),O=(0,e.useCallback)(()=>w({kind:"auto"}),[]),P=(0,e.useCallback)(()=>A(a=>!a),[]),Q=(0,e.useCallback)(a=>{J.scrollToIndex(a,{align:"start"}),y(a+1)},[J]),R=J.getVirtualItems(),S=J.getTotalSize(),T=(0,e.useMemo)(()=>(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-border text-muted-foreground text-xs select-none",children:[(0,d.jsx)("button",{onClick:P,className:`px-1.5 py-0.5 rounded hover:bg-hover transition-colors ${z?"text-foreground":""}`,title:z?"Hide thumbnails":"Show thumbnails","aria-label":"Toggle thumbnails",children:(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[(0,d.jsx)("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),(0,d.jsx)("line",{x1:"4",y1:"12",x2:"20",y2:"12"}),(0,d.jsx)("line",{x1:"4",y1:"18",x2:"20",y2:"18"})]})}),(0,d.jsx)("span",{className:"tabular-nums",children:p>0?`${x} / ${p}`:"—"}),(0,d.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[(0,d.jsx)("button",{onClick:N,className:"px-1.5 py-0.5 rounded hover:bg-hover transition-colors",title:"Zoom out","aria-label":"Zoom out",children:"−"}),(0,d.jsxs)("button",{onClick:O,className:`px-1.5 py-0.5 rounded hover:bg-hover transition-colors tabular-nums min-w-[3.5rem] ${"auto"===v.kind?"":"text-foreground"}`,title:"Reset to automatic zoom",children:[E,"%"]}),(0,d.jsx)("button",{onClick:M,className:"px-1.5 py-0.5 rounded hover:bg-hover transition-colors",title:"Zoom in","aria-label":"Zoom in",children:"+"})]})]}),[p,x,E,v.kind,M,N,O,z,P]);return"error"===l.kind?(0,d.jsxs)("div",{className:"h-full flex flex-col bg-secondary",children:[T,(0,d.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,d.jsx)("div",{className:"text-sm text-red-11",children:l.message})})]}):(0,d.jsxs)("div",{className:"h-full flex flex-col bg-secondary",children:[T,(0,d.jsxs)("div",{className:"flex-1 flex min-h-0",children:[z&&n&&r&&(0,d.jsx)(i,{doc:n,numPages:p,sizes:r,maxPageW:B,currentPage:x,onSelect:Q}),(0,d.jsx)("div",{ref:k,onScroll:K,className:"flex-1 overflow-auto px-4 py-4",children:"loading"!==l.kind&&n&&r&&!(G<=0)?(0,d.jsx)("div",{style:{height:S,width:Math.max(G,t),position:"relative"},children:R.map(a=>(0,d.jsx)("div",{"data-index":a.index,className:"absolute left-0 top-0 w-full flex justify-center",style:{transform:`translateY(${a.start}px)`,paddingBottom:16},children:(0,d.jsx)(j,{doc:n,pageNumber:a.index+1,scale:D,width:r[a.index].w*D,height:r[a.index].h*D})},a.key))}):(0,d.jsx)("div",{className:"h-full flex items-center justify-center",children:(0,d.jsx)("span",{className:"inline-block w-6 h-6 border-2 border-brand border-t-transparent rounded-full animate-spin"})})})]})]})}function i({doc:a,numPages:b,sizes:c,maxPageW:g,currentPage:h,onSelect:k}){let l=(0,e.useRef)(null),m=g>0?100/g:0,n=(0,e.useMemo)(()=>c.map(a=>a.h*m+18+12),[c,m]),o=(0,e.useRef)(n);o.current=n;let p=(0,f.Te)({count:b,getScrollElement:()=>l.current,estimateSize:a=>o.current[a]??0,overscan:3}),q=p.getVirtualItems();return(0,d.jsx)("div",{ref:l,className:"shrink-0 overflow-auto border-r border-border py-2",style:{width:132},children:(0,d.jsx)("div",{style:{height:p.getTotalSize(),width:"100%",position:"relative"},children:q.map(b=>{let e=h===b.index+1;return(0,d.jsxs)("div",{className:"absolute left-0 top-0 w-full flex flex-col items-center",style:{transform:`translateY(${b.start}px)`,paddingBottom:12},children:[(0,d.jsx)("button",{onClick:()=>k(b.index),className:`rounded-sm overflow-hidden transition-shadow ${e?"ring-2 ring-brand":"ring-1 ring-border hover:ring-muted-foreground"}`,title:`Page ${b.index+1}`,"aria-label":`Go to page ${b.index+1}`,children:(0,d.jsx)(j,{doc:a,pageNumber:b.index+1,scale:m,width:c[b.index].w*m,height:c[b.index].h*m})}),(0,d.jsx)("span",{className:`mt-0.5 text-[11px] tabular-nums leading-none ${e?"text-foreground font-medium":"text-muted-foreground"}`,style:{height:18},children:b.index+1})]},b.key)})})})}function j({doc:a,pageNumber:b,scale:c,width:f,height:g}){let h=(0,e.useRef)(null);return(0,d.jsx)("div",{className:"bg-white shadow-lv2",style:{width:f,height:g},children:(0,d.jsx)("canvas",{ref:h,className:"block"})})}},92451:(a,b,c)=>{"use strict";c.d(b,{U:()=>g});var d=c(48249),e=c(67484),f=c(19545);function g({editor:a,query:b,position:c,onClose:h}){let[i,j]=(0,e.useState)(0),k=(0,e.useRef)(null),l=(0,f.Qe)().filter(a=>a.label.toLowerCase().includes(b.toLowerCase())||a.description.toLowerCase().includes(b.toLowerCase()));return 0===l.length?null:(0,d.jsx)("div",{ref:k,className:"slash-command-menu fixed z-[60] bg-popover border border-border rounded-lg shadow-lv2 py-1 w-56 max-h-64 overflow-y-auto",style:{top:c.top,left:c.left},children:l.map((c,e)=>(0,d.jsxs)("button",{className:`w-full flex items-center gap-3 px-3 py-2 text-left text-sm transition-colors ${e===i?"bg-accent text-foreground":"text-muted-foreground hover:bg-hover hover:text-foreground"}`,onClick:()=>{a.chain().focus().deleteRange({from:a.state.selection.from-b.length-1,to:a.state.selection.from}).run(),c.action(a),h()},onMouseEnter:()=>j(e),children:[(0,d.jsx)("span",{className:"w-6 text-center text-xs font-mono flex-shrink-0",children:c.icon}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("div",{className:"font-medium",children:c.label}),(0,d.jsx)("div",{className:"text-xs text-muted-foreground",children:c.description})]})]},c.label))})}},92608:(a,b,c)=>{"use strict";c.d(b,{ShareReviewToggle:()=>j});var d=c(48249),e=c(67484),f=c(44384),g=c(7833),h=c(33281),i=c(83120);function j({content:a,sourceFile:b}){let c,k,l,m,n,{t:o}=(0,f.Bd)(),[p,q]=(0,e.useState)(null),[r,s]=(0,e.useState)(!0),[t,u]=(0,e.useState)(!1),v=p?.active===!0,w=(0,e.useCallback)(async()=>{u(!0);let c=b.split("/").pop()||b,d=await h.t4.runPromiseExit((0,i.bx)({title:c,content:a,sourceFile:b}));if("Success"!==d._tag||!d.value.review){(0,g.oR)(o("toast.reviewCreateFailed"),"error"),u(!1);return}let e=d.value.review;q({id:e.id,active:!0,updatedAt:e.updatedAt||e.createdAt});let f=await h.t4.runPromiseExit((0,i._c)()),j="Success"===f._tag&&f.value.shareBase?`${f.value.shareBase}/review/${e.id}`:`${window.location.origin}/review/${e.id}`;try{await navigator.clipboard.writeText(j)}catch{}(0,g.oR)(e.existing?o("toast.reviewUpdated"):o("toast.reviewCreated"),"success"),u(!1)},[a,b,o]),x=(0,e.useCallback)(async()=>{p&&(u(!0),"Success"===(await h.t4.runPromiseExit((0,i.Gm)(p.id,{active:!1})))._tag?(q(a=>a?{...a,active:!1}:null),(0,g.oR)(o("toast.sharingClosed"),"success")):(0,g.oR)(o("toast.sharingCloseFailed"),"error"),u(!1))},[p,o]),y=(0,e.useCallback)(()=>{t||(v?x():w())},[t,v,w,x]),z=(0,e.useCallback)(()=>{p&&window.open(`${window.location.origin}/review/${p.id}`,"_blank")},[p]);return r?null:(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("button",{onClick:y,disabled:t,className:`relative inline-flex h-4 w-7 items-center rounded-full transition-colors ${t?"opacity-50 cursor-wait":"cursor-pointer"} ${v?"bg-green-500":"bg-muted-foreground/30"}`,title:v?o("review.closeSharing"):o("review.enableSharing"),children:(0,d.jsx)("span",{className:`inline-block h-3 w-3 rounded-full bg-white transition-transform ${v?"translate-x-3.5":"translate-x-0.5"}`})}),(0,d.jsx)("span",{className:`text-[11px] ${v?"text-green-600 dark:text-green-400":"text-muted-foreground"}`,children:v?o("review.sharing"):o("review.notShared")}),v&&p&&p.updatedAt&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"text-[10px] text-muted-foreground",children:(k=String((c=new Date(p.updatedAt)).getMonth()+1).padStart(2,"0"),l=String(c.getDate()).padStart(2,"0"),m=String(c.getHours()).padStart(2,"0"),n=String(c.getMinutes()).padStart(2,"0"),`${k}-${l} ${m}:${n}`)}),(0,d.jsx)("button",{onClick:z,className:"text-[11px] text-brand hover:underline",children:o("review.view")})]})]})}},92701:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{K:()=>o});var e=c(48249),f=c(67484),g=c(44384),h=c(44256),i=c(33281),j=c(81206),k=c(23700),l=a([k]);function m(a){return a?a>=1e6?`${(a/1e6).toFixed(1)}M`:a>=1e3?`${(a/1e3).toFixed(1)}k`:String(a):"0"}function n(a){if(!a)return"–";let b=Math.round(a/1e3);if(b<60)return`${b}s`;let c=Math.floor(b/60);return`${c}m${b%60}s`}k=(l.then?(await l)():l)[0];let q={done:"text-green-9",running:"text-brand",queued:"text-muted-foreground",error:"text-red-9",failed:"text-red-9"};function o({cwd:a,sessionId:b,runId:c,isRunning:d,onClose:l}){let{t:q}=(0,g.Bd)(),[r,s]=(0,f.useState)(null),[t,u]=(0,f.useState)(!1),[v,w]=(0,f.useState)(null),x=(0,f.useRef)(void 0),y=d||null!=r&&"completed"!==r.status&&"failed"!==r.status;(0,f.useCallback)(async()=>{let d=await i.t4.runPromiseExit((0,j.z)({cwd:a,sessionId:b,workflowId:c,ifFingerprint:x.current}));if(u(!0),"Success"!==d._tag||!d.value)return;let e=d.value;e.fingerprint&&(x.current=e.fingerprint),!e.notModified&&e.workflow&&s(e.workflow)},[a,b,c]);let z=[];if(r?.agents){let a=new Map;for(let b of r.agents){let c=b.phaseTitle||q("chat.workflowUngrouped");a.has(c)||a.set(c,[]),a.get(c).push(b)}for(let[b,c]of a)z.push({title:b,agents:c})}let A=r?[r.workflowName,r.status,`${r.agentCount??r.agents?.length??0} ${q("chat.workflowAgents")}`,`${m(r.totalTokens)} tok`,n(r.durationMs)].filter(Boolean).join(" \xb7 "):"";return(0,e.jsxs)(h.ZL,{children:[(0,e.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-scrim p-4",onClick:l,children:(0,e.jsxs)("div",{className:"bg-card rounded-lg shadow-lv3 w-full max-w-[90%] h-[90vh] flex flex-col",onClick:a=>a.stopPropagation(),children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-border flex-shrink-0",children:[(0,e.jsx)("span",{className:"text-base",children:"\uD83E\uDDE9"}),(0,e.jsx)("span",{className:"font-medium text-sm text-foreground flex-shrink-0",children:q("chat.workflowRun")}),A&&(0,e.jsx)("span",{className:"text-xs text-muted-foreground truncate flex-1 min-w-0","data-tooltip":A,children:A}),(0,e.jsxs)("span",{className:"ml-auto flex items-center gap-2 flex-shrink-0",children:[y&&(0,e.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-brand border-t-transparent rounded-full animate-spin"}),(0,e.jsx)("button",{onClick:l,className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-hover transition-colors",title:q("common.close"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),(0,e.jsx)("div",{className:"flex-1 overflow-y-auto px-4 py-3",children:null===r?(0,e.jsx)("div",{className:"text-xs text-muted-foreground text-center py-4",children:q(t?"chat.workflowEmpty":"common.loading")}):(0,e.jsxs)(e.Fragment,{children:[r.summary&&(0,e.jsx)("div",{className:"mb-3 text-xs text-muted-foreground whitespace-pre-wrap",children:r.summary}),z.map(a=>(0,e.jsxs)(f.Fragment,{children:[(0,e.jsx)("div",{className:"text-xs font-semibold text-foreground/80 mt-3 mb-1 sticky top-0 bg-card py-1",children:a.title}),a.agents.map(a=>(0,e.jsx)(p,{agent:a,onOpen:()=>a.agentId&&w({runId:c,agentId:a.agentId,label:a.label,running:"done"!==a.state&&y})},`${a.index}-${a.agentId}`))]},a.title))]})})]})}),v&&(0,e.jsx)(k.f,{cwd:a,sessionId:b,workflowRef:v,onClose:()=>w(null)})]})}function p({agent:a,onOpen:b}){let{t:c}=(0,g.Bd)(),[d,h]=(0,f.useState)(!1),i=a.state&&q[a.state]||"text-muted-foreground",j=a.resultPreview||a.promptPreview||"";return(0,e.jsxs)("div",{className:"border border-border rounded-md mb-1",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[(0,e.jsx)("button",{onClick:()=>h(a=>!a),className:"text-foreground-subtle text-xs flex-shrink-0",title:c(d?"chat.collapse":"chat.expand"),children:d?"▲":"▼"}),(0,e.jsx)("span",{className:"text-xs text-foreground truncate flex-1 min-w-0","data-tooltip":a.label||"",children:a.label||a.agentId}),(0,e.jsx)("span",{className:`text-[10px] flex-shrink-0 ${i}`,children:a.state}),(0,e.jsxs)("span",{className:"text-[10px] text-muted-foreground flex-shrink-0",children:[m(a.tokens)," tok \xb7 ",n(a.durationMs)]}),a.agentId&&(0,e.jsx)("span",{role:"button",tabIndex:0,onClick:b,onKeyDown:a=>{("Enter"===a.key||" "===a.key)&&b()},className:"text-xs text-brand hover:text-teal-10 cursor-pointer flex-shrink-0",title:c("chat.subagentViewTitle"),children:c("chat.workflowViewAgent")})]}),d&&j&&(0,e.jsx)("pre",{className:"text-[11px] bg-secondary px-2 py-1.5 rounded-b overflow-x-auto max-h-32 overflow-y-auto text-muted-foreground whitespace-pre-wrap border-t border-border",children:j})]})}d()}catch(a){d(a)}})},93448:(a,b,c)=>{"use strict";c.d(b,{TabManagerTopBar:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call TabManagerTopBar() from the server but TabManagerTopBar is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/TabManagerTopBar.tsx","TabManagerTopBar")},94192:(a,b,c)=>{"use strict";c.d(b,{R8:()=>i,c0:()=>k,fY:()=>j,gT:()=>l});var d=c(48249),e=c(67484);let f=["agent","explorer","console"],g={agent:"AGENT",explorer:"EXPLORER",console:"CONSOLE"},h=(0,e.createContext)(null);function i(){let a=(0,e.useContext)(h);if(!a)throw Error("useSwipeContext must be used within SwipeableViewContainer");return a}function j({activeView:a,onViewChange:b,children:c}){(0,e.useRef)(null),(0,e.useRef)(!1),(0,e.useRef)(0);let[g,i]=(0,e.useState)(0),[k,l]=(0,e.useState)(!1);f.indexOf(a),f.length;let[m,n]=(0,e.useState)(!1),o={activeView:a,onViewChange:b,dragOffset:(()=>{if(!m)return 0;let a=window.innerWidth;return a?g/a:0})(),isDragging:m&&k};return(0,d.jsx)(h.Provider,{value:o,children:c})}function k({children:a}){let b,c,{activeView:g,dragOffset:h,isDragging:j}=i(),l=(0,e.useRef)(null),m=(0,e.useRef)(null),n=f.indexOf(g),o=f.length;return(0,d.jsx)("div",{ref:l,className:"flex-1 overflow-hidden relative",style:{overscrollBehaviorX:"none"},children:(0,d.jsx)("div",{ref:m,className:j?"flex":"flex transition-transform duration-100 ease-out",style:{position:"absolute",top:"0px",bottom:"0px",left:"0px",width:`${100*f.length}%`,transform:(b=h/o*100,c=-(100/o*n)+(Number.isFinite(b)?b:0),`translateX(${c}%)`)},children:a})})}function l(){let{activeView:a,onViewChange:b,dragOffset:c,isDragging:h}=i(),j=(0,e.useRef)(null),k=(0,e.useRef)([]),[l,m]=(0,e.useState)({left:0,width:0}),n=f.indexOf(a),o=Number.isFinite(c)?c:0,p=Math.round(Math.max(0,Math.min(f.length-1,n-o)));return(0,d.jsxs)("div",{ref:j,className:"relative flex gap-4",children:[f.map((a,c)=>(0,d.jsx)("button",{ref:a=>{k.current[c]=a},onClick:()=>b(a),className:`px-4 py-1 text-sm font-medium transition-colors ${p===c?"text-brand":"text-muted-foreground hover:text-foreground"}`,children:g[a]},a)),(0,d.jsx)("div",{className:`absolute bottom-0 h-0.5 bg-brand ${h?"":"transition-all duration-100 ease-out"}`,style:{left:l.left,width:l.width}})]})}},94239:(a,b,c)=>{"use strict";c.d(b,{c:()=>j});var d=c(48249),e=c(67484),f=c(44384),g=c(61591),h=c(44256);function i({path:a,matchedIndices:b}){let c=(0,e.useMemo)(()=>new Set(b),[b]),f=a.lastIndexOf("/"),g=f>=0?a.slice(0,f+1):"",h=f>=0?a.slice(f+1):a,j=(a,b,e)=>{let f=[],g="",h=!1;for(let e=0;e<a.length;e++){let i=b+e,j=c.has(i);j!==h&&g&&(f.push(h?(0,d.jsx)("span",{className:"text-brand font-medium",children:g},`${b}-${e}`):(0,d.jsx)("span",{children:g},`${b}-${e}`)),g=""),h=j,g+=a[e]}return g&&f.push(h?(0,d.jsx)("span",{className:"text-brand font-medium",children:g},`${b}-end`):(0,d.jsx)("span",{children:g},`${b}-end`)),(0,d.jsx)("span",{className:e,children:f})};return(0,d.jsxs)("span",{className:"truncate",children:[g&&j(g,0,"text-muted-foreground"),j(h,g.length,"text-foreground")]})}function j({files:a,fileIndex:b,recentFiles:c,onSelectFile:k,onClose:l}){let{t:m}=(0,f.Bd)(),[n,o]=(0,e.useState)(""),[p,q]=(0,e.useState)(0),r=(0,e.useRef)(null),s=(0,e.useRef)(null),t=(0,e.useMemo)(()=>{let c,d;return b??(c=[],(d=a=>{for(let b of a)b.isDirectory&&b.children?d(b.children):b.isDirectory||c.push(b.path)})(a),c)},[b,a]),u=(0,e.useMemo)(()=>{if(!n.trim()){let a=new Set(c);return[...c.map(a=>({path:a,score:0,matchedIndices:[]})),...t.filter(b=>!a.has(b)).slice(0,50).map(a=>({path:a,score:0,matchedIndices:[]}))]}let a=[];for(let b of t){let d=function(a,b){let c=a.toLowerCase(),d=b.toLowerCase(),e=[],f=0,g=0,h=-1;for(let i=0;i<c.length&&f<d.length;i++)c[i]===d[f]&&(e.push(i),h===i-1&&(g+=5),(0===i||"/"===a[i-1]||"."===a[i-1]||"-"===a[i-1]||"_"===a[i-1])&&(g+=10),i>a.lastIndexOf("/")&&(g+=3),a[i]===b[f]&&(g+=1),h=i,f++);return f<d.length?null:(g-=.1*a.length,{path:a,score:g,matchedIndices:e})}(b,n.trim());d&&(c.includes(b)&&(d.score+=20),a.push(d))}return a.sort((a,b)=>b.score-a.score),a.slice(0,50)},[n,t,c]),v=(0,e.useCallback)(a=>{o(a),q(0)},[]),w=(0,e.useCallback)(a=>{k(a),l()},[k,l]),x=(0,e.useCallback)(a=>{if(!a.nativeEvent.isComposing)switch(a.key){case"ArrowDown":a.preventDefault(),q(a=>Math.min(a+1,u.length-1));break;case"ArrowUp":a.preventDefault(),q(a=>Math.max(a-1,0));break;case"Enter":a.preventDefault(),u[p]&&w(u[p].path);break;case"Escape":a.preventDefault(),l()}},[u,p,w,l]);return(0,d.jsx)(h.ZL,{children:(0,d.jsx)("div",{className:"fixed inset-0 z-[300] flex items-start justify-center pt-[15vh]",onClick:l,children:(0,d.jsxs)("div",{className:"w-[680px] max-h-[60vh] bg-card border border-border rounded-lg shadow-lv3 overflow-hidden flex flex-col",onClick:a=>a.stopPropagation(),children:[(0,d.jsxs)("div",{className:"px-3 py-2 border-b border-border flex items-center gap-2",children:[(0,d.jsx)("svg",{className:"w-4 h-4 text-muted-foreground flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),(0,d.jsx)("input",{ref:r,value:n,onChange:a=>v(a.target.value),onKeyDown:x,placeholder:m("quickFileOpen.placeholder"),className:"flex-1 bg-transparent text-sm text-foreground outline-none",autoComplete:"off",autoCorrect:"off",spellCheck:"false"}),(0,d.jsx)("kbd",{className:"text-[10px] text-muted-foreground px-1.5 py-0.5 rounded border border-border bg-secondary",children:"ESC"})]}),(0,d.jsx)("div",{ref:s,className:"flex-1 overflow-y-auto py-1",children:0===u.length?(0,d.jsx)("div",{className:"px-3 py-8 text-center text-sm text-muted-foreground",children:m("quickFileOpen.noMatch")}):u.map((a,b)=>(0,d.jsxs)("div",{className:`px-3 py-1.5 flex items-center gap-2 cursor-pointer transition-colors ${b===p?"bg-brand/15 text-foreground":"hover:bg-hover text-foreground"}`,"data-tooltip":a.path,onClick:()=>w(a.path),children:[(0,d.jsx)(g.o,{name:a.path.split("/").pop()||"",className:"w-4 h-4 flex-shrink-0"}),(0,d.jsx)(i,{path:a.path,matchedIndices:a.matchedIndices}),!n.trim()&&c.includes(a.path)&&(0,d.jsx)("span",{className:"ml-auto text-[10px] text-muted-foreground px-1.5 py-0.5 rounded bg-secondary flex-shrink-0",children:m("quickFileOpen.recent")})]},a.path))}),(0,d.jsxs)("div",{className:"px-3 py-1.5 border-t border-border flex items-center gap-3 text-[10px] text-muted-foreground",children:[(0,d.jsxs)("span",{className:"flex items-center gap-1",children:[(0,d.jsx)("kbd",{className:"px-1 py-0.5 rounded border border-border bg-secondary",children:"↑↓"})," ",m("quickFileOpen.selectHint")]}),(0,d.jsxs)("span",{className:"flex items-center gap-1",children:[(0,d.jsx)("kbd",{className:"px-1 py-0.5 rounded border border-border bg-secondary",children:"Enter"})," ",m("quickFileOpen.openHint")]}),(0,d.jsxs)("span",{className:"flex items-center gap-1",children:[(0,d.jsx)("kbd",{className:"px-1 py-0.5 rounded border border-border bg-secondary",children:"Esc"})," ",m("quickFileOpen.closeHint")]})]})]})})})}},94308:(a,b,c)=>{"use strict";c.d(b,{e:()=>g});var d=c(48249),e=c(67484),f=c(44384);function g({branches:a,selectedBranch:b,onSelect:c,isLoading:h,pinnedBranches:i=[]}){let{t:j}=(0,f.Bd)(),[k,l]=(0,e.useState)(!1),[m,n]=(0,e.useState)(""),o=(0,e.useRef)(null),p=(0,e.useRef)(null),q=m.toLowerCase(),r=new Set([...a?.local||[],...a?.remote||[]]),s=i.filter(a=>r.has(a)&&a.toLowerCase().includes(q)),t=new Set(s),u=a?.local.filter(a=>!t.has(a)&&a.toLowerCase().includes(q))||[],v=a?.remote.filter(a=>!t.has(a)&&a.toLowerCase().includes(q))||[],w=a=>{c(a),l(!1),n("")};return(0,d.jsxs)("div",{className:"relative",ref:o,children:[(0,d.jsxs)("button",{onClick:()=>l(!k),disabled:h,className:"w-full px-3 py-1.5 text-sm border border-border rounded bg-card text-foreground text-left flex items-center justify-between hover:border-slate-6 dark:hover:border-slate-6 transition-colors",children:[(0,d.jsxs)("span",{className:"truncate flex items-center gap-2",children:[(0,d.jsx)("svg",{className:"w-4 h-4 text-muted-foreground flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),b||j("git.selectBranch"),a?.current===b&&(0,d.jsxs)("span",{className:"text-xs text-green-11",children:["(",j("git.currentBranch"),")"]})]}),(0,d.jsx)("svg",{className:`w-4 h-4 text-foreground-subtle transition-transform ${k?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),k&&(0,d.jsxs)("div",{className:"absolute z-50 mt-1 w-full bg-card border border-border rounded-lg shadow-lv2 max-h-80 flex flex-col",children:[(0,d.jsx)("div",{className:"p-2 border-b border-border",children:(0,d.jsx)("input",{ref:p,type:"text",value:m,onChange:a=>n(a.target.value),placeholder:j("git.searchBranch"),className:"w-full px-2 py-1 text-sm border border-border rounded bg-secondary text-foreground"})}),(0,d.jsxs)("div",{className:"overflow-y-auto flex-1",children:[s.length>0&&s.map(c=>(0,d.jsxs)("div",{onClick:()=>w(c),className:`px-3 py-1.5 text-sm cursor-pointer flex items-center gap-2 ${c===b?"bg-brand/10 text-brand":"hover:bg-hover text-foreground"}`,children:[(0,d.jsx)("span",{className:"truncate flex-1",children:c}),c===a?.current&&(0,d.jsx)("span",{className:"text-xs text-green-11 flex-shrink-0",children:j("git.currentBranch")}),c===b&&(0,d.jsx)("svg",{className:"w-4 h-4 text-brand flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]},`pinned-${c}`)),u.length>0&&(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"px-3 py-1 text-xs font-medium text-muted-foreground bg-popover sticky top-0",children:j("git.localBranches")}),u.map(c=>(0,d.jsxs)("div",{onClick:()=>w(c),className:`px-3 py-1.5 text-sm cursor-pointer flex items-center gap-2 ${c===b?"bg-brand/10 text-brand":"hover:bg-hover text-foreground"}`,children:[(0,d.jsx)("span",{className:"truncate flex-1",children:c}),c===a?.current&&(0,d.jsx)("span",{className:"text-xs text-green-11 flex-shrink-0",children:j("git.currentBranch")}),c===b&&(0,d.jsx)("svg",{className:"w-4 h-4 text-brand flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]},c))]}),v.length>0&&(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"px-3 py-1 text-xs font-medium text-muted-foreground bg-popover sticky top-0",children:j("git.remoteBranches")}),v.map(a=>(0,d.jsxs)("div",{onClick:()=>w(a),className:`px-3 py-1.5 text-sm cursor-pointer flex items-center gap-2 ${a===b?"bg-brand/10 text-brand":"hover:bg-hover text-foreground"}`,children:[(0,d.jsx)("span",{className:"truncate flex-1",children:a}),a===b&&(0,d.jsx)("svg",{className:"w-4 h-4 text-brand flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]},a))]}),0===s.length&&0===u.length&&0===v.length&&(0,d.jsx)("div",{className:"px-3 py-4 text-sm text-muted-foreground text-center",children:j("git.noMatchingBranches")})]})]})]})}},95401:(a,b,c)=>{"use strict";c.d(b,{m:()=>k});var d=c(48249),e=c(67484),f=c(44256),g=c(33281),h=c(63565),i=c(41224);function j(a){return"env"===a?"from env var":"default"===a?"default":null}function k({currentModel:a,onModelChange:b}){let[c,l]=(0,e.useState)(!1),[m,n]=(0,e.useState)([]),[o,p]=(0,e.useState)(!1),[q,r]=(0,e.useState)(null),[s,t]=(0,e.useState)(!1),[u,v]=(0,e.useState)(!1),[w,x]=(0,e.useState)(!1),[y,z]=(0,e.useState)(null),[A,B]=(0,e.useState)(""),[C,D]=(0,e.useState)("default"),[E,F]=(0,e.useState)(!1),[G,H]=(0,e.useState)(""),[I,J]=(0,e.useState)("default"),[K,L]=(0,e.useState)(""),[M,N]=(0,e.useState)(!1),O=(0,e.useRef)(null),P=(0,e.useRef)(null),Q=(0,e.useRef)(null),[R,S]=(0,e.useState)({top:0,left:0}),T=(0,f.F2)(),U=(0,e.useCallback)(async()=>{p(!0),r(null);let a=await g.t4.runPromiseExit((0,i.qD)(()=>t(!0)));if(t(!1),"Failure"===a._tag)r("Connection error");else{let b=a.value;switch(b._tag){case"ok":n(b.models);break;case"not-installed":case"error":r(b.message);break;case"not-running":r("Ollama is not running")}}p(!1)},[]),V=(0,e.useCallback)(a=>{B(a.baseUrl),D(a.baseUrlSource),F(a.hasKey),H(a.maskedKey),J(a.keySource),L(""),N(!1)},[]),W=(0,e.useCallback)(async()=>{v(!0),z(null);let a=await g.t4.runPromiseExit((0,i.F4)());"Failure"===a._tag?z("Failed to load config"):V(a.value),v(!1)},[V]),X=async()=>{x(!0),z(null);let a=await g.t4.runPromiseExit((0,i.yS)({baseUrl:A}));"Failure"===a._tag?z("Save failed"):(V(a.value),await U()),x(!1)},Y=async()=>{let a=K.trim();if(!a)return;x(!0),z(null);let b=await g.t4.runPromiseExit((0,i.yS)({apiKey:a}));"Failure"===b._tag?z("Save failed"):V(b.value),x(!1)},Z=async()=>{x(!0),z(null);let a=await g.t4.runPromiseExit((0,i.yS)({apiKey:""}));"Failure"===a._tag?z("Clear failed"):V(a.value),x(!1)},$=a?a.replace(/:latest$/,""):"Select model",_=j(C),aa=j(I),ab=c?(0,d.jsx)(f.ZL,{children:(0,d.jsxs)("div",{ref:P,className:`${h.ys} min-w-[300px]`,style:{top:R.top,left:R.left},children:[(0,d.jsxs)("div",{className:"px-3 py-1.5",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-1.5",children:[(0,d.jsx)("span",{className:"text-[11px] font-medium text-muted-foreground",children:"Server URL"}),_&&!u&&(0,d.jsx)("span",{className:"text-[10px] text-muted-foreground/70",children:_})]}),u?(0,d.jsxs)("div",{className:"flex items-center gap-2 py-1 text-xs text-muted-foreground",children:[(0,d.jsx)("span",{className:"w-3 h-3 border border-brand border-t-transparent rounded-full animate-spin"}),"Loading..."]}):(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("input",{type:"text",value:A,onChange:a=>B(a.target.value),onKeyDown:a=>{"Enter"===a.key&&X()},placeholder:"http://127.0.0.1:11434",spellCheck:!1,className:`flex-1 min-w-0 text-xs px-2 py-1 rounded bg-secondary text-foreground border border-border focus:outline-none font-mono ${h.Fx}`}),(0,d.jsx)("button",{onClick:X,disabled:w,className:`text-[11px] px-2 py-1 rounded transition-colors disabled:opacity-40 disabled:cursor-not-allowed ${h.$T}`,children:w?"...":"Save"})]})]}),(0,d.jsxs)("div",{className:"px-3 py-1.5",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-1.5",children:[(0,d.jsx)("span",{className:"text-[11px] font-medium text-muted-foreground",children:"API Key"}),aa&&E&&!u&&(0,d.jsx)("span",{className:"text-[10px] text-muted-foreground/70",children:aa})]}),u?null:E&&!M?(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("code",{className:"flex-1 min-w-0 truncate text-xs px-2 py-1 rounded bg-secondary text-foreground font-mono",children:G}),(0,d.jsx)("button",{onClick:()=>{N(!0),L(""),setTimeout(()=>Q.current?.focus(),0)},className:"text-[11px] px-2 py-1 rounded bg-secondary hover:bg-hover text-foreground transition-colors",disabled:w,children:"Edit"}),(0,d.jsx)("button",{onClick:Z,className:"text-[11px] px-2 py-1 rounded text-red-11 hover:bg-red-500/10 transition-colors",disabled:w,children:"Clear"})]}):(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("input",{ref:Q,type:"password",value:K,onChange:a=>L(a.target.value),onKeyDown:a=>{"Enter"===a.key&&Y()},placeholder:"optional — for authenticated servers",spellCheck:!1,className:`flex-1 min-w-0 text-xs px-2 py-1 rounded bg-secondary text-foreground border border-border focus:outline-none font-mono ${h.Fx}`}),(0,d.jsx)("button",{onClick:Y,disabled:w||!K.trim(),className:`text-[11px] px-2 py-1 rounded transition-colors disabled:opacity-40 disabled:cursor-not-allowed ${h.$T}`,children:w?"...":"Save"}),E&&(0,d.jsx)("button",{onClick:()=>{N(!1),L("")},className:"text-[11px] px-2 py-1 rounded text-muted-foreground hover:text-foreground transition-colors",children:"Cancel"})]}),y&&(0,d.jsx)("div",{className:"mt-1 text-[11px] text-red-11",children:y})]}),(0,d.jsx)("div",{className:"my-1 border-t border-border"}),(0,d.jsx)("div",{className:"px-3 pt-1 pb-0.5",children:(0,d.jsx)("span",{className:"text-[11px] font-medium text-muted-foreground",children:"Model"})}),(0,d.jsx)("div",{className:"max-h-[240px] overflow-y-auto",children:o||s?(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 text-xs text-muted-foreground",children:[(0,d.jsx)("span",{className:"w-3 h-3 border border-brand border-t-transparent rounded-full animate-spin"}),s?"Starting Ollama...":"Loading models..."]}):q?(0,d.jsx)("div",{className:"px-3 py-2 text-xs text-red-11",children:q}):0===m.length?(0,d.jsxs)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:["No models found. Run ",(0,d.jsx)("code",{className:"bg-secondary px-1 rounded",children:"ollama pull <model>"})]}):m.map(c=>{var e;let f=c.name===a;return(0,d.jsxs)("button",{onClick:()=>{b(c.name),l(!1)},className:`w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors ${f?h.yI:"text-foreground hover:bg-hover"}`,children:[(0,d.jsx)(h.hG,{selected:f}),(0,d.jsx)("span",{className:"truncate",children:c.name.replace(/:latest$/,"")}),(0,d.jsx)("span",{className:"ml-auto pl-2 text-muted-foreground flex-shrink-0",children:c.parameter_size||((e=c.size)<1e9?`${(e/1e6).toFixed(0)}M`:`${(e/1e9).toFixed(1)}G`)})]},c.name)})})]})}):null;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.XY,{buttonRef:O,label:$,title:"Configure Ollama",onClick:()=>{if(!c){if(O.current){let a=O.current.getBoundingClientRect(),b=T?.getBoundingClientRect(),c=b?.left??0,d=b?.top??0;S({top:a.bottom+4-d,left:a.left-c})}W(),U()}l(a=>!a)},icon:(0,d.jsx)(h.eV,{engine:"ollama"}),testId:"ollama-config-picker"}),ab]})}},97572:(a,b,c)=>{"use strict";c.d(b,{g:()=>g,v:()=>f});var d=c(79606),e=c(71192);let f=d.tryPromise({try:async()=>{let a=await fetch("/api/projects");if(!a.ok)throw Error(`HTTP ${a.status}`);return await a.json()},catch:a=>new e.uV({message:"fetch /api/projects failed",cause:a})}),g=a=>d.tryPromise({try:async()=>{let b=await fetch("/api/projects",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(a)});if(!b.ok)throw Error(`HTTP ${b.status}`)},catch:a=>new e.uV({message:"save /api/projects failed",cause:a})})},97951:(a,b,c)=>{"use strict";c.d(b,{e:()=>i});var d=c(67484),e=c(85943),f=c(25414),g=c(208),h=c(29939);function i(a,b,{sessionId:c,cwd:j,engine:k,planMode:l,noHistory:m,ollamaModel:n,engineModel:o,claudeModel:p,claudeEffort:q,claudeContextWindow:r,claudeFastMode:s,claudeThinking:t,codexModel:u,codexReasoningEffort:v,onSessionId:w,onFetchTitle:x,onRunComplete:y}){let[z,A]=(0,d.useState)(!1),[B,C]=(0,d.useState)(null),[D,E]=(0,d.useState)(null),[F,G]=(0,d.useState)(null),[H,I]=(0,d.useState)(null),[J,K]=(0,d.useState)(null),L=(0,d.useRef)(null),[M,N]=(0,d.useState)(null),O=(0,d.useRef)(M);O.current=M;let P=(0,d.useRef)(!1),Q=(0,d.useRef)(y);Q.current=y;let R=(0,d.useRef)(!1),S=(0,d.useRef)(null),T=(0,d.useRef)(c);T.current=c;let U=(0,d.useRef)(null),V=(0,d.useRef)(null),W=(0,d.useRef)(null),X=(0,d.useRef)(!1),Y=(0,d.useRef)(!1),Z=(0,d.useRef)(0),$=(0,d.useCallback)(()=>{let a=U.current;if(a&&a.text){let{messageId:c,text:d}=a;b(a=>(0,f.F)(a,{type:"stream_event",event:{type:"content_block_delta",delta:{type:"text_delta",text:d}}},{engine:k,assistantId:c})),U.current={messageId:c,text:""}}V.current=null},[b,k]),_=(0,d.useCallback)(()=>{V.current&&(clearTimeout(V.current),V.current=null),S.current&&(clearTimeout(S.current),S.current=null),$(),A(!1),E(null),G(null);let a=O.current,c=W.current;a&&b(b=>b.map(b=>b.id===a.assistantId||b.id===c?{...b,isStreaming:!1}:b)),N(null),Q.current?.()},[$,b]),aa=(0,d.useCallback)(()=>{let a=O.current;fetch("/api/chat/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:T.current,runId:a?.runKey})}).catch(()=>{}),_()},[_]),ab=(0,d.useCallback)((a,c)=>{let d=a.type,h=a=>{if(P.current||"string"!=typeof a||!a)return;let b=(0,e.r)(a);E(a=>({outputTokens:(a?.outputTokens||0)+b}))};if("system"===d&&"init"===a.subtype){let c=a.session_id,d=X.current;if(w(c),T.current=c,d||(G(a=>a??Date.now()),E(null),P.current=!1),K(null),d){let a=`auto-asst-${++Z.current}`;W.current=a,b(b=>[...b,{id:a,role:"assistant",content:"",toolCalls:[],isStreaming:!0,runKey:O.current?.runKey,runId:O.current?.runId}])}Y.current=!0;return}if("system"===d&&"task_notification"===a.subtype){if(!Y.current){let c=a.status,d=a.summary||"",e=a.task_id,f=`<task-notification>