@yuriai/web 0.3.2-beta.7 → 0.3.3-beta.2
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/{AgentAvatar-Dy2D4-W_.js → AgentAvatar-tFfpSF5F.js} +1 -1
- package/dist/assets/{AssistantConversationSurface-BZwQoBD0.js → AssistantConversationSurface-B-iO-AUW.js} +3 -3
- package/dist/assets/{AssistantSessionCard-Cb5O68ez.js → AssistantSessionCard-DTPufGP2.js} +2 -2
- package/dist/assets/{AssistantUnreadBadge-Dv9HXPrS.js → AssistantUnreadBadge-BV2cbiJo.js} +1 -1
- package/dist/assets/{AssistantView-3fIzHGoU.js → AssistantView-iKt4ZcoR.js} +1 -1
- package/dist/assets/{DiagramView-zlrPK3wP.js → DiagramView-SHoXhtXa.js} +1 -1
- package/dist/assets/{FadeInOnReveal-Cb2cgQyM.js → FadeInOnReveal-4E61VUmD.js} +1 -1
- package/dist/assets/{GuiPluginPage-DX446Fgg.js → GuiPluginPage-Bt5j7vkr.js} +1 -1
- package/dist/assets/{GuiPluginSurface-C34vXd2R.js → GuiPluginSurface-Bs9Pauc8.js} +1 -1
- package/dist/assets/{GuiPluginWindow-BUM2P90L.js → GuiPluginWindow-cnUkWFge.js} +1 -1
- package/dist/assets/{Icon-o1bRhUil.js → Icon-DebSeH2D.js} +1 -1
- package/dist/assets/{ImageLoadingPlaceholder-BS9Swwfz.js → ImageLoadingPlaceholder-BBMhxtKr.js} +1 -1
- package/dist/assets/{LoadingImage-DDafrpn6.js → LoadingImage-6BZsPXXb.js} +1 -1
- package/dist/assets/{MarkdownRenderer-BOLzT07h.js → MarkdownRenderer-Bjl6sXps.js} +2 -2
- package/dist/assets/{MarkdownRendererImpl-BWmWJyQD.js → MarkdownRendererImpl-tZSoVcrU.js} +1 -1
- package/dist/assets/{MarkstreamRendererImpl-MwrM60DK.js → MarkstreamRendererImpl-Br2_lE4f.js} +1 -1
- package/dist/assets/{MobileDetailNavigation-CS3FdXMF.js → MobileDetailNavigation-B7vAsqVU.js} +1 -1
- package/dist/assets/MobileResizableSheet-BJs0jEqn.js +1 -0
- package/dist/assets/{MobileShareBridge-C7SsPeA-.js → MobileShareBridge-Cb9GvxGv.js} +1 -1
- package/dist/assets/{MobileSurface-BkMJ0lqS.js → MobileSurface-BaT1L70D.js} +1 -1
- package/dist/assets/{MultiRunWindow-BkVFZYQl.js → MultiRunWindow-DPM25lxz.js} +1 -1
- package/dist/assets/{OnboardingScreen-EMj1BesS.js → OnboardingScreen-D7ns1Tb2.js} +1 -1
- package/dist/assets/{OverlayScrollbar-mTdNvI2t.js → OverlayScrollbar-B1PH1Jtv.js} +1 -1
- package/dist/assets/{RemoteAssistantSessionCard-CNBayb0p.js → RemoteAssistantSessionCard-BLp9NZhL.js} +1 -1
- package/dist/assets/{SettingsView-BkXX1yqx.js → SettingsView-CaC2DI4Z.js} +3 -3
- package/dist/assets/{SettingsWindow-DEVIOawn.js → SettingsWindow-gVPRXQDh.js} +1 -1
- package/dist/assets/{SetupTourDialog-DpDXKEev.js → SetupTourDialog-BoQIvdEP.js} +1 -1
- package/dist/assets/{TerminalView-BwZd8np-.js → TerminalView-CxlIRxha.js} +1 -1
- package/dist/assets/{ToolOutputDialog-C7FT1uPc.js → ToolOutputDialog-Bsx1wpVW.js} +1 -1
- package/dist/assets/{VoiceSettings-BrAyJv-I.js → VoiceSettings-DhA9feRU.js} +1 -1
- package/dist/assets/{YuriLogo-DNvrroBa.js → YuriLogo-BKdnDJwl.js} +1 -1
- package/dist/assets/{YuriWordmark-bJX68f2Y.js → YuriWordmark-D2e-o9nW.js} +1 -1
- package/dist/assets/{assistant-attachment-cache-zu9sz4ex.js → assistant-attachment-cache-BYvIyn1x.js} +1 -1
- package/dist/assets/{capgoAdapter-CPyV4o5H.js → capgoAdapter-vj-M8YQp.js} +1 -1
- package/dist/assets/{checkbox-BcJaF7Fw.js → checkbox-DVMeOiMB.js} +1 -1
- package/dist/assets/{client-CgAFd1ew.js → client-CzjApAA4.js} +4 -4
- package/dist/assets/{collapsible-ChjJre3f.js → collapsible-D_R6x2Q_.js} +1 -1
- package/dist/assets/{context-menu-BRBPOV2F.js → context-menu-BFDbtdmK.js} +1 -1
- package/dist/assets/{desktopHosts-135cuRCE.js → desktopHosts-BsTrBVja.js} +1 -1
- package/dist/assets/{desktopRelayRestore-1aUztDPU.js → desktopRelayRestore-BxbRKak_.js} +1 -1
- package/dist/assets/{device-C8ZHblkr.js → device-BlmHHWT1.js} +1 -1
- package/dist/assets/{diagram-BhOF-6FQ.js → diagram-CrjNCLmc.js} +1 -1
- package/dist/assets/{dialog-BSyXr9ua.js → dialog-CHzvxSP4.js} +1 -1
- package/dist/assets/{fileMentionTouchSelection-DSXpR_Hq.js → fileMentionTouchSelection-D9GbR7zD.js} +1 -1
- package/dist/assets/{fileReferenceActions-DX-Stroq.js → fileReferenceActions-DLTUzjwi.js} +1 -1
- package/dist/assets/{gitApi--F7MdPg9.js → gitApi-i_uT8MNk.js} +1 -1
- package/dist/assets/gitApiHttp-BgUDBfaJ.js +3 -0
- package/dist/assets/{gui-BMN3-WPc.js → gui-KxRdG4j0.js} +1 -1
- package/dist/assets/{historyImportQueries-eR7Bj6VN.js → historyImportQueries-DiGQ8duS.js} +1 -1
- package/dist/assets/{host-iM7aLAip.js → host-BBp7NPZz.js} +1 -1
- package/dist/assets/{i18n-OsFhnlRH.js → i18n-BvjeIWrT.js} +1 -1
- package/dist/assets/{image-loading-ZB1bYt51.js → image-loading-Dlh4FIPJ.js} +1 -1
- package/dist/assets/{input-Daki_y8O.js → input-Ck9_Qln_.js} +1 -1
- package/dist/assets/{input-store-DRTu4uZc.js → input-store-wWToFdzi.js} +1 -1
- package/dist/assets/{insertionBoundaries-CnhjXWsd.js → insertionBoundaries-BFmZupL3.js} +1 -1
- package/dist/assets/main-RbzEHxam.js +169 -0
- package/dist/assets/{main-CALE45ey.js → main-_RMi6lwy.js} +2 -2
- package/dist/assets/{markdownHeightCache-Dn_Jkp0n.js → markdownHeightCache-CnLR3-I2.js} +1 -1
- package/dist/assets/{mcpQueries-DB6aJ5RI.js → mcpQueries-MmcRk0_G.js} +1 -1
- package/dist/assets/miniChat-CEE6OnLk.js +2 -0
- package/dist/assets/mobile-Cc6EYN5S.js +2 -0
- package/dist/assets/{mobileBackNavigation-CeY46TEx.js → mobileBackNavigation-C6UPWCkI.js} +1 -1
- package/dist/assets/{mobileConnections-BjLYzK32.js → mobileConnections-D8TC3-vN.js} +2 -2
- package/dist/assets/{multirun-DV_l3huB.js → multirun-BJgG4Ymw.js} +1 -1
- package/dist/assets/{native-config-CaDwggks.js → native-config-JMwpif8a.js} +1 -1
- package/dist/assets/{navigation-BjCFktgT.js → navigation-toBhZ-X8.js} +2 -2
- package/dist/assets/{openRemoteProjectSession-C3jFz6kb.js → openRemoteProjectSession-BD2tHXKw.js} +1 -1
- package/dist/assets/{platform-wF65ZFgV.js → platform-CiUKDeXd.js} +1 -1
- package/dist/assets/{project-preview-BhNspxqe.js → project-preview-BjTq299L.js} +1 -1
- package/dist/assets/{projectActions-50e_f9dI.js → projectActions-BPmI9_mW.js} +1 -1
- package/dist/assets/{projectMeta-CwdDc3V4.js → projectMeta-Bh7dUtdB.js} +1 -1
- package/dist/assets/{prompt-attachment-upload-8bssUUT3.js → prompt-attachment-upload-Bem87nmm.js} +1 -1
- package/dist/assets/{pwa-QoTHytgl.js → pwa-B2AKIaf6.js} +2 -2
- package/dist/assets/qoder-zGvP_RLr.svg +5 -0
- package/dist/assets/queue-abort-optimistic-BizaMpYT.js +1 -0
- package/dist/assets/{react-ChbBD2fG.js → react-DeCzn0Uc.js} +1 -1
- package/dist/assets/readiness-CekKZ6au.js +2 -0
- package/dist/assets/{reference-history-BBLJypsd.js → reference-history-cPgFTsku.js} +1 -1
- package/dist/assets/{remote-input-store-DFBMyVS-.js → remote-input-store-BvlOGMu_.js} +1 -1
- package/dist/assets/{remoteProjectQueries-8giIAvzL.js → remoteProjectQueries-yX3kOkR6.js} +1 -1
- package/dist/assets/{remoteSessionReference-BHBerOUy.js → remoteSessionReference-Da4ThgtH.js} +1 -1
- package/dist/assets/{renderElectronMiniChatApp-Yryt2r9g.js → renderElectronMiniChatApp-CmmEVsXV.js} +2 -2
- package/dist/assets/renderMobileApp-D1D1s_ia.js +29 -0
- package/dist/assets/{runtime-auth-mjIpsk3N.js → runtime-auth-DA-qfGHk.js} +1 -1
- package/dist/assets/{runtime-fetch-DKZOpfzo.js → runtime-fetch-V-iMWR8t.js} +1 -1
- package/dist/assets/{runtime-file-download-Dc459c9e.js → runtime-file-download-DxL4XbME.js} +1 -1
- package/dist/assets/{runtime-file-resource-DnhWnndu.js → runtime-file-resource-CKQQEwNv.js} +1 -1
- package/dist/assets/{runtime-switch-BMjl5Y5W.js → runtime-switch-DEPKHgdL.js} +1 -1
- package/dist/assets/{runtimeConfig-CsJ6iub-.js → runtimeConfig-CPU1CoUI.js} +1 -1
- package/dist/assets/runtimeEndpointReset-Bwa7I9vS.js +151 -0
- package/dist/assets/{scheduledTaskNavigation-Bi7sRiFW.js → scheduledTaskNavigation-CdBHn9ti.js} +1 -1
- package/dist/assets/{select-D_jd65HO.js → select-BnDfHG_T.js} +1 -1
- package/dist/assets/{sessionLookup-BUyzfxAJ.js → sessionLookup-mQtUvdep.js} +1 -1
- package/dist/assets/{sortable-tabs-strip-DMwkOrM-.js → sortable-tabs-strip-BwnT5maB.js} +1 -1
- package/dist/assets/{speechSettingsQueries-CJ3jPRqV.js → speechSettingsQueries-mH-OoFPq.js} +1 -1
- package/dist/assets/src-2lmG4z55.css +2 -0
- package/dist/assets/{terminalApi-eR_918UZ.js → terminalApi-CwTOFYhX.js} +1 -1
- package/dist/assets/{textarea-DwisQCE_.js → textarea-CVswImHY.js} +1 -1
- package/dist/assets/{tooltip-DloXgI9f.js → tooltip-DovnVenD.js} +1 -1
- package/dist/assets/{types-sn47BK8u.js → types-CnPxR5yQ.js} +1 -1
- package/dist/assets/{useAppFontEffects-zienz2u_.js → useAppFontEffects-wm0ojvh7.js} +62 -62
- package/dist/assets/{useAssistantUIStore-CphyXHEY.js → useAssistantUIStore-CI42fWZh.js} +1 -1
- package/dist/assets/{useDesktopWindowControlsLayout-VfqGsgdB.js → useDesktopWindowControlsLayout-BBizNJUb.js} +1 -1
- package/dist/assets/{useDictation-Do12BpsS.js → useDictation-OLmxagFb.js} +1 -1
- package/dist/assets/{useEffectiveDirectory-DtDqspBR.js → useEffectiveDirectory-BN5qbhev.js} +1 -1
- package/dist/assets/{useFontPreferences-DFF-uEAD.js → useFontPreferences-DN1mCOsX.js} +1 -1
- package/dist/assets/{useMobileHtmlPreviewStore-DUquFMmd.js → useMobileHtmlPreviewStore-DzzgY1eS.js} +1 -1
- package/dist/assets/{useMobileNavigationStore-BkVbj6Lg.js → useMobileNavigationStore-oveTY29a.js} +12 -12
- package/dist/assets/{usePluginsStore-BRtWcKUj.js → usePluginsStore-DErHgEFY.js} +1 -1
- package/dist/assets/{useProjectRuntimeAPIs-BbjZTtP4.js → useProjectRuntimeAPIs-B-ShHy6s.js} +1 -1
- package/dist/assets/{useStreamingTextThrottle-DMhoKnTy.js → useStreamingTextThrottle-BOvHQRrH.js} +1 -1
- package/dist/assets/{useUIStore-CYex4rbF.js → useUIStore-DjizmHAt.js} +1 -1
- package/dist/index.html +20 -20
- package/dist/mini-chat.html +20 -20
- package/dist/mobile.html +2 -2
- package/package.json +1 -1
- package/server/lib/gui-network/DOCUMENTATION.md +9 -1
- package/server/lib/realtime-proxy.js +4 -2
- package/server/lib/realtime-proxy.test.js +5 -4
- package/server/lib/relay/tunnel-host.js +15 -5
- package/server/lib/relay/tunnel-host.test.js +24 -0
- package/server/lib/remote-hosts/DOCUMENTATION.md +15 -2
- package/server/lib/remote-hosts/gateway.js +14 -4
- package/server/lib/remote-hosts/routes.js +9 -1
- package/server/lib/remote-hosts/routes.test.js +137 -7
- package/server/lib/remote-hosts/transport.js +1 -1
- package/server/lib/session-index/DOCUMENTATION.md +3 -0
- package/server/lib/session-index/service.js +4 -4
- package/server/lib/ui-auth/ui-auth.js +1 -1
- package/server/lib/ui-auth/ui-auth.test.js +3 -0
- package/dist/assets/MobileResizableSheet-Dkx27OGR.js +0 -1
- package/dist/assets/gitApiHttp-BEMPJCIG.js +0 -3
- package/dist/assets/main-DEQdAD0s.js +0 -169
- package/dist/assets/miniChat-VUMSA5V6.js +0 -2
- package/dist/assets/mobile-CiuyBKXM.js +0 -2
- package/dist/assets/queue-abort-optimistic-Bvno7WIB.js +0 -1
- package/dist/assets/readiness-C9buUgS7.js +0 -2
- package/dist/assets/renderMobileApp-f7DiCkl1.js +0 -29
- package/dist/assets/runtimeEndpointReset-CWAGENV5.js +0 -151
- package/dist/assets/src-DRyZ4dLj.css +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t,i as n}from"./runtime-switch-BMjl5Y5W.js";import{R as r,l as i,u as a}from"./platform-wF65ZFgV.js";import{a as o,i as s,r as c}from"./vendor-zustand-CNn3HHhT.js";import{ot as l,st as u}from"./vendor-base-ui-fom6orB6.js";import{St as d,an as f,jt as p,on as m}from"./gitApiHttp-BEMPJCIG.js";import{t as h}from"./safeStorage-DTOhKN0V.js";import{i as g,t as _}from"./vendor-pathe-vBmvQE8f.js";import{n as v}from"./vendor-react-D5BntRmA.js";import{s as y,u as b}from"./vendor-tanstack-react-query-ChSd65dm.js";import{E as x}from"./runtime-file-resource-DnhWnndu.js";import{o as S}from"./path-utils-jGozTg9d.js";import{r as C}from"./vendor-reactuses-core-B8s-Rcd-.js";import{r as w}from"./useUIStore-CYex4rbF.js";import{t as T}from"./i18n-OsFhnlRH.js";import{Ca as E,Gn as D,Ha as O,Ia as k,Jn as A,R as ee,Rn as j,Va as te,Xn as M,Zi as N,fa as ne,fi as P,lt as re,p as F,v as I,x as L,yi as ie,yt as ae}from"./useMobileNavigationStore-BkVbj6Lg.js";import{s as oe}from"./remoteProjectQueries-8giIAvzL.js";import{a as se,g as ce,o as le,p as ue,s as de}from"./fileMentionAutocompleteState-BZJqfgae.js";import{t as fe}from"./AgentAvatar-Dy2D4-W_.js";import{n as R}from"./Icon-o1bRhUil.js";import{l as pe,s as me}from"./gitApi--F7MdPg9.js";import{c as he,d as ge,l as _e,n as ve,r as ye,t as be}from"./fileMentionTouchSelection-DSXpR_Hq.js";import{n as xe}from"./textarea-DwisQCE_.js";import{f as Se,o as Ce}from"./projectMeta-CwdDc3V4.js";var z=(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=ce([...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)},B=(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}),V=(e,t)=>e.highlightedIndex===t.highlightedIndex&&B(e.rows,t.rows),we=(e,t)=>B(e,t)?e:t.slice(),Te=(e,t,n)=>{e&&(t.current&&V(t.current,n)||(t.current=n,e(n)))},Ee=(e,t)=>{t.current=null,e?.({rows:[],highlightedIndex:0})},H=e(u(),1),U=v(),De=e=>e.directories.flatMap(e=>e.sessions),Oe=(e,t)=>({...oe(e,t.location.hostId),select:De}),ke=async(e,t,n)=>{n.sdk();let r=await e.fetchQuery(Oe(t,n));return n.sdk(),De(r)},Ae=(e,t,n,r)=>{n.sdk();let i=e.getQueryData(Oe(t,n).queryKey);for(let e of i?.directories??[]){let t=e.sessions.find(e=>e.id===r);if(t)return t.title||r}return r},je=(e,t,n,r={})=>({queryKey:[...e.queryScope,`composer-files`,t,n,r],staleTime:3e4,gcTime:3e4,queryFn:async({signal:i})=>{let a=await e.sdk().file.find({query:t,location:{directory:e.location.directory},limit:n,type:r.type},{signal:i});if(e.sdk(),i.throwIfAborted(),!Array.isArray(a.data))throw Error(`File search returned no data`);return a.data.map(t=>{let n=g(t.path),r=_(n);return{name:r,path:S(e.location.directory,n),relativePath:n,extension:r.includes(`.`)?r.split(`.`).pop()?.toLowerCase():void 0,isDirectory:t.type===`directory`}})}}),W=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},G=e=>/^[A-Za-z]:\//.test(e)?e.toLowerCase():e,K=e=>e.startsWith(`yuri-remote-location:`)?i(e):W(e),q=(e,t)=>{let n=W(a(t,`local`).directory),r=W(e);if(!n||!r)return!1;let i=G(n),o=G(r);return o===i||o.startsWith(i.endsWith(`/`)?i:`${i}/`)},Me=e=>{if(!e||typeof e!=`object`)return{};let t=e,n={};for(let[e,r]of Object.entries(t)){let t;try{t=K(e)}catch{continue}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=>W(e)).filter(e=>q(e,t)))):[],o=Array.isArray(i.expandedPaths)?Array.from(new Set(i.expandedPaths.filter(e=>typeof e==`string`).map(e=>W(e)).filter(e=>q(e,t)))):[],s=typeof i.selectedPath==`string`?W(i.selectedPath):null,c=s&&q(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])),i=u.selectedPath??c??e[0]??null;n[t]={openPaths:e,selectedPath:i,expandedPaths:r,touchedAt:Math.max(u.touchedAt,l)};continue}n[t]={openPaths:a,selectedPath:c,expandedPaths:o,touchedAt:l}}return n},J=(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},Y=e=>e?{...e,touchedAt:Date.now()}:{openPaths:[],selectedPath:null,expandedPaths:[],touchedAt:Date.now()},Ne=o()(c(s((e,t)=>({byRoot:{},addOpenPath:(t,n,r)=>{let i=K((t||``).trim()),a=W((n||``).trim());!i||!a||!r?.allowOutsideRoot&&!q(a,i)||e(e=>{let t=e.byRoot[i],n=Y(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:J({...e.byRoot,[i]:{...n,openPaths:o,selectedPath:s}},20)}})},removeOpenPath:(t,n)=>{let r=K((t||``).trim()),i=W((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=G(i),a=e=>G(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:J({...e.byRoot,[r]:{...t,openPaths:s,selectedPath:c,touchedAt:Date.now()}},20)}})},removeOpenPathsByPrefix:(t,n)=>{let r=K((t||``).trim()),i=W((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=G(i),a=n.endsWith(`/`)?n:`${n}/`,o=e=>{let t=G(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:J({...e.byRoot,[r]:{...t,openPaths:s,selectedPath:c,touchedAt:Date.now()}},20)}})},removeExpandedPathsByPrefix:(t,n)=>{let r=K((t||``).trim()),i=W((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=G(i),a=n.endsWith(`/`)?n:`${n}/`,o=t.expandedPaths.filter(e=>{let t=G(e);return t!==n&&!t.startsWith(a)});return o.length===t.expandedPaths.length?e:{byRoot:J({...e.byRoot,[r]:{...t,expandedPaths:o,touchedAt:Date.now()}},20)}})},setSelectedPath:(t,n,r)=>{let i=K((t||``).trim()),a=n?W(n.trim()):null;!i||a&&!r?.allowOutsideRoot&&!q(a,i)||e(e=>{let t=e.byRoot[i],n=Y(t),r=a&&!n.openPaths.includes(a)?[...n.openPaths,a]:n.openPaths;return t&&t.selectedPath===a&&r===t.openPaths?e:{byRoot:J({...e.byRoot,[i]:{...n,openPaths:r,selectedPath:a}},20)}})},ensureSelectedPath:e=>{let n=K((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=K((t||``).trim()),i=W((n||``).trim());!r||!i||!q(i,r)||e(e=>{let t=e.byRoot[r],n=Y(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:J({...e.byRoot,[r]:{...n,expandedPaths:a}},20)}})},expandPath:(t,n)=>{let r=K((t||``).trim()),i=W((n||``).trim());!r||!i||!q(i,r)||e(e=>{let t=e.byRoot[r],n=Y(t);return n.expandedPaths.includes(i)&&t?e:{byRoot:J({...e.byRoot,[r]:{...n,expandedPaths:[...n.expandedPaths,i]}},20)}})},expandPaths:(t,n)=>{let r=K((t||``).trim());if(!r||!n||n.length===0)return;let i=n.map(e=>W((e||``).trim())).filter(e=>e&&q(e,r));i.length!==0&&e(e=>{let t=e.byRoot[r],n=Y(t),a=new Set(n.expandedPaths),o=i.filter(e=>!a.has(e));return o.length===0?e:{byRoot:J({...e.byRoot,[r]:{...n,expandedPaths:[...n.expandedPaths,...o]}},20)}})}}),{name:`files-view-tabs-store`,version:2,storage:h(),migrate:e=>{if(!e||typeof e!=`object`)return{byRoot:{}};let t=e.byRoot;return{byRoot:Me(t)}},merge:(e,t)=>({...t,byRoot:Me(e&&typeof e==`object`?e.byRoot:void 0)}),partialize:e=>({byRoot:Me(e.byRoot)})}),{name:`files-view-tabs-store`})),Pe=(e,t)=>{let n=(0,U.c)(4),r=t===void 0?200:t,[i,a]=H.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]),H.useEffect(o,s),i},Fe=()=>{let e=(0,U.c)(17),t=F(Ie),n=ae(),r;e[0]===t?r=e[1]:(r=e=>t?e.getAttachment(t):void 0,e[0]=t,e[1]=r);let i=L(r),a=F(Le),o=F(Re),s=O(ze),c=O(Be),l=d(Ve);if(t){let r;e[2]===i?r=e[3]:(r=I(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 Ie(e){return e.currentSessionId}function Le(e){return e.worktreeMetadata}function Re(e){return e.newSessionDraft}function ze(e){return e.activeProjectId}function Be(e){return e.projects}function Ve(e){return e.currentDirectory}var X=l(),He=`bg-transparent font-[inherit] text-[var(--primary-base)]`,Ue=(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,X.jsx)(`mark`,{className:He,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},We=H.forwardRef((e,t)=>{let n=(0,U.c)(4),r=x(),i;return n[0]!==r||n[1]!==e||n[2]!==t?(i=r?.entry.location.hostId?(0,X.jsx)(Je,{...e,ref:t,entry:r.entry,registry:r.registry},JSON.stringify(r.entry.queryScope)):(0,X.jsx)(Ge,{...e,ref:t}),n[0]=r,n[1]=e,n[2]=t,n[3]=i):i=n[3],i}),Ge=H.forwardRef((e,t)=>{let n=(0,U.c)(22),r=Fe()??``,i=F(Xe),a=ie(Ze),o=!!e.onSessionSelect,s;n[0]===o?s=n[1]:(s={enabled:o},n[0]=o,n[1]=s);let c=ee(s),l=O(Qe),u=O($e),d;if(n[2]!==l||n[3]!==r||n[4]!==u){let e=u.find(e=>e.id===l)?.path||r;d=e?e.replace(/\\/g,`/`).replace(/\/+$/,``):null,n[2]=l,n[3]=r,n[4]=u,n[5]=d}else d=n[5];let f=d,m;n[6]===f?m=n[7]:(m=e=>f?e.byRoot[f]:void 0,n[6]=f,n[7]=m);let h=Ne(m),g=N(et),_=p(tt),v;n[8]!==a||n[9]!==c||n[10]!==e.onSessionSelect?(v=e.onSessionSelect?P(a,c):[],n[8]=a,n[9]=c,n[10]=e.onSessionSelect,n[11]=v):v=n[11];let y=v,b=e.currentSessionId??i,x;return n[12]!==g||n[13]!==r||n[14]!==f||n[15]!==h||n[16]!==e||n[17]!==t||n[18]!==_||n[19]!==y||n[20]!==b?(x=(0,X.jsx)(Ye,{...e,ref:t,currentDirectory:r,currentSessionId:b,projectRoot:f,projectTabs:h,agentCatalog:g,sessions:y,searchFiles:_}),n[12]=g,n[13]=r,n[14]=f,n[15]=h,n[16]=e,n[17]=t,n[18]=_,n[19]=y,n[20]=b,n[21]=x):x=n[21],x}),Ke=[],qe=[],Je=H.forwardRef((e,t)=>{let n=(0,U.c)(32),{entry:r,registry:i}=e,a=b(),o;n[0]===r?o=n[1]:(o=k(r.location.directory,void 0,r),n[0]=r,n[1]=o);let s=!!e.onAgentSelect,c;n[2]!==o||n[3]!==s?(c={...o,enabled:s},n[2]=o,n[3]=s,n[4]=c):c=n[4];let l=y(c),u;n[5]!==r||n[6]!==i?(u=Oe(i,r),n[5]=r,n[6]=i,n[7]=u):u=n[7];let d=!!e.onSessionSelect,f;n[8]!==u||n[9]!==d?(f={...u,enabled:d},n[8]=u,n[9]=d,n[10]=f):f=n[10];let p=y(f),m;n[11]===r.key?m=n[12]:(m=e=>e.byRoot[r.key],n[11]=r.key,n[12]=m);let h=Ne(m),g;n[13]!==a||n[14]!==r?(g=(e,t,n,i)=>{let o=n===void 0?60:n;return a.fetchQuery(je(r,t,o,i))},n[13]=a,n[14]=r,n[15]=g):g=n[15];let _=C(g),v=r.location.directory,x;if(n[16]!==r.location.directory){let e;n[18]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\/+$/,n[18]=e):e=n[18],x=r.location.directory.replace(/\\/g,`/`).replace(e,``),n[16]=r.location.directory,n[17]=x}else x=n[17];let S=l.data??qe,w=p.data??Ke,T=l.error??p.error,E;n[19]===r?E=n[20]:(E=()=>{r.sdk()},n[19]=r,n[20]=E);let D;return n[21]!==r.location.directory||n[22]!==h||n[23]!==e||n[24]!==t||n[25]!==_||n[26]!==S||n[27]!==w||n[28]!==T||n[29]!==E||n[30]!==x?(D=(0,X.jsx)(Ye,{...e,ref:t,currentDirectory:v,projectRoot:x,projectTabs:h,agentCatalog:S,sessions:w,searchFiles:_,catalogError:T,assertCurrent:E}),n[21]=r.location.directory,n[22]=h,n[23]=e,n[24]=t,n[25]=_,n[26]=S,n[27]=w,n[28]=T,n[29]=E,n[30]=x,n[31]=D):D=n[31],D}),Ye=H.forwardRef(({searchQuery:e,onFileSelect:t,onAgentSelect:n,onSkillSelect:r,onSessionSelect:i,onClose:a,style:o,onRowsChange:s,currentDirectory:c,currentSessionId:l,projectRoot:u,projectTabs:d,agentCatalog:p,sessions:h,searchFiles:g,catalogError:_,assertCurrent:v},y)=>{let{t:b}=T(),x=Pe(e,180),S=m(),O=f(),[k,A]=H.useState([]),[ee,te]=H.useState(!1),[M,N]=H.useState(null),[P,re]=H.useState(0),F=H.useRef(0),I=H.useRef({query:e,directory:c,ids:[]}),[L,ie]=H.useState(360),[ae,oe]=H.useState({}),[ce,pe]=H.useState({}),me=H.useRef([]),ge=H.useRef([]),_e=H.useRef([]),Se=H.useRef(null),Ce=H.useRef(null),z=H.useRef(null);z.current||=be();let B=w(e=>e.isMobile),V=(e??``).trim(),we=E({directory:c||null}),U=H.useMemo(()=>r?we.data??[]:[],[r,we.data]),De=H.useMemo(()=>{if(!u||!d)return[];let e=[d.selectedPath,...d.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(`${u}/`)?e.slice(u.length+1):e;n.push({name:i,path:e,relativePath:a,extension:i.includes(`.`)?i.split(`.`).pop()?.toLowerCase():void 0})}return de(n,V,{limit:6})},[V,u,d]),Oe=H.useMemo(()=>n?ne(p).filter(e=>e.mode!==`primary`):[],[p,n]),ke=H.useMemo(()=>i?se({sessions:h,currentSessionId:l??null,searchQuery:V}):[],[h,l,V,i]),Ae=De,je=k,W=H.useMemo(()=>he({skills:U,agents:Oe,sessions:ke,recentFiles:Ae,pathHits:je,searchQuery:V,untitledSession:b(`chat.fileMentionAutocomplete.untitledSession`),sessionBadge:b(`chat.fileMentionAutocomplete.sessionType`),skillBadge:b(`chat.commandAutocomplete.badge.skill`)}),[U,Oe,ke,Ae,je,V,b]);H.useEffect(()=>{let e=e=>{let t=e.target;!t||!Se.current||Se.current.contains(t)||a()};return document.addEventListener(`pointerdown`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0)}},[a]),H.useEffect(()=>{if(!c){A([]),te(!1),N(null);return}let e=(x??``).trim(),t=ue(e);if(!t){A([]),te(!1),N(null);return}let n=!1;te(!0),N(null);let r={includeHidden:S,respectGitignore:!O};return Promise.all([g(c,t,80,{...r,type:`file`}),g(c,t,40,{...r,type:`directory`})]).then(([t,r])=>{if(n)return;let i=new Set(De.map(e=>e.path));A(le({files:t,directories:r,query:e,excludePaths:i,limit:20}))}).catch(e=>{n||N(e instanceof Error?e:Error(String(e)))}).finally(()=>{n||te(!1)}),()=>{n=!0}},[c,x,De,g,S,O]),H.useLayoutEffect(()=>{let t=I.current,n=t.ids[F.current],r=t.query===e&&t.directory===c?Math.max(0,W.findIndex(e=>e.id===n)):0;I.current={query:e,directory:c,ids:W.map(e=>e.id)},F.current=r,re(r)},[W,e,c]),H.useEffect(()=>{oe({}),pe({})},[W]),H.useEffect(()=>{me.current[P]?.scrollIntoView({block:`nearest`})},[P]),H.useEffect(()=>{let e=null,t=()=>{e!==null&&cancelAnimationFrame(e),e=requestAnimationFrame(()=>{let e={},t={};ge.current.forEach((n,r)=>{if(!n)return;let i=_e.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}}),oe(e),pe(t)})};return t(),window.addEventListener(`resize`,t),()=>{e!==null&&cancelAnimationFrame(e),window.removeEventListener(`resize`,t)}},[W]),H.useEffect(()=>{let e=ge.current[P];if(!e)return;let t=()=>{let t=e.clientWidth;t>0&&ie(t)};if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>{n.disconnect()}},[P]);let G=C(e=>{t(e)}),K=C(e=>{n?.(e)}),q=C(e=>{i?.(e)}),Me=C(e=>{r?.(e)}),J=(e,t)=>({onMouseDown:e=>e.preventDefault(),onPointerDown:e=>{e.pointerType===`touch`&&z.current?.pointerDown(e.clientX,e.clientY)},onPointerMove:e=>{e.pointerType===`touch`&&z.current?.pointerMove(e.clientX,e.clientY)},onPointerUp:e=>{e.pointerType===`touch`&&(z.current?.pointerUp(t)??!1)&&(e.preventDefault(),e.stopPropagation())},onPointerCancel:()=>z.current?.pointerCancel(),onClick:()=>{z.current?.click(t)},onMouseMove:()=>{F.current=e,re(e)}}),Y=e=>{try{v?.()}catch(e){N(e instanceof Error?e:Error(String(e)));return}let t=W.length;if(t===0)return;let n=(e%t+t)%t,r=W[n];if(r.agentName!==void 0){K(r.agentName);return}if(r.id.startsWith(`skill:`)){let e=U.find(e=>r.id===`skill:${e.name}-${e.scope}`);e&&Me(e);return}if(r.id.startsWith(`session:`)){let e=ke.find(e=>r.id===`session:${e.id}`);e&&q(e);return}let i=r.id.startsWith(`recent:`)?Ae.find(e=>r.id===`recent:${e.path}`):je.find(e=>r.id===`file:${e.path}`);i&&G(i)};H.useEffect(()=>{Te(s,Ce,{rows:W,highlightedIndex:P})},[s,P,W]);let Ne=H.useRef(s);return Ne.current=s,H.useEffect(()=>()=>{Ee(Ne.current,Ce)},[]),H.useImperativeHandle(y,()=>({acceptIndex:e=>{Y(e)},handleKeyDown:e=>{if(e===`Escape`){a();return}let t=W.length;if(t!==0){if(e===`ArrowDown`){F.current=(F.current+1)%t,re(F.current);return}if(e===`ArrowUp`){F.current=(F.current-1+t)%t,re(F.current);return}(e===`Enter`||e===`Tab`)&&Y(F.current)}}})),(0,X.jsxs)(ve,{ref:Se,isMobile:B,className:`max-w-[640px] max-h-64`,style:o,children:[(0,X.jsx)(xe,{preventOverscroll:!0,outerClassName:`flex-1 min-h-0`,className:`px-0`,children:(0,X.jsxs)(`div`,{className:`py-1`,children:[_||we.error||M?(0,X.jsx)(`div`,{role:`alert`,className:`px-3 py-2 typography-ui-label text-muted-foreground`,children:(_??we.error??M)?.message}):null,W.map((e,t)=>{let n=e.id.startsWith(`file:`)||e.id.startsWith(`recent:`),r=n?D(e.title,{maxLength:60}):e.title,i=P===t,a=ae[t]??!1,o=ce[t]??2.6;return(0,X.jsxs)(`div`,{"data-mention-id":e.id,ref:e=>{me.current[t]=e},className:j(`flex items-center gap-2 px-3 py-1.5 cursor-pointer typography-ui-label rounded-lg`,B&&`min-h-11`,ye(B,i),!B&&i&&`text-interactive-selection-foreground`),...J(t,()=>Y(t)),children:[(0,X.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center`,children:e.agentName===void 0?(0,X.jsx)(R,{name:e.iconName,className:`size-3.5 text-current`}):(0,X.jsx)(fe,{name:e.agentName,size:20})}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,X.jsxs)(`span`,{ref:e=>{ge.current[t]=e},className:j(`relative block min-w-0 overflow-hidden`,n&&a&&i&&`file-mention-marquee-container`),style:i?{"--file-mention-marquee-width":`${L}px`,"--file-mention-marquee-duration":`${o}s`}:void 0,title:e.title,children:[(0,X.jsx)(`span`,{ref:e=>{_e.current[t]=e},className:`absolute invisible whitespace-nowrap pointer-events-none`,"aria-hidden":!0,children:e.title}),n&&a&&i?(0,X.jsx)(`span`,{className:`inline-block whitespace-nowrap file-mention-marquee`,children:Ue(e.title,V)}):(0,X.jsx)(`span`,{className:`block truncate`,children:Ue(r,V)})]}),e.trailingLabel?(0,X.jsx)(`span`,{className:j(`max-w-[40%] shrink-0 truncate text-muted-foreground`,B?`typography-micro`:`typography-meta`),children:e.trailingLabel}):null]}),e.subtitle?(0,X.jsx)(`div`,{className:j(`truncate text-muted-foreground`,B?`typography-micro`:`typography-meta`),children:Ue(e.subtitle,V)}):null]})]},e.id)}),ee&&je.length===0?(0,X.jsx)(`div`,{className:`flex items-center justify-center py-3`,children:(0,X.jsx)(R,{name:`refresh`,className:`h-4 w-4 animate-spin text-muted-foreground`})}):null,!ee&&W.length===0&&(0,X.jsx)(`div`,{className:`px-3 py-2 typography-ui-label text-muted-foreground`,children:b(`chat.fileMentionAutocomplete.empty`)})]})}),!B&&(0,X.jsx)(`div`,{className:`px-3 pt-1 pb-1.5 border-t typography-meta text-muted-foreground`,children:b(`chat.autocomplete.keyboardHint`)})]})});function Xe(e){return e.currentSessionId}function Ze(e){return e.activeSessions}function Qe(e){return e.activeProjectId}function $e(e){return e.projects}function et(e){return e.agents}function tt(e){return e.searchFiles}var nt=new Set([`new`,`fork`,`compact`,`reload`,`undo`,`redo`,`model`,`btw`]),rt=(e,t)=>{if(!t||e.isSkill)return!1;let n=e.name?.trim().toLowerCase();return!!(n&&nt.has(n))},it=(e,t)=>!e||t({name:e}),at=` `,ot=(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]===at&&e[r-2]===`/`&&(r-=2),e[r]===`/`?{start:r,end:n}:null},st=`text-[10px] leading-none uppercase font-bold tracking-tight px-1.5 py-1 rounded border flex-shrink-0`,ct=j(st,`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)]`),lt=j(st,`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)]`),ut=j(st,`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)]`),dt=j(st,`bg-[var(--surface-muted)] text-muted-foreground border-[var(--interactive-border)]/60`),ft=(e,t)=>e.length===t.length&&e.every((e,n)=>e.id===t[n]?.id&&e.description===t[n]?.description),pt=e=>{let t=!!e.sessionID;return{hasSession:t,canStartSessionCommand:t||e.hasNewDraft}},mt=H.forwardRef(({searchQuery:e,onCommandSelect:t,onClose:n,directory:i,style:a,commandPolicy:o,commandContext:s,onRowsChange:c},l)=>{let{t:u}=T(),d=w(e=>e.isMobile),f=F(e=>e.currentSessionId),p=F(e=>!!e.newSessionDraft?.open),m=F(H.useCallback(e=>f?e.getDirectoryForSession(f):void 0,[f])),h=re(f??``,m??void 0),g=H.useMemo(()=>s??{sessionID:f??null,hasMessages:h.length>0,hasNewDraft:p},[s,f,h.length,p]),{hasSession:_,canStartSessionCommand:v}=H.useMemo(()=>pt(g),[g]),y=g.hasMessages,[b,x]=H.useState([]),[S,C]=H.useState(!1),E=te({directory:i}),D=H.useMemo(()=>E.data??[],[E.data]),O=E.isFetching,[k,A]=H.useState(0),ee=H.useRef(0),M=H.useRef(!1),N=H.useRef([]),ne=H.useRef(null),P=H.useRef(!1),I=H.useRef(null),L=H.useRef(!1),ie=H.useRef(null);H.useEffect(()=>{let e=e=>{let t=e.target;!t||!ne.current||ne.current.contains(t)||n()};return document.addEventListener(`pointerdown`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0)}},[n]),H.useEffect(()=>{(async()=>{C(O);try{let t=D.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},..._&&!y?[{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}]:[],...v?[{id:`yuri:craft-goal`,name:`craft-goal`,source:`yuri`,description:u(`chat.commandAutocomplete.command.craftGoalDescription`),isYuri:!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=!y,a=z(n.filter(e=>(i||e.name!==`init`)&&(o?.(e)??!0)),e);x(e=>ft(e,a)?e:a)}catch{let t=!y,n=z([{id:`yuri:new`,name:`new`,source:`yuri`,description:u(`chat.commandAutocomplete.command.newDescription`),isBuiltIn:!0},..._&&!y?[{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}]:[],...v?[{id:`yuri:craft-goal`,name:`craft-goal`,source:`yuri`,description:u(`chat.commandAutocomplete.command.craftGoalDescription`),isYuri:!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);x(e=>ft(e,n)?e:n)}finally{C(!1)}})()},[e,y,_,v,D,O,u,o]),H.useEffect(()=>{A(0)},[b]),H.useEffect(()=>{ee.current=k},[k]),H.useEffect(()=>{N.current[k]?.scrollIntoView({block:`nearest`})},[k]),H.useEffect(()=>{Te(c,ie,{rows:_e(b,{skill:u(`chat.commandAutocomplete.badge.skill`),command:u(`chat.commandAutocomplete.badge.command`),system:u(`chat.commandAutocomplete.badge.system`)}),highlightedIndex:k})},[b,c,k,u]);let ae=H.useRef(c);ae.current=c,H.useEffect(()=>()=>{Ee(ae.current,ie)},[]),H.useImperativeHandle(l,()=>({acceptIndex:(e,n=!0)=>{let r=b[e];r&&t(r,rt(r,n))},handleKeyDown:e=>{let r=b.length;if(e===`Escape`){n();return}if(r!==0){if(e===`ArrowDown`){M.current=!0,A(e=>(e+1)%r);return}if(e===`ArrowUp`){M.current=!0,A(e=>(e-1+r)%r);return}if(e===`Enter`||e===`Tab`){let n=(ee.current%r+r)%r,i=b[n];i&&t(i,rt(i,e===`Enter`))}}}}),[b,n,t]);let oe=e=>{let t=ge(e);switch(e.name){case`new`:return(0,X.jsx)(R,{name:t,className:`h-3.5 w-3.5`});case`init`:return(0,X.jsx)(R,{name:t,className:`h-3.5 w-3.5 text-green-500`});case`undo`:return(0,X.jsx)(R,{name:t,className:`h-3.5 w-3.5 text-orange-500`});case`redo`:return(0,X.jsx)(R,{name:t,className:`h-3.5 w-3.5 text-orange-500`});case`timeline`:case`reload`:return(0,X.jsx)(R,{name:t,className:`h-3.5 w-3.5`});case`compact`:return(0,X.jsx)(R,{name:t,className:`h-3.5 w-3.5 text-purple-500`});case`goal`:return(0,X.jsx)(R,{name:t,className:`h-3.5 w-3.5`});case`review`:return(0,X.jsx)(R,{name:t,className:`h-3.5 w-3.5 text-blue-500`});case`test`:case`build`:case`run`:return(0,X.jsx)(R,{name:t,className:`h-3.5 w-3.5 text-cyan-500`});default:return e.isBuiltIn?(0,X.jsx)(R,{name:t,className:`h-3.5 w-3.5 text-yellow-500`}):(0,X.jsx)(R,{name:t,className:`h-3.5 w-3.5 text-muted-foreground`})}};return(0,X.jsxs)(ve,{ref:ne,isMobile:d,className:`max-w-[450px] max-h-64`,style:a,children:[(0,X.jsx)(xe,{preventOverscroll:!0,outerClassName:`flex-1 min-h-0`,className:`px-0 py-1.5`,children:S?(0,X.jsx)(`div`,{className:`flex items-center justify-center py-4`,children:(0,X.jsx)(R,{name:`refresh`,className:`h-4 w-4 animate-spin text-muted-foreground`})}):(0,X.jsxs)(`div`,{children:[b.map((n,r)=>{let i=n.isBuiltIn,a=n.isYuri;return(0,X.jsxs)(`div`,{ref:e=>{N.current[r]=e},className:j(`flex gap-2 px-2 py-2 cursor-pointer rounded-lg`,d?`items-center`:`items-start`,ye(d,r===k),!d&&r===k&&`bg-interactive-selection/35`),onMouseDown:e=>e.preventDefault(),onPointerDown:e=>{e.pointerType===`touch`&&(I.current={x:e.clientX,y:e.clientY},L.current=!1)},onPointerMove:e=>{if(e.pointerType!==`touch`||!I.current)return;let t=e.clientX-I.current.x,n=e.clientY-I.current.y;Math.hypot(t,n)>6&&(L.current=!0)},onPointerUp:e=>{if(e.pointerType!==`touch`)return;let r=L.current;I.current=null,L.current=!1,!r&&(e.preventDefault(),e.stopPropagation(),P.current=!0,t(n,rt(n,d)))},onPointerCancel:()=>{I.current=null,L.current=!1},onClick:()=>{if(P.current){P.current=!1;return}t(n,rt(n,d))},onMouseMove:()=>{M.current=!1,A(r)},children:[(0,X.jsx)(`div`,{className:j(!d&&`mt-0.5`),children:oe(n)}),(0,X.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsxs)(`span`,{className:`typography-ui-label font-medium`,children:[`/`,Ue(n.name,e)]}),n.isSkill?(0,X.jsx)(`span`,{className:ct,children:u(`chat.commandAutocomplete.badge.skill`)}):(0,X.jsx)(`span`,{className:ct,children:u(`chat.commandAutocomplete.badge.command`)}),a?(0,X.jsx)(`span`,{className:dt,children:`Yuri`}):i?(0,X.jsx)(`span`,{className:dt,children:u(`chat.commandAutocomplete.badge.system`)}):n.scope?(0,X.jsx)(`span`,{className:n.scope===`project`?ut:lt,children:n.scope}):null,n.agent&&(0,X.jsx)(`span`,{className:dt,children:n.agent})]}),n.description&&!d&&(0,X.jsx)(`div`,{className:`typography-meta text-muted-foreground mt-0.5 truncate`,children:Ue(n.description,e)})]})]},n.id)}),b.length===0&&(0,X.jsx)(`div`,{className:`px-3 py-2 typography-ui-label text-muted-foreground`,children:u(`chat.commandAutocomplete.empty`)})]})}),!d&&(0,X.jsx)(`div`,{className:`px-3 pt-1 pb-1.5 border-t typography-meta text-muted-foreground`,children:u(`chat.autocomplete.keyboardHint`)})]})});mt.displayName=`CommandAutocomplete`;var 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=new Map,Pt=new WeakMap,Ft=e=>{let t=Pt.get(e);return t||(t=new Set(e.files.map(e=>e.path)),Pt.set(e,t)),t},It=(e,t)=>`${t}:${e}`,Lt=e=>kt.get(e)??0,Rt=e=>{let t=Lt(e)+1;return kt.set(e,t),t},zt=e=>{let t=(At.get(e)??0)+1;return At.set(e,t),t},Bt=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}),Vt=(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},Ht=(e,t)=>!e&&!t?!1:!e||!t||e.remote!==t.remote||e.branch!==t.branch||e.ahead!==t.ahead||e.behind!==t.behind,Ut=e=>{let t=e?.trim()??``;return t===`?`?``:t},Wt=(e,t)=>{let n=new Set,r=!1,i=!e;e&&(i=e.ahead!==t.ahead||e.behind!==t.behind||e.current!==t.current||e.tracking!==t.tracking||e.isClean!==t.isClean||t.upstreamComparison!==void 0&&Ht(e.upstreamComparison,t.upstreamComparison)||t.diffStats!==void 0&&e.diffStats===void 0);let a=new Map;for(let t of e?.files??[])a.set(t.path,t);for(let e of t.files??[]){let t=a.get(e.path);if(!t){n.add(e.path),Ut(e.index)&&(r=!0);continue}a.delete(e.path),(t.index!==e.index||t.working_dir!==e.working_dir)&&n.add(e.path),!r&&Ut(t.index)!==Ut(e.index)&&(r=!0)}for(let[e,t]of a)n.add(e),Ut(t.index)&&(r=!0);let o=t.diffStats,s=e?.diffStats;if(o!==void 0&&o!==s){let e=s??{};for(let t in o){let r=o[t],i=e[t];(!i||i.insertions!==r.insertions||i.deletions!==r.deletions)&&n.add(t)}for(let t in e)t in o||n.add(t)}return{changed:i||n.size>0,changedPaths:n,indexChanged:r}},Gt=e=>!e||e.trim().length===0,Kt=e=>(e||``).trim()===`U`,qt=e=>{let t=(e.index||``).trim(),n=(e.working_dir||``).trim();if(Kt(t)||Kt(n))return e;let r=t===`?`||n===`?`?`A`:t||n||` `;return{...e,index:r,working_dir:` `}},Jt=e=>{let t=(e.index||``).trim(),n=(e.working_dir||``).trim();if(Kt(t)||Kt(n))return e;let r=n||(t===`A`||t===`?`?`?`:t)||` `;return{...e,index:` `,working_dir:r}},Yt=e=>Gt(e.index)&&Gt(e.working_dir),Q=o()(c((e,t)=>({directories:new Map,activeDirectory:null,setActiveDirectory:n=>{let{activeDirectory:r,directories:i}=t();if(r!==n)if(r&&Rt(r),n&&Rt(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=It(n,a),s=jt.get(o)??(a===`light`?jt.get(It(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),d=t().directories.get(n)??Z(),f=Nt.get(n),p=f?.received===u&&f.stored===d.status?null:Wt(d.status,u);if(p?.changed){c=!0;let r=new Map(t().directories),i=r.get(n)??Z(),{changedPaths:s,indexChanged:l}=p,d=new Map(i.diffCache);for(let e of s)d.delete(e);let f=s.size>0;f&&Rt(n);let m={...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:m,diffCache:d,indexRevision:l?i.indexRevision+1:i.indexRevision,lastRepoCheckAt:o?a:i.lastRepoCheckAt,lastStatusFetch:Date.now(),lastStatusChange:f?Date.now():i.lastStatusChange}),e({directories:r}),Nt.set(n,{received:u,stored:m})}else{Nt.set(n,{received:u,stored:d.status});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`?qt(e):Jt(e);t!==e&&(l=!0),Yt(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=zt(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 M(r,i,void 0,o):await A(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=Vt(s);a.set(n,{...o,diffCache:c}),e({directories:a})},clearDiffCache:n=>{Rt(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=Math.min(Math.max(1,s),Et),l=Ft(o.status),u=o.status.diffStats,d=Bt(n),f=[],p=new Set;for(let e of i){if(p.size>=c)break;if(!e||p.has(e)||!l.has(e))continue;let t=u?.[e];t&&t.insertions+t.deletions>Tt||(p.add(e),!o.diffCache.has(e)&&(d.has(e)||f.push(e)))}let m=f;if(m.length===0)return;let h=Lt(n);if(typeof document<`u`&&document.hidden)return;m.forEach(e=>d.add(e));let g=0,_=[],v=()=>{let e=g;return g+=1,e<m.length?m[e]:null},y=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}}},b=async()=>{for(;;){if(h!==Lt(n))return;let e=v();if(!e)return;try{_.push(await y(e))}catch{}finally{d.delete(e)}}},x=Math.min(Ct,m.length);if(await Promise.allSettled(Array.from({length:x},()=>b())),m.forEach(e=>d.delete(e)),h!==Lt(n))return;let S=new Map(t().directories),C=S.get(n);if(!C)return;let w=new Map(C.diffCache),T=Date.now();_.forEach(e=>{!e.diff.isBinary&&e.diff.original===``&&e.diff.modified===``||w.set(e.path,{...e.diff,fetchedAt:T})});let E=Vt(w);S.set(n,{...C,diffCache:E}),e({directories:S})},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`})),Xt=e=>{let t=(0,U.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)},Zt=e=>{let r=(0,U.c)(3),i=H.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)},Qt=e=>{let t=(0,U.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,U.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,U.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=new Map,t[0]=n):n=t[0];let r=H.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,U.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,U.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)},rn=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\//,``),an=e=>e.branchName?$(e.branchName):e.mode===`existing`?$(e.existingBranch||e.preferredName||``):$(e.preferredName||``),on=async e=>{let t=await Se(e);try{let n=rn((await me(e)).branches?.[t]?.tracking||null);if(n?.remote)return n.remote}catch{}try{let t=rn((await pe(e)).tracking);if(t?.remote)return t.remote}catch{}return null},sn=async(e,t)=>{let n=await on(e),r=$(t);return!n||!r?null:{setUpstream:!0,upstreamRemote:n,upstreamBranch:r}},cn=async(e,t,n)=>{let r=an(t),i=n?.resolvedRootTrackingRemote,a=i===void 0?await sn(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},ln=async(e,t,n)=>{let r=await cn(e.path,t,n);return Ce(e,r)},un=`yuri:lastWorktreeSourceBranch`,dn=({mode:e,sourceBranch:t,linkedPr:n,selectedBranch:r})=>e===`existing-branch`?r||null:n?null:t||null,fn=({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},pn=(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?` `:``}`},mn=(e,t,n)=>{let r=pn(e,t,n);return`${t.length===0&&!/^\s/.test(r)?` `:``}${r}${n.length===0&&!/\s$/.test(r)?` `:``}`},hn=(e,t,n,r)=>{let i=e.slice(0,t),a=e.slice(n),o=mn(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}},gn=(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]},_n=(e,t)=>t<e.length&&e[t]===` `?t+1:t;export{Fe as C,Ae as D,ke as E,we as O,We as S,Ne as T,Q as _,un as a,ot as b,ln as c,$t as d,Zt as f,Xt as g,en as h,mn as i,on as l,tn as m,gn as n,fn as o,nn as p,hn as r,dn as s,_n as t,cn as u,Qt as v,Pe as w,it as x,mt as y};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t,i as n}from"./runtime-switch-DEPKHgdL.js";import{R as r,l as i,u as a}from"./platform-CiUKDeXd.js";import{a as o,i as s,r as c}from"./vendor-zustand-CNn3HHhT.js";import{ot as l,st as u}from"./vendor-base-ui-fom6orB6.js";import{St as d,an as f,jt as p,on as m}from"./gitApiHttp-BgUDBfaJ.js";import{t as h}from"./safeStorage-DTOhKN0V.js";import{i as g,t as _}from"./vendor-pathe-vBmvQE8f.js";import{n as v}from"./vendor-react-D5BntRmA.js";import{s as y,u as b}from"./vendor-tanstack-react-query-ChSd65dm.js";import{E as x}from"./runtime-file-resource-CKQQEwNv.js";import{o as S}from"./path-utils-jGozTg9d.js";import{r as C}from"./vendor-reactuses-core-B8s-Rcd-.js";import{r as w}from"./useUIStore-DjizmHAt.js";import{t as T}from"./i18n-BvjeIWrT.js";import{Ca as E,Gn as D,Ha as O,Ia as k,Jn as A,R as ee,Rn as j,Va as te,Xn as M,Zi as N,fa as ne,fi as P,lt as re,p as F,v as I,x as L,yi as ie,yt as ae}from"./useMobileNavigationStore-oveTY29a.js";import{s as oe}from"./remoteProjectQueries-yX3kOkR6.js";import{a as se,g as ce,o as le,p as ue,s as de}from"./fileMentionAutocompleteState-BZJqfgae.js";import{t as fe}from"./AgentAvatar-tFfpSF5F.js";import{n as R}from"./Icon-DebSeH2D.js";import{l as pe,s as me}from"./gitApi-i_uT8MNk.js";import{c as he,d as ge,l as _e,n as ve,r as ye,t as be}from"./fileMentionTouchSelection-D9GbR7zD.js";import{n as xe}from"./textarea-CVswImHY.js";import{f as Se,o as Ce}from"./projectMeta-Bh7dUtdB.js";var z=(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=ce([...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)},B=(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}),V=(e,t)=>e.highlightedIndex===t.highlightedIndex&&B(e.rows,t.rows),we=(e,t)=>B(e,t)?e:t.slice(),Te=(e,t,n)=>{e&&(t.current&&V(t.current,n)||(t.current=n,e(n)))},Ee=(e,t)=>{t.current=null,e?.({rows:[],highlightedIndex:0})},H=e(u(),1),U=v(),De=e=>e.directories.flatMap(e=>e.sessions),Oe=(e,t)=>({...oe(e,t.location.hostId),select:De}),ke=async(e,t,n)=>{n.sdk();let r=await e.fetchQuery(Oe(t,n));return n.sdk(),De(r)},Ae=(e,t,n,r)=>{n.sdk();let i=e.getQueryData(Oe(t,n).queryKey);for(let e of i?.directories??[]){let t=e.sessions.find(e=>e.id===r);if(t)return t.title||r}return r},je=(e,t,n,r={})=>({queryKey:[...e.queryScope,`composer-files`,t,n,r],staleTime:3e4,gcTime:3e4,queryFn:async({signal:i})=>{let a=await e.sdk().file.find({query:t,location:{directory:e.location.directory},limit:n,type:r.type},{signal:i});if(e.sdk(),i.throwIfAborted(),!Array.isArray(a.data))throw Error(`File search returned no data`);return a.data.map(t=>{let n=g(t.path),r=_(n);return{name:r,path:S(e.location.directory,n),relativePath:n,extension:r.includes(`.`)?r.split(`.`).pop()?.toLowerCase():void 0,isDirectory:t.type===`directory`}})}}),W=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},G=e=>/^[A-Za-z]:\//.test(e)?e.toLowerCase():e,K=e=>e.startsWith(`yuri-remote-location:`)?i(e):W(e),q=(e,t)=>{let n=W(a(t,`local`).directory),r=W(e);if(!n||!r)return!1;let i=G(n),o=G(r);return o===i||o.startsWith(i.endsWith(`/`)?i:`${i}/`)},Me=e=>{if(!e||typeof e!=`object`)return{};let t=e,n={};for(let[e,r]of Object.entries(t)){let t;try{t=K(e)}catch{continue}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=>W(e)).filter(e=>q(e,t)))):[],o=Array.isArray(i.expandedPaths)?Array.from(new Set(i.expandedPaths.filter(e=>typeof e==`string`).map(e=>W(e)).filter(e=>q(e,t)))):[],s=typeof i.selectedPath==`string`?W(i.selectedPath):null,c=s&&q(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])),i=u.selectedPath??c??e[0]??null;n[t]={openPaths:e,selectedPath:i,expandedPaths:r,touchedAt:Math.max(u.touchedAt,l)};continue}n[t]={openPaths:a,selectedPath:c,expandedPaths:o,touchedAt:l}}return n},J=(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},Y=e=>e?{...e,touchedAt:Date.now()}:{openPaths:[],selectedPath:null,expandedPaths:[],touchedAt:Date.now()},Ne=o()(c(s((e,t)=>({byRoot:{},addOpenPath:(t,n,r)=>{let i=K((t||``).trim()),a=W((n||``).trim());!i||!a||!r?.allowOutsideRoot&&!q(a,i)||e(e=>{let t=e.byRoot[i],n=Y(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:J({...e.byRoot,[i]:{...n,openPaths:o,selectedPath:s}},20)}})},removeOpenPath:(t,n)=>{let r=K((t||``).trim()),i=W((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=G(i),a=e=>G(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:J({...e.byRoot,[r]:{...t,openPaths:s,selectedPath:c,touchedAt:Date.now()}},20)}})},removeOpenPathsByPrefix:(t,n)=>{let r=K((t||``).trim()),i=W((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=G(i),a=n.endsWith(`/`)?n:`${n}/`,o=e=>{let t=G(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:J({...e.byRoot,[r]:{...t,openPaths:s,selectedPath:c,touchedAt:Date.now()}},20)}})},removeExpandedPathsByPrefix:(t,n)=>{let r=K((t||``).trim()),i=W((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=G(i),a=n.endsWith(`/`)?n:`${n}/`,o=t.expandedPaths.filter(e=>{let t=G(e);return t!==n&&!t.startsWith(a)});return o.length===t.expandedPaths.length?e:{byRoot:J({...e.byRoot,[r]:{...t,expandedPaths:o,touchedAt:Date.now()}},20)}})},setSelectedPath:(t,n,r)=>{let i=K((t||``).trim()),a=n?W(n.trim()):null;!i||a&&!r?.allowOutsideRoot&&!q(a,i)||e(e=>{let t=e.byRoot[i],n=Y(t),r=a&&!n.openPaths.includes(a)?[...n.openPaths,a]:n.openPaths;return t&&t.selectedPath===a&&r===t.openPaths?e:{byRoot:J({...e.byRoot,[i]:{...n,openPaths:r,selectedPath:a}},20)}})},ensureSelectedPath:e=>{let n=K((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=K((t||``).trim()),i=W((n||``).trim());!r||!i||!q(i,r)||e(e=>{let t=e.byRoot[r],n=Y(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:J({...e.byRoot,[r]:{...n,expandedPaths:a}},20)}})},expandPath:(t,n)=>{let r=K((t||``).trim()),i=W((n||``).trim());!r||!i||!q(i,r)||e(e=>{let t=e.byRoot[r],n=Y(t);return n.expandedPaths.includes(i)&&t?e:{byRoot:J({...e.byRoot,[r]:{...n,expandedPaths:[...n.expandedPaths,i]}},20)}})},expandPaths:(t,n)=>{let r=K((t||``).trim());if(!r||!n||n.length===0)return;let i=n.map(e=>W((e||``).trim())).filter(e=>e&&q(e,r));i.length!==0&&e(e=>{let t=e.byRoot[r],n=Y(t),a=new Set(n.expandedPaths),o=i.filter(e=>!a.has(e));return o.length===0?e:{byRoot:J({...e.byRoot,[r]:{...n,expandedPaths:[...n.expandedPaths,...o]}},20)}})}}),{name:`files-view-tabs-store`,version:2,storage:h(),migrate:e=>{if(!e||typeof e!=`object`)return{byRoot:{}};let t=e.byRoot;return{byRoot:Me(t)}},merge:(e,t)=>({...t,byRoot:Me(e&&typeof e==`object`?e.byRoot:void 0)}),partialize:e=>({byRoot:Me(e.byRoot)})}),{name:`files-view-tabs-store`})),Pe=(e,t)=>{let n=(0,U.c)(4),r=t===void 0?200:t,[i,a]=H.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]),H.useEffect(o,s),i},Fe=()=>{let e=(0,U.c)(17),t=F(Ie),n=ae(),r;e[0]===t?r=e[1]:(r=e=>t?e.getAttachment(t):void 0,e[0]=t,e[1]=r);let i=L(r),a=F(Le),o=F(Re),s=O(ze),c=O(Be),l=d(Ve);if(t){let r;e[2]===i?r=e[3]:(r=I(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 Ie(e){return e.currentSessionId}function Le(e){return e.worktreeMetadata}function Re(e){return e.newSessionDraft}function ze(e){return e.activeProjectId}function Be(e){return e.projects}function Ve(e){return e.currentDirectory}var X=l(),He=`bg-transparent font-[inherit] text-[var(--primary-base)]`,Ue=(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,X.jsx)(`mark`,{className:He,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},We=H.forwardRef((e,t)=>{let n=(0,U.c)(4),r=x(),i;return n[0]!==r||n[1]!==e||n[2]!==t?(i=r?.entry.location.hostId?(0,X.jsx)(Je,{...e,ref:t,entry:r.entry,registry:r.registry},JSON.stringify(r.entry.queryScope)):(0,X.jsx)(Ge,{...e,ref:t}),n[0]=r,n[1]=e,n[2]=t,n[3]=i):i=n[3],i}),Ge=H.forwardRef((e,t)=>{let n=(0,U.c)(22),r=Fe()??``,i=F(Xe),a=ie(Ze),o=!!e.onSessionSelect,s;n[0]===o?s=n[1]:(s={enabled:o},n[0]=o,n[1]=s);let c=ee(s),l=O(Qe),u=O($e),d;if(n[2]!==l||n[3]!==r||n[4]!==u){let e=u.find(e=>e.id===l)?.path||r;d=e?e.replace(/\\/g,`/`).replace(/\/+$/,``):null,n[2]=l,n[3]=r,n[4]=u,n[5]=d}else d=n[5];let f=d,m;n[6]===f?m=n[7]:(m=e=>f?e.byRoot[f]:void 0,n[6]=f,n[7]=m);let h=Ne(m),g=N(et),_=p(tt),v;n[8]!==a||n[9]!==c||n[10]!==e.onSessionSelect?(v=e.onSessionSelect?P(a,c):[],n[8]=a,n[9]=c,n[10]=e.onSessionSelect,n[11]=v):v=n[11];let y=v,b=e.currentSessionId??i,x;return n[12]!==g||n[13]!==r||n[14]!==f||n[15]!==h||n[16]!==e||n[17]!==t||n[18]!==_||n[19]!==y||n[20]!==b?(x=(0,X.jsx)(Ye,{...e,ref:t,currentDirectory:r,currentSessionId:b,projectRoot:f,projectTabs:h,agentCatalog:g,sessions:y,searchFiles:_}),n[12]=g,n[13]=r,n[14]=f,n[15]=h,n[16]=e,n[17]=t,n[18]=_,n[19]=y,n[20]=b,n[21]=x):x=n[21],x}),Ke=[],qe=[],Je=H.forwardRef((e,t)=>{let n=(0,U.c)(32),{entry:r,registry:i}=e,a=b(),o;n[0]===r?o=n[1]:(o=k(r.location.directory,void 0,r),n[0]=r,n[1]=o);let s=!!e.onAgentSelect,c;n[2]!==o||n[3]!==s?(c={...o,enabled:s},n[2]=o,n[3]=s,n[4]=c):c=n[4];let l=y(c),u;n[5]!==r||n[6]!==i?(u=Oe(i,r),n[5]=r,n[6]=i,n[7]=u):u=n[7];let d=!!e.onSessionSelect,f;n[8]!==u||n[9]!==d?(f={...u,enabled:d},n[8]=u,n[9]=d,n[10]=f):f=n[10];let p=y(f),m;n[11]===r.key?m=n[12]:(m=e=>e.byRoot[r.key],n[11]=r.key,n[12]=m);let h=Ne(m),g;n[13]!==a||n[14]!==r?(g=(e,t,n,i)=>{let o=n===void 0?60:n;return a.fetchQuery(je(r,t,o,i))},n[13]=a,n[14]=r,n[15]=g):g=n[15];let _=C(g),v=r.location.directory,x;if(n[16]!==r.location.directory){let e;n[18]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\/+$/,n[18]=e):e=n[18],x=r.location.directory.replace(/\\/g,`/`).replace(e,``),n[16]=r.location.directory,n[17]=x}else x=n[17];let S=l.data??qe,w=p.data??Ke,T=l.error??p.error,E;n[19]===r?E=n[20]:(E=()=>{r.sdk()},n[19]=r,n[20]=E);let D;return n[21]!==r.location.directory||n[22]!==h||n[23]!==e||n[24]!==t||n[25]!==_||n[26]!==S||n[27]!==w||n[28]!==T||n[29]!==E||n[30]!==x?(D=(0,X.jsx)(Ye,{...e,ref:t,currentDirectory:v,projectRoot:x,projectTabs:h,agentCatalog:S,sessions:w,searchFiles:_,catalogError:T,assertCurrent:E}),n[21]=r.location.directory,n[22]=h,n[23]=e,n[24]=t,n[25]=_,n[26]=S,n[27]=w,n[28]=T,n[29]=E,n[30]=x,n[31]=D):D=n[31],D}),Ye=H.forwardRef(({searchQuery:e,onFileSelect:t,onAgentSelect:n,onSkillSelect:r,onSessionSelect:i,onClose:a,style:o,onRowsChange:s,currentDirectory:c,currentSessionId:l,projectRoot:u,projectTabs:d,agentCatalog:p,sessions:h,searchFiles:g,catalogError:_,assertCurrent:v},y)=>{let{t:b}=T(),x=Pe(e,180),S=m(),O=f(),[k,A]=H.useState([]),[ee,te]=H.useState(!1),[M,N]=H.useState(null),[P,re]=H.useState(0),F=H.useRef(0),I=H.useRef({query:e,directory:c,ids:[]}),[L,ie]=H.useState(360),[ae,oe]=H.useState({}),[ce,pe]=H.useState({}),me=H.useRef([]),ge=H.useRef([]),_e=H.useRef([]),Se=H.useRef(null),Ce=H.useRef(null),z=H.useRef(null);z.current||=be();let B=w(e=>e.isMobile),V=(e??``).trim(),we=E({directory:c||null}),U=H.useMemo(()=>r?we.data??[]:[],[r,we.data]),De=H.useMemo(()=>{if(!u||!d)return[];let e=[d.selectedPath,...d.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(`${u}/`)?e.slice(u.length+1):e;n.push({name:i,path:e,relativePath:a,extension:i.includes(`.`)?i.split(`.`).pop()?.toLowerCase():void 0})}return de(n,V,{limit:6})},[V,u,d]),Oe=H.useMemo(()=>n?ne(p).filter(e=>e.mode!==`primary`):[],[p,n]),ke=H.useMemo(()=>i?se({sessions:h,currentSessionId:l??null,searchQuery:V}):[],[h,l,V,i]),Ae=De,je=k,W=H.useMemo(()=>he({skills:U,agents:Oe,sessions:ke,recentFiles:Ae,pathHits:je,searchQuery:V,untitledSession:b(`chat.fileMentionAutocomplete.untitledSession`),sessionBadge:b(`chat.fileMentionAutocomplete.sessionType`),skillBadge:b(`chat.commandAutocomplete.badge.skill`)}),[U,Oe,ke,Ae,je,V,b]);H.useEffect(()=>{let e=e=>{let t=e.target;!t||!Se.current||Se.current.contains(t)||a()};return document.addEventListener(`pointerdown`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0)}},[a]),H.useEffect(()=>{if(!c){A([]),te(!1),N(null);return}let e=(x??``).trim(),t=ue(e);if(!t){A([]),te(!1),N(null);return}let n=!1;te(!0),N(null);let r={includeHidden:S,respectGitignore:!O};return Promise.all([g(c,t,80,{...r,type:`file`}),g(c,t,40,{...r,type:`directory`})]).then(([t,r])=>{if(n)return;let i=new Set(De.map(e=>e.path));A(le({files:t,directories:r,query:e,excludePaths:i,limit:20}))}).catch(e=>{n||N(e instanceof Error?e:Error(String(e)))}).finally(()=>{n||te(!1)}),()=>{n=!0}},[c,x,De,g,S,O]),H.useLayoutEffect(()=>{let t=I.current,n=t.ids[F.current],r=t.query===e&&t.directory===c?Math.max(0,W.findIndex(e=>e.id===n)):0;I.current={query:e,directory:c,ids:W.map(e=>e.id)},F.current=r,re(r)},[W,e,c]),H.useEffect(()=>{oe({}),pe({})},[W]),H.useEffect(()=>{me.current[P]?.scrollIntoView({block:`nearest`})},[P]),H.useEffect(()=>{let e=null,t=()=>{e!==null&&cancelAnimationFrame(e),e=requestAnimationFrame(()=>{let e={},t={};ge.current.forEach((n,r)=>{if(!n)return;let i=_e.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}}),oe(e),pe(t)})};return t(),window.addEventListener(`resize`,t),()=>{e!==null&&cancelAnimationFrame(e),window.removeEventListener(`resize`,t)}},[W]),H.useEffect(()=>{let e=ge.current[P];if(!e)return;let t=()=>{let t=e.clientWidth;t>0&&ie(t)};if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>{n.disconnect()}},[P]);let G=C(e=>{t(e)}),K=C(e=>{n?.(e)}),q=C(e=>{i?.(e)}),Me=C(e=>{r?.(e)}),J=(e,t)=>({onMouseDown:e=>e.preventDefault(),onPointerDown:e=>{e.pointerType===`touch`&&z.current?.pointerDown(e.clientX,e.clientY)},onPointerMove:e=>{e.pointerType===`touch`&&z.current?.pointerMove(e.clientX,e.clientY)},onPointerUp:e=>{e.pointerType===`touch`&&(z.current?.pointerUp(t)??!1)&&(e.preventDefault(),e.stopPropagation())},onPointerCancel:()=>z.current?.pointerCancel(),onClick:()=>{z.current?.click(t)},onMouseMove:()=>{F.current=e,re(e)}}),Y=e=>{try{v?.()}catch(e){N(e instanceof Error?e:Error(String(e)));return}let t=W.length;if(t===0)return;let n=(e%t+t)%t,r=W[n];if(r.agentName!==void 0){K(r.agentName);return}if(r.id.startsWith(`skill:`)){let e=U.find(e=>r.id===`skill:${e.name}-${e.scope}`);e&&Me(e);return}if(r.id.startsWith(`session:`)){let e=ke.find(e=>r.id===`session:${e.id}`);e&&q(e);return}let i=r.id.startsWith(`recent:`)?Ae.find(e=>r.id===`recent:${e.path}`):je.find(e=>r.id===`file:${e.path}`);i&&G(i)};H.useEffect(()=>{Te(s,Ce,{rows:W,highlightedIndex:P})},[s,P,W]);let Ne=H.useRef(s);return Ne.current=s,H.useEffect(()=>()=>{Ee(Ne.current,Ce)},[]),H.useImperativeHandle(y,()=>({acceptIndex:e=>{Y(e)},handleKeyDown:e=>{if(e===`Escape`){a();return}let t=W.length;if(t!==0){if(e===`ArrowDown`){F.current=(F.current+1)%t,re(F.current);return}if(e===`ArrowUp`){F.current=(F.current-1+t)%t,re(F.current);return}(e===`Enter`||e===`Tab`)&&Y(F.current)}}})),(0,X.jsxs)(ve,{ref:Se,isMobile:B,className:`max-w-[640px] max-h-64`,style:o,children:[(0,X.jsx)(xe,{preventOverscroll:!0,outerClassName:`flex-1 min-h-0`,className:`px-0`,children:(0,X.jsxs)(`div`,{className:`py-1`,children:[_||we.error||M?(0,X.jsx)(`div`,{role:`alert`,className:`px-3 py-2 typography-ui-label text-muted-foreground`,children:(_??we.error??M)?.message}):null,W.map((e,t)=>{let n=e.id.startsWith(`file:`)||e.id.startsWith(`recent:`),r=n?D(e.title,{maxLength:60}):e.title,i=P===t,a=ae[t]??!1,o=ce[t]??2.6;return(0,X.jsxs)(`div`,{"data-mention-id":e.id,ref:e=>{me.current[t]=e},className:j(`flex items-center gap-2 px-3 py-1.5 cursor-pointer typography-ui-label rounded-lg`,B&&`min-h-11`,ye(B,i),!B&&i&&`text-interactive-selection-foreground`),...J(t,()=>Y(t)),children:[(0,X.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center`,children:e.agentName===void 0?(0,X.jsx)(R,{name:e.iconName,className:`size-3.5 text-current`}):(0,X.jsx)(fe,{name:e.agentName,size:20})}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,X.jsxs)(`span`,{ref:e=>{ge.current[t]=e},className:j(`relative block min-w-0 overflow-hidden`,n&&a&&i&&`file-mention-marquee-container`),style:i?{"--file-mention-marquee-width":`${L}px`,"--file-mention-marquee-duration":`${o}s`}:void 0,title:e.title,children:[(0,X.jsx)(`span`,{ref:e=>{_e.current[t]=e},className:`absolute invisible whitespace-nowrap pointer-events-none`,"aria-hidden":!0,children:e.title}),n&&a&&i?(0,X.jsx)(`span`,{className:`inline-block whitespace-nowrap file-mention-marquee`,children:Ue(e.title,V)}):(0,X.jsx)(`span`,{className:`block truncate`,children:Ue(r,V)})]}),e.trailingLabel?(0,X.jsx)(`span`,{className:j(`max-w-[40%] shrink-0 truncate text-muted-foreground`,B?`typography-micro`:`typography-meta`),children:e.trailingLabel}):null]}),e.subtitle?(0,X.jsx)(`div`,{className:j(`truncate text-muted-foreground`,B?`typography-micro`:`typography-meta`),children:Ue(e.subtitle,V)}):null]})]},e.id)}),ee&&je.length===0?(0,X.jsx)(`div`,{className:`flex items-center justify-center py-3`,children:(0,X.jsx)(R,{name:`refresh`,className:`h-4 w-4 animate-spin text-muted-foreground`})}):null,!ee&&W.length===0&&(0,X.jsx)(`div`,{className:`px-3 py-2 typography-ui-label text-muted-foreground`,children:b(`chat.fileMentionAutocomplete.empty`)})]})}),!B&&(0,X.jsx)(`div`,{className:`px-3 pt-1 pb-1.5 border-t typography-meta text-muted-foreground`,children:b(`chat.autocomplete.keyboardHint`)})]})});function Xe(e){return e.currentSessionId}function Ze(e){return e.activeSessions}function Qe(e){return e.activeProjectId}function $e(e){return e.projects}function et(e){return e.agents}function tt(e){return e.searchFiles}var nt=new Set([`new`,`fork`,`compact`,`reload`,`undo`,`redo`,`model`,`btw`]),rt=(e,t)=>{if(!t||e.isSkill)return!1;let n=e.name?.trim().toLowerCase();return!!(n&&nt.has(n))},it=(e,t)=>!e||t({name:e}),at=` `,ot=(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]===at&&e[r-2]===`/`&&(r-=2),e[r]===`/`?{start:r,end:n}:null},st=`text-[10px] leading-none uppercase font-bold tracking-tight px-1.5 py-1 rounded border flex-shrink-0`,ct=j(st,`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)]`),lt=j(st,`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)]`),ut=j(st,`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)]`),dt=j(st,`bg-[var(--surface-muted)] text-muted-foreground border-[var(--interactive-border)]/60`),ft=(e,t)=>e.length===t.length&&e.every((e,n)=>e.id===t[n]?.id&&e.description===t[n]?.description),pt=e=>{let t=!!e.sessionID;return{hasSession:t,canStartSessionCommand:t||e.hasNewDraft}},mt=H.forwardRef(({searchQuery:e,onCommandSelect:t,onClose:n,directory:i,style:a,commandPolicy:o,commandContext:s,onRowsChange:c},l)=>{let{t:u}=T(),d=w(e=>e.isMobile),f=F(e=>e.currentSessionId),p=F(e=>!!e.newSessionDraft?.open),m=F(H.useCallback(e=>f?e.getDirectoryForSession(f):void 0,[f])),h=re(f??``,m??void 0),g=H.useMemo(()=>s??{sessionID:f??null,hasMessages:h.length>0,hasNewDraft:p},[s,f,h.length,p]),{hasSession:_,canStartSessionCommand:v}=H.useMemo(()=>pt(g),[g]),y=g.hasMessages,[b,x]=H.useState([]),[S,C]=H.useState(!1),E=te({directory:i}),D=H.useMemo(()=>E.data??[],[E.data]),O=E.isFetching,[k,A]=H.useState(0),ee=H.useRef(0),M=H.useRef(!1),N=H.useRef([]),ne=H.useRef(null),P=H.useRef(!1),I=H.useRef(null),L=H.useRef(!1),ie=H.useRef(null);H.useEffect(()=>{let e=e=>{let t=e.target;!t||!ne.current||ne.current.contains(t)||n()};return document.addEventListener(`pointerdown`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0)}},[n]),H.useEffect(()=>{(async()=>{C(O);try{let t=D.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},..._&&!y?[{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}]:[],...v?[{id:`yuri:craft-goal`,name:`craft-goal`,source:`yuri`,description:u(`chat.commandAutocomplete.command.craftGoalDescription`),isYuri:!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=!y,a=z(n.filter(e=>(i||e.name!==`init`)&&(o?.(e)??!0)),e);x(e=>ft(e,a)?e:a)}catch{let t=!y,n=z([{id:`yuri:new`,name:`new`,source:`yuri`,description:u(`chat.commandAutocomplete.command.newDescription`),isBuiltIn:!0},..._&&!y?[{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}]:[],...v?[{id:`yuri:craft-goal`,name:`craft-goal`,source:`yuri`,description:u(`chat.commandAutocomplete.command.craftGoalDescription`),isYuri:!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);x(e=>ft(e,n)?e:n)}finally{C(!1)}})()},[e,y,_,v,D,O,u,o]),H.useEffect(()=>{A(0)},[b]),H.useEffect(()=>{ee.current=k},[k]),H.useEffect(()=>{N.current[k]?.scrollIntoView({block:`nearest`})},[k]),H.useEffect(()=>{Te(c,ie,{rows:_e(b,{skill:u(`chat.commandAutocomplete.badge.skill`),command:u(`chat.commandAutocomplete.badge.command`),system:u(`chat.commandAutocomplete.badge.system`)}),highlightedIndex:k})},[b,c,k,u]);let ae=H.useRef(c);ae.current=c,H.useEffect(()=>()=>{Ee(ae.current,ie)},[]),H.useImperativeHandle(l,()=>({acceptIndex:(e,n=!0)=>{let r=b[e];r&&t(r,rt(r,n))},handleKeyDown:e=>{let r=b.length;if(e===`Escape`){n();return}if(r!==0){if(e===`ArrowDown`){M.current=!0,A(e=>(e+1)%r);return}if(e===`ArrowUp`){M.current=!0,A(e=>(e-1+r)%r);return}if(e===`Enter`||e===`Tab`){let n=(ee.current%r+r)%r,i=b[n];i&&t(i,rt(i,e===`Enter`))}}}}),[b,n,t]);let oe=e=>{let t=ge(e);switch(e.name){case`new`:return(0,X.jsx)(R,{name:t,className:`h-3.5 w-3.5`});case`init`:return(0,X.jsx)(R,{name:t,className:`h-3.5 w-3.5 text-green-500`});case`undo`:return(0,X.jsx)(R,{name:t,className:`h-3.5 w-3.5 text-orange-500`});case`redo`:return(0,X.jsx)(R,{name:t,className:`h-3.5 w-3.5 text-orange-500`});case`timeline`:case`reload`:return(0,X.jsx)(R,{name:t,className:`h-3.5 w-3.5`});case`compact`:return(0,X.jsx)(R,{name:t,className:`h-3.5 w-3.5 text-purple-500`});case`goal`:return(0,X.jsx)(R,{name:t,className:`h-3.5 w-3.5`});case`review`:return(0,X.jsx)(R,{name:t,className:`h-3.5 w-3.5 text-blue-500`});case`test`:case`build`:case`run`:return(0,X.jsx)(R,{name:t,className:`h-3.5 w-3.5 text-cyan-500`});default:return e.isBuiltIn?(0,X.jsx)(R,{name:t,className:`h-3.5 w-3.5 text-yellow-500`}):(0,X.jsx)(R,{name:t,className:`h-3.5 w-3.5 text-muted-foreground`})}};return(0,X.jsxs)(ve,{ref:ne,isMobile:d,className:`max-w-[450px] max-h-64`,style:a,children:[(0,X.jsx)(xe,{preventOverscroll:!0,outerClassName:`flex-1 min-h-0`,className:`px-0 py-1.5`,children:S?(0,X.jsx)(`div`,{className:`flex items-center justify-center py-4`,children:(0,X.jsx)(R,{name:`refresh`,className:`h-4 w-4 animate-spin text-muted-foreground`})}):(0,X.jsxs)(`div`,{children:[b.map((n,r)=>{let i=n.isBuiltIn,a=n.isYuri;return(0,X.jsxs)(`div`,{ref:e=>{N.current[r]=e},className:j(`flex gap-2 px-2 py-2 cursor-pointer rounded-lg`,d?`items-center`:`items-start`,ye(d,r===k),!d&&r===k&&`bg-interactive-selection/35`),onMouseDown:e=>e.preventDefault(),onPointerDown:e=>{e.pointerType===`touch`&&(I.current={x:e.clientX,y:e.clientY},L.current=!1)},onPointerMove:e=>{if(e.pointerType!==`touch`||!I.current)return;let t=e.clientX-I.current.x,n=e.clientY-I.current.y;Math.hypot(t,n)>6&&(L.current=!0)},onPointerUp:e=>{if(e.pointerType!==`touch`)return;let r=L.current;I.current=null,L.current=!1,!r&&(e.preventDefault(),e.stopPropagation(),P.current=!0,t(n,rt(n,d)))},onPointerCancel:()=>{I.current=null,L.current=!1},onClick:()=>{if(P.current){P.current=!1;return}t(n,rt(n,d))},onMouseMove:()=>{M.current=!1,A(r)},children:[(0,X.jsx)(`div`,{className:j(!d&&`mt-0.5`),children:oe(n)}),(0,X.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsxs)(`span`,{className:`typography-ui-label font-medium`,children:[`/`,Ue(n.name,e)]}),n.isSkill?(0,X.jsx)(`span`,{className:ct,children:u(`chat.commandAutocomplete.badge.skill`)}):(0,X.jsx)(`span`,{className:ct,children:u(`chat.commandAutocomplete.badge.command`)}),a?(0,X.jsx)(`span`,{className:dt,children:`Yuri`}):i?(0,X.jsx)(`span`,{className:dt,children:u(`chat.commandAutocomplete.badge.system`)}):n.scope?(0,X.jsx)(`span`,{className:n.scope===`project`?ut:lt,children:n.scope}):null,n.agent&&(0,X.jsx)(`span`,{className:dt,children:n.agent})]}),n.description&&!d&&(0,X.jsx)(`div`,{className:`typography-meta text-muted-foreground mt-0.5 truncate`,children:Ue(n.description,e)})]})]},n.id)}),b.length===0&&(0,X.jsx)(`div`,{className:`px-3 py-2 typography-ui-label text-muted-foreground`,children:u(`chat.commandAutocomplete.empty`)})]})}),!d&&(0,X.jsx)(`div`,{className:`px-3 pt-1 pb-1.5 border-t typography-meta text-muted-foreground`,children:u(`chat.autocomplete.keyboardHint`)})]})});mt.displayName=`CommandAutocomplete`;var 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=new Map,Pt=new WeakMap,Ft=e=>{let t=Pt.get(e);return t||(t=new Set(e.files.map(e=>e.path)),Pt.set(e,t)),t},It=(e,t)=>`${t}:${e}`,Lt=e=>kt.get(e)??0,Rt=e=>{let t=Lt(e)+1;return kt.set(e,t),t},zt=e=>{let t=(At.get(e)??0)+1;return At.set(e,t),t},Bt=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}),Vt=(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},Ht=(e,t)=>!e&&!t?!1:!e||!t||e.remote!==t.remote||e.branch!==t.branch||e.ahead!==t.ahead||e.behind!==t.behind,Ut=e=>{let t=e?.trim()??``;return t===`?`?``:t},Wt=(e,t)=>{let n=new Set,r=!1,i=!e;e&&(i=e.ahead!==t.ahead||e.behind!==t.behind||e.current!==t.current||e.tracking!==t.tracking||e.isClean!==t.isClean||t.upstreamComparison!==void 0&&Ht(e.upstreamComparison,t.upstreamComparison)||t.diffStats!==void 0&&e.diffStats===void 0);let a=new Map;for(let t of e?.files??[])a.set(t.path,t);for(let e of t.files??[]){let t=a.get(e.path);if(!t){n.add(e.path),Ut(e.index)&&(r=!0);continue}a.delete(e.path),(t.index!==e.index||t.working_dir!==e.working_dir)&&n.add(e.path),!r&&Ut(t.index)!==Ut(e.index)&&(r=!0)}for(let[e,t]of a)n.add(e),Ut(t.index)&&(r=!0);let o=t.diffStats,s=e?.diffStats;if(o!==void 0&&o!==s){let e=s??{};for(let t in o){let r=o[t],i=e[t];(!i||i.insertions!==r.insertions||i.deletions!==r.deletions)&&n.add(t)}for(let t in e)t in o||n.add(t)}return{changed:i||n.size>0,changedPaths:n,indexChanged:r}},Gt=e=>!e||e.trim().length===0,Kt=e=>(e||``).trim()===`U`,qt=e=>{let t=(e.index||``).trim(),n=(e.working_dir||``).trim();if(Kt(t)||Kt(n))return e;let r=t===`?`||n===`?`?`A`:t||n||` `;return{...e,index:r,working_dir:` `}},Jt=e=>{let t=(e.index||``).trim(),n=(e.working_dir||``).trim();if(Kt(t)||Kt(n))return e;let r=n||(t===`A`||t===`?`?`?`:t)||` `;return{...e,index:` `,working_dir:r}},Yt=e=>Gt(e.index)&&Gt(e.working_dir),Q=o()(c((e,t)=>({directories:new Map,activeDirectory:null,setActiveDirectory:n=>{let{activeDirectory:r,directories:i}=t();if(r!==n)if(r&&Rt(r),n&&Rt(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=It(n,a),s=jt.get(o)??(a===`light`?jt.get(It(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),d=t().directories.get(n)??Z(),f=Nt.get(n),p=f?.received===u&&f.stored===d.status?null:Wt(d.status,u);if(p?.changed){c=!0;let r=new Map(t().directories),i=r.get(n)??Z(),{changedPaths:s,indexChanged:l}=p,d=new Map(i.diffCache);for(let e of s)d.delete(e);let f=s.size>0;f&&Rt(n);let m={...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:m,diffCache:d,indexRevision:l?i.indexRevision+1:i.indexRevision,lastRepoCheckAt:o?a:i.lastRepoCheckAt,lastStatusFetch:Date.now(),lastStatusChange:f?Date.now():i.lastStatusChange}),e({directories:r}),Nt.set(n,{received:u,stored:m})}else{Nt.set(n,{received:u,stored:d.status});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`?qt(e):Jt(e);t!==e&&(l=!0),Yt(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=zt(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 M(r,i,void 0,o):await A(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=Vt(s);a.set(n,{...o,diffCache:c}),e({directories:a})},clearDiffCache:n=>{Rt(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=Math.min(Math.max(1,s),Et),l=Ft(o.status),u=o.status.diffStats,d=Bt(n),f=[],p=new Set;for(let e of i){if(p.size>=c)break;if(!e||p.has(e)||!l.has(e))continue;let t=u?.[e];t&&t.insertions+t.deletions>Tt||(p.add(e),!o.diffCache.has(e)&&(d.has(e)||f.push(e)))}let m=f;if(m.length===0)return;let h=Lt(n);if(typeof document<`u`&&document.hidden)return;m.forEach(e=>d.add(e));let g=0,_=[],v=()=>{let e=g;return g+=1,e<m.length?m[e]:null},y=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}}},b=async()=>{for(;;){if(h!==Lt(n))return;let e=v();if(!e)return;try{_.push(await y(e))}catch{}finally{d.delete(e)}}},x=Math.min(Ct,m.length);if(await Promise.allSettled(Array.from({length:x},()=>b())),m.forEach(e=>d.delete(e)),h!==Lt(n))return;let S=new Map(t().directories),C=S.get(n);if(!C)return;let w=new Map(C.diffCache),T=Date.now();_.forEach(e=>{!e.diff.isBinary&&e.diff.original===``&&e.diff.modified===``||w.set(e.path,{...e.diff,fetchedAt:T})});let E=Vt(w);S.set(n,{...C,diffCache:E}),e({directories:S})},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`})),Xt=e=>{let t=(0,U.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)},Zt=e=>{let r=(0,U.c)(3),i=H.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)},Qt=e=>{let t=(0,U.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,U.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,U.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=new Map,t[0]=n):n=t[0];let r=H.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,U.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,U.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)},rn=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\//,``),an=e=>e.branchName?$(e.branchName):e.mode===`existing`?$(e.existingBranch||e.preferredName||``):$(e.preferredName||``),on=async e=>{let t=await Se(e);try{let n=rn((await me(e)).branches?.[t]?.tracking||null);if(n?.remote)return n.remote}catch{}try{let t=rn((await pe(e)).tracking);if(t?.remote)return t.remote}catch{}return null},sn=async(e,t)=>{let n=await on(e),r=$(t);return!n||!r?null:{setUpstream:!0,upstreamRemote:n,upstreamBranch:r}},cn=async(e,t,n)=>{let r=an(t),i=n?.resolvedRootTrackingRemote,a=i===void 0?await sn(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},ln=async(e,t,n)=>{let r=await cn(e.path,t,n);return Ce(e,r)},un=`yuri:lastWorktreeSourceBranch`,dn=({mode:e,sourceBranch:t,linkedPr:n,selectedBranch:r})=>e===`existing-branch`?r||null:n?null:t||null,fn=({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},pn=(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?` `:``}`},mn=(e,t,n)=>{let r=pn(e,t,n);return`${t.length===0&&!/^\s/.test(r)?` `:``}${r}${n.length===0&&!/\s$/.test(r)?` `:``}`},hn=(e,t,n,r)=>{let i=e.slice(0,t),a=e.slice(n),o=mn(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}},gn=(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]},_n=(e,t)=>t<e.length&&e[t]===` `?t+1:t;export{Fe as C,Ae as D,ke as E,we as O,We as S,Ne as T,Q as _,un as a,ot as b,ln as c,$t as d,Zt as f,Xt as g,en as h,mn as i,on as l,tn as m,gn as n,fn as o,nn as p,hn as r,dn as s,_n as t,cn as u,Qt as v,Pe as w,it as x,mt as y};
|