zen-gitsync 2.17.10 → 2.17.12

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 (93) hide show
  1. package/README.md +34 -0
  2. package/package.json +3 -1
  3. package/src/ui/public/assets/AgentView-BNH92bKu.js +5 -0
  4. package/src/ui/public/assets/AppVersionBadge-DXWTExsY.js +2 -0
  5. package/src/ui/public/assets/BranchSelector-CJI-I8JY.js +1 -0
  6. package/src/ui/public/assets/CommitForm-CTYhgpkj.js +6 -0
  7. package/src/ui/public/assets/CommonDialog-DNnN70HC.js +1 -0
  8. package/src/ui/public/assets/EditorView-C2AbXelw.js +1 -0
  9. package/src/ui/public/assets/FileDiffViewer-ZD705xXx.js +14 -0
  10. package/src/ui/public/assets/{FlowExecutionViewer-BgEt5_Hz.js → FlowExecutionViewer-BP9w_OQb.js} +1 -1
  11. package/src/ui/public/assets/FlowOrchestrationWorkspace-DeSI8Mlj.js +21 -0
  12. package/src/ui/public/assets/IconButton-BxRsG5E1.js +1 -0
  13. package/src/ui/public/assets/LogList-1sIFUx4e.js +7 -0
  14. package/src/ui/public/assets/MindmapView-6_fbvhh3.js +1 -0
  15. package/src/ui/public/assets/MonitorView-CURagJDe.js +1 -0
  16. package/src/ui/public/assets/ProjectStartupButton-COyb4Fbk.js +1 -0
  17. package/src/ui/public/assets/RemoteManagerDialog-DoS9EWQr.js +1 -0
  18. package/src/ui/public/assets/RemoteRepoCard-BwrdI5UH.js +1 -0
  19. package/src/ui/public/assets/SourceMapView-DADzBGfb.js +3 -0
  20. package/src/ui/public/assets/SvgIcon-VCh_kGGV.js +1 -0
  21. package/src/ui/public/assets/TemplateManager-C4go4RZu.js +1 -0
  22. package/src/ui/public/assets/UserInputNode-Cl5-bI42.js +1 -0
  23. package/src/ui/public/assets/WorkbenchView-B8QOp8nM.css +1 -0
  24. package/src/ui/public/assets/WorkbenchView-DtCyyW3b.js +6 -0
  25. package/src/ui/public/assets/_plugin-vue_export-helper-Dcylt9fO.js +19 -0
  26. package/src/ui/public/assets/{configStore-BLRcYJdf.js → configStore-BlqdtNUA.js} +1 -1
  27. package/src/ui/public/assets/element-plus-C1PloHQu.css +1 -0
  28. package/src/ui/public/assets/{element-plus-DcZ-TVp6.js → element-plus-IG-bwpR5.js} +6 -6
  29. package/src/ui/public/assets/flow-mindmap-C_w8GJXm.js +139 -0
  30. package/src/ui/public/assets/{gitStore-DMEDMZMk.js → gitStore-BKkZm2m3.js} +4 -4
  31. package/src/ui/public/assets/index-Bq7iCtof.css +1 -0
  32. package/src/ui/public/assets/index-DGHrUfrh.js +28 -0
  33. package/src/ui/public/assets/{office-docx-C0g5Oepv.js → office-docx-CkLOvV7H.js} +5 -5
  34. package/src/ui/public/assets/{office-excel-D-uYLKaA.js → office-excel-CDjN3Va1.js} +1 -1
  35. package/src/ui/public/assets/{office-pptx-De3fnc6M.js → office-pptx-CVu3fXsL.js} +1 -1
  36. package/src/ui/public/assets/previewSandbox-DYMhXJ91.js +0 -0
  37. package/src/ui/public/assets/toolsStore-BlRHNqXl.js +1 -0
  38. package/src/ui/public/assets/{useThemeObserver-CG8k8U18.js → useThemeObserver-DAWKXvWv.js} +1 -1
  39. package/src/ui/public/assets/{vendor-BIgZEtkx.js → vendor-DcK6TCKZ.js} +27 -27
  40. package/src/ui/public/assets/vue-flow-B3gZmkCI.js +39 -0
  41. package/src/ui/public/index.html +18 -18
  42. package/src/ui/server/index.js +8 -0
  43. package/src/ui/server/routes/recentDirectoriesAiSummary.js +288 -0
  44. package/src/ui/server/routes/recentDirectoriesAiSummary.test.js +208 -0
  45. package/src/ui/server/routes/remoteRepos.js +117 -21
  46. package/src/ui/server/routes/remoteRepos.test.js +167 -1
  47. package/src/ui/server/routes/workbench/agentChat.js +9 -3
  48. package/src/ui/server/routes/workbench/agentParity.test.js +16 -0
  49. package/src/ui/server/routes/workbench/agentSessionStore.js +2 -2
  50. package/src/ui/server/routes/workbench/envContext.test.js +8 -8
  51. package/src/ui/server/routes/workbench/index.js +32 -736
  52. package/src/ui/server/routes/workbench/instructionStore.js +3 -113
  53. package/src/ui/server/routes/workbench/jobStore.js +2 -4
  54. package/src/ui/server/routes/workbench/jobStore.test.js +1 -1
  55. package/src/ui/server/routes/workbench/jsonParse.js +6 -143
  56. package/src/ui/server/routes/workbench/orchestratorStore.js +1 -8
  57. package/src/ui/server/routes/workbench/projectRegistry.js +6 -29
  58. package/src/ui/server/routes/workbench/projectRegistry.test.js +33 -56
  59. package/src/ui/server/routes/workbench/projectTool.js +0 -1
  60. package/src/ui/server/routes/workbench/projectTool.test.js +2 -3
  61. package/src/ui/server/routes/workbench/shared.js +2 -7
  62. package/src/ui/server/routes/workbench/taskRunner.js +18 -180
  63. package/src/ui/server/routes/workbench.js +4 -5
  64. package/src/ui/public/assets/AgentView-C-AJo7KS.js +0 -5
  65. package/src/ui/public/assets/AppVersionBadge-B6R6eN2N.js +0 -2
  66. package/src/ui/public/assets/BranchSelector-Cj3kMWON.js +0 -1
  67. package/src/ui/public/assets/CommitForm-DpXuFG-F.js +0 -6
  68. package/src/ui/public/assets/CommonDialog-BLPHDsn0.js +0 -1
  69. package/src/ui/public/assets/EditorView-B1OnoXXf.js +0 -1
  70. package/src/ui/public/assets/FileDiffViewer-BQl0JcWd.js +0 -14
  71. package/src/ui/public/assets/FlowOrchestrationWorkspace-CbLmsSF8.js +0 -21
  72. package/src/ui/public/assets/IconButton-aM3vaSIN.js +0 -1
  73. package/src/ui/public/assets/LogList-UjoVFZ-H.js +0 -7
  74. package/src/ui/public/assets/MindmapView-D_04v0n4.js +0 -1
  75. package/src/ui/public/assets/MonitorView-BD1_uzq7.js +0 -1
  76. package/src/ui/public/assets/ProjectStartupButton-BTYlVvzh.js +0 -1
  77. package/src/ui/public/assets/RemoteManagerDialog-20mpQMwu.js +0 -1
  78. package/src/ui/public/assets/RemoteRepoCard-DOrm17Xd.js +0 -1
  79. package/src/ui/public/assets/SourceMapView-nUU9bYPh.js +0 -3
  80. package/src/ui/public/assets/SvgIcon-LUynX3Iq.js +0 -1
  81. package/src/ui/public/assets/TemplateManager-Bo3Q7J9Y.js +0 -1
  82. package/src/ui/public/assets/UserInputNode-D5tSXiJz.js +0 -1
  83. package/src/ui/public/assets/WorkbenchView-C_Gmzvj1.css +0 -1
  84. package/src/ui/public/assets/WorkbenchView-UGC334JL.js +0 -13
  85. package/src/ui/public/assets/_plugin-vue_export-helper-D-D9qkRz.js +0 -19
  86. package/src/ui/public/assets/element-plus-BWbXh9mk.css +0 -1
  87. package/src/ui/public/assets/flow-mindmap-D1VTkZh3.js +0 -139
  88. package/src/ui/public/assets/index-CW3xs-af.css +0 -1
  89. package/src/ui/public/assets/index-S0_gRyiO.js +0 -26
  90. package/src/ui/public/assets/previewSandbox-DXAxqDVu.js +0 -0
  91. package/src/ui/public/assets/toolsStore-CpImRUhI.js +0 -1
  92. package/src/ui/public/assets/vue-flow-CPCFgenl.js +0 -39
  93. package/src/ui/server/routes/workbench/sessionStore.js +0 -126
package/README.md CHANGED
@@ -10,6 +10,7 @@ A Git automation platform with interactive commits, scheduled sync, custom comma
10
10
  - [What's New](#v2xx--whats-new)
11
11
  - [GUI](#gui)
12
12
  - [Core Git Panel](#core-git-panel)
13
+ - [GitHub / Gitee Repositories](#github--gitee-repositories)
13
14
  - [Branch Management](#branch-management)
14
15
  - [Remote Management](#remote-management)
15
16
  - [Stash Management](#stash-management)
@@ -44,6 +45,7 @@ npm install -g zen-gitsync
44
45
  - **Visual GUI** — Full graphical interface for Git operations
45
46
  - **Branch management** — Create, switch, and track local/remote branches
46
47
  - **Remote management** — Manage multiple remotes (add / rename / retarget / delete) from one dialog, configure multi push URLs, and push to a chosen remote or to all remotes at once
48
+ - **Repository browser** — GitHub / Gitee tabs listing every repository your CLI account can see (private ones included), with search, sorting (recently pushed / recently created / most starred / name) and cards that carry last-push date, fork count, default branch and license
47
49
  - **Stash management** — Save and restore stashes with locked-file filtering
48
50
  - **Tag management** — Create lightweight and annotated tags
49
51
  - **Merge support** — Detect and complete in-progress merges
@@ -160,6 +162,19 @@ In either mode, click **AI Generate** to fill in the fields automatically based
160
162
 
161
163
  ---
162
164
 
165
+ ### GitHub / Gitee Repositories
166
+
167
+ > The Git view has three tabs: **当前项目** (current project), **GitHub 仓库**, and **Gitee 仓库**. The latter two list every repository your `gh` / `gitee` account can see — private ones included. ZenGitSync never touches your token: both panels shell out to the official CLI (`gh`, `@gitee/gitee-cli`), which keeps its own credentials.
168
+
169
+ - **Zero-config guidance** — a missing CLI shows the install command for your platform (winget / Homebrew / `npm install -g @gitee/gitee-cli`) with one-click install and auto-refresh; an installed but signed-out CLI shows the sign-in command plus one-click sign-in, then polls until you finish the interactive flow in the terminal
170
+ - **Search** — filters by name, full path and description; the header switches to `匹配 M / 共 N 个仓库` so you can tell how much got filtered out
171
+ - **Sort** — recently pushed (default) / recently created / most starred / name. Sorting happens in the frontend, so both tabs behave identically — their CLIs do not (`gh` returns most-recently-pushed first, `gitee` returns `owner/name` alphabetical)
172
+ - **No refetch on tab switch** — the list is cached per account, so coming back to the tab paints instantly instead of shelling out to `gh repo list` again; once the cache is a minute old it paints from cache first and refreshes quietly in the background, while **刷新** always pulls for real
173
+ - **Informative cards** — repository name, description and privacy / fork / language / star badges, plus a third line with last-push date, fork count, non-`main` default branch and license (each omitted when there is nothing to say)
174
+ - **One click to open or copy** — clicking a card opens the repository page in your browser; the actions that appear on hover copy the URL or open it
175
+
176
+ ---
177
+
163
178
  ### Quick directory switch
164
179
 
165
180
  ![Directory switcher dialog](https://raw.githubusercontent.com/xz333221/zen-gitsync/main/public/images/directory-switcher.png)
@@ -168,6 +183,8 @@ In either mode, click **AI Generate** to fill in the fields automatically based
168
183
 
169
184
  When the GUI is opened on a directory that is not a Git repository, the right pane shows the **Recent projects** list instead — every recent directory with its Git badges (behind / ahead / uncommitted) and one-click "open in a new tab". Each page load runs a `git fetch` pass over all of them automatically, so the ahead/behind badges show the real state rather than the snapshot from the last fetch; the **刷新全部** button does the same thing on demand.
170
185
 
186
+ The same list (and the **常用目录** list in the directory switcher dialog) carries a short note underneath the cards. With an AI model configured it is an **AI status summary** — one paragraph written by the model from the freshly fetched states, naming the projects that need a pull, have unpushed commits or uncommitted changes, and saying so when everything is in sync. It is generated once per distinct state right after the **刷新全部** pass finishes (never mid-refresh), cached for the page, and there is a regenerate button on the right; the summary is shared between the panel and the dialog, so opening the switcher never triggers a second call. Without a model configured it falls back to a static note explaining what the badges mean.
187
+
171
188
  ---
172
189
 
173
190
  ### Branch Management
@@ -595,6 +612,7 @@ $ g --check-lock=config.json
595
612
  - [新特性](#v2xx--新特性)
596
613
  - [GUI 界面](#gui-界面)
597
614
  - [核心 Git 面板](#核心-git-面板)
615
+ - [GitHub / Gitee 仓库](#github--gitee-仓库)
598
616
  - [分支管理](#分支管理)
599
617
  - [远程仓库管理](#远程仓库管理)
600
618
  - [Stash 管理](#stash-管理)
@@ -629,6 +647,7 @@ npm install -g zen-gitsync
629
647
  - **可视化 GUI** — 完整的 Git 图形操作界面
630
648
  - **分支管理** — 创建、切换、追踪本地/远程分支
631
649
  - **远程仓库管理** — 在一个弹窗里管理多个远程仓库(添加/重命名/改地址/删除)、配置多推送地址,并支持推送到指定远程或一键推送全部
650
+ - **仓库浏览器** — GitHub / Gitee 两个 Tab 列出 CLI 账号下的全部仓库(含私有),支持搜索与排序(最近推送 / 最近创建 / 星标最多 / 仓库名),卡片带最近推送日期、Fork 数、默认分支与许可证
632
651
  - **Stash 管理** — 储藏与恢复变更,支持排除锁定文件
633
652
  - **Tag 管理** — 创建轻量/附注标签
634
653
  - **合并支持** — 自动检测并引导完成进行中的合并
@@ -776,6 +795,19 @@ $ ZEN_ALLOWED_ORIGINS="https://zen.example.com,http://10.0.0.5:8080" g ui
776
795
 
777
796
  ---
778
797
 
798
+ ### GitHub / Gitee 仓库
799
+
800
+ > Git 视图有三个 Tab:**当前项目**、**GitHub 仓库**、**Gitee 仓库**。后两个列出你的 `gh` / `gitee` 账号下能看到的全部仓库(含私有)。ZenGitSync 全程不接触你的令牌:面板调用的是官方 CLI(`gh`、`@gitee/gitee-cli`),凭据由 CLI 自己保管。
801
+
802
+ - **零配置引导** — 没装 CLI 时按平台给出安装命令(winget / Homebrew / `npm install -g @gitee/gitee-cli`),支持一键安装并自动刷新;装了但没登录时给出登录命令 + 一键登录,然后轮询等你走完终端里的交互流程
803
+ - **搜索** — 按仓库名、完整路径、描述过滤;顶部提示同时显示 `匹配 M / 共 N 个仓库`,一眼看出筛掉了多少
804
+ - **排序** — 最近推送(默认)/ 最近创建 / 星标最多 / 仓库名。排序在前端做,两个 Tab 口径一致 —— 它们的 CLI 并不一致(`gh` 按推送时间倒序,`gitee` 按 `owner/name` 字母序)
805
+ - **切 Tab 不重拉** — 列表按账号各缓存一份,切回来直接渲染,不再重跑一遍 `gh repo list`;缓存超过一分钟后先用它画出来、再在后台静默刷新,点「刷新」则永远真的去拉
806
+ - **信息更全的卡片** — 仓库名、描述,以及私有 / Fork / 语言 / 星标徽标,第三行再给最近推送日期、Fork 数、非 `main` 的默认分支与许可证(没有的项直接省略,不留占位)
807
+ - **一键打开 / 复制** — 点击卡片在浏览器打开仓库主页,悬浮时出现的按钮可复制地址或直接打开
808
+
809
+ ---
810
+
779
811
  ### 快速切换目录
780
812
 
781
813
  ![切换目录弹窗](https://raw.githubusercontent.com/xz333221/zen-gitsync/main/public/images/directory-switcher.png)
@@ -784,6 +816,8 @@ $ ZEN_ALLOWED_ORIGINS="https://zen.example.com,http://10.0.0.5:8080" g ui
784
816
 
785
817
  当 GUI 打开在一个**不是 Git 仓库**的目录上时,右侧会改为显示「最近项目」列表 —— 每个最近目录一张卡片,带 Git 徽标(落后 / 领先 / 未提交)与「在新标签页打开」。每次打开界面时会自动对所有项目跑一遍 `git fetch`,让「领先/落后」显示真实状态而不是上次 fetch 时的快照;**刷新全部** 按钮可以随时手动再刷一遍。
786
818
 
819
+ 这份列表(以及切换目录弹窗里的 **常用目录**)在卡片下方还有一段说明。配置了 AI 模型时,它是模型根据刚刷新的状态写成的 **AI 项目状态解读**:一段话说清哪些项目该 pull、哪些有未推送的提交、哪些只是工作区脏了,全都同步干净时也会明确说明。它在「刷新全部」跑完的那一刻按状态生成一次(刷新途中不会生成),整页缓存复用,右侧带重新生成按钮;面板与弹窗共用同一份解读,打开弹窗不会多问一次模型。没配模型时退回一段静态说明,讲清徽标里的数字各是什么意思。
820
+
787
821
  ---
788
822
 
789
823
  ### 分支管理
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zen-gitsync",
3
- "version": "2.17.10",
3
+ "version": "2.17.12",
4
4
  "description": "Auto commit, scheduled sync, and visual GUI for Git. Run `g` in any repo for one-key commit & push, AI commit messages, scheduled background sync, and a drag-and-drop workflow builder.",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -39,6 +39,8 @@
39
39
  "verify:wb-toolcalls": "node scripts/verify-workbench-toolcalls.mjs",
40
40
  "verify:wb-responsive": "node scripts/verify-wb-responsive.cjs",
41
41
  "verify:wb-editor-persist": "node scripts/verify-workbench-editor-persist.cjs",
42
+ "verify:wb-copy-folder-name": "node scripts/verify-copy-folder-name.cjs",
43
+ "verify:repo-list": "node scripts/verify-repo-list.cjs",
42
44
  "e2e": "cd src/ui/client && npx playwright test",
43
45
  "e2e:headed": "cd src/ui/client && npx playwright test --headed",
44
46
  "e2e:install": "cd src/ui/client && npx playwright install chromium",
@@ -0,0 +1,5 @@
1
+ import"./rolldown-runtime-C0FnF6B9.js";import{$ as e,$n as t,A as n,Bn as r,Dn as i,E as a,En as o,Er as s,Gt as c,H as l,Ht as u,In as d,K as f,Nn as p,On as m,Ot as h,Pn as g,Pr as _,Q as v,Qr as y,Tn as b,Wn as x,Yr as S,Yt as C,Zn as w,_n as T,a as E,an as ee,bn as D,br as O,cr as k,ct as te,dn as A,et as ne,i as j,j as re,kn as M,kt as N,ln as P,lr as F,mt as I,nr as L,o as ie,or as R,ot as z,pr as B,pt as ae,qr as V,vr as H,wt as oe,xn as U,zt as se}from"./element-plus-IG-bwpR5.js";import{i as W,n as G,t as K}from"./vendor-DcK6TCKZ.js";import{n as q,t as J}from"./_plugin-vue_export-helper-Dcylt9fO.js";import{t as ce}from"./configStore-BlqdtNUA.js";B();var Y=65536;function X(e){if(!e||!Array.isArray(e.messages))return[];let t=[],n=e.messages.length;for(let r=0;r<n;r++){let i=e.messages[r];if(i.role!==`system`){if(i.role===`user`){let e=``,n;if(typeof i.content==`string`)e=i.content;else if(Array.isArray(i.content)){e=i.content.filter(e=>e?.type===`text`).map(e=>e.text||``).join(` `);let t=i.content.filter(e=>e?.type===`image_url`&&typeof e.image_url?.url==`string`).map((e,t)=>({id:`att-${r}-${t}`,name:`image`,size:0,type:ue(e.image_url?.url||``)||`image/*`,preview:e.image_url?.url}));t.length>0&&(n=t)}(e||n)&&t.push({id:`msg-${r}`,role:`user`,content:e,attachments:n,status:`done`,createdAt:Date.now()})}else if(i.role===`assistant`){let a=``;typeof i.content==`string`&&(a=i.content),a.length>Y&&(a=`…(前文已截断)\n${a.slice(-65536)}`);let o=[];if(i.tool_calls&&i.tool_calls.length>0)for(let e of i.tool_calls)o.push({id:e.id||e.function?.name||K(),name:e.function?.name||``,arguments:e.function?.arguments||``,argsPreview:le(e.function?.name||``,e.function?.arguments||``),status:`done`,result:``});let s=r+1;for(;s<n&&e.messages[s].role===`tool`;){let t=e.messages[s],n=t.tool_call_id||t.name||``,i=o.find(e=>e.id===n);if(i){let e=t.content;typeof e!=`string`&&(e=`(non-text result)`),e.length>Y&&(e=`…(前文已截断)\n${e.slice(-65536)}`),i.result=e}r=s,s++}let c=!!a,l=o.length>0;(c||l)&&t.push({id:`msg-${r}`,role:`assistant`,content:a||``,toolCalls:l?o:void 0,status:`done`,createdAt:Date.now()})}}}return t}function le(e,t){try{let n=JSON.parse(t);switch(e){case`run_command`:return String(n.command||``).slice(0,200);case`read_file`:case`write_file`:case`edit_file`:return String(n.path||``);case`list_files`:return String(n.path||`.`);case`search_text`:return String(n.pattern||``);default:return JSON.stringify(n).slice(0,200)}}catch{return t.slice(0,200)}}function Z(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result||``)),r.onerror=()=>n(r.error||Error(`FileReader failed`)),r.readAsDataURL(e)})}function ue(e){let t=/^data:([^;,]+)/.exec(e);return t?t[1]:``}function de(){let e=ce(),t=O([]),n=O(!1),r=O(null),i=O([]),a=O(!1),o=O(!1),s=O(null),c=O(!1),l=null,u=0,d=0;async function f(){let r=++d,i=e.currentDirectory||``;if(!i){t.value=[],n.value=!1;return}n.value=!0;try{let e=`/api/agent/sessions?cwd=${encodeURIComponent(i)}`,n=await fetch(e).then(e=>e.json());if(r!==d)return;if(!n.success){E.error(n.error||q(`@AGENT:加载会话列表失败`));return}t.value=Array.isArray(n.sessions)?n.sessions:[]}catch(e){if(r!==d)return;E.error(q(`@AGENT:加载会话列表失败`)+`: `+(e?.message||e))}finally{r===d&&(n.value=!1)}}function p(n,r){let i=new Date().toISOString(),a=t.value.find(e=>e.sessionId===n);if(a){a.isGenerating=!0,a.updatedAt=i;return}t.value=[{sessionId:n,title:r,source:`web`,cwd:e.currentDirectory||``,model:``,createdAt:i,updatedAt:i,messageCount:1,size:0,isGenerating:!0},...t.value]}function m(e){let n=t.value.find(t=>t.sessionId===e);n&&(n.isGenerating=!1)}async function h(e){o.value=!0,r.value=e;try{let t=await fetch(`/api/agent/sessions/${encodeURIComponent(e)}`).then(e=>e.json());if(!t.success){E.error(t.error||q(`@AGENT:加载会话失败`));return}i.value=X(t.session)}catch(e){E.error(q(`@AGENT:加载会话失败`)+`: `+(e?.message||e))}finally{o.value=!1}}async function g(e){try{await j.confirm(q(`@AGENT:确认删除该会话`),q(`@AGENT:删除后无法恢复`),{type:`warning`})}catch{return}try{let n=await fetch(`/api/agent/sessions/${encodeURIComponent(e)}`,{method:`DELETE`}).then(e=>e.json());if(!n.success){E.error(n.error||q(`@AGENT:删除失败`));return}t.value=t.value.filter(t=>t.sessionId!==e),r.value===e&&(r.value=null,i.value=[]),E.success(q(`@AGENT:已删除`))}catch(e){E.error(q(`@AGENT:删除失败`)+`: `+(e?.message||e))}}async function _(e,n){try{let r=await fetch(`/api/agent/sessions/${encodeURIComponent(e)}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:n})}).then(e=>e.json());if(!r.success){E.error(r.error||q(`@AGENT:重命名失败`));return}let i=t.value.find(t=>t.sessionId===e);i&&(i.title=n),E.success(q(`@AGENT:已重命名`))}catch(e){E.error(q(`@AGENT:重命名失败`)+`: `+(e?.message||e))}}function v(){r.value=null,i.value=[],s.value=null,t.value=t.value.filter(e=>!e.isGenerating)}async function y(t,n=[]){let o=n.filter(e=>e?.file?.type?.startsWith(`image/`));if(o.length<n.length&&E.warning(q(`@AGENT:仅支持发送图片,非图片文件已忽略`)),!t.trim()&&o.length===0||a.value)return;let d=(await Promise.allSettled(o.map(e=>Z(e.file)))).map(e=>e.status===`fulfilled`?e.value:``).filter(e=>e.startsWith(`data:image/`)),h=++u;l=new AbortController;let g=l,_={id:K(),role:`user`,content:t,status:`done`,createdAt:Date.now()};o.length>0&&(_.attachments=o.map(e=>({id:e.id,name:e.file.name||`image`,size:e.file.size||0,type:e.file.type||``,preview:e.preview}))),i.value.push(_);let v=H({id:K(),role:`assistant`,content:``,status:`pending`,createdAt:Date.now()});i.value.push(v),a.value=!0;let y=[],b=null;try{let n=await fetch(`/api/agent/chat`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`text/event-stream`},body:JSON.stringify({sessionId:r.value||``,userMessage:t,cwd:e.currentDirectory||``,...d.length>0?{images:d}:{}}),signal:g.signal});if(h!==u)return;if(!n.ok||!n.body){let e=await n.text().catch(()=>``);throw Error(e||`HTTP ${n.status}`)}let a=n.body.getReader(),o=new TextDecoder(`utf-8`),c=``,l=r.value;for(;;){let{value:e,done:n}=await a.read();if(h!==u)return;if(n)break;c+=o.decode(e,{stream:!0});let d=c.split(`
2
+ `);c=d.pop()??``;for(let e of d){let n=e.trim();if(!n.startsWith(`data:`))continue;let i=n.slice(5).trim();if(!i)continue;let a;try{a=JSON.parse(i)}catch{continue}switch(a.type){case`meta`:if(a.sessionId){l=a.sessionId,b=a.sessionId,r.value=a.sessionId;let e=String(a.title||``).trim()||t.trim().split(`
3
+ `)[0].trim().slice(0,40)||q(`@AGENT:无标题`);p(a.sessionId,e)}break;case`thinking`:v.reasoning||(v.reasoning=``,v.reasoningStatus=`streaming`),v.reasoning+=String(a.delta||``),v.status=`streaming`;break;case`content`:v.status===`pending`&&(v.status=`streaming`);{let e=String(a.delta||``);v.content+=e;let t=G(v.content);t.reasoning&&(v.reasoning||(v.reasoning=``,v.reasoningStatus=`streaming`),v.reasoning=t.reasoning,v.content=t.content)}break;case`tool_call_start`:{let e=H({id:a.toolCallId||K(),name:a.name||``,argsPreview:a.argsPreview||``,arguments:a.argsPreview||``,status:`running`,result:``});y.push(e),v.toolCalls||=[],v.toolCalls.push(e),v.status===`pending`&&(v.status=`streaming`);break}case`tool_result`:{let e=y.find(e=>e.id===a.toolCallId);e&&(e.result=String(a.result||``),e.status=`done`,e.name===`ask_user`&&(s.value=null));break}case`ask_user`:s.value={interactionId:String(a.interactionId||``),question:String(a.question||``),options:Array.isArray(a.options)?a.options.map(e=>String(e)):[],allowFreeText:a.allowFreeText!==!1};break;case`done`:{let e=a.content||v.content,t=G(e);t.reasoning&&!v.reasoning&&(v.reasoning=t.reasoning),v.content=t.content,v.status=`done`,v.reasoningStatus===`streaming`&&(v.reasoningStatus=`done`);break}case`error`:v.status=`error`,v.error=String(a.error||q(`@AGENT:未知错误`)),v.reasoningStatus===`streaming`&&(v.reasoningStatus=`done`)}}i.value=[...i.value]}if(h!==u)return;v.status===`pending`&&(v.status=`done`),l&&l!==r.value&&(r.value=l),f().catch(()=>{})}catch(e){if(h!==u)return;e?.name===`AbortError`||g.signal.aborted?(v.content=(v.content||``)+`
4
+
5
+ [`+q(`@AGENT:已停止`)+`]`,v.status=`done`,v.reasoningStatus===`streaming`&&(v.reasoningStatus=`done`)):(v.status=`error`,v.error=e?.message||String(e),E.error(v.error||q(`@AGENT:对话失败`)))}finally{h===u&&(a.value=!1,s.value=null,c.value=!1,l=null,b&&m(b))}}async function b(e){let t=s.value,n=r.value,i=String(e||``).trim();if(!t||!n||!i||c.value)return!1;c.value=!0;try{let e=await fetch(`/api/agent/respond`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionId:n,interactionId:t.interactionId,answer:i})}).then(e=>e.json());if(!e.success)throw Error(e.error||q(`@AGENT:回答提交失败`));return s.value=null,!0}catch(e){return E.error(e?.message||q(`@AGENT:回答提交失败`)),!1}finally{c.value=!1}}function x(){l&&=(l.abort(),null)}return{sessions:t,sessionsLoading:n,currentSessionId:r,messages:i,isStreaming:a,sessionLoading:o,pendingQuestion:s,answeringQuestion:c,loadSessions:f,loadSession:h,deleteSession:g,renameSession:_,newSession:v,sendMessage:y,answerQuestion:b,stop:x}}r(),B(),A(),_();var Q={class:`marketplace-panel`},fe={class:`mp-toolbar`},pe={class:`mp-search`},me=[`placeholder`],he={class:`mp-toolbar-sub`},$={class:`mp-target-hint`},ge={class:`mp-source-filter`},_e=[`onClick`],ve={class:`mp-body`},ye={class:`mp-group-header`},be={class:`mp-group-title`},xe={key:0,class:`mp-group-count`},Se={key:1,class:`mp-group-error`},Ce=[`href`,`title`],we={key:0,class:`mp-grid`},Te={class:`mp-card-head`},Ee=[`title`],De={key:0,class:`mp-card-metric`},Oe=[`title`],ke={class:`mp-card-meta`},Ae=[`title`],je=[`title`],Me={key:2,class:`mp-tag remote`},Ne={class:`mp-card-foot`},Pe=[`href`],Fe={key:1,class:`mp-installed-chip`},Ie=[`disabled`,`onClick`],Le={key:3,class:`mp-not-installable`},Re={key:1,class:`mp-empty`},ze={key:0,class:`mp-group installed`},Be={class:`mp-group-header`},Ve={class:`mp-group-title`},He={class:`mp-group-count`},Ue={key:0,class:`mp-installed-block`},We={class:`mp-installed-target`},Ge={class:`mp-installed-list`},Ke={class:`mp-installed-name`},qe={key:0,class:`mp-meta-pkg`},Je={key:1,class:`mp-tag warn`},Ye=[`disabled`,`onClick`],Xe={key:1,class:`mp-empty all`},Ze={key:0,class:`mkt-form`},Qe={class:`mkt-form-name`},$e=[`onUpdate:modelValue`,`placeholder`],et={key:0,class:`mkt-field`},tt={class:`mkt-hint`},nt=J(d({__name:`MarketplacePanel`,props:{type:{}},setup(e){let r=e,d=ce(),_=O([]),v=O([]),x=O(!1),S=O(``),D=O(``),A=O([]),N=O(`project`),P=O(new Set),I=O(new Set),L=b(()=>d.currentDirectory||``),z=null;async function B(){if(!x.value){x.value=!0;try{let e=new URLSearchParams({type:r.type,cwd:L.value});D.value&&e.set(`q`,D.value),A.value.length&&e.set(`sources`,A.value.join(`,`));let t=await(await fetch(`/api/agent/marketplace/catalog?${e}`)).json();t?.success?(_.value=t.groups||[],v.value=t.installed||[]):E.error(t?.error||q(`@MKT:加载失败`))}catch{E.error(q(`@MKT:加载失败`))}finally{x.value=!1}}}R(S,e=>{z&&clearTimeout(z),z=setTimeout(()=>{D.value=e.trim(),B()},400)}),R(A,()=>B()),R(()=>r.type,()=>{A.value=[],D.value=``,S.value=``,B()}),R(L,()=>B()),B();let oe=b(()=>{let e=L.value?L.value.split(/[\\/]/).filter(Boolean).pop():``;return N.value===`project`?e||q(`@MKT:当前项目`):q(`@MKT:g ai 智能体`)});function se(e){return e.stars?`${W(e.stars)} ★`:e.downloads?`${W(e.downloads)} ${q(`@MKT:周下载`)}`:e.uses?`${W(e.uses)} ${q(`@MKT:次使用`)}`:``}function W(e){return e>=1e3?`${(e/1e3).toFixed(e>=1e4?0:1)}k`:String(e)}function G(e){return`${e.id}`}function K(e){return P.value.has(G(e))}let J=b(()=>{let e={project:[],global:[]};for(let t of v.value)(e[t.target]||=[]).push(t);return e}),Y=H({visible:!1,item:null,env:{},args:``});function X(e){return r.type===`mcp`&&(!!e.envKeys?.length||!!e.args?.length)}function le(e){Y.item=e,Y.env=Object.fromEntries((e.envKeys||[]).map(e=>[e,``])),Y.args=(e.args||[]).join(` `),Y.visible=!0}function Z(){let e=Y.item;if(Y.visible=!1,!e)return;let t=Object.fromEntries(Object.entries(Y.env).filter(([,e])=>e.trim()!==``)),n=Y.args.trim()?Y.args.trim().match(/(?:[^\s"]+|"[^"]*")+/g)?.map(e=>e.replace(/^"|"$/g,``))??void 0:void 0;de(e,{env:t,...n?{args:n}:{}})}async function ue(e){if(!e.installed||await nt(e)){if(X(e)){le(e);return}await de(e,{})}}async function de(e,t){let n=G(e);P.value.add(n);try{let n=await fetch(`/api/agent/marketplace/install`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({type:r.type,target:N.value,cwd:L.value,item:{...e,...t}})}),i=await n.json().catch(()=>null);if(!n.ok||!i?.success){E.error(i?.error||q(`@MKT:安装失败`));return}i.item?.warning&&E.warning(i.item.warning),i.item?.envKeys?.length?E.warning(`${q(`@MKT:还缺环境变量`)}: ${i.item.envKeys.join(`, `)}`):E.success(q(`@MKT:安装成功`)),await B()}catch{E.error(q(`@MKT:安装失败`))}finally{P.value.delete(n)}}async function nt(e){try{return await j.confirm(`${e.name} ${q(`@MKT:已安装,要重新安装吗?`)}`,q(`@MKT:重新安装`),{confirmButtonText:q(`@MKT:重装`),cancelButtonText:q(`@MKT:取消`),type:`warning`}),!0}catch{return!1}}async function rt(e){try{await j.confirm(`${q(`@MKT:确定卸载`)} ${e.name}?`,q(`@MKT:卸载`),{confirmButtonText:q(`@MKT:卸载`),cancelButtonText:q(`@MKT:取消`),type:`warning`})}catch{return}let t=`${e.target}:${e.id}`;I.value.add(t);try{let t=new URLSearchParams({target:e.target,cwd:L.value}),n=await fetch(`/api/agent/marketplace/item/${r.type}/${encodeURIComponent(e.id)}?${t}`,{method:`DELETE`}),i=await n.json().catch(()=>null);if(!n.ok||!i?.success){E.error(i?.error||q(`@MKT:卸载失败`));return}E.success(q(`@MKT:已卸载`)),await B()}catch{E.error(q(`@MKT:卸载失败`))}finally{I.value.delete(t)}}return(r,d)=>{let b=f,E=n,D=re,O=l,j=a,P=ie;return w(),M(`div`,Q,[o(`div`,fe,[o(`div`,pe,[g(b,{class:`mp-search-icon`},{default:k(()=>[g(s(c))]),_:1}),F(o(`input`,{"onUpdate:modelValue":d[0]||=e=>S.value=e,class:`mp-search-input`,type:`text`,placeholder:e.type===`skill`?s(q)(`@MKT:搜索 Skill...`):s(q)(`@MKT:搜索 MCP 服务...`)},null,8,me),[[T,S.value]])]),g(D,{modelValue:N.value,"onUpdate:modelValue":d[1]||=e=>N.value=e,size:`small`,class:`mp-target`},{default:k(()=>[g(E,{value:`project`},{default:k(()=>[p(y(s(q)(`@MKT:当前项目`)),1)]),_:1}),g(E,{value:`global`},{default:k(()=>[p(y(s(q)(`@MKT:g ai 智能体`)),1)]),_:1})]),_:1},8,[`modelValue`]),g(O,{content:s(q)(`@MKT:刷新`),placement:`top`,"show-after":300},{default:k(()=>[o(`button`,{class:V([`mp-refresh`,{spinning:x.value}]),onClick:B},[g(b,null,{default:k(()=>[g(s(u))]),_:1})],2)]),_:1},8,[`content`])]),o(`div`,he,[o(`span`,$,[p(y(s(q)(`@MKT:安装到`))+` `,1),o(`b`,null,y(oe.value),1)]),o(`div`,ge,[(w(!0),M(U,null,t(_.value,e=>(w(),M(`button`,{key:e.id,class:V([`mp-chip`,{active:A.value.includes(e.id)}]),onClick:()=>{let t=A.value.indexOf(e.id);t>=0?A.value.splice(t,1):A.value.push(e.id)}},y(e.label),11,_e))),128)),A.value.length?(w(),M(`button`,{key:0,class:`mp-chip clear`,onClick:d[2]||=e=>A.value=[]},y(s(q)(`@MKT:全部来源`)),1)):m(``,!0)])]),F((w(),M(`div`,ve,[(w(!0),M(U,null,t(_.value,e=>(w(),M(`section`,{key:e.id,class:`mp-group`},[o(`header`,ye,[o(`h3`,be,y(e.label),1),e.status===`ok`?(w(),M(`span`,xe,y(e.items.length),1)):(w(),M(`span`,Se,[g(b,null,{default:k(()=>[g(s(ee))]),_:1}),p(` `+y(e.error||s(q)(`@MKT:来源不可用`)),1)])),e.homepage?(w(),M(`a`,{key:2,class:`mp-group-link`,href:e.homepage,target:`_blank`,rel:`noopener noreferrer`,title:e.homepage},[g(b,null,{default:k(()=>[g(s(h))]),_:1})],8,Ce)):m(``,!0)]),e.status===`ok`&&e.items.length?(w(),M(`div`,we,[(w(!0),M(U,null,t(e.items,e=>(w(),M(`article`,{key:G(e),class:`mp-card`},[o(`div`,Te,[o(`span`,{class:`mp-card-name`,title:e.name},y(e.name),9,Ee),se(e)?(w(),M(`span`,De,[g(b,null,{default:k(()=>[e.stars?(w(),i(s(C),{key:0})):(w(),i(s(ae),{key:1}))]),_:2},1024),p(` `+y(se(e)),1)])):m(``,!0)]),o(`p`,{class:`mp-card-desc`,title:e.description},y(e.description||s(q)(`@MKT:暂无描述`)),9,Oe),o(`div`,ke,[e.package?(w(),M(`code`,{key:0,class:`mp-meta-pkg`,title:e.package},y(e.package),9,Ae)):e.repository?(w(),M(`span`,{key:1,class:`mp-meta-repo`,title:e.repository+(e.subpath?` · `+e.subpath:``)},[p(y(e.repository),1),e.subpath?(w(),M(U,{key:0},[p(` · `+y(e.subpath),1)],64)):m(``,!0)],8,je)):m(``,!0),e.transport===`remote`?(w(),M(`span`,Me,y(s(q)(`@MKT:远程服务`)),1)):m(``,!0),(w(!0),M(U,null,t((e.tags||[]).slice(0,2),e=>(w(),M(`span`,{key:e,class:`mp-tag`},y(e),1))),128))]),o(`div`,Ne,[e.upstream?(w(),M(`a`,{key:0,class:`mp-card-link`,href:e.upstream,target:`_blank`,rel:`noopener noreferrer`},y(s(q)(`@MKT:查看来源`)),9,Pe)):m(``,!0),d[6]||=o(`span`,{class:`mp-foot-spacer`},null,-1),e.installed?(w(),M(`span`,Fe,[g(b,null,{default:k(()=>[g(s(ne))]),_:1}),p(y(s(q)(`@MKT:已安装`)),1)])):e.installable===!1?(w(),M(`span`,Le,y(s(q)(`@MKT:暂不支持一键安装`)),1)):(w(),M(`button`,{key:2,class:`mp-install-btn`,disabled:K(e),onClick:t=>ue(e)},y(K(e)?s(q)(`@MKT:安装中...`):s(q)(`@MKT:安装`)),9,Ie))])]))),128))])):e.status===`ok`?(w(),M(`div`,Re,y(s(q)(`@MKT:该来源暂无结果`)),1)):m(``,!0)]))),128)),v.value.length?(w(),M(`section`,ze,[o(`header`,Be,[o(`h3`,Ve,y(s(q)(`@MKT:已安装`)),1),o(`span`,He,y(v.value.length),1)]),(w(),M(U,null,t([`project`,`global`],e=>o(`div`,{key:e},[J.value[e]?.length?(w(),M(`div`,Ue,[o(`div`,We,y(e===`project`?s(q)(`@MKT:当前项目`):s(q)(`@MKT:g ai 智能体`)),1),o(`div`,Ge,[(w(!0),M(U,null,t(J.value[e],t=>(w(),M(`div`,{key:e+t.id,class:`mp-installed-row`},[o(`span`,Ke,y(t.name),1),t.package?(w(),M(`code`,qe,y(t.package),1)):m(``,!0),t.requiredEnv?.length?(w(),M(`span`,Je,y(s(q)(`@MKT:待配置`))+`: `+y(t.requiredEnv.join(`, `)),1)):m(``,!0),d[7]||=o(`span`,{class:`mp-foot-spacer`},null,-1),o(`button`,{class:`mp-remove-btn`,disabled:I.value.has(e+t.id),onClick:e=>rt(t)},[g(b,null,{default:k(()=>[g(s(te))]),_:1}),p(` `+y(I.value.has(e+t.id)?s(q)(`@MKT:卸载中...`):s(q)(`@MKT:卸载`)),1)],8,Ye)]))),128))])])):m(``,!0)])),64))])):m(``,!0),!x.value&&!_.value.length?(w(),M(`div`,Xe,y(s(q)(`@MKT:加载失败`)),1)):m(``,!0)])),[[P,x.value]]),g(j,{modelValue:Y.visible,"onUpdate:modelValue":d[5]||=e=>Y.visible=e,title:s(q)(`@MKT:配置 MCP`),width:`460px`,"close-on-click-modal":!1,"append-to-body":``},{footer:k(()=>[o(`button`,{class:`mkt-cancel`,onClick:d[4]||=e=>Y.visible=!1},y(s(q)(`@MKT:取消`)),1),o(`button`,{class:`mkt-confirm`,onClick:Z},y(s(q)(`@MKT:安装`)),1)]),default:k(()=>[Y.item?(w(),M(`div`,Ze,[o(`p`,Qe,y(Y.item.name),1),(w(!0),M(U,null,t(Object.keys(Y.env),e=>(w(),M(`div`,{key:e,class:`mkt-field`},[o(`label`,null,y(e),1),F(o(`input`,{"onUpdate:modelValue":t=>Y.env[e]=t,type:`text`,autocomplete:`off`,placeholder:s(q)(`@MKT:环境变量值`),spellcheck:`false`},null,8,$e),[[T,Y.env[e]]])]))),128)),Y.item.args?.length?(w(),M(`div`,et,[o(`label`,null,y(s(q)(`@MKT:启动参数`)),1),F(o(`input`,{"onUpdate:modelValue":d[3]||=e=>Y.args=e,type:`text`,autocomplete:`off`,spellcheck:`false`},null,512),[[T,Y.args]]),o(`p`,tt,y(s(q)(`@MKT:参数提示`)),1)])):m(``,!0)])):m(``,!0)]),_:1},8,[`modelValue`,`title`])])}}}),[[`__scopeId`,`data-v-07abd42c`]]);r(),B(),_(),A();var rt={class:`agent-view`},it={class:`sidebar-header`},at={class:`sidebar-search`},ot=[`placeholder`],st={class:`session-list`},ct={key:0,class:`empty-state`},lt={class:`empty-text`},ut={key:0,class:`empty-hint`},dt=[`onClick`],ft={class:`session-item-main`},pt={class:`session-item-title`},mt={class:`session-item-meta`},ht={key:0,class:`meta-generating`},gt={class:`meta-time`},_t={class:`meta-count`},vt={key:2,class:`meta-source cli`},yt=[`onClick`],bt=[`onClick`],xt={class:`agent-chat-area`},St={class:`agent-tabs`,role:`tablist`},Ct=[`aria-selected`,`onClick`],wt={class:`agent-tab-body`},Tt={key:0,class:`agent-chat-pane`},Et={key:0,class:`chat-loading`},Dt={key:0,class:`ask-user-panel`,"aria-live":`polite`},Ot={class:`ask-user-title`},kt={class:`ask-user-question`},At={key:0,class:`ask-user-options`},jt=[`disabled`,`onClick`],Mt=[`disabled`,`placeholder`,`aria-label`],Nt=[`disabled`],Pt={key:0,class:`stop-button-bar`},Ft=J(d({__name:`AgentView`,setup(n){let r=ce(),a=O(`chat`),u=b(()=>a.value===`mcp`?`mcp`:`skill`),d=b(()=>[{id:`chat`,label:q(`@AGENT:对话`),icon:v},{id:`skill`,label:q(`@AGENT:Skill 广场`),icon:oe},{id:`mcp`,label:q(`@AGENT:MCP 广场`),icon:z}]),{sessions:h,sessionsLoading:_,currentSessionId:C,messages:ee,isStreaming:A,sessionLoading:re,loadSessions:B,loadSession:ae,deleteSession:H,renameSession:G,newSession:K,sendMessage:J,pendingQuestion:Y,answeringQuestion:X,answerQuestion:le,stop:Z}=de(),ue=b(()=>{let e=r.theme;return e===`dark`||e===`auto`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}),Q=O(``),fe=b(()=>{if(!Q.value.trim())return h.value;let e=Q.value.toLowerCase();return h.value.filter(t=>(t.title||``).toLowerCase().includes(e)||(t.model||``).toLowerCase().includes(e))}),pe=b(()=>[{id:`p1`,label:q(`@AGENT:查看项目结构`),prompt:q(`@AGENT:prompt_p1`)},{id:`p2`,label:q(`@AGENT:分析代码质量`),prompt:q(`@AGENT:prompt_p2`)},{id:`p3`,label:q(`@AGENT:帮我写测试`),prompt:q(`@AGENT:prompt_p3`)},{id:`p4`,label:q(`@AGENT:Git 状态检查`),prompt:q(`@AGENT:prompt_p4`)},{id:`p5`,label:q(`@AGENT:帮我启动项目`),prompt:q(`@AGENT:prompt_p5`)}]);async function me(e){await J(e.text,e.files),await x(),ve()}async function he(e){await J(e.prompt),await x(),ve()}let $=O(``);async function ge(e=$.value){await le(e)&&($.value=``)}let _e=O(null);function ve(e=!0){_e.value?.scrollToBottom(e)}R(()=>ee.value.length,()=>{x(()=>ve(!1))});function ye(e){if(A.value){E.warning(q(`@AGENT:请先停止当前生成`));return}ae(e)}function be(){if(A.value){E.warning(q(`@AGENT:请先停止当前生成`));return}K()}function xe(e,t){if(t.stopPropagation(),A.value&&C.value===e){E.warning(q(`@AGENT:请先停止当前生成`));return}H(e)}async function Se(e,t,n){n.stopPropagation();try{let{value:n}=await j.prompt(q(`@AGENT:请输入新的会话标题`),q(`@AGENT:重命名会话`),{inputValue:t,inputPattern:/.+/,inputErrorMessage:q(`@AGENT:标题不能为空`)});n&&n!==t&&await G(e,n)}catch{}}function Ce(e){if(!e)return``;try{let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=new Date,r=n.getTime()-t.getTime(),i=e=>String(e).padStart(2,`0`);if(t.toDateString()===n.toDateString())return`${i(t.getHours())}:${i(t.getMinutes())}`;if(r<6048e5){let e=Math.floor(r/864e5);return e===0?q(`@AGENT:今天`):`${e}${q(`@AGENT:天前`)}`}return`${t.getFullYear()}-${i(t.getMonth()+1)}-${i(t.getDate())}`}catch{return e}}let we=O(280),Te=O(!1);function Ee(e){Te.value=!0;let t=e.clientX,n=we.value,r=e=>{let r=e.clientX-t,i=Math.max(200,Math.min(500,n+r));we.value=i},i=()=>{Te.value=!1,document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i)};document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i)}return R(()=>[r.currentDirectory,A.value],async([e,t],n)=>{let r=!n||e!==n[0],i=!!n&&n[1]===!0&&!t;(r||i)&&await B(),C.value&&!A.value&&!h.value.some(e=>e.sessionId===C.value)&&K()},{immediate:!0}),(n,r)=>{let h=ie;return w(),M(`div`,rt,[a.value===`chat`?(w(),M(U,{key:0},[o(`aside`,{class:`agent-sidebar`,style:S({width:we.value+`px`})},[o(`div`,it,[o(`button`,{class:`new-session-btn`,onClick:be},[g(s(f),null,{default:k(()=>[g(s(se))]),_:1}),o(`span`,null,y(s(q)(`@AGENT:新建会话`)),1)])]),o(`div`,at,[g(s(f),{class:`search-icon`},{default:k(()=>[g(s(c))]),_:1}),F(o(`input`,{"onUpdate:modelValue":r[0]||=e=>Q.value=e,placeholder:s(q)(`@AGENT:搜索会话...`),class:`search-input`,type:`text`},null,8,ot),[[T,Q.value]])]),F((w(),M(`div`,st,[fe.value.length===0&&!s(_)?(w(),M(`div`,ct,[g(s(f),{size:28,color:`var(--text-tertiary)`},{default:k(()=>[g(s(e))]),_:1}),o(`div`,lt,y(Q.value?s(q)(`@AGENT:未找到匹配的会话`):s(q)(`@AGENT:暂无会话`)),1),Q.value?m(``,!0):(w(),M(`div`,ut,y(s(q)(`@AGENT:点击上方按钮开始对话`)),1))])):m(``,!0),(w(!0),M(U,null,t(fe.value,e=>(w(),M(`div`,{key:e.sessionId,class:V([`session-item`,{active:s(C)===e.sessionId}]),onClick:t=>ye(e.sessionId)},[o(`div`,ft,[o(`div`,pt,y(e.title||s(q)(`@AGENT:无标题`)),1),o(`div`,mt,[e.isGenerating?(w(),M(`span`,ht,[g(s(f),{class:`is-loading`},{default:k(()=>[g(s(N))]),_:1}),p(` `+y(s(q)(`@AGENT:正在生成中...`)),1)])):(w(),M(U,{key:1},[o(`span`,gt,y(Ce(e.updatedAt)),1),r[5]||=o(`span`,{class:`meta-dot`},`·`,-1),o(`span`,_t,y(e.messageCount)+` `+y(s(q)(`@AGENT:条`)),1)],64)),e.source===`cli`?(w(),M(`span`,vt,`CLI`)):m(``,!0)])]),o(`div`,{class:`session-item-actions`,onClick:r[1]||=D(()=>{},[`stop`])},[g(s(l),{content:s(q)(`@AGENT:重命名`),placement:`top`,"show-after":500},{default:k(()=>[o(`button`,{class:`item-action-btn`,onClick:t=>Se(e.sessionId,e.title,t)},[g(s(f),null,{default:k(()=>[g(s(I))]),_:1})],8,yt)]),_:2},1032,[`content`]),g(s(l),{content:s(q)(`@AGENT:删除`),placement:`top`,"show-after":500},{default:k(()=>[o(`button`,{class:`item-action-btn danger`,onClick:t=>xe(e.sessionId,t)},[g(s(f),null,{default:k(()=>[g(s(te))]),_:1})],8,bt)]),_:2},1032,[`content`])])],10,dt))),128))])),[[h,s(_)]])],4),o(`div`,{class:V([`sidebar-resizer`,{active:Te.value}]),onMousedown:Ee},null,34)],64)):m(``,!0),o(`main`,xt,[o(`nav`,St,[(w(!0),M(U,null,t(d.value,e=>(w(),M(`button`,{key:e.id,type:`button`,class:V([`agent-tab`,{active:a.value===e.id}]),role:`tab`,"aria-selected":a.value===e.id,onClick:t=>a.value=e.id},[g(s(f),null,{default:k(()=>[(w(),i(L(e.icon)))]),_:2},1024),o(`span`,null,y(e.label),1)],10,Ct))),128))]),o(`div`,wt,[a.value===`chat`?(w(),M(`div`,Tt,[s(re)?(w(),M(`div`,Et,[g(s(f),{class:`is-loading`,size:32},{default:k(()=>[g(s(N))]),_:1}),o(`span`,null,y(s(q)(`@AGENT:加载会话中...`)),1)])):(w(),i(s(W),{key:1,ref_key:`chatContainerRef`,ref:_e,messages:s(ee),"preset-questions":pe.value,"welcome-title":s(q)(`@AGENT:智能体助手`),"welcome-description":s(q)(`@AGENT:我可以帮你阅读代码、执行命令、修改文件。选择下方话题或直接输入你的问题。`),"assistant-name":`g ai`,theme:ue.value,disabled:s(A),"upload-config":{accept:`image/*`},placeholder:s(A)?s(q)(`@AGENT:正在生成中...`):s(q)(`@AGENT:输入消息,Enter 发送`),onSend:me,onSelect:he},null,8,[`messages`,`preset-questions`,`welcome-title`,`welcome-description`,`theme`,`disabled`,`placeholder`])),g(P,{name:`fade`},{default:k(()=>[s(Y)?(w(),M(`section`,Dt,[o(`div`,Ot,[g(s(f),null,{default:k(()=>[g(s(e))]),_:1}),o(`span`,null,y(s(q)(`@AGENT:等待你的回答`)),1)]),o(`div`,kt,y(s(Y).question),1),s(Y).options.length?(w(),M(`div`,At,[(w(!0),M(U,null,t(s(Y).options,e=>(w(),M(`button`,{key:e,type:`button`,class:`ask-user-option`,disabled:s(X),onClick:t=>ge(e)},[g(s(f),null,{default:k(()=>[g(s(ne))]),_:1}),o(`span`,null,y(e),1)],8,jt))),128))])):m(``,!0),s(Y).allowFreeText||s(Y).options.length===0?(w(),M(`form`,{key:1,class:`ask-user-form`,onSubmit:r[3]||=D(e=>ge(),[`prevent`])},[F(o(`input`,{"onUpdate:modelValue":r[2]||=e=>$.value=e,type:`text`,disabled:s(X),placeholder:s(q)(`@AGENT:输入回答`),"aria-label":s(q)(`@AGENT:输入回答`)},null,8,Mt),[[T,$.value]]),o(`button`,{type:`submit`,disabled:s(X)||!$.value.trim()},[g(s(f),null,{default:k(()=>[g(s(ne))]),_:1}),o(`span`,null,y(s(q)(`@AGENT:提交回答`)),1)],8,Nt)],32)):m(``,!0)])):m(``,!0)]),_:1}),g(P,{name:`fade`},{default:k(()=>[s(A)?(w(),M(`div`,Pt,[o(`button`,{class:`stop-button`,onClick:r[4]||=(...e)=>s(Z)&&s(Z)(...e)},[g(s(f),null,{default:k(()=>[g(s(N),{class:`is-loading`})]),_:1}),o(`span`,null,y(s(q)(`@AGENT:停止生成`)),1)])])):m(``,!0)]),_:1})])):(w(),i(nt,{key:1,type:u.value},null,8,[`type`]))])])])}}}),[[`__scopeId`,`data-v-17ac5478`]]);export{Ft as default};
@@ -0,0 +1,2 @@
1
+ import"./rolldown-runtime-C0FnF6B9.js";import{Bn as e,Dn as t,E as n,En as r,Er as i,H as a,In as o,K as s,L as c,Nn as l,On as u,Pn as d,Pr as f,Qr as p,Tn as m,Wn as h,Yn as g,Zn as _,a as v,br as y,cr as b,i as x,kn as S,kt as C,nt as w,or as T,pr as E,qn as D,qr as O,tt as k}from"./element-plus-IG-bwpR5.js";import{n as A,t as j}from"./_plugin-vue_export-helper-Dcylt9fO.js";async function M(e,t){let n=e.body.getReader(),r=new TextDecoder(`utf-8`),i=``;for(;;){let{done:e,value:a}=await n.read();if(e)break;i+=r.decode(a,{stream:!0});let o=i.split(`
2
+ `);i=o.pop()??``;for(let e of o)e.trim()&&t(e)}i.trim()&&t(i)}async function N(){let e=await fetch(`/api/app-version`);return e.ok?e.json():{success:!1,current:``,latest:null,hasUpdate:!1,error:`HTTP ${e.status}`}}async function P(e){let t=await fetch(`/api/app-upgrade`,{method:`POST`});if(!t.ok){let n=`HTTP ${t.status}`;try{let e=await t.json();e?.error&&(n=e.error)}catch{}e({type:`error`,message:n}),e({type:`done`,code:t.status});return}if(!t.body){e({type:`error`,message:`响应无 body`}),e({type:`done`,code:-1});return}await M(t,t=>{try{e(JSON.parse(t))}catch{}})}async function F(){let e=await fetch(`/api/app-restart`,{method:`POST`});if(!e.ok){let t=`HTTP ${e.status}`;try{let n=await e.json();n?.error&&(t=n.error)}catch{}throw Error(t)}if(!e.body)throw Error(`响应无 body`);return new Promise((t,n)=>{let r=!1,i=e=>{r||(r=!0,e())};M(e,e=>{try{let r=JSON.parse(e);r.type===`ready`&&typeof r.port==`number`&&r.port>0?i(()=>t(r.port)):r.type===`timeout`?i(()=>n(Error(`restart.timeout`))):r.type===`error`&&i(()=>n(Error(r.message||`restart.failed`)))}catch{}}).then(()=>{i(()=>n(Error(`restart.stream-closed`)))}).catch(()=>{})})}e(),E(),f();var I={key:3},L={key:4},R={key:5},z={key:0,class:`upgrade-hint`},B={key:0,class:`upgrade-countdown`},V={key:1,class:`upgrade-manual`},H={class:`upgrade-manual__label`},U=`npm install -g zen-gitsync --registry https://registry.npmjs.org/`,W=j(o({__name:`UpgradeDialog`,props:{modelValue:{type:Boolean},logs:{},status:{},countdown:{default:0}},emits:[`update:modelValue`,`retry`,`restart`,`cancel`],setup(e,{emit:a}){let o=e,f=a,m=y(null);T(()=>o.logs,async()=>{await h(),m.value&&(m.value.scrollTop=m.value.scrollHeight)});function g(){o.status!==`running`&&(o.status===`success`&&o.countdown>0&&f(`cancel`),f(`update:modelValue`,!1))}function x(){f(`retry`)}function E(){f(`restart`)}function D(){f(`cancel`),f(`update:modelValue`,!1)}async function j(){try{await navigator.clipboard.writeText(U),v.success(A(`@F13B4:已复制升级命令`))}catch{v.warning(A(`@F13B4:复制失败,请手动复制`))}}return(a,o)=>{let h=s,v=c,y=n;return _(),t(y,{"model-value":e.modelValue,"onUpdate:modelValue":o[0]||=e=>f(`update:modelValue`,e),title:i(A)(`@F13B4:升级`),width:`680px`,"close-on-click-modal":!1,"close-on-press-escape":!1,"show-close":e.status!==`running`,"append-to-body":``,onClose:g},{footer:b(()=>[e.status===`failed`?(_(),t(v,{key:0,type:`primary`,onClick:x},{default:b(()=>[l(p(i(A)(`@F13B4:重试`)),1)]),_:1})):u(``,!0),e.status===`failed`?(_(),t(v,{key:1,onClick:j},{default:b(()=>[l(p(i(A)(`@F13B4:复制升级命令`)),1)]),_:1})):u(``,!0),e.status===`success`?(_(),t(v,{key:2,type:`primary`,onClick:E},{default:b(()=>[l(p(i(A)(`@F13B4:立即重启并刷新`)),1)]),_:1})):u(``,!0),e.status===`success`?(_(),t(v,{key:3,onClick:D},{default:b(()=>[l(p(i(A)(`@F13B4:稍后手动重启`)),1)]),_:1})):u(``,!0),e.status===`running`?(_(),t(v,{key:4,disabled:``},{default:b(()=>[l(p(i(A)(`@F13B4:升级中`))+`... `,1)]),_:1})):u(``,!0)]),default:b(()=>[r(`div`,{class:O([`upgrade-status`,`is-${e.status}`])},[e.status===`running`?(_(),t(h,{key:0,class:`is-loading`},{default:b(()=>[d(i(C))]),_:1})):e.status===`success`?(_(),t(h,{key:1,color:`#67c23a`},{default:b(()=>[d(i(k))]),_:1})):(_(),t(h,{key:2,color:`#f56c6c`},{default:b(()=>[d(i(w))]),_:1})),e.status===`running`?(_(),S(`span`,I,p(i(A)(`@F13B4:升级中`)),1)):e.status===`success`?(_(),S(`span`,L,p(i(A)(`@F13B4:升级完成`)),1)):(_(),S(`span`,R,p(i(A)(`@F13B4:升级失败`)),1))],2),e.status===`success`?(_(),S(`p`,z,[l(p(i(A)(`@F13B4:新版本已全局安装,需要重启服务才能生效`))+` `,1),e.countdown>0?(_(),S(`span`,B,p(i(A)(`@F13B4:{seconds} 秒后自动刷新`,{seconds:e.countdown})),1)):u(``,!0)])):u(``,!0),e.status===`failed`?(_(),S(`p`,V,[r(`span`,H,p(i(A)(`@F13B4:手动升级命令`)),1),r(`code`,{class:`upgrade-manual__cmd`},p(U))])):u(``,!0),r(`pre`,{ref_key:`logEl`,ref:m,class:`upgrade-log`},p(e.logs||i(A)(`@F13B4:等待日志输出`)),513)]),_:1},8,[`model-value`,`title`,`show-close`])}}}),[[`__scopeId`,`data-v-40c190d7`]]);e(),E(),f();var G={class:`app-version-badge`},K=[`aria-label`],q=[`aria-label`],J=[`title`,`aria-label`],Y={class:`upgrade-btn__label`},X={class:`upgrade-btn__version`},Z=`https://github.com/xz333221/zen-gitsync/releases`,Q=5,$=`app-version-check`,ee=36e5,te=j(o({__name:`AppVersionBadge`,setup(e){let t=`2.17.12`,n=y(t),o=m(()=>n.value||t),s=y(null),c=y(!1),l=y(``),f=y(`running`),h=y(0),C=null,w=y(!1);function T(){try{let e=sessionStorage.getItem($);if(!e)return null;let{at:t,data:n}=JSON.parse(e);return Date.now()-t>ee?null:n}catch{return null}}function E(e){try{sessionStorage.setItem($,JSON.stringify({at:Date.now(),data:e}))}catch{}}async function O(e=!1){let t=T();t&&(s.value=t);try{let t=await N();s.value=t,E(t),t.current&&(n.value=t.current),!e&&t.success&&t.hasUpdate&&v({type:`success`,message:A(`@F13B4:发现新版本 {version}`,{version:t.latest??``}),duration:4e3})}catch(t){e||v({type:`warning`,message:A(`@F13B4:检查更新失败 {error}`,{error:t?.message||``})})}}async function k(){if(s.value?.hasUpdate){try{await x.confirm(A(`@F13B4:确定要从 {current} 升级到 {latest} 吗?`,{current:s.value.current,latest:s.value.latest}),A(`@F13B4:升级`),{confirmButtonText:A(`@F13B4:确定升级`),cancelButtonText:A(`@F13B4:取消`),type:`info`})}catch{return}l.value=``,f.value=`running`,c.value=!0,await P(e=>{if(e.type===`done`){if(f.value=e.code===0?`success`:`failed`,e.code===0){try{sessionStorage.removeItem($)}catch{}s.value?.latest&&(n.value=s.value.latest),j()}}else e.message&&(l.value+=e.message)})}}function j(){M(),h.value=Q,C=setInterval(()=>{--h.value,h.value<=0&&(C&&=(clearInterval(C),null),L())},1e3)}function M(){C&&=(clearInterval(C),null),h.value=0}function I(){M()}async function L(){if(M(),!w.value){w.value=!0;try{let e=await F(),{pathname:t,search:n,hash:r}=window.location;window.location.href=`http://localhost:${e}${t}${n}${r}`}catch(e){let t=e?.message||``,n={"restart.timeout":`@F13B4:重启超时`,"restart.stream-closed":`@F13B4:重启失败,请刷新页面重试`,"restart.failed":`@F13B4:重启失败`}[t];v({type:`warning`,message:n?A(n):A(`@F13B4:重启失败 {error}`,{error:t})}),w.value=!1}}}return D(()=>{M()}),g(()=>{O(!0)}),(e,t)=>{let n=a;return _(),S(`div`,G,[d(n,{content:i(A)(`@F13B4:在 GitHub 上查看源码`),placement:`top`,effect:`dark`,"show-after":300},{default:b(()=>[r(`a`,{href:`https://github.com/xz333221/zen-gitsync`,target:`_blank`,rel:`noopener noreferrer`,class:`badge-icon-link`,"aria-label":i(A)(`@F13B4:在 GitHub 上查看源码`)},[...t[1]||=[r(`svg`,{viewBox:`0 0 24 24`,width:`15`,height:`15`,"aria-hidden":`true`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`},[r(`path`,{d:`M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844a9.59 9.59 0 0 1 2.504.337c1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.02 10.02 0 0 0 22 12.017C22 6.484 17.522 2 12 2z`})],-1)]],8,K)]),_:1},8,[`content`]),d(n,{content:i(A)(`@F13B4:在 npm 上查看包`),placement:`top`,effect:`dark`,"show-after":300},{default:b(()=>[r(`a`,{href:`https://www.npmjs.com/package/zen-gitsync`,target:`_blank`,rel:`noopener noreferrer`,class:`badge-icon-link badge-icon-link--npm`,"aria-label":i(A)(`@F13B4:在 npm 上查看包`)},[...t[2]||=[r(`svg`,{viewBox:`0 0 24 24`,width:`15`,height:`15`,"aria-hidden":`true`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`},[r(`path`,{d:`M2 2v20h20V2H2zm17.167 17.167H12.5v-10h-3.333v10H4.833V4.833h14.334v14.334z`})],-1)]],8,q)]),_:1},8,[`content`]),d(n,{content:i(A)(`@F13B4:查看更新`),placement:`top`,effect:`dark`,"show-after":300},{default:b(()=>[r(`a`,{href:Z,target:`_blank`,rel:`noopener noreferrer`,class:`version-link`},`v`+p(o.value),1)]),_:1},8,[`content`]),s.value?.hasUpdate?(_(),S(`button`,{key:0,type:`button`,class:`upgrade-btn`,title:i(A)(`@F13B4:发现新版本 {version},点击升级`,{version:s.value.latest??``}),"aria-label":i(A)(`@F13B4:发现新版本 {version},点击升级`,{version:s.value.latest??``}),onClick:k},[t[3]||=r(`span`,{class:`upgrade-btn__dot`,"aria-hidden":`true`},null,-1),r(`span`,Y,p(i(A)(`@F13B4:升级`)),1),r(`span`,X,`v`+p(s.value.latest),1)],8,J)):u(``,!0),d(W,{modelValue:c.value,"onUpdate:modelValue":t[0]||=e=>c.value=e,logs:l.value,status:f.value,countdown:h.value,onRetry:k,onRestart:L,onCancel:I},null,8,[`modelValue`,`logs`,`status`,`countdown`])])}}}),[[`__scopeId`,`data-v-bc7c0d5c`]]);export{te as default};
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime-C0FnF6B9.js";import{$n as e,Bn as t,Dn as n,En as r,Er as i,F as a,Ht as ee,In as o,K as te,Nt as ne,On as s,P as c,Pn as l,Pr as u,Qr as d,Tn as f,U as re,V as ie,W as ae,Zn as p,br as m,cr as h,dn as g,et as _,kn as v,pr as y,qr as b,r as x,xn as S,yn as C,zt as w}from"./element-plus-IG-bwpR5.js";import{n as T,t as E}from"./_plugin-vue_export-helper-Dcylt9fO.js";import{t as D}from"./SvgIcon-VCh_kGGV.js";import{t as O}from"./IconButton-BxRsG5E1.js";import{t as k}from"./gitStore-BKkZm2m3.js";import{t as A}from"./CommonDialog-DNnN70HC.js";t(),y(),u(),g();var j={key:0,class:`branch-info`},M={class:`branch-wrapper`},N={class:`branch-btn`},P={class:`branch-btn-name`},F={class:`branch-btn-caret`},I={class:`branch-popover-inner`},L={class:`branch-search`},R={class:`branch-list`},z=[`onClick`],B={key:1,class:`branch-item-check-placeholder`},V={class:`branch-item-name`},oe={key:0,class:`branch-empty`},H={class:`branch-popover-footer`},U={class:`create-branch-content`},W={class:`form-label`},G={class:`form-label`},K={class:`dialog-footer`},q={class:`footer-actions`},se=[`disabled`],J=E(o({__name:`BranchSelector`,emits:[`branchChanged`],setup(t,{emit:o}){let u=k(),g=o,y=m(!1),E=m(``),J=f(()=>{let e=E.value.trim().toLowerCase();return e?u.allBranches.filter(t=>t.toLowerCase().includes(e)):u.allBranches});async function ce(e){if(e===u.currentBranch){y.value=!1;return}y.value=!1,await u.changeBranch(e)&&(g(`branchChanged`),u.refreshLog())}let Y=m(!1),X=m(``),Z=m(``);function le(){y.value=!1,Z.value=u.currentBranch,Y.value=!0}async function Q(){await u.createBranch(X.value,Z.value)&&(Y.value=!1,X.value=``,g(`branchChanged`))}let $=m(!1);async function ue(){if(!$.value){$.value=!0;try{await Promise.all([u.getCurrentBranch(!0),u.getBranchStatus(!0),u.getAllBranches()]),g(`branchChanged`),u.refreshLog()}finally{$.value=!1}}}return(t,o)=>{let f=te,m=ie,g=x,k=ae,de=c,fe=a,pe=re;return i(u).currentBranch?(p(),v(`div`,j,[r(`div`,M,[l(g,{visible:y.value,"onUpdate:visible":o[1]||=e=>y.value=e,placement:`top-start`,width:260,trigger:`click`,"popper-class":`branch-popover`,"show-arrow":!1,onShow:o[2]||=e=>E.value=``},{reference:h(()=>[r(`button`,N,[l(D,{"icon-class":`git-branch`,"class-name":`branch-btn-icon`}),r(`span`,P,d(i(u).currentBranch),1),r(`span`,F,[l(f,null,{default:h(()=>[...o[7]||=[r(`svg`,{viewBox:`0 0 1024 1024`,xmlns:`http://www.w3.org/2000/svg`},[r(`path`,{fill:`currentColor`,d:`M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.776a29.12 29.12 0 0 0 0-41.6 30.592 30.592 0 0 0-42.752 0z`})],-1)]]),_:1})])])]),default:h(()=>[r(`div`,I,[r(`div`,L,[l(m,{modelValue:E.value,"onUpdate:modelValue":o[0]||=e=>E.value=e,placeholder:i(T)(`@F13B4:搜索或签出分支`),size:`small`,clearable:``,autofocus:``},null,8,[`modelValue`,`placeholder`])]),r(`div`,R,[(p(!0),v(S,null,e(J.value,e=>(p(),v(`div`,{key:e,class:b([`branch-item`,{"is-active":e===i(u).currentBranch}]),onClick:t=>ce(e)},[e===i(u).currentBranch?(p(),n(f,{key:0,class:`branch-item-check`},{default:h(()=>[l(i(_))]),_:1})):(p(),v(`span`,B)),l(D,{"icon-class":`git-branch`,"class-name":`branch-item-icon`}),r(`span`,V,d(e),1)],10,z))),128)),J.value.length===0?(p(),v(`div`,oe,d(i(T)(`@F13B4:没有匹配的分支`)),1)):s(``,!0)]),r(`div`,H,[r(`button`,{class:`branch-create-btn`,onClick:le},[l(f,null,{default:h(()=>[l(i(w))]),_:1}),r(`span`,null,d(i(T)(`@F13B4:创建新分支`)),1)])])])]),_:1},8,[`visible`]),l(O,{tooltip:i(T)(`@CMDCON:刷新`),onClick:ue},{default:h(()=>[l(f,{class:b({"is-loading":$.value})},{default:h(()=>[l(i(ee))]),_:1},8,[`class`])]),_:1},8,[`tooltip`])]),l(A,{modelValue:Y.value,"onUpdate:modelValue":o[6]||=e=>Y.value=e,title:i(T)(`@F13B4:创建新分支`),size:`small`,"destroy-on-close":!0,"append-to-body":!0,"custom-class":`create-branch-dialog`},{footer:h(()=>[r(`div`,K,[r(`div`,q,[r(`button`,{type:`button`,class:`dialog-cancel-btn`,onClick:o[5]||=e=>Y.value=!1},d(i(T)(`@F13B4:取消`)),1),r(`button`,{type:`button`,class:`dialog-confirm-btn`,onClick:Q,disabled:i(u).isCreatingBranch},[i(u).isCreatingBranch?(p(),n(f,{key:1,class:`is-loading`},{default:h(()=>[...o[8]||=[r(`svg`,{viewBox:`0 0 1024 1024`,xmlns:`http://www.w3.org/2000/svg`},[r(`path`,{fill:`currentColor`,d:`M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32z`})],-1)]]),_:1})):(p(),n(f,{key:0},{default:h(()=>[l(i(_))]),_:1})),r(`span`,null,d(i(T)(`@F13B4:创建`)),1)],8,se)])])]),default:h(()=>[r(`div`,U,[l(pe,{model:{newBranchName:X.value,selectedBaseBranch:Z.value},"label-position":`top`},{default:h(()=>[l(k,null,{label:h(()=>[r(`div`,W,[l(f,{class:`label-icon`},{default:h(()=>[l(i(w))]),_:1}),r(`span`,null,d(i(T)(`@F13B4:新分支名称`)),1)])]),default:h(()=>[l(m,{modelValue:X.value,"onUpdate:modelValue":o[3]||=e=>X.value=e,placeholder:i(T)(`@F13B4:请输入新分支名称`),class:`modern-input`,size:`large`,onKeyup:C(Q,[`enter`])},null,8,[`modelValue`,`placeholder`])]),_:1}),l(k,null,{label:h(()=>[r(`div`,G,[l(f,{class:`label-icon`},{default:h(()=>[l(i(ne))]),_:1}),r(`span`,null,d(i(T)(`@F13B4:基于分支`)),1)])]),default:h(()=>[l(fe,{modelValue:Z.value,"onUpdate:modelValue":o[4]||=e=>Z.value=e,placeholder:i(T)(`@F13B4:选择基础分支`),class:`modern-select`,size:`large`,style:{width:`100%`}},{default:h(()=>[(p(!0),v(S,null,e(i(u).allBranches,e=>(p(),n(de,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])]),_:1})]),_:1},8,[`model`])])]),_:1},8,[`modelValue`,`title`])])):s(``,!0)}}}),[[`__scopeId`,`data-v-665171bc`]]);export{J as default};
@@ -0,0 +1,6 @@
1
+ import"./rolldown-runtime-C0FnF6B9.js";import{$n as e,A as t,Bn as n,Bt as r,C as i,Cn as a,Dn as o,E as s,En as c,Er as l,Et as u,F as d,G as f,Gt as p,H as m,Ht as h,I as g,In as _,K as v,L as y,Nn as b,Nt as x,On as S,P as C,Pn as w,Pr as T,Qr as E,S as D,T as O,Tn as k,U as A,V as j,W as M,Wt as N,X as P,Xn as F,Yn as ee,Yr as I,Zn as L,_ as te,a as R,at as ne,bn as re,br as z,cr as B,ct as V,dn as H,et as ie,i as U,it as ae,j as oe,kn as W,kt as G,ln as se,lr as ce,mt as le,nn as ue,o as de,or as fe,ot as pe,pr as K,pt as me,q as he,qr as q,qt as J,st as ge,tt as _e,vn as ve,vr as ye,w as be,x as xe,xn as Y,z as Se,zt as Ce}from"./element-plus-IG-bwpR5.js";import{f as we}from"./vendor-DcK6TCKZ.js";import{n as X,t as Z}from"./_plugin-vue_export-helper-Dcylt9fO.js";import{t as Te}from"./IconButton-BxRsG5E1.js";import{n as Ee,t as De}from"./configStore-BlqdtNUA.js";import{n as Oe,t as Q}from"./gitStore-BKkZm2m3.js";import{t as ke}from"./CommonDialog-DNnN70HC.js";import{t as Ae}from"./TemplateManager-C4go4RZu.js";import{C as je,S as Me,b as Ne,v as Pe,w as Fe,x as Ie,y as Le}from"./index-DGHrUfrh.js";n(),K(),T();var Re={key:0},ze={key:1},Be=Z(_({__name:`StageButton`,props:{from:{default:`form`}},emits:[`click`],setup(e,{emit:t}){let n=t,r=Q(),i=De();function a(e){let t=e.replace(/\\/g,`/`);return i.lockedFiles.some(e=>{let n=e.replace(/\\/g,`/`);return t===n})}function s(){return i.lockedFiles.length!==0&&r.fileList.some(e=>[`modified`,`deleted`,`untracked`].includes(e.type)?a(e.path):!1)}let c=k(()=>r.fileList.filter(e=>[`modified`,`deleted`,`untracked`].includes(e.type)&&!a(e.path)).length),u=k(()=>r.fileList.some(e=>[`modified`,`deleted`,`untracked`].includes(e.type)&&!a(e.path))),d=k(()=>r.isSelectionMode&&r.hasSelectableFiles),f=k(()=>r.selectedUnstagedPaths.length),p=k(()=>r.isSelectionMode?f.value===0:!u.value),h=k(()=>d.value?`${X(`@29974:暂存所选 `)}${f.value}${X(`@29974: 个文件`)}`:u.value?s()?`${X(`@29974:暂存`)}${c.value}${X(`@29974:个未暂存文件(逐个添加)`)}`:`${X(`@29974:暂存所有更改(git add .)`)}`:X(`@29974:没有需要暂存的更改`));async function g(){n(`click`);try{if(d.value){await r.stageFiles(r.selectedUnstagedPaths);return}if(r.isSelectionMode)return;s()?await r.addToStage():await r.addAllToStage()}catch(e){console.error(`添加文件失败:`,e)}}return(t,n)=>{let i=y,a=m;return L(),o(a,{content:h.value,placement:`top`},{default:B(()=>[w(i,{type:`primary`,icon:l(Ce),onClick:g,loading:l(r).isAddingFiles,disabled:p.value,class:q([`stage-button`,`from-${e.from}`,{"is-selective":d.value}])},{default:B(()=>[b(E(d.value?l(X)(`@29974:暂存所选`):l(X)(`@29974:暂存`))+` `,1),d.value?(L(),W(`span`,Re,`(`+E(f.value)+`)`,1)):c.value>0?(L(),W(`span`,ze,`(`+E(c.value)+`)`,1)):S(``,!0)]),_:1},8,[`icon`,`loading`,`disabled`,`class`])]),_:1},8,[`content`])}}}),[[`__scopeId`,`data-v-22060f7f`]]);n(),K(),T();var Ve={key:0},He=Z(_({__name:`CommitButton`,props:{from:{default:`form`},hasUserCommitMessage:{type:Boolean,default:!1},finalCommitMessage:{default:``},skipHooks:{type:Boolean,default:!1}},emits:[`click`,`beforeCommit`,`afterCommit`],setup(e,{emit:t}){let n=e,r=t,i=Q(),a=De(),s=k(()=>i.fileList.filter(e=>e.type===`added`&&!Fe(e.path,a.lockedFiles)).length),c=k(()=>s.value>0),u=k(()=>i.hasConflictedFiles||i.isCommiting?!0:i.isMergeInProgress?!n.hasUserCommitMessage:!c.value||!n.hasUserCommitMessage),d=k(()=>i.isCommiting?X(`@76A11:正在提交中…`):i.hasConflictedFiles?X(`@76A11:存在冲突文件,请先解决冲突`):i.isMergeInProgress?n.hasUserCommitMessage?X(`@76A11:提交并完成合并`):X(`@76A11:请输入提交信息`):c.value?n.hasUserCommitMessage?`${X(`@76A11:提交`)}${s.value}${X(`@76A11:个已暂存文件`)}`:X(`@76A11:请输入提交信息`):X(`@76A11:没有已暂存的更改`)),f=k(()=>i.isCommiting?X(`@76A11:提交中…`):X(`@76A11:提交`));async function p(){if(n.finalCommitMessage.trim()){r(`beforeCommit`),r(`click`);try{let e=await i.commitChanges(n.finalCommitMessage,n.skipHooks);r(`afterCommit`,e)}catch(e){console.error(`提交失败:`,e),r(`afterCommit`,!1)}}}return(t,n)=>{let r=y,a=m;return L(),o(a,{content:d.value,placement:`top`,disabled:l(i).isCommiting},{default:B(()=>[w(r,{type:`primary`,onClick:p,icon:l(i).isCommiting?l(G):l(ie),loading:l(i).isCommiting,disabled:u.value,"aria-busy":l(i).isCommiting?`true`:void 0,"aria-label":l(i).isCommiting?l(X)(`@76A11:正在提交中…`):void 0,class:q([`commit-button`,`from-${e.from}`,{"is-committing":l(i).isCommiting}])},{default:B(()=>[b(E(f.value)+` `,1),s.value>0&&!l(i).isCommiting?(L(),W(`span`,Ve,`(`+E(s.value)+`)`,1)):S(``,!0)]),_:1},8,[`icon`,`loading`,`disabled`,`aria-busy`,`aria-label`,`class`])]),_:1},8,[`content`,`disabled`])}}}),[[`__scopeId`,`data-v-6bd86c7e`]]);n(),K(),T();var Ue={class:`push-progress-container`},We={key:0,class:`pulling-section`},Ge={class:`pulling-text-wrap`},Ke={class:`pulling-title`},qe={class:`pulling-sub`},Je={class:`stage-header`},Ye={class:`stage-icon`},Xe={class:`stage-info`},Ze={class:`stage-label`},Qe={key:0,class:`stage-percent`},$e={key:0,class:`stage-progress`},et={key:2,class:`error-section`},tt={class:`error-header`},nt={class:`error-title`},rt={class:`error-content`},it={key:0,class:`error-suggestion`},at={key:3,class:`messages-section`},ot={class:`messages-title`},st=Z(_({__name:`PushProgressModal`,props:{modelValue:{type:Boolean}},emits:[`update:modelValue`,`complete`,`pull-requested`],setup(t,{expose:n,emit:r}){let{t:i}=we(),a=t,u=r,d=De(),f=Q(),p=z(`progress`),m=z([]),h=z(``),g=z(!1),_=k(()=>h.value.includes(`non-fast-forward`)||h.value.includes(`rejected`)&&h.value.includes(`fetch first`)),x=z(!1);async function C(){x.value=!0;try{(await f.gitPull()).success&&(A.value=!1,u(`pull-requested`))}finally{x.value=!1}}let T=ye([{name:`counting`,label:i(`@PUSH:计数对象`),status:`wait`,percent:0},{name:`compressing`,label:i(`@PUSH:压缩对象`),status:`wait`,percent:0},{name:`writing`,label:i(`@PUSH:写入对象`),status:`wait`,percent:0},{name:`resolving`,label:i(`@PUSH:解析增量`),status:`wait`,percent:0}]),D=z(0),O=z(null),A=k({get:()=>a.modelValue,set:e=>u(`update:modelValue`,e)}),j=k(()=>{if(g.value)return i(`@PUSH:正在拉取远程更新`);switch(p.value){case`progress`:return i(`@PUSH:正在推送`);case`success`:return i(`@PUSH:推送成功`);case`error`:return i(`@PUSH:推送失败`);default:return``}});function M(e){switch(e.type){case`progress`:e.message&&(m.value.push(e.message),setTimeout(()=>{O.value&&(O.value.scrollTop=O.value.scrollHeight)},0));break;case`stage-progress`:if(e.stage&&typeof e.percent==`number`){let t=T.findIndex(t=>t.name===e.stage);t!==-1&&(T[t].percent=e.percent,T[t].status=e.percent===100?`finish`:`process`,D.value=t,e.percent===100&&t<T.length-1&&(T[t+1].status=`wait`))}break;case`complete`:e.success?(p.value=`success`,T.forEach(e=>{(e.status===`process`||e.status===`wait`)&&(e.status=`finish`,e.percent=100)}),D.value=-1,d.autoClosePushModal?setTimeout(()=>{A.value=!1,u(`complete`,!0)},2e3):u(`complete`,!0)):(p.value=`error`,h.value=Oe(e),D.value<T.length&&(T[D.value].status=`error`),D.value=-1,u(`complete`,!1))}}function N(){p.value=`progress`,m.value=[],h.value=``,D.value=0,g.value=!1,T.forEach(e=>{e.status=`wait`,e.percent=0})}function P(e){g.value=e}return n({handleProgress:M,reset:N,setPulling:P}),(t,n)=>{let r=y;return L(),o(l(s),{modelValue:A.value,"onUpdate:modelValue":n[0]||=e=>A.value=e,title:j.value,width:`650px`,"close-on-click-modal":!1,"close-on-press-escape":!1,"show-close":p.value!==`progress`,"append-to-body":!0,"lock-scroll":!1,"destroy-on-close":``,class:q([`push-progress-dialog`,`status-${p.value}`])},{default:B(()=>[c(`div`,Ue,[g.value?(L(),W(`div`,We,[n[1]||=c(`div`,{class:`pulling-icon-wrap`},[c(`svg`,{class:`pulling-spinner`,viewBox:`0 0 50 50`},[c(`circle`,{class:`pulling-spinner-track`,cx:`25`,cy:`25`,r:`20`,fill:`none`,"stroke-width":`4`}),c(`circle`,{class:`pulling-spinner-arc`,cx:`25`,cy:`25`,r:`20`,fill:`none`,"stroke-width":`4`})])],-1),c(`div`,Ge,[c(`div`,Ke,E(l(i)(`@PUSH:正在拉取远程更新`)),1),c(`div`,qe,E(l(i)(`@PUSH:拉取完成后自动继续推送`)),1)])])):(L(),W(`div`,{key:1,class:q([`stages-section`,{"is-loading":p.value===`progress`,"is-success":p.value===`success`}])},[(L(!0),W(Y,null,e(T,(e,t)=>(L(),W(`div`,{key:e.name,class:q([`stage-item`,{active:D.value===t,finished:e.status===`finish`,error:e.status===`error`}])},[c(`div`,Je,[c(`div`,Ye,[e.status===`finish`?(L(),o(l(v),{key:0,class:`icon-finish`},{default:B(()=>[w(l(_e))]),_:1})):e.status===`error`?(L(),o(l(v),{key:1,class:`icon-error`},{default:B(()=>[w(l(ne))]),_:1})):e.status===`process`?(L(),o(l(v),{key:2,class:`icon-process rotating`},{default:B(()=>[w(l(G))]),_:1})):(L(),o(l(v),{key:3,class:`icon-wait`},{default:B(()=>[w(l(G))]),_:1}))]),c(`div`,Xe,[c(`div`,Ze,E(e.label),1),e.status===`process`||e.status===`finish`?(L(),W(`div`,Qe,E(e.percent)+`% `,1)):S(``,!0)])]),e.status===`process`||e.status===`finish`?(L(),W(`div`,$e,[w(l(te),{percentage:e.percent,"stroke-width":6,"show-text":!1,color:e.status===`finish`?`var(--color-success)`:`var(--color-primary)`},null,8,[`percentage`,`color`])])):S(``,!0)],2))),128))],2)),p.value===`error`&&h.value?(L(),W(`div`,et,[c(`div`,tt,[c(`div`,nt,E(l(i)(`@PUSH:错误详情`))+`:`,1),_.value?(L(),o(r,{key:0,type:`primary`,size:`small`,loading:x.value,onClick:C,class:`pull-button`},{default:B(()=>[w(l(v),null,{default:B(()=>[w(l(me))]),_:1}),b(` `+E(l(i)(`@PUSH:先拉取更新`)),1)]),_:1},8,[`loading`])):S(``,!0)]),c(`div`,rt,E(h.value),1),_.value?(L(),W(`div`,it,E(l(i)(`@PUSH:检测到远程有新提交,请先拉取更新后再推送。`)),1)):S(``,!0)])):S(``,!0),m.value.length>0?(L(),W(`div`,at,[c(`div`,ot,E(l(i)(`@PUSH:详细信息`))+`:`,1),c(`div`,{ref_key:`messagesContainerRef`,ref:O,class:`progress-messages`},[(L(!0),W(Y,null,e(m.value,(e,t)=>(L(),W(`div`,{key:t,class:`message-item`},E(e),1))),128))],512)])):S(``,!0)])]),_:1},8,[`modelValue`,`title`,`show-close`,`class`])}}}),[[`__scopeId`,`data-v-f26d0df8`]]);n(),K(),T();var ct={class:`push-button-group`},lt={key:0},ut={class:`push-remote-item`},dt=Z(_({__name:`PushButton`,props:{from:{default:`form`}},emits:[`click`,`beforePush`,`afterPush`],setup(t,{emit:n}){let r=n,a=Q(),s=z(!1),u=z(null),d=k(()=>a.branchAhead>0),f=k(()=>a.fileList.some(e=>e.type===`added`)),p=k(()=>!a.hasConflictedFiles&&a.hasUpstream&&d.value&&!f.value),h=k(()=>!p.value),_=k(()=>a.hasConflictedFiles?X(`@F4137:存在冲突文件,请先解决冲突`):a.hasUpstream?d.value?f.value?X(`@F4137:有未提交的暂存更改,请先提交`):`${X(`@F4137:推送`)}${a.branchAhead}${X(`@F4137:个本地提交`)}`:X(`@F4137:没有需要推送的提交`):X(`@F4137:当前分支没有上游分支`)),v=k(()=>p.value?{backgroundColor:`var(--color-success)`,borderColor:`var(--color-success)`}:{});async function x(){r(`beforePush`),r(`click`);try{s.value=!0,u.value&&u.value.reset();let e=await a.pushToRemoteWithProgress(e=>{u.value&&u.value.handleProgress(e)});e&&await new Promise(e=>setTimeout(e,200)),r(`afterPush`,e)}catch(e){console.error(`推送失败:`,e),r(`afterPush`,!1)}}function C(e){}let T=k(()=>[...a.remotes].sort((e,t)=>e.isUpstream===t.isUpstream?e.name.localeCompare(t.name):e.isUpstream?-1:1));async function O(e){if(e===`manage`){a.isRemoteManagerVisible=!0;return}if(e===`push-all`){await a.pushAllRemotes();return}if(!e.startsWith(`push:`))return;let t=e.slice(5);r(`beforePush`);try{s.value=!0,u.value?.reset();let e=await a.pushToRemoteWithProgress(e=>{u.value?.handleProgress(e)},t);r(`afterPush`,e)}catch(e){console.error(`推送失败:`,e),r(`afterPush`,!1)}}return(n,r)=>{let f=y,p=m,k=g,A=i,j=be,M=D;return L(),W(`div`,null,[c(`div`,ct,[w(p,{content:_.value,placement:`top`},{default:B(()=>[w(f,{type:`primary`,icon:l(ue),onClick:x,loading:l(a).isPushing,disabled:h.value,style:I(v.value),class:q([`push-button`,`from-${t.from}`])},{default:B(()=>[b(E(l(X)(`@F4137:推送`))+` `,1),d.value?(L(),W(`span`,lt,`(`+E(l(a).branchAhead)+`)`,1)):S(``,!0)]),_:1},8,[`icon`,`loading`,`disabled`,`style`,`class`])]),_:1},8,[`content`]),l(a).hasMultipleRemotes?(L(),o(M,{key:0,trigger:`click`,placement:`top-end`,onCommand:O},{dropdown:B(()=>[w(j,null,{default:B(()=>[(L(!0),W(Y,null,e(T.value,e=>(L(),o(A,{key:e.name,command:`push:${e.name}`},{default:B(()=>[c(`span`,ut,[c(`span`,null,E(l(X)(`@F4137:推送到`))+` `+E(e.name),1),e.isUpstream?(L(),o(k,{key:0,size:`small`,type:`success`,effect:`plain`},{default:B(()=>[b(E(l(X)(`@F4137:上游`)),1)]),_:1})):S(``,!0)])]),_:2},1032,[`command`]))),128)),w(A,{divided:``,command:`push-all`},{default:B(()=>[b(E(l(X)(`@F4137:推送到全部远程`)),1)]),_:1}),w(A,{divided:``,command:`manage`},{default:B(()=>[b(E(l(X)(`@F4137:管理远程…`)),1)]),_:1})]),_:1})]),default:B(()=>[w(f,{type:`primary`,icon:l(he),style:I(v.value),class:q([`push-button__caret`,`from-${t.from}`]),"aria-label":l(X)(`@F4137:更多推送选项`)},null,8,[`icon`,`style`,`class`,`aria-label`])]),_:1})):S(``,!0)]),w(st,{ref_key:`progressModalRef`,ref:u,modelValue:s.value,"onUpdate:modelValue":r[0]||=e=>s.value=e,onComplete:C},null,8,[`modelValue`])])}}}),[[`__scopeId`,`data-v-da69033d`]]);n(),K(),T();var ft={class:`one-push-content`},pt={class:`one-push-text`},mt={class:`one-push-title`},ht={key:0,class:`one-push-desc`},gt=Z(_({__name:`QuickPushButton`,props:{from:{default:`form`},hasUserCommitMessage:{type:Boolean,default:!1},finalCommitMessage:{default:``},skipHooks:{type:Boolean,default:!1}},emits:[`beforePush`,`pushStart`,`afterPush`,`clearFields`],setup(e,{expose:t,emit:n}){let i=Q(),a=De(),o=z(!1),s=z(null),u=e,d=n,f=k(()=>i.fileList.some(e=>!Fe(e.path,a.lockedFiles))),p=k(()=>i.isSelectionMode&&i.selectedFiles.size>0&&i.selectedUnstagedPaths.length>0),h=k(()=>i.hasConflictedFiles?!0:i.isSelectionMode?!p.value||!u.hasUserCommitMessage||!i.hasUpstream:!f.value&&i.branchAhead===0||!u.hasUserCommitMessage||!i.hasUpstream),g=k(()=>i.isAddingFiles||i.isCommiting||i.isPushing),_=k(()=>{if(i.hasConflictedFiles)return X(`@2E184:存在冲突文件,请先解决冲突`);if(i.isSelectionMode)return i.selectedFiles.size===0?X(`@2E184:请先勾选要推送的文件`):i.selectedUnstagedPaths.length===0?X(`@2E184:所选文件无需暂存或被锁定`):u.hasUserCommitMessage?i.hasUpstream?X(`@2E184:一键完成:仅暂存所选文件 → 提交 → 推送到远程仓库`):X(`@2E184:当前分支没有上游分支`):X(`@2E184:请输入提交信息`);let e=i.branchAhead>0;return!f.value&&!e?X(`@2E184:没有需要提交或推送的更改`):u.hasUserCommitMessage?i.hasUpstream?f.value?X(`@2E184:一键完成:暂存所有更改 → 提交 → 推送到远程仓库`):X(`@2E184:本地已提交,一键推送到远程仓库`):X(`@2E184:当前分支没有上游分支`):X(`@2E184:请输入提交信息`)}),b=k(()=>i.isSelectionMode&&p.value?X(`@2E184:一键推送所选`):X(`@2E184:一键推送所有`)),x=k(()=>u.from===`form`?i.isSelectionMode&&p.value?X(`@2E184:暂存所选 + 提交 + 推送`):X(`@2E184:暂存 + 提交 + 推送`):``);async function C(){d(`beforePush`);try{let e=i.isSelectionMode&&p.value;if((e||f.value)&&!(e?await i.stageSelectedAndCommit(u.finalCommitMessage,u.skipHooks):await i.addAndCommit(u.finalCommitMessage,u.skipHooks))){d(`afterPush`,!1);return}if(d(`pushStart`),o.value=!0,a.pullBeforePush){s.value?.setPulling(!0);let e=await i.gitPull();if(s.value?.setPulling(!1),!e.success){R.error(X(`@2E184:拉取远程更新失败,已停止推送`)),o.value=!1,i.fetchStatus(),i.getBranchStatus(!0),d(`afterPush`,!1);return}}s.value&&s.value.reset();let t=await i.pushToRemoteWithProgress(e=>{s.value&&s.value.handleProgress(e)});if(t){try{window.dispatchEvent(new CustomEvent(`zen-gitsync:after-quick-push-success`))}catch{}d(`clearFields`)}d(`afterPush`,t)}catch(e){console.error(`一键推送失败:`,e),d(`afterPush`,!1)}}t({triggerQuickPush:C});function T(e){}return(t,n)=>{let i=v,a=y;return L(),W(`div`,null,[w(l(m),{content:_.value,placement:`top`,"show-after":200},{default:B(()=>[w(a,{type:`primary`,onClick:C,loading:g.value,disabled:h.value,class:q([e.from,`one-push-button`])},{default:B(()=>[c(`div`,ft,[w(i,{class:`one-push-icon`},{default:B(()=>[w(l(r))]),_:1}),c(`div`,pt,[c(`span`,mt,E(b.value),1),e.from===`form`?(L(),W(`span`,ht,E(x.value),1)):S(``,!0)])])]),_:1},8,[`loading`,`disabled`,`class`])]),_:1},8,[`content`]),w(st,{ref_key:`progressModalRef`,ref:s,modelValue:o.value,"onUpdate:modelValue":n[0]||=e=>o.value=e,onComplete:T,onPullRequested:C},null,8,[`modelValue`])])}}}),[[`__scopeId`,`data-v-9f003c37`]]);n(),K(),T();var _t={class:`create-tag-button`},vt={class:`tag-dialog-content`},yt={class:`tag-info-card`},bt={class:`info-icon`},xt={class:`info-content`},St={class:`form-tip`},Ct={class:`form-tip`},wt={class:`form-tip`},Tt=Z(_({__name:`CreateTagButton`,props:{variant:{default:`icon`}},setup(e){let n=e,r=Q(),i=z(!1),a=z(``),s=z(``),d=z(`lightweight`),f=z(``),p=z(!1);function h(){a.value=``,s.value=``,d.value=`lightweight`,f.value=``,i.value=!0}async function g(){if(!a.value.trim()){R.warning(X(`@TAG01:请输入标签名称`));return}if(!/^[a-zA-Z0-9._\/-]+$/.test(a.value)){R.warning(X(`@TAG01:标签名称只能包含字母、数字、点、下划线、斜杠和连字符`));return}try{p.value=!0;let e=await(await fetch(`/api/create-tag`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({tagName:a.value.trim(),message:s.value.trim(),type:d.value,commit:f.value.trim()})})).json();e.success?(R.success(X(`@TAG01:标签创建成功`)),i.value=!1):R.error(e.error||X(`@TAG01:创建标签失败`))}catch(e){console.error(`创建标签失败:`,e),R.error(X(`@TAG01:创建标签失败`))}finally{p.value=!1}}let _=k(()=>d.value===`lightweight`?X(`@TAG01:轻量标签是指向提交对象的引用,不包含额外信息`):X(`@TAG01:附注标签是完整的Git对象,包含标签信息、日期、标签者和可选的签名`));return(e,x)=>{let C=v,T=y,D=m,O=j,k=M,N=t,P=oe,F=A;return L(),W(`div`,_t,[w(D,{content:l(X)(`@TAG01:为当前提交创建标签`),placement:`top`,"show-after":200,disabled:n.variant===`text`},{default:B(()=>[w(T,{type:`success`,onClick:h,disabled:!l(r).isGitRepo,circle:n.variant===`icon`,size:n.variant===`icon`?`small`:`default`,class:q(n.variant===`text`?`action-button`:``)},{default:B(()=>[n.variant===`icon`?(L(),o(C,{key:0},{default:B(()=>[w(l(J))]),_:1})):(L(),W(Y,{key:1},[b(E(l(X)(`@TAG01:创建标签`)),1)],64))]),_:1},8,[`disabled`,`circle`,`size`,`class`])]),_:1},8,[`content`,`disabled`]),w(ke,{modelValue:i.value,"onUpdate:modelValue":x[4]||=e=>i.value=e,title:l(X)(`@TAG01:创建 Git 标签`),size:`medium`,"close-on-click-modal":!1,"show-footer":``,"confirm-text":l(X)(`@TAG01:创建`),"cancel-text":l(X)(`@TAG01:取消`),"confirm-loading":p.value,"custom-class":`tag-dialog`,onConfirm:g},{default:B(()=>[c(`div`,vt,[c(`div`,yt,[c(`div`,bt,[w(C,null,{default:B(()=>[w(l(J))]),_:1})]),c(`div`,xt,[c(`h4`,null,E(l(X)(`@TAG01:Git 标签`)),1),c(`p`,null,E(l(X)(`@TAG01:标签用于标记项目的重要版本点,如发布版本 v1.0.0`)),1)])]),w(F,{"label-position":`top`,class:`tag-form`},{default:B(()=>[w(k,{label:l(X)(`@TAG01:标签名称`),required:``},{default:B(()=>[w(O,{modelValue:a.value,"onUpdate:modelValue":x[0]||=e=>a.value=e,placeholder:l(X)(`@TAG01:例如: v1.0.0 或 release-2024`),clearable:``,maxlength:`100`},{prefix:B(()=>[w(C,null,{default:B(()=>[w(l(J))]),_:1})]),_:1},8,[`modelValue`,`placeholder`]),c(`div`,St,[w(C,null,{default:B(()=>[w(l(u))]),_:1}),c(`span`,null,E(l(X)(`@TAG01:建议使用语义化版本号,如 v1.0.0`)),1)])]),_:1},8,[`label`]),w(k,{label:l(X)(`@TAG01:标签类型`)},{default:B(()=>[w(P,{modelValue:d.value,"onUpdate:modelValue":x[1]||=e=>d.value=e,size:`default`},{default:B(()=>[w(N,{value:`lightweight`},{default:B(()=>[b(E(l(X)(`@TAG01:轻量标签`)),1)]),_:1}),w(N,{value:`annotated`},{default:B(()=>[b(E(l(X)(`@TAG01:附注标签`)),1)]),_:1})]),_:1},8,[`modelValue`]),c(`div`,Ct,[w(C,null,{default:B(()=>[w(l(u))]),_:1}),c(`span`,null,E(_.value),1)])]),_:1},8,[`label`]),d.value===`annotated`?(L(),o(k,{key:0,label:l(X)(`@TAG01:标签说明`),required:d.value===`annotated`},{default:B(()=>[w(O,{modelValue:s.value,"onUpdate:modelValue":x[2]||=e=>s.value=e,placeholder:l(X)(`@TAG01:为此标签添加说明信息`),clearable:``,rows:3,type:`textarea`,resize:`none`,maxlength:`500`,"show-word-limit":``},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`label`,`required`])):S(``,!0),w(k,{label:l(X)(`@TAG01:目标提交(可选)`)},{default:B(()=>[w(O,{modelValue:f.value,"onUpdate:modelValue":x[3]||=e=>f.value=e,placeholder:l(X)(`@TAG01:留空则为当前HEAD,或输入commit SHA`),clearable:``,maxlength:`40`},{prefix:B(()=>[...x[5]||=[c(`span`,{class:`commit-prefix`},`commit:`,-1)]]),_:1},8,[`modelValue`,`placeholder`]),c(`div`,wt,[w(C,null,{default:B(()=>[w(l(u))]),_:1}),c(`span`,null,E(l(X)(`@TAG01:默认为当前HEAD提交,也可以指定历史提交`)),1)])]),_:1},8,[`label`])]),_:1})])]),_:1},8,[`modelValue`,`title`,`confirm-text`,`cancel-text`,`confirm-loading`])])}}}),[[`__scopeId`,`data-v-cbbcdcda`]]);n(),K(),T();var Et={class:`tag-list-button`},Dt={class:`tag-list-content`},Ot={key:0,class:`tag-header`},kt={class:`tag-stats`},At={class:`stat-item`},jt={class:`stat-number`},Mt={class:`stat-label`},Nt={class:`tag-actions-header`},Pt={class:`tag-list-container`},Ft={key:0,class:`empty-state`},It={class:`empty-text`},Lt={class:`empty-hint`},Rt={key:1,class:`tag-cards`},zt={class:`tag-card-content`},Bt={class:`tag-info`},Vt={class:`tag-main-info`},Ht={class:`tag-name-badge`},Ut={class:`tag-name-text`},Wt={class:`tag-meta`},Gt={class:`tag-commit`},Kt={class:`tag-date`},qt={key:0,class:`tag-message`},Jt={class:`tag-card-actions`},Yt={key:0,class:`tag-detail-content`},Xt={class:`detail-row`},Zt={class:`detail-label`},Qt={class:`detail-value`},$t={class:`detail-row`},en={class:`detail-label`},tn={class:`detail-value`},nn={class:`detail-row`},rn={class:`detail-label`},an={class:`detail-value`},on={class:`detail-row`},sn={class:`detail-label`},cn={key:0,class:`detail-row detail-message`},ln={class:`detail-label`},un={class:`message-content`},dn=Z(_({__name:`TagListButton`,props:{variant:{default:`icon`}},setup(t){let n=t,r=Q(),i=z(!1),a=z([]),s=z(!1),d=z(!1),f=z(!1),p=z(!1),_=z(null);async function x(){i.value=!0,await C()}async function C(){try{s.value=!0;let e=await(await fetch(`/api/list-tags`)).json();e.success?a.value=e.tags||[]:R.error(e.error||X(`@TAG01:获取标签列表失败`))}catch(e){console.error(`获取标签列表失败:`,e),R.error(X(`@TAG01:获取标签列表失败`))}finally{s.value=!1}}function T(e){_.value=e,p.value=!0}async function D(e){U.confirm(X(`@TAG01:确定要推送此标签到远程仓库吗?`),X(`@TAG01:推送标签`),{confirmButtonText:X(`@TAG01:推送`),cancelButtonText:X(`@TAG01:取消`),type:`info`}).then(async()=>{try{f.value=!0;let t=await(await fetch(`/api/push-tag`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({tagName:e})})).json();t.success?R.success(X(`@TAG01:标签推送成功`)):R.error(t.error||X(`@TAG01:推送标签失败`))}catch(e){console.error(`推送标签失败:`,e),R.error(X(`@TAG01:推送标签失败`))}finally{f.value=!1}}).catch(()=>{})}async function O(){U.confirm(X(`@TAG01:确定要推送所有标签到远程仓库吗?`),X(`@TAG01:推送所有标签`),{confirmButtonText:X(`@TAG01:推送`),cancelButtonText:X(`@TAG01:取消`),type:`info`}).then(async()=>{try{f.value=!0;let e=await(await fetch(`/api/push-all-tags`,{method:`POST`})).json();e.success?R.success(X(`@TAG01:所有标签推送成功`)):R.error(e.error||X(`@TAG01:推送标签失败`))}catch(e){console.error(`推送标签失败:`,e),R.error(X(`@TAG01:推送标签失败`))}finally{f.value=!1}}).catch(()=>{})}async function k(e){U.confirm(X(`@TAG01:确定要删除此标签吗?此操作不可恢复。`),X(`@TAG01:删除标签`),{confirmButtonText:X(`@TAG01:删除`),cancelButtonText:X(`@TAG01:取消`),type:`warning`}).then(async()=>{await A(e)}).catch(()=>{})}async function A(e){try{d.value=!0;let t=await(await fetch(`/api/delete-tag`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({tagName:e})})).json();t.success?(R.success(X(`@TAG01:标签删除成功`)),await C()):R.error(t.error||X(`@TAG01:删除标签失败`))}catch(e){console.error(`删除标签失败:`,e),R.error(X(`@TAG01:删除标签失败`))}finally{d.value=!1}}function j(e){if(!e)return`-`;try{return new Date(e).toLocaleString(`zh-CN`,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`})}catch{return e}}return(t,A)=>{let M=v,N=y,P=m,F=xe,ee=g,I=de;return L(),W(`div`,Et,[w(P,{content:l(X)(`@TAG01:查看和管理所有标签`),placement:`top`,"show-after":200,disabled:n.variant===`text`},{default:B(()=>[w(N,{type:`info`,onClick:x,disabled:!l(r).isGitRepo,circle:n.variant===`icon`,size:n.variant===`icon`?`small`:`default`,class:q(n.variant===`text`?`action-button`:``)},{default:B(()=>[n.variant===`icon`?(L(),o(M,{key:0},{default:B(()=>[w(l(J))]),_:1})):(L(),W(Y,{key:1},[b(E(l(X)(`@TAG01:标签列表`)),1)],64))]),_:1},8,[`disabled`,`circle`,`size`,`class`])]),_:1},8,[`content`,`disabled`]),w(ke,{modelValue:i.value,"onUpdate:modelValue":A[0]||=e=>i.value=e,title:l(X)(`@TAG01:Git 标签列表`),size:`large`,"show-footer":!1,"custom-class":`tag-list-dialog`},{default:B(()=>[c(`div`,Dt,[s.value?S(``,!0):(L(),W(`div`,Ot,[c(`div`,kt,[c(`div`,At,[w(M,{class:`stat-icon`},{default:B(()=>[w(l(J))]),_:1}),c(`span`,jt,E(a.value.length),1),c(`span`,Mt,E(l(X)(`@TAG01:个标签`)),1)])]),c(`div`,Nt,[w(N,{type:`primary`,size:`small`,icon:l(h),onClick:C,loading:s.value,class:`refresh-btn`},{default:B(()=>[b(E(l(X)(`@TAG01:刷新`)),1)]),_:1},8,[`icon`,`loading`]),a.value.length>0?(L(),o(N,{key:0,type:`success`,size:`small`,icon:l(ue),onClick:O,loading:f.value,class:`push-all-btn`},{default:B(()=>[b(E(l(X)(`@TAG01:推送所有标签`)),1)]),_:1},8,[`icon`,`loading`])):S(``,!0)])])),ce((L(),W(`div`,Pt,[a.value.length===0&&!s.value?(L(),W(`div`,Ft,[w(F,{description:l(X)(`@TAG01:暂无标签`),"image-size":120},{image:B(()=>[w(M,{class:`empty-icon`},{default:B(()=>[w(l(J))]),_:1})]),description:B(()=>[c(`p`,It,E(l(X)(`@TAG01:还没有创建任何标签`)),1),c(`p`,Lt,E(l(X)(`@TAG01:使用创建标签功能为项目添加版本标记`)),1)]),_:1},8,[`description`])])):(L(),W(`div`,Rt,[(L(!0),W(Y,null,e(a.value,e=>(L(),W(`div`,{key:e.name,class:`tag-card`},[c(`div`,zt,[c(`div`,Bt,[c(`div`,Vt,[c(`div`,Ht,[w(M,{class:`badge-icon`},{default:B(()=>[w(l(J))]),_:1}),c(`span`,Ut,E(e.name),1),w(ee,{size:`small`,type:e.type===`annotated`?`warning`:`info`,class:`type-tag`},{default:B(()=>[b(E(e.type===`annotated`?l(X)(`@TAG01:附注`):l(X)(`@TAG01:轻量`)),1)]),_:2},1032,[`type`])]),c(`div`,Wt,[c(`span`,Gt,[w(M,null,{default:B(()=>[w(l(u))]),_:1}),b(` `+E(e.commit.substring(0,8)),1)]),c(`span`,Kt,E(j(e.date)),1)]),e.message?(L(),W(`div`,qt,E(e.message),1)):S(``,!0)])]),c(`div`,Jt,[e.message?(L(),o(N,{key:0,size:`small`,type:`info`,onClick:t=>T(e),class:`action-btn view-btn`},{default:B(()=>[b(E(l(X)(`@TAG01:查看`)),1)]),_:1},8,[`onClick`])):S(``,!0),w(N,{size:`small`,type:`success`,icon:l(ue),onClick:t=>D(e.name),loading:f.value,class:`action-btn push-btn`},{default:B(()=>[b(E(l(X)(`@TAG01:推送`)),1)]),_:1},8,[`icon`,`onClick`,`loading`]),w(N,{size:`small`,type:`danger`,icon:l(V),onClick:t=>k(e.name),loading:d.value,class:`action-btn delete-btn`},{default:B(()=>[b(E(l(X)(`@TAG01:删除`)),1)]),_:1},8,[`icon`,`onClick`,`loading`])])])]))),128))]))])),[[I,s.value]])])]),_:1},8,[`modelValue`,`title`]),w(ke,{modelValue:p.value,"onUpdate:modelValue":A[1]||=e=>p.value=e,title:l(X)(`@TAG01:标签详情`),size:`medium`,"show-footer":!1,"custom-class":`tag-detail-dialog`},{default:B(()=>[_.value?(L(),W(`div`,Yt,[c(`div`,Xt,[c(`span`,Zt,E(l(X)(`@TAG01:标签名称:`)),1),c(`code`,Qt,E(_.value.name),1)]),c(`div`,$t,[c(`span`,en,E(l(X)(`@TAG01:提交SHA:`)),1),c(`code`,tn,E(_.value.commit),1)]),c(`div`,nn,[c(`span`,rn,E(l(X)(`@TAG01:创建时间:`)),1),c(`span`,an,E(j(_.value.date)),1)]),c(`div`,on,[c(`span`,sn,E(l(X)(`@TAG01:类型:`)),1),w(ee,{type:_.value.type===`annotated`?`warning`:`info`,size:`small`},{default:B(()=>[b(E(_.value.type===`annotated`?l(X)(`@TAG01:附注标签`):l(X)(`@TAG01:轻量标签`)),1)]),_:1},8,[`type`])]),_.value.message?(L(),W(`div`,cn,[c(`span`,ln,E(l(X)(`@TAG01:标签说明:`)),1),c(`div`,un,E(_.value.message),1)])):S(``,!0)])):S(``,!0)]),_:1},8,[`modelValue`,`title`])])}}}),[[`__scopeId`,`data-v-fc8d7e86`]]);n(),K(),T();var fn={class:`git-operations-button`},pn={class:`actions-section`},mn={class:`action-groups`},hn={class:`action-group`},gn={class:`group-title`},_n={class:`group-buttons`},vn={key:0},yn={class:`action-group`},bn={class:`group-title`},xn={class:`group-buttons`},Sn={class:`action-group`},Cn={class:`group-title`},wn={class:`group-buttons`},Tn={key:0},En={class:`action-group`},Dn={class:`group-title`},On={class:`group-buttons`},kn={class:`action-group`},An={class:`group-title`},jn={class:`group-buttons`},Mn={class:`action-group`},Nn={class:`group-title`},Pn={class:`group-buttons`},Fn={class:`pull-error-content`},In={key:0},Ln={key:1},Rn={class:`pull-error-detail`},zn={class:`pull-error-label`},Bn={class:`pull-error-pre`},Vn=Z(_({__name:`GitOperationsButton`,props:{variant:{default:`icon`},hasUserCommitMessage:{type:Boolean,default:!1},finalCommitMessage:{default:``},skipHooks:{type:Boolean,default:!1}},emits:[`afterCommit`,`afterPush`,`beforePush`,`clearFields`],setup(e,{expose:t,emit:n}){let r=e,i=n,a=Q(),s=z(!1),d=z(!1),f=z({needsMerge:!1,error:``,fullError:``,pullOutput:``});function p(){s.value=!0}let h=k(()=>a.fileList.filter(e=>e.type===`added`).length),g=k(()=>a.branchBehind>0),_=k(()=>a.fileList.some(e=>[`modified`,`deleted`,`untracked`,`intent-to-add`].includes(e.type)));async function C(){try{let e=await a.gitPull();e.success?(await a.fetchStatus(),await a.fetchLog(!1)):(f.value={needsMerge:e.needsMerge,error:e.error,fullError:e.fullError,pullOutput:e.pullOutput},d.value=!0)}catch(e){console.error(`拉取失败:`,e)}}async function T(){try{await a.gitFetchAll(),await a.fetchStatus(),await a.fetchLog(!1)}catch(e){console.error(`获取远程分支失败:`,e)}}async function D(){if(r.hasUserCommitMessage)try{await a.addAndCommit(r.finalCommitMessage,r.skipHooks),a.fetchStatus(),a.fetchLog(),i(`afterCommit`,!0),i(`clearFields`)}catch(e){console.error(`暂存并提交失败:`,e)}}function A(){i(`beforePush`)}function j(e){i(`afterPush`,e)}function M(){i(`clearFields`)}return t({openGitOperationsDrawer:p}),(t,n)=>{let k=v,P=y,F=m,ee=O;return L(),W(`div`,fn,[r.variant===`icon`?(L(),o(Te,{key:0,tooltip:l(X)(`@F13B4:Git 操作`),size:`large`,"custom-class":`btn-rotate-on-hover`,onClick:p},{default:B(()=>[w(k,null,{default:B(()=>[w(l(x))]),_:1})]),_:1},8,[`tooltip`])):(L(),o(P,{key:1,type:`primary`,class:`action-button`,onClick:p},{default:B(()=>[b(E(l(X)(`@F13B4:Git 操作`)),1)]),_:1})),w(ee,{modelValue:s.value,"onUpdate:modelValue":n[2]||=e=>s.value=e,title:l(X)(`@76872:Git 操作`),direction:`rtl`,size:`362px`,"with-header":!0,"show-close":!0,"destroy-on-close":!1,"append-to-body":!0,class:`git-operations-drawer`},{default:B(()=>[c(`div`,pn,[c(`div`,mn,[c(`div`,hn,[c(`div`,gn,E(l(X)(`@76872:基础操作`)),1),c(`div`,_n,[w(Be,{onClick:()=>{},from:`drawer`}),w(Le,{onClick:()=>{},from:`drawer`}),w(He,{"has-user-commit-message":e.hasUserCommitMessage,"final-commit-message":e.finalCommitMessage,"skip-hooks":e.skipHooks,onBeforeCommit:()=>{},onAfterCommit:n[0]||=e=>i(`afterCommit`,e),onClick:()=>{},from:`drawer`},null,8,[`has-user-commit-message`,`final-commit-message`,`skip-hooks`]),w(dt,{onBeforePush:()=>{},onAfterPush:n[1]||=e=>i(`afterPush`,e),onClick:()=>{},from:`drawer`}),w(F,{content:l(a).hasConflictedFiles?l(X)(`@76872:存在冲突文件,请先解决冲突`):g.value?`${l(X)(`@76872:拉取`)}${l(a).branchBehind}${l(X)(`@76872:个远程提交`)}`:`git pull`,placement:`top`},{default:B(()=>[w(P,{type:`primary`,icon:l(me),onClick:C,loading:l(a).isGitPulling,disabled:!l(a).hasUpstream||l(a).hasConflictedFiles,class:`action-button`,style:I(l(a).hasUpstream&&!l(a).hasConflictedFiles?{color:`white`,backgroundColor:`#1e90ff`,borderColor:`#1e90ff`}:{})},{default:B(()=>[b(E(l(X)(`@76872:拉取`))+` `,1),g.value?(L(),W(`span`,vn,`(`+E(l(a).branchBehind)+`)`,1)):S(``,!0)]),_:1},8,[`icon`,`loading`,`disabled`,`style`])]),_:1},8,[`content`]),w(F,{content:`git fetch --all`,placement:`top`},{default:B(()=>[w(P,{type:`info`,icon:l(pe),onClick:T,loading:l(a).isGitFetching,class:`action-button`,style:{color:`white`,"background-color":`#1e90ff`,"border-color":`#1e90ff`}},{default:B(()=>[b(E(l(X)(`@76872:获取所有远程分支`)),1)]),_:1},8,[`icon`,`loading`])]),_:1})])]),c(`div`,yn,[c(`div`,bn,E(l(X)(`@76872:组合操作`)),1),c(`div`,xn,[w(F,{content:l(a).hasConflictedFiles?l(X)(`@76872:存在冲突文件,请先解决冲突`):`git add + git commit`,placement:`top`},{default:B(()=>[w(P,{type:`primary`,icon:l(le),onClick:D,loading:l(a).isAddingFiles||l(a).isCommiting,disabled:!_.value||!e.hasUserCommitMessage||l(a).hasConflictedFiles,class:`action-button`},{default:B(()=>[b(E(l(X)(`@76872:暂存并提交`)),1)]),_:1},8,[`icon`,`loading`,`disabled`])]),_:1},8,[`content`]),w(gt,{from:`drawer`,"has-user-commit-message":e.hasUserCommitMessage,"final-commit-message":e.finalCommitMessage,"skip-hooks":e.skipHooks,onBeforePush:A,onAfterPush:j,onClearFields:M},null,8,[`has-user-commit-message`,`final-commit-message`,`skip-hooks`])])]),c(`div`,Sn,[c(`div`,Cn,E(l(X)(`@76872:重置操作`)),1),c(`div`,wn,[w(F,{content:h.value>0?`${l(X)(`@76872:撤销`)}${h.value}${l(X)(`@76872:个已暂存文件`)}`:`git reset HEAD`,placement:`top`},{default:B(()=>[w(P,{type:`warning`,icon:l(N),onClick:l(a).resetHead,loading:l(a).isResetting,disabled:h.value===0||l(a).hasConflictedFiles,class:`action-button reset-button`},{default:B(()=>[b(E(l(X)(`@76872:重置暂存区`))+` `,1),h.value>0?(L(),W(`span`,Tn,`(`+E(h.value)+`)`,1)):S(``,!0)]),_:1},8,[`icon`,`onClick`,`loading`,`disabled`])]),_:1},8,[`content`]),w(Pe,{variant:`text`})])]),c(`div`,En,[c(`div`,Dn,E(l(X)(`@76872:分支操作`)),1),c(`div`,On,[w(Ne,{variant:`text`})])]),c(`div`,kn,[c(`div`,An,E(l(X)(`@76872:储藏操作`)),1),c(`div`,jn,[w(je,{variant:`text`}),w(Me,{variant:`text`})])]),c(`div`,Mn,[c(`div`,Nn,E(l(X)(`@TAG01:标签操作`)),1),c(`div`,Pn,[w(Tt,{variant:`text`}),w(dn,{variant:`text`})])])])])]),_:1},8,[`modelValue`,`title`]),w(ke,{modelValue:d.value,"onUpdate:modelValue":n[3]||=e=>d.value=e,title:f.value.needsMerge?l(X)(`@76872:需要合并更改`):l(X)(`@76872:拉取失败`),size:`medium`,"show-footer":!0,"show-cancel":!1,"confirm-text":l(X)(`@76872:我知道了`),"append-to-body":!0,onConfirm:n[4]||=e=>d.value=!1},{default:B(()=>[c(`div`,Fn,[c(`div`,{class:q([`pull-error-type`,f.value.needsMerge?`is-warning`:`is-error`])},[w(k,{class:`pull-error-icon`},{default:B(()=>[w(l(u))]),_:1}),f.value.needsMerge?(L(),W(`span`,In,E(l(X)(`@76872:本地存在未提交的更改,与远程内容冲突,请先处理本地更改后再拉取。`)),1)):(L(),W(`span`,Ln,E(l(X)(`@76872:执行 git pull 时发生错误,请查看详细信息。`)),1))],2),c(`div`,Rn,[c(`div`,zn,E(l(X)(`@76872:错误详情`))+`:`,1),c(`pre`,Bn,E(f.value.fullError||f.value.error),1)])])]),_:1},8,[`modelValue`,`title`,`confirm-text`])])}}}),[[`__scopeId`,`data-v-f75259bd`]]);n(),T(),H();var Hn={class:`loading-container`},Un={class:`loading-text`},Wn={key:0,class:`loading-progress`},Gn=_({__name:`GlobalLoading`,props:{visible:{type:Boolean,default:!1},text:{default:X(`@2AEBA:加载中...`)},showProgress:{type:Boolean,default:!1},progress:{default:0},mock:{type:Boolean,default:!1}},setup(e){return(t,n)=>(L(),o(a,{to:`body`},[w(se,{name:`loading-fade`},{default:B(()=>[e.visible||e.mock?(L(),W(`div`,{key:0,class:`global-loading-overlay`,onClick:n[0]||=re(()=>{},[`stop`])},[c(`div`,Hn,[n[1]||=c(`div`,{class:`loading-spinner`},[c(`div`,{class:`spinner-ring`}),c(`div`,{class:`spinner-ring`}),c(`div`,{class:`spinner-ring`})],-1),c(`div`,Un,E(e.text),1),e.showProgress||e.mock?(L(),W(`div`,Wn,[c(`div`,{class:q([`progress-bar`,{"is-mock":e.mock&&!e.showProgress}]),style:I(e.showProgress?{width:e.progress+`%`}:void 0)},null,6)])):S(``,!0)])])):S(``,!0)]),_:1})]))}}),Kn=Z(Gn,[[`__scopeId`,`data-v-6d13a220`]]);n(),T(),H();var qn={class:`success-container`},Jn={class:`success-text`},Yn={key:0,class:`success-description`},Xn=_({__name:`SuccessModal`,props:{visible:{type:Boolean,default:!1},text:{default:X(`@71545:操作成功!`)},description:{default:``}},setup(e){return(t,n)=>(L(),o(a,{to:`body`},[w(se,{name:`success-fade`},{default:B(()=>[e.visible?(L(),W(`div`,{key:0,class:`success-overlay`,onClick:n[0]||=re(()=>{},[`stop`])},[c(`div`,qn,[n[1]||=c(`div`,{class:`success-icon`},[c(`svg`,{viewBox:`0 0 52 52`,class:`success-svg`},[c(`circle`,{class:`success-circle`,cx:`26`,cy:`26`,r:`25`,fill:`none`}),c(`path`,{class:`success-check`,fill:`none`,d:`m14.1 27.2l7.1 7.2 16.7-16.8`})])],-1),c(`div`,Jn,E(e.text),1),e.description?(L(),W(`div`,Yn,E(e.description),1)):S(``,!0)])])):S(``,!0)]),_:1})]))}}),Zn=Z(Xn,[[`__scopeId`,`data-v-c10f43b3`]]);K();var $=ye({visible:!1,text:X(`@F2A3A:加载中...`),showProgress:!1,progress:0});function Qn(){return{loadingState:$,show:e=>{$.visible=!0,$.text=e?.text||X(`@F2A3A:加载中...`),$.showProgress=e?.showProgress||!1,$.progress=e?.progress||0},hide:()=>{$.visible=!1},updateProgress:e=>{$.progress=Math.max(0,Math.min(100,e))},updateText:e=>{$.text=e},setText:e=>{$.visible&&($.text=e)}}}K();var $n=ye({visible:!1,text:X(`@B8591:操作成功!`),description:``});function er(){let e=e=>{$n.visible=!0,$n.text=e?.text||X(`@B8591:操作成功!`),$n.description=e?.description||``;let n=e?.duration||2e3;setTimeout(()=>{t()},n)},t=()=>{$n.visible=!1};return{successState:$n,show:e,hide:t}}n(),K(),T();var tr={class:`one-commit-content`},nr={class:`one-commit-text`},rr={class:`one-commit-title`},ir={key:0,class:`one-commit-desc`},ar=Z(_({__name:`QuickCommitButton`,props:{from:{default:`form`},hasUserCommitMessage:{type:Boolean,default:!1},finalCommitMessage:{default:``},skipHooks:{type:Boolean,default:!1}},emits:[`beforeCommit`,`afterCommit`,`clearFields`],setup(e,{expose:t,emit:n}){let r=Q(),i=De(),a=e,o=n,s=k(()=>r.fileList.some(e=>!Fe(e.path,i.lockedFiles))),u=k(()=>r.isSelectionMode&&r.selectedFiles.size>0&&r.selectedUnstagedPaths.length>0),d=k(()=>r.hasConflictedFiles?!0:r.isSelectionMode?!u.value||!a.hasUserCommitMessage:!s.value||!a.hasUserCommitMessage),f=k(()=>r.isAddingFiles||r.isCommiting),p=k(()=>r.hasConflictedFiles?X(`@2E184:存在冲突文件,请先解决冲突`):r.isSelectionMode?r.selectedFiles.size===0?X(`@2E184:请先勾选要提交的文件`):r.selectedUnstagedPaths.length===0?X(`@2E184:所选文件无需暂存或被锁定`):a.hasUserCommitMessage?X(`@2E184:一键完成:仅暂存所选文件 → 提交`):X(`@2E184:请输入提交信息`):s.value?a.hasUserCommitMessage?X(`@2E184:一键完成:暂存所有更改 → 提交`):X(`@2E184:请输入提交信息`):X(`@2E184:没有需要提交的更改`)),h=k(()=>r.isSelectionMode&&u.value?X(`@2E184:一键提交所选`):X(`@2E184:一键提交`)),g=k(()=>a.from===`form`?r.isSelectionMode&&u.value?X(`@2E184:暂存所选 + 提交`):X(`@2E184:暂存 + 提交`):``);async function _(){o(`beforeCommit`);try{let e=await r.stageSelectedAndCommit(a.finalCommitMessage,a.skipHooks);e&&o(`clearFields`),o(`afterCommit`,e)}catch(e){console.error(`一键提交失败:`,e),o(`afterCommit`,!1)}}return t({triggerQuickCommit:_}),(t,n)=>{let r=v,i=y;return L(),W(`div`,null,[w(l(m),{content:p.value,placement:`top`,"show-after":200},{default:B(()=>[w(i,{type:`primary`,onClick:_,loading:f.value,disabled:d.value,class:q([e.from,`one-commit-button`])},{default:B(()=>[c(`div`,tr,[w(r,{class:`one-commit-icon`},{default:B(()=>[w(l(le))]),_:1}),c(`div`,nr,[c(`span`,rr,E(h.value),1),e.from===`form`?(L(),W(`span`,ir,E(g.value),1)):S(``,!0)])])]),_:1},8,[`loading`,`disabled`,`class`])]),_:1},8,[`content`])])}}}),[[`__scopeId`,`data-v-0bcf5e9d`]]);n(),K();var or={class:`form-bottom-actions`},sr={class:`actions-flex-container`},cr={class:`left-actions`},lr={class:`button-grid`},ur={class:`right-actions`},dr=Z(_({__name:`GitActionButtons`,props:{hasUserCommitMessage:{type:Boolean,default:!1},finalCommitMessage:{default:``},skipHooks:{type:Boolean,default:!1},from:{default:`form`}},emits:[`afterCommit`,`afterPush`,`beforePush`,`pushStart`,`clearFields`],setup(e,{expose:t,emit:n}){let r=n,i=z(null);function a(e){r(`afterCommit`,e)}function o(e){r(`afterPush`,e)}function s(){r(`beforePush`)}function l(){r(`pushStart`)}function u(){r(`clearFields`)}async function d(){return i.value?.triggerQuickPush()}return t({triggerQuickPush:d}),(t,n)=>(L(),W(`div`,or,[c(`div`,sr,[c(`div`,cr,[c(`div`,lr,[w(Be,{onClick:()=>{},from:e.from},null,8,[`from`]),w(He,{"has-user-commit-message":e.hasUserCommitMessage,"final-commit-message":e.finalCommitMessage,"skip-hooks":e.skipHooks,onBeforeCommit:()=>{},onAfterCommit:a,onClick:()=>{},from:e.from},null,8,[`has-user-commit-message`,`final-commit-message`,`skip-hooks`,`from`]),w(dt,{onBeforePush:()=>{},onAfterPush:o,onClick:()=>{},from:e.from},null,8,[`from`])])]),c(`div`,ur,[w(ar,{from:e.from,"has-user-commit-message":e.hasUserCommitMessage,"final-commit-message":e.finalCommitMessage,"skip-hooks":e.skipHooks,onAfterCommit:a,onClearFields:u},null,8,[`from`,`has-user-commit-message`,`final-commit-message`,`skip-hooks`]),w(gt,{ref_key:`quickPushRef`,ref:i,from:e.from,"has-user-commit-message":e.hasUserCommitMessage,"final-commit-message":e.finalCommitMessage,"skip-hooks":e.skipHooks,onBeforePush:s,onPushStart:l,onAfterPush:o,onClearFields:u},null,8,[`from`,`has-user-commit-message`,`final-commit-message`,`skip-hooks`])])])]))}}),[[`__scopeId`,`data-v-92e31e45`]]);n(),K(),T(),H();var fr={class:`dialog-toolbar`},pr={class:`filter-controls`},mr={class:`toolbar-actions`},hr=[`disabled`],gr={class:`btn-text`},_r=[`disabled`],vr={class:`btn-text`},yr=[`disabled`],br={class:`btn-text`},xr={class:`history-scroll`},Sr={key:0,class:`loading-state`},Cr={class:`loading-text`},wr={key:3,class:`history-list`},Tr=[`onClick`],Er={class:`command-info`},Dr={class:`command-text`},Or={class:`command-meta`},kr={class:`timestamp`},Ar={class:`duration`},jr={class:`item-actions`},Mr={key:0,class:`item-details`},Nr={key:0,class:`output-section`},Pr={class:`output-header`},Fr=[`onClick`],Ir={class:`output-content`},Lr={key:0,class:`truncation-notice`},Rr={class:`output-header`},zr={class:`output-content`},Br={key:0,class:`truncation-notice`},Vr={key:2,class:`output-section error`},Hr={class:`output-header`},Ur={class:`output-content`},Wr=Z(_({__name:`CommandHistory`,setup(t){let n=Q(),r=z([]),i=z(!1);function a(e){return Array.isArray(e)?e.join(` `):e==null?``:String(e)}let s=z(!1),u=z(!1),h=z(!1),_=z(new Set),y=z(!1),x=z(!1),T=z(`all`),D=z(`all`),O=z(``),A=k(()=>{let e=r.value;if(T.value!==`all`&&(e=e.filter(e=>T.value===`success`?e.success:!e.success)),D.value!==`all`&&(e=e.filter(e=>{let t=a(e.command).startsWith(`git `);return D.value===`git`?t:!t})),O.value.trim()){let t=O.value.toLowerCase();e=e.filter(e=>a(e.command).toLowerCase().includes(t)||e.stdout&&e.stdout.toLowerCase().includes(t)||e.stderr&&e.stderr.toLowerCase().includes(t)||e.error&&e.error.toLowerCase().includes(t))}return e}),M=k(()=>r.value.filter(e=>e.success).length),N=k(()=>r.value.filter(e=>!e.success).length),I=k(()=>r.value.filter(e=>a(e.command).startsWith(`git `)).length),te=k(()=>r.value.filter(e=>!a(e.command).startsWith(`git `)).length);function ne(){x.value=!0,r.value.length===0&&H()}async function H(){try{if(i.value=!0,n.socket&&n.socket.connected)n.socket.emit(`request_full_history`);else{let e=await(await fetch(`/api/command-history`)).json();e.success?r.value=e.history:R.error(`${X(`@81F0F:加载命令历史失败: `)}${e.error}`)}}catch(e){R.error(`${X(`@81F0F:加载命令历史失败: `)}${e.message}`)}finally{i.value=!1}}async function ie(){if(A.value.length===0){R.warning(X(`@81F0F:没有可复制的命令历史`));return}try{u.value=!0;let e=A.value.map(e=>{let t=`# ${ce(e.timestamp)}${X(`@81F0F: (耗时: `)}${le(e.executionTime)}) - ${e.success?X(`@81F0F:成功`):X(`@81F0F:失败`)}\n`;if(t+=`${a(e.command)}\n`,e.stdout&&(t+=`\n# 输出:\n${e.stdout}\n`),e.stderr){let n=K(e.command)?X(`@81F0F:输出信息`):X(`@81F0F:错误输出`);t+=`\n# ${n}:\n${e.stderr}\n`}return e.error&&(t+=`\n# 错误信息:\n${e.error}\n`),t}).join(`
2
+ ---
3
+
4
+ `);await navigator.clipboard.writeText(e),R({message:X(`@81F0F:命令历史已复制到剪贴板`),type:`success`,zIndex:1e5})}catch(e){R.error(`${X(`@81F0F:复制失败: `)}${e.message}`)}finally{u.value=!1}}async function oe(){if(A.value.length===0){R.warning(X(`@81F0F:没有可复制的命令`));return}try{y.value=!0;let e=A.value.map(e=>a(e.command)).join(`
5
+ `);await navigator.clipboard.writeText(e),R({message:X(`@81F0F:命令列表已复制到剪贴板`),type:`success`,zIndex:1e5})}catch(e){R.error(`${X(`@81F0F:复制失败: `)}${e.message}`)}finally{y.value=!1}}async function se(){try{if(await U.confirm(X(`@81F0F:确定要清空所有命令历史记录吗?此操作不可恢复。`),X(`@81F0F:清空命令历史`),{confirmButtonText:X(`@81F0F:确定`),cancelButtonText:X(`@81F0F:取消`),type:`warning`}),s.value=!0,n.socket&&n.socket.connected)n.socket.emit(`clear_command_history`);else{let e=await(await fetch(`/api/clear-command-history`,{method:`POST`,headers:{"Content-Type":`application/json`}})).json();e.success?(r.value=[],R.success(X(`@81F0F:命令历史已清空`))):R.error(`${X(`@81F0F:清空命令历史失败: `)}${e.error}`)}}catch(e){e!==`cancel`&&e.toString()!==`Error: cancel`&&R.error(`${X(`@81F0F:清空命令历史失败: `)}${e.message}`)}finally{s.value=!1}}function ce(e){return new Date(e).toLocaleString()}function le(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(2)}s`}function ue(e){_.value.has(e)?_.value.delete(e):_.value.add(e)}function de(e){return _.value.has(e)}async function fe(e){try{await navigator.clipboard.writeText(e),R({message:X(`@81F0F:命令已复制到剪贴板`),type:`success`,zIndex:1e5})}catch(e){R.error(`${X(`@81F0F:复制失败: `)}${e.message}`)}}function pe(e){return e.includes(`git push`)||e.includes(`git-push`)}function K(e){return!!pe(a(e))}async function me(e){try{let t=``;if(e.stdout&&(t+=`标准输出:\n${e.stdout}\n\n`),e.stderr){let n=K(e.command)?X(`@81F0F:输出信息`):X(`@81F0F:错误输出`);t+=`${n}:\n${e.stderr}\n\n`}e.error&&(t+=`错误信息:\n${e.error}`),await navigator.clipboard.writeText(t.trim()),R({message:X(`@81F0F:输出已复制到剪贴板`),type:`success`,zIndex:1e5})}catch(e){R.error(`${X(`@81F0F:复制失败: `)}${e.message}`)}}function J(){if(!n.socket){console.error(X(`@81F0F:Socket实例不可用`));return}n.socket.on(`initial_command_history`,e=>{r.value=e.history,h.value=!0}),n.socket.on(`command_history_update`,e=>{r.value.unshift(e.newCommand),r.value.length>100&&r.value.pop(),h.value=!0}),n.socket.on(`full_command_history`,e=>{r.value=e.history,i.value=!1,h.value=!0}),n.socket.on(`command_history_cleared`,e=>{e.success&&(r.value=[],R.success(X(`@81F0F:命令历史已清空`))),s.value=!1}),n.socket.on(`connect`,()=>{h.value=!0,R.success(X(`@81F0F:已连接到实时命令历史`))}),n.socket.on(`disconnect`,()=>{h.value=!1,R.warning(X(`@81F0F:实时命令历史连接已断开`))})}function _e(){n.socket&&(n.socket.off(`initial_command_history`),n.socket.off(`command_history_update`),n.socket.off(`full_command_history`),n.socket.off(`command_history_cleared`))}return ee(()=>{J(),n.socket||(console.log(X(`@81F0F:尝试初始化Socket连接`)),n.initSocketConnection())}),F(()=>{_e()}),(t,n)=>{let _=v,k=g,F=C,ee=d,R=j,z=m,H=xe,U=f;return L(),W(Y,null,[w(Te,{tooltip:l(X)(`@81F0F:查看Git命令历史`),size:`large`,onClick:ne},{default:B(()=>[w(_,null,{default:B(()=>[w(l(ae))]),_:1})]),_:1},8,[`tooltip`]),w(ke,{modelValue:x.value,"onUpdate:modelValue":n[3]||=e=>x.value=e,title:l(X)(`@81F0F:Git 命令历史`),"destroy-on-close":``,"custom-class":`command-history-dialog`,"append-to-body":!0},{default:B(()=>[c(`div`,fr,[w(k,{type:h.value?`success`:`danger`,size:`small`,effect:`dark`,class:`socket-status`},{default:B(()=>[b(E(h.value?l(X)(`@81F0F:实时更新`):l(X)(`@81F0F:未连接`)),1)]),_:1},8,[`type`]),c(`div`,pr,[w(ee,{modelValue:T.value,"onUpdate:modelValue":n[0]||=e=>T.value=e,size:`small`,class:`filter-select`},{default:B(()=>[w(F,{label:`全部状态`,value:`all`}),w(F,{label:`成功 (${M.value})`,value:`success`},null,8,[`label`]),w(F,{label:`失败 (${N.value})`,value:`error`},null,8,[`label`])]),_:1},8,[`modelValue`]),w(ee,{modelValue:D.value,"onUpdate:modelValue":n[1]||=e=>D.value=e,size:`small`,class:`filter-select`},{default:B(()=>[w(F,{label:`全部命令`,value:`all`}),w(F,{label:`Git 命令 (${I.value})`,value:`git`},null,8,[`label`]),w(F,{label:`其他命令 (${te.value})`,value:`other`},null,8,[`label`])]),_:1},8,[`modelValue`]),w(R,{modelValue:O.value,"onUpdate:modelValue":n[2]||=e=>O.value=e,size:`small`,placeholder:`搜索命令或输出...`,clearable:``,class:`search-input`},{prefix:B(()=>[w(_,null,{default:B(()=>[w(l(p))]),_:1})]),_:1},8,[`modelValue`])]),c(`div`,mr,[w(z,{content:l(X)(`@81F0F:只复制命令列表(不含输出)`),placement:`bottom`,effect:`dark`,"show-after":200},{default:B(()=>[c(`button`,{class:`modern-btn copy-commands-button enhanced-btn`,onClick:oe,disabled:A.value.length===0||y.value},[y.value?(L(),o(_,{key:1,class:`btn-icon is-loading`},{default:B(()=>[w(l(G))]),_:1})):(L(),o(_,{key:0,class:`btn-icon`},{default:B(()=>[w(l(ge))]),_:1})),c(`span`,gr,E(l(X)(`@81F0F:命令`)),1)],8,hr)]),_:1},8,[`content`]),w(z,{content:l(X)(`@81F0F:复制完整命令历史(含输出)`),placement:`bottom`,effect:`dark`,"show-after":200},{default:B(()=>[c(`button`,{class:`modern-btn copy-all-button enhanced-btn`,onClick:ie,disabled:A.value.length===0||u.value},[u.value?(L(),o(_,{key:1,class:`btn-icon is-loading`},{default:B(()=>[w(l(G))]),_:1})):(L(),o(_,{key:0,class:`btn-icon`},{default:B(()=>[w(l(ge))]),_:1})),c(`span`,vr,E(l(X)(`@81F0F:全部`)),1)],8,_r)]),_:1},8,[`content`]),w(z,{content:l(X)(`@81F0F:清空命令历史`),placement:`bottom`,effect:`dark`,"show-after":200},{default:B(()=>[c(`button`,{class:`modern-btn clear-button enhanced-btn danger-btn`,onClick:se,disabled:r.value.length===0||s.value},[s.value?(L(),o(_,{key:1,class:`btn-icon is-loading`},{default:B(()=>[w(l(G))]),_:1})):(L(),o(_,{key:0,class:`btn-icon`},{default:B(()=>[w(l(V))]),_:1})),c(`span`,br,E(l(X)(`@81F0F:清空`)),1)],8,yr)]),_:1},8,[`content`])])]),c(`div`,xr,[i.value&&r.value.length===0?(L(),W(`div`,Sr,[w(_,{class:`loading-icon is-loading`},{default:B(()=>[w(l(G))]),_:1}),c(`div`,Cr,E(l(X)(`@81F0F:加载命令历史...`)),1)])):r.value.length===0?(L(),o(H,{key:1,description:l(X)(`@81F0F:暂无命令历史`)},null,8,[`description`])):A.value.length===0?(L(),o(H,{key:2,description:l(X)(`@81F0F:没有匹配的命令`)},null,8,[`description`])):(L(),W(`div`,wr,[(L(!0),W(Y,null,e(A.value,(e,t)=>(L(),W(`div`,{key:t,class:q([`history-item`,{"is-error":!e.success}])},[c(`div`,{class:`item-header`,onClick:e=>ue(t)},[c(`div`,Er,[c(`div`,Dr,[w(k,{size:`small`,type:e.success?`success`:`danger`,effect:`dark`,class:`status-tag`},{default:B(()=>[b(E(e.success?l(X)(`@81F0F:成功`):l(X)(`@81F0F:失败`)),1)]),_:2},1032,[`type`]),c(`code`,null,E(a(e.command)),1)]),c(`div`,Or,[c(`span`,kr,E(ce(e.timestamp)),1),c(`span`,Ar,E(l(X)(`@81F0F:耗时: `))+E(le(e.executionTime)),1)])]),c(`div`,jr,[w(Te,{tooltip:l(X)(`@81F0F:复制命令`),"custom-class":`item-copy-button`,onClick:re(t=>fe(a(e.command)),[`stop`])},{default:B(()=>[w(_,null,{default:B(()=>[w(l(ge))]),_:1})]),_:1},8,[`tooltip`,`onClick`]),c(`div`,{class:q([`expand-button`,{"is-expanded":de(t)}])},[w(_,{class:`btn-icon`},{default:B(()=>[de(t)?(L(),o(l(P),{key:0})):(L(),o(l(he),{key:1}))]),_:2},1024)],2)])],8,Tr),de(t)?(L(),W(`div`,Mr,[e.stdout?(L(),W(`div`,Nr,[c(`div`,Pr,[c(`h4`,null,E(l(X)(`@81F0F:标准输出`)),1),w(z,{content:l(X)(`@81F0F:复制输出`),placement:`bottom`,effect:`dark`,"show-after":200},{default:B(()=>[c(`button`,{class:`modern-btn output-copy-button enhanced-btn`,onClick:t=>me(e)},[w(_,{class:`btn-icon`},{default:B(()=>[w(l(ge))]),_:1})],8,Fr)]),_:2},1032,[`content`])]),c(`pre`,Ir,E(e.stdout),1),e.isStdoutTruncated?(L(),W(`div`,Lr,[w(U,{type:`info`,closable:!1,"show-icon":``},{default:B(()=>[b(E(l(X)(`@81F0F:输出内容过长已被截断,请直接执行命令查看完整输出`)),1)]),_:1})])):S(``,!0)])):S(``,!0),e.stderr?(L(),W(`div`,{key:1,class:q([`output-section`,K(e.command)?``:`error`])},[c(`div`,Rr,[c(`h4`,null,E(K(e.command)?l(X)(`@81F0F:输出信息`):l(X)(`@81F0F:错误输出`)),1)]),c(`pre`,zr,E(e.stderr),1),e.isStderrTruncated?(L(),W(`div`,Br,[w(U,{type:`info`,closable:!1,"show-icon":``},{default:B(()=>[b(E(K(e.command)?l(X)(`@81F0F:输出信息`):l(X)(`@81F0F:错误输出`))+E(l(X)(`@81F0F:内容过长已被截断,请直接执行命令查看完整输出`)),1)]),_:2},1024)])):S(``,!0)],2)):S(``,!0),e.error?(L(),W(`div`,Vr,[c(`div`,Hr,[c(`h4`,null,E(l(X)(`@81F0F:错误信息`)),1)]),c(`pre`,Ur,E(e.error),1)])):S(``,!0)])):S(``,!0)],2))),128))]))])]),_:1},8,[`modelValue`,`title`])],64)}}}),[[`__scopeId`,`data-v-03e1a58f`]]);n(),K(),T(),H();var Gr={class:`card-header app-card-header`},Kr={class:`header-left`},qr={class:`header-right`},Jr={class:`card-content app-card-content`},Yr={class:`layout-container`},Xr={key:0,class:`git-config-warning`},Zr={key:0,class:`merge-in-progress-banner`},Qr={class:`commit-section`},$r={key:0,class:`commit-form`},ei={class:`description-container`},ti={key:1,class:`standard-commit-form`},ni={class:`standard-commit-header`},ri={class:`type-scope-container`},ii={class:`scope-wrapper`},ai={class:`description-container description-inline`},oi={class:`advanced-fields`},si={key:0,class:`status-updating-indicator`},ci={key:0,class:`status-updating-indicator`},li=Z(_({__name:`CommitForm`,setup(t){let n=z(!1);async function r(){if(!n.value){n.value=!0;try{let e=i.isSelectionMode&&i.selectedFiles.size>0?[...i.selectedFiles]:[],t=Ee(),n=await(await fetch(`/api/config/generate-commit-message`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({selectedPaths:e,locale:t.currentLocale})})).json();if(!n.success){let e=n.code,t=n.error||X(`@76872:AI生成失败`),r=e?{TIMEOUT:`@76872:AI生成超时,请重试或检查模型响应速度`,NO_MODEL:`@76872:未配置AI模型,请先在通用设置中添加模型`,NO_JSON:`@76872:AI未返回有效结果,请重试`,PARSE_FAILED:`@76872:AI返回格式无法解析,请重试`,GENERATE_FAILED:`@76872:AI生成失败`,HTTP_ERR:`@76872:AI生成失败`}[e]:null;R.error(r?X(r):t);return}let r=[`feat`,`fix`,`docs`,`style`,`refactor`,`test`,`chore`];if(b.value)n.type&&r.includes(n.type)&&(x.value=n.type),n.scope!==void 0&&(T.value=n.scope),n.description&&(D.value=n.description);else{let e=n.type&&n.description?n.scope?`${n.type}(${n.scope}): ${n.description}`:`${n.type}: ${n.description}`:n.description||``;e&&(s.value=e)}R.success(X(`@76872:AI已生成提交信息`))}catch(e){R.error(`${X(`@76872:AI生成失败`)}: ${e.message}`)}finally{n.value=!1}}}let i=Q(),a=De(),s=z(``),{loadingState:u,show:p,hide:m,setText:h}=Qn(),{successState:g}=er(),_=z(!1),y=z(``),b=k({get:()=>a.isStandardCommit,set:e=>{a.isStandardCommit=e}}),x=z(`feat`),T=z(``),D=z(``),O=z(``),A=z(``),M=z([]),N=z(!1),P=z([]),F=z(!1),I=z(!1),te=k({get:()=>a.skipHooks,set:e=>{a.skipHooks=e}}),ne=k({get:()=>a.autoQuickPushOnEnter,set:e=>{a.autoQuickPushOnEnter=e}}),re=z(null),V=z(!1),H=k(()=>[{value:`feat`,label:`feat: ${X(`@76872:新功能`)}`},{value:`fix`,label:`fix: ${X(`@76872:修复bug`)}`},{value:`docs`,label:`docs: ${X(`@76872:文档修改`)}`},{value:`style`,label:`style: ${X(`@76872:样式修改`)}`},{value:`refactor`,label:`refactor: ${X(`@76872:代码重构`)}`},{value:`test`,label:`test: ${X(`@76872:测试代码`)}`},{value:`chore`,label:`chore: ${X(`@76872:构建/工具修改`)}`}]),ie=z([]),U=k(()=>{if(!b.value)return s.value||y.value;let e=`${x.value||``}`;return T.value&&(e+=`(${T.value})`),e+=`: ${D.value}`,O.value&&(e+=`\n\n${O.value}`),A.value&&(e+=`\n\n${A.value}`),e}),ae=k(()=>b.value?(i.isMergeInProgress||(x.value||``).trim()!==``)&&(D.value||``).trim()!==``:s.value.trim()!==``),oe=k(()=>i.hasConflictedFiles?!0:i.isMergeInProgress?!ae.value:!i.fileList.some(e=>!Fe(e.path,a.lockedFiles))||!ae.value),le=k(()=>{let e=`${X(`@76872:输入提交信息 (默认: `)}${y.value})`;return ne.value?`${e}${X(`@76872:(按回车一键推送)`)}`:e}),ue=k(()=>{let e=X(`@76872:简短描述(必填)`);return ne.value?X(`@76872:简短描述(必填,按回车一键推送)`):e}),de=k(()=>{let e=`git commit -m "${U.value}"`;return te.value&&(e+=` --no-verify`),e});function pe(){let e=a.config;e&&(y.value=e.defaultCommitMessage||``,e.descriptionTemplates&&Array.isArray(e.descriptionTemplates)&&(M.value=e.descriptionTemplates),e.scopeTemplates&&Array.isArray(e.scopeTemplates)&&(P.value=e.scopeTemplates),e.messageTemplates&&Array.isArray(e.messageTemplates)&&(ie.value=e.messageTemplates))}function K(e){D.value=e,N.value=!1}function me(e){T.value=e,F.value=!1}function J(){N.value=!0}function ge(){F.value=!0}function _e(){s.value=``,D.value=``,O.value=``,A.value=``,x.value=`feat`,a.autoSetDefaultMessage&&a.defaultCommitMessage&&(b.value?D.value=a.defaultCommitMessage:s.value=a.defaultCommitMessage)}function ye(){p({text:X(`@76872:正在暂存文件...`),showProgress:!1})}function be(){m()}function xe(e){if(m(),e){_.value=!0;try{setTimeout(async()=>{try{console.log(X(`@76872:推送成功,状态已更新`))}catch(e){console.error(`一键推送后处理失败:`,e)}finally{_.value=!1}},1e3)}catch(e){console.error(`一键推送后处理失败:`,e),_.value=!1}}}function Ce(e){s.value=e,I.value=!1}async function we(e){if(!ne.value||!ae.value)return;let t=i.fileList.some(e=>!Fe(e.path,a.lockedFiles)),n=i.hasConflictedFiles;if(t&&ae.value&&i.hasUpstream&&!n&&e.key===`Enter`&&!e.shiftKey){e.preventDefault();try{await re.value?.triggerQuickPush()}catch(e){console.error(`回车自动一键提交失败:`,e)}}}async function Z(e){try{await a.saveDefaultMessage(e)&&R.success(X(`@76872:默认提交信息设置成功`))}catch(e){R.error(`${X(`@76872:设置默认提交信息失败: `)}${e.message}`)}}fe(()=>i.pendingMergeMessage,e=>{e&&(b.value?(x.value=``,D.value=e):s.value=e,i.pendingMergeMessage=``,R.info(X(`@76872:已自动填充合并提交信息`)))}),fe(()=>i.isAddingFiles,e=>{e&&u.visible&&h(X(`@76872:正在暂存文件...`))}),fe(()=>i.isCommiting,e=>{e&&u.visible&&h(X(`@76872:正在提交更改...`))}),fe(()=>i.isPushing,e=>{e&&u.visible&&m()}),ee(async()=>{fe(()=>a.config,pe,{immediate:!0}),a.config||await a.loadConfig(),a.autoSetDefaultMessage&&a.defaultCommitMessage&&(b.value?D.value||=a.defaultCommitMessage:s.value||=a.defaultCommitMessage),i.pendingMergeMessage&&(b.value?(x.value=``,D.value=i.pendingMergeMessage):s.value=i.pendingMergeMessage,i.pendingMergeMessage=``,R.info(X(`@76872:已自动填充合并提交信息`)))});function Oe(e,t){t([...e?M.value.filter(t=>t.toLowerCase().includes(e.toLowerCase())).map(e=>({value:e})):M.value.map(e=>({value:e})),{value:`⚙️ 管理模板...`,isSettings:!0}])}function ke(e,t){t([...e?P.value.filter(t=>t.toLowerCase().includes(e.toLowerCase())).map(e=>({value:e})):P.value.map(e=>({value:e})),{value:`⚙️ 管理模板...`,isSettings:!0}])}function je(e){e.isSettings?(J(),D.value=``):D.value=e.value}function Me(e){e.isSettings?(ge(),T.value=``):T.value=e.value}function Ne(e,t){t([...e?ie.value.filter(t=>t.toLowerCase().includes(e.toLowerCase())).map(e=>({value:e})):ie.value.map(e=>({value:e})),{value:`⚙️ 管理模板...`,isSettings:!0}])}function Pe(e){e.isSettings?(I.value=!0,s.value=``):s.value=e.value}return(t,a)=>{let p=v,m=Vn,h=f,y=Se,k=C,M=d,P=j;return L(),W(Y,null,[c(`div`,{class:q([`card app-card`,{"is-pushing":l(i).isPushing}])},[c(`div`,Gr,[c(`div`,Kr,[l(i).userName!==``&&l(i).userEmail!==``?(L(),o(dr,{key:0,ref_key:`gitActionButtonsRef`,ref:re,"has-user-commit-message":ae.value,"final-commit-message":U.value,"skip-hooks":te.value,onAfterCommit:a[0]||=e=>{e&&_e()},onAfterPush:xe,onBeforePush:ye,onPushStart:be,onClearFields:_e},null,8,[`has-user-commit-message`,`final-commit-message`,`skip-hooks`])):S(``,!0)]),c(`div`,qr,[w(Te,{tooltip:l(X)(`@76872:AI生成提交信息`),"icon-class":n.value?``:`ai-commit`,size:`medium`,disabled:n.value,onClick:r},{default:B(()=>[n.value?(L(),o(p,{key:0,class:`is-loading`},{default:B(()=>[w(l(G))]),_:1})):S(``,!0)]),_:1},8,[`tooltip`,`icon-class`,`disabled`]),w(Wr),w(m,{class:`ml-auto`,variant:`icon`})])]),c(`div`,Jr,[c(`div`,Yr,[l(i).userName===``||l(i).userEmail===``?(L(),W(`div`,Xr,[w(h,{title:l(X)(`@76872:Git用户信息未配置`),type:`warning`,closable:!1,"show-icon":``},{default:B(()=>[c(`p`,null,E(l(X)(`@76872:您需要配置Git用户名和邮箱才能提交代码。请使用以下命令配置:`)),1),a[11]||=c(`pre`,{class:`config-command`},`git config --global user.name "Your Name"
6
+ git config --global user.email "your.email@example.com"`,-1)]),_:1},8,[`title`])])):(L(),W(Y,{key:1},[l(i).isMergeInProgress?(L(),W(`div`,Zr,[w(h,{title:l(X)(`@76872:合并进行中`),type:`warning`,closable:!1,"show-icon":``},{default:B(()=>[c(`span`,null,E(l(X)(`@76872:分支合并尚未完成,请输入提交信息后点击「提交」按钮完成合并。`)),1)]),_:1},8,[`title`])])):S(``,!0),c(`div`,Qr,[b.value?(L(),W(`div`,ti,[c(`div`,ni,[c(`div`,ri,[w(M,{modelValue:x.value,"onUpdate:modelValue":a[2]||=e=>x.value=e,placeholder:l(X)(`@76872:提交类型`),class:`type-select`,clearable:``},{default:B(()=>[(L(!0),W(Y,null,e(H.value,e=>(L(),o(k,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`]),c(`div`,ii,[w(y,{modelValue:T.value,"onUpdate:modelValue":a[3]||=e=>T.value=e,"fetch-suggestions":ke,placeholder:l(X)(`@76872:作用域(可选)`),class:`scope-input`,clearable:``,onSelect:Me},null,8,[`modelValue`,`placeholder`])]),c(`div`,ai,[w(y,{modelValue:D.value,"onUpdate:modelValue":a[4]||=e=>D.value=e,"fetch-suggestions":Oe,placeholder:ue.value,class:`description-input`,clearable:``,onSelect:je,onKeydown:we},null,8,[`modelValue`,`placeholder`])])])]),c(`div`,{class:`advanced-options-toggle`,onClick:a[5]||=e=>V.value=!V.value},[c(`span`,null,E(V.value?l(X)(`@76872:收起`):l(X)(`@76872:正文及页脚`)),1),w(p,{class:q([`toggle-icon`,{"is-active":V.value}])},{default:B(()=>[w(l(he))]),_:1},8,[`class`])]),ce(c(`div`,oi,[w(P,{modelValue:O.value,"onUpdate:modelValue":a[6]||=e=>O.value=e,type:`textarea`,rows:4,placeholder:l(X)(`@76872:正文(可选):详细描述本次提交的内容和原因`),class:`body-input`,clearable:``},null,8,[`modelValue`,`placeholder`]),w(P,{modelValue:A.value,"onUpdate:modelValue":a[7]||=e=>A.value=e,placeholder:l(X)(`@76872:页脚(可选):如 Closes #123`),class:`footer-input`,clearable:``},null,8,[`modelValue`,`placeholder`])],512),[[ve,V.value]])])):(L(),W(`div`,$r,[c(`div`,ei,[w(y,{modelValue:s.value,"onUpdate:modelValue":a[1]||=e=>s.value=e,"fetch-suggestions":Ne,placeholder:le.value,type:`textarea`,rows:3,resize:`none`,class:`commit-message-input`,onSelect:Pe,onKeydown:we},null,8,[`modelValue`,`placeholder`])])])),oe.value?S(``,!0):(L(),o(Ie,{key:2,command:de.value,title:l(X)(`@76872:提交命令预览:`),placeholder:`git commit -m "<提交信息>"`},null,8,[`command`,`title`]))])],64))])])],2),w(Ae,{visible:N.value,"onUpdate:visible":a[8]||=e=>N.value=e,type:`description`,title:l(X)(`@76872:简短描述模板设置`),placeholder:l(X)(`@76872:输入新模板内容`),"edit-placeholder":l(X)(`@76872:编辑模板内容`),"empty-description":l(X)(`@76872:暂无保存的模板`),onUseTemplate:K},null,8,[`visible`,`title`,`placeholder`,`edit-placeholder`,`empty-description`]),w(Ae,{visible:F.value,"onUpdate:visible":a[9]||=e=>F.value=e,type:`scope`,title:l(X)(`@76872:作用域模板设置`),placeholder:l(X)(`@76872:输入新作用域模板`),"edit-placeholder":l(X)(`@76872:编辑作用域模板内容`),"empty-description":l(X)(`@76872:暂无保存的作用域`),onUseTemplate:me},null,8,[`visible`,`title`,`placeholder`,`edit-placeholder`,`empty-description`]),w(Ae,{visible:I.value,"onUpdate:visible":a[10]||=e=>I.value=e,type:`message`,title:l(X)(`@76872:默认提交信息设置`),placeholder:l(X)(`@76872:输入新模板内容`),"edit-placeholder":l(X)(`@76872:编辑模板内容`),"empty-description":l(X)(`@76872:暂无保存的模板`),"show-default-section":!0,"show-help-text":!0,onUseTemplate:Ce,onSetDefault:Z},null,8,[`visible`,`title`,`placeholder`,`edit-placeholder`,`empty-description`]),w(se,{name:`el-fade-in-linear`},{default:B(()=>[_.value?(L(),W(`div`,si,[w(p,{class:`is-loading`},{default:B(()=>[w(l(G))]),_:1}),c(`span`,null,E(l(X)(`@76872:更新状态中...`)),1)])):S(``,!0)]),_:1}),w(Kn,{visible:l(u).visible,text:l(u).text,"show-progress":l(u).showProgress,progress:l(u).progress},null,8,[`visible`,`text`,`show-progress`,`progress`]),w(Zn,{visible:l(g).visible,text:l(g).text,description:l(g).description},null,8,[`visible`,`text`,`description`]),w(se,{name:`el-fade-in-linear`},{default:B(()=>[_.value?(L(),W(`div`,ci,[w(p,{class:`is-loading`},{default:B(()=>[w(l(G))]),_:1}),c(`span`,null,E(l(X)(`@76872:更新状态中...`)),1)])):S(``,!0)]),_:1})],64)}}}),[[`__scopeId`,`data-v-4d221088`]]);export{li as default};
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime-C0FnF6B9.js";import{Bn as e,Dn as t,E as n,En as r,Er as i,In as a,L as o,Nn as s,On as c,Pn as l,Pr as u,Qr as d,Tn as f,Wn as p,Yr as m,Zn as h,cr as g,er as _,ir as v,jn as y,pr as b,qr as x}from"./element-plus-IG-bwpR5.js";import{n as S,t as C}from"./_plugin-vue_export-helper-Dcylt9fO.js";e(),b(),u();var w=[`id`],T={class:`common-dialog__footer`},E=a({__name:`CommonDialog`,props:{modelValue:{type:Boolean},title:{},size:{default:`medium`},type:{default:`default`},width:{},height:{},top:{default:`50px`},closeOnClickModal:{type:Boolean,default:!1},closeOnPressEscape:{type:Boolean,default:!0},destroyOnClose:{type:Boolean,default:!1},draggable:{type:Boolean,default:!1},customClass:{},appendToBody:{type:Boolean,default:!0},lockScroll:{type:Boolean,default:!0},zIndex:{},heightMode:{default:`max`},heightOffset:{default:`100px`},showFooter:{type:Boolean,default:!1},confirmText:{default:S(`@803A9:确定`)},cancelText:{default:S(`@803A9:取消`)},showCancel:{type:Boolean,default:!0},confirmLoading:{type:Boolean,default:!1}},emits:[`update:modelValue`,`confirm`,`cancel`,`close`,`opened`,`closed`],setup(e,{emit:a}){let u=e,b=a,S=f(()=>{if(u.width)return u.width;switch(u.size){case`small`:return`30%`;case`medium`:return`50%`;case`large`:return`80%`;case`extra-large`:return`90%`;case`fullscreen`:return`100vw`;default:return`50%`}}),C=v(),E=null;function D(){b(`opened`),p(()=>{let e=document.querySelector(`.el-dialog__wrapper:not([style*="display: none"]) .el-dialog`);e&&(e.querySelector(`button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`)||e).focus?.()})}function O(){b(`closed`),E&&typeof E.focus==`function`&&(p(()=>E?.focus()),E=null)}function k(e){e&&!u.modelValue&&(E=document.activeElement),b(`update:modelValue`,e)}let A=f(()=>u.size===`fullscreen`?`0`:u.top),j=f(()=>{let e=[];return u.customClass&&e.push(u.customClass),u.type===`flex`&&e.push(`common-dialog--flex`),u.type===`full-height`&&e.push(`common-dialog--full-height`),u.size===`fullscreen`&&e.push(`common-dialog--fullscreen`),e.join(` `)}),M=f(()=>{if(u.size===`fullscreen`)return{height:`100vh`,maxHeight:`100vh`};let e=`calc(100% - ${u.heightOffset})`;return u.heightMode===`fixed`?{height:e}:{maxHeight:e}});function N(){b(`update:modelValue`,!1),b(`close`)}function P(){b(`confirm`)}function F(){b(`cancel`),N()}return(a,u)=>{let f=o;return h(),t(i(n),{"model-value":e.modelValue,title:e.title,width:S.value,top:A.value,style:m(M.value),"z-index":e.zIndex,fullscreen:e.size===`fullscreen`,"close-on-click-modal":e.closeOnClickModal,"close-on-press-escape":e.closeOnPressEscape,"destroy-on-close":e.destroyOnClose,draggable:e.draggable,class:x(j.value),"append-to-body":e.appendToBody,"lock-scroll":e.lockScroll,"aria-modal":!0,"aria-labelledby":i(C),role:`dialog`,onClose:N,"onUpdate:modelValue":k,onOpened:D,onClosed:O},y({header:g(({titleClass:t})=>[r(`span`,{id:i(C),class:x([`el-dialog__title`,t]),role:`heading`,"aria-level":`2`},d(e.title),11,w)]),default:g(()=>[_(a.$slots,`default`,{},void 0,!0)]),_:2},[e.showFooter||a.$slots.footer?{name:`footer`,fn:g(()=>[_(a.$slots,`footer`,{},()=>[r(`div`,T,[e.showCancel?(h(),t(f,{key:0,type:`button`,onClick:F},{default:g(()=>[s(d(e.cancelText),1)]),_:1})):c(``,!0),l(f,{type:`primary`,loading:e.confirmLoading,onClick:P},{default:g(()=>[s(d(e.confirmText),1)]),_:1},8,[`loading`])])],!0)]),key:`0`}:void 0]),1032,[`model-value`,`title`,`width`,`top`,`style`,`z-index`,`fullscreen`,`close-on-click-modal`,`close-on-press-escape`,`destroy-on-close`,`draggable`,`class`,`append-to-body`,`lock-scroll`,`aria-labelledby`])}}}),D=C(E,[[`__scopeId`,`data-v-601f59df`]]);export{D as t};
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime-C0FnF6B9.js";import{$n as e,Bn as t,Cn as n,Dn as r,En as i,Er as a,H as o,In as s,Mn as ee,Nn as c,On as l,Pn as u,Pr as d,Qr as f,Tn as p,Wn as m,Yn as te,Yr as h,Zn as g,_n as _,a as v,bn as ne,br as y,cr as re,dn as ie,kn as b,lr as x,or as S,pr as C,qn as w,qr as T,xn as E,xr as ae,yn as oe}from"./element-plus-IG-bwpR5.js";import{n as D,t as O}from"./_plugin-vue_export-helper-Dcylt9fO.js";import{t as se}from"./SvgIcon-VCh_kGGV.js";import{t as ce}from"./configStore-BlqdtNUA.js";import{n as le,r as ue,t as de}from"./useThemeObserver-DAWKXvWv.js";import{a as fe,i as pe,n as me,r as he,s as ge,t as _e}from"./previewSandbox-DYMhXJ91.js";import{a as ve,c as ye,l as be,n as xe,o as Se,r as Ce,s as we}from"./monaco-DkJuNcCr.js";import{r as k,t as A}from"./flow-mindmap-C_w8GJXm.js";import{r as Te}from"./index-DGHrUfrh.js";function Ee(e){return{ts:`typescript`,tsx:`typescript`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jsx:`javascript`,vue:`html`,html:`html`,htm:`html`,css:`css`,scss:`scss`,less:`less`,json:`json`,jsonc:`json`,md:`markdown`,markdown:`markdown`,yaml:`yaml`,yml:`yaml`,toml:`ini`,xml:`xml`,svg:`xml`,sh:`shell`,bash:`shell`,zsh:`shell`,fish:`shell`,ps1:`powershell`,py:`python`,go:`go`,rs:`rust`,java:`java`,kt:`kotlin`,rb:`ruby`,php:`php`,c:`c`,cpp:`cpp`,h:`cpp`,cs:`csharp`,sql:`sql`,graphql:`graphql`,gql:`graphql`,txt:`plaintext`,log:`plaintext`,ini:`ini`,env:`ini`,gitignore:`ini`,dockerfile:`dockerfile`}[e.toLowerCase()]??`plaintext`}t(),C();var j={class:`mindmap-preview`},De={class:`mindmap-preview-canvas`},Oe=O(s({__name:`MindmapPreview`,props:{content:{}},setup(e){let t=e,n=p(()=>A(t.content||``,`未命名文档`));return(e,t)=>(g(),b(`div`,j,[t[0]||=i(`div`,{class:`mindmap-preview-header`},[i(`span`,{class:`mindmap-preview-title`},`整篇导图`),i(`span`,{class:`mindmap-preview-hint`},`基于整篇 Markdown 自动生成 · 阅读模式`)],-1),i(`div`,De,[u(a(k),{data:n.value,"preview-mode":``},null,8,[`data`])])]))}}),[[`__scopeId`,`data-v-6929f46f`]]);t(),C(),d(),ie();var ke={class:`sidebar-header`},Ae={class:`sidebar-title`},je={class:`sidebar-actions`},Me={class:`sidebar-search`},Ne=[`placeholder`,`title`],Pe=[`title`,`aria-label`],Fe={key:0,class:`sidebar-tree`},Ie={key:1,class:`tree-arrow-spacer`},Le={class:`tree-icon mit-icon`,"aria-hidden":`true`},Re=[`xlink:href`],ze=[`onClick`,`onContextmenu`],Be={key:1,class:`tree-arrow-spacer`},Ve={key:2,class:`tree-icon mit-icon`,"aria-hidden":`true`},He=[`xlink:href`],Ue={key:3,class:`tree-icon mit-icon`,"aria-hidden":`true`},We=[`xlink:href`],Ge=[`title`],Ke={key:0,class:`tree-name-hit`},qe={key:4,class:`tree-loading`},Je={key:0,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--color-warning)`}},Ye={key:1,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--text-tertiary)`}},Xe=[`placeholder`],Ze={key:0,class:`tree-node tree-inline-input-row`,style:{paddingLeft:`12px`}},Qe={key:0,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--color-warning)`}},$e={key:1,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--text-tertiary)`}},et=[`placeholder`],tt={key:1,class:`tree-empty`},nt={key:1,class:`sidebar-loading`},rt={class:`editor-main`},it={key:0,class:`editor-tabs`},at=[`onClick`,`title`],ot={class:`tab-name`},st={key:0,class:`tab-dirty-dot`},ct=[`onClick`],lt=[`title`],ut=[`disabled`,`title`],dt={key:1,class:`editor-empty`},ft={viewBox:`0 0 24 24`,width:`48`,height:`48`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{opacity:`.3`}},pt={class:`editor-empty-hint`},mt={class:`editor-body`},ht={key:0,class:`image-tab-placeholder`},gt={viewBox:`0 0 24 24`,width:`56`,height:`56`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{opacity:`.35`}},_t={class:`image-tab-placeholder-title`},vt={class:`image-tab-placeholder-hint`},yt={class:`preview-header`},bt={class:`preview-title`},xt={class:`preview-ext-badge`},St=[`title`],Ct={class:`preview-body`},wt=[`sandbox`,`srcdoc`],Tt=15e3,M=O(s({__name:`EditorView`,props:{pendingFilePath:{}},setup(t){self.MonacoEnvironment={getWorker(e,t){return t===`json`?new ye:t===`css`||t===`scss`||t===`less`?new we:t===`html`||t===`handlebars`||t===`razor`?new Se:t===`typescript`||t===`javascript`?new ve:new be}};let s=t,d=ce(),ie=Te(),C=y([]),O=y(!1),k=y(``),A=y(``),j=null;function De(){k.value=``,A.value=``,j&&=(clearTimeout(j),null)}S(k,e=>{j&&clearTimeout(j),j=setTimeout(()=>{A.value=e,j=null},180)}),w(()=>{j&&clearTimeout(j),Dt()});let M=null;function Et(){Dt(),M=setInterval(()=>{document.hidden||d.currentDirectory&&(k.value.trim()||jt())},Tt)}function Dt(){M&&=(clearInterval(M),null)}S(()=>d.currentDirectory,()=>{Et()});async function N(e,t=0){let n=await(await fetch(`/api/browse_directory?path=${encodeURIComponent(e)}`)).json();return n.success?n.items.map(e=>({...e,depth:t,expanded:!1,loading:!1,children:(e.type,void 0)})):[]}async function Ot(){let e=d.currentDirectory;if(e){O.value=!0;try{C.value=await N(e,0)}finally{O.value=!1}}}function kt(e,t=new Set){for(let n of e)n.type===`directory`&&n.expanded&&(t.add(n.path),n.children&&kt(n.children,t));return t}async function At(e,t){for(let n of e)n.type===`directory`&&t.has(n.path)&&(n.children||=await N(n.path,n.depth+1),n.expanded=!0,await At(n.children,t))}async function jt(){let e=d.currentDirectory;if(!e)return;let t=kt(C.value);O.value=!0;try{C.value=await N(e,0),t.size>0&&await At(C.value,t)}finally{O.value=!1}}async function P(e){if(e.type===`directory`){if(e.expanded)e.expanded=!1;else{if(!e.children){e.loading=!0;try{e.children=await N(e.path,e.depth+1)}finally{e.loading=!1}}e.expanded=!0}}}function Mt(e){let t=[];for(let n of e)t.push(n),n.type===`directory`&&n.expanded&&n.children&&t.push(...Mt(n.children));return t}let Nt=p(()=>A.value.trim().toLowerCase());function Pt(e,t){if(!t)return e;let n=[];for(let r of e){let e=r.children?Pt(r.children,t):[],i=r.name.toLowerCase().includes(t);r.type===`directory`?(i||e.length>0)&&(r.expanded=!0,r.children!==void 0&&(r.children=e),n.push(r)):i&&n.push(r)}return n}let Ft=p(()=>Pt(C.value,Nt.value)),It=p(()=>Nt.value.length>0&&Ft.value.length===0);function Lt(e){let t=A.value.trim();if(!t)return[{text:e,hit:!1}];let n=e.toLowerCase(),r=t.toLowerCase(),i=[],a=0,o=n.indexOf(r,a);for(;o!==-1;)o>a&&i.push({text:e.slice(a,o),hit:!1}),i.push({text:e.slice(o,o+r.length),hit:!0}),a=o+r.length,o=n.indexOf(r,a);return a<e.length&&i.push({text:e.slice(a),hit:!1}),i}let Rt=y(null);function zt(){let e=Rt.value;e&&(e.focus(),e.select())}function Bt(){k.value?(De(),Rt.value?.focus()):(Rt.value?.blur(),R.value?.focus())}let F=y([]),I=y(null),L=y(null);async function Vt(e){if(L.value=e,e.type!==`file`){P(e);return}let t=F.value.find(t=>t.path===e.path);if(console.log(`[debug-open-in-editor] EditorView openFile existing tab check:`,{path:e.path,found:!!t,tabsCount:F.value.length}),t){I.value=e.path,m(()=>B());return}let n=e.name.split(`.`).pop()||``;if(En.has(n.toLowerCase())){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`plaintext`};F.value.push(t),I.value=e.path,Y.value=!0;return}if(ge(e.name)){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`office`};F.value.push(t),I.value=e.path,X.value=!1,Y.value=!0;return}try{let t=await fetch(`/api/editor/file?path=${encodeURIComponent(e.path)}`),r=await t.json();if(console.log(`[debug-open-in-editor] EditorView fetch /api/editor/file response:`,{path:e.path,status:t.status,data:r}),!r.success){v.error(`${D(`@EDITOR:打开文件失败: `)}${r.error}`);return}let i=Ee(n),a={path:e.path,name:e.name,content:r.content,originalContent:r.content,isDirty:!1,language:i};console.log(`[debug-open-in-editor] EditorView pushing tab:`,{path:a.path,name:a.name,contentLen:a.content.length,lang:a.language}),F.value.push(a),I.value=e.path,console.log(`[debug-open-in-editor] EditorView tabs after push:`,F.value.length,`activeTabPath=`,I.value)}catch(e){console.log(`[debug-open-in-editor] EditorView fetch threw:`,e),v.error(`${D(`@EDITOR:打开文件失败: `)}${e.message}`)}}S(()=>s.pendingFilePath,async e=>{if(console.log(`[debug-open-in-editor] EditorView watcher fired, filePath=`,e),!e)return;await m();let t=e.split(/[\\/]/).pop()||e;console.log(`[debug-open-in-editor] EditorView calling openFile, name=`,t,`path=`,e),await Vt({name:t,path:e,type:`file`,depth:0}),console.log(`[debug-open-in-editor] EditorView openFile returned`)},{immediate:!0});function Ht(e,t){t.stopPropagation();let n=F.value.findIndex(t=>t.path===e);n!==-1&&(!F.value[n].isDirty||confirm(D(`@EDITOR:文件未保存,确认关闭?`)))&&(F.value.splice(n,1),I.value===e&&(I.value=F.value[Math.min(n,F.value.length-1)]?.path??null))}let Ut=()=>F.value.find(e=>e.path===I.value)??null,Wt=y(null),R=ae(null),z=new Map;function Gt(e){let t=z.get(e.path);return(!t||t.isDisposed())&&(t=Ce.createModel(e.content,e.language,xe.file(e.path)),z.set(e.path,t)),t}function Kt(){if(!Wt.value)return;let e=document.documentElement.getAttribute(`data-theme`)===`dark`;R.value=Ce.create(Wt.value,{theme:e?`vs-dark`:`vs`,fontSize:13,lineHeight:20,fontFamily:`'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace`,minimap:{enabled:!0},scrollBeyondLastLine:!1,renderWhitespace:`selection`,automaticLayout:!0,tabSize:2,wordWrap:`off`,smoothScrolling:!0,cursorBlinking:`smooth`,padding:{top:8,bottom:8},editContext:!1}),R.value.onDidChangeModelContent(()=>{let e=Ut();if(!e)return;let t=R.value.getValue();e.content=t,e.isDirty=t!==e.originalContent}),R.value.onDidBlurEditorText(()=>{d.ui.editorAutoSave&&Ut()?.isDirty&&Jt(!1),requestAnimationFrame(()=>{if(!H.value||H.value.offsetParent===null)return;let e=document.activeElement;e&&(e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.isContentEditable||e.classList?.contains(`native-edit-context`)||e.classList?.contains(`monaco-editor`))||B()})})}S(I,e=>{if(!R.value||!e)return;let t=F.value.find(t=>t.path===e);if(!t)return;let n=Gt(t);R.value.setModel(n),m(()=>B())});function B(){if(!R.value)return;R.value.focus();let e=document.querySelector(`.monaco-editor .native-edit-context`);e&&document.activeElement!==e&&requestAnimationFrame(()=>e.focus?.())}S(()=>F.value.filter(e=>e.isDirty).length,e=>{ie.setDirtyCount(e)},{immediate:!0}),w(()=>ie.setDirtyCount(0)),de(()=>{let e=document.documentElement.getAttribute(`data-theme`)===`dark`;Ce.setTheme(e?`vs-dark`:`vs`)});let V=null;function qt(){if(V||!H.value)return;let e=[H.value],t=H.value.parentElement;for(;t;){if(t.classList.contains(`view-pane`)||t.classList.contains(`editor-pane`)){e.push(t);break}t=t.parentElement}V=new MutationObserver(()=>{H.value&&H.value.offsetParent!==null&&I.value&&R.value&&requestAnimationFrame(()=>{let e=document.activeElement;e&&(e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.isContentEditable||e.classList?.contains(`native-edit-context`)||e.classList?.contains(`monaco-editor`))||B()})});let n=V;e.forEach(e=>n.observe(e,{attributes:!0,attributeFilter:[`style`,`class`,`hidden`]}))}te(async()=>{Kt(),await Ot(),qt(),Et(),I.value&&m(()=>B())}),w(()=>{V?.disconnect(),V=null,R.value?.dispose(),z.forEach(e=>e.dispose()),z.clear()});async function Jt(e=!1){let t=Ut();if(t)try{let n=await(await fetch(`/api/editor/file`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:t.path,content:t.content})})).json();if(!n.success){v.error(`${D(`@EDITOR:保存失败: `)}${n.error}`);return}t.originalContent=t.content,t.isDirty=!1,e||v.success(D(`@EDITOR:已保存`))}catch(e){v.error(`${D(`@EDITOR:保存失败: `)}${e.message}`)}}function Yt(e){let t=e.ctrlKey||e.metaKey;if(t&&e.key.toLowerCase()===`f`){e.preventDefault(),zt();return}t&&e.key===`s`&&(e.preventDefault(),Jt())}te(()=>window.addEventListener(`keydown`,Yt)),w(()=>window.removeEventListener(`keydown`,Yt));let H=y(null),Xt=y(220),Zt=!1,Qt=0,$t=0;function en(e){Zt=!0,Qt=e.clientX,$t=Xt.value,document.addEventListener(`mousemove`,tn),document.addEventListener(`mouseup`,nn),e.preventDefault()}function tn(e){if(!Zt)return;let t=e.clientX-Qt;Xt.value=Math.max(140,Math.min(400,$t+t))}function nn(){Zt=!1,document.removeEventListener(`mousemove`,tn),document.removeEventListener(`mouseup`,nn)}function rn(e){return e.type===`directory`?ue(e.name):le(e.name)}let U=y(null),W=y(null),G=y(null),an=y(null);function K(){let e=L.value;return e?e.type===`directory`?{parentPath:e.path,afterNode:e,depth:e.depth+1}:{parentPath:e.path.includes(`/`)||e.path.includes(`\\`)?e.path.replace(/[\\/][^\\/]+$/,``):d.currentDirectory??``,afterNode:e,depth:e.depth}:{parentPath:d.currentDirectory??``,afterNode:null,depth:0}}async function on(){let e=K();L.value?.type===`directory`&&!L.value.expanded&&await P(L.value),U.value={...e,kind:`file`,value:``},await m(),G.value?.focus()}async function sn(){let e=K();L.value?.type===`directory`&&!L.value.expanded&&await P(L.value),U.value={...e,kind:`directory`,value:``},await m(),G.value?.focus()}function cn(){U.value=null}async function ln(){let e=U.value;if(!e||!e.value.trim()){U.value=null;return}let t=e.value.trim(),n=e.parentPath.replace(/[/\\]$/,``)+`/`+t;if(e.kind===`file`){let e=await(await fetch(`/api/editor/file`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:n})})).json();if(!e.success){v.error(e.error);return}v.success(D(`@EDITOR:创建成功`))}else{let e=await(await fetch(`/api/editor/directory`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:n})})).json();if(!e.success){v.error(e.error);return}v.success(D(`@EDITOR:创建成功`))}U.value=null,await jt()}function un(e){e.key===`Enter`&&(e.preventDefault(),ln()),e.key===`Escape`&&(e.preventDefault(),cn())}let q=y(null),dn=y(null);function fn(e,t){e.preventDefault(),q.value={x:e.clientX,y:e.clientY,node:t}}function J(){q.value=null}async function pn(){let e=q.value?.node;J(),e&&(L.value=e),e?.type===`directory`&&!e.expanded&&await P(e);let t=K();U.value={...t,kind:`file`,value:``},await m(),G.value?.focus()}async function mn(){let e=q.value?.node;J(),e&&(L.value=e),e?.type===`directory`&&!e.expanded&&await P(e);let t=K();U.value={...t,kind:`directory`,value:``},await m(),G.value?.focus()}async function hn(){let e=q.value?.node;J(),e&&(W.value={node:e,value:e.name},await m(),an.value?.focus(),an.value?.select())}async function gn(){let e=W.value;if(!e||!e.value.trim()||e.value.trim()===e.node.name){W.value=null;return}let t=e.value.trim(),n=e.node.path.replace(/[\\/][^\\/]+$/,``).replace(/[/\\]$/,``)+`/`+t,r=await(await fetch(`/api/editor/rename`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({oldPath:e.node.path,newPath:n})})).json();if(!r.success){v.error(r.error);return}let i=F.value.find(t=>t.path===e.node.path);i&&(i.path=n,i.name=t,I.value===e.node.path&&(I.value=n)),W.value=null,await jt()}function _n(e){e.key===`Enter`&&(e.preventDefault(),gn()),e.key===`Escape`&&(e.preventDefault(),W.value=null)}async function vn(){let e=q.value?.node;if(J(),!e)return;let t=e.type===`directory`?D(`@EDITOR:文件夹`):D(`@EDITOR:文件`);if(!confirm(`${D(`@EDITOR:确认删除`)} ${t} "${e.name}"?`))return;let n=await(await fetch(`/api/editor/entry?path=${encodeURIComponent(e.path)}`,{method:`DELETE`})).json();if(!n.success){v.error(n.error);return}let r=F.value.findIndex(t=>t.path===e.path);r!==-1&&(F.value.splice(r,1),I.value===e.path&&(I.value=F.value[Math.max(0,r-1)]?.path??null)),v.success(D(`@EDITOR:已删除`)),await jt()}async function yn(){let e=q.value?.node;if(J(),e)try{let t=await(await fetch(`/api/editor/reveal`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e.path})})).json();t.success||v.error(t.error)}catch(e){v.error(e?.message||String(e))}}function bn(e){let t=d.currentDirectory;if(!t)return e;let n=e=>e.replace(/\\/g,`/`).replace(/\/+$/,``),r=n(t),i=n(e);return i===r?`.`:i.startsWith(r+`/`)?i.slice(r.length+1):i}async function xn(e){try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.left=`-9999px`,document.body.appendChild(t),t.select();let n=document.execCommand(`copy`);return document.body.removeChild(t),n}catch{return!1}}async function Sn(){let e=q.value?.node;J(),e&&(await xn(e.path)?v.success(D(`@EDITOR:已复制到剪贴板`)):v.error(D(`@EDITOR:复制失败`)))}async function Cn(){let e=q.value?.node;J(),e&&(await xn(bn(e.path))?v.success(D(`@EDITOR:已复制到剪贴板`)):v.error(D(`@EDITOR:复制失败`)))}async function wn(){let e=q.value?.node;if(J(),e)try{let t=await(await fetch(`/api/editor/open-in-vscode`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e.path})})).json();t.success||v.error(t.error||D(`@EDITOR:VSCode 未安装`))}catch(e){v.error(e?.message||String(e))}}te(()=>document.addEventListener(`click`,J)),w(()=>document.removeEventListener(`click`,J));let Tn=new Set([`md`,`html`,`htm`,`svg`]),En=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`ico`,`bmp`]),Y=y(!1),X=y(!1),Dn=y(0),Z=p(()=>F.value.find(e=>e.path===I.value)??null),On=p(()=>Z.value?.language===`plaintext`&&Z.value?.content===``),kn=p(()=>Z.value?.language===`office`),Q=p(()=>(Z.value?.name??``).split(`.`).pop()?.toLowerCase()??``),An=p(()=>Tn.has(Q.value)||En.has(Q.value)||ge(Q.value)),jn=p(()=>((Z.value?.content??``).match(/^#{1,6}\s+/gm)||[]).length),$=p(()=>Q.value===`md`&&jn.value>0);S(I,()=>{Y.value&&!An.value&&(Y.value=!1),X.value&&!$.value&&(X.value=!1)});function Mn(){An.value&&(Y.value||(X.value=!1),Y.value=!Y.value)}function Nn(){$.value&&(X.value||(Y.value=!1),X.value=!X.value)}let Pn=p(()=>{let e=Z.value;if(!e)return``;let t=Q.value,n=document.documentElement.getAttribute(`data-theme`)===`light`?`#ffffff`:`#0d1117`;return t===`html`||t===`htm`?me(e.content):t===`svg`?`<!DOCTYPE html><html><head><meta charset="utf-8"><style>html,body{margin:0;padding:0;background:${n};display:flex;align-items:center;justify-content:center;min-height:100vh;}svg{max-width:100%;max-height:90vh;}</style></head><body>${e.content}</body></html>`:``}),Fn=!1,In=0,Ln=0;function Rn(e){Fn=!0,In=e.clientX,Ln=Dn.value,document.addEventListener(`mousemove`,zn),document.addEventListener(`mouseup`,Bn),e.preventDefault()}function zn(e){if(!Fn)return;let t=e.clientX-In;Dn.value=Math.max(200,Math.min(900,Ln+t))}function Bn(){Fn=!1,document.removeEventListener(`mousemove`,zn),document.removeEventListener(`mouseup`,Bn)}return(t,s)=>(g(),b(E,null,[i(`div`,{class:`editor-view`,ref_key:`containerRef`,ref:H},[i(`div`,{class:`editor-sidebar`,style:h({width:Xt.value+`px`})},[i(`div`,ke,[i(`span`,Ae,f(a(D)(`@EDITOR:资源管理器`)),1),i(`div`,je,[u(a(o),{content:a(D)(`@EDITOR:新建文件`),placement:`bottom`,"show-after":300},{default:re(()=>[i(`button`,{class:`sidebar-action-btn`,onClick:on},[...s[9]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`}),i(`polyline`,{points:`14 2 14 8 20 8`}),i(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),i(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1)]])]),_:1},8,[`content`]),u(a(o),{content:a(D)(`@EDITOR:新建文件夹`),placement:`bottom`,"show-after":300},{default:re(()=>[i(`button`,{class:`sidebar-action-btn`,onClick:sn},[...s[10]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`}),i(`line`,{x1:`12`,y1:`11`,x2:`12`,y2:`17`}),i(`line`,{x1:`9`,y1:`14`,x2:`15`,y2:`14`})],-1)]])]),_:1},8,[`content`]),u(a(o),{content:a(D)(`@EDITOR:刷新`),placement:`bottom`,"show-after":300},{default:re(()=>[i(`button`,{class:`sidebar-action-btn`,onClick:Ot},[...s[11]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`polyline`,{points:`1 4 1 10 7 10`}),i(`polyline`,{points:`23 20 23 14 17 14`}),i(`path`,{d:`M20.49 9A9 9 0 0 0 5.64 5.64L1 10m22 4l-4.64 4.36A9 9 0 0 1 3.51 15`})],-1)]])]),_:1},8,[`content`])])]),i(`div`,Me,[s[13]||=i(`svg`,{class:`sidebar-search-icon`,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[i(`circle`,{cx:`11`,cy:`11`,r:`7`}),i(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})],-1),x(i(`input`,{ref_key:`searchInputRef`,ref:Rt,"onUpdate:modelValue":s[0]||=e=>k.value=e,type:`text`,class:`sidebar-search-input`,placeholder:a(D)(`@EDITOR:搜索文件...`),title:a(D)(`@EDITOR:搜索文件...`),spellcheck:`false`,autocomplete:`off`,onKeydown:oe(Bt,[`escape`])},null,40,Ne),[[_,k.value]]),k.value?(g(),b(`button`,{key:0,class:`sidebar-search-clear`,title:a(D)(`@EDITOR:清除搜索`),"aria-label":a(D)(`@EDITOR:清除搜索`),onClick:De},[...s[12]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[i(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),i(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,Pe)):l(``,!0)]),O.value?(g(),b(`div`,nt,[...s[22]||=[i(`span`,{class:`spin-icon`},null,-1)]])):(g(),b(`div`,Fe,[(g(!0),b(E,null,e(Mt(Ft.value),t=>(g(),b(E,{key:t.path},[W.value&&W.value.node.path===t.path?(g(),b(`div`,{key:0,class:`tree-node tree-inline-input-row`,style:h({paddingLeft:12+t.depth*14+`px`})},[t.type===`directory`?(g(),b(`span`,{key:0,class:T([`tree-arrow`,{expanded:t.expanded}])},[...s[14]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(g(),b(`span`,Ie)),(g(),b(`svg`,Le,[i(`use`,{"xlink:href":`#${rn(t)}`},null,8,Re)])),x(i(`input`,{ref_for:!0,ref_key:`renameInputRef`,ref:an,"onUpdate:modelValue":s[1]||=e=>W.value.value=e,onKeydown:_n,onBlur:gn,onClick:s[2]||=ne(()=>{},[`stop`])},null,544),[[_,W.value.value]])],4)):(g(),b(`div`,{key:1,class:T([`tree-node`,{"tree-node--dir":t.type===`directory`,"tree-node--file":t.type===`file`,"tree-node--active":I.value===t.path,"tree-node--selected":L.value?.path===t.path&&I.value!==t.path}]),style:h({paddingLeft:12+t.depth*14+`px`}),onClick:e=>Vt(t),onContextmenu:e=>fn(e,t)},[t.type===`directory`?(g(),b(`span`,{key:0,class:T([`tree-arrow`,{expanded:t.expanded}])},[...s[15]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(g(),b(`span`,Be)),t.type===`directory`?(g(),b(`svg`,Ve,[i(`use`,{"xlink:href":`#${rn(t)}`},null,8,He)])):(g(),b(`svg`,Ue,[i(`use`,{"xlink:href":`#${rn(t)}`},null,8,We)])),i(`span`,{class:`tree-name`,title:t.path},[(g(!0),b(E,null,e(Lt(t.name),(e,t)=>(g(),b(E,{key:t},[e.hit?(g(),b(`span`,Ke,f(e.text),1)):(g(),b(E,{key:1},[c(f(e.text),1)],64))],64))),128))],8,Ge),t.loading?(g(),b(`span`,qe)):l(``,!0)],46,ze)),U.value&&U.value.afterNode?.path===t.path?(g(),b(`div`,{key:2,class:`tree-node tree-inline-input-row`,style:h({paddingLeft:12+U.value.depth*14+`px`})},[s[18]||=i(`span`,{class:`tree-arrow-spacer`},null,-1),U.value.kind===`directory`?(g(),b(`svg`,Je,[...s[16]||=[i(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`},null,-1)]])):(g(),b(`svg`,Ye,[...s[17]||=[i(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`},null,-1),i(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),x(i(`input`,{ref_for:!0,ref_key:`inlineInputRef`,ref:G,class:`tree-inline-input`,"onUpdate:modelValue":s[3]||=e=>U.value.value=e,placeholder:U.value.kind===`file`?a(D)(`@EDITOR:输入文件名`):a(D)(`@EDITOR:输入文件夹名`),onKeydown:un,onBlur:cn,onClick:s[4]||=ne(()=>{},[`stop`])},null,40,Xe),[[_,U.value.value]])],4)):l(``,!0)],64))),128)),U.value&&U.value.afterNode===null?(g(),b(`div`,Ze,[s[21]||=i(`span`,{class:`tree-arrow-spacer`},null,-1),U.value.kind===`directory`?(g(),b(`svg`,Qe,[...s[19]||=[i(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`},null,-1)]])):(g(),b(`svg`,$e,[...s[20]||=[i(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`},null,-1),i(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),x(i(`input`,{ref_key:`inlineInputRef`,ref:G,class:`tree-inline-input`,"onUpdate:modelValue":s[5]||=e=>U.value.value=e,placeholder:U.value.kind===`file`?a(D)(`@EDITOR:输入文件名`):a(D)(`@EDITOR:输入文件夹名`),onKeydown:un,onBlur:cn,onClick:s[6]||=ne(()=>{},[`stop`])},null,40,et),[[_,U.value.value]])])):l(``,!0),!U.value&&(It.value||C.value.length===0)?(g(),b(`div`,tt,f(It.value?a(D)(`@EDITOR:未找到匹配文件`):a(D)(`@EDITOR:暂无文件`)),1)):l(``,!0)]))],4),i(`div`,{class:`editor-resizer`,onMousedown:en},null,32),i(`div`,rt,[F.value.length>0?(g(),b(`div`,it,[(g(!0),b(E,null,e(F.value,e=>(g(),b(`div`,{key:e.path,class:T([`editor-tab`,{active:I.value===e.path,dirty:e.isDirty}]),onClick:t=>I.value=e.path,title:e.path},[i(`span`,ot,f(e.name),1),e.isDirty?(g(),b(`span`,st)):l(``,!0),i(`button`,{class:`tab-close`,onClick:t=>Ht(e.path,t)},[...s[23]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[i(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),i(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,ct)],10,at))),128)),s[26]||=i(`div`,{class:`editor-tabs-spacer`},null,-1),An.value?(g(),b(`button`,{key:0,class:T([`preview-toggle-btn`,{active:Y.value}]),title:Y.value?a(D)(`@EDITOR:关闭预览`):a(D)(`@EDITOR:打开预览`),onClick:Mn},[s[24]||=i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z`}),i(`circle`,{cx:`12`,cy:`12`,r:`3`})],-1),i(`span`,null,f(a(D)(`@EDITOR:预览`)),1)],10,lt)):l(``,!0),$.value?(g(),b(`button`,{key:1,class:T([`preview-toggle-btn mindmap-toggle-btn`,{active:X.value,disabled:!$.value}]),disabled:!$.value,title:$.value?X.value?a(D)(`@EDITOR:关闭思维导图`):a(D)(`@EDITOR:打开思维导图`):a(D)(`@EDITOR:需要至少一个 # 标题`),onClick:Nn},[s[25]||=ee(`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-6bc4e9b4><circle cx="12" cy="12" r="2" data-v-6bc4e9b4></circle><circle cx="5" cy="6" r="1.6" data-v-6bc4e9b4></circle><circle cx="19" cy="6" r="1.6" data-v-6bc4e9b4></circle><circle cx="5" cy="18" r="1.6" data-v-6bc4e9b4></circle><circle cx="19" cy="18" r="1.6" data-v-6bc4e9b4></circle><line x1="11" y1="11" x2="6.4" y2="7" data-v-6bc4e9b4></line><line x1="13" y1="11" x2="17.6" y2="7" data-v-6bc4e9b4></line><line x1="11" y1="13" x2="6.4" y2="17" data-v-6bc4e9b4></line><line x1="13" y1="13" x2="17.6" y2="17" data-v-6bc4e9b4></line></svg>`,1),i(`span`,null,f(a(D)(`@EDITOR:思维导图`)),1)],10,ut)):l(``,!0)])):l(``,!0),F.value.length===0?(g(),b(`div`,dt,[(g(),b(`svg`,ft,[...s[27]||=[i(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`},null,-1),i(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),i(`p`,null,f(a(D)(`@EDITOR:从左侧选择文件打开`)),1),i(`p`,pt,f(a(D)(`@EDITOR:Ctrl+S 保存`)),1)])):l(``,!0),i(`div`,mt,[i(`div`,{class:T([`monaco-container`,{hidden:F.value.length===0||On.value||kn.value}]),ref_key:`editorContainerRef`,ref:Wt},null,2),On.value&&F.value.length>0&&!Y.value&&!X.value?(g(),b(`div`,ht,[(g(),b(`svg`,gt,[...s[28]||=[i(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`},null,-1),i(`circle`,{cx:`9`,cy:`9`,r:`2`},null,-1),i(`path`,{d:`m21 15-5-5L5 21`},null,-1)]])),i(`p`,_t,f(Z.value?.name),1),i(`p`,vt,f(a(D)(`@EDITOR:这是图片文件,已在右侧预览面板中打开`)),1)])):l(``,!0),(Y.value||X.value)&&F.value.length>0?(g(),b(`div`,{key:1,class:`preview-resizer`,onMousedown:Rn},null,32)):l(``,!0),(Y.value||X.value)&&F.value.length>0?(g(),b(`div`,{key:2,class:`preview-panel`,style:h({flexBasis:Dn.value+`px`})},[i(`div`,yt,[i(`span`,bt,f(X.value?a(D)(`@EDITOR:思维导图`):a(D)(`@EDITOR:预览`)),1),i(`span`,xt,f(Q.value.toUpperCase()),1),s[30]||=i(`div`,{class:`preview-header-spacer`},null,-1),i(`button`,{class:`preview-close-btn`,title:X.value?a(D)(`@EDITOR:关闭思维导图`):a(D)(`@EDITOR:关闭预览`),onClick:s[7]||=e=>X.value?X.value=!1:Y.value=!1},[...s[29]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[i(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),i(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,St)]),i(`div`,Ct,[X.value&&Q.value===`md`&&Z.value?(g(),r(Oe,{key:0,content:Z.value.content,class:`preview-mindmap`},null,8,[`content`])):Y.value&&Q.value===`md`&&Z.value?(g(),r(pe,{key:1,content:Z.value.content,class:`preview-markdown`},null,8,[`content`])):Y.value&&[`html`,`htm`,`svg`].includes(Q.value)?(g(),b(`iframe`,{key:2,class:`preview-iframe`,sandbox:a(_e),srcdoc:Pn.value},null,8,wt)):Y.value&&a(En).has(Q.value)&&Z.value?(g(),r(fe,{key:3,"file-path":Z.value.path,"file-name":Z.value.name},null,8,[`file-path`,`file-name`])):Y.value&&kn.value&&Z.value?(g(),r(he,{key:4,"file-path":Z.value.path},null,8,[`file-path`])):l(``,!0)])],4)):l(``,!0)])])],512),(g(),r(n,{to:`body`},[q.value?(g(),b(`div`,{key:0,ref_key:`ctxMenuRef`,ref:dn,class:`ctx-menu`,style:h({left:q.value.x+`px`,top:q.value.y+`px`}),onClick:s[8]||=ne(()=>{},[`stop`])},[i(`button`,{class:`ctx-menu-item`,onClick:pn},[s[31]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`}),i(`polyline`,{points:`14 2 14 8 20 8`}),i(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),i(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1),c(` `+f(a(D)(`@EDITOR:新建文件`)),1)]),i(`button`,{class:`ctx-menu-item`,onClick:mn},[s[32]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`}),i(`line`,{x1:`12`,y1:`11`,x2:`12`,y2:`17`}),i(`line`,{x1:`9`,y1:`14`,x2:`15`,y2:`14`})],-1),c(` `+f(a(D)(`@EDITOR:新建文件夹`)),1)]),s[38]||=i(`div`,{class:`ctx-menu-sep`},null,-1),i(`button`,{class:`ctx-menu-item`,onClick:Sn},[s[33]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`}),i(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})],-1),c(` `+f(a(D)(`@EDITOR:复制绝对路径`)),1)]),i(`button`,{class:`ctx-menu-item`,onClick:Cn},[s[34]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`}),i(`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`})],-1),c(` `+f(a(D)(`@EDITOR:复制相对路径`)),1)]),s[39]||=i(`div`,{class:`ctx-menu-sep`},null,-1),i(`button`,{class:`ctx-menu-item`,onClick:yn},[s[35]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`}),i(`path`,{d:`M3 7v10a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2`})],-1),c(` `+f(a(D)(`@EDITOR:在资源管理器中打开`)),1)]),i(`button`,{class:`ctx-menu-item`,onClick:wn},[u(se,{"icon-class":`vscode`,"class-name":`ctx-menu-icon`}),c(` `+f(a(D)(`@EDITOR:在 VSCode 中打开`)),1)]),i(`button`,{class:`ctx-menu-item`,onClick:hn},[s[36]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`}),i(`path`,{d:`M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z`})],-1),c(` `+f(a(D)(`@EDITOR:重命名`)),1)]),i(`button`,{class:`ctx-menu-item ctx-menu-item--danger`,onClick:vn},[s[37]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`polyline`,{points:`3 6 5 6 21 6`}),i(`path`,{d:`M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6`}),i(`path`,{d:`M10 11v6`}),i(`path`,{d:`M14 11v6`}),i(`path`,{d:`M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2`})],-1),c(` `+f(a(D)(`@EDITOR:删除`)),1)])],4)):l(``,!0)]))],64))}}),[[`__scopeId`,`data-v-6bc4e9b4`]]);export{M as default};