diffstalkerd 0.13.7 → 0.13.9
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.
|
@@ -9,7 +9,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(
|
|
|
9
9
|
`),r=n.endsWith(`
|
|
10
10
|
`)?n.slice(0,-1):n,i=r.split(`
|
|
11
11
|
`),a=Sg(t);if(a===null||i.some(e=>e.length>2e3))return{lines:i.map(yg),language:null};let o=hg.highlight(r,{language:a,ignoreIllegals:!0}).value;return{lines:xg(o),language:a}}function wg(e){return e?Sg(e):null}var Tg=/<span[^>]*class="([^"]*)"[^>]*>|<span[^>]*>|<\/span>|[^<]+/g;function Eg(e){return e.replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`).replace(/&/g,`&`)}function Dg(e,t){return Og(hg.highlight(e,{language:t,ignoreIllegals:!0}).value)}function Og(e){let t=[],n=[];for(let r of e.matchAll(Tg)){let e=r[0];e.charCodeAt(0)===60?e[1]===`/`?n.pop():n.push(r[1]??``):t.push({text:Eg(e),cls:n[n.length-1]??``})}return t}function kg(e){let t=[];for(let n of e){let e=t[t.length-1];e&&e.cls===n.cls&&e.changed===n.changed?e.text+=n.text:t.push({...n})}return t}function Ag(e,t){if(!t||t.length===0)return e.map(e=>({text:e.text,cls:e.cls,changed:!1}));let n=[],r=0,i=0,a=0,o=0;for(;r<e.length&&i<t.length;){let s=Math.min(e[r].text.length-a,t[i].text.length-o);s>0&&n.push({text:e[r].text.slice(a,a+s),cls:e[r].cls,changed:t[i].type===`changed`}),a+=s,o+=s,a===e[r].text.length&&(r++,a=0),i<t.length&&o===t[i].text.length&&(i++,o=0)}for(;r<e.length;){let t=e[r].text.slice(a);t&&n.push({text:t,cls:e[r].cls,changed:!1}),r++,a=0}return n}function jg(e,t){if(t===null)return null;let n=[],r=[];for(let t of e)if(t.kind!==`no-newline`){if(t.content.length>2e3)return null;t.kind!==`add`&&n.push(t),t.kind!==`del`&&r.push(t)}let i=new WeakMap;for(let e of[n,r]){if(e.length===0)continue;let n=hg.highlight(e.map(e=>e.content).join(`
|
|
12
|
-
`),{language:t,ignoreIllegals:!0}).value,r=xg(n);e.forEach((e,t)=>{let n=r[t];n!==void 0&&i.set(e,Og(n))})}return i}var Mg=new WeakMap;function Ng(e,t,n,r){let i=r?.get(e),a=`${n?`1`:`0`}|${t??``}|${i?`d`:`l`}`,o=Mg.get(e);if(o&&o.sig===a)return o.pieces;if(i!==void 0){let t=kg(Ag(i,e.segments));return Mg.set(e,{sig:a,pieces:t}),t}let s=n&&e.kind!==`no-newline`&&t!==null&&e.content.length<=2e3?kg(Ag(Dg(e.content,t),e.segments)):null;return Mg.set(e,{sig:a,pieces:s}),s}function Pg(e,t){return t?.kind===`del`?{key:e.key,left:e,right:null}:t?.kind===`add`?{key:e.key,left:null,right:e}:{key:e.key,left:e,right:e}}function Fg(e,t){let n=t,r=[];for(;n<e.length&&e[n].kind===`del`;)r.push(e[n++]);let i=n<e.length&&e[n].kind===`no-newline`?e[n++]:null,a=[];for(;n<e.length&&e[n].kind===`add`;)a.push(e[n++]);let o=i!==null&&a.length>0&&n<e.length&&e[n].kind===`no-newline`?e[n++]:null;return r.length===0&&a.length===0&&i===null&&n++,{dels:r,adds:a,midMarker:i,endMarker:o,next:n}}function Ig(e){let t=[],n=Math.max(e.dels.length,e.adds.length);for(let r=0;r<n;r++){let n=e.dels[r]??null,i=e.adds[r]??null;t.push({key:`${n?.key??`_`}|${i?.key??`_`}`,left:n,right:i})}return e.midMarker&&t.push({key:`${e.midMarker.key}|${e.endMarker?.key??`_`}`,left:e.midMarker,right:e.endMarker}),t}function Lg(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(r.kind===`no-newline`)t.push(Pg(r,e[n-1])),n++;else if(r.kind===`context`)t.push({key:r.key,left:r,right:r}),n++;else{let r=Fg(e,n);t.push(...Ig(r)),n=r.next}}return t}var Rg=new WeakMap;function zg(e){let t=Rg.get(e);return t||(t=Lg(e),Rg.set(e,t)),t}function Bg(e){return zg(e).length}var Vg=gr({__name:`DiffLineContent`,props:{row:{},pieces:{}},setup(e){return(t,n)=>e.pieces?(q(!0),J(K,{key:0},G(e.pieces,(e,t)=>(q(),J(`span`,{key:t,class:z([e.cls,{"word-hl":e.changed}])},B(e.text),3))),128)):e.row.segments?(q(!0),J(K,{key:1},G(e.row.segments,(e,t)=>(q(),J(`span`,{key:t,class:z({"word-hl":e.type===`changed`})},B(e.text),3))),128)):(q(),J(K,{key:2},[Z(B(e.row.content),1)],64))}}),Hg=[`title`],Ug=ef(gr({__name:`ViewFileButton`,props:{path:{}},setup(e){let t=e,n=Vl(),r=cl();function i(){tu({view:`explorer`}),n.setActiveView(`explorer`),r.revealFile(t.path)}return(e,n)=>(q(),J(`button`,{class:`view-file mono`,"data-testid":`view-file`,title:`Open ${t.path} in the Explorer`,onClick:n[0]||=Jo(e=>i(),[`stop`])},` view file `,8,Hg))}}),[[`__scopeId`,`data-v-18b50238`]]),Wg=[`title`],Gg=1500,Kg=ef(gr({__name:`CopyPathButton`,props:{path:{}},setup(e){let t=e,n=V(null),r=null;function i(e){n.value=e,r!==null&&clearTimeout(r),r=setTimeout(()=>{n.value=null,r=null},Gg)}Pr(()=>{r!==null&&clearTimeout(r)});async function a(){try{await navigator.clipboard.writeText(t.path),i(`copied`)}catch{i(`failed`)}}return(e,r)=>(q(),J(`button`,{class:`copy-path mono`,"data-testid":`copy-path`,title:`Copy ${t.path} to the clipboard`,onClick:r[0]||=Jo(e=>a(),[`stop`])},B(n.value===`copied`?`copied`:n.value===`failed`?`copy failed`:`copy path`),9,Wg))}}),[[`__scopeId`,`data-v-ccadb0c1`]]),qg=`→`;function Jg(e){switch(e){case`staged`:return`HEAD ${qg} index`;case`unstaged`:return`index ${qg} working tree`;case`both`:return`HEAD ${qg} working tree`;case`untracked`:return`nothing ${qg} new file`}}function Yg(e){switch(e.kind){case`working`:return e.status===`untracked`?`new file ${qg} working tree`:e.status===`deleted`?e.staged?`HEAD ${qg} deleted`:`index ${qg} deleted`:e.staged?`HEAD ${qg} index`:`index ${qg} working tree`;case`compare`:return`${e.base??`base`}…${e.head??`HEAD`}`;case`compare-uncommitted`:return Jg(e.side);case`commit`:return`${e.shortHash}^ ${qg} ${e.shortHash}`;case`journal`:return`HEAD ${qg} working tree`}}function Xg(e){switch(e.kind){case`working`:return e.status===`untracked`?`A new file: every line is an addition`:e.status===`deleted`?`The file was deleted; every line is a removal`:e.staged?`What you have staged: HEAD compared against the index`:`What you have not staged yet: the index compared against the file on disk`;case`compare`:return e.head===null?`Everything this branch adds on top of its base (three-dot diff)`:`Everything ${e.head} adds on top of the layer below it (three-dot diff)`;case`compare-uncommitted`:return`Uncommitted work: ${Jg(e.side)} — not the compare base`;case`commit`:return`What this commit changed, against its parent`;case`journal`:return`The working tree compared against HEAD`}}var Zg=[`title`],Qg=ef(gr({__name:`RefPairLabel`,props:{pair:{}},setup(e){let t=e,n=$(()=>Yg(t.pair)),r=$(()=>Xg(t.pair));return(e,t)=>(q(),J(`span`,{class:`ref-pair mono`,"data-testid":`ref-pair`,title:r.value},B(n.value),9,Zg))}}),[[`__scopeId`,`data-v-4d0265c4`]]),$g=[`disabled`,`aria-pressed`,`title`],e_=ef(gr({__name:`WholeFileToggle`,props:{on:{type:Boolean},busy:{type:Boolean},disabled:{type:Boolean},disabledReason:{}},emits:[`toggle`],setup(e){return(t,n)=>(q(),J(`button`,{class:z([`whole-file mono`,{on:e.on}]),"data-testid":`whole-file`,disabled:e.disabled||e.busy,"aria-pressed":e.on,title:e.disabled?e.disabledReason??`This file has no wider view`:e.on?`Back to hunks`:`Show the whole file, with the changes marked`,onClick:n[0]||=Jo(e=>t.$emit(`toggle`),[`stop`])},B(e.busy?`loading…`:e.on?`hunks`:`whole file`),11,$g))}}),[[`__scopeId`,`data-v-cf336a00`]]),t_={key:0,class:`diff-empty`,"data-testid":`diff-empty`},n_={key:0,"data-testid":`not-shown-note`},r_={key:2},i_={key:0,class:`file-header`,"data-testid":`file-section-header`},a_={class:`pin-x`},o_={class:`file-path`},s_={class:`pin-x`},c_=[`data-edited-at`],l_={class:`hunk-header`,"data-testid":`hunk-header`},u_={class:`pin-x`},d_={key:0,class:`ranges`},f_={key:1,class:`ranges`},p_={key:2,class:`hunk-context`},m_={key:3,class:`hunk-time`,"data-testid":`hunk-time`},h_={class:`ln code-gutter old`},g_={class:`ln code-gutter new`},__={class:`marker`},v_={class:`content code-cell`},y_={key:1,class:`split-body`},b_={class:`split-side left`},x_={class:`ln code-gutter`},S_={class:`marker`},C_={class:`content code-cell`},w_={class:`split-side right`},T_={class:`ln code-gutter`},E_={class:`marker`},D_={class:`content code-cell`},O_=1500,k_=6e4,A_=ef(gr({__name:`DiffView`,props:{diff:{},filePath:{},mode:{},syntax:{type:Boolean},refPair:{},showWholeToggle:{type:Boolean},wholePath:{},wholeLoading:{type:Boolean},wholeRefusal:{},wrap:{type:Boolean},showFileHeaders:{type:Boolean},embedded:{type:Boolean}},emits:[`toggle-whole`],setup(e,{emit:t}){let n=e,r=t,i=$(()=>{let e=new Map;for(let t of l.value.sections)e.set(t.key,wg(t.filePath??n.filePath));return e}),a=$(()=>{let e=new Map;if(n.syntax!==!0||n.wholePath==null)return e;for(let t of l.value.sections){if((t.filePath??n.filePath)!==n.wholePath)continue;let r=t.hunks.flatMap(e=>e.rows);e.set(t.key,jg(r,i.value.get(t.key)??null))}return e});function o(e,t){return Ng(e,i.value.get(t.key)??null,n.syntax===!0,a.value.get(t.key))}function s(e,t){return e?o(e,t):null}let c=$(()=>n.mode===`split`),l=$(()=>Wc(n.diff)),u=$(()=>n.showFileHeaders||l.value.sections.filter(e=>e.filePath!==null).length>1),d=V(Date.now()),f=null;function p(){let e=l.value.latestEditedAt;return e!==void 0&&Date.now()-e<k_}function m(){f!==null&&(clearInterval(f),f=null)}function h(){p()?f===null&&(f=setInterval(()=>{d.value=Date.now(),p()||m()},1e3)):m()}W(()=>l.value.latestEditedAt,h,{immediate:!0}),Pr(m);function g(e){return e.editedAt===void 0?``:Od(e.editedAt,d.value)}function _(e){return e.editedAt!==void 0&&d.value-e.editedAt<O_}function v(e){return e.kind===`add`?`+`:e.kind===`del`?`-`:``}let y=$(()=>l.value.sections.some(e=>e.notes.length>0)),b=V(null),x=!1;function S(e){let t=e.target;if(x||!(t instanceof HTMLElement)||!t.classList.contains(`split-side`))return;x=!0;let n=t.scrollLeft;b.value?.querySelectorAll(`.split-side`).forEach(e=>{e!==t&&e.scrollLeft!==n&&(e.scrollLeft=n)}),requestAnimationFrame(()=>{x=!1})}return jr(()=>{b.value?.addEventListener(`scroll`,S,!0)}),Pr(()=>{b.value?.removeEventListener(`scroll`,S,!0)}),(t,n)=>l.value.rowCount===0?(q(),J(`div`,t_,[l.value.notShown?(q(),J(`p`,n_,B(l.value.notShown.note),1)):y.value?(q(),J(K,{key:1},[(q(!0),J(K,null,G(l.value.sections.flatMap(e=>e.notes),(e,t)=>(q(),J(`p`,{key:t,class:`empty-note mono`},B(e),1))),128)),n[0]||=Y(`p`,null,`No text changes to show.`,-1)],64)):(q(),J(`p`,r_,`No changes to show.`))])):(q(),J(`div`,{key:1,ref_key:`rootEl`,ref:b,class:z([`diff-scroll mono`,{"with-file-headers":u.value,split:c.value,embedded:e.embedded,wrap:e.wrap}]),"data-testid":`diff-view`,style:le({"--ln-w":`${l.value.lineNumWidth}ch`})},[(q(!0),J(K,null,G(l.value.sections,t=>(q(),J(`section`,{key:t.key,class:`file-section`},[u.value&&t.filePath?(q(),J(`div`,i_,[Y(`span`,a_,[Y(`span`,o_,B(t.filePath),1),e.refPair?(q(),ga(Qg,{key:0,pair:e.refPair},null,8,[`pair`])):Q(``,!0),e.showWholeToggle?(q(),ga(e_,{key:1,on:e.wholePath===t.filePath,busy:e.wholeLoading&&e.wholePath===t.filePath,disabled:e.wholeRefusal?.key===t.filePath,"disabled-reason":e.wholeRefusal?.key===t.filePath?e.wholeRefusal.reason:void 0,onToggle:e=>r(`toggle-whole`,t.filePath)},null,8,[`on`,`busy`,`disabled`,`disabled-reason`,`onToggle`])):Q(``,!0),X(Ug,{path:t.filePath},null,8,[`path`]),X(Kg,{path:t.filePath},null,8,[`path`])])])):Q(``,!0),(q(!0),J(K,null,G(t.notes,(e,t)=>(q(),J(`div`,{key:t,class:`file-note`},[Y(`span`,s_,B(e),1)]))),128)),(q(!0),J(K,null,G(t.hunks,e=>(q(),J(`section`,{key:e.key,class:z([`hunk`,{flash:_(e)}]),"data-edited-at":e.editedAt},[Y(`div`,l_,[Y(`span`,u_,[e.oldRange?(q(),J(`span`,d_,`Lines `+B(e.oldRange)+` → `+B(e.newRange),1)):(q(),J(`span`,f_,B(e.raw),1)),e.context?(q(),J(`span`,p_,B(e.context),1)):Q(``,!0),e.editedAt===void 0?Q(``,!0):(q(),J(`span`,m_,B(g(e)),1))])]),c.value?(q(),J(`div`,y_,[Y(`div`,b_,[(q(!0),J(K,null,G(U(zg)(e.rows),e=>(q(),J(`div`,{key:e.key,class:z([`split-line`,[e.left?e.left.kind:`empty`]])},[Y(`span`,x_,B(e.left?.oldLineNum??``),1),Y(`span`,S_,B(e.left&&e.left.kind===`del`?`-`:``),1),Y(`span`,C_,[e.left?(q(),ga(Vg,{key:0,row:e.left,pieces:s(e.left,t)},null,8,[`row`,`pieces`])):Q(``,!0)])],2))),128))]),Y(`div`,w_,[(q(!0),J(K,null,G(U(zg)(e.rows),e=>(q(),J(`div`,{key:e.key,class:z([`split-line`,[e.right?e.right.kind:`empty`]])},[Y(`span`,T_,B(e.right?.newLineNum??``),1),Y(`span`,E_,B(e.right&&e.right.kind===`add`?`+`:``),1),Y(`span`,D_,[e.right?(q(),ga(Vg,{key:0,row:e.right,pieces:s(e.right,t)},null,8,[`row`,`pieces`])):Q(``,!0)])],2))),128))])])):(q(!0),J(K,{key:0},G(e.rows,e=>(q(),J(`div`,{key:e.key,class:z([`row`,e.kind])},[Y(`span`,h_,B(e.oldLineNum??``),1),Y(`span`,g_,B(e.newLineNum??``),1),Y(`span`,__,B(v(e)),1),Y(`span`,v_,[X(Vg,{row:e,pieces:o(e,t)},null,8,[`row`,`pieces`])])],2))),128))],10,c_))),128))]))),128))],6))}}),[[`__scopeId`,`data-v-61cf2024`]]),j_=[`aria-pressed`,`title`],M_=ef(gr({__name:`WrapToggle`,setup(e){let t=Vl();return(e,n)=>(q(),J(`button`,{class:z([`wrap-toggle mono`,{on:U(t).wrapEnabled}]),"data-testid":`wrap-toggle`,"aria-pressed":U(t).wrapEnabled,"aria-label":`Wrap long lines`,title:U(t).wrapEnabled?`Wrap long lines: on. Click to scroll horizontally instead`:`Wrap long lines: off. Click to wrap instead of scrolling horizontally`,onClick:n[0]||=e=>U(t).toggleWrap()},` Wrap `,10,j_))}}),[[`__scopeId`,`data-v-f7064b49`]]),N_={class:`probe-viewport`},P_=[`data-key`],F_=[`aria-expanded`,`aria-label`,`onClick`],I_=[`data-status`],L_=[`title`],R_={class:`path-head`},z_={class:`path-tail`},B_={key:2,class:`uncommitted-tag mono`},V_={class:`row-stats mono`},H_={key:0,class:`count-add`},U_={key:1,class:`count-del`},W_=[`title`],G_={key:2,class:`load-diff`},K_=[`onClick`],q_={class:`load-diff-size`},J_=`\0`,Y_=new WeakMap;function X_(e){let t=Y_.get(e);if(t===void 0){t=null;for(let n of e.lines)if(n.type===`header`){if(n.content.startsWith(`Binary files`)){t={kind:`binary`,note:`Binary file — no text diff to show.`};break}if(n.content.startsWith(`Large file — diff not shown`)){t={kind:`large`,note:n.content};break}}Y_.set(e,t)}return t}var Z_=.1;function Q_(e,t){return Math.abs(e.rowH-t.rowH)<Z_&&Math.abs(e.hunkHeaderH-t.hunkHeaderH)<Z_&&Math.abs(e.hunkBorderB-t.hunkBorderB)<Z_&&Math.abs(e.fileHeaderH-t.fileHeaderH)<Z_&&Math.abs(e.noteH-t.noteH)<Z_&&Math.abs(e.sectionGap-t.sectionGap)<Z_&&Math.abs(e.scrollbarH-t.scrollbarH)<Z_}var $_={lines:[{type:`header`,content:`diff --git a/__probe__/a b/__probe__/a`},{type:`header`,content:`new file mode 100644`},{type:`hunk`,content:`@@ -0,0 +1,2 @@`},{type:`addition`,content:`+one`,newLineNum:1},{type:`addition`,content:`+two`,newLineNum:2},{type:`hunk`,content:`@@ -10 +11 @@ probe`},{type:`context`,content:` ctx`,oldLineNum:10,newLineNum:11},{type:`header`,content:`diff --git a/__probe__/b b/__probe__/b`},{type:`hunk`,content:`@@ -1 +1 @@`},{type:`deletion`,content:`-x`,oldLineNum:1},{type:`addition`,content:`+y`,newLineNum:1}]},ev=2,tv=1500,nv=ef(gr({__name:`DiffStack`,props:{files:{},activeKey:{},syntax:{type:Boolean},mode:{},wrap:{type:Boolean},mediaKeys:{},wholeKey:{},wholeLoading:{type:Boolean},showWholeToggle:{type:Boolean},wholeRefusal:{}},emits:[`active-file`,`toggle-collapse`,`toggle-whole`],setup(e,{expose:t,emit:n}){let r=e,i=n,a=V(null),o=V(null),s=new Map;function c(e,t){t instanceof HTMLElement?s.set(e,t):s.delete(e)}function l(e){return e.diff===null?null:X_(e.diff)}function u(e){return l(e)?.kind===`binary`&&(r.mediaKeys?.has(e.key)??!1)}let d=Bt(new Set),f=new Set;function p(e){for(let t of e)t.stats.insertions+t.stats.deletions<=1500&&f.add(t.key)}p(r.files);function m(e){return e.stats.insertions+e.stats.deletions>tv}function h(e){return e.status!==`untracked`&&e.status!==`added`}function g(e){if(r.wholeRefusal?.key===e.key)return r.wholeRefusal.reason;let t=l(e);return t===null?_(e)?`Load the diff first`:null:t.kind===`binary`?`Binary file — there is no text to show`:`Diff withheld: this file is over the size cap`}function _(e){return m(e)&&l(e)===null&&!d.has(e.key)&&!f.has(e.key)}function v(e){return!!e.collapsed||_(e)}function y(e){d.add(e),On(()=>ge.invalidateOffsets())}function b(){let e=r.files.filter(e=>_(e));for(let t of e)d.add(t.key);return e.length>0&&On(()=>ge.invalidateOffsets()),e.length}let x=V(null),S=$_,C=V(null),w=null;function T(){let e=x.value;if(!e)return;let t=e.querySelector(`.diff-scroll`),n=e.querySelector(`.row`),r=e.querySelector(`.hunk`),i=e.querySelector(`.hunk-header`),a=e.querySelector(`.file-header`),o=e.querySelector(`.file-note`),s=e.querySelectorAll(`.file-section`);if(!t||!n||!r||!i||!a||!o||s.length<2)return;let c=n.getBoundingClientRect().height;if(c<=0)return;let l=i.getBoundingClientRect().height,u={rowH:c,hunkHeaderH:l,hunkBorderB:Math.max(0,r.getBoundingClientRect().height-l-ev*c),fileHeaderH:a.getBoundingClientRect().height,noteH:o.getBoundingClientRect().height,sectionGap:s[1].getBoundingClientRect().top-s[0].getBoundingClientRect().bottom,scrollbarH:Math.max(0,t.offsetHeight-t.clientHeight)},d=C.value;d!==null&&Q_(d,u)||(oe.prepare({survivingKeys:se(ne),changedEls:[null]}),C.value=u,document.documentElement.style.setProperty(`--row-h`,`${c}px`),k={},ge.invalidateOffsets(),On(()=>{oe.restore(),P()}))}function E(e){if(e.diff){let t=Uc(e.diff,e.staged??!1).rowCount;if(t>0)return Math.max(t*20,48)}let t=e.stats.insertions+e.stats.deletions,n=Math.max(1,Math.ceil(t/10));return Math.max((t+n*7)*20,48)}function D(e){if(r.wrap)return null;let t=C.value;if(!t||!e.diff)return null;let n=Uc(e.diff,e.staged??!1);if(n.rowCount===0)return null;let i=n.sections.filter(e=>e.filePath!==null).length>1,a=r.mode===`split`?t.scrollbarH:0;return n.sections.forEach((e,n)=>{n>0&&(a+=t.sectionGap),i&&e.filePath!==null&&(a+=t.fileHeaderH),a+=e.notes.length*t.noteH,e.hunks.forEach((n,i)=>{let o=r.mode===`split`?Bg(n.rows):n.rows.length;a+=t.hunkHeaderH+o*t.rowH,i<e.hunks.length-1&&(a+=t.hunkBorderB)})}),a}function O(e){return`auto ${D(e)??E(e)}px`}let k={},A={notShownBinaryH:`.not-shown-binary`,notShownLargeH:`.not-shown-large`,notShownMediaH:`.not-shown-media`,loadDiffH:`.load-diff`};function j(){if(k.toolbarH===void 0){if(!o.value)return null;k.toolbarH=o.value.getBoundingClientRect().height}return k.toolbarH??null}function M(){if(k.borderY===void 0)for(let e of s.values()){let t=getComputedStyle(e);k.borderY=(parseFloat(t.borderTopWidth)||0)+(parseFloat(t.borderBottomWidth)||0)+(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0);break}return k.borderY??null}function N(){if(k.headerH===void 0)for(let e of s.values()){let t=e.querySelector(`.file-diff-header`);if(t){k.headerH=t.getBoundingClientRect().height;break}}return k.headerH??null}function P(){let e=a.value,t=N();e&&t!==null&&e.style.setProperty(`--stack-header-h`,`${t}px`)}function F(){if(r.files.length<=1)return 0;if(k.gap===void 0){let e=s.get(r.files[1].key);if(!e)return null;k.gap=parseFloat(getComputedStyle(e).marginTop)||0}return k.gap}function I(e,t){if(k[e]===void 0){let n=s.get(t)?.querySelector(A[e]);if(!n)return null;k[e]=n.getBoundingClientRect().height}return k[e]??null}function L(e){let t=l(e);return t===null?_(e)?`loadDiffH`:null:u(e)?`notShownMediaH`:t.kind===`binary`?`notShownBinaryH`:`notShownLargeH`}function ee(e){return l(e)?.kind===`binary`?`not-shown-binary`:`not-shown-large`}function R(e,t,n){if(e.collapsed)return n+t;let r=L(e);if(r!==null){let i=I(r,e.key);return i===null?null:n+t+i}return n+t+(D(e)??E(e))}function te(){if(C.value===null||r.wrap)return null;let e=N(),t=F(),n=j(),i=M();if(e===null||t===null||n===null||i===null)return null;let a=new Map(r.files.map(e=>[e.key,e]));return{start:n,gap:t,heightFor:t=>{let n=a.get(t);return n===void 0?null:R(n,e,i)}}}let ne=r.files;function re(e,t){return`${e}${J_}${t}`}function ie(){let e=[];for(let t of ne){let n=s.get(t.key);if(!n||(e.push({key:t.key,kind:`file`,fileKey:t.key,el:n}),v(t)||!t.diff))continue;let r=Uc(t.diff,t.staged??!1),i=n.querySelectorAll(`.hunk`),a=0;for(let n of r.sections)for(let r of n.hunks){let n=i[a++];n&&e.push({key:re(t.key,r.key),kind:`hunk`,fileKey:t.key,el:n})}}return e}function ae(e){let t=e.indexOf(J_);if(t===-1)return s.get(e)??null;let n=e.slice(0,t),i=e.slice(t+1),a=s.get(n),o=r.files.find(e=>e.key===n);if(!a||!o?.diff||v(o))return null;let c=Uc(o.diff,o.staged??!1),l=0;for(let e of c.sections)for(let t of e.hunks){if(t.key===i)return a.querySelectorAll(`.hunk`)[l]??null;l++}return null}let oe=Ym(a,{candidates:ie,resolve:ae,isTweenActive:()=>ge.isTweening()});function se(e){let t=new Set;for(let n of e){if(t.add(n.key),!n.diff||v(n))continue;let e=Uc(n.diff,n.staged??!1);for(let r of e.sections)for(let e of r.hunks)t.add(re(n.key,e.key))}return t}function ce(e){let t=[],n=[],r=new Map(ne.map(e=>[e.key,e])),i=new Set(e.map(e=>e.key));for(let e of ne)i.has(e.key)||t.push(s.get(e.key)??null);for(let i of e){let e=r.get(i.key);e?(e.diff!==i.diff||v(e)!==v(i))&&(t.push(s.get(i.key)??null),n.push(i.key)):(t.push(null),n.push(i.key))}return t.length===0&&(e.length===ne.length&&e.every((e,t)=>e.key===ne[t].key)||t.push(null)),{els:t,changedKeys:n}}let ue=[];W(()=>r.files,e=>{let t=ce(e);ue=t.changedKeys,oe.prepare({survivingKeys:se(e),changedEls:t.els}),p(e)},{flush:`pre`}),W(()=>r.files,e=>{oe.restore(),ne=e,ge.invalidateOffsets();for(let e of ue){let t=de.get(e);t&&fe.set(t,t.getBoundingClientRect().height)}ue=[]},{flush:`post`}),W(()=>[r.mode,r.wrap,r.mediaKeys],()=>{oe.prepare({survivingKeys:se(ne),changedEls:[null]})},{flush:`pre`}),W(()=>[r.mode,r.wrap,r.mediaKeys],()=>{oe.restore(),ge.invalidateOffsets();for(let e of de.values())fe.set(e,e.getBoundingClientRect().height)},{flush:`post`});let de=new Map,fe=new WeakMap,pe=typeof ResizeObserver<`u`?new ResizeObserver(e=>{for(let t of e){let e=t.target,n=t.borderBoxSize?.[0]?.blockSize??e.getBoundingClientRect().height,r=fe.get(e);fe.set(e,n),r!==void 0&&r!==n&&ge.invalidateOffsets()}}):null;function me(e,t){let n=de.get(e);if(t instanceof HTMLElement){if(n===t)return;n&&pe?.unobserve(n),de.set(e,t),pe?.observe(t)}else n&&(pe?.unobserve(n),de.delete(e))}jr(()=>{T(),On(()=>P());let e=x.value?.querySelector(`.row`);e&&typeof ResizeObserver<`u`&&(w=new ResizeObserver(()=>T()),w.observe(e)),window.addEventListener(`resize`,T)}),Pr(()=>{w?.disconnect(),pe?.disconnect(),window.removeEventListener(`resize`,T)});function he(){let e=[];for(let t of r.files){let n=s.get(t.key);n&&e.push({key:t.key,el:n})}return e}let ge=ih(a,{sections:he,sectionHeights:te,stickyOffset:0,onActiveKey:e=>i(`active-file`,e)});W(gu(),()=>{k.gap=void 0,ge.invalidateOffsets()},{flush:`post`});function _e(e,t){ge.scrollToKey(e,t)}function ve(e,t,n){ge.scrollToTarget(()=>{let n=a.value,r=s.get(e);if(!n||!r)return null;let i=t(),o=i===null?null:ae(re(e,i));if(!o||o.offsetParent===null)return r.offsetTop-0;let c=r.querySelector(`.file-diff-header`)?.offsetHeight??0;return o.getBoundingClientRect().top-n.getBoundingClientRect().top+n.scrollTop-0-c},{...n,activeKey:e})}function ye(e){s.get(e)?.focus({preventScroll:!0})}return t({scrollToFile:_e,scrollToHunk:ve,expandAllGated:b,focusFile:ye,scrollerEl:a,isTweening:ge.isTweening,lastUserScrollAt:ge.lastUserScrollAt}),(t,n)=>(q(),J(`div`,{ref_key:`scrollerEl`,ref:a,class:`stack-scroller`},[Y(`div`,{ref_key:`probeEl`,ref:x,class:`size-probe`,"aria-hidden":`true`},[Y(`div`,N_,[X(A_,{diff:U(S),"show-file-headers":``},null,8,[`diff`])])],512),Y(`div`,{ref_key:`toolbarEl`,ref:o,class:`stack-toolbar`},[X(M_)],512),(q(!0),J(K,null,G(e.files,a=>(q(),J(`section`,{key:a.key,ref_for:!0,ref:e=>c(a.key,e),class:z([`file-diff`,{selected:a.key===e.activeKey,uncommitted:a.uncommitted}]),"data-key":a.key,"data-testid":`file-diff`,tabindex:`-1`},[Y(`header`,{class:z([`file-diff-header`,{uncommitted:a.uncommitted}])},[Y(`button`,{class:`collapse-btn mono`,"aria-expanded":!v(a),"aria-label":`${v(a)?`Expand`:`Collapse`} ${a.path}`,onClick:e=>_(a)?y(a.key):i(`toggle-collapse`,a.key)},B(v(a)?`▸`:`▾`),9,F_),Y(`span`,{class:`letter mono`,"data-status":a.status},B(U(ql)(a.status)),9,I_),Y(`span`,{class:`path mono`,title:a.path},[Y(`span`,R_,B(U(Xl)(a.path).head),1),Y(`span`,z_,B(U(Xl)(a.path).tail),1)],8,L_),a.refPair?(q(),ga(Qg,{key:0,pair:a.refPair},null,8,[`pair`])):Q(``,!0),r.showWholeToggle&&h(a)?(q(),ga(e_,{key:1,on:r.wholeKey===a.key,busy:r.wholeLoading&&r.wholeKey===a.key,disabled:g(a)!==null,"disabled-reason":g(a)??void 0,onToggle:e=>i(`toggle-whole`,a.key)},null,8,[`on`,`busy`,`disabled`,`disabled-reason`,`onToggle`])):Q(``,!0),X(Ug,{path:a.path},null,8,[`path`]),X(Kg,{path:a.path},null,8,[`path`]),a.uncommitted?(q(),J(`span`,B_,B(a.uncommitted===`both`?`[uncommitted]`:`[${a.uncommitted}]`),1)):Q(``,!0),Y(`span`,V_,[a.stats.insertions?(q(),J(`span`,H_,`+`+B(a.stats.insertions),1)):Q(``,!0),a.stats.deletions?(q(),J(`span`,U_,`−`+B(a.stats.deletions),1)):Q(``,!0)])],2),u(a)?Vn((q(),J(`div`,{key:0,ref_for:!0,ref:e=>me(a.key,e),class:`not-shown-media`,"data-testid":`not-shown-media`},[Gr(t.$slots,`media`,{file:a},void 0,!0)],512)),[[lo,!a.collapsed]]):l(a)?Vn((q(),J(`div`,{key:1,class:z([`not-shown-note`,ee(a)]),title:l(a)?.note,"data-testid":`not-shown-note`},B(l(a)?.note),11,W_)),[[lo,!a.collapsed]]):_(a)?Vn((q(),J(`div`,G_,[Y(`button`,{class:`load-diff-btn mono chrome-chip`,"data-testid":`load-diff`,onClick:e=>y(a.key)},[n[0]||=Z(` Load diff `,-1),Y(`span`,q_,`(`+B(a.stats.insertions+a.stats.deletions)+` changed lines)`,1)],8,K_)],512)),[[lo,!a.collapsed]]):Vn((q(),J(`div`,{key:3,ref_for:!0,ref:e=>me(a.key,e),class:z([`file-diff-body`,{"wrap-mode":r.wrap}]),style:le({containIntrinsicSize:O(a)})},[a.diff?(q(),ga(A_,{key:0,diff:a.diff,"file-path":a.path,syntax:r.syntax,mode:r.mode,wrap:r.wrap,"whole-path":r.wholeKey===a.key?a.path:null,embedded:``},null,8,[`diff`,`file-path`,`syntax`,`mode`,`wrap`,`whole-path`])):(q(),J(`div`,{key:1,class:`placeholder`,"data-testid":`diff-placeholder`,style:le({height:`${E(a)}px`})},null,4))],6)),[[lo,!a.collapsed]])],10,P_))),128))],512))}}),[[`__scopeId`,`data-v-c00d9c88`]]),rv=8388608,iv=2097152,av=8192,ov=16777216,sv=33554432;function cv(e){return Array.from(e,e=>e.charCodeAt(0))}cv(`GIF87a`),cv(`GIF89a`),cv(`ftyp`);function lv(e){return{offset:8,bytes:cv(e)}}cv(`RIFF`),lv(`WEBP`),lv(`avif`),lv(`avis`),lv(`heic`),lv(`heix`),lv(`heim`),lv(`heis`),lv(`hevc`),lv(`hevx`),lv(`mif1`),lv(`msf1`),cv(`BM`);function uv(e){return`${Math.floor(e/1e6)} MB`}function dv(e){return`${Math.floor(e/1e6)} MP`}var fv={"not-an-image":null,malformed:null,"header-not-found":null,"unsupported-format":`no preview (format not rendered)`,animation:`no preview (animated PNG not rendered)`,"too-large":`no preview (over the preview size cap: ${uv(rv)}, or ${uv(iv)} for GIF)`,"too-many-pixels":`no preview (over the preview pixel budget: ${av} px per side, ${dv(ov)} per image, 256 frames, or ${dv(sv)} across an animation)`};function pv(e){let t=e===null?null:fv[e];return t===null?`No preview`:t[0].toUpperCase()+t.slice(1)}var mv=[`src`,`width`,`height`],hv={key:1,class:`frame-note`,"data-testid":`image-loading`},gv={key:2,class:`frame-note`,"data-testid":`image-failed`},_v=`Image preview`,vv=ef(gr({__name:`ImageFrame`,props:{src:{},width:{},height:{},fit:{}},emits:[`ok`,`fail`],setup(e,{emit:t}){let n=e,r=t,i=V(`loading`);W(()=>n.src,()=>{i.value=`loading`});function a(e){let t=e.target;t.naturalWidth===0||t.naturalHeight===0?o():(i.value=`ok`,r(`ok`))}function o(){i.value=`failed`,r(`fail`)}return(t,n)=>(q(),J(`div`,{class:z([`image-frame`,e.fit]),"data-testid":`image-frame`,tabindex:`0`,role:`group`,"aria-label":`Image preview`},[i.value===`failed`?Q(``,!0):(q(),J(`img`,{key:0,class:z([`image`,{ready:i.value===`ok`}]),"data-testid":`image`,src:e.src,width:e.width,height:e.height,alt:_v,loading:`lazy`,decoding:`async`,referrerpolicy:`no-referrer`,draggable:`false`,onLoad:a,onError:o},null,42,mv)),i.value===`loading`?(q(),J(`p`,hv,`Loading…`)):i.value===`failed`?(q(),J(`p`,gv,` Preview failed to decode `)):Q(``,!0)],2))}}),[[`__scopeId`,`data-v-1c7a4b88`]]),yv={class:`image-meta mono`,"data-testid":`image-meta`},bv={class:`side-meta`},xv={class:`side-meta`},Sv={key:0,class:`delta`,"data-testid":`image-byte-delta`},Cv={key:1,class:`hint`,"data-testid":`image-metadata-hint`},wv={class:`half old`,"data-testid":`image-old`},Tv={key:1,class:`plate`,"data-testid":`image-refused`},Ev={class:`half new`,"data-testid":`image-new`},Dv={key:1,class:`plate`,"data-testid":`image-refused`},Ov={class:`image-controls`},kv={class:`mode-picker`,role:`radiogroup`,"aria-label":`Image comparison mode`,"data-testid":`image-diff-mode`},Av=[`aria-checked`,`data-mode`,`onClick`],jv=[`disabled`],Mv=ef(gr({__name:`ImageDiffView`,props:{pair:{},repoId:{}},emits:[`fail`],setup(e,{emit:t}){let n=e,r=t,i=Vl(),a=[{value:`side-by-side`,label:`Side by side`},{value:`swipe`,label:`Swipe`},{value:`onion`,label:`Onion`}],o=V(50);function s(e){return e!==null&&e.image!==null}let c=$(()=>s(n.pair.old)),l=$(()=>s(n.pair.new)),u=$(()=>{let e=n.pair.old?.image,t=n.pair.new?.image;return!!e&&!!t&&e.width===t.width&&e.height===t.height}),d=$(()=>i.imageDiffMode!==`side-by-side`&&c.value&&l.value&&u.value?i.imageDiffMode:`side-by-side`),f=$(()=>d.value!==`side-by-side`),p=$(()=>({"--swipe":String(o.value),"--onion":String(o.value/100)}));function m(e){return Us(n.repoId,{path:e.path,side:e.side,version:e.version})}let h=V(!1),g=V(!1);W(()=>n.pair,()=>{h.value=!1,g.value=!1}),W([h,g],()=>{let e=!c.value||h.value,t=!l.value||g.value;e&&t&&r(`fail`)});function _(e){if(e===null)return`—`;let t=[Kl(e.bytes)];return e.image&&t.push(`${e.image.width} × ${e.image.height}`),t.push(e.oid===null?`working tree`:e.oid.slice(0,7)),t.join(` · `)}let v=$(()=>_(n.pair.old)),y=$(()=>_(n.pair.new)),b=$(()=>{let e=n.pair.old?.bytes,t=n.pair.new?.bytes;return e===void 0||t===void 0||e===t?null:`${t>e?`+`:`−`}${Kl(Math.abs(t-e))}`}),x=$(()=>u.value&&b.value!==null);function S(e,t){return e===null?`No version on this side`:t?`Preview failed to decode`:pv(e.refusal)}return(t,n)=>(q(),J(`div`,{class:z([`image-diff`,d.value]),"data-testid":`image-diff`},[Y(`p`,yv,[Y(`span`,bv,`old `+B(v.value),1),n[3]||=Y(`span`,{class:`arrow`,"aria-hidden":`true`},`→`,-1),Y(`span`,xv,`new `+B(y.value),1),b.value?(q(),J(`span`,Sv,`(`+B(b.value)+`)`,1)):Q(``,!0),x.value?(q(),J(`span`,Cv,` same dimensions, different bytes — the change may be metadata only (EXIF/ICC) `)):Q(``,!0)]),Y(`div`,{class:z([`image-stage`,d.value]),style:le(p.value)},[Y(`div`,wv,[e.pair.old&&e.pair.old.image&&!h.value?(q(),ga(vv,{key:0,src:m(e.pair.old),width:e.pair.old.image.width,height:e.pair.old.image.height,fit:`fit`,onFail:n[0]||=e=>h.value=!0},null,8,[`src`,`width`,`height`])):(q(),J(`p`,Tv,B(S(e.pair.old,h.value)),1))]),Y(`div`,Ev,[e.pair.new&&e.pair.new.image&&!g.value?(q(),ga(vv,{key:0,src:m(e.pair.new),width:e.pair.new.image.width,height:e.pair.new.image.height,fit:`fit`,onFail:n[1]||=e=>g.value=!0},null,8,[`src`,`width`,`height`])):(q(),J(`p`,Dv,B(S(e.pair.new,g.value)),1))])],6),Y(`div`,Ov,[Y(`div`,kv,[(q(),J(K,null,G(a,e=>Y(`button`,{key:e.value,class:z([`mode-btn mono`,{on:U(i).imageDiffMode===e.value}]),role:`radio`,"aria-checked":U(i).imageDiffMode===e.value,"data-mode":e.value,onClick:t=>U(i).setImageDiffMode(e.value)},B(e.label),11,Av)),64))]),Vn(Y(`input`,{"onUpdate:modelValue":n[2]||=e=>o.value=e,class:z([`swipe-range`,{inert:!f.value}]),"data-testid":`image-diff-swipe`,type:`range`,min:`0`,max:`100`,step:`1`,"aria-label":`Swipe between old and new`,disabled:!f.value},null,10,jv),[[Go,o.value,void 0,{number:!0}]])])],2))}}),[[`__scopeId`,`data-v-357863f9`]]),Nv=[`aria-orientation`,`aria-label`,`aria-valuenow`,`aria-valuemin`,`aria-valuemax`],Pv=ef(gr({__name:`SplitResizer`,props:{split:{},label:{}},setup(e){return(t,n)=>(q(),J(`div`,{class:`row-resizer`,role:`separator`,"aria-orientation":e.split.ariaOrientation.value,"aria-label":e.label,"aria-valuenow":e.split.ariaValueNow.value,"aria-valuemin":e.split.ariaValueMin.value,"aria-valuemax":e.split.ariaValueMax.value,tabindex:`0`,onPointerdown:n[0]||=(...t)=>e.split.onPointerDown&&e.split.onPointerDown(...t),onPointermove:n[1]||=(...t)=>e.split.onPointerMove&&e.split.onPointerMove(...t),onPointerup:n[2]||=(...t)=>e.split.onPointerUp&&e.split.onPointerUp(...t),onPointercancel:n[3]||=(...t)=>e.split.onPointerCancel&&e.split.onPointerCancel(...t),onKeydown:n[4]||=(...t)=>e.split.onKeydown&&e.split.onKeydown(...t)},null,40,Nv))}}),[[`__scopeId`,`data-v-36b65c10`]]),Fv={key:0,class:`clean-state`,"data-testid":`clean-tree`,role:`status`},Iv={key:1,class:`panel-note`},Lv={key:2,class:`panel-note`},Rv={key:3,class:`panel-note`,"data-testid":`filter-no-matches`},zv=[`aria-labelledby`,`data-testid`],Bv=[`id`],Vv={class:`section-count`},Hv=[`aria-selected`,`tabindex`,`title`,`onClick`,`onKeydown`],Uv=[`data-testid`,`disabled`,`title`,`aria-label`,`onClick`],Wv=[`data-status`],Gv={class:`path`},Kv={class:`dir`},qv={class:`base`},Jv={key:0,class:`hunks`},Yv={class:`row-stats`},Xv={key:0,class:`count-add`},Zv={key:1,class:`count-del`},Qv=[`aria-orientation`,`aria-valuenow`,`aria-valuemin`,`aria-valuemax`],$v=5,ey=ef(gr({__name:`ChangesView`,setup(e){let t=sl(),n=Vl(),r=$(()=>t.shared.status),i=$(()=>!t.shared.isLoading&&r.value!==null&&r.value.files.length===0);function a(e){return n.flashedFile===e.path}let o=ru(),s=Am($(()=>r.value?.files??[]),e=>e.path),c=$(()=>Fm(s.filtered.value)),l=$(()=>[{name:`Modified`,files:c.value.modified},{name:`Untracked`,files:c.value.untracked},{name:`Staged`,files:c.value.staged}].filter(e=>e.files.length>0)),u=Qc;function d(e){return n.activeStackKey===u(e)}let f=$(()=>{let e=c.value.ordered,r=n.activeStackKey;if(r!==null){let t=e.findIndex(e=>u(e)===r);if(t!==-1)return t}let i=t.selection.file;return i?e.indexOf(i):-1});function p(e){let t=qp(e,56),n=t.lastIndexOf(`/`);return n===-1?{dir:``,base:t}:{dir:t.slice(0,n+1),base:t.slice(n+1)}}function m(e){let n=t.shared.hunkCounts;if(!n||e.status===`untracked`)return``;let r=n.staged[e.path]??0,i=n.unstaged[e.path]??0,a=r+i;if(a===0)return``;let o=e.staged?r:i;return o===a?`●${a}`:`●${o}/${a}`}function h(e){return e.status===`conflicted`}function g(e){return h(e)?`Conflicted — resolve the conflict first`:e.staged?`Unstage this file`:`Stage this file`}function _(e){return h(e)?`Cannot ${e.staged?`unstage`:`stage`} ${e.path}: resolve the conflict first`:`${e.staged?`Unstage`:`Stage`} ${e.path}`}let v=V(null),y=$(()=>v.value?.scrollerEl??null),b=Bt(new Set);function x(e){b.has(e)?b.delete(e):b.add(e)}function S(e){if(tu({view:`changes`}),t.wholeFile?.key===e){t.setWholeFile(null);return}let r=c.value.ordered.find(t=>u(t)===e);r&&(n.setActiveStackKey(e),t.setWholeFile({view:`changes`,key:e,path:r.path}))}W(()=>t.repoId,()=>{n.setActiveStackKey(null),b.clear(),w.clear()});let C=$(()=>{let{byKey:e}=t.workingDiffs,n=t.wholeFile;return c.value.ordered.map(t=>{let r=u(t),i=n?.key===r?n.diff:e.get(r)?.diff??null;return{key:r,path:t.path,status:t.status,staged:t.staged,stats:{insertions:t.insertions??0,deletions:t.deletions??0},diff:i,collapsed:b.has(r),refPair:{kind:`working`,staged:t.staged,status:t.status}}})}),w=Bt(new Set);function T(e,t){return`${e}\u0000${t.old?.version??``}\u0000${t.new?.version??``}`}W($(()=>{let e=c.value.ordered,n=Math.max(0,f.value),r=Math.min(e.length,n+$v+1),i=[];for(let a=Math.max(0,n-$v);a<r;a++){let n=e[a],r=u(n);if(b.has(r))continue;let o=t.workingDiffs.byKey.get(r);o&&X_(o.diff)?.kind===`binary`&&i.push(n)}return i}),e=>{for(let n of e)t.ensureMedia(n,n.staged)},{immediate:!0});let E=$(()=>{let e=new Set;for(let[n,r]of t.mediaMeta)w.has(T(n,r))||(r.old?.image||r.new?.image)&&e.add(n);return e}),D={old:null,new:null};function O(e){return t.mediaMeta.get(e)??D}function k(e){let t=O(e);return()=>w.add(T(e,t))}let A=0;function j(e){A=Date.now(),t.selectFile(e),n.setActiveStackKey(u(e)),v.value?.scrollToFile(u(e),{smooth:!0})}function M(e){tu({view:`changes`}),j(e)}function N(e){M(e),On(()=>v.value?.focusFile(u(e)))}let P=V(null),F=$(()=>{let e=c.value.ordered,t=f.value;return(t>=0?e[t]:e[0])??null});function I(e){let t=c.value.ordered,n=Im(f.value,e,t.length);n!==-1&&(j(t[n]),On(()=>{P.value?.querySelectorAll(`.file-row`)[n]?.focus()}))}function L(){let e=P.value;if(!e)return;let t=f.value,n=e.querySelectorAll(`.file-row`);(t>=0?n[t]:n[0])?.focus()}W(()=>c.value.ordered,()=>{let e=P.value?.contains(document.activeElement)??!1;On(()=>{let t=P.value;e&&t&&!t.contains(document.activeElement)&&L()})});let ee=V(null);W(()=>o.open,(e,t)=>{!e&&t&&(ee.value?.querySelector(`[data-testid="filter-chip"]`))?.contains(document.activeElement)&&On(L)});let{onPointerEnter:R,onPointerLeave:te}=Wm(ee,()=>n.activeStackKey,()=>{let e=P.value,t=f.value;return!e||t<0?null:e.querySelectorAll(`.file-row`)[t]??null});W(()=>n.stackScrollRequest,e=>{e&&On(()=>v.value?.scrollToFile(e.key,{smooth:!1}))}),W(()=>n.expandGatedRequest,e=>{e!==0&&v.value?.expandAllGated()});function ne(e,n){let r=t.workingDiffs.byKey.get(e);if(!r)return null;let i=t.diffModelFor(r.diff,n),a=null,o=-1/0;for(let e of i.sections)for(let t of e.hunks)t.editedAt!==void 0&&t.editedAt>o&&(o=t.editedAt,a=t.key);return a}function re(e){let t=c.value.ordered.find(t=>t.path===e);if(!t)return;let r=u(t);n.setActiveStackKey(r),On(()=>{let e=v.value;e&&((t.insertions??0)+(t.deletions??0)>1500?e.scrollToFile(r,{smooth:!0}):e.scrollToHunk(r,()=>ne(r,t.staged),{smooth:!0}))})}let ie=null;jr(()=>{ie=fu({jump:re,lastUserScrollAt:()=>Math.max(v.value?.lastUserScrollAt()??0,A)})}),Pr(()=>{ie?.(),ie=null});let ae=gu(),oe=V(null),se=zm({container:oe,isRow:ae,column:{pref:`changesSplit`,defaultRatio:.32,min:Dl,max:Ol},row:{pref:`changesTop`,defaultRatio:.3,min:kl,max:Al}}),ce=Vm(ae,I),ue=Um(ae,y,`File diffs`,{self:!0}),de=$(()=>({"--files-col":`${(se.columnRatio.value*100).toFixed(2)}%`,...ae.value?{"--changes-top":`${(se.rowRatio.value*100).toFixed(2)}%`}:{}}));return(e,f)=>(q(),J(`div`,{ref_key:`containerEl`,ref:oe,class:z([`changes`,{portrait:U(ae)}]),style:le(de.value)},[i.value?(q(),J(`div`,Fv,[...f[10]||=[Y(`p`,{class:`clean-title`},`No changes.`,-1),Y(`p`,{class:`clean-sub`},`The working tree is clean.`,-1)]])):(q(),J(`aside`,{key:1,ref_key:`filesColEl`,ref:ee,class:`files-col`,"aria-label":`Changed files`,onPointerenter:f[3]||=(...e)=>U(R)&&U(R)(...e),onPointerleave:f[4]||=(...e)=>U(te)&&U(te)(...e)},[U(o).open?(q(),ga(Pm,{key:0,class:`files-filter`,shown:c.value.ordered.length,total:U(s).total.value,corpus:`changed files`,singular:`changed file`},null,8,[`shown`,`total`])):Q(``,!0),U(t).shared.isLoading?(q(),J(`p`,Iv,`Loading status…`)):r.value?U(s).empty.value?(q(),J(`p`,Rv,` No changed file matches “`+B(U(o).query)+`”. `,1)):(q(),J(`div`,{key:4,ref_key:`listEl`,ref:P,class:`file-list`,"data-testid":`file-list`,role:`listbox`,"aria-label":`Changed files`},[(q(!0),J(K,null,G(l.value,e=>(q(),J(`section`,{key:e.name,class:`file-section`,role:`group`,"aria-labelledby":`files-section-${e.name.toLowerCase()}`,"data-testid":`section-${e.name.toLowerCase()}`},[Y(`h3`,{id:`files-section-${e.name.toLowerCase()}`,class:`section-header eyebrow`},[Z(B(e.name)+` `,1),Y(`span`,Vv,B(e.files.length),1)],8,Bv),(q(!0),J(K,null,G(e.files,e=>(q(),J(`div`,{key:U(u)(e),class:z([`file-row mono list-row`,{selected:d(e),flash:a(e)}]),role:`option`,"aria-selected":d(e),tabindex:e===F.value?0:-1,title:e.path,onClick:t=>M(e),onKeydown:[f[0]||=Xo(Jo(e=>I(1),[`prevent`]),[`down`]),f[1]||=Xo(Jo(e=>I(-1),[`prevent`]),[`up`]),Xo(Jo(t=>N(e),[`prevent`]),[`enter`]),Xo(Jo(t=>M(e),[`prevent`]),[`space`]),f[2]||=(...e)=>U(ce)&&U(ce)(...e)]},[Y(`button`,{class:`stage-btn`,tabindex:`-1`,"data-testid":e.staged?`unstage-file`:`stage-file`,disabled:h(e),title:g(e),"aria-label":_(e),onClick:Jo(n=>e.staged?U(t).unstageFile(e.path):U(t).stageFile(e.path),[`stop`])},B(e.staged?`−`:`+`),9,Uv),Y(`span`,{class:`letter`,"data-status":e.status},B(U(ql)(e.status)),9,Wv),Y(`span`,Gv,[Y(`span`,Kv,B(p(e.path).dir),1),Y(`span`,qv,B(p(e.path).base),1)]),m(e)?(q(),J(`span`,Jv,B(m(e)),1)):Q(``,!0),Y(`span`,Yv,[e.insertions?(q(),J(`span`,Xv,`+`+B(e.insertions),1)):Q(``,!0),e.deletions?(q(),J(`span`,Zv,`−`+B(e.deletions),1)):Q(``,!0)])],42,Hv))),128))],8,zv))),128))],512)):(q(),J(`p`,Lv,`No status yet.`))],544)),!i.value&&U(ae)?(q(),ga(Pv,{key:2,split:U(se),label:`Resize file list`},null,8,[`split`])):i.value?Q(``,!0):(q(),J(`div`,{key:3,class:`resizer`,role:`separator`,"aria-orientation":U(se).ariaOrientation.value,"aria-label":`Resize file list`,"aria-valuenow":U(se).ariaValueNow.value,"aria-valuemin":U(se).ariaValueMin.value,"aria-valuemax":U(se).ariaValueMax.value,tabindex:`0`,onPointerdown:f[5]||=(...e)=>U(se).onPointerDown&&U(se).onPointerDown(...e),onPointermove:f[6]||=(...e)=>U(se).onPointerMove&&U(se).onPointerMove(...e),onPointerup:f[7]||=(...e)=>U(se).onPointerUp&&U(se).onPointerUp(...e),onPointercancel:f[8]||=(...e)=>U(se).onPointerCancel&&U(se).onPointerCancel(...e),onKeydown:f[9]||=(...e)=>U(se).onKeydown&&U(se).onKeydown(...e)},null,40,Qv)),i.value?Q(``,!0):(q(),ga(nv,Oa({ref_key:`stackEl`,ref:v,key:U(t).repoId??``,class:`diff-col`,"data-testid":`changes-diffs`,files:C.value,"active-key":U(n).activeStackKey,syntax:U(n).diffSyntaxEnabled,mode:U(n).diffMode,wrap:U(n).wrapEnabled,"media-keys":E.value,"show-whole-toggle":``,"whole-key":U(t).wholeFile?.key??null,"whole-loading":U(t).wholeFileLoading,"whole-refusal":U(t).wholeFileRefusal},U(ue),{onActiveFile:U(n).setActiveStackKey,onToggleCollapse:x,onToggleWhole:S}),{media:Bn(({file:e})=>[U(t).repoId===null?Q(``,!0):(q(),ga(Mv,Oa({key:0,pair:O(e.key),"repo-id":U(t).repoId},qr({fail:k(e.key)})),null,16,[`pair`,`repo-id`]))]),_:1},16,[`files`,`active-key`,`syntax`,`mode`,`wrap`,`media-keys`,`whole-key`,`whole-loading`,`whole-refusal`,`onActiveFile`]))],6))}}),[[`__scopeId`,`data-v-b5e7f97b`]]),ty=15e3;function ny(e,t=ty){let n=new Map;for(let t of e)t.type===`hunk`&&n.set(t.seq,t);let r=[],i=new Map;for(let n of e){if(n.type===`boundary`){i.clear(),r.push({type:`boundary`,key:n.seq,entry:n});continue}if(ry(n,i,r,t))continue;for(let e of n.supersedes)i.delete(e);let e={type:`hunk-group`,key:n.seq,members:[n],tip:n,kind:n.kind};r.push(e),n.kind!==`reverted`&&i.set(n.seq,e)}for(let e of r)e.type===`hunk-group`&&(e.kind=iy(e,n));return r}function ry(e,t,n,r){if(e.kind===`reverted`||e.supersedes.length!==1||e.siblings!==1)return!1;let i=t.get(e.supersedes[0]);return!i||Math.max(0,e.ts-i.tip.ts)>r?!1:(t.delete(i.tip.seq),i.members.push(e),i.tip=e,t.set(e.seq,i),n.splice(n.indexOf(i),1),n.push(i),!0)}function iy(e,t){let{members:n,tip:r}=e;if(n.length===1)return r.kind;let i=n[0];if(i.supersedes.length===0)return`created`;if(i.supersedes.length!==1)return r.kind;let a=t.get(i.supersedes[0]);if(!a)return r.kind;let o=r.stats.insertions+r.stats.deletions,s=a.stats.insertions+a.stats.deletions;return o>s?`expanded`:o<s?`shrunk`:`edited`}var ay={class:`journal`},oy={key:0,class:`panel-note view-error`,"data-testid":`journal-error`},sy={key:1,class:`journal-empty`,"data-testid":`journal-loading`},cy={key:2,class:`journal-empty`,"data-testid":`journal-empty`},ly=[`role`,`aria-expanded`,`title`,`tabindex`,`onClick`,`onKeydown`],uy={key:0,class:`boundary-fold`,"aria-hidden":`true`},dy=[`title`],fy=[`data-kind`,`data-seq`],py={class:`entry-header mono`},my=[`data-kind`],hy=[`title`],gy={key:0,class:`path-dir`},_y={class:`path-name`},vy={key:0,class:`fold-count`,"data-testid":`fold-count`},yy={class:`trailer`},by={class:`stats`},xy={key:0,class:`count-add`},Sy={key:1,class:`count-del`},Cy=[`title`],wy=[`onClick`],Ty={key:3,class:`boundary mono`,"data-testid":`journal-restarted`};function Ey(e){let t=new Map;for(let n of e){let e=n.type===`hunk`?n.supersedes:n.resolves;for(let r of e)t.has(r)||t.set(r,n.ts)}return t}var Dy=ef(gr({__name:`JournalView`,setup(e){let t={kind:`journal`},n=sl(),r=Vl(),i=$(()=>n.journalEntries),a=$(()=>ny(i.value)),o=$(()=>Ey(i.value)),s=$(()=>[...a.value].reverse()),c=Bt(new Set);function l(e){return o.value.has(e.tip.seq)}function u(e){return e.entry.resolves.length>0}function d(e){c.has(e)?c.delete(e):c.add(e)}let f=Date.now(),p=V(Date.now()),m=null;function h(){let e=i.value;return e.length>0?e[e.length-1].ts:0}function g(){p.value=Date.now();let e=p.value-h()<6e4?1e3:3e4;m=setTimeout(g,e)}function _(){m!==null&&clearTimeout(m),g()}function v(e){return p.value-e>36e5?b(e):Od(e,p.value)}function y(e){return kd(new Date(e))}function b(e){return Yl(e,p.value)}function x(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function S(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t+1)}function C(e){return e.status===`untracked`||e.status===`added`?!0:e.diff?.lines.some(e=>e.type===`header`&&e.content.startsWith(`new file mode`))??!1}function w(e){let t=e.kind;return t===`created`?C(e.tip)?`created`:`edited`:t===`expanded`||t===`shrunk`?`edited`:t}function T(e){let t=w(e);return t===`created`?`new file`:t}function E(e){let t=e.resolves.length;switch(e.kind){case`commit`:return`committed ${e.label} — ${t} change${t===1?``:`s`}`;case`checkout`:return`checked out ${e.label}`;case`stash`:return e.label?`stash — ${e.label}`:`stash`;case`op-start`:return`operation started — ${e.label}`;case`op-end`:return`operation finished — ${e.label}`;case`journal-start`:return`journal started ${b(e.ts)}`}}function D(e){let t=e.diff?.lines.length??0;return{containIntrinsicSize:`auto ${Math.max(48,t*20+32)}px`}}let O=Bt(new Set);function k(e){return e.stats.insertions+e.stats.deletions}function A(e){return k(e)>800&&!O.has(e.seq)}let j=V(null),M=new Map;function N(e,t){t instanceof HTMLElement?M.set(e,t):M.delete(e)}let P=a.value,F=Bt(new Set);function I(){let e=[];for(let t=P.length-1;t>=0;t--){let n=P[t],r=M.get(n.key);if(r){let t=String(n.key);e.push({key:t,kind:`file`,fileKey:t,el:r})}}return e}let L=Ym(j,{candidates:I,resolve:e=>M.get(Number(e))??null});function ee(){let e=new Map,t=0;for(let n of a.value)n.type===`boundary`&&(e.set(n.key,t),t=n.key);let n=new Set,r=[];for(let t of a.value)if(t.type===`boundary`&&c.has(t.key)){for(let e of t.entry.resolves)n.add(e);r.push({lo:e.get(t.key)??0,hi:t.key})}return{resolvedTips:n,sections:r}}let R=$(()=>{let e=new Set;if(c.size===0)return e;let{resolvedTips:t,sections:n}=ee();if(n.length===0)return e;let r=e=>n.some(t=>e>t.lo&&e<t.hi);for(let n of a.value)n.type===`hunk-group`&&(t.has(n.tip.seq)||l(n)&&r(n.tip.seq))&&e.add(n.key);return e}),te=$(()=>s.value.filter(e=>!R.value.has(e.key)));function ne(e,t){let n=[],r=new Map(t.map(e=>[e.key,e]));for(let t of e){let e=r.get(t.key),i=e?.type===`hunk-group`&&t.type===`hunk-group`&&e.tip.seq!==t.tip.seq;(!e||i)&&n.push(null)}let i=new Set(e.map(e=>e.key));for(let e of t)i.has(e.key)||n.push(M.get(e.key)??null);return n}function re(e,t){if(!ae.value||t.length===0)return;let n=new Set(t.map(e=>e.key)),r=0;for(let e of n)e>r&&(r=e);for(let t of e)t.type===`hunk-group`&&!n.has(t.key)&&t.key>r&&F.add(t.key)}function ie(e,t){let n=[];for(let r of e)t.has(r)||n.push(M.get(r)??null);for(let r of t)e.has(r)||n.push(null);return n}W([a,R],([e,t],[n,r])=>{re(e,n);let i=[...ne(e,n),...ie(t,r)];i.length!==0&&L.prepare({survivingKeys:new Set(e.filter(e=>!t.has(e.key)).map(e=>String(e.key))),changedEls:i})},{flush:`pre`}),W([a,R],([e])=>{L.restore(),P=e},{flush:`post`});let ae=V(!0),oe=V(0),se=ce(i.value);function ce(e){return e.length>0?e[e.length-1].seq:0}function ue(e,t){let n=0;for(let r of e)(r.type===`hunk-group`?r.tip.seq:r.key)>t&&n++;return n}function de(){let e=j.value;if(!e)return;let t=e.scrollTop<=40;ae.value=t,t&&(se=ce(i.value),oe.value=0)}function fe(){let e=j.value;e&&(e.scrollTop=0,ae.value=!0,se=ce(i.value),oe.value=0)}W(a,e=>{let t=ce(i.value);t<se?(se=t,oe.value=0,ae.value&&fe()):ae.value?t>se?fe():se=t:oe.value=ue(e,se)},{flush:`post`}),W(()=>n.journalEpoch,(e,t)=>{t!==null&&(O.clear(),F.clear(),c.clear(),pe.value=null,se=ce(i.value),oe.value=0,ae.value=!0,On(fe))});let pe=V(null);async function me(){pe.value=null;try{await n.loadJournal()}catch(e){pe.value=Rs(e)}}return W(()=>h(),_),jr(()=>{me(),g(),On(fe)}),Pr(()=>{m!==null&&(clearTimeout(m),m=null)}),(e,i)=>(q(),J(`div`,ay,[Y(`div`,{ref_key:`scrollerEl`,ref:j,class:`journal-scroll`,"data-testid":`journal-scroll`,onScrollPassive:de},[pe.value&&a.value.length===0?(q(),J(`p`,oy,B(pe.value),1)):a.value.length===0&&!U(n).journalLoaded?(q(),J(`p`,sy,` Loading journal… `)):a.value.length===0?(q(),J(`p`,cy,` journal started `+B(b(U(f)))+` — your edits will show up here `,1)):Q(``,!0),(q(!0),J(K,null,G(te.value,e=>(q(),J(K,{key:e.key},[e.type===`boundary`?(q(),J(`div`,{key:0,ref_for:!0,ref:t=>N(e.key,t),class:z([`boundary mono`,{foldable:u(e),folded:c.has(e.key)}]),"data-testid":`journal-boundary`,role:u(e)?`button`:void 0,"aria-expanded":u(e)?!c.has(e.key):void 0,title:u(e)?c.has(e.key)?`Show this commit's changes`:`Fold this commit's changes`:void 0,tabindex:u(e)?0:void 0,onClick:t=>u(e)&&d(e.key),onKeydown:[Xo(Jo(t=>u(e)&&d(e.key),[`prevent`]),[`enter`]),Xo(Jo(t=>u(e)&&d(e.key),[`prevent`]),[`space`])]},[u(e)?(q(),J(`span`,uy,B(c.has(e.key)?`▸`:`▾`),1)):Q(``,!0),Y(`span`,{class:`boundary-label`,title:E(e.entry)},B(E(e.entry)),9,dy)],42,ly)):(q(),J(`div`,{key:1,class:z([`reveal`,{enter:F.has(e.key)}])},[Y(`article`,{ref_for:!0,ref:t=>N(e.key,t),class:`entry`,"data-kind":w(e),"data-seq":e.key,"data-testid":`journal-entry`},[Y(`header`,py,[Y(`span`,{class:`kind`,"data-kind":w(e),"data-testid":`kind-badge`},B(T(e)),9,my),Y(`span`,{class:`path`,title:e.tip.path},[S(e.tip.path)?(q(),J(`span`,gy,B(S(e.tip.path)),1)):Q(``,!0),Y(`span`,_y,B(x(e.tip.path)),1)],8,hy),X(Qg,{pair:t}),X(Ug,{path:e.tip.path},null,8,[`path`]),X(Kg,{path:e.tip.path},null,8,[`path`]),e.members.length>1?(q(),J(`span`,vy,`×`+B(e.members.length),1)):Q(``,!0),Y(`span`,yy,[Y(`span`,by,[e.tip.stats.insertions?(q(),J(`span`,xy,`+`+B(e.tip.stats.insertions),1)):Q(``,!0),e.tip.stats.deletions?(q(),J(`span`,Sy,`−`+B(e.tip.stats.deletions),1)):Q(``,!0)]),Y(`time`,{class:`time`,title:y(e.tip.ts)},B(v(e.tip.ts)),9,Cy)])]),A(e.tip)?(q(),J(`button`,{key:0,class:`huge-row mono`,"data-testid":`huge-collapsed`,onClick:t=>O.add(e.tip.seq)},B(k(e.tip))+` lines changed — show `,9,wy)):(q(),J(`div`,{key:1,class:`entry-body`,style:le(D(e.tip)),"data-testid":`entry-body`},[X(A_,{diff:e.tip.diff,"file-path":e.tip.path,syntax:U(r).diffSyntaxEnabled,mode:U(r).diffMode},null,8,[`diff`,`file-path`,`syntax`,`mode`])],4))],8,fy)],2))],64))),128)),U(n).journalRestarted&&a.value.length>0?(q(),J(`div`,Ty,[...i[0]||=[Y(`span`,{class:`boundary-label`},`journal restarted — earlier entries were lost`,-1)]])):Q(``,!0)],544),oe.value>0?(q(),J(`button`,{key:0,class:`new-pill mono`,"data-testid":`new-pill`,onClick:fe},B(oe.value)+` new ↑ `,1)):Q(``,!0)]))}}),[[`__scopeId`,`data-v-f46c8c6a`]]);function Oy(e){let t={name:``,fullPath:``,isDirectory:!0,children:[],depth:0};for(let n=0;n<e.length;n++){let r=e[n].path.split(`/`),i=t;for(let e=0;e<r.length;e++){let t=r[e],a=e===r.length-1,o=r.slice(0,e+1).join(`/`),s=a?void 0:i.children.find(e=>e.name===t&&e.isDirectory);s||(s={name:t,fullPath:o,isDirectory:!a,children:[],depth:i.depth+1,fileIndex:a?n:void 0},i.children.push(s)),i=s}}return ky(t),jy(t),t}function ky(e){for(let t of e.children)ky(t);for(let t=0;t<e.children.length;t++){let n=e.children[t];for(;n.isDirectory&&n.children.length===1&&n.children[0].isDirectory;){let e=n.children[0];n.name=`${n.name}/${e.name}`,n.fullPath=e.fullPath,n.children=e.children,Ay(n,n.depth)}}}function Ay(e,t){e.depth=t;for(let n of e.children)Ay(n,t+1)}function jy(e){e.children.sort((e,t)=>e.isDirectory&&!t.isDirectory?-1:!e.isDirectory&&t.isDirectory?1:e.name.localeCompare(t.name));for(let t of e.children)jy(t)}function My(e){let t=[];function n(e,r){for(let i=0;i<e.children.length;i++){let a=e.children[i],o=i===e.children.length-1;t.push({type:a.isDirectory?`directory`:`file`,name:a.name,fullPath:a.fullPath,depth:a.depth-1,fileIndex:a.fileIndex,isLast:o,parentIsLast:[...r]}),a.isDirectory&&n(a,[...r,o])}}return n(e,[]),t}var Ny=[`onClick`],Py=[`aria-expanded`,`aria-label`,`onClick`,`onKeydown`],Fy=[`title`],Iy=[`data-file-index`,`aria-selected`,`tabindex`,`title`,`onClick`,`onKeydown`],Ly=[`data-status`],Ry={class:`name`},zy={key:0,class:`uncommitted-tag`,"data-testid":`uncommitted-tag`},By={class:`row-stats`},Vy={key:0,class:`count-add`},Hy={key:1,class:`count-del`};function Uy(e){return My(Oy(e)).flatMap(t=>{if(t.type!==`file`||t.fileIndex===void 0)return[];let n=e[t.fileIndex];return n?[n]:[]})}var Wy=ef(gr({__name:`ChangedFileTree`,props:{files:{},selectedIndex:{},portrait:{type:Boolean}},emits:[`activate`,`select`],setup(e,{emit:t}){let n=e,r=t,i=V(null),a=$(()=>My(Oy(n.files))),o=Bt(new Set);function s(e,t){t?o.add(e):o.delete(e)}function c(e){s(e,!o.has(e))}let l=$(()=>{let e=[],t=null;for(let n of a.value){if(t!==null){if(n.depth>t)continue;t=null}e.push(n),n.type===`directory`&&o.has(n.fullPath)&&(t=n.depth)}return e}),u=$(()=>{let e=[];for(let t of l.value){if(t.type===`directory`){e.push({...t,type:`directory`});continue}if(t.fileIndex===void 0)continue;let r=n.files[t.fileIndex];r&&e.push({...t,type:`file`,fileIndex:t.fileIndex,file:r})}return e}),d=$(()=>u.value.flatMap(e=>e.type===`file`?[e.fileIndex]:[]));function f(e){return e===`both`?`[uncommitted]`:`[${e}]`}let p=$(()=>{let e=d.value,t=n.selectedIndex;return t!==null&&e.includes(t)?t:e[0]??null});function m(e){return i.value?.querySelector(`.file-row[data-file-index="${e}"]`)??null}function h(e){let t=d.value,i=n.selectedIndex,a=Im(i===null?-1:t.indexOf(i),e,t.length);a!==-1&&(r(`select`,t[a]),On(()=>m(t[a])?.focus()))}let g=Vm(sn(n,`portrait`),h),{onPointerEnter:_,onPointerLeave:v}=Wm(i,()=>n.selectedIndex,()=>n.selectedIndex===null?null:m(n.selectedIndex));return(t,n)=>(q(),J(`aside`,{ref_key:`rootEl`,ref:i,class:`files-col`,role:`listbox`,"aria-label":`Changed files`,onPointerenter:n[3]||=(...e)=>U(_)&&U(_)(...e),onPointerleave:n[4]||=(...e)=>U(v)&&U(v)(...e)},[(q(!0),J(K,null,G(u.value,t=>(q(),J(K,{key:`${t.type}:${t.fullPath}:${t.fileIndex}`},[t.type===`directory`?(q(),J(`div`,{key:0,class:`dir-row mono`,role:`presentation`,style:le({"--depth":t.depth}),onClick:e=>c(t.fullPath)},[Y(`button`,{class:`dir-collapse-btn`,"aria-expanded":!o.has(t.fullPath),"aria-label":`${o.has(t.fullPath)?`Expand`:`Collapse`} ${t.fullPath}`,onClick:Jo(e=>c(t.fullPath),[`stop`]),onKeydown:[Xo(Jo(e=>c(t.fullPath),[`prevent`]),[`enter`]),Xo(Jo(e=>c(t.fullPath),[`prevent`]),[`space`]),Xo(Jo(e=>s(t.fullPath,!0),[`prevent`]),[`left`]),Xo(Jo(e=>s(t.fullPath,!1),[`prevent`]),[`right`])]},B(o.has(t.fullPath)?`▸`:`▾`),41,Py),Y(`span`,{class:`dir-name`,title:t.fullPath},B(t.name)+`/`,9,Fy)],12,Ny)):(q(),J(`div`,{key:1,class:z([`file-row mono list-row`,{selected:e.selectedIndex===t.fileIndex,uncommitted:t.file.uncommitted!==void 0}]),style:le({"--depth":t.depth}),"data-file-index":t.fileIndex,role:`option`,"aria-selected":e.selectedIndex===t.fileIndex,tabindex:t.fileIndex===p.value?0:-1,title:t.file.path,onClick:e=>r(`activate`,t.fileIndex),onKeydown:[n[0]||=Xo(Jo(e=>h(1),[`prevent`]),[`down`]),n[1]||=Xo(Jo(e=>h(-1),[`prevent`]),[`up`]),Xo(Jo(e=>r(`activate`,t.fileIndex),[`prevent`]),[`enter`]),Xo(Jo(e=>r(`activate`,t.fileIndex),[`prevent`]),[`space`]),n[2]||=(...e)=>U(g)&&U(g)(...e)]},[Y(`span`,{class:`letter`,"data-status":t.file.status},B(U(ql)(t.file.status)),9,Ly),Y(`span`,Ry,B(t.name),1),t.file.uncommitted?(q(),J(`span`,zy,B(f(t.file.uncommitted)),1)):Q(``,!0),Y(`span`,By,[t.file.additions?(q(),J(`span`,Vy,`+`+B(t.file.additions),1)):Q(``,!0),t.file.deletions?(q(),J(`span`,Hy,`−`+B(t.file.deletions),1)):Q(``,!0)])],46,Iy))],64))),128))],544))}}),[[`__scopeId`,`data-v-85a30e23`]]),Gy={class:`commits-col files-col`,"aria-label":`Commit history`},Ky={key:0,class:`panel-note`},qy={key:1,class:`panel-note view-error`},Jy={key:2,class:`panel-note`,"data-testid":`history-empty`},Yy=[`aria-selected`,`tabindex`,`title`,`onClick`,`onKeydown`],Xy={class:`row-top`},Zy={class:`hash mono`},Qy=[`title`],$y={class:`row-meta mono`},eb=[`title`],tb=[`title`],nb={class:`date`},rb={key:0,class:`load-error view-error`,"data-testid":`load-error`},ib=[`disabled`],ab={class:`detail-header`,"data-testid":`commit-detail`},ob={class:`detail-top`},sb=[`title`],cb={class:`detail-message`},lb={class:`detail-meta mono`},ub={class:`author`},db={class:`abs-date`},fb={key:0,class:`panel-note view-error detail-note`,"data-testid":`detail-error`},pb={key:1,class:`panel-note detail-note`},mb={key:2,class:`panel-note detail-note`,"data-testid":`history-no-files`},hb={key:2,class:`panel-note detail-note`,"data-testid":`history-prompt`},gb=100,_b=ef(gr({__name:`HistoryView`,setup(e){let t=sl(),n=Vl(),{history:r}=Fs(t),i=V(null),a=V(null),o=V(Math.max(gb,t.history.commits.length)),s=V(null),c=$(()=>r.value.commits),l=$(()=>r.value.selectedCommit),u=$(()=>r.value.commitFiles??[]);function d(e){return`h:${l.value?.hash??``}:${e}`}let f=V(null),p=Bt(new Set),m=V(null),h=$(()=>m.value?.scrollerEl??null);W(()=>r.value.commitFiles,e=>{let t=e?Uy(e)[0]:void 0;f.value=t&&e?e.indexOf(t):null},{immediate:!0});let g=$(()=>{let e=l.value;return e?Uy(u.value).map(n=>{let r=d(n.path);return{key:r,path:n.path,status:n.status,stats:{insertions:n.additions,deletions:n.deletions},diff:t.wholeFile?.key===r?t.wholeFile.diff:n.diff,collapsed:p.has(r),refPair:{kind:`commit`,shortHash:e.shortHash}}}):[]}),_=$(()=>{let e=f.value===null?void 0:u.value[f.value];return e?d(e.path):null});function v(e){let t=u.value[e];if(!t)return;f.value=e;let n=d(t.path);p.delete(n),On(()=>m.value?.scrollToFile(n))}function y(e){let t=u.value.findIndex(t=>d(t.path)===e);t!==-1&&(f.value=t)}function b(e){p.has(e)?p.delete(e):p.add(e)}W(()=>n.expandGatedRequest,e=>{e!==0&&m.value?.expandAllGated()}),W(l,(e,n)=>{n&&e?.hash!==n.hash&&t.wholeFile!==null&&t.setWholeFile(null)});function x(e){let n=l.value,r=u.value.find(t=>d(t.path)===e);n&&r&&(t.wholeFile?.key===e?t.setWholeFile(null):(tu({view:`history`}),t.setWholeFile({view:`history`,key:e,path:r.path,hash:n.hash})))}let S=$(()=>c.value.length>=o.value),C=o.value;async function w(e){i.value=null,C=e;try{await t.loadHistory(e),o.value=e}catch(e){i.value=Rs(e)}}function T(){w(C)}jr(()=>{c.value.length===0&&!r.value.isLoading&&w(gb)});let E=V(null);function D(e){tu({view:`history`}),O(e)}async function O(e){a.value=null,E.value=e.hash;try{await t.selectHistoryCommit(e)}catch(e){a.value=`Failed to load commit diff: ${Rs(e)}`}}W(c,e=>{let t=E.value;if(t===null||l.value!==null)return;let n=e.find(e=>e.hash===t);n?O(n):E.value=null});function k(e){return e.refs?e.refs.split(`,`).map(e=>e.trim()).filter(Boolean):[]}function A(e){return Od(e.date.getTime())}let j=$(()=>{let e=c.value,t=l.value;return t&&e.includes(t)?t:e[0]??null});function M(e){let t=c.value,n=Im(l.value?t.indexOf(l.value):-1,e,t.length);n!==-1&&(O(t[n]),On(()=>{s.value?.querySelectorAll(`.commit-row`)[n]?.focus()}))}let N=gu(),P=V(null),F=zm({container:P,isRow:N,row:{pref:`historyTop`,defaultRatio:.28,min:kl,max:Al}}),I=Vm(N,M),L=Um(N,h,`Commit diff`,{self:!0});function ee(e){O(e),N.value&&On(()=>h.value?.focus())}return(e,d)=>(q(),J(`div`,{ref_key:`containerEl`,ref:P,class:z([`history`,{portrait:U(N)}]),style:le(U(N)?{"--history-top":`${(U(F).rowRatio.value*100).toFixed(2)}%`}:void 0)},[Y(`aside`,Gy,[U(r).isLoading&&c.value.length===0?(q(),J(`p`,Ky,`Loading history…`)):i.value&&c.value.length===0?(q(),J(`p`,qy,B(i.value),1)):c.value.length===0?(q(),J(`p`,Jy,` No commits yet. `)):(q(),J(K,{key:3},[Y(`div`,{ref_key:`listEl`,ref:s,class:`commit-list`,"data-testid":`commit-list`,role:`listbox`,"aria-label":`Commits`},[(q(!0),J(K,null,G(c.value,e=>(q(),J(`div`,{key:e.hash,class:z([`commit-row list-row`,{selected:e===l.value}]),role:`option`,"aria-selected":e===l.value,tabindex:e===j.value?0:-1,title:e.hash,onClick:t=>D(e),onKeydown:[d[0]||=Xo(Jo(e=>M(1),[`prevent`]),[`down`]),d[1]||=Xo(Jo(e=>M(-1),[`prevent`]),[`up`]),Xo(Jo(t=>ee(e),[`prevent`]),[`enter`]),Xo(Jo(t=>D(e),[`prevent`]),[`space`]),d[2]||=(...e)=>U(I)&&U(I)(...e)]},[Y(`span`,Xy,[Y(`span`,Zy,B(e.shortHash),1),Y(`span`,{class:`message`,title:e.message},B(e.message),9,Qy)]),Y(`span`,$y,[(q(!0),J(K,null,G(k(e),e=>(q(),J(`span`,{key:e,class:`ref-tag`,title:e},B(e),9,eb))),128)),Y(`span`,{class:`author`,title:e.author},B(e.author),9,tb),Y(`span`,nb,B(A(e)),1)])],42,Yy))),128))],512),i.value?(q(),J(`p`,rb,[Z(B(i.value)+` `,1),Y(`button`,{class:`load-retry chrome-chip`,"data-testid":`load-retry`,onClick:T},`Retry`)])):Q(``,!0),S.value?(q(),J(`button`,{key:1,class:`load-more chrome-chip`,"data-testid":`load-more`,disabled:U(r).isLoading,onClick:d[3]||=e=>w(o.value+gb)},B(U(r).isLoading?`Loading…`:`Load more`),9,ib)):Q(``,!0)],64))]),U(N)?(q(),ga(Pv,{key:0,class:`history-resizer`,split:U(F),label:`Resize commit and file lists`},null,8,[`split`])):Q(``,!0),X(Wy,{class:`commit-files`,"data-testid":`commit-files`,files:u.value,"selected-index":f.value,portrait:U(N),onActivate:v,onSelect:v},null,8,[`files`,`selected-index`,`portrait`]),l.value?(q(),J(K,{key:1},[Y(`header`,ab,[Y(`div`,ob,[Y(`span`,{class:`full-hash mono`,title:l.value.hash},B(l.value.hash),9,sb)]),Y(`p`,cb,B(l.value.message),1),Y(`p`,lb,[Y(`span`,ub,B(l.value.author),1),Y(`span`,db,B(U(kd)(l.value.date)),1)])]),a.value?(q(),J(`p`,fb,B(a.value),1)):U(r).commitFiles===null?(q(),J(`p`,pb,`Loading diff…`)):U(r).commitFiles.length===0?(q(),J(`p`,mb,` No file changes to show (merge commits are not shown as a diff). `)):(q(),ga(nv,Oa({key:3,ref_key:`stackEl`,ref:m,class:`diffs-col`,"data-testid":`commit-diffs`,files:g.value,"active-key":_.value,syntax:U(n).diffSyntaxEnabled,mode:U(n).diffMode,wrap:U(n).wrapEnabled,"show-whole-toggle":``,"whole-key":U(t).wholeFile?.key??null,"whole-loading":U(t).wholeFileLoading,"whole-refusal":U(t).wholeFileRefusal},U(L),{onActiveFile:y,onToggleCollapse:b,onToggleWhole:x}),null,16,[`files`,`active-key`,`syntax`,`mode`,`wrap`,`whole-key`,`whole-loading`,`whole-refusal`]))],64)):(q(),J(`p`,hb,` Select a commit to view its changes `))],6))}}),[[`__scopeId`,`data-v-7fe3481f`]]),vb=new Set([`/`,`-`,`_`,`.`]);function yb(e){if(e.length<2)return``;let t=e[0];for(let n of e.slice(1)){let e=0;for(;e<t.length&&e<n.length&&t[e]===n[e];)e++;t=t.slice(0,e)}let n=t.length;for(;n>0&&!vb.has(t[n-1]);)n--;let r=t.slice(0,n);return e.every(e=>e.length>r.length)?r:``}var bb={class:`stack-strip mono`,"aria-label":`Stack layers`,"data-testid":`stack-strip`},xb=[`aria-pressed`,`disabled`],Sb=[`title`],Cb=[`title`],wb={class:`layers`},Tb=[`data-layer`,`aria-pressed`,`disabled`,`title`,`onClick`],Eb={class:`pos`,"aria-hidden":`true`},Db={class:`name`,"aria-hidden":`true`},Ob={class:`visually-hidden`},kb={class:`commits`},Ab={class:`visually-hidden`},jb={key:1,class:`visually-hidden`},Mb={key:1,class:`note`,"data-testid":`stack-forked`},Nb=ef(gr({__name:`StackStrip`,props:{stack:{},active:{},disabled:{type:Boolean}},emits:[`pick`],setup(e,{emit:t}){let n=e,r=t,i=$(()=>yb(n.stack.layers.map(e=>e.name)));function a(e){return e.name.slice(i.value.length)}function o(e){return e.commits===1?`commit`:`commits`}function s(e){return e.refs.slice(1).join(`, `)}function c(e){let t=s(e)===``?``:`; also ${s(e)}`,n=e.isHead?` (checked out)`:``;return`${e.name}${n}: ${e.commits} ${o(e)} on top of the layer below${t}`}return(t,n)=>(q(),J(`nav`,bb,[n[3]||=Y(`span`,{class:`eyebrow`,"aria-hidden":`true`},`stack`,-1),Y(`button`,{type:`button`,class:z([`chip all`,{current:e.active===null}]),"data-testid":`stack-all`,"aria-pressed":e.active===null,disabled:e.disabled,title:`The whole stack: trunk…HEAD`,onClick:n[0]||=e=>r(`pick`,null)},` all `,10,xb),Y(`span`,{class:`trunk`,"data-testid":`stack-trunk`,title:`trunk: ${e.stack.trunk}`},B(e.stack.trunk),9,Sb),n[4]||=Y(`span`,{class:`arrow`,"aria-hidden":`true`},`›`,-1),i.value?(q(),J(`span`,{key:0,class:`prefix`,"data-testid":`stack-prefix`,title:`Every layer's name starts with ${i.value}`},B(i.value),9,Cb)):Q(``,!0),Y(`span`,wb,[(q(!0),J(K,null,G(e.stack.layers,(t,i)=>(q(),J(`button`,{key:t.tip,type:`button`,class:z([`layer`,{current:e.active===t.name,head:t.isHead}]),"data-testid":`stack-layer`,"data-layer":t.name,"aria-pressed":e.active===t.name,disabled:e.disabled,title:c(t),onClick:e=>r(`pick`,t.name)},[Y(`span`,Eb,B(i+1),1),Y(`span`,Db,B(a(t)),1),Y(`span`,Ob,B(t.name),1),Y(`span`,kb,[Z(B(t.commits),1),Y(`span`,Ab,B(` ${o(t)}`),1)]),t.isHead?(q(),J(K,{key:0},[n[1]||=Y(`span`,{class:`head-mark`,"aria-hidden":`true`},`●`,-1),n[2]||=Y(`span`,{class:`visually-hidden`},`, checked out`,-1)],64)):Q(``,!0),s(t)===``?Q(``,!0):(q(),J(`span`,jb,`, also `+B(s(t)),1))],10,Tb))),128))]),e.stack.forkedAbove?(q(),J(`span`,Mb,`forks above HEAD; only this line is shown`)):Q(``,!0)]))}}),[[`__scopeId`,`data-v-9c7b2b84`]]),Pb={class:`topbar`,"data-testid":`compare-topbar`},Fb={class:`base-select`},Ib=[`title`],Lb={key:1,class:`arrow`,"aria-hidden":`true`},Rb=[`disabled`,`value`],zb={key:0,value:``,disabled:``},Bb=[`value`],Vb={key:1,class:`uncommitted-toggles`,"data-testid":`uncommitted-toggles`},Hb=[`data-testid`,`checked`,`onChange`],Ub={key:2,class:`stats mono`,"data-testid":`compare-stats`},Wb={class:`files-changed`},Gb={class:`count-add`},Kb={class:`count-del`},qb={key:3,class:`topbar-busy mono`,"data-testid":`compare-busy`},Jb={key:0,class:`view-error error-banner`,"data-testid":`compare-error-banner`},Yb={key:1,class:`panel-note view-error`,"data-testid":`compare-error`},Xb={key:2,class:`state-block`,"data-testid":`no-base-branch`},Zb={key:3,class:`panel-note`,"data-testid":`compare-loading`},Qb={key:4,class:`panel-note`,"data-testid":`compare-clean`},$b={key:0,class:`commits-section`},ex=[`aria-expanded`],tx={class:`chevron`},nx={class:`commits-count`},rx={key:0,class:`commit-list mono`,"data-testid":`compare-commits`},ix={class:`hash`},ax=[`title`],ox={class:`meta`},sx={class:`author`},cx={class:`date`},lx=[`aria-busy`],ux=ef(gr({__name:`CompareView`,setup(e){let t=sl(),n=Vl(),{compare:r,compareStack:i,selectedStackHead:a,pickedLayer:o,comparePair:s}=Fs(t),c=Bt(t.getLastUncommitted()),l=[{key:`staged`,label:`staged`},{key:`unstaged`,label:`unstaged`},{key:`untracked`,label:`untracked`}],u=V([]),d=V(!1),f=Bt(new Set),p=V(null),m=$(()=>p.value?.scrollerEl??null);jr(()=>{h(),g()});async function h(){await t.refreshCompare({...c})}async function g(){try{u.value=await t.getCandidateBaseBranches()}catch{u.value=[]}}let _=$(()=>r.value.compareDiff),v=$(()=>_.value?.files??[]),y=$(()=>t.shared.status?.branch?.current||null),b=$(()=>s.value.head??y.value),x=$(()=>{let e=r.value.baseBranch;return e!==null&&!u.value.includes(e)?[e,...u.value]:u.value});async function S(e){let n=e.target.value;n&&n!==r.value.baseBranch&&(tu({view:`compare`}),await t.setSelectedCompareBase(n,{...c}))}let C=$(()=>(i.value?.layers.length??0)>=2);async function w(e){e!==a.value&&(tu({view:`compare`}),await t.setSelectedStackHead(e,{...c}))}let T=$(()=>o.value!==null&&!o.value.isHead);async function E(e,n){c[e]=n.target.checked,await t.refreshCompare({...c})}function D(e){return Od(e.date.getTime())}let O=$(()=>r.value.selection.type===`file`?r.value.selection.index:null);function k(e){tu({view:`compare`}),A(e)}function A(e){t.selectCompareFile(e);let n=v.value[e];if(!n)return;let r=$c(n);f.delete(r),On(()=>p.value?.scrollToFile(r))}W(()=>n.stackScrollRequest,e=>{e&&On(()=>p.value?.scrollToFile(e.key,{smooth:!1}))}),W(()=>n.expandGatedRequest,e=>{e!==0&&p.value?.expandAllGated()});function j(e){let n=v.value.findIndex(t=>$c(t)===e);n!==-1&&t.selectCompareFile(n)}W(()=>v.value,e=>{let n=Uy(e)[0];n&&O.value===null&&t.selectCompareFile(e.indexOf(n))},{immediate:!0});function M(e){f.has(e)?f.delete(e):f.add(e)}function N(e){if(tu({view:`compare`}),t.wholeFile?.key===e){t.setWholeFile(null);return}let n=P.value.find(t=>$c(t)===e);if(!n)return;let r=v.value.findIndex(t=>$c(t)===e);r!==-1&&A(r),t.setWholeFile({view:`compare`,key:e,path:n.path,side:n.uncommitted})}let P=$(()=>Uy(v.value)),F=$(()=>P.value.map(e=>({key:$c(e),path:e.path,status:e.status,uncommitted:e.uncommitted,stats:{insertions:e.additions,deletions:e.deletions},diff:t.wholeFile?.key===$c(e)?t.wholeFile.diff:e.diff,collapsed:f.has($c(e)),refPair:e.uncommitted?{kind:`compare-uncommitted`,side:e.uncommitted}:{kind:`compare`,base:s.value.base,head:s.value.head}}))),I=$(()=>{let e=O.value;if(e===null)return null;let t=v.value[e];return t?$c(t):null}),L=gu(),ee=V(null),R=zm({container:ee,isRow:L,row:{pref:`compareTop`,defaultRatio:.22,min:kl,max:Al}}),te=Um(L,m,`File diffs`,{self:!0});return(e,o)=>(q(),J(`div`,{class:z([`compare`,{portrait:U(L)}]),style:le(U(L)?{"--compare-top":`${(U(R).rowRatio.value*100).toFixed(2)}%`}:void 0)},[Y(`header`,Pb,[(q(),ga(lr,{defer:``,to:`#view-toolbar-slot`,disabled:!U(L)},[Y(`label`,Fb,[b.value?(q(),J(`span`,{key:0,class:`head-branch mono`,title:b.value},B(b.value),9,Ib)):Q(``,!0),b.value?(q(),J(`span`,Lb,`→`)):Q(``,!0),o[1]||=Y(`span`,{class:`eyebrow`},`base`,-1),Y(`select`,{class:`mono`,"data-testid":`base-select`,"aria-label":`Base branch`,disabled:U(r).loading,value:U(r).baseBranch??``,onChange:S},[U(r).baseBranch===null?(q(),J(`option`,zb,`pick a base…`)):Q(``,!0),(q(!0),J(K,null,G(x.value,e=>(q(),J(`option`,{key:e,value:e},B(e),9,Bb))),128))],40,Rb)])],8,[`disabled`])),C.value&&U(i)?(q(),ga(Nb,{key:0,stack:U(i),active:U(a),disabled:U(r).loading,onPick:w},null,8,[`stack`,`active`,`disabled`])):Q(``,!0),T.value?Q(``,!0):(q(),J(`fieldset`,Vb,[o[2]||=Y(`legend`,null,`include`,-1),(q(),J(K,null,G(l,e=>Y(`label`,{key:e.key,class:`uncommitted-toggle`},[Y(`input`,{type:`checkbox`,"data-testid":`uncommitted-toggle-${e.key}`,checked:c[e.key],onChange:t=>E(e.key,t)},null,40,Hb),Y(`span`,null,B(e.label),1)])),64))])),_.value?(q(),J(`p`,Ub,[Y(`span`,Wb,B(_.value.stats.filesChanged)+` `+B(_.value.stats.filesChanged===1?`file`:`files`)+` changed`,1),Y(`span`,Gb,`+`+B(_.value.stats.additions),1),Y(`span`,Kb,`−`+B(_.value.stats.deletions),1)])):Q(``,!0),U(r).loading&&_.value?(q(),J(`span`,qb,`Loading…`)):Q(``,!0)]),U(r).error&&_.value?(q(),J(`p`,Jb,B(U(r).error),1)):Q(``,!0),U(r).error&&!_.value?(q(),J(`p`,Yb,B(U(r).error),1)):U(r).noBaseBranch?(q(),J(`div`,Xb,[...o[3]||=[Y(`p`,{class:`state-title`},`No base branch detected.`,-1),Y(`p`,{class:`state-hint`},` Base detection uses remote refs (like origin/main) — this repo has none that qualify. Pick a base branch above to compare against. `,-1)]])):U(r).loading&&!_.value?(q(),J(`p`,Zb,` Loading compare… `)):_.value&&v.value.length===0?(q(),J(`p`,Qb,` No changes`+B(b.value?` on ${b.value}`:``)+` compared to `+B(U(s).base)+`. `,1)):_.value?(q(),J(K,{key:5},[_.value.commits.length>0?(q(),J(`section`,$b,[(q(),ga(lr,{defer:``,to:`#view-toolbar-slot`,disabled:!U(L)},[Y(`button`,{class:`commits-toggle eyebrow`,"data-testid":`commits-toggle`,"aria-expanded":d.value,onClick:o[0]||=e=>d.value=!d.value},[Y(`span`,tx,B(d.value?`▾`:`▸`),1),o[4]||=Z(` Commits `,-1),Y(`span`,nx,B(_.value.commits.length),1)],8,ex)],8,[`disabled`])),d.value?(q(),J(`ul`,rx,[(q(!0),J(K,null,G(_.value.commits,e=>(q(),J(`li`,{key:e.hash,class:`commit-row`},[Y(`span`,ix,B(e.shortHash),1),Y(`span`,{class:`message`,title:e.message},B(e.message),9,ax),Y(`span`,ox,[Y(`span`,sx,B(e.author),1),Y(`span`,cx,B(D(e)),1)])]))),128))])):Q(``,!0)])):Q(``,!0),Y(`div`,{ref_key:`prBodyEl`,ref:ee,class:`pr-body`,"aria-busy":U(r).loading&&!!_.value},[X(Wy,{"data-testid":`compare-files`,files:v.value,"selected-index":O.value,portrait:U(L),onActivate:k,onSelect:A},null,8,[`files`,`selected-index`,`portrait`]),U(L)?(q(),ga(Pv,{key:0,split:U(R),label:`Resize file list`},null,8,[`split`])):Q(``,!0),X(nv,Oa({ref_key:`stackEl`,ref:p,class:`diffs-col`,"data-testid":`compare-diffs`,files:F.value,"active-key":I.value,syntax:U(n).diffSyntaxEnabled,mode:U(n).diffMode,wrap:U(n).wrapEnabled,"show-whole-toggle":``,"whole-key":U(t).wholeFile?.key??null,"whole-loading":U(t).wholeFileLoading,"whole-refusal":U(t).wholeFileRefusal},U(te),{onActiveFile:j,onToggleCollapse:M,onToggleWhole:N}),null,16,[`files`,`active-key`,`syntax`,`mode`,`wrap`,`whole-key`,`whole-loading`,`whole-refusal`])],8,lx)],64)):Q(``,!0)],6))}}),[[`__scopeId`,`data-v-066a9cd7`]]),dx=[`title`],fx=ef(gr({__name:`ShowChangesButton`,props:{path:{}},setup(e){let t=e,n=sl(),r=Vl(),i=$(()=>{let e=(n.shared.status?.files??[]).filter(e=>e.path===t.path);return e.length===0?null:e.find(e=>!e.staged)??e[0]});function a(){let e=i.value;if(!e)return;let t=Qc(e);tu({view:`changes`}),r.setActiveView(`changes`),n.selectFile(e),r.setActiveStackKey(t),r.requestStackScroll(t)}return(e,n)=>i.value?(q(),J(`button`,{key:0,class:`show-changes mono`,"data-testid":`show-changes`,title:`Show what changed in ${t.path}`,onClick:n[0]||=Jo(e=>a(),[`stop`])},` show changes `,8,dx)):Q(``,!0)}}),[[`__scopeId`,`data-v-786aa840`]]),px={key:0,class:`image-view`,"data-testid":`image-view`},mx={class:`image-controls`},hx=[`aria-pressed`,`title`],gx=ef(gr({__name:`ImageView`,props:{path:{},media:{}},emits:[`fail`],setup(e,{emit:t}){let n=e,r=t,i=sl(),a=V(`fit`),o=$(()=>i.repoId===null?null:Us(i.repoId,{path:n.path,side:`worktree`,version:n.media.version}));return(t,n)=>o.value!==null&&e.media.image?(q(),J(`div`,px,[Y(`div`,mx,[Y(`button`,{class:z([`fit-toggle mono`,{on:a.value===`actual`}]),"data-testid":`image-fit-toggle`,"aria-pressed":a.value===`actual`,"aria-label":`Show the image at its actual size`,title:a.value===`actual`?`Actual size: on. Click to shrink the image to fit`:`Actual size: off. Click to show every pixel 1:1 and scroll`,onClick:n[0]||=e=>a.value=a.value===`actual`?`fit`:`actual`},` 1:1 `,10,hx)]),X(vv,{src:o.value,width:e.media.image.width,height:e.media.image.height,fit:a.value,onFail:n[1]||=e=>r(`fail`)},null,8,[`src`,`width`,`height`,`fit`])])):Q(``,!0)}}),[[`__scopeId`,`data-v-94ee96d6`]]),_x={class:`file-pane`},vx={key:0,class:`pane-header mono`,"data-testid":`file-header`},yx=[`title`],bx={class:`file-meta`},xx={key:0,class:`file-lang`},Sx={key:1,class:`file-lang`,"data-testid":`file-format`},Cx={key:2,class:`mono`,"data-testid":`file-dimensions`},wx={key:3,"data-testid":`file-frames`},Tx={key:4,class:`file-size`},Ex={class:`pane-body`},Dx={key:0,class:`pane-note`,"data-testid":`file-prompt`},Ox={key:1,class:`pane-note pane-error mono`,"data-testid":`file-error`},kx={key:2,class:`pane-note`,"data-testid":`file-loading`},Ax={key:4,class:`pane-note`,"data-testid":`file-binary`},jx={key:0,"data-testid":`image-refused`},Mx={key:5,class:`pane-note`,"data-testid":`file-too-large`},Nx={key:6,class:`pane-note`,"data-testid":`file-empty`},Px=[`data-ln`],Fx={class:`ln code-gutter`},Ix=[`innerHTML`],Lx={key:0,class:`truncated-note mono`,"data-testid":`file-truncated`},Rx=ef(gr({__name:`FileContentPane`,props:{path:{},file:{},loading:{type:Boolean},error:{},wrap:{type:Boolean}},setup(e){let t=e,n=$(()=>{if(t.path===null||t.file===null)return null;let{binary:e,tooLarge:n,content:r}=t.file;return e||n||r===``?null:Cg(r,t.path)}),r=cl(),i=V(null),a=V(null),o=null;W(()=>r.lineRequest,e=>{e&&On(()=>{let t=i.value?.querySelector(`[data-ln="${e.line}"]`);t&&(t.scrollIntoView({block:`center`}),a.value=e.line,o&&clearTimeout(o),o=setTimeout(()=>{a.value=null,o=null},1200))})});let s=$(()=>{let e=n.value?.lines.length??0;return`${Math.max(3,String(e).length)}ch`}),c=$(()=>t.file!==null&&!t.file.binary&&!t.file.tooLarge&&t.file.content===``),l=V(!1);W(()=>[t.path,t.file],()=>{l.value=!1});let u=$(()=>{if(l.value)return` · preview failed to decode`;let e=t.file?.media?.refusal??null,n=e===null?null:fv[e];return n===null?``:` · ${n}`}),d=$(()=>t.file?.media?.image??null),f=$(()=>{let e=d.value?.frames??1;return e>1?e:null});return(t,r)=>(q(),J(`div`,_x,[e.path?(q(),J(`header`,vx,[Y(`span`,{class:`file-path`,title:e.path},B(e.path),9,yx),Y(`span`,bx,[n.value?.language?(q(),J(`span`,xx,B(n.value.language),1)):Q(``,!0),d.value?(q(),J(`span`,Sx,B(d.value.format),1)):Q(``,!0),d.value?(q(),J(`span`,Cx,B(d.value.width)+` × `+B(d.value.height),1)):Q(``,!0),f.value?(q(),J(`span`,wx,B(f.value)+` frames`,1)):Q(``,!0),e.file?(q(),J(`span`,Tx,B(U(Kl)(e.file.size)),1)):Q(``,!0),e.path?(q(),ga(fx,{key:5,path:e.path},null,8,[`path`])):Q(``,!0),X(M_)])])):Q(``,!0),Y(`div`,Ex,[e.path===null?(q(),J(`p`,Dx,`Select a file`)):e.error&&e.file===null?(q(),J(`p`,Ox,B(e.error),1)):e.file===null?(q(),J(`p`,kx,B(e.loading?`Loading…`:``),1)):e.file.media?.image&&!l.value?(q(),ga(gx,{key:3,path:e.path,media:e.file.media,onFail:r[0]||=e=>l.value=!0},null,8,[`path`,`media`])):e.file.binary||e.file.media?(q(),J(`p`,Ax,[Z(` Binary file — `+B(U(Kl)(e.file.size)),1),u.value?(q(),J(`span`,jx,B(u.value),1)):Q(``,!0)])):e.file.tooLarge?(q(),J(`p`,Mx,` File too large to display (`+B(U(Kl)(e.file.size))+`) `,1)):c.value?(q(),J(`p`,Nx,`Empty file`)):n.value?(q(),J(`div`,{key:7,ref_key:`scrollEl`,ref:i,class:z([`code-scroll mono`,{wrap:e.wrap}]),"data-testid":`file-content`},[Y(`div`,{class:z([`code-lines`,{stale:e.loading}]),style:le({"--ln-w":s.value})},[(q(!0),J(K,null,G(n.value.lines,(e,t)=>(q(),J(`div`,{key:t,class:z([`code-row`,{"line-flash":a.value===t+1}]),"data-ln":t+1},[Y(`span`,Fx,B(t+1),1),Y(`span`,{class:`code code-cell`,innerHTML:e},null,8,Ix)],10,Px))),128))],6),e.file.truncated?(q(),J(`p`,Lx,` Truncated — showing the first `+B(n.value.lines.length.toLocaleString())+` of `+B(e.file.totalLines.toLocaleString())+` lines. `,1)):Q(``,!0)],2)):Q(``,!0)])]))}}),[[`__scopeId`,`data-v-19236ad9`]]),zx=5e3;function Bx(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n>0?t.slice(n):t}function Vx(e,t){if(e.binary)return{kind:`note`,note:`Binary file — no outline.`};if(e.tooLarge)return{kind:`note`,note:`File too large to outline.`};if(t===null)return{kind:`note`,note:`Loading outline…`};if(t.status===`unavailable`)return{kind:`note`,note:`Outline unavailable for this file.`};if(t.status===`unsupported`)return t.reason===`no-script-block`?{kind:`note`,note:`No <script> block in this component.`}:{kind:`note`,note:`No outline for ${Bx(e.path)} files.`};if(t.symbols.length===0)return{kind:`note`,note:`No symbols in this file.`};let n=e.truncated&&e.totalLines>zx?`Outline of the first ${zx.toLocaleString()} of ${e.totalLines.toLocaleString()} lines.`:null;return{kind:`symbols`,symbols:t.symbols,note:n}}var Hx=[`value`],Ux={key:0,class:`outline-note`,"data-testid":`outline-note`},Wx={key:0,class:`outline-note`,"data-testid":`outline-partial`},Gx={key:1,class:`outline-note`,"data-testid":`outline-no-match`},Kx={key:2,class:`outline-list`,role:`listbox`,"aria-label":`Symbols`},qx=[`title`,`aria-selected`,`onMousemove`,`onClick`],Jx={class:`outline-kind`},Yx={class:`outline-name`},Xx={key:0,class:`outline-parent`},Zx={class:`outline-line`},Qx=ef(gr({__name:`OutlinePopover`,setup(e,{expose:t}){let n=cl(),{open:r,rootEl:i}=nf(),a=V(null),o=V(``),s=V(0),c=null;function l(){o.value=``,s.value=0,c=document.activeElement instanceof HTMLElement?document.activeElement:null,r.value=!0,On(()=>a.value?.focus())}W(r,e=>{if(e)return;let t=i.value?.contains(document.activeElement)??!1,n=c;c=null,t&&n?.isConnected===!0&&n.focus()}),t({openPopover:l});let u=$(()=>n.file===null||n.selectedPath===null?{kind:`note`,note:`No file open.`}:Vx({path:n.selectedPath,binary:n.file.binary,tooLarge:n.file.tooLarge,truncated:n.file.truncated,totalLines:n.file.totalLines},n.fileSymbols)),d=$(()=>u.value.kind===`symbols`?u.value.symbols:[]),f=$(()=>{let e=o.value.trim();if(e===``)return d.value;let t=d.value.map(e=>e.name),n=new Set(Cd(t,t.length).find(e).map(e=>e.text));return d.value.filter(e=>n.has(e.name))});W(f,()=>{s.value=0}),W(()=>n.selectedPath,()=>{r.value=!1});function p(e){n.requestLine(e.startLine),r.value=!1}function m(e){if(e.key===`ArrowDown`||e.ctrlKey&&e.key===`j`)e.preventDefault(),s.value=Td(s.value,1,f.value.length);else if(e.key===`ArrowUp`||e.ctrlKey&&e.key===`k`)e.preventDefault(),s.value=Td(s.value,-1,f.value.length);else if(e.key===`Enter`){e.preventDefault();let t=f.value[s.value];t!==void 0&&p(t)}else e.key===`Escape`&&(e.preventDefault(),r.value=!1)}return(e,t)=>U(r)?(q(),J(`div`,{key:0,ref_key:`rootEl`,ref:i,class:`outline mono`,"data-testid":`outline-popover`},[Y(`input`,{ref_key:`inputEl`,ref:a,class:`outline-input mono`,"data-testid":`outline-input`,type:`text`,autocomplete:`off`,spellcheck:`false`,placeholder:`filter symbols`,"aria-label":`Filter symbols`,value:o.value,onInput:t[0]||=e=>o.value=e.target.value,onKeydown:m},null,40,Hx),u.value.kind===`note`?(q(),J(`p`,Ux,B(u.value.note),1)):(q(),J(K,{key:1},[u.value.note?(q(),J(`p`,Wx,B(u.value.note),1)):Q(``,!0),f.value.length===0?(q(),J(`p`,Gx,` No symbol matches “`+B(o.value.trim())+`”. `,1)):(q(),J(`ul`,Kx,[(q(!0),J(K,null,G(f.value,(e,t)=>(q(),J(`li`,{key:`${e.name}:${e.startLine}`,class:z([`outline-row`,{selected:t===s.value}]),title:e.parent?`${e.name} in ${e.parent}`:e.name,role:`option`,"aria-selected":t===s.value,onMousemove:e=>s.value=t,onClick:t=>p(e)},[Y(`span`,Jx,B(e.kind),1),Y(`span`,Yx,B(e.name),1),e.parent?(q(),J(`span`,Xx,`in `+B(e.parent),1)):Q(``,!0),Y(`span`,Zx,B(e.startLine),1)],42,qx))),128))]))],64))],512)):Q(``,!0)}}),[[`__scopeId`,`data-v-6a76fb9b`]]),$x={class:`tree-col`},eS={class:`tree-toolbar`,role:`toolbar`,"aria-label":`Explorer filters`},tS=[`aria-pressed`,`title`],nS=[`aria-pressed`,`title`],rS=[`aria-pressed`,`title`],iS=[`disabled`],aS={class:`tree-scroll`},oS={key:0,class:`panel-note`},sS={key:1,class:`panel-note view-error`,"data-testid":`tree-error`},cS={key:2,class:`panel-note`,"data-testid":`tree-empty`},lS=[`aria-level`,`aria-expanded`,`aria-selected`,`aria-busy`,`tabindex`,`title`,`onClick`,`onKeydown`],uS={class:`chevron`,"aria-hidden":`true`},dS={key:0,class:`changes-dot`,title:`Contains changes`},fS={key:1,class:`staged-dot`,title:`Staged`},pS={key:2,class:`status-letter`,"data-testid":`status-letter`},mS={key:4,class:`panel-note view-error`,"data-testid":`tree-error`},hS=ef(gr({__name:`ExplorerView`,setup(e){let t=sl(),n=Vl(),r=cl(),i=V(null);W(()=>n.outlineRequest,e=>{e!==0&&(i.value?.openPopover(),r.loadSymbols())});let{rows:a,rootLoading:o,error:s,showHidden:c,showIgnored:l,changedOnly:u,selectedPath:d,file:f,fileLoading:p,fileError:m}=Fs(r),h=V(null);async function g(){await r.ensureRoot()}async function _(e){await r.toggleDir(e)}async function v(e){await r.openFile(e)}jr(()=>{g()}),W(()=>t.repoId,()=>{g()});function y(e){b.value=e.entry.path,tu({view:`explorer`}),e.entry.type===`dir`?_(e.entry.path):v(e.entry.path)}let b=V(null),x=$(()=>{for(let e of[b.value,d.value]){if(e===null)continue;let t=a.value.findIndex(t=>t.entry.path===e);if(t!==-1)return t}return 0});function S(e){let t=a.value[e];t&&(b.value=t.entry.path,On(()=>{h.value?.querySelectorAll(`.tree-row`)[e]?.focus()}))}function C(e){return a.value.findIndex(t=>t.entry.path===e.entry.path)}function w(e,t){let n=C(e);n!==-1&&S(Math.min(a.value.length-1,Math.max(0,n+t)))}function T(e){if(e.entry.type!==`dir`)return;if(!e.isExpanded){_(e.entry.path);return}let t=C(e);if(t===-1)return;let n=a.value[t+1];n&&n.depth>e.depth&&S(t+1)}function E(e){if(e.entry.type===`dir`&&e.isExpanded){r.collapseDir(e.entry.path);return}let t=e.entry.path;for(let e=t.lastIndexOf(`/`);e!==-1;e=t.lastIndexOf(`/`)){t=t.slice(0,e);let n=a.value.findIndex(e=>e.entry.path===t);if(n!==-1){S(n);return}}}W(()=>a.value,()=>{let e=h.value?.contains(document.activeElement)??!1;On(()=>{let t=h.value;if(!e||!t||t.contains(document.activeElement))return;let n=x.value,r=a.value[n];r&&(b.value=r.entry.path,t.querySelectorAll(`.tree-row`)[n]?.focus())})}),W(d,()=>{On(()=>{h.value?.querySelector(`.tree-row.selected`)?.scrollIntoView({block:`nearest`})})});function D(e){return e.entry.gitStatus?`st-${e.entry.gitStatus}`:null}let O=gu(),k=V(null),A=zm({container:k,isRow:O,row:{pref:`explorerTop`,defaultRatio:.34,min:kl,max:Al}}),j=V(null),M=Um(O,j,`File content`),N=Vm(O,(e,t)=>w(t,e));return(e,t)=>(q(),J(`div`,{ref_key:`containerEl`,ref:k,class:z([`explorer`,{portrait:U(O)}]),style:le(U(O)?{"--explorer-top":`${(U(A).rowRatio.value*100).toFixed(2)}%`}:void 0)},[Y(`aside`,$x,[(q(),ga(lr,{defer:``,to:`#view-toolbar-slot`,disabled:!U(O)},[Y(`div`,eS,[Y(`button`,{class:`tool-toggle mono`,"data-testid":`toggle-hidden`,"aria-pressed":U(c),title:U(c)?`Dotfiles are shown. Click to hide them`:`Dotfiles are hidden. Click to show them`,onClick:t[0]||=e=>U(r).setShowHidden(!U(c))},` dotfiles `,8,tS),Y(`button`,{class:`tool-toggle mono`,"data-testid":`toggle-ignored`,"aria-pressed":U(l),title:U(l)?`Gitignored files are shown. Click to hide them`:`Gitignored files are hidden. Click to show them`,onClick:t[1]||=e=>U(r).setShowIgnored(!U(l))},` ignored `,8,nS),Y(`button`,{class:`tool-toggle mono`,"data-testid":`toggle-changed`,"aria-pressed":U(u),title:U(u)?`Showing only files with changes. Click to show every file`:`Showing every file. Click to show only files with changes`,onClick:t[2]||=e=>U(r).setChangedOnly(!U(u))},` changed `,8,rS),Y(`button`,{class:`tool-refresh mono`,"data-testid":`tree-refresh`,"aria-label":`Reload the tree`,title:`Reload the tree`,disabled:U(o),onClick:t[3]||=e=>U(r).refresh()},` ↻ `,8,iS)])],8,[`disabled`])),Y(`div`,aS,[U(o)&&U(a).length===0?(q(),J(`p`,oS,`Loading tree…`)):U(s)&&U(a).length===0?(q(),J(`p`,sS,B(U(s)),1)):U(a).length===0?(q(),J(`p`,cS,B(U(u)?`No changed files.`:`Empty repository.`),1)):(q(),J(`div`,{key:3,ref_key:`treeEl`,ref:h,class:`tree mono`,role:`tree`,"aria-label":`Repository files`},[(q(!0),J(K,null,G(U(a),(e,n)=>(q(),J(K,{key:e.entry.path},[Y(`div`,{class:z([`tree-row list-row`,[D(e),{selected:e.entry.path===U(d)}]]),role:`treeitem`,"aria-level":e.depth+1,"aria-expanded":e.entry.type===`dir`?e.isExpanded:void 0,"aria-selected":e.entry.path===U(d),"aria-busy":e.isLoading||void 0,tabindex:n===x.value?0:-1,title:e.entry.path,onClick:t=>y(e),onKeydown:[Xo(Jo(t=>w(e,1),[`prevent`]),[`down`]),Xo(Jo(t=>w(e,-1),[`prevent`]),[`up`]),Xo(Jo(t=>T(e),[`prevent`]),[`right`]),Xo(Jo(t=>E(e),[`prevent`]),[`left`]),Xo(Jo(t=>y(e),[`prevent`]),[`enter`]),Xo(Jo(t=>y(e),[`prevent`]),[`space`]),t[4]||=Xo(Jo(e=>S(0),[`prevent`]),[`home`]),t[5]||=Xo(Jo(e=>S(U(a).length-1),[`prevent`]),[`end`]),t=>U(N)(t,e)]},[(q(!0),J(K,null,G(e.depth,e=>(q(),J(`span`,{key:e,class:`guide`,"aria-hidden":`true`}))),128)),Y(`span`,uS,B(e.entry.type===`dir`?e.isExpanded?`▾`:`▸`:``),1),Y(`span`,{class:z([`name`,{dir:e.entry.type===`dir`}])},B(e.displayName),3),e.entry.type===`dir`&&e.entry.hasChanges?(q(),J(`span`,dS,`●`)):Q(``,!0),e.entry.type===`file`&&e.entry.staged?(q(),J(`span`,fS,`●`)):Q(``,!0),e.entry.type===`file`&&e.entry.gitStatus?(q(),J(`span`,pS,B(U(ql)(e.entry.gitStatus)),1)):Q(``,!0)],42,lS),e.isExpanded&&e.isLoading?(q(),J(`div`,{key:0,class:`tree-loading mono`,role:`presentation`,"data-testid":`dir-loading`,style:le({paddingLeft:`${(e.depth+1)*1.25+1.75}ch`})},` Loading… `,4)):Q(``,!0)],64))),128))],512)),U(s)&&U(a).length>0?(q(),J(`p`,mS,B(U(s)),1)):Q(``,!0)])]),U(O)?(q(),ga(Pv,{key:0,split:U(A),label:`Resize file tree`},null,8,[`split`])):Q(``,!0),Y(`section`,Oa({ref_key:`payloadEl`,ref:j,class:`content-col`},U(M)),[X(Qx,{ref_key:`outlineEl`,ref:i},null,512),X(Rx,{path:U(d),file:U(f),loading:U(p),error:U(m),wrap:U(n).wrapEnabled},null,8,[`path`,`file`,`loading`,`error`,`wrap`])],16)],6))}}),[[`__scopeId`,`data-v-48316821`]]),gS={class:`shell`},_S={class:`workspace`},vS=3e3,yS=1500,bS=ef(gr({__name:`App`,setup(e){let t=ic(),n=cl(),r=sl(),i=Vl();_u();let{activate:a,openByPath:o}=Hl();i.init(),su(),cu(),pu();let s={changes:ey,journal:Dy,history:_b,compare:ux,explorer:hS},c=$(()=>s[i.activeView]),l=$(()=>t.activeRepoId!==null);jr(()=>{t.connect()});let u=()=>{r.releaseOnUnload()};jr(()=>{window.addEventListener(`pagehide`,u)}),Fr(()=>{window.removeEventListener(`pagehide`,u)});let d=!0,f=null;function p(){d=!1,f!==null&&(clearTimeout(f),f=null)}function m(e){t.activeRepoId===null&&e.length!==0&&a(e[0])}let h=nu({onRestore:_}),g=V(null);async function _(e,n){if(e.view===null&&e.repo===null)return;e.repo!==null&&t.suspendFollowNavigation(yS);let r=t.activeRepoId===null;r&&e.view!==null&&i.setActiveView(e.view),(await y(e,n)||v(e,n))&&(!r&&e.view!==null&&i.setActiveView(e.view),e.view!==null&&await b(e,n))}function v(e,t){return!t.isStale()&&e.repo!==null&&r.repoId===null&&r.repoPath===h.toAbsolute(e.repo)}async function y(e,t){return e.repo===null||h.isActiveRepo(e.repo)?!0:(await h.whenHomeReady,t.isStale()||!await o(h.toAbsolute(e.repo))||t.isStale()?!1:(await On(),!t.isStale()))}async function b(e,t){switch(g.value=null,e.view){case`explorer`:e.at===null?n.clearSelection():e.at!==n.selectedPath&&await n.revealFile(e.at);return;case`history`:await S(e.at,e.whole,t);return;case`compare`:await C(e,t);return;case`changes`:x(e.at,e.whole);return;default:return}}function x(e,t=null){if(e===null){r.selectFile(null),i.setActiveStackKey(null),r.setWholeFile(null);return}let n=r.shared.status?.files;if(!n){g.value={view:`changes`,at:e,whole:t,repoPath:r.repoPath};return}let a=e.slice(e.indexOf(`:`)+1),o=n.find(t=>Qc(t)===e)??n.find(e=>e.path===a)??null;if(!o)return;r.selectFile(o);let s=Qc(o);i.setActiveStackKey(s),i.requestStackScroll(s),r.setWholeFile(t===o.path?{view:`changes`,key:s,path:o.path}:null)}async function S(e,t,n){if(e===null){await r.selectHistoryCommit(null),r.setWholeFile(null);return}let i=e=>{r.setWholeFile(t===null?null:{view:`history`,key:`h:${e}:${t}`,path:t,hash:e})};if(r.history.selectedCommit?.hash.startsWith(e)){i(r.history.selectedCommit.hash);return}let a=r.history.commits.find(t=>t.hash.startsWith(e));if(a){await r.selectHistoryCommit(a),i(a.hash);return}let o=await r.resolveCommit(e);o===null||n.isStale()||(await r.selectHistoryCommit(o),i(o.hash))}async function C(e,t){let n=e.base!==null&&e.base!==r.selectedCompareBase?e.base:void 0;if((n!==void 0||e.head!==r.selectedStackHead)&&(await r.setComparePick({base:n,head:e.head}),t.isStale()))return;if(e.at===null){r.setWholeFile(null);return}let a=r.compare.compareDiff?.files;if(!a){g.value={view:`compare`,at:e.at,whole:e.whole,repoPath:r.repoPath};return}let o=a.findIndex(t=>t.path===e.at);if(o===-1)return;r.selectCompareFile(o);let s=a[o];i.requestStackScroll($c(s)),r.setWholeFile(e.whole===s.path?{view:`compare`,key:$c(s),path:s.path,side:s.uncommitted}:null)}function w(e){return e.repoPath===r.repoPath||(g.value=null,!1)}return W(()=>r.shared.status,()=>{let e=g.value;e?.view===`changes`&&i.activeView===`changes`&&w(e)&&(g.value=null,x(e.at,e.whole??null))}),W(()=>r.compare.compareDiff,e=>{let t=g.value;if(t?.view!==`compare`||i.activeView!==`compare`||!e||!w(t))return;g.value=null;let n=e.files.findIndex(e=>e.path===t.at);if(n===-1)return;r.selectCompareFile(n);let a=e.files[n];i.requestStackScroll($c(a)),r.setWholeFile(t.whole===a.path?{view:`compare`,key:$c(a),path:a.path,side:a.uncommitted}:null)}),(h.initial.view!==null||h.initial.repo!==null)&&(h.initial.repo!==null&&(p(),t.skipInitialFollow=!0),h.restore(h.initial)),W([()=>t.repos,()=>t.follow],([e,n])=>{d&&(n===null?f===null&&e.length>0&&(f=setTimeout(()=>{f=null,d&&(p(),m(t.repos))},vS)):(p(),!(t.followEnabled&&n.followedRepoId!==null&&n.followedPath!==null)&&m(e)))}),Fr(()=>{f!==null&&clearTimeout(f)}),(e,n)=>(q(),J(`div`,gS,[X(Pf),X(Jf),X(Yf),Y(`main`,_S,[l.value?(q(),ga(Hr(c.value),{key:U(t).activeRepoId??``})):(q(),ga(sp,{key:0}))]),X(ip),U(i).activeOverlay===`finder`?(q(),ga(Sp,{key:0})):U(i).activeOverlay===`search`?(q(),ga(Ip,{key:1})):U(i).activeOverlay===`help`?(q(),ga(Kp,{key:2})):U(i).activeOverlay===`settings`?(q(),ga(Om,{key:3})):Q(``,!0)]))}}),[[`__scopeId`,`data-v-6c0b2faa`]]),xS={black:`#000000`,red:`#cd0000`,green:`#00cd00`,yellow:`#cdcd00`,blue:`#0000ee`,magenta:`#cd00cd`,cyan:`#00cdcd`,white:`#e5e5e5`,gray:`#7f7f7f`,grey:`#7f7f7f`,blackBright:`#7f7f7f`,redBright:`#ff0000`,greenBright:`#00ff00`,yellowBright:`#ffff00`,blueBright:`#5c5cff`,magentaBright:`#ff00ff`,cyanBright:`#00ffff`,whiteBright:`#ffffff`};function SS(e){if(e.startsWith(`#`))return e.toLowerCase();let t=xS[e];if(!t)throw Error(`unknown color name: ${e}`);return t}function CS(e){return[`--diff-add-bg: ${SS(e.addBg)};`,`--diff-del-bg: ${SS(e.delBg)};`,`--diff-add-highlight: ${SS(e.addHighlight)};`,`--diff-del-highlight: ${SS(e.delHighlight)};`,`--diff-text: ${SS(e.text)};`,`--diff-add-line-num: ${SS(e.addLineNum)};`,`--diff-del-line-num: ${SS(e.delLineNum)};`,`--diff-context-line-num: ${SS(e.contextLineNum)};`,`--diff-add-symbol: ${SS(e.addSymbol)};`,`--diff-del-symbol: ${SS(e.delSymbol)};`]}function wS(e){return[`--bg: ${e.bg};`,`--surface: ${e.surface};`,`--surface-raised: ${e.surfaceRaised};`,`--border: ${e.border};`,`--text: ${e.text};`,`--text-dim: ${e.textDim};`,`--accent: ${e.accent};`,`--selection: ${e.selection};`,`--add: ${e.add};`,`--del: ${e.del};`,`--warn: ${e.warn};`,`--status-modified: ${e.statusModified};`,`--status-added: ${e.statusAdded};`,`--status-deleted: ${e.statusDeleted};`,`--status-untracked: ${e.statusUntracked};`,`--status-renamed: ${e.statusRenamed};`,`--status-copied: ${e.statusCopied};`,`--status-conflicted: ${e.statusConflicted};`,`--uncommitted: ${e.uncommitted};`,`--flash: ${e.flash};`]}function TS(e){return[`--syn-keyword: ${e.keyword};`,`--syn-string: ${e.string};`,`--syn-comment: ${e.comment};`,`--syn-number: ${e.number};`,`--syn-literal: ${e.literal};`,`--syn-title: ${e.title};`,`--syn-attr: ${e.attr};`,`--syn-meta: ${e.meta};`]}function ES(e){let t=[`color-scheme: ${e.scheme};`,...wS(e.chrome),...CS(e.colors),...TS(e.syntax)];return`:root[data-theme='${e.name}'] {\n ${t.join(`
|
|
12
|
+
`),{language:t,ignoreIllegals:!0}).value,r=xg(n);e.forEach((e,t)=>{let n=r[t];n!==void 0&&i.set(e,Og(n))})}return i}var Mg=new WeakMap;function Ng(e,t,n,r){let i=r?.get(e),a=`${n?`1`:`0`}|${t??``}|${i?`d`:`l`}`,o=Mg.get(e);if(o&&o.sig===a)return o.pieces;if(i!==void 0){let t=kg(Ag(i,e.segments));return Mg.set(e,{sig:a,pieces:t}),t}let s=n&&e.kind!==`no-newline`&&t!==null&&e.content.length<=2e3?kg(Ag(Dg(e.content,t),e.segments)):null;return Mg.set(e,{sig:a,pieces:s}),s}function Pg(e,t){return t?.kind===`del`?{key:e.key,left:e,right:null}:t?.kind===`add`?{key:e.key,left:null,right:e}:{key:e.key,left:e,right:e}}function Fg(e,t){let n=t,r=[];for(;n<e.length&&e[n].kind===`del`;)r.push(e[n++]);let i=n<e.length&&e[n].kind===`no-newline`?e[n++]:null,a=[];for(;n<e.length&&e[n].kind===`add`;)a.push(e[n++]);let o=i!==null&&a.length>0&&n<e.length&&e[n].kind===`no-newline`?e[n++]:null;return r.length===0&&a.length===0&&i===null&&n++,{dels:r,adds:a,midMarker:i,endMarker:o,next:n}}function Ig(e){let t=[],n=Math.max(e.dels.length,e.adds.length);for(let r=0;r<n;r++){let n=e.dels[r]??null,i=e.adds[r]??null;t.push({key:`${n?.key??`_`}|${i?.key??`_`}`,left:n,right:i})}return e.midMarker&&t.push({key:`${e.midMarker.key}|${e.endMarker?.key??`_`}`,left:e.midMarker,right:e.endMarker}),t}function Lg(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(r.kind===`no-newline`)t.push(Pg(r,e[n-1])),n++;else if(r.kind===`context`)t.push({key:r.key,left:r,right:r}),n++;else{let r=Fg(e,n);t.push(...Ig(r)),n=r.next}}return t}var Rg=new WeakMap;function zg(e){let t=Rg.get(e);return t||(t=Lg(e),Rg.set(e,t)),t}function Bg(e){return zg(e).length}var Vg=gr({__name:`DiffLineContent`,props:{row:{},pieces:{}},setup(e){return(t,n)=>e.pieces?(q(!0),J(K,{key:0},G(e.pieces,(e,t)=>(q(),J(`span`,{key:t,class:z([e.cls,{"word-hl":e.changed}])},B(e.text),3))),128)):e.row.segments?(q(!0),J(K,{key:1},G(e.row.segments,(e,t)=>(q(),J(`span`,{key:t,class:z({"word-hl":e.type===`changed`})},B(e.text),3))),128)):(q(),J(K,{key:2},[Z(B(e.row.content),1)],64))}}),Hg=[`title`],Ug=ef(gr({__name:`ViewFileButton`,props:{path:{}},setup(e){let t=e,n=Vl(),r=cl();function i(){tu({view:`explorer`}),n.setActiveView(`explorer`),r.revealFile(t.path)}return(e,n)=>(q(),J(`button`,{class:`view-file mono`,"data-testid":`view-file`,title:`Open ${t.path} in the Explorer`,onClick:n[0]||=Jo(e=>i(),[`stop`])},` view file `,8,Hg))}}),[[`__scopeId`,`data-v-18b50238`]]),Wg=[`title`],Gg=1500,Kg=ef(gr({__name:`CopyPathButton`,props:{path:{}},setup(e){let t=e,n=V(null),r=null;function i(e){n.value=e,r!==null&&clearTimeout(r),r=setTimeout(()=>{n.value=null,r=null},Gg)}Pr(()=>{r!==null&&clearTimeout(r)});async function a(){try{await navigator.clipboard.writeText(t.path),i(`copied`)}catch{i(`failed`)}}return(e,r)=>(q(),J(`button`,{class:`copy-path mono`,"data-testid":`copy-path`,title:`Copy ${t.path} to the clipboard`,onClick:r[0]||=Jo(e=>a(),[`stop`])},B(n.value===`copied`?`copied`:n.value===`failed`?`copy failed`:`copy path`),9,Wg))}}),[[`__scopeId`,`data-v-ccadb0c1`]]),qg=`→`;function Jg(e){return e===`staged`?`index`:`working tree`}function Yg(e){switch(e.kind){case`working`:return e.status===`untracked`?`new file ${qg} working tree`:e.status===`deleted`?e.staged?`HEAD ${qg} deleted`:`index ${qg} deleted`:e.staged?`HEAD ${qg} index`:`index ${qg} working tree`;case`compare`:return`${e.base??`base`}…${e.head??`HEAD`}`;case`compare-uncommitted`:return`${e.base??`base`}…${Jg(e.side)}`;case`commit`:return`${e.shortHash}^ ${qg} ${e.shortHash}`;case`journal`:return`HEAD ${qg} working tree`}}function Xg(e){switch(e.kind){case`working`:return e.status===`untracked`?`A new file: every line is an addition`:e.status===`deleted`?`The file was deleted; every line is a removal`:e.staged?`What you have staged: HEAD compared against the index`:`What you have not staged yet: the index compared against the file on disk`;case`compare`:return e.head===null?`Everything this branch adds on top of its base (three-dot diff)`:`Everything ${e.head} adds on top of the layer below it (three-dot diff)`;case`compare-uncommitted`:return e.side===`staged`?`Everything this branch adds on top of its base, plus what you have staged (three-dot diff against the index)`:`Everything this branch adds on top of its base, plus your uncommitted work (three-dot diff against the working tree)`;case`commit`:return`What this commit changed, against its parent`;case`journal`:return`The working tree compared against HEAD`}}var Zg=[`title`],Qg=ef(gr({__name:`RefPairLabel`,props:{pair:{}},setup(e){let t=e,n=$(()=>Yg(t.pair)),r=$(()=>Xg(t.pair));return(e,t)=>(q(),J(`span`,{class:`ref-pair mono`,"data-testid":`ref-pair`,title:r.value},B(n.value),9,Zg))}}),[[`__scopeId`,`data-v-4d0265c4`]]),$g=[`disabled`,`aria-pressed`,`title`],e_=ef(gr({__name:`WholeFileToggle`,props:{on:{type:Boolean},busy:{type:Boolean},disabled:{type:Boolean},disabledReason:{}},emits:[`toggle`],setup(e){return(t,n)=>(q(),J(`button`,{class:z([`whole-file mono`,{on:e.on}]),"data-testid":`whole-file`,disabled:e.disabled||e.busy,"aria-pressed":e.on,title:e.disabled?e.disabledReason??`This file has no wider view`:e.on?`Back to hunks`:`Show the whole file, with the changes marked`,onClick:n[0]||=Jo(e=>t.$emit(`toggle`),[`stop`])},B(e.busy?`loading…`:e.on?`hunks`:`whole file`),11,$g))}}),[[`__scopeId`,`data-v-18074880`]]),t_={key:0,class:`diff-empty`,"data-testid":`diff-empty`},n_={key:0,"data-testid":`not-shown-note`},r_={key:2},i_={key:0,class:`file-header`,"data-testid":`file-section-header`},a_={class:`pin-x`},o_={class:`file-path`},s_={class:`pin-x`},c_=[`data-edited-at`],l_={class:`hunk-header`,"data-testid":`hunk-header`},u_={class:`pin-x`},d_={key:0,class:`ranges`},f_={key:1,class:`ranges`},p_={key:2,class:`hunk-context`},m_={key:3,class:`hunk-time`,"data-testid":`hunk-time`},h_={class:`ln code-gutter old`},g_={class:`ln code-gutter new`},__={class:`marker`},v_={class:`content code-cell`},y_={key:1,class:`split-body`},b_={class:`split-side left`},x_={class:`ln code-gutter`},S_={class:`marker`},C_={class:`content code-cell`},w_={class:`split-side right`},T_={class:`ln code-gutter`},E_={class:`marker`},D_={class:`content code-cell`},O_=1500,k_=6e4,A_=ef(gr({__name:`DiffView`,props:{diff:{},filePath:{},mode:{},syntax:{type:Boolean},refPair:{},showWholeToggle:{type:Boolean},wholePath:{},wholeLoading:{type:Boolean},wholeRefusal:{},wrap:{type:Boolean},showFileHeaders:{type:Boolean},embedded:{type:Boolean}},emits:[`toggle-whole`],setup(e,{emit:t}){let n=e,r=t,i=$(()=>{let e=new Map;for(let t of l.value.sections)e.set(t.key,wg(t.filePath??n.filePath));return e}),a=$(()=>{let e=new Map;if(n.syntax!==!0||n.wholePath==null)return e;for(let t of l.value.sections){if((t.filePath??n.filePath)!==n.wholePath)continue;let r=t.hunks.flatMap(e=>e.rows);e.set(t.key,jg(r,i.value.get(t.key)??null))}return e});function o(e,t){return Ng(e,i.value.get(t.key)??null,n.syntax===!0,a.value.get(t.key))}function s(e,t){return e?o(e,t):null}let c=$(()=>n.mode===`split`),l=$(()=>Wc(n.diff)),u=$(()=>n.showFileHeaders||l.value.sections.filter(e=>e.filePath!==null).length>1),d=V(Date.now()),f=null;function p(){let e=l.value.latestEditedAt;return e!==void 0&&Date.now()-e<k_}function m(){f!==null&&(clearInterval(f),f=null)}function h(){p()?f===null&&(f=setInterval(()=>{d.value=Date.now(),p()||m()},1e3)):m()}W(()=>l.value.latestEditedAt,h,{immediate:!0}),Pr(m);function g(e){return e.editedAt===void 0?``:Od(e.editedAt,d.value)}function _(e){return e.editedAt!==void 0&&d.value-e.editedAt<O_}function v(e){return e.kind===`add`?`+`:e.kind===`del`?`-`:``}let y=$(()=>l.value.sections.some(e=>e.notes.length>0)),b=V(null),x=!1;function S(e){let t=e.target;if(x||!(t instanceof HTMLElement)||!t.classList.contains(`split-side`))return;x=!0;let n=t.scrollLeft;b.value?.querySelectorAll(`.split-side`).forEach(e=>{e!==t&&e.scrollLeft!==n&&(e.scrollLeft=n)}),requestAnimationFrame(()=>{x=!1})}return jr(()=>{b.value?.addEventListener(`scroll`,S,!0)}),Pr(()=>{b.value?.removeEventListener(`scroll`,S,!0)}),(t,n)=>l.value.rowCount===0?(q(),J(`div`,t_,[l.value.notShown?(q(),J(`p`,n_,B(l.value.notShown.note),1)):y.value?(q(),J(K,{key:1},[(q(!0),J(K,null,G(l.value.sections.flatMap(e=>e.notes),(e,t)=>(q(),J(`p`,{key:t,class:`empty-note mono`},B(e),1))),128)),n[0]||=Y(`p`,null,`No text changes to show.`,-1)],64)):(q(),J(`p`,r_,`No changes to show.`))])):(q(),J(`div`,{key:1,ref_key:`rootEl`,ref:b,class:z([`diff-scroll mono`,{"with-file-headers":u.value,split:c.value,embedded:e.embedded,wrap:e.wrap}]),"data-testid":`diff-view`,style:le({"--ln-w":`${l.value.lineNumWidth}ch`})},[(q(!0),J(K,null,G(l.value.sections,t=>(q(),J(`section`,{key:t.key,class:`file-section`},[u.value&&t.filePath?(q(),J(`div`,i_,[Y(`span`,a_,[Y(`span`,o_,B(t.filePath),1),e.refPair?(q(),ga(Qg,{key:0,pair:e.refPair},null,8,[`pair`])):Q(``,!0),e.showWholeToggle?(q(),ga(e_,{key:1,on:e.wholePath===t.filePath,busy:e.wholeLoading&&e.wholePath===t.filePath,disabled:e.wholeRefusal?.key===t.filePath,"disabled-reason":e.wholeRefusal?.key===t.filePath?e.wholeRefusal.reason:void 0,onToggle:e=>r(`toggle-whole`,t.filePath)},null,8,[`on`,`busy`,`disabled`,`disabled-reason`,`onToggle`])):Q(``,!0),X(Ug,{path:t.filePath},null,8,[`path`]),X(Kg,{path:t.filePath},null,8,[`path`])])])):Q(``,!0),(q(!0),J(K,null,G(t.notes,(e,t)=>(q(),J(`div`,{key:t,class:`file-note`},[Y(`span`,s_,B(e),1)]))),128)),(q(!0),J(K,null,G(t.hunks,e=>(q(),J(`section`,{key:e.key,class:z([`hunk`,{flash:_(e)}]),"data-edited-at":e.editedAt},[Y(`div`,l_,[Y(`span`,u_,[e.oldRange?(q(),J(`span`,d_,`Lines `+B(e.oldRange)+` → `+B(e.newRange),1)):(q(),J(`span`,f_,B(e.raw),1)),e.context?(q(),J(`span`,p_,B(e.context),1)):Q(``,!0),e.editedAt===void 0?Q(``,!0):(q(),J(`span`,m_,B(g(e)),1))])]),c.value?(q(),J(`div`,y_,[Y(`div`,b_,[(q(!0),J(K,null,G(U(zg)(e.rows),e=>(q(),J(`div`,{key:e.key,class:z([`split-line`,[e.left?e.left.kind:`empty`]])},[Y(`span`,x_,B(e.left?.oldLineNum??``),1),Y(`span`,S_,B(e.left&&e.left.kind===`del`?`-`:``),1),Y(`span`,C_,[e.left?(q(),ga(Vg,{key:0,row:e.left,pieces:s(e.left,t)},null,8,[`row`,`pieces`])):Q(``,!0)])],2))),128))]),Y(`div`,w_,[(q(!0),J(K,null,G(U(zg)(e.rows),e=>(q(),J(`div`,{key:e.key,class:z([`split-line`,[e.right?e.right.kind:`empty`]])},[Y(`span`,T_,B(e.right?.newLineNum??``),1),Y(`span`,E_,B(e.right&&e.right.kind===`add`?`+`:``),1),Y(`span`,D_,[e.right?(q(),ga(Vg,{key:0,row:e.right,pieces:s(e.right,t)},null,8,[`row`,`pieces`])):Q(``,!0)])],2))),128))])])):(q(!0),J(K,{key:0},G(e.rows,e=>(q(),J(`div`,{key:e.key,class:z([`row`,e.kind])},[Y(`span`,h_,B(e.oldLineNum??``),1),Y(`span`,g_,B(e.newLineNum??``),1),Y(`span`,__,B(v(e)),1),Y(`span`,v_,[X(Vg,{row:e,pieces:o(e,t)},null,8,[`row`,`pieces`])])],2))),128))],10,c_))),128))]))),128))],6))}}),[[`__scopeId`,`data-v-61cf2024`]]),j_=[`aria-pressed`,`title`],M_=ef(gr({__name:`WrapToggle`,setup(e){let t=Vl();return(e,n)=>(q(),J(`button`,{class:z([`wrap-toggle mono`,{on:U(t).wrapEnabled}]),"data-testid":`wrap-toggle`,"aria-pressed":U(t).wrapEnabled,"aria-label":`Wrap long lines`,title:U(t).wrapEnabled?`Wrap long lines: on. Click to scroll horizontally instead`:`Wrap long lines: off. Click to wrap instead of scrolling horizontally`,onClick:n[0]||=e=>U(t).toggleWrap()},` Wrap `,10,j_))}}),[[`__scopeId`,`data-v-f7064b49`]]),N_={class:`probe-viewport`},P_=[`data-key`],F_=[`aria-expanded`,`aria-label`,`onClick`],I_=[`data-status`],L_=[`title`],R_={class:`path-head`},z_={class:`path-tail`},B_={key:2,class:`uncommitted-tag mono`},V_={class:`row-stats mono`},H_={key:0,class:`count-add`},U_={key:1,class:`count-del`},W_=[`title`],G_={key:2,class:`load-diff`},K_=[`onClick`],q_={class:`load-diff-size`},J_=`\0`,Y_=new WeakMap;function X_(e){let t=Y_.get(e);if(t===void 0){t=null;for(let n of e.lines)if(n.type===`header`){if(n.content.startsWith(`Binary files`)){t={kind:`binary`,note:`Binary file — no text diff to show.`};break}if(n.content.startsWith(`Large file — diff not shown`)){t={kind:`large`,note:n.content};break}}Y_.set(e,t)}return t}var Z_=.1;function Q_(e,t){return Math.abs(e.rowH-t.rowH)<Z_&&Math.abs(e.hunkHeaderH-t.hunkHeaderH)<Z_&&Math.abs(e.hunkBorderB-t.hunkBorderB)<Z_&&Math.abs(e.fileHeaderH-t.fileHeaderH)<Z_&&Math.abs(e.noteH-t.noteH)<Z_&&Math.abs(e.sectionGap-t.sectionGap)<Z_&&Math.abs(e.scrollbarH-t.scrollbarH)<Z_}var $_={lines:[{type:`header`,content:`diff --git a/__probe__/a b/__probe__/a`},{type:`header`,content:`new file mode 100644`},{type:`hunk`,content:`@@ -0,0 +1,2 @@`},{type:`addition`,content:`+one`,newLineNum:1},{type:`addition`,content:`+two`,newLineNum:2},{type:`hunk`,content:`@@ -10 +11 @@ probe`},{type:`context`,content:` ctx`,oldLineNum:10,newLineNum:11},{type:`header`,content:`diff --git a/__probe__/b b/__probe__/b`},{type:`hunk`,content:`@@ -1 +1 @@`},{type:`deletion`,content:`-x`,oldLineNum:1},{type:`addition`,content:`+y`,newLineNum:1}]},ev=2,tv=1500,nv=ef(gr({__name:`DiffStack`,props:{files:{},activeKey:{},syntax:{type:Boolean},mode:{},wrap:{type:Boolean},mediaKeys:{},wholeKey:{},wholeLoading:{type:Boolean},showWholeToggle:{type:Boolean},wholeRefusal:{}},emits:[`active-file`,`toggle-collapse`,`toggle-whole`],setup(e,{expose:t,emit:n}){let r=e,i=n,a=V(null),o=V(null),s=new Map;function c(e,t){t instanceof HTMLElement?s.set(e,t):s.delete(e)}function l(e){return e.diff===null?null:X_(e.diff)}function u(e){return l(e)?.kind===`binary`&&(r.mediaKeys?.has(e.key)??!1)}let d=Bt(new Set),f=new Set;function p(e){for(let t of e)t.stats.insertions+t.stats.deletions<=1500&&f.add(t.key)}p(r.files);function m(e){return e.stats.insertions+e.stats.deletions>tv}function h(e){return e.status!==`untracked`&&e.status!==`added`}function g(e){if(r.wholeRefusal?.key===e.key)return r.wholeRefusal.reason;let t=l(e);return t===null?_(e)?`Load the diff first`:null:t.kind===`binary`?`Binary file — there is no text to show`:`Diff withheld: this file is over the size cap`}function _(e){return m(e)&&l(e)===null&&!d.has(e.key)&&!f.has(e.key)}function v(e){return!!e.collapsed||_(e)}function y(e){d.add(e),On(()=>ge.invalidateOffsets())}function b(){let e=r.files.filter(e=>_(e));for(let t of e)d.add(t.key);return e.length>0&&On(()=>ge.invalidateOffsets()),e.length}let x=V(null),S=$_,C=V(null),w=null;function T(){let e=x.value;if(!e)return;let t=e.querySelector(`.diff-scroll`),n=e.querySelector(`.row`),r=e.querySelector(`.hunk`),i=e.querySelector(`.hunk-header`),a=e.querySelector(`.file-header`),o=e.querySelector(`.file-note`),s=e.querySelectorAll(`.file-section`);if(!t||!n||!r||!i||!a||!o||s.length<2)return;let c=n.getBoundingClientRect().height;if(c<=0)return;let l=i.getBoundingClientRect().height,u={rowH:c,hunkHeaderH:l,hunkBorderB:Math.max(0,r.getBoundingClientRect().height-l-ev*c),fileHeaderH:a.getBoundingClientRect().height,noteH:o.getBoundingClientRect().height,sectionGap:s[1].getBoundingClientRect().top-s[0].getBoundingClientRect().bottom,scrollbarH:Math.max(0,t.offsetHeight-t.clientHeight)},d=C.value;d!==null&&Q_(d,u)||(oe.prepare({survivingKeys:se(ne),changedEls:[null]}),C.value=u,document.documentElement.style.setProperty(`--row-h`,`${c}px`),k={},ge.invalidateOffsets(),On(()=>{oe.restore(),P()}))}function E(e){if(e.diff){let t=Uc(e.diff,e.staged??!1).rowCount;if(t>0)return Math.max(t*20,48)}let t=e.stats.insertions+e.stats.deletions,n=Math.max(1,Math.ceil(t/10));return Math.max((t+n*7)*20,48)}function D(e){if(r.wrap)return null;let t=C.value;if(!t||!e.diff)return null;let n=Uc(e.diff,e.staged??!1);if(n.rowCount===0)return null;let i=n.sections.filter(e=>e.filePath!==null).length>1,a=r.mode===`split`?t.scrollbarH:0;return n.sections.forEach((e,n)=>{n>0&&(a+=t.sectionGap),i&&e.filePath!==null&&(a+=t.fileHeaderH),a+=e.notes.length*t.noteH,e.hunks.forEach((n,i)=>{let o=r.mode===`split`?Bg(n.rows):n.rows.length;a+=t.hunkHeaderH+o*t.rowH,i<e.hunks.length-1&&(a+=t.hunkBorderB)})}),a}function O(e){return`auto ${D(e)??E(e)}px`}let k={},A={notShownBinaryH:`.not-shown-binary`,notShownLargeH:`.not-shown-large`,notShownMediaH:`.not-shown-media`,loadDiffH:`.load-diff`};function j(){if(k.toolbarH===void 0){if(!o.value)return null;k.toolbarH=o.value.getBoundingClientRect().height}return k.toolbarH??null}function M(){if(k.borderY===void 0)for(let e of s.values()){let t=getComputedStyle(e);k.borderY=(parseFloat(t.borderTopWidth)||0)+(parseFloat(t.borderBottomWidth)||0)+(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0);break}return k.borderY??null}function N(){if(k.headerH===void 0)for(let e of s.values()){let t=e.querySelector(`.file-diff-header`);if(t){k.headerH=t.getBoundingClientRect().height;break}}return k.headerH??null}function P(){let e=a.value,t=N();e&&t!==null&&e.style.setProperty(`--stack-header-h`,`${t}px`)}function F(){if(r.files.length<=1)return 0;if(k.gap===void 0){let e=s.get(r.files[1].key);if(!e)return null;k.gap=parseFloat(getComputedStyle(e).marginTop)||0}return k.gap}function I(e,t){if(k[e]===void 0){let n=s.get(t)?.querySelector(A[e]);if(!n)return null;k[e]=n.getBoundingClientRect().height}return k[e]??null}function L(e){let t=l(e);return t===null?_(e)?`loadDiffH`:null:u(e)?`notShownMediaH`:t.kind===`binary`?`notShownBinaryH`:`notShownLargeH`}function ee(e){return l(e)?.kind===`binary`?`not-shown-binary`:`not-shown-large`}function R(e,t,n){if(e.collapsed)return n+t;let r=L(e);if(r!==null){let i=I(r,e.key);return i===null?null:n+t+i}return n+t+(D(e)??E(e))}function te(){if(C.value===null||r.wrap)return null;let e=N(),t=F(),n=j(),i=M();if(e===null||t===null||n===null||i===null)return null;let a=new Map(r.files.map(e=>[e.key,e]));return{start:n,gap:t,heightFor:t=>{let n=a.get(t);return n===void 0?null:R(n,e,i)}}}let ne=r.files;function re(e,t){return`${e}${J_}${t}`}function ie(){let e=[];for(let t of ne){let n=s.get(t.key);if(!n||(e.push({key:t.key,kind:`file`,fileKey:t.key,el:n}),v(t)||!t.diff))continue;let r=Uc(t.diff,t.staged??!1),i=n.querySelectorAll(`.hunk`),a=0;for(let n of r.sections)for(let r of n.hunks){let n=i[a++];n&&e.push({key:re(t.key,r.key),kind:`hunk`,fileKey:t.key,el:n})}}return e}function ae(e){let t=e.indexOf(J_);if(t===-1)return s.get(e)??null;let n=e.slice(0,t),i=e.slice(t+1),a=s.get(n),o=r.files.find(e=>e.key===n);if(!a||!o?.diff||v(o))return null;let c=Uc(o.diff,o.staged??!1),l=0;for(let e of c.sections)for(let t of e.hunks){if(t.key===i)return a.querySelectorAll(`.hunk`)[l]??null;l++}return null}let oe=Ym(a,{candidates:ie,resolve:ae,isTweenActive:()=>ge.isTweening()});function se(e){let t=new Set;for(let n of e){if(t.add(n.key),!n.diff||v(n))continue;let e=Uc(n.diff,n.staged??!1);for(let r of e.sections)for(let e of r.hunks)t.add(re(n.key,e.key))}return t}function ce(e){let t=[],n=[],r=new Map(ne.map(e=>[e.key,e])),i=new Set(e.map(e=>e.key));for(let e of ne)i.has(e.key)||t.push(s.get(e.key)??null);for(let i of e){let e=r.get(i.key);e?(e.diff!==i.diff||v(e)!==v(i))&&(t.push(s.get(i.key)??null),n.push(i.key)):(t.push(null),n.push(i.key))}return t.length===0&&(e.length===ne.length&&e.every((e,t)=>e.key===ne[t].key)||t.push(null)),{els:t,changedKeys:n}}let ue=[];W(()=>r.files,e=>{let t=ce(e);ue=t.changedKeys,oe.prepare({survivingKeys:se(e),changedEls:t.els}),p(e)},{flush:`pre`}),W(()=>r.files,e=>{oe.restore(),ne=e,ge.invalidateOffsets();for(let e of ue){let t=de.get(e);t&&fe.set(t,t.getBoundingClientRect().height)}ue=[]},{flush:`post`}),W(()=>[r.mode,r.wrap,r.mediaKeys],()=>{oe.prepare({survivingKeys:se(ne),changedEls:[null]})},{flush:`pre`}),W(()=>[r.mode,r.wrap,r.mediaKeys],()=>{oe.restore(),ge.invalidateOffsets();for(let e of de.values())fe.set(e,e.getBoundingClientRect().height)},{flush:`post`});let de=new Map,fe=new WeakMap,pe=typeof ResizeObserver<`u`?new ResizeObserver(e=>{for(let t of e){let e=t.target,n=t.borderBoxSize?.[0]?.blockSize??e.getBoundingClientRect().height,r=fe.get(e);fe.set(e,n),r!==void 0&&r!==n&&ge.invalidateOffsets()}}):null;function me(e,t){let n=de.get(e);if(t instanceof HTMLElement){if(n===t)return;n&&pe?.unobserve(n),de.set(e,t),pe?.observe(t)}else n&&(pe?.unobserve(n),de.delete(e))}jr(()=>{T(),On(()=>P());let e=x.value?.querySelector(`.row`);e&&typeof ResizeObserver<`u`&&(w=new ResizeObserver(()=>T()),w.observe(e)),window.addEventListener(`resize`,T)}),Pr(()=>{w?.disconnect(),pe?.disconnect(),window.removeEventListener(`resize`,T)});function he(){let e=[];for(let t of r.files){let n=s.get(t.key);n&&e.push({key:t.key,el:n})}return e}let ge=ih(a,{sections:he,sectionHeights:te,stickyOffset:0,onActiveKey:e=>i(`active-file`,e)});W(gu(),()=>{k.gap=void 0,ge.invalidateOffsets()},{flush:`post`});function _e(e,t){ge.scrollToKey(e,t)}function ve(e,t,n){ge.scrollToTarget(()=>{let n=a.value,r=s.get(e);if(!n||!r)return null;let i=t(),o=i===null?null:ae(re(e,i));if(!o||o.offsetParent===null)return r.offsetTop-0;let c=r.querySelector(`.file-diff-header`)?.offsetHeight??0;return o.getBoundingClientRect().top-n.getBoundingClientRect().top+n.scrollTop-0-c},{...n,activeKey:e})}function ye(e){s.get(e)?.focus({preventScroll:!0})}return t({scrollToFile:_e,scrollToHunk:ve,expandAllGated:b,focusFile:ye,scrollerEl:a,isTweening:ge.isTweening,lastUserScrollAt:ge.lastUserScrollAt}),(t,n)=>(q(),J(`div`,{ref_key:`scrollerEl`,ref:a,class:`stack-scroller`},[Y(`div`,{ref_key:`probeEl`,ref:x,class:`size-probe`,"aria-hidden":`true`},[Y(`div`,N_,[X(A_,{diff:U(S),"show-file-headers":``},null,8,[`diff`])])],512),Y(`div`,{ref_key:`toolbarEl`,ref:o,class:`stack-toolbar`},[X(M_)],512),(q(!0),J(K,null,G(e.files,a=>(q(),J(`section`,{key:a.key,ref_for:!0,ref:e=>c(a.key,e),class:z([`file-diff`,{selected:a.key===e.activeKey,uncommitted:a.uncommitted}]),"data-key":a.key,"data-testid":`file-diff`,tabindex:`-1`},[Y(`header`,{class:z([`file-diff-header`,{uncommitted:a.uncommitted}])},[Y(`button`,{class:`collapse-btn mono`,"aria-expanded":!v(a),"aria-label":`${v(a)?`Expand`:`Collapse`} ${a.path}`,onClick:e=>_(a)?y(a.key):i(`toggle-collapse`,a.key)},B(v(a)?`▸`:`▾`),9,F_),Y(`span`,{class:`letter mono`,"data-status":a.status},B(U(ql)(a.status)),9,I_),Y(`span`,{class:`path mono`,title:a.path},[Y(`span`,R_,B(U(Xl)(a.path).head),1),Y(`span`,z_,B(U(Xl)(a.path).tail),1)],8,L_),a.refPair?(q(),ga(Qg,{key:0,pair:a.refPair},null,8,[`pair`])):Q(``,!0),r.showWholeToggle&&h(a)?(q(),ga(e_,{key:1,on:r.wholeKey===a.key,busy:r.wholeLoading&&r.wholeKey===a.key,disabled:g(a)!==null,"disabled-reason":g(a)??void 0,onToggle:e=>i(`toggle-whole`,a.key)},null,8,[`on`,`busy`,`disabled`,`disabled-reason`,`onToggle`])):Q(``,!0),X(Ug,{path:a.path},null,8,[`path`]),X(Kg,{path:a.path},null,8,[`path`]),a.uncommitted?(q(),J(`span`,B_,B(a.uncommitted===`both`?`[uncommitted]`:`[${a.uncommitted}]`),1)):Q(``,!0),Y(`span`,V_,[a.stats.insertions?(q(),J(`span`,H_,`+`+B(a.stats.insertions),1)):Q(``,!0),a.stats.deletions?(q(),J(`span`,U_,`−`+B(a.stats.deletions),1)):Q(``,!0)])],2),u(a)?Vn((q(),J(`div`,{key:0,ref_for:!0,ref:e=>me(a.key,e),class:`not-shown-media`,"data-testid":`not-shown-media`},[Gr(t.$slots,`media`,{file:a},void 0,!0)],512)),[[lo,!a.collapsed]]):l(a)?Vn((q(),J(`div`,{key:1,class:z([`not-shown-note`,ee(a)]),title:l(a)?.note,"data-testid":`not-shown-note`},B(l(a)?.note),11,W_)),[[lo,!a.collapsed]]):_(a)?Vn((q(),J(`div`,G_,[Y(`button`,{class:`load-diff-btn mono chrome-chip`,"data-testid":`load-diff`,onClick:e=>y(a.key)},[n[0]||=Z(` Load diff `,-1),Y(`span`,q_,`(`+B(a.stats.insertions+a.stats.deletions)+` changed lines)`,1)],8,K_)],512)),[[lo,!a.collapsed]]):Vn((q(),J(`div`,{key:3,ref_for:!0,ref:e=>me(a.key,e),class:z([`file-diff-body`,{"wrap-mode":r.wrap}]),style:le({containIntrinsicSize:O(a)})},[a.diff?(q(),ga(A_,{key:0,diff:a.diff,"file-path":a.path,syntax:r.syntax,mode:r.mode,wrap:r.wrap,"whole-path":r.wholeKey===a.key?a.path:null,embedded:``},null,8,[`diff`,`file-path`,`syntax`,`mode`,`wrap`,`whole-path`])):(q(),J(`div`,{key:1,class:`placeholder`,"data-testid":`diff-placeholder`,style:le({height:`${E(a)}px`})},null,4))],6)),[[lo,!a.collapsed]])],10,P_))),128))],512))}}),[[`__scopeId`,`data-v-28399737`]]),rv=8388608,iv=2097152,av=8192,ov=16777216,sv=33554432;function cv(e){return Array.from(e,e=>e.charCodeAt(0))}cv(`GIF87a`),cv(`GIF89a`),cv(`ftyp`);function lv(e){return{offset:8,bytes:cv(e)}}cv(`RIFF`),lv(`WEBP`),lv(`avif`),lv(`avis`),lv(`heic`),lv(`heix`),lv(`heim`),lv(`heis`),lv(`hevc`),lv(`hevx`),lv(`mif1`),lv(`msf1`),cv(`BM`);function uv(e){return`${Math.floor(e/1e6)} MB`}function dv(e){return`${Math.floor(e/1e6)} MP`}var fv={"not-an-image":null,malformed:null,"header-not-found":null,"unsupported-format":`no preview (format not rendered)`,animation:`no preview (animated PNG not rendered)`,"too-large":`no preview (over the preview size cap: ${uv(rv)}, or ${uv(iv)} for GIF)`,"too-many-pixels":`no preview (over the preview pixel budget: ${av} px per side, ${dv(ov)} per image, 256 frames, or ${dv(sv)} across an animation)`};function pv(e){let t=e===null?null:fv[e];return t===null?`No preview`:t[0].toUpperCase()+t.slice(1)}var mv=[`src`,`width`,`height`],hv={key:1,class:`frame-note`,"data-testid":`image-loading`},gv={key:2,class:`frame-note`,"data-testid":`image-failed`},_v=`Image preview`,vv=ef(gr({__name:`ImageFrame`,props:{src:{},width:{},height:{},fit:{}},emits:[`ok`,`fail`],setup(e,{emit:t}){let n=e,r=t,i=V(`loading`);W(()=>n.src,()=>{i.value=`loading`});function a(e){let t=e.target;t.naturalWidth===0||t.naturalHeight===0?o():(i.value=`ok`,r(`ok`))}function o(){i.value=`failed`,r(`fail`)}return(t,n)=>(q(),J(`div`,{class:z([`image-frame`,e.fit]),"data-testid":`image-frame`,tabindex:`0`,role:`group`,"aria-label":`Image preview`},[i.value===`failed`?Q(``,!0):(q(),J(`img`,{key:0,class:z([`image`,{ready:i.value===`ok`}]),"data-testid":`image`,src:e.src,width:e.width,height:e.height,alt:_v,loading:`lazy`,decoding:`async`,referrerpolicy:`no-referrer`,draggable:`false`,onLoad:a,onError:o},null,42,mv)),i.value===`loading`?(q(),J(`p`,hv,`Loading…`)):i.value===`failed`?(q(),J(`p`,gv,` Preview failed to decode `)):Q(``,!0)],2))}}),[[`__scopeId`,`data-v-1c7a4b88`]]),yv={class:`image-meta mono`,"data-testid":`image-meta`},bv={class:`side-meta`},xv={class:`side-meta`},Sv={key:0,class:`delta`,"data-testid":`image-byte-delta`},Cv={key:1,class:`hint`,"data-testid":`image-metadata-hint`},wv={class:`half old`,"data-testid":`image-old`},Tv={key:1,class:`plate`,"data-testid":`image-refused`},Ev={class:`half new`,"data-testid":`image-new`},Dv={key:1,class:`plate`,"data-testid":`image-refused`},Ov={class:`image-controls`},kv={class:`mode-picker`,role:`radiogroup`,"aria-label":`Image comparison mode`,"data-testid":`image-diff-mode`},Av=[`aria-checked`,`data-mode`,`onClick`],jv=[`disabled`],Mv=ef(gr({__name:`ImageDiffView`,props:{pair:{},repoId:{}},emits:[`fail`],setup(e,{emit:t}){let n=e,r=t,i=Vl(),a=[{value:`side-by-side`,label:`Side by side`},{value:`swipe`,label:`Swipe`},{value:`onion`,label:`Onion`}],o=V(50);function s(e){return e!==null&&e.image!==null}let c=$(()=>s(n.pair.old)),l=$(()=>s(n.pair.new)),u=$(()=>{let e=n.pair.old?.image,t=n.pair.new?.image;return!!e&&!!t&&e.width===t.width&&e.height===t.height}),d=$(()=>i.imageDiffMode!==`side-by-side`&&c.value&&l.value&&u.value?i.imageDiffMode:`side-by-side`),f=$(()=>d.value!==`side-by-side`),p=$(()=>({"--swipe":String(o.value),"--onion":String(o.value/100)}));function m(e){return Us(n.repoId,{path:e.path,side:e.side,version:e.version})}let h=V(!1),g=V(!1);W(()=>n.pair,()=>{h.value=!1,g.value=!1}),W([h,g],()=>{let e=!c.value||h.value,t=!l.value||g.value;e&&t&&r(`fail`)});function _(e){if(e===null)return`—`;let t=[Kl(e.bytes)];return e.image&&t.push(`${e.image.width} × ${e.image.height}`),t.push(e.oid===null?`working tree`:e.oid.slice(0,7)),t.join(` · `)}let v=$(()=>_(n.pair.old)),y=$(()=>_(n.pair.new)),b=$(()=>{let e=n.pair.old?.bytes,t=n.pair.new?.bytes;return e===void 0||t===void 0||e===t?null:`${t>e?`+`:`−`}${Kl(Math.abs(t-e))}`}),x=$(()=>u.value&&b.value!==null);function S(e,t){return e===null?`No version on this side`:t?`Preview failed to decode`:pv(e.refusal)}return(t,n)=>(q(),J(`div`,{class:z([`image-diff`,d.value]),"data-testid":`image-diff`},[Y(`p`,yv,[Y(`span`,bv,`old `+B(v.value),1),n[3]||=Y(`span`,{class:`arrow`,"aria-hidden":`true`},`→`,-1),Y(`span`,xv,`new `+B(y.value),1),b.value?(q(),J(`span`,Sv,`(`+B(b.value)+`)`,1)):Q(``,!0),x.value?(q(),J(`span`,Cv,` same dimensions, different bytes — the change may be metadata only (EXIF/ICC) `)):Q(``,!0)]),Y(`div`,{class:z([`image-stage`,d.value]),style:le(p.value)},[Y(`div`,wv,[e.pair.old&&e.pair.old.image&&!h.value?(q(),ga(vv,{key:0,src:m(e.pair.old),width:e.pair.old.image.width,height:e.pair.old.image.height,fit:`fit`,onFail:n[0]||=e=>h.value=!0},null,8,[`src`,`width`,`height`])):(q(),J(`p`,Tv,B(S(e.pair.old,h.value)),1))]),Y(`div`,Ev,[e.pair.new&&e.pair.new.image&&!g.value?(q(),ga(vv,{key:0,src:m(e.pair.new),width:e.pair.new.image.width,height:e.pair.new.image.height,fit:`fit`,onFail:n[1]||=e=>g.value=!0},null,8,[`src`,`width`,`height`])):(q(),J(`p`,Dv,B(S(e.pair.new,g.value)),1))])],6),Y(`div`,Ov,[Y(`div`,kv,[(q(),J(K,null,G(a,e=>Y(`button`,{key:e.value,class:z([`mode-btn mono`,{on:U(i).imageDiffMode===e.value}]),role:`radio`,"aria-checked":U(i).imageDiffMode===e.value,"data-mode":e.value,onClick:t=>U(i).setImageDiffMode(e.value)},B(e.label),11,Av)),64))]),Vn(Y(`input`,{"onUpdate:modelValue":n[2]||=e=>o.value=e,class:z([`swipe-range`,{inert:!f.value}]),"data-testid":`image-diff-swipe`,type:`range`,min:`0`,max:`100`,step:`1`,"aria-label":`Swipe between old and new`,disabled:!f.value},null,10,jv),[[Go,o.value,void 0,{number:!0}]])])],2))}}),[[`__scopeId`,`data-v-357863f9`]]),Nv=[`aria-orientation`,`aria-label`,`aria-valuenow`,`aria-valuemin`,`aria-valuemax`],Pv=ef(gr({__name:`SplitResizer`,props:{split:{},label:{}},setup(e){return(t,n)=>(q(),J(`div`,{class:`row-resizer`,role:`separator`,"aria-orientation":e.split.ariaOrientation.value,"aria-label":e.label,"aria-valuenow":e.split.ariaValueNow.value,"aria-valuemin":e.split.ariaValueMin.value,"aria-valuemax":e.split.ariaValueMax.value,tabindex:`0`,onPointerdown:n[0]||=(...t)=>e.split.onPointerDown&&e.split.onPointerDown(...t),onPointermove:n[1]||=(...t)=>e.split.onPointerMove&&e.split.onPointerMove(...t),onPointerup:n[2]||=(...t)=>e.split.onPointerUp&&e.split.onPointerUp(...t),onPointercancel:n[3]||=(...t)=>e.split.onPointerCancel&&e.split.onPointerCancel(...t),onKeydown:n[4]||=(...t)=>e.split.onKeydown&&e.split.onKeydown(...t)},null,40,Nv))}}),[[`__scopeId`,`data-v-36b65c10`]]),Fv={key:0,class:`clean-state`,"data-testid":`clean-tree`,role:`status`},Iv={key:1,class:`panel-note`},Lv={key:2,class:`panel-note`},Rv={key:3,class:`panel-note`,"data-testid":`filter-no-matches`},zv=[`aria-labelledby`,`data-testid`],Bv=[`id`],Vv={class:`section-count`},Hv=[`aria-selected`,`tabindex`,`title`,`onClick`,`onKeydown`],Uv=[`data-testid`,`disabled`,`title`,`aria-label`,`onClick`],Wv=[`data-status`],Gv={class:`path`},Kv={class:`dir`},qv={class:`base`},Jv={key:0,class:`hunks`},Yv={class:`row-stats`},Xv={key:0,class:`count-add`},Zv={key:1,class:`count-del`},Qv=[`aria-orientation`,`aria-valuenow`,`aria-valuemin`,`aria-valuemax`],$v=5,ey=ef(gr({__name:`ChangesView`,setup(e){let t=sl(),n=Vl(),r=$(()=>t.shared.status),i=$(()=>!t.shared.isLoading&&r.value!==null&&r.value.files.length===0);function a(e){return n.flashedFile===e.path}let o=ru(),s=Am($(()=>r.value?.files??[]),e=>e.path),c=$(()=>Fm(s.filtered.value)),l=$(()=>[{name:`Modified`,files:c.value.modified},{name:`Untracked`,files:c.value.untracked},{name:`Staged`,files:c.value.staged}].filter(e=>e.files.length>0)),u=Qc;function d(e){return n.activeStackKey===u(e)}let f=$(()=>{let e=c.value.ordered,r=n.activeStackKey;if(r!==null){let t=e.findIndex(e=>u(e)===r);if(t!==-1)return t}let i=t.selection.file;return i?e.indexOf(i):-1});function p(e){let t=qp(e,56),n=t.lastIndexOf(`/`);return n===-1?{dir:``,base:t}:{dir:t.slice(0,n+1),base:t.slice(n+1)}}function m(e){let n=t.shared.hunkCounts;if(!n||e.status===`untracked`)return``;let r=n.staged[e.path]??0,i=n.unstaged[e.path]??0,a=r+i;if(a===0)return``;let o=e.staged?r:i;return o===a?`●${a}`:`●${o}/${a}`}function h(e){return e.status===`conflicted`}function g(e){return h(e)?`Conflicted — resolve the conflict first`:e.staged?`Unstage this file`:`Stage this file`}function _(e){return h(e)?`Cannot ${e.staged?`unstage`:`stage`} ${e.path}: resolve the conflict first`:`${e.staged?`Unstage`:`Stage`} ${e.path}`}let v=V(null),y=$(()=>v.value?.scrollerEl??null),b=Bt(new Set);function x(e){b.has(e)?b.delete(e):b.add(e)}function S(e){if(tu({view:`changes`}),t.wholeFile?.key===e){t.setWholeFile(null);return}let r=c.value.ordered.find(t=>u(t)===e);r&&(n.setActiveStackKey(e),t.setWholeFile({view:`changes`,key:e,path:r.path}))}W(()=>t.repoId,()=>{n.setActiveStackKey(null),b.clear(),w.clear()});let C=$(()=>{let{byKey:e}=t.workingDiffs,n=t.wholeFile;return c.value.ordered.map(t=>{let r=u(t),i=n?.key===r?n.diff:e.get(r)?.diff??null;return{key:r,path:t.path,status:t.status,staged:t.staged,stats:{insertions:t.insertions??0,deletions:t.deletions??0},diff:i,collapsed:b.has(r),refPair:{kind:`working`,staged:t.staged,status:t.status}}})}),w=Bt(new Set);function T(e,t){return`${e}\u0000${t.old?.version??``}\u0000${t.new?.version??``}`}W($(()=>{let e=c.value.ordered,n=Math.max(0,f.value),r=Math.min(e.length,n+$v+1),i=[];for(let a=Math.max(0,n-$v);a<r;a++){let n=e[a],r=u(n);if(b.has(r))continue;let o=t.workingDiffs.byKey.get(r);o&&X_(o.diff)?.kind===`binary`&&i.push(n)}return i}),e=>{for(let n of e)t.ensureMedia(n,n.staged)},{immediate:!0});let E=$(()=>{let e=new Set;for(let[n,r]of t.mediaMeta)w.has(T(n,r))||(r.old?.image||r.new?.image)&&e.add(n);return e}),D={old:null,new:null};function O(e){return t.mediaMeta.get(e)??D}function k(e){let t=O(e);return()=>w.add(T(e,t))}let A=0;function j(e){A=Date.now(),t.selectFile(e),n.setActiveStackKey(u(e)),v.value?.scrollToFile(u(e),{smooth:!0})}function M(e){tu({view:`changes`}),j(e)}function N(e){M(e),On(()=>v.value?.focusFile(u(e)))}let P=V(null),F=$(()=>{let e=c.value.ordered,t=f.value;return(t>=0?e[t]:e[0])??null});function I(e){let t=c.value.ordered,n=Im(f.value,e,t.length);n!==-1&&(j(t[n]),On(()=>{P.value?.querySelectorAll(`.file-row`)[n]?.focus()}))}function L(){let e=P.value;if(!e)return;let t=f.value,n=e.querySelectorAll(`.file-row`);(t>=0?n[t]:n[0])?.focus()}W(()=>c.value.ordered,()=>{let e=P.value?.contains(document.activeElement)??!1;On(()=>{let t=P.value;e&&t&&!t.contains(document.activeElement)&&L()})});let ee=V(null);W(()=>o.open,(e,t)=>{!e&&t&&(ee.value?.querySelector(`[data-testid="filter-chip"]`))?.contains(document.activeElement)&&On(L)});let{onPointerEnter:R,onPointerLeave:te}=Wm(ee,()=>n.activeStackKey,()=>{let e=P.value,t=f.value;return!e||t<0?null:e.querySelectorAll(`.file-row`)[t]??null});W(()=>n.stackScrollRequest,e=>{e&&On(()=>v.value?.scrollToFile(e.key,{smooth:!1}))}),W(()=>n.expandGatedRequest,e=>{e!==0&&v.value?.expandAllGated()});function ne(e,n){let r=t.workingDiffs.byKey.get(e);if(!r)return null;let i=t.diffModelFor(r.diff,n),a=null,o=-1/0;for(let e of i.sections)for(let t of e.hunks)t.editedAt!==void 0&&t.editedAt>o&&(o=t.editedAt,a=t.key);return a}function re(e){let t=c.value.ordered.find(t=>t.path===e);if(!t)return;let r=u(t);n.setActiveStackKey(r),On(()=>{let e=v.value;e&&((t.insertions??0)+(t.deletions??0)>1500?e.scrollToFile(r,{smooth:!0}):e.scrollToHunk(r,()=>ne(r,t.staged),{smooth:!0}))})}let ie=null;jr(()=>{ie=fu({jump:re,lastUserScrollAt:()=>Math.max(v.value?.lastUserScrollAt()??0,A)})}),Pr(()=>{ie?.(),ie=null});let ae=gu(),oe=V(null),se=zm({container:oe,isRow:ae,column:{pref:`changesSplit`,defaultRatio:.32,min:Dl,max:Ol},row:{pref:`changesTop`,defaultRatio:.3,min:kl,max:Al}}),ce=Vm(ae,I),ue=Um(ae,y,`File diffs`,{self:!0}),de=$(()=>({"--files-col":`${(se.columnRatio.value*100).toFixed(2)}%`,...ae.value?{"--changes-top":`${(se.rowRatio.value*100).toFixed(2)}%`}:{}}));return(e,f)=>(q(),J(`div`,{ref_key:`containerEl`,ref:oe,class:z([`changes`,{portrait:U(ae)}]),style:le(de.value)},[i.value?(q(),J(`div`,Fv,[...f[10]||=[Y(`p`,{class:`clean-title`},`No changes.`,-1),Y(`p`,{class:`clean-sub`},`The working tree is clean.`,-1)]])):(q(),J(`aside`,{key:1,ref_key:`filesColEl`,ref:ee,class:`files-col`,"aria-label":`Changed files`,onPointerenter:f[3]||=(...e)=>U(R)&&U(R)(...e),onPointerleave:f[4]||=(...e)=>U(te)&&U(te)(...e)},[U(o).open?(q(),ga(Pm,{key:0,class:`files-filter`,shown:c.value.ordered.length,total:U(s).total.value,corpus:`changed files`,singular:`changed file`},null,8,[`shown`,`total`])):Q(``,!0),U(t).shared.isLoading?(q(),J(`p`,Iv,`Loading status…`)):r.value?U(s).empty.value?(q(),J(`p`,Rv,` No changed file matches “`+B(U(o).query)+`”. `,1)):(q(),J(`div`,{key:4,ref_key:`listEl`,ref:P,class:`file-list`,"data-testid":`file-list`,role:`listbox`,"aria-label":`Changed files`},[(q(!0),J(K,null,G(l.value,e=>(q(),J(`section`,{key:e.name,class:`file-section`,role:`group`,"aria-labelledby":`files-section-${e.name.toLowerCase()}`,"data-testid":`section-${e.name.toLowerCase()}`},[Y(`h3`,{id:`files-section-${e.name.toLowerCase()}`,class:`section-header eyebrow`},[Z(B(e.name)+` `,1),Y(`span`,Vv,B(e.files.length),1)],8,Bv),(q(!0),J(K,null,G(e.files,e=>(q(),J(`div`,{key:U(u)(e),class:z([`file-row mono list-row`,{selected:d(e),flash:a(e)}]),role:`option`,"aria-selected":d(e),tabindex:e===F.value?0:-1,title:e.path,onClick:t=>M(e),onKeydown:[f[0]||=Xo(Jo(e=>I(1),[`prevent`]),[`down`]),f[1]||=Xo(Jo(e=>I(-1),[`prevent`]),[`up`]),Xo(Jo(t=>N(e),[`prevent`]),[`enter`]),Xo(Jo(t=>M(e),[`prevent`]),[`space`]),f[2]||=(...e)=>U(ce)&&U(ce)(...e)]},[Y(`button`,{class:`stage-btn`,tabindex:`-1`,"data-testid":e.staged?`unstage-file`:`stage-file`,disabled:h(e),title:g(e),"aria-label":_(e),onClick:Jo(n=>e.staged?U(t).unstageFile(e.path):U(t).stageFile(e.path),[`stop`])},B(e.staged?`−`:`+`),9,Uv),Y(`span`,{class:`letter`,"data-status":e.status},B(U(ql)(e.status)),9,Wv),Y(`span`,Gv,[Y(`span`,Kv,B(p(e.path).dir),1),Y(`span`,qv,B(p(e.path).base),1)]),m(e)?(q(),J(`span`,Jv,B(m(e)),1)):Q(``,!0),Y(`span`,Yv,[e.insertions?(q(),J(`span`,Xv,`+`+B(e.insertions),1)):Q(``,!0),e.deletions?(q(),J(`span`,Zv,`−`+B(e.deletions),1)):Q(``,!0)])],42,Hv))),128))],8,zv))),128))],512)):(q(),J(`p`,Lv,`No status yet.`))],544)),!i.value&&U(ae)?(q(),ga(Pv,{key:2,split:U(se),label:`Resize file list`},null,8,[`split`])):i.value?Q(``,!0):(q(),J(`div`,{key:3,class:`resizer`,role:`separator`,"aria-orientation":U(se).ariaOrientation.value,"aria-label":`Resize file list`,"aria-valuenow":U(se).ariaValueNow.value,"aria-valuemin":U(se).ariaValueMin.value,"aria-valuemax":U(se).ariaValueMax.value,tabindex:`0`,onPointerdown:f[5]||=(...e)=>U(se).onPointerDown&&U(se).onPointerDown(...e),onPointermove:f[6]||=(...e)=>U(se).onPointerMove&&U(se).onPointerMove(...e),onPointerup:f[7]||=(...e)=>U(se).onPointerUp&&U(se).onPointerUp(...e),onPointercancel:f[8]||=(...e)=>U(se).onPointerCancel&&U(se).onPointerCancel(...e),onKeydown:f[9]||=(...e)=>U(se).onKeydown&&U(se).onKeydown(...e)},null,40,Qv)),i.value?Q(``,!0):(q(),ga(nv,Oa({ref_key:`stackEl`,ref:v,key:U(t).repoId??``,class:`diff-col`,"data-testid":`changes-diffs`,files:C.value,"active-key":U(n).activeStackKey,syntax:U(n).diffSyntaxEnabled,mode:U(n).diffMode,wrap:U(n).wrapEnabled,"media-keys":E.value,"show-whole-toggle":``,"whole-key":U(t).wholeFile?.key??null,"whole-loading":U(t).wholeFileLoading,"whole-refusal":U(t).wholeFileRefusal},U(ue),{onActiveFile:U(n).setActiveStackKey,onToggleCollapse:x,onToggleWhole:S}),{media:Bn(({file:e})=>[U(t).repoId===null?Q(``,!0):(q(),ga(Mv,Oa({key:0,pair:O(e.key),"repo-id":U(t).repoId},qr({fail:k(e.key)})),null,16,[`pair`,`repo-id`]))]),_:1},16,[`files`,`active-key`,`syntax`,`mode`,`wrap`,`media-keys`,`whole-key`,`whole-loading`,`whole-refusal`,`onActiveFile`]))],6))}}),[[`__scopeId`,`data-v-b5e7f97b`]]),ty=15e3;function ny(e,t=ty){let n=new Map;for(let t of e)t.type===`hunk`&&n.set(t.seq,t);let r=[],i=new Map;for(let n of e){if(n.type===`boundary`){i.clear(),r.push({type:`boundary`,key:n.seq,entry:n});continue}if(ry(n,i,r,t))continue;for(let e of n.supersedes)i.delete(e);let e={type:`hunk-group`,key:n.seq,members:[n],tip:n,kind:n.kind};r.push(e),n.kind!==`reverted`&&i.set(n.seq,e)}for(let e of r)e.type===`hunk-group`&&(e.kind=iy(e,n));return r}function ry(e,t,n,r){if(e.kind===`reverted`||e.supersedes.length!==1||e.siblings!==1)return!1;let i=t.get(e.supersedes[0]);return!i||Math.max(0,e.ts-i.tip.ts)>r?!1:(t.delete(i.tip.seq),i.members.push(e),i.tip=e,t.set(e.seq,i),n.splice(n.indexOf(i),1),n.push(i),!0)}function iy(e,t){let{members:n,tip:r}=e;if(n.length===1)return r.kind;let i=n[0];if(i.supersedes.length===0)return`created`;if(i.supersedes.length!==1)return r.kind;let a=t.get(i.supersedes[0]);if(!a)return r.kind;let o=r.stats.insertions+r.stats.deletions,s=a.stats.insertions+a.stats.deletions;return o>s?`expanded`:o<s?`shrunk`:`edited`}var ay={class:`journal`},oy={key:0,class:`panel-note view-error`,"data-testid":`journal-error`},sy={key:1,class:`journal-empty`,"data-testid":`journal-loading`},cy={key:2,class:`journal-empty`,"data-testid":`journal-empty`},ly=[`role`,`aria-expanded`,`title`,`tabindex`,`onClick`,`onKeydown`],uy={key:0,class:`boundary-fold`,"aria-hidden":`true`},dy=[`title`],fy=[`data-kind`,`data-seq`],py={class:`entry-header mono`},my=[`data-kind`],hy=[`title`],gy={key:0,class:`path-dir`},_y={class:`path-name`},vy={key:0,class:`fold-count`,"data-testid":`fold-count`},yy={class:`trailer`},by={class:`stats`},xy={key:0,class:`count-add`},Sy={key:1,class:`count-del`},Cy=[`title`],wy=[`onClick`],Ty={key:3,class:`boundary mono`,"data-testid":`journal-restarted`};function Ey(e){let t=new Map;for(let n of e){let e=n.type===`hunk`?n.supersedes:n.resolves;for(let r of e)t.has(r)||t.set(r,n.ts)}return t}var Dy=ef(gr({__name:`JournalView`,setup(e){let t={kind:`journal`},n=sl(),r=Vl(),i=$(()=>n.journalEntries),a=$(()=>ny(i.value)),o=$(()=>Ey(i.value)),s=$(()=>[...a.value].reverse()),c=Bt(new Set);function l(e){return o.value.has(e.tip.seq)}function u(e){return e.entry.resolves.length>0}function d(e){c.has(e)?c.delete(e):c.add(e)}let f=Date.now(),p=V(Date.now()),m=null;function h(){let e=i.value;return e.length>0?e[e.length-1].ts:0}function g(){p.value=Date.now();let e=p.value-h()<6e4?1e3:3e4;m=setTimeout(g,e)}function _(){m!==null&&clearTimeout(m),g()}function v(e){return p.value-e>36e5?b(e):Od(e,p.value)}function y(e){return kd(new Date(e))}function b(e){return Yl(e,p.value)}function x(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function S(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t+1)}function C(e){return e.status===`untracked`||e.status===`added`?!0:e.diff?.lines.some(e=>e.type===`header`&&e.content.startsWith(`new file mode`))??!1}function w(e){let t=e.kind;return t===`created`?C(e.tip)?`created`:`edited`:t===`expanded`||t===`shrunk`?`edited`:t}function T(e){let t=w(e);return t===`created`?`new file`:t}function E(e){let t=e.resolves.length;switch(e.kind){case`commit`:return`committed ${e.label} — ${t} change${t===1?``:`s`}`;case`checkout`:return`checked out ${e.label}`;case`stash`:return e.label?`stash — ${e.label}`:`stash`;case`op-start`:return`operation started — ${e.label}`;case`op-end`:return`operation finished — ${e.label}`;case`journal-start`:return`journal started ${b(e.ts)}`}}function D(e){let t=e.diff?.lines.length??0;return{containIntrinsicSize:`auto ${Math.max(48,t*20+32)}px`}}let O=Bt(new Set);function k(e){return e.stats.insertions+e.stats.deletions}function A(e){return k(e)>800&&!O.has(e.seq)}let j=V(null),M=new Map;function N(e,t){t instanceof HTMLElement?M.set(e,t):M.delete(e)}let P=a.value,F=Bt(new Set);function I(){let e=[];for(let t=P.length-1;t>=0;t--){let n=P[t],r=M.get(n.key);if(r){let t=String(n.key);e.push({key:t,kind:`file`,fileKey:t,el:r})}}return e}let L=Ym(j,{candidates:I,resolve:e=>M.get(Number(e))??null});function ee(){let e=new Map,t=0;for(let n of a.value)n.type===`boundary`&&(e.set(n.key,t),t=n.key);let n=new Set,r=[];for(let t of a.value)if(t.type===`boundary`&&c.has(t.key)){for(let e of t.entry.resolves)n.add(e);r.push({lo:e.get(t.key)??0,hi:t.key})}return{resolvedTips:n,sections:r}}let R=$(()=>{let e=new Set;if(c.size===0)return e;let{resolvedTips:t,sections:n}=ee();if(n.length===0)return e;let r=e=>n.some(t=>e>t.lo&&e<t.hi);for(let n of a.value)n.type===`hunk-group`&&(t.has(n.tip.seq)||l(n)&&r(n.tip.seq))&&e.add(n.key);return e}),te=$(()=>s.value.filter(e=>!R.value.has(e.key)));function ne(e,t){let n=[],r=new Map(t.map(e=>[e.key,e]));for(let t of e){let e=r.get(t.key),i=e?.type===`hunk-group`&&t.type===`hunk-group`&&e.tip.seq!==t.tip.seq;(!e||i)&&n.push(null)}let i=new Set(e.map(e=>e.key));for(let e of t)i.has(e.key)||n.push(M.get(e.key)??null);return n}function re(e,t){if(!ae.value||t.length===0)return;let n=new Set(t.map(e=>e.key)),r=0;for(let e of n)e>r&&(r=e);for(let t of e)t.type===`hunk-group`&&!n.has(t.key)&&t.key>r&&F.add(t.key)}function ie(e,t){let n=[];for(let r of e)t.has(r)||n.push(M.get(r)??null);for(let r of t)e.has(r)||n.push(null);return n}W([a,R],([e,t],[n,r])=>{re(e,n);let i=[...ne(e,n),...ie(t,r)];i.length!==0&&L.prepare({survivingKeys:new Set(e.filter(e=>!t.has(e.key)).map(e=>String(e.key))),changedEls:i})},{flush:`pre`}),W([a,R],([e])=>{L.restore(),P=e},{flush:`post`});let ae=V(!0),oe=V(0),se=ce(i.value);function ce(e){return e.length>0?e[e.length-1].seq:0}function ue(e,t){let n=0;for(let r of e)(r.type===`hunk-group`?r.tip.seq:r.key)>t&&n++;return n}function de(){let e=j.value;if(!e)return;let t=e.scrollTop<=40;ae.value=t,t&&(se=ce(i.value),oe.value=0)}function fe(){let e=j.value;e&&(e.scrollTop=0,ae.value=!0,se=ce(i.value),oe.value=0)}W(a,e=>{let t=ce(i.value);t<se?(se=t,oe.value=0,ae.value&&fe()):ae.value?t>se?fe():se=t:oe.value=ue(e,se)},{flush:`post`}),W(()=>n.journalEpoch,(e,t)=>{t!==null&&(O.clear(),F.clear(),c.clear(),pe.value=null,se=ce(i.value),oe.value=0,ae.value=!0,On(fe))});let pe=V(null);async function me(){pe.value=null;try{await n.loadJournal()}catch(e){pe.value=Rs(e)}}return W(()=>h(),_),jr(()=>{me(),g(),On(fe)}),Pr(()=>{m!==null&&(clearTimeout(m),m=null)}),(e,i)=>(q(),J(`div`,ay,[Y(`div`,{ref_key:`scrollerEl`,ref:j,class:`journal-scroll`,"data-testid":`journal-scroll`,onScrollPassive:de},[pe.value&&a.value.length===0?(q(),J(`p`,oy,B(pe.value),1)):a.value.length===0&&!U(n).journalLoaded?(q(),J(`p`,sy,` Loading journal… `)):a.value.length===0?(q(),J(`p`,cy,` journal started `+B(b(U(f)))+` — your edits will show up here `,1)):Q(``,!0),(q(!0),J(K,null,G(te.value,e=>(q(),J(K,{key:e.key},[e.type===`boundary`?(q(),J(`div`,{key:0,ref_for:!0,ref:t=>N(e.key,t),class:z([`boundary mono`,{foldable:u(e),folded:c.has(e.key)}]),"data-testid":`journal-boundary`,role:u(e)?`button`:void 0,"aria-expanded":u(e)?!c.has(e.key):void 0,title:u(e)?c.has(e.key)?`Show this commit's changes`:`Fold this commit's changes`:void 0,tabindex:u(e)?0:void 0,onClick:t=>u(e)&&d(e.key),onKeydown:[Xo(Jo(t=>u(e)&&d(e.key),[`prevent`]),[`enter`]),Xo(Jo(t=>u(e)&&d(e.key),[`prevent`]),[`space`])]},[u(e)?(q(),J(`span`,uy,B(c.has(e.key)?`▸`:`▾`),1)):Q(``,!0),Y(`span`,{class:`boundary-label`,title:E(e.entry)},B(E(e.entry)),9,dy)],42,ly)):(q(),J(`div`,{key:1,class:z([`reveal`,{enter:F.has(e.key)}])},[Y(`article`,{ref_for:!0,ref:t=>N(e.key,t),class:`entry`,"data-kind":w(e),"data-seq":e.key,"data-testid":`journal-entry`},[Y(`header`,py,[Y(`span`,{class:`kind`,"data-kind":w(e),"data-testid":`kind-badge`},B(T(e)),9,my),Y(`span`,{class:`path`,title:e.tip.path},[S(e.tip.path)?(q(),J(`span`,gy,B(S(e.tip.path)),1)):Q(``,!0),Y(`span`,_y,B(x(e.tip.path)),1)],8,hy),X(Qg,{pair:t}),X(Ug,{path:e.tip.path},null,8,[`path`]),X(Kg,{path:e.tip.path},null,8,[`path`]),e.members.length>1?(q(),J(`span`,vy,`×`+B(e.members.length),1)):Q(``,!0),Y(`span`,yy,[Y(`span`,by,[e.tip.stats.insertions?(q(),J(`span`,xy,`+`+B(e.tip.stats.insertions),1)):Q(``,!0),e.tip.stats.deletions?(q(),J(`span`,Sy,`−`+B(e.tip.stats.deletions),1)):Q(``,!0)]),Y(`time`,{class:`time`,title:y(e.tip.ts)},B(v(e.tip.ts)),9,Cy)])]),A(e.tip)?(q(),J(`button`,{key:0,class:`huge-row mono`,"data-testid":`huge-collapsed`,onClick:t=>O.add(e.tip.seq)},B(k(e.tip))+` lines changed — show `,9,wy)):(q(),J(`div`,{key:1,class:`entry-body`,style:le(D(e.tip)),"data-testid":`entry-body`},[X(A_,{diff:e.tip.diff,"file-path":e.tip.path,syntax:U(r).diffSyntaxEnabled,mode:U(r).diffMode},null,8,[`diff`,`file-path`,`syntax`,`mode`])],4))],8,fy)],2))],64))),128)),U(n).journalRestarted&&a.value.length>0?(q(),J(`div`,Ty,[...i[0]||=[Y(`span`,{class:`boundary-label`},`journal restarted — earlier entries were lost`,-1)]])):Q(``,!0)],544),oe.value>0?(q(),J(`button`,{key:0,class:`new-pill mono`,"data-testid":`new-pill`,onClick:fe},B(oe.value)+` new ↑ `,1)):Q(``,!0)]))}}),[[`__scopeId`,`data-v-f46c8c6a`]]);function Oy(e){let t={name:``,fullPath:``,isDirectory:!0,children:[],depth:0};for(let n=0;n<e.length;n++){let r=e[n].path.split(`/`),i=t;for(let e=0;e<r.length;e++){let t=r[e],a=e===r.length-1,o=r.slice(0,e+1).join(`/`),s=a?void 0:i.children.find(e=>e.name===t&&e.isDirectory);s||(s={name:t,fullPath:o,isDirectory:!a,children:[],depth:i.depth+1,fileIndex:a?n:void 0},i.children.push(s)),i=s}}return ky(t),jy(t),t}function ky(e){for(let t of e.children)ky(t);for(let t=0;t<e.children.length;t++){let n=e.children[t];for(;n.isDirectory&&n.children.length===1&&n.children[0].isDirectory;){let e=n.children[0];n.name=`${n.name}/${e.name}`,n.fullPath=e.fullPath,n.children=e.children,Ay(n,n.depth)}}}function Ay(e,t){e.depth=t;for(let n of e.children)Ay(n,t+1)}function jy(e){e.children.sort((e,t)=>e.isDirectory&&!t.isDirectory?-1:!e.isDirectory&&t.isDirectory?1:e.name.localeCompare(t.name));for(let t of e.children)jy(t)}function My(e){let t=[];function n(e,r){for(let i=0;i<e.children.length;i++){let a=e.children[i],o=i===e.children.length-1;t.push({type:a.isDirectory?`directory`:`file`,name:a.name,fullPath:a.fullPath,depth:a.depth-1,fileIndex:a.fileIndex,isLast:o,parentIsLast:[...r]}),a.isDirectory&&n(a,[...r,o])}}return n(e,[]),t}var Ny=[`onClick`],Py=[`aria-expanded`,`aria-label`,`onClick`,`onKeydown`],Fy=[`title`],Iy=[`data-file-index`,`aria-selected`,`tabindex`,`title`,`onClick`,`onKeydown`],Ly=[`data-status`],Ry={class:`name`},zy={key:0,class:`uncommitted-tag`,"data-testid":`uncommitted-tag`},By={class:`row-stats`},Vy={key:0,class:`count-add`},Hy={key:1,class:`count-del`};function Uy(e){return My(Oy(e)).flatMap(t=>{if(t.type!==`file`||t.fileIndex===void 0)return[];let n=e[t.fileIndex];return n?[n]:[]})}var Wy=ef(gr({__name:`ChangedFileTree`,props:{files:{},selectedIndex:{},portrait:{type:Boolean}},emits:[`activate`,`select`],setup(e,{emit:t}){let n=e,r=t,i=V(null),a=$(()=>My(Oy(n.files))),o=Bt(new Set);function s(e,t){t?o.add(e):o.delete(e)}function c(e){s(e,!o.has(e))}let l=$(()=>{let e=[],t=null;for(let n of a.value){if(t!==null){if(n.depth>t)continue;t=null}e.push(n),n.type===`directory`&&o.has(n.fullPath)&&(t=n.depth)}return e}),u=$(()=>{let e=[];for(let t of l.value){if(t.type===`directory`){e.push({...t,type:`directory`});continue}if(t.fileIndex===void 0)continue;let r=n.files[t.fileIndex];r&&e.push({...t,type:`file`,fileIndex:t.fileIndex,file:r})}return e}),d=$(()=>u.value.flatMap(e=>e.type===`file`?[e.fileIndex]:[]));function f(e){return e===`both`?`[uncommitted]`:`[${e}]`}let p=$(()=>{let e=d.value,t=n.selectedIndex;return t!==null&&e.includes(t)?t:e[0]??null});function m(e){return i.value?.querySelector(`.file-row[data-file-index="${e}"]`)??null}function h(e){let t=d.value,i=n.selectedIndex,a=Im(i===null?-1:t.indexOf(i),e,t.length);a!==-1&&(r(`select`,t[a]),On(()=>m(t[a])?.focus()))}let g=Vm(sn(n,`portrait`),h),{onPointerEnter:_,onPointerLeave:v}=Wm(i,()=>n.selectedIndex,()=>n.selectedIndex===null?null:m(n.selectedIndex));return(t,n)=>(q(),J(`aside`,{ref_key:`rootEl`,ref:i,class:`files-col`,role:`listbox`,"aria-label":`Changed files`,onPointerenter:n[3]||=(...e)=>U(_)&&U(_)(...e),onPointerleave:n[4]||=(...e)=>U(v)&&U(v)(...e)},[(q(!0),J(K,null,G(u.value,t=>(q(),J(K,{key:`${t.type}:${t.fullPath}:${t.fileIndex}`},[t.type===`directory`?(q(),J(`div`,{key:0,class:`dir-row mono`,role:`presentation`,style:le({"--depth":t.depth}),onClick:e=>c(t.fullPath)},[Y(`button`,{class:`dir-collapse-btn`,"aria-expanded":!o.has(t.fullPath),"aria-label":`${o.has(t.fullPath)?`Expand`:`Collapse`} ${t.fullPath}`,onClick:Jo(e=>c(t.fullPath),[`stop`]),onKeydown:[Xo(Jo(e=>c(t.fullPath),[`prevent`]),[`enter`]),Xo(Jo(e=>c(t.fullPath),[`prevent`]),[`space`]),Xo(Jo(e=>s(t.fullPath,!0),[`prevent`]),[`left`]),Xo(Jo(e=>s(t.fullPath,!1),[`prevent`]),[`right`])]},B(o.has(t.fullPath)?`▸`:`▾`),41,Py),Y(`span`,{class:`dir-name`,title:t.fullPath},B(t.name)+`/`,9,Fy)],12,Ny)):(q(),J(`div`,{key:1,class:z([`file-row mono list-row`,{selected:e.selectedIndex===t.fileIndex,uncommitted:t.file.uncommitted!==void 0}]),style:le({"--depth":t.depth}),"data-file-index":t.fileIndex,role:`option`,"aria-selected":e.selectedIndex===t.fileIndex,tabindex:t.fileIndex===p.value?0:-1,title:t.file.path,onClick:e=>r(`activate`,t.fileIndex),onKeydown:[n[0]||=Xo(Jo(e=>h(1),[`prevent`]),[`down`]),n[1]||=Xo(Jo(e=>h(-1),[`prevent`]),[`up`]),Xo(Jo(e=>r(`activate`,t.fileIndex),[`prevent`]),[`enter`]),Xo(Jo(e=>r(`activate`,t.fileIndex),[`prevent`]),[`space`]),n[2]||=(...e)=>U(g)&&U(g)(...e)]},[Y(`span`,{class:`letter`,"data-status":t.file.status},B(U(ql)(t.file.status)),9,Ly),Y(`span`,Ry,B(t.name),1),t.file.uncommitted?(q(),J(`span`,zy,B(f(t.file.uncommitted)),1)):Q(``,!0),Y(`span`,By,[t.file.additions?(q(),J(`span`,Vy,`+`+B(t.file.additions),1)):Q(``,!0),t.file.deletions?(q(),J(`span`,Hy,`−`+B(t.file.deletions),1)):Q(``,!0)])],46,Iy))],64))),128))],544))}}),[[`__scopeId`,`data-v-16864c04`]]),Gy={class:`commits-col files-col`,"aria-label":`Commit history`},Ky={key:0,class:`panel-note`},qy={key:1,class:`panel-note view-error`},Jy={key:2,class:`panel-note`,"data-testid":`history-empty`},Yy=[`aria-selected`,`tabindex`,`title`,`onClick`,`onKeydown`],Xy={class:`row-top`},Zy={class:`hash mono`},Qy=[`title`],$y={class:`row-meta mono`},eb=[`title`],tb=[`title`],nb={class:`date`},rb={key:0,class:`load-error view-error`,"data-testid":`load-error`},ib=[`disabled`],ab={class:`detail-header`,"data-testid":`commit-detail`},ob={class:`detail-top`},sb=[`title`],cb={class:`detail-message`},lb={class:`detail-meta mono`},ub={class:`author`},db={class:`abs-date`},fb={key:0,class:`panel-note view-error detail-note`,"data-testid":`detail-error`},pb={key:1,class:`panel-note detail-note`},mb={key:2,class:`panel-note detail-note`,"data-testid":`history-no-files`},hb={key:2,class:`panel-note detail-note`,"data-testid":`history-prompt`},gb=100,_b=ef(gr({__name:`HistoryView`,setup(e){let t=sl(),n=Vl(),{history:r}=Fs(t),i=V(null),a=V(null),o=V(Math.max(gb,t.history.commits.length)),s=V(null),c=$(()=>r.value.commits),l=$(()=>r.value.selectedCommit),u=$(()=>r.value.commitFiles??[]);function d(e){return`h:${l.value?.hash??``}:${e}`}let f=V(null),p=Bt(new Set),m=V(null),h=$(()=>m.value?.scrollerEl??null);W(()=>r.value.commitFiles,e=>{let t=e?Uy(e)[0]:void 0;f.value=t&&e?e.indexOf(t):null},{immediate:!0});let g=$(()=>{let e=l.value;return e?Uy(u.value).map(n=>{let r=d(n.path);return{key:r,path:n.path,status:n.status,stats:{insertions:n.additions,deletions:n.deletions},diff:t.wholeFile?.key===r?t.wholeFile.diff:n.diff,collapsed:p.has(r),refPair:{kind:`commit`,shortHash:e.shortHash}}}):[]}),_=$(()=>{let e=f.value===null?void 0:u.value[f.value];return e?d(e.path):null});function v(e){let t=u.value[e];if(!t)return;f.value=e;let n=d(t.path);p.delete(n),On(()=>m.value?.scrollToFile(n))}function y(e){let t=u.value.findIndex(t=>d(t.path)===e);t!==-1&&(f.value=t)}function b(e){p.has(e)?p.delete(e):p.add(e)}W(()=>n.expandGatedRequest,e=>{e!==0&&m.value?.expandAllGated()}),W(l,(e,n)=>{n&&e?.hash!==n.hash&&t.wholeFile!==null&&t.setWholeFile(null)});function x(e){let n=l.value,r=u.value.find(t=>d(t.path)===e);n&&r&&(t.wholeFile?.key===e?t.setWholeFile(null):(tu({view:`history`}),t.setWholeFile({view:`history`,key:e,path:r.path,hash:n.hash})))}let S=$(()=>c.value.length>=o.value),C=o.value;async function w(e){i.value=null,C=e;try{await t.loadHistory(e),o.value=e}catch(e){i.value=Rs(e)}}function T(){w(C)}jr(()=>{c.value.length===0&&!r.value.isLoading&&w(gb)});let E=V(null);function D(e){tu({view:`history`}),O(e)}async function O(e){a.value=null,E.value=e.hash;try{await t.selectHistoryCommit(e)}catch(e){a.value=`Failed to load commit diff: ${Rs(e)}`}}W(c,e=>{let t=E.value;if(t===null||l.value!==null)return;let n=e.find(e=>e.hash===t);n?O(n):E.value=null});function k(e){return e.refs?e.refs.split(`,`).map(e=>e.trim()).filter(Boolean):[]}function A(e){return Od(e.date.getTime())}let j=$(()=>{let e=c.value,t=l.value;return t&&e.includes(t)?t:e[0]??null});function M(e){let t=c.value,n=Im(l.value?t.indexOf(l.value):-1,e,t.length);n!==-1&&(O(t[n]),On(()=>{s.value?.querySelectorAll(`.commit-row`)[n]?.focus()}))}let N=gu(),P=V(null),F=zm({container:P,isRow:N,row:{pref:`historyTop`,defaultRatio:.28,min:kl,max:Al}}),I=Vm(N,M),L=Um(N,h,`Commit diff`,{self:!0});function ee(e){O(e),N.value&&On(()=>h.value?.focus())}return(e,d)=>(q(),J(`div`,{ref_key:`containerEl`,ref:P,class:z([`history`,{portrait:U(N)}]),style:le(U(N)?{"--history-top":`${(U(F).rowRatio.value*100).toFixed(2)}%`}:void 0)},[Y(`aside`,Gy,[U(r).isLoading&&c.value.length===0?(q(),J(`p`,Ky,`Loading history…`)):i.value&&c.value.length===0?(q(),J(`p`,qy,B(i.value),1)):c.value.length===0?(q(),J(`p`,Jy,` No commits yet. `)):(q(),J(K,{key:3},[Y(`div`,{ref_key:`listEl`,ref:s,class:`commit-list`,"data-testid":`commit-list`,role:`listbox`,"aria-label":`Commits`},[(q(!0),J(K,null,G(c.value,e=>(q(),J(`div`,{key:e.hash,class:z([`commit-row list-row`,{selected:e===l.value}]),role:`option`,"aria-selected":e===l.value,tabindex:e===j.value?0:-1,title:e.hash,onClick:t=>D(e),onKeydown:[d[0]||=Xo(Jo(e=>M(1),[`prevent`]),[`down`]),d[1]||=Xo(Jo(e=>M(-1),[`prevent`]),[`up`]),Xo(Jo(t=>ee(e),[`prevent`]),[`enter`]),Xo(Jo(t=>D(e),[`prevent`]),[`space`]),d[2]||=(...e)=>U(I)&&U(I)(...e)]},[Y(`span`,Xy,[Y(`span`,Zy,B(e.shortHash),1),Y(`span`,{class:`message`,title:e.message},B(e.message),9,Qy)]),Y(`span`,$y,[(q(!0),J(K,null,G(k(e),e=>(q(),J(`span`,{key:e,class:`ref-tag`,title:e},B(e),9,eb))),128)),Y(`span`,{class:`author`,title:e.author},B(e.author),9,tb),Y(`span`,nb,B(A(e)),1)])],42,Yy))),128))],512),i.value?(q(),J(`p`,rb,[Z(B(i.value)+` `,1),Y(`button`,{class:`load-retry chrome-chip`,"data-testid":`load-retry`,onClick:T},`Retry`)])):Q(``,!0),S.value?(q(),J(`button`,{key:1,class:`load-more chrome-chip`,"data-testid":`load-more`,disabled:U(r).isLoading,onClick:d[3]||=e=>w(o.value+gb)},B(U(r).isLoading?`Loading…`:`Load more`),9,ib)):Q(``,!0)],64))]),U(N)?(q(),ga(Pv,{key:0,class:`history-resizer`,split:U(F),label:`Resize commit and file lists`},null,8,[`split`])):Q(``,!0),X(Wy,{class:`commit-files`,"data-testid":`commit-files`,files:u.value,"selected-index":f.value,portrait:U(N),onActivate:v,onSelect:v},null,8,[`files`,`selected-index`,`portrait`]),l.value?(q(),J(K,{key:1},[Y(`header`,ab,[Y(`div`,ob,[Y(`span`,{class:`full-hash mono`,title:l.value.hash},B(l.value.hash),9,sb)]),Y(`p`,cb,B(l.value.message),1),Y(`p`,lb,[Y(`span`,ub,B(l.value.author),1),Y(`span`,db,B(U(kd)(l.value.date)),1)])]),a.value?(q(),J(`p`,fb,B(a.value),1)):U(r).commitFiles===null?(q(),J(`p`,pb,`Loading diff…`)):U(r).commitFiles.length===0?(q(),J(`p`,mb,` No file changes to show (merge commits are not shown as a diff). `)):(q(),ga(nv,Oa({key:3,ref_key:`stackEl`,ref:m,class:`diffs-col`,"data-testid":`commit-diffs`,files:g.value,"active-key":_.value,syntax:U(n).diffSyntaxEnabled,mode:U(n).diffMode,wrap:U(n).wrapEnabled,"show-whole-toggle":``,"whole-key":U(t).wholeFile?.key??null,"whole-loading":U(t).wholeFileLoading,"whole-refusal":U(t).wholeFileRefusal},U(L),{onActiveFile:y,onToggleCollapse:b,onToggleWhole:x}),null,16,[`files`,`active-key`,`syntax`,`mode`,`wrap`,`whole-key`,`whole-loading`,`whole-refusal`]))],64)):(q(),J(`p`,hb,` Select a commit to view its changes `))],6))}}),[[`__scopeId`,`data-v-7fe3481f`]]),vb=new Set([`/`,`-`,`_`,`.`]);function yb(e){if(e.length<2)return``;let t=e[0];for(let n of e.slice(1)){let e=0;for(;e<t.length&&e<n.length&&t[e]===n[e];)e++;t=t.slice(0,e)}let n=t.length;for(;n>0&&!vb.has(t[n-1]);)n--;let r=t.slice(0,n);return e.every(e=>e.length>r.length)?r:``}var bb={class:`stack-strip mono`,"aria-label":`Stack layers`,"data-testid":`stack-strip`},xb=[`aria-pressed`,`disabled`],Sb=[`title`],Cb=[`title`],wb={class:`layers`},Tb=[`data-layer`,`aria-pressed`,`disabled`,`title`,`onClick`],Eb={class:`pos`,"aria-hidden":`true`},Db={class:`name`,"aria-hidden":`true`},Ob={class:`visually-hidden`},kb={class:`commits`},Ab={class:`visually-hidden`},jb={key:1,class:`visually-hidden`},Mb={key:1,class:`note`,"data-testid":`stack-forked`},Nb=ef(gr({__name:`StackStrip`,props:{stack:{},active:{},disabled:{type:Boolean}},emits:[`pick`],setup(e,{emit:t}){let n=e,r=t,i=$(()=>yb(n.stack.layers.map(e=>e.name)));function a(e){return e.name.slice(i.value.length)}function o(e){return e.commits===1?`commit`:`commits`}function s(e){return e.refs.slice(1).join(`, `)}function c(e){let t=s(e)===``?``:`; also ${s(e)}`,n=e.isHead?` (checked out)`:``;return`${e.name}${n}: ${e.commits} ${o(e)} on top of the layer below${t}`}return(t,n)=>(q(),J(`nav`,bb,[n[3]||=Y(`span`,{class:`eyebrow`,"aria-hidden":`true`},`stack`,-1),Y(`button`,{type:`button`,class:z([`chip all`,{current:e.active===null}]),"data-testid":`stack-all`,"aria-pressed":e.active===null,disabled:e.disabled,title:`The whole stack: trunk…HEAD`,onClick:n[0]||=e=>r(`pick`,null)},` all `,10,xb),Y(`span`,{class:`trunk`,"data-testid":`stack-trunk`,title:`trunk: ${e.stack.trunk}`},B(e.stack.trunk),9,Sb),n[4]||=Y(`span`,{class:`arrow`,"aria-hidden":`true`},`›`,-1),i.value?(q(),J(`span`,{key:0,class:`prefix`,"data-testid":`stack-prefix`,title:`Every layer's name starts with ${i.value}`},B(i.value),9,Cb)):Q(``,!0),Y(`span`,wb,[(q(!0),J(K,null,G(e.stack.layers,(t,i)=>(q(),J(`button`,{key:t.tip,type:`button`,class:z([`layer`,{current:e.active===t.name,head:t.isHead}]),"data-testid":`stack-layer`,"data-layer":t.name,"aria-pressed":e.active===t.name,disabled:e.disabled,title:c(t),onClick:e=>r(`pick`,t.name)},[Y(`span`,Eb,B(i+1),1),Y(`span`,Db,B(a(t)),1),Y(`span`,Ob,B(t.name),1),Y(`span`,kb,[Z(B(t.commits),1),Y(`span`,Ab,B(` ${o(t)}`),1)]),t.isHead?(q(),J(K,{key:0},[n[1]||=Y(`span`,{class:`head-mark`,"aria-hidden":`true`},`●`,-1),n[2]||=Y(`span`,{class:`visually-hidden`},`, checked out`,-1)],64)):Q(``,!0),s(t)===``?Q(``,!0):(q(),J(`span`,jb,`, also `+B(s(t)),1))],10,Tb))),128))]),e.stack.forkedAbove?(q(),J(`span`,Mb,`forks above HEAD; only this line is shown`)):Q(``,!0)]))}}),[[`__scopeId`,`data-v-9c7b2b84`]]),Pb={class:`topbar`,"data-testid":`compare-topbar`},Fb={class:`base-select`},Ib=[`title`],Lb={key:1,class:`arrow`,"aria-hidden":`true`},Rb=[`disabled`,`value`],zb={key:0,value:``,disabled:``},Bb=[`value`],Vb={key:1,class:`uncommitted-toggles`,"data-testid":`uncommitted-toggles`},Hb=[`data-testid`,`checked`,`disabled`,`title`,`onChange`],Ub={key:2,class:`stats mono`,"data-testid":`compare-stats`},Wb={class:`files-changed`},Gb={class:`count-add`},Kb={class:`count-del`},qb={key:3,class:`topbar-busy mono`,"data-testid":`compare-busy`},Jb={key:0,class:`view-error error-banner`,"data-testid":`compare-error-banner`},Yb={key:1,class:`panel-note view-error`,"data-testid":`compare-error`},Xb={key:2,class:`state-block`,"data-testid":`no-base-branch`},Zb={key:3,class:`panel-note`,"data-testid":`compare-loading`},Qb={key:4,class:`panel-note`,"data-testid":`compare-clean`},$b={key:0,class:`commits-section`},ex=[`aria-expanded`],tx={class:`chevron`},nx={class:`commits-count`},rx={key:0,class:`commit-list mono`,"data-testid":`compare-commits`},ix={class:`hash`},ax=[`title`],ox={class:`meta`},sx={class:`author`},cx={class:`date`},lx=[`aria-busy`],ux=ef(gr({__name:`CompareView`,setup(e){let t=sl(),n=Vl(),{compare:r,compareStack:i,selectedStackHead:a,pickedLayer:o,comparePair:s}=Fs(t),c=Bt(t.getLastUncommitted()),l=[{key:`staged`,label:`staged`},{key:`unstaged`,label:`unstaged`},{key:`untracked`,label:`untracked`}],u=V([]),d=V(!1),f=Bt(new Set),p=V(null),m=$(()=>p.value?.scrollerEl??null);jr(()=>{h(),g()});async function h(){await t.refreshCompare({...c})}async function g(){try{u.value=await t.getCandidateBaseBranches()}catch{u.value=[]}}let _=$(()=>r.value.compareDiff),v=$(()=>_.value?.files??[]),y=$(()=>t.shared.status?.branch?.current||null),b=$(()=>s.value.head??y.value),x=$(()=>{let e=r.value.baseBranch;return e!==null&&!u.value.includes(e)?[e,...u.value]:u.value});async function S(e){let n=e.target.value;n&&n!==r.value.baseBranch&&(tu({view:`compare`}),await t.setSelectedCompareBase(n,{...c}))}let C=$(()=>(i.value?.layers.length??0)>=2);async function w(e){e!==a.value&&(tu({view:`compare`}),await t.setSelectedStackHead(e,{...c}))}let T=$(()=>o.value!==null&&!o.value.isHead),E=$(()=>c.unstaged);async function D(e,n){c[e]=n.target.checked,c.unstaged&&(c.staged=!0),await t.refreshCompare({...c})}function O(e){return Od(e.date.getTime())}let k=$(()=>r.value.selection.type===`file`?r.value.selection.index:null);function A(e){tu({view:`compare`}),j(e)}function j(e){t.selectCompareFile(e);let n=v.value[e];if(!n)return;let r=$c(n);f.delete(r),On(()=>p.value?.scrollToFile(r))}W(()=>n.stackScrollRequest,e=>{e&&On(()=>p.value?.scrollToFile(e.key,{smooth:!1}))}),W(()=>n.expandGatedRequest,e=>{e!==0&&p.value?.expandAllGated()});function M(e){let n=v.value.findIndex(t=>$c(t)===e);n!==-1&&t.selectCompareFile(n)}W(()=>v.value,e=>{let n=Uy(e)[0];n&&k.value===null&&t.selectCompareFile(e.indexOf(n))},{immediate:!0});function N(e){f.has(e)?f.delete(e):f.add(e)}function P(e){if(tu({view:`compare`}),t.wholeFile?.key===e){t.setWholeFile(null);return}let n=F.value.find(t=>$c(t)===e);if(!n)return;let r=v.value.findIndex(t=>$c(t)===e);r!==-1&&j(r),t.setWholeFile({view:`compare`,key:e,path:n.path,side:n.uncommitted})}let F=$(()=>Uy(v.value)),I=$(()=>F.value.map(e=>({key:$c(e),path:e.path,status:e.status,uncommitted:e.uncommitted,stats:{insertions:e.additions,deletions:e.deletions},diff:t.wholeFile?.key===$c(e)?t.wholeFile.diff:e.diff,collapsed:f.has($c(e)),refPair:e.uncommitted?{kind:`compare-uncommitted`,base:s.value.base,side:e.uncommitted}:{kind:`compare`,base:s.value.base,head:s.value.head}}))),L=$(()=>{let e=k.value;if(e===null)return null;let t=v.value[e];return t?$c(t):null}),ee=gu(),R=V(null),te=zm({container:R,isRow:ee,row:{pref:`compareTop`,defaultRatio:.22,min:kl,max:Al}}),ne=Um(ee,m,`File diffs`,{self:!0});return(e,o)=>(q(),J(`div`,{class:z([`compare`,{portrait:U(ee)}]),style:le(U(ee)?{"--compare-top":`${(U(te).rowRatio.value*100).toFixed(2)}%`}:void 0)},[Y(`header`,Pb,[(q(),ga(lr,{defer:``,to:`#view-toolbar-slot`,disabled:!U(ee)},[Y(`label`,Fb,[b.value?(q(),J(`span`,{key:0,class:`head-branch mono`,title:b.value},B(b.value),9,Ib)):Q(``,!0),b.value?(q(),J(`span`,Lb,`→`)):Q(``,!0),o[1]||=Y(`span`,{class:`eyebrow`},`base`,-1),Y(`select`,{class:`mono`,"data-testid":`base-select`,"aria-label":`Base branch`,disabled:U(r).loading,value:U(r).baseBranch??``,onChange:S},[U(r).baseBranch===null?(q(),J(`option`,zb,`pick a base…`)):Q(``,!0),(q(!0),J(K,null,G(x.value,e=>(q(),J(`option`,{key:e,value:e},B(e),9,Bb))),128))],40,Rb)])],8,[`disabled`])),C.value&&U(i)?(q(),ga(Nb,{key:0,stack:U(i),active:U(a),disabled:U(r).loading,onPick:w},null,8,[`stack`,`active`,`disabled`])):Q(``,!0),T.value?Q(``,!0):(q(),J(`fieldset`,Vb,[o[2]||=Y(`legend`,null,`include`,-1),(q(),J(K,null,G(l,e=>Y(`label`,{key:e.key,class:`uncommitted-toggle`},[Y(`input`,{type:`checkbox`,"data-testid":`uncommitted-toggle-${e.key}`,checked:c[e.key],disabled:e.key===`staged`&&E.value,title:e.key===`staged`&&E.value?`Unstaged edits sit on top of staged ones, so unstaged includes these`:void 0,onChange:t=>D(e.key,t)},null,40,Hb),Y(`span`,null,B(e.label),1)])),64))])),_.value?(q(),J(`p`,Ub,[Y(`span`,Wb,B(_.value.stats.filesChanged)+` `+B(_.value.stats.filesChanged===1?`file`:`files`)+` changed`,1),Y(`span`,Gb,`+`+B(_.value.stats.additions),1),Y(`span`,Kb,`−`+B(_.value.stats.deletions),1)])):Q(``,!0),U(r).loading&&_.value?(q(),J(`span`,qb,`Loading…`)):Q(``,!0)]),U(r).error&&_.value?(q(),J(`p`,Jb,B(U(r).error),1)):Q(``,!0),U(r).error&&!_.value?(q(),J(`p`,Yb,B(U(r).error),1)):U(r).noBaseBranch?(q(),J(`div`,Xb,[...o[3]||=[Y(`p`,{class:`state-title`},`No base branch detected.`,-1),Y(`p`,{class:`state-hint`},` Base detection uses remote refs (like origin/main) — this repo has none that qualify. Pick a base branch above to compare against. `,-1)]])):U(r).loading&&!_.value?(q(),J(`p`,Zb,` Loading compare… `)):_.value&&v.value.length===0?(q(),J(`p`,Qb,` No changes`+B(b.value?` on ${b.value}`:``)+` compared to `+B(U(s).base)+`. `,1)):_.value?(q(),J(K,{key:5},[_.value.commits.length>0?(q(),J(`section`,$b,[(q(),ga(lr,{defer:``,to:`#view-toolbar-slot`,disabled:!U(ee)},[Y(`button`,{class:`commits-toggle eyebrow`,"data-testid":`commits-toggle`,"aria-expanded":d.value,onClick:o[0]||=e=>d.value=!d.value},[Y(`span`,tx,B(d.value?`▾`:`▸`),1),o[4]||=Z(` Commits `,-1),Y(`span`,nx,B(_.value.commits.length),1)],8,ex)],8,[`disabled`])),d.value?(q(),J(`ul`,rx,[(q(!0),J(K,null,G(_.value.commits,e=>(q(),J(`li`,{key:e.hash,class:`commit-row`},[Y(`span`,ix,B(e.shortHash),1),Y(`span`,{class:`message`,title:e.message},B(e.message),9,ax),Y(`span`,ox,[Y(`span`,sx,B(e.author),1),Y(`span`,cx,B(O(e)),1)])]))),128))])):Q(``,!0)])):Q(``,!0),Y(`div`,{ref_key:`prBodyEl`,ref:R,class:`pr-body`,"aria-busy":U(r).loading&&!!_.value},[X(Wy,{"data-testid":`compare-files`,files:v.value,"selected-index":k.value,portrait:U(ee),onActivate:A,onSelect:j},null,8,[`files`,`selected-index`,`portrait`]),U(ee)?(q(),ga(Pv,{key:0,split:U(te),label:`Resize file list`},null,8,[`split`])):Q(``,!0),X(nv,Oa({ref_key:`stackEl`,ref:p,class:`diffs-col`,"data-testid":`compare-diffs`,files:I.value,"active-key":L.value,syntax:U(n).diffSyntaxEnabled,mode:U(n).diffMode,wrap:U(n).wrapEnabled,"show-whole-toggle":``,"whole-key":U(t).wholeFile?.key??null,"whole-loading":U(t).wholeFileLoading,"whole-refusal":U(t).wholeFileRefusal},U(ne),{onActiveFile:M,onToggleCollapse:N,onToggleWhole:P}),null,16,[`files`,`active-key`,`syntax`,`mode`,`wrap`,`whole-key`,`whole-loading`,`whole-refusal`])],8,lx)],64)):Q(``,!0)],6))}}),[[`__scopeId`,`data-v-4e535c19`]]),dx=[`title`],fx=ef(gr({__name:`ShowChangesButton`,props:{path:{}},setup(e){let t=e,n=sl(),r=Vl(),i=$(()=>{let e=(n.shared.status?.files??[]).filter(e=>e.path===t.path);return e.length===0?null:e.find(e=>!e.staged)??e[0]});function a(){let e=i.value;if(!e)return;let t=Qc(e);tu({view:`changes`}),r.setActiveView(`changes`),n.selectFile(e),r.setActiveStackKey(t),r.requestStackScroll(t)}return(e,n)=>i.value?(q(),J(`button`,{key:0,class:`show-changes mono`,"data-testid":`show-changes`,title:`Show what changed in ${t.path}`,onClick:n[0]||=Jo(e=>a(),[`stop`])},` show changes `,8,dx)):Q(``,!0)}}),[[`__scopeId`,`data-v-786aa840`]]),px={key:0,class:`image-view`,"data-testid":`image-view`},mx={class:`image-controls`},hx=[`aria-pressed`,`title`],gx=ef(gr({__name:`ImageView`,props:{path:{},media:{}},emits:[`fail`],setup(e,{emit:t}){let n=e,r=t,i=sl(),a=V(`fit`),o=$(()=>i.repoId===null?null:Us(i.repoId,{path:n.path,side:`worktree`,version:n.media.version}));return(t,n)=>o.value!==null&&e.media.image?(q(),J(`div`,px,[Y(`div`,mx,[Y(`button`,{class:z([`fit-toggle mono`,{on:a.value===`actual`}]),"data-testid":`image-fit-toggle`,"aria-pressed":a.value===`actual`,"aria-label":`Show the image at its actual size`,title:a.value===`actual`?`Actual size: on. Click to shrink the image to fit`:`Actual size: off. Click to show every pixel 1:1 and scroll`,onClick:n[0]||=e=>a.value=a.value===`actual`?`fit`:`actual`},` 1:1 `,10,hx)]),X(vv,{src:o.value,width:e.media.image.width,height:e.media.image.height,fit:a.value,onFail:n[1]||=e=>r(`fail`)},null,8,[`src`,`width`,`height`,`fit`])])):Q(``,!0)}}),[[`__scopeId`,`data-v-94ee96d6`]]),_x={class:`file-pane`},vx={key:0,class:`pane-header mono`,"data-testid":`file-header`},yx=[`title`],bx={class:`file-meta`},xx={key:0,class:`file-lang`},Sx={key:1,class:`file-lang`,"data-testid":`file-format`},Cx={key:2,class:`mono`,"data-testid":`file-dimensions`},wx={key:3,"data-testid":`file-frames`},Tx={key:4,class:`file-size`},Ex={class:`pane-body`},Dx={key:0,class:`pane-note`,"data-testid":`file-prompt`},Ox={key:1,class:`pane-note pane-error mono`,"data-testid":`file-error`},kx={key:2,class:`pane-note`,"data-testid":`file-loading`},Ax={key:4,class:`pane-note`,"data-testid":`file-binary`},jx={key:0,"data-testid":`image-refused`},Mx={key:5,class:`pane-note`,"data-testid":`file-too-large`},Nx={key:6,class:`pane-note`,"data-testid":`file-empty`},Px=[`data-ln`],Fx={class:`ln code-gutter`},Ix=[`innerHTML`],Lx={key:0,class:`truncated-note mono`,"data-testid":`file-truncated`},Rx=ef(gr({__name:`FileContentPane`,props:{path:{},file:{},loading:{type:Boolean},error:{},wrap:{type:Boolean}},setup(e){let t=e,n=$(()=>{if(t.path===null||t.file===null)return null;let{binary:e,tooLarge:n,content:r}=t.file;return e||n||r===``?null:Cg(r,t.path)}),r=cl(),i=V(null),a=V(null),o=null;W(()=>r.lineRequest,e=>{e&&On(()=>{let t=i.value?.querySelector(`[data-ln="${e.line}"]`);t&&(t.scrollIntoView({block:`center`}),a.value=e.line,o&&clearTimeout(o),o=setTimeout(()=>{a.value=null,o=null},1200))})});let s=$(()=>{let e=n.value?.lines.length??0;return`${Math.max(3,String(e).length)}ch`}),c=$(()=>t.file!==null&&!t.file.binary&&!t.file.tooLarge&&t.file.content===``),l=V(!1);W(()=>[t.path,t.file],()=>{l.value=!1});let u=$(()=>{if(l.value)return` · preview failed to decode`;let e=t.file?.media?.refusal??null,n=e===null?null:fv[e];return n===null?``:` · ${n}`}),d=$(()=>t.file?.media?.image??null),f=$(()=>{let e=d.value?.frames??1;return e>1?e:null});return(t,r)=>(q(),J(`div`,_x,[e.path?(q(),J(`header`,vx,[Y(`span`,{class:`file-path`,title:e.path},B(e.path),9,yx),Y(`span`,bx,[n.value?.language?(q(),J(`span`,xx,B(n.value.language),1)):Q(``,!0),d.value?(q(),J(`span`,Sx,B(d.value.format),1)):Q(``,!0),d.value?(q(),J(`span`,Cx,B(d.value.width)+` × `+B(d.value.height),1)):Q(``,!0),f.value?(q(),J(`span`,wx,B(f.value)+` frames`,1)):Q(``,!0),e.file?(q(),J(`span`,Tx,B(U(Kl)(e.file.size)),1)):Q(``,!0),e.path?(q(),ga(fx,{key:5,path:e.path},null,8,[`path`])):Q(``,!0),X(M_)])])):Q(``,!0),Y(`div`,Ex,[e.path===null?(q(),J(`p`,Dx,`Select a file`)):e.error&&e.file===null?(q(),J(`p`,Ox,B(e.error),1)):e.file===null?(q(),J(`p`,kx,B(e.loading?`Loading…`:``),1)):e.file.media?.image&&!l.value?(q(),ga(gx,{key:3,path:e.path,media:e.file.media,onFail:r[0]||=e=>l.value=!0},null,8,[`path`,`media`])):e.file.binary||e.file.media?(q(),J(`p`,Ax,[Z(` Binary file — `+B(U(Kl)(e.file.size)),1),u.value?(q(),J(`span`,jx,B(u.value),1)):Q(``,!0)])):e.file.tooLarge?(q(),J(`p`,Mx,` File too large to display (`+B(U(Kl)(e.file.size))+`) `,1)):c.value?(q(),J(`p`,Nx,`Empty file`)):n.value?(q(),J(`div`,{key:7,ref_key:`scrollEl`,ref:i,class:z([`code-scroll mono`,{wrap:e.wrap}]),"data-testid":`file-content`},[Y(`div`,{class:z([`code-lines`,{stale:e.loading}]),style:le({"--ln-w":s.value})},[(q(!0),J(K,null,G(n.value.lines,(e,t)=>(q(),J(`div`,{key:t,class:z([`code-row`,{"line-flash":a.value===t+1}]),"data-ln":t+1},[Y(`span`,Fx,B(t+1),1),Y(`span`,{class:`code code-cell`,innerHTML:e},null,8,Ix)],10,Px))),128))],6),e.file.truncated?(q(),J(`p`,Lx,` Truncated — showing the first `+B(n.value.lines.length.toLocaleString())+` of `+B(e.file.totalLines.toLocaleString())+` lines. `,1)):Q(``,!0)],2)):Q(``,!0)])]))}}),[[`__scopeId`,`data-v-19236ad9`]]),zx=5e3;function Bx(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n>0?t.slice(n):t}function Vx(e,t){if(e.binary)return{kind:`note`,note:`Binary file — no outline.`};if(e.tooLarge)return{kind:`note`,note:`File too large to outline.`};if(t===null)return{kind:`note`,note:`Loading outline…`};if(t.status===`unavailable`)return{kind:`note`,note:`Outline unavailable for this file.`};if(t.status===`unsupported`)return t.reason===`no-script-block`?{kind:`note`,note:`No <script> block in this component.`}:{kind:`note`,note:`No outline for ${Bx(e.path)} files.`};if(t.symbols.length===0)return{kind:`note`,note:`No symbols in this file.`};let n=e.truncated&&e.totalLines>zx?`Outline of the first ${zx.toLocaleString()} of ${e.totalLines.toLocaleString()} lines.`:null;return{kind:`symbols`,symbols:t.symbols,note:n}}var Hx=[`value`],Ux={key:0,class:`outline-note`,"data-testid":`outline-note`},Wx={key:0,class:`outline-note`,"data-testid":`outline-partial`},Gx={key:1,class:`outline-note`,"data-testid":`outline-no-match`},Kx={key:2,class:`outline-list`,role:`listbox`,"aria-label":`Symbols`},qx=[`title`,`aria-selected`,`onMousemove`,`onClick`],Jx={class:`outline-kind`},Yx={class:`outline-name`},Xx={key:0,class:`outline-parent`},Zx={class:`outline-line`},Qx=ef(gr({__name:`OutlinePopover`,setup(e,{expose:t}){let n=cl(),{open:r,rootEl:i}=nf(),a=V(null),o=V(``),s=V(0),c=null;function l(){o.value=``,s.value=0,c=document.activeElement instanceof HTMLElement?document.activeElement:null,r.value=!0,On(()=>a.value?.focus())}W(r,e=>{if(e)return;let t=i.value?.contains(document.activeElement)??!1,n=c;c=null,t&&n?.isConnected===!0&&n.focus()}),t({openPopover:l});let u=$(()=>n.file===null||n.selectedPath===null?{kind:`note`,note:`No file open.`}:Vx({path:n.selectedPath,binary:n.file.binary,tooLarge:n.file.tooLarge,truncated:n.file.truncated,totalLines:n.file.totalLines},n.fileSymbols)),d=$(()=>u.value.kind===`symbols`?u.value.symbols:[]),f=$(()=>{let e=o.value.trim();if(e===``)return d.value;let t=d.value.map(e=>e.name),n=new Set(Cd(t,t.length).find(e).map(e=>e.text));return d.value.filter(e=>n.has(e.name))});W(f,()=>{s.value=0}),W(()=>n.selectedPath,()=>{r.value=!1});function p(e){n.requestLine(e.startLine),r.value=!1}function m(e){if(e.key===`ArrowDown`||e.ctrlKey&&e.key===`j`)e.preventDefault(),s.value=Td(s.value,1,f.value.length);else if(e.key===`ArrowUp`||e.ctrlKey&&e.key===`k`)e.preventDefault(),s.value=Td(s.value,-1,f.value.length);else if(e.key===`Enter`){e.preventDefault();let t=f.value[s.value];t!==void 0&&p(t)}else e.key===`Escape`&&(e.preventDefault(),r.value=!1)}return(e,t)=>U(r)?(q(),J(`div`,{key:0,ref_key:`rootEl`,ref:i,class:`outline mono`,"data-testid":`outline-popover`},[Y(`input`,{ref_key:`inputEl`,ref:a,class:`outline-input mono`,"data-testid":`outline-input`,type:`text`,autocomplete:`off`,spellcheck:`false`,placeholder:`filter symbols`,"aria-label":`Filter symbols`,value:o.value,onInput:t[0]||=e=>o.value=e.target.value,onKeydown:m},null,40,Hx),u.value.kind===`note`?(q(),J(`p`,Ux,B(u.value.note),1)):(q(),J(K,{key:1},[u.value.note?(q(),J(`p`,Wx,B(u.value.note),1)):Q(``,!0),f.value.length===0?(q(),J(`p`,Gx,` No symbol matches “`+B(o.value.trim())+`”. `,1)):(q(),J(`ul`,Kx,[(q(!0),J(K,null,G(f.value,(e,t)=>(q(),J(`li`,{key:`${e.name}:${e.startLine}`,class:z([`outline-row`,{selected:t===s.value}]),title:e.parent?`${e.name} in ${e.parent}`:e.name,role:`option`,"aria-selected":t===s.value,onMousemove:e=>s.value=t,onClick:t=>p(e)},[Y(`span`,Jx,B(e.kind),1),Y(`span`,Yx,B(e.name),1),e.parent?(q(),J(`span`,Xx,`in `+B(e.parent),1)):Q(``,!0),Y(`span`,Zx,B(e.startLine),1)],42,qx))),128))]))],64))],512)):Q(``,!0)}}),[[`__scopeId`,`data-v-6a76fb9b`]]),$x={class:`tree-col`},eS={class:`tree-toolbar`,role:`toolbar`,"aria-label":`Explorer filters`},tS=[`aria-pressed`,`title`],nS=[`aria-pressed`,`title`],rS=[`aria-pressed`,`title`],iS=[`disabled`],aS={class:`tree-scroll`},oS={key:0,class:`panel-note`},sS={key:1,class:`panel-note view-error`,"data-testid":`tree-error`},cS={key:2,class:`panel-note`,"data-testid":`tree-empty`},lS=[`aria-level`,`aria-expanded`,`aria-selected`,`aria-busy`,`tabindex`,`title`,`onClick`,`onKeydown`],uS={class:`chevron`,"aria-hidden":`true`},dS={key:0,class:`changes-dot`,title:`Contains changes`},fS={key:1,class:`staged-dot`,title:`Staged`},pS={key:2,class:`status-letter`,"data-testid":`status-letter`},mS={key:4,class:`panel-note view-error`,"data-testid":`tree-error`},hS=ef(gr({__name:`ExplorerView`,setup(e){let t=sl(),n=Vl(),r=cl(),i=V(null);W(()=>n.outlineRequest,e=>{e!==0&&(i.value?.openPopover(),r.loadSymbols())});let{rows:a,rootLoading:o,error:s,showHidden:c,showIgnored:l,changedOnly:u,selectedPath:d,file:f,fileLoading:p,fileError:m}=Fs(r),h=V(null);async function g(){await r.ensureRoot()}async function _(e){await r.toggleDir(e)}async function v(e){await r.openFile(e)}jr(()=>{g()}),W(()=>t.repoId,()=>{g()});function y(e){b.value=e.entry.path,tu({view:`explorer`}),e.entry.type===`dir`?_(e.entry.path):v(e.entry.path)}let b=V(null),x=$(()=>{for(let e of[b.value,d.value]){if(e===null)continue;let t=a.value.findIndex(t=>t.entry.path===e);if(t!==-1)return t}return 0});function S(e){let t=a.value[e];t&&(b.value=t.entry.path,On(()=>{h.value?.querySelectorAll(`.tree-row`)[e]?.focus()}))}function C(e){return a.value.findIndex(t=>t.entry.path===e.entry.path)}function w(e,t){let n=C(e);n!==-1&&S(Math.min(a.value.length-1,Math.max(0,n+t)))}function T(e){if(e.entry.type!==`dir`)return;if(!e.isExpanded){_(e.entry.path);return}let t=C(e);if(t===-1)return;let n=a.value[t+1];n&&n.depth>e.depth&&S(t+1)}function E(e){if(e.entry.type===`dir`&&e.isExpanded){r.collapseDir(e.entry.path);return}let t=e.entry.path;for(let e=t.lastIndexOf(`/`);e!==-1;e=t.lastIndexOf(`/`)){t=t.slice(0,e);let n=a.value.findIndex(e=>e.entry.path===t);if(n!==-1){S(n);return}}}W(()=>a.value,()=>{let e=h.value?.contains(document.activeElement)??!1;On(()=>{let t=h.value;if(!e||!t||t.contains(document.activeElement))return;let n=x.value,r=a.value[n];r&&(b.value=r.entry.path,t.querySelectorAll(`.tree-row`)[n]?.focus())})}),W(d,()=>{On(()=>{h.value?.querySelector(`.tree-row.selected`)?.scrollIntoView({block:`nearest`})})});function D(e){return e.entry.gitStatus?`st-${e.entry.gitStatus}`:null}let O=gu(),k=V(null),A=zm({container:k,isRow:O,row:{pref:`explorerTop`,defaultRatio:.34,min:kl,max:Al}}),j=V(null),M=Um(O,j,`File content`),N=Vm(O,(e,t)=>w(t,e));return(e,t)=>(q(),J(`div`,{ref_key:`containerEl`,ref:k,class:z([`explorer`,{portrait:U(O)}]),style:le(U(O)?{"--explorer-top":`${(U(A).rowRatio.value*100).toFixed(2)}%`}:void 0)},[Y(`aside`,$x,[(q(),ga(lr,{defer:``,to:`#view-toolbar-slot`,disabled:!U(O)},[Y(`div`,eS,[Y(`button`,{class:`tool-toggle mono`,"data-testid":`toggle-hidden`,"aria-pressed":U(c),title:U(c)?`Dotfiles are shown. Click to hide them`:`Dotfiles are hidden. Click to show them`,onClick:t[0]||=e=>U(r).setShowHidden(!U(c))},` dotfiles `,8,tS),Y(`button`,{class:`tool-toggle mono`,"data-testid":`toggle-ignored`,"aria-pressed":U(l),title:U(l)?`Gitignored files are shown. Click to hide them`:`Gitignored files are hidden. Click to show them`,onClick:t[1]||=e=>U(r).setShowIgnored(!U(l))},` ignored `,8,nS),Y(`button`,{class:`tool-toggle mono`,"data-testid":`toggle-changed`,"aria-pressed":U(u),title:U(u)?`Showing only files with changes. Click to show every file`:`Showing every file. Click to show only files with changes`,onClick:t[2]||=e=>U(r).setChangedOnly(!U(u))},` changed `,8,rS),Y(`button`,{class:`tool-refresh mono`,"data-testid":`tree-refresh`,"aria-label":`Reload the tree`,title:`Reload the tree`,disabled:U(o),onClick:t[3]||=e=>U(r).refresh()},` ↻ `,8,iS)])],8,[`disabled`])),Y(`div`,aS,[U(o)&&U(a).length===0?(q(),J(`p`,oS,`Loading tree…`)):U(s)&&U(a).length===0?(q(),J(`p`,sS,B(U(s)),1)):U(a).length===0?(q(),J(`p`,cS,B(U(u)?`No changed files.`:`Empty repository.`),1)):(q(),J(`div`,{key:3,ref_key:`treeEl`,ref:h,class:`tree mono`,role:`tree`,"aria-label":`Repository files`},[(q(!0),J(K,null,G(U(a),(e,n)=>(q(),J(K,{key:e.entry.path},[Y(`div`,{class:z([`tree-row list-row`,[D(e),{selected:e.entry.path===U(d)}]]),role:`treeitem`,"aria-level":e.depth+1,"aria-expanded":e.entry.type===`dir`?e.isExpanded:void 0,"aria-selected":e.entry.path===U(d),"aria-busy":e.isLoading||void 0,tabindex:n===x.value?0:-1,title:e.entry.path,onClick:t=>y(e),onKeydown:[Xo(Jo(t=>w(e,1),[`prevent`]),[`down`]),Xo(Jo(t=>w(e,-1),[`prevent`]),[`up`]),Xo(Jo(t=>T(e),[`prevent`]),[`right`]),Xo(Jo(t=>E(e),[`prevent`]),[`left`]),Xo(Jo(t=>y(e),[`prevent`]),[`enter`]),Xo(Jo(t=>y(e),[`prevent`]),[`space`]),t[4]||=Xo(Jo(e=>S(0),[`prevent`]),[`home`]),t[5]||=Xo(Jo(e=>S(U(a).length-1),[`prevent`]),[`end`]),t=>U(N)(t,e)]},[(q(!0),J(K,null,G(e.depth,e=>(q(),J(`span`,{key:e,class:`guide`,"aria-hidden":`true`}))),128)),Y(`span`,uS,B(e.entry.type===`dir`?e.isExpanded?`▾`:`▸`:``),1),Y(`span`,{class:z([`name`,{dir:e.entry.type===`dir`}])},B(e.displayName),3),e.entry.type===`dir`&&e.entry.hasChanges?(q(),J(`span`,dS,`●`)):Q(``,!0),e.entry.type===`file`&&e.entry.staged?(q(),J(`span`,fS,`●`)):Q(``,!0),e.entry.type===`file`&&e.entry.gitStatus?(q(),J(`span`,pS,B(U(ql)(e.entry.gitStatus)),1)):Q(``,!0)],42,lS),e.isExpanded&&e.isLoading?(q(),J(`div`,{key:0,class:`tree-loading mono`,role:`presentation`,"data-testid":`dir-loading`,style:le({paddingLeft:`${(e.depth+1)*1.25+1.75}ch`})},` Loading… `,4)):Q(``,!0)],64))),128))],512)),U(s)&&U(a).length>0?(q(),J(`p`,mS,B(U(s)),1)):Q(``,!0)])]),U(O)?(q(),ga(Pv,{key:0,split:U(A),label:`Resize file tree`},null,8,[`split`])):Q(``,!0),Y(`section`,Oa({ref_key:`payloadEl`,ref:j,class:`content-col`},U(M)),[X(Qx,{ref_key:`outlineEl`,ref:i},null,512),X(Rx,{path:U(d),file:U(f),loading:U(p),error:U(m),wrap:U(n).wrapEnabled},null,8,[`path`,`file`,`loading`,`error`,`wrap`])],16)],6))}}),[[`__scopeId`,`data-v-48316821`]]),gS={class:`shell`},_S={class:`workspace`},vS=3e3,yS=1500,bS=ef(gr({__name:`App`,setup(e){let t=ic(),n=cl(),r=sl(),i=Vl();_u();let{activate:a,openByPath:o}=Hl();i.init(),su(),cu(),pu();let s={changes:ey,journal:Dy,history:_b,compare:ux,explorer:hS},c=$(()=>s[i.activeView]),l=$(()=>t.activeRepoId!==null);jr(()=>{t.connect()});let u=()=>{r.releaseOnUnload()};jr(()=>{window.addEventListener(`pagehide`,u)}),Fr(()=>{window.removeEventListener(`pagehide`,u)});let d=!0,f=null;function p(){d=!1,f!==null&&(clearTimeout(f),f=null)}function m(e){t.activeRepoId===null&&e.length!==0&&a(e[0])}let h=nu({onRestore:_}),g=V(null);async function _(e,n){if(e.view===null&&e.repo===null)return;e.repo!==null&&t.suspendFollowNavigation(yS);let r=t.activeRepoId===null;r&&e.view!==null&&i.setActiveView(e.view),(await y(e,n)||v(e,n))&&(!r&&e.view!==null&&i.setActiveView(e.view),e.view!==null&&await b(e,n))}function v(e,t){return!t.isStale()&&e.repo!==null&&r.repoId===null&&r.repoPath===h.toAbsolute(e.repo)}async function y(e,t){return e.repo===null||h.isActiveRepo(e.repo)?!0:(await h.whenHomeReady,t.isStale()||!await o(h.toAbsolute(e.repo))||t.isStale()?!1:(await On(),!t.isStale()))}async function b(e,t){switch(g.value=null,e.view){case`explorer`:e.at===null?n.clearSelection():e.at!==n.selectedPath&&await n.revealFile(e.at);return;case`history`:await S(e.at,e.whole,t);return;case`compare`:await C(e,t);return;case`changes`:x(e.at,e.whole);return;default:return}}function x(e,t=null){if(e===null){r.selectFile(null),i.setActiveStackKey(null),r.setWholeFile(null);return}let n=r.shared.status?.files;if(!n){g.value={view:`changes`,at:e,whole:t,repoPath:r.repoPath};return}let a=e.slice(e.indexOf(`:`)+1),o=n.find(t=>Qc(t)===e)??n.find(e=>e.path===a)??null;if(!o)return;r.selectFile(o);let s=Qc(o);i.setActiveStackKey(s),i.requestStackScroll(s),r.setWholeFile(t===o.path?{view:`changes`,key:s,path:o.path}:null)}async function S(e,t,n){if(e===null){await r.selectHistoryCommit(null),r.setWholeFile(null);return}let i=e=>{r.setWholeFile(t===null?null:{view:`history`,key:`h:${e}:${t}`,path:t,hash:e})};if(r.history.selectedCommit?.hash.startsWith(e)){i(r.history.selectedCommit.hash);return}let a=r.history.commits.find(t=>t.hash.startsWith(e));if(a){await r.selectHistoryCommit(a),i(a.hash);return}let o=await r.resolveCommit(e);o===null||n.isStale()||(await r.selectHistoryCommit(o),i(o.hash))}async function C(e,t){let n=e.base!==null&&e.base!==r.selectedCompareBase?e.base:void 0;if((n!==void 0||e.head!==r.selectedStackHead)&&(await r.setComparePick({base:n,head:e.head}),t.isStale()))return;if(e.at===null){r.setWholeFile(null);return}let a=r.compare.compareDiff?.files;if(!a){g.value={view:`compare`,at:e.at,whole:e.whole,repoPath:r.repoPath};return}let o=a.findIndex(t=>t.path===e.at);if(o===-1)return;r.selectCompareFile(o);let s=a[o];i.requestStackScroll($c(s)),r.setWholeFile(e.whole===s.path?{view:`compare`,key:$c(s),path:s.path,side:s.uncommitted}:null)}function w(e){return e.repoPath===r.repoPath||(g.value=null,!1)}return W(()=>r.shared.status,()=>{let e=g.value;e?.view===`changes`&&i.activeView===`changes`&&w(e)&&(g.value=null,x(e.at,e.whole??null))}),W(()=>r.compare.compareDiff,e=>{let t=g.value;if(t?.view!==`compare`||i.activeView!==`compare`||!e||!w(t))return;g.value=null;let n=e.files.findIndex(e=>e.path===t.at);if(n===-1)return;r.selectCompareFile(n);let a=e.files[n];i.requestStackScroll($c(a)),r.setWholeFile(t.whole===a.path?{view:`compare`,key:$c(a),path:a.path,side:a.uncommitted}:null)}),(h.initial.view!==null||h.initial.repo!==null)&&(h.initial.repo!==null&&(p(),t.skipInitialFollow=!0),h.restore(h.initial)),W([()=>t.repos,()=>t.follow],([e,n])=>{d&&(n===null?f===null&&e.length>0&&(f=setTimeout(()=>{f=null,d&&(p(),m(t.repos))},vS)):(p(),!(t.followEnabled&&n.followedRepoId!==null&&n.followedPath!==null)&&m(e)))}),Fr(()=>{f!==null&&clearTimeout(f)}),(e,n)=>(q(),J(`div`,gS,[X(Pf),X(Jf),X(Yf),Y(`main`,_S,[l.value?(q(),ga(Hr(c.value),{key:U(t).activeRepoId??``})):(q(),ga(sp,{key:0}))]),X(ip),U(i).activeOverlay===`finder`?(q(),ga(Sp,{key:0})):U(i).activeOverlay===`search`?(q(),ga(Ip,{key:1})):U(i).activeOverlay===`help`?(q(),ga(Kp,{key:2})):U(i).activeOverlay===`settings`?(q(),ga(Om,{key:3})):Q(``,!0)]))}}),[[`__scopeId`,`data-v-6c0b2faa`]]),xS={black:`#000000`,red:`#cd0000`,green:`#00cd00`,yellow:`#cdcd00`,blue:`#0000ee`,magenta:`#cd00cd`,cyan:`#00cdcd`,white:`#e5e5e5`,gray:`#7f7f7f`,grey:`#7f7f7f`,blackBright:`#7f7f7f`,redBright:`#ff0000`,greenBright:`#00ff00`,yellowBright:`#ffff00`,blueBright:`#5c5cff`,magentaBright:`#ff00ff`,cyanBright:`#00ffff`,whiteBright:`#ffffff`};function SS(e){if(e.startsWith(`#`))return e.toLowerCase();let t=xS[e];if(!t)throw Error(`unknown color name: ${e}`);return t}function CS(e){return[`--diff-add-bg: ${SS(e.addBg)};`,`--diff-del-bg: ${SS(e.delBg)};`,`--diff-add-highlight: ${SS(e.addHighlight)};`,`--diff-del-highlight: ${SS(e.delHighlight)};`,`--diff-text: ${SS(e.text)};`,`--diff-add-line-num: ${SS(e.addLineNum)};`,`--diff-del-line-num: ${SS(e.delLineNum)};`,`--diff-context-line-num: ${SS(e.contextLineNum)};`,`--diff-add-symbol: ${SS(e.addSymbol)};`,`--diff-del-symbol: ${SS(e.delSymbol)};`]}function wS(e){return[`--bg: ${e.bg};`,`--surface: ${e.surface};`,`--surface-raised: ${e.surfaceRaised};`,`--border: ${e.border};`,`--text: ${e.text};`,`--text-dim: ${e.textDim};`,`--accent: ${e.accent};`,`--selection: ${e.selection};`,`--add: ${e.add};`,`--del: ${e.del};`,`--warn: ${e.warn};`,`--status-modified: ${e.statusModified};`,`--status-added: ${e.statusAdded};`,`--status-deleted: ${e.statusDeleted};`,`--status-untracked: ${e.statusUntracked};`,`--status-renamed: ${e.statusRenamed};`,`--status-copied: ${e.statusCopied};`,`--status-conflicted: ${e.statusConflicted};`,`--uncommitted: ${e.uncommitted};`,`--flash: ${e.flash};`]}function TS(e){return[`--syn-keyword: ${e.keyword};`,`--syn-string: ${e.string};`,`--syn-comment: ${e.comment};`,`--syn-number: ${e.number};`,`--syn-literal: ${e.literal};`,`--syn-title: ${e.title};`,`--syn-attr: ${e.attr};`,`--syn-meta: ${e.meta};`]}function ES(e){let t=[`color-scheme: ${e.scheme};`,...wS(e.chrome),...CS(e.colors),...TS(e.syntax)];return`:root[data-theme='${e.name}'] {\n ${t.join(`
|
|
13
13
|
`)}\n}`}function DS(){return ul.map(e=>ES(fl[e])).join(`
|
|
14
14
|
|
|
15
15
|
`)+`
|