@xbzbing/dsh-git-panel 1.6.0 → 1.6.2
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/README.en.md +4 -4
- package/README.md +4 -4
- package/lib/client.js +52 -7
- package/lib/host/core.d.ts +9 -1
- package/lib/host/core.js +8 -1
- package/lib/host/index.d.ts +5 -3
- package/lib/host/index.js +11 -2
- package/lib/host/queries.js +5 -4
- package/lib/host/suggest.d.ts +20 -1
- package/lib/host/suggest.js +78 -16
- package/lib/host/types.d.ts +23 -4
- package/lib/host/types.js +4 -0
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
window.__ModuleLoader__.load({ id: "@xbzbing/dsh-git-panel", factory: (require) => {
|
|
2
2
|
var module = { exports: {} }; var exports = module.exports;
|
|
3
|
-
"use strict";var
|
|
3
|
+
"use strict";var Sn=require("react");var ti=`
|
|
4
4
|
.gp-panel{display:flex;flex-direction:column;height:100%;min-height:0;color:var(--dsw-alias-label-primary);font-size:13px;position:relative;
|
|
5
5
|
/* One selection language across the three list panes (Overview commits,
|
|
6
6
|
* Changes rows, Files tree): primary-tinted fill + a 3px inset left bar. */
|
|
@@ -185,6 +185,13 @@ a.gp-statusbar__repo:hover{background:var(--dsw-alias-interactive-bg-hover);colo
|
|
|
185
185
|
.gp-files__copy-path:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
186
186
|
.gp-files__copy-path:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}
|
|
187
187
|
.gp-files__copy-path--error{color:var(--dsw-alias-state-error-primary)}
|
|
188
|
+
/* Icon-only properties entry at the toolbar's far right. The path's flex-grow
|
|
189
|
+
* already pins the trailing cluster to the right edge; a margin-left:auto here
|
|
190
|
+
* would steal that free space and collapse the path to its 120px basis. */
|
|
191
|
+
.gp-files__props{flex:none;display:inline-flex;align-items:center;border:1px solid var(--dsw-alias-border-l2);border-radius:6px;padding:4px 6px;background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-secondary);cursor:pointer}
|
|
192
|
+
.gp-files__props:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}
|
|
193
|
+
.gp-files__props:disabled{opacity:0.5;cursor:default}
|
|
194
|
+
.gp-files__props:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}
|
|
188
195
|
.gp-files__mode{display:flex;gap:4px}
|
|
189
196
|
.gp-files__mode-btn{border:0;border-radius:6px;padding:4px 10px;background:transparent;color:var(--dsw-alias-label-secondary);cursor:pointer;font:inherit;font-size:12px}
|
|
190
197
|
.gp-files__mode-btn--active{background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);font-weight:600}
|
|
@@ -252,6 +259,10 @@ a.gp-statusbar__repo:hover{background:var(--dsw-alias-interactive-bg-hover);colo
|
|
|
252
259
|
/* commit box */
|
|
253
260
|
.gp-commitbox{flex:none;border-top:1px solid var(--dsw-alias-border-l2);padding:8px 10px;display:flex;flex-direction:column;gap:8px}
|
|
254
261
|
.gp-commitbox__msg{width:100%;min-height:72px;resize:vertical;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:8px;box-sizing:border-box}
|
|
262
|
+
.gp-commitbox__msg-wrap{position:relative;display:block}
|
|
263
|
+
.gp-commitbox__msg-wrap--busy .gp-commitbox__msg{padding-right:28px}
|
|
264
|
+
/* Loading indicator inside the disabled field (AI suggest in flight). */
|
|
265
|
+
.gp-commitbox__spin{position:absolute;top:8px;right:8px;width:13px;height:13px;box-sizing:border-box;border-radius:50%;border:2px solid var(--dsw-alias-border-l2);border-top-color:var(--dsw-alias-state-business-primary);animation:gp-spin .7s linear infinite;pointer-events:none}
|
|
255
266
|
.gp-commitbox__msg[readonly]{color:var(--dsw-alias-label-tertiary);background:var(--dsw-alias-bg-layer-2);cursor:progress}
|
|
256
267
|
.gp-commitbox__msg:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:-2px}
|
|
257
268
|
.gp-commitbox__row{display:flex;align-items:center;gap:10px}
|
|
@@ -378,6 +389,39 @@ a.gp-statusbar__repo:hover{background:var(--dsw-alias-interactive-bg-hover);colo
|
|
|
378
389
|
.gp-btn--danger{border-color:transparent;background:var(--dsw-alias-state-error-primary);color:#fff}
|
|
379
390
|
.gp-btn--danger:hover:not(:disabled){background:color-mix(in srgb,var(--dsw-alias-state-error-primary) 85%,#000);color:#fff}
|
|
380
391
|
|
|
392
|
+
/* file properties dialog: grouped label/value rows. Emphasis comes from
|
|
393
|
+
* weight/color (bold name & numbers, tinted Git chips), not from layout.
|
|
394
|
+
* Groups after the first are separated by a hairline so the section titles
|
|
395
|
+
* read as dividers instead of floating among the rows. */
|
|
396
|
+
.gp-props__group{display:flex;flex-direction:column;gap:2px}
|
|
397
|
+
.gp-props__group + .gp-props__group{border-top:1px solid var(--dsw-alias-border-l2);padding-top:10px;margin-top:2px}
|
|
398
|
+
.gp-props__group-title{font-size:12px;font-weight:650;letter-spacing:0.01em;color:var(--dsw-alias-label-primary);margin-bottom:5px}
|
|
399
|
+
.gp-props__row{display:flex;align-items:baseline;gap:12px;min-height:22px}
|
|
400
|
+
.gp-props__label{flex:none;width:84px;color:var(--dsw-alias-label-secondary);font-size:12px}
|
|
401
|
+
.gp-props__value{flex:1;min-width:0;display:flex;flex-wrap:wrap;align-items:baseline;justify-content:flex-end;gap:6px;color:var(--dsw-alias-label-primary);font-size:12px;text-align:right;overflow-wrap:anywhere}
|
|
402
|
+
.gp-props__strong{font-weight:650;font-variant-numeric:tabular-nums}
|
|
403
|
+
.gp-props__sub{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums}
|
|
404
|
+
.gp-props__mono{font-family:var(--dsw-font-mono,monospace);font-size:11px;user-select:all}
|
|
405
|
+
/* Path values are copy targets (hover shows the affordance). */
|
|
406
|
+
.gp-props__copy{border:0;background:transparent;padding:2px 4px;margin:-2px 0;font:inherit;color:inherit;text-align:right;cursor:pointer;border-radius:5px;min-width:0}
|
|
407
|
+
.gp-props__copy:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
408
|
+
.gp-props__copy:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:1px}
|
|
409
|
+
.gp-props__copy .gp-props__mono{font-size:11px}
|
|
410
|
+
/* Footer status bar: Git chips pinned left, copy feedback right, both
|
|
411
|
+
* vertically centered; always rendered (fixed height) so feedback never
|
|
412
|
+
* resizes the dialog. */
|
|
413
|
+
.gp-props__statusbar{min-height:34px;padding:6px 14px;justify-content:space-between;align-items:center;border-top:1px solid var(--dsw-alias-border-l2)}
|
|
414
|
+
.gp-props__footer-chips{display:inline-flex;flex-wrap:wrap;align-items:center;gap:6px;min-width:0}
|
|
415
|
+
/* Copy feedback: info blue at reduced presence \u2014 success green would clash
|
|
416
|
+
* with the green "tracked" chip on the same bar. */
|
|
417
|
+
.gp-props__copied{font-size:12px;font-weight:600;color:color-mix(in srgb,var(--dsw-alias-state-business-primary) 60%,transparent);white-space:nowrap}
|
|
418
|
+
.gp-props__copied--err{color:color-mix(in srgb,var(--dsw-alias-state-error-primary) 75%,transparent)}
|
|
419
|
+
/* Git chips: status colors arrive via gp-status--* (currentColor-based),
|
|
420
|
+
* painted as a soft tinted pill so states pop without shouting. */
|
|
421
|
+
.gp-props__badge{display:inline-block;padding:1.5px 9px;border-radius:999px;font-size:11px;font-weight:600;line-height:1.5;border:1px solid color-mix(in srgb,currentColor 30%,transparent);background:color-mix(in srgb,currentColor 12%,transparent);white-space:nowrap}
|
|
422
|
+
.gp-props__badge--ok{color:var(--dsw-alias-state-success-primary)}
|
|
423
|
+
.gp-props__badge--muted{color:var(--dsw-alias-label-tertiary)}
|
|
424
|
+
|
|
381
425
|
/* reset dialog: mode radios + hard-mode lost-files warning */
|
|
382
426
|
.gp-reset__modes{display:flex;flex-direction:column;gap:6px}
|
|
383
427
|
.gp-reset__mode{display:flex;align-items:flex-start;gap:8px;padding:8px 10px;border:1px solid var(--dsw-alias-border-l2);border-radius:8px;cursor:pointer}
|
|
@@ -472,6 +516,7 @@ a.gp-statusbar__repo:hover{background:var(--dsw-alias-interactive-bg-hover);colo
|
|
|
472
516
|
.gp-cfg__switch:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}
|
|
473
517
|
.gp-cfg__text{font-size:13px;color:var(--dsw-alias-label-primary)}
|
|
474
518
|
.gp-cfg__seg{align-self:flex-start}
|
|
519
|
+
.gp-cfg__seglabel{margin:0;font-size:13px;color:var(--dsw-alias-label-primary)}
|
|
475
520
|
.gp-cfg__hint{margin:0;font-size:12px;line-height:1.6;color:var(--dsw-alias-label-tertiary)}
|
|
476
521
|
.gp-cfg__err{margin:0;font-size:12px;color:var(--dsw-alias-state-error-primary)}
|
|
477
522
|
.gp-cfg__card{display:flex;flex-direction:column;gap:10px;padding:12px 14px;border:1px solid var(--dsw-alias-border-l2);border-radius:10px;background:var(--dsw-alias-bg-layer-2)}
|
|
@@ -622,12 +667,12 @@ a.gp-statusbar__repo:hover{background:var(--dsw-alias-interactive-bg-hover);colo
|
|
|
622
667
|
@media (prefers-reduced-motion:reduce){
|
|
623
668
|
.gp-sheet,.gp-sheet-backdrop,.gp-modal,.gp-modal-backdrop,.gp-zl-mask{animation:none}
|
|
624
669
|
}
|
|
625
|
-
`,vn=!1;function Zn(){if(vn||typeof document>"u")return;let e="dsh-git-panel/client.css";if(document.querySelector(`style[data-plugin-css="${e}"]`)!==null){vn=!0;return}let t=document.createElement("style");t.dataset.plugin="@xbzbing/dsh-git-panel",t.dataset.pluginCss=e,t.textContent=Xa,document.head.appendChild(t),vn=!0}var er={"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","common.cancel":"\u53D6\u6D88","ops.aiHint":"\u63D0\u793A\uFF1A\u7ED9 AI \u591A\u4E00\u70B9\u4FE1\u4EFB\uFF0C\u4F60\u53EF\u4EE5\u5C1D\u8BD5\u8BA9 AI \u76F4\u63A5\u6267\u884C Git \u64CD\u4F5C\u3002","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":"\u8BBF\u95EE GitHub \u67E5\u770B @xbzbing/dsh-git-panel \u9879\u76EE\uFF0C\u8BF7\u4E3A\u9879\u76EE\u70B9\u4EAE\u4E00\u9897\u5C0F\u661F\u661F\u5427 \u2B50","overview.head":"\u5168\u90E8\u5206\u652F","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.changeSummary":"{files} \u4E2A\u6587\u4EF6","overview.expandDir":"\u5C55\u5F00\u76EE\u5F55","overview.collapseDir":"\u6298\u53E0\u76EE\u5F55","overview.fetch":"\u62C9\u53D6\u8FDC\u7A0B","overview.branchesError":"\u5206\u652F\u52A0\u8F7D\u5931\u8D25","overview.filterBranch":"\u6309\u5206\u652F\u7B5B\u9009","overview.backToList":"\u8FD4\u56DE\u5217\u8868","overview.createTag":"\u521B\u5EFA\u6807\u7B7E","overview.revert":"\u8FD8\u539F\u6B64\u63D0\u4EA4","overview.reset":"\u91CD\u7F6E\u5230\u6B64","switch.action":"\u5207\u6362","switch.rowTitle":"\u5207\u6362\u5230 {name}","switch.rowTitleTrack":"\u4ECE {ref} \u65B0\u5EFA\u8DDF\u8E2A\u5206\u652F {name} \u5E76\u5207\u6362","switch.detached":"\u6E38\u79BB HEAD","switch.confirmTitle":"\u5207\u6362\u5206\u652F","switch.body":"\u4ECE {from} \u5207\u6362\u5230 {to}\u3002","switch.trackingNote":"\u672C\u5730\u8FD8\u6CA1\u6709 {name}\uFF0C\u5C06\u5148\u4ECE {ref} \u521B\u5EFA\u5B83\u5E76\u8BBE\u7F6E\u8DDF\u8E2A\uFF08upstream\uFF09\u3002","switch.dirtyWarn":"\u5F53\u524D\u6709 {count} \u4E2A\u6587\u4EF6\u5B58\u5728\u672A\u63D0\u4EA4\u53D8\u66F4\u3002","switch.modeDirect":"\u76F4\u63A5\u5207\u6362","switch.modeDirectHint":"\u672A\u63D0\u4EA4\u53D8\u66F4\u4F1A\u968F\u5DE5\u4F5C\u533A\u5E26\u8FC7\u53BB\uFF1B\u82E5\u4E0E\u76EE\u6807\u5206\u652F\u51B2\u7A81\uFF0CGit \u4F1A\u62D2\u7EDD\u5207\u6362\uFF0C\u5DE5\u4F5C\u533A\u4FDD\u6301\u4E0D\u53D8\u3002","switch.modeStash":"\u5148\u8D2E\u85CF {count} \u4E2A\u6587\u4EF6\u7684\u53D8\u66F4\uFF0C\u518D\u5207\u6362","switch.modeStashHint":"\u53D8\u66F4\u79FB\u5165\u8D2E\u85CF\u6808\u9876\uFF08\u542B\u672A\u8DDF\u8E2A\u6587\u4EF6\uFF09\uFF0C\u5207\u6362\u540E\u53EF\u4ECE\u300C\u53D8\u66F4\u8BB0\u5F55 \u2192 \u8D2E\u85CF\u300D\u6062\u590D\u3002\u6CE8\u610F\uFF1A\u4E0D\u4F1A\u81EA\u52A8\u6062\u590D\uFF1B\u6062\u590D\u65F6\u82E5\u4E0E\u76EE\u6807\u5206\u652F\u51B2\u7A81\u9700\u624B\u52A8\u89E3\u51B3\u3002","switch.confirm":"\u5207\u6362","switch.confirmStash":"\u8D2E\u85CF\u5E76\u5207\u6362","switch.switching":"\u6B63\u5728\u5207\u6362\u2026","switch.stashMessage":"\u5207\u6362\u5230 {branch} \u524D\u81EA\u52A8\u8D2E\u85CF","tag.createTitle":"\u5728\u6B64\u63D0\u4EA4\u521B\u5EFA\u6807\u7B7E","tag.namePlaceholder":"\u6807\u7B7E\u540D","tag.annotated":"\u9644\u6CE8\u6807\u7B7E\uFF08\u5E26\u8BF4\u660E\uFF09","tag.messagePlaceholder":"\u6807\u7B7E\u8BF4\u660E","tag.create":"\u521B\u5EFA\u6807\u7B7E","tag.deleteTitle":"\u5220\u9664\u6807\u7B7E","tag.deleteConfirm":"\u786E\u5B9A\u5220\u9664\u6807\u7B7E\u300C{name}\u300D\uFF1F","tag.deleteOne":"\u5220\u9664\u6807\u7B7E\u300C{name}\u300D","ops.dirtyWarn":"\u68C0\u6D4B\u5230\u672A\u63D0\u4EA4\u6539\u52A8\uFF0C\u8FD9\u4E9B\u6539\u52A8\u53EF\u80FD\u662F dsh AI \u6B63\u5728\u8FDB\u884C\u7684\u5DE5\u4F5C\u3002","revert.title":"\u8FD8\u539F\u63D0\u4EA4","revert.body":"\u5C06\u5728\u5F53\u524D HEAD \u8FFD\u52A0\u4E00\u4E2A\u53CD\u5411\u63D0\u4EA4\uFF0C\u8FD8\u539F {ref} \u7684\u6539\u52A8\u3002\u4E0D\u4F1A\u4E22\u5F03\u4F60\u7684\u5DE5\u4F5C\u533A\u6539\u52A8\u3002","revert.confirm":"\u8FD8\u539F","reset.title":"\u91CD\u7F6E\u5206\u652F","reset.body":"\u5C06\u628A\u5F53\u524D\u5206\u652F\u7684 HEAD \u4ECE {from} \u79FB\u52A8\u5230 {to}\u3002","reset.modeSoft":"\u8F6F\u91CD\u7F6E\uFF08--soft\uFF09","reset.softHint":"\u79FB\u52A8 HEAD\uFF0C\u6539\u52A8\u4FDD\u7559\u5728\u6682\u5B58\u533A\u3002","reset.modeMixed":"\u6DF7\u5408\u91CD\u7F6E\uFF08--mixed\uFF0C\u9ED8\u8BA4\uFF09","reset.mixedHint":"\u79FB\u52A8 HEAD\uFF0C\u6539\u52A8\u4FDD\u7559\u5728\u5DE5\u4F5C\u533A\u3002","reset.modeHard":"\u786C\u91CD\u7F6E\uFF08--hard\uFF09","reset.hardHint":"\u79FB\u52A8 HEAD \u5230\u6B64\u63D0\u4EA4\u5E76\u4E22\u5F03\u6240\u6709\u672A\u63D0\u4EA4\u6539\u52A8\uFF08\u672A\u63D0\u4EA4\u6539\u52A8\u65E0\u6CD5\u6062\u590D\uFF09\u3002","reset.hardOrphan":"\u5F53\u524D\u5206\u652F\u4E0A\u665A\u4E8E\u76EE\u6807\u7684\u63D0\u4EA4\u4F1A\u79BB\u5F00\u5206\u652F\uFF08\u4ECD\u53EF\u7528 git reflog \u627E\u56DE\uFF09\u3002","reset.hardWarn":"\u4EE5\u4E0B\u672A\u63D0\u4EA4\u6539\u52A8\u5C06\u88AB\u6C38\u4E45\u4E22\u5F03\uFF1A","reset.lostMore":"\u2026\u8FD8\u6709\u66F4\u591A\u672A\u63D0\u4EA4\u6539\u52A8\u672A\u663E\u793A\uFF08\u5217\u8868\u5DF2\u622A\u65AD\uFF09","reset.hardAck":"\u6211\u5DF2\u4E86\u89E3\uFF0C\u786E\u8BA4\u4E22\u5F03\u8FD9\u4E9B\u672A\u63D0\u4EA4\u6539\u52A8","reset.hardAckClean":"\u6211\u5DF2\u4E86\u89E3\u6B64\u64CD\u4F5C\u7684\u540E\u679C\uFF0C\u786E\u8BA4\u91CD\u7F6E","reset.confirm":"\u91CD\u7F6E","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","changes.backToList":"\u8FD4\u56DE\u5217\u8868","changes.stash":"\u8D2E\u85CF\u66F4\u6539","stash.title":"\u8D2E\u85CF\u5F53\u524D\u66F4\u6539","stash.messagePlaceholder":"\u8D2E\u85CF\u8BF4\u660E\uFF08\u53EF\u9009\uFF09","stash.save":"\u8D2E\u85CF","stash.section":"\u8D2E\u85CF","stash.onBranch":"\u4F4D\u4E8E {branch}","stash.apply":"\u5E94\u7528","stash.pop":"\u5F39\u51FA","stash.drop":"\u4E22\u5F03","stash.dropTitle":"\u4E22\u5F03\u8D2E\u85CF","stash.dropConfirm":"\u786E\u5B9A\u4E22\u5F03\u6B64\u8D2E\u85CF\u6761\u76EE\uFF1F\u4E22\u5F03\u540E\u65E0\u6CD5\u6062\u590D\uFF1A{name}","files.selectFile":"\u9009\u62E9\u4E00\u4E2A\u6587\u4EF6\u67E5\u770B\u5185\u5BB9","files.loadFailed":"\u52A0\u8F7D\u5931\u8D25","files.backToTree":"\u8FD4\u56DE\u6587\u4EF6\u6811","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.highlightOff":"\u6587\u4EF6\u8F83\u5927\uFF0C\u5DF2\u5173\u95ED\u8BED\u6CD5\u9AD8\u4EAE\u4EE5\u4FDD\u6301\u6D41\u7545","files.lineTruncated":" \u2026\uFF08\u6B64\u884C\u8FC7\u957F\uFF0C\u5DF2\u622A\u65AD\uFF09","files.findPlaceholder":"\u5728\u6B64\u6587\u4EF6\u4E2D\u67E5\u627E","files.findNoMatch":"\u65E0\u5339\u914D","files.findPrev":"\u4E0A\u4E00\u4E2A","files.findNext":"\u4E0B\u4E00\u4E2A","files.findClose":"\u5173\u95ED\u67E5\u627E","files.findCase":"\u533A\u5206\u5927\u5C0F\u5199","files.previewMode":"\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.copyContent":"\u590D\u5236\u6587\u4EF6\u5185\u5BB9","files.contentCopied":"\u5185\u5BB9\u5DF2\u590D\u5236","files.contentCopyFailed":"\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","files.zoomBar":"\u56FE\u7247\u7F29\u653E","files.zoomIn":"\u653E\u5927","files.zoomOut":"\u7F29\u5C0F","files.zoomActual":"\u5B9E\u9645\u5927\u5C0F\uFF08100%\uFF09","files.zoomFit":"\u9002\u5E94\u7A97\u53E3","files.zoomFullscreen":"\u5168\u5C4F\u67E5\u770B","files.gitNotInstalled":"\u7CFB\u7EDF\u672A\u5B89\u88C5 Git\uFF0CGit \u9762\u677F\u4E0D\u53EF\u7528\uFF0C\u8BF7\u5B89\u88C5 Git \u5DE5\u5177\u540E\u91CD\u8BD5\u3002","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}","stats.partial":"\u7EDF\u8BA1\u5DF2\u7B80\u5316","stats.partialHint":"\u53D8\u66F4\u6570\u91CF\u8F83\u591A\uFF0C\u5DF2\u8DF3\u8FC7\u672A\u8DDF\u8E2A\u6587\u4EF6\u884C\u6570\u4E0E\u6700\u8FD1\u53D8\u66F4\u65F6\u95F4\u7684\u7CBE\u786E\u7EDF\u8BA1\u4EE5\u4FDD\u6301\u9762\u677F\u6D41\u7545\u3002","commit.placeholder":"\u63D0\u4EA4\u4FE1\u606F","commit.commit":"\u63D0\u4EA4","commit.amend":"\u4FEE\u6B63\u4E0A\u6B21\u63D0\u4EA4\uFF08amend\uFF09","commit.suggest":"AI \u751F\u6210","commit.suggesting":"\u751F\u6210\u4E2D\u2026","commit.suggestOverwrite":"\u518D\u6B21\u70B9\u51FB\u300CAI \u751F\u6210\u300D\u4EE5\u8986\u76D6\u5F53\u524D\u63D0\u4EA4\u4FE1\u606F","commit.suggestTruncated":"diff \u8FC7\u957F\u5DF2\u622A\u65AD\uFF0C\u751F\u6210\u7684\u5EFA\u8BAE\u53EF\u80FD\u4E0D\u5B8C\u6574","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","diff.expandCapped":"\u6587\u4EF6\u8F83\u5927\uFF0C\u5DF2\u5C55\u5F00 {n} \u884C\u4E0A\u4E0B\u6587\uFF0C\u5176\u4F59\u4FDD\u6301\u6298\u53E0\uFF0C\u53EF\u9010\u6BB5\u5C55\u5F00","diff.truncated":"git \u8F93\u51FA\u8D85\u51FA\u4E0A\u9650\uFF0C\u4EE5\u4E0B\u5DEE\u5F02\u88AB\u622A\u65AD\uFF0C\u884C\u53F7\u4E0E\u589E\u5220\u7EDF\u8BA1\u53EF\u80FD\u4E0D\u5B8C\u6574","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\u64CD\u4F5C\u88AB\u963B\u6B62","error.emptyMessage":"\u63D0\u4EA4\u4FE1\u606F\u4E0D\u80FD\u4E3A\u7A7A","error.emptyDiff":"\u6CA1\u6709\u53EF\u751F\u6210\u7684\u53D8\u66F4","error.llmUnavailable":"AI \u670D\u52A1\u4E0D\u53EF\u7528","error.llmFailed":"AI \u751F\u6210\u5931\u8D25","error.suggestDisabled":"AI \u751F\u6210\u5DF2\u5728\u63D2\u4EF6\u914D\u7F6E\u4E2D\u5173\u95ED","error.conflict":"\u8D2E\u85CF\u5E94\u7528\u4EA7\u751F\u51B2\u7A81\uFF0C\u8D2E\u85CF\u6761\u76EE\u5DF2\u4FDD\u7559\uFF0C\u8BF7\u624B\u52A8\u89E3\u51B3\u51B2\u7A81\u540E\u518D\u8BD5","error.revertConflict":"\u8FD8\u539F\u4F1A\u4E0E\u5F53\u524D\u5185\u5BB9\u51B2\u7A81\uFF0C\u5DF2\u81EA\u52A8\u53D6\u6D88\u8FD8\u539F\uFF08\u672A\u6539\u52A8\u4F60\u7684\u5DE5\u4F5C\u533A\uFF09","error.revertStuck":"\u8FD8\u539F\u4EA7\u751F\u51B2\u7A81\u4E14\u81EA\u52A8\u53D6\u6D88\u5931\u8D25\uFF0C\u4ED3\u5E93\u4ECD\u5904\u4E8E\u8FD8\u539F\u4E2D\uFF0C\u8BF7\u624B\u52A8\u6267\u884C git revert --abort \u6216\u89E3\u51B3\u51B2\u7A81","error.revertMerge":"\u8FD9\u662F\u4E00\u4E2A\u5408\u5E76\u63D0\u4EA4\uFF0C\u9762\u677F\u6682\u4E0D\u652F\u6301\u8FD8\u539F\uFF08\u9700\u6307\u5B9A\u4E3B\u7EBF\u7236\u63D0\u4EA4\uFF09\uFF0C\u8BF7\u5728\u547D\u4EE4\u884C\u7528 git revert -m \u5904\u7406","error.indexBusy":"Git \u6B63\u5FD9\uFF08\u53E6\u4E00\u8FDB\u7A0B\u5360\u7528\u7D22\u5F15\uFF09\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5","error.notFound":"\u76EE\u6807\u4E0D\u5B58\u5728\uFF08\u5206\u652F / \u6807\u7B7E / \u8D2E\u85CF\u53EF\u80FD\u5DF2\u88AB\u5220\u9664\u6216\u91CD\u547D\u540D\uFF09","error.branchInUse":"\u8BE5\u5206\u652F\u5DF2\u5728\u53E6\u4E00\u4E2A\u5DE5\u4F5C\u6811\u4E2D\u68C0\u51FA\uFF0C\u65E0\u6CD5\u5728\u6B64\u5207\u6362","error.stashSwitchFailed":"\u672A\u63D0\u4EA4\u53D8\u66F4\u5DF2\u8D2E\u85CF\uFF08\u53EF\u5728\u300C\u53D8\u66F4\u8BB0\u5F55 \u2192 \u8D2E\u85CF\u300D\u6062\u590D\uFF09\uFF0C\u4F46\u5207\u6362\u5931\u8D25\uFF1A{reason}","error.invalidName":"\u540D\u79F0\u4E0D\u5408\u6CD5","error.notFastForward":"\u672C\u5730\u4E0E\u8FDC\u7A0B\u5206\u652F\u5DF2\u5206\u53C9\uFF0C\u65E0\u6CD5\u5FEB\u8FDB\u62C9\u53D6\uFF0C\u8BF7\u624B\u52A8\u5408\u5E76\u6216\u53D8\u57FA","error.pushRejected":"\u63A8\u9001\u88AB\u62D2\u7EDD\uFF1A\u8FDC\u7A0B\u5DF2\u6709\u65B0\u63D0\u4EA4\uFF0C\u8BF7\u5148\u300C\u68C0\u67E5\u540C\u6B65\u300D\u5E76\u62C9\u53D6\u540E\u518D\u63A8\u9001","error.authFailed":"\u8BA4\u8BC1\u5931\u8D25\uFF1A\u6CA1\u6709\u53EF\u7528\u7684 git \u51ED\u636E\uFF08HTTPS \u9700\u51ED\u636E\u52A9\u624B\u3001SSH \u9700\u5BC6\u94A5\uFF09\u3002\u8BF7\u5148\u5728\u547D\u4EE4\u884C\u5B8C\u6210\u4E00\u6B21\u63A8\u9001\u4EE5\u7F13\u5B58\u51ED\u636E","status.openRepo":"\u5728\u6D4F\u89C8\u5668\u6253\u5F00\u4ED3\u5E93\u4E3B\u9875","status.openRepoOn":"\u5728 {host} \u6253\u5F00\u4ED3\u5E93\u4E3B\u9875","status.synced":"\u5DF2\u4E0E\u8FDC\u7A0B\u540C\u6B65","status.ahead":"\u9886\u5148 {n}","status.behind":"\u843D\u540E {n}","status.diverged":"\u5DF2\u5206\u53C9\uFF08\u9886\u5148 {ahead} / \u843D\u540E {behind}\uFF09","status.noUpstream":"\u672A\u8DDF\u8E2A\u8FDC\u7A0B\u5206\u652F","status.detached":"\u6E38\u79BB HEAD\uFF0C\u65E0\u5206\u652F\u540C\u6B65\u72B6\u6001","status.check":"\u68C0\u67E5\u540C\u6B65\u72B6\u6001","status.checkTitle":"\u68C0\u67E5\u4E0E\u8FDC\u7A0B\u7684\u540C\u6B65\u72B6\u6001\uFF1A\u6267\u884C git fetch \u62C9\u53D6\u6700\u65B0\u5F15\u7528\u5E76\u5237\u65B0\u9886\u5148/\u843D\u540E\u8BA1\u6570\uFF0C\u4E0D\u6539\u52A8\u5DE5\u4F5C\u533A","status.pull":"\u62C9\u53D6","status.pulling":"\u540C\u6B65\u4E2D\u2026","status.pullTitle":"\u5FEB\u8FDB\u62C9\u53D6\u8FDC\u7A0B\u66F4\u65B0","status.pullConfirmTitle":"\u62C9\u53D6\u8FDC\u7A0B\u66F4\u65B0","status.pullConfirmBody":"\u5C06\u4EE5\u5FEB\u8FDB\u65B9\u5F0F\u628A\u5F53\u524D\u5206\u652F {branch} \u66F4\u65B0\u5230\u8FDC\u7A0B\u6700\u65B0\u63D0\u4EA4\uFF08\u843D\u540E {behind} \u4E2A\u63D0\u4EA4\uFF09\u3002\u4EC5\u5728\u672A\u5206\u53C9\u65F6\u53EF\u884C\uFF0C\u4E0D\u4F1A\u4EA7\u751F\u5408\u5E76\u63D0\u4EA4\uFF0C\u4E5F\u4E0D\u4F1A\u6539\u52A8\u4F60\u7684\u672A\u63D0\u4EA4\u5185\u5BB9\u3002","status.pullConfirm":"\u62C9\u53D6","status.pullScope":"\u5C06\u5F15\u5165 {commits} \u4E2A\u63D0\u4EA4 \xB7 {files} \u4E2A\u6587\u4EF6 \xB7 +{ins} / \u2212{del} \u884C","status.pullScopeLoading":"\u6B63\u5728\u7EDF\u8BA1\u8FDC\u7A0B\u5DEE\u5F02\u2026","status.push":"\u63A8\u9001","status.pushTitle":"\u63A8\u9001\u672C\u5730\u63D0\u4EA4\u5230\u8FDC\u7A0B","status.pushConfirmTitle":"\u63A8\u9001\u5230\u8FDC\u7A0B","status.pushConfirmBody":"\u5C06\u628A\u5F53\u524D\u5206\u652F {branch} \u9886\u5148\u8FDC\u7A0B\u7684 {ahead} \u4E2A\u63D0\u4EA4\u63A8\u9001\u5230\u4E0A\u6E38\u3002\u4EC5\u505A\u5FEB\u8FDB\u63A8\u9001\uFF0C\u4E0D\u4F1A\u5F3A\u5236\u8986\u76D6\u8FDC\u7A0B\u5386\u53F2\u3002","status.pushConfirm":"\u63A8\u9001","status.pushing":"\u63A8\u9001\u4E2D\u2026","status.pushScope":"\u5C06\u63A8\u9001 {commits} \u4E2A\u63D0\u4EA4 \xB7 {files} \u4E2A\u6587\u4EF6 \xB7 +{ins} / \u2212{del} \u884C","status.pushScopeLoading":"\u6B63\u5728\u7EDF\u8BA1\u5F85\u63A8\u9001\u5DEE\u5F02\u2026","status.publish":"\u53D1\u5E03","status.publishTitle":"\u53D1\u5E03\u5206\u652F\u5E76\u8BBE\u7F6E\u4E0A\u6E38","status.publishConfirmTitle":"\u53D1\u5E03\u5206\u652F\u5230\u8FDC\u7A0B","status.publishConfirmBody":"\u5F53\u524D\u5206\u652F {branch} \u5C1A\u672A\u8DDF\u8E2A\u8FDC\u7A0B\u3002\u5C06\u6267\u884C git push -u {remote} \u5728\u8FDC\u7A0B\u521B\u5EFA\u540C\u540D\u5206\u652F\u5E76\u8BBE\u4E3A\u4E0A\u6E38\u8DDF\u8E2A\u3002","status.publishConfirm":"\u53D1\u5E03","status.publishing":"\u53D1\u5E03\u4E2D\u2026","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.graphTitle":"\u63D0\u4EA4\u5386\u53F2\u56FE\u7EBF\u6761\u6837\u5F0F","cfg.graphHint":"\u9009\u62E9\u63D0\u4EA4\u5386\u53F2\u56FE\u7684\u8FDE\u7EBF\u753B\u6CD5\uFF1A\u5E73\u884C\u7EBF\u4E3A VSCode / \u56FE\u5F62\u754C\u9762\u98CE\u683C\uFF0C\u5206\u652F\u5404\u5360\u4E00\u5217\u3001\u5171\u4EAB\u7956\u5148\u4EE5\u5E76\u884C\u7EBF\u8868\u793A\uFF1B\u7D27\u51D1\u4E3A git log \u547D\u4EE4\u884C\u98CE\u683C\uFF0C\u5171\u4EAB\u7956\u5148\u5408\u5E76\u4E3A\u4E00\u5217\u3001\u7EBF\u66F4\u5C11\u3002\u4FDD\u5B58\u540E\u7ACB\u5373\u751F\u6548\u3002","cfg.graphParallel":"\u5E73\u884C\u7EBF\uFF08VSCode \u98CE\u683C\uFF09","cfg.graphCompact":"\u7D27\u51D1\uFF08git log \u98CE\u683C\uFF09","cfg.suggestTitle":"AI \u751F\u6210\u63D0\u4EA4\u4FE1\u606F","cfg.suggestToggle":"\u63D0\u4EA4\u6846\u663E\u793A AI \u751F\u6210\u6309\u94AE","cfg.suggestMaxBytesLabel":"\u8F93\u5165\u9884\u7B97","cfg.suggestMaxBytesUnit":"KiB","cfg.suggestMaxBytesHint":"\u53D1\u9001\u7ED9\u6A21\u578B\u7684 diff \u4E0A\u9650\uFF0C\u8D85\u51FA\u4F1A\u622A\u65AD\uFF1B\u8303\u56F4 16\u2013512\u3002","cfg.suggestOutputLabel":"\u8F93\u51FA\u4E0A\u9650","cfg.suggestOutputUnit":"tokens","cfg.suggestOutputHint":"\u6A21\u578B\u751F\u6210\u9884\u7B97\uFF1B\u601D\u8003\u6A21\u578B\u7684\u63A8\u7406\u8BA1\u5165\u8BE5\u9884\u7B97\uFF1B\u8303\u56F4 256\u201316384\u3002","cfg.suggestTimeoutLabel":"\u751F\u6210\u8D85\u65F6","cfg.suggestTimeoutUnit":"\u79D2","cfg.suggestTimeoutHint":"\u8D85\u65F6\u5373\u751F\u6210\u5931\u8D25\uFF1B\u8303\u56F4 5\u2013120\u3002","cfg.suggestHint":"\u5F00\u542F\u540E\u63D0\u4EA4\u6846\u65C1\u4F1A\u51FA\u73B0\u300CAI \u751F\u6210\u300D\u6309\u94AE\uFF1A\u6839\u636E\u5F53\u524D\u53D8\u66F4\u4E0E\u6700\u8FD1\u63D0\u4EA4\u98CE\u683C\u751F\u6210\u63D0\u4EA4\u4FE1\u606F\uFF0C\u586B\u5165\u540E\u53EF\u7F16\u8F91\u518D\u63D0\u4EA4\u3002\u751F\u6210\u7684\u8BF7\u6C42\u4F1A\u4F7F\u7528\u4F60\u5728 DSH \u4E2D\u914D\u7F6E\u7684\u6A21\u578B\uFF0Cdiff \u5185\u5BB9\u4F1A\u53D1\u9001\u7ED9\u6A21\u578B\u4F9B\u5E94\u5546\u3002\u4FDD\u5B58\u540E\u7ACB\u5373\u751F\u6548\u3002","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"},tr={"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","common.cancel":"Cancel","ops.aiHint":"Tip: Trust AI more, try direct Git\u2011operation execution by AI.","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":"Visit @xbzbing/dsh-git-panel on GitHub \u2014 please give the project a little star \u2B50","overview.head":"All branches","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.changeSummary":"{files} files","overview.expandDir":"Expand folder","overview.collapseDir":"Collapse folder","overview.fetch":"Fetch","overview.branchesError":"Failed to load branches","overview.filterBranch":"Filter by branch","overview.backToList":"Back to list","overview.createTag":"Create tag","switch.action":"Switch","switch.rowTitle":"Switch to {name}","switch.rowTitleTrack":"Create {name} tracking {ref} and switch to it","switch.detached":"detached HEAD","switch.confirmTitle":"Switch branch","switch.body":"Switch from {from} to {to}.","switch.trackingNote":"There is no local {name} yet: it will be created from {ref} and set to track it.","switch.dirtyWarn":"{count} file(s) have uncommitted changes.","switch.modeDirect":"Switch directly","switch.modeDirectHint":"Uncommitted changes come along; if they collide with the target branch, git refuses the switch and the work tree stays untouched.","switch.modeStash":"Stash the {count} file(s) first, then switch","switch.modeStashHint":"The changes (including untracked files) move to the top of the stash; restore them from Changes \u2192 Stash afterwards. Note: they are not restored automatically, and restoring may need manual conflict resolution.","switch.confirm":"Switch","switch.confirmStash":"Stash and switch","switch.switching":"Switching\u2026","switch.stashMessage":"Auto-stash before switching to {branch}","overview.revert":"Revert this commit","overview.reset":"Reset to here","tag.createTitle":"Create a tag at this commit","tag.namePlaceholder":"Tag name","tag.annotated":"Annotated tag (with message)","tag.messagePlaceholder":"Tag message","tag.create":"Create tag","tag.deleteTitle":"Delete tag","tag.deleteConfirm":'Delete tag "{name}"?',"tag.deleteOne":'Delete tag "{name}"',"ops.dirtyWarn":"There are uncommitted changes \u2014 they may be work the dsh AI is doing.","revert.title":"Revert commit","revert.body":"Appends a reverse commit at the current HEAD that undoes the changes in {ref}. Your working-tree changes are kept.","revert.confirm":"Revert","reset.title":"Reset branch","reset.body":"Moves the current branch HEAD from {from} to {to}.","reset.modeSoft":"Soft (--soft)","reset.softHint":"Moves HEAD; changes stay staged.","reset.modeMixed":"Mixed (--mixed, default)","reset.mixedHint":"Moves HEAD; changes stay in the working tree.","reset.modeHard":"Hard (--hard)","reset.hardHint":"Moves HEAD to this commit and discards all uncommitted changes (uncommitted changes cannot be recovered).","reset.hardOrphan":"Commits after the target leave the branch (still recoverable via git reflog).","reset.hardWarn":"The following uncommitted changes will be permanently discarded:","reset.lostMore":"\u2026 more uncommitted changes not shown (list capped)","reset.hardAck":"I understand these uncommitted changes will be lost","reset.hardAckClean":"I understand the consequences and confirm the reset","reset.confirm":"Reset","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","changes.backToList":"Back to list","changes.stash":"Stash changes","stash.title":"Stash current changes","stash.messagePlaceholder":"Stash message (optional)","stash.save":"Stash","stash.section":"Stashes","stash.onBranch":"on {branch}","stash.apply":"Apply","stash.pop":"Pop","stash.drop":"Drop","stash.dropTitle":"Drop stash","stash.dropConfirm":"Drop this stash? This cannot be undone: {name}","files.selectFile":"Select a file to preview","files.loadFailed":"Load failed","files.backToTree":"Back to files","files.truncated":"Too many entries \u2014 truncated","files.tooLarge":"File too large to preview","files.binary":"Binary file \u2014 no preview","files.highlightOff":"Large file \u2014 syntax highlighting disabled for performance","files.lineTruncated":" \u2026 (line too long, truncated)","files.findPlaceholder":"Find in file","files.findNoMatch":"No results","files.findPrev":"Previous match","files.findNext":"Next match","files.findClose":"Close find","files.findCase":"Match case","files.previewMode":"Preview mode","files.source":"Source","files.render":"Rendered","files.copyPath":"Copy relative path","files.pathCopied":"Path copied","files.pathCopyFailed":"Copy failed","files.copyContent":"Copy file content","files.contentCopied":"Content copied","files.contentCopyFailed":"Copy failed","files.ignored":"Ignored by Git","files.copy":"Copy code","files.copied":"Copied","files.footnotes":"Footnotes","files.zoomBar":"Image zoom","files.zoomIn":"Zoom in","files.zoomOut":"Zoom out","files.zoomActual":"Actual size (100%)","files.zoomFit":"Fit to window","files.zoomFullscreen":"View fullscreen","files.gitNotInstalled":"Git is not installed; the Git panel is unavailable. Please install Git and try again.","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","stats.partial":"simplified","stats.partialHint":"Large change set \u2014 untracked line counts and last-change time are omitted to keep the panel responsive.","commit.placeholder":"Commit message","commit.commit":"Commit","commit.amend":"Amend previous commit","commit.suggest":"AI suggest","commit.suggesting":"Generating\u2026","commit.suggestOverwrite":'Click "AI suggest" again to replace the current message',"commit.suggestTruncated":"The diff was truncated; the suggestion may be incomplete","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","diff.expandCapped":"Large file: expanded {n} lines of context; the rest stays collapsed and can be expanded in place","diff.truncated":"git output exceeded the output cap: this diff is truncated, so line numbers and +/- counts past the cut may be wrong","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 this operation","error.emptyMessage":"Commit message cannot be empty","error.emptyDiff":"No changes to summarize","error.llmUnavailable":"AI service unavailable","error.llmFailed":"AI generation failed","error.suggestDisabled":"AI suggest is turned off in the plugin config","error.conflict":"Applying the stash produced conflicts; the stash entry is kept \u2014 resolve them and retry","error.revertConflict":"The revert would conflict with the current content; it was cancelled automatically (your working tree is unchanged)","error.revertStuck":"The revert conflicted and could not be auto-cancelled; the repository is mid-revert \u2014 run `git revert --abort` or resolve it manually","error.revertMerge":"This is a merge commit; the panel cannot revert it (a mainline parent is required) \u2014 use `git revert -m` on the command line","error.indexBusy":"Git is busy (another process holds the index lock); try again shortly","error.notFound":"Target not found (the branch / tag / stash may have been removed or renamed)","error.branchInUse":"That branch is checked out in another worktree, so it cannot be switched to here","error.stashSwitchFailed":"The uncommitted changes were stashed (restore them from Changes \u2192 Stash), but the switch failed: {reason}","error.invalidName":"Invalid name","error.notFastForward":"Local and remote have diverged \u2014 a fast-forward pull is not possible; merge or rebase manually","error.pushRejected":"Push rejected: the remote has new commits \u2014 run \u201CCheck sync\u201D and pull first, then push","error.authFailed":"Authentication failed: no usable git credentials (HTTPS needs a credential helper, SSH needs a key). Push once from the command line first to cache them","status.openRepo":"Open the repository home in the browser","status.openRepoOn":"Open the repository home on {host}","status.synced":"Up to date with remote","status.ahead":"{n} ahead","status.behind":"{n} behind","status.diverged":"Diverged ({ahead} ahead / {behind} behind)","status.noUpstream":"No upstream branch","status.detached":"Detached HEAD \u2014 no branch sync state","status.check":"Check sync status","status.checkTitle":"Check sync with the remote: runs git fetch to update refs and refresh the ahead/behind counts; your working tree is untouched","status.pull":"Pull","status.pulling":"Syncing\u2026","status.pullTitle":"Fast-forward pull of remote updates","status.pullConfirmTitle":"Pull remote updates","status.pullConfirmBody":"Fast-forwards the current branch {branch} to the latest remote commit ({behind} behind). Only possible when not diverged; it creates no merge commit and leaves your uncommitted work untouched.","status.pullConfirm":"Pull","status.pullScope":"Brings in {commits} commits \xB7 {files} files \xB7 +{ins} / \u2212{del} lines","status.pullScopeLoading":"Measuring incoming changes\u2026","status.push":"Push","status.pushTitle":"Push local commits to the remote","status.pushConfirmTitle":"Push to remote","status.pushConfirmBody":"Pushes the {ahead} commits that {branch} is ahead of the remote to its upstream. Fast-forward only \u2014 it never force-overwrites remote history.","status.pushConfirm":"Push","status.pushing":"Pushing\u2026","status.pushScope":"Pushes {commits} commits \xB7 {files} files \xB7 +{ins} / \u2212{del} lines","status.pushScopeLoading":"Measuring outgoing changes\u2026","status.publish":"Publish","status.publishTitle":"Publish the branch and set its upstream","status.publishConfirmTitle":"Publish branch to remote","status.publishConfirmBody":"The current branch {branch} has no upstream yet. This runs git push -u {remote} to create a same-named branch on the remote and set it as the upstream.","status.publishConfirm":"Publish","status.publishing":"Publishing\u2026","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.graphTitle":"Commit graph line style","cfg.graphHint":"Choose how the commit graph draws its lines: parallel is the VSCode / GUI style \u2014 each branch keeps its own column and a shared ancestor shows as parallel lines; compact is the git log style \u2014 a shared ancestor merges into one column with fewer lines. Saved changes apply immediately.","cfg.graphParallel":"Parallel (VSCode style)","cfg.graphCompact":"Compact (git log style)","cfg.suggestTitle":"AI commit message","cfg.suggestToggle":"Show AI suggest button in the commit box","cfg.suggestMaxBytesLabel":"Input budget","cfg.suggestMaxBytesUnit":"KiB","cfg.suggestMaxBytesHint":"Diff bytes sent to the model; beyond it the diff is truncated. Range 16\u2013512.","cfg.suggestOutputLabel":"Output limit","cfg.suggestOutputUnit":"tokens","cfg.suggestOutputHint":"Model generation budget; reasoning tokens count against it on thinking models. Range 256\u201316384.","cfg.suggestTimeoutLabel":"Generation timeout","cfg.suggestTimeoutUnit":"s","cfg.suggestTimeoutHint":"Generation fails after the timeout. Range 5\u2013120.","cfg.suggestHint":'When on, an "AI suggest" button appears beside the commit button: it writes a commit message from the current changes and the recent commit style, filled in for you to edit before committing. Generation uses the model configured in DSH; the diff is sent to that model provider. Saved changes apply immediately.',"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 Ot=require("react");var Ka=new Set(["cwd-unavailable"]),wn=3e4,Ja=6e4,Bt=class{constructor(t,n){this.remote=t;this.sessionId=n}view={state:"cold"};listeners=new Set;timer;inflight;pendingRefresh=!1;disposed=!1;pollMs=wn;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||wn,this.setView({state:"ready",snapshot:t.value});else if(t.error.code!=="cancelled")if(Ka.has(t.error.code))this.pollMs=Ja,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 if(t.error.code==="git-unavailable"){let n=t.error;this.setView({state:"error",error:{code:"git-unavailable",...n.detail?{detail:n.detail}:{},...n.cwd?{cwd:n.cwd}:{},...n.isGitRepo!==void 0?{isGitRepo:n.isGitRepo}:{}}})}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||wn,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 Va="/api",Wa="gitPanel";function qa(e){try{let t=e.get("connection")?.rpc,n=t?.call;if(t!==void 0&&typeof n=="function")return(a,r,i)=>n.call(t,Va,a,r,i)}catch{}}function Ua(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 me(e,t){return!e.ok||e.value.kind!==t?null:e.value}function Ze(e){return e!==void 0&&e!==""}var nr=new WeakMap;function Mt(e){let t=nr.get(e);if(t!==void 0)return t;let n=async(r,i,o)=>{let s=qa(e);if(s===void 0)return{ok:!1,error:{code:"git-unavailable",message:"no connection"}};try{let l=await s(`${Wa}/${r}`,{args:{request:i}},o);return Ua(l)}catch(l){return{ok:!1,error:{code:"git-unavailable",message:l instanceof Error?l.message:String(l)}}}},a={snapshot:(r,i)=>n("snapshot",r,i),run:(r,i)=>n("run",r,i),query:(r,i)=>n("query",r,i),suggest:(r,i)=>n("suggest",r,i),version:(r,i)=>n("version",r,i)};return nr.set(e,a),a}var it=new Map,rr,xn;function ar(e){xn=e,rr=Mt(e)}function Rt(e){let t=it.get(e);if(t===void 0){let n=rr??(xn?Mt(xn):void 0);t=new Bt(n??Za(),e),it.set(e,t)}return t}var ja=6e4,It=new Map;function Qa(e){let t=It.get(e);t!==void 0&&(clearTimeout(t),It.delete(e)),mt.set(e,(mt.get(e)??0)+1)}function Ya(e){let t=(mt.get(e)??1)-1;if(t>0){mt.set(e,t);return}mt.delete(e);let n=setTimeout(()=>{It.delete(e),!((mt.get(e)??0)>0)&&(it.get(e)?.dispose(),it.delete(e))},ja);It.set(e,n)}var mt=new Map;function Gt(){for(let e of it.values())e.resync()}function ir(){for(let e of it.values())e.dispose();it.clear()}function Za(){let e=async()=>({ok:!1,error:{code:"git-unavailable"}});return{snapshot:e,run:e,query:e,suggest:e,version:e}}function $t(e){let[,t]=(0,Ot.useState)(0),n=e?Rt(e):void 0;return(0,Ot.useEffect)(()=>{if(n===void 0||e===void 0)return;Qa(e);let a=n.subscribe(()=>t(r=>r+1));return n.ensure(),()=>{a(),Ya(e)}},[n,e]),n?n.getSnapshot():{state:"cold"}}var L=require("react");var or="[data-conversation-tabs]",Pt='[data-conversation-tabs] button[role="tab"]',kn=new Map,Dt=new Map;function sr(e,t){let n=Dt.get(e);if(n!==void 0&&n.size>0){for(let a of n)a(t);return}kn.set(e,t)}function lr(e){let t=kn.get(e);return t===void 0?null:(kn.delete(e),t)}function dr(e,t){let n=Dt.get(e);return n===void 0&&(n=new Set,Dt.set(e,n)),n.add(t),()=>{let a=Dt.get(e);a!==void 0&&(a.delete(t),a.size===0&&Dt.delete(e))}}var ei=6e4,_n=new Map;function cr(e,t){_n.set(e,{tab:t,leftAt:Date.now()})}function pr(e){let t=_n.get(e);return t===void 0?null:Date.now()-t.leftAt>ei?(_n.delete(e),null):t.tab}function ur(e){if(typeof document>"u")return!1;let t=document.querySelectorAll(Pt);for(let n of t)if((n.textContent??"").trim()===e)return n.getAttribute("aria-selected")!=="true"&&n.click(),!0;return!1}function gr(e){if(typeof document>"u")return!1;let t=document.querySelectorAll(Pt);for(let n of t)if((n.textContent??"").trim()===e)return n.getAttribute("aria-selected")==="true";return!1}function fr(e){if(typeof document>"u")return!1;let t=document.querySelectorAll(Pt);for(let n of t)if((n.textContent??"").trim()!==e)return n.getAttribute("aria-selected")!=="true"&&n.click(),!0;return!1}var c=require("react"),cn=require("react-dom");var H=require("react");function be(e,t=15){return(0,H.createElement)("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"},e)}function Xt({size:e}){return be([(0,H.createElement)("circle",{key:"c",cx:8,cy:8,r:2.4}),(0,H.createElement)("line",{key:"l1",x1:8,y1:1.5,x2:8,y2:5.6}),(0,H.createElement)("line",{key:"l2",x1:8,y1:10.4,x2:8,y2:14.5})],e)}function mr({size:e}){return be([(0,H.createElement)("path",{key:"a",d:"M4 2v8"}),(0,H.createElement)("path",{key:"b",d:"M2 4h4"}),(0,H.createElement)("circle",{key:"c",cx:4,cy:12,r:1.6}),(0,H.createElement)("circle",{key:"d",cx:12,cy:4,r:1.6}),(0,H.createElement)("path",{key:"e",d:"M12 6v4"}),(0,H.createElement)("path",{key:"f",d:"M10 12h4"})],e)}function Sn({size:e}){return be([(0,H.createElement)("circle",{key:"a",cx:4,cy:3,r:1.6}),(0,H.createElement)("circle",{key:"b",cx:4,cy:13,r:1.6}),(0,H.createElement)("circle",{key:"c",cx:12,cy:5,r:1.6}),(0,H.createElement)("path",{key:"d",d:"M4 4.6v6.8"}),(0,H.createElement)("path",{key:"e",d:"M12 6.6c0 3-4 2.4-8 4"})],e)}function ht({size:e}){return be([(0,H.createElement)("path",{key:"a",d:"M2 7V3h4l8 8-4 4z"}),(0,H.createElement)("circle",{key:"b",cx:4.5,cy:5.5,r:.8,fill:"currentColor"})],e)}function et({size:e,open:t}){return be([(0,H.createElement)("path",{key:"a",d:t?"M3 6l5 5 5-5":"M6 3l5 5-5 5"})],e)}function tt({size:e}){return be([(0,H.createElement)("path",{key:"a",d:"M4 4l8 8M12 4l-8 8"})],e)}function yt({size:e}){return be([(0,H.createElement)("path",{key:"a",d:"M10 3L5 8l5 5"}),(0,H.createElement)("path",{key:"b",d:"M5 8h8"})],e)}function hr({size:e}){return be([(0,H.createElement)("path",{key:"a",d:"M2 3h12l-4.5 5.5V13L6.5 11V8.5z"})],e)}function Kt({size:e}){return be([(0,H.createElement)("path",{key:"a",d:"M13 8a5 5 0 1 1-1.5-3.5"}),(0,H.createElement)("path",{key:"b",d:"M13 2v3h-3"})],e)}function yr({size:e}){return be([(0,H.createElement)("path",{key:"a",d:"M8 2.6l1.4 4 4 1.4-4 1.4-1.4 4-1.4-4-4-1.4 4-1.4z"}),(0,H.createElement)("path",{key:"b",d:"M13 11.6v2.8M11.6 13h2.8"})],e)}function br({size:e}){return be([(0,H.createElement)("path",{key:"a",d:"M4 2h5l3 3v9H4z"}),(0,H.createElement)("path",{key:"b",d:"M9 2v3h3"})],e)}function Cn({size:e}){return be([(0,H.createElement)("path",{key:"a",d:"M2 5.5h12V13H2z"}),(0,H.createElement)("path",{key:"b",d:"M1.5 3h13v2.5h-13z"}),(0,H.createElement)("path",{key:"c",d:"M6.5 8.5h3"})],e)}function vr({size:e}){return be([(0,H.createElement)("path",{key:"a",d:"M3 4.5h10"}),(0,H.createElement)("path",{key:"b",d:"M5.5 4.5V3h5v1.5"}),(0,H.createElement)("path",{key:"c",d:"M4.5 4.5l.7 9h5.6l.7-9"})],e)}function wr({size:e}){return be([(0,H.createElement)("path",{key:"a",d:"M3 7a5 5 0 1 1 1.3 3.4"}),(0,H.createElement)("path",{key:"b",d:"M3 3.5V7h3.5"})],e)}function Jt({size:e}){return be([(0,H.createElement)("path",{key:"a",d:"M13 3v10"}),(0,H.createElement)("path",{key:"b",d:"M10.5 8L3 3.5v9z",fill:"currentColor"})],e)}function xr({size:e}){return be([(0,H.createElement)("path",{key:"a",d:"M5 2.5h4l2.5 2.5v7.5h-6.5z"}),(0,H.createElement)("path",{key:"b",d:"M9 2.5V5h2.5"}),(0,H.createElement)("path",{key:"c",d:"M11 12.5v1.5h-6.5V6"})],e)}function kr({size:e=15}){return(0,H.createElement)("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"currentColor"},(0,H.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 _r({size:e}){return be([(0,H.createElement)("path",{key:"a",d:"M8 2.5v7"}),(0,H.createElement)("path",{key:"b",d:"M4.5 7L8 10.5 11.5 7"}),(0,H.createElement)("path",{key:"c",d:"M3 13h10"})],e)}function Tn({size:e}){return be([(0,H.createElement)("path",{key:"a",d:"M8 10.5v-7"}),(0,H.createElement)("path",{key:"b",d:"M4.5 6L8 2.5 11.5 6"}),(0,H.createElement)("path",{key:"c",d:"M3 13h10"})],e)}function Sr({size:e}){return be([(0,H.createElement)("path",{key:"a",d:"M12.5 7a4.5 4.5 0 0 0-8-2.3"}),(0,H.createElement)("path",{key:"b",d:"M3.5 9a4.5 4.5 0 0 0 8 2.3"}),(0,H.createElement)("path",{key:"c",d:"M4.3 2.2v2.5h2.5"}),(0,H.createElement)("path",{key:"d",d:"M11.7 13.8v-2.5H9.2"})],e)}function Cr({size:e=15,filled:t}){return(0,H.createElement)("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:t?"currentColor":"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"},(0,H.createElement)("path",{d:"M8 1.8l1.76 3.57 3.94.57-2.85 2.78.67 3.92L8 10.78l-3.52 1.85.67-3.92L2.3 5.94l3.94-.57z"}))}function Tr(e){let t=0;for(let n of e){t=Math.max(t,n.lane+1);for(let a of n.edges)t=Math.max(t,a.fromLane+1,a.toLane+1)}return t}function Nr(e,t){let n=[],a=[],r=[],i=[],o=0,s=()=>{if(i.length===0)return o++;let d=Math.min(...i);return i.splice(i.indexOf(d),1),d},l=d=>{d!==null&&!i.includes(d)&&i.push(d)};for(let d of e){let p=T=>{let E=a.findIndex(J=>J===T);return E===-1&&(E=a.findIndex(J=>J===null),E===-1&&(E=a.length,a.push(null),r.push(null)),a[E]=T,r[E]=s()),E},u=a.some(T=>T===d.hash),g=p(d.hash),w=r[g],k=[...a],_=[...r],S=d.parents,R=S.length>=2;for(let T=0;T<a.length;T++)T!==g&&a[T]===d.hash&&(l(r[T]),a[T]=null,r[T]=null);let $=-1,q=[];if(S.length===0)l(r[g]),a[g]=null,r[g]=null;else{let T=S[0],E=t==="compact"?a.findIndex((J,O)=>J===T&&O!==g):-1;if(E===-1)a[g]=T,$=g;else{let J=Math.min(g,E),O=Math.max(g,E);a[J]=T,l(r[O]),a[O]=null,r[O]=null,$=J}for(let J=1;J<S.length;J++)q.push(p(S[J]))}let A=[];for(let T=0;T<k.length;T++){let E=k[T];if(E!==null)if(E===d.hash){if(T===g&&!u)continue;A.push({fromLane:T,toLane:g,color:_[T],kind:"into"})}else{let J=a[T]===E?T:a.findIndex(O=>O===E);J!==-1&&A.push({fromLane:T,toLane:J,color:_[T],kind:"pass"})}}$!==-1&&A.push({fromLane:g,toLane:$,color:r[$],kind:"out"});for(let T of q)A.push({fromLane:g,toLane:T,color:r[T],kind:"out"});for(n.push({commit:d,lane:g,color:w,edges:A,merge:R});a.length>0&&a[a.length-1]===null;)a=a.slice(0,-1),r=r.slice(0,-1)}return n}function Er(e){let t={name:"",path:"",dir:!0,children:[]};for(let n of e){let a=n.path.split("/").filter(o=>o!==""),r=t,i="";for(let o=0;o<a.length;o++){let s=a[o];i=i===""?s:`${i}/${s}`;let l=o===a.length-1,d=r.children.find(p=>p.name===s&&p.dir===!l);d===void 0&&(d={name:s,path:i,dir:!l,children:[],...l?{meta:n.meta}:{}},r.children.push(d)),r=d}}return Mr(t),Rr(t.children)}function Mr(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)Mr(t)}function Rr(e){return e.map(t=>{if(!t.dir)return t;let n=t;for(;n.children.length===1&&n.children[0].dir;){let a=n.children[0];n={name:`${n.name}/${a.name}`,path:a.path,dir:!0,children:a.children}}return{...n,children:Rr(n.children)}})}function bt(e,t,n){if(e===null)return"";let a=typeof e=="number"?e:Date.parse(e);if(!Number.isFinite(a))return"";let r=Math.max(0,t-a),i=Math.floor(r/6e4);if(i<1)return n("time.justNow");if(i<60)return n("time.minutesAgo",{n:i});let o=Math.floor(i/60);if(o<24)return n("time.hoursAgo",{n:o});let s=Math.floor(o/24);return n("time.daysAgo",{n:s})}function Lt(e){if(e===null)return"";let t=new Date(typeof e=="number"?e:Date.parse(e));if(Number.isNaN(t.getTime()))return"";let n=a=>String(a).padStart(2,"0");return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}function Nn(e){if(e===null)return"";let t=new Date(typeof e=="number"?e:Date.parse(e));if(Number.isNaN(t.getTime()))return"";let n=a=>String(a).padStart(2,"0");return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}var Vt={added:"A",modified:"M",deleted:"D",renamed:"R",untracked:"U",conflicted:"!",typechange:"T"};function Wt(e){return e==="added"||e==="untracked"?"gp-status--added":e==="deleted"?"gp-status--deleted":e==="renamed"?"gp-status--renamed":"gp-status--modified"}var v=require("react");var Me={maxBytes:{min:16384,max:524288,default:131072},maxOutputTokens:{min:256,max:16384,default:4096},timeoutMs:{min:5e3,max:12e4,default:15e3}},ti={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 En(e){let t=e.lastIndexOf(".");return t<0?null:ti[e.slice(t+1).toLowerCase()]??null}function Gr(e){return/^Binary files .* differ$/m.test(e)||/^GIT binary patch$/m.test(e)}function Dr(e){return En(e)!==null}function Pr(e){return/\.svg$/i.test(e)}function ni(e){let t=e.split(`
|
|
626
|
-
`),n=[],
|
|
627
|
-
`),r=Number.isFinite(t)&&t>0?t:0,i=0,o=0,s=!0,l=!1,d=0;for(;d<a.length&&!a[d].startsWith("@@");d++);for(;d<a.length;d++){let u=a[d];if(u.startsWith("@@")){let k=ri.exec(u);if(k){let _=Number(k[1]),S=Number(k[3]),R=_-S;if(s)S>1&&n.push(ot({rightStart:1,count:S-1,delta:R,atStart:!0}));else{let $=S-o;$>0&&n.push(ot({rightStart:o,count:$,delta:R,atStart:!1}))}i=_,o=S,s=!1}n.push({kind:"hunk",leftNo:null,rightNo:null,leftText:null,rightText:null,text:u});continue}if(u.startsWith("\\"))continue;let g=u[0],w=u.slice(1);g==="+"?(n.push({kind:"add",leftNo:null,rightNo:o,leftText:null,rightText:w}),o++,l=!0):g==="-"?(n.push({kind:"del",leftNo:i,rightNo:null,leftText:w,rightText:null}),i++,l=!0):g===" "&&(n.push({kind:"context",leftNo:i,rightNo:o,leftText:w,rightText:w}),i++,o++,l=!0)}let p=r-o+1;return l&&!s&&o>0&&p>0&&n.push(ot({rightStart:o,count:p,delta:i-o,atStart:!1})),ai(n)}function zr(e,t){let n=e[e.length-1],a=n!==void 0&&n.kind==="gap",r=a?n.gap:void 0,i=a?e[e.length-2]:n,o=i===void 0?null:i.rightNo,s=o!==null&&o>0?o:0,l=Number.isFinite(t)?t-s:0,d=l>0?l:0;if(r===void 0){if(d===0||s===0)return e;let p=i===void 0?null:i.leftNo;return p===null?null:[...e,ot({rightStart:s+1,count:d,delta:p-s,atStart:!1})]}return r.rightStart===s+1&&r.count===d?e:d===0?e.slice(0,-1):[...e.slice(0,-1),ot({rightStart:s+1,count:d,delta:r.delta,atStart:!1})]}function ot(e){return{kind:"gap",leftNo:null,rightNo:null,leftText:null,rightText:null,gap:e}}function ai(e){let t=[],n=0;for(;n<e.length;){let a=e[n];if(a.kind==="del"){let r=[],i=n;for(;i<e.length&&e[i].kind==="del";)r.push(e[i]),i++;let o=[];for(;i<e.length&&e[i].kind==="add";)o.push(e[i]),i++;let s=Math.max(r.length,o.length);for(let l=0;l<s;l++){let d=r[l],p=o[l];if(d&&p){let u=ii(d.leftText??"",p.rightText??"");t.push({kind:"mod",leftNo:d.leftNo,rightNo:p.rightNo,leftText:d.leftText,rightText:p.rightText,...u!==null?{leftWord:u.left,rightWord:u.right}:{}})}else d?t.push({kind:"del",leftNo:d.leftNo,rightNo:null,leftText:d.leftText,rightText:null}):p&&t.push({kind:"add",leftNo:null,rightNo:p.rightNo,leftText:null,rightText:p.rightText})}n=i}else t.push(a),n++}return t}function ii(e,t){let n=Math.min(e.length,t.length),a=0;for(;a<n&&e[a]===t[a];)a++;let r=0;for(;r<n-a&&e[e.length-1-r]===t[t.length-1-r];)r++;return a===0&&r===0?null:{left:[a,e.length-r],right:[a,t.length-r]}}function oi(e,t,n){return n.map((a,r)=>{let i=t+r;return{kind:"context",leftNo:i+e,rightNo:i,leftText:a,rightText:a}})}var st=20;function Hr(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 Fr(e,t,n,a,r,i){let o=e.findIndex(u=>u.kind==="gap"&&u.gap?.rightStart===t);if(o<0)return e.slice();let s=e[o].gap,l=oi(s.delta,a,r),d=[],p=s.count;if(n==="all"||r.length>=p)d.push(...l);else if(n==="down")d.push(...l),i||d.push(ot({rightStart:s.rightStart+r.length,count:p-r.length,delta:s.delta,atStart:!1}));else{if(r.length===0)return[...e.slice(0,o),...e.slice(o+1)];let u=p-r.length;d.push(ot({rightStart:s.rightStart,count:u,delta:s.delta,atStart:s.atStart})),d.push(...l)}return[...e.slice(0,o),...d,...e.slice(o+1)]}var an=require("@deepseek-ai/dsh-client-ui-primitives");function Br(e,t){let n=[[],[],[]],a=0;for(let r of e){let i=a+r.text.length,o=[a,Math.max(a,Math.min(i,t[0])),Math.max(a,Math.min(i,t[1])),i];for(let s=0;s<3;s++){let l=r.text.slice(o[s]-a,o[s+1]-a);l!==""&&n[s].push({text:l,style:r.style})}a=i}return n}function Ir(e){let t=new Map;return n=>{if(t.has(n))return t.get(n);let a=e(n);return t.size>=8e3&&t.clear(),t.set(n,a),a}}function wt(e){let t=new Array(e.length+1);t[0]=0;for(let n=0;n<e.length;n++)t[n+1]=t[n]+e[n];return t}function Or(e,t){let n=0,a=e.length-1;for(;n<a;){let r=n+a+1>>1;e[r]<=t?n=r:a=r-1}return n}function xt(e,t,n,a){let r=e.length-1;if(r<=0)return{first:0,last:0};let i=Or(e,t-a),o=Math.min(r,Or(e,t+n+a)+1);return{first:i,last:o}}function qt(e,t,n,a){return t<0?e:t>=e.first&&t<e.last?{first:Math.min(e.first,Math.max(0,t-a)),last:Math.max(e.last,Math.min(n,t+a))}:{first:Math.max(0,t-a),last:Math.min(n,t+a)}}var lt=require("react");function kt(){let[e,t]=(0,lt.useState)({top:0,height:0}),n=(0,lt.useRef)(null),a=(0,lt.useRef)(null);return{setEl:(0,lt.useCallback)(i=>{if(a.current!==null&&(a.current(),a.current=null),n.current=i,i===null)return;let o=()=>t(l=>{let d=i.scrollTop,p=i.clientHeight;return l.top===d&&l.height===p?l:{top:d,height:p}});o(),i.addEventListener("scroll",o,{passive:!0});let s=typeof ResizeObserver<"u"?new ResizeObserver(o):null;s?.observe(i),a.current=()=>{i.removeEventListener("scroll",o),s?.disconnect()}},[]),viewport:e,elRef:n}}var Se=require("react"),Ut=5e3,jt=120;function Qt(e,t){let[n,a]=(0,Se.useState)(e);return(0,Se.useEffect)(()=>{let r=setTimeout(()=>a(e),t);return()=>clearTimeout(r)},[e,t]),n}function Yt(e,t){if(t==="")return[];let n=[],a=0;for(;;){let r=e.indexOf(t,a);if(r<0)break;n.push([r,r+t.length]),a=r+t.length}return n}function Mn(e,t,n,a,r){if(n>=a)return[];if(e===void 0)return[t.slice(n,a)];let i=[],o=0,s=0;for(let l of e){let d=o+l.text.length,p=Math.max(n,o),u=Math.min(a,d);if(u>p&&i.push((0,Se.createElement)("span",{key:`${r}-${s++}`,style:l.style},l.text.slice(p-o,u-o))),o=d,o>=a)break}return i}function Zt(e,t,n,a,r,i){let o=[],s=0,l=[...t].sort((d,p)=>d[0]-p[0]);for(let[d,p]of l){if(d<s)continue;d>s&&o.push(...Mn(n,e,s,d,`${a}b${s}`));let u=r!==null&&r[0]===d&&r[1]===p;o.push((0,Se.createElement)("mark",{key:`mk${a}-${d}`,className:`gp-find-hit${u?" gp-find-hit--active":""}`,...u?{ref:i}:{}},Mn(n,e,d,p,`mk${a}-${d}`))),s=p}return s<e.length&&o.push(...Mn(n,e,s,e.length,`${a}e`)),o}function en(e){return(0,Se.createElement)("div",{key:"find",className:"gp-find"},[(0,Se.createElement)("input",{key:"in",ref:e.inputRef,className:"gp-find__input",type:"text",placeholder:e.t("files.findPlaceholder"),value:e.query,spellCheck:!1,"aria-label":e.t("files.findPlaceholder"),onChange:t=>e.onChange(t.target.value),onKeyDown:t=>{t.key==="Escape"?(t.preventDefault(),t.stopPropagation(),e.onClose()):t.key==="Enter"&&(t.preventDefault(),e.onStep(t.shiftKey?-1:1))}}),(0,Se.createElement)("button",{key:"case",type:"button",className:`gp-find__btn gp-find__case${e.caseSensitive?" gp-find__case--active":""}`,title:e.t("files.findCase"),"aria-label":e.t("files.findCase"),"aria-pressed":e.caseSensitive,onClick:()=>e.onToggleCase()},"Aa"),(0,Se.createElement)("span",{key:"cnt",className:"gp-find__count"},e.query===""?"":e.matches===0?e.t("files.findNoMatch"):`${e.active+1}/${e.matches}`),(0,Se.createElement)("button",{key:"prev",type:"button",className:"gp-find__btn",title:e.t("files.findPrev"),"aria-label":e.t("files.findPrev"),disabled:e.matches===0,onClick:()=>e.onStep(-1)},"\u2039"),(0,Se.createElement)("button",{key:"next",type:"button",className:"gp-find__btn",title:e.t("files.findNext"),"aria-label":e.t("files.findNext"),disabled:e.matches===0,onClick:()=>e.onStep(1)},"\u203A"),(0,Se.createElement)("button",{key:"x",type:"button",className:"gp-find__btn",title:e.t("files.findClose"),"aria-label":e.t("files.findClose"),onClick:()=>e.onClose()},"\u2715")])}var nt=require("react");var I=require("react"),qr=require("react-dom");function Xr(e){let t=e.deltaMode===1?8:e.deltaMode===2?24:1;return Math.sign(e.deltaY)*Math.min(24,Math.abs(e.deltaY*t))}function Kr(e){let t=Math.sign(e)*Math.min(24,Math.abs(e));return t<=0?1-2*t/100:1/(1+2*t/100)}var si=.1,li=8,Rn=1.25;function Jr(e){return Number.isFinite(e)?Math.min(li,Math.max(si,e)):1}function Gn(e,t,n){return(e+t)*n-t}var $r=3;function Vr(e,t){return e*e+t*t>=$r*$r}function Wr(e,t,n,a){return{left:e-n,top:t-a}}var di=300;function At({src:e,alt:t,t:n,viewportClass:a,fullscreen:r=!0,onEmptyAreaMouseDown:i}){let o=(0,I.useRef)(null),s=(0,I.useRef)(null),l=(0,I.useRef)(null),[d,p]=(0,I.useState)(null),[u,g]=(0,I.useState)("fit"),[w,k]=(0,I.useState)(null),[_,S]=(0,I.useState)(!1),[R,$]=(0,I.useState)(!1),q=(0,I.useRef)("fit"),A=(0,I.useRef)(null),T=(0,I.useRef)(null),E=(0,I.useRef)(null),J=(0,I.useRef)(0),O=(0,I.useCallback)(()=>{let f=l.current;return f===null||f.naturalWidth===0||f.clientWidth===0?null:f.clientWidth/f.naturalWidth},[]),V=(0,I.useCallback)((f,x,P)=>{let z=s.current,C=l.current;if(z===null||C===null||C.naturalWidth===0||C.clientWidth===0)return;let X=C.clientWidth/C.naturalWidth,te=Jr(f);if(te===X)return;let ee=z.getBoundingClientRect();A.current={x:x-ee.left,y:P-ee.top,ratio:te/X},g(te)},[]),j=(0,I.useCallback)(f=>{let x=s.current,P=O();if(x===null||P===null)return;let z=x.getBoundingClientRect();V(P*f,z.left+z.width/2,z.top+z.height/2)},[O,V]),N=(0,I.useCallback)(()=>{let f=s.current;if(f===null)return;let x=f.getBoundingClientRect();V(1,x.left+x.width/2,x.top+x.height/2)},[V]),Z=(0,I.useCallback)(()=>{g("fit")},[]),ie=(0,I.useCallback)(()=>{let f=l.current;f===null||f.naturalWidth===0||f.clientWidth===0||k(Math.round(f.clientWidth/f.naturalWidth*100))},[]);(0,I.useLayoutEffect)(()=>{q.current=u,u==="fit"&&ie();let f=A.current;A.current=null;let x=s.current;f===null||x===null||(x.scrollLeft=Gn(x.scrollLeft,f.x,f.ratio),x.scrollTop=Gn(x.scrollTop,f.y,f.ratio))},[u,ie]),(0,I.useEffect)(()=>{q.current="fit",A.current=null,T.current=null,g("fit"),p(null),k(null)},[e]),(0,I.useEffect)(()=>{let f=o.current;if(f===null)return;let x=X=>{if(!X.ctrlKey)return;X.cancelable&&X.preventDefault();let te=l.current;if(te===null||!te.complete||te.naturalWidth===0)return;let ee=O();ee!==null&&V(ee*Kr(Xr(X)),X.clientX,X.clientY)},P=X=>{let te=X,ee=O();ee!==null&&(te.cancelable&&te.preventDefault(),T.current={base:ee,x:te.clientX,y:te.clientY})},z=X=>{let te=X,ee=T.current;ee!==null&&(te.cancelable&&te.preventDefault(),V(ee.base*te.scale,ee.x,ee.y))},C=()=>{T.current=null};return f.addEventListener("wheel",x,{passive:!1}),f.addEventListener("gesturestart",P,{passive:!1}),f.addEventListener("gesturechange",z,{passive:!1}),f.addEventListener("gestureend",C),()=>{f.removeEventListener("wheel",x),f.removeEventListener("gesturestart",P),f.removeEventListener("gesturechange",z),f.removeEventListener("gestureend",C)}},[O,V]);let oe=(0,I.useCallback)(f=>{if(f.button!==0||f.pointerType!=="mouse")return;let x=s.current;if(x===null)return;let{offsetX:P,offsetY:z}=f.nativeEvent;f.target===x&&(P>=x.clientWidth||z>=x.clientHeight)||(E.current={id:f.pointerId,x:f.clientX,y:f.clientY,left:x.scrollLeft,top:x.scrollTop,pan:x.scrollWidth>x.clientWidth||x.scrollHeight>x.clientHeight,moved:!1})},[]);(0,I.useEffect)(()=>{let f=z=>{let C=E.current;C===null||z!==C.id||(C.moved&&(J.current=performance.now()),E.current=null,$(!1))},x=z=>{let C=E.current;if(C===null||z.pointerId!==C.id)return;if(z.buttons===0){f(z.pointerId);return}let X=z.clientX-C.x,te=z.clientY-C.y;if(!C.moved){if(!Vr(X,te))return;C.moved=!0,$(!0)}let ee=s.current;if(ee===null||!C.pan)return;let xe=Wr(C.left,C.top,X,te);ee.scrollLeft=xe.left,ee.scrollTop=xe.top},P=z=>{f(z.pointerId)};return window.addEventListener("pointermove",x),window.addEventListener("pointerup",P),window.addEventListener("pointercancel",P),()=>{window.removeEventListener("pointermove",x),window.removeEventListener("pointerup",P),window.removeEventListener("pointercancel",P)}},[]),(0,I.useEffect)(()=>{let f=s.current;if(f===null||typeof ResizeObserver>"u")return;let x=new ResizeObserver(()=>{q.current==="fit"&&ie()});return x.observe(f),()=>x.disconnect()},[ie]);let W=(0,I.useCallback)(()=>{let f=l.current;f!==null&&(p({w:f.naturalWidth,h:f.naturalHeight}),q.current==="fit"&&ie())},[ie]),de=(0,I.useCallback)(()=>{performance.now()-J.current<di||(u==="fit"?N():Z())},[u,N,Z]),se=(0,I.useCallback)(()=>{S(!1)},[]),he=u==="fit"?w!==null?`${w}%`:"\u2014":`${Math.round(u*100)}%`,fe=u!=="fit"&&d!==null?{width:`${d.w*u}px`,maxWidth:"none",maxHeight:"none"}:void 0,Y=d!==null?(0,I.createElement)("div",{key:"bar",className:"gp-zoom__bar",role:"group","aria-label":n("files.zoomBar")},[(0,I.createElement)("button",{key:"out",type:"button",className:"gp-zoom__btn","aria-label":n("files.zoomOut"),title:n("files.zoomOut"),onClick:()=>j(1/Rn)},"\u2212"),(0,I.createElement)("button",{key:"pct",type:"button",className:"gp-zoom__btn gp-zoom__pct","aria-label":`${he}\uFF0C${n("files.zoomActual")}`,title:n("files.zoomActual"),onClick:N},he),(0,I.createElement)("button",{key:"in",type:"button",className:"gp-zoom__btn","aria-label":n("files.zoomIn"),title:n("files.zoomIn"),onClick:()=>j(Rn)},"+"),(0,I.createElement)("button",{key:"fit",type:"button",className:"gp-zoom__btn gp-zoom__btn--text","aria-pressed":u==="fit",onClick:Z},n("files.zoomFit")),r?(0,I.createElement)("button",{key:"fs",type:"button",className:"gp-zoom__btn","aria-label":n("files.zoomFullscreen"),title:n("files.zoomFullscreen"),onClick:()=>S(!0)},"\u2921"):null]):null;return(0,I.createElement)("div",{className:"gp-zoom",ref:o,"data-zoomed":u==="fit"?void 0:"true","data-dragging":R?"true":void 0},[(0,I.createElement)("div",{key:"vp",className:`gp-zoom__scroll ${a}`,ref:s,onPointerDown:oe,onMouseDown:i===void 0?void 0:f=>{f.target===f.currentTarget&&i()}},(0,I.createElement)("img",{key:"img",ref:l,className:"gp-zoom__img",src:e,alt:t,style:fe,draggable:!1,onLoad:W,onDoubleClick:de})),Y,_?(0,I.createElement)(ci,{key:"lb",src:e,alt:t,t:n,onClose:se}):null])}function ci({src:e,alt:t,t:n,onClose:a}){let r=(0,I.useRef)(null),i=(0,I.useRef)(null),o=(0,I.useRef)(null);return(0,I.useEffect)(()=>{o.current=document.activeElement instanceof HTMLElement?document.activeElement:null,i.current?.focus();let s=()=>{let d=r.current;return d===null?[]:[...d.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')].filter(p=>!p.hasAttribute("disabled")&&p.getClientRects().length>0)},l=d=>{if(d.key==="Escape"){d.stopPropagation(),a();return}if(d.key!=="Tab")return;let p=s();if(p.length===0)return;let u=document.activeElement instanceof HTMLElement?document.activeElement:null,g=u===null?-1:p.indexOf(u);d.preventDefault();let w=d.shiftKey?-1:1,k=g===-1?w===-1?p.length-1:0:(g+w+p.length)%p.length;p[k]?.focus()};return window.addEventListener("keydown",l,!0),()=>{window.removeEventListener("keydown",l,!0),o.current?.focus()}},[a]),(0,qr.createPortal)((0,I.createElement)("div",{className:"gp-zl-backdrop",ref:r,role:"dialog","aria-modal":"true","aria-label":n("files.zoomFullscreen")},[(0,I.createElement)("div",{key:"stage",className:"gp-zl-stage"},[(0,I.createElement)("div",{key:"mask",className:"gp-zl-mask","aria-hidden":"true",onMouseDown:a}),(0,I.createElement)("div",{key:"frame",className:"gp-zl-frame"},(0,I.createElement)(At,{src:e,alt:t,t:n,viewportClass:"gp-zl-viewport",fullscreen:!1,onEmptyAreaMouseDown:a})),(0,I.createElement)("button",{key:"close",ref:i,type:"button",className:"gp-zl-close","aria-label":n("common.close"),onClick:a},(0,I.createElement)(tt,{size:16}))])]),document.body)}function tn(e,t,n){let a=n(`diff.${e}`);return(0,nt.createElement)("div",{className:`gp-imgcmp__pane gp-imgcmp__pane--${e}`},[(0,nt.createElement)("div",{key:"head",className:"gp-imgcmp__head"},a),t===void 0?(0,nt.createElement)("div",{key:"missing",className:"gp-imgcmp__missing"},n("diff.imageMissing")):(0,nt.createElement)(At,{key:"img",src:t,alt:a,t:n,viewportClass:"gp-imgcmp__img"})])}function Ur({oldUrl:e,newUrl:t,mode:n,t:a}){return n==="before"?(0,nt.createElement)("div",{className:"gp-imgcmp gp-imgcmp--single"},tn("before",e,a)):n==="after"?(0,nt.createElement)("div",{className:"gp-imgcmp gp-imgcmp--single"},tn("after",t,a)):(0,nt.createElement)("div",{className:"gp-imgcmp"},[tn("before",e,a),tn("after",t,a)])}var Dn=20,pi=27,ui=29,jr=12,gi=600,on=(0,v.memo)(function({text:t,mode:n,path:a,remote:r,sessionId:i,base:o,commit:s,expanded:l,truncated:d,newLines:p,t:u}){let g=(0,v.useMemo)(()=>Ar(t,p),[t,p]),w=Gr(t),k=(0,an.useCodeHighlighter)(a===void 0?void 0:(0,an.languageForPath)(a)),_=(0,v.useMemo)(()=>Ir(k),[k]),[S,R]=(0,v.useState)(g),$=(0,v.useRef)(t);(0,v.useEffect)(()=>{if($.current!==t){$.current=t,R(g);return}R(Q=>zr(Q,p)??g)},[t,p,g]);let q=yi(S,R,r,i,a,o,s),A=a!==void 0&&Pr(a),[T,E]=(0,v.useState)("render");(0,v.useEffect)(()=>{E("render")},[a]);let O=(w||A)&&a!==void 0&&Dr(a)&&r!==void 0&&i!==void 0&&o!==void 0&&(!A||T==="render"),V=vi(O?r:void 0,O?i:void 0,O?a:void 0,O?o:void 0,O?s:void 0),[j,N]=(0,v.useState)(!1),[Z,ie]=(0,v.useState)(""),[oe,W]=(0,v.useState)(!1),[de,se]=(0,v.useState)(0),he=(0,v.useRef)(null),fe=(0,v.useRef)(null),Y=(0,v.useRef)(null);(0,v.useEffect)(()=>{N(!1),ie(""),se(0)},[t,a]);let f=(0,v.useMemo)(()=>n==="unified"?Hr(S):null,[n,S]),x=(0,v.useMemo)(()=>n==="before"?wi(S):n==="after"?xi(S):null,[n,S]),P=(0,v.useMemo)(()=>mi(S,f,x),[S,f,x]),z=(0,v.useMemo)(()=>P.map(Q=>({key:Q.key,text:Q.text.toLowerCase()})),[P]),C=Qt(Z,jt),X=oe?C:C.toLowerCase(),te=oe?P:z,ee=(0,v.useMemo)(()=>hi(te,X),[te,X]);(0,v.useEffect)(()=>{se(0)},[X]);let xe=ee.length===0?0:Math.min(de,ee.length-1),G=ee.length>0?ee[xe]:null,ve=G?.cellKey??null,Fe=G?.start??-1,Ce=(0,v.useMemo)(()=>{let Q=new Map;for(let B of ee){let h=Q.get(B.cellKey)??[];h.push([B.start,B.end]),Q.set(B.cellKey,h)}return Q},[ee]);(0,v.useEffect)(()=>{if(ve===null)return;let Q=requestAnimationFrame(()=>Y.current?.scrollIntoView({block:"center",inline:"nearest"}));return()=>cancelAnimationFrame(Q)},[xe,ee,ve,Fe]);let De=(0,v.useCallback)(Q=>{se(B=>ee.length===0?0:(B+Q+ee.length)%ee.length)},[ee.length]);(0,v.useEffect)(()=>{let Q=B=>{if(!((B.ctrlKey||B.metaKey)&&(B.key==="f"||B.key==="F")))return;let h=he.current;h===null||h.offsetParent===null||(B.preventDefault(),N(!0),requestAnimationFrame(()=>fe.current?.select()))};return document.addEventListener("keydown",Q),()=>document.removeEventListener("keydown",Q)},[]);let{setEl:Le,viewport:Ae,elRef:Be}=kt(),Te=(0,v.useRef)(null),[Ve,pt]=(0,v.useState)(0),[We,Ke]=(0,v.useState)(0),Ne=(0,v.useRef)({mode:n,rows:S,heights:[]});(Ne.current.mode!==n||Ne.current.rows!==S)&&(Ne.current={mode:n,rows:S,heights:[]});let _e=Ne.current.heights,Ie=f!==null?f.length:x!==null?x.length:S.length,qe=(0,v.useCallback)(Q=>{let B=f!==null?f[Q]??null:x===null?S[Q]??null:null;return B===null?Dn:B.kind==="hunk"?pi:B.kind==="gap"?ui:Dn},[f,x,S]),Ee=(0,v.useMemo)(()=>{let Q=new Array(Ie);for(let B=0;B<Ie;B++){let h=_e[B];Q[B]=h!==void 0&&h>0?h:qe(B)}return Q},[Ie,_e,qe,We]),we=(0,v.useMemo)(()=>wt(Ee),[Ee]),ut=Ae.height>0?Ae.height:gi,{first:ne,last:ze}=xt(we,Math.max(0,Ae.top-Ve),ut,jr*Dn),Et=ve===null?-1:fi(ve),{first:Ue,last:je}=qt({first:ne,last:ze},Et,Ie,jr);if((0,v.useLayoutEffect)(()=>{let Q=Te.current,B=Be.current;if(Q===null||B===null)return;let h=Q.getBoundingClientRect().top-B.getBoundingClientRect().top+B.scrollTop;Math.abs(h-Ve)>.5&&pt(h);let D=new Map;for(let re of Q.querySelectorAll("[data-r]")){let ce=Number(re.dataset.r),ye=re.getBoundingClientRect().height;if(!Number.isFinite(ye)||ye<=0)continue;let Je=D.get(ce);(Je===void 0||ye>Je)&&D.set(ce,ye)}let M=!1;for(let[re,ce]of D){let ye=_e[re];(ye===void 0||Math.abs(ye-ce)>.5)&&(_e[re]=ce,M=!0)}M&&Ke(re=>re+1)}),O){let Q=(()=>{if(V.kind==="idle"||V.kind==="loading")return(0,v.createElement)("div",{className:"gp-empty"},u("common.loading"));if(V.kind==="ready"){let B=V.res;if(B.tooLarge===!0)return(0,v.createElement)("div",{className:"gp-empty"},u("diff.tooLarge"));if(B.mime!==null&&(B.old!==void 0||B.new!==void 0))return(0,v.createElement)(Ur,{oldUrl:B.old,newUrl:B.new,mode:n,t:u})}return(0,v.createElement)("div",{className:"gp-empty"},u("diff.binary"))})();return A?Qr(T,E,Q,u):Q}if(w&&!A)return(0,v.createElement)("div",{className:"gp-empty"},u("diff.binary"));let Qe=j&&X!==""?{perCell:Ce,activeKey:ve,activeRange:G!==null?[G.start,G.end]:null,activeRef:Y}:null,gt=(Q,B)=>B>.5?(0,v.createElement)("div",{key:Q,className:"gp-diff__spacer",style:{gridColumn:"1 / -1",height:`${B}px`}}):null,ke=gt("lead",we[Ue]),Oe=gt("tail",we[Ie]-we[je]),ft=(()=>{if(t.trim()==="")return(0,v.createElement)("div",{className:"gp-empty"},u("diff.empty"));if(x!==null){let B=[ke];for(let h=Ue;h<je;h++){let D=x[h];B.push((0,v.createElement)("div",{key:`n${h}`,className:"gp-diff-no"},D.no??"")),B.push(rn("gp-diff-cell",`c${h}`,D.text,_,Qe,h))}return B.push(Oe),(0,v.createElement)("div",{className:"gp-diff__single",ref:Te},B)}if(f!==null){let B=[ke];for(let h=Ue;h<je;h++)B.push(..._i(f[h],h,_,q,Qe,u));return B.push(Oe),(0,v.createElement)("div",{className:"gp-diff__unified",ref:Te},B)}let Q=[ke];for(let B=Ue;B<je;B++)Q.push(...ki(S[B],B,_,q,Qe,u));return Q.push(Oe),(0,v.createElement)("div",{className:"gp-diff__side",ref:Te},Q)})(),rt=j?(0,v.createElement)(en,{inputRef:fe,query:Z,matches:ee.length,active:xe,caseSensitive:oe,onChange:ie,onToggleCase:()=>W(Q=>!Q),onStep:De,onClose:()=>N(!1),t:u}):null,Ye=l===!0&&S.some(Q=>Q.kind==="gap"),at=(0,v.createElement)("div",{className:"gp-diff__wrap",ref:he},[rt,d===!0?(0,v.createElement)("div",{key:"truncated",className:"gp-notice"},u("diff.truncated")):null,Ye?(0,v.createElement)("div",{key:"capped",className:"gp-notice"},u("diff.expandCapped",{n:2e3})):null,(0,v.createElement)("div",{key:"scroll",className:"gp-diff__scroll",ref:Le},ft)]);return A?Qr(T,E,at,u):at});function fi(e){let t=Number(e.slice(1));return Number.isFinite(t)?t:-1}function mi(e,t,n){let a=[];return n!==null?(n.forEach((r,i)=>a.push({key:`c${i}`,text:r.text})),a):t!==null?(t.forEach((r,i)=>{if(r.kind==="hunk"||r.kind==="gap")return;let o=r.rightText??r.leftText??"";o!==""&&a.push({key:`c${i}`,text:o})}),a):(e.forEach((r,i)=>{r.kind==="hunk"||r.kind==="gap"||(r.leftText!==null&&r.leftText!==""&&a.push({key:`l${i}`,text:r.leftText}),r.rightText!==null&&r.rightText!==""&&a.push({key:`r${i}`,text:r.rightText}))}),a)}function hi(e,t){if(t==="")return[];let n=[];for(let a of e)for(let[r,i]of Yt(a.text,t))if(n.push({cellKey:a.key,start:r,end:i}),n.length>=Ut)return n;return n}function Qr(e,t,n,a){let r=(i,o)=>(0,v.createElement)("button",{key:i,type:"button",className:`gp-seg__btn${e===i?" gp-seg__btn--active":""}`,"aria-pressed":e===i,onClick:()=>t(i)},o);return(0,v.createElement)("div",{className:"gp-svgdiff"},[(0,v.createElement)("div",{key:"bar",className:"gp-svgdiff__bar"},(0,v.createElement)("div",{className:"gp-seg"},[r("render",a("diff.svgRender")),r("source",a("diff.svgSource"))])),(0,v.createElement)("div",{key:"body",className:"gp-svgdiff__body"},n)])}function yi(e,t,n,a,r,i,o){let[s,l]=(0,v.useState)(null),d=(0,v.useRef)(0);(0,v.useEffect)(()=>{d.current+=1,l(null)},[e]);let p=(0,v.useCallback)((u,g)=>{if(n===void 0||a===void 0||r===void 0||i===void 0)return;let w=`${u.rightStart}:${g}`;l(w);let k=++d.current,{start:_,end:S}=bi(u,g),R=i==="commit"&&o!==void 0?{kind:"file-lines",path:r,base:"commit",commit:o,start:_,end:S}:i==="staged"?{kind:"file-lines",path:r,base:"staged",start:_,end:S}:{kind:"file-lines",path:r,base:"worktree",start:_,end:S};n.query({sessionId:a,query:R}).then($=>{if(k!==d.current)return;let q=me($,"file-lines");l(null),q!==null&&t(A=>Fr(A,u.rightStart,g,q.start,q.lines,q.eof))}).catch(()=>{k===d.current&&l(null)})},[n,a,r,i,o,t]);return{busy:s,run:p}}function bi(e,t){let n=e.count;return t==="all"||n<=st?{start:e.rightStart,end:e.rightStart+n-1}:t==="down"?{start:e.rightStart,end:e.rightStart+st-1}:{start:e.rightStart+n-st,end:e.rightStart+n-1}}function vi(e,t,n,a,r){let[i,o]=(0,v.useState)({kind:"idle"});return(0,v.useEffect)(()=>{if(e===void 0||t===void 0||n===void 0||a===void 0)return;let s=!0;o({kind:"loading"});let l=a==="commit"&&r!==void 0?{kind:"image-diff",path:n,base:"commit",commit:r}:a==="staged"?{kind:"image-diff",path:n,base:"staged"}:{kind:"image-diff",path:n,base:"worktree"};return e.query({sessionId:t,query:l}).then(d=>{if(!s)return;let p=me(d,"image-diff");o(p!==null?{kind:"ready",res:p}:{kind:"failed"})}).catch(()=>{s&&o({kind:"failed"})}),()=>{s=!1}},[e,t,n,a,r]),i}function nn(e,t=""){return e.map((n,a)=>(0,v.createElement)("span",{key:`${t}${a}`,style:n.style},n.text))}function Yr(e,t,n,a){if(n===null)return null;let r=n.perCell.get(t);if(r===void 0||r.length===0)return null;let i=n.activeKey===t?n.activeRange:null;return Zt(e,r,a,t,i,n.activeRef)}function rn(e,t,n,a,r=null,i=-1){let o={key:t,className:e,"data-r":i>=0?i:void 0};if(n==="")return(0,v.createElement)("div",o,"\xA0");let s=a(n)?.[0],l=Yr(n,t,r,s);return l!==null?(0,v.createElement)("div",o,l):(0,v.createElement)("div",o,s===void 0?n:nn(s))}function Pn(e,t,n,a,r,i,o=null,s=-1){let l={key:t,className:e,"data-r":s>=0?s:void 0},d=i(n)?.[0]??[{text:n,style:{}}],p=Yr(n,t,o,d);if(p!==null)return(0,v.createElement)("div",l,p);let[u,g,w]=Br(d,a);return(0,v.createElement)("div",l,[...nn(u,"p"),(0,v.createElement)("span",{key:"w",className:r},g.length===0?"\xA0":nn(g)),...nn(w,"s")])}function wi(e){return e.filter(t=>t.leftText!==null).map(t=>({no:t.leftNo,text:t.leftText}))}function xi(e){return e.filter(t=>t.rightText!==null).map(t=>({no:t.rightNo,text:t.rightText}))}function ki(e,t,n,a,r,i){if(e.kind==="hunk")return[(0,v.createElement)("div",{key:`h${t}`,className:"gp-diff-row--hunk gp-diff-cell",style:{gridColumn:"1 / -1"},"data-r":t},e.text??"")];if(e.kind==="gap")return[Zr(e.gap,t,a,i)];let o=e.kind==="del"||e.kind==="mod"?"gp-diff-row--del":"",s=e.kind==="add"||e.kind==="mod"?"gp-diff-row--add":"",l=e.leftText===null?(0,v.createElement)("div",{key:`l${t}`,className:`gp-diff-cell ${o}`}):e.kind==="mod"&&e.leftWord!==void 0?Pn(`gp-diff-cell ${o}`,`l${t}`,e.leftText,e.leftWord,"gp-diff-word gp-diff-word--del",n,r,t):rn(`gp-diff-cell ${o}`,`l${t}`,e.leftText,n,r,t),d=e.rightText===null?(0,v.createElement)("div",{key:`r${t}`,className:`gp-diff-cell ${s}`}):e.kind==="mod"&&e.rightWord!==void 0?Pn(`gp-diff-cell ${s}`,`r${t}`,e.rightText,e.rightWord,"gp-diff-word gp-diff-word--add",n,r,t):rn(`gp-diff-cell ${s}`,`r${t}`,e.rightText,n,r,t);return[(0,v.createElement)("div",{key:`ln${t}`,className:"gp-diff-no"},e.leftNo??""),l,(0,v.createElement)("div",{key:`rn${t}`,className:"gp-diff-no"},e.rightNo??""),d]}function _i(e,t,n,a,r,i){if(e.kind==="hunk")return[(0,v.createElement)("div",{key:`h${t}`,className:"gp-diff-row--hunk gp-diff-cell",style:{gridColumn:"1 / -1"},"data-r":t},e.text??"")];if(e.kind==="gap")return[Zr(e.gap,t,a,i)];let o=e.kind==="del",s=e.kind==="add",l=s?"gp-diff-row--add":o?"gp-diff-row--del":"",d=s?"+":o?"\u2212":"\xA0",p=e.rightText??e.leftText??"",u=s?e.rightWord:o?e.leftWord:void 0,g=s?"gp-diff-word gp-diff-word--add":"gp-diff-word gp-diff-word--del",w=`gp-diff-cell gp-diff-uni__code ${l}`,k=u!==void 0?Pn(w,`c${t}`,p,u,g,n,r,t):rn(w,`c${t}`,p,n,r,t);return[(0,v.createElement)("div",{key:`ol${t}`,className:"gp-diff-no"},e.leftNo??""),(0,v.createElement)("div",{key:`nl${t}`,className:"gp-diff-no"},e.rightNo??""),(0,v.createElement)("div",{key:`sg${t}`,className:`gp-diff-uni__sign ${l}`},d),k]}function Zr(e,t,n,a){let r=n.busy===`${e.rightStart}:all`,i=n.busy===`${e.rightStart}:up`,o=n.busy===`${e.rightStart}:down`,s=(p,u,g)=>(0,v.createElement)("button",{key:p,type:"button",className:"gp-gap__btn",disabled:n.busy!==null,onClick:w=>{w.stopPropagation(),n.run(e,p)}},g?a("common.loading"):u),l=[],d=e.count;return d<=st?l.push(s("all",a("diff.expandGap",{n:d}),r)):(e.atStart||l.push(s("up",a("diff.expandUp",{n:st}),i)),l.push(s("all",a("diff.expandGap",{n:d}),r)),l.push(s("down",a("diff.expandDown",{n:st}),o))),(0,v.createElement)("div",{key:`g${t}`,className:"gp-diff-row--gap",style:{gridColumn:"1 / -1"},"data-r":t},l)}function sn(e){return Lr(e)}var U=require("react");var Si=100;function ea(e,t,n){let[a,r]=(0,U.useState)(null),[i,o]=(0,U.useState)(!1),[s,l]=(0,U.useState)([]),d=(0,U.useCallback)(()=>{o(!1),(async()=>{let[p,u]=await Promise.all([e.query({sessionId:t,query:{kind:"branches"}}),e.query({sessionId:t,query:{kind:"tags"}})]),g=me(p,"branches");if(g===null){o(!0);return}let w=me(u,"tags");r({current:g.current,defaultBranch:g.defaultBranch,local:g.local,remote:g.remote,tags:w?.tags??[]}),e.query({sessionId:t,query:{kind:"authors"}}).then(k=>{l(me(k,"authors")?.authors??[])})})()},[e,t]);return(0,U.useEffect)(()=>{d()},[n]),{tree:a,treeError:i,authors:s,reload:d}}function ta(e,t,n,a,r){let[i,o]=(0,U.useState)([]),[s,l]=(0,U.useState)(0),[d,p]=(0,U.useState)(!1),[u,g]=(0,U.useState)(!1),w=(0,U.useRef)(0),k=(0,U.useRef)(!1),_=(0,U.useRef)(null),S=(0,U.useCallback)(async(A,T)=>{if(k.current)return;k.current=!0;let E=w.current;p(!0),g(!1);let J=await e.query({sessionId:t,query:{kind:"history",limit:Si,skip:A,...T.ref?{ref:T.ref}:{},...T.search?{search:T.search}:{},...T.author?{author:T.author}:{},...T.since?{since:T.since}:{}}});if(k.current=!1,E!==w.current)return;p(!1);let O=me(J,"history");if(O===null){g(!0);return}let V=O.commits;o(j=>A===0?V:[...j,...V]),l(O.total)},[e,t]),R=(0,U.useRef)(n);(0,U.useEffect)(()=>{w.current+=1,k.current=!1,R.current!==n&&(R.current=n,r(),_.current&&(_.current.scrollTop=0)),S(0,n)},[n,a]);let $=s<0?!0:i.length<s,q=(0,U.useCallback)(()=>{k.current||!$||S(i.length,n)},[S,i.length,n,$]);return{commits:i,total:s,loading:d,listError:u,hasMore:$,listRef:_,loadMore:q}}function na(e,t,n){let[a,r]=(0,U.useState)(null),[i,o]=(0,U.useState)(null),[s,l]=(0,U.useState)(!1),[d,p]=(0,U.useState)(null),[u,g]=(0,U.useState)(null),[w,k]=(0,U.useState)(!1),[_,S]=(0,U.useState)(n),[R,$]=(0,U.useState)(!1),q=(0,U.useRef)(0),A=(0,U.useRef)(null),T=(0,U.useRef)(new Map),E=(0,U.useCallback)((Y,f)=>{let x=T.current;for(x.set(Y,f);x.size>50;){let P=x.keys().next().value;if(P===void 0)break;x.delete(P)}},[]),J=(0,U.useCallback)(()=>{r(null),o(null),A.current=null},[]),O=(0,U.useCallback)(Y=>{A.current===Y.hash&&r(Y)},[]),V=(0,U.useCallback)(async Y=>{A.current=Y.hash,r(Y),l(!1),q.current+=1,p(null),g(null),k(!1);let f=T.current.get(Y.hash);if(f!==void 0){o(f);return}o(null);let x=await e.query({sessionId:t,query:{kind:"show",ref:Y.hash}});if(A.current!==Y.hash)return;let P=me(x,"show");if(P!==null){let z={commit:P.commit,body:P.body,stats:P.stats,insertions:P.insertions,deletions:P.deletions};E(Y.hash,z),o(z)}else l(!0)},[e,t,E]),j=(0,U.useCallback)(async(Y,f,x,P=!1)=>{let z=++q.current;p({path:Y,hash:f,shortHash:x}),g(null),k(!1),$(P);let C=await e.query({sessionId:t,query:{kind:"diff",path:Y,base:"commit",commit:f,...P?{context:2e3}:{}}});if(z!==q.current)return;let X=me(C,"diff");X!==null?g({text:X.text,newLines:X.newLines,truncated:X.truncated}):k(!0)},[e,t]),N=(0,U.useCallback)(()=>{q.current+=1,p(null),g(null),k(!1),$(!1)},[]);(0,U.useEffect)(()=>{if(d===null)return;let Y=f=>{f.key==="Escape"&&N()};return document.addEventListener("keydown",Y),()=>document.removeEventListener("keydown",Y)},[d,N]);let[Z,ie]=(0,U.useState)(null),[oe,W]=(0,U.useState)(null),de=(0,U.useRef)(void 0),se=(0,U.useRef)(null),he=(0,U.useCallback)((Y,f,x)=>{de.current!==void 0&&clearTimeout(de.current),de.current=setTimeout(()=>{se.current=Y.hash,ie({commit:Y,x:f,y:x});let P=T.current.get(Y.hash);if(P!==void 0){W(P.body);return}W(null),e.query({sessionId:t,query:{kind:"show",ref:Y.hash}}).then(z=>{if(se.current!==Y.hash)return;let C=me(z,"show");C!==null?(E(Y.hash,{commit:C.commit,body:C.body,stats:C.stats,insertions:C.insertions,deletions:C.deletions}),W(C.body)):W("")})},260)},[e,t,E]),fe=(0,U.useCallback)(()=>{de.current!==void 0&&clearTimeout(de.current),se.current=null,ie(null),W(null)},[]);return(0,U.useEffect)(()=>()=>{de.current!==void 0&&clearTimeout(de.current)},[]),{selected:a,detail:i,detailError:s,select:V,resyncSelected:O,clearSelection:J,fileDiff:d,fileDiffData:u,fileDiffError:w,fileDiffMode:_,setFileDiffMode:S,fileDiffExpanded:R,openFileDiff:j,closeFileDiff:N,hover:Z,hoverBody:oe,onHoverEnter:he,onHoverLeave:fe}}var He=require("react"),Ci=(e,t,n)=>Math.max(t,Math.min(n,e));function Ti(e,t){try{let n=typeof localStorage<"u"?localStorage.getItem(e):null,a=n===null?NaN:Number(n);return Number.isFinite(a)?a:t}catch{return t}}function Ni(e,t){try{typeof localStorage<"u"&&localStorage.setItem(e,String(Math.round(t)))}catch{}}function dt(e){let{storageKey:t,initial:n,min:a,reserve:r,edge:i}=e,[o,s]=(0,He.useState)(()=>Ti(t,n)),l=(0,He.useRef)(null),d=(0,He.useRef)(null),p=(0,He.useCallback)(g=>{let k=l.current?.parentElement?.clientWidth??Number.MAX_SAFE_INTEGER;d.current={x:g.clientX,w:o,max:Math.max(a,k-r)},g.preventDefault(),typeof document<"u"&&(document.body.style.cursor="col-resize",document.body.style.userSelect="none")},[o,a,r]);(0,He.useEffect)(()=>{if(typeof window>"u")return;let g=k=>{let _=d.current;if(_===null)return;let S=k.clientX-_.x;s(Ci(_.w+(i==="end"?S:-S),a,_.max))},w=()=>{d.current!==null&&(d.current=null,typeof document<"u"&&(document.body.style.cursor="",document.body.style.userSelect=""),s(k=>(Ni(t,k),k)))};return window.addEventListener("pointermove",g),window.addEventListener("pointerup",w),()=>{window.removeEventListener("pointermove",g),window.removeEventListener("pointerup",w)}},[i,a,t]);let u=(0,He.createElement)("div",{key:`rz-${t}`,ref:l,className:"gp-resizer",role:"separator","aria-orientation":"vertical",onPointerDown:p});return{width:o,divider:u}}var ra=require("react");function ct(e,t,n,a,r=!1){return e.map(i=>(0,ra.createElement)("button",{key:i,type:"button",className:`gp-seg__btn${t===i?" gp-seg__btn--active":""}`,...r?{disabled:!0}:{},onClick:()=>n(i)},a(i)))}var ge=require("react"),aa=require("react-dom");function zt(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");case"not-ff":return n("error.notFastForward");case"push-rejected":return n("error.pushRejected");case"auth-failed":return n("error.authFailed");case"conflict":return n("error.conflict");case"revert-conflict":return n("error.revertConflict");case"revert-stuck":return n("error.revertStuck");case"revert-merge":return n("error.revertMerge");case"index-busy":return n("error.indexBusy");case"not-found":return n("error.notFound");case"branch-in-use":return n("error.branchInUse");case"stash-switch-failed":return n("error.stashSwitchFailed",{reason:t??""});case"invalid-name":case"invalid-index":return n("error.invalidName");default:return t??n("error.generic")}}function _t(e){return(0,ge.createElement)("div",{key:"aihint",className:"gp-modal__hint"},e("ops.aiHint"))}function St(e){return(0,ge.createElement)("div",{key:"footer",className:"gp-modal__footer"},[(0,ge.createElement)("button",{key:"cancel",type:"button",className:"gp-btn",onClick:e.onClose},e.t("common.cancel")),(0,ge.createElement)("button",{key:"ok",type:"button",className:`gp-btn ${e.danger?"gp-btn--danger":"gp-btn--primary"}`,disabled:e.confirmDisabled,onClick:e.onConfirm},e.confirmLabel)])}function Ct(e){return typeof document>"u"?null:(0,ge.createElement)(Ei,e)}function Ei({onClose:e,title:t,icon:n,hash:a,body:r,footer:i,overlay:o,portalKey:s,t:l}){let d=o!=null;(0,ge.useEffect)(()=>{let u=g=>{g.key==="Escape"&&!d&&e()};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[e,d]);let p=(0,ge.createElement)("div",{className:"gp-modal-backdrop",onClick:u=>{!d&&u.target===u.currentTarget&&e()}},(0,ge.createElement)("div",{className:"gp-modal gp-modal--sm",role:"dialog","aria-modal":!0},[(0,ge.createElement)("div",{key:"bar",className:"gp-modal__bar"},[n!==void 0?(0,ge.createElement)("span",{key:"ic",className:"gp-modal__fileicon"},n):null,(0,ge.createElement)("span",{key:"title",className:"gp-modal__path"},t),a!==void 0?(0,ge.createElement)("span",{key:"hash",className:"gp-modal__hash"},a):null,(0,ge.createElement)("button",{key:"close",type:"button",className:"gp-icon-btn gp-modal__close",title:l("common.close"),disabled:d,onClick:e},(0,ge.createElement)(tt,{size:15}))]),(0,ge.createElement)("div",{key:"body",className:"gp-modal__form"},r),i,o??null]));return(0,aa.createPortal)(p,document.body,s)}function Mi(e){return(0,ge.createElement)("div",{key:"overlay",className:"gp-modal__overlay"},[(0,ge.createElement)("div",{key:"sp",className:"gp-spinner"}),(0,ge.createElement)("div",{key:"lb",className:"gp-modal__overlay-label"},e)])}function $e(e){let t=e.confirmBusy===!0&&e.busyLabel!==void 0;return Ct({onClose:e.onClose,title:e.title,portalKey:"confirm-modal",t:e.t,body:[(0,ge.createElement)("div",{key:"txt",className:"gp-modal__confirmtext"},e.body),e.extra??null,_t(e.t),e.error!==null?(0,ge.createElement)("div",{key:"err",className:"gp-feedback"},e.error):null],footer:St({onClose:e.onClose,onConfirm:e.onConfirm,confirmLabel:e.confirmLabel,confirmDisabled:e.confirmBusy===!0,danger:e.danger,t:e.t}),...t?{overlay:Mi(e.busyLabel)}:{}})}var ae=require("react");function ia(e,t){return typeof document>"u"?null:(0,ae.createElement)(Ri,{target:e,...t})}function Ri({target:e,onClose:t,onCreate:n,error:a,t:r}){let[i,o]=(0,ae.useState)(""),[s,l]=(0,ae.useState)(!1),[d,p]=(0,ae.useState)(""),u=()=>{i.trim()!==""&&n(i.trim(),s?d:"")};return Ct({onClose:t,title:r("tag.createTitle"),icon:(0,ae.createElement)(ht,{size:15}),hash:e.shortHash,portalKey:"tag-create-modal",t:r,body:[(0,ae.createElement)("input",{key:"name",className:"gp-input",placeholder:r("tag.namePlaceholder"),value:i,autoFocus:!0,onChange:g=>o(g.target.value),onKeyDown:g=>{g.key==="Enter"&&u()}}),(0,ae.createElement)("label",{key:"ann",className:"gp-modal__check"},[(0,ae.createElement)("input",{key:"cb",type:"checkbox",className:"gp-check",checked:s,onChange:()=>l(g=>!g)}),r("tag.annotated")]),s?(0,ae.createElement)("textarea",{key:"msg",className:"gp-input gp-input--area",placeholder:r("tag.messagePlaceholder"),value:d,onChange:g=>p(g.target.value)}):null,_t(r),a!==null?(0,ae.createElement)("div",{key:"err",className:"gp-feedback"},a):null],footer:St({onClose:t,onConfirm:u,confirmLabel:r("tag.create"),confirmDisabled:i.trim()==="",danger:!1,t:r})})}function oa(e,t){return typeof document>"u"?null:(0,ae.createElement)(Gi,{target:e,...t})}function Gi({target:e,from:t,dirty:n,lostFiles:a,lostTotal:r,lostTruncated:i,busy:o,error:s,onReset:l,onClose:d,t:p}){let[u,g]=(0,ae.useState)("mixed"),[w,k]=(0,ae.useState)(!1);(0,ae.useEffect)(()=>{u!=="hard"&&k(!1)},[u]);let _=[{value:"mixed",label:"reset.modeMixed",hint:"reset.mixedHint"},{value:"soft",label:"reset.modeSoft",hint:"reset.softHint"},{value:"hard",label:"reset.modeHard",hint:"reset.hardHint"}],S=o||u==="hard"&&!w;return Ct({onClose:d,title:p("reset.title"),icon:(0,ae.createElement)(Jt,{size:15}),hash:e.shortHash,portalKey:"reset-modal",t:p,body:[(0,ae.createElement)("div",{key:"txt",className:"gp-modal__confirmtext"},p("reset.body",{from:t,to:e.shortHash})),(0,ae.createElement)("div",{key:"modes",className:"gp-reset__modes"},_.map(R=>(0,ae.createElement)("label",{key:R.value,className:`gp-reset__mode${u===R.value?" gp-reset__mode--on":""}${R.value==="hard"?" gp-reset__mode--danger":""}`},[(0,ae.createElement)("input",{key:"r",type:"radio",name:"gp-reset-mode",className:"gp-check",checked:u===R.value,onChange:()=>g(R.value)}),(0,ae.createElement)("span",{key:"tx",className:"gp-reset__modetext"},[(0,ae.createElement)("span",{key:"l",className:"gp-reset__modelabel"},p(R.label)),(0,ae.createElement)("span",{key:"h",className:"gp-reset__modehint"},p(R.hint))])]))),u==="hard"?(0,ae.createElement)("div",{key:"orphan",className:"gp-reset__dirtywarn"},p("reset.hardOrphan")):null,u==="hard"&&r>0?(0,ae.createElement)("div",{key:"lost",className:"gp-reset__lost"},[(0,ae.createElement)("div",{key:"w",className:"gp-reset__warn"},p("reset.hardWarn")),(0,ae.createElement)("ul",{key:"ul",className:"gp-reset__lostlist"},[...a.map(R=>(0,ae.createElement)("li",{key:R,title:R},R)),i?(0,ae.createElement)("li",{key:"_more",className:"gp-reset__lostmore"},p("reset.lostMore")):null])]):null,u==="hard"?(0,ae.createElement)("label",{key:"ack",className:"gp-modal__check gp-reset__ack"},[(0,ae.createElement)("input",{key:"cb",type:"checkbox",className:"gp-check",checked:w,onChange:()=>k(R=>!R)}),p(r>0?"reset.hardAck":"reset.hardAckClean")]):null,n?(0,ae.createElement)("div",{key:"dirty",className:"gp-reset__dirtywarn"},p("ops.dirtyWarn")):null,_t(p),s!==null?(0,ae.createElement)("div",{key:"err",className:"gp-feedback"},s):null],footer:St({onClose:d,onConfirm:()=>void l(u),confirmLabel:p("reset.confirm"),confirmDisabled:S,danger:u==="hard",t:p})})}var Re=require("react");function sa(e,t){return typeof document>"u"?null:(0,Re.createElement)(Di,{target:e,...t})}function Di({target:e,from:t,dirty:n,busy:a,error:r,onConfirm:i,onClose:o,t:s}){let[l,d]=(0,Re.useState)(!1),p=(u,g,w,k)=>(0,Re.createElement)("label",{key:g,className:`gp-bpick__mode${l===u?" gp-bpick__mode--on":""}`},[(0,Re.createElement)("input",{key:"r",type:"radio",name:"gp-switch-mode",className:"gp-check",checked:l===u,onChange:()=>d(u)}),(0,Re.createElement)("span",{key:"tx",className:"gp-bpick__modetext"},[(0,Re.createElement)("span",{key:"l",className:"gp-bpick__modelabel"},w),(0,Re.createElement)("span",{key:"h",className:"gp-bpick__modehint"},k)])]);return $e({title:s("switch.confirmTitle"),body:s("switch.body",{from:t??s("switch.detached"),to:e.name}),extra:(0,Re.createElement)("div",{key:"x",className:"gp-bpick__extra"},[e.createFrom===void 0?null:(0,Re.createElement)("div",{key:"trk",className:"gp-bpick__note"},s("switch.trackingNote",{name:e.name,ref:e.createFrom})),n===0?null:(0,Re.createElement)("div",{key:"dw",className:"gp-bpick__warn"},s("switch.dirtyWarn",{count:n})),n===0?null:(0,Re.createElement)("div",{key:"md",className:"gp-bpick__modes"},[p(!1,"direct",s("switch.modeDirect"),s("switch.modeDirectHint")),p(!0,"stash",s("switch.modeStash",{count:n}),s("switch.modeStashHint"))])]),confirmLabel:s(l?"switch.confirmStash":"switch.confirm"),danger:!1,error:r,confirmBusy:a,busyLabel:s("switch.switching"),onConfirm:()=>i(l),onClose:o,t:s})}function Pi(e){let t=e.indexOf("/");return t<=0||t===e.length-1?null:{remote:e.slice(0,t),branch:e.slice(t+1)}}function la(e){let t=new Set(e.local.map(r=>r.name)),n=e.local.map(r=>({key:`local:${r.name}`,group:"local",label:r.name,name:r.name,reused:!1,ahead:r.ahead,behind:r.behind,shortHash:r.shortHash})),a=[];for(let r of e.remote){let i=Pi(r.name);if(i===null)continue;let o=t.has(i.branch);a.push({key:`remote:${r.name}`,group:"remote",label:r.name,name:i.branch,createFrom:o?void 0:r.name,reused:o,ahead:r.ahead,behind:r.behind,shortHash:r.shortHash})}return[...n,...a]}function da(e,t){return e.name!==t}var pe=require("react");var Xe=require("react"),ca=require("react-dom"),Li=140,Ai=260;function ln(e){let t=e?.placement??"above",n=e?.delayMs??Li,a=e?.maxWidth??Ai,[r,i]=(0,Xe.useState)(null),o=(0,Xe.useRef)(void 0),s=(0,Xe.useCallback)(()=>{o.current!==void 0&&(clearTimeout(o.current),o.current=void 0),i(null)},[]),l=(0,Xe.useCallback)((g,w)=>{o.current!==void 0&&clearTimeout(o.current),o.current=setTimeout(()=>{let k=g.getBoundingClientRect(),_=Math.max(8,Math.min(k.left,window.innerWidth-a-8));i(t==="below"?{text:w,left:_,top:k.bottom+6}:{text:w,left:_,bottom:Math.max(8,window.innerHeight-k.top+6)})},n)},[t,n,a]),d=(0,Xe.useCallback)(g=>({onMouseEnter:w=>l(w.currentTarget,g),onMouseLeave:s,onFocus:w=>l(w.currentTarget,g),onBlur:s}),[l,s]),p={left:r?.left??0,maxWidth:a};r?.top!==void 0&&(p.top=r.top),r?.bottom!==void 0&&(p.bottom=r.bottom);let u=r!==null&&typeof document<"u"?(0,ca.createPortal)((0,Xe.createElement)("div",{className:"gp-tip gp-tip--sb",style:p},r.text),document.body):null;return{tipProps:d,tipNode:u,hideTip:s}}function pa(e,t,n){if(e==="loading"||e===null)return(0,pe.createElement)("div",{className:"gp-pullscope gp-pullscope--loading"},t(n.loading));let a=t(n.line,{commits:e.commits,files:e.files,ins:e.insertions,del:e.deletions}),r=a.match(/(\+\d+)\s*\/\s*([-−]\d+)/);if(r===null)return(0,pe.createElement)("div",{className:"gp-pullscope"},a);let i=a.indexOf(r[0]);return(0,pe.createElement)("div",{className:"gp-pullscope"},[a.slice(0,i),(0,pe.createElement)("span",{key:"add",className:"gp-pullscope__add"},r[1])," / ",(0,pe.createElement)("span",{key:"del",className:"gp-pullscope__del"},r[2]),a.slice(i+r[0].length)])}function ua(e,t){return pa(e,t,{line:"status.pullScope",loading:"status.pullScopeLoading"})}function ga(e,t){return pa(e,t,{line:"status.pushScope",loading:"status.pushScopeLoading"})}function zi(e){let t=e.replace(/^https?:\/\/[^/]+\//,"").replace(/\/+$/,""),n=t.split("/");return n.length>=2?n.slice(-2).join("/"):t}function Ln(e,t){return(0,pe.createElement)(Hi,{snapshot:e,cb:t})}function Hi({snapshot:e,cb:t}){let{t:n}=t,{tipProps:a,tipNode:r,hideTip:i}=ln({placement:"above"}),o=e.remote??null,s=e.hasUpstream===!0,l=(()=>{if(o===null||o.hostKind!=="github")return null;let R=(0,pe.createElement)(kr,{size:14});if(o.webUrl===null)return(0,pe.createElement)("span",{key:"r",className:"gp-statusbar__repo gp-statusbar__repo--none","aria-label":o.url,...a(o.url)},(0,pe.createElement)("span",{className:"gp-statusbar__ic"},R));let $=o.host!==null?n("status.openRepoOn",{host:o.host}):n("status.openRepo"),q=`${zi(o.webUrl)} \xB7 ${$}`;return(0,pe.createElement)("a",{key:"r",className:"gp-statusbar__repo",href:o.webUrl,target:"_blank",rel:"noreferrer","aria-label":q,...a(q)},(0,pe.createElement)("span",{className:"gp-statusbar__ic"},R))})(),{ahead:d,behind:p,branch:u}=e,g=s&&p>0&&d===0,w=s&&d>0&&p===0,k=!s&&u!==null&&o!==null,_=(()=>{let R,$="";return u===null?R=n("status.detached"):s?d===0&&p===0?(R=n("status.synced"),$=" gp-statusbar__state--ok"):d>0&&p>0?(R=n("status.diverged",{ahead:d,behind:p}),$=" gp-statusbar__state--warn"):p>0?(R=n("status.behind",{n:p}),$=" gp-statusbar__state--warn"):R=n("status.ahead",{n:d}):R=n("status.noUpstream"),(0,pe.createElement)("span",{key:"s",className:`gp-statusbar__state${$}`},R)})(),S=[o!==null?(0,pe.createElement)("button",{key:"check",type:"button",className:"gp-icon-btn gp-statusbar__btn",disabled:t.syncBusy,"aria-label":n("status.check"),...a(n("status.checkTitle")),onClick:()=>{i(),t.onCheck()}},(0,pe.createElement)(Sr,{size:13})):null,g?(0,pe.createElement)("button",{key:"pull",type:"button",className:"gp-btn gp-btn--sm gp-statusbar__pull",disabled:t.pullBusy,"aria-label":n("status.pullTitle"),...a(n("status.pullTitle")),onClick:()=>{i(),t.onPull()}},[(0,pe.createElement)(_r,{key:"i",size:12}),n("status.pull")]):null,w?(0,pe.createElement)("button",{key:"push",type:"button",className:"gp-btn gp-btn--sm gp-statusbar__pull",disabled:t.pushBusy,"aria-label":n("status.pushTitle"),...a(n("status.pushTitle")),onClick:()=>{i(),t.onPush()}},[(0,pe.createElement)(Tn,{key:"i",size:12}),n("status.push")]):null,k?(0,pe.createElement)("button",{key:"publish",type:"button",className:"gp-btn gp-btn--sm gp-statusbar__pull",disabled:t.publishBusy,"aria-label":n("status.publishTitle"),...a(n("status.publishTitle")),onClick:()=>{i(),t.onPublish()}},[(0,pe.createElement)(Tn,{key:"i",size:12}),n("status.publish")]):null];return(0,pe.createElement)("div",{key:"statusbar",className:`gp-statusbar${t.syncBusy?" gp-statusbar--busy":""}`},[l,(0,pe.createElement)("div",{key:"sync",className:"gp-statusbar__sync"},[_,...S]),r])}var An=new Set,Tt=14,fa=30;function Fi(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n].kind!==t[n].kind||e[n].name!==t[n].name||e[n].head!==t[n].head)return!1;return!0}var Bi=46,Ii=260;function Oi(e,t){let[n,a]=(0,c.useState)(!1);return(0,c.useEffect)(()=>{if(e===null||typeof ResizeObserver>"u")return;let r=()=>a(e.clientWidth>0&&e.clientWidth<t);r();let i=new ResizeObserver(r);return i.observe(e),()=>i.disconnect()},[e,t]),n}function ma({remote:e,sessionId:t,refreshKey:n,defaultDiffView:a,snapshot:r,onAction:i,onResync:o,compact:s,t:l}){let[d,p]=(0,c.useState)({ref:null,search:"",author:"",since:""}),[u,g]=(0,c.useState)(""),[w,k]=(0,c.useState)(null),_=Oi(w,Ii),[S,R]=(0,c.useState)(new Set(["tags","remote"])),[$,q]=(0,c.useState)(0),A=n+$,T=()=>q(y=>y+1),[E,J]=(0,c.useState)(null),[O,V]=(0,c.useState)(null),[j,N]=(0,c.useState)(null),[Z,ie]=(0,c.useState)(null),[oe,W]=(0,c.useState)(null),[de,se]=(0,c.useState)(!1),[he,fe]=(0,c.useState)(!1),[Y,f]=(0,c.useState)(!1),[x,P]=(0,c.useState)(!1),[z,C]=(0,c.useState)(!1),[X,te]=(0,c.useState)(!1),[ee,xe]=(0,c.useState)(!1),[G,ve]=(0,c.useState)(!1),[Fe,Ce]=(0,c.useState)(null),[De,Le]=(0,c.useState)(null),[Ae,Be]=(0,c.useState)("list"),[Te,Ve]=(0,c.useState)(null),[pt,We]=(0,c.useState)(!1),[Ke,Ne]=(0,c.useState)(!1);(0,c.useEffect)(()=>{if(!Ke)return;let y=K=>{K.key==="Escape"&&Ne(!1)};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[Ke]),(0,c.useEffect)(()=>{!s&&Ke&&Ne(!1)},[s,Ke]),(0,c.useEffect)(()=>{if(!x){Ce(null);return}let y=!0;return Ce("loading"),e.query({sessionId:t,query:{kind:"pull-preview"}}).then(K=>{if(!y)return;let le=me(K,"pull-preview");Ce(le!==null&&le.hasUpstream?{commits:le.commits,files:le.files,insertions:le.insertions,deletions:le.deletions}:null)}),()=>{y=!1}},[x,e,t]),(0,c.useEffect)(()=>{if(!X){Le(null);return}let y=!0;return Le("loading"),e.query({sessionId:t,query:{kind:"push-preview"}}).then(K=>{if(!y)return;let le=me(K,"push-preview");Le(le!==null&&le.hasUpstream?{commits:le.commits,files:le.files,insertions:le.insertions,deletions:le.deletions}:null)}),()=>{y=!1}},[X,e,t]);let{tree:_e,treeError:Ie,authors:qe,reload:Ee}=ea(e,t,A),we=(0,c.useMemo)(()=>{let y=new Map;if(_e===null)return y;for(let K of la(_e))da(K,_e.current)&&y.set(K.key,K);return y},[_e]),ut=y=>{W(null),Ve(y)},ne=na(e,t,a),{commits:ze,loading:Et,listError:Ue,hasMore:je,listRef:Qe,loadMore:gt}=ta(e,t,d,A,ne.clearSelection);(0,c.useEffect)(()=>{let y=setTimeout(()=>p(K=>K.search===u?K:{...K,search:u}),300);return()=>clearTimeout(y)},[u]);let ke=d.search!=="",Oe=(0,c.useMemo)(()=>ke?ze.map(y=>({commit:y,lane:0,color:0,edges:[],merge:!1})):Nr(ze,r.graphStyle),[ze,ke,r.graphStyle]),ft=(0,c.useMemo)(()=>ke?0:Tr(Oe),[Oe,ke]),rt=ke?12:Math.max(Tt,ft*Tt),Ye=s?Bi:fa,at=s?`${rt}px minmax(0,1fr)`:`${rt}px minmax(120px,1fr) 72px 120px 96px`,Q=()=>{let y=Qe.current;y===null||!je||y.scrollTop+y.clientHeight>=y.scrollHeight-240&>()},B=y=>{ne.select(y),s&&Be("detail")},h=(0,c.useMemo)(()=>Date.now(),[ze]),D=(0,c.useMemo)(()=>ne.detail===null?[]:Er(ne.detail.stats.map(y=>({path:y.path,meta:y.status}))),[ne.detail]),M=ne.selected,re=M?.hash??null,[ce,ye]=(0,c.useState)({hash:null,dirs:An}),Je=ce.hash===re?ce.dirs:An,Pa=(0,c.useCallback)(y=>{ye(K=>{let le=K.hash===re?K.dirs:An,Ft=new Set(le);return Ft.has(y)?Ft.delete(y):Ft.add(y),{hash:re,dirs:Ft}})},[re]);(0,c.useEffect)(()=>{if(M===null)return;let y=ze.find(K=>K.hash===M.hash);y!==void 0&&y!==M&&!Fi(y.refs,M.refs)&&ne.resyncSelected(y)},[ze,M]);let Kn=dt({storageKey:"gp.overview.left",initial:200,min:130,reserve:360,edge:"end"}),Jn=dt({storageKey:"gp.overview.right",initial:340,min:190,reserve:360,edge:"start"}),Vn=y=>p(K=>({...K,ref:y})),La=async(y,K)=>{if(!(E===null||de)){W(null),se(!0);try{let le=await e.run({sessionId:t,action:{kind:"tag-create",name:y,commit:E.hash,...K.trim()!==""?{message:K}:{}}});le.ok?(J(null),T()):W(zt(le.error.code,le.error.message,l))}finally{se(!1)}}},Aa=async y=>{if(!de){W(null),se(!0);try{let K=await e.run({sessionId:t,action:{kind:"tag-delete",name:y}});K.ok?(V(null),T()):W(zt(K.error.code,K.error.message,l))}finally{se(!1)}}},za=async()=>{if(!(j===null||de)){W(null),se(!0);try{let y=await i({kind:"revert",commit:j.hash});y.ok?N(null):W(y.error??l("error.generic"))}finally{se(!1)}}},Ha=async y=>{if(!(Z===null||de)){W(null),se(!0);try{let K=await i({kind:"reset",commit:Z.hash,mode:y});K.ok?ie(null):W(K.error??l("error.generic"))}finally{se(!1)}}},Fa=async y=>{if(!(Te===null||pt)){W(null),We(!0);try{let K=await i({kind:"branch-checkout",name:Te.name,...Te.createFrom===void 0?{}:{createFrom:Te.createFrom},...y?{stashMessage:l("switch.stashMessage",{branch:Te.name})}:{}});K.ok?(Ve(null),Ee()):W(K.error??l("error.generic"))}finally{We(!1)}}},Ba=async()=>{if(!he){W(null),fe(!0);try{let y=await i({kind:"fetch"});y.ok?Ee():W(y.error??l("error.generic"))}finally{fe(!1)}}},Ia=async()=>{if(!Y){W(null),f(!0);try{let y=await i({kind:"pull-ff"});y.ok?(P(!1),Ee()):W(y.error??l("error.generic"))}finally{f(!1)}}},Oa=async()=>{if(!z){W(null),C(!0);try{let y=await i({kind:"push"});y.ok?(te(!1),Ee()):W(y.error??l("error.generic"))}finally{C(!1)}}},$a=async()=>{if(!(ee||r.remote===null)){W(null),xe(!0);try{let y=await i({kind:"publish",remote:r.remote.name});y.ok?(ve(!1),Ee()):W(y.error??l("error.generic"))}finally{xe(!1)}}},Wn={syncBusy:he,pullBusy:Y,pushBusy:z,publishBusy:ee,onCheck:()=>void Ba(),onPull:()=>{W(null),P(!0)},onPush:()=>{W(null),te(!0)},onPublish:()=>{W(null),ve(!0)},t:l},qn=Wi(ne.fileDiff,{data:ne.fileDiffData,error:ne.fileDiffError,mode:ne.fileDiffMode,onMode:ne.setFileDiffMode,expanded:ne.fileDiffExpanded,onExpand:y=>{ne.fileDiff!==null&&ne.openFileDiff(ne.fileDiff.path,ne.fileDiff.hash,ne.fileDiff.shortHash,y)},onClose:ne.closeFileDiff,remote:e,sessionId:t,compact:s,t:l}),Un=(0,c.useMemo)(()=>[...new Set(r.changes.filter(y=>y.status!=="untracked").map(y=>y.path))],[r.changes]),jn=[E!==null?ia(E,{onClose:()=>J(null),onCreate:La,error:oe,compact:s,t:l}):null,O!==null?$e({title:l("tag.deleteTitle"),body:l("tag.deleteConfirm",{name:O}),confirmLabel:l("tag.deleteTitle"),danger:!0,error:oe,confirmBusy:de,onConfirm:()=>void Aa(O),onClose:()=>V(null),t:l}):null,j!==null?$e({title:l("revert.title"),body:l("revert.body",{ref:`${j.shortHash} ${j.subject}`})+(r.dirty?`
|
|
670
|
+
`,Cn=!1;function or(){if(Cn||typeof document>"u")return;let e="dsh-git-panel/client.css";if(document.querySelector(`style[data-plugin-css="${e}"]`)!==null){Cn=!0;return}let t=document.createElement("style");t.dataset.plugin="@xbzbing/dsh-git-panel",t.dataset.pluginCss=e,t.textContent=ti,document.head.appendChild(t),Cn=!0}var sr={"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","common.cancel":"\u53D6\u6D88","ops.aiHint":"\u63D0\u793A\uFF1A\u7ED9 AI \u591A\u4E00\u70B9\u4FE1\u4EFB\uFF0C\u4F60\u53EF\u4EE5\u5C1D\u8BD5\u8BA9 AI \u76F4\u63A5\u6267\u884C Git \u64CD\u4F5C\u3002","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":"\u8BBF\u95EE GitHub \u67E5\u770B @xbzbing/dsh-git-panel \u9879\u76EE\uFF0C\u8BF7\u4E3A\u9879\u76EE\u70B9\u4EAE\u4E00\u9897\u5C0F\u661F\u661F\u5427 \u2B50","overview.head":"\u5168\u90E8\u5206\u652F","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.changeSummary":"{files} \u4E2A\u6587\u4EF6","overview.expandDir":"\u5C55\u5F00\u76EE\u5F55","overview.collapseDir":"\u6298\u53E0\u76EE\u5F55","overview.fetch":"\u62C9\u53D6\u8FDC\u7A0B","overview.branchesError":"\u5206\u652F\u52A0\u8F7D\u5931\u8D25","overview.filterBranch":"\u6309\u5206\u652F\u7B5B\u9009","overview.backToList":"\u8FD4\u56DE\u5217\u8868","overview.createTag":"\u521B\u5EFA\u6807\u7B7E","overview.revert":"\u8FD8\u539F\u6B64\u63D0\u4EA4","overview.reset":"\u91CD\u7F6E\u5230\u6B64","switch.action":"\u5207\u6362","switch.rowTitle":"\u5207\u6362\u5230 {name}","switch.rowTitleTrack":"\u4ECE {ref} \u65B0\u5EFA\u8DDF\u8E2A\u5206\u652F {name} \u5E76\u5207\u6362","switch.detached":"\u6E38\u79BB HEAD","switch.confirmTitle":"\u5207\u6362\u5206\u652F","switch.body":"\u4ECE {from} \u5207\u6362\u5230 {to}\u3002","switch.trackingNote":"\u672C\u5730\u8FD8\u6CA1\u6709 {name}\uFF0C\u5C06\u5148\u4ECE {ref} \u521B\u5EFA\u5B83\u5E76\u8BBE\u7F6E\u8DDF\u8E2A\uFF08upstream\uFF09\u3002","switch.dirtyWarn":"\u5F53\u524D\u6709 {count} \u4E2A\u6587\u4EF6\u5B58\u5728\u672A\u63D0\u4EA4\u53D8\u66F4\u3002","switch.modeDirect":"\u76F4\u63A5\u5207\u6362","switch.modeDirectHint":"\u672A\u63D0\u4EA4\u53D8\u66F4\u4F1A\u968F\u5DE5\u4F5C\u533A\u5E26\u8FC7\u53BB\uFF1B\u82E5\u4E0E\u76EE\u6807\u5206\u652F\u51B2\u7A81\uFF0CGit \u4F1A\u62D2\u7EDD\u5207\u6362\uFF0C\u5DE5\u4F5C\u533A\u4FDD\u6301\u4E0D\u53D8\u3002","switch.modeStash":"\u5148\u8D2E\u85CF {count} \u4E2A\u6587\u4EF6\u7684\u53D8\u66F4\uFF0C\u518D\u5207\u6362","switch.modeStashHint":"\u53D8\u66F4\u79FB\u5165\u8D2E\u85CF\u6808\u9876\uFF08\u542B\u672A\u8DDF\u8E2A\u6587\u4EF6\uFF09\uFF0C\u5207\u6362\u540E\u53EF\u4ECE\u300C\u53D8\u66F4\u8BB0\u5F55 \u2192 \u8D2E\u85CF\u300D\u6062\u590D\u3002\u6CE8\u610F\uFF1A\u4E0D\u4F1A\u81EA\u52A8\u6062\u590D\uFF1B\u6062\u590D\u65F6\u82E5\u4E0E\u76EE\u6807\u5206\u652F\u51B2\u7A81\u9700\u624B\u52A8\u89E3\u51B3\u3002","switch.confirm":"\u5207\u6362","switch.confirmStash":"\u8D2E\u85CF\u5E76\u5207\u6362","switch.switching":"\u6B63\u5728\u5207\u6362\u2026","switch.stashMessage":"\u5207\u6362\u5230 {branch} \u524D\u81EA\u52A8\u8D2E\u85CF","tag.createTitle":"\u5728\u6B64\u63D0\u4EA4\u521B\u5EFA\u6807\u7B7E","tag.namePlaceholder":"\u6807\u7B7E\u540D","tag.annotated":"\u9644\u6CE8\u6807\u7B7E\uFF08\u5E26\u8BF4\u660E\uFF09","tag.messagePlaceholder":"\u6807\u7B7E\u8BF4\u660E","tag.create":"\u521B\u5EFA\u6807\u7B7E","tag.deleteTitle":"\u5220\u9664\u6807\u7B7E","tag.deleteConfirm":"\u786E\u5B9A\u5220\u9664\u6807\u7B7E\u300C{name}\u300D\uFF1F","tag.deleteOne":"\u5220\u9664\u6807\u7B7E\u300C{name}\u300D","ops.dirtyWarn":"\u68C0\u6D4B\u5230\u672A\u63D0\u4EA4\u6539\u52A8\uFF0C\u8FD9\u4E9B\u6539\u52A8\u53EF\u80FD\u662F dsh AI \u6B63\u5728\u8FDB\u884C\u7684\u5DE5\u4F5C\u3002","revert.title":"\u8FD8\u539F\u63D0\u4EA4","revert.body":"\u5C06\u5728\u5F53\u524D HEAD \u8FFD\u52A0\u4E00\u4E2A\u53CD\u5411\u63D0\u4EA4\uFF0C\u8FD8\u539F {ref} \u7684\u6539\u52A8\u3002\u4E0D\u4F1A\u4E22\u5F03\u4F60\u7684\u5DE5\u4F5C\u533A\u6539\u52A8\u3002","revert.confirm":"\u8FD8\u539F","reset.title":"\u91CD\u7F6E\u5206\u652F","reset.body":"\u5C06\u628A\u5F53\u524D\u5206\u652F\u7684 HEAD \u4ECE {from} \u79FB\u52A8\u5230 {to}\u3002","reset.modeSoft":"\u8F6F\u91CD\u7F6E\uFF08--soft\uFF09","reset.softHint":"\u79FB\u52A8 HEAD\uFF0C\u6539\u52A8\u4FDD\u7559\u5728\u6682\u5B58\u533A\u3002","reset.modeMixed":"\u6DF7\u5408\u91CD\u7F6E\uFF08--mixed\uFF0C\u9ED8\u8BA4\uFF09","reset.mixedHint":"\u79FB\u52A8 HEAD\uFF0C\u6539\u52A8\u4FDD\u7559\u5728\u5DE5\u4F5C\u533A\u3002","reset.modeHard":"\u786C\u91CD\u7F6E\uFF08--hard\uFF09","reset.hardHint":"\u79FB\u52A8 HEAD \u5230\u6B64\u63D0\u4EA4\u5E76\u4E22\u5F03\u6240\u6709\u672A\u63D0\u4EA4\u6539\u52A8\uFF08\u672A\u63D0\u4EA4\u6539\u52A8\u65E0\u6CD5\u6062\u590D\uFF09\u3002","reset.hardOrphan":"\u5F53\u524D\u5206\u652F\u4E0A\u665A\u4E8E\u76EE\u6807\u7684\u63D0\u4EA4\u4F1A\u79BB\u5F00\u5206\u652F\uFF08\u4ECD\u53EF\u7528 git reflog \u627E\u56DE\uFF09\u3002","reset.hardWarn":"\u4EE5\u4E0B\u672A\u63D0\u4EA4\u6539\u52A8\u5C06\u88AB\u6C38\u4E45\u4E22\u5F03\uFF1A","reset.lostMore":"\u2026\u8FD8\u6709\u66F4\u591A\u672A\u63D0\u4EA4\u6539\u52A8\u672A\u663E\u793A\uFF08\u5217\u8868\u5DF2\u622A\u65AD\uFF09","reset.hardAck":"\u6211\u5DF2\u4E86\u89E3\uFF0C\u786E\u8BA4\u4E22\u5F03\u8FD9\u4E9B\u672A\u63D0\u4EA4\u6539\u52A8","reset.hardAckClean":"\u6211\u5DF2\u4E86\u89E3\u6B64\u64CD\u4F5C\u7684\u540E\u679C\uFF0C\u786E\u8BA4\u91CD\u7F6E","reset.confirm":"\u91CD\u7F6E","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","changes.backToList":"\u8FD4\u56DE\u5217\u8868","changes.stash":"\u8D2E\u85CF\u66F4\u6539","stash.title":"\u8D2E\u85CF\u5F53\u524D\u66F4\u6539","stash.messagePlaceholder":"\u8D2E\u85CF\u8BF4\u660E\uFF08\u53EF\u9009\uFF09","stash.save":"\u8D2E\u85CF","stash.section":"\u8D2E\u85CF","stash.onBranch":"\u4F4D\u4E8E {branch}","stash.apply":"\u5E94\u7528","stash.pop":"\u5F39\u51FA","stash.drop":"\u4E22\u5F03","stash.dropTitle":"\u4E22\u5F03\u8D2E\u85CF","stash.dropConfirm":"\u786E\u5B9A\u4E22\u5F03\u6B64\u8D2E\u85CF\u6761\u76EE\uFF1F\u4E22\u5F03\u540E\u65E0\u6CD5\u6062\u590D\uFF1A{name}","files.selectFile":"\u9009\u62E9\u4E00\u4E2A\u6587\u4EF6\u67E5\u770B\u5185\u5BB9","files.loadFailed":"\u52A0\u8F7D\u5931\u8D25","files.backToTree":"\u8FD4\u56DE\u6587\u4EF6\u6811","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.highlightOff":"\u6587\u4EF6\u8F83\u5927\uFF0C\u5DF2\u5173\u95ED\u8BED\u6CD5\u9AD8\u4EAE\u4EE5\u4FDD\u6301\u6D41\u7545","files.lineTruncated":" \u2026\uFF08\u6B64\u884C\u8FC7\u957F\uFF0C\u5DF2\u622A\u65AD\uFF09","files.findPlaceholder":"\u5728\u6B64\u6587\u4EF6\u4E2D\u67E5\u627E","files.findNoMatch":"\u65E0\u5339\u914D","files.findPrev":"\u4E0A\u4E00\u4E2A","files.findNext":"\u4E0B\u4E00\u4E2A","files.findClose":"\u5173\u95ED\u67E5\u627E","files.findCase":"\u533A\u5206\u5927\u5C0F\u5199","files.previewMode":"\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.copyContent":"\u590D\u5236\u6587\u4EF6\u5185\u5BB9","files.contentCopied":"\u5185\u5BB9\u5DF2\u590D\u5236","files.contentCopyFailed":"\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","files.zoomBar":"\u56FE\u7247\u7F29\u653E","files.zoomIn":"\u653E\u5927","files.zoomOut":"\u7F29\u5C0F","files.zoomActual":"\u5B9E\u9645\u5927\u5C0F\uFF08100%\uFF09","files.zoomFit":"\u9002\u5E94\u7A97\u53E3","files.zoomFullscreen":"\u5168\u5C4F\u67E5\u770B","files.gitNotInstalled":"\u7CFB\u7EDF\u672A\u5B89\u88C5 Git\uFF0CGit \u9762\u677F\u4E0D\u53EF\u7528\uFF0C\u8BF7\u5B89\u88C5 Git \u5DE5\u5177\u540E\u91CD\u8BD5\u3002","files.propsTitle":"\u6587\u4EF6\u5C5E\u6027","files.propsGroupStats":"\u5927\u5C0F\u4E0E\u7EDF\u8BA1","files.propsGroupTime":"\u65F6\u95F4","files.propsName":"\u540D\u79F0","files.propsType":"\u7C7B\u578B","files.propsTypeImage":"{fmt} \u56FE\u7247","files.propsTypeText":"\u6587\u672C\u6587\u4EF6","files.propsTypeBinary":"\u4E8C\u8FDB\u5236\u6587\u4EF6","files.propsTypeUnread":"\u8FC7\u5927\u672A\u8BFB\u53D6","files.propsTypeFmt":"{label}\uFF08.{ext}\uFF09","files.propsRelPath":"\u76F8\u5BF9\u8DEF\u5F84","files.propsAbsPath":"\u7EDD\u5BF9\u8DEF\u5F84","files.propsCopyHint":"\u70B9\u51FB\u590D\u5236","files.propsSize":"\u5927\u5C0F","files.propsSizeBytes":"\uFF08{bytes} \u5B57\u8282\uFF09","files.propsLines":"\u884C\u6570","files.propsImageSize":"\u56FE\u7247\u5C3A\u5BF8","files.propsImageSizeFmt":"{w} \xD7 {h}","files.propsMtime":"\u4FEE\u6539\u65F6\u95F4","files.propsUntracked":"\u672A\u8DDF\u8E2A","files.propsTrackedYes":"\u5DF2\u8DDF\u8E2A","files.propsStaged":"\u5DF2\u6682\u5B58","files.stAdded":"\u5DF2\u6DFB\u52A0","files.stModified":"\u5DF2\u4FEE\u6539","files.stDeleted":"\u5DF2\u5220\u9664","files.stRenamed":"\u5DF2\u91CD\u547D\u540D","files.stConflicted":"\u6709\u51B2\u7A81","files.stTypechange":"\u7C7B\u578B\u53D8\u66F4","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}","stats.partial":"\u7EDF\u8BA1\u5DF2\u7B80\u5316","stats.partialHint":"\u53D8\u66F4\u6570\u91CF\u8F83\u591A\uFF0C\u5DF2\u8DF3\u8FC7\u672A\u8DDF\u8E2A\u6587\u4EF6\u884C\u6570\u4E0E\u6700\u8FD1\u53D8\u66F4\u65F6\u95F4\u7684\u7CBE\u786E\u7EDF\u8BA1\u4EE5\u4FDD\u6301\u9762\u677F\u6D41\u7545\u3002","commit.placeholder":"\u63D0\u4EA4\u4FE1\u606F","commit.commit":"\u63D0\u4EA4","commit.amend":"\u4FEE\u6B63\u4E0A\u6B21\u63D0\u4EA4\uFF08amend\uFF09","commit.suggest":"AI \u751F\u6210","commit.suggesting":"\u751F\u6210\u4E2D\u2026","commit.suggestOverwrite":"\u518D\u6B21\u70B9\u51FB\u300CAI \u751F\u6210\u300D\u4EE5\u8986\u76D6\u5F53\u524D\u63D0\u4EA4\u4FE1\u606F","commit.suggestTruncated":"diff \u8FC7\u957F\u5DF2\u622A\u65AD\uFF0C\u751F\u6210\u7684\u5EFA\u8BAE\u53EF\u80FD\u4E0D\u5B8C\u6574","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","diff.expandCapped":"\u6587\u4EF6\u8F83\u5927\uFF0C\u5DF2\u5C55\u5F00 {n} \u884C\u4E0A\u4E0B\u6587\uFF0C\u5176\u4F59\u4FDD\u6301\u6298\u53E0\uFF0C\u53EF\u9010\u6BB5\u5C55\u5F00","diff.truncated":"git \u8F93\u51FA\u8D85\u51FA\u4E0A\u9650\uFF1A\u6B64\u5DEE\u5F02\u53EA\u4FDD\u7559\u4E86\u5C3E\u6BB5\uFF0C\u5F00\u5934\u7684\u6539\u52A8\u4E0E\u589E\u5220\u7EDF\u8BA1\u53EF\u80FD\u7F3A\u5931","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\u64CD\u4F5C\u88AB\u963B\u6B62","error.emptyMessage":"\u63D0\u4EA4\u4FE1\u606F\u4E0D\u80FD\u4E3A\u7A7A","error.emptyDiff":"\u6CA1\u6709\u53EF\u751F\u6210\u7684\u53D8\u66F4","error.llmUnavailable":"AI \u670D\u52A1\u4E0D\u53EF\u7528","error.llmFailed":"AI \u751F\u6210\u5931\u8D25","error.suggestDisabled":"AI \u751F\u6210\u5DF2\u5728\u63D2\u4EF6\u914D\u7F6E\u4E2D\u5173\u95ED","error.conflict":"\u8D2E\u85CF\u5E94\u7528\u4EA7\u751F\u51B2\u7A81\uFF0C\u8D2E\u85CF\u6761\u76EE\u5DF2\u4FDD\u7559\uFF0C\u8BF7\u624B\u52A8\u89E3\u51B3\u51B2\u7A81\u540E\u518D\u8BD5","error.revertConflict":"\u8FD8\u539F\u4F1A\u4E0E\u5F53\u524D\u5185\u5BB9\u51B2\u7A81\uFF0C\u5DF2\u81EA\u52A8\u53D6\u6D88\u8FD8\u539F\uFF08\u672A\u6539\u52A8\u4F60\u7684\u5DE5\u4F5C\u533A\uFF09","error.revertStuck":"\u8FD8\u539F\u4EA7\u751F\u51B2\u7A81\u4E14\u81EA\u52A8\u53D6\u6D88\u5931\u8D25\uFF0C\u4ED3\u5E93\u4ECD\u5904\u4E8E\u8FD8\u539F\u4E2D\uFF0C\u8BF7\u624B\u52A8\u6267\u884C git revert --abort \u6216\u89E3\u51B3\u51B2\u7A81","error.revertMerge":"\u8FD9\u662F\u4E00\u4E2A\u5408\u5E76\u63D0\u4EA4\uFF0C\u9762\u677F\u6682\u4E0D\u652F\u6301\u8FD8\u539F\uFF08\u9700\u6307\u5B9A\u4E3B\u7EBF\u7236\u63D0\u4EA4\uFF09\uFF0C\u8BF7\u5728\u547D\u4EE4\u884C\u7528 git revert -m \u5904\u7406","error.indexBusy":"Git \u6B63\u5FD9\uFF08\u53E6\u4E00\u8FDB\u7A0B\u5360\u7528\u7D22\u5F15\uFF09\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5","error.notFound":"\u76EE\u6807\u4E0D\u5B58\u5728\uFF08\u5206\u652F / \u6807\u7B7E / \u8D2E\u85CF\u53EF\u80FD\u5DF2\u88AB\u5220\u9664\u6216\u91CD\u547D\u540D\uFF09","error.branchInUse":"\u8BE5\u5206\u652F\u5DF2\u5728\u53E6\u4E00\u4E2A\u5DE5\u4F5C\u6811\u4E2D\u68C0\u51FA\uFF0C\u65E0\u6CD5\u5728\u6B64\u5207\u6362","error.stashSwitchFailed":"\u672A\u63D0\u4EA4\u53D8\u66F4\u5DF2\u8D2E\u85CF\uFF08\u53EF\u5728\u300C\u53D8\u66F4\u8BB0\u5F55 \u2192 \u8D2E\u85CF\u300D\u6062\u590D\uFF09\uFF0C\u4F46\u5207\u6362\u5931\u8D25\uFF1A{reason}","error.invalidName":"\u540D\u79F0\u4E0D\u5408\u6CD5","error.notFastForward":"\u672C\u5730\u4E0E\u8FDC\u7A0B\u5206\u652F\u5DF2\u5206\u53C9\uFF0C\u65E0\u6CD5\u5FEB\u8FDB\u62C9\u53D6\uFF0C\u8BF7\u624B\u52A8\u5408\u5E76\u6216\u53D8\u57FA","error.pushRejected":"\u63A8\u9001\u88AB\u62D2\u7EDD\uFF1A\u8FDC\u7A0B\u5DF2\u6709\u65B0\u63D0\u4EA4\uFF0C\u8BF7\u5148\u300C\u68C0\u67E5\u540C\u6B65\u300D\u5E76\u62C9\u53D6\u540E\u518D\u63A8\u9001","error.authFailed":"\u8BA4\u8BC1\u5931\u8D25\uFF1A\u6CA1\u6709\u53EF\u7528\u7684 git \u51ED\u636E\uFF08HTTPS \u9700\u51ED\u636E\u52A9\u624B\u3001SSH \u9700\u5BC6\u94A5\uFF09\u3002\u8BF7\u5148\u5728\u547D\u4EE4\u884C\u5B8C\u6210\u4E00\u6B21\u63A8\u9001\u4EE5\u7F13\u5B58\u51ED\u636E","status.openRepo":"\u5728\u6D4F\u89C8\u5668\u6253\u5F00\u4ED3\u5E93\u4E3B\u9875","status.openRepoOn":"\u5728 {host} \u6253\u5F00\u4ED3\u5E93\u4E3B\u9875","status.synced":"\u5DF2\u4E0E\u8FDC\u7A0B\u540C\u6B65","status.ahead":"\u9886\u5148 {n}","status.behind":"\u843D\u540E {n}","status.diverged":"\u5DF2\u5206\u53C9\uFF08\u9886\u5148 {ahead} / \u843D\u540E {behind}\uFF09","status.noUpstream":"\u672A\u8DDF\u8E2A\u8FDC\u7A0B\u5206\u652F","status.detached":"\u6E38\u79BB HEAD\uFF0C\u65E0\u5206\u652F\u540C\u6B65\u72B6\u6001","status.check":"\u68C0\u67E5\u540C\u6B65\u72B6\u6001","status.checkTitle":"\u68C0\u67E5\u4E0E\u8FDC\u7A0B\u7684\u540C\u6B65\u72B6\u6001\uFF1A\u6267\u884C git fetch \u62C9\u53D6\u6700\u65B0\u5F15\u7528\u5E76\u5237\u65B0\u9886\u5148/\u843D\u540E\u8BA1\u6570\uFF0C\u4E0D\u6539\u52A8\u5DE5\u4F5C\u533A","status.pull":"\u62C9\u53D6","status.pulling":"\u540C\u6B65\u4E2D\u2026","status.pullTitle":"\u5FEB\u8FDB\u62C9\u53D6\u8FDC\u7A0B\u66F4\u65B0","status.pullConfirmTitle":"\u62C9\u53D6\u8FDC\u7A0B\u66F4\u65B0","status.pullConfirmBody":"\u5C06\u4EE5\u5FEB\u8FDB\u65B9\u5F0F\u628A\u5F53\u524D\u5206\u652F {branch} \u66F4\u65B0\u5230\u8FDC\u7A0B\u6700\u65B0\u63D0\u4EA4\uFF08\u843D\u540E {behind} \u4E2A\u63D0\u4EA4\uFF09\u3002\u4EC5\u5728\u672A\u5206\u53C9\u65F6\u53EF\u884C\uFF0C\u4E0D\u4F1A\u4EA7\u751F\u5408\u5E76\u63D0\u4EA4\uFF0C\u4E5F\u4E0D\u4F1A\u6539\u52A8\u4F60\u7684\u672A\u63D0\u4EA4\u5185\u5BB9\u3002","status.pullConfirm":"\u62C9\u53D6","status.pullScope":"\u5C06\u5F15\u5165 {commits} \u4E2A\u63D0\u4EA4 \xB7 {files} \u4E2A\u6587\u4EF6 \xB7 +{ins} / \u2212{del} \u884C","status.pullScopeLoading":"\u6B63\u5728\u7EDF\u8BA1\u8FDC\u7A0B\u5DEE\u5F02\u2026","status.push":"\u63A8\u9001","status.pushTitle":"\u63A8\u9001\u672C\u5730\u63D0\u4EA4\u5230\u8FDC\u7A0B","status.pushConfirmTitle":"\u63A8\u9001\u5230\u8FDC\u7A0B","status.pushConfirmBody":"\u5C06\u628A\u5F53\u524D\u5206\u652F {branch} \u9886\u5148\u8FDC\u7A0B\u7684 {ahead} \u4E2A\u63D0\u4EA4\u63A8\u9001\u5230\u4E0A\u6E38\u3002\u4EC5\u505A\u5FEB\u8FDB\u63A8\u9001\uFF0C\u4E0D\u4F1A\u5F3A\u5236\u8986\u76D6\u8FDC\u7A0B\u5386\u53F2\u3002","status.pushConfirm":"\u63A8\u9001","status.pushing":"\u63A8\u9001\u4E2D\u2026","status.pushScope":"\u5C06\u63A8\u9001 {commits} \u4E2A\u63D0\u4EA4 \xB7 {files} \u4E2A\u6587\u4EF6 \xB7 +{ins} / \u2212{del} \u884C","status.pushScopeLoading":"\u6B63\u5728\u7EDF\u8BA1\u5F85\u63A8\u9001\u5DEE\u5F02\u2026","status.publish":"\u53D1\u5E03","status.publishTitle":"\u53D1\u5E03\u5206\u652F\u5E76\u8BBE\u7F6E\u4E0A\u6E38","status.publishConfirmTitle":"\u53D1\u5E03\u5206\u652F\u5230\u8FDC\u7A0B","status.publishConfirmBody":"\u5F53\u524D\u5206\u652F {branch} \u5C1A\u672A\u8DDF\u8E2A\u8FDC\u7A0B\u3002\u5C06\u6267\u884C git push -u {remote} \u5728\u8FDC\u7A0B\u521B\u5EFA\u540C\u540D\u5206\u652F\u5E76\u8BBE\u4E3A\u4E0A\u6E38\u8DDF\u8E2A\u3002","status.publishConfirm":"\u53D1\u5E03","status.publishing":"\u53D1\u5E03\u4E2D\u2026","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.graphTitle":"\u63D0\u4EA4\u5386\u53F2\u56FE\u7EBF\u6761\u6837\u5F0F","cfg.graphHint":"\u9009\u62E9\u63D0\u4EA4\u5386\u53F2\u56FE\u7684\u8FDE\u7EBF\u753B\u6CD5\uFF1A\u5E73\u884C\u7EBF\u4E3A VSCode / \u56FE\u5F62\u754C\u9762\u98CE\u683C\uFF0C\u5206\u652F\u5404\u5360\u4E00\u5217\u3001\u5171\u4EAB\u7956\u5148\u4EE5\u5E76\u884C\u7EBF\u8868\u793A\uFF1B\u7D27\u51D1\u4E3A git log \u547D\u4EE4\u884C\u98CE\u683C\uFF0C\u5171\u4EAB\u7956\u5148\u5408\u5E76\u4E3A\u4E00\u5217\u3001\u7EBF\u66F4\u5C11\u3002\u4FDD\u5B58\u540E\u7ACB\u5373\u751F\u6548\u3002","cfg.graphParallel":"\u5E73\u884C\u7EBF\uFF08VSCode \u98CE\u683C\uFF09","cfg.graphCompact":"\u7D27\u51D1\uFF08git log \u98CE\u683C\uFF09","cfg.suggestTitle":"AI \u751F\u6210\u63D0\u4EA4\u4FE1\u606F","cfg.suggestToggle":"\u63D0\u4EA4\u6846\u663E\u793A AI \u751F\u6210\u6309\u94AE","cfg.suggestLangLabel":"\u751F\u6210\u8BED\u8A00","cfg.suggestLangAuto":"\u81EA\u52A8","cfg.suggestLangZh":"\u4E2D\u6587","cfg.suggestLangEn":"English","cfg.suggestLangHint":"\u81EA\u52A8 = \u8DDF\u968F\u4F60\u5728\u6B64\u4ED3\u5E93\u7684\u63D0\u4EA4\u8BED\u8A00\uFF08\u5C31\u8FD1\u52A0\u6743\uFF0C\u5F53\u524D git \u4F5C\u8005\u4F18\u5148\uFF0C\u5FFD\u7565 release / merge \u7B49\u673A\u68B0\u63D0\u4EA4\uFF09\uFF1B\u4E2D\u6587 / English \u76F4\u63A5\u6307\u5B9A\u3002","cfg.suggestMaxBytesLabel":"\u8F93\u5165\u9884\u7B97","cfg.suggestMaxBytesUnit":"KiB","cfg.suggestMaxBytesHint":"\u53D1\u9001\u7ED9\u6A21\u578B\u7684 diff \u4E0A\u9650\uFF0C\u8D85\u51FA\u4F1A\u622A\u65AD\uFF1B\u8303\u56F4 16\u2013512\u3002","cfg.suggestOutputLabel":"\u8F93\u51FA\u4E0A\u9650","cfg.suggestOutputUnit":"tokens","cfg.suggestOutputHint":"\u6A21\u578B\u751F\u6210\u9884\u7B97\uFF1B\u601D\u8003\u6A21\u578B\u7684\u63A8\u7406\u8BA1\u5165\u8BE5\u9884\u7B97\uFF1B\u8303\u56F4 256\u201316384\u3002","cfg.suggestTimeoutLabel":"\u751F\u6210\u8D85\u65F6","cfg.suggestTimeoutUnit":"\u79D2","cfg.suggestTimeoutHint":"\u8D85\u65F6\u5373\u751F\u6210\u5931\u8D25\uFF1B\u8303\u56F4 5\u2013120\u3002","cfg.suggestHint":"\u5F00\u542F\u540E\u63D0\u4EA4\u6846\u65C1\u4F1A\u51FA\u73B0\u300CAI \u751F\u6210\u300D\u6309\u94AE\uFF1A\u6839\u636E\u5F53\u524D\u53D8\u66F4\u4E0E\u4ED3\u5E93\u65E2\u6709\u63D0\u4EA4\u98CE\u683C\u751F\u6210\u63D0\u4EA4\u4FE1\u606F\uFF0C\u586B\u5165\u540E\u53EF\u7F16\u8F91\u518D\u63D0\u4EA4\u3002\u751F\u6210\u7684\u8BF7\u6C42\u4F1A\u4F7F\u7528\u4F60\u5728 DSH \u4E2D\u914D\u7F6E\u7684\u6A21\u578B\uFF0Cdiff \u5185\u5BB9\u4F1A\u53D1\u9001\u7ED9\u6A21\u578B\u4F9B\u5E94\u5546\u3002\u4FDD\u5B58\u540E\u7ACB\u5373\u751F\u6548\u3002","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"},lr={"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","common.cancel":"Cancel","ops.aiHint":"Tip: Trust AI more, try direct Git\u2011operation execution by AI.","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":"Visit @xbzbing/dsh-git-panel on GitHub \u2014 please give the project a little star \u2B50","overview.head":"All branches","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.changeSummary":"{files} files","overview.expandDir":"Expand folder","overview.collapseDir":"Collapse folder","overview.fetch":"Fetch","overview.branchesError":"Failed to load branches","overview.filterBranch":"Filter by branch","overview.backToList":"Back to list","overview.createTag":"Create tag","switch.action":"Switch","switch.rowTitle":"Switch to {name}","switch.rowTitleTrack":"Create {name} tracking {ref} and switch to it","switch.detached":"detached HEAD","switch.confirmTitle":"Switch branch","switch.body":"Switch from {from} to {to}.","switch.trackingNote":"There is no local {name} yet: it will be created from {ref} and set to track it.","switch.dirtyWarn":"{count} file(s) have uncommitted changes.","switch.modeDirect":"Switch directly","switch.modeDirectHint":"Uncommitted changes come along; if they collide with the target branch, git refuses the switch and the work tree stays untouched.","switch.modeStash":"Stash the {count} file(s) first, then switch","switch.modeStashHint":"The changes (including untracked files) move to the top of the stash; restore them from Changes \u2192 Stash afterwards. Note: they are not restored automatically, and restoring may need manual conflict resolution.","switch.confirm":"Switch","switch.confirmStash":"Stash and switch","switch.switching":"Switching\u2026","switch.stashMessage":"Auto-stash before switching to {branch}","overview.revert":"Revert this commit","overview.reset":"Reset to here","tag.createTitle":"Create a tag at this commit","tag.namePlaceholder":"Tag name","tag.annotated":"Annotated tag (with message)","tag.messagePlaceholder":"Tag message","tag.create":"Create tag","tag.deleteTitle":"Delete tag","tag.deleteConfirm":'Delete tag "{name}"?',"tag.deleteOne":'Delete tag "{name}"',"ops.dirtyWarn":"There are uncommitted changes \u2014 they may be work the dsh AI is doing.","revert.title":"Revert commit","revert.body":"Appends a reverse commit at the current HEAD that undoes the changes in {ref}. Your working-tree changes are kept.","revert.confirm":"Revert","reset.title":"Reset branch","reset.body":"Moves the current branch HEAD from {from} to {to}.","reset.modeSoft":"Soft (--soft)","reset.softHint":"Moves HEAD; changes stay staged.","reset.modeMixed":"Mixed (--mixed, default)","reset.mixedHint":"Moves HEAD; changes stay in the working tree.","reset.modeHard":"Hard (--hard)","reset.hardHint":"Moves HEAD to this commit and discards all uncommitted changes (uncommitted changes cannot be recovered).","reset.hardOrphan":"Commits after the target leave the branch (still recoverable via git reflog).","reset.hardWarn":"The following uncommitted changes will be permanently discarded:","reset.lostMore":"\u2026 more uncommitted changes not shown (list capped)","reset.hardAck":"I understand these uncommitted changes will be lost","reset.hardAckClean":"I understand the consequences and confirm the reset","reset.confirm":"Reset","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","changes.backToList":"Back to list","changes.stash":"Stash changes","stash.title":"Stash current changes","stash.messagePlaceholder":"Stash message (optional)","stash.save":"Stash","stash.section":"Stashes","stash.onBranch":"on {branch}","stash.apply":"Apply","stash.pop":"Pop","stash.drop":"Drop","stash.dropTitle":"Drop stash","stash.dropConfirm":"Drop this stash? This cannot be undone: {name}","files.selectFile":"Select a file to preview","files.loadFailed":"Load failed","files.backToTree":"Back to files","files.truncated":"Too many entries \u2014 truncated","files.tooLarge":"File too large to preview","files.binary":"Binary file \u2014 no preview","files.highlightOff":"Large file \u2014 syntax highlighting disabled for performance","files.lineTruncated":" \u2026 (line too long, truncated)","files.findPlaceholder":"Find in file","files.findNoMatch":"No results","files.findPrev":"Previous match","files.findNext":"Next match","files.findClose":"Close find","files.findCase":"Match case","files.previewMode":"Preview mode","files.source":"Source","files.render":"Rendered","files.copyPath":"Copy relative path","files.pathCopied":"Path copied","files.pathCopyFailed":"Copy failed","files.copyContent":"Copy file content","files.contentCopied":"Content copied","files.contentCopyFailed":"Copy failed","files.ignored":"Ignored by Git","files.copy":"Copy code","files.copied":"Copied","files.footnotes":"Footnotes","files.zoomBar":"Image zoom","files.zoomIn":"Zoom in","files.zoomOut":"Zoom out","files.zoomActual":"Actual size (100%)","files.zoomFit":"Fit to window","files.zoomFullscreen":"View fullscreen","files.gitNotInstalled":"Git is not installed; the Git panel is unavailable. Please install Git and try again.","files.propsTitle":"File properties","files.propsGroupStats":"Size & stats","files.propsGroupTime":"Timestamps","files.propsName":"Name","files.propsType":"Type","files.propsTypeImage":"{fmt} image","files.propsTypeText":"Text file","files.propsTypeBinary":"Binary file","files.propsTypeUnread":"Too large to read","files.propsTypeFmt":"{label} (.{ext})","files.propsRelPath":"Relative path","files.propsAbsPath":"Absolute path","files.propsCopyHint":"Click to copy","files.propsSize":"Size","files.propsSizeBytes":"({bytes} bytes)","files.propsLines":"Lines","files.propsImageSize":"Dimensions","files.propsImageSizeFmt":"{w} \xD7 {h}","files.propsMtime":"Modified","files.propsUntracked":"Untracked","files.propsTrackedYes":"Tracked","files.propsStaged":"Staged","files.stAdded":"Added","files.stModified":"Modified","files.stDeleted":"Deleted","files.stRenamed":"Renamed","files.stConflicted":"Conflicted","files.stTypechange":"Type changed","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","stats.partial":"simplified","stats.partialHint":"Large change set \u2014 untracked line counts and last-change time are omitted to keep the panel responsive.","commit.placeholder":"Commit message","commit.commit":"Commit","commit.amend":"Amend previous commit","commit.suggest":"AI suggest","commit.suggesting":"Generating\u2026","commit.suggestOverwrite":'Click "AI suggest" again to replace the current message',"commit.suggestTruncated":"The diff was truncated; the suggestion may be incomplete","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","diff.expandCapped":"Large file: expanded {n} lines of context; the rest stays collapsed and can be expanded in place","diff.truncated":"git output exceeded the output cap: only the tail of this diff survived, so the opening changes and the +/- counts may be missing","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 this operation","error.emptyMessage":"Commit message cannot be empty","error.emptyDiff":"No changes to summarize","error.llmUnavailable":"AI service unavailable","error.llmFailed":"AI generation failed","error.suggestDisabled":"AI suggest is turned off in the plugin config","error.conflict":"Applying the stash produced conflicts; the stash entry is kept \u2014 resolve them and retry","error.revertConflict":"The revert would conflict with the current content; it was cancelled automatically (your working tree is unchanged)","error.revertStuck":"The revert conflicted and could not be auto-cancelled; the repository is mid-revert \u2014 run `git revert --abort` or resolve it manually","error.revertMerge":"This is a merge commit; the panel cannot revert it (a mainline parent is required) \u2014 use `git revert -m` on the command line","error.indexBusy":"Git is busy (another process holds the index lock); try again shortly","error.notFound":"Target not found (the branch / tag / stash may have been removed or renamed)","error.branchInUse":"That branch is checked out in another worktree, so it cannot be switched to here","error.stashSwitchFailed":"The uncommitted changes were stashed (restore them from Changes \u2192 Stash), but the switch failed: {reason}","error.invalidName":"Invalid name","error.notFastForward":"Local and remote have diverged \u2014 a fast-forward pull is not possible; merge or rebase manually","error.pushRejected":"Push rejected: the remote has new commits \u2014 run \u201CCheck sync\u201D and pull first, then push","error.authFailed":"Authentication failed: no usable git credentials (HTTPS needs a credential helper, SSH needs a key). Push once from the command line first to cache them","status.openRepo":"Open the repository home in the browser","status.openRepoOn":"Open the repository home on {host}","status.synced":"Up to date with remote","status.ahead":"{n} ahead","status.behind":"{n} behind","status.diverged":"Diverged ({ahead} ahead / {behind} behind)","status.noUpstream":"No upstream branch","status.detached":"Detached HEAD \u2014 no branch sync state","status.check":"Check sync status","status.checkTitle":"Check sync with the remote: runs git fetch to update refs and refresh the ahead/behind counts; your working tree is untouched","status.pull":"Pull","status.pulling":"Syncing\u2026","status.pullTitle":"Fast-forward pull of remote updates","status.pullConfirmTitle":"Pull remote updates","status.pullConfirmBody":"Fast-forwards the current branch {branch} to the latest remote commit ({behind} behind). Only possible when not diverged; it creates no merge commit and leaves your uncommitted work untouched.","status.pullConfirm":"Pull","status.pullScope":"Brings in {commits} commits \xB7 {files} files \xB7 +{ins} / \u2212{del} lines","status.pullScopeLoading":"Measuring incoming changes\u2026","status.push":"Push","status.pushTitle":"Push local commits to the remote","status.pushConfirmTitle":"Push to remote","status.pushConfirmBody":"Pushes the {ahead} commits that {branch} is ahead of the remote to its upstream. Fast-forward only \u2014 it never force-overwrites remote history.","status.pushConfirm":"Push","status.pushing":"Pushing\u2026","status.pushScope":"Pushes {commits} commits \xB7 {files} files \xB7 +{ins} / \u2212{del} lines","status.pushScopeLoading":"Measuring outgoing changes\u2026","status.publish":"Publish","status.publishTitle":"Publish the branch and set its upstream","status.publishConfirmTitle":"Publish branch to remote","status.publishConfirmBody":"The current branch {branch} has no upstream yet. This runs git push -u {remote} to create a same-named branch on the remote and set it as the upstream.","status.publishConfirm":"Publish","status.publishing":"Publishing\u2026","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.graphTitle":"Commit graph line style","cfg.graphHint":"Choose how the commit graph draws its lines: parallel is the VSCode / GUI style \u2014 each branch keeps its own column and a shared ancestor shows as parallel lines; compact is the git log style \u2014 a shared ancestor merges into one column with fewer lines. Saved changes apply immediately.","cfg.graphParallel":"Parallel (VSCode style)","cfg.graphCompact":"Compact (git log style)","cfg.suggestTitle":"AI commit message","cfg.suggestToggle":"Show AI suggest button in the commit box","cfg.suggestLangLabel":"Language","cfg.suggestLangAuto":"Auto","cfg.suggestLangZh":"\u4E2D\u6587","cfg.suggestLangEn":"English","cfg.suggestLangHint":"Auto follows the language you write commits in for this repository (recency-weighted, with the current git author preferred, ignoring mechanical commits such as releases and merges); \u4E2D\u6587 / English pin it.","cfg.suggestMaxBytesLabel":"Input budget","cfg.suggestMaxBytesUnit":"KiB","cfg.suggestMaxBytesHint":"Diff bytes sent to the model; beyond it the diff is truncated. Range 16\u2013512.","cfg.suggestOutputLabel":"Output limit","cfg.suggestOutputUnit":"tokens","cfg.suggestOutputHint":"Model generation budget; reasoning tokens count against it on thinking models. Range 256\u201316384.","cfg.suggestTimeoutLabel":"Generation timeout","cfg.suggestTimeoutUnit":"s","cfg.suggestTimeoutHint":"Generation fails after the timeout. Range 5\u2013120.","cfg.suggestHint":'When on, an "AI suggest" button appears beside the commit button: it writes a commit message from the current changes and the repository\u2019s existing commit style, filled in for you to edit before committing. Generation uses the model configured in DSH; the diff is sent to that model provider. Saved changes apply immediately.',"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 Vt=require("react");var ni=new Set(["cwd-unavailable"]),Tn=3e4,ri=6e4,Kt=class{constructor(t,n){this.remote=t;this.sessionId=n}view={state:"cold"};listeners=new Set;timer;inflight;pendingRefresh=!1;disposed=!1;pollMs=Tn;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||Tn,this.setView({state:"ready",snapshot:t.value});else if(t.error.code!=="cancelled")if(ni.has(t.error.code))this.pollMs=ri,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 if(t.error.code==="git-unavailable"){let n=t.error;this.setView({state:"error",error:{code:"git-unavailable",...n.detail?{detail:n.detail}:{},...n.cwd?{cwd:n.cwd}:{},...n.isGitRepo!==void 0?{isGitRepo:n.isGitRepo}:{}}})}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||Tn,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 ai="/api",ii="gitPanel";function oi(e){try{let t=e.get("connection")?.rpc,n=t?.call;if(t!==void 0&&typeof n=="function")return(r,a,i)=>n.call(t,ai,r,a,i)}catch{}}function si(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 ye(e,t){return!e.ok||e.value.kind!==t?null:e.value}function et(e){return e!==void 0&&e!==""}var dr=new WeakMap;function Pt(e){let t=dr.get(e);if(t!==void 0)return t;let n=async(a,i,o)=>{let s=oi(e);if(s===void 0)return{ok:!1,error:{code:"git-unavailable",message:"no connection"}};try{let l=await s(`${ii}/${a}`,{args:{request:i}},o);return si(l)}catch(l){return{ok:!1,error:{code:"git-unavailable",message:l instanceof Error?l.message:String(l)}}}},r={snapshot:(a,i)=>n("snapshot",a,i),run:(a,i)=>n("run",a,i),query:(a,i)=>n("query",a,i),suggest:(a,i)=>n("suggest",a,i),version:(a,i)=>n("version",a,i)};return dr.set(e,r),r}var pt=new Map,cr,Nn;function pr(e){Nn=e,cr=Pt(e)}function Dt(e){let t=pt.get(e);if(t===void 0){let n=cr??(Nn?Pt(Nn):void 0);t=new Kt(n??pi(),e),pt.set(e,t)}return t}var li=6e4,Ut=new Map;function di(e){let t=Ut.get(e);t!==void 0&&(clearTimeout(t),Ut.delete(e)),vt.set(e,(vt.get(e)??0)+1)}function ci(e){let t=(vt.get(e)??1)-1;if(t>0){vt.set(e,t);return}vt.delete(e);let n=setTimeout(()=>{Ut.delete(e),!((vt.get(e)??0)>0)&&(pt.get(e)?.dispose(),pt.delete(e))},li);Ut.set(e,n)}var vt=new Map;function zt(){for(let e of pt.values())e.resync()}function ur(){for(let e of pt.values())e.dispose();pt.clear()}function pi(){let e=async()=>({ok:!1,error:{code:"git-unavailable"}});return{snapshot:e,run:e,query:e,suggest:e,version:e}}function Wt(e){let[,t]=(0,Vt.useState)(0),n=e?Dt(e):void 0;return(0,Vt.useEffect)(()=>{if(n===void 0||e===void 0)return;di(e);let r=n.subscribe(()=>t(a=>a+1));return n.ensure(),()=>{r(),ci(e)}},[n,e]),n?n.getSnapshot():{state:"cold"}}var I=require("react");var gr="[data-conversation-tabs]",Ht='[data-conversation-tabs] button[role="tab"]',En=new Map,At=new Map;function fr(e,t){let n=At.get(e);if(n!==void 0&&n.size>0){for(let r of n)r(t);return}En.set(e,t)}function mr(e){let t=En.get(e);return t===void 0?null:(En.delete(e),t)}function hr(e,t){let n=At.get(e);return n===void 0&&(n=new Set,At.set(e,n)),n.add(t),()=>{let r=At.get(e);r!==void 0&&(r.delete(t),r.size===0&&At.delete(e))}}var ui=6e4,Mn=new Map;function yr(e,t){Mn.set(e,{tab:t,leftAt:Date.now()})}function br(e){let t=Mn.get(e);return t===void 0?null:Date.now()-t.leftAt>ui?(Mn.delete(e),null):t.tab}function vr(e){if(typeof document>"u")return!1;let t=document.querySelectorAll(Ht);for(let n of t)if((n.textContent??"").trim()===e)return n.getAttribute("aria-selected")!=="true"&&n.click(),!0;return!1}function wr(e){if(typeof document>"u")return!1;let t=document.querySelectorAll(Ht);for(let n of t)if((n.textContent??"").trim()===e)return n.getAttribute("aria-selected")==="true";return!1}function xr(e){if(typeof document>"u")return!1;let t=document.querySelectorAll(Ht);for(let n of t)if((n.textContent??"").trim()!==e)return n.getAttribute("aria-selected")!=="true"&&n.click(),!0;return!1}var c=require("react"),hn=require("react-dom");var H=require("react");function ve(e,t=15){return(0,H.createElement)("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"},e)}function qt({size:e}){return ve([(0,H.createElement)("circle",{key:"c",cx:8,cy:8,r:2.4}),(0,H.createElement)("line",{key:"l1",x1:8,y1:1.5,x2:8,y2:5.6}),(0,H.createElement)("line",{key:"l2",x1:8,y1:10.4,x2:8,y2:14.5})],e)}function kr({size:e}){return ve([(0,H.createElement)("path",{key:"a",d:"M4 2v8"}),(0,H.createElement)("path",{key:"b",d:"M2 4h4"}),(0,H.createElement)("circle",{key:"c",cx:4,cy:12,r:1.6}),(0,H.createElement)("circle",{key:"d",cx:12,cy:4,r:1.6}),(0,H.createElement)("path",{key:"e",d:"M12 6v4"}),(0,H.createElement)("path",{key:"f",d:"M10 12h4"})],e)}function Gn({size:e}){return ve([(0,H.createElement)("circle",{key:"a",cx:4,cy:3,r:1.6}),(0,H.createElement)("circle",{key:"b",cx:4,cy:13,r:1.6}),(0,H.createElement)("circle",{key:"c",cx:12,cy:5,r:1.6}),(0,H.createElement)("path",{key:"d",d:"M4 4.6v6.8"}),(0,H.createElement)("path",{key:"e",d:"M12 6.6c0 3-4 2.4-8 4"})],e)}function wt({size:e}){return ve([(0,H.createElement)("path",{key:"a",d:"M2 7V3h4l8 8-4 4z"}),(0,H.createElement)("circle",{key:"b",cx:4.5,cy:5.5,r:.8,fill:"currentColor"})],e)}function tt({size:e,open:t}){return ve([(0,H.createElement)("path",{key:"a",d:t?"M3 6l5 5 5-5":"M6 3l5 5-5 5"})],e)}function nt({size:e}){return ve([(0,H.createElement)("path",{key:"a",d:"M4 4l8 8M12 4l-8 8"})],e)}function xt({size:e}){return ve([(0,H.createElement)("path",{key:"a",d:"M10 3L5 8l5 5"}),(0,H.createElement)("path",{key:"b",d:"M5 8h8"})],e)}function _r({size:e}){return ve([(0,H.createElement)("path",{key:"a",d:"M2 3h12l-4.5 5.5V13L6.5 11V8.5z"})],e)}function jt({size:e}){return ve([(0,H.createElement)("path",{key:"a",d:"M13 8a5 5 0 1 1-1.5-3.5"}),(0,H.createElement)("path",{key:"b",d:"M13 2v3h-3"})],e)}function Sr({size:e}){return ve([(0,H.createElement)("path",{key:"a",d:"M8 2.6l1.4 4 4 1.4-4 1.4-1.4 4-1.4-4-4-1.4 4-1.4z"}),(0,H.createElement)("path",{key:"b",d:"M13 11.6v2.8M11.6 13h2.8"})],e)}function Cr({size:e}){return ve([(0,H.createElement)("path",{key:"a",d:"M4 2h5l3 3v9H4z"}),(0,H.createElement)("path",{key:"b",d:"M9 2v3h3"})],e)}function Rn({size:e}){return ve([(0,H.createElement)("path",{key:"a",d:"M2 5.5h12V13H2z"}),(0,H.createElement)("path",{key:"b",d:"M1.5 3h13v2.5h-13z"}),(0,H.createElement)("path",{key:"c",d:"M6.5 8.5h3"})],e)}function Tr({size:e}){return ve([(0,H.createElement)("path",{key:"a",d:"M3 4.5h10"}),(0,H.createElement)("path",{key:"b",d:"M5.5 4.5V3h5v1.5"}),(0,H.createElement)("path",{key:"c",d:"M4.5 4.5l.7 9h5.6l.7-9"})],e)}function Nr({size:e}){return ve([(0,H.createElement)("path",{key:"a",d:"M3 7a5 5 0 1 1 1.3 3.4"}),(0,H.createElement)("path",{key:"b",d:"M3 3.5V7h3.5"})],e)}function Qt({size:e}){return ve([(0,H.createElement)("path",{key:"a",d:"M13 3v10"}),(0,H.createElement)("path",{key:"b",d:"M10.5 8L3 3.5v9z",fill:"currentColor"})],e)}function Er({size:e}){return ve([(0,H.createElement)("path",{key:"a",d:"M5 2.5h4l2.5 2.5v7.5h-6.5z"}),(0,H.createElement)("path",{key:"b",d:"M9 2.5V5h2.5"}),(0,H.createElement)("path",{key:"c",d:"M11 12.5v1.5h-6.5V6"})],e)}function Mr({size:e=15}){return(0,H.createElement)("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"currentColor"},(0,H.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 Gr({size:e}){return ve([(0,H.createElement)("path",{key:"a",d:"M8 2.5v7"}),(0,H.createElement)("path",{key:"b",d:"M4.5 7L8 10.5 11.5 7"}),(0,H.createElement)("path",{key:"c",d:"M3 13h10"})],e)}function Ln({size:e}){return ve([(0,H.createElement)("path",{key:"a",d:"M8 10.5v-7"}),(0,H.createElement)("path",{key:"b",d:"M4.5 6L8 2.5 11.5 6"}),(0,H.createElement)("path",{key:"c",d:"M3 13h10"})],e)}function Rr({size:e}){return ve([(0,H.createElement)("path",{key:"a",d:"M12.5 7a4.5 4.5 0 0 0-8-2.3"}),(0,H.createElement)("path",{key:"b",d:"M3.5 9a4.5 4.5 0 0 0 8 2.3"}),(0,H.createElement)("path",{key:"c",d:"M4.3 2.2v2.5h2.5"}),(0,H.createElement)("path",{key:"d",d:"M11.7 13.8v-2.5H9.2"})],e)}function Lr({size:e}){return ve([(0,H.createElement)("circle",{key:"a",cx:8,cy:8,r:6}),(0,H.createElement)("path",{key:"b",d:"M8 7.2v3.6"}),(0,H.createElement)("circle",{key:"c",cx:8,cy:5.2,r:.5,fill:"currentColor",stroke:"none"})],e)}function Pr({size:e=15,filled:t}){return(0,H.createElement)("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:t?"currentColor":"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"},(0,H.createElement)("path",{d:"M8 1.8l1.76 3.57 3.94.57-2.85 2.78.67 3.92L8 10.78l-3.52 1.85.67-3.92L2.3 5.94l3.94-.57z"}))}function Dr(e){let t=0;for(let n of e){t=Math.max(t,n.lane+1);for(let r of n.edges)t=Math.max(t,r.fromLane+1,r.toLane+1)}return t}function zr(e,t){let n=[],r=[],a=[],i=[],o=0,s=()=>{if(i.length===0)return o++;let d=Math.min(...i);return i.splice(i.indexOf(d),1),d},l=d=>{d!==null&&!i.includes(d)&&i.push(d)};for(let d of e){let p=C=>{let R=r.findIndex(Q=>Q===C);return R===-1&&(R=r.findIndex(Q=>Q===null),R===-1&&(R=r.length,r.push(null),a.push(null)),r[R]=C,a[R]=s()),R},u=r.some(C=>C===d.hash),g=p(d.hash),S=a[g],b=[...r],_=[...a],k=d.parents,M=k.length>=2;for(let C=0;C<r.length;C++)C!==g&&r[C]===d.hash&&(l(a[C]),r[C]=null,a[C]=null);let D=-1,J=[];if(k.length===0)l(a[g]),r[g]=null,a[g]=null;else{let C=k[0],R=t==="compact"?r.findIndex((Q,U)=>Q===C&&U!==g):-1;if(R===-1)r[g]=C,D=g;else{let Q=Math.min(g,R),U=Math.max(g,R);r[Q]=C,l(a[U]),r[U]=null,a[U]=null,D=Q}for(let Q=1;Q<k.length;Q++)J.push(p(k[Q]))}let F=[];for(let C=0;C<b.length;C++){let R=b[C];if(R!==null)if(R===d.hash){if(C===g&&!u)continue;F.push({fromLane:C,toLane:g,color:_[C],kind:"into"})}else{let Q=r[C]===R?C:r.findIndex(U=>U===R);Q!==-1&&F.push({fromLane:C,toLane:Q,color:_[C],kind:"pass"})}}D!==-1&&F.push({fromLane:g,toLane:D,color:a[D],kind:"out"});for(let C of J)F.push({fromLane:g,toLane:C,color:a[C],kind:"out"});for(n.push({commit:d,lane:g,color:S,edges:F,merge:M});r.length>0&&r[r.length-1]===null;)r=r.slice(0,-1),a=a.slice(0,-1)}return n}function Ar(e){let t={name:"",path:"",dir:!0,children:[]};for(let n of e){let r=n.path.split("/").filter(o=>o!==""),a=t,i="";for(let o=0;o<r.length;o++){let s=r[o];i=i===""?s:`${i}/${s}`;let l=o===r.length-1,d=a.children.find(p=>p.name===s&&p.dir===!l);d===void 0&&(d={name:s,path:i,dir:!l,children:[],...l?{meta:n.meta}:{}},a.children.push(d)),a=d}}return Hr(t),Fr(t.children)}function Hr(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)Hr(t)}function Fr(e){return e.map(t=>{if(!t.dir)return t;let n=t;for(;n.children.length===1&&n.children[0].dir;){let r=n.children[0];n={name:`${n.name}/${r.name}`,path:r.path,dir:!0,children:r.children}}return{...n,children:Fr(n.children)}})}function rt(e,t,n){if(e===null)return"";let r=typeof e=="number"?e:Date.parse(e);if(!Number.isFinite(r))return"";let a=Math.max(0,t-r),i=Math.floor(a/6e4);if(i<1)return n("time.justNow");if(i<60)return n("time.minutesAgo",{n:i});let o=Math.floor(i/60);if(o<24)return n("time.hoursAgo",{n:o});let s=Math.floor(o/24);return n("time.daysAgo",{n:s})}function Ft(e){if(e===null)return"";let t=new Date(typeof e=="number"?e:Date.parse(e));if(Number.isNaN(t.getTime()))return"";let n=r=>String(r).padStart(2,"0");return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}function Bt(e){if(e===null)return"";let t=new Date(typeof e=="number"?e:Date.parse(e));if(Number.isNaN(t.getTime()))return"";let n=r=>String(r).padStart(2,"0");return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}var Yt={added:"A",modified:"M",deleted:"D",renamed:"R",untracked:"U",conflicted:"!",typechange:"T"};function kt(e){return e==="added"||e==="untracked"?"gp-status--added":e==="deleted"?"gp-status--deleted":e==="renamed"?"gp-status--renamed":"gp-status--modified"}function Br(e,t){return e.some(n=>n.status==="untracked"&&(n.isDirectory?t.startsWith(`${n.path}/`):n.path===t))}var x=require("react");var Re={maxBytes:{min:16384,max:524288,default:131072},maxOutputTokens:{min:256,max:16384,default:4096},timeoutMs:{min:5e3,max:12e4,default:15e3}},Zt=["auto","zh","en"],Pn="auto",gi={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 It(e){let t=e.lastIndexOf(".");return t<0?null:gi[e.slice(t+1).toLowerCase()]??null}function Ir(e){return/^Binary files .* differ$/m.test(e)||/^GIT binary patch$/m.test(e)}function Or(e){return It(e)!==null}function $r(e){return/\.svg$/i.test(e)}function fi(e){let t=e.split(`
|
|
671
|
+
`),n=[],r=!1;for(let a of t){if(a.startsWith("@@")){r=!0;continue}if(r){if(a.startsWith("diff ")||a.startsWith("index ")){r=!1;continue}a!==""&&n.push(a)}}return n}function Xr(e){let t=0,n=0;for(let r of fi(e))r.startsWith("+")?t++:r.startsWith("-")&&n++;return{add:t,del:n}}var mi=/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/;function Jr(e,t){let n=[],r=e.split(`
|
|
672
|
+
`),a=Number.isFinite(t)&&t>0?t:0,i=0,o=0,s=!0,l=!1,d=0;for(;d<r.length&&!r[d].startsWith("@@");d++);for(;d<r.length;d++){let u=r[d];if(u.startsWith("@@")){let b=mi.exec(u);if(b){let _=Number(b[1]),k=Number(b[3]),M=_-k;if(s)k>1&&n.push(ut({rightStart:1,count:k-1,delta:M,atStart:!0}));else{let D=k-o;D>0&&n.push(ut({rightStart:o,count:D,delta:M,atStart:!1}))}i=_,o=k,s=!1}n.push({kind:"hunk",leftNo:null,rightNo:null,leftText:null,rightText:null,text:u});continue}if(u.startsWith("\\"))continue;let g=u[0],S=u.slice(1);g==="+"?(n.push({kind:"add",leftNo:null,rightNo:o,leftText:null,rightText:S}),o++,l=!0):g==="-"?(n.push({kind:"del",leftNo:i,rightNo:null,leftText:S,rightText:null}),i++,l=!0):g===" "&&(n.push({kind:"context",leftNo:i,rightNo:o,leftText:S,rightText:S}),i++,o++,l=!0)}let p=a-o+1;return l&&!s&&o>0&&p>0&&n.push(ut({rightStart:o,count:p,delta:i-o,atStart:!1})),hi(n)}function Kr(e,t){let n=e[e.length-1],r=n!==void 0&&n.kind==="gap",a=r?n.gap:void 0,i=r?e[e.length-2]:n,o=i===void 0?null:i.rightNo,s=o!==null&&o>0?o:0,l=Number.isFinite(t)?t-s:0,d=l>0?l:0;if(a===void 0){if(d===0||s===0)return e;let p=i===void 0?null:i.leftNo;return p===null?null:[...e,ut({rightStart:s+1,count:d,delta:p-s,atStart:!1})]}return a.rightStart===s+1&&a.count===d?e:d===0?e.slice(0,-1):[...e.slice(0,-1),ut({rightStart:s+1,count:d,delta:a.delta,atStart:!1})]}function ut(e){return{kind:"gap",leftNo:null,rightNo:null,leftText:null,rightText:null,gap:e}}function hi(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(r.kind==="del"){let a=[],i=n;for(;i<e.length&&e[i].kind==="del";)a.push(e[i]),i++;let o=[];for(;i<e.length&&e[i].kind==="add";)o.push(e[i]),i++;let s=Math.max(a.length,o.length);for(let l=0;l<s;l++){let d=a[l],p=o[l];if(d&&p){let u=yi(d.leftText??"",p.rightText??"");t.push({kind:"mod",leftNo:d.leftNo,rightNo:p.rightNo,leftText:d.leftText,rightText:p.rightText,...u!==null?{leftWord:u.left,rightWord:u.right}:{}})}else d?t.push({kind:"del",leftNo:d.leftNo,rightNo:null,leftText:d.leftText,rightText:null}):p&&t.push({kind:"add",leftNo:null,rightNo:p.rightNo,leftText:null,rightText:p.rightText})}n=i}else t.push(r),n++}return t}function yi(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;let a=0;for(;a<n-r&&e[e.length-1-a]===t[t.length-1-a];)a++;return r===0&&a===0?null:{left:[r,e.length-a],right:[r,t.length-a]}}function bi(e,t,n){return n.map((r,a)=>{let i=t+a;return{kind:"context",leftNo:i+e,rightNo:i,leftText:r,rightText:r}})}var gt=20;function Ur(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 Vr(e,t,n,r,a,i){let o=e.findIndex(u=>u.kind==="gap"&&u.gap?.rightStart===t);if(o<0)return e.slice();let s=e[o].gap,l=bi(s.delta,r,a),d=[],p=s.count;if(n==="all"||a.length>=p)d.push(...l);else if(n==="down")d.push(...l),i||d.push(ut({rightStart:s.rightStart+a.length,count:p-a.length,delta:s.delta,atStart:!1}));else{if(a.length===0)return[...e.slice(0,o),...e.slice(o+1)];let u=p-a.length;d.push(ut({rightStart:s.rightStart,count:u,delta:s.delta,atStart:s.atStart})),d.push(...l)}return[...e.slice(0,o),...d,...e.slice(o+1)]}var pn=require("@deepseek-ai/dsh-client-ui-primitives");function Wr(e,t){let n=[[],[],[]],r=0;for(let a of e){let i=r+a.text.length,o=[r,Math.max(r,Math.min(i,t[0])),Math.max(r,Math.min(i,t[1])),i];for(let s=0;s<3;s++){let l=a.text.slice(o[s]-r,o[s+1]-r);l!==""&&n[s].push({text:l,style:a.style})}r=i}return n}function qr(e){let t=new Map;return n=>{if(t.has(n))return t.get(n);let r=e(n);return t.size>=8e3&&t.clear(),t.set(n,r),r}}function St(e){let t=new Array(e.length+1);t[0]=0;for(let n=0;n<e.length;n++)t[n+1]=t[n]+e[n];return t}function jr(e,t){let n=0,r=e.length-1;for(;n<r;){let a=n+r+1>>1;e[a]<=t?n=a:r=a-1}return n}function Ct(e,t,n,r){let a=e.length-1;if(a<=0)return{first:0,last:0};let i=jr(e,t-r),o=Math.min(a,jr(e,t+n+r)+1);return{first:i,last:o}}function en(e,t,n,r){return t<0?e:t>=e.first&&t<e.last?{first:Math.min(e.first,Math.max(0,t-r)),last:Math.max(e.last,Math.min(n,t+r))}:{first:Math.max(0,t-r),last:Math.min(n,t+r)}}var ft=require("react");function Tt(){let[e,t]=(0,ft.useState)({top:0,height:0}),n=(0,ft.useRef)(null),r=(0,ft.useRef)(null);return{setEl:(0,ft.useCallback)(i=>{if(r.current!==null&&(r.current(),r.current=null),n.current=i,i===null)return;let o=()=>t(l=>{let d=i.scrollTop,p=i.clientHeight;return l.top===d&&l.height===p?l:{top:d,height:p}});o(),i.addEventListener("scroll",o,{passive:!0});let s=typeof ResizeObserver<"u"?new ResizeObserver(o):null;s?.observe(i),r.current=()=>{i.removeEventListener("scroll",o),s?.disconnect()}},[]),viewport:e,elRef:n}}var Ne=require("react"),tn=5e3,nn=120;function rn(e,t){let[n,r]=(0,Ne.useState)(e);return(0,Ne.useEffect)(()=>{let a=setTimeout(()=>r(e),t);return()=>clearTimeout(a)},[e,t]),n}function an(e,t){if(t==="")return[];let n=[],r=0;for(;;){let a=e.indexOf(t,r);if(a<0)break;n.push([a,a+t.length]),r=a+t.length}return n}function Dn(e,t,n,r,a){if(n>=r)return[];if(e===void 0)return[t.slice(n,r)];let i=[],o=0,s=0;for(let l of e){let d=o+l.text.length,p=Math.max(n,o),u=Math.min(r,d);if(u>p&&i.push((0,Ne.createElement)("span",{key:`${a}-${s++}`,style:l.style},l.text.slice(p-o,u-o))),o=d,o>=r)break}return i}function on(e,t,n,r,a,i){let o=[],s=0,l=[...t].sort((d,p)=>d[0]-p[0]);for(let[d,p]of l){if(d<s)continue;d>s&&o.push(...Dn(n,e,s,d,`${r}b${s}`));let u=a!==null&&a[0]===d&&a[1]===p;o.push((0,Ne.createElement)("mark",{key:`mk${r}-${d}`,className:`gp-find-hit${u?" gp-find-hit--active":""}`,...u?{ref:i}:{}},Dn(n,e,d,p,`mk${r}-${d}`))),s=p}return s<e.length&&o.push(...Dn(n,e,s,e.length,`${r}e`)),o}function sn(e){return(0,Ne.createElement)("div",{key:"find",className:"gp-find"},[(0,Ne.createElement)("input",{key:"in",ref:e.inputRef,className:"gp-find__input",type:"text",placeholder:e.t("files.findPlaceholder"),value:e.query,spellCheck:!1,"aria-label":e.t("files.findPlaceholder"),onChange:t=>e.onChange(t.target.value),onKeyDown:t=>{t.key==="Escape"?(t.preventDefault(),t.stopPropagation(),e.onClose()):t.key==="Enter"&&(t.preventDefault(),e.onStep(t.shiftKey?-1:1))}}),(0,Ne.createElement)("button",{key:"case",type:"button",className:`gp-find__btn gp-find__case${e.caseSensitive?" gp-find__case--active":""}`,title:e.t("files.findCase"),"aria-label":e.t("files.findCase"),"aria-pressed":e.caseSensitive,onClick:()=>e.onToggleCase()},"Aa"),(0,Ne.createElement)("span",{key:"cnt",className:"gp-find__count"},e.query===""?"":e.matches===0?e.t("files.findNoMatch"):`${e.active+1}/${e.matches}`),(0,Ne.createElement)("button",{key:"prev",type:"button",className:"gp-find__btn",title:e.t("files.findPrev"),"aria-label":e.t("files.findPrev"),disabled:e.matches===0,onClick:()=>e.onStep(-1)},"\u2039"),(0,Ne.createElement)("button",{key:"next",type:"button",className:"gp-find__btn",title:e.t("files.findNext"),"aria-label":e.t("files.findNext"),disabled:e.matches===0,onClick:()=>e.onStep(1)},"\u203A"),(0,Ne.createElement)("button",{key:"x",type:"button",className:"gp-find__btn",title:e.t("files.findClose"),"aria-label":e.t("files.findClose"),onClick:()=>e.onClose()},"\u2715")])}var at=require("react");var X=require("react"),ra=require("react-dom");function Yr(e){let t=e.deltaMode===1?8:e.deltaMode===2?24:1;return Math.sign(e.deltaY)*Math.min(24,Math.abs(e.deltaY*t))}function Zr(e){let t=Math.sign(e)*Math.min(24,Math.abs(e));return t<=0?1-2*t/100:1/(1+2*t/100)}var vi=.1,wi=8,zn=1.25;function ea(e){return Number.isFinite(e)?Math.min(wi,Math.max(vi,e)):1}function An(e,t,n){return(e+t)*n-t}var Qr=3;function ta(e,t){return e*e+t*t>=Qr*Qr}function na(e,t,n,r){return{left:e-n,top:t-r}}var xi=300;function Ot({src:e,alt:t,t:n,viewportClass:r,fullscreen:a=!0,onEmptyAreaMouseDown:i}){let o=(0,X.useRef)(null),s=(0,X.useRef)(null),l=(0,X.useRef)(null),[d,p]=(0,X.useState)(null),[u,g]=(0,X.useState)("fit"),[S,b]=(0,X.useState)(null),[_,k]=(0,X.useState)(!1),[M,D]=(0,X.useState)(!1),J=(0,X.useRef)("fit"),F=(0,X.useRef)(null),C=(0,X.useRef)(null),R=(0,X.useRef)(null),Q=(0,X.useRef)(0),U=(0,X.useCallback)(()=>{let w=l.current;return w===null||w.naturalWidth===0||w.clientWidth===0?null:w.clientWidth/w.naturalWidth},[]),K=(0,X.useCallback)((w,T,j)=>{let Y=s.current,m=l.current;if(Y===null||m===null||m.naturalWidth===0||m.clientWidth===0)return;let G=m.clientWidth/m.naturalWidth,B=ea(w);if(B===G)return;let P=Y.getBoundingClientRect();F.current={x:T-P.left,y:j-P.top,ratio:B/G},g(B)},[]),ae=(0,X.useCallback)(w=>{let T=s.current,j=U();if(T===null||j===null)return;let Y=T.getBoundingClientRect();K(j*w,Y.left+Y.width/2,Y.top+Y.height/2)},[U,K]),z=(0,X.useCallback)(()=>{let w=s.current;if(w===null)return;let T=w.getBoundingClientRect();K(1,T.left+T.width/2,T.top+T.height/2)},[K]),W=(0,X.useCallback)(()=>{g("fit")},[]),O=(0,X.useCallback)(()=>{let w=l.current;w===null||w.naturalWidth===0||w.clientWidth===0||b(Math.round(w.clientWidth/w.naturalWidth*100))},[]);(0,X.useLayoutEffect)(()=>{J.current=u,u==="fit"&&O();let w=F.current;F.current=null;let T=s.current;w===null||T===null||(T.scrollLeft=An(T.scrollLeft,w.x,w.ratio),T.scrollTop=An(T.scrollTop,w.y,w.ratio))},[u,O]),(0,X.useEffect)(()=>{J.current="fit",F.current=null,C.current=null,g("fit"),p(null),b(null)},[e]),(0,X.useEffect)(()=>{let w=o.current;if(w===null)return;let T=G=>{if(!G.ctrlKey)return;G.cancelable&&G.preventDefault();let B=l.current;if(B===null||!B.complete||B.naturalWidth===0)return;let P=U();P!==null&&K(P*Zr(Yr(G)),G.clientX,G.clientY)},j=G=>{let B=G,P=U();P!==null&&(B.cancelable&&B.preventDefault(),C.current={base:P,x:B.clientX,y:B.clientY})},Y=G=>{let B=G,P=C.current;P!==null&&(B.cancelable&&B.preventDefault(),K(P.base*B.scale,P.x,P.y))},m=()=>{C.current=null};return w.addEventListener("wheel",T,{passive:!1}),w.addEventListener("gesturestart",j,{passive:!1}),w.addEventListener("gesturechange",Y,{passive:!1}),w.addEventListener("gestureend",m),()=>{w.removeEventListener("wheel",T),w.removeEventListener("gesturestart",j),w.removeEventListener("gesturechange",Y),w.removeEventListener("gestureend",m)}},[U,K]);let se=(0,X.useCallback)(w=>{if(w.button!==0||w.pointerType!=="mouse")return;let T=s.current;if(T===null)return;let{offsetX:j,offsetY:Y}=w.nativeEvent;w.target===T&&(j>=T.clientWidth||Y>=T.clientHeight)||(R.current={id:w.pointerId,x:w.clientX,y:w.clientY,left:T.scrollLeft,top:T.scrollTop,pan:T.scrollWidth>T.clientWidth||T.scrollHeight>T.clientHeight,moved:!1})},[]);(0,X.useEffect)(()=>{let w=Y=>{let m=R.current;m===null||Y!==m.id||(m.moved&&(Q.current=performance.now()),R.current=null,D(!1))},T=Y=>{let m=R.current;if(m===null||Y.pointerId!==m.id)return;if(Y.buttons===0){w(Y.pointerId);return}let G=Y.clientX-m.x,B=Y.clientY-m.y;if(!m.moved){if(!ta(G,B))return;m.moved=!0,D(!0)}let P=s.current;if(P===null||!m.pan)return;let ue=na(m.left,m.top,G,B);P.scrollLeft=ue.left,P.scrollTop=ue.top},j=Y=>{w(Y.pointerId)};return window.addEventListener("pointermove",T),window.addEventListener("pointerup",j),window.addEventListener("pointercancel",j),()=>{window.removeEventListener("pointermove",T),window.removeEventListener("pointerup",j),window.removeEventListener("pointercancel",j)}},[]),(0,X.useEffect)(()=>{let w=s.current;if(w===null||typeof ResizeObserver>"u")return;let T=new ResizeObserver(()=>{J.current==="fit"&&O()});return T.observe(w),()=>T.disconnect()},[O]);let q=(0,X.useCallback)(()=>{let w=l.current;w!==null&&(p({w:w.naturalWidth,h:w.naturalHeight}),J.current==="fit"&&O())},[O]),de=(0,X.useCallback)(()=>{performance.now()-Q.current<xi||(u==="fit"?z():W())},[u,z,W]),le=(0,X.useCallback)(()=>{k(!1)},[]),he=u==="fit"?S!==null?`${S}%`:"\u2014":`${Math.round(u*100)}%`,be=u!=="fit"&&d!==null?{width:`${d.w*u}px`,maxWidth:"none",maxHeight:"none"}:void 0,ee=d!==null?(0,X.createElement)("div",{key:"bar",className:"gp-zoom__bar",role:"group","aria-label":n("files.zoomBar")},[(0,X.createElement)("button",{key:"out",type:"button",className:"gp-zoom__btn","aria-label":n("files.zoomOut"),title:n("files.zoomOut"),onClick:()=>ae(1/zn)},"\u2212"),(0,X.createElement)("button",{key:"pct",type:"button",className:"gp-zoom__btn gp-zoom__pct","aria-label":`${he}\uFF0C${n("files.zoomActual")}`,title:n("files.zoomActual"),onClick:z},he),(0,X.createElement)("button",{key:"in",type:"button",className:"gp-zoom__btn","aria-label":n("files.zoomIn"),title:n("files.zoomIn"),onClick:()=>ae(zn)},"+"),(0,X.createElement)("button",{key:"fit",type:"button",className:"gp-zoom__btn gp-zoom__btn--text","aria-pressed":u==="fit",onClick:W},n("files.zoomFit")),a?(0,X.createElement)("button",{key:"fs",type:"button",className:"gp-zoom__btn","aria-label":n("files.zoomFullscreen"),title:n("files.zoomFullscreen"),onClick:()=>k(!0)},"\u2921"):null]):null;return(0,X.createElement)("div",{className:"gp-zoom",ref:o,"data-zoomed":u==="fit"?void 0:"true","data-dragging":M?"true":void 0},[(0,X.createElement)("div",{key:"vp",className:`gp-zoom__scroll ${r}`,ref:s,onPointerDown:se,onMouseDown:i===void 0?void 0:w=>{w.target===w.currentTarget&&i()}},(0,X.createElement)("img",{key:"img",ref:l,className:"gp-zoom__img",src:e,alt:t,style:be,draggable:!1,onLoad:q,onDoubleClick:de})),ee,_?(0,X.createElement)(ki,{key:"lb",src:e,alt:t,t:n,onClose:le}):null])}function ki({src:e,alt:t,t:n,onClose:r}){let a=(0,X.useRef)(null),i=(0,X.useRef)(null),o=(0,X.useRef)(null);return(0,X.useEffect)(()=>{o.current=document.activeElement instanceof HTMLElement?document.activeElement:null,i.current?.focus();let s=()=>{let d=a.current;return d===null?[]:[...d.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')].filter(p=>!p.hasAttribute("disabled")&&p.getClientRects().length>0)},l=d=>{if(d.key==="Escape"){d.stopPropagation(),r();return}if(d.key!=="Tab")return;let p=s();if(p.length===0)return;let u=document.activeElement instanceof HTMLElement?document.activeElement:null,g=u===null?-1:p.indexOf(u);d.preventDefault();let S=d.shiftKey?-1:1,b=g===-1?S===-1?p.length-1:0:(g+S+p.length)%p.length;p[b]?.focus()};return window.addEventListener("keydown",l,!0),()=>{window.removeEventListener("keydown",l,!0),o.current?.focus()}},[r]),(0,ra.createPortal)((0,X.createElement)("div",{className:"gp-zl-backdrop",ref:a,role:"dialog","aria-modal":"true","aria-label":n("files.zoomFullscreen")},[(0,X.createElement)("div",{key:"stage",className:"gp-zl-stage"},[(0,X.createElement)("div",{key:"mask",className:"gp-zl-mask","aria-hidden":"true",onMouseDown:r}),(0,X.createElement)("div",{key:"frame",className:"gp-zl-frame"},(0,X.createElement)(Ot,{src:e,alt:t,t:n,viewportClass:"gp-zl-viewport",fullscreen:!1,onEmptyAreaMouseDown:r})),(0,X.createElement)("button",{key:"close",ref:i,type:"button",className:"gp-zl-close","aria-label":n("common.close"),onClick:r},(0,X.createElement)(nt,{size:16}))])]),document.body)}function ln(e,t,n){let r=n(`diff.${e}`);return(0,at.createElement)("div",{className:`gp-imgcmp__pane gp-imgcmp__pane--${e}`},[(0,at.createElement)("div",{key:"head",className:"gp-imgcmp__head"},r),t===void 0?(0,at.createElement)("div",{key:"missing",className:"gp-imgcmp__missing"},n("diff.imageMissing")):(0,at.createElement)(Ot,{key:"img",src:t,alt:r,t:n,viewportClass:"gp-imgcmp__img"})])}function aa({oldUrl:e,newUrl:t,mode:n,t:r}){return n==="before"?(0,at.createElement)("div",{className:"gp-imgcmp gp-imgcmp--single"},ln("before",e,r)):n==="after"?(0,at.createElement)("div",{className:"gp-imgcmp gp-imgcmp--single"},ln("after",t,r)):(0,at.createElement)("div",{className:"gp-imgcmp"},[ln("before",e,r),ln("after",t,r)])}var Hn=20,_i=27,Si=29,ia=12,Ci=600,un=(0,x.memo)(function({text:t,mode:n,path:r,remote:a,sessionId:i,base:o,commit:s,expanded:l,truncated:d,newLines:p,t:u}){let g=(0,x.useMemo)(()=>Jr(t,p),[t,p]),S=Ir(t),b=(0,pn.useCodeHighlighter)(r===void 0?void 0:(0,pn.languageForPath)(r)),_=(0,x.useMemo)(()=>qr(b),[b]),[k,M]=(0,x.useState)(g),D=(0,x.useRef)(t);(0,x.useEffect)(()=>{if(D.current!==t){D.current=t,M(g);return}M(te=>Kr(te,p)??g)},[t,p,g]);let J=Mi(k,M,a,i,r,o,s),F=r!==void 0&&$r(r),[C,R]=(0,x.useState)("render");(0,x.useEffect)(()=>{R("render")},[r]);let U=(S||F)&&r!==void 0&&Or(r)&&a!==void 0&&i!==void 0&&o!==void 0&&(!F||C==="render"),K=Ri(U?a:void 0,U?i:void 0,U?r:void 0,U?o:void 0,U?s:void 0),[ae,z]=(0,x.useState)(!1),[W,O]=(0,x.useState)(""),[se,q]=(0,x.useState)(!1),[de,le]=(0,x.useState)(0),he=(0,x.useRef)(null),be=(0,x.useRef)(null),ee=(0,x.useRef)(null);(0,x.useEffect)(()=>{z(!1),O(""),le(0)},[t,r]);let w=(0,x.useMemo)(()=>n==="unified"?Ur(k):null,[n,k]),T=(0,x.useMemo)(()=>n==="before"?Li(k):n==="after"?Pi(k):null,[n,k]),j=(0,x.useMemo)(()=>Ni(k,w,T),[k,w,T]),Y=(0,x.useMemo)(()=>j.map(te=>({key:te.key,text:te.text.toLowerCase()})),[j]),m=rn(W,nn),G=se?m:m.toLowerCase(),B=se?j:Y,P=(0,x.useMemo)(()=>Ei(B,G),[B,G]);(0,x.useEffect)(()=>{le(0)},[G]);let ue=P.length===0?0:Math.min(de,P.length-1),Se=P.length>0?P[ue]:null,_e=Se?.cellKey??null,lt=Se?.start??-1,Fe=(0,x.useMemo)(()=>{let te=new Map;for(let $ of P){let h=te.get($.cellKey)??[];h.push([$.start,$.end]),te.set($.cellKey,h)}return te},[P]);(0,x.useEffect)(()=>{if(_e===null)return;let te=requestAnimationFrame(()=>ee.current?.scrollIntoView({block:"center",inline:"nearest"}));return()=>cancelAnimationFrame(te)},[ue,P,_e,lt]);let De=(0,x.useCallback)(te=>{le($=>P.length===0?0:($+te+P.length)%P.length)},[P.length]);(0,x.useEffect)(()=>{let te=$=>{if(!(($.ctrlKey||$.metaKey)&&($.key==="f"||$.key==="F")))return;let h=he.current;h===null||h.offsetParent===null||($.preventDefault(),z(!0),requestAnimationFrame(()=>be.current?.select()))};return document.addEventListener("keydown",te),()=>document.removeEventListener("keydown",te)},[]);let{setEl:N,viewport:Ee,elRef:ze}=Tt(),xe=(0,x.useRef)(null),[$e,Ve]=(0,x.useState)(0),[Be,Ae]=(0,x.useState)(0),Me=(0,x.useRef)({mode:n,rows:k,heights:[]});(Me.current.mode!==n||Me.current.rows!==k)&&(Me.current={mode:n,rows:k,heights:[]});let Te=Me.current.heights,Xe=w!==null?w.length:T!==null?T.length:k.length,qe=(0,x.useCallback)(te=>{let $=w!==null?w[te]??null:T===null?k[te]??null:null;return $===null?Hn:$.kind==="hunk"?_i:$.kind==="gap"?Si:Hn},[w,T,k]),Ge=(0,x.useMemo)(()=>{let te=new Array(Xe);for(let $=0;$<Xe;$++){let h=Te[$];te[$]=h!==void 0&&h>0?h:qe($)}return te},[Xe,Te,qe,Be]),ke=(0,x.useMemo)(()=>St(Ge),[Ge]),ht=Ee.height>0?Ee.height:Ci,{first:ne,last:Ie}=Ct(ke,Math.max(0,Ee.top-$e),ht,ia*Hn),Lt=_e===null?-1:Ti(_e),{first:je,last:Qe}=en({first:ne,last:Ie},Lt,Xe,ia);if((0,x.useLayoutEffect)(()=>{let te=xe.current,$=ze.current;if(te===null||$===null)return;let h=te.getBoundingClientRect().top-$.getBoundingClientRect().top+$.scrollTop;Math.abs(h-$e)>.5&&Ve(h);let L=new Map;for(let re of te.querySelectorAll("[data-r]")){let pe=Number(re.dataset.r),we=re.getBoundingClientRect().height;if(!Number.isFinite(we)||we<=0)continue;let We=L.get(pe);(We===void 0||we>We)&&L.set(pe,we)}let E=!1;for(let[re,pe]of L){let we=Te[re];(we===void 0||Math.abs(we-pe)>.5)&&(Te[re]=pe,E=!0)}E&&Ae(re=>re+1)}),U){let te=(()=>{if(K.kind==="idle"||K.kind==="loading")return(0,x.createElement)("div",{className:"gp-empty"},u("common.loading"));if(K.kind==="ready"){let $=K.res;if($.tooLarge===!0)return(0,x.createElement)("div",{className:"gp-empty"},u("diff.tooLarge"));if($.mime!==null&&($.old!==void 0||$.new!==void 0))return(0,x.createElement)(aa,{oldUrl:$.old,newUrl:$.new,mode:n,t:u})}return(0,x.createElement)("div",{className:"gp-empty"},u("diff.binary"))})();return F?oa(C,R,te,u):te}if(S&&!F)return(0,x.createElement)("div",{className:"gp-empty"},u("diff.binary"));let Ye=ae&&G!==""?{perCell:Fe,activeKey:_e,activeRange:Se!==null?[Se.start,Se.end]:null,activeRef:ee}:null,yt=(te,$)=>$>.5?(0,x.createElement)("div",{key:te,className:"gp-diff__spacer",style:{gridColumn:"1 / -1",height:`${$}px`}}):null,Ce=yt("lead",ke[je]),Je=yt("tail",ke[Xe]-ke[Qe]),bt=(()=>{if(t.trim()==="")return(0,x.createElement)("div",{className:"gp-empty"},u("diff.empty"));if(T!==null){let $=[Ce];for(let h=je;h<Qe;h++){let L=T[h];$.push((0,x.createElement)("div",{key:`n${h}`,className:"gp-diff-no"},L.no??"")),$.push(cn("gp-diff-cell",`c${h}`,L.text,_,Ye,h))}return $.push(Je),(0,x.createElement)("div",{className:"gp-diff__single",ref:xe},$)}if(w!==null){let $=[Ce];for(let h=je;h<Qe;h++)$.push(...zi(w[h],h,_,J,Ye,u));return $.push(Je),(0,x.createElement)("div",{className:"gp-diff__unified",ref:xe},$)}let te=[Ce];for(let $=je;$<Qe;$++)te.push(...Di(k[$],$,_,J,Ye,u));return te.push(Je),(0,x.createElement)("div",{className:"gp-diff__side",ref:xe},te)})(),dt=ae?(0,x.createElement)(sn,{inputRef:be,query:W,matches:P.length,active:ue,caseSensitive:se,onChange:O,onToggleCase:()=>q(te=>!te),onStep:De,onClose:()=>z(!1),t:u}):null,Ze=l===!0&&k.some(te=>te.kind==="gap"),ct=(0,x.createElement)("div",{className:"gp-diff__wrap",ref:he},[dt,d===!0?(0,x.createElement)("div",{key:"truncated",className:"gp-notice"},u("diff.truncated")):null,Ze?(0,x.createElement)("div",{key:"capped",className:"gp-notice"},u("diff.expandCapped",{n:2e3})):null,(0,x.createElement)("div",{key:"scroll",className:"gp-diff__scroll",ref:N},bt)]);return F?oa(C,R,ct,u):ct});function Ti(e){let t=Number(e.slice(1));return Number.isFinite(t)?t:-1}function Ni(e,t,n){let r=[];return n!==null?(n.forEach((a,i)=>r.push({key:`c${i}`,text:a.text})),r):t!==null?(t.forEach((a,i)=>{if(a.kind==="hunk"||a.kind==="gap")return;let o=a.rightText??a.leftText??"";o!==""&&r.push({key:`c${i}`,text:o})}),r):(e.forEach((a,i)=>{a.kind==="hunk"||a.kind==="gap"||(a.leftText!==null&&a.leftText!==""&&r.push({key:`l${i}`,text:a.leftText}),a.rightText!==null&&a.rightText!==""&&r.push({key:`r${i}`,text:a.rightText}))}),r)}function Ei(e,t){if(t==="")return[];let n=[];for(let r of e)for(let[a,i]of an(r.text,t))if(n.push({cellKey:r.key,start:a,end:i}),n.length>=tn)return n;return n}function oa(e,t,n,r){let a=(i,o)=>(0,x.createElement)("button",{key:i,type:"button",className:`gp-seg__btn${e===i?" gp-seg__btn--active":""}`,"aria-pressed":e===i,onClick:()=>t(i)},o);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"},[a("render",r("diff.svgRender")),a("source",r("diff.svgSource"))])),(0,x.createElement)("div",{key:"body",className:"gp-svgdiff__body"},n)])}function Mi(e,t,n,r,a,i,o){let[s,l]=(0,x.useState)(null),d=(0,x.useRef)(0);(0,x.useEffect)(()=>{d.current+=1,l(null)},[e]);let p=(0,x.useCallback)((u,g)=>{if(n===void 0||r===void 0||a===void 0||i===void 0)return;let S=`${u.rightStart}:${g}`;l(S);let b=++d.current,{start:_,end:k}=Gi(u,g),M=i==="commit"&&o!==void 0?{kind:"file-lines",path:a,base:"commit",commit:o,start:_,end:k}:i==="staged"?{kind:"file-lines",path:a,base:"staged",start:_,end:k}:{kind:"file-lines",path:a,base:"worktree",start:_,end:k};n.query({sessionId:r,query:M}).then(D=>{if(b!==d.current)return;let J=ye(D,"file-lines");l(null),J!==null&&t(F=>Vr(F,u.rightStart,g,J.start,J.lines,J.eof))}).catch(()=>{b===d.current&&l(null)})},[n,r,a,i,o,t]);return{busy:s,run:p}}function Gi(e,t){let n=e.count;return t==="all"||n<=gt?{start:e.rightStart,end:e.rightStart+n-1}:t==="down"?{start:e.rightStart,end:e.rightStart+gt-1}:{start:e.rightStart+n-gt,end:e.rightStart+n-1}}function Ri(e,t,n,r,a){let[i,o]=(0,x.useState)({kind:"idle"});return(0,x.useEffect)(()=>{if(e===void 0||t===void 0||n===void 0||r===void 0)return;let s=!0;o({kind:"loading"});let l=r==="commit"&&a!==void 0?{kind:"image-diff",path:n,base:"commit",commit:a}:r==="staged"?{kind:"image-diff",path:n,base:"staged"}:{kind:"image-diff",path:n,base:"worktree"};return e.query({sessionId:t,query:l}).then(d=>{if(!s)return;let p=ye(d,"image-diff");o(p!==null?{kind:"ready",res:p}:{kind:"failed"})}).catch(()=>{s&&o({kind:"failed"})}),()=>{s=!1}},[e,t,n,r,a]),i}function dn(e,t=""){return e.map((n,r)=>(0,x.createElement)("span",{key:`${t}${r}`,style:n.style},n.text))}function sa(e,t,n,r){if(n===null)return null;let a=n.perCell.get(t);if(a===void 0||a.length===0)return null;let i=n.activeKey===t?n.activeRange:null;return on(e,a,r,t,i,n.activeRef)}function cn(e,t,n,r,a=null,i=-1){let o={key:t,className:e,"data-r":i>=0?i:void 0};if(n==="")return(0,x.createElement)("div",o,"\xA0");let s=r(n)?.[0],l=sa(n,t,a,s);return l!==null?(0,x.createElement)("div",o,l):(0,x.createElement)("div",o,s===void 0?n:dn(s))}function Fn(e,t,n,r,a,i,o=null,s=-1){let l={key:t,className:e,"data-r":s>=0?s:void 0},d=i(n)?.[0]??[{text:n,style:{}}],p=sa(n,t,o,d);if(p!==null)return(0,x.createElement)("div",l,p);let[u,g,S]=Wr(d,r);return(0,x.createElement)("div",l,[...dn(u,"p"),(0,x.createElement)("span",{key:"w",className:a},g.length===0?"\xA0":dn(g)),...dn(S,"s")])}function Li(e){return e.filter(t=>t.leftText!==null).map(t=>({no:t.leftNo,text:t.leftText}))}function Pi(e){return e.filter(t=>t.rightText!==null).map(t=>({no:t.rightNo,text:t.rightText}))}function Di(e,t,n,r,a,i){if(e.kind==="hunk")return[(0,x.createElement)("div",{key:`h${t}`,className:"gp-diff-row--hunk gp-diff-cell",style:{gridColumn:"1 / -1"},"data-r":t},e.text??"")];if(e.kind==="gap")return[la(e.gap,t,r,i)];let o=e.kind==="del"||e.kind==="mod"?"gp-diff-row--del":"",s=e.kind==="add"||e.kind==="mod"?"gp-diff-row--add":"",l=e.leftText===null?(0,x.createElement)("div",{key:`l${t}`,className:`gp-diff-cell ${o}`}):e.kind==="mod"&&e.leftWord!==void 0?Fn(`gp-diff-cell ${o}`,`l${t}`,e.leftText,e.leftWord,"gp-diff-word gp-diff-word--del",n,a,t):cn(`gp-diff-cell ${o}`,`l${t}`,e.leftText,n,a,t),d=e.rightText===null?(0,x.createElement)("div",{key:`r${t}`,className:`gp-diff-cell ${s}`}):e.kind==="mod"&&e.rightWord!==void 0?Fn(`gp-diff-cell ${s}`,`r${t}`,e.rightText,e.rightWord,"gp-diff-word gp-diff-word--add",n,a,t):cn(`gp-diff-cell ${s}`,`r${t}`,e.rightText,n,a,t);return[(0,x.createElement)("div",{key:`ln${t}`,className:"gp-diff-no"},e.leftNo??""),l,(0,x.createElement)("div",{key:`rn${t}`,className:"gp-diff-no"},e.rightNo??""),d]}function zi(e,t,n,r,a,i){if(e.kind==="hunk")return[(0,x.createElement)("div",{key:`h${t}`,className:"gp-diff-row--hunk gp-diff-cell",style:{gridColumn:"1 / -1"},"data-r":t},e.text??"")];if(e.kind==="gap")return[la(e.gap,t,r,i)];let o=e.kind==="del",s=e.kind==="add",l=s?"gp-diff-row--add":o?"gp-diff-row--del":"",d=s?"+":o?"\u2212":"\xA0",p=e.rightText??e.leftText??"",u=s?e.rightWord:o?e.leftWord:void 0,g=s?"gp-diff-word gp-diff-word--add":"gp-diff-word gp-diff-word--del",S=`gp-diff-cell gp-diff-uni__code ${l}`,b=u!==void 0?Fn(S,`c${t}`,p,u,g,n,a,t):cn(S,`c${t}`,p,n,a,t);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 ${l}`},d),b]}function la(e,t,n,r){let a=n.busy===`${e.rightStart}:all`,i=n.busy===`${e.rightStart}:up`,o=n.busy===`${e.rightStart}:down`,s=(p,u,g)=>(0,x.createElement)("button",{key:p,type:"button",className:"gp-gap__btn",disabled:n.busy!==null,onClick:S=>{S.stopPropagation(),n.run(e,p)}},g?r("common.loading"):u),l=[],d=e.count;return d<=gt?l.push(s("all",r("diff.expandGap",{n:d}),a)):(e.atStart||l.push(s("up",r("diff.expandUp",{n:gt}),i)),l.push(s("all",r("diff.expandGap",{n:d}),a)),l.push(s("down",r("diff.expandDown",{n:gt}),o))),(0,x.createElement)("div",{key:`g${t}`,className:"gp-diff-row--gap",style:{gridColumn:"1 / -1"},"data-r":t},l)}function gn(e){return Xr(e)}var Z=require("react");var Ai=100;function da(e,t,n){let[r,a]=(0,Z.useState)(null),[i,o]=(0,Z.useState)(!1),[s,l]=(0,Z.useState)([]),d=(0,Z.useCallback)(()=>{o(!1),(async()=>{let[p,u]=await Promise.all([e.query({sessionId:t,query:{kind:"branches"}}),e.query({sessionId:t,query:{kind:"tags"}})]),g=ye(p,"branches");if(g===null){o(!0);return}let S=ye(u,"tags");a({current:g.current,defaultBranch:g.defaultBranch,local:g.local,remote:g.remote,tags:S?.tags??[]}),e.query({sessionId:t,query:{kind:"authors"}}).then(b=>{l(ye(b,"authors")?.authors??[])})})()},[e,t]);return(0,Z.useEffect)(()=>{d()},[n]),{tree:r,treeError:i,authors:s,reload:d}}function ca(e,t,n,r,a){let[i,o]=(0,Z.useState)([]),[s,l]=(0,Z.useState)(0),[d,p]=(0,Z.useState)(!1),[u,g]=(0,Z.useState)(!1),S=(0,Z.useRef)(0),b=(0,Z.useRef)(!1),_=(0,Z.useRef)(null),k=(0,Z.useCallback)(async(F,C)=>{if(b.current)return;b.current=!0;let R=S.current;p(!0),g(!1);let Q=await e.query({sessionId:t,query:{kind:"history",limit:Ai,skip:F,...C.ref?{ref:C.ref}:{},...C.search?{search:C.search}:{},...C.author?{author:C.author}:{},...C.since?{since:C.since}:{}}});if(b.current=!1,R!==S.current)return;p(!1);let U=ye(Q,"history");if(U===null){g(!0);return}let K=U.commits;o(ae=>F===0?K:[...ae,...K]),l(U.total)},[e,t]),M=(0,Z.useRef)(n);(0,Z.useEffect)(()=>{S.current+=1,b.current=!1,M.current!==n&&(M.current=n,a(),_.current&&(_.current.scrollTop=0)),k(0,n)},[n,r]);let D=s<0?!0:i.length<s,J=(0,Z.useCallback)(()=>{b.current||!D||k(i.length,n)},[k,i.length,n,D]);return{commits:i,total:s,loading:d,listError:u,hasMore:D,listRef:_,loadMore:J}}function pa(e,t,n){let[r,a]=(0,Z.useState)(null),[i,o]=(0,Z.useState)(null),[s,l]=(0,Z.useState)(!1),[d,p]=(0,Z.useState)(null),[u,g]=(0,Z.useState)(null),[S,b]=(0,Z.useState)(!1),[_,k]=(0,Z.useState)(n),[M,D]=(0,Z.useState)(!1),J=(0,Z.useRef)(0),F=(0,Z.useRef)(null),C=(0,Z.useRef)(new Map),R=(0,Z.useCallback)((ee,w)=>{let T=C.current;for(T.set(ee,w);T.size>50;){let j=T.keys().next().value;if(j===void 0)break;T.delete(j)}},[]),Q=(0,Z.useCallback)(()=>{a(null),o(null),F.current=null},[]),U=(0,Z.useCallback)(ee=>{F.current===ee.hash&&a(ee)},[]),K=(0,Z.useCallback)(async ee=>{F.current=ee.hash,a(ee),l(!1),J.current+=1,p(null),g(null),b(!1);let w=C.current.get(ee.hash);if(w!==void 0){o(w);return}o(null);let T=await e.query({sessionId:t,query:{kind:"show",ref:ee.hash}});if(F.current!==ee.hash)return;let j=ye(T,"show");if(j!==null){let Y={commit:j.commit,body:j.body,stats:j.stats,insertions:j.insertions,deletions:j.deletions};R(ee.hash,Y),o(Y)}else l(!0)},[e,t,R]),ae=(0,Z.useCallback)(async(ee,w,T,j=!1)=>{let Y=++J.current;p({path:ee,hash:w,shortHash:T}),g(null),b(!1),D(j);let m=await e.query({sessionId:t,query:{kind:"diff",path:ee,base:"commit",commit:w,...j?{context:2e3}:{}}});if(Y!==J.current)return;let G=ye(m,"diff");G!==null?g({text:G.text,newLines:G.newLines,truncated:G.truncated}):b(!0)},[e,t]),z=(0,Z.useCallback)(()=>{J.current+=1,p(null),g(null),b(!1),D(!1)},[]);(0,Z.useEffect)(()=>{if(d===null)return;let ee=w=>{w.key==="Escape"&&z()};return document.addEventListener("keydown",ee),()=>document.removeEventListener("keydown",ee)},[d,z]);let[W,O]=(0,Z.useState)(null),[se,q]=(0,Z.useState)(null),de=(0,Z.useRef)(void 0),le=(0,Z.useRef)(null),he=(0,Z.useCallback)((ee,w,T)=>{de.current!==void 0&&clearTimeout(de.current),de.current=setTimeout(()=>{le.current=ee.hash,O({commit:ee,x:w,y:T});let j=C.current.get(ee.hash);if(j!==void 0){q(j.body);return}q(null),e.query({sessionId:t,query:{kind:"show",ref:ee.hash}}).then(Y=>{if(le.current!==ee.hash)return;let m=ye(Y,"show");m!==null?(R(ee.hash,{commit:m.commit,body:m.body,stats:m.stats,insertions:m.insertions,deletions:m.deletions}),q(m.body)):q("")})},260)},[e,t,R]),be=(0,Z.useCallback)(()=>{de.current!==void 0&&clearTimeout(de.current),le.current=null,O(null),q(null)},[]);return(0,Z.useEffect)(()=>()=>{de.current!==void 0&&clearTimeout(de.current)},[]),{selected:r,detail:i,detailError:s,select:K,resyncSelected:U,clearSelection:Q,fileDiff:d,fileDiffData:u,fileDiffError:S,fileDiffMode:_,setFileDiffMode:k,fileDiffExpanded:M,openFileDiff:ae,closeFileDiff:z,hover:W,hoverBody:se,onHoverEnter:he,onHoverLeave:be}}var Oe=require("react"),Hi=(e,t,n)=>Math.max(t,Math.min(n,e));function Fi(e,t){try{let n=typeof localStorage<"u"?localStorage.getItem(e):null,r=n===null?NaN:Number(n);return Number.isFinite(r)?r:t}catch{return t}}function Bi(e,t){try{typeof localStorage<"u"&&localStorage.setItem(e,String(Math.round(t)))}catch{}}function mt(e){let{storageKey:t,initial:n,min:r,reserve:a,edge:i}=e,[o,s]=(0,Oe.useState)(()=>Fi(t,n)),l=(0,Oe.useRef)(null),d=(0,Oe.useRef)(null),p=(0,Oe.useCallback)(g=>{let b=l.current?.parentElement?.clientWidth??Number.MAX_SAFE_INTEGER;d.current={x:g.clientX,w:o,max:Math.max(r,b-a)},g.preventDefault(),typeof document<"u"&&(document.body.style.cursor="col-resize",document.body.style.userSelect="none")},[o,r,a]);(0,Oe.useEffect)(()=>{if(typeof window>"u")return;let g=b=>{let _=d.current;if(_===null)return;let k=b.clientX-_.x;s(Hi(_.w+(i==="end"?k:-k),r,_.max))},S=()=>{d.current!==null&&(d.current=null,typeof document<"u"&&(document.body.style.cursor="",document.body.style.userSelect=""),s(b=>(Bi(t,b),b)))};return window.addEventListener("pointermove",g),window.addEventListener("pointerup",S),()=>{window.removeEventListener("pointermove",g),window.removeEventListener("pointerup",S)}},[i,r,t]);let u=(0,Oe.createElement)("div",{key:`rz-${t}`,ref:l,className:"gp-resizer",role:"separator","aria-orientation":"vertical",onPointerDown:p});return{width:o,divider:u}}var ua=require("react");function it(e,t,n,r,a=!1){return e.map(i=>(0,ua.createElement)("button",{key:i,type:"button",className:`gp-seg__btn${t===i?" gp-seg__btn--active":""}`,...a?{disabled:!0}:{},onClick:()=>n(i)},r(i)))}var me=require("react"),ga=require("react-dom");function $t(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");case"not-ff":return n("error.notFastForward");case"push-rejected":return n("error.pushRejected");case"auth-failed":return n("error.authFailed");case"conflict":return n("error.conflict");case"revert-conflict":return n("error.revertConflict");case"revert-stuck":return n("error.revertStuck");case"revert-merge":return n("error.revertMerge");case"index-busy":return n("error.indexBusy");case"not-found":return n("error.notFound");case"branch-in-use":return n("error.branchInUse");case"stash-switch-failed":return n("error.stashSwitchFailed",{reason:t??""});case"invalid-name":case"invalid-index":return n("error.invalidName");default:return t??n("error.generic")}}function Nt(e){return(0,me.createElement)("div",{key:"aihint",className:"gp-modal__hint"},e("ops.aiHint"))}function Et(e){return(0,me.createElement)("div",{key:"footer",className:"gp-modal__footer"},[(0,me.createElement)("button",{key:"cancel",type:"button",className:"gp-btn",onClick:e.onClose},e.t("common.cancel")),(0,me.createElement)("button",{key:"ok",type:"button",className:`gp-btn ${e.danger?"gp-btn--danger":"gp-btn--primary"}`,disabled:e.confirmDisabled,onClick:e.onConfirm},e.confirmLabel)])}function ot(e){return typeof document>"u"?null:(0,me.createElement)(Ii,e)}function Ii({onClose:e,title:t,icon:n,hash:r,body:a,footer:i,overlay:o,portalKey:s,t:l}){let d=o!=null;(0,me.useEffect)(()=>{let u=g=>{g.key==="Escape"&&!d&&e()};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[e,d]);let p=(0,me.createElement)("div",{className:"gp-modal-backdrop",onClick:u=>{!d&&u.target===u.currentTarget&&e()}},(0,me.createElement)("div",{className:"gp-modal gp-modal--sm",role:"dialog","aria-modal":!0},[(0,me.createElement)("div",{key:"bar",className:"gp-modal__bar"},[n!==void 0?(0,me.createElement)("span",{key:"ic",className:"gp-modal__fileicon"},n):null,(0,me.createElement)("span",{key:"title",className:"gp-modal__path"},t),r!==void 0?(0,me.createElement)("span",{key:"hash",className:"gp-modal__hash"},r):null,(0,me.createElement)("button",{key:"close",type:"button",className:"gp-icon-btn gp-modal__close",title:l("common.close"),disabled:d,onClick:e},(0,me.createElement)(nt,{size:15}))]),(0,me.createElement)("div",{key:"body",className:"gp-modal__form"},a),i,o??null]));return(0,ga.createPortal)(p,document.body,s)}function Oi(e){return(0,me.createElement)("div",{key:"overlay",className:"gp-modal__overlay"},[(0,me.createElement)("div",{key:"sp",className:"gp-spinner"}),(0,me.createElement)("div",{key:"lb",className:"gp-modal__overlay-label"},e)])}function Ke(e){let t=e.confirmBusy===!0&&e.busyLabel!==void 0;return ot({onClose:e.onClose,title:e.title,portalKey:"confirm-modal",t:e.t,body:[(0,me.createElement)("div",{key:"txt",className:"gp-modal__confirmtext"},e.body),e.extra??null,Nt(e.t),e.error!==null?(0,me.createElement)("div",{key:"err",className:"gp-feedback"},e.error):null],footer:Et({onClose:e.onClose,onConfirm:e.onConfirm,confirmLabel:e.confirmLabel,confirmDisabled:e.confirmBusy===!0,danger:e.danger,t:e.t}),...t?{overlay:Oi(e.busyLabel)}:{}})}var ie=require("react");function fa(e,t){return typeof document>"u"?null:(0,ie.createElement)($i,{target:e,...t})}function $i({target:e,onClose:t,onCreate:n,error:r,t:a}){let[i,o]=(0,ie.useState)(""),[s,l]=(0,ie.useState)(!1),[d,p]=(0,ie.useState)(""),u=()=>{i.trim()!==""&&n(i.trim(),s?d:"")};return ot({onClose:t,title:a("tag.createTitle"),icon:(0,ie.createElement)(wt,{size:15}),hash:e.shortHash,portalKey:"tag-create-modal",t:a,body:[(0,ie.createElement)("input",{key:"name",className:"gp-input",placeholder:a("tag.namePlaceholder"),value:i,autoFocus:!0,onChange:g=>o(g.target.value),onKeyDown:g=>{g.key==="Enter"&&u()}}),(0,ie.createElement)("label",{key:"ann",className:"gp-modal__check"},[(0,ie.createElement)("input",{key:"cb",type:"checkbox",className:"gp-check",checked:s,onChange:()=>l(g=>!g)}),a("tag.annotated")]),s?(0,ie.createElement)("textarea",{key:"msg",className:"gp-input gp-input--area",placeholder:a("tag.messagePlaceholder"),value:d,onChange:g=>p(g.target.value)}):null,Nt(a),r!==null?(0,ie.createElement)("div",{key:"err",className:"gp-feedback"},r):null],footer:Et({onClose:t,onConfirm:u,confirmLabel:a("tag.create"),confirmDisabled:i.trim()==="",danger:!1,t:a})})}function ma(e,t){return typeof document>"u"?null:(0,ie.createElement)(Xi,{target:e,...t})}function Xi({target:e,from:t,dirty:n,lostFiles:r,lostTotal:a,lostTruncated:i,busy:o,error:s,onReset:l,onClose:d,t:p}){let[u,g]=(0,ie.useState)("mixed"),[S,b]=(0,ie.useState)(!1);(0,ie.useEffect)(()=>{u!=="hard"&&b(!1)},[u]);let _=[{value:"mixed",label:"reset.modeMixed",hint:"reset.mixedHint"},{value:"soft",label:"reset.modeSoft",hint:"reset.softHint"},{value:"hard",label:"reset.modeHard",hint:"reset.hardHint"}],k=o||u==="hard"&&!S;return ot({onClose:d,title:p("reset.title"),icon:(0,ie.createElement)(Qt,{size:15}),hash:e.shortHash,portalKey:"reset-modal",t:p,body:[(0,ie.createElement)("div",{key:"txt",className:"gp-modal__confirmtext"},p("reset.body",{from:t,to:e.shortHash})),(0,ie.createElement)("div",{key:"modes",className:"gp-reset__modes"},_.map(M=>(0,ie.createElement)("label",{key:M.value,className:`gp-reset__mode${u===M.value?" gp-reset__mode--on":""}${M.value==="hard"?" gp-reset__mode--danger":""}`},[(0,ie.createElement)("input",{key:"r",type:"radio",name:"gp-reset-mode",className:"gp-check",checked:u===M.value,onChange:()=>g(M.value)}),(0,ie.createElement)("span",{key:"tx",className:"gp-reset__modetext"},[(0,ie.createElement)("span",{key:"l",className:"gp-reset__modelabel"},p(M.label)),(0,ie.createElement)("span",{key:"h",className:"gp-reset__modehint"},p(M.hint))])]))),u==="hard"?(0,ie.createElement)("div",{key:"orphan",className:"gp-reset__dirtywarn"},p("reset.hardOrphan")):null,u==="hard"&&a>0?(0,ie.createElement)("div",{key:"lost",className:"gp-reset__lost"},[(0,ie.createElement)("div",{key:"w",className:"gp-reset__warn"},p("reset.hardWarn")),(0,ie.createElement)("ul",{key:"ul",className:"gp-reset__lostlist"},[...r.map(M=>(0,ie.createElement)("li",{key:M,title:M},M)),i?(0,ie.createElement)("li",{key:"_more",className:"gp-reset__lostmore"},p("reset.lostMore")):null])]):null,u==="hard"?(0,ie.createElement)("label",{key:"ack",className:"gp-modal__check gp-reset__ack"},[(0,ie.createElement)("input",{key:"cb",type:"checkbox",className:"gp-check",checked:S,onChange:()=>b(M=>!M)}),p(a>0?"reset.hardAck":"reset.hardAckClean")]):null,n?(0,ie.createElement)("div",{key:"dirty",className:"gp-reset__dirtywarn"},p("ops.dirtyWarn")):null,Nt(p),s!==null?(0,ie.createElement)("div",{key:"err",className:"gp-feedback"},s):null],footer:Et({onClose:d,onConfirm:()=>void l(u),confirmLabel:p("reset.confirm"),confirmDisabled:k,danger:u==="hard",t:p})})}var Le=require("react");function ha(e,t){return typeof document>"u"?null:(0,Le.createElement)(Ji,{target:e,...t})}function Ji({target:e,from:t,dirty:n,busy:r,error:a,onConfirm:i,onClose:o,t:s}){let[l,d]=(0,Le.useState)(!1),p=(u,g,S,b)=>(0,Le.createElement)("label",{key:g,className:`gp-bpick__mode${l===u?" gp-bpick__mode--on":""}`},[(0,Le.createElement)("input",{key:"r",type:"radio",name:"gp-switch-mode",className:"gp-check",checked:l===u,onChange:()=>d(u)}),(0,Le.createElement)("span",{key:"tx",className:"gp-bpick__modetext"},[(0,Le.createElement)("span",{key:"l",className:"gp-bpick__modelabel"},S),(0,Le.createElement)("span",{key:"h",className:"gp-bpick__modehint"},b)])]);return Ke({title:s("switch.confirmTitle"),body:s("switch.body",{from:t??s("switch.detached"),to:e.name}),extra:(0,Le.createElement)("div",{key:"x",className:"gp-bpick__extra"},[e.createFrom===void 0?null:(0,Le.createElement)("div",{key:"trk",className:"gp-bpick__note"},s("switch.trackingNote",{name:e.name,ref:e.createFrom})),n===0?null:(0,Le.createElement)("div",{key:"dw",className:"gp-bpick__warn"},s("switch.dirtyWarn",{count:n})),n===0?null:(0,Le.createElement)("div",{key:"md",className:"gp-bpick__modes"},[p(!1,"direct",s("switch.modeDirect"),s("switch.modeDirectHint")),p(!0,"stash",s("switch.modeStash",{count:n}),s("switch.modeStashHint"))])]),confirmLabel:s(l?"switch.confirmStash":"switch.confirm"),danger:!1,error:a,confirmBusy:r,busyLabel:s("switch.switching"),onConfirm:()=>i(l),onClose:o,t:s})}function Ki(e){let t=e.indexOf("/");return t<=0||t===e.length-1?null:{remote:e.slice(0,t),branch:e.slice(t+1)}}function ya(e){let t=new Set(e.local.map(a=>a.name)),n=e.local.map(a=>({key:`local:${a.name}`,group:"local",label:a.name,name:a.name,reused:!1,ahead:a.ahead,behind:a.behind,shortHash:a.shortHash})),r=[];for(let a of e.remote){let i=Ki(a.name);if(i===null)continue;let o=t.has(i.branch);r.push({key:`remote:${a.name}`,group:"remote",label:a.name,name:i.branch,createFrom:o?void 0:a.name,reused:o,ahead:a.ahead,behind:a.behind,shortHash:a.shortHash})}return[...n,...r]}function ba(e,t){return e.name!==t}var ge=require("react");var Ue=require("react"),va=require("react-dom"),Ui=140,Vi=260;function fn(e){let t=e?.placement??"above",n=e?.delayMs??Ui,r=e?.maxWidth??Vi,[a,i]=(0,Ue.useState)(null),o=(0,Ue.useRef)(void 0),s=(0,Ue.useCallback)(()=>{o.current!==void 0&&(clearTimeout(o.current),o.current=void 0),i(null)},[]),l=(0,Ue.useCallback)((g,S)=>{o.current!==void 0&&clearTimeout(o.current),o.current=setTimeout(()=>{let b=g.getBoundingClientRect(),_=Math.max(8,Math.min(b.left,window.innerWidth-r-8));i(t==="below"?{text:S,left:_,top:b.bottom+6}:{text:S,left:_,bottom:Math.max(8,window.innerHeight-b.top+6)})},n)},[t,n,r]),d=(0,Ue.useCallback)(g=>({onMouseEnter:S=>l(S.currentTarget,g),onMouseLeave:s,onFocus:S=>l(S.currentTarget,g),onBlur:s}),[l,s]),p={left:a?.left??0,maxWidth:r};a?.top!==void 0&&(p.top=a.top),a?.bottom!==void 0&&(p.bottom=a.bottom);let u=a!==null&&typeof document<"u"?(0,va.createPortal)((0,Ue.createElement)("div",{className:"gp-tip gp-tip--sb",style:p},a.text),document.body):null;return{tipProps:d,tipNode:u,hideTip:s}}function wa(e,t,n){if(e==="loading"||e===null)return(0,ge.createElement)("div",{className:"gp-pullscope gp-pullscope--loading"},t(n.loading));let r=t(n.line,{commits:e.commits,files:e.files,ins:e.insertions,del:e.deletions}),a=r.match(/(\+\d+)\s*\/\s*([-−]\d+)/);if(a===null)return(0,ge.createElement)("div",{className:"gp-pullscope"},r);let i=r.indexOf(a[0]);return(0,ge.createElement)("div",{className:"gp-pullscope"},[r.slice(0,i),(0,ge.createElement)("span",{key:"add",className:"gp-pullscope__add"},a[1])," / ",(0,ge.createElement)("span",{key:"del",className:"gp-pullscope__del"},a[2]),r.slice(i+a[0].length)])}function xa(e,t){return wa(e,t,{line:"status.pullScope",loading:"status.pullScopeLoading"})}function ka(e,t){return wa(e,t,{line:"status.pushScope",loading:"status.pushScopeLoading"})}function Wi(e){let t=e.replace(/^https?:\/\/[^/]+\//,"").replace(/\/+$/,""),n=t.split("/");return n.length>=2?n.slice(-2).join("/"):t}function Bn(e,t){return(0,ge.createElement)(qi,{snapshot:e,cb:t})}function qi({snapshot:e,cb:t}){let{t:n}=t,{tipProps:r,tipNode:a,hideTip:i}=fn({placement:"above"}),o=e.remote??null,s=e.hasUpstream===!0,l=(()=>{if(o===null||o.hostKind!=="github")return null;let M=(0,ge.createElement)(Mr,{size:14});if(o.webUrl===null)return(0,ge.createElement)("span",{key:"r",className:"gp-statusbar__repo gp-statusbar__repo--none","aria-label":o.url,...r(o.url)},(0,ge.createElement)("span",{className:"gp-statusbar__ic"},M));let D=o.host!==null?n("status.openRepoOn",{host:o.host}):n("status.openRepo"),J=`${Wi(o.webUrl)} \xB7 ${D}`;return(0,ge.createElement)("a",{key:"r",className:"gp-statusbar__repo",href:o.webUrl,target:"_blank",rel:"noreferrer","aria-label":J,...r(J)},(0,ge.createElement)("span",{className:"gp-statusbar__ic"},M))})(),{ahead:d,behind:p,branch:u}=e,g=s&&p>0&&d===0,S=s&&d>0&&p===0,b=!s&&u!==null&&o!==null,_=(()=>{let M,D="";return u===null?M=n("status.detached"):s?d===0&&p===0?(M=n("status.synced"),D=" gp-statusbar__state--ok"):d>0&&p>0?(M=n("status.diverged",{ahead:d,behind:p}),D=" gp-statusbar__state--warn"):p>0?(M=n("status.behind",{n:p}),D=" gp-statusbar__state--warn"):M=n("status.ahead",{n:d}):M=n("status.noUpstream"),(0,ge.createElement)("span",{key:"s",className:`gp-statusbar__state${D}`},M)})(),k=[o!==null?(0,ge.createElement)("button",{key:"check",type:"button",className:"gp-icon-btn gp-statusbar__btn",disabled:t.syncBusy,"aria-label":n("status.check"),...r(n("status.checkTitle")),onClick:()=>{i(),t.onCheck()}},(0,ge.createElement)(Rr,{size:13})):null,g?(0,ge.createElement)("button",{key:"pull",type:"button",className:"gp-btn gp-btn--sm gp-statusbar__pull",disabled:t.pullBusy,"aria-label":n("status.pullTitle"),...r(n("status.pullTitle")),onClick:()=>{i(),t.onPull()}},[(0,ge.createElement)(Gr,{key:"i",size:12}),n("status.pull")]):null,S?(0,ge.createElement)("button",{key:"push",type:"button",className:"gp-btn gp-btn--sm gp-statusbar__pull",disabled:t.pushBusy,"aria-label":n("status.pushTitle"),...r(n("status.pushTitle")),onClick:()=>{i(),t.onPush()}},[(0,ge.createElement)(Ln,{key:"i",size:12}),n("status.push")]):null,b?(0,ge.createElement)("button",{key:"publish",type:"button",className:"gp-btn gp-btn--sm gp-statusbar__pull",disabled:t.publishBusy,"aria-label":n("status.publishTitle"),...r(n("status.publishTitle")),onClick:()=>{i(),t.onPublish()}},[(0,ge.createElement)(Ln,{key:"i",size:12}),n("status.publish")]):null];return(0,ge.createElement)("div",{key:"statusbar",className:`gp-statusbar${t.syncBusy?" gp-statusbar--busy":""}`},[l,(0,ge.createElement)("div",{key:"sync",className:"gp-statusbar__sync"},[_,...k]),a])}var In=new Set,Mt=14,_a=30;function ji(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n].kind!==t[n].kind||e[n].name!==t[n].name||e[n].head!==t[n].head)return!1;return!0}var Qi=46,Yi=260;function Zi(e,t){let[n,r]=(0,c.useState)(!1);return(0,c.useEffect)(()=>{if(e===null||typeof ResizeObserver>"u")return;let a=()=>r(e.clientWidth>0&&e.clientWidth<t);a();let i=new ResizeObserver(a);return i.observe(e),()=>i.disconnect()},[e,t]),n}function Sa({remote:e,sessionId:t,refreshKey:n,defaultDiffView:r,snapshot:a,onAction:i,onResync:o,compact:s,t:l}){let[d,p]=(0,c.useState)({ref:null,search:"",author:"",since:""}),[u,g]=(0,c.useState)(""),[S,b]=(0,c.useState)(null),_=Zi(S,Yi),[k,M]=(0,c.useState)(new Set(["tags","remote"])),[D,J]=(0,c.useState)(0),F=n+D,C=()=>J(y=>y+1),[R,Q]=(0,c.useState)(null),[U,K]=(0,c.useState)(null),[ae,z]=(0,c.useState)(null),[W,O]=(0,c.useState)(null),[se,q]=(0,c.useState)(null),[de,le]=(0,c.useState)(!1),[he,be]=(0,c.useState)(!1),[ee,w]=(0,c.useState)(!1),[T,j]=(0,c.useState)(!1),[Y,m]=(0,c.useState)(!1),[G,B]=(0,c.useState)(!1),[P,ue]=(0,c.useState)(!1),[Se,_e]=(0,c.useState)(!1),[lt,Fe]=(0,c.useState)(null),[De,N]=(0,c.useState)(null),[Ee,ze]=(0,c.useState)("list"),[xe,$e]=(0,c.useState)(null),[Ve,Be]=(0,c.useState)(!1),[Ae,Me]=(0,c.useState)(!1);(0,c.useEffect)(()=>{if(!Ae)return;let y=V=>{V.key==="Escape"&&Me(!1)};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[Ae]),(0,c.useEffect)(()=>{!s&&Ae&&Me(!1)},[s,Ae]),(0,c.useEffect)(()=>{if(!T){Fe(null);return}let y=!0;return Fe("loading"),e.query({sessionId:t,query:{kind:"pull-preview"}}).then(V=>{if(!y)return;let ce=ye(V,"pull-preview");Fe(ce!==null&&ce.hasUpstream?{commits:ce.commits,files:ce.files,insertions:ce.insertions,deletions:ce.deletions}:null)}),()=>{y=!1}},[T,e,t]),(0,c.useEffect)(()=>{if(!G){N(null);return}let y=!0;return N("loading"),e.query({sessionId:t,query:{kind:"push-preview"}}).then(V=>{if(!y)return;let ce=ye(V,"push-preview");N(ce!==null&&ce.hasUpstream?{commits:ce.commits,files:ce.files,insertions:ce.insertions,deletions:ce.deletions}:null)}),()=>{y=!1}},[G,e,t]);let{tree:Te,treeError:Xe,authors:qe,reload:Ge}=da(e,t,F),ke=(0,c.useMemo)(()=>{let y=new Map;if(Te===null)return y;for(let V of ya(Te))ba(V,Te.current)&&y.set(V.key,V);return y},[Te]),ht=y=>{q(null),$e(y)},ne=pa(e,t,r),{commits:Ie,loading:Lt,listError:je,hasMore:Qe,listRef:Ye,loadMore:yt}=ca(e,t,d,F,ne.clearSelection);(0,c.useEffect)(()=>{let y=setTimeout(()=>p(V=>V.search===u?V:{...V,search:u}),300);return()=>clearTimeout(y)},[u]);let Ce=d.search!=="",Je=(0,c.useMemo)(()=>Ce?Ie.map(y=>({commit:y,lane:0,color:0,edges:[],merge:!1})):zr(Ie,a.graphStyle),[Ie,Ce,a.graphStyle]),bt=(0,c.useMemo)(()=>Ce?0:Dr(Je),[Je,Ce]),dt=Ce?12:Math.max(Mt,bt*Mt),Ze=s?Qi:_a,ct=s?`${dt}px minmax(0,1fr)`:`${dt}px minmax(120px,1fr) 72px 120px 96px`,te=()=>{let y=Ye.current;y===null||!Qe||y.scrollTop+y.clientHeight>=y.scrollHeight-240&&yt()},$=y=>{ne.select(y),s&&ze("detail")},h=(0,c.useMemo)(()=>Date.now(),[Ie]),L=(0,c.useMemo)(()=>ne.detail===null?[]:Ar(ne.detail.stats.map(y=>({path:y.path,meta:y.status}))),[ne.detail]),E=ne.selected,re=E?.hash??null,[pe,we]=(0,c.useState)({hash:null,dirs:In}),We=pe.hash===re?pe.dirs:In,Ka=(0,c.useCallback)(y=>{we(V=>{let ce=V.hash===re?V.dirs:In,Jt=new Set(ce);return Jt.has(y)?Jt.delete(y):Jt.add(y),{hash:re,dirs:Jt}})},[re]);(0,c.useEffect)(()=>{if(E===null)return;let y=Ie.find(V=>V.hash===E.hash);y!==void 0&&y!==E&&!ji(y.refs,E.refs)&&ne.resyncSelected(y)},[Ie,E]);let Qn=mt({storageKey:"gp.overview.left",initial:200,min:130,reserve:360,edge:"end"}),Yn=mt({storageKey:"gp.overview.right",initial:340,min:190,reserve:360,edge:"start"}),Zn=y=>p(V=>({...V,ref:y})),Ua=async(y,V)=>{if(!(R===null||de)){q(null),le(!0);try{let ce=await e.run({sessionId:t,action:{kind:"tag-create",name:y,commit:R.hash,...V.trim()!==""?{message:V}:{}}});ce.ok?(Q(null),C()):q($t(ce.error.code,ce.error.message,l))}finally{le(!1)}}},Va=async y=>{if(!de){q(null),le(!0);try{let V=await e.run({sessionId:t,action:{kind:"tag-delete",name:y}});V.ok?(K(null),C()):q($t(V.error.code,V.error.message,l))}finally{le(!1)}}},Wa=async()=>{if(!(ae===null||de)){q(null),le(!0);try{let y=await i({kind:"revert",commit:ae.hash});y.ok?z(null):q(y.error??l("error.generic"))}finally{le(!1)}}},qa=async y=>{if(!(W===null||de)){q(null),le(!0);try{let V=await i({kind:"reset",commit:W.hash,mode:y});V.ok?O(null):q(V.error??l("error.generic"))}finally{le(!1)}}},ja=async y=>{if(!(xe===null||Ve)){q(null),Be(!0);try{let V=await i({kind:"branch-checkout",name:xe.name,...xe.createFrom===void 0?{}:{createFrom:xe.createFrom},...y?{stashMessage:l("switch.stashMessage",{branch:xe.name})}:{}});V.ok?($e(null),Ge()):q(V.error??l("error.generic"))}finally{Be(!1)}}},Qa=async()=>{if(!he){q(null),be(!0);try{let y=await i({kind:"fetch"});y.ok?Ge():q(y.error??l("error.generic"))}finally{be(!1)}}},Ya=async()=>{if(!ee){q(null),w(!0);try{let y=await i({kind:"pull-ff"});y.ok?(j(!1),Ge()):q(y.error??l("error.generic"))}finally{w(!1)}}},Za=async()=>{if(!Y){q(null),m(!0);try{let y=await i({kind:"push"});y.ok?(B(!1),Ge()):q(y.error??l("error.generic"))}finally{m(!1)}}},ei=async()=>{if(!(P||a.remote===null)){q(null),ue(!0);try{let y=await i({kind:"publish",remote:a.remote.name});y.ok?(_e(!1),Ge()):q(y.error??l("error.generic"))}finally{ue(!1)}}},er={syncBusy:he,pullBusy:ee,pushBusy:Y,publishBusy:P,onCheck:()=>void Qa(),onPull:()=>{q(null),j(!0)},onPush:()=>{q(null),B(!0)},onPublish:()=>{q(null),_e(!0)},t:l},tr=io(ne.fileDiff,{data:ne.fileDiffData,error:ne.fileDiffError,mode:ne.fileDiffMode,onMode:ne.setFileDiffMode,expanded:ne.fileDiffExpanded,onExpand:y=>{ne.fileDiff!==null&&ne.openFileDiff(ne.fileDiff.path,ne.fileDiff.hash,ne.fileDiff.shortHash,y)},onClose:ne.closeFileDiff,remote:e,sessionId:t,compact:s,t:l}),nr=(0,c.useMemo)(()=>[...new Set(a.changes.filter(y=>y.status!=="untracked").map(y=>y.path))],[a.changes]),rr=[R!==null?fa(R,{onClose:()=>Q(null),onCreate:Ua,error:se,compact:s,t:l}):null,U!==null?Ke({title:l("tag.deleteTitle"),body:l("tag.deleteConfirm",{name:U}),confirmLabel:l("tag.deleteTitle"),danger:!0,error:se,confirmBusy:de,onConfirm:()=>void Va(U),onClose:()=>K(null),t:l}):null,ae!==null?Ke({title:l("revert.title"),body:l("revert.body",{ref:`${ae.shortHash} ${ae.subject}`})+(a.dirty?`
|
|
628
673
|
|
|
629
|
-
${l("ops.dirtyWarn")}`:""),confirmLabel:l("revert.confirm"),danger:!1,error:oe,confirmBusy:de,onConfirm:()=>void za(),onClose:()=>N(null),t:l}):null,Z!==null?oa(Z,{from:r.head??Z.shortHash,dirty:r.dirty,lostFiles:Un,lostTotal:Un.length,lostTruncated:r.truncated,busy:de,error:oe,onReset:Ha,onClose:()=>ie(null),t:l}):null,x?$e({title:l("status.pullConfirmTitle"),body:l("status.pullConfirmBody",{branch:r.branch??"HEAD",behind:r.behind}),extra:ua(Fe,l),confirmLabel:l("status.pullConfirm"),danger:!1,error:oe,confirmBusy:Y,busyLabel:l("status.pulling"),onConfirm:()=>void Ia(),onClose:()=>P(!1),t:l}):null,X?$e({title:l("status.pushConfirmTitle"),body:l("status.pushConfirmBody",{branch:r.branch??"HEAD",ahead:r.ahead}),extra:ga(De,l),confirmLabel:l("status.pushConfirm"),danger:!1,error:oe,confirmBusy:z,busyLabel:l("status.pushing"),onConfirm:()=>void Oa(),onClose:()=>te(!1),t:l}):null,G?$e({title:l("status.publishConfirmTitle"),body:l("status.publishConfirmBody",{branch:r.branch??"HEAD",remote:r.remote?.name??"origin"}),confirmLabel:l("status.publishConfirm"),danger:!1,error:oe,confirmBusy:ee,busyLabel:l("status.publishing"),onConfirm:()=>void $a(),onClose:()=>ve(!1),t:l}):null,Te!==null?sa(Te,{from:r.branch,dirty:r.dirty?Math.max(1,r.stats.fileCount):0,busy:pt,error:oe,onConfirm:y=>void Fa(y),onClose:()=>Ve(null),t:l}):null],Qn=(0,c.createElement)("div",{key:"mid",className:"gp-col gp-col--mid gp-history"},[(0,c.createElement)("div",{key:"tb",className:"gp-toolbar",ref:k},[s?(0,c.createElement)("button",{key:"filter",type:"button",className:`gp-btn${d.ref!==null?" gp-btn--primary":""}`,title:l("overview.filterBranch"),onClick:()=>Ne(!0)},[(0,c.createElement)(hr,{key:"ic",size:13}),d.ref??l("overview.filterBranch")]):null,(0,c.createElement)("input",{key:"search",className:"gp-search",placeholder:l(_||s?"overview.searchShort":"overview.search"),value:u,onChange:y=>g(y.target.value)}),(0,c.createElement)("select",{key:"author",className:"gp-select",value:d.author,onChange:y=>p(K=>({...K,author:y.target.value}))},[(0,c.createElement)("option",{key:"",value:""},l("overview.allUsers")),...qe.map(y=>(0,c.createElement)("option",{key:y,value:y},y))]),(0,c.createElement)("select",{key:"since",className:"gp-select",value:d.since,onChange:y=>p(K=>({...K,since:y.target.value}))},[(0,c.createElement)("option",{key:"",value:""},l("overview.allTime")),(0,c.createElement)("option",{key:"today",value:"1 day ago"},l("overview.today")),(0,c.createElement)("option",{key:"7d",value:"7 days ago"},l("overview.last7d")),(0,c.createElement)("option",{key:"30d",value:"30 days ago"},l("overview.last30d"))]),(0,c.createElement)("button",{key:"fetch",type:"button",className:"gp-icon-btn",title:l("overview.fetch"),onClick:()=>{e.run({sessionId:t,action:{kind:"fetch"}}).then(()=>Ee())}},(0,c.createElement)(Kt,{size:14}))]),(0,c.createElement)("div",{key:"list",className:"gp-history__list",ref:Qe,onScroll:Q},ze.length===0?(0,c.createElement)("div",{className:"gp-empty"},l(Et?"common.loading":Ue?"overview.loadFailed":"overview.noResults")):Oe.map(y=>Ki(y,{selected:M?.hash===y.commit.hash,gridTpl:at,graphW:rt,laneCount:ft,searching:ke,now:h,compact:s,rowH:Ye,onSelect:()=>B(y.commit),onHoverEnter:ne.onHoverEnter,onHoverLeave:ne.onHoverLeave,t:l})))]),Yn=M===null?[(0,c.createElement)("div",{key:"empty",className:"gp-empty"},[(0,c.createElement)(Xt,{key:"i",size:20}),l("overview.selectCommit")])]:[(0,c.createElement)("div",{key:"files",className:"gp-detail__files"},ne.detail===null?(0,c.createElement)("div",{className:"gp-empty"},ne.detailError?l("overview.detailFailed"):l("common.loading")):[ne.detail.stats.length>0?(0,c.createElement)("div",{key:"sum",className:"gp-detail__summary"},[(0,c.createElement)("span",{key:"f"},l("overview.changeSummary",{files:ne.detail.stats.length})),(0,c.createElement)("span",{key:"sep",className:"gp-detail__summary-sep"},"\xB7"),(0,c.createElement)("span",{key:"a",className:"gp-stats__add"},`+${ne.detail.insertions}`),(0,c.createElement)("span",{key:"d",className:"gp-stats__del"},`\u2212${ne.detail.deletions}`)]):null,Vi(D,{activePath:ne.fileDiff?.path??null,openTitle:l("overview.openFileDiff"),onOpen:y=>{M!==null&&ne.openFileDiff(y,M.hash,M.shortHash)},collapsed:Je,onToggleDir:Pa,expandLabel:l("overview.expandDir"),collapseLabel:l("overview.collapseDir")})]),(0,c.createElement)("div",{key:"msg",className:"gp-detail__msg"},[(0,c.createElement)("div",{key:"subj",className:"gp-detail__subject"},M.subject),(0,c.createElement)("div",{key:"meta",className:"gp-detail__meta"},[(0,c.createElement)("span",{key:"h",className:"gp-commit-hash"},M.shortHash),(0,c.createElement)("span",{key:"a"},M.author),(0,c.createElement)("span",{key:"t"},Nn(M.dateIso))]),(0,c.createElement)("div",{key:"ops",className:"gp-detail__ops"},(()=>{let y=M.refs.filter(K=>K.kind==="tag");return[y.length>0?(0,c.createElement)("div",{key:"tags",className:"gp-detail__tags"},y.map(K=>(0,c.createElement)("span",{key:`tag-${K.name}`,className:"gp-ref-chip gp-ref-chip--tag gp-ref-chip--del",title:K.name},[(0,c.createElement)(ht,{key:"i",size:11}),(0,c.createElement)("span",{key:"n",className:"gp-detail__tagname"},K.name),(0,c.createElement)("button",{key:"x",type:"button",className:"gp-ref-chip__x",title:l("tag.deleteOne",{name:K.name}),onClick:()=>{W(null),V(K.name)}},(0,c.createElement)(tt,{size:11}))]))):null,(0,c.createElement)("div",{key:"actions",className:"gp-detail__actions"},[(0,c.createElement)("button",{key:"revert",type:"button",className:"gp-btn gp-btn--sm",title:l("overview.revert"),onClick:()=>{W(null),N({hash:M.hash,shortHash:M.shortHash,subject:M.subject})}},[(0,c.createElement)(wr,{key:"i",size:12}),l("overview.revert")]),(0,c.createElement)("button",{key:"reset",type:"button",className:"gp-btn gp-btn--sm",title:l("overview.reset"),onClick:()=>{W(null),o(),ie({hash:M.hash,shortHash:M.shortHash,subject:M.subject})}},[(0,c.createElement)(Jt,{key:"i",size:12}),l("overview.reset")]),(0,c.createElement)("button",{key:"addtag",type:"button",className:"gp-btn gp-btn--sm",title:l("overview.createTag"),onClick:()=>{W(null),J({hash:M.hash,shortHash:M.shortHash})}},[(0,c.createElement)(ht,{key:"i",size:12}),l("overview.createTag")])])]})()),ne.detail!==null&&ne.detail.body!==""?(0,c.createElement)("pre",{key:"body",className:"gp-detail__body"},ne.detail.body):(0,c.createElement)("div",{key:"nb",className:"gp-empty"},l("overview.noMessage"))])];return s?(0,c.createElement)("div",{className:"gp-overview gp-overview--compact"},[qn,...jn,Ae==="detail"?(0,c.createElement)("div",{key:"detail",className:"gp-col gp-col--mid gp-detail"},[(0,c.createElement)("div",{key:"back",className:"gp-subhead"},[(0,c.createElement)("button",{key:"b",type:"button",className:"gp-subhead__back",onClick:()=>Be("list")},[(0,c.createElement)(yt,{key:"i",size:14}),l("overview.backToList")]),M!==null?(0,c.createElement)("span",{key:"h",className:"gp-subhead__title gp-commit-hash"},M.shortHash):null]),...Yn]):Qn,Ln(r,Wn),Ke?Xi(_e,Ie,d.ref,S,{onFilter:y=>{Vn(y),Ne(!1)},switchOptions:we,onSwitch:y=>{Ne(!1),ut(y)},onToggle:y=>R(K=>{let le=new Set(K);return le.has(y)?le.delete(y):le.add(y),le}),onRetry:Ee,onClose:()=>Ne(!1),t:l}):null]):(0,c.createElement)("div",{className:"gp-overview"},[qn,...jn,(0,c.createElement)("div",{key:"left",className:"gp-col gp-col--left",style:{flex:`0 0 ${Kn.width}px`}},[(0,c.createElement)("div",{key:"scroll",className:"gp-col-left__scroll"},ha(_e,Ie,d.ref,S,{onFilter:y=>Vn(y),switchOptions:we,onSwitch:ut,onToggle:y=>R(K=>{let le=new Set(K);return le.has(y)?le.delete(y):le.add(y),le}),onRetry:Ee,t:l})),Ln(r,Wn)]),Kn.divider,Qn,Jn.divider,(0,c.createElement)("div",{key:"right",className:"gp-col gp-col--right gp-detail",style:{flex:`0 0 ${Jn.width}px`}},Yn),$i(ne.hover,ne.hoverBody,l)])}function $i(e,t,n){if(e===null||typeof document>"u")return null;let a=460,r=Math.min(e.x+16,(typeof window<"u"?window.innerWidth:1200)-a-12),i=e.y+14,o=(0,c.createElement)("div",{className:"gp-hovercard",style:{left:r,top:i,maxWidth:a}},[(0,c.createElement)("div",{key:"subj",className:"gp-hovercard__subject"},e.commit.subject),(0,c.createElement)("div",{key:"meta",className:"gp-hovercard__meta"},[(0,c.createElement)("span",{key:"h",className:"gp-commit-hash"},e.commit.shortHash),(0,c.createElement)("span",{key:"a"},e.commit.author),(0,c.createElement)("span",{key:"t"},Nn(e.commit.dateIso))]),t===null?(0,c.createElement)("div",{key:"l",className:"gp-hovercard__loading"},n("common.loading")):t===""?(0,c.createElement)("div",{key:"e",className:"gp-hovercard__loading"},n("overview.noMessage")):(0,c.createElement)("pre",{key:"body",className:"gp-hovercard__body"},t)]);return(0,cn.createPortal)(o,document.body,"commit-hovercard")}function ha(e,t,n,a,r){if(t)return(0,c.createElement)("div",{className:"gp-empty"},[(0,c.createElement)("span",{key:"m"},r.t("overview.branchesError")),(0,c.createElement)("button",{key:"r",type:"button",className:"gp-btn",style:{marginTop:8},onClick:r.onRetry},r.t("common.retry"))]);if(e===null)return(0,c.createElement)("div",{className:"gp-empty"},r.t("common.loading"));let i=(o,s,l,d,p="")=>(0,c.createElement)("div",{key:o,className:"gp-branch-group"},[(0,c.createElement)("div",{key:"head",className:"gp-branch-group__head",onClick:()=>r.onToggle(o)},[(0,c.createElement)(et,{key:"c",size:11,open:!a.has(o)}),`${r.t(s)} (${l.length})`]),a.has(o)?null:l.map(u=>{let g=p+u.name,w=e.current===u.name,k=`gp-branch-row${n===g?" gp-branch-row--active":""}${w?" gp-branch-row--current":""}`,_=r.switchOptions.get(`${o}:${u.name}`);return(0,c.createElement)("div",{key:u.name,className:k,title:u.name,onClick:()=>r.onFilter(n===g?null:g)},[(0,c.createElement)("span",{key:"i",style:{display:"inline-flex",width:14}},d),(0,c.createElement)("span",{key:"n",className:"gp-tree-name"},u.name),u.ahead||u.behind?(0,c.createElement)("span",{key:"t",className:"gp-branch-row__track"},`${u.ahead?`\u2191${u.ahead}`:""}${u.behind?`\u2193${u.behind}`:""}`):null,_===void 0?null:(0,c.createElement)("button",{key:"sw",type:"button",className:"gp-branch-row__switch",title:r.t(_.createFrom===void 0?"switch.rowTitle":"switch.rowTitleTrack",{name:_.name,ref:_.label}),onClick:S=>{S.stopPropagation(),r.onSwitch(_)}},r.t("switch.action"))])})]);return(0,c.createElement)("div",{},[(0,c.createElement)("div",{key:"head-row",className:"gp-branch-row",style:{fontWeight:600,justifyContent:"center",padding:"4px 10px"},onClick:()=>r.onFilter(null)},r.t("overview.head")),i("local","overview.local",e.local,(0,c.createElement)(Sn,{size:13})),i("remote","overview.remote",e.remote,(0,c.createElement)(Sn,{size:13})),i("tags","overview.tags",e.tags,(0,c.createElement)(ht,{size:13}))])}function Xi(e,t,n,a,r){if(typeof document>"u")return null;let i=(0,c.createElement)("div",{className:"gp-sheet-backdrop",onClick:o=>{o.target===o.currentTarget&&r.onClose()}},(0,c.createElement)("div",{className:"gp-sheet",role:"dialog","aria-modal":!0},[(0,c.createElement)("div",{key:"bar",className:"gp-sheet__bar"},[(0,c.createElement)("span",{key:"title",className:"gp-sheet__title"},r.t("overview.filterBranch")),(0,c.createElement)("button",{key:"close",type:"button",className:"gp-icon-btn gp-sheet__close",title:r.t("common.close"),onClick:r.onClose},(0,c.createElement)(tt,{size:15}))]),(0,c.createElement)("div",{key:"body",className:"gp-sheet__body"},ha(e,t,n,a,r))]));return(0,cn.createPortal)(i,document.body,"branch-filter-sheet")}function Ki(e,t){let n=e.commit,a=n.refs.map(i=>(0,c.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)),r=(0,c.createElement)("div",{key:"g",className:"gp-graph-cell"},t.searching?null:Ji(e,t.laneCount,t.rowH));return t.compact?(0,c.createElement)("div",{key:n.hash,className:`gp-commit-row gp-commit-row--compact${t.selected?" gp-commit-row--active":""}`,style:{gridTemplateColumns:t.gridTpl,height:`${t.rowH}px`},onClick:t.onSelect},[r,(0,c.createElement)("div",{key:"tx",className:"gp-commit-lines"},[(0,c.createElement)("div",{key:"s",className:"gp-commit-subject"},[...a,n.subject]),(0,c.createElement)("div",{key:"m",className:"gp-commit-sub"},[(0,c.createElement)("span",{key:"h",className:"gp-commit-hash"},n.shortHash),(0,c.createElement)("span",{key:"a",className:"gp-commit-author"},n.author),(0,c.createElement)("span",{key:"d",className:"gp-commit-date"},bt(n.dateIso,t.now,t.t))])])]):(0,c.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},[r,(0,c.createElement)("div",{key:"s",className:"gp-commit-subject"},[...a,n.subject]),(0,c.createElement)("div",{key:"h",className:"gp-commit-hash"},n.shortHash),(0,c.createElement)("div",{key:"a",className:"gp-commit-author"},n.author),(0,c.createElement)("div",{key:"d",className:"gp-commit-date",title:Lt(n.dateIso)},bt(n.dateIso,t.now,t.t))])}var dn=["#4e9bff","#3fb950","#e0982e","#d05ce3","#e5534b","#2dc6c6","#d29922","#8b949e"];function Ji(e,t,n=fa){let a=Math.max(Tt,t*Tt),r=s=>s*Tt+Tt/2,i=n/2,o=[];for(let s of e.edges){let l=dn[s.color%dn.length],d=s.kind==="out"?i:0,p=s.kind==="into"?i:n,u=(d+p)/2;o.push((0,c.createElement)("path",{key:`e${s.kind}-${s.fromLane}-${s.toLane}-${s.color}`,d:`M ${r(s.fromLane)} ${d} C ${r(s.fromLane)} ${u}, ${r(s.toLane)} ${u}, ${r(s.toLane)} ${p}`,stroke:l,strokeWidth:1.6,fill:"none"}))}return o.push((0,c.createElement)("circle",{key:"node",cx:r(e.lane),cy:i,r:e.merge?4:3.2,fill:dn[e.color%dn.length],stroke:"var(--dsw-alias-bg-layer-1)",strokeWidth:1})),(0,c.createElement)("svg",{className:"gp-graph-svg",width:a,height:n},o)}function Vi(e,t){let n=[],a=(r,i)=>{for(let o of r)if(o.dir){let s=t.collapsed.has(o.path);n.push((0,c.createElement)("div",{key:o.path,className:"gp-tree-row gp-tree-row--dir",style:{paddingLeft:10+i*14},title:s?t.expandLabel:t.collapseLabel,role:"button",tabIndex:0,"aria-expanded":!s,onClick:()=>t.onToggleDir(o.path),onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),t.onToggleDir(o.path))}},[(0,c.createElement)(et,{key:"c",size:11,open:!s}),(0,c.createElement)("span",{key:"n",className:"gp-tree-name"},o.name)])),s||a(o.children,i+1)}else{let s=String(o.meta??"modified"),l=t.activePath===o.path;n.push((0,c.createElement)("div",{key:o.path,className:`gp-tree-row${l?" gp-tree-row--active":""}`,style:{paddingLeft:10+i*14},title:t.openTitle,onClick:()=>t.onOpen(o.path)},[(0,c.createElement)("span",{key:"st",className:`gp-status-badge ${Wt(s)}`},(Vt[s]??s[0]??"M").toUpperCase()),(0,c.createElement)("span",{key:"n",className:"gp-tree-name"},o.name)]))}};return a(e,0),(0,c.createElement)("div",{},n)}function Wi(e,t){if(e===null||typeof document>"u")return null;let{data:n,error:a,mode:r,onMode:i,expanded:o,onExpand:s,onClose:l,remote:d,sessionId:p,compact:u,t:g}=t,w=u?["unified","before","after"]:["unified","split","before","after"],k=u&&r==="split"?"unified":r,_=n!==null&&n.text!==""?(()=>{let E=sn(n.text);return(0,c.createElement)("span",{key:"sum",className:"gp-modal__sum"},[(0,c.createElement)("span",{key:"a",className:"gp-stats__add"},`+${E.add}`),(0,c.createElement)("span",{key:"d",className:"gp-stats__del"},`\u2212${E.del}`)])})():null,S=(0,c.createElement)("button",{key:"expand",type:"button",className:`gp-seg__btn gp-diff__expand${o?" gp-seg__btn--active":""}`,disabled:k!=="split"&&k!=="unified",title:g(o?"diff.collapse":"diff.expandAll"),onClick:()=>s(!o)},g(o?"diff.collapse":"diff.expandAll")),R=(0,c.createElement)("div",{key:"seg",className:"gp-seg"},ct(w,k,i,E=>g(`diff.${E}`))),$=(0,c.createElement)("button",{key:"close",type:"button",className:"gp-icon-btn gp-modal__close",title:g("common.close"),onClick:l},(0,c.createElement)(tt,{size:15})),q=[(0,c.createElement)("span",{key:"fileicon",className:"gp-modal__fileicon"},(0,c.createElement)(br,{size:15})),(0,c.createElement)("span",{key:"path",className:"gp-modal__path",title:e.path},qi(e.path)),(0,c.createElement)("span",{key:"hash",className:"gp-modal__hash"},e.shortHash),_,S],A=u?[(0,c.createElement)("div",{key:"brow1",className:"gp-modal__bar-row"},q),(0,c.createElement)("div",{key:"brow2",className:"gp-modal__bar-row gp-modal__bar-row--controls"},[R,$])]:[...q,R,$],T=(0,c.createElement)("div",{className:"gp-modal-backdrop",onClick:E=>{E.target===E.currentTarget&&l()}},(0,c.createElement)("div",{className:"gp-modal",role:"dialog","aria-modal":!0},[(0,c.createElement)("div",{key:"bar",className:"gp-modal__bar"},A),(0,c.createElement)("div",{key:"scroll",className:"gp-modal__scroll"},n===null?(0,c.createElement)("div",{className:"gp-empty"},g(a?"overview.diffFailed":"common.loading")):(0,c.createElement)(on,{key:"diff",text:n.text,mode:k,path:e.path,remote:d,sessionId:p,base:"commit",commit:e.hash,expanded:o,truncated:n.truncated===!0,newLines:n.newLines,t:g}))]));return(0,cn.createPortal)(T,document.body,"file-diff-modal")}function qi(e){let t=e.lastIndexOf("/");return t<0?[(0,c.createElement)("span",{key:"n",className:"gp-modal__name"},e)]:[(0,c.createElement)("span",{key:"d",className:"gp-modal__dir"},e.slice(0,t+1)),(0,c.createElement)("span",{key:"n",className:"gp-modal__name"},e.slice(t+1))]}var m=require("react");var Ge=require("react");function ya({stats:e,t}){let n=Date.now(),a=[(0,Ge.createElement)("span",{key:"files",className:"gp-stats__item"},t("stats.files",{n:e.fileCount})),(0,Ge.createElement)("span",{key:"lines",className:"gp-stats__item"},[(0,Ge.createElement)("span",{key:"a",className:"gp-stats__add"},`+${e.insertions}`)," ",(0,Ge.createElement)("span",{key:"d",className:"gp-stats__del"},`\u2212${e.deletions}`)])];e.staged>0&&a.push((0,Ge.createElement)("span",{key:"st",className:"gp-stats__item"},t("stats.staged",{n:e.staged}))),e.modified>0&&a.push((0,Ge.createElement)("span",{key:"mo",className:"gp-stats__item"},t("stats.modified",{n:e.modified}))),e.untracked>0&&a.push((0,Ge.createElement)("span",{key:"un",className:"gp-stats__item"},t("stats.untracked",{n:e.untracked}))),e.partial&&a.push((0,Ge.createElement)("span",{key:"partial",className:"gp-stats__item gp-stats__partial",title:t("stats.partialHint")},t("stats.partial")));let r=[];return e.lastChangeAt!==null&&r.push((0,Ge.createElement)("span",{key:"lc",className:"gp-stats__item",title:Lt(e.lastChangeAt)},t("stats.lastChange",{time:bt(e.lastChangeAt,n,t)}))),e.headCommittedAt!==null&&r.push((0,Ge.createElement)("span",{key:"hc",className:"gp-stats__item",title:Lt(e.headCommittedAt)},t("stats.lastCommit",{time:bt(e.headCommittedAt,n,t)}))),r.length>0&&a.push((0,Ge.createElement)("span",{key:"times",className:"gp-stats__times"},r)),(0,Ge.createElement)("div",{className:"gp-stats"},a)}var zn=28,ba=26,Ui=8,ji=600;function va({remote:e,sessionId:t,snapshot:n,onAction:a,compact:r,t:i}){let[o,s]=(0,m.useState)(new Set),[l,d]=(0,m.useState)(""),[p,u]=(0,m.useState)(!1),[g,w]=(0,m.useState)(!1),[k,_]=(0,m.useState)(null),[S,R]=(0,m.useState)(new Set),[$,q]=(0,m.useState)(null),[A,T]=(0,m.useState)(null),[E,J]=(0,m.useState)(null),[O,V]=(0,m.useState)(()=>n.defaultDiffView),[j,N]=(0,m.useState)(!1),[Z,ie]=(0,m.useState)(!1),[oe,W]=(0,m.useState)(!1),[de,se]=(0,m.useState)(!1),[he,fe]=(0,m.useState)(null),[Y,f]=(0,m.useState)("list"),[x,P]=(0,m.useState)([]),[z,C]=(0,m.useState)(!0),[X,te]=(0,m.useState)(!1),[ee,xe]=(0,m.useState)(null),G=(0,m.useRef)(null),ve=(0,m.useRef)(0),{setEl:Fe,viewport:Ce}=kt(),De=(0,m.useCallback)(async()=>{let h=await e.query({sessionId:t,query:{kind:"stash-list"}}),D=me(h,"stash-list");P(D?.entries??[])},[e,t]);(0,m.useEffect)(()=>{De()},[De,n.checkedAt]);let Le=(0,m.useMemo)(()=>n.changes.filter(h=>h.staged).sort(Hn),[n]),Ae=(0,m.useMemo)(()=>n.changes.filter(h=>!h.staged&&h.status!=="untracked").sort(Hn),[n]),Be=(0,m.useMemo)(()=>n.changes.filter(h=>h.status==="untracked").sort(Hn),[n]),Ve=[{key:"staged",labelKey:"changes.groupStaged",items:Le},{key:"unstaged",labelKey:"changes.groupUnstaged",items:Ae},{key:"untracked",labelKey:"changes.groupUntracked",items:Be}].filter(h=>h.items.length>0),{items:pt,tops:We,totalH:Ke}=(0,m.useMemo)(()=>{let h=[];for(let M of Ve)if(h.push({kind:"head",g:{key:M.key,labelKey:M.labelKey,count:M.items.length}}),!S.has(M.key))for(let re of M.items)h.push({kind:"row",c:re});let D=wt(h.map(M=>M.kind==="head"?ba:zn));return{items:h,tops:D,totalH:D[h.length]}},[Le,Ae,Be,S]),Ne=Ce.height>0?Ce.height:ji,{first:_e,last:Ie}=xt(We,Ce.top,Ne,Ui*zn);(0,m.useEffect)(()=>{s(h=>{if(h.size===0)return h;let D=new Set(n.changes.map(ce=>ce.path+(ce.staged?":s":":w"))),M=new Set,re=!1;for(let ce of h)D.has(ce)?M.add(ce):re=!0;return re?M:h})},[n]),(0,m.useEffect)(()=>{if(!p||Z||l.trim()!=="")return;let h=!0;return e.query({sessionId:t,query:{kind:"last-commit-message"}}).then(D=>{let M=me(D,"last-commit-message");h&&M!==null&&(d(M.message),ie(!0))}),()=>{h=!1}},[p,Z,l,e,t]);let qe=(0,m.useCallback)(async(h,D,M=!1,re=!1)=>{let ce=++ve.current;T({path:h,base:D}),re||J(null),N(M);let ye=await e.query({sessionId:t,query:{kind:"diff",path:h,base:D,...M?{context:2e3}:{}}});if(ce!==ve.current)return;let Je=me(ye,"diff");J(Je!==null?{text:Je.text,newLines:Je.newLines,truncated:Je.truncated}:{text:"",newLines:0})},[e,t]);(0,m.useEffect)(()=>{if(A===null)return;if(!n.changes.some(D=>D.path===A.path)){T(null),J(null),f("list");return}qe(A.path,A.base,j,!0)},[n]),(0,m.useEffect)(()=>{q(null)},[n]),(0,m.useEffect)(()=>{se(!1)},[n]);let Ee=h=>{s(D=>{let M=new Set(D);return M.has(h)?M.delete(h):M.add(h),M})},we=async h=>{if(g)return!1;w(!0),_(null),fe(null);try{let D=await a(h);return D.ok?!0:(_(D.error??i("error.generic")),!1)}catch(D){return _(D instanceof Error?D.message:i("error.generic")),!1}finally{w(!1)}},ut=async()=>{let h=l.trim();if(h===""&&!p){_(i("error.emptyMessage"));return}let D=o.size>0?[...new Set([...o].map(re=>re.replace(/:[sw]$/,"")))]:void 0;await we({kind:"commit",message:h,...D?{paths:D}:{},...p?{amend:!0}:{}})&&(d(""),s(new Set),u(!1),ie(!1))},ne=async h=>{await we({kind:"stash-push",...h.trim()!==""?{message:h}:{}})&&(te(!1),De())},ze=(h,D)=>{we({kind:"stash-apply",index:h,sha:D}).then(M=>{M&&De()})},Et=(h,D)=>{we({kind:"stash-pop",index:h,sha:D}).then(M=>{M&&De()})},Ue=async(h,D)=>{await we({kind:"stash-drop",index:h,sha:D})&&(xe(null),De())},je=(h,D)=>{switch(h){case"empty-diff":return i("error.emptyDiff");case"llm-unavailable":return i("error.llmUnavailable");case"suggest-disabled":return i("error.suggestDisabled");case"llm-error":case"llm-output":return D===void 0?i("error.llmFailed"):`${i("error.llmFailed")}: ${D}`;default:return D??i("error.generic")}},Qe=async()=>{if(oe)return;if(p&&!de&&l.trim()!==""){se(!0),_(null),fe(i("commit.suggestOverwrite"));return}se(!1);let h=o.size>0?[...new Set([...o].map(D=>D.replace(/:[sw]$/,"")))]:void 0;W(!0),_(null),fe(null);try{let D=await e.suggest({sessionId:t,...h&&h.length>0?{paths:h}:{}});D.ok?(d(D.value.message),D.value.truncated===!0&&fe(i("commit.suggestTruncated")),G.current?.focus()):_(je(D.error.code,D.error.message))}catch(D){_(D instanceof Error?D.message:i("error.generic"))}finally{W(!1)}},gt=h=>{R(D=>{let M=new Set(D);return M.has(h)?M.delete(h):M.add(h),M})},ke=E!==null&&E.text!==""?sn(E.text):null,Oe=dt({storageKey:"gp.changes.left",initial:380,min:220,reserve:200,edge:"end"}),ft=(h,D)=>{qe(h,D),r&&f("diff")},rt=r?["unified","before","after"]:["unified","split","before","after"],Ye=r&&O==="split"?"unified":O,at=[(0,m.createElement)(ya,{key:"stats",stats:n.stats,t:i}),(0,m.createElement)("div",{key:"toolbar",className:"gp-toolbar"},[(0,m.createElement)("button",{key:"sa",type:"button",className:"gp-btn",disabled:g||n.changes.length===0,onClick:()=>void we({kind:"stage-all"})},i("changes.stageAll")),(0,m.createElement)("button",{key:"ua",type:"button",className:"gp-btn",disabled:g||n.staged===0,onClick:()=>void we({kind:"unstage-all"})},i("changes.unstageAll")),(0,m.createElement)("button",{key:"stash",type:"button",className:"gp-btn",disabled:g||n.staged===0&&n.modified===0,title:i("changes.stash"),onClick:()=>{_(null),te(!0)}},[(0,m.createElement)(Cn,{key:"ic",size:13}),i("changes.stash")])]),k!==null?(0,m.createElement)("div",{key:"err",className:"gp-feedback"},k):null,he!==null?(0,m.createElement)("div",{key:"notice",className:"gp-notice"},he):null,(0,m.createElement)("div",{key:"list",className:"gp-changes__list",ref:Fe},n.changes.length===0?(0,m.createElement)("div",{className:"gp-empty"},i("changes.noChanges")):(0,m.createElement)("div",{className:"gp-changes__vlist",style:{height:Ke}},pt.slice(_e,Ie).map((h,D)=>{let M=_e+D;if(h.kind==="head"){let ye=h.g;return(0,m.createElement)("div",{key:`h:${ye.key}`,className:"gp-changes__vrow",style:{top:We[M],height:ba}},(0,m.createElement)("div",{className:"gp-group-head",onClick:()=>gt(ye.key)},[(0,m.createElement)(et,{key:"chev",size:12,open:!S.has(ye.key)}),`${i(ye.labelKey)} (${ye.count})`]))}let re=h.c,ce=re.path+(re.staged?":s":":w");return(0,m.createElement)("div",{key:ce,className:"gp-changes__vrow",style:{top:We[M],height:zn}},Zi(re,{selected:o.has(ce),active:A?.path===re.path&&A.base===(re.staged?"staged":"worktree"),busy:g,armed:$===ce,onToggle:()=>Ee(ce),onOpen:()=>ft(re.path,re.staged?"staged":"worktree"),onStage:()=>void we(re.staged?{kind:"unstage",paths:[re.path]}:{kind:"stage",paths:[re.path]}),onDiscard:()=>{$===ce?(we({kind:"discard",paths:[re.path]}),q(null)):q(ce)},t:i}))}))),x.length>0?(0,m.createElement)("div",{key:"stashes",className:"gp-stash"},[(0,m.createElement)("div",{key:"head",className:"gp-group-head",onClick:()=>C(h=>!h)},[(0,m.createElement)(et,{key:"chev",size:12,open:!z}),`${i("stash.section")} (${x.length})`]),z?null:(0,m.createElement)("div",{key:"items"},x.map(h=>Yi(h,{busy:g,onApply:()=>ze(h.index,h.sha),onPop:()=>Et(h.index,h.sha),onDrop:()=>{_(null),xe(h)},t:i})))]):null,(0,m.createElement)("div",{key:"box",className:"gp-commitbox"},[(0,m.createElement)("textarea",{key:"msg",className:"gp-commitbox__msg",placeholder:i("commit.placeholder"),value:l,ref:G,readOnly:oe,"aria-busy":oe,onChange:h=>d(h.target.value)}),(0,m.createElement)("div",{key:"row",className:"gp-commitbox__row"},[(0,m.createElement)("label",{key:"amend",className:"gp-commitbox__amend"},[(0,m.createElement)("input",{key:"cb",type:"checkbox",className:"gp-check",checked:p,disabled:oe,onChange:()=>{u(h=>!h),ie(!1)}}),i("commit.amend")]),(0,m.createElement)("div",{key:"actions",className:"gp-commitbox__actions"},[n.suggestEnabled!==!1?(0,m.createElement)("button",{key:"suggest",type:"button",className:"gp-btn",disabled:g||oe||n.changes.length===0,onClick:()=>void Qe(),title:i("commit.suggest")},[(0,m.createElement)(yr,{key:"ic",size:13}),i(oe?"commit.suggesting":"commit.suggest")]):null,(0,m.createElement)("button",{key:"commit",type:"button",className:"gp-btn gp-btn--primary",disabled:g||oe||l.trim()==="",onClick:()=>void ut()},i("commit.commit"))])])])],Q=A===null?(0,m.createElement)("div",{className:"gp-empty"},i("changes.selectFile")):(0,m.createElement)("div",{className:"gp-diff"},[(0,m.createElement)("div",{key:"tb",className:`gp-diff__toolbar${r?" gp-diff__toolbar--compact":""}`},(()=>{let h=r?(0,m.createElement)("button",{key:"back",type:"button",className:"gp-subhead__back",onClick:()=>f("list")},[(0,m.createElement)(yt,{key:"i",size:14}),i("changes.backToList")]):null,D=(0,m.createElement)("span",{key:"path",className:"gp-diff__path"},A.path),M=ke?(0,m.createElement)("span",{key:"sum",className:"gp-stats__item",style:{marginLeft:"auto"}},[(0,m.createElement)("span",{key:"a",className:"gp-stats__add"},`+${ke.add}`)," ",(0,m.createElement)("span",{key:"d",className:"gp-stats__del"},`\u2212${ke.del}`)]):null,re=(0,m.createElement)("button",{key:"expand",type:"button",className:`gp-seg__btn gp-diff__expand${j?" gp-seg__btn--active":""}`,style:ke||r?{}:{marginLeft:"auto"},disabled:Ye!=="split"&&Ye!=="unified",title:i(j?"diff.collapse":"diff.expandAll"),onClick:()=>void qe(A.path,A.base,!j)},i(j?"diff.collapse":"diff.expandAll")),ce=(0,m.createElement)("div",{key:"seg",className:"gp-seg"},ct(rt,Ye,V,ye=>i(`diff.${ye}`)));return r?[(0,m.createElement)("div",{key:"row1",className:"gp-diff__toolbar-row"},[h,D,M]),(0,m.createElement)("div",{key:"row2",className:"gp-diff__toolbar-row gp-diff__toolbar-row--controls"},[re,ce])]:[h,D,M,re,ce]})()),E===null?(0,m.createElement)("div",{key:"scroll",className:"gp-diff__scroll"},(0,m.createElement)("div",{className:"gp-empty"},i("common.loading"))):(0,m.createElement)(on,{key:"diff",text:E.text,mode:Ye,path:A.path,remote:e,sessionId:t,base:A.base,expanded:j,truncated:E.truncated===!0,newLines:E.newLines,t:i})]),B=[X?(0,m.createElement)(Qi,{key:"push",onClose:()=>te(!1),onStash:ne,error:k,t:i}):null,ee!==null?$e({title:i("stash.dropTitle"),body:i("stash.dropConfirm",{name:ee.message}),confirmLabel:i("stash.drop"),danger:!0,error:k,onConfirm:()=>void Ue(ee.index,ee.sha),onClose:()=>xe(null),t:i}):null];return r?(0,m.createElement)("div",{className:"gp-changes gp-changes--compact"},[...B,Y==="diff"?(0,m.createElement)("div",{key:"right",className:"gp-changes__right"},Q):(0,m.createElement)("div",{key:"left",className:"gp-changes__left"},at)]):(0,m.createElement)("div",{className:"gp-changes"},[...B,(0,m.createElement)("div",{key:"left",className:"gp-changes__left",style:{flex:`0 0 ${Oe.width}px`}},at),Oe.divider,(0,m.createElement)("div",{key:"right",className:"gp-changes__right"},Q)])}function Qi({onClose:e,onStash:t,error:n,t:a}){let[r,i]=(0,m.useState)("");return Ct({onClose:e,title:a("stash.title"),icon:(0,m.createElement)(Cn,{size:15}),portalKey:"stash-push-modal",t:a,body:[(0,m.createElement)("input",{key:"msg",className:"gp-input",placeholder:a("stash.messagePlaceholder"),value:r,autoFocus:!0,onChange:o=>i(o.target.value),onKeyDown:o=>{o.key==="Enter"&&t(r)}}),_t(a),n!==null?(0,m.createElement)("div",{key:"err",className:"gp-feedback"},n):null],footer:St({onClose:e,onConfirm:()=>void t(r),confirmLabel:a("stash.save"),confirmDisabled:!1,danger:!1,t:a})})}function Yi(e,t){return(0,m.createElement)("div",{key:e.index,className:"gp-stash-row"},[(0,m.createElement)("div",{key:"info",className:"gp-stash-row__info"},[(0,m.createElement)("span",{key:"m",className:"gp-stash-row__msg",title:e.message},e.message),(0,m.createElement)("span",{key:"meta",className:"gp-stash-row__meta"},[e.branch!==null?(0,m.createElement)("span",{key:"b"},t.t("stash.onBranch",{branch:e.branch})):null,e.relTime!==""?(0,m.createElement)("span",{key:"t"},e.relTime):null])]),(0,m.createElement)("div",{key:"act",className:"gp-stash-row__actions"},[(0,m.createElement)("button",{key:"apply",type:"button",className:"gp-btn gp-btn--sm",disabled:t.busy,onClick:t.onApply},t.t("stash.apply")),(0,m.createElement)("button",{key:"pop",type:"button",className:"gp-btn gp-btn--sm",disabled:t.busy,onClick:t.onPop},t.t("stash.pop")),(0,m.createElement)("button",{key:"drop",type:"button",className:"gp-icon-btn",disabled:t.busy,title:t.t("stash.drop"),onClick:t.onDrop},(0,m.createElement)(vr,{size:14}))])])}function Hn(e,t){return e.path.localeCompare(t.path)}function Zi(e,t){let n=e.path.split("/").pop()??e.path,a=e.path.includes("/")?e.path.slice(0,e.path.lastIndexOf("/")):"";return(0,m.createElement)("div",{key:e.path+(e.staged?":s":":w"),className:`gp-file-row${t.active?" gp-file-row--active":""}`,onClick:t.onOpen},[(0,m.createElement)("input",{key:"cb",type:"checkbox",className:"gp-check",checked:t.selected,onClick:r=>r.stopPropagation(),onChange:t.onToggle}),(0,m.createElement)("span",{key:"st",className:`gp-status-badge ${Wt(e.status)}`},Vt[e.status]??"?"),(0,m.createElement)("span",{key:"nm",className:"gp-tree-name",title:e.path},[n,a?(0,m.createElement)("span",{key:"d",style:{color:"var(--dsw-alias-label-tertiary)",marginLeft:6,fontSize:11}},a):null]),(0,m.createElement)("span",{key:"act",className:"gp-file-row__actions"},[(0,m.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,m.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 Pe=require("@deepseek-ai/dsh-client-ui-primitives");function ka(e){return/\.(?:md|markdown)$/i.test(e)}function Fn(e){return/\.(?:html?|xhtml)$/i.test(e)}function eo(e){return ka(e)||Fn(e)}var to=256*1024,no=5e3,wa=5e3,pn=20,xa=12,ro=600,ao=6e4,un=new Map;function io(e,t){let n=t.file.kind==="loading"?{kind:"idle"}:t.file;un.set(e,{state:{...t,file:n},leftAt:Date.now()})}function oo(e){let t=un.get(e);return t===void 0?null:Date.now()-t.leftAt>ao?(un.delete(e),null):t.state}function Bn({remote:e,sessionId:t,compact:n,worktreeGen:a,t:r}){let i=(0,b.useRef)(void 0);i.current===void 0&&(i.current=oo(t));let o=i.current,[s,l]=(0,b.useState)(()=>o?.dirs??new Map),[d,p]=(0,b.useState)(()=>o?.open??new Set([""])),[u,g]=(0,b.useState)(()=>o?.selected??null),[w,k]=(0,b.useState)(()=>o?.file??{kind:"idle"}),[_,S]=(0,b.useState)(()=>o?.renderMarkdown??!0),[R,$]=(0,b.useState)("idle"),[q,A]=(0,b.useState)("idle"),[T,E]=(0,b.useState)(()=>o?.pane??"tree"),J=(0,b.useMemo)(()=>({code:{copyLabel:r("files.copy"),copiedLabel:r("files.copied")},footnotes:r("files.footnotes")}),[r]),O=(0,b.useRef)(0),V=dt({storageKey:"gp.files.left",initial:300,min:180,reserve:220,edge:"end"}),j=(0,b.useCallback)(f=>{l(x=>{let P=x.get(f);if(P!==void 0&&P.status!=="error")return x;let z=new Map(x);return z.set(f,{status:"loading"}),z}),e.query({sessionId:t,query:{kind:"dir-list",path:f}}).then(x=>{let P=me(x,"dir-list");l(z=>{let C=new Map(z);return C.set(f,P===null?{status:"error"}:{status:"ready",entries:P.entries,truncated:P.truncated}),C})}).catch(()=>{l(x=>{let P=new Map(x);return P.set(f,{status:"error"}),P})})},[e,t]);(0,b.useEffect)(()=>{j("")},[j]);let N=(0,b.useRef)(a);(0,b.useEffect)(()=>{N.current!==a&&(N.current=a,un.delete(t),l(new Map),p(new Set([""])),g(null),k({kind:"idle"}),E("tree"),j(""))},[a,t,j]);let Z=(0,b.useCallback)(f=>{p(x=>{let P=new Set(x);return P.has(f)?(P.delete(f),P):(P.add(f),s.get(f)===void 0&&j(f),P)})},[s,j]),ie=(0,b.useCallback)(f=>{g(f),n&&E("preview"),S(!Fn(f)),$("idle"),A("idle");let x=++O.current;k({kind:"loading",path:f}),e.query({sessionId:t,query:{kind:"file-content",path:f}}).then(P=>{if(x!==O.current)return;let z=me(P,"file-content");if(z===null){k({kind:"error",path:f});return}if(z.tooLarge===!0){k({kind:"tooLarge",path:f});return}if(z.variant==="image"&&z.dataUrl!==void 0){k({kind:"image",path:f,dataUrl:z.dataUrl});return}if(z.variant==="text"){k({kind:"text",path:f,content:z.content??"",lines:z.lines??0});return}k({kind:"binary",path:f})}).catch(()=>{x===O.current&&k({kind:"error",path:f})})},[e,t,n]),oe=(0,b.useRef)({dirs:s,open:d,selected:u,file:w,renderMarkdown:_,pane:T});oe.current={dirs:s,open:d,selected:u,file:w,renderMarkdown:_,pane:T},(0,b.useEffect)(()=>()=>{io(t,oe.current)},[t]);let W=(0,b.useRef)(!1);(0,b.useEffect)(()=>{W.current||(W.current=!0,o!==null&&o.selected!==null&&w.kind==="idle"&&ie(o.selected))},[o,w.kind,ie]);let de=(0,b.useMemo)(()=>_a("",0,{dirs:s,open:d,selected:u,toggleDir:Z,selectFile:ie,t:r}),[s,d,u,Z,ie,r]),se=async()=>{if(u===null)return;let f=O.current,x=await(0,Pe.writeClipboard)(u);f===O.current&&$(x?"copied":"error")},he=async()=>{if(w.kind!=="text")return;let f=O.current,x=await(0,Pe.writeClipboard)(w.content);f===O.current&&A(x?"copied":"error")},fe=(0,b.createElement)("div",{key:"left",className:"gp-files__tree",style:n?void 0:{flex:`0 0 ${V.width}px`}},de),Y=(0,b.createElement)("div",{key:"right",className:"gp-files__preview"},[u!==null?(0,b.createElement)("div",{key:"bar",className:"gp-files__bar"},[n?(0,b.createElement)("button",{key:"back",type:"button",className:"gp-subhead__back",onClick:()=>E("tree")},[(0,b.createElement)(yt,{key:"i",size:14}),r("files.backToTree")]):null,(0,b.createElement)("code",{key:"path",className:"gp-files__path",title:u},u),w.kind==="text"&&eo(w.path)?(0,b.createElement)("div",{key:"mode",className:"gp-files__mode",role:"group","aria-label":r("files.previewMode")},[(0,b.createElement)("button",{key:"source",type:"button",className:`gp-files__mode-btn${_?"":" gp-files__mode-btn--active"}`,"aria-pressed":!_,onClick:()=>S(!1)},r("files.source")),(0,b.createElement)("button",{key:"render",type:"button",className:`gp-files__mode-btn${_?" gp-files__mode-btn--active":""}`,"aria-pressed":_,onClick:()=>S(!0)},r("files.render"))]):null,(0,b.createElement)("button",{key:"copy",type:"button",className:`gp-files__copy-path${R==="error"?" gp-files__copy-path--error":""}`,"aria-live":"polite",onClick:()=>{se()}},r(R==="copied"?"files.pathCopied":R==="error"?"files.pathCopyFailed":"files.copyPath")),w.kind==="text"?(0,b.createElement)("button",{key:"copy-content",type:"button",className:`gp-files__copy-path${q==="error"?" gp-files__copy-path--error":""}`,"aria-live":"polite",onClick:()=>{he()}},r(q==="copied"?"files.contentCopied":q==="error"?"files.contentCopyFailed":"files.copyContent")):null]):null,(0,b.createElement)("div",{key:"content",className:"gp-files__preview-content"},so(w,_,J,r))]);return n?(0,b.createElement)("div",{className:"gp-files gp-files--compact"},T==="preview"?Y:fe):(0,b.createElement)("div",{className:"gp-files"},[fe,V.divider,Y])}function so(e,t,n,a){return e.kind==="text"&&t&&ka(e.path)?(0,b.createElement)("div",{className:"gp-files__markdown"},(0,b.createElement)(Pe.MarkdownText,{text:e.content,labels:n,variant:"body"})):e.kind==="text"&&t&&Fn(e.path)?(0,b.createElement)("iframe",{className:"gp-files__html",title:e.path,srcDoc:e.content,sandbox:"allow-scripts",referrerPolicy:"no-referrer"}):lo(e,a)}function _a(e,t,n){let a=n.dirs.get(e);if(a===void 0||a.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(a.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 i of a.entries){let o=e===""?i.name:`${e}/${i.name}`;if(i.dir){let s=n.open.has(o);r.push((0,b.createElement)("button",{key:o,type:"button",className:`gp-tree-row gp-files__entry gp-files__entry--dir${i.ignored?" gp-tree-row--ignored":""}`,style:{paddingLeft:10+t*14},"aria-expanded":s,"aria-label":i.ignored?`${i.name} (${n.t("files.ignored")})`:i.name,onClick:()=>n.toggleDir(o)},[(0,b.createElement)("span",{key:"c",className:"gp-tree-chev"},(0,b.createElement)(et,{size:11,open:s})),(0,b.createElement)("span",{key:"i",className:"gp-tree-ic"},(0,b.createElement)(Pe.FileTypeIcon,{kind:"folder",size:18})),(0,b.createElement)("span",{key:"n",className:"gp-tree-name"},i.name)])),s&&r.push(..._a(o,t+1,n))}else{let s=n.selected===o;r.push((0,b.createElement)("button",{key:o,type:"button",className:`gp-tree-row gp-files__entry${s?" gp-tree-row--active":""}${i.ignored?" gp-tree-row--ignored":""}`,style:{paddingLeft:10+t*14},"aria-current":s?"true":void 0,"aria-label":i.ignored?`${i.name} (${n.t("files.ignored")})`:i.name,onClick:()=>n.selectFile(o)},[(0,b.createElement)("span",{key:"c",className:"gp-tree-chev"}),(0,b.createElement)("span",{key:"i",className:"gp-tree-ic"},(0,b.createElement)(Pe.FileTypeIcon,{path:o,size:18})),(0,b.createElement)("span",{key:"n",className:"gp-tree-name"},i.name)]))}}return a.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 lo(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)(At,{src:e.dataUrl,alt:e.path,t,viewportClass:"gp-files__image"});case"text":return(0,b.createElement)(po,{content:e.content,path:e.path,t})}}function co(e,t){if(t==="")return[];let n=[];for(let a=0;a<e.length;a++)for(let[r,i]of Yt(e[a],t))if(n.push({line:a,start:r,end:i}),n.length>=Ut)return n;return n}function po({content:e,path:t,t:n}){let a=(0,b.useMemo)(()=>{let C=e.split(`
|
|
630
|
-
`);return
|
|
631
|
-
`)),[r,o,a]),[l,d]=(0,b.useState)(!1),[p,u]=(0,b.useState)(""),[g,w]=(0,b.useState)(!1),[k,_]=(0,b.useState)(0),{setEl:S,viewport:R,elRef:$}=kt(),q=(0,b.useRef)(null),A=(0,b.useRef)(null);(0,b.useEffect)(()=>{d(!1),u(""),_(0)},[t]);let T=Qt(p,jt),E=(0,b.useMemo)(()=>a.map(C=>C.toLowerCase()),[a]),J=g?T:T.toLowerCase(),O=g?a:E,V=(0,b.useMemo)(()=>co(O,J),[O,J]);(0,b.useEffect)(()=>{_(0)},[J]);let j=V.length===0?0:Math.min(k,V.length-1),N=(0,b.useMemo)(()=>{let C=new Map;for(let X of V){let te=C.get(X.line)??[];te.push([X.start,X.end]),C.set(X.line,te)}return C},[V]);(0,b.useEffect)(()=>{let C=X=>{if(!((X.ctrlKey||X.metaKey)&&(X.key==="f"||X.key==="F")))return;let te=$.current;te===null||te.offsetParent===null||(X.preventDefault(),d(!0),requestAnimationFrame(()=>q.current?.select()))};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[]);let Z=a.length,ie=(0,b.useMemo)(()=>wt(new Array(Z).fill(pn)),[Z]),oe=R.height>0?R.height:ro,{first:W,last:de}=xt(ie,R.top,oe,xa*pn),se=V.length>0?V[j].line:-1,{first:he,last:fe}=qt({first:W,last:de},se,Z,xa);(0,b.useEffect)(()=>{if(se<0)return;let C=requestAnimationFrame(()=>A.current?.scrollIntoView({block:"center",inline:"nearest"}));return()=>cancelAnimationFrame(C)},[j,V,se]);let Y=(0,b.useCallback)(C=>{_(X=>V.length===0?0:(X+C+V.length)%V.length)},[V.length]),f=V.length>0?V[j]:null,x=l?(0,b.createElement)(en,{inputRef:q,query:p,matches:V.length,active:j,caseSensitive:g,onChange:u,onToggleCase:()=>w(C=>!C),onStep:Y,onClose:()=>d(!1),t:n}):null,P=r||l?(0,b.createElement)("div",{key:"hd",className:"gp-files__header"},[r?(0,b.createElement)("div",{key:"note",className:"gp-files__note"},n("files.highlightOff")):null,x]):null,z=[];for(let C=he;C<fe;C++)z.push((0,b.createElement)("div",{key:C,className:"gp-files__row",style:{top:C*pn}},[(0,b.createElement)("div",{key:"n",className:"gp-diff-no"},C+1),uo(a[C],C,s?.[C],N.get(C),f,A,n)]));return(0,b.createElement)("div",{className:"gp-files__code gp-diff__scroll",ref:S},[P,(0,b.createElement)("div",{key:"grid",className:"gp-files__single gp-files__single--virt",style:{height:Z*pn}},z)])}function uo(e,t,n,a,r,i,o){if(e==="")return(0,b.createElement)("div",{key:`c${t}`,className:"gp-diff-cell"},"\xA0");if(e.length>wa)return(0,b.createElement)("div",{key:`c${t}`,className:"gp-diff-cell"},[e.slice(0,wa),(0,b.createElement)("span",{key:"trunc",className:"gp-files__trunc"},o("files.lineTruncated"))]);if(a===void 0||a.length===0)return(0,b.createElement)("div",{key:`c${t}`,className:"gp-diff-cell"},n!==void 0?n.map((l,d)=>(0,b.createElement)("span",{key:d,style:l.style},l.text)):e);let s=r!==null&&r.line===t?[r.start,r.end]:null;return(0,b.createElement)("div",{key:`c${t}`,className:"gp-diff-cell"},Zt(e,a,n,`c${t}`,s,i))}var gn=require("react"),go=620;function Sa(e){let[t,n]=(0,gn.useState)(!1);return(0,gn.useLayoutEffect)(()=>{if(e===null||typeof ResizeObserver>"u")return;let a=()=>n(e.clientWidth>0&&e.clientWidth<=go);a();let r=new ResizeObserver(a);return r.observe(e),()=>r.disconnect()},[e]),t}var Ca="gp.panel.fontDelta";function fo(){if(typeof localStorage>"u")return 0;let e=Number(localStorage.getItem(Ca));return e===-1||e===1?e:0}function Ta({ctx:e,sessionId:t,t:n}){let[a,r]=(0,L.useState)(fo),[i,o]=(0,L.useState)(null),[s,l]=(0,L.useState)(null),d=Sa(s),p=$t(t),u=Mt(e),g=p.state==="error"&&p.error.code==="git-unavailable",w=p.state==="error"&&(p.error.code==="not-a-git-repo"||p.error.code==="git-unavailable"),k=g&&p.state==="error"&&p.error.isGitRepo===!0,_=w?"files":i!==null&&i.sessionId===t?i.tab:null,S=(0,L.useRef)({tabs:new Set});S.current.sessionId!==t&&(S.current={sessionId:t,tabs:new Set}),_!==null&&S.current.tabs.add(_);let R=S.current.tabs.has("files");(0,L.useEffect)(()=>{if(!Ze(t))return;if(w){o(null);return}if(i?.sessionId===t)return;let N=lr(t);if(N!==null){o({sessionId:t,tab:N});return}let Z=pr(t);if(Z!==null){o({sessionId:t,tab:Z});return}p.state==="ready"&&o({sessionId:t,tab:p.snapshot.dirty?"changes":"overview"})},[t,p,w,i?.sessionId]),(0,L.useEffect)(()=>{if(Ze(t))return dr(t,N=>o({sessionId:t,tab:N}))},[t]);let $=(0,L.useRef)({tab:null});$.current={sessionId:t,tab:_},(0,L.useEffect)(()=>()=>{let{sessionId:N,tab:Z}=$.current;N!==void 0&&Z!==null&&cr(N,Z)},[]);let q=p.state==="ready"?p.snapshot.checkedAt:0,[A,T]=(0,L.useState)(0),E=async N=>{if(!Ze(t))return{ok:!1,error:n("error.noCwd")};let Z=await u.run({sessionId:t,action:N});return Z.ok?(Rt(t).accept(Z.snapshot),N.kind==="branch-checkout"&&T(ie=>ie+1),{ok:!0}):(N.kind==="branch-checkout"&&N.stashMessage!==void 0&&T(ie=>ie+1),Rt(t).resync(),{ok:!1,error:zt(Z.error.code,Z.error.message,n)})},J=N=>{r(N),typeof localStorage<"u"&&localStorage.setItem(Ca,String(N))},O=[{key:"overview",label:n("tab.overview"),icon:(0,L.createElement)(Xt,{size:14})},{key:"changes",label:n("tab.changes"),icon:(0,L.createElement)(mr,{size:14})},{key:"files",label:n("tab.files"),icon:(0,L.createElement)(xr,{size:14})}],V=w?O.filter(N=>N.key==="files"):O,j=(()=>{if(!Ze(t))return(0,L.createElement)("div",{className:"gp-empty"},n("error.noCwd"));if(p.state==="no-cwd")return(0,L.createElement)("div",{className:"gp-empty"},n("error.noCwd"));if(w){let Z=R?(0,L.createElement)(Bn,{key:t,remote:u,sessionId:t,compact:d,worktreeGen:A,t:n}):null;return k?(0,L.createElement)("div",{className:"gp-files-wrap"},[(0,L.createElement)("div",{key:"notice",className:"gp-notice"},n("files.gitNotInstalled")),Z]):(0,L.createElement)("div",{style:{display:"contents"}},Z)}if(p.state==="error")return(0,L.createElement)("div",{className:"gp-empty"},n("pill.unavailable"));if(p.state==="cold"||p.state==="loading"||_===null)return(0,L.createElement)("div",{className:"gp-empty"},n("common.loading"));let N=p.snapshot;return(0,L.createElement)("div",{style:{display:"contents"}},[S.current.tabs.has("overview")?(0,L.createElement)("div",{key:"overview",style:_==="overview"?{display:"contents"}:{display:"none"}},(0,L.createElement)(ma,{key:t,remote:u,sessionId:t,refreshKey:q,defaultDiffView:N.defaultDiffView,snapshot:N,onAction:E,onResync:()=>Rt(t).resync(),compact:d,t:n})):null,S.current.tabs.has("changes")?(0,L.createElement)("div",{key:"changes",style:_==="changes"?{display:"contents"}:{display:"none"}},(0,L.createElement)(va,{key:t,remote:u,sessionId:t,snapshot:N,onAction:E,compact:d,t:n})):null,R?(0,L.createElement)("div",{key:"files",style:_==="files"?{display:"contents"}:{display:"none"}},(0,L.createElement)(Bn,{key:t,remote:u,sessionId:t,compact:d,worktreeGen:A,t:n})):null])})();return(0,L.createElement)("div",{className:"gp-panel",ref:l,"data-conversation-composer-overlay":"","data-font-delta":a,"data-layout":d?"compact":"wide"},[(0,L.createElement)("div",{key:"tabs",className:"gp-tabbar",role:"tablist"},[...V.map(N=>(0,L.createElement)("button",{key:N.key,type:"button",role:"tab","aria-selected":_===N.key,className:`gp-tab${_===N.key?" gp-tab--active":""}`,onClick:()=>{Ze(t)&&o({sessionId:t,tab:N.key})}},[(0,L.createElement)("span",{key:"i",className:"gp-tab__icon"},N.icon),(0,L.createElement)("span",{key:"l",className:"gp-tab__label"},N.label)])),(0,L.createElement)("div",{key:"trailing",className:"gp-tabbar__trailing"},[(0,L.createElement)("div",{key:"font",className:"gp-font"},[(0,L.createElement)("button",{key:"dec",type:"button",className:"gp-font__decrease",onClick:()=>J(-1),"aria-label":n("panel.fontDecrease")},"A\u2212"),(0,L.createElement)("button",{key:"reset",type:"button",className:"gp-font__reset",onClick:()=>J(0),"aria-label":n("panel.fontReset")},"A"),(0,L.createElement)("button",{key:"inc",type:"button",className:"gp-font__increase",onClick:()=>J(1),"aria-label":n("panel.fontIncrease")},"A+")]),(0,L.createElement)(mo,{key:"ver",remote:u,t:n})])]),(0,L.createElement)("div",{key:"body",className:"gp-body"},j)])}function mo({remote:e,t}){let[n,a]=(0,L.useState)({kind:"idle"}),{tipProps:r,tipNode:i}=ln({placement:"below",maxWidth:300});(0,L.useEffect)(()=>{let d=!0;return e.version({}).then(p=>{d&&"current"in p&&a(u=>({...u,info:p}))}),()=>{d=!1}},[e]);let o=async()=>{a(p=>({kind:"checking",info:p.info}));let d=await e.version({check:!0});a({kind:"idle",info:"current"in d?d:void 0})},s=n.info,l=n.kind==="checking"?(0,L.createElement)("span",{className:"gp-verbar__status"},t("version.checking")):s===void 0||!s.checkedRemote?null:s.error!==void 0?(0,L.createElement)("span",{className:"gp-verbar__status gp-verbar__status--err",title:s.error},s.error==="repository is not configured"?t("version.noRepo"):t("version.error")):s.updateAvailable&&s.latest!==void 0?(0,L.createElement)("span",{},[(0,L.createElement)("span",{key:"s",className:"gp-verbar__status gp-verbar__status--new"},t("version.updateAvailable",{latest:s.latest,current:s.current})),s.releaseUrl!==void 0?(0,L.createElement)("a",{key:"l",className:"gp-verbar__link",href:s.releaseUrl,target:"_blank",rel:"noreferrer",style:{marginLeft:8}},t("version.viewRelease")):null]):(0,L.createElement)("span",{className:"gp-verbar__status gp-verbar__status--ok"},t("version.upToDate",{current:s.current}));return(0,L.createElement)("div",{className:"gp-verbar"},[s!==void 0?(0,L.createElement)("span",{key:"tag",className:"gp-verbar__tag"},`v${s.current}`):null,l,(0,L.createElement)("button",{key:"btn",type:"button",className:"gp-verbar__btn",disabled:n.kind==="checking",onClick:()=>void o()},[(0,L.createElement)("span",{key:"i",className:"gp-tab__icon"},(0,L.createElement)(Kt,{size:12})),t("version.check")]),s?.repositoryUrl!==void 0?(0,L.createElement)("a",{key:"gh",className:"gp-icon-btn gp-verbar__gh gp-verbar__gh--starred",href:s.repositoryUrl,target:"_blank",rel:"noreferrer","aria-label":t("version.openRepo"),...r(t("version.openRepo"))},(0,L.createElement)(Cr,{size:15})):null,i])}var ue=require("react"),Ra=require("react-dom");var Na="data-gp-tab-dot",Nt,In=null,Ea="",mn=null,fn;function ho(e){if(typeof document>"u")return null;let t=document.querySelectorAll(Pt);for(let n of t)if((n.textContent??"").trim()===e)return n;return null}function On(){let e=ho(Ea);if(e===null)return;let t=e.querySelector(`[${Na}]`);if(mn===null){t?.remove();return}let n=`gp-tab-dot gp-tab-dot--${mn}`;if(t!==null){t.className!==n&&(t.className=n);return}let a=document.createElement("span");a.className=n,a.setAttribute(Na,""),a.setAttribute("aria-hidden","true"),e.appendChild(a)}function yo(){if(typeof document>"u"||typeof MutationObserver>"u")return;let e=document.querySelector(or);if(e!==In){if(Nt?.disconnect(),In=e,e===null){Nt=void 0;return}Nt=new MutationObserver(()=>On()),Nt.observe(e,{childList:!0,subtree:!0})}}function bo(){Nt?.disconnect(),Nt=void 0,In=null}function Ma(e,t,n){if(!(typeof document>"u")){if(n===null){$n(e);return}fn=e,Ea=t,mn=n,yo(),On()}}function $n(e){fn!==void 0&&fn!==e||(fn=void 0,mn=null,On(),bo())}function vo(e){let t=e.replace(/[/\\]+$/,"").split(/[/\\]/);return t[t.length-1]||e}function wo(){let[e,t]=(0,ue.useState)(!1),[n,a]=(0,ue.useState)(null),r=(0,ue.useRef)(null);return(0,ue.useLayoutEffect)(()=>{if(!e||r.current===null){a(null);return}let s=r.current.getBoundingClientRect();a({left:s.left,bottom:window.innerHeight-s.top+8})},[e]),{bind:{ref:s=>{r.current=s},onMouseEnter:()=>t(!0),onMouseLeave:()=>t(!1)},render:s=>!e||n===null||typeof document>"u"?null:(0,Ra.createPortal)((0,ue.createElement)("div",{className:"gp-tip",style:{left:n.left,bottom:n.bottom}},s.map((l,d)=>(0,ue.createElement)("div",{key:d,className:d===0?"gp-tip__path":"gp-tip__note"},l))),document.body)}}function xo(e){let[t,n]=(0,ue.useState)(!1);return(0,ue.useEffect)(()=>{if(e===null||typeof ResizeObserver>"u")return;let r=e.closest("[data-conversation-region]")??document.body,i=()=>n(r.clientWidth>0&&r.clientWidth<ko);i();let o=new ResizeObserver(i);return o.observe(r),()=>o.disconnect()},[e]),t}var ko=620;function Ga({sessionId:e,t}){let n=$t(e),a=wo(),[r,i]=(0,ue.useState)(null),o=xo(r),s=(0,ue.useRef)(Symbol("gp-tab-dot")),l=n.state==="ready"&&n.snapshot.showInputPill===!1?n.snapshot.dirty?"dirty":"synced":null,d=t("panel.tab");if((0,ue.useEffect)(()=>{Ma(s.current,d,l);let S=s.current;return()=>{$n(S)}},[d,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.code==="git-unavailable"||n.error.showInputPill===!1?null:(0,ue.createElement)("span",{className:"gp-pill gp-pill--degraded",title:n.error.detail??t("pill.unavailable")},t("pill.unavailable"));let p=n.snapshot;if(p.showInputPill===!1)return null;let u=vo(p.root),g=p.branch??`(${t("pill.detached")})`,w=p.dirty,k=w?"gp-pill--dirty":"gp-pill--synced",_=()=>{if(gr(d)){fr(d);return}Ze(e)&&sr(e,w?"changes":"overview"),ur(d)};return(0,ue.createElement)("span",{className:"gp-pill-wrap",ref:i},[(0,ue.createElement)("button",{key:"btn",type:"button",className:`gp-pill ${k}${o?" gp-pill--compact":""}`,onClick:_,ref:a.bind.ref,onMouseEnter:a.bind.onMouseEnter,onMouseLeave:a.bind.onMouseLeave},[(0,ue.createElement)("span",{key:"dot",className:"gp-pill__dot","aria-hidden":"true"}),(0,ue.createElement)("span",{key:"repo",className:"gp-pill__repo"},u),(0,ue.createElement)("span",{key:"git",className:"gp-pill__git"},["(",(0,ue.createElement)("span",{key:"b",className:"gp-pill__branch"},g),")"])]),a.render([p.root,t(w?"pill.dirty":"pill.synced")])])}var F=require("react");function _o(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}}var hn={min:Me.maxBytes.min/1024,max:Me.maxBytes.max/1024},yn={min:Me.timeoutMs.min/1e3,max:Me.timeoutMs.max/1e3};function Xn(e,t){return Math.min(t.max,Math.max(t.min,Math.floor(e)))}function So(e){let t=e.trim();if(t==="")return null;let n=Number(t);return Number.isFinite(n)?n:null}function Da({ctx:e,t}){let[,n]=(0,F.useState)(0),[a,r]=(0,F.useState)(!1),[i,o]=(0,F.useState)(!1),[s,l]=(0,F.useState)(null),[d,p]=(0,F.useState)(null),[u,g]=(0,F.useState)(null),[w,k]=(0,F.useState)(null),[_,S]=(0,F.useState)(null),[R,$]=(0,F.useState)(null),[q,A]=(0,F.useState)(null),T=()=>{n(G=>G+1)},E=e.get("configForms"),J=(0,F.useMemo)(()=>E?.describe(),[E]);(0,F.useEffect)(()=>{if(J!==void 0)return J.ensure(),J.subscribe(T)},[J]);let O=J?.getSnapshot().view,V=(0,F.useMemo)(()=>O===void 0?void 0:_o(O.namespaces),[O]),j=(0,F.useMemo)(()=>E!==void 0&&V!==void 0?E.get(V):void 0,[E,V]);(0,F.useEffect)(()=>{if(j!==void 0)return j.subscribe(T)},[j]);let N=j?.getSnapshot(),Z=j!==void 0&&N!==void 0&&N.status==="ready",ie=J?.getSnapshot().status,oe=s??(typeof N?.value?.showInputPill=="boolean"?N.value.showInputPill:!0),W=d??(N?.value?.defaultDiffView==="split"?"split":"unified"),de=u??(N?.value?.graphStyle==="compact"?"compact":"parallel"),se=w??(typeof N?.value?.suggestEnabled=="boolean"?N.value.suggestEnabled:!0),he=Xn(typeof N?.value?.suggestMaxBytes=="number"?N.value.suggestMaxBytes/1024:Me.maxBytes.default/1024,hn),fe=Xn(typeof N?.value?.suggestMaxOutputTokens=="number"?N.value.suggestMaxOutputTokens:Me.maxOutputTokens.default,Me.maxOutputTokens),Y=Xn(typeof N?.value?.suggestTimeoutMs=="number"?N.value.suggestTimeoutMs/1e3:Me.timeoutMs.default/1e3,yn),f=async(G,ve,Fe)=>{if(j!==void 0){o(!1),r(!0);try{let Ce=await j.set(G,ve);Fe(),Ce?(Gt(),setTimeout(()=>Gt(),1e3)):o(!0)}catch{Fe(),o(!0)}finally{r(!1)}}},x=G=>(l(G),f("showInputPill",G,()=>l(null))),P=G=>G===W?Promise.resolve():(p(G),f("defaultDiffView",G,()=>p(null))),z=G=>G===de?Promise.resolve():(g(G),f("graphStyle",G,()=>g(null))),C=G=>(k(G),f("suggestEnabled",G,()=>k(null))),X=(G,ve,Fe,Ce,De,Le)=>{let Ae=G===null?null:So(G);if(Ae===null)return Le(),Promise.resolve();let Be=Math.min(ve.max,Math.max(ve.min,Math.floor(Ae)));return De(String(Be)),f(Ce,Be*Fe,Le)},te=G=>X(G,hn,1024,"suggestMaxBytes",S,()=>S(null)),ee=G=>X(G,Me.maxOutputTokens,1,"suggestMaxOutputTokens",$,()=>$(null)),xe=G=>X(G,yn,1e3,"suggestTimeoutMs",A,()=>A(null));return E===void 0?(0,F.createElement)("p",{className:"gp-cfg__hint"},t("cfg.notLoaded")):Z?(0,F.createElement)("div",{className:"gp-cfg"},[(0,F.createElement)("h3",{key:"title",className:"gp-cfg__title"},t("cfg.title")),(0,F.createElement)("label",{key:"row",className:"gp-cfg__row"},[(0,F.createElement)("input",{key:"switch",type:"checkbox",role:"switch",className:"gp-cfg__switch",checked:oe,disabled:a||N?.writable===!1,onChange:G=>{x(G.currentTarget.checked)}}),(0,F.createElement)("span",{key:"text",className:"gp-cfg__text"},t("cfg.toggle"))]),(0,F.createElement)("p",{key:"hint",className:"gp-cfg__hint"},t("cfg.hint")),(0,F.createElement)("h3",{key:"difftitle",className:"gp-cfg__title",style:{marginTop:6}},t("cfg.diffTitle")),(0,F.createElement)("div",{key:"diffseg",className:"gp-seg gp-cfg__seg"},ct(["unified","split"],W,G=>{P(G)},G=>t(G==="unified"?"cfg.diffUnified":"cfg.diffSplit"),a||N?.writable===!1)),(0,F.createElement)("p",{key:"diffhint",className:"gp-cfg__hint"},t("cfg.diffHint")),(0,F.createElement)("h3",{key:"graphtitle",className:"gp-cfg__title",style:{marginTop:6}},t("cfg.graphTitle")),(0,F.createElement)("div",{key:"graphseg",className:"gp-seg gp-cfg__seg"},ct(["parallel","compact"],de,G=>{z(G)},G=>t(G==="parallel"?"cfg.graphParallel":"cfg.graphCompact"),a||N?.writable===!1)),(0,F.createElement)("p",{key:"graphhint",className:"gp-cfg__hint"},t("cfg.graphHint")),(0,F.createElement)("div",{key:"suggestcard",className:"gp-cfg__card"},[(0,F.createElement)("h3",{key:"sgtitle",className:"gp-cfg__card-title"},t("cfg.suggestTitle")),(0,F.createElement)("label",{key:"sgrow",className:"gp-cfg__row"},[(0,F.createElement)("input",{key:"switch",type:"checkbox",role:"switch",className:"gp-cfg__switch",checked:se,disabled:a||N?.writable===!1,onChange:G=>{C(G.currentTarget.checked)}}),(0,F.createElement)("span",{key:"text",className:"gp-cfg__text"},t("cfg.suggestToggle"))]),(0,F.createElement)("div",{key:"numax",className:"gp-cfg__numrow"},[(0,F.createElement)("label",{key:"lab",className:"gp-cfg__numlabel",htmlFor:"gp-cfg-maxkib"},t("cfg.suggestMaxBytesLabel")),(0,F.createElement)("input",{key:"input",id:"gp-cfg-maxkib",type:"number",className:"gp-cfg__numinput",inputMode:"numeric",min:hn.min,max:hn.max,"aria-describedby":"gp-cfg-maxkib-hint",value:_??String(he),disabled:a||N?.writable===!1,onChange:G=>{S(G.currentTarget.value)},onBlur:()=>{te(_)},onKeyDown:G=>{G.key==="Enter"&&G.currentTarget.blur()}}),(0,F.createElement)("span",{key:"unit",className:"gp-cfg__numunit"},t("cfg.suggestMaxBytesUnit"))]),(0,F.createElement)("p",{key:"numaxhint",id:"gp-cfg-maxkib-hint",className:"gp-cfg__rangehint"},t("cfg.suggestMaxBytesHint")),(0,F.createElement)("div",{key:"nuout",className:"gp-cfg__numrow"},[(0,F.createElement)("label",{key:"lab",className:"gp-cfg__numlabel",htmlFor:"gp-cfg-outtok"},t("cfg.suggestOutputLabel")),(0,F.createElement)("input",{key:"input",id:"gp-cfg-outtok",type:"number",className:"gp-cfg__numinput",inputMode:"numeric",min:Me.maxOutputTokens.min,max:Me.maxOutputTokens.max,"aria-describedby":"gp-cfg-outtok-hint",value:R??String(fe),disabled:a||N?.writable===!1,onChange:G=>{$(G.currentTarget.value)},onBlur:()=>{ee(R)},onKeyDown:G=>{G.key==="Enter"&&G.currentTarget.blur()}}),(0,F.createElement)("span",{key:"unit",className:"gp-cfg__numunit"},t("cfg.suggestOutputUnit"))]),(0,F.createElement)("p",{key:"nuouthint",id:"gp-cfg-outtok-hint",className:"gp-cfg__rangehint"},t("cfg.suggestOutputHint")),(0,F.createElement)("div",{key:"nuto",className:"gp-cfg__numrow"},[(0,F.createElement)("label",{key:"lab",className:"gp-cfg__numlabel",htmlFor:"gp-cfg-timeout"},t("cfg.suggestTimeoutLabel")),(0,F.createElement)("input",{key:"input",id:"gp-cfg-timeout",type:"number",className:"gp-cfg__numinput",inputMode:"numeric",min:yn.min,max:yn.max,"aria-describedby":"gp-cfg-timeout-hint",value:q??String(Y),disabled:a||N?.writable===!1,onChange:G=>{A(G.currentTarget.value)},onBlur:()=>{xe(q)},onKeyDown:G=>{G.key==="Enter"&&G.currentTarget.blur()}}),(0,F.createElement)("span",{key:"unit",className:"gp-cfg__numunit"},t("cfg.suggestTimeoutUnit"))]),(0,F.createElement)("p",{key:"nutohint",id:"gp-cfg-timeout-hint",className:"gp-cfg__rangehint"},t("cfg.suggestTimeoutHint")),(0,F.createElement)("p",{key:"sghint",className:"gp-cfg__hint"},t("cfg.suggestHint"))]),i?(0,F.createElement)("p",{key:"error",className:"gp-cfg__err",role:"alert"},t("cfg.saveFailed")):null]):ie==="idle"||ie==="loading"?(0,F.createElement)("p",{className:"gp-cfg__hint"},t("common.loading")):(0,F.createElement)("p",{className:"gp-cfg__hint"},t("cfg.notLoaded"))}var Ht="gitPanel",Co=["dsh-git-panel","@xbzbing/dsh-git-panel"],To=["slots","locale","connection"],No="dsh-git-panel";function Eo(e){Zn(),ar(e),e.effect(()=>e.locale.register(Ht,{zh:er,en:tr})??void 0,"dsh-git-panel: dictionaries");let t=e.locale.bind(Ht),n=[],a=r=>{typeof r=="function"&&n.push(r)};a(e.slots.inject("conversation.view",()=>e.slots.register({name:"conversation.view",id:"git-panel",order:30,locale:Ht,label:()=>t("panel.tab")},r=>(0,bn.createElement)(Ta,{ctx:e,sessionId:r.sessionId,t})))),a(e.slots.inject("conversation.input.left",()=>e.slots.register({name:"conversation.input.left",id:"git-panel-pill",order:100,locale:Ht},r=>(0,bn.createElement)(Ga,{sessionId:r.sessionId,t}))));for(let r of Co)a(e.slots.inject("plugins.bundle.config",()=>e.slots.register({name:"plugins.bundle.config",key:r,locale:Ht},i=>i.view==="summary"?t("cfg.title"):(0,bn.createElement)(Da,{ctx:e,t}))));e.effect(()=>{let r=e.on("connection/reset",()=>Gt());return()=>{typeof r=="function"&&r();for(let i of n.splice(0))try{i()}catch{}ir()}},"dsh-git-panel: lifecycle")}module.exports={name:No,inject:To,apply:Eo};
|
|
674
|
+
${l("ops.dirtyWarn")}`:""),confirmLabel:l("revert.confirm"),danger:!1,error:se,confirmBusy:de,onConfirm:()=>void Wa(),onClose:()=>z(null),t:l}):null,W!==null?ma(W,{from:a.head??W.shortHash,dirty:a.dirty,lostFiles:nr,lostTotal:nr.length,lostTruncated:a.truncated,busy:de,error:se,onReset:qa,onClose:()=>O(null),t:l}):null,T?Ke({title:l("status.pullConfirmTitle"),body:l("status.pullConfirmBody",{branch:a.branch??"HEAD",behind:a.behind}),extra:xa(lt,l),confirmLabel:l("status.pullConfirm"),danger:!1,error:se,confirmBusy:ee,busyLabel:l("status.pulling"),onConfirm:()=>void Ya(),onClose:()=>j(!1),t:l}):null,G?Ke({title:l("status.pushConfirmTitle"),body:l("status.pushConfirmBody",{branch:a.branch??"HEAD",ahead:a.ahead}),extra:ka(De,l),confirmLabel:l("status.pushConfirm"),danger:!1,error:se,confirmBusy:Y,busyLabel:l("status.pushing"),onConfirm:()=>void Za(),onClose:()=>B(!1),t:l}):null,Se?Ke({title:l("status.publishConfirmTitle"),body:l("status.publishConfirmBody",{branch:a.branch??"HEAD",remote:a.remote?.name??"origin"}),confirmLabel:l("status.publishConfirm"),danger:!1,error:se,confirmBusy:P,busyLabel:l("status.publishing"),onConfirm:()=>void ei(),onClose:()=>_e(!1),t:l}):null,xe!==null?ha(xe,{from:a.branch,dirty:a.dirty?Math.max(1,a.stats.fileCount):0,busy:Ve,error:se,onConfirm:y=>void ja(y),onClose:()=>$e(null),t:l}):null],ar=(0,c.createElement)("div",{key:"mid",className:"gp-col gp-col--mid gp-history"},[(0,c.createElement)("div",{key:"tb",className:"gp-toolbar",ref:b},[s?(0,c.createElement)("button",{key:"filter",type:"button",className:`gp-btn${d.ref!==null?" gp-btn--primary":""}`,title:l("overview.filterBranch"),onClick:()=>Me(!0)},[(0,c.createElement)(_r,{key:"ic",size:13}),d.ref??l("overview.filterBranch")]):null,(0,c.createElement)("input",{key:"search",className:"gp-search",placeholder:l(_||s?"overview.searchShort":"overview.search"),value:u,onChange:y=>g(y.target.value)}),(0,c.createElement)("select",{key:"author",className:"gp-select",value:d.author,onChange:y=>p(V=>({...V,author:y.target.value}))},[(0,c.createElement)("option",{key:"",value:""},l("overview.allUsers")),...qe.map(y=>(0,c.createElement)("option",{key:y,value:y},y))]),(0,c.createElement)("select",{key:"since",className:"gp-select",value:d.since,onChange:y=>p(V=>({...V,since:y.target.value}))},[(0,c.createElement)("option",{key:"",value:""},l("overview.allTime")),(0,c.createElement)("option",{key:"today",value:"1 day ago"},l("overview.today")),(0,c.createElement)("option",{key:"7d",value:"7 days ago"},l("overview.last7d")),(0,c.createElement)("option",{key:"30d",value:"30 days ago"},l("overview.last30d"))]),(0,c.createElement)("button",{key:"fetch",type:"button",className:"gp-icon-btn",title:l("overview.fetch"),onClick:()=>{e.run({sessionId:t,action:{kind:"fetch"}}).then(()=>Ge())}},(0,c.createElement)(jt,{size:14}))]),(0,c.createElement)("div",{key:"list",className:"gp-history__list",ref:Ye,onScroll:te},Ie.length===0?(0,c.createElement)("div",{className:"gp-empty"},l(Lt?"common.loading":je?"overview.loadFailed":"overview.noResults")):Je.map(y=>no(y,{selected:E?.hash===y.commit.hash,gridTpl:ct,graphW:dt,laneCount:bt,searching:Ce,now:h,compact:s,rowH:Ze,onSelect:()=>$(y.commit),onHoverEnter:ne.onHoverEnter,onHoverLeave:ne.onHoverLeave,t:l})))]),ir=E===null?[(0,c.createElement)("div",{key:"empty",className:"gp-empty"},[(0,c.createElement)(qt,{key:"i",size:20}),l("overview.selectCommit")])]:[(0,c.createElement)("div",{key:"files",className:"gp-detail__files"},ne.detail===null?(0,c.createElement)("div",{className:"gp-empty"},ne.detailError?l("overview.detailFailed"):l("common.loading")):[ne.detail.stats.length>0?(0,c.createElement)("div",{key:"sum",className:"gp-detail__summary"},[(0,c.createElement)("span",{key:"f"},l("overview.changeSummary",{files:ne.detail.stats.length})),(0,c.createElement)("span",{key:"sep",className:"gp-detail__summary-sep"},"\xB7"),(0,c.createElement)("span",{key:"a",className:"gp-stats__add"},`+${ne.detail.insertions}`),(0,c.createElement)("span",{key:"d",className:"gp-stats__del"},`\u2212${ne.detail.deletions}`)]):null,ao(L,{activePath:ne.fileDiff?.path??null,openTitle:l("overview.openFileDiff"),onOpen:y=>{E!==null&&ne.openFileDiff(y,E.hash,E.shortHash)},collapsed:We,onToggleDir:Ka,expandLabel:l("overview.expandDir"),collapseLabel:l("overview.collapseDir")})]),(0,c.createElement)("div",{key:"msg",className:"gp-detail__msg"},[(0,c.createElement)("div",{key:"subj",className:"gp-detail__subject"},E.subject),(0,c.createElement)("div",{key:"meta",className:"gp-detail__meta"},[(0,c.createElement)("span",{key:"h",className:"gp-commit-hash"},E.shortHash),(0,c.createElement)("span",{key:"a"},E.author),(0,c.createElement)("span",{key:"t"},Bt(E.dateIso))]),(0,c.createElement)("div",{key:"ops",className:"gp-detail__ops"},(()=>{let y=E.refs.filter(V=>V.kind==="tag");return[y.length>0?(0,c.createElement)("div",{key:"tags",className:"gp-detail__tags"},y.map(V=>(0,c.createElement)("span",{key:`tag-${V.name}`,className:"gp-ref-chip gp-ref-chip--tag gp-ref-chip--del",title:V.name},[(0,c.createElement)(wt,{key:"i",size:11}),(0,c.createElement)("span",{key:"n",className:"gp-detail__tagname"},V.name),(0,c.createElement)("button",{key:"x",type:"button",className:"gp-ref-chip__x",title:l("tag.deleteOne",{name:V.name}),onClick:()=>{q(null),K(V.name)}},(0,c.createElement)(nt,{size:11}))]))):null,(0,c.createElement)("div",{key:"actions",className:"gp-detail__actions"},[(0,c.createElement)("button",{key:"revert",type:"button",className:"gp-btn gp-btn--sm",title:l("overview.revert"),onClick:()=>{q(null),z({hash:E.hash,shortHash:E.shortHash,subject:E.subject})}},[(0,c.createElement)(Nr,{key:"i",size:12}),l("overview.revert")]),(0,c.createElement)("button",{key:"reset",type:"button",className:"gp-btn gp-btn--sm",title:l("overview.reset"),onClick:()=>{q(null),o(),O({hash:E.hash,shortHash:E.shortHash,subject:E.subject})}},[(0,c.createElement)(Qt,{key:"i",size:12}),l("overview.reset")]),(0,c.createElement)("button",{key:"addtag",type:"button",className:"gp-btn gp-btn--sm",title:l("overview.createTag"),onClick:()=>{q(null),Q({hash:E.hash,shortHash:E.shortHash})}},[(0,c.createElement)(wt,{key:"i",size:12}),l("overview.createTag")])])]})()),ne.detail!==null&&ne.detail.body!==""?(0,c.createElement)("pre",{key:"body",className:"gp-detail__body"},ne.detail.body):(0,c.createElement)("div",{key:"nb",className:"gp-empty"},l("overview.noMessage"))])];return s?(0,c.createElement)("div",{className:"gp-overview gp-overview--compact"},[tr,...rr,Ee==="detail"?(0,c.createElement)("div",{key:"detail",className:"gp-col gp-col--mid gp-detail"},[(0,c.createElement)("div",{key:"back",className:"gp-subhead"},[(0,c.createElement)("button",{key:"b",type:"button",className:"gp-subhead__back",onClick:()=>ze("list")},[(0,c.createElement)(xt,{key:"i",size:14}),l("overview.backToList")]),E!==null?(0,c.createElement)("span",{key:"h",className:"gp-subhead__title gp-commit-hash"},E.shortHash):null]),...ir]):ar,Bn(a,er),Ae?to(Te,Xe,d.ref,k,{onFilter:y=>{Zn(y),Me(!1)},switchOptions:ke,onSwitch:y=>{Me(!1),ht(y)},onToggle:y=>M(V=>{let ce=new Set(V);return ce.has(y)?ce.delete(y):ce.add(y),ce}),onRetry:Ge,onClose:()=>Me(!1),t:l}):null]):(0,c.createElement)("div",{className:"gp-overview"},[tr,...rr,(0,c.createElement)("div",{key:"left",className:"gp-col gp-col--left",style:{flex:`0 0 ${Qn.width}px`}},[(0,c.createElement)("div",{key:"scroll",className:"gp-col-left__scroll"},Ca(Te,Xe,d.ref,k,{onFilter:y=>Zn(y),switchOptions:ke,onSwitch:ht,onToggle:y=>M(V=>{let ce=new Set(V);return ce.has(y)?ce.delete(y):ce.add(y),ce}),onRetry:Ge,t:l})),Bn(a,er)]),Qn.divider,ar,Yn.divider,(0,c.createElement)("div",{key:"right",className:"gp-col gp-col--right gp-detail",style:{flex:`0 0 ${Yn.width}px`}},ir),eo(ne.hover,ne.hoverBody,l)])}function eo(e,t,n){if(e===null||typeof document>"u")return null;let r=460,a=Math.min(e.x+16,(typeof window<"u"?window.innerWidth:1200)-r-12),i=e.y+14,o=(0,c.createElement)("div",{className:"gp-hovercard",style:{left:a,top:i,maxWidth:r}},[(0,c.createElement)("div",{key:"subj",className:"gp-hovercard__subject"},e.commit.subject),(0,c.createElement)("div",{key:"meta",className:"gp-hovercard__meta"},[(0,c.createElement)("span",{key:"h",className:"gp-commit-hash"},e.commit.shortHash),(0,c.createElement)("span",{key:"a"},e.commit.author),(0,c.createElement)("span",{key:"t"},Bt(e.commit.dateIso))]),t===null?(0,c.createElement)("div",{key:"l",className:"gp-hovercard__loading"},n("common.loading")):t===""?(0,c.createElement)("div",{key:"e",className:"gp-hovercard__loading"},n("overview.noMessage")):(0,c.createElement)("pre",{key:"body",className:"gp-hovercard__body"},t)]);return(0,hn.createPortal)(o,document.body,"commit-hovercard")}function Ca(e,t,n,r,a){if(t)return(0,c.createElement)("div",{className:"gp-empty"},[(0,c.createElement)("span",{key:"m"},a.t("overview.branchesError")),(0,c.createElement)("button",{key:"r",type:"button",className:"gp-btn",style:{marginTop:8},onClick:a.onRetry},a.t("common.retry"))]);if(e===null)return(0,c.createElement)("div",{className:"gp-empty"},a.t("common.loading"));let i=(o,s,l,d,p="")=>(0,c.createElement)("div",{key:o,className:"gp-branch-group"},[(0,c.createElement)("div",{key:"head",className:"gp-branch-group__head",onClick:()=>a.onToggle(o)},[(0,c.createElement)(tt,{key:"c",size:11,open:!r.has(o)}),`${a.t(s)} (${l.length})`]),r.has(o)?null:l.map(u=>{let g=p+u.name,S=e.current===u.name,b=`gp-branch-row${n===g?" gp-branch-row--active":""}${S?" gp-branch-row--current":""}`,_=a.switchOptions.get(`${o}:${u.name}`);return(0,c.createElement)("div",{key:u.name,className:b,title:u.name,onClick:()=>a.onFilter(n===g?null:g)},[(0,c.createElement)("span",{key:"i",style:{display:"inline-flex",width:14}},d),(0,c.createElement)("span",{key:"n",className:"gp-tree-name"},u.name),u.ahead||u.behind?(0,c.createElement)("span",{key:"t",className:"gp-branch-row__track"},`${u.ahead?`\u2191${u.ahead}`:""}${u.behind?`\u2193${u.behind}`:""}`):null,_===void 0?null:(0,c.createElement)("button",{key:"sw",type:"button",className:"gp-branch-row__switch",title:a.t(_.createFrom===void 0?"switch.rowTitle":"switch.rowTitleTrack",{name:_.name,ref:_.label}),onClick:k=>{k.stopPropagation(),a.onSwitch(_)}},a.t("switch.action"))])})]);return(0,c.createElement)("div",{},[(0,c.createElement)("div",{key:"head-row",className:"gp-branch-row",style:{fontWeight:600,justifyContent:"center",padding:"4px 10px"},onClick:()=>a.onFilter(null)},a.t("overview.head")),i("local","overview.local",e.local,(0,c.createElement)(Gn,{size:13})),i("remote","overview.remote",e.remote,(0,c.createElement)(Gn,{size:13})),i("tags","overview.tags",e.tags,(0,c.createElement)(wt,{size:13}))])}function to(e,t,n,r,a){if(typeof document>"u")return null;let i=(0,c.createElement)("div",{className:"gp-sheet-backdrop",onClick:o=>{o.target===o.currentTarget&&a.onClose()}},(0,c.createElement)("div",{className:"gp-sheet",role:"dialog","aria-modal":!0},[(0,c.createElement)("div",{key:"bar",className:"gp-sheet__bar"},[(0,c.createElement)("span",{key:"title",className:"gp-sheet__title"},a.t("overview.filterBranch")),(0,c.createElement)("button",{key:"close",type:"button",className:"gp-icon-btn gp-sheet__close",title:a.t("common.close"),onClick:a.onClose},(0,c.createElement)(nt,{size:15}))]),(0,c.createElement)("div",{key:"body",className:"gp-sheet__body"},Ca(e,t,n,r,a))]));return(0,hn.createPortal)(i,document.body,"branch-filter-sheet")}function no(e,t){let n=e.commit,r=n.refs.map(i=>(0,c.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)),a=(0,c.createElement)("div",{key:"g",className:"gp-graph-cell"},t.searching?null:ro(e,t.laneCount,t.rowH));return t.compact?(0,c.createElement)("div",{key:n.hash,className:`gp-commit-row gp-commit-row--compact${t.selected?" gp-commit-row--active":""}`,style:{gridTemplateColumns:t.gridTpl,height:`${t.rowH}px`},onClick:t.onSelect},[a,(0,c.createElement)("div",{key:"tx",className:"gp-commit-lines"},[(0,c.createElement)("div",{key:"s",className:"gp-commit-subject"},[...r,n.subject]),(0,c.createElement)("div",{key:"m",className:"gp-commit-sub"},[(0,c.createElement)("span",{key:"h",className:"gp-commit-hash"},n.shortHash),(0,c.createElement)("span",{key:"a",className:"gp-commit-author"},n.author),(0,c.createElement)("span",{key:"d",className:"gp-commit-date"},rt(n.dateIso,t.now,t.t))])])]):(0,c.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},[a,(0,c.createElement)("div",{key:"s",className:"gp-commit-subject"},[...r,n.subject]),(0,c.createElement)("div",{key:"h",className:"gp-commit-hash"},n.shortHash),(0,c.createElement)("div",{key:"a",className:"gp-commit-author"},n.author),(0,c.createElement)("div",{key:"d",className:"gp-commit-date",title:Ft(n.dateIso)},rt(n.dateIso,t.now,t.t))])}var mn=["#4e9bff","#3fb950","#e0982e","#d05ce3","#e5534b","#2dc6c6","#d29922","#8b949e"];function ro(e,t,n=_a){let r=Math.max(Mt,t*Mt),a=s=>s*Mt+Mt/2,i=n/2,o=[];for(let s of e.edges){let l=mn[s.color%mn.length],d=s.kind==="out"?i:0,p=s.kind==="into"?i:n,u=(d+p)/2;o.push((0,c.createElement)("path",{key:`e${s.kind}-${s.fromLane}-${s.toLane}-${s.color}`,d:`M ${a(s.fromLane)} ${d} C ${a(s.fromLane)} ${u}, ${a(s.toLane)} ${u}, ${a(s.toLane)} ${p}`,stroke:l,strokeWidth:1.6,fill:"none"}))}return o.push((0,c.createElement)("circle",{key:"node",cx:a(e.lane),cy:i,r:e.merge?4:3.2,fill:mn[e.color%mn.length],stroke:"var(--dsw-alias-bg-layer-1)",strokeWidth:1})),(0,c.createElement)("svg",{className:"gp-graph-svg",width:r,height:n},o)}function ao(e,t){let n=[],r=(a,i)=>{for(let o of a)if(o.dir){let s=t.collapsed.has(o.path);n.push((0,c.createElement)("div",{key:o.path,className:"gp-tree-row gp-tree-row--dir",style:{paddingLeft:10+i*14},title:s?t.expandLabel:t.collapseLabel,role:"button",tabIndex:0,"aria-expanded":!s,onClick:()=>t.onToggleDir(o.path),onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),t.onToggleDir(o.path))}},[(0,c.createElement)(tt,{key:"c",size:11,open:!s}),(0,c.createElement)("span",{key:"n",className:"gp-tree-name"},o.name)])),s||r(o.children,i+1)}else{let s=String(o.meta??"modified"),l=t.activePath===o.path;n.push((0,c.createElement)("div",{key:o.path,className:`gp-tree-row${l?" gp-tree-row--active":""}`,style:{paddingLeft:10+i*14},title:t.openTitle,onClick:()=>t.onOpen(o.path)},[(0,c.createElement)("span",{key:"st",className:`gp-status-badge ${kt(s)}`},(Yt[s]??s[0]??"M").toUpperCase()),(0,c.createElement)("span",{key:"n",className:"gp-tree-name"},o.name)]))}};return r(e,0),(0,c.createElement)("div",{},n)}function io(e,t){if(e===null||typeof document>"u")return null;let{data:n,error:r,mode:a,onMode:i,expanded:o,onExpand:s,onClose:l,remote:d,sessionId:p,compact:u,t:g}=t,S=u?["unified","before","after"]:["unified","split","before","after"],b=u&&a==="split"?"unified":a,_=n!==null&&n.text!==""?(()=>{let R=gn(n.text);return(0,c.createElement)("span",{key:"sum",className:"gp-modal__sum"},[(0,c.createElement)("span",{key:"a",className:"gp-stats__add"},`+${R.add}`),(0,c.createElement)("span",{key:"d",className:"gp-stats__del"},`\u2212${R.del}`)])})():null,k=(0,c.createElement)("button",{key:"expand",type:"button",className:`gp-seg__btn gp-diff__expand${o?" gp-seg__btn--active":""}`,disabled:b!=="split"&&b!=="unified",title:g(o?"diff.collapse":"diff.expandAll"),onClick:()=>s(!o)},g(o?"diff.collapse":"diff.expandAll")),M=(0,c.createElement)("div",{key:"seg",className:"gp-seg"},it(S,b,i,R=>g(`diff.${R}`))),D=(0,c.createElement)("button",{key:"close",type:"button",className:"gp-icon-btn gp-modal__close",title:g("common.close"),onClick:l},(0,c.createElement)(nt,{size:15})),J=[(0,c.createElement)("span",{key:"fileicon",className:"gp-modal__fileicon"},(0,c.createElement)(Cr,{size:15})),(0,c.createElement)("span",{key:"path",className:"gp-modal__path",title:e.path},oo(e.path)),(0,c.createElement)("span",{key:"hash",className:"gp-modal__hash"},e.shortHash),_,k],F=u?[(0,c.createElement)("div",{key:"brow1",className:"gp-modal__bar-row"},J),(0,c.createElement)("div",{key:"brow2",className:"gp-modal__bar-row gp-modal__bar-row--controls"},[M,D])]:[...J,M,D],C=(0,c.createElement)("div",{className:"gp-modal-backdrop",onClick:R=>{R.target===R.currentTarget&&l()}},(0,c.createElement)("div",{className:"gp-modal",role:"dialog","aria-modal":!0},[(0,c.createElement)("div",{key:"bar",className:"gp-modal__bar"},F),(0,c.createElement)("div",{key:"scroll",className:"gp-modal__scroll"},n===null?(0,c.createElement)("div",{className:"gp-empty"},g(r?"overview.diffFailed":"common.loading")):(0,c.createElement)(un,{key:"diff",text:n.text,mode:b,path:e.path,remote:d,sessionId:p,base:"commit",commit:e.hash,expanded:o,truncated:n.truncated===!0,newLines:n.newLines,t:g}))]));return(0,hn.createPortal)(C,document.body,"file-diff-modal")}function oo(e){let t=e.lastIndexOf("/");return t<0?[(0,c.createElement)("span",{key:"n",className:"gp-modal__name"},e)]:[(0,c.createElement)("span",{key:"d",className:"gp-modal__dir"},e.slice(0,t+1)),(0,c.createElement)("span",{key:"n",className:"gp-modal__name"},e.slice(t+1))]}var f=require("react");var Pe=require("react");function Ta({stats:e,t}){let n=Date.now(),r=[(0,Pe.createElement)("span",{key:"files",className:"gp-stats__item"},t("stats.files",{n:e.fileCount})),(0,Pe.createElement)("span",{key:"lines",className:"gp-stats__item"},[(0,Pe.createElement)("span",{key:"a",className:"gp-stats__add"},`+${e.insertions}`)," ",(0,Pe.createElement)("span",{key:"d",className:"gp-stats__del"},`\u2212${e.deletions}`)])];e.staged>0&&r.push((0,Pe.createElement)("span",{key:"st",className:"gp-stats__item"},t("stats.staged",{n:e.staged}))),e.modified>0&&r.push((0,Pe.createElement)("span",{key:"mo",className:"gp-stats__item"},t("stats.modified",{n:e.modified}))),e.untracked>0&&r.push((0,Pe.createElement)("span",{key:"un",className:"gp-stats__item"},t("stats.untracked",{n:e.untracked}))),e.partial&&r.push((0,Pe.createElement)("span",{key:"partial",className:"gp-stats__item gp-stats__partial",title:t("stats.partialHint")},t("stats.partial")));let a=[];return e.lastChangeAt!==null&&a.push((0,Pe.createElement)("span",{key:"lc",className:"gp-stats__item",title:Ft(e.lastChangeAt)},t("stats.lastChange",{time:rt(e.lastChangeAt,n,t)}))),e.headCommittedAt!==null&&a.push((0,Pe.createElement)("span",{key:"hc",className:"gp-stats__item",title:Ft(e.headCommittedAt)},t("stats.lastCommit",{time:rt(e.headCommittedAt,n,t)}))),a.length>0&&r.push((0,Pe.createElement)("span",{key:"times",className:"gp-stats__times"},a)),(0,Pe.createElement)("div",{className:"gp-stats"},r)}var On=28,Na=26,so=8,lo=600;function Ea({remote:e,sessionId:t,snapshot:n,onAction:r,compact:a,t:i}){let[o,s]=(0,f.useState)(new Set),[l,d]=(0,f.useState)(""),[p,u]=(0,f.useState)(!1),[g,S]=(0,f.useState)(!1),[b,_]=(0,f.useState)(null),[k,M]=(0,f.useState)(new Set),[D,J]=(0,f.useState)(null),[F,C]=(0,f.useState)(null),[R,Q]=(0,f.useState)(null),[U,K]=(0,f.useState)(()=>n.defaultDiffView),[ae,z]=(0,f.useState)(!1),[W,O]=(0,f.useState)(!1),[se,q]=(0,f.useState)(!1),[de,le]=(0,f.useState)(!1),[he,be]=(0,f.useState)(null),[ee,w]=(0,f.useState)("list"),[T,j]=(0,f.useState)([]),[Y,m]=(0,f.useState)(!0),[G,B]=(0,f.useState)(!1),[P,ue]=(0,f.useState)(null),Se=(0,f.useRef)(null),_e=(0,f.useRef)(0),{setEl:lt,viewport:Fe}=Tt(),De=(0,f.useCallback)(async()=>{let h=await e.query({sessionId:t,query:{kind:"stash-list"}}),L=ye(h,"stash-list");j(L?.entries??[])},[e,t]);(0,f.useEffect)(()=>{De()},[De,n.checkedAt]);let N=(0,f.useMemo)(()=>n.changes.filter(h=>h.staged).sort($n),[n]),Ee=(0,f.useMemo)(()=>n.changes.filter(h=>!h.staged&&h.status!=="untracked").sort($n),[n]),ze=(0,f.useMemo)(()=>n.changes.filter(h=>h.status==="untracked").sort($n),[n]),$e=[{key:"staged",labelKey:"changes.groupStaged",items:N},{key:"unstaged",labelKey:"changes.groupUnstaged",items:Ee},{key:"untracked",labelKey:"changes.groupUntracked",items:ze}].filter(h=>h.items.length>0),{items:Ve,tops:Be,totalH:Ae}=(0,f.useMemo)(()=>{let h=[];for(let E of $e)if(h.push({kind:"head",g:{key:E.key,labelKey:E.labelKey,count:E.items.length}}),!k.has(E.key))for(let re of E.items)h.push({kind:"row",c:re});let L=St(h.map(E=>E.kind==="head"?Na:On));return{items:h,tops:L,totalH:L[h.length]}},[N,Ee,ze,k]),Me=Fe.height>0?Fe.height:lo,{first:Te,last:Xe}=Ct(Be,Fe.top,Me,so*On);(0,f.useEffect)(()=>{s(h=>{if(h.size===0)return h;let L=new Set(n.changes.map(pe=>pe.path+(pe.staged?":s":":w"))),E=new Set,re=!1;for(let pe of h)L.has(pe)?E.add(pe):re=!0;return re?E:h})},[n]),(0,f.useEffect)(()=>{if(!p||W||l.trim()!=="")return;let h=!0;return e.query({sessionId:t,query:{kind:"last-commit-message"}}).then(L=>{let E=ye(L,"last-commit-message");h&&E!==null&&(d(E.message),O(!0))}),()=>{h=!1}},[p,W,l,e,t]);let qe=(0,f.useCallback)(async(h,L,E=!1,re=!1)=>{let pe=++_e.current;C({path:h,base:L}),re||Q(null),z(E);let we=await e.query({sessionId:t,query:{kind:"diff",path:h,base:L,...E?{context:2e3}:{}}});if(pe!==_e.current)return;let We=ye(we,"diff");Q(We!==null?{text:We.text,newLines:We.newLines,truncated:We.truncated}:{text:"",newLines:0})},[e,t]);(0,f.useEffect)(()=>{if(F===null)return;if(!n.changes.some(L=>L.path===F.path)){C(null),Q(null),w("list");return}qe(F.path,F.base,ae,!0)},[n]),(0,f.useEffect)(()=>{J(null)},[n]),(0,f.useEffect)(()=>{le(!1)},[n]);let Ge=h=>{s(L=>{let E=new Set(L);return E.has(h)?E.delete(h):E.add(h),E})},ke=async h=>{if(g)return!1;S(!0),_(null),be(null);try{let L=await r(h);return L.ok?!0:(_(L.error??i("error.generic")),!1)}catch(L){return _(L instanceof Error?L.message:i("error.generic")),!1}finally{S(!1)}},ht=async()=>{let h=l.trim();if(h===""&&!p){_(i("error.emptyMessage"));return}let L=o.size>0?[...new Set([...o].map(re=>re.replace(/:[sw]$/,"")))]:void 0;await ke({kind:"commit",message:h,...L?{paths:L}:{},...p?{amend:!0}:{}})&&(d(""),s(new Set),u(!1),O(!1))},ne=async h=>{await ke({kind:"stash-push",...h.trim()!==""?{message:h}:{}})&&(B(!1),De())},Ie=(h,L)=>{ke({kind:"stash-apply",index:h,sha:L}).then(E=>{E&&De()})},Lt=(h,L)=>{ke({kind:"stash-pop",index:h,sha:L}).then(E=>{E&&De()})},je=async(h,L)=>{await ke({kind:"stash-drop",index:h,sha:L})&&(ue(null),De())},Qe=(h,L)=>{switch(h){case"empty-diff":return i("error.emptyDiff");case"llm-unavailable":return i("error.llmUnavailable");case"suggest-disabled":return i("error.suggestDisabled");case"llm-error":case"llm-output":return L===void 0?i("error.llmFailed"):`${i("error.llmFailed")}: ${L}`;default:return L??i("error.generic")}},Ye=async()=>{if(se)return;if(p&&!de&&l.trim()!==""){le(!0),_(null),be(i("commit.suggestOverwrite"));return}le(!1);let h=o.size>0?[...new Set([...o].map(L=>L.replace(/:[sw]$/,"")))]:void 0;q(!0),_(null),be(null);try{let L=await e.suggest({sessionId:t,...h&&h.length>0?{paths:h}:{}});L.ok?(d(L.value.message),L.value.truncated===!0&&be(i("commit.suggestTruncated")),Se.current?.focus()):_(Qe(L.error.code,L.error.message))}catch(L){_(L instanceof Error?L.message:i("error.generic"))}finally{q(!1)}},yt=h=>{M(L=>{let E=new Set(L);return E.has(h)?E.delete(h):E.add(h),E})},Ce=R!==null&&R.text!==""?gn(R.text):null,Je=mt({storageKey:"gp.changes.left",initial:380,min:220,reserve:200,edge:"end"}),bt=(h,L)=>{qe(h,L),a&&w("diff")},dt=a?["unified","before","after"]:["unified","split","before","after"],Ze=a&&U==="split"?"unified":U,ct=[(0,f.createElement)(Ta,{key:"stats",stats:n.stats,t:i}),(0,f.createElement)("div",{key:"toolbar",className:"gp-toolbar"},[(0,f.createElement)("button",{key:"sa",type:"button",className:"gp-btn",disabled:g||n.changes.length===0,onClick:()=>void ke({kind:"stage-all"})},i("changes.stageAll")),(0,f.createElement)("button",{key:"ua",type:"button",className:"gp-btn",disabled:g||n.staged===0,onClick:()=>void ke({kind:"unstage-all"})},i("changes.unstageAll")),(0,f.createElement)("button",{key:"stash",type:"button",className:"gp-btn",disabled:g||n.staged===0&&n.modified===0,title:i("changes.stash"),onClick:()=>{_(null),B(!0)}},[(0,f.createElement)(Rn,{key:"ic",size:13}),i("changes.stash")])]),b!==null?(0,f.createElement)("div",{key:"err",className:"gp-feedback"},b):null,he!==null?(0,f.createElement)("div",{key:"notice",className:"gp-notice"},he):null,(0,f.createElement)("div",{key:"list",className:"gp-changes__list",ref:lt},n.changes.length===0?(0,f.createElement)("div",{className:"gp-empty"},i("changes.noChanges")):(0,f.createElement)("div",{className:"gp-changes__vlist",style:{height:Ae}},Ve.slice(Te,Xe).map((h,L)=>{let E=Te+L;if(h.kind==="head"){let we=h.g;return(0,f.createElement)("div",{key:`h:${we.key}`,className:"gp-changes__vrow",style:{top:Be[E],height:Na}},(0,f.createElement)("div",{className:"gp-group-head",onClick:()=>yt(we.key)},[(0,f.createElement)(tt,{key:"chev",size:12,open:!k.has(we.key)}),`${i(we.labelKey)} (${we.count})`]))}let re=h.c,pe=re.path+(re.staged?":s":":w");return(0,f.createElement)("div",{key:pe,className:"gp-changes__vrow",style:{top:Be[E],height:On}},uo(re,{selected:o.has(pe),active:F?.path===re.path&&F.base===(re.staged?"staged":"worktree"),busy:g,armed:D===pe,onToggle:()=>Ge(pe),onOpen:()=>bt(re.path,re.staged?"staged":"worktree"),onStage:()=>void ke(re.staged?{kind:"unstage",paths:[re.path]}:{kind:"stage",paths:[re.path]}),onDiscard:()=>{D===pe?(ke({kind:"discard",paths:[re.path]}),J(null)):J(pe)},t:i}))}))),T.length>0?(0,f.createElement)("div",{key:"stashes",className:"gp-stash"},[(0,f.createElement)("div",{key:"head",className:"gp-group-head",onClick:()=>m(h=>!h)},[(0,f.createElement)(tt,{key:"chev",size:12,open:!Y}),`${i("stash.section")} (${T.length})`]),Y?null:(0,f.createElement)("div",{key:"items"},T.map(h=>po(h,{busy:g,onApply:()=>Ie(h.index,h.sha),onPop:()=>Lt(h.index,h.sha),onDrop:()=>{_(null),ue(h)},t:i})))]):null,(0,f.createElement)("div",{key:"box",className:"gp-commitbox"},[(0,f.createElement)("div",{key:"msg",className:`gp-commitbox__msg-wrap${se?" gp-commitbox__msg-wrap--busy":""}`},[(0,f.createElement)("textarea",{key:"ta",className:"gp-commitbox__msg",placeholder:i("commit.placeholder"),value:l,ref:Se,readOnly:se,"aria-busy":se,onChange:h=>d(h.target.value)}),se?(0,f.createElement)("span",{key:"spin",className:"gp-commitbox__spin","aria-hidden":"true"}):null]),(0,f.createElement)("div",{key:"row",className:"gp-commitbox__row"},[(0,f.createElement)("label",{key:"amend",className:"gp-commitbox__amend"},[(0,f.createElement)("input",{key:"cb",type:"checkbox",className:"gp-check",checked:p,disabled:se,onChange:()=>{u(h=>!h),O(!1)}}),i("commit.amend")]),(0,f.createElement)("div",{key:"actions",className:"gp-commitbox__actions"},[n.suggestEnabled!==!1?(0,f.createElement)("button",{key:"suggest",type:"button",className:"gp-btn",disabled:g||se||n.changes.length===0,onClick:()=>void Ye(),title:i("commit.suggest")},[(0,f.createElement)(Sr,{key:"ic",size:13}),i(se?"commit.suggesting":"commit.suggest")]):null,(0,f.createElement)("button",{key:"commit",type:"button",className:"gp-btn gp-btn--primary",disabled:g||se||l.trim()==="",onClick:()=>void ht()},i("commit.commit"))])])])],te=F===null?(0,f.createElement)("div",{className:"gp-empty"},i("changes.selectFile")):(0,f.createElement)("div",{className:"gp-diff"},[(0,f.createElement)("div",{key:"tb",className:`gp-diff__toolbar${a?" gp-diff__toolbar--compact":""}`},(()=>{let h=a?(0,f.createElement)("button",{key:"back",type:"button",className:"gp-subhead__back",onClick:()=>w("list")},[(0,f.createElement)(xt,{key:"i",size:14}),i("changes.backToList")]):null,L=(0,f.createElement)("span",{key:"path",className:"gp-diff__path"},F.path),E=Ce?(0,f.createElement)("span",{key:"sum",className:"gp-stats__item",style:{marginLeft:"auto"}},[(0,f.createElement)("span",{key:"a",className:"gp-stats__add"},`+${Ce.add}`)," ",(0,f.createElement)("span",{key:"d",className:"gp-stats__del"},`\u2212${Ce.del}`)]):null,re=(0,f.createElement)("button",{key:"expand",type:"button",className:`gp-seg__btn gp-diff__expand${ae?" gp-seg__btn--active":""}`,style:Ce||a?{}:{marginLeft:"auto"},disabled:Ze!=="split"&&Ze!=="unified",title:i(ae?"diff.collapse":"diff.expandAll"),onClick:()=>void qe(F.path,F.base,!ae)},i(ae?"diff.collapse":"diff.expandAll")),pe=(0,f.createElement)("div",{key:"seg",className:"gp-seg"},it(dt,Ze,K,we=>i(`diff.${we}`)));return a?[(0,f.createElement)("div",{key:"row1",className:"gp-diff__toolbar-row"},[h,L,E]),(0,f.createElement)("div",{key:"row2",className:"gp-diff__toolbar-row gp-diff__toolbar-row--controls"},[re,pe])]:[h,L,E,re,pe]})()),R===null?(0,f.createElement)("div",{key:"scroll",className:"gp-diff__scroll"},(0,f.createElement)("div",{className:"gp-empty"},i("common.loading"))):(0,f.createElement)(un,{key:"diff",text:R.text,mode:Ze,path:F.path,remote:e,sessionId:t,base:F.base,expanded:ae,truncated:R.truncated===!0,newLines:R.newLines,t:i})]),$=[G?(0,f.createElement)(co,{key:"push",onClose:()=>B(!1),onStash:ne,error:b,t:i}):null,P!==null?Ke({title:i("stash.dropTitle"),body:i("stash.dropConfirm",{name:P.message}),confirmLabel:i("stash.drop"),danger:!0,error:b,onConfirm:()=>void je(P.index,P.sha),onClose:()=>ue(null),t:i}):null];return a?(0,f.createElement)("div",{className:"gp-changes gp-changes--compact"},[...$,ee==="diff"?(0,f.createElement)("div",{key:"right",className:"gp-changes__right"},te):(0,f.createElement)("div",{key:"left",className:"gp-changes__left"},ct)]):(0,f.createElement)("div",{className:"gp-changes"},[...$,(0,f.createElement)("div",{key:"left",className:"gp-changes__left",style:{flex:`0 0 ${Je.width}px`}},ct),Je.divider,(0,f.createElement)("div",{key:"right",className:"gp-changes__right"},te)])}function co({onClose:e,onStash:t,error:n,t:r}){let[a,i]=(0,f.useState)("");return ot({onClose:e,title:r("stash.title"),icon:(0,f.createElement)(Rn,{size:15}),portalKey:"stash-push-modal",t:r,body:[(0,f.createElement)("input",{key:"msg",className:"gp-input",placeholder:r("stash.messagePlaceholder"),value:a,autoFocus:!0,onChange:o=>i(o.target.value),onKeyDown:o=>{o.key==="Enter"&&t(a)}}),Nt(r),n!==null?(0,f.createElement)("div",{key:"err",className:"gp-feedback"},n):null],footer:Et({onClose:e,onConfirm:()=>void t(a),confirmLabel:r("stash.save"),confirmDisabled:!1,danger:!1,t:r})})}function po(e,t){return(0,f.createElement)("div",{key:e.index,className:"gp-stash-row"},[(0,f.createElement)("div",{key:"info",className:"gp-stash-row__info"},[(0,f.createElement)("span",{key:"m",className:"gp-stash-row__msg",title:e.message},e.message),(0,f.createElement)("span",{key:"meta",className:"gp-stash-row__meta"},[e.branch!==null?(0,f.createElement)("span",{key:"b"},t.t("stash.onBranch",{branch:e.branch})):null,e.relTime!==""?(0,f.createElement)("span",{key:"t"},e.relTime):null])]),(0,f.createElement)("div",{key:"act",className:"gp-stash-row__actions"},[(0,f.createElement)("button",{key:"apply",type:"button",className:"gp-btn gp-btn--sm",disabled:t.busy,onClick:t.onApply},t.t("stash.apply")),(0,f.createElement)("button",{key:"pop",type:"button",className:"gp-btn gp-btn--sm",disabled:t.busy,onClick:t.onPop},t.t("stash.pop")),(0,f.createElement)("button",{key:"drop",type:"button",className:"gp-icon-btn",disabled:t.busy,title:t.t("stash.drop"),onClick:t.onDrop},(0,f.createElement)(Tr,{size:14}))])])}function $n(e,t){return e.path.localeCompare(t.path)}function uo(e,t){let n=e.path.split("/").pop()??e.path,r=e.path.includes("/")?e.path.slice(0,e.path.lastIndexOf("/")):"";return(0,f.createElement)("div",{key:e.path+(e.staged?":s":":w"),className:`gp-file-row${t.active?" gp-file-row--active":""}`,onClick:t.onOpen},[(0,f.createElement)("input",{key:"cb",type:"checkbox",className:"gp-check",checked:t.selected,onClick:a=>a.stopPropagation(),onChange:t.onToggle}),(0,f.createElement)("span",{key:"st",className:`gp-status-badge ${kt(e.status)}`},Yt[e.status]??"?"),(0,f.createElement)("span",{key:"nm",className:"gp-tree-name",title:e.path},[n,r?(0,f.createElement)("span",{key:"d",style:{color:"var(--dsw-alias-label-tertiary)",marginLeft:6,fontSize:11}},r):null]),(0,f.createElement)("span",{key:"act",className:"gp-file-row__actions"},[(0,f.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:a=>{a.stopPropagation(),t.onStage()}},e.staged?"\u2212":"+"),(0,f.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:a=>{a.stopPropagation(),t.onDiscard()}},"\u21BA")])])}var v=require("react");var He=require("@deepseek-ai/dsh-client-ui-primitives");var oe=require("react");function Xn(e){if(!Number.isFinite(e)||e<0)return"";if(e<1024)return`${e} B`;let t=["KB","MB","GB","TB"],n=e/1024,r=0;for(;(n>=1024||Number(n.toFixed(1))>=1024)&&r<t.length-1;)n/=1024,r++;return`${n.toFixed(1)} ${t[r]}`}var go={bash:"Bash",c:"C",cpp:"C++",csharp:"C#",css:"CSS",dockerfile:"Dockerfile",go:"Go",html:"HTML",java:"Java",javascript:"JavaScript",json:"JSON",jsx:"JSX",kotlin:"Kotlin",markdown:"Markdown",php:"PHP",python:"Python",ruby:"Ruby",rust:"Rust",scss:"SCSS",shellscript:"Shell",sql:"SQL",swift:"Swift",toml:"TOML",tsx:"TSX",typescript:"TypeScript",vue:"Vue",xml:"XML",yaml:"YAML"};function Ma(e){return go[e]??fo(e)}function fo(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Gt=require("@deepseek-ai/dsh-client-ui-primitives");function mo(e,t){let n=ho(e.path);if(e.kind==="binary")return t("files.propsTypeBinary");let r=It(e.path);if((e.kind==="image"||e.kind==="tooLarge")&&r!==null){let s=r.slice(6).toUpperCase();return t("files.propsTypeFmt",{label:t("files.propsTypeImage",{fmt:s}),ext:n})}let a=(0,Gt.languageForPath)(e.path),o=a!==void 0&&a!==""?Ma(a):e.kind==="tooLarge"?t("files.propsTypeUnread"):t("files.propsTypeText");return n===""?o:t("files.propsTypeFmt",{label:o,ext:n})}function ho(e){let t=e.slice(e.lastIndexOf("/")+1),n=t.lastIndexOf(".");return n>0?t.slice(n+1):""}function st(e,t,n){return{label:e,value:typeof t=="string"?(0,oe.createElement)("span",{},t):t,key:n}}function Jn(e,t,n){return(0,oe.createElement)("div",{key:n,className:"gp-props__group"},[e!==null?(0,oe.createElement)("div",{key:"t",className:"gp-props__group-title"},e):null,...t.map(r=>(0,oe.createElement)("div",{key:r.key,className:"gp-props__row"},[(0,oe.createElement)("span",{key:"l",className:"gp-props__label"},r.label),(0,oe.createElement)("span",{key:"v",className:"gp-props__value"},r.value)]))])}function Ga(e,t,n){return(0,oe.createElement)("button",{type:"button",className:"gp-props__copy",title:t,"aria-label":t,onClick:n},(0,oe.createElement)("code",{className:"gp-props__mono"},e))}function yo(e,t,n){let r=[],a=e.filter(i=>i.path===t&&!i.isDirectory);a.some(i=>i.staged)&&r.push((0,oe.createElement)("span",{key:"staged",className:"gp-props__badge gp-status--added"},n("files.propsStaged")));for(let i of a)i.staged||i.status==="untracked"||r.push((0,oe.createElement)("span",{key:i.status,className:`gp-props__badge ${kt(i.status)}`},bo(i.status,n)));return r}function bo(e,t){switch(e){case"added":return t("files.stAdded");case"modified":return t("files.stModified");case"deleted":return t("files.stDeleted");case"renamed":return t("files.stRenamed");case"untracked":return t("files.propsUntracked");case"conflicted":return t("files.stConflicted");case"typechange":return t("files.stTypechange")}}function Ra({input:e,snapshot:t,onClose:n,t:r}){let[a,i]=(0,oe.useState)(null);(0,oe.useEffect)(()=>{if(e.kind!=="image"||e.dataUrl===void 0)return;let D=!0,J=new Image;return J.onload=()=>{D&&i({w:J.naturalWidth,h:J.naturalHeight})},J.src=e.dataUrl,()=>{D=!1}},[e.kind,e.dataUrl]);let[o,s]=(0,oe.useState)(null),l=(0,oe.useRef)(void 0);(0,oe.useEffect)(()=>{s(null)},[e.path]),(0,oe.useEffect)(()=>()=>{l.current!==void 0&&clearTimeout(l.current)},[]);let d=D=>{(0,Gt.writeClipboard)(D).then(J=>{s(J?"copied":"error"),l.current!==void 0&&clearTimeout(l.current),l.current=setTimeout(()=>s(null),1600)})},p=e.path.lastIndexOf("/"),u=p<0?e.path:e.path.slice(p+1),g=[st(r("files.propsName"),(0,oe.createElement)("span",{className:"gp-props__strong"},u),"name"),st(r("files.propsType"),mo(e,r),"type"),st(r("files.propsRelPath"),Ga(e.path,r("files.propsCopyHint"),()=>d(e.path)),"rel")];if(t!==null){let D=`${t.root}/${e.path}`;g.push(st(r("files.propsAbsPath"),Ga(D,r("files.propsCopyHint"),()=>d(D)),"abs"))}let S=[];if(e.size!==void 0){let D=e.size>=1024?(0,oe.createElement)("span",{},[(0,oe.createElement)("span",{key:"h",className:"gp-props__strong"},Xn(e.size)),(0,oe.createElement)("span",{key:"b",className:"gp-props__sub"},r("files.propsSizeBytes",{bytes:e.size.toLocaleString("en-US")}))]):(0,oe.createElement)("span",{className:"gp-props__strong"},Xn(e.size));S.push(st(r("files.propsSize"),D,"size"))}e.kind==="text"&&e.lines!==void 0&&S.push(st(r("files.propsLines"),(0,oe.createElement)("span",{className:"gp-props__strong"},String(e.lines)),"lines")),a!==null&&S.push(st(r("files.propsImageSize"),(0,oe.createElement)("span",{className:"gp-props__strong"},r("files.propsImageSizeFmt",a)),"dims"));let b=[];e.mtimeMs!==void 0&&b.push(st(r("files.propsMtime"),(0,oe.createElement)("span",{title:rt(e.mtimeMs,Date.now(),r)},Bt(e.mtimeMs)),"mtime"));let _=[Jn(null,g,"g-basic"),S.length>0?Jn(r("files.propsGroupStats"),S,"g-stats"):null,b.length>0?Jn(r("files.propsGroupTime"),b,"g-time"):null],k=[];t!==null&&(k.push(e.ignored?(0,oe.createElement)("span",{key:"ig",className:"gp-props__badge gp-props__badge--muted"},r("files.ignored")):Br(t.changes,e.path)?(0,oe.createElement)("span",{key:"un",className:"gp-props__badge gp-props__badge--muted"},r("files.propsUntracked")):(0,oe.createElement)("span",{key:"tr",className:"gp-props__badge gp-props__badge--ok"},r("files.propsTrackedYes"))),k.push(...yo(t.changes,e.path,r)));let M=(0,oe.createElement)("div",{key:"status",className:"gp-modal__footer gp-props__statusbar","aria-live":"polite"},[k.length>0?(0,oe.createElement)("span",{key:"chips",className:"gp-props__footer-chips"},k):null,o!==null?(0,oe.createElement)("span",{key:"fb",className:`gp-props__copied${o==="error"?" gp-props__copied--err":""}`},r(o==="copied"?"files.pathCopied":"files.pathCopyFailed")):null]);return ot({onClose:n,title:r("files.propsTitle"),icon:(0,oe.createElement)(Gt.FileTypeIcon,{path:e.path,size:15}),body:_,footer:M,portalKey:"file-props",t:r})}function Da(e){return/\.(?:md|markdown)$/i.test(e)}function Kn(e){return/\.(?:html?|xhtml)$/i.test(e)}function vo(e){return Da(e)||Kn(e)}var wo=256*1024,xo=5e3,La=5e3,yn=20,Pa=12,ko=600,_o=6e4,bn=new Map;function So(e,t){let n=t.file.kind==="loading"?{kind:"idle"}:t.file;bn.set(e,{state:{...t,file:n},leftAt:Date.now()})}function Co(e){let t=bn.get(e);return t===void 0?null:Date.now()-t.leftAt>_o?(bn.delete(e),null):t.state}function Un({remote:e,sessionId:t,compact:n,worktreeGen:r,snapshot:a,t:i}){let o=(0,v.useRef)(void 0);o.current===void 0&&(o.current=Co(t));let s=o.current,[l,d]=(0,v.useState)(()=>s?.dirs??new Map),[p,u]=(0,v.useState)(()=>s?.open??new Set([""])),[g,S]=(0,v.useState)(()=>s?.selected??null),[b,_]=(0,v.useState)(()=>s?.file??{kind:"idle"}),[k,M]=(0,v.useState)(()=>s?.renderMarkdown??!0),[D,J]=(0,v.useState)("idle"),[F,C]=(0,v.useState)("idle"),[R,Q]=(0,v.useState)(!1),[U,K]=(0,v.useState)(()=>s?.pane??"tree"),ae=(0,v.useMemo)(()=>({code:{copyLabel:i("files.copy"),copiedLabel:i("files.copied")},footnotes:i("files.footnotes")}),[i]),z=(0,v.useRef)(0),W=mt({storageKey:"gp.files.left",initial:300,min:180,reserve:220,edge:"end"}),O=(0,v.useCallback)(m=>{d(G=>{let B=G.get(m);if(B!==void 0&&B.status!=="error")return G;let P=new Map(G);return P.set(m,{status:"loading"}),P}),e.query({sessionId:t,query:{kind:"dir-list",path:m}}).then(G=>{let B=ye(G,"dir-list");d(P=>{let ue=new Map(P);return ue.set(m,B===null?{status:"error"}:{status:"ready",entries:B.entries,truncated:B.truncated}),ue})}).catch(()=>{d(G=>{let B=new Map(G);return B.set(m,{status:"error"}),B})})},[e,t]);(0,v.useEffect)(()=>{O("")},[O]);let se=(0,v.useRef)(r);(0,v.useEffect)(()=>{se.current!==r&&(se.current=r,bn.delete(t),d(new Map),u(new Set([""])),S(null),_({kind:"idle"}),K("tree"),O(""))},[r,t,O]);let q=(0,v.useCallback)(m=>{u(G=>{let B=new Set(G);return B.has(m)?(B.delete(m),B):(B.add(m),l.get(m)===void 0&&O(m),B)})},[l,O]),de=(0,v.useCallback)(m=>{S(m),n&&K("preview"),M(!Kn(m)),J("idle"),C("idle"),Q(!1);let G=++z.current;_({kind:"loading",path:m}),e.query({sessionId:t,query:{kind:"file-content",path:m}}).then(B=>{if(G!==z.current)return;let P=ye(B,"file-content");if(P===null){_({kind:"error",path:m});return}let ue={...P.size!==void 0?{size:P.size}:{},...P.mtimeMs!==void 0?{mtimeMs:P.mtimeMs}:{}};if(P.tooLarge===!0){_({kind:"tooLarge",path:m,...ue});return}if(P.variant==="image"&&P.dataUrl!==void 0){_({kind:"image",path:m,dataUrl:P.dataUrl,...ue});return}if(P.variant==="text"){_({kind:"text",path:m,content:P.content??"",lines:P.lines??0,...ue});return}_({kind:"binary",path:m,...ue})}).catch(()=>{G===z.current&&_({kind:"error",path:m})})},[e,t,n]),le=(0,v.useRef)({dirs:l,open:p,selected:g,file:b,renderMarkdown:k,pane:U});le.current={dirs:l,open:p,selected:g,file:b,renderMarkdown:k,pane:U},(0,v.useEffect)(()=>()=>{So(t,le.current)},[t]);let he=(0,v.useRef)(!1);(0,v.useEffect)(()=>{he.current||(he.current=!0,s!==null&&s.selected!==null&&b.kind==="idle"&&de(s.selected))},[s,b.kind,de]);let be=(0,v.useMemo)(()=>za("",0,{dirs:l,open:p,selected:g,toggleDir:q,selectFile:de,t:i}),[l,p,g,q,de,i]),ee=async()=>{if(g===null)return;let m=z.current,G=await(0,He.writeClipboard)(g);m===z.current&&J(G?"copied":"error")},w=async()=>{if(b.kind!=="text")return;let m=z.current,G=await(0,He.writeClipboard)(b.content);m===z.current&&C(G?"copied":"error")},T=(()=>{if(g===null||b.kind!=="text"&&b.kind!=="image"&&b.kind!=="binary"&&b.kind!=="tooLarge")return null;let m=g.lastIndexOf("/"),G=m<0?"":g.slice(0,m),B=m<0?g:g.slice(m+1),P=l.get(G),ue=P?.status==="ready"?P.entries.find(Se=>!Se.dir&&Se.name===B):void 0;return{path:g,kind:b.kind,...b.size!==void 0?{size:b.size}:{},...b.mtimeMs!==void 0?{mtimeMs:b.mtimeMs}:{},...b.kind==="text"?{lines:b.lines}:{},...b.kind==="image"?{dataUrl:b.dataUrl}:{},ignored:ue?.ignored===!0}})(),j=(0,v.createElement)("div",{key:"left",className:"gp-files__tree",style:n?void 0:{flex:`0 0 ${W.width}px`}},be),Y=(0,v.createElement)("div",{key:"right",className:"gp-files__preview"},[g!==null?(0,v.createElement)("div",{key:"bar",className:"gp-files__bar"},[n?(0,v.createElement)("button",{key:"back",type:"button",className:"gp-subhead__back",onClick:()=>K("tree")},[(0,v.createElement)(xt,{key:"i",size:14}),i("files.backToTree")]):null,(0,v.createElement)("code",{key:"path",className:"gp-files__path",title:g},g),b.kind==="text"&&vo(b.path)?(0,v.createElement)("div",{key:"mode",className:"gp-files__mode",role:"group","aria-label":i("files.previewMode")},[(0,v.createElement)("button",{key:"source",type:"button",className:`gp-files__mode-btn${k?"":" gp-files__mode-btn--active"}`,"aria-pressed":!k,onClick:()=>M(!1)},i("files.source")),(0,v.createElement)("button",{key:"render",type:"button",className:`gp-files__mode-btn${k?" gp-files__mode-btn--active":""}`,"aria-pressed":k,onClick:()=>M(!0)},i("files.render"))]):null,(0,v.createElement)("button",{key:"copy",type:"button",className:`gp-files__copy-path${D==="error"?" gp-files__copy-path--error":""}`,"aria-live":"polite",onClick:()=>{ee()}},i(D==="copied"?"files.pathCopied":D==="error"?"files.pathCopyFailed":"files.copyPath")),b.kind==="text"?(0,v.createElement)("button",{key:"copy-content",type:"button",className:`gp-files__copy-path${F==="error"?" gp-files__copy-path--error":""}`,"aria-live":"polite",onClick:()=>{w()}},i(F==="copied"?"files.contentCopied":F==="error"?"files.contentCopyFailed":"files.copyContent")):null,(0,v.createElement)("button",{key:"props",type:"button",className:"gp-files__props",title:i("files.propsTitle"),"aria-label":i("files.propsTitle"),disabled:T===null,onClick:()=>Q(!0)},(0,v.createElement)(Lr,{size:14}))]):null,(0,v.createElement)("div",{key:"content",className:"gp-files__preview-content"},To(b,k,ae,i)),T!==null&&R?(0,v.createElement)(Ra,{key:"props-modal",input:T,snapshot:a,onClose:()=>Q(!1),t:i}):null]);return n?(0,v.createElement)("div",{className:"gp-files gp-files--compact"},U==="preview"?Y:j):(0,v.createElement)("div",{className:"gp-files"},[j,W.divider,Y])}function To(e,t,n,r){return e.kind==="text"&&t&&Da(e.path)?(0,v.createElement)("div",{className:"gp-files__markdown"},(0,v.createElement)(He.MarkdownText,{text:e.content,labels:n,variant:"body"})):e.kind==="text"&&t&&Kn(e.path)?(0,v.createElement)("iframe",{className:"gp-files__html",title:e.path,srcDoc:e.content,sandbox:"allow-scripts",referrerPolicy:"no-referrer"}):No(e,r)}function za(e,t,n){let r=n.dirs.get(e);if(r===void 0||r.status==="loading")return t===0?[(0,v.createElement)("div",{key:"l",className:"gp-empty"},n.t("common.loading"))]:[(0,v.createElement)("div",{key:`l${e}`,className:"gp-tree-row gp-tree-row--muted",style:{paddingLeft:10+t*14}},n.t("common.loading"))];if(r.status==="error")return[(0,v.createElement)("div",{key:`e${e}`,className:"gp-tree-row gp-tree-row--muted",style:{paddingLeft:10+t*14}},n.t("files.loadFailed"))];let a=[];for(let i of r.entries){let o=e===""?i.name:`${e}/${i.name}`;if(i.dir){let s=n.open.has(o);a.push((0,v.createElement)("button",{key:o,type:"button",className:`gp-tree-row gp-files__entry gp-files__entry--dir${i.ignored?" gp-tree-row--ignored":""}`,style:{paddingLeft:10+t*14},"aria-expanded":s,"aria-label":i.ignored?`${i.name} (${n.t("files.ignored")})`:i.name,onClick:()=>n.toggleDir(o)},[(0,v.createElement)("span",{key:"c",className:"gp-tree-chev"},(0,v.createElement)(tt,{size:11,open:s})),(0,v.createElement)("span",{key:"i",className:"gp-tree-ic"},(0,v.createElement)(He.FileTypeIcon,{kind:"folder",size:18})),(0,v.createElement)("span",{key:"n",className:"gp-tree-name"},i.name)])),s&&a.push(...za(o,t+1,n))}else{let s=n.selected===o;a.push((0,v.createElement)("button",{key:o,type:"button",className:`gp-tree-row gp-files__entry${s?" gp-tree-row--active":""}${i.ignored?" gp-tree-row--ignored":""}`,style:{paddingLeft:10+t*14},"aria-current":s?"true":void 0,"aria-label":i.ignored?`${i.name} (${n.t("files.ignored")})`:i.name,onClick:()=>n.selectFile(o)},[(0,v.createElement)("span",{key:"c",className:"gp-tree-chev"}),(0,v.createElement)("span",{key:"i",className:"gp-tree-ic"},(0,v.createElement)(He.FileTypeIcon,{path:o,size:18})),(0,v.createElement)("span",{key:"n",className:"gp-tree-name"},i.name)]))}}return r.truncated&&a.push((0,v.createElement)("div",{key:`t${e}`,className:"gp-tree-row gp-tree-row--muted",style:{paddingLeft:10+t*14}},n.t("files.truncated"))),a}function No(e,t){switch(e.kind){case"idle":return(0,v.createElement)("div",{className:"gp-empty"},t("files.selectFile"));case"loading":return(0,v.createElement)("div",{className:"gp-empty"},t("common.loading"));case"error":return(0,v.createElement)("div",{className:"gp-empty"},t("files.loadFailed"));case"tooLarge":return(0,v.createElement)("div",{className:"gp-empty"},t("files.tooLarge"));case"binary":return(0,v.createElement)("div",{className:"gp-empty"},t("files.binary"));case"image":return(0,v.createElement)(Ot,{src:e.dataUrl,alt:e.path,t,viewportClass:"gp-files__image"});case"text":return(0,v.createElement)(Mo,{content:e.content,path:e.path,t})}}function Eo(e,t){if(t==="")return[];let n=[];for(let r=0;r<e.length;r++)for(let[a,i]of an(e[r],t))if(n.push({line:r,start:a,end:i}),n.length>=tn)return n;return n}function Mo({content:e,path:t,t:n}){let r=(0,v.useMemo)(()=>{let m=e.split(`
|
|
675
|
+
`);return m.length>0&&m[m.length-1]===""&&m.pop(),m},[e]),a=e.length>wo||r.length>xo,i=a?void 0:(0,He.languageForPath)(t),o=(0,He.useCodeHighlighter)(i),s=(0,v.useMemo)(()=>a?void 0:o(r.join(`
|
|
676
|
+
`)),[a,o,r]),[l,d]=(0,v.useState)(!1),[p,u]=(0,v.useState)(""),[g,S]=(0,v.useState)(!1),[b,_]=(0,v.useState)(0),{setEl:k,viewport:M,elRef:D}=Tt(),J=(0,v.useRef)(null),F=(0,v.useRef)(null);(0,v.useEffect)(()=>{d(!1),u(""),_(0)},[t]);let C=rn(p,nn),R=(0,v.useMemo)(()=>r.map(m=>m.toLowerCase()),[r]),Q=g?C:C.toLowerCase(),U=g?r:R,K=(0,v.useMemo)(()=>Eo(U,Q),[U,Q]);(0,v.useEffect)(()=>{_(0)},[Q]);let ae=K.length===0?0:Math.min(b,K.length-1),z=(0,v.useMemo)(()=>{let m=new Map;for(let G of K){let B=m.get(G.line)??[];B.push([G.start,G.end]),m.set(G.line,B)}return m},[K]);(0,v.useEffect)(()=>{let m=G=>{if(!((G.ctrlKey||G.metaKey)&&(G.key==="f"||G.key==="F")))return;let B=D.current;B===null||B.offsetParent===null||(G.preventDefault(),d(!0),requestAnimationFrame(()=>J.current?.select()))};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[]);let W=r.length,O=(0,v.useMemo)(()=>St(new Array(W).fill(yn)),[W]),se=M.height>0?M.height:ko,{first:q,last:de}=Ct(O,M.top,se,Pa*yn),le=K.length>0?K[ae].line:-1,{first:he,last:be}=en({first:q,last:de},le,W,Pa);(0,v.useEffect)(()=>{if(le<0)return;let m=requestAnimationFrame(()=>F.current?.scrollIntoView({block:"center",inline:"nearest"}));return()=>cancelAnimationFrame(m)},[ae,K,le]);let ee=(0,v.useCallback)(m=>{_(G=>K.length===0?0:(G+m+K.length)%K.length)},[K.length]),w=K.length>0?K[ae]:null,T=l?(0,v.createElement)(sn,{inputRef:J,query:p,matches:K.length,active:ae,caseSensitive:g,onChange:u,onToggleCase:()=>S(m=>!m),onStep:ee,onClose:()=>d(!1),t:n}):null,j=a||l?(0,v.createElement)("div",{key:"hd",className:"gp-files__header"},[a?(0,v.createElement)("div",{key:"note",className:"gp-files__note"},n("files.highlightOff")):null,T]):null,Y=[];for(let m=he;m<be;m++)Y.push((0,v.createElement)("div",{key:m,className:"gp-files__row",style:{top:m*yn}},[(0,v.createElement)("div",{key:"n",className:"gp-diff-no"},m+1),Go(r[m],m,s?.[m],z.get(m),w,F,n)]));return(0,v.createElement)("div",{className:"gp-files__code gp-diff__scroll",ref:k},[j,(0,v.createElement)("div",{key:"grid",className:"gp-files__single gp-files__single--virt",style:{height:W*yn}},Y)])}function Go(e,t,n,r,a,i,o){if(e==="")return(0,v.createElement)("div",{key:`c${t}`,className:"gp-diff-cell"},"\xA0");if(e.length>La)return(0,v.createElement)("div",{key:`c${t}`,className:"gp-diff-cell"},[e.slice(0,La),(0,v.createElement)("span",{key:"trunc",className:"gp-files__trunc"},o("files.lineTruncated"))]);if(r===void 0||r.length===0)return(0,v.createElement)("div",{key:`c${t}`,className:"gp-diff-cell"},n!==void 0?n.map((l,d)=>(0,v.createElement)("span",{key:d,style:l.style},l.text)):e);let s=a!==null&&a.line===t?[a.start,a.end]:null;return(0,v.createElement)("div",{key:`c${t}`,className:"gp-diff-cell"},on(e,r,n,`c${t}`,s,i))}var vn=require("react"),Ro=620;function Aa(e){let[t,n]=(0,vn.useState)(!1);return(0,vn.useLayoutEffect)(()=>{if(e===null||typeof ResizeObserver>"u")return;let r=()=>n(e.clientWidth>0&&e.clientWidth<=Ro);r();let a=new ResizeObserver(r);return a.observe(e),()=>a.disconnect()},[e]),t}var Ha="gp.panel.fontDelta";function Lo(){if(typeof localStorage>"u")return 0;let e=Number(localStorage.getItem(Ha));return e===-1||e===1?e:0}function Fa({ctx:e,sessionId:t,t:n}){let[r,a]=(0,I.useState)(Lo),[i,o]=(0,I.useState)(null),[s,l]=(0,I.useState)(null),d=Aa(s),p=Wt(t),u=Pt(e),g=p.state==="error"&&p.error.code==="git-unavailable",S=p.state==="error"&&(p.error.code==="not-a-git-repo"||p.error.code==="git-unavailable"),b=g&&p.state==="error"&&p.error.isGitRepo===!0,_=S?"files":i!==null&&i.sessionId===t?i.tab:null,k=(0,I.useRef)({tabs:new Set});k.current.sessionId!==t&&(k.current={sessionId:t,tabs:new Set}),_!==null&&k.current.tabs.add(_);let M=k.current.tabs.has("files");(0,I.useEffect)(()=>{if(!et(t))return;if(S){o(null);return}if(i?.sessionId===t)return;let z=mr(t);if(z!==null){o({sessionId:t,tab:z});return}let W=br(t);if(W!==null){o({sessionId:t,tab:W});return}p.state==="ready"&&o({sessionId:t,tab:p.snapshot.dirty?"changes":"overview"})},[t,p,S,i?.sessionId]),(0,I.useEffect)(()=>{if(et(t))return hr(t,z=>o({sessionId:t,tab:z}))},[t]);let D=(0,I.useRef)({tab:null});D.current={sessionId:t,tab:_},(0,I.useEffect)(()=>()=>{let{sessionId:z,tab:W}=D.current;z!==void 0&&W!==null&&yr(z,W)},[]);let J=p.state==="ready"?p.snapshot.checkedAt:0,[F,C]=(0,I.useState)(0),R=async z=>{if(!et(t))return{ok:!1,error:n("error.noCwd")};let W=await u.run({sessionId:t,action:z});return W.ok?(Dt(t).accept(W.snapshot),z.kind==="branch-checkout"&&C(O=>O+1),{ok:!0}):(z.kind==="branch-checkout"&&z.stashMessage!==void 0&&C(O=>O+1),Dt(t).resync(),{ok:!1,error:$t(W.error.code,W.error.message,n)})},Q=z=>{a(z),typeof localStorage<"u"&&localStorage.setItem(Ha,String(z))},U=[{key:"overview",label:n("tab.overview"),icon:(0,I.createElement)(qt,{size:14})},{key:"changes",label:n("tab.changes"),icon:(0,I.createElement)(kr,{size:14})},{key:"files",label:n("tab.files"),icon:(0,I.createElement)(Er,{size:14})}],K=S?U.filter(z=>z.key==="files"):U,ae=(()=>{if(!et(t))return(0,I.createElement)("div",{className:"gp-empty"},n("error.noCwd"));if(p.state==="no-cwd")return(0,I.createElement)("div",{className:"gp-empty"},n("error.noCwd"));if(S){let W=M?(0,I.createElement)(Un,{key:t,remote:u,sessionId:t,compact:d,worktreeGen:F,snapshot:null,t:n}):null;return b?(0,I.createElement)("div",{className:"gp-files-wrap"},[(0,I.createElement)("div",{key:"notice",className:"gp-notice"},n("files.gitNotInstalled")),W]):(0,I.createElement)("div",{style:{display:"contents"}},W)}if(p.state==="error")return(0,I.createElement)("div",{className:"gp-empty"},n("pill.unavailable"));if(p.state==="cold"||p.state==="loading"||_===null)return(0,I.createElement)("div",{className:"gp-empty"},n("common.loading"));let z=p.snapshot;return(0,I.createElement)("div",{style:{display:"contents"}},[k.current.tabs.has("overview")?(0,I.createElement)("div",{key:"overview",style:_==="overview"?{display:"contents"}:{display:"none"}},(0,I.createElement)(Sa,{key:t,remote:u,sessionId:t,refreshKey:J,defaultDiffView:z.defaultDiffView,snapshot:z,onAction:R,onResync:()=>Dt(t).resync(),compact:d,t:n})):null,k.current.tabs.has("changes")?(0,I.createElement)("div",{key:"changes",style:_==="changes"?{display:"contents"}:{display:"none"}},(0,I.createElement)(Ea,{key:t,remote:u,sessionId:t,snapshot:z,onAction:R,compact:d,t:n})):null,M?(0,I.createElement)("div",{key:"files",style:_==="files"?{display:"contents"}:{display:"none"}},(0,I.createElement)(Un,{key:t,remote:u,sessionId:t,compact:d,worktreeGen:F,snapshot:z,t:n})):null])})();return(0,I.createElement)("div",{className:"gp-panel",ref:l,"data-conversation-composer-overlay":"","data-font-delta":r,"data-layout":d?"compact":"wide"},[(0,I.createElement)("div",{key:"tabs",className:"gp-tabbar",role:"tablist"},[...K.map(z=>(0,I.createElement)("button",{key:z.key,type:"button",role:"tab","aria-selected":_===z.key,className:`gp-tab${_===z.key?" gp-tab--active":""}`,onClick:()=>{et(t)&&o({sessionId:t,tab:z.key})}},[(0,I.createElement)("span",{key:"i",className:"gp-tab__icon"},z.icon),(0,I.createElement)("span",{key:"l",className:"gp-tab__label"},z.label)])),(0,I.createElement)("div",{key:"trailing",className:"gp-tabbar__trailing"},[(0,I.createElement)("div",{key:"font",className:"gp-font"},[(0,I.createElement)("button",{key:"dec",type:"button",className:"gp-font__decrease",onClick:()=>Q(-1),"aria-label":n("panel.fontDecrease")},"A\u2212"),(0,I.createElement)("button",{key:"reset",type:"button",className:"gp-font__reset",onClick:()=>Q(0),"aria-label":n("panel.fontReset")},"A"),(0,I.createElement)("button",{key:"inc",type:"button",className:"gp-font__increase",onClick:()=>Q(1),"aria-label":n("panel.fontIncrease")},"A+")]),(0,I.createElement)(Po,{key:"ver",remote:u,t:n})])]),(0,I.createElement)("div",{key:"body",className:"gp-body"},ae)])}function Po({remote:e,t}){let[n,r]=(0,I.useState)({kind:"idle"}),{tipProps:a,tipNode:i}=fn({placement:"below",maxWidth:300});(0,I.useEffect)(()=>{let d=!0;return e.version({}).then(p=>{d&&"current"in p&&r(u=>({...u,info:p}))}),()=>{d=!1}},[e]);let o=async()=>{r(p=>({kind:"checking",info:p.info}));let d=await e.version({check:!0});r({kind:"idle",info:"current"in d?d:void 0})},s=n.info,l=n.kind==="checking"?(0,I.createElement)("span",{className:"gp-verbar__status"},t("version.checking")):s===void 0||!s.checkedRemote?null:s.error!==void 0?(0,I.createElement)("span",{className:"gp-verbar__status gp-verbar__status--err",title:s.error},s.error==="repository is not configured"?t("version.noRepo"):t("version.error")):s.updateAvailable&&s.latest!==void 0?(0,I.createElement)("span",{},[(0,I.createElement)("span",{key:"s",className:"gp-verbar__status gp-verbar__status--new"},t("version.updateAvailable",{latest:s.latest,current:s.current})),s.releaseUrl!==void 0?(0,I.createElement)("a",{key:"l",className:"gp-verbar__link",href:s.releaseUrl,target:"_blank",rel:"noreferrer",style:{marginLeft:8}},t("version.viewRelease")):null]):(0,I.createElement)("span",{className:"gp-verbar__status gp-verbar__status--ok"},t("version.upToDate",{current:s.current}));return(0,I.createElement)("div",{className:"gp-verbar"},[s!==void 0?(0,I.createElement)("span",{key:"tag",className:"gp-verbar__tag"},`v${s.current}`):null,l,(0,I.createElement)("button",{key:"btn",type:"button",className:"gp-verbar__btn",disabled:n.kind==="checking",onClick:()=>void o()},[(0,I.createElement)("span",{key:"i",className:"gp-tab__icon"},(0,I.createElement)(jt,{size:12})),t("version.check")]),s?.repositoryUrl!==void 0?(0,I.createElement)("a",{key:"gh",className:"gp-icon-btn gp-verbar__gh gp-verbar__gh--starred",href:s.repositoryUrl,target:"_blank",rel:"noreferrer","aria-label":t("version.openRepo"),...a(t("version.openRepo"))},(0,I.createElement)(Pr,{size:15})):null,i])}var fe=require("react"),$a=require("react-dom");var Ba="data-gp-tab-dot",Rt,Vn=null,Ia="",xn=null,wn;function Do(e){if(typeof document>"u")return null;let t=document.querySelectorAll(Ht);for(let n of t)if((n.textContent??"").trim()===e)return n;return null}function Wn(){let e=Do(Ia);if(e===null)return;let t=e.querySelector(`[${Ba}]`);if(xn===null){t?.remove();return}let n=`gp-tab-dot gp-tab-dot--${xn}`;if(t!==null){t.className!==n&&(t.className=n);return}let r=document.createElement("span");r.className=n,r.setAttribute(Ba,""),r.setAttribute("aria-hidden","true"),e.appendChild(r)}function zo(){if(typeof document>"u"||typeof MutationObserver>"u")return;let e=document.querySelector(gr);if(e!==Vn){if(Rt?.disconnect(),Vn=e,e===null){Rt=void 0;return}Rt=new MutationObserver(()=>Wn()),Rt.observe(e,{childList:!0,subtree:!0})}}function Ao(){Rt?.disconnect(),Rt=void 0,Vn=null}function Oa(e,t,n){if(!(typeof document>"u")){if(n===null){qn(e);return}wn=e,Ia=t,xn=n,zo(),Wn()}}function qn(e){wn!==void 0&&wn!==e||(wn=void 0,xn=null,Wn(),Ao())}function Ho(e){let t=e.replace(/[/\\]+$/,"").split(/[/\\]/);return t[t.length-1]||e}function Fo(){let[e,t]=(0,fe.useState)(!1),[n,r]=(0,fe.useState)(null),a=(0,fe.useRef)(null);return(0,fe.useLayoutEffect)(()=>{if(!e||a.current===null){r(null);return}let s=a.current.getBoundingClientRect();r({left:s.left,bottom:window.innerHeight-s.top+8})},[e]),{bind:{ref:s=>{a.current=s},onMouseEnter:()=>t(!0),onMouseLeave:()=>t(!1)},render:s=>!e||n===null||typeof document>"u"?null:(0,$a.createPortal)((0,fe.createElement)("div",{className:"gp-tip",style:{left:n.left,bottom:n.bottom}},s.map((l,d)=>(0,fe.createElement)("div",{key:d,className:d===0?"gp-tip__path":"gp-tip__note"},l))),document.body)}}function Bo(e){let[t,n]=(0,fe.useState)(!1);return(0,fe.useEffect)(()=>{if(e===null||typeof ResizeObserver>"u")return;let a=e.closest("[data-conversation-region]")??document.body,i=()=>n(a.clientWidth>0&&a.clientWidth<Io);i();let o=new ResizeObserver(i);return o.observe(a),()=>o.disconnect()},[e]),t}var Io=620;function Xa({sessionId:e,t}){let n=Wt(e),r=Fo(),[a,i]=(0,fe.useState)(null),o=Bo(a),s=(0,fe.useRef)(Symbol("gp-tab-dot")),l=n.state==="ready"&&n.snapshot.showInputPill===!1?n.snapshot.dirty?"dirty":"synced":null,d=t("panel.tab");if((0,fe.useEffect)(()=>{Oa(s.current,d,l);let k=s.current;return()=>{qn(k)}},[d,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.code==="git-unavailable"||n.error.showInputPill===!1?null:(0,fe.createElement)("span",{className:"gp-pill gp-pill--degraded",title:n.error.detail??t("pill.unavailable")},t("pill.unavailable"));let p=n.snapshot;if(p.showInputPill===!1)return null;let u=Ho(p.root),g=p.branch??`(${t("pill.detached")})`,S=p.dirty,b=S?"gp-pill--dirty":"gp-pill--synced",_=()=>{if(wr(d)){xr(d);return}et(e)&&fr(e,S?"changes":"overview"),vr(d)};return(0,fe.createElement)("span",{className:"gp-pill-wrap",ref:i},[(0,fe.createElement)("button",{key:"btn",type:"button",className:`gp-pill ${b}${o?" gp-pill--compact":""}`,onClick:_,ref:r.bind.ref,onMouseEnter:r.bind.onMouseEnter,onMouseLeave:r.bind.onMouseLeave},[(0,fe.createElement)("span",{key:"dot",className:"gp-pill__dot","aria-hidden":"true"}),(0,fe.createElement)("span",{key:"repo",className:"gp-pill__repo"},u),(0,fe.createElement)("span",{key:"git",className:"gp-pill__git"},["(",(0,fe.createElement)("span",{key:"b",className:"gp-pill__branch"},g),")"])]),r.render([p.root,t(S?"pill.dirty":"pill.synced")])])}var A=require("react");function Oo(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}}var kn={min:Re.maxBytes.min/1024,max:Re.maxBytes.max/1024},_n={min:Re.timeoutMs.min/1e3,max:Re.timeoutMs.max/1e3};function jn(e,t){return Math.min(t.max,Math.max(t.min,Math.floor(e)))}function $o(e){let t=e.trim();if(t==="")return null;let n=Number(t);return Number.isFinite(n)?n:null}function Ja({ctx:e,t}){let[,n]=(0,A.useState)(0),[r,a]=(0,A.useState)(!1),[i,o]=(0,A.useState)(!1),[s,l]=(0,A.useState)(null),[d,p]=(0,A.useState)(null),[u,g]=(0,A.useState)(null),[S,b]=(0,A.useState)(null),[_,k]=(0,A.useState)(null),[M,D]=(0,A.useState)(null),[J,F]=(0,A.useState)(null),[C,R]=(0,A.useState)(null),Q=()=>{n(N=>N+1)},U=e.get("configForms"),K=(0,A.useMemo)(()=>U?.describe(),[U]);(0,A.useEffect)(()=>{if(K!==void 0)return K.ensure(),K.subscribe(Q)},[K]);let ae=K?.getSnapshot().view,z=(0,A.useMemo)(()=>ae===void 0?void 0:Oo(ae.namespaces),[ae]),W=(0,A.useMemo)(()=>U!==void 0&&z!==void 0?U.get(z):void 0,[U,z]);(0,A.useEffect)(()=>{if(W!==void 0)return W.subscribe(Q)},[W]);let O=W?.getSnapshot(),se=W!==void 0&&O!==void 0&&O.status==="ready",q=K?.getSnapshot().status,de=s??(typeof O?.value?.showInputPill=="boolean"?O.value.showInputPill:!0),le=d??(O?.value?.defaultDiffView==="split"?"split":"unified"),he=u??(O?.value?.graphStyle==="compact"?"compact":"parallel"),be=S??(typeof O?.value?.suggestEnabled=="boolean"?O.value.suggestEnabled:!0),ee=O?.value?.suggestLanguage,w=_??(typeof ee=="string"&&Zt.includes(ee)?ee:Pn),T=jn(typeof O?.value?.suggestMaxBytes=="number"?O.value.suggestMaxBytes/1024:Re.maxBytes.default/1024,kn),j=jn(typeof O?.value?.suggestMaxOutputTokens=="number"?O.value.suggestMaxOutputTokens:Re.maxOutputTokens.default,Re.maxOutputTokens),Y=jn(typeof O?.value?.suggestTimeoutMs=="number"?O.value.suggestTimeoutMs/1e3:Re.timeoutMs.default/1e3,_n),m=async(N,Ee,ze)=>{if(W!==void 0){o(!1),a(!0);try{let xe=await W.set(N,Ee);ze(),xe?(zt(),setTimeout(()=>zt(),1e3)):o(!0)}catch{ze(),o(!0)}finally{a(!1)}}},G=N=>(l(N),m("showInputPill",N,()=>l(null))),B=N=>N===le?Promise.resolve():(p(N),m("defaultDiffView",N,()=>p(null))),P=N=>N===he?Promise.resolve():(g(N),m("graphStyle",N,()=>g(null))),ue=N=>(b(N),m("suggestEnabled",N,()=>b(null))),Se=N=>N===w?Promise.resolve():(k(N),m("suggestLanguage",N,()=>k(null))),_e=(N,Ee,ze,xe,$e,Ve)=>{let Be=N===null?null:$o(N);if(Be===null)return Ve(),Promise.resolve();let Ae=Math.min(Ee.max,Math.max(Ee.min,Math.floor(Be)));return $e(String(Ae)),m(xe,Ae*ze,Ve)},lt=N=>_e(N,kn,1024,"suggestMaxBytes",D,()=>D(null)),Fe=N=>_e(N,Re.maxOutputTokens,1,"suggestMaxOutputTokens",F,()=>F(null)),De=N=>_e(N,_n,1e3,"suggestTimeoutMs",R,()=>R(null));return U===void 0?(0,A.createElement)("p",{className:"gp-cfg__hint"},t("cfg.notLoaded")):se?(0,A.createElement)("div",{className:"gp-cfg"},[(0,A.createElement)("h3",{key:"title",className:"gp-cfg__title"},t("cfg.title")),(0,A.createElement)("label",{key:"row",className:"gp-cfg__row"},[(0,A.createElement)("input",{key:"switch",type:"checkbox",role:"switch",className:"gp-cfg__switch",checked:de,disabled:r||O?.writable===!1,onChange:N=>{G(N.currentTarget.checked)}}),(0,A.createElement)("span",{key:"text",className:"gp-cfg__text"},t("cfg.toggle"))]),(0,A.createElement)("p",{key:"hint",className:"gp-cfg__hint"},t("cfg.hint")),(0,A.createElement)("h3",{key:"difftitle",className:"gp-cfg__title",style:{marginTop:6}},t("cfg.diffTitle")),(0,A.createElement)("div",{key:"diffseg",className:"gp-seg gp-cfg__seg"},it(["unified","split"],le,N=>{B(N)},N=>t(N==="unified"?"cfg.diffUnified":"cfg.diffSplit"),r||O?.writable===!1)),(0,A.createElement)("p",{key:"diffhint",className:"gp-cfg__hint"},t("cfg.diffHint")),(0,A.createElement)("h3",{key:"graphtitle",className:"gp-cfg__title",style:{marginTop:6}},t("cfg.graphTitle")),(0,A.createElement)("div",{key:"graphseg",className:"gp-seg gp-cfg__seg"},it(["parallel","compact"],he,N=>{P(N)},N=>t(N==="parallel"?"cfg.graphParallel":"cfg.graphCompact"),r||O?.writable===!1)),(0,A.createElement)("p",{key:"graphhint",className:"gp-cfg__hint"},t("cfg.graphHint")),(0,A.createElement)("div",{key:"suggestcard",className:"gp-cfg__card"},[(0,A.createElement)("h3",{key:"sgtitle",className:"gp-cfg__card-title"},t("cfg.suggestTitle")),(0,A.createElement)("label",{key:"sgrow",className:"gp-cfg__row"},[(0,A.createElement)("input",{key:"switch",type:"checkbox",role:"switch",className:"gp-cfg__switch",checked:be,disabled:r||O?.writable===!1,onChange:N=>{ue(N.currentTarget.checked)}}),(0,A.createElement)("span",{key:"text",className:"gp-cfg__text"},t("cfg.suggestToggle"))]),(0,A.createElement)("p",{key:"sglangtitle",className:"gp-cfg__seglabel"},t("cfg.suggestLangLabel")),(0,A.createElement)("div",{key:"sglang",className:"gp-seg gp-cfg__seg",role:"group","aria-label":t("cfg.suggestLangLabel")},it([...Zt],w,N=>{Se(N)},N=>t(N==="auto"?"cfg.suggestLangAuto":N==="zh"?"cfg.suggestLangZh":"cfg.suggestLangEn"),r||O?.writable===!1)),(0,A.createElement)("p",{key:"sglanghint",className:"gp-cfg__rangehint"},t("cfg.suggestLangHint")),(0,A.createElement)("div",{key:"numax",className:"gp-cfg__numrow"},[(0,A.createElement)("label",{key:"lab",className:"gp-cfg__numlabel",htmlFor:"gp-cfg-maxkib"},t("cfg.suggestMaxBytesLabel")),(0,A.createElement)("input",{key:"input",id:"gp-cfg-maxkib",type:"number",className:"gp-cfg__numinput",inputMode:"numeric",min:kn.min,max:kn.max,"aria-describedby":"gp-cfg-maxkib-hint",value:M??String(T),disabled:r||O?.writable===!1,onChange:N=>{D(N.currentTarget.value)},onBlur:()=>{lt(M)},onKeyDown:N=>{N.key==="Enter"&&N.currentTarget.blur()}}),(0,A.createElement)("span",{key:"unit",className:"gp-cfg__numunit"},t("cfg.suggestMaxBytesUnit"))]),(0,A.createElement)("p",{key:"numaxhint",id:"gp-cfg-maxkib-hint",className:"gp-cfg__rangehint"},t("cfg.suggestMaxBytesHint")),(0,A.createElement)("div",{key:"nuout",className:"gp-cfg__numrow"},[(0,A.createElement)("label",{key:"lab",className:"gp-cfg__numlabel",htmlFor:"gp-cfg-outtok"},t("cfg.suggestOutputLabel")),(0,A.createElement)("input",{key:"input",id:"gp-cfg-outtok",type:"number",className:"gp-cfg__numinput",inputMode:"numeric",min:Re.maxOutputTokens.min,max:Re.maxOutputTokens.max,"aria-describedby":"gp-cfg-outtok-hint",value:J??String(j),disabled:r||O?.writable===!1,onChange:N=>{F(N.currentTarget.value)},onBlur:()=>{Fe(J)},onKeyDown:N=>{N.key==="Enter"&&N.currentTarget.blur()}}),(0,A.createElement)("span",{key:"unit",className:"gp-cfg__numunit"},t("cfg.suggestOutputUnit"))]),(0,A.createElement)("p",{key:"nuouthint",id:"gp-cfg-outtok-hint",className:"gp-cfg__rangehint"},t("cfg.suggestOutputHint")),(0,A.createElement)("div",{key:"nuto",className:"gp-cfg__numrow"},[(0,A.createElement)("label",{key:"lab",className:"gp-cfg__numlabel",htmlFor:"gp-cfg-timeout"},t("cfg.suggestTimeoutLabel")),(0,A.createElement)("input",{key:"input",id:"gp-cfg-timeout",type:"number",className:"gp-cfg__numinput",inputMode:"numeric",min:_n.min,max:_n.max,"aria-describedby":"gp-cfg-timeout-hint",value:C??String(Y),disabled:r||O?.writable===!1,onChange:N=>{R(N.currentTarget.value)},onBlur:()=>{De(C)},onKeyDown:N=>{N.key==="Enter"&&N.currentTarget.blur()}}),(0,A.createElement)("span",{key:"unit",className:"gp-cfg__numunit"},t("cfg.suggestTimeoutUnit"))]),(0,A.createElement)("p",{key:"nutohint",id:"gp-cfg-timeout-hint",className:"gp-cfg__rangehint"},t("cfg.suggestTimeoutHint")),(0,A.createElement)("p",{key:"sghint",className:"gp-cfg__hint"},t("cfg.suggestHint"))]),i?(0,A.createElement)("p",{key:"error",className:"gp-cfg__err",role:"alert"},t("cfg.saveFailed")):null]):q==="idle"||q==="loading"?(0,A.createElement)("p",{className:"gp-cfg__hint"},t("common.loading")):(0,A.createElement)("p",{className:"gp-cfg__hint"},t("cfg.notLoaded"))}var Xt="gitPanel",Xo=["dsh-git-panel","@xbzbing/dsh-git-panel"],Jo=["slots","locale","connection"],Ko="dsh-git-panel";function Uo(e){or(),pr(e),e.effect(()=>e.locale.register(Xt,{zh:sr,en:lr})??void 0,"dsh-git-panel: dictionaries");let t=e.locale.bind(Xt),n=[],r=a=>{typeof a=="function"&&n.push(a)};r(e.slots.inject("conversation.view",()=>e.slots.register({name:"conversation.view",id:"git-panel",order:30,locale:Xt,label:()=>t("panel.tab")},a=>(0,Sn.createElement)(Fa,{ctx:e,sessionId:a.sessionId,t})))),r(e.slots.inject("conversation.input.left",()=>e.slots.register({name:"conversation.input.left",id:"git-panel-pill",order:100,locale:Xt},a=>(0,Sn.createElement)(Xa,{sessionId:a.sessionId,t}))));for(let a of Xo)r(e.slots.inject("plugins.bundle.config",()=>e.slots.register({name:"plugins.bundle.config",key:a,locale:Xt},i=>i.view==="summary"?t("cfg.title"):(0,Sn.createElement)(Ja,{ctx:e,t}))));e.effect(()=>{let a=e.on("connection/reset",()=>zt());return()=>{typeof a=="function"&&a();for(let i of n.splice(0))try{i()}catch{}ur()}},"dsh-git-panel: lifecycle")}module.exports={name:Ko,inject:Jo,apply:Uo};
|
|
632
677
|
return module.exports;
|
|
633
678
|
} });
|