dsh-git-desk 0.20.0 → 0.21.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/README.md +4 -2
- package/client.js +6 -4
- package/dist/host/lib/git.js +164 -9
- package/dist/host/lib/rpc.js +5 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,11 +36,12 @@ The tab is not a global panel. It does not sit above the Workspace session list.
|
|
|
36
36
|
- **Tooltips.** Every icon-only control shows a native tooltip with the same text as its accessible name, so the sync, layout, and staging icons read without guessing.
|
|
37
37
|
- **Two comparisons.** Staged compares `HEAD` to `Staged` with one arrow per block. Unstaged compares `Staged` to `Local` with two arrows per block.
|
|
38
38
|
- **Block actions.** Left arrow stages a local block. Right arrow in the unstaged diff reverts the block to the staged version after confirmation. Right arrow in the staged diff unstages the block.
|
|
39
|
-
- **
|
|
39
|
+
- **Discard.** The trash control in the diff header restores the selected file to the last commit, or deletes it when it is untracked, after a confirmation. This cannot be undone.
|
|
40
|
+
- **Commit.** Message, amend toggle, skip hooks toggle, and commit button. The button is disabled until something is staged and no conflict remains. Skip hooks commits with `--no-verify` when a hook is broken.
|
|
40
41
|
- **AI commit actions.** The sparkle button next to Commit offers two actions. **Write a commit message** reads the staged patch and fills the message field. **Create a branch and commit** generates the message, derives the branch name, and opens the branch dialog for confirmation. Both use the model selected in Settings and run only when you click them.
|
|
41
42
|
- **Branches.** The header menu searches local and remote branches, switches local branches, and creates a branch from `HEAD` without a commit. Choosing a remote branch creates a local tracking branch. The commit box still offers **Branch** for create-and-commit.
|
|
42
43
|
- **Branch and commit.** Creates a branch from the current `HEAD`, commits only the staged changes, and leaves Push as the next action.
|
|
43
|
-
- **Sync.** Fetch, pull, and push appear once in the header. Ahead and behind counts appear on push and pull only when they are not zero.
|
|
44
|
+
- **Sync.** Fetch, pull, and push appear once in the header. Ahead and behind counts appear on push and pull only when they are not zero. Pull fast-forwards only. When local changes would be overwritten, pull stashes them, retries, and restores them with staged files still staged. A conflicting restore keeps the stash, switches to Changes, and shows a notice that stays until it is closed or another sync runs.
|
|
44
45
|
- **History.** Lanes, refs, author, relative time, commit detail, file list, and a read-only full-file diff preview in the right panel matching JetBrains ergonomics.
|
|
45
46
|
- **Commit actions.** Right-click a commit, or use the actions control in the detail header, to undo the last commit, revert it, cherry-pick it onto the current branch, or reset the branch to it. Undo and revert open Changes with the message filled and the changes staged. Undo is refused for a pushed HEAD, revert and cherry-pick are refused for merge commits, and every action is refused while another operation is in progress. The menu states the reason on the disabled row.
|
|
46
47
|
- **Stashes.** File-level stash with a message, then apply, pop, or drop.
|
|
@@ -73,6 +74,7 @@ Details, endpoint table, and verification are in [`docs/implementation.md`](docs
|
|
|
73
74
|
|
|
74
75
|
- The tab uses the current session's workspace path. A per-session `workingDirectory` override or a DSH worktree outside the workspace is not followed.
|
|
75
76
|
- Stash is file-level. Hunk-level stash is not implemented.
|
|
77
|
+
- Discard has no undo. It is refused for a conflicted file, while another operation is in progress, and for a rename whose old path holds another file. An untracked nested repository is not deleted.
|
|
76
78
|
- Commit messages and branch names are not generated by a model.
|
|
77
79
|
- Conflict resolution is whole-side plus the marker view. There is no three-pane editor.
|
|
78
80
|
- Block arrows are hidden on a rename; use the file buttons.
|
package/client.js
CHANGED
|
@@ -3,7 +3,7 @@ window.__ModuleLoader__.load({
|
|
|
3
3
|
factory(require) {
|
|
4
4
|
var module = { exports: {} };
|
|
5
5
|
var exports = module.exports;
|
|
6
|
-
"use strict";var wi=Object.create;var Ye=Object.defineProperty;var ki=Object.getOwnPropertyDescriptor;var Ni=Object.getOwnPropertyNames;var Ci=Object.getPrototypeOf,Ri=Object.prototype.hasOwnProperty;var Mi=(t,i)=>{for(var n in i)Ye(t,n,{get:i[n],enumerable:!0})},Tt=(t,i,n,a)=>{if(i&&typeof i=="object"||typeof i=="function")for(let s of Ni(i))!Ri.call(t,s)&&s!==n&&Ye(t,s,{get:()=>i[s],enumerable:!(a=ki(i,s))||a.enumerable});return t};var Si=(t,i,n)=>(n=t!=null?wi(Ci(t)):{},Tt(i||!t||!t.__esModule?Ye(n,"default",{value:t,enumerable:!0}):n,t)),Ti=t=>Tt(Ye({},"__esModule",{value:!0}),t);var ma={};Mi(ma,{apply:()=>ha,inject:()=>ga});module.exports=Ti(ma);var te=Si(require("react"),1),e=te.default.createElement,{useState:x,useEffect:A,useRef:B,useMemo:Me,useCallback:Je}=te.default,ct=class extends Error{code;details;constructor(i,n,a){super(n),this.name="GitCallError",this.code=i,this.details=a}};function Ht(t){if(!(t instanceof Error)||!("code"in t))return;let{code:i}=t;return typeof i=="string"?i:void 0}function _(t){return t instanceof Error?t:new Error(String(t))}var He="git",rt="dsh-git",Hi="dsh-resource://file/session/",Pi=t=>t.startsWith("/")||/^[A-Za-z]:[/\\]/.test(t)||t.startsWith("\\\\"),Ei=t=>t.replace(/\\/g,"/").replace(/^(?:\.\/)+/,"").split("/").map(i=>encodeURIComponent(i)).join("/"),Xe=(t,i)=>`${Hi}${encodeURIComponent(t)}/${Ei(i)}`;function Ai(t,i,n){let a=n.replace(/\\/g,"/");if(!Pi(a))return Xe(t,a);let s=i===void 0?"":i.replace(/\\/g,"/").replace(/\/+$/,"");return s!==""&&a===s?Xe(t,""):s!==""&&a.startsWith(`${s}/`)?Xe(t,a.slice(s.length+1)):Xe(t,a)}function zi(t){let i=t?.rows??[],n=i.findIndex(a=>a.k!=="ctx");if(n<0)return 1;for(let a=n;a<i.length;a+=1){let s=i[a];if(s!==void 0&&s.r!==null)return s.r}return 1}var Di={panel:"Git","mode.changes":"Changes","mode.log":"History","mode.stash":"Stashes","guide.title":"Git changes","guide.description":"Review, stage, commit, and sync the workspace repository.","section.conflicts":"Conflicts","section.staged":"Staged","section.unstaged":"Unstaged","section.stagedCount":"{count} staged","section.unstagedCount":"{count} changed","section.conflictCount":"{count} unresolved","empty.noChanges":"No changes","empty.noChangesHint":"The working tree matches the last commit.","empty.selectFile":"Select a file to review it","empty.selectFileHint":"The full file is shown on both sides. Nothing is collapsed.","empty.noRepo":"Not a Git repository","empty.noRepoHint":"This workspace is not a repository yet.","empty.init":"Initialize repository","empty.noWorkspace":"No workspace is open","empty.noWorkspaceHint":"Open a workspace, then return to Git.","empty.noHistory":"No commits yet","empty.noHistoryHint":"The first commit will appear here.","empty.noStashes":"No stashes","empty.noStashesHint":"Park work here before switching tasks.","action.stageFile":"Stage file","action.unstageFile":"Unstage file","action.stageAll":"Stage all","action.unstageAll":"Unstage all","ai.action":"AI actions","ai.write":"Write a commit message","ai.branch":"Create a branch and commit","ai.written":"Message written with {model}","action.stageBlock":"Stage block","action.unstageBlock":"Unstage block","action.revertBlock":"Revert block to the staged version","action.refresh":"Refresh","action.back":"Back to changes","action.openEditor":"Open in editor","action.prevChange":"Previous change","action.nextChange":"Next change","action.close":"Close","action.cancel":"Cancel","action.confirm":"Confirm","action.commit":"Commit","action.committing":"Committing","action.branch":"Branch","action.createBranch":"Create branch and commit","action.checkout":"Checkout","action.fetch":"Fetch","action.pull":"Pull","action.push":"Push","action.apply":"Apply","action.pop":"Pop","action.drop":"Drop","action.stash":"Stash changes","action.acceptOurs":"Accept ours","action.acceptTheirs":"Accept theirs","action.retry":"Retry","action.init":"Initialize","action.newBranch":"New branch","action.createAndSwitch":"Create and switch","repo.title":"Repositories","repo.current":"Current repository","repo.workspace":"Workspace folder","repo.pick":"Switch repository","repo.none":"No repository found","repo.initRoot":"New repository at the workspace root","repo.initRootTitle":"Initialize at the workspace root?","repo.initRootBody":"The workspace contains {count} repositories. A repository at the workspace root treats each of them as an untracked folder. Pick one of the repositories instead.","repo.initRootConfirm":"Initialize anyway","action.revert":"Revert block","diff.split":"Split","diff.unified":"Unified","diff.head":"HEAD","diff.staged":"Staged","diff.local":"Local","diff.parent":"Parent","diff.commit":"Commit","diff.binary":"Binary file changed","diff.binaryHint":"{before} to {after}","diff.conflictBanner":"This file has unresolved conflicts. Commit is blocked until you resolve it.","diff.loading":"Loading diff","diff.noChanges":"No changes in this file","diff.fullFile":"Full file","diff.layout":"Diff layout","diff.changes":"Changes in this file","diff.lines":"{count} lines","commit.placeholder":"Describe the change","commit.hintStage":"Stage a file to commit.","commit.hintConflict":"Resolve conflicts before committing.","commit.hintMessage":"Write a commit message.","commit.done":"Committed {hash}","commit.amend":"Amend last commit","branch.title":"Branch and commit","branch.name":"Branch name","branch.nameHint":"Created from the current HEAD, then the staged changes are committed.","branch.message":"Commit message","branch.created":"Created {branch} and committed","branch.current":"Current branch","branch.local":"Local branches","branch.loading":"Loading branches","branch.none":"No branches","branch.new":"New branch","branch.newTitle":"New branch","branch.newHint":"Created from the current HEAD and checked out. No commit is made.","branch.search":"Search branches","branch.remote":"Remote branches","branch.createdOnly":"Created {branch}","branch.noneMatch":"No branch matches","stash.title":"Stash changes","stash.message":"Stash message","stash.select":"Files to stash","stash.selectHint":"Only the selected files are stashed. Untracked files are included.","stash.default":"WIP","stash.nothing":"No files to stash.","stash.created":"Stashed {count} files","stash.applied":"Applied {ref}","stash.popped":"Popped {ref}","stash.dropped":"Dropped {ref}","stash.dropTitle":"Drop stash","stash.dropBody":"This deletes {ref} permanently. The changes are not applied.","sync.fetched":"Fetched","sync.pulled":"Pulled","sync.pushed":"Pushed","sync.ahead":"{count} ahead","sync.behind":"{count} behind","sync.noUpstream":"This branch has no upstream. Push sets one.","sync.none":"Up to date","log.title":"History","log.loading":"Loading history","log.select":"Select a commit","log.files":"Changed files","log.noFiles":"No file changes","log.author":"Author","log.date":"Date","log.parent":"Parent","log.message":"Message","history.actions":"Commit actions","history.copy":"Copy commit hash","history.undo":"Undo last commit","history.undoHint":"Moves HEAD back and keeps the change staged.","history.revert":"Revert commit","history.revertHint":"Stages the inverse change with a revert message.","history.cherryPick":"Cherry-pick commit","history.cherryPickHint":"Applies the commit here and commits it.","history.reset":"Reset branch to here","history.resetHint":"Moves this branch to the selected commit.","history.blockedOperation":"Finish the current operation first.","history.blockedNotHead":"Only the last commit can be undone.","history.blockedDetached":"Check out a branch first.","history.blockedNoParent":"The first commit cannot be undone.","history.blockedPushed":"This commit is already on the upstream branch. Revert it instead.","history.blockedMerge":"Merge commits are not supported here.","history.blockedStaged":"Commit or unstage the staged files first.","history.blockedContained":"Already in this branch.","history.blockedConflict":"Resolve the conflicts first.","history.undoTitle":"Undo the last commit?","history.undoBody":"The commit leaves the branch and its changes stay staged, so you can edit and commit again.","history.undoAction":"Undo commit","history.revertTitle":"Revert this commit?","history.revertBody":"A new set of changes that reverses this commit is staged with a generated message. The commit stays in history.","history.revertAction":"Revert commit","history.resetTitle":"Reset this branch?","history.resetBody":"This branch moves to {hash}. Choose what happens to the changes after it.","history.resetModeSoft":"Soft","history.resetModeSoftHint":"Keep the changes staged for a new commit.","history.resetModeMixed":"Mixed","history.resetModeMixedHint":"Keep the changes in the working tree, unstaged.","history.resetModeHard":"Hard","history.resetModeHardHint":"Discard the commits and their changes.","history.resetHardWarning":"Hard reset discards every local change after this commit. This cannot be undone.","history.resetAction":"Reset branch","history.undone":"Commit undone. Changes are staged.","history.reverted":"Revert ready. Review it, then commit.","history.revertConflicts":"Revert stopped with conflicts. Resolve them, then commit.","history.picked":"Cherry-picked as {hash}","history.resetDone":"Branch reset to {hash}","status.loading":"Reading repository","status.detached":"Detached HEAD","error.title":"Git action failed","error.notInstalled":"Git is not installed","error.notInstalledHint":"Install Git and make it available on PATH, then refresh.","confirm.revertTitle":"Revert this block?","confirm.revertBody":"The local block is replaced by the staged version. This working tree change is lost.","confirm.checkoutTitle":"Switch branch?","confirm.checkoutBody":"Local changes are carried over when Git can keep them, otherwise the checkout is refused.","confirm.yesRevert":"Revert block","confirm.yesCheckout":"Switch branch","meta.binary":"binary","meta.blocks":"{count} blocks","meta.add":"{count} added","meta.del":"{count} deleted","filter.placeholder":"Filter files","filter.clear":"Clear filter","meta.partial":"partial","meta.partialHint":"Some changes in this file are staged","commit.stagedSummary":"{count} staged","commit.shortcut":"{key}+Enter to commit","diff.added":"Added","diff.removed":"Removed","diff.blockCount":"{count} changes","diff.blockCountOne":"1 change","stash.applyHint":"Apply the changes and keep the stash","stash.popHint":"Apply the changes and delete the stash","stash.dropHint":"Delete the stash","filter.empty":'No files match "{filter}"',"action.copyHash":"Copy commit hash","action.copied":"Copied!","diff.unstaged":"Unstaged","stash.selectAll":"Select all","stash.deselectAll":"Deselect all","header.label":"Git panel","settings.section":"Git","settings.model":"AI model","settings.modelHint":"Used by the commit message actions. The default follows the Composer selection, including later changes.","settings.modelSame":"Same as Composer","settings.modelEmpty":"No models are available in this build.","settings.modelFailed":"The model list could not be read.","settings.instruction":"Commit instructions","settings.instructionHint":"These lines shape the wording. The title line type(scope): summary stays required; a short body is welcome.","settings.instructionReset":"Restore default","settings.instructionFailed":"The default instructions could not be read.","command.toggle":"Open or collapse the Git panel","command.commit":"Commit staged changes","command.writeMessage":"Write the commit message with AI","command.stageAll":"Stage all changes","command.openFirst":"Open the Git panel first","command.nothingToStage":"No changed files to stage","command.notReady":"Stage a file and write a message first","split.files":"Resize the file list","split.commits":"Resize the commit list"},Li={panel:"Git","mode.changes":"\u66F4\u6539","mode.log":"\u5386\u53F2","mode.stash":"\u8D2E\u85CF","guide.title":"Git \u66F4\u6539","guide.description":"\u67E5\u770B\u3001\u6682\u5B58\u3001\u63D0\u4EA4\u5E76\u540C\u6B65\u5DE5\u4F5C\u533A\u4ED3\u5E93\u3002","section.conflicts":"\u51B2\u7A81","section.staged":"\u5DF2\u6682\u5B58","section.unstaged":"\u672A\u6682\u5B58","section.stagedCount":"\u5DF2\u6682\u5B58 {count}","section.unstagedCount":"\u5DF2\u66F4\u6539 {count}","section.conflictCount":"\u672A\u89E3\u51B3 {count}","empty.noChanges":"\u6CA1\u6709\u66F4\u6539","empty.noChangesHint":"\u5DE5\u4F5C\u533A\u4E0E\u6700\u8FD1\u4E00\u6B21\u63D0\u4EA4\u4E00\u81F4\u3002","empty.selectFile":"\u9009\u62E9\u4E00\u4E2A\u6587\u4EF6\u67E5\u770B\u66F4\u6539","empty.selectFileHint":"\u4E24\u4FA7\u90FD\u663E\u793A\u5B8C\u6574\u6587\u4EF6\uFF0C\u4E0D\u4F1A\u6298\u53E0\u3002","empty.noRepo":"\u4E0D\u662F Git \u4ED3\u5E93","empty.noRepoHint":"\u5F53\u524D\u5DE5\u4F5C\u533A\u8FD8\u4E0D\u662F\u4ED3\u5E93\u3002","empty.init":"\u521D\u59CB\u5316\u4ED3\u5E93","empty.noWorkspace":"\u6CA1\u6709\u6253\u5F00\u7684\u5DE5\u4F5C\u533A","empty.noWorkspaceHint":"\u6253\u5F00\u4E00\u4E2A\u5DE5\u4F5C\u533A\uFF0C\u7136\u540E\u56DE\u5230 Git\u3002","empty.noHistory":"\u8FD8\u6CA1\u6709\u63D0\u4EA4","empty.noHistoryHint":"\u7B2C\u4E00\u6B21\u63D0\u4EA4\u4F1A\u51FA\u73B0\u5728\u8FD9\u91CC\u3002","empty.noStashes":"\u6CA1\u6709\u8D2E\u85CF","empty.noStashesHint":"\u5207\u6362\u4EFB\u52A1\u524D\u53EF\u4EE5\u628A\u5DE5\u4F5C\u653E\u5728\u8FD9\u91CC\u3002","action.stageFile":"\u6682\u5B58\u6587\u4EF6","action.unstageFile":"\u53D6\u6D88\u6682\u5B58\u6587\u4EF6","action.stageAll":"\u5168\u90E8\u6682\u5B58","action.unstageAll":"\u5168\u90E8\u53D6\u6D88\u6682\u5B58","ai.action":"AI \u64CD\u4F5C","ai.write":"\u751F\u6210\u63D0\u4EA4\u4FE1\u606F","ai.branch":"\u521B\u5EFA\u5206\u652F\u5E76\u63D0\u4EA4","ai.written":"\u5DF2\u7531 {model} \u751F\u6210\u63D0\u4EA4\u4FE1\u606F","action.stageBlock":"\u6682\u5B58\u533A\u5757","action.unstageBlock":"\u53D6\u6D88\u6682\u5B58\u533A\u5757","action.revertBlock":"\u5C06\u533A\u5757\u8FD8\u539F\u4E3A\u5DF2\u6682\u5B58\u7248\u672C","action.refresh":"\u5237\u65B0","action.back":"\u8FD4\u56DE\u66F4\u6539","action.openEditor":"\u5728\u7F16\u8F91\u5668\u4E2D\u6253\u5F00","action.prevChange":"\u4E0A\u4E00\u4E2A\u66F4\u6539","action.nextChange":"\u4E0B\u4E00\u4E2A\u66F4\u6539","action.close":"\u5173\u95ED","action.cancel":"\u53D6\u6D88","action.confirm":"\u786E\u8BA4","action.commit":"\u63D0\u4EA4","action.committing":"\u6B63\u5728\u63D0\u4EA4","action.branch":"\u5206\u652F","action.createBranch":"\u521B\u5EFA\u5206\u652F\u5E76\u63D0\u4EA4","action.checkout":"\u5207\u6362","action.fetch":"\u83B7\u53D6","action.pull":"\u62C9\u53D6","action.push":"\u63A8\u9001","action.apply":"\u5E94\u7528","action.pop":"\u5F39\u51FA","action.drop":"\u5220\u9664","action.stash":"\u8D2E\u85CF\u66F4\u6539","action.acceptOurs":"\u91C7\u7528\u672C\u5730","action.acceptTheirs":"\u91C7\u7528\u8FDC\u7AEF","action.retry":"\u91CD\u8BD5","action.init":"\u521D\u59CB\u5316","action.newBranch":"\u65B0\u5EFA\u5206\u652F","action.createAndSwitch":"\u521B\u5EFA\u5E76\u5207\u6362","repo.title":"\u4ED3\u5E93","repo.current":"\u5F53\u524D\u4ED3\u5E93","repo.workspace":"\u5DE5\u4F5C\u533A\u76EE\u5F55","repo.pick":"\u5207\u6362\u4ED3\u5E93","repo.none":"\u672A\u627E\u5230\u4ED3\u5E93","repo.initRoot":"\u5728\u5DE5\u4F5C\u533A\u6839\u76EE\u5F55\u65B0\u5EFA\u4ED3\u5E93","repo.initRootTitle":"\u5728\u6839\u76EE\u5F55\u521D\u59CB\u5316\uFF1F","repo.initRootBody":"\u5DE5\u4F5C\u533A\u5305\u542B {count} \u4E2A\u4ED3\u5E93\u3002\u5728\u6839\u76EE\u5F55\u521D\u59CB\u5316\u4F1A\u628A\u5B83\u4EEC\u5F53\u6210\u672A\u8DDF\u8E2A\u76EE\u5F55\u3002\u8BF7\u6539\u7528\u4ED3\u5E93\u9009\u62E9\u5668\u3002","repo.initRootConfirm":"\u4ECD\u8981\u521D\u59CB\u5316","action.revert":"\u8FD8\u539F\u533A\u5757","diff.split":"\u5E76\u6392","diff.unified":"\u7EDF\u4E00","diff.head":"HEAD","diff.staged":"\u5DF2\u6682\u5B58","diff.local":"\u672C\u5730","diff.parent":"\u7236\u63D0\u4EA4","diff.commit":"\u63D0\u4EA4","diff.binary":"\u4E8C\u8FDB\u5236\u6587\u4EF6\u5DF2\u66F4\u6539","diff.binaryHint":"{before} \u5230 {after}","diff.conflictBanner":"\u6B64\u6587\u4EF6\u6709\u672A\u89E3\u51B3\u7684\u51B2\u7A81\u3002\u89E3\u51B3\u524D\u65E0\u6CD5\u63D0\u4EA4\u3002","diff.loading":"\u6B63\u5728\u8BFB\u53D6\u5DEE\u5F02","diff.noChanges":"\u6B64\u6587\u4EF6\u6CA1\u6709\u66F4\u6539","diff.fullFile":"\u5B8C\u6574\u6587\u4EF6","diff.layout":"\u5DEE\u5F02\u5E03\u5C40","diff.changes":"\u6B64\u6587\u4EF6\u4E2D\u7684\u66F4\u6539","diff.lines":"{count} \u884C","commit.placeholder":"\u63CF\u8FF0\u8FD9\u6B21\u66F4\u6539","commit.hintStage":"\u5148\u6682\u5B58\u4E00\u4E2A\u6587\u4EF6\u3002","commit.hintConflict":"\u8BF7\u5148\u89E3\u51B3\u51B2\u7A81\u3002","commit.hintMessage":"\u5199\u4E00\u6761\u63D0\u4EA4\u4FE1\u606F\u3002","commit.done":"\u5DF2\u63D0\u4EA4 {hash}","commit.amend":"\u4FEE\u8865\u4E0A\u6B21\u63D0\u4EA4","branch.title":"\u5206\u652F\u5E76\u63D0\u4EA4","branch.name":"\u5206\u652F\u540D","branch.nameHint":"\u4ECE\u5F53\u524D HEAD \u521B\u5EFA\u5206\u652F\uFF0C\u7136\u540E\u63D0\u4EA4\u5DF2\u6682\u5B58\u7684\u66F4\u6539\u3002","branch.message":"\u63D0\u4EA4\u4FE1\u606F","branch.created":"\u5DF2\u521B\u5EFA {branch} \u5E76\u63D0\u4EA4","branch.current":"\u5F53\u524D\u5206\u652F","branch.local":"\u672C\u5730\u5206\u652F","branch.loading":"\u6B63\u5728\u8BFB\u53D6\u5206\u652F","branch.none":"\u6CA1\u6709\u5206\u652F","branch.new":"\u65B0\u5EFA\u5206\u652F","branch.newTitle":"\u65B0\u5EFA\u5206\u652F","branch.newHint":"\u4ECE\u5F53\u524D HEAD \u521B\u5EFA\u5E76\u5207\u6362\uFF0C\u4E0D\u4EA7\u751F\u63D0\u4EA4\u3002","branch.search":"\u641C\u7D22\u5206\u652F","branch.remote":"\u8FDC\u7AEF\u5206\u652F","branch.createdOnly":"\u5DF2\u521B\u5EFA {branch}","branch.noneMatch":"\u6CA1\u6709\u5339\u914D\u7684\u5206\u652F","stash.title":"\u8D2E\u85CF\u66F4\u6539","stash.message":"\u8D2E\u85CF\u4FE1\u606F","stash.select":"\u8981\u8D2E\u85CF\u7684\u6587\u4EF6","stash.selectHint":"\u53EA\u8D2E\u85CF\u9009\u4E2D\u7684\u6587\u4EF6\u3002\u672A\u8DDF\u8E2A\u6587\u4EF6\u4E5F\u4F1A\u5305\u542B\u3002","stash.default":"WIP","stash.nothing":"\u6CA1\u6709\u53EF\u8D2E\u85CF\u7684\u6587\u4EF6\u3002","stash.created":"\u5DF2\u8D2E\u85CF {count} \u4E2A\u6587\u4EF6","stash.applied":"\u5DF2\u5E94\u7528 {ref}","stash.popped":"\u5DF2\u5F39\u51FA {ref}","stash.dropped":"\u5DF2\u5220\u9664 {ref}","stash.dropTitle":"\u5220\u9664\u8D2E\u85CF","stash.dropBody":"\u8FD9\u4F1A\u6C38\u4E45\u5220\u9664 {ref}\uFF0C\u4E14\u4E0D\u4F1A\u5E94\u7528\u5176\u4E2D\u7684\u66F4\u6539\u3002","sync.fetched":"\u5DF2\u83B7\u53D6","sync.pulled":"\u5DF2\u62C9\u53D6","sync.pushed":"\u5DF2\u63A8\u9001","sync.ahead":"\u9886\u5148 {count}","sync.behind":"\u843D\u540E {count}","sync.noUpstream":"\u6B64\u5206\u652F\u6CA1\u6709\u4E0A\u6E38\uFF0C\u63A8\u9001\u65F6\u4F1A\u8BBE\u7F6E\u3002","sync.none":"\u5DF2\u662F\u6700\u65B0","log.title":"\u5386\u53F2","log.loading":"\u6B63\u5728\u8BFB\u53D6\u5386\u53F2","log.select":"\u9009\u62E9\u4E00\u4E2A\u63D0\u4EA4","log.files":"\u66F4\u6539\u7684\u6587\u4EF6","log.noFiles":"\u6CA1\u6709\u6587\u4EF6\u66F4\u6539","log.author":"\u4F5C\u8005","log.date":"\u65E5\u671F","log.parent":"\u7236\u63D0\u4EA4","log.message":"\u4FE1\u606F","history.actions":"\u63D0\u4EA4\u64CD\u4F5C","history.copy":"\u590D\u5236\u63D0\u4EA4\u54C8\u5E0C","history.undo":"\u64A4\u9500\u6700\u540E\u4E00\u6B21\u63D0\u4EA4","history.undoHint":"HEAD \u56DE\u9000\uFF0C\u66F4\u6539\u4FDD\u7559\u5728\u6682\u5B58\u533A\u3002","history.revert":"\u8FD8\u539F\u63D0\u4EA4","history.revertHint":"\u751F\u6210\u53CD\u5411\u66F4\u6539\u5E76\u5199\u5165\u8FD8\u539F\u4FE1\u606F\u3002","history.cherryPick":"\u62E3\u9009\u63D0\u4EA4","history.cherryPickHint":"\u5728\u6B64\u5206\u652F\u5E94\u7528\u5E76\u63D0\u4EA4\u8BE5\u63D0\u4EA4\u3002","history.reset":"\u5C06\u5206\u652F\u91CD\u7F6E\u5230\u6B64\u5904","history.resetHint":"\u628A\u5F53\u524D\u5206\u652F\u79FB\u52A8\u5230\u6240\u9009\u63D0\u4EA4\u3002","history.blockedOperation":"\u8BF7\u5148\u5B8C\u6210\u5F53\u524D\u64CD\u4F5C\u3002","history.blockedNotHead":"\u53EA\u80FD\u64A4\u9500\u6700\u540E\u4E00\u6B21\u63D0\u4EA4\u3002","history.blockedDetached":"\u8BF7\u5148\u5207\u6362\u5230\u5206\u652F\u3002","history.blockedNoParent":"\u7B2C\u4E00\u4E2A\u63D0\u4EA4\u65E0\u6CD5\u64A4\u9500\u3002","history.blockedPushed":"\u8BE5\u63D0\u4EA4\u5DF2\u5728\u4E0A\u6E38\u5206\u652F\u4E0A\uFF0C\u8BF7\u6539\u7528\u8FD8\u539F\u3002","history.blockedMerge":"\u6B64\u5904\u4E0D\u652F\u6301\u5408\u5E76\u63D0\u4EA4\u3002","history.blockedStaged":"\u8BF7\u5148\u63D0\u4EA4\u6216\u53D6\u6D88\u6682\u5B58\u5DF2\u6682\u5B58\u7684\u6587\u4EF6\u3002","history.blockedContained":"\u5DF2\u5728\u5F53\u524D\u5206\u652F\u4E2D\u3002","history.blockedConflict":"\u8BF7\u5148\u89E3\u51B3\u51B2\u7A81\u3002","history.undoTitle":"\u64A4\u9500\u6700\u540E\u4E00\u6B21\u63D0\u4EA4\uFF1F","history.undoBody":"\u8BE5\u63D0\u4EA4\u4F1A\u79BB\u5F00\u5206\u652F\uFF0C\u66F4\u6539\u4FDD\u7559\u5728\u6682\u5B58\u533A\uFF0C\u53EF\u7EE7\u7EED\u7F16\u8F91\u5E76\u91CD\u65B0\u63D0\u4EA4\u3002","history.undoAction":"\u64A4\u9500\u63D0\u4EA4","history.revertTitle":"\u8FD8\u539F\u8FD9\u4E2A\u63D0\u4EA4\uFF1F","history.revertBody":"\u4F1A\u6682\u5B58\u53CD\u5411\u66F4\u6539\u5E76\u586B\u5165\u8FD8\u539F\u4FE1\u606F\uFF0C\u539F\u63D0\u4EA4\u4ECD\u4FDD\u7559\u5728\u5386\u53F2\u4E2D\u3002","history.revertAction":"\u8FD8\u539F\u63D0\u4EA4","history.resetTitle":"\u91CD\u7F6E\u8FD9\u4E2A\u5206\u652F\uFF1F","history.resetBody":"\u5206\u652F\u4F1A\u79FB\u52A8\u5230 {hash}\u3002\u9009\u62E9\u5176\u540E\u66F4\u6539\u7684\u5904\u7406\u65B9\u5F0F\u3002","history.resetModeSoft":"\u8F6F\u91CD\u7F6E","history.resetModeSoftHint":"\u66F4\u6539\u4FDD\u7559\u5728\u6682\u5B58\u533A\uFF0C\u53EF\u91CD\u65B0\u63D0\u4EA4\u3002","history.resetModeMixed":"\u6DF7\u5408\u91CD\u7F6E","history.resetModeMixedHint":"\u66F4\u6539\u4FDD\u7559\u5728\u5DE5\u4F5C\u533A\uFF0C\u4E0D\u6682\u5B58\u3002","history.resetModeHard":"\u786C\u91CD\u7F6E","history.resetModeHardHint":"\u4E22\u5F03\u8FD9\u4E9B\u63D0\u4EA4\u53CA\u5176\u66F4\u6539\u3002","history.resetHardWarning":"\u786C\u91CD\u7F6E\u4F1A\u4E22\u5F03\u8BE5\u63D0\u4EA4\u4E4B\u540E\u7684\u5168\u90E8\u672C\u5730\u66F4\u6539\uFF0C\u4E14\u65E0\u6CD5\u64A4\u9500\u3002","history.resetAction":"\u91CD\u7F6E\u5206\u652F","history.undone":"\u5DF2\u64A4\u9500\u63D0\u4EA4\uFF0C\u66F4\u6539\u5DF2\u6682\u5B58\u3002","history.reverted":"\u8FD8\u539F\u5DF2\u5C31\u7EEA\uFF0C\u8BF7\u68C0\u67E5\u540E\u63D0\u4EA4\u3002","history.revertConflicts":"\u8FD8\u539F\u9047\u5230\u51B2\u7A81\uFF0C\u8BF7\u89E3\u51B3\u540E\u63D0\u4EA4\u3002","history.picked":"\u5DF2\u62E3\u9009\u4E3A {hash}","history.resetDone":"\u5206\u652F\u5DF2\u91CD\u7F6E\u5230 {hash}","status.loading":"\u6B63\u5728\u8BFB\u53D6\u4ED3\u5E93","status.detached":"\u6E38\u79BB HEAD","error.title":"Git \u64CD\u4F5C\u5931\u8D25","error.notInstalled":"\u672A\u5B89\u88C5 Git","error.notInstalledHint":"\u5B89\u88C5 Git \u5E76\u786E\u4FDD\u5B83\u5728 PATH \u4E2D\uFF0C\u7136\u540E\u5237\u65B0\u3002","confirm.revertTitle":"\u8FD8\u539F\u8FD9\u4E2A\u533A\u5757\uFF1F","confirm.revertBody":"\u672C\u5730\u533A\u5757\u4F1A\u88AB\u5DF2\u6682\u5B58\u7248\u672C\u66FF\u6362\uFF0C\u8FD9\u90E8\u5206\u5DE5\u4F5C\u533A\u66F4\u6539\u4F1A\u4E22\u5931\u3002","confirm.checkoutTitle":"\u5207\u6362\u5206\u652F\uFF1F","confirm.checkoutBody":"\u5982\u679C Git \u80FD\u4FDD\u7559\uFF0C\u672C\u5730\u66F4\u6539\u4F1A\u5E26\u5230\u65B0\u5206\u652F\uFF0C\u5426\u5219\u4F1A\u62D2\u7EDD\u5207\u6362\u3002","confirm.yesRevert":"\u8FD8\u539F\u533A\u5757","confirm.yesCheckout":"\u5207\u6362\u5206\u652F","meta.binary":"\u4E8C\u8FDB\u5236","meta.blocks":"{count} \u4E2A\u533A\u5757","meta.add":"\u65B0\u589E {count}","meta.del":"\u5220\u9664 {count}","filter.placeholder":"\u8FC7\u6EE4\u6587\u4EF6","filter.clear":"\u6E05\u9664\u8FC7\u6EE4","meta.partial":"\u90E8\u5206","meta.partialHint":"\u6B64\u6587\u4EF6\u7684\u90E8\u5206\u66F4\u6539\u5DF2\u6682\u5B58","commit.stagedSummary":"\u5DF2\u6682\u5B58 {count} \u4E2A","commit.shortcut":"\u6309 {key}+Enter \u63D0\u4EA4","diff.added":"\u65B0\u589E","diff.removed":"\u5220\u9664","diff.blockCount":"{count} \u5904\u66F4\u6539","diff.blockCountOne":"1 \u5904\u66F4\u6539","stash.applyHint":"\u5E94\u7528\u66F4\u6539\u5E76\u4FDD\u7559\u8D2E\u85CF","stash.popHint":"\u5E94\u7528\u66F4\u6539\u5E76\u5220\u9664\u8D2E\u85CF","stash.dropHint":"\u5220\u9664\u8D2E\u85CF","filter.empty":'\u6CA1\u6709\u6587\u4EF6\u5339\u914D "{filter}"',"action.copyHash":"\u590D\u5236\u63D0\u4EA4\u54C8\u5E0C","action.copied":"\u5DF2\u590D\u5236\uFF01","diff.unstaged":"\u672A\u6682\u5B58","stash.selectAll":"\u5168\u9009","stash.deselectAll":"\u5168\u4E0D\u9009","header.label":"Git \u9762\u677F","settings.section":"Git","settings.model":"AI \u6A21\u578B","settings.modelHint":"\u7528\u4E8E\u751F\u6210\u63D0\u4EA4\u4FE1\u606F\u3002\u9ED8\u8BA4\u8DDF\u968F\u8F93\u5165\u6846\u9009\u62E9\u7684\u6A21\u578B\uFF0C\u4E4B\u540E\u5207\u6362\u4E5F\u4F1A\u8DDF\u968F\u3002","settings.modelSame":"\u4E0E\u8F93\u5165\u6846\u76F8\u540C","settings.modelEmpty":"\u6B64\u7248\u672C\u6CA1\u6709\u53EF\u7528\u6A21\u578B\u3002","settings.modelFailed":"\u65E0\u6CD5\u8BFB\u53D6\u6A21\u578B\u5217\u8868\u3002","settings.instruction":"\u63D0\u4EA4\u4FE1\u606F\u6307\u4EE4","settings.instructionHint":"\u8FD9\u4E9B\u5185\u5BB9\u51B3\u5B9A\u63AA\u8F9E\uFF0C\u6807\u9898\u884C type(scope): \u6458\u8981\u59CB\u7EC8\u5FC5\u586B\uFF0C\u53EF\u4EE5\u518D\u5199\u4E00\u6BB5\u8BF4\u660E\u3002","settings.instructionReset":"\u6062\u590D\u9ED8\u8BA4","settings.instructionFailed":"\u65E0\u6CD5\u8BFB\u53D6\u9ED8\u8BA4\u6307\u4EE4\u3002","command.toggle":"\u6253\u5F00\u6216\u6536\u8D77 Git \u9762\u677F","command.commit":"\u63D0\u4EA4\u5DF2\u6682\u5B58\u7684\u66F4\u6539","command.writeMessage":"\u7528 AI \u5199\u63D0\u4EA4\u4FE1\u606F","command.stageAll":"\u6682\u5B58\u5168\u90E8\u66F4\u6539","command.openFirst":"\u8BF7\u5148\u6253\u5F00 Git \u9762\u677F","command.nothingToStage":"\u6CA1\u6709\u53EF\u6682\u5B58\u7684\u66F4\u6539","command.notReady":"\u8BF7\u5148\u6682\u5B58\u6587\u4EF6\u5E76\u586B\u5199\u63D0\u4EA4\u4FE1\u606F","split.files":"\u8C03\u6574\u6587\u4EF6\u5217\u8868\u5BBD\u5EA6","split.commits":"\u8C03\u6574\u63D0\u4EA4\u5217\u8868\u5BBD\u5EA6"},Pt="dsh-git.layout",Et="dsh-git.layout.compact",$e="dsh-git.repo.";function Ge(t,i){try{return window.localStorage.getItem(t)??i}catch{return i}}function Pe(t,i){try{window.localStorage.setItem(t,i)}catch{}}var Bi=/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent)?"\u2318":"Ctrl",At=new Map;function Wt(t){let i=At.get(t);if(i===void 0){let n=new Set,a=!1;i={hook:{getSnapshot:()=>a,subscribe(s){return n.add(s),()=>{n.delete(s)}}},set(s){if(s!==a){a=s;for(let o of[...n])o()}}},At.set(t,i)}return i}var Gt="dsh-git.preferences.v1";function Ii(){let t={model:null,instruction:""},i=Ge(Gt,"");if(i==="")return t;try{let n=JSON.parse(i),a=n!==null&&typeof n=="object"?n:{};return{model:gt(a.model),instruction:typeof a.instruction=="string"?a.instruction:""}}catch{return t}}var dt=(()=>{let t=Ii(),i=new Set;return{hook:{getSnapshot:()=>t,subscribe(n){return i.add(n),()=>{i.delete(n)}}},set(n){t={model:gt(n.model),instruction:typeof n.instruction=="string"?n.instruction:""},Pe(Gt,JSON.stringify(t));for(let a of[...i])a()}}})(),Ut="dsh-git.split",pt=320,Fe=220,zt=280,Kt=1e4,Dt=16;function Fi(){let t=Number.parseInt(Ge(Ut,""),10);return Number.isFinite(t)?Math.min(Math.max(t,Fe),Kt):pt}var We=(()=>{let t=Fi(),i=new Set;return{get:()=>t,subscribe(n){return i.add(n),()=>{i.delete(n)}},set(n){let a=Math.round(n);if(!(!Number.isFinite(a)||a===t)){t=Math.min(Math.max(a,Fe),Kt),Pe(Ut,String(t));for(let s of[...i])s()}}}})();function Vt(){let[t,i]=x(We.get);return A(()=>(i(We.get()),We.subscribe(()=>i(We.get()))),[]),[t,We.set]}function _t(t,i){let n=B(0);A(()=>{let a=t.current;if(a===null)return;let s=()=>{a.style.height="auto";let u=a.offsetHeight-a.clientHeight,p=a.closest(".gitp-root"),c=p===null?600:p.getBoundingClientRect().height,m=Math.max(140,Math.round(c*.45)),d=a.scrollHeight+u;a.style.height=`${Math.min(d,m)}px`,a.style.overflowY=d>m?"auto":"hidden"};if(s(),typeof ResizeObserver>"u")return;let o=a.parentElement;if(o===null)return;let h=new ResizeObserver(u=>{let p=u[0];if(p===void 0)return;let c=Math.round(p.contentRect.width);c!==n.current&&(n.current=c,s())});return h.observe(o),()=>h.disconnect()},[t,i])}function Lt(t){return JSON.stringify({provider:t.provider,model:t.model})}function gt(t){if(t===null||typeof t!="object")return null;let i=t;return typeof i.provider!="string"||i.provider===""||typeof i.model!="string"||i.model===""?null:{provider:i.provider,model:i.model}}function Oi(t){try{return gt(JSON.parse(t))}catch{return null}}function O(...t){return t.filter(Boolean).join(" ")}function Ze(t){let i=t.lastIndexOf("/");return i===-1?{dir:"",base:t}:{dir:t.slice(0,i+1),base:t.slice(i+1)}}function ze(t){return typeof t=="string"?t.slice(0,7):""}function ht(t){switch(t){case"A":return"is-added";case"D":return"is-deleted";case"R":return"is-renamed";case"U":return"is-untracked";case"C":return"is-conflict";default:return"is-modified"}}function Bt(t){return String(t??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60)}function ji(t,i){let n=Bt(String(t??"").split(/\r?\n/)[0]);if(n!=="")return n;let a=i?Ze(i).base.replace(/\.[^.]+$/,""):"changes";return`${Bt(a)||"changes"}-changes`.slice(0,60)}function It(t){return t.match(/\s+|[A-Za-z0-9_]+|[^\sA-Za-z0-9_]/g)??[]}function $i(t,i){if(t===i||t.length>2e3||i.length>2e3)return null;let n=It(t),a=It(i),s=0;for(;s<n.length&&s<a.length&&n[s]===a[s];)s+=1;let o=0;for(;o<n.length-s&&o<a.length-s&&n[n.length-1-o]===a[a.length-1-o];)o+=1;return{lPre:n.slice(0,s).join(""),lMid:n.slice(s,n.length-o).join(""),lSuf:o===0?"":n.slice(n.length-o).join(""),rPre:a.slice(0,s).join(""),rMid:a.slice(s,a.length-o).join(""),rSuf:o===0?"":a.slice(a.length-o).join("")}}function Ft(t,i,n){return i===""?e(te.default.Fragment,null,t,n):e(te.default.Fragment,null,t,e("span",{className:"gitp-word"},i),n)}function Ot(t){let i=new Date(t);if(Number.isNaN(i.getTime()))return t;let n=Math.round((i.getTime()-Date.now())/1e3),a=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"});if(Math.abs(n)<60)return a.format(n,"second");let s=Math.round(n/60);if(Math.abs(s)<60)return a.format(s,"minute");let o=Math.round(s/60);if(Math.abs(o)<24)return a.format(o,"hour");let h=Math.round(o/24);return Math.abs(h)<30?a.format(h,"day"):i.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function Wi(t){let i=[],n=[];for(let a of t){let s=i.indexOf(a.hash);s===-1&&(s=i.length,i.push(a.hash));let o=a.parents??[];i[s]=o[0]??null;for(let h=1;h<o.length;h+=1){let u=o[h];u!==void 0&&i.splice(s+h,0,u)}for(;i.length>0&&i[i.length-1]===null;)i.pop();n.push({...a,lane:s,laneCount:Math.max(1,i.length)})}return n}function ge(t){return t==null?"":t instanceof Error?t.message:String(t)}function P({path:t,size:i=16,viewBox:n="0 0 24 24",className:a,filled:s=!1}){return e("svg",{className:a,width:i,height:i,viewBox:n,fill:s?"currentColor":"none",stroke:s?"none":"currentColor",strokeWidth:s?0:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},e("path",{d:t}))}var w={branch:"M6 3v12a3 3 0 0 0 3 3h6M6 9h6a3 3 0 0 0 3-3V3M6 3.5a1 1 0 1 0 0-.1M18 3.5a1 1 0 1 0 0-.1M18 21a1 1 0 1 0 0-.1",changes:"M4 6h16M4 12h10M4 18h13M18 9l3 3-3 3",history:"M3 12a9 9 0 1 0 3-6.7M3 4v5h5M12 7v5l3 2",stash:"M4 8h16M6 8v11a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V8M9 8V5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3M10 12h4",plus:"M12 5v14M5 12h14",minus:"M5 12h14",left:"M19 12H5m0 0l6-6m-6 6l6 6",right:"M5 12h14m0 0l-6-6m6 6l-6 6",refresh:"M20 11a8 8 0 1 0-2.3 5.7M20 4v7h-7",fetch:"M6 15a4 4 0 0 1 .8-7.9 5 5 0 0 1 9.6-1.1A3.5 3.5 0 0 1 17 15M12 11v7m0 0l-3-3m3 3l3-3",pull:"M12 4v11m0 0l-4-4m4 4l4-4M5 20h14",push:"M12 20V9m0 0l-4 4m4-4l4 4M5 4h14",close:"M6 6l12 12M18 6L6 18",chevron:"M6 9l6 6 6-6",chevronUp:"M6 15l6-6 6 6",sparkles:"M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9zM18.5 15l.9 2.1 2.1.9-2.1.9-.9 2.1-.9-2.1-2.1-.9 2.1-.9z",file:"M14 3H7a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V7zM14 3v4h4",code:"M8 7l-5 5 5 5M16 7l5 5-5 5",warning:"M12 3l9 16H3zM12 9v5M12 17v.5",check:"M5 12l5 5L20 7",folder:"M3 6a1 1 0 0 1 1-1h5l2 2h8a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1z",split:"M4 5h16v14H4zM12 5v14",unified:"M4 5h16M4 9h16M4 13h16M4 17h16",search:"M11 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16zM21 21l-4.35-4.35",copy:"M8 4v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7.242a2 2 0 0 0-.602-1.43L16.08 2.5a2 2 0 0 0-1.43-.5H10a2 2 0 0 0-2 2zM4 8H3a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-1",checkAlt:"M20 6L9 17l-5-5",more:"M6 12h.01M12 12h.01M18 12h.01",undo:"M9 14L4 9l5-5M4 9h10a6 6 0 0 1 0 12h-2",revert:"M10 7L5 12l5 5M5 12h9a5 5 0 0 1 5 5",cherry:"M12 17.5m-3.5 0a3.5 3.5 0 1 0 7 0a3.5 3.5 0 1 0 -7 0M7 6.5m-2.5 0a2.5 2.5 0 1 0 5 0a2.5 2.5 0 1 0 -5 0M12 14c0-3 2-5.5 6-7M12 14c-1-2.5-2.5-4-5-5.5",reset:"M3 12a9 9 0 1 0 3-6.7M3 4v5h5M12 8v4l2.5 2"},Ee=20;function Qe({size:t=20}){return e("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"},e("path",{d:"M12 3v18",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round"}),e("path",{d:"M12 12c0-4 3-6 7-6h1",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round"}),e("circle",{cx:12,cy:3.5,r:2.3,fill:"currentColor"}),e("circle",{cx:12,cy:12,r:2.3,fill:"currentColor"}),e("circle",{cx:12,cy:20.5,r:2.3,fill:"currentColor"}))}function Gi({size:t=20}){return e(Qe,{size:t})}var Ui=`
|
|
6
|
+
"use strict";var Si=Object.create;var Je=Object.defineProperty;var Ti=Object.getOwnPropertyDescriptor;var Hi=Object.getOwnPropertyNames;var Ei=Object.getPrototypeOf,Pi=Object.prototype.hasOwnProperty;var Di=(t,i)=>{for(var n in i)Je(t,n,{get:i[n],enumerable:!0})},Dt=(t,i,n,a)=>{if(i&&typeof i=="object"||typeof i=="function")for(let o of Hi(i))!Pi.call(t,o)&&o!==n&&Je(t,o,{get:()=>i[o],enumerable:!(a=Ti(i,o))||a.enumerable});return t};var zi=(t,i,n)=>(n=t!=null?Si(Ei(t)):{},Dt(i||!t||!t.__esModule?Je(n,"default",{value:t,enumerable:!0}):n,t)),Ai=t=>Dt(Je({},"__esModule",{value:!0}),t);var wa={};Di(wa,{apply:()=>xa,inject:()=>ya});module.exports=Ai(wa);var te=zi(require("react"),1),e=te.default.createElement,{useState:w,useEffect:A,useRef:I,useMemo:Ne,useCallback:Qe}=te.default,pt=class extends Error{code;details;constructor(i,n,a){super(n),this.name="GitCallError",this.code=i,this.details=a}};function zt(t){if(!(t instanceof Error)||!("code"in t))return;let{code:i}=t;return typeof i=="string"?i:void 0}function q(t){return t instanceof Error?t:new Error(String(t))}var Te="git",lt="dsh-git",Li="dsh-resource://file/session/",Bi=t=>t.startsWith("/")||/^[A-Za-z]:[/\\]/.test(t)||t.startsWith("\\\\"),Ii=t=>t.replace(/\\/g,"/").replace(/^(?:\.\/)+/,"").split("/").map(i=>encodeURIComponent(i)).join("/"),Ze=(t,i)=>`${Li}${encodeURIComponent(t)}/${Ii(i)}`;function Fi(t,i,n){let a=n.replace(/\\/g,"/");if(!Bi(a))return Ze(t,a);let o=i===void 0?"":i.replace(/\\/g,"/").replace(/\/+$/,"");return o!==""&&a===o?Ze(t,""):o!==""&&a.startsWith(`${o}/`)?Ze(t,a.slice(o.length+1)):Ze(t,a)}function Oi(t){let i=t?.rows??[],n=i.findIndex(a=>a.k!=="ctx");if(n<0)return 1;for(let a=n;a<i.length;a+=1){let o=i[a];if(o!==void 0&&o.r!==null)return o.r}return 1}var ji={panel:"Git","mode.changes":"Changes","mode.log":"History","mode.stash":"Stashes","guide.title":"Git changes","guide.description":"Review, stage, commit, and sync the workspace repository.","section.conflicts":"Conflicts","section.staged":"Staged","section.unstaged":"Unstaged","section.stagedCount":"{count} staged","section.unstagedCount":"{count} changed","section.conflictCount":"{count} unresolved","empty.noChanges":"No changes","empty.noChangesHint":"The working tree matches the last commit.","empty.selectFile":"Select a file to review it","empty.selectFileHint":"The full file is shown on both sides. Nothing is collapsed.","empty.noRepo":"Not a Git repository","empty.noRepoHint":"This workspace is not a repository yet.","empty.init":"Initialize repository","empty.noWorkspace":"No workspace is open","empty.noWorkspaceHint":"Open a workspace, then return to Git.","empty.noHistory":"No commits yet","empty.noHistoryHint":"The first commit will appear here.","empty.noStashes":"No stashes","empty.noStashesHint":"Park work here before switching tasks.","action.stageFile":"Stage file","action.unstageFile":"Unstage file","action.stageAll":"Stage all","action.unstageAll":"Unstage all","ai.action":"AI actions","ai.write":"Write a commit message","ai.branch":"Create a branch and commit","ai.written":"Message written with {model}","action.stageBlock":"Stage block","action.unstageBlock":"Unstage block","action.revertBlock":"Revert block to the staged version","action.refresh":"Refresh","action.back":"Back to changes","action.openEditor":"Open in editor","action.prevChange":"Previous change","action.nextChange":"Next change","action.close":"Close","action.cancel":"Cancel","action.confirm":"Confirm","action.commit":"Commit","action.committing":"Committing","action.branch":"Branch","action.createBranch":"Create branch and commit","action.checkout":"Checkout","action.fetch":"Fetch","action.pull":"Pull","action.push":"Push","action.apply":"Apply","action.pop":"Pop","action.drop":"Drop","action.stash":"Stash changes","action.discard":"Discard changes","action.acceptOurs":"Accept ours","action.acceptTheirs":"Accept theirs","action.retry":"Retry","action.init":"Initialize","action.newBranch":"New branch","action.createAndSwitch":"Create and switch","repo.title":"Repositories","repo.current":"Current repository","repo.workspace":"Workspace folder","repo.pick":"Switch repository","repo.none":"No repository found","repo.initRoot":"New repository at the workspace root","repo.initRootTitle":"Initialize at the workspace root?","repo.initRootBody":"The workspace contains {count} repositories. A repository at the workspace root treats each of them as an untracked folder. Pick one of the repositories instead.","repo.initRootConfirm":"Initialize anyway","action.revert":"Revert block","diff.split":"Split","diff.unified":"Unified","diff.head":"HEAD","diff.staged":"Staged","diff.local":"Local","diff.parent":"Parent","diff.commit":"Commit","diff.binary":"Binary file changed","diff.binaryHint":"{before} to {after}","diff.conflictBanner":"This file has unresolved conflicts. Commit is blocked until you resolve it.","diff.loading":"Loading diff","diff.noChanges":"No changes in this file","diff.fullFile":"Full file","diff.layout":"Diff layout","diff.changes":"Changes in this file","diff.lines":"{count} lines","commit.placeholder":"Describe the change","commit.hintStage":"Stage a file to commit.","commit.hintConflict":"Resolve conflicts before committing.","commit.hintMessage":"Write a commit message.","commit.done":"Committed {hash}","commit.amend":"Amend last commit","commit.noVerify":"Skip hooks","commit.noVerifyHint":"Commit without running Git hooks.","branch.title":"Branch and commit","branch.name":"Branch name","branch.nameHint":"Created from the current HEAD, then the staged changes are committed.","branch.message":"Commit message","branch.created":"Created {branch} and committed","branch.current":"Current branch","branch.local":"Local branches","branch.loading":"Loading branches","branch.none":"No branches","branch.new":"New branch","branch.newTitle":"New branch","branch.newHint":"Created from the current HEAD and checked out. No commit is made.","branch.search":"Search branches","branch.remote":"Remote branches","branch.createdOnly":"Created {branch}","branch.noneMatch":"No branch matches","stash.title":"Stash changes","stash.message":"Stash message","stash.select":"Files to stash","stash.selectHint":"Only the selected files are stashed. Untracked files are included.","stash.default":"WIP","stash.nothing":"No files to stash.","stash.created":"Stashed {count} files","stash.applied":"Applied {ref}","stash.popped":"Popped {ref}","stash.dropped":"Dropped {ref}","stash.dropTitle":"Drop stash","stash.dropBody":"This deletes {ref} permanently. The changes are not applied.","discard.title":"Discard changes?","discard.body":"Every local change in {path} is lost. This cannot be undone.","discard.deleteTitle":"Delete untracked file?","discard.deleteBody":"{path} is untracked. The file is removed from disk. This cannot be undone.","discard.confirm":"Discard changes","discard.deleteConfirm":"Delete file","discard.done":"Discarded changes in {name}","discard.deleted":"Deleted {name}","sync.fetched":"Fetched","sync.pulled":"Pulled","sync.pulledStashed":"Pulled and restored local changes","sync.pulledStashConflict":"Pulled, but some local changes could not be restored. The stash is kept in Stashes.","sync.pushed":"Pushed","sync.ahead":"{count} ahead","sync.behind":"{count} behind","sync.noUpstream":"This branch has no upstream. Push sets one.","sync.none":"Up to date","log.title":"History","log.loading":"Loading history","log.select":"Select a commit","log.files":"Changed files","log.noFiles":"No file changes","log.author":"Author","log.date":"Date","log.parent":"Parent","log.message":"Message","history.actions":"Commit actions","history.copy":"Copy commit hash","history.undo":"Undo last commit","history.undoHint":"Moves HEAD back and keeps the change staged.","history.revert":"Revert commit","history.revertHint":"Stages the inverse change with a revert message.","history.cherryPick":"Cherry-pick commit","history.cherryPickHint":"Applies the commit here and commits it.","history.reset":"Reset branch to here","history.resetHint":"Moves this branch to the selected commit.","history.blockedOperation":"Finish the current operation first.","history.blockedNotHead":"Only the last commit can be undone.","history.blockedDetached":"Check out a branch first.","history.blockedNoParent":"The first commit cannot be undone.","history.blockedPushed":"This commit is already on the upstream branch. Revert it instead.","history.blockedMerge":"Merge commits are not supported here.","history.blockedStaged":"Commit or unstage the staged files first.","history.blockedContained":"Already in this branch.","history.blockedConflict":"Resolve the conflicts first.","history.undoTitle":"Undo the last commit?","history.undoBody":"The commit leaves the branch and its changes stay staged, so you can edit and commit again.","history.undoAction":"Undo commit","history.revertTitle":"Revert this commit?","history.revertBody":"A new set of changes that reverses this commit is staged with a generated message. The commit stays in history.","history.revertAction":"Revert commit","history.resetTitle":"Reset this branch?","history.resetBody":"This branch moves to {hash}. Choose what happens to the changes after it.","history.resetModeSoft":"Soft","history.resetModeSoftHint":"Keep the changes staged for a new commit.","history.resetModeMixed":"Mixed","history.resetModeMixedHint":"Keep the changes in the working tree, unstaged.","history.resetModeHard":"Hard","history.resetModeHardHint":"Discard the commits and their changes.","history.resetHardWarning":"Hard reset discards every local change after this commit. This cannot be undone.","history.resetAction":"Reset branch","history.undone":"Commit undone. Changes are staged.","history.reverted":"Revert ready. Review it, then commit.","history.revertConflicts":"Revert stopped with conflicts. Resolve them, then commit.","history.picked":"Cherry-picked as {hash}","history.resetDone":"Branch reset to {hash}","status.loading":"Reading repository","status.detached":"Detached HEAD","error.title":"Git action failed","error.notInstalled":"Git is not installed","error.notInstalledHint":"Install Git and make it available on PATH, then refresh.","confirm.revertTitle":"Revert this block?","confirm.revertBody":"The local block is replaced by the staged version. This working tree change is lost.","confirm.checkoutTitle":"Switch branch?","confirm.checkoutBody":"Local changes are carried over when Git can keep them, otherwise the checkout is refused.","confirm.yesRevert":"Revert block","confirm.yesCheckout":"Switch branch","meta.binary":"binary","meta.blocks":"{count} blocks","meta.add":"{count} added","meta.del":"{count} deleted","filter.placeholder":"Filter files","filter.clear":"Clear filter","meta.partial":"partial","meta.partialHint":"Some changes in this file are staged","commit.stagedSummary":"{count} staged","commit.shortcut":"{key}+Enter to commit","diff.added":"Added","diff.removed":"Removed","diff.blockCount":"{count} changes","diff.blockCountOne":"1 change","stash.applyHint":"Apply the changes and keep the stash","stash.popHint":"Apply the changes and delete the stash","stash.dropHint":"Delete the stash","filter.empty":'No files match "{filter}"',"action.copyHash":"Copy commit hash","action.copied":"Copied!","diff.unstaged":"Unstaged","stash.selectAll":"Select all","stash.deselectAll":"Deselect all","header.label":"Git panel","settings.section":"Git","settings.model":"AI model","settings.modelHint":"Used by the commit message actions. The default follows the Composer selection, including later changes.","settings.modelSame":"Same as Composer","settings.modelEmpty":"No models are available in this build.","settings.modelFailed":"The model list could not be read.","settings.instruction":"Commit instructions","settings.instructionHint":"These lines shape the wording. The title line type(scope): summary stays required; a short body is welcome.","settings.instructionReset":"Restore default","settings.instructionFailed":"The default instructions could not be read.","command.toggle":"Open or collapse the Git panel","command.commit":"Commit staged changes","command.writeMessage":"Write the commit message with AI","command.stageAll":"Stage all changes","command.openFirst":"Open the Git panel first","command.nothingToStage":"No changed files to stage","command.notReady":"Stage a file and write a message first","split.files":"Resize the file list","split.commits":"Resize the commit list"},$i={panel:"Git","mode.changes":"\u66F4\u6539","mode.log":"\u5386\u53F2","mode.stash":"\u8D2E\u85CF","guide.title":"Git \u66F4\u6539","guide.description":"\u67E5\u770B\u3001\u6682\u5B58\u3001\u63D0\u4EA4\u5E76\u540C\u6B65\u5DE5\u4F5C\u533A\u4ED3\u5E93\u3002","section.conflicts":"\u51B2\u7A81","section.staged":"\u5DF2\u6682\u5B58","section.unstaged":"\u672A\u6682\u5B58","section.stagedCount":"\u5DF2\u6682\u5B58 {count}","section.unstagedCount":"\u5DF2\u66F4\u6539 {count}","section.conflictCount":"\u672A\u89E3\u51B3 {count}","empty.noChanges":"\u6CA1\u6709\u66F4\u6539","empty.noChangesHint":"\u5DE5\u4F5C\u533A\u4E0E\u6700\u8FD1\u4E00\u6B21\u63D0\u4EA4\u4E00\u81F4\u3002","empty.selectFile":"\u9009\u62E9\u4E00\u4E2A\u6587\u4EF6\u67E5\u770B\u66F4\u6539","empty.selectFileHint":"\u4E24\u4FA7\u90FD\u663E\u793A\u5B8C\u6574\u6587\u4EF6\uFF0C\u4E0D\u4F1A\u6298\u53E0\u3002","empty.noRepo":"\u4E0D\u662F Git \u4ED3\u5E93","empty.noRepoHint":"\u5F53\u524D\u5DE5\u4F5C\u533A\u8FD8\u4E0D\u662F\u4ED3\u5E93\u3002","empty.init":"\u521D\u59CB\u5316\u4ED3\u5E93","empty.noWorkspace":"\u6CA1\u6709\u6253\u5F00\u7684\u5DE5\u4F5C\u533A","empty.noWorkspaceHint":"\u6253\u5F00\u4E00\u4E2A\u5DE5\u4F5C\u533A\uFF0C\u7136\u540E\u56DE\u5230 Git\u3002","empty.noHistory":"\u8FD8\u6CA1\u6709\u63D0\u4EA4","empty.noHistoryHint":"\u7B2C\u4E00\u6B21\u63D0\u4EA4\u4F1A\u51FA\u73B0\u5728\u8FD9\u91CC\u3002","empty.noStashes":"\u6CA1\u6709\u8D2E\u85CF","empty.noStashesHint":"\u5207\u6362\u4EFB\u52A1\u524D\u53EF\u4EE5\u628A\u5DE5\u4F5C\u653E\u5728\u8FD9\u91CC\u3002","action.stageFile":"\u6682\u5B58\u6587\u4EF6","action.unstageFile":"\u53D6\u6D88\u6682\u5B58\u6587\u4EF6","action.stageAll":"\u5168\u90E8\u6682\u5B58","action.unstageAll":"\u5168\u90E8\u53D6\u6D88\u6682\u5B58","ai.action":"AI \u64CD\u4F5C","ai.write":"\u751F\u6210\u63D0\u4EA4\u4FE1\u606F","ai.branch":"\u521B\u5EFA\u5206\u652F\u5E76\u63D0\u4EA4","ai.written":"\u5DF2\u7531 {model} \u751F\u6210\u63D0\u4EA4\u4FE1\u606F","action.stageBlock":"\u6682\u5B58\u533A\u5757","action.unstageBlock":"\u53D6\u6D88\u6682\u5B58\u533A\u5757","action.revertBlock":"\u5C06\u533A\u5757\u8FD8\u539F\u4E3A\u5DF2\u6682\u5B58\u7248\u672C","action.refresh":"\u5237\u65B0","action.back":"\u8FD4\u56DE\u66F4\u6539","action.openEditor":"\u5728\u7F16\u8F91\u5668\u4E2D\u6253\u5F00","action.prevChange":"\u4E0A\u4E00\u4E2A\u66F4\u6539","action.nextChange":"\u4E0B\u4E00\u4E2A\u66F4\u6539","action.close":"\u5173\u95ED","action.cancel":"\u53D6\u6D88","action.confirm":"\u786E\u8BA4","action.commit":"\u63D0\u4EA4","action.committing":"\u6B63\u5728\u63D0\u4EA4","action.branch":"\u5206\u652F","action.createBranch":"\u521B\u5EFA\u5206\u652F\u5E76\u63D0\u4EA4","action.checkout":"\u5207\u6362","action.fetch":"\u83B7\u53D6","action.pull":"\u62C9\u53D6","action.push":"\u63A8\u9001","action.apply":"\u5E94\u7528","action.pop":"\u5F39\u51FA","action.drop":"\u5220\u9664","action.stash":"\u8D2E\u85CF\u66F4\u6539","action.discard":"\u4E22\u5F03\u66F4\u6539","action.acceptOurs":"\u91C7\u7528\u672C\u5730","action.acceptTheirs":"\u91C7\u7528\u8FDC\u7AEF","action.retry":"\u91CD\u8BD5","action.init":"\u521D\u59CB\u5316","action.newBranch":"\u65B0\u5EFA\u5206\u652F","action.createAndSwitch":"\u521B\u5EFA\u5E76\u5207\u6362","repo.title":"\u4ED3\u5E93","repo.current":"\u5F53\u524D\u4ED3\u5E93","repo.workspace":"\u5DE5\u4F5C\u533A\u76EE\u5F55","repo.pick":"\u5207\u6362\u4ED3\u5E93","repo.none":"\u672A\u627E\u5230\u4ED3\u5E93","repo.initRoot":"\u5728\u5DE5\u4F5C\u533A\u6839\u76EE\u5F55\u65B0\u5EFA\u4ED3\u5E93","repo.initRootTitle":"\u5728\u6839\u76EE\u5F55\u521D\u59CB\u5316\uFF1F","repo.initRootBody":"\u5DE5\u4F5C\u533A\u5305\u542B {count} \u4E2A\u4ED3\u5E93\u3002\u5728\u6839\u76EE\u5F55\u521D\u59CB\u5316\u4F1A\u628A\u5B83\u4EEC\u5F53\u6210\u672A\u8DDF\u8E2A\u76EE\u5F55\u3002\u8BF7\u6539\u7528\u4ED3\u5E93\u9009\u62E9\u5668\u3002","repo.initRootConfirm":"\u4ECD\u8981\u521D\u59CB\u5316","action.revert":"\u8FD8\u539F\u533A\u5757","diff.split":"\u5E76\u6392","diff.unified":"\u7EDF\u4E00","diff.head":"HEAD","diff.staged":"\u5DF2\u6682\u5B58","diff.local":"\u672C\u5730","diff.parent":"\u7236\u63D0\u4EA4","diff.commit":"\u63D0\u4EA4","diff.binary":"\u4E8C\u8FDB\u5236\u6587\u4EF6\u5DF2\u66F4\u6539","diff.binaryHint":"{before} \u5230 {after}","diff.conflictBanner":"\u6B64\u6587\u4EF6\u6709\u672A\u89E3\u51B3\u7684\u51B2\u7A81\u3002\u89E3\u51B3\u524D\u65E0\u6CD5\u63D0\u4EA4\u3002","diff.loading":"\u6B63\u5728\u8BFB\u53D6\u5DEE\u5F02","diff.noChanges":"\u6B64\u6587\u4EF6\u6CA1\u6709\u66F4\u6539","diff.fullFile":"\u5B8C\u6574\u6587\u4EF6","diff.layout":"\u5DEE\u5F02\u5E03\u5C40","diff.changes":"\u6B64\u6587\u4EF6\u4E2D\u7684\u66F4\u6539","diff.lines":"{count} \u884C","commit.placeholder":"\u63CF\u8FF0\u8FD9\u6B21\u66F4\u6539","commit.hintStage":"\u5148\u6682\u5B58\u4E00\u4E2A\u6587\u4EF6\u3002","commit.hintConflict":"\u8BF7\u5148\u89E3\u51B3\u51B2\u7A81\u3002","commit.hintMessage":"\u5199\u4E00\u6761\u63D0\u4EA4\u4FE1\u606F\u3002","commit.done":"\u5DF2\u63D0\u4EA4 {hash}","commit.amend":"\u4FEE\u8865\u4E0A\u6B21\u63D0\u4EA4","commit.noVerify":"\u8DF3\u8FC7\u94A9\u5B50","commit.noVerifyHint":"\u63D0\u4EA4\u65F6\u4E0D\u8FD0\u884C Git \u94A9\u5B50\u3002","branch.title":"\u5206\u652F\u5E76\u63D0\u4EA4","branch.name":"\u5206\u652F\u540D","branch.nameHint":"\u4ECE\u5F53\u524D HEAD \u521B\u5EFA\u5206\u652F\uFF0C\u7136\u540E\u63D0\u4EA4\u5DF2\u6682\u5B58\u7684\u66F4\u6539\u3002","branch.message":"\u63D0\u4EA4\u4FE1\u606F","branch.created":"\u5DF2\u521B\u5EFA {branch} \u5E76\u63D0\u4EA4","branch.current":"\u5F53\u524D\u5206\u652F","branch.local":"\u672C\u5730\u5206\u652F","branch.loading":"\u6B63\u5728\u8BFB\u53D6\u5206\u652F","branch.none":"\u6CA1\u6709\u5206\u652F","branch.new":"\u65B0\u5EFA\u5206\u652F","branch.newTitle":"\u65B0\u5EFA\u5206\u652F","branch.newHint":"\u4ECE\u5F53\u524D HEAD \u521B\u5EFA\u5E76\u5207\u6362\uFF0C\u4E0D\u4EA7\u751F\u63D0\u4EA4\u3002","branch.search":"\u641C\u7D22\u5206\u652F","branch.remote":"\u8FDC\u7AEF\u5206\u652F","branch.createdOnly":"\u5DF2\u521B\u5EFA {branch}","branch.noneMatch":"\u6CA1\u6709\u5339\u914D\u7684\u5206\u652F","stash.title":"\u8D2E\u85CF\u66F4\u6539","stash.message":"\u8D2E\u85CF\u4FE1\u606F","stash.select":"\u8981\u8D2E\u85CF\u7684\u6587\u4EF6","stash.selectHint":"\u53EA\u8D2E\u85CF\u9009\u4E2D\u7684\u6587\u4EF6\u3002\u672A\u8DDF\u8E2A\u6587\u4EF6\u4E5F\u4F1A\u5305\u542B\u3002","stash.default":"WIP","stash.nothing":"\u6CA1\u6709\u53EF\u8D2E\u85CF\u7684\u6587\u4EF6\u3002","stash.created":"\u5DF2\u8D2E\u85CF {count} \u4E2A\u6587\u4EF6","stash.applied":"\u5DF2\u5E94\u7528 {ref}","stash.popped":"\u5DF2\u5F39\u51FA {ref}","stash.dropped":"\u5DF2\u5220\u9664 {ref}","stash.dropTitle":"\u5220\u9664\u8D2E\u85CF","stash.dropBody":"\u8FD9\u4F1A\u6C38\u4E45\u5220\u9664 {ref}\uFF0C\u4E14\u4E0D\u4F1A\u5E94\u7528\u5176\u4E2D\u7684\u66F4\u6539\u3002","discard.title":"\u4E22\u5F03\u66F4\u6539\uFF1F","discard.body":"{path} \u7684\u6240\u6709\u672C\u5730\u66F4\u6539\u90FD\u4F1A\u4E22\u5931\u3002\u6B64\u64CD\u4F5C\u65E0\u6CD5\u64A4\u9500\u3002","discard.deleteTitle":"\u5220\u9664\u672A\u8DDF\u8E2A\u6587\u4EF6\uFF1F","discard.deleteBody":"{path} \u672A\u88AB\u8DDF\u8E2A\u3002\u6587\u4EF6\u5C06\u4ECE\u78C1\u76D8\u5220\u9664\u3002\u6B64\u64CD\u4F5C\u65E0\u6CD5\u64A4\u9500\u3002","discard.confirm":"\u4E22\u5F03\u66F4\u6539","discard.deleteConfirm":"\u5220\u9664\u6587\u4EF6","discard.done":"\u5DF2\u4E22\u5F03 {name} \u7684\u66F4\u6539","discard.deleted":"\u5DF2\u5220\u9664 {name}","sync.fetched":"\u5DF2\u83B7\u53D6","sync.pulled":"\u5DF2\u62C9\u53D6","sync.pulledStashed":"\u5DF2\u62C9\u53D6\u5E76\u6062\u590D\u672C\u5730\u66F4\u6539","sync.pulledStashConflict":"\u5DF2\u62C9\u53D6\uFF0C\u4F46\u90E8\u5206\u672C\u5730\u66F4\u6539\u672A\u80FD\u6062\u590D\u3002\u66F4\u6539\u4ECD\u4FDD\u7559\u5728\u201C\u8D2E\u85CF\u201D\u4E2D\u3002","sync.pushed":"\u5DF2\u63A8\u9001","sync.ahead":"\u9886\u5148 {count}","sync.behind":"\u843D\u540E {count}","sync.noUpstream":"\u6B64\u5206\u652F\u6CA1\u6709\u4E0A\u6E38\uFF0C\u63A8\u9001\u65F6\u4F1A\u8BBE\u7F6E\u3002","sync.none":"\u5DF2\u662F\u6700\u65B0","log.title":"\u5386\u53F2","log.loading":"\u6B63\u5728\u8BFB\u53D6\u5386\u53F2","log.select":"\u9009\u62E9\u4E00\u4E2A\u63D0\u4EA4","log.files":"\u66F4\u6539\u7684\u6587\u4EF6","log.noFiles":"\u6CA1\u6709\u6587\u4EF6\u66F4\u6539","log.author":"\u4F5C\u8005","log.date":"\u65E5\u671F","log.parent":"\u7236\u63D0\u4EA4","log.message":"\u4FE1\u606F","history.actions":"\u63D0\u4EA4\u64CD\u4F5C","history.copy":"\u590D\u5236\u63D0\u4EA4\u54C8\u5E0C","history.undo":"\u64A4\u9500\u6700\u540E\u4E00\u6B21\u63D0\u4EA4","history.undoHint":"HEAD \u56DE\u9000\uFF0C\u66F4\u6539\u4FDD\u7559\u5728\u6682\u5B58\u533A\u3002","history.revert":"\u8FD8\u539F\u63D0\u4EA4","history.revertHint":"\u751F\u6210\u53CD\u5411\u66F4\u6539\u5E76\u5199\u5165\u8FD8\u539F\u4FE1\u606F\u3002","history.cherryPick":"\u62E3\u9009\u63D0\u4EA4","history.cherryPickHint":"\u5728\u6B64\u5206\u652F\u5E94\u7528\u5E76\u63D0\u4EA4\u8BE5\u63D0\u4EA4\u3002","history.reset":"\u5C06\u5206\u652F\u91CD\u7F6E\u5230\u6B64\u5904","history.resetHint":"\u628A\u5F53\u524D\u5206\u652F\u79FB\u52A8\u5230\u6240\u9009\u63D0\u4EA4\u3002","history.blockedOperation":"\u8BF7\u5148\u5B8C\u6210\u5F53\u524D\u64CD\u4F5C\u3002","history.blockedNotHead":"\u53EA\u80FD\u64A4\u9500\u6700\u540E\u4E00\u6B21\u63D0\u4EA4\u3002","history.blockedDetached":"\u8BF7\u5148\u5207\u6362\u5230\u5206\u652F\u3002","history.blockedNoParent":"\u7B2C\u4E00\u4E2A\u63D0\u4EA4\u65E0\u6CD5\u64A4\u9500\u3002","history.blockedPushed":"\u8BE5\u63D0\u4EA4\u5DF2\u5728\u4E0A\u6E38\u5206\u652F\u4E0A\uFF0C\u8BF7\u6539\u7528\u8FD8\u539F\u3002","history.blockedMerge":"\u6B64\u5904\u4E0D\u652F\u6301\u5408\u5E76\u63D0\u4EA4\u3002","history.blockedStaged":"\u8BF7\u5148\u63D0\u4EA4\u6216\u53D6\u6D88\u6682\u5B58\u5DF2\u6682\u5B58\u7684\u6587\u4EF6\u3002","history.blockedContained":"\u5DF2\u5728\u5F53\u524D\u5206\u652F\u4E2D\u3002","history.blockedConflict":"\u8BF7\u5148\u89E3\u51B3\u51B2\u7A81\u3002","history.undoTitle":"\u64A4\u9500\u6700\u540E\u4E00\u6B21\u63D0\u4EA4\uFF1F","history.undoBody":"\u8BE5\u63D0\u4EA4\u4F1A\u79BB\u5F00\u5206\u652F\uFF0C\u66F4\u6539\u4FDD\u7559\u5728\u6682\u5B58\u533A\uFF0C\u53EF\u7EE7\u7EED\u7F16\u8F91\u5E76\u91CD\u65B0\u63D0\u4EA4\u3002","history.undoAction":"\u64A4\u9500\u63D0\u4EA4","history.revertTitle":"\u8FD8\u539F\u8FD9\u4E2A\u63D0\u4EA4\uFF1F","history.revertBody":"\u4F1A\u6682\u5B58\u53CD\u5411\u66F4\u6539\u5E76\u586B\u5165\u8FD8\u539F\u4FE1\u606F\uFF0C\u539F\u63D0\u4EA4\u4ECD\u4FDD\u7559\u5728\u5386\u53F2\u4E2D\u3002","history.revertAction":"\u8FD8\u539F\u63D0\u4EA4","history.resetTitle":"\u91CD\u7F6E\u8FD9\u4E2A\u5206\u652F\uFF1F","history.resetBody":"\u5206\u652F\u4F1A\u79FB\u52A8\u5230 {hash}\u3002\u9009\u62E9\u5176\u540E\u66F4\u6539\u7684\u5904\u7406\u65B9\u5F0F\u3002","history.resetModeSoft":"\u8F6F\u91CD\u7F6E","history.resetModeSoftHint":"\u66F4\u6539\u4FDD\u7559\u5728\u6682\u5B58\u533A\uFF0C\u53EF\u91CD\u65B0\u63D0\u4EA4\u3002","history.resetModeMixed":"\u6DF7\u5408\u91CD\u7F6E","history.resetModeMixedHint":"\u66F4\u6539\u4FDD\u7559\u5728\u5DE5\u4F5C\u533A\uFF0C\u4E0D\u6682\u5B58\u3002","history.resetModeHard":"\u786C\u91CD\u7F6E","history.resetModeHardHint":"\u4E22\u5F03\u8FD9\u4E9B\u63D0\u4EA4\u53CA\u5176\u66F4\u6539\u3002","history.resetHardWarning":"\u786C\u91CD\u7F6E\u4F1A\u4E22\u5F03\u8BE5\u63D0\u4EA4\u4E4B\u540E\u7684\u5168\u90E8\u672C\u5730\u66F4\u6539\uFF0C\u4E14\u65E0\u6CD5\u64A4\u9500\u3002","history.resetAction":"\u91CD\u7F6E\u5206\u652F","history.undone":"\u5DF2\u64A4\u9500\u63D0\u4EA4\uFF0C\u66F4\u6539\u5DF2\u6682\u5B58\u3002","history.reverted":"\u8FD8\u539F\u5DF2\u5C31\u7EEA\uFF0C\u8BF7\u68C0\u67E5\u540E\u63D0\u4EA4\u3002","history.revertConflicts":"\u8FD8\u539F\u9047\u5230\u51B2\u7A81\uFF0C\u8BF7\u89E3\u51B3\u540E\u63D0\u4EA4\u3002","history.picked":"\u5DF2\u62E3\u9009\u4E3A {hash}","history.resetDone":"\u5206\u652F\u5DF2\u91CD\u7F6E\u5230 {hash}","status.loading":"\u6B63\u5728\u8BFB\u53D6\u4ED3\u5E93","status.detached":"\u6E38\u79BB HEAD","error.title":"Git \u64CD\u4F5C\u5931\u8D25","error.notInstalled":"\u672A\u5B89\u88C5 Git","error.notInstalledHint":"\u5B89\u88C5 Git \u5E76\u786E\u4FDD\u5B83\u5728 PATH \u4E2D\uFF0C\u7136\u540E\u5237\u65B0\u3002","confirm.revertTitle":"\u8FD8\u539F\u8FD9\u4E2A\u533A\u5757\uFF1F","confirm.revertBody":"\u672C\u5730\u533A\u5757\u4F1A\u88AB\u5DF2\u6682\u5B58\u7248\u672C\u66FF\u6362\uFF0C\u8FD9\u90E8\u5206\u5DE5\u4F5C\u533A\u66F4\u6539\u4F1A\u4E22\u5931\u3002","confirm.checkoutTitle":"\u5207\u6362\u5206\u652F\uFF1F","confirm.checkoutBody":"\u5982\u679C Git \u80FD\u4FDD\u7559\uFF0C\u672C\u5730\u66F4\u6539\u4F1A\u5E26\u5230\u65B0\u5206\u652F\uFF0C\u5426\u5219\u4F1A\u62D2\u7EDD\u5207\u6362\u3002","confirm.yesRevert":"\u8FD8\u539F\u533A\u5757","confirm.yesCheckout":"\u5207\u6362\u5206\u652F","meta.binary":"\u4E8C\u8FDB\u5236","meta.blocks":"{count} \u4E2A\u533A\u5757","meta.add":"\u65B0\u589E {count}","meta.del":"\u5220\u9664 {count}","filter.placeholder":"\u8FC7\u6EE4\u6587\u4EF6","filter.clear":"\u6E05\u9664\u8FC7\u6EE4","meta.partial":"\u90E8\u5206","meta.partialHint":"\u6B64\u6587\u4EF6\u7684\u90E8\u5206\u66F4\u6539\u5DF2\u6682\u5B58","commit.stagedSummary":"\u5DF2\u6682\u5B58 {count} \u4E2A","commit.shortcut":"\u6309 {key}+Enter \u63D0\u4EA4","diff.added":"\u65B0\u589E","diff.removed":"\u5220\u9664","diff.blockCount":"{count} \u5904\u66F4\u6539","diff.blockCountOne":"1 \u5904\u66F4\u6539","stash.applyHint":"\u5E94\u7528\u66F4\u6539\u5E76\u4FDD\u7559\u8D2E\u85CF","stash.popHint":"\u5E94\u7528\u66F4\u6539\u5E76\u5220\u9664\u8D2E\u85CF","stash.dropHint":"\u5220\u9664\u8D2E\u85CF","filter.empty":'\u6CA1\u6709\u6587\u4EF6\u5339\u914D "{filter}"',"action.copyHash":"\u590D\u5236\u63D0\u4EA4\u54C8\u5E0C","action.copied":"\u5DF2\u590D\u5236\uFF01","diff.unstaged":"\u672A\u6682\u5B58","stash.selectAll":"\u5168\u9009","stash.deselectAll":"\u5168\u4E0D\u9009","header.label":"Git \u9762\u677F","settings.section":"Git","settings.model":"AI \u6A21\u578B","settings.modelHint":"\u7528\u4E8E\u751F\u6210\u63D0\u4EA4\u4FE1\u606F\u3002\u9ED8\u8BA4\u8DDF\u968F\u8F93\u5165\u6846\u9009\u62E9\u7684\u6A21\u578B\uFF0C\u4E4B\u540E\u5207\u6362\u4E5F\u4F1A\u8DDF\u968F\u3002","settings.modelSame":"\u4E0E\u8F93\u5165\u6846\u76F8\u540C","settings.modelEmpty":"\u6B64\u7248\u672C\u6CA1\u6709\u53EF\u7528\u6A21\u578B\u3002","settings.modelFailed":"\u65E0\u6CD5\u8BFB\u53D6\u6A21\u578B\u5217\u8868\u3002","settings.instruction":"\u63D0\u4EA4\u4FE1\u606F\u6307\u4EE4","settings.instructionHint":"\u8FD9\u4E9B\u5185\u5BB9\u51B3\u5B9A\u63AA\u8F9E\uFF0C\u6807\u9898\u884C type(scope): \u6458\u8981\u59CB\u7EC8\u5FC5\u586B\uFF0C\u53EF\u4EE5\u518D\u5199\u4E00\u6BB5\u8BF4\u660E\u3002","settings.instructionReset":"\u6062\u590D\u9ED8\u8BA4","settings.instructionFailed":"\u65E0\u6CD5\u8BFB\u53D6\u9ED8\u8BA4\u6307\u4EE4\u3002","command.toggle":"\u6253\u5F00\u6216\u6536\u8D77 Git \u9762\u677F","command.commit":"\u63D0\u4EA4\u5DF2\u6682\u5B58\u7684\u66F4\u6539","command.writeMessage":"\u7528 AI \u5199\u63D0\u4EA4\u4FE1\u606F","command.stageAll":"\u6682\u5B58\u5168\u90E8\u66F4\u6539","command.openFirst":"\u8BF7\u5148\u6253\u5F00 Git \u9762\u677F","command.nothingToStage":"\u6CA1\u6709\u53EF\u6682\u5B58\u7684\u66F4\u6539","command.notReady":"\u8BF7\u5148\u6682\u5B58\u6587\u4EF6\u5E76\u586B\u5199\u63D0\u4EA4\u4FE1\u606F","split.files":"\u8C03\u6574\u6587\u4EF6\u5217\u8868\u5BBD\u5EA6","split.commits":"\u8C03\u6574\u63D0\u4EA4\u5217\u8868\u5BBD\u5EA6"},At="dsh-git.layout",Lt="dsh-git.layout.compact",We="dsh-git.repo.";function Ve(t,i){try{return window.localStorage.getItem(t)??i}catch{return i}}function He(t,i){try{window.localStorage.setItem(t,i)}catch{}}var Wi=/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent)?"\u2318":"Ctrl",Bt=new Map;function Kt(t){let i=Bt.get(t);if(i===void 0){let n=new Set,a=!1;i={hook:{getSnapshot:()=>a,subscribe(o){return n.add(o),()=>{n.delete(o)}}},set(o){if(o!==a){a=o;for(let r of[...n])r()}}},Bt.set(t,i)}return i}var _t="dsh-git.preferences.v1";function Gi(){let t={model:null,instruction:""},i=Ve(_t,"");if(i==="")return t;try{let n=JSON.parse(i),a=n!==null&&typeof n=="object"?n:{};return{model:mt(a.model),instruction:typeof a.instruction=="string"?a.instruction:""}}catch{return t}}var ut=(()=>{let t=Gi(),i=new Set;return{hook:{getSnapshot:()=>t,subscribe(n){return i.add(n),()=>{i.delete(n)}}},set(n){t={model:mt(n.model),instruction:typeof n.instruction=="string"?n.instruction:""},He(_t,JSON.stringify(t));for(let a of[...i])a()}}})(),qt="dsh-git.split",gt=320,Fe=220,It=280,Yt=1e4,Ft=16;function Vi(){let t=Number.parseInt(Ve(qt,""),10);return Number.isFinite(t)?Math.min(Math.max(t,Fe),Yt):gt}var Ge=(()=>{let t=Vi(),i=new Set;return{get:()=>t,subscribe(n){return i.add(n),()=>{i.delete(n)}},set(n){let a=Math.round(n);if(!(!Number.isFinite(a)||a===t)){t=Math.min(Math.max(a,Fe),Yt),He(qt,String(t));for(let o of[...i])o()}}}})();function Xt(){let[t,i]=w(Ge.get);return A(()=>(i(Ge.get()),Ge.subscribe(()=>i(Ge.get()))),[]),[t,Ge.set]}function Jt(t,i){let n=I(0);A(()=>{let a=t.current;if(a===null)return;let o=()=>{a.style.height="auto";let p=a.offsetHeight-a.clientHeight,d=a.closest(".gitp-root"),l=d===null?600:d.getBoundingClientRect().height,h=Math.max(140,Math.round(l*.45)),c=a.scrollHeight+p;a.style.height=`${Math.min(c,h)}px`,a.style.overflowY=c>h?"auto":"hidden"};if(o(),typeof ResizeObserver>"u")return;let r=a.parentElement;if(r===null)return;let g=new ResizeObserver(p=>{let d=p[0];if(d===void 0)return;let l=Math.round(d.contentRect.width);l!==n.current&&(n.current=l,o())});return g.observe(r),()=>g.disconnect()},[t,i])}function Ot(t){return JSON.stringify({provider:t.provider,model:t.model})}function mt(t){if(t===null||typeof t!="object")return null;let i=t;return typeof i.provider!="string"||i.provider===""||typeof i.model!="string"||i.model===""?null:{provider:i.provider,model:i.model}}function Ui(t){try{return mt(JSON.parse(t))}catch{return null}}function j(...t){return t.filter(Boolean).join(" ")}function Ue(t){let i=t.lastIndexOf("/");return i===-1?{dir:"",base:t}:{dir:t.slice(0,i+1),base:t.slice(i+1)}}function Pe(t){return typeof t=="string"?t.slice(0,7):""}function ft(t){switch(t){case"A":return"is-added";case"D":return"is-deleted";case"R":return"is-renamed";case"U":return"is-untracked";case"C":return"is-conflict";default:return"is-modified"}}function jt(t){return String(t??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60)}function Ki(t,i){let n=jt(String(t??"").split(/\r?\n/)[0]);if(n!=="")return n;let a=i?Ue(i).base.replace(/\.[^.]+$/,""):"changes";return`${jt(a)||"changes"}-changes`.slice(0,60)}function $t(t){return t.match(/\s+|[A-Za-z0-9_]+|[^\sA-Za-z0-9_]/g)??[]}function _i(t,i){if(t===i||t.length>2e3||i.length>2e3)return null;let n=$t(t),a=$t(i),o=0;for(;o<n.length&&o<a.length&&n[o]===a[o];)o+=1;let r=0;for(;r<n.length-o&&r<a.length-o&&n[n.length-1-r]===a[a.length-1-r];)r+=1;return{lPre:n.slice(0,o).join(""),lMid:n.slice(o,n.length-r).join(""),lSuf:r===0?"":n.slice(n.length-r).join(""),rPre:a.slice(0,o).join(""),rMid:a.slice(o,a.length-r).join(""),rSuf:r===0?"":a.slice(a.length-r).join("")}}function Wt(t,i,n){return i===""?e(te.default.Fragment,null,t,n):e(te.default.Fragment,null,t,e("span",{className:"gitp-word"},i),n)}function Gt(t){let i=new Date(t);if(Number.isNaN(i.getTime()))return t;let n=Math.round((i.getTime()-Date.now())/1e3),a=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"});if(Math.abs(n)<60)return a.format(n,"second");let o=Math.round(n/60);if(Math.abs(o)<60)return a.format(o,"minute");let r=Math.round(o/60);if(Math.abs(r)<24)return a.format(r,"hour");let g=Math.round(r/24);return Math.abs(g)<30?a.format(g,"day"):i.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function qi(t){let i=[],n=[];for(let a of t){let o=i.indexOf(a.hash);o===-1&&(o=i.length,i.push(a.hash));let r=a.parents??[];i[o]=r[0]??null;for(let g=1;g<r.length;g+=1){let p=r[g];p!==void 0&&i.splice(o+g,0,p)}for(;i.length>0&&i[i.length-1]===null;)i.pop();n.push({...a,lane:o,laneCount:Math.max(1,i.length)})}return n}function fe(t){return t==null?"":t instanceof Error?t.message:String(t)}function H({path:t,size:i=16,viewBox:n="0 0 24 24",className:a,filled:o=!1}){return e("svg",{className:a,width:i,height:i,viewBox:n,fill:o?"currentColor":"none",stroke:o?"none":"currentColor",strokeWidth:o?0:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},e("path",{d:t}))}var k={branch:"M6 3v12a3 3 0 0 0 3 3h6M6 9h6a3 3 0 0 0 3-3V3M6 3.5a1 1 0 1 0 0-.1M18 3.5a1 1 0 1 0 0-.1M18 21a1 1 0 1 0 0-.1",changes:"M4 6h16M4 12h10M4 18h13M18 9l3 3-3 3",history:"M3 12a9 9 0 1 0 3-6.7M3 4v5h5M12 7v5l3 2",stash:"M4 8h16M6 8v11a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V8M9 8V5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3M10 12h4",plus:"M12 5v14M5 12h14",minus:"M5 12h14",left:"M19 12H5m0 0l6-6m-6 6l6 6",right:"M5 12h14m0 0l-6-6m6 6l-6 6",refresh:"M20 11a8 8 0 1 0-2.3 5.7M20 4v7h-7",fetch:"M6 15a4 4 0 0 1 .8-7.9 5 5 0 0 1 9.6-1.1A3.5 3.5 0 0 1 17 15M12 11v7m0 0l-3-3m3 3l3-3",pull:"M12 4v11m0 0l-4-4m4 4l4-4M5 20h14",push:"M12 20V9m0 0l-4 4m4-4l4 4M5 4h14",close:"M6 6l12 12M18 6L6 18",chevron:"M6 9l6 6 6-6",chevronUp:"M6 15l6-6 6 6",sparkles:"M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9zM18.5 15l.9 2.1 2.1.9-2.1.9-.9 2.1-.9-2.1-2.1-.9 2.1-.9z",file:"M14 3H7a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V7zM14 3v4h4",code:"M8 7l-5 5 5 5M16 7l5 5-5 5",warning:"M12 3l9 16H3zM12 9v5M12 17v.5",check:"M5 12l5 5L20 7",folder:"M3 6a1 1 0 0 1 1-1h5l2 2h8a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1z",split:"M4 5h16v14H4zM12 5v14",unified:"M4 5h16M4 9h16M4 13h16M4 17h16",search:"M11 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16zM21 21l-4.35-4.35",copy:"M8 4v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7.242a2 2 0 0 0-.602-1.43L16.08 2.5a2 2 0 0 0-1.43-.5H10a2 2 0 0 0-2 2zM4 8H3a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-1",checkAlt:"M20 6L9 17l-5-5",more:"M6 12h.01M12 12h.01M18 12h.01",undo:"M9 14L4 9l5-5M4 9h10a6 6 0 0 1 0 12h-2",revert:"M10 7L5 12l5 5M5 12h9a5 5 0 0 1 5 5",cherry:"M12 17.5m-3.5 0a3.5 3.5 0 1 0 7 0a3.5 3.5 0 1 0 -7 0M7 6.5m-2.5 0a2.5 2.5 0 1 0 5 0a2.5 2.5 0 1 0 -5 0M12 14c0-3 2-5.5 6-7M12 14c-1-2.5-2.5-4-5-5.5",reset:"M3 12a9 9 0 1 0 3-6.7M3 4v5h5M12 8v4l2.5 2",trash:"M3 6h18M8 6V4h8v2M19 6l-1 14H6L5 6M10 11v5M14 11v5"},Ee=20;function et({size:t=20}){return e("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"},e("path",{d:"M12 3v18",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round"}),e("path",{d:"M12 12c0-4 3-6 7-6h1",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round"}),e("circle",{cx:12,cy:3.5,r:2.3,fill:"currentColor"}),e("circle",{cx:12,cy:12,r:2.3,fill:"currentColor"}),e("circle",{cx:12,cy:20.5,r:2.3,fill:"currentColor"}))}function Yi({size:t=20}){return e(et,{size:t})}var Xi=`
|
|
7
7
|
.gitp-root{--gitp-mono:var(--dsh-font-family-code,var(--dsh-font-family-code-default,ui-monospace,SFMono-Regular,Menlo,Consolas,monospace));--gitp-ease:cubic-bezier(.2,.7,.3,1);--gitp-hair:var(--dsh-hairline-width,.5px);--gitp-ring:var(--dsw-alias-state-business-primary);position:relative;display:flex;flex-direction:column;height:100%;min-height:0;width:100%;overflow:hidden;background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-primary);font-family:var(--dsw-font-family,system-ui,sans-serif);font-size:13px;line-height:20px;-webkit-font-smoothing:antialiased}
|
|
8
8
|
.gitp-root *{box-sizing:border-box}
|
|
9
9
|
.gitp-root button,.gitp-root input,.gitp-root textarea{font:inherit;color:inherit}
|
|
@@ -94,8 +94,10 @@ button[data-forge-header]{display:none}
|
|
|
94
94
|
.gitp-commit-status-line{display:flex;align-items:center;justify-content:space-between;gap:6px;padding:0 2px;font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums}
|
|
95
95
|
.gitp-commit-status-line.has-conflict{color:var(--dsw-alias-state-error-primary)}
|
|
96
96
|
.gitp-commit-actions{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
|
|
97
|
-
.gitp-
|
|
98
|
-
.gitp-amend
|
|
97
|
+
.gitp-commit-opts{display:flex;align-items:center;gap:12px;margin-right:auto;min-width:0;flex-wrap:wrap}
|
|
98
|
+
.gitp-amend{display:inline-flex;align-items:center;gap:6px;padding-left:2px;font-size:12px;color:var(--dsw-alias-label-secondary);cursor:pointer;flex:none;user-select:none}
|
|
99
|
+
.gitp-dialog-option{display:inline-flex;align-items:center;gap:6px;font-size:13px;color:var(--dsw-alias-label-secondary);cursor:pointer;flex:none;user-select:none}
|
|
100
|
+
.gitp-amend input,.gitp-check input,.gitp-dialog-option input{width:14px;height:14px;margin:0;accent-color:var(--dsw-alias-brand-primary);cursor:pointer}
|
|
99
101
|
.gitp-btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;height:32px;padding:0 14px;border:0;border-radius:var(--dsw-radius-sm,8px);background:transparent;box-shadow:inset 0 0 0 var(--gitp-hair) var(--dsw-alias-border-l3);color:var(--dsw-alias-label-primary);cursor:pointer;font-size:13px;font-weight:500;flex:none;white-space:nowrap;transition:background-color 120ms ease,opacity 120ms ease;user-select:none}
|
|
100
102
|
.gitp-btn:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}
|
|
101
103
|
.gitp-btn:active:not(:disabled){background:var(--dsw-alias-interactive-bg-active)}
|
|
@@ -313,7 +315,7 @@ button[data-forge-header]{display:none}
|
|
|
313
315
|
.gitp-settings select:focus,.gitp-settings textarea:focus{outline:none;border-color:var(--dsw-alias-state-business-primary)}
|
|
314
316
|
.gitp-settings select:focus-visible,.gitp-settings textarea:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:1px}
|
|
315
317
|
.gitp-settings-actions{display:flex;justify-content:flex-end}
|
|
316
|
-
`,jt="dsh-git-desk/styles";if(typeof document<"u"&&document.querySelector(`style[data-plugin-css=${JSON.stringify(jt)}]`)===null){let t=document.createElement("style");t.dataset.plugin="dsh-git-desk",t.dataset.pluginCss=jt,t.textContent=Ui,document.head.appendChild(t)}function ce({icon:t,title:i,hint:n,action:a}){return e("div",{className:"gitp-center"},t?e("div",{className:"gitp-center-icon"},t):null,e("div",{className:"gitp-center-title"},i),n?e("div",{className:"gitp-center-hint"},n):null,a??null)}function Q(){return e("span",{className:"gitp-spinner","aria-hidden":"true"})}function Ae({label:t,icon:i,onClick:n,disabled:a,active:s}){return e("button",{type:"button",className:O("gitp-iconbtn",s&&"is-active"),onClick:n,disabled:a,"aria-label":t,title:t},e(P,{path:i}))}function ot({label:t,icon:i,count:n,onClick:a,disabled:s,busy:o}){return e("button",{type:"button",className:O("gitp-toolbtn",n>0&&"has-count"),onClick:a,disabled:s||o,"aria-label":n>0?`${t}, ${n}`:t,title:n>0?`${t} (${n})`:t},o?e(Q):e(P,{path:i,size:14}),n>0?e("span",{className:"gitp-toolbtn-num"},n>99?"99+":String(n)):null)}function Ue({title:t,onClose:i,children:n,danger:a,closeLabel:s="Close"}){let o=B(null),h=B(i);return h.current=i,A(()=>{let u=document.activeElement,p=o.current;p?.querySelector("input, textarea, select, button")?.focus();let m=d=>{if(d.key==="Escape"){d.preventDefault(),d.stopPropagation(),h.current();return}if(d.key!=="Tab"||p===null)return;let b=[...p.querySelectorAll('button, input, textarea, select, [href], [tabindex]:not([tabindex="-1"])')].filter(f=>!f.hasAttribute("disabled")&&f.offsetParent!==null);if(b.length===0)return;let v=b[0],k=b[b.length-1];v===void 0||k===void 0||(d.shiftKey&&document.activeElement===v?(d.preventDefault(),k.focus()):!d.shiftKey&&document.activeElement===k&&(d.preventDefault(),v.focus()))};return document.addEventListener("keydown",m,!0),()=>{document.removeEventListener("keydown",m,!0),u instanceof HTMLElement&&typeof u.focus=="function"&&u.focus()}},[]),e("div",{className:"gitp-modal-layer",onMouseDown:u=>{u.target===u.currentTarget&&h.current()}},e("div",{className:O("gitp-modal",a&&"is-danger"),ref:o,role:"dialog","aria-modal":"true","aria-label":t},e("div",{className:"gitp-modal-head"},e("div",{className:"gitp-modal-title"},t),e(Ae,{label:s,icon:w.close,onClick:i})),n))}function mt({title:t,body:i,confirmLabel:n,cancelLabel:a,danger:s,busy:o,onConfirm:h,onClose:u}){return e(Ue,{title:t,onClose:u,danger:s},e("div",{className:"gitp-modal-sub"},i),e("div",{className:"gitp-modal-actions"},e("button",{type:"button",className:"gitp-btn",onClick:u,disabled:o},a),e("button",{type:"button",className:O("gitp-btn",s?"is-danger":"is-primary"),onClick:h,disabled:o},o?e(Q):null,n)))}function Ki({t,defaultName:i,defaultMessage:n,busy:a,error:s,onCreate:o,onClose:h}){let[u,p]=x(i),[c,m]=x(n),d=B(null);_t(d,c);let b=u.trim()!==""&&c.trim()!==""&&!a;return e(Ue,{title:t("branch.title"),onClose:h,closeLabel:t("action.close")},e("div",{className:"gitp-field"},e("label",{htmlFor:"gitp-branch-name"},t("branch.name")),e("input",{id:"gitp-branch-name",value:u,onChange:v=>p(v.target.value),spellCheck:!1,autoComplete:"off"}),e("div",{className:"gitp-field-hint"},t("branch.nameHint"))),e("div",{className:"gitp-field"},e("label",{htmlFor:"gitp-branch-message"},t("branch.message")),e("textarea",{id:"gitp-branch-message",ref:d,value:c,onChange:v=>m(v.target.value)})),s?e("div",{className:"gitp-modal-error"},s):null,e("div",{className:"gitp-modal-actions"},e("button",{type:"button",className:"gitp-btn",onClick:h,disabled:a},t("action.cancel")),e("button",{type:"button",className:"gitp-btn is-primary",disabled:!b,onClick:()=>o({name:u.trim(),message:c.trim()})},a?e(Q):null,t("action.createBranch"))))}function Vi({t,files:i,busy:n,error:a,onCreate:s,onClose:o}){let[h,u]=x(()=>new Set(i.map(d=>d.path))),[p,c]=x(""),m=d=>{u(b=>{let v=new Set(b);return v.has(d)?v.delete(d):v.add(d),v})};return e(Ue,{title:t("stash.title"),onClose:o,closeLabel:t("action.close")},e("div",{className:"gitp-modal-sub"},t("stash.selectHint")),i.length>1?e("div",{style:{display:"flex",justifyContent:"flex-end",marginBottom:"4px"}},e("button",{type:"button",className:"gitp-linkbtn",onClick:()=>u(h.size===i.length?new Set:new Set(i.map(d=>d.path)))},h.size===i.length?t("stash.deselectAll"):t("stash.selectAll"))):null,i.length===0?e("div",{className:"gitp-modal-sub"},t("stash.nothing")):e("div",{className:"gitp-filechecks"},i.map(d=>e("label",{className:"gitp-check",key:d.path},e("input",{type:"checkbox",checked:h.has(d.path),onChange:()=>m(d.path)}),e("span",{className:"gitp-check-path"},d.path)))),e("div",{className:"gitp-field"},e("label",{htmlFor:"gitp-stash-message"},t("stash.message")),e("input",{id:"gitp-stash-message",value:p,onChange:d=>c(d.target.value),placeholder:t("stash.default")})),a?e("div",{className:"gitp-modal-error"},a):null,e("div",{className:"gitp-modal-actions"},e("button",{type:"button",className:"gitp-btn",onClick:o,disabled:n},t("action.cancel")),e("button",{type:"button",className:"gitp-btn is-primary",disabled:n||h.size===0,onClick:()=>s({paths:[...h],message:p.trim()})},n?e(Q):null,t("action.stash"))))}function lt({entry:t,side:i,selected:n,busy:a,t:s,onSelect:o,onToggle:h}){let u=Ze(t.path),p=i==="staged"?t.stagedAdd:t.add,c=i==="staged"?t.stagedDel:t.del,m=s(i==="staged"?"action.unstageFile":"action.stageFile");return e("div",{className:O("gitp-filerow",n&&"is-selected"),role:"button",tabIndex:0,"aria-current":n?"true":void 0,onClick:()=>o(),onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),o())}},e("span",{className:O("gitp-status",ht(t.letter))},t.letter),e("span",{className:"gitp-filename"},u.dir?e("span",{className:"gitp-filedir"},u.dir):null,u.base,t.both?e("span",{className:"gitp-both-tag",title:s("meta.partialHint")},s("meta.partial")):null),t.binary?e("span",{className:"gitp-delta"},s("meta.binary")):e("span",{className:"gitp-delta"},p!==null&&p>0?e("span",{className:"gitp-add"},`+${p}`):null,c!==null&&c>0?e("span",{className:"gitp-del"},`\u2212${c}`):null),i==="conflict"?null:e("button",{type:"button",className:"gitp-rowaction","aria-label":m,title:m,disabled:a,onClick:d=>{d.stopPropagation(),h()}},e(P,{path:i==="staged"?w.minus:w.plus,size:14})))}function _i({t,snapshot:i,conflicts:n,staged:a,unstaged:s,selection:o,onSelect:h,busy:u,fileBusy:p,onToggleFile:c,onToggleAll:m,diff:d,diffLoading:b,layout:v,onLayout:k,onRefresh:f,onBlock:g,onResolve:C,onOpen:W,message:R,onMessage:j,onCommit:S,onBranch:E,canCommit:T,commitBusy:I,aiBusy:F,aiMenuOpen:M,onAiToggle:G,onAiClose:U,onAiWrite:$,onAiBranch:be,selectionKey:De,amend:D,onAmend:q,canAmend:X,compact:V,onBack:Le}){let[re,Be]=x(""),[ve,he]=Vt(),ne=B(null),me=B(null),oe=B(null);_t(oe,R);let[ie,ye]=x({conflicts:!1,staged:!1,unstaged:!1}),de=l=>ye(N=>({...N,[l]:!N[l]})),ae=re.trim().toLowerCase(),xe=l=>ae===""||l.path.toLowerCase().includes(ae),we=Me(()=>n.filter(xe),[n,ae]),ke=Me(()=>a.filter(xe),[a,ae]),J=Me(()=>s.filter(xe),[s,ae]),Ne=Me(()=>{let l=0,N=0;for(let z of a)l+=z.stagedAdd??0,N+=z.stagedDel??0;return{add:l,del:N}},[a]),ee=!V||o===null,Ce=!V||o!==null,pe=we.length+ke.length+J.length,le=n.length+a.length+s.length;return e("div",{className:"gitp-changes",ref:ne},ee?e("div",{className:"gitp-listcol",ref:me,style:V?void 0:{width:`${ve}px`}},le>0?e("div",{className:"gitp-filter-box"},e(P,{path:w.search,size:13}),e("input",{type:"text",value:re,onChange:l=>Be(l.target.value),placeholder:t("filter.placeholder"),"aria-label":t("filter.placeholder"),spellCheck:!1}),re?e("button",{type:"button",className:"gitp-filter-clear",onClick:()=>Be(""),"aria-label":t("filter.clear")},e(P,{path:w.close,size:10})):null):null,e("div",{className:"gitp-filelist"},we.length>0?e(te.default.Fragment,null,e("div",{className:"gitp-section-head is-conflict",onClick:()=>de("conflicts"),onKeyDown:l=>{l.target!==l.currentTarget||l.key!=="Enter"&&l.key!==" "||(l.preventDefault(),de("conflicts"))},role:"button","aria-expanded":!ie.conflicts,tabIndex:0},e(P,{path:w.chevron,size:14,className:O("gitp-section-chev",ie.conflicts&&"is-collapsed")}),e("span",{className:"gitp-section-title"},t("section.conflicts")),e("span",{className:"gitp-section-count"},String(we.length))),ie.conflicts?null:we.map(l=>e(lt,{key:`conflict:${l.path}`,entry:l,side:"conflict",selected:o?.side==="conflict"&&o.path===l.path,busy:p,t,onSelect:()=>h({side:"conflict",path:l.path,renamed:!1}),onToggle:()=>{}}))):null,ke.length>0?e(te.default.Fragment,null,e("div",{className:"gitp-section-head",onClick:()=>de("staged"),onKeyDown:l=>{l.target!==l.currentTarget||l.key!=="Enter"&&l.key!==" "||(l.preventDefault(),de("staged"))},role:"button","aria-expanded":!ie.staged,tabIndex:0},e(P,{path:w.chevron,size:14,className:O("gitp-section-chev",ie.staged&&"is-collapsed")}),e("span",{className:"gitp-section-title"},t("section.staged")),e("span",{className:"gitp-section-count"},String(ke.length)),e("button",{type:"button",className:"gitp-section-action","aria-label":t("action.unstageAll"),title:t("action.unstageAll"),disabled:p,onClick:l=>{l.stopPropagation(),m("staged")}},e(P,{path:w.minus,size:14}))),ie.staged?null:ke.map(l=>e(lt,{key:`staged:${l.path}`,entry:l,side:"staged",selected:o?.side==="staged"&&o.path===l.path,busy:p,t,onSelect:()=>h({side:"staged",path:l.path,renamed:l.kind==="renamed"}),onToggle:()=>c(l,"staged")}))):null,J.length>0?e(te.default.Fragment,null,e("div",{className:"gitp-section-head",onClick:()=>de("unstaged"),onKeyDown:l=>{l.target!==l.currentTarget||l.key!=="Enter"&&l.key!==" "||(l.preventDefault(),de("unstaged"))},role:"button","aria-expanded":!ie.unstaged,tabIndex:0},e(P,{path:w.chevron,size:14,className:O("gitp-section-chev",ie.unstaged&&"is-collapsed")}),e("span",{className:"gitp-section-title"},t("section.unstaged")),e("span",{className:"gitp-section-count"},String(J.length)),e("button",{type:"button",className:"gitp-section-action","aria-label":t("action.stageAll"),title:t("action.stageAll"),disabled:p,onClick:l=>{l.stopPropagation(),m("unstaged")}},e(P,{path:w.plus,size:14}))),ie.unstaged?null:J.map(l=>e(lt,{key:`unstaged:${l.path}`,entry:l,side:"unstaged",selected:o?.side==="unstaged"&&o.path===l.path,busy:p,t,onSelect:()=>h({side:"unstaged",path:l.path,renamed:l.kind==="renamed"}),onToggle:()=>c(l,"unstaged")}))):null,ae!==""&&pe===0?e("div",{className:"gitp-center",style:{padding:"24px"}},t("filter.empty",{filter:re})):null,le===0?e(ce,{icon:e(P,{path:w.check,size:28}),title:t("empty.noChanges"),hint:t("empty.noChangesHint"),action:e("button",{type:"button",className:"gitp-btn is-small",onClick:f,disabled:u},t("action.refresh"))}):null),e("div",{className:"gitp-commitbox"},e("textarea",{ref:oe,value:R,onChange:l=>j(l.target.value),onKeyDown:l=>{l.defaultPrevented||(l.ctrlKey||l.metaKey)&&l.key==="Enter"&&(l.preventDefault(),T&&!I&&S())},placeholder:t("commit.placeholder"),"aria-label":t("commit.placeholder")}),e("div",{className:O("gitp-commit-status-line",n.length>0&&"has-conflict")},n.length>0?e("span",null,t("commit.hintConflict")):a.length>0?e(te.default.Fragment,null,e("span",null,t("commit.stagedSummary",{count:a.length})," ",e("span",{className:"gitp-add"},`+${Ne.add}`)," ",e("span",{className:"gitp-del"},`\u2212${Ne.del}`)),e("span",null,t("commit.shortcut",{key:Bi}))):e("span",null,t("commit.hintStage"))),e("div",{className:"gitp-commit-actions"},X?e("label",{className:"gitp-amend"},e("input",{type:"checkbox",checked:D,onChange:l=>q(l.target.checked)}),t("commit.amend")):null,e("div",{className:"gitp-ai-wrap"},e("button",{type:"button",className:"gitp-btn is-small is-icon","aria-label":t("ai.action"),"aria-haspopup":"menu","aria-expanded":M===!0,title:t("ai.action"),disabled:I||F||a.length===0,onClick:G},F?e(Q):e(P,{path:w.sparkles,size:13}))),e("button",{type:"button",className:"gitp-btn is-small",onClick:E,disabled:I||n.length>0||a.length===0,"aria-label":t("action.branch")},e(P,{path:w.branch,size:13}),t("action.branch")),e("button",{type:"button",className:"gitp-btn is-primary is-small",onClick:S,disabled:!T||I},I?e(Q):null,t(I?"action.committing":"action.commit"))),M?e(Ji,{t,busy:F,canUse:a.length>0,canBranch:a.length>0&&n.length===0,onWrite:$,onBranch:be,onClose:U}):null)):null,ee&&Ce?e(Yt,{label:t("split.files"),containerRef:ne,columnRef:me,width:ve,onChange:he}):null,Ce?e("div",{className:"gitp-diffcol"},o?e(qt,{t,diff:d,loading:b,layout:v,onLayout:k,onBlock:g,onResolve:C,busy:p,selectionKey:De,renamed:o.renamed===!0,compact:V,onBack:Le,onOpen:W}):e(ce,{icon:e(P,{path:w.file,size:28}),title:t("empty.selectFile"),hint:t("empty.selectFileHint")})):null)}function qt({t,diff:i,loading:n,layout:a,onLayout:s,onBlock:o,onResolve:h,busy:u,selectionKey:p,renamed:c=!1,compact:m,onBack:d,onOpen:b}){let v=B(null),[k,f]=x({index:-1,canPrev:!1,canNext:!1}),g=Me(()=>i===null?[]:[...i.blocks??[]].sort((E,T)=>E.row-T.row),[i]),C=()=>{let E=v.current;if(E===null)return[];let T=[...E.querySelectorAll(".gitp-pane")];if(T.length>0)return T;let I=E.querySelector(".gitp-unified");return I===null?[]:[I]},W=E=>{let T=-1;for(let I=0;I<g.length;I+=1){let F=g[I];F!==void 0&&F.row*Ee<=E+40&&(T=I)}return{index:T,canPrev:T>0,canNext:g.some(I=>I.row*Ee>E+40)}};A(()=>{let E=v.current;if(E===null)return;let T=0,I=()=>{let M=C()[0];f(W(M===void 0?0:M.scrollTop))},F=()=>{T===0&&(T=requestAnimationFrame(()=>{T=0,I()}))};return E.addEventListener("scroll",F,!0),I(),()=>{E.removeEventListener("scroll",F,!0),T!==0&&cancelAnimationFrame(T)}},[i,a]);let R=E=>{let T=C()[0],I=T===void 0?0:T.scrollTop,F=null;if(E>0)F=g.find($=>$.row*Ee>I+40)??null;else{for(let $ of g)$.row*Ee<=I+40&&(F=$);F=F===null?null:g[g.indexOf(F)-1]??null}if(F===null)return;let M=Math.max(0,F.row*Ee-40),G=C();for(let $ of G)$.scrollTop=M;let U=G[0]===void 0?M:G[0].scrollTop;f(W(U))};if(n&&i===null)return e("div",{className:"gitp-diff"},e("div",{className:"gitp-center"},e(Q),e("div",{className:"gitp-center-hint"},t("diff.loading"))));if(i===null)return e("div",{className:"gitp-diff"},e(ce,{icon:e(P,{path:w.file,size:28}),title:t("empty.selectFile"),hint:t("empty.selectFileHint")}));let j=Ze(i.path),S={left:i.labels.left==="HEAD"?t("diff.head"):i.labels.left==="Staged"?t("diff.staged"):i.labels.left==="Local"?t("diff.local"):i.labels.left==="Parent"?t("diff.parent"):i.labels.left,right:i.labels.right==="Staged"?t("diff.staged"):i.labels.right==="Local"?t("diff.local"):i.labels.right==="Commit"?t("diff.commit"):i.labels.right==="Incoming"?t("action.acceptTheirs"):i.labels.right};return e("div",{className:"gitp-diff",ref:v},e("div",{className:"gitp-diff-head"},m&&d?e(Ae,{label:t("action.back"),icon:w.left,onClick:d}):null,e("div",{className:"gitp-diff-title"},e("span",{className:O("gitp-status",ht(i.conflict?"C":"M"))},i.conflict?"C":"M"),e("div",{className:"gitp-diff-path"},j.dir?e("span",{className:"gitp-diff-dir"},j.dir):null,e("span",{className:"gitp-diff-base"},j.base)),i.conflict?e("span",{className:"gitp-diff-pill is-conflict"},t("section.conflicts")):i.side==="staged"?e("span",{className:"gitp-diff-pill is-staged"},t("diff.staged")):i.side==="unstaged"?e("span",{className:"gitp-diff-pill is-unstaged"},t("diff.unstaged")):i.side==="log"?e("span",{className:"gitp-diff-pill is-commit"},t("diff.commit")):null),i.conflict?e("span",{className:"gitp-diff-stats gitp-del"},t("section.conflicts")):i.binary?e("span",{className:"gitp-diff-stats"},t("diff.binary")):e("span",{className:"gitp-diff-stats"},e("span",{className:"gitp-add"},`+${i.add??0}`),e("span",{className:"gitp-del"},`\u2212${i.del??0}`)),g.length>0&&!i.conflict&&!i.binary?e("div",{className:"gitp-change-nav",role:"group","aria-label":t("diff.changes")},e(Ae,{label:t("action.prevChange"),icon:w.chevronUp,onClick:()=>R(-1),disabled:!k.canPrev}),e("span",{className:"gitp-change-count"},`${Math.max(0,k.index)+1}/${g.length}`),e(Ae,{label:t("action.nextChange"),icon:w.chevron,onClick:()=>R(1),disabled:!k.canNext})):null,e("div",{className:"gitp-diff-actions"},b!==void 0&&!i.binary?e(Ae,{label:t("action.openEditor"),icon:w.code,onClick:()=>b(i)}):null,i.conflict?null:e("div",{className:"gitp-seg",role:"group","aria-label":t("diff.layout")},e("button",{type:"button",className:a==="split"?"is-active":"","aria-pressed":a==="split","aria-label":t("diff.split"),title:t("diff.split"),onClick:()=>s("split")},e(P,{path:w.split,size:13})),e("button",{type:"button",className:a==="unified"?"is-active":"","aria-pressed":a==="unified","aria-label":t("diff.unified"),title:t("diff.unified"),onClick:()=>s("unified")},e(P,{path:w.unified,size:13}))))),i.conflict?e("div",{className:"gitp-conflict-banner"},e(P,{path:w.warning,size:14}),e("span",null,t("diff.conflictBanner")),e("button",{type:"button",className:"gitp-btn is-small",onClick:()=>h?.("ours"),disabled:u},t("action.acceptOurs")),e("button",{type:"button",className:"gitp-btn is-small",onClick:()=>h?.("theirs"),disabled:u},t("action.acceptTheirs"))):null,i.binary?e("div",{className:"gitp-binary"},e("div",{className:"gitp-binary-title"},t("diff.binary")),e("div",null,t("diff.binaryHint",{before:i.leftSize??0,after:i.rightSize??0}))):i.conflict?e(qi,{diff:i}):a==="unified"?e(Xi,{t,diff:i,onBlock:o,busy:u,selectionKey:p,renamed:c}):e(Yi,{t,diff:i,labels:S,onBlock:o,busy:u,selectionKey:p,renamed:c}),!i.binary&&!i.conflict?e("div",{className:"gitp-diff-foot"},e("span",{className:"gitp-diff-legend"},e("span",{className:"gitp-diff-dot is-add"}),t("diff.added")),e("span",{className:"gitp-diff-legend"},e("span",{className:"gitp-diff-dot is-del"}),t("diff.removed")),e("span",{className:"gitp-diff-foot-spacer"}),e("span",null,g.length===1?t("diff.blockCountOne"):t("diff.blockCount",{count:g.length}))):null)}function qi({diff:t}){return e("div",{className:"gitp-unified"},t.right.map((i,n)=>e("div",{className:O("gitp-urow",/^(<{7}|={7}|>{7})/.test(i)&&"is-conflict-marker"),key:n},e("span",{className:"gitp-uno"},n+1),e("span",{className:"gitp-ucontent"},i||"\xA0"))))}function Yi({t,diff:i,labels:n,onBlock:a,busy:s,selectionKey:o,renamed:h}){let u=B(null),p=B(null),c=B(null),m=f=>{c.current&&(c.current.style.transform=`translateY(${-f}px)`)},d=f=>{let g=f.scrollTop;u.current&&u.current!==f&&(u.current.scrollTop=g),p.current&&p.current!==f&&(p.current.scrollTop=g),m(g)};A(()=>{let f=i.blocks[0];if(!f||f.row<=10)return;let g=Math.max(0,f.row*Ee-80);u.current&&(u.current.scrollTop=g),p.current&&(p.current.scrollTop=g),m(g)},[o]);let b=Me(()=>{let f=new Map;for(let g of i.rows){if(g.k!=="mod"||g.l===null||g.r===null)continue;let C=i.left[g.l-1]??"",W=i.right[g.r-1]??"";f.set(g,$i(C,W))}return f},[i]),v=Me(()=>{let f=new Map;for(let g of i.blocks)f.set(g.row,g);return f},[i]),k=f=>{if(h)return[];let g={action:"unstaged",icon:w.left,label:t("action.stageBlock"),revert:!1},C={action:"revert",icon:w.right,label:t("action.revertBlock"),revert:!0};return i.side==="unstaged"?i.leftMissing?[g]:[g,C]:i.side==="staged"?[{action:"staged",icon:w.right,label:t("action.unstageBlock"),revert:!1}]:[]};return e(te.default.Fragment,null,e("div",{className:"gitp-pane-heads"},e("div",{className:"gitp-pane-head"},n.left),e("div",{className:"gitp-pane-head-gutter"}),e("div",{className:"gitp-pane-head"},n.right)),e("div",{className:"gitp-panes"},e("div",{className:"gitp-pane",ref:u,tabIndex:0,role:"region","aria-label":n.left,onScroll:f=>d(f.currentTarget)},i.rows.map((f,g)=>{let C=f.l?i.left[f.l-1]??"":"",W=f.k==="add"?"blank":f.k==="mod"?"del":f.k,R=b.get(f);return e("div",{className:O("gitp-line",W!=="ctx"&&`is-${W}`),key:`l${g}`},e("span",{className:"gitp-ln"},f.l??""),e("span",{className:"gitp-code"},f.l===null?"\xA0":R?Ft(R.lPre,R.lMid,R.lSuf):C||"\xA0"))})),e("div",{className:"gitp-gutter","aria-hidden":!1},e("div",{className:"gitp-gutter-inner",ref:c},i.blocks.map(f=>{let g=k(f);return g.length===0?null:e("div",{className:"gitp-arrows",key:f.id,style:{top:f.row*Ee}},g.map(C=>e("button",{type:"button",className:O("gitp-arrow",C.revert&&"is-revert"),key:C.action,"aria-label":C.label,title:C.label,disabled:s,onClick:()=>a(f,C.action)},e(P,{path:C.icon,size:12}))))}))),e("div",{className:"gitp-pane",ref:p,tabIndex:0,role:"region","aria-label":n.right,onScroll:f=>d(f.currentTarget)},i.rows.map((f,g)=>{let C=f.r?i.right[f.r-1]??"":"",W=f.k==="del"?"blank":f.k==="mod"?"add":f.k,R=b.get(f);return e("div",{className:O("gitp-line",W!=="ctx"&&`is-${W}`),key:`r${g}`},e("span",{className:"gitp-ln"},f.r??""),e("span",{className:"gitp-code"},f.r===null?"\xA0":R?Ft(R.rPre,R.rMid,R.rSuf):C||"\xA0"))}))))}function Xi({t,diff:i,onBlock:n,busy:a,selectionKey:s,renamed:o}){let h=Me(()=>{let c=new Map;for(let d of i.blocks)c.set(d.row,d);let m=[];return i.rows.forEach((d,b)=>{let v=c.get(b),k=d.l===null?"":i.left[d.l-1]??"",f=d.r===null?"":i.right[d.r-1]??"";d.k==="ctx"?m.push({l:d.l,r:d.r,text:k,kind:"ctx",block:v}):d.k==="mod"?(m.push({l:d.l,r:null,text:k,kind:"del",block:v}),m.push({l:null,r:d.r,text:f,kind:"add"})):d.k==="del"?m.push({l:d.l,r:null,text:k,kind:"del",block:v}):m.push({l:null,r:d.r,text:f,kind:"add",block:v})}),m},[i]),u=B(null);A(()=>{let c=h.find(m=>m.block!==void 0);!c||h.indexOf(c)<=10||u.current===null||(u.current.scrollTop=Math.max(0,h.indexOf(c)*Ee-80))},[s]);let p=c=>{if(o)return[];let m={action:"unstaged",icon:w.left,label:t("action.stageBlock"),revert:!1},d={action:"revert",icon:w.right,label:t("action.revertBlock"),revert:!0};return i.side==="unstaged"?i.leftMissing?[m]:[m,d]:i.side==="staged"?[{action:"staged",icon:w.right,label:t("action.unstageBlock"),revert:!1}]:[]};return e("div",{className:"gitp-unified",ref:u,tabIndex:0,role:"region","aria-label":t("diff.unified")},h.map((c,m)=>{let d=c.block?p(c.block):[];return e("div",{className:O("gitp-urow",c.kind!=="ctx"&&`is-${c.kind}`),key:m},e("span",{className:"gitp-uarrows"},d.map(b=>e("button",{type:"button",className:O("gitp-arrow",b.revert&&"is-revert"),key:b.action,"aria-label":b.label,title:b.label,disabled:a,onClick:()=>{c.block!==void 0&&n(c.block,b.action)}},e(P,{path:b.icon,size:12})))),e("span",{className:"gitp-uno"},c.l??""),e("span",{className:"gitp-uno"},c.r??""),e("span",{className:"gitp-ucontent"},c.text||"\xA0"))}))}function Ji({t,busy:i,canUse:n,canBranch:a,onWrite:s,onBranch:o,onClose:h}){let u=B(h);u.current=h;let p=B(null);A(()=>{let m=b=>{b.key==="Escape"&&(b.preventDefault(),b.stopPropagation(),u.current())},d=b=>{let v=b.target;p.current!==null&&v instanceof Node&&p.current.contains(v)||v instanceof Element&&v.closest(".gitp-ai-wrap")!==null||u.current()};return document.addEventListener("keydown",m,!0),document.addEventListener("mousedown",d,!0),()=>{document.removeEventListener("keydown",m,!0),document.removeEventListener("mousedown",d,!0)}},[]);let c=(m,d,b,v,k)=>e("button",{type:"button",key:m,className:"gitp-popover-row",role:"menuitem",disabled:v,onClick:k},e(P,{path:d,size:13}),e("span",{className:"gitp-popover-row-text"},b));return e("div",{className:"gitp-popover is-menu",ref:p,role:"menu","aria-label":t("ai.action")},c("write",w.sparkles,t("ai.write"),!n||i,s),c("branch",w.branch,t("ai.branch"),!a||i,o))}function Zi({t,workspaceTitle:i,branch:n,repo:a,ahead:s,behind:o,upstream:h,onBranchMenu:u,onRepoMenu:p,repos:c,repoRoot:m,onSync:d,busy:b,onRefresh:v,syncing:k}){let f=n?.name??(n?.oid?ze(n.oid):t(a===!1?"empty.noRepo":"status.detached")),g=c.find(j=>j.root===m)??null,C=c[0],W=c.length>1||C!==void 0&&c.length===1&&C.name!=="."&&!C.name.startsWith(".."),R=g===null?t("repo.none"):g.name==="."?t("repo.workspace"):g.label??g.name;return e("div",{className:"gitp-head"},e("div",{className:"gitp-head-left"},e("span",{className:"gitp-repo"},i),W?e("button",{type:"button",className:"gitp-branch gitp-repo-pick",onClick:p,"aria-haspopup":"listbox","aria-label":t("repo.pick"),title:t("repo.pick")},e(P,{path:w.folder,size:13}),e("span",{className:"gitp-branch-name"},R),e("span",{className:"gitp-chevron"},e(P,{path:w.chevron,size:11}))):null,e("button",{type:"button",className:"gitp-branch",onClick:u,disabled:a===!1,"aria-haspopup":"listbox","aria-label":t("branch.title"),title:t("branch.title")},e(P,{path:w.branch,size:13}),e("span",{className:"gitp-branch-name"},f),e("span",{className:"gitp-chevron"},e(P,{path:w.chevron,size:11})))),e("div",{className:"gitp-head-right"},e(ot,{label:t("action.fetch"),icon:w.fetch,count:0,onClick:()=>d("fetch"),busy:k==="fetch",disabled:b}),e(ot,{label:t("action.pull"),icon:w.pull,count:o,onClick:()=>d("pull"),busy:k==="pull",disabled:b||h===null}),e(ot,{label:t("action.push"),icon:w.push,count:s,onClick:()=>d("push"),busy:k==="push",disabled:b}),e(Ae,{label:t("action.refresh"),icon:w.refresh,onClick:v,disabled:b})))}function Qi({t,mode:i,onMode:n,counts:a}){let s=[{id:"changes",label:t("mode.changes"),count:a.changes},{id:"log",label:t("mode.log"),count:0},{id:"stash",label:t("mode.stash"),count:0}];return e("nav",{className:"gitp-rail","aria-label":t("panel")},s.map(o=>e("button",{type:"button",key:o.id,className:O("gitp-rail-item",i===o.id&&"is-active"),onClick:()=>n(o.id),"aria-label":o.count>0?`${o.label}, ${o.count}`:o.label,"aria-current":i===o.id?"page":void 0},e("span",{className:"gitp-rail-label"},o.label),o.count>0?e("span",{className:"gitp-rail-count"},String(o.count)):null)))}function ea({t,repos:i,current:n,onPick:a,onInitRoot:s,onClose:o}){let h=B(null),u=B(o);u.current=o,A(()=>{h.current?.querySelector("button:not(:disabled)")?.focus();let c=m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),u.current())};return document.addEventListener("keydown",c,!0),()=>document.removeEventListener("keydown",c,!0)},[]);let p=!i.some(c=>c.name==="."||c.name.startsWith(".."));return e("div",{className:"gitp-popover-layer",onMouseDown:c=>{c.target===c.currentTarget&&u.current()}},e("div",{className:"gitp-popover is-wide",ref:h,role:"listbox","aria-label":t("repo.title")},e("div",{className:"gitp-popover-title"},t("repo.title")),e("div",{className:"gitp-popover-list"},i.map(c=>e("button",{type:"button",key:c.root,className:"gitp-popover-row",role:"option","aria-selected":c.root===n,disabled:c.root===n,onClick:()=>a(c.root)},e(P,{path:w.folder,size:13}),e("span",{className:"gitp-popover-row-text"},c.name==="."?t("repo.workspace"):c.label??c.name),c.root===n?e(P,{path:w.check,size:13,className:"gitp-checkmark"}):null))),p?e(te.default.Fragment,null,e("div",{className:"gitp-popover-sep"}),e("button",{type:"button",className:"gitp-popover-row",onClick:s},e(P,{path:w.plus,size:13}),e("span",{className:"gitp-popover-row-text"},t("repo.initRoot")))):null))}function ta({t,branches:i,loading:n,busy:a,onCheckout:s,onNew:o,onClose:h}){let u=B(null),p=B(h);p.current=h;let[c,m]=x("");A(()=>{u.current?.querySelector("input")?.focus();let R=j=>{j.key==="Escape"&&(j.preventDefault(),j.stopPropagation(),p.current())};return document.addEventListener("keydown",R,!0),()=>document.removeEventListener("keydown",R,!0)},[]);let d=c.trim().toLowerCase(),b=i.filter(R=>!R.remote),v=new Set(b.map(R=>R.name)),k=i.filter(R=>{if(!R.remote)return!1;let j=R.name.split("/").slice(1).join("/");return j!==""&&!v.has(j)}),f=R=>d===""||R.name.toLowerCase().includes(d),g=b.filter(f),C=k.filter(f),W=(R,j)=>R.map(S=>e("button",{type:"button",key:`${j?"r":"l"}:${S.name}`,className:"gitp-popover-row",role:"option","aria-selected":S.current===!0,disabled:a||S.current===!0,onClick:()=>s(S.name,j)},e(P,{path:w.branch,size:13}),e("span",{className:"gitp-popover-row-text"},S.name),S.current?e(P,{path:w.check,size:13,className:"gitp-checkmark"}):null));return e("div",{className:"gitp-popover-layer",onMouseDown:R=>{R.target===R.currentTarget&&p.current()}},e("div",{className:"gitp-popover is-wide",ref:u,role:"listbox","aria-label":t("branch.local")},e("input",{className:"gitp-search",value:c,placeholder:t("branch.search"),onChange:R=>m(R.target.value),"aria-label":t("branch.search")}),e("button",{type:"button",className:"gitp-popover-row",disabled:a,onClick:o},e(P,{path:w.plus,size:13}),e("span",{className:"gitp-popover-row-text"},t("branch.new"))),e("div",{className:"gitp-popover-sep"}),n?e("div",{className:"gitp-modal-sub"},t("branch.loading")):null,!n&&g.length===0&&C.length===0?e("div",{className:"gitp-modal-sub"},t(d===""?"branch.none":"branch.noneMatch")):null,g.length>0?e(te.default.Fragment,null,e("div",{className:"gitp-popover-title"},t("branch.local")),e("div",{className:"gitp-popover-list"},W(g,!1))):null,C.length>0?e(te.default.Fragment,null,e("div",{className:"gitp-popover-title"},t("branch.remote")),e("div",{className:"gitp-popover-list"},W(C,!0))):null))}function ia({t,busy:i,error:n,onCreate:a,onClose:s}){let[o,h]=x("");return e(Ue,{title:t("branch.newTitle"),onClose:s,closeLabel:t("action.close")},e("div",{className:"gitp-field"},e("label",{htmlFor:"gitp-new-branch"},t("branch.name")),e("input",{id:"gitp-new-branch",value:o,onChange:u=>h(u.target.value),spellCheck:!1,autoComplete:"off"}),e("div",{className:"gitp-field-hint"},t("branch.newHint"))),n?e("div",{className:"gitp-modal-error"},n):null,e("div",{className:"gitp-modal-actions"},e("button",{type:"button",className:"gitp-btn",onClick:s,disabled:i},t("action.cancel")),e("button",{type:"button",className:"gitp-btn is-primary",disabled:i||o.trim()==="",onClick:()=>a({name:o.trim()})},i?e(Q):null,t("action.createAndSwitch"))))}function aa(t,i,n,a){let s=i?.branch??null,o=i?.merging===!0||i?.rebasing===!0||i?.reverting===!0||i?.cherryPicking===!0,h=(i?.conflicts?.length??0)>0,u=(i?.entries??[]).some(k=>k.staged),p=s===null||s.detached===!0,c=s?.oid!==null&&s?.oid!==void 0&&s.oid===t.hash,m=typeof s?.upstream=="string"&&s.upstream!==""&&s.ahead===0,d=(t.parents?.length??0)>1,b=[];b.push({id:"copy",label:a("history.copy"),icon:w.copy,hint:null,reason:null});let v=null;return o?v=a("history.blockedOperation"):p?v=a("history.blockedDetached"):c?(t.parents?.length??0)===0?v=a("history.blockedNoParent"):m&&(v=a("history.blockedPushed")):v=a("history.blockedNotHead"),b.push({id:"undo",label:a("history.undo"),icon:w.undo,hint:a("history.undoHint"),reason:v}),v=null,o?v=a("history.blockedOperation"):d?v=a("history.blockedMerge"):h?v=a("history.blockedConflict"):u&&(v=a("history.blockedStaged")),b.push({id:"revert",label:a("history.revert"),icon:w.revert,hint:a("history.revertHint"),reason:v}),v=null,o?v=a("history.blockedOperation"):d?v=a("history.blockedMerge"):h?v=a("history.blockedConflict"):n.has(t.hash)&&(v=a("history.blockedContained")),b.push({id:"cherry",label:a("history.cherryPick"),icon:w.cherry,hint:a("history.cherryPickHint"),reason:v}),v=null,o?v=a("history.blockedOperation"):p&&(v=a("history.blockedDetached")),b.push({id:"reset",label:a("history.reset"),icon:w.reset,hint:a("history.resetHint"),reason:v}),b}function na({t,commit:i,rows:n,busy:a,onPick:s,onClose:o}){let h=B(null),u=B(o),p=B(null);return u.current=o,A(()=>{p.current=document.activeElement instanceof HTMLElement?document.activeElement:null,h.current?.querySelector("button:not(:disabled)")?.focus();let c=m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),u.current())};return document.addEventListener("keydown",c,!0),()=>{document.removeEventListener("keydown",c,!0),p.current&&typeof p.current.focus=="function"&&p.current.focus()}},[]),e("div",{className:"gitp-popover-layer",onMouseDown:c=>{c.target===c.currentTarget&&u.current()}},e("div",{className:"gitp-popover is-wide",ref:h,role:"menu","aria-label":t("history.actions")},e("div",{className:"gitp-popover-title"},t("history.actions")),e("div",{className:"gitp-popover-blurb",title:i.subject},`${ze(i.hash)} \xB7 ${i.subject}`),e("div",{className:"gitp-popover-sep"}),n.map(c=>e("button",{type:"button",key:c.id,className:"gitp-action-row",role:"menuitem",disabled:a||c.reason!==null,title:c.reason??c.hint??void 0,onClick:()=>s(c.id)},e(P,{path:c.icon??w.more,size:13}),e("span",{className:"gitp-action-text"},e("span",{className:"gitp-action-label"},c.label),c.reason!==null||c.hint!==null?e("span",{className:"gitp-action-reason"},c.reason??c.hint):null)))))}function sa({t,commit:i,busy:n,error:a,onReset:s,onClose:o}){let[h,u]=x("soft"),p=[["soft","history.resetModeSoft","history.resetModeSoftHint"],["mixed","history.resetModeMixed","history.resetModeMixedHint"],["hard","history.resetModeHard","history.resetModeHardHint"]];return e(Ue,{title:t("history.resetTitle"),onClose:o,danger:h==="hard"},e("div",{className:"gitp-modal-sub"},t("history.resetBody",{hash:ze(i.hash)})),e("div",{role:"radiogroup","aria-label":t("history.resetTitle")},p.map(([c,m,d])=>e("label",{key:c,className:"gitp-reset-mode"},e("input",{type:"radio",name:"gitp-reset-mode",value:c,checked:h===c,disabled:n,onChange:()=>u(c)}),e("span",{className:"gitp-reset-mode-text"},e("span",{className:"gitp-reset-mode-title"},t(m)),e("span",{className:"gitp-reset-mode-hint"},t(d)))))),h==="hard"?e("div",{className:"gitp-modal-warn",role:"alert"},t("history.resetHardWarning")):null,a!==null?e("div",{className:"gitp-modal-error"},a):null,e("div",{className:"gitp-modal-actions"},e("button",{type:"button",className:"gitp-btn",onClick:o,disabled:n},t("action.cancel")),e("button",{type:"button",className:O("gitp-btn",h==="hard"?"is-danger":"is-primary"),onClick:()=>s(h),disabled:n},n?e(Q):null,t("history.resetAction"))))}function ra({call:t,workspaceId:i,repo:n,t:a,refreshToken:s,compact:o,layout:h,onLayout:u,snapshot:p,onApplied:c}){let[m,d]=x(null),[b,v]=x(null),[k,f]=x(null),[g,C]=x(null),[W,R]=x(null),[j,S]=x(!1),[E,T]=x(!1),[I,F]=x(!1),[M,G]=x(null),[U,$]=x(!1),[be,De]=Vt(),[D,q]=x(null),[X,V]=x(null),[Le,re]=x(null),[Be,ve]=x(null),[he,ne]=x(null),[me,oe]=x(null),ie=B(null),ye=B(null),de=B(n),ae=l=>{navigator?.clipboard?.writeText&&(navigator.clipboard.writeText(l).catch(()=>{}),$(!0),setTimeout(()=>$(!1),2e3))};A(()=>{if(me===null)return;let l=setTimeout(()=>oe(null),4e3);return()=>clearTimeout(l)},[me]),A(()=>{q(null),V(null),re(null),ve(null)},[n]),A(()=>{de.current!==n&&(de.current=n,v(null),f(null),C(null),R(null))},[n]),A(()=>{let l=!0,N=new AbortController;return S(!0),t("log",{workspaceId:i,repo:n},N.signal).then(z=>{if(!l)return;let K=Wi(z.commits??[]);d(K);let Y=K[0];Y!==void 0&&v(Re=>Re??Y.hash)}).catch(z=>{let K=_(z);l&&K.name!=="AbortError"&&G(K)}).finally(()=>{l&&S(!1)}),()=>{l=!1,N.abort()}},[i,n,s]),A(()=>{if(!b){f(null);return}let l=!0,N=new AbortController;return T(!0),t("commitDetail",{workspaceId:i,repo:n,hash:b},N.signal).then(z=>{if(l){f(z);let K=z.files[0];!o&&K!==void 0?C(Y=>Y!==null&&z.files.some(Re=>Re.path===Y)?Y:K.path):o&&C(null),R(null)}}).catch(z=>{let K=_(z);l&&K.name!=="AbortError"&&G(K)}).finally(()=>{l&&T(!1)}),()=>{l=!1,N.abort()}},[i,n,b,o]),A(()=>{if(!g||!k){R(null);return}let l=!0,N=new AbortController;return F(!0),t("diff",{workspaceId:i,repo:n,path:g,side:"log",commit:k.hash,parent:k.parents?.[0]},N.signal).then(z=>{l&&R(z)}).catch(z=>{let K=_(z);l&&K.name!=="AbortError"&&G(K)}).finally(()=>{l&&F(!1)}),()=>{l=!1,N.abort()}},[i,n,g,k]);let xe=Me(()=>{let l=new Map;for(let Y of m??[])l.set(Y.hash,Y.parents);let N=new Set,z=[],K=p?.branch?.oid;for(typeof K=="string"&&K!==""&&z.push(K);z.length>0;){let Y=z.pop();if(Y===void 0)break;if(!N.has(Y)){N.add(Y);for(let Re of l.get(Y)??[])z.push(Re)}}return N},[m,p?.branch?.oid]),we=D===null?[]:aa(D,p,xe,a);async function ke(l){ne("undo");try{let N=await t("undoCommit",{workspaceId:i,repo:n,hash:l.hash});V(null),c({status:N.status,message:N.message,goToChanges:!0,toast:a("history.undone")})}catch(N){V(null),oe({text:ge(N),error:!0}),c({})}finally{ne(null)}}async function J(l){ne("revert");try{let N=await t("revertCommit",{workspaceId:i,repo:n,hash:l.hash});V(null),c({status:N.status,message:N.message,goToChanges:!0,toast:a(N.conflicted?"history.revertConflicts":"history.reverted")})}catch(N){V(null),oe({text:ge(N),error:!0}),c({})}finally{ne(null)}}async function Ne(l){ne("cherry");try{let N=await t("cherryPickCommit",{workspaceId:i,repo:n,hash:l.hash});oe({text:a("history.picked",{hash:ze(N.hash)}),error:!1}),c({status:N.status})}catch(N){oe({text:ge(N),error:!0}),c({})}finally{ne(null)}}async function ee(l,N){ne("reset"),ve(null);try{let z=await t("resetToCommit",{workspaceId:i,repo:n,hash:l.hash,mode:N,confirm:!0});re(null),oe({text:a("history.resetDone",{hash:ze(l.hash)}),error:!1}),c({status:z.status})}catch(z){ve(ge(z))}finally{ne(null)}}function Ce(l){let N=D;if(N!==null){if(l==="copy"){ae(N.hash),q(null),oe({text:a("action.copied"),error:!1});return}q(null),l==="undo"?V({type:"undo",commit:N}):l==="revert"?V({type:"revert",commit:N}):l==="cherry"?Ne(N):l==="reset"&&re(N)}}if(j&&m===null)return e(ce,{icon:e(Q),title:a("log.loading")});if(m===null&&M!==null)return e(ce,{icon:e(P,{path:w.warning,size:28}),title:a("error.title"),hint:ge(M)});if(m!==null&&m.length===0)return e(ce,{icon:e(P,{path:w.history,size:28}),title:a("empty.noHistory"),hint:a("empty.noHistoryHint")});let pe=!o||!g,le=!o||!!g;return e("div",{className:"gitp-changes",ref:ie},pe?e("div",{className:"gitp-listcol",ref:ye,style:o?void 0:{width:`${be}px`}},e("div",{className:"gitp-loglist"},M?e("div",{className:"gitp-error"},e("span",{className:"gitp-error-text"},ge(M))):null,(m??[]).map(l=>e("button",{type:"button",key:l.hash,className:O("gitp-commitrow",b===l.hash&&"is-selected"),onClick:()=>v(l.hash),onContextMenu:N=>{N.preventDefault(),v(l.hash),q(l)},"aria-haspopup":"menu"},e("span",{className:"gitp-graph",style:{width:Math.max(14,l.laneCount*10+8)}},e("span",{className:"gitp-graph-line",style:{left:6+l.lane*10}}),e("span",{className:O("gitp-graph-dot",l.lane%4?`g${l.lane%4}`:""),style:{left:6+l.lane*10}})),e("span",{className:"gitp-commitmain"},e("div",{className:"gitp-commit-subject"},l.subject),e("div",{className:"gitp-commit-meta"},e("span",null,l.author),e("span",null,"\xB7"),e("span",null,Ot(l.date))),l.refs.length>0?e("div",{className:"gitp-refs"},l.refs.map(N=>e("span",{key:N,className:O("gitp-ref",N.startsWith("HEAD")&&"is-head")},N.replace(/^HEAD -> /,"")))):null)))),e("div",{className:"gitp-logdetail-summary"},E&&k===null?e("div",{className:"gitp-center",style:{padding:"24px"}},e(Q)):k===null?e(ce,{title:a("log.select")}):e(te.default.Fragment,null,e("div",{className:"gitp-detail-head"},e("div",{className:"gitp-detail-title"},e("div",{className:"gitp-detail-subject"},k.subject),e(Ae,{label:a("history.actions"),icon:w.more,disabled:he!==null,onClick:()=>q({hash:k.hash,parents:k.parents??[],subject:k.subject})})),e("div",{className:"gitp-detail-meta"},e("button",{type:"button",className:"gitp-detail-hash-btn",onClick:()=>ae(k.hash),title:a(U?"action.copied":"action.copyHash")},ze(k.hash),e(P,{path:U?w.check:w.copy,size:11})),e("span",null,k.author),e("span",null,Ot(k.date)))),k.body?e("div",{className:"gitp-detail-body"},k.body):null,e("div",{className:"gitp-detail-section-head"},e("span",null,a("log.files")),e("span",{className:"gitp-section-count"},String(k.files?.length??0))),e("div",{className:"gitp-detail-files"},!k.files||k.files.length===0?e("div",{className:"gitp-center-hint",style:{padding:"4px 8px"}},a("log.noFiles")):k.files.map(l=>{let N=Ze(l.path);return e("button",{type:"button",key:l.path,className:O("gitp-detail-file",g===l.path&&"is-selected"),onClick:()=>C(l.path)},e("span",{className:O("gitp-status",ht("M"))},"M"),e("span",{className:"gitp-filename"},N.dir?e("span",{className:"gitp-filedir"},N.dir):null,N.base),l.binary?e("span",{className:"gitp-delta"},a("meta.binary")):e("span",{className:"gitp-delta"},l.add!==null&&l.add>0?e("span",{className:"gitp-add"},`+${l.add}`):null,l.del!==null&&l.del>0?e("span",{className:"gitp-del"},`\u2212${l.del}`):null))}))))):null,pe&&le?e(Yt,{label:a("split.commits"),containerRef:ie,columnRef:ye,width:be,onChange:De}):null,le?e("div",{className:"gitp-diffcol"},g?e(qt,{t:a,diff:W,loading:I,layout:h,onLayout:u,onBlock:()=>{},busy:!0,selectionKey:`${k?.hash??""}:${g}`,compact:o,onBack:o?()=>C(null):void 0}):e(ce,{icon:e(P,{path:w.changes,size:28}),title:a("empty.selectFile"),hint:a("empty.selectFileHint")})):null,D?e(na,{t:a,commit:D,rows:we,busy:he!==null,onPick:Ce,onClose:()=>q(null)}):null,X?e(mt,{title:a(X.type==="undo"?"history.undoTitle":"history.revertTitle"),body:a(X.type==="undo"?"history.undoBody":"history.revertBody"),confirmLabel:a(X.type==="undo"?"history.undoAction":"history.revertAction"),cancelLabel:a("action.cancel"),busy:he!==null,onConfirm:()=>X.type==="undo"?ke(X.commit):J(X.commit),onClose:()=>{he===null&&V(null)}}):null,Le?e(sa,{t:a,commit:Le,busy:he==="reset",error:Be,onReset:l=>ee(Le,l),onClose:()=>{he===null&&(re(null),ve(null))}}):null,me?e("div",{className:O("gitp-toast",me.error&&"is-error"),role:"status","aria-live":"polite"},me.text):null)}function oa({call:t,workspaceId:i,repo:n,t:a,snapshot:s,onStatus:o,refreshToken:h}){let[u,p]=x(null),[c,m]=x(null),[d,b]=x(!1),[v,k]=x(null),[f,g]=x(null),[C,W]=x(null),[R,j]=x(null),S=B(n);A(()=>{S.current!==n&&(S.current=n,p(null))},[n]);let E=Je(async M=>{try{let G=await t("stashList",{workspaceId:i,repo:n},M);p(G.stashes??[]),m(null)}catch(G){let U=_(G);U.name!=="AbortError"&&m(U)}},[i,n,t]);A(()=>{let M=new AbortController;return E(M.signal),()=>M.abort()},[E,h]),A(()=>{if(R===null)return;let M=setTimeout(()=>j(null),4e3);return()=>clearTimeout(M)},[R]);let T=(s?.entries??[]).filter(M=>M.unstaged&&!M.conflicted);async function I({paths:M,message:G}){k("create"),g(null);try{let U=await t("stashPush",{workspaceId:i,repo:n,paths:M,message:G,includeUntracked:M.some($=>T.find(be=>be.path===$)?.untracked===!0)});o(U.status),p(U.stashes??[]),b(!1),j(a("stash.created",{count:M.length}))}catch(U){g(ge(U))}finally{k(null)}}async function F(M,G,U){k(M+G),m(null);try{let $=await t(M==="drop"?"stashDrop":"stashApply",{workspaceId:i,repo:n,ref:G,pop:U});o($.status),p($.stashes??[]),j(M==="drop"?a("stash.dropped",{ref:G}):a(U?"stash.popped":"stash.applied",{ref:G})),W(null)}catch($){m(_($))}finally{k(null)}}return e("div",{className:"gitp-stash"},e("div",{className:"gitp-stash-head"},e("div",{className:"gitp-stash-title"},e("span",null,a("mode.stash")),u?.length?e("span",{className:"gitp-section-count"},String(u.length)):null),e("button",{type:"button",className:"gitp-btn is-small is-primary",onClick:()=>b(!0),disabled:T.length===0},e(P,{path:w.plus,size:12}),a("action.stash"))),c?e("div",{className:"gitp-error"},e("span",{className:"gitp-error-text"},ge(c))):null,u===null?e("div",{className:"gitp-center"},e(Q)):u.length===0?e(ce,{icon:e(P,{path:w.stash,size:28}),title:a("empty.noStashes"),hint:a("empty.noStashesHint"),action:T.length>0?e("button",{type:"button",className:"gitp-btn is-primary is-small",onClick:()=>b(!0)},e(P,{path:w.plus,size:12}),a("action.stash")):null}):e("div",{className:"gitp-stashlist"},u.map(M=>e("div",{className:"gitp-stashrow",key:M.ref},e("div",{className:"gitp-stash-main"},e("div",{className:"gitp-stash-msg"},M.message||"WIP"),e("div",{className:"gitp-stash-meta"},e("span",{className:"gitp-stash-ref"},M.ref),e("span",null,"\xB7"),e("span",null,ze(M.hash)))),e("div",{className:"gitp-stash-actions"},e("button",{type:"button",className:"gitp-btn is-small",onClick:()=>F("apply",M.ref,!1),disabled:v!==null,title:a("stash.applyHint")},v==="apply"+M.ref?e(Q):null,a("action.apply")),e("button",{type:"button",className:"gitp-btn is-small",onClick:()=>F("apply",M.ref,!0),disabled:v!==null,title:a("stash.popHint")},v==="apply"+M.ref?e(Q):null,a("action.pop")),e("button",{type:"button",className:"gitp-btn is-small gitp-stash-btn-danger","aria-label":a("action.drop"),onClick:()=>W(M.ref),disabled:v!==null,title:a("stash.dropHint")},a("action.drop")))))),d?e(Vi,{t:a,files:T,busy:v==="create",error:f,onCreate:I,onClose:()=>{b(!1),g(null)}}):null,C?e(mt,{title:a("stash.dropTitle"),body:a("stash.dropBody",{ref:C}),confirmLabel:a("action.drop"),cancelLabel:a("action.cancel"),danger:!0,busy:v==="drop"+C,onConfirm:()=>F("drop",C,!1),onClose:()=>W(null)}):null,R?e("div",{className:"gitp-toast",role:"status","aria-live":"polite"},R):null)}function la({call:t,t:i,useWorkspaces:n,useSessions:a,sessionId:s,useTabInfo:o,sidebarRight:h}){let{tab:u}=o(),p=Wt(s).set;A(()=>{p(u.visible===!0)},[p,u.visible]),A(()=>()=>{p(!1)},[p]),A(()=>{ut={visible:u.visible===!0,canStageAll:()=>it.length>0&&E===null,stageAll:()=>vt("unstaged"),canCommit:()=>at&&E===null,commit:()=>xt(),canWriteMessage:()=>Se.length>0&&E===null&&!xe,writeMessage:()=>kt()}}),A(()=>()=>{ut=null},[]);let c=n(r=>r.items),m=a(r=>r.byId[s]),d=c.find(r=>r.sessionIds?.includes(s))??c.find(r=>m?.cwd!==void 0&&(m.cwd===r.path||m.cwd.startsWith(`${r.path}/`)))??null,b=d===null?"":d.workspaceId,v=B(null),[k,f]=x(!1),[g,C]=x(null),[W,R]=x(!1),[j,S]=x(null),[E,T]=x(null),[I,F]=x(null),[M,G]=x("changes"),[U,$]=x(""),[be,De]=x(!1),[D,q]=x(null),[X,V]=x(null),[Le,re]=x(!1),[Be,ve]=x(0),[he,ne]=x(()=>Ge(Pt,"split")==="unified"?"unified":"split"),[me,oe]=x(()=>Ge(Et,"split")==="unified"?"unified":"split"),[ie,ye]=x(!1),[de,ae]=x(!1),[xe,we]=x(!1),[ke,J]=x(null),[Ne,ee]=x(null),[Ce,pe]=x(!1),[le,l]=x(null),[N,z]=x(null),[K,Y]=x(0),[Re,Ke]=x([]),[L,Oe]=x(null),Xt=r=>{if(L===null||h===void 0)return;let y=zi(r),H=Ai(s,m===void 0?void 0:m.cwd,`${L}/${r.path}`);h.openResource(H,{params:{line:y}})},[Jt,Zt]=x(0),[Qt,Ve]=x(!1),[ei,et]=x(!1),je=B(0),tt=B(null);A(()=>{let r=v.current;if(r===null||typeof ResizeObserver>"u")return;let y=0,H=new ResizeObserver(Z=>{y&&cancelAnimationFrame(y),y=requestAnimationFrame(()=>{y=0;let Te=Z[0]?.contentRect.width??0;f(Te>0&&Te<900)})});return H.observe(r),()=>{H.disconnect(),y&&cancelAnimationFrame(y)}},[d?.workspaceId]);let se=Je(r=>{!r||!Array.isArray(r.entries)||(je.current+=1,C(r))},[]),fe=Je(async(r,y)=>{if(!d||L===null)return;let H=++je.current;y||R(!0);try{let Z=await t("status",{workspaceId:b,repo:L},r);H===je.current&&(tt.current=null,C(Z),Array.isArray(Z.repos)&&Z.repos.length>0&&Ke(Z.repos),S(null))}catch(Z){let Te=_(Z);if(Te.name==="AbortError"||H!==je.current)return;let Ie=Ht(Z);if(Ie==="git/not-repo"||Ie==="git/repo-invalid"){if(tt.current===L){S(Te);return}tt.current=L,Pe($e+b,""),Oe(null),C(null),S(null),Zt(st=>st+1);return}S(Te)}finally{H===je.current&&R(!1)}},[d?.workspaceId,L,t]),ti=Je(r=>{r?.status&&se(r.status),typeof r.message=="string"&&($(r.message),De(!1)),r?.goToChanges&&(q(null),V(null),G("changes")),r?.toast&&z(r.toast),Y(y=>y+1),fe(void 0,!1)},[se,fe]),ft=B(null);A(()=>{if(!d?.workspaceId)return;let r=b;ft.current!==r&&(ft.current=r,Ke([]),Oe(null),C(null));let y=new AbortController;return(async()=>{try{let H=await t("status",{workspaceId:r},y.signal);if(y.signal.aborted)return;let Z=Array.isArray(H.repos)?H.repos:[];Ke(Z);let Te=Ge($e+r,""),Ie=Z.find(st=>st.root===Te)??Z[0]??null;Ie?(Oe(Ie.root),Pe($e+r,Ie.root)):C(H)}catch(H){let Z=_(H);Z.name!=="AbortError"&&S(Z)}})(),()=>y.abort()},[d?.workspaceId,t,Jt]),A(()=>{if(L===null)return;let r=new AbortController;return fe(r.signal,!1),()=>r.abort()},[L,fe]),A(()=>{if(!d||L===null)return;let r=setInterval(()=>{document.visibilityState==="visible"&&fe(void 0,!0)},8e3);return()=>clearInterval(r)},[d?.workspaceId,L,fe]),A(()=>{let r=()=>fe(void 0,!0);return window.addEventListener("focus",r),()=>window.removeEventListener("focus",r)},[fe]),A(()=>{if(N===null)return;let r=setTimeout(()=>z(null),4e3);return()=>clearTimeout(r)},[N]);let _e=g?.entries?.filter(r=>r.conflicted)??[],Se=g?.entries?.filter(r=>r.staged&&!r.conflicted)??[],it=g?.entries?.filter(r=>r.unstaged&&!r.conflicted)??[],at=Se.length>0&&_e.length===0&&U.trim()!==""&&g?.repo!==!1,nt=D?`${D.side}:${D.path}:${D.commit??""}`:"",ii=D===null?!0:D.side==="staged"?g?.entries?.some(r=>r.path===D.path&&r.staged&&!r.conflicted):D.side==="unstaged"?g?.entries?.some(r=>r.path===D.path&&r.unstaged&&!r.conflicted):D.side==="conflict"?g?.entries?.some(r=>r.path===D.path&&r.conflicted):!0;A(()=>{g!==null&&D!==null&&!ii&&q(null)},[g,nt]),A(()=>{if(!d||D===null){V(null);return}let r=new AbortController;return re(!0),t("diff",{workspaceId:b,repo:L,path:D.path,side:D.side},r.signal).then(y=>{r.signal.aborted||V(y)}).catch(y=>{let H=_(y);!r.signal.aborted&&H.name!=="AbortError"&&S(H)}).finally(()=>{r.signal.aborted||re(!1)}),()=>r.abort()},[d?.workspaceId,L,nt,Be,t]);function ue(){ve(r=>r+1)}function ai(r){D!==null&&D.side===r.side&&D.path===r.path||(V(null),q(r))}function bt(r){let y=new Set;for(let H of r)y.add(H.path),H.from&&y.add(H.from);return[...y]}async function ni(r,y){if(E===null){T("file"),S(null);try{let H=await t(y==="staged"?"unstage":"stage",{workspaceId:b,repo:L,paths:bt([r])});se(H),D?.path===r.path&&D.side===y&&q(null),ue()}catch(H){S(_(H))}finally{T(null)}}}async function vt(r){let y=r==="staged"?Se:it;if(!(E!==null||y.length===0)){T("file"),S(null);try{let H=await t(r==="staged"?"unstage":"stage",{workspaceId:b,repo:L,paths:bt(y)});se(H),ue()}catch(H){S(_(H))}finally{T(null)}}}async function si(r,y){if(!(E!==null||X===null)){if(y==="revert"){l({title:i("confirm.revertTitle"),body:i("confirm.revertBody"),confirmLabel:i("confirm.yesRevert"),danger:!0,run:()=>yt(r,"revert")});return}await yt(r,y)}}async function yt(r,y){if(X!==null){T("block"),S(null);try{let H=await t("applyBlocks",{workspaceId:b,repo:L,path:X.path,side:y,blocks:[r],baseHash:X.baseHash,targetHash:X.targetHash,confirm:!0});se(H),ue()}catch(H){S(_(H)),Ht(H)==="git/stale"&&ue()}finally{T(null),l(null)}}}async function ri(r){if(!(!D||E!==null)){T("resolve"),S(null);try{let y=await t("resolve",{workspaceId:b,repo:L,path:D.path,side:r});se(y),q(null),ue()}catch(y){S(_(y))}finally{T(null)}}}async function xt(){if(!(!at||E!==null)){T("commit"),S(null);try{let r=await t("commit",{workspaceId:b,repo:L,message:U,amend:be});se(r.status),$(""),De(!1),z(i("commit.done",{hash:ze(r.hash)})),ue()}catch(r){S(_(r))}finally{T(null)}}}function oi(){Se.length===0||_e.length>0||(J(null),ye(!0))}async function wt(){if(xe||Se.length===0)return null;we(!0),S(null);try{let r=dt.hook.getSnapshot(),y=await t("aiMessage",{workspaceId:b,repo:L,...r.model===null?{}:{model:r.model},...r.instruction.trim()===""?{}:{instruction:r.instruction}});return y.model!==null&&y.model!==""&&z(i("ai.written",{model:y.model})),y.message!==""?y.message:null}catch(r){return S(_(r)),null}finally{we(!1)}}async function kt(){ae(!1);let r=await wt();r!==null&&$(r)}async function li(){if(ae(!1),Se.length===0||_e.length>0)return;let r=await wt();r!==null&&($(r),J(null),ye(!0))}async function ci({name:r,message:y}){pe(!0),J(null);try{let H=await t("createBranchAndCommit",{workspaceId:b,repo:L,name:r,message:y});se(H.status),$(""),ye(!1),z(i("branch.created",{branch:r})),ue()}catch(H){J(ge(H))}finally{pe(!1)}}async function di(r){if(E===null){T("sync"),F(r),S(null);try{let y=await t(r,{workspaceId:b,repo:L});se(y.status),z(i(r==="fetch"?"sync.fetched":r==="pull"?"sync.pulled":"sync.pushed"))}catch(y){S(_(y))}finally{T(null),F(null)}}}async function pi(){if(g?.repo!==!1){if(Ne!==null){ee(null);return}ee({branches:[],loading:!0});try{let r=await t("branches",{workspaceId:b,repo:L});ee({branches:r.branches??[],loading:!1})}catch(r){ee(null),S(_(r))}}}function ui(r,y){if(ee(null),(g?.entries?.length??0)>0){l({title:i("confirm.checkoutTitle"),body:i("confirm.checkoutBody"),confirmLabel:i("confirm.yesCheckout"),danger:!1,run:()=>Nt(r,y)});return}Nt(r,y)}async function Nt(r,y){l(null),pe(!0),S(null);try{let H=await t("checkout",{workspaceId:b,repo:L,branch:r,remote:y===!0});se(H.status),ee(null),q(null),ue()}catch(H){ee(null),S(_(H))}finally{pe(!1)}}async function Ct(){if(E===null){T("init"),S(null);try{let r=await t("init",{workspaceId:b});Array.isArray(r.repos)&&Ke(r.repos);let y=r.selected??r.root??null;typeof y=="string"&&y!==""&&(Pe($e+b,y),Oe(y)),se(r)}catch(r){S(_(r))}finally{T(null)}}}function gi(r){Ve(!1),r!==L&&(Pe($e+b,r??""),Oe(r),C(null),q(null),V(null),ee(null))}function hi(){Ve(!1),l({title:i("repo.initRootTitle"),body:i("repo.initRootBody",{count:Re.length}),confirmLabel:i("repo.initRootConfirm"),danger:!0,run:()=>{l(null),Ct()}})}async function mi({name:r}){if(L!==null){pe(!0),J(null);try{let y=await t("createBranch",{workspaceId:b,repo:L,name:r});se(y.status),et(!1),z(i("branch.createdOnly",{branch:r})),ue()}catch(y){J(ge(y))}finally{pe(!1)}}}let Rt=k?me:he;function Mt(r){k?(oe(r),Pe(Et,r)):(ne(r),Pe(Pt,r))}if(d===null)return e("div",{className:"gitp-root"},e(ce,{icon:e(P,{path:w.branch,size:28}),title:i("empty.noWorkspace"),hint:i("empty.noWorkspaceHint")}));let qe=g?.branch??null,fi=qe?.ahead??0,bi=qe?.behind??0,St=j,vi=Se[0]?.path,yi=ji(U,vi),xi=U;return e("div",{className:O("gitp-root",k&&"is-compact"),ref:v},e(Zi,{t:i,workspaceTitle:d.title,branch:qe,repo:g?.repo!==!1,ahead:fi,behind:bi,upstream:qe?.upstream??null,onBranchMenu:pi,onRepoMenu:()=>Ve(!0),repos:Re,repoRoot:L,onSync:di,busy:E!==null,onRefresh:()=>{fe(void 0,!1),D&&ue(),Y(r=>r+1)},syncing:I}),St?e("div",{className:"gitp-error",role:"alert"},e(P,{path:w.warning,size:14}),e("span",{className:"gitp-error-text"},ge(St)),e(Ae,{label:i("action.close"),icon:w.close,onClick:()=>S(null)})):null,e("div",{className:"gitp-body"},e(Qi,{t:i,mode:M,onMode:G,counts:{changes:g?.entries?.length??0}}),e("div",{className:"gitp-content"},g===null?e(ce,{icon:e(Q),title:i("status.loading")}):g.repo===!1?e(ce,{icon:e(P,{path:w.branch,size:28}),title:i("empty.noRepo"),hint:i("empty.noRepoHint"),action:e("button",{type:"button",className:"gitp-btn is-primary",onClick:Ct,disabled:E!==null},E==="init"?e(Q):null,i("empty.init"))}):M==="log"?e(ra,{call:t,workspaceId:b,repo:L??"",t:i,refreshToken:K,compact:k,layout:Rt,onLayout:Mt,snapshot:g,onApplied:ti}):M==="stash"?e(oa,{call:t,workspaceId:b,repo:L??"",t:i,snapshot:g,onStatus:se,refreshToken:K}):e(_i,{t:i,snapshot:g,conflicts:_e,staged:Se,unstaged:it,selection:D,onSelect:ai,busy:E!==null,fileBusy:E!==null,onToggleFile:ni,onToggleAll:vt,diff:X,diffLoading:Le,layout:Rt,onLayout:Mt,onRefresh:()=>{ue(),fe(void 0,!1)},onBlock:si,onResolve:ri,onOpen:Xt,message:U,onMessage:$,onCommit:xt,onBranch:oi,canCommit:at,commitBusy:E==="commit",aiBusy:xe,aiMenuOpen:de,onAiToggle:()=>ae(r=>!r),onAiClose:()=>ae(!1),onAiWrite:kt,onAiBranch:li,selectionKey:nt,amend:be,onAmend:De,canAmend:g.branch?.initial!==!0,compact:k,onBack:()=>q(null)}))),Ne?e(ta,{t:i,branches:Ne.branches,loading:Ne.loading===!0,busy:Ce,onCheckout:ui,onNew:()=>{ee(null),J(null),et(!0)},onClose:()=>ee(null)}):null,Qt?e(ea,{t:i,repos:Re,current:L,onPick:gi,onInitRoot:hi,onClose:()=>Ve(!1)}):null,ei?e(ia,{t:i,busy:Ce,error:ke,onCreate:mi,onClose:()=>{et(!1),J(null)}}):null,ie?e(Ki,{t:i,defaultName:yi,defaultMessage:xi,busy:Ce,error:ke,onCreate:ci,onClose:()=>{ye(!1),J(null)}}):null,le?e(mt,{title:le.title,body:le.body,confirmLabel:le.confirmLabel,cancelLabel:i("action.cancel"),danger:le.danger,busy:E==="block"||Ce,onConfirm:()=>le.run(),onClose:()=>l(null)}):null,N?e("div",{className:"gitp-toast",role:"status","aria-live":"polite"},N):null)}function ca({t}){return e(te.default.Fragment,null,e(Qe,{size:14}),e("span",{className:"gitp-tab-title"},t("panel")))}function $t({sessionId:t,sidebarRight:i,useVisible:n,t:a}){let s=n(h=>h===!0),o=a("header.label");return e("button",{type:"button",className:O("gitp-iconbtn","gitp-header-btn",s&&"is-active"),"aria-label":o,"aria-pressed":s,title:o,onClick(){if(!s){i.openTab("git");return}let h=i.tabsIn(t).find(u=>u.kind==="git");h!==void 0&&i.hide(h.id)}},e(Qe,{size:16}))}function Yt({label:t,containerRef:i,columnRef:n,width:a,onChange:s}){let o=B(null),h=()=>{let p=i.current;return p===null?a:Math.max(Fe,Math.round(p.getBoundingClientRect().width)-zt)},u=p=>Math.min(Math.max(Math.round(p),Fe),h());return A(()=>()=>{o.current=null,document.body.style.cursor="",document.body.style.userSelect=""},[]),A(()=>{let p=i.current;if(p===null||typeof ResizeObserver>"u")return;let c=new ResizeObserver(()=>{let m=Math.round(p.getBoundingClientRect().width);if(m===0)return;let d=Math.max(Fe,m-zt);a>d&&s(d)});return c.observe(p),()=>c.disconnect()},[i,a,s]),e("div",{className:"gitp-resizer",role:"separator","aria-orientation":"vertical","aria-label":t,"aria-valuemin":Fe,"aria-valuemax":h(),"aria-valuenow":a,tabIndex:0,onPointerDown(p){p.button===0&&(o.current={x:p.clientX,width:a,next:a},p.currentTarget.setPointerCapture(p.pointerId),document.body.style.cursor="col-resize",document.body.style.userSelect="none",p.preventDefault())},onPointerMove(p){let c=o.current;if(c===null)return;let m=u(c.width+(p.clientX-c.x));m!==c.next&&(c.next=m,n.current!==null&&(n.current.style.width=`${m}px`),p.currentTarget.setAttribute("aria-valuenow",String(m)))},onPointerUp(p){let c=o.current;c!==null&&(o.current=null,p.currentTarget.hasPointerCapture(p.pointerId)&&p.currentTarget.releasePointerCapture(p.pointerId),document.body.style.cursor="",document.body.style.userSelect="",s(c.next))},onPointerCancel(){o.current=null,document.body.style.cursor="",document.body.style.userSelect=""},onDoubleClick(){s(u(pt))},onKeyDown(p){if(p.key==="ArrowLeft"||p.key==="ArrowRight"){p.preventDefault();let c=p.key==="ArrowRight"?Dt:-Dt;s(u(a+c));return}p.key==="Home"&&(p.preventDefault(),s(u(pt)))}})}var ut=null;function da({t,call:i,usePrefs:n,savePrefs:a}){let s=n(f=>f),[o,h]=x(null),[u,p]=x(!1);A(()=>{let f=new AbortController,g=!0;return i("preferences",{},f.signal).then(C=>{g&&h(C)},()=>{g&&p(!0)}),()=>{g=!1,f.abort()}},[i]);let c=o?.groups??[],m=s.model,d=m===null?"":Lt(m),b=m!==null&&c.some(f=>f.id===m.provider&&f.models.some(g=>g.id===m.model)),v=s.instruction===""?o?.instruction??"":s.instruction,k=o===null&&!u;return e("div",{className:"gitp-settings"},e("div",{className:"gitp-settings-row"},e("div",{className:"gitp-settings-copy"},e("label",{className:"gitp-settings-label",htmlFor:"gitp-settings-model"},t("settings.model")),e("p",{className:"gitp-settings-hint"},t("settings.modelHint"))),e("select",{id:"gitp-settings-model",value:d,disabled:k,onChange:f=>{let g=f.target.value;if(g===""){a({...s,model:null});return}let C=Oi(g);C!==null&&a({...s,model:C})}},e("option",{value:""},t("settings.modelSame")),b||s.model===null?null:e("option",{value:d},`${s.model.provider} \xB7 ${s.model.model}`),c.map(f=>e("optgroup",{key:f.id,label:f.label},f.models.map(g=>e("option",{key:g.id,value:Lt({provider:f.id,model:g.id})},g.name))))),u?e("p",{className:"gitp-settings-error"},t("settings.modelFailed")):null,!u&&o!==null&&c.length===0?e("p",{className:"gitp-settings-error"},t("settings.modelEmpty")):null),e("div",{className:"gitp-settings-row"},e("div",{className:"gitp-settings-copy"},e("label",{className:"gitp-settings-label",htmlFor:"gitp-settings-instruction"},t("settings.instruction")),e("p",{className:"gitp-settings-hint"},t("settings.instructionHint"))),e("textarea",{id:"gitp-settings-instruction",value:v,spellCheck:!1,disabled:k,onChange:f=>a({...s,instruction:f.target.value})}),e("div",{className:"gitp-settings-actions"},e("button",{type:"button",className:"gitp-btn is-small",disabled:s.instruction==="",onClick:()=>a({...s,instruction:""})},t("settings.instructionReset"))),u?e("p",{className:"gitp-settings-error"},t("settings.instructionFailed")):null))}function pa(){return e(Qe,{size:16})}function ua(t,i){let n=o=>({status:"blocked",reason:o}),a=["page","editable","terminal"],s=o=>{let h=ut;return h===null||!h.visible?n(i("command.openFirst")):o(h)};return[{id:"git.panel.toggle",label:()=>i("command.toggle"),aliases:["git","source control","toggle panel"],defaults:{},regions:a,modals:[],resolve:()=>({status:"handled",run:()=>{let o=t.sidebarRight.active();if(t.sidebarRight.isExpanded()&&o!==void 0&&o.kind==="git"){t.sidebarRight.hide(o.id);return}try{t.sidebarRight.openTab("git")}catch{}}})},{id:"git.stageAll",label:()=>i("command.stageAll"),aliases:["git","stage"],defaults:{},regions:a,modals:[],resolve:()=>s(o=>o.canStageAll()?{status:"handled",run:()=>o.stageAll()}:n(i("command.nothingToStage")))},{id:"git.commit",label:()=>i("command.commit"),aliases:["git","commit"],defaults:{},regions:a,modals:[],resolve:()=>s(o=>o.canCommit()?{status:"handled",run:()=>o.commit()}:n(i("command.notReady")))},{id:"git.writeMessage",label:()=>i("command.writeMessage"),aliases:["git","commit message","ai"],defaults:{},regions:a,modals:[],resolve:()=>s(o=>o.canWriteMessage()?{status:"handled",run:()=>o.writeMessage()}:n(i("command.notReady")))}]}var ga=["connection","slots","locale","sidebarRightTabs","sidebarRight"];function ha(t){t.locale.register(He,"en",Di),t.locale.register(He,"zh",Li);let i=t.locale.bind(He),n=async(s,o,h)=>{let u=await t.connection.rpc.call("/git-rpc",s,o,h);if(!u.ok)throw new ct(u.error.code,u.error.message,u.error.details);return u.value};t.effect(()=>t.sidebarRightTabs.register({id:rt,kind:"git",priority:"extension",title:()=>i("panel"),guide:[{id:"git",order:50,title:()=>i("guide.title"),description:()=>i("guide.description"),icon:()=>e(Gi,null)}]}),"dsh-git: right sidebar tab type");let a=s=>({sessionId:s,sidebarRight:t.sidebarRight,hooks:{visible:Wt(s).hook}});t.slots.inject("conversation.session.header.utilities",()=>t.slots.register({name:"conversation.session.header.utilities",id:"git-panel",order:-7,locale:He,inject:a},$t)),t.slots.inject("conversation.hero.options",()=>t.slots.register({name:"conversation.hero.options",id:"git-panel",order:-7,locale:He,inject:a},$t)),t.slots.inject("settings.section",()=>t.slots.register({name:"settings.section",id:"git",order:25,label:()=>i("settings.section"),locale:He,inject:()=>({t:i,call:n,savePrefs:dt.set,hooks:{prefs:dt.hook}})},da)),t.slots.inject("settings.section.icon",()=>t.slots.register({name:"settings.section.icon",id:"git",order:25},pa)),t.inject(["shortcuts"],s=>{for(let o of ua(t,i))s.effect(()=>s.shortcuts.register(o),`dsh-git: ${o.id}`)}),t.slots.inject("sidebar.right.pane.tab",()=>t.slots.register({name:"sidebar.right.pane.tab",key:rt,locale:He,inject:()=>({call:n,t:i,sidebarRight:t.sidebarRight})},la)),t.slots.inject("sidebar.right.pane.tab.title",()=>t.slots.register({name:"sidebar.right.pane.tab.title",key:rt,locale:He,inject:()=>({t:i})},ca))}
|
|
318
|
+
`,Vt="dsh-git-desk/styles";if(typeof document<"u"&&document.querySelector(`style[data-plugin-css=${JSON.stringify(Vt)}]`)===null){let t=document.createElement("style");t.dataset.plugin="dsh-git-desk",t.dataset.pluginCss=Vt,t.textContent=Xi,document.head.appendChild(t)}function ue({icon:t,title:i,hint:n,action:a}){return e("div",{className:"gitp-center"},t?e("div",{className:"gitp-center-icon"},t):null,e("div",{className:"gitp-center-title"},i),n?e("div",{className:"gitp-center-hint"},n):null,a??null)}function ee(){return e("span",{className:"gitp-spinner","aria-hidden":"true"})}function xe({label:t,icon:i,onClick:n,disabled:a,active:o}){return e("button",{type:"button",className:j("gitp-iconbtn",o&&"is-active"),onClick:n,disabled:a,"aria-label":t,title:t},e(H,{path:i}))}function ct({label:t,icon:i,count:n,onClick:a,disabled:o,busy:r}){return e("button",{type:"button",className:j("gitp-toolbtn",n>0&&"has-count"),onClick:a,disabled:o||r,"aria-label":n>0?`${t}, ${n}`:t,title:n>0?`${t} (${n})`:t},r?e(ee):e(H,{path:i,size:14}),n>0?e("span",{className:"gitp-toolbtn-num"},n>99?"99+":String(n)):null)}function Ke({title:t,onClose:i,children:n,danger:a,closeLabel:o="Close"}){let r=I(null),g=I(i);return g.current=i,A(()=>{let p=document.activeElement,d=r.current;d?.querySelector("input, textarea, select, button")?.focus();let h=c=>{if(c.key==="Escape"){c.preventDefault(),c.stopPropagation(),g.current();return}if(c.key!=="Tab"||d===null)return;let b=[...d.querySelectorAll('button, input, textarea, select, [href], [tabindex]:not([tabindex="-1"])')].filter(u=>!u.hasAttribute("disabled")&&u.offsetParent!==null);if(b.length===0)return;let y=b[0],N=b[b.length-1];y===void 0||N===void 0||(c.shiftKey&&document.activeElement===y?(c.preventDefault(),N.focus()):!c.shiftKey&&document.activeElement===N&&(c.preventDefault(),y.focus()))};return document.addEventListener("keydown",h,!0),()=>{document.removeEventListener("keydown",h,!0),p instanceof HTMLElement&&typeof p.focus=="function"&&p.focus()}},[]),e("div",{className:"gitp-modal-layer",onMouseDown:p=>{p.target===p.currentTarget&&g.current()}},e("div",{className:j("gitp-modal",a&&"is-danger"),ref:r,role:"dialog","aria-modal":"true","aria-label":t},e("div",{className:"gitp-modal-head"},e("div",{className:"gitp-modal-title"},t),e(xe,{label:o,icon:k.close,onClick:i})),n))}function bt({title:t,body:i,confirmLabel:n,cancelLabel:a,danger:o,busy:r,onConfirm:g,onClose:p}){return e(Ke,{title:t,onClose:p,danger:o},e("div",{className:"gitp-modal-sub"},i),e("div",{className:"gitp-modal-actions"},e("button",{type:"button",className:"gitp-btn",onClick:p,disabled:r},a),e("button",{type:"button",className:j("gitp-btn",o?"is-danger":"is-primary"),onClick:g,disabled:r},r?e(ee):null,n)))}function Ji({t,defaultName:i,defaultMessage:n,busy:a,noVerify:o,error:r,onCreate:g,onNoVerify:p,onClose:d}){let[l,h]=w(i),[c,b]=w(n),y=I(null);Jt(y,c);let N=l.trim()!==""&&c.trim()!==""&&!a;return e(Ke,{title:t("branch.title"),onClose:d,closeLabel:t("action.close")},e("div",{className:"gitp-field"},e("label",{htmlFor:"gitp-branch-name"},t("branch.name")),e("input",{id:"gitp-branch-name",value:l,onChange:u=>h(u.target.value),spellCheck:!1,autoComplete:"off"}),e("div",{className:"gitp-field-hint"},t("branch.nameHint"))),e("div",{className:"gitp-field"},e("label",{htmlFor:"gitp-branch-message"},t("branch.message")),e("textarea",{id:"gitp-branch-message",ref:y,value:c,onChange:u=>b(u.target.value)})),e("label",{className:"gitp-dialog-option",title:t("commit.noVerifyHint")},e("input",{type:"checkbox",checked:o,onChange:u=>p(u.target.checked),disabled:a}),t("commit.noVerify")),r?e("div",{className:"gitp-modal-error"},r):null,e("div",{className:"gitp-modal-actions"},e("button",{type:"button",className:"gitp-btn",onClick:d,disabled:a},t("action.cancel")),e("button",{type:"button",className:"gitp-btn is-primary",disabled:!N,onClick:()=>g({name:l.trim(),message:c.trim()})},a?e(ee):null,t("action.createBranch"))))}function Zi({t,files:i,busy:n,error:a,onCreate:o,onClose:r}){let[g,p]=w(()=>new Set(i.map(c=>c.path))),[d,l]=w(""),h=c=>{p(b=>{let y=new Set(b);return y.has(c)?y.delete(c):y.add(c),y})};return e(Ke,{title:t("stash.title"),onClose:r,closeLabel:t("action.close")},e("div",{className:"gitp-modal-sub"},t("stash.selectHint")),i.length>1?e("div",{style:{display:"flex",justifyContent:"flex-end",marginBottom:"4px"}},e("button",{type:"button",className:"gitp-linkbtn",onClick:()=>p(g.size===i.length?new Set:new Set(i.map(c=>c.path)))},g.size===i.length?t("stash.deselectAll"):t("stash.selectAll"))):null,i.length===0?e("div",{className:"gitp-modal-sub"},t("stash.nothing")):e("div",{className:"gitp-filechecks"},i.map(c=>e("label",{className:"gitp-check",key:c.path},e("input",{type:"checkbox",checked:g.has(c.path),onChange:()=>h(c.path)}),e("span",{className:"gitp-check-path"},c.path)))),e("div",{className:"gitp-field"},e("label",{htmlFor:"gitp-stash-message"},t("stash.message")),e("input",{id:"gitp-stash-message",value:d,onChange:c=>l(c.target.value),placeholder:t("stash.default")})),a?e("div",{className:"gitp-modal-error"},a):null,e("div",{className:"gitp-modal-actions"},e("button",{type:"button",className:"gitp-btn",onClick:r,disabled:n},t("action.cancel")),e("button",{type:"button",className:"gitp-btn is-primary",disabled:n||g.size===0,onClick:()=>o({paths:[...g],message:d.trim()})},n?e(ee):null,t("action.stash"))))}function dt({entry:t,side:i,selected:n,busy:a,t:o,onSelect:r,onToggle:g}){let p=Ue(t.path),d=i==="staged"?t.stagedAdd:t.add,l=i==="staged"?t.stagedDel:t.del,h=o(i==="staged"?"action.unstageFile":"action.stageFile");return e("div",{className:j("gitp-filerow",n&&"is-selected"),role:"button",tabIndex:0,"aria-current":n?"true":void 0,onClick:()=>r(),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),r())}},e("span",{className:j("gitp-status",ft(t.letter))},t.letter),e("span",{className:"gitp-filename"},p.dir?e("span",{className:"gitp-filedir"},p.dir):null,p.base,t.both?e("span",{className:"gitp-both-tag",title:o("meta.partialHint")},o("meta.partial")):null),t.binary?e("span",{className:"gitp-delta"},o("meta.binary")):e("span",{className:"gitp-delta"},d!==null&&d>0?e("span",{className:"gitp-add"},`+${d}`):null,l!==null&&l>0?e("span",{className:"gitp-del"},`\u2212${l}`):null),i==="conflict"?null:e("button",{type:"button",className:"gitp-rowaction","aria-label":h,title:h,disabled:a,onClick:c=>{c.stopPropagation(),g()}},e(H,{path:i==="staged"?k.minus:k.plus,size:14})))}function Qi({t,snapshot:i,conflicts:n,staged:a,unstaged:o,selection:r,onSelect:g,busy:p,fileBusy:d,onToggleFile:l,onToggleAll:h,onDiscard:c,diff:b,diffLoading:y,layout:N,onLayout:u,onRefresh:m,onBlock:C,onResolve:V,onOpen:S,message:$,onMessage:T,onCommit:F,onBranch:P,canCommit:W,commitBusy:L,aiBusy:R,aiMenuOpen:O,onAiToggle:U,onAiClose:_,onAiWrite:X,onAiBranch:De,selectionKey:le,amend:ge,onAmend:D,noVerify:K,onNoVerify:ce,canAmend:ie,compact:Ce,onBack:we}){let[se,oe]=w(""),[be,he]=Xt(),ze=I(null),Ae=I(null),Le=I(null);Jt(Le,$);let[Y,Oe]=w({conflicts:!1,staged:!1,unstaged:!1}),re=f=>Oe(ae=>({...ae,[f]:!ae[f]})),de=se.trim().toLowerCase(),Me=f=>de===""||f.path.toLowerCase().includes(de),ke=Ne(()=>n.filter(Me),[n,de]),J=Ne(()=>a.filter(Me),[a,de]),me=Ne(()=>o.filter(Me),[o,de]),Z=r===null||r.side==="conflict"?null:(r.side==="staged"?a:o).find(f=>f.path===r.path)??null,ve=Ne(()=>{let f=0,ae=0;for(let Be of a)f+=Be.stagedAdd??0,ae+=Be.stagedDel??0;return{add:f,del:ae}},[a]),v=!Ce||r===null,M=!Ce||r!==null,z=ke.length+J.length+me.length,G=n.length+a.length+o.length;return e("div",{className:"gitp-changes",ref:ze},v?e("div",{className:"gitp-listcol",ref:Ae,style:Ce?void 0:{width:`${be}px`}},G>0?e("div",{className:"gitp-filter-box"},e(H,{path:k.search,size:13}),e("input",{type:"text",value:se,onChange:f=>oe(f.target.value),placeholder:t("filter.placeholder"),"aria-label":t("filter.placeholder"),spellCheck:!1}),se?e("button",{type:"button",className:"gitp-filter-clear",onClick:()=>oe(""),"aria-label":t("filter.clear")},e(H,{path:k.close,size:10})):null):null,e("div",{className:"gitp-filelist"},ke.length>0?e(te.default.Fragment,null,e("div",{className:"gitp-section-head is-conflict",onClick:()=>re("conflicts"),onKeyDown:f=>{f.target!==f.currentTarget||f.key!=="Enter"&&f.key!==" "||(f.preventDefault(),re("conflicts"))},role:"button","aria-expanded":!Y.conflicts,tabIndex:0},e(H,{path:k.chevron,size:14,className:j("gitp-section-chev",Y.conflicts&&"is-collapsed")}),e("span",{className:"gitp-section-title"},t("section.conflicts")),e("span",{className:"gitp-section-count"},String(ke.length))),Y.conflicts?null:ke.map(f=>e(dt,{key:`conflict:${f.path}`,entry:f,side:"conflict",selected:r?.side==="conflict"&&r.path===f.path,busy:d,t,onSelect:()=>g({side:"conflict",path:f.path,renamed:!1}),onToggle:()=>{}}))):null,J.length>0?e(te.default.Fragment,null,e("div",{className:"gitp-section-head",onClick:()=>re("staged"),onKeyDown:f=>{f.target!==f.currentTarget||f.key!=="Enter"&&f.key!==" "||(f.preventDefault(),re("staged"))},role:"button","aria-expanded":!Y.staged,tabIndex:0},e(H,{path:k.chevron,size:14,className:j("gitp-section-chev",Y.staged&&"is-collapsed")}),e("span",{className:"gitp-section-title"},t("section.staged")),e("span",{className:"gitp-section-count"},String(J.length)),e("button",{type:"button",className:"gitp-section-action","aria-label":t("action.unstageAll"),title:t("action.unstageAll"),disabled:d,onClick:f=>{f.stopPropagation(),h("staged")}},e(H,{path:k.minus,size:14}))),Y.staged?null:J.map(f=>e(dt,{key:`staged:${f.path}`,entry:f,side:"staged",selected:r?.side==="staged"&&r.path===f.path,busy:d,t,onSelect:()=>g({side:"staged",path:f.path,renamed:f.kind==="renamed"}),onToggle:()=>l(f,"staged")}))):null,me.length>0?e(te.default.Fragment,null,e("div",{className:"gitp-section-head",onClick:()=>re("unstaged"),onKeyDown:f=>{f.target!==f.currentTarget||f.key!=="Enter"&&f.key!==" "||(f.preventDefault(),re("unstaged"))},role:"button","aria-expanded":!Y.unstaged,tabIndex:0},e(H,{path:k.chevron,size:14,className:j("gitp-section-chev",Y.unstaged&&"is-collapsed")}),e("span",{className:"gitp-section-title"},t("section.unstaged")),e("span",{className:"gitp-section-count"},String(me.length)),e("button",{type:"button",className:"gitp-section-action","aria-label":t("action.stageAll"),title:t("action.stageAll"),disabled:d,onClick:f=>{f.stopPropagation(),h("unstaged")}},e(H,{path:k.plus,size:14}))),Y.unstaged?null:me.map(f=>e(dt,{key:`unstaged:${f.path}`,entry:f,side:"unstaged",selected:r?.side==="unstaged"&&r.path===f.path,busy:d,t,onSelect:()=>g({side:"unstaged",path:f.path,renamed:f.kind==="renamed"}),onToggle:()=>l(f,"unstaged")}))):null,de!==""&&z===0?e("div",{className:"gitp-center",style:{padding:"24px"}},t("filter.empty",{filter:se})):null,G===0?e(ue,{icon:e(H,{path:k.check,size:28}),title:t("empty.noChanges"),hint:t("empty.noChangesHint"),action:e("button",{type:"button",className:"gitp-btn is-small",onClick:m,disabled:p},t("action.refresh"))}):null),e("div",{className:"gitp-commitbox"},e("textarea",{ref:Le,value:$,onChange:f=>T(f.target.value),onKeyDown:f=>{f.defaultPrevented||(f.ctrlKey||f.metaKey)&&f.key==="Enter"&&(f.preventDefault(),W&&!L&&F())},placeholder:t("commit.placeholder"),"aria-label":t("commit.placeholder")}),e("div",{className:j("gitp-commit-status-line",n.length>0&&"has-conflict")},n.length>0?e("span",null,t("commit.hintConflict")):a.length>0?e(te.default.Fragment,null,e("span",null,t("commit.stagedSummary",{count:a.length})," ",e("span",{className:"gitp-add"},`+${ve.add}`)," ",e("span",{className:"gitp-del"},`\u2212${ve.del}`)),e("span",null,t("commit.shortcut",{key:Wi}))):e("span",null,t("commit.hintStage"))),e("div",{className:"gitp-commit-actions"},e("div",{className:"gitp-commit-opts"},ie?e("label",{className:"gitp-amend"},e("input",{type:"checkbox",checked:ge,onChange:f=>D(f.target.checked)}),t("commit.amend")):null,e("label",{className:"gitp-amend",title:t("commit.noVerifyHint")},e("input",{type:"checkbox",checked:K,onChange:f=>ce(f.target.checked),disabled:L}),t("commit.noVerify"))),e("div",{className:"gitp-ai-wrap"},e("button",{type:"button",className:"gitp-btn is-small is-icon","aria-label":t("ai.action"),"aria-haspopup":"menu","aria-expanded":O===!0,title:t("ai.action"),disabled:L||R||a.length===0,onClick:U},R?e(ee):e(H,{path:k.sparkles,size:13}))),e("button",{type:"button",className:"gitp-btn is-small",onClick:P,disabled:L||n.length>0||a.length===0,"aria-label":t("action.branch")},e(H,{path:k.branch,size:13}),t("action.branch")),e("button",{type:"button",className:"gitp-btn is-primary is-small",onClick:F,disabled:!W||L},L?e(ee):null,t(L?"action.committing":"action.commit"))),O?e(aa,{t,busy:R,canUse:a.length>0,canBranch:a.length>0&&n.length===0,onWrite:X,onBranch:De,onClose:_}):null)):null,v&&M?e(Qt,{label:t("split.files"),containerRef:ze,columnRef:Ae,width:be,onChange:he}):null,M?e("div",{className:"gitp-diffcol"},r?e(Zt,{t,diff:b,loading:y,layout:N,onLayout:u,onBlock:C,onResolve:V,busy:d,selectionKey:le,renamed:r.renamed===!0,compact:Ce,onBack:we,onOpen:S,onDiscard:Z===null?void 0:()=>c(Z)}):e(ue,{icon:e(H,{path:k.file,size:28}),title:t("empty.selectFile"),hint:t("empty.selectFileHint")})):null)}function Zt({t,diff:i,loading:n,layout:a,onLayout:o,onBlock:r,onResolve:g,busy:p,selectionKey:d,renamed:l=!1,compact:h,onBack:c,onOpen:b,onDiscard:y}){let N=I(null),[u,m]=w({index:-1,canPrev:!1,canNext:!1}),C=Ne(()=>i===null?[]:[...i.blocks??[]].sort((P,W)=>P.row-W.row),[i]),V=()=>{let P=N.current;if(P===null)return[];let W=[...P.querySelectorAll(".gitp-pane")];if(W.length>0)return W;let L=P.querySelector(".gitp-unified");return L===null?[]:[L]},S=P=>{let W=-1;for(let L=0;L<C.length;L+=1){let R=C[L];R!==void 0&&R.row*Ee<=P+40&&(W=L)}return{index:W,canPrev:W>0,canNext:C.some(L=>L.row*Ee>P+40)}};A(()=>{let P=N.current;if(P===null)return;let W=0,L=()=>{let O=V()[0];m(S(O===void 0?0:O.scrollTop))},R=()=>{W===0&&(W=requestAnimationFrame(()=>{W=0,L()}))};return P.addEventListener("scroll",R,!0),L(),()=>{P.removeEventListener("scroll",R,!0),W!==0&&cancelAnimationFrame(W)}},[i,a]);let $=P=>{let W=V()[0],L=W===void 0?0:W.scrollTop,R=null;if(P>0)R=C.find(X=>X.row*Ee>L+40)??null;else{for(let X of C)X.row*Ee<=L+40&&(R=X);R=R===null?null:C[C.indexOf(R)-1]??null}if(R===null)return;let O=Math.max(0,R.row*Ee-40),U=V();for(let X of U)X.scrollTop=O;let _=U[0]===void 0?O:U[0].scrollTop;m(S(_))};if(n&&i===null)return e("div",{className:"gitp-diff"},e("div",{className:"gitp-center"},e(ee),e("div",{className:"gitp-center-hint"},t("diff.loading"))));if(i===null)return e("div",{className:"gitp-diff"},e(ue,{icon:e(H,{path:k.file,size:28}),title:t("empty.selectFile"),hint:t("empty.selectFileHint")}));let T=Ue(i.path),F={left:i.labels.left==="HEAD"?t("diff.head"):i.labels.left==="Staged"?t("diff.staged"):i.labels.left==="Local"?t("diff.local"):i.labels.left==="Parent"?t("diff.parent"):i.labels.left,right:i.labels.right==="Staged"?t("diff.staged"):i.labels.right==="Local"?t("diff.local"):i.labels.right==="Commit"?t("diff.commit"):i.labels.right==="Incoming"?t("action.acceptTheirs"):i.labels.right};return e("div",{className:"gitp-diff",ref:N},e("div",{className:"gitp-diff-head"},h&&c?e(xe,{label:t("action.back"),icon:k.left,onClick:c}):null,e("div",{className:"gitp-diff-title"},e("span",{className:j("gitp-status",ft(i.conflict?"C":"M"))},i.conflict?"C":"M"),e("div",{className:"gitp-diff-path"},T.dir?e("span",{className:"gitp-diff-dir"},T.dir):null,e("span",{className:"gitp-diff-base"},T.base)),i.conflict?e("span",{className:"gitp-diff-pill is-conflict"},t("section.conflicts")):i.side==="staged"?e("span",{className:"gitp-diff-pill is-staged"},t("diff.staged")):i.side==="unstaged"?e("span",{className:"gitp-diff-pill is-unstaged"},t("diff.unstaged")):i.side==="log"?e("span",{className:"gitp-diff-pill is-commit"},t("diff.commit")):null),i.conflict?e("span",{className:"gitp-diff-stats gitp-del"},t("section.conflicts")):i.binary?e("span",{className:"gitp-diff-stats"},t("diff.binary")):e("span",{className:"gitp-diff-stats"},e("span",{className:"gitp-add"},`+${i.add??0}`),e("span",{className:"gitp-del"},`\u2212${i.del??0}`)),C.length>0&&!i.conflict&&!i.binary?e("div",{className:"gitp-change-nav",role:"group","aria-label":t("diff.changes")},e(xe,{label:t("action.prevChange"),icon:k.chevronUp,onClick:()=>$(-1),disabled:!u.canPrev}),e("span",{className:"gitp-change-count"},`${Math.max(0,u.index)+1}/${C.length}`),e(xe,{label:t("action.nextChange"),icon:k.chevron,onClick:()=>$(1),disabled:!u.canNext})):null,e("div",{className:"gitp-diff-actions"},b!==void 0&&!i.binary?e(xe,{label:t("action.openEditor"),icon:k.code,onClick:()=>b(i)}):null,i.conflict?null:e("div",{className:"gitp-seg",role:"group","aria-label":t("diff.layout")},e("button",{type:"button",className:a==="split"?"is-active":"","aria-pressed":a==="split","aria-label":t("diff.split"),title:t("diff.split"),onClick:()=>o("split")},e(H,{path:k.split,size:13})),e("button",{type:"button",className:a==="unified"?"is-active":"","aria-pressed":a==="unified","aria-label":t("diff.unified"),title:t("diff.unified"),onClick:()=>o("unified")},e(H,{path:k.unified,size:13}))),y!==void 0?e(xe,{label:t("action.discard"),icon:k.trash,onClick:y,disabled:p}):null)),i.conflict?e("div",{className:"gitp-conflict-banner"},e(H,{path:k.warning,size:14}),e("span",null,t("diff.conflictBanner")),e("button",{type:"button",className:"gitp-btn is-small",onClick:()=>g?.("ours"),disabled:p},t("action.acceptOurs")),e("button",{type:"button",className:"gitp-btn is-small",onClick:()=>g?.("theirs"),disabled:p},t("action.acceptTheirs"))):null,i.binary?e("div",{className:"gitp-binary"},e("div",{className:"gitp-binary-title"},t("diff.binary")),e("div",null,t("diff.binaryHint",{before:i.leftSize??0,after:i.rightSize??0}))):i.conflict?e(ea,{diff:i}):a==="unified"?e(ia,{t,diff:i,onBlock:r,busy:p,selectionKey:d,renamed:l}):e(ta,{t,diff:i,labels:F,onBlock:r,busy:p,selectionKey:d,renamed:l}),!i.binary&&!i.conflict?e("div",{className:"gitp-diff-foot"},e("span",{className:"gitp-diff-legend"},e("span",{className:"gitp-diff-dot is-add"}),t("diff.added")),e("span",{className:"gitp-diff-legend"},e("span",{className:"gitp-diff-dot is-del"}),t("diff.removed")),e("span",{className:"gitp-diff-foot-spacer"}),e("span",null,C.length===1?t("diff.blockCountOne"):t("diff.blockCount",{count:C.length}))):null)}function ea({diff:t}){return e("div",{className:"gitp-unified"},t.right.map((i,n)=>e("div",{className:j("gitp-urow",/^(<{7}|={7}|>{7})/.test(i)&&"is-conflict-marker"),key:n},e("span",{className:"gitp-uno"},n+1),e("span",{className:"gitp-ucontent"},i||"\xA0"))))}function ta({t,diff:i,labels:n,onBlock:a,busy:o,selectionKey:r,renamed:g}){let p=I(null),d=I(null),l=I(null),h=u=>{l.current&&(l.current.style.transform=`translateY(${-u}px)`)},c=u=>{let m=u.scrollTop;p.current&&p.current!==u&&(p.current.scrollTop=m),d.current&&d.current!==u&&(d.current.scrollTop=m),h(m)};A(()=>{let u=i.blocks[0];if(!u||u.row<=10)return;let m=Math.max(0,u.row*Ee-80);p.current&&(p.current.scrollTop=m),d.current&&(d.current.scrollTop=m),h(m)},[r]);let b=Ne(()=>{let u=new Map;for(let m of i.rows){if(m.k!=="mod"||m.l===null||m.r===null)continue;let C=i.left[m.l-1]??"",V=i.right[m.r-1]??"";u.set(m,_i(C,V))}return u},[i]),y=Ne(()=>{let u=new Map;for(let m of i.blocks)u.set(m.row,m);return u},[i]),N=u=>{if(g)return[];let m={action:"unstaged",icon:k.left,label:t("action.stageBlock"),revert:!1},C={action:"revert",icon:k.right,label:t("action.revertBlock"),revert:!0};return i.side==="unstaged"?i.leftMissing?[m]:[m,C]:i.side==="staged"?[{action:"staged",icon:k.right,label:t("action.unstageBlock"),revert:!1}]:[]};return e(te.default.Fragment,null,e("div",{className:"gitp-pane-heads"},e("div",{className:"gitp-pane-head"},n.left),e("div",{className:"gitp-pane-head-gutter"}),e("div",{className:"gitp-pane-head"},n.right)),e("div",{className:"gitp-panes"},e("div",{className:"gitp-pane",ref:p,tabIndex:0,role:"region","aria-label":n.left,onScroll:u=>c(u.currentTarget)},i.rows.map((u,m)=>{let C=u.l?i.left[u.l-1]??"":"",V=u.k==="add"?"blank":u.k==="mod"?"del":u.k,S=b.get(u);return e("div",{className:j("gitp-line",V!=="ctx"&&`is-${V}`),key:`l${m}`},e("span",{className:"gitp-ln"},u.l??""),e("span",{className:"gitp-code"},u.l===null?"\xA0":S?Wt(S.lPre,S.lMid,S.lSuf):C||"\xA0"))})),e("div",{className:"gitp-gutter","aria-hidden":!1},e("div",{className:"gitp-gutter-inner",ref:l},i.blocks.map(u=>{let m=N(u);return m.length===0?null:e("div",{className:"gitp-arrows",key:u.id,style:{top:u.row*Ee}},m.map(C=>e("button",{type:"button",className:j("gitp-arrow",C.revert&&"is-revert"),key:C.action,"aria-label":C.label,title:C.label,disabled:o,onClick:()=>a(u,C.action)},e(H,{path:C.icon,size:12}))))}))),e("div",{className:"gitp-pane",ref:d,tabIndex:0,role:"region","aria-label":n.right,onScroll:u=>c(u.currentTarget)},i.rows.map((u,m)=>{let C=u.r?i.right[u.r-1]??"":"",V=u.k==="del"?"blank":u.k==="mod"?"add":u.k,S=b.get(u);return e("div",{className:j("gitp-line",V!=="ctx"&&`is-${V}`),key:`r${m}`},e("span",{className:"gitp-ln"},u.r??""),e("span",{className:"gitp-code"},u.r===null?"\xA0":S?Wt(S.rPre,S.rMid,S.rSuf):C||"\xA0"))}))))}function ia({t,diff:i,onBlock:n,busy:a,selectionKey:o,renamed:r}){let g=Ne(()=>{let l=new Map;for(let c of i.blocks)l.set(c.row,c);let h=[];return i.rows.forEach((c,b)=>{let y=l.get(b),N=c.l===null?"":i.left[c.l-1]??"",u=c.r===null?"":i.right[c.r-1]??"";c.k==="ctx"?h.push({l:c.l,r:c.r,text:N,kind:"ctx",block:y}):c.k==="mod"?(h.push({l:c.l,r:null,text:N,kind:"del",block:y}),h.push({l:null,r:c.r,text:u,kind:"add"})):c.k==="del"?h.push({l:c.l,r:null,text:N,kind:"del",block:y}):h.push({l:null,r:c.r,text:u,kind:"add",block:y})}),h},[i]),p=I(null);A(()=>{let l=g.find(h=>h.block!==void 0);!l||g.indexOf(l)<=10||p.current===null||(p.current.scrollTop=Math.max(0,g.indexOf(l)*Ee-80))},[o]);let d=l=>{if(r)return[];let h={action:"unstaged",icon:k.left,label:t("action.stageBlock"),revert:!1},c={action:"revert",icon:k.right,label:t("action.revertBlock"),revert:!0};return i.side==="unstaged"?i.leftMissing?[h]:[h,c]:i.side==="staged"?[{action:"staged",icon:k.right,label:t("action.unstageBlock"),revert:!1}]:[]};return e("div",{className:"gitp-unified",ref:p,tabIndex:0,role:"region","aria-label":t("diff.unified")},g.map((l,h)=>{let c=l.block?d(l.block):[];return e("div",{className:j("gitp-urow",l.kind!=="ctx"&&`is-${l.kind}`),key:h},e("span",{className:"gitp-uarrows"},c.map(b=>e("button",{type:"button",className:j("gitp-arrow",b.revert&&"is-revert"),key:b.action,"aria-label":b.label,title:b.label,disabled:a,onClick:()=>{l.block!==void 0&&n(l.block,b.action)}},e(H,{path:b.icon,size:12})))),e("span",{className:"gitp-uno"},l.l??""),e("span",{className:"gitp-uno"},l.r??""),e("span",{className:"gitp-ucontent"},l.text||"\xA0"))}))}function aa({t,busy:i,canUse:n,canBranch:a,onWrite:o,onBranch:r,onClose:g}){let p=I(g);p.current=g;let d=I(null);A(()=>{let h=b=>{b.key==="Escape"&&(b.preventDefault(),b.stopPropagation(),p.current())},c=b=>{let y=b.target;d.current!==null&&y instanceof Node&&d.current.contains(y)||y instanceof Element&&y.closest(".gitp-ai-wrap")!==null||p.current()};return document.addEventListener("keydown",h,!0),document.addEventListener("mousedown",c,!0),()=>{document.removeEventListener("keydown",h,!0),document.removeEventListener("mousedown",c,!0)}},[]);let l=(h,c,b,y,N)=>e("button",{type:"button",key:h,className:"gitp-popover-row",role:"menuitem",disabled:y,onClick:N},e(H,{path:c,size:13}),e("span",{className:"gitp-popover-row-text"},b));return e("div",{className:"gitp-popover is-menu",ref:d,role:"menu","aria-label":t("ai.action")},l("write",k.sparkles,t("ai.write"),!n||i,o),l("branch",k.branch,t("ai.branch"),!a||i,r))}function na({t,workspaceTitle:i,branch:n,repo:a,ahead:o,behind:r,upstream:g,onBranchMenu:p,onRepoMenu:d,repos:l,repoRoot:h,onSync:c,busy:b,onRefresh:y,syncing:N}){let u=n?.name??(n?.oid?Pe(n.oid):t(a===!1?"empty.noRepo":"status.detached")),m=l.find($=>$.root===h)??null,C=l[0],V=l.length>1||C!==void 0&&l.length===1&&C.name!=="."&&!C.name.startsWith(".."),S=m===null?t("repo.none"):m.name==="."?t("repo.workspace"):m.label??m.name;return e("div",{className:"gitp-head"},e("div",{className:"gitp-head-left"},e("span",{className:"gitp-repo"},i),V?e("button",{type:"button",className:"gitp-branch gitp-repo-pick",onClick:d,"aria-haspopup":"listbox","aria-label":t("repo.pick"),title:t("repo.pick")},e(H,{path:k.folder,size:13}),e("span",{className:"gitp-branch-name"},S),e("span",{className:"gitp-chevron"},e(H,{path:k.chevron,size:11}))):null,e("button",{type:"button",className:"gitp-branch",onClick:p,disabled:a===!1,"aria-haspopup":"listbox","aria-label":t("branch.title"),title:t("branch.title")},e(H,{path:k.branch,size:13}),e("span",{className:"gitp-branch-name"},u),e("span",{className:"gitp-chevron"},e(H,{path:k.chevron,size:11})))),e("div",{className:"gitp-head-right"},e(ct,{label:t("action.fetch"),icon:k.fetch,count:0,onClick:()=>c("fetch"),busy:N==="fetch",disabled:b}),e(ct,{label:t("action.pull"),icon:k.pull,count:r,onClick:()=>c("pull"),busy:N==="pull",disabled:b||g===null}),e(ct,{label:t("action.push"),icon:k.push,count:o,onClick:()=>c("push"),busy:N==="push",disabled:b}),e(xe,{label:t("action.refresh"),icon:k.refresh,onClick:y,disabled:b})))}function sa({t,mode:i,onMode:n,counts:a}){let o=[{id:"changes",label:t("mode.changes"),count:a.changes},{id:"log",label:t("mode.log"),count:0},{id:"stash",label:t("mode.stash"),count:0}];return e("nav",{className:"gitp-rail","aria-label":t("panel")},o.map(r=>e("button",{type:"button",key:r.id,className:j("gitp-rail-item",i===r.id&&"is-active"),onClick:()=>n(r.id),"aria-label":r.count>0?`${r.label}, ${r.count}`:r.label,"aria-current":i===r.id?"page":void 0},e("span",{className:"gitp-rail-label"},r.label),r.count>0?e("span",{className:"gitp-rail-count"},String(r.count)):null)))}function oa({t,repos:i,current:n,onPick:a,onInitRoot:o,onClose:r}){let g=I(null),p=I(r);p.current=r,A(()=>{g.current?.querySelector("button:not(:disabled)")?.focus();let l=h=>{h.key==="Escape"&&(h.preventDefault(),h.stopPropagation(),p.current())};return document.addEventListener("keydown",l,!0),()=>document.removeEventListener("keydown",l,!0)},[]);let d=!i.some(l=>l.name==="."||l.name.startsWith(".."));return e("div",{className:"gitp-popover-layer",onMouseDown:l=>{l.target===l.currentTarget&&p.current()}},e("div",{className:"gitp-popover is-wide",ref:g,role:"listbox","aria-label":t("repo.title")},e("div",{className:"gitp-popover-title"},t("repo.title")),e("div",{className:"gitp-popover-list"},i.map(l=>e("button",{type:"button",key:l.root,className:"gitp-popover-row",role:"option","aria-selected":l.root===n,disabled:l.root===n,onClick:()=>a(l.root)},e(H,{path:k.folder,size:13}),e("span",{className:"gitp-popover-row-text"},l.name==="."?t("repo.workspace"):l.label??l.name),l.root===n?e(H,{path:k.check,size:13,className:"gitp-checkmark"}):null))),d?e(te.default.Fragment,null,e("div",{className:"gitp-popover-sep"}),e("button",{type:"button",className:"gitp-popover-row",onClick:o},e(H,{path:k.plus,size:13}),e("span",{className:"gitp-popover-row-text"},t("repo.initRoot")))):null))}function ra({t,branches:i,loading:n,busy:a,onCheckout:o,onNew:r,onClose:g}){let p=I(null),d=I(g);d.current=g;let[l,h]=w("");A(()=>{p.current?.querySelector("input")?.focus();let S=$=>{$.key==="Escape"&&($.preventDefault(),$.stopPropagation(),d.current())};return document.addEventListener("keydown",S,!0),()=>document.removeEventListener("keydown",S,!0)},[]);let c=l.trim().toLowerCase(),b=i.filter(S=>!S.remote),y=new Set(b.map(S=>S.name)),N=i.filter(S=>{if(!S.remote)return!1;let $=S.name.split("/").slice(1).join("/");return $!==""&&!y.has($)}),u=S=>c===""||S.name.toLowerCase().includes(c),m=b.filter(u),C=N.filter(u),V=(S,$)=>S.map(T=>e("button",{type:"button",key:`${$?"r":"l"}:${T.name}`,className:"gitp-popover-row",role:"option","aria-selected":T.current===!0,disabled:a||T.current===!0,onClick:()=>o(T.name,$)},e(H,{path:k.branch,size:13}),e("span",{className:"gitp-popover-row-text"},T.name),T.current?e(H,{path:k.check,size:13,className:"gitp-checkmark"}):null));return e("div",{className:"gitp-popover-layer",onMouseDown:S=>{S.target===S.currentTarget&&d.current()}},e("div",{className:"gitp-popover is-wide",ref:p,role:"listbox","aria-label":t("branch.local")},e("input",{className:"gitp-search",value:l,placeholder:t("branch.search"),onChange:S=>h(S.target.value),"aria-label":t("branch.search")}),e("button",{type:"button",className:"gitp-popover-row",disabled:a,onClick:r},e(H,{path:k.plus,size:13}),e("span",{className:"gitp-popover-row-text"},t("branch.new"))),e("div",{className:"gitp-popover-sep"}),n?e("div",{className:"gitp-modal-sub"},t("branch.loading")):null,!n&&m.length===0&&C.length===0?e("div",{className:"gitp-modal-sub"},t(c===""?"branch.none":"branch.noneMatch")):null,m.length>0?e(te.default.Fragment,null,e("div",{className:"gitp-popover-title"},t("branch.local")),e("div",{className:"gitp-popover-list"},V(m,!1))):null,C.length>0?e(te.default.Fragment,null,e("div",{className:"gitp-popover-title"},t("branch.remote")),e("div",{className:"gitp-popover-list"},V(C,!0))):null))}function la({t,busy:i,error:n,onCreate:a,onClose:o}){let[r,g]=w("");return e(Ke,{title:t("branch.newTitle"),onClose:o,closeLabel:t("action.close")},e("div",{className:"gitp-field"},e("label",{htmlFor:"gitp-new-branch"},t("branch.name")),e("input",{id:"gitp-new-branch",value:r,onChange:p=>g(p.target.value),spellCheck:!1,autoComplete:"off"}),e("div",{className:"gitp-field-hint"},t("branch.newHint"))),n?e("div",{className:"gitp-modal-error"},n):null,e("div",{className:"gitp-modal-actions"},e("button",{type:"button",className:"gitp-btn",onClick:o,disabled:i},t("action.cancel")),e("button",{type:"button",className:"gitp-btn is-primary",disabled:i||r.trim()==="",onClick:()=>a({name:r.trim()})},i?e(ee):null,t("action.createAndSwitch"))))}function ca(t,i,n,a){let o=i?.branch??null,r=i?.merging===!0||i?.rebasing===!0||i?.reverting===!0||i?.cherryPicking===!0,g=(i?.conflicts?.length??0)>0,p=(i?.entries??[]).some(N=>N.staged),d=o===null||o.detached===!0,l=o?.oid!==null&&o?.oid!==void 0&&o.oid===t.hash,h=typeof o?.upstream=="string"&&o.upstream!==""&&o.ahead===0,c=(t.parents?.length??0)>1,b=[];b.push({id:"copy",label:a("history.copy"),icon:k.copy,hint:null,reason:null});let y=null;return r?y=a("history.blockedOperation"):d?y=a("history.blockedDetached"):l?(t.parents?.length??0)===0?y=a("history.blockedNoParent"):h&&(y=a("history.blockedPushed")):y=a("history.blockedNotHead"),b.push({id:"undo",label:a("history.undo"),icon:k.undo,hint:a("history.undoHint"),reason:y}),y=null,r?y=a("history.blockedOperation"):c?y=a("history.blockedMerge"):g?y=a("history.blockedConflict"):p&&(y=a("history.blockedStaged")),b.push({id:"revert",label:a("history.revert"),icon:k.revert,hint:a("history.revertHint"),reason:y}),y=null,r?y=a("history.blockedOperation"):c?y=a("history.blockedMerge"):g?y=a("history.blockedConflict"):n.has(t.hash)&&(y=a("history.blockedContained")),b.push({id:"cherry",label:a("history.cherryPick"),icon:k.cherry,hint:a("history.cherryPickHint"),reason:y}),y=null,r?y=a("history.blockedOperation"):d&&(y=a("history.blockedDetached")),b.push({id:"reset",label:a("history.reset"),icon:k.reset,hint:a("history.resetHint"),reason:y}),b}function da({t,commit:i,rows:n,busy:a,onPick:o,onClose:r}){let g=I(null),p=I(r),d=I(null);return p.current=r,A(()=>{d.current=document.activeElement instanceof HTMLElement?document.activeElement:null,g.current?.querySelector("button:not(:disabled)")?.focus();let l=h=>{h.key==="Escape"&&(h.preventDefault(),h.stopPropagation(),p.current())};return document.addEventListener("keydown",l,!0),()=>{document.removeEventListener("keydown",l,!0),d.current&&typeof d.current.focus=="function"&&d.current.focus()}},[]),e("div",{className:"gitp-popover-layer",onMouseDown:l=>{l.target===l.currentTarget&&p.current()}},e("div",{className:"gitp-popover is-wide",ref:g,role:"menu","aria-label":t("history.actions")},e("div",{className:"gitp-popover-title"},t("history.actions")),e("div",{className:"gitp-popover-blurb",title:i.subject},`${Pe(i.hash)} \xB7 ${i.subject}`),e("div",{className:"gitp-popover-sep"}),n.map(l=>e("button",{type:"button",key:l.id,className:"gitp-action-row",role:"menuitem",disabled:a||l.reason!==null,title:l.reason??l.hint??void 0,onClick:()=>o(l.id)},e(H,{path:l.icon??k.more,size:13}),e("span",{className:"gitp-action-text"},e("span",{className:"gitp-action-label"},l.label),l.reason!==null||l.hint!==null?e("span",{className:"gitp-action-reason"},l.reason??l.hint):null)))))}function pa({t,commit:i,busy:n,error:a,onReset:o,onClose:r}){let[g,p]=w("soft"),d=[["soft","history.resetModeSoft","history.resetModeSoftHint"],["mixed","history.resetModeMixed","history.resetModeMixedHint"],["hard","history.resetModeHard","history.resetModeHardHint"]];return e(Ke,{title:t("history.resetTitle"),onClose:r,danger:g==="hard"},e("div",{className:"gitp-modal-sub"},t("history.resetBody",{hash:Pe(i.hash)})),e("div",{role:"radiogroup","aria-label":t("history.resetTitle")},d.map(([l,h,c])=>e("label",{key:l,className:"gitp-reset-mode"},e("input",{type:"radio",name:"gitp-reset-mode",value:l,checked:g===l,disabled:n,onChange:()=>p(l)}),e("span",{className:"gitp-reset-mode-text"},e("span",{className:"gitp-reset-mode-title"},t(h)),e("span",{className:"gitp-reset-mode-hint"},t(c)))))),g==="hard"?e("div",{className:"gitp-modal-warn",role:"alert"},t("history.resetHardWarning")):null,a!==null?e("div",{className:"gitp-modal-error"},a):null,e("div",{className:"gitp-modal-actions"},e("button",{type:"button",className:"gitp-btn",onClick:r,disabled:n},t("action.cancel")),e("button",{type:"button",className:j("gitp-btn",g==="hard"?"is-danger":"is-primary"),onClick:()=>o(g),disabled:n},n?e(ee):null,t("history.resetAction"))))}function ua({call:t,workspaceId:i,repo:n,t:a,refreshToken:o,compact:r,layout:g,onLayout:p,snapshot:d,onApplied:l}){let[h,c]=w(null),[b,y]=w(null),[N,u]=w(null),[m,C]=w(null),[V,S]=w(null),[$,T]=w(!1),[F,P]=w(!1),[W,L]=w(!1),[R,O]=w(null),[U,_]=w(!1),[X,De]=Xt(),[le,ge]=w(null),[D,K]=w(null),[ce,ie]=w(null),[Ce,we]=w(null),[se,oe]=w(null),[be,he]=w(null),ze=I(null),Ae=I(null),Le=I(n),Y=v=>{navigator?.clipboard?.writeText&&(navigator.clipboard.writeText(v).catch(()=>{}),_(!0),setTimeout(()=>_(!1),2e3))};A(()=>{if(be===null)return;let v=setTimeout(()=>he(null),4e3);return()=>clearTimeout(v)},[be]),A(()=>{ge(null),K(null),ie(null),we(null)},[n]),A(()=>{Le.current!==n&&(Le.current=n,y(null),u(null),C(null),S(null))},[n]),A(()=>{let v=!0,M=new AbortController;return T(!0),t("log",{workspaceId:i,repo:n},M.signal).then(z=>{if(!v)return;let G=qi(z.commits??[]);c(G);let f=G[0];f!==void 0&&y(ae=>ae??f.hash)}).catch(z=>{let G=q(z);v&&G.name!=="AbortError"&&O(G)}).finally(()=>{v&&T(!1)}),()=>{v=!1,M.abort()}},[i,n,o]),A(()=>{if(!b){u(null);return}let v=!0,M=new AbortController;return P(!0),t("commitDetail",{workspaceId:i,repo:n,hash:b},M.signal).then(z=>{if(v){u(z);let G=z.files[0];!r&&G!==void 0?C(f=>f!==null&&z.files.some(ae=>ae.path===f)?f:G.path):r&&C(null),S(null)}}).catch(z=>{let G=q(z);v&&G.name!=="AbortError"&&O(G)}).finally(()=>{v&&P(!1)}),()=>{v=!1,M.abort()}},[i,n,b,r]),A(()=>{if(!m||!N){S(null);return}let v=!0,M=new AbortController;return L(!0),t("diff",{workspaceId:i,repo:n,path:m,side:"log",commit:N.hash,parent:N.parents?.[0]},M.signal).then(z=>{v&&S(z)}).catch(z=>{let G=q(z);v&&G.name!=="AbortError"&&O(G)}).finally(()=>{v&&L(!1)}),()=>{v=!1,M.abort()}},[i,n,m,N]);let Oe=Ne(()=>{let v=new Map;for(let f of h??[])v.set(f.hash,f.parents);let M=new Set,z=[],G=d?.branch?.oid;for(typeof G=="string"&&G!==""&&z.push(G);z.length>0;){let f=z.pop();if(f===void 0)break;if(!M.has(f)){M.add(f);for(let ae of v.get(f)??[])z.push(ae)}}return M},[h,d?.branch?.oid]),re=le===null?[]:ca(le,d,Oe,a);async function de(v){oe("undo");try{let M=await t("undoCommit",{workspaceId:i,repo:n,hash:v.hash});K(null),l({status:M.status,message:M.message,goToChanges:!0,toast:a("history.undone")})}catch(M){K(null),he({text:fe(M),error:!0}),l({})}finally{oe(null)}}async function Me(v){oe("revert");try{let M=await t("revertCommit",{workspaceId:i,repo:n,hash:v.hash});K(null),l({status:M.status,message:M.message,goToChanges:!0,toast:a(M.conflicted?"history.revertConflicts":"history.reverted")})}catch(M){K(null),he({text:fe(M),error:!0}),l({})}finally{oe(null)}}async function ke(v){oe("cherry");try{let M=await t("cherryPickCommit",{workspaceId:i,repo:n,hash:v.hash});he({text:a("history.picked",{hash:Pe(M.hash)}),error:!1}),l({status:M.status})}catch(M){he({text:fe(M),error:!0}),l({})}finally{oe(null)}}async function J(v,M){oe("reset"),we(null);try{let z=await t("resetToCommit",{workspaceId:i,repo:n,hash:v.hash,mode:M,confirm:!0});ie(null),he({text:a("history.resetDone",{hash:Pe(v.hash)}),error:!1}),l({status:z.status})}catch(z){we(fe(z))}finally{oe(null)}}function me(v){let M=le;if(M!==null){if(v==="copy"){Y(M.hash),ge(null),he({text:a("action.copied"),error:!1});return}ge(null),v==="undo"?K({type:"undo",commit:M}):v==="revert"?K({type:"revert",commit:M}):v==="cherry"?ke(M):v==="reset"&&ie(M)}}if($&&h===null)return e(ue,{icon:e(ee),title:a("log.loading")});if(h===null&&R!==null)return e(ue,{icon:e(H,{path:k.warning,size:28}),title:a("error.title"),hint:fe(R)});if(h!==null&&h.length===0)return e(ue,{icon:e(H,{path:k.history,size:28}),title:a("empty.noHistory"),hint:a("empty.noHistoryHint")});let Z=!r||!m,ve=!r||!!m;return e("div",{className:"gitp-changes",ref:ze},Z?e("div",{className:"gitp-listcol",ref:Ae,style:r?void 0:{width:`${X}px`}},e("div",{className:"gitp-loglist"},R?e("div",{className:"gitp-error"},e("span",{className:"gitp-error-text"},fe(R))):null,(h??[]).map(v=>e("button",{type:"button",key:v.hash,className:j("gitp-commitrow",b===v.hash&&"is-selected"),onClick:()=>y(v.hash),onContextMenu:M=>{M.preventDefault(),y(v.hash),ge(v)},"aria-haspopup":"menu"},e("span",{className:"gitp-graph",style:{width:Math.max(14,v.laneCount*10+8)}},e("span",{className:"gitp-graph-line",style:{left:6+v.lane*10}}),e("span",{className:j("gitp-graph-dot",v.lane%4?`g${v.lane%4}`:""),style:{left:6+v.lane*10}})),e("span",{className:"gitp-commitmain"},e("div",{className:"gitp-commit-subject"},v.subject),e("div",{className:"gitp-commit-meta"},e("span",null,v.author),e("span",null,"\xB7"),e("span",null,Gt(v.date))),v.refs.length>0?e("div",{className:"gitp-refs"},v.refs.map(M=>e("span",{key:M,className:j("gitp-ref",M.startsWith("HEAD")&&"is-head")},M.replace(/^HEAD -> /,"")))):null)))),e("div",{className:"gitp-logdetail-summary"},F&&N===null?e("div",{className:"gitp-center",style:{padding:"24px"}},e(ee)):N===null?e(ue,{title:a("log.select")}):e(te.default.Fragment,null,e("div",{className:"gitp-detail-head"},e("div",{className:"gitp-detail-title"},e("div",{className:"gitp-detail-subject"},N.subject),e(xe,{label:a("history.actions"),icon:k.more,disabled:se!==null,onClick:()=>ge({hash:N.hash,parents:N.parents??[],subject:N.subject})})),e("div",{className:"gitp-detail-meta"},e("button",{type:"button",className:"gitp-detail-hash-btn",onClick:()=>Y(N.hash),title:a(U?"action.copied":"action.copyHash")},Pe(N.hash),e(H,{path:U?k.check:k.copy,size:11})),e("span",null,N.author),e("span",null,Gt(N.date)))),N.body?e("div",{className:"gitp-detail-body"},N.body):null,e("div",{className:"gitp-detail-section-head"},e("span",null,a("log.files")),e("span",{className:"gitp-section-count"},String(N.files?.length??0))),e("div",{className:"gitp-detail-files"},!N.files||N.files.length===0?e("div",{className:"gitp-center-hint",style:{padding:"4px 8px"}},a("log.noFiles")):N.files.map(v=>{let M=Ue(v.path);return e("button",{type:"button",key:v.path,className:j("gitp-detail-file",m===v.path&&"is-selected"),onClick:()=>C(v.path)},e("span",{className:j("gitp-status",ft("M"))},"M"),e("span",{className:"gitp-filename"},M.dir?e("span",{className:"gitp-filedir"},M.dir):null,M.base),v.binary?e("span",{className:"gitp-delta"},a("meta.binary")):e("span",{className:"gitp-delta"},v.add!==null&&v.add>0?e("span",{className:"gitp-add"},`+${v.add}`):null,v.del!==null&&v.del>0?e("span",{className:"gitp-del"},`\u2212${v.del}`):null))}))))):null,Z&&ve?e(Qt,{label:a("split.commits"),containerRef:ze,columnRef:Ae,width:X,onChange:De}):null,ve?e("div",{className:"gitp-diffcol"},m?e(Zt,{t:a,diff:V,loading:W,layout:g,onLayout:p,onBlock:()=>{},busy:!0,selectionKey:`${N?.hash??""}:${m}`,compact:r,onBack:r?()=>C(null):void 0}):e(ue,{icon:e(H,{path:k.changes,size:28}),title:a("empty.selectFile"),hint:a("empty.selectFileHint")})):null,le?e(da,{t:a,commit:le,rows:re,busy:se!==null,onPick:me,onClose:()=>ge(null)}):null,D?e(bt,{title:a(D.type==="undo"?"history.undoTitle":"history.revertTitle"),body:a(D.type==="undo"?"history.undoBody":"history.revertBody"),confirmLabel:a(D.type==="undo"?"history.undoAction":"history.revertAction"),cancelLabel:a("action.cancel"),busy:se!==null,onConfirm:()=>D.type==="undo"?de(D.commit):Me(D.commit),onClose:()=>{se===null&&K(null)}}):null,ce?e(pa,{t:a,commit:ce,busy:se==="reset",error:Ce,onReset:v=>J(ce,v),onClose:()=>{se===null&&(ie(null),we(null))}}):null,be?e("div",{className:j("gitp-toast",be.error&&"is-error"),role:"status","aria-live":"polite"},be.text):null)}function ga({call:t,workspaceId:i,repo:n,t:a,snapshot:o,onStatus:r,refreshToken:g}){let[p,d]=w(null),[l,h]=w(null),[c,b]=w(!1),[y,N]=w(null),[u,m]=w(null),[C,V]=w(null),[S,$]=w(null),T=I(n);A(()=>{T.current!==n&&(T.current=n,d(null))},[n]);let F=Qe(async R=>{try{let O=await t("stashList",{workspaceId:i,repo:n},R);d(O.stashes??[]),h(null)}catch(O){let U=q(O);U.name!=="AbortError"&&h(U)}},[i,n,t]);A(()=>{let R=new AbortController;return F(R.signal),()=>R.abort()},[F,g]),A(()=>{if(S===null)return;let R=setTimeout(()=>$(null),4e3);return()=>clearTimeout(R)},[S]);let P=(o?.entries??[]).filter(R=>R.unstaged&&!R.conflicted);async function W({paths:R,message:O}){N("create"),m(null);try{let U=await t("stashPush",{workspaceId:i,repo:n,paths:R,message:O,includeUntracked:R.some(_=>P.find(X=>X.path===_)?.untracked===!0)});r(U.status),d(U.stashes??[]),b(!1),$(a("stash.created",{count:R.length}))}catch(U){m(fe(U))}finally{N(null)}}async function L(R,O,U){N(R+O),h(null);try{let _=await t(R==="drop"?"stashDrop":"stashApply",{workspaceId:i,repo:n,ref:O,pop:U});r(_.status),d(_.stashes??[]),$(R==="drop"?a("stash.dropped",{ref:O}):a(U?"stash.popped":"stash.applied",{ref:O})),V(null)}catch(_){h(q(_))}finally{N(null)}}return e("div",{className:"gitp-stash"},e("div",{className:"gitp-stash-head"},e("div",{className:"gitp-stash-title"},e("span",null,a("mode.stash")),p?.length?e("span",{className:"gitp-section-count"},String(p.length)):null),e("button",{type:"button",className:"gitp-btn is-small is-primary",onClick:()=>b(!0),disabled:P.length===0},e(H,{path:k.plus,size:12}),a("action.stash"))),l?e("div",{className:"gitp-error"},e("span",{className:"gitp-error-text"},fe(l))):null,p===null?e("div",{className:"gitp-center"},e(ee)):p.length===0?e(ue,{icon:e(H,{path:k.stash,size:28}),title:a("empty.noStashes"),hint:a("empty.noStashesHint"),action:P.length>0?e("button",{type:"button",className:"gitp-btn is-primary is-small",onClick:()=>b(!0)},e(H,{path:k.plus,size:12}),a("action.stash")):null}):e("div",{className:"gitp-stashlist"},p.map(R=>e("div",{className:"gitp-stashrow",key:R.ref},e("div",{className:"gitp-stash-main"},e("div",{className:"gitp-stash-msg"},R.message||"WIP"),e("div",{className:"gitp-stash-meta"},e("span",{className:"gitp-stash-ref"},R.ref),e("span",null,"\xB7"),e("span",null,Pe(R.hash)))),e("div",{className:"gitp-stash-actions"},e("button",{type:"button",className:"gitp-btn is-small",onClick:()=>L("apply",R.ref,!1),disabled:y!==null,title:a("stash.applyHint")},y==="apply"+R.ref?e(ee):null,a("action.apply")),e("button",{type:"button",className:"gitp-btn is-small",onClick:()=>L("apply",R.ref,!0),disabled:y!==null,title:a("stash.popHint")},y==="apply"+R.ref?e(ee):null,a("action.pop")),e("button",{type:"button",className:"gitp-btn is-small gitp-stash-btn-danger","aria-label":a("action.drop"),onClick:()=>V(R.ref),disabled:y!==null,title:a("stash.dropHint")},a("action.drop")))))),c?e(Zi,{t:a,files:P,busy:y==="create",error:u,onCreate:W,onClose:()=>{b(!1),m(null)}}):null,C?e(bt,{title:a("stash.dropTitle"),body:a("stash.dropBody",{ref:C}),confirmLabel:a("action.drop"),cancelLabel:a("action.cancel"),danger:!0,busy:y==="drop"+C,onConfirm:()=>L("drop",C,!1),onClose:()=>V(null)}):null,S?e("div",{className:"gitp-toast",role:"status","aria-live":"polite"},S):null)}function ha({call:t,t:i,useWorkspaces:n,useSessions:a,sessionId:o,useTabInfo:r,sidebarRight:g}){let{tab:p}=r(),d=Kt(o).set;A(()=>{d(p.visible===!0)},[d,p.visible]),A(()=>()=>{d(!1)},[d]),A(()=>{ht={visible:p.visible===!0,canStageAll:()=>nt.length>0&&F===null,stageAll:()=>kt("unstaged"),canCommit:()=>st&&F===null,commit:()=>Ct(),canWriteMessage:()=>Re.length>0&&F===null&&!de,writeMessage:()=>Rt()}}),A(()=>()=>{ht=null},[]);let l=n(s=>s.items),h=a(s=>s.byId[o]),c=l.find(s=>s.sessionIds?.includes(o))??l.find(s=>h?.cwd!==void 0&&(h.cwd===s.path||h.cwd.startsWith(`${s.path}/`)))??null,b=c===null?"":c.workspaceId,y=I(null),[N,u]=w(!1),[m,C]=w(null),[V,S]=w(!1),[$,T]=w(null),[F,P]=w(null),[W,L]=w(null),[R,O]=w("changes"),[U,_]=w(""),[X,De]=w(!1),[le,ge]=w(!1),[D,K]=w(null),[ce,ie]=w(null),[Ce,we]=w(!1),[se,oe]=w(0),[be,he]=w(()=>Ve(At,"split")==="unified"?"unified":"split"),[ze,Ae]=w(()=>Ve(Lt,"split")==="unified"?"unified":"split"),[Le,Y]=w(!1),[Oe,re]=w(!1),[de,Me]=w(!1),[ke,J]=w(null),[me,Z]=w(null),[ve,v]=w(!1),[M,z]=w(null),[G,f]=w(null),[ae,Be]=w(null),[vt,yt]=w(0),[tt,_e]=w([]),[B,je]=w(null),ei=s=>{if(B===null||g===void 0)return;let x=Oi(s),E=Fi(o,h===void 0?void 0:h.cwd,`${B}/${s.path}`);g.openResource(E,{params:{line:x}})},[ti,ii]=w(0),[ai,qe]=w(!1),[ni,it]=w(!1),$e=I(0),at=I(null);A(()=>{let s=y.current;if(s===null||typeof ResizeObserver>"u")return;let x=0,E=new ResizeObserver(Q=>{x&&cancelAnimationFrame(x),x=requestAnimationFrame(()=>{x=0;let Se=Q[0]?.contentRect.width??0;u(Se>0&&Se<900)})});return E.observe(s),()=>{E.disconnect(),x&&cancelAnimationFrame(x)}},[c?.workspaceId]);let ne=Qe(s=>{!s||!Array.isArray(s.entries)||($e.current+=1,C(s))},[]),ye=Qe(async(s,x)=>{if(!c||B===null)return;let E=++$e.current;x||S(!0);try{let Q=await t("status",{workspaceId:b,repo:B},s);E===$e.current&&(at.current=null,C(Q),Array.isArray(Q.repos)&&Q.repos.length>0&&_e(Q.repos),T(null))}catch(Q){let Se=q(Q);if(Se.name==="AbortError"||E!==$e.current)return;let Ie=zt(Q);if(Ie==="git/not-repo"||Ie==="git/repo-invalid"){if(at.current===B){T(Se);return}at.current=B,He(We+b,""),je(null),C(null),T(null),ii(rt=>rt+1);return}T(Se)}finally{E===$e.current&&S(!1)}},[c?.workspaceId,B,t]),si=Qe(s=>{s?.status&&ne(s.status),typeof s.message=="string"&&(_(s.message),De(!1)),s?.goToChanges&&(K(null),ie(null),O("changes")),s?.toast&&f(s.toast),yt(x=>x+1),ye(void 0,!1)},[ne,ye]),xt=I(null);A(()=>{if(!c?.workspaceId)return;let s=b;xt.current!==s&&(xt.current=s,_e([]),je(null),C(null));let x=new AbortController;return(async()=>{try{let E=await t("status",{workspaceId:s},x.signal);if(x.signal.aborted)return;let Q=Array.isArray(E.repos)?E.repos:[];_e(Q);let Se=Ve(We+s,""),Ie=Q.find(rt=>rt.root===Se)??Q[0]??null;Ie?(je(Ie.root),He(We+s,Ie.root)):C(E)}catch(E){let Q=q(E);Q.name!=="AbortError"&&T(Q)}})(),()=>x.abort()},[c?.workspaceId,t,ti]),A(()=>{if(B===null)return;let s=new AbortController;return ye(s.signal,!1),()=>s.abort()},[B,ye]),A(()=>{if(!c||B===null)return;let s=setInterval(()=>{document.visibilityState==="visible"&&ye(void 0,!0)},8e3);return()=>clearInterval(s)},[c?.workspaceId,B,ye]),A(()=>{let s=()=>ye(void 0,!0);return window.addEventListener("focus",s),()=>window.removeEventListener("focus",s)},[ye]),A(()=>{if(G===null)return;let s=setTimeout(()=>f(null),4e3);return()=>clearTimeout(s)},[G]);let Ye=m?.entries?.filter(s=>s.conflicted)??[],Re=m?.entries?.filter(s=>s.staged&&!s.conflicted)??[],nt=m?.entries?.filter(s=>s.unstaged&&!s.conflicted)??[],st=Re.length>0&&Ye.length===0&&U.trim()!==""&&m?.repo!==!1,ot=D?`${D.side}:${D.path}:${D.commit??""}`:"",oi=D===null?!0:D.side==="staged"?m?.entries?.some(s=>s.path===D.path&&s.staged&&!s.conflicted):D.side==="unstaged"?m?.entries?.some(s=>s.path===D.path&&s.unstaged&&!s.conflicted):D.side==="conflict"?m?.entries?.some(s=>s.path===D.path&&s.conflicted):!0;A(()=>{m!==null&&D!==null&&!oi&&K(null)},[m,ot]),A(()=>{if(!c||D===null){ie(null);return}let s=new AbortController;return we(!0),t("diff",{workspaceId:b,repo:B,path:D.path,side:D.side},s.signal).then(x=>{s.signal.aborted||ie(x)}).catch(x=>{let E=q(x);!s.signal.aborted&&E.name!=="AbortError"&&T(E)}).finally(()=>{s.signal.aborted||we(!1)}),()=>s.abort()},[c?.workspaceId,B,ot,se,t]);function pe(){oe(s=>s+1)}function ri(s){D!==null&&D.side===s.side&&D.path===s.path||(ie(null),K(s))}function wt(s){let x=new Set;for(let E of s)x.add(E.path),E.from&&x.add(E.from);return[...x]}async function li(s,x){if(F===null){P("file"),T(null);try{let E=await t(x==="staged"?"unstage":"stage",{workspaceId:b,repo:B,paths:wt([s])});ne(E),D?.path===s.path&&D.side===x&&K(null),pe()}catch(E){T(q(E))}finally{P(null)}}}async function kt(s){let x=s==="staged"?Re:nt;if(!(F!==null||x.length===0)){P("file"),T(null);try{let E=await t(s==="staged"?"unstage":"stage",{workspaceId:b,repo:B,paths:wt(x)});ne(E),pe()}catch(E){T(q(E))}finally{P(null)}}}function ci(s){F===null&&z({title:i(s.untracked?"discard.deleteTitle":"discard.title"),body:i(s.untracked?"discard.deleteBody":"discard.body",{path:s.path}),confirmLabel:i(s.untracked?"discard.deleteConfirm":"discard.confirm"),danger:!0,run:()=>void di(s)})}async function di(s){if(F===null){P("discard"),T(null);try{let x=await t("discard",{workspaceId:b,repo:B,paths:[s.path],confirm:!0});ne(x),D?.path===s.path&&(K(null),ie(null)),pe(),f(i(s.untracked?"discard.deleted":"discard.done",{name:Ue(s.path).base}))}catch(x){T(q(x))}finally{P(null),z(null)}}}async function pi(s,x){if(!(F!==null||ce===null)){if(x==="revert"){z({title:i("confirm.revertTitle"),body:i("confirm.revertBody"),confirmLabel:i("confirm.yesRevert"),danger:!0,run:()=>Nt(s,"revert")});return}await Nt(s,x)}}async function Nt(s,x){if(ce!==null){P("block"),T(null);try{let E=await t("applyBlocks",{workspaceId:b,repo:B,path:ce.path,side:x,blocks:[s],baseHash:ce.baseHash,targetHash:ce.targetHash,confirm:!0});ne(E),pe()}catch(E){T(q(E)),zt(E)==="git/stale"&&pe()}finally{P(null),z(null)}}}async function ui(s){if(!(!D||F!==null)){P("resolve"),T(null);try{let x=await t("resolve",{workspaceId:b,repo:B,path:D.path,side:s});ne(x),K(null),pe()}catch(x){T(q(x))}finally{P(null)}}}async function Ct(){if(!(!st||F!==null)){P("commit"),T(null);try{let s=await t("commit",{workspaceId:b,repo:B,message:U,amend:X,noVerify:le});ne(s.status),_(""),De(!1),f(i("commit.done",{hash:Pe(s.hash)})),pe()}catch(s){T(q(s))}finally{P(null)}}}function gi(){Re.length===0||Ye.length>0||(J(null),Y(!0))}async function Mt(){if(de||Re.length===0)return null;Me(!0),T(null);try{let s=ut.hook.getSnapshot(),x=await t("aiMessage",{workspaceId:b,repo:B,...s.model===null?{}:{model:s.model},...s.instruction.trim()===""?{}:{instruction:s.instruction}});return x.model!==null&&x.model!==""&&f(i("ai.written",{model:x.model})),x.message!==""?x.message:null}catch(s){return T(q(s)),null}finally{Me(!1)}}async function Rt(){re(!1);let s=await Mt();s!==null&&_(s)}async function hi(){if(re(!1),Re.length===0||Ye.length>0)return;let s=await Mt();s!==null&&(_(s),J(null),Y(!0))}async function mi({name:s,message:x}){v(!0),J(null);try{let E=await t("createBranchAndCommit",{workspaceId:b,repo:B,name:s,message:x,noVerify:le});ne(E.status),_(""),Y(!1),f(i("branch.created",{branch:s})),pe()}catch(E){J(fe(E))}finally{v(!1)}}async function fi(s){if(F===null){P("sync"),L(s),T(null),Be(null);try{let x=await t(s,{workspaceId:b,repo:B});ne(x.status),s==="pull"&&x.autoStash==="conflict"?(O("changes"),K(null),ie(null),Be(i("sync.pulledStashConflict"))):f(i(s==="fetch"?"sync.fetched":s==="pull"?x.autoStash==="restored"?"sync.pulledStashed":"sync.pulled":"sync.pushed"))}catch(x){T(q(x))}finally{P(null),L(null)}}}async function bi(){if(m?.repo!==!1){if(me!==null){Z(null);return}Z({branches:[],loading:!0});try{let s=await t("branches",{workspaceId:b,repo:B});Z({branches:s.branches??[],loading:!1})}catch(s){Z(null),T(q(s))}}}function vi(s,x){if(Z(null),(m?.entries?.length??0)>0){z({title:i("confirm.checkoutTitle"),body:i("confirm.checkoutBody"),confirmLabel:i("confirm.yesCheckout"),danger:!1,run:()=>St(s,x)});return}St(s,x)}async function St(s,x){z(null),v(!0),T(null);try{let E=await t("checkout",{workspaceId:b,repo:B,branch:s,remote:x===!0});ne(E.status),Z(null),K(null),pe()}catch(E){Z(null),T(q(E))}finally{v(!1)}}async function Tt(){if(F===null){P("init"),T(null);try{let s=await t("init",{workspaceId:b});Array.isArray(s.repos)&&_e(s.repos);let x=s.selected??s.root??null;typeof x=="string"&&x!==""&&(He(We+b,x),je(x)),ne(s)}catch(s){T(q(s))}finally{P(null)}}}function yi(s){qe(!1),s!==B&&(He(We+b,s??""),je(s),C(null),K(null),ie(null),Z(null))}function xi(){qe(!1),z({title:i("repo.initRootTitle"),body:i("repo.initRootBody",{count:tt.length}),confirmLabel:i("repo.initRootConfirm"),danger:!0,run:()=>{z(null),Tt()}})}async function wi({name:s}){if(B!==null){v(!0),J(null);try{let x=await t("createBranch",{workspaceId:b,repo:B,name:s});ne(x.status),it(!1),f(i("branch.createdOnly",{branch:s})),pe()}catch(x){J(fe(x))}finally{v(!1)}}}let Ht=N?ze:be;function Et(s){N?(Ae(s),He(Lt,s)):(he(s),He(At,s))}if(c===null)return e("div",{className:"gitp-root"},e(ue,{icon:e(H,{path:k.branch,size:28}),title:i("empty.noWorkspace"),hint:i("empty.noWorkspaceHint")}));let Xe=m?.branch??null,ki=Xe?.ahead??0,Ni=Xe?.behind??0,Pt=$,Ci=Re[0]?.path,Mi=Ki(U,Ci),Ri=U;return e("div",{className:j("gitp-root",N&&"is-compact"),ref:y},e(na,{t:i,workspaceTitle:c.title,branch:Xe,repo:m?.repo!==!1,ahead:ki,behind:Ni,upstream:Xe?.upstream??null,onBranchMenu:bi,onRepoMenu:()=>qe(!0),repos:tt,repoRoot:B,onSync:fi,busy:F!==null,onRefresh:()=>{ye(void 0,!1),D&&pe(),yt(s=>s+1)},syncing:W}),Pt?e("div",{className:"gitp-error",role:"alert"},e(H,{path:k.warning,size:14}),e("span",{className:"gitp-error-text"},fe(Pt)),e(xe,{label:i("action.close"),icon:k.close,onClick:()=>T(null)})):null,ae?e("div",{className:"gitp-error",role:"status"},e(H,{path:k.warning,size:14}),e("span",{className:"gitp-error-text"},ae),e(xe,{label:i("action.close"),icon:k.close,onClick:()=>Be(null)})):null,e("div",{className:"gitp-body"},e(sa,{t:i,mode:R,onMode:O,counts:{changes:m?.entries?.length??0}}),e("div",{className:"gitp-content"},m===null?e(ue,{icon:e(ee),title:i("status.loading")}):m.repo===!1?e(ue,{icon:e(H,{path:k.branch,size:28}),title:i("empty.noRepo"),hint:i("empty.noRepoHint"),action:e("button",{type:"button",className:"gitp-btn is-primary",onClick:Tt,disabled:F!==null},F==="init"?e(ee):null,i("empty.init"))}):R==="log"?e(ua,{call:t,workspaceId:b,repo:B??"",t:i,refreshToken:vt,compact:N,layout:Ht,onLayout:Et,snapshot:m,onApplied:si}):R==="stash"?e(ga,{call:t,workspaceId:b,repo:B??"",t:i,snapshot:m,onStatus:ne,refreshToken:vt}):e(Qi,{t:i,snapshot:m,conflicts:Ye,staged:Re,unstaged:nt,selection:D,onSelect:ri,busy:F!==null,fileBusy:F!==null,onToggleFile:li,onToggleAll:kt,onDiscard:ci,diff:ce,diffLoading:Ce,layout:Ht,onLayout:Et,onRefresh:()=>{pe(),ye(void 0,!1)},onBlock:pi,onResolve:ui,onOpen:ei,message:U,onMessage:_,onCommit:Ct,onBranch:gi,canCommit:st,commitBusy:F==="commit",aiBusy:de,aiMenuOpen:Oe,onAiToggle:()=>re(s=>!s),onAiClose:()=>re(!1),onAiWrite:Rt,onAiBranch:hi,selectionKey:ot,amend:X,onAmend:De,noVerify:le,onNoVerify:ge,canAmend:m.branch?.initial!==!0,compact:N,onBack:()=>K(null)}))),me?e(ra,{t:i,branches:me.branches,loading:me.loading===!0,busy:ve,onCheckout:vi,onNew:()=>{Z(null),J(null),it(!0)},onClose:()=>Z(null)}):null,ai?e(oa,{t:i,repos:tt,current:B,onPick:yi,onInitRoot:xi,onClose:()=>qe(!1)}):null,ni?e(la,{t:i,busy:ve,error:ke,onCreate:wi,onClose:()=>{it(!1),J(null)}}):null,Le?e(Ji,{t:i,defaultName:Mi,defaultMessage:Ri,busy:ve,noVerify:le,error:ke,onCreate:mi,onNoVerify:ge,onClose:()=>{Y(!1),J(null)}}):null,M?e(bt,{title:M.title,body:M.body,confirmLabel:M.confirmLabel,cancelLabel:i("action.cancel"),danger:M.danger,busy:F!==null||ve,onConfirm:()=>M.run(),onClose:()=>z(null)}):null,G?e("div",{className:"gitp-toast",role:"status","aria-live":"polite"},G):null)}function ma({t}){return e(te.default.Fragment,null,e(et,{size:14}),e("span",{className:"gitp-tab-title"},t("panel")))}function Ut({sessionId:t,sidebarRight:i,useVisible:n,t:a}){let o=n(g=>g===!0),r=a("header.label");return e("button",{type:"button",className:j("gitp-iconbtn","gitp-header-btn",o&&"is-active"),"aria-label":r,"aria-pressed":o,title:r,onClick(){if(!o){i.openTab("git");return}let g=i.tabsIn(t).find(p=>p.kind==="git");g!==void 0&&i.hide(g.id)}},e(et,{size:16}))}function Qt({label:t,containerRef:i,columnRef:n,width:a,onChange:o}){let r=I(null),g=()=>{let d=i.current;return d===null?a:Math.max(Fe,Math.round(d.getBoundingClientRect().width)-It)},p=d=>Math.min(Math.max(Math.round(d),Fe),g());return A(()=>()=>{r.current=null,document.body.style.cursor="",document.body.style.userSelect=""},[]),A(()=>{let d=i.current;if(d===null||typeof ResizeObserver>"u")return;let l=new ResizeObserver(()=>{let h=Math.round(d.getBoundingClientRect().width);if(h===0)return;let c=Math.max(Fe,h-It);a>c&&o(c)});return l.observe(d),()=>l.disconnect()},[i,a,o]),e("div",{className:"gitp-resizer",role:"separator","aria-orientation":"vertical","aria-label":t,"aria-valuemin":Fe,"aria-valuemax":g(),"aria-valuenow":a,tabIndex:0,onPointerDown(d){d.button===0&&(r.current={x:d.clientX,width:a,next:a},d.currentTarget.setPointerCapture(d.pointerId),document.body.style.cursor="col-resize",document.body.style.userSelect="none",d.preventDefault())},onPointerMove(d){let l=r.current;if(l===null)return;let h=p(l.width+(d.clientX-l.x));h!==l.next&&(l.next=h,n.current!==null&&(n.current.style.width=`${h}px`),d.currentTarget.setAttribute("aria-valuenow",String(h)))},onPointerUp(d){let l=r.current;l!==null&&(r.current=null,d.currentTarget.hasPointerCapture(d.pointerId)&&d.currentTarget.releasePointerCapture(d.pointerId),document.body.style.cursor="",document.body.style.userSelect="",o(l.next))},onPointerCancel(){r.current=null,document.body.style.cursor="",document.body.style.userSelect=""},onDoubleClick(){o(p(gt))},onKeyDown(d){if(d.key==="ArrowLeft"||d.key==="ArrowRight"){d.preventDefault();let l=d.key==="ArrowRight"?Ft:-Ft;o(p(a+l));return}d.key==="Home"&&(d.preventDefault(),o(p(gt)))}})}var ht=null;function fa({t,call:i,usePrefs:n,savePrefs:a}){let o=n(u=>u),[r,g]=w(null),[p,d]=w(!1);A(()=>{let u=new AbortController,m=!0;return i("preferences",{},u.signal).then(C=>{m&&g(C)},()=>{m&&d(!0)}),()=>{m=!1,u.abort()}},[i]);let l=r?.groups??[],h=o.model,c=h===null?"":Ot(h),b=h!==null&&l.some(u=>u.id===h.provider&&u.models.some(m=>m.id===h.model)),y=o.instruction===""?r?.instruction??"":o.instruction,N=r===null&&!p;return e("div",{className:"gitp-settings"},e("div",{className:"gitp-settings-row"},e("div",{className:"gitp-settings-copy"},e("label",{className:"gitp-settings-label",htmlFor:"gitp-settings-model"},t("settings.model")),e("p",{className:"gitp-settings-hint"},t("settings.modelHint"))),e("select",{id:"gitp-settings-model",value:c,disabled:N,onChange:u=>{let m=u.target.value;if(m===""){a({...o,model:null});return}let C=Ui(m);C!==null&&a({...o,model:C})}},e("option",{value:""},t("settings.modelSame")),b||o.model===null?null:e("option",{value:c},`${o.model.provider} \xB7 ${o.model.model}`),l.map(u=>e("optgroup",{key:u.id,label:u.label},u.models.map(m=>e("option",{key:m.id,value:Ot({provider:u.id,model:m.id})},m.name))))),p?e("p",{className:"gitp-settings-error"},t("settings.modelFailed")):null,!p&&r!==null&&l.length===0?e("p",{className:"gitp-settings-error"},t("settings.modelEmpty")):null),e("div",{className:"gitp-settings-row"},e("div",{className:"gitp-settings-copy"},e("label",{className:"gitp-settings-label",htmlFor:"gitp-settings-instruction"},t("settings.instruction")),e("p",{className:"gitp-settings-hint"},t("settings.instructionHint"))),e("textarea",{id:"gitp-settings-instruction",value:y,spellCheck:!1,disabled:N,onChange:u=>a({...o,instruction:u.target.value})}),e("div",{className:"gitp-settings-actions"},e("button",{type:"button",className:"gitp-btn is-small",disabled:o.instruction==="",onClick:()=>a({...o,instruction:""})},t("settings.instructionReset"))),p?e("p",{className:"gitp-settings-error"},t("settings.instructionFailed")):null))}function ba(){return e(et,{size:16})}function va(t,i){let n=r=>({status:"blocked",reason:r}),a=["page","editable","terminal"],o=r=>{let g=ht;return g===null||!g.visible?n(i("command.openFirst")):r(g)};return[{id:"git.panel.toggle",label:()=>i("command.toggle"),aliases:["git","source control","toggle panel"],defaults:{},regions:a,modals:[],resolve:()=>({status:"handled",run:()=>{let r=t.sidebarRight.active();if(t.sidebarRight.isExpanded()&&r!==void 0&&r.kind==="git"){t.sidebarRight.hide(r.id);return}try{t.sidebarRight.openTab("git")}catch{}}})},{id:"git.stageAll",label:()=>i("command.stageAll"),aliases:["git","stage"],defaults:{},regions:a,modals:[],resolve:()=>o(r=>r.canStageAll()?{status:"handled",run:()=>r.stageAll()}:n(i("command.nothingToStage")))},{id:"git.commit",label:()=>i("command.commit"),aliases:["git","commit"],defaults:{},regions:a,modals:[],resolve:()=>o(r=>r.canCommit()?{status:"handled",run:()=>r.commit()}:n(i("command.notReady")))},{id:"git.writeMessage",label:()=>i("command.writeMessage"),aliases:["git","commit message","ai"],defaults:{},regions:a,modals:[],resolve:()=>o(r=>r.canWriteMessage()?{status:"handled",run:()=>r.writeMessage()}:n(i("command.notReady")))}]}var ya=["connection","slots","locale","sidebarRightTabs","sidebarRight"];function xa(t){t.locale.register(Te,"en",ji),t.locale.register(Te,"zh",$i);let i=t.locale.bind(Te),n=async(o,r,g)=>{let p=await t.connection.rpc.call("/git-rpc",o,r,g);if(!p.ok)throw new pt(p.error.code,p.error.message,p.error.details);return p.value};t.effect(()=>t.sidebarRightTabs.register({id:lt,kind:"git",priority:"extension",title:()=>i("panel"),guide:[{id:"git",order:50,title:()=>i("guide.title"),description:()=>i("guide.description"),icon:()=>e(Yi,null)}]}),"dsh-git: right sidebar tab type");let a=o=>({sessionId:o,sidebarRight:t.sidebarRight,hooks:{visible:Kt(o).hook}});t.slots.inject("conversation.session.header.utilities",()=>t.slots.register({name:"conversation.session.header.utilities",id:"git-panel",order:-7,locale:Te,inject:a},Ut)),t.slots.inject("conversation.hero.options",()=>t.slots.register({name:"conversation.hero.options",id:"git-panel",order:-7,locale:Te,inject:a},Ut)),t.slots.inject("settings.section",()=>t.slots.register({name:"settings.section",id:"git",order:25,label:()=>i("settings.section"),locale:Te,inject:()=>({t:i,call:n,savePrefs:ut.set,hooks:{prefs:ut.hook}})},fa)),t.slots.inject("settings.section.icon",()=>t.slots.register({name:"settings.section.icon",id:"git",order:25},ba)),t.inject(["shortcuts"],o=>{for(let r of va(t,i))o.effect(()=>o.shortcuts.register(r),`dsh-git: ${r.id}`)}),t.slots.inject("sidebar.right.pane.tab",()=>t.slots.register({name:"sidebar.right.pane.tab",key:lt,locale:Te,inject:()=>({call:n,t:i,sidebarRight:t.sidebarRight})},ha)),t.slots.inject("sidebar.right.pane.tab.title",()=>t.slots.register({name:"sidebar.right.pane.tab.title",key:lt,locale:Te,inject:()=>({t:i})},ma))}
|
|
317
319
|
|
|
318
320
|
return module.exports;
|
|
319
321
|
},
|
package/dist/host/lib/git.js
CHANGED
|
@@ -710,6 +710,86 @@ export async function unstagePaths(runtime, root, paths) {
|
|
|
710
710
|
throw failure(result, 'Git could not unstage the selected files.');
|
|
711
711
|
return readStatus(runtime, root);
|
|
712
712
|
}
|
|
713
|
+
/**
|
|
714
|
+
* Discard every local change to the named files.
|
|
715
|
+
*
|
|
716
|
+
* The named entries are restored to HEAD in the index and the working tree. An
|
|
717
|
+
* untracked file is deleted. A rename is expanded to its recorded old path, so
|
|
718
|
+
* the old path returns and the new one leaves. The caller must confirm first.
|
|
719
|
+
* @param runtime the runtime helpers.
|
|
720
|
+
* @param root the repository root.
|
|
721
|
+
* @param paths the caller paths.
|
|
722
|
+
* @param confirm whether the caller confirmed the loss.
|
|
723
|
+
* @returns the fresh snapshot.
|
|
724
|
+
*/
|
|
725
|
+
export async function discardPaths(runtime, root, paths, confirm) {
|
|
726
|
+
if (confirm !== true)
|
|
727
|
+
throw new GitError('git/confirm-required', 'Discarding changes needs confirmation.');
|
|
728
|
+
const safe = [...new Set(paths.map((value) => repoPath(root, value).path))];
|
|
729
|
+
if (safe.length === 0)
|
|
730
|
+
return readStatus(runtime, root);
|
|
731
|
+
const snapshot = await readStatus(runtime, root);
|
|
732
|
+
if (snapshot.merging || snapshot.rebasing || snapshot.reverting || snapshot.cherryPicking) {
|
|
733
|
+
throw new GitError('git/operation', 'Finish the current operation before discarding changes.');
|
|
734
|
+
}
|
|
735
|
+
const wanted = new Set(safe);
|
|
736
|
+
const entries = snapshot.entries.filter((entry) => wanted.has(entry.path));
|
|
737
|
+
if (entries.length === 0) {
|
|
738
|
+
throw new GitError('git/stale', 'The file changed after the list was read. Refresh and try again.');
|
|
739
|
+
}
|
|
740
|
+
if (entries.some((entry) => entry.conflicted)) {
|
|
741
|
+
throw new GitError('git/conflict', 'Resolve the conflict instead of discarding it.');
|
|
742
|
+
}
|
|
743
|
+
const selected = new Set(entries);
|
|
744
|
+
for (const entry of entries) {
|
|
745
|
+
if (entry.from === null || entry.from === undefined)
|
|
746
|
+
continue;
|
|
747
|
+
const occupant = snapshot.entries.find((other) => other.path === entry.from && !selected.has(other));
|
|
748
|
+
if (occupant !== undefined) {
|
|
749
|
+
throw new GitError('git/discard-blocked', 'The old path of this rename holds another file. Remove or discard that file first.');
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
const untracked = new Set();
|
|
753
|
+
const tracked = new Set();
|
|
754
|
+
for (const entry of entries) {
|
|
755
|
+
if (entry.untracked) {
|
|
756
|
+
untracked.add(entry.path);
|
|
757
|
+
continue;
|
|
758
|
+
}
|
|
759
|
+
tracked.add(entry.path);
|
|
760
|
+
if (entry.from !== null && entry.from !== undefined)
|
|
761
|
+
tracked.add(entry.from);
|
|
762
|
+
}
|
|
763
|
+
const literal = (values) => [...values].map((value) => `:(literal)${value}`);
|
|
764
|
+
if (untracked.size > 0) {
|
|
765
|
+
const cleaned = await runtime.run(root, ['clean', '-f', '--', ...literal(untracked)]);
|
|
766
|
+
if (cleaned.code !== 0)
|
|
767
|
+
throw failure(cleaned, 'Git could not delete the untracked files.');
|
|
768
|
+
}
|
|
769
|
+
if (tracked.size > 0) {
|
|
770
|
+
const specs = literal(tracked);
|
|
771
|
+
const head = await runtime.run(root, ['rev-parse', '--verify', 'HEAD']);
|
|
772
|
+
if (head.code === 0) {
|
|
773
|
+
const restored = await runtime.run(root, ['restore', '--source=HEAD', '--staged', '--worktree', '--', ...specs]);
|
|
774
|
+
if (restored.code !== 0)
|
|
775
|
+
throw failure(restored, 'Git could not discard the selected files.');
|
|
776
|
+
}
|
|
777
|
+
else {
|
|
778
|
+
const removed = await runtime.run(root, ['rm', '--cached', '-f', '--', ...specs]);
|
|
779
|
+
if (removed.code !== 0)
|
|
780
|
+
throw failure(removed, 'Git could not remove the staged files.');
|
|
781
|
+
const cleaned = await runtime.run(root, ['clean', '-f', '--', ...specs]);
|
|
782
|
+
if (cleaned.code !== 0)
|
|
783
|
+
throw failure(cleaned, 'Git could not delete the selected files.');
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
const status = await readStatus(runtime, root);
|
|
787
|
+
const remaining = [...untracked].filter((path) => status.entries.some((entry) => entry.path === path));
|
|
788
|
+
if (remaining.length > 0) {
|
|
789
|
+
throw new GitError('git/discard-incomplete', `An untracked path could not be deleted: ${remaining.join(', ')}. A nested repository must be removed outside the panel.`, { paths: remaining });
|
|
790
|
+
}
|
|
791
|
+
return status;
|
|
792
|
+
}
|
|
713
793
|
/**
|
|
714
794
|
* Commit the staged changes.
|
|
715
795
|
* @param runtime the runtime helpers.
|
|
@@ -728,9 +808,12 @@ export async function commit(runtime, root, options) {
|
|
|
728
808
|
if (!snapshot.entries.some((entry) => entry.staged)) {
|
|
729
809
|
throw new GitError('git/nothing-staged', 'Stage at least one file before committing.');
|
|
730
810
|
}
|
|
731
|
-
const args = ['commit'
|
|
811
|
+
const args = ['commit'];
|
|
812
|
+
if (options.noVerify === true)
|
|
813
|
+
args.push('--no-verify');
|
|
732
814
|
if (options.amend === true)
|
|
733
815
|
args.push('--amend');
|
|
816
|
+
args.push('-F', '-');
|
|
734
817
|
const result = await runtime.run(root, args, {
|
|
735
818
|
input: message.endsWith('\n') ? message : `${message}\n`,
|
|
736
819
|
});
|
|
@@ -796,7 +879,11 @@ export async function createBranchAndCommit(runtime, root, options) {
|
|
|
796
879
|
throw new GitError('git/branch-failed', created.stderr.trim() || 'Git could not create the branch.');
|
|
797
880
|
}
|
|
798
881
|
try {
|
|
799
|
-
return await commit(runtime, root, {
|
|
882
|
+
return await commit(runtime, root, {
|
|
883
|
+
message: options.message,
|
|
884
|
+
amend: false,
|
|
885
|
+
noVerify: options.noVerify === true,
|
|
886
|
+
});
|
|
800
887
|
}
|
|
801
888
|
catch (error) {
|
|
802
889
|
if (error instanceof GitError) {
|
|
@@ -850,26 +937,94 @@ export async function push(runtime, root) {
|
|
|
850
937
|
status: await readStatus(runtime, root),
|
|
851
938
|
};
|
|
852
939
|
}
|
|
940
|
+
/** The stash message used when a pull has to carry local changes. */
|
|
941
|
+
const PULL_STASH_MESSAGE = 'dsh-git: changes before pull';
|
|
942
|
+
/**
|
|
943
|
+
* Tell whether Git refused a pull because local changes are in the way.
|
|
944
|
+
* @param text the combined command output.
|
|
945
|
+
* @returns whether stashing the changes may let the pull continue.
|
|
946
|
+
*/
|
|
947
|
+
function blockedByLocalChanges(text) {
|
|
948
|
+
return /would be overwritten|cannot pull with rebase|Please commit your changes or stash them|Please commit or stash them|Please move or remove them/i.test(text);
|
|
949
|
+
}
|
|
950
|
+
/**
|
|
951
|
+
* Build the failure for a pull that did not succeed.
|
|
952
|
+
* @param result the command result.
|
|
953
|
+
* @returns the error.
|
|
954
|
+
*/
|
|
955
|
+
function pullFailure(result) {
|
|
956
|
+
return new GitError('git/pull-failed', result.stderr.trim() || result.stdout.trim() || 'Pull failed.', {
|
|
957
|
+
stdout: result.stdout,
|
|
958
|
+
stderr: result.stderr,
|
|
959
|
+
});
|
|
960
|
+
}
|
|
853
961
|
/**
|
|
854
|
-
* Pull fast-forward only.
|
|
962
|
+
* Pull fast-forward only, carrying local changes through a stash.
|
|
963
|
+
*
|
|
964
|
+
* Git refuses a fast-forward when the update touches a file with local changes,
|
|
965
|
+
* and when an untracked file would be overwritten. The working tree is stashed,
|
|
966
|
+
* the pull is retried, and the stash is popped with the index intact. A pop
|
|
967
|
+
* conflict keeps the stash and reports it, because the pull itself succeeded.
|
|
855
968
|
* @param runtime the runtime helpers.
|
|
856
969
|
* @param root the repository root.
|
|
857
|
-
* @returns the command output and
|
|
970
|
+
* @returns the command output, status, and whether local changes were carried.
|
|
858
971
|
*/
|
|
859
972
|
export async function pull(runtime, root) {
|
|
860
973
|
const remote = await remoteStatus(runtime, root);
|
|
861
974
|
if (remote.upstream === null)
|
|
862
975
|
throw new GitError('git/no-upstream', 'This branch has no upstream branch.');
|
|
863
|
-
const
|
|
976
|
+
const args = ['pull', '--ff-only', '--no-rebase'];
|
|
977
|
+
let result = await runtime.run(root, args, { network: true });
|
|
978
|
+
let autoStash;
|
|
864
979
|
if (result.code !== 0) {
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
980
|
+
const text = `${result.stderr}\n${result.stdout}`;
|
|
981
|
+
const status = blockedByLocalChanges(text) ? await readStatus(runtime, root) : null;
|
|
982
|
+
if (status === null ||
|
|
983
|
+
status.entries.length === 0 ||
|
|
984
|
+
status.conflicts.length > 0 ||
|
|
985
|
+
status.merging ||
|
|
986
|
+
status.rebasing ||
|
|
987
|
+
status.reverting ||
|
|
988
|
+
status.cherryPicking) {
|
|
989
|
+
throw pullFailure(result);
|
|
990
|
+
}
|
|
991
|
+
const includeUntracked = /untracked working tree files would be overwritten/i.test(text);
|
|
992
|
+
const before = await runtime.run(root, ['rev-parse', '-q', '--verify', 'refs/stash']);
|
|
993
|
+
const stashed = await runtime.run(root, [
|
|
994
|
+
'stash',
|
|
995
|
+
'push',
|
|
996
|
+
...(includeUntracked ? ['--include-untracked'] : []),
|
|
997
|
+
'-m',
|
|
998
|
+
PULL_STASH_MESSAGE,
|
|
999
|
+
]);
|
|
1000
|
+
const after = await runtime.run(root, ['rev-parse', '-q', '--verify', 'refs/stash']);
|
|
1001
|
+
if (stashed.code !== 0 || after.stdout.trim() === before.stdout.trim())
|
|
1002
|
+
throw pullFailure(result);
|
|
1003
|
+
result = await runtime.run(root, args, { network: true });
|
|
1004
|
+
const current = await runtime.run(root, ['rev-parse', '-q', '--verify', 'refs/stash']);
|
|
1005
|
+
const otherStash = current.stdout.trim() !== after.stdout.trim();
|
|
1006
|
+
if (result.code !== 0) {
|
|
1007
|
+
if (otherStash) {
|
|
1008
|
+
throw new GitError('git/pull-stash-failed', `${pullFailure(result).message} Another stash was created while the pull ran, so the local changes stay in the stash.`, { stdout: result.stdout, stderr: result.stderr });
|
|
1009
|
+
}
|
|
1010
|
+
const restored = await runtime.run(root, ['stash', 'pop', '--index', 'stash@{0}']);
|
|
1011
|
+
if (restored.code !== 0) {
|
|
1012
|
+
throw new GitError('git/pull-stash-failed', `${pullFailure(result).message} The local changes could not be restored and remain in the stash.`, { stdout: result.stdout, stderr: result.stderr });
|
|
1013
|
+
}
|
|
1014
|
+
throw pullFailure(result);
|
|
1015
|
+
}
|
|
1016
|
+
if (otherStash) {
|
|
1017
|
+
autoStash = 'conflict';
|
|
1018
|
+
}
|
|
1019
|
+
else {
|
|
1020
|
+
const restored = await runtime.run(root, ['stash', 'pop', '--index', 'stash@{0}']);
|
|
1021
|
+
autoStash = restored.code === 0 ? 'restored' : 'conflict';
|
|
1022
|
+
}
|
|
869
1023
|
}
|
|
870
1024
|
return {
|
|
871
1025
|
output: `${result.stdout}${result.stderr}`.trim(),
|
|
872
1026
|
status: await readStatus(runtime, root),
|
|
1027
|
+
...(autoStash === undefined ? {} : { autoStash }),
|
|
873
1028
|
};
|
|
874
1029
|
}
|
|
875
1030
|
/**
|
package/dist/host/lib/rpc.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { preferences, writeCommitMessage } from './ai.js';
|
|
2
2
|
import { GitError } from './exec.js';
|
|
3
|
-
import { applyBlocks, branches, checkout, cherryPickCommit, commit, commitDetail, createBranch, createBranchAndCommit, discoverRepositories, diff, fetch, findRepository, initRepository, log, pull, push, recentSubjects, resetToCommit, resolveConflict, resolveRepository, revertCommit, stagePaths, stagedPatch, stashApply, stashDrop, stashList, stashPush, status, undoCommit, unstagePaths, } from './git.js';
|
|
3
|
+
import { applyBlocks, branches, checkout, cherryPickCommit, commit, commitDetail, createBranch, createBranchAndCommit, discardPaths, discoverRepositories, diff, fetch, findRepository, initRepository, log, pull, push, recentSubjects, resetToCommit, resolveConflict, resolveRepository, revertCommit, stagePaths, stagedPatch, stashApply, stashDrop, stashList, stashPush, status, undoCommit, unstagePaths, } from './git.js';
|
|
4
4
|
/**
|
|
5
5
|
* Read one field from a client payload.
|
|
6
6
|
* @param payload the payload.
|
|
@@ -181,6 +181,8 @@ async function dispatch(ctx, runtime, endpoint, payload) {
|
|
|
181
181
|
return stagePaths(runtime, root, pathsField(payload, 'paths'));
|
|
182
182
|
case 'unstage':
|
|
183
183
|
return unstagePaths(runtime, root, pathsField(payload, 'paths'));
|
|
184
|
+
case 'discard':
|
|
185
|
+
return discardPaths(runtime, root, pathsField(payload, 'paths'), valueOf(payload, 'confirm') === true);
|
|
184
186
|
case 'applyBlocks':
|
|
185
187
|
return applyBlocks(runtime, root, {
|
|
186
188
|
path: stringField(payload, 'path'),
|
|
@@ -194,11 +196,13 @@ async function dispatch(ctx, runtime, endpoint, payload) {
|
|
|
194
196
|
return commit(runtime, root, {
|
|
195
197
|
message: optionalString(payload, 'message') ?? '',
|
|
196
198
|
amend: valueOf(payload, 'amend') === true,
|
|
199
|
+
noVerify: valueOf(payload, 'noVerify') === true,
|
|
197
200
|
});
|
|
198
201
|
case 'createBranchAndCommit':
|
|
199
202
|
return createBranchAndCommit(runtime, root, {
|
|
200
203
|
name: stringField(payload, 'name'),
|
|
201
204
|
message: stringField(payload, 'message'),
|
|
205
|
+
noVerify: valueOf(payload, 'noVerify') === true,
|
|
202
206
|
});
|
|
203
207
|
case 'push':
|
|
204
208
|
return push(runtime, root);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-git-desk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Git desk for DeepSeek Harness: a right-sidebar Git workbench with full-file side-by-side diffs, block staging, commits, history, branches, stash, and sync.",
|
|
6
6
|
"keywords": [
|