@p4code/cli 0.7.3 → 0.7.5
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/bin.mjs +94 -48
- package/dist/client/assets/DiffPanel-B-hI6AHg.js +98 -0
- package/dist/client/assets/FilePreviewPanel-Xz-EQJym.js +2230 -0
- package/dist/client/assets/P4DesignScreen-D6gkHJN-.css +1 -0
- package/dist/client/assets/P4DesignScreen-tmjJ1wBJ.js +19 -0
- package/dist/client/assets/PreviewPanel-D5E2Wr5f.js +2 -0
- package/dist/client/assets/PullRequestCodeTab-D67cgTHc.js +251 -0
- package/dist/client/assets/collapsible-rU_2mbwU.js +2 -0
- package/dist/client/assets/entities-CFKxsn8K.js +2 -0
- package/dist/client/assets/fileCommentAnnotations-DyvHntdJ.js +2 -0
- package/dist/client/assets/index-BQOf0qjc.js +3279 -0
- package/dist/client/assets/{index-XfE7ve8U.css → index-DQqa12Zh.css} +1 -1
- package/dist/client/assets/{renderFileChildren-B7uYxWA9.js → renderFileChildren-C91cUqQV.js} +2 -2
- package/dist/client/assets/textarea-BrbECJ8l.js +48 -0
- package/dist/client/assets/toggle-group-B7VPLYFz.js +2 -0
- package/dist/client/index.html +5 -5
- package/dist/{renderer-Dd2mDvu6.mjs → renderer-DZwr3Qmo.mjs} +2 -2
- package/dist/{runtime-Bv8fNDZe.mjs → runtime-DC_ewLnZ.mjs} +2 -2
- package/dist/{src-BLvXVs9y.mjs → src-DjTfFS-z.mjs} +29 -3
- package/package.json +1 -1
- package/dist/client/assets/DiffPanel-1TZXju6q.js +0 -98
- package/dist/client/assets/FilePreviewPanel-DGKHFQQ_.js +0 -2230
- package/dist/client/assets/P4DesignScreen-DIBwDYjN.js +0 -19
- package/dist/client/assets/P4DesignScreen-D_8l8WCl.css +0 -1
- package/dist/client/assets/PreviewPanel-B5bhhzbx.js +0 -2
- package/dist/client/assets/PullRequestCodeTab-ENp-K16o.js +0 -251
- package/dist/client/assets/entities-fvtdKO2-.js +0 -2
- package/dist/client/assets/fileCommentAnnotations-BPIepn3Q.js +0 -2
- package/dist/client/assets/index-B4Nxc2w0.js +0 -3265
- package/dist/client/assets/previewAssetResource-J1WeeXS-.js +0 -4
- package/dist/client/assets/textarea-CVN2-Kkx.js +0 -47
- package/dist/client/assets/toggle-group-Bs73JkcK.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{r as t}from"./preload-helper-CEhsl8MR.js";import{n,r,t as i}from"./compiler-runtime-CLAvuQ-D.js";import{Ma as a,Ms as o,Qs as s,Ui as c,Zo as l,es as u,ks as d}from"./textarea-BrbECJ8l.js";import"./entities-CFKxsn8K.js";import{n as f,t as p}from"./renderFileChildren-C91cUqQV.js";import{Cn as m,Dn as h,En as g,Fn as _,Ln as v,Mn as y,On as b,Pn as x,Rn as S,Sn as C,T as w,Tn as T,b as E,ht as D,jn as O,kn as k,mt as A,nt as j,rt as M,sr as ee,w as te,wn as N,wt as P,xn as F,y as ne}from"./index-BQOf0qjc.js";var I=s(`chevrons-down-up`,[[`path`,{d:`m7 20 5-5 5 5`,key:`13a0gw`}],[`path`,{d:`m7 4 5 5 5-5`,key:`1kwcof`}]]),L=s(`columns-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M12 3v18`,key:`108xh3`}]]),R=s(`rows-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M21 9H3`,key:`1338ky`}],[`path`,{d:`M21 15H3`,key:`9uk58r`}]]);function z(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function B(e,t){return e==null||t==null?e===t:e.header!==t.header||e.footer!==t.footer?!1:V(e.items,t.items)}function V(e,t){if(e==null||t==null)return e===t;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r==null||i==null||r.id!==i.id||r.type!==i.type||r.element!==i.element||r.instance!==i.instance||r.version!==i.version)return!1}return!0}function re(e,t,n){let r=document.createElement(`div`);return r.style.display=`flow-root`,e===`header`?(r.setAttribute(k,``),t.before(r)):(r.setAttribute(b,``),t.after(r)),n?.observe(r),r}function H(e){let t=window.devicePixelRatio??1;return Math.round(e*t)/t}var U=`theme.disableLineNumbers.overflow.themeType.disableFileHeader.disableVirtualizationBuffers.preferredHighlighter.useCSSClasses.useTokenTransformer.tokenizeMaxLineLength.tokenizeMaxLength.unsafeCSS.diffStyle.diffIndicators.disableBackground.expandUnchanged.loadDiffFiles.collapsedContextThreshold.lineDiffType.maxLineDiffLength.expansionLineCount.lineHoverHighlight.enableTokenInteractionsOnWhitespace.enableGutterUtility.__debugPointerEvents.enableLineSelection.controlledSelection.disableErrorHandling`.split(`.`),W=[`theme`,`disableLineNumbers`,`overflow`,`themeType`,`disableFileHeader`,`disableVirtualizationBuffers`,`preferredHighlighter`,`useCSSClasses`,`useTokenTransformer`,`tokenizeMaxLineLength`,`tokenizeMaxLength`,`unsafeCSS`,`lineHoverHighlight`,`enableTokenInteractionsOnWhitespace`,`enableGutterUtility`,`__debugPointerEvents`,`enableLineSelection`,`controlledSelection`,`disableErrorHandling`],ie=[`renderCustomHeader`,`renderHeaderPrefix`,`renderHeaderFilenameSuffix`,`renderHeaderMetadata`,`renderAnnotation`,`renderGutterUtility`,`onPostRender`,`onGutterUtilityClick`,`onLineClick`,`onLineNumberClick`,`onLineEnter`,`onLineLeave`,`onTokenClick`,`onTokenEnter`,`onTokenLeave`],ae=[`onLineSelected`,`onLineSelectionStart`,`onLineSelectionChange`,`onLineSelectionEnd`],oe=Symbol(`CodeView.itemOptionsState`);function G(e,t){Object.defineProperty(e,oe,{configurable:!1,enumerable:!1,value:t})}function K(e){return e[oe]}function q(e,t,n){Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get(){return n(this)}})}var se=120,ce=1,le=`--diffs-overflow-override`,J=12e6,ue=1e6,de=2e6,fe=J-de,pe=J-ue;function me(e){if(e==null)throw Error(`CodeView: createEditor is required for items with edit: true`)}var he=(()=>{let{navigator:e}=globalThis,t=e.userAgent,n=/iP(?:hone|ad|od)/.test(t),r=e.platform===`MacIntel`&&e.maxTouchPoints>1;return(n||r)&&/AppleWebKit/.test(t)&&/Safari/.test(t)&&!/(CriOS|FxiOS|EdgiOS|OPiOS)/.test(t)})(),ge=class e{static __STOP=!1;static __lastScrollPosition=0;type=`advanced`;config={overscrollSize:200,intersectionObserverMargin:0,resizeDebugging:!1};items=[];idToItem=new Map;selectedLines=null;itemEditors=new Map;attachedEditors=new Set;instanceToItem=new Map;layoutDirtyIndex;pendingLayoutReset;renderOptionsRevision=0;slotCoordinator;slotSnapshot;scrollListeners=new Set;scrollHeight=0;containerHeight=-1;scrollTop=0;scrollPageOffset=0;scrollDirty=!0;scrollInteractionFixTimer;pointerEventsDisabled=!1;codeOverflowFix=!1;height=0;heightDirty=!0;windowSpecs={top:0,bottom:0};renderState={scrollTop:-1,firstIndex:-1,lastIndex:-1,stickyHeight:0,stickyTop:-1,stickyBottom:-1};itemMetricsCache=O;fileOptionsPrototype;diffOptionsPrototype;pendingScrollTarget;pendingLayoutAnchor;shouldFixContainerFocus=!1;scrollAnimation;root;resizeObserver;container=document.createElement(`div`);stickyContainer=document.createElement(`div`);stickyOffset=document.createElement(`div`);header={element:void 0,render:void 0,height:0};footer={element:void 0,render:void 0,height:0};elementPool=[];elementPoolVersion=0;elementPoolTracker=new WeakMap;pendingElementPool=[];options;workerManager;isReadySubscription;isContainerManaged;constructor(e={theme:_},t,n=!1){this.options=e,this.computeMetricsCache(e.itemMetrics),this.fileOptionsPrototype=this.createFileOptionsPrototype(),this.diffOptionsPrototype=this.createDiffOptionsPrototype(),this.workerManager=t,this.isContainerManaged=n,this.stickyOffset.style.contain=`layout size`,this.stickyContainer.style.position=`sticky`,this.stickyContainer.style.width=`100%`,this.stickyContainer.style.contain=`layout style inline-size`,this.stickyContainer.style.isolation=`isolate`,this.stickyContainer.style.display=`flex`,this.stickyContainer.style.flexDirection=`column`}getLayout(){return this.options.layout??y}getItemTopOffset(){return this.getLayout().paddingTop+this.header.height}computeMetricsCache(e){return this.itemMetricsCache={hunkLineCount:e?.hunkLineCount??O.hunkLineCount,lineHeight:e?.lineHeight??O.lineHeight,diffHeaderHeight:e?.diffHeaderHeight??O.diffHeaderHeight,hunkSeparatorHeight:e?.hunkSeparatorHeight,spacing:e?.spacing??O.spacing,paddingTop:e?.paddingTop,paddingBottom:e?.paddingBottom},this.itemMetricsCache}getSmoothScrollSettings(){return this.options.smoothScrollSettings??x}shouldDisablePointerEvents(){return this.options.pointerEventsOnScroll!==!0}shouldValidateItemHeights(){return v&&this.options.__devOnlyValidateItemHeights===!0}validateRenderedItemHeight(e){if(!this.shouldValidateItemHeights()||e.element==null)return;let t=e.instance.getAdvancedStickySpecs();if(t==null)return;let n=t.height,r=e.element.getBoundingClientRect().height;n!==r&&console.error(`CodeView: reconciled item height does not match DOM height`,{id:e.item.id,type:e.type,index:e.index,version:e.version,expectedHeight:n,actualHeight:r,delta:r-n,stickyTopOffset:t.topOffset,virtualizedHeight:e.instance.getVirtualizedHeight(),top:e.top,scrollTop:this.getScrollTop(),windowSpecs:{...this.windowSpecs},element:e.element,instance:e.instance})}validateStickyContainerHeight(){if(!this.shouldValidateItemHeights())return;let{firstIndex:e,lastIndex:t,stickyHeight:n,stickyTop:r,stickyBottom:i}=this.renderState;if(e===-1||t===-1)return;let a=this.stickyContainer.getBoundingClientRect().height;Math.abs(a-n)<ce||console.error(`CodeView: sticky container height does not match computed layout`,{computedStickyHeight:n,actualStickyHeight:a,delta:a-n,stickyTop:r,stickyBottom:i,firstIndex:e,lastIndex:t,firstStickySpecs:this.items[e]?.instance.getAdvancedStickySpecs(),lastStickySpecs:this.items[t]?.instance.getAdvancedStickySpecs(),scrollTop:this.getScrollTop(),scrollPageOffset:this.scrollPageOffset,windowSpecs:{...this.windowSpecs},stickyContainer:this.stickyContainer})}clearScrollInteractionTimer(){this.scrollInteractionFixTimer!=null&&(clearTimeout(this.scrollInteractionFixTimer),this.scrollInteractionFixTimer=void 0)}suspendScrollInteractions(){this.clearScrollInteractionTimer(),this.shouldDisablePointerEvents()&&!this.pointerEventsDisabled&&(this.stickyContainer.style.pointerEvents=`none`,this.pointerEventsDisabled=!0),he&&!this.codeOverflowFix&&(this.stickyContainer.style.setProperty(le,`hidden`),this.codeOverflowFix=!0),this.scrollInteractionFixTimer=setTimeout(this.restoreScrollInteractions,se)}restoreScrollInteractions=()=>{this.clearScrollInteractionTimer(),this.pointerEventsDisabled&&=(this.stickyContainer.style.removeProperty(`pointer-events`),!1),this.codeOverflowFix&&=(this.stickyContainer.style.setProperty(le,`auto`),!1)};syncLayout(){let{gap:e,paddingBottom:t,paddingTop:n}=this.getLayout();this.stickyContainer.style.gap=`${e}px`,this.container?.style.setProperty(`margin-top`,`${n}px`),this.container?.style.setProperty(`margin-bottom`,`${t}px`)}reconcileHeaderFooterHosts(){let e=this.reconcileHost(`header`),t=this.reconcileHost(`footer`);return e||t}reconcileHost(e){let{root:t,container:n}=this;if(t==null||n==null)return!1;let r=e===`header`?this.header:this.footer,i=e===`header`?this.options.renderCodeViewHeader:this.options.renderCodeViewFooter;if(i==null)return r.element==null?!1:(this.resizeObserver?.unobserve(r.element),r.element.remove(),r.element=void 0,r.render=void 0,this.setHostHeight(r,0),!1);if(r.element!=null&&i===r.render)return!1;let a=r.element??re(e,n,this.resizeObserver);r.element=a;let o=i();return o==null?!this.isContainerManaged&&a.children.length>0&&(a.textContent=``):a.replaceChildren(o),r.render=i,!0}setHostHeight(e,t){e.height!==t&&(e.height=t,this.scrollDirty=!0)}measureMountedHosts(){this.header.element!=null&&this.setHostHeight(this.header,this.header.element.getBoundingClientRect().height),this.footer.element!=null&&this.setHostHeight(this.footer,this.footer.element.getBoundingClientRect().height)}setup(t){if(this.root!=null)throw Error(`CodeView.setup: already setup`);this.workerManager?.subscribeToThemeChanges(this),this.root=t,this.root.style.overflowAnchor=`none`,this.root.hasAttribute(`tabindex`)||(this.root.tabIndex=-1),this.container??=document.createElement(`div`),this.container.style.contain=`layout style`,this.syncLayout(),this.container.appendChild(this.stickyOffset),this.container.appendChild(this.stickyContainer),this.root.appendChild(this.container),this.scrollDirty=!0,this.heightDirty=!0,this.resizeObserver=new ResizeObserver(this.handleResize),this.resizeObserver.observe(this.stickyContainer),this.root.addEventListener(`scroll`,this.handleScroll,{passive:!0}),this.root.addEventListener(`wheel`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`touchstart`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`pointerdown`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`keydown`,this.clearPendingScroll,{passive:!0}),this.resizeObserver.observe(this.root),this.render(!0),window.__INSTANCE=this,window.__TOGGLE=()=>{e.__STOP?(e.__STOP=!1,this.scrollTo({type:`position`,position:e.__lastScrollPosition,behavior:`instant`})):(e.__lastScrollPosition=this.getScrollTop(),e.__STOP=!0)}}reset(){g(this.computeRenderRangeAndEmit),this.clearReadySubscription(),this.restoreScrollInteractions(),this.cleanAllRenderedItems();for(let e of this.itemEditors.values())e.editor.cleanUp();this.itemEditors.clear(),this.attachedEditors.clear(),this.selectedLines=null,this.items.length=0,this.idToItem.clear(),this.instanceToItem.clear(),this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,this.stickyContainer.textContent=``,this.stickyOffset.style.height=``,this.container?.style.removeProperty(`height`),this.containerHeight=-1,this.windowSpecs={top:0,bottom:0},this.pendingLayoutAnchor=void 0,this.shouldFixContainerFocus=!1,this.height=0,this.scrollTop=0,this.scrollPageOffset=0,this.scrollHeight=0,this.scrollDirty=!0,this.heightDirty=!0,this.resetRenderState(),this.isContainerManaged||this.flushSlotCoordinator()}cleanUp(){this.reset(),this.clearElementPool(),this.restoreScrollInteractions(),this.workerManager?.unsubscribeToThemeChanges(this),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.root?.removeEventListener(`scroll`,this.handleScroll),this.root?.removeEventListener(`wheel`,this.clearPendingScroll),this.root?.removeEventListener(`touchstart`,this.clearPendingScroll),this.root?.removeEventListener(`pointerdown`,this.clearPendingScroll),this.root?.removeEventListener(`keydown`,this.clearPendingScroll),this.root?.style.removeProperty(`overflow-anchor`),this.container?.remove(),this.stickyOffset.remove(),this.stickyContainer.remove(),this.stickyContainer.textContent=``,this.header.element?.remove(),this.header.element=void 0,this.header.render=void 0,this.header.height=0,this.footer.element?.remove(),this.footer.element=void 0,this.footer.render=void 0,this.footer.height=0,this.root=void 0,this.container=void 0}cleanAllRenderedItems(){if(this.renderState.firstIndex!==-1)for(let e=this.renderState.firstIndex;e<=this.renderState.lastIndex;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.cleanAllRenderedItems: Item does not exist at index: ${e}`);this.releaseRenderedItem(t)}}primeScrollTarget(e){e.type!==`position`&&this.idToItem.get(e.id)?.instance.primeHighlightCache()}getElementPoolLimit(){let e=this.getHeight()+this.config.overscrollSize*2,{diffHeaderHeight:t}=this.itemMetricsCache;return Math.max(8,Math.ceil(e/Math.max(t,10))+1)*(this.isContainerManaged?2:1)}acquireElement(){this.promotePendingPooledElements();let e=this.elementPool.pop();for(;e!=null&&!this.isElementPoolGenerationCurrent(e);)e=this.elementPool.pop();return e??=document.createElement(S),this.markElementPoolGenerationCurrent(e),e}releaseRenderedItem(e){let{element:t}=e;t!=null&&this.renderedItemOwnsFocus(t)&&(this.shouldFixContainerFocus=!0),e.instance.cleanUp(!0),this.attachedEditors.delete(e.item.id),e.element=void 0,t!=null&&(t.remove(),this.cleanElement(t),this.queueElementForPool(t))}renderedItemOwnsFocus(e){let{activeElement:t}=document;return t===e||e.contains(t)||e.shadowRoot?.activeElement!=null}fixContainerFocus(){this.shouldFixContainerFocus&&(this.shouldFixContainerFocus=!1,this.root?.focus({preventScroll:!0}))}cleanElement(e){let{shadowRoot:t}=e;if(t!=null)for(let e of Array.from(t.children))xe(e)||e.remove();this.isContainerManaged||e.replaceChildren()}queueElementForPool(e){let t=this.getElementPoolLimit();!this.isElementPoolGenerationCurrent(e)||this.getElementPoolSize()>=t||(this.isElementClean(e)?this.elementPool.push(e):this.pendingElementPool.push(e))}promotePendingPooledElements(){if(this.pendingElementPool.length===0)return;let{pendingElementPool:e}=this;this.pendingElementPool=[];let t=this.getElementPoolLimit();for(let n of e)this.isElementPoolGenerationCurrent(n)&&this.isElementClean(n)&&this.elementPool.length<t?this.elementPool.push(n):this.isElementPoolGenerationCurrent(n)&&this.getElementPoolSize()<t&&this.pendingElementPool.push(n)}isElementClean(e){return e.childNodes.length===0}getElementPoolSize(){return this.elementPool.length+this.pendingElementPool.length}clearElementPool(){this.elementPool.length=0,this.pendingElementPool.length=0}invalidateElementPool(){this.elementPoolVersion++,this.clearElementPool()}markElementPoolGenerationCurrent(e){this.elementPoolTracker.set(e,this.elementPoolVersion)}isElementPoolGenerationCurrent(e){return this.elementPoolTracker.get(e)===this.elementPoolVersion}resolveEffectiveScrollBehavior(e,t){return z()?`instant`:e.behavior===`smooth-auto`?Math.abs(t-this.getScrollTop())<=this.getHeight()*10?`smooth`:`instant`:e.behavior??`instant`}scrollTo(e){if(this.root==null)return;let t=this.normalizeScrollTarget(e);if(t==null)return;let n=this.resolveScrollTargetTop(t);n!=null&&(this.primeScrollTarget(t),this.resolveEffectiveScrollBehavior(t,n)===`smooth`?this.scrollAnimation??={position:this.getScrollTop(),velocity:0,lastTimestamp:performance.now()}:this.scrollAnimation=void 0,this.suspendScrollInteractions(),this.pendingLayoutAnchor=void 0,this.pendingScrollTarget=t,this.render())}setSelectedLines(e,t){this.applySelectedLines(e,t)}getSelectedLines(){return this.selectedLines}clearSelectedLines(e){this.applySelectedLines(null,e)}getItem(e){return this.idToItem.get(e)?.item}getEditor(e){return this.itemEditors.get(e)?.editor}updateItem(e){let t=this.idToItem.get(e.id);return t==null?(console.error(`CodeView.updateItem: unknown item id "${e.id}"`),!1):this.syncItemRecord(t,e)?(this.markItemLayoutDirty(t),this.scrollDirty=!0,this.render(),this.syncItemEditors(),this.syncSelection(),!0):!1}updateItemId(e,t){if(e===t)return!0;let n=this.idToItem.get(e);if(n==null)return console.error(`CodeView.updateItemId: unknown item id "${e}"`),!1;if(this.idToItem.has(t))return console.error(`CodeView.updateItemId: duplicate item id "${t}"`),!1;this.idToItem.delete(e),n.item.id=t,this.idToItem.set(t,n),this.updateItemOptionsId(n.instance.options,t),this.selectedLines?.id===e&&(this.selectedLines={...this.selectedLines,id:t},this.options.onSelectedLinesChange?.(this.selectedLines));let r=this.itemEditors.get(e);return r!=null&&(r.state.id=t,this.itemEditors.delete(e),this.itemEditors.set(t,r),this.attachedEditors.delete(e)&&this.attachedEditors.add(t)),this.renamePendingScrollTarget(e,t),this.renamePendingLayoutAnchor(e,t),this.render(),!0}addItem(e){this.addItems([e])}addItems(e){this.appendItemsInternal(e),this.syncItemEditors(),this.syncSelection()}removeItem(e){let t=this.idToItem.get(e);if(t==null)return console.error(`CodeView.removeItem: unknown item id "${e}"`),!1;let n=[];for(let e of this.items)e!==t&&n.push(e.item);return this.setItems(n),!0}setItems(e){let t;this.items.length===0?this.appendItemsInternal(e):this.tryAppendItems(e)||(t=this.reconcileItems(e)),this.syncItemEditors(t),this.syncSelection()}appendItemsInternal(e,t=!0){if(e.length===0)return;let n=this.getLayout(),r=this.items.length===0?0:this.scrollHeight+n.gap,i=r;for(let t=0;t<e.length;t++){let i=e[t];if(i==null)throw Error(`CodeView.appendItemsInternal: missing input item`);if(this.idToItem.has(i.id))throw Error(`CodeView.addItem: duplicate id "${i.id}"`);let a=this.createItem(i,this.items.length,r);this.items.push(a),this.idToItem.set(a.item.id,a),this.instanceToItem.set(a.instance,a),a.height=_e(a),r+=a.height+n.gap}this.scrollHeight=r-n.gap,this.scrollDirty=!0,t&&(this.canSkipRenderForAppend(i)?this.syncContainerHeight():this.render())}canSkipRenderForAppend(e){return this.container!=null&&this.renderState.firstIndex!==-1&&this.pendingScrollTarget==null&&this.scrollAnimation==null&&this.layoutDirtyIndex==null&&e>this.windowSpecs.bottom}onThemeChange(){this.invalidateElementPool()}setOptions(e){if(e==null)return;this.capturePendingLayoutAnchor();let{options:t}=this,n=this.getLayout(),{itemMetricsCache:r}=this;ve(t,e)&&this.invalidateElementPool(),this.options=e;let i=this.computeMetricsCache(e.itemMetrics),a=!T(r,i),o=!T(n,this.getLayout());o&&this.syncLayout();let s=a||ye(t,e);if(s){let n=this.pendingLayoutReset;this.pendingLayoutReset={metrics:a?i:n?.metrics,resetFileLayoutCache:!0,resetDiffLayoutCache:!0,includeEstimatedDiffHeights:n?.includeEstimatedDiffHeights===!0||a||be(t,e)}}(o||s)&&(this.markLayoutDirtyFromIndex(0),this.scrollDirty=!0),m(t,e)||this.renderOptionsRevision++,this.syncItemEditors();let c=t.renderCodeViewHeader!==e.renderCodeViewHeader||t.renderCodeViewFooter!==e.renderCodeViewFooter;!this.isContainerManaged&&(this.items.length>0||c)&&this.render()}capturePendingLayoutAnchor(e=this.idToItem){this.root==null||this.items.length===0||this.pendingScrollTarget!=null||(this.pendingLayoutAnchor=this.getScrollAnchor(this.getScrollTop(),e))}render(t=!1){e.__STOP||(t?(g(this.computeRenderRangeAndEmit),this.computeRenderRangeAndEmit()):h(this.computeRenderRangeAndEmit))}isReady(){let{workerManager:e}=this;return e==null||e.isInitialized()||e.getStats().workersFailed?(this.clearReadySubscription(),!0):(this.isReadySubscription??=e.subscribeToStatChanges(e=>{e.managerState!==`initialized`&&!e.workersFailed||(this.clearReadySubscription(),this.render(!0))}),e.getStats().managerState===`waiting`&&e.initialize().catch(()=>{}),!1)}clearReadySubscription(){this.isReadySubscription!=null&&(this.isReadySubscription(),this.isReadySubscription=void 0)}instanceChanged(e,t){let n=this.instanceToItem.get(e);if(n==null)throw Error(`CodeView.instanceChanged: An instance has changed that is not registered`);t&&this.markItemLayoutDirty(n),this.render()}getWindowSpecs(){return this.windowSpecs}getContainerElement(){return this.root}getHeaderElement(){return this.header.element}getFooterElement(){return this.footer.element}getRenderedItems(){let{firstIndex:e,lastIndex:t}=this.renderState;if(e===-1||t===-1||t<e)return[];let n=[];for(let r=e;r<=t;r++){let e=this.items[r];e?.element!=null&&(e.type===`diff`?n.push({id:e.item.id,type:`diff`,item:e.item,version:e.version,element:e.element,instance:e.instance}):n.push({id:e.item.id,type:`file`,item:e.item,version:e.version,element:e.element,instance:e.instance}))}return n}setSlotCoordinator(e){return e===this.slotCoordinator?!1:(this.slotCoordinator=e,this.slotSnapshot=void 0,!0)}getSlotSnapshot(e){return this.buildSlotSnapshot(e)}buildSlotSnapshot(e){let t=De(this.getRenderedItems(),e),{element:n}=this.header,{element:r}=this.footer;if(!(t==null&&n==null&&r==null))return{items:t,header:n,footer:r}}subscribeToScroll(e){return this.scrollListeners.add(e),()=>{this.scrollListeners.delete(e)}}getLocalTopForInstance(e){let t=this.instanceToItem.get(e);if(t==null)throw Error(`CodeView.getLocalTopForInstance: unknown virtualized instance`);return t.top}getTopForItem(e){let t=this.idToItem.get(e);if(t!=null)return t.top+this.getItemTopOffset()}createItem(e,t,n){let{itemMetricsCache:r}=this;if(e.type===`diff`){let i=new A(this.createDiffOptions(e.id),this,r,this.workerManager,this.isContainerManaged);return{type:`diff`,item:e,version:e.version,index:t,top:n,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:i}}let i=new f(this.createFileOptions(e.id),this,r,this.workerManager,this.isContainerManaged);return{type:`file`,item:e,version:e.version,index:t,top:n,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:i}}applySelectedLines(e,t){let{selectedLines:n}=this;e==null&&n==null||e!=null&&n?.id===e.id&&C(n.range,e.range)||(n!=null&&n.id!==e?.id&&this.idToItem.get(n.id)?.instance.setSelectedLines(null,{notify:!1}),this.selectedLines=e,this.idToItem.get(e?.id??``)?.instance.setSelectedLines(e?.range??null,t))}syncSelection(){if(this.selectedLines==null)return;let e=this.idToItem.get(this.selectedLines.id);if(e==null){this.selectedLines=null,this.options.onSelectedLinesChange?.(null);return}e.instance.setSelectedLines(this.selectedLines.range,{notify:!1})}isItemInEditMode(e){return e.item.edit===!0&&e.item.collapsed!==!0}attachItemEditor(e){let{id:t}=e.item,{createEditor:n}=this.options;if(e.element==null||this.attachedEditors.has(t)||!this.isItemInEditMode(e))return;let r=this.itemEditors.get(t),i=!1;try{if(r==null){me(n);let e={id:t},a=n({onChange:(t,n)=>{let r=this.idToItem.get(e.id);r!=null&&(e.lastChange={item:r.item,file:t,lineAnnotations:n},this.options.onItemEditChange?.(r.item,t,n))}});if(a==null)return;r={editor:a,state:e},this.itemEditors.set(t,r),i=!0}r.editor.edit(e.instance),this.attachedEditors.add(t)}catch(n){throw i&&r!=null&&(this.itemEditors.delete(t),r.editor.cleanUp()),this.releaseRenderedItem(e),n}}syncItemEditors(e){if(this.itemEditors.size===0)return;let t=[];for(let[n,r]of this.itemEditors){let i=this.idToItem.get(n),a=e?.get(n);if(a==null&&i!=null&&this.isItemInEditMode(i))continue;r.editor.cleanUp(),this.itemEditors.delete(n),this.attachedEditors.delete(n);let{lastChange:o}=r.state,s=a==null?i?.item??o?.item:o?.item??a.item;s?.type===`diff`&&(a==null&&i!=null&&i.type===`diff`&&i.instance.completeEditSession()&&(this.markItemLayoutDirty(i),this.render()),D(s.fileDiff)),o!=null&&t.push(a!=null||i==null?o:{...o,item:i.item})}for(let{item:e,file:n,lineAnnotations:r}of t)this.options.onItemEditComplete?.(e,n,r)}renamePendingScrollTarget(e,t){let{pendingScrollTarget:n}=this;n==null||n.type===`position`||n.id!==e||(this.pendingScrollTarget={...n,id:t})}renamePendingLayoutAnchor(e,t){this.pendingLayoutAnchor?.id===e&&(this.pendingLayoutAnchor.id=t)}createFileOptionsPrototype(){let e={};for(let t of W)q(e,t,()=>this.options[t]);q(e,`stickyHeader`,()=>this.options.stickyHeaders),q(e,`collapsed`,e=>{let t=K(e);if(t!=null)return this.getItemOptions(t,`file`)?.item.collapsed});for(let t of ie)this.defineItemSharedCallback(e,`file`,t);for(let t of ae)this.defineItemSelectionCallback(e,`file`,t);return e}createDiffOptionsPrototype(){let e={};for(let t of U)q(e,t,()=>this.options[t]);q(e,`stickyHeader`,()=>this.options.stickyHeaders),q(e,`hunkSeparators`,()=>this.options.hunkSeparators),q(e,`collapsed`,e=>{let t=K(e);if(t!=null)return this.getItemOptions(t,`diff`)?.item.collapsed});for(let t of ie)this.defineItemSharedCallback(e,`diff`,t);for(let t of ae)this.defineItemSelectionCallback(e,`diff`,t);return e}createFileOptions(e){let t=Object.create(this.fileOptionsPrototype);return G(t,{id:e}),t}createDiffOptions(e){let t=Object.create(this.diffOptionsPrototype);return G(t,{id:e}),t}updateItemOptionsId(e,t){let n=K(e);if(n==null)throw Error(`CodeView.updateItemOptionsId: No valid state`);n.id=t}getItemOptions(e,t){let n=this.idToItem.get(e.id);if(!(n==null||n.type!==t))return n}defineItemSharedCallback(e,t,n){q(e,n,e=>{if(this.options[n]==null)return;let r=K(e);if(r==null)return;let i=r.callbackCache??={},a=i[n];return a??(a=((...e)=>{let i=this.getItemOptions(r,t);if(i==null)return;let a=this.options[n];return a?.(...e,i)}),i[n]=a),a})}defineItemSelectionCallback(e,t,n){q(e,n,e=>{let r=K(e);if(r==null)return;let i=r.callbackCache??={},a=i[n];return a??(a=(e=>{let i=this.getItemOptions(r,t);if(i==null)return;let a=e==null?null:{id:i.item.id,range:e};this.options.controlledSelection!==!0&&(e!=null||this.selectedLines?.id===i.item.id)&&this.applySelectedLines(a,{notify:!1}),this.options.onSelectedLinesChange?.(a);let o=this.options[n];return o?.(e,i)}),i[n]=a),a})}markLayoutDirtyFromIndex(e){this.layoutDirtyIndex=Math.min(this.layoutDirtyIndex??e,e)}markItemLayoutDirty(e){if(this.items[e.index]!==e)throw Error(`CodeView.markItemLayoutDirty: unknown item id "${e.item.id}"`);this.markLayoutDirtyFromIndex(e.index)}tryAppendItems(e){if(e.length<=this.items.length)return!1;for(let t=0;t<this.items.length;t++){let n=this.items[t];if(n==null)throw Error(`CodeView.tryAppendItems: missing existing item`);let r=e[t];if(r==null||n.item.id!==r.id||n.type!==r.type)return!1}for(let t=0;t<this.items.length;t++){let n=this.items[t];if(n==null)throw Error(`CodeView.tryAppendItems: missing existing item`);let r=e[t];if(r==null)throw Error(`CodeView.tryAppendItems: append candidate missing prefix item`);this.syncItemRecord(n,r)&&this.markLayoutDirtyFromIndex(t)}return this.appendItemsInternal(e.slice(this.items.length),!1),this.scrollDirty=!0,this.render(),!0}reconcileItems(e){let{items:t,idToItem:n}=this,r=new Set(t),i=[],a=new Map,o=new Map,s=new Map,c;for(let s=0;s<e.length;s++){let l=e[s];if(l==null)throw Error(`CodeView.reconcileItems: missing input item`);if(a.has(l.id))throw Error(`CodeView.setItems: duplicate id "${l.id}"`);let u=n.get(l.id),d=u!=null&&u.type===l.type?u:this.createItem(l,s,0);d.index=s,u!=null&&u.type===l.type?(r.delete(u),this.syncItemRecord(d,l)&&(c=Math.min(c??s,s))):c=Math.min(c??s,s),t[s]!==d&&(c=Math.min(c??s,s)),i.push(d),a.set(l.id,d),o.set(d.instance,d)}if(c==null){if(r.size===0)return;c=Math.max(i.length-1,0)}this.capturePendingLayoutAnchor(a);for(let e=0;e<t.length;e++){let n=t[e];if(n==null||!r.has(n))continue;s.set(n.item.id,n),this.releaseRenderedItem(n);let a=Math.max(i.length-1,0);c=Math.min(c??a,a)}return this.items=i,this.idToItem=a,this.instanceToItem=o,this.renderState.firstIndex>=i.length?this.resetRenderState():this.renderState.lastIndex>=i.length&&(this.renderState.lastIndex=i.length-1),this.markLayoutDirtyFromIndex(c),this.scrollDirty=!0,this.render(),s.size>0?s:void 0}syncItemRecord(e,t){if(e.type!==t.type)throw Error(`CodeView.syncItemRecord: type mismatch for id "${t.id}"`);return e.version===t.version?!1:(e.item=t,e.version=t.version,e.renderedOptionsRevision=-1,!0)}getMaxScrollTopForHeight(e){let{paddingBottom:t,paddingTop:n}=this.getLayout();return Math.max(n+this.header.height+e+this.footer.height+t-this.getHeight(),0)}getMaxScrollTop(){return this.getMaxScrollTopForHeight(this.getScrollHeight())}shouldRebaseScroll(){return this.getMaxScrollTop()>pe}getPagedScrollHeight(){return this.shouldRebaseScroll()?Math.min(this.getScrollHeight(),J):this.getScrollHeight()}getMaxPagedScrollTop(){return this.getMaxScrollTopForHeight(this.getPagedScrollHeight())}clampPagedScrollTop(e){let t=this.getMaxPagedScrollTop();return Math.max(0,Math.min(e,t))}clampScrollTop(e){let t=this.getMaxScrollTop();return Math.max(0,Math.min(e,t))}getMaxScrollPageOffset(){return Math.max(this.getMaxScrollTop()-this.getMaxPagedScrollTop(),0)}clampScrollPageOffset(e){let t=this.getMaxScrollPageOffset();return Math.max(0,Math.min(e,t))}resolveScrollPageWindow(e,t){let n=H(this.clampPagedScrollTop(t)),r=this.clampScrollPageOffset(e-n);return n=H(this.clampPagedScrollTop(e-r)),r=this.clampScrollPageOffset(e-n),{pagedScrollTop:n,scrollPageOffset:r}}resolvePagedScrollPosition(e){if(!this.shouldRebaseScroll())return{pagedScrollTop:this.clampPagedScrollTop(e),scrollPageOffset:0};let t=this.clampScrollPageOffset(this.scrollPageOffset),n=e-t,r=this.getMaxPagedScrollTop(),i=this.getMaxScrollPageOffset(),a=n>pe&&t<i,o=n<ue&&t>0;return n<0||n>r||a||o?this.resolveScrollPageWindow(e,o?Math.min(fe,r):de):{pagedScrollTop:H(this.clampPagedScrollTop(n)),scrollPageOffset:t}}needsScrollPageUpdate(e){let t=H(this.clampScrollTop(e)),{scrollPageOffset:n}=this.resolvePagedScrollPosition(t);return n!==this.scrollPageOffset}getPagedLayoutTop(e){return this.shouldRebaseScroll()?Math.max(e-this.scrollPageOffset,0):e}getStickyHeaderOffset(){return this.options.stickyHeaders===!0&&this.options.disableFileHeader!==!0?this.itemMetricsCache.diffHeaderHeight:0}getScrollTargetRect(e){let t=this.idToItem.get(e.id);if(t==null){console.warn(`CodeView.scrollTo: unknown item id "${e.id}"`);return}if(e.type===`item`)return{top:t.top,height:t.height};if(e.type===`range`){let n=this.getRangeScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve range ${Se(e.range)} for item "${e.id}"`);return}return{top:t.top+n.top,height:n.height}}let n=this.getLineScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve line ${e.lineNumber} for item "${e.id}"`);return}return{top:t.top+n.top,height:n.height}}normalizeScrollTarget(e){if(e.type===`position`||e.align!==`nearest`)return e;let t=this.getScrollTargetRect(e);if(t==null)return;let n=e.offset??0,r=this.getItemTopOffset()+t.top,i=r+t.height,a=this.getScrollTop(),o=a+(e.type===`line`||e.type===`range`?this.getStickyHeaderOffset():0),s=a+this.getHeight();if(!(r-n<=o&&i+n>=s)){if(r-n<o)return{...e,align:`start`};if(i+n>s)return{...e,align:`end`}}}resolveScrollTargetTop(e){if(e.type===`position`){let t=this.clampScrollTop(e.position);return t===e.position?this.clampScrollTop(e.position-this.getStickyHeaderOffset()):t}let t=this.idToItem.get(e.id);if(t==null){console.warn(`CodeView.scrollTo: unknown item id "${e.id}"`);return}if(e.type===`item`)return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top,t.height,e.align,e.offset));if(e.type===`range`){let n=this.getRangeScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve range ${Se(e.range)} for item "${e.id}"`);return}return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top+n.top,n.height,e.align,e.offset,this.getStickyHeaderOffset()))}let n=this.getLineScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve line ${e.lineNumber} for item "${e.id}"`);return}return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top+n.top,n.height,e.align,e.offset,this.getStickyHeaderOffset()))}resolveAlignedScrollPosition(e,t,n,r=0,i=0){e+=this.getItemTopOffset();let a=this.getHeight();return n===`center`&&t+r<a?e-(a-t)/2+r:n===`end`?e-(a-t)+r:e-i-r}getLineScrollPosition(e,t){return e.type===`diff`?e.instance.getLinePosition(t.lineNumber,t.side):e.instance.getLinePosition(t.lineNumber)}getRangeScrollPosition(e,t){let{range:n}=t,r=this.getLineScrollPosition(e,{type:`line`,id:t.id,lineNumber:n.start,side:n.side}),i=this.getLineScrollPosition(e,{type:`line`,id:t.id,lineNumber:n.end,side:n.endSide??n.side});if(r==null||i==null)return;let a=r.top,o=a+r.height,s=i.top,c=s+i.height,l=Math.min(a,s);return{top:l,height:Math.max(o,c)-l}}computeTargetScrollTopForFrame(e,t){if(this.pendingScrollTarget==null)return e;let n=this.resolveScrollTargetTop(this.pendingScrollTarget);if(n==null)return e;let{scrollAnimation:r}=this;return r==null?n:this.computeSpringStep(r,n,t).position}computeSpringStep(e,t,n){let r=Math.max(0,n-e.lastTimestamp),{omega:i}=this.getSmoothScrollSettings(),a=Math.exp(-i*r),o=e.position-t,s=e.velocity+i*o;return{position:t+(o+s*r)*a,velocity:(s*(1-i*r)-i*o)*a}}advanceScrollAnimation(e,t){if(this.pendingScrollTarget==null)return;let n=this.resolveScrollTargetTop(this.pendingScrollTarget);if(n==null){this.pendingScrollTarget=void 0,this.scrollAnimation=void 0;return}let r=this.scrollAnimation;if(r==null)return n;r.position+=t;let{position:i,velocity:a}=this.computeSpringStep(r,n,e);r.lastTimestamp=e,r.position=i,r.velocity=a;let{positionEpsilon:o,velocityEpsilon:s}=this.getSmoothScrollSettings();return Math.abs(n-i)<=o&&Math.abs(a)<=s?(r.position=n,r.velocity=0,this.scrollAnimation=void 0,n):r.position}computeRenderRangeAndEmit=(t=performance.now())=>{if(e.__STOP||this.container==null||!this.isReady())return;let n=this.getHeight(),r=this.getScrollTop(),i=r,a=this.pendingLayoutAnchor!=null,o=this.getScrollAnchor(i);if(this.layoutDirtyIndex!=null&&(this.recomputeLayout(this.layoutDirtyIndex,this.pendingLayoutReset),this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,a=!0),a&&o!=null){let e=this.resolveAnchoredScrollTop(o);if(e!=null){let t=e-i;i=e,this.scrollAnimation!=null&&(this.scrollAnimation.position+=t)}}a&&(i=this.clampScrollTop(i),this.syncContainerHeight());let s=this.computeTargetScrollTopForFrame(i,t),c=!a&&(this.renderState.scrollTop===-1||Math.abs(s-this.renderState.scrollTop)>n+this.config.overscrollSize*2);c&&(o=void 0),this.windowSpecs=F({scrollTop:s-this.header.height,height:n,scrollHeight:this.getScrollHeight(),fitPerfectly:c,fitPerfectlyOverscroll:this.getFitPerfectlyOverscroll(),overscrollSize:this.config.overscrollSize});let l=r;(this.pendingScrollTarget!=null&&s!==l||this.needsScrollPageUpdate(s))&&(this.applyScrollFix(s,l,this.windowSpecs),l=s);let{top:u,bottom:d}=this.windowSpecs,{firstIndex:f,lastIndex:p}=this.renderState;if(f>=0)for(let e=f;e<=p;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.computeRenderRangeAndEmit: No item at index: ${e}`);t.top>u-t.height&&t.top<=d||this.releaseRenderedItem(t)}let m=this.reconcileHeaderFooterHosts(),h,g=new Set,_=this.findFirstVisibleIndex(u),v=this.findLastVisibleIndex(d);for(let e=_;e<=v;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.computeRenderRangeAndEmit: missing item`);let{instance:n}=t;t.element==null?(t.element=this.acquireElement(),Te(this.stickyContainer,t.element,h),n.virtualizedSetup(),we(t,t.element)&&(t.renderedOptionsRevision=this.renderOptionsRevision,g.add(t)),h=t.element):(Te(this.stickyContainer,t.element,h),we(t,void 0,t.renderedOptionsRevision!==this.renderOptionsRevision)&&(t.renderedOptionsRevision=this.renderOptionsRevision,g.add(t)),h=t.element),t.item.edit===!0&&this.attachItemEditor(t)}this.renderState.firstIndex=_<=v?_:-1,this.renderState.lastIndex=v,this.flushSlotCoordinator(),this.flushManagers(g),m&&this.measureMountedHosts(),this.reconcileRenderedItems(g),this.syncContainerHeight(),this.updateStickyPositioning();let y=o==null?void 0:this.resolveAnchoredScrollTop(o);o===this.pendingLayoutAnchor&&(this.pendingLayoutAnchor=void 0);let b=y==null?0:y-i,x=s,S=!1;if(this.pendingScrollTarget!=null){let e=this.advanceScrollAnimation(t,b);e==null?x=i:(x=e,S=!0)}else x=y??s;x!==l&&(this.applyScrollFix(x,l,this.windowSpecs),l=x),S&&this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),this.renderState.scrollTop=H(l),this.updateStickyPositioning(),this.validateStickyContainerHeight(),this.fixContainerFocus(),(c||this.scrollAnimation!=null)&&this.render()};flushManagers(e){for(let t of e)t.instance.flushManagers()}syncContainerHeight(){let e=this.getPagedScrollHeight();this.container==null||this.containerHeight===e||(this.container.style.height=`${e}px`,this.containerHeight=e)}getStickyBounds(e){let{firstIndex:t,lastIndex:n}=e==null?this.renderState:{firstIndex:this.findFirstVisibleIndex(e.top),lastIndex:this.findLastVisibleIndex(e.bottom)};if(t===-1||n===-1||t>n)return;let r=this.items[t]?.instance.getAdvancedStickySpecs(e),i=this.items[n]?.instance.getAdvancedStickySpecs(e);if(!(r==null||i==null))return{stickyTop:this.getPagedLayoutTop(Math.max(r.topOffset,0)),stickyBottom:this.getPagedLayoutTop(i.topOffset+i.height)}}applyStickyPositioning({stickyTop:e,stickyBottom:t}){let n=this.getHeight(),{itemMetricsCache:r}=this,i=t-e;this.renderState.stickyHeight=i,this.renderState.stickyTop=e,this.renderState.stickyBottom=t,this.stickyOffset.style.height=`${e}px`;let a=(Math.random()*r.lineHeight>>0)*-1,o=-Math.max(i+a,0)+n;this.stickyContainer.style.top=`${o}px`,this.stickyContainer.style.bottom=`${o+r.diffHeaderHeight}px`}syncPagedScrollScaffolding(e){this.syncContainerHeight();let t=this.getStickyBounds(e);t!=null&&this.applyStickyPositioning(t)}reconcileRenderedItems(e){let{firstIndex:t,lastIndex:n}=this.renderState;if(t===-1)return;let r=-1,i=!1;for(let a=t;a<this.items.length&&!(!i&&a>n);a++){let t=this.items[a];if(t==null)throw Error(`CodeView.reconcileRenderedItems: Invalid item`);r===-1?r=t.top:t.top!==r&&(t.top=r,t.instance.syncVirtualizedTop(),i=!0),(e==null?a<=n:e.has(t))&&(t.instance.reconcileHeights()&&(i=!0,t.height=t.instance.getVirtualizedHeight()),this.validateRenderedItemHeight(t)),r+=t.instance.getVirtualizedHeight(),a<this.items.length-1&&(r+=this.getLayout().gap)}i&&r!=null&&(this.scrollDirty=!0,this.scrollHeight=r)}updateStickyPositioning(){let e=this.getStickyBounds();if(e==null){this.renderState.firstIndex===-1&&(this.stickyOffset.style.height=``);return}let{stickyTop:t,stickyBottom:n}=e;n-t===this.renderState.stickyHeight&&t===this.renderState.stickyTop&&n===this.renderState.stickyBottom||this.applyStickyPositioning(e)}handleScroll=()=>{e.__STOP||(this.suspendScrollInteractions(),this.scrollDirty=!0,this.notifyScroll(),this.render())};clearPendingScroll=()=>{this.pendingScrollTarget=void 0,this.pendingLayoutAnchor=void 0,this.scrollAnimation=void 0};handleResize=e=>{let t=!1;for(let n of e)if(n.target===this.stickyContainer){let e=n.borderBoxSize[0].blockSize;if(Math.abs(e-this.renderState.stickyHeight)>=ce){let e=this.getScrollTop(),n=this.getScrollAnchor(e);this.reconcileRenderedItems(),this.updateStickyPositioning();let r=n==null?void 0:this.resolveAnchoredScrollTop(n);if(r!=null){let t=r-e;this.applyScrollFix(r,e,this.windowSpecs),this.scrollAnimation!=null&&(this.scrollAnimation.position+=t)}this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),t=!0}}else if(n.target===this.header.element||n.target===this.footer.element){let e=n.target===this.header.element?this.header:this.footer,r=n.borderBoxSize[0].blockSize;if(r!==e.height){let n=this.getScrollTop(),i=this.getScrollAnchor(n);this.setHostHeight(e,r);let a=i==null?void 0:this.resolveAnchoredScrollTop(i);if(a!=null){let e=a-n;this.applyScrollFix(a,n,this.windowSpecs),this.scrollAnimation!=null&&(this.scrollAnimation.position+=e)}this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),t=!0}}else this.scrollDirty=!0,this.heightDirty=!0,t=!0;t&&this.render(!0)};getScrollAnchorViewportTop(e,t){return e<t?t+this.getStickyHeaderOffset():t}getScrollAnchor(e,t=this.idToItem){let n,{pendingLayoutAnchor:r}=this;if(r!=null){let e=this.idToItem.get(r.id);if(e!=null&&t.get(r.id)===e)return r;e!=null&&(n=e)}if(e<=0)return;let{firstIndex:i,lastIndex:a,stickyTop:o,stickyBottom:s}=this.renderState;if(i===-1||a===-1)return;let c=this.getHeight();if(!(o===-1||s===-1)){for(let r=i;r<=a;r++){let i=this.items[r];if(i==null)continue;let a=this.getItemTopOffset()+i.top;if(a+i.height<=e)continue;if(a>=e+c)break;if(t.get(i.item.id)!==i){n??=i;continue}if(a>=e)return{type:`item`,id:i.item.id,viewportOffset:a-e};let o=this.getScrollAnchorViewportTop(a,e)-a,s=i.instance.getNumericScrollAnchor(o);if(s!=null){let t=a+s.top;return{type:`line`,id:i.item.id,lineNumber:s.lineNumber,side:s.side,viewportOffset:t-e}}}if(n!=null)for(let e=n.index+1;e<this.items.length;e++){let n=this.items[e];if(n!=null&&t.get(n.item.id)===n)return{type:`item`,id:n.item.id,viewportOffset:0}}}}resolveAnchoredScrollTop(e){let t=this.idToItem.get(e.id);if(t==null)return;let n=this.getItemTopOffset();if(e.type===`item`){let r=n+t.top;return this.clampScrollTop(r-e.viewportOffset)}let r=t.type===`diff`?t.instance.getLinePosition(e.lineNumber,e.side):t.instance.getLinePosition(e.lineNumber);if(r==null)return;let i=n+t.top+r.top;return this.clampScrollTop(i-e.viewportOffset)}applyScrollFix(e,t,n){if(this.root==null)return;let r=H(this.clampScrollTop(e)),i=H(t),{scrollPageOffset:a}=this,o=H(this.clampPagedScrollTop(i-a)),{pagedScrollTop:s,scrollPageOffset:c}=this.resolvePagedScrollPosition(r),l=s,u=a!==c;r===this.renderState.scrollTop&&r===i&&l===o&&!u||(this.suspendScrollInteractions(),(l!==o||u)&&(this.scrollPageOffset=c,this.syncPagedScrollScaffolding(n)),l!==o&&this.root.scrollTo({top:l,behavior:`instant`}),this.renderState.scrollTop=r,this.scrollTop=r,this.scrollDirty=!1)}isPendingTargetSettled(e){let t=this.resolveScrollTargetTop(e);return t==null?!0:H(this.getScrollTop())===H(t)}getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let e=this.root?.scrollTop??0;return this.scrollTop=this.clampScrollTop(e+this.scrollPageOffset),this.scrollTop}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=this.root?.getBoundingClientRect().height??0,this.height):this.height}getScrollHeight(){return this.scrollHeight}flushSlotCoordinator(){if(this.slotCoordinator==null)return;let e=this.buildSlotSnapshot(this.slotCoordinator);B(this.slotSnapshot,e)||(this.slotSnapshot=e,this.slotCoordinator.onSnapshotChange(e))}notifyScroll(){if(this.scrollListeners.size===0)return;let e=this.getScrollTop();for(let t of this.scrollListeners)t(e,this)}findFirstVisibleIndex(e){let t=0,n=this.items.length-1,r=this.items.length;for(;t<=n;){let i=t+n>>1,a=this.items[i];if(a==null)throw Error(`CodeView.findFirstVisibleIndex: invalid item index`);a.top+a.height>e?(r=i,n=i-1):t=i+1}return r}findLastVisibleIndex(e){let t=0,n=this.items.length-1,r=-1;for(;t<=n;){let i=t+n>>1,a=this.items[i];if(a==null)throw Error(`CodeView.findLastVisibleIndex: invalid item index`);a.top<=e?(r=i,t=i+1):n=i-1}return r}recomputeLayout(e=0,t){if(this.items.length===0){this.scrollHeight=0;return}let n=this.getLayout(),r=0;if(e>0){let t=this.items[e-1];if(t==null)throw Error(`CodeView.recomputeLayout: invalid dirty index`);r=t.top+t.height+n.gap}for(let i=e;i<this.items.length;i++){let e=this.items[i];if(e==null)throw Error(`CodeView.recomputeLayout: invalid item index`);if(e.top=r,e.type===`diff`){let n=e.instance.consumeCodeViewLayoutChanges(e.item.fileDiff);n!=null&&Object.assign(e.item.fileDiff,n),e.height=e.instance.prepareCodeViewItem(e.item.fileDiff,r,t,e.item.annotations??[])}else e.height=e.instance.prepareCodeViewItem(e.item.file,r,t,e.item.annotations??[]);r+=e.height,i<this.items.length-1&&(r+=n.gap)}r!==this.scrollHeight&&(this.scrollDirty=!0),this.scrollHeight=r}resetRenderState(){this.renderState.scrollTop=-1,this.renderState.firstIndex=-1,this.renderState.lastIndex=-1,this.renderState.stickyHeight=0,this.renderState.stickyTop=-1,this.renderState.stickyBottom=-1}getFitPerfectlyOverscroll(){return this.getLayout().gap+this.itemMetricsCache.diffHeaderHeight}};function _e(e){return e.instance.cleanUp(!0),e.type===`diff`?e.instance.prepareCodeViewItem(e.item.fileDiff,e.top,void 0,e.item.annotations??[]):e.instance.prepareCodeViewItem(e.item.file,e.top,void 0,e.item.annotations??[])}function ve(e,t){return!N(e.theme??_,t.theme??_)||(e.themeType??`system`)!==(t.themeType??`system`)||e.unsafeCSS!==t.unsafeCSS}function ye(e,t){return(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||e.unsafeCSS!==t.unsafeCSS||(e.diffStyle??`split`)!==(t.diffStyle??`split`)||(e.diffIndicators??`bars`)!==(t.diffIndicators??`bars`)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function be(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function xe(e){return e instanceof SVGElement?!0:P(e)&&(e.hasAttribute(`data-core-css`)||e.hasAttribute(`data-theme-css`)||e.hasAttribute(`data-unsafe-css`))}function Se(e){let t=Ce(e.start,e.side),n=Ce(e.end,e.endSide??e.side);return t===n?t:`${t}-${n}`}function Ce(e,t){return t==null?`${e}`:`${t===`deletions`?`D`:`A`}${e}`}function we(e,t,n=!1){return e.type===`diff`?e.instance.render({deferManagers:!0,fileContainer:t,fileDiff:e.item.fileDiff,forceRender:n,lineAnnotations:e.item.annotations??[]}):e.instance.render({deferManagers:!0,fileContainer:t,file:e.item.file,forceRender:n,lineAnnotations:e.item.annotations??[]})}function Te(e,t,n){if(n==null){e.firstChild!==t&&e.prepend(t);return}n.nextSibling!==t&&n.after(t)}function Ee(e){return(e.annotations?.length??0)>0}function De(e,{hasHeaderRenderers:t,hasAnnotationRenderer:n,hasGutterRenderer:r}){if(e.length===0)return;if(t||r)return e;if(!n)return;let i=[];for(let t of e)Ee(t.item)&&i.push(t);return i.length>0?i:void 0}var Y=e(r(),1),X=e(t(),1),Z=n(),Oe=typeof window>`u`?Y.useEffect:Y.useLayoutEffect;function ke(e){return{instance:void 0,items:void 0,controlled:e,managedOptions:void 0,disableFlushSync:!1,slotCoordinator:void 0}}function Ae(e,t){let{className:n,containerRef:r,disableWorkerPool:i=!1,editorOptions:a,initialItems:o,items:s,onItemEditChange:c,onItemEditComplete:l,onScroll:u,onSelectedLinesChange:d,options:f,renderAnnotation:p,renderCodeViewFooter:h,renderCodeViewHeader:g,renderCustomHeader:_,renderGutterUtility:v,renderHeaderFilenameSuffix:y,renderHeaderMetadata:b,renderHeaderPrefix:x,selectedLines:S,style:C}=e,T=s!==void 0,E=te(),D=(0,Y.useContext)(ne),O=(0,Y.useRef)(ke(T)),k=_!=null,A=p!=null,j=v!=null,M=k||x!=null||y!=null||b!=null,ee=M||A||j,N=g!=null,P=h!=null,F=w(e=>{d?.(e)}),I=S!==void 0,L=w(e=>{if(E==null)throw Error(`CodeView: EditContext is not attached`);let t=E({...a,...e});if(t==null)throw Error(`CodeView: EditProvider.createEditor must return an editor instance`);return t}),R=w((e,t,n)=>{c?.(e,t,n)}),z=w((e,t,n)=>{l?.(e,t,n)}),B=(0,Y.useMemo)(()=>Fe({options:f,hasCustomHeader:k,hasGutterRenderer:j,hasCodeViewHeader:N,hasCodeViewFooter:P,onSelectedLinesChange:d==null?void 0:F,controlledSelection:I,createEditor:E==null?void 0:L,onItemEditChange:c==null?void 0:R,onItemEditComplete:l==null?void 0:z}),[E,I,L,R,z,F,P,N,k,j,c,l,d,f]),[V]=(0,Y.useState)(()=>Pe()),[,re]=(0,Y.useState)({}),H=w(e=>{O.current.instance!=null&&(e==null||e!==O.current.instance.getContainerElement())&&(O.current.instance.cleanUp(),V.publish(void 0),O.current=ke(T)),e!=null&&e!==O.current.instance?.getContainerElement()&&(O.current.instance=new ge(B,i?void 0:D,!0),O.current.instance.setup(e)),typeof r==`function`?r(e):r!=null&&(r.current=e)}),U=w(e=>{O.current.disableFlushSync?V.publish(e):(0,X.flushSync)(()=>{V.publish(e)})}),W=(0,Y.useMemo)(()=>{if(!(!M&&!A&&!j&&!N&&!P))return{hasHeaderRenderers:M,hasAnnotationRenderer:A,hasGutterRenderer:j,onSnapshotChange:U}},[U,A,j,M,N,P]);return Oe(()=>u==null?void 0:O.current.instance?.subscribeToScroll(u)),Oe(()=>{let{instance:e,controlled:t,items:n,managedOptions:r,slotCoordinator:i}=O.current;if(e!=null)try{O.current.disableFlushSync=!0;let a=!1;if(m(B,r)||(O.current.managedOptions=B,e.setOptions(B),a=!0),t!==T){console.error(`CodeView: cannot switch between controlled and uncontrolled modes. Remount with a new key instead.`);return}if(T)s!==n&&(Ne(n,s)?O.current.items=s:Me(n,s)?(O.current.items=s,e.addItems(s.slice(n.length))):(O.current.items=s,e.setItems(s),a=!0));else if(n==null){let t=o??[];O.current.items=t,t.length>0&&(e.setItems(t),a=!0)}S!==void 0&&e.setSelectedLines(S,{notify:!1});let c=e.setSlotCoordinator(W),l=!1;W!==i&&((W==null||i==null)&&(l=!0),O.current.slotCoordinator=W),(a||c)&&e.render(!0),c&&W==null&&V.publish(void 0),l&&re({})}finally{O.current.disableFlushSync=!1}}),(0,Y.useImperativeHandle)(t,()=>({addItems(e){let{controlled:t,instance:n}=O.current;Q(t,`addItems`),n==null?console.error(`CodeView.addItems: no valid instance to append items with`,e):n.addItems(e)},getItem(e){let{instance:t}=O.current;if(t==null){console.error(`CodeView.getItem: no valid instance exists`,e);return}else return t.getItem(e)},removeItem(e){let{controlled:t,instance:n}=O.current;return Q(t,`removeItem`),n==null?(console.error(`CodeView.removeItem: no valid instance to remove item from`,e),!1):n.removeItem(e)},updateItem(e){let{controlled:t,instance:n}=O.current;return Q(t,`updateItem`),n==null?(console.error(`CodeView.updateItem: no valid instance to update item with`,e),!1):n.updateItem(e)},updateItemId(e,t){let{controlled:n,instance:r}=O.current;return Q(n,`updateItemId`),r==null?(console.error(`CodeView.updateItemId: no valid instance to update item id with`,e,t),!1):r.updateItemId(e,t)},scrollTo(e){let{instance:t}=O.current;t==null?console.error(`CodeView.scrollTo: no valid instance to scroll with`,e):t.scrollTo(e)},setSelectedLines(e){let{instance:t}=O.current;t==null?console.error(`CodeView.setSelectedLines: no valid instance to update selection with`,e):(t.setSelectedLines(e,{notify:!1}),F(e))},getSelectedLines(){let{instance:e}=O.current;return e==null?(console.error(`CodeView.getSelectedLines: no valid instance exists`),null):e.getSelectedLines()},clearSelectedLines(){let{instance:e}=O.current;e==null?console.error(`CodeView.clearSelectedLines: no valid instance to update selection with`):(e.clearSelectedLines({notify:!1}),F(null))},getEditor(e){let{instance:t}=O.current;if(t==null){console.error(`CodeView.getEditor: no valid instance exists`,e);return}return t.getEditor(e)},getInstance(){return O.current.instance}}),[F]),(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{ref:H,className:n,style:C}),(ee||N||P)&&(0,Z.jsx)(Ie,{managedContentStore:V,renderCustomHeader:_,renderHeaderPrefix:x,renderHeaderFilenameSuffix:y,renderHeaderMetadata:b,renderAnnotation:p,renderGutterUtility:v,renderCodeViewHeader:g,renderCodeViewFooter:h})]})}var je=(0,Y.forwardRef)(Ae);function Me(e,t){if(e==null||t.length<=e.length)return!1;if(e.length===0)return!0;for(let n=0;n<e.length;n++)if(t[n]!==e[n])return!1;return!0}function Ne(e,t){if(e==null||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Q(e,t){if(e)throw Error(`CodeView.${t} cannot be used when CodeView is controlled. Use initialItems for imperative item updates.`)}function Pe(){let e,t=new Set;return{getSnapshot(){return e},publish(n){if(!B(e,n)){e=n;for(let e of t)e()}},subscribe(e){return t.add(e),()=>{t.delete(e)}}}}function Fe({options:e,hasCustomHeader:t,hasGutterRenderer:n,hasCodeViewHeader:r,hasCodeViewFooter:i,onSelectedLinesChange:a,controlledSelection:o,createEditor:s,onItemEditChange:c,onItemEditComplete:l}){let u={...e,controlledSelection:o,onSelectedLinesChange:a,createEditor:s};return c!=null&&(u.onItemEditChange=c),l!=null&&(u.onItemEditComplete=l),t&&(u.renderCustomHeader=$),n&&(u.renderGutterUtility=$),r&&(u.renderCodeViewHeader=$),i&&(u.renderCodeViewFooter=$),u}var Ie=(0,Y.memo)(function({managedContentStore:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderFilenameSuffix:r,renderHeaderMetadata:i,renderAnnotation:a,renderGutterUtility:o,renderCodeViewHeader:s,renderCodeViewFooter:c}){"use no memo";let l=w(t=>e.subscribe(t)),u=w(()=>e.getSnapshot()),d=(0,Y.useSyncExternalStore)(l,u,u),f=``;for(let e of d?.items??[])f+=`${e.id}:${e.version}:${e.type}`;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Y.useMemo)(()=>d?.items?.map(e=>(0,X.createPortal)(Le({renderedItem:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderFilenameSuffix:r,renderHeaderMetadata:i,renderAnnotation:a,renderGutterUtility:o}),e.element,e.id)),[t,n,r,i,a,o,f]),(0,Y.useMemo)(()=>s!=null&&d?.header!=null?(0,X.createPortal)(s(),d.header):null,[s,d?.header]),(0,Y.useMemo)(()=>c!=null&&d?.footer!=null?(0,X.createPortal)(c(),d.footer):null,[c,d?.footer])]})});function Le({renderedItem:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderFilenameSuffix:r,renderHeaderMetadata:i,renderAnnotation:a,renderGutterUtility:o}){if(e.type===`diff`){let{item:s,instance:c}=e;return E({fileDiff:s.fileDiff,renderCustomHeader:t==null?void 0:()=>t(s),renderHeaderPrefix:n==null?void 0:()=>n(s),renderHeaderFilenameSuffix:r==null?void 0:()=>r(s),renderHeaderMetadata:i==null?void 0:()=>i(s),renderAnnotation:a==null?void 0:e=>a(e,s),lineAnnotations:s.annotations,renderGutterUtility:o==null?void 0:e=>o(e,s),getHoveredLine:c.getHoveredLine})}else{let{item:s,instance:c}=e;return p({file:s.file,renderCustomHeader:t==null?void 0:()=>t(s),renderHeaderPrefix:n==null?void 0:()=>n(s),renderHeaderFilenameSuffix:r==null?void 0:()=>r(s),renderHeaderMetadata:i==null?void 0:()=>i(s),renderAnnotation:a==null?void 0:e=>a(e,s),lineAnnotations:s.annotations,renderGutterUtility:o==null?void 0:e=>o(e,s),getHoveredLine:c.getHoveredLine})}}function $(){}function Re(e,t){return e.length>0&&e.every(e=>t.has(e))}function ze(e,t){return Re(e,t)?new Set:new Set(e)}var Be=function(e){return e.disabled=`data-disabled`,e.orientation=`data-orientation`,e.multiple=`data-multiple`,e}({}),Ve={multiple(e){return e?{[Be.multiple]:``}:null}},He=Y.forwardRef(function(e,t){let{defaultValue:n,disabled:r=!1,loopFocus:i=!0,onValueChange:s,orientation:c=`horizontal`,multiple:f=!1,value:p,className:m,render:h,style:g,..._}=e,v=a(!0),y=Y.useMemo(()=>p!==void 0||n!==void 0,[p,n]),b=(v?.disabled??!1)||r,[x,S]=u({controlled:p,default:p===void 0?n??o:void 0,name:`ToggleGroup`,state:`value`}),C=l((e,t,n)=>{let r;f?(r=x.slice(),t?r.push(e):r.splice(x.indexOf(e),1)):r=t?[e]:[],s?.(r,n),!n.isCanceled&&S(r)}),w={disabled:b,multiple:f,orientation:c},T=Y.useMemo(()=>({disabled:b,orientation:c,setGroupValue:C,value:x,isValueInitialized:y}),[b,c,C,x,y]),E={role:`group`},D=d(`div`,e,{enabled:!!v,state:w,ref:t,props:[E,_],stateAttributesMapping:Ve});return(0,Z.jsx)(M.Provider,{value:T,children:v?D:(0,Z.jsx)(ee,{render:h,className:m,style:g,state:w,refs:[t],props:[E,_],stateAttributesMapping:Ve,loopFocus:i,enableHomeAndEndKeys:!0,orientation:c})})}),Ue=i(),We=Y.createContext({size:`default`,variant:`default`});function Ge(e){let t=(0,Ue.c)(24),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({className:r,variant:a,size:o,orientation:s,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let l=a===void 0?`default`:a,u=o===void 0?`default`:o,d=s===void 0?`horizontal`:s,f;t[7]!==u||t[8]!==l?(f={size:u,variant:l},t[7]=u,t[8]=l,t[9]=f):f=t[9];let p=f,m=d===`horizontal`?`*:pointer-coarse:after:min-w-auto`:`*:pointer-coarse:after:min-h-auto`,h=l==="default"?`gap-0.5`:d===`horizontal`?`*:not-first:not-data-[slot=separator]:before:-start-[0.5px] *:not-last:not-data-[slot=separator]:before:-end-[0.5px] *:not-first:rounded-s-none *:not-last:rounded-e-none *:not-first:border-s-0 *:not-last:border-e-0 *:not-first:before:rounded-s-none *:not-last:before:rounded-e-none`:`*:not-first:not-data-[slot=separator]:before:-top-[0.5px] *:not-last:not-data-[slot=separator]:before:-bottom-[0.5px] flex-col *:not-first:rounded-t-none *:not-last:rounded-b-none *:not-first:border-t-0 *:not-last:border-b-0 *:not-first:before:rounded-t-none *:not-last:before:rounded-b-none *:data-[slot=toggle]:not-last:before:hidden dark:*:last:before:hidden dark:*:first:before:block`,g;t[10]!==r||t[11]!==m||t[12]!==h?(g=c(`flex w-fit *:focus-visible:z-10 dark:*:[[data-slot=separator]:has(+[data-slot=toggle]:hover)]:before:bg-input/64 dark:*:[[data-slot=separator]:has(+[data-slot=toggle][data-pressed])]:before:bg-input dark:*:[[data-slot=toggle]:hover+[data-slot=separator]]:before:bg-input/64 dark:*:[[data-slot=toggle][data-pressed]+[data-slot=separator]]:before:bg-input`,m,h,r),t[10]=r,t[11]=m,t[12]=h,t[13]=g):g=t[13];let _;t[14]!==n||t[15]!==p?(_=(0,Z.jsx)(We,{value:p,children:n}),t[14]=n,t[15]=p,t[16]=_):_=t[16];let v;return t[17]!==d||t[18]!==i||t[19]!==u||t[20]!==g||t[21]!==_||t[22]!==l?(v=(0,Z.jsx)(He,{className:g,"data-size":u,"data-slot":`toggle-group`,"data-variant":l,orientation:d,...i,children:_}),t[17]=d,t[18]=i,t[19]=u,t[20]=g,t[21]=_,t[22]=l,t[23]=v):v=t[23],v}function Ke(e){let t=(0,Ue.c)(12),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,children:n,variant:o,size:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=Y.use(We),c=o??s.variant,l=a??s.size,u;return t[6]!==n||t[7]!==r||t[8]!==i||t[9]!==l||t[10]!==c?(u=(0,Z.jsx)(j,{className:r,"data-size":l,"data-variant":c,size:l,variant:c,...i,children:n}),t[6]=n,t[7]=r,t[8]=i,t[9]=l,t[10]=c,t[11]=u):u=t[11],u}export{je as a,I as c,ze as i,Ge as n,R as o,Re as r,L as s,Ke as t};
|
|
2
|
+
//# sourceMappingURL=toggle-group-B7VPLYFz.js.map
|
package/dist/client/index.html
CHANGED
|
@@ -90,15 +90,15 @@
|
|
|
90
90
|
does not flash a stage label the client will not use.
|
|
91
91
|
-->
|
|
92
92
|
<title>P4 Code</title>
|
|
93
|
-
<script type="module" crossorigin src="/assets/index-
|
|
93
|
+
<script type="module" crossorigin src="/assets/index-BQOf0qjc.js"></script>
|
|
94
94
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-QTnfLwEv.js">
|
|
95
95
|
<link rel="modulepreload" crossorigin href="/assets/compiler-runtime-CLAvuQ-D.js">
|
|
96
96
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-CEhsl8MR.js">
|
|
97
|
-
<link rel="modulepreload" crossorigin href="/assets/textarea-
|
|
98
|
-
<link rel="modulepreload" crossorigin href="/assets/
|
|
97
|
+
<link rel="modulepreload" crossorigin href="/assets/textarea-BrbECJ8l.js">
|
|
98
|
+
<link rel="modulepreload" crossorigin href="/assets/collapsible-rU_2mbwU.js">
|
|
99
99
|
<link rel="modulepreload" crossorigin href="/assets/env-jW24S9HL.js">
|
|
100
|
-
<link rel="modulepreload" crossorigin href="/assets/entities-
|
|
101
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
100
|
+
<link rel="modulepreload" crossorigin href="/assets/entities-CFKxsn8K.js">
|
|
101
|
+
<link rel="stylesheet" crossorigin href="/assets/index-DQqa12Zh.css">
|
|
102
102
|
</head>
|
|
103
103
|
<body>
|
|
104
104
|
<div id="root">
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { f as selectLayoutItems, r as computeLayout, u as resolveValue } from "./runtime-
|
|
3
|
+
import { f as selectLayoutItems, r as computeLayout, u as resolveValue } from "./runtime-DC_ewLnZ.mjs";
|
|
4
4
|
import Konva from "konva";
|
|
5
5
|
import "konva/skia-backend";
|
|
6
6
|
import { Canvas, FontLibrary, Image } from "skia-canvas";
|
|
@@ -423,4 +423,4 @@ function createRenderer(width, height) {
|
|
|
423
423
|
//#endregion
|
|
424
424
|
export { createRenderer, rasterizeSvg, renderDesignExport, renderDesignPng };
|
|
425
425
|
|
|
426
|
-
//# sourceMappingURL=renderer-
|
|
426
|
+
//# sourceMappingURL=renderer-DZwr3Qmo.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { T as DesignDocument, j as DesignNode } from "./src-
|
|
3
|
+
import { T as DesignDocument, j as DesignNode } from "./src-DjTfFS-z.mjs";
|
|
4
4
|
import * as Schema from "effect/Schema";
|
|
5
5
|
//#region ../../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/utils.js
|
|
6
6
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
@@ -981,4 +981,4 @@ function semanticDiff(before, after) {
|
|
|
981
981
|
//#endregion
|
|
982
982
|
export { documentContentDigest as a, parseDesign as c, reviewState as d, selectLayoutItems as f, diagnostic as i, patchNode as l, validateDesign as m, canonicalSerialize as n, fileHash as o, semanticDiff as p, computeLayout as r, isConfinedRelativePath as s, buildIndexes as t, resolveValue as u };
|
|
983
983
|
|
|
984
|
-
//# sourceMappingURL=runtime-
|
|
984
|
+
//# sourceMappingURL=runtime-DC_ewLnZ.mjs.map
|
|
@@ -16827,6 +16827,16 @@ const DesignHostTheme = Schema$1.Literals([
|
|
|
16827
16827
|
"atelier",
|
|
16828
16828
|
"night"
|
|
16829
16829
|
]);
|
|
16830
|
+
const DesignHostDisplaySize = Schema$1.Literals([
|
|
16831
|
+
"small",
|
|
16832
|
+
"medium",
|
|
16833
|
+
"large"
|
|
16834
|
+
]);
|
|
16835
|
+
const DesignHostCursorLabel = Schema$1.Literals([
|
|
16836
|
+
"name",
|
|
16837
|
+
"agent",
|
|
16838
|
+
"none"
|
|
16839
|
+
]);
|
|
16830
16840
|
const PreferredPort = Schema$1.Int.check(Schema$1.isBetween({
|
|
16831
16841
|
minimum: 0,
|
|
16832
16842
|
maximum: 65535
|
|
@@ -16840,14 +16850,30 @@ const DesignHostSettings = Schema$1.Struct({
|
|
|
16840
16850
|
/** The port the next start asks for; 0 means any free port. */
|
|
16841
16851
|
preferredPort: PreferredPort,
|
|
16842
16852
|
/** The desktop app keeps the server running after its window closes. */
|
|
16843
|
-
keepRunning: Schema$1.Boolean
|
|
16853
|
+
keepRunning: Schema$1.Boolean,
|
|
16854
|
+
showPixelGrid: Schema$1.Boolean,
|
|
16855
|
+
scrollWheelZoom: Schema$1.Boolean,
|
|
16856
|
+
invertZoom: Schema$1.Boolean,
|
|
16857
|
+
chatTextSize: DesignHostDisplaySize,
|
|
16858
|
+
agentCursorSize: DesignHostDisplaySize,
|
|
16859
|
+
agentCursorLabel: DesignHostCursorLabel,
|
|
16860
|
+
animations: Schema$1.Boolean,
|
|
16861
|
+
showHomeInput: Schema$1.Boolean
|
|
16844
16862
|
});
|
|
16845
16863
|
/** Only the given fields change. A blank `reviewerName` restores the default name. */
|
|
16846
16864
|
const DesignHostSettingsPatch = Schema$1.Struct({
|
|
16847
16865
|
theme: Schema$1.optional(DesignHostTheme),
|
|
16848
16866
|
reviewerName: Schema$1.optional(ReviewerName),
|
|
16849
16867
|
preferredPort: Schema$1.optional(PreferredPort),
|
|
16850
|
-
keepRunning: Schema$1.optional(Schema$1.Boolean)
|
|
16868
|
+
keepRunning: Schema$1.optional(Schema$1.Boolean),
|
|
16869
|
+
showPixelGrid: Schema$1.optional(Schema$1.Boolean),
|
|
16870
|
+
scrollWheelZoom: Schema$1.optional(Schema$1.Boolean),
|
|
16871
|
+
invertZoom: Schema$1.optional(Schema$1.Boolean),
|
|
16872
|
+
chatTextSize: Schema$1.optional(DesignHostDisplaySize),
|
|
16873
|
+
agentCursorSize: Schema$1.optional(DesignHostDisplaySize),
|
|
16874
|
+
agentCursorLabel: Schema$1.optional(DesignHostCursorLabel),
|
|
16875
|
+
animations: Schema$1.optional(Schema$1.Boolean),
|
|
16876
|
+
showHomeInput: Schema$1.optional(Schema$1.Boolean)
|
|
16851
16877
|
});
|
|
16852
16878
|
/**
|
|
16853
16879
|
* What the server knows about an agent, keyed by `agentLabel` (the MCP client name). It appears
|
|
@@ -17002,4 +17028,4 @@ RpcGroup.make(
|
|
|
17002
17028
|
//#endregion
|
|
17003
17029
|
export { FeedSourceUpsertInput as $, PreviewAutomationStatus as $a, MODEL_SLUG_ALIASES_BY_PROVIDER as $c, UserInputQuestion as $i, CommandId as $l, P4_PROJECT_FILE_NAME as $n, DEFAULT_COMPRESS_MODE as $o, TaskUpdateInput as $r, ProjectMetaUpdatedPayload as $s, ThreadContextUpdateInput as $t, DesignLibraryManifest as A, PreviewAutomationClientDisconnectedError as Aa, ThreadPullRequestLink as Ac, anyWorktreeRuleEnabled as Ai, HubClientRevokeInput as Al, ThreadAdviseNotPermittedError as An, HubNotificationPreferences as Ao, OpenRouterToolFailedError as Ar, OrchestrationGetSnapshotError as As, AGENT_ASSET_FILE_MAX_CHARS as At, DesignValidateRequest as B, PreviewAutomationPressInput as Ba, ThreadSnoozedPayload as Bc, KeybindingsConfig as Bi, AuthOrchestrationOperateScope as Bl, ThreadRequestResult as Bn, ThreadEvidenceReportActivity as Bo, TaskGetInput as Br, OrchestrationSearchThreadsError as Bs, AssetCompressInput as Bt, DesignApplyReceipt as C, ExternalLauncherBrowserSpawnError as Ca, ThreadPairGateId as Cc, DeviceToolTargetInput as Ci, VcsRepositoryDetectionError as Cl, ThreadSpawnResult as Cn, HUB_TUNNEL_INITIAL_WINDOW_BYTES as Co, ServerSettingsError as Cr, OrchestrationCheckpointSummary as Cs, FilesystemBrowseError as Ct, DesignGuideRequest as D, ExternalLauncherUnsupportedEditorError as Da, ThreadPinReorderedPayload as Dc, DEFAULT_WORKTREE_CLEANUP_SETTINGS as Di, HubClientEnrollmentExchange as Dl, AdviseToolUnavailableError as Dn, HubAgentActivityInput as Do, OpenRouterChatInput as Dr, OrchestrationEventMetadata as Ds, mcpOAuthStorageName as Dt, DesignGuideReceipt as E, ExternalLauncherUnknownEditorError as Ea, ThreadPairTriageAdvancedPayload as Ec, SshDeviceHostConfig as Ei, HubClientAssetGrantInput as El, ThreadWaitResult as En, HubTunnelControl as Eo, OpenRouterApiKeyError as Er, OrchestrationEvent as Es, McpServerRegistration as Et, DesignStatusReceipt as F, PreviewAutomationInvalidSelectorError as Fa, ThreadRuntimeModeSetPayload as Fc, planSettingsSync as Fi, AuthAccessTokenType as Fl, ThreadAskNotPermittedError as Fn, HubAnalyticsQuery as Fo, HubTaskCreateInput as Fr, OrchestrationMessageRole as Fs, AgentAssetListFilter as Ft, FeedCleanupResult as G, PreviewAutomationResizeInput as Ga, ThreadUnsnoozedPayload as Gc, PluginManifest as Gi, EnvironmentAuthorizationError as Gl, TicketResolveError as Gn, ThreadWatchFailedError as Go, TaskNotStartableError as Gr, OrchestrationThreadActivityTone as Gs, MemoryAppendInput as Gt, FeedArticle as H, PreviewAutomationRecordingStatus as Ha, ThreadUnarchivedPayload as Hc, MODEL_PICKER_JUMP_KEYBINDING_COMMANDS as Hi, AuthReviewWriteScope as Hl, TrackerApiKeyError as Hn, ThreadEvidenceReportResult as Ho, TaskListFilter as Hr, OrchestrationSessionStatus as Hs, AssetCompressResult as Ht, DesignStatusRequest as I, PreviewAutomationMalformedResponseError as Ia, ThreadScheduledTaskCancelledPayload as Ic, describeFusionPromptRejection as Ii, AuthAccessWriteScope as Il, ThreadAskResult as In, THREAD_EVIDENCE_REPORT_MAX_CHARS as Io, HubTaskPutInput as Ir, OrchestrationProposedPlanId as Is, AgentAssetName as It, FeedListResult as J, PreviewAutomationScrollInput as Ja, ANTIGRAVITY_DEFAULT_MODEL as Jc, ResourceMonitorCommand as Ji, isChatProject as Jl, ProjectListEntriesError as Jn, ThreadWatchReviewResult as Jo, TaskSourceSelector as Jr, PROVIDER_SEND_TURN_MAX_DOCUMENT_BYTES as Js, ThreadCleanupResult as Jt, FeedEngagement as K, PreviewAutomationResizeResult as Ka, ThreadWorkspaceLifecycle as Kc, DesktopHostTelemetryMessage as Ki, ServerAuthSessionMethod as Kl, TicketResolveInput as Kn, ThreadWatchNotPermittedError as Ko, TaskProposeInput as Kr, OrchestrationThreadPairGate as Ks, MemoryAppendResult as Kt, DesignStylesReceipt as L, PreviewAutomationNavigateInput as La, ThreadScheduledTaskCreatedPayload as Lc, rejectFusionPromptOverride as Li, AuthAdministrativeScopes as Ll, ThreadAskToolError as Ln, THREAD_REVIEW_ITEM_MAX_BYTES as Lo, Task as Lr, OrchestrationReadModel as Ls, AgentAssetWriteInput as Lt, DesignRenderReceipt as M, PreviewAutomationError as Ma, ThreadPullRequestsUpdatedPayload as Mc, SETTINGS_SYNC_FILE_PATH as Mi, HubServerMembership as Ml, ThreadAdviseToolError as Mn, HUB_ANALYTICS_QUERY_LIMITS as Mo, TypeSafeAskInput as Mr, OrchestrationGetTurnDiffResult as Ms, AgentAsset as Mt, DesignRenderRequest as N, PreviewAutomationEvaluateInput as Na, ThreadQueuedMessageRemovedPayload as Nc, SettingsSyncPayload as Ni, AuthAccessReadScope as Nl, ThreadAskFailedError as Nn, HubAnalyticsFactInput as No, TypeSafeAskResult as Nr, OrchestrationGetWorkflowScriptError as Ns, AgentAssetFiles as Nt, DesignInspectReceipt as O, PREVIEW_AUTOMATION_V1_OPERATIONS as Oa, ThreadPinnedPayload as Oc, EMPTY_WORKTREE_CLEANUP_PREVIEW as Oi, HubClientEnrollmentInput as Ol, ThreadAdviseFailedError as On, HubLiveActivityRegistrationInput as Oo, OpenRouterChatResult as Or, OrchestrationEventType as Os, mcpSecretStorageName as Ot, DesignSelection as P, PreviewAutomationExecutionError as Pa, ThreadRevertedPayload as Pc, filterSyncedSettings as Pi, AuthAccessStreamError as Pl, ThreadAskInput as Pn, HubAnalyticsPage as Po, DEFAULT_TASK_SOURCE as Pr, OrchestrationMessage as Ps, AgentAssetKind as Pt, FeedSourceId as Q, PreviewAutomationSnapshotInput as Qa, DEFAULT_TEXT_GENERATION_MODEL_BY_PROVIDER as Qc, MONITOR_TOOL_TASK_TYPES as Qi, CheckpointRef as Ql, P4ProjectFile as Qn, CompressMode as Qo, TaskToolUnavailableError as Qr, ProjectDeletedPayload as Qs, ThreadContextSummarizer as Qt, DesignStylesRequest as R, PreviewAutomationNoAvailableHostError as Ra, ThreadScheduledTaskFiredPayload as Rc, resolveFusionPromptOverride as Ri, AuthClientMetadataDeviceType as Rl, ThreadGateRespondInput as Rn, THREAD_REVIEW_MAX_BYTES as Ro, TaskCreateInput as Rr, OrchestrationScheduledTaskId as Rs, HubLinkError as Rt, DesignSubscribeRequest as S, EDITORS as Sa, ThreadPairGateAdvancedPayload as Sc, DeviceToolScreenshotResult as Si, VcsProcessTimeoutError as Sl, ThreadSpawnNotPermittedError as Sn, EnvironmentScopeRequiredError as So, ServerSettings as Sr, OrchestrationCheckpointStatus as Ss, AssetWorkspaceRootNormalizationError as St, DesignDocument as T, ExternalLauncherEditorSpawnError as Ta, ThreadPairGateResolvedPayload as Tc, LOCAL_DEVICE_HOST_ID as Ti, HubAccountId as Tl, ThreadWaitInput as Tn, HUB_TUNNEL_WEBSOCKET_PROTOCOL as To, DEFAULT_OPENROUTER_DECISIONS_MODEL as Tr, OrchestrationDispatchCommandError as Ts, McpServerName as Tt, FeedArticleId as U, PreviewAutomationRemoteUnavailableError as Ua, ThreadUnpinnedPayload as Uc, ResolvedKeybindingRule as Ui, AuthStandardClientScopes as Ul, TicketCommentInput as Un, ThreadWatchEventsInput as Uo, TaskNotFoundError as Ur, OrchestrationShellSnapshot as Us, AssetCompressValidationFailedError as Ut, FEED_CATEGORIES as V, PreviewAutomationRecordingArtifact as Va, ThreadTurnDiffCompletedPayload as Vc, KeybindingsConfigError as Vi, AuthOrchestrationReadScope as Vl, SupervisorApiKeyError as Vn, ThreadEvidenceReportInput as Vo, TaskLabel as Vr, OrchestrationSession as Vs, AssetCompressRefusedError as Vt, FeedCleanupInput as W, PreviewAutomationRequestQueueClosedError as Wa, ThreadUnpromptedSubagentsSetPayload as Wc, THREAD_JUMP_KEYBINDING_COMMANDS as Wi, AuthTerminalOperateScope as Wl, TicketCommentResult as Wn, ThreadWatchEventsResult as Wo, TaskNotLinkedError as Wr, OrchestrationThread as Ws, MemoryAppendFailedError as Wt, FeedRefreshResult as X, PreviewAutomationSetColorSchemeResult as Xa, DEFAULT_MODEL_BY_PROVIDER as Xc, INERT_TASK_TYPES as Xi, ApprovalRequestId as Xl, ProjectSearchEntriesError as Xn, WatchToolUnavailableError as Xo, TaskStoreError as Xr, PROVIDER_SEND_TURN_MAX_INPUT_CHARS as Xs, ThreadConfigureResult as Xt, FeedMarkReadInput as Y, PreviewAutomationSetColorSchemeInput as Ya, DEFAULT_MODEL as Yc, ResourceMonitorEvent as Yi, AgentAssetId as Yl, ProjectReadFileError as Yn, ThreadWatchToolError as Yo, TaskStatus as Yr, PROVIDER_SEND_TURN_MAX_IMAGE_BYTES as Ys, ThreadConfigureInput as Yt, FeedSource as Z, PreviewAutomationSnapshot as Za, DEFAULT_TEXT_GENERATION_MODEL as Zc, MONITOR_TASK_TYPES as Zi, AuthSessionId as Zl, ProjectWriteFileError as Zn, ChatAttachment as Zo, TaskToolError as Zr, ProjectCreatedPayload as Zs, ThreadContextReadResult as Zt, UserInputRankingError as _, TerminalNotRunningError as _a, ThreadMessageSentPayload as _c, DeviceToolCloseInput as _i, VcsProcessMissingExitCodeError as _l, ThreadRenameRejectedError as _n, EnvironmentHttpCommonError as _o, DEFAULT_SERVER_SETTINGS as _r, ModelSelection as _s, AssetWorkspaceAssetNotFoundError as _t, ComputerUseDeviceRequest as a, UsageLimitSourceId as aa, ProviderSessionRuntimeStatus as ac, DeviceColorFilter as ai, isProviderDriverKind as al, ThreadMergeChildResult as an, PreviewAutomationUnavailableError as ao, ServerProcessResourceHistoryFailureTag as ar, FUSION_GATE_DEFAULT_TIMEOUT_MS as as, parentThreadIdFromSidechat as at, PortSchema as au, DesignRpcGroup as b, TerminalWriteError as ba, ThreadPairCursorAdvancedPayload as bc, DeviceToolOpenInput as bi, VcsProcessSpawnError as bl, ThreadSnoozeResult as bn, EnvironmentRequestInvalidError as bo, OpenCodeSettings as br, OrchestrationAggregateKind as bs, AssetWorkspacePathValidationError as bt, ComputerUseHostRegistration as c, ProviderRespondToUserInputInput as ca, ThreadActivityAppendedPayload as cc, DeviceHostId as ci, PullRequestUnavailableError as cl, ThreadPairCreateInput as cn, FILL_PREVIEW_VIEWPORT as co, ServerSelfUpdateError as cr, FUSION_GATE_UNWATCHED_SUMMARY as cs, AssetLocalFileNotFoundError as ct, ProviderItemId as cu, ComputerUseJsInput as d, ProviderStopSessionInput as da, ThreadCompressModeSetPayload as dc, DeviceListInput as di, resolvePullRequestAuthorFilter as dl, ThreadPairDetachResult as dn, PreviewTabId as do, ClaudeSettings as dr, FUSION_RETRY_PROMPT_PREFIX as ds, AssetPreviewTypeValidationError as dt, RuntimeTaskId as du, WorkflowScriptProvenance as ea, ProjectScript as ec, UNKNOWN_TASK_STATUS_FALLBACK as ei, ModelCapabilities as el, ThreadContextUpdateResult as en, PreviewAutomationTabNotFoundError as eo, GitCommandError as er, DEFAULT_PROVIDER_INTERACTION_MODE as es, FeedSummary as et, EnvironmentId as eu, ComputerUseOutput as f, DEFAULT_TERMINAL_ID as fa, ThreadComputerUseGrantSetPayload as fc, DeviceNotFoundError as fi, SourceControlProviderError as fl, ThreadPlanReadInput as fn, DesktopBackendBootstrap as fo, CodexSettings as fr, FUSION_REVIEW_MESSAGE_ID_PREFIX as fs, AssetProjectFaviconInspectionError as ft, TaskId as fu, ProviderSetupError as g, TerminalHistoryError as ga, ThreadMessageQueuedPayload as gc, DeviceSessionDetailInput as gi, VcsProcessExitError as gl, ThreadRenameInput as gn, EnvironmentHttpApi as go, DEFAULT_PROVIDER_HEALTH_REFRESH_INTERVAL as gr, JEV_CONSULTED_ACTIVITY_KIND as gs, AssetWorkspaceAssetInspectionError as gt, TurnId as gu, DeviceCommandResult as h, TerminalCwdStatError as ha, ThreadInteractionModeSetPayload as hc, DevicePlatformUnavailableError as hi, VcsDriverKind as hl, ThreadPlanUpdateResult as hn, EnvironmentAuthenticatedPrincipal as ho, DEFAULT_JEV_ROLE_ROUTING_MIN_CONFIDENCE as hr, FusionReviewPolicy as hs, AssetSigningKeyLoadError as ht, TrimmedNonEmptyString as hu, COMPUTER_USE_MAX_OUTPUT_CHARS as i, UsageLimitSourceError as ia, ProviderInteractionMode as ic, DeviceBootError as ii, defaultInstanceIdForDriver as il, ThreadMergeChildInput as in, PreviewAutomationTypeInput as io, ServerLocalCliUpdateError as ir, FUSION_EVIDENCE_REPORT_REPAIR_MESSAGE_ID_PREFIX as is, isSidechatThreadId as it, NonNegativeInt as iu, DesignNode as j, PreviewAutomationControlInterruptedError as ja, ThreadPullRequestStack as jc, SETTINGS_SYNC_ASSET_NAME as ji, HubClientSocketTicketInput as jl, ThreadAdviseResult as jn, HubPushRegistrationInput as jo, TypeSafeAskFailedError as jr, OrchestrationGetTurnDiffError as js, AGENT_ASSET_TOTAL_MAX_BYTES as jt, DesignInspectRequest as k, PreviewAutomationClickInput as ka, ThreadProposedPlanUpsertedPayload as kc, WORKTREE_CLEANUP_RULES as ki, HubClientId as kl, ThreadAdviseInput as kn, HubLiveActivityRemoveInput as ko, OpenRouterDecideInput as kr, OrchestrationGetFullThreadDiffError as ks, mcpUserScopeSessionName as kt, ComputerUseHostReport as l, ProviderSendTurnInput as la, ThreadArchivedPayload as lc, DeviceHostUnavailableError as li, pullRequestHostOf as ll, ThreadPairCreateResult as ln, PreviewInvalidUrlError as lo, isProviderAvailable as lr, FUSION_JEV_PROMPT_PREFIX as ls, AssetLocalPathValidationError as lt, RuntimeItemId as lu, DeviceCommandInput as m, TerminalCwdNotFoundError as ma, ThreadDeletedPayload as mc, DevicePlatformAvailability as mi, SourceControlRepositoryError as ml, ThreadPlanUpdateInput as mn, EnvironmentAuthenticatedAuth as mo, DEFAULT_AUTOMATIC_GIT_FETCH_INTERVAL as mr, FusionReviewExperiment as ms, AssetProjectFaviconResolutionError as mt, ThreadPairId as mu, WsRpcGroup as n, ProviderResetCreditError as na, ProjectionPendingApprovalStatus as nc, DeviceActionInput as ni, ProviderDriverKind as nl, ThreadControlRejectedError as nn, PreviewAutomationTargetNotEditableError as no, GitPullRequestMaterializationError as nr, FUSION_ACTIVATION_PROMPT_PREFIX as ns, BtwAskError as nt, IsoDateTime as nu, ComputerUseEnrollmentRequest as o, ProviderInterruptTurnInput as oa, ProviderUserInputAnswers as oc, DeviceDetail as oi, PullRequestOperationError as ol, ThreadMessageInput as on, PreviewAutomationUnsupportedClientError as oo, ServerProvider as or, FUSION_GATE_MESSAGE_ID_PREFIX as os, AssetAttachmentNotFoundError as ot, PositiveInt as ou, ComputerUseSourceAttestation as p, TerminalCwdNotDirectoryError as pa, ThreadCreatedPayload as pc, DeviceOperationError as pi, SourceControlProviderKind as pl, ThreadPlanReadResult as pn, EnvironmentAuthInvalidError as po, CursorSettings as pr, FUSION_REVIEW_PROMPT_PREFIX as ps, AssetProjectFaviconNotFoundError as pt, ThreadId as pu, FeedError as q, PreviewAutomationResultTooLargeError as qa, orchestrationThreadNotFoundMessage as qc, DesktopTelemetryControlMessage as qi, P4_CHAT_PROJECT_ID as ql, TicketResolveResult as qn, ThreadWatchReviewInput as qo, TaskProposeResult as qr, OrchestrationThreadSearchSource as qs, ThreadCleanupInput as qt, COMPUTER_USE_DEFAULT_TIMEOUT_MS as r, ProviderResetCreditOutcome as ra, ProviderApprovalDecision as rc, DeviceActionUnavailableError as ri, ProviderInstanceId as rl, ThreadControlToolError as rn, PreviewAutomationTimeoutError as ro, TextGenerationError as rr, FUSION_ADVICE_PROMPT_PREFIX as rs, SIDECHAT_THREAD_ID_PREFIX as rt, MessageId as ru, ComputerUseError as s, ProviderRespondToRequestInput as sa, RuntimeMode as sc, DeviceDetailInput as si, PullRequestStack as sl, ThreadMessageResult as sn, PreviewAutomationWaitForInput as so, ServerProviderUpdateError as sr, FUSION_GATE_PROMPT_PREFIX as ss, AssetLocalFileInspectionError as st, ProjectId as su, WS_METHODS as t, isToolLifecycleItemType as ta, ProjectionPendingApprovalDecision as tc, isReadableTaskId as ti, PREFERRED_DEFAULT_CODEX_MODELS as tl, ThreadControlNotPermittedError as tn, PreviewAutomationTabTargetInput as to, GitManagerError as tr, DEFAULT_RUNTIME_MODE as ts, UsageReadError as tt, EventId as tu, ComputerUseHostResponse as u, ProviderSessionStartInput as ua, ThreadCompletionFields as uc, DeviceId as ui, pullRequestProviderRequirement as ul, ThreadPairDetachInput as un, PreviewSessionLookupError as uo, AntigravitySettings as ur, FUSION_NO_OBJECTION_TEXT as us, AssetMdxBuildError as ut, RuntimeRequestId as uu, DesignAssetRequest as v, TerminalResizeError as va, ThreadMetaUpdatedPayload as vc, DeviceToolError as vi, VcsProcessOutputLimitError as vl, ThreadRenameResult as vn, EnvironmentInternalError as vo, GrokSettings as vr, ORCHESTRATION_WS_METHODS as vs, AssetWorkspaceContextNotFoundError as vt, DesignApplyRequest as w, ExternalLauncherCommandNotFoundError as wa, ThreadPairGateOpenedPayload as wc, DeviceToolUnavailableError as wi, VcsUnsupportedOperationError as wl, ThreadToolUnavailableError as wn, HUB_TUNNEL_MAX_WINDOW_BYTES as wo, clampProviderHealthRefreshSeconds as wr, OrchestrationCommandReceiptStatus as ws, McpRegistryError as wt, DesignServiceError as x, DesktopPreviewScreenshotArtifactSchema as xa, ThreadPairDetachedPayload as xc, DeviceToolOpenResult as xi, VcsProcessStdinWriteError as xl, ThreadSpawnInput as xn, EnvironmentResourceNotFoundError as xo, STORAGE_CLEANUP_TARGETS as xr, OrchestrationCheckpointFile as xs, AssetWorkspaceResolutionError as xt, DesignHumanApplyRequest as y, TerminalSessionLookupError as ya, ThreadPairCreatedPayload as yc, DeviceToolListResult as yi, VcsProcessOutputReadError as yl, ThreadSnoozeInput as yn, EnvironmentOperationForbiddenError as yo, MuseSettings as yr, OrchestrationActorKind as ys, AssetWorkspaceContextResolutionError as yt, DesignValidateReceipt as z, PreviewAutomationOpenInput as za, ThreadSessionSetPayload as zc, KeybindingRule as zi, AuthEnvironmentScopes as zl, ThreadGateRespondResult as zn, THREAD_REVIEW_SCAN_LIMIT as zo, TaskCurrentInput as zr, OrchestrationScheduledTaskStatus as zs, agentAssetTotalBytes as zt };
|
|
17004
17030
|
|
|
17005
|
-
//# sourceMappingURL=src-
|
|
17031
|
+
//# sourceMappingURL=src-DjTfFS-z.mjs.map
|
package/package.json
CHANGED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,r as n,t as r}from"./compiler-runtime-CLAvuQ-D.js";import{Dc as i,Di as a,Ei as o,En as s,F as c,Fs as l,Is as u,L as d,Ls as ee,Mn as te,Oi as f,P as p,Rc as ne,Rl as m,Rs as h,Ti as re,Wc as g,Xc as _,Y as v,et as y,l as b,ll as x,mi as S,nl as ie,ui as C,vi as w,wi as ae,xn as T,yi as E}from"./textarea-CVN2-Kkx.js";import{g as D,x as oe}from"./previewAssetResource-J1WeeXS-.js";import{_ as se,m as O}from"./entities-fvtdKO2-.js";import{a as k,c as A,i as j,n as M,o as ce,r as le,s as ue,t as de}from"./toggle-group-Bs73JkcK.js";import{D as fe,Fi as pe,Nr as me,O as he,Sr as ge,X as _e,Xr as ve,Z as ye,Zr as be,cr as xe,ct as Se,dr as Ce,dt as we,fr as Te,ft as Ee,gr as De,h as Oe,ji as ke,k as N,lr as Ae,lt as je,mr as Me,ni as Ne,ot as Pe,p as Fe,pr as Ie,st as Le,ti as Re,ur as ze,ut as Be,xr as Ve,yr as He}from"./index-B4Nxc2w0.js";import{a as Ue,n as We}from"./fileCommentAnnotations-BPIepn3Q.js";var Ge=h(`pilcrow`,[[`path`,{d:`M13 4v16`,key:`8vvj80`}],[`path`,{d:`M17 4v16`,key:`7dpous`}],[`path`,{d:`M19 4H9.5a4.5 4.5 0 0 0 0 9H13`,key:`sh4n9v`}]]),P=e(n(),1);function Ke({threadRef:e,filePath:t,activeCwd:n,openInEditor:r,openFileSurface:a}){if(e){if(a){a(t);return}i.getState().openFile(e,t);return}r(n?D(t,n):t)}var F=r();function qe(e,t){let n=(0,F.c)(4),r=He(e,t),i;return n[0]!==r.data||n[1]!==r.error||n[2]!==r.isPending?(i={data:r.data,error:r.error,isPending:r.isPending},n[0]=r.data,n[1]=r.error,n[2]=r.isPending,n[3]=i):i=n[3],i}var I=t(),Je=[];function Ye(e){return(e.endSide??e.side)===`deletions`?`deletions`:`additions`}function L(e,t,n){let r=Ye(t),i=e.findIndex(e=>e.side===r&&e.lineNumber===t.end);return i<0?[...e,{side:r,lineNumber:t.end,metadata:{entries:[n]}}]:e.map((e,t)=>t===i?{...e,metadata:{entries:[...e.metadata.entries,n]}}:e)}function Xe(e){let t=(0,F.c)(50),{files:n,sectionId:r,sectionTitle:i,composerDraftTarget:a,options:o,viewerRef:c,className:l,renderHeaderPrefix:u}=e,d=T($e),ee=T(z),f;t[0]===a?f=t[1]:(f=e=>e.getComposerDraft(a)?.reviewComments??Je,t[0]=a,t[1]=f);let p=T(f),[ne,m]=(0,P.useState)(null),[h,re]=(0,P.useState)(null),g;t[2]===n?g=t[3]:(g=new Map(n.map(Qe)),t[2]=n,t[3]=g);let _=g,v;if(t[4]!==h||t[5]!==n||t[6]!==p||t[7]!==r){let e;t[9]!==h||t[10]!==p||t[11]!==r?(e=e=>{let{fileDiff:t,filePath:n,fileKey:i,collapsed:a}=e,o=p.filter(e=>e.sectionId===r&&e.filePath===n&&(e.fenceLanguage??`diff`)===`diff`).reduce((e,n)=>{let r=te(t,n);return r?L(e,r,{id:n.id,kind:`comment`,range:r,rangeLabel:n.rangeLabel,text:n.text}):e},[]),s=h?.fileKey===i?[...o,h.annotation]:o;return{id:i,type:`diff`,fileDiff:t,annotations:s,collapsed:a,version:Le(`${a?`1`:`0`}:${s.flatMap(R).join(`:`)}`)}},t[9]=h,t[10]=p,t[11]=r,t[12]=e):e=t[12],v=n.map(e),t[4]=h,t[5]=n,t[6]=p,t[7]=r,t[8]=v}else v=t[8];let y=v,b;t[13]!==a||t[14]!==h?.annotation||t[15]!==ee?(b=e=>{m(null),h?.annotation.metadata.entries.some(t=>t.id===e)?re(null):ee(a,e)},t[13]=a,t[14]=h?.annotation,t[15]=ee,t[16]=b):b=t[16];let x=b,S;t[17]!==d||t[18]!==a||t[19]!==h||t[20]!==_||t[21]!==r||t[22]!==i?(S=(e,t)=>{let n=h?.annotation.metadata.entries.find(t=>t.id===e),o=h?_.get(h.fileKey):void 0;if(!n||!o)return;let c=s({id:n.id,sectionId:r,sectionTitle:i,filePath:o.filePath,fileDiff:o.fileDiff,range:n.range,text:t});c&&d(a,c),m(null),re(null)},t[17]=d,t[18]=a,t[19]=h,t[20]=_,t[21]=r,t[22]=i,t[23]=S):S=t[23];let ie=S,C;t[24]!==_||t[25]!==r||t[26]!==i?(C=(e,t)=>{if(!e)return;let n=t.item;if(n.type!==`diff`)return;let a=_.get(n.id);if(!a)return;let o=We(),c=s({id:o,sectionId:r,sectionTitle:i,filePath:a.filePath,fileDiff:a.fileDiff,range:e,text:``});c&&re({fileKey:n.id,annotation:{side:Ye(e),lineNumber:e.end,metadata:{entries:[{id:o,kind:`draft`,range:e,rangeLabel:c.rangeLabel,text:``}]}}})},t[24]=_,t[25]=r,t[26]=i,t[27]=C):C=t[27];let w=C,ae=h!==null,E;t[28]===c?E=t[29]:(E=c?{ref:c}:{},t[28]=c,t[29]=E);let D;t[30]===l?D=t[31]:(D=l?{className:l}:{},t[30]=l,t[31]=D);let oe=!ae,se=!ae,O;t[32]!==w||t[33]!==o||t[34]!==se||t[35]!==oe?(O={...o,enableGutterUtility:oe,enableLineSelection:se,onLineSelectionEnd:w},t[32]=w,t[33]=o,t[34]=se,t[35]=oe,t[36]=O):O=t[36];let A;t[37]===u?A=t[38]:(A=e=>e.type===`diff`?u(e.fileDiff,e.id,e.collapsed===!0):null,t[37]=u,t[38]=A);let j;t[39]!==x||t[40]!==ie?(j=e=>(0,I.jsx)(`div`,{className:`py-1`,children:e.metadata.entries.map(e=>(0,I.jsx)(Ue,{kind:e.kind,rangeLabel:e.rangeLabel,text:e.text,onCancel:()=>x(e.id),onComment:t=>ie(e.id,t),onDelete:()=>x(e.id)},e.id))}),t[39]=x,t[40]=ie,t[41]=j):j=t[41];let M;return t[42]!==y||t[43]!==ne||t[44]!==O||t[45]!==A||t[46]!==j||t[47]!==E||t[48]!==D?(M=(0,I.jsx)(k,{...E,...D,items:y,selectedLines:ne,onSelectedLinesChange:m,options:O,renderHeaderPrefix:A,renderAnnotation:j}),t[42]=y,t[43]=ne,t[44]=O,t[45]=A,t[46]=j,t[47]=E,t[48]=D,t[49]=M):M=t[49],M}function R(e){return e.metadata.entries.map(Ze)}function Ze(e){return`${e.id}:${e.rangeLabel}:${e.text}`}function Qe(e){return[e.fileKey,e]}function z(e){return e.removeReviewComment}function $e(e){return e.addReviewComment}function et(e){return{diffPreview:g(e,{label:`environment-data:review:diff-preview`,tag:m.reviewGetDiffPreview,staleTimeMs:5e3})}}var tt=et(y);function B(e){return e.remoteName&&e.name.startsWith(`${e.remoteName}/`)?e.name.slice(e.remoteName.length+1):e.name}function nt(e,t){let n=new Set(t),r=e.map(e=>{let r=t.filter(t=>n.has(t)&&B(t)===e.name),i=r.find(e=>e.remoteName===`origin`)??r[0]??null;return i&&n.delete(i),{id:`local:${e.name}`,label:e.name,local:e,remote:i}}),i=t.filter(e=>n.has(e)).map(e=>({id:`remote:${e.name}`,label:e.name,local:null,remote:e}));return[...r,...i]}function rt(e,t){let n=t.trim().toLocaleLowerCase();return n.length===0?e:e.filter(e=>e.label.toLocaleLowerCase().includes(n)||e.local?.name.toLocaleLowerCase().includes(n)===!0||e.remote?.name.toLocaleLowerCase().includes(n)===!0)}var V=`__automatic_base_ref__`,it=new Set,at=`
|
|
2
|
-
[data-diffs-header],
|
|
3
|
-
[data-diff],
|
|
4
|
-
[data-file],
|
|
5
|
-
[data-error-wrapper],
|
|
6
|
-
[data-virtualizer-buffer] {
|
|
7
|
-
--diffs-header-font-family: var(--font-sans) !important;
|
|
8
|
-
--diffs-font-family: var(--font-mono) !important;
|
|
9
|
-
--diffs-bg: color-mix(in srgb, var(--card) 90%, var(--background)) !important;
|
|
10
|
-
--diffs-light-bg: color-mix(in srgb, var(--card) 90%, var(--background)) !important;
|
|
11
|
-
--diffs-dark-bg: color-mix(in srgb, var(--card) 90%, var(--background)) !important;
|
|
12
|
-
--diffs-token-light-bg: transparent;
|
|
13
|
-
--diffs-token-dark-bg: transparent;
|
|
14
|
-
|
|
15
|
-
--diffs-bg-context-override: color-mix(in srgb, var(--background) 97%, var(--foreground));
|
|
16
|
-
--diffs-bg-hover-override: color-mix(in srgb, var(--background) 94%, var(--foreground));
|
|
17
|
-
--diffs-bg-separator-override: color-mix(in srgb, var(--background) 95%, var(--foreground));
|
|
18
|
-
--diffs-bg-buffer-override: color-mix(in srgb, var(--background) 90%, var(--foreground));
|
|
19
|
-
|
|
20
|
-
--diffs-bg-addition-override: color-mix(in srgb, var(--background) 92%, var(--success));
|
|
21
|
-
--diffs-bg-addition-number-override: color-mix(in srgb, var(--background) 88%, var(--success));
|
|
22
|
-
--diffs-bg-addition-hover-override: color-mix(in srgb, var(--background) 85%, var(--success));
|
|
23
|
-
--diffs-bg-addition-emphasis-override: color-mix(in srgb, var(--background) 80%, var(--success));
|
|
24
|
-
|
|
25
|
-
--diffs-bg-deletion-override: color-mix(in srgb, var(--background) 92%, var(--destructive));
|
|
26
|
-
--diffs-bg-deletion-number-override: color-mix(in srgb, var(--background) 88%, var(--destructive));
|
|
27
|
-
--diffs-bg-deletion-hover-override: color-mix(in srgb, var(--background) 85%, var(--destructive));
|
|
28
|
-
--diffs-bg-deletion-emphasis-override: color-mix(
|
|
29
|
-
in srgb,
|
|
30
|
-
var(--background) 80%,
|
|
31
|
-
var(--destructive)
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
background-color: var(--diffs-bg) !important;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
[data-file-info] {
|
|
38
|
-
background-color: color-mix(in srgb, var(--card) 94%, var(--foreground)) !important;
|
|
39
|
-
border-block-color: var(--border) !important;
|
|
40
|
-
color: var(--foreground) !important;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
[data-diffs-header] {
|
|
44
|
-
position: sticky !important;
|
|
45
|
-
top: 0;
|
|
46
|
-
z-index: 4;
|
|
47
|
-
background-color: color-mix(in srgb, var(--card) 94%, var(--foreground)) !important;
|
|
48
|
-
border-bottom: 1px solid var(--border) !important;
|
|
49
|
-
align-items: center !important;
|
|
50
|
-
font-family: var(--font-sans) !important;
|
|
51
|
-
font-size: 12px !important;
|
|
52
|
-
line-height: 1 !important;
|
|
53
|
-
min-height: 32px !important;
|
|
54
|
-
padding-block: 6px !important;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
[data-diffs-header] [data-header-content] {
|
|
58
|
-
align-items: center !important;
|
|
59
|
-
line-height: 1 !important;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
[data-diffs-header] [data-metadata] {
|
|
63
|
-
align-items: center !important;
|
|
64
|
-
line-height: 1 !important;
|
|
65
|
-
font-variant-numeric: tabular-nums;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
[data-diffs-header] [data-additions-count],
|
|
69
|
-
[data-diffs-header] [data-deletions-count] {
|
|
70
|
-
font-family: var(--font-mono) !important;
|
|
71
|
-
font-size: 11px !important;
|
|
72
|
-
font-variant-numeric: tabular-nums;
|
|
73
|
-
line-height: 1 !important;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
[data-diffs-header] [data-change-icon],
|
|
77
|
-
[data-diffs-header] [data-rename-icon] {
|
|
78
|
-
display: block;
|
|
79
|
-
flex-shrink: 0;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
[data-title] {
|
|
83
|
-
cursor: pointer;
|
|
84
|
-
transition:
|
|
85
|
-
color 120ms ease,
|
|
86
|
-
text-decoration-color 120ms ease;
|
|
87
|
-
text-decoration: underline;
|
|
88
|
-
text-decoration-color: transparent;
|
|
89
|
-
text-underline-offset: 2px;
|
|
90
|
-
font-family: var(--font-sans) !important;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
[data-title]:hover {
|
|
94
|
-
color: color-mix(in srgb, var(--foreground) 84%, var(--primary)) !important;
|
|
95
|
-
text-decoration-color: currentColor;
|
|
96
|
-
}
|
|
97
|
-
`;function H({mode:e=`inline`,composerDraftTarget:t,initialGitScope:n,threadRef:r}){let{resolvedTheme:i}=oe(),s=be(),[te]=(0,P.useState)(n),[m,h]=(0,P.useState)(`stacked`),[g,y]=(0,P.useState)(s.wordWrap),[T,D]=(0,P.useState)(s.diffIgnoreWhitespace),[k,Oe]=(0,P.useState)(``),[Le,He]=(0,P.useState)(()=>({scopeKey:null,fileKeys:it})),Ue=(0,P.useRef)(null),We=r.threadId,F=se(r),Je=F?.projectId??null,Ye=O(F&&Je?{environmentId:F.environmentId,projectId:Je}:null),L=F?.worktreePath??Ye?.workspaceRoot,R=ne(v.configValueAtom(F?.environmentId??null)),Ze=Ve(F?.environmentId??null,R?.availableEditors??[]),Qe=b(F!=null&&L!=null?ve.status({environmentId:F.environmentId,input:{cwd:L}}):null),z=N(e=>he(e.byThreadKey,r,te===`unstaged`)),$e=Qe.data?.isRepo??!0,{turnDiffSummaries:et,inferredCheckpointTurnCountByTurnId:B}=fe(F),H=(0,P.useMemo)(()=>[...et].toSorted((e,t)=>{let n=e.checkpointTurnCount??B[e.turnId]??0,r=t.checkpointTurnCount??B[t.turnId]??0;return n===r?t.completedAt.localeCompare(e.completedAt):r-n}),[B,et]);(0,P.useEffect)(()=>{z.kind===`turn`&&N.getState().reconcileTurnSelection(r,H.map(e=>e.turnId))},[z,H,r]);let U=z.kind===`turn`?z.turnId:null,W=z.kind===`unstaged`?`unstaged`:`branch`,G=z.kind===`branch`?z.baseRef:null,ot=z.kind===`turn`?z.filePath:null,st=z.kind===`turn`?z.revealRequestId:0,K=U===null?void 0:H.find(e=>e.turnId===U)??H[0],q=K&&(K.checkpointTurnCount??B[K.turnId]),ct=H[0],lt=U===null?W===`unstaged`?`Working tree`:`Branch changes`:K?.turnId===ct?.turnId?`Latest turn`:`Turn ${q??`?`}`,ut=K?`turn:${K.turnId}`:W,J=`${r.environmentId}:${r.threadId}:${ut}`,dt=Le.scopeKey===J?Le.fileKeys:it,ft=K?`Turn ${q??`?`}`:W===`unstaged`?`Working tree`:`Branch changes`,pt=(0,P.useMemo)(()=>typeof q==`number`?{fromTurnCount:Math.max(0,q-1),toTurnCount:q}:null,[q]),mt=qe({environmentId:F?.environmentId??null,threadId:We,fromTurnCount:pt?.fromTurnCount??null,toTurnCount:pt?.toTurnCount??null,ignoreWhitespace:T,cacheScope:K?`turn:${K.turnId}`:null},{enabled:$e&&K!==void 0}),ht=b(U===null&&F&&L?tt.diffPreview({environmentId:F.environmentId,input:{cwd:L,...G?{baseRef:G}:{},ignoreWhitespace:T}}):null),gt=U===null&&ht.error?.includes(`configured workspace root`)===!0&&R?.cwd!==void 0&&R.cwd!==L,_t=b(gt&&F&&R?tt.diffPreview({environmentId:F.environmentId,input:{cwd:R.cwd,...G?{baseRef:G}:{},ignoreWhitespace:T}}):null),Y=gt?_t:ht,X=Y.data?.sources.find(e=>e.kind===(W===`unstaged`?`working-tree`:`branch-range`)),vt=b(U===null&&W===`branch`&&F&&Y.data?.cwd?ve.listRefs({environmentId:F.environmentId,input:{cwd:Y.data.cwd,includeMatchingRemoteRefs:!0,refKind:`local`,...k.trim().length>0?{query:k.trim()}:{},limit:100}}):null),yt=b(U===null&&W===`branch`&&F&&Y.data?.cwd?ve.listRefs({environmentId:F.environmentId,input:{cwd:Y.data.cwd,includeMatchingRemoteRefs:!0,refKind:`remote`,...k.trim().length>0?{query:k.trim()}:{},limit:100}}):null),bt=nt(vt.data?.refs.filter(e=>e.name!==X?.headRef)??[],yt.data?.refs??[]),xt=rt(bt,k),St=e=>G&&G===e.remote?.name?G:e.local?.name??e.remote?.name??e.id,Ct=[V,...bt.map(St)],wt=[...k.trim().length===0?[V]:[],...xt.map(St)],Tt=X?.diff,Z=K?mt.data?.diff:Tt,Et=!K&&X?.truncated===!0,Dt=K?mt.isPending:Y.isPending,Ot=K?mt.error:Y.error,kt=typeof Z==`string`&&Z.trim().length===0,Q=(0,P.useMemo)(()=>Be(Z,`diff-panel:${i}`,{compactPartialHunkOffsets:U===null}),[i,Z,U]),At=(0,P.useMemo)(()=>!Q||Q.kind!==`files`?[]:Q.files.toSorted((e,t)=>Ee(e).localeCompare(Ee(t),void 0,{numeric:!0,sensitivity:`base`})),[Q]),$=(0,P.useMemo)(()=>At.map(e=>{let t=Pe(e);return{fileDiff:e,filePath:Ee(e),fileKey:t,collapsed:dt.has(t)}}),[dt,At]),jt=(0,P.useMemo)(()=>$.map(e=>e.fileKey),[$]),Mt=le(jt,dt),Nt=(0,P.useMemo)(()=>je(At),[At]);(0,P.useEffect)(()=>{if(!ot)return;let e=$.find(e=>e.filePath===ot);e&&Ue.current?.scrollTo({type:`item`,id:e.fileKey,align:`start`})},[$,ot,st]);let Pt=De({threadRef:r,workspaceRoot:L??null}),Ft=(0,P.useCallback)(e=>{Ke({threadRef:r,filePath:e,activeCwd:L,openFileSurface:Pt,openInEditor:e=>{(async()=>{let t=await Ze(e);t._tag===`Failure`&&!_(t)&&console.warn(`Failed to open diff file in editor.`,{operation:`open-diff-file`,environmentId:r.environmentId,threadId:r.threadId,...x(ie(t))})})()}})},[L,Pt,Ze,r]),It=(0,P.useCallback)(e=>{He(t=>{let n=new Set(t.scopeKey===J?t.fileKeys:[]);return n.has(e)?n.delete(e):n.add(e),{scopeKey:J,fileKeys:n}})},[J]),Lt=(0,P.useCallback)(()=>{He(e=>{let t=e.scopeKey===J?e.fileKeys:it;return{scopeKey:J,fileKeys:j(jt,t)}})},[J,jt]),Rt=e=>{N.getState().selectTurn(r,e)},zt=e=>{N.getState().selectGitScope(r,e)},Bt=e=>{N.getState().selectBranchBaseRef(r,e)};return(0,I.jsx)(ye,{mode:e,header:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3 [-webkit-app-region:no-drag]`,children:[(0,I.jsxs)(S,{children:[(0,I.jsxs)(a,{className:`inline-flex h-6 max-w-full items-center gap-1 rounded-md bg-muted/70 px-2 text-xs font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring`,"aria-label":`Diff scope: ${lt}`,children:[(0,I.jsx)(`span`,{className:`truncate`,children:lt}),(0,I.jsx)(u,{className:`size-3.5 shrink-0 text-muted-foreground`})]}),(0,I.jsxs)(E,{align:`start`,className:`w-60`,children:[(0,I.jsx)(w,{className:U===null&&W===`unstaged`?`bg-foreground/[0.08]`:void 0,onClick:()=>zt(`unstaged`),children:(0,I.jsx)(`span`,{children:`Working tree`})}),(0,I.jsx)(w,{className:U===null&&W===`branch`?`bg-foreground/[0.08]`:void 0,onClick:()=>zt(`branch`),children:(0,I.jsx)(`span`,{children:`Branch changes`})}),(0,I.jsx)(w,{className:U!==null&&K?.turnId===ct?.turnId?`bg-foreground/[0.08]`:void 0,onClick:()=>{ct&&Rt(ct.turnId)},children:(0,I.jsx)(`span`,{children:`Latest turn`})}),(0,I.jsxs)(ae,{children:[(0,I.jsx)(o,{children:`Turn`}),(0,I.jsx)(re,{className:`w-64`,children:H.map(e=>{let t=e.checkpointTurnCount??B[e.turnId]??`?`;return(0,I.jsxs)(w,{className:e.turnId===K?.turnId?`bg-foreground/[0.08]`:void 0,onClick:()=>Rt(e.turnId),children:[(0,I.jsxs)(`span`,{children:[`Turn `,t]}),(0,I.jsx)(`span`,{className:`ml-auto text-xs tabular-nums text-muted-foreground`,children:me(e.completedAt,s.timestampFormat)})]},e.turnId)})})]})]})]}),U===null&&W===`branch`&&X?.baseRef&&(0,I.jsxs)(`div`,{className:`flex min-w-0 max-w-full items-center gap-2 overflow-hidden text-xs text-muted-foreground`,title:`${X.headRef??`HEAD`} → ${X.baseRef}`,"aria-label":`Comparing ${X.headRef??`HEAD`} against ${X.baseRef}`,children:[(0,I.jsx)(`span`,{className:`min-w-0 max-w-48 truncate`,children:X.headRef??`HEAD`}),(0,I.jsx)(pe,{className:`size-3.5 shrink-0 opacity-70`}),(0,I.jsxs)(xe,{items:Ct,filteredItems:wt,value:G??V,onOpenChange:e=>{e||Oe(``)},onValueChange:e=>{e&&Bt(e===V?null:e)},children:[(0,I.jsxs)(Me,{className:`inline-flex min-w-0 max-w-48 items-center gap-1 overflow-hidden rounded-md px-1.5 py-1 outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,"aria-label":`Change comparison target. Currently ${X.baseRef}`,children:[(0,I.jsx)(`span`,{className:`min-w-0 truncate`,children:X.baseRef}),(0,I.jsx)(u,{className:`size-3.5 shrink-0 opacity-70`})]}),(0,I.jsxs)(Ie,{align:`start`,className:`w-72 min-w-0 max-w-[calc(100vw-1rem)] overflow-hidden [&>[data-slot=combobox-popup]]:min-w-0 [&>[data-slot=combobox-popup]]:overflow-hidden`,children:[(0,I.jsx)(`div`,{className:`min-w-0 shrink-0 px-3 pt-2.5`,children:(0,I.jsxs)(`div`,{className:`relative -translate-y-px border-b border-border/70 pb-1.5 transition-colors focus-within:border-ring`,children:[(0,I.jsx)(Ne,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1.5 left-0 size-4 shrink-0 text-muted-foreground/55`}),(0,I.jsx)(ze,{className:`[&_input]:h-6.5 [&_input]:ps-5 [&_input]:font-sans [&_input]:leading-6.5`,inputClassName:`rounded-none bg-transparent text-sm`,placeholder:`Search refs...`,showTrigger:!1,size:`sm`,unstyled:!0,value:k,onChange:e=>Oe(e.target.value)})]})}),(0,I.jsxs)(`div`,{className:`grid shrink-0 grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 border-b border-border/70 ps-3 pe-6.5 pt-2 pb-1.5 font-medium text-[10px] text-muted-foreground uppercase tracking-wide`,children:[(0,I.jsx)(`span`,{"aria-hidden":`true`}),(0,I.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_2rem] items-center`,children:[(0,I.jsx)(`span`,{children:`Branch`}),(0,I.jsx)(`span`,{className:`text-right`,children:`Remote`})]})]}),(0,I.jsx)(Ae,{children:`No matching refs.`}),(0,I.jsxs)(Te,{className:`max-h-64 min-w-0 overflow-x-hidden`,children:[(0,I.jsx)(Ce,{className:`h-8 w-full min-w-0 grid-cols-[1rem_minmax(0,1fr)] py-0`,contentClassName:`w-full min-w-0 overflow-hidden`,value:V,children:(0,I.jsx)(`span`,{className:`block min-w-0 truncate`,children:`Automatic`})}),bt.map(e=>{let t=St(e),n=e.local!==null&&e.remote!==null,r=e.remote?.name===t;return(0,I.jsx)(Ce,{className:`h-8 w-full min-w-0 grid-cols-[1rem_minmax(0,1fr)] py-0`,contentClassName:`w-full min-w-0 overflow-hidden`,value:t,children:(0,I.jsxs)(`div`,{className:`grid w-full min-w-0 grid-cols-[minmax(0,1fr)_2rem] items-center overflow-hidden`,children:[(0,I.jsx)(`span`,{className:`block min-w-0 truncate pe-2`,children:e.label}),n?(0,I.jsx)(`div`,{className:`flex justify-end`,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,I.jsx)(ge,{"aria-label":`Use remote version of ${e.label}`,checked:r,className:`[--thumb-size:--spacing(3)]`,onCheckedChange:t=>{let n=t?e.remote?.name:e.local?.name;n&&Bt(n)}})}):e.remote?(0,I.jsx)(`span`,{className:`flex justify-end text-muted-foreground`,title:`Remote only`,children:(0,I.jsx)(ee,{"aria-hidden":`true`,className:`size-3`})}):null]})},e.id)})]})]})]})]})]}),(0,I.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 [-webkit-app-region:no-drag]`,children:[$.length>0&&(0,I.jsx)(Fe,{additions:Nt.additions,deletions:Nt.deletions,className:`mr-1 text-[11px]`,layout:`inline`}),$.length>0&&(0,I.jsxs)(p,{children:[(0,I.jsx)(d,{render:(0,I.jsx)(C,{type:`button`,size:`icon-xs`,variant:`outline`,"aria-label":Mt?`Expand all files`:`Collapse all files`,onClick:Lt}),children:Mt?(0,I.jsx)(ke,{className:`size-3`}):(0,I.jsx)(A,{className:`size-3`})}),(0,I.jsx)(c,{side:`top`,children:Mt?`Expand all files`:`Collapse all files`})]}),(0,I.jsxs)(M,{className:`shrink-0`,variant:`outline`,size:`xs`,value:[m],onValueChange:e=>{let t=e[0];(t===`stacked`||t===`split`)&&h(t)},children:[(0,I.jsx)(de,{"aria-label":`Stacked diff view`,value:`stacked`,children:(0,I.jsx)(ce,{className:`size-3`})}),(0,I.jsx)(de,{"aria-label":`Split diff view`,value:`split`,children:(0,I.jsx)(ue,{className:`size-3`})})]}),(0,I.jsxs)(p,{children:[(0,I.jsx)(d,{render:(0,I.jsx)(de,{"aria-label":g?`Disable diff line wrapping`:`Enable diff line wrapping`,variant:`outline`,size:`xs`,pressed:g,onPressedChange:e=>{y(!!e)}}),children:(0,I.jsx)(Re,{className:`size-3`})}),(0,I.jsx)(c,{side:`top`,children:g?`Disable line wrapping`:`Enable line wrapping`})]}),(0,I.jsxs)(p,{children:[(0,I.jsx)(d,{render:(0,I.jsx)(de,{"aria-label":T?`Show whitespace changes`:`Hide whitespace changes`,variant:`outline`,size:`xs`,pressed:T,onPressedChange:e=>{D(!!e)}}),children:(0,I.jsx)(Ge,{className:`size-3`})}),(0,I.jsx)(c,{side:`top`,children:T?`Show whitespace changes`:`Hide whitespace changes`})]})]})]}),children:F?$e?U!==null&&H.length===0?(0,I.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`No completed turns yet.`}):(0,I.jsx)(I.Fragment,{children:(0,I.jsxs)(`div`,{className:`diff-panel-viewport flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[Et&&(0,I.jsx)(`p`,{className:`shrink-0 border-b border-border/70 bg-muted/40 px-3 py-1.5 text-[11px] text-muted-foreground`,children:`This diff was truncated because it exceeded the preview limit. The changes shown are incomplete.`}),Ot&&!Q&&(0,I.jsx)(`div`,{className:`px-3`,children:(0,I.jsx)(`p`,{className:`mb-2 text-[11px] text-red-500/80`,children:Ot})}),Q?Q.kind===`files`?(0,I.jsx)(`div`,{className:`min-h-0 flex-1`,onClickCapture:e=>{let t=(e.nativeEvent.composedPath?.()??[]).find(e=>e instanceof HTMLElement&&e.hasAttribute(`data-title`))?.textContent?.trim();t&&Ft(t)},children:(0,I.jsx)(Xe,{viewerRef:Ue,className:`diff-render-surface h-full min-h-0 overflow-auto`,files:$,sectionId:ut,sectionTitle:ft,composerDraftTarget:t,renderHeaderPrefix:(e,t,n)=>{let r=Ee(e);return(0,I.jsxs)(p,{children:[(0,I.jsx)(d,{render:(0,I.jsx)(`button`,{type:`button`,className:f(`inline-flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-sm border-0 bg-transparent p-0 transition-colors hover:bg-foreground/10 focus-visible:outline-hidden`,Se(e)),"aria-label":n?`Expand ${r}`:`Collapse ${r}`,"aria-expanded":!n,onClick:e=>{e.stopPropagation(),It(t)}}),children:n?(0,I.jsx)(l,{className:`size-4`}):(0,I.jsx)(u,{className:`size-4`})}),(0,I.jsx)(c,{side:`top`,children:n?`Expand diff`:`Collapse diff`})]})},options:{diffStyle:m===`split`?`split`:`unified`,lineDiffType:`none`,overflow:g?`wrap`:`scroll`,theme:we(i),themeType:i,unsafeCSS:at,stickyHeaders:!0,itemMetrics:{diffHeaderHeight:33},layout:{paddingTop:0,paddingBottom:8,gap:8}}},J??ut)}):(0,I.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-2`,children:(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground/75`,children:Q.reason}),(0,I.jsx)(`pre`,{className:f(`max-h-[72vh] rounded-md border border-border/70 bg-background/70 p-3 font-mono text-[11px] leading-relaxed text-muted-foreground/90`,g?`overflow-auto whitespace-pre-wrap wrap-break-word`:`overflow-auto`),children:Q.text})]})}):Dt?(0,I.jsx)(_e,{label:K?`Loading checkpoint diff...`:W===`unstaged`?`Loading working tree diff...`:`Loading branch diff...`}):(0,I.jsx)(`div`,{className:`flex h-full items-center justify-center px-3 py-2 text-xs text-muted-foreground/70`,children:(0,I.jsx)(`p`,{children:kt?`No net changes in this selection.`:`No patch available for this selection.`})})]})}):(0,I.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`Turn diffs are unavailable because this project is not a git repository.`}):(0,I.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`Select a thread to inspect turn diffs.`})})}export{Oe as DiffWorkerPoolProvider,H as default};
|
|
98
|
-
//# sourceMappingURL=DiffPanel-1TZXju6q.js.map
|