@openchamber/web 2.7.1 → 2.7.2-canary.20261112.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AboutDialog-Byc63m0u.js → AboutDialog-CD63uz39.js} +1 -1
- package/dist/assets/{AboutLogo-BwwjES_b.js → AboutLogo-2kHLExbm.js} +1 -1
- package/dist/assets/{ArchiveView-DIg8Bq5r.js → ArchiveView-D9AL3G55.js} +1 -1
- package/dist/assets/{ChangeRequestDiffUnavailable-DtCWp1bf.js → ChangeRequestDiffUnavailable-BFaXu17a.js} +1 -1
- package/dist/assets/{CommandPalette-D1G7W43z.js → CommandPalette-wJg29t3M.js} +1 -1
- package/dist/assets/{DataFileArtifact-BPwh4rIZ.js → DataFileArtifact-B8OGvXN-.js} +1 -1
- package/dist/assets/{DiffView-B9-zXR21.js → DiffView-CAhUZy1p.js} +1 -1
- package/dist/assets/{FilesView-CTKhKCjC.js → FilesView-Bad_K4vM.js} +3 -3
- package/dist/assets/{GitView-2p131yFW.js → GitView-ESiTCDSw.js} +1 -1
- package/dist/assets/{GuestPanelContent-BY7I-Y-o.js → GuestPanelContent-BHcsCOcI.js} +1 -1
- package/dist/assets/{HelpDialog-BfDxlsKj.js → HelpDialog-CLkDLRCv.js} +1 -1
- package/dist/assets/{IntegrationsCatalogView-DX9AlNKS.js → IntegrationsCatalogView-CreW2QU2.js} +1 -1
- package/dist/assets/{JsonTreeView-Ghbn2jaO.js → JsonTreeView-CuPCB2B8.js} +1 -1
- package/dist/assets/{MarkdownDiffPreview-CcER_eYB.js → MarkdownDiffPreview-rDAnCu-X.js} +1 -1
- package/dist/assets/{MarkdownRendererImpl-DjBAwXof.js → MarkdownRendererImpl-BQO-q7Gs.js} +4 -4
- package/dist/assets/{MemoryDebugPanel-MrH6vI6i.js → MemoryDebugPanel-BA6eNPT5.js} +1 -1
- package/dist/assets/{NoteEditor-DnaXw3v6.js → NoteEditor-H5Z5TEv5.js} +1 -1
- package/dist/assets/{OfficeArtifact-av3so80I.js → OfficeArtifact-Dp7UZZNN.js} +2 -2
- package/dist/assets/{OfficeDocumentDiff-C-XvqPYx.js → OfficeDocumentDiff-Cm9lGPXQ.js} +1 -1
- package/dist/assets/{OnboardingScreen-Dlbi5e0G.js → OnboardingScreen-IeS_KnCh.js} +1 -1
- package/dist/assets/{OpenCodeStatusDialog-BZzdMaVU.js → OpenCodeStatusDialog-CGFzdIrc.js} +1 -1
- package/dist/assets/{OverviewView-CQ82APO2.js → OverviewView-C6HXytWH.js} +1 -1
- package/dist/assets/{PatchDiff-EZ_WbikC.js → PatchDiff-DxkfAF18.js} +1 -1
- package/dist/assets/{PlanView-jUry4bXu.js → PlanView-D8IoHTf_.js} +1 -1
- package/dist/assets/{ProjectActionsDialog-Bt6OXdLD.js → ProjectActionsDialog-BWduOyXA.js} +1 -1
- package/dist/assets/{ReplyCommand-CLNJlG5f.js → ReplyCommand-BjRiG3jU.js} +1 -1
- package/dist/assets/{ReplyUiBlock-DthlzVWC.js → ReplyUiBlock-B_mKHYbN.js} +1 -1
- package/dist/assets/{ReviewCards-qePUMD-z.js → ReviewCards-BnpUajD4.js} +1 -1
- package/dist/assets/{RunOverview-CvD2Q7KM.js → RunOverview-BQY-GREp.js} +1 -1
- package/dist/assets/{ScheduledTasksDialog-Dtdb6owf.js → ScheduledTasksDialog-CtlWd_VV.js} +1 -1
- package/dist/assets/{SettingsView-JBCXhydZ.js → SettingsView-CgbOYmvV.js} +1 -1
- package/dist/assets/{SettingsWindow-RJIA1rl5.js → SettingsWindow-ByKOH90R.js} +1 -1
- package/dist/assets/{SidebarSectionsManager-4i4NcHs0.js → SidebarSectionsManager-DqrV_u__.js} +1 -1
- package/dist/assets/{SourceBoardView-BuYJw-Sp.js → SourceBoardView-B0aGQnwC.js} +1 -1
- package/dist/assets/{SpaceAccessDialog-B4-bPo9e.js → SpaceAccessDialog-DMsJ-sxh.js} +1 -1
- package/dist/assets/{SpaceApplyDialog-DjTQ5PZT.js → SpaceApplyDialog-3UONCZIV.js} +1 -1
- package/dist/assets/{SpaceRow-CYk17vzn.js → SpaceRow-BJuduShI.js} +1 -1
- package/dist/assets/{SpaceSetupOutput-DRDEgMzx.js → SpaceSetupOutput-ro_nF8gr.js} +1 -1
- package/dist/assets/{SpacesView-BSt0xE6N.js → SpacesView-BqoY_SpZ.js} +1 -1
- package/dist/assets/{SubmoduleDiffSummary-CTwpN0TO.js → SubmoduleDiffSummary-NjPxpgMr.js} +1 -1
- package/dist/assets/{TableArtifact-BGTFUrHC.js → TableArtifact-oqOE37_Y.js} +1 -1
- package/dist/assets/{ToolOutputDialog-DcQ4eDvb.js → ToolOutputDialog-Bqv2rByf.js} +1 -1
- package/dist/assets/{ToolPartDiffPreview-idv0MY3G.js → ToolPartDiffPreview-SklZNjf9.js} +1 -1
- package/dist/assets/{UiBlock-CVYWc3Px.js → UiBlock-D3PdhNSP.js} +2 -2
- package/dist/assets/{UsageStatsView-Cgo61IDa.js → UsageStatsView-DM3iZLEy.js} +1 -1
- package/dist/assets/{WalkthroughView-CYr8y2pi.js → WalkthroughView-2TaZc0MB.js} +1 -1
- package/dist/assets/{WorktreesView-Duwvqggr.js → WorktreesView-aba8lY_x.js} +1 -1
- package/dist/assets/{appThemeRegistry-DgyhfFpu.js → appThemeRegistry-BrFExrgv.js} +1 -1
- package/dist/assets/{ar-zwtOisVI.js → ar-DuOBHgr_.js} +1 -1
- package/dist/assets/{codeHighlight-DQ8KOMKI.js → codeHighlight-mEwmnZVN.js} +1 -1
- package/dist/assets/{columnWidthMemory-Ol4D51DU.js → columnWidthMemory-NVG-9uFM.js} +1 -1
- package/dist/assets/{computeVirtualFileMetrics-P_6wH9ys.js → computeVirtualFileMetrics-DkXi0qX-.js} +2 -2
- package/dist/assets/{contextFileOpenGuard-9zXH1DLm.js → contextFileOpenGuard-DFp3E2Gd.js} +1 -1
- package/dist/assets/{date-time-CRucRasX.js → date-time-DRGzhBlp.js} +1 -1
- package/dist/assets/{de-5cm4El6N.js → de-DpOf_BMg.js} +1 -1
- package/dist/assets/{documentClient-BbTBnbCU.js → documentClient-UXIlVIAK.js} +2 -2
- package/dist/assets/{documentHost-Dxv6OV6h.js → documentHost-BWtn8iCI.js} +1 -1
- package/dist/assets/{editorCodeMetrics-BzYZ4PzQ.js → editorCodeMetrics-BaoTimWj.js} +1 -1
- package/dist/assets/{es-CYh9u5rf.js → es-BextOZlH.js} +1 -1
- package/dist/assets/{fileContentPoller-p6RiDNz7.js → fileContentPoller-BV7Knoib.js} +1 -1
- package/dist/assets/{flexokiTheme-BNUmLj3l.js → flexokiTheme-tyakPldH.js} +1 -1
- package/dist/assets/{fr-gZGCwYzk.js → fr-BJEccZsE.js} +1 -1
- package/dist/assets/{he-DWb3dvEl.js → he-9oI-aOhB.js} +1 -1
- package/dist/assets/{highlights-DWR6MS75.js → highlights-8Aapk9tv.js} +1 -1
- package/dist/assets/{index-BcEWRtz8.js → index-D0ue7E3H.js} +1 -1
- package/dist/assets/{initializeSharedPreferences-u4U22OVN.js → initializeSharedPreferences-DNUHFeIw.js} +1 -1
- package/dist/assets/{install-request-C0o_6GEa.js → install-request-DI6T7dQX.js} +1 -1
- package/dist/assets/{install-CkKsKExH.js → install-s_PIiJvM.js} +1 -1
- package/dist/assets/{isDiffPlainText-B70cjgtm.js → isDiffPlainText-BcgZ-0g8.js} +1 -1
- package/dist/assets/{isFilePlainText-DNNat5m3.js → isFilePlainText-DCv6hsjs.js} +1 -1
- package/dist/assets/{ja-CAeb9wyo.js → ja-Bf_2zWyq.js} +1 -1
- package/dist/assets/{katex.min-2cmqKX7p.js → katex.min-CAwHaRYk.js} +4 -4
- package/dist/assets/{ko-DuYqVIuP.js → ko-BAGf67hm.js} +1 -1
- package/dist/assets/{main-kUMMbMdC.js → main-CZBlb0Vm.js} +4 -4
- package/dist/assets/{main-D9Ri_lHo.js → main-g_cZWPOo.js} +2 -2
- package/dist/assets/{miniChat-HoE2mQuK.js → miniChat-jzqDFSB-.js} +2 -2
- package/dist/assets/{mobile-BFQ0eaJT.js → mobile-4zqwQ7Sj.js} +2 -2
- package/dist/assets/{moveWorkspacePath-BkzUq9fV.js → moveWorkspacePath-D4BOjl1P.js} +1 -1
- package/dist/assets/{nl-BPlUOQoY.js → nl-MVCsXAqA.js} +1 -1
- package/dist/assets/{officeDocument-C74tIqpD.js → officeDocument-CnopQpfD.js} +1 -1
- package/dist/assets/{parseDiffFromFile-COnIA377.js → parseDiffFromFile-CdzPmTcc.js} +1 -1
- package/dist/assets/{pierreDiffTint-9AmpxGGB.js → pierreDiffTint-CVXkDTiH.js} +1 -1
- package/dist/assets/{pl-DZRSuGdV.js → pl-zi2r4I2L.js} +1 -1
- package/dist/assets/{pt-BR-fU-ttTba.js → pt-BR-D-thkXCk.js} +1 -1
- package/dist/assets/{relocateRestoredSession-DawfZWX6.js → relocateRestoredSession-CL5sou6T.js} +2 -2
- package/dist/assets/{renderElectronMiniChatApp-q30Gq6wf.js → renderElectronMiniChatApp-ByeC9_X9.js} +2 -2
- package/dist/assets/{renderMarkdownForExport-0rL6OK8T.js → renderMarkdownForExport-B2BahH3V.js} +1 -1
- package/dist/assets/{renderMobileApp-B_PjVgBu.js → renderMobileApp-BHQf77yR.js} +3 -3
- package/dist/assets/{resolveLanguages-dF0QdGAX.js → resolveLanguages-D-TyRYRT.js} +1 -1
- package/dist/assets/{runtimeEndpointReset-BsAAA4Nf.js → runtimeEndpointReset-DKWDEJh9.js} +5 -5
- package/dist/assets/{scheduledTasksApi-CB-Xtp2P.js → scheduledTasksApi-DIaiATcl.js} +1 -1
- package/dist/assets/{shiki-CVNu2J2E.js → shiki-CTynytaK.js} +1 -1
- package/dist/assets/{space-apply-BmOleF8W.js → space-apply-CYC8IOgP.js} +1 -1
- package/dist/assets/{space-close-DqG3RGoP.js → space-close-CDpywx5q.js} +1 -1
- package/dist/assets/{spaceNetwork-DUGLrihG.js → spaceNetwork-DYE6zemZ.js} +1 -1
- package/dist/assets/{stream-tokenizer-Bzos6Fhy.js → stream-tokenizer-DHz3vo2_.js} +1 -1
- package/dist/assets/{textMateThemeFromAppTheme-BRUbLAuj.js → textMateThemeFromAppTheme-ZHLiHrUo.js} +1 -1
- package/dist/assets/{tr-CD93vntx.js → tr-BeLCIXLh.js} +1 -1
- package/dist/assets/{uk-DTqcJvdn.js → uk-CWz0kaNm.js} +1 -1
- package/dist/assets/{useAppFontEffects-xaAfmUwn.js → useAppFontEffects-DEX5CMOn.js} +15 -15
- package/dist/assets/{useBranchPullRequestRequest-CIftwmmA.js → useBranchPullRequestRequest-CulIXVeT.js} +1 -1
- package/dist/assets/{useCallableModelProviders-DYpBJMqj.js → useCallableModelProviders-CV8ihNIz.js} +1 -1
- package/dist/assets/{useDiffFindSurface-CqxU53Ed.js → useDiffFindSurface-DcsqijBv.js} +1 -1
- package/dist/assets/{useGitCleanLine-CmVX9s9E.js → useGitCleanLine-DvEtGCIy.js} +1 -1
- package/dist/assets/{useInlineCommentController-C-V8vqSj.js → useInlineCommentController-BL4NrAAM.js} +1 -1
- package/dist/assets/{useMarkdownLocalAssets-BfOLz9Xm.js → useMarkdownLocalAssets-6zcqySrf.js} +1 -1
- package/dist/assets/{useRootScrollLock-Ciuj2iZ_.js → useRootScrollLock-BHTza82m.js} +1 -1
- package/dist/assets/{useWalkthroughReview-BdjnKO7o.js → useWalkthroughReview-C_afIgqu.js} +1 -1
- package/dist/assets/{useWholeFileComment-DkYtu1tm.js → useWholeFileComment-WwfwT0jq.js} +1 -1
- package/dist/assets/{useWorktreeArchiveActions-DGzuZU_x.js → useWorktreeArchiveActions-CORhov5Z.js} +1 -1
- package/dist/assets/{vendor-codemirror-language-data-CSQf665k.js → vendor-codemirror-language-data--j1xV4at.js} +2 -2
- package/dist/assets/{zh-CN-BJ4oeBCY.js → zh-CN-D2e-OTjQ.js} +1 -1
- package/dist/assets/{zh-TW-BMW1G3F_.js → zh-TW-DCj_Doyh.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/mini-chat.html +2 -2
- package/dist/mobile.html +2 -2
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{R as z,j as E,a as Ie,f as ze,r as m}from"./vendor-react--VO_rL_p.js";import{a3 as je,u as Ut,an,ao as Mt,P as ln,U as cn,hl as dn,n as un,bP as fn,cp as hn,au as Se,cq as Pt,cr as Nt,cs as pn}from"./useAppFontEffects-xaAfmUwn.js";import{p as mn,a as gn}from"./parseDiffFromFile-COnIA377.js";import{c as Ft}from"./isDiffPlainText-B70cjgtm.js";import{P as yn,a as xn,V as it,F as vn}from"./pierreDiffTint-9AmpxGGB.js";import{R as wn,a as Ln,V as Sn}from"./ReviewCards-qePUMD-z.js";import"./katex.min-2cmqKX7p.js";import{a as Ht,I as bn,u as Rn}from"./useInlineCommentController-C-V8vqSj.js";import{u as kn,aF as Cn}from"./runtimeEndpointReset-BsAAA4Nf.js";import{ensurePierreThemeRegistered as $t,getResolvedShikiTheme as Ot}from"./appThemeRegistry-DgyhfFpu.js";import{DIFFS_HIGHLIGHTER as En}from"./diffsHighlighter-BsxkaI3Q.js";import{u as In}from"./editorCodeMetrics-BzYZ4PzQ.js";const pe=n=>{if(n.type==="review")return`review-${n.id}`;if(n.type==="new"){const e=Math.min(n.selection.start,n.selection.end),r=Math.max(n.selection.start,n.selection.end);return`new-comment-${n.selection.side??"additions"}-${e}-${r}`}return`draft-${n.draft.id}`},Tn=(n,e)=>n&&!e?{lineNumber:Math.max(n.start,n.end),side:n.side??"additions",metadata:{type:"new",selection:n}}:null,An=n=>{const{drafts:e,editingDraftId:r,reviewItems:t=[]}=n,i=[];for(const a of e){if(!Number.isFinite(a.endLine))continue;const l=Math.max(1,Math.floor(a.endLine)),u=a.side==="original"?"deletions":"additions";i.push({lineNumber:l,side:u,metadata:{type:a.id===r?"edit":"saved",draft:a}})}for(const a of t)i.push({lineNumber:a.lineNumber,side:a.side,metadata:{type:"review",id:a.id}});return i};function Mn(n){const e=n.trim();if(!e)return null;if(/^-?\d+(\.\d+)?$/.test(e)){const r=Number.parseFloat(e);return Number.isFinite(r)?r:null}if(e.endsWith("px")){const r=Number.parseFloat(e.slice(0,-2));return Number.isFinite(r)?r:null}return null}function _t(n){if(!(!n||n<=0))return Math.max(200,Math.floor(n))}function Pn(n){const{diffRootRef:e,drafts:r,selection:t,editingDraftId:i,commentText:a,onTextChange:l,fileLabel:u,onSave:d,onCancel:c,onEdit:f,onDelete:y,review:h,reviewItems:S,reviewField:R,excerptOf:w}=n,[O,D]=z.useState(0),[N,H]=z.useState(null),M=z.useMemo(()=>!t||i?null:pe({type:"new",selection:t}),[i,t]),W=z.useMemo(()=>{const x=r.map(b=>pe({type:b.id===i?"edit":"saved",draft:b}));M&&x.push(M);for(const b of S)x.push(pe({type:"review",id:b.id}));return x},[r,i,S,M]),q=z.useCallback(x=>{const b=e.current;if(!b)return null;const _=b.querySelector("diffs-container");if(!(_ instanceof HTMLElement))return null;const j=_.querySelector(`[data-annotation-id="${x}"]`);if(j instanceof HTMLElement)return j;const X=_.shadowRoot;return X?X.querySelector(`[data-annotation-id="${x}"]`):null},[e]);z.useEffect(()=>{if(W.length===0)return;let x=!1,b=0;const _=12,j=()=>{x||W.every(Y=>!!q(Y))||b>=_||(b+=1,requestAnimationFrame(()=>{x||(D(Y=>Y+1),j())}))};return j(),()=>{x=!0}},[W,q]),z.useEffect(()=>{const x=e.current;if(!x)return;const b=()=>{const j=getComputedStyle(x),X=Mn(j.getPropertyValue("--oc-context-panel-width")),Y=x.getBoundingClientRect(),Q=X??Y.width;H(Q>0?Q:null)};b();const _=new ResizeObserver(()=>{b()});return _.observe(x),window.addEventListener("resize",b),()=>{_.disconnect(),window.removeEventListener("resize",b)}},[e]);const oe=z.useCallback(x=>{const _=e.current?.getBoundingClientRect(),j=x.closest("[data-annotation-content]"),X=j instanceof HTMLElement?j.getBoundingClientRect():x.getBoundingClientRect(),Y=[X.width];_&&Y.push(_.right-X.left);const Q=Y.filter(Te=>Number.isFinite(Te)&&Te>0);return Q.length>0?_t(Math.min(...Q)):_t(N)},[e,N]),ie=()=>{const x=e.current?.querySelector("diffs-container")?.shadowRoot,b=x?Array.from(x.querySelectorAll("[data-line][data-selected-line]")).at(-1):void 0;if(b)return getComputedStyle(b).getPropertyValue("--diffs-computed-selected-line-bg").trim()||void 0};return E.jsxs(E.Fragment,{children:[r.map(x=>{const b=pe({type:x.id===i?"edit":"saved",draft:x}),_=q(b);if(!_)return null;const j=oe(_);return x.id===i?Ie.createPortal(E.jsx(Ht,{initialText:a,onTextChange:l,fileLabel:u,lineRange:{start:x.startLine,end:x.endLine,side:x.side==="original"?"deletions":"additions"},isEditing:!0,onSave:d,onCancel:c,maxWidth:j,bandColor:ie()}),_,`draft-edit-${x.id}`):Ie.createPortal(E.jsx(bn,{draft:x,onEdit:()=>f(x),onDelete:()=>y(x),maxWidth:j,forAgent:h!==null}),_,`draft-card-${x.id}`)}),t&&!i&&M&&(()=>{const x=q(M);if(!x)return null;const b=oe(x);return Ie.createPortal(E.jsx(Ht,{initialText:a,onTextChange:l,fileLabel:u,lineRange:t,isEditing:!1,onSave:d,onCancel:c,maxWidth:b,bandColor:ie(),review:R}),x,M)})(),h?S.map(x=>{const b=pe({type:"review",id:x.id}),_=q(b);if(!_)return null;const j=oe(_);return Ie.createPortal(E.jsx("div",{className:"px-3 py-1.5",children:x.kind==="draft"?E.jsx(wn,{comment:x.comment,review:h,excerpt:w(x),fileLabel:u,maxWidth:j}):E.jsx(Ln,{thread:x.thread,review:h,excerpt:w(x),maxWidth:j})}),_,b)}):null]})}const Br=14,Wr=n=>n.slice(n.lastIndexOf("/",n.length-2)+1),Gt=n=>n.replace(/\\/g,"/").replace(/^\/+/,"").trim(),Dt=(n,e)=>({id:`dir:${n}`,path:n,name:e,children:new Map,directFiles:[],files:[]}),zr=n=>{const e=Dt("","");for(const r of n){const t=Gt(r.path);if(!t)continue;const a=t.split("/").filter(Boolean).slice(0,-1);let l=e;if(l.files.push(r),a.length>0){let u="";for(const d of a){u=u?`${u}/${d}`:d;const c=l.children.get(d);if(c){c.files.push(r),l=c;continue}const f=Dt(u,d);f.files.push(r),l.children.set(d,f),l=f}}l.directFiles.push(r)}return e},Nn=n=>{let e=n,r=n.name;for(;e.directFiles.length===0&&e.children.size===1;){const[t]=e.children.values();e=t,r=`${r}/${t.name}`}return{node:e,label:r}},qr=(n,e)=>{const r=[],t=(i,a)=>{const l=Array.from(i.children.values()).sort((d,c)=>d.path.localeCompare(c.path));for(const d of l){const{node:c,label:f}=Nn(d);r.push({key:c.id,kind:"directory",depth:a,label:f,directory:c}),e.has(c.path)&&t(c,a+1)}const u=[...i.directFiles].sort((d,c)=>d.path.localeCompare(c.path));for(const d of u)r.push({key:`file:${Gt(d.path)}`,kind:"file",depth:a,file:d})};return t(n,0),r},Vr=n=>{const e=ze.c(29),{path:r,from:t,className:i,nameFirst:a}=n,l=a===void 0?!1:a;let u,d;e[0]!==r?(u=r.lastIndexOf("/"),d=u===-1?"":r.slice(0,u),e[0]=r,e[1]=u,e[2]=d):(u=e[1],d=e[2]);const c=d;let f;e[3]!==u||e[4]!==r?(f=r.slice(u+1),e[3]=u,e[4]=r,e[5]=f):f=e[5];const y=f;let h;if(e[6]!==t){const M=t?t.lastIndexOf("/"):-1;h=t&&M!==-1?t.slice(0,M):"",e[6]=t,e[7]=h}else h=e[7];const S=h,R=t?`${t} → ${r}`:r;if(u===-1&&!t){let M;e[8]!==i?(M=je("block min-w-0 truncate text-foreground",i),e[8]=i,e[9]=M):M=e[9];let W;return e[10]!==r||e[11]!==M||e[12]!==R?(W=E.jsx("span",{dir:"ltr",className:M,title:R,children:r}),e[10]=r,e[11]=M,e[12]=R,e[13]=W):W=e[13],W}const w=l&&"gap-2";let O;e[14]!==i||e[15]!==w?(O=je("flex min-w-0 items-baseline overflow-hidden",w,i),e[14]=i,e[15]=w,e[16]=O):O=e[16];let D;e[17]!==t?(D=t?E.jsxs(E.Fragment,{children:[E.jsx("span",{className:"oc-ui-start-align min-w-0 truncate text-muted-foreground",style:{direction:"rtl",unicodeBidi:"plaintext"},children:t}),E.jsx("span",{className:"shrink-0 px-1 text-muted-foreground",children:"→"})]}):null,e[17]=t,e[18]=D):D=e[18];let N;e[19]!==c||e[20]!==S||e[21]!==y||e[22]!==l?(N=l?E.jsxs(E.Fragment,{children:[E.jsx("span",{className:"max-w-full shrink-0 truncate text-foreground",children:y}),c&&c!==S?E.jsx("span",{className:"min-w-0 truncate typography-micro text-muted-foreground",children:c}):null]}):E.jsxs(E.Fragment,{children:[c?E.jsx("span",{className:"oc-ui-start-align min-w-0 truncate text-muted-foreground",style:{direction:"rtl",unicodeBidi:"plaintext"},children:c}):null,E.jsxs("span",{className:"max-w-full shrink-0 truncate",children:[c?E.jsx("span",{className:"text-muted-foreground",children:"/"}):null,E.jsx("span",{className:"text-foreground",children:y})]})]}),e[19]=c,e[20]=S,e[21]=y,e[22]=l,e[23]=N):N=e[23];let H;return e[24]!==O||e[25]!==D||e[26]!==N||e[27]!==R?(H=E.jsxs("span",{dir:"ltr",className:O,title:R,children:[D,N]}),e[24]=O,e[25]=D,e[26]=N,e[27]=R,e[28]=H):H=e[28],H},st=3,Fn=1e6,jt=new WeakMap,Hn=n=>{const e=jt.get(n);if(e)return e;let r=!1;const t=[];for(const a of n.hunks){const l=[];for(const u of a.hunkContent){if(u.type==="context"){dt(l,{...u});continue}const d=$n(n,u);(d.length>1||d[0]?.type==="context")&&(r=!0);for(const c of d)dt(l,c)}t.push(..._n(a,l))}const i=r?jn(n,t):n;return jt.set(n,i),i},Bt=n=>n.replace(/\s+/g,""),$n=(n,e)=>{if(e.deletions===0||e.additions===0)return[{...e}];const r=n.deletionLines.slice(e.deletionLineIndex,e.deletionLineIndex+e.deletions),t=n.additionLines.slice(e.additionLineIndex,e.additionLineIndex+e.additions),i=[];let a=0,l=0;for(const[u,d]of On(r,t))(u>a||d>l)&&i.push({type:"change",deletions:u-a,deletionLineIndex:e.deletionLineIndex+a,additions:d-l,additionLineIndex:e.additionLineIndex+l}),dt(i,{type:"context",lines:1,deletionLineIndex:e.deletionLineIndex+u,additionLineIndex:e.additionLineIndex+d}),a=u+1,l=d+1;return(a<e.deletions||l<e.additions)&&i.push({type:"change",deletions:e.deletions-a,deletionLineIndex:e.deletionLineIndex+a,additions:e.additions-l,additionLineIndex:e.additionLineIndex+l}),i},On=(n,e)=>{const r=n.map(Bt),t=e.map(Bt),i=[];let a=0;for(;a<r.length&&a<t.length&&r[a]===t[a];)i.push([a,a]),a+=1;let l=0;for(;l<r.length-a&&l<t.length-a&&r[r.length-1-l]===t[t.length-1-l];)l+=1;const u=r.length-a-l,d=t.length-a-l;if(u>0&&d>0&&(u+1)*(d+1)<=Fn){const c=d+1,f=new Uint32Array((u+1)*c);for(let S=u-1;S>=0;S-=1)for(let R=d-1;R>=0;R-=1)f[S*c+R]=r[a+S]===t[a+R]?f[(S+1)*c+R+1]+1:Math.max(f[(S+1)*c+R],f[S*c+R+1]);let y=0,h=0;for(;y<u&&h<d;)r[a+y]===t[a+h]?(i.push([a+y,a+h]),y+=1,h+=1):f[(y+1)*c+h]>=f[y*c+h+1]?y+=1:h+=1}for(let c=l;c>0;c-=1)i.push([r.length-c,t.length-c]);return i},dt=(n,e)=>{const r=n.at(-1);if(r?.type==="context"&&e.type==="context"){r.lines+=e.lines;return}n.push(e)},Wt=(n,e,r)=>({type:"context",lines:r,deletionLineIndex:n.deletionLineIndex+e,additionLineIndex:n.additionLineIndex+e}),_n=(n,e)=>{const r=[];let t=null;for(const[a,l]of e.entries()){if(l.type==="change"){if(!t){t=[];const d=e[a-1];if(d?.type==="context"){const c=Math.min(d.lines,st);t.push(Wt(d,d.lines-c,c))}}t.push(l);continue}if(!t)continue;if(a<e.length-1&&l.lines<=st*2){t.push(l);continue}t.push(Wt(l,0,Math.min(l.lines,st))),r.push(t),t=null}t&&r.push(t);const i=e.at(-1);return r.map(a=>{const l=a.at(-1),u=l!==void 0&&i!==void 0&&_e(l,"deletion")===_e(i,"deletion")&&_e(l,"addition")===_e(i,"addition");return Dn(n,a,u)})},_e=(n,e)=>e==="deletion"?n.deletionLineIndex+(n.type==="context"?n.lines:n.deletions):n.additionLineIndex+(n.type==="context"?n.lines:n.additions),Dn=(n,e,r)=>{let t=0,i=0,a=0,l=0,u=0;for(const w of e)w.type==="context"?(a+=w.lines,l+=w.lines,u+=w.lines):(t+=w.additions,i+=w.deletions,l+=Math.max(w.additions,w.deletions),u+=w.additions+w.deletions);const d=e[0],c=a+t,f=a+i,y=zt(Be(n.additionStart,n.additionCount)+d.additionLineIndex-n.additionLineIndex,c),h=zt(Be(n.deletionStart,n.deletionCount)+d.deletionLineIndex-n.deletionLineIndex,f),R=d.additionLineIndex===n.additionLineIndex&&d.deletionLineIndex===n.deletionLineIndex?n.hunkContext:void 0;return{collapsedBefore:0,additionStart:y,additionCount:c,additionLines:t,additionLineIndex:d.additionLineIndex,deletionStart:h,deletionCount:f,deletionLines:i,deletionLineIndex:d.deletionLineIndex,hunkContent:e,hunkContext:R,hunkSpecs:`@@ -${h},${f} +${y},${c} @@${R?` ${R}`:""}
|
|
1
|
+
import{R as z,j as E,a as Ie,f as ze,r as m}from"./vendor-react--VO_rL_p.js";import{a3 as je,u as Ut,an,ao as Mt,P as ln,U as cn,hl as dn,n as un,bP as fn,cp as hn,au as Se,cq as Pt,cr as Nt,cs as pn}from"./useAppFontEffects-DEX5CMOn.js";import{p as mn,a as gn}from"./parseDiffFromFile-CdzPmTcc.js";import{c as Ft}from"./isDiffPlainText-BcgZ-0g8.js";import{P as yn,a as xn,V as it,F as vn}from"./pierreDiffTint-CVXkDTiH.js";import{R as wn,a as Ln,V as Sn}from"./ReviewCards-BnpUajD4.js";import"./katex.min-CAwHaRYk.js";import{a as Ht,I as bn,u as Rn}from"./useInlineCommentController-BL4NrAAM.js";import{u as kn,aF as Cn}from"./runtimeEndpointReset-DKWDEJh9.js";import{ensurePierreThemeRegistered as $t,getResolvedShikiTheme as Ot}from"./appThemeRegistry-BrFExrgv.js";import{DIFFS_HIGHLIGHTER as En}from"./diffsHighlighter-BsxkaI3Q.js";import{u as In}from"./editorCodeMetrics-BaoTimWj.js";const pe=n=>{if(n.type==="review")return`review-${n.id}`;if(n.type==="new"){const e=Math.min(n.selection.start,n.selection.end),r=Math.max(n.selection.start,n.selection.end);return`new-comment-${n.selection.side??"additions"}-${e}-${r}`}return`draft-${n.draft.id}`},Tn=(n,e)=>n&&!e?{lineNumber:Math.max(n.start,n.end),side:n.side??"additions",metadata:{type:"new",selection:n}}:null,An=n=>{const{drafts:e,editingDraftId:r,reviewItems:t=[]}=n,i=[];for(const a of e){if(!Number.isFinite(a.endLine))continue;const l=Math.max(1,Math.floor(a.endLine)),u=a.side==="original"?"deletions":"additions";i.push({lineNumber:l,side:u,metadata:{type:a.id===r?"edit":"saved",draft:a}})}for(const a of t)i.push({lineNumber:a.lineNumber,side:a.side,metadata:{type:"review",id:a.id}});return i};function Mn(n){const e=n.trim();if(!e)return null;if(/^-?\d+(\.\d+)?$/.test(e)){const r=Number.parseFloat(e);return Number.isFinite(r)?r:null}if(e.endsWith("px")){const r=Number.parseFloat(e.slice(0,-2));return Number.isFinite(r)?r:null}return null}function _t(n){if(!(!n||n<=0))return Math.max(200,Math.floor(n))}function Pn(n){const{diffRootRef:e,drafts:r,selection:t,editingDraftId:i,commentText:a,onTextChange:l,fileLabel:u,onSave:d,onCancel:c,onEdit:f,onDelete:y,review:h,reviewItems:S,reviewField:R,excerptOf:w}=n,[O,D]=z.useState(0),[N,H]=z.useState(null),M=z.useMemo(()=>!t||i?null:pe({type:"new",selection:t}),[i,t]),W=z.useMemo(()=>{const x=r.map(b=>pe({type:b.id===i?"edit":"saved",draft:b}));M&&x.push(M);for(const b of S)x.push(pe({type:"review",id:b.id}));return x},[r,i,S,M]),q=z.useCallback(x=>{const b=e.current;if(!b)return null;const _=b.querySelector("diffs-container");if(!(_ instanceof HTMLElement))return null;const j=_.querySelector(`[data-annotation-id="${x}"]`);if(j instanceof HTMLElement)return j;const X=_.shadowRoot;return X?X.querySelector(`[data-annotation-id="${x}"]`):null},[e]);z.useEffect(()=>{if(W.length===0)return;let x=!1,b=0;const _=12,j=()=>{x||W.every(Y=>!!q(Y))||b>=_||(b+=1,requestAnimationFrame(()=>{x||(D(Y=>Y+1),j())}))};return j(),()=>{x=!0}},[W,q]),z.useEffect(()=>{const x=e.current;if(!x)return;const b=()=>{const j=getComputedStyle(x),X=Mn(j.getPropertyValue("--oc-context-panel-width")),Y=x.getBoundingClientRect(),Q=X??Y.width;H(Q>0?Q:null)};b();const _=new ResizeObserver(()=>{b()});return _.observe(x),window.addEventListener("resize",b),()=>{_.disconnect(),window.removeEventListener("resize",b)}},[e]);const oe=z.useCallback(x=>{const _=e.current?.getBoundingClientRect(),j=x.closest("[data-annotation-content]"),X=j instanceof HTMLElement?j.getBoundingClientRect():x.getBoundingClientRect(),Y=[X.width];_&&Y.push(_.right-X.left);const Q=Y.filter(Te=>Number.isFinite(Te)&&Te>0);return Q.length>0?_t(Math.min(...Q)):_t(N)},[e,N]),ie=()=>{const x=e.current?.querySelector("diffs-container")?.shadowRoot,b=x?Array.from(x.querySelectorAll("[data-line][data-selected-line]")).at(-1):void 0;if(b)return getComputedStyle(b).getPropertyValue("--diffs-computed-selected-line-bg").trim()||void 0};return E.jsxs(E.Fragment,{children:[r.map(x=>{const b=pe({type:x.id===i?"edit":"saved",draft:x}),_=q(b);if(!_)return null;const j=oe(_);return x.id===i?Ie.createPortal(E.jsx(Ht,{initialText:a,onTextChange:l,fileLabel:u,lineRange:{start:x.startLine,end:x.endLine,side:x.side==="original"?"deletions":"additions"},isEditing:!0,onSave:d,onCancel:c,maxWidth:j,bandColor:ie()}),_,`draft-edit-${x.id}`):Ie.createPortal(E.jsx(bn,{draft:x,onEdit:()=>f(x),onDelete:()=>y(x),maxWidth:j,forAgent:h!==null}),_,`draft-card-${x.id}`)}),t&&!i&&M&&(()=>{const x=q(M);if(!x)return null;const b=oe(x);return Ie.createPortal(E.jsx(Ht,{initialText:a,onTextChange:l,fileLabel:u,lineRange:t,isEditing:!1,onSave:d,onCancel:c,maxWidth:b,bandColor:ie(),review:R}),x,M)})(),h?S.map(x=>{const b=pe({type:"review",id:x.id}),_=q(b);if(!_)return null;const j=oe(_);return Ie.createPortal(E.jsx("div",{className:"px-3 py-1.5",children:x.kind==="draft"?E.jsx(wn,{comment:x.comment,review:h,excerpt:w(x),fileLabel:u,maxWidth:j}):E.jsx(Ln,{thread:x.thread,review:h,excerpt:w(x),maxWidth:j})}),_,b)}):null]})}const Br=14,Wr=n=>n.slice(n.lastIndexOf("/",n.length-2)+1),Gt=n=>n.replace(/\\/g,"/").replace(/^\/+/,"").trim(),Dt=(n,e)=>({id:`dir:${n}`,path:n,name:e,children:new Map,directFiles:[],files:[]}),zr=n=>{const e=Dt("","");for(const r of n){const t=Gt(r.path);if(!t)continue;const a=t.split("/").filter(Boolean).slice(0,-1);let l=e;if(l.files.push(r),a.length>0){let u="";for(const d of a){u=u?`${u}/${d}`:d;const c=l.children.get(d);if(c){c.files.push(r),l=c;continue}const f=Dt(u,d);f.files.push(r),l.children.set(d,f),l=f}}l.directFiles.push(r)}return e},Nn=n=>{let e=n,r=n.name;for(;e.directFiles.length===0&&e.children.size===1;){const[t]=e.children.values();e=t,r=`${r}/${t.name}`}return{node:e,label:r}},qr=(n,e)=>{const r=[],t=(i,a)=>{const l=Array.from(i.children.values()).sort((d,c)=>d.path.localeCompare(c.path));for(const d of l){const{node:c,label:f}=Nn(d);r.push({key:c.id,kind:"directory",depth:a,label:f,directory:c}),e.has(c.path)&&t(c,a+1)}const u=[...i.directFiles].sort((d,c)=>d.path.localeCompare(c.path));for(const d of u)r.push({key:`file:${Gt(d.path)}`,kind:"file",depth:a,file:d})};return t(n,0),r},Vr=n=>{const e=ze.c(29),{path:r,from:t,className:i,nameFirst:a}=n,l=a===void 0?!1:a;let u,d;e[0]!==r?(u=r.lastIndexOf("/"),d=u===-1?"":r.slice(0,u),e[0]=r,e[1]=u,e[2]=d):(u=e[1],d=e[2]);const c=d;let f;e[3]!==u||e[4]!==r?(f=r.slice(u+1),e[3]=u,e[4]=r,e[5]=f):f=e[5];const y=f;let h;if(e[6]!==t){const M=t?t.lastIndexOf("/"):-1;h=t&&M!==-1?t.slice(0,M):"",e[6]=t,e[7]=h}else h=e[7];const S=h,R=t?`${t} → ${r}`:r;if(u===-1&&!t){let M;e[8]!==i?(M=je("block min-w-0 truncate text-foreground",i),e[8]=i,e[9]=M):M=e[9];let W;return e[10]!==r||e[11]!==M||e[12]!==R?(W=E.jsx("span",{dir:"ltr",className:M,title:R,children:r}),e[10]=r,e[11]=M,e[12]=R,e[13]=W):W=e[13],W}const w=l&&"gap-2";let O;e[14]!==i||e[15]!==w?(O=je("flex min-w-0 items-baseline overflow-hidden",w,i),e[14]=i,e[15]=w,e[16]=O):O=e[16];let D;e[17]!==t?(D=t?E.jsxs(E.Fragment,{children:[E.jsx("span",{className:"oc-ui-start-align min-w-0 truncate text-muted-foreground",style:{direction:"rtl",unicodeBidi:"plaintext"},children:t}),E.jsx("span",{className:"shrink-0 px-1 text-muted-foreground",children:"→"})]}):null,e[17]=t,e[18]=D):D=e[18];let N;e[19]!==c||e[20]!==S||e[21]!==y||e[22]!==l?(N=l?E.jsxs(E.Fragment,{children:[E.jsx("span",{className:"max-w-full shrink-0 truncate text-foreground",children:y}),c&&c!==S?E.jsx("span",{className:"min-w-0 truncate typography-micro text-muted-foreground",children:c}):null]}):E.jsxs(E.Fragment,{children:[c?E.jsx("span",{className:"oc-ui-start-align min-w-0 truncate text-muted-foreground",style:{direction:"rtl",unicodeBidi:"plaintext"},children:c}):null,E.jsxs("span",{className:"max-w-full shrink-0 truncate",children:[c?E.jsx("span",{className:"text-muted-foreground",children:"/"}):null,E.jsx("span",{className:"text-foreground",children:y})]})]}),e[19]=c,e[20]=S,e[21]=y,e[22]=l,e[23]=N):N=e[23];let H;return e[24]!==O||e[25]!==D||e[26]!==N||e[27]!==R?(H=E.jsxs("span",{dir:"ltr",className:O,title:R,children:[D,N]}),e[24]=O,e[25]=D,e[26]=N,e[27]=R,e[28]=H):H=e[28],H},st=3,Fn=1e6,jt=new WeakMap,Hn=n=>{const e=jt.get(n);if(e)return e;let r=!1;const t=[];for(const a of n.hunks){const l=[];for(const u of a.hunkContent){if(u.type==="context"){dt(l,{...u});continue}const d=$n(n,u);(d.length>1||d[0]?.type==="context")&&(r=!0);for(const c of d)dt(l,c)}t.push(..._n(a,l))}const i=r?jn(n,t):n;return jt.set(n,i),i},Bt=n=>n.replace(/\s+/g,""),$n=(n,e)=>{if(e.deletions===0||e.additions===0)return[{...e}];const r=n.deletionLines.slice(e.deletionLineIndex,e.deletionLineIndex+e.deletions),t=n.additionLines.slice(e.additionLineIndex,e.additionLineIndex+e.additions),i=[];let a=0,l=0;for(const[u,d]of On(r,t))(u>a||d>l)&&i.push({type:"change",deletions:u-a,deletionLineIndex:e.deletionLineIndex+a,additions:d-l,additionLineIndex:e.additionLineIndex+l}),dt(i,{type:"context",lines:1,deletionLineIndex:e.deletionLineIndex+u,additionLineIndex:e.additionLineIndex+d}),a=u+1,l=d+1;return(a<e.deletions||l<e.additions)&&i.push({type:"change",deletions:e.deletions-a,deletionLineIndex:e.deletionLineIndex+a,additions:e.additions-l,additionLineIndex:e.additionLineIndex+l}),i},On=(n,e)=>{const r=n.map(Bt),t=e.map(Bt),i=[];let a=0;for(;a<r.length&&a<t.length&&r[a]===t[a];)i.push([a,a]),a+=1;let l=0;for(;l<r.length-a&&l<t.length-a&&r[r.length-1-l]===t[t.length-1-l];)l+=1;const u=r.length-a-l,d=t.length-a-l;if(u>0&&d>0&&(u+1)*(d+1)<=Fn){const c=d+1,f=new Uint32Array((u+1)*c);for(let S=u-1;S>=0;S-=1)for(let R=d-1;R>=0;R-=1)f[S*c+R]=r[a+S]===t[a+R]?f[(S+1)*c+R+1]+1:Math.max(f[(S+1)*c+R],f[S*c+R+1]);let y=0,h=0;for(;y<u&&h<d;)r[a+y]===t[a+h]?(i.push([a+y,a+h]),y+=1,h+=1):f[(y+1)*c+h]>=f[y*c+h+1]?y+=1:h+=1}for(let c=l;c>0;c-=1)i.push([r.length-c,t.length-c]);return i},dt=(n,e)=>{const r=n.at(-1);if(r?.type==="context"&&e.type==="context"){r.lines+=e.lines;return}n.push(e)},Wt=(n,e,r)=>({type:"context",lines:r,deletionLineIndex:n.deletionLineIndex+e,additionLineIndex:n.additionLineIndex+e}),_n=(n,e)=>{const r=[];let t=null;for(const[a,l]of e.entries()){if(l.type==="change"){if(!t){t=[];const d=e[a-1];if(d?.type==="context"){const c=Math.min(d.lines,st);t.push(Wt(d,d.lines-c,c))}}t.push(l);continue}if(!t)continue;if(a<e.length-1&&l.lines<=st*2){t.push(l);continue}t.push(Wt(l,0,Math.min(l.lines,st))),r.push(t),t=null}t&&r.push(t);const i=e.at(-1);return r.map(a=>{const l=a.at(-1),u=l!==void 0&&i!==void 0&&_e(l,"deletion")===_e(i,"deletion")&&_e(l,"addition")===_e(i,"addition");return Dn(n,a,u)})},_e=(n,e)=>e==="deletion"?n.deletionLineIndex+(n.type==="context"?n.lines:n.deletions):n.additionLineIndex+(n.type==="context"?n.lines:n.additions),Dn=(n,e,r)=>{let t=0,i=0,a=0,l=0,u=0;for(const w of e)w.type==="context"?(a+=w.lines,l+=w.lines,u+=w.lines):(t+=w.additions,i+=w.deletions,l+=Math.max(w.additions,w.deletions),u+=w.additions+w.deletions);const d=e[0],c=a+t,f=a+i,y=zt(Be(n.additionStart,n.additionCount)+d.additionLineIndex-n.additionLineIndex,c),h=zt(Be(n.deletionStart,n.deletionCount)+d.deletionLineIndex-n.deletionLineIndex,f),R=d.additionLineIndex===n.additionLineIndex&&d.deletionLineIndex===n.deletionLineIndex?n.hunkContext:void 0;return{collapsedBefore:0,additionStart:y,additionCount:c,additionLines:t,additionLineIndex:d.additionLineIndex,deletionStart:h,deletionCount:f,deletionLines:i,deletionLineIndex:d.deletionLineIndex,hunkContent:e,hunkContext:R,hunkSpecs:`@@ -${h},${f} +${y},${c} @@${R?` ${R}`:""}
|
|
2
2
|
`,splitLineStart:0,splitLineCount:l,unifiedLineStart:0,unifiedLineCount:u,noEOFCRDeletions:r&&n.noEOFCRDeletions,noEOFCRAdditions:r&&n.noEOFCRAdditions}},Be=(n,e)=>n-(e===0?0:1),zt=(n,e)=>n+(e===0?0:1),jn=(n,e)=>{let r=0,t=0,i=0;for(const l of e)l.collapsedBefore=Math.max(Be(l.additionStart,l.additionCount)-i,0),l.splitLineStart=r+l.collapsedBefore,l.unifiedLineStart=t+l.collapsedBefore,r+=l.collapsedBefore+l.splitLineCount,t+=l.collapsedBefore+l.unifiedLineCount,i=Be(l.additionStart,l.additionCount)+l.additionCount;if(e.at(-1)&&!n.isPartial&&n.additionLines.length>0&&n.deletionLines.length>0){const l=Math.max(n.additionLines.length-i,0);r+=l,t+=l}return{...n,...n.isPartial?Bn(n,e):{hunks:e},splitLineCount:r,unifiedLineCount:t,cacheKey:n.cacheKey===void 0?void 0:`${n.cacheKey}:hide-whitespace`}},Bn=(n,e)=>{const r=[],t=[],i=(l,u,d,c)=>{for(let f=d;f<d+c;f+=1)u.push(l[f])};return{hunks:e.map(l=>{const u=r.length,d=t.length,c=l.hunkContent.map(f=>{const y={...f,deletionLineIndex:r.length,additionLineIndex:t.length};return i(n.deletionLines,r,f.deletionLineIndex,f.type==="context"?f.lines:f.deletions),i(n.additionLines,t,f.additionLineIndex,f.type==="context"?f.lines:f.additions),y});return{...l,deletionLineIndex:u,additionLineIndex:d,hunkContent:c}}),deletionLines:r,additionLines:t}},Wn=n=>n.replace(/\r?\n$/,""),zn=(n,e,r)=>{if(!n.isPartial)return r-1;for(const t of n.hunks){const i=e==="additions"?t.additionStart:t.deletionStart,a=e==="additions"?t.additionCount:t.deletionCount;if(r<i||r>=i+a)continue;return(e==="additions"?t.additionLineIndex:t.deletionLineIndex)+(r-i)}return null},qn=(n,e,r,t)=>{const i=e==="additions"?n.additionLines:n.deletionLines,a=[];for(let l=Math.max(1,r);l<=t;l+=1){const u=zn(n,e,l),d=u===null?void 0:i[u];d!==void 0&&a.push(Wn(d))}return a.join(`
|
|
3
3
|
`)},at=/[\p{L}\p{N}_$]/u,Vn=(n,e)=>{if(e<0||e>n.length)return null;const r=e===n.length?n.length-1:e;if(r<0||!at.test(n[r]))return null;let t=r,i=r+1;for(;t>0&&at.test(n[t-1]);)t-=1;for(;i<n.length&&at.test(n[i]);)i+=1;return{word:n.slice(t,i),spanStart:t}},Kn=n=>n?Array.from(n.children).filter(e=>e instanceof HTMLElement&&e.hasAttribute("data-code")):[],Un=(n,e)=>{const r=new Map,t=()=>{const d=n.getBoundingClientRect().left,c=Array.from(r.values(),f=>({entry:f,left:f.column.getBoundingClientRect().left-d,clientWidth:f.column.clientWidth,scrollWidth:f.column.scrollWidth,scrollLeft:f.column.scrollLeft}));e.hidden=!c.some(f=>f.scrollWidth-f.clientWidth>1);for(const{entry:f,left:y,clientWidth:h,scrollWidth:S,scrollLeft:R}of c){const w=S-h>1;f.track.hidden=!w,w&&(f.track.style.left=`${y}px`,f.track.style.width=`${h}px`,f.spacer.style.width=`${S}px`,f.track.scrollLeft=R)}},i=new ResizeObserver(t),a=new MutationObserver(()=>u()),l=d=>{const c=document.createElement("div");c.className="absolute inset-y-0 overflow-x-auto overflow-y-hidden overscroll-x-none",c.tabIndex=-1,c.hidden=!0;const f=document.createElement("div");f.className="h-px",c.appendChild(f),e.appendChild(c);const y=()=>{Math.abs(c.scrollLeft-d.scrollLeft)>=1&&(c.scrollLeft=d.scrollLeft)},h=()=>{Math.abs(d.scrollLeft-c.scrollLeft)>=1&&(d.scrollLeft=c.scrollLeft)};return d.addEventListener("scroll",y,{passive:!0}),c.addEventListener("scroll",h,{passive:!0}),i.observe(d),{column:d,content:null,track:c,spacer:f,detach:()=>{d.removeEventListener("scroll",y),c.removeEventListener("scroll",h),i.unobserve(d),c.remove()}}},u=()=>{const d=n.querySelector("diffs-container")?.shadowRoot??null,c=d?.querySelector("pre")??null,f=Kn(c);for(const[y,h]of r)f.includes(y)||(h.detach(),h.content&&i.unobserve(h.content),r.delete(y));for(const y of f){const h=r.get(y)??l(y);r.set(y,h);const S=Array.from(y.children).find(R=>R.hasAttribute("data-content"))??null;S!==h.content&&(h.content&&i.unobserve(h.content),S&&i.observe(S),h.content=S)}a.disconnect(),a.observe(n,{childList:!0}),d&&a.observe(d,{childList:!0}),c&&a.observe(c,{childList:!0});for(const y of f)a.observe(y,{childList:!0});r.size===0&&(e.hidden=!0)};return u(),i.observe(n),()=>{a.disconnect(),i.disconnect();for(const d of r.values())d.detach();r.clear(),e.hidden=!0}},Gn=n=>{const e=ze.c(4),{containerRef:r}=n,t=z.useRef(null);let i,a;e[0]!==r?(i=()=>{const u=r.current,d=t.current;if(!(!u||!d))return Un(u,d)},a=[r],e[0]=r,e[1]=i,e[2]=a):(i=e[1],a=e[2]),z.useEffect(i,a);let l;return e[3]===Symbol.for("react.memo_cache_sentinel")?(l=E.jsx("div",{ref:t,hidden:!0,"aria-hidden":"true",className:"sticky bottom-0 z-10 h-2.5 bg-background"}),e[3]=l):l=e[3],l},qt=[],Xn=`
|
|
4
4
|
[data-gutter-buffer="annotation"] { min-height: 0; }
|
package/dist/assets/{useCallableModelProviders-DYpBJMqj.js → useCallableModelProviders-CV8ihNIz.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a}from"./vendor-react--VO_rL_p.js";import{l as u,j as p}from"./katex.min-
|
|
1
|
+
import{r as a}from"./vendor-react--VO_rL_p.js";import{l as u,j as p}from"./katex.min-CAwHaRYk.js";import{W as f}from"./useAppFontEffects-DEX5CMOn.js";function h(t=!0){const i=f(r=>r.providers),e=u(r=>r.currentDirectory),[c,n]=a.useState(void 0);return a.useEffect(()=>{if(!t)return;let r=!1;return(async()=>{try{const l=e?`/api/small-model?directory=${encodeURIComponent(e)}`:"/api/small-model",o=await p(l,{method:"GET",headers:{Accept:"application/json"}});if(!o.ok)return;const s=await o.json().catch(()=>null);!r&&Array.isArray(s?.authenticatedProviders)&&n(s.authenticatedProviders.filter(d=>typeof d=="string"))}catch{}})(),()=>{r=!0}},[i,e,t]),c}export{h as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as we,R as n,j as x}from"./vendor-react--VO_rL_p.js";import{h as Fe}from"./useBranchPullRequestRequest-CIftwmmA.js";import{u as Ce,a3 as Ee,d7 as Se,I as oe,y as Re,ag as ue,B as fe,ah as de,af as he,fP as ve,fQ as Ne}from"./useAppFontEffects-xaAfmUwn.js";import"./katex.min-2cmqKX7p.js";const je="data-diff-find-bar",Qe=t=>{const e=we.c(99),{query:i,onQueryChange:y,total:a,currentIndex:m,isSearching:s,failedCount:C,onNext:g,onPrevious:b,onClose:h,focusNonce:d,className:A}=t,k=C===void 0?0:C,{t:l}=Ce(),E=n.useRef(null);let P,N;e[0]===Symbol.for("react.memo_cache_sentinel")?(P=()=>{E.current?.focus()},N=[],e[0]=P,e[1]=N):(P=e[0],N=e[1]),n.useEffect(P,N);let F,S;e[2]!==d?(F=()=>{d&&d>0&&(E.current?.focus(),E.current?.select())},S=[d],e[2]=d,e[3]=F,e[4]=S):(F=e[3],S=e[4]),n.useEffect(F,S);let I;e[5]!==s||e[6]!==i?(I=i.trim().length>0&&!s,e[5]=s,e[6]=i,e[7]=I):I=e[7];const j=I;let p;e[8]!==m||e[9]!==j||e[10]!==l||e[11]!==a?(p=a>0?l("diffFind.countAria",{current:m+1,total:a}):j?l("diffFind.noMatches"):void 0,e[8]=m,e[9]=j,e[10]=l,e[11]=a,e[12]=p):p=e[12];const _=p;let o;e[13]!==s||e[14]!==_||e[15]!==l?(o=s?[_,l("diffFind.searchingAria")].filter(Boolean).join(", "):_,e[13]=s,e[14]=_,e[15]=l,e[16]=o):o=e[16];const c=o;let u;e[17]!==h||e[18]!==g||e[19]!==b?(u=B=>{Se(B)||(B.key==="Enter"?(B.preventDefault(),B.shiftKey?b():g()):B.key==="Escape"&&(B.preventDefault(),h()))},e[17]=h,e[18]=g,e[19]=b,e[20]=u):u=e[20];const w=u;let R;e[21]!==A?(R=Ee("absolute inset-e-3 top-3 z-40 flex flex-col rounded-lg border border-edge bg-[var(--surface-elevated)] px-1.5 py-1 shadow-lg",A),e[21]=A,e[22]=R):R=e[22];let Q;e[23]===Symbol.for("react.memo_cache_sentinel")?(Q=x.jsx(oe,{name:"search",className:"ms-0.5 size-3.5 text-muted-foreground"}),e[23]=Q):Q=e[23];let T;e[24]!==y?(T=B=>y(B.target.value),e[24]=y,e[25]=T):T=e[25];let O;e[26]!==l?(O=l("diffFind.placeholder"),e[26]=l,e[27]=O):O=e[27];let $;e[28]!==l?($=l("diffFind.placeholder"),e[28]=l,e[29]=$):$=e[29];let z;e[30]!==w||e[31]!==i||e[32]!==T||e[33]!==O||e[34]!==$?(z=x.jsx(Re,{ref:E,value:i,onChange:T,onKeyDown:w,placeholder:O,"aria-label":$,className:"h-7 w-40 rounded-md px-2 py-0 text-sm md:w-56"}),e[30]=w,e[31]=i,e[32]=T,e[33]=O,e[34]=$,e[35]=z):z=e[35];let D;e[36]!==m||e[37]!==j||e[38]!==s||e[39]!==l||e[40]!==a?(D=j&&a===0?l("diffFind.noMatches"):a>0?`${m+1}/${a}${s?"+":""}`:"",e[36]=m,e[37]=j,e[38]=s,e[39]=l,e[40]=a,e[41]=D):D=e[41];let r;e[42]!==c||e[43]!==D?(r=x.jsx("span",{className:"min-w-12 px-1 text-center typography-micro text-muted-foreground tabular-nums","aria-live":"polite","aria-label":c,children:D}),e[42]=c,e[43]=D,e[44]=r):r=e[44];let f;e[45]!==l?(f=l("diffFind.previousAria"),e[45]=l,e[46]=f):f=e[46];const v=a===0;let M;e[47]===Symbol.for("react.memo_cache_sentinel")?(M=x.jsx(oe,{name:"arrow-up",className:"size-3.5"}),e[47]=M):M=e[47];let L;e[48]!==b||e[49]!==f||e[50]!==v?(L=x.jsx(ue,{asChild:!0,children:x.jsx("span",{className:"inline-flex",children:x.jsx(fe,{type:"button",variant:"ghost",size:"sm",className:"size-6 p-0 text-muted-foreground",onClick:b,"aria-label":f,disabled:v,children:M})})}),e[48]=b,e[49]=f,e[50]=v,e[51]=L):L=e[51];let H;e[52]!==l?(H=l("diffFind.previousAria"),e[52]=l,e[53]=H):H=e[53];let K;e[54]!==H?(K=x.jsx(de,{side:"bottom",sideOffset:6,children:H}),e[54]=H,e[55]=K):K=e[55];let W;e[56]!==L||e[57]!==K?(W=x.jsxs(he,{children:[L,K]}),e[56]=L,e[57]=K,e[58]=W):W=e[58];let U;e[59]!==l?(U=l("diffFind.nextAria"),e[59]=l,e[60]=U):U=e[60];const ce=a===0;let re;e[61]===Symbol.for("react.memo_cache_sentinel")?(re=x.jsx(oe,{name:"arrow-down",className:"size-3.5"}),e[61]=re):re=e[61];let q;e[62]!==g||e[63]!==U||e[64]!==ce?(q=x.jsx(ue,{asChild:!0,children:x.jsx("span",{className:"inline-flex",children:x.jsx(fe,{type:"button",variant:"ghost",size:"sm",className:"size-6 p-0 text-muted-foreground",onClick:g,"aria-label":U,disabled:ce,children:re})})}),e[62]=g,e[63]=U,e[64]=ce,e[65]=q):q=e[65];let J;e[66]!==l?(J=l("diffFind.nextAria"),e[66]=l,e[67]=J):J=e[67];let G;e[68]!==J?(G=x.jsx(de,{side:"bottom",sideOffset:6,children:J}),e[68]=J,e[69]=G):G=e[69];let V;e[70]!==q||e[71]!==G?(V=x.jsxs(he,{children:[q,G]}),e[70]=q,e[71]=G,e[72]=V):V=e[72];let X;e[73]!==l?(X=l("diffFind.closeAria"),e[73]=l,e[74]=X):X=e[74];let ie;e[75]===Symbol.for("react.memo_cache_sentinel")?(ie=x.jsx(oe,{name:"close",className:"size-3.5"}),e[75]=ie):ie=e[75];let Y;e[76]!==h||e[77]!==X?(Y=x.jsx(ue,{asChild:!0,children:x.jsx(fe,{type:"button",variant:"ghost",size:"sm",className:"size-6 p-0 text-muted-foreground",onClick:h,"aria-label":X,children:ie})}),e[76]=h,e[77]=X,e[78]=Y):Y=e[78];let Z;e[79]!==l?(Z=l("diffFind.closeAria"),e[79]=l,e[80]=Z):Z=e[80];let ee;e[81]!==Z?(ee=x.jsx(de,{side:"bottom",sideOffset:6,children:Z}),e[81]=Z,e[82]=ee):ee=e[82];let te;e[83]!==Y||e[84]!==ee?(te=x.jsxs(he,{children:[Y,ee]}),e[83]=Y,e[84]=ee,e[85]=te):te=e[85];let ne;e[86]!==z||e[87]!==r||e[88]!==W||e[89]!==V||e[90]!==te?(ne=x.jsxs("div",{className:"flex items-center gap-1",children:[Q,z,r,W,V,te]}),e[86]=z,e[87]=r,e[88]=W,e[89]=V,e[90]=te,e[91]=ne):ne=e[91];let se;e[92]!==k||e[93]!==l?(se=k>0&&x.jsx("p",{className:"w-0 min-w-full px-1 pb-0.5 typography-micro text-status-warning",children:l("diffFind.failedCount",{count:k})}),e[92]=k,e[93]=l,e[94]=se):se=e[94];let le;return e[95]!==R||e[96]!==ne||e[97]!==se?(le=x.jsxs("div",{"data-diff-find-bar":"",className:R,children:[ne,se]}),e[95]=R,e[96]=ne,e[97]=se,e[98]=le):le=e[98],le},Ie=/[.*+?^${}()|[\]\\]/g,Me=t=>t.replace(Ie,"\\$&"),Le=t=>t.replace(/\r?\n$/,""),ke=(t,e,i)=>{const y=new RegExp(Me(e),i?"g":"gi"),a=[];for(const m of t.matchAll(y))a.push({spanStart:m.index??0,spanLength:m[0].length});return a},ae=(t,e,i,y,a,m,s)=>{if(y<1)return;const C=Le(a);for(const g of ke(C,m,s))t.push({filePath:e,side:i,lineNumber:y,spanStart:g.spanStart,spanLength:g.spanLength})},Pe=(t,e,i,y)=>{if(i.length===0)return[];const a=y.caseSensitive??!1,m=y.layout==="inline",s=[];for(const C of t.hunks){let g=C.additionStart,b=C.deletionStart;for(const h of C.hunkContent){if(h.type==="context"){for(let d=0;d<h.lines;d+=1)m||ae(s,e,"deletions",b+d,t.deletionLines[h.deletionLineIndex+d],i,a),ae(s,e,"additions",g+d,t.additionLines[h.additionLineIndex+d],i,a);g+=h.lines,b+=h.lines;continue}for(let d=0;d<h.deletions;d+=1)ae(s,e,"deletions",b+d,t.deletionLines[h.deletionLineIndex+d],i,a);b+=h.deletions;for(let d=0;d<h.additions;d+=1)ae(s,e,"additions",g+d,t.additionLines[h.additionLineIndex+d],i,a);g+=h.additions}}return s},Ae=120,He=(t,e)=>t&&e?Fe(t):t,pe=[],xe=(t,e)=>t.filePath===e.filePath&&t.side===e.side&&t.lineNumber===e.lineNumber&&t.spanStart===e.spanStart,ge=(t,e)=>{const i=t.get(e.filePath);return i!==void 0&&i.revision===e.revision},me=(t,e)=>t.has(e.filePath)&&t.get(e.filePath)===e.revision,be=(t,e)=>{const i=[],y=a=>{for(const m of a){const s=e.get(m.filePath);s?.nestedSources&&s.revision===m.revision?y(s.nestedSources):i.push(m)}};return y(t),i},Ke=({sources:t,caseSensitive:e=!1})=>{const[i,y]=n.useState(!1),[a,m]=n.useState(""),[s,C]=n.useState(""),[g,b]=n.useState(0),[h,d]=n.useState(()=>new Map),A=n.useRef(h),[k,l]=n.useState(()=>new Map),E=n.useRef(k),P=n.useRef(t);P.current=t;const N=n.useRef(i);N.current=i;const F=n.useRef(!1),S=n.useRef(null),I=n.useCallback(async()=>{if(!F.current){F.current=!0;try{for(;;){if(!N.current)return;const r=be(P.current,A.current).find(L=>!ge(A.current,L)&&!me(E.current,L));if(!r)return;let f;try{f=await r.load()}catch{const L=new Map(E.current).set(r.filePath,r.revision);E.current=L,l(L);continue}const v=f!==null&&"nestedSources"in f?{revision:r.revision,diff:null,nestedSources:f.nestedSources}:{revision:r.revision,diff:f,nestedSources:null},M=new Map(A.current).set(r.filePath,v);A.current=M,d(M)}}finally{F.current=!1}}},[]);n.useEffect(()=>{i&&I()},[i,I,t]),n.useEffect(()=>{if(a===s)return;const r=window.setTimeout(()=>{C(a),b(0)},Ae);return()=>window.clearTimeout(r)},[s,a]);const j=n.useMemo(()=>be(t,h),[h,t]),p=n.useMemo(()=>{if(!i)return pe;const r=s.trim();if(r.length===0)return pe;const f=[];for(const v of j){const M=h.get(v.filePath)?.diff;M&&f.push(...Pe(M,v.filePath,r,{caseSensitive:e,layout:v.layout}))}return f},[s,e,i,h,j]),_=n.useRef(p);_.current=p;const[o,c]=n.useState({matches:p,query:s});if(o.matches!==p){const r=o.query===s?o.matches[g]:void 0,f=r?p.findIndex(M=>xe(M,r)):-1,v=f>=0?f:p.length===0?0:Math.min(g,p.length-1);c({matches:p,query:s}),v!==g&&b(v)}const u=n.useCallback(r=>{S.current=null,m(r)},[]),w=n.useCallback(()=>{if(!N.current&&E.current.size>0){const r=new Map;E.current=r,l(r)}y(!0)},[]),R=n.useCallback(()=>{S.current=null,w()},[w]),Q=n.useCallback(()=>{S.current=null,y(!1)},[]),T=n.useCallback((r,f)=>{if(m(r),C(r),w(),f){S.current={...f,query:r};return}S.current=null,b(0)},[w]),O=i&&j.some(r=>!ge(h,r)&&!me(k,r)),$=i?j.filter(r=>me(k,r)).length:0;n.useEffect(()=>{const r=S.current;if(!r)return;if(!i||r.query!==s){S.current=null;return}const f=p.findIndex(v=>xe(v,r));if(f>=0){S.current=null,b(p.length===0?0:(f+1)%p.length);return}O||(S.current=null,b(0))},[s,i,O,p]);const z=n.useCallback(()=>{b(r=>{const f=_.current.length;return f===0?0:(r+1)%f})},[]),D=n.useCallback(()=>{b(r=>{const f=_.current.length;return f===0?0:(r-1+f)%f})},[]);return{isOpen:i,open:R,close:Q,query:a,setQuery:u,matches:p,currentIndex:g,currentMatch:p[g]??null,isSearching:O,failedCount:$,next:z,previous:D,openWithQuery:T}},_e=(t,e)=>t instanceof HTMLElement&&!e?.contains(t)&&(t.isContentEditable||t.matches("input, textarea")),Oe=5e3,Te="[data-find-surface]",ye=(t,e)=>{if(!(t instanceof Element))return!1;const i=t.closest(Te);return i!==null&&i!==e},We=({find:t,visible:e,rootRef:i,reveal:y})=>{const{isOpen:a,matches:m,currentMatch:s,currentIndex:C,open:g,close:b,openWithQuery:h}=t,d=n.useRef(new Map),[A,k]=n.useState(0),l=n.useRef(y);l.current=y;const E=n.useMemo(()=>{const o=new Map;for(const c of m){const u=o.get(c.filePath);u?u.push(c):o.set(c.filePath,[c])}return o},[m]),P=n.useRef({isOpen:a,currentMatch:s,matchesByFile:E});P.current={isOpen:a,currentMatch:s,matchesByFile:E};const N=n.useCallback((o,c)=>{const u=P.current,w=u.currentMatch;if(!u.isOpen||!w||w.filePath!==o){c.setFindHighlights([],0);return}const R=u.matchesByFile.get(o)??[];c.setFindHighlights(R,R.indexOf(w))},[]),F=n.useRef(null),S=n.useCallback(()=>{const o=F.current;o?.frame!=null&&window.cancelAnimationFrame(o.frame),F.current=null},[]),I=n.useCallback(o=>{const c=F.current;c?.frame!=null&&window.cancelAnimationFrame(c.frame);const u={match:o,frame:null,deadline:performance.now()+Oe};F.current=u;const w=()=>{if(u.frame=null,F.current!==u)return;if(d.current.get(o.filePath)?.scrollToLine({lineNumber:o.lineNumber,side:o.side,align:"center"})){F.current=null;return}performance.now()<u.deadline&&(u.frame=window.requestAnimationFrame(w))};u.frame=window.requestAnimationFrame(w)},[]);n.useEffect(()=>S,[S]);const j=n.useCallback((o,c)=>{if(!c){d.current.delete(o);return}d.current.set(o,c),P.current.isOpen&&N(o,c);const u=F.current;u&&u.match.filePath===o&&I(u.match)},[N,I]);n.useEffect(()=>{for(const[o,c]of d.current)N(o,c)},[N,s,a,E]);const p=n.useRef(null);n.useEffect(()=>{if(!a||!s){p.current=null,S();return}const o=`${C}:${s.filePath}:${s.side}:${s.lineNumber}:${s.spanStart}`;p.current!==o&&(p.current=o,l.current(s,d.current.has(s.filePath)),I(s))},[S,C,s,a,I]),ve("find_in_file",o=>{if(!e||o.defaultPrevented||_e(document.activeElement,i.current)||ye(o.target,i.current))return!1;g(),k(c=>c+1)}),n.useEffect(()=>{if(!e||!a)return;const o=c=>{if(c.key!=="Escape"||c.defaultPrevented||Se(c))return;const{target:u}=c;if(!(u instanceof Node))return;const w=document.activeElement,R=!w||w===document.body;!i.current?.contains(u)&&!R||ye(u,i.current)||!(u instanceof Element&&u.closest(`[${je}]`)!==null)&&Ne(u)||(c.preventDefault(),c.stopPropagation(),b())};return window.addEventListener("keydown",o,!0),()=>window.removeEventListener("keydown",o,!0)},[b,a,i,e]);const _=n.useCallback((o,c)=>{h(c.word,{filePath:o,side:c.side,lineNumber:c.lineNumber,spanStart:c.spanStart}),k(u=>u+1)},[h]);return{registerViewer:j,openOnWord:_,focusNonce:A}};export{Qe as D,We as a,He as r,Ke as u};
|
|
1
|
+
import{f as we,R as n,j as x}from"./vendor-react--VO_rL_p.js";import{h as Fe}from"./useBranchPullRequestRequest-CulIXVeT.js";import{u as Ce,a3 as Ee,d7 as Se,I as oe,y as Re,ag as ue,B as fe,ah as de,af as he,fP as ve,fQ as Ne}from"./useAppFontEffects-DEX5CMOn.js";import"./katex.min-CAwHaRYk.js";const je="data-diff-find-bar",Qe=t=>{const e=we.c(99),{query:i,onQueryChange:y,total:a,currentIndex:m,isSearching:s,failedCount:C,onNext:g,onPrevious:b,onClose:h,focusNonce:d,className:A}=t,k=C===void 0?0:C,{t:l}=Ce(),E=n.useRef(null);let P,N;e[0]===Symbol.for("react.memo_cache_sentinel")?(P=()=>{E.current?.focus()},N=[],e[0]=P,e[1]=N):(P=e[0],N=e[1]),n.useEffect(P,N);let F,S;e[2]!==d?(F=()=>{d&&d>0&&(E.current?.focus(),E.current?.select())},S=[d],e[2]=d,e[3]=F,e[4]=S):(F=e[3],S=e[4]),n.useEffect(F,S);let I;e[5]!==s||e[6]!==i?(I=i.trim().length>0&&!s,e[5]=s,e[6]=i,e[7]=I):I=e[7];const j=I;let p;e[8]!==m||e[9]!==j||e[10]!==l||e[11]!==a?(p=a>0?l("diffFind.countAria",{current:m+1,total:a}):j?l("diffFind.noMatches"):void 0,e[8]=m,e[9]=j,e[10]=l,e[11]=a,e[12]=p):p=e[12];const _=p;let o;e[13]!==s||e[14]!==_||e[15]!==l?(o=s?[_,l("diffFind.searchingAria")].filter(Boolean).join(", "):_,e[13]=s,e[14]=_,e[15]=l,e[16]=o):o=e[16];const c=o;let u;e[17]!==h||e[18]!==g||e[19]!==b?(u=B=>{Se(B)||(B.key==="Enter"?(B.preventDefault(),B.shiftKey?b():g()):B.key==="Escape"&&(B.preventDefault(),h()))},e[17]=h,e[18]=g,e[19]=b,e[20]=u):u=e[20];const w=u;let R;e[21]!==A?(R=Ee("absolute inset-e-3 top-3 z-40 flex flex-col rounded-lg border border-edge bg-[var(--surface-elevated)] px-1.5 py-1 shadow-lg",A),e[21]=A,e[22]=R):R=e[22];let Q;e[23]===Symbol.for("react.memo_cache_sentinel")?(Q=x.jsx(oe,{name:"search",className:"ms-0.5 size-3.5 text-muted-foreground"}),e[23]=Q):Q=e[23];let T;e[24]!==y?(T=B=>y(B.target.value),e[24]=y,e[25]=T):T=e[25];let O;e[26]!==l?(O=l("diffFind.placeholder"),e[26]=l,e[27]=O):O=e[27];let $;e[28]!==l?($=l("diffFind.placeholder"),e[28]=l,e[29]=$):$=e[29];let z;e[30]!==w||e[31]!==i||e[32]!==T||e[33]!==O||e[34]!==$?(z=x.jsx(Re,{ref:E,value:i,onChange:T,onKeyDown:w,placeholder:O,"aria-label":$,className:"h-7 w-40 rounded-md px-2 py-0 text-sm md:w-56"}),e[30]=w,e[31]=i,e[32]=T,e[33]=O,e[34]=$,e[35]=z):z=e[35];let D;e[36]!==m||e[37]!==j||e[38]!==s||e[39]!==l||e[40]!==a?(D=j&&a===0?l("diffFind.noMatches"):a>0?`${m+1}/${a}${s?"+":""}`:"",e[36]=m,e[37]=j,e[38]=s,e[39]=l,e[40]=a,e[41]=D):D=e[41];let r;e[42]!==c||e[43]!==D?(r=x.jsx("span",{className:"min-w-12 px-1 text-center typography-micro text-muted-foreground tabular-nums","aria-live":"polite","aria-label":c,children:D}),e[42]=c,e[43]=D,e[44]=r):r=e[44];let f;e[45]!==l?(f=l("diffFind.previousAria"),e[45]=l,e[46]=f):f=e[46];const v=a===0;let M;e[47]===Symbol.for("react.memo_cache_sentinel")?(M=x.jsx(oe,{name:"arrow-up",className:"size-3.5"}),e[47]=M):M=e[47];let L;e[48]!==b||e[49]!==f||e[50]!==v?(L=x.jsx(ue,{asChild:!0,children:x.jsx("span",{className:"inline-flex",children:x.jsx(fe,{type:"button",variant:"ghost",size:"sm",className:"size-6 p-0 text-muted-foreground",onClick:b,"aria-label":f,disabled:v,children:M})})}),e[48]=b,e[49]=f,e[50]=v,e[51]=L):L=e[51];let H;e[52]!==l?(H=l("diffFind.previousAria"),e[52]=l,e[53]=H):H=e[53];let K;e[54]!==H?(K=x.jsx(de,{side:"bottom",sideOffset:6,children:H}),e[54]=H,e[55]=K):K=e[55];let W;e[56]!==L||e[57]!==K?(W=x.jsxs(he,{children:[L,K]}),e[56]=L,e[57]=K,e[58]=W):W=e[58];let U;e[59]!==l?(U=l("diffFind.nextAria"),e[59]=l,e[60]=U):U=e[60];const ce=a===0;let re;e[61]===Symbol.for("react.memo_cache_sentinel")?(re=x.jsx(oe,{name:"arrow-down",className:"size-3.5"}),e[61]=re):re=e[61];let q;e[62]!==g||e[63]!==U||e[64]!==ce?(q=x.jsx(ue,{asChild:!0,children:x.jsx("span",{className:"inline-flex",children:x.jsx(fe,{type:"button",variant:"ghost",size:"sm",className:"size-6 p-0 text-muted-foreground",onClick:g,"aria-label":U,disabled:ce,children:re})})}),e[62]=g,e[63]=U,e[64]=ce,e[65]=q):q=e[65];let J;e[66]!==l?(J=l("diffFind.nextAria"),e[66]=l,e[67]=J):J=e[67];let G;e[68]!==J?(G=x.jsx(de,{side:"bottom",sideOffset:6,children:J}),e[68]=J,e[69]=G):G=e[69];let V;e[70]!==q||e[71]!==G?(V=x.jsxs(he,{children:[q,G]}),e[70]=q,e[71]=G,e[72]=V):V=e[72];let X;e[73]!==l?(X=l("diffFind.closeAria"),e[73]=l,e[74]=X):X=e[74];let ie;e[75]===Symbol.for("react.memo_cache_sentinel")?(ie=x.jsx(oe,{name:"close",className:"size-3.5"}),e[75]=ie):ie=e[75];let Y;e[76]!==h||e[77]!==X?(Y=x.jsx(ue,{asChild:!0,children:x.jsx(fe,{type:"button",variant:"ghost",size:"sm",className:"size-6 p-0 text-muted-foreground",onClick:h,"aria-label":X,children:ie})}),e[76]=h,e[77]=X,e[78]=Y):Y=e[78];let Z;e[79]!==l?(Z=l("diffFind.closeAria"),e[79]=l,e[80]=Z):Z=e[80];let ee;e[81]!==Z?(ee=x.jsx(de,{side:"bottom",sideOffset:6,children:Z}),e[81]=Z,e[82]=ee):ee=e[82];let te;e[83]!==Y||e[84]!==ee?(te=x.jsxs(he,{children:[Y,ee]}),e[83]=Y,e[84]=ee,e[85]=te):te=e[85];let ne;e[86]!==z||e[87]!==r||e[88]!==W||e[89]!==V||e[90]!==te?(ne=x.jsxs("div",{className:"flex items-center gap-1",children:[Q,z,r,W,V,te]}),e[86]=z,e[87]=r,e[88]=W,e[89]=V,e[90]=te,e[91]=ne):ne=e[91];let se;e[92]!==k||e[93]!==l?(se=k>0&&x.jsx("p",{className:"w-0 min-w-full px-1 pb-0.5 typography-micro text-status-warning",children:l("diffFind.failedCount",{count:k})}),e[92]=k,e[93]=l,e[94]=se):se=e[94];let le;return e[95]!==R||e[96]!==ne||e[97]!==se?(le=x.jsxs("div",{"data-diff-find-bar":"",className:R,children:[ne,se]}),e[95]=R,e[96]=ne,e[97]=se,e[98]=le):le=e[98],le},Ie=/[.*+?^${}()|[\]\\]/g,Me=t=>t.replace(Ie,"\\$&"),Le=t=>t.replace(/\r?\n$/,""),ke=(t,e,i)=>{const y=new RegExp(Me(e),i?"g":"gi"),a=[];for(const m of t.matchAll(y))a.push({spanStart:m.index??0,spanLength:m[0].length});return a},ae=(t,e,i,y,a,m,s)=>{if(y<1)return;const C=Le(a);for(const g of ke(C,m,s))t.push({filePath:e,side:i,lineNumber:y,spanStart:g.spanStart,spanLength:g.spanLength})},Pe=(t,e,i,y)=>{if(i.length===0)return[];const a=y.caseSensitive??!1,m=y.layout==="inline",s=[];for(const C of t.hunks){let g=C.additionStart,b=C.deletionStart;for(const h of C.hunkContent){if(h.type==="context"){for(let d=0;d<h.lines;d+=1)m||ae(s,e,"deletions",b+d,t.deletionLines[h.deletionLineIndex+d],i,a),ae(s,e,"additions",g+d,t.additionLines[h.additionLineIndex+d],i,a);g+=h.lines,b+=h.lines;continue}for(let d=0;d<h.deletions;d+=1)ae(s,e,"deletions",b+d,t.deletionLines[h.deletionLineIndex+d],i,a);b+=h.deletions;for(let d=0;d<h.additions;d+=1)ae(s,e,"additions",g+d,t.additionLines[h.additionLineIndex+d],i,a);g+=h.additions}}return s},Ae=120,He=(t,e)=>t&&e?Fe(t):t,pe=[],xe=(t,e)=>t.filePath===e.filePath&&t.side===e.side&&t.lineNumber===e.lineNumber&&t.spanStart===e.spanStart,ge=(t,e)=>{const i=t.get(e.filePath);return i!==void 0&&i.revision===e.revision},me=(t,e)=>t.has(e.filePath)&&t.get(e.filePath)===e.revision,be=(t,e)=>{const i=[],y=a=>{for(const m of a){const s=e.get(m.filePath);s?.nestedSources&&s.revision===m.revision?y(s.nestedSources):i.push(m)}};return y(t),i},Ke=({sources:t,caseSensitive:e=!1})=>{const[i,y]=n.useState(!1),[a,m]=n.useState(""),[s,C]=n.useState(""),[g,b]=n.useState(0),[h,d]=n.useState(()=>new Map),A=n.useRef(h),[k,l]=n.useState(()=>new Map),E=n.useRef(k),P=n.useRef(t);P.current=t;const N=n.useRef(i);N.current=i;const F=n.useRef(!1),S=n.useRef(null),I=n.useCallback(async()=>{if(!F.current){F.current=!0;try{for(;;){if(!N.current)return;const r=be(P.current,A.current).find(L=>!ge(A.current,L)&&!me(E.current,L));if(!r)return;let f;try{f=await r.load()}catch{const L=new Map(E.current).set(r.filePath,r.revision);E.current=L,l(L);continue}const v=f!==null&&"nestedSources"in f?{revision:r.revision,diff:null,nestedSources:f.nestedSources}:{revision:r.revision,diff:f,nestedSources:null},M=new Map(A.current).set(r.filePath,v);A.current=M,d(M)}}finally{F.current=!1}}},[]);n.useEffect(()=>{i&&I()},[i,I,t]),n.useEffect(()=>{if(a===s)return;const r=window.setTimeout(()=>{C(a),b(0)},Ae);return()=>window.clearTimeout(r)},[s,a]);const j=n.useMemo(()=>be(t,h),[h,t]),p=n.useMemo(()=>{if(!i)return pe;const r=s.trim();if(r.length===0)return pe;const f=[];for(const v of j){const M=h.get(v.filePath)?.diff;M&&f.push(...Pe(M,v.filePath,r,{caseSensitive:e,layout:v.layout}))}return f},[s,e,i,h,j]),_=n.useRef(p);_.current=p;const[o,c]=n.useState({matches:p,query:s});if(o.matches!==p){const r=o.query===s?o.matches[g]:void 0,f=r?p.findIndex(M=>xe(M,r)):-1,v=f>=0?f:p.length===0?0:Math.min(g,p.length-1);c({matches:p,query:s}),v!==g&&b(v)}const u=n.useCallback(r=>{S.current=null,m(r)},[]),w=n.useCallback(()=>{if(!N.current&&E.current.size>0){const r=new Map;E.current=r,l(r)}y(!0)},[]),R=n.useCallback(()=>{S.current=null,w()},[w]),Q=n.useCallback(()=>{S.current=null,y(!1)},[]),T=n.useCallback((r,f)=>{if(m(r),C(r),w(),f){S.current={...f,query:r};return}S.current=null,b(0)},[w]),O=i&&j.some(r=>!ge(h,r)&&!me(k,r)),$=i?j.filter(r=>me(k,r)).length:0;n.useEffect(()=>{const r=S.current;if(!r)return;if(!i||r.query!==s){S.current=null;return}const f=p.findIndex(v=>xe(v,r));if(f>=0){S.current=null,b(p.length===0?0:(f+1)%p.length);return}O||(S.current=null,b(0))},[s,i,O,p]);const z=n.useCallback(()=>{b(r=>{const f=_.current.length;return f===0?0:(r+1)%f})},[]),D=n.useCallback(()=>{b(r=>{const f=_.current.length;return f===0?0:(r-1+f)%f})},[]);return{isOpen:i,open:R,close:Q,query:a,setQuery:u,matches:p,currentIndex:g,currentMatch:p[g]??null,isSearching:O,failedCount:$,next:z,previous:D,openWithQuery:T}},_e=(t,e)=>t instanceof HTMLElement&&!e?.contains(t)&&(t.isContentEditable||t.matches("input, textarea")),Oe=5e3,Te="[data-find-surface]",ye=(t,e)=>{if(!(t instanceof Element))return!1;const i=t.closest(Te);return i!==null&&i!==e},We=({find:t,visible:e,rootRef:i,reveal:y})=>{const{isOpen:a,matches:m,currentMatch:s,currentIndex:C,open:g,close:b,openWithQuery:h}=t,d=n.useRef(new Map),[A,k]=n.useState(0),l=n.useRef(y);l.current=y;const E=n.useMemo(()=>{const o=new Map;for(const c of m){const u=o.get(c.filePath);u?u.push(c):o.set(c.filePath,[c])}return o},[m]),P=n.useRef({isOpen:a,currentMatch:s,matchesByFile:E});P.current={isOpen:a,currentMatch:s,matchesByFile:E};const N=n.useCallback((o,c)=>{const u=P.current,w=u.currentMatch;if(!u.isOpen||!w||w.filePath!==o){c.setFindHighlights([],0);return}const R=u.matchesByFile.get(o)??[];c.setFindHighlights(R,R.indexOf(w))},[]),F=n.useRef(null),S=n.useCallback(()=>{const o=F.current;o?.frame!=null&&window.cancelAnimationFrame(o.frame),F.current=null},[]),I=n.useCallback(o=>{const c=F.current;c?.frame!=null&&window.cancelAnimationFrame(c.frame);const u={match:o,frame:null,deadline:performance.now()+Oe};F.current=u;const w=()=>{if(u.frame=null,F.current!==u)return;if(d.current.get(o.filePath)?.scrollToLine({lineNumber:o.lineNumber,side:o.side,align:"center"})){F.current=null;return}performance.now()<u.deadline&&(u.frame=window.requestAnimationFrame(w))};u.frame=window.requestAnimationFrame(w)},[]);n.useEffect(()=>S,[S]);const j=n.useCallback((o,c)=>{if(!c){d.current.delete(o);return}d.current.set(o,c),P.current.isOpen&&N(o,c);const u=F.current;u&&u.match.filePath===o&&I(u.match)},[N,I]);n.useEffect(()=>{for(const[o,c]of d.current)N(o,c)},[N,s,a,E]);const p=n.useRef(null);n.useEffect(()=>{if(!a||!s){p.current=null,S();return}const o=`${C}:${s.filePath}:${s.side}:${s.lineNumber}:${s.spanStart}`;p.current!==o&&(p.current=o,l.current(s,d.current.has(s.filePath)),I(s))},[S,C,s,a,I]),ve("find_in_file",o=>{if(!e||o.defaultPrevented||_e(document.activeElement,i.current)||ye(o.target,i.current))return!1;g(),k(c=>c+1)}),n.useEffect(()=>{if(!e||!a)return;const o=c=>{if(c.key!=="Escape"||c.defaultPrevented||Se(c))return;const{target:u}=c;if(!(u instanceof Node))return;const w=document.activeElement,R=!w||w===document.body;!i.current?.contains(u)&&!R||ye(u,i.current)||!(u instanceof Element&&u.closest(`[${je}]`)!==null)&&Ne(u)||(c.preventDefault(),c.stopPropagation(),b())};return window.addEventListener("keydown",o,!0),()=>window.removeEventListener("keydown",o,!0)},[b,a,i,e]);const _=n.useCallback((o,c)=>{h(c.word,{filePath:o,side:c.side,lineNumber:c.lineNumber,spanStart:c.spanStart}),k(u=>u+1)},[h]);return{registerViewer:j,openOnWord:_,focusNonce:A}};export{Qe as D,We as a,He as r,Ke as u};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{R as w,f as be,j as t}from"./vendor-react--VO_rL_p.js";import{u as Pt}from"./vendor-tanstack-react-virtual-Bw3q1rnq.js";import{hw as Ot,h7 as Ft,u as xe,P as nt,af as at,ag as ot,I as _,a3 as le,ah as lt,e_ as Mt,f6 as Lt,K as Ht,aR as we,B as ne,hx as $t,cm as Gt,hy as _t,t as Oe,q as Fe,D as Me,l as Le,F as He,o as it,hz as Bt,a1 as rt,eQ as ct,n as dt,hA as Kt,ce as Ut,A as ge,C as qt,bP as wt,bQ as vt,hB as Re,hC as jt,cp as Be,hD as Nt,hE as Ct,hF as Xt,hG as St,hH as Ke,hI as kt,hJ as Vt,hK as Wt,hL as Jt,hM as At,hN as Yt,hO as Zt,hP as Qt,hQ as Tt,hR as It,fr as Je,aT as ut,aU as mt,aV as ft,aW as ht,aX as pt,hS as es,hT as ts,hU as ss,hV as is,hW as ns,co as $e,hX as Et,hY as as,x as gt,hZ as os,h_ as ls}from"./useAppFontEffects-xaAfmUwn.js";import{u as Ue,cf as Dt,cg as rs,b3 as qe}from"./katex.min-2cmqKX7p.js";import{a as xt,C as cs,b as ds,c as us,f as ms,T as Ye}from"./useBranchPullRequestRequest-CIftwmmA.js";import{a7 as fs,a5 as hs,a6 as ps,aJ as gs}from"./runtimeEndpointReset-BsAAA4Nf.js";const xs=500,ys=10;let Se=null;const Pe=()=>{Se&&window.clearTimeout(Se.timer),Se=null},zt=l=>({onPointerDown:e=>{if(Pe(),e.pointerType==="mouse"||e.target instanceof Element&&e.target.closest("button, a, input"))return;Se={timer:window.setTimeout(()=>{Se=null,Ot(),l()},xs),x:e.clientX,y:e.clientY}},onPointerMove:e=>{Se&&Math.hypot(e.clientX-Se.x,e.clientY-Se.y)>ys&&Pe()},onPointerUp:Pe,onPointerCancel:Pe,onPointerLeave:Pe,onContextMenu:e=>e.preventDefault()}),bs=l=>{const e=be.c(4),{insertions:s,deletions:i,hideZero:h}=l,f=h===void 0?!1:h;let m;return e[0]!==i||e[1]!==f||e[2]!==s?(m=t.jsx(Lt,{added:s,removed:i,hideZero:f,className:"typography-micro"}),e[0]=i,e[1]=f,e[2]=s,e[3]=m):m=e[3],m},ws=w.memo(function(e){const s=be.c(71),{file:i,actionLabel:h,actionSymbol:f,onAction:m,onViewDiff:u,onRevert:r,isReverting:p,stats:k,rowPaddingClassName:C,indentPx:c,actionAtStart:y,nameOnly:S,showRevert:H}=e,V=c===void 0?0:c,v=y===void 0?!1:y,o=S===void 0?!1:S,x=H===void 0?!0:H;let T;s[0]!==i?(T=Ft(i),s[0]=i,s[1]=T):T=s[1];const I=T,{t:P}=xe(),{isMobile:z}=nt();let ee;s[2]!==I.descriptionKey||s[3]!==P?(ee=P(I.descriptionKey),s[2]=I.descriptionKey,s[3]=P,s[4]=ee):ee=s[4];const q=ee,B=k?.insertions??0,A=k?.deletions??0;let R;s[5]!==m||s[6]!==u?(R=U=>{U.key===" "?(U.preventDefault(),m()):U.key==="Enter"&&(U.preventDefault(),u())},s[5]=m,s[6]=u,s[7]=R):R=s[7];const b=R;let M;s[8]!==m?(M=U=>{U.preventDefault(),U.stopPropagation(),m()},s[8]=m,s[9]=M):M=s[9];const j=M;let D;s[10]!==r?(D=U=>{U.preventDefault(),U.stopPropagation(),r()},s[10]=r,s[11]=D):D=s[11];const $=D,X=f==="+"?"contextTooltips.git.stageFile":"contextTooltips.git.unstageFile";let L;s[12]!==P||s[13]!==X?(L=P(X),s[12]=P,s[13]=X,s[14]=L):L=s[14];let W;s[15]!==h||s[16]!==f||s[17]!==j||s[18]!==L?(W=t.jsx("button",{type:"button",onClick:j,className:"flex size-5 shrink-0 items-center justify-center rounded typography-micro font-semibold text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]","aria-label":h,"data-row-tooltip":L,children:f}),s[15]=h,s[16]=f,s[17]=j,s[18]=L,s[19]=W):W=s[19];const G=W;let J;s[20]!==A||s[21]!==B||s[22]!==z?(J=t.jsx(bs,{insertions:B,deletions:A,hideZero:z}),s[20]=A,s[21]=B,s[22]=z,s[23]=J):J=s[23];const F=J;let O;s[24]!==i.path||s[25]!==$||s[26]!==z||s[27]!==p||s[28]!==x||s[29]!==P?(O=x?t.jsxs(at,{children:[t.jsx(ot,{asChild:!0,children:t.jsx("button",{type:"button",onClick:$,disabled:p,className:le(z?"sr-only":"flex size-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50"),"aria-label":P("gitView.changes.revertFileAria",{path:i.path}),children:p?t.jsx(_,{name:"loader-4",className:"size-3.5 animate-spin"}):t.jsx(_,{name:"arrow-go-back",className:"size-3.5"})})}),t.jsx(lt,{sideOffset:8,children:P("gitView.changes.revertFileTooltip")})]}):null,s[24]=i.path,s[25]=$,s[26]=z,s[27]=p,s[28]=x,s[29]=P,s[30]=O):O=s[30];const Y=O,te=C??"px-3",se=z?"min-h-11 select-none rounded-md active:bg-interactive-hover":"py-1.5";let Z;s[31]!==te||s[32]!==se?(Z=le("group flex items-center gap-2 cursor-pointer",te,se),s[31]=te,s[32]=se,s[33]=Z):Z=s[33];let a;s[34]!==z||s[35]!==p||s[36]!==r||s[37]!==x?(a=z&&x&&!p?zt(r):null,s[34]=z,s[35]=p,s[36]=r,s[37]=x,s[38]=a):a=s[38];let d;s[39]!==V?(d=V>0?{paddingInlineStart:`${V}px`}:void 0,s[39]=V,s[40]=d):d=s[40];const g=v?G:null;let n;s[41]!==I.color?(n={color:I.color},s[41]=I.color,s[42]=n):n=s[42];let E;s[43]!==I.code||s[44]!==q||s[45]!==n?(E=t.jsx("span",{className:"typography-micro font-semibold w-4 text-center uppercase",style:n,title:q,"aria-label":q,children:I.code}),s[43]=I.code,s[44]=q,s[45]=n,s[46]=E):E=s[46];let N;s[47]!==i.path?(N=t.jsx(Mt,{filePath:i.path,className:"h-3.5 w-3.5 shrink-0"}),s[47]=i.path,s[48]=N):N=s[48];let Q;s[49]!==i.path||s[50]!==i.previousPath||s[51]!==z||s[52]!==o?(Q=o?t.jsxs("span",{className:"oc-ui-start-align flex-1 min-w-0 truncate typography-ui-label",style:{direction:"rtl",unicodeBidi:"plaintext"},title:i.previousPath?`${i.previousPath} → ${i.path}`:i.path,children:[i.previousPath?t.jsxs("span",{className:"text-muted-foreground",children:[xt(i.previousPath)," → "]}):null,t.jsx("span",{className:"text-foreground",children:xt(i.path)})]}):t.jsx(cs,{path:i.path,from:i.previousPath,nameFirst:z,className:"flex-1 typography-ui-label"}),s[49]=i.path,s[50]=i.previousPath,s[51]=z,s[52]=o,s[53]=Q):Q=s[53];let K;s[54]!==v||s[55]!==G||s[56]!==p||s[57]!==Y||s[58]!==F?(K=v?t.jsxs(t.Fragment,{children:[F,Y]}):t.jsxs("span",{className:"flex shrink-0 items-center justify-items-end gap-2 md:grid",children:[t.jsx("span",{className:le("md:col-start-1 md:row-start-1",p?"md:invisible":"md:group-hover:invisible md:group-focus-within:invisible"),children:F}),t.jsxs("span",{className:le("flex items-center gap-2 md:col-start-1 md:row-start-1",!p&&"md:invisible md:group-hover:visible md:group-focus-within:visible"),children:[Y,G]})]}),s[54]=v,s[55]=G,s[56]=p,s[57]=Y,s[58]=F,s[59]=K):K=s[59];let ae;return s[60]!==b||s[61]!==u||s[62]!==Z||s[63]!==a||s[64]!==d||s[65]!==g||s[66]!==E||s[67]!==N||s[68]!==Q||s[69]!==K?(ae=t.jsxs("div",{className:Z,role:"button",tabIndex:0,onClick:u,onKeyDown:b,...a,style:d,children:[g,E,N,Q,K]}),s[60]=b,s[61]=u,s[62]=Z,s[63]=a,s[64]=d,s[65]=g,s[66]=E,s[67]=N,s[68]=Q,s[69]=K,s[70]=ae):ae=s[70],ae}),vs=1e3,yt=34,Ze=30,Ge="ps-0 pe-2",Qe=(l,e)=>`${l} ${e}`,Ws=({groups:l,diffStats:e,revertingPaths:s,isRevertingAll:i=!1,headerBackgroundClassName:h="bg-sidebar",onVisiblePathsChange:f,onRevertAll:m,onRevertDirectory:u})=>{const{t:r}=xe(),{isMobile:p}=nt(),k=w.useRef(null),c=Ue(a=>a.gitChangesViewMode)==="tree",y=w.useMemo(()=>l.filter(a=>a.entries.length>0),[l]),[S,H]=w.useState(new Set),[V,v]=w.useState(new Set),[o,x]=w.useState(!1),[T,I]=w.useState(null),P=Ht(),{confirm:z}=P,ee=w.useCallback(async(a,d)=>{await z({title:r("gitView.changes.revertFileDialogTitle"),message:r("gitView.changes.revertFileDescription",{path:d}),action:r("gitView.changes.revertFileConfirm"),destructive:!0})&&a.onRevertFile(d)},[z,r]),q=w.useMemo(()=>y.map(a=>ds(a.entries)),[y]),B=w.useMemo(()=>{const a=[];return y.forEach((d,g)=>{Array.from(q[g]?.children.values()??[]).forEach(n=>{a.push(Qe(d.id,us(n).node.path))})}),a},[q,y]);w.useEffect(()=>{c&&v(a=>{const d=new Set,g=new Set(B);return a.forEach(n=>{(n.slice(n.indexOf(" ")+1).includes("/")||g.has(n))&&d.add(n)}),B.forEach(n=>d.add(n)),d})},[c,B]);const A=w.useMemo(()=>{const a=[];return y.forEach((d,g)=>{if(a.push({type:"header",key:`header:${d.id}`,groupIndex:g}),!S.has(d.id)){if(c){const n=new Set;V.forEach(N=>{N.startsWith(`${d.id} `)&&n.add(N.slice(d.id.length+1))}),ms(q[g],n).forEach(N=>{N.kind==="file"?a.push({type:"file",key:`${d.id}:${N.key}`,groupIndex:g,file:N.file,depth:N.depth}):a.push({type:"directory",key:`${d.id}:${N.key}`,groupIndex:g,directory:N.directory,label:N.label,depth:N.depth})});return}d.entries.forEach(n=>{a.push({type:"file",key:`${d.id}:file:${n.path}`,groupIndex:g,file:n,depth:0})})}}),m&&y.length>0&&a.push({type:"revert-all",key:"revert-all"}),a},[S,V,c,m,q,y]),R=A.length,b=R>=vs,M=Pt({count:R,enabled:b,getScrollElement:()=>k.current,estimateSize:()=>yt,overscan:12,getItemKey:a=>A[a]?.key??a}),j=M.getVirtualItems(),D=w.useMemo(()=>{if(!b)return 0;const a=k.current?.scrollTop??0;return j.find(g=>g.end>a)?.index??0},[b,j,k]);w.useEffect(()=>{if(!f)return;const a=d=>d&&d.type==="file"?d.file.path:null;if(R===0){f([]);return}if(!b){const d=[];for(const g of A)if(g.type==="file"&&(d.push(g.file.path),d.length>=Ze))break;f(d);return}f(A.slice(D,D+Math.ceil((k.current?.clientHeight??0)/yt)+Ze).map(d=>a(d)).filter(d=>!!d).slice(0,Ze))},[f,R,A,b,D]);const $=w.useCallback(a=>{H(d=>{const g=new Set(d);return g.has(a)?g.delete(a):g.add(a),g})},[]),X=w.useCallback((a,d)=>{v(g=>{const n=new Set(g),E=Qe(a,d);return n.has(E)?n.delete(E):n.add(E),n})},[]),L=w.useMemo(()=>{const a=new Set;return y.forEach(d=>d.entries.forEach(g=>a.add(g.path))),Array.from(a)},[y]),W=L.length,G=T?i||T.paths.some(a=>s.has(a)):!1,J=w.useCallback(async()=>{!m||i||L.length===0||(await m(L),x(!1))},[L,i,m]),F=w.useCallback(async()=>{!u||!T||G||(await u(T.paths),I(null))},[G,u,T]),O=w.useCallback((a,d)=>{const g=S.has(a.id),n=a.entries.length;return t.jsxs("div",{className:le("sticky top-0 z-10 flex items-center gap-2 py-2",h,Ge,!d&&"mt-1 border-t border-edge-muted"),children:[t.jsx(we,{sideOffset:8,label:a.actionAllLabel,className:"shrink-0",children:t.jsx("button",{type:"button",onClick:()=>a.onActionAll(a.entries.map(E=>E.path)),className:"flex size-5 shrink-0 items-center justify-center rounded typography-micro font-semibold text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]","aria-label":a.actionAllLabel,children:a.actionSymbol})}),t.jsxs("button",{type:"button",onClick:()=>$(a.id),className:"flex min-w-0 flex-1 items-center gap-2 rounded text-start focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]","aria-expanded":!g,children:[t.jsx("h3",{className:"truncate typography-ui-header font-semibold text-foreground",children:a.title}),t.jsx("span",{className:"typography-meta text-muted-foreground",children:n}),t.jsx(_,{name:"arrow-down-s",className:le("size-3.5 shrink-0 text-muted-foreground transition-transform",g&&"-rotate-90 rtl:rotate-90")})]})]})},[S,h,$]),Y=w.useCallback((a,d,g,n)=>{const E=V.has(Qe(a.id,d.path)),N=d.files.map(K=>K.path),Q=i||N.some(K=>s.has(K));return t.jsxs("div",{className:le("group flex items-center gap-2 text-muted-foreground hover:text-foreground",p?"min-h-11 select-none":"py-1.5",Ge),style:{paddingInlineStart:`${n*Ye}px`},...p&&a.showRevertActions!==!1&&u&&!Q?zt(()=>I({path:d.path,paths:N,count:N.length})):null,children:[t.jsxs("button",{type:"button",onClick:()=>X(a.id,d.path),"aria-expanded":E,className:"flex min-w-0 flex-1 items-center gap-1.5 rounded text-start focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":E?r("gitView.changes.collapseDirectoryAria",{path:d.path}):r("gitView.changes.expandDirectoryAria",{path:d.path}),children:[t.jsx("span",{className:"flex w-4 shrink-0 items-center justify-center",children:t.jsx(_,{name:"arrow-right-s",className:le("size-3.5 transition-transform",E&&"rotate-90 rtl:-rotate-90")})}),t.jsx("span",{className:"min-w-0 truncate typography-ui-label",title:d.path,children:g}),E?null:t.jsx("span",{className:"shrink-0 typography-micro tabular-nums text-muted-foreground",children:d.files.length})]}),t.jsxs("span",{className:le("flex shrink-0 items-center gap-2 transition-opacity",!Q&&"md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100"),children:[a.showRevertActions!==!1&&u?t.jsx("button",{type:"button",onClick:()=>I({path:d.path,paths:N,count:N.length}),disabled:Q,className:p?"sr-only":"flex size-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)] disabled:cursor-not-allowed disabled:opacity-50","aria-label":r("gitView.changes.revertDirectoryAria",{path:d.path}),"data-row-tooltip":r("gitView.changes.revertDirectoryTooltip"),children:Q?t.jsx(_,{name:"loader-4",className:"size-3.5 animate-spin"}):t.jsx(_,{name:"arrow-go-back",className:"size-3.5"})}):null,t.jsx("button",{type:"button",onClick:()=>a.onActionAll(d.files.map(K=>K.path)),className:"flex size-5 shrink-0 items-center justify-center rounded typography-micro font-semibold text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]","aria-label":r(a.actionSymbol==="+"?"gitView.changes.stageDirectoryAria":"gitView.changes.unstageDirectoryAria",{path:d.path}),"data-row-tooltip":r(a.actionSymbol==="+"?"contextTooltips.git.stageFolder":"contextTooltips.git.unstageFolder"),children:a.actionSymbol})]})]})},[V,p,i,u,s,r,X]),te=w.useCallback((a,d)=>{if(a.type==="revert-all")return t.jsx("div",{className:le("flex justify-end py-2",Ge),children:t.jsx(we,{sideOffset:8,label:r("contextTooltips.git.discardAll"),children:t.jsxs(ne,{variant:"ghost",size:"sm",onClick:()=>x(!0),disabled:i,className:"gap-1.5 text-[var(--status-error)] hover:bg-[var(--status-error)]/10 hover:text-[var(--status-error)]",children:[t.jsx(_,{name:"arrow-go-back",className:"size-3.5"}),r("gitView.changes.revertAll")]})})});const g=y[a.groupIndex];if(!g)return null;if(a.type==="header")return O(g,d);if(a.type==="directory")return Y(g,a.directory,a.label,a.depth);const n=a.file;return t.jsx(ws,{file:n,actionLabel:g.getActionLabel(n.path),actionSymbol:g.actionSymbol,onAction:()=>g.onActionFile(n.path),stats:e?.[g.statsScope]?.[n.path],onViewDiff:()=>g.onViewDiff(n.path),onRevert:()=>{ee(g,n.path)},isReverting:s.has(n.path)||i,rowPaddingClassName:Ge,indentPx:a.depth*Ye,actionAtStart:!c,nameOnly:c,showRevert:g.showRevertActions!==!1})},[e,i,c,Y,O,ee,s,r,y]),se=a=>a.type!=="file"&&a.type!=="directory"?null:Array.from({length:a.depth},(d,g)=>t.jsx("span",{"aria-hidden":!0,className:"pointer-events-none absolute inset-y-0 w-px bg-edge",style:{insetInlineStart:`${g*Ye+8}px`}},g)),Z=w.useCallback(a=>{if(c||p)return!1;const d=A[a],g=A[a-1];return!d||!g||d.type!=="file"&&d.type!=="directory"||g.type!=="file"&&g.type!=="directory"?!1:g.groupIndex===d.groupIndex},[p,c,A]);return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"relative flex h-full min-h-0 w-full flex-col overflow-hidden",children:[t.jsx($t,{ref:k,className:"overlay-scrollbar-target overlay-scrollbar-container min-h-0 w-full flex-1 overflow-x-hidden overflow-y-auto",children:b?t.jsx("div",{style:{height:M.getTotalSize(),position:"relative"},children:j.map(a=>{const d=A[a.index];return d?t.jsxs("div",{"data-index":a.index,ref:M.measureElement,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${a.start}px)`},className:le(Z(a.index)&&"before:pointer-events-none before:absolute before:inset-s-0 before:inset-e-2 before:top-0 before:border-t before:border-edge"),children:[se(d),te(d,a.index===0)]},d.key):null})}):t.jsx("div",{role:"list","aria-label":r("gitView.changes.changedFilesAria"),children:A.map((a,d)=>t.jsxs("div",{className:le("relative",Z(d)&&"before:pointer-events-none before:absolute before:inset-s-0 before:inset-e-2 before:top-0 before:border-t before:border-edge"),children:[se(a),te(a,d===0)]},a.key))})}),t.jsx(Gt,{containerRef:k,disableHorizontal:!0}),t.jsx(_t,{containerRef:k,sideOffset:8})]}),P.dialog,t.jsx(Oe,{open:o,onOpenChange:a=>{!i&&!a&&x(!1)},children:t.jsxs(Fe,{className:"max-w-md",children:[t.jsxs(Me,{children:[t.jsx(Le,{children:r("gitView.changes.revertAllDialogTitle")}),t.jsx(He,{children:W===1?r("gitView.changes.revertAllDescriptionSingle",{count:W}):r("gitView.changes.revertAllDescriptionPlural",{count:W})})]}),t.jsxs(it,{children:[t.jsx(ne,{variant:"outline",size:"sm",onClick:()=>x(!1),disabled:i,children:r("gitView.common.cancel")}),t.jsx(ne,{variant:"destructive",size:"sm",onClick:()=>{J()},disabled:i,children:r(i?"gitView.changes.reverting":"gitView.changes.revertAll")})]})]})}),t.jsx(Oe,{open:!!T,onOpenChange:a=>{!G&&!a&&I(null)},children:t.jsxs(Fe,{className:"max-w-md",children:[t.jsxs(Me,{children:[t.jsx(Le,{children:r("gitView.changes.revertDirectoryDialogTitle")}),t.jsx(He,{children:T?T.count===1?r("gitView.changes.revertDirectoryDescriptionSingle",{count:T.count,path:T.path}):r("gitView.changes.revertDirectoryDescriptionPlural",{count:T.count,path:T.path}):null})]}),t.jsxs(it,{children:[t.jsx(ne,{variant:"outline",size:"sm",onClick:()=>I(null),disabled:G,children:r("gitView.common.cancel")}),t.jsx(ne,{variant:"destructive",size:"sm",onClick:()=>{F()},disabled:G||!T,children:r(G?"gitView.changes.reverting":"gitView.changes.revertDirectory")})]})]})})]})},et=38,_e=200,js=l=>{const e=be.c(26),{value:s,onChange:i,onSubmit:h,placeholder:f,disabled:m,hasTouchInput:u,isMobile:r}=l,p=m===void 0?!1:m,k=u===void 0?!1:u,C=r===void 0?!1:r,{t:c}=xe(),y=w.useRef(null),S=Bt(y),H=Ue(Ns);let V;e[0]===Symbol.for("react.memo_cache_sentinel")?(V=()=>{const b=y.current;if(!b)return;const M=document.activeElement===b,j=()=>{b.style.height=`${et}px`;const $=b.scrollHeight,X=Math.min(Math.max($,et),_e);b.style.height=`${X}px`,b.style.overflowY=$>_e?"auto":"hidden",$>_e&&!M&&(b.scrollTop=b.scrollHeight)};j();const D=window.requestAnimationFrame(j);return()=>{window.cancelAnimationFrame(D)}},e[0]=V):V=e[0];let v;e[1]!==s?(v=[s],e[1]=s,e[2]=v):v=e[2],w.useLayoutEffect(V,v);let o;e[3]!==i?(o=b=>i(b.target.value),e[3]=i,e[4]=o):o=e[4];let x;e[5]!==h?(x=b=>{b.key==="Enter"&&(b.metaKey||b.ctrlKey)&&!b.shiftKey&&!b.altKey&&(b.preventDefault(),h?.())},e[5]=h,e[6]=x):x=e[6];let T;e[7]!==f||e[8]!==c?(T=f??c("gitView.commit.messagePlaceholder"),e[7]=f,e[8]=c,e[9]=T):T=e[9];const I=k?"on":"off",P=k?"sentences":"off",z=C||H,ee=p&&"opacity-50";let q;e[10]!==ee?(q=le("oc-raised oc-field w-full rounded-lg bg-surface-elevated px-3 py-2 typography-ui-label text-foreground placeholder:text-muted-foreground","resize-none outline-none",ee),e[10]=ee,e[11]=q):q=e[11];let B;e[12]===Symbol.for("react.memo_cache_sentinel")?(B={minHeight:et,maxHeight:_e},e[12]=B):B=e[12];let A;e[13]!==p||e[14]!==P||e[15]!==z||e[16]!==q||e[17]!==o||e[18]!==x||e[19]!==T||e[20]!==I||e[21]!==s?(A=t.jsx("textarea",{ref:y,value:s,onChange:o,onKeyDown:x,placeholder:T,rows:1,disabled:p,autoCorrect:I,autoCapitalize:P,spellCheck:z,className:q,style:B}),e[13]=p,e[14]=P,e[15]=z,e[16]=q,e[17]=o,e[18]=x,e[19]=T,e[20]=I,e[21]=s,e[22]=A):A=e[22];let R;return e[23]!==S||e[24]!==A?(R=t.jsxs(t.Fragment,{children:[A,S]}),e[23]=S,e[24]=A,e[25]=R):R=e[25],R};function Ns(l){return l.inputSpellcheckEnabled}const Cs=l=>{const e=be.c(30),{highlights:s,onInsert:i}=l,{t:h}=xe();if(s.length===0)return null;let f;e[0]!==s||e[1]!==i?(f=()=>{i(s)},e[0]=s,e[1]=i,e[2]=f):f=e[2];const m=f;let u;e[3]!==h?(u=h("gitView.commit.aiHighlights.title"),e[3]=h,e[4]=u):u=e[4];let r;e[5]!==u?(r=t.jsx("p",{className:"typography-micro text-muted-foreground",children:u}),e[5]=u,e[6]=r):r=e[6];let p;e[7]!==h?(p=h("gitView.commit.aiHighlights.insertAria"),e[7]=h,e[8]=p):p=e[8];let k;e[9]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(_,{name:"arrow-down",className:"size-4"}),e[9]=k):k=e[9];let C;e[10]!==m||e[11]!==p?(C=t.jsx(ot,{asChild:!0,children:t.jsx(ne,{variant:"ghost",size:"icon",className:"size-6",onClick:m,"aria-label":p,children:k})}),e[10]=m,e[11]=p,e[12]=C):C=e[12];let c;e[13]!==h?(c=h("gitView.commit.aiHighlights.insertTooltip"),e[13]=h,e[14]=c):c=e[14];let y;e[15]!==c?(y=t.jsx(lt,{sideOffset:8,children:c}),e[15]=c,e[16]=y):y=e[16];let S;e[17]!==C||e[18]!==y?(S=t.jsxs(at,{children:[C,y]}),e[17]=C,e[18]=y,e[19]=S):S=e[19];let H;e[20]!==r||e[21]!==S?(H=t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r,S]}),e[20]=r,e[21]=S,e[22]=H):H=e[22];let V;e[23]!==s?(V=s.map(Ss),e[23]=s,e[24]=V):V=e[24];let v;e[25]!==V?(v=t.jsx("ul",{className:"space-y-1",children:V}),e[25]=V,e[26]=v):v=e[26];let o;return e[27]!==H||e[28]!==v?(o=t.jsxs("div",{className:"space-y-2 rounded-xl oc-tile px-3 py-2",children:[H,v]}),e[27]=H,e[28]=v,e[29]=o):o=e[29],o};function Ss(l,e){return t.jsx("li",{className:"typography-meta text-foreground",children:l},`${l}-${e}`)}const Js=l=>{const e=be.c(113),{stagedCount:s,commitMessage:i,onCommitMessageChange:h,generatedHighlights:f,onInsertHighlights:m,onGenerateMessage:u,isGeneratingMessage:r,onCommit:p,onCommitAndPush:k,commitAction:C,networkOperationBlocked:c,hasPendingIndexMutation:y,gitmojiEnabled:S,onOpenGitmojiPicker:H}=l,V=c===void 0?!1:c,v=y===void 0?!1:y,{t:o}=xe(),x=s>0;let T;e[0]!==C||e[1]!==i||e[2]!==v||e[3]!==x?(T=i.trim()&&x&&C===null&&!v,e[0]=C,e[1]=i,e[2]=v,e[3]=x,e[4]=T):T=e[4];const I=T,{isMobile:P,hasTouchInput:z}=nt(),[ee,q]=w.useState(!1);let B;e[5]!==i||e[6]!==x||e[7]!==o?(B=x?i.trim()?null:o("contextTooltips.git.writeMessageFirst"):o("contextTooltips.git.stageFilesFirst"),e[5]=i,e[6]=x,e[7]=o,e[8]=B):B=e[8];const A=B;if(P&&!ee&&!x&&!i.trim()&&f.length===0){let oe;e[9]!==o?(oe=o("gitView.commit.title"),e[9]=o,e[10]=oe):oe=e[10];let me;e[11]!==oe?(me=t.jsx("h3",{className:"typography-ui-header font-semibold text-foreground",children:oe}),e[11]=oe,e[12]=me):me=e[12];let fe;e[13]!==o?(fe=o("gitView.commit.stageFilesHint"),e[13]=o,e[14]=fe):fe=e[14];let he;e[15]!==fe?(he=t.jsx("span",{className:"min-w-0 truncate typography-meta text-muted-foreground",children:fe}),e[15]=fe,e[16]=he):he=e[16];let ve;return e[17]!==me||e[18]!==he?(ve=t.jsxs("section",{className:"flex items-baseline gap-2",children:[me,he]}),e[17]=me,e[18]=he,e[19]=ve):ve=e[19],ve}let R,b;e[20]===Symbol.for("react.memo_cache_sentinel")?(R=()=>q(!0),b=oe=>{oe.currentTarget.contains(oe.relatedTarget)||q(!1)},e[20]=R,e[21]=b):(R=e[20],b=e[21]);let M;e[22]!==o?(M=o("gitView.commit.title"),e[22]=o,e[23]=M):M=e[23];let j;e[24]!==M?(j=t.jsx("h3",{className:"typography-ui-header font-semibold text-foreground",children:M}),e[24]=M,e[25]=j):j=e[25];let D;e[26]!==x||e[27]!==o?(D=x?null:t.jsx("span",{className:"min-w-0 truncate typography-meta text-muted-foreground",children:o("gitView.commit.stageFilesHint")}),e[26]=x,e[27]=o,e[28]=D):D=e[28];let $;e[29]!==j||e[30]!==D?($=t.jsxs("div",{className:"flex w-full items-baseline gap-2 px-0 pt-2 pb-1",children:[j,D]}),e[29]=j,e[30]=D,e[31]=$):$=e[31];let X;e[32]!==f||e[33]!==m?(X=t.jsx(Cs,{highlights:f,onInsert:m}),e[32]=f,e[33]=m,e[34]=X):X=e[34];let L;e[35]!==I||e[36]!==r||e[37]!==p?(L=()=>{I&&!r&&p()},e[35]=I,e[36]=r,e[37]=p,e[38]=L):L=e[38];let W;e[39]!==o?(W=o("gitView.commit.messagePlaceholder"),e[39]=o,e[40]=W):W=e[40];const G=C!==null;let J;e[41]!==i||e[42]!==z||e[43]!==P||e[44]!==h||e[45]!==L||e[46]!==W||e[47]!==G?(J=t.jsx(js,{value:i,onChange:h,onSubmit:L,placeholder:W,disabled:G,hasTouchInput:z,isMobile:P}),e[41]=i,e[42]=z,e[43]=P,e[44]=h,e[45]=L,e[46]=W,e[47]=G,e[48]=J):J=e[48];let F;e[49]!==S||e[50]!==H||e[51]!==o?(F=S&&t.jsx(we,{sideOffset:8,label:o("contextTooltips.git.addGitmoji"),className:"w-fit",children:t.jsxs(ne,{variant:"outline",size:"sm",onClick:H,className:"w-fit",type:"button",children:[t.jsx(_,{name:"emotion-happy",className:"size-4"}),o("gitView.commit.addGitmoji")]})}),e[49]=S,e[50]=H,e[51]=o,e[52]=F):F=e[52];let O;e[53]!==x||e[54]!==o?(O=o(x?"gitView.commit.generateAria":"contextTooltips.git.stageFilesFirst"),e[53]=x,e[54]=o,e[55]=O):O=e[55];const Y=r||C!==null||v||s===0;let te;e[56]!==o?(te=o("gitView.commit.generateAria"),e[56]=o,e[57]=te):te=e[57];let se;e[58]!==r?(se=r?t.jsx(_,{name:"loader-4",className:"size-4 animate-spin"}):t.jsx(_,{name:"ai-generate-2",className:"size-4 text-primary"}),e[58]=r,e[59]=se):se=e[59];let Z;e[60]!==o?(Z=o("gitView.commit.generate"),e[60]=o,e[61]=Z):Z=e[61];let a;e[62]!==Z?(a=t.jsx("span",{className:"commit-actions__label",children:Z}),e[62]=Z,e[63]=a):a=e[63];let d;e[64]!==u||e[65]!==Y||e[66]!==te||e[67]!==se||e[68]!==a?(d=t.jsxs(ne,{variant:"outline",size:"sm",onClick:u,disabled:Y,type:"button","aria-label":te,className:"commit-actions__btn",children:[se,a]}),e[64]=u,e[65]=Y,e[66]=te,e[67]=se,e[68]=a,e[69]=d):d=e[69];let g;e[70]!==O||e[71]!==d?(g=t.jsx(we,{sideOffset:8,label:O,children:d}),e[70]=O,e[71]=d,e[72]=g):g=e[72];let n;e[73]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx("div",{className:"flex-1"}),e[73]=n):n=e[73];let E;e[74]!==A||e[75]!==o?(E=A??o("contextTooltips.git.commit"),e[74]=A,e[75]=o,e[76]=E):E=e[76];let N;e[77]!==p?(N=oe=>p(oe.currentTarget),e[77]=p,e[78]=N):N=e[78];const Q=!I||r;let K;e[79]!==o?(K=o("gitView.commit.commitAria"),e[79]=o,e[80]=K):K=e[80];let ae;e[81]!==C||e[82]!==o?(ae=C==="commit"?t.jsxs(t.Fragment,{children:[t.jsx(_,{name:"loader-4",className:"size-4 animate-spin"}),t.jsx("span",{className:"commit-actions__label",children:o("gitView.commit.committing")})]}):t.jsxs(t.Fragment,{children:[t.jsx(_,{name:"git-commit",className:"size-4"}),t.jsx("span",{className:"commit-actions__label",children:o("gitView.commit.commit")})]}),e[81]=C,e[82]=o,e[83]=ae):ae=e[83];let U;e[84]!==N||e[85]!==Q||e[86]!==K||e[87]!==ae?(U=t.jsx(ne,{size:"sm",variant:"outline",onClick:N,disabled:Q,className:"commit-actions__btn whitespace-nowrap","aria-label":K,children:ae}),e[84]=N,e[85]=Q,e[86]=K,e[87]=ae,e[88]=U):U=e[88];let re;e[89]!==E||e[90]!==U?(re=t.jsx(we,{sideOffset:8,label:E,children:U}),e[89]=E,e[90]=U,e[91]=re):re=e[91];let ce;e[92]!==I||e[93]!==C||e[94]!==A||e[95]!==r||e[96]!==P||e[97]!==V||e[98]!==k||e[99]!==o?(ce=P?t.jsxs(at,{children:[t.jsx(ot,{asChild:!0,children:t.jsx(ne,{variant:"default",size:"sm",onClick:oe=>k(oe.currentTarget),disabled:!I||r||V,className:"h-7 w-7 p-0","aria-label":o("gitView.commit.pushAria"),children:C==="commitAndPush"?t.jsx(_,{name:"loader-4",className:"size-4 animate-spin"}):t.jsx(_,{name:"arrow-up",className:"size-3.5"})})}),t.jsx(lt,{side:"top",children:t.jsx("p",{children:o("gitView.commit.push")})})]}):t.jsx(we,{sideOffset:8,label:A??o("contextTooltips.git.commitAndSync"),children:t.jsx(ne,{size:"sm",variant:"default",onClick:oe=>k(oe.currentTarget),disabled:!I||r||V,className:"commit-actions__btn","aria-label":o("gitView.commit.pushAria"),children:C==="commitAndPush"?t.jsxs(t.Fragment,{children:[t.jsx(_,{name:"loader-4",className:"size-4 animate-spin"}),t.jsx("span",{className:"commit-actions__label commit-actions__label--push",children:o("gitView.commit.pushing")})]}):t.jsxs(t.Fragment,{children:[t.jsx(_,{name:"arrow-up",className:"size-3.5"}),t.jsx("span",{className:"commit-actions__label commit-actions__label--push",children:o("gitView.commit.push")})]})})}),e[92]=I,e[93]=C,e[94]=A,e[95]=r,e[96]=P,e[97]=V,e[98]=k,e[99]=o,e[100]=ce):ce=e[100];let de;e[101]!==g||e[102]!==re||e[103]!==ce?(de=t.jsxs("div",{className:"@container/commit-actions flex items-center gap-2 min-w-0",children:[g,n,re,ce]}),e[101]=g,e[102]=re,e[103]=ce,e[104]=de):de=e[104];let ue;e[105]!==X||e[106]!==J||e[107]!==F||e[108]!==de?(ue=t.jsxs("div",{className:"flex flex-col gap-3 px-0 pt-1 pb-3",children:[X,J,F,de]}),e[105]=X,e[106]=J,e[107]=F,e[108]=de,e[109]=ue):ue=e[109];let ye;return e[110]!==$||e[111]!==ue?(ye=t.jsxs("section",{className:"border-0 bg-transparent rounded-none",onFocus:R,onBlur:b,children:[$,ue]}),e[110]=$,e[111]=ue,e[112]=ye):ye=e[112],ye},Ys=l=>{const e=be.c(153),{open:s,onOpenChange:i,conflictFiles:h,directory:f,operation:m,onAbort:u,onClearState:r,onNavigatedToChat:p}=l;let k;e[0]!==h?(k=h===void 0?[]:h,e[0]=h,e[1]=k):k=e[1];const C=k,{t:c}=xe(),y=rt(ks),S=rt(Vs),H=ct(As),V=ct(Ts),[v,o]=w.useState(!1),[x,T]=w.useState(null),[I,P]=w.useState(null);let z,ee;e[2]!==f||e[3]!==s||e[4]!==c?(z=()=>{!s||!f||(o(!0),P(null),T(null),Kt(f).then(ie=>{T(ie)}).catch(ie=>{const pe=ie instanceof Error?ie.message:c("gitView.conflict.loadFailed");P(pe)}).finally(()=>{o(!1)}))},ee=[s,f,c],e[2]=f,e[3]=s,e[4]=c,e[5]=z,e[6]=ee):(z=e[5],ee=e[6]),w.useEffect(z,ee);let q;e[7]!==x||e[8]!==f||e[9]!==m?(q=async()=>{if(!x)return null;const ie=m==="merge"?"merge":"rebase",pe=x.headInfo||(m==="merge"?"MERGE_HEAD":"REBASE_HEAD"),ke=m==="merge"?"git commit --no-edit":"git rebase --continue",Ve=await Ut(f),je=Ve.render("git.conflict.resolve.visible",{operation_label:ie,head_ref:pe}),Ne=Ve.render("git.conflict.resolve.instructions",{operation_label:ie,directory:f,operation:m,head_info:x.headInfo||"N/A",continue_cmd:ke}),Ce=`${ie} conflict context (JSON)
|
|
1
|
+
import{R as w,f as be,j as t}from"./vendor-react--VO_rL_p.js";import{u as Pt}from"./vendor-tanstack-react-virtual-Bw3q1rnq.js";import{hw as Ot,h7 as Ft,u as xe,P as nt,af as at,ag as ot,I as _,a3 as le,ah as lt,e_ as Mt,f6 as Lt,K as Ht,aR as we,B as ne,hx as $t,cm as Gt,hy as _t,t as Oe,q as Fe,D as Me,l as Le,F as He,o as it,hz as Bt,a1 as rt,eQ as ct,n as dt,hA as Kt,ce as Ut,A as ge,C as qt,bP as wt,bQ as vt,hB as Re,hC as jt,cp as Be,hD as Nt,hE as Ct,hF as Xt,hG as St,hH as Ke,hI as kt,hJ as Vt,hK as Wt,hL as Jt,hM as At,hN as Yt,hO as Zt,hP as Qt,hQ as Tt,hR as It,fr as Je,aT as ut,aU as mt,aV as ft,aW as ht,aX as pt,hS as es,hT as ts,hU as ss,hV as is,hW as ns,co as $e,hX as Et,hY as as,x as gt,hZ as os,h_ as ls}from"./useAppFontEffects-DEX5CMOn.js";import{u as Ue,cf as Dt,cg as rs,b3 as qe}from"./katex.min-CAwHaRYk.js";import{a as xt,C as cs,b as ds,c as us,f as ms,T as Ye}from"./useBranchPullRequestRequest-CulIXVeT.js";import{a7 as fs,a5 as hs,a6 as ps,aJ as gs}from"./runtimeEndpointReset-DKWDEJh9.js";const xs=500,ys=10;let Se=null;const Pe=()=>{Se&&window.clearTimeout(Se.timer),Se=null},zt=l=>({onPointerDown:e=>{if(Pe(),e.pointerType==="mouse"||e.target instanceof Element&&e.target.closest("button, a, input"))return;Se={timer:window.setTimeout(()=>{Se=null,Ot(),l()},xs),x:e.clientX,y:e.clientY}},onPointerMove:e=>{Se&&Math.hypot(e.clientX-Se.x,e.clientY-Se.y)>ys&&Pe()},onPointerUp:Pe,onPointerCancel:Pe,onPointerLeave:Pe,onContextMenu:e=>e.preventDefault()}),bs=l=>{const e=be.c(4),{insertions:s,deletions:i,hideZero:h}=l,f=h===void 0?!1:h;let m;return e[0]!==i||e[1]!==f||e[2]!==s?(m=t.jsx(Lt,{added:s,removed:i,hideZero:f,className:"typography-micro"}),e[0]=i,e[1]=f,e[2]=s,e[3]=m):m=e[3],m},ws=w.memo(function(e){const s=be.c(71),{file:i,actionLabel:h,actionSymbol:f,onAction:m,onViewDiff:u,onRevert:r,isReverting:p,stats:k,rowPaddingClassName:C,indentPx:c,actionAtStart:y,nameOnly:S,showRevert:H}=e,V=c===void 0?0:c,v=y===void 0?!1:y,o=S===void 0?!1:S,x=H===void 0?!0:H;let T;s[0]!==i?(T=Ft(i),s[0]=i,s[1]=T):T=s[1];const I=T,{t:P}=xe(),{isMobile:z}=nt();let ee;s[2]!==I.descriptionKey||s[3]!==P?(ee=P(I.descriptionKey),s[2]=I.descriptionKey,s[3]=P,s[4]=ee):ee=s[4];const q=ee,B=k?.insertions??0,A=k?.deletions??0;let R;s[5]!==m||s[6]!==u?(R=U=>{U.key===" "?(U.preventDefault(),m()):U.key==="Enter"&&(U.preventDefault(),u())},s[5]=m,s[6]=u,s[7]=R):R=s[7];const b=R;let M;s[8]!==m?(M=U=>{U.preventDefault(),U.stopPropagation(),m()},s[8]=m,s[9]=M):M=s[9];const j=M;let D;s[10]!==r?(D=U=>{U.preventDefault(),U.stopPropagation(),r()},s[10]=r,s[11]=D):D=s[11];const $=D,X=f==="+"?"contextTooltips.git.stageFile":"contextTooltips.git.unstageFile";let L;s[12]!==P||s[13]!==X?(L=P(X),s[12]=P,s[13]=X,s[14]=L):L=s[14];let W;s[15]!==h||s[16]!==f||s[17]!==j||s[18]!==L?(W=t.jsx("button",{type:"button",onClick:j,className:"flex size-5 shrink-0 items-center justify-center rounded typography-micro font-semibold text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]","aria-label":h,"data-row-tooltip":L,children:f}),s[15]=h,s[16]=f,s[17]=j,s[18]=L,s[19]=W):W=s[19];const G=W;let J;s[20]!==A||s[21]!==B||s[22]!==z?(J=t.jsx(bs,{insertions:B,deletions:A,hideZero:z}),s[20]=A,s[21]=B,s[22]=z,s[23]=J):J=s[23];const F=J;let O;s[24]!==i.path||s[25]!==$||s[26]!==z||s[27]!==p||s[28]!==x||s[29]!==P?(O=x?t.jsxs(at,{children:[t.jsx(ot,{asChild:!0,children:t.jsx("button",{type:"button",onClick:$,disabled:p,className:le(z?"sr-only":"flex size-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50"),"aria-label":P("gitView.changes.revertFileAria",{path:i.path}),children:p?t.jsx(_,{name:"loader-4",className:"size-3.5 animate-spin"}):t.jsx(_,{name:"arrow-go-back",className:"size-3.5"})})}),t.jsx(lt,{sideOffset:8,children:P("gitView.changes.revertFileTooltip")})]}):null,s[24]=i.path,s[25]=$,s[26]=z,s[27]=p,s[28]=x,s[29]=P,s[30]=O):O=s[30];const Y=O,te=C??"px-3",se=z?"min-h-11 select-none rounded-md active:bg-interactive-hover":"py-1.5";let Z;s[31]!==te||s[32]!==se?(Z=le("group flex items-center gap-2 cursor-pointer",te,se),s[31]=te,s[32]=se,s[33]=Z):Z=s[33];let a;s[34]!==z||s[35]!==p||s[36]!==r||s[37]!==x?(a=z&&x&&!p?zt(r):null,s[34]=z,s[35]=p,s[36]=r,s[37]=x,s[38]=a):a=s[38];let d;s[39]!==V?(d=V>0?{paddingInlineStart:`${V}px`}:void 0,s[39]=V,s[40]=d):d=s[40];const g=v?G:null;let n;s[41]!==I.color?(n={color:I.color},s[41]=I.color,s[42]=n):n=s[42];let E;s[43]!==I.code||s[44]!==q||s[45]!==n?(E=t.jsx("span",{className:"typography-micro font-semibold w-4 text-center uppercase",style:n,title:q,"aria-label":q,children:I.code}),s[43]=I.code,s[44]=q,s[45]=n,s[46]=E):E=s[46];let N;s[47]!==i.path?(N=t.jsx(Mt,{filePath:i.path,className:"h-3.5 w-3.5 shrink-0"}),s[47]=i.path,s[48]=N):N=s[48];let Q;s[49]!==i.path||s[50]!==i.previousPath||s[51]!==z||s[52]!==o?(Q=o?t.jsxs("span",{className:"oc-ui-start-align flex-1 min-w-0 truncate typography-ui-label",style:{direction:"rtl",unicodeBidi:"plaintext"},title:i.previousPath?`${i.previousPath} → ${i.path}`:i.path,children:[i.previousPath?t.jsxs("span",{className:"text-muted-foreground",children:[xt(i.previousPath)," → "]}):null,t.jsx("span",{className:"text-foreground",children:xt(i.path)})]}):t.jsx(cs,{path:i.path,from:i.previousPath,nameFirst:z,className:"flex-1 typography-ui-label"}),s[49]=i.path,s[50]=i.previousPath,s[51]=z,s[52]=o,s[53]=Q):Q=s[53];let K;s[54]!==v||s[55]!==G||s[56]!==p||s[57]!==Y||s[58]!==F?(K=v?t.jsxs(t.Fragment,{children:[F,Y]}):t.jsxs("span",{className:"flex shrink-0 items-center justify-items-end gap-2 md:grid",children:[t.jsx("span",{className:le("md:col-start-1 md:row-start-1",p?"md:invisible":"md:group-hover:invisible md:group-focus-within:invisible"),children:F}),t.jsxs("span",{className:le("flex items-center gap-2 md:col-start-1 md:row-start-1",!p&&"md:invisible md:group-hover:visible md:group-focus-within:visible"),children:[Y,G]})]}),s[54]=v,s[55]=G,s[56]=p,s[57]=Y,s[58]=F,s[59]=K):K=s[59];let ae;return s[60]!==b||s[61]!==u||s[62]!==Z||s[63]!==a||s[64]!==d||s[65]!==g||s[66]!==E||s[67]!==N||s[68]!==Q||s[69]!==K?(ae=t.jsxs("div",{className:Z,role:"button",tabIndex:0,onClick:u,onKeyDown:b,...a,style:d,children:[g,E,N,Q,K]}),s[60]=b,s[61]=u,s[62]=Z,s[63]=a,s[64]=d,s[65]=g,s[66]=E,s[67]=N,s[68]=Q,s[69]=K,s[70]=ae):ae=s[70],ae}),vs=1e3,yt=34,Ze=30,Ge="ps-0 pe-2",Qe=(l,e)=>`${l} ${e}`,Ws=({groups:l,diffStats:e,revertingPaths:s,isRevertingAll:i=!1,headerBackgroundClassName:h="bg-sidebar",onVisiblePathsChange:f,onRevertAll:m,onRevertDirectory:u})=>{const{t:r}=xe(),{isMobile:p}=nt(),k=w.useRef(null),c=Ue(a=>a.gitChangesViewMode)==="tree",y=w.useMemo(()=>l.filter(a=>a.entries.length>0),[l]),[S,H]=w.useState(new Set),[V,v]=w.useState(new Set),[o,x]=w.useState(!1),[T,I]=w.useState(null),P=Ht(),{confirm:z}=P,ee=w.useCallback(async(a,d)=>{await z({title:r("gitView.changes.revertFileDialogTitle"),message:r("gitView.changes.revertFileDescription",{path:d}),action:r("gitView.changes.revertFileConfirm"),destructive:!0})&&a.onRevertFile(d)},[z,r]),q=w.useMemo(()=>y.map(a=>ds(a.entries)),[y]),B=w.useMemo(()=>{const a=[];return y.forEach((d,g)=>{Array.from(q[g]?.children.values()??[]).forEach(n=>{a.push(Qe(d.id,us(n).node.path))})}),a},[q,y]);w.useEffect(()=>{c&&v(a=>{const d=new Set,g=new Set(B);return a.forEach(n=>{(n.slice(n.indexOf(" ")+1).includes("/")||g.has(n))&&d.add(n)}),B.forEach(n=>d.add(n)),d})},[c,B]);const A=w.useMemo(()=>{const a=[];return y.forEach((d,g)=>{if(a.push({type:"header",key:`header:${d.id}`,groupIndex:g}),!S.has(d.id)){if(c){const n=new Set;V.forEach(N=>{N.startsWith(`${d.id} `)&&n.add(N.slice(d.id.length+1))}),ms(q[g],n).forEach(N=>{N.kind==="file"?a.push({type:"file",key:`${d.id}:${N.key}`,groupIndex:g,file:N.file,depth:N.depth}):a.push({type:"directory",key:`${d.id}:${N.key}`,groupIndex:g,directory:N.directory,label:N.label,depth:N.depth})});return}d.entries.forEach(n=>{a.push({type:"file",key:`${d.id}:file:${n.path}`,groupIndex:g,file:n,depth:0})})}}),m&&y.length>0&&a.push({type:"revert-all",key:"revert-all"}),a},[S,V,c,m,q,y]),R=A.length,b=R>=vs,M=Pt({count:R,enabled:b,getScrollElement:()=>k.current,estimateSize:()=>yt,overscan:12,getItemKey:a=>A[a]?.key??a}),j=M.getVirtualItems(),D=w.useMemo(()=>{if(!b)return 0;const a=k.current?.scrollTop??0;return j.find(g=>g.end>a)?.index??0},[b,j,k]);w.useEffect(()=>{if(!f)return;const a=d=>d&&d.type==="file"?d.file.path:null;if(R===0){f([]);return}if(!b){const d=[];for(const g of A)if(g.type==="file"&&(d.push(g.file.path),d.length>=Ze))break;f(d);return}f(A.slice(D,D+Math.ceil((k.current?.clientHeight??0)/yt)+Ze).map(d=>a(d)).filter(d=>!!d).slice(0,Ze))},[f,R,A,b,D]);const $=w.useCallback(a=>{H(d=>{const g=new Set(d);return g.has(a)?g.delete(a):g.add(a),g})},[]),X=w.useCallback((a,d)=>{v(g=>{const n=new Set(g),E=Qe(a,d);return n.has(E)?n.delete(E):n.add(E),n})},[]),L=w.useMemo(()=>{const a=new Set;return y.forEach(d=>d.entries.forEach(g=>a.add(g.path))),Array.from(a)},[y]),W=L.length,G=T?i||T.paths.some(a=>s.has(a)):!1,J=w.useCallback(async()=>{!m||i||L.length===0||(await m(L),x(!1))},[L,i,m]),F=w.useCallback(async()=>{!u||!T||G||(await u(T.paths),I(null))},[G,u,T]),O=w.useCallback((a,d)=>{const g=S.has(a.id),n=a.entries.length;return t.jsxs("div",{className:le("sticky top-0 z-10 flex items-center gap-2 py-2",h,Ge,!d&&"mt-1 border-t border-edge-muted"),children:[t.jsx(we,{sideOffset:8,label:a.actionAllLabel,className:"shrink-0",children:t.jsx("button",{type:"button",onClick:()=>a.onActionAll(a.entries.map(E=>E.path)),className:"flex size-5 shrink-0 items-center justify-center rounded typography-micro font-semibold text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]","aria-label":a.actionAllLabel,children:a.actionSymbol})}),t.jsxs("button",{type:"button",onClick:()=>$(a.id),className:"flex min-w-0 flex-1 items-center gap-2 rounded text-start focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]","aria-expanded":!g,children:[t.jsx("h3",{className:"truncate typography-ui-header font-semibold text-foreground",children:a.title}),t.jsx("span",{className:"typography-meta text-muted-foreground",children:n}),t.jsx(_,{name:"arrow-down-s",className:le("size-3.5 shrink-0 text-muted-foreground transition-transform",g&&"-rotate-90 rtl:rotate-90")})]})]})},[S,h,$]),Y=w.useCallback((a,d,g,n)=>{const E=V.has(Qe(a.id,d.path)),N=d.files.map(K=>K.path),Q=i||N.some(K=>s.has(K));return t.jsxs("div",{className:le("group flex items-center gap-2 text-muted-foreground hover:text-foreground",p?"min-h-11 select-none":"py-1.5",Ge),style:{paddingInlineStart:`${n*Ye}px`},...p&&a.showRevertActions!==!1&&u&&!Q?zt(()=>I({path:d.path,paths:N,count:N.length})):null,children:[t.jsxs("button",{type:"button",onClick:()=>X(a.id,d.path),"aria-expanded":E,className:"flex min-w-0 flex-1 items-center gap-1.5 rounded text-start focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":E?r("gitView.changes.collapseDirectoryAria",{path:d.path}):r("gitView.changes.expandDirectoryAria",{path:d.path}),children:[t.jsx("span",{className:"flex w-4 shrink-0 items-center justify-center",children:t.jsx(_,{name:"arrow-right-s",className:le("size-3.5 transition-transform",E&&"rotate-90 rtl:-rotate-90")})}),t.jsx("span",{className:"min-w-0 truncate typography-ui-label",title:d.path,children:g}),E?null:t.jsx("span",{className:"shrink-0 typography-micro tabular-nums text-muted-foreground",children:d.files.length})]}),t.jsxs("span",{className:le("flex shrink-0 items-center gap-2 transition-opacity",!Q&&"md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100"),children:[a.showRevertActions!==!1&&u?t.jsx("button",{type:"button",onClick:()=>I({path:d.path,paths:N,count:N.length}),disabled:Q,className:p?"sr-only":"flex size-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)] disabled:cursor-not-allowed disabled:opacity-50","aria-label":r("gitView.changes.revertDirectoryAria",{path:d.path}),"data-row-tooltip":r("gitView.changes.revertDirectoryTooltip"),children:Q?t.jsx(_,{name:"loader-4",className:"size-3.5 animate-spin"}):t.jsx(_,{name:"arrow-go-back",className:"size-3.5"})}):null,t.jsx("button",{type:"button",onClick:()=>a.onActionAll(d.files.map(K=>K.path)),className:"flex size-5 shrink-0 items-center justify-center rounded typography-micro font-semibold text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]","aria-label":r(a.actionSymbol==="+"?"gitView.changes.stageDirectoryAria":"gitView.changes.unstageDirectoryAria",{path:d.path}),"data-row-tooltip":r(a.actionSymbol==="+"?"contextTooltips.git.stageFolder":"contextTooltips.git.unstageFolder"),children:a.actionSymbol})]})]})},[V,p,i,u,s,r,X]),te=w.useCallback((a,d)=>{if(a.type==="revert-all")return t.jsx("div",{className:le("flex justify-end py-2",Ge),children:t.jsx(we,{sideOffset:8,label:r("contextTooltips.git.discardAll"),children:t.jsxs(ne,{variant:"ghost",size:"sm",onClick:()=>x(!0),disabled:i,className:"gap-1.5 text-[var(--status-error)] hover:bg-[var(--status-error)]/10 hover:text-[var(--status-error)]",children:[t.jsx(_,{name:"arrow-go-back",className:"size-3.5"}),r("gitView.changes.revertAll")]})})});const g=y[a.groupIndex];if(!g)return null;if(a.type==="header")return O(g,d);if(a.type==="directory")return Y(g,a.directory,a.label,a.depth);const n=a.file;return t.jsx(ws,{file:n,actionLabel:g.getActionLabel(n.path),actionSymbol:g.actionSymbol,onAction:()=>g.onActionFile(n.path),stats:e?.[g.statsScope]?.[n.path],onViewDiff:()=>g.onViewDiff(n.path),onRevert:()=>{ee(g,n.path)},isReverting:s.has(n.path)||i,rowPaddingClassName:Ge,indentPx:a.depth*Ye,actionAtStart:!c,nameOnly:c,showRevert:g.showRevertActions!==!1})},[e,i,c,Y,O,ee,s,r,y]),se=a=>a.type!=="file"&&a.type!=="directory"?null:Array.from({length:a.depth},(d,g)=>t.jsx("span",{"aria-hidden":!0,className:"pointer-events-none absolute inset-y-0 w-px bg-edge",style:{insetInlineStart:`${g*Ye+8}px`}},g)),Z=w.useCallback(a=>{if(c||p)return!1;const d=A[a],g=A[a-1];return!d||!g||d.type!=="file"&&d.type!=="directory"||g.type!=="file"&&g.type!=="directory"?!1:g.groupIndex===d.groupIndex},[p,c,A]);return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"relative flex h-full min-h-0 w-full flex-col overflow-hidden",children:[t.jsx($t,{ref:k,className:"overlay-scrollbar-target overlay-scrollbar-container min-h-0 w-full flex-1 overflow-x-hidden overflow-y-auto",children:b?t.jsx("div",{style:{height:M.getTotalSize(),position:"relative"},children:j.map(a=>{const d=A[a.index];return d?t.jsxs("div",{"data-index":a.index,ref:M.measureElement,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${a.start}px)`},className:le(Z(a.index)&&"before:pointer-events-none before:absolute before:inset-s-0 before:inset-e-2 before:top-0 before:border-t before:border-edge"),children:[se(d),te(d,a.index===0)]},d.key):null})}):t.jsx("div",{role:"list","aria-label":r("gitView.changes.changedFilesAria"),children:A.map((a,d)=>t.jsxs("div",{className:le("relative",Z(d)&&"before:pointer-events-none before:absolute before:inset-s-0 before:inset-e-2 before:top-0 before:border-t before:border-edge"),children:[se(a),te(a,d===0)]},a.key))})}),t.jsx(Gt,{containerRef:k,disableHorizontal:!0}),t.jsx(_t,{containerRef:k,sideOffset:8})]}),P.dialog,t.jsx(Oe,{open:o,onOpenChange:a=>{!i&&!a&&x(!1)},children:t.jsxs(Fe,{className:"max-w-md",children:[t.jsxs(Me,{children:[t.jsx(Le,{children:r("gitView.changes.revertAllDialogTitle")}),t.jsx(He,{children:W===1?r("gitView.changes.revertAllDescriptionSingle",{count:W}):r("gitView.changes.revertAllDescriptionPlural",{count:W})})]}),t.jsxs(it,{children:[t.jsx(ne,{variant:"outline",size:"sm",onClick:()=>x(!1),disabled:i,children:r("gitView.common.cancel")}),t.jsx(ne,{variant:"destructive",size:"sm",onClick:()=>{J()},disabled:i,children:r(i?"gitView.changes.reverting":"gitView.changes.revertAll")})]})]})}),t.jsx(Oe,{open:!!T,onOpenChange:a=>{!G&&!a&&I(null)},children:t.jsxs(Fe,{className:"max-w-md",children:[t.jsxs(Me,{children:[t.jsx(Le,{children:r("gitView.changes.revertDirectoryDialogTitle")}),t.jsx(He,{children:T?T.count===1?r("gitView.changes.revertDirectoryDescriptionSingle",{count:T.count,path:T.path}):r("gitView.changes.revertDirectoryDescriptionPlural",{count:T.count,path:T.path}):null})]}),t.jsxs(it,{children:[t.jsx(ne,{variant:"outline",size:"sm",onClick:()=>I(null),disabled:G,children:r("gitView.common.cancel")}),t.jsx(ne,{variant:"destructive",size:"sm",onClick:()=>{F()},disabled:G||!T,children:r(G?"gitView.changes.reverting":"gitView.changes.revertDirectory")})]})]})})]})},et=38,_e=200,js=l=>{const e=be.c(26),{value:s,onChange:i,onSubmit:h,placeholder:f,disabled:m,hasTouchInput:u,isMobile:r}=l,p=m===void 0?!1:m,k=u===void 0?!1:u,C=r===void 0?!1:r,{t:c}=xe(),y=w.useRef(null),S=Bt(y),H=Ue(Ns);let V;e[0]===Symbol.for("react.memo_cache_sentinel")?(V=()=>{const b=y.current;if(!b)return;const M=document.activeElement===b,j=()=>{b.style.height=`${et}px`;const $=b.scrollHeight,X=Math.min(Math.max($,et),_e);b.style.height=`${X}px`,b.style.overflowY=$>_e?"auto":"hidden",$>_e&&!M&&(b.scrollTop=b.scrollHeight)};j();const D=window.requestAnimationFrame(j);return()=>{window.cancelAnimationFrame(D)}},e[0]=V):V=e[0];let v;e[1]!==s?(v=[s],e[1]=s,e[2]=v):v=e[2],w.useLayoutEffect(V,v);let o;e[3]!==i?(o=b=>i(b.target.value),e[3]=i,e[4]=o):o=e[4];let x;e[5]!==h?(x=b=>{b.key==="Enter"&&(b.metaKey||b.ctrlKey)&&!b.shiftKey&&!b.altKey&&(b.preventDefault(),h?.())},e[5]=h,e[6]=x):x=e[6];let T;e[7]!==f||e[8]!==c?(T=f??c("gitView.commit.messagePlaceholder"),e[7]=f,e[8]=c,e[9]=T):T=e[9];const I=k?"on":"off",P=k?"sentences":"off",z=C||H,ee=p&&"opacity-50";let q;e[10]!==ee?(q=le("oc-raised oc-field w-full rounded-lg bg-surface-elevated px-3 py-2 typography-ui-label text-foreground placeholder:text-muted-foreground","resize-none outline-none",ee),e[10]=ee,e[11]=q):q=e[11];let B;e[12]===Symbol.for("react.memo_cache_sentinel")?(B={minHeight:et,maxHeight:_e},e[12]=B):B=e[12];let A;e[13]!==p||e[14]!==P||e[15]!==z||e[16]!==q||e[17]!==o||e[18]!==x||e[19]!==T||e[20]!==I||e[21]!==s?(A=t.jsx("textarea",{ref:y,value:s,onChange:o,onKeyDown:x,placeholder:T,rows:1,disabled:p,autoCorrect:I,autoCapitalize:P,spellCheck:z,className:q,style:B}),e[13]=p,e[14]=P,e[15]=z,e[16]=q,e[17]=o,e[18]=x,e[19]=T,e[20]=I,e[21]=s,e[22]=A):A=e[22];let R;return e[23]!==S||e[24]!==A?(R=t.jsxs(t.Fragment,{children:[A,S]}),e[23]=S,e[24]=A,e[25]=R):R=e[25],R};function Ns(l){return l.inputSpellcheckEnabled}const Cs=l=>{const e=be.c(30),{highlights:s,onInsert:i}=l,{t:h}=xe();if(s.length===0)return null;let f;e[0]!==s||e[1]!==i?(f=()=>{i(s)},e[0]=s,e[1]=i,e[2]=f):f=e[2];const m=f;let u;e[3]!==h?(u=h("gitView.commit.aiHighlights.title"),e[3]=h,e[4]=u):u=e[4];let r;e[5]!==u?(r=t.jsx("p",{className:"typography-micro text-muted-foreground",children:u}),e[5]=u,e[6]=r):r=e[6];let p;e[7]!==h?(p=h("gitView.commit.aiHighlights.insertAria"),e[7]=h,e[8]=p):p=e[8];let k;e[9]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(_,{name:"arrow-down",className:"size-4"}),e[9]=k):k=e[9];let C;e[10]!==m||e[11]!==p?(C=t.jsx(ot,{asChild:!0,children:t.jsx(ne,{variant:"ghost",size:"icon",className:"size-6",onClick:m,"aria-label":p,children:k})}),e[10]=m,e[11]=p,e[12]=C):C=e[12];let c;e[13]!==h?(c=h("gitView.commit.aiHighlights.insertTooltip"),e[13]=h,e[14]=c):c=e[14];let y;e[15]!==c?(y=t.jsx(lt,{sideOffset:8,children:c}),e[15]=c,e[16]=y):y=e[16];let S;e[17]!==C||e[18]!==y?(S=t.jsxs(at,{children:[C,y]}),e[17]=C,e[18]=y,e[19]=S):S=e[19];let H;e[20]!==r||e[21]!==S?(H=t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r,S]}),e[20]=r,e[21]=S,e[22]=H):H=e[22];let V;e[23]!==s?(V=s.map(Ss),e[23]=s,e[24]=V):V=e[24];let v;e[25]!==V?(v=t.jsx("ul",{className:"space-y-1",children:V}),e[25]=V,e[26]=v):v=e[26];let o;return e[27]!==H||e[28]!==v?(o=t.jsxs("div",{className:"space-y-2 rounded-xl oc-tile px-3 py-2",children:[H,v]}),e[27]=H,e[28]=v,e[29]=o):o=e[29],o};function Ss(l,e){return t.jsx("li",{className:"typography-meta text-foreground",children:l},`${l}-${e}`)}const Js=l=>{const e=be.c(113),{stagedCount:s,commitMessage:i,onCommitMessageChange:h,generatedHighlights:f,onInsertHighlights:m,onGenerateMessage:u,isGeneratingMessage:r,onCommit:p,onCommitAndPush:k,commitAction:C,networkOperationBlocked:c,hasPendingIndexMutation:y,gitmojiEnabled:S,onOpenGitmojiPicker:H}=l,V=c===void 0?!1:c,v=y===void 0?!1:y,{t:o}=xe(),x=s>0;let T;e[0]!==C||e[1]!==i||e[2]!==v||e[3]!==x?(T=i.trim()&&x&&C===null&&!v,e[0]=C,e[1]=i,e[2]=v,e[3]=x,e[4]=T):T=e[4];const I=T,{isMobile:P,hasTouchInput:z}=nt(),[ee,q]=w.useState(!1);let B;e[5]!==i||e[6]!==x||e[7]!==o?(B=x?i.trim()?null:o("contextTooltips.git.writeMessageFirst"):o("contextTooltips.git.stageFilesFirst"),e[5]=i,e[6]=x,e[7]=o,e[8]=B):B=e[8];const A=B;if(P&&!ee&&!x&&!i.trim()&&f.length===0){let oe;e[9]!==o?(oe=o("gitView.commit.title"),e[9]=o,e[10]=oe):oe=e[10];let me;e[11]!==oe?(me=t.jsx("h3",{className:"typography-ui-header font-semibold text-foreground",children:oe}),e[11]=oe,e[12]=me):me=e[12];let fe;e[13]!==o?(fe=o("gitView.commit.stageFilesHint"),e[13]=o,e[14]=fe):fe=e[14];let he;e[15]!==fe?(he=t.jsx("span",{className:"min-w-0 truncate typography-meta text-muted-foreground",children:fe}),e[15]=fe,e[16]=he):he=e[16];let ve;return e[17]!==me||e[18]!==he?(ve=t.jsxs("section",{className:"flex items-baseline gap-2",children:[me,he]}),e[17]=me,e[18]=he,e[19]=ve):ve=e[19],ve}let R,b;e[20]===Symbol.for("react.memo_cache_sentinel")?(R=()=>q(!0),b=oe=>{oe.currentTarget.contains(oe.relatedTarget)||q(!1)},e[20]=R,e[21]=b):(R=e[20],b=e[21]);let M;e[22]!==o?(M=o("gitView.commit.title"),e[22]=o,e[23]=M):M=e[23];let j;e[24]!==M?(j=t.jsx("h3",{className:"typography-ui-header font-semibold text-foreground",children:M}),e[24]=M,e[25]=j):j=e[25];let D;e[26]!==x||e[27]!==o?(D=x?null:t.jsx("span",{className:"min-w-0 truncate typography-meta text-muted-foreground",children:o("gitView.commit.stageFilesHint")}),e[26]=x,e[27]=o,e[28]=D):D=e[28];let $;e[29]!==j||e[30]!==D?($=t.jsxs("div",{className:"flex w-full items-baseline gap-2 px-0 pt-2 pb-1",children:[j,D]}),e[29]=j,e[30]=D,e[31]=$):$=e[31];let X;e[32]!==f||e[33]!==m?(X=t.jsx(Cs,{highlights:f,onInsert:m}),e[32]=f,e[33]=m,e[34]=X):X=e[34];let L;e[35]!==I||e[36]!==r||e[37]!==p?(L=()=>{I&&!r&&p()},e[35]=I,e[36]=r,e[37]=p,e[38]=L):L=e[38];let W;e[39]!==o?(W=o("gitView.commit.messagePlaceholder"),e[39]=o,e[40]=W):W=e[40];const G=C!==null;let J;e[41]!==i||e[42]!==z||e[43]!==P||e[44]!==h||e[45]!==L||e[46]!==W||e[47]!==G?(J=t.jsx(js,{value:i,onChange:h,onSubmit:L,placeholder:W,disabled:G,hasTouchInput:z,isMobile:P}),e[41]=i,e[42]=z,e[43]=P,e[44]=h,e[45]=L,e[46]=W,e[47]=G,e[48]=J):J=e[48];let F;e[49]!==S||e[50]!==H||e[51]!==o?(F=S&&t.jsx(we,{sideOffset:8,label:o("contextTooltips.git.addGitmoji"),className:"w-fit",children:t.jsxs(ne,{variant:"outline",size:"sm",onClick:H,className:"w-fit",type:"button",children:[t.jsx(_,{name:"emotion-happy",className:"size-4"}),o("gitView.commit.addGitmoji")]})}),e[49]=S,e[50]=H,e[51]=o,e[52]=F):F=e[52];let O;e[53]!==x||e[54]!==o?(O=o(x?"gitView.commit.generateAria":"contextTooltips.git.stageFilesFirst"),e[53]=x,e[54]=o,e[55]=O):O=e[55];const Y=r||C!==null||v||s===0;let te;e[56]!==o?(te=o("gitView.commit.generateAria"),e[56]=o,e[57]=te):te=e[57];let se;e[58]!==r?(se=r?t.jsx(_,{name:"loader-4",className:"size-4 animate-spin"}):t.jsx(_,{name:"ai-generate-2",className:"size-4 text-primary"}),e[58]=r,e[59]=se):se=e[59];let Z;e[60]!==o?(Z=o("gitView.commit.generate"),e[60]=o,e[61]=Z):Z=e[61];let a;e[62]!==Z?(a=t.jsx("span",{className:"commit-actions__label",children:Z}),e[62]=Z,e[63]=a):a=e[63];let d;e[64]!==u||e[65]!==Y||e[66]!==te||e[67]!==se||e[68]!==a?(d=t.jsxs(ne,{variant:"outline",size:"sm",onClick:u,disabled:Y,type:"button","aria-label":te,className:"commit-actions__btn",children:[se,a]}),e[64]=u,e[65]=Y,e[66]=te,e[67]=se,e[68]=a,e[69]=d):d=e[69];let g;e[70]!==O||e[71]!==d?(g=t.jsx(we,{sideOffset:8,label:O,children:d}),e[70]=O,e[71]=d,e[72]=g):g=e[72];let n;e[73]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx("div",{className:"flex-1"}),e[73]=n):n=e[73];let E;e[74]!==A||e[75]!==o?(E=A??o("contextTooltips.git.commit"),e[74]=A,e[75]=o,e[76]=E):E=e[76];let N;e[77]!==p?(N=oe=>p(oe.currentTarget),e[77]=p,e[78]=N):N=e[78];const Q=!I||r;let K;e[79]!==o?(K=o("gitView.commit.commitAria"),e[79]=o,e[80]=K):K=e[80];let ae;e[81]!==C||e[82]!==o?(ae=C==="commit"?t.jsxs(t.Fragment,{children:[t.jsx(_,{name:"loader-4",className:"size-4 animate-spin"}),t.jsx("span",{className:"commit-actions__label",children:o("gitView.commit.committing")})]}):t.jsxs(t.Fragment,{children:[t.jsx(_,{name:"git-commit",className:"size-4"}),t.jsx("span",{className:"commit-actions__label",children:o("gitView.commit.commit")})]}),e[81]=C,e[82]=o,e[83]=ae):ae=e[83];let U;e[84]!==N||e[85]!==Q||e[86]!==K||e[87]!==ae?(U=t.jsx(ne,{size:"sm",variant:"outline",onClick:N,disabled:Q,className:"commit-actions__btn whitespace-nowrap","aria-label":K,children:ae}),e[84]=N,e[85]=Q,e[86]=K,e[87]=ae,e[88]=U):U=e[88];let re;e[89]!==E||e[90]!==U?(re=t.jsx(we,{sideOffset:8,label:E,children:U}),e[89]=E,e[90]=U,e[91]=re):re=e[91];let ce;e[92]!==I||e[93]!==C||e[94]!==A||e[95]!==r||e[96]!==P||e[97]!==V||e[98]!==k||e[99]!==o?(ce=P?t.jsxs(at,{children:[t.jsx(ot,{asChild:!0,children:t.jsx(ne,{variant:"default",size:"sm",onClick:oe=>k(oe.currentTarget),disabled:!I||r||V,className:"h-7 w-7 p-0","aria-label":o("gitView.commit.pushAria"),children:C==="commitAndPush"?t.jsx(_,{name:"loader-4",className:"size-4 animate-spin"}):t.jsx(_,{name:"arrow-up",className:"size-3.5"})})}),t.jsx(lt,{side:"top",children:t.jsx("p",{children:o("gitView.commit.push")})})]}):t.jsx(we,{sideOffset:8,label:A??o("contextTooltips.git.commitAndSync"),children:t.jsx(ne,{size:"sm",variant:"default",onClick:oe=>k(oe.currentTarget),disabled:!I||r||V,className:"commit-actions__btn","aria-label":o("gitView.commit.pushAria"),children:C==="commitAndPush"?t.jsxs(t.Fragment,{children:[t.jsx(_,{name:"loader-4",className:"size-4 animate-spin"}),t.jsx("span",{className:"commit-actions__label commit-actions__label--push",children:o("gitView.commit.pushing")})]}):t.jsxs(t.Fragment,{children:[t.jsx(_,{name:"arrow-up",className:"size-3.5"}),t.jsx("span",{className:"commit-actions__label commit-actions__label--push",children:o("gitView.commit.push")})]})})}),e[92]=I,e[93]=C,e[94]=A,e[95]=r,e[96]=P,e[97]=V,e[98]=k,e[99]=o,e[100]=ce):ce=e[100];let de;e[101]!==g||e[102]!==re||e[103]!==ce?(de=t.jsxs("div",{className:"@container/commit-actions flex items-center gap-2 min-w-0",children:[g,n,re,ce]}),e[101]=g,e[102]=re,e[103]=ce,e[104]=de):de=e[104];let ue;e[105]!==X||e[106]!==J||e[107]!==F||e[108]!==de?(ue=t.jsxs("div",{className:"flex flex-col gap-3 px-0 pt-1 pb-3",children:[X,J,F,de]}),e[105]=X,e[106]=J,e[107]=F,e[108]=de,e[109]=ue):ue=e[109];let ye;return e[110]!==$||e[111]!==ue?(ye=t.jsxs("section",{className:"border-0 bg-transparent rounded-none",onFocus:R,onBlur:b,children:[$,ue]}),e[110]=$,e[111]=ue,e[112]=ye):ye=e[112],ye},Ys=l=>{const e=be.c(153),{open:s,onOpenChange:i,conflictFiles:h,directory:f,operation:m,onAbort:u,onClearState:r,onNavigatedToChat:p}=l;let k;e[0]!==h?(k=h===void 0?[]:h,e[0]=h,e[1]=k):k=e[1];const C=k,{t:c}=xe(),y=rt(ks),S=rt(Vs),H=ct(As),V=ct(Ts),[v,o]=w.useState(!1),[x,T]=w.useState(null),[I,P]=w.useState(null);let z,ee;e[2]!==f||e[3]!==s||e[4]!==c?(z=()=>{!s||!f||(o(!0),P(null),T(null),Kt(f).then(ie=>{T(ie)}).catch(ie=>{const pe=ie instanceof Error?ie.message:c("gitView.conflict.loadFailed");P(pe)}).finally(()=>{o(!1)}))},ee=[s,f,c],e[2]=f,e[3]=s,e[4]=c,e[5]=z,e[6]=ee):(z=e[5],ee=e[6]),w.useEffect(z,ee);let q;e[7]!==x||e[8]!==f||e[9]!==m?(q=async()=>{if(!x)return null;const ie=m==="merge"?"merge":"rebase",pe=x.headInfo||(m==="merge"?"MERGE_HEAD":"REBASE_HEAD"),ke=m==="merge"?"git commit --no-edit":"git rebase --continue",Ve=await Ut(f),je=Ve.render("git.conflict.resolve.visible",{operation_label:ie,head_ref:pe}),Ne=Ve.render("git.conflict.resolve.instructions",{operation_label:ie,directory:f,operation:m,head_info:x.headInfo||"N/A",continue_cmd:ke}),Ce=`${ie} conflict context (JSON)
|
|
2
2
|
${JSON.stringify({directory:f,operation:x.operation,headInfo:x.headInfo,statusPorcelain:x.statusPorcelain,unmergedFiles:x.unmergedFiles,diff:x.diff},null,2)}`;return{visibleText:je,instructionsText:Ne,payloadText:Ce}},e[7]=x,e[8]=f,e[9]=m,e[10]=q):q=e[10];const B=q;let A;e[11]!==B||e[12]!==c?(A=async()=>{try{return await B()}catch(ie){const pe=ie;ge.error(c("magicPrompts.toast.loadFailed"),{description:pe instanceof Error?pe.message:void 0});return}},e[11]=B,e[12]=c,e[13]=A):A=e[13];const R=A;let b;e[14]!==u||e[15]!==i?(b=()=>{u(),i(!1)},e[14]=u,e[15]=i,e[16]=b):b=e[16];const M=b;let j;e[17]!==r||e[18]!==i?(j=()=>{r?.(),i(!1)},e[17]=r,e[18]=i,e[19]=j):j=e[19];const D=j;let $;e[20]!==S||e[21]!==r||e[22]!==p||e[23]!==i||e[24]!==R||e[25]!==H||e[26]!==V||e[27]!==c?($=async()=>{const ie=await R();if(ie!==void 0){if(!ie){ge.error(c("gitView.conflict.noDetailsAvailable"));return}if(!S){ge.error(c("gitView.conflict.noActiveSession"),{description:c("gitView.conflict.noActiveSessionDescription")});return}H(ie.visibleText,"replace"),V([{text:ie.instructionsText,synthetic:!0},{text:ie.payloadText,synthetic:!0}]),r?.(),i(!1),p?.()}},e[20]=S,e[21]=r,e[22]=p,e[23]=i,e[24]=R,e[25]=H,e[26]=V,e[27]=c,e[28]=$):$=e[28];const X=$;let L;e[29]!==f||e[30]!==r||e[31]!==p||e[32]!==i||e[33]!==y||e[34]!==R||e[35]!==c?(L=async()=>{const ie=await R();if(ie!==void 0){if(!ie){ge.error(c("gitView.conflict.noDetailsAvailable"));return}y({directoryOverride:f,initialPrompt:ie.visibleText,syntheticParts:[{text:ie.instructionsText,synthetic:!0},{text:ie.payloadText,synthetic:!0}]}),r?.(),i(!1),p?.()}},e[29]=f,e[30]=r,e[31]=p,e[32]=i,e[33]=y,e[34]=R,e[35]=c,e[36]=L):L=e[36];const W=L;let G,J,F,O,Y,te,se,Z,a,d,g,n,E,N,Q,K,ae,U,re,ce,de,ue;if(e[37]!==x||e[38]!==C||e[39]!==S||e[40]!==M||e[41]!==D||e[42]!==X||e[43]!==W||e[44]!==v||e[45]!==I||e[46]!==i||e[47]!==s||e[48]!==m||e[49]!==c){const ie=c(m==="merge"?"gitView.operation.merge":"gitView.operation.rebase"),pe=x?.unmergedFiles||C;F=Oe,de=s,ue=i,J=Fe,ce="max-w-md w-[calc(100vw-2rem)]",N="flex flex-col gap-4 overflow-hidden";let ke;e[72]===Symbol.for("react.memo_cache_sentinel")?(ke=t.jsx(_,{name:"alert",className:"size-5 shrink-0 text-[var(--status-warning)]"}),e[72]=ke):ke=e[72];const Ve=t.jsxs("div",{className:"flex items-center gap-2",children:[ke,t.jsx(Le,{children:c("gitView.conflict.detectedTitle",{operation:ie})})]});let je;e[73]!==m||e[74]!==c?(je=c("gitView.conflict.detectedDescription",{operation:m}),e[73]=m,e[74]=c,e[75]=je):je=e[75];let Ne;e[76]!==je?(Ne=t.jsx(He,{children:je}),e[76]=je,e[77]=Ne):Ne=e[77],e[78]!==Ve||e[79]!==Ne?(Q=t.jsxs(Me,{children:[Ve,Ne]}),e[78]=Ve,e[79]=Ne,e[80]=Q):Q=e[80],e[81]!==v||e[82]!==c?(K=v&&t.jsxs("div",{className:"flex items-center justify-center gap-2 py-4 text-muted-foreground",children:[t.jsx(_,{name:"loader-4",className:"size-4 animate-spin"}),t.jsx("span",{className:"typography-meta",children:c("gitView.conflict.loading")})]}),e[81]=v,e[82]=c,e[83]=K):K=e[83],e[84]!==I||e[85]!==c?(ae=I&&t.jsx("div",{className:"rounded-lg bg-[var(--status-error-bg)] p-3 text-[var(--status-error)] typography-meta break-words",children:c("gitView.conflict.errorLoadingDetails",{message:I})}),e[84]=I,e[85]=c,e[86]=ae):ae=e[86],e[87]!==pe||e[88]!==c?(U=pe.length>0&&t.jsxs("div",{className:"space-y-2 overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("p",{className:"typography-meta text-muted-foreground",children:c("gitView.conflict.conflictedFiles")}),t.jsx("span",{className:"typography-micro px-1.5 py-0.5 rounded bg-[var(--surface-elevated)] text-muted-foreground",children:pe.length})]}),t.jsx(dt,{outerClassName:"max-h-40 rounded-lg bg-[var(--surface-elevated)]",className:"p-3",disableHorizontal:!0,children:t.jsx("ul",{className:"space-y-1",children:pe.map(Is)})})]}),e[87]=pe,e[88]=c,e[89]=U):U=e[89],e[90]!==x||e[91]!==c?(re=x?.headInfo&&t.jsxs("div",{className:"space-y-1 overflow-hidden",children:[t.jsx("p",{className:"typography-meta text-muted-foreground",children:c("gitView.conflict.headInfo")}),t.jsx(dt,{outerClassName:"max-h-24 rounded-lg bg-[var(--surface-elevated)]",className:"typography-micro text-foreground font-mono p-3 break-words whitespace-pre-wrap",disableHorizontal:!0,children:x.headInfo})]}),e[90]=x,e[91]=c,e[92]=re):re=e[92],g="flex flex-col gap-2 pt-2";let Ce;e[93]!==W?(Ce=()=>{W()},e[93]=W,e[94]=Ce):Ce=e[94];const Xe=v||!x;let Ae;e[95]!==v?(Ae=v?t.jsx(_,{name:"loader-4",className:"size-4 animate-spin"}):t.jsx(_,{name:"add",className:"size-4"}),e[95]=v,e[96]=Ae):Ae=e[96];let Te;e[97]!==c?(Te=c("gitView.conflict.resolveNewSession"),e[97]=c,e[98]=Te):Te=e[98],e[99]!==Ce||e[100]!==Xe||e[101]!==Ae||e[102]!==Te?(n=t.jsxs(ne,{variant:"default",onClick:Ce,disabled:Xe,className:"w-full gap-2",children:[Ae,Te]}),e[99]=Ce,e[100]=Xe,e[101]=Ae,e[102]=Te,e[103]=n):n=e[103];let Ie;e[104]!==X?(Ie=()=>{X()},e[104]=X,e[105]=Ie):Ie=e[105];const We=v||!x||!S;let Ee;e[106]!==v?(Ee=v?t.jsx(_,{name:"loader-4",className:"size-4 animate-spin"}):t.jsx(_,{name:"chat-1",className:"size-4"}),e[106]=v,e[107]=Ee):Ee=e[107];let De;e[108]!==c?(De=c("gitView.conflict.resolveCurrentSession"),e[108]=c,e[109]=De):De=e[109],e[110]!==Ie||e[111]!==We||e[112]!==Ee||e[113]!==De?(E=t.jsxs(ne,{variant:"outline",onClick:Ie,disabled:We,className:"w-full gap-2",children:[Ee,De]}),e[110]=Ie,e[111]=We,e[112]=Ee,e[113]=De,e[114]=E):E=e[114],a="flex gap-2 pt-1";let ze;e[115]!==c?(ze=c("gitView.conflict.continueLater"),e[115]=c,e[116]=ze):ze=e[116],e[117]!==D||e[118]!==ze?(d=t.jsx(ne,{variant:"ghost",size:"sm",onClick:D,className:"flex-1",children:ze}),e[117]=D,e[118]=ze,e[119]=d):d=e[119],G=ne,O="destructive",Y="sm",te=M,se="flex-1",Z=c("gitView.conflict.abortOperation",{operation:ie}),e[37]=x,e[38]=C,e[39]=S,e[40]=M,e[41]=D,e[42]=X,e[43]=W,e[44]=v,e[45]=I,e[46]=i,e[47]=s,e[48]=m,e[49]=c,e[50]=G,e[51]=J,e[52]=F,e[53]=O,e[54]=Y,e[55]=te,e[56]=se,e[57]=Z,e[58]=a,e[59]=d,e[60]=g,e[61]=n,e[62]=E,e[63]=N,e[64]=Q,e[65]=K,e[66]=ae,e[67]=U,e[68]=re,e[69]=ce,e[70]=de,e[71]=ue}else G=e[50],J=e[51],F=e[52],O=e[53],Y=e[54],te=e[55],se=e[56],Z=e[57],a=e[58],d=e[59],g=e[60],n=e[61],E=e[62],N=e[63],Q=e[64],K=e[65],ae=e[66],U=e[67],re=e[68],ce=e[69],de=e[70],ue=e[71];let ye;e[120]!==G||e[121]!==O||e[122]!==Y||e[123]!==te||e[124]!==se||e[125]!==Z?(ye=t.jsx(G,{variant:O,size:Y,onClick:te,className:se,children:Z}),e[120]=G,e[121]=O,e[122]=Y,e[123]=te,e[124]=se,e[125]=Z,e[126]=ye):ye=e[126];let oe;e[127]!==a||e[128]!==d||e[129]!==ye?(oe=t.jsxs("div",{className:a,children:[d,ye]}),e[127]=a,e[128]=d,e[129]=ye,e[130]=oe):oe=e[130];let me;e[131]!==g||e[132]!==n||e[133]!==E||e[134]!==oe?(me=t.jsxs("div",{className:g,children:[n,E,oe]}),e[131]=g,e[132]=n,e[133]=E,e[134]=oe,e[135]=me):me=e[135];let fe;e[136]!==N||e[137]!==Q||e[138]!==K||e[139]!==ae||e[140]!==U||e[141]!==re||e[142]!==me?(fe=t.jsxs("div",{className:N,children:[Q,K,ae,U,re,me]}),e[136]=N,e[137]=Q,e[138]=K,e[139]=ae,e[140]=U,e[141]=re,e[142]=me,e[143]=fe):fe=e[143];let he;e[144]!==J||e[145]!==ce||e[146]!==fe?(he=t.jsx(J,{className:ce,children:fe}),e[144]=J,e[145]=ce,e[146]=fe,e[147]=he):he=e[147];let ve;return e[148]!==F||e[149]!==de||e[150]!==ue||e[151]!==he?(ve=t.jsx(F,{open:de,onOpenChange:ue,children:he}),e[148]=F,e[149]=de,e[150]=ue,e[151]=he,e[152]=ve):ve=e[152],ve};function ks(l){return l.openNewSessionDraft}function Vs(l){return l.currentSessionId}function As(l){return l.setPendingInputText}function Ts(l){return l.setPendingSyntheticParts}function Is(l){return t.jsx("li",{className:"typography-micro text-foreground font-mono truncate block",title:l,children:l},l)}const Zs=({open:l,onOpenChange:e,targetBranch:s,changedFileCount:i,onCommitAndSwitch:h,onGenerateMessage:f,onRevertAndSwitch:m})=>{const{t:u}=xe(),[r,p]=w.useState(""),[k,C]=w.useState(null),[c,y]=w.useState(!1),S=k!==null;w.useEffect(()=>{l||(p(""),y(!1))},[l]);const H=async()=>{C("generate");try{const o=await f();o&&p(o)}catch(o){ge.error(o instanceof Error?o.message:u("gitView.dirtySwitch.actionFailed"))}finally{C(null)}},V=async()=>{C("commit");try{let o=r.trim();if(!o){if(o=(await f()).trim(),!o){ge.error(u("gitView.toast.enterCommitMessage"));return}p(o)}await h(o,c)}catch(o){ge.error(o instanceof Error?o.message:u("gitView.dirtySwitch.actionFailed"))}finally{C(null)}},v=async()=>{C("revert");try{await m()}catch(o){ge.error(o instanceof Error?o.message:u("gitView.dirtySwitch.actionFailed"))}finally{C(null)}};return t.jsx(Oe,{open:l,onOpenChange:o=>{S||e(o)},children:t.jsx(Fe,{className:"max-w-md w-[calc(100vw-2rem)]",children:t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs(Me,{children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(_,{name:"alert",className:"size-5 shrink-0 text-[var(--status-warning)]"}),t.jsx(Le,{children:u("gitView.dirtySwitch.title")})]}),t.jsx(He,{children:i===1?u("gitView.dirtySwitch.descriptionSingle",{branch:s}):u("gitView.dirtySwitch.descriptionPlural",{branch:s,count:i})})]}),t.jsxs("div",{className:"oc-raised oc-field flex items-center gap-2 rounded-lg px-3 py-2",children:[t.jsx("input",{value:r,onChange:o=>p(o.target.value),placeholder:u("gitView.commit.messagePlaceholder"),disabled:S,onKeyDown:o=>{o.key==="Enter"&&!S&&(o.preventDefault(),V())},className:"min-w-0 flex-1 bg-transparent typography-meta text-foreground outline-none placeholder:text-muted-foreground"}),t.jsx(we,{sideOffset:8,label:u("gitView.commit.generateAria"),className:"shrink-0",children:t.jsx("button",{type:"button",onClick:()=>{H()},disabled:S,"aria-label":u("gitView.commit.generate"),className:"shrink-0 text-muted-foreground hover:text-foreground disabled:opacity-50",children:k==="generate"?t.jsx(_,{name:"loader-4",className:"size-4 animate-spin"}):t.jsx(_,{name:"ai-generate-2",className:"size-4 text-primary"})})})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(qt,{checked:c,onChange:y,disabled:S,ariaLabel:u("gitView.dirtySwitch.pushAfterCommit")}),t.jsx("span",{className:"typography-ui-label text-foreground cursor-pointer select-none",onClick:()=>!S&&y(!c),children:u("gitView.dirtySwitch.pushAfterCommit")})]}),t.jsxs("div",{className:"flex items-center justify-between gap-2 pt-1",children:[t.jsxs(ne,{variant:"destructive",size:"sm",onClick:()=>{v()},disabled:S,className:"gap-2",children:[k==="revert"?t.jsx(_,{name:"loader-4",className:"size-4 animate-spin"}):null,u("gitView.dirtySwitch.revertAndSwitch")]}),t.jsxs(ne,{variant:"default",size:"sm",onClick:()=>{V()},disabled:S,className:"gap-2",children:[k==="commit"?t.jsx(_,{name:"loader-4",className:"size-4 animate-spin"}):null,u("gitView.dirtySwitch.commitAndSwitch")]})]})]})})})},tt="max-w-none",Es="flex flex-wrap items-center gap-2",Rt=l=>{const e=be.c(6),{error:s,children:i}=l,h=s?"alert":void 0,f=s&&"text-[var(--status-error)]";let m;e[0]!==f?(m=le(Ke,f),e[0]=f,e[1]=m):m=e[1];let u;return e[2]!==i||e[3]!==h||e[4]!==m?(u=t.jsx("p",{role:h,className:m,children:i}),e[2]=i,e[3]=h,e[4]=m,e[5]=u):u=e[5],u},Ds=l=>{if(!l||l.target.operation!=="checkout-hydration")return[];const e=[...l.target.requirements],s=[...(l.hydration?.submodules??[]).map(i=>({kind:"submodule",item:i})),...(l.hydration?.lfs??[]).map(i=>({kind:"lfs",item:i}))];for(const{kind:i,item:h}of s){const f=h.endpoint;f&&(e.some(m=>m.kind===i&&m.path===h.path&&m.endpoint.fingerprint===f.fingerprint)||e.push({kind:i,path:h.path,endpoint:f}))}return e},zs=l=>{const e=be.c(48),{directory:s,className:i}=l,{t:h}=xe(),{git:f,sourceControl:m}=wt(),u=vt(s,m),r=Re(Ps),p=Re(Os),k=jt(),C=Be(Fs),c=Be(Ms);let y;e[0]!==c?(y=Nt(c),e[0]=c,e[1]=y):y=e[1];const S=y,[H,V]=w.useState(""),[v,o]=w.useState(!1),x=w.useRef(0);let T;e[2]===Symbol.for("react.memo_cache_sentinel")?(T=()=>(x.current=x.current+1,V(""),o(!1),()=>{x.current=x.current+1}),e[2]=T):T=e[2];let I;e[3]!==u.scope||e[4]!==f||e[5]!==m?(I=[u.scope,f,m],e[3]=u.scope,e[4]=f,e[5]=m,e[6]=I):I=e[6],w.useLayoutEffect(T,I);const P=u.read;let z;e[7]!==k?(z=L=>Dt(L)&&At(L,k),e[7]=k,e[8]=z):z=e[8];let ee;e[9]!==r||e[10]!==p||e[11]!==z?(ee=Ct(r,p,z),e[9]=r,e[10]=p,e[11]=z,e[12]=ee):ee=e[12];const q=ee;let B,A,R,b,M,j,D;if(e[13]!==i||e[14]!==s||e[15]!==f||e[16]!==r||e[17]!==q||e[18]!==S||e[19]!==H||e[20]!==P||e[21]!==C||e[22]!==m||e[23]!==h){R=Symbol.for("react.early_return_sentinel");e:{const L=P?Xt(P):null,W=L?.providers[0]?.primaryRemote??L?.remotes[0]?.name??"origin",G=(P?.repository.remotes??[]).filter(F=>F.name!==W&&L?.remotes.find(O=>O.name===F.name)?.readiness!=="ready"),J=async(F,O)=>{if(H)return;const Y=x.current,te=qe(),se=()=>x.current===Y&&te===qe();V(F),o(!1);const Z=await ts({directory:s,identity:O,remoteName:F},{git:f,sourceControl:m});se()&&(Z.status!=="applied"&&o(!0),V(""))};if(!G.length||!f.configureTransportBinding){R=null;break e}B=Tt,e[31]!==h?(b=h("gitView.remotes.title"),e[31]=h,e[32]=b):b=e[32],e[33]!==h?(M=h("gitView.remotes.description"),e[33]=h,e[34]=M):M=e[34],e[35]!==i?(j=le("min-w-0",i),e[35]=i,e[36]=j):j=e[36],D=It,A=G.map(F=>{const O=St(F.fetch.displayUrl);return t.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"truncate typography-ui-label text-foreground",children:F.name}),t.jsx("p",{className:le(Ke,"truncate"),title:F.fetch.displayUrl,children:F.fetch.displayUrl})]}),t.jsx(kt,{activeProfile:null,identities:q,onSelect:Y=>{J(F.name,Y)},isApplying:H===F.name,applicability:Y=>Vt(Y,O,S),triggerClassName:"shrink-0 border border-border",onOpen:()=>{C(m,r.map(Ls))}})]},F.name)})}e[13]=i,e[14]=s,e[15]=f,e[16]=r,e[17]=q,e[18]=S,e[19]=H,e[20]=P,e[21]=C,e[22]=m,e[23]=h,e[24]=B,e[25]=A,e[26]=R,e[27]=b,e[28]=M,e[29]=j,e[30]=D}else B=e[24],A=e[25],R=e[26],b=e[27],M=e[28],j=e[29],D=e[30];if(R!==Symbol.for("react.early_return_sentinel"))return R;let $;e[37]!==v||e[38]!==h?($=v?t.jsx(Rt,{error:!0,children:h("settings.sourceControl.instance.status.operationFailed")}):null,e[37]=v,e[38]=h,e[39]=$):$=e[39];let X;return e[40]!==B||e[41]!==A||e[42]!==$||e[43]!==b||e[44]!==M||e[45]!==j||e[46]!==D?(X=t.jsxs(B,{title:b,description:M,className:j,contentClassName:D,children:[A,$]}),e[40]=B,e[41]=A,e[42]=$,e[43]=b,e[44]=M,e[45]=j,e[46]=D,e[47]=X):X=e[47],X},Rs=({directory:l,className:e})=>{const{t:s}=xe(),{git:i,sourceControl:h}=wt(),f=vt(l,h),m=Wt(l,i,h),[u,r]=w.useState(""),[p,k]=w.useState(""),[C,c]=w.useState(null),[y,S]=w.useState(!1),[H,V]=w.useState(!1),[v,o]=w.useState(!1),x=w.useRef(0),T=Re(n=>n.profiles),I=Re(n=>n.globalIdentity),P=Re(n=>n.loadProfiles),z=Re(n=>n.loadGlobalIdentity),ee=jt(),q=Be(n=>n.refreshIdentityAccounts),B=Be(n=>n.identities),A=w.useMemo(()=>Nt(B),[B]),R=Jt(l),b=m.entry?.reads.at(-1)?.operation,M=b?.target.operation==="checkout-hydration"&&b.target.remote.name===u?Ds(b):[],j=M.find(n=>JSON.stringify([n.kind,n.path,n.endpoint.fingerprint])===p),D=f.read,$=D?.repository.remotes.find(n=>n.name===u),X=j&&D?.binding?.auxiliary.find(n=>n.kind===j.kind&&n.endpoint.fingerprint===j.endpoint.fingerprint);w.useLayoutEffect(()=>(x.current+=1,r(""),k(""),c(null),S(!1),V(!1),o(!1),()=>{x.current+=1}),[f.scope,i,h]),w.useLayoutEffect(()=>{},[j?.endpoint.fingerprint]),w.useEffect(()=>{v&&(P(),z())},[P,z,v]);const L=w.useMemo(()=>Ct(T,I,n=>Dt(n)&&At(n,ee)),[ee,T,I]),W=j?.endpoint.displayUrl??"",G=w.useMemo(()=>W?St(W):null,[W]),J=w.useCallback(n=>G?Vt(n,G,A):{applicable:!0},[G,A]),F=w.useMemo(()=>{const n=L.filter(N=>J(N).applicable);return(R?.userName&&R.userEmail?n.find(N=>N.userName===R.userName&&N.userEmail===R.userEmail):void 0)??n.find(N=>N.account&&G?.host&&(Yt(N.account.instance)===G.host||Zt(A[N.account.instance]??"")===G.host))??null},[J,L,G,A,R]),O=(C?.endpoint===j?.endpoint.fingerprint?L.find(n=>n.id===C?.id):null)??F,Y=O?rs(O):null,te=!!(f.status==="ready"&&D?.binding&&$&&j&&i.configureAuxiliaryBinding&&!y&&O&&J(O).applicable&&(Y!=="account"||O?.account)&&(Y!=="ssh"||O?.sshCredentialId)),se=!!(f.status==="ready"&&X&&$&&i.configureAuxiliaryBinding&&!y),Z=async()=>{if(!u||m.blocked)return;const n=m.start();if(n){V(!1);try{await ss({directory:l,git:i,sourceControl:h,parentRemoteName:u,onOperation:n.onOperation})}catch(E){E instanceof is||V(!0)}finally{n.finish()}}},a=async n=>{if(n==="configure"&&!te||n==="remove"&&!se||!f.isCurrent()||!D?.binding||!$||!j||!i.configureAuxiliaryBinding)return;const E=x.current,N=qe(),Q=()=>x.current===E&&N===qe(),K={directory:l,expectedRepositoryId:D.repository.repositoryId,expectedRevision:D.revision,expectedConfigRevision:D.repository.configRevision,parentRemote:u,expectedParentFingerprint:$.fetch.fingerprint,kind:j.kind,path:j.path,expectedEndpointFingerprint:j.endpoint.fingerprint},ae=n==="remove"?{...K,operation:n}:O&&ns(O,K);if(!ae)return;const U=$e.captureMutation(f.scope,D);S(!0),V(!1);try{const re=await i.configureAuxiliaryBinding(ae);$e.setMutationResult(U,re.binding)||await $e.reconcile(U,h)}catch{Q()&&V(!0),await $e.reconcile(U,h)}finally{U.release(),Q()&&S(!1)}},d=!!(M.length&&b&&"error"in b&&b.error.code==="AUTHENTICATION_REQUIRED"),g=n=>s(n==="submodule"?"gitView.hydration.kind.submodule":"gitView.hydration.kind.lfs");return t.jsxs(fs,{open:v,onOpenChange:o,className:le("min-w-0",e),children:[t.jsxs(hs,{className:"w-auto justify-start gap-1.5",children:[t.jsx(Qt,{children:s("gitView.hydration.title")}),t.jsx(_,{name:v?"arrow-up-s":"arrow-down-s",className:"h-4 w-4 text-muted-foreground"})]}),t.jsx(ps,{children:t.jsxs(Tt,{description:s("gitView.hydration.description"),className:"min-w-0 pt-2",contentClassName:It,children:[t.jsx(Je,{label:s("gitView.hydration.parentRemote"),controlClassName:tt,children:t.jsxs(ut,{value:u,onValueChange:n=>{r(n),k(""),c(null)},disabled:!D?.binding||y||m.blocked,children:[t.jsx(mt,{className:"w-fit max-w-[28ch]","aria-label":s("gitView.hydration.parentRemote"),children:t.jsx(ft,{placeholder:s("settings.sourceControl.transport.remoteLabel")})}),t.jsx(ht,{children:D?.binding?.remotes.filter(n=>n.readiness==="ready").map(n=>t.jsx(pt,{value:n.name,children:n.name},n.name))})]})}),t.jsx(es,{entry:m.entry,onRefresh:()=>{m.refresh()},onCancel:()=>{m.cancel()}}),d?t.jsx("p",{className:Ke,children:s("gitView.hydration.authorizationNeeded")}):null,M.length?t.jsx(Je,{label:s("gitView.hydration.endpoint"),controlClassName:tt,children:t.jsxs(ut,{value:p,onValueChange:k,disabled:y,children:[t.jsx(mt,{className:"w-fit max-w-[28ch]","aria-label":s("gitView.hydration.endpoint"),children:t.jsx(ft,{placeholder:s("gitView.hydration.chooseEndpoint"),children:j?`${j.path} · ${g(j.kind)} · ${j.endpoint.displayUrl}`:void 0})}),t.jsx(ht,{children:M.map(n=>{const E=JSON.stringify([n.kind,n.path,n.endpoint.fingerprint]);return t.jsxs(pt,{value:E,children:[n.path," · ",g(n.kind)," · ",n.endpoint.displayUrl]},E)})})]})}):null,j?t.jsx(t.Fragment,{children:t.jsx(Je,{label:s("gitView.hydration.identity"),controlClassName:tt,children:t.jsx(kt,{activeProfile:O,identities:L,onSelect:n=>c({endpoint:j.endpoint.fingerprint,id:n.id}),isApplying:y,applicability:J,triggerClassName:"w-full max-w-none border border-border",menuAlign:"start",onOpen:()=>{q(h,T.map(n=>n.account))}})})}):null,b?.hydration?.status==="client-missing"?t.jsx("p",{role:"alert",className:le(Ke,"text-[var(--status-warning)]"),children:s("gitView.hydration.lfsMissing")}):null,H?t.jsx(Rt,{error:!0,children:s("settings.sourceControl.instance.status.operationFailed")}):null,t.jsxs("div",{className:Es,children:[t.jsx(ne,{size:"sm",variant:"outline",disabled:!u||m.blocked||y,onClick:()=>{Z()},children:s("gitView.hydration.retry")}),j?t.jsxs(t.Fragment,{children:[t.jsx(ne,{size:"sm",disabled:!te,onClick:()=>{a("configure")},children:s("settings.common.actions.saveChanges")}),X?t.jsx(ne,{size:"sm",variant:"ghost",disabled:!se,onClick:()=>{a("remove")},children:s("settings.common.actions.delete")}):null]}):null]})]})})]})};function Ps(l){return l.profiles}function Os(l){return l.globalIdentity}function Fs(l){return l.refreshIdentityAccounts}function Ms(l){return l.identities}function Ls(l){return l.account}const st="border-t border-edge pt-4",Qs=l=>{const e=be.c(11),{open:s,onOpenChange:i,directory:h}=l,{t:f}=xe(),m=Ue(Hs),u=Ue($s);let r;e[0]!==h||e[1]!==i||e[2]!==s||e[3]!==u||e[4]!==m||e[5]!==f?(r=s?t.jsxs(Fe,{className:"@container min-w-0 max-h-[85dvh] overflow-y-auto",children:[t.jsxs(Me,{children:[t.jsx(Le,{children:f("gitView.context.configure")}),t.jsx(He,{children:f("gitView.context.description")})]}),t.jsx(zs,{directory:h,className:st}),t.jsx(Rs,{directory:h,className:st}),t.jsxs(it,{className:st,children:[t.jsx(ne,{size:"sm",variant:"ghost",onClick:()=>{i(!1),m("git"),u(!0)},children:f("gitView.context.settings")}),t.jsx(ne,{size:"sm",variant:"outline",onClick:()=>i(!1),children:f("dialog.common.actions.close")})]})]}):null,e[0]=h,e[1]=i,e[2]=s,e[3]=u,e[4]=m,e[5]=f,e[6]=r):r=e[6];let p;return e[7]!==i||e[8]!==s||e[9]!==r?(p=t.jsx(Oe,{open:s,onOpenChange:i,children:r}),e[7]=i,e[8]=s,e[9]=r,e[10]=p):p=e[10],p};function Hs(l){return l.setSettingsPage}function $s(l){return l.setSettingsDialogOpen}const ei=({mergeInProgress:l,rebaseInProgress:e,onContinue:s,onAbort:i,onResolveWithAI:h,conflictCount:f=0,isLoading:m=!1})=>{const{t:u}=xe(),[r,p]=w.useState(null),k=l&&l.head,C=e&&(e.headName||e.onto),c=k?"merge":C?"rebase":null;if(!c)return null;const y=async()=>{p("continue");try{await s()}finally{p(null)}},S=async()=>{p("abort");try{await i()}finally{p(null)}},H=r!==null,V=f>0,v=u(c==="merge"?"gitView.operation.merge":"gitView.operation.rebase");let o="";l?o=l.message?u("gitView.operation.mergingMessage",{message:l.message}):u("gitView.operation.mergeInProgressWithHead",{head:l.head}):e&&(o=e.headName?u("gitView.operation.rebasingOnto",{headName:e.headName,onto:e.onto||""}):u("gitView.operation.rebaseInProgress"));const x=V?f===1?u("gitView.operation.inProgressTitleOneConflict",{operation:v,count:f}):u("gitView.operation.inProgressTitleManyConflicts",{operation:v,count:f}):u("gitView.operation.inProgressTitle",{operation:v}),T=u(V?"gitView.operation.resolveConflictsHint":"gitView.operation.readyToContinueHint");return t.jsx("div",{className:"mx-4 mt-3 overflow-hidden rounded-lg bg-[var(--status-warning-background)]",children:t.jsxs("div",{className:"flex flex-col gap-3 p-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"typography-label text-[var(--status-warning)]",children:x}),o&&t.jsx("p",{className:"typography-micro break-words text-muted-foreground",children:o})]}),t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[t.jsx("p",{className:"typography-micro min-w-[12rem] flex-1 text-muted-foreground",children:T}),t.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[t.jsx(we,{sideOffset:8,label:u("contextTooltips.git.abortOperation"),children:t.jsxs(ne,{variant:"ghost",size:"sm",onClick:S,disabled:H||m,className:"gap-1.5",children:[r==="abort"?t.jsx(_,{name:"loader-4",className:"size-4 animate-spin"}):t.jsx(_,{name:"close",className:"size-4"}),u("gitView.operation.abort")]})}),V?h&&t.jsx(we,{sideOffset:8,label:u("contextTooltips.git.resolveWithAgent"),children:t.jsx(ne,{variant:"default",size:"sm",onClick:h,disabled:H||m,children:u("gitView.operation.resolveWithAi")})}):t.jsx(we,{sideOffset:8,label:u("contextTooltips.git.continueOperation"),children:t.jsxs(ne,{variant:"default",size:"sm",onClick:y,disabled:H||m,className:"gap-1.5",children:[r==="continue"?t.jsx(_,{name:"loader-4",className:"size-4 animate-spin"}):t.jsx(_,{name:"check",className:"size-4"}),u("gitView.operation.continue")]})})]})]})]})})},bt=()=>Math.floor(Math.random()*1e3);function ti(){const l=be.c(11),{t:e}=xe(),{triggerFireworks:s}=gs(),i=Et();let h;l[0]!==i||l[1]!==e||l[2]!==s?(h=(p,k)=>{const{pushAfter:C,origin:c}=k,y=i?as(i,p,gt(),bt()):null;return y?ge.success(y.title,{description:y.description}):ge.success(e("gitView.toast.commitCreated")),y&&!C&&s({kind:"deletion",origin:c}),y!==null},l[0]=i,l[1]=e,l[2]=s,l[3]=h):h=l[3];const f=h;let m;l[4]!==i||l[5]!==e||l[6]!==s?(m=p=>{const{deletion:k,origin:C}=p,c=i?os(i,new Date,gt(),bt()):null;c?ge.success(c.title,{description:c.description}):ge.success(e("gitView.publish.succeeded")),s({kind:k?"deletion":"push",origin:C})},l[4]=i,l[5]=e,l[6]=s,l[7]=m):m=l[7];const u=m;let r;return l[8]!==f||l[9]!==u?(r={committed:f,pushed:u},l[8]=f,l[9]=u,l[10]=r):r=l[10],r}function si(l){const e=be.c(4),s=Et(),[i]=w.useState(Gs);let h;return e[0]!==s||e[1]!==l||e[2]!==i?(h=(s?ls(s,i.at,i.seed):null)??l,e[0]=s,e[1]=l,e[2]=i,e[3]=h):h=e[3],h}function Gs(){return{at:new Date,seed:Math.floor(Math.random()*1e3)}}export{Ws as C,Zs as D,ei as I,Qs as R,ti as a,Js as b,Ys as c,bs as d,si as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{f as Ce,r as se,j as s,R as V}from"./vendor-react--VO_rL_p.js";import{u as le,a3 as te,U as ce,B as ee,I as Q,ag as oe,ah as ae,af as re,P as je,c$ as ve,d0 as we,az as ye,d1 as Se,d2 as Ne,d3 as ke,d4 as De,d5 as Ie,d6 as de,z as me,d7 as Le,d8 as Te,d9 as Ee,a1 as ue,bL as ze,da as ie,db as Re,dc as Pe,dd as fe,A as he,de as _e}from"./useAppFontEffects-
|
|
1
|
+
import{f as Ce,r as se,j as s,R as V}from"./vendor-react--VO_rL_p.js";import{u as le,a3 as te,U as ce,B as ee,I as Q,ag as oe,ah as ae,af as re,P as je,c$ as ve,d0 as we,az as ye,d1 as Se,d2 as Ne,d3 as ke,d4 as De,d5 as Ie,d6 as de,z as me,d7 as Le,d8 as Te,d9 as Ee,a1 as ue,bL as ze,da as ie,db as Re,dc as Pe,dd as fe,A as he,de as _e}from"./useAppFontEffects-DEX5CMOn.js";import{a5 as Me,a6 as Ae,a7 as $e}from"./runtimeEndpointReset-DKWDEJh9.js";import{bi as xe,b3 as Fe}from"./katex.min-CAwHaRYk.js";const pe="inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-muted-foreground hover:bg-interactive-hover hover:text-foreground";function Je(r){const e=Ce.c(79),{draft:l,onEdit:y,onDelete:f,className:p,maxWidth:Z,forAgent:Y}=r,C=Y===void 0?!1:Y,{t:n}=le(),[g,U]=se.useState(!1),S=l.text;let B;e[0]!==S?(B=S.length>150||S.split(`
|
|
2
2
|
`).length>3,e[0]=S,e[1]=B):B=e[1];const N=B;let T;e[2]!==p?(T=te("w-full max-w-[min(100%,calc(var(--oc-context-panel-width,100vw)-var(--oc-editor-gutter-width,0px)))] overflow-hidden rounded-xl border border-[var(--interactive-border)] bg-[var(--surface-elevated)] shadow-none",p),e[2]=p,e[3]=T):T=e[3];const m=Z?`${Math.max(200,Math.floor(Z))}px`:void 0;let c;e[4]!==m?(c={maxWidth:m},e[4]=m,e[5]=c):c=e[5];let A;e[6]!==C?(A=C?s.jsx(Q,{name:"attachment-2",className:"size-3.5 shrink-0 text-muted-foreground"}):null,e[6]=C,e[7]=A):A=e[7];let o;e[8]!==l.fileLabel||e[9]!==C||e[10]!==n?(o=C?n("review.card.forAgent"):l.fileLabel,e[8]=l.fileLabel,e[9]=C,e[10]=n,e[11]=o):o=e[11];let $;e[12]!==l.fileLabel||e[13]!==o?($=s.jsx("span",{className:"min-w-0 max-w-[200px] truncate text-xs font-medium text-foreground",title:l.fileLabel,children:o}),e[12]=l.fileLabel,e[13]=o,e[14]=$):$=e[14];let F;e[15]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:"•"}),e[15]=F):F=e[15];let E;e[16]!==l?(E=ce(l)?"shrink-0":"min-w-0 truncate",e[16]=l,e[17]=E):E=e[17];let i;e[18]!==E?(i=te("me-auto text-xs text-muted-foreground",E),e[18]=E,e[19]=i):i=e[19];let z;e[20]!==l||e[21]!==n?(z=ce(l)?n("inlineComment.range.wholeFile"):s.jsxs(s.Fragment,{children:[n("inlineComment.range.lines",{start:l.startLine,end:l.endLine}),l.side?` (${l.side})`:""]}),e[20]=l,e[21]=n,e[22]=z):z=e[22];let d;e[23]!==i||e[24]!==z?(d=s.jsx("span",{className:i,children:z}),e[23]=i,e[24]=z,e[25]=d):d=e[25];let K;e[26]===Symbol.for("react.memo_cache_sentinel")?(K={minHeight:0,minWidth:0},e[26]=K):K=e[26];let j;e[27]!==n?(j=n("inlineComment.actions.editComment"),e[27]=n,e[28]=j):j=e[28];let R;e[29]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsx(Q,{name:"pencil",className:"h-3 w-3"}),e[29]=R):R=e[29];let h;e[30]!==y||e[31]!==j?(h=s.jsx(oe,{asChild:!0,children:s.jsx("button",{type:"button",className:pe,style:K,onClick:y,"aria-label":j,children:R})}),e[30]=y,e[31]=j,e[32]=h):h=e[32];let P;e[33]!==n?(P=n("inlineComment.actions.editComment"),e[33]=n,e[34]=P):P=e[34];let O;e[35]!==P?(O=s.jsx(ae,{side:"top",sideOffset:6,children:P}),e[35]=P,e[36]=O):O=e[36];let k;e[37]!==h||e[38]!==O?(k=s.jsxs(re,{children:[h,O]}),e[37]=h,e[38]=O,e[39]=k):k=e[39];let D;e[40]===Symbol.for("react.memo_cache_sentinel")?(D={minHeight:0,minWidth:0},e[40]=D):D=e[40];let v;e[41]!==n?(v=n("inlineComment.actions.deleteComment"),e[41]=n,e[42]=v):v=e[42];let J;e[43]===Symbol.for("react.memo_cache_sentinel")?(J=s.jsx(Q,{name:"close",className:"h-3 w-3"}),e[43]=J):J=e[43];let _;e[44]!==f||e[45]!==v?(_=s.jsx(oe,{asChild:!0,children:s.jsx("button",{type:"button",className:pe,style:D,onClick:f,"aria-label":v,children:J})}),e[44]=f,e[45]=v,e[46]=_):_=e[46];let w;e[47]!==n?(w=n("inlineComment.actions.deleteComment"),e[47]=n,e[48]=w):w=e[48];let I;e[49]!==w?(I=s.jsx(ae,{side:"top",sideOffset:6,children:w}),e[49]=w,e[50]=I):I=e[50];let H;e[51]!==_||e[52]!==I?(H=s.jsxs(re,{children:[_,I]}),e[51]=_,e[52]=I,e[53]=H):H=e[53];let L;e[54]!==d||e[55]!==k||e[56]!==H||e[57]!==A||e[58]!==$?(L=s.jsxs("div",{className:"flex items-center gap-1.5 px-3 pt-2",children:[A,$,F,d,k,H]}),e[54]=d,e[55]=k,e[56]=H,e[57]=A,e[58]=$,e[59]=L):L=e[59];const q=g||!N,X=!g&&N&&"line-clamp-3";let a;e[60]!==X?(a=te("whitespace-pre-wrap break-words text-sm leading-relaxed text-foreground",X),e[60]=X,e[61]=a):a=e[61];let u;e[62]!==S||e[63]!==a?(u=s.jsx("div",{className:a,children:S}),e[62]=S,e[63]=a,e[64]=u):u=e[64];let b;e[65]!==N||e[66]!==g||e[67]!==n?(b=N&&s.jsx(Me,{asChild:!0,children:s.jsx(ee,{variant:"ghost",size:"sm",className:"mt-1 h-6 w-full justify-start px-0 text-xs text-muted-foreground hover:text-foreground",children:g?s.jsxs(s.Fragment,{children:[s.jsx(Q,{name:"arrow-up-s",className:"me-1 size-3"}),n("inlineComment.actions.showLess")]}):s.jsxs(s.Fragment,{children:[s.jsx(Q,{name:"arrow-down-s",className:"me-1 size-3"}),n("inlineComment.actions.showMore")]})})}),e[65]=N,e[66]=g,e[67]=n,e[68]=b):b=e[68];let G;e[69]===Symbol.for("react.memo_cache_sentinel")?(G=s.jsx(Ae,{}),e[69]=G):G=e[69];let W;e[70]!==q||e[71]!==u||e[72]!==b?(W=s.jsx("div",{className:"px-3 pb-2 pt-1",children:s.jsxs($e,{open:q,onOpenChange:U,children:[u,b,G]})}),e[70]=q,e[71]=u,e[72]=b,e[73]=W):W=e[73];let t;return e[74]!==L||e[75]!==T||e[76]!==W||e[77]!==c?(t=s.jsxs("div",{className:T,style:c,"data-comment-card":"true",children:[L,W]}),e[74]=L,e[75]=T,e[76]=W,e[77]=c,e[78]=t):t=e[78],t}const Ke=120,Oe=r=>r.split("/").pop()||r;function Qe({initialText:r="",onTextChange:e,onSave:l,onCancel:y,fileLabel:f,lineRange:p,isEditing:Z=!1,className:Y,maxWidth:C,bandColor:n,floating:g=!1,band:U=!0,wholeFile:S=!1,saveLabel:B,saving:N=!1,review:T}){const{t:m}=le(),{isMobile:c}=je(),A=ve(we(),"diff"),[o,$]=V.useState(r),[F,E]=V.useState(!1),i=se.useRef(null),z=ye("enter"),d=()=>{const t=i.current;t&&(t.style.height="auto",t.style.height=`${Math.min(t.scrollHeight,Ke)}px`)},K=t=>{$(t),e?.(t)};V.useLayoutEffect(d,[o]);const j=se.useRef(p);se.useEffect(()=>{p&&(j.current=p)},[p]);const R=t=>{if(!t)return;const x=Math.min(t.start,t.end),M=Math.max(t.start,t.end);return{...t,start:x,end:M}},h=R(p),P=S?m("inlineComment.range.wholeFile"):h?h.start===h.end?m("review.range.line",{line:h.start}):m("inlineComment.range.lines",{start:h.start,end:h.end}):null,O=[f,h?m("inlineComment.range.lines",{start:h.start,end:h.end}):null].filter(Boolean).join(" • ")||m("inlineComment.actions.comment");se.useEffect(()=>{const t=i.current;if(!t)return;t.focus({preventScroll:!0});const x=t.value.length;t.setSelectionRange(x,x),c&&t.scrollIntoView({behavior:"auto",block:"nearest"})},[c]);const k=Se(),D=se.useRef(null);V.useLayoutEffect(()=>{const t=D.current;t!==null&&(D.current=null,i.current?.setSelectionRange(t,t))},[o]);const v=(t,x,M)=>{const ne=i.current?.value??o;D.current=t+M.length,K(`${ne.slice(0,t)}${M}${ne.slice(x)}`),i.current?.focus()},J=V.useCallback(()=>i.current?.selectionStart??0,[]),_=V.useCallback(t=>i.current?Ne(i.current,t):null,[]),w=ke({text:o,getCaret:J,replaceRange:v,caretCoords:_}),I=De(),H=t=>{const x=t.currentTarget,M=k.takePastedImages(t.clipboardData,x.value,{start:x.selectionStart,end:x.selectionEnd});M&&(t.preventDefault(),v(M.from,M.to,M.insertion))},L=()=>{if(o.trim()&&!N){if(l(o,R(j.current))===!1)return;k.attachCitedImages(o)}},q=t=>{Le(t)||w.handleKeyDown(t)||(t.key==="Enter"&&I.shouldSubmit(t)?(t.preventDefault(),L()):t.key==="Escape"&&(t.preventDefault(),y()))},X=async()=>{if(!(!T||!o.trim()||F)){E(!0);try{await T.add(o,R(j.current))}finally{E(!1)}}},a=T?.suggestionCode,u=()=>{if(!a)return;const t=i.current,x=t?.selectionStart??o.length,M=t?.selectionEnd??o.length,ne=x>0&&o[x-1]!==`
|
|
3
3
|
`?`
|
|
4
4
|
`:"";v(x,M,`${ne}\`\`\`suggestion
|
package/dist/assets/{useMarkdownLocalAssets-BfOLz9Xm.js → useMarkdownLocalAssets-6zcqySrf.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as y,R,f as C}from"./vendor-react--VO_rL_p.js";import{bk as A}from"./useAppFontEffects-
|
|
1
|
+
import{a as y,R,f as C}from"./vendor-react--VO_rL_p.js";import{bk as A}from"./useAppFontEffects-DEX5CMOn.js";const d="data-oc-block-index",g="data-oc-block-key",L=s=>{const e=s.ownerDocument.defaultView;for(let t=s.parentElement;t&&e;t=t.parentElement)if(/auto|scroll/.test(e.getComputedStyle(t).overflowY))return t;return null},w=(s,e)=>{if(!s)return 0;const t=Number.parseFloat(s.ownerDocument.defaultView?.getComputedStyle(s)[e]??"");return Number.isFinite(t)?t:0},E=s=>Array.from(s.querySelectorAll("video, audio")).some(e=>e instanceof HTMLMediaElement&&!e.paused),D=(s,e)=>{let t=5381;for(let n=0;n<e.length;n+=1)t=(t<<5)+t+e.charCodeAt(n)|0;return`${s}:${e.length}:${t>>>0}`},p=new WeakMap,M=24;class N{container=null;scroller=null;attached=!1;near=new Set;pins=new Map;holds=0;selecting=!1;selectionRelease=null;sizes=new Map;kept=new Set;listeners=new Set;stop=null;frame=null;charsPerLine=80;subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});isRendered(e){return this.attached?!this.scroller||this.holds>0||this.near.has(e)||this.pins.has(e):e<M}size(e){return this.sizes.get(e)}attach(e){this.detach(),this.container=e,this.scroller=L(e),this.attached=!0,p.set(e,this);const t=this.scroller;if(!t){this.notify();return}const n=e.ownerDocument,i=n.defaultView,r=()=>this.update(),c=()=>{this.frame!==null||!i||(this.frame=i.requestAnimationFrame(()=>{this.frame=null,this.update()}))},l=globalThis.ResizeObserver?new ResizeObserver(()=>{this.charsPerLine=Math.max(20,Math.round(e.clientWidth/7.5)),this.update(),c()}):null;l?.observe(t),l?.observe(e),this.charsPerLine=Math.max(20,Math.round(e.clientWidth/7.5)),c();const u=()=>{const a=n.getSelection(),h=a&&!a.isCollapsed&&a.rangeCount>0?a.getRangeAt(0):null,o=!!(h&&(e.contains(h.commonAncestorContainer)||h.intersectsNode(e)));h&&o&&!this.selectionRelease&&this.spansUnmounted(h)?this.selectionRelease=this.hold(void 0):!o&&this.selectionRelease&&(this.selectionRelease(),this.selectionRelease=null),o!==this.selecting&&(this.selecting=o,o||this.update())},f=a=>{if(!(a.target instanceof Element)||!a.target.closest("summary"))return;const h=a.target.closest(`[${d}]`)?.getAttribute(g);h&&this.kept.add(h)};t.addEventListener("scroll",r,{passive:!0}),e.addEventListener("click",f,!0),n.addEventListener("selectionchange",u),this.stop=()=>{this.frame!==null&&i?.cancelAnimationFrame(this.frame),this.frame=null,l?.disconnect(),t.removeEventListener("scroll",r),e.removeEventListener("click",f,!0),n.removeEventListener("selectionchange",u)}}detach(){this.stop?.(),this.stop=null,this.container&&p.delete(this.container),this.container=null,this.scroller=null;const e=this.selectionRelease;this.selectionRelease=null,this.selecting=!1,e?.()}hold(e,t=!1){e===void 0?this.holds+=1:this.pins.set(e,(this.pins.get(e)??0)+1),this.notify(t);let n=!1;return()=>{if(!n){if(n=!0,e===void 0)this.holds-=1;else{const i=(this.pins.get(e)??1)-1;i>0?this.pins.set(e,i):this.pins.delete(e)}this.update(),this.notify()}}}update(){const e=this.container,t=this.scroller,n=e?.querySelector("[data-oc-streamdown]");if(!e||!t||!n)return;const i=Array.from(n.children).filter(o=>o instanceof HTMLElement&&o.hasAttribute(d)),r=t.getBoundingClientRect();if(r.height===0)return;const c=r.top-r.height,l=r.bottom+r.height;let u=0,f=i.length;for(;u<f;){const o=u+f>>1;i[o].getBoundingClientRect().bottom<c?u=o+1:f=o}const a=new Set;for(let o=u;o<i.length&&!(i[o].getBoundingClientRect().top>l);o+=1)a.add(Number(i[o].getAttribute(d)));if(this.selecting)for(const o of this.near)a.add(o);if(this.holds===0)for(const o of i){const m=Number(o.getAttribute(d));a.has(m)||this.pins.has(m)||(this.isLive(o)?a.add(m):this.measure(o))}const h=a.size!==this.near.size||[...a].some(o=>!this.near.has(o));this.near=a,h&&this.notify()}isLive(e){if(e.hasAttribute("data-oc-block-placeholder"))return!1;const t=e.getAttribute(g);return t!==null&&this.kept.has(t)||E(e)}spansUnmounted(e){const t=r=>{const l=(r instanceof Element?r:r.parentElement)?.closest(`[${d}]`);return l&&this.container?.contains(l)?Number(l.getAttribute(d)):null},n=t(e.startContainer),i=t(e.endContainer);if(n===null||i===null)return!!this.container?.querySelector("[data-oc-block-placeholder]");for(let r=n;r<=i;r+=1)if(!this.isRendered(r))return!0;return!1}measure(e){const t=e.getAttribute(g);!t||e.hasAttribute("data-oc-block-placeholder")||this.sizes.set(t,{height:e.getBoundingClientRect().height,start:w(e.firstElementChild,"marginBlockStart"),end:w(e.lastElementChild,"marginBlockEnd")})}notify(e=!1){const t=()=>{for(const n of this.listeners)n()};e?y.flushSync(t):t()}}const b=s=>{const e=s.closest("[data-markdown-content]")??s.querySelector("[data-markdown-content]");return e?p.get(e):void 0},x=s=>b(s)!==void 0,v=(s,e={})=>{const t=b(s);if(!t)return()=>{};const n=e.block?.getAttribute(d);return t.hold(n==null?void 0:Number(n),e.sync)},K=R.createContext(null),S=s=>!!s.trim()&&!s.startsWith("#")&&!s.startsWith("//")&&!/^[a-z][a-z\d+.-]*:/i.test(s),k=s=>{try{return decodeURIComponent(s)}catch{return s}},B=(s,e)=>A(s.slice(0,s.lastIndexOf("/")+1)||"/",k(e.split(/[?#]/,1)[0]??"")),W=(s,e)=>{if(!e||s.defaultPrevented||s.button!==0||s.metaKey||s.ctrlKey||s.shiftKey||s.altKey)return!1;const t=s.currentTarget.getAttribute("href")??"";if(t.startsWith("#")){s.preventDefault(),s.stopPropagation();const n=k(t.slice(1)).toLowerCase(),i=s.currentTarget.closest("[data-markdown-content]"),r=i?v(i,{sync:!0}):null;for(const c of i?.querySelectorAll("h1,h2,h3,h4,h5,h6")??[]){const l=(c.textContent??"").trim().toLowerCase().replace(/[^\p{L}\p{N}\s-]/gu,"").replace(/\s+/g,"-");if(n&&(c.id===n||l===n)){c.scrollIntoView({block:"start"});break}}return r?.(),!0}return S(t)?(s.preventDefault(),s.stopPropagation(),e.onOpenFile(B(e.filePath,t)),!0):!1},F=s=>{const e=C.c(6),{filePath:t,workspaceRoot:n,onOpenFile:i,enabled:r,colorScheme:c}=s;let l;return e[0]!==c||e[1]!==r||e[2]!==t||e[3]!==i||e[4]!==n?(l=r&&t?{filePath:t,workspaceRoot:n,onOpenFile:i,colorScheme:c}:void 0,e[0]=c,e[1]=r,e[2]=t,e[3]=i,e[4]=n,e[5]=l):l=e[5],l};export{g as B,K as M,d as a,D as b,N as c,x as d,v as h,S as i,W as o,B as r,F as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as F,R as P,r as he,j as a}from"./vendor-react--VO_rL_p.js";import{u as $,bU as we,bV as ge,bW as xe,bE as M,bX as be,bY as ne,bZ as Se,bf as ve,b3 as se,bG as ye}from"./katex.min-2cmqKX7p.js";import{u as Q,a3 as G,I as T,a7 as _e,a8 as je,a6 as Ne,a1 as J,gI as Ee,fo as ae,gJ as Ce,n as Ie,gK as Le,gL as ke,gM as De,ay as Re,gN as ze,cX as Te,cU as Ae,b1 as Fe,x as ie,gO as Pe,gP as Oe,gQ as Me,Z as ce,gR as $e,gS as Ge}from"./useAppFontEffects-xaAfmUwn.js";import{M as de}from"./vendor-base-ui-CHqK1aDI.js";import{o as oe,a as Ve,h as We,s as He}from"./vendor-zod-B_hXR7jf.js";function zt(){const n=F.c(5),e=$(Ue);let t;n[0]===Symbol.for("react.memo_cache_sentinel")?(t=we(),n[0]=t):t=n[0];const r=t;let s;n[1]!==e?(s=ge(e),n[1]=e,n[2]=s):s=n[2];const l=s;let o;return n[3]!==l?(o={usesFramelessChrome:r,side:l},n[3]=l,n[4]=o):o=n[4],o}function Ue(n){return n.desktopWindowControlsPosition}const Be={close:"#FF5F57",minimize:"#FEBC2E",maximize:"#28C940"},Ye="rgba(0, 0, 0, 0.7)",Ze=n=>{const e=F.c(3),{action:t}=n;if(t==="close"){let s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=a.jsx(T,{name:"close",className:"size-[10px]"}),e[0]=s):s=e[0],s}if(t==="minimize"){let s;return e[1]===Symbol.for("react.memo_cache_sentinel")?(s=a.jsx(T,{name:"subtract",className:"size-[10px]"}),e[1]=s):s=e[1],s}let r;return e[2]===Symbol.for("react.memo_cache_sentinel")?(r=a.jsx(T,{name:"add",className:"size-[10px]"}),e[2]=r):r=e[2],r},Ke=n=>{const e=F.c(18),{action:t,isMaximized:r,onActivate:s}=n,{t:l}=Q(),o=Be[t];let c;e[0]!==t||e[1]!==r||e[2]!==l?(c=l(t==="close"?"header.windowControls.close":t==="minimize"?"header.windowControls.minimize":r?"header.windowControls.restore":"header.windowControls.maximize"),e[0]=t,e[1]=r,e[2]=l,e[3]=c):c=e[3];const p=c;let d;e[4]!==t||e[5]!==s?(d=()=>s(t),e[4]=t,e[5]=s,e[6]=d):d=e[6];let i;e[7]!==o?(i={backgroundColor:o,color:Ye},e[7]=o,e[8]=i):i=e[8];let u;e[9]!==t?(u=a.jsx("span",{className:"flex items-center justify-center opacity-0 transition-opacity duration-75 group-hover/wctl:opacity-100",children:a.jsx(Ze,{action:t})}),e[9]=t,e[10]=u):u=e[10];let m;e[11]!==i||e[12]!==u?(m=a.jsx("span",{className:"flex size-3.5 items-center justify-center rounded-full shadow-[inset_0_0_0_0.5px_rgba(0,0,0,0.28)] transition-[filter] duration-75 active:brightness-90",style:i,children:u}),e[11]=i,e[12]=u,e[13]=m):m=e[13];let h;return e[14]!==p||e[15]!==d||e[16]!==m?(h=a.jsx("button",{type:"button",onClick:d,title:p,"aria-label":p,className:"app-region-no-drag flex h-8 w-[24px] items-center justify-center rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:m}),e[14]=p,e[15]=d,e[16]=m,e[17]=h):h=e[17],h},Tt=P.memo(function(e){const t=F.c(27),{visible:r,position:s}=e,l=s===void 0?"right":s,{t:o}=Q(),[c,p]=P.useState(!1),d=$(qe);let i,u;if(t[0]!==r?(i=()=>{if(!r)return;let y=!1;M("desktop_get_current_window_state").then(D=>{y||p(!!D?.maximized)}).catch(Je);const E=D=>{const x=D.detail;p(!!x?.maximized)};return window.addEventListener("openchamber:window-maximized-changed",E),()=>{y=!0,window.removeEventListener("openchamber:window-maximized-changed",E)}},u=[r],t[0]=r,t[1]=i,t[2]=u):(i=t[1],u=t[2]),he.useEffect(i,u),!r)return null;const m=l==="left";let h,w,f,g,S;if(t[3]!==d||t[4]!==m||t[5]!==c||t[6]!==l||t[7]!==o){S=Symbol.for("react.early_return_sentinel");e:{const y=xe(l);let E;t[13]===Symbol.for("react.memo_cache_sentinel")?(E=_=>{if(_==="close"){M("desktop_close_current_window");return}if(_==="minimize"){M("desktop_minimize_current_window");return}M("desktop_toggle_current_window_maximized").then(b=>p(!!b?.maximized)).catch(Xe)},t[13]=E):E=t[13];const D=E;if(d==="traffic-lights"){const _=m?"me-1":"ms-1 me-3";let b;t[14]!==_?(b=G("app-region-no-drag group/wctl flex h-8 shrink-0 items-center",_),t[14]=_,t[15]=b):b=t[15];let j;t[16]!==o?(j=o("header.windowControls.groupAria"),t[16]=o,t[17]=j):j=t[17];let N;t[18]!==c?(N=C=>a.jsx(Ke,{action:C,isMaximized:c,onActivate:D},C),t[18]=c,t[19]=N):N=t[19],S=a.jsx("div",{dir:"ltr",className:b,"aria-label":j,children:y.map(N)});break e}const x=G("app-region-no-drag inline-flex items-center justify-center text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",m?"h-8 w-8 rounded-md":"h-12 w-11"),k=m?"app-region-no-drag me-1 flex h-8 shrink-0 items-center":"app-region-no-drag ms-1 flex h-12 shrink-0 items-center",R=_=>_==="minimize"?a.jsx("button",{type:"button",className:x,onClick:Qe,title:o("header.windowControls.minimize"),"aria-label":o("header.windowControls.minimize"),children:a.jsx(T,{name:"subtract",className:"h-4 w-4"})},"minimize"):_==="maximize"?a.jsx("button",{type:"button",className:x,onClick:()=>{M("desktop_toggle_current_window_maximized").then(b=>p(!!b?.maximized)).catch(et)},title:o(c?"header.windowControls.restore":"header.windowControls.maximize"),"aria-label":o(c?"header.windowControls.restore":"header.windowControls.maximize"),children:a.jsx(T,{name:c?"fullscreen-exit":"checkbox-blank",className:"h-3.5 w-3.5"})},"maximize"):a.jsx("button",{type:"button",className:G(x,"hover:bg-[var(--status-error)] hover:text-[var(--status-error-foreground)]"),onClick:tt,title:o("header.windowControls.close"),"aria-label":o("header.windowControls.close"),children:a.jsx(T,{name:"close",className:"h-4 w-4"})},"close");h="ltr",w=k,t[20]!==o?(f=o("header.windowControls.groupAria"),t[20]=o,t[21]=f):f=t[21],g=y.map(R)}t[3]=d,t[4]=m,t[5]=c,t[6]=l,t[7]=o,t[8]=h,t[9]=w,t[10]=f,t[11]=g,t[12]=S}else h=t[8],w=t[9],f=t[10],g=t[11],S=t[12];if(S!==Symbol.for("react.early_return_sentinel"))return S;let v;return t[22]!==h||t[23]!==w||t[24]!==f||t[25]!==g?(v=a.jsx("div",{dir:h,className:w,"aria-label":f,children:g}),t[22]=h,t[23]=w,t[24]=f,t[25]=g,t[26]=v):v=t[26],v});function qe(n){return n.desktopWindowControlsStyle}function Je(){}function Xe(){}function Qe(){M("desktop_minimize_current_window")}function et(){}function tt(){M("desktop_close_current_window")}const te="new-session",nt=10;function At(n){const e=F.c(18),{children:t,variant:r,scopeProjectId:s,align:l}=n,o=r===void 0?"default":r,c=s===void 0?null:s,p=l===void 0?"start":l,d=$(it),i=$(st);let u;e[0]!==t?(u=a.jsx(_e,{asChild:!0,children:t}),e[0]=t,e[1]=u):u=e[1];const m=o==="compact"?"w-[280px]":"w-[360px]";let h;e[2]!==m?(h=G("overflow-hidden p-1 max-w-[calc(100vw-32px)]",m),e[2]=m,e[3]=h):h=e[3];let w;e[4]!==d||e[5]!==c||e[6]!==i||e[7]!==o?(w=d?a.jsx(ot,{onSelect:()=>i(!1),variant:o,scopeProjectId:c}):null,e[4]=d,e[5]=c,e[6]=i,e[7]=o,e[8]=w):w=e[8];let f;e[9]!==p||e[10]!==h||e[11]!==w?(f=a.jsx(je,{align:p,sideOffset:6,className:h,children:w}),e[9]=p,e[10]=h,e[11]=w,e[12]=f):f=e[12];let g;return e[13]!==d||e[14]!==i||e[15]!==u||e[16]!==f?(g=a.jsxs(Ne,{open:d,onOpenChange:i,modal:!1,disableGlobalShortcuts:!0,children:[u,f]}),e[13]=d,e[14]=i,e[15]=u,e[16]=f,e[17]=g):g=e[17],g}function st(n){return n.setSessionDropdownOpen}function it(n){return n.isSessionDropdownOpen}function ot(n){const e=F.c(32),{onSelect:t,variant:r,scopeProjectId:s}=n,l=J(ct),o=J(at);let c;e[0]!==l||e[1]!==s?(c={scopeProjectId:s,currentSessionId:l,maxParents:nt,ignorePins:!0},e[0]=l,e[1]=s,e[2]=c):c=e[2];const p=Ee(!0,c);let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=[],e[3]=d):d=e[3],P.useEffect(lt,d);const i=J(rt),{t:u}=Q();let m;e[4]!==t||e[5]!==i?(m=()=>{t(),i()},e[4]=t,e[5]=i,e[6]=m):m=e[6];const h=m;let w;e[7]===Symbol.for("react.memo_cache_sentinel")?(w=new Set,e[7]=w):w=e[7];const[f,g]=P.useState(w),S=P.useRef(null),v=P.useRef(!1),y=o?te:l;let E;e[8]===Symbol.for("react.memo_cache_sentinel")?(E=I=>{g(q=>{const L=new Set(q);return L.has(I)?L.delete(I):L.add(I),L})},e[8]=E):E=e[8];const D=E;let x,k;e[9]!==f||e[10]!==y||e[11]!==p?(x=()=>{if(v.current||!y)return;const I=y===te?[]:Ce(p,y);if(!I)return;if(I.some(L=>!f.has(L))){g(L=>new Set([...L,...I]));return}const q=requestAnimationFrame(()=>{const L=Array.from(S.current?.querySelectorAll("[data-switcher-item-id]")??[]).find(O=>O.dataset.switcherItemId===y);L&&(L.focus(),L.scrollIntoView({block:"nearest"}),v.current=!0)});return()=>cancelAnimationFrame(q)},k=[f,y,p],e[9]=f,e[10]=y,e[11]=p,e[12]=x,e[13]=k):(x=e[12],k=e[13]),P.useLayoutEffect(x,k);let R,_;e[14]===Symbol.for("react.memo_cache_sentinel")?(R=G("group relative flex w-full cursor-pointer items-center gap-2 rounded-lg px-2 py-1.5 outline-hidden select-none","data-[highlighted]:bg-interactive-hover hover:bg-interactive-hover"),_=a.jsx(T,{name:"chat-new",className:"h-4 w-4 flex-shrink-0 text-muted-foreground"}),e[14]=R,e[15]=_):(R=e[14],_=e[15]);let b;e[16]!==u?(b=u("sessions.sidebar.header.actions.newSession"),e[16]=u,e[17]=b):b=e[17];let j;e[18]!==b?(j=a.jsx("span",{className:"truncate typography-ui-label font-normal leading-tight text-foreground",children:b}),e[18]=b,e[19]=j):j=e[19];let N;e[20]!==h||e[21]!==j?(N=a.jsxs(de,{"data-switcher-item-id":te,onClick:h,className:R,children:[_,j]}),e[20]=h,e[21]=j,e[22]=N):N=e[22];let C;e[23]!==f||e[24]!==p||e[25]!==t||e[26]!==u||e[27]!==r?(C=p.length===0?a.jsx("div",{className:"px-3 py-4 text-center typography-meta text-muted-foreground",children:u("sessions.switcher.empty")}):p.map(I=>a.jsx(ue,{item:I,depth:0,variant:r,expandedParents:f,toggleParent:D,closeDropdown:t},I.node.session.id)),e[23]=f,e[24]=p,e[25]=t,e[26]=u,e[27]=r,e[28]=C):C=e[28];let A;return e[29]!==N||e[30]!==C?(A=a.jsx(Ie,{ref:S,outerClassName:"max-h-[60vh]",disableHorizontal:!0,children:a.jsxs("div",{className:"space-y-0.5",children:[N,C]})}),e[29]=N,e[30]=C,e[31]=A):A=e[31],A}function rt(n){return n.openNewSessionDraft}function lt(){ae()}function at(n){return n.newSessionDraft.open===!0}function ct(n){return n.currentSessionId}function ue(n){const e=F.c(31),{item:t,depth:r,variant:s,expandedParents:l,toggleParent:o,closeDropdown:c}=n,{node:p,secondaryMeta:d}=t,i=p.session,u=p.children.length>0;let m;e[0]!==l||e[1]!==i.id?(m=l.has(i.id),e[0]=l,e[1]=i.id,e[2]=m):m=e[2];const h=m;let w;e[3]!==u||e[4]!==i.id||e[5]!==o?(w=u?()=>o(i.id):void 0,e[3]=u,e[4]=i.id,e[5]=o,e[6]=w):w=e[6];let f;e[7]!==c||e[8]!==r||e[9]!==u||e[10]!==h||e[11]!==d||e[12]!==i||e[13]!==w||e[14]!==s?(f=a.jsx(dt,{session:i,depth:r,variant:s,secondaryMeta:d,hasChildren:u,isExpanded:h,onToggleExpand:w,closeDropdown:c}),e[7]=c,e[8]=r,e[9]=u,e[10]=h,e[11]=d,e[12]=i,e[13]=w,e[14]=s,e[15]=f):f=e[15];let g;e[16]!==c||e[17]!==r||e[18]!==l||e[19]!==u||e[20]!==h||e[21]!==t.groupDirectory||e[22]!==t.projectId||e[23]!==p.children||e[24]!==d||e[25]!==o||e[26]!==s?(g=u&&h?p.children.map(v=>a.jsx(ue,{item:{node:v,projectId:t.projectId,groupDirectory:t.groupDirectory,secondaryMeta:d},depth:r+1,variant:s,expandedParents:l,toggleParent:o,closeDropdown:c},v.session.id)):null,e[16]=c,e[17]=r,e[18]=l,e[19]=u,e[20]=h,e[21]=t.groupDirectory,e[22]=t.projectId,e[23]=p.children,e[24]=d,e[25]=o,e[26]=s,e[27]=g):g=e[27];let S;return e[28]!==f||e[29]!==g?(S=a.jsxs(a.Fragment,{children:[f,g]}),e[28]=f,e[29]=g,e[30]=S):S=e[30],S}function dt(n){const e=F.c(59),{session:t,depth:r,variant:s,secondaryMeta:l,hasChildren:o,isExpanded:c,onToggleExpand:p,closeDropdown:d}=n,{t:i}=Q(),u=J(mt),m=J(ut),h=Le(t.id),w=ke(t.id),f=u===t.id;let g;e[0]!==t.title||e[1]!==i?(g=t.title?.trim()||i("sessions.sidebar.session.untitled"),e[0]=t.title,e[1]=i,e[2]=g):g=e[2];const S=g,v=De(t.id),y=v!==null,E=Re(y),D=!y&&h&&(!f||w);let x;if(e[3]!==t){const z=ze(t)||Date.now();x=Te(z),e[3]=t,e[4]=x}else x=e[4];const k=x;let R;e[5]!==l?.projectLabel?(R=l?.projectLabel?.trim()||null,e[5]=l?.projectLabel,e[6]=R):R=e[6];const _=R;let b;e[7]!==l?.branchLabel?(b=l?.branchLabel?.trim()||null,e[7]=l?.branchLabel,e[8]=b):b=e[8];const j=b,N=j&&j!=="HEAD"?j:null;let C;e[9]!==d||e[10]!==f||e[11]!==t||e[12]!==m?(C=()=>{if(f){d();return}const z=Fe(t);m(t.id,z??null),d()},e[9]=d,e[10]=f,e[11]=t,e[12]=m,e[13]=C):C=e[13];const A=C;let I;e[14]!==A?(I=z=>{if(z.target?.closest("[data-switcher-expand]")){z.preventDefault();return}A()},e[14]=A,e[15]=I):I=e[15];const q=t.id,L=f&&"bg-interactive-selection text-interactive-selection-foreground hover:bg-interactive-selection data-[highlighted]:bg-interactive-selection";let O;e[16]!==L?(O=G("group relative flex w-full cursor-pointer items-start gap-2 rounded-lg px-2 py-1.5 outline-hidden select-none","data-[highlighted]:bg-interactive-hover hover:bg-interactive-hover",L),e[16]=L,e[17]=O):O=e[17];const ee=8+r*12;let V;e[18]!==ee?(V={paddingInlineStart:ee},e[18]=ee,e[19]=V):V=e[19];let W;e[20]!==o||e[21]!==c||e[22]!==p||e[23]!==i||e[24]!==s?(W=s==="compact"&&o?a.jsx("span",{role:"button",tabIndex:-1,"data-switcher-expand":!0,onClick:z=>{z.preventDefault(),z.stopPropagation(),p?.()},className:"inline-flex h-3.5 w-3.5 flex-shrink-0 items-center justify-center rounded text-muted-foreground hover:text-foreground","aria-label":i(c?"sessions.sidebar.session.subsessions.collapse":"sessions.sidebar.session.subsessions.expand"),children:c?a.jsx(T,{name:"arrow-down-s",className:"h-3.5 w-3.5"}):a.jsx(T,{name:"arrow-right-s",className:"h-3.5 w-3.5"})}):null,e[20]=o,e[21]=c,e[22]=p,e[23]=i,e[24]=s,e[25]=W):W=e[25];let H;e[26]!==S?(H=a.jsx("span",{dir:"auto",className:"truncate oc-ui-start-align typography-ui-label font-normal leading-tight text-foreground",children:S}),e[26]=S,e[27]=H):H=e[27];let U;e[28]!==W||e[29]!==H?(U=a.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[W,H]}),e[28]=W,e[29]=H,e[30]=U):U=e[30];let B;e[31]!==N||e[32]!==o||e[33]!==c||e[34]!==p||e[35]!==_||e[36]!==i||e[37]!==k||e[38]!==s?(B=s==="default"?a.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 truncate text-muted-foreground leading-tight",style:{fontSize:"calc(var(--text-ui-label) * 0.85)"},children:[o?a.jsx("span",{role:"button",tabIndex:-1,"data-switcher-expand":!0,onClick:z=>{z.preventDefault(),z.stopPropagation(),p?.()},className:"inline-flex h-3 w-3 flex-shrink-0 items-center justify-center rounded text-muted-foreground hover:text-foreground","aria-label":i(c?"sessions.sidebar.session.subsessions.collapse":"sessions.sidebar.session.subsessions.expand"),children:c?a.jsx(T,{name:"arrow-down-s",className:"h-3 w-3"}):a.jsx(T,{name:"arrow-right-s",className:"h-3 w-3"})}):null,a.jsx("span",{className:"flex-shrink-0",children:k}),_?a.jsx("span",{className:"truncate",children:_}):null,N?a.jsxs("span",{className:"inline-flex min-w-0 items-center gap-0.5",children:[a.jsx(T,{name:"git-branch",className:"h-3 w-3 flex-shrink-0 text-muted-foreground"}),a.jsx("span",{className:"truncate",children:N})]}):null]}):null,e[31]=N,e[32]=o,e[33]=c,e[34]=p,e[35]=_,e[36]=i,e[37]=k,e[38]=s,e[39]=B):B=e[39];let Y;e[40]!==U||e[41]!==B?(Y=a.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[U,B]}),e[40]=U,e[41]=B,e[42]=Y):Y=e[42];let Z;e[43]!==y||e[44]!==E||e[45]!==D||e[46]!==v?(Z=y||D?a.jsx("span",{className:"flex h-3 w-3 flex-shrink-0 items-center justify-center self-center",children:a.jsx(Ae,{state:v??"unread",runningClassName:G("h-2 w-2",E)})}):null,e[43]=y,e[44]=E,e[45]=D,e[46]=v,e[47]=Z):Z=e[47];let K;e[48]!==k||e[49]!==s?(K=s==="compact"?a.jsx("span",{className:"shrink-0 self-center typography-micro text-muted-foreground tabular-nums",children:k}):null,e[48]=k,e[49]=s,e[50]=K):K=e[50];let X;return e[51]!==t.id||e[52]!==V||e[53]!==Y||e[54]!==Z||e[55]!==K||e[56]!==I||e[57]!==O?(X=a.jsxs(de,{onClick:I,"data-slot":"session-switcher-item","data-switcher-item-id":q,className:O,style:V,children:[Y,Z,K]}),e[51]=t.id,e[52]=V,e[53]=Y,e[54]=Z,e[55]=K,e[56]=I,e[57]=O,e[58]=X):X=e[58],X}function ut(n){return n.setCurrentSession}function mt(n){return n.currentSessionId}const Ft=n=>!Number.isFinite(n)||n<=0?new Intl.NumberFormat(ie(),{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(0):new Intl.NumberFormat(ie(),{style:"currency",currency:"USD",minimumFractionDigits:n<.01?4:2,maximumFractionDigits:n<.01?4:2}).format(n),ft="ui-store",pt=oe({state:oe({contextSurfaceZones:Ve(He(),We())})}),ht=n=>{if(!n)return null;let e;try{e=JSON.parse(n)}catch{return null}const t=pt.safeParse(e);return t.success?Se.parse(t.data.state.contextSurfaceZones):null},Pt=()=>{const n=e=>{if(e.key!==ft)return;const t=ht(e.newValue);if(!t)return;const r=$.getState().contextSurfaceZones,s=new Set([...Object.keys(r),...Object.keys(t)].filter(be));for(const l of s){const o=ne(t,l);o!==ne($.getState().contextSurfaceZones,l)&&$.getState().moveContextSurfaceToZone(l,o)}};return window.addEventListener("storage",n),()=>window.removeEventListener("storage",n)},wt=10*6e4,re=45e3,gt=[1e3,2e3,4e3],me={isHidden:()=>!1,onVisible:()=>()=>{}},xt=()=>()=>{},bt=()=>()=>{},St=()=>{let n=!1;const e=new Set;return window.addEventListener("openchamber:window-visibility",t=>{if(!(t instanceof CustomEvent)||t.detail!==!0&&t.detail!==!1)return;const r=n;if(n=!t.detail,r&&t.detail)for(const s of e)s()}),{isHidden:()=>n,onVisible:t=>(e.add(t),()=>{e.delete(t)})}};let le=null;const vt=()=>typeof document>"u"?me:ye()?(le??=St(),le):{isHidden:()=>document.visibilityState==="hidden",onVisible:n=>{let e=document.visibilityState==="hidden";const t=()=>{const s=document.visibilityState==="hidden";e&&!s&&n(),e=s},r=()=>{e&&document.visibilityState!=="hidden"&&t()};return document.addEventListener("visibilitychange",t),window.addEventListener("focus",r),()=>{document.removeEventListener("visibilitychange",t),window.removeEventListener("focus",r)}}},yt=(n,e,t=window.setTimeout.bind(window),r=window.clearTimeout.bind(window),s=me,l=xt,o=e,c=Date.now,p=bt)=>{let d=!1,i,u=0,m=!1,h=!1,w=!1,f=!1,g=!1,S=null,v=null,y=Number.NEGATIVE_INFINITY;const E=()=>S??y+wt,D=b=>{i!==void 0&&r(i);const j=b??(m?Math.max(0,Math.min(E(),v??Number.POSITIVE_INFINITY)-c()):re);i=t(()=>{if(i=void 0,!s.isHidden()){if(m&&c()<E()&&v!==null){v=null,x(o,!1);return}x(e)}},j)},x=async(b,j=!0)=>{h=!0,w=!1;const N=await b().catch(()=>!1);if(h=!1,d)return;if(m||=N,j&&N)y=c(),S=null,v=null;else if(N)v=null;else if(m){const A=c()+re;j?S=A:v??=A}if(f){f=!1,g=!1,x(e);return}if(!m&&w){x(e);return}if(g&&m){g=!1,x(o,!1);return}const C=m?void 0:gt[u];C!==void 0&&(u+=1),D(C)},k=s.onVisible(()=>{if(!d){if(i!==void 0&&r(i),i=void 0,h){f=!0;return}x(e)}}),R=l(()=>{if(!(d||m)){if(h){w=!0;return}i!==void 0&&r(i),i=void 0,x(e)}}),_=p(()=>{if(!d){if(h){g=!0;return}m&&x(o,!1)}});return x(n),()=>{d=!0,k(),R(),_(),i!==void 0&&r(i)}},Ot=n=>{const e=F.c(3);let t,r;e[0]!==n?(t=()=>{const s=jt;let l=s();const o=ve(()=>{l(),l=s()});return()=>{o(),l()}},r=[n],e[0]=n,e[1]=t,e[2]=r):(t=e[1],r=e[2]),P.useEffect(t,r)};function _t(){return ce.getState().refreshSessionHead()}function jt(){const n=se();let e=!0;const t=async s=>(s?await Pe(Oe()):await ae(),!e||se()!==n?!1:(Me(),ce.getState().status==="ready")),r=yt(()=>t(!0),()=>t(!1),window.setTimeout.bind(window),window.clearTimeout.bind(window),vt(),s=>Ge(l=>{l===n&&s()}),_t,Date.now,s=>$e(l=>{l===n&&s()}));return()=>{e=!1,r()}}const fe=()=>{const n=[document.documentElement,document.body],e=document.getElementById("root");return e&&n.push(e),n},pe=()=>{let n=!1;for(const e of fe())e.scrollTop!==0&&(e.scrollTop=0,n=!0),e.scrollLeft!==0&&(e.scrollLeft=0,n=!0);return n},Nt=n=>n===document||fe().some(e=>e===n),Mt=()=>{const n=F.c(1);let e;n[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],n[0]=e):e=n[0],P.useEffect(Ct,e)};function Et(n){Nt(n.target)&&pe()}function Ct(){const n=Et;return document.addEventListener("scroll",n,{capture:!0,passive:!0}),pe(),()=>document.removeEventListener("scroll",n,{capture:!0})}export{At as S,Tt as W,Pt as a,Mt as b,Ot as c,Ft as f,zt as u};
|
|
1
|
+
import{f as F,R as P,r as he,j as a}from"./vendor-react--VO_rL_p.js";import{u as $,bU as we,bV as ge,bW as xe,bE as M,bX as be,bY as ne,bZ as Se,bf as ve,b3 as se,bG as ye}from"./katex.min-CAwHaRYk.js";import{u as Q,a3 as G,I as T,a7 as _e,a8 as je,a6 as Ne,a1 as J,gI as Ee,fo as ae,gJ as Ce,n as Ie,gK as Le,gL as ke,gM as De,ay as Re,gN as ze,cX as Te,cU as Ae,b1 as Fe,x as ie,gO as Pe,gP as Oe,gQ as Me,Z as ce,gR as $e,gS as Ge}from"./useAppFontEffects-DEX5CMOn.js";import{M as de}from"./vendor-base-ui-CHqK1aDI.js";import{o as oe,a as Ve,h as We,s as He}from"./vendor-zod-B_hXR7jf.js";function zt(){const n=F.c(5),e=$(Ue);let t;n[0]===Symbol.for("react.memo_cache_sentinel")?(t=we(),n[0]=t):t=n[0];const r=t;let s;n[1]!==e?(s=ge(e),n[1]=e,n[2]=s):s=n[2];const l=s;let o;return n[3]!==l?(o={usesFramelessChrome:r,side:l},n[3]=l,n[4]=o):o=n[4],o}function Ue(n){return n.desktopWindowControlsPosition}const Be={close:"#FF5F57",minimize:"#FEBC2E",maximize:"#28C940"},Ye="rgba(0, 0, 0, 0.7)",Ze=n=>{const e=F.c(3),{action:t}=n;if(t==="close"){let s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=a.jsx(T,{name:"close",className:"size-[10px]"}),e[0]=s):s=e[0],s}if(t==="minimize"){let s;return e[1]===Symbol.for("react.memo_cache_sentinel")?(s=a.jsx(T,{name:"subtract",className:"size-[10px]"}),e[1]=s):s=e[1],s}let r;return e[2]===Symbol.for("react.memo_cache_sentinel")?(r=a.jsx(T,{name:"add",className:"size-[10px]"}),e[2]=r):r=e[2],r},Ke=n=>{const e=F.c(18),{action:t,isMaximized:r,onActivate:s}=n,{t:l}=Q(),o=Be[t];let c;e[0]!==t||e[1]!==r||e[2]!==l?(c=l(t==="close"?"header.windowControls.close":t==="minimize"?"header.windowControls.minimize":r?"header.windowControls.restore":"header.windowControls.maximize"),e[0]=t,e[1]=r,e[2]=l,e[3]=c):c=e[3];const p=c;let d;e[4]!==t||e[5]!==s?(d=()=>s(t),e[4]=t,e[5]=s,e[6]=d):d=e[6];let i;e[7]!==o?(i={backgroundColor:o,color:Ye},e[7]=o,e[8]=i):i=e[8];let u;e[9]!==t?(u=a.jsx("span",{className:"flex items-center justify-center opacity-0 transition-opacity duration-75 group-hover/wctl:opacity-100",children:a.jsx(Ze,{action:t})}),e[9]=t,e[10]=u):u=e[10];let m;e[11]!==i||e[12]!==u?(m=a.jsx("span",{className:"flex size-3.5 items-center justify-center rounded-full shadow-[inset_0_0_0_0.5px_rgba(0,0,0,0.28)] transition-[filter] duration-75 active:brightness-90",style:i,children:u}),e[11]=i,e[12]=u,e[13]=m):m=e[13];let h;return e[14]!==p||e[15]!==d||e[16]!==m?(h=a.jsx("button",{type:"button",onClick:d,title:p,"aria-label":p,className:"app-region-no-drag flex h-8 w-[24px] items-center justify-center rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:m}),e[14]=p,e[15]=d,e[16]=m,e[17]=h):h=e[17],h},Tt=P.memo(function(e){const t=F.c(27),{visible:r,position:s}=e,l=s===void 0?"right":s,{t:o}=Q(),[c,p]=P.useState(!1),d=$(qe);let i,u;if(t[0]!==r?(i=()=>{if(!r)return;let y=!1;M("desktop_get_current_window_state").then(D=>{y||p(!!D?.maximized)}).catch(Je);const E=D=>{const x=D.detail;p(!!x?.maximized)};return window.addEventListener("openchamber:window-maximized-changed",E),()=>{y=!0,window.removeEventListener("openchamber:window-maximized-changed",E)}},u=[r],t[0]=r,t[1]=i,t[2]=u):(i=t[1],u=t[2]),he.useEffect(i,u),!r)return null;const m=l==="left";let h,w,f,g,S;if(t[3]!==d||t[4]!==m||t[5]!==c||t[6]!==l||t[7]!==o){S=Symbol.for("react.early_return_sentinel");e:{const y=xe(l);let E;t[13]===Symbol.for("react.memo_cache_sentinel")?(E=_=>{if(_==="close"){M("desktop_close_current_window");return}if(_==="minimize"){M("desktop_minimize_current_window");return}M("desktop_toggle_current_window_maximized").then(b=>p(!!b?.maximized)).catch(Xe)},t[13]=E):E=t[13];const D=E;if(d==="traffic-lights"){const _=m?"me-1":"ms-1 me-3";let b;t[14]!==_?(b=G("app-region-no-drag group/wctl flex h-8 shrink-0 items-center",_),t[14]=_,t[15]=b):b=t[15];let j;t[16]!==o?(j=o("header.windowControls.groupAria"),t[16]=o,t[17]=j):j=t[17];let N;t[18]!==c?(N=C=>a.jsx(Ke,{action:C,isMaximized:c,onActivate:D},C),t[18]=c,t[19]=N):N=t[19],S=a.jsx("div",{dir:"ltr",className:b,"aria-label":j,children:y.map(N)});break e}const x=G("app-region-no-drag inline-flex items-center justify-center text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",m?"h-8 w-8 rounded-md":"h-12 w-11"),k=m?"app-region-no-drag me-1 flex h-8 shrink-0 items-center":"app-region-no-drag ms-1 flex h-12 shrink-0 items-center",R=_=>_==="minimize"?a.jsx("button",{type:"button",className:x,onClick:Qe,title:o("header.windowControls.minimize"),"aria-label":o("header.windowControls.minimize"),children:a.jsx(T,{name:"subtract",className:"h-4 w-4"})},"minimize"):_==="maximize"?a.jsx("button",{type:"button",className:x,onClick:()=>{M("desktop_toggle_current_window_maximized").then(b=>p(!!b?.maximized)).catch(et)},title:o(c?"header.windowControls.restore":"header.windowControls.maximize"),"aria-label":o(c?"header.windowControls.restore":"header.windowControls.maximize"),children:a.jsx(T,{name:c?"fullscreen-exit":"checkbox-blank",className:"h-3.5 w-3.5"})},"maximize"):a.jsx("button",{type:"button",className:G(x,"hover:bg-[var(--status-error)] hover:text-[var(--status-error-foreground)]"),onClick:tt,title:o("header.windowControls.close"),"aria-label":o("header.windowControls.close"),children:a.jsx(T,{name:"close",className:"h-4 w-4"})},"close");h="ltr",w=k,t[20]!==o?(f=o("header.windowControls.groupAria"),t[20]=o,t[21]=f):f=t[21],g=y.map(R)}t[3]=d,t[4]=m,t[5]=c,t[6]=l,t[7]=o,t[8]=h,t[9]=w,t[10]=f,t[11]=g,t[12]=S}else h=t[8],w=t[9],f=t[10],g=t[11],S=t[12];if(S!==Symbol.for("react.early_return_sentinel"))return S;let v;return t[22]!==h||t[23]!==w||t[24]!==f||t[25]!==g?(v=a.jsx("div",{dir:h,className:w,"aria-label":f,children:g}),t[22]=h,t[23]=w,t[24]=f,t[25]=g,t[26]=v):v=t[26],v});function qe(n){return n.desktopWindowControlsStyle}function Je(){}function Xe(){}function Qe(){M("desktop_minimize_current_window")}function et(){}function tt(){M("desktop_close_current_window")}const te="new-session",nt=10;function At(n){const e=F.c(18),{children:t,variant:r,scopeProjectId:s,align:l}=n,o=r===void 0?"default":r,c=s===void 0?null:s,p=l===void 0?"start":l,d=$(it),i=$(st);let u;e[0]!==t?(u=a.jsx(_e,{asChild:!0,children:t}),e[0]=t,e[1]=u):u=e[1];const m=o==="compact"?"w-[280px]":"w-[360px]";let h;e[2]!==m?(h=G("overflow-hidden p-1 max-w-[calc(100vw-32px)]",m),e[2]=m,e[3]=h):h=e[3];let w;e[4]!==d||e[5]!==c||e[6]!==i||e[7]!==o?(w=d?a.jsx(ot,{onSelect:()=>i(!1),variant:o,scopeProjectId:c}):null,e[4]=d,e[5]=c,e[6]=i,e[7]=o,e[8]=w):w=e[8];let f;e[9]!==p||e[10]!==h||e[11]!==w?(f=a.jsx(je,{align:p,sideOffset:6,className:h,children:w}),e[9]=p,e[10]=h,e[11]=w,e[12]=f):f=e[12];let g;return e[13]!==d||e[14]!==i||e[15]!==u||e[16]!==f?(g=a.jsxs(Ne,{open:d,onOpenChange:i,modal:!1,disableGlobalShortcuts:!0,children:[u,f]}),e[13]=d,e[14]=i,e[15]=u,e[16]=f,e[17]=g):g=e[17],g}function st(n){return n.setSessionDropdownOpen}function it(n){return n.isSessionDropdownOpen}function ot(n){const e=F.c(32),{onSelect:t,variant:r,scopeProjectId:s}=n,l=J(ct),o=J(at);let c;e[0]!==l||e[1]!==s?(c={scopeProjectId:s,currentSessionId:l,maxParents:nt,ignorePins:!0},e[0]=l,e[1]=s,e[2]=c):c=e[2];const p=Ee(!0,c);let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=[],e[3]=d):d=e[3],P.useEffect(lt,d);const i=J(rt),{t:u}=Q();let m;e[4]!==t||e[5]!==i?(m=()=>{t(),i()},e[4]=t,e[5]=i,e[6]=m):m=e[6];const h=m;let w;e[7]===Symbol.for("react.memo_cache_sentinel")?(w=new Set,e[7]=w):w=e[7];const[f,g]=P.useState(w),S=P.useRef(null),v=P.useRef(!1),y=o?te:l;let E;e[8]===Symbol.for("react.memo_cache_sentinel")?(E=I=>{g(q=>{const L=new Set(q);return L.has(I)?L.delete(I):L.add(I),L})},e[8]=E):E=e[8];const D=E;let x,k;e[9]!==f||e[10]!==y||e[11]!==p?(x=()=>{if(v.current||!y)return;const I=y===te?[]:Ce(p,y);if(!I)return;if(I.some(L=>!f.has(L))){g(L=>new Set([...L,...I]));return}const q=requestAnimationFrame(()=>{const L=Array.from(S.current?.querySelectorAll("[data-switcher-item-id]")??[]).find(O=>O.dataset.switcherItemId===y);L&&(L.focus(),L.scrollIntoView({block:"nearest"}),v.current=!0)});return()=>cancelAnimationFrame(q)},k=[f,y,p],e[9]=f,e[10]=y,e[11]=p,e[12]=x,e[13]=k):(x=e[12],k=e[13]),P.useLayoutEffect(x,k);let R,_;e[14]===Symbol.for("react.memo_cache_sentinel")?(R=G("group relative flex w-full cursor-pointer items-center gap-2 rounded-lg px-2 py-1.5 outline-hidden select-none","data-[highlighted]:bg-interactive-hover hover:bg-interactive-hover"),_=a.jsx(T,{name:"chat-new",className:"h-4 w-4 flex-shrink-0 text-muted-foreground"}),e[14]=R,e[15]=_):(R=e[14],_=e[15]);let b;e[16]!==u?(b=u("sessions.sidebar.header.actions.newSession"),e[16]=u,e[17]=b):b=e[17];let j;e[18]!==b?(j=a.jsx("span",{className:"truncate typography-ui-label font-normal leading-tight text-foreground",children:b}),e[18]=b,e[19]=j):j=e[19];let N;e[20]!==h||e[21]!==j?(N=a.jsxs(de,{"data-switcher-item-id":te,onClick:h,className:R,children:[_,j]}),e[20]=h,e[21]=j,e[22]=N):N=e[22];let C;e[23]!==f||e[24]!==p||e[25]!==t||e[26]!==u||e[27]!==r?(C=p.length===0?a.jsx("div",{className:"px-3 py-4 text-center typography-meta text-muted-foreground",children:u("sessions.switcher.empty")}):p.map(I=>a.jsx(ue,{item:I,depth:0,variant:r,expandedParents:f,toggleParent:D,closeDropdown:t},I.node.session.id)),e[23]=f,e[24]=p,e[25]=t,e[26]=u,e[27]=r,e[28]=C):C=e[28];let A;return e[29]!==N||e[30]!==C?(A=a.jsx(Ie,{ref:S,outerClassName:"max-h-[60vh]",disableHorizontal:!0,children:a.jsxs("div",{className:"space-y-0.5",children:[N,C]})}),e[29]=N,e[30]=C,e[31]=A):A=e[31],A}function rt(n){return n.openNewSessionDraft}function lt(){ae()}function at(n){return n.newSessionDraft.open===!0}function ct(n){return n.currentSessionId}function ue(n){const e=F.c(31),{item:t,depth:r,variant:s,expandedParents:l,toggleParent:o,closeDropdown:c}=n,{node:p,secondaryMeta:d}=t,i=p.session,u=p.children.length>0;let m;e[0]!==l||e[1]!==i.id?(m=l.has(i.id),e[0]=l,e[1]=i.id,e[2]=m):m=e[2];const h=m;let w;e[3]!==u||e[4]!==i.id||e[5]!==o?(w=u?()=>o(i.id):void 0,e[3]=u,e[4]=i.id,e[5]=o,e[6]=w):w=e[6];let f;e[7]!==c||e[8]!==r||e[9]!==u||e[10]!==h||e[11]!==d||e[12]!==i||e[13]!==w||e[14]!==s?(f=a.jsx(dt,{session:i,depth:r,variant:s,secondaryMeta:d,hasChildren:u,isExpanded:h,onToggleExpand:w,closeDropdown:c}),e[7]=c,e[8]=r,e[9]=u,e[10]=h,e[11]=d,e[12]=i,e[13]=w,e[14]=s,e[15]=f):f=e[15];let g;e[16]!==c||e[17]!==r||e[18]!==l||e[19]!==u||e[20]!==h||e[21]!==t.groupDirectory||e[22]!==t.projectId||e[23]!==p.children||e[24]!==d||e[25]!==o||e[26]!==s?(g=u&&h?p.children.map(v=>a.jsx(ue,{item:{node:v,projectId:t.projectId,groupDirectory:t.groupDirectory,secondaryMeta:d},depth:r+1,variant:s,expandedParents:l,toggleParent:o,closeDropdown:c},v.session.id)):null,e[16]=c,e[17]=r,e[18]=l,e[19]=u,e[20]=h,e[21]=t.groupDirectory,e[22]=t.projectId,e[23]=p.children,e[24]=d,e[25]=o,e[26]=s,e[27]=g):g=e[27];let S;return e[28]!==f||e[29]!==g?(S=a.jsxs(a.Fragment,{children:[f,g]}),e[28]=f,e[29]=g,e[30]=S):S=e[30],S}function dt(n){const e=F.c(59),{session:t,depth:r,variant:s,secondaryMeta:l,hasChildren:o,isExpanded:c,onToggleExpand:p,closeDropdown:d}=n,{t:i}=Q(),u=J(mt),m=J(ut),h=Le(t.id),w=ke(t.id),f=u===t.id;let g;e[0]!==t.title||e[1]!==i?(g=t.title?.trim()||i("sessions.sidebar.session.untitled"),e[0]=t.title,e[1]=i,e[2]=g):g=e[2];const S=g,v=De(t.id),y=v!==null,E=Re(y),D=!y&&h&&(!f||w);let x;if(e[3]!==t){const z=ze(t)||Date.now();x=Te(z),e[3]=t,e[4]=x}else x=e[4];const k=x;let R;e[5]!==l?.projectLabel?(R=l?.projectLabel?.trim()||null,e[5]=l?.projectLabel,e[6]=R):R=e[6];const _=R;let b;e[7]!==l?.branchLabel?(b=l?.branchLabel?.trim()||null,e[7]=l?.branchLabel,e[8]=b):b=e[8];const j=b,N=j&&j!=="HEAD"?j:null;let C;e[9]!==d||e[10]!==f||e[11]!==t||e[12]!==m?(C=()=>{if(f){d();return}const z=Fe(t);m(t.id,z??null),d()},e[9]=d,e[10]=f,e[11]=t,e[12]=m,e[13]=C):C=e[13];const A=C;let I;e[14]!==A?(I=z=>{if(z.target?.closest("[data-switcher-expand]")){z.preventDefault();return}A()},e[14]=A,e[15]=I):I=e[15];const q=t.id,L=f&&"bg-interactive-selection text-interactive-selection-foreground hover:bg-interactive-selection data-[highlighted]:bg-interactive-selection";let O;e[16]!==L?(O=G("group relative flex w-full cursor-pointer items-start gap-2 rounded-lg px-2 py-1.5 outline-hidden select-none","data-[highlighted]:bg-interactive-hover hover:bg-interactive-hover",L),e[16]=L,e[17]=O):O=e[17];const ee=8+r*12;let V;e[18]!==ee?(V={paddingInlineStart:ee},e[18]=ee,e[19]=V):V=e[19];let W;e[20]!==o||e[21]!==c||e[22]!==p||e[23]!==i||e[24]!==s?(W=s==="compact"&&o?a.jsx("span",{role:"button",tabIndex:-1,"data-switcher-expand":!0,onClick:z=>{z.preventDefault(),z.stopPropagation(),p?.()},className:"inline-flex h-3.5 w-3.5 flex-shrink-0 items-center justify-center rounded text-muted-foreground hover:text-foreground","aria-label":i(c?"sessions.sidebar.session.subsessions.collapse":"sessions.sidebar.session.subsessions.expand"),children:c?a.jsx(T,{name:"arrow-down-s",className:"h-3.5 w-3.5"}):a.jsx(T,{name:"arrow-right-s",className:"h-3.5 w-3.5"})}):null,e[20]=o,e[21]=c,e[22]=p,e[23]=i,e[24]=s,e[25]=W):W=e[25];let H;e[26]!==S?(H=a.jsx("span",{dir:"auto",className:"truncate oc-ui-start-align typography-ui-label font-normal leading-tight text-foreground",children:S}),e[26]=S,e[27]=H):H=e[27];let U;e[28]!==W||e[29]!==H?(U=a.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[W,H]}),e[28]=W,e[29]=H,e[30]=U):U=e[30];let B;e[31]!==N||e[32]!==o||e[33]!==c||e[34]!==p||e[35]!==_||e[36]!==i||e[37]!==k||e[38]!==s?(B=s==="default"?a.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 truncate text-muted-foreground leading-tight",style:{fontSize:"calc(var(--text-ui-label) * 0.85)"},children:[o?a.jsx("span",{role:"button",tabIndex:-1,"data-switcher-expand":!0,onClick:z=>{z.preventDefault(),z.stopPropagation(),p?.()},className:"inline-flex h-3 w-3 flex-shrink-0 items-center justify-center rounded text-muted-foreground hover:text-foreground","aria-label":i(c?"sessions.sidebar.session.subsessions.collapse":"sessions.sidebar.session.subsessions.expand"),children:c?a.jsx(T,{name:"arrow-down-s",className:"h-3 w-3"}):a.jsx(T,{name:"arrow-right-s",className:"h-3 w-3"})}):null,a.jsx("span",{className:"flex-shrink-0",children:k}),_?a.jsx("span",{className:"truncate",children:_}):null,N?a.jsxs("span",{className:"inline-flex min-w-0 items-center gap-0.5",children:[a.jsx(T,{name:"git-branch",className:"h-3 w-3 flex-shrink-0 text-muted-foreground"}),a.jsx("span",{className:"truncate",children:N})]}):null]}):null,e[31]=N,e[32]=o,e[33]=c,e[34]=p,e[35]=_,e[36]=i,e[37]=k,e[38]=s,e[39]=B):B=e[39];let Y;e[40]!==U||e[41]!==B?(Y=a.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[U,B]}),e[40]=U,e[41]=B,e[42]=Y):Y=e[42];let Z;e[43]!==y||e[44]!==E||e[45]!==D||e[46]!==v?(Z=y||D?a.jsx("span",{className:"flex h-3 w-3 flex-shrink-0 items-center justify-center self-center",children:a.jsx(Ae,{state:v??"unread",runningClassName:G("h-2 w-2",E)})}):null,e[43]=y,e[44]=E,e[45]=D,e[46]=v,e[47]=Z):Z=e[47];let K;e[48]!==k||e[49]!==s?(K=s==="compact"?a.jsx("span",{className:"shrink-0 self-center typography-micro text-muted-foreground tabular-nums",children:k}):null,e[48]=k,e[49]=s,e[50]=K):K=e[50];let X;return e[51]!==t.id||e[52]!==V||e[53]!==Y||e[54]!==Z||e[55]!==K||e[56]!==I||e[57]!==O?(X=a.jsxs(de,{onClick:I,"data-slot":"session-switcher-item","data-switcher-item-id":q,className:O,style:V,children:[Y,Z,K]}),e[51]=t.id,e[52]=V,e[53]=Y,e[54]=Z,e[55]=K,e[56]=I,e[57]=O,e[58]=X):X=e[58],X}function ut(n){return n.setCurrentSession}function mt(n){return n.currentSessionId}const Ft=n=>!Number.isFinite(n)||n<=0?new Intl.NumberFormat(ie(),{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(0):new Intl.NumberFormat(ie(),{style:"currency",currency:"USD",minimumFractionDigits:n<.01?4:2,maximumFractionDigits:n<.01?4:2}).format(n),ft="ui-store",pt=oe({state:oe({contextSurfaceZones:Ve(He(),We())})}),ht=n=>{if(!n)return null;let e;try{e=JSON.parse(n)}catch{return null}const t=pt.safeParse(e);return t.success?Se.parse(t.data.state.contextSurfaceZones):null},Pt=()=>{const n=e=>{if(e.key!==ft)return;const t=ht(e.newValue);if(!t)return;const r=$.getState().contextSurfaceZones,s=new Set([...Object.keys(r),...Object.keys(t)].filter(be));for(const l of s){const o=ne(t,l);o!==ne($.getState().contextSurfaceZones,l)&&$.getState().moveContextSurfaceToZone(l,o)}};return window.addEventListener("storage",n),()=>window.removeEventListener("storage",n)},wt=10*6e4,re=45e3,gt=[1e3,2e3,4e3],me={isHidden:()=>!1,onVisible:()=>()=>{}},xt=()=>()=>{},bt=()=>()=>{},St=()=>{let n=!1;const e=new Set;return window.addEventListener("openchamber:window-visibility",t=>{if(!(t instanceof CustomEvent)||t.detail!==!0&&t.detail!==!1)return;const r=n;if(n=!t.detail,r&&t.detail)for(const s of e)s()}),{isHidden:()=>n,onVisible:t=>(e.add(t),()=>{e.delete(t)})}};let le=null;const vt=()=>typeof document>"u"?me:ye()?(le??=St(),le):{isHidden:()=>document.visibilityState==="hidden",onVisible:n=>{let e=document.visibilityState==="hidden";const t=()=>{const s=document.visibilityState==="hidden";e&&!s&&n(),e=s},r=()=>{e&&document.visibilityState!=="hidden"&&t()};return document.addEventListener("visibilitychange",t),window.addEventListener("focus",r),()=>{document.removeEventListener("visibilitychange",t),window.removeEventListener("focus",r)}}},yt=(n,e,t=window.setTimeout.bind(window),r=window.clearTimeout.bind(window),s=me,l=xt,o=e,c=Date.now,p=bt)=>{let d=!1,i,u=0,m=!1,h=!1,w=!1,f=!1,g=!1,S=null,v=null,y=Number.NEGATIVE_INFINITY;const E=()=>S??y+wt,D=b=>{i!==void 0&&r(i);const j=b??(m?Math.max(0,Math.min(E(),v??Number.POSITIVE_INFINITY)-c()):re);i=t(()=>{if(i=void 0,!s.isHidden()){if(m&&c()<E()&&v!==null){v=null,x(o,!1);return}x(e)}},j)},x=async(b,j=!0)=>{h=!0,w=!1;const N=await b().catch(()=>!1);if(h=!1,d)return;if(m||=N,j&&N)y=c(),S=null,v=null;else if(N)v=null;else if(m){const A=c()+re;j?S=A:v??=A}if(f){f=!1,g=!1,x(e);return}if(!m&&w){x(e);return}if(g&&m){g=!1,x(o,!1);return}const C=m?void 0:gt[u];C!==void 0&&(u+=1),D(C)},k=s.onVisible(()=>{if(!d){if(i!==void 0&&r(i),i=void 0,h){f=!0;return}x(e)}}),R=l(()=>{if(!(d||m)){if(h){w=!0;return}i!==void 0&&r(i),i=void 0,x(e)}}),_=p(()=>{if(!d){if(h){g=!0;return}m&&x(o,!1)}});return x(n),()=>{d=!0,k(),R(),_(),i!==void 0&&r(i)}},Ot=n=>{const e=F.c(3);let t,r;e[0]!==n?(t=()=>{const s=jt;let l=s();const o=ve(()=>{l(),l=s()});return()=>{o(),l()}},r=[n],e[0]=n,e[1]=t,e[2]=r):(t=e[1],r=e[2]),P.useEffect(t,r)};function _t(){return ce.getState().refreshSessionHead()}function jt(){const n=se();let e=!0;const t=async s=>(s?await Pe(Oe()):await ae(),!e||se()!==n?!1:(Me(),ce.getState().status==="ready")),r=yt(()=>t(!0),()=>t(!1),window.setTimeout.bind(window),window.clearTimeout.bind(window),vt(),s=>Ge(l=>{l===n&&s()}),_t,Date.now,s=>$e(l=>{l===n&&s()}));return()=>{e=!1,r()}}const fe=()=>{const n=[document.documentElement,document.body],e=document.getElementById("root");return e&&n.push(e),n},pe=()=>{let n=!1;for(const e of fe())e.scrollTop!==0&&(e.scrollTop=0,n=!0),e.scrollLeft!==0&&(e.scrollLeft=0,n=!0);return n},Nt=n=>n===document||fe().some(e=>e===n),Mt=()=>{const n=F.c(1);let e;n[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],n[0]=e):e=n[0],P.useEffect(Ct,e)};function Et(n){Nt(n.target)&&pe()}function Ct(){const n=Et;return document.addEventListener("scroll",n,{capture:!0,passive:!0}),pe(),()=>document.removeEventListener("scroll",n,{capture:!0})}export{At as S,Tt as W,Pt as a,Mt as b,Ot as c,Ft as f,zt as u};
|