dsh-git-desk 0.24.0 → 0.25.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/client.js CHANGED
@@ -4,9 +4,9 @@ window.__ModuleLoader__.load({
4
4
  var module = { exports: {} };
5
5
  var exports = module.exports;
6
6
  globalThis.__dshGitDeskRequireAsync = require.async;
7
- "use strict";var Vn=Object.create;var xt=Object.defineProperty;var _n=Object.getOwnPropertyDescriptor;var qn=Object.getOwnPropertyNames;var Xn=Object.getPrototypeOf,Yn=Object.prototype.hasOwnProperty;var Jn=(t,n)=>{for(var a in n)xt(t,a,{get:n[a],enumerable:!0})},Yt=(t,n,a,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of qn(n))!Yn.call(t,r)&&r!==a&&xt(t,r,{get:()=>n[r],enumerable:!(i=_n(n,r))||i.enumerable});return t};var Zn=(t,n,a)=>(a=t!=null?Vn(Xn(t)):{},Yt(n||!t||!t.__esModule?xt(a,"default",{value:t,enumerable:!0}):a,t)),Qn=t=>Yt(xt({},"__esModule",{value:!0}),t);var ea={};Jn(ea,{apply:()=>Qi,inject:()=>Zi});module.exports=Qn(ea);var Ne=Zn(require("react"),1);var Ye=require("react"),ei={ts:"typescript",mts:"typescript",cts:"typescript",tsx:"tsx",js:"javascript",mjs:"javascript",cjs:"javascript",jsx:"jsx",json:"json",jsonc:"json",json5:"json",md:"markdown",markdown:"markdown",mdx:"markdown",css:"css",scss:"css",less:"css",html:"html",htm:"html",vue:"html",svelte:"html",py:"python",pyw:"python",yml:"yaml",yaml:"yaml",xml:"xml",svg:"xml",xsd:"xml",sql:"sql",java:"java",c:"cpp",h:"cpp",cc:"cpp",cpp:"cpp",cxx:"cpp",hpp:"cpp",rs:"rust",go:"go",php:"php"},Jt=4e3,Zt=2e5;function ti(t){let n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\")),a=t.slice(n+1).toLowerCase(),i=a.lastIndexOf(".");return i<0?"text":ei[a.slice(i+1)]??"text"}var Rt=null;function ni(){if(Rt===null){let t=globalThis.__dshGitDeskRequireAsync;if(typeof t!="function")return Promise.reject(new Error("dsh-git-desk: the highlight chunk loader is unavailable"));Rt=t("./client.highlight.js")}return Rt}var ii={left:null,right:null};function Qt(t){let n=(0,Ye.useMemo)(()=>{if(t===null||t.binary||t.conflict)return null;let r=ti(t.path);if(r==="text"||t.left.length>Jt||t.right.length>Jt)return null;let s=t.left.join(`
8
- `),p=t.right.join(`
9
- `);return s.length>Zt||p.length>Zt?null:{language:r,left:s,right:p}},[t]),[a,i]=(0,Ye.useState)(null);return(0,Ye.useEffect)(()=>{if(n===null)return;let r=!0;return ni().then(s=>{r&&i(s)},s=>{console.warn("dsh-git-desk: syntax highlighting is unavailable",s)}),()=>{r=!1}},[n]),(0,Ye.useMemo)(()=>n===null||a===null?ii:{left:a.highlightLines(n.left,n.language),right:a.highlightLines(n.right,n.language)},[n,a])}var e=Ne.default.createElement,{useState:w,useEffect:A,useRef:B,useMemo:Pe,useCallback:kt}=Ne.default,Ht=class extends Error{code;details;constructor(n,a,i){super(a),this.name="GitCallError",this.code=n,this.details=i}};function en(t){if(!(t instanceof Error)||!("code"in t))return;let{code:n}=t;return typeof n=="string"?n:void 0}function ee(t){return t instanceof Error?t:new Error(String(t))}var Ge="git",Tt="dsh-git",ai="dsh-resource://file/session/",si=t=>t.startsWith("/")||/^[A-Za-z]:[/\\]/.test(t)||t.startsWith("\\\\"),ri=t=>t.replace(/\\/g,"/").replace(/^(?:\.\/)+/,"").split("/").map(n=>encodeURIComponent(n)).join("/"),wt=(t,n)=>`${ai}${encodeURIComponent(t)}/${ri(n)}`;function oi(t,n,a){let i=a.replace(/\\/g,"/");if(!si(i))return wt(t,i);let r=n===void 0?"":n.replace(/\\/g,"/").replace(/\/+$/,"");return r!==""&&i===r?wt(t,""):r!==""&&i.startsWith(`${r}/`)?wt(t,i.slice(r.length+1)):wt(t,i)}function li(t){let n=t?.rows??[],a=n.findIndex(i=>i.k!=="ctx");if(a<0)return 1;for(let i=a;i<n.length;i+=1){let r=n[i];if(r!==void 0&&r.r!==null)return r.r}return 1}var ci={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","selection.count":"{count} selected","selection.stage":"Stage selected files","selection.unstage":"Unstage selected files","selection.discard":"Discard selected files","selection.clear":"Clear selection","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","repo.worktree":"Worktree","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.inWorktree":"Checked out in another worktree","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 selected files are stashed. All staged and unstaged changes in each selected file are included.","stash.busy":"Wait for the current operation to finish.","stash.renameHint":"Renamed files and their old paths cannot be stashed. Deselect them or commit or unstage the rename first.","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}","discard.titleMany":"Discard changes in {count} files?","discard.titleOne":"Discard changes in this file?","discard.bodyMany":"Every local change in these files is lost. This cannot be undone.","discard.doneMany":"Discarded changes in {count} files","discard.doneOne":"Discarded changes in this file","discard.more":"{count} more","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","split.panes":"Resize the diff panes"},di={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","selection.count":"\u5DF2\u9009\u62E9 {count} \u4E2A\u6587\u4EF6","selection.stage":"\u6682\u5B58\u6240\u9009\u6587\u4EF6","selection.unstage":"\u53D6\u6D88\u6682\u5B58\u6240\u9009\u6587\u4EF6","selection.discard":"\u4E22\u5F03\u6240\u9009\u6587\u4EF6","selection.clear":"\u6E05\u9664\u9009\u62E9","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","repo.worktree":"\u5DE5\u4F5C\u6811","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.inWorktree":"\u5DF2\u5728\u5176\u4ED6\u5DE5\u4F5C\u6811\u68C0\u51FA","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\uFF0C\u6BCF\u4E2A\u6587\u4EF6\u4E2D\u5DF2\u6682\u5B58\u548C\u672A\u6682\u5B58\u7684\u66F4\u6539\u90FD\u4F1A\u5305\u542B\u3002","stash.busy":"\u8BF7\u7B49\u5F85\u5F53\u524D\u64CD\u4F5C\u5B8C\u6210\u3002","stash.renameHint":"\u65E0\u6CD5\u8D2E\u85CF\u91CD\u547D\u540D\u7684\u6587\u4EF6\u6216\u5176\u65E7\u8DEF\u5F84\u3002\u8BF7\u53D6\u6D88\u9009\u62E9\uFF0C\u6216\u5148\u63D0\u4EA4\u6216\u53D6\u6D88\u6682\u5B58\u91CD\u547D\u540D\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}","discard.titleMany":"\u4E22\u5F03 {count} \u4E2A\u6587\u4EF6\u7684\u66F4\u6539\uFF1F","discard.titleOne":"\u4E22\u5F03\u6B64\u6587\u4EF6\u7684\u66F4\u6539\uFF1F","discard.bodyMany":"\u8FD9\u4E9B\u6587\u4EF6\u7684\u6240\u6709\u672C\u5730\u66F4\u6539\u90FD\u4F1A\u4E22\u5931\u3002\u6B64\u64CD\u4F5C\u65E0\u6CD5\u64A4\u9500\u3002","discard.doneMany":"\u5DF2\u4E22\u5F03 {count} \u4E2A\u6587\u4EF6\u7684\u66F4\u6539","discard.doneOne":"\u5DF2\u4E22\u5F03\u6B64\u6587\u4EF6\u7684\u66F4\u6539","discard.more":"\u8FD8\u6709 {count} \u4E2A","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","split.panes":"\u8C03\u6574\u5E76\u6392\u5DEE\u5F02\u7684\u5BBD\u5EA6"},tn="dsh-git.layout",nn="dsh-git.layout.compact",ot="dsh-git.repo.";function ct(t,n){try{return window.localStorage.getItem(t)??n}catch{return n}}function We(t,n){try{window.localStorage.setItem(t,n)}catch{}}var pi=/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent)?"\u2318":"Ctrl",an=new Map;function fn(t){let n=an.get(t);if(n===void 0){let a=new Set,i=!1;n={hook:{getSnapshot:()=>i,subscribe(r){return a.add(r),()=>{a.delete(r)}}},set(r){if(r!==i){i=r;for(let s of[...a])s()}}},an.set(t,n)}return n}var mn="dsh-git.preferences.v1";function ui(){let t={model:null,instruction:""},n=ct(mn,"");if(n==="")return t;try{let a=JSON.parse(n),i=a!==null&&typeof a=="object"?a:{};return{model:Ft(i.model),instruction:typeof i.instruction=="string"?i.instruction:""}}catch{return t}}var Dt=(()=>{let t=ui(),n=new Set;return{hook:{getSnapshot:()=>t,subscribe(a){return n.add(a),()=>{n.delete(a)}}},set(a){t={model:Ft(a.model),instruction:typeof a.instruction=="string"?a.instruction:""},We(mn,JSON.stringify(t));for(let i of[...n])i()}}})(),gi="dsh-git.split",zt=320,lt=220,sn=280,hi=1e4,rn=16;function bn(t,n,a){let r=(()=>{let p=Number.parseFloat(ct(t,""));return Number.isFinite(p)?a(p):n})(),s=new Set;return{get:()=>r,subscribe(p){return s.add(p),()=>{s.delete(p)}},set(p){if(!Number.isFinite(p))return;let u=a(p);if(u!==r){r=u,We(t,String(u));for(let l of[...s])l()}}}}var fi=bn(gi,zt,t=>Math.min(Math.max(Math.round(t),lt),hi)),mi="dsh-git.diffsplit",Lt=.5,on=.02,ln=120,yn=52;function bi(t,n){let a=Math.round(n)-yn;if(a<=0)return Math.min(Math.max(t,0),1);let i=Math.min(.45,ln/a),r=Math.max(.55,1-ln/a);return Math.min(Math.max(t,i),r)}var yi=bn(mi,Lt,t=>Math.round(Math.min(Math.max(t,0),1)*1e3)/1e3);function vn(t){let[n,a]=w(t.get);return A(()=>(a(t.get()),t.subscribe(()=>a(t.get()))),[t]),[n,t.set]}function xn(){return vn(fi)}function vi(){return vn(yi)}function wn(t,n){let a=B(0);A(()=>{let i=t.current;if(i===null)return;let r=()=>{i.style.height="auto";let u=i.offsetHeight-i.clientHeight,l=i.closest(".gitp-root"),c=l===null?600:l.getBoundingClientRect().height,g=Math.max(140,Math.round(c*.45)),b=i.scrollHeight+u;i.style.height=`${Math.min(b,g)}px`,i.style.overflowY=b>g?"auto":"hidden"};if(r(),typeof ResizeObserver>"u")return;let s=i.parentElement;if(s===null)return;let p=new ResizeObserver(u=>{let l=u[0];if(l===void 0)return;let c=Math.round(l.contentRect.width);c!==a.current&&(a.current=c,r())});return p.observe(s),()=>p.disconnect()},[t,n])}function cn(t){return JSON.stringify({provider:t.provider,model:t.model})}function Ft(t){if(t===null||typeof t!="object")return null;let n=t;return typeof n.provider!="string"||n.provider===""||typeof n.model!="string"||n.model===""?null:{provider:n.provider,model:n.model}}function xi(t){try{return Ft(JSON.parse(t))}catch{return null}}function _(...t){return t.filter(Boolean).join(" ")}function dt(t){let n=t.lastIndexOf("/");return n===-1?{dir:"",base:t}:{dir:t.slice(0,n+1),base:t.slice(n+1)}}function Ue(t){return typeof t=="string"?t.slice(0,7):""}function Ot(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 dn(t){return String(t??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60)}function wi(t,n){let a=dn(String(t??"").split(/\r?\n/)[0]);if(a!=="")return a;let i=n?dt(n).base.replace(/\.[^.]+$/,""):"changes";return`${dn(i)||"changes"}-changes`.slice(0,60)}function pn(t){return t.match(/\s+|[A-Za-z0-9_]+|[^\sA-Za-z0-9_]/g)??[]}function ki(t,n){if(t===n||t.length>2e3||n.length>2e3)return null;let a=pn(t),i=pn(n),r=0;for(;r<a.length&&r<i.length&&a[r]===i[r];)r+=1;let s=0;for(;s<a.length-r&&s<i.length-r&&a[a.length-1-s]===i[i.length-1-s];)s+=1;return{lPre:a.slice(0,r).join(""),lMid:a.slice(r,a.length-s).join(""),lSuf:s===0?"":a.slice(a.length-s).join(""),rPre:i.slice(0,r).join(""),rMid:i.slice(r,i.length-s).join(""),rSuf:s===0?"":i.slice(i.length-s).join("")}}function Ni(t,n){let a=[],i=0;for(let r of t){let s=i;if(i=s+r.text.length,n===null||n.to<=n.from){a.push({text:r.text,token:r.token,word:!1});continue}let u=Math.max(0,Math.min(r.text.length,n.from-s)),l=Math.max(u,Math.min(r.text.length,n.to-s));for(let[c,g]of[[r.text.slice(0,u),!1],[r.text.slice(u,l),!0],[r.text.slice(l),!1]])c!==""&&a.push({text:c,token:r.token,word:g})}return a}function At(t,n,a){let i=Ni(t??[{text:n,token:null}],a);if(i.length===0)return"\xA0";let r=[],s=[],p=()=>{s.length!==0&&(r.push(e("span",{className:"gitp-word",key:`w${r.length}`},s)),s=[])};return i.forEach((u,l)=>{let c=u.token===null?e("span",{key:`s${l}`},u.text):e("span",{className:u.token,key:`s${l}`},u.text);if(u.word){s.push(c);return}p(),r.push(c)}),p(),r}function Bt(t,n){return t===null||n===null?null:t[n-1]??null}function un(t){let n=new Date(t);if(Number.isNaN(n.getTime()))return t;let a=Math.round((n.getTime()-Date.now())/1e3),i=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"});if(Math.abs(a)<60)return i.format(a,"second");let r=Math.round(a/60);if(Math.abs(r)<60)return i.format(r,"minute");let s=Math.round(r/60);if(Math.abs(s)<24)return i.format(s,"hour");let p=Math.round(s/24);return Math.abs(p)<30?i.format(p,"day"):n.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function Ci(t){let n=[],a=[];for(let i of t){let r=n.indexOf(i.hash);r===-1&&(r=n.length,n.push(i.hash));let s=i.parents??[];n[r]=s[0]??null;for(let p=1;p<s.length;p+=1){let u=s[p];u!==void 0&&n.splice(r+p,0,u)}for(;n.length>0&&n[n.length-1]===null;)n.pop();a.push({...i,lane:r,laneCount:Math.max(1,n.length)})}return a}function we(t){return t==null?"":t instanceof Error?t.message:String(t)}function D({path:t,size:n=16,viewBox:a="0 0 24 24",className:i,filled:r=!1}){return e("svg",{className:i,width:n,height:n,viewBox:a,fill:r?"currentColor":"none",stroke:r?"none":"currentColor",strokeWidth:r?0:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},e("path",{d:t}))}var x={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"},Ke=20;function Nt({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 Si({size:t=20}){return e(Nt,{size:t})}var Mi=`
7
+ "use strict";var hi=Object.create;var Nt=Object.defineProperty;var mi=Object.getOwnPropertyDescriptor;var fi=Object.getOwnPropertyNames;var bi=Object.getPrototypeOf,vi=Object.prototype.hasOwnProperty;var yi=(t,n)=>{for(var r in n)Nt(t,r,{get:n[r],enumerable:!0})},on=(t,n,r,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of fi(n))!vi.call(t,s)&&s!==r&&Nt(t,s,{get:()=>n[s],enumerable:!(i=mi(n,s))||i.enumerable});return t};var wi=(t,n,r)=>(r=t!=null?hi(bi(t)):{},on(n||!t||!t.__esModule?Nt(r,"default",{value:t,enumerable:!0}):r,t)),xi=t=>on(Nt({},"__esModule",{value:!0}),t);var Ra={};yi(Ra,{apply:()=>Ca,inject:()=>Na});module.exports=xi(Ra);var ve=wi(require("react"),1);var it=require("react"),ki={ts:"typescript",mts:"typescript",cts:"typescript",tsx:"tsx",js:"javascript",mjs:"javascript",cjs:"javascript",jsx:"jsx",json:"json",jsonc:"json",json5:"json",md:"markdown",markdown:"markdown",mdx:"markdown",css:"css",scss:"css",less:"css",html:"html",htm:"html",vue:"html",svelte:"html",py:"python",pyw:"python",yml:"yaml",yaml:"yaml",xml:"xml",svg:"xml",xsd:"xml",sql:"sql",java:"java",c:"cpp",h:"cpp",cc:"cpp",cpp:"cpp",cxx:"cpp",hpp:"cpp",rs:"rust",go:"go",php:"php"},sn=4e3,ln=2e5;function Ni(t){let n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\")),r=t.slice(n+1).toLowerCase(),i=r.lastIndexOf(".");return i<0?"text":ki[r.slice(i+1)]??"text"}var At=null;function Ci(){if(At===null){let t=globalThis.__dshGitDeskRequireAsync;if(typeof t!="function")return Promise.reject(new Error("dsh-git-desk: the highlight chunk loader is unavailable"));At=t("./client.highlight.js")}return At}var Ri={left:null,right:null};function cn(t){let n=(0,it.useMemo)(()=>{if(t===null||t.binary||t.conflict)return null;let s=Ni(t.path);if(s==="text"||t.left.length>sn||t.right.length>sn)return null;let o=t.left.join(`
8
+ `),d=t.right.join(`
9
+ `);return o.length>ln||d.length>ln?null:{language:s,left:o,right:d}},[t]),[r,i]=(0,it.useState)(null);return(0,it.useEffect)(()=>{if(n===null)return;let s=!0;return Ci().then(o=>{s&&i(o)},o=>{console.warn("dsh-git-desk: syntax highlighting is unavailable",o)}),()=>{s=!1}},[n]),(0,it.useMemo)(()=>n===null||r===null?Ri:{left:r.highlightLines(n.left,n.language),right:r.highlightLines(n.right,n.language)},[n,r])}var e=ve.default.createElement,{useState:C,useEffect:O,useRef:G,useMemo:Ie,useCallback:Rt}=ve.default,Ft=class extends Error{code;details;constructor(n,r,i){super(r),this.name="GitCallError",this.code=n,this.details=i}};function dn(t){if(!(t instanceof Error)||!("code"in t))return;let{code:n}=t;return typeof n=="string"?n:void 0}function ne(t){return t instanceof Error?t:new Error(String(t))}var qe="git",zt="dsh-git",Si="dsh-resource://file/session/",Mi=t=>t.startsWith("/")||/^[A-Za-z]:[/\\]/.test(t)||t.startsWith("\\\\"),Ti=t=>t.replace(/\\/g,"/").replace(/^(?:\.\/)+/,"").split("/").map(n=>encodeURIComponent(n)).join("/"),Ct=(t,n)=>`${Si}${encodeURIComponent(t)}/${Ti(n)}`;function Pi(t,n,r){let i=r.replace(/\\/g,"/");if(!Mi(i))return Ct(t,i);let s=n===void 0?"":n.replace(/\\/g,"/").replace(/\/+$/,"");return s!==""&&i===s?Ct(t,""):s!==""&&i.startsWith(`${s}/`)?Ct(t,i.slice(s.length+1)):Ct(t,i)}function Hi(t){let n=t?.rows??[],r=n.findIndex(i=>i.k!=="ctx");if(r<0)return 1;for(let i=r;i<n.length;i+=1){let s=n[i];if(s!==void 0&&s.r!==null)return s.r}return 1}var Ei={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","selection.count":"{count} selected","selection.stage":"Stage selected files","selection.unstage":"Unstage selected files","selection.discard":"Discard selected files","selection.clear":"Clear selection","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","repo.worktree":"Worktree","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","branch.menuTitle":"Branches","branch.actions":"Branch actions","branch.actionsFor":"Actions for {branch}","branch.checkout":"Checkout {branch}","branch.mergeInto":"Merge into {branch}","branch.rebaseOnto":"Rebase {branch} onto {source}","branch.mergeIntoCurrent":"Merge into the current branch","branch.rebaseCurrent":"Rebase the current branch onto {source}","branch.mergeHint":"Fast-forward when {branch} can move forward.","branch.rebaseHint":"Replays your local commits on top of {source}.","branch.checkoutHint":"Switch the working tree to this branch.","branch.checkoutRemoteHint":"Creates a local tracking branch.","branch.localKind":"Local branch","branch.remoteKind":"Remote branch","branch.worktreeKind":"Checked out in {worktree}","branch.finishFirst":"Finish the {operation} first.","branch.detached":"Check out a branch first.","operation.merge":"merge","operation.rebase":"rebase","operation.revert":"revert","operation.cherryPick":"cherry-pick","merge.title":"Merge into {branch}","merge.body":"{source} is merged into {branch}. Git fast-forwards when it can.","merge.sourceLabel":"Source","merge.targetLabel":"Target","merge.resultLabel":"Result","merge.resultFF":"fast-forward when Git can","merge.resultCommit":"a merge commit","merge.noFF":"Always create a merge commit","merge.noFFHint":"Creates a merge commit even when a fast-forward is possible.","merge.note":"A conflict stops the merge. Resolve the files in Changes, then continue.","merge.remoteNote":"Uses the fetched {source}. Fetch first if the remote branch is stale.","merge.confirm":"Merge into {branch}","merge.busy":"Merging","rebase.title":"Rebase onto {source}","rebase.body":"{branch} replays its {count} commits on top of {source}. This rewrites the branch history.","rebase.bodyOne":"{branch} replays its commit on top of {source}. This rewrites the branch history.","rebase.fact":"Commits to replay","rebase.factPushed":"Already on {upstream}","rebase.pushedWarn":"{count} of those commits are already on {upstream}. The next push will be rejected until you force push.","rebase.pushedWarnOne":"1 of those commits is already on {upstream}. The next push will be rejected until you force push.","rebase.dirtyWarn":"{count} files have uncommitted changes. Rebase needs a clean working tree. Commit or stash them first.","rebase.dirtyWarnOne":"1 file has uncommitted changes. Rebase needs a clean working tree. Commit or stash it first.","rebase.note":"A conflict stops the rebase at each commit. Resolve it, then continue or skip the commit.","rebase.confirm":"Rebase onto {source}","rebase.busy":"Rebasing","op.merge":"Merging {source} into {branch}","op.rebase":"Rebasing {branch} onto {source}","op.mergeGeneric":"Merge in progress","op.rebaseGeneric":"Rebase in progress","op.unresolvedCountOne":"1 unresolved file.","op.unresolvedCountMany":"{count} unresolved files.","op.resolveTail":"Resolve and stage the files, then continue.","op.resolveSkipTail":"Resolve and stage the files, then continue or skip this commit.","op.allResolved":"All conflicts resolved.","op.readyMergeTail":"Continue creates the merge commit.","op.readyRebaseTail":"Continue the rebase.","op.continue":"Continue","op.continueHint":"Continue the operation","op.continueBlocked":"Resolve and stage every conflicted file first.","op.skip":"Skip","op.skipHint":"Skip the stopped commit","op.abort":"Abort","op.abortHint":"Abort the {operation} and restore the branch","abort.mergeTitle":"Abort the merge?","abort.mergeBody":"The merge stops and {branch} returns to {hash}. Every conflict resolution is lost.","abort.rebaseTitle":"Abort the rebase?","abort.rebaseBody":"The rebase stops and {branch} returns to {hash}. Every replayed commit and conflict resolution is lost.","abort.genericBody":"The {operation} stops and the branch returns to its state before the operation. Conflict resolutions are lost.","abort.merge":"Abort merge","abort.rebase":"Abort rebase","skip.title":"Skip this commit?","skip.body":"The commit being replayed is dropped, including the conflict resolution. The rebase continues with the next commit.","skip.confirm":"Skip commit","skip.commit":"Stopped commit","conflict.message":"This file has unresolved conflicts. Resolve it, then stage it to continue.","conflict.take":"Take {branch}","conflict.sides":"ours: {ours} \xB7 theirs: {theirs}","conflict.sidesRebase":"ours: {ours}, the branch replayed onto \xB7 theirs: {theirs}, your commits","conflict.externalSides":"The panel did not start this operation, so the branch names are unknown.","opFoot.merge":"Merge in progress. Continue from the banner above.","opFoot.rebase":"Rebase in progress. Continue or skip from the banner above.","toast.merged":"Merged {source} into {branch}","toast.rebased":"Rebased {branch} onto {source}","toast.mergeFinished":"Merge finished","toast.rebaseFinished":"Rebase finished","toast.mergeAborted":"Merge aborted","toast.rebaseAborted":"Rebase aborted","toast.skipped":"Skipped {hash}. Rebase finished.","toast.skippedCommit":"Skipped {hash}","toast.skippedDone":"Commit skipped. Rebase finished.","toast.commitSkipped":"Commit skipped","toast.stoppedAgain":"Rebase stopped again at the next commit.","stash.title":"Stash changes","stash.message":"Stash message","stash.select":"Files to stash","stash.selectHint":"Only selected files are stashed. All staged and unstaged changes in each selected file are included.","stash.busy":"Wait for the current operation to finish.","stash.renameHint":"Renamed files and their old paths cannot be stashed. Deselect them or commit or unstage the rename first.","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}","discard.titleMany":"Discard changes in {count} files?","discard.titleOne":"Discard changes in this file?","discard.bodyMany":"Every local change in these files is lost. This cannot be undone.","discard.doneMany":"Discarded changes in {count} files","discard.doneOne":"Discarded changes in this file","discard.more":"{count} more","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","split.panes":"Resize the diff panes"},Di={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","selection.count":"\u5DF2\u9009\u62E9 {count} \u4E2A\u6587\u4EF6","selection.stage":"\u6682\u5B58\u6240\u9009\u6587\u4EF6","selection.unstage":"\u53D6\u6D88\u6682\u5B58\u6240\u9009\u6587\u4EF6","selection.discard":"\u4E22\u5F03\u6240\u9009\u6587\u4EF6","selection.clear":"\u6E05\u9664\u9009\u62E9","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","repo.worktree":"\u5DE5\u4F5C\u6811","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","branch.menuTitle":"\u5206\u652F","branch.actions":"\u5206\u652F\u64CD\u4F5C","branch.actionsFor":"{branch} \u7684\u64CD\u4F5C","branch.checkout":"\u5207\u6362\u5230 {branch}","branch.mergeInto":"\u5408\u5E76\u5230 {branch}","branch.rebaseOnto":"\u5C06 {branch} \u53D8\u57FA\u5230 {source}","branch.mergeIntoCurrent":"\u5408\u5E76\u5230\u5F53\u524D\u5206\u652F","branch.rebaseCurrent":"\u5C06\u5F53\u524D\u5206\u652F\u53D8\u57FA\u5230 {source}","branch.mergeHint":"\u5F53 {branch} \u53EF\u4EE5\u5FEB\u8FDB\u65F6\u76F4\u63A5\u5FEB\u8FDB\u3002","branch.rebaseHint":"\u628A\u672C\u5730\u63D0\u4EA4\u91CD\u653E\u5230 {source} \u4E4B\u4E0A\u3002","branch.checkoutHint":"\u628A\u5DE5\u4F5C\u533A\u5207\u6362\u5230\u8BE5\u5206\u652F\u3002","branch.checkoutRemoteHint":"\u521B\u5EFA\u672C\u5730\u8DDF\u8E2A\u5206\u652F\u3002","branch.localKind":"\u672C\u5730\u5206\u652F","branch.remoteKind":"\u8FDC\u7AEF\u5206\u652F","branch.worktreeKind":"\u5DF2\u5728 {worktree} \u68C0\u51FA","branch.finishFirst":"\u8BF7\u5148\u5B8C\u6210{operation}\u3002","branch.detached":"\u8BF7\u5148\u5207\u6362\u5230\u4E00\u4E2A\u5206\u652F\u3002","operation.merge":"\u5408\u5E76","operation.rebase":"\u53D8\u57FA","operation.revert":"\u8FD8\u539F","operation.cherryPick":"\u62E3\u9009","merge.title":"\u5408\u5E76\u5230 {branch}","merge.body":"\u628A {source} \u5408\u5E76\u5230 {branch}\u3002Git \u80FD\u5FEB\u8FDB\u65F6\u4F1A\u76F4\u63A5\u5FEB\u8FDB\u3002","merge.sourceLabel":"\u6765\u6E90","merge.targetLabel":"\u76EE\u6807","merge.resultLabel":"\u7ED3\u679C","merge.resultFF":"Git \u80FD\u5FEB\u8FDB\u65F6\u76F4\u63A5\u5FEB\u8FDB","merge.resultCommit":"\u4E00\u4E2A\u5408\u5E76\u63D0\u4EA4","merge.noFF":"\u59CB\u7EC8\u521B\u5EFA\u5408\u5E76\u63D0\u4EA4","merge.noFFHint":"\u5373\u4F7F\u53EF\u4EE5\u5FEB\u8FDB\u4E5F\u521B\u5EFA\u5408\u5E76\u63D0\u4EA4\u3002","merge.note":"\u51B2\u7A81\u4F1A\u4E2D\u6B62\u5408\u5E76\u3002\u5728\u201C\u66F4\u6539\u201D\u4E2D\u89E3\u51B3\u6587\u4EF6\u540E\u7EE7\u7EED\u3002","merge.remoteNote":"\u4F7F\u7528\u5DF2\u83B7\u53D6\u7684 {source}\u3002\u5982\u679C\u8FDC\u7AEF\u5206\u652F\u4E0D\u662F\u6700\u65B0\uFF0C\u8BF7\u5148\u83B7\u53D6\u3002","merge.confirm":"\u5408\u5E76\u5230 {branch}","merge.busy":"\u6B63\u5728\u5408\u5E76","rebase.title":"\u53D8\u57FA\u5230 {source}","rebase.body":"{branch} \u7684 {count} \u4E2A\u63D0\u4EA4\u4F1A\u5728 {source} \u4E4B\u4E0A\u91CD\u653E\u3002\u8FD9\u4F1A\u91CD\u5199\u5206\u652F\u5386\u53F2\u3002","rebase.bodyOne":"{branch} \u7684\u63D0\u4EA4\u4F1A\u5728 {source} \u4E4B\u4E0A\u91CD\u653E\u3002\u8FD9\u4F1A\u91CD\u5199\u5206\u652F\u5386\u53F2\u3002","rebase.fact":"\u8981\u91CD\u653E\u7684\u63D0\u4EA4","rebase.factPushed":"\u5DF2\u5728 {upstream}","rebase.pushedWarn":"\u5176\u4E2D {count} \u4E2A\u63D0\u4EA4\u5DF2\u5728 {upstream}\u3002\u4E0B\u6B21\u63A8\u9001\u4F1A\u88AB\u62D2\u7EDD\uFF0C\u9664\u975E\u5F3A\u5236\u63A8\u9001\u3002","rebase.pushedWarnOne":"\u5176\u4E2D 1 \u4E2A\u63D0\u4EA4\u5DF2\u5728 {upstream}\u3002\u4E0B\u6B21\u63A8\u9001\u4F1A\u88AB\u62D2\u7EDD\uFF0C\u9664\u975E\u5F3A\u5236\u63A8\u9001\u3002","rebase.dirtyWarn":"\u6709 {count} \u4E2A\u6587\u4EF6\u672A\u63D0\u4EA4\u3002\u53D8\u57FA\u9700\u8981\u5E72\u51C0\u7684\u5DE5\u4F5C\u533A\u3002\u8BF7\u5148\u63D0\u4EA4\u6216\u8D2E\u85CF\u3002","rebase.dirtyWarnOne":"\u6709 1 \u4E2A\u6587\u4EF6\u672A\u63D0\u4EA4\u3002\u53D8\u57FA\u9700\u8981\u5E72\u51C0\u7684\u5DE5\u4F5C\u533A\u3002\u8BF7\u5148\u63D0\u4EA4\u6216\u8D2E\u85CF\u3002","rebase.note":"\u6BCF\u4E2A\u63D0\u4EA4\u9047\u5230\u51B2\u7A81\u90FD\u4F1A\u4E2D\u6B62\u53D8\u57FA\u3002\u89E3\u51B3\u540E\u53EF\u4EE5\u7EE7\u7EED\u6216\u8DF3\u8FC7\u8BE5\u63D0\u4EA4\u3002","rebase.confirm":"\u53D8\u57FA\u5230 {source}","rebase.busy":"\u6B63\u5728\u53D8\u57FA","op.merge":"\u6B63\u5728\u628A {source} \u5408\u5E76\u5230 {branch}","op.rebase":"\u6B63\u5728\u628A {branch} \u53D8\u57FA\u5230 {source}","op.mergeGeneric":"\u5408\u5E76\u8FDB\u884C\u4E2D","op.rebaseGeneric":"\u53D8\u57FA\u8FDB\u884C\u4E2D","op.unresolvedCountOne":"\u8FD8\u6709 1 \u4E2A\u672A\u89E3\u51B3\u6587\u4EF6\u3002","op.unresolvedCountMany":"\u8FD8\u6709 {count} \u4E2A\u672A\u89E3\u51B3\u6587\u4EF6\u3002","op.resolveTail":"\u89E3\u51B3\u5E76\u6682\u5B58\u8FD9\u4E9B\u6587\u4EF6\u540E\u7EE7\u7EED\u3002","op.resolveSkipTail":"\u89E3\u51B3\u5E76\u6682\u5B58\u8FD9\u4E9B\u6587\u4EF6\u540E\u7EE7\u7EED\uFF0C\u6216\u8DF3\u8FC7\u6B64\u63D0\u4EA4\u3002","op.allResolved":"\u6240\u6709\u51B2\u7A81\u5DF2\u89E3\u51B3\u3002","op.readyMergeTail":"\u7EE7\u7EED\u4F1A\u521B\u5EFA\u5408\u5E76\u63D0\u4EA4\u3002","op.readyRebaseTail":"\u7EE7\u7EED\u53D8\u57FA\u3002","op.continue":"\u7EE7\u7EED","op.continueHint":"\u7EE7\u7EED\u5F53\u524D\u64CD\u4F5C","op.continueBlocked":"\u8BF7\u5148\u89E3\u51B3\u5E76\u6682\u5B58\u6240\u6709\u51B2\u7A81\u6587\u4EF6\u3002","op.skip":"\u8DF3\u8FC7","op.skipHint":"\u8DF3\u8FC7\u505C\u4E0B\u7684\u63D0\u4EA4","op.abort":"\u4E2D\u6B62","op.abortHint":"\u4E2D\u6B62{operation}\u5E76\u6062\u590D\u5206\u652F","abort.mergeTitle":"\u4E2D\u6B62\u5408\u5E76\uFF1F","abort.mergeBody":"\u5408\u5E76\u4F1A\u505C\u6B62\uFF0C{branch} \u56DE\u5230 {hash}\u3002\u6240\u6709\u51B2\u7A81\u89E3\u51B3\u90FD\u4F1A\u4E22\u5931\u3002","abort.rebaseTitle":"\u4E2D\u6B62\u53D8\u57FA\uFF1F","abort.rebaseBody":"\u53D8\u57FA\u4F1A\u505C\u6B62\uFF0C{branch} \u56DE\u5230 {hash}\u3002\u6240\u6709\u91CD\u653E\u7684\u63D0\u4EA4\u548C\u51B2\u7A81\u89E3\u51B3\u90FD\u4F1A\u4E22\u5931\u3002","abort.genericBody":"{operation}\u4F1A\u505C\u6B62\uFF0C\u5206\u652F\u56DE\u5230\u64CD\u4F5C\u524D\u7684\u72B6\u6001\u3002\u51B2\u7A81\u89E3\u51B3\u4F1A\u4E22\u5931\u3002","abort.merge":"\u4E2D\u6B62\u5408\u5E76","abort.rebase":"\u4E2D\u6B62\u53D8\u57FA","skip.title":"\u8DF3\u8FC7\u6B64\u63D0\u4EA4\uFF1F","skip.body":"\u6B63\u5728\u91CD\u653E\u7684\u63D0\u4EA4\u4F1A\u88AB\u4E22\u5F03\uFF0C\u5305\u62EC\u51B2\u7A81\u89E3\u51B3\u3002\u53D8\u57FA\u4F1A\u7EE7\u7EED\u4E0B\u4E00\u4E2A\u63D0\u4EA4\u3002","skip.confirm":"\u8DF3\u8FC7\u63D0\u4EA4","skip.commit":"\u505C\u4E0B\u7684\u63D0\u4EA4","conflict.message":"\u6B64\u6587\u4EF6\u6709\u672A\u89E3\u51B3\u7684\u51B2\u7A81\u3002\u89E3\u51B3\u5E76\u6682\u5B58\u540E\u7EE7\u7EED\u3002","conflict.take":"\u91C7\u7528 {branch}","conflict.sides":"ours\uFF1A{ours} \xB7 theirs\uFF1A{theirs}","conflict.sidesRebase":"ours\uFF1A{ours}\uFF0C\u88AB\u91CD\u653E\u5230\u7684\u5206\u652F \xB7 theirs\uFF1A{theirs}\uFF0C\u4F60\u7684\u63D0\u4EA4","conflict.externalSides":"\u6B64\u64CD\u4F5C\u4E0D\u662F\u9762\u677F\u53D1\u8D77\u7684\uFF0C\u56E0\u6B64\u4E0D\u77E5\u9053\u5206\u652F\u540D\u3002","opFoot.merge":"\u5408\u5E76\u8FDB\u884C\u4E2D\u3002\u8BF7\u5728\u4E0A\u65B9\u6A2A\u5E45\u4E2D\u7EE7\u7EED\u3002","opFoot.rebase":"\u53D8\u57FA\u8FDB\u884C\u4E2D\u3002\u8BF7\u5728\u4E0A\u65B9\u6A2A\u5E45\u4E2D\u7EE7\u7EED\u6216\u8DF3\u8FC7\u3002","toast.merged":"\u5DF2\u628A {source} \u5408\u5E76\u5230 {branch}","toast.rebased":"\u5DF2\u628A {branch} \u53D8\u57FA\u5230 {source}","toast.mergeFinished":"\u5408\u5E76\u5B8C\u6210","toast.rebaseFinished":"\u53D8\u57FA\u5B8C\u6210","toast.mergeAborted":"\u5DF2\u4E2D\u6B62\u5408\u5E76","toast.rebaseAborted":"\u5DF2\u4E2D\u6B62\u53D8\u57FA","toast.skipped":"\u5DF2\u8DF3\u8FC7 {hash}\u3002\u53D8\u57FA\u5B8C\u6210\u3002","toast.skippedCommit":"\u5DF2\u8DF3\u8FC7 {hash}","toast.skippedDone":"\u5DF2\u8DF3\u8FC7\u63D0\u4EA4\u3002\u53D8\u57FA\u5B8C\u6210\u3002","toast.commitSkipped":"\u5DF2\u8DF3\u8FC7\u63D0\u4EA4","toast.stoppedAgain":"\u53D8\u57FA\u5728\u4E0B\u4E00\u4E2A\u63D0\u4EA4\u5904\u518D\u6B21\u505C\u4E0B\u3002","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\uFF0C\u6BCF\u4E2A\u6587\u4EF6\u4E2D\u5DF2\u6682\u5B58\u548C\u672A\u6682\u5B58\u7684\u66F4\u6539\u90FD\u4F1A\u5305\u542B\u3002","stash.busy":"\u8BF7\u7B49\u5F85\u5F53\u524D\u64CD\u4F5C\u5B8C\u6210\u3002","stash.renameHint":"\u65E0\u6CD5\u8D2E\u85CF\u91CD\u547D\u540D\u7684\u6587\u4EF6\u6216\u5176\u65E7\u8DEF\u5F84\u3002\u8BF7\u53D6\u6D88\u9009\u62E9\uFF0C\u6216\u5148\u63D0\u4EA4\u6216\u53D6\u6D88\u6682\u5B58\u91CD\u547D\u540D\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}","discard.titleMany":"\u4E22\u5F03 {count} \u4E2A\u6587\u4EF6\u7684\u66F4\u6539\uFF1F","discard.titleOne":"\u4E22\u5F03\u6B64\u6587\u4EF6\u7684\u66F4\u6539\uFF1F","discard.bodyMany":"\u8FD9\u4E9B\u6587\u4EF6\u7684\u6240\u6709\u672C\u5730\u66F4\u6539\u90FD\u4F1A\u4E22\u5931\u3002\u6B64\u64CD\u4F5C\u65E0\u6CD5\u64A4\u9500\u3002","discard.doneMany":"\u5DF2\u4E22\u5F03 {count} \u4E2A\u6587\u4EF6\u7684\u66F4\u6539","discard.doneOne":"\u5DF2\u4E22\u5F03\u6B64\u6587\u4EF6\u7684\u66F4\u6539","discard.more":"\u8FD8\u6709 {count} \u4E2A","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","split.panes":"\u8C03\u6574\u5E76\u6392\u5DEE\u5F02\u7684\u5BBD\u5EA6"},pn="dsh-git.layout",un="dsh-git.layout.compact",gt="dsh-git.repo.";function mt(t,n){try{return window.localStorage.getItem(t)??n}catch{return n}}function Xe(t,n){try{window.localStorage.setItem(t,n)}catch{}}var Ai=/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent)?"\u2318":"Ctrl",gn=new Map;function Cn(t){let n=gn.get(t);if(n===void 0){let r=new Set,i=!1;n={hook:{getSnapshot:()=>i,subscribe(s){return r.add(s),()=>{r.delete(s)}}},set(s){if(s!==i){i=s;for(let o of[...r])o()}}},gn.set(t,n)}return n}var Rn="dsh-git.preferences.v1";function zi(){let t={model:null,instruction:""},n=mt(Rn,"");if(n==="")return t;try{let r=JSON.parse(n),i=r!==null&&typeof r=="object"?r:{};return{model:$t(i.model),instruction:typeof i.instruction=="string"?i.instruction:""}}catch{return t}}var It=(()=>{let t=zi(),n=new Set;return{hook:{getSnapshot:()=>t,subscribe(r){return n.add(r),()=>{n.delete(r)}}},set(r){t={model:$t(r.model),instruction:typeof r.instruction=="string"?r.instruction:""},Xe(Rn,JSON.stringify(t));for(let i of[...n])i()}}})(),Li="dsh-git.split",Ot=320,ht=220,hn=280,Bi=1e4,mn=16;function Sn(t,n,r){let s=(()=>{let d=Number.parseFloat(mt(t,""));return Number.isFinite(d)?r(d):n})(),o=new Set;return{get:()=>s,subscribe(d){return o.add(d),()=>{o.delete(d)}},set(d){if(!Number.isFinite(d))return;let g=r(d);if(g!==s){s=g,Xe(t,String(g));for(let l of[...o])l()}}}}var Fi=Sn(Li,Ot,t=>Math.min(Math.max(Math.round(t),ht),Bi)),Ii="dsh-git.diffsplit",jt=.5,fn=.02,bn=120,Mn=52;function Oi(t,n){let r=Math.round(n)-Mn;if(r<=0)return Math.min(Math.max(t,0),1);let i=Math.min(.45,bn/r),s=Math.max(.55,1-bn/r);return Math.min(Math.max(t,i),s)}var ji=Sn(Ii,jt,t=>Math.round(Math.min(Math.max(t,0),1)*1e3)/1e3);function Tn(t){let[n,r]=C(t.get);return O(()=>(r(t.get()),t.subscribe(()=>r(t.get()))),[t]),[n,t.set]}function Pn(){return Tn(Fi)}function Gi(){return Tn(ji)}function Hn(t,n){let r=G(0);O(()=>{let i=t.current;if(i===null)return;let s=()=>{i.style.height="auto";let g=i.offsetHeight-i.clientHeight,l=i.closest(".gitp-root"),c=l===null?600:l.getBoundingClientRect().height,m=Math.max(140,Math.round(c*.45)),v=i.scrollHeight+g;i.style.height=`${Math.min(v,m)}px`,i.style.overflowY=v>m?"auto":"hidden"};if(s(),typeof ResizeObserver>"u")return;let o=i.parentElement;if(o===null)return;let d=new ResizeObserver(g=>{let l=g[0];if(l===void 0)return;let c=Math.round(l.contentRect.width);c!==r.current&&(r.current=c,s())});return d.observe(o),()=>d.disconnect()},[t,n])}function vn(t){return JSON.stringify({provider:t.provider,model:t.model})}function $t(t){if(t===null||typeof t!="object")return null;let n=t;return typeof n.provider!="string"||n.provider===""||typeof n.model!="string"||n.model===""?null:{provider:n.provider,model:n.model}}function Wi(t){try{return $t(JSON.parse(t))}catch{return null}}function Y(...t){return t.filter(Boolean).join(" ")}function bt(t){let n=t.lastIndexOf("/");return n===-1?{dir:"",base:t}:{dir:t.slice(0,n+1),base:t.slice(n+1)}}function Se(t){return typeof t=="string"?t.slice(0,7):""}function Ut(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 yn(t){return String(t??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60)}function Ki(t,n){let r=yn(String(t??"").split(/\r?\n/)[0]);if(r!=="")return r;let i=n?bt(n).base.replace(/\.[^.]+$/,""):"changes";return`${yn(i)||"changes"}-changes`.slice(0,60)}function wn(t){return t.match(/\s+|[A-Za-z0-9_]+|[^\sA-Za-z0-9_]/g)??[]}function $i(t,n){if(t===n||t.length>2e3||n.length>2e3)return null;let r=wn(t),i=wn(n),s=0;for(;s<r.length&&s<i.length&&r[s]===i[s];)s+=1;let o=0;for(;o<r.length-s&&o<i.length-s&&r[r.length-1-o]===i[i.length-1-o];)o+=1;return{lPre:r.slice(0,s).join(""),lMid:r.slice(s,r.length-o).join(""),lSuf:o===0?"":r.slice(r.length-o).join(""),rPre:i.slice(0,s).join(""),rMid:i.slice(s,i.length-o).join(""),rSuf:o===0?"":i.slice(i.length-o).join("")}}function Ui(t,n){let r=[],i=0;for(let s of t){let o=i;if(i=o+s.text.length,n===null||n.to<=n.from){r.push({text:s.text,token:s.token,word:!1});continue}let g=Math.max(0,Math.min(s.text.length,n.from-o)),l=Math.max(g,Math.min(s.text.length,n.to-o));for(let[c,m]of[[s.text.slice(0,g),!1],[s.text.slice(g,l),!0],[s.text.slice(l),!1]])c!==""&&r.push({text:c,token:s.token,word:m})}return r}function Gt(t,n,r){let i=Ui(t??[{text:n,token:null}],r);if(i.length===0)return"\xA0";let s=[],o=[],d=()=>{o.length!==0&&(s.push(e("span",{className:"gitp-word",key:`w${s.length}`},o)),o=[])};return i.forEach((g,l)=>{let c=g.token===null?e("span",{key:`s${l}`},g.text):e("span",{className:g.token,key:`s${l}`},g.text);if(g.word){o.push(c);return}d(),s.push(c)}),d(),s}function Wt(t,n){return t===null||n===null?null:t[n-1]??null}function xn(t){let n=new Date(t);if(Number.isNaN(n.getTime()))return t;let r=Math.round((n.getTime()-Date.now())/1e3),i=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"});if(Math.abs(r)<60)return i.format(r,"second");let s=Math.round(r/60);if(Math.abs(s)<60)return i.format(s,"minute");let o=Math.round(s/60);if(Math.abs(o)<24)return i.format(o,"hour");let d=Math.round(o/24);return Math.abs(d)<30?i.format(d,"day"):n.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function Vi(t){let n=[],r=[];for(let i of t){let s=n.indexOf(i.hash);s===-1&&(s=n.length,n.push(i.hash));let o=i.parents??[];n[s]=o[0]??null;for(let d=1;d<o.length;d+=1){let g=o[d];g!==void 0&&n.splice(s+d,0,g)}for(;n.length>0&&n[n.length-1]===null;)n.pop();r.push({...i,lane:s,laneCount:Math.max(1,n.length)})}return r}function ye(t){return t==null?"":t instanceof Error?t.message:String(t)}function A({path:t,size:n=16,viewBox:r="0 0 24 24",className:i,filled:s=!1}){return e("svg",{className:i,width:n,height:n,viewBox:r,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",merge:"M6 3v12a3 3 0 0 0 3 3h6M6 3.5a1 1 0 1 0 0-.1M18 18.5a1 1 0 1 0 0-.1",rebase:"M6 21V9a3 3 0 0 1 3-3h6M15 3l3 3-3 3M6 21.5a1 1 0 1 0 0-.1M18 6.5a1 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"},Ye=20;function St({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 _i({size:t=20}){return e(St,{size:t})}var qi=`
10
10
  .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}
11
11
  .gitp-root *{box-sizing:border-box}
12
12
  .gitp-root button,.gitp-root input,.gitp-root textarea{font:inherit;color:inherit}
@@ -143,7 +143,7 @@ button[data-forge-header]{display:none}
143
143
  .gitp-seg button:hover:not(.is-active){color:var(--dsw-alias-label-primary)}
144
144
  .gitp-seg button.is-active{background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);box-shadow:var(--dsw-elevation-soft,0 1px 2px rgba(0,0,0,.12))}
145
145
  .gitp-conflict-banner{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:8px 12px;border-bottom:1px solid var(--dsw-alias-border-l1);background:color-mix(in srgb,var(--dsw-alias-state-error-primary) 8%,var(--dsw-alias-bg-base));color:var(--dsw-alias-state-error-primary);font-size:12px;line-height:18px;flex:none}
146
- .gitp-conflict-banner span{flex:1;min-width:160px}
146
+ .gitp-conflict-banner .gitp-conflict-text{flex:1;min-width:160px}
147
147
  .gitp-pane-heads{display:flex;flex:none;height:28px;border-bottom:1px solid var(--dsw-alias-border-l1);font-size:12px;color:var(--dsw-alias-label-tertiary)}
148
148
  .gitp-pane-head{display:flex;align-items:center;flex:1;min-width:0;padding:0 12px;font-weight:500}
149
149
  .gitp-pane-head-gutter{width:52px;flex:none;border-left:1px solid var(--dsw-alias-border-l1);border-right:1px solid var(--dsw-alias-border-l1)}
@@ -301,6 +301,43 @@ button[data-forge-header]{display:none}
301
301
  .gitp-popover-hint{flex:none;max-width:140px;font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
302
302
  .gitp-worktree{flex:none;padding:1px 6px;border-radius:var(--dsw-radius-sm,8px);background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px;white-space:nowrap}
303
303
  .gitp-popover .gitp-modal-sub{padding:6px 8px;margin:0;color:var(--dsw-alias-label-tertiary)}
304
+ .gitp-branch-row{display:flex;align-items:center;gap:2px;border-radius:var(--dsw-radius-sm,8px)}
305
+ .gitp-branch-row:hover{background:var(--dsw-alias-interactive-bg-hover)}
306
+ .gitp-branch-row .gitp-branch-pick{flex:1;min-width:0;width:auto;border-radius:var(--dsw-radius-sm,8px)}
307
+ .gitp-branch-row .gitp-branch-pick:hover:not(:disabled){background:transparent}
308
+ .gitp-branch-row .gitp-branch-pick[aria-current=true]:disabled{opacity:1;cursor:default}
309
+ .gitp-branch-actions{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:0;border-radius:6px;background:transparent;color:var(--dsw-alias-label-tertiary);cursor:pointer;flex:none;opacity:.7;transition:opacity 100ms ease,background-color 100ms ease,color 100ms ease}
310
+ .gitp-branch-row:hover .gitp-branch-actions,.gitp-branch-actions:focus-visible{opacity:1}
311
+ .gitp-branch-actions:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-accent,var(--dsw-alias-interactive-bg-active));color:var(--dsw-alias-label-primary)}
312
+ .gitp-branch-actions:disabled{opacity:.4;cursor:default}
313
+ .gitp-branch-pane-head{display:flex;align-items:center;gap:6px;padding:2px 4px 6px}
314
+ .gitp-branch-pane-head .gitp-iconbtn{width:26px;height:26px;min-width:26px;border-radius:7px}
315
+ .gitp-branch-pane-name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:500}
316
+ .gitp-branch-pane-meta{padding:0 8px 6px;font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary)}
317
+ .gitp-opbanner{display:flex;flex-wrap:wrap;align-items:flex-start;gap:8px 10px;flex:none;margin:0 12px 8px;padding:8px 8px 8px 12px;border-radius:var(--dsw-radius-sm,8px);background:color-mix(in srgb,var(--dsw-alias-state-warn-primary) 9%,var(--dsw-alias-bg-base));box-shadow:inset 2px 0 0 var(--dsw-alias-state-warn-primary)}
318
+ .gitp-opbanner-icon{display:flex;flex:none;color:var(--dsw-alias-state-warn-primary);margin-top:2px}
319
+ .gitp-opbanner-main{display:flex;flex:1;min-width:190px;flex-direction:column;gap:1px}
320
+ .gitp-opbanner-title{font-size:13px;line-height:20px;font-weight:500;color:var(--dsw-alias-label-primary)}
321
+ .gitp-opbanner-meta{font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary);text-wrap:pretty}
322
+ .gitp-opbanner-meta .is-bad{color:var(--dsw-alias-state-error-primary);font-weight:500}
323
+ .gitp-opbanner-meta .is-ok{color:var(--dsw-alias-state-success-primary);font-weight:500}
324
+ .gitp-opbanner-actions{display:flex;align-items:center;gap:6px;flex:none;margin-left:auto}
325
+ .gitp-opbanner-actions .gitp-btn{height:28px;padding:0 10px;font-size:12px}
326
+ .gitp-opbanner-actions .is-abort{color:var(--dsw-alias-label-secondary)}
327
+ .gitp-opbanner-actions .is-abort:hover:not(:disabled){background:color-mix(in srgb,var(--dsw-alias-state-error-primary) 12%,transparent);color:var(--dsw-alias-state-error-primary)}
328
+ .gitp-opfoot{display:flex;align-items:flex-start;gap:8px;flex:none;padding:10px 12px;border-top:1px solid var(--dsw-alias-border-l1);font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary)}
329
+ .gitp-opfoot svg{flex:none;margin-top:1px;color:var(--dsw-alias-label-tertiary)}
330
+ .gitp-commitbox.is-hidden{display:none}
331
+ .gitp-modal-facts{display:flex;flex-direction:column;gap:4px;margin:0 0 14px;padding:8px 10px;border-radius:var(--dsw-radius-sm,8px);background:var(--dsw-alias-interactive-bg-hover);font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary)}
332
+ .gitp-modal-fact{display:flex;align-items:baseline;justify-content:space-between;gap:10px}
333
+ .gitp-modal-fact b{min-width:0;overflow-wrap:anywhere;text-align:right;font-weight:500;color:var(--dsw-alias-label-primary)}
334
+ .gitp-modal-hint{margin:6px 0 12px;font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary);text-wrap:pretty}
335
+ .gitp-modal-warn.is-caution{background:color-mix(in srgb,var(--dsw-alias-state-warn-primary) 12%,transparent);color:var(--dsw-alias-state-warn-primary)}
336
+ .gitp-conflict-actions{display:flex;gap:6px;flex:none}
337
+ .gitp-conflict-sides{flex-basis:100%;font-size:11px;line-height:16px;color:var(--dsw-alias-label-tertiary);text-wrap:pretty}
338
+ .gitp-root.is-compact .gitp-opbanner{margin:0 8px 8px;padding:8px 8px 8px 10px}
339
+ .gitp-root.is-compact .gitp-opbanner-actions{width:100%;justify-content:flex-end}
340
+ .gitp-root.is-compact .gitp-branch-row .gitp-branch-pick{padding-left:8px}
304
341
  .gitp-center{display:flex;flex:1;flex-direction:column;align-items:center;justify-content:center;gap:4px;padding:32px 24px;text-align:center;color:var(--dsw-alias-label-tertiary)}
305
342
  .gitp-center-title{font-size:14px;line-height:22px;font-weight:500;color:var(--dsw-alias-label-primary)}
306
343
  .gitp-center-hint{max-width:320px;font-size:13px;line-height:20px;color:var(--dsw-alias-label-tertiary);text-wrap:pretty}
@@ -345,7 +382,7 @@ button[data-forge-header]{display:none}
345
382
  .gitp-settings select:focus,.gitp-settings textarea:focus{outline:none;border-color:var(--dsw-alias-state-business-primary)}
346
383
  .gitp-settings select:focus-visible,.gitp-settings textarea:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:1px}
347
384
  .gitp-settings-actions{display:flex;justify-content:flex-end}
348
- `,gn="dsh-git-desk/styles";if(typeof document<"u"&&document.querySelector(`style[data-plugin-css=${JSON.stringify(gn)}]`)===null){let t=document.createElement("style");t.dataset.plugin="dsh-git-desk",t.dataset.pluginCss=gn,t.textContent=Mi,document.head.appendChild(t)}function ke({icon:t,title:n,hint:a,action:i}){return e("div",{className:"gitp-center"},t?e("div",{className:"gitp-center-icon"},t):null,e("div",{className:"gitp-center-title"},n),a?e("div",{className:"gitp-center-hint"},a):null,i??null)}function le(){return e("span",{className:"gitp-spinner","aria-hidden":"true"})}function Me({label:t,icon:n,onClick:a,disabled:i,active:r}){return e("button",{type:"button",className:_("gitp-iconbtn",r&&"is-active"),onClick:a,disabled:i,"aria-label":t,title:t},e(D,{path:n}))}function Et({label:t,icon:n,count:a,onClick:i,disabled:r,busy:s}){return e("button",{type:"button",className:_("gitp-toolbtn",a>0&&"has-count"),onClick:i,disabled:r||s,"aria-label":a>0?`${t}, ${a}`:t,title:a>0?`${t} (${a})`:t},s?e(le):e(D,{path:n,size:14}),a>0?e("span",{className:"gitp-toolbtn-num"},a>99?"99+":String(a)):null)}function pt({title:t,onClose:n,children:a,danger:i,closeLabel:r="Close"}){let s=B(null),p=B(n);return p.current=n,A(()=>{let u=document.activeElement,l=s.current;l?.querySelector("input, textarea, select, button")?.focus();let g=b=>{if(b.key==="Escape"){b.preventDefault(),b.stopPropagation(),p.current();return}if(b.key!=="Tab"||l===null)return;let m=[...l.querySelectorAll('button, input, textarea, select, [href], [tabindex]:not([tabindex="-1"])')].filter(R=>!R.hasAttribute("disabled")&&R.offsetParent!==null);if(m.length===0)return;let h=m[0],C=m[m.length-1];h===void 0||C===void 0||(b.shiftKey&&document.activeElement===h?(b.preventDefault(),C.focus()):!b.shiftKey&&document.activeElement===C&&(b.preventDefault(),h.focus()))};return document.addEventListener("keydown",g,!0),()=>{document.removeEventListener("keydown",g,!0),u instanceof HTMLElement&&typeof u.focus=="function"&&u.focus()}},[]),e("div",{className:"gitp-modal-layer",onMouseDown:u=>{u.target===u.currentTarget&&p.current()}},e("div",{className:_("gitp-modal",i&&"is-danger"),ref:s,role:"dialog","aria-modal":"true","aria-label":t},e("div",{className:"gitp-modal-head"},e("div",{className:"gitp-modal-title"},t),e(Me,{label:r,icon:x.close,onClick:n})),a))}function jt({title:t,body:n,confirmLabel:a,cancelLabel:i,danger:r,busy:s,onConfirm:p,onClose:u}){return e(pt,{title:t,onClose:u,danger:r},e("div",{className:"gitp-modal-sub"},n),e("div",{className:"gitp-modal-actions"},e("button",{type:"button",className:"gitp-btn",onClick:u,disabled:s},i),e("button",{type:"button",className:_("gitp-btn",r?"is-danger":"is-primary"),onClick:p,disabled:s},s?e(le):null,a)))}function Ri({t,defaultName:n,defaultMessage:a,busy:i,noVerify:r,error:s,onCreate:p,onNoVerify:u,onClose:l}){let[c,g]=w(n),[b,m]=w(a),h=B(null);wn(h,b);let C=c.trim()!==""&&b.trim()!==""&&!i;return e(pt,{title:t("branch.title"),onClose:l,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:c,onChange:R=>g(R.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:h,value:b,onChange:R=>m(R.target.value)})),e("label",{className:"gitp-dialog-option",title:t("commit.noVerifyHint")},e("input",{type:"checkbox",checked:r,onChange:R=>u(R.target.checked),disabled:i}),t("commit.noVerify")),s?e("div",{className:"gitp-modal-error"},s):null,e("div",{className:"gitp-modal-actions"},e("button",{type:"button",className:"gitp-btn",onClick:l,disabled:i},t("action.cancel")),e("button",{type:"button",className:"gitp-btn is-primary",disabled:!C,onClick:()=>p({name:c.trim(),message:b.trim()})},i?e(le):null,t("action.createBranch"))))}function kn({t,files:n,busy:a,error:i,onCreate:r,onClose:s}){let[p,u]=w(()=>new Set(n.map(b=>b.path))),[l,c]=w(""),g=b=>{u(m=>{let h=new Set(m);return h.has(b)?h.delete(b):h.add(b),h})};return e(pt,{title:t("stash.title"),onClose:()=>{a||s()},closeLabel:t("action.close")},e("div",{className:"gitp-modal-sub"},t("stash.selectHint")),e("div",{className:"gitp-modal-sub"},t("stash.renameHint")),n.length>1?e("div",{style:{display:"flex",justifyContent:"flex-end",marginBottom:"4px"}},e("button",{type:"button",className:"gitp-linkbtn",onClick:()=>u(p.size===n.length?new Set:new Set(n.map(b=>b.path)))},p.size===n.length?t("stash.deselectAll"):t("stash.selectAll"))):null,n.length===0?e("div",{className:"gitp-modal-sub"},t("stash.nothing")):e("div",{className:"gitp-filechecks"},n.map(b=>e("label",{className:"gitp-check",key:b.path},e("input",{type:"checkbox",checked:p.has(b.path),onChange:()=>g(b.path)}),e("span",{className:"gitp-check-path"},b.path)))),e("div",{className:"gitp-field"},e("label",{htmlFor:"gitp-stash-message"},t("stash.message")),e("input",{id:"gitp-stash-message",value:l,onChange:b=>c(b.target.value),placeholder:t("stash.default")})),i?e("div",{className:"gitp-modal-error",role:"alert"},i):null,e("div",{className:"gitp-modal-actions"},e("button",{type:"button",className:"gitp-btn",onClick:s,disabled:a},t("action.cancel")),e("button",{type:"button",className:"gitp-btn is-primary",disabled:a||p.size===0,onClick:()=>r({paths:[...p],message:l.trim()})},a?e(le):null,t("action.stash"))))}function Pt({entry:t,side:n,selected:a,focused:i,busy:r,t:s,onActivate:p,onToggle:u}){let l=dt(t.path),c=n==="staged"?t.stagedAdd:t.add,g=n==="staged"?t.stagedDel:t.del,b=s(n==="staged"?"action.unstageFile":"action.stageFile");return e("div",{className:_("gitp-filerow",a&&"is-selected",i&&"is-focused"),role:"button",tabIndex:0,"aria-pressed":a,onClick:m=>p(m),onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),p(m))}},e("span",{className:_("gitp-status",Ot(t.letter))},t.letter),e("span",{className:"gitp-filename"},l.dir?e("span",{className:"gitp-filedir"},l.dir):null,l.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"},c!==null&&c>0?e("span",{className:"gitp-add"},`+${c}`):null,g!==null&&g>0?e("span",{className:"gitp-del"},`\u2212${g}`):null),n==="conflict"?null:e("button",{type:"button",className:"gitp-rowaction","aria-label":b,title:b,disabled:r,onClick:m=>{m.stopPropagation(),u()}},e(D,{path:n==="staged"?x.minus:x.plus,size:14})))}function Ti({t,snapshot:n,conflicts:a,staged:i,unstaged:r,selection:s,onSelect:p,busy:u,fileBusy:l,onToggleFile:c,onToggleAll:g,onDiscard:b,onBatchStage:m,onBatchUnstage:h,onBatchDiscard:C,onStash:R,diff:P,diffLoading:T,layout:J,onLayout:H,onRefresh:U,onBlock:X,onResolve:f,onOpen:N,message:z,onMessage:G,onCommit:k,onBranch:F,canCommit:j,commitBusy:K,aiBusy:ne,aiMenuOpen:He,onAiToggle:ae,onAiClose:he,onAiWrite:me,onAiBranch:O,selectionKey:te,amend:fe,onAmend:ue,noVerify:Fe,onNoVerify:Ce,canAmend:be,compact:ye,onBack:Se}){let[De,Je]=w(""),[Ve,Ze]=xn(),ze=B(null),Le=B(null),Ae=B(null);wn(Ae,z);let ve=(d,S)=>`${d}\0${S}`,[Z,ge]=w(()=>s===null||s.side==="conflict"?new Set:new Set([ve(s.side,s.path)])),[ce,re]=w(!1),[se,v]=w(null),[M,W]=w(null),$=B(!1);A(()=>{se!==null||!$.current||($.current=!1,(Le.current?.querySelector(".gitp-filerow")??Le.current?.querySelector(".gitp-filter-box input"))?.focus())},[se,n]);let V=B(null),[Y,ut]=w({conflicts:!1,staged:!1,unstaged:!1}),Re=d=>ut(S=>({...S,[d]:!S[d]})),Be=De.trim().toLowerCase(),_e=d=>Be===""||d.path.toLowerCase().includes(Be),Oe=Pe(()=>a.filter(_e),[a,Be]),Te=Pe(()=>i.filter(_e),[i,Be]),L=Pe(()=>r.filter(_e),[r,Be]),Ie=d=>{let S=d.indexOf("\0");if(S<0)return null;let I=d.slice(0,S);if(I!=="staged"&&I!=="unstaged")return null;let q=d.slice(S+1),oe=(I==="staged"?i:r).find(pe=>pe.path===q);return oe===void 0?null:{side:I,entry:oe}},Qe=Pe(()=>{let d=[];for(let S of Z){let I=Ie(S);I!==null&&d.push(I)}return d},[Z,i,r]),gt=Qe.filter(d=>d.side==="unstaged"),ht=Qe.filter(d=>d.side==="staged");A(()=>{ge(d=>{if(d.size===0)return d;let S=new Set;for(let I of d)Ie(I)!==null&&S.add(I);return S.size===d.size?d:S})},[n,s]),A(()=>{Z.size===0&&re(!1)},[Z.size]);function et(d,S){if(d==="conflict"){V.current=null,ge(new Set),p({side:d,path:S.path,renamed:!1});return}V.current={side:d,path:S.path,renamed:S.kind==="renamed"},ge(new Set([ve(d,S.path)])),p({side:d,path:S.path,renamed:S.kind==="renamed"})}function tt(d,S){let I=ve(d,S.path);if(Z.has(I)){let q=new Set(Z);if(q.delete(I),s!==null&&s.side===d&&s.path===S.path){let oe=[...q].pop(),pe=oe===void 0?null:Ie(oe);p(pe===null?null:{side:pe.side,path:pe.entry.path,renamed:pe.entry.kind==="renamed"})}ge(q);return}V.current={side:d,path:S.path,renamed:S.kind==="renamed"},ge(new Set([...Z,I])),p({side:d,path:S.path,renamed:S.kind==="renamed"})}function Ct(d,S){let I=d==="staged"?Te:L,q=V.current!==null&&V.current.side===d?V.current.path:null,oe=q===null?-1:I.findIndex($e=>$e.path===q),pe=I.findIndex($e=>$e.path===S.path);if(oe<0||pe<0){et(d,S);return}let[St,bt]=oe<=pe?[oe,pe]:[pe,oe];ge(new Set(I.slice(St,bt+1).map($e=>ve(d,$e.path)))),p({side:d,path:S.path,renamed:S.kind==="renamed"})}function qe(d,S,I){let q=I!==null&&(I.metaKey||I.ctrlKey),oe=I!==null&&I.shiftKey;if(d==="conflict"){if(q||oe)return;re(!1),et(d,S);return}if(I===null){re(!1),et(d,S);return}if(oe){re(!0),Ct(d,S);return}if(q){re(!0),tt(d,S);return}re(!1),et(d,S)}function je(d){if(Je(d),Z.size===0)return;let S=ce;ge(new Set),re(!1),V.current=null,S&&p(null)}function nt(){ge(new Set),re(!1),V.current=null,p(null)}async function Q(d){let S=d==="stage"?gt:d==="unstage"?ht:Qe;if(S.length===0)return;let I=S.map(oe=>oe.entry);if(d==="discard"){C(I);return}(d==="stage"?await m(I):await h(I))&&(ge(new Set),re(!1),Le.current?.querySelector(".gitp-filerow")?.focus())}let de=s===null||s.side==="conflict"?null:(s.side==="staged"?i:r).find(d=>d.path===s.path)??null;function ft(d){let S=[...new Map(d.map(I=>[I.path,I])).values()];S.length!==0&&(W(null),v(S))}async function mt(d){W(null);try{await R(d),$.current=!0,v(null),nt()}catch(S){W(we(S))}}let at=Pe(()=>{let d=0,S=0;for(let I of i)d+=I.stagedAdd??0,S+=I.stagedDel??0;return{add:d,del:S}},[i]),st=!ye||s===null||ce,Xe=!ye||s!==null&&!ce,Ee=Oe.length+Te.length+L.length,it=a.length+i.length+r.length;return e("div",{className:"gitp-changes",ref:ze},st?e("div",{className:"gitp-listcol",ref:Le,style:ye?void 0:{width:`${Ve}px`}},it>0?e("div",{className:"gitp-filter-box"},e(D,{path:x.search,size:13}),e("input",{type:"text",value:De,onChange:d=>je(d.target.value),placeholder:t("filter.placeholder"),"aria-label":t("filter.placeholder"),spellCheck:!1}),De?e("button",{type:"button",className:"gitp-filter-clear",onClick:()=>je(""),"aria-label":t("filter.clear")},e(D,{path:x.close,size:10})):null):null,Z.size>1?e("div",{className:"gitp-batchbar",role:"group","aria-label":t("selection.count",{count:Z.size})},e("span",{className:"gitp-batch-count"},t("selection.count",{count:Z.size})),e("button",{type:"button",className:"gitp-batch-btn","aria-label":t("selection.stage"),title:t("selection.stage"),disabled:l||gt.length===0,onClick:()=>Q("stage")},e(D,{path:x.plus,size:14})),e("button",{type:"button",className:"gitp-batch-btn","aria-label":t("selection.unstage"),title:t("selection.unstage"),disabled:l||ht.length===0,onClick:()=>Q("unstage")},e(D,{path:x.minus,size:14})),e("button",{type:"button",className:"gitp-batch-btn","aria-label":t("action.stash"),title:t("action.stash"),disabled:l,onClick:()=>ft(Qe.map(d=>d.entry))},e(D,{path:x.stash,size:14})),e("button",{type:"button",className:"gitp-batch-btn is-danger","aria-label":t("selection.discard"),title:t("selection.discard"),disabled:l,onClick:()=>Q("discard")},e(D,{path:x.trash,size:14})),e("button",{type:"button",className:"gitp-batch-btn","aria-label":t("selection.clear"),title:t("selection.clear"),disabled:l,onClick:nt},e(D,{path:x.close,size:14}))):null,e("div",{className:"gitp-filelist"},Oe.length>0?e(Ne.default.Fragment,null,e("div",{className:"gitp-section-head is-conflict",onClick:()=>Re("conflicts"),onKeyDown:d=>{d.target!==d.currentTarget||d.key!=="Enter"&&d.key!==" "||(d.preventDefault(),Re("conflicts"))},role:"button","aria-expanded":!Y.conflicts,tabIndex:0},e(D,{path:x.chevron,size:14,className:_("gitp-section-chev",Y.conflicts&&"is-collapsed")}),e("span",{className:"gitp-section-title"},t("section.conflicts")),e("span",{className:"gitp-section-count"},String(Oe.length))),Y.conflicts?null:Oe.map(d=>e(Pt,{key:`conflict:${d.path}`,entry:d,side:"conflict",selected:s?.side==="conflict"&&s.path===d.path,focused:!1,busy:l,t,onActivate:S=>qe("conflict",d,S),onToggle:()=>{}}))):null,Te.length>0?e(Ne.default.Fragment,null,e("div",{className:"gitp-section-head",onClick:()=>Re("staged"),onKeyDown:d=>{d.target!==d.currentTarget||d.key!=="Enter"&&d.key!==" "||(d.preventDefault(),Re("staged"))},role:"button","aria-expanded":!Y.staged,tabIndex:0},e(D,{path:x.chevron,size:14,className:_("gitp-section-chev",Y.staged&&"is-collapsed")}),e("span",{className:"gitp-section-title"},t("section.staged")),e("span",{className:"gitp-section-count"},String(Te.length)),e("button",{type:"button",className:"gitp-section-action","aria-label":t("action.unstageAll"),title:t("action.unstageAll"),disabled:l,onClick:d=>{d.stopPropagation(),g("staged")}},e(D,{path:x.minus,size:14}))),Y.staged?null:Te.map(d=>e(Pt,{key:`staged:${d.path}`,entry:d,side:"staged",selected:Z.has(ve("staged",d.path))||Z.size===0&&s?.side==="staged"&&s.path===d.path,focused:Z.size>1&&s?.side==="staged"&&s.path===d.path,busy:l,t,onActivate:S=>qe("staged",d,S),onToggle:()=>c(d,"staged")}))):null,L.length>0?e(Ne.default.Fragment,null,e("div",{className:"gitp-section-head",onClick:()=>Re("unstaged"),onKeyDown:d=>{d.target!==d.currentTarget||d.key!=="Enter"&&d.key!==" "||(d.preventDefault(),Re("unstaged"))},role:"button","aria-expanded":!Y.unstaged,tabIndex:0},e(D,{path:x.chevron,size:14,className:_("gitp-section-chev",Y.unstaged&&"is-collapsed")}),e("span",{className:"gitp-section-title"},t("section.unstaged")),e("span",{className:"gitp-section-count"},String(L.length)),e("button",{type:"button",className:"gitp-section-action","aria-label":t("action.stageAll"),title:t("action.stageAll"),disabled:l,onClick:d=>{d.stopPropagation(),g("unstaged")}},e(D,{path:x.plus,size:14}))),Y.unstaged?null:L.map(d=>e(Pt,{key:`unstaged:${d.path}`,entry:d,side:"unstaged",selected:Z.has(ve("unstaged",d.path))||Z.size===0&&s?.side==="unstaged"&&s.path===d.path,focused:Z.size>1&&s?.side==="unstaged"&&s.path===d.path,busy:l,t,onActivate:S=>qe("unstaged",d,S),onToggle:()=>c(d,"unstaged")}))):null,Be!==""&&Ee===0?e("div",{className:"gitp-center",style:{padding:"24px"}},t("filter.empty",{filter:De})):null,it===0?e(ke,{icon:e(D,{path:x.check,size:28}),title:t("empty.noChanges"),hint:t("empty.noChangesHint"),action:e("button",{type:"button",className:"gitp-btn is-small",onClick:U,disabled:u},t("action.refresh"))}):null),e("div",{className:"gitp-commitbox"},e("textarea",{ref:Ae,value:z,onChange:d=>G(d.target.value),onKeyDown:d=>{d.defaultPrevented||(d.ctrlKey||d.metaKey)&&d.key==="Enter"&&(d.preventDefault(),j&&!K&&k())},placeholder:t("commit.placeholder"),"aria-label":t("commit.placeholder")}),e("div",{className:_("gitp-commit-status-line",a.length>0&&"has-conflict")},a.length>0?e("span",null,t("commit.hintConflict")):i.length>0?e(Ne.default.Fragment,null,e("span",null,t("commit.stagedSummary",{count:i.length})," ",e("span",{className:"gitp-add"},`+${at.add}`)," ",e("span",{className:"gitp-del"},`\u2212${at.del}`)),e("span",null,t("commit.shortcut",{key:pi}))):e("span",null,t("commit.hintStage"))),e("div",{className:"gitp-commit-actions"},e("div",{className:"gitp-commit-opts"},be?e("label",{className:"gitp-amend"},e("input",{type:"checkbox",checked:fe,onChange:d=>ue(d.target.checked)}),t("commit.amend")):null,e("label",{className:"gitp-amend",title:t("commit.noVerifyHint")},e("input",{type:"checkbox",checked:Fe,onChange:d=>Ce(d.target.checked),disabled:K}),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":He===!0,title:t("ai.action"),disabled:K||ne||i.length===0,onClick:ae},ne?e(le):e(D,{path:x.sparkles,size:13}))),e("button",{type:"button",className:"gitp-btn is-small",onClick:F,disabled:K||a.length>0||i.length===0,"aria-label":t("action.branch")},e(D,{path:x.branch,size:13}),t("action.branch")),e("button",{type:"button",className:"gitp-btn is-primary is-small",onClick:k,disabled:!j||K},K?e(le):null,t(K?"action.committing":"action.commit"))),He?e(zi,{t,busy:ne,canUse:i.length>0,canBranch:i.length>0&&a.length===0,onWrite:me,onBranch:O,onClose:he}):null)):null,st&&Xe?e(Cn,{label:t("split.files"),containerRef:ze,columnRef:Le,width:Ve,onChange:Ze}):null,Xe?e("div",{className:"gitp-diffcol"},s?e(Nn,{t,diff:P,loading:T,layout:J,onLayout:H,onBlock:X,onResolve:f,busy:l,selectionKey:te,renamed:s.renamed===!0,compact:ye,onBack:Se,onOpen:N,onDiscard:de===null?void 0:()=>b(de),onStash:de===null||Z.size>1?void 0:()=>ft([de])}):e(ke,{icon:e(D,{path:x.file,size:28}),title:t("empty.selectFile"),hint:t("empty.selectFileHint")})):null,se===null?null:e(kn,{t,files:se,busy:l,error:M,onCreate:mt,onClose:()=>v(null)}))}function Nn({t,diff:n,loading:a,layout:i,onLayout:r,onBlock:s,onResolve:p,busy:u,selectionKey:l,renamed:c=!1,compact:g,onBack:b,onOpen:m,onDiscard:h,onStash:C}){let R=B(null),[P,T]=w({index:-1,canPrev:!1,canNext:!1}),J=Qt(n),H=Pe(()=>n===null?[]:[...n.blocks??[]].sort((G,k)=>G.row-k.row),[n]),U=()=>{let G=R.current;if(G===null)return[];let k=[...G.querySelectorAll(".gitp-pane")];if(k.length>0)return k;let F=G.querySelector(".gitp-unified");return F===null?[]:[F]},X=G=>{let k=-1;for(let F=0;F<H.length;F+=1){let j=H[F];j!==void 0&&j.row*Ke<=G+40&&(k=F)}return{index:k,canPrev:k>0,canNext:H.some(F=>F.row*Ke>G+40)}};A(()=>{let G=R.current;if(G===null)return;let k=0,F=()=>{let K=U()[0];T(X(K===void 0?0:K.scrollTop))},j=()=>{k===0&&(k=requestAnimationFrame(()=>{k=0,F()}))};return G.addEventListener("scroll",j,!0),F(),()=>{G.removeEventListener("scroll",j,!0),k!==0&&cancelAnimationFrame(k)}},[n,i]);let f=G=>{let k=U()[0],F=k===void 0?0:k.scrollTop,j=null;if(G>0)j=H.find(ae=>ae.row*Ke>F+40)??null;else{for(let ae of H)ae.row*Ke<=F+40&&(j=ae);j=j===null?null:H[H.indexOf(j)-1]??null}if(j===null)return;let K=Math.max(0,j.row*Ke-40),ne=U();for(let ae of ne)ae.scrollTop=K;let He=ne[0]===void 0?K:ne[0].scrollTop;T(X(He))};if(a&&n===null)return e("div",{className:"gitp-diff"},e("div",{className:"gitp-center"},e(le),e("div",{className:"gitp-center-hint"},t("diff.loading"))));if(n===null)return e("div",{className:"gitp-diff"},e(ke,{icon:e(D,{path:x.file,size:28}),title:t("empty.selectFile"),hint:t("empty.selectFileHint")}));let N=dt(n.path),z={left:n.labels.left==="HEAD"?t("diff.head"):n.labels.left==="Staged"?t("diff.staged"):n.labels.left==="Local"?t("diff.local"):n.labels.left==="Parent"?t("diff.parent"):n.labels.left,right:n.labels.right==="Staged"?t("diff.staged"):n.labels.right==="Local"?t("diff.local"):n.labels.right==="Commit"?t("diff.commit"):n.labels.right==="Incoming"?t("action.acceptTheirs"):n.labels.right};return e("div",{className:"gitp-diff",ref:R},e("div",{className:"gitp-diff-head"},g&&b?e(Me,{label:t("action.back"),icon:x.left,onClick:b}):null,e("div",{className:"gitp-diff-title"},e("span",{className:_("gitp-status",Ot(n.conflict?"C":"M"))},n.conflict?"C":"M"),e("div",{className:"gitp-diff-path"},N.dir?e("span",{className:"gitp-diff-dir"},N.dir):null,e("span",{className:"gitp-diff-base"},N.base)),n.conflict?e("span",{className:"gitp-diff-pill is-conflict"},t("section.conflicts")):n.side==="staged"?e("span",{className:"gitp-diff-pill is-staged"},t("diff.staged")):n.side==="unstaged"?e("span",{className:"gitp-diff-pill is-unstaged"},t("diff.unstaged")):n.side==="log"?e("span",{className:"gitp-diff-pill is-commit"},t("diff.commit")):null),n.conflict?e("span",{className:"gitp-diff-stats gitp-del"},t("section.conflicts")):n.binary?e("span",{className:"gitp-diff-stats"},t("diff.binary")):e("span",{className:"gitp-diff-stats"},e("span",{className:"gitp-add"},`+${n.add??0}`),e("span",{className:"gitp-del"},`\u2212${n.del??0}`)),H.length>0&&!n.conflict&&!n.binary?e("div",{className:"gitp-change-nav",role:"group","aria-label":t("diff.changes")},e(Me,{label:t("action.prevChange"),icon:x.chevronUp,onClick:()=>f(-1),disabled:!P.canPrev}),e("span",{className:"gitp-change-count"},`${Math.max(0,P.index)+1}/${H.length}`),e(Me,{label:t("action.nextChange"),icon:x.chevron,onClick:()=>f(1),disabled:!P.canNext})):null,e("div",{className:"gitp-diff-actions"},m!==void 0&&!n.binary?e(Me,{label:t("action.openEditor"),icon:x.code,onClick:()=>m(n)}):null,n.conflict?null:e("div",{className:"gitp-seg",role:"group","aria-label":t("diff.layout")},e("button",{type:"button",className:i==="split"?"is-active":"","aria-pressed":i==="split","aria-label":t("diff.split"),title:t("diff.split"),onClick:()=>r("split")},e(D,{path:x.split,size:13})),e("button",{type:"button",className:i==="unified"?"is-active":"","aria-pressed":i==="unified","aria-label":t("diff.unified"),title:t("diff.unified"),onClick:()=>r("unified")},e(D,{path:x.unified,size:13}))),C!==void 0?e(Me,{label:t("action.stash"),icon:x.stash,onClick:C,disabled:u}):null,h!==void 0?e(Me,{label:t("action.discard"),icon:x.trash,onClick:h,disabled:u}):null)),n.conflict?e("div",{className:"gitp-conflict-banner"},e(D,{path:x.warning,size:14}),e("span",null,t("diff.conflictBanner")),e("button",{type:"button",className:"gitp-btn is-small",onClick:()=>p?.("ours"),disabled:u},t("action.acceptOurs")),e("button",{type:"button",className:"gitp-btn is-small",onClick:()=>p?.("theirs"),disabled:u},t("action.acceptTheirs"))):null,n.binary?e("div",{className:"gitp-binary"},e("div",{className:"gitp-binary-title"},t("diff.binary")),e("div",null,t("diff.binaryHint",{before:n.leftSize??0,after:n.rightSize??0}))):n.conflict?e(Ei,{diff:n}):i==="unified"?e(Di,{t,diff:n,tokens:J,onBlock:s,busy:u,selectionKey:l,renamed:c}):e(Pi,{t,diff:n,labels:z,tokens:J,onBlock:s,busy:u,selectionKey:l,renamed:c}),!n.binary&&!n.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,H.length===1?t("diff.blockCountOne"):t("diff.blockCount",{count:H.length}))):null)}function Ei({diff:t}){return e("div",{className:"gitp-unified"},t.right.map((n,a)=>e("div",{className:_("gitp-urow",/^(<{7}|={7}|>{7})/.test(n)&&"is-conflict-marker"),key:a},e("span",{className:"gitp-uno"},a+1),e("span",{className:"gitp-ucontent"},n||"\xA0"))))}function Pi({t,diff:n,labels:a,tokens:i,onBlock:r,busy:s,selectionKey:p,renamed:u}){let l=B(null),c=B(null),g=B(null),b=B(null),m=B(null),h=B(null),[C,R]=vi(),P=f=>{m.current!==null&&(m.current.style.flexGrow=String(f)),h.current!==null&&(h.current.style.flexGrow=String(1-f)),l.current!==null&&(l.current.style.flexGrow=String(f)),c.current!==null&&(c.current.style.flexGrow=String(1-f))};A(()=>{P(C)},[C]);let T=f=>{g.current&&(g.current.style.transform=`translateY(${-f}px)`)},J=f=>{let N=f.scrollTop;l.current&&l.current!==f&&(l.current.scrollTop=N),c.current&&c.current!==f&&(c.current.scrollTop=N),T(N)};A(()=>{let f=n.blocks[0];if(!f||f.row<=10)return;let N=Math.max(0,f.row*Ke-80);l.current&&(l.current.scrollTop=N),c.current&&(c.current.scrollTop=N),T(N)},[p]);let H=Pe(()=>{let f=new Map;for(let N of n.rows){if(N.k!=="mod"||N.l===null||N.r===null)continue;let z=n.left[N.l-1]??"",G=n.right[N.r-1]??"";f.set(N,ki(z,G))}return f},[n]),U=Pe(()=>{let f=new Map;for(let N of n.blocks)f.set(N.row,N);return f},[n]),X=f=>{if(u)return[];let N={action:"unstaged",icon:x.left,label:t("action.stageBlock"),revert:!1},z={action:"revert",icon:x.right,label:t("action.revertBlock"),revert:!0};return n.side==="unstaged"?n.leftMissing?[N]:[N,z]:n.side==="staged"?[{action:"staged",icon:x.right,label:t("action.unstageBlock"),revert:!1}]:[]};return e("div",{className:"gitp-split",ref:b},e("div",{className:"gitp-pane-heads"},e("div",{className:"gitp-pane-head",ref:m},a.left),e("div",{className:"gitp-pane-head-gutter"}),e("div",{className:"gitp-pane-head",ref:h},a.right)),e("div",{className:"gitp-panes"},e("div",{className:"gitp-pane",ref:l,tabIndex:0,role:"region","aria-label":a.left,onScroll:f=>J(f.currentTarget)},n.rows.map((f,N)=>{let z=f.l?n.left[f.l-1]??"":"",G=f.k==="add"?"blank":f.k==="mod"?"del":f.k,k=H.get(f);return e("div",{className:_("gitp-line",G!=="ctx"&&`is-${G}`),key:`l${N}`},e("span",{className:"gitp-ln"},f.l??""),e("span",{className:"gitp-code"},f.l===null?"\xA0":At(Bt(i.left,f.l),z,k?{from:k.lPre.length,to:k.lPre.length+k.lMid.length}:null)))})),e("div",{className:"gitp-gutter","aria-hidden":!1},e("div",{className:"gitp-gutter-inner",ref:g},n.blocks.map(f=>{let N=X(f);return N.length===0?null:e("div",{className:"gitp-arrows",key:f.id,style:{top:f.row*Ke}},N.map(z=>e("button",{type:"button",className:_("gitp-arrow",z.revert&&"is-revert"),key:z.action,"aria-label":z.label,title:z.label,disabled:s,onClick:()=>r(f,z.action)},e(D,{path:z.icon,size:12}))))}))),e(Hi,{label:t("split.panes"),wrapRef:b,ratio:C,onChange:R,onDrag:P}),e("div",{className:"gitp-pane",ref:c,tabIndex:0,role:"region","aria-label":a.right,onScroll:f=>J(f.currentTarget)},n.rows.map((f,N)=>{let z=f.r?n.right[f.r-1]??"":"",G=f.k==="del"?"blank":f.k==="mod"?"add":f.k,k=H.get(f);return e("div",{className:_("gitp-line",G!=="ctx"&&`is-${G}`),key:`r${N}`},e("span",{className:"gitp-ln"},f.r??""),e("span",{className:"gitp-code"},f.r===null?"\xA0":At(Bt(i.right,f.r),z,k?{from:k.rPre.length,to:k.rPre.length+k.rMid.length}:null)))}))))}function Hi({label:t,wrapRef:n,ratio:a,onChange:i,onDrag:r}){let s=B(null),p=()=>{let l=n.current;return l===null?0:Math.round(l.getBoundingClientRect().width)},u=l=>bi(l,p());return A(()=>()=>{s.current=null,document.body.style.cursor="",document.body.style.userSelect=""},[]),e("div",{className:"gitp-resizer gitp-pane-resizer",role:"separator","aria-orientation":"vertical","aria-label":t,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(a*100),tabIndex:0,onPointerDown(l){l.button===0&&(s.current={x:l.clientX,ratio:a,next:a},l.currentTarget.setPointerCapture(l.pointerId),document.body.style.cursor="col-resize",document.body.style.userSelect="none",l.preventDefault())},onPointerMove(l){let c=s.current;if(c===null)return;let g=p()-yn;if(g<=0)return;let b=u(c.ratio+(l.clientX-c.x)/g);b!==c.next&&(c.next=b,r(b),l.currentTarget.setAttribute("aria-valuenow",String(Math.round(b*100))))},onPointerUp(l){let c=s.current;c!==null&&(s.current=null,l.currentTarget.hasPointerCapture(l.pointerId)&&l.currentTarget.releasePointerCapture(l.pointerId),document.body.style.cursor="",document.body.style.userSelect="",i(c.next))},onPointerCancel(){s.current=null,document.body.style.cursor="",document.body.style.userSelect=""},onDoubleClick(){i(u(Lt))},onKeyDown(l){if(l.key==="ArrowLeft"||l.key==="ArrowRight"){l.preventDefault(),i(u(a+(l.key==="ArrowRight"?on:-on)));return}l.key==="Home"&&(l.preventDefault(),i(u(Lt)))}})}function Di({t,diff:n,tokens:a,onBlock:i,busy:r,selectionKey:s,renamed:p}){let u=Pe(()=>{let g=new Map;for(let m of n.blocks)g.set(m.row,m);let b=[];return n.rows.forEach((m,h)=>{let C=g.get(h),R=m.l===null?"":n.left[m.l-1]??"",P=m.r===null?"":n.right[m.r-1]??"";m.k==="ctx"?b.push({l:m.l,r:m.r,text:R,kind:"ctx",block:C}):m.k==="mod"?(b.push({l:m.l,r:null,text:R,kind:"del",block:C}),b.push({l:null,r:m.r,text:P,kind:"add"})):m.k==="del"?b.push({l:m.l,r:null,text:R,kind:"del",block:C}):b.push({l:null,r:m.r,text:P,kind:"add",block:C})}),b},[n]),l=B(null);A(()=>{let g=u.find(b=>b.block!==void 0);!g||u.indexOf(g)<=10||l.current===null||(l.current.scrollTop=Math.max(0,u.indexOf(g)*Ke-80))},[s]);let c=g=>{if(p)return[];let b={action:"unstaged",icon:x.left,label:t("action.stageBlock"),revert:!1},m={action:"revert",icon:x.right,label:t("action.revertBlock"),revert:!0};return n.side==="unstaged"?n.leftMissing?[b]:[b,m]:n.side==="staged"?[{action:"staged",icon:x.right,label:t("action.unstageBlock"),revert:!1}]:[]};return e("div",{className:"gitp-unified",ref:l,tabIndex:0,role:"region","aria-label":t("diff.unified")},u.map((g,b)=>{let m=g.block?c(g.block):[];return e("div",{className:_("gitp-urow",g.kind!=="ctx"&&`is-${g.kind}`),key:b},e("span",{className:"gitp-uarrows"},m.map(h=>e("button",{type:"button",className:_("gitp-arrow",h.revert&&"is-revert"),key:h.action,"aria-label":h.label,title:h.label,disabled:r,onClick:()=>{g.block!==void 0&&i(g.block,h.action)}},e(D,{path:h.icon,size:12})))),e("span",{className:"gitp-uno"},g.l??""),e("span",{className:"gitp-uno"},g.r??""),e("span",{className:"gitp-ucontent"},At(Bt(g.l!==null?a.left:a.right,g.l??g.r),g.text,null)))}))}function zi({t,busy:n,canUse:a,canBranch:i,onWrite:r,onBranch:s,onClose:p}){let u=B(p);u.current=p;let l=B(null);A(()=>{let g=m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),u.current())},b=m=>{let h=m.target;l.current!==null&&h instanceof Node&&l.current.contains(h)||h instanceof Element&&h.closest(".gitp-ai-wrap")!==null||u.current()};return document.addEventListener("keydown",g,!0),document.addEventListener("mousedown",b,!0),()=>{document.removeEventListener("keydown",g,!0),document.removeEventListener("mousedown",b,!0)}},[]);let c=(g,b,m,h,C)=>e("button",{type:"button",key:g,className:"gitp-popover-row",role:"menuitem",disabled:h,onClick:C},e(D,{path:b,size:13}),e("span",{className:"gitp-popover-row-text"},m));return e("div",{className:"gitp-popover is-menu",ref:l,role:"menu","aria-label":t("ai.action")},c("write",x.sparkles,t("ai.write"),!a||n,r),c("branch",x.branch,t("ai.branch"),!i||n,s))}function Li({t,workspaceTitle:n,branch:a,repo:i,ahead:r,behind:s,upstream:p,onBranchMenu:u,onRepoMenu:l,repos:c,repoRoot:g,onSync:b,busy:m,onRefresh:h,syncing:C}){let R=a?.name??(a?.oid?Ue(a.oid):t(i===!1?"empty.noRepo":"status.detached")),P=c.find(X=>X.root===g)??null,T=c[0],J=c.length>1||T!==void 0&&c.length===1&&T.name!=="."&&!T.name.startsWith(".."),H=P===null?t("repo.none"):P.name==="."?t("repo.workspace"):P.label??P.name,U=P?.worktree===!0;return e("div",{className:"gitp-head"},e("div",{className:"gitp-head-left"},e("span",{className:"gitp-repo"},n),J?e("button",{type:"button",className:"gitp-branch gitp-repo-pick",onClick:l,"aria-haspopup":"listbox","aria-label":t("repo.pick"),title:t("repo.pick")},e(D,{path:x.folder,size:13}),e("span",{className:"gitp-branch-name"},H),e("span",{className:"gitp-chevron"},e(D,{path:x.chevron,size:11}))):null,e("button",{type:"button",className:"gitp-branch",onClick:u,disabled:i===!1,"aria-haspopup":"listbox","aria-label":t("branch.title"),title:t("branch.title")},e(D,{path:x.branch,size:13}),e("span",{className:"gitp-branch-name"},R),e("span",{className:"gitp-chevron"},e(D,{path:x.chevron,size:11}))),U?e("span",{className:"gitp-worktree",title:g??void 0},t("repo.worktree")):null),e("div",{className:"gitp-head-right"},e(Et,{label:t("action.fetch"),icon:x.fetch,count:0,onClick:()=>b("fetch"),busy:C==="fetch",disabled:m}),e(Et,{label:t("action.pull"),icon:x.pull,count:s,onClick:()=>b("pull"),busy:C==="pull",disabled:m||p===null}),e(Et,{label:t("action.push"),icon:x.push,count:r,onClick:()=>b("push"),busy:C==="push",disabled:m}),e(Me,{label:t("action.refresh"),icon:x.refresh,onClick:h,disabled:m})))}function Ai({t,mode:n,onMode:a,counts:i}){let r=[{id:"changes",label:t("mode.changes"),count:i.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")},r.map(s=>e("button",{type:"button",key:s.id,className:_("gitp-rail-item",n===s.id&&"is-active"),onClick:()=>a(s.id),"aria-label":s.count>0?`${s.label}, ${s.count}`:s.label,"aria-current":n===s.id?"page":void 0},e("span",{className:"gitp-rail-label"},s.label),s.count>0?e("span",{className:"gitp-rail-count"},String(s.count)):null)))}function Bi({t,repos:n,current:a,onPick:i,onInitRoot:r,onClose:s}){let p=B(null),u=B(s);u.current=s,A(()=>{p.current?.querySelector("button:not(:disabled)")?.focus();let c=g=>{g.key==="Escape"&&(g.preventDefault(),g.stopPropagation(),u.current())};return document.addEventListener("keydown",c,!0),()=>document.removeEventListener("keydown",c,!0)},[]);let l=!n.some(c=>!c.worktree&&(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:p,role:"listbox","aria-label":t("repo.title")},e("div",{className:"gitp-popover-title"},t("repo.title")),e("div",{className:"gitp-popover-list"},n.map(c=>e("button",{type:"button",key:c.root,className:_("gitp-popover-row",c.worktree&&"is-nested"),role:"option","aria-selected":c.root===a,disabled:c.root===a,title:c.root,onClick:()=>i(c.root)},e(D,{path:c.worktree?x.branch:x.folder,size:13}),e("span",{className:"gitp-popover-row-text"},c.name==="."?t("repo.workspace"):c.label??c.name),c.worktree&&c.branch!==null?e("span",{className:"gitp-popover-hint"},c.branch):null,c.root===a?e(D,{path:x.check,size:13,className:"gitp-checkmark"}):null))),l?e(Ne.default.Fragment,null,e("div",{className:"gitp-popover-sep"}),e("button",{type:"button",className:"gitp-popover-row",onClick:r},e(D,{path:x.plus,size:13}),e("span",{className:"gitp-popover-row-text"},t("repo.initRoot")))):null))}function Ii({t,branches:n,loading:a,busy:i,onCheckout:r,onNew:s,onClose:p}){let u=B(null),l=B(p);l.current=p;let[c,g]=w("");A(()=>{u.current?.querySelector("input")?.focus();let H=U=>{U.key==="Escape"&&(U.preventDefault(),U.stopPropagation(),l.current())};return document.addEventListener("keydown",H,!0),()=>document.removeEventListener("keydown",H,!0)},[]);let b=c.trim().toLowerCase(),m=n.filter(H=>!H.remote),h=new Set(m.map(H=>H.name)),C=n.filter(H=>{if(!H.remote)return!1;let U=H.name.split("/").slice(1).join("/");return U!==""&&!h.has(U)}),R=H=>b===""||H.name.toLowerCase().includes(b),P=m.filter(R),T=C.filter(R),J=(H,U)=>H.map(X=>{let f=X.worktree!==null;return e("button",{type:"button",key:`${U?"r":"l"}:${X.name}`,className:"gitp-popover-row",role:"option","aria-selected":X.current===!0,disabled:i||X.current===!0||f,title:f?`${t("branch.inWorktree")}: ${X.worktree??""}`:void 0,onClick:()=>r(X.name,U)},e(D,{path:x.branch,size:13}),e("span",{className:"gitp-popover-row-text"},X.name),f?e("span",{className:"gitp-popover-hint"},X.worktree??""):null,X.current?e(D,{path:x.check,size:13,className:"gitp-checkmark"}):null)});return e("div",{className:"gitp-popover-layer",onMouseDown:H=>{H.target===H.currentTarget&&l.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:H=>g(H.target.value),"aria-label":t("branch.search")}),e("button",{type:"button",className:"gitp-popover-row",disabled:i,onClick:s},e(D,{path:x.plus,size:13}),e("span",{className:"gitp-popover-row-text"},t("branch.new"))),e("div",{className:"gitp-popover-sep"}),a?e("div",{className:"gitp-modal-sub"},t("branch.loading")):null,!a&&P.length===0&&T.length===0?e("div",{className:"gitp-modal-sub"},t(b===""?"branch.none":"branch.noneMatch")):null,P.length>0?e(Ne.default.Fragment,null,e("div",{className:"gitp-popover-title"},t("branch.local")),e("div",{className:"gitp-popover-list"},J(P,!1))):null,T.length>0?e(Ne.default.Fragment,null,e("div",{className:"gitp-popover-title"},t("branch.remote")),e("div",{className:"gitp-popover-list"},J(T,!0))):null))}function Fi({t,busy:n,error:a,onCreate:i,onClose:r}){let[s,p]=w("");return e(pt,{title:t("branch.newTitle"),onClose:r,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:s,onChange:u=>p(u.target.value),spellCheck:!1,autoComplete:"off"}),e("div",{className:"gitp-field-hint"},t("branch.newHint"))),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||s.trim()==="",onClick:()=>i({name:s.trim()})},n?e(le):null,t("action.createAndSwitch"))))}function Oi(t,n,a,i){let r=n?.branch??null,s=n?.merging===!0||n?.rebasing===!0||n?.reverting===!0||n?.cherryPicking===!0,p=(n?.conflicts?.length??0)>0,u=(n?.entries??[]).some(C=>C.staged),l=r===null||r.detached===!0,c=r?.oid!==null&&r?.oid!==void 0&&r.oid===t.hash,g=typeof r?.upstream=="string"&&r.upstream!==""&&r.ahead===0,b=(t.parents?.length??0)>1,m=[];m.push({id:"copy",label:i("history.copy"),icon:x.copy,hint:null,reason:null});let h=null;return s?h=i("history.blockedOperation"):l?h=i("history.blockedDetached"):c?(t.parents?.length??0)===0?h=i("history.blockedNoParent"):g&&(h=i("history.blockedPushed")):h=i("history.blockedNotHead"),m.push({id:"undo",label:i("history.undo"),icon:x.undo,hint:i("history.undoHint"),reason:h}),h=null,s?h=i("history.blockedOperation"):b?h=i("history.blockedMerge"):p?h=i("history.blockedConflict"):u&&(h=i("history.blockedStaged")),m.push({id:"revert",label:i("history.revert"),icon:x.revert,hint:i("history.revertHint"),reason:h}),h=null,s?h=i("history.blockedOperation"):b?h=i("history.blockedMerge"):p?h=i("history.blockedConflict"):a.has(t.hash)&&(h=i("history.blockedContained")),m.push({id:"cherry",label:i("history.cherryPick"),icon:x.cherry,hint:i("history.cherryPickHint"),reason:h}),h=null,s?h=i("history.blockedOperation"):l&&(h=i("history.blockedDetached")),m.push({id:"reset",label:i("history.reset"),icon:x.reset,hint:i("history.resetHint"),reason:h}),m}function ji({t,commit:n,rows:a,busy:i,onPick:r,onClose:s}){let p=B(null),u=B(s),l=B(null);return u.current=s,A(()=>{l.current=document.activeElement instanceof HTMLElement?document.activeElement:null,p.current?.querySelector("button:not(:disabled)")?.focus();let c=g=>{g.key==="Escape"&&(g.preventDefault(),g.stopPropagation(),u.current())};return document.addEventListener("keydown",c,!0),()=>{document.removeEventListener("keydown",c,!0),l.current&&typeof l.current.focus=="function"&&l.current.focus()}},[]),e("div",{className:"gitp-popover-layer",onMouseDown:c=>{c.target===c.currentTarget&&u.current()}},e("div",{className:"gitp-popover is-wide",ref:p,role:"menu","aria-label":t("history.actions")},e("div",{className:"gitp-popover-title"},t("history.actions")),e("div",{className:"gitp-popover-blurb",title:n.subject},`${Ue(n.hash)} \xB7 ${n.subject}`),e("div",{className:"gitp-popover-sep"}),a.map(c=>e("button",{type:"button",key:c.id,className:"gitp-action-row",role:"menuitem",disabled:i||c.reason!==null,title:c.reason??c.hint??void 0,onClick:()=>r(c.id)},e(D,{path:c.icon??x.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 $i({t,commit:n,busy:a,error:i,onReset:r,onClose:s}){let[p,u]=w("soft"),l=[["soft","history.resetModeSoft","history.resetModeSoftHint"],["mixed","history.resetModeMixed","history.resetModeMixedHint"],["hard","history.resetModeHard","history.resetModeHardHint"]];return e(pt,{title:t("history.resetTitle"),onClose:s,danger:p==="hard"},e("div",{className:"gitp-modal-sub"},t("history.resetBody",{hash:Ue(n.hash)})),e("div",{role:"radiogroup","aria-label":t("history.resetTitle")},l.map(([c,g,b])=>e("label",{key:c,className:"gitp-reset-mode"},e("input",{type:"radio",name:"gitp-reset-mode",value:c,checked:p===c,disabled:a,onChange:()=>u(c)}),e("span",{className:"gitp-reset-mode-text"},e("span",{className:"gitp-reset-mode-title"},t(g)),e("span",{className:"gitp-reset-mode-hint"},t(b)))))),p==="hard"?e("div",{className:"gitp-modal-warn",role:"alert"},t("history.resetHardWarning")):null,i!==null?e("div",{className:"gitp-modal-error"},i):null,e("div",{className:"gitp-modal-actions"},e("button",{type:"button",className:"gitp-btn",onClick:s,disabled:a},t("action.cancel")),e("button",{type:"button",className:_("gitp-btn",p==="hard"?"is-danger":"is-primary"),onClick:()=>r(p),disabled:a},a?e(le):null,t("history.resetAction"))))}function Gi({call:t,workspaceId:n,repo:a,t:i,refreshToken:r,compact:s,layout:p,onLayout:u,snapshot:l,onApplied:c}){let[g,b]=w(null),[m,h]=w(null),[C,R]=w(null),[P,T]=w(null),[J,H]=w(null),[U,X]=w(!1),[f,N]=w(!1),[z,G]=w(!1),[k,F]=w(null),[j,K]=w(!1),[ne,He]=xn(),[ae,he]=w(null),[me,O]=w(null),[te,fe]=w(null),[ue,Fe]=w(null),[Ce,be]=w(null),[ye,Se]=w(null),De=B(null),Je=B(null),Ve=B(a),Ze=v=>{navigator?.clipboard?.writeText&&(navigator.clipboard.writeText(v).catch(()=>{}),K(!0),setTimeout(()=>K(!1),2e3))};A(()=>{if(ye===null)return;let v=setTimeout(()=>Se(null),4e3);return()=>clearTimeout(v)},[ye]),A(()=>{he(null),O(null),fe(null),Fe(null)},[a]),A(()=>{Ve.current!==a&&(Ve.current=a,h(null),R(null),T(null),H(null))},[a]),A(()=>{let v=!0,M=new AbortController;return X(!0),t("log",{workspaceId:n,repo:a},M.signal).then(W=>{if(!v)return;let $=Ci(W.commits??[]);b($);let V=$[0];V!==void 0&&h(Y=>Y??V.hash)}).catch(W=>{let $=ee(W);v&&$.name!=="AbortError"&&F($)}).finally(()=>{v&&X(!1)}),()=>{v=!1,M.abort()}},[n,a,r]),A(()=>{if(!m){R(null);return}let v=!0,M=new AbortController;return N(!0),t("commitDetail",{workspaceId:n,repo:a,hash:m},M.signal).then(W=>{if(v){R(W);let $=W.files[0];!s&&$!==void 0?T(V=>V!==null&&W.files.some(Y=>Y.path===V)?V:$.path):s&&T(null),H(null)}}).catch(W=>{let $=ee(W);v&&$.name!=="AbortError"&&F($)}).finally(()=>{v&&N(!1)}),()=>{v=!1,M.abort()}},[n,a,m,s]),A(()=>{if(!P||!C){H(null);return}let v=!0,M=new AbortController;return G(!0),t("diff",{workspaceId:n,repo:a,path:P,side:"log",commit:C.hash,parent:C.parents?.[0]},M.signal).then(W=>{v&&H(W)}).catch(W=>{let $=ee(W);v&&$.name!=="AbortError"&&F($)}).finally(()=>{v&&G(!1)}),()=>{v=!1,M.abort()}},[n,a,P,C]);let ze=Pe(()=>{let v=new Map;for(let V of g??[])v.set(V.hash,V.parents);let M=new Set,W=[],$=l?.branch?.oid;for(typeof $=="string"&&$!==""&&W.push($);W.length>0;){let V=W.pop();if(V===void 0)break;if(!M.has(V)){M.add(V);for(let Y of v.get(V)??[])W.push(Y)}}return M},[g,l?.branch?.oid]),Le=ae===null?[]:Oi(ae,l,ze,i);async function Ae(v){be("undo");try{let M=await t("undoCommit",{workspaceId:n,repo:a,hash:v.hash});O(null),c({status:M.status,message:M.message,goToChanges:!0,toast:i("history.undone")})}catch(M){O(null),Se({text:we(M),error:!0}),c({})}finally{be(null)}}async function ve(v){be("revert");try{let M=await t("revertCommit",{workspaceId:n,repo:a,hash:v.hash});O(null),c({status:M.status,message:M.message,goToChanges:!0,toast:i(M.conflicted?"history.revertConflicts":"history.reverted")})}catch(M){O(null),Se({text:we(M),error:!0}),c({})}finally{be(null)}}async function Z(v){be("cherry");try{let M=await t("cherryPickCommit",{workspaceId:n,repo:a,hash:v.hash});Se({text:i("history.picked",{hash:Ue(M.hash)}),error:!1}),c({status:M.status})}catch(M){Se({text:we(M),error:!0}),c({})}finally{be(null)}}async function ge(v,M){be("reset"),Fe(null);try{let W=await t("resetToCommit",{workspaceId:n,repo:a,hash:v.hash,mode:M,confirm:!0});fe(null),Se({text:i("history.resetDone",{hash:Ue(v.hash)}),error:!1}),c({status:W.status})}catch(W){Fe(we(W))}finally{be(null)}}function ce(v){let M=ae;if(M!==null){if(v==="copy"){Ze(M.hash),he(null),Se({text:i("action.copied"),error:!1});return}he(null),v==="undo"?O({type:"undo",commit:M}):v==="revert"?O({type:"revert",commit:M}):v==="cherry"?Z(M):v==="reset"&&fe(M)}}if(U&&g===null)return e(ke,{icon:e(le),title:i("log.loading")});if(g===null&&k!==null)return e(ke,{icon:e(D,{path:x.warning,size:28}),title:i("error.title"),hint:we(k)});if(g!==null&&g.length===0)return e(ke,{icon:e(D,{path:x.history,size:28}),title:i("empty.noHistory"),hint:i("empty.noHistoryHint")});let re=!s||!P,se=!s||!!P;return e("div",{className:"gitp-changes",ref:De},re?e("div",{className:"gitp-listcol",ref:Je,style:s?void 0:{width:`${ne}px`}},e("div",{className:"gitp-loglist"},k?e("div",{className:"gitp-error"},e("span",{className:"gitp-error-text"},we(k))):null,(g??[]).map(v=>e("button",{type:"button",key:v.hash,className:_("gitp-commitrow",m===v.hash&&"is-selected"),onClick:()=>h(v.hash),onContextMenu:M=>{M.preventDefault(),h(v.hash),he(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:_("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,un(v.date))),v.refs.length>0?e("div",{className:"gitp-refs"},v.refs.map(M=>e("span",{key:M,className:_("gitp-ref",M.startsWith("HEAD")&&"is-head")},M.replace(/^HEAD -> /,"")))):null)))),e("div",{className:"gitp-logdetail-summary"},f&&C===null?e("div",{className:"gitp-center",style:{padding:"24px"}},e(le)):C===null?e(ke,{title:i("log.select")}):e(Ne.default.Fragment,null,e("div",{className:"gitp-detail-head"},e("div",{className:"gitp-detail-title"},e("div",{className:"gitp-detail-subject"},C.subject),e(Me,{label:i("history.actions"),icon:x.more,disabled:Ce!==null,onClick:()=>he({hash:C.hash,parents:C.parents??[],subject:C.subject})})),e("div",{className:"gitp-detail-meta"},e("button",{type:"button",className:"gitp-detail-hash-btn",onClick:()=>Ze(C.hash),title:i(j?"action.copied":"action.copyHash")},Ue(C.hash),e(D,{path:j?x.check:x.copy,size:11})),e("span",null,C.author),e("span",null,un(C.date)))),C.body?e("div",{className:"gitp-detail-body"},C.body):null,e("div",{className:"gitp-detail-section-head"},e("span",null,i("log.files")),e("span",{className:"gitp-section-count"},String(C.files?.length??0))),e("div",{className:"gitp-detail-files"},!C.files||C.files.length===0?e("div",{className:"gitp-center-hint",style:{padding:"4px 8px"}},i("log.noFiles")):C.files.map(v=>{let M=dt(v.path);return e("button",{type:"button",key:v.path,className:_("gitp-detail-file",P===v.path&&"is-selected"),onClick:()=>T(v.path)},e("span",{className:_("gitp-status",Ot("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"},i("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,re&&se?e(Cn,{label:i("split.commits"),containerRef:De,columnRef:Je,width:ne,onChange:He}):null,se?e("div",{className:"gitp-diffcol"},P?e(Nn,{t:i,diff:J,loading:z,layout:p,onLayout:u,onBlock:()=>{},busy:!0,selectionKey:`${C?.hash??""}:${P}`,compact:s,onBack:s?()=>T(null):void 0}):e(ke,{icon:e(D,{path:x.changes,size:28}),title:i("empty.selectFile"),hint:i("empty.selectFileHint")})):null,ae?e(ji,{t:i,commit:ae,rows:Le,busy:Ce!==null,onPick:ce,onClose:()=>he(null)}):null,me?e(jt,{title:i(me.type==="undo"?"history.undoTitle":"history.revertTitle"),body:i(me.type==="undo"?"history.undoBody":"history.revertBody"),confirmLabel:i(me.type==="undo"?"history.undoAction":"history.revertAction"),cancelLabel:i("action.cancel"),busy:Ce!==null,onConfirm:()=>me.type==="undo"?Ae(me.commit):ve(me.commit),onClose:()=>{Ce===null&&O(null)}}):null,te?e($i,{t:i,commit:te,busy:Ce==="reset",error:ue,onReset:v=>ge(te,v),onClose:()=>{Ce===null&&(fe(null),Fe(null))}}):null,ye?e("div",{className:_("gitp-toast",ye.error&&"is-error"),role:"status","aria-live":"polite"},ye.text):null)}function Wi({call:t,workspaceId:n,repo:a,t:i,snapshot:r,onStatus:s,refreshToken:p}){let[u,l]=w(null),[c,g]=w(null),[b,m]=w(!1),[h,C]=w(null),[R,P]=w(null),[T,J]=w(null),[H,U]=w(null),X=B(a);A(()=>{X.current!==a&&(X.current=a,l(null))},[a]);let f=kt(async k=>{try{let F=await t("stashList",{workspaceId:n,repo:a},k);l(F.stashes??[]),g(null)}catch(F){let j=ee(F);j.name!=="AbortError"&&g(j)}},[n,a,t]);A(()=>{let k=new AbortController;return f(k.signal),()=>k.abort()},[f,p]),A(()=>{if(H===null)return;let k=setTimeout(()=>U(null),4e3);return()=>clearTimeout(k)},[H]);let N=(r?.entries??[]).filter(k=>(k.staged||k.unstaged)&&!k.conflicted);async function z({paths:k,message:F}){C("create"),P(null);try{let j=await t("stashPush",{workspaceId:n,repo:a,paths:k,message:F,includeUntracked:k.some(K=>N.find(ne=>ne.path===K)?.untracked===!0)});s(j.status),l(j.stashes??[]),m(!1),U(i("stash.created",{count:k.length}))}catch(j){P(we(j))}finally{C(null)}}async function G(k,F,j){C(k+F),g(null);try{let K=await t(k==="drop"?"stashDrop":"stashApply",{workspaceId:n,repo:a,ref:F,pop:j});s(K.status),l(K.stashes??[]),U(k==="drop"?i("stash.dropped",{ref:F}):i(j?"stash.popped":"stash.applied",{ref:F})),J(null)}catch(K){g(ee(K))}finally{C(null)}}return e("div",{className:"gitp-stash"},e("div",{className:"gitp-stash-head"},e("div",{className:"gitp-stash-title"},e("span",null,i("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:()=>m(!0),disabled:N.length===0},e(D,{path:x.plus,size:12}),i("action.stash"))),c?e("div",{className:"gitp-error"},e("span",{className:"gitp-error-text"},we(c))):null,u===null?e("div",{className:"gitp-center"},e(le)):u.length===0?e(ke,{icon:e(D,{path:x.stash,size:28}),title:i("empty.noStashes"),hint:i("empty.noStashesHint"),action:N.length>0?e("button",{type:"button",className:"gitp-btn is-primary is-small",onClick:()=>m(!0)},e(D,{path:x.plus,size:12}),i("action.stash")):null}):e("div",{className:"gitp-stashlist"},u.map(k=>e("div",{className:"gitp-stashrow",key:k.ref},e("div",{className:"gitp-stash-main"},e("div",{className:"gitp-stash-msg"},k.message||"WIP"),e("div",{className:"gitp-stash-meta"},e("span",{className:"gitp-stash-ref"},k.ref),e("span",null,"\xB7"),e("span",null,Ue(k.hash)))),e("div",{className:"gitp-stash-actions"},e("button",{type:"button",className:"gitp-btn is-small",onClick:()=>G("apply",k.ref,!1),disabled:h!==null,title:i("stash.applyHint")},h==="apply"+k.ref?e(le):null,i("action.apply")),e("button",{type:"button",className:"gitp-btn is-small",onClick:()=>G("apply",k.ref,!0),disabled:h!==null,title:i("stash.popHint")},h==="apply"+k.ref?e(le):null,i("action.pop")),e("button",{type:"button",className:"gitp-btn is-small gitp-stash-btn-danger","aria-label":i("action.drop"),onClick:()=>J(k.ref),disabled:h!==null,title:i("stash.dropHint")},i("action.drop")))))),b?e(kn,{t:i,files:N,busy:h==="create",error:R,onCreate:z,onClose:()=>{m(!1),P(null)}}):null,T?e(jt,{title:i("stash.dropTitle"),body:i("stash.dropBody",{ref:T}),confirmLabel:i("action.drop"),cancelLabel:i("action.cancel"),danger:!0,busy:h==="drop"+T,onConfirm:()=>G("drop",T,!1),onClose:()=>J(null)}):null,H?e("div",{className:"gitp-toast",role:"status","aria-live":"polite"},H):null)}function Ki(t){let n=t?.projectionValues?.workingDirectory;if(typeof n=="string"&&n.trim()!=="")return n.trim();let a=t?.cwd;return typeof a=="string"&&a!==""?a:null}function Ui(t,n,a){let i=typeof t.sessionRoot=="string"?t.sessionRoot:null;if(t.worktree===!0&&i!==null){let p=n.find(u=>u.root===i);if(p!==void 0)return p}let r=n.find(p=>p.root===a);return r!==void 0?r:(i===null?void 0:n.find(p=>p.root===i))??n[0]??null}function Vi(t){let n=typeof t.sessionRoot=="string"?t.sessionRoot:"";return`${t.worktree===!0?"worktree":"checkout"}:${n}`}function _i({call:t,t:n,useWorkspaces:a,useSessions:i,sessionId:r,useTabInfo:s,sidebarRight:p}){let{tab:u}=s(),l=fn(r).set;A(()=>{l(u.visible===!0)},[l,u.visible]),A(()=>()=>{l(!1)},[l]),A(()=>{It={visible:u.visible===!0,canStageAll:()=>it.length>0&&N===null,stageAll:()=>bt("unstaged"),canCommit:()=>d&&N===null,commit:()=>Gt(),canWriteMessage:()=>Ee.length>0&&N===null&&!ve,writeMessage:()=>Kt()}}),A(()=>()=>{It=null},[]);let c=a(o=>o.items),g=i(o=>o.byId[r]),b=Ki(g),m=c.find(o=>o.sessionIds?.includes(r))??c.find(o=>g?.cwd!==void 0&&(g.cwd===o.path||g.cwd.startsWith(`${o.path}/`)))??null,h=m===null?"":m.workspaceId,C=B(null),[R,P]=w(!1),[T,J]=w(null),[H,U]=w(!1),[X,f]=w(null),[N,z]=w(null),[G,k]=w(null),[F,j]=w("changes"),[K,ne]=w(""),[He,ae]=w(!1),[he,me]=w(!1),[O,te]=w(null),[fe,ue]=w(null),[Fe,Ce]=w(!1),[be,ye]=w(0),[Se,De]=w(()=>ct(tn,"split")==="unified"?"unified":"split"),[Je,Ve]=w(()=>ct(nn,"split")==="unified"?"unified":"split"),[Ze,ze]=w(!1),[Le,Ae]=w(!1),[ve,Z]=w(!1),[ge,ce]=w(null),[re,se]=w(null),[v,M]=w(!1),[W,$]=w(null),[V,Y]=w(null),[ut,Re]=w(null),[Be,_e]=w(0),[Oe,Te]=w([]),[L,Ie]=w(null),Qe=o=>{if(L===null||p===void 0)return;let y=li(o),E=oi(r,g===void 0?void 0:g.cwd,`${L}/${o.path}`);p.openResource(E,{params:{line:y}})},[gt,ht]=w(0),[et,tt]=w(!1),[Ct,qe]=w(!1),je=B(0),nt=B(null);A(()=>{let o=C.current;if(o===null||typeof ResizeObserver>"u")return;let y=0,E=new ResizeObserver(ie=>{y&&cancelAnimationFrame(y),y=requestAnimationFrame(()=>{y=0;let xe=ie[0]?.contentRect.width??0;P(xe>0&&xe<900)})});return E.observe(o),()=>{E.disconnect(),y&&cancelAnimationFrame(y)}},[m?.workspaceId]);let Q=kt(o=>{!o||!Array.isArray(o.entries)||(je.current+=1,J(o))},[]),de=kt(async(o,y)=>{if(!m||L===null)return;let E=++je.current;y||U(!0);try{let ie=await t("status",{workspaceId:h,repo:L,sessionDir:b},o);E===je.current&&(nt.current=null,J(ie),Array.isArray(ie.repos)&&ie.repos.length>0&&Te(ie.repos),f(null))}catch(ie){let xe=ee(ie);if(xe.name==="AbortError"||E!==je.current)return;let rt=en(ie);if(rt==="git/not-repo"||rt==="git/repo-invalid"){if(nt.current===L){f(xe);return}nt.current=L,We(ot+h,""),Ie(null),J(null),f(null),ht(Mt=>Mt+1);return}f(xe)}finally{E===je.current&&U(!1)}},[m?.workspaceId,L,t,b]),ft=kt(o=>{o?.status&&Q(o.status),typeof o.message=="string"&&(ne(o.message),ae(!1)),o?.goToChanges&&(te(null),ue(null),j("changes")),o?.toast&&Y(o.toast),_e(y=>y+1),de(void 0,!1)},[Q,de]),mt=B(null),at=B(null),st=B(null);st.current=L,A(()=>{if(!m?.workspaceId)return;let o=h,y=mt.current!==o;y&&(mt.current=o,Te([]),Ie(null),J(null));let E=new AbortController;return(async()=>{try{let ie=await t("status",{workspaceId:o,sessionDir:b},E.signal);if(E.signal.aborted)return;let xe=Array.isArray(ie.repos)?ie.repos:[];Te(xe);let rt=Vi(ie),Mt=at.current!==rt;if(at.current=rt,!y&&!Mt&&st.current!==null)return;let vt=Ui(ie,xe,ct(ot+o,""));vt?(Ie(vt.root),(ie.worktree!==!0||vt.root!==ie.sessionRoot)&&We(ot+o,vt.root)):J(ie)}catch(ie){let xe=ee(ie);xe.name!=="AbortError"&&f(xe)}})(),()=>E.abort()},[m?.workspaceId,t,gt,b]),A(()=>{if(L===null)return;let o=new AbortController;return de(o.signal,!1),()=>o.abort()},[L,de]),A(()=>{if(!m||L===null)return;let o=setInterval(()=>{document.visibilityState==="visible"&&de(void 0,!0)},8e3);return()=>clearInterval(o)},[m?.workspaceId,L,de]),A(()=>{let o=()=>de(void 0,!0);return window.addEventListener("focus",o),()=>window.removeEventListener("focus",o)},[de]),A(()=>{if(V===null)return;let o=setTimeout(()=>Y(null),4e3);return()=>clearTimeout(o)},[V]);let Xe=T?.entries?.filter(o=>o.conflicted)??[],Ee=T?.entries?.filter(o=>o.staged&&!o.conflicted)??[],it=T?.entries?.filter(o=>o.unstaged&&!o.conflicted)??[],d=Ee.length>0&&Xe.length===0&&K.trim()!==""&&T?.repo!==!1,S=O?`${O.side}:${O.path}:${O.commit??""}`:"",I=O===null?!0:O.side==="staged"?T?.entries?.some(o=>o.path===O.path&&o.staged&&!o.conflicted):O.side==="unstaged"?T?.entries?.some(o=>o.path===O.path&&o.unstaged&&!o.conflicted):O.side==="conflict"?T?.entries?.some(o=>o.path===O.path&&o.conflicted):!0;A(()=>{T!==null&&O!==null&&!I&&te(null)},[T,S]),A(()=>{if(!m||O===null){ue(null);return}let o=new AbortController;return Ce(!0),t("diff",{workspaceId:h,repo:L,path:O.path,side:O.side},o.signal).then(y=>{o.signal.aborted||ue(y)}).catch(y=>{let E=ee(y);!o.signal.aborted&&E.name!=="AbortError"&&f(E)}).finally(()=>{o.signal.aborted||Ce(!1)}),()=>o.abort()},[m?.workspaceId,L,S,be,t]);function q(){ye(o=>o+1)}function oe(o){if(o===null){te(null);return}O!==null&&O.side===o.side&&O.path===o.path||(ue(null),te(o))}function pe(o){let y=new Set;for(let E of o)y.add(E.path),E.from&&y.add(E.from);return[...y]}async function St(o,y){if(N===null){z("file"),f(null);try{let E=await t(y==="staged"?"unstage":"stage",{workspaceId:h,repo:L,paths:pe([o])});Q(E),O?.path===o.path&&O.side===y&&te(null),q()}catch(E){f(ee(E))}finally{z(null)}}}async function bt(o){let y=o==="staged"?Ee:it;if(!(N!==null||y.length===0)){z("file"),f(null);try{let E=await t(o==="staged"?"unstage":"stage",{workspaceId:h,repo:L,paths:pe(y)});Q(E),q()}catch(E){f(ee(E))}finally{z(null)}}}async function $e(o,y){if(N!==null||o.length===0)return!1;z("file"),f(null);try{let E=await t(y==="staged"?"unstage":"stage",{workspaceId:h,repo:L,paths:pe(o)});return Q(E),te(null),ue(null),q(),!0}catch(E){return f(ee(E)),!1}finally{z(null)}}async function Sn(o){if(N!==null)throw new Error(n("stash.busy"));z("stash");try{let y=await t("stashPush",{workspaceId:h,repo:L,paths:o.paths,message:o.message});Q(y.status),te(null),ue(null),Y(n("stash.created",{count:o.paths.length})),_e(E=>E+1)}finally{z(null)}}function Mn(o){if(N!==null)return;let y=[...new Set(o.map(E=>E.path))];y.length!==0&&$({title:n(y.length===1?"discard.titleOne":"discard.titleMany",{count:y.length}),body:e("div",null,e("div",null,n("discard.bodyMany")),e("ul",{className:"gitp-confirm-paths"},y.slice(0,8).map(E=>e("li",{key:E},E))),y.length>8?e("div",{className:"gitp-confirm-more"},n("discard.more",{count:y.length-8})):null),confirmLabel:n("discard.confirm"),danger:!0,run:()=>void Rn(y)})}async function Rn(o){if(N===null){z("discard"),f(null);try{let y=await t("discard",{workspaceId:h,repo:L,paths:o,confirm:!0});Q(y),te(null),ue(null),q(),Y(o.length===1?n("discard.doneOne"):n("discard.doneMany",{count:o.length}))}catch(y){f(ee(y))}finally{z(null),$(null)}}}function Tn(o){N===null&&$({title:n(o.untracked?"discard.deleteTitle":"discard.title"),body:n(o.untracked?"discard.deleteBody":"discard.body",{path:o.path}),confirmLabel:n(o.untracked?"discard.deleteConfirm":"discard.confirm"),danger:!0,run:()=>void En(o)})}async function En(o){if(N===null){z("discard"),f(null);try{let y=await t("discard",{workspaceId:h,repo:L,paths:[o.path],confirm:!0});Q(y),O?.path===o.path&&(te(null),ue(null)),q(),Y(n(o.untracked?"discard.deleted":"discard.done",{name:dt(o.path).base}))}catch(y){f(ee(y))}finally{z(null),$(null)}}}async function Pn(o,y){if(!(N!==null||fe===null)){if(y==="revert"){$({title:n("confirm.revertTitle"),body:n("confirm.revertBody"),confirmLabel:n("confirm.yesRevert"),danger:!0,run:()=>$t(o,"revert")});return}await $t(o,y)}}async function $t(o,y){if(fe!==null){z("block"),f(null);try{let E=await t("applyBlocks",{workspaceId:h,repo:L,path:fe.path,side:y,blocks:[o],baseHash:fe.baseHash,targetHash:fe.targetHash,confirm:!0});Q(E),q()}catch(E){f(ee(E)),en(E)==="git/stale"&&q()}finally{z(null),$(null)}}}async function Hn(o){if(!(!O||N!==null)){z("resolve"),f(null);try{let y=await t("resolve",{workspaceId:h,repo:L,path:O.path,side:o});Q(y),te(null),q()}catch(y){f(ee(y))}finally{z(null)}}}async function Gt(){if(!(!d||N!==null)){z("commit"),f(null);try{let o=await t("commit",{workspaceId:h,repo:L,message:K,amend:He,noVerify:he});Q(o.status),ne(""),ae(!1),Y(n("commit.done",{hash:Ue(o.hash)})),q()}catch(o){f(ee(o))}finally{z(null)}}}function Dn(){Ee.length===0||Xe.length>0||(ce(null),ze(!0))}async function Wt(){if(ve||Ee.length===0)return null;Z(!0),f(null);try{let o=Dt.hook.getSnapshot(),y=await t("aiMessage",{workspaceId:h,repo:L,sessionId:r,...o.model===null?{}:{model:o.model},...o.instruction.trim()===""?{}:{instruction:o.instruction}});return y.model!==null&&y.model!==""&&Y(n("ai.written",{model:y.model})),y.message!==""?y.message:null}catch(o){return f(ee(o)),null}finally{Z(!1)}}async function Kt(){Ae(!1);let o=await Wt();o!==null&&ne(o)}async function zn(){if(Ae(!1),Ee.length===0||Xe.length>0)return;let o=await Wt();o!==null&&(ne(o),ce(null),ze(!0))}async function Ln({name:o,message:y}){M(!0),ce(null);try{let E=await t("createBranchAndCommit",{workspaceId:h,repo:L,name:o,message:y,noVerify:he});Q(E.status),ne(""),ze(!1),Y(n("branch.created",{branch:o})),q()}catch(E){ce(we(E))}finally{M(!1)}}async function An(o){if(N===null){z("sync"),k(o),f(null),Re(null);try{let y=await t(o,{workspaceId:h,repo:L});Q(y.status),o==="pull"&&y.autoStash==="conflict"?(j("changes"),te(null),ue(null),Re(n("sync.pulledStashConflict"))):Y(n(o==="fetch"?"sync.fetched":o==="pull"?y.autoStash==="restored"?"sync.pulledStashed":"sync.pulled":"sync.pushed"))}catch(y){f(ee(y))}finally{z(null),k(null)}}}async function Bn(){if(T?.repo!==!1){if(re!==null){se(null);return}se({branches:[],loading:!0});try{let o=await t("branches",{workspaceId:h,repo:L});se({branches:o.branches??[],loading:!1})}catch(o){se(null),f(ee(o))}}}function In(o,y){if(se(null),(T?.entries?.length??0)>0){$({title:n("confirm.checkoutTitle"),body:n("confirm.checkoutBody"),confirmLabel:n("confirm.yesCheckout"),danger:!1,run:()=>Ut(o,y)});return}Ut(o,y)}async function Ut(o,y){$(null),M(!0),f(null);try{let E=await t("checkout",{workspaceId:h,repo:L,branch:o,remote:y===!0});Q(E.status),se(null),te(null),q()}catch(E){se(null),f(ee(E))}finally{M(!1)}}async function Vt(){if(N===null){z("init"),f(null);try{let o=await t("init",{workspaceId:h});Array.isArray(o.repos)&&Te(o.repos);let y=o.selected??o.root??null;typeof y=="string"&&y!==""&&(We(ot+h,y),Ie(y)),Q(o)}catch(o){f(ee(o))}finally{z(null)}}}function Fn(o){tt(!1),o!==L&&(We(ot+h,o??""),Ie(o),J(null),te(null),ue(null),se(null))}function On(){tt(!1),$({title:n("repo.initRootTitle"),body:n("repo.initRootBody",{count:Oe.length}),confirmLabel:n("repo.initRootConfirm"),danger:!0,run:()=>{$(null),Vt()}})}async function jn({name:o}){if(L!==null){M(!0),ce(null);try{let y=await t("createBranch",{workspaceId:h,repo:L,name:o});Q(y.status),qe(!1),Y(n("branch.createdOnly",{branch:o})),q()}catch(y){ce(we(y))}finally{M(!1)}}}let _t=R?Je:Se;function qt(o){R?(Ve(o),We(nn,o)):(De(o),We(tn,o))}if(m===null)return e("div",{className:"gitp-root"},e(ke,{icon:e(D,{path:x.branch,size:28}),title:n("empty.noWorkspace"),hint:n("empty.noWorkspaceHint")}));let yt=T?.branch??null,$n=yt?.ahead??0,Gn=yt?.behind??0,Xt=X,Wn=Ee[0]?.path,Kn=wi(K,Wn),Un=K;return e("div",{className:_("gitp-root",R&&"is-compact"),ref:C},e(Li,{t:n,workspaceTitle:m.title,branch:yt,repo:T?.repo!==!1,ahead:$n,behind:Gn,upstream:yt?.upstream??null,onBranchMenu:Bn,onRepoMenu:()=>tt(!0),repos:Oe,repoRoot:L,onSync:An,busy:N!==null,onRefresh:()=>{de(void 0,!1),O&&q(),_e(o=>o+1)},syncing:G}),Xt?e("div",{className:"gitp-error",role:"alert"},e(D,{path:x.warning,size:14}),e("span",{className:"gitp-error-text"},we(Xt)),e(Me,{label:n("action.close"),icon:x.close,onClick:()=>f(null)})):null,ut?e("div",{className:"gitp-error",role:"status"},e(D,{path:x.warning,size:14}),e("span",{className:"gitp-error-text"},ut),e(Me,{label:n("action.close"),icon:x.close,onClick:()=>Re(null)})):null,e("div",{className:"gitp-body"},e(Ai,{t:n,mode:F,onMode:j,counts:{changes:T?.entries?.length??0}}),e("div",{className:"gitp-content"},T===null?e(ke,{icon:e(le),title:n("status.loading")}):T.repo===!1?e(ke,{icon:e(D,{path:x.branch,size:28}),title:n("empty.noRepo"),hint:n("empty.noRepoHint"),action:e("button",{type:"button",className:"gitp-btn is-primary",onClick:Vt,disabled:N!==null},N==="init"?e(le):null,n("empty.init"))}):F==="log"?e(Gi,{call:t,workspaceId:h,repo:L??"",t:n,refreshToken:Be,compact:R,layout:_t,onLayout:qt,snapshot:T,onApplied:ft}):F==="stash"?e(Wi,{call:t,workspaceId:h,repo:L??"",t:n,snapshot:T,onStatus:Q,refreshToken:Be}):e(Ti,{t:n,snapshot:T,conflicts:Xe,staged:Ee,unstaged:it,selection:O,onSelect:oe,busy:N!==null,fileBusy:N!==null,onToggleFile:St,onToggleAll:bt,onDiscard:Tn,onBatchStage:o=>$e(o,"unstaged"),onBatchUnstage:o=>$e(o,"staged"),onBatchDiscard:Mn,onStash:Sn,diff:fe,diffLoading:Fe,layout:_t,onLayout:qt,onRefresh:()=>{q(),de(void 0,!1)},onBlock:Pn,onResolve:Hn,onOpen:Qe,message:K,onMessage:ne,onCommit:Gt,onBranch:Dn,canCommit:d,commitBusy:N==="commit",aiBusy:ve,aiMenuOpen:Le,onAiToggle:()=>Ae(o=>!o),onAiClose:()=>Ae(!1),onAiWrite:Kt,onAiBranch:zn,selectionKey:S,amend:He,onAmend:ae,noVerify:he,onNoVerify:me,canAmend:T.branch?.initial!==!0,compact:R,onBack:()=>te(null)}))),re?e(Ii,{t:n,branches:re.branches,loading:re.loading===!0,busy:v,onCheckout:In,onNew:()=>{se(null),ce(null),qe(!0)},onClose:()=>se(null)}):null,et?e(Bi,{t:n,repos:Oe,current:L,onPick:Fn,onInitRoot:On,onClose:()=>tt(!1)}):null,Ct?e(Fi,{t:n,busy:v,error:ge,onCreate:jn,onClose:()=>{qe(!1),ce(null)}}):null,Ze?e(Ri,{t:n,defaultName:Kn,defaultMessage:Un,busy:v,noVerify:he,error:ge,onCreate:Ln,onNoVerify:me,onClose:()=>{ze(!1),ce(null)}}):null,W?e(jt,{title:W.title,body:W.body,confirmLabel:W.confirmLabel,cancelLabel:n("action.cancel"),danger:W.danger,busy:N!==null||v,onConfirm:()=>W.run(),onClose:()=>$(null)}):null,V?e("div",{className:"gitp-toast",role:"status","aria-live":"polite"},V):null)}function qi({t}){return e(Ne.default.Fragment,null,e(Nt,{size:14}),e("span",{className:"gitp-tab-title"},t("panel")))}function hn({sessionId:t,sidebarRight:n,useVisible:a,t:i}){let r=a(p=>p===!0),s=i("header.label");return e("button",{type:"button",className:_("gitp-iconbtn","gitp-header-btn",r&&"is-active"),"aria-label":s,"aria-pressed":r,title:s,onClick(){if(!r){n.openTab("git");return}let p=n.tabsIn(t).find(u=>u.kind==="git");p!==void 0&&n.hide(p.id)}},e(Nt,{size:16}))}function Cn({label:t,containerRef:n,columnRef:a,width:i,onChange:r}){let s=B(null),p=()=>{let l=n.current;return l===null?i:Math.max(lt,Math.round(l.getBoundingClientRect().width)-sn)},u=l=>Math.min(Math.max(Math.round(l),lt),p());return A(()=>()=>{s.current=null,document.body.style.cursor="",document.body.style.userSelect=""},[]),A(()=>{let l=n.current;if(l===null||typeof ResizeObserver>"u")return;let c=new ResizeObserver(()=>{let g=Math.round(l.getBoundingClientRect().width);if(g===0)return;let b=Math.max(lt,g-sn);i>b&&r(b)});return c.observe(l),()=>c.disconnect()},[n,i,r]),e("div",{className:"gitp-resizer",role:"separator","aria-orientation":"vertical","aria-label":t,"aria-valuemin":lt,"aria-valuemax":p(),"aria-valuenow":i,tabIndex:0,onPointerDown(l){l.button===0&&(s.current={x:l.clientX,width:i,next:i},l.currentTarget.setPointerCapture(l.pointerId),document.body.style.cursor="col-resize",document.body.style.userSelect="none",l.preventDefault())},onPointerMove(l){let c=s.current;if(c===null)return;let g=u(c.width+(l.clientX-c.x));g!==c.next&&(c.next=g,a.current!==null&&(a.current.style.width=`${g}px`),l.currentTarget.setAttribute("aria-valuenow",String(g)))},onPointerUp(l){let c=s.current;c!==null&&(s.current=null,l.currentTarget.hasPointerCapture(l.pointerId)&&l.currentTarget.releasePointerCapture(l.pointerId),document.body.style.cursor="",document.body.style.userSelect="",r(c.next))},onPointerCancel(){s.current=null,document.body.style.cursor="",document.body.style.userSelect=""},onDoubleClick(){r(u(zt))},onKeyDown(l){if(l.key==="ArrowLeft"||l.key==="ArrowRight"){l.preventDefault();let c=l.key==="ArrowRight"?rn:-rn;r(u(i+c));return}l.key==="Home"&&(l.preventDefault(),r(u(zt)))}})}var It=null;function Xi({t,call:n,usePrefs:a,savePrefs:i}){let r=a(R=>R),[s,p]=w(null),[u,l]=w(!1);A(()=>{let R=new AbortController,P=!0;return n("preferences",{},R.signal).then(T=>{P&&p(T)},()=>{P&&l(!0)}),()=>{P=!1,R.abort()}},[n]);let c=s?.groups??[],g=r.model,b=g===null?"":cn(g),m=g!==null&&c.some(R=>R.id===g.provider&&R.models.some(P=>P.id===g.model)),h=r.instruction===""?s?.instruction??"":r.instruction,C=s===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:b,disabled:C,onChange:R=>{let P=R.target.value;if(P===""){i({...r,model:null});return}let T=xi(P);T!==null&&i({...r,model:T})}},e("option",{value:""},t("settings.modelSame")),m||r.model===null?null:e("option",{value:b},`${r.model.provider} \xB7 ${r.model.model}`),c.map(R=>e("optgroup",{key:R.id,label:R.label},R.models.map(P=>e("option",{key:P.id,value:cn({provider:R.id,model:P.id})},P.name))))),u?e("p",{className:"gitp-settings-error"},t("settings.modelFailed")):null,!u&&s!==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:h,spellCheck:!1,disabled:C,onChange:R=>i({...r,instruction:R.target.value})}),e("div",{className:"gitp-settings-actions"},e("button",{type:"button",className:"gitp-btn is-small",disabled:r.instruction==="",onClick:()=>i({...r,instruction:""})},t("settings.instructionReset"))),u?e("p",{className:"gitp-settings-error"},t("settings.instructionFailed")):null))}function Yi(){return e(Nt,{size:16})}function Ji(t,n){let a=s=>({status:"blocked",reason:s}),i=["page","editable","terminal"],r=s=>{let p=It;return p===null||!p.visible?a(n("command.openFirst")):s(p)};return[{id:"git.panel.toggle",label:()=>n("command.toggle"),aliases:["git","source control","toggle panel"],defaults:{},regions:i,modals:[],resolve:()=>({status:"handled",run:()=>{let s=t.sidebarRight.active();if(t.sidebarRight.isExpanded()&&s!==void 0&&s.kind==="git"){t.sidebarRight.hide(s.id);return}try{t.sidebarRight.openTab("git")}catch{}}})},{id:"git.stageAll",label:()=>n("command.stageAll"),aliases:["git","stage"],defaults:{},regions:i,modals:[],resolve:()=>r(s=>s.canStageAll()?{status:"handled",run:()=>s.stageAll()}:a(n("command.nothingToStage")))},{id:"git.commit",label:()=>n("command.commit"),aliases:["git","commit"],defaults:{},regions:i,modals:[],resolve:()=>r(s=>s.canCommit()?{status:"handled",run:()=>s.commit()}:a(n("command.notReady")))},{id:"git.writeMessage",label:()=>n("command.writeMessage"),aliases:["git","commit message","ai"],defaults:{},regions:i,modals:[],resolve:()=>r(s=>s.canWriteMessage()?{status:"handled",run:()=>s.writeMessage()}:a(n("command.notReady")))}]}var Zi=["connection","slots","locale","sidebarRightTabs","sidebarRight"];function Qi(t){t.locale.register(Ge,"en",ci),t.locale.register(Ge,"zh",di);let n=t.locale.bind(Ge),a=async(r,s,p)=>{let u=await t.connection.rpc.call("/git-rpc",r,s,p);if(!u.ok)throw new Ht(u.error.code,u.error.message,u.error.details);return u.value};t.effect(()=>t.sidebarRightTabs.register({id:Tt,kind:"git",priority:"extension",title:()=>n("panel"),guide:[{id:"git",order:50,title:()=>n("guide.title"),description:()=>n("guide.description"),icon:()=>e(Si,null)}]}),"dsh-git: right sidebar tab type");let i=r=>({sessionId:r,sidebarRight:t.sidebarRight,hooks:{visible:fn(r).hook}});t.slots.inject("conversation.session.header.utilities",()=>t.slots.register({name:"conversation.session.header.utilities",id:"git-panel",order:-7,locale:Ge,inject:i},hn)),t.slots.inject("conversation.hero.options",()=>t.slots.register({name:"conversation.hero.options",id:"git-panel",order:-7,locale:Ge,inject:i},hn)),t.slots.inject("settings.section",()=>t.slots.register({name:"settings.section",id:"git",order:25,label:()=>n("settings.section"),locale:Ge,inject:()=>({t:n,call:a,savePrefs:Dt.set,hooks:{prefs:Dt.hook}})},Xi)),t.slots.inject("settings.section.icon",()=>t.slots.register({name:"settings.section.icon",id:"git",order:25},Yi)),t.inject(["shortcuts"],r=>{for(let s of Ji(t,n))r.effect(()=>r.shortcuts.register(s),`dsh-git: ${s.id}`)}),t.slots.inject("sidebar.right.pane.tab",()=>t.slots.register({name:"sidebar.right.pane.tab",key:Tt,locale:Ge,inject:()=>({call:a,t:n,sidebarRight:t.sidebarRight})},_i)),t.slots.inject("sidebar.right.pane.tab.title",()=>t.slots.register({name:"sidebar.right.pane.tab.title",key:Tt,locale:Ge,inject:()=>({t:n})},qi))}
385
+ `,kn="dsh-git-desk/styles";if(typeof document<"u"&&document.querySelector(`style[data-plugin-css=${JSON.stringify(kn)}]`)===null){let t=document.createElement("style");t.dataset.plugin="dsh-git-desk",t.dataset.pluginCss=kn,t.textContent=qi,document.head.appendChild(t)}function Me({icon:t,title:n,hint:r,action:i}){return e("div",{className:"gitp-center"},t?e("div",{className:"gitp-center-icon"},t):null,e("div",{className:"gitp-center-title"},n),r?e("div",{className:"gitp-center-hint"},r):null,i??null)}function ue(){return e("span",{className:"gitp-spinner","aria-hidden":"true"})}function ze({label:t,icon:n,onClick:r,disabled:i,active:s}){return e("button",{type:"button",className:Y("gitp-iconbtn",s&&"is-active"),onClick:r,disabled:i,"aria-label":t,title:t},e(A,{path:n}))}function Lt({label:t,icon:n,count:r,onClick:i,disabled:s,busy:o}){return e("button",{type:"button",className:Y("gitp-toolbtn",r>0&&"has-count"),onClick:i,disabled:s||o,"aria-label":r>0?`${t}, ${r}`:t,title:r>0?`${t} (${r})`:t},o?e(ue):e(A,{path:n,size:14}),r>0?e("span",{className:"gitp-toolbtn-num"},r>99?"99+":String(r)):null)}function at({title:t,onClose:n,children:r,danger:i,closeLabel:s="Close"}){let o=G(null),d=G(n);return d.current=n,O(()=>{let g=document.activeElement,l=o.current;l?.querySelector("input, textarea, select, button")?.focus();let m=v=>{if(v.key==="Escape"){v.preventDefault(),v.stopPropagation(),d.current();return}if(v.key!=="Tab"||l===null)return;let b=[...l.querySelectorAll('button, input, textarea, select, [href], [tabindex]:not([tabindex="-1"])')].filter(D=>!D.hasAttribute("disabled")&&D.offsetParent!==null);if(b.length===0)return;let h=b[0],R=b[b.length-1];h===void 0||R===void 0||(v.shiftKey&&document.activeElement===h?(v.preventDefault(),R.focus()):!v.shiftKey&&document.activeElement===R&&(v.preventDefault(),h.focus()))};return document.addEventListener("keydown",m,!0),()=>{document.removeEventListener("keydown",m,!0),g instanceof HTMLElement&&typeof g.focus=="function"&&g.focus()}},[]),e("div",{className:"gitp-modal-layer",onMouseDown:g=>{g.target===g.currentTarget&&d.current()}},e("div",{className:Y("gitp-modal",i&&"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(ze,{label:s,icon:w.close,onClick:n})),r))}function Vt({title:t,body:n,confirmLabel:r,cancelLabel:i,danger:s,busy:o,onConfirm:d,onClose:g}){return e(at,{title:t,onClose:g,danger:s},e("div",{className:"gitp-modal-sub"},n),e("div",{className:"gitp-modal-actions"},e("button",{type:"button",className:"gitp-btn",onClick:g,disabled:o},i),e("button",{type:"button",className:Y("gitp-btn",s?"is-danger":"is-primary"),onClick:d,disabled:o},o?e(ue):null,r)))}function Xi({t,defaultName:n,defaultMessage:r,busy:i,noVerify:s,error:o,onCreate:d,onNoVerify:g,onClose:l}){let[c,m]=C(n),[v,b]=C(r),h=G(null);Hn(h,v);let R=c.trim()!==""&&v.trim()!==""&&!i;return e(at,{title:t("branch.title"),onClose:l,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:c,onChange:D=>m(D.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:h,value:v,onChange:D=>b(D.target.value)})),e("label",{className:"gitp-dialog-option",title:t("commit.noVerifyHint")},e("input",{type:"checkbox",checked:s,onChange:D=>g(D.target.checked),disabled:i}),t("commit.noVerify")),o?e("div",{className:"gitp-modal-error"},o):null,e("div",{className:"gitp-modal-actions"},e("button",{type:"button",className:"gitp-btn",onClick:l,disabled:i},t("action.cancel")),e("button",{type:"button",className:"gitp-btn is-primary",disabled:!R,onClick:()=>d({name:c.trim(),message:v.trim()})},i?e(ue):null,t("action.createBranch"))))}function En({t,files:n,busy:r,error:i,onCreate:s,onClose:o}){let[d,g]=C(()=>new Set(n.map(v=>v.path))),[l,c]=C(""),m=v=>{g(b=>{let h=new Set(b);return h.has(v)?h.delete(v):h.add(v),h})};return e(at,{title:t("stash.title"),onClose:()=>{r||o()},closeLabel:t("action.close")},e("div",{className:"gitp-modal-sub"},t("stash.selectHint")),e("div",{className:"gitp-modal-sub"},t("stash.renameHint")),n.length>1?e("div",{style:{display:"flex",justifyContent:"flex-end",marginBottom:"4px"}},e("button",{type:"button",className:"gitp-linkbtn",onClick:()=>g(d.size===n.length?new Set:new Set(n.map(v=>v.path)))},d.size===n.length?t("stash.deselectAll"):t("stash.selectAll"))):null,n.length===0?e("div",{className:"gitp-modal-sub"},t("stash.nothing")):e("div",{className:"gitp-filechecks"},n.map(v=>e("label",{className:"gitp-check",key:v.path},e("input",{type:"checkbox",checked:d.has(v.path),onChange:()=>m(v.path)}),e("span",{className:"gitp-check-path"},v.path)))),e("div",{className:"gitp-field"},e("label",{htmlFor:"gitp-stash-message"},t("stash.message")),e("input",{id:"gitp-stash-message",value:l,onChange:v=>c(v.target.value),placeholder:t("stash.default")})),i?e("div",{className:"gitp-modal-error",role:"alert"},i):null,e("div",{className:"gitp-modal-actions"},e("button",{type:"button",className:"gitp-btn",onClick:o,disabled:r},t("action.cancel")),e("button",{type:"button",className:"gitp-btn is-primary",disabled:r||d.size===0,onClick:()=>s({paths:[...d],message:l.trim()})},r?e(ue):null,t("action.stash"))))}function ft({label:t,value:n}){return e("div",{className:"gitp-modal-fact"},e("span",null,t),e("b",null,n))}function Yi({t,source:n,current:r,remote:i,noFastForward:s,busy:o,error:d,onNoFastForward:g,onConfirm:l,onClose:c}){return e(at,{title:t("merge.title",{branch:r}),onClose:()=>{o||c()},closeLabel:t("action.close")},e("div",{className:"gitp-modal-sub"},t("merge.body",{source:n,branch:r})),e("div",{className:"gitp-modal-facts"},e(ft,{label:t("merge.sourceLabel"),value:n}),e(ft,{label:t("merge.targetLabel"),value:r}),e(ft,{label:t("merge.resultLabel"),value:t(s?"merge.resultCommit":"merge.resultFF")})),e("label",{className:"gitp-dialog-option"},e("input",{type:"checkbox",checked:s,onChange:m=>g(m.target.checked),disabled:o}),t("merge.noFF")),e("div",{className:"gitp-modal-hint"},t("merge.noFFHint")),e("div",{className:"gitp-modal-hint"},t("merge.note")),i?e("div",{className:"gitp-modal-hint"},t("merge.remoteNote",{source:n})):null,d?e("div",{className:"gitp-modal-error",role:"alert"},d):null,e("div",{className:"gitp-modal-actions"},e("button",{type:"button",className:"gitp-btn",onClick:c,disabled:o},t("action.cancel")),e("button",{type:"button",className:"gitp-btn is-primary",onClick:l,disabled:o},o?e(ue):null,o?t("merge.busy"):t("merge.confirm",{branch:r}))))}function Ji({t,source:n,current:r,commits:i,pushed:s,upstream:o,dirtyCount:d,remote:g,busy:l,error:c,onConfirm:m,onClose:v}){let b=i===1?t("rebase.bodyOne",{branch:r,source:n}):t("rebase.body",{branch:r,count:i,source:n}),h=d===1?t("rebase.dirtyWarnOne"):t("rebase.dirtyWarn",{count:d}),R=o===null?"":s===1?t("rebase.pushedWarnOne",{upstream:o}):t("rebase.pushedWarn",{count:s,upstream:o});return e(at,{title:t("rebase.title",{source:n}),onClose:()=>{l||v()},closeLabel:t("action.close")},e("div",{className:"gitp-modal-sub"},b),e("div",{className:"gitp-modal-facts"},e(ft,{label:t("rebase.fact"),value:String(i)}),s>0&&o!==null?e(ft,{label:t("rebase.factPushed",{upstream:o}),value:String(s)}):null),s>0?e("div",{className:"gitp-modal-warn is-caution",role:"alert"},R):null,d>0?e("div",{className:"gitp-modal-warn",role:"alert"},h):null,e("div",{className:"gitp-modal-hint"},t("rebase.note")),g?e("div",{className:"gitp-modal-hint"},t("merge.remoteNote",{source:n})):null,c?e("div",{className:"gitp-modal-error",role:"alert"},c):null,e("div",{className:"gitp-modal-actions"},e("button",{type:"button",className:"gitp-btn",onClick:v,disabled:l},t("action.cancel")),e("button",{type:"button",className:"gitp-btn is-primary",onClick:m,disabled:l||d>0},l?e(ue):null,l?t("rebase.busy"):t("rebase.confirm",{source:n}))))}function Bt({entry:t,side:n,selected:r,focused:i,busy:s,t:o,onActivate:d,onToggle:g}){let l=bt(t.path),c=n==="staged"?t.stagedAdd:t.add,m=n==="staged"?t.stagedDel:t.del,v=o(n==="staged"?"action.unstageFile":"action.stageFile");return e("div",{className:Y("gitp-filerow",r&&"is-selected",i&&"is-focused"),role:"button",tabIndex:0,"aria-pressed":r,onClick:b=>d(b),onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),d(b))}},e("span",{className:Y("gitp-status",Ut(t.letter))},t.letter),e("span",{className:"gitp-filename"},l.dir?e("span",{className:"gitp-filedir"},l.dir):null,l.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"},c!==null&&c>0?e("span",{className:"gitp-add"},`+${c}`):null,m!==null&&m>0?e("span",{className:"gitp-del"},`\u2212${m}`):null),n==="conflict"?null:e("button",{type:"button",className:"gitp-rowaction","aria-label":v,title:v,disabled:s,onClick:b=>{b.stopPropagation(),g()}},e(A,{path:n==="staged"?w.minus:w.plus,size:14})))}function Zi({t,snapshot:n,conflicts:r,staged:i,unstaged:s,selection:o,onSelect:d,busy:g,fileBusy:l,onToggleFile:c,onToggleAll:m,onDiscard:v,onBatchStage:b,onBatchUnstage:h,onBatchDiscard:R,onStash:D,diff:H,diffLoading:k,layout:Q,onLayout:ie,onRefresh:se,onBlock:Z,onResolve:f,onOpen:x,message:M,onMessage:ee,onCommit:E,onBranch:P,canCommit:B,commitBusy:I,aiBusy:$,aiMenuOpen:j,onAiToggle:q,onAiClose:U,onAiWrite:V,onAiBranch:z,selectionKey:X,amend:we,onAmend:le,noVerify:We,onNoVerify:Te,canAmend:Ne,compact:Ce,onBack:Pe,operation:Le,sides:rt}){let[Oe,ot]=C(""),[je,st]=Pn(),Ge=G(null),He=G(null),Je=G(null);Hn(Je,M);let Ee=(p,S)=>`${p}\0${S}`,[_,me]=C(()=>o===null||o.side==="conflict"?new Set:new Set([Ee(o.side,o.path)])),[ce,y]=C(!1),[T,K]=C(null),[W,re]=C(null),J=G(!1);O(()=>{T!==null||!J.current||(J.current=!1,(He.current?.querySelector(".gitp-filerow")??He.current?.querySelector(".gitp-filter-box input"))?.focus())},[T,n]);let De=G(null),[xe,be]=C({conflicts:!1,staged:!1,unstaged:!1}),ge=p=>be(S=>({...S,[p]:!S[p]})),Be=Oe.trim().toLowerCase(),ke=p=>Be===""||p.path.toLowerCase().includes(Be),Ze=Ie(()=>r.filter(ke),[r,Be]),Ke=Ie(()=>i.filter(ke),[i,Be]),$e=Ie(()=>s.filter(ke),[s,Be]),Qe=p=>{let S=p.indexOf("\0");if(S<0)return null;let F=p.slice(0,S);if(F!=="staged"&&F!=="unstaged")return null;let fe=p.slice(S+1),de=(F==="staged"?i:s).find(ae=>ae.path===fe);return de===void 0?null:{side:F,entry:de}},Ue=Ie(()=>{let p=[];for(let S of _){let F=Qe(S);F!==null&&p.push(F)}return p},[_,i,s]),et=Ue.filter(p=>p.side==="unstaged"),L=Ue.filter(p=>p.side==="staged");O(()=>{me(p=>{if(p.size===0)return p;let S=new Set;for(let F of p)Qe(F)!==null&&S.add(F);return S.size===p.size?p:S})},[n,o]),O(()=>{_.size===0&&y(!1)},[_.size]);function Fe(p,S){if(p==="conflict"){De.current=null,me(new Set),d({side:p,path:S.path,renamed:!1});return}De.current={side:p,path:S.path,renamed:S.kind==="renamed"},me(new Set([Ee(p,S.path)])),d({side:p,path:S.path,renamed:S.kind==="renamed"})}function Mt(p,S){let F=Ee(p,S.path);if(_.has(F)){let fe=new Set(_);if(fe.delete(F),o!==null&&o.side===p&&o.path===S.path){let de=[...fe].pop(),ae=de===void 0?null:Qe(de);d(ae===null?null:{side:ae.side,path:ae.entry.path,renamed:ae.entry.kind==="renamed"})}me(fe);return}De.current={side:p,path:S.path,renamed:S.kind==="renamed"},me(new Set([..._,F])),d({side:p,path:S.path,renamed:S.kind==="renamed"})}function Tt(p,S){let F=p==="staged"?Ke:$e,fe=De.current!==null&&De.current.side===p?De.current.path:null,de=fe===null?-1:F.findIndex(nt=>nt.path===fe),ae=F.findIndex(nt=>nt.path===S.path);if(de<0||ae<0){Fe(p,S);return}let[Ae,Pt]=de<=ae?[de,ae]:[ae,de];me(new Set(F.slice(Ae,Pt+1).map(nt=>Ee(p,nt.path)))),d({side:p,path:S.path,renamed:S.kind==="renamed"})}function lt(p,S,F){let fe=F!==null&&(F.metaKey||F.ctrlKey),de=F!==null&&F.shiftKey;if(p==="conflict"){if(fe||de)return;y(!1),Fe(p,S);return}if(F===null){y(!1),Fe(p,S);return}if(de){y(!0),Tt(p,S);return}if(fe){y(!0),Mt(p,S);return}y(!1),Fe(p,S)}function vt(p){if(ot(p),_.size===0)return;let S=ce;me(new Set),y(!1),De.current=null,S&&d(null)}function tt(){me(new Set),y(!1),De.current=null,d(null)}async function ct(p){let S=p==="stage"?et:p==="unstage"?L:Ue;if(S.length===0)return;let F=S.map(de=>de.entry);if(p==="discard"){R(F);return}(p==="stage"?await b(F):await h(F))&&(me(new Set),y(!1),He.current?.querySelector(".gitp-filerow")?.focus())}let Ve=o===null||o.side==="conflict"?null:(o.side==="staged"?i:s).find(p=>p.path===o.path)??null;function _e(p){let S=[...new Map(p.map(F=>[F.path,F])).values()];S.length!==0&&(re(null),K(S))}async function dt(p){re(null);try{await D(p),J.current=!0,K(null),tt()}catch(S){re(ye(S))}}let te=Ie(()=>{let p=0,S=0;for(let F of i)p+=F.stagedAdd??0,S+=F.stagedDel??0;return{add:p,del:S}},[i]),he=!Ce||o===null||ce,yt=!Ce||o!==null&&!ce,wt=Ze.length+Ke.length+$e.length,pt=r.length+i.length+s.length;return e("div",{className:"gitp-changes",ref:Ge},he?e("div",{className:"gitp-listcol",ref:He,style:Ce?void 0:{width:`${je}px`}},pt>0?e("div",{className:"gitp-filter-box"},e(A,{path:w.search,size:13}),e("input",{type:"text",value:Oe,onChange:p=>vt(p.target.value),placeholder:t("filter.placeholder"),"aria-label":t("filter.placeholder"),spellCheck:!1}),Oe?e("button",{type:"button",className:"gitp-filter-clear",onClick:()=>vt(""),"aria-label":t("filter.clear")},e(A,{path:w.close,size:10})):null):null,_.size>1?e("div",{className:"gitp-batchbar",role:"group","aria-label":t("selection.count",{count:_.size})},e("span",{className:"gitp-batch-count"},t("selection.count",{count:_.size})),e("button",{type:"button",className:"gitp-batch-btn","aria-label":t("selection.stage"),title:t("selection.stage"),disabled:l||et.length===0,onClick:()=>ct("stage")},e(A,{path:w.plus,size:14})),e("button",{type:"button",className:"gitp-batch-btn","aria-label":t("selection.unstage"),title:t("selection.unstage"),disabled:l||L.length===0,onClick:()=>ct("unstage")},e(A,{path:w.minus,size:14})),e("button",{type:"button",className:"gitp-batch-btn","aria-label":t("action.stash"),title:t("action.stash"),disabled:l,onClick:()=>_e(Ue.map(p=>p.entry))},e(A,{path:w.stash,size:14})),e("button",{type:"button",className:"gitp-batch-btn is-danger","aria-label":t("selection.discard"),title:t("selection.discard"),disabled:l,onClick:()=>ct("discard")},e(A,{path:w.trash,size:14})),e("button",{type:"button",className:"gitp-batch-btn","aria-label":t("selection.clear"),title:t("selection.clear"),disabled:l,onClick:tt},e(A,{path:w.close,size:14}))):null,e("div",{className:"gitp-filelist"},Ze.length>0?e(ve.default.Fragment,null,e("div",{className:"gitp-section-head is-conflict",onClick:()=>ge("conflicts"),onKeyDown:p=>{p.target!==p.currentTarget||p.key!=="Enter"&&p.key!==" "||(p.preventDefault(),ge("conflicts"))},role:"button","aria-expanded":!xe.conflicts,tabIndex:0},e(A,{path:w.chevron,size:14,className:Y("gitp-section-chev",xe.conflicts&&"is-collapsed")}),e("span",{className:"gitp-section-title"},t("section.conflicts")),e("span",{className:"gitp-section-count"},String(Ze.length))),xe.conflicts?null:Ze.map(p=>e(Bt,{key:`conflict:${p.path}`,entry:p,side:"conflict",selected:o?.side==="conflict"&&o.path===p.path,focused:!1,busy:l,t,onActivate:S=>lt("conflict",p,S),onToggle:()=>{}}))):null,Ke.length>0?e(ve.default.Fragment,null,e("div",{className:"gitp-section-head",onClick:()=>ge("staged"),onKeyDown:p=>{p.target!==p.currentTarget||p.key!=="Enter"&&p.key!==" "||(p.preventDefault(),ge("staged"))},role:"button","aria-expanded":!xe.staged,tabIndex:0},e(A,{path:w.chevron,size:14,className:Y("gitp-section-chev",xe.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:l,onClick:p=>{p.stopPropagation(),m("staged")}},e(A,{path:w.minus,size:14}))),xe.staged?null:Ke.map(p=>e(Bt,{key:`staged:${p.path}`,entry:p,side:"staged",selected:_.has(Ee("staged",p.path))||_.size===0&&o?.side==="staged"&&o.path===p.path,focused:_.size>1&&o?.side==="staged"&&o.path===p.path,busy:l,t,onActivate:S=>lt("staged",p,S),onToggle:()=>c(p,"staged")}))):null,$e.length>0?e(ve.default.Fragment,null,e("div",{className:"gitp-section-head",onClick:()=>ge("unstaged"),onKeyDown:p=>{p.target!==p.currentTarget||p.key!=="Enter"&&p.key!==" "||(p.preventDefault(),ge("unstaged"))},role:"button","aria-expanded":!xe.unstaged,tabIndex:0},e(A,{path:w.chevron,size:14,className:Y("gitp-section-chev",xe.unstaged&&"is-collapsed")}),e("span",{className:"gitp-section-title"},t("section.unstaged")),e("span",{className:"gitp-section-count"},String($e.length)),e("button",{type:"button",className:"gitp-section-action","aria-label":t("action.stageAll"),title:t("action.stageAll"),disabled:l,onClick:p=>{p.stopPropagation(),m("unstaged")}},e(A,{path:w.plus,size:14}))),xe.unstaged?null:$e.map(p=>e(Bt,{key:`unstaged:${p.path}`,entry:p,side:"unstaged",selected:_.has(Ee("unstaged",p.path))||_.size===0&&o?.side==="unstaged"&&o.path===p.path,focused:_.size>1&&o?.side==="unstaged"&&o.path===p.path,busy:l,t,onActivate:S=>lt("unstaged",p,S),onToggle:()=>c(p,"unstaged")}))):null,Be!==""&&wt===0?e("div",{className:"gitp-center",style:{padding:"24px"}},t("filter.empty",{filter:Oe})):null,pt===0?e(Me,{icon:e(A,{path:w.check,size:28}),title:t("empty.noChanges"),hint:t("empty.noChangesHint"),action:e("button",{type:"button",className:"gitp-btn is-small",onClick:se,disabled:g},t("action.refresh"))}):null),e("div",{className:Y("gitp-commitbox",Le!==null&&"is-hidden")},e("textarea",{ref:Je,value:M,onChange:p=>ee(p.target.value),onKeyDown:p=>{p.defaultPrevented||(p.ctrlKey||p.metaKey)&&p.key==="Enter"&&(p.preventDefault(),B&&!I&&E())},placeholder:t("commit.placeholder"),"aria-label":t("commit.placeholder")}),e("div",{className:Y("gitp-commit-status-line",r.length>0&&"has-conflict")},r.length>0?e("span",null,t("commit.hintConflict")):i.length>0?e(ve.default.Fragment,null,e("span",null,t("commit.stagedSummary",{count:i.length})," ",e("span",{className:"gitp-add"},`+${te.add}`)," ",e("span",{className:"gitp-del"},`\u2212${te.del}`)),e("span",null,t("commit.shortcut",{key:Ai}))):e("span",null,t("commit.hintStage"))),e("div",{className:"gitp-commit-actions"},e("div",{className:"gitp-commit-opts"},Ne?e("label",{className:"gitp-amend"},e("input",{type:"checkbox",checked:we,onChange:p=>le(p.target.checked)}),t("commit.amend")):null,e("label",{className:"gitp-amend",title:t("commit.noVerifyHint")},e("input",{type:"checkbox",checked:We,onChange:p=>Te(p.target.checked),disabled:I}),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":j===!0,title:t("ai.action"),disabled:I||$||i.length===0,onClick:q},$?e(ue):e(A,{path:w.sparkles,size:13}))),e("button",{type:"button",className:"gitp-btn is-small",onClick:P,disabled:I||r.length>0||i.length===0,"aria-label":t("action.branch")},e(A,{path:w.branch,size:13}),t("action.branch")),e("button",{type:"button",className:"gitp-btn is-primary is-small",onClick:E,disabled:!B||I},I?e(ue):null,t(I?"action.committing":"action.commit"))),j?e(ia,{t,busy:$,canUse:i.length>0,canBranch:i.length>0&&r.length===0,onWrite:V,onBranch:z,onClose:U}):null),Le===null?null:e("div",{className:"gitp-opfoot"},e(A,{path:Le==="merge"?w.merge:w.rebase,size:13}),e("span",null,t(Le==="merge"?"opFoot.merge":"opFoot.rebase")))):null,he&&yt?e(An,{label:t("split.files"),containerRef:Ge,columnRef:He,width:je,onChange:st}):null,yt?e("div",{className:"gitp-diffcol"},o?e(Dn,{t,diff:H,loading:k,layout:Q,onLayout:ie,onBlock:Z,onResolve:f,busy:l,selectionKey:X,renamed:o.renamed===!0,compact:Ce,onBack:Pe,operation:Le,sides:rt,onOpen:x,onDiscard:Ve===null?void 0:()=>v(Ve),onStash:Ve===null||_.size>1?void 0:()=>_e([Ve])}):e(Me,{icon:e(A,{path:w.file,size:28}),title:t("empty.selectFile"),hint:t("empty.selectFileHint")})):null,T===null?null:e(En,{t,files:T,busy:l,error:W,onCreate:dt,onClose:()=>K(null)}))}function Dn({t,diff:n,loading:r,layout:i,onLayout:s,onBlock:o,onResolve:d,busy:g,selectionKey:l,renamed:c=!1,compact:m,onBack:v,onOpen:b,onDiscard:h,onStash:R,operation:D,sides:H}){let k=G(null),[Q,ie]=C({index:-1,canPrev:!1,canNext:!1}),se=cn(n),Z=Ie(()=>n===null?[]:[...n.blocks??[]].sort((P,B)=>P.row-B.row),[n]),f=()=>{let P=k.current;if(P===null)return[];let B=[...P.querySelectorAll(".gitp-pane")];if(B.length>0)return B;let I=P.querySelector(".gitp-unified");return I===null?[]:[I]},x=P=>{let B=-1;for(let I=0;I<Z.length;I+=1){let $=Z[I];$!==void 0&&$.row*Ye<=P+40&&(B=I)}return{index:B,canPrev:B>0,canNext:Z.some(I=>I.row*Ye>P+40)}};O(()=>{let P=k.current;if(P===null)return;let B=0,I=()=>{let j=f()[0];ie(x(j===void 0?0:j.scrollTop))},$=()=>{B===0&&(B=requestAnimationFrame(()=>{B=0,I()}))};return P.addEventListener("scroll",$,!0),I(),()=>{P.removeEventListener("scroll",$,!0),B!==0&&cancelAnimationFrame(B)}},[n,i]);let M=P=>{let B=f()[0],I=B===void 0?0:B.scrollTop,$=null;if(P>0)$=Z.find(V=>V.row*Ye>I+40)??null;else{for(let V of Z)V.row*Ye<=I+40&&($=V);$=$===null?null:Z[Z.indexOf($)-1]??null}if($===null)return;let j=Math.max(0,$.row*Ye-40),q=f();for(let V of q)V.scrollTop=j;let U=q[0]===void 0?j:q[0].scrollTop;ie(x(U))};if(r&&n===null)return e("div",{className:"gitp-diff"},e("div",{className:"gitp-center"},e(ue),e("div",{className:"gitp-center-hint"},t("diff.loading"))));if(n===null)return e("div",{className:"gitp-diff"},e(Me,{icon:e(A,{path:w.file,size:28}),title:t("empty.selectFile"),hint:t("empty.selectFileHint")}));let ee=bt(n.path),E={left:n.labels.left==="HEAD"?t("diff.head"):n.labels.left==="Staged"?t("diff.staged"):n.labels.left==="Local"?t("diff.local"):n.labels.left==="Parent"?t("diff.parent"):n.labels.left,right:n.labels.right==="Staged"?t("diff.staged"):n.labels.right==="Local"?t("diff.local"):n.labels.right==="Commit"?t("diff.commit"):n.labels.right==="Incoming"?t("action.acceptTheirs"):n.labels.right};return e("div",{className:"gitp-diff",ref:k},e("div",{className:"gitp-diff-head"},m&&v?e(ze,{label:t("action.back"),icon:w.left,onClick:v}):null,e("div",{className:"gitp-diff-title"},e("span",{className:Y("gitp-status",Ut(n.conflict?"C":"M"))},n.conflict?"C":"M"),e("div",{className:"gitp-diff-path"},ee.dir?e("span",{className:"gitp-diff-dir"},ee.dir):null,e("span",{className:"gitp-diff-base"},ee.base)),n.conflict?e("span",{className:"gitp-diff-pill is-conflict"},t("section.conflicts")):n.side==="staged"?e("span",{className:"gitp-diff-pill is-staged"},t("diff.staged")):n.side==="unstaged"?e("span",{className:"gitp-diff-pill is-unstaged"},t("diff.unstaged")):n.side==="log"?e("span",{className:"gitp-diff-pill is-commit"},t("diff.commit")):null),n.conflict?e("span",{className:"gitp-diff-stats gitp-del"},t("section.conflicts")):n.binary?e("span",{className:"gitp-diff-stats"},t("diff.binary")):e("span",{className:"gitp-diff-stats"},e("span",{className:"gitp-add"},`+${n.add??0}`),e("span",{className:"gitp-del"},`\u2212${n.del??0}`)),Z.length>0&&!n.conflict&&!n.binary?e("div",{className:"gitp-change-nav",role:"group","aria-label":t("diff.changes")},e(ze,{label:t("action.prevChange"),icon:w.chevronUp,onClick:()=>M(-1),disabled:!Q.canPrev}),e("span",{className:"gitp-change-count"},`${Math.max(0,Q.index)+1}/${Z.length}`),e(ze,{label:t("action.nextChange"),icon:w.chevron,onClick:()=>M(1),disabled:!Q.canNext})):null,e("div",{className:"gitp-diff-actions"},b!==void 0&&!n.binary?e(ze,{label:t("action.openEditor"),icon:w.code,onClick:()=>b(n)}):null,n.conflict?null:e("div",{className:"gitp-seg",role:"group","aria-label":t("diff.layout")},e("button",{type:"button",className:i==="split"?"is-active":"","aria-pressed":i==="split","aria-label":t("diff.split"),title:t("diff.split"),onClick:()=>s("split")},e(A,{path:w.split,size:13})),e("button",{type:"button",className:i==="unified"?"is-active":"","aria-pressed":i==="unified","aria-label":t("diff.unified"),title:t("diff.unified"),onClick:()=>s("unified")},e(A,{path:w.unified,size:13}))),R!==void 0?e(ze,{label:t("action.stash"),icon:w.stash,onClick:R,disabled:g}):null,h!==void 0?e(ze,{label:t("action.discard"),icon:w.trash,onClick:h,disabled:g}):null)),n.conflict?e("div",{className:"gitp-conflict-banner"},e(A,{path:w.warning,size:14}),e("span",{className:"gitp-conflict-text"},t(D===null?"diff.conflictBanner":"conflict.message")),e("div",{className:"gitp-conflict-actions"},e("button",{type:"button",className:"gitp-btn is-small",onClick:()=>d?.("ours"),disabled:g},H===null?t("action.acceptOurs"):t("conflict.take",{branch:H.ours})),e("button",{type:"button",className:"gitp-btn is-small",onClick:()=>d?.("theirs"),disabled:g},H===null?t("action.acceptTheirs"):t("conflict.take",{branch:H.theirs}))),H===null?D===null?null:e("div",{className:"gitp-conflict-sides"},t("conflict.externalSides")):e("div",{className:"gitp-conflict-sides"},H.kind==="rebase"?t("conflict.sidesRebase",{ours:H.ours,theirs:H.theirs}):t("conflict.sides",{ours:H.ours,theirs:H.theirs}))):null,n.binary?e("div",{className:"gitp-binary"},e("div",{className:"gitp-binary-title"},t("diff.binary")),e("div",null,t("diff.binaryHint",{before:n.leftSize??0,after:n.rightSize??0}))):n.conflict?e(Qi,{diff:n}):i==="unified"?e(na,{t,diff:n,tokens:se,onBlock:o,busy:g,selectionKey:l,renamed:c}):e(ea,{t,diff:n,labels:E,tokens:se,onBlock:o,busy:g,selectionKey:l,renamed:c}),!n.binary&&!n.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,Z.length===1?t("diff.blockCountOne"):t("diff.blockCount",{count:Z.length}))):null)}function Qi({diff:t}){return e("div",{className:"gitp-unified"},t.right.map((n,r)=>e("div",{className:Y("gitp-urow",/^(<{7}|={7}|>{7})/.test(n)&&"is-conflict-marker"),key:r},e("span",{className:"gitp-uno"},r+1),e("span",{className:"gitp-ucontent"},n||"\xA0"))))}function ea({t,diff:n,labels:r,tokens:i,onBlock:s,busy:o,selectionKey:d,renamed:g}){let l=G(null),c=G(null),m=G(null),v=G(null),b=G(null),h=G(null),[R,D]=Gi(),H=f=>{b.current!==null&&(b.current.style.flexGrow=String(f)),h.current!==null&&(h.current.style.flexGrow=String(1-f)),l.current!==null&&(l.current.style.flexGrow=String(f)),c.current!==null&&(c.current.style.flexGrow=String(1-f))};O(()=>{H(R)},[R]);let k=f=>{m.current&&(m.current.style.transform=`translateY(${-f}px)`)},Q=f=>{let x=f.scrollTop;l.current&&l.current!==f&&(l.current.scrollTop=x),c.current&&c.current!==f&&(c.current.scrollTop=x),k(x)};O(()=>{let f=n.blocks[0];if(!f||f.row<=10)return;let x=Math.max(0,f.row*Ye-80);l.current&&(l.current.scrollTop=x),c.current&&(c.current.scrollTop=x),k(x)},[d]);let ie=Ie(()=>{let f=new Map;for(let x of n.rows){if(x.k!=="mod"||x.l===null||x.r===null)continue;let M=n.left[x.l-1]??"",ee=n.right[x.r-1]??"";f.set(x,$i(M,ee))}return f},[n]),se=Ie(()=>{let f=new Map;for(let x of n.blocks)f.set(x.row,x);return f},[n]),Z=f=>{if(g)return[];let x={action:"unstaged",icon:w.left,label:t("action.stageBlock"),revert:!1},M={action:"revert",icon:w.right,label:t("action.revertBlock"),revert:!0};return n.side==="unstaged"?n.leftMissing?[x]:[x,M]:n.side==="staged"?[{action:"staged",icon:w.right,label:t("action.unstageBlock"),revert:!1}]:[]};return e("div",{className:"gitp-split",ref:v},e("div",{className:"gitp-pane-heads"},e("div",{className:"gitp-pane-head",ref:b},r.left),e("div",{className:"gitp-pane-head-gutter"}),e("div",{className:"gitp-pane-head",ref:h},r.right)),e("div",{className:"gitp-panes"},e("div",{className:"gitp-pane",ref:l,tabIndex:0,role:"region","aria-label":r.left,onScroll:f=>Q(f.currentTarget)},n.rows.map((f,x)=>{let M=f.l?n.left[f.l-1]??"":"",ee=f.k==="add"?"blank":f.k==="mod"?"del":f.k,E=ie.get(f);return e("div",{className:Y("gitp-line",ee!=="ctx"&&`is-${ee}`),key:`l${x}`},e("span",{className:"gitp-ln"},f.l??""),e("span",{className:"gitp-code"},f.l===null?"\xA0":Gt(Wt(i.left,f.l),M,E?{from:E.lPre.length,to:E.lPre.length+E.lMid.length}:null)))})),e("div",{className:"gitp-gutter","aria-hidden":!1},e("div",{className:"gitp-gutter-inner",ref:m},n.blocks.map(f=>{let x=Z(f);return x.length===0?null:e("div",{className:"gitp-arrows",key:f.id,style:{top:f.row*Ye}},x.map(M=>e("button",{type:"button",className:Y("gitp-arrow",M.revert&&"is-revert"),key:M.action,"aria-label":M.label,title:M.label,disabled:o,onClick:()=>s(f,M.action)},e(A,{path:M.icon,size:12}))))}))),e(ta,{label:t("split.panes"),wrapRef:v,ratio:R,onChange:D,onDrag:H}),e("div",{className:"gitp-pane",ref:c,tabIndex:0,role:"region","aria-label":r.right,onScroll:f=>Q(f.currentTarget)},n.rows.map((f,x)=>{let M=f.r?n.right[f.r-1]??"":"",ee=f.k==="del"?"blank":f.k==="mod"?"add":f.k,E=ie.get(f);return e("div",{className:Y("gitp-line",ee!=="ctx"&&`is-${ee}`),key:`r${x}`},e("span",{className:"gitp-ln"},f.r??""),e("span",{className:"gitp-code"},f.r===null?"\xA0":Gt(Wt(i.right,f.r),M,E?{from:E.rPre.length,to:E.rPre.length+E.rMid.length}:null)))}))))}function ta({label:t,wrapRef:n,ratio:r,onChange:i,onDrag:s}){let o=G(null),d=()=>{let l=n.current;return l===null?0:Math.round(l.getBoundingClientRect().width)},g=l=>Oi(l,d());return O(()=>()=>{o.current=null,document.body.style.cursor="",document.body.style.userSelect=""},[]),e("div",{className:"gitp-resizer gitp-pane-resizer",role:"separator","aria-orientation":"vertical","aria-label":t,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(r*100),tabIndex:0,onPointerDown(l){l.button===0&&(o.current={x:l.clientX,ratio:r,next:r},l.currentTarget.setPointerCapture(l.pointerId),document.body.style.cursor="col-resize",document.body.style.userSelect="none",l.preventDefault())},onPointerMove(l){let c=o.current;if(c===null)return;let m=d()-Mn;if(m<=0)return;let v=g(c.ratio+(l.clientX-c.x)/m);v!==c.next&&(c.next=v,s(v),l.currentTarget.setAttribute("aria-valuenow",String(Math.round(v*100))))},onPointerUp(l){let c=o.current;c!==null&&(o.current=null,l.currentTarget.hasPointerCapture(l.pointerId)&&l.currentTarget.releasePointerCapture(l.pointerId),document.body.style.cursor="",document.body.style.userSelect="",i(c.next))},onPointerCancel(){o.current=null,document.body.style.cursor="",document.body.style.userSelect=""},onDoubleClick(){i(g(jt))},onKeyDown(l){if(l.key==="ArrowLeft"||l.key==="ArrowRight"){l.preventDefault(),i(g(r+(l.key==="ArrowRight"?fn:-fn)));return}l.key==="Home"&&(l.preventDefault(),i(g(jt)))}})}function na({t,diff:n,tokens:r,onBlock:i,busy:s,selectionKey:o,renamed:d}){let g=Ie(()=>{let m=new Map;for(let b of n.blocks)m.set(b.row,b);let v=[];return n.rows.forEach((b,h)=>{let R=m.get(h),D=b.l===null?"":n.left[b.l-1]??"",H=b.r===null?"":n.right[b.r-1]??"";b.k==="ctx"?v.push({l:b.l,r:b.r,text:D,kind:"ctx",block:R}):b.k==="mod"?(v.push({l:b.l,r:null,text:D,kind:"del",block:R}),v.push({l:null,r:b.r,text:H,kind:"add"})):b.k==="del"?v.push({l:b.l,r:null,text:D,kind:"del",block:R}):v.push({l:null,r:b.r,text:H,kind:"add",block:R})}),v},[n]),l=G(null);O(()=>{let m=g.find(v=>v.block!==void 0);!m||g.indexOf(m)<=10||l.current===null||(l.current.scrollTop=Math.max(0,g.indexOf(m)*Ye-80))},[o]);let c=m=>{if(d)return[];let v={action:"unstaged",icon:w.left,label:t("action.stageBlock"),revert:!1},b={action:"revert",icon:w.right,label:t("action.revertBlock"),revert:!0};return n.side==="unstaged"?n.leftMissing?[v]:[v,b]:n.side==="staged"?[{action:"staged",icon:w.right,label:t("action.unstageBlock"),revert:!1}]:[]};return e("div",{className:"gitp-unified",ref:l,tabIndex:0,role:"region","aria-label":t("diff.unified")},g.map((m,v)=>{let b=m.block?c(m.block):[];return e("div",{className:Y("gitp-urow",m.kind!=="ctx"&&`is-${m.kind}`),key:v},e("span",{className:"gitp-uarrows"},b.map(h=>e("button",{type:"button",className:Y("gitp-arrow",h.revert&&"is-revert"),key:h.action,"aria-label":h.label,title:h.label,disabled:s,onClick:()=>{m.block!==void 0&&i(m.block,h.action)}},e(A,{path:h.icon,size:12})))),e("span",{className:"gitp-uno"},m.l??""),e("span",{className:"gitp-uno"},m.r??""),e("span",{className:"gitp-ucontent"},Gt(Wt(m.l!==null?r.left:r.right,m.l??m.r),m.text,null)))}))}function ia({t,busy:n,canUse:r,canBranch:i,onWrite:s,onBranch:o,onClose:d}){let g=G(d);g.current=d;let l=G(null);O(()=>{let m=b=>{b.key==="Escape"&&(b.preventDefault(),b.stopPropagation(),g.current())},v=b=>{let h=b.target;l.current!==null&&h instanceof Node&&l.current.contains(h)||h instanceof Element&&h.closest(".gitp-ai-wrap")!==null||g.current()};return document.addEventListener("keydown",m,!0),document.addEventListener("mousedown",v,!0),()=>{document.removeEventListener("keydown",m,!0),document.removeEventListener("mousedown",v,!0)}},[]);let c=(m,v,b,h,R)=>e("button",{type:"button",key:m,className:"gitp-popover-row",role:"menuitem",disabled:h,onClick:R},e(A,{path:v,size:13}),e("span",{className:"gitp-popover-row-text"},b));return e("div",{className:"gitp-popover is-menu",ref:l,role:"menu","aria-label":t("ai.action")},c("write",w.sparkles,t("ai.write"),!r||n,s),c("branch",w.branch,t("ai.branch"),!i||n,o))}function aa({t,workspaceTitle:n,branch:r,repo:i,ahead:s,behind:o,upstream:d,onBranchMenu:g,onRepoMenu:l,repos:c,repoRoot:m,onSync:v,busy:b,onRefresh:h,syncing:R}){let D=r?.name??(r?.oid?Se(r.oid):t(i===!1?"empty.noRepo":"status.detached")),H=c.find(Z=>Z.root===m)??null,k=c[0],Q=c.length>1||k!==void 0&&c.length===1&&k.name!=="."&&!k.name.startsWith(".."),ie=H===null?t("repo.none"):H.name==="."?t("repo.workspace"):H.label??H.name,se=H?.worktree===!0;return e("div",{className:"gitp-head"},e("div",{className:"gitp-head-left"},e("span",{className:"gitp-repo"},n),Q?e("button",{type:"button",className:"gitp-branch gitp-repo-pick",onClick:l,"aria-haspopup":"listbox","aria-label":t("repo.pick"),title:t("repo.pick")},e(A,{path:w.folder,size:13}),e("span",{className:"gitp-branch-name"},ie),e("span",{className:"gitp-chevron"},e(A,{path:w.chevron,size:11}))):null,e("button",{type:"button",className:"gitp-branch",onClick:g,disabled:i===!1,"aria-haspopup":"dialog","aria-label":t("branch.menuTitle"),title:t("branch.menuTitle")},e(A,{path:w.branch,size:13}),e("span",{className:"gitp-branch-name"},D),e("span",{className:"gitp-chevron"},e(A,{path:w.chevron,size:11}))),se?e("span",{className:"gitp-worktree",title:m??void 0},t("repo.worktree")):null),e("div",{className:"gitp-head-right"},e(Lt,{label:t("action.fetch"),icon:w.fetch,count:0,onClick:()=>v("fetch"),busy:R==="fetch",disabled:b}),e(Lt,{label:t("action.pull"),icon:w.pull,count:o,onClick:()=>v("pull"),busy:R==="pull",disabled:b||d===null}),e(Lt,{label:t("action.push"),icon:w.push,count:s,onClick:()=>v("push"),busy:R==="push",disabled:b}),e(ze,{label:t("action.refresh"),icon:w.refresh,onClick:h,disabled:b})))}function ra({t,kind:n,source:r,current:i,unresolved:s,busy:o,onContinue:d,onSkip:g,onAbort:l}){let c=r!==null&&i!==null?n==="merge"?t("op.merge",{source:r,branch:i}):t("op.rebase",{branch:i,source:r}):t(n==="merge"?"op.mergeGeneric":"op.rebaseGeneric"),m=s>0?e(ve.default.Fragment,null,e("span",{className:"is-bad"},s===1?t("op.unresolvedCountOne"):t("op.unresolvedCountMany",{count:s}))," ",t(n==="rebase"?"op.resolveSkipTail":"op.resolveTail")):e(ve.default.Fragment,null,e("span",{className:"is-ok"},t("op.allResolved"))," ",t(n==="merge"?"op.readyMergeTail":"op.readyRebaseTail"));return e("div",{className:"gitp-opbanner",role:"region","aria-label":c},e("span",{className:"gitp-opbanner-icon"},e(A,{path:n==="merge"?w.merge:w.rebase,size:15})),e("div",{className:"gitp-opbanner-main"},e("div",{className:"gitp-opbanner-title"},c),e("div",{className:"gitp-opbanner-meta","aria-live":"polite"},m)),e("div",{className:"gitp-opbanner-actions"},e("button",{type:"button",className:"gitp-btn is-primary is-small","aria-label":t("op.continue"),title:s>0?t("op.continueBlocked"):t("op.continueHint"),disabled:o||s>0,onClick:d},o?e(ue):null,t("op.continue")),n==="rebase"?e("button",{type:"button",className:"gitp-btn is-small","aria-label":t("op.skip"),title:t("op.skipHint"),disabled:o,onClick:g},t("op.skip")):null,e("button",{type:"button",className:"gitp-btn is-small is-abort","aria-label":t("op.abort"),title:t("op.abortHint",{operation:t(n==="merge"?"operation.merge":"operation.rebase")}),disabled:o,onClick:l},t("op.abort"))))}function oa({t,mode:n,onMode:r,counts:i}){let s=[{id:"changes",label:t("mode.changes"),count:i.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:Y("gitp-rail-item",n===o.id&&"is-active"),onClick:()=>r(o.id),"aria-label":o.count>0?`${o.label}, ${o.count}`:o.label,"aria-current":n===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 sa({t,repos:n,current:r,onPick:i,onInitRoot:s,onClose:o}){let d=G(null),g=G(o);g.current=o,O(()=>{d.current?.querySelector("button:not(:disabled)")?.focus();let c=m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),g.current())};return document.addEventListener("keydown",c,!0),()=>document.removeEventListener("keydown",c,!0)},[]);let l=!n.some(c=>!c.worktree&&(c.name==="."||c.name.startsWith("..")));return e("div",{className:"gitp-popover-layer",onMouseDown:c=>{c.target===c.currentTarget&&g.current()}},e("div",{className:"gitp-popover is-wide",ref:d,role:"listbox","aria-label":t("repo.title")},e("div",{className:"gitp-popover-title"},t("repo.title")),e("div",{className:"gitp-popover-list"},n.map(c=>e("button",{type:"button",key:c.root,className:Y("gitp-popover-row",c.worktree&&"is-nested"),role:"option","aria-selected":c.root===r,disabled:c.root===r,title:c.root,onClick:()=>i(c.root)},e(A,{path:c.worktree?w.branch:w.folder,size:13}),e("span",{className:"gitp-popover-row-text"},c.name==="."?t("repo.workspace"):c.label??c.name),c.worktree&&c.branch!==null?e("span",{className:"gitp-popover-hint"},c.branch):null,c.root===r?e(A,{path:w.check,size:13,className:"gitp-checkmark"}):null))),l?e(ve.default.Fragment,null,e("div",{className:"gitp-popover-sep"}),e("button",{type:"button",className:"gitp-popover-row",onClick:s},e(A,{path:w.plus,size:13}),e("span",{className:"gitp-popover-row-text"},t("repo.initRoot")))):null))}function la({t,branches:n,loading:r,busy:i,current:s,detached:o,blocked:d,onCheckout:g,onMerge:l,onRebase:c,onNew:m,onClose:v}){let b=G(null),h=G(null),R=G(v);R.current=v;let[D,H]=C(""),[k,Q]=C(null);O(()=>{let j=q=>{q.key==="Escape"&&(q.preventDefault(),q.stopPropagation(),R.current())};return document.addEventListener("keydown",j,!0),()=>document.removeEventListener("keydown",j,!0)},[]),O(()=>{k===null?b.current?.querySelector(".gitp-search")?.focus():h.current?.focus()},[k]);let ie=D.trim().toLowerCase(),se=n.filter(j=>!j.remote),Z=new Set(se.map(j=>j.name)),f=n.filter(j=>{if(!j.remote)return!1;let q=j.name.split("/").slice(1).join("/");return q!==""&&!Z.has(q)}),x=j=>ie===""||j.name.toLowerCase().includes(ie),M=se.filter(x),ee=f.filter(x),E=(j,q)=>j.map(U=>{let V=U.worktree!==null,z=U.current===!0,X=d??(V?t("branch.worktreeKind",{worktree:U.worktree??""}):z?t("branch.current"):null);return e("div",{className:"gitp-branch-row",key:`${q?"r":"l"}:${U.name}`},e("button",{type:"button",className:"gitp-popover-row gitp-branch-pick","aria-current":z?"true":void 0,disabled:i||z||V||d!==null,title:X??t("branch.checkout",{branch:U.name}),onClick:()=>g(U.name,q)},e(A,{path:w.branch,size:13}),e("span",{className:"gitp-popover-row-text"},U.name),d!==null&&!z?e("span",{className:"gitp-popover-hint"},d):V?e("span",{className:"gitp-popover-hint"},U.worktree??""):null,z?e(A,{path:w.check,size:13,className:"gitp-checkmark"}):null),z?null:e("button",{type:"button",className:"gitp-branch-actions","aria-label":t("branch.actionsFor",{branch:U.name}),title:t("branch.actionsFor",{branch:U.name}),disabled:i,onClick:()=>Q(U.name)},e(A,{path:w.more,size:14})))}),P=k===null?null:n.find(j=>j.name===k)??null,B=(j,q,U,V,z,X)=>e("button",{type:"button",className:"gitp-action-row","data-action":j,disabled:z!==null,title:z??V,onClick:X},e(A,{path:q,size:14}),e("div",{className:"gitp-action-text"},e("span",{className:"gitp-action-label"},U),z!==null||V!==""?e("span",{className:"gitp-action-reason"},z??V):null)),I=P===null?null:(()=>{let j=P.worktree!==null,q=P.current===!0,U=d??(j?t("branch.worktreeKind",{worktree:P.worktree??""}):q?t("branch.current"):null),V=d??(o||s===null?t("branch.detached"):null),z=j?t("branch.worktreeKind",{worktree:P.worktree??""}):P.remote?t("branch.remoteKind"):t("branch.localKind");return e("div",{className:"gitp-branch-pane"},e("div",{className:"gitp-branch-pane-head"},e("button",{type:"button",ref:h,className:"gitp-iconbtn","aria-label":t("action.back"),title:t("action.back"),onClick:()=>Q(null)},e(A,{path:w.left,size:15})),e("span",{className:"gitp-branch-pane-name",title:P.name},P.name)),e("div",{className:"gitp-branch-pane-meta"},z),e("div",{className:"gitp-popover-sep"}),B("checkout",w.branch,t("branch.checkout",{branch:P.name}),P.remote?t("branch.checkoutRemoteHint"):t("branch.checkoutHint"),U,()=>g(P.name,P.remote)),B("merge",w.merge,s===null?t("branch.mergeIntoCurrent"):t("branch.mergeInto",{branch:s}),s===null?"":t("branch.mergeHint",{branch:s}),V,()=>l(P.name,P.remote)),B("rebase",w.rebase,s===null?t("branch.rebaseCurrent",{source:P.name}):t("branch.rebaseOnto",{branch:s,source:P.name}),t("branch.rebaseHint",{source:P.name}),V,()=>c(P.name,P.remote)))})(),$=e(ve.default.Fragment,null,e("input",{className:"gitp-search",value:D,placeholder:t("branch.search"),onChange:j=>H(j.target.value),"aria-label":t("branch.search")}),e("button",{type:"button",className:"gitp-popover-row",disabled:i||d!==null,title:d??void 0,onClick:m},e(A,{path:w.plus,size:13}),e("span",{className:"gitp-popover-row-text"},t("branch.new"))),e("div",{className:"gitp-popover-sep"}),r?e("div",{className:"gitp-modal-sub"},t("branch.loading")):null,!r&&M.length===0&&ee.length===0?e("div",{className:"gitp-modal-sub"},t(ie===""?"branch.none":"branch.noneMatch")):null,M.length>0?e(ve.default.Fragment,null,e("div",{className:"gitp-popover-title"},t("branch.local")),e("div",{className:"gitp-popover-list"},E(M,!1))):null,ee.length>0?e(ve.default.Fragment,null,e("div",{className:"gitp-popover-title"},t("branch.remote")),e("div",{className:"gitp-popover-list"},E(ee,!0))):null);return e("div",{className:"gitp-popover-layer",onMouseDown:j=>{j.target===j.currentTarget&&R.current()}},e("div",{className:"gitp-popover is-wide",ref:b,role:"dialog","aria-label":t(I===null?"branch.menuTitle":"branch.actions")},I===null?$:I))}function ca({t,busy:n,error:r,onCreate:i,onClose:s}){let[o,d]=C("");return e(at,{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:g=>d(g.target.value),spellCheck:!1,autoComplete:"off"}),e("div",{className:"gitp-field-hint"},t("branch.newHint"))),r?e("div",{className:"gitp-modal-error"},r):null,e("div",{className:"gitp-modal-actions"},e("button",{type:"button",className:"gitp-btn",onClick:s,disabled:n},t("action.cancel")),e("button",{type:"button",className:"gitp-btn is-primary",disabled:n||o.trim()==="",onClick:()=>i({name:o.trim()})},n?e(ue):null,t("action.createAndSwitch"))))}function da(t,n,r,i){let s=n?.branch??null,o=n?.merging===!0||n?.rebasing===!0||n?.reverting===!0||n?.cherryPicking===!0,d=(n?.conflicts?.length??0)>0,g=(n?.entries??[]).some(R=>R.staged),l=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,v=(t.parents?.length??0)>1,b=[];b.push({id:"copy",label:i("history.copy"),icon:w.copy,hint:null,reason:null});let h=null;return o?h=i("history.blockedOperation"):l?h=i("history.blockedDetached"):c?(t.parents?.length??0)===0?h=i("history.blockedNoParent"):m&&(h=i("history.blockedPushed")):h=i("history.blockedNotHead"),b.push({id:"undo",label:i("history.undo"),icon:w.undo,hint:i("history.undoHint"),reason:h}),h=null,o?h=i("history.blockedOperation"):v?h=i("history.blockedMerge"):d?h=i("history.blockedConflict"):g&&(h=i("history.blockedStaged")),b.push({id:"revert",label:i("history.revert"),icon:w.revert,hint:i("history.revertHint"),reason:h}),h=null,o?h=i("history.blockedOperation"):v?h=i("history.blockedMerge"):d?h=i("history.blockedConflict"):r.has(t.hash)&&(h=i("history.blockedContained")),b.push({id:"cherry",label:i("history.cherryPick"),icon:w.cherry,hint:i("history.cherryPickHint"),reason:h}),h=null,o?h=i("history.blockedOperation"):l&&(h=i("history.blockedDetached")),b.push({id:"reset",label:i("history.reset"),icon:w.reset,hint:i("history.resetHint"),reason:h}),b}function pa({t,commit:n,rows:r,busy:i,onPick:s,onClose:o}){let d=G(null),g=G(o),l=G(null);return g.current=o,O(()=>{l.current=document.activeElement instanceof HTMLElement?document.activeElement:null,d.current?.querySelector("button:not(:disabled)")?.focus();let c=m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),g.current())};return document.addEventListener("keydown",c,!0),()=>{document.removeEventListener("keydown",c,!0),l.current&&typeof l.current.focus=="function"&&l.current.focus()}},[]),e("div",{className:"gitp-popover-layer",onMouseDown:c=>{c.target===c.currentTarget&&g.current()}},e("div",{className:"gitp-popover is-wide",ref:d,role:"menu","aria-label":t("history.actions")},e("div",{className:"gitp-popover-title"},t("history.actions")),e("div",{className:"gitp-popover-blurb",title:n.subject},`${Se(n.hash)} \xB7 ${n.subject}`),e("div",{className:"gitp-popover-sep"}),r.map(c=>e("button",{type:"button",key:c.id,className:"gitp-action-row",role:"menuitem",disabled:i||c.reason!==null,title:c.reason??c.hint??void 0,onClick:()=>s(c.id)},e(A,{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 ua({t,commit:n,busy:r,error:i,onReset:s,onClose:o}){let[d,g]=C("soft"),l=[["soft","history.resetModeSoft","history.resetModeSoftHint"],["mixed","history.resetModeMixed","history.resetModeMixedHint"],["hard","history.resetModeHard","history.resetModeHardHint"]];return e(at,{title:t("history.resetTitle"),onClose:o,danger:d==="hard"},e("div",{className:"gitp-modal-sub"},t("history.resetBody",{hash:Se(n.hash)})),e("div",{role:"radiogroup","aria-label":t("history.resetTitle")},l.map(([c,m,v])=>e("label",{key:c,className:"gitp-reset-mode"},e("input",{type:"radio",name:"gitp-reset-mode",value:c,checked:d===c,disabled:r,onChange:()=>g(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(v)))))),d==="hard"?e("div",{className:"gitp-modal-warn",role:"alert"},t("history.resetHardWarning")):null,i!==null?e("div",{className:"gitp-modal-error"},i):null,e("div",{className:"gitp-modal-actions"},e("button",{type:"button",className:"gitp-btn",onClick:o,disabled:r},t("action.cancel")),e("button",{type:"button",className:Y("gitp-btn",d==="hard"?"is-danger":"is-primary"),onClick:()=>s(d),disabled:r},r?e(ue):null,t("history.resetAction"))))}function ga({call:t,workspaceId:n,repo:r,t:i,refreshToken:s,compact:o,layout:d,onLayout:g,snapshot:l,onApplied:c}){let[m,v]=C(null),[b,h]=C(null),[R,D]=C(null),[H,k]=C(null),[Q,ie]=C(null),[se,Z]=C(!1),[f,x]=C(!1),[M,ee]=C(!1),[E,P]=C(null),[B,I]=C(!1),[$,j]=Pn(),[q,U]=C(null),[V,z]=C(null),[X,we]=C(null),[le,We]=C(null),[Te,Ne]=C(null),[Ce,Pe]=C(null),Le=G(null),rt=G(null),Oe=G(r),ot=y=>{navigator?.clipboard?.writeText&&(navigator.clipboard.writeText(y).catch(()=>{}),I(!0),setTimeout(()=>I(!1),2e3))};O(()=>{if(Ce===null)return;let y=setTimeout(()=>Pe(null),4e3);return()=>clearTimeout(y)},[Ce]),O(()=>{U(null),z(null),we(null),We(null)},[r]),O(()=>{Oe.current!==r&&(Oe.current=r,h(null),D(null),k(null),ie(null))},[r]),O(()=>{let y=!0,T=new AbortController;return Z(!0),t("log",{workspaceId:n,repo:r},T.signal).then(K=>{if(!y)return;let W=Vi(K.commits??[]);v(W);let re=W[0];re!==void 0&&h(J=>J??re.hash)}).catch(K=>{let W=ne(K);y&&W.name!=="AbortError"&&P(W)}).finally(()=>{y&&Z(!1)}),()=>{y=!1,T.abort()}},[n,r,s]),O(()=>{if(!b){D(null);return}let y=!0,T=new AbortController;return x(!0),t("commitDetail",{workspaceId:n,repo:r,hash:b},T.signal).then(K=>{if(y){D(K);let W=K.files[0];!o&&W!==void 0?k(re=>re!==null&&K.files.some(J=>J.path===re)?re:W.path):o&&k(null),ie(null)}}).catch(K=>{let W=ne(K);y&&W.name!=="AbortError"&&P(W)}).finally(()=>{y&&x(!1)}),()=>{y=!1,T.abort()}},[n,r,b,o]),O(()=>{if(!H||!R){ie(null);return}let y=!0,T=new AbortController;return ee(!0),t("diff",{workspaceId:n,repo:r,path:H,side:"log",commit:R.hash,parent:R.parents?.[0]},T.signal).then(K=>{y&&ie(K)}).catch(K=>{let W=ne(K);y&&W.name!=="AbortError"&&P(W)}).finally(()=>{y&&ee(!1)}),()=>{y=!1,T.abort()}},[n,r,H,R]);let je=Ie(()=>{let y=new Map;for(let re of m??[])y.set(re.hash,re.parents);let T=new Set,K=[],W=l?.branch?.oid;for(typeof W=="string"&&W!==""&&K.push(W);K.length>0;){let re=K.pop();if(re===void 0)break;if(!T.has(re)){T.add(re);for(let J of y.get(re)??[])K.push(J)}}return T},[m,l?.branch?.oid]),st=q===null?[]:da(q,l,je,i);async function Ge(y){Ne("undo");try{let T=await t("undoCommit",{workspaceId:n,repo:r,hash:y.hash});z(null),c({status:T.status,message:T.message,goToChanges:!0,toast:i("history.undone")})}catch(T){z(null),Pe({text:ye(T),error:!0}),c({})}finally{Ne(null)}}async function He(y){Ne("revert");try{let T=await t("revertCommit",{workspaceId:n,repo:r,hash:y.hash});z(null),c({status:T.status,message:T.message,goToChanges:!0,toast:i(T.conflicted?"history.revertConflicts":"history.reverted")})}catch(T){z(null),Pe({text:ye(T),error:!0}),c({})}finally{Ne(null)}}async function Je(y){Ne("cherry");try{let T=await t("cherryPickCommit",{workspaceId:n,repo:r,hash:y.hash});Pe({text:i("history.picked",{hash:Se(T.hash)}),error:!1}),c({status:T.status})}catch(T){Pe({text:ye(T),error:!0}),c({})}finally{Ne(null)}}async function Ee(y,T){Ne("reset"),We(null);try{let K=await t("resetToCommit",{workspaceId:n,repo:r,hash:y.hash,mode:T,confirm:!0});we(null),Pe({text:i("history.resetDone",{hash:Se(y.hash)}),error:!1}),c({status:K.status})}catch(K){We(ye(K))}finally{Ne(null)}}function _(y){let T=q;if(T!==null){if(y==="copy"){ot(T.hash),U(null),Pe({text:i("action.copied"),error:!1});return}U(null),y==="undo"?z({type:"undo",commit:T}):y==="revert"?z({type:"revert",commit:T}):y==="cherry"?Je(T):y==="reset"&&we(T)}}if(se&&m===null)return e(Me,{icon:e(ue),title:i("log.loading")});if(m===null&&E!==null)return e(Me,{icon:e(A,{path:w.warning,size:28}),title:i("error.title"),hint:ye(E)});if(m!==null&&m.length===0)return e(Me,{icon:e(A,{path:w.history,size:28}),title:i("empty.noHistory"),hint:i("empty.noHistoryHint")});let me=!o||!H,ce=!o||!!H;return e("div",{className:"gitp-changes",ref:Le},me?e("div",{className:"gitp-listcol",ref:rt,style:o?void 0:{width:`${$}px`}},e("div",{className:"gitp-loglist"},E?e("div",{className:"gitp-error"},e("span",{className:"gitp-error-text"},ye(E))):null,(m??[]).map(y=>e("button",{type:"button",key:y.hash,className:Y("gitp-commitrow",b===y.hash&&"is-selected"),onClick:()=>h(y.hash),onContextMenu:T=>{T.preventDefault(),h(y.hash),U(y)},"aria-haspopup":"menu"},e("span",{className:"gitp-graph",style:{width:Math.max(14,y.laneCount*10+8)}},e("span",{className:"gitp-graph-line",style:{left:6+y.lane*10}}),e("span",{className:Y("gitp-graph-dot",y.lane%4?`g${y.lane%4}`:""),style:{left:6+y.lane*10}})),e("span",{className:"gitp-commitmain"},e("div",{className:"gitp-commit-subject"},y.subject),e("div",{className:"gitp-commit-meta"},e("span",null,y.author),e("span",null,"\xB7"),e("span",null,xn(y.date))),y.refs.length>0?e("div",{className:"gitp-refs"},y.refs.map(T=>e("span",{key:T,className:Y("gitp-ref",T.startsWith("HEAD")&&"is-head")},T.replace(/^HEAD -> /,"")))):null)))),e("div",{className:"gitp-logdetail-summary"},f&&R===null?e("div",{className:"gitp-center",style:{padding:"24px"}},e(ue)):R===null?e(Me,{title:i("log.select")}):e(ve.default.Fragment,null,e("div",{className:"gitp-detail-head"},e("div",{className:"gitp-detail-title"},e("div",{className:"gitp-detail-subject"},R.subject),e(ze,{label:i("history.actions"),icon:w.more,disabled:Te!==null,onClick:()=>U({hash:R.hash,parents:R.parents??[],subject:R.subject})})),e("div",{className:"gitp-detail-meta"},e("button",{type:"button",className:"gitp-detail-hash-btn",onClick:()=>ot(R.hash),title:i(B?"action.copied":"action.copyHash")},Se(R.hash),e(A,{path:B?w.check:w.copy,size:11})),e("span",null,R.author),e("span",null,xn(R.date)))),R.body?e("div",{className:"gitp-detail-body"},R.body):null,e("div",{className:"gitp-detail-section-head"},e("span",null,i("log.files")),e("span",{className:"gitp-section-count"},String(R.files?.length??0))),e("div",{className:"gitp-detail-files"},!R.files||R.files.length===0?e("div",{className:"gitp-center-hint",style:{padding:"4px 8px"}},i("log.noFiles")):R.files.map(y=>{let T=bt(y.path);return e("button",{type:"button",key:y.path,className:Y("gitp-detail-file",H===y.path&&"is-selected"),onClick:()=>k(y.path)},e("span",{className:Y("gitp-status",Ut("M"))},"M"),e("span",{className:"gitp-filename"},T.dir?e("span",{className:"gitp-filedir"},T.dir):null,T.base),y.binary?e("span",{className:"gitp-delta"},i("meta.binary")):e("span",{className:"gitp-delta"},y.add!==null&&y.add>0?e("span",{className:"gitp-add"},`+${y.add}`):null,y.del!==null&&y.del>0?e("span",{className:"gitp-del"},`\u2212${y.del}`):null))}))))):null,me&&ce?e(An,{label:i("split.commits"),containerRef:Le,columnRef:rt,width:$,onChange:j}):null,ce?e("div",{className:"gitp-diffcol"},H?e(Dn,{t:i,diff:Q,loading:M,layout:d,onLayout:g,onBlock:()=>{},busy:!0,selectionKey:`${R?.hash??""}:${H}`,compact:o,onBack:o?()=>k(null):void 0,operation:null,sides:null}):e(Me,{icon:e(A,{path:w.changes,size:28}),title:i("empty.selectFile"),hint:i("empty.selectFileHint")})):null,q?e(pa,{t:i,commit:q,rows:st,busy:Te!==null,onPick:_,onClose:()=>U(null)}):null,V?e(Vt,{title:i(V.type==="undo"?"history.undoTitle":"history.revertTitle"),body:i(V.type==="undo"?"history.undoBody":"history.revertBody"),confirmLabel:i(V.type==="undo"?"history.undoAction":"history.revertAction"),cancelLabel:i("action.cancel"),busy:Te!==null,onConfirm:()=>V.type==="undo"?Ge(V.commit):He(V.commit),onClose:()=>{Te===null&&z(null)}}):null,X?e(ua,{t:i,commit:X,busy:Te==="reset",error:le,onReset:y=>Ee(X,y),onClose:()=>{Te===null&&(we(null),We(null))}}):null,Ce?e("div",{className:Y("gitp-toast",Ce.error&&"is-error"),role:"status","aria-live":"polite"},Ce.text):null)}function ha({call:t,workspaceId:n,repo:r,t:i,snapshot:s,onStatus:o,refreshToken:d}){let[g,l]=C(null),[c,m]=C(null),[v,b]=C(!1),[h,R]=C(null),[D,H]=C(null),[k,Q]=C(null),[ie,se]=C(null),Z=G(r);O(()=>{Z.current!==r&&(Z.current=r,l(null))},[r]);let f=Rt(async E=>{try{let P=await t("stashList",{workspaceId:n,repo:r},E);l(P.stashes??[]),m(null)}catch(P){let B=ne(P);B.name!=="AbortError"&&m(B)}},[n,r,t]);O(()=>{let E=new AbortController;return f(E.signal),()=>E.abort()},[f,d]),O(()=>{if(ie===null)return;let E=setTimeout(()=>se(null),4e3);return()=>clearTimeout(E)},[ie]);let x=(s?.entries??[]).filter(E=>(E.staged||E.unstaged)&&!E.conflicted);async function M({paths:E,message:P}){R("create"),H(null);try{let B=await t("stashPush",{workspaceId:n,repo:r,paths:E,message:P,includeUntracked:E.some(I=>x.find($=>$.path===I)?.untracked===!0)});o(B.status),l(B.stashes??[]),b(!1),se(i("stash.created",{count:E.length}))}catch(B){H(ye(B))}finally{R(null)}}async function ee(E,P,B){R(E+P),m(null);try{let I=await t(E==="drop"?"stashDrop":"stashApply",{workspaceId:n,repo:r,ref:P,pop:B});o(I.status),l(I.stashes??[]),se(E==="drop"?i("stash.dropped",{ref:P}):i(B?"stash.popped":"stash.applied",{ref:P})),Q(null)}catch(I){m(ne(I))}finally{R(null)}}return e("div",{className:"gitp-stash"},e("div",{className:"gitp-stash-head"},e("div",{className:"gitp-stash-title"},e("span",null,i("mode.stash")),g?.length?e("span",{className:"gitp-section-count"},String(g.length)):null),e("button",{type:"button",className:"gitp-btn is-small is-primary",onClick:()=>b(!0),disabled:x.length===0},e(A,{path:w.plus,size:12}),i("action.stash"))),c?e("div",{className:"gitp-error"},e("span",{className:"gitp-error-text"},ye(c))):null,g===null?e("div",{className:"gitp-center"},e(ue)):g.length===0?e(Me,{icon:e(A,{path:w.stash,size:28}),title:i("empty.noStashes"),hint:i("empty.noStashesHint"),action:x.length>0?e("button",{type:"button",className:"gitp-btn is-primary is-small",onClick:()=>b(!0)},e(A,{path:w.plus,size:12}),i("action.stash")):null}):e("div",{className:"gitp-stashlist"},g.map(E=>e("div",{className:"gitp-stashrow",key:E.ref},e("div",{className:"gitp-stash-main"},e("div",{className:"gitp-stash-msg"},E.message||"WIP"),e("div",{className:"gitp-stash-meta"},e("span",{className:"gitp-stash-ref"},E.ref),e("span",null,"\xB7"),e("span",null,Se(E.hash)))),e("div",{className:"gitp-stash-actions"},e("button",{type:"button",className:"gitp-btn is-small",onClick:()=>ee("apply",E.ref,!1),disabled:h!==null,title:i("stash.applyHint")},h==="apply"+E.ref?e(ue):null,i("action.apply")),e("button",{type:"button",className:"gitp-btn is-small",onClick:()=>ee("apply",E.ref,!0),disabled:h!==null,title:i("stash.popHint")},h==="apply"+E.ref?e(ue):null,i("action.pop")),e("button",{type:"button",className:"gitp-btn is-small gitp-stash-btn-danger","aria-label":i("action.drop"),onClick:()=>Q(E.ref),disabled:h!==null,title:i("stash.dropHint")},i("action.drop")))))),v?e(En,{t:i,files:x,busy:h==="create",error:D,onCreate:M,onClose:()=>{b(!1),H(null)}}):null,k?e(Vt,{title:i("stash.dropTitle"),body:i("stash.dropBody",{ref:k}),confirmLabel:i("action.drop"),cancelLabel:i("action.cancel"),danger:!0,busy:h==="drop"+k,onConfirm:()=>ee("drop",k,!1),onClose:()=>Q(null)}):null,ie?e("div",{className:"gitp-toast",role:"status","aria-live":"polite"},ie):null)}function ma(t){let n=t?.projectionValues?.workingDirectory;if(typeof n=="string"&&n.trim()!=="")return n.trim();let r=t?.cwd;return typeof r=="string"&&r!==""?r:null}function fa(t,n,r){let i=typeof t.sessionRoot=="string"?t.sessionRoot:null;if(t.worktree===!0&&i!==null){let d=n.find(g=>g.root===i);if(d!==void 0)return d}let s=n.find(d=>d.root===r);return s!==void 0?s:(i===null?void 0:n.find(d=>d.root===i))??n[0]??null}function ba(t){let n=typeof t.sessionRoot=="string"?t.sessionRoot:"";return`${t.worktree===!0?"worktree":"checkout"}:${n}`}function va({call:t,t:n,useWorkspaces:r,useSessions:i,sessionId:s,useTabInfo:o,sidebarRight:d}){let{tab:g}=o(),l=Cn(s).set;O(()=>{l(g.visible===!0)},[l,g.visible]),O(()=>()=>{l(!1)},[l]),O(()=>{Kt={visible:g.visible===!0,canStageAll:()=>fe.length>0&&x===null,stageAll:()=>_t("unstaged"),canCommit:()=>de&&x===null,commit:()=>Yt(),canWriteMessage:()=>F.length>0&&x===null&&!He,writeMessage:()=>Zt()}}),O(()=>()=>{Kt=null},[]);let c=r(a=>a.items),m=i(a=>a.byId[s]),v=ma(m),b=c.find(a=>a.sessionIds?.includes(s))??c.find(a=>m?.cwd!==void 0&&(m.cwd===a.path||m.cwd.startsWith(`${a.path}/`)))??null,h=b===null?"":b.workspaceId,R=G(null),[D,H]=C(!1),[k,Q]=C(null),[ie,se]=C(!1),[Z,f]=C(null),[x,M]=C(null),[ee,E]=C(null),[P,B]=C("changes"),[I,$]=C(""),[j,q]=C(!1),[U,V]=C(!1),[z,X]=C(null),[we,le]=C(null),[We,Te]=C(!1),[Ne,Ce]=C(0),[Pe,Le]=C(()=>mt(pn,"split")==="unified"?"unified":"split"),[rt,Oe]=C(()=>mt(un,"split")==="unified"?"unified":"split"),[ot,je]=C(!1),[st,Ge]=C(!1),[He,Je]=C(!1),[Ee,_]=C(null),[me,ce]=C(null),[y,T]=C(!1),[K,W]=C(null),[re,J]=C(null),[De,xe]=C(null),[be,ge]=C(null),[Be,ke]=C(null),[Ze,Ke]=C(!1),[$e,Qe]=C(0),[Ue,et]=C([]),[L,Fe]=C(null),Mt=a=>{if(L===null||d===void 0)return;let u=Hi(a),N=Pi(s,m===void 0?void 0:m.cwd,`${L}/${a.path}`);d.openResource(N,{params:{line:u}})},[Tt,lt]=C(0),[vt,tt]=C(!1),[ct,Ve]=C(!1),_e=G(0),dt=G(null);O(()=>{let a=R.current;if(a===null||typeof ResizeObserver>"u")return;let u=0,N=new ResizeObserver(oe=>{u&&cancelAnimationFrame(u),u=requestAnimationFrame(()=>{u=0;let Re=oe[0]?.contentRect.width??0;H(Re>0&&Re<900)})});return N.observe(a),()=>{N.disconnect(),u&&cancelAnimationFrame(u)}},[b?.workspaceId]);let te=Rt(a=>{!a||!Array.isArray(a.entries)||(_e.current+=1,Q(a),!a.merging&&!a.rebasing&&ke(null))},[]),he=Rt(async(a,u)=>{if(!b||L===null)return;let N=++_e.current;u||se(!0);try{let oe=await t("status",{workspaceId:h,repo:L,sessionDir:v},a);N===_e.current&&(dt.current=null,Q(oe),!oe.merging&&!oe.rebasing&&ke(null),Array.isArray(oe.repos)&&oe.repos.length>0&&et(oe.repos),f(null))}catch(oe){let Re=ne(oe);if(Re.name==="AbortError"||N!==_e.current)return;let ut=dn(oe);if(ut==="git/not-repo"||ut==="git/repo-invalid"){if(dt.current===L){f(Re);return}dt.current=L,Xe(gt+h,""),Fe(null),Q(null),f(null),lt(Dt=>Dt+1);return}f(Re)}finally{N===_e.current&&se(!1)}},[b?.workspaceId,L,t,v]),yt=Rt(a=>{a?.status&&te(a.status),typeof a.message=="string"&&($(a.message),q(!1)),a?.goToChanges&&(X(null),le(null),B("changes")),a?.toast&&J(a.toast),Qe(u=>u+1),he(void 0,!1)},[te,he]),wt=G(null),pt=G(null),p=G(null);p.current=L,O(()=>{if(!b?.workspaceId)return;let a=h,u=wt.current!==a;u&&(wt.current=a,et([]),Fe(null),Q(null),ke(null),ge(null));let N=new AbortController;return(async()=>{try{let oe=await t("status",{workspaceId:a,sessionDir:v},N.signal);if(N.signal.aborted)return;let Re=Array.isArray(oe.repos)?oe.repos:[];et(Re);let ut=ba(oe),Dt=pt.current!==ut;if(pt.current=ut,!u&&!Dt&&p.current!==null)return;let kt=fa(oe,Re,mt(gt+a,""));kt?(Fe(kt.root),(oe.worktree!==!0||kt.root!==oe.sessionRoot)&&Xe(gt+a,kt.root)):Q(oe)}catch(oe){let Re=ne(oe);Re.name!=="AbortError"&&f(Re)}})(),()=>N.abort()},[b?.workspaceId,t,Tt,v]),O(()=>{if(L===null)return;let a=new AbortController;return he(a.signal,!1),()=>a.abort()},[L,he]),O(()=>{if(!b||L===null)return;let a=setInterval(()=>{document.visibilityState==="visible"&&he(void 0,!0)},8e3);return()=>clearInterval(a)},[b?.workspaceId,L,he]),O(()=>{let a=()=>he(void 0,!0);return window.addEventListener("focus",a),()=>window.removeEventListener("focus",a)},[he]),O(()=>{if(re===null)return;let a=setTimeout(()=>J(null),4e3);return()=>clearTimeout(a)},[re]);let S=k?.entries?.filter(a=>a.conflicted)??[],F=k?.entries?.filter(a=>a.staged&&!a.conflicted)??[],fe=k?.entries?.filter(a=>a.unstaged&&!a.conflicted)??[],de=F.length>0&&S.length===0&&I.trim()!==""&&k?.repo!==!1,ae=k?.merging===!0?"merge":k?.rebasing===!0?"rebase":null,Ae=Be!==null&&Be.kind===ae?Be:null,Pt=Ae===null||ae===null?null:ae==="merge"?{kind:"merge",ours:Ae.current,theirs:Ae.source}:{kind:"rebase",ours:Ae.source,theirs:Ae.current},nt=k?.merging===!0?n("branch.finishFirst",{operation:n("operation.merge")}):k?.rebasing===!0?n("branch.finishFirst",{operation:n("operation.rebase")}):k?.reverting===!0?n("branch.finishFirst",{operation:n("operation.revert")}):k?.cherryPicking===!0?n("branch.finishFirst",{operation:n("operation.cherryPick")}):null,Ht=z?`${z.side}:${z.path}:${z.commit??""}`:"",zn=z===null?!0:z.side==="staged"?k?.entries?.some(a=>a.path===z.path&&a.staged&&!a.conflicted):z.side==="unstaged"?k?.entries?.some(a=>a.path===z.path&&a.unstaged&&!a.conflicted):z.side==="conflict"?k?.entries?.some(a=>a.path===z.path&&a.conflicted):!0;O(()=>{k!==null&&z!==null&&!zn&&X(null)},[k,Ht]),O(()=>{if(!b||z===null){le(null);return}let a=new AbortController;return Te(!0),t("diff",{workspaceId:h,repo:L,path:z.path,side:z.side},a.signal).then(u=>{a.signal.aborted||le(u)}).catch(u=>{let N=ne(u);!a.signal.aborted&&N.name!=="AbortError"&&f(N)}).finally(()=>{a.signal.aborted||Te(!1)}),()=>a.abort()},[b?.workspaceId,L,Ht,Ne,t]);function pe(){Ce(a=>a+1)}function Ln(a){if(a===null){X(null);return}z!==null&&z.side===a.side&&z.path===a.path||(le(null),X(a))}function Et(a){let u=new Set;for(let N of a)u.add(N.path),N.from&&u.add(N.from);return[...u]}async function Bn(a,u){if(x===null){M("file"),f(null);try{let N=await t(u==="staged"?"unstage":"stage",{workspaceId:h,repo:L,paths:Et([a])});te(N),z?.path===a.path&&z.side===u&&X(null),pe()}catch(N){f(ne(N))}finally{M(null)}}}async function _t(a){let u=a==="staged"?F:fe;if(!(x!==null||u.length===0)){M("file"),f(null);try{let N=await t(a==="staged"?"unstage":"stage",{workspaceId:h,repo:L,paths:Et(u)});te(N),pe()}catch(N){f(ne(N))}finally{M(null)}}}async function qt(a,u){if(x!==null||a.length===0)return!1;M("file"),f(null);try{let N=await t(u==="staged"?"unstage":"stage",{workspaceId:h,repo:L,paths:Et(a)});return te(N),X(null),le(null),pe(),!0}catch(N){return f(ne(N)),!1}finally{M(null)}}async function Fn(a){if(x!==null)throw new Error(n("stash.busy"));M("stash");try{let u=await t("stashPush",{workspaceId:h,repo:L,paths:a.paths,message:a.message});te(u.status),X(null),le(null),J(n("stash.created",{count:a.paths.length})),Qe(N=>N+1)}finally{M(null)}}function In(a){if(x!==null)return;let u=[...new Set(a.map(N=>N.path))];u.length!==0&&W({title:n(u.length===1?"discard.titleOne":"discard.titleMany",{count:u.length}),body:e("div",null,e("div",null,n("discard.bodyMany")),e("ul",{className:"gitp-confirm-paths"},u.slice(0,8).map(N=>e("li",{key:N},N))),u.length>8?e("div",{className:"gitp-confirm-more"},n("discard.more",{count:u.length-8})):null),confirmLabel:n("discard.confirm"),danger:!0,run:()=>void On(u)})}async function On(a){if(x===null){M("discard"),f(null);try{let u=await t("discard",{workspaceId:h,repo:L,paths:a,confirm:!0});te(u),X(null),le(null),pe(),J(a.length===1?n("discard.doneOne"):n("discard.doneMany",{count:a.length}))}catch(u){f(ne(u))}finally{M(null),W(null)}}}function jn(a){x===null&&W({title:n(a.untracked?"discard.deleteTitle":"discard.title"),body:n(a.untracked?"discard.deleteBody":"discard.body",{path:a.path}),confirmLabel:n(a.untracked?"discard.deleteConfirm":"discard.confirm"),danger:!0,run:()=>void Gn(a)})}async function Gn(a){if(x===null){M("discard"),f(null);try{let u=await t("discard",{workspaceId:h,repo:L,paths:[a.path],confirm:!0});te(u),z?.path===a.path&&(X(null),le(null)),pe(),J(n(a.untracked?"discard.deleted":"discard.done",{name:bt(a.path).base}))}catch(u){f(ne(u))}finally{M(null),W(null)}}}async function Wn(a,u){if(!(x!==null||we===null)){if(u==="revert"){W({title:n("confirm.revertTitle"),body:n("confirm.revertBody"),confirmLabel:n("confirm.yesRevert"),danger:!0,run:()=>Xt(a,"revert")});return}await Xt(a,u)}}async function Xt(a,u){if(we!==null){M("block"),f(null);try{let N=await t("applyBlocks",{workspaceId:h,repo:L,path:we.path,side:u,blocks:[a],baseHash:we.baseHash,targetHash:we.targetHash,confirm:!0});te(N),pe()}catch(N){f(ne(N)),dn(N)==="git/stale"&&pe()}finally{M(null),W(null)}}}async function Kn(a){if(!(!z||x!==null)){M("resolve"),f(null);try{let u=await t("resolve",{workspaceId:h,repo:L,path:z.path,side:a});te(u),X(null),pe()}catch(u){f(ne(u))}finally{M(null)}}}async function Yt(){if(!(!de||x!==null)){M("commit"),f(null);try{let a=await t("commit",{workspaceId:h,repo:L,message:I,amend:j,noVerify:U});te(a.status),$(""),q(!1),J(n("commit.done",{hash:Se(a.hash)})),pe()}catch(a){f(ne(a))}finally{M(null)}}}function $n(){F.length===0||S.length>0||(_(null),je(!0))}async function Jt(){if(He||F.length===0)return null;Je(!0),f(null);try{let a=It.hook.getSnapshot(),u=await t("aiMessage",{workspaceId:h,repo:L,sessionId:s,...a.model===null?{}:{model:a.model},...a.instruction.trim()===""?{}:{instruction:a.instruction}});return u.model!==null&&u.model!==""&&J(n("ai.written",{model:u.model})),u.message!==""?u.message:null}catch(a){return f(ne(a)),null}finally{Je(!1)}}async function Zt(){Ge(!1);let a=await Jt();a!==null&&$(a)}async function Un(){if(Ge(!1),F.length===0||S.length>0)return;let a=await Jt();a!==null&&($(a),_(null),je(!0))}async function Vn({name:a,message:u}){T(!0),_(null);try{let N=await t("createBranchAndCommit",{workspaceId:h,repo:L,name:a,message:u,noVerify:U});te(N.status),$(""),je(!1),J(n("branch.created",{branch:a})),pe()}catch(N){_(ye(N))}finally{T(!1)}}async function _n(a){if(x===null){M("sync"),E(a),f(null),xe(null);try{let u=await t(a,{workspaceId:h,repo:L});te(u.status),a==="pull"&&u.autoStash==="conflict"?(B("changes"),X(null),le(null),xe(n("sync.pulledStashConflict"))):J(n(a==="fetch"?"sync.fetched":a==="pull"?u.autoStash==="restored"?"sync.pulledStashed":"sync.pulled":"sync.pushed"))}catch(u){f(ne(u))}finally{M(null),E(null)}}}async function qn(){if(!(y||k?.repo===!1)){if(me!==null){ce(null);return}ce({branches:[],loading:!0});try{let a=await t("branches",{workspaceId:h,repo:L});ce({branches:a.branches??[],loading:!1})}catch(a){ce(null),f(ne(a))}}}function Xn(a,u){J(a==="merge"?u===null?n("toast.mergeFinished"):n("toast.merged",{source:u.source,branch:u.current}):u===null?n("toast.rebaseFinished"):n("toast.rebased",{branch:u.current,source:u.source})),ke(null)}function Yn(a,u){k===null||k.branch.name===null||(ce(null),Ke(!1),ge({kind:"merge",source:a,remote:u,error:null}))}async function Jn(a,u){if(!(L===null||k===null||k.branch.name===null||y)){ce(null),T(!0),f(null);try{let N=await t("rebasePreview",{workspaceId:h,repo:L,branch:a});ge({kind:"rebase",source:a,remote:u,preview:N,error:null})}catch(N){f(ne(N))}finally{T(!1)}}}function Qt(){x==="merge"||x==="rebase"||ge(null)}async function Zn(){let a=be;if(a===null||a.kind!=="merge"||x!==null||L===null)return;let u={kind:"merge",source:a.source,current:k?.branch.name??"",startOid:k?.branch.oid??""};M("merge"),ge({...a,error:null}),f(null);try{let N=await t("merge",{workspaceId:h,repo:L,branch:a.source,noFastForward:Ze});te(N.status),ge(null),X(null),le(null),pe(),N.status.merging?(ke(u),B("changes")):J(n("toast.merged",{source:a.source,branch:N.status.branch.name??u.current}))}catch(N){ge({...a,error:ye(N)}),he(void 0,!1)}finally{M(null)}}async function Qn(){let a=be;if(a===null||a.kind!=="rebase"||x!==null||L===null||(k?.entries.length??0)>0)return;let u={kind:"rebase",source:a.source,current:k?.branch.name??"",startOid:k?.branch.oid??""};M("rebase"),ge({...a,error:null}),f(null);try{let N=await t("rebase",{workspaceId:h,repo:L,branch:a.source});te(N.status),ge(null),X(null),le(null),pe(),N.status.rebasing?(ke(u),B("changes")):J(n("toast.rebased",{branch:N.status.branch.name??u.current,source:a.source}))}catch(N){ge({...a,error:ye(N)}),he(void 0,!1)}finally{M(null)}}async function ei(){if(ae===null||x!==null||S.length>0||L===null)return;let a=ae,u=Ae;M("continue"),f(null);try{let N=await t("operationContinue",{workspaceId:h,repo:L});te(N.status),X(null),le(null),pe(),N.status.merging||N.status.rebasing?a==="rebase"&&N.status.conflicts.length>0&&J(n("toast.stoppedAgain")):Xn(a,u)}catch(N){f(ne(N)),he(void 0,!1)}finally{M(null)}}function ti(){if(ae===null||x!==null)return;let a=ae,u=Ae,N=u===null?n("abort.genericBody",{operation:n(a==="merge"?"operation.merge":"operation.rebase")}):n(a==="merge"?"abort.mergeBody":"abort.rebaseBody",{branch:u.current,hash:Se(u.startOid)});W({title:n(a==="merge"?"abort.mergeTitle":"abort.rebaseTitle"),body:N,confirmLabel:n(a==="merge"?"abort.merge":"abort.rebase"),danger:!0,run:()=>void ni(a)})}async function ni(a){if(!(x!==null||L===null)){M("abort"),f(null);try{let u=await t("operationAbort",{workspaceId:h,repo:L});te(u.status),ke(null),X(null),le(null),pe(),J(n(a==="merge"?"toast.mergeAborted":"toast.rebaseAborted"))}catch(u){f(ne(u)),he(void 0,!1)}finally{M(null),W(null)}}}function ii(){if(ae!=="rebase"||x!==null)return;let a=k?.operationCommit??"";W({title:n("skip.title"),body:a===""?n("skip.body"):e("div",null,e("div",{className:"gitp-modal-sub"},n("skip.body")),e("div",{className:"gitp-modal-facts"},e("div",{className:"gitp-modal-fact"},e("span",null,n("skip.commit")),e("b",null,Se(a))))),confirmLabel:n("skip.confirm"),danger:!0,run:()=>void ai()})}async function ai(){if(!(ae!=="rebase"||x!==null||L===null)){M("skip"),f(null);try{let a=await t("rebaseSkip",{workspaceId:h,repo:L});te(a.status);let u=a.skipped??"";X(null),le(null),pe(),a.status.rebasing?J(u===""?n("toast.commitSkipped"):n("toast.skippedCommit",{hash:Se(u)})):(ke(null),J(u===""?n("toast.skippedDone"):n("toast.skipped",{hash:Se(u)})))}catch(a){f(ne(a)),he(void 0,!1)}finally{M(null),W(null)}}}function ri(a,u){if(ce(null),(k?.entries?.length??0)>0){W({title:n("confirm.checkoutTitle"),body:n("confirm.checkoutBody"),confirmLabel:n("confirm.yesCheckout"),danger:!1,run:()=>en(a,u)});return}en(a,u)}async function en(a,u){W(null),T(!0),f(null);try{let N=await t("checkout",{workspaceId:h,repo:L,branch:a,remote:u===!0});te(N.status),ce(null),X(null),pe()}catch(N){ce(null),f(ne(N))}finally{T(!1)}}async function tn(){if(x===null){M("init"),f(null);try{let a=await t("init",{workspaceId:h});Array.isArray(a.repos)&&et(a.repos);let u=a.selected??a.root??null;typeof u=="string"&&u!==""&&(Xe(gt+h,u),Fe(u)),te(a)}catch(a){f(ne(a))}finally{M(null)}}}function oi(a){tt(!1),a!==L&&(Xe(gt+h,a??""),Fe(a),Q(null),X(null),le(null),ce(null),ke(null),ge(null))}function si(){tt(!1),W({title:n("repo.initRootTitle"),body:n("repo.initRootBody",{count:Ue.length}),confirmLabel:n("repo.initRootConfirm"),danger:!0,run:()=>{W(null),tn()}})}async function li({name:a}){if(L!==null){T(!0),_(null);try{let u=await t("createBranch",{workspaceId:h,repo:L,name:a});te(u.status),Ve(!1),J(n("branch.createdOnly",{branch:a})),pe()}catch(u){_(ye(u))}finally{T(!1)}}}let nn=D?rt:Pe;function an(a){D?(Oe(a),Xe(un,a)):(Le(a),Xe(pn,a))}if(b===null)return e("div",{className:"gitp-root"},e(Me,{icon:e(A,{path:w.branch,size:28}),title:n("empty.noWorkspace"),hint:n("empty.noWorkspaceHint")}));let xt=k?.branch??null,ci=xt?.ahead??0,di=xt?.behind??0,rn=Z,pi=F[0]?.path,ui=Ki(I,pi),gi=I;return e("div",{className:Y("gitp-root",D&&"is-compact"),ref:R},e(aa,{t:n,workspaceTitle:b.title,branch:xt,repo:k?.repo!==!1,ahead:ci,behind:di,upstream:xt?.upstream??null,onBranchMenu:qn,onRepoMenu:()=>tt(!0),repos:Ue,repoRoot:L,onSync:_n,busy:x!==null,onRefresh:()=>{he(void 0,!1),z&&pe(),Qe(a=>a+1)},syncing:ee}),ae===null?null:e(ra,{t:n,kind:ae,source:Ae?.source??null,current:Ae?.current??null,unresolved:k?.conflicts?.length??0,busy:x==="continue"||x==="abort"||x==="skip",onContinue:()=>void ei(),onSkip:ii,onAbort:ti}),rn?e("div",{className:"gitp-error",role:"alert"},e(A,{path:w.warning,size:14}),e("span",{className:"gitp-error-text"},ye(rn)),e(ze,{label:n("action.close"),icon:w.close,onClick:()=>f(null)})):null,De?e("div",{className:"gitp-error",role:"status"},e(A,{path:w.warning,size:14}),e("span",{className:"gitp-error-text"},De),e(ze,{label:n("action.close"),icon:w.close,onClick:()=>xe(null)})):null,e("div",{className:"gitp-body"},e(oa,{t:n,mode:P,onMode:B,counts:{changes:k?.entries?.length??0}}),e("div",{className:"gitp-content"},k===null?e(Me,{icon:e(ue),title:n("status.loading")}):k.repo===!1?e(Me,{icon:e(A,{path:w.branch,size:28}),title:n("empty.noRepo"),hint:n("empty.noRepoHint"),action:e("button",{type:"button",className:"gitp-btn is-primary",onClick:tn,disabled:x!==null},x==="init"?e(ue):null,n("empty.init"))}):P==="log"?e(ga,{call:t,workspaceId:h,repo:L??"",t:n,refreshToken:$e,compact:D,layout:nn,onLayout:an,snapshot:k,onApplied:yt}):P==="stash"?e(ha,{call:t,workspaceId:h,repo:L??"",t:n,snapshot:k,onStatus:te,refreshToken:$e}):e(Zi,{t:n,snapshot:k,conflicts:S,staged:F,unstaged:fe,selection:z,onSelect:Ln,busy:x!==null,fileBusy:x!==null,onToggleFile:Bn,onToggleAll:_t,onDiscard:jn,onBatchStage:a=>qt(a,"unstaged"),onBatchUnstage:a=>qt(a,"staged"),onBatchDiscard:In,onStash:Fn,diff:we,diffLoading:We,layout:nn,onLayout:an,onRefresh:()=>{pe(),he(void 0,!1)},onBlock:Wn,onResolve:Kn,onOpen:Mt,message:I,onMessage:$,onCommit:Yt,onBranch:$n,canCommit:de,commitBusy:x==="commit",aiBusy:He,aiMenuOpen:st,onAiToggle:()=>Ge(a=>!a),onAiClose:()=>Ge(!1),onAiWrite:Zt,onAiBranch:Un,selectionKey:Ht,amend:j,onAmend:q,noVerify:U,onNoVerify:V,canAmend:k.branch?.initial!==!0,compact:D,onBack:()=>X(null),operation:ae,sides:Pt}))),me?e(la,{t:n,branches:me.branches,loading:me.loading===!0,busy:y,current:k?.branch.name??null,detached:k?.branch.detached===!0,blocked:nt,onCheckout:ri,onMerge:Yn,onRebase:(a,u)=>void Jn(a,u),onNew:()=>{ce(null),_(null),Ve(!0)},onClose:()=>ce(null)}):null,vt?e(sa,{t:n,repos:Ue,current:L,onPick:oi,onInitRoot:si,onClose:()=>tt(!1)}):null,ct?e(ca,{t:n,busy:y,error:Ee,onCreate:li,onClose:()=>{Ve(!1),_(null)}}):null,ot?e(Xi,{t:n,defaultName:ui,defaultMessage:gi,busy:y,noVerify:U,error:Ee,onCreate:Vn,onNoVerify:V,onClose:()=>{je(!1),_(null)}}):null,be===null?null:be.kind==="merge"?e(Yi,{t:n,source:be.source,current:k?.branch.name??"",remote:be.remote,noFastForward:Ze,busy:x==="merge",error:be.error,onNoFastForward:Ke,onConfirm:()=>void Zn(),onClose:Qt}):e(Ji,{t:n,source:be.source,current:k?.branch.name??"",commits:be.preview.commits,pushed:be.preview.pushed,upstream:be.preview.upstream,dirtyCount:k?.entries.length??0,remote:be.remote,busy:x==="rebase",error:be.error,onConfirm:()=>void Qn(),onClose:Qt}),K?e(Vt,{title:K.title,body:K.body,confirmLabel:K.confirmLabel,cancelLabel:n("action.cancel"),danger:K.danger,busy:x!==null||y,onConfirm:()=>K.run(),onClose:()=>W(null)}):null,re?e("div",{className:"gitp-toast",role:"status","aria-live":"polite"},re):null)}function ya({t}){return e(ve.default.Fragment,null,e(St,{size:14}),e("span",{className:"gitp-tab-title"},t("panel")))}function Nn({sessionId:t,sidebarRight:n,useVisible:r,t:i}){let s=r(d=>d===!0),o=i("header.label");return e("button",{type:"button",className:Y("gitp-iconbtn","gitp-header-btn",s&&"is-active"),"aria-label":o,"aria-pressed":s,title:o,onClick(){if(!s){n.openTab("git");return}let d=n.tabsIn(t).find(g=>g.kind==="git");d!==void 0&&n.hide(d.id)}},e(St,{size:16}))}function An({label:t,containerRef:n,columnRef:r,width:i,onChange:s}){let o=G(null),d=()=>{let l=n.current;return l===null?i:Math.max(ht,Math.round(l.getBoundingClientRect().width)-hn)},g=l=>Math.min(Math.max(Math.round(l),ht),d());return O(()=>()=>{o.current=null,document.body.style.cursor="",document.body.style.userSelect=""},[]),O(()=>{let l=n.current;if(l===null||typeof ResizeObserver>"u")return;let c=new ResizeObserver(()=>{let m=Math.round(l.getBoundingClientRect().width);if(m===0)return;let v=Math.max(ht,m-hn);i>v&&s(v)});return c.observe(l),()=>c.disconnect()},[n,i,s]),e("div",{className:"gitp-resizer",role:"separator","aria-orientation":"vertical","aria-label":t,"aria-valuemin":ht,"aria-valuemax":d(),"aria-valuenow":i,tabIndex:0,onPointerDown(l){l.button===0&&(o.current={x:l.clientX,width:i,next:i},l.currentTarget.setPointerCapture(l.pointerId),document.body.style.cursor="col-resize",document.body.style.userSelect="none",l.preventDefault())},onPointerMove(l){let c=o.current;if(c===null)return;let m=g(c.width+(l.clientX-c.x));m!==c.next&&(c.next=m,r.current!==null&&(r.current.style.width=`${m}px`),l.currentTarget.setAttribute("aria-valuenow",String(m)))},onPointerUp(l){let c=o.current;c!==null&&(o.current=null,l.currentTarget.hasPointerCapture(l.pointerId)&&l.currentTarget.releasePointerCapture(l.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(g(Ot))},onKeyDown(l){if(l.key==="ArrowLeft"||l.key==="ArrowRight"){l.preventDefault();let c=l.key==="ArrowRight"?mn:-mn;s(g(i+c));return}l.key==="Home"&&(l.preventDefault(),s(g(Ot)))}})}var Kt=null;function wa({t,call:n,usePrefs:r,savePrefs:i}){let s=r(D=>D),[o,d]=C(null),[g,l]=C(!1);O(()=>{let D=new AbortController,H=!0;return n("preferences",{},D.signal).then(k=>{H&&d(k)},()=>{H&&l(!0)}),()=>{H=!1,D.abort()}},[n]);let c=o?.groups??[],m=s.model,v=m===null?"":vn(m),b=m!==null&&c.some(D=>D.id===m.provider&&D.models.some(H=>H.id===m.model)),h=s.instruction===""?o?.instruction??"":s.instruction,R=o===null&&!g;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:v,disabled:R,onChange:D=>{let H=D.target.value;if(H===""){i({...s,model:null});return}let k=Wi(H);k!==null&&i({...s,model:k})}},e("option",{value:""},t("settings.modelSame")),b||s.model===null?null:e("option",{value:v},`${s.model.provider} \xB7 ${s.model.model}`),c.map(D=>e("optgroup",{key:D.id,label:D.label},D.models.map(H=>e("option",{key:H.id,value:vn({provider:D.id,model:H.id})},H.name))))),g?e("p",{className:"gitp-settings-error"},t("settings.modelFailed")):null,!g&&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:h,spellCheck:!1,disabled:R,onChange:D=>i({...s,instruction:D.target.value})}),e("div",{className:"gitp-settings-actions"},e("button",{type:"button",className:"gitp-btn is-small",disabled:s.instruction==="",onClick:()=>i({...s,instruction:""})},t("settings.instructionReset"))),g?e("p",{className:"gitp-settings-error"},t("settings.instructionFailed")):null))}function xa(){return e(St,{size:16})}function ka(t,n){let r=o=>({status:"blocked",reason:o}),i=["page","editable","terminal"],s=o=>{let d=Kt;return d===null||!d.visible?r(n("command.openFirst")):o(d)};return[{id:"git.panel.toggle",label:()=>n("command.toggle"),aliases:["git","source control","toggle panel"],defaults:{},regions:i,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:()=>n("command.stageAll"),aliases:["git","stage"],defaults:{},regions:i,modals:[],resolve:()=>s(o=>o.canStageAll()?{status:"handled",run:()=>o.stageAll()}:r(n("command.nothingToStage")))},{id:"git.commit",label:()=>n("command.commit"),aliases:["git","commit"],defaults:{},regions:i,modals:[],resolve:()=>s(o=>o.canCommit()?{status:"handled",run:()=>o.commit()}:r(n("command.notReady")))},{id:"git.writeMessage",label:()=>n("command.writeMessage"),aliases:["git","commit message","ai"],defaults:{},regions:i,modals:[],resolve:()=>s(o=>o.canWriteMessage()?{status:"handled",run:()=>o.writeMessage()}:r(n("command.notReady")))}]}var Na=["connection","slots","locale","sidebarRightTabs","sidebarRight"];function Ca(t){t.locale.register(qe,"en",Ei),t.locale.register(qe,"zh",Di);let n=t.locale.bind(qe),r=async(s,o,d)=>{let g=await t.connection.rpc.call("/git-rpc",s,o,d);if(!g.ok)throw new Ft(g.error.code,g.error.message,g.error.details);return g.value};t.effect(()=>t.sidebarRightTabs.register({id:zt,kind:"git",priority:"extension",title:()=>n("panel"),guide:[{id:"git",order:50,title:()=>n("guide.title"),description:()=>n("guide.description"),icon:()=>e(_i,null)}]}),"dsh-git: right sidebar tab type");let i=s=>({sessionId:s,sidebarRight:t.sidebarRight,hooks:{visible:Cn(s).hook}});t.slots.inject("conversation.session.header.utilities",()=>t.slots.register({name:"conversation.session.header.utilities",id:"git-panel",order:-7,locale:qe,inject:i},Nn)),t.slots.inject("conversation.hero.options",()=>t.slots.register({name:"conversation.hero.options",id:"git-panel",order:-7,locale:qe,inject:i},Nn)),t.slots.inject("settings.section",()=>t.slots.register({name:"settings.section",id:"git",order:25,label:()=>n("settings.section"),locale:qe,inject:()=>({t:n,call:r,savePrefs:It.set,hooks:{prefs:It.hook}})},wa)),t.slots.inject("settings.section.icon",()=>t.slots.register({name:"settings.section.icon",id:"git",order:25},xa)),t.inject(["shortcuts"],s=>{for(let o of ka(t,n))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:zt,locale:qe,inject:()=>({call:r,t:n,sidebarRight:t.sidebarRight})},va)),t.slots.inject("sidebar.right.pane.tab.title",()=>t.slots.register({name:"sidebar.right.pane.tab.title",key:zt,locale:qe,inject:()=>({t:n})},ya))}
349
386
 
350
387
  return module.exports;
351
388
  },
@@ -65,6 +65,7 @@ export function createRuntime(subprocess) {
65
65
  const signal = options.signal === undefined ? timeout : AbortSignal.any([timeout, options.signal]);
66
66
  const env = {
67
67
  ...process.env,
68
+ ...(options.env ?? {}),
68
69
  LC_ALL: 'C',
69
70
  LANG: 'C',
70
71
  GIT_TERMINAL_PROMPT: '0',
@@ -292,22 +292,49 @@ async function readStatus(runtime, root) {
292
292
  binary,
293
293
  });
294
294
  }
295
- const [mergeHead, rebaseHead, revertHead, cherryHead] = await Promise.all([
295
+ const [mergeHead, revertHead, cherryHead, rebaseDirs] = await Promise.all([
296
296
  runtime.run(root, ['rev-parse', '-q', '--verify', 'MERGE_HEAD']),
297
- runtime.run(root, ['rev-parse', '-q', '--verify', 'REBASE_HEAD']),
298
297
  runtime.run(root, ['rev-parse', '-q', '--verify', 'REVERT_HEAD']),
299
298
  runtime.run(root, ['rev-parse', '-q', '--verify', 'CHERRY_PICK_HEAD']),
299
+ // Git keeps REBASE_HEAD after a successful rebase, so it cannot tell a
300
+ // running rebase from a finished one. The state directories can. They live
301
+ // in the per-worktree Git directory.
302
+ runtime.run(root, [
303
+ 'rev-parse',
304
+ '--path-format=absolute',
305
+ '--git-path',
306
+ 'rebase-merge',
307
+ '--git-path',
308
+ 'rebase-apply',
309
+ ]),
300
310
  ]);
311
+ const rebaseDirPaths = rebaseDirs.code === 0
312
+ ? rebaseDirs.stdout
313
+ .split('\n')
314
+ .map((line) => line.trim())
315
+ .filter((line) => line !== '')
316
+ : [];
317
+ const rebaseStats = await Promise.all(rebaseDirPaths.map((target) => runtime.lstatPath(target)));
318
+ const rebaseStarted = rebaseStats.some((stat) => stat !== null && stat.isDirectory());
319
+ let operationCommit = null;
320
+ if (rebaseStarted) {
321
+ // REBASE_HEAD survives a finished rebase, so read it only while the state
322
+ // directories say a rebase is actually running.
323
+ const stopped = await runtime.run(root, ['rev-parse', '--verify', '--quiet', 'REBASE_HEAD']);
324
+ if (stopped.code === 0 && stopped.stdout.trim() !== '')
325
+ operationCommit = stopped.stdout.trim();
326
+ }
301
327
  return {
302
328
  repo: true,
303
329
  root,
304
330
  branch: parsed.branch,
305
331
  entries,
306
332
  merging: mergeHead.code === 0,
307
- rebasing: rebaseHead.code === 0,
333
+ rebasing: rebaseStarted,
308
334
  reverting: revertHead.code === 0,
309
335
  cherryPicking: cherryHead.code === 0,
310
336
  conflicts: entries.filter((entry) => entry.conflicted).map((entry) => entry.path),
337
+ operationCommit,
311
338
  };
312
339
  }
313
340
  /**
@@ -1233,6 +1260,235 @@ export async function fetch(runtime, root) {
1233
1260
  status: await readStatus(runtime, root),
1234
1261
  };
1235
1262
  }
1263
+ /**
1264
+ * Read a branch argument from a request.
1265
+ * @param value the caller value.
1266
+ * @returns the trimmed name.
1267
+ */
1268
+ function branchArgument(value) {
1269
+ const name = typeof value === 'string' ? value.trim() : '';
1270
+ if (name === '' || name.startsWith('-') || name.includes('\0') || name.includes('\n')) {
1271
+ throw new GitError('git/branch-invalid', 'Choose a branch.');
1272
+ }
1273
+ return name;
1274
+ }
1275
+ /**
1276
+ * Resolve one branch name to its tip commit.
1277
+ * @param runtime the runtime helpers.
1278
+ * @param root the repository root.
1279
+ * @param value the caller branch.
1280
+ * @returns the name and hash.
1281
+ */
1282
+ async function branchTip(runtime, root, value) {
1283
+ const name = branchArgument(value);
1284
+ const resolved = await runtime.run(root, ['rev-parse', '--verify', '--quiet', `${name}^{commit}`]);
1285
+ const hash = resolved.stdout.trim();
1286
+ if (resolved.code !== 0 || hash === '') {
1287
+ throw new GitError('git/branch-invalid', `The branch ${name} no longer exists.`);
1288
+ }
1289
+ return { name, hash };
1290
+ }
1291
+ /**
1292
+ * Name the merge or rebase an operation endpoint can act on.
1293
+ * @param snapshot the current status.
1294
+ * @returns the kind, or null.
1295
+ */
1296
+ function mergeOrRebase(snapshot) {
1297
+ if (snapshot.merging)
1298
+ return 'merge';
1299
+ if (snapshot.rebasing)
1300
+ return 'rebase';
1301
+ return null;
1302
+ }
1303
+ /**
1304
+ * Build the failure for a merge or rebase that did not stop on a conflict.
1305
+ * @param kind the operation.
1306
+ * @param result the command result.
1307
+ * @returns the error.
1308
+ */
1309
+ function operationFailure(kind, result) {
1310
+ const message = result.stderr.trim() || result.stdout.trim() || (kind === 'merge' ? 'Merge failed.' : 'Rebase failed.');
1311
+ return new GitError(kind === 'merge' ? 'git/merge-failed' : 'git/rebase-failed', message, {
1312
+ stdout: result.stdout,
1313
+ stderr: result.stderr,
1314
+ });
1315
+ }
1316
+ /**
1317
+ * Merge one branch into the current branch.
1318
+ * @param runtime the runtime helpers.
1319
+ * @param root the repository root.
1320
+ * @param options the merge request.
1321
+ * @returns the output, fresh status, and conflicted paths.
1322
+ */
1323
+ export async function merge(runtime, root, options) {
1324
+ const snapshot = await readStatus(runtime, root);
1325
+ refuseOperation(snapshot);
1326
+ if (snapshot.branch.detached || snapshot.branch.name === null) {
1327
+ throw new GitError('git/detached', 'Check out a branch before merging.');
1328
+ }
1329
+ const source = await branchTip(runtime, root, options.branch);
1330
+ if (source.name === snapshot.branch.name) {
1331
+ throw new GitError('git/branch-invalid', 'Choose a branch other than the current one.');
1332
+ }
1333
+ const args = ['merge', '--no-edit', options.noFastForward ? '--no-ff' : '--ff', source.name];
1334
+ const result = await runtime.run(root, args);
1335
+ const status = await readStatus(runtime, root);
1336
+ const output = `${result.stdout}${result.stderr}`.trim();
1337
+ if (result.code !== 0) {
1338
+ if (status.merging)
1339
+ return { output, status, conflicted: status.conflicts };
1340
+ throw operationFailure('merge', result);
1341
+ }
1342
+ return { output, status, ...(status.conflicts.length > 0 ? { conflicted: status.conflicts } : {}) };
1343
+ }
1344
+ /**
1345
+ * Rebase the current branch onto another branch.
1346
+ * @param runtime the runtime helpers.
1347
+ * @param root the repository root.
1348
+ * @param options the rebase request.
1349
+ * @returns the output, fresh status, and conflicted paths.
1350
+ */
1351
+ export async function rebase(runtime, root, options) {
1352
+ const snapshot = await readStatus(runtime, root);
1353
+ refuseOperation(snapshot);
1354
+ if (snapshot.branch.detached || snapshot.branch.name === null) {
1355
+ throw new GitError('git/detached', 'Check out a branch before rebasing.');
1356
+ }
1357
+ const source = await branchTip(runtime, root, options.branch);
1358
+ if (source.name === snapshot.branch.name) {
1359
+ throw new GitError('git/branch-invalid', 'Choose a branch other than the current one.');
1360
+ }
1361
+ if (snapshot.entries.length > 0) {
1362
+ throw new GitError('git/dirty-tree', 'Commit or stash your changes before rebasing.');
1363
+ }
1364
+ const result = await runtime.run(root, ['rebase', source.name], {
1365
+ env: { GIT_EDITOR: 'true', GIT_SEQUENCE_EDITOR: 'true' },
1366
+ });
1367
+ const status = await readStatus(runtime, root);
1368
+ const output = `${result.stdout}${result.stderr}`.trim();
1369
+ if (result.code !== 0) {
1370
+ if (status.rebasing)
1371
+ return { output, status, conflicted: status.conflicts };
1372
+ throw operationFailure('rebase', result);
1373
+ }
1374
+ return { output, status, ...(status.conflicts.length > 0 ? { conflicted: status.conflicts } : {}) };
1375
+ }
1376
+ /**
1377
+ * Continue a stopped merge or rebase.
1378
+ * @param runtime the runtime helpers.
1379
+ * @param root the repository root.
1380
+ * @returns the output, fresh status, and conflicted paths.
1381
+ */
1382
+ export async function operationContinue(runtime, root) {
1383
+ const snapshot = await readStatus(runtime, root);
1384
+ const kind = mergeOrRebase(snapshot);
1385
+ if (kind === null) {
1386
+ throw new GitError('git/no-operation', 'No merge or rebase is in progress.');
1387
+ }
1388
+ if (snapshot.conflicts.length > 0) {
1389
+ throw new GitError('git/conflict', 'Resolve and stage the conflicts before continuing.');
1390
+ }
1391
+ const args = kind === 'merge' ? ['merge', '--continue'] : ['rebase', '--continue'];
1392
+ const result = await runtime.run(root, args, { env: { GIT_EDITOR: 'true', GIT_SEQUENCE_EDITOR: 'true' } });
1393
+ const status = await readStatus(runtime, root);
1394
+ const output = `${result.stdout}${result.stderr}`.trim();
1395
+ if (result.code !== 0) {
1396
+ if ((status.merging || status.rebasing) && status.conflicts.length > 0) {
1397
+ return { output, status, conflicted: status.conflicts };
1398
+ }
1399
+ throw operationFailure(kind, result);
1400
+ }
1401
+ return { output, status, ...(status.conflicts.length > 0 ? { conflicted: status.conflicts } : {}) };
1402
+ }
1403
+ /**
1404
+ * Abort a stopped merge or rebase.
1405
+ * @param runtime the runtime helpers.
1406
+ * @param root the repository root.
1407
+ * @returns the output and fresh status.
1408
+ */
1409
+ export async function operationAbort(runtime, root) {
1410
+ const snapshot = await readStatus(runtime, root);
1411
+ const kind = mergeOrRebase(snapshot);
1412
+ if (kind === null) {
1413
+ throw new GitError('git/no-operation', 'No merge or rebase is in progress.');
1414
+ }
1415
+ const result = await runtime.run(root, kind === 'merge' ? ['merge', '--abort'] : ['rebase', '--abort']);
1416
+ if (result.code !== 0) {
1417
+ throw new GitError(kind === 'merge' ? 'git/merge-abort-failed' : 'git/rebase-abort-failed', result.stderr.trim() || result.stdout.trim() || `Git could not abort the ${kind}.`, { stdout: result.stdout, stderr: result.stderr });
1418
+ }
1419
+ return {
1420
+ output: `${result.stdout}${result.stderr}`.trim(),
1421
+ status: await readStatus(runtime, root),
1422
+ };
1423
+ }
1424
+ /**
1425
+ * Skip the commit a rebase stopped on.
1426
+ * @param runtime the runtime helpers.
1427
+ * @param root the repository root.
1428
+ * @returns the output, fresh status, the skipped commit, and conflicted paths.
1429
+ */
1430
+ export async function rebaseSkip(runtime, root) {
1431
+ const snapshot = await readStatus(runtime, root);
1432
+ if (!snapshot.rebasing) {
1433
+ throw new GitError('git/no-operation', 'No rebase is in progress.');
1434
+ }
1435
+ const stopped = await runtime.run(root, ['rev-parse', '--verify', '--quiet', 'REBASE_HEAD']);
1436
+ const skipped = stopped.code === 0 ? stopped.stdout.trim() : '';
1437
+ const result = await runtime.run(root, ['rebase', '--skip'], {
1438
+ env: { GIT_EDITOR: 'true', GIT_SEQUENCE_EDITOR: 'true' },
1439
+ });
1440
+ const status = await readStatus(runtime, root);
1441
+ const output = `${result.stdout}${result.stderr}`.trim();
1442
+ const extra = skipped === '' ? {} : { skipped };
1443
+ if (result.code !== 0) {
1444
+ if (status.rebasing && status.conflicts.length > 0) {
1445
+ return { output, status, conflicted: status.conflicts, ...extra };
1446
+ }
1447
+ throw operationFailure('rebase', result);
1448
+ }
1449
+ return { output, status, ...extra };
1450
+ }
1451
+ /**
1452
+ * Read what a rebase dialog needs before it starts.
1453
+ * @param runtime the runtime helpers.
1454
+ * @param root the repository root.
1455
+ * @param options the rebase request.
1456
+ * @returns the replay and pushed commit counts.
1457
+ */
1458
+ export async function rebasePreview(runtime, root, options) {
1459
+ const snapshot = await readStatus(runtime, root);
1460
+ refuseOperation(snapshot);
1461
+ if (snapshot.branch.detached || snapshot.branch.name === null) {
1462
+ throw new GitError('git/detached', 'Check out a branch before rebasing.');
1463
+ }
1464
+ const source = await branchTip(runtime, root, options.branch);
1465
+ if (source.name === snapshot.branch.name) {
1466
+ throw new GitError('git/branch-invalid', 'Choose a branch other than the current one.');
1467
+ }
1468
+ const totalResult = await runtime.run(root, ['rev-list', '--count', `${source.name}..HEAD`]);
1469
+ if (totalResult.code !== 0) {
1470
+ throw failure(totalResult, 'Git could not count the commits to replay.');
1471
+ }
1472
+ const total = Number.parseInt(totalResult.stdout.trim(), 10);
1473
+ const commits = Number.isFinite(total) ? total : 0;
1474
+ const upstream = snapshot.branch.upstream;
1475
+ let pushed = 0;
1476
+ if (upstream !== null && upstream !== '') {
1477
+ const unpushedResult = await runtime.run(root, [
1478
+ 'rev-list',
1479
+ '--count',
1480
+ `${source.name}..HEAD`,
1481
+ '--not',
1482
+ upstream,
1483
+ ]);
1484
+ if (unpushedResult.code === 0) {
1485
+ const unpushed = Number.parseInt(unpushedResult.stdout.trim(), 10);
1486
+ if (Number.isFinite(unpushed))
1487
+ pushed = Math.max(0, commits - unpushed);
1488
+ }
1489
+ }
1490
+ return { commits, pushed, upstream };
1491
+ }
1236
1492
  /**
1237
1493
  * Read the staged patch for the message writer.
1238
1494
  * @param runtime the runtime helpers.
@@ -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, discardPaths, discoverRepositories, diff, fetch, findRepository, initRepository, log, pull, push, recentSubjects, resetToCommit, resolveConflict, resolveRepository, revertCommit, sessionCheckout, 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, merge, operationAbort, operationContinue, pull, push, rebase, rebasePreview, rebaseSkip, recentSubjects, resetToCommit, resolveConflict, resolveRepository, revertCommit, sessionCheckout, 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.
@@ -251,6 +251,21 @@ async function dispatch(ctx, runtime, endpoint, payload) {
251
251
  branch: stringField(payload, 'branch'),
252
252
  remote: valueOf(payload, 'remote') === true,
253
253
  });
254
+ case 'merge':
255
+ return merge(runtime, root, {
256
+ branch: stringField(payload, 'branch'),
257
+ noFastForward: valueOf(payload, 'noFastForward') === true,
258
+ });
259
+ case 'rebase':
260
+ return rebase(runtime, root, { branch: stringField(payload, 'branch') });
261
+ case 'rebasePreview':
262
+ return rebasePreview(runtime, root, { branch: stringField(payload, 'branch') });
263
+ case 'operationContinue':
264
+ return operationContinue(runtime, root);
265
+ case 'operationAbort':
266
+ return operationAbort(runtime, root);
267
+ case 'rebaseSkip':
268
+ return rebaseSkip(runtime, root);
254
269
  case 'stashList':
255
270
  return stashList(runtime, root);
256
271
  case 'stashPush':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-git-desk",
3
- "version": "0.24.0",
3
+ "version": "0.25.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": [