dateStyle="${this.preferences?.dateStyle}"
details
>
${this.renderSuggestedChanges()}
`}renderIncomingOutgoing(){return null==this.branchState||0===this.branchState.ahead&&0===this.branchState.behind?Lt:Mt`
Incoming / Outgoing
Incoming Changes
${this.branchState.behind??0}
Outgoing Changes
${this.branchState.ahead??0}
`}renderPatchCreation(){return this.inReview?Mt`{this.dispatchEvent(new CustomEvent("gl-inspect-create-suggestions",{detail:e.detail}))}}
>`:Lt}render(){return null==this.wip?Lt:Mt`
${this.renderActions()}
${this.renderPullRequest()}
${Qt(!1===this.inReview,(()=>this.renderChangedFiles("wip")))}${this.renderPatchCreation()}
`}getFileActions(e,t){const o={icon:"go-to-file",label:"Open file",action:"file-open"};return!0===e.staged?[o,{icon:"remove",label:"Unstage changes",action:"file-unstage"}]:[o,{icon:"plus",label:"Stage changes",action:"file-stage"}]}onDataActionClick(e){this.dispatchEvent(new CustomEvent("data-action",{detail:{name:e}}))}onToggleReviewMode(e){this.dispatchEvent(new CustomEvent("draft-state-changed",{detail:{inReview:e}}))}onShowCodeSuggestion(e){this.dispatchEvent(new CustomEvent("gl-show-code-suggestion",{detail:{id:e}}))}};ka.styles=[je`
:host {
--gk-avatar-size: 1.6rem;
}
`],$a([Kt({type:Object})],ka.prototype,"wip",2),$a([Kt({type:Object})],ka.prototype,"orgSettings",2),$a([Kt({type:Object})],ka.prototype,"draftState",2),$a([Kt({type:Object})],ka.prototype,"generate",2),$a([Yt()],ka.prototype,"inReview",1),$a([Yt()],ka.prototype,"patchCreateMetadata",2),ka=$a([Vt("gl-wip-details")],ka);const _a=je`
.commit-action {
display: inline-flex;
justify-content: center;
align-items: center;
height: 21px;
border-radius: 0.25em;
color: inherit;
padding: 0.2rem;
vertical-align: text-bottom;
text-decoration: none;
gap: 0.2rem;
}
.commit-action > * {
pointer-events: none;
}
.commit-action:focus {
outline: 1px solid var(--vscode-focusBorder);
outline-offset: -1px;
}
.commit-action:hover {
color: var(--vscode-foreground);
text-decoration: none;
}
:host-context(.vscode-dark) .commit-action:hover {
background-color: var(--color-background--lighten-15);
}
:host-context(.vscode-light) .commit-action:hover {
background-color: var(--color-background--darken-15);
}
:host-context(.vscode-dark) .commit-action.is-active {
background-color: var(--color-background--lighten-10);
}
:host-context(.vscode-light) .commit-action.is-active {
background-color: var(--color-background--darken-10);
}
.commit-action.is-disabled {
opacity: 0.5;
pointer-events: none;
}
.commit-action.is-hidden {
display: none;
}
.commit-action--emphasis-low:not(:hover, :focus, :active) {
opacity: 0.5;
}
.pr--opened {
color: var(--vscode-gitlens-openPullRequestIconColor);
}
.pr--closed {
color: var(--vscode-gitlens-closedPullRequestIconColor);
}
.pr--merged {
color: var(--vscode-gitlens-mergedPullRequestIconColor);
}
`;var Ca=Object.defineProperty,Sa=Object.getOwnPropertyDescriptor,Aa=(e,t,o,n)=>{for(var r,a=n>1?void 0:n?Sa(t,o):t,l=e.length-1;l>=0;l--)(r=e[l])&&(a=(n?r(t,o,a):r(a))||a);return n&&a&&Ca(t,o,a),a};let Ea=class extends lit_element_r{constructor(){super(...arguments),this.pinned=!1,this.uncommitted=!1,this.shortSha=""}get navigationState(){if(null==this.navigation)return{back:!1,forward:!1};const e={back:!0,forward:!0};return this.navigation.count<=1?(e.back=!1,e.forward=!1):0===this.navigation.position?(e.back=!0,e.forward=!1):this.navigation.position===this.navigation.count-1&&(e.back=!1,e.forward=!0),e}handleAction(e){const t=e.target,o=t.dataset.action;if(null!=o)if("commit-actions"===o){const o=e instanceof MouseEvent&&e.altKey;this.fireEvent("commit-actions",{action:t.dataset.actionType,alt:o})}else this.fireEvent(o)}fireEvent(e,t){this.dispatchEvent(new CustomEvent(`gl-${e}`,{detail:t}))}render(){const e=this.pinned?Mt`Unpin this Commit
Restores Automatic Following`:Mt`Pin this Commit
Suspends Automatic Following`;let t="Forward",o="Back";return this.navigation?.hint&&(this.pinned?o+=` - ${this.navigation.hint}`:t+=` - ${this.navigation.hint}`),Mt`
${e}
${Qt(this.navigationState.forward,(()=>Mt`
`))}
${Qt(this.uncommitted,(()=>Mt`
`))}
${Qt(!this.uncommitted,(()=>Mt`
`))}
`}};Ea.styles=[_a,je`
*,
*::before,
*::after {
box-sizing: border-box;
}
:host {
display: flex;
flex-direction: row;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
gap: 0.2rem;
}
:host([pinned]) {
background-color: var(--color-alert-warningBackground);
box-shadow: 0 0 0 0.1rem var(--color-alert-warningBorder);
border-radius: 0.3rem;
}
:host([pinned]) .commit-action:hover,
:host([pinned]) .commit-action.is-active {
background-color: var(--color-alert-warningHoverBackground);
}
.group {
display: flex;
flex: none;
flex-direction: row;
max-width: 100%;
}
.sha {
margin: 0 0.5rem 0 0.25rem;
}
`],Aa([Kt({type:Boolean,reflect:!0})],Ea.prototype,"pinned",2),Aa([Kt({type:Boolean})],Ea.prototype,"uncommitted",2),Aa([Kt({type:Object})],Ea.prototype,"navigation",2),Aa([Kt()],Ea.prototype,"shortSha",2),Aa([Kt()],Ea.prototype,"stashNumber",2),Ea=Aa([Vt("gl-inspect-nav")],Ea);var Pa=Object.defineProperty,Oa=Object.getOwnPropertyDescriptor,Ra=(e,t,o,n)=>{for(var r,a=n>1?void 0:n?Oa(t,o):t,l=e.length-1;l>=0;l--)(r=e[l])&&(a=(n?r(t,o,a):r(a))||a);return n&&a&&Pa(t,o,a),a};let Ta=class extends lit_element_r{render(){if(null==this.wip)return Lt;const e=this.wip.changes,t=this.wip.branch;if(null==e||null==t)return Lt;let o="git-pull-request";if(this.wip.pullRequest?.state)switch(this.wip.pullRequest?.state){case"merged":o="git-merge";break;case"closed":o="git-pull-request-closed"}return Mt`
`}handleAction(e,t){const o=e instanceof MouseEvent&&e.altKey;this.dispatchEvent(new CustomEvent("gl-branch-action",{detail:{action:t,alt:o}}))}};Ta.styles=[_a,je`
*,
*::before,
*::after {
box-sizing: border-box;
}
:host {
display: flex;
flex-direction: row;
/* flex-wrap: wrap; */
align-items: center;
justify-content: space-between;
gap: 0.2rem;
}
.tooltip--overflowed {
min-width: 0;
}
.commit-action--overflowed {
width: 100%;
}
.branch {
min-width: 0;
max-width: fit-content;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.group {
display: flex;
flex: none;
flex-direction: row;
min-width: 0;
max-width: 100%;
}
.group:first-child {
min-width: 0;
flex: 0 1 auto;
}
hr {
border: none;
border-top: 1px solid var(--color-foreground--25);
}
.md-code {
background: var(--vscode-textCodeBlock-background);
border-radius: 3px;
padding: 0px 4px 2px 4px;
font-family: var(--vscode-editor-font-family);
}
`],Ra([Kt({type:Object})],Ta.prototype,"wip",2),Ra([Kt({type:Object})],Ta.prototype,"preferences",2),Ta=Ra([Vt("gl-status-nav")],Ta);var Da=Object.defineProperty,Ma=Object.getOwnPropertyDescriptor,Ia=(e,t,o,n)=>{for(var r,a=n>1?void 0:n?Ma(t,o):t,l=e.length-1;l>=0;l--)(r=e[l])&&(a=(n?r(t,o,a):r(a))||a);return n&&a&&Da(t,o,a),a};const La="0000000000000000000000000000000000000000";let Ba=class extends lit_element_r{constructor(){super(),this.draftState={inReview:!1},this._disposables=[],this.indentPreference=16,Re(Ce)}get isUncommitted(){return this.state?.commit?.sha===La}get hasCommit(){return null!=this.state?.commit}get isStash(){return null!=this.state?.commit?.stashNumber}get wipStatus(){const e=this.state?.wip;if(null==e)return;const t=e.branch;if(null==t)return;const o=e.changes,n=o?.files.length??0,r=t.tracking?.ahead??0,a=t.tracking?.behind??0,l=a>0&&r>0?"both":a>0?"behind":r>0?"ahead":n>0?"working":void 0;return{branch:e.repositoryCount>1?`${e.repo.name}:${t.name}`:t.name,upstream:t.upstream?.name,ahead:r,behind:a,working:e.changes?.files.length??0,status:l}}get navigation(){if(null==this.state?.navigationStack)return{back:!1,forward:!1};const e={back:!0,forward:!0};return this.state.navigationStack.count<=1?(e.back=!1,e.forward=!1):0===this.state.navigationStack.position?(e.back=!0,e.forward=!1):this.state.navigationStack.position===this.state.navigationStack.count-1&&(e.back=!1,e.forward=!0),e}updateDocumentProperties(){const e=this.state?.preferences?.indent;if(e===this.indentPreference)return;this.indentPreference=e??16;document.documentElement.style.setProperty("--gitlens-tree-indent",`${this.indentPreference}px`)}updated(e){e.has("state")&&(this.updateDocumentProperties(),null!=this.state?.inReview&&this.state.inReview!==this.draftState.inReview&&(this.draftState.inReview=this.state.inReview))}connectedCallback(){super.connectedCallback(),this._hostIpc=new ee("commit-details"),this._disposables=[this._hostIpc.onReceiveMessage((e=>this.onMessageReceived(e))),this._hostIpc,B.on("gl-inspect-nav","gl-commit-actions",(e=>this.onCommitActions(e))),B.on("gl-status-nav","gl-branch-action",(e=>this.onBranchAction(e.detail.action))),B.on('[data-action="pick-commit"]',"click",(e=>this.onPickCommit(e))),B.on('[data-action="wip"]',"click",(e=>this.onSwitchMode(e,"wip"))),B.on('[data-action="details"]',"click",(e=>this.onSwitchMode(e,"commit"))),B.on('[data-action="search-commit"]',"click",(e=>this.onSearchCommit(e))),B.on('[data-action="files-layout"]',"click",(e=>this.onToggleFilesLayout(e))),B.on("gl-inspect-nav","gl-pin",(()=>this.onTogglePin())),B.on("gl-inspect-nav","gl-back",(()=>this.onNavigate("back"))),B.on("gl-inspect-nav","gl-forward",(()=>this.onNavigate("forward"))),B.on('[data-action="create-patch"]',"click",(e=>this.onCreatePatchFromWip(!0))),B.on('[data-region="rich-pane"]',"expanded-change",(e=>this.onExpandedChange(e.detail,"autolinks"))),B.on('[data-region="pullrequest-pane"]',"expanded-change",(e=>this.onExpandedChange(e.detail,"pullrequest"))),B.on('[data-action="explain-commit"]',"click",(e=>this.onExplainCommit(e))),B.on('[data-action="switch-ai"]',"click",(e=>this.onSwitchAiModel(e))),B.on("gl-wip-details","create-patch",(e=>this.onCreatePatchFromWip(e.detail.checked))),B.on("gl-commit-details","file-open-on-remote",(e=>this.onOpenFileOnRemote(e.detail))),B.on("gl-commit-details,gl-wip-details","file-open",(e=>this.onOpenFile(e.detail))),B.on("gl-commit-details","file-compare-working",(e=>this.onCompareFileWithWorking(e.detail))),B.on("gl-commit-details,gl-wip-details","file-compare-previous",(e=>this.onCompareFileWithPrevious(e.detail))),B.on("gl-commit-details","file-more-actions",(e=>this.onFileMoreActions(e.detail))),B.on("gl-wip-details","file-stage",(e=>this.onStageFile(e.detail))),B.on("gl-wip-details","file-unstage",(e=>this.onUnstageFile(e.detail))),B.on("gl-wip-details","data-action",(e=>this.onBranchAction(e.detail.name))),B.on("gl-wip-details","gl-inspect-create-suggestions",(e=>this.onSuggestChanges(e.detail))),B.on("gl-wip-details","gl-patch-generate-title",(e=>this.onCreateGenerateTitle(e.detail))),B.on("gl-wip-details","gl-show-code-suggestion",(e=>this.onShowCodeSuggestion(e.detail))),B.on("gl-wip-details","gl-patch-file-compare-previous",(e=>this.onCompareFileWithPrevious(e.detail))),B.on("gl-wip-details","gl-patch-file-open",(e=>this.onOpenFile(e.detail))),B.on("gl-wip-details","gl-patch-file-stage",(e=>this.onStageFile(e.detail))),B.on("gl-wip-details","gl-patch-file-unstage",(e=>this.onUnstageFile(e.detail))),B.on("gl-wip-details","gl-patch-create-cancelled",(()=>this.onDraftStateChanged(!1))),B.on("gl-status-nav,issue-pull-request","gl-issue-pull-request-details",(()=>this.onBranchAction("open-pr-details")))]}onSuggestChanges(e){this._hostIpc.sendCommand(ti,e)}onShowCodeSuggestion(e){this._hostIpc.sendCommand(vi,e)}onMessageReceived(e){switch(!0){case Oi.is(e):e.params.state,this.state=e.params.state,this.dispatchEvent(new CustomEvent("state-changed",{detail:this.state}));break;case Ri.is(e):this.state={...this.state,wip:e.params.wip,inReview:e.params.inReview},this.dispatchEvent(new CustomEvent("state-changed",{detail:this.state}));break;case Mi.is(e):this.onDraftStateChanged(e.params.inReview,!0);break;case Ti.is(e):this.state={...this.state,hasConnectedJira:e.params.hasConnectedJira},this.dispatchEvent(new CustomEvent("state-changed",{detail:this.state}));break;case Di.is(e):this.state={...this.state,hasAccount:e.params.hasAccount},this.dispatchEvent(new CustomEvent("state-changed",{detail:this.state}))}}disconnectedCallback(){this._disposables.forEach((e=>e.dispose())),this._disposables=[],super.disconnectedCallback()}renderTopInspect(){return null==this.state?.commit?Lt:Mt``}renderTopWip(){return null==this.state?.wip?Lt:Mt``}renderRepoStatusContent(e){const t=this.wipStatus?.status;return Mt`
${Qt(null!=this.wipStatus?.status,(()=>Mt``))}
${Qt(null!=t,(()=>Mt``))}
`}renderWipTooltipContent(){return null==this.wipStatus?"Overview":Mt`
Overview of ${this.wipStatus.branch}
${Qt("both"===this.wipStatus.status,(()=>Mt`
${this.wipStatus.branch} is
${P("commit",this.wipStatus.behind)} behind and
${P("commit",this.wipStatus.ahead)} ahead of
${this.wipStatus.upstream??"origin"}`))}
${Qt("behind"===this.wipStatus.status,(()=>Mt`
${this.wipStatus.branch} is
${P("commit",this.wipStatus.behind)} behind
${this.wipStatus.upstream??"origin"}`))}
${Qt("ahead"===this.wipStatus.status,(()=>Mt`
${this.wipStatus.branch} is
${P("commit",this.wipStatus.ahead)} ahead of
${this.wipStatus.upstream??"origin"}`))}
${Qt(this.wipStatus.working>0,(()=>Mt`
${P("working change",this.wipStatus.working)}`))}
`}renderTopSection(){const e="wip"===this.state?.mode;return Mt`