@yuriai/web 0.2.12-beta.2 → 0.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/assets/{AssistantView-BGwT_cnj.js → AssistantView-DU3Q-GKG.js} +3 -3
  2. package/dist/assets/{DiagramView-DRVSHYyW.js → DiagramView-YnLo2AT2.js} +1 -1
  3. package/dist/assets/{GuiPluginSurface-CXDLKbI2.js → GuiPluginSurface-d2b15A6E.js} +1 -1
  4. package/dist/assets/{GuiPluginWindow-BKPe8p8t.js → GuiPluginWindow-X2qtGb-7.js} +1 -1
  5. package/dist/assets/MarkdownRenderer-Fn6_Gozt.js +2 -0
  6. package/dist/assets/{MarkdownRendererImpl-Do8KAqlC.js → MarkdownRendererImpl-DzjvFzLO.js} +1 -1
  7. package/dist/assets/{MarkstreamRendererImpl-L2-fHtpA.js → MarkstreamRendererImpl-DzM6YvFv.js} +1 -1
  8. package/dist/assets/{MobileDetailNavigation-BtLQo_Rl.js → MobileDetailNavigation-BLTmtkxn.js} +1 -1
  9. package/dist/assets/{MobileShareBridge-B3fVcVe4.js → MobileShareBridge-DmFvN9Yu.js} +1 -1
  10. package/dist/assets/{MobileTabPageHeader-DnIyAEmt.js → MobileTabPageHeader-B_IlXMaq.js} +1 -1
  11. package/dist/assets/{MultiRunWindow-CexoBVhb.js → MultiRunWindow-B-z-Hlxt.js} +1 -1
  12. package/dist/assets/{SettingsView-B1Nn2sIu.js → SettingsView-DZaVLtN_.js} +1 -1
  13. package/dist/assets/{SettingsWindow-DDCNdxmH.js → SettingsWindow-Dk7zBIhW.js} +1 -1
  14. package/dist/assets/{TerminalView-BH93XSrJ.js → TerminalView-BRZXzdsv.js} +1 -1
  15. package/dist/assets/{ToolOutputDialog-fZ_4z7wi.js → ToolOutputDialog-u_nwyfmh.js} +1 -1
  16. package/dist/assets/{appThemeRegistry-PpiWCZgq.js → appThemeRegistry-DQncRaH8.js} +1 -1
  17. package/dist/assets/{capgoAdapter-B9VrK7jw.js → capgoAdapter-oYpF3Iys.js} +1 -1
  18. package/dist/assets/{device-B7GyZCPd.js → device-VqNjblDR.js} +1 -1
  19. package/dist/assets/{dropdown-menu.styles-BfEkQov6.js → dropdown-menu.styles-BneT70Wd.js} +1 -1
  20. package/dist/assets/{fileMentionTouchSelection-C5BslzWG.js → fileMentionTouchSelection-DLB9NaT8.js} +1 -1
  21. package/dist/assets/{gitApi-Q5-lN46d.js → gitApi-DmsP48X9.js} +1 -1
  22. package/dist/assets/insertionBoundaries-CdkyD16g.js +1 -0
  23. package/dist/assets/{main-BejI5g8K.js → main-CizaES-l.js} +6 -6
  24. package/dist/assets/{main-DZFZc2Cz.js → main-DGdMB0a9.js} +2 -2
  25. package/dist/assets/{mcpQueries-DhdyzBPI.js → mcpQueries-D-ACeQhU.js} +1 -1
  26. package/dist/assets/{miniChat-BoLIKdEU.js → miniChat-DFw_Yk31.js} +2 -2
  27. package/dist/assets/{mobile-qUsKQQrt.js → mobile-D-9RyRP2.js} +2 -2
  28. package/dist/assets/{mobileBackNavigation-B_x92p6I.js → mobileBackNavigation-PW9PKRp9.js} +1 -1
  29. package/dist/assets/{multirun-Cs1-2PJ3.js → multirun-CkF_yWhp.js} +1 -1
  30. package/dist/assets/{native-config-Qpfr4t6J.js → native-config-eNF46MQE.js} +1 -1
  31. package/dist/assets/{platform-DXeTzJHG.js → platform-DUe-qtEp.js} +1 -1
  32. package/dist/assets/{projectMeta-BpdNCDci.js → projectMeta-paQJnzSj.js} +1 -1
  33. package/dist/assets/{readiness-BjyrMWQ4.js → readiness-CD8PmDO8.js} +1 -1
  34. package/dist/assets/{renderElectronMiniChatApp-DMuZlrFu.js → renderElectronMiniChatApp-B7G6Pb13.js} +2 -2
  35. package/dist/assets/{renderMobileApp-BiGLm-5i.js → renderMobileApp-Cfw5ds5r.js} +4 -4
  36. package/dist/assets/{runtimeConfig-B25zh-JV.js → runtimeConfig-OWlkIGor.js} +1 -1
  37. package/dist/assets/runtimeEndpointReset-2OM4_xI2.js +149 -0
  38. package/dist/assets/{scheduledTaskNavigation-JfDZws7P.js → scheduledTaskNavigation-fnceJcDf.js} +1 -1
  39. package/dist/assets/{sessionChangeSummary-CnUPwOh6.js → sessionChangeSummary-BsydkEi-.js} +1 -1
  40. package/dist/assets/{sessionLookup-DpKDj2Pl.js → sessionLookup-C4d1itBe.js} +1 -1
  41. package/dist/assets/{sortable-tabs-strip-h-raXfd8.js → sortable-tabs-strip-DR90BVpO.js} +1 -1
  42. package/dist/assets/{speechSettingsQueries-JtXEoFYP.js → speechSettingsQueries-DLQhKWB7.js} +1 -1
  43. package/dist/assets/src-dSUmXLC4.css +2 -0
  44. package/dist/assets/{terminalApi-CIbkfDkE.js → terminalApi-BuoB9-0z.js} +1 -1
  45. package/dist/assets/types-BC9_N4bU.js +2 -0
  46. package/dist/assets/{useAppFontEffects-fKQ6i4QC.js → useAppFontEffects-BR5PcExE.js} +39 -39
  47. package/dist/assets/{useDesktopWindowControlsLayout-aCAOBpZH.js → useDesktopWindowControlsLayout-BXU-GCDJ.js} +1 -1
  48. package/dist/assets/{useEffectiveDirectory-HWABaJoo.js → useEffectiveDirectory-BKQn4QdT.js} +1 -1
  49. package/dist/assets/{useFontPreferences-51P_6ZRi.js → useFontPreferences-B4l7mbDx.js} +1 -1
  50. package/dist/assets/{useMobileNavigationStore-CjljWARe.js → useMobileNavigationStore-DiH8EKl-.js} +4 -4
  51. package/dist/assets/{useWorkerHighlightedLines-DWTiInlP.js → useWorkerHighlightedLines-D5244yEp.js} +1 -1
  52. package/dist/index.html +8 -8
  53. package/dist/mini-chat.html +8 -8
  54. package/dist/mobile.html +8 -8
  55. package/package.json +1 -1
  56. package/server/lib/git/DOCUMENTATION.md +1 -0
  57. package/server/lib/git/routes.js +10 -1
  58. package/server/lib/git/routes.test.js +76 -0
  59. package/dist/assets/MarkdownRenderer-B8xi-szc.js +0 -2
  60. package/dist/assets/insertionBoundaries-ewtT_GYv.js +0 -1
  61. package/dist/assets/runtimeEndpointReset-j5Tq4J9B.js +0 -149
  62. package/dist/assets/src-DZ4-mHgg.css +0 -2
  63. package/dist/assets/types-CM0lXtmR.js +0 -2
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{it as t,rt as n}from"./vendor-base-ui-CdzJ6My_.js";import{v as r}from"./useUIStore-NMQx_cnG.js";import{n as i}from"./vendor-react-BP2cRVqX.js";import{f as a,r as o,t as s}from"./button-DFX-UCuQ.js";import{n as c}from"./useThemeSystem-8jhE4Zyk.js";import{n as l}from"./Icon-C1nXIg7J.js";import{i as u,n as d,t as f}from"./tooltip-Byl6nrXB.js";import{n as p}from"./MarkdownRenderer-B8xi-szc.js";import{n as m,r as h}from"./toolHelpers-DL452NVK.js";import{t as g}from"./vendor-tanstack-react-virtual-B_EO--9t.js";import{n as _}from"./markdownTheme-DHoKvD6O.js";import{n as v,t as y}from"./markdown-worker-oBGEB9Eg.js";var b=e(t(),1),x=i(),S=n(),C=`w-[min(30rem,calc(100cqw-1rem))] min-w-[280px] max-w-full overflow-hidden rounded-xl shadow-[inset_0_1px_0_0_rgba(255,255,255,0.8),inset_0_0_0_1px_rgba(0,0,0,0.04),0_0_0_1px_rgba(0,0,0,0.10),0_1px_2px_-0.5px_rgba(0,0,0,0.08),0_4px_8px_-2px_rgba(0,0,0,0.08),0_12px_20px_-4px_rgba(0,0,0,0.08)] dark:shadow-[inset_0_1px_0_0_rgba(255,255,255,0.12),inset_0_0_0_1px_rgba(255,255,255,0.08),0_0_0_1px_rgba(0,0,0,0.36),0_1px_1px_-0.5px_rgba(0,0,0,0.22),0_3px_3px_-1.5px_rgba(0,0,0,0.20),0_6px_6px_-3px_rgba(0,0,0,0.16)]`,w={maxWidth:`min(28rem, calc(100cqw - 4ch))`,backgroundColor:`var(--surface-elevated)`,color:`var(--surface-elevated-foreground)`},T=`flex items-center justify-between gap-3 border-b border-[var(--surface-subtle)] px-3 py-2.5`,E=`text-xs font-medium leading-4 text-foreground md:text-[0.8125rem] md:leading-5`,D=`text-xs tabular-nums leading-4 text-muted-foreground md:text-[0.8125rem] md:leading-5`,O=`m-0 list-none divide-y divide-[var(--surface-subtle)] p-0`,k=`${O} max-h-[min(22rem,50vh)] overflow-y-auto`,A=`${O} w-full`,ee={className:`p-0 rounded-none`,maxHeightClass:`max-h-[46vh]`,disableHorizontal:!0},j=`px-2.5 py-1.5 text-xs leading-4 md:py-2 md:text-[0.8125rem] md:leading-5`,M=`flex min-w-0 items-center gap-1 text-xs leading-4 text-muted-foreground md:gap-1.5 md:text-[0.8125rem] md:leading-5`,te=`min-w-0 truncate text-xs leading-4 text-foreground md:text-[0.8125rem] md:leading-5`,ne=`inline-flex shrink-0 items-center gap-1 text-xs leading-4 tabular-nums text-muted-foreground md:text-[0.8125rem] md:leading-5`,re=`h-3 w-3 shrink-0 md:h-3.5 md:w-3.5`,ie={in_progress:`text-foreground`,pending:`text-foreground`,completed:`text-muted-foreground line-through`,cancelled:`text-muted-foreground line-through`},ae={in_progress:`chat.statusRow.todo.status.inProgress`,pending:`chat.statusRow.todo.status.pending`,completed:`chat.statusRow.todo.status.completed`,cancelled:`chat.statusRow.todo.status.cancelled`},N=e=>{let t=(0,x.c)(26),{todo:n,isActive:r,activeRef:i}=e,{t:s}=a(),c=oe.has(n.status)?n.status:`pending`,p=ae[c],m;t[0]!==s||t[1]!==p?(m=s(p),t[0]=s,t[1]=p,t[2]=m):m=t[2];let h=m,g;t[3]===c?g=t[4]:(g=c===`in_progress`?(0,S.jsx)(l,{name:`record-circle`,className:`h-3.5 w-3.5 text-[var(--status-info)]`,"aria-hidden":`true`}):c===`completed`?(0,S.jsx)(l,{name:`checkbox-circle`,className:`h-3.5 w-3.5 text-[var(--status-success)]`,"aria-hidden":`true`}):(0,S.jsx)(l,{name:`time`,className:`h-3.5 w-3.5 text-muted-foreground`,"aria-hidden":`true`}),t[3]=c,t[4]=g);let _=g,v=r?`step`:void 0,y=r&&`bg-[var(--surface-muted)] before:absolute before:inset-y-2 before:left-0 before:w-0.5 before:rounded-full before:bg-[var(--status-info)]`,b;t[5]===y?b=t[6]:(b=o(`group relative grid min-w-0 grid-cols-[1rem_minmax(0,1fr)] items-start gap-2.5`,j,y),t[5]=y,t[6]=b);let C;t[7]!==_||t[8]!==h?(C=(0,S.jsx)(u,{asChild:!0,children:(0,S.jsx)(`span`,{className:`flex size-4 items-center justify-center`,"aria-label":h,children:_})}),t[7]=_,t[8]=h,t[9]=C):C=t[9];let w;t[10]===h?w=t[11]:(w=(0,S.jsx)(d,{side:`left`,sideOffset:6,children:h}),t[10]=h,t[11]=w);let T;t[12]!==C||t[13]!==w?(T=(0,S.jsxs)(f,{children:[C,w]}),t[12]=C,t[13]=w,t[14]=T):T=t[14];let E=ie[c],D;t[15]===E?D=t[16]:(D=o(`block whitespace-normal break-words`,E),t[15]=E,t[16]=D);let O;t[17]!==D||t[18]!==n.content?(O=(0,S.jsx)(`span`,{className:`min-w-0 flex-1`,children:(0,S.jsx)(`span`,{className:D,children:n.content})}),t[17]=D,t[18]=n.content,t[19]=O):O=t[19];let k;return t[20]!==i||t[21]!==O||t[22]!==v||t[23]!==b||t[24]!==T?(k=(0,S.jsxs)(`li`,{ref:i,"aria-current":v,className:b,children:[T,O]}),t[20]=i,t[21]=O,t[22]=v,t[23]=b,t[24]=T,t[25]=k):k=t[25],k},oe=new Set([`in_progress`,`pending`,`completed`,`cancelled`]),P=e=>e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`),F=e=>e?Object.entries(e).map(([e,t])=>t==null?``:`${e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}:${typeof t==`number`?`${t}px`:t};`).join(``):``,I=(e,t,n)=>{let r=e.querySelector(`pre`);r&&(r.style.margin=`0`,r.style.background=`transparent`,r.style.whiteSpace=t?`pre-wrap`:`pre`,t&&(r.style.wordBreak=`break-word`,r.style.overflowWrap=`break-word`));let i=e.querySelector(`code`);if(i){let e=F(n);e&&i.setAttribute(`style`,`${i.getAttribute(`style`)??``}${e}`)}},L=e=>`<pre><code>${P(e)}</code></pre>`,R=e=>{let t=(0,x.c)(21),{code:n,language:r,className:i,style:a,codeStyle:s,wrap:l}=e,u=l!==void 0&&l,{currentTheme:d}=c(),f=b.useRef(null),p;t[0]===d?p=t[1]:(p=_(d),t[0]=d,t[1]=p);let m=p,h,g;t[2]!==n||t[3]!==s||t[4]!==u?(h=()=>{let e=f.current;e&&(e.innerHTML=L(n),I(e,u,s))},g=[n,u,s],t[2]=n,t[3]=s,t[4]=u,t[5]=h,t[6]=g):(h=t[5],g=t[6]),b.useLayoutEffect(h,g);let v,C;t[7]!==n||t[8]!==s||t[9]!==r||t[10]!==u?(v=()=>{let e=f.current;if(!e)return;let t=!0,i=new AbortController;return y(n,(r||`text`).toLowerCase(),{signal:i.signal,priority:`visible`}).then(n=>{!t||!e||!n||(e.innerHTML=n,I(e,u,s))}),()=>{t=!1,i.abort()}},C=[n,r,u,s],t[7]=n,t[8]=s,t[9]=r,t[10]=u,t[11]=v,t[12]=C):(v=t[11],C=t[12]),b.useEffect(v,C);let w;t[13]===i?w=t[14]:(w=o(`typography-code`,i),t[13]=i,t[14]=w);let T=m,E;t[15]!==a||t[16]!==T?(E={...T,...a},t[15]=a,t[16]=T,t[17]=E):E=t[17];let D;return t[18]!==w||t[19]!==E?(D=(0,S.jsx)(`div`,{ref:f,className:w,style:E}),t[18]=w,t[19]=E,t[20]=D):D=t[20],D},z=e=>{let t=e.replace(/^<file>\s*\n?/,``).replace(/\n?<\/file>\s*$/,``);return t=t.replace(/^\s*\d{5}\|\s?/gm,``),t.trim()},B=(e,t=``)=>{if(typeof e==`string`)return e;if(e==null)return t;if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)return String(e);try{return JSON.stringify(e)}catch{return t}},V=e=>e?e.includes(`<diagnostics`)||e.includes(`<file_diagnostics>`)||e.includes(`LSP errors detected`)||e.includes(`This file has errors`):!1,H=e=>e?e.replace(/\n{0,2}LSP errors detected[\s\S]*?<diagnostics[^>]*>[\s\S]*?<\/diagnostics>/g,``).replace(/\n{0,2}This file has errors[\s\S]*?<\/file_diagnostics>/g,``).replace(/<diagnostics[^>]*>[\s\S]*?<\/diagnostics>/g,``).replace(/<file_diagnostics>[\s\S]*?<\/file_diagnostics>/g,``).trim():``,U=(e,t)=>!e||typeof e!=`object`?String(e):h(e,t||``),W=e=>{if(typeof e==`string`){let t=e.trim();return t.length>0?t:void 0}if(e&&typeof e==`object`){let t=e.patch;if(typeof t==`string`){let e=t.trim();return e.length>0?e:void 0}}},G=e=>{if(!e||typeof e!=`object`)return;let t=W(e.patch)??W(e.diff);if(t)return t;let n=Array.isArray(e.files)?e.files:[];for(let e of n){if(!e||typeof e!=`object`)continue;let t=W(e.patch)??W(e.diff);if(t)return t}},K=e=>{if(!e||typeof e!=`string`)return{data:null,isJson:!1};let t=e.trim();if(!t.startsWith(`{`)&&!t.startsWith(`[`)||!t.endsWith(`}`)&&!t.endsWith(`]`)||t.length<2)return{data:null,isJson:!1};try{let e=JSON.parse(t);return typeof e==`object`&&e?{data:e,isJson:!0}:{data:null,isJson:!1}}catch{return{data:null,isJson:!1}}},q=(e,t,n)=>{let r=z(e);if((t===`edit`||t===`multiedit`||t===`write`||t===`apply_patch`)&&V(r)&&(r=H(r)),(t===`edit`||t===`multiedit`||t===`apply_patch`)&&r.trim().length===0){let e=G(n);if(e)return e}return r},se=e=>{let t=e.match(/<type>(file|directory)<\/type>/i)?.[1]?.toLowerCase()??`unknown`,n=(e.match(/<content>([\s\S]*?)<\/content>/i)?.[1]??e).replace(/\r\n/g,`
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{it as t,rt as n}from"./vendor-base-ui-CdzJ6My_.js";import{v as r}from"./useUIStore-NMQx_cnG.js";import{n as i}from"./vendor-react-BP2cRVqX.js";import{f as a,r as o,t as s}from"./button-DFX-UCuQ.js";import{n as c}from"./useThemeSystem-8jhE4Zyk.js";import{n as l}from"./Icon-C1nXIg7J.js";import{i as u,n as d,t as f}from"./tooltip-Byl6nrXB.js";import{n as p}from"./MarkdownRenderer-Fn6_Gozt.js";import{n as m,r as h}from"./toolHelpers-DL452NVK.js";import{t as g}from"./vendor-tanstack-react-virtual-B_EO--9t.js";import{n as _}from"./markdownTheme-DHoKvD6O.js";import{n as v,t as y}from"./markdown-worker-oBGEB9Eg.js";var b=e(t(),1),x=i(),S=n(),C=`w-[min(30rem,calc(100cqw-1rem))] min-w-[280px] max-w-full overflow-hidden rounded-xl shadow-[inset_0_1px_0_0_rgba(255,255,255,0.8),inset_0_0_0_1px_rgba(0,0,0,0.04),0_0_0_1px_rgba(0,0,0,0.10),0_1px_2px_-0.5px_rgba(0,0,0,0.08),0_4px_8px_-2px_rgba(0,0,0,0.08),0_12px_20px_-4px_rgba(0,0,0,0.08)] dark:shadow-[inset_0_1px_0_0_rgba(255,255,255,0.12),inset_0_0_0_1px_rgba(255,255,255,0.08),0_0_0_1px_rgba(0,0,0,0.36),0_1px_1px_-0.5px_rgba(0,0,0,0.22),0_3px_3px_-1.5px_rgba(0,0,0,0.20),0_6px_6px_-3px_rgba(0,0,0,0.16)]`,w={maxWidth:`min(28rem, calc(100cqw - 4ch))`,backgroundColor:`var(--surface-elevated)`,color:`var(--surface-elevated-foreground)`},T=`flex items-center justify-between gap-3 border-b border-[var(--surface-subtle)] px-3 py-2.5`,E=`text-xs font-medium leading-4 text-foreground md:text-[0.8125rem] md:leading-5`,D=`text-xs tabular-nums leading-4 text-muted-foreground md:text-[0.8125rem] md:leading-5`,O=`m-0 list-none divide-y divide-[var(--surface-subtle)] p-0`,k=`${O} max-h-[min(22rem,50vh)] overflow-y-auto`,A=`${O} w-full`,ee={className:`p-0 rounded-none`,maxHeightClass:`max-h-[46vh]`,disableHorizontal:!0},j=`px-2.5 py-1.5 text-xs leading-4 md:py-2 md:text-[0.8125rem] md:leading-5`,M=`flex min-w-0 items-center gap-1 text-xs leading-4 text-muted-foreground md:gap-1.5 md:text-[0.8125rem] md:leading-5`,te=`min-w-0 truncate text-xs leading-4 text-foreground md:text-[0.8125rem] md:leading-5`,ne=`inline-flex shrink-0 items-center gap-1 text-xs leading-4 tabular-nums text-muted-foreground md:text-[0.8125rem] md:leading-5`,re=`h-3 w-3 shrink-0 md:h-3.5 md:w-3.5`,ie={in_progress:`text-foreground`,pending:`text-foreground`,completed:`text-muted-foreground line-through`,cancelled:`text-muted-foreground line-through`},ae={in_progress:`chat.statusRow.todo.status.inProgress`,pending:`chat.statusRow.todo.status.pending`,completed:`chat.statusRow.todo.status.completed`,cancelled:`chat.statusRow.todo.status.cancelled`},N=e=>{let t=(0,x.c)(26),{todo:n,isActive:r,activeRef:i}=e,{t:s}=a(),c=oe.has(n.status)?n.status:`pending`,p=ae[c],m;t[0]!==s||t[1]!==p?(m=s(p),t[0]=s,t[1]=p,t[2]=m):m=t[2];let h=m,g;t[3]===c?g=t[4]:(g=c===`in_progress`?(0,S.jsx)(l,{name:`record-circle`,className:`h-3.5 w-3.5 text-[var(--status-info)]`,"aria-hidden":`true`}):c===`completed`?(0,S.jsx)(l,{name:`checkbox-circle`,className:`h-3.5 w-3.5 text-[var(--status-success)]`,"aria-hidden":`true`}):(0,S.jsx)(l,{name:`time`,className:`h-3.5 w-3.5 text-muted-foreground`,"aria-hidden":`true`}),t[3]=c,t[4]=g);let _=g,v=r?`step`:void 0,y=r&&`bg-[var(--surface-muted)] before:absolute before:inset-y-2 before:left-0 before:w-0.5 before:rounded-full before:bg-[var(--status-info)]`,b;t[5]===y?b=t[6]:(b=o(`group relative grid min-w-0 grid-cols-[1rem_minmax(0,1fr)] items-start gap-2.5`,j,y),t[5]=y,t[6]=b);let C;t[7]!==_||t[8]!==h?(C=(0,S.jsx)(u,{asChild:!0,children:(0,S.jsx)(`span`,{className:`flex size-4 items-center justify-center`,"aria-label":h,children:_})}),t[7]=_,t[8]=h,t[9]=C):C=t[9];let w;t[10]===h?w=t[11]:(w=(0,S.jsx)(d,{side:`left`,sideOffset:6,children:h}),t[10]=h,t[11]=w);let T;t[12]!==C||t[13]!==w?(T=(0,S.jsxs)(f,{children:[C,w]}),t[12]=C,t[13]=w,t[14]=T):T=t[14];let E=ie[c],D;t[15]===E?D=t[16]:(D=o(`block whitespace-normal break-words`,E),t[15]=E,t[16]=D);let O;t[17]!==D||t[18]!==n.content?(O=(0,S.jsx)(`span`,{className:`min-w-0 flex-1`,children:(0,S.jsx)(`span`,{className:D,children:n.content})}),t[17]=D,t[18]=n.content,t[19]=O):O=t[19];let k;return t[20]!==i||t[21]!==O||t[22]!==v||t[23]!==b||t[24]!==T?(k=(0,S.jsxs)(`li`,{ref:i,"aria-current":v,className:b,children:[T,O]}),t[20]=i,t[21]=O,t[22]=v,t[23]=b,t[24]=T,t[25]=k):k=t[25],k},oe=new Set([`in_progress`,`pending`,`completed`,`cancelled`]),P=e=>e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`),F=e=>e?Object.entries(e).map(([e,t])=>t==null?``:`${e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}:${typeof t==`number`?`${t}px`:t};`).join(``):``,I=(e,t,n)=>{let r=e.querySelector(`pre`);r&&(r.style.margin=`0`,r.style.background=`transparent`,r.style.whiteSpace=t?`pre-wrap`:`pre`,t&&(r.style.wordBreak=`break-word`,r.style.overflowWrap=`break-word`));let i=e.querySelector(`code`);if(i){let e=F(n);e&&i.setAttribute(`style`,`${i.getAttribute(`style`)??``}${e}`)}},L=e=>`<pre><code>${P(e)}</code></pre>`,R=e=>{let t=(0,x.c)(21),{code:n,language:r,className:i,style:a,codeStyle:s,wrap:l}=e,u=l!==void 0&&l,{currentTheme:d}=c(),f=b.useRef(null),p;t[0]===d?p=t[1]:(p=_(d),t[0]=d,t[1]=p);let m=p,h,g;t[2]!==n||t[3]!==s||t[4]!==u?(h=()=>{let e=f.current;e&&(e.innerHTML=L(n),I(e,u,s))},g=[n,u,s],t[2]=n,t[3]=s,t[4]=u,t[5]=h,t[6]=g):(h=t[5],g=t[6]),b.useLayoutEffect(h,g);let v,C;t[7]!==n||t[8]!==s||t[9]!==r||t[10]!==u?(v=()=>{let e=f.current;if(!e)return;let t=!0,i=new AbortController;return y(n,(r||`text`).toLowerCase(),{signal:i.signal,priority:`visible`}).then(n=>{!t||!e||!n||(e.innerHTML=n,I(e,u,s))}),()=>{t=!1,i.abort()}},C=[n,r,u,s],t[7]=n,t[8]=s,t[9]=r,t[10]=u,t[11]=v,t[12]=C):(v=t[11],C=t[12]),b.useEffect(v,C);let w;t[13]===i?w=t[14]:(w=o(`typography-code`,i),t[13]=i,t[14]=w);let T=m,E;t[15]!==a||t[16]!==T?(E={...T,...a},t[15]=a,t[16]=T,t[17]=E):E=t[17];let D;return t[18]!==w||t[19]!==E?(D=(0,S.jsx)(`div`,{ref:f,className:w,style:E}),t[18]=w,t[19]=E,t[20]=D):D=t[20],D},z=e=>{let t=e.replace(/^<file>\s*\n?/,``).replace(/\n?<\/file>\s*$/,``);return t=t.replace(/^\s*\d{5}\|\s?/gm,``),t.trim()},B=(e,t=``)=>{if(typeof e==`string`)return e;if(e==null)return t;if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)return String(e);try{return JSON.stringify(e)}catch{return t}},V=e=>e?e.includes(`<diagnostics`)||e.includes(`<file_diagnostics>`)||e.includes(`LSP errors detected`)||e.includes(`This file has errors`):!1,H=e=>e?e.replace(/\n{0,2}LSP errors detected[\s\S]*?<diagnostics[^>]*>[\s\S]*?<\/diagnostics>/g,``).replace(/\n{0,2}This file has errors[\s\S]*?<\/file_diagnostics>/g,``).replace(/<diagnostics[^>]*>[\s\S]*?<\/diagnostics>/g,``).replace(/<file_diagnostics>[\s\S]*?<\/file_diagnostics>/g,``).trim():``,U=(e,t)=>!e||typeof e!=`object`?String(e):h(e,t||``),W=e=>{if(typeof e==`string`){let t=e.trim();return t.length>0?t:void 0}if(e&&typeof e==`object`){let t=e.patch;if(typeof t==`string`){let e=t.trim();return e.length>0?e:void 0}}},G=e=>{if(!e||typeof e!=`object`)return;let t=W(e.patch)??W(e.diff);if(t)return t;let n=Array.isArray(e.files)?e.files:[];for(let e of n){if(!e||typeof e!=`object`)continue;let t=W(e.patch)??W(e.diff);if(t)return t}},K=e=>{if(!e||typeof e!=`string`)return{data:null,isJson:!1};let t=e.trim();if(!t.startsWith(`{`)&&!t.startsWith(`[`)||!t.endsWith(`}`)&&!t.endsWith(`]`)||t.length<2)return{data:null,isJson:!1};try{let e=JSON.parse(t);return typeof e==`object`&&e?{data:e,isJson:!0}:{data:null,isJson:!1}}catch{return{data:null,isJson:!1}}},q=(e,t,n)=>{let r=z(e);if((t===`edit`||t===`multiedit`||t===`write`||t===`apply_patch`)&&V(r)&&(r=H(r)),(t===`edit`||t===`multiedit`||t===`apply_patch`)&&r.trim().length===0){let e=G(n);if(e)return e}return r},se=e=>{let t=e.match(/<type>(file|directory)<\/type>/i)?.[1]?.toLowerCase()??`unknown`,n=(e.match(/<content>([\s\S]*?)<\/content>/i)?.[1]??e).replace(/\r\n/g,`
2
2
  `).split(`
3
3
  `),r=e=>/\(\s*File has more lines\..*offset.*\)/i.test(e.trim());return{type:t,lines:n.map(e=>{let n=e.trim(),i=n.startsWith(`(`)&&n.endsWith(`)`)||r(n);if(t!==`directory`){let t=e.match(/^(\d+):\s?(.*)$/);if(t){let e=t[2],n=e.trim(),i=n.startsWith(`(`)&&n.endsWith(`)`)||r(n);return{lineNumber:i?null:Number(t[1]),text:e,isInfo:i}}}return{lineNumber:null,text:e,isInfo:i}}).filter((e,t,n)=>{if(e.text.trim().length>0)return!0;let r=n[t-1],i=n[t+1],a=!!(r?.isInfo||i?.isInfo),o=e.lineNumber!==null;return!(a&&o)})}},ce=(e,t)=>{try{let n=e.trim().split(`
4
4
  `).filter(Boolean);if(n.length===0)return null;let i=[];return n.forEach(e=>{let t=e.match(/^(\s*)(.+)$/);if(t){let[,e,n]=t,r=Math.floor(e.length/2),a=!n.endsWith(`/`);i.push({name:n.replace(/\/$/,``),depth:r,isFile:a})}}),(0,S.jsx)(`div`,{className:o(`w-full min-w-0 font-mono space-y-0.5`,t?.unstyled?null:`p-3 bg-muted/20 rounded-xl border border-border/30`),style:r.tool.popup,children:i.map((e,t)=>(0,S.jsx)(`div`,{className:`min-w-0`,style:{paddingLeft:`${e.depth*20}px`},children:e.isFile?(0,S.jsx)(`span`,{className:`text-foreground/90 block truncate`,children:e.name}):(0,S.jsxs)(`span`,{className:`font-semibold text-foreground block truncate`,children:[e.name,`/`]})},t))})}catch{return null}},le={backgroundColor:`var(--status-info)`,opacity:.6},ue=(e,t,n)=>{try{let i=e.trim().split(`
package/dist/index.html CHANGED
@@ -560,7 +560,7 @@
560
560
  opacity: 0.72;
561
561
  }
562
562
  </style>
563
- <script type="module" crossorigin src="/assets/main-DZFZc2Cz.js"></script>
563
+ <script type="module" crossorigin src="/assets/main-DGdMB0a9.js"></script>
564
564
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
565
565
  <link rel="modulepreload" crossorigin href="/assets/runtime-auth-ef9W7A43.js">
566
566
  <link rel="modulepreload" crossorigin href="/assets/runtime-switch-CAZiOV2G.js">
@@ -588,14 +588,14 @@
588
588
  <link rel="modulepreload" crossorigin href="/assets/path-utils-jGozTg9d.js">
589
589
  <link rel="modulepreload" crossorigin href="/assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js">
590
590
  <link rel="modulepreload" crossorigin href="/assets/runtime-file-resource-D3k0hKDj.js">
591
- <link rel="modulepreload" crossorigin href="/assets/platform-DXeTzJHG.js">
592
- <link rel="modulepreload" crossorigin href="/assets/terminalApi-CIbkfDkE.js">
591
+ <link rel="modulepreload" crossorigin href="/assets/platform-DUe-qtEp.js">
592
+ <link rel="modulepreload" crossorigin href="/assets/terminalApi-BuoB9-0z.js">
593
593
  <link rel="modulepreload" crossorigin href="/assets/runtime-file-download-BzblfnMx.js">
594
- <link rel="modulepreload" crossorigin href="/assets/types-CM0lXtmR.js">
595
- <link rel="modulepreload" crossorigin href="/assets/capgoAdapter-B9VrK7jw.js">
596
- <link rel="modulepreload" crossorigin href="/assets/native-config-Qpfr4t6J.js">
597
- <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-B25zh-JV.js">
598
- <link rel="stylesheet" crossorigin href="/assets/src-DZ4-mHgg.css">
594
+ <link rel="modulepreload" crossorigin href="/assets/types-BC9_N4bU.js">
595
+ <link rel="modulepreload" crossorigin href="/assets/capgoAdapter-oYpF3Iys.js">
596
+ <link rel="modulepreload" crossorigin href="/assets/native-config-eNF46MQE.js">
597
+ <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-OWlkIGor.js">
598
+ <link rel="stylesheet" crossorigin href="/assets/src-dSUmXLC4.css">
599
599
  </head>
600
600
  <body class="h-full bg-background text-foreground">
601
601
  <!-- Keep the startup layer outside #root. React replaces every child of
@@ -77,7 +77,7 @@
77
77
  .dark #initial-loading img { filter: invert(1); }
78
78
  </style>
79
79
 
80
- <script type="module" crossorigin src="/assets/miniChat-BoLIKdEU.js"></script>
80
+ <script type="module" crossorigin src="/assets/miniChat-DFw_Yk31.js"></script>
81
81
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
82
82
  <link rel="modulepreload" crossorigin href="/assets/runtime-auth-ef9W7A43.js">
83
83
  <link rel="modulepreload" crossorigin href="/assets/runtime-switch-CAZiOV2G.js">
@@ -105,14 +105,14 @@
105
105
  <link rel="modulepreload" crossorigin href="/assets/path-utils-jGozTg9d.js">
106
106
  <link rel="modulepreload" crossorigin href="/assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js">
107
107
  <link rel="modulepreload" crossorigin href="/assets/runtime-file-resource-D3k0hKDj.js">
108
- <link rel="modulepreload" crossorigin href="/assets/platform-DXeTzJHG.js">
109
- <link rel="modulepreload" crossorigin href="/assets/terminalApi-CIbkfDkE.js">
108
+ <link rel="modulepreload" crossorigin href="/assets/platform-DUe-qtEp.js">
109
+ <link rel="modulepreload" crossorigin href="/assets/terminalApi-BuoB9-0z.js">
110
110
  <link rel="modulepreload" crossorigin href="/assets/runtime-file-download-BzblfnMx.js">
111
- <link rel="modulepreload" crossorigin href="/assets/types-CM0lXtmR.js">
112
- <link rel="modulepreload" crossorigin href="/assets/capgoAdapter-B9VrK7jw.js">
113
- <link rel="modulepreload" crossorigin href="/assets/native-config-Qpfr4t6J.js">
114
- <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-B25zh-JV.js">
115
- <link rel="stylesheet" crossorigin href="/assets/src-DZ4-mHgg.css">
111
+ <link rel="modulepreload" crossorigin href="/assets/types-BC9_N4bU.js">
112
+ <link rel="modulepreload" crossorigin href="/assets/capgoAdapter-oYpF3Iys.js">
113
+ <link rel="modulepreload" crossorigin href="/assets/native-config-eNF46MQE.js">
114
+ <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-OWlkIGor.js">
115
+ <link rel="stylesheet" crossorigin href="/assets/src-dSUmXLC4.css">
116
116
  </head>
117
117
  <body class="h-full bg-background text-foreground">
118
118
  <div id="root" class="h-full">
package/dist/mobile.html CHANGED
@@ -64,7 +64,7 @@
64
64
  </script>
65
65
 
66
66
  <style>.dark #mobile-startup-logo img { filter: invert(1); }</style>
67
- <script type="module" crossorigin src="/assets/mobile-qUsKQQrt.js"></script>
67
+ <script type="module" crossorigin src="/assets/mobile-D-9RyRP2.js"></script>
68
68
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
69
69
  <link rel="modulepreload" crossorigin href="/assets/runtime-auth-ef9W7A43.js">
70
70
  <link rel="modulepreload" crossorigin href="/assets/runtime-switch-CAZiOV2G.js">
@@ -92,14 +92,14 @@
92
92
  <link rel="modulepreload" crossorigin href="/assets/path-utils-jGozTg9d.js">
93
93
  <link rel="modulepreload" crossorigin href="/assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js">
94
94
  <link rel="modulepreload" crossorigin href="/assets/runtime-file-resource-D3k0hKDj.js">
95
- <link rel="modulepreload" crossorigin href="/assets/platform-DXeTzJHG.js">
96
- <link rel="modulepreload" crossorigin href="/assets/terminalApi-CIbkfDkE.js">
95
+ <link rel="modulepreload" crossorigin href="/assets/platform-DUe-qtEp.js">
96
+ <link rel="modulepreload" crossorigin href="/assets/terminalApi-BuoB9-0z.js">
97
97
  <link rel="modulepreload" crossorigin href="/assets/runtime-file-download-BzblfnMx.js">
98
- <link rel="modulepreload" crossorigin href="/assets/types-CM0lXtmR.js">
99
- <link rel="modulepreload" crossorigin href="/assets/capgoAdapter-B9VrK7jw.js">
100
- <link rel="modulepreload" crossorigin href="/assets/native-config-Qpfr4t6J.js">
101
- <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-B25zh-JV.js">
102
- <link rel="stylesheet" crossorigin href="/assets/src-DZ4-mHgg.css">
98
+ <link rel="modulepreload" crossorigin href="/assets/types-BC9_N4bU.js">
99
+ <link rel="modulepreload" crossorigin href="/assets/capgoAdapter-oYpF3Iys.js">
100
+ <link rel="modulepreload" crossorigin href="/assets/native-config-eNF46MQE.js">
101
+ <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-OWlkIGor.js">
102
+ <link rel="stylesheet" crossorigin href="/assets/src-dSUmXLC4.css">
103
103
  </head>
104
104
  <body class="h-full bg-background text-foreground">
105
105
  <div id="root" class="h-full">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuriai/web",
3
- "version": "0.2.12-beta.2",
3
+ "version": "0.2.12",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./server/index.js",
@@ -116,6 +116,7 @@ The following functions are internal helpers used by exported functions:
116
116
  - `diffStats`: Object mapping file paths to `{ insertions, deletions }`. Omitted by light mode and by oversized change sets.
117
117
  - `mergeInProgress`: Object with `{ head, message }` if merge in progress.
118
118
  - `rebaseInProgress`: Object with `{ headName, onto }` if rebase in progress.
119
+ - `revision`: `/api/git/status` only. Content revision `<light|full>:<sha1 base64url>` of the serialized status for that mode. Clients may echo it as `?since=<revision>`; when the freshly computed snapshot has the same revision the route answers `{ unchanged: true, revision }` without the file list. `getStatus` is still executed on every request, so `unchanged` is authoritative for current state. The shared HTTP client keeps the last snapshot per directory/mode, bound to transport identity and its invalidation version, and drops it on any local mutation. The VS Code runtime computes status in the extension host and never uses this field.
119
120
 
120
121
  ### Staged and unstaged change handling
121
122
  - `status.files` exposes both `index` and `working_dir` codes. Shared UI uses these as separate scopes: staged rows are derived from non-empty `index` statuses, while unstaged rows are derived from `working_dir` statuses and untracked files.
@@ -1,3 +1,5 @@
1
+ import { createHash } from 'node:crypto';
2
+
1
3
  export function registerGitRoutes(app, { messageQueueService = null, createRequestID = () => globalThis.crypto.randomUUID(), broadcastWorktreeTopologyChanged = () => {}, releaseWorktreeLocation } = {}) {
2
4
  const normalizeWorktreePath = (value) => typeof value === 'string' ? value.trim().replace(/\\/g, '/').replace(/\/+$/, '') : '';
3
5
  const lifecycleOperations = new Map();
@@ -250,7 +252,14 @@ export function registerGitRoutes(app, { messageQueueService = null, createReque
250
252
 
251
253
  const mode = req.query.mode === 'light' ? 'light' : undefined;
252
254
  const status = await getStatus(directory, { mode });
253
- res.json(status);
255
+ // Content revision: clients echo it as `since`; an identical snapshot is
256
+ // answered without re-sending (and re-parsing) the full file list.
257
+ const serialized = JSON.stringify(status);
258
+ const revision = `${mode ?? 'full'}:${createHash('sha1').update(serialized).digest('base64url')}`;
259
+ if (typeof req.query.since === 'string' && req.query.since === revision) {
260
+ return res.json({ unchanged: true, revision });
261
+ }
262
+ res.json({ ...status, revision });
254
263
  } catch (error) {
255
264
  const errorText = extractGitErrorText(error);
256
265
  if (/not a git repository/i.test(errorText)) {
@@ -8,6 +8,7 @@ const gitLibraries = {
8
8
  getWorktrees: vi.fn(),
9
9
  isGitRepository: vi.fn(),
10
10
  resolvePrimaryWorktreeRoot: vi.fn(),
11
+ getStatus: vi.fn(),
11
12
  };
12
13
 
13
14
  vi.mock('./index.js', () => ({
@@ -18,6 +19,7 @@ vi.mock('./index.js', () => ({
18
19
  getWorktrees: gitLibraries.getWorktrees,
19
20
  isGitRepository: gitLibraries.isGitRepository,
20
21
  resolvePrimaryWorktreeRoot: gitLibraries.resolvePrimaryWorktreeRoot,
22
+ getStatus: gitLibraries.getStatus,
21
23
  }));
22
24
 
23
25
  const { registerGitRoutes } = await import('./routes.js');
@@ -205,6 +207,80 @@ describe('git routes batch discover', () => {
205
207
  });
206
208
  });
207
209
 
210
+ describe('git routes status revision', () => {
211
+ const statusPayload = (overrides = {}) => ({
212
+ current: 'main',
213
+ tracking: null,
214
+ ahead: 0,
215
+ behind: 0,
216
+ files: [{ path: 'a.ts', index: ' ', working_dir: 'M' }],
217
+ isClean: false,
218
+ oversized: false,
219
+ ...overrides,
220
+ });
221
+
222
+ beforeEach(() => {
223
+ gitLibraries.isGitRepository.mockReset();
224
+ gitLibraries.getStatus.mockReset();
225
+ gitLibraries.isGitRepository.mockResolvedValue(true);
226
+ });
227
+
228
+ const requestStatus = async (query) => {
229
+ const { app, getRoute } = createRouteRegistry();
230
+ registerGitRoutes(app);
231
+ const response = createMockResponse();
232
+ await getRoute('GET', '/api/git/status')({ query: { directory: '/repo', ...query } }, response);
233
+ return response;
234
+ };
235
+
236
+ it('returns the full status with a stable content revision', async () => {
237
+ gitLibraries.getStatus.mockResolvedValue(statusPayload());
238
+ const first = await requestStatus();
239
+ const second = await requestStatus();
240
+
241
+ expect(first.statusCode).toBe(200);
242
+ expect(first.body).toMatchObject(statusPayload());
243
+ expect(typeof first.body.revision).toBe('string');
244
+ expect(first.body.revision.length).toBeGreaterThan(0);
245
+ expect(second.body.revision).toBe(first.body.revision);
246
+ });
247
+
248
+ it('answers unchanged without the file list when the client revision matches', async () => {
249
+ gitLibraries.getStatus.mockResolvedValue(statusPayload());
250
+ const { body: full } = await requestStatus();
251
+
252
+ const response = await requestStatus({ since: full.revision });
253
+
254
+ expect(response.statusCode).toBe(200);
255
+ expect(response.body).toEqual({ unchanged: true, revision: full.revision });
256
+ });
257
+
258
+ it('returns the full status when content changed since the client revision', async () => {
259
+ gitLibraries.getStatus.mockResolvedValueOnce(statusPayload());
260
+ const { body: full } = await requestStatus();
261
+ const changed = statusPayload({ files: [{ path: 'a.ts', index: 'M', working_dir: ' ' }] });
262
+ gitLibraries.getStatus.mockResolvedValueOnce(changed);
263
+
264
+ const response = await requestStatus({ since: full.revision });
265
+
266
+ expect(response.body).toMatchObject(changed);
267
+ expect(response.body.unchanged).toBeUndefined();
268
+ expect(response.body.revision).not.toBe(full.revision);
269
+ });
270
+
271
+ it('gives light and full payloads distinct revisions', async () => {
272
+ gitLibraries.getStatus.mockImplementation(async (_directory, options) => (
273
+ options?.mode === 'light' ? statusPayload() : statusPayload({ diffStats: { 'a.ts': { insertions: 1, deletions: 0 } } })
274
+ ));
275
+ const { body: full } = await requestStatus();
276
+
277
+ const light = await requestStatus({ mode: 'light', since: full.revision });
278
+
279
+ expect(light.body.unchanged).toBeUndefined();
280
+ expect(light.body.files).toHaveLength(1);
281
+ });
282
+ });
283
+
208
284
  describe('git routes index mutations', () => {
209
285
  beforeEach(() => {
210
286
  gitLibraries.stageFiles.mockReset();
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkstreamRendererImpl-L2-fHtpA.js","assets/rolldown-runtime-hePW80VL.js","assets/vendor-base-ui-CdzJ6My_.js","assets/useUIStore-NMQx_cnG.js","assets/runtime-switch-CAZiOV2G.js","assets/runtime-auth-ef9W7A43.js","assets/vendor-zustand-o69pgTEK.js","assets/brand-storage-bootstrap-D4BW3w-M.js","assets/brand-storage-migration-Bhz6UOBJ.js","assets/vendor-react-BP2cRVqX.js","assets/fileQueries-DbUx7NwP.js","assets/vendor-tanstack-react-query-CdqCAt40.js","assets/vendor-tanstack-query-core-BWz0ose6.js","assets/queryRuntime-BuRnpVtK.js","assets/runtime-fetch-BAN5Gnnp.js","assets/vendor-markstream-react-Bm0cO70Z.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/vendor-markstream-core-Cm34iPLL.js","assets/vendor-floating-ui-dom-BHhLtF5l.js","assets/vendor-floating-ui-core-Co1I1lFV.js","assets/vendor-reactuses-core-BJ-jJ4YM.js","assets/vendor-lodash-es-DfLbG5Af.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/button-DFX-UCuQ.js","assets/desktop-dp2Z0toS.js","assets/runtimeAPIRegistry-C2VogTny.js","assets/store-CKaWYiP4.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/useMobileNavigationStore-CjljWARe.js","assets/platform-DXeTzJHG.js","assets/vendor-opencode-client-fxfj4IA_.js","assets/vendor-effect-DV9F8PTZ.js","assets/persistence-BfjCXjLZ.js","assets/pathNormalization-ewtPqJWn.js","assets/vendor-pathe-vBmvQE8f.js","assets/runtime-file-resource-D3k0hKDj.js","assets/runtime-file-store-BVRgEtI-.js","assets/path-utils-jGozTg9d.js","assets/vendor-sonner-ZS8XIOVl.js","assets/useAssistantUIStore-rdsbsVts.js","assets/vendor-zod-Dzk5kdUU.js","assets/vendor-fuse.js-DB5wDJbI.js","assets/vendor-fuzzysort-ukaRp9PC.js","assets/useThemeSystem-8jhE4Zyk.js","assets/tooltip-Byl6nrXB.js","assets/image-loading-FUFYiO1j.js","assets/image-loading-D9Z_BASK.css","assets/url-MRa-FtQa.js","assets/useEffectiveDirectory-HWABaJoo.js","assets/LoadingImage-ByZs_EGY.js","assets/ImageLoadingPlaceholder-B5t9zOYn.js","assets/markdownHeightCache-BsFt9Iuh.js","assets/dualLimitLru-D8Sphgua.js","assets/MarkdownRendererImpl-Do8KAqlC.js","assets/vendor-katex-DNVSTX6g.js","assets/FadeInOnReveal-CxIQc2_J.js","assets/markdownTheme-DHoKvD6O.js","assets/vendor-pierre-diffs-DPBtNDJ5.js","assets/vendor-hast-util-to-html-Bw_SgZ1t.js","assets/vendor-character-entities-legacy-Wut6vMuj.js","assets/vendor-character-entities-html4-DlN_yAFd.js","assets/vendor-ccount-CyGsA0u7.js","assets/vendor-comma-separated-tokens-B9ouxNNS.js","assets/vendor-oniguruma-to-es-CrHzjjSU.js","assets/vendor-oniguruma-parser-D2DIvhSP.js","assets/vendor-diff-Dq7CZNim.js","assets/vendor-lru_map-BMOrLc9L.js","assets/markdown-worker-oBGEB9Eg.js","assets/vendor-morphdom-BbKiNDAu.js","assets/vendor-dompurify-CeJNOzik.js","assets/vendor-pele-C1WTNWUm.js","assets/vendor-marked-WVekxjAN.js","assets/vendor-remend-C3cXc-tf.js","assets/fileReferenceActions-No7p4Kdo.js","assets/toolHelpers-DL452NVK.js","assets/fileReferenceParser-1HHDBUum.js","assets/MarkstreamRendererImpl-EpBnVy9J.css"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{a as t}from"./vendor-zustand-o69pgTEK.js";import{it as n,rt as r}from"./vendor-base-ui-CdzJ6My_.js";import"./brand-storage-bootstrap-D4BW3w-M.js";import{n as i}from"./vendor-react-BP2cRVqX.js";import{o as a}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{r as o}from"./button-DFX-UCuQ.js";import{t as s}from"./useEffectiveDirectory-HWABaJoo.js";import{i as c,n as l,t as u}from"./markdownHeightCache-BsFt9Iuh.js";var d=i(),f=e(n(),1),p=`yuri:chunk-import-reload`,m=250,h=3e4,g=[/Importing a module script failed/i,/Failed to fetch dynamically imported module/i,/error loading dynamically imported module/i,/Loading chunk \S+ failed/i,/ChunkLoadError/i];function _(e){if(e instanceof Error)return`${e.name}\n${e.message}\n${e.stack??``}`;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function v(e){let t=_(e);return g.some(e=>e.test(t))}function y(e){return`0.2.12-beta.2:${_(e).slice(0,500)}`}function b(e){if(typeof window>`u`)return;let t=Date.now(),n=y(e),r=null;try{let e=window.sessionStorage.getItem(p);if(e)try{r=JSON.parse(e)}catch{r=null}}catch{return}let i=typeof r?.timestamp==`number`?r.timestamp:0;if(!(r?.signature===n&&t-i<h)){try{window.sessionStorage.setItem(p,JSON.stringify({signature:n,timestamp:t}))}catch{return}console.error(`[refresh-debug] chunk-import-reload`,{error:_(e).slice(0,1e3)}),window.setTimeout(()=>{window.location.reload()},0)}}async function x(e,t={}){let n=t.retries??1,r;for(let t=0;t<=n;t+=1)try{return await e()}catch(e){if(r=e,!v(e)||t>=n)break;await new Promise(e=>setTimeout(e,m*(t+1)))}throw v(r)&&b(r),r}var S=e=>(0,f.lazy)(()=>x(e)),C=(e,t)=>!!t?.toLowerCase().startsWith(`video/`)||/^data:video\//i.test(e)||/\.(?:mp4|m4v|webm|mov|ogv|ogg)(?:[?#]|$)/i.test(e),w=(e,t)=>{try{let n=t??(typeof localStorage>`u`?null:localStorage);return!n||n.getItem(e)!==`0`}catch{return!0}},T=(e,t)=>{try{typeof localStorage<`u`&&localStorage.setItem(e,t?`1`:`0`)}catch{}},E=`yuri:markstream-react`,D=e=>w(E,e),O=t(e=>({markstreamReactEnabled:D(),setMarkstreamReactEnabled:t=>{T(E,t),e({markstreamReactEnabled:t})}})),k=null,A=()=>(k??=a(()=>import(`./MarkstreamRendererImpl-L2-fHtpA.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77])).catch(e=>{throw k=null,e}),k),j=()=>{A().catch(()=>void 0)},M=null,N=()=>(M??=a(()=>import(`./MarkdownRendererImpl-Do8KAqlC.js`).then(e=>e.n),__vite__mapDeps([54,1,4,5,24,25,2,30,14,6,31,32,7,8,3,33,9,13,12,34,35,36,10,11,37,38,16,55,20,21,22,23,26,27,28,29,39,40,41,42,43,53,44,46,47,48,49,56,52,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76])).catch(e=>{throw M=null,e}),M),P=()=>{N().catch(()=>void 0),D()&&j()},F=class extends f.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){console.warn(`[markstream-react] falling back to the current Markdown renderer`,e)}render(){return this.state.hasError?this.props.fallback:this.props.children}},I=f.createContext(!0),L=()=>f.useContext(I),R=r(),z=S(()=>N().then(e=>({default:e.MarkdownRenderer}))),B=S(()=>A().then(e=>({default:e.MarkstreamRenderer}))),V=S(()=>N().then(e=>({default:e.SimpleMarkdownRenderer}))),H=e=>e===`tool`?`markdown-content markdown-tool`:e===`reasoning`?`markdown-content markdown-reasoning`:`markdown-content leading-relaxed`,U=e=>{let t=(0,d.c)(15),n=O(K),r=typeof e.content==`string`?e.content:``,i=typeof e.variant==`string`?e.variant:`assistant`,a;t[0]!==r||t[1]!==n||t[2]!==e.reserveMeasuredHeight||t[3]!==i?(a=e.reserveMeasuredHeight?l(u(r,n?`markstream:${i}`:i)):void 0,t[0]=r,t[1]=n,t[2]=e.reserveMeasuredHeight,t[3]=i,t[4]=a):a=t[4];let s=a,f;t[5]!==e.className||t[6]!==e.variant?(f=o(`relative break-words w-full min-w-0`,H(e.variant),typeof e.className==`string`?e.className:void 0),t[5]=e.className,t[6]=e.variant,t[7]=f):f=t[7];let p;t[8]!==r||t[9]!==e.animated||t[10]!==s?(p=(0,R.jsx)(c,{animated:e.animated,content:r,reservedHeight:s}),t[8]=r,t[9]=e.animated,t[10]=s,t[11]=p):p=t[11];let m;return t[12]!==f||t[13]!==p?(m=(0,R.jsx)(`div`,{className:f,"aria-busy":`true`,"data-markdown-hydration":`deferred`,"data-markdown-ready":`false`,children:p}),t[12]=f,t[13]=p,t[14]=m):m=t[14],m},W=e=>{let t=(0,d.c)(13),n=L(),r=O(q);if(!n&&e.isStreaming!==!0){let n;return t[0]===e?n=t[1]:(n=(0,R.jsx)(U,{...e,animated:!1,reserveMeasuredHeight:!0}),t[0]=e,t[1]=n),n}let i;t[2]===e?i=t[3]:(i=(0,R.jsx)(f.Suspense,{fallback:(0,R.jsx)(U,{...e,reserveMeasuredHeight:!0}),children:(0,R.jsx)(z,{...e})}),t[2]=e,t[3]=i);let a=i,o;t[4]!==a||t[5]!==r||t[6]!==e?(o=r?(0,R.jsx)(F,{fallback:a,children:(0,R.jsx)(f.Suspense,{fallback:(0,R.jsx)(U,{...e,reserveMeasuredHeight:!0}),children:(0,R.jsx)(B,{...e})})}):a,t[4]=a,t[5]=r,t[6]=e,t[7]=o):o=t[7];let c=o,l;t[8]===e?l=t[9]:(l=t=>{if(!e.onShowPopup||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey)return;let n=t.target instanceof Element?t.target.closest(`a[href]`):null,r=n?.getAttribute(`href`);if(!r||!C(r))return;t.preventDefault(),t.stopPropagation();let i=n?.textContent?.trim()||r.split(/[/?#]/).filter(Boolean).pop()||r;e.onShowPopup({open:!0,title:i,content:``,video:{url:r,filename:i,directory:s()??``}})},t[8]=e,t[9]=l);let u;return t[10]!==c||t[11]!==l?(u=(0,R.jsx)(`div`,{className:`contents`,onClickCapture:l,children:c}),t[10]=c,t[11]=l,t[12]=u):u=t[12],u},G=e=>{let t=(0,d.c)(4);if(!L()){let n;return t[0]===e?n=t[1]:(n=(0,R.jsx)(U,{...e,animated:!1}),t[0]=e,t[1]=n),n}let n;return t[2]===e?n=t[3]:(n=(0,R.jsx)(f.Suspense,{fallback:(0,R.jsx)(U,{...e}),children:(0,R.jsx)(V,{...e})}),t[2]=e,t[3]=n),n};function K(e){return e.markstreamReactEnabled}function q(e){return e.markstreamReactEnabled}export{C as a,P as i,G as n,S as o,I as r,W as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t,i as n}from"./runtime-switch-CAZiOV2G.js";import{C as r}from"./desktop-dp2Z0toS.js";import{t as i}from"./runtimeAPIRegistry-C2VogTny.js";import{a,i as o,r as s}from"./vendor-zustand-o69pgTEK.js";import{it as c,rt as l}from"./vendor-base-ui-CdzJ6My_.js";import{B as u,Ct as d,M as f,Mt as p}from"./platform-DXeTzJHG.js";import{b as m,n as h,x as g}from"./useUIStore-NMQx_cnG.js";import{D as ee,O as _}from"./persistence-BfjCXjLZ.js";import{n as v}from"./vendor-react-BP2cRVqX.js";import{s as y}from"./vendor-tanstack-react-query-CdqCAt40.js";import{a as b,o as x}from"./queryRuntime-BuRnpVtK.js";import{r as S}from"./vendor-reactuses-core-BJ-jJ4YM.js";import{f as te,r as C,u as ne}from"./button-DFX-UCuQ.js";import{Ea as re,Gn as w,Ht as ie,Ir as ae,S as T,Va as E,Za as oe,_t as se,bn as D,ct as ce,d as O,kr as le,lt as k,mo as A,po as ue,un as de,ut as fe,y as pe}from"./useMobileNavigationStore-CjljWARe.js";import{t as me}from"./AgentAvatar-DJCC3Aqe.js";import{n as j}from"./Icon-C1nXIg7J.js";import{g as he,v as ge}from"./gitApi-Q5-lN46d.js";import{f as _e,o as M}from"./projectMeta-BpdNCDci.js";import{c as ve,d as N,l as P,n as ye,r as be,t as xe}from"./fileMentionTouchSelection-C5BslzWG.js";import{n as Se}from"./textarea-BuvlUTo2.js";var Ce=(e,t)=>{let n=t.trim();if(!n)return[...e].sort((e,t)=>e.isBuiltIn===t.isBuiltIn?e.name.localeCompare(t.name):e.isBuiltIn?-1:1);let r=w([...e],n,e=>[e.name,e.description??``]);return r.sort((e,t)=>e.score===t.score?e.item.isBuiltIn===t.item.isBuiltIn?e.item.name.localeCompare(t.item.name):e.item.isBuiltIn?-1:1:e.score-t.score),r.map(e=>e.item)},we=(e,t)=>e===t||e.length===t.length&&e.every((e,n)=>{let r=t[n];return r!=null&&e.id===r.id&&e.title===r.title&&(e.subtitle??``)===(r.subtitle??``)&&(e.badge??``)===(r.badge??``)&&e.iconName===r.iconName&&e.agentName===r.agentName}),Te=(e,t)=>e.highlightedIndex===t.highlightedIndex&&we(e.rows,t.rows),Ee=(e,t)=>we(e,t)?e:t.slice(),De=(e,t,n)=>{e&&(t.current&&Te(t.current,n)||(t.current=n,e(n)))},Oe=(e,t)=>{t.current=null,e?.({rows:[],highlightedIndex:0})},F=e(c(),1),I=e=>{if(!e)return``;let t=e.replace(/\\/g,`/`),n=t.startsWith(`//`),r=t.replace(/\/+/g,`/`);n&&!r.startsWith(`//`)&&(r=`/${r}`);let i=r===`/`,a=/^[A-Za-z]:\/$/.test(r);return!i&&!a&&(r=r.replace(/\/+$/,``)),r},L=e=>/^[A-Za-z]:\//.test(e)?e.toLowerCase():e,R=(e,t)=>{let n=I(t),r=I(e);if(!n||!r)return!1;let i=L(n),a=L(r);return a===i||a.startsWith(`${i}/`)},ke=e=>{if(!e||typeof e!=`object`)return{};let t=e,n={};for(let[e,r]of Object.entries(t)){let t=I(e);if(!t||!r||typeof r!=`object`)continue;let i=r,a=Array.isArray(i.openPaths)?Array.from(new Set(i.openPaths.filter(e=>typeof e==`string`).map(e=>I(e)).filter(e=>R(e,t)))):[],o=Array.isArray(i.expandedPaths)?Array.from(new Set(i.expandedPaths.filter(e=>typeof e==`string`).map(e=>I(e)).filter(e=>R(e,t)))):[],s=typeof i.selectedPath==`string`?I(i.selectedPath):null,c=s&&R(s,t)?s:a[0]??null,l=typeof i.touchedAt==`number`&&Number.isFinite(i.touchedAt)?i.touchedAt:Date.now(),u=n[t];if(u){let e=Array.from(new Set([...u.openPaths,...a])),r=Array.from(new Set([...u.expandedPaths,...o]));n[t]={openPaths:e,selectedPath:u.selectedPath??c??e[0]??null,expandedPaths:r,touchedAt:Math.max(u.touchedAt,l)};continue}n[t]={openPaths:a,selectedPath:c,expandedPaths:o,touchedAt:l}}return n},z=(e,t)=>{let n=Object.entries(e);if(n.length<=t)return e;n.sort((e,t)=>(t[1]?.touchedAt??0)-(e[1]?.touchedAt??0));let r={};for(let[e,i]of n.slice(0,t))r[e]=i;return r},B=e=>e?{...e,touchedAt:Date.now()}:{openPaths:[],selectedPath:null,expandedPaths:[],touchedAt:Date.now()},Ae=a()(s(o((e,t)=>({byRoot:{},addOpenPath:(t,n,r)=>{let i=I((t||``).trim()),a=I((n||``).trim());!i||!a||!r?.allowOutsideRoot&&!R(a,i)||e(e=>{let t=e.byRoot[i],n=B(t),r=n.openPaths.includes(a),o=r?n.openPaths:[...n.openPaths,a],s=n.selectedPath??a;return t&&r&&t.selectedPath===s?e:{byRoot:z({...e.byRoot,[i]:{...n,openPaths:o,selectedPath:s}},20)}})},removeOpenPath:(t,n)=>{let r=I((t||``).trim()),i=I((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=L(i),a=e=>L(e)===n,o=t.selectedPath?a(t.selectedPath):!1;if(!t.openPaths.some(a)&&!o)return e;let s=t.openPaths.filter(e=>!a(e)),c=o?s[0]??null:t.selectedPath;return{byRoot:z({...e.byRoot,[r]:{...t,openPaths:s,selectedPath:c,touchedAt:Date.now()}},20)}})},removeOpenPathsByPrefix:(t,n)=>{let r=I((t||``).trim()),i=I((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=L(i),a=n.endsWith(`/`)?n:`${n}/`,o=e=>{let t=L(e);return t===n||t.startsWith(a)},s=t.openPaths.filter(e=>!o(e));if(s.length===t.openPaths.length)return e;let c=t.selectedPath&&o(t.selectedPath)?s[0]??null:t.selectedPath;return{byRoot:z({...e.byRoot,[r]:{...t,openPaths:s,selectedPath:c,touchedAt:Date.now()}},20)}})},removeExpandedPathsByPrefix:(t,n)=>{let r=I((t||``).trim()),i=I((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=L(i),a=n.endsWith(`/`)?n:`${n}/`,o=t.expandedPaths.filter(e=>{let t=L(e);return t!==n&&!t.startsWith(a)});return o.length===t.expandedPaths.length?e:{byRoot:z({...e.byRoot,[r]:{...t,expandedPaths:o,touchedAt:Date.now()}},20)}})},setSelectedPath:(t,n,r)=>{let i=I((t||``).trim()),a=n?I(n.trim()):null;!i||a&&!r?.allowOutsideRoot&&!R(a,i)||e(e=>{let t=e.byRoot[i],n=B(t),r=a&&!n.openPaths.includes(a)?[...n.openPaths,a]:n.openPaths;return t&&t.selectedPath===a&&r===t.openPaths?e:{byRoot:z({...e.byRoot,[i]:{...n,openPaths:r,selectedPath:a}},20)}})},ensureSelectedPath:e=>{let n=I((e||``).trim());if(!n)return;let r=t().byRoot[n];if(!r||r.selectedPath)return;let i=r.openPaths[0]??null;i&&t().setSelectedPath(n,i)},toggleExpandedPath:(t,n)=>{let r=I((t||``).trim()),i=I((n||``).trim());!r||!i||!R(i,r)||e(e=>{let t=e.byRoot[r],n=B(t),a=n.expandedPaths.includes(i)?n.expandedPaths.filter(e=>e!==i):[...n.expandedPaths,i];return t&&t.expandedPaths===a&&t.selectedPath===n.selectedPath&&t.openPaths===n.openPaths?e:{byRoot:z({...e.byRoot,[r]:{...n,expandedPaths:a}},20)}})},expandPath:(t,n)=>{let r=I((t||``).trim()),i=I((n||``).trim());!r||!i||!R(i,r)||e(e=>{let t=e.byRoot[r],n=B(t);return n.expandedPaths.includes(i)&&t?e:{byRoot:z({...e.byRoot,[r]:{...n,expandedPaths:[...n.expandedPaths,i]}},20)}})},expandPaths:(t,n)=>{let r=I((t||``).trim());if(!r||!n||n.length===0)return;let i=n.map(e=>I((e||``).trim())).filter(e=>e&&R(e,r));i.length!==0&&e(e=>{let t=e.byRoot[r],n=B(t),a=new Set(n.expandedPaths),o=i.filter(e=>!a.has(e));return o.length===0?e:{byRoot:z({...e.byRoot,[r]:{...n,expandedPaths:[...n.expandedPaths,...o]}},20)}})}}),{name:`files-view-tabs-store`,version:2,storage:m(),migrate:e=>{if(!e||typeof e!=`object`)return{byRoot:{}};let t=e.byRoot;return{byRoot:ke(t)}},partialize:e=>({byRoot:ke(e.byRoot)})}),{name:`files-view-tabs-store`})),V=v(),je=(e,t)=>{let n=(0,V.c)(4),r=t===void 0?200:t,[i,a]=F.useState(e),o,s;return n[0]!==r||n[1]!==e?(o=()=>{let t=window.setTimeout(()=>{a(e)},r);return()=>{window.clearTimeout(t)}},s=[e,r],n[0]=r,n[1]=e,n[2]=o,n[3]=s):(o=n[2],s=n[3]),F.useEffect(o,s),i},Me=()=>{let e=(0,V.c)(17),t=O(Ne),n=D(),r;e[0]===t?r=e[1]:(r=e=>t?e.getAttachment(t):void 0,e[0]=t,e[1]=r);let i=T(r),a=O(H),o=O(U),s=A(W),c=A(Pe),l=d(Fe);if(t){let r;e[2]===i?r=e[3]:(r=pe(i),e[2]=i,e[3]=r);let o=r;if(o)return o;let s;e[4]!==t||e[5]!==a?(s=a.get(t),e[4]=t,e[5]=a,e[6]=s):s=e[6];let c=s;if(c?.path)return c.path;let l;if(e[7]!==t||e[8]!==n){let r;e[10]===t?r=e[11]:(r=e=>e.id===t,e[10]=t,e[11]=r),l=n.find(r),e[7]=t,e[8]=n,e[9]=l}else l=e[9];let u=l;if(u?.directory)return u.directory}if(o?.open&&(o.bootstrapPendingDirectory||o.directoryOverride))return(o.bootstrapPendingDirectory||o.directoryOverride)??void 0;if(s){let t;if(e[12]!==s||e[13]!==c){let n;e[15]===s?n=e[16]:(n=e=>e.id===s,e[15]=s,e[16]=n),t=c.find(n),e[12]=s,e[13]=c,e[14]=t}else t=e[14];let n=t;if(n?.path)return n.path}return l??void 0};function Ne(e){return e.currentSessionId}function H(e){return e.worktreeMetadata}function U(e){return e.newSessionDraft}function W(e){return e.activeProjectId}function Pe(e){return e.projects}function Fe(e){return e.currentDirectory}var G=l(),Ie=`bg-transparent font-[inherit] text-[var(--primary-base)]`,Le=(e,t)=>{let n=t.trim().toLowerCase();if(!n)return e;let r=e.toLowerCase();if(!r.includes(n))return e;let i=[],a=0,o=r.indexOf(n);for(;o!==-1;)o>a&&i.push(e.slice(a,o)),i.push((0,G.jsx)(`mark`,{className:Ie,children:e.slice(o,o+n.length)},`${o}-${n}`)),a=o+n.length,o=r.indexOf(n,a);return a<e.length&&i.push(e.slice(a)),i},Re=F.forwardRef(({searchQuery:e,onFileSelect:t,onAgentSelect:n,onSkillSelect:r,onSessionSelect:i,onClose:a,style:o,onRowsChange:s},c)=>{let{t:l}=te(),u=Me()??``,d=O(e=>e.currentSessionId),f=ae(e=>e.activeSessions),m=ie({enabled:!!i}),g=A(e=>e.activeProjectId),v=A(e=>e.projects),y=F.useMemo(()=>v.find(e=>e.id===g)?.path??null,[g,v]),b=F.useMemo(()=>{let e=y||u;return e?e.replace(/\\/g,`/`).replace(/\/+$/,``):null},[y,u]),x=Ae(e=>b?e.byRoot[b]:void 0),w=re(e=>e.agents),T=p(e=>e.searchFiles),D=je(e,180),ue=_(),de=ee(),[pe,he]=F.useState([]),[ge,_e]=F.useState(!1),[M,N]=F.useState(0),P=F.useRef(0),Ce=F.useRef({query:e,directory:u,ids:[]}),[we,Te]=F.useState(360),[Ee,I]=F.useState({}),[L,R]=F.useState({}),ke=F.useRef([]),z=F.useRef([]),B=F.useRef([]),V=F.useRef(null),Ne=F.useRef(null),H=F.useRef(null);H.current||=xe();let U=h(e=>e.isMobile),W=(e??``).trim(),Pe=oe({directory:u||null}),Fe=F.useMemo(()=>r?Pe.data??[]:[],[r,Pe.data]),Ie=F.useMemo(()=>{if(!b||!x)return[];let e=[x.selectedPath,...x.openPaths.slice().reverse()].filter(e=>typeof e==`string`&&e.length>0),t=new Set,n=[];for(let r of e){if(t.has(r))continue;t.add(r);let e=r.replace(/\\/g,`/`),i=e.split(`/`).filter(Boolean).pop()||e,a=e.startsWith(`${b}/`)?e.slice(b.length+1):e;n.push({name:i,path:e,relativePath:a,extension:i.includes(`.`)?i.split(`.`).pop()?.toLowerCase():void 0})}return fe(n,W,{limit:6})},[W,b,x]),Re=F.useMemo(()=>n?E(w).filter(e=>e.mode!==`primary`):[],[w,n]),ze=F.useMemo(()=>i?ce({sessions:le(f,m),currentSessionId:d,searchQuery:W}):[],[f,d,m,W,i]),K=Ie,Be=pe,q=F.useMemo(()=>ve({skills:Fe,agents:Re,sessions:ze,recentFiles:K,pathHits:Be,searchQuery:W,untitledSession:l(`chat.fileMentionAutocomplete.untitledSession`),sessionBadge:l(`chat.fileMentionAutocomplete.sessionType`),skillBadge:l(`chat.commandAutocomplete.badge.skill`)}),[Fe,Re,ze,K,Be,W,l]);F.useEffect(()=>{let e=e=>{let t=e.target;!t||!V.current||V.current.contains(t)||a()};return document.addEventListener(`pointerdown`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0)}},[a]),F.useEffect(()=>{if(!u){he([]);return}let e=(D??``).trim(),t=se(e);if(!t){he([]);return}let n=!1;_e(!0);let r={includeHidden:ue,respectGitignore:!de};return Promise.all([T(u,t,80,{...r,type:`file`}),T(u,t,40,{...r,type:`directory`})]).then(([t,r])=>{if(n)return;let i=new Set(Ie.map(e=>e.path));he(k({files:t,directories:r,query:e,excludePaths:i,limit:20}))}).catch(()=>{n||he([])}).finally(()=>{n||_e(!1)}),()=>{n=!0}},[u,D,Ie,T,ue,de]),F.useLayoutEffect(()=>{let t=Ce.current,n=t.ids[P.current],r=t.query===e&&t.directory===u?Math.max(0,q.findIndex(e=>e.id===n)):0;Ce.current={query:e,directory:u,ids:q.map(e=>e.id)},P.current=r,N(r)},[q,e,u]),F.useEffect(()=>{I({}),R({})},[q]),F.useEffect(()=>{ke.current[M]?.scrollIntoView({block:`nearest`})},[M]),F.useEffect(()=>{let e=null,t=()=>{e!==null&&cancelAnimationFrame(e),e=requestAnimationFrame(()=>{let e={},t={};z.current.forEach((n,r)=>{if(!n)return;let i=B.current[r]?.offsetWidth??n.scrollWidth,a=Math.max(0,i-n.clientWidth),o=a>8;if(e[r]=o,o){let e=Math.max(.6,a/110);t[r]=e}}),I(e),R(t)})};return t(),window.addEventListener(`resize`,t),()=>{e!==null&&cancelAnimationFrame(e),window.removeEventListener(`resize`,t)}},[q]),F.useEffect(()=>{let e=z.current[M];if(!e)return;let t=()=>{let t=e.clientWidth;t>0&&Te(t)};if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>{n.disconnect()}},[M]);let Ve=S(e=>{t(e)}),He=S(e=>{n?.(e)}),Ue=S(e=>{i?.(e)}),We=S(e=>{r?.(e)}),Ge=(e,t)=>({onMouseDown:e=>e.preventDefault(),onPointerDown:e=>{e.pointerType===`touch`&&H.current?.pointerDown(e.clientX,e.clientY)},onPointerMove:e=>{e.pointerType===`touch`&&H.current?.pointerMove(e.clientX,e.clientY)},onPointerUp:e=>{e.pointerType===`touch`&&(H.current?.pointerUp(t)??!1)&&(e.preventDefault(),e.stopPropagation())},onPointerCancel:()=>H.current?.pointerCancel(),onClick:()=>{H.current?.click(t)},onMouseMove:()=>{P.current=e,N(e)}}),J=e=>{let t=q.length;if(t===0)return;let n=(e%t+t)%t,r=q[n];if(r.agentName!==void 0){He(r.agentName);return}if(r.id.startsWith(`skill:`)){let e=Fe.find(e=>r.id===`skill:${e.name}-${e.scope}`);e&&We(e);return}if(r.id.startsWith(`session:`)){let e=ze.find(e=>r.id===`session:${e.id}`);e&&Ue(e);return}let i=r.id.startsWith(`recent:`)?K.find(e=>r.id===`recent:${e.path}`):Be.find(e=>r.id===`file:${e.path}`);i&&Ve(i)};F.useEffect(()=>{De(s,Ne,{rows:q,highlightedIndex:M})},[s,M,q]);let Ke=F.useRef(s);return Ke.current=s,F.useEffect(()=>()=>{Oe(Ke.current,Ne)},[]),F.useImperativeHandle(c,()=>({acceptIndex:e=>{J(e)},handleKeyDown:e=>{if(e===`Escape`){a();return}let t=q.length;if(t!==0){if(e===`ArrowDown`){P.current=(P.current+1)%t,N(P.current);return}if(e===`ArrowUp`){P.current=(P.current-1+t)%t,N(P.current);return}(e===`Enter`||e===`Tab`)&&J(P.current)}}})),(0,G.jsxs)(ye,{ref:V,isMobile:U,className:`max-w-[640px] max-h-64`,style:o,children:[(0,G.jsx)(Se,{preventOverscroll:!0,outerClassName:`flex-1 min-h-0`,className:`px-0`,children:(0,G.jsxs)(`div`,{className:`py-1`,children:[q.map((e,t)=>{let n=e.id.startsWith(`file:`)||e.id.startsWith(`recent:`),r=n?ne(e.title,{maxLength:60}):e.title,i=M===t,a=Ee[t]??!1,o=L[t]??2.6;return(0,G.jsxs)(`div`,{"data-mention-id":e.id,ref:e=>{ke.current[t]=e},className:C(`flex items-center gap-2 px-3 py-1.5 cursor-pointer typography-ui-label rounded-lg`,U&&`min-h-11`,be(U,i),!U&&i&&`text-interactive-selection-foreground`),...Ge(t,()=>J(t)),children:[(0,G.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center`,children:e.agentName===void 0?(0,G.jsx)(j,{name:e.iconName,className:`size-3.5 text-current`}):(0,G.jsx)(me,{name:e.agentName,size:20})}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`span`,{ref:e=>{z.current[t]=e},className:`relative block min-w-0 overflow-hidden file-mention-marquee-container`,style:i?{"--file-mention-marquee-width":`${we}px`,"--file-mention-marquee-duration":`${o}s`}:void 0,title:e.title,children:[(0,G.jsx)(`span`,{ref:e=>{B.current[t]=e},className:`absolute invisible whitespace-nowrap pointer-events-none`,"aria-hidden":!0,children:e.title}),n&&a&&i?(0,G.jsx)(`span`,{className:`inline-block whitespace-nowrap file-mention-marquee`,children:Le(e.title,W)}):(0,G.jsx)(`span`,{className:`block truncate`,children:Le(r,W)})]}),e.subtitle?(0,G.jsx)(`div`,{className:C(`truncate text-muted-foreground`,U?`typography-micro`:`typography-meta`),children:Le(e.subtitle,W)}):null]})]},e.id)}),ge&&Be.length===0?(0,G.jsx)(`div`,{className:`flex items-center justify-center py-3`,children:(0,G.jsx)(j,{name:`refresh`,className:`h-4 w-4 animate-spin text-muted-foreground`})}):null,!ge&&q.length===0&&(0,G.jsx)(`div`,{className:`px-3 py-2 typography-ui-label text-muted-foreground`,children:l(`chat.fileMentionAutocomplete.empty`)})]})}),!U&&(0,G.jsx)(`div`,{className:`px-3 pt-1 pb-1.5 border-t typography-meta text-muted-foreground`,children:l(`chat.autocomplete.keyboardHint`)})]})}),ze=new Set([`new`,`fork`,`compact`,`reload`,`undo`,`redo`,`model`,`goal`,`btw`]),K=(e,t)=>{if(!t||e.isSkill)return!1;let n=e.name?.trim().toLowerCase();return!!(n&&ze.has(n))},Be=(e,t)=>!e||t({name:e}),q=` `,Ve=(e,t)=>{let n=Math.max(0,Math.min(t,e.length)),r=n;for(;r>0&&!/\s/.test(e[r-1]);)--r;return r>=2&&e[r-1]===q&&e[r-2]===`/`&&(r-=2),e[r]===`/`?{start:r,end:n}:null},He=`text-[10px] leading-none uppercase font-bold tracking-tight px-1.5 py-1 rounded border flex-shrink-0`,Ue=C(He,`bg-[color-mix(in_srgb,var(--primary-base)_12%,transparent)] text-[color-mix(in_srgb,var(--primary-base)_70%,transparent)] border-[color-mix(in_srgb,var(--primary-base)_24%,transparent)]`),We=C(He,`bg-[color-mix(in_srgb,var(--status-success)_12%,transparent)] text-[color-mix(in_srgb,var(--status-success)_70%,transparent)] border-[color-mix(in_srgb,var(--status-success)_24%,transparent)]`),Ge=C(He,`bg-[color-mix(in_srgb,var(--status-info)_12%,transparent)] text-[color-mix(in_srgb,var(--status-info)_70%,transparent)] border-[color-mix(in_srgb,var(--status-info)_24%,transparent)]`),J=C(He,`bg-[var(--surface-muted)] text-muted-foreground border-[var(--interactive-border)]/60`),Ke=(e,t)=>e.length===t.length&&e.every((e,n)=>e.id===t[n]?.id&&e.description===t[n]?.description),qe=(e,t)=>{let n=!!e.sessionID;return{hasSession:n,canStartSessionCommand:n||e.hasNewDraft,canUseReviewHandoffFlow:n&&!t&&!r()}},Je=F.forwardRef(({searchQuery:e,onCommandSelect:t,onClose:n,directory:i,style:a,commandPolicy:o,commandContext:s,onRowsChange:c},l)=>{let{t:u}=te(),d=h(e=>e.isMobile),f=O(e=>e.currentSessionId),p=O(e=>!!e.newSessionDraft?.open),m=O(F.useCallback(e=>f?e.getDirectoryForSession(f):void 0,[f])),g=de(f??``,m??void 0),ee=F.useMemo(()=>s??{sessionID:f??null,hasMessages:g.length>0,hasNewDraft:p},[s,f,g.length,p]),{hasSession:_,canStartSessionCommand:v,canUseReviewHandoffFlow:y}=F.useMemo(()=>qe(ee,d),[ee,d]),b=ee.hasMessages,[x,S]=F.useState([]),[ne,re]=F.useState(!1),w=ue({directory:i}),ie=F.useMemo(()=>w.data??[],[w.data]),ae=w.isFetching,[T,E]=F.useState(0),oe=F.useRef(0),se=F.useRef(!1),D=F.useRef([]),ce=F.useRef(null),le=F.useRef(!1),k=F.useRef(null),A=F.useRef(!1),fe=F.useRef(null);F.useEffect(()=>{let e=e=>{let t=e.target;!t||!ce.current||ce.current.contains(t)||n()};return document.addEventListener(`pointerdown`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0)}},[n]),F.useEffect(()=>{(async()=>{re(ae);try{let t=ie.flatMap((e,t)=>e.source===`skill`?[]:[{id:`opencode:${e.scope??`global`}:${e.name}:${e.agent??``}:${e.model??``}:${t}`,name:e.name,source:`opencode`,description:e.description,agent:e.agent??void 0,model:e.model??void 0,isBuiltIn:e.isBuiltIn,scope:e.scope,reference:e.reference}]),n=[{id:`yuri:new`,name:`new`,source:`yuri`,description:u(`chat.commandAutocomplete.command.newDescription`),isBuiltIn:!0},..._&&!b?[{id:`yuri:init`,name:`init`,source:`yuri`,description:u(`chat.commandAutocomplete.command.initDescription`),isBuiltIn:!0}]:[],..._?[{id:`yuri:btw`,name:`btw`,source:`yuri`,description:u(`chat.btw.description`),isBuiltIn:!0},{id:`yuri:undo`,name:`undo`,source:`yuri`,description:u(`chat.commandAutocomplete.command.undoDescription`),isBuiltIn:!0},{id:`yuri:redo`,name:`redo`,source:`yuri`,description:u(`chat.commandAutocomplete.command.redoDescription`),isBuiltIn:!0},{id:`yuri:fork`,name:`fork`,source:`yuri`,description:u(`chat.commandAutocomplete.command.forkDescription`),isBuiltIn:!0},{id:`yuri:timeline`,name:`timeline`,source:`yuri`,description:u(`chat.commandAutocomplete.command.timelineDescription`),isBuiltIn:!0}]:[],{id:`yuri:model`,name:`model`,source:`yuri`,description:u(`chat.commandAutocomplete.command.modelDescription`),isBuiltIn:!0},{id:`yuri:compact`,name:`compact`,source:`yuri`,description:u(`chat.commandAutocomplete.command.compactDescription`),isBuiltIn:!0},...r()?[{id:`yuri:reload`,name:`reload`,source:`yuri`,description:u(`chat.commandAutocomplete.command.reloadDescription`),isBuiltIn:!0}]:[],..._?[{id:`yuri:summary`,name:`summary`,source:`yuri`,description:u(`chat.commandAutocomplete.command.summaryDescription`),isYuri:!0}]:[],...v?[{id:`yuri:workspace-review`,name:`workspace-review`,source:`yuri`,description:u(`chat.commandAutocomplete.command.workspaceReviewDescription`),isYuri:!0}]:[],...y?[{id:`yuri:handoff-review`,name:`handoff-review`,source:`yuri`,description:u(`chat.commandAutocomplete.command.handoffReviewDescription`),isYuri:!0}]:[],...v?[{id:`yuri:craft-goal`,name:`craft-goal`,source:`yuri`,description:u(`chat.commandAutocomplete.command.craftGoalDescription`),isYuri:!0}]:[],...v?[{id:`yuri:goal`,name:`goal`,source:`yuri`,description:u(`chat.goal.button.armAria`),isBuiltIn:!0}]:[],...v?[{id:`yuri:catch-up`,name:`catch-up`,source:`yuri`,description:u(`chat.commandAutocomplete.command.catchUpDescription`),isYuri:!0}]:[],...v?[{id:`yuri:debug`,name:`debug`,source:`yuri`,description:u(`chat.commandAutocomplete.command.debugDescription`),isYuri:!0}]:[],...v?[{id:`yuri:weigh`,name:`weigh`,source:`yuri`,description:u(`chat.commandAutocomplete.command.weighDescription`),isYuri:!0}]:[],...v?[{id:`yuri:explore`,name:`explore`,source:`yuri`,description:u(`chat.commandAutocomplete.command.exploreDescription`),isYuri:!0}]:[],...t],i=!b,a=Ce(n.filter(e=>(i||e.name!==`init`)&&(o?.(e)??!0)),e);S(e=>Ke(e,a)?e:a)}catch{let t=!b,n=Ce([{id:`yuri:new`,name:`new`,source:`yuri`,description:u(`chat.commandAutocomplete.command.newDescription`),isBuiltIn:!0},..._&&!b?[{id:`yuri:init`,name:`init`,source:`yuri`,description:u(`chat.commandAutocomplete.command.initDescription`),isBuiltIn:!0}]:[],..._?[{id:`yuri:btw`,name:`btw`,source:`yuri`,description:u(`chat.btw.description`),isBuiltIn:!0},{id:`yuri:undo`,name:`undo`,source:`yuri`,description:u(`chat.commandAutocomplete.command.undoDescription`),isBuiltIn:!0},{id:`yuri:redo`,name:`redo`,source:`yuri`,description:u(`chat.commandAutocomplete.command.redoDescription`),isBuiltIn:!0},{id:`yuri:fork`,name:`fork`,source:`yuri`,description:u(`chat.commandAutocomplete.command.forkDescription`),isBuiltIn:!0},{id:`yuri:timeline`,name:`timeline`,source:`yuri`,description:u(`chat.commandAutocomplete.command.timelineDescription`),isBuiltIn:!0}]:[],{id:`yuri:model`,name:`model`,source:`yuri`,description:u(`chat.commandAutocomplete.command.modelDescription`),isBuiltIn:!0},{id:`yuri:compact`,name:`compact`,source:`yuri`,description:u(`chat.commandAutocomplete.command.compactDescription`),isBuiltIn:!0},...r()?[{id:`yuri:reload`,name:`reload`,source:`yuri`,description:u(`chat.commandAutocomplete.command.reloadDescription`),isBuiltIn:!0}]:[],..._?[{id:`yuri:summary`,name:`summary`,source:`yuri`,description:u(`chat.commandAutocomplete.command.summaryDescription`),isYuri:!0}]:[],...v?[{id:`yuri:workspace-review`,name:`workspace-review`,source:`yuri`,description:u(`chat.commandAutocomplete.command.workspaceReviewDescription`),isYuri:!0}]:[],...y?[{id:`yuri:handoff-review`,name:`handoff-review`,source:`yuri`,description:u(`chat.commandAutocomplete.command.handoffReviewDescription`),isYuri:!0}]:[],...v?[{id:`yuri:craft-goal`,name:`craft-goal`,source:`yuri`,description:u(`chat.commandAutocomplete.command.craftGoalDescription`),isYuri:!0}]:[],...v?[{id:`yuri:goal`,name:`goal`,source:`yuri`,description:u(`chat.goal.button.armAria`),isBuiltIn:!0}]:[],...v?[{id:`yuri:catch-up`,name:`catch-up`,source:`yuri`,description:u(`chat.commandAutocomplete.command.catchUpDescription`),isYuri:!0}]:[],...v?[{id:`yuri:debug`,name:`debug`,source:`yuri`,description:u(`chat.commandAutocomplete.command.debugDescription`),isYuri:!0}]:[],...v?[{id:`yuri:weigh`,name:`weigh`,source:`yuri`,description:u(`chat.commandAutocomplete.command.weighDescription`),isYuri:!0}]:[],...v?[{id:`yuri:explore`,name:`explore`,source:`yuri`,description:u(`chat.commandAutocomplete.command.exploreDescription`),isYuri:!0}]:[]].filter(e=>(t||e.name!==`init`)&&(o?.(e)??!0)),e);S(e=>Ke(e,n)?e:n)}finally{re(!1)}})()},[e,b,_,v,y,ie,ae,u,o]),F.useEffect(()=>{E(0)},[x]),F.useEffect(()=>{oe.current=T},[T]),F.useEffect(()=>{D.current[T]?.scrollIntoView({block:`nearest`})},[T]),F.useEffect(()=>{De(c,fe,{rows:P(x,{skill:u(`chat.commandAutocomplete.badge.skill`),command:u(`chat.commandAutocomplete.badge.command`),system:u(`chat.commandAutocomplete.badge.system`)}),highlightedIndex:T})},[x,c,T,u]);let pe=F.useRef(c);pe.current=c,F.useEffect(()=>()=>{Oe(pe.current,fe)},[]),F.useImperativeHandle(l,()=>({acceptIndex:(e,n=!0)=>{let r=x[e];r&&t(r,K(r,n))},handleKeyDown:e=>{let r=x.length;if(e===`Escape`){n();return}if(r!==0){if(e===`ArrowDown`){se.current=!0,E(e=>(e+1)%r);return}if(e===`ArrowUp`){se.current=!0,E(e=>(e-1+r)%r);return}if(e===`Enter`||e===`Tab`){let n=(oe.current%r+r)%r,i=x[n];i&&t(i,K(i,e===`Enter`))}}}}),[x,n,t]);let me=e=>{let t=N(e);switch(e.name){case`new`:return(0,G.jsx)(j,{name:t,className:`h-3.5 w-3.5`});case`init`:return(0,G.jsx)(j,{name:t,className:`h-3.5 w-3.5 text-green-500`});case`undo`:return(0,G.jsx)(j,{name:t,className:`h-3.5 w-3.5 text-orange-500`});case`redo`:return(0,G.jsx)(j,{name:t,className:`h-3.5 w-3.5 text-orange-500`});case`timeline`:case`reload`:return(0,G.jsx)(j,{name:t,className:`h-3.5 w-3.5`});case`compact`:return(0,G.jsx)(j,{name:t,className:`h-3.5 w-3.5 text-purple-500`});case`goal`:return(0,G.jsx)(j,{name:t,className:`h-3.5 w-3.5`});case`review`:return(0,G.jsx)(j,{name:t,className:`h-3.5 w-3.5 text-blue-500`});case`test`:case`build`:case`run`:return(0,G.jsx)(j,{name:t,className:`h-3.5 w-3.5 text-cyan-500`});default:return e.isBuiltIn?(0,G.jsx)(j,{name:t,className:`h-3.5 w-3.5 text-yellow-500`}):(0,G.jsx)(j,{name:t,className:`h-3.5 w-3.5 text-muted-foreground`})}};return(0,G.jsxs)(ye,{ref:ce,isMobile:d,className:`max-w-[450px] max-h-64`,style:a,children:[(0,G.jsx)(Se,{preventOverscroll:!0,outerClassName:`flex-1 min-h-0`,className:`px-0 py-1.5`,children:ne?(0,G.jsx)(`div`,{className:`flex items-center justify-center py-4`,children:(0,G.jsx)(j,{name:`refresh`,className:`h-4 w-4 animate-spin text-muted-foreground`})}):(0,G.jsxs)(`div`,{children:[x.map((n,r)=>{let i=n.isBuiltIn,a=n.isYuri;return(0,G.jsxs)(`div`,{ref:e=>{D.current[r]=e},className:C(`flex gap-2 px-2 py-2 cursor-pointer rounded-lg`,d?`items-center`:`items-start`,be(d,r===T),!d&&r===T&&`bg-interactive-selection/35`),onMouseDown:e=>e.preventDefault(),onPointerDown:e=>{e.pointerType===`touch`&&(k.current={x:e.clientX,y:e.clientY},A.current=!1)},onPointerMove:e=>{if(e.pointerType!==`touch`||!k.current)return;let t=e.clientX-k.current.x,n=e.clientY-k.current.y;Math.hypot(t,n)>6&&(A.current=!0)},onPointerUp:e=>{if(e.pointerType!==`touch`)return;let r=A.current;k.current=null,A.current=!1,!r&&(e.preventDefault(),e.stopPropagation(),le.current=!0,t(n,K(n,d)))},onPointerCancel:()=>{k.current=null,A.current=!1},onClick:()=>{if(le.current){le.current=!1;return}t(n,K(n,d))},onMouseMove:()=>{se.current=!1,E(r)},children:[(0,G.jsx)(`div`,{className:C(!d&&`mt-0.5`),children:me(n)}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`span`,{className:`typography-ui-label font-medium`,children:[`/`,Le(n.name,e)]}),n.isSkill?(0,G.jsx)(`span`,{className:Ue,children:u(`chat.commandAutocomplete.badge.skill`)}):(0,G.jsx)(`span`,{className:Ue,children:u(`chat.commandAutocomplete.badge.command`)}),a?(0,G.jsx)(`span`,{className:J,children:`Yuri`}):i?(0,G.jsx)(`span`,{className:J,children:u(`chat.commandAutocomplete.badge.system`)}):n.scope?(0,G.jsx)(`span`,{className:n.scope===`project`?Ge:We,children:n.scope}):null,n.agent&&(0,G.jsx)(`span`,{className:J,children:n.agent})]}),n.description&&!d&&(0,G.jsx)(`div`,{className:`typography-meta text-muted-foreground mt-0.5 truncate`,children:Le(n.description,e)})]})]},n.id)}),x.length===0&&(0,G.jsx)(`div`,{className:`px-3 py-2 typography-ui-label text-muted-foreground`,children:u(`chat.commandAutocomplete.empty`)})]})}),!d&&(0,G.jsx)(`div`,{className:`px-3 pt-1 pb-1.5 border-t typography-meta text-muted-foreground`,children:u(`chat.autocomplete.keyboardHint`)})]})});Je.displayName=`CommandAutocomplete`;var Ye=2,Xe=e=>!!e&&typeof e==`object`&&!Array.isArray(e),Ze=e=>{let t=e?.trim().replace(/\\/g,`/`);return t?t.length>1?t.replace(/\/+$/,``):t:null},Qe=e=>Xe(e)&&Array.isArray(e.all)&&e.all.every(e=>typeof e==`string`)&&typeof e.current==`string`&&Xe(e.branches),Y=(e,t)=>JSON.stringify([e,t]),$e=e=>`version`in e&&e.version===Ye&&Xe(e.entries),et=e=>{if(!e)return null;try{let t=JSON.parse(e);return Xe(t)?t.version===Ye&&Xe(t.entries)?{version:Ye,entries:t.entries}:t:null}catch{return null}},tt=(e,t)=>{try{e.setItem(`yuri.gitBranchCache`,JSON.stringify(t))}catch{}},nt=(e,t,n)=>{let r=Ze(e);if(!r||!t)return null;let i;try{i=n.getItem(`yuri.gitBranchCache`)}catch{return null}let a=et(i);if(!a)return null;if($e(a))return Qe(a.entries[Y(t,r)])?a.entries[Y(t,r)]:null;let o={};for(let[e,n]of Object.entries(a)){let r=Ze(e);r&&Qe(n)&&(o[Y(t,r)]=n)}return tt(n,{version:Ye,entries:o}),o[Y(t,r)]??null},rt=(e,t,n,r)=>{let i=Ze(e);if(!i||!t||!Qe(n))return;let a=null;try{a=r.getItem(`yuri.gitBranchCache`)}catch{return}let o=et(a);tt(r,{version:Ye,entries:{...o&&$e(o)?o.entries:{},[Y(t,i)]:n}})},it=3e4,X=Ze,at=(e,t=n())=>x.git.branches(X(e),t),ot=(e,t=n())=>x.git.remotes(X(e),t),st=async(e,t,n)=>{n.throwIfAborted();let r=i()?.git,a=t?.getGitBranches?await t.getGitBranches(e,{signal:n}):r?await r.getGitBranches(e,{signal:n}):await f(e,{signal:n});return n.throwIfAborted(),a},ct=async(e,t,n)=>{n.throwIfAborted();let r=i()?.git,a=t?.getRemotes?await t.getRemotes(e,{signal:n}):r?await r.getRemotes(e,{signal:n}):await u(e,{signal:n});return n.throwIfAborted(),a},lt=(e,t,r=n(),i=g())=>{let a=X(e),o=t;return{queryKey:at(a,r),queryFn:async({signal:e})=>{if(!a)throw Error(`Git branches require a directory`);let t=await st(a,o,e);return rt(a,r,t,i),t},staleTime:it,gcTime:1/0,initialData:()=>nt(a,r,i)??void 0,initialDataUpdatedAt:0}},ut=(e,t,r=n())=>{let i=X(e),a=t;return{queryKey:ot(i,r),queryFn:({signal:e})=>{if(!i)throw Error(`Git remotes require a directory`);return ct(i,a,e)},staleTime:it,gcTime:1/0}},dt=(e,r,i)=>{let a=(0,V.c)(9),o=i===void 0||i,s=F.useSyncExternalStore(t,n,n),c,l,u;a[0]!==e||a[1]!==r||a[2]!==s?(c=X(e),u=y,l=lt(c,r,s),a[0]=e,a[1]=r,a[2]=s,a[3]=c,a[4]=l,a[5]=u):(c=a[3],l=a[4],u=a[5]);let d=o&&!!c,f;return a[6]!==l||a[7]!==d?(f={...l,enabled:d},a[6]=l,a[7]=d,a[8]=f):f=a[8],u(f)},ft=(e,r,i)=>{let a=(0,V.c)(9),o=i===void 0||i,s=F.useSyncExternalStore(t,n,n),c,l,u;a[0]!==e||a[1]!==r||a[2]!==s?(c=X(e),u=y,l=ut(c,r,s),a[0]=e,a[1]=r,a[2]=s,a[3]=c,a[4]=l,a[5]=u):(c=a[3],l=a[4],u=a[5]);let d=o&&!!c,f;return a[6]!==l||a[7]!==d?(f={...l,enabled:d},a[6]=l,a[7]=d,a[8]=f):f=a[8],u(f)},pt=(e,t,r=b,i=n())=>r.fetchQuery(lt(e,t,i)),mt=(e,t,r=b,i=n())=>r.fetchQuery({...lt(e,t,i),staleTime:0}),ht=e=>e instanceof Error?e.name===`AbortError`||e.name===`CancelledError`||e.name===`Error`&&e.message===`CancelledError`:!1,gt=1e4,_t=6e4,vt=5e3,yt=3e4,bt=6e4,xt=25,St=40,Ct=2,wt=15e3,Tt=500,Et=30,Dt=20971520,Ot=new Map,kt=new Map,At=new Map,jt=new Map,Mt=new Map,Nt=(e,t)=>`${t}:${e}`,Pt=e=>kt.get(e)??0,Ft=e=>{let t=Pt(e)+1;return kt.set(e,t),t},It=e=>{let t=(At.get(e)??0)+1;return At.set(e,t),t},Lt=e=>{let t=Ot.get(e);if(t)return t;let n=new Set;return Ot.set(e,n),n},Z=()=>({isGitRepo:null,status:null,branches:null,branchesTransportIdentity:null,log:null,identity:null,diffCache:new Map,indexRevision:0,lastRepoCheckAt:0,lastStatusFetch:0,lastStatusChange:0,lastLogFetch:0,lastBranchesFetch:0,lastIdentityFetch:0,logMaxCount:25,isLoadingStatus:!1,isLoadingLog:!1,isLoadingBranches:!1,isLoadingIdentity:!1}),Rt=(e,t=Et,n=Dt)=>{let r=0;for(let t of e.values())r+=(t.original?.length??0)+(t.modified?.length??0);if(e.size<=t&&r<=n)return e;let i=Array.from(e.entries()).sort((e,t)=>e[1].fetchedAt-t[1].fetchedAt),a=new Map,o=0;for(let e=i.length-1;e>=0;e--){let[r,s]=i[e],c=(s.original?.length??0)+(s.modified?.length??0);if(a.size>=t)break;o+c>n&&a.size>0||(a.set(r,s),o+=c)}return a},zt=(e,t)=>{if(!e&&!t)return!1;if(!e||!t)return!0;let n=new Set([...Object.keys(e),...Object.keys(t)]);for(let r of n){let n=e[r],i=t[r];if(!(!n&&!i)&&(!n||!i||n.insertions!==i.insertions||n.deletions!==i.deletions))return!0}return!1},Bt=(e,t)=>!e&&!t?!1:!e||!t||e.remote!==t.remote||e.branch!==t.branch||e.ahead!==t.ahead||e.behind!==t.behind,Vt=(e,t)=>{if(!e&&!t)return!1;if(!e||!t)return!0;let n=e.files??[],r=t.files??[];if(n.length!==r.length||e.ahead!==t.ahead||e.behind!==t.behind||e.current!==t.current||e.tracking!==t.tracking||e.isClean!==t.isClean||t.upstreamComparison!==void 0&&Bt(e.upstreamComparison,t.upstreamComparison))return!0;let i=new Set(n.map(e=>`${e.path}:${e.index}:${e.working_dir}`));for(let e of r)if(!i.has(`${e.path}:${e.index}:${e.working_dir}`))return!0;return!!(t.diffStats!==void 0&&zt(e.diffStats,t.diffStats))},Ht=(e,t)=>{let n=new Set;if(!t)return n;let r=e?.files??[],i=t.files??[],a=new Map(r.map(e=>[e.path,e])),o=new Map(i.map(e=>[e.path,e])),s=new Set([...a.keys(),...o.keys()]);for(let e of s){let t=a.get(e),r=o.get(e);if(!t||!r){n.add(e);continue}if(t.index!==r.index||t.working_dir!==r.working_dir){n.add(e);continue}}if(t.diffStats!==void 0){let r=e?.diffStats??{},i=t.diffStats??{},a=new Set([...Object.keys(r),...Object.keys(i)]);for(let e of a){let t=r[e],a=i[e];if(!t||!a){n.add(e);continue}(t.insertions!==a.insertions||t.deletions!==a.deletions)&&n.add(e)}}return n},Ut=(e,t)=>{if(!e&&!t)return!1;if(!e||!t)return!0;let n=e.files??[],r=t.files??[],i=e=>{let t=e?.trim()??``;return t===`?`?``:t},a=new Map(n.map(e=>[e.path,i(e.index)])),o=new Map(r.map(e=>[e.path,i(e.index)])),s=new Set([...a.keys(),...o.keys()]);for(let e of s)if((a.get(e)??``)!==(o.get(e)??``))return!0;return!1},Wt=e=>!e||e.trim().length===0,Gt=e=>(e||``).trim()===`U`,Kt=e=>{let t=(e.index||``).trim(),n=(e.working_dir||``).trim();if(Gt(t)||Gt(n))return e;let r=t===`?`||n===`?`?`A`:t||n||` `;return{...e,index:r,working_dir:` `}},qt=e=>{let t=(e.index||``).trim(),n=(e.working_dir||``).trim();if(Gt(t)||Gt(n))return e;let r=n||(t===`A`||t===`?`?`?`:t)||` `;return{...e,index:` `,working_dir:r}},Jt=e=>Wt(e.index)&&Wt(e.working_dir),Q=a()(s((e,t)=>({directories:new Map,activeDirectory:null,setActiveDirectory:n=>{let{activeDirectory:r,directories:i}=t();if(r!==n)if(r&&Ft(r),n&&Ft(n),n&&!i.has(n)){let t=new Map(i);t.set(n,Z()),e({activeDirectory:n,directories:t})}else e({activeDirectory:n})},getDirectoryState:e=>t().directories.get(e)??null,fetchStatus:async(n,r,i={})=>{let a=i.mode??`full`,o=Nt(n,a),s=jt.get(o)??(a===`light`?jt.get(Nt(n,`full`)):void 0);if(s)return s;let c=(async()=>{let{silent:a=!1}=i,{directories:o}=t(),s=o.get(n);if(s||=Z(),!a){let r=new Map(t().directories),i=r.get(n)??Z();r.set(n,{...i,isLoadingStatus:!0}),e({directories:r})}let c=!1;try{let a=Date.now(),o=s.isGitRepo!==!0||a-(s.lastRepoCheckAt||0)>_t,l=s.isGitRepo===!0;if(o&&(l=await r.checkIsGitRepository(n)),!l){let r=new Map(t().directories),i=r.get(n)??s;return r.set(n,{...i,isGitRepo:!1,status:null,isLoadingStatus:!1,lastRepoCheckAt:a,lastStatusFetch:a}),e({directories:r}),!1}let u=await r.getGitStatus(n,i.mode?{mode:i.mode}:void 0);if(Vt(s.status,u)){c=!0;let r=new Map(t().directories),i=r.get(n)??Z(),s=Ht(i.status,u),l=Ut(i.status,u),d=new Set((i.status?.files??[]).map(e=>e.path)),f=new Set((u.files??[]).map(e=>e.path)),p=new Map(i.diffCache);for(let e of d)f.has(e)||p.delete(e);for(let e of s)p.delete(e);let m=s.size>0;m&&Ft(n);let h={...u,diffStats:u.diffStats===void 0&&i.status?.diffStats!==void 0?i.status.diffStats:u.diffStats,upstreamComparison:u.upstreamComparison===void 0?i.status?.upstreamComparison:u.upstreamComparison};r.set(n,{...i,isGitRepo:!0,status:h,diffCache:p,indexRevision:l?i.indexRevision+1:i.indexRevision,lastRepoCheckAt:o?a:i.lastRepoCheckAt,lastStatusFetch:Date.now(),lastStatusChange:m?Date.now():i.lastStatusChange}),e({directories:r})}else{let r=new Map(t().directories),i=r.get(n)??Z();r.set(n,{...i,isGitRepo:!0,lastRepoCheckAt:o?a:i.lastRepoCheckAt,lastStatusFetch:Date.now(),lastStatusChange:i.lastStatusChange}),e({directories:r})}}catch(e){console.error(`Failed to fetch git status:`,e)}finally{if(!a){let r=new Map(t().directories),i=r.get(n)??Z();r.set(n,{...i,isLoadingStatus:!1}),e({directories:r})}}return c})();jt.set(o,c);try{return await c}finally{jt.get(o)===c&&jt.delete(o)}},moveStatusPathsOptimistically:(n,r,i)=>{let a=new Set(r.map(e=>e.trim()).filter(Boolean));if(a.size===0)return null;let{directories:o}=t(),s=o.get(n),c=s?.status??null;if(!s||!c)return c;let l=!1,u=[];for(let e of c.files){if(!a.has(e.path)){u.push(e);continue}let t=i===`stage`?Kt(e):qt(e);t!==e&&(l=!0),Jt(t)?l=!0:u.push(t)}if(!l)return c;let d=new Map(o);return d.set(n,{...s,status:{...c,files:u,isClean:u.length===0},indexRevision:s.indexRevision+1,lastStatusChange:Date.now()}),e({directories:d}),c},restoreStatus:(n,r)=>{let{directories:i}=t(),a=i.get(n);if(!a)return;let o=new Map(i);o.set(n,{...a,status:r,indexRevision:a.indexRevision+1,lastStatusChange:Date.now()}),e({directories:o})},bumpIndexRevision:n=>{let{directories:r}=t(),i=r.get(n);if(!i)return;let a=new Map(r);a.set(n,{...i,indexRevision:i.indexRevision+1}),e({directories:a})},fetchBranches:async(r,i,a={})=>{let o=n(),s=It(r);{let n=new Map(t().directories),i=n.get(r)??Z();n.set(r,{...i,isLoadingBranches:!0}),e({directories:n})}try{let c=a.force?await mt(r,i,void 0,o):await pt(r,i,void 0,o);if(s!==At.get(r)||o!==n())return;let l=new Map(t().directories),u=l.get(r)??Z();l.set(r,{...u,branches:c,branchesTransportIdentity:o,isLoadingBranches:!1,lastBranchesFetch:Date.now()}),e({directories:l})}catch(i){if(ht(i)||console.error(`Failed to fetch git branches:`,i),s!==At.get(r)||o!==n())return;let a=new Map(t().directories),c=a.get(r)??Z();a.set(r,{...c,isLoadingBranches:!1}),e({directories:a})}},fetchLog:async(n,r,i)=>{let{directories:a}=t(),o=a.get(n),s=i??o?.logMaxCount??25;{let r=new Map(t().directories),i=r.get(n)??Z();r.set(n,{...i,isLoadingLog:!0}),e({directories:r})}try{let i=await r.getGitLog(n,{maxCount:s}),a=new Map(t().directories),o=a.get(n)??Z();a.set(n,{...o,log:i,isLoadingLog:!1,lastLogFetch:Date.now(),logMaxCount:s}),e({directories:a})}catch(r){console.error(`Failed to fetch git log:`,r);let i=new Map(t().directories),a=i.get(n)??Z();i.set(n,{...a,isLoadingLog:!1}),e({directories:i})}},fetchIdentity:async(n,r)=>{{let r=new Map(t().directories),i=r.get(n)??Z();r.set(n,{...i,isLoadingIdentity:!0}),e({directories:r})}try{let i=await r.getCurrentGitIdentity(n),a=new Map(t().directories),o=a.get(n)??Z();a.set(n,{...o,identity:i,isLoadingIdentity:!1,lastIdentityFetch:Date.now()}),e({directories:a})}catch(r){console.error(`Failed to fetch git identity:`,r);let i=new Map(t().directories),a=i.get(n)??Z();i.set(n,{...a,isLoadingIdentity:!1}),e({directories:i})}},fetchAll:async(n,r,i={})=>{let{directories:a}=t(),o=a.get(n);if(!o){o=Z();let t=new Map(a);t.set(n,o),e({directories:t})}let{force:s=!1,silentIfCached:c=!1}=i,l=Date.now();await t().fetchStatus(n,r,{silent:c&&!!o?.status});let u=t().directories.get(n);if(!u?.isGitRepo)return;await t().fetchBranches(n,r,{force:s});let d=l-(u.lastLogFetch||0);(s||d>gt||!u.log)&&await t().fetchLog(n,r),await t().fetchIdentity(n,r)},getDiff:(e,n)=>t().directories.get(e)?.diffCache.get(n)??null,setDiff:(n,r,i)=>{let a=new Map(t().directories),o=a.get(n)??Z(),s=new Map(o.diffCache);s.set(r,{...i,fetchedAt:Date.now()});let c=Rt(s);a.set(n,{...o,diffCache:c}),e({directories:a})},clearDiffCache:n=>{Ft(n);let r=new Map(t().directories),i=r.get(n);i&&(r.set(n,{...i,diffCache:new Map}),e({directories:r}))},fetchAllDiffs:async(e,n)=>{let r=t().directories.get(e);if(!r?.status?.files||r.status.files.length===0)return;let i=r.status.files.map(e=>e.path).slice(0,xt);await t().prefetchDiffs(e,n,i,{maxFiles:xt})},prefetchDiffs:async(n,r,i,a={})=>{let o=t().directories.get(n);if(!o?.status?.files||o.status.files.length===0||i.length===0)return;let{maxFiles:s=St}=a,c=new Set(o.status.files.map(e=>e.path)),l=o.status.diffStats,u=Lt(n),d=[],f=new Set;for(let e of i){if(!e||f.has(e)||(f.add(e),!c.has(e))||o.diffCache.has(e)||u.has(e))continue;let t=l?.[e];t&&t.insertions+t.deletions>Tt||d.push(e)}let p=d.slice(0,Math.max(1,s));if(p.length===0)return;let m=Pt(n);if(typeof document<`u`&&document.hidden)return;p.forEach(e=>u.add(e));let h=0,g=[],ee=()=>{let e=h;return h+=1,e<p.length?p[e]:null},_=async e=>{let t=r.getGitFileDiff(n,{path:e}),i=new Promise((e,t)=>{setTimeout(()=>t(Error(`Timed out after ${wt}ms`)),wt)}),a=await Promise.race([t,i]);return{path:e,diff:{original:a.original??``,modified:a.modified??``,isBinary:a.isBinary}}},v=async()=>{for(;;){if(m!==Pt(n))return;let e=ee();if(!e)return;try{g.push(await _(e))}catch{}finally{u.delete(e)}}},y=Math.min(Ct,p.length);if(await Promise.allSettled(Array.from({length:y},()=>v())),p.forEach(e=>u.delete(e)),m!==Pt(n))return;let b=new Map(t().directories),x=b.get(n);if(!x)return;let S=new Map(x.diffCache),te=Date.now();g.forEach(e=>{!e.diff.isBinary&&e.diff.original===``&&e.diff.modified===``||S.set(e.path,{...e.diff,fetchedAt:te})});let C=Rt(S);b.set(n,{...x,diffCache:C}),e({directories:b})},setLogMaxCount:(n,r)=>{let i=new Map(t().directories),a=i.get(n)??Z();i.set(n,{...a,logMaxCount:r}),e({directories:i})},ensureStatus:async(e,n)=>{let r=t().directories.get(e),i=Date.now();r?.status&&i-r.lastStatusFetch<vt||await t().fetchStatus(e,n,{silent:!!r?.status})},ensureAll:(e,n)=>{let r=Mt.get(e);if(r)return r;let i=(async()=>{let r=t().directories.get(e),i=Date.now();(!r?.status||r.status.diffStats===void 0||i-(r?.lastStatusFetch??0)>=vt)&&await t().fetchStatus(e,n,{silent:!!r?.status});let a=t().directories.get(e);if(!a?.isGitRepo)return;let o=[];(!a.branches||i-a.lastBranchesFetch>=yt)&&o.push(t().fetchBranches(e,n)),(!a.log||i-a.lastLogFetch>=gt)&&o.push(t().fetchLog(e,n)),(!a.identity||i-a.lastIdentityFetch>=bt)&&o.push(t().fetchIdentity(e,n)),o.length>0&&await Promise.all(o)})();return Mt.set(e,i),i.finally(()=>{Mt.get(e)===i&&Mt.delete(e)}),i},refresh:async(e,n={})=>{let{activeDirectory:r}=t();r&&await t().fetchAll(r,e,n)}}),{name:`git-store`})),Yt=e=>{let t=(0,V.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.status??null:null,t[0]=e,t[1]=n),Q(n)},Xt=e=>{let r=(0,V.c)(3),i=F.useSyncExternalStore(t,n,n),a;return r[0]!==e||r[1]!==i?(a=t=>{if(!e)return null;let n=t.directories.get(e);return n?.branchesTransportIdentity===i?n.branches:null},r[0]=e,r[1]=i,r[2]=a):a=r[2],Q(a)},Zt=e=>{let t=(0,V.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.log??null:null,t[0]=e,t[1]=n),Q(n)},Qt=e=>{let t=(0,V.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.isGitRepo??null:null,t[0]=e,t[1]=n),Q(n)},$t=e=>{let t=(0,V.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.status?.current?.trim()??null:null,t[0]=e,t[1]=n),Q(n)},en=e=>{let t=(0,V.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=new Map,t[0]=n):n=t[0];let r=F.useRef(n),i;return t[1]===e?i=t[2]:(i=t=>{let n=r.current,i=n.size===e.length;if(i)for(let r of e){let e=t.directories.get(r),a=n.get(r);if(!a||(e?.isGitRepo??null)!==a.isGitRepo||(e?.status?.current??null)!==a.branch){i=!1;break}}if(i)return n;let a=new Map;for(let n of e){let e=t.directories.get(n);a.set(n,{isGitRepo:e?.isGitRepo??null,branch:e?.status?.current??null})}return r.current=a,a},t[1]=e,t[2]=i),Q(i)},tn=e=>{let t=(0,V.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.isLoadingStatus??!1:!1,t[0]=e,t[1]=n),Q(n)},nn=e=>{let t=(0,V.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.isLoadingLog??!1:!1,t[0]=e,t[1]=n),Q(n)},rn=e=>{let t=(0,V.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.isLoadingBranches??!1:!1,t[0]=e,t[1]=n),Q(n)},an=e=>{let t=String(e||``).trim().replace(/^remotes\//,``);if(!t)return null;let n=t.indexOf(`/`);return n<=0||n>=t.length-1?null:{remote:t.slice(0,n),branch:t.slice(n+1)}},$=e=>String(e||``).trim().replace(/^refs\/heads\//,``).replace(/^heads\//,``).replace(/^remotes\//,``),on=e=>e.branchName?$(e.branchName):e.mode===`existing`?$(e.existingBranch||e.preferredName||``):$(e.preferredName||``),sn=async e=>{let t=await _e(e);try{let n=an((await he(e)).branches?.[t]?.tracking||null);if(n?.remote)return n.remote}catch{}try{let t=an((await ge(e)).tracking);if(t?.remote)return t.remote}catch{}return null},cn=async(e,t)=>{let n=await sn(e),r=$(t);return!n||!r?null:{setUpstream:!0,upstreamRemote:n,upstreamBranch:r}},ln=async(e,t,n)=>{let r=on(t),i=n?.resolvedRootTrackingRemote,a=i===void 0?await cn(e,r):i&&$(r)?{setUpstream:!0,upstreamRemote:i,upstreamBranch:$(r)}:null;return a?{...t,setUpstream:t.setUpstream??a.setUpstream,upstreamRemote:t.upstreamRemote||a.upstreamRemote,upstreamBranch:t.upstreamBranch||a.upstreamBranch}:t},un=async(e,t,n)=>{let r=await ln(e.path,t,n);return M(e,r)},dn=`yuri:lastWorktreeSourceBranch`,fn=({mode:e,sourceBranch:t,linkedPr:n,selectedBranch:r})=>e===`existing-branch`?r||null:n?null:t||null,pn=({branches:e,savedSourceBranch:t,rootBranch:n})=>t&&e.includes(t)&&t?{sourceBranch:t,shouldClearSavedSourceBranch:!1}:{sourceBranch:n&&e.includes(n)?n:e.includes(`main`)?`main`:e.includes(`master`)?`master`:e[0]??``,shouldClearSavedSourceBranch:!!t},mn=(e,t,n)=>{if(!e)return e;let r=t.length>0&&!/\s$/.test(t)&&!/^\s/.test(e)&&!/[([{]$/.test(t),i=n.length>0&&!/\s$/.test(e)&&!/^\s/.test(n)&&!/^[\])}.,;:!?]/.test(n);return`${r?` `:``}${e}${i?` `:``}`},hn=(e,t,n)=>{let r=mn(e,t,n);return`${t.length===0&&!/^\s/.test(r)?` `:``}${r}${n.length===0&&!/\s$/.test(r)?` `:``}`},gn=(e,t,n,r)=>{let i=e.slice(0,t),a=e.slice(n),o=hn(r,i,a),s=Math.max(0,o.indexOf(r)),c=i.length+s;return{text:`${i}${o}${a}`,caret:i.length+o.length,start:c,end:c+r.length}},_n=(e,t)=>{let n=e=>`${e.kind}:${e.value}:${e.range.start}:${e.range.end}`;return new Set(e.map(n)).has(n(t))||e.some(e=>e.range.start<t.range.end&&t.range.start<e.range.end)?[...e]:[...e,t]},vn=(e,t)=>t<e.length&&e[t]===` `?t+1:t;export{Ae as A,ft as C,Re as D,Be as E,Me as O,dt as S,Ve as T,en as _,dn as a,Qt as b,un as c,$t as d,Xt as f,Zt as g,tn as h,hn as i,Ee as j,je as k,sn as l,nn as m,_n as n,pn as o,rn as p,gn as r,fn as s,vn as t,ln as u,Yt as v,Je as w,mt as x,Q as y};