@xbzbing/dsh-git-panel 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client.js +15 -8
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -8,7 +8,7 @@ var module = { exports: {} }; var exports = module.exports;
|
|
|
8
8
|
--gp-select-bar:inset 3px 0 0 var(--dsw-alias-state-business-primary)}
|
|
9
9
|
.gp-panel[data-font-delta="1"]{zoom:1.08;font-size:14px}
|
|
10
10
|
.gp-panel[data-font-delta="-1"]{zoom:.92;font-size:12px}
|
|
11
|
-
.gp-tabbar{display:flex;align-items:center;gap:4px;padding:6px 10px;border-bottom:1px solid var(--dsw-alias-border-l2);flex:none}
|
|
11
|
+
.gp-tabbar{display:flex;align-items:center;gap:4px;padding:6px 10px;border-bottom:1px solid var(--dsw-alias-border-l2);flex:none;flex-wrap:nowrap;min-width:0;container-type:inline-size}
|
|
12
12
|
/* The shell floats the input composer over the view's bottom (composer-overlay
|
|
13
13
|
* mode). Reserve that height as bottom padding so the panel's own bottom rows
|
|
14
14
|
* (commit box / commit comment) stay above it instead of being covered. */
|
|
@@ -27,12 +27,19 @@ var module = { exports: {} }; var exports = module.exports;
|
|
|
27
27
|
.gp-verbar__link:hover{text-decoration:underline}
|
|
28
28
|
.gp-verbar__gh{color:var(--dsw-alias-label-secondary);text-decoration:none}
|
|
29
29
|
.gp-verbar__gh:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}
|
|
30
|
-
.gp-tab{display:inline-flex;align-items:center;gap:6px;height:30px;padding:0 12px;border:0;border-radius:8px;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:13px;cursor:pointer;transition:background .12s ease,color .12s ease}
|
|
30
|
+
.gp-tab{display:inline-flex;align-items:center;gap:6px;height:30px;padding:0 12px;border:0;border-radius:8px;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:13px;cursor:pointer;flex:none;transition:background .12s ease,color .12s ease}
|
|
31
31
|
.gp-tab:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
32
32
|
/* Active tab: primary-tinted fill + primary text + medium weight + a soft ring.
|
|
33
33
|
* Clear enough to spot at a glance, restrained enough not to shout. */
|
|
34
34
|
.gp-tab--active{background:color-mix(in srgb,var(--dsw-alias-state-business-primary) 12%,transparent);color:var(--dsw-alias-state-business-primary);font-weight:600;box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--dsw-alias-state-business-primary) 32%,transparent)}
|
|
35
|
-
.gp-tab__icon{display:inline-flex;width:15px;height:15px}
|
|
35
|
+
.gp-tab__icon{display:inline-flex;width:15px;height:15px;flex:none}
|
|
36
|
+
.gp-tab__label{white-space:nowrap}
|
|
37
|
+
/* Responsive tab bar (the bar is an inline-size container): as the panel
|
|
38
|
+
* narrows \u2014 e.g. when the right sidebar opens \u2014 shed the trailing controls
|
|
39
|
+
* first, then drop the tab labels to icon-only. Two stages, so labels never
|
|
40
|
+
* wrap or overflow into the garbled multi-line state. */
|
|
41
|
+
@container (max-width:460px){.gp-tabbar .gp-font,.gp-tabbar .gp-verbar{display:none}}
|
|
42
|
+
@container (max-width:300px){.gp-tab__label{display:none}.gp-tab{gap:0;padding:0 10px}}
|
|
36
43
|
.gp-font{margin-left:4px;display:inline-flex;align-items:center;border:1px solid var(--dsw-alias-border-l2);border-radius:6px;overflow:hidden}
|
|
37
44
|
.gp-font button{border:0;border-left:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-secondary);font:inherit;font-size:11px;line-height:22px;width:24px;height:24px;padding:0;cursor:pointer}
|
|
38
45
|
.gp-font button:first-child{border-left:0}
|
|
@@ -89,7 +96,7 @@ var module = { exports: {} }; var exports = module.exports;
|
|
|
89
96
|
.gp-ref-chip--tag{color:var(--dsw-alias-state-warn-primary,var(--dsw-alias-label-secondary))}
|
|
90
97
|
.gp-graph-cell{position:relative}
|
|
91
98
|
.gp-graph-svg{display:block}
|
|
92
|
-
.gp-search{flex:1;height:28px;border:1px solid var(--dsw-alias-border-l2);border-radius:6px;background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);font:inherit;font-size:12px;padding:0 10px;box-sizing:border-box}
|
|
99
|
+
.gp-search{flex:1;min-width:60px;height:28px;border:1px solid var(--dsw-alias-border-l2);border-radius:6px;background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);font:inherit;font-size:12px;padding:0 10px;box-sizing:border-box}
|
|
93
100
|
.gp-search:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:-2px}
|
|
94
101
|
.gp-select{height:28px;border:1px solid var(--dsw-alias-border-l2);border-radius:6px;background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);font:inherit;font-size:12px;padding:0 6px}
|
|
95
102
|
|
|
@@ -310,10 +317,10 @@ var module = { exports: {} }; var exports = module.exports;
|
|
|
310
317
|
.gp-tip{position:fixed;z-index:60;max-width:520px;padding:8px 12px;border:1px solid var(--dsw-alias-border-l1,var(--dsw-alias-border-l2));border-radius:12px;background:var(--dsw-alias-bg-layer-3,var(--dsw-alias-bg-layer-2));box-shadow:0 6px 24px rgba(0,0,0,.18),0 1px 3px rgba(0,0,0,.12);font-size:12px;line-height:1.5;pointer-events:none}
|
|
311
318
|
.gp-tip__path{color:var(--dsw-alias-label-primary);font-family:var(--dsw-font-mono,ui-monospace,monospace);word-break:break-all}
|
|
312
319
|
.gp-tip__note{margin-top:4px;color:var(--dsw-alias-label-tertiary)}
|
|
313
|
-
`,Je=!1;function ot(){if(Je||typeof document>"u")return;let e="dsh-git-panel/client.css";if(document.querySelector(`style[data-plugin-css="${e}"]`)!==null){Je=!0;return}let t=document.createElement("style");t.dataset.plugin="@xbzbing/dsh-git-panel",t.dataset.pluginCss=e,t.textContent=ln,document.head.appendChild(t),Je=!0}var st={"panel.tab":"Git","panel.fontDecrease":"\u7F29\u5C0F\u5B57\u4F53","panel.fontReset":"\u91CD\u7F6E\u5B57\u4F53\u5927\u5C0F","panel.fontIncrease":"\u653E\u5927\u5B57\u4F53","tab.overview":"Git \u603B\u89C8","tab.changes":"\u53D8\u66F4\u8BB0\u5F55","tab.files":"\u6587\u4EF6\u6D4F\u89C8","pill.unavailable":"Git \u4E0D\u53EF\u7528","pill.detached":"\u6E38\u79BB HEAD","pill.synced":"\u672C\u5730\u5DF2\u540C\u6B65","pill.dirty":"\u6709\u5F85\u63D0\u4EA4\u7684\u53D8\u66F4","common.loading":"\u52A0\u8F7D\u4E2D\u2026","common.retry":"\u91CD\u8BD5","common.close":"\u5173\u95ED","version.check":"\u68C0\u67E5\u65B0\u7248\u672C","version.checking":"\u68C0\u67E5\u4E2D\u2026","version.upToDate":"\u5DF2\u662F\u6700\u65B0\uFF08{current}\uFF09","version.updateAvailable":"\u6709\u65B0\u7248\u672C {latest}\uFF08\u5F53\u524D {current}\uFF09","version.viewRelease":"\u67E5\u770B\u53D1\u5E03","version.error":"\u68C0\u67E5\u5931\u8D25","version.noRepo":"\u672A\u914D\u7F6E\u4ED3\u5E93\u5730\u5740","version.openRepo":"\u5728 GitHub \u4E0A\u6253\u5F00\u4ED3\u5E93","overview.head":"HEAD\uFF08\u5F53\u524D\u5206\u652F\uFF09","overview.local":"\u672C\u5730","overview.remote":"\u8FDC\u7A0B","overview.tags":"\u6807\u7B7E","overview.search":"\u641C\u7D22\u63D0\u4EA4\uFF08\u6D88\u606F / \u54C8\u5E0C\uFF09","overview.allUsers":"\u5168\u90E8\u4F5C\u8005","overview.allTime":"\u5168\u90E8\u65F6\u95F4","overview.today":"\u4ECA\u5929","overview.last7d":"\u8FD1 7 \u5929","overview.last30d":"\u8FD1 30 \u5929","overview.selectCommit":"\u9009\u62E9\u4E00\u4E2A\u63D0\u4EA4\u67E5\u770B\u8BE6\u60C5","overview.noMessage":"\uFF08\u65E0\u63D0\u4EA4\u6B63\u6587\uFF09","overview.noResults":"\u6CA1\u6709\u5339\u914D\u7684\u63D0\u4EA4","overview.loadFailed":"\u52A0\u8F7D\u5931\u8D25","overview.detailFailed":"\u8BE6\u60C5\u52A0\u8F7D\u5931\u8D25","overview.diffFailed":"\u5DEE\u5F02\u52A0\u8F7D\u5931\u8D25","overview.openFileDiff":"\u67E5\u770B\u8BE5\u6587\u4EF6\u5728\u6B64\u63D0\u4EA4\u4E2D\u7684\u53D8\u66F4","overview.fetch":"\u62C9\u53D6\u8FDC\u7A0B","overview.branchesError":"\u5206\u652F\u52A0\u8F7D\u5931\u8D25","changes.groupStaged":"\u5DF2\u6682\u5B58\u7684\u66F4\u6539","changes.groupUnstaged":"\u66F4\u6539","changes.groupUntracked":"\u672A\u7248\u672C\u63A7\u5236\u7684\u6587\u4EF6","changes.selectFile":"\u9009\u62E9\u4E00\u4E2A\u6587\u4EF6\u67E5\u770B\u53D8\u66F4","changes.noChanges":"\u6CA1\u6709\u672A\u63D0\u4EA4\u7684\u53D8\u66F4","changes.stageAll":"\u5168\u90E8\u6682\u5B58","changes.unstageAll":"\u5168\u90E8\u53D6\u6D88\u6682\u5B58","changes.stage":"\u6682\u5B58","changes.unstage":"\u53D6\u6D88\u6682\u5B58","changes.discard":"\u653E\u5F03\u66F4\u6539","changes.discardConfirm":"\u518D\u6B21\u70B9\u51FB\u4EE5\u786E\u8BA4\u653E\u5F03","files.selectFile":"\u9009\u62E9\u4E00\u4E2A\u6587\u4EF6\u67E5\u770B\u5185\u5BB9","files.loadFailed":"\u52A0\u8F7D\u5931\u8D25","files.truncated":"\u6761\u76EE\u8FC7\u591A\uFF0C\u5DF2\u622A\u65AD","files.tooLarge":"\u6587\u4EF6\u8FC7\u5927\uFF0C\u65E0\u6CD5\u9884\u89C8","files.binary":"\u4E8C\u8FDB\u5236\u6587\u4EF6\uFF0C\u65E0\u6CD5\u9884\u89C8","files.previewMode":"Markdown \u9884\u89C8\u65B9\u5F0F","files.source":"\u6E90\u7801","files.render":"\u6E32\u67D3","files.copyPath":"\u590D\u5236\u76F8\u5BF9\u8DEF\u5F84","files.pathCopied":"\u8DEF\u5F84\u5DF2\u590D\u5236","files.pathCopyFailed":"\u590D\u5236\u5931\u8D25","files.ignored":"\u5DF2\u88AB Git \u5FFD\u7565","files.copy":"\u590D\u5236\u4EE3\u7801","files.copied":"\u5DF2\u590D\u5236","files.footnotes":"\u6CE8\u91CA","stats.files":"{n} \u4E2A\u6587\u4EF6","stats.lastChange":"\u6700\u8FD1\u53D8\u66F4 {time}","stats.lastCommit":"\u4E0A\u6B21\u63D0\u4EA4 {time}","stats.staged":"\u5DF2\u6682\u5B58 {n}","stats.modified":"\u5DF2\u4FEE\u6539 {n}","stats.untracked":"\u672A\u8DDF\u8E2A {n}","commit.placeholder":"\u63D0\u4EA4\u4FE1\u606F","commit.commit":"\u63D0\u4EA4","commit.amend":"\u4FEE\u6B63\u4E0A\u6B21\u63D0\u4EA4\uFF08amend\uFF09","diff.unified":"\u7EDF\u4E00","diff.split":"\u5BF9\u7167","diff.before":"\u53D8\u66F4\u524D","diff.after":"\u53D8\u66F4\u540E","diff.binary":"\u4E8C\u8FDB\u5236\u6587\u4EF6\uFF0C\u65E0\u6CD5\u663E\u793A\u5BF9\u7167","diff.tooLarge":"\u56FE\u7247\u8FC7\u5927\uFF0C\u65E0\u6CD5\u663E\u793A\u5BF9\u7167","diff.imageMissing":"\u4E0D\u5B58\u5728","diff.svgRender":"\u6E32\u67D3","diff.svgSource":"\u6E90\u7801","diff.empty":"\u65E0\u5DEE\u5F02","diff.expandAll":"\u5C55\u5F00\u5168\u90E8","diff.collapse":"\u6298\u53E0\u672A\u53D8\u66F4","diff.expandGap":"\u5C55\u5F00\u5168\u90E8 {n} \u884C","diff.expandUp":"\u5411\u4E0A\u5C55\u5F00 {n} \u884C","diff.expandDown":"\u5411\u4E0B\u5C55\u5F00 {n} \u884C","time.justNow":"\u521A\u521A","time.minutesAgo":"{n} \u5206\u949F\u524D","time.hoursAgo":"{n} \u5C0F\u65F6\u524D","time.daysAgo":"{n} \u5929\u524D","error.generic":"\u64CD\u4F5C\u5931\u8D25","error.notARepo":"\u5F53\u524D\u76EE\u5F55\u4E0D\u662F Git \u4ED3\u5E93","error.noCwd":"\u5F53\u524D\u4F1A\u8BDD\u65E0\u5DE5\u4F5C\u76EE\u5F55","error.localChangesBlock":"\u672C\u5730\u6709\u672A\u63D0\u4EA4\u53D8\u66F4\uFF0C\u65E0\u6CD5\u5207\u6362","error.emptyMessage":"\u63D0\u4EA4\u4FE1\u606F\u4E0D\u80FD\u4E3A\u7A7A","cfg.title":"\u8F93\u5165\u6846\u5206\u652F\u6807\u8BB0","cfg.toggle":"\u663E\u793A\u8F93\u5165\u6846\u6807\u8BB0","cfg.hint":"\u5F00\u542F\u65F6\u5728\u8F93\u5165\u6846\u663E\u793A zsh \u98CE\u683C\u7684 <\u4ED3\u5E93\u540D> (\u5206\u652F) \u6807\u8BB0\uFF1B\u5173\u95ED\u540E\u6539\u4E3A\u5728 Git \u6807\u7B7E\u65C1\u663E\u793A\u72B6\u6001\u5706\u70B9\u3002\u4FDD\u5B58\u540E\u7ACB\u5373\u751F\u6548\u3002","cfg.diffTitle":"\u5DEE\u5F02\u5BF9\u6BD4\u9ED8\u8BA4\u89C6\u56FE","cfg.diffHint":"\u9009\u62E9\u53D8\u66F4\u5BF9\u6BD4\u9ED8\u8BA4\u6253\u5F00\u7684\u5E03\u5C40\uFF1A\u7EDF\u4E00\u89C6\u56FE\u4E3A\u5355\u680F\u884C\u5185\u5BF9\u6BD4\uFF0C\u5E76\u6392\u89C6\u56FE\u4E3A\u5DE6\u53F3\u5206\u680F\u5BF9\u6BD4\u3002\u4ECD\u53EF\u5728\u6BCF\u4E2A\u5DEE\u5F02\u89C6\u56FE\u4E2D\u4E34\u65F6\u5207\u6362\u3002\u4FDD\u5B58\u540E\u7ACB\u5373\u751F\u6548\u3002","cfg.diffUnified":"\u7EDF\u4E00\u89C6\u56FE\uFF08\u5355\u680F\u884C\u5185\uFF09","cfg.diffSplit":"\u5E76\u6392\u89C6\u56FE\uFF08\u5DE6\u53F3\u5206\u680F\uFF09","cfg.notLoaded":"\u914D\u7F6E\u672A\u52A0\u8F7D\uFF1A\u8BE5\u914D\u7F6E\u7531\u8FD0\u884C\u4E2D\u7684\u5BBF\u4E3B\u63D0\u4F9B\uFF0C\u82E5\u957F\u65F6\u95F4\u7A7A\u767D\u8BF7\u91CD\u542F DSH \u540E\u91CD\u8BD5\u3002","cfg.saveFailed":"\u4FDD\u5B58\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"},lt={"panel.tab":"Git","panel.fontDecrease":"Decrease font size","panel.fontReset":"Reset font size","panel.fontIncrease":"Increase font size","tab.overview":"Overview","tab.changes":"Changes","tab.files":"Files","pill.unavailable":"Git unavailable","pill.detached":"detached HEAD","pill.synced":"Everything committed","pill.dirty":"Uncommitted changes","common.loading":"Loading\u2026","common.retry":"Retry","common.close":"Close","version.check":"Check for updates","version.checking":"Checking\u2026","version.upToDate":"Up to date ({current})","version.updateAvailable":"New version {latest} available (current {current})","version.viewRelease":"View release","version.error":"Check failed","version.noRepo":"Repository not configured","version.openRepo":"Open repository on GitHub","overview.head":"HEAD (Current Branch)","overview.local":"Local","overview.remote":"Remote","overview.tags":"Tags","overview.search":"Search commits (message / hash)","overview.allUsers":"All authors","overview.allTime":"All time","overview.today":"Today","overview.last7d":"Last 7 days","overview.last30d":"Last 30 days","overview.selectCommit":"Select a commit to see details","overview.noMessage":"(no commit body)","overview.noResults":"No matching commits","overview.loadFailed":"Load failed","overview.detailFailed":"Failed to load details","overview.diffFailed":"Failed to load diff","overview.openFileDiff":"View this file\u2019s changes in this commit","overview.fetch":"Fetch","overview.branchesError":"Failed to load branches","changes.groupStaged":"Staged changes","changes.groupUnstaged":"Changes","changes.groupUntracked":"Unversioned files","changes.selectFile":"Select a file to see its diff","changes.noChanges":"No uncommitted changes","changes.stageAll":"Stage all","changes.unstageAll":"Unstage all","changes.stage":"Stage","changes.unstage":"Unstage","changes.discard":"Discard changes","changes.discardConfirm":"Click again to confirm discard","files.selectFile":"Select a file to preview","files.loadFailed":"Load failed","files.truncated":"Too many entries \u2014 truncated","files.tooLarge":"File too large to preview","files.binary":"Binary file \u2014 no preview","files.previewMode":"Markdown preview mode","files.source":"Source","files.render":"Rendered","files.copyPath":"Copy relative path","files.pathCopied":"Path copied","files.pathCopyFailed":"Copy failed","files.ignored":"Ignored by Git","files.copy":"Copy code","files.copied":"Copied","files.footnotes":"Footnotes","stats.files":"{n} files","stats.lastChange":"changed {time}","stats.lastCommit":"last commit {time}","stats.staged":"{n} staged","stats.modified":"{n} modified","stats.untracked":"{n} untracked","commit.placeholder":"Commit message","commit.commit":"Commit","commit.amend":"Amend previous commit","diff.unified":"Unified","diff.split":"Split","diff.before":"Before","diff.after":"After","diff.binary":"Binary file \u2014 no diff to show","diff.tooLarge":"Image too large to compare","diff.imageMissing":"Does not exist","diff.svgRender":"Rendered","diff.svgSource":"Source","diff.empty":"No differences","diff.expandAll":"Expand all","diff.collapse":"Collapse unchanged","diff.expandGap":"Expand all {n} lines","diff.expandUp":"Expand up {n} lines","diff.expandDown":"Expand down {n} lines","time.justNow":"just now","time.minutesAgo":"{n}m ago","time.hoursAgo":"{n}h ago","time.daysAgo":"{n}d ago","error.generic":"Operation failed","error.notARepo":"Not a Git repository","error.noCwd":"This session has no working directory","error.localChangesBlock":"Local changes block the checkout","error.emptyMessage":"Commit message cannot be empty","cfg.title":"Input-bar branch marker","cfg.toggle":"Show input-bar marker","cfg.hint":"When on, the input bar shows the zsh-style <repo> (branch) marker; when off, a status dot appears beside the Git tab instead. Saved changes apply immediately.","cfg.diffTitle":"Default diff view","cfg.diffHint":"Choose the layout diffs open with: unified is a single inline column, split is side-by-side. You can still switch per diff. Saved changes apply immediately.","cfg.diffUnified":"Unified (single inline column)","cfg.diffSplit":"Split (side-by-side)","cfg.notLoaded":"Config not loaded: it is served by the running host. Restart DSH if this stays blank.","cfg.saveFailed":"Save failed, please retry"};var Te=require("react");var dn=new Set(["cwd-unavailable"]),Ke=3e4,cn=6e4,Ne=class{constructor(t,n){this.remote=t;this.sessionId=n}view={state:"cold"};listeners=new Set;timer;inflight;pendingRefresh=!1;disposed=!1;pollMs=Ke;subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}getSnapshot(){return this.view}ensure(){this.view.state!=="cold"&&this.view.state!=="no-cwd"||this.refresh()}refresh(){return this.inflight!==void 0?(this.pendingRefresh=!0,this.inflight):this.disposed?Promise.resolve():(this.view.state==="cold"&&this.setView({state:"loading"}),this.inflight=this.remote.snapshot({sessionId:this.sessionId}).then(t=>{if(!this.disposed){if(t.ok)this.pollMs=t.value.refreshIntervalMs||Ke,this.setView({state:"ready",snapshot:t.value});else if(t.error.code!=="cancelled")if(dn.has(t.error.code))this.pollMs=cn,this.setView({state:"no-cwd"});else if(t.error.code==="not-a-git-repo"){let n=t.error;this.setView({state:"error",error:{code:"not-a-git-repo",...n.cwd?{cwd:n.cwd}:{},...n.showInputPill!==void 0?{showInputPill:n.showInputPill}:{}}})}else this.setView({state:"error",error:{code:t.error.code,..."detail"in t.error?{detail:t.error.detail}:{}}})}}).catch(t=>{this.disposed||this.setView({state:"error",error:{code:"git-unavailable",detail:t instanceof Error?t.message:String(t)}})}).finally(()=>{this.inflight=void 0,this.pendingRefresh&&!this.disposed?(this.pendingRefresh=!1,this.refresh()):this.schedulePoll()}),this.inflight)}resync(){this.disposed||this.refresh()}accept(t){this.disposed||(this.pollMs=t.refreshIntervalMs||Ke,this.setView({state:"ready",snapshot:t}),this.schedulePoll())}schedulePoll(){this.disposed||(this.timer!==void 0&&clearTimeout(this.timer),!(this.pollMs<=0)&&(this.timer=setTimeout(()=>{this.refresh()},this.pollMs)))}setView(t){this.view=t;for(let n of this.listeners)n()}dispose(){this.disposed=!0,this.timer!==void 0&&clearTimeout(this.timer),this.timer=void 0,this.listeners.clear()}};var pn="/api",fn="gitPanel";function gn(e){try{let t=e.get("connection")?.rpc,n=t?.call;if(t!==void 0&&typeof n=="function")return(i,r,a)=>n.call(t,pn,i,r,a)}catch{}}function un(e){let t=e;if(t===null||typeof t!="object")return{ok:!1,error:{code:"git-unavailable",message:"malformed rpc result"}};if(t.ok!==!0){let n=t.error;return{ok:!1,error:{code:typeof n?.code=="string"?n.code:"git-unavailable",message:typeof n?.message=="string"?n.message:void 0}}}return t.value===void 0?{ok:!1,error:{code:"git-unavailable",message:"missing value"}}:t.value}function I(e,t){return!e.ok||e.value.kind!==t?null:e.value}function ae(e){return e!==void 0&&e!==""}var dt=new WeakMap;function we(e){let t=dt.get(e);if(t!==void 0)return t;let n=async(r,a,s)=>{let o=gn(e);if(o===void 0)return{ok:!1,error:{code:"git-unavailable",message:"no connection"}};try{let l=await o(`${fn}/${r}`,{args:{request:a}},s);return un(l)}catch(l){return{ok:!1,error:{code:"git-unavailable",message:l instanceof Error?l.message:String(l)}}}},i={snapshot:(r,a)=>n("snapshot",r,a),run:(r,a)=>n("run",r,a),query:(r,a)=>n("query",r,a),version:(r,a)=>n("version",r,a)};return dt.set(e,i),i}var se=new Map,ct,Be;function pt(e){Be=e,ct=we(e)}function We(e){let t=se.get(e);if(t===void 0){let n=ct??(Be?we(Be):void 0);t=new Ne(n??bn(),e),se.set(e,t)}return t}var mn=6e4,Ge=new Map;function hn(e){let t=Ge.get(e);t!==void 0&&(clearTimeout(t),Ge.delete(e)),fe.set(e,(fe.get(e)??0)+1)}function yn(e){let t=(fe.get(e)??1)-1;if(t>0){fe.set(e,t);return}fe.delete(e);let n=setTimeout(()=>{Ge.delete(e),!((fe.get(e)??0)>0)&&(se.get(e)?.dispose(),se.delete(e))},mn);Ge.set(e,n)}var fe=new Map;function xe(){for(let e of se.values())e.resync()}function ft(){for(let e of se.values())e.dispose();se.clear()}function bn(){let e=async()=>({ok:!1,error:{code:"git-unavailable"}});return{snapshot:e,run:e,query:e,version:e}}function Re(e){let[,t]=(0,Te.useState)(0),n=e?We(e):void 0;return(0,Te.useEffect)(()=>{if(n===void 0||e===void 0)return;hn(e);let i=n.subscribe(()=>t(r=>r+1));return n.ensure(),()=>{i(),yn(e)}},[n,e]),n?n.getSnapshot():{state:"cold"}}var k=require("react");var gt="[data-conversation-tabs]",_e='[data-conversation-tabs] button[role="tab"]',Oe=new Map,ke=new Map;function ut(e,t){let n=ke.get(e);if(n!==void 0&&n.size>0){for(let i of n)i(t);return}Oe.set(e,t)}function mt(e){let t=Oe.get(e);return t===void 0?null:(Oe.delete(e),t)}function ht(e,t){let n=ke.get(e);return n===void 0&&(n=new Set,ke.set(e,n)),n.add(t),()=>{let i=ke.get(e);i!==void 0&&(i.delete(t),i.size===0&&ke.delete(e))}}function yt(e){if(typeof document>"u")return!1;let t=document.querySelectorAll(_e);for(let n of t)if((n.textContent??"").trim()===e)return n.getAttribute("aria-selected")!=="true"&&n.click(),!0;return!1}function bt(e){if(typeof document>"u")return!1;let t=document.querySelectorAll(_e);for(let n of t)if((n.textContent??"").trim()===e)return n.getAttribute("aria-selected")==="true";return!1}function vt(e){if(typeof document>"u")return!1;let t=document.querySelectorAll(_e);for(let n of t)if((n.textContent??"").trim()!==e)return n.getAttribute("aria-selected")!=="true"&&n.click(),!0;return!1}var d=require("react"),Ze=require("react-dom");var F=require("react");function ee(e,t=15){return(0,F.createElement)("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"},e)}function Ee({size:e}){return ee([(0,F.createElement)("circle",{key:"c",cx:8,cy:8,r:2.4}),(0,F.createElement)("line",{key:"l1",x1:8,y1:1.5,x2:8,y2:5.6}),(0,F.createElement)("line",{key:"l2",x1:8,y1:10.4,x2:8,y2:14.5})],e)}function wt({size:e}){return ee([(0,F.createElement)("path",{key:"a",d:"M4 2v8"}),(0,F.createElement)("path",{key:"b",d:"M2 4h4"}),(0,F.createElement)("circle",{key:"c",cx:4,cy:12,r:1.6}),(0,F.createElement)("circle",{key:"d",cx:12,cy:4,r:1.6}),(0,F.createElement)("path",{key:"e",d:"M12 6v4"}),(0,F.createElement)("path",{key:"f",d:"M10 12h4"})],e)}function je({size:e}){return ee([(0,F.createElement)("circle",{key:"a",cx:4,cy:3,r:1.6}),(0,F.createElement)("circle",{key:"b",cx:4,cy:13,r:1.6}),(0,F.createElement)("circle",{key:"c",cx:12,cy:5,r:1.6}),(0,F.createElement)("path",{key:"d",d:"M4 4.6v6.8"}),(0,F.createElement)("path",{key:"e",d:"M12 6.6c0 3-4 2.4-8 4"})],e)}function xt({size:e}){return ee([(0,F.createElement)("path",{key:"a",d:"M2 7V3h4l8 8-4 4z"}),(0,F.createElement)("circle",{key:"b",cx:4.5,cy:5.5,r:.8,fill:"currentColor"})],e)}function le({size:e,open:t}){return ee([(0,F.createElement)("path",{key:"a",d:t?"M3 6l5 5 5-5":"M6 3l5 5-5 5"})],e)}function kt({size:e}){return ee([(0,F.createElement)("path",{key:"a",d:"M4 4l8 8M12 4l-8 8"})],e)}function De({size:e}){return ee([(0,F.createElement)("path",{key:"a",d:"M13 8a5 5 0 1 1-1.5-3.5"}),(0,F.createElement)("path",{key:"b",d:"M13 2v3h-3"})],e)}function _t({size:e}){return ee([(0,F.createElement)("path",{key:"a",d:"M4 2h5l3 3v9H4z"}),(0,F.createElement)("path",{key:"b",d:"M9 2v3h3"})],e)}function St({size:e}){return ee([(0,F.createElement)("path",{key:"a",d:"M5 2.5h4l2.5 2.5v7.5h-6.5z"}),(0,F.createElement)("path",{key:"b",d:"M9 2.5V5h2.5"}),(0,F.createElement)("path",{key:"c",d:"M11 12.5v1.5h-6.5V6"})],e)}function Ct({size:e=15}){return(0,F.createElement)("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"currentColor"},(0,F.createElement)("path",{"fill-rule":"evenodd",d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z"}))}function Nt(e){let t=0;for(let n of e){t=Math.max(t,n.lane+1);for(let i of n.edges)t=Math.max(t,i.fromLane+1,i.toLane+1)}return t}function Gt(e){let t=[],n=[],i=new Map,r=0,a=s=>{let o=i.get(s);return o===void 0&&(o=r++,i.set(s,o)),o};for(let s of e){let o=f=>{let m=n.findIndex(T=>T===f);return m===-1&&(m=n.findIndex(T=>T===null),m===-1&&(m=n.length,n.push(null)),n[m]=f),m},l=o(s.hash),c=a(s.hash),g=[...n],p=s.parents,y=p.length>=2;for(let f=0;f<n.length;f++)f!==l&&n[f]===s.hash&&(n[f]=null);if(p.length===0)n[l]=null;else{n[l]=p[0],a(p[0]);for(let f=1;f<p.length;f++){let m=p[f];o(m),a(m)}}let h=[],v=n;for(let f=0;f<g.length;f++){let m=g[f];if(m!==null)if(m===s.hash)h.push({fromLane:f,toLane:l,color:a(s.hash)});else{let T=v.findIndex(R=>R===m);T!==-1&&h.push({fromLane:f,toLane:T,color:a(m)})}}for(let f of p){let m=v.findIndex(T=>T===f);m!==-1&&h.push({fromLane:l,toLane:m,color:a(f)})}for(t.push({commit:s,lane:l,color:c,edges:h,merge:y});n.length>0&&n[n.length-1]===null;)n=n.slice(0,-1)}return t}function Tt(e){let t={name:"",path:"",dir:!0,children:[]};for(let n of e){let i=n.path.split("/").filter(s=>s!==""),r=t,a="";for(let s=0;s<i.length;s++){let o=i[s];a=a===""?o:`${a}/${o}`;let l=s===i.length-1,c=r.children.find(g=>g.name===o&&g.dir===!l);c===void 0&&(c={name:o,path:a,dir:!l,children:[],...l?{meta:n.meta}:{}},r.children.push(c)),r=c}}return Rt(t),Et(t.children)}function Rt(e){e.children.sort((t,n)=>t.dir!==n.dir?t.dir?-1:1:t.name.localeCompare(n.name));for(let t of e.children)Rt(t)}function Et(e){return e.map(t=>{if(!t.dir)return t;let n=t;for(;n.children.length===1&&n.children[0].dir;){let i=n.children[0];n={name:`${n.name}/${i.name}`,path:i.path,dir:!0,children:i.children}}return{...n,children:Et(n.children)}})}function ge(e,t,n){if(e===null)return"";let i=typeof e=="number"?e:Date.parse(e);if(!Number.isFinite(i))return"";let r=Math.max(0,t-i),a=Math.floor(r/6e4);if(a<1)return n("time.justNow");if(a<60)return n("time.minutesAgo",{n:a});let s=Math.floor(a/60);if(s<24)return n("time.hoursAgo",{n:s});let o=Math.floor(s/24);return n("time.daysAgo",{n:o})}function ue(e){if(e===null)return"";let t=new Date(typeof e=="number"?e:Date.parse(e));if(Number.isNaN(t.getTime()))return"";let n=i=>String(i).padStart(2,"0");return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}var Me={added:"A",modified:"M",deleted:"D",renamed:"R",untracked:"U",conflicted:"!",typechange:"T"};function Pe(e){return e==="added"||e==="untracked"?"gp-status--added":e==="deleted"?"gp-status--deleted":e==="renamed"?"gp-status--renamed":"gp-status--modified"}var x=require("react");var vn={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",avif:"image/avif",bmp:"image/bmp",svg:"image/svg+xml",ico:"image/x-icon",tif:"image/tiff",tiff:"image/tiff"};function Ue(e){let t=e.lastIndexOf(".");return t<0?null:vn[e.slice(t+1).toLowerCase()]??null}function Dt(e){return/^Binary files .* differ$/m.test(e)||/^GIT binary patch$/m.test(e)}function Mt(e){return Ue(e)!==null}function Pt(e){return/\.svg$/i.test(e)}function wn(e){let t=Qe(e);return t.length===0?!1:t.every(n=>n.startsWith("+")||n.startsWith(" "))&&t.some(n=>n.startsWith("+"))&&/^\+\+\+ /m.test(e)&&/--- \/dev\/null/m.test(e)}function xn(e){let t=Qe(e);return t.length===0?!1:t.every(n=>n.startsWith("-")||n.startsWith(" "))&&t.some(n=>n.startsWith("-"))&&/^\+\+\+ \/dev\/null/m.test(e)}function Qe(e){let t=e.split(`
|
|
320
|
+
`,Je=!1;function ot(){if(Je||typeof document>"u")return;let e="dsh-git-panel/client.css";if(document.querySelector(`style[data-plugin-css="${e}"]`)!==null){Je=!0;return}let t=document.createElement("style");t.dataset.plugin="@xbzbing/dsh-git-panel",t.dataset.pluginCss=e,t.textContent=ln,document.head.appendChild(t),Je=!0}var st={"panel.tab":"Git","panel.fontDecrease":"\u7F29\u5C0F\u5B57\u4F53","panel.fontReset":"\u91CD\u7F6E\u5B57\u4F53\u5927\u5C0F","panel.fontIncrease":"\u653E\u5927\u5B57\u4F53","tab.overview":"Git \u603B\u89C8","tab.changes":"\u53D8\u66F4\u8BB0\u5F55","tab.files":"\u6587\u4EF6\u6D4F\u89C8","pill.unavailable":"Git \u4E0D\u53EF\u7528","pill.detached":"\u6E38\u79BB HEAD","pill.synced":"\u672C\u5730\u5DF2\u540C\u6B65","pill.dirty":"\u6709\u5F85\u63D0\u4EA4\u7684\u53D8\u66F4","common.loading":"\u52A0\u8F7D\u4E2D\u2026","common.retry":"\u91CD\u8BD5","common.close":"\u5173\u95ED","version.check":"\u68C0\u67E5\u65B0\u7248\u672C","version.checking":"\u68C0\u67E5\u4E2D\u2026","version.upToDate":"\u5DF2\u662F\u6700\u65B0\uFF08{current}\uFF09","version.updateAvailable":"\u6709\u65B0\u7248\u672C {latest}\uFF08\u5F53\u524D {current}\uFF09","version.viewRelease":"\u67E5\u770B\u53D1\u5E03","version.error":"\u68C0\u67E5\u5931\u8D25","version.noRepo":"\u672A\u914D\u7F6E\u4ED3\u5E93\u5730\u5740","version.openRepo":"\u5728 GitHub \u4E0A\u6253\u5F00\u4ED3\u5E93","overview.head":"HEAD\uFF08\u5F53\u524D\u5206\u652F\uFF09","overview.local":"\u672C\u5730","overview.remote":"\u8FDC\u7A0B","overview.tags":"\u6807\u7B7E","overview.search":"\u641C\u7D22\u63D0\u4EA4\uFF08\u6D88\u606F / \u54C8\u5E0C\uFF09","overview.searchShort":"\u641C\u7D22\u63D0\u4EA4","overview.allUsers":"\u5168\u90E8\u4F5C\u8005","overview.allTime":"\u5168\u90E8\u65F6\u95F4","overview.today":"\u4ECA\u5929","overview.last7d":"\u8FD1 7 \u5929","overview.last30d":"\u8FD1 30 \u5929","overview.selectCommit":"\u9009\u62E9\u4E00\u4E2A\u63D0\u4EA4\u67E5\u770B\u8BE6\u60C5","overview.noMessage":"\uFF08\u65E0\u63D0\u4EA4\u6B63\u6587\uFF09","overview.noResults":"\u6CA1\u6709\u5339\u914D\u7684\u63D0\u4EA4","overview.loadFailed":"\u52A0\u8F7D\u5931\u8D25","overview.detailFailed":"\u8BE6\u60C5\u52A0\u8F7D\u5931\u8D25","overview.diffFailed":"\u5DEE\u5F02\u52A0\u8F7D\u5931\u8D25","overview.openFileDiff":"\u67E5\u770B\u8BE5\u6587\u4EF6\u5728\u6B64\u63D0\u4EA4\u4E2D\u7684\u53D8\u66F4","overview.fetch":"\u62C9\u53D6\u8FDC\u7A0B","overview.branchesError":"\u5206\u652F\u52A0\u8F7D\u5931\u8D25","changes.groupStaged":"\u5DF2\u6682\u5B58\u7684\u66F4\u6539","changes.groupUnstaged":"\u66F4\u6539","changes.groupUntracked":"\u672A\u7248\u672C\u63A7\u5236\u7684\u6587\u4EF6","changes.selectFile":"\u9009\u62E9\u4E00\u4E2A\u6587\u4EF6\u67E5\u770B\u53D8\u66F4","changes.noChanges":"\u6CA1\u6709\u672A\u63D0\u4EA4\u7684\u53D8\u66F4","changes.stageAll":"\u5168\u90E8\u6682\u5B58","changes.unstageAll":"\u5168\u90E8\u53D6\u6D88\u6682\u5B58","changes.stage":"\u6682\u5B58","changes.unstage":"\u53D6\u6D88\u6682\u5B58","changes.discard":"\u653E\u5F03\u66F4\u6539","changes.discardConfirm":"\u518D\u6B21\u70B9\u51FB\u4EE5\u786E\u8BA4\u653E\u5F03","files.selectFile":"\u9009\u62E9\u4E00\u4E2A\u6587\u4EF6\u67E5\u770B\u5185\u5BB9","files.loadFailed":"\u52A0\u8F7D\u5931\u8D25","files.truncated":"\u6761\u76EE\u8FC7\u591A\uFF0C\u5DF2\u622A\u65AD","files.tooLarge":"\u6587\u4EF6\u8FC7\u5927\uFF0C\u65E0\u6CD5\u9884\u89C8","files.binary":"\u4E8C\u8FDB\u5236\u6587\u4EF6\uFF0C\u65E0\u6CD5\u9884\u89C8","files.previewMode":"Markdown \u9884\u89C8\u65B9\u5F0F","files.source":"\u6E90\u7801","files.render":"\u6E32\u67D3","files.copyPath":"\u590D\u5236\u76F8\u5BF9\u8DEF\u5F84","files.pathCopied":"\u8DEF\u5F84\u5DF2\u590D\u5236","files.pathCopyFailed":"\u590D\u5236\u5931\u8D25","files.ignored":"\u5DF2\u88AB Git \u5FFD\u7565","files.copy":"\u590D\u5236\u4EE3\u7801","files.copied":"\u5DF2\u590D\u5236","files.footnotes":"\u6CE8\u91CA","stats.files":"{n} \u4E2A\u6587\u4EF6","stats.lastChange":"\u6700\u8FD1\u53D8\u66F4 {time}","stats.lastCommit":"\u4E0A\u6B21\u63D0\u4EA4 {time}","stats.staged":"\u5DF2\u6682\u5B58 {n}","stats.modified":"\u5DF2\u4FEE\u6539 {n}","stats.untracked":"\u672A\u8DDF\u8E2A {n}","commit.placeholder":"\u63D0\u4EA4\u4FE1\u606F","commit.commit":"\u63D0\u4EA4","commit.amend":"\u4FEE\u6B63\u4E0A\u6B21\u63D0\u4EA4\uFF08amend\uFF09","diff.unified":"\u7EDF\u4E00","diff.split":"\u5BF9\u7167","diff.before":"\u53D8\u66F4\u524D","diff.after":"\u53D8\u66F4\u540E","diff.binary":"\u4E8C\u8FDB\u5236\u6587\u4EF6\uFF0C\u65E0\u6CD5\u663E\u793A\u5BF9\u7167","diff.tooLarge":"\u56FE\u7247\u8FC7\u5927\uFF0C\u65E0\u6CD5\u663E\u793A\u5BF9\u7167","diff.imageMissing":"\u4E0D\u5B58\u5728","diff.svgRender":"\u6E32\u67D3","diff.svgSource":"\u6E90\u7801","diff.empty":"\u65E0\u5DEE\u5F02","diff.expandAll":"\u5C55\u5F00\u5168\u90E8","diff.collapse":"\u6298\u53E0\u672A\u53D8\u66F4","diff.expandGap":"\u5C55\u5F00\u5168\u90E8 {n} \u884C","diff.expandUp":"\u5411\u4E0A\u5C55\u5F00 {n} \u884C","diff.expandDown":"\u5411\u4E0B\u5C55\u5F00 {n} \u884C","time.justNow":"\u521A\u521A","time.minutesAgo":"{n} \u5206\u949F\u524D","time.hoursAgo":"{n} \u5C0F\u65F6\u524D","time.daysAgo":"{n} \u5929\u524D","error.generic":"\u64CD\u4F5C\u5931\u8D25","error.notARepo":"\u5F53\u524D\u76EE\u5F55\u4E0D\u662F Git \u4ED3\u5E93","error.noCwd":"\u5F53\u524D\u4F1A\u8BDD\u65E0\u5DE5\u4F5C\u76EE\u5F55","error.localChangesBlock":"\u672C\u5730\u6709\u672A\u63D0\u4EA4\u53D8\u66F4\uFF0C\u65E0\u6CD5\u5207\u6362","error.emptyMessage":"\u63D0\u4EA4\u4FE1\u606F\u4E0D\u80FD\u4E3A\u7A7A","cfg.title":"\u8F93\u5165\u6846\u5206\u652F\u6807\u8BB0","cfg.toggle":"\u663E\u793A\u8F93\u5165\u6846\u6807\u8BB0","cfg.hint":"\u5F00\u542F\u65F6\u5728\u8F93\u5165\u6846\u663E\u793A zsh \u98CE\u683C\u7684 <\u4ED3\u5E93\u540D> (\u5206\u652F) \u6807\u8BB0\uFF1B\u5173\u95ED\u540E\u6539\u4E3A\u5728 Git \u6807\u7B7E\u65C1\u663E\u793A\u72B6\u6001\u5706\u70B9\u3002\u4FDD\u5B58\u540E\u7ACB\u5373\u751F\u6548\u3002","cfg.diffTitle":"\u5DEE\u5F02\u5BF9\u6BD4\u9ED8\u8BA4\u89C6\u56FE","cfg.diffHint":"\u9009\u62E9\u53D8\u66F4\u5BF9\u6BD4\u9ED8\u8BA4\u6253\u5F00\u7684\u5E03\u5C40\uFF1A\u7EDF\u4E00\u89C6\u56FE\u4E3A\u5355\u680F\u884C\u5185\u5BF9\u6BD4\uFF0C\u5E76\u6392\u89C6\u56FE\u4E3A\u5DE6\u53F3\u5206\u680F\u5BF9\u6BD4\u3002\u4ECD\u53EF\u5728\u6BCF\u4E2A\u5DEE\u5F02\u89C6\u56FE\u4E2D\u4E34\u65F6\u5207\u6362\u3002\u4FDD\u5B58\u540E\u7ACB\u5373\u751F\u6548\u3002","cfg.diffUnified":"\u7EDF\u4E00\u89C6\u56FE\uFF08\u5355\u680F\u884C\u5185\uFF09","cfg.diffSplit":"\u5E76\u6392\u89C6\u56FE\uFF08\u5DE6\u53F3\u5206\u680F\uFF09","cfg.notLoaded":"\u914D\u7F6E\u672A\u52A0\u8F7D\uFF1A\u8BE5\u914D\u7F6E\u7531\u8FD0\u884C\u4E2D\u7684\u5BBF\u4E3B\u63D0\u4F9B\uFF0C\u82E5\u957F\u65F6\u95F4\u7A7A\u767D\u8BF7\u91CD\u542F DSH \u540E\u91CD\u8BD5\u3002","cfg.saveFailed":"\u4FDD\u5B58\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"},lt={"panel.tab":"Git","panel.fontDecrease":"Decrease font size","panel.fontReset":"Reset font size","panel.fontIncrease":"Increase font size","tab.overview":"Overview","tab.changes":"Changes","tab.files":"Files","pill.unavailable":"Git unavailable","pill.detached":"detached HEAD","pill.synced":"Everything committed","pill.dirty":"Uncommitted changes","common.loading":"Loading\u2026","common.retry":"Retry","common.close":"Close","version.check":"Check for updates","version.checking":"Checking\u2026","version.upToDate":"Up to date ({current})","version.updateAvailable":"New version {latest} available (current {current})","version.viewRelease":"View release","version.error":"Check failed","version.noRepo":"Repository not configured","version.openRepo":"Open repository on GitHub","overview.head":"HEAD (Current Branch)","overview.local":"Local","overview.remote":"Remote","overview.tags":"Tags","overview.search":"Search commits (message / hash)","overview.searchShort":"Search","overview.allUsers":"All authors","overview.allTime":"All time","overview.today":"Today","overview.last7d":"Last 7 days","overview.last30d":"Last 30 days","overview.selectCommit":"Select a commit to see details","overview.noMessage":"(no commit body)","overview.noResults":"No matching commits","overview.loadFailed":"Load failed","overview.detailFailed":"Failed to load details","overview.diffFailed":"Failed to load diff","overview.openFileDiff":"View this file\u2019s changes in this commit","overview.fetch":"Fetch","overview.branchesError":"Failed to load branches","changes.groupStaged":"Staged changes","changes.groupUnstaged":"Changes","changes.groupUntracked":"Unversioned files","changes.selectFile":"Select a file to see its diff","changes.noChanges":"No uncommitted changes","changes.stageAll":"Stage all","changes.unstageAll":"Unstage all","changes.stage":"Stage","changes.unstage":"Unstage","changes.discard":"Discard changes","changes.discardConfirm":"Click again to confirm discard","files.selectFile":"Select a file to preview","files.loadFailed":"Load failed","files.truncated":"Too many entries \u2014 truncated","files.tooLarge":"File too large to preview","files.binary":"Binary file \u2014 no preview","files.previewMode":"Markdown preview mode","files.source":"Source","files.render":"Rendered","files.copyPath":"Copy relative path","files.pathCopied":"Path copied","files.pathCopyFailed":"Copy failed","files.ignored":"Ignored by Git","files.copy":"Copy code","files.copied":"Copied","files.footnotes":"Footnotes","stats.files":"{n} files","stats.lastChange":"changed {time}","stats.lastCommit":"last commit {time}","stats.staged":"{n} staged","stats.modified":"{n} modified","stats.untracked":"{n} untracked","commit.placeholder":"Commit message","commit.commit":"Commit","commit.amend":"Amend previous commit","diff.unified":"Unified","diff.split":"Split","diff.before":"Before","diff.after":"After","diff.binary":"Binary file \u2014 no diff to show","diff.tooLarge":"Image too large to compare","diff.imageMissing":"Does not exist","diff.svgRender":"Rendered","diff.svgSource":"Source","diff.empty":"No differences","diff.expandAll":"Expand all","diff.collapse":"Collapse unchanged","diff.expandGap":"Expand all {n} lines","diff.expandUp":"Expand up {n} lines","diff.expandDown":"Expand down {n} lines","time.justNow":"just now","time.minutesAgo":"{n}m ago","time.hoursAgo":"{n}h ago","time.daysAgo":"{n}d ago","error.generic":"Operation failed","error.notARepo":"Not a Git repository","error.noCwd":"This session has no working directory","error.localChangesBlock":"Local changes block the checkout","error.emptyMessage":"Commit message cannot be empty","cfg.title":"Input-bar branch marker","cfg.toggle":"Show input-bar marker","cfg.hint":"When on, the input bar shows the zsh-style <repo> (branch) marker; when off, a status dot appears beside the Git tab instead. Saved changes apply immediately.","cfg.diffTitle":"Default diff view","cfg.diffHint":"Choose the layout diffs open with: unified is a single inline column, split is side-by-side. You can still switch per diff. Saved changes apply immediately.","cfg.diffUnified":"Unified (single inline column)","cfg.diffSplit":"Split (side-by-side)","cfg.notLoaded":"Config not loaded: it is served by the running host. Restart DSH if this stays blank.","cfg.saveFailed":"Save failed, please retry"};var Te=require("react");var dn=new Set(["cwd-unavailable"]),Ke=3e4,cn=6e4,Ne=class{constructor(t,n){this.remote=t;this.sessionId=n}view={state:"cold"};listeners=new Set;timer;inflight;pendingRefresh=!1;disposed=!1;pollMs=Ke;subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}getSnapshot(){return this.view}ensure(){this.view.state!=="cold"&&this.view.state!=="no-cwd"||this.refresh()}refresh(){return this.inflight!==void 0?(this.pendingRefresh=!0,this.inflight):this.disposed?Promise.resolve():(this.view.state==="cold"&&this.setView({state:"loading"}),this.inflight=this.remote.snapshot({sessionId:this.sessionId}).then(t=>{if(!this.disposed){if(t.ok)this.pollMs=t.value.refreshIntervalMs||Ke,this.setView({state:"ready",snapshot:t.value});else if(t.error.code!=="cancelled")if(dn.has(t.error.code))this.pollMs=cn,this.setView({state:"no-cwd"});else if(t.error.code==="not-a-git-repo"){let n=t.error;this.setView({state:"error",error:{code:"not-a-git-repo",...n.cwd?{cwd:n.cwd}:{},...n.showInputPill!==void 0?{showInputPill:n.showInputPill}:{}}})}else this.setView({state:"error",error:{code:t.error.code,..."detail"in t.error?{detail:t.error.detail}:{}}})}}).catch(t=>{this.disposed||this.setView({state:"error",error:{code:"git-unavailable",detail:t instanceof Error?t.message:String(t)}})}).finally(()=>{this.inflight=void 0,this.pendingRefresh&&!this.disposed?(this.pendingRefresh=!1,this.refresh()):this.schedulePoll()}),this.inflight)}resync(){this.disposed||this.refresh()}accept(t){this.disposed||(this.pollMs=t.refreshIntervalMs||Ke,this.setView({state:"ready",snapshot:t}),this.schedulePoll())}schedulePoll(){this.disposed||(this.timer!==void 0&&clearTimeout(this.timer),!(this.pollMs<=0)&&(this.timer=setTimeout(()=>{this.refresh()},this.pollMs)))}setView(t){this.view=t;for(let n of this.listeners)n()}dispose(){this.disposed=!0,this.timer!==void 0&&clearTimeout(this.timer),this.timer=void 0,this.listeners.clear()}};var pn="/api",fn="gitPanel";function gn(e){try{let t=e.get("connection")?.rpc,n=t?.call;if(t!==void 0&&typeof n=="function")return(i,r,a)=>n.call(t,pn,i,r,a)}catch{}}function un(e){let t=e;if(t===null||typeof t!="object")return{ok:!1,error:{code:"git-unavailable",message:"malformed rpc result"}};if(t.ok!==!0){let n=t.error;return{ok:!1,error:{code:typeof n?.code=="string"?n.code:"git-unavailable",message:typeof n?.message=="string"?n.message:void 0}}}return t.value===void 0?{ok:!1,error:{code:"git-unavailable",message:"missing value"}}:t.value}function q(e,t){return!e.ok||e.value.kind!==t?null:e.value}function re(e){return e!==void 0&&e!==""}var dt=new WeakMap;function we(e){let t=dt.get(e);if(t!==void 0)return t;let n=async(r,a,s)=>{let o=gn(e);if(o===void 0)return{ok:!1,error:{code:"git-unavailable",message:"no connection"}};try{let l=await o(`${fn}/${r}`,{args:{request:a}},s);return un(l)}catch(l){return{ok:!1,error:{code:"git-unavailable",message:l instanceof Error?l.message:String(l)}}}},i={snapshot:(r,a)=>n("snapshot",r,a),run:(r,a)=>n("run",r,a),query:(r,a)=>n("query",r,a),version:(r,a)=>n("version",r,a)};return dt.set(e,i),i}var oe=new Map,ct,Be;function pt(e){Be=e,ct=we(e)}function We(e){let t=oe.get(e);if(t===void 0){let n=ct??(Be?we(Be):void 0);t=new Ne(n??bn(),e),oe.set(e,t)}return t}var mn=6e4,Ge=new Map;function hn(e){let t=Ge.get(e);t!==void 0&&(clearTimeout(t),Ge.delete(e)),fe.set(e,(fe.get(e)??0)+1)}function yn(e){let t=(fe.get(e)??1)-1;if(t>0){fe.set(e,t);return}fe.delete(e);let n=setTimeout(()=>{Ge.delete(e),!((fe.get(e)??0)>0)&&(oe.get(e)?.dispose(),oe.delete(e))},mn);Ge.set(e,n)}var fe=new Map;function xe(){for(let e of oe.values())e.resync()}function ft(){for(let e of oe.values())e.dispose();oe.clear()}function bn(){let e=async()=>({ok:!1,error:{code:"git-unavailable"}});return{snapshot:e,run:e,query:e,version:e}}function Re(e){let[,t]=(0,Te.useState)(0),n=e?We(e):void 0;return(0,Te.useEffect)(()=>{if(n===void 0||e===void 0)return;hn(e);let i=n.subscribe(()=>t(r=>r+1));return n.ensure(),()=>{i(),yn(e)}},[n,e]),n?n.getSnapshot():{state:"cold"}}var _=require("react");var gt="[data-conversation-tabs]",_e='[data-conversation-tabs] button[role="tab"]',Oe=new Map,ke=new Map;function ut(e,t){let n=ke.get(e);if(n!==void 0&&n.size>0){for(let i of n)i(t);return}Oe.set(e,t)}function mt(e){let t=Oe.get(e);return t===void 0?null:(Oe.delete(e),t)}function ht(e,t){let n=ke.get(e);return n===void 0&&(n=new Set,ke.set(e,n)),n.add(t),()=>{let i=ke.get(e);i!==void 0&&(i.delete(t),i.size===0&&ke.delete(e))}}function yt(e){if(typeof document>"u")return!1;let t=document.querySelectorAll(_e);for(let n of t)if((n.textContent??"").trim()===e)return n.getAttribute("aria-selected")!=="true"&&n.click(),!0;return!1}function bt(e){if(typeof document>"u")return!1;let t=document.querySelectorAll(_e);for(let n of t)if((n.textContent??"").trim()===e)return n.getAttribute("aria-selected")==="true";return!1}function vt(e){if(typeof document>"u")return!1;let t=document.querySelectorAll(_e);for(let n of t)if((n.textContent??"").trim()!==e)return n.getAttribute("aria-selected")!=="true"&&n.click(),!0;return!1}var d=require("react"),Ze=require("react-dom");var P=require("react");function Z(e,t=15){return(0,P.createElement)("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"},e)}function Ee({size:e}){return Z([(0,P.createElement)("circle",{key:"c",cx:8,cy:8,r:2.4}),(0,P.createElement)("line",{key:"l1",x1:8,y1:1.5,x2:8,y2:5.6}),(0,P.createElement)("line",{key:"l2",x1:8,y1:10.4,x2:8,y2:14.5})],e)}function wt({size:e}){return Z([(0,P.createElement)("path",{key:"a",d:"M4 2v8"}),(0,P.createElement)("path",{key:"b",d:"M2 4h4"}),(0,P.createElement)("circle",{key:"c",cx:4,cy:12,r:1.6}),(0,P.createElement)("circle",{key:"d",cx:12,cy:4,r:1.6}),(0,P.createElement)("path",{key:"e",d:"M12 6v4"}),(0,P.createElement)("path",{key:"f",d:"M10 12h4"})],e)}function je({size:e}){return Z([(0,P.createElement)("circle",{key:"a",cx:4,cy:3,r:1.6}),(0,P.createElement)("circle",{key:"b",cx:4,cy:13,r:1.6}),(0,P.createElement)("circle",{key:"c",cx:12,cy:5,r:1.6}),(0,P.createElement)("path",{key:"d",d:"M4 4.6v6.8"}),(0,P.createElement)("path",{key:"e",d:"M12 6.6c0 3-4 2.4-8 4"})],e)}function xt({size:e}){return Z([(0,P.createElement)("path",{key:"a",d:"M2 7V3h4l8 8-4 4z"}),(0,P.createElement)("circle",{key:"b",cx:4.5,cy:5.5,r:.8,fill:"currentColor"})],e)}function se({size:e,open:t}){return Z([(0,P.createElement)("path",{key:"a",d:t?"M3 6l5 5 5-5":"M6 3l5 5-5 5"})],e)}function kt({size:e}){return Z([(0,P.createElement)("path",{key:"a",d:"M4 4l8 8M12 4l-8 8"})],e)}function De({size:e}){return Z([(0,P.createElement)("path",{key:"a",d:"M13 8a5 5 0 1 1-1.5-3.5"}),(0,P.createElement)("path",{key:"b",d:"M13 2v3h-3"})],e)}function _t({size:e}){return Z([(0,P.createElement)("path",{key:"a",d:"M4 2h5l3 3v9H4z"}),(0,P.createElement)("path",{key:"b",d:"M9 2v3h3"})],e)}function St({size:e}){return Z([(0,P.createElement)("path",{key:"a",d:"M5 2.5h4l2.5 2.5v7.5h-6.5z"}),(0,P.createElement)("path",{key:"b",d:"M9 2.5V5h2.5"}),(0,P.createElement)("path",{key:"c",d:"M11 12.5v1.5h-6.5V6"})],e)}function Ct({size:e=15}){return(0,P.createElement)("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"currentColor"},(0,P.createElement)("path",{"fill-rule":"evenodd",d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z"}))}function Nt(e){let t=0;for(let n of e){t=Math.max(t,n.lane+1);for(let i of n.edges)t=Math.max(t,i.fromLane+1,i.toLane+1)}return t}function Gt(e){let t=[],n=[],i=new Map,r=0,a=s=>{let o=i.get(s);return o===void 0&&(o=r++,i.set(s,o)),o};for(let s of e){let o=b=>{let v=n.findIndex(R=>R===b);return v===-1&&(v=n.findIndex(R=>R===null),v===-1&&(v=n.length,n.push(null)),n[v]=b),v},l=o(s.hash),c=a(s.hash),f=[...n],p=s.parents,h=p.length>=2;for(let b=0;b<n.length;b++)b!==l&&n[b]===s.hash&&(n[b]=null);if(p.length===0)n[l]=null;else{n[l]=p[0],a(p[0]);for(let b=1;b<p.length;b++){let v=p[b];o(v),a(v)}}let u=[],x=n;for(let b=0;b<f.length;b++){let v=f[b];if(v!==null)if(v===s.hash)u.push({fromLane:b,toLane:l,color:a(s.hash)});else{let R=x.findIndex(m=>m===v);R!==-1&&u.push({fromLane:b,toLane:R,color:a(v)})}}for(let b of p){let v=x.findIndex(R=>R===b);v!==-1&&u.push({fromLane:l,toLane:v,color:a(b)})}for(t.push({commit:s,lane:l,color:c,edges:u,merge:h});n.length>0&&n[n.length-1]===null;)n=n.slice(0,-1)}return t}function Tt(e){let t={name:"",path:"",dir:!0,children:[]};for(let n of e){let i=n.path.split("/").filter(s=>s!==""),r=t,a="";for(let s=0;s<i.length;s++){let o=i[s];a=a===""?o:`${a}/${o}`;let l=s===i.length-1,c=r.children.find(f=>f.name===o&&f.dir===!l);c===void 0&&(c={name:o,path:a,dir:!l,children:[],...l?{meta:n.meta}:{}},r.children.push(c)),r=c}}return Rt(t),Et(t.children)}function Rt(e){e.children.sort((t,n)=>t.dir!==n.dir?t.dir?-1:1:t.name.localeCompare(n.name));for(let t of e.children)Rt(t)}function Et(e){return e.map(t=>{if(!t.dir)return t;let n=t;for(;n.children.length===1&&n.children[0].dir;){let i=n.children[0];n={name:`${n.name}/${i.name}`,path:i.path,dir:!0,children:i.children}}return{...n,children:Et(n.children)}})}function ge(e,t,n){if(e===null)return"";let i=typeof e=="number"?e:Date.parse(e);if(!Number.isFinite(i))return"";let r=Math.max(0,t-i),a=Math.floor(r/6e4);if(a<1)return n("time.justNow");if(a<60)return n("time.minutesAgo",{n:a});let s=Math.floor(a/60);if(s<24)return n("time.hoursAgo",{n:s});let o=Math.floor(s/24);return n("time.daysAgo",{n:o})}function ue(e){if(e===null)return"";let t=new Date(typeof e=="number"?e:Date.parse(e));if(Number.isNaN(t.getTime()))return"";let n=i=>String(i).padStart(2,"0");return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}var Me={added:"A",modified:"M",deleted:"D",renamed:"R",untracked:"U",conflicted:"!",typechange:"T"};function Pe(e){return e==="added"||e==="untracked"?"gp-status--added":e==="deleted"?"gp-status--deleted":e==="renamed"?"gp-status--renamed":"gp-status--modified"}var S=require("react");var vn={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",avif:"image/avif",bmp:"image/bmp",svg:"image/svg+xml",ico:"image/x-icon",tif:"image/tiff",tiff:"image/tiff"};function Ue(e){let t=e.lastIndexOf(".");return t<0?null:vn[e.slice(t+1).toLowerCase()]??null}function Dt(e){return/^Binary files .* differ$/m.test(e)||/^GIT binary patch$/m.test(e)}function Mt(e){return Ue(e)!==null}function Pt(e){return/\.svg$/i.test(e)}function wn(e){let t=Qe(e);return t.length===0?!1:t.every(n=>n.startsWith("+")||n.startsWith(" "))&&t.some(n=>n.startsWith("+"))&&/^\+\+\+ /m.test(e)&&/--- \/dev\/null/m.test(e)}function xn(e){let t=Qe(e);return t.length===0?!1:t.every(n=>n.startsWith("-")||n.startsWith(" "))&&t.some(n=>n.startsWith("-"))&&/^\+\+\+ \/dev\/null/m.test(e)}function Qe(e){let t=e.split(`
|
|
314
321
|
`),n=[],i=!1;for(let r of t){if(r.startsWith("@@")){i=!0;continue}if(i){if(r.startsWith("diff ")||r.startsWith("index ")){i=!1;continue}r!==""&&n.push(r)}}return n}function Ft(e){let t=0,n=0;for(let i of Qe(e))i.startsWith("+")?t++:i.startsWith("-")&&n++;return{add:t,del:n}}var kn=/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/;function Lt(e){let t=[],n=e.split(`
|
|
315
|
-
`),i=0,r=0,a=!0,s=!1,o=0;for(;o<n.length&&!n[o].startsWith("@@");o++);for(;o<n.length;o++){let l=n[o];if(l.startsWith("@@")){let p=kn.exec(l);if(p){let y=Number(p[1]),h=Number(p[3]),v=y-h;if(a)h>1&&t.push(me({rightStart:1,count:h-1,delta:v,atStart:!0,atEnd:!1}));else{let f=h-r;f>0&&t.push(me({rightStart:r,count:f,delta:v,atStart:!1,atEnd:!1}))}i=y,r=h,a=!1}t.push({kind:"hunk",leftNo:null,rightNo:null,leftText:null,rightText:null,text:l});continue}if(l.startsWith("\\"))continue;let c=l[0],g=l.slice(1);c==="+"?(t.push({kind:"add",leftNo:null,rightNo:r,leftText:null,rightText:g}),r++,s=!0):c==="-"?(t.push({kind:"del",leftNo:i,rightNo:null,leftText:g,rightText:null}),i++,s=!0):c===" "&&(t.push({kind:"context",leftNo:i,rightNo:r,leftText:g,rightText:g}),i++,r++,s=!0)}return s&&!a&&!wn(e)&&!xn(e)&&t.push(me({rightStart:r,count:null,delta:i-r,atStart:!1,atEnd:!0})),_n(t)}function me(e){return{kind:"gap",leftNo:null,rightNo:null,leftText:null,rightText:null,gap:e}}function _n(e){let t=[],n=0;for(;n<e.length;){let i=e[n];if(i.kind==="del"){let r=[],a=n;for(;a<e.length&&e[a].kind==="del";)r.push(e[a]),a++;let s=[];for(;a<e.length&&e[a].kind==="add";)s.push(e[a]),a++;let o=Math.max(r.length,s.length);for(let l=0;l<o;l++){let c=r[l],g=s[l];if(c&&g){let p=Sn(c.leftText??"",g.rightText??"");t.push({kind:"mod",leftNo:c.leftNo,rightNo:g.rightNo,leftText:c.leftText,rightText:g.rightText,...p!==null?{leftWord:p.left,rightWord:p.right}:{}})}else c?t.push({kind:"del",leftNo:c.leftNo,rightNo:null,leftText:c.leftText,rightText:null}):g&&t.push({kind:"add",leftNo:null,rightNo:g.rightNo,leftText:null,rightText:g.rightText})}n=a}else t.push(i),n++}return t}function Sn(e,t){let n=Math.min(e.length,t.length),i=0;for(;i<n&&e[i]===t[i];)i++;let r=0;for(;r<n-i&&e[e.length-1-r]===t[t.length-1-r];)r++;return i===0&&r===0?null:{left:[i,e.length-r],right:[i,t.length-r]}}function Cn(e,t,n){return n.map((i,r)=>{let a=t+r;return{kind:"context",leftNo:a+e,rightNo:a,leftText:i,rightText:i}})}var Z=20;function At(e){let t=[];for(let n of e)n.kind==="mod"?(t.push({kind:"del",leftNo:n.leftNo,rightNo:null,leftText:n.leftText,rightText:null,...n.leftWord!==void 0?{leftWord:n.leftWord}:{}}),t.push({kind:"add",leftNo:null,rightNo:n.rightNo,leftText:null,rightText:n.rightText,...n.rightWord!==void 0?{rightWord:n.rightWord}:{}})):t.push(n);return t}function zt(e,t,n,i,r,a){let s=e.findIndex(p=>p.kind==="gap"&&p.gap?.rightStart===t);if(s<0)return e.slice();let o=e[s].gap,l=Cn(o.delta,i,r),c=[];if(o.atEnd)return c.push(...l),!a&&r.length>0&&c.push(me({rightStart:i+r.length,count:null,delta:o.delta,atStart:!1,atEnd:!0})),[...e.slice(0,s),...c,...e.slice(s+1)];let g=o.count??r.length;if(n==="all"||r.length>=g)c.push(...l);else if(n==="down"){c.push(...l);let p=g-r.length;c.push(me({rightStart:o.rightStart+r.length,count:p,delta:o.delta,atStart:!1,atEnd:!1}))}else{let p=g-r.length;c.push(me({rightStart:o.rightStart,count:p,delta:o.delta,atStart:o.atStart,atEnd:!1})),c.push(...l)}return[...e.slice(0,s),...c,...e.slice(s+1)]}var ze=require("@deepseek-ai/dsh-client-ui-primitives");function $t(e,t){let n=[[],[],[]],i=0;for(let r of e){let a=i+r.text.length,s=[i,Math.max(i,Math.min(a,t[0])),Math.max(i,Math.min(a,t[1])),a];for(let o=0;o<3;o++){let l=r.text.slice(s[o]-i,s[o+1]-i);l!==""&&n[o].push({text:l,style:r.style})}i=a}return n}var te=require("react");function Fe(e,t,n){let i=n(`diff.${e}`);return(0,te.createElement)("div",{className:`gp-imgcmp__pane gp-imgcmp__pane--${e}`},[(0,te.createElement)("div",{key:"head",className:"gp-imgcmp__head"},i),t===void 0?(0,te.createElement)("div",{key:"missing",className:"gp-imgcmp__missing"},n("diff.imageMissing")):(0,te.createElement)("div",{key:"img",className:"gp-imgcmp__img"},(0,te.createElement)("img",{src:t,alt:i}))])}function Ht({oldUrl:e,newUrl:t,mode:n,t:i}){return n==="before"?(0,te.createElement)("div",{className:"gp-imgcmp gp-imgcmp--single"},Fe("before",e,i)):n==="after"?(0,te.createElement)("div",{className:"gp-imgcmp gp-imgcmp--single"},Fe("after",t,i)):(0,te.createElement)("div",{className:"gp-imgcmp"},[Fe("before",e,i),Fe("after",t,i)])}var $e=(0,x.memo)(function({text:t,mode:n,path:i,remote:r,sessionId:a,imageSpec:s,t:o}){let l=(0,x.useMemo)(()=>Lt(t),[t]),c=Dt(t),g=(0,ze.useCodeHighlighter)(i===void 0?void 0:(0,ze.languageForPath)(i)),[p,y]=(0,x.useState)(l);(0,x.useEffect)(()=>{y(l)},[l]);let h=Nn(p,y,r,a,i,s),v=i!==void 0&&Pt(i),[f,m]=(0,x.useState)("render");(0,x.useEffect)(()=>{m("render")},[i]);let R=(c||v)&&i!==void 0&&Mt(i)&&r!==void 0&&a!==void 0&&s!==void 0&&(!v||f==="render"),w=Tn(R?r:void 0,R?a:void 0,R?i:void 0,R?s:void 0);if(R){let M=(()=>{if(w.kind==="idle"||w.kind==="loading")return(0,x.createElement)("div",{className:"gp-empty"},o("common.loading"));if(w.kind==="ready"){let E=w.res;if(E.tooLarge===!0)return(0,x.createElement)("div",{className:"gp-empty"},o("diff.tooLarge"));if(E.mime!==null&&(E.old!==void 0||E.new!==void 0))return(0,x.createElement)(Ht,{oldUrl:E.old,newUrl:E.new,mode:n,t:o})}return(0,x.createElement)("div",{className:"gp-empty"},o("diff.binary"))})();return v?Vt(f,m,M,o):M}if(c&&!v)return(0,x.createElement)("div",{className:"gp-empty"},o("diff.binary"));let A=(()=>{if(t.trim()==="")return(0,x.createElement)("div",{className:"gp-empty"},o("diff.empty"));if(n==="before")return Xt(Rn(p),g);if(n==="after")return Xt(En(p),g);if(n==="unified"){let M=At(p);return(0,x.createElement)("div",{className:"gp-diff__unified"},M.flatMap((E,N)=>Mn(E,N,g,h,o)))}return(0,x.createElement)("div",{className:"gp-diff__side"},p.flatMap((M,E)=>Dn(M,E,g,h,o)))})();return v?Vt(f,m,A,o):A});function Vt(e,t,n,i){let r=(a,s)=>(0,x.createElement)("button",{key:a,type:"button",className:`gp-seg__btn${e===a?" gp-seg__btn--active":""}`,"aria-pressed":e===a,onClick:()=>t(a)},s);return(0,x.createElement)("div",{className:"gp-svgdiff"},[(0,x.createElement)("div",{key:"bar",className:"gp-svgdiff__bar"},(0,x.createElement)("div",{className:"gp-seg"},[r("render",i("diff.svgRender")),r("source",i("diff.svgSource"))])),(0,x.createElement)("div",{key:"body",className:"gp-svgdiff__body"},n)])}function Nn(e,t,n,i,r,a){let[s,o]=(0,x.useState)(null),l=(0,x.useRef)(0);(0,x.useEffect)(()=>{l.current+=1,o(null)},[e]);let c=(0,x.useCallback)((g,p)=>{if(n===void 0||i===void 0||r===void 0||a===void 0)return;let y=`${g.rightStart}:${p}`;o(y);let h=++l.current,{start:v,end:f}=Gn(g,p),m=a.base==="commit"&&a.commit!==void 0?{kind:"file-lines",path:r,base:"commit",commit:a.commit,start:v,end:f}:a.base==="staged"?{kind:"file-lines",path:r,base:"staged",start:v,end:f}:{kind:"file-lines",path:r,base:"worktree",start:v,end:f};n.query({sessionId:i,query:m}).then(T=>{if(h!==l.current)return;let R=I(T,"file-lines");o(null),R!==null&&t(w=>zt(w,g.rightStart,p,R.start,R.lines,R.eof))}).catch(()=>{h===l.current&&o(null)})},[n,i,r,a,t]);return{busy:s,run:c}}function Gn(e,t){if(e.atEnd)return{start:e.rightStart,end:e.rightStart+Z-1};let n=e.count??Z;return t==="all"||n<=Z?{start:e.rightStart,end:e.rightStart+n-1}:t==="down"?{start:e.rightStart,end:e.rightStart+Z-1}:{start:e.rightStart+n-Z,end:e.rightStart+n-1}}function Tn(e,t,n,i){let[r,a]=(0,x.useState)({kind:"idle"}),s=i?.base,o=i?.commit;return(0,x.useEffect)(()=>{if(e===void 0||t===void 0||n===void 0||s===void 0)return;let l=!0;a({kind:"loading"});let c=s==="commit"&&o!==void 0?{kind:"image-diff",path:n,base:"commit",commit:o}:s==="staged"?{kind:"image-diff",path:n,base:"staged"}:{kind:"image-diff",path:n,base:"worktree"};return e.query({sessionId:t,query:c}).then(g=>{if(!l)return;let p=I(g,"image-diff");a(p!==null?{kind:"ready",res:p}:{kind:"failed"})}).catch(()=>{l&&a({kind:"failed"})}),()=>{l=!1}},[e,t,n,s,o]),r}function Le(e,t=""){return e.map((n,i)=>(0,x.createElement)("span",{key:`${t}${i}`,style:n.style},n.text))}function Ae(e,t,n,i){if(n==="")return(0,x.createElement)("div",{key:t,className:e},"\xA0");let r=i(n)?.[0];return(0,x.createElement)("div",{key:t,className:e},r===void 0?n:Le(r))}function Ye(e,t,n,i,r,a){let s=a(n)?.[0]??[{text:n,style:{}}],[o,l,c]=$t(s,i);return(0,x.createElement)("div",{key:t,className:e},[...Le(o,"p"),(0,x.createElement)("span",{key:"w",className:r},l.length===0?"\xA0":Le(l)),...Le(c,"s")])}function Rn(e){return e.filter(t=>t.leftText!==null).map(t=>({no:t.leftNo,text:t.leftText}))}function En(e){return e.filter(t=>t.rightText!==null).map(t=>({no:t.rightNo,text:t.rightText}))}function Xt(e,t){return(0,x.createElement)("div",{className:"gp-diff__single"},e.flatMap((n,i)=>[(0,x.createElement)("div",{key:`n${i}`,className:"gp-diff-no"},n.no??""),Ae("gp-diff-cell",`c${i}`,n.text,t)]))}function Dn(e,t,n,i,r){if(e.kind==="hunk")return[(0,x.createElement)("div",{key:`h${t}`,className:"gp-diff-row--hunk gp-diff-cell",style:{gridColumn:"1 / -1"}},e.text??"")];if(e.kind==="gap")return[It(e.gap,t,i,r)];let a=e.kind==="del"||e.kind==="mod"?"gp-diff-row--del":"",s=e.kind==="add"||e.kind==="mod"?"gp-diff-row--add":"",o=e.leftText===null?(0,x.createElement)("div",{key:`l${t}`,className:`gp-diff-cell ${a}`}):e.kind==="mod"&&e.leftWord!==void 0?Ye(`gp-diff-cell ${a}`,`l${t}`,e.leftText,e.leftWord,"gp-diff-word gp-diff-word--del",n):Ae(`gp-diff-cell ${a}`,`l${t}`,e.leftText,n),l=e.rightText===null?(0,x.createElement)("div",{key:`r${t}`,className:`gp-diff-cell ${s}`}):e.kind==="mod"&&e.rightWord!==void 0?Ye(`gp-diff-cell ${s}`,`r${t}`,e.rightText,e.rightWord,"gp-diff-word gp-diff-word--add",n):Ae(`gp-diff-cell ${s}`,`r${t}`,e.rightText,n);return[(0,x.createElement)("div",{key:`ln${t}`,className:"gp-diff-no"},e.leftNo??""),o,(0,x.createElement)("div",{key:`rn${t}`,className:"gp-diff-no"},e.rightNo??""),l]}function Mn(e,t,n,i,r){if(e.kind==="hunk")return[(0,x.createElement)("div",{key:`h${t}`,className:"gp-diff-row--hunk gp-diff-cell",style:{gridColumn:"1 / -1"}},e.text??"")];if(e.kind==="gap")return[It(e.gap,t,i,r)];let a=e.kind==="del",s=e.kind==="add",o=s?"gp-diff-row--add":a?"gp-diff-row--del":"",l=s?"+":a?"\u2212":"\xA0",c=e.rightText??e.leftText??"",g=s?e.rightWord:a?e.leftWord:void 0,p=s?"gp-diff-word gp-diff-word--add":"gp-diff-word gp-diff-word--del",y=`gp-diff-cell gp-diff-uni__code ${o}`,h=g!==void 0?Ye(y,`c${t}`,c,g,p,n):Ae(y,`c${t}`,c,n);return[(0,x.createElement)("div",{key:`ol${t}`,className:"gp-diff-no"},e.leftNo??""),(0,x.createElement)("div",{key:`nl${t}`,className:"gp-diff-no"},e.rightNo??""),(0,x.createElement)("div",{key:`sg${t}`,className:`gp-diff-uni__sign ${o}`},l),h]}function It(e,t,n,i){let r=n.busy===`${e.rightStart}:all`,a=n.busy===`${e.rightStart}:up`,s=n.busy===`${e.rightStart}:down`,o=(c,g,p)=>(0,x.createElement)("button",{key:c,type:"button",className:"gp-gap__btn",disabled:n.busy!==null,onClick:y=>{y.stopPropagation(),n.run(e,c)}},p?i("common.loading"):g),l=[];if(e.atEnd)l.push(o("down",i("diff.expandDown",{n:Z}),s));else{let c=e.count??0;c>0&&c<=Z?l.push(o("all",i("diff.expandGap",{n:c}),r)):(e.atStart||l.push(o("up",i("diff.expandUp",{n:Z}),a)),l.push(o("all",i("diff.expandGap",{n:c}),r)),l.push(o("down",i("diff.expandDown",{n:Z}),s)))}return(0,x.createElement)("div",{key:`g${t}`,className:"gp-diff-row--gap",style:{gridColumn:"1 / -1"}},l)}function He(e){return Ft(e)}var C=require("react");var Pn=100;function qt(e,t,n){let[i,r]=(0,C.useState)(null),[a,s]=(0,C.useState)(!1),[o,l]=(0,C.useState)([]),c=(0,C.useCallback)(()=>{s(!1),(async()=>{let[g,p]=await Promise.all([e.query({sessionId:t,query:{kind:"branches"}}),e.query({sessionId:t,query:{kind:"tags"}})]),y=I(g,"branches");if(y===null){s(!0);return}let h=I(p,"tags");r({current:y.current,defaultBranch:y.defaultBranch,local:y.local,remote:y.remote,tags:h?.tags??[]}),e.query({sessionId:t,query:{kind:"authors"}}).then(v=>{l(I(v,"authors")?.authors??[])})})()},[e,t]);return(0,C.useEffect)(()=>{c()},[n]),{tree:i,treeError:a,authors:o,reload:c}}function Jt(e,t,n,i,r){let[a,s]=(0,C.useState)([]),[o,l]=(0,C.useState)(0),[c,g]=(0,C.useState)(!1),[p,y]=(0,C.useState)(!1),h=(0,C.useRef)(0),v=(0,C.useRef)(!1),f=(0,C.useRef)(null),m=(0,C.useCallback)(async(A,M)=>{if(v.current)return;v.current=!0;let E=h.current;g(!0),y(!1);let N=await e.query({sessionId:t,query:{kind:"history",limit:Pn,skip:A,...M.ref?{ref:M.ref}:{},...M.search?{search:M.search}:{},...M.author?{author:M.author}:{},...M.since?{since:M.since}:{}}});if(v.current=!1,E!==h.current)return;g(!1);let z=I(N,"history");if(z===null){y(!0);return}let _=z.commits;s($=>A===0?_:[...$,..._]),l(z.total)},[e,t]),T=(0,C.useRef)(n);(0,C.useEffect)(()=>{h.current+=1,v.current=!1,T.current!==n&&(T.current=n,r(),f.current&&(f.current.scrollTop=0)),m(0,n)},[n,i]);let R=o<0?!0:a.length<o,w=(0,C.useCallback)(()=>{v.current||!R||m(a.length,n)},[m,a.length,n,R]);return{commits:a,total:o,loading:c,listError:p,hasMore:R,listRef:f,loadMore:w}}function Kt(e,t,n){let[i,r]=(0,C.useState)(null),[a,s]=(0,C.useState)(null),[o,l]=(0,C.useState)(!1),[c,g]=(0,C.useState)(null),[p,y]=(0,C.useState)(null),[h,v]=(0,C.useState)(!1),[f,m]=(0,C.useState)(n),[T,R]=(0,C.useState)(!1),w=(0,C.useRef)(0),A=(0,C.useRef)(null),M=(0,C.useRef)(new Map),E=(0,C.useCallback)((P,B)=>{let q=M.current;for(q.set(P,B);q.size>50;){let K=q.keys().next().value;if(K===void 0)break;q.delete(K)}},[]),N=(0,C.useCallback)(()=>{r(null),s(null),A.current=null},[]),z=(0,C.useCallback)(async P=>{A.current=P.hash,r(P),l(!1),w.current+=1,g(null),y(null),v(!1);let B=M.current.get(P.hash);if(B!==void 0){s(B);return}s(null);let q=await e.query({sessionId:t,query:{kind:"show",ref:P.hash}});if(A.current!==P.hash)return;let K=I(q,"show");if(K!==null){let ie={commit:K.commit,body:K.body,stats:K.stats};E(P.hash,ie),s(ie)}else l(!0)},[e,t,E]),_=(0,C.useCallback)(async(P,B,q,K=!1)=>{let ie=++w.current;g({path:P,hash:B,shortHash:q}),y(null),v(!1),R(K);let j=await e.query({sessionId:t,query:{kind:"diff",path:P,base:"commit",commit:B,...K?{context:1e5}:{}}});if(ie!==w.current)return;let ve=I(j,"diff");ve!==null?y(ve.text):v(!0)},[e,t]),$=(0,C.useCallback)(()=>{w.current+=1,g(null),y(null),v(!1),R(!1)},[]);(0,C.useEffect)(()=>{if(c===null)return;let P=B=>{B.key==="Escape"&&$()};return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[c,$]);let[W,Q]=(0,C.useState)(null),[ce,X]=(0,C.useState)(null),O=(0,C.useRef)(void 0),re=(0,C.useRef)(null),G=(0,C.useCallback)((P,B,q)=>{O.current!==void 0&&clearTimeout(O.current),O.current=setTimeout(()=>{re.current=P.hash,Q({commit:P,x:B,y:q});let K=M.current.get(P.hash);if(K!==void 0){X(K.body);return}X(null),e.query({sessionId:t,query:{kind:"show",ref:P.hash}}).then(ie=>{if(re.current!==P.hash)return;let j=I(ie,"show");j!==null?(E(P.hash,{commit:j.commit,body:j.body,stats:j.stats}),X(j.body)):X("")})},260)},[e,t,E]),J=(0,C.useCallback)(()=>{O.current!==void 0&&clearTimeout(O.current),re.current=null,Q(null),X(null)},[]);return(0,C.useEffect)(()=>()=>{O.current!==void 0&&clearTimeout(O.current)},[]),{selected:i,detail:a,detailError:o,select:z,clearSelection:N,fileDiff:c,fileDiffText:p,fileDiffError:h,fileDiffMode:f,setFileDiffMode:m,fileDiffExpanded:T,openFileDiff:_,closeFileDiff:$,hover:W,hoverBody:ce,onHoverEnter:G,onHoverLeave:J}}var Y=require("react"),Fn=(e,t,n)=>Math.max(t,Math.min(n,e));function Ln(e,t){try{let n=typeof localStorage<"u"?localStorage.getItem(e):null,i=n===null?NaN:Number(n);return Number.isFinite(i)?i:t}catch{return t}}function An(e,t){try{typeof localStorage<"u"&&localStorage.setItem(e,String(Math.round(t)))}catch{}}function de(e){let{storageKey:t,initial:n,min:i,reserve:r,edge:a}=e,[s,o]=(0,Y.useState)(()=>Ln(t,n)),l=(0,Y.useRef)(null),c=(0,Y.useRef)(null),g=(0,Y.useCallback)(y=>{let v=l.current?.parentElement?.clientWidth??Number.MAX_SAFE_INTEGER;c.current={x:y.clientX,w:s,max:Math.max(i,v-r)},y.preventDefault(),typeof document<"u"&&(document.body.style.cursor="col-resize",document.body.style.userSelect="none")},[s,i,r]);(0,Y.useEffect)(()=>{if(typeof window>"u")return;let y=v=>{let f=c.current;if(f===null)return;let m=v.clientX-f.x;o(Fn(f.w+(a==="end"?m:-m),i,f.max))},h=()=>{c.current!==null&&(c.current=null,typeof document<"u"&&(document.body.style.cursor="",document.body.style.userSelect=""),o(v=>(An(t,v),v)))};return window.addEventListener("pointermove",y),window.addEventListener("pointerup",h),()=>{window.removeEventListener("pointermove",y),window.removeEventListener("pointerup",h)}},[a,i,t]);let p=(0,Y.createElement)("div",{key:`rz-${t}`,ref:l,className:"gp-resizer",role:"separator","aria-orientation":"vertical",onPointerDown:g});return{width:s,divider:p}}var Bt=require("react");function he(e,t,n,i,r=!1){return e.map(a=>(0,Bt.createElement)("button",{key:a,type:"button",className:`gp-seg__btn${t===a?" gp-seg__btn--active":""}`,...r?{disabled:!0}:{},onClick:()=>n(a)},i(a)))}var ye=14,Se=30;function Wt({remote:e,sessionId:t,refreshKey:n,defaultDiffView:i,t:r}){let[a,s]=(0,d.useState)({ref:null,search:"",author:"",since:""}),[o,l]=(0,d.useState)(""),[c,g]=(0,d.useState)(new Set(["tags","remote"])),{tree:p,treeError:y,authors:h,reload:v}=qt(e,t,n),f=Kt(e,t,i),{commits:m,loading:T,listError:R,hasMore:w,listRef:A,loadMore:M}=Jt(e,t,a,n,f.clearSelection);(0,d.useEffect)(()=>{let G=setTimeout(()=>s(J=>J.search===o?J:{...J,search:o}),300);return()=>clearTimeout(G)},[o]);let E=a.search!=="",N=(0,d.useMemo)(()=>E?m.map(G=>({commit:G,lane:0,color:0,edges:[],merge:!1})):Gt(m),[m,E]),z=(0,d.useMemo)(()=>E?0:Nt(N),[N,E]),_=E?12:Math.max(ye,z*ye),$=`${_}px minmax(120px,1fr) 72px 120px 96px`,W=()=>{let G=A.current;G===null||!w||G.scrollTop+G.clientHeight>=G.scrollHeight-240&&M()},Q=(0,d.useMemo)(()=>Date.now(),[m]),ce=(0,d.useMemo)(()=>f.detail===null?[]:Tt(f.detail.stats.map(G=>({path:G.path,meta:G.status}))),[f.detail]),X=f.selected,O=de({storageKey:"gp.overview.left",initial:200,min:130,reserve:360,edge:"end"}),re=de({storageKey:"gp.overview.right",initial:340,min:190,reserve:360,edge:"start"});return(0,d.createElement)("div",{className:"gp-overview"},[In(f.fileDiff,{text:f.fileDiffText,error:f.fileDiffError,mode:f.fileDiffMode,onMode:f.setFileDiffMode,expanded:f.fileDiffExpanded,onExpand:G=>{f.fileDiff!==null&&f.openFileDiff(f.fileDiff.path,f.fileDiff.hash,f.fileDiff.shortHash,G)},onClose:f.closeFileDiff,remote:e,sessionId:t,t:r}),(0,d.createElement)("div",{key:"left",className:"gp-col gp-col--left",style:{flex:`0 0 ${O.width}px`}},$n(p,y,a.ref,c,{onFilter:G=>s(J=>({...J,ref:G})),onToggle:G=>g(J=>{let P=new Set(J);return P.has(G)?P.delete(G):P.add(G),P}),onRetry:v,t:r})),O.divider,(0,d.createElement)("div",{key:"mid",className:"gp-col gp-col--mid gp-history"},[(0,d.createElement)("div",{key:"tb",className:"gp-toolbar"},[(0,d.createElement)("input",{key:"search",className:"gp-search",placeholder:r("overview.search"),value:o,onChange:G=>l(G.target.value)}),(0,d.createElement)("select",{key:"author",className:"gp-select",value:a.author,onChange:G=>s(J=>({...J,author:G.target.value}))},[(0,d.createElement)("option",{key:"",value:""},r("overview.allUsers")),...h.map(G=>(0,d.createElement)("option",{key:G,value:G},G))]),(0,d.createElement)("select",{key:"since",className:"gp-select",value:a.since,onChange:G=>s(J=>({...J,since:G.target.value}))},[(0,d.createElement)("option",{key:"",value:""},r("overview.allTime")),(0,d.createElement)("option",{key:"today",value:"1 day ago"},r("overview.today")),(0,d.createElement)("option",{key:"7d",value:"7 days ago"},r("overview.last7d")),(0,d.createElement)("option",{key:"30d",value:"30 days ago"},r("overview.last30d"))]),(0,d.createElement)("button",{key:"fetch",type:"button",className:"gp-icon-btn",title:r("overview.fetch"),onClick:()=>{e.run({sessionId:t,action:{kind:"fetch"}}).then(()=>v())}},(0,d.createElement)(De,{size:14}))]),(0,d.createElement)("div",{key:"list",className:"gp-history__list",ref:A,onScroll:W},m.length===0?(0,d.createElement)("div",{className:"gp-empty"},r(T?"common.loading":R?"overview.loadFailed":"overview.noResults")):N.map(G=>Hn(G,{selected:X?.hash===G.commit.hash,gridTpl:$,graphW:_,laneCount:z,searching:E,now:Q,onSelect:()=>void f.select(G.commit),onHoverEnter:f.onHoverEnter,onHoverLeave:f.onHoverLeave,t:r})))]),re.divider,(0,d.createElement)("div",{key:"right",className:"gp-col gp-col--right gp-detail",style:{flex:`0 0 ${re.width}px`}},X===null?(0,d.createElement)("div",{className:"gp-empty"},[(0,d.createElement)(Ee,{key:"i",size:20}),r("overview.selectCommit")]):[(0,d.createElement)("div",{key:"files",className:"gp-detail__files"},f.detail===null?(0,d.createElement)("div",{className:"gp-empty"},f.detailError?r("overview.detailFailed"):r("common.loading")):Xn(ce,{activePath:f.fileDiff?.path??null,openTitle:r("overview.openFileDiff"),onOpen:G=>{X!==null&&f.openFileDiff(G,X.hash,X.shortHash)}})),(0,d.createElement)("div",{key:"msg",className:"gp-detail__msg"},[(0,d.createElement)("div",{key:"subj",className:"gp-detail__subject"},X.subject),(0,d.createElement)("div",{key:"meta",className:"gp-detail__meta"},[(0,d.createElement)("span",{key:"h",className:"gp-commit-hash"},X.shortHash),(0,d.createElement)("span",{key:"a"},X.author),(0,d.createElement)("span",{key:"t",title:ue(X.dateIso)},ge(X.dateIso,Q,r))]),f.detail!==null&&f.detail.body!==""?(0,d.createElement)("pre",{key:"body",className:"gp-detail__body"},f.detail.body):(0,d.createElement)("div",{key:"nb",className:"gp-empty"},r("overview.noMessage"))])]),zn(f.hover,f.hoverBody,r)])}function zn(e,t,n){if(e===null||typeof document>"u")return null;let i=460,r=Math.min(e.x+16,(typeof window<"u"?window.innerWidth:1200)-i-12),a=e.y+14,s=(0,d.createElement)("div",{className:"gp-hovercard",style:{left:r,top:a,maxWidth:i}},[(0,d.createElement)("div",{key:"subj",className:"gp-hovercard__subject"},e.commit.subject),(0,d.createElement)("div",{key:"meta",className:"gp-hovercard__meta"},[(0,d.createElement)("span",{key:"h",className:"gp-commit-hash"},e.commit.shortHash),(0,d.createElement)("span",{key:"a"},e.commit.author)]),t===null?(0,d.createElement)("div",{key:"l",className:"gp-hovercard__loading"},n("common.loading")):t===""?(0,d.createElement)("div",{key:"e",className:"gp-hovercard__loading"},n("overview.noMessage")):(0,d.createElement)("pre",{key:"body",className:"gp-hovercard__body"},t)]);return(0,Ze.createPortal)(s,document.body,"commit-hovercard")}function $n(e,t,n,i,r){if(t)return(0,d.createElement)("div",{className:"gp-empty"},[(0,d.createElement)("span",{key:"m"},r.t("overview.branchesError")),(0,d.createElement)("button",{key:"r",type:"button",className:"gp-btn",style:{marginTop:8},onClick:r.onRetry},r.t("common.retry"))]);if(e===null)return(0,d.createElement)("div",{className:"gp-empty"},r.t("common.loading"));let a=(s,o,l,c,g="")=>(0,d.createElement)("div",{key:s,className:"gp-branch-group"},[(0,d.createElement)("div",{key:"head",className:"gp-branch-group__head",onClick:()=>r.onToggle(s)},[(0,d.createElement)(le,{key:"c",size:11,open:!i.has(s)}),`${r.t(o)} (${l.length})`]),i.has(s)?null:l.map(p=>{let y=g+p.name,h=e.current===p.name,v=`gp-branch-row${n===y?" gp-branch-row--active":""}${h?" gp-branch-row--current":""}`;return(0,d.createElement)("div",{key:p.name,className:v,title:p.name,onClick:()=>r.onFilter(n===y?null:y)},[(0,d.createElement)("span",{key:"i",style:{display:"inline-flex",width:14}},c),(0,d.createElement)("span",{key:"n",className:"gp-tree-name"},p.name),p.ahead||p.behind?(0,d.createElement)("span",{key:"t",className:"gp-branch-row__track"},`${p.ahead?`\u2191${p.ahead}`:""}${p.behind?`\u2193${p.behind}`:""}`):null])})]);return(0,d.createElement)("div",{},[(0,d.createElement)("div",{key:"head-row",className:"gp-branch-row",style:{fontWeight:600,paddingLeft:10},onClick:()=>r.onFilter(null)},r.t("overview.head")),a("local","overview.local",e.local,(0,d.createElement)(je,{size:13})),a("remote","overview.remote",e.remote,(0,d.createElement)(je,{size:13})),a("tags","overview.tags",e.tags,(0,d.createElement)(xt,{size:13}))])}function Hn(e,t){let n=e.commit;return(0,d.createElement)("div",{key:n.hash,className:`gp-commit-row${t.selected?" gp-commit-row--active":""}`,style:{gridTemplateColumns:t.gridTpl},onClick:t.onSelect,onMouseEnter:i=>t.onHoverEnter(n,i.clientX,i.clientY),onMouseLeave:t.onHoverLeave},[(0,d.createElement)("div",{key:"g",className:"gp-graph-cell"},t.searching?null:Vn(e,t.laneCount)),(0,d.createElement)("div",{key:"s",className:"gp-commit-subject"},[...n.refs.map(i=>(0,d.createElement)("span",{key:i.name,className:`gp-ref-chip${i.head?" gp-ref-chip--head":""}${i.kind==="remote"?" gp-ref-chip--remote":""}${i.kind==="tag"?" gp-ref-chip--tag":""}`},i.name)),n.subject]),(0,d.createElement)("div",{key:"h",className:"gp-commit-hash"},n.shortHash),(0,d.createElement)("div",{key:"a",className:"gp-commit-author"},n.author),(0,d.createElement)("div",{key:"d",className:"gp-commit-date",title:ue(n.dateIso)},ge(n.dateIso,t.now,t.t))])}var Ve=["#4e9bff","#3fb950","#e0982e","#d05ce3","#e5534b","#2dc6c6","#d29922","#8b949e"];function Vn(e,t){let n=Math.max(ye,t*ye),i=a=>a*ye+ye/2,r=[];for(let a of e.edges){let s=Ve[a.color%Ve.length];r.push((0,d.createElement)("path",{key:`e${a.fromLane}-${a.toLane}-${a.color}`,d:`M ${i(a.fromLane)} 0 C ${i(a.fromLane)} ${Se/2}, ${i(a.toLane)} ${Se/2}, ${i(a.toLane)} ${Se}`,stroke:s,strokeWidth:1.6,fill:"none"}))}return r.push((0,d.createElement)("circle",{key:"node",cx:i(e.lane),cy:Se/2,r:e.merge?4:3.2,fill:Ve[e.color%Ve.length],stroke:"var(--dsw-alias-bg-layer-1)",strokeWidth:1})),(0,d.createElement)("svg",{className:"gp-graph-svg",width:n,height:Se},r)}function Xn(e,t){let n=[],i=(r,a)=>{for(let s of r)if(s.dir)n.push((0,d.createElement)("div",{key:s.path,className:"gp-tree-row",style:{paddingLeft:10+a*14}},[(0,d.createElement)(le,{key:"c",size:11,open:!0}),(0,d.createElement)("span",{key:"n",className:"gp-tree-name"},s.name)])),i(s.children,a+1);else{let o=String(s.meta??"modified"),l=t.activePath===s.path;n.push((0,d.createElement)("div",{key:s.path,className:`gp-tree-row${l?" gp-tree-row--active":""}`,style:{paddingLeft:10+a*14},title:t.openTitle,onClick:()=>t.onOpen(s.path)},[(0,d.createElement)("span",{key:"st",className:`gp-status-badge ${Pe(o)}`},(Me[o]??o[0]??"M").toUpperCase()),(0,d.createElement)("span",{key:"n",className:"gp-tree-name"},s.name)]))}};return i(e,0),(0,d.createElement)("div",{},n)}function In(e,t){if(e===null||typeof document>"u")return null;let{text:n,error:i,mode:r,onMode:a,expanded:s,onExpand:o,onClose:l,remote:c,sessionId:g,t:p}=t,y=(0,d.createElement)("div",{className:"gp-modal-backdrop",onClick:h=>{h.target===h.currentTarget&&l()}},(0,d.createElement)("div",{className:"gp-modal",role:"dialog","aria-modal":!0},[(0,d.createElement)("div",{key:"bar",className:"gp-modal__bar"},[(0,d.createElement)("span",{key:"fileicon",className:"gp-modal__fileicon"},(0,d.createElement)(_t,{size:15})),(0,d.createElement)("span",{key:"path",className:"gp-modal__path",title:e.path},qn(e.path)),(0,d.createElement)("span",{key:"hash",className:"gp-modal__hash"},e.shortHash),n!==null&&n!==""?(()=>{let h=He(n);return(0,d.createElement)("span",{key:"sum",className:"gp-modal__sum"},[(0,d.createElement)("span",{key:"a",className:"gp-stats__add"},`+${h.add}`),(0,d.createElement)("span",{key:"d",className:"gp-stats__del"},`\u2212${h.del}`)])})():null,(0,d.createElement)("button",{key:"expand",type:"button",className:`gp-seg__btn gp-diff__expand${s?" gp-seg__btn--active":""}`,disabled:r!=="split"&&r!=="unified",title:p(s?"diff.collapse":"diff.expandAll"),onClick:()=>o(!s)},p(s?"diff.collapse":"diff.expandAll")),(0,d.createElement)("div",{key:"seg",className:"gp-seg"},he(["unified","split","before","after"],r,a,h=>p(`diff.${h}`))),(0,d.createElement)("button",{key:"close",type:"button",className:"gp-icon-btn gp-modal__close",title:p("common.close"),onClick:l},(0,d.createElement)(kt,{size:15}))]),(0,d.createElement)("div",{key:"scroll",className:"gp-modal__scroll"},n===null?(0,d.createElement)("div",{className:"gp-empty"},p(i?"overview.diffFailed":"common.loading")):(0,d.createElement)($e,{text:n,mode:r,path:e.path,remote:c,sessionId:g,imageSpec:{base:"commit",commit:e.hash},t:p}))]));return(0,Ze.createPortal)(y,document.body,"file-diff-modal")}function qn(e){let t=e.lastIndexOf("/");return t<0?[(0,d.createElement)("span",{key:"n",className:"gp-modal__name"},e)]:[(0,d.createElement)("span",{key:"d",className:"gp-modal__dir"},e.slice(0,t+1)),(0,d.createElement)("span",{key:"n",className:"gp-modal__name"},e.slice(t+1))]}var u=require("react");var U=require("react");function Ot({stats:e,t}){let n=Date.now(),i=[(0,U.createElement)("span",{key:"files",className:"gp-stats__item"},t("stats.files",{n:e.fileCount})),(0,U.createElement)("span",{key:"lines",className:"gp-stats__item"},[(0,U.createElement)("span",{key:"a",className:"gp-stats__add"},`+${e.insertions}`)," ",(0,U.createElement)("span",{key:"d",className:"gp-stats__del"},`\u2212${e.deletions}`)])];e.staged>0&&i.push((0,U.createElement)("span",{key:"st",className:"gp-stats__item"},t("stats.staged",{n:e.staged}))),e.modified>0&&i.push((0,U.createElement)("span",{key:"mo",className:"gp-stats__item"},t("stats.modified",{n:e.modified}))),e.untracked>0&&i.push((0,U.createElement)("span",{key:"un",className:"gp-stats__item"},t("stats.untracked",{n:e.untracked})));let r=[];return e.lastChangeAt!==null&&r.push((0,U.createElement)("span",{key:"lc",className:"gp-stats__item",title:ue(e.lastChangeAt)},t("stats.lastChange",{time:ge(e.lastChangeAt,n,t)}))),e.headCommittedAt!==null&&r.push((0,U.createElement)("span",{key:"hc",className:"gp-stats__item",title:ue(e.headCommittedAt)},t("stats.lastCommit",{time:ge(e.headCommittedAt,n,t)}))),r.length>0&&i.push((0,U.createElement)("span",{key:"times",className:"gp-stats__times"},r)),(0,U.createElement)("div",{className:"gp-stats"},i)}function jt({remote:e,sessionId:t,snapshot:n,onAction:i,t:r}){let[a,s]=(0,u.useState)(new Set),[o,l]=(0,u.useState)(""),[c,g]=(0,u.useState)(!1),[p,y]=(0,u.useState)(!1),[h,v]=(0,u.useState)(null),[f,m]=(0,u.useState)(new Set),[T,R]=(0,u.useState)(null),[w,A]=(0,u.useState)(null),[M,E]=(0,u.useState)(null),[N,z]=(0,u.useState)(()=>n.defaultDiffView),[_,$]=(0,u.useState)(!1),[W,Q]=(0,u.useState)(!1),ce=(0,u.useRef)(0),X=(0,u.useMemo)(()=>n.changes.filter(S=>S.staged).sort(et),[n]),O=(0,u.useMemo)(()=>n.changes.filter(S=>!S.staged&&S.status!=="untracked").sort(et),[n]),re=(0,u.useMemo)(()=>n.changes.filter(S=>S.status==="untracked").sort(et),[n]),J=[{key:"staged",labelKey:"changes.groupStaged",items:X},{key:"unstaged",labelKey:"changes.groupUnstaged",items:O},{key:"untracked",labelKey:"changes.groupUntracked",items:re}].filter(S=>S.items.length>0);(0,u.useEffect)(()=>{s(S=>{if(S.size===0)return S;let D=new Set(n.changes.map(oe=>oe.path+(oe.staged?":s":":w"))),H=new Set,pe=!1;for(let oe of S)D.has(oe)?H.add(oe):pe=!0;return pe?H:S})},[n]),(0,u.useEffect)(()=>{if(!c||W||o.trim()!=="")return;let S=!0;return e.query({sessionId:t,query:{kind:"last-commit-message"}}).then(D=>{let H=I(D,"last-commit-message");S&&H!==null&&(l(H.message),Q(!0))}),()=>{S=!1}},[c,W,o,e,t]);let P=(0,u.useCallback)(async(S,D,H=!1,pe=!1)=>{let oe=++ce.current;A({path:S,base:D}),pe||E(null),$(H);let sn=await e.query({sessionId:t,query:{kind:"diff",path:S,base:D,...H?{context:1e5}:{}}});if(oe!==ce.current)return;let at=I(sn,"diff");E(at!==null?at.text:"")},[e,t]);(0,u.useEffect)(()=>{if(w===null)return;if(!n.changes.some(D=>D.path===w.path)){A(null),E(null);return}P(w.path,w.base,_,!0)},[n]),(0,u.useEffect)(()=>{R(null)},[n]);let B=S=>{s(D=>{let H=new Set(D);return H.has(S)?H.delete(S):H.add(S),H})},q=async S=>{if(p)return!1;y(!0),v(null);try{let D=await i(S);return D.ok?!0:(v(D.error??r("error.generic")),!1)}catch(D){return v(D instanceof Error?D.message:r("error.generic")),!1}finally{y(!1)}},K=async()=>{let S=o.trim();if(S===""&&!c){v(r("error.emptyMessage"));return}let D=a.size>0?[...new Set([...a].map(pe=>pe.replace(/:[sw]$/,"")))]:void 0;await q({kind:"commit",message:S,...D?{paths:D}:{},...c?{amend:!0}:{}})&&(l(""),s(new Set),g(!1),Q(!1))},ie=S=>{m(D=>{let H=new Set(D);return H.has(S)?H.delete(S):H.add(S),H})},j=M!==null&&M!==""?He(M):null,ve=de({storageKey:"gp.changes.left",initial:380,min:220,reserve:200,edge:"end"});return(0,u.createElement)("div",{className:"gp-changes"},[(0,u.createElement)("div",{key:"left",className:"gp-changes__left",style:{flex:`0 0 ${ve.width}px`}},[(0,u.createElement)(Ot,{key:"stats",stats:n.stats,t:r}),(0,u.createElement)("div",{key:"toolbar",className:"gp-toolbar"},[(0,u.createElement)("button",{key:"sa",type:"button",className:"gp-btn",disabled:p||n.changes.length===0,onClick:()=>void q({kind:"stage-all"})},r("changes.stageAll")),(0,u.createElement)("button",{key:"ua",type:"button",className:"gp-btn",disabled:p||n.staged===0,onClick:()=>void q({kind:"unstage-all"})},r("changes.unstageAll"))]),h!==null?(0,u.createElement)("div",{key:"err",className:"gp-feedback"},h):null,(0,u.createElement)("div",{key:"list",className:"gp-changes__list"},n.changes.length===0?(0,u.createElement)("div",{className:"gp-empty"},r("changes.noChanges")):J.map(S=>(0,u.createElement)("div",{key:S.key},[(0,u.createElement)("div",{key:"head",className:"gp-group-head",onClick:()=>ie(S.key)},[(0,u.createElement)(le,{key:"chev",size:12,open:!f.has(S.key)}),`${r(S.labelKey)} (${S.items.length})`]),f.has(S.key)?null:S.items.map(D=>{let H=D.path+(D.staged?":s":":w");return Jn(D,{selected:a.has(H),active:w?.path===D.path&&w.base===(D.staged?"staged":"worktree"),busy:p,armed:T===H,onToggle:()=>B(H),onOpen:()=>void P(D.path,D.staged?"staged":"worktree"),onStage:()=>void q(D.staged?{kind:"unstage",paths:[D.path]}:{kind:"stage",paths:[D.path]}),onDiscard:()=>{T===H?(q({kind:"discard",paths:[D.path]}),R(null)):R(H)},t:r})})]))),(0,u.createElement)("div",{key:"box",className:"gp-commitbox"},[(0,u.createElement)("textarea",{key:"msg",className:"gp-commitbox__msg",placeholder:r("commit.placeholder"),value:o,onChange:S=>l(S.target.value)}),(0,u.createElement)("div",{key:"row",className:"gp-commitbox__row"},[(0,u.createElement)("label",{key:"amend",className:"gp-commitbox__amend"},[(0,u.createElement)("input",{key:"cb",type:"checkbox",className:"gp-check",checked:c,onChange:()=>{g(S=>!S),Q(!1)}}),r("commit.amend")]),(0,u.createElement)("div",{key:"actions",className:"gp-commitbox__actions"},[(0,u.createElement)("button",{key:"commit",type:"button",className:"gp-btn gp-btn--primary",disabled:p||o.trim()==="",onClick:()=>void K()},r("commit.commit"))])])])]),ve.divider,(0,u.createElement)("div",{key:"right",className:"gp-changes__right"},w===null?(0,u.createElement)("div",{className:"gp-empty"},r("changes.selectFile")):(0,u.createElement)("div",{className:"gp-diff"},[(0,u.createElement)("div",{key:"tb",className:"gp-diff__toolbar"},[(0,u.createElement)("span",{key:"path",className:"gp-diff__path"},w.path),j?(0,u.createElement)("span",{key:"sum",className:"gp-stats__item",style:{marginLeft:"auto"}},[(0,u.createElement)("span",{key:"a",className:"gp-stats__add"},`+${j.add}`)," ",(0,u.createElement)("span",{key:"d",className:"gp-stats__del"},`\u2212${j.del}`)]):null,(0,u.createElement)("button",{key:"expand",type:"button",className:`gp-seg__btn gp-diff__expand${_?" gp-seg__btn--active":""}`,style:j?{}:{marginLeft:"auto"},disabled:N!=="split"&&N!=="unified",title:r(_?"diff.collapse":"diff.expandAll"),onClick:()=>void P(w.path,w.base,!_)},r(_?"diff.collapse":"diff.expandAll")),(0,u.createElement)("div",{key:"seg",className:"gp-seg"},he(["unified","split","before","after"],N,z,S=>r(`diff.${S}`)))]),(0,u.createElement)("div",{key:"scroll",className:"gp-diff__scroll"},M===null?(0,u.createElement)("div",{className:"gp-empty"},r("common.loading")):(0,u.createElement)($e,{text:M,mode:N,path:w.path,remote:e,sessionId:t,imageSpec:{base:w.base},t:r}))]))])}function et(e,t){return e.path.localeCompare(t.path)}function Jn(e,t){let n=e.path.split("/").pop()??e.path,i=e.path.includes("/")?e.path.slice(0,e.path.lastIndexOf("/")):"";return(0,u.createElement)("div",{key:e.path+(e.staged?":s":":w"),className:`gp-file-row${t.active?" gp-file-row--active":""}`,onClick:t.onOpen},[(0,u.createElement)("input",{key:"cb",type:"checkbox",className:"gp-check",checked:t.selected,onClick:r=>r.stopPropagation(),onChange:t.onToggle}),(0,u.createElement)("span",{key:"st",className:`gp-status-badge ${Pe(e.status)}`},Me[e.status]??"?"),(0,u.createElement)("span",{key:"nm",className:"gp-tree-name",title:e.path},[n,i?(0,u.createElement)("span",{key:"d",style:{color:"var(--dsw-alias-label-tertiary)",marginLeft:6,fontSize:11}},i):null]),(0,u.createElement)("span",{key:"act",className:"gp-file-row__actions"},[(0,u.createElement)("button",{key:"stg",type:"button",className:"gp-icon-btn",title:e.staged?t.t("changes.unstage"):t.t("changes.stage"),disabled:t.busy,onClick:r=>{r.stopPropagation(),t.onStage()}},e.staged?"\u2212":"+"),(0,u.createElement)("button",{key:"dis",type:"button",className:"gp-icon-btn",title:t.armed?t.t("changes.discardConfirm"):t.t("changes.discard"),style:t.armed?{color:"var(--dsw-alias-state-error-primary)"}:{},disabled:t.busy,onClick:r=>{r.stopPropagation(),t.onDiscard()}},"\u21BA")])])}var b=require("react");var ne=require("@deepseek-ai/dsh-client-ui-primitives");function Ut(e){return/\.(?:md|markdown)$/i.test(e)}function tt({remote:e,sessionId:t,t:n}){let[i,r]=(0,b.useState)(new Map),[a,s]=(0,b.useState)(new Set([""])),[o,l]=(0,b.useState)(null),[c,g]=(0,b.useState)({kind:"idle"}),[p,y]=(0,b.useState)(!0),[h,v]=(0,b.useState)("idle"),f=(0,b.useMemo)(()=>({code:{copyLabel:n("files.copy"),copiedLabel:n("files.copied")},footnotes:n("files.footnotes")}),[n]),m=(0,b.useRef)(0),T=de({storageKey:"gp.files.left",initial:300,min:180,reserve:220,edge:"end"}),R=(0,b.useCallback)(N=>{r(z=>{let _=z.get(N);if(_!==void 0&&_.status!=="error")return z;let $=new Map(z);return $.set(N,{status:"loading"}),$}),e.query({sessionId:t,query:{kind:"dir-list",path:N}}).then(z=>{let _=I(z,"dir-list");r($=>{let W=new Map($);return W.set(N,_===null?{status:"error"}:{status:"ready",entries:_.entries,truncated:_.truncated}),W})}).catch(()=>{r(z=>{let _=new Map(z);return _.set(N,{status:"error"}),_})})},[e,t]);(0,b.useEffect)(()=>{R("")},[R]);let w=(0,b.useCallback)(N=>{s(z=>{let _=new Set(z);return _.has(N)?(_.delete(N),_):(_.add(N),i.get(N)===void 0&&R(N),_)})},[i,R]),A=(0,b.useCallback)(N=>{l(N),y(!0),v("idle");let z=++m.current;g({kind:"loading",path:N}),e.query({sessionId:t,query:{kind:"file-content",path:N}}).then(_=>{if(z!==m.current)return;let $=I(_,"file-content");if($===null){g({kind:"error",path:N});return}if($.tooLarge===!0){g({kind:"tooLarge",path:N});return}if($.variant==="image"&&$.dataUrl!==void 0){g({kind:"image",path:N,dataUrl:$.dataUrl});return}if($.variant==="text"){g({kind:"text",path:N,content:$.content??"",lines:$.lines??0});return}g({kind:"binary",path:N})}).catch(()=>{z===m.current&&g({kind:"error",path:N})})},[e,t]),M=(0,b.useMemo)(()=>Qt("",0,{dirs:i,open:a,selected:o,toggleDir:w,selectFile:A,t:n}),[i,a,o,w,A,n]),E=async()=>{if(o===null)return;let N=m.current;try{await navigator.clipboard.writeText(o),N===m.current&&v("copied")}catch{N===m.current&&v("error")}};return(0,b.createElement)("div",{className:"gp-files"},[(0,b.createElement)("div",{key:"left",className:"gp-files__tree",style:{flex:`0 0 ${T.width}px`}},M),T.divider,(0,b.createElement)("div",{key:"right",className:"gp-files__preview"},[o!==null?(0,b.createElement)("div",{key:"bar",className:"gp-files__bar"},[(0,b.createElement)("code",{key:"path",className:"gp-files__path",title:o},o),c.kind==="text"&&Ut(c.path)?(0,b.createElement)("div",{key:"mode",className:"gp-files__mode",role:"group","aria-label":n("files.previewMode")},[(0,b.createElement)("button",{key:"source",type:"button",className:`gp-files__mode-btn${p?"":" gp-files__mode-btn--active"}`,"aria-pressed":!p,onClick:()=>y(!1)},n("files.source")),(0,b.createElement)("button",{key:"render",type:"button",className:`gp-files__mode-btn${p?" gp-files__mode-btn--active":""}`,"aria-pressed":p,onClick:()=>y(!0)},n("files.render"))]):null,(0,b.createElement)("button",{key:"copy",type:"button",className:`gp-files__copy-path${h==="error"?" gp-files__copy-path--error":""}`,"aria-live":"polite",onClick:()=>{E()}},n(h==="copied"?"files.pathCopied":h==="error"?"files.pathCopyFailed":"files.copyPath"))]):null,(0,b.createElement)("div",{key:"content",className:"gp-files__preview-content"},c.kind==="text"&&p&&Ut(c.path)?(0,b.createElement)("div",{className:"gp-files__markdown"},(0,b.createElement)(ne.MarkdownText,{text:c.content,labels:f,variant:"body"})):Kn(c,n))])])}function Qt(e,t,n){let i=n.dirs.get(e);if(i===void 0||i.status==="loading")return t===0?[(0,b.createElement)("div",{key:"l",className:"gp-empty"},n.t("common.loading"))]:[(0,b.createElement)("div",{key:`l${e}`,className:"gp-tree-row gp-tree-row--muted",style:{paddingLeft:10+t*14}},n.t("common.loading"))];if(i.status==="error")return[(0,b.createElement)("div",{key:`e${e}`,className:"gp-tree-row gp-tree-row--muted",style:{paddingLeft:10+t*14}},n.t("files.loadFailed"))];let r=[];for(let a of i.entries){let s=e===""?a.name:`${e}/${a.name}`;if(a.dir){let o=n.open.has(s);r.push((0,b.createElement)("button",{key:s,type:"button",className:`gp-tree-row gp-files__entry gp-files__entry--dir${a.ignored?" gp-tree-row--ignored":""}`,style:{paddingLeft:10+t*14},"aria-expanded":o,"aria-label":a.ignored?`${a.name} (${n.t("files.ignored")})`:a.name,onClick:()=>n.toggleDir(s)},[(0,b.createElement)("span",{key:"c",className:"gp-tree-chev"},(0,b.createElement)(le,{size:11,open:o})),(0,b.createElement)("span",{key:"i",className:"gp-tree-ic"},(0,b.createElement)(ne.FileTypeIcon,{kind:"folder",size:18})),(0,b.createElement)("span",{key:"n",className:"gp-tree-name"},a.name)])),o&&r.push(...Qt(s,t+1,n))}else{let o=n.selected===s;r.push((0,b.createElement)("button",{key:s,type:"button",className:`gp-tree-row gp-files__entry${o?" gp-tree-row--active":""}${a.ignored?" gp-tree-row--ignored":""}`,style:{paddingLeft:10+t*14},"aria-current":o?"true":void 0,"aria-label":a.ignored?`${a.name} (${n.t("files.ignored")})`:a.name,onClick:()=>n.selectFile(s)},[(0,b.createElement)("span",{key:"c",className:"gp-tree-chev"}),(0,b.createElement)("span",{key:"i",className:"gp-tree-ic"},(0,b.createElement)(ne.FileTypeIcon,{path:s,size:18})),(0,b.createElement)("span",{key:"n",className:"gp-tree-name"},a.name)]))}}return i.truncated&&r.push((0,b.createElement)("div",{key:`t${e}`,className:"gp-tree-row gp-tree-row--muted",style:{paddingLeft:10+t*14}},n.t("files.truncated"))),r}function Kn(e,t){switch(e.kind){case"idle":return(0,b.createElement)("div",{className:"gp-empty"},t("files.selectFile"));case"loading":return(0,b.createElement)("div",{className:"gp-empty"},t("common.loading"));case"error":return(0,b.createElement)("div",{className:"gp-empty"},t("files.loadFailed"));case"tooLarge":return(0,b.createElement)("div",{className:"gp-empty"},t("files.tooLarge"));case"binary":return(0,b.createElement)("div",{className:"gp-empty"},t("files.binary"));case"image":return(0,b.createElement)("div",{className:"gp-files__image"},(0,b.createElement)("img",{src:e.dataUrl,alt:e.path}));case"text":return(0,b.createElement)("div",{className:"gp-files__code gp-diff__scroll"},(0,b.createElement)(Bn,{content:e.content,path:e.path}))}}function Bn({content:e,path:t}){let n=(0,ne.languageForPath)(t),i=(0,ne.useCodeHighlighter)(n),r=(0,b.useMemo)(()=>{let s=e.split(`
|
|
316
|
-
`);return s.length>0&&s[s.length-1]===""&&s.pop(),s},[e]),a=(0,
|
|
317
|
-
`)),[i,r]);return(0,b.createElement)("div",{className:"gp-files__single"},r.flatMap((s,o)=>[(0,b.createElement)("div",{key:`n${o}`,className:"gp-diff-no"},o+1),(0,b.createElement)("div",{key:`c${o}`,className:"gp-diff-cell"},s===""?"\xA0":a?.[o]!==void 0?a[o].map((l,c)=>(0,b.createElement)("span",{key:c,style:l.style},l.text)):s)]))}var Yt="gp.panel.fontDelta";function Wn(){if(typeof localStorage>"u")return 0;let e=Number(localStorage.getItem(Yt));return e===-1||e===1?e:0}function Zt({ctx:e,sessionId:t,t:n}){let[i,r]=(0,k.useState)(Wn),[a,s]=(0,k.useState)(null),o=Re(t),l=we(e),c=o.state==="error"&&o.error.code==="not-a-git-repo",g=c?"files":a!==null&&a.sessionId===t?a.tab:null,p=(0,k.useRef)({tabs:new Set});p.current.sessionId!==t&&(p.current={sessionId:t,tabs:new Set}),g!==null&&p.current.tabs.add(g);let y=p.current.tabs.has("files");(0,k.useEffect)(()=>{if(!ae(t))return;if(c){s(null);return}if(a?.sessionId===t)return;let w=mt(t);if(w!==null){s({sessionId:t,tab:w});return}o.state==="ready"&&s({sessionId:t,tab:o.snapshot.dirty?"changes":"overview"})},[t,o,c,a?.sessionId]),(0,k.useEffect)(()=>{if(ae(t))return ht(t,w=>s({sessionId:t,tab:w}))},[t]);let h=o.state==="ready"?o.snapshot.checkedAt:0,v=async w=>{if(!ae(t))return{ok:!1,error:n("error.noCwd")};let A=await l.run({sessionId:t,action:w});return A.ok?(We(t).accept(A.snapshot),{ok:!0}):{ok:!1,error:On(A.error.code,A.error.message,n)}},f=w=>{r(w),typeof localStorage<"u"&&localStorage.setItem(Yt,String(w))},m=[{key:"overview",label:n("tab.overview"),icon:(0,k.createElement)(Ee,{size:14})},{key:"changes",label:n("tab.changes"),icon:(0,k.createElement)(wt,{size:14})},{key:"files",label:n("tab.files"),icon:(0,k.createElement)(St,{size:14})}],T=c?m.filter(w=>w.key==="files"):m,R=(()=>{if(!ae(t))return(0,k.createElement)("div",{className:"gp-empty"},n("error.noCwd"));if(o.state==="no-cwd")return(0,k.createElement)("div",{className:"gp-empty"},n("error.noCwd"));if(c)return(0,k.createElement)("div",{style:{display:"contents"}},y?(0,k.createElement)(tt,{key:t,remote:l,sessionId:t,t:n}):null);if(o.state==="error")return(0,k.createElement)("div",{className:"gp-empty"},n("pill.unavailable"));if(o.state==="cold"||o.state==="loading"||g===null)return(0,k.createElement)("div",{className:"gp-empty"},n("common.loading"));let w=o.snapshot;return(0,k.createElement)("div",{style:{display:"contents"}},[p.current.tabs.has("overview")?(0,k.createElement)("div",{key:"overview",style:g==="overview"?{display:"contents"}:{display:"none"}},(0,k.createElement)(Wt,{key:t,remote:l,sessionId:t,refreshKey:h,defaultDiffView:w.defaultDiffView,t:n})):null,p.current.tabs.has("changes")?(0,k.createElement)("div",{key:"changes",style:g==="changes"?{display:"contents"}:{display:"none"}},(0,k.createElement)(jt,{key:t,remote:l,sessionId:t,snapshot:w,onAction:v,t:n})):null,y?(0,k.createElement)("div",{key:"files",style:g==="files"?{display:"contents"}:{display:"none"}},(0,k.createElement)(tt,{key:t,remote:l,sessionId:t,t:n})):null])})();return(0,k.createElement)("div",{className:"gp-panel","data-conversation-composer-overlay":"","data-font-delta":i},[(0,k.createElement)("div",{key:"tabs",className:"gp-tabbar",role:"tablist"},[...T.map(w=>(0,k.createElement)("button",{key:w.key,type:"button",role:"tab","aria-selected":g===w.key,className:`gp-tab${g===w.key?" gp-tab--active":""}`,onClick:()=>{ae(t)&&s({sessionId:t,tab:w.key})}},[(0,k.createElement)("span",{key:"i",className:"gp-tab__icon"},w.icon),w.label])),(0,k.createElement)("div",{key:"font",className:"gp-font"},[(0,k.createElement)("button",{key:"dec",type:"button",className:"gp-font__decrease",onClick:()=>f(-1),"aria-label":n("panel.fontDecrease")},"A\u2212"),(0,k.createElement)("button",{key:"reset",type:"button",className:"gp-font__reset",onClick:()=>f(0),"aria-label":n("panel.fontReset")},"A"),(0,k.createElement)("button",{key:"inc",type:"button",className:"gp-font__increase",onClick:()=>f(1),"aria-label":n("panel.fontIncrease")},"A+")]),(0,k.createElement)(jn,{key:"ver",remote:l,t:n})]),(0,k.createElement)("div",{key:"body",className:"gp-body"},R)])}function On(e,t,n){switch(e){case"empty-message":return n("error.emptyMessage");case"not-a-git-repo":return n("error.notARepo");case"cwd-unavailable":return n("error.noCwd");case"local-changes-block":return n("error.localChangesBlock");default:return t??n("error.generic")}}function jn({remote:e,t}){let[n,i]=(0,k.useState)({kind:"idle"});(0,k.useEffect)(()=>{let o=!0;return e.version({}).then(l=>{o&&"current"in l&&i(c=>({...c,info:l}))}),()=>{o=!1}},[e]);let r=async()=>{i(l=>({kind:"checking",info:l.info}));let o=await e.version({check:!0});i({kind:"idle",info:"current"in o?o:void 0})},a=n.info,s=n.kind==="checking"?(0,k.createElement)("span",{className:"gp-verbar__status"},t("version.checking")):a===void 0||!a.checkedRemote?null:a.error!==void 0?(0,k.createElement)("span",{className:"gp-verbar__status gp-verbar__status--err",title:a.error},a.error==="repository is not configured"?t("version.noRepo"):t("version.error")):a.updateAvailable&&a.latest!==void 0?(0,k.createElement)("span",{},[(0,k.createElement)("span",{key:"s",className:"gp-verbar__status gp-verbar__status--new"},t("version.updateAvailable",{latest:a.latest,current:a.current})),a.releaseUrl!==void 0?(0,k.createElement)("a",{key:"l",className:"gp-verbar__link",href:a.releaseUrl,target:"_blank",rel:"noreferrer",style:{marginLeft:8}},t("version.viewRelease")):null]):(0,k.createElement)("span",{className:"gp-verbar__status gp-verbar__status--ok"},t("version.upToDate",{current:a.current}));return(0,k.createElement)("div",{className:"gp-verbar"},[a!==void 0?(0,k.createElement)("span",{key:"tag",className:"gp-verbar__tag"},`v${a.current}`):null,s,(0,k.createElement)("button",{key:"btn",type:"button",className:"gp-verbar__btn",disabled:n.kind==="checking",onClick:()=>void r()},[(0,k.createElement)("span",{key:"i",className:"gp-tab__icon"},(0,k.createElement)(De,{size:12})),t("version.check")]),a?.repositoryUrl!==void 0?(0,k.createElement)("a",{key:"gh",className:"gp-icon-btn gp-verbar__gh",href:a.repositoryUrl,target:"_blank",rel:"noreferrer",title:t("version.openRepo"),"aria-label":t("version.openRepo")},(0,k.createElement)(Ct,{size:15})):null])}var V=require("react"),rn=require("react-dom");var en="data-gp-tab-dot",be,nt=null,tn="",Ie=null,Xe;function Un(e){if(typeof document>"u")return null;let t=document.querySelectorAll(_e);for(let n of t)if((n.textContent??"").trim()===e)return n;return null}function rt(){let e=Un(tn);if(e===null)return;let t=e.querySelector(`[${en}]`);if(Ie===null){t?.remove();return}let n=`gp-tab-dot gp-tab-dot--${Ie}`;if(t!==null){t.className!==n&&(t.className=n);return}let i=document.createElement("span");i.className=n,i.setAttribute(en,""),i.setAttribute("aria-hidden","true"),e.appendChild(i)}function Qn(){if(typeof document>"u"||typeof MutationObserver>"u")return;let e=document.querySelector(gt);if(e!==nt){if(be?.disconnect(),nt=e,e===null){be=void 0;return}be=new MutationObserver(()=>rt()),be.observe(e,{childList:!0,subtree:!0})}}function Yn(){be?.disconnect(),be=void 0,nt=null}function nn(e,t,n){if(!(typeof document>"u")){if(n===null){it(e);return}Xe=e,tn=t,Ie=n,Qn(),rt()}}function it(e){Xe!==void 0&&Xe!==e||(Xe=void 0,Ie=null,rt(),Yn())}function Zn(e){let t=e.replace(/[/\\]+$/,"").split(/[/\\]/);return t[t.length-1]||e}function er(){let[e,t]=(0,V.useState)(!1),[n,i]=(0,V.useState)(null),r=(0,V.useRef)(null);return(0,V.useLayoutEffect)(()=>{if(!e||r.current===null){i(null);return}let o=r.current.getBoundingClientRect();i({left:o.left,bottom:window.innerHeight-o.top+8})},[e]),{bind:{ref:o=>{r.current=o},onMouseEnter:()=>t(!0),onMouseLeave:()=>t(!1)},render:o=>!e||n===null||typeof document>"u"?null:(0,rn.createPortal)((0,V.createElement)("div",{className:"gp-tip",style:{left:n.left,bottom:n.bottom}},o.map((l,c)=>(0,V.createElement)("div",{key:c,className:c===0?"gp-tip__path":"gp-tip__note"},l))),document.body)}}function tr(e){let[t,n]=(0,V.useState)(!1);return(0,V.useEffect)(()=>{if(e===null||typeof ResizeObserver>"u")return;let r=e.closest("[data-conversation-region]")??document.body,a=()=>n(r.clientWidth>0&&r.clientWidth<nr);a();let s=new ResizeObserver(a);return s.observe(r),()=>s.disconnect()},[e]),t}var nr=620;function an({sessionId:e,t}){let n=Re(e),i=er(),[r,a]=(0,V.useState)(null),s=tr(r),o=(0,V.useRef)(Symbol("gp-tab-dot")),l=n.state==="ready"&&n.snapshot.showInputPill===!1?n.snapshot.dirty?"dirty":"synced":null,c=t("panel.tab");if((0,V.useEffect)(()=>{nn(o.current,c,l);let m=o.current;return()=>{it(m)}},[c,l]),n.state==="cold"||n.state==="loading"||n.state==="no-cwd")return null;if(n.state==="error")return n.error.code==="not-a-git-repo"||n.error.showInputPill===!1?null:(0,V.createElement)("span",{className:"gp-pill gp-pill--degraded",title:n.error.detail??t("pill.unavailable")},t("pill.unavailable"));let g=n.snapshot;if(g.showInputPill===!1)return null;let p=Zn(g.root),y=g.branch??`(${t("pill.detached")})`,h=g.dirty,v=h?"gp-pill--dirty":"gp-pill--synced",f=()=>{let m=t("panel.tab");if(bt(m)){vt(m);return}ae(e)&&ut(e,h?"changes":"overview"),yt(m)};return(0,V.createElement)("span",{className:"gp-pill-wrap",ref:a},[(0,V.createElement)("button",{key:"btn",type:"button",className:`gp-pill ${v}${s?" gp-pill--compact":""}`,onClick:f,ref:i.bind.ref,onMouseEnter:i.bind.onMouseEnter,onMouseLeave:i.bind.onMouseLeave},[(0,V.createElement)("span",{key:"dot",className:"gp-pill__dot","aria-hidden":"true"}),(0,V.createElement)("span",{key:"repo",className:"gp-pill__repo"},p),(0,V.createElement)("span",{key:"git",className:"gp-pill__git"},["(",(0,V.createElement)("span",{key:"b",className:"gp-pill__branch"},y),")"])]),i.render([g.root,t(h?"pill.dirty":"pill.synced")])])}var L=require("react");function rr(e){for(let t of e){let n=t.schema?.dict;if(n!==void 0&&"showInputPill"in n||JSON.stringify(t.schema).includes("showInputPill"))return t.ns}}function on({ctx:e,t}){let[,n]=(0,L.useState)(0),[i,r]=(0,L.useState)(!1),[a,s]=(0,L.useState)(!1),[o,l]=(0,L.useState)(null),[c,g]=(0,L.useState)(null),p=()=>{n(_=>_+1)},y=e.get("configForms"),h=(0,L.useMemo)(()=>y?.describe(),[y]);(0,L.useEffect)(()=>{if(h!==void 0)return h.ensure(),h.subscribe(p)},[h]);let v=h?.getSnapshot().view,f=(0,L.useMemo)(()=>v===void 0?void 0:rr(v.namespaces),[v]),m=(0,L.useMemo)(()=>y!==void 0&&f!==void 0?y.get(f):void 0,[y,f]);(0,L.useEffect)(()=>{if(m!==void 0)return m.subscribe(p)},[m]);let T=m?.getSnapshot(),R=m!==void 0&&T!==void 0&&T.status==="ready",w=h?.getSnapshot().status,A=o??(typeof T?.value?.showInputPill=="boolean"?T.value.showInputPill:!0),M=c??(T?.value?.defaultDiffView==="split"?"split":"unified"),E=async(_,$,W)=>{if(m!==void 0){s(!1),r(!0);try{let Q=await m.set(_,$);W(),Q?(xe(),setTimeout(()=>xe(),1e3)):s(!0)}catch{W(),s(!0)}finally{r(!1)}}},N=_=>(l(_),E("showInputPill",_,()=>l(null))),z=_=>_===M?Promise.resolve():(g(_),E("defaultDiffView",_,()=>g(null)));return y===void 0?(0,L.createElement)("p",{className:"gp-cfg__hint"},t("cfg.notLoaded")):R?(0,L.createElement)("div",{className:"gp-cfg"},[(0,L.createElement)("h3",{key:"title",className:"gp-cfg__title"},t("cfg.title")),(0,L.createElement)("label",{key:"row",className:"gp-cfg__row"},[(0,L.createElement)("input",{key:"switch",type:"checkbox",role:"switch",className:"gp-cfg__switch",checked:A,disabled:i||T?.writable===!1,onChange:_=>{N(_.currentTarget.checked)}}),(0,L.createElement)("span",{key:"text",className:"gp-cfg__text"},t("cfg.toggle"))]),(0,L.createElement)("p",{key:"hint",className:"gp-cfg__hint"},t("cfg.hint")),(0,L.createElement)("h3",{key:"difftitle",className:"gp-cfg__title",style:{marginTop:6}},t("cfg.diffTitle")),(0,L.createElement)("div",{key:"diffseg",className:"gp-seg gp-cfg__seg"},he(["unified","split"],M,_=>{z(_)},_=>t(_==="unified"?"cfg.diffUnified":"cfg.diffSplit"),i||T?.writable===!1)),(0,L.createElement)("p",{key:"diffhint",className:"gp-cfg__hint"},t("cfg.diffHint")),a?(0,L.createElement)("p",{key:"error",className:"gp-cfg__err",role:"alert"},t("cfg.saveFailed")):null]):w==="idle"||w==="loading"?(0,L.createElement)("p",{className:"gp-cfg__hint"},t("common.loading")):(0,L.createElement)("p",{className:"gp-cfg__hint"},t("cfg.notLoaded"))}var Ce="gitPanel",ir=["dsh-git-panel","@xbzbing/dsh-git-panel"],ar=["slots","locale","connection"],or="dsh-git-panel";function sr(e){ot(),pt(e),e.effect(()=>e.locale.register(Ce,{zh:st,en:lt})??void 0,"dsh-git-panel: dictionaries");let t=e.locale.bind(Ce),n=[],i=r=>{typeof r=="function"&&n.push(r)};i(e.slots.inject("conversation.view",()=>e.slots.register({name:"conversation.view",id:"git-panel",order:30,locale:Ce,label:()=>t("panel.tab")},r=>(0,qe.createElement)(Zt,{ctx:e,sessionId:r.sessionId,t})))),i(e.slots.inject("conversation.input.left",()=>e.slots.register({name:"conversation.input.left",id:"git-panel-pill",order:100,locale:Ce},r=>(0,qe.createElement)(an,{sessionId:r.sessionId,t}))));for(let r of ir)i(e.slots.inject("plugins.bundle.config",()=>e.slots.register({name:"plugins.bundle.config",key:r,locale:Ce},a=>a.view==="summary"?t("cfg.title"):(0,qe.createElement)(on,{ctx:e,t}))));e.effect(()=>{let r=e.on("connection/reset",()=>xe());return()=>{typeof r=="function"&&r();for(let a of n.splice(0))try{a()}catch{}ft()}},"dsh-git-panel: lifecycle")}module.exports={name:or,inject:ar,apply:sr};
|
|
322
|
+
`),i=0,r=0,a=!0,s=!1,o=0;for(;o<n.length&&!n[o].startsWith("@@");o++);for(;o<n.length;o++){let l=n[o];if(l.startsWith("@@")){let p=kn.exec(l);if(p){let h=Number(p[1]),u=Number(p[3]),x=h-u;if(a)u>1&&t.push(me({rightStart:1,count:u-1,delta:x,atStart:!0,atEnd:!1}));else{let b=u-r;b>0&&t.push(me({rightStart:r,count:b,delta:x,atStart:!1,atEnd:!1}))}i=h,r=u,a=!1}t.push({kind:"hunk",leftNo:null,rightNo:null,leftText:null,rightText:null,text:l});continue}if(l.startsWith("\\"))continue;let c=l[0],f=l.slice(1);c==="+"?(t.push({kind:"add",leftNo:null,rightNo:r,leftText:null,rightText:f}),r++,s=!0):c==="-"?(t.push({kind:"del",leftNo:i,rightNo:null,leftText:f,rightText:null}),i++,s=!0):c===" "&&(t.push({kind:"context",leftNo:i,rightNo:r,leftText:f,rightText:f}),i++,r++,s=!0)}return s&&!a&&!wn(e)&&!xn(e)&&t.push(me({rightStart:r,count:null,delta:i-r,atStart:!1,atEnd:!0})),_n(t)}function me(e){return{kind:"gap",leftNo:null,rightNo:null,leftText:null,rightText:null,gap:e}}function _n(e){let t=[],n=0;for(;n<e.length;){let i=e[n];if(i.kind==="del"){let r=[],a=n;for(;a<e.length&&e[a].kind==="del";)r.push(e[a]),a++;let s=[];for(;a<e.length&&e[a].kind==="add";)s.push(e[a]),a++;let o=Math.max(r.length,s.length);for(let l=0;l<o;l++){let c=r[l],f=s[l];if(c&&f){let p=Sn(c.leftText??"",f.rightText??"");t.push({kind:"mod",leftNo:c.leftNo,rightNo:f.rightNo,leftText:c.leftText,rightText:f.rightText,...p!==null?{leftWord:p.left,rightWord:p.right}:{}})}else c?t.push({kind:"del",leftNo:c.leftNo,rightNo:null,leftText:c.leftText,rightText:null}):f&&t.push({kind:"add",leftNo:null,rightNo:f.rightNo,leftText:null,rightText:f.rightText})}n=a}else t.push(i),n++}return t}function Sn(e,t){let n=Math.min(e.length,t.length),i=0;for(;i<n&&e[i]===t[i];)i++;let r=0;for(;r<n-i&&e[e.length-1-r]===t[t.length-1-r];)r++;return i===0&&r===0?null:{left:[i,e.length-r],right:[i,t.length-r]}}function Cn(e,t,n){return n.map((i,r)=>{let a=t+r;return{kind:"context",leftNo:a+e,rightNo:a,leftText:i,rightText:i}})}var Q=20;function At(e){let t=[];for(let n of e)n.kind==="mod"?(t.push({kind:"del",leftNo:n.leftNo,rightNo:null,leftText:n.leftText,rightText:null,...n.leftWord!==void 0?{leftWord:n.leftWord}:{}}),t.push({kind:"add",leftNo:null,rightNo:n.rightNo,leftText:null,rightText:n.rightText,...n.rightWord!==void 0?{rightWord:n.rightWord}:{}})):t.push(n);return t}function zt(e,t,n,i,r,a){let s=e.findIndex(p=>p.kind==="gap"&&p.gap?.rightStart===t);if(s<0)return e.slice();let o=e[s].gap,l=Cn(o.delta,i,r),c=[];if(o.atEnd)return c.push(...l),!a&&r.length>0&&c.push(me({rightStart:i+r.length,count:null,delta:o.delta,atStart:!1,atEnd:!0})),[...e.slice(0,s),...c,...e.slice(s+1)];let f=o.count??r.length;if(n==="all"||r.length>=f)c.push(...l);else if(n==="down"){c.push(...l);let p=f-r.length;c.push(me({rightStart:o.rightStart+r.length,count:p,delta:o.delta,atStart:!1,atEnd:!1}))}else{let p=f-r.length;c.push(me({rightStart:o.rightStart,count:p,delta:o.delta,atStart:o.atStart,atEnd:!1})),c.push(...l)}return[...e.slice(0,s),...c,...e.slice(s+1)]}var ze=require("@deepseek-ai/dsh-client-ui-primitives");function $t(e,t){let n=[[],[],[]],i=0;for(let r of e){let a=i+r.text.length,s=[i,Math.max(i,Math.min(a,t[0])),Math.max(i,Math.min(a,t[1])),a];for(let o=0;o<3;o++){let l=r.text.slice(s[o]-i,s[o+1]-i);l!==""&&n[o].push({text:l,style:r.style})}i=a}return n}var ee=require("react");function Fe(e,t,n){let i=n(`diff.${e}`);return(0,ee.createElement)("div",{className:`gp-imgcmp__pane gp-imgcmp__pane--${e}`},[(0,ee.createElement)("div",{key:"head",className:"gp-imgcmp__head"},i),t===void 0?(0,ee.createElement)("div",{key:"missing",className:"gp-imgcmp__missing"},n("diff.imageMissing")):(0,ee.createElement)("div",{key:"img",className:"gp-imgcmp__img"},(0,ee.createElement)("img",{src:t,alt:i}))])}function Ht({oldUrl:e,newUrl:t,mode:n,t:i}){return n==="before"?(0,ee.createElement)("div",{className:"gp-imgcmp gp-imgcmp--single"},Fe("before",e,i)):n==="after"?(0,ee.createElement)("div",{className:"gp-imgcmp gp-imgcmp--single"},Fe("after",t,i)):(0,ee.createElement)("div",{className:"gp-imgcmp"},[Fe("before",e,i),Fe("after",t,i)])}var $e=(0,S.memo)(function({text:t,mode:n,path:i,remote:r,sessionId:a,imageSpec:s,t:o}){let l=(0,S.useMemo)(()=>Lt(t),[t]),c=Dt(t),f=(0,ze.useCodeHighlighter)(i===void 0?void 0:(0,ze.languageForPath)(i)),[p,h]=(0,S.useState)(l);(0,S.useEffect)(()=>{h(l)},[l]);let u=Nn(p,h,r,a,i,s),x=i!==void 0&&Pt(i),[b,v]=(0,S.useState)("render");(0,S.useEffect)(()=>{v("render")},[i]);let m=(c||x)&&i!==void 0&&Mt(i)&&r!==void 0&&a!==void 0&&s!==void 0&&(!x||b==="render"),w=Tn(m?r:void 0,m?a:void 0,m?i:void 0,m?s:void 0);if(m){let D=(()=>{if(w.kind==="idle"||w.kind==="loading")return(0,S.createElement)("div",{className:"gp-empty"},o("common.loading"));if(w.kind==="ready"){let M=w.res;if(M.tooLarge===!0)return(0,S.createElement)("div",{className:"gp-empty"},o("diff.tooLarge"));if(M.mime!==null&&(M.old!==void 0||M.new!==void 0))return(0,S.createElement)(Ht,{oldUrl:M.old,newUrl:M.new,mode:n,t:o})}return(0,S.createElement)("div",{className:"gp-empty"},o("diff.binary"))})();return x?Vt(b,v,D,o):D}if(c&&!x)return(0,S.createElement)("div",{className:"gp-empty"},o("diff.binary"));let H=(()=>{if(t.trim()==="")return(0,S.createElement)("div",{className:"gp-empty"},o("diff.empty"));if(n==="before")return Xt(Rn(p),f);if(n==="after")return Xt(En(p),f);if(n==="unified"){let D=At(p);return(0,S.createElement)("div",{className:"gp-diff__unified"},D.flatMap((M,T)=>Mn(M,T,f,u,o)))}return(0,S.createElement)("div",{className:"gp-diff__side"},p.flatMap((D,M)=>Dn(D,M,f,u,o)))})();return x?Vt(b,v,H,o):H});function Vt(e,t,n,i){let r=(a,s)=>(0,S.createElement)("button",{key:a,type:"button",className:`gp-seg__btn${e===a?" gp-seg__btn--active":""}`,"aria-pressed":e===a,onClick:()=>t(a)},s);return(0,S.createElement)("div",{className:"gp-svgdiff"},[(0,S.createElement)("div",{key:"bar",className:"gp-svgdiff__bar"},(0,S.createElement)("div",{className:"gp-seg"},[r("render",i("diff.svgRender")),r("source",i("diff.svgSource"))])),(0,S.createElement)("div",{key:"body",className:"gp-svgdiff__body"},n)])}function Nn(e,t,n,i,r,a){let[s,o]=(0,S.useState)(null),l=(0,S.useRef)(0);(0,S.useEffect)(()=>{l.current+=1,o(null)},[e]);let c=(0,S.useCallback)((f,p)=>{if(n===void 0||i===void 0||r===void 0||a===void 0)return;let h=`${f.rightStart}:${p}`;o(h);let u=++l.current,{start:x,end:b}=Gn(f,p),v=a.base==="commit"&&a.commit!==void 0?{kind:"file-lines",path:r,base:"commit",commit:a.commit,start:x,end:b}:a.base==="staged"?{kind:"file-lines",path:r,base:"staged",start:x,end:b}:{kind:"file-lines",path:r,base:"worktree",start:x,end:b};n.query({sessionId:i,query:v}).then(R=>{if(u!==l.current)return;let m=q(R,"file-lines");o(null),m!==null&&t(w=>zt(w,f.rightStart,p,m.start,m.lines,m.eof))}).catch(()=>{u===l.current&&o(null)})},[n,i,r,a,t]);return{busy:s,run:c}}function Gn(e,t){if(e.atEnd)return{start:e.rightStart,end:e.rightStart+Q-1};let n=e.count??Q;return t==="all"||n<=Q?{start:e.rightStart,end:e.rightStart+n-1}:t==="down"?{start:e.rightStart,end:e.rightStart+Q-1}:{start:e.rightStart+n-Q,end:e.rightStart+n-1}}function Tn(e,t,n,i){let[r,a]=(0,S.useState)({kind:"idle"}),s=i?.base,o=i?.commit;return(0,S.useEffect)(()=>{if(e===void 0||t===void 0||n===void 0||s===void 0)return;let l=!0;a({kind:"loading"});let c=s==="commit"&&o!==void 0?{kind:"image-diff",path:n,base:"commit",commit:o}:s==="staged"?{kind:"image-diff",path:n,base:"staged"}:{kind:"image-diff",path:n,base:"worktree"};return e.query({sessionId:t,query:c}).then(f=>{if(!l)return;let p=q(f,"image-diff");a(p!==null?{kind:"ready",res:p}:{kind:"failed"})}).catch(()=>{l&&a({kind:"failed"})}),()=>{l=!1}},[e,t,n,s,o]),r}function Le(e,t=""){return e.map((n,i)=>(0,S.createElement)("span",{key:`${t}${i}`,style:n.style},n.text))}function Ae(e,t,n,i){if(n==="")return(0,S.createElement)("div",{key:t,className:e},"\xA0");let r=i(n)?.[0];return(0,S.createElement)("div",{key:t,className:e},r===void 0?n:Le(r))}function Ye(e,t,n,i,r,a){let s=a(n)?.[0]??[{text:n,style:{}}],[o,l,c]=$t(s,i);return(0,S.createElement)("div",{key:t,className:e},[...Le(o,"p"),(0,S.createElement)("span",{key:"w",className:r},l.length===0?"\xA0":Le(l)),...Le(c,"s")])}function Rn(e){return e.filter(t=>t.leftText!==null).map(t=>({no:t.leftNo,text:t.leftText}))}function En(e){return e.filter(t=>t.rightText!==null).map(t=>({no:t.rightNo,text:t.rightText}))}function Xt(e,t){return(0,S.createElement)("div",{className:"gp-diff__single"},e.flatMap((n,i)=>[(0,S.createElement)("div",{key:`n${i}`,className:"gp-diff-no"},n.no??""),Ae("gp-diff-cell",`c${i}`,n.text,t)]))}function Dn(e,t,n,i,r){if(e.kind==="hunk")return[(0,S.createElement)("div",{key:`h${t}`,className:"gp-diff-row--hunk gp-diff-cell",style:{gridColumn:"1 / -1"}},e.text??"")];if(e.kind==="gap")return[It(e.gap,t,i,r)];let a=e.kind==="del"||e.kind==="mod"?"gp-diff-row--del":"",s=e.kind==="add"||e.kind==="mod"?"gp-diff-row--add":"",o=e.leftText===null?(0,S.createElement)("div",{key:`l${t}`,className:`gp-diff-cell ${a}`}):e.kind==="mod"&&e.leftWord!==void 0?Ye(`gp-diff-cell ${a}`,`l${t}`,e.leftText,e.leftWord,"gp-diff-word gp-diff-word--del",n):Ae(`gp-diff-cell ${a}`,`l${t}`,e.leftText,n),l=e.rightText===null?(0,S.createElement)("div",{key:`r${t}`,className:`gp-diff-cell ${s}`}):e.kind==="mod"&&e.rightWord!==void 0?Ye(`gp-diff-cell ${s}`,`r${t}`,e.rightText,e.rightWord,"gp-diff-word gp-diff-word--add",n):Ae(`gp-diff-cell ${s}`,`r${t}`,e.rightText,n);return[(0,S.createElement)("div",{key:`ln${t}`,className:"gp-diff-no"},e.leftNo??""),o,(0,S.createElement)("div",{key:`rn${t}`,className:"gp-diff-no"},e.rightNo??""),l]}function Mn(e,t,n,i,r){if(e.kind==="hunk")return[(0,S.createElement)("div",{key:`h${t}`,className:"gp-diff-row--hunk gp-diff-cell",style:{gridColumn:"1 / -1"}},e.text??"")];if(e.kind==="gap")return[It(e.gap,t,i,r)];let a=e.kind==="del",s=e.kind==="add",o=s?"gp-diff-row--add":a?"gp-diff-row--del":"",l=s?"+":a?"\u2212":"\xA0",c=e.rightText??e.leftText??"",f=s?e.rightWord:a?e.leftWord:void 0,p=s?"gp-diff-word gp-diff-word--add":"gp-diff-word gp-diff-word--del",h=`gp-diff-cell gp-diff-uni__code ${o}`,u=f!==void 0?Ye(h,`c${t}`,c,f,p,n):Ae(h,`c${t}`,c,n);return[(0,S.createElement)("div",{key:`ol${t}`,className:"gp-diff-no"},e.leftNo??""),(0,S.createElement)("div",{key:`nl${t}`,className:"gp-diff-no"},e.rightNo??""),(0,S.createElement)("div",{key:`sg${t}`,className:`gp-diff-uni__sign ${o}`},l),u]}function It(e,t,n,i){let r=n.busy===`${e.rightStart}:all`,a=n.busy===`${e.rightStart}:up`,s=n.busy===`${e.rightStart}:down`,o=(c,f,p)=>(0,S.createElement)("button",{key:c,type:"button",className:"gp-gap__btn",disabled:n.busy!==null,onClick:h=>{h.stopPropagation(),n.run(e,c)}},p?i("common.loading"):f),l=[];if(e.atEnd)l.push(o("down",i("diff.expandDown",{n:Q}),s));else{let c=e.count??0;c>0&&c<=Q?l.push(o("all",i("diff.expandGap",{n:c}),r)):(e.atStart||l.push(o("up",i("diff.expandUp",{n:Q}),a)),l.push(o("all",i("diff.expandGap",{n:c}),r)),l.push(o("down",i("diff.expandDown",{n:Q}),s)))}return(0,S.createElement)("div",{key:`g${t}`,className:"gp-diff-row--gap",style:{gridColumn:"1 / -1"}},l)}function He(e){return Ft(e)}var G=require("react");var Pn=100;function qt(e,t,n){let[i,r]=(0,G.useState)(null),[a,s]=(0,G.useState)(!1),[o,l]=(0,G.useState)([]),c=(0,G.useCallback)(()=>{s(!1),(async()=>{let[f,p]=await Promise.all([e.query({sessionId:t,query:{kind:"branches"}}),e.query({sessionId:t,query:{kind:"tags"}})]),h=q(f,"branches");if(h===null){s(!0);return}let u=q(p,"tags");r({current:h.current,defaultBranch:h.defaultBranch,local:h.local,remote:h.remote,tags:u?.tags??[]}),e.query({sessionId:t,query:{kind:"authors"}}).then(x=>{l(q(x,"authors")?.authors??[])})})()},[e,t]);return(0,G.useEffect)(()=>{c()},[n]),{tree:i,treeError:a,authors:o,reload:c}}function Jt(e,t,n,i,r){let[a,s]=(0,G.useState)([]),[o,l]=(0,G.useState)(0),[c,f]=(0,G.useState)(!1),[p,h]=(0,G.useState)(!1),u=(0,G.useRef)(0),x=(0,G.useRef)(!1),b=(0,G.useRef)(null),v=(0,G.useCallback)(async(H,D)=>{if(x.current)return;x.current=!0;let M=u.current;f(!0),h(!1);let T=await e.query({sessionId:t,query:{kind:"history",limit:Pn,skip:H,...D.ref?{ref:D.ref}:{},...D.search?{search:D.search}:{},...D.author?{author:D.author}:{},...D.since?{since:D.since}:{}}});if(x.current=!1,M!==u.current)return;f(!1);let V=q(T,"history");if(V===null){h(!0);return}let k=V.commits;s(A=>H===0?k:[...A,...k]),l(V.total)},[e,t]),R=(0,G.useRef)(n);(0,G.useEffect)(()=>{u.current+=1,x.current=!1,R.current!==n&&(R.current=n,r(),b.current&&(b.current.scrollTop=0)),v(0,n)},[n,i]);let m=o<0?!0:a.length<o,w=(0,G.useCallback)(()=>{x.current||!m||v(a.length,n)},[v,a.length,n,m]);return{commits:a,total:o,loading:c,listError:p,hasMore:m,listRef:b,loadMore:w}}function Kt(e,t,n){let[i,r]=(0,G.useState)(null),[a,s]=(0,G.useState)(null),[o,l]=(0,G.useState)(!1),[c,f]=(0,G.useState)(null),[p,h]=(0,G.useState)(null),[u,x]=(0,G.useState)(!1),[b,v]=(0,G.useState)(n),[R,m]=(0,G.useState)(!1),w=(0,G.useRef)(0),H=(0,G.useRef)(null),D=(0,G.useRef)(new Map),M=(0,G.useCallback)((F,C)=>{let L=D.current;for(L.set(F,C);L.size>50;){let I=L.keys().next().value;if(I===void 0)break;L.delete(I)}},[]),T=(0,G.useCallback)(()=>{r(null),s(null),H.current=null},[]),V=(0,G.useCallback)(async F=>{H.current=F.hash,r(F),l(!1),w.current+=1,f(null),h(null),x(!1);let C=D.current.get(F.hash);if(C!==void 0){s(C);return}s(null);let L=await e.query({sessionId:t,query:{kind:"show",ref:F.hash}});if(H.current!==F.hash)return;let I=q(L,"show");if(I!==null){let ne={commit:I.commit,body:I.body,stats:I.stats};M(F.hash,ne),s(ne)}else l(!0)},[e,t,M]),k=(0,G.useCallback)(async(F,C,L,I=!1)=>{let ne=++w.current;f({path:F,hash:C,shortHash:L}),h(null),x(!1),m(I);let W=await e.query({sessionId:t,query:{kind:"diff",path:F,base:"commit",commit:C,...I?{context:1e5}:{}}});if(ne!==w.current)return;let ve=q(W,"diff");ve!==null?h(ve.text):x(!0)},[e,t]),A=(0,G.useCallback)(()=>{w.current+=1,f(null),h(null),x(!1),m(!1)},[]);(0,G.useEffect)(()=>{if(c===null)return;let F=C=>{C.key==="Escape"&&A()};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[c,A]);let[J,j]=(0,G.useState)(null),[de,Y]=(0,G.useState)(null),B=(0,G.useRef)(void 0),ie=(0,G.useRef)(null),K=(0,G.useCallback)((F,C,L)=>{B.current!==void 0&&clearTimeout(B.current),B.current=setTimeout(()=>{ie.current=F.hash,j({commit:F,x:C,y:L});let I=D.current.get(F.hash);if(I!==void 0){Y(I.body);return}Y(null),e.query({sessionId:t,query:{kind:"show",ref:F.hash}}).then(ne=>{if(ie.current!==F.hash)return;let W=q(ne,"show");W!==null?(M(F.hash,{commit:W.commit,body:W.body,stats:W.stats}),Y(W.body)):Y("")})},260)},[e,t,M]),ce=(0,G.useCallback)(()=>{B.current!==void 0&&clearTimeout(B.current),ie.current=null,j(null),Y(null)},[]);return(0,G.useEffect)(()=>()=>{B.current!==void 0&&clearTimeout(B.current)},[]),{selected:i,detail:a,detailError:o,select:V,clearSelection:T,fileDiff:c,fileDiffText:p,fileDiffError:u,fileDiffMode:b,setFileDiffMode:v,fileDiffExpanded:R,openFileDiff:k,closeFileDiff:A,hover:J,hoverBody:de,onHoverEnter:K,onHoverLeave:ce}}var U=require("react"),Fn=(e,t,n)=>Math.max(t,Math.min(n,e));function Ln(e,t){try{let n=typeof localStorage<"u"?localStorage.getItem(e):null,i=n===null?NaN:Number(n);return Number.isFinite(i)?i:t}catch{return t}}function An(e,t){try{typeof localStorage<"u"&&localStorage.setItem(e,String(Math.round(t)))}catch{}}function le(e){let{storageKey:t,initial:n,min:i,reserve:r,edge:a}=e,[s,o]=(0,U.useState)(()=>Ln(t,n)),l=(0,U.useRef)(null),c=(0,U.useRef)(null),f=(0,U.useCallback)(h=>{let x=l.current?.parentElement?.clientWidth??Number.MAX_SAFE_INTEGER;c.current={x:h.clientX,w:s,max:Math.max(i,x-r)},h.preventDefault(),typeof document<"u"&&(document.body.style.cursor="col-resize",document.body.style.userSelect="none")},[s,i,r]);(0,U.useEffect)(()=>{if(typeof window>"u")return;let h=x=>{let b=c.current;if(b===null)return;let v=x.clientX-b.x;o(Fn(b.w+(a==="end"?v:-v),i,b.max))},u=()=>{c.current!==null&&(c.current=null,typeof document<"u"&&(document.body.style.cursor="",document.body.style.userSelect=""),o(x=>(An(t,x),x)))};return window.addEventListener("pointermove",h),window.addEventListener("pointerup",u),()=>{window.removeEventListener("pointermove",h),window.removeEventListener("pointerup",u)}},[a,i,t]);let p=(0,U.createElement)("div",{key:`rz-${t}`,ref:l,className:"gp-resizer",role:"separator","aria-orientation":"vertical",onPointerDown:f});return{width:s,divider:p}}var Bt=require("react");function he(e,t,n,i,r=!1){return e.map(a=>(0,Bt.createElement)("button",{key:a,type:"button",className:`gp-seg__btn${t===a?" gp-seg__btn--active":""}`,...r?{disabled:!0}:{},onClick:()=>n(a)},i(a)))}var ye=14,Se=30,zn=260;function $n(e,t){let[n,i]=(0,d.useState)(!1);return(0,d.useEffect)(()=>{if(e===null||typeof ResizeObserver>"u")return;let r=()=>i(e.clientWidth>0&&e.clientWidth<t);r();let a=new ResizeObserver(r);return a.observe(e),()=>a.disconnect()},[e,t]),n}function Wt({remote:e,sessionId:t,refreshKey:n,defaultDiffView:i,t:r}){let[a,s]=(0,d.useState)({ref:null,search:"",author:"",since:""}),[o,l]=(0,d.useState)(""),[c,f]=(0,d.useState)(null),p=$n(c,zn),[h,u]=(0,d.useState)(new Set(["tags","remote"])),{tree:x,treeError:b,authors:v,reload:R}=qt(e,t,n),m=Kt(e,t,i),{commits:w,loading:H,listError:D,hasMore:M,listRef:T,loadMore:V}=Jt(e,t,a,n,m.clearSelection);(0,d.useEffect)(()=>{let C=setTimeout(()=>s(L=>L.search===o?L:{...L,search:o}),300);return()=>clearTimeout(C)},[o]);let k=a.search!=="",A=(0,d.useMemo)(()=>k?w.map(C=>({commit:C,lane:0,color:0,edges:[],merge:!1})):Gt(w),[w,k]),J=(0,d.useMemo)(()=>k?0:Nt(A),[A,k]),j=k?12:Math.max(ye,J*ye),de=`${j}px minmax(120px,1fr) 72px 120px 96px`,Y=()=>{let C=T.current;C===null||!M||C.scrollTop+C.clientHeight>=C.scrollHeight-240&&V()},B=(0,d.useMemo)(()=>Date.now(),[w]),ie=(0,d.useMemo)(()=>m.detail===null?[]:Tt(m.detail.stats.map(C=>({path:C.path,meta:C.status}))),[m.detail]),K=m.selected,ce=le({storageKey:"gp.overview.left",initial:200,min:130,reserve:360,edge:"end"}),F=le({storageKey:"gp.overview.right",initial:340,min:190,reserve:360,edge:"start"});return(0,d.createElement)("div",{className:"gp-overview"},[Jn(m.fileDiff,{text:m.fileDiffText,error:m.fileDiffError,mode:m.fileDiffMode,onMode:m.setFileDiffMode,expanded:m.fileDiffExpanded,onExpand:C=>{m.fileDiff!==null&&m.openFileDiff(m.fileDiff.path,m.fileDiff.hash,m.fileDiff.shortHash,C)},onClose:m.closeFileDiff,remote:e,sessionId:t,t:r}),(0,d.createElement)("div",{key:"left",className:"gp-col gp-col--left",style:{flex:`0 0 ${ce.width}px`}},Vn(x,b,a.ref,h,{onFilter:C=>s(L=>({...L,ref:C})),onToggle:C=>u(L=>{let I=new Set(L);return I.has(C)?I.delete(C):I.add(C),I}),onRetry:R,t:r})),ce.divider,(0,d.createElement)("div",{key:"mid",className:"gp-col gp-col--mid gp-history"},[(0,d.createElement)("div",{key:"tb",className:"gp-toolbar",ref:f},[(0,d.createElement)("input",{key:"search",className:"gp-search",placeholder:r(p?"overview.searchShort":"overview.search"),value:o,onChange:C=>l(C.target.value)}),(0,d.createElement)("select",{key:"author",className:"gp-select",value:a.author,onChange:C=>s(L=>({...L,author:C.target.value}))},[(0,d.createElement)("option",{key:"",value:""},r("overview.allUsers")),...v.map(C=>(0,d.createElement)("option",{key:C,value:C},C))]),(0,d.createElement)("select",{key:"since",className:"gp-select",value:a.since,onChange:C=>s(L=>({...L,since:C.target.value}))},[(0,d.createElement)("option",{key:"",value:""},r("overview.allTime")),(0,d.createElement)("option",{key:"today",value:"1 day ago"},r("overview.today")),(0,d.createElement)("option",{key:"7d",value:"7 days ago"},r("overview.last7d")),(0,d.createElement)("option",{key:"30d",value:"30 days ago"},r("overview.last30d"))]),(0,d.createElement)("button",{key:"fetch",type:"button",className:"gp-icon-btn",title:r("overview.fetch"),onClick:()=>{e.run({sessionId:t,action:{kind:"fetch"}}).then(()=>R())}},(0,d.createElement)(De,{size:14}))]),(0,d.createElement)("div",{key:"list",className:"gp-history__list",ref:T,onScroll:Y},w.length===0?(0,d.createElement)("div",{className:"gp-empty"},r(H?"common.loading":D?"overview.loadFailed":"overview.noResults")):A.map(C=>Xn(C,{selected:K?.hash===C.commit.hash,gridTpl:de,graphW:j,laneCount:J,searching:k,now:B,onSelect:()=>void m.select(C.commit),onHoverEnter:m.onHoverEnter,onHoverLeave:m.onHoverLeave,t:r})))]),F.divider,(0,d.createElement)("div",{key:"right",className:"gp-col gp-col--right gp-detail",style:{flex:`0 0 ${F.width}px`}},K===null?(0,d.createElement)("div",{className:"gp-empty"},[(0,d.createElement)(Ee,{key:"i",size:20}),r("overview.selectCommit")]):[(0,d.createElement)("div",{key:"files",className:"gp-detail__files"},m.detail===null?(0,d.createElement)("div",{className:"gp-empty"},m.detailError?r("overview.detailFailed"):r("common.loading")):qn(ie,{activePath:m.fileDiff?.path??null,openTitle:r("overview.openFileDiff"),onOpen:C=>{K!==null&&m.openFileDiff(C,K.hash,K.shortHash)}})),(0,d.createElement)("div",{key:"msg",className:"gp-detail__msg"},[(0,d.createElement)("div",{key:"subj",className:"gp-detail__subject"},K.subject),(0,d.createElement)("div",{key:"meta",className:"gp-detail__meta"},[(0,d.createElement)("span",{key:"h",className:"gp-commit-hash"},K.shortHash),(0,d.createElement)("span",{key:"a"},K.author),(0,d.createElement)("span",{key:"t",title:ue(K.dateIso)},ge(K.dateIso,B,r))]),m.detail!==null&&m.detail.body!==""?(0,d.createElement)("pre",{key:"body",className:"gp-detail__body"},m.detail.body):(0,d.createElement)("div",{key:"nb",className:"gp-empty"},r("overview.noMessage"))])]),Hn(m.hover,m.hoverBody,r)])}function Hn(e,t,n){if(e===null||typeof document>"u")return null;let i=460,r=Math.min(e.x+16,(typeof window<"u"?window.innerWidth:1200)-i-12),a=e.y+14,s=(0,d.createElement)("div",{className:"gp-hovercard",style:{left:r,top:a,maxWidth:i}},[(0,d.createElement)("div",{key:"subj",className:"gp-hovercard__subject"},e.commit.subject),(0,d.createElement)("div",{key:"meta",className:"gp-hovercard__meta"},[(0,d.createElement)("span",{key:"h",className:"gp-commit-hash"},e.commit.shortHash),(0,d.createElement)("span",{key:"a"},e.commit.author)]),t===null?(0,d.createElement)("div",{key:"l",className:"gp-hovercard__loading"},n("common.loading")):t===""?(0,d.createElement)("div",{key:"e",className:"gp-hovercard__loading"},n("overview.noMessage")):(0,d.createElement)("pre",{key:"body",className:"gp-hovercard__body"},t)]);return(0,Ze.createPortal)(s,document.body,"commit-hovercard")}function Vn(e,t,n,i,r){if(t)return(0,d.createElement)("div",{className:"gp-empty"},[(0,d.createElement)("span",{key:"m"},r.t("overview.branchesError")),(0,d.createElement)("button",{key:"r",type:"button",className:"gp-btn",style:{marginTop:8},onClick:r.onRetry},r.t("common.retry"))]);if(e===null)return(0,d.createElement)("div",{className:"gp-empty"},r.t("common.loading"));let a=(s,o,l,c,f="")=>(0,d.createElement)("div",{key:s,className:"gp-branch-group"},[(0,d.createElement)("div",{key:"head",className:"gp-branch-group__head",onClick:()=>r.onToggle(s)},[(0,d.createElement)(se,{key:"c",size:11,open:!i.has(s)}),`${r.t(o)} (${l.length})`]),i.has(s)?null:l.map(p=>{let h=f+p.name,u=e.current===p.name,x=`gp-branch-row${n===h?" gp-branch-row--active":""}${u?" gp-branch-row--current":""}`;return(0,d.createElement)("div",{key:p.name,className:x,title:p.name,onClick:()=>r.onFilter(n===h?null:h)},[(0,d.createElement)("span",{key:"i",style:{display:"inline-flex",width:14}},c),(0,d.createElement)("span",{key:"n",className:"gp-tree-name"},p.name),p.ahead||p.behind?(0,d.createElement)("span",{key:"t",className:"gp-branch-row__track"},`${p.ahead?`\u2191${p.ahead}`:""}${p.behind?`\u2193${p.behind}`:""}`):null])})]);return(0,d.createElement)("div",{},[(0,d.createElement)("div",{key:"head-row",className:"gp-branch-row",style:{fontWeight:600,paddingLeft:10},onClick:()=>r.onFilter(null)},r.t("overview.head")),a("local","overview.local",e.local,(0,d.createElement)(je,{size:13})),a("remote","overview.remote",e.remote,(0,d.createElement)(je,{size:13})),a("tags","overview.tags",e.tags,(0,d.createElement)(xt,{size:13}))])}function Xn(e,t){let n=e.commit;return(0,d.createElement)("div",{key:n.hash,className:`gp-commit-row${t.selected?" gp-commit-row--active":""}`,style:{gridTemplateColumns:t.gridTpl},onClick:t.onSelect,onMouseEnter:i=>t.onHoverEnter(n,i.clientX,i.clientY),onMouseLeave:t.onHoverLeave},[(0,d.createElement)("div",{key:"g",className:"gp-graph-cell"},t.searching?null:In(e,t.laneCount)),(0,d.createElement)("div",{key:"s",className:"gp-commit-subject"},[...n.refs.map(i=>(0,d.createElement)("span",{key:i.name,className:`gp-ref-chip${i.head?" gp-ref-chip--head":""}${i.kind==="remote"?" gp-ref-chip--remote":""}${i.kind==="tag"?" gp-ref-chip--tag":""}`},i.name)),n.subject]),(0,d.createElement)("div",{key:"h",className:"gp-commit-hash"},n.shortHash),(0,d.createElement)("div",{key:"a",className:"gp-commit-author"},n.author),(0,d.createElement)("div",{key:"d",className:"gp-commit-date",title:ue(n.dateIso)},ge(n.dateIso,t.now,t.t))])}var Ve=["#4e9bff","#3fb950","#e0982e","#d05ce3","#e5534b","#2dc6c6","#d29922","#8b949e"];function In(e,t){let n=Math.max(ye,t*ye),i=a=>a*ye+ye/2,r=[];for(let a of e.edges){let s=Ve[a.color%Ve.length];r.push((0,d.createElement)("path",{key:`e${a.fromLane}-${a.toLane}-${a.color}`,d:`M ${i(a.fromLane)} 0 C ${i(a.fromLane)} ${Se/2}, ${i(a.toLane)} ${Se/2}, ${i(a.toLane)} ${Se}`,stroke:s,strokeWidth:1.6,fill:"none"}))}return r.push((0,d.createElement)("circle",{key:"node",cx:i(e.lane),cy:Se/2,r:e.merge?4:3.2,fill:Ve[e.color%Ve.length],stroke:"var(--dsw-alias-bg-layer-1)",strokeWidth:1})),(0,d.createElement)("svg",{className:"gp-graph-svg",width:n,height:Se},r)}function qn(e,t){let n=[],i=(r,a)=>{for(let s of r)if(s.dir)n.push((0,d.createElement)("div",{key:s.path,className:"gp-tree-row",style:{paddingLeft:10+a*14}},[(0,d.createElement)(se,{key:"c",size:11,open:!0}),(0,d.createElement)("span",{key:"n",className:"gp-tree-name"},s.name)])),i(s.children,a+1);else{let o=String(s.meta??"modified"),l=t.activePath===s.path;n.push((0,d.createElement)("div",{key:s.path,className:`gp-tree-row${l?" gp-tree-row--active":""}`,style:{paddingLeft:10+a*14},title:t.openTitle,onClick:()=>t.onOpen(s.path)},[(0,d.createElement)("span",{key:"st",className:`gp-status-badge ${Pe(o)}`},(Me[o]??o[0]??"M").toUpperCase()),(0,d.createElement)("span",{key:"n",className:"gp-tree-name"},s.name)]))}};return i(e,0),(0,d.createElement)("div",{},n)}function Jn(e,t){if(e===null||typeof document>"u")return null;let{text:n,error:i,mode:r,onMode:a,expanded:s,onExpand:o,onClose:l,remote:c,sessionId:f,t:p}=t,h=(0,d.createElement)("div",{className:"gp-modal-backdrop",onClick:u=>{u.target===u.currentTarget&&l()}},(0,d.createElement)("div",{className:"gp-modal",role:"dialog","aria-modal":!0},[(0,d.createElement)("div",{key:"bar",className:"gp-modal__bar"},[(0,d.createElement)("span",{key:"fileicon",className:"gp-modal__fileicon"},(0,d.createElement)(_t,{size:15})),(0,d.createElement)("span",{key:"path",className:"gp-modal__path",title:e.path},Kn(e.path)),(0,d.createElement)("span",{key:"hash",className:"gp-modal__hash"},e.shortHash),n!==null&&n!==""?(()=>{let u=He(n);return(0,d.createElement)("span",{key:"sum",className:"gp-modal__sum"},[(0,d.createElement)("span",{key:"a",className:"gp-stats__add"},`+${u.add}`),(0,d.createElement)("span",{key:"d",className:"gp-stats__del"},`\u2212${u.del}`)])})():null,(0,d.createElement)("button",{key:"expand",type:"button",className:`gp-seg__btn gp-diff__expand${s?" gp-seg__btn--active":""}`,disabled:r!=="split"&&r!=="unified",title:p(s?"diff.collapse":"diff.expandAll"),onClick:()=>o(!s)},p(s?"diff.collapse":"diff.expandAll")),(0,d.createElement)("div",{key:"seg",className:"gp-seg"},he(["unified","split","before","after"],r,a,u=>p(`diff.${u}`))),(0,d.createElement)("button",{key:"close",type:"button",className:"gp-icon-btn gp-modal__close",title:p("common.close"),onClick:l},(0,d.createElement)(kt,{size:15}))]),(0,d.createElement)("div",{key:"scroll",className:"gp-modal__scroll"},n===null?(0,d.createElement)("div",{className:"gp-empty"},p(i?"overview.diffFailed":"common.loading")):(0,d.createElement)($e,{text:n,mode:r,path:e.path,remote:c,sessionId:f,imageSpec:{base:"commit",commit:e.hash},t:p}))]));return(0,Ze.createPortal)(h,document.body,"file-diff-modal")}function Kn(e){let t=e.lastIndexOf("/");return t<0?[(0,d.createElement)("span",{key:"n",className:"gp-modal__name"},e)]:[(0,d.createElement)("span",{key:"d",className:"gp-modal__dir"},e.slice(0,t+1)),(0,d.createElement)("span",{key:"n",className:"gp-modal__name"},e.slice(t+1))]}var g=require("react");var O=require("react");function Ot({stats:e,t}){let n=Date.now(),i=[(0,O.createElement)("span",{key:"files",className:"gp-stats__item"},t("stats.files",{n:e.fileCount})),(0,O.createElement)("span",{key:"lines",className:"gp-stats__item"},[(0,O.createElement)("span",{key:"a",className:"gp-stats__add"},`+${e.insertions}`)," ",(0,O.createElement)("span",{key:"d",className:"gp-stats__del"},`\u2212${e.deletions}`)])];e.staged>0&&i.push((0,O.createElement)("span",{key:"st",className:"gp-stats__item"},t("stats.staged",{n:e.staged}))),e.modified>0&&i.push((0,O.createElement)("span",{key:"mo",className:"gp-stats__item"},t("stats.modified",{n:e.modified}))),e.untracked>0&&i.push((0,O.createElement)("span",{key:"un",className:"gp-stats__item"},t("stats.untracked",{n:e.untracked})));let r=[];return e.lastChangeAt!==null&&r.push((0,O.createElement)("span",{key:"lc",className:"gp-stats__item",title:ue(e.lastChangeAt)},t("stats.lastChange",{time:ge(e.lastChangeAt,n,t)}))),e.headCommittedAt!==null&&r.push((0,O.createElement)("span",{key:"hc",className:"gp-stats__item",title:ue(e.headCommittedAt)},t("stats.lastCommit",{time:ge(e.headCommittedAt,n,t)}))),r.length>0&&i.push((0,O.createElement)("span",{key:"times",className:"gp-stats__times"},r)),(0,O.createElement)("div",{className:"gp-stats"},i)}function jt({remote:e,sessionId:t,snapshot:n,onAction:i,t:r}){let[a,s]=(0,g.useState)(new Set),[o,l]=(0,g.useState)(""),[c,f]=(0,g.useState)(!1),[p,h]=(0,g.useState)(!1),[u,x]=(0,g.useState)(null),[b,v]=(0,g.useState)(new Set),[R,m]=(0,g.useState)(null),[w,H]=(0,g.useState)(null),[D,M]=(0,g.useState)(null),[T,V]=(0,g.useState)(()=>n.defaultDiffView),[k,A]=(0,g.useState)(!1),[J,j]=(0,g.useState)(!1),de=(0,g.useRef)(0),Y=(0,g.useMemo)(()=>n.changes.filter(N=>N.staged).sort(et),[n]),B=(0,g.useMemo)(()=>n.changes.filter(N=>!N.staged&&N.status!=="untracked").sort(et),[n]),ie=(0,g.useMemo)(()=>n.changes.filter(N=>N.status==="untracked").sort(et),[n]),ce=[{key:"staged",labelKey:"changes.groupStaged",items:Y},{key:"unstaged",labelKey:"changes.groupUnstaged",items:B},{key:"untracked",labelKey:"changes.groupUntracked",items:ie}].filter(N=>N.items.length>0);(0,g.useEffect)(()=>{s(N=>{if(N.size===0)return N;let E=new Set(n.changes.map(ae=>ae.path+(ae.staged?":s":":w"))),$=new Set,pe=!1;for(let ae of N)E.has(ae)?$.add(ae):pe=!0;return pe?$:N})},[n]),(0,g.useEffect)(()=>{if(!c||J||o.trim()!=="")return;let N=!0;return e.query({sessionId:t,query:{kind:"last-commit-message"}}).then(E=>{let $=q(E,"last-commit-message");N&&$!==null&&(l($.message),j(!0))}),()=>{N=!1}},[c,J,o,e,t]);let F=(0,g.useCallback)(async(N,E,$=!1,pe=!1)=>{let ae=++de.current;H({path:N,base:E}),pe||M(null),A($);let sn=await e.query({sessionId:t,query:{kind:"diff",path:N,base:E,...$?{context:1e5}:{}}});if(ae!==de.current)return;let at=q(sn,"diff");M(at!==null?at.text:"")},[e,t]);(0,g.useEffect)(()=>{if(w===null)return;if(!n.changes.some(E=>E.path===w.path)){H(null),M(null);return}F(w.path,w.base,k,!0)},[n]),(0,g.useEffect)(()=>{m(null)},[n]);let C=N=>{s(E=>{let $=new Set(E);return $.has(N)?$.delete(N):$.add(N),$})},L=async N=>{if(p)return!1;h(!0),x(null);try{let E=await i(N);return E.ok?!0:(x(E.error??r("error.generic")),!1)}catch(E){return x(E instanceof Error?E.message:r("error.generic")),!1}finally{h(!1)}},I=async()=>{let N=o.trim();if(N===""&&!c){x(r("error.emptyMessage"));return}let E=a.size>0?[...new Set([...a].map(pe=>pe.replace(/:[sw]$/,"")))]:void 0;await L({kind:"commit",message:N,...E?{paths:E}:{},...c?{amend:!0}:{}})&&(l(""),s(new Set),f(!1),j(!1))},ne=N=>{v(E=>{let $=new Set(E);return $.has(N)?$.delete(N):$.add(N),$})},W=D!==null&&D!==""?He(D):null,ve=le({storageKey:"gp.changes.left",initial:380,min:220,reserve:200,edge:"end"});return(0,g.createElement)("div",{className:"gp-changes"},[(0,g.createElement)("div",{key:"left",className:"gp-changes__left",style:{flex:`0 0 ${ve.width}px`}},[(0,g.createElement)(Ot,{key:"stats",stats:n.stats,t:r}),(0,g.createElement)("div",{key:"toolbar",className:"gp-toolbar"},[(0,g.createElement)("button",{key:"sa",type:"button",className:"gp-btn",disabled:p||n.changes.length===0,onClick:()=>void L({kind:"stage-all"})},r("changes.stageAll")),(0,g.createElement)("button",{key:"ua",type:"button",className:"gp-btn",disabled:p||n.staged===0,onClick:()=>void L({kind:"unstage-all"})},r("changes.unstageAll"))]),u!==null?(0,g.createElement)("div",{key:"err",className:"gp-feedback"},u):null,(0,g.createElement)("div",{key:"list",className:"gp-changes__list"},n.changes.length===0?(0,g.createElement)("div",{className:"gp-empty"},r("changes.noChanges")):ce.map(N=>(0,g.createElement)("div",{key:N.key},[(0,g.createElement)("div",{key:"head",className:"gp-group-head",onClick:()=>ne(N.key)},[(0,g.createElement)(se,{key:"chev",size:12,open:!b.has(N.key)}),`${r(N.labelKey)} (${N.items.length})`]),b.has(N.key)?null:N.items.map(E=>{let $=E.path+(E.staged?":s":":w");return Bn(E,{selected:a.has($),active:w?.path===E.path&&w.base===(E.staged?"staged":"worktree"),busy:p,armed:R===$,onToggle:()=>C($),onOpen:()=>void F(E.path,E.staged?"staged":"worktree"),onStage:()=>void L(E.staged?{kind:"unstage",paths:[E.path]}:{kind:"stage",paths:[E.path]}),onDiscard:()=>{R===$?(L({kind:"discard",paths:[E.path]}),m(null)):m($)},t:r})})]))),(0,g.createElement)("div",{key:"box",className:"gp-commitbox"},[(0,g.createElement)("textarea",{key:"msg",className:"gp-commitbox__msg",placeholder:r("commit.placeholder"),value:o,onChange:N=>l(N.target.value)}),(0,g.createElement)("div",{key:"row",className:"gp-commitbox__row"},[(0,g.createElement)("label",{key:"amend",className:"gp-commitbox__amend"},[(0,g.createElement)("input",{key:"cb",type:"checkbox",className:"gp-check",checked:c,onChange:()=>{f(N=>!N),j(!1)}}),r("commit.amend")]),(0,g.createElement)("div",{key:"actions",className:"gp-commitbox__actions"},[(0,g.createElement)("button",{key:"commit",type:"button",className:"gp-btn gp-btn--primary",disabled:p||o.trim()==="",onClick:()=>void I()},r("commit.commit"))])])])]),ve.divider,(0,g.createElement)("div",{key:"right",className:"gp-changes__right"},w===null?(0,g.createElement)("div",{className:"gp-empty"},r("changes.selectFile")):(0,g.createElement)("div",{className:"gp-diff"},[(0,g.createElement)("div",{key:"tb",className:"gp-diff__toolbar"},[(0,g.createElement)("span",{key:"path",className:"gp-diff__path"},w.path),W?(0,g.createElement)("span",{key:"sum",className:"gp-stats__item",style:{marginLeft:"auto"}},[(0,g.createElement)("span",{key:"a",className:"gp-stats__add"},`+${W.add}`)," ",(0,g.createElement)("span",{key:"d",className:"gp-stats__del"},`\u2212${W.del}`)]):null,(0,g.createElement)("button",{key:"expand",type:"button",className:`gp-seg__btn gp-diff__expand${k?" gp-seg__btn--active":""}`,style:W?{}:{marginLeft:"auto"},disabled:T!=="split"&&T!=="unified",title:r(k?"diff.collapse":"diff.expandAll"),onClick:()=>void F(w.path,w.base,!k)},r(k?"diff.collapse":"diff.expandAll")),(0,g.createElement)("div",{key:"seg",className:"gp-seg"},he(["unified","split","before","after"],T,V,N=>r(`diff.${N}`)))]),(0,g.createElement)("div",{key:"scroll",className:"gp-diff__scroll"},D===null?(0,g.createElement)("div",{className:"gp-empty"},r("common.loading")):(0,g.createElement)($e,{text:D,mode:T,path:w.path,remote:e,sessionId:t,imageSpec:{base:w.base},t:r}))]))])}function et(e,t){return e.path.localeCompare(t.path)}function Bn(e,t){let n=e.path.split("/").pop()??e.path,i=e.path.includes("/")?e.path.slice(0,e.path.lastIndexOf("/")):"";return(0,g.createElement)("div",{key:e.path+(e.staged?":s":":w"),className:`gp-file-row${t.active?" gp-file-row--active":""}`,onClick:t.onOpen},[(0,g.createElement)("input",{key:"cb",type:"checkbox",className:"gp-check",checked:t.selected,onClick:r=>r.stopPropagation(),onChange:t.onToggle}),(0,g.createElement)("span",{key:"st",className:`gp-status-badge ${Pe(e.status)}`},Me[e.status]??"?"),(0,g.createElement)("span",{key:"nm",className:"gp-tree-name",title:e.path},[n,i?(0,g.createElement)("span",{key:"d",style:{color:"var(--dsw-alias-label-tertiary)",marginLeft:6,fontSize:11}},i):null]),(0,g.createElement)("span",{key:"act",className:"gp-file-row__actions"},[(0,g.createElement)("button",{key:"stg",type:"button",className:"gp-icon-btn",title:e.staged?t.t("changes.unstage"):t.t("changes.stage"),disabled:t.busy,onClick:r=>{r.stopPropagation(),t.onStage()}},e.staged?"\u2212":"+"),(0,g.createElement)("button",{key:"dis",type:"button",className:"gp-icon-btn",title:t.armed?t.t("changes.discardConfirm"):t.t("changes.discard"),style:t.armed?{color:"var(--dsw-alias-state-error-primary)"}:{},disabled:t.busy,onClick:r=>{r.stopPropagation(),t.onDiscard()}},"\u21BA")])])}var y=require("react");var te=require("@deepseek-ai/dsh-client-ui-primitives");function Ut(e){return/\.(?:md|markdown)$/i.test(e)}function tt({remote:e,sessionId:t,t:n}){let[i,r]=(0,y.useState)(new Map),[a,s]=(0,y.useState)(new Set([""])),[o,l]=(0,y.useState)(null),[c,f]=(0,y.useState)({kind:"idle"}),[p,h]=(0,y.useState)(!0),[u,x]=(0,y.useState)("idle"),b=(0,y.useMemo)(()=>({code:{copyLabel:n("files.copy"),copiedLabel:n("files.copied")},footnotes:n("files.footnotes")}),[n]),v=(0,y.useRef)(0),R=le({storageKey:"gp.files.left",initial:300,min:180,reserve:220,edge:"end"}),m=(0,y.useCallback)(T=>{r(V=>{let k=V.get(T);if(k!==void 0&&k.status!=="error")return V;let A=new Map(V);return A.set(T,{status:"loading"}),A}),e.query({sessionId:t,query:{kind:"dir-list",path:T}}).then(V=>{let k=q(V,"dir-list");r(A=>{let J=new Map(A);return J.set(T,k===null?{status:"error"}:{status:"ready",entries:k.entries,truncated:k.truncated}),J})}).catch(()=>{r(V=>{let k=new Map(V);return k.set(T,{status:"error"}),k})})},[e,t]);(0,y.useEffect)(()=>{m("")},[m]);let w=(0,y.useCallback)(T=>{s(V=>{let k=new Set(V);return k.has(T)?(k.delete(T),k):(k.add(T),i.get(T)===void 0&&m(T),k)})},[i,m]),H=(0,y.useCallback)(T=>{l(T),h(!0),x("idle");let V=++v.current;f({kind:"loading",path:T}),e.query({sessionId:t,query:{kind:"file-content",path:T}}).then(k=>{if(V!==v.current)return;let A=q(k,"file-content");if(A===null){f({kind:"error",path:T});return}if(A.tooLarge===!0){f({kind:"tooLarge",path:T});return}if(A.variant==="image"&&A.dataUrl!==void 0){f({kind:"image",path:T,dataUrl:A.dataUrl});return}if(A.variant==="text"){f({kind:"text",path:T,content:A.content??"",lines:A.lines??0});return}f({kind:"binary",path:T})}).catch(()=>{V===v.current&&f({kind:"error",path:T})})},[e,t]),D=(0,y.useMemo)(()=>Qt("",0,{dirs:i,open:a,selected:o,toggleDir:w,selectFile:H,t:n}),[i,a,o,w,H,n]),M=async()=>{if(o===null)return;let T=v.current;try{await navigator.clipboard.writeText(o),T===v.current&&x("copied")}catch{T===v.current&&x("error")}};return(0,y.createElement)("div",{className:"gp-files"},[(0,y.createElement)("div",{key:"left",className:"gp-files__tree",style:{flex:`0 0 ${R.width}px`}},D),R.divider,(0,y.createElement)("div",{key:"right",className:"gp-files__preview"},[o!==null?(0,y.createElement)("div",{key:"bar",className:"gp-files__bar"},[(0,y.createElement)("code",{key:"path",className:"gp-files__path",title:o},o),c.kind==="text"&&Ut(c.path)?(0,y.createElement)("div",{key:"mode",className:"gp-files__mode",role:"group","aria-label":n("files.previewMode")},[(0,y.createElement)("button",{key:"source",type:"button",className:`gp-files__mode-btn${p?"":" gp-files__mode-btn--active"}`,"aria-pressed":!p,onClick:()=>h(!1)},n("files.source")),(0,y.createElement)("button",{key:"render",type:"button",className:`gp-files__mode-btn${p?" gp-files__mode-btn--active":""}`,"aria-pressed":p,onClick:()=>h(!0)},n("files.render"))]):null,(0,y.createElement)("button",{key:"copy",type:"button",className:`gp-files__copy-path${u==="error"?" gp-files__copy-path--error":""}`,"aria-live":"polite",onClick:()=>{M()}},n(u==="copied"?"files.pathCopied":u==="error"?"files.pathCopyFailed":"files.copyPath"))]):null,(0,y.createElement)("div",{key:"content",className:"gp-files__preview-content"},c.kind==="text"&&p&&Ut(c.path)?(0,y.createElement)("div",{className:"gp-files__markdown"},(0,y.createElement)(te.MarkdownText,{text:c.content,labels:b,variant:"body"})):Wn(c,n))])])}function Qt(e,t,n){let i=n.dirs.get(e);if(i===void 0||i.status==="loading")return t===0?[(0,y.createElement)("div",{key:"l",className:"gp-empty"},n.t("common.loading"))]:[(0,y.createElement)("div",{key:`l${e}`,className:"gp-tree-row gp-tree-row--muted",style:{paddingLeft:10+t*14}},n.t("common.loading"))];if(i.status==="error")return[(0,y.createElement)("div",{key:`e${e}`,className:"gp-tree-row gp-tree-row--muted",style:{paddingLeft:10+t*14}},n.t("files.loadFailed"))];let r=[];for(let a of i.entries){let s=e===""?a.name:`${e}/${a.name}`;if(a.dir){let o=n.open.has(s);r.push((0,y.createElement)("button",{key:s,type:"button",className:`gp-tree-row gp-files__entry gp-files__entry--dir${a.ignored?" gp-tree-row--ignored":""}`,style:{paddingLeft:10+t*14},"aria-expanded":o,"aria-label":a.ignored?`${a.name} (${n.t("files.ignored")})`:a.name,onClick:()=>n.toggleDir(s)},[(0,y.createElement)("span",{key:"c",className:"gp-tree-chev"},(0,y.createElement)(se,{size:11,open:o})),(0,y.createElement)("span",{key:"i",className:"gp-tree-ic"},(0,y.createElement)(te.FileTypeIcon,{kind:"folder",size:18})),(0,y.createElement)("span",{key:"n",className:"gp-tree-name"},a.name)])),o&&r.push(...Qt(s,t+1,n))}else{let o=n.selected===s;r.push((0,y.createElement)("button",{key:s,type:"button",className:`gp-tree-row gp-files__entry${o?" gp-tree-row--active":""}${a.ignored?" gp-tree-row--ignored":""}`,style:{paddingLeft:10+t*14},"aria-current":o?"true":void 0,"aria-label":a.ignored?`${a.name} (${n.t("files.ignored")})`:a.name,onClick:()=>n.selectFile(s)},[(0,y.createElement)("span",{key:"c",className:"gp-tree-chev"}),(0,y.createElement)("span",{key:"i",className:"gp-tree-ic"},(0,y.createElement)(te.FileTypeIcon,{path:s,size:18})),(0,y.createElement)("span",{key:"n",className:"gp-tree-name"},a.name)]))}}return i.truncated&&r.push((0,y.createElement)("div",{key:`t${e}`,className:"gp-tree-row gp-tree-row--muted",style:{paddingLeft:10+t*14}},n.t("files.truncated"))),r}function Wn(e,t){switch(e.kind){case"idle":return(0,y.createElement)("div",{className:"gp-empty"},t("files.selectFile"));case"loading":return(0,y.createElement)("div",{className:"gp-empty"},t("common.loading"));case"error":return(0,y.createElement)("div",{className:"gp-empty"},t("files.loadFailed"));case"tooLarge":return(0,y.createElement)("div",{className:"gp-empty"},t("files.tooLarge"));case"binary":return(0,y.createElement)("div",{className:"gp-empty"},t("files.binary"));case"image":return(0,y.createElement)("div",{className:"gp-files__image"},(0,y.createElement)("img",{src:e.dataUrl,alt:e.path}));case"text":return(0,y.createElement)("div",{className:"gp-files__code gp-diff__scroll"},(0,y.createElement)(On,{content:e.content,path:e.path}))}}function On({content:e,path:t}){let n=(0,te.languageForPath)(t),i=(0,te.useCodeHighlighter)(n),r=(0,y.useMemo)(()=>{let s=e.split(`
|
|
323
|
+
`);return s.length>0&&s[s.length-1]===""&&s.pop(),s},[e]),a=(0,y.useMemo)(()=>i(r.join(`
|
|
324
|
+
`)),[i,r]);return(0,y.createElement)("div",{className:"gp-files__single"},r.flatMap((s,o)=>[(0,y.createElement)("div",{key:`n${o}`,className:"gp-diff-no"},o+1),(0,y.createElement)("div",{key:`c${o}`,className:"gp-diff-cell"},s===""?"\xA0":a?.[o]!==void 0?a[o].map((l,c)=>(0,y.createElement)("span",{key:c,style:l.style},l.text)):s)]))}var Yt="gp.panel.fontDelta";function jn(){if(typeof localStorage>"u")return 0;let e=Number(localStorage.getItem(Yt));return e===-1||e===1?e:0}function Zt({ctx:e,sessionId:t,t:n}){let[i,r]=(0,_.useState)(jn),[a,s]=(0,_.useState)(null),o=Re(t),l=we(e),c=o.state==="error"&&o.error.code==="not-a-git-repo",f=c?"files":a!==null&&a.sessionId===t?a.tab:null,p=(0,_.useRef)({tabs:new Set});p.current.sessionId!==t&&(p.current={sessionId:t,tabs:new Set}),f!==null&&p.current.tabs.add(f);let h=p.current.tabs.has("files");(0,_.useEffect)(()=>{if(!re(t))return;if(c){s(null);return}if(a?.sessionId===t)return;let w=mt(t);if(w!==null){s({sessionId:t,tab:w});return}o.state==="ready"&&s({sessionId:t,tab:o.snapshot.dirty?"changes":"overview"})},[t,o,c,a?.sessionId]),(0,_.useEffect)(()=>{if(re(t))return ht(t,w=>s({sessionId:t,tab:w}))},[t]);let u=o.state==="ready"?o.snapshot.checkedAt:0,x=async w=>{if(!re(t))return{ok:!1,error:n("error.noCwd")};let H=await l.run({sessionId:t,action:w});return H.ok?(We(t).accept(H.snapshot),{ok:!0}):{ok:!1,error:Un(H.error.code,H.error.message,n)}},b=w=>{r(w),typeof localStorage<"u"&&localStorage.setItem(Yt,String(w))},v=[{key:"overview",label:n("tab.overview"),icon:(0,_.createElement)(Ee,{size:14})},{key:"changes",label:n("tab.changes"),icon:(0,_.createElement)(wt,{size:14})},{key:"files",label:n("tab.files"),icon:(0,_.createElement)(St,{size:14})}],R=c?v.filter(w=>w.key==="files"):v,m=(()=>{if(!re(t))return(0,_.createElement)("div",{className:"gp-empty"},n("error.noCwd"));if(o.state==="no-cwd")return(0,_.createElement)("div",{className:"gp-empty"},n("error.noCwd"));if(c)return(0,_.createElement)("div",{style:{display:"contents"}},h?(0,_.createElement)(tt,{key:t,remote:l,sessionId:t,t:n}):null);if(o.state==="error")return(0,_.createElement)("div",{className:"gp-empty"},n("pill.unavailable"));if(o.state==="cold"||o.state==="loading"||f===null)return(0,_.createElement)("div",{className:"gp-empty"},n("common.loading"));let w=o.snapshot;return(0,_.createElement)("div",{style:{display:"contents"}},[p.current.tabs.has("overview")?(0,_.createElement)("div",{key:"overview",style:f==="overview"?{display:"contents"}:{display:"none"}},(0,_.createElement)(Wt,{key:t,remote:l,sessionId:t,refreshKey:u,defaultDiffView:w.defaultDiffView,t:n})):null,p.current.tabs.has("changes")?(0,_.createElement)("div",{key:"changes",style:f==="changes"?{display:"contents"}:{display:"none"}},(0,_.createElement)(jt,{key:t,remote:l,sessionId:t,snapshot:w,onAction:x,t:n})):null,h?(0,_.createElement)("div",{key:"files",style:f==="files"?{display:"contents"}:{display:"none"}},(0,_.createElement)(tt,{key:t,remote:l,sessionId:t,t:n})):null])})();return(0,_.createElement)("div",{className:"gp-panel","data-conversation-composer-overlay":"","data-font-delta":i},[(0,_.createElement)("div",{key:"tabs",className:"gp-tabbar",role:"tablist"},[...R.map(w=>(0,_.createElement)("button",{key:w.key,type:"button",role:"tab","aria-selected":f===w.key,className:`gp-tab${f===w.key?" gp-tab--active":""}`,onClick:()=>{re(t)&&s({sessionId:t,tab:w.key})}},[(0,_.createElement)("span",{key:"i",className:"gp-tab__icon"},w.icon),(0,_.createElement)("span",{key:"l",className:"gp-tab__label"},w.label)])),(0,_.createElement)("div",{key:"font",className:"gp-font"},[(0,_.createElement)("button",{key:"dec",type:"button",className:"gp-font__decrease",onClick:()=>b(-1),"aria-label":n("panel.fontDecrease")},"A\u2212"),(0,_.createElement)("button",{key:"reset",type:"button",className:"gp-font__reset",onClick:()=>b(0),"aria-label":n("panel.fontReset")},"A"),(0,_.createElement)("button",{key:"inc",type:"button",className:"gp-font__increase",onClick:()=>b(1),"aria-label":n("panel.fontIncrease")},"A+")]),(0,_.createElement)(Qn,{key:"ver",remote:l,t:n})]),(0,_.createElement)("div",{key:"body",className:"gp-body"},m)])}function Un(e,t,n){switch(e){case"empty-message":return n("error.emptyMessage");case"not-a-git-repo":return n("error.notARepo");case"cwd-unavailable":return n("error.noCwd");case"local-changes-block":return n("error.localChangesBlock");default:return t??n("error.generic")}}function Qn({remote:e,t}){let[n,i]=(0,_.useState)({kind:"idle"});(0,_.useEffect)(()=>{let o=!0;return e.version({}).then(l=>{o&&"current"in l&&i(c=>({...c,info:l}))}),()=>{o=!1}},[e]);let r=async()=>{i(l=>({kind:"checking",info:l.info}));let o=await e.version({check:!0});i({kind:"idle",info:"current"in o?o:void 0})},a=n.info,s=n.kind==="checking"?(0,_.createElement)("span",{className:"gp-verbar__status"},t("version.checking")):a===void 0||!a.checkedRemote?null:a.error!==void 0?(0,_.createElement)("span",{className:"gp-verbar__status gp-verbar__status--err",title:a.error},a.error==="repository is not configured"?t("version.noRepo"):t("version.error")):a.updateAvailable&&a.latest!==void 0?(0,_.createElement)("span",{},[(0,_.createElement)("span",{key:"s",className:"gp-verbar__status gp-verbar__status--new"},t("version.updateAvailable",{latest:a.latest,current:a.current})),a.releaseUrl!==void 0?(0,_.createElement)("a",{key:"l",className:"gp-verbar__link",href:a.releaseUrl,target:"_blank",rel:"noreferrer",style:{marginLeft:8}},t("version.viewRelease")):null]):(0,_.createElement)("span",{className:"gp-verbar__status gp-verbar__status--ok"},t("version.upToDate",{current:a.current}));return(0,_.createElement)("div",{className:"gp-verbar"},[a!==void 0?(0,_.createElement)("span",{key:"tag",className:"gp-verbar__tag"},`v${a.current}`):null,s,(0,_.createElement)("button",{key:"btn",type:"button",className:"gp-verbar__btn",disabled:n.kind==="checking",onClick:()=>void r()},[(0,_.createElement)("span",{key:"i",className:"gp-tab__icon"},(0,_.createElement)(De,{size:12})),t("version.check")]),a?.repositoryUrl!==void 0?(0,_.createElement)("a",{key:"gh",className:"gp-icon-btn gp-verbar__gh",href:a.repositoryUrl,target:"_blank",rel:"noreferrer",title:t("version.openRepo"),"aria-label":t("version.openRepo")},(0,_.createElement)(Ct,{size:15})):null])}var X=require("react"),rn=require("react-dom");var en="data-gp-tab-dot",be,nt=null,tn="",Ie=null,Xe;function Yn(e){if(typeof document>"u")return null;let t=document.querySelectorAll(_e);for(let n of t)if((n.textContent??"").trim()===e)return n;return null}function rt(){let e=Yn(tn);if(e===null)return;let t=e.querySelector(`[${en}]`);if(Ie===null){t?.remove();return}let n=`gp-tab-dot gp-tab-dot--${Ie}`;if(t!==null){t.className!==n&&(t.className=n);return}let i=document.createElement("span");i.className=n,i.setAttribute(en,""),i.setAttribute("aria-hidden","true"),e.appendChild(i)}function Zn(){if(typeof document>"u"||typeof MutationObserver>"u")return;let e=document.querySelector(gt);if(e!==nt){if(be?.disconnect(),nt=e,e===null){be=void 0;return}be=new MutationObserver(()=>rt()),be.observe(e,{childList:!0,subtree:!0})}}function er(){be?.disconnect(),be=void 0,nt=null}function nn(e,t,n){if(!(typeof document>"u")){if(n===null){it(e);return}Xe=e,tn=t,Ie=n,Zn(),rt()}}function it(e){Xe!==void 0&&Xe!==e||(Xe=void 0,Ie=null,rt(),er())}function tr(e){let t=e.replace(/[/\\]+$/,"").split(/[/\\]/);return t[t.length-1]||e}function nr(){let[e,t]=(0,X.useState)(!1),[n,i]=(0,X.useState)(null),r=(0,X.useRef)(null);return(0,X.useLayoutEffect)(()=>{if(!e||r.current===null){i(null);return}let o=r.current.getBoundingClientRect();i({left:o.left,bottom:window.innerHeight-o.top+8})},[e]),{bind:{ref:o=>{r.current=o},onMouseEnter:()=>t(!0),onMouseLeave:()=>t(!1)},render:o=>!e||n===null||typeof document>"u"?null:(0,rn.createPortal)((0,X.createElement)("div",{className:"gp-tip",style:{left:n.left,bottom:n.bottom}},o.map((l,c)=>(0,X.createElement)("div",{key:c,className:c===0?"gp-tip__path":"gp-tip__note"},l))),document.body)}}function rr(e){let[t,n]=(0,X.useState)(!1);return(0,X.useEffect)(()=>{if(e===null||typeof ResizeObserver>"u")return;let r=e.closest("[data-conversation-region]")??document.body,a=()=>n(r.clientWidth>0&&r.clientWidth<ir);a();let s=new ResizeObserver(a);return s.observe(r),()=>s.disconnect()},[e]),t}var ir=620;function an({sessionId:e,t}){let n=Re(e),i=nr(),[r,a]=(0,X.useState)(null),s=rr(r),o=(0,X.useRef)(Symbol("gp-tab-dot")),l=n.state==="ready"&&n.snapshot.showInputPill===!1?n.snapshot.dirty?"dirty":"synced":null,c=t("panel.tab");if((0,X.useEffect)(()=>{nn(o.current,c,l);let v=o.current;return()=>{it(v)}},[c,l]),n.state==="cold"||n.state==="loading"||n.state==="no-cwd")return null;if(n.state==="error")return n.error.code==="not-a-git-repo"||n.error.showInputPill===!1?null:(0,X.createElement)("span",{className:"gp-pill gp-pill--degraded",title:n.error.detail??t("pill.unavailable")},t("pill.unavailable"));let f=n.snapshot;if(f.showInputPill===!1)return null;let p=tr(f.root),h=f.branch??`(${t("pill.detached")})`,u=f.dirty,x=u?"gp-pill--dirty":"gp-pill--synced",b=()=>{let v=t("panel.tab");if(bt(v)){vt(v);return}re(e)&&ut(e,u?"changes":"overview"),yt(v)};return(0,X.createElement)("span",{className:"gp-pill-wrap",ref:a},[(0,X.createElement)("button",{key:"btn",type:"button",className:`gp-pill ${x}${s?" gp-pill--compact":""}`,onClick:b,ref:i.bind.ref,onMouseEnter:i.bind.onMouseEnter,onMouseLeave:i.bind.onMouseLeave},[(0,X.createElement)("span",{key:"dot",className:"gp-pill__dot","aria-hidden":"true"}),(0,X.createElement)("span",{key:"repo",className:"gp-pill__repo"},p),(0,X.createElement)("span",{key:"git",className:"gp-pill__git"},["(",(0,X.createElement)("span",{key:"b",className:"gp-pill__branch"},h),")"])]),i.render([f.root,t(u?"pill.dirty":"pill.synced")])])}var z=require("react");function ar(e){for(let t of e){let n=t.schema?.dict;if(n!==void 0&&"showInputPill"in n||JSON.stringify(t.schema).includes("showInputPill"))return t.ns}}function on({ctx:e,t}){let[,n]=(0,z.useState)(0),[i,r]=(0,z.useState)(!1),[a,s]=(0,z.useState)(!1),[o,l]=(0,z.useState)(null),[c,f]=(0,z.useState)(null),p=()=>{n(k=>k+1)},h=e.get("configForms"),u=(0,z.useMemo)(()=>h?.describe(),[h]);(0,z.useEffect)(()=>{if(u!==void 0)return u.ensure(),u.subscribe(p)},[u]);let x=u?.getSnapshot().view,b=(0,z.useMemo)(()=>x===void 0?void 0:ar(x.namespaces),[x]),v=(0,z.useMemo)(()=>h!==void 0&&b!==void 0?h.get(b):void 0,[h,b]);(0,z.useEffect)(()=>{if(v!==void 0)return v.subscribe(p)},[v]);let R=v?.getSnapshot(),m=v!==void 0&&R!==void 0&&R.status==="ready",w=u?.getSnapshot().status,H=o??(typeof R?.value?.showInputPill=="boolean"?R.value.showInputPill:!0),D=c??(R?.value?.defaultDiffView==="split"?"split":"unified"),M=async(k,A,J)=>{if(v!==void 0){s(!1),r(!0);try{let j=await v.set(k,A);J(),j?(xe(),setTimeout(()=>xe(),1e3)):s(!0)}catch{J(),s(!0)}finally{r(!1)}}},T=k=>(l(k),M("showInputPill",k,()=>l(null))),V=k=>k===D?Promise.resolve():(f(k),M("defaultDiffView",k,()=>f(null)));return h===void 0?(0,z.createElement)("p",{className:"gp-cfg__hint"},t("cfg.notLoaded")):m?(0,z.createElement)("div",{className:"gp-cfg"},[(0,z.createElement)("h3",{key:"title",className:"gp-cfg__title"},t("cfg.title")),(0,z.createElement)("label",{key:"row",className:"gp-cfg__row"},[(0,z.createElement)("input",{key:"switch",type:"checkbox",role:"switch",className:"gp-cfg__switch",checked:H,disabled:i||R?.writable===!1,onChange:k=>{T(k.currentTarget.checked)}}),(0,z.createElement)("span",{key:"text",className:"gp-cfg__text"},t("cfg.toggle"))]),(0,z.createElement)("p",{key:"hint",className:"gp-cfg__hint"},t("cfg.hint")),(0,z.createElement)("h3",{key:"difftitle",className:"gp-cfg__title",style:{marginTop:6}},t("cfg.diffTitle")),(0,z.createElement)("div",{key:"diffseg",className:"gp-seg gp-cfg__seg"},he(["unified","split"],D,k=>{V(k)},k=>t(k==="unified"?"cfg.diffUnified":"cfg.diffSplit"),i||R?.writable===!1)),(0,z.createElement)("p",{key:"diffhint",className:"gp-cfg__hint"},t("cfg.diffHint")),a?(0,z.createElement)("p",{key:"error",className:"gp-cfg__err",role:"alert"},t("cfg.saveFailed")):null]):w==="idle"||w==="loading"?(0,z.createElement)("p",{className:"gp-cfg__hint"},t("common.loading")):(0,z.createElement)("p",{className:"gp-cfg__hint"},t("cfg.notLoaded"))}var Ce="gitPanel",or=["dsh-git-panel","@xbzbing/dsh-git-panel"],sr=["slots","locale","connection"],lr="dsh-git-panel";function dr(e){ot(),pt(e),e.effect(()=>e.locale.register(Ce,{zh:st,en:lt})??void 0,"dsh-git-panel: dictionaries");let t=e.locale.bind(Ce),n=[],i=r=>{typeof r=="function"&&n.push(r)};i(e.slots.inject("conversation.view",()=>e.slots.register({name:"conversation.view",id:"git-panel",order:30,locale:Ce,label:()=>t("panel.tab")},r=>(0,qe.createElement)(Zt,{ctx:e,sessionId:r.sessionId,t})))),i(e.slots.inject("conversation.input.left",()=>e.slots.register({name:"conversation.input.left",id:"git-panel-pill",order:100,locale:Ce},r=>(0,qe.createElement)(an,{sessionId:r.sessionId,t}))));for(let r of or)i(e.slots.inject("plugins.bundle.config",()=>e.slots.register({name:"plugins.bundle.config",key:r,locale:Ce},a=>a.view==="summary"?t("cfg.title"):(0,qe.createElement)(on,{ctx:e,t}))));e.effect(()=>{let r=e.on("connection/reset",()=>xe());return()=>{typeof r=="function"&&r();for(let a of n.splice(0))try{a()}catch{}ft()}},"dsh-git-panel: lifecycle")}module.exports={name:lr,inject:sr,apply:dr};
|
|
318
325
|
return module.exports;
|
|
319
326
|
} });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xbzbing/dsh-git-panel",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "DeepSeek Harness (dsh) plugin: an IDE-style Git panel in the Web GUI — branch/history overview, uncommitted changes with commit & amend, diff stats, and a zsh-style branch marker in the input bar.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|