@xbzbing/dsh-git-panel 1.2.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 Ze=require("react");var Tn=`
3
+ "use strict";var Xt=require("react");var Ir=`
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. */
@@ -34,11 +34,15 @@ var module = { exports: {} }; var exports = module.exports;
34
34
  .gp-tab--active{background:color-mix(in srgb,var(--dsw-alias-state-business-primary) 12%,transparent);color:var(--dsw-alias-state-business-primary);font-weight:600;box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--dsw-alias-state-business-primary) 32%,transparent)}
35
35
  .gp-tab__icon{display:inline-flex;width:15px;height:15px;flex:none}
36
36
  .gp-tab__label{white-space:nowrap}
37
- /* Responsive tab bar (the bar is an inline-size container): as the panel
38
- * narrows \u2014 e.g. when the right sidebar opens \u2014 shed the trailing controls
39
- * first, then drop the tab labels to icon-only. Two stages, so labels never
40
- * wrap or overflow into the garbled multi-line state. */
41
- @container (max-width:460px){.gp-tabbar .gp-font,.gp-tabbar .gp-verbar{display:none}}
37
+ /* Trailing cluster (font stepper + version bar). display:contents makes it
38
+ * transparent to the tab-bar flex in the wide layout \u2014 font sits after the
39
+ * tabs, version bar floats right via its own margin-left:auto \u2014 identical to a
40
+ * flat layout. The compact layout re-materializes it as a wrapped second row. */
41
+ .gp-tabbar__trailing{display:contents}
42
+ /* Responsive tab bar (the bar is an inline-size container): a very narrow panel
43
+ * drops the tab labels to icon-only so they never wrap into a garbled multi-line
44
+ * state. Hiding the trailing controls is handled by the compact layout (which
45
+ * moves them to a second row) rather than removing them. */
42
46
  @container (max-width:300px){.gp-tab__label{display:none}.gp-tab{gap:0;padding:0 10px}}
43
47
  .gp-font{margin-left:4px;display:inline-flex;align-items:center;border:1px solid var(--dsw-alias-border-l2);border-radius:6px;overflow:hidden}
44
48
  .gp-font button{border:0;border-left:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-secondary);font:inherit;font-size:11px;line-height:22px;width:24px;height:24px;padding:0;cursor:pointer}
@@ -86,7 +90,7 @@ var module = { exports: {} }; var exports = module.exports;
86
90
  /* overscroll-behavior:contain keeps a wheel gesture that reaches the top/bottom
87
91
  * of the commit list from bubbling out and scrolling the whole conversation. */
88
92
  .gp-history__list{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain}
89
- .gp-commit-row{display:grid;align-items:center;gap:8px;height:30px;padding:0 10px;cursor:pointer;border-bottom:1px solid transparent}
93
+ .gp-commit-row{display:grid;align-items:center;gap:8px;height:30px;padding:0 10px;cursor:pointer;box-sizing:border-box}
90
94
  .gp-commit-row:hover{background:var(--dsw-alias-interactive-bg-hover)}
91
95
  .gp-commit-row--active,.gp-commit-row--active:hover{background:var(--gp-select-bg);box-shadow:var(--gp-select-bar)}
92
96
  .gp-commit-subject{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@@ -110,7 +114,7 @@ var module = { exports: {} }; var exports = module.exports;
110
114
  .gp-detail__files{flex:1 1 50%;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:6px 0;border-bottom:1px solid var(--dsw-alias-border-l2)}
111
115
  .gp-detail__msg{flex:1 1 50%;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:10px}
112
116
  .gp-detail__subject{font-weight:600;margin-bottom:6px}
113
- .gp-detail__meta{font-size:11px;color:var(--dsw-alias-label-tertiary);margin-bottom:8px;display:flex;gap:8px;flex-wrap:wrap}
117
+ .gp-detail__meta{font-size:11px;color:var(--dsw-alias-label-tertiary);margin-bottom:8px;display:flex;align-items:baseline;gap:8px;flex-wrap:wrap}
114
118
  .gp-detail__body{white-space:pre-wrap;font-size:12px;color:var(--dsw-alias-label-secondary);margin:0;font-family:inherit}
115
119
 
116
120
  /* file tree \u2014 13px to match the middle history list (was 12px, felt cramped) */
@@ -188,6 +192,12 @@ var module = { exports: {} }; var exports = module.exports;
188
192
  .gp-files__image{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;display:flex;align-items:center;justify-content:center;padding:16px;background-color:var(--dsw-alias-bg-layer-1);background-image:linear-gradient(45deg,color-mix(in srgb,var(--dsw-alias-label-primary) 5%,transparent) 25%,transparent 25%,transparent 50%,color-mix(in srgb,var(--dsw-alias-label-primary) 5%,transparent) 50%,color-mix(in srgb,var(--dsw-alias-label-primary) 5%,transparent) 75%,transparent 75%);background-size:16px 16px}
189
193
  .gp-files__image img{max-width:100%;max-height:100%;object-fit:contain}
190
194
  .gp-changes__list{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:4px 0}
195
+ /* Virtualized change list: a fixed-height relative spacer owns the scrollbar;
196
+ * each mounted row/head is absolutely positioned at its offset and pinned to
197
+ * the fixed height the window math assumes (VROW_H / VHEAD_H). */
198
+ .gp-changes__vlist{position:relative;width:100%}
199
+ .gp-changes__vrow{position:absolute;left:0;right:0;box-sizing:border-box}
200
+ .gp-changes__vrow>.gp-file-row,.gp-changes__vrow>.gp-group-head{height:100%;box-sizing:border-box}
191
201
  .gp-check{width:14px;height:14px;flex:none;cursor:pointer}
192
202
  .gp-group-head{display:flex;align-items:center;gap:6px;padding:5px 10px;font-size:11px;color:var(--dsw-alias-label-tertiary);cursor:pointer;user-select:none}
193
203
  .gp-file-row{display:flex;align-items:center;gap:8px;padding:4px 10px 4px 20px;cursor:pointer;font-size:12px;border-radius:4px}
@@ -208,6 +218,8 @@ var module = { exports: {} }; var exports = module.exports;
208
218
  .gp-stats__times{display:inline-flex;align-items:center;gap:14px;flex-wrap:nowrap}
209
219
  .gp-stats__add{color:var(--dsw-alias-state-success-primary)}
210
220
  .gp-stats__del{color:var(--dsw-alias-state-error-primary)}
221
+ /* "simplified" marker on a huge change set: muted + help cursor + dotted hint. */
222
+ .gp-stats__partial{color:var(--dsw-alias-label-tertiary);cursor:help;text-decoration:underline dotted;text-underline-offset:2px}
211
223
 
212
224
  /* commit box */
213
225
  .gp-commitbox{flex:none;border-top:1px solid var(--dsw-alias-border-l2);padding:8px 10px;display:flex;flex-direction:column;gap:8px}
@@ -273,6 +285,7 @@ var module = { exports: {} }; var exports = module.exports;
273
285
  .gp-svgdiff__bar{flex:none;display:flex;justify-content:flex-end;padding:6px 10px;border-bottom:1px solid var(--dsw-alias-border-l2)}
274
286
  .gp-svgdiff__body{flex:1;min-height:0;display:flex;flex-direction:column;overflow:auto;overscroll-behavior:contain}
275
287
  .gp-feedback{padding:6px 10px;font-size:12px;color:var(--dsw-alias-state-error-primary);background:color-mix(in srgb,var(--dsw-alias-state-error-primary) 10%,transparent);display:flex;align-items:center;gap:8px}
288
+ .gp-notice{padding:6px 10px;font-size:12px;color:var(--dsw-alias-label-secondary);background:color-mix(in srgb,var(--dsw-alias-label-secondary) 10%,transparent);display:flex;align-items:center;gap:8px}
276
289
 
277
290
  /* commit file-diff modal (overview \u2192 click a file): a centered dialog over a
278
291
  * dimmed backdrop, closed by Esc / backdrop click / the close button. */
@@ -290,10 +303,60 @@ var module = { exports: {} }; var exports = module.exports;
290
303
  .gp-modal__close{flex:none}
291
304
  .gp-modal__scroll{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;font-family:var(--dsw-font-mono,monospace);font-size:12px;background:var(--dsw-alias-bg-layer-2)}
292
305
 
306
+ /* small dialog (tag create/delete, stash push/drop): auto-height form modal */
307
+ .gp-modal--sm{width:min(460px,92vw);height:auto;max-height:min(560px,86vh)}
308
+ .gp-modal__form{flex:1;min-height:0;overflow-y:auto;padding:14px;display:flex;flex-direction:column;gap:10px}
309
+ .gp-modal__confirmtext{font-size:13px;line-height:1.6;color:var(--dsw-alias-label-primary);white-space:pre-wrap;word-break:break-word}
310
+ .gp-modal__check{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--dsw-alias-label-secondary);cursor:pointer;user-select:none}
311
+ .gp-input{width:100%;box-sizing:border-box;height:30px;padding:0 10px;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:13px}
312
+ .gp-input:focus{outline:none;border-color:var(--dsw-alias-state-business-primary)}
313
+ .gp-input--area{height:auto;min-height:60px;padding:8px 10px;resize:vertical;line-height:1.5}
314
+ .gp-modal__footer{flex:none;display:flex;justify-content:flex-end;gap:8px;padding:10px 14px;border-top:1px solid var(--dsw-alias-border-l2)}
315
+ .gp-modal__hint{font-size:11px;line-height:1.5;color:var(--dsw-alias-label-tertiary)}
316
+ .gp-btn--sm{height:24px;padding:0 8px;font-size:11px}
317
+ .gp-btn--danger{border-color:transparent;background:var(--dsw-alias-state-error-primary);color:#fff}
318
+ .gp-btn--danger:hover:not(:disabled){background:color-mix(in srgb,var(--dsw-alias-state-error-primary) 85%,#000);color:#fff}
319
+
320
+ /* reset dialog: mode radios + hard-mode lost-files warning */
321
+ .gp-reset__modes{display:flex;flex-direction:column;gap:6px}
322
+ .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}
323
+ .gp-reset__mode--on{border-color:var(--dsw-alias-state-business-primary);background:var(--dsw-alias-bg-layer-2)}
324
+ .gp-reset__mode--danger.gp-reset__mode--on{border-color:var(--dsw-alias-state-error-primary)}
325
+ .gp-reset__mode .gp-check{margin-top:2px;flex:none}
326
+ .gp-reset__modetext{display:flex;flex-direction:column;gap:2px;min-width:0}
327
+ .gp-reset__modelabel{font-size:12px;color:var(--dsw-alias-label-primary)}
328
+ .gp-reset__mode--danger .gp-reset__modelabel{color:var(--dsw-alias-state-error-primary);font-weight:600}
329
+ .gp-reset__modehint{font-size:11px;line-height:1.4;color:var(--dsw-alias-label-tertiary)}
330
+ .gp-reset__lost{border:1px solid var(--dsw-alias-state-error-primary);border-radius:8px;padding:8px 10px;background:color-mix(in srgb,var(--dsw-alias-state-error-primary) 8%,transparent)}
331
+ .gp-reset__warn{font-size:12px;font-weight:600;color:var(--dsw-alias-state-error-primary);margin-bottom:4px}
332
+ .gp-reset__lostlist{margin:0;padding-left:16px;max-height:120px;overflow-y:auto;font-size:11px;font-family:var(--dsw-font-mono,ui-monospace,monospace);color:var(--dsw-alias-label-secondary)}
333
+ .gp-reset__lostlist li{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
334
+ .gp-reset__lostmore{font-family:inherit;color:var(--dsw-alias-label-tertiary);list-style:none;margin-left:-16px}
335
+ .gp-reset__ack{color:var(--dsw-alias-state-error-primary)}
336
+ .gp-reset__dirtywarn{font-size:11px;line-height:1.5;color:var(--dsw-alias-state-warn-primary,#e0982e)}
337
+
338
+ /* commit detail action area: tag chips on their own wrapping row (shown only
339
+ * when tags exist), action buttons on a second row below */
340
+ .gp-detail__ops{display:flex;flex-direction:column;align-items:flex-start;gap:8px;margin-bottom:10px}
341
+ .gp-detail__tags{display:flex;flex-wrap:wrap;align-items:center;gap:6px}
342
+ .gp-detail__tagname{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:180px}
343
+ .gp-detail__actions{display:flex;flex-wrap:wrap;align-items:center;gap:6px}
344
+ .gp-ref-chip--del{display:inline-flex;align-items:center;gap:4px;max-width:100%}
345
+ .gp-ref-chip__x{display:inline-flex;align-items:center;padding:0;margin-left:2px;border:none;background:none;color:inherit;cursor:pointer;opacity:.7}
346
+ .gp-ref-chip__x:hover{opacity:1;color:var(--dsw-alias-state-error-primary)}
347
+
348
+ /* stash list (changes page, below the change list) */
349
+ .gp-stash{flex:none;border-top:1px solid var(--dsw-alias-border-l2)}
350
+ .gp-stash-row{display:flex;align-items:center;gap:8px;padding:5px 10px;font-size:12px}
351
+ .gp-stash-row__info{flex:1;min-width:0;display:flex;flex-direction:column;gap:1px}
352
+ .gp-stash-row__msg{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-primary)}
353
+ .gp-stash-row__meta{display:flex;gap:8px;font-size:10px;color:var(--dsw-alias-label-tertiary)}
354
+ .gp-stash-row__actions{flex:none;display:flex;align-items:center;gap:4px}
355
+
293
356
  /* commit hover card (middle column): pointer-anchored, lists changed files */
294
357
  .gp-hovercard{position:fixed;z-index:70;padding:10px 12px;border:1px solid var(--dsw-alias-border-l1,var(--dsw-alias-border-l2));border-radius:10px;background:var(--dsw-alias-bg-layer-3,var(--dsw-alias-bg-layer-2));box-shadow:0 8px 28px rgba(0,0,0,.2),0 1px 3px rgba(0,0,0,.12);font-size:12px;pointer-events:none;max-height:60vh;overflow:hidden;display:flex;flex-direction:column}
295
- .gp-hovercard__subject{font-weight:600;color:var(--dsw-alias-label-primary);margin-bottom:4px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
296
- .gp-hovercard__meta{display:flex;gap:8px;font-size:11px;color:var(--dsw-alias-label-tertiary);margin-bottom:8px}
358
+ .gp-hovercard__subject{font-weight:600;color:var(--dsw-alias-label-primary);margin-bottom:4px;white-space:normal;word-break:break-word;overflow-wrap:anywhere}
359
+ .gp-hovercard__meta{display:flex;align-items:baseline;gap:8px;font-size:11px;color:var(--dsw-alias-label-tertiary);margin-bottom:8px;flex-wrap:wrap}
297
360
  .gp-hovercard__loading{font-size:11px;color:var(--dsw-alias-label-tertiary)}
298
361
  .gp-hovercard__body{margin:0;font-family:inherit;font-size:12px;line-height:1.5;color:var(--dsw-alias-label-secondary);white-space:pre-wrap;word-break:break-word;overflow-y:auto;min-height:0}
299
362
 
@@ -348,10 +411,96 @@ var module = { exports: {} }; var exports = module.exports;
348
411
  .gp-tip{position:fixed;z-index:60;max-width:520px;padding:8px 12px;border:1px solid var(--dsw-alias-border-l1,var(--dsw-alias-border-l2));border-radius:12px;background:var(--dsw-alias-bg-layer-3,var(--dsw-alias-bg-layer-2));box-shadow:0 6px 24px rgba(0,0,0,.18),0 1px 3px rgba(0,0,0,.12);font-size:12px;line-height:1.5;pointer-events:none}
349
412
  .gp-tip__path{color:var(--dsw-alias-label-primary);font-family:var(--dsw-font-mono,ui-monospace,monospace);word-break:break-all}
350
413
  .gp-tip__note{margin-top:4px;color:var(--dsw-alias-label-tertiary)}
351
- `,et=!1;function wt(){if(et||typeof document>"u")return;let e="dsh-git-panel/client.css";if(document.querySelector(`style[data-plugin-css="${e}"]`)!==null){et=!0;return}let t=document.createElement("style");t.dataset.plugin="@xbzbing/dsh-git-panel",t.dataset.pluginCss=e,t.textContent=Tn,document.head.appendChild(t),et=!0}var kt={"panel.tab":"Git","panel.fontDecrease":"\u7F29\u5C0F\u5B57\u4F53","panel.fontReset":"\u91CD\u7F6E\u5B57\u4F53\u5927\u5C0F","panel.fontIncrease":"\u653E\u5927\u5B57\u4F53","tab.overview":"Git \u603B\u89C8","tab.changes":"\u53D8\u66F4\u8BB0\u5F55","tab.files":"\u6587\u4EF6\u6D4F\u89C8","pill.unavailable":"Git \u4E0D\u53EF\u7528","pill.detached":"\u6E38\u79BB HEAD","pill.synced":"\u672C\u5730\u5DF2\u540C\u6B65","pill.dirty":"\u6709\u5F85\u63D0\u4EA4\u7684\u53D8\u66F4","common.loading":"\u52A0\u8F7D\u4E2D\u2026","common.retry":"\u91CD\u8BD5","common.close":"\u5173\u95ED","version.check":"\u68C0\u67E5\u65B0\u7248\u672C","version.checking":"\u68C0\u67E5\u4E2D\u2026","version.upToDate":"\u5DF2\u662F\u6700\u65B0\uFF08{current}\uFF09","version.updateAvailable":"\u6709\u65B0\u7248\u672C {latest}\uFF08\u5F53\u524D {current}\uFF09","version.viewRelease":"\u67E5\u770B\u53D1\u5E03","version.error":"\u68C0\u67E5\u5931\u8D25","version.noRepo":"\u672A\u914D\u7F6E\u4ED3\u5E93\u5730\u5740","version.openRepo":"\u5728 GitHub \u4E0A\u6253\u5F00\u4ED3\u5E93","overview.head":"HEAD\uFF08\u5F53\u524D\u5206\u652F\uFF09","overview.local":"\u672C\u5730","overview.remote":"\u8FDC\u7A0B","overview.tags":"\u6807\u7B7E","overview.search":"\u641C\u7D22\u63D0\u4EA4\uFF08\u6D88\u606F / \u54C8\u5E0C\uFF09","overview.searchShort":"\u641C\u7D22\u63D0\u4EA4","overview.allUsers":"\u5168\u90E8\u4F5C\u8005","overview.allTime":"\u5168\u90E8\u65F6\u95F4","overview.today":"\u4ECA\u5929","overview.last7d":"\u8FD1 7 \u5929","overview.last30d":"\u8FD1 30 \u5929","overview.selectCommit":"\u9009\u62E9\u4E00\u4E2A\u63D0\u4EA4\u67E5\u770B\u8BE6\u60C5","overview.noMessage":"\uFF08\u65E0\u63D0\u4EA4\u6B63\u6587\uFF09","overview.noResults":"\u6CA1\u6709\u5339\u914D\u7684\u63D0\u4EA4","overview.loadFailed":"\u52A0\u8F7D\u5931\u8D25","overview.detailFailed":"\u8BE6\u60C5\u52A0\u8F7D\u5931\u8D25","overview.diffFailed":"\u5DEE\u5F02\u52A0\u8F7D\u5931\u8D25","overview.openFileDiff":"\u67E5\u770B\u8BE5\u6587\u4EF6\u5728\u6B64\u63D0\u4EA4\u4E2D\u7684\u53D8\u66F4","overview.fetch":"\u62C9\u53D6\u8FDC\u7A0B","overview.branchesError":"\u5206\u652F\u52A0\u8F7D\u5931\u8D25","changes.groupStaged":"\u5DF2\u6682\u5B58\u7684\u66F4\u6539","changes.groupUnstaged":"\u66F4\u6539","changes.groupUntracked":"\u672A\u7248\u672C\u63A7\u5236\u7684\u6587\u4EF6","changes.selectFile":"\u9009\u62E9\u4E00\u4E2A\u6587\u4EF6\u67E5\u770B\u53D8\u66F4","changes.noChanges":"\u6CA1\u6709\u672A\u63D0\u4EA4\u7684\u53D8\u66F4","changes.stageAll":"\u5168\u90E8\u6682\u5B58","changes.unstageAll":"\u5168\u90E8\u53D6\u6D88\u6682\u5B58","changes.stage":"\u6682\u5B58","changes.unstage":"\u53D6\u6D88\u6682\u5B58","changes.discard":"\u653E\u5F03\u66F4\u6539","changes.discardConfirm":"\u518D\u6B21\u70B9\u51FB\u4EE5\u786E\u8BA4\u653E\u5F03","files.selectFile":"\u9009\u62E9\u4E00\u4E2A\u6587\u4EF6\u67E5\u770B\u5185\u5BB9","files.loadFailed":"\u52A0\u8F7D\u5931\u8D25","files.truncated":"\u6761\u76EE\u8FC7\u591A\uFF0C\u5DF2\u622A\u65AD","files.tooLarge":"\u6587\u4EF6\u8FC7\u5927\uFF0C\u65E0\u6CD5\u9884\u89C8","files.binary":"\u4E8C\u8FDB\u5236\u6587\u4EF6\uFF0C\u65E0\u6CD5\u9884\u89C8","files.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.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}","commit.placeholder":"\u63D0\u4EA4\u4FE1\u606F","commit.commit":"\u63D0\u4EA4","commit.amend":"\u4FEE\u6B63\u4E0A\u6B21\u63D0\u4EA4\uFF08amend\uFF09","diff.unified":"\u7EDF\u4E00","diff.split":"\u5BF9\u7167","diff.before":"\u53D8\u66F4\u524D","diff.after":"\u53D8\u66F4\u540E","diff.binary":"\u4E8C\u8FDB\u5236\u6587\u4EF6\uFF0C\u65E0\u6CD5\u663E\u793A\u5BF9\u7167","diff.tooLarge":"\u56FE\u7247\u8FC7\u5927\uFF0C\u65E0\u6CD5\u663E\u793A\u5BF9\u7167","diff.imageMissing":"\u4E0D\u5B58\u5728","diff.svgRender":"\u6E32\u67D3","diff.svgSource":"\u6E90\u7801","diff.empty":"\u65E0\u5DEE\u5F02","diff.expandAll":"\u5C55\u5F00\u5168\u90E8","diff.collapse":"\u6298\u53E0\u672A\u53D8\u66F4","diff.expandGap":"\u5C55\u5F00\u5168\u90E8 {n} \u884C","diff.expandUp":"\u5411\u4E0A\u5C55\u5F00 {n} \u884C","diff.expandDown":"\u5411\u4E0B\u5C55\u5F00 {n} \u884C","time.justNow":"\u521A\u521A","time.minutesAgo":"{n} \u5206\u949F\u524D","time.hoursAgo":"{n} \u5C0F\u65F6\u524D","time.daysAgo":"{n} \u5929\u524D","error.generic":"\u64CD\u4F5C\u5931\u8D25","error.notARepo":"\u5F53\u524D\u76EE\u5F55\u4E0D\u662F Git \u4ED3\u5E93","error.noCwd":"\u5F53\u524D\u4F1A\u8BDD\u65E0\u5DE5\u4F5C\u76EE\u5F55","error.localChangesBlock":"\u672C\u5730\u6709\u672A\u63D0\u4EA4\u53D8\u66F4\uFF0C\u65E0\u6CD5\u5207\u6362","error.emptyMessage":"\u63D0\u4EA4\u4FE1\u606F\u4E0D\u80FD\u4E3A\u7A7A","cfg.title":"\u8F93\u5165\u6846\u5206\u652F\u6807\u8BB0","cfg.toggle":"\u663E\u793A\u8F93\u5165\u6846\u6807\u8BB0","cfg.hint":"\u5F00\u542F\u65F6\u5728\u8F93\u5165\u6846\u663E\u793A zsh \u98CE\u683C\u7684 <\u4ED3\u5E93\u540D> (\u5206\u652F) \u6807\u8BB0\uFF1B\u5173\u95ED\u540E\u6539\u4E3A\u5728 Git \u6807\u7B7E\u65C1\u663E\u793A\u72B6\u6001\u5706\u70B9\u3002\u4FDD\u5B58\u540E\u7ACB\u5373\u751F\u6548\u3002","cfg.diffTitle":"\u5DEE\u5F02\u5BF9\u6BD4\u9ED8\u8BA4\u89C6\u56FE","cfg.diffHint":"\u9009\u62E9\u53D8\u66F4\u5BF9\u6BD4\u9ED8\u8BA4\u6253\u5F00\u7684\u5E03\u5C40\uFF1A\u7EDF\u4E00\u89C6\u56FE\u4E3A\u5355\u680F\u884C\u5185\u5BF9\u6BD4\uFF0C\u5E76\u6392\u89C6\u56FE\u4E3A\u5DE6\u53F3\u5206\u680F\u5BF9\u6BD4\u3002\u4ECD\u53EF\u5728\u6BCF\u4E2A\u5DEE\u5F02\u89C6\u56FE\u4E2D\u4E34\u65F6\u5207\u6362\u3002\u4FDD\u5B58\u540E\u7ACB\u5373\u751F\u6548\u3002","cfg.diffUnified":"\u7EDF\u4E00\u89C6\u56FE\uFF08\u5355\u680F\u884C\u5185\uFF09","cfg.diffSplit":"\u5E76\u6392\u89C6\u56FE\uFF08\u5DE6\u53F3\u5206\u680F\uFF09","cfg.notLoaded":"\u914D\u7F6E\u672A\u52A0\u8F7D\uFF1A\u8BE5\u914D\u7F6E\u7531\u8FD0\u884C\u4E2D\u7684\u5BBF\u4E3B\u63D0\u4F9B\uFF0C\u82E5\u957F\u65F6\u95F4\u7A7A\u767D\u8BF7\u91CD\u542F DSH \u540E\u91CD\u8BD5\u3002","cfg.saveFailed":"\u4FDD\u5B58\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"},_t={"panel.tab":"Git","panel.fontDecrease":"Decrease font size","panel.fontReset":"Reset font size","panel.fontIncrease":"Increase font size","tab.overview":"Overview","tab.changes":"Changes","tab.files":"Files","pill.unavailable":"Git unavailable","pill.detached":"detached HEAD","pill.synced":"Everything committed","pill.dirty":"Uncommitted changes","common.loading":"Loading\u2026","common.retry":"Retry","common.close":"Close","version.check":"Check for updates","version.checking":"Checking\u2026","version.upToDate":"Up to date ({current})","version.updateAvailable":"New version {latest} available (current {current})","version.viewRelease":"View release","version.error":"Check failed","version.noRepo":"Repository not configured","version.openRepo":"Open repository on GitHub","overview.head":"HEAD (Current Branch)","overview.local":"Local","overview.remote":"Remote","overview.tags":"Tags","overview.search":"Search commits (message / hash)","overview.searchShort":"Search","overview.allUsers":"All authors","overview.allTime":"All time","overview.today":"Today","overview.last7d":"Last 7 days","overview.last30d":"Last 30 days","overview.selectCommit":"Select a commit to see details","overview.noMessage":"(no commit body)","overview.noResults":"No matching commits","overview.loadFailed":"Load failed","overview.detailFailed":"Failed to load details","overview.diffFailed":"Failed to load diff","overview.openFileDiff":"View this file\u2019s changes in this commit","overview.fetch":"Fetch","overview.branchesError":"Failed to load branches","changes.groupStaged":"Staged changes","changes.groupUnstaged":"Changes","changes.groupUntracked":"Unversioned files","changes.selectFile":"Select a file to see its diff","changes.noChanges":"No uncommitted changes","changes.stageAll":"Stage all","changes.unstageAll":"Unstage all","changes.stage":"Stage","changes.unstage":"Unstage","changes.discard":"Discard changes","changes.discardConfirm":"Click again to confirm discard","files.selectFile":"Select a file to preview","files.loadFailed":"Load failed","files.truncated":"Too many entries \u2014 truncated","files.tooLarge":"File too large to preview","files.binary":"Binary file \u2014 no preview","files.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.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","commit.placeholder":"Commit message","commit.commit":"Commit","commit.amend":"Amend previous commit","diff.unified":"Unified","diff.split":"Split","diff.before":"Before","diff.after":"After","diff.binary":"Binary file \u2014 no diff to show","diff.tooLarge":"Image too large to compare","diff.imageMissing":"Does not exist","diff.svgRender":"Rendered","diff.svgSource":"Source","diff.empty":"No differences","diff.expandAll":"Expand all","diff.collapse":"Collapse unchanged","diff.expandGap":"Expand all {n} lines","diff.expandUp":"Expand up {n} lines","diff.expandDown":"Expand down {n} lines","time.justNow":"just now","time.minutesAgo":"{n}m ago","time.hoursAgo":"{n}h ago","time.daysAgo":"{n}d ago","error.generic":"Operation failed","error.notARepo":"Not a Git repository","error.noCwd":"This session has no working directory","error.localChangesBlock":"Local changes block the checkout","error.emptyMessage":"Commit message cannot be empty","cfg.title":"Input-bar branch marker","cfg.toggle":"Show input-bar marker","cfg.hint":"When on, the input bar shows the zsh-style <repo> (branch) marker; when off, a status dot appears beside the Git tab instead. Saved changes apply immediately.","cfg.diffTitle":"Default diff view","cfg.diffHint":"Choose the layout diffs open with: unified is a single inline column, split is side-by-side. You can still switch per diff. Saved changes apply immediately.","cfg.diffUnified":"Unified (single inline column)","cfg.diffSplit":"Split (side-by-side)","cfg.notLoaded":"Config not loaded: it is served by the running host. Restart DSH if this stays blank.","cfg.saveFailed":"Save failed, please retry"};var Ee=require("react");var Rn=new Set(["cwd-unavailable"]),tt=3e4,En=6e4,Te=class{constructor(t,n){this.remote=t;this.sessionId=n}view={state:"cold"};listeners=new Set;timer;inflight;pendingRefresh=!1;disposed=!1;pollMs=tt;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||tt,this.setView({state:"ready",snapshot:t.value});else if(t.error.code!=="cancelled")if(Rn.has(t.error.code))this.pollMs=En,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||tt,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 Mn="/api",Dn="gitPanel";function Fn(e){try{let t=e.get("connection")?.rpc,n=t?.call;if(t!==void 0&&typeof n=="function")return(r,i,a)=>n.call(t,Mn,r,i,a)}catch{}}function An(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 Z(e,t){return!e.ok||e.value.kind!==t?null:e.value}function pe(e){return e!==void 0&&e!==""}var St=new WeakMap;function xe(e){let t=St.get(e);if(t!==void 0)return t;let n=async(i,a,s)=>{let o=Fn(e);if(o===void 0)return{ok:!1,error:{code:"git-unavailable",message:"no connection"}};try{let l=await o(`${Dn}/${i}`,{args:{request:a}},s);return An(l)}catch(l){return{ok:!1,error:{code:"git-unavailable",message:l instanceof Error?l.message:String(l)}}}},r={snapshot:(i,a)=>n("snapshot",i,a),run:(i,a)=>n("run",i,a),query:(i,a)=>n("query",i,a),version:(i,a)=>n("version",i,a)};return St.set(e,r),r}var fe=new Map,Ct,nt;function Nt(e){nt=e,Ct=xe(e)}function rt(e){let t=fe.get(e);if(t===void 0){let n=Ct??(nt?xe(nt):void 0);t=new Te(n??Hn(),e),fe.set(e,t)}return t}var Pn=6e4,Re=new Map;function Ln(e){let t=Re.get(e);t!==void 0&&(clearTimeout(t),Re.delete(e)),me.set(e,(me.get(e)??0)+1)}function $n(e){let t=(me.get(e)??1)-1;if(t>0){me.set(e,t);return}me.delete(e);let n=setTimeout(()=>{Re.delete(e),!((me.get(e)??0)>0)&&(fe.get(e)?.dispose(),fe.delete(e))},Pn);Re.set(e,n)}var me=new Map;function we(){for(let e of fe.values())e.resync()}function Gt(){for(let e of fe.values())e.dispose();fe.clear()}function Hn(){let e=async()=>({ok:!1,error:{code:"git-unavailable"}});return{snapshot:e,run:e,query:e,version:e}}function Me(e){let[,t]=(0,Ee.useState)(0),n=e?rt(e):void 0;return(0,Ee.useEffect)(()=>{if(n===void 0||e===void 0)return;Ln(e);let r=n.subscribe(()=>t(i=>i+1));return n.ensure(),()=>{r(),$n(e)}},[n,e]),n?n.getSnapshot():{state:"cold"}}var S=require("react");var Tt="[data-conversation-tabs]",_e='[data-conversation-tabs] button[role="tab"]',it=new Map,ke=new Map;function Rt(e,t){let n=ke.get(e);if(n!==void 0&&n.size>0){for(let r of n)r(t);return}it.set(e,t)}function Et(e){let t=it.get(e);return t===void 0?null:(it.delete(e),t)}function Mt(e,t){let n=ke.get(e);return n===void 0&&(n=new Set,ke.set(e,n)),n.add(t),()=>{let r=ke.get(e);r!==void 0&&(r.delete(t),r.size===0&&ke.delete(e))}}var zn=6e4,at=new Map;function Dt(e,t){at.set(e,{tab:t,leftAt:Date.now()})}function Ft(e){let t=at.get(e);return t===void 0?null:Date.now()-t.leftAt>zn?(at.delete(e),null):t.tab}function At(e){if(typeof document>"u")return!1;let t=document.querySelectorAll(_e);for(let n of t)if((n.textContent??"").trim()===e)return n.getAttribute("aria-selected")!=="true"&&n.click(),!0;return!1}function Pt(e){if(typeof document>"u")return!1;let t=document.querySelectorAll(_e);for(let n of t)if((n.textContent??"").trim()===e)return n.getAttribute("aria-selected")==="true";return!1}function Lt(e){if(typeof document>"u")return!1;let t=document.querySelectorAll(_e);for(let n of t)if((n.textContent??"").trim()!==e)return n.getAttribute("aria-selected")!=="true"&&n.click(),!0;return!1}var p=require("react"),ft=require("react-dom");var V=require("react");function le(e,t=15){return(0,V.createElement)("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"},e)}function De({size:e}){return le([(0,V.createElement)("circle",{key:"c",cx:8,cy:8,r:2.4}),(0,V.createElement)("line",{key:"l1",x1:8,y1:1.5,x2:8,y2:5.6}),(0,V.createElement)("line",{key:"l2",x1:8,y1:10.4,x2:8,y2:14.5})],e)}function $t({size:e}){return le([(0,V.createElement)("path",{key:"a",d:"M4 2v8"}),(0,V.createElement)("path",{key:"b",d:"M2 4h4"}),(0,V.createElement)("circle",{key:"c",cx:4,cy:12,r:1.6}),(0,V.createElement)("circle",{key:"d",cx:12,cy:4,r:1.6}),(0,V.createElement)("path",{key:"e",d:"M12 6v4"}),(0,V.createElement)("path",{key:"f",d:"M10 12h4"})],e)}function ot({size:e}){return le([(0,V.createElement)("circle",{key:"a",cx:4,cy:3,r:1.6}),(0,V.createElement)("circle",{key:"b",cx:4,cy:13,r:1.6}),(0,V.createElement)("circle",{key:"c",cx:12,cy:5,r:1.6}),(0,V.createElement)("path",{key:"d",d:"M4 4.6v6.8"}),(0,V.createElement)("path",{key:"e",d:"M12 6.6c0 3-4 2.4-8 4"})],e)}function Ht({size:e}){return le([(0,V.createElement)("path",{key:"a",d:"M2 7V3h4l8 8-4 4z"}),(0,V.createElement)("circle",{key:"b",cx:4.5,cy:5.5,r:.8,fill:"currentColor"})],e)}function ge({size:e,open:t}){return le([(0,V.createElement)("path",{key:"a",d:t?"M3 6l5 5 5-5":"M6 3l5 5-5 5"})],e)}function zt({size:e}){return le([(0,V.createElement)("path",{key:"a",d:"M4 4l8 8M12 4l-8 8"})],e)}function Fe({size:e}){return le([(0,V.createElement)("path",{key:"a",d:"M13 8a5 5 0 1 1-1.5-3.5"}),(0,V.createElement)("path",{key:"b",d:"M13 2v3h-3"})],e)}function It({size:e}){return le([(0,V.createElement)("path",{key:"a",d:"M4 2h5l3 3v9H4z"}),(0,V.createElement)("path",{key:"b",d:"M9 2v3h3"})],e)}function Xt({size:e}){return le([(0,V.createElement)("path",{key:"a",d:"M5 2.5h4l2.5 2.5v7.5h-6.5z"}),(0,V.createElement)("path",{key:"b",d:"M9 2.5V5h2.5"}),(0,V.createElement)("path",{key:"c",d:"M11 12.5v1.5h-6.5V6"})],e)}function Vt({size:e=15}){return(0,V.createElement)("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"currentColor"},(0,V.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 Kt(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 qt(e){let t=[],n=[],r=new Map,i=0,a=s=>{let o=r.get(s);return o===void 0&&(o=i++,r.set(s,o)),o};for(let s of e){let o=x=>{let _=n.findIndex(F=>F===x);return _===-1&&(_=n.findIndex(F=>F===null),_===-1&&(_=n.length,n.push(null)),n[_]=x),_},l=o(s.hash),d=a(s.hash),g=[...n],c=s.parents,u=c.length>=2;for(let x=0;x<n.length;x++)x!==l&&n[x]===s.hash&&(n[x]=null);if(c.length===0)n[l]=null;else{n[l]=c[0],a(c[0]);for(let x=1;x<c.length;x++){let _=c[x];o(_),a(_)}}let m=[],k=n;for(let x=0;x<g.length;x++){let _=g[x];if(_!==null)if(_===s.hash)m.push({fromLane:x,toLane:l,color:d});else{let F=k.findIndex(v=>v===_);F!==-1&&m.push({fromLane:x,toLane:F,color:a(_)})}}for(let x of c){let _=k.findIndex(F=>F===x);_!==-1&&m.push({fromLane:l,toLane:_,color:a(x)})}for(t.push({commit:s,lane:l,color:d,edges:m,merge:u});n.length>0&&n[n.length-1]===null;)n=n.slice(0,-1)}return t}function Jt(e){let t={name:"",path:"",dir:!0,children:[]};for(let n of e){let r=n.path.split("/").filter(s=>s!==""),i=t,a="";for(let s=0;s<r.length;s++){let o=r[s];a=a===""?o:`${a}/${o}`;let l=s===r.length-1,d=i.children.find(g=>g.name===o&&g.dir===!l);d===void 0&&(d={name:o,path:a,dir:!l,children:[],...l?{meta:n.meta}:{}},i.children.push(d)),i=d}}return Bt(t),Ot(t.children)}function Bt(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)Bt(t)}function Ot(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:Ot(n.children)}})}function Se(e,t,n){if(e===null)return"";let r=typeof e=="number"?e:Date.parse(e);if(!Number.isFinite(r))return"";let i=Math.max(0,t-r),a=Math.floor(i/6e4);if(a<1)return n("time.justNow");if(a<60)return n("time.minutesAgo",{n:a});let s=Math.floor(a/60);if(s<24)return n("time.hoursAgo",{n:s});let o=Math.floor(s/24);return n("time.daysAgo",{n:o})}function Ce(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 Wt(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 Ae={added:"A",modified:"M",deleted:"D",renamed:"R",untracked:"U",conflicted:"!",typechange:"T"};function Pe(e){return e==="added"||e==="untracked"?"gp-status--added":e==="deleted"?"gp-status--deleted":e==="renamed"?"gp-status--renamed":"gp-status--modified"}var h=require("react");var In={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 st(e){let t=e.lastIndexOf(".");return t<0?null:In[e.slice(t+1).toLowerCase()]??null}function Ut(e){return/^Binary files .* differ$/m.test(e)||/^GIT binary patch$/m.test(e)}function jt(e){return st(e)!==null}function Qt(e){return/\.svg$/i.test(e)}function Xn(e){let t=lt(e);return t.length===0?!1:t.every(n=>n.startsWith("+")||n.startsWith(" "))&&t.some(n=>n.startsWith("+"))&&/^\+\+\+ /m.test(e)&&/--- \/dev\/null/m.test(e)}function Vn(e){let t=lt(e);return t.length===0?!1:t.every(n=>n.startsWith("-")||n.startsWith(" "))&&t.some(n=>n.startsWith("-"))&&/^\+\+\+ \/dev\/null/m.test(e)}function lt(e){let t=e.split(`
352
- `),n=[],r=!1;for(let i of t){if(i.startsWith("@@")){r=!0;continue}if(r){if(i.startsWith("diff ")||i.startsWith("index ")){r=!1;continue}i!==""&&n.push(i)}}return n}function Yt(e){let t=0,n=0;for(let r of lt(e))r.startsWith("+")?t++:r.startsWith("-")&&n++;return{add:t,del:n}}var Kn=/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/;function Zt(e){let t=[],n=e.split(`
353
- `),r=0,i=0,a=!0,s=!1,o=0;for(;o<n.length&&!n[o].startsWith("@@");o++);for(;o<n.length;o++){let l=n[o];if(l.startsWith("@@")){let c=Kn.exec(l);if(c){let u=Number(c[1]),m=Number(c[3]),k=u-m;if(a)m>1&&t.push(he({rightStart:1,count:m-1,delta:k,atStart:!0,atEnd:!1}));else{let x=m-i;x>0&&t.push(he({rightStart:i,count:x,delta:k,atStart:!1,atEnd:!1}))}r=u,i=m,a=!1}t.push({kind:"hunk",leftNo:null,rightNo:null,leftText:null,rightText:null,text:l});continue}if(l.startsWith("\\"))continue;let d=l[0],g=l.slice(1);d==="+"?(t.push({kind:"add",leftNo:null,rightNo:i,leftText:null,rightText:g}),i++,s=!0):d==="-"?(t.push({kind:"del",leftNo:r,rightNo:null,leftText:g,rightText:null}),r++,s=!0):d===" "&&(t.push({kind:"context",leftNo:r,rightNo:i,leftText:g,rightText:g}),r++,i++,s=!0)}return s&&!a&&!Xn(e)&&!Vn(e)&&t.push(he({rightStart:i,count:null,delta:r-i,atStart:!1,atEnd:!0})),qn(t)}function he(e){return{kind:"gap",leftNo:null,rightNo:null,leftText:null,rightText:null,gap:e}}function qn(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(r.kind==="del"){let i=[],a=n;for(;a<e.length&&e[a].kind==="del";)i.push(e[a]),a++;let s=[];for(;a<e.length&&e[a].kind==="add";)s.push(e[a]),a++;let o=Math.max(i.length,s.length);for(let l=0;l<o;l++){let d=i[l],g=s[l];if(d&&g){let c=Jn(d.leftText??"",g.rightText??"");t.push({kind:"mod",leftNo:d.leftNo,rightNo:g.rightNo,leftText:d.leftText,rightText:g.rightText,...c!==null?{leftWord:c.left,rightWord:c.right}:{}})}else d?t.push({kind:"del",leftNo:d.leftNo,rightNo:null,leftText:d.leftText,rightText:null}):g&&t.push({kind:"add",leftNo:null,rightNo:g.rightNo,leftText:null,rightText:g.rightText})}n=a}else t.push(r),n++}return t}function Jn(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;let i=0;for(;i<n-r&&e[e.length-1-i]===t[t.length-1-i];)i++;return r===0&&i===0?null:{left:[r,e.length-i],right:[r,t.length-i]}}function Bn(e,t,n){return n.map((r,i)=>{let a=t+i;return{kind:"context",leftNo:a+e,rightNo:a,leftText:r,rightText:r}})}var oe=20;function dt(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 en(e,t,n,r,i,a){let s=e.findIndex(c=>c.kind==="gap"&&c.gap?.rightStart===t);if(s<0)return e.slice();let o=e[s].gap,l=Bn(o.delta,r,i),d=[];if(o.atEnd)return d.push(...l),!a&&i.length>0&&d.push(he({rightStart:r+i.length,count:null,delta:o.delta,atStart:!1,atEnd:!0})),[...e.slice(0,s),...d,...e.slice(s+1)];let g=o.count??i.length;if(n==="all"||i.length>=g)d.push(...l);else if(n==="down"){d.push(...l);let c=g-i.length;d.push(he({rightStart:o.rightStart+i.length,count:c,delta:o.delta,atStart:!1,atEnd:!1}))}else{let c=g-i.length;d.push(he({rightStart:o.rightStart,count:c,delta:o.delta,atStart:o.atStart,atEnd:!1})),d.push(...l)}return[...e.slice(0,s),...d,...e.slice(s+1)]}var Je=require("@deepseek-ai/dsh-client-ui-primitives");function tn(e,t){let n=[[],[],[]],r=0;for(let i of e){let a=r+i.text.length,s=[r,Math.max(r,Math.min(a,t[0])),Math.max(r,Math.min(a,t[1])),a];for(let o=0;o<3;o++){let l=i.text.slice(s[o]-r,s[o+1]-r);l!==""&&n[o].push({text:l,style:i.style})}r=a}return n}var te=require("react"),Le=5e3,$e=120;function He(e,t){let[n,r]=(0,te.useState)(e);return(0,te.useEffect)(()=>{let i=setTimeout(()=>r(e),t);return()=>clearTimeout(i)},[e,t]),n}function ze(e,t){if(t==="")return[];let n=[],r=0;for(;;){let i=e.indexOf(t,r);if(i<0)break;n.push([i,i+t.length]),r=i+t.length}return n}function ct(e,t,n,r,i){if(n>=r)return[];if(e===void 0)return[t.slice(n,r)];let a=[],s=0,o=0;for(let l of e){let d=s+l.text.length,g=Math.max(n,s),c=Math.min(r,d);if(c>g&&a.push((0,te.createElement)("span",{key:`${i}-${o++}`,style:l.style},l.text.slice(g-s,c-s))),s=d,s>=r)break}return a}function Ie(e,t,n,r,i,a){let s=[],o=0,l=[...t].sort((d,g)=>d[0]-g[0]);for(let[d,g]of l){if(d<o)continue;d>o&&s.push(...ct(n,e,o,d,`${r}b${o}`));let c=i!==null&&i[0]===d&&i[1]===g;s.push((0,te.createElement)("mark",{key:`mk${r}-${d}`,className:`gp-find-hit${c?" gp-find-hit--active":""}`,...c?{ref:a}:{}},ct(n,e,d,g,`mk${r}-${d}`))),o=g}return o<e.length&&s.push(...ct(n,e,o,e.length,`${r}e`)),s}function Xe(e){return(0,te.createElement)("div",{key:"find",className:"gp-find"},[(0,te.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,te.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,te.createElement)("span",{key:"cnt",className:"gp-find__count"},e.query===""?"":e.matches===0?e.t("files.findNoMatch"):`${e.active+1}/${e.matches}`),(0,te.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,te.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,te.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 de=require("react");function Ve(e,t,n){let r=n(`diff.${e}`);return(0,de.createElement)("div",{className:`gp-imgcmp__pane gp-imgcmp__pane--${e}`},[(0,de.createElement)("div",{key:"head",className:"gp-imgcmp__head"},r),t===void 0?(0,de.createElement)("div",{key:"missing",className:"gp-imgcmp__missing"},n("diff.imageMissing")):(0,de.createElement)("div",{key:"img",className:"gp-imgcmp__img"},(0,de.createElement)("img",{src:t,alt:r}))])}function nn({oldUrl:e,newUrl:t,mode:n,t:r}){return n==="before"?(0,de.createElement)("div",{className:"gp-imgcmp gp-imgcmp--single"},Ve("before",e,r)):n==="after"?(0,de.createElement)("div",{className:"gp-imgcmp gp-imgcmp--single"},Ve("after",t,r)):(0,de.createElement)("div",{className:"gp-imgcmp"},[Ve("before",e,r),Ve("after",t,r)])}var Be=(0,h.memo)(function({text:t,mode:n,path:r,remote:i,sessionId:a,imageSpec:s,t:o}){let l=(0,h.useMemo)(()=>Zt(t),[t]),d=Ut(t),g=(0,Je.useCodeHighlighter)(r===void 0?void 0:(0,Je.languageForPath)(r)),[c,u]=(0,h.useState)(l);(0,h.useEffect)(()=>{u(l)},[l]);let m=Un(c,u,i,a,r,s),k=r!==void 0&&Qt(r),[x,_]=(0,h.useState)("render");(0,h.useEffect)(()=>{_("render")},[r]);let v=(d||k)&&r!==void 0&&jt(r)&&i!==void 0&&a!==void 0&&s!==void 0&&(!k||x==="render"),M=Qn(v?i:void 0,v?a:void 0,v?r:void 0,v?s:void 0),[z,A]=(0,h.useState)(!1),[C,N]=(0,h.useState)(""),[O,D]=(0,h.useState)(!1),[U,Q]=(0,h.useState)(0),j=(0,h.useRef)(null),ne=(0,h.useRef)(null),T=(0,h.useRef)(null);(0,h.useEffect)(()=>{A(!1),N(""),Q(0)},[t,r]);let I=(0,h.useMemo)(()=>On(n,c),[n,c]),X=(0,h.useMemo)(()=>I.map(J=>({key:J.key,text:J.text.toLowerCase()})),[I]),P=He(C,$e),ee=O?P:P.toLowerCase(),$=O?I:X,w=(0,h.useMemo)(()=>Wn($,ee),[$,ee]);(0,h.useEffect)(()=>{Q(0)},[ee]);let L=w.length===0?0:Math.min(U,w.length-1),q=w.length>0?w[L]:null,re=(0,h.useMemo)(()=>{let J=new Map;for(let H of w){let se=J.get(H.cellKey)??[];se.push([H.start,H.end]),J.set(H.cellKey,se)}return J},[w]);(0,h.useEffect)(()=>{let J=H=>{if(!((H.ctrlKey||H.metaKey)&&(H.key==="f"||H.key==="F")))return;let se=j.current;se===null||se.offsetParent===null||(H.preventDefault(),A(!0),requestAnimationFrame(()=>ne.current?.select()))};return document.addEventListener("keydown",J),()=>document.removeEventListener("keydown",J)},[]),(0,h.useEffect)(()=>{T.current?.scrollIntoView({block:"center",inline:"nearest"})},[L,w]);let Y=(0,h.useCallback)(J=>{Q(H=>w.length===0?0:(H+J+w.length)%w.length)},[w.length]),G=z&&ee!==""?{perCell:re,activeKey:q?.cellKey??null,activeRange:q?[q.start,q.end]:null,activeRef:T}:null;if(v){let J=(()=>{if(M.kind==="idle"||M.kind==="loading")return(0,h.createElement)("div",{className:"gp-empty"},o("common.loading"));if(M.kind==="ready"){let H=M.res;if(H.tooLarge===!0)return(0,h.createElement)("div",{className:"gp-empty"},o("diff.tooLarge"));if(H.mime!==null&&(H.old!==void 0||H.new!==void 0))return(0,h.createElement)(nn,{oldUrl:H.old,newUrl:H.new,mode:n,t:o})}return(0,h.createElement)("div",{className:"gp-empty"},o("diff.binary"))})();return k?rn(x,_,J,o):J}if(d&&!k)return(0,h.createElement)("div",{className:"gp-empty"},o("diff.binary"));let y=(()=>{if(t.trim()==="")return(0,h.createElement)("div",{className:"gp-empty"},o("diff.empty"));if(n==="before")return an(sn(c),g,G);if(n==="after")return an(ln(c),g,G);if(n==="unified"){let J=dt(c);return(0,h.createElement)("div",{className:"gp-diff__unified"},J.flatMap((H,se)=>Zn(H,se,g,m,G,o)))}return(0,h.createElement)("div",{className:"gp-diff__side"},c.flatMap((J,H)=>Yn(J,H,g,m,G,o)))})(),R=z?(0,h.createElement)(Xe,{inputRef:ne,query:C,matches:w.length,active:L,caseSensitive:O,onChange:N,onToggleCase:()=>D(J=>!J),onStep:Y,onClose:()=>A(!1),t:o}):null,K=(0,h.createElement)("div",{className:"gp-diff__wrap",ref:j},[R,y]);return k?rn(x,_,K,o):K});function On(e,t){let n=[];return e==="before"?(sn(t).forEach((r,i)=>n.push({key:`c${i}`,text:r.text})),n):e==="after"?(ln(t).forEach((r,i)=>n.push({key:`c${i}`,text:r.text})),n):e==="unified"?(dt(t).forEach((r,i)=>{if(r.kind==="hunk"||r.kind==="gap")return;let a=r.rightText??r.leftText??"";a!==""&&n.push({key:`c${i}`,text:a})}),n):(t.forEach((r,i)=>{r.kind==="hunk"||r.kind==="gap"||(r.leftText!==null&&r.leftText!==""&&n.push({key:`l${i}`,text:r.leftText}),r.rightText!==null&&r.rightText!==""&&n.push({key:`r${i}`,text:r.rightText}))}),n)}function Wn(e,t){if(t==="")return[];let n=[];for(let r of e)for(let[i,a]of ze(r.text,t))if(n.push({cellKey:r.key,start:i,end:a}),n.length>=Le)return n;return n}function rn(e,t,n,r){let i=(a,s)=>(0,h.createElement)("button",{key:a,type:"button",className:`gp-seg__btn${e===a?" gp-seg__btn--active":""}`,"aria-pressed":e===a,onClick:()=>t(a)},s);return(0,h.createElement)("div",{className:"gp-svgdiff"},[(0,h.createElement)("div",{key:"bar",className:"gp-svgdiff__bar"},(0,h.createElement)("div",{className:"gp-seg"},[i("render",r("diff.svgRender")),i("source",r("diff.svgSource"))])),(0,h.createElement)("div",{key:"body",className:"gp-svgdiff__body"},n)])}function Un(e,t,n,r,i,a){let[s,o]=(0,h.useState)(null),l=(0,h.useRef)(0);(0,h.useEffect)(()=>{l.current+=1,o(null)},[e]);let d=(0,h.useCallback)((g,c)=>{if(n===void 0||r===void 0||i===void 0||a===void 0)return;let u=`${g.rightStart}:${c}`;o(u);let m=++l.current,{start:k,end:x}=jn(g,c),_=a.base==="commit"&&a.commit!==void 0?{kind:"file-lines",path:i,base:"commit",commit:a.commit,start:k,end:x}:a.base==="staged"?{kind:"file-lines",path:i,base:"staged",start:k,end:x}:{kind:"file-lines",path:i,base:"worktree",start:k,end:x};n.query({sessionId:r,query:_}).then(F=>{if(m!==l.current)return;let v=Z(F,"file-lines");o(null),v!==null&&t(M=>en(M,g.rightStart,c,v.start,v.lines,v.eof))}).catch(()=>{m===l.current&&o(null)})},[n,r,i,a,t]);return{busy:s,run:d}}function jn(e,t){if(e.atEnd)return{start:e.rightStart,end:e.rightStart+oe-1};let n=e.count??oe;return t==="all"||n<=oe?{start:e.rightStart,end:e.rightStart+n-1}:t==="down"?{start:e.rightStart,end:e.rightStart+oe-1}:{start:e.rightStart+n-oe,end:e.rightStart+n-1}}function Qn(e,t,n,r){let[i,a]=(0,h.useState)({kind:"idle"}),s=r?.base,o=r?.commit;return(0,h.useEffect)(()=>{if(e===void 0||t===void 0||n===void 0||s===void 0)return;let l=!0;a({kind:"loading"});let d=s==="commit"&&o!==void 0?{kind:"image-diff",path:n,base:"commit",commit:o}:s==="staged"?{kind:"image-diff",path:n,base:"staged"}:{kind:"image-diff",path:n,base:"worktree"};return e.query({sessionId:t,query:d}).then(g=>{if(!l)return;let c=Z(g,"image-diff");a(c!==null?{kind:"ready",res:c}:{kind:"failed"})}).catch(()=>{l&&a({kind:"failed"})}),()=>{l=!1}},[e,t,n,s,o]),i}function Ke(e,t=""){return e.map((n,r)=>(0,h.createElement)("span",{key:`${t}${r}`,style:n.style},n.text))}function on(e,t,n,r){if(n===null)return null;let i=n.perCell.get(t);if(i===void 0||i.length===0)return null;let a=n.activeKey===t?n.activeRange:null;return Ie(e,i,r,t,a,n.activeRef)}function qe(e,t,n,r,i=null){if(n==="")return(0,h.createElement)("div",{key:t,className:e},"\xA0");let a=r(n)?.[0],s=on(n,t,i,a);return s!==null?(0,h.createElement)("div",{key:t,className:e},s):(0,h.createElement)("div",{key:t,className:e},a===void 0?n:Ke(a))}function pt(e,t,n,r,i,a,s=null){let o=a(n)?.[0]??[{text:n,style:{}}],l=on(n,t,s,o);if(l!==null)return(0,h.createElement)("div",{key:t,className:e},l);let[d,g,c]=tn(o,r);return(0,h.createElement)("div",{key:t,className:e},[...Ke(d,"p"),(0,h.createElement)("span",{key:"w",className:i},g.length===0?"\xA0":Ke(g)),...Ke(c,"s")])}function sn(e){return e.filter(t=>t.leftText!==null).map(t=>({no:t.leftNo,text:t.leftText}))}function ln(e){return e.filter(t=>t.rightText!==null).map(t=>({no:t.rightNo,text:t.rightText}))}function an(e,t,n=null){return(0,h.createElement)("div",{className:"gp-diff__single"},e.flatMap((r,i)=>[(0,h.createElement)("div",{key:`n${i}`,className:"gp-diff-no"},r.no??""),qe("gp-diff-cell",`c${i}`,r.text,t,n)]))}function Yn(e,t,n,r,i,a){if(e.kind==="hunk")return[(0,h.createElement)("div",{key:`h${t}`,className:"gp-diff-row--hunk gp-diff-cell",style:{gridColumn:"1 / -1"}},e.text??"")];if(e.kind==="gap")return[dn(e.gap,t,r,a)];let s=e.kind==="del"||e.kind==="mod"?"gp-diff-row--del":"",o=e.kind==="add"||e.kind==="mod"?"gp-diff-row--add":"",l=e.leftText===null?(0,h.createElement)("div",{key:`l${t}`,className:`gp-diff-cell ${s}`}):e.kind==="mod"&&e.leftWord!==void 0?pt(`gp-diff-cell ${s}`,`l${t}`,e.leftText,e.leftWord,"gp-diff-word gp-diff-word--del",n,i):qe(`gp-diff-cell ${s}`,`l${t}`,e.leftText,n,i),d=e.rightText===null?(0,h.createElement)("div",{key:`r${t}`,className:`gp-diff-cell ${o}`}):e.kind==="mod"&&e.rightWord!==void 0?pt(`gp-diff-cell ${o}`,`r${t}`,e.rightText,e.rightWord,"gp-diff-word gp-diff-word--add",n,i):qe(`gp-diff-cell ${o}`,`r${t}`,e.rightText,n,i);return[(0,h.createElement)("div",{key:`ln${t}`,className:"gp-diff-no"},e.leftNo??""),l,(0,h.createElement)("div",{key:`rn${t}`,className:"gp-diff-no"},e.rightNo??""),d]}function Zn(e,t,n,r,i,a){if(e.kind==="hunk")return[(0,h.createElement)("div",{key:`h${t}`,className:"gp-diff-row--hunk gp-diff-cell",style:{gridColumn:"1 / -1"}},e.text??"")];if(e.kind==="gap")return[dn(e.gap,t,r,a)];let s=e.kind==="del",o=e.kind==="add",l=o?"gp-diff-row--add":s?"gp-diff-row--del":"",d=o?"+":s?"\u2212":"\xA0",g=e.rightText??e.leftText??"",c=o?e.rightWord:s?e.leftWord:void 0,u=o?"gp-diff-word gp-diff-word--add":"gp-diff-word gp-diff-word--del",m=`gp-diff-cell gp-diff-uni__code ${l}`,k=c!==void 0?pt(m,`c${t}`,g,c,u,n,i):qe(m,`c${t}`,g,n,i);return[(0,h.createElement)("div",{key:`ol${t}`,className:"gp-diff-no"},e.leftNo??""),(0,h.createElement)("div",{key:`nl${t}`,className:"gp-diff-no"},e.rightNo??""),(0,h.createElement)("div",{key:`sg${t}`,className:`gp-diff-uni__sign ${l}`},d),k]}function dn(e,t,n,r){let i=n.busy===`${e.rightStart}:all`,a=n.busy===`${e.rightStart}:up`,s=n.busy===`${e.rightStart}:down`,o=(d,g,c)=>(0,h.createElement)("button",{key:d,type:"button",className:"gp-gap__btn",disabled:n.busy!==null,onClick:u=>{u.stopPropagation(),n.run(e,d)}},c?r("common.loading"):g),l=[];if(e.atEnd)l.push(o("down",r("diff.expandDown",{n:oe}),s));else{let d=e.count??0;d>0&&d<=oe?l.push(o("all",r("diff.expandGap",{n:d}),i)):(e.atStart||l.push(o("up",r("diff.expandUp",{n:oe}),a)),l.push(o("all",r("diff.expandGap",{n:d}),i)),l.push(o("down",r("diff.expandDown",{n:oe}),s)))}return(0,h.createElement)("div",{key:`g${t}`,className:"gp-diff-row--gap",style:{gridColumn:"1 / -1"}},l)}function Oe(e){return Yt(e)}var E=require("react");var er=100;function cn(e,t,n){let[r,i]=(0,E.useState)(null),[a,s]=(0,E.useState)(!1),[o,l]=(0,E.useState)([]),d=(0,E.useCallback)(()=>{s(!1),(async()=>{let[g,c]=await Promise.all([e.query({sessionId:t,query:{kind:"branches"}}),e.query({sessionId:t,query:{kind:"tags"}})]),u=Z(g,"branches");if(u===null){s(!0);return}let m=Z(c,"tags");i({current:u.current,defaultBranch:u.defaultBranch,local:u.local,remote:u.remote,tags:m?.tags??[]}),e.query({sessionId:t,query:{kind:"authors"}}).then(k=>{l(Z(k,"authors")?.authors??[])})})()},[e,t]);return(0,E.useEffect)(()=>{d()},[n]),{tree:r,treeError:a,authors:o,reload:d}}function pn(e,t,n,r,i){let[a,s]=(0,E.useState)([]),[o,l]=(0,E.useState)(0),[d,g]=(0,E.useState)(!1),[c,u]=(0,E.useState)(!1),m=(0,E.useRef)(0),k=(0,E.useRef)(!1),x=(0,E.useRef)(null),_=(0,E.useCallback)(async(z,A)=>{if(k.current)return;k.current=!0;let C=m.current;g(!0),u(!1);let N=await e.query({sessionId:t,query:{kind:"history",limit:er,skip:z,...A.ref?{ref:A.ref}:{},...A.search?{search:A.search}:{},...A.author?{author:A.author}:{},...A.since?{since:A.since}:{}}});if(k.current=!1,C!==m.current)return;g(!1);let O=Z(N,"history");if(O===null){u(!0);return}let D=O.commits;s(U=>z===0?D:[...U,...D]),l(O.total)},[e,t]),F=(0,E.useRef)(n);(0,E.useEffect)(()=>{m.current+=1,k.current=!1,F.current!==n&&(F.current=n,i(),x.current&&(x.current.scrollTop=0)),_(0,n)},[n,r]);let v=o<0?!0:a.length<o,M=(0,E.useCallback)(()=>{k.current||!v||_(a.length,n)},[_,a.length,n,v]);return{commits:a,total:o,loading:d,listError:c,hasMore:v,listRef:x,loadMore:M}}function fn(e,t,n){let[r,i]=(0,E.useState)(null),[a,s]=(0,E.useState)(null),[o,l]=(0,E.useState)(!1),[d,g]=(0,E.useState)(null),[c,u]=(0,E.useState)(null),[m,k]=(0,E.useState)(!1),[x,_]=(0,E.useState)(n),[F,v]=(0,E.useState)(!1),M=(0,E.useRef)(0),z=(0,E.useRef)(null),A=(0,E.useRef)(new Map),C=(0,E.useCallback)(($,w)=>{let L=A.current;for(L.set($,w);L.size>50;){let q=L.keys().next().value;if(q===void 0)break;L.delete(q)}},[]),N=(0,E.useCallback)(()=>{i(null),s(null),z.current=null},[]),O=(0,E.useCallback)(async $=>{z.current=$.hash,i($),l(!1),M.current+=1,g(null),u(null),k(!1);let w=A.current.get($.hash);if(w!==void 0){s(w);return}s(null);let L=await e.query({sessionId:t,query:{kind:"show",ref:$.hash}});if(z.current!==$.hash)return;let q=Z(L,"show");if(q!==null){let re={commit:q.commit,body:q.body,stats:q.stats};C($.hash,re),s(re)}else l(!0)},[e,t,C]),D=(0,E.useCallback)(async($,w,L,q=!1)=>{let re=++M.current;g({path:$,hash:w,shortHash:L}),u(null),k(!1),v(q);let Y=await e.query({sessionId:t,query:{kind:"diff",path:$,base:"commit",commit:w,...q?{context:1e5}:{}}});if(re!==M.current)return;let G=Z(Y,"diff");G!==null?u(G.text):k(!0)},[e,t]),U=(0,E.useCallback)(()=>{M.current+=1,g(null),u(null),k(!1),v(!1)},[]);(0,E.useEffect)(()=>{if(d===null)return;let $=w=>{w.key==="Escape"&&U()};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[d,U]);let[Q,j]=(0,E.useState)(null),[ne,T]=(0,E.useState)(null),I=(0,E.useRef)(void 0),X=(0,E.useRef)(null),P=(0,E.useCallback)(($,w,L)=>{I.current!==void 0&&clearTimeout(I.current),I.current=setTimeout(()=>{X.current=$.hash,j({commit:$,x:w,y:L});let q=A.current.get($.hash);if(q!==void 0){T(q.body);return}T(null),e.query({sessionId:t,query:{kind:"show",ref:$.hash}}).then(re=>{if(X.current!==$.hash)return;let Y=Z(re,"show");Y!==null?(C($.hash,{commit:Y.commit,body:Y.body,stats:Y.stats}),T(Y.body)):T("")})},260)},[e,t,C]),ee=(0,E.useCallback)(()=>{I.current!==void 0&&clearTimeout(I.current),X.current=null,j(null),T(null)},[]);return(0,E.useEffect)(()=>()=>{I.current!==void 0&&clearTimeout(I.current)},[]),{selected:r,detail:a,detailError:o,select:O,clearSelection:N,fileDiff:d,fileDiffText:c,fileDiffError:m,fileDiffMode:x,setFileDiffMode:_,fileDiffExpanded:F,openFileDiff:D,closeFileDiff:U,hover:Q,hoverBody:ne,onHoverEnter:P,onHoverLeave:ee}}var ae=require("react"),tr=(e,t,n)=>Math.max(t,Math.min(n,e));function nr(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 rr(e,t){try{typeof localStorage<"u"&&localStorage.setItem(e,String(Math.round(t)))}catch{}}function ue(e){let{storageKey:t,initial:n,min:r,reserve:i,edge:a}=e,[s,o]=(0,ae.useState)(()=>nr(t,n)),l=(0,ae.useRef)(null),d=(0,ae.useRef)(null),g=(0,ae.useCallback)(u=>{let k=l.current?.parentElement?.clientWidth??Number.MAX_SAFE_INTEGER;d.current={x:u.clientX,w:s,max:Math.max(r,k-i)},u.preventDefault(),typeof document<"u"&&(document.body.style.cursor="col-resize",document.body.style.userSelect="none")},[s,r,i]);(0,ae.useEffect)(()=>{if(typeof window>"u")return;let u=k=>{let x=d.current;if(x===null)return;let _=k.clientX-x.x;o(tr(x.w+(a==="end"?_:-_),r,x.max))},m=()=>{d.current!==null&&(d.current=null,typeof document<"u"&&(document.body.style.cursor="",document.body.style.userSelect=""),o(k=>(rr(t,k),k)))};return window.addEventListener("pointermove",u),window.addEventListener("pointerup",m),()=>{window.removeEventListener("pointermove",u),window.removeEventListener("pointerup",m)}},[a,r,t]);let c=(0,ae.createElement)("div",{key:`rz-${t}`,ref:l,className:"gp-resizer",role:"separator","aria-orientation":"vertical",onPointerDown:g});return{width:s,divider:c}}var gn=require("react");function ye(e,t,n,r,i=!1){return e.map(a=>(0,gn.createElement)("button",{key:a,type:"button",className:`gp-seg__btn${t===a?" gp-seg__btn--active":""}`,...i?{disabled:!0}:{},onClick:()=>n(a)},r(a)))}var be=14,Ne=30,ir=260;function ar(e,t){let[n,r]=(0,p.useState)(!1);return(0,p.useEffect)(()=>{if(e===null||typeof ResizeObserver>"u")return;let i=()=>r(e.clientWidth>0&&e.clientWidth<t);i();let a=new ResizeObserver(i);return a.observe(e),()=>a.disconnect()},[e,t]),n}function un({remote:e,sessionId:t,refreshKey:n,defaultDiffView:r,t:i}){let[a,s]=(0,p.useState)({ref:null,search:"",author:"",since:""}),[o,l]=(0,p.useState)(""),[d,g]=(0,p.useState)(null),c=ar(d,ir),[u,m]=(0,p.useState)(new Set(["tags","remote"])),{tree:k,treeError:x,authors:_,reload:F}=cn(e,t,n),v=fn(e,t,r),{commits:M,loading:z,listError:A,hasMore:C,listRef:N,loadMore:O}=pn(e,t,a,n,v.clearSelection);(0,p.useEffect)(()=>{let w=setTimeout(()=>s(L=>L.search===o?L:{...L,search:o}),300);return()=>clearTimeout(w)},[o]);let D=a.search!=="",U=(0,p.useMemo)(()=>D?M.map(w=>({commit:w,lane:0,color:0,edges:[],merge:!1})):qt(M),[M,D]),Q=(0,p.useMemo)(()=>D?0:Kt(U),[U,D]),j=D?12:Math.max(be,Q*be),ne=`${j}px minmax(120px,1fr) 72px 120px 96px`,T=()=>{let w=N.current;w===null||!C||w.scrollTop+w.clientHeight>=w.scrollHeight-240&&O()},I=(0,p.useMemo)(()=>Date.now(),[M]),X=(0,p.useMemo)(()=>v.detail===null?[]:Jt(v.detail.stats.map(w=>({path:w.path,meta:w.status}))),[v.detail]),P=v.selected,ee=ue({storageKey:"gp.overview.left",initial:200,min:130,reserve:360,edge:"end"}),$=ue({storageKey:"gp.overview.right",initial:340,min:190,reserve:360,edge:"start"});return(0,p.createElement)("div",{className:"gp-overview"},[pr(v.fileDiff,{text:v.fileDiffText,error:v.fileDiffError,mode:v.fileDiffMode,onMode:v.setFileDiffMode,expanded:v.fileDiffExpanded,onExpand:w=>{v.fileDiff!==null&&v.openFileDiff(v.fileDiff.path,v.fileDiff.hash,v.fileDiff.shortHash,w)},onClose:v.closeFileDiff,remote:e,sessionId:t,t:i}),(0,p.createElement)("div",{key:"left",className:"gp-col gp-col--left",style:{flex:`0 0 ${ee.width}px`}},sr(k,x,a.ref,u,{onFilter:w=>s(L=>({...L,ref:w})),onToggle:w=>m(L=>{let q=new Set(L);return q.has(w)?q.delete(w):q.add(w),q}),onRetry:F,t:i})),ee.divider,(0,p.createElement)("div",{key:"mid",className:"gp-col gp-col--mid gp-history"},[(0,p.createElement)("div",{key:"tb",className:"gp-toolbar",ref:g},[(0,p.createElement)("input",{key:"search",className:"gp-search",placeholder:i(c?"overview.searchShort":"overview.search"),value:o,onChange:w=>l(w.target.value)}),(0,p.createElement)("select",{key:"author",className:"gp-select",value:a.author,onChange:w=>s(L=>({...L,author:w.target.value}))},[(0,p.createElement)("option",{key:"",value:""},i("overview.allUsers")),..._.map(w=>(0,p.createElement)("option",{key:w,value:w},w))]),(0,p.createElement)("select",{key:"since",className:"gp-select",value:a.since,onChange:w=>s(L=>({...L,since:w.target.value}))},[(0,p.createElement)("option",{key:"",value:""},i("overview.allTime")),(0,p.createElement)("option",{key:"today",value:"1 day ago"},i("overview.today")),(0,p.createElement)("option",{key:"7d",value:"7 days ago"},i("overview.last7d")),(0,p.createElement)("option",{key:"30d",value:"30 days ago"},i("overview.last30d"))]),(0,p.createElement)("button",{key:"fetch",type:"button",className:"gp-icon-btn",title:i("overview.fetch"),onClick:()=>{e.run({sessionId:t,action:{kind:"fetch"}}).then(()=>F())}},(0,p.createElement)(Fe,{size:14}))]),(0,p.createElement)("div",{key:"list",className:"gp-history__list",ref:N,onScroll:T},M.length===0?(0,p.createElement)("div",{className:"gp-empty"},i(z?"common.loading":A?"overview.loadFailed":"overview.noResults")):U.map(w=>lr(w,{selected:P?.hash===w.commit.hash,gridTpl:ne,graphW:j,laneCount:Q,searching:D,now:I,onSelect:()=>void v.select(w.commit),onHoverEnter:v.onHoverEnter,onHoverLeave:v.onHoverLeave,t:i})))]),$.divider,(0,p.createElement)("div",{key:"right",className:"gp-col gp-col--right gp-detail",style:{flex:`0 0 ${$.width}px`}},P===null?(0,p.createElement)("div",{className:"gp-empty"},[(0,p.createElement)(De,{key:"i",size:20}),i("overview.selectCommit")]):[(0,p.createElement)("div",{key:"files",className:"gp-detail__files"},v.detail===null?(0,p.createElement)("div",{className:"gp-empty"},v.detailError?i("overview.detailFailed"):i("common.loading")):cr(X,{activePath:v.fileDiff?.path??null,openTitle:i("overview.openFileDiff"),onOpen:w=>{P!==null&&v.openFileDiff(w,P.hash,P.shortHash)}})),(0,p.createElement)("div",{key:"msg",className:"gp-detail__msg"},[(0,p.createElement)("div",{key:"subj",className:"gp-detail__subject"},P.subject),(0,p.createElement)("div",{key:"meta",className:"gp-detail__meta"},[(0,p.createElement)("span",{key:"h",className:"gp-commit-hash"},P.shortHash),(0,p.createElement)("span",{key:"a"},P.author),(0,p.createElement)("span",{key:"t"},Wt(P.dateIso))]),v.detail!==null&&v.detail.body!==""?(0,p.createElement)("pre",{key:"body",className:"gp-detail__body"},v.detail.body):(0,p.createElement)("div",{key:"nb",className:"gp-empty"},i("overview.noMessage"))])]),or(v.hover,v.hoverBody,i)])}function or(e,t,n){if(e===null||typeof document>"u")return null;let r=460,i=Math.min(e.x+16,(typeof window<"u"?window.innerWidth:1200)-r-12),a=e.y+14,s=(0,p.createElement)("div",{className:"gp-hovercard",style:{left:i,top:a,maxWidth:r}},[(0,p.createElement)("div",{key:"subj",className:"gp-hovercard__subject"},e.commit.subject),(0,p.createElement)("div",{key:"meta",className:"gp-hovercard__meta"},[(0,p.createElement)("span",{key:"h",className:"gp-commit-hash"},e.commit.shortHash),(0,p.createElement)("span",{key:"a"},e.commit.author)]),t===null?(0,p.createElement)("div",{key:"l",className:"gp-hovercard__loading"},n("common.loading")):t===""?(0,p.createElement)("div",{key:"e",className:"gp-hovercard__loading"},n("overview.noMessage")):(0,p.createElement)("pre",{key:"body",className:"gp-hovercard__body"},t)]);return(0,ft.createPortal)(s,document.body,"commit-hovercard")}function sr(e,t,n,r,i){if(t)return(0,p.createElement)("div",{className:"gp-empty"},[(0,p.createElement)("span",{key:"m"},i.t("overview.branchesError")),(0,p.createElement)("button",{key:"r",type:"button",className:"gp-btn",style:{marginTop:8},onClick:i.onRetry},i.t("common.retry"))]);if(e===null)return(0,p.createElement)("div",{className:"gp-empty"},i.t("common.loading"));let a=(s,o,l,d,g="")=>(0,p.createElement)("div",{key:s,className:"gp-branch-group"},[(0,p.createElement)("div",{key:"head",className:"gp-branch-group__head",onClick:()=>i.onToggle(s)},[(0,p.createElement)(ge,{key:"c",size:11,open:!r.has(s)}),`${i.t(o)} (${l.length})`]),r.has(s)?null:l.map(c=>{let u=g+c.name,m=e.current===c.name,k=`gp-branch-row${n===u?" gp-branch-row--active":""}${m?" gp-branch-row--current":""}`;return(0,p.createElement)("div",{key:c.name,className:k,title:c.name,onClick:()=>i.onFilter(n===u?null:u)},[(0,p.createElement)("span",{key:"i",style:{display:"inline-flex",width:14}},d),(0,p.createElement)("span",{key:"n",className:"gp-tree-name"},c.name),c.ahead||c.behind?(0,p.createElement)("span",{key:"t",className:"gp-branch-row__track"},`${c.ahead?`\u2191${c.ahead}`:""}${c.behind?`\u2193${c.behind}`:""}`):null])})]);return(0,p.createElement)("div",{},[(0,p.createElement)("div",{key:"head-row",className:"gp-branch-row",style:{fontWeight:600,paddingLeft:10},onClick:()=>i.onFilter(null)},i.t("overview.head")),a("local","overview.local",e.local,(0,p.createElement)(ot,{size:13})),a("remote","overview.remote",e.remote,(0,p.createElement)(ot,{size:13})),a("tags","overview.tags",e.tags,(0,p.createElement)(Ht,{size:13}))])}function lr(e,t){let n=e.commit;return(0,p.createElement)("div",{key:n.hash,className:`gp-commit-row${t.selected?" gp-commit-row--active":""}`,style:{gridTemplateColumns:t.gridTpl},onClick:t.onSelect,onMouseEnter:r=>t.onHoverEnter(n,r.clientX,r.clientY),onMouseLeave:t.onHoverLeave},[(0,p.createElement)("div",{key:"g",className:"gp-graph-cell"},t.searching?null:dr(e,t.laneCount)),(0,p.createElement)("div",{key:"s",className:"gp-commit-subject"},[...n.refs.map(r=>(0,p.createElement)("span",{key:r.name,className:`gp-ref-chip${r.head?" gp-ref-chip--head":""}${r.kind==="remote"?" gp-ref-chip--remote":""}${r.kind==="tag"?" gp-ref-chip--tag":""}`},r.name)),n.subject]),(0,p.createElement)("div",{key:"h",className:"gp-commit-hash"},n.shortHash),(0,p.createElement)("div",{key:"a",className:"gp-commit-author"},n.author),(0,p.createElement)("div",{key:"d",className:"gp-commit-date",title:Ce(n.dateIso)},Se(n.dateIso,t.now,t.t))])}var We=["#4e9bff","#3fb950","#e0982e","#d05ce3","#e5534b","#2dc6c6","#d29922","#8b949e"];function dr(e,t){let n=Math.max(be,t*be),r=a=>a*be+be/2,i=[];for(let a of e.edges){let s=We[a.color%We.length];i.push((0,p.createElement)("path",{key:`e${a.fromLane}-${a.toLane}-${a.color}`,d:`M ${r(a.fromLane)} 0 C ${r(a.fromLane)} ${Ne/2}, ${r(a.toLane)} ${Ne/2}, ${r(a.toLane)} ${Ne}`,stroke:s,strokeWidth:1.6,fill:"none"}))}return i.push((0,p.createElement)("circle",{key:"node",cx:r(e.lane),cy:Ne/2,r:e.merge?4:3.2,fill:We[e.color%We.length],stroke:"var(--dsw-alias-bg-layer-1)",strokeWidth:1})),(0,p.createElement)("svg",{className:"gp-graph-svg",width:n,height:Ne},i)}function cr(e,t){let n=[],r=(i,a)=>{for(let s of i)if(s.dir)n.push((0,p.createElement)("div",{key:s.path,className:"gp-tree-row",style:{paddingLeft:10+a*14}},[(0,p.createElement)(ge,{key:"c",size:11,open:!0}),(0,p.createElement)("span",{key:"n",className:"gp-tree-name"},s.name)])),r(s.children,a+1);else{let o=String(s.meta??"modified"),l=t.activePath===s.path;n.push((0,p.createElement)("div",{key:s.path,className:`gp-tree-row${l?" gp-tree-row--active":""}`,style:{paddingLeft:10+a*14},title:t.openTitle,onClick:()=>t.onOpen(s.path)},[(0,p.createElement)("span",{key:"st",className:`gp-status-badge ${Pe(o)}`},(Ae[o]??o[0]??"M").toUpperCase()),(0,p.createElement)("span",{key:"n",className:"gp-tree-name"},s.name)]))}};return r(e,0),(0,p.createElement)("div",{},n)}function pr(e,t){if(e===null||typeof document>"u")return null;let{text:n,error:r,mode:i,onMode:a,expanded:s,onExpand:o,onClose:l,remote:d,sessionId:g,t:c}=t,u=(0,p.createElement)("div",{className:"gp-modal-backdrop",onClick:m=>{m.target===m.currentTarget&&l()}},(0,p.createElement)("div",{className:"gp-modal",role:"dialog","aria-modal":!0},[(0,p.createElement)("div",{key:"bar",className:"gp-modal__bar"},[(0,p.createElement)("span",{key:"fileicon",className:"gp-modal__fileicon"},(0,p.createElement)(It,{size:15})),(0,p.createElement)("span",{key:"path",className:"gp-modal__path",title:e.path},fr(e.path)),(0,p.createElement)("span",{key:"hash",className:"gp-modal__hash"},e.shortHash),n!==null&&n!==""?(()=>{let m=Oe(n);return(0,p.createElement)("span",{key:"sum",className:"gp-modal__sum"},[(0,p.createElement)("span",{key:"a",className:"gp-stats__add"},`+${m.add}`),(0,p.createElement)("span",{key:"d",className:"gp-stats__del"},`\u2212${m.del}`)])})():null,(0,p.createElement)("button",{key:"expand",type:"button",className:`gp-seg__btn gp-diff__expand${s?" gp-seg__btn--active":""}`,disabled:i!=="split"&&i!=="unified",title:c(s?"diff.collapse":"diff.expandAll"),onClick:()=>o(!s)},c(s?"diff.collapse":"diff.expandAll")),(0,p.createElement)("div",{key:"seg",className:"gp-seg"},ye(["unified","split","before","after"],i,a,m=>c(`diff.${m}`))),(0,p.createElement)("button",{key:"close",type:"button",className:"gp-icon-btn gp-modal__close",title:c("common.close"),onClick:l},(0,p.createElement)(zt,{size:15}))]),(0,p.createElement)("div",{key:"scroll",className:"gp-modal__scroll"},n===null?(0,p.createElement)("div",{className:"gp-empty"},c(r?"overview.diffFailed":"common.loading")):(0,p.createElement)(Be,{text:n,mode:i,path:e.path,remote:d,sessionId:g,imageSpec:{base:"commit",commit:e.hash},t:c}))]));return(0,ft.createPortal)(u,document.body,"file-diff-modal")}function fr(e){let t=e.lastIndexOf("/");return t<0?[(0,p.createElement)("span",{key:"n",className:"gp-modal__name"},e)]:[(0,p.createElement)("span",{key:"d",className:"gp-modal__dir"},e.slice(0,t+1)),(0,p.createElement)("span",{key:"n",className:"gp-modal__name"},e.slice(t+1))]}var b=require("react");var ie=require("react");function mn({stats:e,t}){let n=Date.now(),r=[(0,ie.createElement)("span",{key:"files",className:"gp-stats__item"},t("stats.files",{n:e.fileCount})),(0,ie.createElement)("span",{key:"lines",className:"gp-stats__item"},[(0,ie.createElement)("span",{key:"a",className:"gp-stats__add"},`+${e.insertions}`)," ",(0,ie.createElement)("span",{key:"d",className:"gp-stats__del"},`\u2212${e.deletions}`)])];e.staged>0&&r.push((0,ie.createElement)("span",{key:"st",className:"gp-stats__item"},t("stats.staged",{n:e.staged}))),e.modified>0&&r.push((0,ie.createElement)("span",{key:"mo",className:"gp-stats__item"},t("stats.modified",{n:e.modified}))),e.untracked>0&&r.push((0,ie.createElement)("span",{key:"un",className:"gp-stats__item"},t("stats.untracked",{n:e.untracked})));let i=[];return e.lastChangeAt!==null&&i.push((0,ie.createElement)("span",{key:"lc",className:"gp-stats__item",title:Ce(e.lastChangeAt)},t("stats.lastChange",{time:Se(e.lastChangeAt,n,t)}))),e.headCommittedAt!==null&&i.push((0,ie.createElement)("span",{key:"hc",className:"gp-stats__item",title:Ce(e.headCommittedAt)},t("stats.lastCommit",{time:Se(e.headCommittedAt,n,t)}))),i.length>0&&r.push((0,ie.createElement)("span",{key:"times",className:"gp-stats__times"},i)),(0,ie.createElement)("div",{className:"gp-stats"},r)}function hn({remote:e,sessionId:t,snapshot:n,onAction:r,t:i}){let[a,s]=(0,b.useState)(new Set),[o,l]=(0,b.useState)(""),[d,g]=(0,b.useState)(!1),[c,u]=(0,b.useState)(!1),[m,k]=(0,b.useState)(null),[x,_]=(0,b.useState)(new Set),[F,v]=(0,b.useState)(null),[M,z]=(0,b.useState)(null),[A,C]=(0,b.useState)(null),[N,O]=(0,b.useState)(()=>n.defaultDiffView),[D,U]=(0,b.useState)(!1),[Q,j]=(0,b.useState)(!1),ne=(0,b.useRef)(0),T=(0,b.useMemo)(()=>n.changes.filter(y=>y.staged).sort(gt),[n]),I=(0,b.useMemo)(()=>n.changes.filter(y=>!y.staged&&y.status!=="untracked").sort(gt),[n]),X=(0,b.useMemo)(()=>n.changes.filter(y=>y.status==="untracked").sort(gt),[n]),ee=[{key:"staged",labelKey:"changes.groupStaged",items:T},{key:"unstaged",labelKey:"changes.groupUnstaged",items:I},{key:"untracked",labelKey:"changes.groupUntracked",items:X}].filter(y=>y.items.length>0);(0,b.useEffect)(()=>{s(y=>{if(y.size===0)return y;let R=new Set(n.changes.map(H=>H.path+(H.staged?":s":":w"))),K=new Set,J=!1;for(let H of y)R.has(H)?K.add(H):J=!0;return J?K:y})},[n]),(0,b.useEffect)(()=>{if(!d||Q||o.trim()!=="")return;let y=!0;return e.query({sessionId:t,query:{kind:"last-commit-message"}}).then(R=>{let K=Z(R,"last-commit-message");y&&K!==null&&(l(K.message),j(!0))}),()=>{y=!1}},[d,Q,o,e,t]);let $=(0,b.useCallback)(async(y,R,K=!1,J=!1)=>{let H=++ne.current;z({path:y,base:R}),J||C(null),U(K);let se=await e.query({sessionId:t,query:{kind:"diff",path:y,base:R,...K?{context:1e5}:{}}});if(H!==ne.current)return;let xt=Z(se,"diff");C(xt!==null?xt.text:"")},[e,t]);(0,b.useEffect)(()=>{if(M===null)return;if(!n.changes.some(R=>R.path===M.path)){z(null),C(null);return}$(M.path,M.base,D,!0)},[n]),(0,b.useEffect)(()=>{v(null)},[n]);let w=y=>{s(R=>{let K=new Set(R);return K.has(y)?K.delete(y):K.add(y),K})},L=async y=>{if(c)return!1;u(!0),k(null);try{let R=await r(y);return R.ok?!0:(k(R.error??i("error.generic")),!1)}catch(R){return k(R instanceof Error?R.message:i("error.generic")),!1}finally{u(!1)}},q=async()=>{let y=o.trim();if(y===""&&!d){k(i("error.emptyMessage"));return}let R=a.size>0?[...new Set([...a].map(J=>J.replace(/:[sw]$/,"")))]:void 0;await L({kind:"commit",message:y,...R?{paths:R}:{},...d?{amend:!0}:{}})&&(l(""),s(new Set),g(!1),j(!1))},re=y=>{_(R=>{let K=new Set(R);return K.has(y)?K.delete(y):K.add(y),K})},Y=A!==null&&A!==""?Oe(A):null,G=ue({storageKey:"gp.changes.left",initial:380,min:220,reserve:200,edge:"end"});return(0,b.createElement)("div",{className:"gp-changes"},[(0,b.createElement)("div",{key:"left",className:"gp-changes__left",style:{flex:`0 0 ${G.width}px`}},[(0,b.createElement)(mn,{key:"stats",stats:n.stats,t:i}),(0,b.createElement)("div",{key:"toolbar",className:"gp-toolbar"},[(0,b.createElement)("button",{key:"sa",type:"button",className:"gp-btn",disabled:c||n.changes.length===0,onClick:()=>void L({kind:"stage-all"})},i("changes.stageAll")),(0,b.createElement)("button",{key:"ua",type:"button",className:"gp-btn",disabled:c||n.staged===0,onClick:()=>void L({kind:"unstage-all"})},i("changes.unstageAll"))]),m!==null?(0,b.createElement)("div",{key:"err",className:"gp-feedback"},m):null,(0,b.createElement)("div",{key:"list",className:"gp-changes__list"},n.changes.length===0?(0,b.createElement)("div",{className:"gp-empty"},i("changes.noChanges")):ee.map(y=>(0,b.createElement)("div",{key:y.key},[(0,b.createElement)("div",{key:"head",className:"gp-group-head",onClick:()=>re(y.key)},[(0,b.createElement)(ge,{key:"chev",size:12,open:!x.has(y.key)}),`${i(y.labelKey)} (${y.items.length})`]),x.has(y.key)?null:y.items.map(R=>{let K=R.path+(R.staged?":s":":w");return gr(R,{selected:a.has(K),active:M?.path===R.path&&M.base===(R.staged?"staged":"worktree"),busy:c,armed:F===K,onToggle:()=>w(K),onOpen:()=>void $(R.path,R.staged?"staged":"worktree"),onStage:()=>void L(R.staged?{kind:"unstage",paths:[R.path]}:{kind:"stage",paths:[R.path]}),onDiscard:()=>{F===K?(L({kind:"discard",paths:[R.path]}),v(null)):v(K)},t:i})})]))),(0,b.createElement)("div",{key:"box",className:"gp-commitbox"},[(0,b.createElement)("textarea",{key:"msg",className:"gp-commitbox__msg",placeholder:i("commit.placeholder"),value:o,onChange:y=>l(y.target.value)}),(0,b.createElement)("div",{key:"row",className:"gp-commitbox__row"},[(0,b.createElement)("label",{key:"amend",className:"gp-commitbox__amend"},[(0,b.createElement)("input",{key:"cb",type:"checkbox",className:"gp-check",checked:d,onChange:()=>{g(y=>!y),j(!1)}}),i("commit.amend")]),(0,b.createElement)("div",{key:"actions",className:"gp-commitbox__actions"},[(0,b.createElement)("button",{key:"commit",type:"button",className:"gp-btn gp-btn--primary",disabled:c||o.trim()==="",onClick:()=>void q()},i("commit.commit"))])])])]),G.divider,(0,b.createElement)("div",{key:"right",className:"gp-changes__right"},M===null?(0,b.createElement)("div",{className:"gp-empty"},i("changes.selectFile")):(0,b.createElement)("div",{className:"gp-diff"},[(0,b.createElement)("div",{key:"tb",className:"gp-diff__toolbar"},[(0,b.createElement)("span",{key:"path",className:"gp-diff__path"},M.path),Y?(0,b.createElement)("span",{key:"sum",className:"gp-stats__item",style:{marginLeft:"auto"}},[(0,b.createElement)("span",{key:"a",className:"gp-stats__add"},`+${Y.add}`)," ",(0,b.createElement)("span",{key:"d",className:"gp-stats__del"},`\u2212${Y.del}`)]):null,(0,b.createElement)("button",{key:"expand",type:"button",className:`gp-seg__btn gp-diff__expand${D?" gp-seg__btn--active":""}`,style:Y?{}:{marginLeft:"auto"},disabled:N!=="split"&&N!=="unified",title:i(D?"diff.collapse":"diff.expandAll"),onClick:()=>void $(M.path,M.base,!D)},i(D?"diff.collapse":"diff.expandAll")),(0,b.createElement)("div",{key:"seg",className:"gp-seg"},ye(["unified","split","before","after"],N,O,y=>i(`diff.${y}`)))]),(0,b.createElement)("div",{key:"scroll",className:"gp-diff__scroll"},A===null?(0,b.createElement)("div",{className:"gp-empty"},i("common.loading")):(0,b.createElement)(Be,{text:A,mode:N,path:M.path,remote:e,sessionId:t,imageSpec:{base:M.base},t:i}))]))])}function gt(e,t){return e.path.localeCompare(t.path)}function gr(e,t){let n=e.path.split("/").pop()??e.path,r=e.path.includes("/")?e.path.slice(0,e.path.lastIndexOf("/")):"";return(0,b.createElement)("div",{key:e.path+(e.staged?":s":":w"),className:`gp-file-row${t.active?" gp-file-row--active":""}`,onClick:t.onOpen},[(0,b.createElement)("input",{key:"cb",type:"checkbox",className:"gp-check",checked:t.selected,onClick:i=>i.stopPropagation(),onChange:t.onToggle}),(0,b.createElement)("span",{key:"st",className:`gp-status-badge ${Pe(e.status)}`},Ae[e.status]??"?"),(0,b.createElement)("span",{key:"nm",className:"gp-tree-name",title:e.path},[n,r?(0,b.createElement)("span",{key:"d",style:{color:"var(--dsw-alias-label-tertiary)",marginLeft:6,fontSize:11}},r):null]),(0,b.createElement)("span",{key:"act",className:"gp-file-row__actions"},[(0,b.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:i=>{i.stopPropagation(),t.onStage()}},e.staged?"\u2212":"+"),(0,b.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:i=>{i.stopPropagation(),t.onDiscard()}},"\u21BA")])])}var f=require("react");var ce=require("@deepseek-ai/dsh-client-ui-primitives");function bn(e){return/\.(?:md|markdown)$/i.test(e)}function mt(e){return/\.(?:html?|xhtml)$/i.test(e)}function ur(e){return bn(e)||mt(e)}var mr=256*1024,hr=5e3,yn=5e3,Ue=20,je=12,yr=6e4,ut=new Map;function br(e,t){let n=t.file.kind==="loading"?{kind:"idle"}:t.file;ut.set(e,{state:{...t,file:n},leftAt:Date.now()})}function vr(e){let t=ut.get(e);return t===void 0?null:Date.now()-t.leftAt>yr?(ut.delete(e),null):t.state}function ht({remote:e,sessionId:t,t:n}){let r=(0,f.useRef)(void 0);r.current===void 0&&(r.current=vr(t));let i=r.current,[a,s]=(0,f.useState)(()=>i?.dirs??new Map),[o,l]=(0,f.useState)(()=>i?.open??new Set([""])),[d,g]=(0,f.useState)(()=>i?.selected??null),[c,u]=(0,f.useState)(()=>i?.file??{kind:"idle"}),[m,k]=(0,f.useState)(()=>i?.renderMarkdown??!0),[x,_]=(0,f.useState)("idle"),[F,v]=(0,f.useState)("idle"),M=(0,f.useMemo)(()=>({code:{copyLabel:n("files.copy"),copiedLabel:n("files.copied")},footnotes:n("files.footnotes")}),[n]),z=(0,f.useRef)(0),A=ue({storageKey:"gp.files.left",initial:300,min:180,reserve:220,edge:"end"}),C=(0,f.useCallback)(T=>{s(I=>{let X=I.get(T);if(X!==void 0&&X.status!=="error")return I;let P=new Map(I);return P.set(T,{status:"loading"}),P}),e.query({sessionId:t,query:{kind:"dir-list",path:T}}).then(I=>{let X=Z(I,"dir-list");s(P=>{let ee=new Map(P);return ee.set(T,X===null?{status:"error"}:{status:"ready",entries:X.entries,truncated:X.truncated}),ee})}).catch(()=>{s(I=>{let X=new Map(I);return X.set(T,{status:"error"}),X})})},[e,t]);(0,f.useEffect)(()=>{C("")},[C]);let N=(0,f.useCallback)(T=>{l(I=>{let X=new Set(I);return X.has(T)?(X.delete(T),X):(X.add(T),a.get(T)===void 0&&C(T),X)})},[a,C]),O=(0,f.useCallback)(T=>{g(T),k(!mt(T)),_("idle"),v("idle");let I=++z.current;u({kind:"loading",path:T}),e.query({sessionId:t,query:{kind:"file-content",path:T}}).then(X=>{if(I!==z.current)return;let P=Z(X,"file-content");if(P===null){u({kind:"error",path:T});return}if(P.tooLarge===!0){u({kind:"tooLarge",path:T});return}if(P.variant==="image"&&P.dataUrl!==void 0){u({kind:"image",path:T,dataUrl:P.dataUrl});return}if(P.variant==="text"){u({kind:"text",path:T,content:P.content??"",lines:P.lines??0});return}u({kind:"binary",path:T})}).catch(()=>{I===z.current&&u({kind:"error",path:T})})},[e,t]),D=(0,f.useRef)({dirs:a,open:o,selected:d,file:c,renderMarkdown:m});D.current={dirs:a,open:o,selected:d,file:c,renderMarkdown:m},(0,f.useEffect)(()=>()=>{br(t,D.current)},[t]);let U=(0,f.useRef)(!1);(0,f.useEffect)(()=>{U.current||(U.current=!0,i!==null&&i.selected!==null&&c.kind==="idle"&&O(i.selected))},[i,c.kind,O]);let Q=(0,f.useMemo)(()=>vn("",0,{dirs:a,open:o,selected:d,toggleDir:N,selectFile:O,t:n}),[a,o,d,N,O,n]),j=async()=>{if(d===null)return;let T=z.current;try{await navigator.clipboard.writeText(d),T===z.current&&_("copied")}catch{T===z.current&&_("error")}},ne=async()=>{if(c.kind!=="text")return;let T=z.current;try{await navigator.clipboard.writeText(c.content),T===z.current&&v("copied")}catch{T===z.current&&v("error")}};return(0,f.createElement)("div",{className:"gp-files"},[(0,f.createElement)("div",{key:"left",className:"gp-files__tree",style:{flex:`0 0 ${A.width}px`}},Q),A.divider,(0,f.createElement)("div",{key:"right",className:"gp-files__preview"},[d!==null?(0,f.createElement)("div",{key:"bar",className:"gp-files__bar"},[(0,f.createElement)("code",{key:"path",className:"gp-files__path",title:d},d),c.kind==="text"&&ur(c.path)?(0,f.createElement)("div",{key:"mode",className:"gp-files__mode",role:"group","aria-label":n("files.previewMode")},[(0,f.createElement)("button",{key:"source",type:"button",className:`gp-files__mode-btn${m?"":" gp-files__mode-btn--active"}`,"aria-pressed":!m,onClick:()=>k(!1)},n("files.source")),(0,f.createElement)("button",{key:"render",type:"button",className:`gp-files__mode-btn${m?" gp-files__mode-btn--active":""}`,"aria-pressed":m,onClick:()=>k(!0)},n("files.render"))]):null,(0,f.createElement)("button",{key:"copy",type:"button",className:`gp-files__copy-path${x==="error"?" gp-files__copy-path--error":""}`,"aria-live":"polite",onClick:()=>{j()}},n(x==="copied"?"files.pathCopied":x==="error"?"files.pathCopyFailed":"files.copyPath")),c.kind==="text"?(0,f.createElement)("button",{key:"copy-content",type:"button",className:`gp-files__copy-path${F==="error"?" gp-files__copy-path--error":""}`,"aria-live":"polite",onClick:()=>{ne()}},n(F==="copied"?"files.contentCopied":F==="error"?"files.contentCopyFailed":"files.copyContent")):null]):null,(0,f.createElement)("div",{key:"content",className:"gp-files__preview-content"},xr(c,m,M,n))])])}function xr(e,t,n,r){return e.kind==="text"&&t&&bn(e.path)?(0,f.createElement)("div",{className:"gp-files__markdown"},(0,f.createElement)(ce.MarkdownText,{text:e.content,labels:n,variant:"body"})):e.kind==="text"&&t&&mt(e.path)?(0,f.createElement)("iframe",{className:"gp-files__html",title:e.path,srcDoc:e.content,sandbox:"allow-scripts",referrerPolicy:"no-referrer"}):wr(e,r)}function vn(e,t,n){let r=n.dirs.get(e);if(r===void 0||r.status==="loading")return t===0?[(0,f.createElement)("div",{key:"l",className:"gp-empty"},n.t("common.loading"))]:[(0,f.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,f.createElement)("div",{key:`e${e}`,className:"gp-tree-row gp-tree-row--muted",style:{paddingLeft:10+t*14}},n.t("files.loadFailed"))];let i=[];for(let a of r.entries){let s=e===""?a.name:`${e}/${a.name}`;if(a.dir){let o=n.open.has(s);i.push((0,f.createElement)("button",{key:s,type:"button",className:`gp-tree-row gp-files__entry gp-files__entry--dir${a.ignored?" gp-tree-row--ignored":""}`,style:{paddingLeft:10+t*14},"aria-expanded":o,"aria-label":a.ignored?`${a.name} (${n.t("files.ignored")})`:a.name,onClick:()=>n.toggleDir(s)},[(0,f.createElement)("span",{key:"c",className:"gp-tree-chev"},(0,f.createElement)(ge,{size:11,open:o})),(0,f.createElement)("span",{key:"i",className:"gp-tree-ic"},(0,f.createElement)(ce.FileTypeIcon,{kind:"folder",size:18})),(0,f.createElement)("span",{key:"n",className:"gp-tree-name"},a.name)])),o&&i.push(...vn(s,t+1,n))}else{let o=n.selected===s;i.push((0,f.createElement)("button",{key:s,type:"button",className:`gp-tree-row gp-files__entry${o?" gp-tree-row--active":""}${a.ignored?" gp-tree-row--ignored":""}`,style:{paddingLeft:10+t*14},"aria-current":o?"true":void 0,"aria-label":a.ignored?`${a.name} (${n.t("files.ignored")})`:a.name,onClick:()=>n.selectFile(s)},[(0,f.createElement)("span",{key:"c",className:"gp-tree-chev"}),(0,f.createElement)("span",{key:"i",className:"gp-tree-ic"},(0,f.createElement)(ce.FileTypeIcon,{path:s,size:18})),(0,f.createElement)("span",{key:"n",className:"gp-tree-name"},a.name)]))}}return r.truncated&&i.push((0,f.createElement)("div",{key:`t${e}`,className:"gp-tree-row gp-tree-row--muted",style:{paddingLeft:10+t*14}},n.t("files.truncated"))),i}function wr(e,t){switch(e.kind){case"idle":return(0,f.createElement)("div",{className:"gp-empty"},t("files.selectFile"));case"loading":return(0,f.createElement)("div",{className:"gp-empty"},t("common.loading"));case"error":return(0,f.createElement)("div",{className:"gp-empty"},t("files.loadFailed"));case"tooLarge":return(0,f.createElement)("div",{className:"gp-empty"},t("files.tooLarge"));case"binary":return(0,f.createElement)("div",{className:"gp-empty"},t("files.binary"));case"image":return(0,f.createElement)("div",{className:"gp-files__image"},(0,f.createElement)("img",{src:e.dataUrl,alt:e.path}));case"text":return(0,f.createElement)(_r,{content:e.content,path:e.path,t})}}function kr(e,t){if(t==="")return[];let n=[];for(let r=0;r<e.length;r++)for(let[i,a]of ze(e[r],t))if(n.push({line:r,start:i,end:a}),n.length>=Le)return n;return n}function _r({content:e,path:t,t:n}){let r=(0,f.useMemo)(()=>{let G=e.split(`
354
- `);return G.length>0&&G[G.length-1]===""&&G.pop(),G},[e]),i=e.length>mr||r.length>hr,a=i?void 0:(0,ce.languageForPath)(t),s=(0,ce.useCodeHighlighter)(a),o=(0,f.useMemo)(()=>i?void 0:s(r.join(`
355
- `)),[i,s,r]),[l,d]=(0,f.useState)(!1),[g,c]=(0,f.useState)(""),[u,m]=(0,f.useState)(!1),[k,x]=(0,f.useState)(0),_=(0,f.useRef)(null),F=(0,f.useRef)(null),v=(0,f.useRef)(null);(0,f.useEffect)(()=>{d(!1),c(""),x(0)},[t]);let M=He(g,$e),z=(0,f.useMemo)(()=>r.map(G=>G.toLowerCase()),[r]),A=u?M:M.toLowerCase(),C=u?r:z,N=(0,f.useMemo)(()=>kr(C,A),[C,A]);(0,f.useEffect)(()=>{x(0)},[A]);let O=N.length===0?0:Math.min(k,N.length-1),D=(0,f.useMemo)(()=>{let G=new Map;for(let y of N){let R=G.get(y.line)??[];R.push([y.start,y.end]),G.set(y.line,R)}return G},[N]);(0,f.useEffect)(()=>{let G=y=>{if(!((y.ctrlKey||y.metaKey)&&(y.key==="f"||y.key==="F")))return;let R=_.current;R===null||R.offsetParent===null||(y.preventDefault(),d(!0),requestAnimationFrame(()=>F.current?.select()))};return document.addEventListener("keydown",G),()=>document.removeEventListener("keydown",G)},[]);let[U,Q]=(0,f.useState)({top:0,height:0});(0,f.useLayoutEffect)(()=>{let G=_.current;if(G===null)return;let y=()=>Q({top:G.scrollTop,height:G.clientHeight});y(),G.addEventListener("scroll",y,{passive:!0});let R=typeof ResizeObserver<"u"?new ResizeObserver(y):null;return R?.observe(G),()=>{G.removeEventListener("scroll",y),R?.disconnect()}},[]);let j=r.length,T=Math.max(0,Math.floor((U.top-0)/Ue)-je),I=U.height===0?j:Math.ceil(U.height/Ue)+je*2,X=Math.min(j,T+I),P=N.length>0?N[O].line:-1,ee=P>=0?Math.min(T,Math.max(0,P-je)):T,$=P>=0?Math.max(X,Math.min(j,P+je)):X;(0,f.useEffect)(()=>{if(P<0)return;let G=requestAnimationFrame(()=>v.current?.scrollIntoView({block:"center",inline:"nearest"}));return()=>cancelAnimationFrame(G)},[O,N,P]);let w=(0,f.useCallback)(G=>{x(y=>N.length===0?0:(y+G+N.length)%N.length)},[N.length]),L=N.length>0?N[O]:null,q=l?(0,f.createElement)(Xe,{inputRef:F,query:g,matches:N.length,active:O,caseSensitive:u,onChange:c,onToggleCase:()=>m(G=>!G),onStep:w,onClose:()=>d(!1),t:n}):null,re=i||l?(0,f.createElement)("div",{key:"hd",className:"gp-files__header"},[i?(0,f.createElement)("div",{key:"note",className:"gp-files__note"},n("files.highlightOff")):null,q]):null,Y=[];for(let G=ee;G<$;G++)Y.push((0,f.createElement)("div",{key:G,className:"gp-files__row",style:{top:G*Ue}},[(0,f.createElement)("div",{key:"n",className:"gp-diff-no"},G+1),Sr(r[G],G,o?.[G],D.get(G),L,v,n)]));return(0,f.createElement)("div",{className:"gp-files__code gp-diff__scroll",ref:_},[re,(0,f.createElement)("div",{key:"grid",className:"gp-files__single gp-files__single--virt",style:{height:j*Ue}},Y)])}function Sr(e,t,n,r,i,a,s){if(e==="")return(0,f.createElement)("div",{key:`c${t}`,className:"gp-diff-cell"},"\xA0");if(e.length>yn)return(0,f.createElement)("div",{key:`c${t}`,className:"gp-diff-cell"},[e.slice(0,yn),(0,f.createElement)("span",{key:"trunc",className:"gp-files__trunc"},s("files.lineTruncated"))]);if(r===void 0||r.length===0)return(0,f.createElement)("div",{key:`c${t}`,className:"gp-diff-cell"},n!==void 0?n.map((l,d)=>(0,f.createElement)("span",{key:d,style:l.style},l.text)):e);let o=i!==null&&i.line===t?[i.start,i.end]:null;return(0,f.createElement)("div",{key:`c${t}`,className:"gp-diff-cell"},Ie(e,r,n,`c${t}`,o,a))}var xn="gp.panel.fontDelta";function Cr(){if(typeof localStorage>"u")return 0;let e=Number(localStorage.getItem(xn));return e===-1||e===1?e:0}function wn({ctx:e,sessionId:t,t:n}){let[r,i]=(0,S.useState)(Cr),[a,s]=(0,S.useState)(null),o=Me(t),l=xe(e),d=o.state==="error"&&o.error.code==="git-unavailable",g=o.state==="error"&&(o.error.code==="not-a-git-repo"||o.error.code==="git-unavailable"),c=d&&o.state==="error"&&o.error.isGitRepo===!0,u=g?"files":a!==null&&a.sessionId===t?a.tab:null,m=(0,S.useRef)({tabs:new Set});m.current.sessionId!==t&&(m.current={sessionId:t,tabs:new Set}),u!==null&&m.current.tabs.add(u);let k=m.current.tabs.has("files");(0,S.useEffect)(()=>{if(!pe(t))return;if(g){s(null);return}if(a?.sessionId===t)return;let C=Et(t);if(C!==null){s({sessionId:t,tab:C});return}let N=Ft(t);if(N!==null){s({sessionId:t,tab:N});return}o.state==="ready"&&s({sessionId:t,tab:o.snapshot.dirty?"changes":"overview"})},[t,o,g,a?.sessionId]),(0,S.useEffect)(()=>{if(pe(t))return Mt(t,C=>s({sessionId:t,tab:C}))},[t]);let x=(0,S.useRef)({tab:null});x.current={sessionId:t,tab:u},(0,S.useEffect)(()=>()=>{let{sessionId:C,tab:N}=x.current;C!==void 0&&N!==null&&Dt(C,N)},[]);let _=o.state==="ready"?o.snapshot.checkedAt:0,F=async C=>{if(!pe(t))return{ok:!1,error:n("error.noCwd")};let N=await l.run({sessionId:t,action:C});return N.ok?(rt(t).accept(N.snapshot),{ok:!0}):{ok:!1,error:Nr(N.error.code,N.error.message,n)}},v=C=>{i(C),typeof localStorage<"u"&&localStorage.setItem(xn,String(C))},M=[{key:"overview",label:n("tab.overview"),icon:(0,S.createElement)(De,{size:14})},{key:"changes",label:n("tab.changes"),icon:(0,S.createElement)($t,{size:14})},{key:"files",label:n("tab.files"),icon:(0,S.createElement)(Xt,{size:14})}],z=g?M.filter(C=>C.key==="files"):M,A=(()=>{if(!pe(t))return(0,S.createElement)("div",{className:"gp-empty"},n("error.noCwd"));if(o.state==="no-cwd")return(0,S.createElement)("div",{className:"gp-empty"},n("error.noCwd"));if(g){let N=k?(0,S.createElement)(ht,{key:t,remote:l,sessionId:t,t:n}):null;return c?(0,S.createElement)("div",{className:"gp-files-wrap"},[(0,S.createElement)("div",{key:"notice",className:"gp-notice"},n("files.gitNotInstalled")),N]):(0,S.createElement)("div",{style:{display:"contents"}},N)}if(o.state==="error")return(0,S.createElement)("div",{className:"gp-empty"},n("pill.unavailable"));if(o.state==="cold"||o.state==="loading"||u===null)return(0,S.createElement)("div",{className:"gp-empty"},n("common.loading"));let C=o.snapshot;return(0,S.createElement)("div",{style:{display:"contents"}},[m.current.tabs.has("overview")?(0,S.createElement)("div",{key:"overview",style:u==="overview"?{display:"contents"}:{display:"none"}},(0,S.createElement)(un,{key:t,remote:l,sessionId:t,refreshKey:_,defaultDiffView:C.defaultDiffView,t:n})):null,m.current.tabs.has("changes")?(0,S.createElement)("div",{key:"changes",style:u==="changes"?{display:"contents"}:{display:"none"}},(0,S.createElement)(hn,{key:t,remote:l,sessionId:t,snapshot:C,onAction:F,t:n})):null,k?(0,S.createElement)("div",{key:"files",style:u==="files"?{display:"contents"}:{display:"none"}},(0,S.createElement)(ht,{key:t,remote:l,sessionId:t,t:n})):null])})();return(0,S.createElement)("div",{className:"gp-panel","data-conversation-composer-overlay":"","data-font-delta":r},[(0,S.createElement)("div",{key:"tabs",className:"gp-tabbar",role:"tablist"},[...z.map(C=>(0,S.createElement)("button",{key:C.key,type:"button",role:"tab","aria-selected":u===C.key,className:`gp-tab${u===C.key?" gp-tab--active":""}`,onClick:()=>{pe(t)&&s({sessionId:t,tab:C.key})}},[(0,S.createElement)("span",{key:"i",className:"gp-tab__icon"},C.icon),(0,S.createElement)("span",{key:"l",className:"gp-tab__label"},C.label)])),(0,S.createElement)("div",{key:"font",className:"gp-font"},[(0,S.createElement)("button",{key:"dec",type:"button",className:"gp-font__decrease",onClick:()=>v(-1),"aria-label":n("panel.fontDecrease")},"A\u2212"),(0,S.createElement)("button",{key:"reset",type:"button",className:"gp-font__reset",onClick:()=>v(0),"aria-label":n("panel.fontReset")},"A"),(0,S.createElement)("button",{key:"inc",type:"button",className:"gp-font__increase",onClick:()=>v(1),"aria-label":n("panel.fontIncrease")},"A+")]),(0,S.createElement)(Gr,{key:"ver",remote:l,t:n})]),(0,S.createElement)("div",{key:"body",className:"gp-body"},A)])}function Nr(e,t,n){switch(e){case"empty-message":return n("error.emptyMessage");case"not-a-git-repo":return n("error.notARepo");case"cwd-unavailable":return n("error.noCwd");case"local-changes-block":return n("error.localChangesBlock");default:return t??n("error.generic")}}function Gr({remote:e,t}){let[n,r]=(0,S.useState)({kind:"idle"});(0,S.useEffect)(()=>{let o=!0;return e.version({}).then(l=>{o&&"current"in l&&r(d=>({...d,info:l}))}),()=>{o=!1}},[e]);let i=async()=>{r(l=>({kind:"checking",info:l.info}));let o=await e.version({check:!0});r({kind:"idle",info:"current"in o?o:void 0})},a=n.info,s=n.kind==="checking"?(0,S.createElement)("span",{className:"gp-verbar__status"},t("version.checking")):a===void 0||!a.checkedRemote?null:a.error!==void 0?(0,S.createElement)("span",{className:"gp-verbar__status gp-verbar__status--err",title:a.error},a.error==="repository is not configured"?t("version.noRepo"):t("version.error")):a.updateAvailable&&a.latest!==void 0?(0,S.createElement)("span",{},[(0,S.createElement)("span",{key:"s",className:"gp-verbar__status gp-verbar__status--new"},t("version.updateAvailable",{latest:a.latest,current:a.current})),a.releaseUrl!==void 0?(0,S.createElement)("a",{key:"l",className:"gp-verbar__link",href:a.releaseUrl,target:"_blank",rel:"noreferrer",style:{marginLeft:8}},t("version.viewRelease")):null]):(0,S.createElement)("span",{className:"gp-verbar__status gp-verbar__status--ok"},t("version.upToDate",{current:a.current}));return(0,S.createElement)("div",{className:"gp-verbar"},[a!==void 0?(0,S.createElement)("span",{key:"tag",className:"gp-verbar__tag"},`v${a.current}`):null,s,(0,S.createElement)("button",{key:"btn",type:"button",className:"gp-verbar__btn",disabled:n.kind==="checking",onClick:()=>void i()},[(0,S.createElement)("span",{key:"i",className:"gp-tab__icon"},(0,S.createElement)(Fe,{size:12})),t("version.check")]),a?.repositoryUrl!==void 0?(0,S.createElement)("a",{key:"gh",className:"gp-icon-btn gp-verbar__gh",href:a.repositoryUrl,target:"_blank",rel:"noreferrer",title:t("version.openRepo"),"aria-label":t("version.openRepo")},(0,S.createElement)(Vt,{size:15})):null])}var W=require("react"),Cn=require("react-dom");var kn="data-gp-tab-dot",ve,yt=null,_n="",Ye=null,Qe;function Tr(e){if(typeof document>"u")return null;let t=document.querySelectorAll(_e);for(let n of t)if((n.textContent??"").trim()===e)return n;return null}function bt(){let e=Tr(_n);if(e===null)return;let t=e.querySelector(`[${kn}]`);if(Ye===null){t?.remove();return}let n=`gp-tab-dot gp-tab-dot--${Ye}`;if(t!==null){t.className!==n&&(t.className=n);return}let r=document.createElement("span");r.className=n,r.setAttribute(kn,""),r.setAttribute("aria-hidden","true"),e.appendChild(r)}function Rr(){if(typeof document>"u"||typeof MutationObserver>"u")return;let e=document.querySelector(Tt);if(e!==yt){if(ve?.disconnect(),yt=e,e===null){ve=void 0;return}ve=new MutationObserver(()=>bt()),ve.observe(e,{childList:!0,subtree:!0})}}function Er(){ve?.disconnect(),ve=void 0,yt=null}function Sn(e,t,n){if(!(typeof document>"u")){if(n===null){vt(e);return}Qe=e,_n=t,Ye=n,Rr(),bt()}}function vt(e){Qe!==void 0&&Qe!==e||(Qe=void 0,Ye=null,bt(),Er())}function Mr(e){let t=e.replace(/[/\\]+$/,"").split(/[/\\]/);return t[t.length-1]||e}function Dr(){let[e,t]=(0,W.useState)(!1),[n,r]=(0,W.useState)(null),i=(0,W.useRef)(null);return(0,W.useLayoutEffect)(()=>{if(!e||i.current===null){r(null);return}let o=i.current.getBoundingClientRect();r({left:o.left,bottom:window.innerHeight-o.top+8})},[e]),{bind:{ref:o=>{i.current=o},onMouseEnter:()=>t(!0),onMouseLeave:()=>t(!1)},render:o=>!e||n===null||typeof document>"u"?null:(0,Cn.createPortal)((0,W.createElement)("div",{className:"gp-tip",style:{left:n.left,bottom:n.bottom}},o.map((l,d)=>(0,W.createElement)("div",{key:d,className:d===0?"gp-tip__path":"gp-tip__note"},l))),document.body)}}function Fr(e){let[t,n]=(0,W.useState)(!1);return(0,W.useEffect)(()=>{if(e===null||typeof ResizeObserver>"u")return;let i=e.closest("[data-conversation-region]")??document.body,a=()=>n(i.clientWidth>0&&i.clientWidth<Ar);a();let s=new ResizeObserver(a);return s.observe(i),()=>s.disconnect()},[e]),t}var Ar=620;function Nn({sessionId:e,t}){let n=Me(e),r=Dr(),[i,a]=(0,W.useState)(null),s=Fr(i),o=(0,W.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,W.useEffect)(()=>{Sn(o.current,d,l);let _=o.current;return()=>{vt(_)}},[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,W.createElement)("span",{className:"gp-pill gp-pill--degraded",title:n.error.detail??t("pill.unavailable")},t("pill.unavailable"));let g=n.snapshot;if(g.showInputPill===!1)return null;let c=Mr(g.root),u=g.branch??`(${t("pill.detached")})`,m=g.dirty,k=m?"gp-pill--dirty":"gp-pill--synced",x=()=>{if(Pt(d)){Lt(d);return}pe(e)&&Rt(e,m?"changes":"overview"),At(d)};return(0,W.createElement)("span",{className:"gp-pill-wrap",ref:a},[(0,W.createElement)("button",{key:"btn",type:"button",className:`gp-pill ${k}${s?" gp-pill--compact":""}`,onClick:x,ref:r.bind.ref,onMouseEnter:r.bind.onMouseEnter,onMouseLeave:r.bind.onMouseLeave},[(0,W.createElement)("span",{key:"dot",className:"gp-pill__dot","aria-hidden":"true"}),(0,W.createElement)("span",{key:"repo",className:"gp-pill__repo"},c),(0,W.createElement)("span",{key:"git",className:"gp-pill__git"},["(",(0,W.createElement)("span",{key:"b",className:"gp-pill__branch"},u),")"])]),r.render([g.root,t(m?"pill.dirty":"pill.synced")])])}var B=require("react");function Pr(e){for(let t of e){let n=t.schema?.dict;if(n!==void 0&&"showInputPill"in n||JSON.stringify(t.schema).includes("showInputPill"))return t.ns}}function Gn({ctx:e,t}){let[,n]=(0,B.useState)(0),[r,i]=(0,B.useState)(!1),[a,s]=(0,B.useState)(!1),[o,l]=(0,B.useState)(null),[d,g]=(0,B.useState)(null),c=()=>{n(D=>D+1)},u=e.get("configForms"),m=(0,B.useMemo)(()=>u?.describe(),[u]);(0,B.useEffect)(()=>{if(m!==void 0)return m.ensure(),m.subscribe(c)},[m]);let k=m?.getSnapshot().view,x=(0,B.useMemo)(()=>k===void 0?void 0:Pr(k.namespaces),[k]),_=(0,B.useMemo)(()=>u!==void 0&&x!==void 0?u.get(x):void 0,[u,x]);(0,B.useEffect)(()=>{if(_!==void 0)return _.subscribe(c)},[_]);let F=_?.getSnapshot(),v=_!==void 0&&F!==void 0&&F.status==="ready",M=m?.getSnapshot().status,z=o??(typeof F?.value?.showInputPill=="boolean"?F.value.showInputPill:!0),A=d??(F?.value?.defaultDiffView==="split"?"split":"unified"),C=async(D,U,Q)=>{if(_!==void 0){s(!1),i(!0);try{let j=await _.set(D,U);Q(),j?(we(),setTimeout(()=>we(),1e3)):s(!0)}catch{Q(),s(!0)}finally{i(!1)}}},N=D=>(l(D),C("showInputPill",D,()=>l(null))),O=D=>D===A?Promise.resolve():(g(D),C("defaultDiffView",D,()=>g(null)));return u===void 0?(0,B.createElement)("p",{className:"gp-cfg__hint"},t("cfg.notLoaded")):v?(0,B.createElement)("div",{className:"gp-cfg"},[(0,B.createElement)("h3",{key:"title",className:"gp-cfg__title"},t("cfg.title")),(0,B.createElement)("label",{key:"row",className:"gp-cfg__row"},[(0,B.createElement)("input",{key:"switch",type:"checkbox",role:"switch",className:"gp-cfg__switch",checked:z,disabled:r||F?.writable===!1,onChange:D=>{N(D.currentTarget.checked)}}),(0,B.createElement)("span",{key:"text",className:"gp-cfg__text"},t("cfg.toggle"))]),(0,B.createElement)("p",{key:"hint",className:"gp-cfg__hint"},t("cfg.hint")),(0,B.createElement)("h3",{key:"difftitle",className:"gp-cfg__title",style:{marginTop:6}},t("cfg.diffTitle")),(0,B.createElement)("div",{key:"diffseg",className:"gp-seg gp-cfg__seg"},ye(["unified","split"],A,D=>{O(D)},D=>t(D==="unified"?"cfg.diffUnified":"cfg.diffSplit"),r||F?.writable===!1)),(0,B.createElement)("p",{key:"diffhint",className:"gp-cfg__hint"},t("cfg.diffHint")),a?(0,B.createElement)("p",{key:"error",className:"gp-cfg__err",role:"alert"},t("cfg.saveFailed")):null]):M==="idle"||M==="loading"?(0,B.createElement)("p",{className:"gp-cfg__hint"},t("common.loading")):(0,B.createElement)("p",{className:"gp-cfg__hint"},t("cfg.notLoaded"))}var Ge="gitPanel",Lr=["dsh-git-panel","@xbzbing/dsh-git-panel"],$r=["slots","locale","connection"],Hr="dsh-git-panel";function zr(e){wt(),Nt(e),e.effect(()=>e.locale.register(Ge,{zh:kt,en:_t})??void 0,"dsh-git-panel: dictionaries");let t=e.locale.bind(Ge),n=[],r=i=>{typeof i=="function"&&n.push(i)};r(e.slots.inject("conversation.view",()=>e.slots.register({name:"conversation.view",id:"git-panel",order:30,locale:Ge,label:()=>t("panel.tab")},i=>(0,Ze.createElement)(wn,{ctx:e,sessionId:i.sessionId,t})))),r(e.slots.inject("conversation.input.left",()=>e.slots.register({name:"conversation.input.left",id:"git-panel-pill",order:100,locale:Ge},i=>(0,Ze.createElement)(Nn,{sessionId:i.sessionId,t}))));for(let i of Lr)r(e.slots.inject("plugins.bundle.config",()=>e.slots.register({name:"plugins.bundle.config",key:i,locale:Ge},a=>a.view==="summary"?t("cfg.title"):(0,Ze.createElement)(Gn,{ctx:e,t}))));e.effect(()=>{let i=e.on("connection/reset",()=>we());return()=>{typeof i=="function"&&i();for(let a of n.splice(0))try{a()}catch{}Gt()}},"dsh-git-panel: lifecycle")}module.exports={name:Hr,inject:$r,apply:zr};
414
+
415
+ /* ===================================================================
416
+ * Compact (mobile / narrow-split) layout
417
+ * The panel root carries data-layout="compact" at or below COMPACT_BP
418
+ * (layout.ts). The three-column tabs collapse to a single column that
419
+ * drills from a list into a detail/diff/preview with a back button; the
420
+ * branch filter moves into a bottom sheet. All rules below hang off the
421
+ * attribute, so the wide layout is byte-for-byte unchanged. Portaled
422
+ * surfaces (modal, sheet) sit outside .gp-panel and are keyed off their
423
+ * own classes / viewport media queries instead.
424
+ * =================================================================== */
425
+
426
+ /* Tab bar: wrap the trailing cluster onto a second full-width row so the
427
+ * font stepper + version bar stay reachable instead of being hidden. */
428
+ .gp-panel[data-layout="compact"] .gp-tabbar{flex-wrap:wrap;row-gap:4px}
429
+ .gp-panel[data-layout="compact"] .gp-tabbar__trailing{display:flex;flex-basis:100%;align-items:center;gap:8px;margin-top:2px}
430
+ .gp-panel[data-layout="compact"] .gp-tabbar .gp-font,
431
+ .gp-panel[data-layout="compact"] .gp-tabbar .gp-verbar{display:inline-flex}
432
+ .gp-panel[data-layout="compact"] .gp-tab{height:36px}
433
+
434
+ /* Shared drill-in back bar (overview detail / files preview). The Changes
435
+ * diff and Files bar reuse just the .gp-subhead__back button inline. */
436
+ .gp-subhead{display:flex;align-items:center;gap:8px;padding:7px 10px;border-bottom:1px solid var(--dsw-alias-border-l2);flex:none}
437
+ .gp-subhead__back{display:inline-flex;align-items:center;gap:6px;height:32px;padding:0 10px;border:1px solid var(--dsw-alias-border-l2);border-radius:8px;background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-secondary);font:inherit;font-size:12px;cursor:pointer;flex:none;white-space:nowrap}
438
+ .gp-subhead__back:hover{background:var(--dsw-alias-interactive-bg-hover)}
439
+ .gp-subhead__back:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:-2px}
440
+ .gp-subhead__title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;color:var(--dsw-alias-label-tertiary)}
441
+
442
+ /* Overview: single column, each pane fills width + height. */
443
+ .gp-overview--compact .gp-col{width:100%}
444
+ /* Two-line commit rows: subject on top, hash\xB7author\xB7time below; the graph
445
+ * cell stretches to the taller row so lane edges still connect. */
446
+ .gp-commit-row--compact{align-items:stretch}
447
+ .gp-commit-lines{display:flex;flex-direction:column;justify-content:center;gap:2px;min-width:0}
448
+ .gp-commit-row--compact .gp-commit-subject{font-size:13px}
449
+ .gp-commit-sub{display:flex;align-items:center;gap:8px;min-width:0;font-size:11px;color:var(--dsw-alias-label-tertiary)}
450
+ .gp-commit-row--compact .gp-commit-author{min-width:0;overflow:hidden;text-overflow:ellipsis}
451
+ .gp-commit-row--compact .gp-commit-date{flex:none}
452
+
453
+ /* Changes / Files: the single visible pane takes the full width. */
454
+ .gp-changes--compact .gp-changes__left,
455
+ .gp-changes--compact .gp-changes__right{flex:1 1 100%;min-width:0;width:100%}
456
+ .gp-files--compact .gp-files__tree,
457
+ .gp-files--compact .gp-files__preview{flex:1 1 100%;min-width:0;width:100%}
458
+
459
+ /* Image compare stacks vertically in compact: two ~195px columns are unusable
460
+ * on a phone. The single-image before/after mode keeps its full-height row.
461
+ * The portaled diff modal lives outside .gp-panel, so it keeps side-by-side
462
+ * (near-fullscreen at small viewports, where two columns still fit). */
463
+ .gp-panel[data-layout="compact"] .gp-imgcmp:not(.gp-imgcmp--single){grid-template-columns:1fr;grid-template-rows:1fr 1fr}
464
+
465
+ /* Bottom sheet (compact branch/ref filter): slides up from the bottom edge,
466
+ * portaled over the panel. Honors the home-indicator safe area. */
467
+ .gp-sheet-backdrop{position:fixed;inset:0;z-index:1000;display:flex;align-items:flex-end;background:color-mix(in srgb,var(--dsw-alias-bg-base,#000) 50%,transparent);animation:gp-fade-in .12s ease}
468
+ .gp-sheet{display:flex;flex-direction:column;width:100%;max-height:72vh;background:var(--dsw-alias-bg-layer-2);border-radius:16px 16px 0 0;box-shadow:0 -12px 40px rgba(0,0,0,.3);animation:gp-sheet-up .22s cubic-bezier(.16,1,.3,1);padding-bottom:env(safe-area-inset-bottom)}
469
+ @keyframes gp-sheet-up{from{transform:translateY(100%)}to{transform:none}}
470
+ .gp-sheet__bar{display:flex;align-items:center;gap:8px;padding:12px 14px;border-bottom:1px solid var(--dsw-alias-border-l2);flex:none}
471
+ .gp-sheet__title{font-size:14px;font-weight:600;color:var(--dsw-alias-label-primary)}
472
+ .gp-sheet__close{margin-left:auto;flex:none}
473
+ .gp-sheet__body{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:6px 0}
474
+ .gp-sheet__body .gp-branch-row{padding-top:8px;padding-bottom:8px}
475
+
476
+ /* Touch devices (independent of width \u2014 e.g. a tablet in landscape): no hover
477
+ * means row actions must stay visible, and hit targets grow. */
478
+ @media (hover:none){
479
+ .gp-file-row__actions{visibility:visible}
480
+ .gp-icon-btn{width:34px;height:34px}
481
+ .gp-btn{height:36px}
482
+ .gp-tree-row{padding-top:7px;padding-bottom:7px}
483
+ .gp-branch-row{padding-top:8px;padding-bottom:8px}
484
+ }
485
+
486
+ /* Diff modal on a small viewport (it is portaled outside .gp-panel, so this is
487
+ * keyed on the viewport, not the panel attribute): near-fullscreen, wrapping
488
+ * toolbar. The base rule already uses vw/vh, so this only tightens the fit. */
489
+ @media (max-width:640px){
490
+ .gp-modal-backdrop{padding:10px}
491
+ .gp-modal{width:96vw;height:90vh;border-radius:12px}
492
+ .gp-modal__bar{flex-wrap:wrap;row-gap:6px}
493
+ }
494
+
495
+ @media (prefers-reduced-motion:reduce){
496
+ .gp-sheet,.gp-sheet-backdrop,.gp-modal,.gp-modal-backdrop{animation:none}
497
+ }
498
+ `,jt=!1;function _n(){if(jt||typeof document>"u")return;let e="dsh-git-panel/client.css";if(document.querySelector(`style[data-plugin-css="${e}"]`)!==null){jt=!0;return}let t=document.createElement("style");t.dataset.plugin="@xbzbing/dsh-git-panel",t.dataset.pluginCss=e,t.textContent=Ir,document.head.appendChild(t),jt=!0}var Sn={"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":"\u5728 GitHub \u4E0A\u6253\u5F00\u4ED3\u5E93","overview.head":"HEAD\uFF08\u5F53\u524D\u5206\u652F\uFF09","overview.local":"\u672C\u5730","overview.remote":"\u8FDC\u7A0B","overview.tags":"\u6807\u7B7E","overview.search":"\u641C\u7D22\u63D0\u4EA4\uFF08\u6D88\u606F / \u54C8\u5E0C\uFF09","overview.searchShort":"\u641C\u7D22\u63D0\u4EA4","overview.allUsers":"\u5168\u90E8\u4F5C\u8005","overview.allTime":"\u5168\u90E8\u65F6\u95F4","overview.today":"\u4ECA\u5929","overview.last7d":"\u8FD1 7 \u5929","overview.last30d":"\u8FD1 30 \u5929","overview.selectCommit":"\u9009\u62E9\u4E00\u4E2A\u63D0\u4EA4\u67E5\u770B\u8BE6\u60C5","overview.noMessage":"\uFF08\u65E0\u63D0\u4EA4\u6B63\u6587\uFF09","overview.noResults":"\u6CA1\u6709\u5339\u914D\u7684\u63D0\u4EA4","overview.loadFailed":"\u52A0\u8F7D\u5931\u8D25","overview.detailFailed":"\u8BE6\u60C5\u52A0\u8F7D\u5931\u8D25","overview.diffFailed":"\u5DEE\u5F02\u52A0\u8F7D\u5931\u8D25","overview.openFileDiff":"\u67E5\u770B\u8BE5\u6587\u4EF6\u5728\u6B64\u63D0\u4EA4\u4E2D\u7684\u53D8\u66F4","overview.fetch":"\u62C9\u53D6\u8FDC\u7A0B","overview.branchesError":"\u5206\u652F\u52A0\u8F7D\u5931\u8D25","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","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.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","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\u6807\u7B7E\u6216\u8D2E\u85CF\u53EF\u80FD\u5DF2\u88AB\u5220\u9664\uFF09","error.invalidName":"\u540D\u79F0\u4E0D\u5408\u6CD5","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.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"},Cn={"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":"Open repository on GitHub","overview.head":"HEAD (Current Branch)","overview.local":"Local","overview.remote":"Remote","overview.tags":"Tags","overview.search":"Search commits (message / hash)","overview.searchShort":"Search","overview.allUsers":"All authors","overview.allTime":"All time","overview.today":"Today","overview.last7d":"Last 7 days","overview.last30d":"Last 30 days","overview.selectCommit":"Select a commit to see details","overview.noMessage":"(no commit body)","overview.noResults":"No matching commits","overview.loadFailed":"Load failed","overview.detailFailed":"Failed to load details","overview.diffFailed":"Failed to load diff","overview.openFileDiff":"View this file\u2019s changes in this commit","overview.fetch":"Fetch","overview.branchesError":"Failed to load branches","overview.filterBranch":"Filter by branch","overview.backToList":"Back to list","overview.createTag":"Create tag","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.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","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 tag or stash may have been removed)","error.invalidName":"Invalid name","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.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 ut=require("react");var Xr=new Set(["cwd-unavailable"]),Ut=3e4,Vr=6e4,pt=class{constructor(t,n){this.remote=t;this.sessionId=n}view={state:"cold"};listeners=new Set;timer;inflight;pendingRefresh=!1;disposed=!1;pollMs=Ut;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||Ut,this.setView({state:"ready",snapshot:t.value});else if(t.error.code!=="cancelled")if(Xr.has(t.error.code))this.pollMs=Vr,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||Ut,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 Kr="/api",Jr="gitPanel";function Br(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,Kr,r,a,i)}catch{}}function Or(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 de(e,t){return!e.ok||e.value.kind!==t?null:e.value}function Ce(e){return e!==void 0&&e!==""}var Nn=new WeakMap;function We(e){let t=Nn.get(e);if(t!==void 0)return t;let n=async(a,i,o)=>{let s=Br(e);if(s===void 0)return{ok:!1,error:{code:"git-unavailable",message:"no connection"}};try{let l=await s(`${Jr}/${a}`,{args:{request:i}},o);return Or(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 Nn.set(e,r),r}var Ee=new Map,Tn,Qt;function En(e){Qt=e,Tn=We(e)}function je(e){let t=Ee.get(e);if(t===void 0){let n=Tn??(Qt?We(Qt):void 0);t=new pt(n??Ur(),e),Ee.set(e,t)}return t}var qr=6e4,gt=new Map;function Wr(e){let t=gt.get(e);t!==void 0&&(clearTimeout(t),gt.delete(e)),Pe.set(e,(Pe.get(e)??0)+1)}function jr(e){let t=(Pe.get(e)??1)-1;if(t>0){Pe.set(e,t);return}Pe.delete(e);let n=setTimeout(()=>{gt.delete(e),!((Pe.get(e)??0)>0)&&(Ee.get(e)?.dispose(),Ee.delete(e))},qr);gt.set(e,n)}var Pe=new Map;function Ue(){for(let e of Ee.values())e.resync()}function Rn(){for(let e of Ee.values())e.dispose();Ee.clear()}function Ur(){let e=async()=>({ok:!1,error:{code:"git-unavailable"}});return{snapshot:e,run:e,query:e,suggest:e,version:e}}function ft(e){let[,t]=(0,ut.useState)(0),n=e?je(e):void 0;return(0,ut.useEffect)(()=>{if(n===void 0||e===void 0)return;Wr(e);let r=n.subscribe(()=>t(a=>a+1));return n.ensure(),()=>{r(),jr(e)}},[n,e]),n?n.getSnapshot():{state:"cold"}}var T=require("react");var Gn="[data-conversation-tabs]",Ye='[data-conversation-tabs] button[role="tab"]',Yt=new Map,Qe=new Map;function Mn(e,t){let n=Qe.get(e);if(n!==void 0&&n.size>0){for(let r of n)r(t);return}Yt.set(e,t)}function Dn(e){let t=Yt.get(e);return t===void 0?null:(Yt.delete(e),t)}function An(e,t){let n=Qe.get(e);return n===void 0&&(n=new Set,Qe.set(e,n)),n.add(t),()=>{let r=Qe.get(e);r!==void 0&&(r.delete(t),r.size===0&&Qe.delete(e))}}var Qr=6e4,Zt=new Map;function Pn(e,t){Zt.set(e,{tab:t,leftAt:Date.now()})}function Ln(e){let t=Zt.get(e);return t===void 0?null:Date.now()-t.leftAt>Qr?(Zt.delete(e),null):t.tab}function Hn(e){if(typeof document>"u")return!1;let t=document.querySelectorAll(Ye);for(let n of t)if((n.textContent??"").trim()===e)return n.getAttribute("aria-selected")!=="true"&&n.click(),!0;return!1}function Fn(e){if(typeof document>"u")return!1;let t=document.querySelectorAll(Ye);for(let n of t)if((n.textContent??"").trim()===e)return n.getAttribute("aria-selected")==="true";return!1}function zn(e){if(typeof document>"u")return!1;let t=document.querySelectorAll(Ye);for(let n of t)if((n.textContent??"").trim()!==e)return n.getAttribute("aria-selected")!=="true"&&n.click(),!0;return!1}var d=require("react"),At=require("react-dom");var F=require("react");function ge(e,t=15){return(0,F.createElement)("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"},e)}function mt({size:e}){return ge([(0,F.createElement)("circle",{key:"c",cx:8,cy:8,r:2.4}),(0,F.createElement)("line",{key:"l1",x1:8,y1:1.5,x2:8,y2:5.6}),(0,F.createElement)("line",{key:"l2",x1:8,y1:10.4,x2:8,y2:14.5})],e)}function $n({size:e}){return ge([(0,F.createElement)("path",{key:"a",d:"M4 2v8"}),(0,F.createElement)("path",{key:"b",d:"M2 4h4"}),(0,F.createElement)("circle",{key:"c",cx:4,cy:12,r:1.6}),(0,F.createElement)("circle",{key:"d",cx:12,cy:4,r:1.6}),(0,F.createElement)("path",{key:"e",d:"M12 6v4"}),(0,F.createElement)("path",{key:"f",d:"M10 12h4"})],e)}function en({size:e}){return ge([(0,F.createElement)("circle",{key:"a",cx:4,cy:3,r:1.6}),(0,F.createElement)("circle",{key:"b",cx:4,cy:13,r:1.6}),(0,F.createElement)("circle",{key:"c",cx:12,cy:5,r:1.6}),(0,F.createElement)("path",{key:"d",d:"M4 4.6v6.8"}),(0,F.createElement)("path",{key:"e",d:"M12 6.6c0 3-4 2.4-8 4"})],e)}function Le({size:e}){return ge([(0,F.createElement)("path",{key:"a",d:"M2 7V3h4l8 8-4 4z"}),(0,F.createElement)("circle",{key:"b",cx:4.5,cy:5.5,r:.8,fill:"currentColor"})],e)}function Ne({size:e,open:t}){return ge([(0,F.createElement)("path",{key:"a",d:t?"M3 6l5 5 5-5":"M6 3l5 5-5 5"})],e)}function He({size:e}){return ge([(0,F.createElement)("path",{key:"a",d:"M4 4l8 8M12 4l-8 8"})],e)}function Fe({size:e}){return ge([(0,F.createElement)("path",{key:"a",d:"M10 3L5 8l5 5"}),(0,F.createElement)("path",{key:"b",d:"M5 8h8"})],e)}function In({size:e}){return ge([(0,F.createElement)("path",{key:"a",d:"M2 3h12l-4.5 5.5V13L6.5 11V8.5z"})],e)}function ht({size:e}){return ge([(0,F.createElement)("path",{key:"a",d:"M13 8a5 5 0 1 1-1.5-3.5"}),(0,F.createElement)("path",{key:"b",d:"M13 2v3h-3"})],e)}function Xn({size:e}){return ge([(0,F.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,F.createElement)("path",{key:"b",d:"M13 11.6v2.8M11.6 13h2.8"})],e)}function Vn({size:e}){return ge([(0,F.createElement)("path",{key:"a",d:"M4 2h5l3 3v9H4z"}),(0,F.createElement)("path",{key:"b",d:"M9 2v3h3"})],e)}function tn({size:e}){return ge([(0,F.createElement)("path",{key:"a",d:"M2 5.5h12V13H2z"}),(0,F.createElement)("path",{key:"b",d:"M1.5 3h13v2.5h-13z"}),(0,F.createElement)("path",{key:"c",d:"M6.5 8.5h3"})],e)}function Kn({size:e}){return ge([(0,F.createElement)("path",{key:"a",d:"M3 4.5h10"}),(0,F.createElement)("path",{key:"b",d:"M5.5 4.5V3h5v1.5"}),(0,F.createElement)("path",{key:"c",d:"M4.5 4.5l.7 9h5.6l.7-9"})],e)}function Jn({size:e}){return ge([(0,F.createElement)("path",{key:"a",d:"M3 7a5 5 0 1 1 1.3 3.4"}),(0,F.createElement)("path",{key:"b",d:"M3 3.5V7h3.5"})],e)}function yt({size:e}){return ge([(0,F.createElement)("path",{key:"a",d:"M13 3v10"}),(0,F.createElement)("path",{key:"b",d:"M10.5 8L3 3.5v9z",fill:"currentColor"})],e)}function Bn({size:e}){return ge([(0,F.createElement)("path",{key:"a",d:"M5 2.5h4l2.5 2.5v7.5h-6.5z"}),(0,F.createElement)("path",{key:"b",d:"M9 2.5V5h2.5"}),(0,F.createElement)("path",{key:"c",d:"M11 12.5v1.5h-6.5V6"})],e)}function On({size:e=15}){return(0,F.createElement)("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"currentColor"},(0,F.createElement)("path",{"fill-rule":"evenodd",d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z"}))}function qn(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 Wn(e,t){let n=[],r=[],a=[],i=[],o=0,s=()=>{if(i.length===0)return o++;let c=Math.min(...i);return i.splice(i.indexOf(c),1),c},l=c=>{c!==null&&!i.includes(c)&&i.push(c)};for(let c of e){let p=b=>{let _=r.findIndex(P=>P===b);return _===-1&&(_=r.findIndex(P=>P===null),_===-1&&(_=r.length,r.push(null),a.push(null)),r[_]=b,a[_]=s()),_},g=p(c.hash),m=a[g],k=[...r],v=[...a],x=c.parents,E=x.length>=2;for(let b=0;b<r.length;b++)b!==g&&r[b]===c.hash&&(l(a[b]),r[b]=null,a[b]=null);let G=-1,X=[];if(x.length===0)l(a[g]),r[g]=null,a[g]=null;else{let b=x[0],_=t==="compact"?r.findIndex((P,z)=>P===b&&z!==g):-1;if(_===-1)r[g]=b,G=g;else{let P=Math.min(g,_),z=Math.max(g,_);r[P]=b,l(a[z]),r[z]=null,a[z]=null,G=P}for(let P=1;P<x.length;P++)X.push(p(x[P]))}let V=[];for(let b=0;b<k.length;b++){let _=k[b];if(_!==null)if(_===c.hash)V.push({fromLane:b,toLane:g,color:v[b],kind:"into"});else{let P=r[b]===_?b:r.findIndex(z=>z===_);P!==-1&&V.push({fromLane:b,toLane:P,color:v[b],kind:"pass"})}}G!==-1&&V.push({fromLane:g,toLane:G,color:a[G],kind:"out"});for(let b of X)V.push({fromLane:g,toLane:b,color:a[b],kind:"out"});for(n.push({commit:c,lane:g,color:m,edges:V,merge:E});r.length>0&&r[r.length-1]===null;)r=r.slice(0,-1),a=a.slice(0,-1)}return n}function jn(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,c=a.children.find(p=>p.name===s&&p.dir===!l);c===void 0&&(c={name:s,path:i,dir:!l,children:[],...l?{meta:n.meta}:{}},a.children.push(c)),a=c}}return Un(t),Qn(t.children)}function Un(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)Un(t)}function Qn(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:Qn(n.children)}})}function ze(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 Ze(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 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=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 bt={added:"A",modified:"M",deleted:"D",renamed:"R",untracked:"U",conflicted:"!",typechange:"T"};function vt(e){return e==="added"||e==="untracked"?"gp-status--added":e==="deleted"?"gp-status--deleted":e==="renamed"?"gp-status--renamed":"gp-status--modified"}var w=require("react");var Yr={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 rn(e){let t=e.lastIndexOf(".");return t<0?null:Yr[e.slice(t+1).toLowerCase()]??null}function Yn(e){return/^Binary files .* differ$/m.test(e)||/^GIT binary patch$/m.test(e)}function Zn(e){return rn(e)!==null}function er(e){return/\.svg$/i.test(e)}function Zr(e){let t=an(e);return t.length===0?!1:t.every(n=>n.startsWith("+")||n.startsWith(" "))&&t.some(n=>n.startsWith("+"))&&/^\+\+\+ /m.test(e)&&/--- \/dev\/null/m.test(e)}function ea(e){let t=an(e);return t.length===0?!1:t.every(n=>n.startsWith("-")||n.startsWith(" "))&&t.some(n=>n.startsWith("-"))&&/^\+\+\+ \/dev\/null/m.test(e)}function an(e){let t=e.split(`
499
+ `),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 tr(e){let t=0,n=0;for(let r of an(e))r.startsWith("+")?t++:r.startsWith("-")&&n++;return{add:t,del:n}}var ta=/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/;function nr(e){let t=[],n=e.split(`
500
+ `),r=0,a=0,i=!0,o=!1,s=0;for(;s<n.length&&!n[s].startsWith("@@");s++);for(;s<n.length;s++){let l=n[s];if(l.startsWith("@@")){let g=ta.exec(l);if(g){let m=Number(g[1]),k=Number(g[3]),v=m-k;if(i)k>1&&t.push($e({rightStart:1,count:k-1,delta:v,atStart:!0,atEnd:!1}));else{let x=k-a;x>0&&t.push($e({rightStart:a,count:x,delta:v,atStart:!1,atEnd:!1}))}r=m,a=k,i=!1}t.push({kind:"hunk",leftNo:null,rightNo:null,leftText:null,rightText:null,text:l});continue}if(l.startsWith("\\"))continue;let c=l[0],p=l.slice(1);c==="+"?(t.push({kind:"add",leftNo:null,rightNo:a,leftText:null,rightText:p}),a++,o=!0):c==="-"?(t.push({kind:"del",leftNo:r,rightNo:null,leftText:p,rightText:null}),r++,o=!0):c===" "&&(t.push({kind:"context",leftNo:r,rightNo:a,leftText:p,rightText:p}),r++,a++,o=!0)}return o&&!i&&!Zr(e)&&!ea(e)&&t.push($e({rightStart:a,count:null,delta:r-a,atStart:!1,atEnd:!0})),na(t)}function $e(e){return{kind:"gap",leftNo:null,rightNo:null,leftText:null,rightText:null,gap:e}}function na(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 c=a[l],p=o[l];if(c&&p){let g=ra(c.leftText??"",p.rightText??"");t.push({kind:"mod",leftNo:c.leftNo,rightNo:p.rightNo,leftText:c.leftText,rightText:p.rightText,...g!==null?{leftWord:g.left,rightWord:g.right}:{}})}else c?t.push({kind:"del",leftNo:c.leftNo,rightNo:null,leftText:c.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 ra(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 aa(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 xe=20;function on(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 rr(e,t,n,r,a,i){let o=e.findIndex(g=>g.kind==="gap"&&g.gap?.rightStart===t);if(o<0)return e.slice();let s=e[o].gap,l=aa(s.delta,r,a),c=[];if(s.atEnd)return c.push(...l),!i&&a.length>0&&c.push($e({rightStart:r+a.length,count:null,delta:s.delta,atStart:!1,atEnd:!0})),[...e.slice(0,o),...c,...e.slice(o+1)];let p=s.count??a.length;if(n==="all"||a.length>=p)c.push(...l);else if(n==="down"){c.push(...l);let g=p-a.length;c.push($e({rightStart:s.rightStart+a.length,count:g,delta:s.delta,atStart:!1,atEnd:!1}))}else{let g=p-a.length;c.push($e({rightStart:s.rightStart,count:g,delta:s.delta,atStart:s.atStart,atEnd:!1})),c.push(...l)}return[...e.slice(0,o),...c,...e.slice(o+1)]}var Rt=require("@deepseek-ai/dsh-client-ui-primitives");function ar(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}var fe=require("react"),wt=5e3,xt=120;function kt(e,t){let[n,r]=(0,fe.useState)(e);return(0,fe.useEffect)(()=>{let a=setTimeout(()=>r(e),t);return()=>clearTimeout(a)},[e,t]),n}function _t(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 sn(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 c=o+l.text.length,p=Math.max(n,o),g=Math.min(r,c);if(g>p&&i.push((0,fe.createElement)("span",{key:`${a}-${s++}`,style:l.style},l.text.slice(p-o,g-o))),o=c,o>=r)break}return i}function St(e,t,n,r,a,i){let o=[],s=0,l=[...t].sort((c,p)=>c[0]-p[0]);for(let[c,p]of l){if(c<s)continue;c>s&&o.push(...sn(n,e,s,c,`${r}b${s}`));let g=a!==null&&a[0]===c&&a[1]===p;o.push((0,fe.createElement)("mark",{key:`mk${r}-${c}`,className:`gp-find-hit${g?" gp-find-hit--active":""}`,...g?{ref:i}:{}},sn(n,e,c,p,`mk${r}-${c}`))),s=p}return s<e.length&&o.push(...sn(n,e,s,e.length,`${r}e`)),o}function Ct(e){return(0,fe.createElement)("div",{key:"find",className:"gp-find"},[(0,fe.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,fe.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,fe.createElement)("span",{key:"cnt",className:"gp-find__count"},e.query===""?"":e.matches===0?e.t("files.findNoMatch"):`${e.active+1}/${e.matches}`),(0,fe.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,fe.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,fe.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 _e=require("react");function Nt(e,t,n){let r=n(`diff.${e}`);return(0,_e.createElement)("div",{className:`gp-imgcmp__pane gp-imgcmp__pane--${e}`},[(0,_e.createElement)("div",{key:"head",className:"gp-imgcmp__head"},r),t===void 0?(0,_e.createElement)("div",{key:"missing",className:"gp-imgcmp__missing"},n("diff.imageMissing")):(0,_e.createElement)("div",{key:"img",className:"gp-imgcmp__img"},(0,_e.createElement)("img",{src:t,alt:r}))])}function ir({oldUrl:e,newUrl:t,mode:n,t:r}){return n==="before"?(0,_e.createElement)("div",{className:"gp-imgcmp gp-imgcmp--single"},Nt("before",e,r)):n==="after"?(0,_e.createElement)("div",{className:"gp-imgcmp gp-imgcmp--single"},Nt("after",t,r)):(0,_e.createElement)("div",{className:"gp-imgcmp"},[Nt("before",e,r),Nt("after",t,r)])}var Gt=(0,w.memo)(function({text:t,mode:n,path:r,remote:a,sessionId:i,imageSpec:o,t:s}){let l=(0,w.useMemo)(()=>nr(t),[t]),c=Yn(t),p=(0,Rt.useCodeHighlighter)(r===void 0?void 0:(0,Rt.languageForPath)(r)),[g,m]=(0,w.useState)(l);(0,w.useEffect)(()=>{m(l)},[l]);let k=sa(g,m,a,i,r,o),v=r!==void 0&&er(r),[x,E]=(0,w.useState)("render");(0,w.useEffect)(()=>{E("render")},[r]);let X=(c||v)&&r!==void 0&&Zn(r)&&a!==void 0&&i!==void 0&&o!==void 0&&(!v||x==="render"),V=da(X?a:void 0,X?i:void 0,X?r:void 0,X?o:void 0),[b,_]=(0,w.useState)(!1),[P,z]=(0,w.useState)(""),[U,C]=(0,w.useState)(!1),[$,ne]=(0,w.useState)(0),Q=(0,w.useRef)(null),re=(0,w.useRef)(null),ae=(0,w.useRef)(null);(0,w.useEffect)(()=>{_(!1),z(""),ne(0)},[t,r]);let q=(0,w.useMemo)(()=>ia(n,g),[n,g]),Y=(0,w.useMemo)(()=>q.map(Z=>({key:Z.key,text:Z.text.toLowerCase()})),[q]),N=kt(P,xt),le=U?N:N.toLowerCase(),A=U?q:Y,S=(0,w.useMemo)(()=>oa(A,le),[A,le]);(0,w.useEffect)(()=>{ne(0)},[le]);let L=S.length===0?0:Math.min($,S.length-1),K=S.length>0?S[L]:null,ee=(0,w.useMemo)(()=>{let Z=new Map;for(let W of S){let me=Z.get(W.cellKey)??[];me.push([W.start,W.end]),Z.set(W.cellKey,me)}return Z},[S]);(0,w.useEffect)(()=>{let Z=W=>{if(!((W.ctrlKey||W.metaKey)&&(W.key==="f"||W.key==="F")))return;let me=Q.current;me===null||me.offsetParent===null||(W.preventDefault(),_(!0),requestAnimationFrame(()=>re.current?.select()))};return document.addEventListener("keydown",Z),()=>document.removeEventListener("keydown",Z)},[]),(0,w.useEffect)(()=>{ae.current?.scrollIntoView({block:"center",inline:"nearest"})},[L,S]);let ce=(0,w.useCallback)(Z=>{ne(W=>S.length===0?0:(W+Z+S.length)%S.length)},[S.length]),D=b&&le!==""?{perCell:ee,activeKey:K?.cellKey??null,activeRange:K?[K.start,K.end]:null,activeRef:ae}:null;if(X){let Z=(()=>{if(V.kind==="idle"||V.kind==="loading")return(0,w.createElement)("div",{className:"gp-empty"},s("common.loading"));if(V.kind==="ready"){let W=V.res;if(W.tooLarge===!0)return(0,w.createElement)("div",{className:"gp-empty"},s("diff.tooLarge"));if(W.mime!==null&&(W.old!==void 0||W.new!==void 0))return(0,w.createElement)(ir,{oldUrl:W.old,newUrl:W.new,mode:n,t:s})}return(0,w.createElement)("div",{className:"gp-empty"},s("diff.binary"))})();return v?or(x,E,Z,s):Z}if(c&&!v)return(0,w.createElement)("div",{className:"gp-empty"},s("diff.binary"));let M=(()=>{if(t.trim()==="")return(0,w.createElement)("div",{className:"gp-empty"},s("diff.empty"));if(n==="before")return sr(dr(g),p,D);if(n==="after")return sr(cr(g),p,D);if(n==="unified"){let Z=on(g);return(0,w.createElement)("div",{className:"gp-diff__unified"},Z.flatMap((W,me)=>pa(W,me,p,k,D,s)))}return(0,w.createElement)("div",{className:"gp-diff__side"},g.flatMap((Z,W)=>ca(Z,W,p,k,D,s)))})(),oe=b?(0,w.createElement)(Ct,{inputRef:re,query:P,matches:S.length,active:L,caseSensitive:U,onChange:z,onToggleCase:()=>C(Z=>!Z),onStep:ce,onClose:()=>_(!1),t:s}):null,ke=(0,w.createElement)("div",{className:"gp-diff__wrap",ref:Q},[oe,M]);return v?or(x,E,ke,s):ke});function ia(e,t){let n=[];return e==="before"?(dr(t).forEach((r,a)=>n.push({key:`c${a}`,text:r.text})),n):e==="after"?(cr(t).forEach((r,a)=>n.push({key:`c${a}`,text:r.text})),n):e==="unified"?(on(t).forEach((r,a)=>{if(r.kind==="hunk"||r.kind==="gap")return;let i=r.rightText??r.leftText??"";i!==""&&n.push({key:`c${a}`,text:i})}),n):(t.forEach((r,a)=>{r.kind==="hunk"||r.kind==="gap"||(r.leftText!==null&&r.leftText!==""&&n.push({key:`l${a}`,text:r.leftText}),r.rightText!==null&&r.rightText!==""&&n.push({key:`r${a}`,text:r.rightText}))}),n)}function oa(e,t){if(t==="")return[];let n=[];for(let r of e)for(let[a,i]of _t(r.text,t))if(n.push({cellKey:r.key,start:a,end:i}),n.length>=wt)return n;return n}function or(e,t,n,r){let a=(i,o)=>(0,w.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,w.createElement)("div",{className:"gp-svgdiff"},[(0,w.createElement)("div",{key:"bar",className:"gp-svgdiff__bar"},(0,w.createElement)("div",{className:"gp-seg"},[a("render",r("diff.svgRender")),a("source",r("diff.svgSource"))])),(0,w.createElement)("div",{key:"body",className:"gp-svgdiff__body"},n)])}function sa(e,t,n,r,a,i){let[o,s]=(0,w.useState)(null),l=(0,w.useRef)(0);(0,w.useEffect)(()=>{l.current+=1,s(null)},[e]);let c=(0,w.useCallback)((p,g)=>{if(n===void 0||r===void 0||a===void 0||i===void 0)return;let m=`${p.rightStart}:${g}`;s(m);let k=++l.current,{start:v,end:x}=la(p,g),E=i.base==="commit"&&i.commit!==void 0?{kind:"file-lines",path:a,base:"commit",commit:i.commit,start:v,end:x}:i.base==="staged"?{kind:"file-lines",path:a,base:"staged",start:v,end:x}:{kind:"file-lines",path:a,base:"worktree",start:v,end:x};n.query({sessionId:r,query:E}).then(G=>{if(k!==l.current)return;let X=de(G,"file-lines");s(null),X!==null&&t(V=>rr(V,p.rightStart,g,X.start,X.lines,X.eof))}).catch(()=>{k===l.current&&s(null)})},[n,r,a,i,t]);return{busy:o,run:c}}function la(e,t){if(e.atEnd)return{start:e.rightStart,end:e.rightStart+xe-1};let n=e.count??xe;return t==="all"||n<=xe?{start:e.rightStart,end:e.rightStart+n-1}:t==="down"?{start:e.rightStart,end:e.rightStart+xe-1}:{start:e.rightStart+n-xe,end:e.rightStart+n-1}}function da(e,t,n,r){let[a,i]=(0,w.useState)({kind:"idle"}),o=r?.base,s=r?.commit;return(0,w.useEffect)(()=>{if(e===void 0||t===void 0||n===void 0||o===void 0)return;let l=!0;i({kind:"loading"});let c=o==="commit"&&s!==void 0?{kind:"image-diff",path:n,base:"commit",commit:s}:o==="staged"?{kind:"image-diff",path:n,base:"staged"}:{kind:"image-diff",path:n,base:"worktree"};return e.query({sessionId:t,query:c}).then(p=>{if(!l)return;let g=de(p,"image-diff");i(g!==null?{kind:"ready",res:g}:{kind:"failed"})}).catch(()=>{l&&i({kind:"failed"})}),()=>{l=!1}},[e,t,n,o,s]),a}function Tt(e,t=""){return e.map((n,r)=>(0,w.createElement)("span",{key:`${t}${r}`,style:n.style},n.text))}function lr(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 St(e,a,r,t,i,n.activeRef)}function Et(e,t,n,r,a=null){if(n==="")return(0,w.createElement)("div",{key:t,className:e},"\xA0");let i=r(n)?.[0],o=lr(n,t,a,i);return o!==null?(0,w.createElement)("div",{key:t,className:e},o):(0,w.createElement)("div",{key:t,className:e},i===void 0?n:Tt(i))}function ln(e,t,n,r,a,i,o=null){let s=i(n)?.[0]??[{text:n,style:{}}],l=lr(n,t,o,s);if(l!==null)return(0,w.createElement)("div",{key:t,className:e},l);let[c,p,g]=ar(s,r);return(0,w.createElement)("div",{key:t,className:e},[...Tt(c,"p"),(0,w.createElement)("span",{key:"w",className:a},p.length===0?"\xA0":Tt(p)),...Tt(g,"s")])}function dr(e){return e.filter(t=>t.leftText!==null).map(t=>({no:t.leftNo,text:t.leftText}))}function cr(e){return e.filter(t=>t.rightText!==null).map(t=>({no:t.rightNo,text:t.rightText}))}function sr(e,t,n=null){return(0,w.createElement)("div",{className:"gp-diff__single"},e.flatMap((r,a)=>[(0,w.createElement)("div",{key:`n${a}`,className:"gp-diff-no"},r.no??""),Et("gp-diff-cell",`c${a}`,r.text,t,n)]))}function ca(e,t,n,r,a,i){if(e.kind==="hunk")return[(0,w.createElement)("div",{key:`h${t}`,className:"gp-diff-row--hunk gp-diff-cell",style:{gridColumn:"1 / -1"}},e.text??"")];if(e.kind==="gap")return[pr(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,w.createElement)("div",{key:`l${t}`,className:`gp-diff-cell ${o}`}):e.kind==="mod"&&e.leftWord!==void 0?ln(`gp-diff-cell ${o}`,`l${t}`,e.leftText,e.leftWord,"gp-diff-word gp-diff-word--del",n,a):Et(`gp-diff-cell ${o}`,`l${t}`,e.leftText,n,a),c=e.rightText===null?(0,w.createElement)("div",{key:`r${t}`,className:`gp-diff-cell ${s}`}):e.kind==="mod"&&e.rightWord!==void 0?ln(`gp-diff-cell ${s}`,`r${t}`,e.rightText,e.rightWord,"gp-diff-word gp-diff-word--add",n,a):Et(`gp-diff-cell ${s}`,`r${t}`,e.rightText,n,a);return[(0,w.createElement)("div",{key:`ln${t}`,className:"gp-diff-no"},e.leftNo??""),l,(0,w.createElement)("div",{key:`rn${t}`,className:"gp-diff-no"},e.rightNo??""),c]}function pa(e,t,n,r,a,i){if(e.kind==="hunk")return[(0,w.createElement)("div",{key:`h${t}`,className:"gp-diff-row--hunk gp-diff-cell",style:{gridColumn:"1 / -1"}},e.text??"")];if(e.kind==="gap")return[pr(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":"",c=s?"+":o?"\u2212":"\xA0",p=e.rightText??e.leftText??"",g=s?e.rightWord:o?e.leftWord:void 0,m=s?"gp-diff-word gp-diff-word--add":"gp-diff-word gp-diff-word--del",k=`gp-diff-cell gp-diff-uni__code ${l}`,v=g!==void 0?ln(k,`c${t}`,p,g,m,n,a):Et(k,`c${t}`,p,n,a);return[(0,w.createElement)("div",{key:`ol${t}`,className:"gp-diff-no"},e.leftNo??""),(0,w.createElement)("div",{key:`nl${t}`,className:"gp-diff-no"},e.rightNo??""),(0,w.createElement)("div",{key:`sg${t}`,className:`gp-diff-uni__sign ${l}`},c),v]}function pr(e,t,n,r){let a=n.busy===`${e.rightStart}:all`,i=n.busy===`${e.rightStart}:up`,o=n.busy===`${e.rightStart}:down`,s=(c,p,g)=>(0,w.createElement)("button",{key:c,type:"button",className:"gp-gap__btn",disabled:n.busy!==null,onClick:m=>{m.stopPropagation(),n.run(e,c)}},g?r("common.loading"):p),l=[];if(e.atEnd)l.push(s("down",r("diff.expandDown",{n:xe}),o));else{let c=e.count??0;c>0&&c<=xe?l.push(s("all",r("diff.expandGap",{n:c}),a)):(e.atStart||l.push(s("up",r("diff.expandUp",{n:xe}),i)),l.push(s("all",r("diff.expandGap",{n:c}),a)),l.push(s("down",r("diff.expandDown",{n:xe}),o)))}return(0,w.createElement)("div",{key:`g${t}`,className:"gp-diff-row--gap",style:{gridColumn:"1 / -1"}},l)}function Mt(e){return tr(e)}var H=require("react");var ga=100;function gr(e,t,n){let[r,a]=(0,H.useState)(null),[i,o]=(0,H.useState)(!1),[s,l]=(0,H.useState)([]),c=(0,H.useCallback)(()=>{o(!1),(async()=>{let[p,g]=await Promise.all([e.query({sessionId:t,query:{kind:"branches"}}),e.query({sessionId:t,query:{kind:"tags"}})]),m=de(p,"branches");if(m===null){o(!0);return}let k=de(g,"tags");a({current:m.current,defaultBranch:m.defaultBranch,local:m.local,remote:m.remote,tags:k?.tags??[]}),e.query({sessionId:t,query:{kind:"authors"}}).then(v=>{l(de(v,"authors")?.authors??[])})})()},[e,t]);return(0,H.useEffect)(()=>{c()},[n]),{tree:r,treeError:i,authors:s,reload:c}}function ur(e,t,n,r,a){let[i,o]=(0,H.useState)([]),[s,l]=(0,H.useState)(0),[c,p]=(0,H.useState)(!1),[g,m]=(0,H.useState)(!1),k=(0,H.useRef)(0),v=(0,H.useRef)(!1),x=(0,H.useRef)(null),E=(0,H.useCallback)(async(b,_)=>{if(v.current)return;v.current=!0;let P=k.current;p(!0),m(!1);let z=await e.query({sessionId:t,query:{kind:"history",limit:ga,skip:b,..._.ref?{ref:_.ref}:{},..._.search?{search:_.search}:{},..._.author?{author:_.author}:{},..._.since?{since:_.since}:{}}});if(v.current=!1,P!==k.current)return;p(!1);let U=de(z,"history");if(U===null){m(!0);return}let C=U.commits;o($=>b===0?C:[...$,...C]),l(U.total)},[e,t]),G=(0,H.useRef)(n);(0,H.useEffect)(()=>{k.current+=1,v.current=!1,G.current!==n&&(G.current=n,a(),x.current&&(x.current.scrollTop=0)),E(0,n)},[n,r]);let X=s<0?!0:i.length<s,V=(0,H.useCallback)(()=>{v.current||!X||E(i.length,n)},[E,i.length,n,X]);return{commits:i,total:s,loading:c,listError:g,hasMore:X,listRef:x,loadMore:V}}function fr(e,t,n){let[r,a]=(0,H.useState)(null),[i,o]=(0,H.useState)(null),[s,l]=(0,H.useState)(!1),[c,p]=(0,H.useState)(null),[g,m]=(0,H.useState)(null),[k,v]=(0,H.useState)(!1),[x,E]=(0,H.useState)(n),[G,X]=(0,H.useState)(!1),V=(0,H.useRef)(0),b=(0,H.useRef)(null),_=(0,H.useRef)(new Map),P=(0,H.useCallback)((S,L)=>{let K=_.current;for(K.set(S,L);K.size>50;){let ee=K.keys().next().value;if(ee===void 0)break;K.delete(ee)}},[]),z=(0,H.useCallback)(()=>{a(null),o(null),b.current=null},[]),U=(0,H.useCallback)(S=>{b.current===S.hash&&a(S)},[]),C=(0,H.useCallback)(async S=>{b.current=S.hash,a(S),l(!1),V.current+=1,p(null),m(null),v(!1);let L=_.current.get(S.hash);if(L!==void 0){o(L);return}o(null);let K=await e.query({sessionId:t,query:{kind:"show",ref:S.hash}});if(b.current!==S.hash)return;let ee=de(K,"show");if(ee!==null){let ce={commit:ee.commit,body:ee.body,stats:ee.stats};P(S.hash,ce),o(ce)}else l(!0)},[e,t,P]),$=(0,H.useCallback)(async(S,L,K,ee=!1)=>{let ce=++V.current;p({path:S,hash:L,shortHash:K}),m(null),v(!1),X(ee);let D=await e.query({sessionId:t,query:{kind:"diff",path:S,base:"commit",commit:L,...ee?{context:1e5}:{}}});if(ce!==V.current)return;let M=de(D,"diff");M!==null?m(M.text):v(!0)},[e,t]),ne=(0,H.useCallback)(()=>{V.current+=1,p(null),m(null),v(!1),X(!1)},[]);(0,H.useEffect)(()=>{if(c===null)return;let S=L=>{L.key==="Escape"&&ne()};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[c,ne]);let[Q,re]=(0,H.useState)(null),[ae,q]=(0,H.useState)(null),Y=(0,H.useRef)(void 0),N=(0,H.useRef)(null),le=(0,H.useCallback)((S,L,K)=>{Y.current!==void 0&&clearTimeout(Y.current),Y.current=setTimeout(()=>{N.current=S.hash,re({commit:S,x:L,y:K});let ee=_.current.get(S.hash);if(ee!==void 0){q(ee.body);return}q(null),e.query({sessionId:t,query:{kind:"show",ref:S.hash}}).then(ce=>{if(N.current!==S.hash)return;let D=de(ce,"show");D!==null?(P(S.hash,{commit:D.commit,body:D.body,stats:D.stats}),q(D.body)):q("")})},260)},[e,t,P]),A=(0,H.useCallback)(()=>{Y.current!==void 0&&clearTimeout(Y.current),N.current=null,re(null),q(null)},[]);return(0,H.useEffect)(()=>()=>{Y.current!==void 0&&clearTimeout(Y.current)},[]),{selected:r,detail:i,detailError:s,select:C,resyncSelected:U,clearSelection:z,fileDiff:c,fileDiffText:g,fileDiffError:k,fileDiffMode:x,setFileDiffMode:E,fileDiffExpanded:G,openFileDiff:$,closeFileDiff:ne,hover:Q,hoverBody:ae,onHoverEnter:le,onHoverLeave:A}}var be=require("react"),ua=(e,t,n)=>Math.max(t,Math.min(n,e));function fa(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 ma(e,t){try{typeof localStorage<"u"&&localStorage.setItem(e,String(Math.round(t)))}catch{}}function Re(e){let{storageKey:t,initial:n,min:r,reserve:a,edge:i}=e,[o,s]=(0,be.useState)(()=>fa(t,n)),l=(0,be.useRef)(null),c=(0,be.useRef)(null),p=(0,be.useCallback)(m=>{let v=l.current?.parentElement?.clientWidth??Number.MAX_SAFE_INTEGER;c.current={x:m.clientX,w:o,max:Math.max(r,v-a)},m.preventDefault(),typeof document<"u"&&(document.body.style.cursor="col-resize",document.body.style.userSelect="none")},[o,r,a]);(0,be.useEffect)(()=>{if(typeof window>"u")return;let m=v=>{let x=c.current;if(x===null)return;let E=v.clientX-x.x;s(ua(x.w+(i==="end"?E:-E),r,x.max))},k=()=>{c.current!==null&&(c.current=null,typeof document<"u"&&(document.body.style.cursor="",document.body.style.userSelect=""),s(v=>(ma(t,v),v)))};return window.addEventListener("pointermove",m),window.addEventListener("pointerup",k),()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",k)}},[i,r,t]);let g=(0,be.createElement)("div",{key:`rz-${t}`,ref:l,className:"gp-resizer",role:"separator","aria-orientation":"vertical",onPointerDown:p});return{width:o,divider:g}}var mr=require("react");function Ge(e,t,n,r,a=!1){return e.map(i=>(0,mr.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 se=require("react"),hr=require("react-dom");function et(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"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"invalid-name":case"invalid-index":return n("error.invalidName");default:return t??n("error.generic")}}function Ie(e){return(0,se.createElement)("div",{key:"aihint",className:"gp-modal__hint"},e("ops.aiHint"))}function Xe(e){return(0,se.createElement)("div",{key:"footer",className:"gp-modal__footer"},[(0,se.createElement)("button",{key:"cancel",type:"button",className:"gp-btn",onClick:e.onClose},e.t("common.cancel")),(0,se.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 Ve(e){return typeof document>"u"?null:(0,se.createElement)(ha,e)}function ha({onClose:e,title:t,icon:n,hash:r,body:a,footer:i,portalKey:o,t:s}){(0,se.useEffect)(()=>{let c=p=>{p.key==="Escape"&&e()};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e]);let l=(0,se.createElement)("div",{className:"gp-modal-backdrop",onClick:c=>{c.target===c.currentTarget&&e()}},(0,se.createElement)("div",{className:"gp-modal gp-modal--sm",role:"dialog","aria-modal":!0},[(0,se.createElement)("div",{key:"bar",className:"gp-modal__bar"},[n!==void 0?(0,se.createElement)("span",{key:"ic",className:"gp-modal__fileicon"},n):null,(0,se.createElement)("span",{key:"title",className:"gp-modal__path"},t),r!==void 0?(0,se.createElement)("span",{key:"hash",className:"gp-modal__hash"},r):null,(0,se.createElement)("button",{key:"close",type:"button",className:"gp-icon-btn gp-modal__close",title:s("common.close"),onClick:e},(0,se.createElement)(He,{size:15}))]),(0,se.createElement)("div",{key:"body",className:"gp-modal__form"},a),i]));return(0,hr.createPortal)(l,document.body,o)}function tt(e){return Ve({onClose:e.onClose,title:e.title,portalKey:"confirm-modal",t:e.t,body:[(0,se.createElement)("div",{key:"txt",className:"gp-modal__confirmtext"},e.body),Ie(e.t),e.error!==null?(0,se.createElement)("div",{key:"err",className:"gp-feedback"},e.error):null],footer:Xe({onClose:e.onClose,onConfirm:e.onConfirm,confirmLabel:e.confirmLabel,confirmDisabled:e.confirmBusy===!0,danger:e.danger,t:e.t})})}var O=require("react");function yr(e,t){return typeof document>"u"?null:(0,O.createElement)(ya,{target:e,...t})}function ya({target:e,onClose:t,onCreate:n,error:r,t:a}){let[i,o]=(0,O.useState)(""),[s,l]=(0,O.useState)(!1),[c,p]=(0,O.useState)(""),g=()=>{i.trim()!==""&&n(i.trim(),s?c:"")};return Ve({onClose:t,title:a("tag.createTitle"),icon:(0,O.createElement)(Le,{size:15}),hash:e.shortHash,portalKey:"tag-create-modal",t:a,body:[(0,O.createElement)("input",{key:"name",className:"gp-input",placeholder:a("tag.namePlaceholder"),value:i,autoFocus:!0,onChange:m=>o(m.target.value),onKeyDown:m=>{m.key==="Enter"&&g()}}),(0,O.createElement)("label",{key:"ann",className:"gp-modal__check"},[(0,O.createElement)("input",{key:"cb",type:"checkbox",className:"gp-check",checked:s,onChange:()=>l(m=>!m)}),a("tag.annotated")]),s?(0,O.createElement)("textarea",{key:"msg",className:"gp-input gp-input--area",placeholder:a("tag.messagePlaceholder"),value:c,onChange:m=>p(m.target.value)}):null,Ie(a),r!==null?(0,O.createElement)("div",{key:"err",className:"gp-feedback"},r):null],footer:Xe({onClose:t,onConfirm:g,confirmLabel:a("tag.create"),confirmDisabled:i.trim()==="",danger:!1,t:a})})}function br(e,t){return typeof document>"u"?null:(0,O.createElement)(ba,{target:e,...t})}function ba({target:e,from:t,dirty:n,lostFiles:r,lostTotal:a,lostTruncated:i,busy:o,error:s,onReset:l,onClose:c,t:p}){let[g,m]=(0,O.useState)("mixed"),[k,v]=(0,O.useState)(!1);(0,O.useEffect)(()=>{g!=="hard"&&v(!1)},[g]);let x=[{value:"mixed",label:"reset.modeMixed",hint:"reset.mixedHint"},{value:"soft",label:"reset.modeSoft",hint:"reset.softHint"},{value:"hard",label:"reset.modeHard",hint:"reset.hardHint"}],E=o||g==="hard"&&!k;return Ve({onClose:c,title:p("reset.title"),icon:(0,O.createElement)(yt,{size:15}),hash:e.shortHash,portalKey:"reset-modal",t:p,body:[(0,O.createElement)("div",{key:"txt",className:"gp-modal__confirmtext"},p("reset.body",{from:t,to:e.shortHash})),(0,O.createElement)("div",{key:"modes",className:"gp-reset__modes"},x.map(G=>(0,O.createElement)("label",{key:G.value,className:`gp-reset__mode${g===G.value?" gp-reset__mode--on":""}${G.value==="hard"?" gp-reset__mode--danger":""}`},[(0,O.createElement)("input",{key:"r",type:"radio",name:"gp-reset-mode",className:"gp-check",checked:g===G.value,onChange:()=>m(G.value)}),(0,O.createElement)("span",{key:"tx",className:"gp-reset__modetext"},[(0,O.createElement)("span",{key:"l",className:"gp-reset__modelabel"},p(G.label)),(0,O.createElement)("span",{key:"h",className:"gp-reset__modehint"},p(G.hint))])]))),g==="hard"?(0,O.createElement)("div",{key:"orphan",className:"gp-reset__dirtywarn"},p("reset.hardOrphan")):null,g==="hard"&&a>0?(0,O.createElement)("div",{key:"lost",className:"gp-reset__lost"},[(0,O.createElement)("div",{key:"w",className:"gp-reset__warn"},p("reset.hardWarn")),(0,O.createElement)("ul",{key:"ul",className:"gp-reset__lostlist"},[...r.map(G=>(0,O.createElement)("li",{key:G,title:G},G)),i?(0,O.createElement)("li",{key:"_more",className:"gp-reset__lostmore"},p("reset.lostMore")):null])]):null,g==="hard"?(0,O.createElement)("label",{key:"ack",className:"gp-modal__check gp-reset__ack"},[(0,O.createElement)("input",{key:"cb",type:"checkbox",className:"gp-check",checked:k,onChange:()=>v(G=>!G)}),p(a>0?"reset.hardAck":"reset.hardAckClean")]):null,n?(0,O.createElement)("div",{key:"dirty",className:"gp-reset__dirtywarn"},p("ops.dirtyWarn")):null,Ie(p),s!==null?(0,O.createElement)("div",{key:"err",className:"gp-feedback"},s):null],footer:Xe({onClose:c,onConfirm:()=>void l(g),confirmLabel:p("reset.confirm"),confirmDisabled:E,danger:g==="hard",t:p})})}var Ke=14,vr=30;function va(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 wa=46,xa=260;function ka(e,t){let[n,r]=(0,d.useState)(!1);return(0,d.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 wr({remote:e,sessionId:t,refreshKey:n,defaultDiffView:r,snapshot:a,onAction:i,onResync:o,compact:s,t:l}){let[c,p]=(0,d.useState)({ref:null,search:"",author:"",since:""}),[g,m]=(0,d.useState)(""),[k,v]=(0,d.useState)(null),x=ka(k,xa),[E,G]=(0,d.useState)(new Set(["tags","remote"])),[X,V]=(0,d.useState)(0),b=n+X,_=()=>V(y=>y+1),[P,z]=(0,d.useState)(null),[U,C]=(0,d.useState)(null),[$,ne]=(0,d.useState)(null),[Q,re]=(0,d.useState)(null),[ae,q]=(0,d.useState)(null),[Y,N]=(0,d.useState)(!1),[le,A]=(0,d.useState)("list"),[S,L]=(0,d.useState)(!1);(0,d.useEffect)(()=>{if(!S)return;let y=I=>{I.key==="Escape"&&L(!1)};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[S]),(0,d.useEffect)(()=>{!s&&S&&L(!1)},[s,S]);let{tree:K,treeError:ee,authors:ce,reload:D}=gr(e,t,b),M=fr(e,t,r),{commits:oe,loading:ke,listError:Z,hasMore:W,listRef:me,loadMore:Vt}=ur(e,t,c,b,M.clearSelection);(0,d.useEffect)(()=>{let y=setTimeout(()=>p(I=>I.search===g?I:{...I,search:g}),300);return()=>clearTimeout(y)},[g]);let ve=c.search!=="",we=(0,d.useMemo)(()=>ve?oe.map(y=>({commit:y,lane:0,color:0,edges:[],merge:!1})):Wn(oe,a.graphStyle),[oe,ve,a.graphStyle]),Be=(0,d.useMemo)(()=>ve?0:qn(we),[we,ve]),De=ve?12:Math.max(Ke,Be*Ke),rt=s?wa:vr,bn=s?`${De}px minmax(0,1fr)`:`${De}px minmax(120px,1fr) 72px 120px 96px`,Kt=()=>{let y=me.current;y===null||!W||y.scrollTop+y.clientHeight>=y.scrollHeight-240&&Vt()},Jt=y=>{M.select(y),s&&A("detail")},Oe=(0,d.useMemo)(()=>Date.now(),[oe]),Bt=(0,d.useMemo)(()=>M.detail===null?[]:jn(M.detail.stats.map(y=>({path:y.path,meta:y.status}))),[M.detail]),j=M.selected;(0,d.useEffect)(()=>{if(j===null)return;let y=oe.find(I=>I.hash===j.hash);y!==void 0&&y!==j&&!va(y.refs,j.refs)&&M.resyncSelected(y)},[oe,j]);let qe=Re({storageKey:"gp.overview.left",initial:200,min:130,reserve:360,edge:"end"}),at=Re({storageKey:"gp.overview.right",initial:340,min:190,reserve:360,edge:"start"}),Ae=y=>p(I=>({...I,ref:y})),Ot=async(y,I)=>{if(!(P===null||Y)){q(null),N(!0);try{let pe=await e.run({sessionId:t,action:{kind:"tag-create",name:y,commit:P.hash,...I.trim()!==""?{message:I}:{}}});pe.ok?(z(null),_()):q(et(pe.error.code,pe.error.message,l))}finally{N(!1)}}},ye=async y=>{if(!Y){q(null),N(!0);try{let I=await e.run({sessionId:t,action:{kind:"tag-delete",name:y}});I.ok?(C(null),_()):q(et(I.error.code,I.error.message,l))}finally{N(!1)}}},qt=async()=>{if(!($===null||Y)){q(null),N(!0);try{let y=await i({kind:"revert",commit:$.hash});y.ok?ne(null):q(y.error??l("error.generic"))}finally{N(!1)}}},Wt=async y=>{if(!(Q===null||Y)){q(null),N(!0);try{let I=await i({kind:"reset",commit:Q.hash,mode:y});I.ok?re(null):q(I.error??l("error.generic"))}finally{N(!1)}}},it=Ea(M.fileDiff,{text:M.fileDiffText,error:M.fileDiffError,mode:M.fileDiffMode,onMode:M.setFileDiffMode,expanded:M.fileDiffExpanded,onExpand:y=>{M.fileDiff!==null&&M.openFileDiff(M.fileDiff.path,M.fileDiff.hash,M.fileDiff.shortHash,y)},onClose:M.closeFileDiff,remote:e,sessionId:t,compact:s,t:l}),ot=(0,d.useMemo)(()=>[...new Set(a.changes.filter(y=>y.status!=="untracked").map(y=>y.path))],[a.changes]),st=[P!==null?yr(P,{onClose:()=>z(null),onCreate:Ot,error:ae,compact:s,t:l}):null,U!==null?tt({title:l("tag.deleteTitle"),body:l("tag.deleteConfirm",{name:U}),confirmLabel:l("tag.deleteTitle"),danger:!0,error:ae,confirmBusy:Y,onConfirm:()=>void ye(U),onClose:()=>C(null),t:l}):null,$!==null?tt({title:l("revert.title"),body:l("revert.body",{ref:`${$.shortHash} ${$.subject}`})+(a.dirty?`
501
+
502
+ ${l("ops.dirtyWarn")}`:""),confirmLabel:l("revert.confirm"),danger:!1,error:ae,confirmBusy:Y,onConfirm:()=>void qt(),onClose:()=>ne(null),t:l}):null,Q!==null?br(Q,{from:a.head??Q.shortHash,dirty:a.dirty,lostFiles:ot,lostTotal:ot.length,lostTruncated:a.truncated,busy:Y,error:ae,onReset:Wt,onClose:()=>re(null),t:l}):null],lt=(0,d.createElement)("div",{key:"mid",className:"gp-col gp-col--mid gp-history"},[(0,d.createElement)("div",{key:"tb",className:"gp-toolbar",ref:v},[s?(0,d.createElement)("button",{key:"filter",type:"button",className:`gp-btn${c.ref!==null?" gp-btn--primary":""}`,title:l("overview.filterBranch"),onClick:()=>L(!0)},[(0,d.createElement)(In,{key:"ic",size:13}),c.ref??l("overview.filterBranch")]):null,(0,d.createElement)("input",{key:"search",className:"gp-search",placeholder:l(x||s?"overview.searchShort":"overview.search"),value:g,onChange:y=>m(y.target.value)}),(0,d.createElement)("select",{key:"author",className:"gp-select",value:c.author,onChange:y=>p(I=>({...I,author:y.target.value}))},[(0,d.createElement)("option",{key:"",value:""},l("overview.allUsers")),...ce.map(y=>(0,d.createElement)("option",{key:y,value:y},y))]),(0,d.createElement)("select",{key:"since",className:"gp-select",value:c.since,onChange:y=>p(I=>({...I,since:y.target.value}))},[(0,d.createElement)("option",{key:"",value:""},l("overview.allTime")),(0,d.createElement)("option",{key:"today",value:"1 day ago"},l("overview.today")),(0,d.createElement)("option",{key:"7d",value:"7 days ago"},l("overview.last7d")),(0,d.createElement)("option",{key:"30d",value:"30 days ago"},l("overview.last30d"))]),(0,d.createElement)("button",{key:"fetch",type:"button",className:"gp-icon-btn",title:l("overview.fetch"),onClick:()=>{e.run({sessionId:t,action:{kind:"fetch"}}).then(()=>D())}},(0,d.createElement)(ht,{size:14}))]),(0,d.createElement)("div",{key:"list",className:"gp-history__list",ref:me,onScroll:Kt},oe.length===0?(0,d.createElement)("div",{className:"gp-empty"},l(ke?"common.loading":Z?"overview.loadFailed":"overview.noResults")):we.map(y=>Ca(y,{selected:j?.hash===y.commit.hash,gridTpl:bn,graphW:De,laneCount:Be,searching:ve,now:Oe,compact:s,rowH:rt,onSelect:()=>Jt(y.commit),onHoverEnter:M.onHoverEnter,onHoverLeave:M.onHoverLeave,t:l})))]),dt=j===null?[(0,d.createElement)("div",{key:"empty",className:"gp-empty"},[(0,d.createElement)(mt,{key:"i",size:20}),l("overview.selectCommit")])]:[(0,d.createElement)("div",{key:"files",className:"gp-detail__files"},M.detail===null?(0,d.createElement)("div",{className:"gp-empty"},M.detailError?l("overview.detailFailed"):l("common.loading")):Ta(Bt,{activePath:M.fileDiff?.path??null,openTitle:l("overview.openFileDiff"),onOpen:y=>{j!==null&&M.openFileDiff(y,j.hash,j.shortHash)}})),(0,d.createElement)("div",{key:"msg",className:"gp-detail__msg"},[(0,d.createElement)("div",{key:"subj",className:"gp-detail__subject"},j.subject),(0,d.createElement)("div",{key:"meta",className:"gp-detail__meta"},[(0,d.createElement)("span",{key:"h",className:"gp-commit-hash"},j.shortHash),(0,d.createElement)("span",{key:"a"},j.author),(0,d.createElement)("span",{key:"t"},nn(j.dateIso))]),(0,d.createElement)("div",{key:"ops",className:"gp-detail__ops"},(()=>{let y=j.refs.filter(I=>I.kind==="tag");return[y.length>0?(0,d.createElement)("div",{key:"tags",className:"gp-detail__tags"},y.map(I=>(0,d.createElement)("span",{key:`tag-${I.name}`,className:"gp-ref-chip gp-ref-chip--tag gp-ref-chip--del",title:I.name},[(0,d.createElement)(Le,{key:"i",size:11}),(0,d.createElement)("span",{key:"n",className:"gp-detail__tagname"},I.name),(0,d.createElement)("button",{key:"x",type:"button",className:"gp-ref-chip__x",title:l("tag.deleteOne",{name:I.name}),onClick:()=>{q(null),C(I.name)}},(0,d.createElement)(He,{size:11}))]))):null,(0,d.createElement)("div",{key:"actions",className:"gp-detail__actions"},[(0,d.createElement)("button",{key:"revert",type:"button",className:"gp-btn gp-btn--sm",title:l("overview.revert"),onClick:()=>{q(null),ne({hash:j.hash,shortHash:j.shortHash,subject:j.subject})}},[(0,d.createElement)(Jn,{key:"i",size:12}),l("overview.revert")]),(0,d.createElement)("button",{key:"reset",type:"button",className:"gp-btn gp-btn--sm",title:l("overview.reset"),onClick:()=>{q(null),o(),re({hash:j.hash,shortHash:j.shortHash,subject:j.subject})}},[(0,d.createElement)(yt,{key:"i",size:12}),l("overview.reset")]),(0,d.createElement)("button",{key:"addtag",type:"button",className:"gp-btn gp-btn--sm",title:l("overview.createTag"),onClick:()=>{q(null),z({hash:j.hash,shortHash:j.shortHash})}},[(0,d.createElement)(Le,{key:"i",size:12}),l("overview.createTag")])])]})()),M.detail!==null&&M.detail.body!==""?(0,d.createElement)("pre",{key:"body",className:"gp-detail__body"},M.detail.body):(0,d.createElement)("div",{key:"nb",className:"gp-empty"},l("overview.noMessage"))])];return s?(0,d.createElement)("div",{className:"gp-overview gp-overview--compact"},[it,...st,le==="detail"?(0,d.createElement)("div",{key:"detail",className:"gp-col gp-col--mid gp-detail"},[(0,d.createElement)("div",{key:"back",className:"gp-subhead"},[(0,d.createElement)("button",{key:"b",type:"button",className:"gp-subhead__back",onClick:()=>A("list")},[(0,d.createElement)(Fe,{key:"i",size:14}),l("overview.backToList")]),j!==null?(0,d.createElement)("span",{key:"h",className:"gp-subhead__title gp-commit-hash"},j.shortHash):null]),...dt]):lt,S?Sa(K,ee,c.ref,E,{onFilter:y=>{Ae(y),L(!1)},onToggle:y=>G(I=>{let pe=new Set(I);return pe.has(y)?pe.delete(y):pe.add(y),pe}),onRetry:D,onClose:()=>L(!1),t:l}):null]):(0,d.createElement)("div",{className:"gp-overview"},[it,...st,(0,d.createElement)("div",{key:"left",className:"gp-col gp-col--left",style:{flex:`0 0 ${qe.width}px`}},xr(K,ee,c.ref,E,{onFilter:y=>Ae(y),onToggle:y=>G(I=>{let pe=new Set(I);return pe.has(y)?pe.delete(y):pe.add(y),pe}),onRetry:D,t:l})),qe.divider,lt,at.divider,(0,d.createElement)("div",{key:"right",className:"gp-col gp-col--right gp-detail",style:{flex:`0 0 ${at.width}px`}},dt),_a(M.hover,M.hoverBody,l)])}function _a(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,d.createElement)("div",{className:"gp-hovercard",style:{left:a,top:i,maxWidth:r}},[(0,d.createElement)("div",{key:"subj",className:"gp-hovercard__subject"},e.commit.subject),(0,d.createElement)("div",{key:"meta",className:"gp-hovercard__meta"},[(0,d.createElement)("span",{key:"h",className:"gp-commit-hash"},e.commit.shortHash),(0,d.createElement)("span",{key:"a"},e.commit.author),(0,d.createElement)("span",{key:"t"},nn(e.commit.dateIso))]),t===null?(0,d.createElement)("div",{key:"l",className:"gp-hovercard__loading"},n("common.loading")):t===""?(0,d.createElement)("div",{key:"e",className:"gp-hovercard__loading"},n("overview.noMessage")):(0,d.createElement)("pre",{key:"body",className:"gp-hovercard__body"},t)]);return(0,At.createPortal)(o,document.body,"commit-hovercard")}function xr(e,t,n,r,a){if(t)return(0,d.createElement)("div",{className:"gp-empty"},[(0,d.createElement)("span",{key:"m"},a.t("overview.branchesError")),(0,d.createElement)("button",{key:"r",type:"button",className:"gp-btn",style:{marginTop:8},onClick:a.onRetry},a.t("common.retry"))]);if(e===null)return(0,d.createElement)("div",{className:"gp-empty"},a.t("common.loading"));let i=(o,s,l,c,p="")=>(0,d.createElement)("div",{key:o,className:"gp-branch-group"},[(0,d.createElement)("div",{key:"head",className:"gp-branch-group__head",onClick:()=>a.onToggle(o)},[(0,d.createElement)(Ne,{key:"c",size:11,open:!r.has(o)}),`${a.t(s)} (${l.length})`]),r.has(o)?null:l.map(g=>{let m=p+g.name,k=e.current===g.name,v=`gp-branch-row${n===m?" gp-branch-row--active":""}${k?" gp-branch-row--current":""}`;return(0,d.createElement)("div",{key:g.name,className:v,title:g.name,onClick:()=>a.onFilter(n===m?null:m)},[(0,d.createElement)("span",{key:"i",style:{display:"inline-flex",width:14}},c),(0,d.createElement)("span",{key:"n",className:"gp-tree-name"},g.name),g.ahead||g.behind?(0,d.createElement)("span",{key:"t",className:"gp-branch-row__track"},`${g.ahead?`\u2191${g.ahead}`:""}${g.behind?`\u2193${g.behind}`:""}`):null])})]);return(0,d.createElement)("div",{},[(0,d.createElement)("div",{key:"head-row",className:"gp-branch-row",style:{fontWeight:600,paddingLeft:10},onClick:()=>a.onFilter(null)},a.t("overview.head")),i("local","overview.local",e.local,(0,d.createElement)(en,{size:13})),i("remote","overview.remote",e.remote,(0,d.createElement)(en,{size:13})),i("tags","overview.tags",e.tags,(0,d.createElement)(Le,{size:13}))])}function Sa(e,t,n,r,a){if(typeof document>"u")return null;let i=(0,d.createElement)("div",{className:"gp-sheet-backdrop",onClick:o=>{o.target===o.currentTarget&&a.onClose()}},(0,d.createElement)("div",{className:"gp-sheet",role:"dialog","aria-modal":!0},[(0,d.createElement)("div",{key:"bar",className:"gp-sheet__bar"},[(0,d.createElement)("span",{key:"title",className:"gp-sheet__title"},a.t("overview.filterBranch")),(0,d.createElement)("button",{key:"close",type:"button",className:"gp-icon-btn gp-sheet__close",title:a.t("common.close"),onClick:a.onClose},(0,d.createElement)(He,{size:15}))]),(0,d.createElement)("div",{key:"body",className:"gp-sheet__body"},xr(e,t,n,r,a))]));return(0,At.createPortal)(i,document.body,"branch-filter-sheet")}function Ca(e,t){let n=e.commit,r=n.refs.map(i=>(0,d.createElement)("span",{key:i.name,className:`gp-ref-chip${i.head?" gp-ref-chip--head":""}${i.kind==="remote"?" gp-ref-chip--remote":""}${i.kind==="tag"?" gp-ref-chip--tag":""}`},i.name)),a=(0,d.createElement)("div",{key:"g",className:"gp-graph-cell"},t.searching?null:Na(e,t.laneCount,t.rowH));return t.compact?(0,d.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,d.createElement)("div",{key:"tx",className:"gp-commit-lines"},[(0,d.createElement)("div",{key:"s",className:"gp-commit-subject"},[...r,n.subject]),(0,d.createElement)("div",{key:"m",className:"gp-commit-sub"},[(0,d.createElement)("span",{key:"h",className:"gp-commit-hash"},n.shortHash),(0,d.createElement)("span",{key:"a",className:"gp-commit-author"},n.author),(0,d.createElement)("span",{key:"d",className:"gp-commit-date"},ze(n.dateIso,t.now,t.t))])])]):(0,d.createElement)("div",{key:n.hash,className:`gp-commit-row${t.selected?" gp-commit-row--active":""}`,style:{gridTemplateColumns:t.gridTpl},onClick:t.onSelect,onMouseEnter:i=>t.onHoverEnter(n,i.clientX,i.clientY),onMouseLeave:t.onHoverLeave},[a,(0,d.createElement)("div",{key:"s",className:"gp-commit-subject"},[...r,n.subject]),(0,d.createElement)("div",{key:"h",className:"gp-commit-hash"},n.shortHash),(0,d.createElement)("div",{key:"a",className:"gp-commit-author"},n.author),(0,d.createElement)("div",{key:"d",className:"gp-commit-date",title:Ze(n.dateIso)},ze(n.dateIso,t.now,t.t))])}var Dt=["#4e9bff","#3fb950","#e0982e","#d05ce3","#e5534b","#2dc6c6","#d29922","#8b949e"];function Na(e,t,n=vr){let r=Math.max(Ke,t*Ke),a=s=>s*Ke+Ke/2,i=n/2,o=[];for(let s of e.edges){let l=Dt[s.color%Dt.length],c=s.kind==="out"?i:0,p=s.kind==="into"?i:n,g=(c+p)/2;o.push((0,d.createElement)("path",{key:`e${s.kind}-${s.fromLane}-${s.toLane}-${s.color}`,d:`M ${a(s.fromLane)} ${c} C ${a(s.fromLane)} ${g}, ${a(s.toLane)} ${g}, ${a(s.toLane)} ${p}`,stroke:l,strokeWidth:1.6,fill:"none"}))}return o.push((0,d.createElement)("circle",{key:"node",cx:a(e.lane),cy:i,r:e.merge?4:3.2,fill:Dt[e.color%Dt.length],stroke:"var(--dsw-alias-bg-layer-1)",strokeWidth:1})),(0,d.createElement)("svg",{className:"gp-graph-svg",width:r,height:n},o)}function Ta(e,t){let n=[],r=(a,i)=>{for(let o of a)if(o.dir)n.push((0,d.createElement)("div",{key:o.path,className:"gp-tree-row",style:{paddingLeft:10+i*14}},[(0,d.createElement)(Ne,{key:"c",size:11,open:!0}),(0,d.createElement)("span",{key:"n",className:"gp-tree-name"},o.name)])),r(o.children,i+1);else{let s=String(o.meta??"modified"),l=t.activePath===o.path;n.push((0,d.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,d.createElement)("span",{key:"st",className:`gp-status-badge ${vt(s)}`},(bt[s]??s[0]??"M").toUpperCase()),(0,d.createElement)("span",{key:"n",className:"gp-tree-name"},o.name)]))}};return r(e,0),(0,d.createElement)("div",{},n)}function Ea(e,t){if(e===null||typeof document>"u")return null;let{text:n,error:r,mode:a,onMode:i,expanded:o,onExpand:s,onClose:l,remote:c,sessionId:p,compact:g,t:m}=t,k=g?["unified","before","after"]:["unified","split","before","after"],v=g&&a==="split"?"unified":a,x=(0,d.createElement)("div",{className:"gp-modal-backdrop",onClick:E=>{E.target===E.currentTarget&&l()}},(0,d.createElement)("div",{className:"gp-modal",role:"dialog","aria-modal":!0},[(0,d.createElement)("div",{key:"bar",className:"gp-modal__bar"},[(0,d.createElement)("span",{key:"fileicon",className:"gp-modal__fileicon"},(0,d.createElement)(Vn,{size:15})),(0,d.createElement)("span",{key:"path",className:"gp-modal__path",title:e.path},Ra(e.path)),(0,d.createElement)("span",{key:"hash",className:"gp-modal__hash"},e.shortHash),n!==null&&n!==""?(()=>{let E=Mt(n);return(0,d.createElement)("span",{key:"sum",className:"gp-modal__sum"},[(0,d.createElement)("span",{key:"a",className:"gp-stats__add"},`+${E.add}`),(0,d.createElement)("span",{key:"d",className:"gp-stats__del"},`\u2212${E.del}`)])})():null,(0,d.createElement)("button",{key:"expand",type:"button",className:`gp-seg__btn gp-diff__expand${o?" gp-seg__btn--active":""}`,disabled:v!=="split"&&v!=="unified",title:m(o?"diff.collapse":"diff.expandAll"),onClick:()=>s(!o)},m(o?"diff.collapse":"diff.expandAll")),(0,d.createElement)("div",{key:"seg",className:"gp-seg"},Ge(k,v,i,E=>m(`diff.${E}`))),(0,d.createElement)("button",{key:"close",type:"button",className:"gp-icon-btn gp-modal__close",title:m("common.close"),onClick:l},(0,d.createElement)(He,{size:15}))]),(0,d.createElement)("div",{key:"scroll",className:"gp-modal__scroll"},n===null?(0,d.createElement)("div",{className:"gp-empty"},m(r?"overview.diffFailed":"common.loading")):(0,d.createElement)(Gt,{text:n,mode:v,path:e.path,remote:c,sessionId:p,imageSpec:{base:"commit",commit:e.hash},t:m}))]));return(0,At.createPortal)(x,document.body,"file-diff-modal")}function Ra(e){let t=e.lastIndexOf("/");return t<0?[(0,d.createElement)("span",{key:"n",className:"gp-modal__name"},e)]:[(0,d.createElement)("span",{key:"d",className:"gp-modal__dir"},e.slice(0,t+1)),(0,d.createElement)("span",{key:"n",className:"gp-modal__name"},e.slice(t+1))]}var u=require("react");var he=require("react");function kr({stats:e,t}){let n=Date.now(),r=[(0,he.createElement)("span",{key:"files",className:"gp-stats__item"},t("stats.files",{n:e.fileCount})),(0,he.createElement)("span",{key:"lines",className:"gp-stats__item"},[(0,he.createElement)("span",{key:"a",className:"gp-stats__add"},`+${e.insertions}`)," ",(0,he.createElement)("span",{key:"d",className:"gp-stats__del"},`\u2212${e.deletions}`)])];e.staged>0&&r.push((0,he.createElement)("span",{key:"st",className:"gp-stats__item"},t("stats.staged",{n:e.staged}))),e.modified>0&&r.push((0,he.createElement)("span",{key:"mo",className:"gp-stats__item"},t("stats.modified",{n:e.modified}))),e.untracked>0&&r.push((0,he.createElement)("span",{key:"un",className:"gp-stats__item"},t("stats.untracked",{n:e.untracked}))),e.partial&&r.push((0,he.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,he.createElement)("span",{key:"lc",className:"gp-stats__item",title:Ze(e.lastChangeAt)},t("stats.lastChange",{time:ze(e.lastChangeAt,n,t)}))),e.headCommittedAt!==null&&a.push((0,he.createElement)("span",{key:"hc",className:"gp-stats__item",title:Ze(e.headCommittedAt)},t("stats.lastCommit",{time:ze(e.headCommittedAt,n,t)}))),a.length>0&&r.push((0,he.createElement)("span",{key:"times",className:"gp-stats__times"},a)),(0,he.createElement)("div",{className:"gp-stats"},r)}function Pt(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 _r(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 Lt(e,t,n,r){let a=e.length-1;if(a<=0)return{first:0,last:0};let i=_r(e,t-r),o=Math.min(a,_r(e,t+n+r)+1);return{first:i,last:o}}var Me=require("react");function Ht(){let[e,t]=(0,Me.useState)({top:0,height:0}),n=(0,Me.useRef)(null),r=(0,Me.useRef)(null);return{setEl:(0,Me.useCallback)(i=>{if(r.current!==null&&(r.current(),r.current=null),n.current=i,i===null)return;let o=()=>t(l=>{let c=i.scrollTop,p=i.clientHeight;return l.top===c&&l.height===p?l:{top:c,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 dn=28,Sr=26,Ga=8,Ma=600;function Cr({remote:e,sessionId:t,snapshot:n,onAction:r,compact:a,t:i}){let[o,s]=(0,u.useState)(new Set),[l,c]=(0,u.useState)(""),[p,g]=(0,u.useState)(!1),[m,k]=(0,u.useState)(!1),[v,x]=(0,u.useState)(null),[E,G]=(0,u.useState)(new Set),[X,V]=(0,u.useState)(null),[b,_]=(0,u.useState)(null),[P,z]=(0,u.useState)(null),[U,C]=(0,u.useState)(()=>n.defaultDiffView),[$,ne]=(0,u.useState)(!1),[Q,re]=(0,u.useState)(!1),[ae,q]=(0,u.useState)(!1),[Y,N]=(0,u.useState)(!1),[le,A]=(0,u.useState)(null),[S,L]=(0,u.useState)("list"),[K,ee]=(0,u.useState)([]),[ce,D]=(0,u.useState)(!0),[M,oe]=(0,u.useState)(!1),[ke,Z]=(0,u.useState)(null),W=(0,u.useRef)(null),me=(0,u.useRef)(0),{setEl:Vt,viewport:ve}=Ht(),we=(0,u.useCallback)(async()=>{let h=await e.query({sessionId:t,query:{kind:"stash-list"}}),R=de(h,"stash-list");ee(R?.entries??[])},[e,t]);(0,u.useEffect)(()=>{we()},[we,n.checkedAt]);let Be=(0,u.useMemo)(()=>n.changes.filter(h=>h.staged).sort(cn),[n]),De=(0,u.useMemo)(()=>n.changes.filter(h=>!h.staged&&h.status!=="untracked").sort(cn),[n]),rt=(0,u.useMemo)(()=>n.changes.filter(h=>h.status==="untracked").sort(cn),[n]),Kt=[{key:"staged",labelKey:"changes.groupStaged",items:Be},{key:"unstaged",labelKey:"changes.groupUnstaged",items:De},{key:"untracked",labelKey:"changes.groupUntracked",items:rt}].filter(h=>h.items.length>0),{items:Jt,tops:Oe,totalH:Bt}=(0,u.useMemo)(()=>{let h=[];for(let B of Kt)if(h.push({kind:"head",g:{key:B.key,labelKey:B.labelKey,count:B.items.length}}),!E.has(B.key))for(let ie of B.items)h.push({kind:"row",c:ie});let R=Pt(h.map(B=>B.kind==="head"?Sr:dn));return{items:h,tops:R,totalH:R[h.length]}},[Be,De,rt,E]),j=ve.height>0?ve.height:Ma,{first:qe,last:at}=Lt(Oe,ve.top,j,Ga*dn);(0,u.useEffect)(()=>{s(h=>{if(h.size===0)return h;let R=new Set(n.changes.map(ue=>ue.path+(ue.staged?":s":":w"))),B=new Set,ie=!1;for(let ue of h)R.has(ue)?B.add(ue):ie=!0;return ie?B:h})},[n]),(0,u.useEffect)(()=>{if(!p||Q||l.trim()!=="")return;let h=!0;return e.query({sessionId:t,query:{kind:"last-commit-message"}}).then(R=>{let B=de(R,"last-commit-message");h&&B!==null&&(c(B.message),re(!0))}),()=>{h=!1}},[p,Q,l,e,t]);let Ae=(0,u.useCallback)(async(h,R,B=!1,ie=!1)=>{let ue=++me.current;_({path:h,base:R}),ie||z(null),ne(B);let Te=await e.query({sessionId:t,query:{kind:"diff",path:h,base:R,...B?{context:1e5}:{}}});if(ue!==me.current)return;let kn=de(Te,"diff");z(kn!==null?kn.text:"")},[e,t]);(0,u.useEffect)(()=>{if(b===null)return;if(!n.changes.some(R=>R.path===b.path)){_(null),z(null),L("list");return}Ae(b.path,b.base,$,!0)},[n]),(0,u.useEffect)(()=>{V(null)},[n]),(0,u.useEffect)(()=>{N(!1)},[n]);let Ot=h=>{s(R=>{let B=new Set(R);return B.has(h)?B.delete(h):B.add(h),B})},ye=async h=>{if(m)return!1;k(!0),x(null),A(null);try{let R=await r(h);return R.ok?!0:(x(R.error??i("error.generic")),!1)}catch(R){return x(R instanceof Error?R.message:i("error.generic")),!1}finally{k(!1)}},qt=async()=>{let h=l.trim();if(h===""&&!p){x(i("error.emptyMessage"));return}let R=o.size>0?[...new Set([...o].map(ie=>ie.replace(/:[sw]$/,"")))]:void 0;await ye({kind:"commit",message:h,...R?{paths:R}:{},...p?{amend:!0}:{}})&&(c(""),s(new Set),g(!1),re(!1))},Wt=async h=>{await ye({kind:"stash-push",...h.trim()!==""?{message:h}:{}})&&(oe(!1),we())},it=(h,R)=>{ye({kind:"stash-apply",index:h,sha:R}).then(B=>{B&&we()})},ot=(h,R)=>{ye({kind:"stash-pop",index:h,sha:R}).then(B=>{B&&we()})},st=async(h,R)=>{await ye({kind:"stash-drop",index:h,sha:R})&&(Z(null),we())},lt=(h,R)=>{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 R===void 0?i("error.llmFailed"):`${i("error.llmFailed")}: ${R}`;default:return R??i("error.generic")}},dt=async()=>{if(ae)return;if(p&&!Y&&l.trim()!==""){N(!0),x(null),A(i("commit.suggestOverwrite"));return}N(!1);let h=o.size>0?[...new Set([...o].map(R=>R.replace(/:[sw]$/,"")))]:void 0;q(!0),x(null),A(null);try{let R=await e.suggest({sessionId:t,...h&&h.length>0?{paths:h}:{}});R.ok?(c(R.value.message),R.value.truncated===!0&&A(i("commit.suggestTruncated")),W.current?.focus()):x(lt(R.error.code,R.error.message))}catch(R){x(R instanceof Error?R.message:i("error.generic"))}finally{q(!1)}},y=h=>{G(R=>{let B=new Set(R);return B.has(h)?B.delete(h):B.add(h),B})},I=P!==null&&P!==""?Mt(P):null,pe=Re({storageKey:"gp.changes.left",initial:380,min:220,reserve:200,edge:"end"}),zr=(h,R)=>{Ae(h,R),a&&L("diff")},$r=a?["unified","before","after"]:["unified","split","before","after"],ct=a&&U==="split"?"unified":U,vn=[(0,u.createElement)(kr,{key:"stats",stats:n.stats,t:i}),(0,u.createElement)("div",{key:"toolbar",className:"gp-toolbar"},[(0,u.createElement)("button",{key:"sa",type:"button",className:"gp-btn",disabled:m||n.changes.length===0,onClick:()=>void ye({kind:"stage-all"})},i("changes.stageAll")),(0,u.createElement)("button",{key:"ua",type:"button",className:"gp-btn",disabled:m||n.staged===0,onClick:()=>void ye({kind:"unstage-all"})},i("changes.unstageAll")),(0,u.createElement)("button",{key:"stash",type:"button",className:"gp-btn",disabled:m||n.staged===0&&n.modified===0,title:i("changes.stash"),onClick:()=>{x(null),oe(!0)}},[(0,u.createElement)(tn,{key:"ic",size:13}),i("changes.stash")])]),v!==null?(0,u.createElement)("div",{key:"err",className:"gp-feedback"},v):null,le!==null?(0,u.createElement)("div",{key:"notice",className:"gp-notice"},le):null,(0,u.createElement)("div",{key:"list",className:"gp-changes__list",ref:Vt},n.changes.length===0?(0,u.createElement)("div",{className:"gp-empty"},i("changes.noChanges")):(0,u.createElement)("div",{className:"gp-changes__vlist",style:{height:Bt}},Jt.slice(qe,at).map((h,R)=>{let B=qe+R;if(h.kind==="head"){let Te=h.g;return(0,u.createElement)("div",{key:`h:${Te.key}`,className:"gp-changes__vrow",style:{top:Oe[B],height:Sr}},(0,u.createElement)("div",{className:"gp-group-head",onClick:()=>y(Te.key)},[(0,u.createElement)(Ne,{key:"chev",size:12,open:!E.has(Te.key)}),`${i(Te.labelKey)} (${Te.count})`]))}let ie=h.c,ue=ie.path+(ie.staged?":s":":w");return(0,u.createElement)("div",{key:ue,className:"gp-changes__vrow",style:{top:Oe[B],height:dn}},Pa(ie,{selected:o.has(ue),active:b?.path===ie.path&&b.base===(ie.staged?"staged":"worktree"),busy:m,armed:X===ue,onToggle:()=>Ot(ue),onOpen:()=>zr(ie.path,ie.staged?"staged":"worktree"),onStage:()=>void ye(ie.staged?{kind:"unstage",paths:[ie.path]}:{kind:"stage",paths:[ie.path]}),onDiscard:()=>{X===ue?(ye({kind:"discard",paths:[ie.path]}),V(null)):V(ue)},t:i}))}))),K.length>0?(0,u.createElement)("div",{key:"stashes",className:"gp-stash"},[(0,u.createElement)("div",{key:"head",className:"gp-group-head",onClick:()=>D(h=>!h)},[(0,u.createElement)(Ne,{key:"chev",size:12,open:!ce}),`${i("stash.section")} (${K.length})`]),ce?null:(0,u.createElement)("div",{key:"items"},K.map(h=>Aa(h,{busy:m,onApply:()=>it(h.index,h.sha),onPop:()=>ot(h.index,h.sha),onDrop:()=>{x(null),Z(h)},t:i})))]):null,(0,u.createElement)("div",{key:"box",className:"gp-commitbox"},[(0,u.createElement)("textarea",{key:"msg",className:"gp-commitbox__msg",placeholder:i("commit.placeholder"),value:l,ref:W,onChange:h=>c(h.target.value)}),(0,u.createElement)("div",{key:"row",className:"gp-commitbox__row"},[(0,u.createElement)("label",{key:"amend",className:"gp-commitbox__amend"},[(0,u.createElement)("input",{key:"cb",type:"checkbox",className:"gp-check",checked:p,onChange:()=>{g(h=>!h),re(!1)}}),i("commit.amend")]),(0,u.createElement)("div",{key:"actions",className:"gp-commitbox__actions"},[n.suggestEnabled!==!1?(0,u.createElement)("button",{key:"suggest",type:"button",className:"gp-btn",disabled:m||ae||n.changes.length===0,onClick:()=>void dt(),title:i("commit.suggest")},[(0,u.createElement)(Xn,{key:"ic",size:13}),i(ae?"commit.suggesting":"commit.suggest")]):null,(0,u.createElement)("button",{key:"commit",type:"button",className:"gp-btn gp-btn--primary",disabled:m||ae||l.trim()==="",onClick:()=>void qt()},i("commit.commit"))])])])],wn=b===null?(0,u.createElement)("div",{className:"gp-empty"},i("changes.selectFile")):(0,u.createElement)("div",{className:"gp-diff"},[(0,u.createElement)("div",{key:"tb",className:"gp-diff__toolbar"},[a?(0,u.createElement)("button",{key:"back",type:"button",className:"gp-subhead__back",onClick:()=>L("list")},[(0,u.createElement)(Fe,{key:"i",size:14}),i("changes.backToList")]):null,(0,u.createElement)("span",{key:"path",className:"gp-diff__path"},b.path),I?(0,u.createElement)("span",{key:"sum",className:"gp-stats__item",style:{marginLeft:"auto"}},[(0,u.createElement)("span",{key:"a",className:"gp-stats__add"},`+${I.add}`)," ",(0,u.createElement)("span",{key:"d",className:"gp-stats__del"},`\u2212${I.del}`)]):null,(0,u.createElement)("button",{key:"expand",type:"button",className:`gp-seg__btn gp-diff__expand${$?" gp-seg__btn--active":""}`,style:I?{}:{marginLeft:"auto"},disabled:ct!=="split"&&ct!=="unified",title:i($?"diff.collapse":"diff.expandAll"),onClick:()=>void Ae(b.path,b.base,!$)},i($?"diff.collapse":"diff.expandAll")),(0,u.createElement)("div",{key:"seg",className:"gp-seg"},Ge($r,ct,C,h=>i(`diff.${h}`)))]),(0,u.createElement)("div",{key:"scroll",className:"gp-diff__scroll"},P===null?(0,u.createElement)("div",{className:"gp-empty"},i("common.loading")):(0,u.createElement)(Gt,{text:P,mode:ct,path:b.path,remote:e,sessionId:t,imageSpec:{base:b.base},t:i}))]),xn=[M?(0,u.createElement)(Da,{key:"push",onClose:()=>oe(!1),onStash:Wt,error:v,t:i}):null,ke!==null?tt({title:i("stash.dropTitle"),body:i("stash.dropConfirm",{name:ke.message}),confirmLabel:i("stash.drop"),danger:!0,error:v,onConfirm:()=>void st(ke.index,ke.sha),onClose:()=>Z(null),t:i}):null];return a?(0,u.createElement)("div",{className:"gp-changes gp-changes--compact"},[...xn,S==="diff"?(0,u.createElement)("div",{key:"right",className:"gp-changes__right"},wn):(0,u.createElement)("div",{key:"left",className:"gp-changes__left"},vn)]):(0,u.createElement)("div",{className:"gp-changes"},[...xn,(0,u.createElement)("div",{key:"left",className:"gp-changes__left",style:{flex:`0 0 ${pe.width}px`}},vn),pe.divider,(0,u.createElement)("div",{key:"right",className:"gp-changes__right"},wn)])}function Da({onClose:e,onStash:t,error:n,t:r}){let[a,i]=(0,u.useState)("");return Ve({onClose:e,title:r("stash.title"),icon:(0,u.createElement)(tn,{size:15}),portalKey:"stash-push-modal",t:r,body:[(0,u.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)}}),Ie(r),n!==null?(0,u.createElement)("div",{key:"err",className:"gp-feedback"},n):null],footer:Xe({onClose:e,onConfirm:()=>void t(a),confirmLabel:r("stash.save"),confirmDisabled:!1,danger:!1,t:r})})}function Aa(e,t){return(0,u.createElement)("div",{key:e.index,className:"gp-stash-row"},[(0,u.createElement)("div",{key:"info",className:"gp-stash-row__info"},[(0,u.createElement)("span",{key:"m",className:"gp-stash-row__msg",title:e.message},e.message),(0,u.createElement)("span",{key:"meta",className:"gp-stash-row__meta"},[e.branch!==null?(0,u.createElement)("span",{key:"b"},t.t("stash.onBranch",{branch:e.branch})):null,e.relTime!==""?(0,u.createElement)("span",{key:"t"},e.relTime):null])]),(0,u.createElement)("div",{key:"act",className:"gp-stash-row__actions"},[(0,u.createElement)("button",{key:"apply",type:"button",className:"gp-btn gp-btn--sm",disabled:t.busy,onClick:t.onApply},t.t("stash.apply")),(0,u.createElement)("button",{key:"pop",type:"button",className:"gp-btn gp-btn--sm",disabled:t.busy,onClick:t.onPop},t.t("stash.pop")),(0,u.createElement)("button",{key:"drop",type:"button",className:"gp-icon-btn",disabled:t.busy,title:t.t("stash.drop"),onClick:t.onDrop},(0,u.createElement)(Kn,{size:14}))])])}function cn(e,t){return e.path.localeCompare(t.path)}function Pa(e,t){let n=e.path.split("/").pop()??e.path,r=e.path.includes("/")?e.path.slice(0,e.path.lastIndexOf("/")):"";return(0,u.createElement)("div",{key:e.path+(e.staged?":s":":w"),className:`gp-file-row${t.active?" gp-file-row--active":""}`,onClick:t.onOpen},[(0,u.createElement)("input",{key:"cb",type:"checkbox",className:"gp-check",checked:t.selected,onClick:a=>a.stopPropagation(),onChange:t.onToggle}),(0,u.createElement)("span",{key:"st",className:`gp-status-badge ${vt(e.status)}`},bt[e.status]??"?"),(0,u.createElement)("span",{key:"nm",className:"gp-tree-name",title:e.path},[n,r?(0,u.createElement)("span",{key:"d",style:{color:"var(--dsw-alias-label-tertiary)",marginLeft:6,fontSize:11}},r):null]),(0,u.createElement)("span",{key:"act",className:"gp-file-row__actions"},[(0,u.createElement)("button",{key:"stg",type:"button",className:"gp-icon-btn",title:e.staged?t.t("changes.unstage"):t.t("changes.stage"),disabled:t.busy,onClick:a=>{a.stopPropagation(),t.onStage()}},e.staged?"\u2212":"+"),(0,u.createElement)("button",{key:"dis",type:"button",className:"gp-icon-btn",title:t.armed?t.t("changes.discardConfirm"):t.t("changes.discard"),style:t.armed?{color:"var(--dsw-alias-state-error-primary)"}:{},disabled:t.busy,onClick:a=>{a.stopPropagation(),t.onDiscard()}},"\u21BA")])])}var f=require("react");var Se=require("@deepseek-ai/dsh-client-ui-primitives");function Tr(e){return/\.(?:md|markdown)$/i.test(e)}function un(e){return/\.(?:html?|xhtml)$/i.test(e)}function La(e){return Tr(e)||un(e)}var Ha=256*1024,Fa=5e3,Nr=5e3,Ft=20,pn=12,za=600,$a=6e4,gn=new Map;function Ia(e,t){let n=t.file.kind==="loading"?{kind:"idle"}:t.file;gn.set(e,{state:{...t,file:n},leftAt:Date.now()})}function Xa(e){let t=gn.get(e);return t===void 0?null:Date.now()-t.leftAt>$a?(gn.delete(e),null):t.state}function fn({remote:e,sessionId:t,compact:n,t:r}){let a=(0,f.useRef)(void 0);a.current===void 0&&(a.current=Xa(t));let i=a.current,[o,s]=(0,f.useState)(()=>i?.dirs??new Map),[l,c]=(0,f.useState)(()=>i?.open??new Set([""])),[p,g]=(0,f.useState)(()=>i?.selected??null),[m,k]=(0,f.useState)(()=>i?.file??{kind:"idle"}),[v,x]=(0,f.useState)(()=>i?.renderMarkdown??!0),[E,G]=(0,f.useState)("idle"),[X,V]=(0,f.useState)("idle"),[b,_]=(0,f.useState)(()=>i?.pane??"tree"),P=(0,f.useMemo)(()=>({code:{copyLabel:r("files.copy"),copiedLabel:r("files.copied")},footnotes:r("files.footnotes")}),[r]),z=(0,f.useRef)(0),U=Re({storageKey:"gp.files.left",initial:300,min:180,reserve:220,edge:"end"}),C=(0,f.useCallback)(A=>{s(S=>{let L=S.get(A);if(L!==void 0&&L.status!=="error")return S;let K=new Map(S);return K.set(A,{status:"loading"}),K}),e.query({sessionId:t,query:{kind:"dir-list",path:A}}).then(S=>{let L=de(S,"dir-list");s(K=>{let ee=new Map(K);return ee.set(A,L===null?{status:"error"}:{status:"ready",entries:L.entries,truncated:L.truncated}),ee})}).catch(()=>{s(S=>{let L=new Map(S);return L.set(A,{status:"error"}),L})})},[e,t]);(0,f.useEffect)(()=>{C("")},[C]);let $=(0,f.useCallback)(A=>{c(S=>{let L=new Set(S);return L.has(A)?(L.delete(A),L):(L.add(A),o.get(A)===void 0&&C(A),L)})},[o,C]),ne=(0,f.useCallback)(A=>{g(A),n&&_("preview"),x(!un(A)),G("idle"),V("idle");let S=++z.current;k({kind:"loading",path:A}),e.query({sessionId:t,query:{kind:"file-content",path:A}}).then(L=>{if(S!==z.current)return;let K=de(L,"file-content");if(K===null){k({kind:"error",path:A});return}if(K.tooLarge===!0){k({kind:"tooLarge",path:A});return}if(K.variant==="image"&&K.dataUrl!==void 0){k({kind:"image",path:A,dataUrl:K.dataUrl});return}if(K.variant==="text"){k({kind:"text",path:A,content:K.content??"",lines:K.lines??0});return}k({kind:"binary",path:A})}).catch(()=>{S===z.current&&k({kind:"error",path:A})})},[e,t,n]),Q=(0,f.useRef)({dirs:o,open:l,selected:p,file:m,renderMarkdown:v,pane:b});Q.current={dirs:o,open:l,selected:p,file:m,renderMarkdown:v,pane:b},(0,f.useEffect)(()=>()=>{Ia(t,Q.current)},[t]);let re=(0,f.useRef)(!1);(0,f.useEffect)(()=>{re.current||(re.current=!0,i!==null&&i.selected!==null&&m.kind==="idle"&&ne(i.selected))},[i,m.kind,ne]);let ae=(0,f.useMemo)(()=>Er("",0,{dirs:o,open:l,selected:p,toggleDir:$,selectFile:ne,t:r}),[o,l,p,$,ne,r]),q=async()=>{if(p===null)return;let A=z.current;try{await navigator.clipboard.writeText(p),A===z.current&&G("copied")}catch{A===z.current&&G("error")}},Y=async()=>{if(m.kind!=="text")return;let A=z.current;try{await navigator.clipboard.writeText(m.content),A===z.current&&V("copied")}catch{A===z.current&&V("error")}},N=(0,f.createElement)("div",{key:"left",className:"gp-files__tree",style:n?void 0:{flex:`0 0 ${U.width}px`}},ae),le=(0,f.createElement)("div",{key:"right",className:"gp-files__preview"},[p!==null?(0,f.createElement)("div",{key:"bar",className:"gp-files__bar"},[n?(0,f.createElement)("button",{key:"back",type:"button",className:"gp-subhead__back",onClick:()=>_("tree")},[(0,f.createElement)(Fe,{key:"i",size:14}),r("files.backToTree")]):null,(0,f.createElement)("code",{key:"path",className:"gp-files__path",title:p},p),m.kind==="text"&&La(m.path)?(0,f.createElement)("div",{key:"mode",className:"gp-files__mode",role:"group","aria-label":r("files.previewMode")},[(0,f.createElement)("button",{key:"source",type:"button",className:`gp-files__mode-btn${v?"":" gp-files__mode-btn--active"}`,"aria-pressed":!v,onClick:()=>x(!1)},r("files.source")),(0,f.createElement)("button",{key:"render",type:"button",className:`gp-files__mode-btn${v?" gp-files__mode-btn--active":""}`,"aria-pressed":v,onClick:()=>x(!0)},r("files.render"))]):null,(0,f.createElement)("button",{key:"copy",type:"button",className:`gp-files__copy-path${E==="error"?" gp-files__copy-path--error":""}`,"aria-live":"polite",onClick:()=>{q()}},r(E==="copied"?"files.pathCopied":E==="error"?"files.pathCopyFailed":"files.copyPath")),m.kind==="text"?(0,f.createElement)("button",{key:"copy-content",type:"button",className:`gp-files__copy-path${X==="error"?" gp-files__copy-path--error":""}`,"aria-live":"polite",onClick:()=>{Y()}},r(X==="copied"?"files.contentCopied":X==="error"?"files.contentCopyFailed":"files.copyContent")):null]):null,(0,f.createElement)("div",{key:"content",className:"gp-files__preview-content"},Va(m,v,P,r))]);return n?(0,f.createElement)("div",{className:"gp-files gp-files--compact"},b==="preview"?le:N):(0,f.createElement)("div",{className:"gp-files"},[N,U.divider,le])}function Va(e,t,n,r){return e.kind==="text"&&t&&Tr(e.path)?(0,f.createElement)("div",{className:"gp-files__markdown"},(0,f.createElement)(Se.MarkdownText,{text:e.content,labels:n,variant:"body"})):e.kind==="text"&&t&&un(e.path)?(0,f.createElement)("iframe",{className:"gp-files__html",title:e.path,srcDoc:e.content,sandbox:"allow-scripts",referrerPolicy:"no-referrer"}):Ka(e,r)}function Er(e,t,n){let r=n.dirs.get(e);if(r===void 0||r.status==="loading")return t===0?[(0,f.createElement)("div",{key:"l",className:"gp-empty"},n.t("common.loading"))]:[(0,f.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,f.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,f.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,f.createElement)("span",{key:"c",className:"gp-tree-chev"},(0,f.createElement)(Ne,{size:11,open:s})),(0,f.createElement)("span",{key:"i",className:"gp-tree-ic"},(0,f.createElement)(Se.FileTypeIcon,{kind:"folder",size:18})),(0,f.createElement)("span",{key:"n",className:"gp-tree-name"},i.name)])),s&&a.push(...Er(o,t+1,n))}else{let s=n.selected===o;a.push((0,f.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,f.createElement)("span",{key:"c",className:"gp-tree-chev"}),(0,f.createElement)("span",{key:"i",className:"gp-tree-ic"},(0,f.createElement)(Se.FileTypeIcon,{path:o,size:18})),(0,f.createElement)("span",{key:"n",className:"gp-tree-name"},i.name)]))}}return r.truncated&&a.push((0,f.createElement)("div",{key:`t${e}`,className:"gp-tree-row gp-tree-row--muted",style:{paddingLeft:10+t*14}},n.t("files.truncated"))),a}function Ka(e,t){switch(e.kind){case"idle":return(0,f.createElement)("div",{className:"gp-empty"},t("files.selectFile"));case"loading":return(0,f.createElement)("div",{className:"gp-empty"},t("common.loading"));case"error":return(0,f.createElement)("div",{className:"gp-empty"},t("files.loadFailed"));case"tooLarge":return(0,f.createElement)("div",{className:"gp-empty"},t("files.tooLarge"));case"binary":return(0,f.createElement)("div",{className:"gp-empty"},t("files.binary"));case"image":return(0,f.createElement)("div",{className:"gp-files__image"},(0,f.createElement)("img",{src:e.dataUrl,alt:e.path}));case"text":return(0,f.createElement)(Ba,{content:e.content,path:e.path,t})}}function Ja(e,t){if(t==="")return[];let n=[];for(let r=0;r<e.length;r++)for(let[a,i]of _t(e[r],t))if(n.push({line:r,start:a,end:i}),n.length>=wt)return n;return n}function Ba({content:e,path:t,t:n}){let r=(0,f.useMemo)(()=>{let D=e.split(`
503
+ `);return D.length>0&&D[D.length-1]===""&&D.pop(),D},[e]),a=e.length>Ha||r.length>Fa,i=a?void 0:(0,Se.languageForPath)(t),o=(0,Se.useCodeHighlighter)(i),s=(0,f.useMemo)(()=>a?void 0:o(r.join(`
504
+ `)),[a,o,r]),[l,c]=(0,f.useState)(!1),[p,g]=(0,f.useState)(""),[m,k]=(0,f.useState)(!1),[v,x]=(0,f.useState)(0),{setEl:E,viewport:G,elRef:X}=Ht(),V=(0,f.useRef)(null),b=(0,f.useRef)(null);(0,f.useEffect)(()=>{c(!1),g(""),x(0)},[t]);let _=kt(p,xt),P=(0,f.useMemo)(()=>r.map(D=>D.toLowerCase()),[r]),z=m?_:_.toLowerCase(),U=m?r:P,C=(0,f.useMemo)(()=>Ja(U,z),[U,z]);(0,f.useEffect)(()=>{x(0)},[z]);let $=C.length===0?0:Math.min(v,C.length-1),ne=(0,f.useMemo)(()=>{let D=new Map;for(let M of C){let oe=D.get(M.line)??[];oe.push([M.start,M.end]),D.set(M.line,oe)}return D},[C]);(0,f.useEffect)(()=>{let D=M=>{if(!((M.ctrlKey||M.metaKey)&&(M.key==="f"||M.key==="F")))return;let oe=X.current;oe===null||oe.offsetParent===null||(M.preventDefault(),c(!0),requestAnimationFrame(()=>V.current?.select()))};return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[]);let Q=r.length,re=(0,f.useMemo)(()=>Pt(new Array(Q).fill(Ft)),[Q]),ae=G.height>0?G.height:za,{first:q,last:Y}=Lt(re,G.top,ae,pn*Ft),N=C.length>0?C[$].line:-1,le=N>=0?Math.min(q,Math.max(0,N-pn)):q,A=N>=0?Math.max(Y,Math.min(Q,N+pn)):Y;(0,f.useEffect)(()=>{if(N<0)return;let D=requestAnimationFrame(()=>b.current?.scrollIntoView({block:"center",inline:"nearest"}));return()=>cancelAnimationFrame(D)},[$,C,N]);let S=(0,f.useCallback)(D=>{x(M=>C.length===0?0:(M+D+C.length)%C.length)},[C.length]),L=C.length>0?C[$]:null,K=l?(0,f.createElement)(Ct,{inputRef:V,query:p,matches:C.length,active:$,caseSensitive:m,onChange:g,onToggleCase:()=>k(D=>!D),onStep:S,onClose:()=>c(!1),t:n}):null,ee=a||l?(0,f.createElement)("div",{key:"hd",className:"gp-files__header"},[a?(0,f.createElement)("div",{key:"note",className:"gp-files__note"},n("files.highlightOff")):null,K]):null,ce=[];for(let D=le;D<A;D++)ce.push((0,f.createElement)("div",{key:D,className:"gp-files__row",style:{top:D*Ft}},[(0,f.createElement)("div",{key:"n",className:"gp-diff-no"},D+1),Oa(r[D],D,s?.[D],ne.get(D),L,b,n)]));return(0,f.createElement)("div",{className:"gp-files__code gp-diff__scroll",ref:E},[ee,(0,f.createElement)("div",{key:"grid",className:"gp-files__single gp-files__single--virt",style:{height:Q*Ft}},ce)])}function Oa(e,t,n,r,a,i,o){if(e==="")return(0,f.createElement)("div",{key:`c${t}`,className:"gp-diff-cell"},"\xA0");if(e.length>Nr)return(0,f.createElement)("div",{key:`c${t}`,className:"gp-diff-cell"},[e.slice(0,Nr),(0,f.createElement)("span",{key:"trunc",className:"gp-files__trunc"},o("files.lineTruncated"))]);if(r===void 0||r.length===0)return(0,f.createElement)("div",{key:`c${t}`,className:"gp-diff-cell"},n!==void 0?n.map((l,c)=>(0,f.createElement)("span",{key:c,style:l.style},l.text)):e);let s=a!==null&&a.line===t?[a.start,a.end]:null;return(0,f.createElement)("div",{key:`c${t}`,className:"gp-diff-cell"},St(e,r,n,`c${t}`,s,i))}var zt=require("react"),qa=620;function Rr(e){let[t,n]=(0,zt.useState)(!1);return(0,zt.useLayoutEffect)(()=>{if(e===null||typeof ResizeObserver>"u")return;let r=()=>n(e.clientWidth>0&&e.clientWidth<=qa);r();let a=new ResizeObserver(r);return a.observe(e),()=>a.disconnect()},[e]),t}var Gr="gp.panel.fontDelta";function Wa(){if(typeof localStorage>"u")return 0;let e=Number(localStorage.getItem(Gr));return e===-1||e===1?e:0}function Mr({ctx:e,sessionId:t,t:n}){let[r,a]=(0,T.useState)(Wa),[i,o]=(0,T.useState)(null),[s,l]=(0,T.useState)(null),c=Rr(s),p=ft(t),g=We(e),m=p.state==="error"&&p.error.code==="git-unavailable",k=p.state==="error"&&(p.error.code==="not-a-git-repo"||p.error.code==="git-unavailable"),v=m&&p.state==="error"&&p.error.isGitRepo===!0,x=k?"files":i!==null&&i.sessionId===t?i.tab:null,E=(0,T.useRef)({tabs:new Set});E.current.sessionId!==t&&(E.current={sessionId:t,tabs:new Set}),x!==null&&E.current.tabs.add(x);let G=E.current.tabs.has("files");(0,T.useEffect)(()=>{if(!Ce(t))return;if(k){o(null);return}if(i?.sessionId===t)return;let C=Dn(t);if(C!==null){o({sessionId:t,tab:C});return}let $=Ln(t);if($!==null){o({sessionId:t,tab:$});return}p.state==="ready"&&o({sessionId:t,tab:p.snapshot.dirty?"changes":"overview"})},[t,p,k,i?.sessionId]),(0,T.useEffect)(()=>{if(Ce(t))return An(t,C=>o({sessionId:t,tab:C}))},[t]);let X=(0,T.useRef)({tab:null});X.current={sessionId:t,tab:x},(0,T.useEffect)(()=>()=>{let{sessionId:C,tab:$}=X.current;C!==void 0&&$!==null&&Pn(C,$)},[]);let V=p.state==="ready"?p.snapshot.checkedAt:0,b=async C=>{if(!Ce(t))return{ok:!1,error:n("error.noCwd")};let $=await g.run({sessionId:t,action:C});return $.ok?(je(t).accept($.snapshot),{ok:!0}):(je(t).resync(),{ok:!1,error:et($.error.code,$.error.message,n)})},_=C=>{a(C),typeof localStorage<"u"&&localStorage.setItem(Gr,String(C))},P=[{key:"overview",label:n("tab.overview"),icon:(0,T.createElement)(mt,{size:14})},{key:"changes",label:n("tab.changes"),icon:(0,T.createElement)($n,{size:14})},{key:"files",label:n("tab.files"),icon:(0,T.createElement)(Bn,{size:14})}],z=k?P.filter(C=>C.key==="files"):P,U=(()=>{if(!Ce(t))return(0,T.createElement)("div",{className:"gp-empty"},n("error.noCwd"));if(p.state==="no-cwd")return(0,T.createElement)("div",{className:"gp-empty"},n("error.noCwd"));if(k){let $=G?(0,T.createElement)(fn,{key:t,remote:g,sessionId:t,compact:c,t:n}):null;return v?(0,T.createElement)("div",{className:"gp-files-wrap"},[(0,T.createElement)("div",{key:"notice",className:"gp-notice"},n("files.gitNotInstalled")),$]):(0,T.createElement)("div",{style:{display:"contents"}},$)}if(p.state==="error")return(0,T.createElement)("div",{className:"gp-empty"},n("pill.unavailable"));if(p.state==="cold"||p.state==="loading"||x===null)return(0,T.createElement)("div",{className:"gp-empty"},n("common.loading"));let C=p.snapshot;return(0,T.createElement)("div",{style:{display:"contents"}},[E.current.tabs.has("overview")?(0,T.createElement)("div",{key:"overview",style:x==="overview"?{display:"contents"}:{display:"none"}},(0,T.createElement)(wr,{key:t,remote:g,sessionId:t,refreshKey:V,defaultDiffView:C.defaultDiffView,snapshot:C,onAction:b,onResync:()=>je(t).resync(),compact:c,t:n})):null,E.current.tabs.has("changes")?(0,T.createElement)("div",{key:"changes",style:x==="changes"?{display:"contents"}:{display:"none"}},(0,T.createElement)(Cr,{key:t,remote:g,sessionId:t,snapshot:C,onAction:b,compact:c,t:n})):null,G?(0,T.createElement)("div",{key:"files",style:x==="files"?{display:"contents"}:{display:"none"}},(0,T.createElement)(fn,{key:t,remote:g,sessionId:t,compact:c,t:n})):null])})();return(0,T.createElement)("div",{className:"gp-panel",ref:l,"data-conversation-composer-overlay":"","data-font-delta":r,"data-layout":c?"compact":"wide"},[(0,T.createElement)("div",{key:"tabs",className:"gp-tabbar",role:"tablist"},[...z.map(C=>(0,T.createElement)("button",{key:C.key,type:"button",role:"tab","aria-selected":x===C.key,className:`gp-tab${x===C.key?" gp-tab--active":""}`,onClick:()=>{Ce(t)&&o({sessionId:t,tab:C.key})}},[(0,T.createElement)("span",{key:"i",className:"gp-tab__icon"},C.icon),(0,T.createElement)("span",{key:"l",className:"gp-tab__label"},C.label)])),(0,T.createElement)("div",{key:"trailing",className:"gp-tabbar__trailing"},[(0,T.createElement)("div",{key:"font",className:"gp-font"},[(0,T.createElement)("button",{key:"dec",type:"button",className:"gp-font__decrease",onClick:()=>_(-1),"aria-label":n("panel.fontDecrease")},"A\u2212"),(0,T.createElement)("button",{key:"reset",type:"button",className:"gp-font__reset",onClick:()=>_(0),"aria-label":n("panel.fontReset")},"A"),(0,T.createElement)("button",{key:"inc",type:"button",className:"gp-font__increase",onClick:()=>_(1),"aria-label":n("panel.fontIncrease")},"A+")]),(0,T.createElement)(ja,{key:"ver",remote:g,t:n})])]),(0,T.createElement)("div",{key:"body",className:"gp-body"},U)])}function ja({remote:e,t}){let[n,r]=(0,T.useState)({kind:"idle"});(0,T.useEffect)(()=>{let s=!0;return e.version({}).then(l=>{s&&"current"in l&&r(c=>({...c,info:l}))}),()=>{s=!1}},[e]);let a=async()=>{r(l=>({kind:"checking",info:l.info}));let s=await e.version({check:!0});r({kind:"idle",info:"current"in s?s:void 0})},i=n.info,o=n.kind==="checking"?(0,T.createElement)("span",{className:"gp-verbar__status"},t("version.checking")):i===void 0||!i.checkedRemote?null:i.error!==void 0?(0,T.createElement)("span",{className:"gp-verbar__status gp-verbar__status--err",title:i.error},i.error==="repository is not configured"?t("version.noRepo"):t("version.error")):i.updateAvailable&&i.latest!==void 0?(0,T.createElement)("span",{},[(0,T.createElement)("span",{key:"s",className:"gp-verbar__status gp-verbar__status--new"},t("version.updateAvailable",{latest:i.latest,current:i.current})),i.releaseUrl!==void 0?(0,T.createElement)("a",{key:"l",className:"gp-verbar__link",href:i.releaseUrl,target:"_blank",rel:"noreferrer",style:{marginLeft:8}},t("version.viewRelease")):null]):(0,T.createElement)("span",{className:"gp-verbar__status gp-verbar__status--ok"},t("version.upToDate",{current:i.current}));return(0,T.createElement)("div",{className:"gp-verbar"},[i!==void 0?(0,T.createElement)("span",{key:"tag",className:"gp-verbar__tag"},`v${i.current}`):null,o,(0,T.createElement)("button",{key:"btn",type:"button",className:"gp-verbar__btn",disabled:n.kind==="checking",onClick:()=>void a()},[(0,T.createElement)("span",{key:"i",className:"gp-tab__icon"},(0,T.createElement)(ht,{size:12})),t("version.check")]),i?.repositoryUrl!==void 0?(0,T.createElement)("a",{key:"gh",className:"gp-icon-btn gp-verbar__gh",href:i.repositoryUrl,target:"_blank",rel:"noreferrer",title:t("version.openRepo"),"aria-label":t("version.openRepo")},(0,T.createElement)(On,{size:15})):null])}var te=require("react"),Lr=require("react-dom");var Dr="data-gp-tab-dot",Je,mn=null,Ar="",It=null,$t;function Ua(e){if(typeof document>"u")return null;let t=document.querySelectorAll(Ye);for(let n of t)if((n.textContent??"").trim()===e)return n;return null}function hn(){let e=Ua(Ar);if(e===null)return;let t=e.querySelector(`[${Dr}]`);if(It===null){t?.remove();return}let n=`gp-tab-dot gp-tab-dot--${It}`;if(t!==null){t.className!==n&&(t.className=n);return}let r=document.createElement("span");r.className=n,r.setAttribute(Dr,""),r.setAttribute("aria-hidden","true"),e.appendChild(r)}function Qa(){if(typeof document>"u"||typeof MutationObserver>"u")return;let e=document.querySelector(Gn);if(e!==mn){if(Je?.disconnect(),mn=e,e===null){Je=void 0;return}Je=new MutationObserver(()=>hn()),Je.observe(e,{childList:!0,subtree:!0})}}function Ya(){Je?.disconnect(),Je=void 0,mn=null}function Pr(e,t,n){if(!(typeof document>"u")){if(n===null){yn(e);return}$t=e,Ar=t,It=n,Qa(),hn()}}function yn(e){$t!==void 0&&$t!==e||($t=void 0,It=null,hn(),Ya())}function Za(e){let t=e.replace(/[/\\]+$/,"").split(/[/\\]/);return t[t.length-1]||e}function ei(){let[e,t]=(0,te.useState)(!1),[n,r]=(0,te.useState)(null),a=(0,te.useRef)(null);return(0,te.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,Lr.createPortal)((0,te.createElement)("div",{className:"gp-tip",style:{left:n.left,bottom:n.bottom}},s.map((l,c)=>(0,te.createElement)("div",{key:c,className:c===0?"gp-tip__path":"gp-tip__note"},l))),document.body)}}function ti(e){let[t,n]=(0,te.useState)(!1);return(0,te.useEffect)(()=>{if(e===null||typeof ResizeObserver>"u")return;let a=e.closest("[data-conversation-region]")??document.body,i=()=>n(a.clientWidth>0&&a.clientWidth<ni);i();let o=new ResizeObserver(i);return o.observe(a),()=>o.disconnect()},[e]),t}var ni=620;function Hr({sessionId:e,t}){let n=ft(e),r=ei(),[a,i]=(0,te.useState)(null),o=ti(a),s=(0,te.useRef)(Symbol("gp-tab-dot")),l=n.state==="ready"&&n.snapshot.showInputPill===!1?n.snapshot.dirty?"dirty":"synced":null,c=t("panel.tab");if((0,te.useEffect)(()=>{Pr(s.current,c,l);let E=s.current;return()=>{yn(E)}},[c,l]),n.state==="cold"||n.state==="loading"||n.state==="no-cwd")return null;if(n.state==="error")return n.error.code==="not-a-git-repo"||n.error.code==="git-unavailable"||n.error.showInputPill===!1?null:(0,te.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 g=Za(p.root),m=p.branch??`(${t("pill.detached")})`,k=p.dirty,v=k?"gp-pill--dirty":"gp-pill--synced",x=()=>{if(Fn(c)){zn(c);return}Ce(e)&&Mn(e,k?"changes":"overview"),Hn(c)};return(0,te.createElement)("span",{className:"gp-pill-wrap",ref:i},[(0,te.createElement)("button",{key:"btn",type:"button",className:`gp-pill ${v}${o?" gp-pill--compact":""}`,onClick:x,ref:r.bind.ref,onMouseEnter:r.bind.onMouseEnter,onMouseLeave:r.bind.onMouseLeave},[(0,te.createElement)("span",{key:"dot",className:"gp-pill__dot","aria-hidden":"true"}),(0,te.createElement)("span",{key:"repo",className:"gp-pill__repo"},g),(0,te.createElement)("span",{key:"git",className:"gp-pill__git"},["(",(0,te.createElement)("span",{key:"b",className:"gp-pill__branch"},m),")"])]),r.render([p.root,t(k?"pill.dirty":"pill.synced")])])}var J=require("react");function ri(e){for(let t of e){let n=t.schema?.dict;if(n!==void 0&&"showInputPill"in n||JSON.stringify(t.schema).includes("showInputPill"))return t.ns}}function Fr({ctx:e,t}){let[,n]=(0,J.useState)(0),[r,a]=(0,J.useState)(!1),[i,o]=(0,J.useState)(!1),[s,l]=(0,J.useState)(null),[c,p]=(0,J.useState)(null),[g,m]=(0,J.useState)(null),[k,v]=(0,J.useState)(null),x=()=>{n(N=>N+1)},E=e.get("configForms"),G=(0,J.useMemo)(()=>E?.describe(),[E]);(0,J.useEffect)(()=>{if(G!==void 0)return G.ensure(),G.subscribe(x)},[G]);let X=G?.getSnapshot().view,V=(0,J.useMemo)(()=>X===void 0?void 0:ri(X.namespaces),[X]),b=(0,J.useMemo)(()=>E!==void 0&&V!==void 0?E.get(V):void 0,[E,V]);(0,J.useEffect)(()=>{if(b!==void 0)return b.subscribe(x)},[b]);let _=b?.getSnapshot(),P=b!==void 0&&_!==void 0&&_.status==="ready",z=G?.getSnapshot().status,U=s??(typeof _?.value?.showInputPill=="boolean"?_.value.showInputPill:!0),C=c??(_?.value?.defaultDiffView==="split"?"split":"unified"),$=g??(_?.value?.graphStyle==="compact"?"compact":"parallel"),ne=k??(typeof _?.value?.suggestEnabled=="boolean"?_.value.suggestEnabled:!0),Q=async(N,le,A)=>{if(b!==void 0){o(!1),a(!0);try{let S=await b.set(N,le);A(),S?(Ue(),setTimeout(()=>Ue(),1e3)):o(!0)}catch{A(),o(!0)}finally{a(!1)}}},re=N=>(l(N),Q("showInputPill",N,()=>l(null))),ae=N=>N===C?Promise.resolve():(p(N),Q("defaultDiffView",N,()=>p(null))),q=N=>N===$?Promise.resolve():(m(N),Q("graphStyle",N,()=>m(null))),Y=N=>(v(N),Q("suggestEnabled",N,()=>v(null)));return E===void 0?(0,J.createElement)("p",{className:"gp-cfg__hint"},t("cfg.notLoaded")):P?(0,J.createElement)("div",{className:"gp-cfg"},[(0,J.createElement)("h3",{key:"title",className:"gp-cfg__title"},t("cfg.title")),(0,J.createElement)("label",{key:"row",className:"gp-cfg__row"},[(0,J.createElement)("input",{key:"switch",type:"checkbox",role:"switch",className:"gp-cfg__switch",checked:U,disabled:r||_?.writable===!1,onChange:N=>{re(N.currentTarget.checked)}}),(0,J.createElement)("span",{key:"text",className:"gp-cfg__text"},t("cfg.toggle"))]),(0,J.createElement)("p",{key:"hint",className:"gp-cfg__hint"},t("cfg.hint")),(0,J.createElement)("h3",{key:"difftitle",className:"gp-cfg__title",style:{marginTop:6}},t("cfg.diffTitle")),(0,J.createElement)("div",{key:"diffseg",className:"gp-seg gp-cfg__seg"},Ge(["unified","split"],C,N=>{ae(N)},N=>t(N==="unified"?"cfg.diffUnified":"cfg.diffSplit"),r||_?.writable===!1)),(0,J.createElement)("p",{key:"diffhint",className:"gp-cfg__hint"},t("cfg.diffHint")),(0,J.createElement)("h3",{key:"graphtitle",className:"gp-cfg__title",style:{marginTop:6}},t("cfg.graphTitle")),(0,J.createElement)("div",{key:"graphseg",className:"gp-seg gp-cfg__seg"},Ge(["parallel","compact"],$,N=>{q(N)},N=>t(N==="parallel"?"cfg.graphParallel":"cfg.graphCompact"),r||_?.writable===!1)),(0,J.createElement)("p",{key:"graphhint",className:"gp-cfg__hint"},t("cfg.graphHint")),(0,J.createElement)("h3",{key:"sgtitle",className:"gp-cfg__title",style:{marginTop:6}},t("cfg.suggestTitle")),(0,J.createElement)("label",{key:"sgrow",className:"gp-cfg__row"},[(0,J.createElement)("input",{key:"switch",type:"checkbox",role:"switch",className:"gp-cfg__switch",checked:ne,disabled:r||_?.writable===!1,onChange:N=>{Y(N.currentTarget.checked)}}),(0,J.createElement)("span",{key:"text",className:"gp-cfg__text"},t("cfg.suggestToggle"))]),(0,J.createElement)("p",{key:"sghint",className:"gp-cfg__hint"},t("cfg.suggestHint")),i?(0,J.createElement)("p",{key:"error",className:"gp-cfg__err",role:"alert"},t("cfg.saveFailed")):null]):z==="idle"||z==="loading"?(0,J.createElement)("p",{className:"gp-cfg__hint"},t("common.loading")):(0,J.createElement)("p",{className:"gp-cfg__hint"},t("cfg.notLoaded"))}var nt="gitPanel",ai=["dsh-git-panel","@xbzbing/dsh-git-panel"],ii=["slots","locale","connection"],oi="dsh-git-panel";function si(e){_n(),En(e),e.effect(()=>e.locale.register(nt,{zh:Sn,en:Cn})??void 0,"dsh-git-panel: dictionaries");let t=e.locale.bind(nt),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:nt,label:()=>t("panel.tab")},a=>(0,Xt.createElement)(Mr,{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:nt},a=>(0,Xt.createElement)(Hr,{sessionId:a.sessionId,t}))));for(let a of ai)r(e.slots.inject("plugins.bundle.config",()=>e.slots.register({name:"plugins.bundle.config",key:a,locale:nt},i=>i.view==="summary"?t("cfg.title"):(0,Xt.createElement)(Fr,{ctx:e,t}))));e.effect(()=>{let a=e.on("connection/reset",()=>Ue());return()=>{typeof a=="function"&&a();for(let i of n.splice(0))try{i()}catch{}Rn()}},"dsh-git-panel: lifecycle")}module.exports={name:oi,inject:ii,apply:si};
356
505
  return module.exports;
357
506
  } });