@pi-chamber/web 0.9.9-rc.3 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +70 -67
  2. package/dist/assets/{DiagramView-Dy4F1cil.js → DiagramView-CbSxUe1D.js} +1 -1
  3. package/dist/assets/{DiffView-C76KYB1I.js → DiffView-VyBf4ilo.js} +1 -1
  4. package/dist/assets/{FileSaveConflictDialog-C-TUbGz7.js → FileSaveConflictDialog-BCvbQ234.js} +1 -1
  5. package/dist/assets/{FilesView-D05cD0Vv.js → FilesView-DasA5EU2.js} +1 -1
  6. package/dist/assets/{GitView-BrSR7uJk.js → GitView-DU3mOECp.js} +3 -3
  7. package/dist/assets/{JsonTreeView-Ds6UD-nj.js → JsonTreeView-xZiWDwua.js} +1 -1
  8. package/dist/assets/{MarkdownRendererImpl-D_ClsZYB.js → MarkdownRendererImpl-BBwdI2OF.js} +2 -2
  9. package/dist/assets/{PatchDiff-DaZ-PTug.js → PatchDiff-BhKm_JPT.js} +1 -1
  10. package/dist/assets/{SessionSwitcherContent-FaYzgplj.js → SessionSwitcherContent-DTGSP_RB.js} +1 -1
  11. package/dist/assets/{SessionSwitcherDropdown-D_9pieby.js → SessionSwitcherDropdown-CedOB-xC.js} +2 -2
  12. package/dist/assets/{SessionUnreadDot-DGuqqVhb.js → SessionUnreadDot-CZSNKram.js} +1 -1
  13. package/dist/assets/SettingsView-B5nmu8x4.js +2 -0
  14. package/dist/assets/{SettingsWindow-Dpw6aF2F.js → SettingsWindow-y33YrpBE.js} +1 -1
  15. package/dist/assets/{ToolOutputDialog-CcbJkYYg.js → ToolOutputDialog-JqIXJWAH.js} +3 -3
  16. package/dist/assets/{ToolPartDiffPreview-C0c8f4Nt.js → ToolPartDiffPreview-CRi_33jE.js} +1 -1
  17. package/dist/assets/{VirtualizedFileDiff-BvU0E4qX.js → VirtualizedFileDiff-ehLQSR5W.js} +4 -4
  18. package/dist/assets/{collapsible-B6bVtxgp.js → collapsible-Vypq-nMP.js} +1 -1
  19. package/dist/assets/{computeVirtualFileMetrics-hWwF-t_o.js → computeVirtualFileMetrics-BTfrj_fR.js} +2 -2
  20. package/dist/assets/{contextFileOpenGuard-Y5Z8LQyY.js → contextFileOpenGuard-Dl6mFfD1.js} +1 -1
  21. package/dist/assets/{gitStatusPredicates-Dmaw5g31.js → gitStatusPredicates-LAsJAhCL.js} +1 -1
  22. package/dist/assets/{index-BXgR2dKM.css → index-BXX8l7mM.css} +1 -1
  23. package/dist/assets/{index-BOtRfXre.js → index-DvNeSFO9.js} +1 -1
  24. package/dist/assets/{index-CqdQEvR2.js → index-OveFsNBm.js} +1 -1
  25. package/dist/assets/{isDiffPlainText-C1dRfEBh.js → isDiffPlainText-CNZohQ4q.js} +1 -1
  26. package/dist/assets/{isFilePlainText-wlC41gsX.js → isFilePlainText-Dz8UubRT.js} +1 -1
  27. package/dist/assets/{main-CkViwsz_.js → main-BsDkATRV.js} +3 -3
  28. package/dist/assets/{main-CfNlfHvj.js → main-C393Ywhx.js} +2 -2
  29. package/dist/assets/{markdownCore-Ci_ipXBM.js → markdownCore-Bz9-Y75q.js} +1 -1
  30. package/dist/assets/{miniChat-BFzjOj9l.js → miniChat-CWEerp3c.js} +2 -2
  31. package/dist/assets/{mobile-D4xKl_yN.js → mobile-YxV9KcxF.js} +2 -2
  32. package/dist/assets/{renderElectronMiniChatApp-BQBx6mC4.js → renderElectronMiniChatApp-GrLmBQRb.js} +2 -2
  33. package/dist/assets/{renderMobileApp-D1Q-yGOv.js → renderMobileApp-C29wquBe.js} +3 -3
  34. package/dist/assets/{runtimeEndpointReset-Co9SkOQC.js → runtimeEndpointReset-DHARMv9w.js} +14 -14
  35. package/dist/assets/{runtimeSurface-CPm7KWaN.js → runtimeSurface-DUXw4-oa.js} +1 -1
  36. package/dist/assets/{useAppFontEffects-D00QsL7D.js → useAppFontEffects-ad-lZJ6o.js} +86 -86
  37. package/dist/assets/{useFilesViewSearch-BsC82OOk.js → useFilesViewSearch-C4oOHPml.js} +1 -1
  38. package/dist/assets/{usePushVisibilityBeacon-Pg0Sln_M.js → usePushVisibilityBeacon-xd8Q10cI.js} +1 -1
  39. package/dist/assets/{useSwitcherItems-BXn8MrAT.js → useSwitcherItems-B6VC7tug.js} +1 -1
  40. package/dist/assets/{vendor-codemirror-language-data-DhJ96dYN.js → vendor-codemirror-language-data-B4j3gkaT.js} +2 -2
  41. package/dist/assets/{web-components-Bb-NxfNy.js → web-components-B0RFakat.js} +3 -3
  42. package/dist/index.html +4 -4
  43. package/dist/mini-chat.html +3 -3
  44. package/dist/mobile.html +3 -3
  45. package/package.json +1 -1
  46. package/dist/assets/SettingsView-C-YJztlm.js +0 -2
@@ -1,4 +1,4 @@
1
- import{R as Q,j as o,r as v}from"./vendor-react-B5Z1Mdn3.js";import{a1 as fe,a4 as ge,I as pe,a6 as me,dj as ve,dk as N,aQ as be,ae as ye}from"./useAppFontEffects-D00QsL7D.js";import{B as we}from"./web-components-Bb-NxfNy.js";import{f as ee}from"./computeVirtualFileMetrics-hWwF-t_o.js";import{V as xe,F as Re}from"./VirtualizedFileDiff-BvU0E4qX.js";import{aq as Se}from"./runtimeEndpointReset-Co9SkOQC.js";import{ensurePierreThemeRegistered as te,getResolvedShikiTheme as ne}from"./appThemeRegistry-gegrE2dq.js";import{Z as ie,o as re}from"./index-BOtRfXre.js";const G=new Set;let X=null;function E(r){G.add(r),X??=requestAnimationFrame(ce)}function ce(r){const e=new Set(G);G.clear();for(const t of e)try{t(r)}catch(n){console.error(n)}G.size>0?X=requestAnimationFrame(ce):X=null}function se({scrollTop:r,scrollHeight:e,height:t,fitPerfectly:n=!1,fitPerfectlyOverscroll:i=0,overscrollSize:s}){const a=t+s*2,d=n?t+i*2:a;if(e=Math.max(e,d),a>=e||n){const f=Math.max(r-i,0),p=Math.min(r+d,e);return{top:f,bottom:Math.max(p,f)}}let l=r+t/2-a/2,u=l+a;return l<0&&(l=0),u>e&&(u=e),l=Math.floor(Math.max(l,0)),{top:l,bottom:Math.ceil(Math.max(Math.min(u,e),l))}}function ke(r,e){return r==null||e==null?r===e:r.top===e.top&&r.bottom===e.bottom}const de=1e3,Ee=de*4,Te=[0,1e-6,.99999,1],Oe={overscrollSize:de,intersectionObserverMargin:Ee,resizeDebugging:!1};let $=0,ze=-1;var Ce=class z{static __STOP=!1;static __lastScrollPosition=0;__id=`virtualizer-${++ze}`;config;type="simple";intersectionObserver;scrollTop=0;height=0;scrollHeight=0;windowSpecs={top:0,bottom:0};root;contentContainer;resizeObserver;observers=new Map;visibleInstances=new Map;visibleInstancesDirty=!1;instancesChanged=new Set;scrollDirty=!0;heightDirty=!0;scrollHeightDirty=!0;renderedObservers=0;connectQueue=new Map;constructor(e){this.config={...Oe,...e}}setup(e,t){if(this.root==null){this.root=e,this.resizeObserver=new ResizeObserver(this.handleContainerResize),this.intersectionObserver=new IntersectionObserver(this.handleIntersectionChange,{root:this.root,threshold:Te,rootMargin:`${this.config.intersectionObserverMargin}px 0px ${this.config.intersectionObserverMargin}px 0px`}),e instanceof Document?this.setupWindow():this.setupElement(t),window.__INSTANCE=this,window.__TOGGLE=()=>{z.__STOP?(z.__STOP=!1,(this.getScrollContainerElement()??window).scrollTo({top:z.__lastScrollPosition}),E(this.computeRenderRangeAndEmit)):(z.__lastScrollPosition=this.getScrollTop(),z.__STOP=!0)};for(const[n,i]of this.connectQueue.entries())this.connect(n,i);this.connectQueue.clear(),this.markDOMDirty(),E(this.computeRenderRangeAndEmit)}}instanceChanged(e,t){this.instancesChanged.add(e),t&&this.markDOMDirty(),E(this.computeRenderRangeAndEmit)}getWindowSpecs(){return this.windowSpecs.top===0&&this.windowSpecs.bottom===0&&(this.windowSpecs=se({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize})),this.windowSpecs}isInstanceVisible(e,t){const n=this.getScrollTop(),i=this.getHeight(),s=this.config.intersectionObserverMargin,a=n-s,d=n+i+s;return!(e<a-t||e>d)}handleContainerResize=e=>{if(this.root==null)return;let t=!1;for(const n of e){const i=n.borderBoxSize[0].blockSize;this.root instanceof Document?i!==this.scrollHeight&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(console.log("Virtualizer: content size change",this.__id,{sizeChange:i-$,newSize:i}),$=i)):n.target===this.root?i!==this.height&&(this.heightDirty=!0,t=!0):n.target===this.contentContainer&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(console.log("Virtualizer: scroller size change",this.__id,{sizeChange:i-$,newSize:i}),$=i))}t&&E(this.computeRenderRangeAndEmit)};setupWindow(){if(this.root==null||!(this.root instanceof Document))throw new Error("Virtualizer.setupWindow: Invalid setup method");window.addEventListener("scroll",this.handleWindowScroll,{passive:!0}),window.addEventListener("resize",this.handleWindowResize,{passive:!0}),this.resizeObserver?.observe(this.root.documentElement)}setupElement(e){if(this.root==null||this.root instanceof Document)throw new Error("Virtualizer.setupElement: Invalid setup method");this.root.addEventListener("scroll",this.handleElementScroll,{passive:!0}),this.resizeObserver?.observe(this.root),e??=this.root.firstElementChild??void 0,e instanceof HTMLElement&&(this.contentContainer=e,this.resizeObserver?.observe(e))}cleanUp(){this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.intersectionObserver?.disconnect(),this.intersectionObserver=void 0,this.root?.removeEventListener("scroll",this.handleElementScroll),window.removeEventListener("scroll",this.handleWindowScroll),window.removeEventListener("resize",this.handleWindowResize),this.root=void 0,this.contentContainer=void 0,this.observers.clear(),this.visibleInstances.clear(),this.instancesChanged.clear(),this.connectQueue.clear(),this.visibleInstancesDirty=!1,this.windowSpecs={top:0,bottom:0},this.scrollTop=0,this.height=0,this.scrollHeight=0}getOffsetInScrollContainer(e){return this.getScrollTop()+V(e,this.getScrollContainerElement())}connect(e,t){if(this.observers.has(e))throw new Error("Virtualizer.connect: instance is already connected...");return this.intersectionObserver==null?this.connectQueue.set(e,t):(this.intersectionObserver.observe(e),this.observers.set(e,t),this.instancesChanged.add(t),this.markDOMDirty(),E(this.computeRenderRangeAndEmit)),()=>this.disconnect(e)}disconnect(e){const t=this.observers.get(e);this.connectQueue.delete(e),t!=null&&(this.intersectionObserver?.unobserve(e),this.observers.delete(e),this.visibleInstances.delete(e)&&(this.visibleInstancesDirty=!0),this.markDOMDirty(),E(this.computeRenderRangeAndEmit))}handleWindowResize=()=>{z.__STOP||window.innerHeight===this.height||(this.heightDirty=!0,E(this.computeRenderRangeAndEmit))};handleWindowScroll=()=>{z.__STOP||this.root==null||!(this.root instanceof Document)||(this.scrollDirty=!0,E(this.computeRenderRangeAndEmit))};handleElementScroll=()=>{z.__STOP||this.root==null||this.root instanceof Document||(this.scrollDirty=!0,E(this.computeRenderRangeAndEmit))};computeRenderRangeAndEmit=()=>{if(z.__STOP)return;const e=this.heightDirty||this.scrollHeightDirty;if(!this.scrollDirty&&!this.scrollHeightDirty&&!this.heightDirty&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty&&this.instancesChanged.size===0)return;let t=this.instancesChanged.size>0;if(this.instancesChanged.size===0){const s=se({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize});if(!e&&ke(this.windowSpecs,s)&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty)return;this.windowSpecs=s}this.visibleInstancesDirty=!1,this.renderedObservers=this.observers.size;const n=this.getScrollAnchor(this.height),i=new Set;for(const s of e?this.observers.values():this.visibleInstances.values())s.onRender(e)&&i.add(s);for(const s of this.instancesChanged)i.has(s)||s.onRender(e)&&i.add(s);this.scrollFix(n);for(const s of i)s.reconcileHeights();t||=this.instancesChanged.size>0,t&&this.markDOMDirty(),(t||e)&&E(this.computeRenderRangeAndEmit),i.clear(),this.instancesChanged.clear()};scrollFix(e){if(e==null)return;const t=this.getScrollContainerElement(),{lineIndex:n,lineOffset:i,fileElement:s,fileOffset:a,fileTypeOffset:d}=e;if(n!=null&&i!=null){const u=s.shadowRoot?.querySelector(`[data-line][data-line-index="${n}"]`);if(u instanceof HTMLElement){const f=V(u,t);if(f!==i){const p=f-i;this.applyScrollFix(p)}return}}const l=V(s,t);if(d==="top")l!==a&&this.applyScrollFix(l-a);else{const u=l+s.getBoundingClientRect().height;u!==a&&this.applyScrollFix(u-a)}}applyScrollFix(e){this.root==null||this.root instanceof Document?window.scrollTo({top:window.scrollY+e,behavior:"instant"}):this.root.scrollTo({top:this.root.scrollTop+e,behavior:"instant"}),this.markDOMDirty()}getScrollAnchor(e){const t=this.getScrollContainerElement();let n;for(const[i]of this.visibleInstances.entries()){const s=V(i,t),a=s+i.offsetHeight;let d,l;a<=0?(d=a,l="bottom"):(d=s,l="top");let u,f;if(a>0&&s<e)for(const k of i.shadowRoot?.querySelectorAll("[data-line][data-line-index]")??[]){if(!(k instanceof HTMLElement))continue;const T=k.dataset.lineIndex;if(T==null)continue;const w=V(k,t);if(!(w<0)){u=T,f=w;break}}if(n?.lineOffset!=null&&f==null)continue;let p=!1;(n==null||f!=null&&(n.lineOffset==null||f<n.lineOffset)||f==null&&n.lineOffset==null&&(d>=0&&(n.fileOffset<0||d<n.fileOffset)||d<0&&n.fileOffset<0&&d>n.fileOffset))&&(p=!0),p&&(n={fileElement:i,fileTypeOffset:l,fileOffset:d,lineIndex:u,lineOffset:f})}return n}handleIntersectionChange=e=>{this.scrollDirty=!0;for(const{target:t,isIntersecting:n}of e){if(!(t instanceof HTMLElement))throw new Error("Virtualizer.handleIntersectionChange: target not an HTMLElement");const i=this.observers.get(t);i!=null&&(n&&!this.visibleInstances.has(t)?(i.setVisibility(!0),this.visibleInstances.set(t,i),this.visibleInstancesDirty=!0):!n&&this.visibleInstances.has(t)&&(i.setVisibility(!1),this.visibleInstances.delete(t),this.visibleInstancesDirty=!0))}this.visibleInstancesDirty&&E(this.computeRenderRangeAndEmit)};getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let e=this.root==null?0:this.root instanceof Document?window.scrollY:this.root.scrollTop;return e=Math.max(0,Math.min(e,this.getScrollHeight()-this.getHeight())),this.scrollTop=e,e}getScrollHeight(){return this.scrollHeightDirty?(this.scrollHeightDirty=!1,this.scrollHeight=this.root==null?0:this.root instanceof Document?this.root.documentElement.scrollHeight:this.root.scrollHeight,this.scrollHeight):this.scrollHeight}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=this.root==null?0:this.root instanceof Document?globalThis.innerHeight:this.root.getBoundingClientRect().height,this.height):this.height}markDOMDirty(){this.scrollDirty=!0,this.scrollHeightDirty=!0,this.heightDirty=!0}getScrollContainerElement(){return this.root==null||this.root instanceof Document?void 0:this.root}};function V(r,e){const t=r.getBoundingClientRect(),n=e?.getBoundingClientRect().top??0;return t.top-n}const Ye=Q.memo(function({scope:e,isGitRepo:t,branchAvailable:n,allCount:i,workingCount:s,stagedCount:a,turnCount:d,branchCount:l,onScopeChange:u}){const[f,p]=Q.useState(!1),k=e==="all"?i:e==="staged"?a:e==="turn"?d:e==="branch"?l:s,T=e==="staged"?"Staged":e==="turn"?"Last turn":e==="branch"?"Branch":e==="all"?"All":"Changed";return o.jsxs(fe,{open:f,onOpenChange:p,children:[o.jsx(ge,{asChild:!0,children:o.jsxs("button",{type:"button",className:"flex h-7 flex-shrink-0 items-center gap-1.5 rounded-md px-2 typography-ui-label font-semibold text-foreground outline-none hover:bg-interactive-hover focus-visible:ring-2 focus-visible:ring-ring","aria-label":"Select change mode",children:[o.jsxs("span",{className:"whitespace-nowrap",children:[T,o.jsxs("span",{className:"diff-toolbar__scope-count",children:[": ",k]})]}),o.jsx(pe,{name:"arrow-down-s",className:"size-4 flex-shrink-0 opacity-60"})]})}),o.jsx(me,{align:"start",className:"w-40",children:o.jsxs(ve,{value:e,onValueChange:w=>{(w==="all"||w==="working"||w==="staged"||w==="turn"||w==="branch")&&(u?.(w),p(!1))},children:[t!==!1?o.jsx(N,{value:"all",children:o.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[o.jsx("span",{children:"All"}),o.jsx("span",{className:"typography-meta text-muted-foreground",children:i})]})}):null,t!==!1?o.jsx(N,{value:"working",children:o.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[o.jsx("span",{children:"Changed"}),o.jsx("span",{className:"typography-meta text-muted-foreground",children:s})]})}):null,t!==!1?o.jsx(N,{value:"staged",children:o.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[o.jsx("span",{children:"Staged"}),o.jsx("span",{className:"typography-meta text-muted-foreground",children:a})]})}):null,o.jsx(N,{value:"turn",children:o.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[o.jsx("span",{children:"Last turn"}),o.jsx("span",{className:"typography-meta text-muted-foreground",children:d})]})}),n?o.jsx(N,{value:"branch",children:o.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[o.jsx("span",{children:"Branch"}),o.jsx("span",{className:"typography-meta text-muted-foreground",children:l})]})}):null]})})]})}),oe=5e5,De=`
1
+ import{R as Q,j as o,r as v}from"./vendor-react-B5Z1Mdn3.js";import{a2 as fe,a5 as ge,I as pe,a7 as me,dk as ve,dl as N,aR as be,af as ye}from"./useAppFontEffects-ad-lZJ6o.js";import{B as we}from"./web-components-B0RFakat.js";import{f as ee}from"./computeVirtualFileMetrics-BTfrj_fR.js";import{V as xe,F as Re}from"./VirtualizedFileDiff-ehLQSR5W.js";import{ap as Se}from"./runtimeEndpointReset-DHARMv9w.js";import{ensurePierreThemeRegistered as te,getResolvedShikiTheme as ne}from"./appThemeRegistry-gegrE2dq.js";import{Z as ie,o as re}from"./index-DvNeSFO9.js";const G=new Set;let X=null;function E(r){G.add(r),X??=requestAnimationFrame(ce)}function ce(r){const e=new Set(G);G.clear();for(const t of e)try{t(r)}catch(n){console.error(n)}G.size>0?X=requestAnimationFrame(ce):X=null}function se({scrollTop:r,scrollHeight:e,height:t,fitPerfectly:n=!1,fitPerfectlyOverscroll:i=0,overscrollSize:s}){const a=t+s*2,d=n?t+i*2:a;if(e=Math.max(e,d),a>=e||n){const f=Math.max(r-i,0),p=Math.min(r+d,e);return{top:f,bottom:Math.max(p,f)}}let l=r+t/2-a/2,u=l+a;return l<0&&(l=0),u>e&&(u=e),l=Math.floor(Math.max(l,0)),{top:l,bottom:Math.ceil(Math.max(Math.min(u,e),l))}}function ke(r,e){return r==null||e==null?r===e:r.top===e.top&&r.bottom===e.bottom}const de=1e3,Ee=de*4,Te=[0,1e-6,.99999,1],Oe={overscrollSize:de,intersectionObserverMargin:Ee,resizeDebugging:!1};let $=0,ze=-1;var Ce=class z{static __STOP=!1;static __lastScrollPosition=0;__id=`virtualizer-${++ze}`;config;type="simple";intersectionObserver;scrollTop=0;height=0;scrollHeight=0;windowSpecs={top:0,bottom:0};root;contentContainer;resizeObserver;observers=new Map;visibleInstances=new Map;visibleInstancesDirty=!1;instancesChanged=new Set;scrollDirty=!0;heightDirty=!0;scrollHeightDirty=!0;renderedObservers=0;connectQueue=new Map;constructor(e){this.config={...Oe,...e}}setup(e,t){if(this.root==null){this.root=e,this.resizeObserver=new ResizeObserver(this.handleContainerResize),this.intersectionObserver=new IntersectionObserver(this.handleIntersectionChange,{root:this.root,threshold:Te,rootMargin:`${this.config.intersectionObserverMargin}px 0px ${this.config.intersectionObserverMargin}px 0px`}),e instanceof Document?this.setupWindow():this.setupElement(t),window.__INSTANCE=this,window.__TOGGLE=()=>{z.__STOP?(z.__STOP=!1,(this.getScrollContainerElement()??window).scrollTo({top:z.__lastScrollPosition}),E(this.computeRenderRangeAndEmit)):(z.__lastScrollPosition=this.getScrollTop(),z.__STOP=!0)};for(const[n,i]of this.connectQueue.entries())this.connect(n,i);this.connectQueue.clear(),this.markDOMDirty(),E(this.computeRenderRangeAndEmit)}}instanceChanged(e,t){this.instancesChanged.add(e),t&&this.markDOMDirty(),E(this.computeRenderRangeAndEmit)}getWindowSpecs(){return this.windowSpecs.top===0&&this.windowSpecs.bottom===0&&(this.windowSpecs=se({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize})),this.windowSpecs}isInstanceVisible(e,t){const n=this.getScrollTop(),i=this.getHeight(),s=this.config.intersectionObserverMargin,a=n-s,d=n+i+s;return!(e<a-t||e>d)}handleContainerResize=e=>{if(this.root==null)return;let t=!1;for(const n of e){const i=n.borderBoxSize[0].blockSize;this.root instanceof Document?i!==this.scrollHeight&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(console.log("Virtualizer: content size change",this.__id,{sizeChange:i-$,newSize:i}),$=i)):n.target===this.root?i!==this.height&&(this.heightDirty=!0,t=!0):n.target===this.contentContainer&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(console.log("Virtualizer: scroller size change",this.__id,{sizeChange:i-$,newSize:i}),$=i))}t&&E(this.computeRenderRangeAndEmit)};setupWindow(){if(this.root==null||!(this.root instanceof Document))throw new Error("Virtualizer.setupWindow: Invalid setup method");window.addEventListener("scroll",this.handleWindowScroll,{passive:!0}),window.addEventListener("resize",this.handleWindowResize,{passive:!0}),this.resizeObserver?.observe(this.root.documentElement)}setupElement(e){if(this.root==null||this.root instanceof Document)throw new Error("Virtualizer.setupElement: Invalid setup method");this.root.addEventListener("scroll",this.handleElementScroll,{passive:!0}),this.resizeObserver?.observe(this.root),e??=this.root.firstElementChild??void 0,e instanceof HTMLElement&&(this.contentContainer=e,this.resizeObserver?.observe(e))}cleanUp(){this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.intersectionObserver?.disconnect(),this.intersectionObserver=void 0,this.root?.removeEventListener("scroll",this.handleElementScroll),window.removeEventListener("scroll",this.handleWindowScroll),window.removeEventListener("resize",this.handleWindowResize),this.root=void 0,this.contentContainer=void 0,this.observers.clear(),this.visibleInstances.clear(),this.instancesChanged.clear(),this.connectQueue.clear(),this.visibleInstancesDirty=!1,this.windowSpecs={top:0,bottom:0},this.scrollTop=0,this.height=0,this.scrollHeight=0}getOffsetInScrollContainer(e){return this.getScrollTop()+V(e,this.getScrollContainerElement())}connect(e,t){if(this.observers.has(e))throw new Error("Virtualizer.connect: instance is already connected...");return this.intersectionObserver==null?this.connectQueue.set(e,t):(this.intersectionObserver.observe(e),this.observers.set(e,t),this.instancesChanged.add(t),this.markDOMDirty(),E(this.computeRenderRangeAndEmit)),()=>this.disconnect(e)}disconnect(e){const t=this.observers.get(e);this.connectQueue.delete(e),t!=null&&(this.intersectionObserver?.unobserve(e),this.observers.delete(e),this.visibleInstances.delete(e)&&(this.visibleInstancesDirty=!0),this.markDOMDirty(),E(this.computeRenderRangeAndEmit))}handleWindowResize=()=>{z.__STOP||window.innerHeight===this.height||(this.heightDirty=!0,E(this.computeRenderRangeAndEmit))};handleWindowScroll=()=>{z.__STOP||this.root==null||!(this.root instanceof Document)||(this.scrollDirty=!0,E(this.computeRenderRangeAndEmit))};handleElementScroll=()=>{z.__STOP||this.root==null||this.root instanceof Document||(this.scrollDirty=!0,E(this.computeRenderRangeAndEmit))};computeRenderRangeAndEmit=()=>{if(z.__STOP)return;const e=this.heightDirty||this.scrollHeightDirty;if(!this.scrollDirty&&!this.scrollHeightDirty&&!this.heightDirty&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty&&this.instancesChanged.size===0)return;let t=this.instancesChanged.size>0;if(this.instancesChanged.size===0){const s=se({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize});if(!e&&ke(this.windowSpecs,s)&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty)return;this.windowSpecs=s}this.visibleInstancesDirty=!1,this.renderedObservers=this.observers.size;const n=this.getScrollAnchor(this.height),i=new Set;for(const s of e?this.observers.values():this.visibleInstances.values())s.onRender(e)&&i.add(s);for(const s of this.instancesChanged)i.has(s)||s.onRender(e)&&i.add(s);this.scrollFix(n);for(const s of i)s.reconcileHeights();t||=this.instancesChanged.size>0,t&&this.markDOMDirty(),(t||e)&&E(this.computeRenderRangeAndEmit),i.clear(),this.instancesChanged.clear()};scrollFix(e){if(e==null)return;const t=this.getScrollContainerElement(),{lineIndex:n,lineOffset:i,fileElement:s,fileOffset:a,fileTypeOffset:d}=e;if(n!=null&&i!=null){const u=s.shadowRoot?.querySelector(`[data-line][data-line-index="${n}"]`);if(u instanceof HTMLElement){const f=V(u,t);if(f!==i){const p=f-i;this.applyScrollFix(p)}return}}const l=V(s,t);if(d==="top")l!==a&&this.applyScrollFix(l-a);else{const u=l+s.getBoundingClientRect().height;u!==a&&this.applyScrollFix(u-a)}}applyScrollFix(e){this.root==null||this.root instanceof Document?window.scrollTo({top:window.scrollY+e,behavior:"instant"}):this.root.scrollTo({top:this.root.scrollTop+e,behavior:"instant"}),this.markDOMDirty()}getScrollAnchor(e){const t=this.getScrollContainerElement();let n;for(const[i]of this.visibleInstances.entries()){const s=V(i,t),a=s+i.offsetHeight;let d,l;a<=0?(d=a,l="bottom"):(d=s,l="top");let u,f;if(a>0&&s<e)for(const k of i.shadowRoot?.querySelectorAll("[data-line][data-line-index]")??[]){if(!(k instanceof HTMLElement))continue;const T=k.dataset.lineIndex;if(T==null)continue;const w=V(k,t);if(!(w<0)){u=T,f=w;break}}if(n?.lineOffset!=null&&f==null)continue;let p=!1;(n==null||f!=null&&(n.lineOffset==null||f<n.lineOffset)||f==null&&n.lineOffset==null&&(d>=0&&(n.fileOffset<0||d<n.fileOffset)||d<0&&n.fileOffset<0&&d>n.fileOffset))&&(p=!0),p&&(n={fileElement:i,fileTypeOffset:l,fileOffset:d,lineIndex:u,lineOffset:f})}return n}handleIntersectionChange=e=>{this.scrollDirty=!0;for(const{target:t,isIntersecting:n}of e){if(!(t instanceof HTMLElement))throw new Error("Virtualizer.handleIntersectionChange: target not an HTMLElement");const i=this.observers.get(t);i!=null&&(n&&!this.visibleInstances.has(t)?(i.setVisibility(!0),this.visibleInstances.set(t,i),this.visibleInstancesDirty=!0):!n&&this.visibleInstances.has(t)&&(i.setVisibility(!1),this.visibleInstances.delete(t),this.visibleInstancesDirty=!0))}this.visibleInstancesDirty&&E(this.computeRenderRangeAndEmit)};getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let e=this.root==null?0:this.root instanceof Document?window.scrollY:this.root.scrollTop;return e=Math.max(0,Math.min(e,this.getScrollHeight()-this.getHeight())),this.scrollTop=e,e}getScrollHeight(){return this.scrollHeightDirty?(this.scrollHeightDirty=!1,this.scrollHeight=this.root==null?0:this.root instanceof Document?this.root.documentElement.scrollHeight:this.root.scrollHeight,this.scrollHeight):this.scrollHeight}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=this.root==null?0:this.root instanceof Document?globalThis.innerHeight:this.root.getBoundingClientRect().height,this.height):this.height}markDOMDirty(){this.scrollDirty=!0,this.scrollHeightDirty=!0,this.heightDirty=!0}getScrollContainerElement(){return this.root==null||this.root instanceof Document?void 0:this.root}};function V(r,e){const t=r.getBoundingClientRect(),n=e?.getBoundingClientRect().top??0;return t.top-n}const Ye=Q.memo(function({scope:e,isGitRepo:t,branchAvailable:n,allCount:i,workingCount:s,stagedCount:a,turnCount:d,branchCount:l,onScopeChange:u}){const[f,p]=Q.useState(!1),k=e==="all"?i:e==="staged"?a:e==="turn"?d:e==="branch"?l:s,T=e==="staged"?"Staged":e==="turn"?"Last turn":e==="branch"?"Branch":e==="all"?"All":"Changed";return o.jsxs(fe,{open:f,onOpenChange:p,children:[o.jsx(ge,{asChild:!0,children:o.jsxs("button",{type:"button",className:"flex h-7 flex-shrink-0 items-center gap-1.5 rounded-md px-2 typography-ui-label font-semibold text-foreground outline-none hover:bg-interactive-hover focus-visible:ring-2 focus-visible:ring-ring","aria-label":"Select change mode",children:[o.jsxs("span",{className:"whitespace-nowrap",children:[T,o.jsxs("span",{className:"diff-toolbar__scope-count",children:[": ",k]})]}),o.jsx(pe,{name:"arrow-down-s",className:"size-4 flex-shrink-0 opacity-60"})]})}),o.jsx(me,{align:"start",className:"w-40",children:o.jsxs(ve,{value:e,onValueChange:w=>{(w==="all"||w==="working"||w==="staged"||w==="turn"||w==="branch")&&(u?.(w),p(!1))},children:[t!==!1?o.jsx(N,{value:"all",children:o.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[o.jsx("span",{children:"All"}),o.jsx("span",{className:"typography-meta text-muted-foreground",children:i})]})}):null,t!==!1?o.jsx(N,{value:"working",children:o.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[o.jsx("span",{children:"Changed"}),o.jsx("span",{className:"typography-meta text-muted-foreground",children:s})]})}):null,t!==!1?o.jsx(N,{value:"staged",children:o.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[o.jsx("span",{children:"Staged"}),o.jsx("span",{className:"typography-meta text-muted-foreground",children:a})]})}):null,o.jsx(N,{value:"turn",children:o.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[o.jsx("span",{children:"Last turn"}),o.jsx("span",{className:"typography-meta text-muted-foreground",children:d})]})}),n?o.jsx(N,{value:"branch",children:o.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[o.jsx("span",{children:"Branch"}),o.jsx("span",{className:"typography-meta text-muted-foreground",children:l})]})}):null]})})]})}),oe=5e5,De=`
2
2
  :host {
3
3
  font-family: var(--font-mono);
4
4
  font-size: var(--text-code);