@pi-chamber/web 1.0.2-rc.1 → 1.0.3-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{DiagramView-GUJij-1P.js → DiagramView-CXjieF51.js} +1 -1
- package/dist/assets/DiffView-CXg8TAtI.js +18 -0
- package/dist/assets/{FileSaveConflictDialog-Ci6WdSiS.js → FileSaveConflictDialog-a-HOCgyP.js} +1 -1
- package/dist/assets/{FilesView-DBiWEo71.js → FilesView-Dcd9ltOX.js} +1 -1
- package/dist/assets/{GitView-DVyhqN5s.js → GitView-DF2nsuSA.js} +3 -3
- package/dist/assets/{JsonTreeView-BaU7aAUq.js → JsonTreeView-BRU2mRTd.js} +1 -1
- package/dist/assets/{MarkdownRendererImpl-6NBJLtEr.js → MarkdownRendererImpl-CeYMkg1A.js} +5 -5
- package/dist/assets/{PatchDiff-CvptevA2.js → PatchDiff-kSTpjhu6.js} +1 -1
- package/dist/assets/{SessionSwitcherContent-Cqp5FVCP.js → SessionSwitcherContent-BsXDFt24.js} +1 -1
- package/dist/assets/{SessionSwitcherDropdown-CRVJU16x.js → SessionSwitcherDropdown-D8fSObHr.js} +2 -2
- package/dist/assets/{SessionUnreadDot-CsFxImPI.js → SessionUnreadDot-BpsHyrri.js} +1 -1
- package/dist/assets/SettingsView-OEl7QmXC.js +6 -0
- package/dist/assets/{SettingsWindow-geMUhnxd.js → SettingsWindow-BMBCj_L_.js} +1 -1
- package/dist/assets/{ToolOutputDialog-BLGl2mNt.js → ToolOutputDialog-KOVdmTqm.js} +1 -1
- package/dist/assets/{ToolPartDiffPreview-BVeL1IuE.js → ToolPartDiffPreview-B9xuVvkm.js} +1 -1
- package/dist/assets/{VirtualizedFileDiff-9kAZ96se.js → VirtualizedFileDiff-CV_Cpmqu.js} +4 -4
- package/dist/assets/{collapsible-BencOwkW.js → collapsible-BH1vXEAI.js} +1 -1
- package/dist/assets/{computeVirtualFileMetrics-C8vH0vcM.js → computeVirtualFileMetrics-yHZbtf5H.js} +2 -2
- package/dist/assets/{contextFileOpenGuard-B6e3cTcl.js → contextFileOpenGuard-BA2pkQY_.js} +1 -1
- package/dist/assets/{gitStatusPredicates-B6w5GMNU.js → gitStatusPredicates-CpGQLvMK.js} +1 -1
- package/dist/assets/index-5fyXnZFi.css +1 -0
- package/dist/assets/{index-CpSdU-d4.js → index-C-sV_9sb.js} +3 -3
- package/dist/assets/{index-BifnX1Mp.js → index-D_FGGnQQ.js} +1 -1
- package/dist/assets/{isDiffPlainText-BepQ1JHv.js → isDiffPlainText-BNyusJZz.js} +1 -1
- package/dist/assets/{isFilePlainText-CA1KFaTm.js → isFilePlainText-CMAUe7qD.js} +1 -1
- package/dist/assets/{main-dhVDQIHu.js → main-BMLgZ5yn.js} +2 -2
- package/dist/assets/{main-TzeSIx1W.js → main-DNq1n9F_.js} +3 -3
- package/dist/assets/{markdownCore-BztwD2c9.js → markdownCore-CZWcaNr2.js} +2 -2
- package/dist/assets/{miniChat-smqdx0Y7.js → miniChat-B2AgUZqL.js} +2 -2
- package/dist/assets/{mobile-BV-WCEiE.js → mobile-BsGiRUUg.js} +2 -2
- package/dist/assets/{renderElectronMiniChatApp-DKmb9oa7.js → renderElectronMiniChatApp-UV9dnnbf.js} +2 -2
- package/dist/assets/renderMobileApp-BMifduGA.js +11 -0
- package/dist/assets/runtimeEndpointReset-CkvC02dQ.js +53 -0
- package/dist/assets/{runtimeSurface-Bm6cRkok.js → runtimeSurface-BdndJV2m.js} +1 -1
- package/dist/assets/{useAppFontEffects-Dq7xKVjh.js → useAppFontEffects-CclUs9KY.js} +98 -98
- package/dist/assets/{useFilesViewSearch-Bvlo7C3a.js → useFilesViewSearch-CI5Gy1cp.js} +1 -1
- package/dist/assets/{usePushVisibilityBeacon-BY4xtozp.js → usePushVisibilityBeacon-aDmGZrTW.js} +3 -3
- package/dist/assets/{useSwitcherItems-CkE242zK.js → useSwitcherItems-BZKyNjhp.js} +1 -1
- package/dist/assets/{vendor-codemirror-language-data-Bv6kN79m.js → vendor-codemirror-language-data-C6LBD7qA.js} +2 -2
- package/dist/assets/{web-components-CCiRgoOw.js → web-components-Cdnmh4Xb.js} +4 -4
- package/dist/index.html +4 -4
- package/dist/mini-chat.html +3 -3
- package/dist/mobile.html +3 -3
- package/package.json +1 -1
- package/server/lib/pi/model-config-store.js +146 -20
- package/server/lib/pi/model-config-store.test.js +153 -21
- package/server/lib/pi/routes.js +42 -1
- package/server/lib/pi/routes.test.js +104 -2
- package/server/lib/pi/session-daemon/DOCUMENTATION.md +3 -2
- package/server/lib/pi/session-daemon/session-daemon.js +322 -58
- package/server/lib/pi/session-daemon/session-daemon.test.js +335 -0
- package/server/lib/pi/session-daemon/session-failed-create-cleanup.test.js +372 -0
- package/server/lib/pi/session-persistence-gap.test.js +731 -0
- package/dist/assets/DiffView-BZ487Bhh.js +0 -18
- package/dist/assets/SettingsView-ppaIrPry.js +0 -2
- package/dist/assets/index-Dwz16owi.css +0 -1
- package/dist/assets/renderMobileApp-D3dtjeaE.js +0 -11
- package/dist/assets/runtimeEndpointReset-C1EENUlq.js +0 -53
|
@@ -1,4 +1,4 @@
|
|
|
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-Dq7xKVjh.js";import{B as we}from"./web-components-CCiRgoOw.js";import{f as ee}from"./computeVirtualFileMetrics-C8vH0vcM.js";import{V as xe,F as Re}from"./VirtualizedFileDiff-9kAZ96se.js";import{ap as Se}from"./runtimeEndpointReset-C1EENUlq.js";import{ensurePierreThemeRegistered as te,getResolvedShikiTheme as ne}from"./appThemeRegistry-gegrE2dq.js";import{Z as ie,o as re}from"./index-CpSdU-d4.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,dr as ve,ds as N,aR as be,af as ye}from"./useAppFontEffects-CclUs9KY.js";import{B as we}from"./web-components-Cdnmh4Xb.js";import{f as ee}from"./computeVirtualFileMetrics-yHZbtf5H.js";import{V as xe,F as Re}from"./VirtualizedFileDiff-CV_Cpmqu.js";import{ap as Se}from"./runtimeEndpointReset-CkvC02dQ.js";import{ensurePierreThemeRegistered as te,getResolvedShikiTheme as ne}from"./appThemeRegistry-gegrE2dq.js";import{Z as ie,o as re}from"./index-C-sV_9sb.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);
|