@yuriai/web 0.2.34-beta.3 → 0.2.34
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/{AssistantContactStatus-D3ScljGl.js → AssistantContactStatus-PWo73pfN.js} +3 -3
- package/dist/assets/{AssistantUnreadBadge-NkBCB4n9.js → AssistantUnreadBadge-PRiDJ-Ys.js} +1 -1
- package/dist/assets/{AssistantView-CI2lhkIT.js → AssistantView-Cuz4v_fG.js} +1 -1
- package/dist/assets/{DiagramView-DNQmqZTz.js → DiagramView-dxbQ6MXl.js} +1 -1
- package/dist/assets/{GuiPluginSurface-Da61Xn7x.js → GuiPluginSurface--HkD4nKM.js} +1 -1
- package/dist/assets/MarkdownRenderer-CJAX6rqh.js +2 -0
- package/dist/assets/{MarkdownRendererImpl-yQaid-kp.js → MarkdownRendererImpl-BcRYBCHW.js} +1 -1
- package/dist/assets/{MarkstreamRendererImpl-B1S_vvdw.js → MarkstreamRendererImpl-zQ6bU9wm.js} +1 -1
- package/dist/assets/{MobileDetailNavigation-Hd18mJ2l.js → MobileDetailNavigation-pEUXnpqd.js} +1 -1
- package/dist/assets/{MobileShareBridge-CgAoZoO9.js → MobileShareBridge-13ws-R6X.js} +1 -1
- package/dist/assets/MobileTabPageHeader-BxUA9rmy.js +2 -0
- package/dist/assets/{MultiRunWindow-CdUZs6BA.js → MultiRunWindow-BEMTJndj.js} +1 -1
- package/dist/assets/{SettingsView-C0P981Yx.js → SettingsView-DI-zla9J.js} +1 -1
- package/dist/assets/{SettingsWindow-Bep47gp_.js → SettingsWindow-Cdhi7oJR.js} +1 -1
- package/dist/assets/{SetupTourDialog-CngeU4Gl.js → SetupTourDialog-DoeHKyr7.js} +1 -1
- package/dist/assets/{TerminalView-BRuYIzl6.js → TerminalView-BIKNgq3M.js} +1 -1
- package/dist/assets/{ToolOutputDialog-DvBKkPyY.js → ToolOutputDialog-Wq2Qn7Nh.js} +1 -1
- package/dist/assets/{VoiceSettings-Bwq3L5vz.js → VoiceSettings-Y1dbxZXa.js} +1 -1
- package/dist/assets/{appThemeRegistry-DSbTAzmO.js → appThemeRegistry-ClsRp7sO.js} +1 -1
- package/dist/assets/{capgoAdapter-D9oY9_ut.js → capgoAdapter-C3LxG5Eu.js} +1 -1
- package/dist/assets/{gitApi-DSzxh9dp.js → gitApi-DxUmZcUw.js} +1 -1
- package/dist/assets/{insertionBoundaries-B_epKOnH.js → insertionBoundaries-DUy8i_LT.js} +1 -1
- package/dist/assets/{main-C8bkHEMX.js → main-B1kgopEY.js} +2 -2
- package/dist/assets/{main-DROYKEfx.js → main-D7TMj7hd.js} +4 -4
- package/dist/assets/{mcpQueries-Daeejbnx.js → mcpQueries-UE2a-IBc.js} +1 -1
- package/dist/assets/{miniChat-CoUl0Vav.js → miniChat-D-04iNeR.js} +2 -2
- package/dist/assets/{mobile-LaGrgSUM.js → mobile-CDPRNGIg.js} +2 -2
- package/dist/assets/{mobileBackNavigation-goIeVVNl.js → mobileBackNavigation-DaCBsLLk.js} +1 -1
- package/dist/assets/{multirun-D_JGy3RU.js → multirun-C-f8cwos.js} +1 -1
- package/dist/assets/{native-config-BFOCyZg2.js → native-config-C32KBsgV.js} +1 -1
- package/dist/assets/{projectMeta-wNuM5rHW.js → projectMeta-DD7W5l0p.js} +1 -1
- package/dist/assets/{pwa-xGAzXaZv.js → pwa-BApESewB.js} +1 -1
- package/dist/assets/{queue-abort-optimistic-BGuIwEZM.js → queue-abort-optimistic-DEras0MF.js} +1 -1
- package/dist/assets/{readiness-BPbnvr2e.js → readiness-DSB26e24.js} +1 -1
- package/dist/assets/{renderElectronMiniChatApp-C3T22u2H.js → renderElectronMiniChatApp-BzRnk_52.js} +2 -2
- package/dist/assets/{renderMobileApp-DAQsqK1D.js → renderMobileApp-BEWiG7ie.js} +4 -4
- package/dist/assets/{runtimeConfig-DtKtvKA2.js → runtimeConfig-CRxel2dc.js} +1 -1
- package/dist/assets/{runtimeEndpointReset-BwfxkwS0.js → runtimeEndpointReset-Dc7CPkqY.js} +3 -3
- package/dist/assets/{sessionLookup-pYkh3EU2.js → sessionLookup-CV0eH5rT.js} +1 -1
- package/dist/assets/{speechSettingsQueries-6Ea0FfKL.js → speechSettingsQueries-C_e3XdqK.js} +1 -1
- package/dist/assets/types-DUFadVpY.js +2 -0
- package/dist/assets/{useAppFontEffects-BW8yQWSG.js → useAppFontEffects-B-VpUGq4.js} +5 -5
- package/dist/assets/{useDesktopWindowControlsLayout-BC2wTKdJ.js → useDesktopWindowControlsLayout-DMCQ5xgT.js} +1 -1
- package/dist/assets/{useEffectiveDirectory-OJzoI-nH.js → useEffectiveDirectory-F4aXdQ21.js} +1 -1
- package/dist/assets/{useMobileNavigationStore-C8nCzxDH.js → useMobileNavigationStore-DHX2bCjA.js} +4 -4
- package/dist/assets/{usePluginsStore-B3584ktF.js → usePluginsStore-YObSp0OZ.js} +1 -1
- package/dist/assets/{useWorkerHighlightedLines-CZlfrVSP.js → useWorkerHighlightedLines-Di0GTxuY.js} +1 -1
- package/dist/index.html +5 -5
- package/dist/mini-chat.html +5 -5
- package/dist/mobile.html +5 -5
- package/package.json +1 -1
- package/server/lib/host-update/DOCUMENTATION.md +6 -0
- package/dist/assets/MarkdownRenderer-D-7r0LeT.js +0 -2
- package/dist/assets/MobileTabPageHeader-B9kurLFw.js +0 -2
- package/dist/assets/types-CNECQLeq.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-hePW80VL.js";import{i as t}from"./runtime-switch-DEZ1K7qW.js";import{n}from"./runtime-fetch-D0YWp3FJ.js";import{At as r,bt as i}from"./gitApiHttp-MWsHNHuo.js";import{n as a}from"./vendor-react-DlzBev0S.js";import{s as o}from"./vendor-tanstack-react-query-B-Wpqq5J.js";import{a as s,o as c}from"./queryRuntime-2dx7jbt9.js";import{va as l}from"./useMobileNavigationStore-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-hePW80VL.js";import{i as t}from"./runtime-switch-DEZ1K7qW.js";import{n}from"./runtime-fetch-D0YWp3FJ.js";import{At as r,bt as i}from"./gitApiHttp-MWsHNHuo.js";import{n as a}from"./vendor-react-DlzBev0S.js";import{s as o}from"./vendor-tanstack-react-query-B-Wpqq5J.js";import{a as s,o as c}from"./queryRuntime-2dx7jbt9.js";import{va as l}from"./useMobileNavigationStore-DHX2bCjA.js";var u=e({mcpConfigsQueryOptions:()=>v,mcpStatusQueryOptions:()=>y,normalizeMcpDirectory:()=>f,readMcpConfigsSnapshot:()=>S,readMcpStatusSnapshot:()=>C,refreshMcpConfigsQuery:()=>w,refreshMcpStatusQuery:()=>T,resolveMcpConfigQueryDirectory:()=>p,useMcpConfigsQuery:()=>b,useMcpStatusQuery:()=>x}),d=a(),f=e=>{if(typeof e!=`string`)return null;let t=e.trim();if(!t)return null;let n=t.replace(/\\/g,`/`);return n.length>1?n.replace(/\/+$/,``):n},p=()=>{let e=l.getState().getActiveProject?.();return f(e?.path)??f(r.getDirectory())},m=(e,n=t())=>c.mcp.configs(e,n),h=(e,n=t())=>c.mcp.status(e,n),g=e=>e?r.getScopedApiClient(e):r.getApiClient(),_=e=>e?{location:{directory:e}}:void 0,v=(e=p(),r=t())=>{let i=f(e);return{queryKey:m(i,r),queryFn:async({signal:e})=>{let t=i?`?directory=${encodeURIComponent(i)}`:``,r=await n(`/api/config/mcp${t}`,{headers:i?{"x-opencode-directory":i}:void 0,signal:e});if(!r.ok)throw Error(`Failed to load MCP configs`);let a=await r.json();if(!Array.isArray(a))throw Error(`Invalid MCP configs response`);return a},staleTime:5e3,retry:2}},y=(e,n=t())=>{let r=f(e);return{queryKey:h(r,n),queryFn:async()=>{let e=await g(r).mcp.list(_(r));if(!Array.isArray(e.data))throw Error(`v2 mcp.list returned no data`);let t={};for(let n of e.data)n?.name&&(t[n.name]=n.status);return t},staleTime:2e3,retry:1}},b=(e,t)=>{let n=(0,d.c)(9),i;n[0]===t?i=n[1]:(i=t===void 0?{}:t,n[0]=t,n[1]=i);let a=i,s=l(E),c,u;if(n[2]!==s||n[3]!==e){let t=e===void 0?f(s)??f(r.getDirectory()):f(e);u=o,c=v(t),n[2]=s,n[3]=e,n[4]=c,n[5]=u}else c=n[4],u=n[5];let p;return n[6]!==a.enabled||n[7]!==c?(p={...c,enabled:a.enabled},n[6]=a.enabled,n[7]=c,n[8]=p):p=n[8],u(p)},x=(e,t)=>{let n=(0,d.c)(10),r;n[0]===t?r=n[1]:(r=t===void 0?{}:t,n[0]=t,n[1]=r);let a=r,s=i(D),c=e===void 0?s:e,l,u,p;if(n[2]!==a.enabled||n[3]!==c){let e=f(c);l=a.enabled!==!1&&!!e,p=o,u=y(e),n[2]=a.enabled,n[3]=c,n[4]=l,n[5]=u,n[6]=p}else l=n[4],u=n[5],p=n[6];let m;return n[7]!==l||n[8]!==u?(m={...u,enabled:l},n[7]=l,n[8]=u,n[9]=m):m=n[9],p(m)},S=(e=s,n=p(),r=t())=>e.getQueryData(m(f(n),r))??[],C=(e=s,n,r=t())=>e.getQueryData(h(f(n),r))??{},w=async(e,n,r)=>{let i=f(n);return t()===r?e.fetchQuery({...v(i,r),staleTime:0}):S(e,i,r)},T=async(e,n,r)=>{let i=f(n);return t()===r?e.fetchQuery({...y(i,r),staleTime:0}):C(e,i,r)};function E(e){return e.getActiveProject?.()?.path??null}function D(e){return e.currentDirectory}export{w as a,b as c,C as i,x as l,f as n,T as o,S as r,p as s,u as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/renderElectronMiniChatApp-
|
|
2
|
-
import{t as e}from"./runtimeConfig-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/renderElectronMiniChatApp-BzRnk_52.js","assets/rolldown-runtime-hePW80VL.js","assets/desktop-BAmoc_34.js","assets/runtime-auth-DBn9yahL.js","assets/runtime-switch-DEZ1K7qW.js","assets/runtimeAPIRegistry-C2VogTny.js","assets/vendor-base-ui-CzHs0bHY.js","assets/gitApiHttp-MWsHNHuo.js","assets/runtime-fetch-D0YWp3FJ.js","assets/vendor-zustand-vDaAPGfl.js","assets/vendor-opencode-client-cQ47ywrT.js","assets/vendor-effect-X1Hqc7ba.js","assets/brand-storage-bootstrap-D4BW3w-M.js","assets/brand-storage-migration-Bhz6UOBJ.js","assets/useUIStore-BerIUSLP.js","assets/bootstrap-C8paoQ0j.js","assets/vendor-react-DlzBev0S.js","assets/queryRuntime-2dx7jbt9.js","assets/vendor-tanstack-query-core-Y_YoRHtC.js","assets/pathNormalization-ewtPqJWn.js","assets/vendor-pathe-vBmvQE8f.js","assets/runtime-ead7P81A.js","assets/runtime-file-resource-BP4P52ry.js","assets/fileQueries-C2Rs6TPz.js","assets/vendor-tanstack-react-query-B-Wpqq5J.js","assets/runtime-file-store-BVRgEtI-.js","assets/path-utils-jGozTg9d.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/vendor-sonner-BEHGipm5.js","assets/vendor-reactuses-core-DWo5Wn6R.js","assets/vendor-lodash-es-BS45jPoZ.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/button-C-gRcs_2.js","assets/store-OjrIiXCx.js","assets/tour-DDI0Zg7l.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/MobileShareBridge-13ws-R6X.js","assets/platform-sEg2IOLZ.js","assets/MobileDetailNavigation-pEUXnpqd.js","assets/useMobileNavigationStore-DHX2bCjA.js","assets/useAssistantUIStore-D25VqrpK.js","assets/vendor-zod-DZzbCm1s.js","assets/vendor-opencode-schema-DWT45VBX.js","assets/Icon-OJf0qBKf.js","assets/AgentAvatar-DLzcNrQ0.js","assets/agentColors-DWSbQXy2.js","assets/vendor-dicebear-core-CV95S5Pg.js","assets/vendor-dicebear-styles-C4OfoX7R.js","assets/dualLimitLru-D8Sphgua.js","assets/useThemeSystem-CNzUUkFn.js","assets/vendor-framer-motion-DDMKlXiP.js","assets/dialog-3UseH0hM.js","assets/dialog-CTYD3Sbr.css","assets/rasterizePng-056Poix7.js","assets/useAppFontEffects-B-VpUGq4.js","assets/desktopHosts-BLU1tGSX.js","assets/desktopRelayRestore-2BIIs8mZ.js","assets/vendor-pierre-diffs-BFiZ3IhI.js","assets/vendor-hast-util-to-html-Bw_SgZ1t.js","assets/vendor-character-entities-legacy-Wut6vMuj.js","assets/vendor-character-entities-html4-DlN_yAFd.js","assets/vendor-ccount-CyGsA0u7.js","assets/vendor-comma-separated-tokens-B9ouxNNS.js","assets/vendor-oniguruma-to-es-CrHzjjSU.js","assets/vendor-oniguruma-parser-D2DIvhSP.js","assets/vendor-diff-Dq7CZNim.js","assets/vendor-lru_map-BMOrLc9L.js","assets/fileMentionAutocompleteState-BZJqfgae.js","assets/vendor-fuse.js-DB5wDJbI.js","assets/vendor-fuzzysort-ukaRp9PC.js","assets/gitApi-DxUmZcUw.js","assets/vendor-simplewebauthn-browser-Dwhcdg_5.js","assets/checkbox-BrJBzET8.js","assets/input-CmLlZdeD.js","assets/tooltip-Degmpxnd.js","assets/pwa-BApESewB.js","assets/MobileResizableSheet-DuAi_epR.js","assets/MobileWindowStack-DGLdgoGr.js","assets/select-J8r9SxHt.js","assets/device-w1ioiqv3.js","assets/textarea-BHgcxJdC.js","assets/OverlayScrollbar-CZD1yU06.js","assets/dropdown-menu.styles-BDla58Rm.js","assets/projectMeta-DD7W5l0p.js","assets/vendor-dnd-kit-core-DK4OoOTr.js","assets/vendor-dnd-kit-accessibility-BOtnpZt5.js","assets/vendor-dnd-kit-sortable-Cv69eQm1.js","assets/YuriLogo-CMUoGUHc.js","assets/themes-BgDJcxRc.js","assets/scheduledTaskNavigation-Cq5yavoC.js","assets/theme-validation-BGYdrOu7.js","assets/sessionLookup-CV0eH5rT.js","assets/useDictation-DFVJpRbm.js","assets/LoadingImage-sZ5omN5L.js","assets/ImageLoadingPlaceholder-DlQbo9CM.js","assets/image-loading-DKQOYtti.js","assets/image-loading-D9Z_BASK.css","assets/sessionLookup-8C8nv-EP.css","assets/fileMentionTouchSelection-ByaQJcTS.js","assets/insertionBoundaries-DUy8i_LT.js","assets/appThemeRegistry-ClsRp7sO.js","assets/queue-abort-optimistic-DEras0MF.js","assets/MarkdownRenderer-CJAX6rqh.js","assets/useEffectiveDirectory-F4aXdQ21.js","assets/markdownHeightCache-xNkQdlqi.js","assets/url-MRa-FtQa.js","assets/toolHelpers-iEHVHQ9p.js","assets/react-a6PrrNTm.js","assets/FadeInOnReveal-BRrU2ivL.js","assets/useWorkerHighlightedLines-Di0GTxuY.js","assets/markdownTheme-CHNl6tUv.js","assets/markdown-worker-oBGEB9Eg.js","assets/vendor-tanstack-react-virtual-DSFNK3qc.js","assets/vendor-cmdk-C_tivUtr.js","assets/vendor-aria-hidden-BbL3cEyI.js","assets/sortable-tabs-strip-CiP6RIQa.js","assets/speechSettingsQueries-C_e3XdqK.js","assets/vendor-motion-C9oiAdx-.js","assets/useStreamingTextThrottle-VhgGU_te.js","assets/useFontPreferences-CEK8G_Ps.js","assets/terminalApi-BMWW_0wH.js","assets/useAppFontEffects-RpgNbjA4.css","assets/useDesktopWindowControlsLayout-DMCQ5xgT.js","assets/AssistantContactStatus-PWo73pfN.js","assets/assistant-attachment-cache-oatc8F4t.js","assets/src-BgE3FRXg.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{t as e}from"./runtimeConfig-CRxel2dc.js";import{o as t}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";/* empty css */window.__YURI_RUNTIME_APIS__=e(),t(async()=>{let{renderElectronMiniChatApp:e}=await import(`./renderElectronMiniChatApp-BzRnk_52.js`);return{renderElectronMiniChatApp:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126])).then(({renderElectronMiniChatApp:t})=>{t(window.__YURI_RUNTIME_APIS__??e())});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/renderMobileApp-
|
|
2
|
-
import{t as e}from"./runtimeConfig-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/renderMobileApp-BEWiG7ie.js","assets/rolldown-runtime-hePW80VL.js","assets/runtime-auth-DBn9yahL.js","assets/runtime-switch-DEZ1K7qW.js","assets/runtime-fetch-D0YWp3FJ.js","assets/runtimeAPIRegistry-C2VogTny.js","assets/vendor-zustand-vDaAPGfl.js","assets/vendor-base-ui-CzHs0bHY.js","assets/gitApiHttp-MWsHNHuo.js","assets/desktop-BAmoc_34.js","assets/vendor-opencode-client-cQ47ywrT.js","assets/vendor-effect-X1Hqc7ba.js","assets/brand-storage-bootstrap-D4BW3w-M.js","assets/brand-storage-migration-Bhz6UOBJ.js","assets/useUIStore-BerIUSLP.js","assets/bootstrap-C8paoQ0j.js","assets/vendor-react-DlzBev0S.js","assets/queryRuntime-2dx7jbt9.js","assets/vendor-tanstack-query-core-Y_YoRHtC.js","assets/pathNormalization-ewtPqJWn.js","assets/vendor-pathe-vBmvQE8f.js","assets/runtime-ead7P81A.js","assets/runtime-file-resource-BP4P52ry.js","assets/fileQueries-C2Rs6TPz.js","assets/vendor-tanstack-react-query-B-Wpqq5J.js","assets/runtime-file-store-BVRgEtI-.js","assets/path-utils-jGozTg9d.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/platform-sEg2IOLZ.js","assets/capgoAdapter-C3LxG5Eu.js","assets/types-DUFadVpY.js","assets/vendor-pierre-diffs-BFiZ3IhI.js","assets/vendor-hast-util-to-html-Bw_SgZ1t.js","assets/vendor-character-entities-legacy-Wut6vMuj.js","assets/vendor-character-entities-html4-DlN_yAFd.js","assets/vendor-ccount-CyGsA0u7.js","assets/vendor-comma-separated-tokens-B9ouxNNS.js","assets/vendor-oniguruma-to-es-CrHzjjSU.js","assets/vendor-oniguruma-parser-D2DIvhSP.js","assets/vendor-diff-Dq7CZNim.js","assets/vendor-lru_map-BMOrLc9L.js","assets/vendor-sonner-BEHGipm5.js","assets/vendor-reactuses-core-DWo5Wn6R.js","assets/vendor-lodash-es-BS45jPoZ.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/button-C-gRcs_2.js","assets/store-OjrIiXCx.js","assets/tour-DDI0Zg7l.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/MobileShareBridge-13ws-R6X.js","assets/MobileDetailNavigation-pEUXnpqd.js","assets/useMobileNavigationStore-DHX2bCjA.js","assets/useAssistantUIStore-D25VqrpK.js","assets/vendor-zod-DZzbCm1s.js","assets/vendor-opencode-schema-DWT45VBX.js","assets/Icon-OJf0qBKf.js","assets/AgentAvatar-DLzcNrQ0.js","assets/agentColors-DWSbQXy2.js","assets/vendor-dicebear-core-CV95S5Pg.js","assets/vendor-dicebear-styles-C4OfoX7R.js","assets/dualLimitLru-D8Sphgua.js","assets/useThemeSystem-CNzUUkFn.js","assets/vendor-framer-motion-DDMKlXiP.js","assets/dialog-3UseH0hM.js","assets/dialog-CTYD3Sbr.css","assets/rasterizePng-056Poix7.js","assets/gitApi-DxUmZcUw.js","assets/useAppFontEffects-B-VpUGq4.js","assets/desktopHosts-BLU1tGSX.js","assets/desktopRelayRestore-2BIIs8mZ.js","assets/fileMentionAutocompleteState-BZJqfgae.js","assets/vendor-fuse.js-DB5wDJbI.js","assets/vendor-fuzzysort-ukaRp9PC.js","assets/vendor-simplewebauthn-browser-Dwhcdg_5.js","assets/checkbox-BrJBzET8.js","assets/input-CmLlZdeD.js","assets/tooltip-Degmpxnd.js","assets/pwa-BApESewB.js","assets/MobileResizableSheet-DuAi_epR.js","assets/MobileWindowStack-DGLdgoGr.js","assets/select-J8r9SxHt.js","assets/device-w1ioiqv3.js","assets/textarea-BHgcxJdC.js","assets/OverlayScrollbar-CZD1yU06.js","assets/dropdown-menu.styles-BDla58Rm.js","assets/projectMeta-DD7W5l0p.js","assets/vendor-dnd-kit-core-DK4OoOTr.js","assets/vendor-dnd-kit-accessibility-BOtnpZt5.js","assets/vendor-dnd-kit-sortable-Cv69eQm1.js","assets/YuriLogo-CMUoGUHc.js","assets/themes-BgDJcxRc.js","assets/scheduledTaskNavigation-Cq5yavoC.js","assets/theme-validation-BGYdrOu7.js","assets/sessionLookup-CV0eH5rT.js","assets/useDictation-DFVJpRbm.js","assets/LoadingImage-sZ5omN5L.js","assets/ImageLoadingPlaceholder-DlQbo9CM.js","assets/image-loading-DKQOYtti.js","assets/image-loading-D9Z_BASK.css","assets/sessionLookup-8C8nv-EP.css","assets/fileMentionTouchSelection-ByaQJcTS.js","assets/insertionBoundaries-DUy8i_LT.js","assets/appThemeRegistry-ClsRp7sO.js","assets/queue-abort-optimistic-DEras0MF.js","assets/MarkdownRenderer-CJAX6rqh.js","assets/useEffectiveDirectory-F4aXdQ21.js","assets/markdownHeightCache-xNkQdlqi.js","assets/url-MRa-FtQa.js","assets/toolHelpers-iEHVHQ9p.js","assets/react-a6PrrNTm.js","assets/FadeInOnReveal-BRrU2ivL.js","assets/useWorkerHighlightedLines-Di0GTxuY.js","assets/markdownTheme-CHNl6tUv.js","assets/markdown-worker-oBGEB9Eg.js","assets/vendor-tanstack-react-virtual-DSFNK3qc.js","assets/vendor-cmdk-C_tivUtr.js","assets/vendor-aria-hidden-BbL3cEyI.js","assets/sortable-tabs-strip-CiP6RIQa.js","assets/speechSettingsQueries-C_e3XdqK.js","assets/vendor-motion-C9oiAdx-.js","assets/useStreamingTextThrottle-VhgGU_te.js","assets/useFontPreferences-CEK8G_Ps.js","assets/terminalApi-BMWW_0wH.js","assets/useAppFontEffects-RpgNbjA4.css","assets/tap-LkQum5bB.js","assets/MobileTabPageHeader-BxUA9rmy.js","assets/vendor-codemirror-autocomplete-C0FrlFqZ.js","assets/vendor-codemirror-lang-angular-Cm7vBE3E.js","assets/vendor-codemirror-lang-json-DowyFczU.js","assets/vendor-codemirror-lang-markdown-npWBZIoE.js","assets/vendor-codemirror-lang-python-OPRdU26g.js","assets/vendor-codemirror-legacy-modes-DwltVFbT.js","assets/mcpQueries-UE2a-IBc.js","assets/usePluginsStore-YObSp0OZ.js","assets/collapsible-B7esGYLd.js","assets/vendor-codemirror-commands-5saeUOVY.js","assets/vendor-codemirror-search-hZY-L2l8.js","assets/vendor-replit-codemirror-vim-BmQmU1lR.js","assets/vendor-codemirror-language-data-B3pLWvv-.js","assets/projectActions-BX0cjZoq.js","assets/AssistantContactStatus-PWo73pfN.js","assets/assistant-attachment-cache-oatc8F4t.js","assets/runtimeEndpointReset-Dc7CPkqY.js","assets/YuriWordmark-DHYo0FlR.js","assets/mobileBackNavigation-DaCBsLLk.js","assets/AssistantUnreadBadge-PRiDJ-Ys.js","assets/context-menu-DWn1nSZC.js","assets/readiness-DSB26e24.js","assets/native-errors-06if6eu-.js","assets/appearance--vFosLNi.js","assets/vendor-cron-parser-BmO80h0C.js","assets/runtimeEndpointReset-BP4JwHFJ.css","assets/SettingsView-DI-zla9J.js","assets/native-config-C32KBsgV.js","assets/vendor-qrcode-D7jBCyl-.js","assets/vendor-dijkstrajs-BAzPDGZM.js","assets/VoiceSettings-Y1dbxZXa.js","assets/VoiceSettings-C0HSdVvS.css","assets/GuiPluginWindow-BykPaQeY.js","assets/vendor-yaml-C9KlJAlj.js","assets/AssistantView-Cuz4v_fG.js","assets/touch-gestures-CErgaXZ7.js","assets/renderMobileApp-1G4-5u-t.css","assets/src-BgE3FRXg.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{t as e}from"./runtimeConfig-CRxel2dc.js";import{o as t}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";/* empty css */window.__YURI_RUNTIME_APIS__=e(),t(async()=>{let{renderMobileApp:e}=await import(`./renderMobileApp-BEWiG7ie.js`);return{renderMobileApp:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164])).then(({renderMobileApp:t})=>{t(window.__YURI_RUNTIME_APIS__??e())});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{st as t}from"./vendor-base-ui-CzHs0bHY.js";import{n}from"./vendor-react-DlzBev0S.js";import{a as r,n as i}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{n as a}from"./platform-sEg2IOLZ.js";import{i as o}from"./vendor-reactuses-core-DWo5Wn6R.js";import{i as s}from"./appThemeRegistry-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{st as t}from"./vendor-base-ui-CzHs0bHY.js";import{n}from"./vendor-react-DlzBev0S.js";import{a as r,n as i}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{n as a}from"./platform-sEg2IOLZ.js";import{i as o}from"./vendor-reactuses-core-DWo5Wn6R.js";import{i as s}from"./appThemeRegistry-ClsRp7sO.js";var c=n(),l=e(t(),1),u=`__yuriMobileBackRoute`,d=()=>typeof window>`u`||a()?null:{currentState:()=>window.history.state&&typeof window.history.state==`object`?window.history.state:null,pushState:e=>window.history.pushState(e,``,window.location.href),back:()=>window.history.back(),subscribe:e=>{let t=t=>e(t.state&&typeof t.state==`object`?t.state:null);return window.addEventListener(`popstate`,t),()=>window.removeEventListener(`popstate`,t)}},f=e=>{let t=e?.[u];return typeof t==`number`&&Number.isFinite(t)?t:null},p=new class{routes=[];listeners=new Set;nextToken=1;history;removeHistoryListener=null;programmaticHistoryBackToken=null;pendingHistoryRemovals=new Map;animatedBackDriver=null;presentationCancelDriver=null;constructor(e=d()){this.history=e}subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));getTopRoute=()=>this.routes.at(-1)??null;register=e=>{let t=this.pendingHistoryRemovals.get(e.id);this.pendingHistoryRemovals.delete(e.id);let n=!!(this.history&&t!==void 0&&f(this.history.currentState())===t),r={...e,token:n&&t!==void 0?t:this.nextToken++};this.routes.push(r),this.ensureHistoryListener(),this.history&&!n&&this.history.pushState({...this.history.currentState()??{},[u]:r.token}),this.notify();let i=!0;return()=>{if(!i)return;i=!1;let e=this.routes.indexOf(r);e<0||(this.routes.splice(e,1),this.history&&f(this.history.currentState())===r.token?(this.pendingHistoryRemovals.set(r.id,r.token),queueMicrotask(()=>{if(this.pendingHistoryRemovals.get(r.id)===r.token){if(this.pendingHistoryRemovals.delete(r.id),!this.history||f(this.history.currentState())!==r.token){this.routes.length===0&&this.pendingHistoryRemovals.size===0&&this.disposeHistoryListener();return}this.programmaticHistoryBackToken=r.token,this.history.back(),this.routes.length===0&&this.pendingHistoryRemovals.size===0&&this.disposeHistoryListener()}})):this.routes.length===0&&this.pendingHistoryRemovals.size===0&&this.disposeHistoryListener(),this.notify())}};backImmediately=e=>{let t=this.getTopRoute();return!t||e&&t.layer!==e?!1:t.onBack()!==!1};requestAnimatedBack=e=>{let t=this.getTopRoute();return!t||e&&t.layer!==e?!1:this.animatedBackDriver?.(t)?!0:this.backImmediately(e)};setAnimatedBackDriver=e=>(this.animatedBackDriver=e,()=>{this.animatedBackDriver===e&&(this.animatedBackDriver=null)});setPresentationCancelDriver=e=>(this.presentationCancelDriver=e,()=>{this.presentationCancelDriver===e&&(this.presentationCancelDriver=null)});cancelPresentation=()=>{this.presentationCancelDriver?.()};requestBrowserBack=()=>{let e=this.getTopRoute();return e?this.history&&f(this.history.currentState())===e.token?(this.history.back(),!0):e.onBack()!==!1:!1};ensureHistoryListener(){!this.history||this.removeHistoryListener||(this.removeHistoryListener=this.history.subscribe(e=>{if(this.programmaticHistoryBackToken!==null){this.programmaticHistoryBackToken=null;return}let t=this.getTopRoute();t&&f(e)!==t.token&&t.onBack()===!1&&this.history&&this.history.pushState({...this.history.currentState()??{},[u]:t.token})}))}disposeHistoryListener(){this.removeHistoryListener?.(),this.removeHistoryListener=null,this.programmaticHistoryBackToken=null,this.pendingHistoryRemovals.clear()}notify(){this.listeners.forEach(e=>e())}},m=e=>{let t=(0,c.c)(8),{id:n,active:r,layer:i,onBack:a,surfaceRef:s,underlayRef:u}=e,d=i===void 0?`root`:i,f=o(a),m,h;t[0]!==r||t[1]!==f||t[2]!==n||t[3]!==d||t[4]!==s||t[5]!==u?(m=()=>{if(r)return p.register({id:n,layer:d,onBack:f,getSurface:()=>s.current,getUnderlay:()=>u?.current??null})},h=[r,f,n,d,s,u],t[0]=r,t[1]=f,t[2]=n,t[3]=d,t[4]=s,t[5]=u,t[6]=m,t[7]=h):(m=t[6],h=t[7]),l.useEffect(m,h)},h=r(`YuriNavigation`),g=e=>Math.min(1,Math.max(0,Number.isFinite(e)?e:0)),_=(e,t)=>!e||!t?!1:e.onBack()!==!1,v=e=>{let t=g(e.progress),n=e.commit?1-t:t;if(n<=.001)return 0;let r=Math.max(1,e.viewportWidth??390),i=Math.abs(e.velocityX??0)/r,a=n/Math.max(e.commit?2.4:2.8,i)*1e3,o=e.commit?90:100,s=e.commit?320:260;return Math.round(Math.min(s,Math.max(o,a)))},y=e=>{let{surface:t,underlay:n,surfaceTransition:r,surfaceAnimation:i,underlayTransition:a,underlayAnimation:o}=e;t.style.removeProperty(`transform`),t.style.removeProperty(`opacity`),t.style.removeProperty(`will-change`),t.style.removeProperty(`box-shadow`),t.style.transition=r,t.style.animation=i,n&&(n.style.removeProperty(`transform`),n.style.removeProperty(`opacity`),n.style.removeProperty(`will-change`),n.style.transition=a??``,n.style.animation=o??``,delete n.dataset.mobileBackRevealing)},b=(e,t)=>{let n=g(t),{surface:r}=e;r.style.transform=`translate3d(${n*100}%, 0, 0)`},x=e=>!e.surfaceConnected||e.topRouteToken!==e.routeToken||e.routeSurface!==e.outgoingSurface,S=async(e,t,n,r)=>{if(!r&&typeof e.animate==`function`){let r=e.style.transform||`translate3d(0%, 0, 0)`,i=`translate3d(${t}%, 0, 0)`,a=e.animate([{transform:r},{transform:i}],{duration:n,easing:`cubic-bezier(0.22, 1, 0.36, 1)`,fill:`forwards`}),o=!1;try{await a.finished,o=!0}catch{}finally{o&&(e.style.transform=i),a.cancel()}return}e.style.transform=`translate3d(${t}%, 0, 0)`},C=async(e,t,n=typeof window<`u`&&window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches,r=v({progress:Number.parseFloat(e.style.transform.match(/translate3d\(([-\d.]+)%/)?.[1]??`0`)/100,commit:t}))=>S(e,t?100:0,r,n),w=class{pending=0;enqueue(){this.pending+=1}take(){return this.pending!==0&&(--this.pending,!0)}clear(){this.pending=0}},T=e=>{let t=(0,c.c)(4),{enabled:n,rootRoutesBlocked:r}=e,o,u;t[0]!==n||t[1]!==r?(o=()=>{if(!n||!a()||i.getPlatform()===`web`)return;let e=!1,t=null,o=null,c=0,l=0,u=0,d=new w,f=[],m=e=>!!e&&(!r||e?.layer===`overlay`),x=()=>{let e=m(p.getTopRoute());h.setEnabled({enabled:e}).catch(E)},S=()=>{if(p.cancelPresentation(),o)return;let e=p.getTopRoute();if(!m(e))return;let n=e.getSurface();if(!n)return;n.getAnimations().forEach(D),o=null;let r=e.layer===`root`?e.getUnderlay():null,i=n.style.transition,a=n.style.animation,s=r?.style.transition??null,c=r?.style.animation??null;r?.getAnimations().forEach(O),n.style.transition=`none`,n.style.animation=`none`,n.style.willChange=`transform`,r&&(r.style.removeProperty(`transform`),r.style.removeProperty(`will-change`),r.dataset.mobileBackRevealing=`true`),u+=1,t={route:e,surface:n,underlay:r,surfaceTransition:i,surfaceAnimation:a,underlayTransition:s,underlayAnimation:c},b(t,0)},T=e=>{l=g(e),!c&&(c=window.requestAnimationFrame(()=>{c=0,t&&b(t,l)}))},F=k,I=(n,r,i)=>{if(n&&s(),o)return n&&m(p.getTopRoute())?(d.enqueue(),!0):!1;c&&=(window.cancelAnimationFrame(c),0),t||S(),t&&r!==void 0&&b(t,r);let a=t,f=u;if(t=null,!a){if(!n)return!1;let e=p.getTopRoute();return _(e,m(e))}o=a;let h=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1,x=v({progress:g(r??l),commit:n,velocityX:i,viewportWidth:window.innerWidth});return C(a.surface,n,h,x).then(async()=>{f===u&&(!e&&n&&(a.route.onBack(),await F(a)),f===u&&(y(a),o===a&&(o=null),!e&&d.take()&&I(!0,0,0)))}),!0},L=p.setAnimatedBackDriver(e=>e!==p.getTopRoute()||!m(e)?!1:I(!0,0,0)),R=p.subscribe(x);return(async()=>{let t=await h.addListener(`backStarted`,S),n=await h.addListener(`backProgressed`,e=>T(e.progress??0)),r=await h.addListener(`backCancelled`,e=>I(!1,e.progress,e.velocityX)),i=await h.addListener(`backInvoked`,e=>I(!0,e.progress,e.velocityX));if(e){await Promise.all([t.remove(),n.remove(),r.remove(),i.remove()]);return}f.push(t,n,r,i),x()})().catch(A),x(),()=>{e=!0,u+=1,d.clear(),R(),L(),c&&window.cancelAnimationFrame(c),t&&y(t),o&&(o.surface.getAnimations().forEach(j),o.underlay?.getAnimations().forEach(M),y(o)),t=null,o=null,h.setEnabled({enabled:!1}).catch(N),f.forEach(P)}},u=[n,r],t[0]=n,t[1]=r,t[2]=o,t[3]=u):(o=t[2],u=t[3]),l.useEffect(o,u)};function E(){}function D(e){return e.cancel()}function O(e){return e.cancel()}function k(e){return new Promise(t=>{let n=0,r=12,i=!1,a=()=>{i||(i=!0,c(),n&&window.cancelAnimationFrame(n),t())},o=()=>{let t=p.getTopRoute();return x({surfaceConnected:e.surface.isConnected,routeToken:e.route.token,topRouteToken:t?.token??null,routeSurface:e.route.getSurface(),outgoingSurface:e.surface})},s=()=>{if(o()||r<=0){a();return}--r,n=window.requestAnimationFrame(s)},c=p.subscribe(()=>{o()&&a()});s()})}function A(){}function j(e){return e.cancel()}function M(e){return e.cancel()}function N(){}function P(e){e.remove()}export{m as n,T as r,p as t};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{S as t}from"./desktop-BAmoc_34.js";import{a as n,r}from"./vendor-zustand-vDaAPGfl.js";import{ot as i,st as a}from"./vendor-base-ui-CzHs0bHY.js";import{At as o,In as s,Vn as c,bt as l}from"./gitApiHttp-MWsHNHuo.js";import"./brand-storage-bootstrap-D4BW3w-M.js";import{r as u}from"./useUIStore-BerIUSLP.js";import{n as d}from"./vendor-react-DlzBev0S.js";import{u as f}from"./fileQueries-C2Rs6TPz.js";import{i as p}from"./vendor-reactuses-core-DWo5Wn6R.js";import{f as m,i as h,r as g,t as _,y as v}from"./button-C-gRcs_2.js";import{$r as y,Bi as b,Cr as x,Hi as S,Nr as C,br as w,f as T,ki as ee,p as E,ri as D,va as O,yr as k}from"./useMobileNavigationStore-C8nCzxDH.js";import{n as A}from"./Icon-OJf0qBKf.js";import{n as te}from"./gitApi-DSzxh9dp.js";import{t as j}from"./checkbox-BrJBzET8.js";import{t as ne}from"./input-CmLlZdeD.js";import{i as re,n as M,t as ie}from"./tooltip-Degmpxnd.js";import{a as ae}from"./device-w1ioiqv3.js";import{a as oe,b as se,c as N,f as P,h as F,l as I,o as L,p as R,r as z,w as ce,x as B,y as le}from"./insertionBoundaries-B_epKOnH.js";import{a as V,c as ue,d as H,i as U,n as de,o as W,r as G,s as fe,t as pe}from"./select-J8r9SxHt.js";import{r as K,t as me}from"./textarea-BHgcxJdC.js";import{a as q,f as J,h as he,i as Y,m as ge,n as _e}from"./projectMeta-wNuM5rHW.js";import{n as ve,r as ye,t as be}from"./collapsible-B7esGYLd.js";var X=e(a(),1),xe=d(),Se=/^[a-z0-9](?:[a-z0-9-]{0,48}[a-z0-9])?$/,Ce=/^g[1-9]\d*$/,Z=(e,t,n,r,i)=>{if(!Se.test(e)||t!==void 0&&!Ce.test(t)||!n?.trim()||!r?.trim()||n!==n.trim()||r!==r.trim())return null;if(i===void 0)return{groupSlug:e,runGroup:t,providerID:n,modelID:r,fusion:!1};if(i===`fusion`)return{groupSlug:e,runGroup:t,providerID:n,modelID:r,fusion:!0};if(!/^\d+$/.test(i))return null;let a=Number.parseInt(i,10);return!Number.isSafeInteger(a)||a<=0?null:{groupSlug:e,runGroup:t,providerID:n,modelID:r,index:a,fusion:!1}},we=e=>{if(!e)return null;let t=e.split(`/`);if(t.length<3||t.length>5)return null;let[n]=t;if(t.length===3)return Z(n,void 0,t[1],t[2],void 0);if(t.length===4){let[,e,r,i]=t;return Ce.test(e)?Z(n,e,r,i,void 0):Z(n,void 0,e,r,i)}let[,r,i,a,o]=t;return r===``?Z(n,void 0,i,a,o):Z(n,r,i,a,o)},Te=e=>{let t=[e.groupSlug];return e.runGroup&&t.push(e.runGroup),t.push(e.providerID,e.modelID),e.index!==void 0&&t.push(String(e.index)),t.join(`/`)},Q=(e,t,n,r)=>{let i=[e];return r&&i.push(r),i.push(t,n,`fusion`),i.join(`/`)},Ee=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).substring(0,50),De=(e,t)=>`${Ee(e)}-${Ee(t)}`.substring(0,60),Oe=(e,t)=>`${e}/${t}`,ke=e=>{let t=e.replace(/\\/g,`/`);return t===`/`?`/`:t.length>1?t.replace(/\/+$/,``):t},Ae=(e,t)=>{let n=ke(t),r=e.directory,i=typeof r==`string`&&r.trim().length>0?e:{...e,directory:n};c(e.id,n),E.getState().markSessionAsYuriCreated(e.id),y.getState().upsertSession(i);try{s().ensureChild(n,{bootstrap:!1}).setState(t=>{let n=t.session.findIndex(t=>t.id===e.id);if(n>=0&&t.session[n]===i)return t;let r=n>=0?t.session.map((e,t)=>t===n?i:e):[...t.session,i].sort((e,t)=>e.id.localeCompare(t.id));return{session:r,sessionTotal:Math.max(t.sessionTotal,r.length),limit:Math.max(t.limit,r.length)}})}catch{}return i},je=()=>{let e=O.getState(),t=e.activeProjectId;if(!t)return null;let n=e.projects.find(e=>e.id===t);if(n?.path)return{id:n.id,path:n.path};let r=l.getState().currentDirectory??null;if(r&&r.trim().length>0){let e=r.replace(/\\/g,`/`).replace(/\/+$/,``)||r;return{id:`path:${e}`,path:e}}return null},Me=n()(r(e=>({isLoading:!1,error:null,createMultiRun:async t=>{let n=t.name.trim(),{groups:r,agent:i,files:a,setupCommands:s}=t;if(!n)return e({error:`Group name is required`}),null;if(!r||r.length===0)return e({error:`At least one run group is required`}),null;for(let t=0;t<r.length;t++){if(!r[t].prompt.trim())return e({error:`Group ${t+1}: prompt is required`}),null;if(r[t].models.length<1)return e({error:`Group ${t+1}: select at least 1 model`}),null;if(r[t].models.length>5)return e({error:`Group ${t+1}: maximum 5 models allowed`}),null}e({isLoading:!0,error:null});try{let c=je();if(!c)return e({error:`Select a project`,isLoading:!1}),null;let l=c.path,u=await te(l)&&t.isolateRuns!==!1,d=Ee(n),f=u?await J(l):void 0,p=u?await I(l):null,m=[],h=s?.filter(e=>e.trim().length>0)??[];for(let e=0;e<r.length;e++){let n=r[e],i=n.prompt,a=new Map;for(let e of n.models){let t=`${e.providerID}:${e.modelID}`;a.set(t,(a.get(t)||0)+1)}let s=new Map;for(let g of n.models){let n=`${g.providerID}:${g.modelID}`,_=a.get(n)||1,v=(s.get(n)||0)+1;s.set(n,v);let y=De(g.providerID,g.modelID),b=r.length>1?`g${e+1}`:void 0,x=_>1?Oe(d,`${y}/${v}`):Oe(d,y),S=b?`${b}/${x}`:x,T=Te({groupSlug:d,runGroup:b,providerID:g.providerID,modelID:g.modelID,index:_>1?v:void 0});try{if(!u){let e=await o.withDirectory(l,()=>o.createSession({title:T}));Ae(e,l),m.push({sessionId:e.id,worktreePath:l,providerID:g.providerID,modelID:g.modelID,variant:g.variant,prompt:i});continue}let e=await N(c,{preferredName:S,mode:`new`,branchName:S,worktreeName:S,startRef:t.worktreeBaseBranch||`HEAD`,setupCommands:h,returnAfterDirectoryCreated:!0},{resolvedRootTrackingRemote:p}),n={...e,createdFromBranch:f,kind:`standard`};await w(c)&&await C(e.path);let r=await o.withDirectory(e.path,()=>o.createSession({title:T}));Ae(r,e.path),E.getState().setWorktreeMetadata(r.id,n),m.push({sessionId:r.id,worktreePath:e.path,providerID:g.providerID,modelID:g.modelID,variant:g.variant,prompt:i})}catch(e){console.warn(`[MultiRun] Failed to create session:`,e)}}}let g=s?.filter(e=>e.trim().length>0)??[];g.length>0&&x(c,g).catch(()=>{console.warn(`[MultiRun] Failed to save worktree setup commands`)});let _=m.map(e=>e.sessionId),v=m[0]?.sessionId??null;if(_.length===0)return e({error:`Failed to create any sessions`,isLoading:!1}),null;let y=a?.map(e=>({type:`file`,mime:e.mime,filename:e.filename,url:e.url}));return(async()=>{try{await Promise.allSettled(m.map(async e=>{try{await T({sessionId:e.sessionId,directory:e.worktreePath,content:e.prompt,providerID:e.providerID,modelID:e.modelID,variant:e.variant,agent:i,files:y})}catch(e){console.warn(`[MultiRun] Failed to start run:`,e)}}))}catch(e){console.warn(`[MultiRun] Failed to start runs:`,e)}})(),e({isLoading:!1}),{groupSlug:d,sessionIds:_,firstSessionId:v}}catch(t){return e({error:t instanceof Error?t.message:`Failed to create Multi-Run`,isLoading:!1}),null}},clearError:()=>{e({error:null})}}),{name:`multirun-store`})),$=i(),Ne=`h-7`,Pe=()=>`${Date.now()}-${Math.random().toString(36).substring(2,9)}`,Fe=e=>{let t=(0,xe.c)(13),{model:n,instanceIndex:r,totalSameModel:i,onRemove:a}=e,o=n.displayName||`${n.providerID}/${n.modelID}`,s=i>1?`${o} (${r})`:o,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=g(`flex items-center gap-1.5 px-2 rounded-md bg-interactive-selection/20 border border-border/30`,Ne),t[0]=c):c=t[0];let l;t[1]!==n.modelID||t[2]!==n.providerID?(l=(0,$.jsx)(H,{modelId:n.modelID,providerId:n.providerID,className:`h-3.5 w-3.5`}),t[1]=n.modelID,t[2]=n.providerID,t[3]=l):l=t[3];let u;t[4]===s?u=t[5]:(u=(0,$.jsx)(`span`,{className:`typography-meta font-medium truncate max-w-[140px]`,children:s}),t[4]=s,t[5]=u);let d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(A,{name:`close`,className:`h-3.5 w-3.5`}),t[6]=d):d=t[6];let f;t[7]===a?f=t[8]:(f=(0,$.jsx)(`button`,{type:`button`,onClick:a,className:`text-muted-foreground hover:text-foreground ml-0.5`,children:d}),t[7]=a,t[8]=f);let p;return t[9]!==l||t[10]!==u||t[11]!==f?(p=(0,$.jsxs)(`div`,{className:c,children:[l,u,f]}),t[9]=l,t[10]=u,t[11]=f,t[12]=p):p=t[12],p},Ie=e=>{let t=(0,xe.c)(131),{selectedModels:n,onAdd:r,onRemove:i,onUpdate:a,minModels:o,addButtonLabel:s,showChips:c,maxModels:l,addButtonClassName:d,dropdownSide:f,dropdownClassName:p,containerClassName:h,triggerIcon:v}=e,y=c===void 0||c,b=f===void 0?`top`:f,{t:x}=m(),C=ee(Le),w=ee(Re),T=u(ze),E=u(Be),{favoriteModelsList:D,recentModelsList:O}=ge(),k=u(Ve),te=u(He),[j,ne]=X.useState(!1),[re,M]=X.useState(``),[ie,ae]=X.useState(null),oe=X.useRef(null),se=X.useRef(null),N=l===1,P=l===void 0||n.length<l||N,F;if(t[0]!==n){F=new Map;for(let e of n){let t=`${e.providerID}:${e.modelID}`;F.set(t,(F.get(t)||0)+1)}t[0]=n,t[1]=F}else F=t[1];let I=F,L;t[2]===n?L=t[3]:(L=e=>n.filter(t=>t.providerID===e.providerID&&t.modelID===e.modelID).findIndex(t=>t.instanceId===e.instanceId)+1,t[2]=n,t[3]=L);let R=L,z,ce;t[4]!==b||t[5]!==j?(z=()=>{if(!j||!se.current)return;let e=se.current.getBoundingClientRect();if(b===`bottom`){let t=(window.visualViewport?.height??document.documentElement.clientHeight??window.innerHeight)-e.bottom-16-112;ae(Math.max(160,Math.min(320,t)));return}let t=se.current.parentElement;for(;t&&!(t.getAttribute(`role`)===`dialog`||t.hasAttribute(`data-scroll-shadow`));){let e=getComputedStyle(t);if(e.overflow===`auto`||e.overflow===`hidden`||e.overflowY===`auto`||e.overflowY===`hidden`)break;t=t.parentElement}let n=t?t.getBoundingClientRect().top:0,r=e.top-n-16;ae(Math.max(150,Math.min(300,r)))},ce=[b,j],t[4]=b,t[5]=j,t[6]=z,t[7]=ce):(z=t[6],ce=t[7]),X.useEffect(z,ce);let B,le;t[8]!==P||t[9]!==j?(B=()=>{!P&&j&&(ne(!1),M(``))},le=[P,j],t[8]=P,t[9]=j,t[10]=B,t[11]=le):(B=t[10],le=t[11]),X.useEffect(B,le);let V,H;t[12]===j?(V=t[13],H=t[14]):(V=()=>{if(!j)return;let e=e=>{oe.current&&!oe.current.contains(e.target)&&(ne(!1),M(``))};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},H=[j],t[12]=j,t[13]=V,t[14]=H),X.useEffect(V,H);let W;t[15]!==N||t[16]!==r||t[17]!==a||t[18]!==n.length?(W=e=>{let t={providerID:e.providerID,modelID:e.modelID,displayName:S(e.model,e.modelID)||e.modelID,instanceId:Pe()};N&&n.length>0&&a?a(0,t):r(t),N&&(ne(!1),M(``))},t[15]=N,t[16]=r,t[17]=a,t[18]=n.length,t[19]=W):W=t[19];let G=W,K;t[20]===x?K=t[21]:(K=x(`multirun.modelMultiSelect.search.placeholder`),t[20]=x,t[21]=K);let me;t[22]===x?me=t[23]:(me=x(`multirun.modelMultiSelect.search.noResults`),t[22]=x,t[23]=me);let q;t[24]===x?q=t[25]:(q=x(`multirun.modelMultiSelect.sections.favorites`),t[24]=x,t[25]=q);let J;t[26]===x?J=t[27]:(J=x(`multirun.modelMultiSelect.sections.recent`),t[26]=x,t[27]=J);let Y;t[28]===x?Y=t[29]:(Y=x(`multirun.modelMultiSelect.keyboard.hint`),t[28]=x,t[29]=Y);let _e;t[30]===x?_e=t[31]:(_e=x(`settings.agents.modelSelector.actions.favorite`),t[30]=x,t[31]=_e);let ve;t[32]===x?ve=t[33]:(ve=x(`settings.agents.modelSelector.actions.unfavorite`),t[32]=x,t[33]=ve);let ye;t[34]===x?ye=t[35]:(ye=x(`chat.modelControls.provider`),t[34]=x,t[35]=ye);let be;t[36]===x?be=t[37]:(be=x(`chat.modelControls.capabilities`),t[36]=x,t[37]=be);let Se;t[38]===x?Se=t[39]:(Se=x(`chat.modelControls.capability.toolCalling`),t[38]=x,t[39]=Se);let Ce;t[40]===x?Ce=t[41]:(Ce=x(`chat.modelControls.capability.reasoning`),t[40]=x,t[41]=Ce);let Z;t[42]===x?Z=t[43]:(Z=x(`chat.modelControls.modality.image`),t[42]=x,t[43]=Z);let we;t[44]===x?we=t[45]:(we=x(`chat.modelControls.modality.video`),t[44]=x,t[45]=we);let Te;t[46]===x?Te=t[47]:(Te=x(`chat.modelControls.modality.audio`),t[46]=x,t[47]=Te);let Q;t[48]===x?Q=t[49]:(Q=x(`chat.modelControls.costPerMillion`),t[48]=x,t[49]=Q);let Ee;t[50]===x?Ee=t[51]:(Ee=x(`chat.modelControls.costInput`),t[50]=x,t[51]=Ee);let De;t[52]===x?De=t[53]:(De=x(`chat.modelControls.costOutput`),t[52]=x,t[53]=De);let Oe;t[54]!==K||t[55]!==me||t[56]!==q||t[57]!==J||t[58]!==Y||t[59]!==_e||t[60]!==ve||t[61]!==ye||t[62]!==be||t[63]!==Se||t[64]!==Ce||t[65]!==Z||t[66]!==we||t[67]!==Te||t[68]!==Q||t[69]!==Ee||t[70]!==De?(Oe={searchPlaceholder:K,noResults:me,favorites:q,recent:J,keyboardHint:Y,favorite:_e,unfavorite:ve,provider:ye,capabilities:be,capabilityToolCalling:Se,capabilityReasoning:Ce,modalityImage:Z,modalityVideo:we,modalityAudio:Te,costPerMillion:Q,costInput:Ee,costOutput:De},t[54]=K,t[55]=me,t[56]=q,t[57]=J,t[58]=Y,t[59]=_e,t[60]=ve,t[61]=ye,t[62]=be,t[63]=Se,t[64]=Ce,t[65]=Z,t[66]=we,t[67]=Te,t[68]=Q,t[69]=Ee,t[70]=De,t[71]=Oe):Oe=t[71];let ke=Oe,Ae;t[72]===h?Ae=t[73]:(Ae=g(`relative`,h),t[72]=h,t[73]=Ae);let je;t[74]===d?je=t[75]:(je=g(Ne,`!border-border/80 !bg-[var(--surface-subtle)] hover:!bg-[var(--interactive-hover)]/70`,d),t[74]=d,t[75]=je);let Me=!P,Ie;t[76]===j?Ie=t[77]:(Ie=()=>{ne(!j)},t[76]=j,t[77]=Ie);let We;t[78]===v?We=t[79]:(We=v??(0,$.jsx)(A,{name:`add`,className:`h-3.5 w-3.5 mr-1`}),t[78]=v,t[79]=We);let Ge;t[80]!==s||t[81]!==x?(Ge=s??x(`multirun.modelMultiSelect.actions.addModel`),t[80]=s,t[81]=x,t[82]=Ge):Ge=t[82];let Ke;t[83]!==je||t[84]!==Me||t[85]!==Ie||t[86]!==We||t[87]!==Ge?(Ke=(0,$.jsxs)(_,{ref:se,type:`button`,variant:`outline`,size:`sm`,className:je,disabled:Me,onClick:Ie,children:[We,Ge]}),t[83]=je,t[84]=Me,t[85]=Ie,t[86]=We,t[87]=Ge,t[88]=Ke):Ke=t[88];let qe;t[89]!==ie||t[90]!==P||t[91]!==p||t[92]!==b||t[93]!==D||t[94]!==w||t[95]!==G||t[96]!==k||t[97]!==E||t[98]!==j||t[99]!==ke||t[100]!==I||t[101]!==te||t[102]!==C||t[103]!==O||t[104]!==re||t[105]!==T?(qe=j?(0,$.jsx)(`div`,{className:g(`absolute left-0 z-50 w-[min(420px,calc(100vw-2rem))] max-w-[calc(100vw-2rem)] flex flex-col overflow-hidden rounded-xl border border-border/50 shadow-lg`,b===`top`?`bottom-full mb-1`:`top-full mt-1`,p),style:{background:`linear-gradient(var(--surface-elevated),var(--surface-elevated)),linear-gradient(var(--surface-background),var(--surface-background))`},children:(0,$.jsx)(he,{providers:C,providerOrder:te,favoriteModels:D,recentModels:O,getMetadata:w,hiddenModels:k,searchQuery:re,onSearchQueryChange:M,onSelect:G,labels:ke,selectionCount:e=>I.get(`${e.providerID}:${e.modelID}`)||0,disabled:!P,maxHeightClassName:`flex-1`,maxHeightStyle:{maxHeight:ie?`${ie}px`:`300px`},stickyHeaders:!0,tooltipsEnabled:j,isFavorite:e=>E(e.providerID,e.modelID),onToggleFavorite:e=>T(e.providerID,e.modelID),onEscape:()=>{ne(!1),M(``)}})}):null,t[89]=ie,t[90]=P,t[91]=p,t[92]=b,t[93]=D,t[94]=w,t[95]=G,t[96]=k,t[97]=E,t[98]=j,t[99]=ke,t[100]=I,t[101]=te,t[102]=C,t[103]=O,t[104]=re,t[105]=T,t[106]=qe):qe=t[106];let Je;t[107]!==Ae||t[108]!==Ke||t[109]!==qe?(Je=(0,$.jsxs)(`div`,{className:Ae,ref:oe,children:[Ke,qe]}),t[107]=Ae,t[108]=Ke,t[109]=qe,t[110]=Je):Je=t[110];let Ye;t[111]!==R||t[112]!==I||t[113]!==i||t[114]!==a||t[115]!==C||t[116]!==n||t[117]!==y||t[118]!==x?(Ye=y&&n.length>0&&(0,$.jsx)(`div`,{className:`flex flex-col gap-2 w-full`,children:n.map((e,t)=>{let n=`${e.providerID}:${e.modelID}`,r=I.get(n)||1,o=R(e),s=C.find(t=>t.id===e.providerID)?.models?.find(t=>t.id===e.modelID),c=s?.variants?Object.keys(s.variants):[],l=c.length>0,u=e.variant??`__default__`;return(0,$.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,$.jsx)(Fe,{model:e,instanceIndex:o,totalSameModel:r,onRemove:()=>i(t)}),l&&(0,$.jsxs)(pe,{value:u,onValueChange:n=>{if(!a)return;let r=n===`__default__`?void 0:n;a(t,{...e,variant:r})},children:[(0,$.jsxs)(fe,{size:`chip`,className:`px-2 gap-1.5 rounded-md !border-border/80 !bg-[var(--surface-subtle)] hover:!bg-[var(--interactive-hover)]/70 typography-meta font-medium text-foreground`,children:[(0,$.jsx)(A,{name:`brain-ai-3`,className:g(`h-3.5 w-3.5 flex-shrink-0`,u===`__default__`?`text-muted-foreground`:`text-[color:var(--status-info)]`)}),(0,$.jsx)(ue,{placeholder:x(`multirun.modelMultiSelect.variant.placeholder`),children:e=>e===`__default__`?x(`multirun.modelMultiSelect.variant.default`):e})]}),(0,$.jsxs)(de,{fitContent:!0,children:[(0,$.jsx)(U,{value:`__default__`,className:`pr-2 [&>span:first-child]:hidden`,children:x(`multirun.modelMultiSelect.variant.default`)}),c.map(Ue)]})]})]},e.instanceId)})}),t[111]=R,t[112]=I,t[113]=i,t[114]=a,t[115]=C,t[116]=n,t[117]=y,t[118]=x,t[119]=Ye):Ye=t[119];let Xe;t[120]!==Je||t[121]!==Ye?(Xe=(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 items-center`,children:[Je,Ye]}),t[120]=Je,t[121]=Ye,t[122]=Xe):Xe=t[122];let Ze;t[123]!==l||t[124]!==o||t[125]!==n.length||t[126]!==x?(Ze=o!==void 0&&n.length<o&&(0,$.jsx)(`p`,{className:`typography-micro text-muted-foreground`,children:l===void 0?x(`multirun.modelMultiSelect.validation.minOnly`,{min:o}):x(`multirun.modelMultiSelect.validation.minToMax`,{min:o,max:l})}),t[123]=l,t[124]=o,t[125]=n.length,t[126]=x,t[127]=Ze):Ze=t[127];let Qe;return t[128]!==Xe||t[129]!==Ze?(Qe=(0,$.jsxs)(`div`,{className:`space-y-2`,children:[Xe,Ze]}),t[128]=Xe,t[129]=Ze,t[130]=Qe):Qe=t[130],Qe};function Le(e){return e.providers}function Re(e){return e.getModelMetadata}function ze(e){return e.toggleFavoriteModel}function Be(e){return e.isFavoriteModel}function Ve(e){return e.hiddenModels}function He(e){return e.providerOrder}function Ue(e){return(0,$.jsx)(U,{value:e,className:`pr-2 [&>span:first-child]:hidden`,children:e},e)}function We(e){let t=(0,xe.c)(30),{git:n}=f(),r=P(e),i=se(e),a=F(e),o=R(e),s=le(Ye),c=le(Je),l,u;t[0]!==e||t[1]!==c||t[2]!==n||t[3]!==i||t[4]!==a?(l=()=>{!e||!n||i!==null||a||c(e,n,{silent:!0})},u=[e,n,c,i,a],t[0]=e,t[1]=c,t[2]=n,t[3]=i,t[4]=a,t[5]=l,t[6]=u):(l=t[5],u=t[6]),X.useEffect(l,u);let d;t[7]!==r?.all||t[8]!==e||t[9]!==s||t[10]!==n||t[11]!==i?(d=()=>{!e||!n||i===!0&&(r?.all||s(e,n))},t[7]=r?.all,t[8]=e,t[9]=s,t[10]=n,t[11]=i,t[12]=d):d=t[12];let p=r?.all,m;t[13]!==e||t[14]!==s||t[15]!==n||t[16]!==i||t[17]!==p?(m=[e,n,i,p,s],t[13]=e,t[14]=s,t[15]=n,t[16]=i,t[17]=p,t[18]=m):m=t[18],X.useEffect(d,m);let h=a||i===!0&&o,g;bb0:{if(!r?.all){let e;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[19]=e):e=t[19],g=e;break bb0}let e;t[20]===r.all?e=t[21]:(e=r.all.filter(qe).sort(),t[20]=r.all,t[21]=e),g=e}let _=g,v;bb1:{if(!r?.all){let e;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[22]=e):e=t[22],v=e;break bb1}let e;t[23]===r.all?e=t[24]:(e=r.all.filter(Ke).map(Ge).sort(),t[23]=r.all,t[24]=e),v=e}let y=v,b;bb2:{if(!e){b=null;break bb2}if(i!==null){b=i;break bb2}if(h){b=null;break bb2}b=r?.all?!0:null}let x=b,S;return t[25]!==x||t[26]!==h||t[27]!==_||t[28]!==y?(S={localBranches:_,remoteBranches:y,isLoading:h,isGitRepository:x},t[25]=x,t[26]=h,t[27]=_,t[28]=y,t[29]=S):S=t[29],S}function Ge(e){return e.replace(/^remotes\//,``)}function Ke(e){return e.startsWith(`remotes/`)}function qe(e){return!e.startsWith(`remotes/`)}function Je(e){return e.fetchStatus}function Ye(e){return e.fetchBranches}var Xe=({directory:e,value:t,onChange:n,className:r,disabled:i,id:a})=>{let{t:o}=m(),{localBranches:s,remoteBranches:c,isLoading:l,isGitRepository:u}=We(e),d=X.useMemo(()=>[...s,...c.map(e=>`remotes/${e}`)],[s,c]);return X.useEffect(()=>{if(i||l||d.length===0||t&&d.includes(t))return;let r=t,a=!1;return(async()=>{try{let t=e?await J(e).catch(()=>null):null;if(a)return;let i=localStorage.getItem(oe),{sourceBranch:o,shouldClearSavedSourceBranch:s}=L({branches:d,savedSourceBranch:i,rootBranch:t});if(s&&localStorage.removeItem(oe),a||r&&d.includes(r))return;o&&n(o)}catch{}})(),()=>{a=!0}},[d,e,i,l,n,t]),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(pe,{value:t,onValueChange:n,disabled:i||!u||l,children:[(0,$.jsx)(fe,{id:a,size:`lg`,className:r??`w-fit typography-meta text-foreground`,children:(0,$.jsx)(ue,{placeholder:o(l?`multiRun.branchSelector.status.loadingBranches`:`multiRun.branchSelector.placeholder.selectSourceBranch`)})}),(0,$.jsx)(de,{className:`max-h-[280px] max-w-[320px]`,children:l?(0,$.jsx)(`div`,{className:`px-2 py-4 text-center typography-meta text-muted-foreground`,children:o(`multiRun.branchSelector.status.loadingBranches`)}):s.length===0&&c.length===0?(0,$.jsx)(`div`,{className:`px-2 py-4 text-center typography-meta text-muted-foreground`,children:o(`multiRun.branchSelector.status.noBranchesFound`)}):(0,$.jsxs)($.Fragment,{children:[s.length>0&&(0,$.jsxs)(G,{children:[(0,$.jsx)(V,{className:`font-semibold text-foreground`,children:o(`multiRun.branchSelector.groups.localBranches`)}),s.map(e=>(0,$.jsx)(U,{value:e,className:`whitespace-normal break-all`,children:e},e))]}),s.length>0&&c.length>0&&(0,$.jsx)(W,{}),c.length>0&&(0,$.jsxs)(G,{children:[(0,$.jsx)(V,{className:`font-semibold text-foreground`,children:o(`multiRun.branchSelector.groups.remoteBranches`)}),c.map(e=>(0,$.jsx)(U,{value:`remotes/${e}`,className:`whitespace-normal break-all`,children:e},`remotes/${e}`))]})]})})]}),u===!1&&(0,$.jsx)(`p`,{className:`typography-micro text-muted-foreground/70 mt-2`,children:o(`multiRun.branchSelector.status.notInGitRepository`)})]})},Ze=e=>{let t=(0,xe.c)(36),{value:n,onChange:r,className:i,disabled:a,id:o,portalToBody:s}=e,{t:c}=m(),l=ee(Qe),u=ee($e),d=ee(et),f;t[0]===l?f=t[1]:(f=l(),t[0]=l,t[1]=f);let p=f,h;t[2]===p?h=t[3]:(h=p.filter(tt),t[2]=p,t[3]=h);let _=h,v,y;t[4]!==p.length||t[5]!==u?(v=()=>{p.length===0&&u()},y=[p.length,u],t[4]=p.length,t[5]=u,t[6]=v,t[7]=y):(v=t[6],y=t[7]),X.useEffect(v,y);let b,x;t[8]!==d||t[9]!==a||t[10]!==r||t[11]!==_||t[12]!==n?(b=()=>{if(a)return;let e=n.trim();if(e.length>0&&_.some(t=>t.name===e))return;let t=typeof d==`string`&&d.trim().length>0?d.trim():null;if(t&&_.some(e=>e.name===t)){r(t);return}let i=_[0]?.name;i&&r(i)},x=[d,a,r,_,n],t[8]=d,t[9]=a,t[10]=r,t[11]=_,t[12]=n,t[13]=b,t[14]=x):(b=t[13],x=t[14]),X.useEffect(b,x);let S=n.trim().length>0?n:void 0,C;t[15]===i?C=t[16]:(C=g(`max-w-full typography-meta text-foreground !border-border/80 !bg-[var(--surface-subtle)] hover:!bg-[var(--interactive-hover)]/70 data-[popup-open]:!bg-[var(--interactive-active)]/70`,i),t[15]=i,t[16]=C);let w;t[17]===c?w=t[18]:(w=c(`multirun.agentSelector.placeholder`),t[17]=c,t[18]=w);let T;t[19]===w?T=t[20]:(T=(0,$.jsx)(ue,{placeholder:w}),t[19]=w,t[20]=T);let E;t[21]!==o||t[22]!==C||t[23]!==T?(E=(0,$.jsx)(fe,{id:o,size:`lg`,className:C,children:T}),t[21]=o,t[22]=C,t[23]=T,t[24]=E):E=t[24];let D;t[25]===_?D=t[26]:(D=_.length>0&&(0,$.jsx)(G,{children:_.map(nt)}),t[25]=_,t[26]=D);let O;t[27]!==s||t[28]!==D?(O=(0,$.jsx)(de,{fitContent:!0,portalToBody:s,children:D}),t[27]=s,t[28]=D,t[29]=O):O=t[29];let k;return t[30]!==a||t[31]!==r||t[32]!==S||t[33]!==E||t[34]!==O?(k=(0,$.jsxs)(pe,{value:S,onValueChange:r,disabled:a,children:[E,O]}),t[30]=a,t[31]=r,t[32]=S,t[33]=E,t[34]=O,t[35]=k):k=t[35],k};function Qe(e){return e.getVisibleAgents}function $e(e){return e.loadAgents}function et(e){return e.currentAgentName}function tt(e){return b(e.mode)}function nt(e){return(0,$.jsx)(U,{value:e.name,className:`w-auto whitespace-nowrap`,children:e.name},e.name)}var rt=10485760,it=5,at=e=>{let t=(0,xe.c)(3),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(re,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,tabIndex:-1,className:`inline-flex items-center justify-center text-muted-foreground/50 hover:text-muted-foreground transition-colors`,children:(0,$.jsx)(A,{name:`information`,className:`h-3.5 w-3.5`})})}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,$.jsxs)(ie,{children:[r,(0,$.jsx)(M,{side:`top`,className:`max-w-[240px]`,children:n})]}),t[1]=n,t[2]=i),i},ot=e=>{let t=(0,xe.c)(9),{htmlFor:n,required:r,children:i,info:a}=e,o;t[0]===r?o=t[1]:(o=r&&(0,$.jsx)(`span`,{className:`text-destructive ml-0.5`,children:`*`}),t[0]=r,t[1]=o);let s;t[2]!==i||t[3]!==n||t[4]!==o?(s=(0,$.jsxs)(`label`,{htmlFor:n,className:`typography-meta font-medium text-foreground`,children:[i,o]}),t[2]=i,t[3]=n,t[4]=o,t[5]=s):s=t[5];let c=a&&a,l;return t[6]!==s||t[7]!==c?(l=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8],l},st=e=>{let t=h(e.path),n=e.icon?Y[e.icon]:null,r=e.color?_e[e.color]:void 0,i=(0,$.jsx)(A,{name:n??`folder`,className:`h-3.5 w-3.5`,style:r?{color:r}:void 0});return(0,$.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`flex h-4 w-4 shrink-0 items-center justify-center overflow-hidden text-muted-foreground`,children:e.iconImage?(0,$.jsx)(q,{project:e,className:`size-full object-contain`,fallback:i}):i}),(0,$.jsx)(`span`,{className:`truncate`,children:t})]})},ct=({initialPrompt:e,onCreated:n,onCancel:r,isWindowed:i=!1})=>{let{t:a}=m(),[o,s]=X.useState(``),[c,u]=X.useState(()=>[{id:Pe(),prompt:``,models:[]}]),[d,f]=X.useState(``),[h,y]=X.useState([]),[b,x]=X.useState(!1),[S,C]=X.useState([]),[w,T]=X.useState(!1),[ee,te]=X.useState(!1),[oe,se]=X.useState(!0),N=X.useRef(null),P=l(e=>e.currentDirectory??null),F=X.useMemo(()=>{if(typeof window>`u`)return null;let e=window.__VSCODE_CONFIG__?.workspaceFolder;return typeof e==`string`&&e.trim().length>0?e.trim():null},[]),I=O(e=>e.activeProjectId),L=O(e=>e.setActiveProjectIdOnly),R=O(e=>e.projects),[z,ce]=X.useState(()=>I??null);X.useEffect(()=>{if(I){ce(I);return}!z&&R.length>0&&ce(R[0].id)},[I,R,z]);let B=X.useMemo(()=>z?R.find(e=>e.id===z)??null:null,[R,z]),le=B?.path??P,V=p(e=>{ce(e),e!==I&&L(e)}),H=X.useMemo(()=>{if(B?.path)return{id:B.id,path:B.path};let e=P??F;return e?{id:`path:${e}`,path:e}:null},[B,P,F]),[W]=X.useState(()=>typeof window<`u`&&t()),G=X.useMemo(()=>typeof navigator>`u`?!1:/Macintosh|Mac OS X/.test(navigator.userAgent||``),[]),me=ae(),q=X.useMemo(()=>{if(typeof window>`u`)return null;let e=window.__YURI_MACOS_MAJOR__;if(typeof e==`number`&&Number.isFinite(e)&&e>0)return e;if(typeof navigator>`u`)return null;let t=(navigator.userAgent||``).match(/Mac OS X (\d+)[._](\d+)/);if(!t)return null;let n=Number.parseInt(t[1],10),r=Number.parseInt(t[2],10);return Number.isNaN(n)?null:n===10?r:n},[]),J=X.useMemo(()=>W&&G||me?`pl-[5.5rem]`:`pl-3`,[W,G,me]),he=X.useMemo(()=>!W||!G||q===null?``:q>=26?`h-12`:q<=15?`h-14`:``,[W,G,q]),Y=p(async e=>{e.target.closest(`button, a, input, select, textarea`)||e.button===0&&W&&await v()}),ge=p(e=>{r&&e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),r())}),_e=!!r;X.useEffect(()=>{if(_e)return window.addEventListener(`keydown`,ge,!0),()=>window.removeEventListener(`keydown`,ge,!0)},[_e]);let[xe,Se]=X.useState(``),{isLoading:Ce,isGitRepository:Z}=We(le),we=X.useRef(!1),Te=Z===!0,Q=Te&&oe;X.useEffect(()=>{if(Z===!1){we.current=!0,se(!1);return}Z===!0&&we.current&&(we.current=!1,se(!0))},[Z]);let Ee=Me(e=>e.createMultiRun),De=Me(e=>e.error),Oe=Me(e=>e.clearError);X.useEffect(()=>{typeof e==`string`&&e.trim().length>0&&u(t=>{let n=[...t];return n.length>0&&!n[0].prompt.trim()&&(n[0]={...n[0],prompt:e}),n})},[e]),X.useEffect(()=>{if(!H)return;let e=!1;return te(!0),(async()=>{try{let t=await k(H);e||C(t)}catch{}finally{e||te(!1)}})(),()=>{e=!0}},[H]);let ke=p((e,t)=>{u(n=>n.map(n=>n.id===e?{...n,...t}:n))}),Ae=p(e=>{u(t=>t.filter(t=>t.id!==e))}),je=p(()=>{u(e=>[...e,{id:Pe(),prompt:``,models:[]}])}),Ne=async e=>{let t=e.target.files;if(!t)return;let n=0;for(let e=0;e<t.length;e++){let r=t[e];if(r.size>rt){D.error(a(`multirun.launcher.toast.fileTooLarge`,{fileName:r.name}));continue}try{let e=await new Promise((e,t)=>{let n=new FileReader;n.onload=()=>e(n.result),n.onerror=t,n.readAsDataURL(r)});y(t=>[...t,{id:Pe(),filename:r.name,mimeType:r.type||`application/octet-stream`,size:r.size,dataUrl:e}]),n++}catch(e){console.error(`File attach failed`,e),D.error(a(`multirun.launcher.toast.attachFailed`,{fileName:r.name}))}}n>0&&D.success(a(n===1?`multirun.launcher.toast.attachedSingle`:`multirun.launcher.toast.attachedPlural`,{count:n})),N.current&&(N.current.value=``)},Fe=e=>{y(t=>t.filter(t=>t.id!==e))},Ie=X.useMemo(()=>c.reduce((e,t)=>e+t.models.length,0),[c]),Le=async e=>{e.preventDefault();let t=c.filter(e=>e.prompt.trim()&&e.models.length>=1);if(t.length!==0&&!(Ie<1)){x(!0),Oe();try{z&&z!==I&&L(z);let e=h.map(e=>({mime:e.mimeType,filename:e.filename,url:e.dataUrl})),r=S.filter(e=>e.trim().length>0),i=t.map(e=>({prompt:e.prompt.trim(),models:e.models.map(e=>({providerID:e.providerID,modelID:e.modelID,displayName:e.displayName,variant:e.variant}))})),a={name:o.trim(),groups:i,agent:d||void 0,worktreeBaseBranch:Q?xe:void 0,isolateRuns:Q,files:e.length>0?e:void 0,setupCommands:r.length>0?r:void 0},s=await Ee(a);s&&(s.firstSessionId&&E.getState().setCurrentSession(s.firstSessionId),n?.())}finally{x(!1)}}},Re=!!(o.trim()&&c.some(e=>e.prompt.trim()&&e.models.length>=1)&&Ie>=1&&le&&!Ce&&(Z===!1||!Q||xe)),ze=S.filter(e=>e.trim()).length;return(0,$.jsxs)(`form`,{onSubmit:Le,className:`flex flex-col h-full bg-background`,children:[i?null:(0,$.jsxs)(`header`,{onMouseDown:Y,className:g(`relative flex h-12 shrink-0 items-center justify-center border-b app-region-drag select-none`,J,he),style:{borderColor:`var(--interactive-border)`},children:[(0,$.jsx)(`h1`,{className:`typography-ui-label font-medium`,children:a(`multirun.launcher.title`)}),r&&(0,$.jsx)(`div`,{className:`absolute right-0 flex items-center pr-3`,children:(0,$.jsxs)(ie,{children:[(0,$.jsx)(re,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:r,"aria-label":a(`multirun.launcher.actions.closeEsc`),className:`inline-flex h-9 w-9 items-center justify-center p-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-interactive-hover/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary app-region-no-drag`,children:(0,$.jsx)(A,{name:`close`,className:`h-5 w-5`})})}),(0,$.jsx)(M,{children:(0,$.jsx)(`p`,{children:a(`multirun.launcher.actions.closeEsc`)})})]})})]}),(0,$.jsx)(K,{className:`flex-1 min-h-0 overflow-auto`,size:64,hideTopShadow:!0,children:(0,$.jsx)(`div`,{className:`mx-auto w-full max-w-2xl px-4 sm:px-6 py-5`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,$.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-x-4 gap-y-3`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(ot,{htmlFor:`multirun-project`,required:!0,children:a(`multirun.launcher.project.label`)}),R.length>0?(0,$.jsxs)(pe,{value:z??void 0,onValueChange:V,children:[(0,$.jsx)(fe,{id:`multirun-project`,size:`lg`,className:`w-fit max-w-full`,children:B?(0,$.jsx)(ue,{children:st(B)}):(0,$.jsx)(ue,{placeholder:a(`multirun.launcher.project.placeholder`)})}),(0,$.jsx)(de,{fitContent:!0,children:R.map(e=>(0,$.jsx)(U,{value:e.id,className:`max-w-[24rem]`,children:st(e)},e.id))})]}):(0,$.jsx)(`p`,{className:`typography-micro text-muted-foreground py-2`,children:a(`multirun.launcher.project.empty`)})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(ot,{htmlFor:`group-name`,required:!0,info:(0,$.jsx)(at,{children:a(`multirun.launcher.groupName.info`)}),children:a(`multirun.launcher.groupName.label`)}),(0,$.jsx)(ne,{id:`group-name`,value:o,onChange:e=>s(e.target.value),placeholder:a(`multirun.launcher.groupName.placeholder`),className:`typography-meta w-full`,required:!0})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(ot,{htmlFor:`multirun-worktree-base-branch`,info:(0,$.jsx)(at,{children:a(`multirun.launcher.baseBranch.info`)}),children:a(`multirun.launcher.baseBranch.label`)}),(0,$.jsx)(Xe,{directory:le,value:xe,onChange:Se,disabled:!Q,id:`multirun-worktree-base-branch`}),(0,$.jsxs)(`label`,{className:`mt-1.5 flex w-fit items-center gap-1.5 typography-micro text-muted-foreground`,children:[(0,$.jsx)(j,{checked:oe,onChange:se,disabled:!Te,ariaLabel:a(`multirun.launcher.isolateRuns.label`)}),(0,$.jsx)(`span`,{children:a(`multirun.launcher.isolateRuns.label`)})]})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(ot,{htmlFor:`multirun-agent`,info:(0,$.jsx)(at,{children:a(`multirun.launcher.agent.info`)}),children:a(`multirun.launcher.agent.label`)}),(0,$.jsx)(Ze,{value:d,onChange:f,id:`multirun-agent`})]})]}),(0,$.jsxs)(be,{open:w,onOpenChange:T,children:[(0,$.jsxs)(ye,{className:`w-full flex items-center gap-2 py-1.5 px-2 -mx-2 rounded-lg hover:bg-[var(--interactive-hover)]/50 transition-colors group`,children:[(0,$.jsx)(A,{name:`terminal`,className:`h-3.5 w-3.5 text-muted-foreground/70`}),(0,$.jsx)(`span`,{className:`typography-meta font-medium text-muted-foreground group-hover:text-foreground transition-colors`,children:a(`multirun.launcher.setupCommands.label`)}),ze>0&&(0,$.jsx)(`span`,{className:`inline-flex items-center justify-center h-4 min-w-4 px-1 rounded-full typography-micro font-medium`,style:{backgroundColor:`var(--primary-base)`,color:`var(--primary-foreground)`,fontSize:`0.625rem`,lineHeight:1},children:ze}),(0,$.jsx)(A,{name:`arrow-down-s`,className:g(`h-3.5 w-3.5 text-muted-foreground/50 transition-transform duration-200 ml-auto`,w&&`rotate-180`)})]}),(0,$.jsx)(ve,{children:(0,$.jsx)(`div`,{className:`pt-2 space-y-1.5`,children:ee?(0,$.jsx)(`p`,{className:`typography-meta text-muted-foreground/70 px-2`,children:a(`multirun.launcher.setupCommands.loading`)}):(0,$.jsxs)($.Fragment,{children:[S.map((e,t)=>(0,$.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,$.jsx)(ne,{value:e,onChange:e=>{let n=[...S];n[t]=e.target.value,C(n)},placeholder:a(`multirun.launcher.setupCommands.commandPlaceholder`),className:`h-8 flex-1 font-mono text-xs`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>C(S.filter((e,n)=>n!==t)),className:`flex-shrink-0 flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:text-destructive hover:bg-destructive/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50`,"aria-label":a(`multirun.launcher.setupCommands.removeCommandAria`),children:(0,$.jsx)(A,{name:`close`,className:`h-3.5 w-3.5`})})]},`${e}-${t}`)),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>C([...S,``]),className:`flex items-center gap-1 typography-meta text-muted-foreground hover:text-foreground transition-colors px-1`,children:[(0,$.jsx)(A,{name:`add`,className:`h-3 w-3`}),a(`multirun.launcher.setupCommands.addCommand`)]})]})})})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(ot,{htmlFor:`prompt`,required:!0,children:a(`multirun.launcher.attachments.label`)}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,$.jsx)(`input`,{ref:N,type:`file`,multiple:!0,className:`hidden`,onChange:Ne,accept:`*/*`}),(0,$.jsxs)(ie,{children:[(0,$.jsx)(re,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>N.current?.click(),className:`inline-flex items-center gap-1 h-6 px-2 rounded-md typography-micro text-muted-foreground hover:text-foreground hover:bg-[var(--interactive-hover)]/50 transition-colors`,children:[(0,$.jsx)(A,{name:`attachment-2`,className:`h-3 w-3`}),a(`multirun.launcher.attachments.attach`)]})}),(0,$.jsx)(M,{children:a(`multirun.launcher.attachments.tooltip`)})]}),h.map(e=>(0,$.jsxs)(`div`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded-md typography-micro border`,style:{backgroundColor:`var(--surface-elevated)`,borderColor:`var(--interactive-border)`},children:[e.mimeType.startsWith(`image/`)?(0,$.jsx)(A,{name:`file-image`,className:`h-3 w-3 text-muted-foreground`}):(0,$.jsx)(A,{name:`file`,className:`h-3 w-3 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`truncate max-w-[100px]`,title:e.filename,children:e.filename}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>Fe(e.id),className:`text-muted-foreground hover:text-destructive`,children:(0,$.jsx)(A,{name:`close`,className:`h-3 w-3`})})]},e.id))]})]}),c.map((e,t)=>(0,$.jsx)(lt,{group:e,groupIndex:t,canRemove:c.length>1,onUpdate:ke,onRemove:Ae},e.id)),(0,$.jsxs)(`button`,{type:`button`,onClick:je,className:`flex items-center gap-1.5 py-2 px-3 -mx-3 rounded-lg typography-meta font-medium text-muted-foreground hover:text-foreground hover:bg-[var(--interactive-hover)]/50 transition-colors`,children:[(0,$.jsx)(A,{name:`add`,className:`h-3.5 w-3.5`}),a(`multirun.launcher.groups.addGroup`)]}),De&&(0,$.jsx)(`div`,{className:`px-3 py-2 rounded-lg typography-meta`,style:{backgroundColor:`var(--status-error-background)`,color:`var(--status-error)`,borderWidth:1,borderColor:`var(--status-error-border)`},children:De})]})})}),(0,$.jsx)(`div`,{className:`shrink-0 px-4 sm:px-6 py-3`,children:(0,$.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl flex items-center justify-end gap-2`,children:[!Q&&Z!==null?(0,$.jsxs)(`div`,{className:`mr-auto flex min-w-0 items-center gap-1.5 typography-micro text-muted-foreground`,children:[(0,$.jsx)(A,{name:`information`,className:`h-3.5 w-3.5 shrink-0`}),(0,$.jsx)(`span`,{className:`truncate`,children:a(`multirun.launcher.project.gitRequired`)})]}):null,(0,$.jsx)(_,{type:`button`,variant:`ghost`,size:`sm`,onClick:r,children:a(`multirun.launcher.actions.cancel`)}),(0,$.jsx)(_,{type:`submit`,size:`sm`,disabled:!Re||b,children:b?a(`multirun.launcher.actions.creating`):(0,$.jsx)($.Fragment,{children:a(`multirun.launcher.actions.startWithRunCount`,{count:Ie})})})]})})]})},lt=e=>{let t=(0,xe.c)(94),{group:n,groupIndex:r,canRemove:i,onUpdate:a,onRemove:o}=e,{t:s}=m(),[c,l]=X.useState(!1),[u,d]=X.useState(``),[f,h]=X.useState(!1),[g,_]=X.useState(``),v=X.useRef(null),y=X.useRef(null),b=X.useRef(null),x;t[0]!==n.id||t[1]!==n.models||t[2]!==a?(x=e=>{n.models.length>=it||a(n.id,{models:[...n.models,e]})},t[0]=n.id,t[1]=n.models,t[2]=a,t[3]=x):x=t[3];let S=p(x),C;t[4]!==n.id||t[5]!==n.models||t[6]!==a?(C=e=>{a(n.id,{models:n.models.filter((t,n)=>n!==e)})},t[4]=n.id,t[5]=n.models,t[6]=a,t[7]=C):C=t[7];let w=p(C),T;t[8]!==n.id||t[9]!==n.models||t[10]!==a?(T=(e,t)=>{a(n.id,{models:n.models.map((n,r)=>r===e?t:n)})},t[8]=n.id,t[9]=n.models,t[10]=a,t[11]=T):T=t[11];let ee=p(T),E;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(E=(e,t)=>{if(e.startsWith(`/`)){let n=e.indexOf(` `),r=e.indexOf(`
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{S as t}from"./desktop-BAmoc_34.js";import{a as n,r}from"./vendor-zustand-vDaAPGfl.js";import{ot as i,st as a}from"./vendor-base-ui-CzHs0bHY.js";import{At as o,In as s,Vn as c,bt as l}from"./gitApiHttp-MWsHNHuo.js";import"./brand-storage-bootstrap-D4BW3w-M.js";import{r as u}from"./useUIStore-BerIUSLP.js";import{n as d}from"./vendor-react-DlzBev0S.js";import{u as f}from"./fileQueries-C2Rs6TPz.js";import{i as p}from"./vendor-reactuses-core-DWo5Wn6R.js";import{f as m,i as h,r as g,t as _,y as v}from"./button-C-gRcs_2.js";import{$r as y,Bi as b,Cr as x,Hi as S,Nr as C,br as w,f as T,ki as ee,p as E,ri as D,va as O,yr as k}from"./useMobileNavigationStore-DHX2bCjA.js";import{n as A}from"./Icon-OJf0qBKf.js";import{n as te}from"./gitApi-DxUmZcUw.js";import{t as j}from"./checkbox-BrJBzET8.js";import{t as ne}from"./input-CmLlZdeD.js";import{i as re,n as M,t as ie}from"./tooltip-Degmpxnd.js";import{a as ae}from"./device-w1ioiqv3.js";import{a as oe,b as se,c as N,f as P,h as F,l as I,o as L,p as R,r as z,w as ce,x as B,y as le}from"./insertionBoundaries-DUy8i_LT.js";import{a as V,c as ue,d as H,i as U,n as de,o as W,r as G,s as fe,t as pe}from"./select-J8r9SxHt.js";import{r as K,t as me}from"./textarea-BHgcxJdC.js";import{a as q,f as J,h as he,i as Y,m as ge,n as _e}from"./projectMeta-DD7W5l0p.js";import{n as ve,r as ye,t as be}from"./collapsible-B7esGYLd.js";var X=e(a(),1),xe=d(),Se=/^[a-z0-9](?:[a-z0-9-]{0,48}[a-z0-9])?$/,Ce=/^g[1-9]\d*$/,Z=(e,t,n,r,i)=>{if(!Se.test(e)||t!==void 0&&!Ce.test(t)||!n?.trim()||!r?.trim()||n!==n.trim()||r!==r.trim())return null;if(i===void 0)return{groupSlug:e,runGroup:t,providerID:n,modelID:r,fusion:!1};if(i===`fusion`)return{groupSlug:e,runGroup:t,providerID:n,modelID:r,fusion:!0};if(!/^\d+$/.test(i))return null;let a=Number.parseInt(i,10);return!Number.isSafeInteger(a)||a<=0?null:{groupSlug:e,runGroup:t,providerID:n,modelID:r,index:a,fusion:!1}},we=e=>{if(!e)return null;let t=e.split(`/`);if(t.length<3||t.length>5)return null;let[n]=t;if(t.length===3)return Z(n,void 0,t[1],t[2],void 0);if(t.length===4){let[,e,r,i]=t;return Ce.test(e)?Z(n,e,r,i,void 0):Z(n,void 0,e,r,i)}let[,r,i,a,o]=t;return r===``?Z(n,void 0,i,a,o):Z(n,r,i,a,o)},Te=e=>{let t=[e.groupSlug];return e.runGroup&&t.push(e.runGroup),t.push(e.providerID,e.modelID),e.index!==void 0&&t.push(String(e.index)),t.join(`/`)},Q=(e,t,n,r)=>{let i=[e];return r&&i.push(r),i.push(t,n,`fusion`),i.join(`/`)},Ee=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).substring(0,50),De=(e,t)=>`${Ee(e)}-${Ee(t)}`.substring(0,60),Oe=(e,t)=>`${e}/${t}`,ke=e=>{let t=e.replace(/\\/g,`/`);return t===`/`?`/`:t.length>1?t.replace(/\/+$/,``):t},Ae=(e,t)=>{let n=ke(t),r=e.directory,i=typeof r==`string`&&r.trim().length>0?e:{...e,directory:n};c(e.id,n),E.getState().markSessionAsYuriCreated(e.id),y.getState().upsertSession(i);try{s().ensureChild(n,{bootstrap:!1}).setState(t=>{let n=t.session.findIndex(t=>t.id===e.id);if(n>=0&&t.session[n]===i)return t;let r=n>=0?t.session.map((e,t)=>t===n?i:e):[...t.session,i].sort((e,t)=>e.id.localeCompare(t.id));return{session:r,sessionTotal:Math.max(t.sessionTotal,r.length),limit:Math.max(t.limit,r.length)}})}catch{}return i},je=()=>{let e=O.getState(),t=e.activeProjectId;if(!t)return null;let n=e.projects.find(e=>e.id===t);if(n?.path)return{id:n.id,path:n.path};let r=l.getState().currentDirectory??null;if(r&&r.trim().length>0){let e=r.replace(/\\/g,`/`).replace(/\/+$/,``)||r;return{id:`path:${e}`,path:e}}return null},Me=n()(r(e=>({isLoading:!1,error:null,createMultiRun:async t=>{let n=t.name.trim(),{groups:r,agent:i,files:a,setupCommands:s}=t;if(!n)return e({error:`Group name is required`}),null;if(!r||r.length===0)return e({error:`At least one run group is required`}),null;for(let t=0;t<r.length;t++){if(!r[t].prompt.trim())return e({error:`Group ${t+1}: prompt is required`}),null;if(r[t].models.length<1)return e({error:`Group ${t+1}: select at least 1 model`}),null;if(r[t].models.length>5)return e({error:`Group ${t+1}: maximum 5 models allowed`}),null}e({isLoading:!0,error:null});try{let c=je();if(!c)return e({error:`Select a project`,isLoading:!1}),null;let l=c.path,u=await te(l)&&t.isolateRuns!==!1,d=Ee(n),f=u?await J(l):void 0,p=u?await I(l):null,m=[],h=s?.filter(e=>e.trim().length>0)??[];for(let e=0;e<r.length;e++){let n=r[e],i=n.prompt,a=new Map;for(let e of n.models){let t=`${e.providerID}:${e.modelID}`;a.set(t,(a.get(t)||0)+1)}let s=new Map;for(let g of n.models){let n=`${g.providerID}:${g.modelID}`,_=a.get(n)||1,v=(s.get(n)||0)+1;s.set(n,v);let y=De(g.providerID,g.modelID),b=r.length>1?`g${e+1}`:void 0,x=_>1?Oe(d,`${y}/${v}`):Oe(d,y),S=b?`${b}/${x}`:x,T=Te({groupSlug:d,runGroup:b,providerID:g.providerID,modelID:g.modelID,index:_>1?v:void 0});try{if(!u){let e=await o.withDirectory(l,()=>o.createSession({title:T}));Ae(e,l),m.push({sessionId:e.id,worktreePath:l,providerID:g.providerID,modelID:g.modelID,variant:g.variant,prompt:i});continue}let e=await N(c,{preferredName:S,mode:`new`,branchName:S,worktreeName:S,startRef:t.worktreeBaseBranch||`HEAD`,setupCommands:h,returnAfterDirectoryCreated:!0},{resolvedRootTrackingRemote:p}),n={...e,createdFromBranch:f,kind:`standard`};await w(c)&&await C(e.path);let r=await o.withDirectory(e.path,()=>o.createSession({title:T}));Ae(r,e.path),E.getState().setWorktreeMetadata(r.id,n),m.push({sessionId:r.id,worktreePath:e.path,providerID:g.providerID,modelID:g.modelID,variant:g.variant,prompt:i})}catch(e){console.warn(`[MultiRun] Failed to create session:`,e)}}}let g=s?.filter(e=>e.trim().length>0)??[];g.length>0&&x(c,g).catch(()=>{console.warn(`[MultiRun] Failed to save worktree setup commands`)});let _=m.map(e=>e.sessionId),v=m[0]?.sessionId??null;if(_.length===0)return e({error:`Failed to create any sessions`,isLoading:!1}),null;let y=a?.map(e=>({type:`file`,mime:e.mime,filename:e.filename,url:e.url}));return(async()=>{try{await Promise.allSettled(m.map(async e=>{try{await T({sessionId:e.sessionId,directory:e.worktreePath,content:e.prompt,providerID:e.providerID,modelID:e.modelID,variant:e.variant,agent:i,files:y})}catch(e){console.warn(`[MultiRun] Failed to start run:`,e)}}))}catch(e){console.warn(`[MultiRun] Failed to start runs:`,e)}})(),e({isLoading:!1}),{groupSlug:d,sessionIds:_,firstSessionId:v}}catch(t){return e({error:t instanceof Error?t.message:`Failed to create Multi-Run`,isLoading:!1}),null}},clearError:()=>{e({error:null})}}),{name:`multirun-store`})),$=i(),Ne=`h-7`,Pe=()=>`${Date.now()}-${Math.random().toString(36).substring(2,9)}`,Fe=e=>{let t=(0,xe.c)(13),{model:n,instanceIndex:r,totalSameModel:i,onRemove:a}=e,o=n.displayName||`${n.providerID}/${n.modelID}`,s=i>1?`${o} (${r})`:o,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=g(`flex items-center gap-1.5 px-2 rounded-md bg-interactive-selection/20 border border-border/30`,Ne),t[0]=c):c=t[0];let l;t[1]!==n.modelID||t[2]!==n.providerID?(l=(0,$.jsx)(H,{modelId:n.modelID,providerId:n.providerID,className:`h-3.5 w-3.5`}),t[1]=n.modelID,t[2]=n.providerID,t[3]=l):l=t[3];let u;t[4]===s?u=t[5]:(u=(0,$.jsx)(`span`,{className:`typography-meta font-medium truncate max-w-[140px]`,children:s}),t[4]=s,t[5]=u);let d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(A,{name:`close`,className:`h-3.5 w-3.5`}),t[6]=d):d=t[6];let f;t[7]===a?f=t[8]:(f=(0,$.jsx)(`button`,{type:`button`,onClick:a,className:`text-muted-foreground hover:text-foreground ml-0.5`,children:d}),t[7]=a,t[8]=f);let p;return t[9]!==l||t[10]!==u||t[11]!==f?(p=(0,$.jsxs)(`div`,{className:c,children:[l,u,f]}),t[9]=l,t[10]=u,t[11]=f,t[12]=p):p=t[12],p},Ie=e=>{let t=(0,xe.c)(131),{selectedModels:n,onAdd:r,onRemove:i,onUpdate:a,minModels:o,addButtonLabel:s,showChips:c,maxModels:l,addButtonClassName:d,dropdownSide:f,dropdownClassName:p,containerClassName:h,triggerIcon:v}=e,y=c===void 0||c,b=f===void 0?`top`:f,{t:x}=m(),C=ee(Le),w=ee(Re),T=u(ze),E=u(Be),{favoriteModelsList:D,recentModelsList:O}=ge(),k=u(Ve),te=u(He),[j,ne]=X.useState(!1),[re,M]=X.useState(``),[ie,ae]=X.useState(null),oe=X.useRef(null),se=X.useRef(null),N=l===1,P=l===void 0||n.length<l||N,F;if(t[0]!==n){F=new Map;for(let e of n){let t=`${e.providerID}:${e.modelID}`;F.set(t,(F.get(t)||0)+1)}t[0]=n,t[1]=F}else F=t[1];let I=F,L;t[2]===n?L=t[3]:(L=e=>n.filter(t=>t.providerID===e.providerID&&t.modelID===e.modelID).findIndex(t=>t.instanceId===e.instanceId)+1,t[2]=n,t[3]=L);let R=L,z,ce;t[4]!==b||t[5]!==j?(z=()=>{if(!j||!se.current)return;let e=se.current.getBoundingClientRect();if(b===`bottom`){let t=(window.visualViewport?.height??document.documentElement.clientHeight??window.innerHeight)-e.bottom-16-112;ae(Math.max(160,Math.min(320,t)));return}let t=se.current.parentElement;for(;t&&!(t.getAttribute(`role`)===`dialog`||t.hasAttribute(`data-scroll-shadow`));){let e=getComputedStyle(t);if(e.overflow===`auto`||e.overflow===`hidden`||e.overflowY===`auto`||e.overflowY===`hidden`)break;t=t.parentElement}let n=t?t.getBoundingClientRect().top:0,r=e.top-n-16;ae(Math.max(150,Math.min(300,r)))},ce=[b,j],t[4]=b,t[5]=j,t[6]=z,t[7]=ce):(z=t[6],ce=t[7]),X.useEffect(z,ce);let B,le;t[8]!==P||t[9]!==j?(B=()=>{!P&&j&&(ne(!1),M(``))},le=[P,j],t[8]=P,t[9]=j,t[10]=B,t[11]=le):(B=t[10],le=t[11]),X.useEffect(B,le);let V,H;t[12]===j?(V=t[13],H=t[14]):(V=()=>{if(!j)return;let e=e=>{oe.current&&!oe.current.contains(e.target)&&(ne(!1),M(``))};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},H=[j],t[12]=j,t[13]=V,t[14]=H),X.useEffect(V,H);let W;t[15]!==N||t[16]!==r||t[17]!==a||t[18]!==n.length?(W=e=>{let t={providerID:e.providerID,modelID:e.modelID,displayName:S(e.model,e.modelID)||e.modelID,instanceId:Pe()};N&&n.length>0&&a?a(0,t):r(t),N&&(ne(!1),M(``))},t[15]=N,t[16]=r,t[17]=a,t[18]=n.length,t[19]=W):W=t[19];let G=W,K;t[20]===x?K=t[21]:(K=x(`multirun.modelMultiSelect.search.placeholder`),t[20]=x,t[21]=K);let me;t[22]===x?me=t[23]:(me=x(`multirun.modelMultiSelect.search.noResults`),t[22]=x,t[23]=me);let q;t[24]===x?q=t[25]:(q=x(`multirun.modelMultiSelect.sections.favorites`),t[24]=x,t[25]=q);let J;t[26]===x?J=t[27]:(J=x(`multirun.modelMultiSelect.sections.recent`),t[26]=x,t[27]=J);let Y;t[28]===x?Y=t[29]:(Y=x(`multirun.modelMultiSelect.keyboard.hint`),t[28]=x,t[29]=Y);let _e;t[30]===x?_e=t[31]:(_e=x(`settings.agents.modelSelector.actions.favorite`),t[30]=x,t[31]=_e);let ve;t[32]===x?ve=t[33]:(ve=x(`settings.agents.modelSelector.actions.unfavorite`),t[32]=x,t[33]=ve);let ye;t[34]===x?ye=t[35]:(ye=x(`chat.modelControls.provider`),t[34]=x,t[35]=ye);let be;t[36]===x?be=t[37]:(be=x(`chat.modelControls.capabilities`),t[36]=x,t[37]=be);let Se;t[38]===x?Se=t[39]:(Se=x(`chat.modelControls.capability.toolCalling`),t[38]=x,t[39]=Se);let Ce;t[40]===x?Ce=t[41]:(Ce=x(`chat.modelControls.capability.reasoning`),t[40]=x,t[41]=Ce);let Z;t[42]===x?Z=t[43]:(Z=x(`chat.modelControls.modality.image`),t[42]=x,t[43]=Z);let we;t[44]===x?we=t[45]:(we=x(`chat.modelControls.modality.video`),t[44]=x,t[45]=we);let Te;t[46]===x?Te=t[47]:(Te=x(`chat.modelControls.modality.audio`),t[46]=x,t[47]=Te);let Q;t[48]===x?Q=t[49]:(Q=x(`chat.modelControls.costPerMillion`),t[48]=x,t[49]=Q);let Ee;t[50]===x?Ee=t[51]:(Ee=x(`chat.modelControls.costInput`),t[50]=x,t[51]=Ee);let De;t[52]===x?De=t[53]:(De=x(`chat.modelControls.costOutput`),t[52]=x,t[53]=De);let Oe;t[54]!==K||t[55]!==me||t[56]!==q||t[57]!==J||t[58]!==Y||t[59]!==_e||t[60]!==ve||t[61]!==ye||t[62]!==be||t[63]!==Se||t[64]!==Ce||t[65]!==Z||t[66]!==we||t[67]!==Te||t[68]!==Q||t[69]!==Ee||t[70]!==De?(Oe={searchPlaceholder:K,noResults:me,favorites:q,recent:J,keyboardHint:Y,favorite:_e,unfavorite:ve,provider:ye,capabilities:be,capabilityToolCalling:Se,capabilityReasoning:Ce,modalityImage:Z,modalityVideo:we,modalityAudio:Te,costPerMillion:Q,costInput:Ee,costOutput:De},t[54]=K,t[55]=me,t[56]=q,t[57]=J,t[58]=Y,t[59]=_e,t[60]=ve,t[61]=ye,t[62]=be,t[63]=Se,t[64]=Ce,t[65]=Z,t[66]=we,t[67]=Te,t[68]=Q,t[69]=Ee,t[70]=De,t[71]=Oe):Oe=t[71];let ke=Oe,Ae;t[72]===h?Ae=t[73]:(Ae=g(`relative`,h),t[72]=h,t[73]=Ae);let je;t[74]===d?je=t[75]:(je=g(Ne,`!border-border/80 !bg-[var(--surface-subtle)] hover:!bg-[var(--interactive-hover)]/70`,d),t[74]=d,t[75]=je);let Me=!P,Ie;t[76]===j?Ie=t[77]:(Ie=()=>{ne(!j)},t[76]=j,t[77]=Ie);let We;t[78]===v?We=t[79]:(We=v??(0,$.jsx)(A,{name:`add`,className:`h-3.5 w-3.5 mr-1`}),t[78]=v,t[79]=We);let Ge;t[80]!==s||t[81]!==x?(Ge=s??x(`multirun.modelMultiSelect.actions.addModel`),t[80]=s,t[81]=x,t[82]=Ge):Ge=t[82];let Ke;t[83]!==je||t[84]!==Me||t[85]!==Ie||t[86]!==We||t[87]!==Ge?(Ke=(0,$.jsxs)(_,{ref:se,type:`button`,variant:`outline`,size:`sm`,className:je,disabled:Me,onClick:Ie,children:[We,Ge]}),t[83]=je,t[84]=Me,t[85]=Ie,t[86]=We,t[87]=Ge,t[88]=Ke):Ke=t[88];let qe;t[89]!==ie||t[90]!==P||t[91]!==p||t[92]!==b||t[93]!==D||t[94]!==w||t[95]!==G||t[96]!==k||t[97]!==E||t[98]!==j||t[99]!==ke||t[100]!==I||t[101]!==te||t[102]!==C||t[103]!==O||t[104]!==re||t[105]!==T?(qe=j?(0,$.jsx)(`div`,{className:g(`absolute left-0 z-50 w-[min(420px,calc(100vw-2rem))] max-w-[calc(100vw-2rem)] flex flex-col overflow-hidden rounded-xl border border-border/50 shadow-lg`,b===`top`?`bottom-full mb-1`:`top-full mt-1`,p),style:{background:`linear-gradient(var(--surface-elevated),var(--surface-elevated)),linear-gradient(var(--surface-background),var(--surface-background))`},children:(0,$.jsx)(he,{providers:C,providerOrder:te,favoriteModels:D,recentModels:O,getMetadata:w,hiddenModels:k,searchQuery:re,onSearchQueryChange:M,onSelect:G,labels:ke,selectionCount:e=>I.get(`${e.providerID}:${e.modelID}`)||0,disabled:!P,maxHeightClassName:`flex-1`,maxHeightStyle:{maxHeight:ie?`${ie}px`:`300px`},stickyHeaders:!0,tooltipsEnabled:j,isFavorite:e=>E(e.providerID,e.modelID),onToggleFavorite:e=>T(e.providerID,e.modelID),onEscape:()=>{ne(!1),M(``)}})}):null,t[89]=ie,t[90]=P,t[91]=p,t[92]=b,t[93]=D,t[94]=w,t[95]=G,t[96]=k,t[97]=E,t[98]=j,t[99]=ke,t[100]=I,t[101]=te,t[102]=C,t[103]=O,t[104]=re,t[105]=T,t[106]=qe):qe=t[106];let Je;t[107]!==Ae||t[108]!==Ke||t[109]!==qe?(Je=(0,$.jsxs)(`div`,{className:Ae,ref:oe,children:[Ke,qe]}),t[107]=Ae,t[108]=Ke,t[109]=qe,t[110]=Je):Je=t[110];let Ye;t[111]!==R||t[112]!==I||t[113]!==i||t[114]!==a||t[115]!==C||t[116]!==n||t[117]!==y||t[118]!==x?(Ye=y&&n.length>0&&(0,$.jsx)(`div`,{className:`flex flex-col gap-2 w-full`,children:n.map((e,t)=>{let n=`${e.providerID}:${e.modelID}`,r=I.get(n)||1,o=R(e),s=C.find(t=>t.id===e.providerID)?.models?.find(t=>t.id===e.modelID),c=s?.variants?Object.keys(s.variants):[],l=c.length>0,u=e.variant??`__default__`;return(0,$.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,$.jsx)(Fe,{model:e,instanceIndex:o,totalSameModel:r,onRemove:()=>i(t)}),l&&(0,$.jsxs)(pe,{value:u,onValueChange:n=>{if(!a)return;let r=n===`__default__`?void 0:n;a(t,{...e,variant:r})},children:[(0,$.jsxs)(fe,{size:`chip`,className:`px-2 gap-1.5 rounded-md !border-border/80 !bg-[var(--surface-subtle)] hover:!bg-[var(--interactive-hover)]/70 typography-meta font-medium text-foreground`,children:[(0,$.jsx)(A,{name:`brain-ai-3`,className:g(`h-3.5 w-3.5 flex-shrink-0`,u===`__default__`?`text-muted-foreground`:`text-[color:var(--status-info)]`)}),(0,$.jsx)(ue,{placeholder:x(`multirun.modelMultiSelect.variant.placeholder`),children:e=>e===`__default__`?x(`multirun.modelMultiSelect.variant.default`):e})]}),(0,$.jsxs)(de,{fitContent:!0,children:[(0,$.jsx)(U,{value:`__default__`,className:`pr-2 [&>span:first-child]:hidden`,children:x(`multirun.modelMultiSelect.variant.default`)}),c.map(Ue)]})]})]},e.instanceId)})}),t[111]=R,t[112]=I,t[113]=i,t[114]=a,t[115]=C,t[116]=n,t[117]=y,t[118]=x,t[119]=Ye):Ye=t[119];let Xe;t[120]!==Je||t[121]!==Ye?(Xe=(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 items-center`,children:[Je,Ye]}),t[120]=Je,t[121]=Ye,t[122]=Xe):Xe=t[122];let Ze;t[123]!==l||t[124]!==o||t[125]!==n.length||t[126]!==x?(Ze=o!==void 0&&n.length<o&&(0,$.jsx)(`p`,{className:`typography-micro text-muted-foreground`,children:l===void 0?x(`multirun.modelMultiSelect.validation.minOnly`,{min:o}):x(`multirun.modelMultiSelect.validation.minToMax`,{min:o,max:l})}),t[123]=l,t[124]=o,t[125]=n.length,t[126]=x,t[127]=Ze):Ze=t[127];let Qe;return t[128]!==Xe||t[129]!==Ze?(Qe=(0,$.jsxs)(`div`,{className:`space-y-2`,children:[Xe,Ze]}),t[128]=Xe,t[129]=Ze,t[130]=Qe):Qe=t[130],Qe};function Le(e){return e.providers}function Re(e){return e.getModelMetadata}function ze(e){return e.toggleFavoriteModel}function Be(e){return e.isFavoriteModel}function Ve(e){return e.hiddenModels}function He(e){return e.providerOrder}function Ue(e){return(0,$.jsx)(U,{value:e,className:`pr-2 [&>span:first-child]:hidden`,children:e},e)}function We(e){let t=(0,xe.c)(30),{git:n}=f(),r=P(e),i=se(e),a=F(e),o=R(e),s=le(Ye),c=le(Je),l,u;t[0]!==e||t[1]!==c||t[2]!==n||t[3]!==i||t[4]!==a?(l=()=>{!e||!n||i!==null||a||c(e,n,{silent:!0})},u=[e,n,c,i,a],t[0]=e,t[1]=c,t[2]=n,t[3]=i,t[4]=a,t[5]=l,t[6]=u):(l=t[5],u=t[6]),X.useEffect(l,u);let d;t[7]!==r?.all||t[8]!==e||t[9]!==s||t[10]!==n||t[11]!==i?(d=()=>{!e||!n||i===!0&&(r?.all||s(e,n))},t[7]=r?.all,t[8]=e,t[9]=s,t[10]=n,t[11]=i,t[12]=d):d=t[12];let p=r?.all,m;t[13]!==e||t[14]!==s||t[15]!==n||t[16]!==i||t[17]!==p?(m=[e,n,i,p,s],t[13]=e,t[14]=s,t[15]=n,t[16]=i,t[17]=p,t[18]=m):m=t[18],X.useEffect(d,m);let h=a||i===!0&&o,g;bb0:{if(!r?.all){let e;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[19]=e):e=t[19],g=e;break bb0}let e;t[20]===r.all?e=t[21]:(e=r.all.filter(qe).sort(),t[20]=r.all,t[21]=e),g=e}let _=g,v;bb1:{if(!r?.all){let e;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[22]=e):e=t[22],v=e;break bb1}let e;t[23]===r.all?e=t[24]:(e=r.all.filter(Ke).map(Ge).sort(),t[23]=r.all,t[24]=e),v=e}let y=v,b;bb2:{if(!e){b=null;break bb2}if(i!==null){b=i;break bb2}if(h){b=null;break bb2}b=r?.all?!0:null}let x=b,S;return t[25]!==x||t[26]!==h||t[27]!==_||t[28]!==y?(S={localBranches:_,remoteBranches:y,isLoading:h,isGitRepository:x},t[25]=x,t[26]=h,t[27]=_,t[28]=y,t[29]=S):S=t[29],S}function Ge(e){return e.replace(/^remotes\//,``)}function Ke(e){return e.startsWith(`remotes/`)}function qe(e){return!e.startsWith(`remotes/`)}function Je(e){return e.fetchStatus}function Ye(e){return e.fetchBranches}var Xe=({directory:e,value:t,onChange:n,className:r,disabled:i,id:a})=>{let{t:o}=m(),{localBranches:s,remoteBranches:c,isLoading:l,isGitRepository:u}=We(e),d=X.useMemo(()=>[...s,...c.map(e=>`remotes/${e}`)],[s,c]);return X.useEffect(()=>{if(i||l||d.length===0||t&&d.includes(t))return;let r=t,a=!1;return(async()=>{try{let t=e?await J(e).catch(()=>null):null;if(a)return;let i=localStorage.getItem(oe),{sourceBranch:o,shouldClearSavedSourceBranch:s}=L({branches:d,savedSourceBranch:i,rootBranch:t});if(s&&localStorage.removeItem(oe),a||r&&d.includes(r))return;o&&n(o)}catch{}})(),()=>{a=!0}},[d,e,i,l,n,t]),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(pe,{value:t,onValueChange:n,disabled:i||!u||l,children:[(0,$.jsx)(fe,{id:a,size:`lg`,className:r??`w-fit typography-meta text-foreground`,children:(0,$.jsx)(ue,{placeholder:o(l?`multiRun.branchSelector.status.loadingBranches`:`multiRun.branchSelector.placeholder.selectSourceBranch`)})}),(0,$.jsx)(de,{className:`max-h-[280px] max-w-[320px]`,children:l?(0,$.jsx)(`div`,{className:`px-2 py-4 text-center typography-meta text-muted-foreground`,children:o(`multiRun.branchSelector.status.loadingBranches`)}):s.length===0&&c.length===0?(0,$.jsx)(`div`,{className:`px-2 py-4 text-center typography-meta text-muted-foreground`,children:o(`multiRun.branchSelector.status.noBranchesFound`)}):(0,$.jsxs)($.Fragment,{children:[s.length>0&&(0,$.jsxs)(G,{children:[(0,$.jsx)(V,{className:`font-semibold text-foreground`,children:o(`multiRun.branchSelector.groups.localBranches`)}),s.map(e=>(0,$.jsx)(U,{value:e,className:`whitespace-normal break-all`,children:e},e))]}),s.length>0&&c.length>0&&(0,$.jsx)(W,{}),c.length>0&&(0,$.jsxs)(G,{children:[(0,$.jsx)(V,{className:`font-semibold text-foreground`,children:o(`multiRun.branchSelector.groups.remoteBranches`)}),c.map(e=>(0,$.jsx)(U,{value:`remotes/${e}`,className:`whitespace-normal break-all`,children:e},`remotes/${e}`))]})]})})]}),u===!1&&(0,$.jsx)(`p`,{className:`typography-micro text-muted-foreground/70 mt-2`,children:o(`multiRun.branchSelector.status.notInGitRepository`)})]})},Ze=e=>{let t=(0,xe.c)(36),{value:n,onChange:r,className:i,disabled:a,id:o,portalToBody:s}=e,{t:c}=m(),l=ee(Qe),u=ee($e),d=ee(et),f;t[0]===l?f=t[1]:(f=l(),t[0]=l,t[1]=f);let p=f,h;t[2]===p?h=t[3]:(h=p.filter(tt),t[2]=p,t[3]=h);let _=h,v,y;t[4]!==p.length||t[5]!==u?(v=()=>{p.length===0&&u()},y=[p.length,u],t[4]=p.length,t[5]=u,t[6]=v,t[7]=y):(v=t[6],y=t[7]),X.useEffect(v,y);let b,x;t[8]!==d||t[9]!==a||t[10]!==r||t[11]!==_||t[12]!==n?(b=()=>{if(a)return;let e=n.trim();if(e.length>0&&_.some(t=>t.name===e))return;let t=typeof d==`string`&&d.trim().length>0?d.trim():null;if(t&&_.some(e=>e.name===t)){r(t);return}let i=_[0]?.name;i&&r(i)},x=[d,a,r,_,n],t[8]=d,t[9]=a,t[10]=r,t[11]=_,t[12]=n,t[13]=b,t[14]=x):(b=t[13],x=t[14]),X.useEffect(b,x);let S=n.trim().length>0?n:void 0,C;t[15]===i?C=t[16]:(C=g(`max-w-full typography-meta text-foreground !border-border/80 !bg-[var(--surface-subtle)] hover:!bg-[var(--interactive-hover)]/70 data-[popup-open]:!bg-[var(--interactive-active)]/70`,i),t[15]=i,t[16]=C);let w;t[17]===c?w=t[18]:(w=c(`multirun.agentSelector.placeholder`),t[17]=c,t[18]=w);let T;t[19]===w?T=t[20]:(T=(0,$.jsx)(ue,{placeholder:w}),t[19]=w,t[20]=T);let E;t[21]!==o||t[22]!==C||t[23]!==T?(E=(0,$.jsx)(fe,{id:o,size:`lg`,className:C,children:T}),t[21]=o,t[22]=C,t[23]=T,t[24]=E):E=t[24];let D;t[25]===_?D=t[26]:(D=_.length>0&&(0,$.jsx)(G,{children:_.map(nt)}),t[25]=_,t[26]=D);let O;t[27]!==s||t[28]!==D?(O=(0,$.jsx)(de,{fitContent:!0,portalToBody:s,children:D}),t[27]=s,t[28]=D,t[29]=O):O=t[29];let k;return t[30]!==a||t[31]!==r||t[32]!==S||t[33]!==E||t[34]!==O?(k=(0,$.jsxs)(pe,{value:S,onValueChange:r,disabled:a,children:[E,O]}),t[30]=a,t[31]=r,t[32]=S,t[33]=E,t[34]=O,t[35]=k):k=t[35],k};function Qe(e){return e.getVisibleAgents}function $e(e){return e.loadAgents}function et(e){return e.currentAgentName}function tt(e){return b(e.mode)}function nt(e){return(0,$.jsx)(U,{value:e.name,className:`w-auto whitespace-nowrap`,children:e.name},e.name)}var rt=10485760,it=5,at=e=>{let t=(0,xe.c)(3),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(re,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,tabIndex:-1,className:`inline-flex items-center justify-center text-muted-foreground/50 hover:text-muted-foreground transition-colors`,children:(0,$.jsx)(A,{name:`information`,className:`h-3.5 w-3.5`})})}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,$.jsxs)(ie,{children:[r,(0,$.jsx)(M,{side:`top`,className:`max-w-[240px]`,children:n})]}),t[1]=n,t[2]=i),i},ot=e=>{let t=(0,xe.c)(9),{htmlFor:n,required:r,children:i,info:a}=e,o;t[0]===r?o=t[1]:(o=r&&(0,$.jsx)(`span`,{className:`text-destructive ml-0.5`,children:`*`}),t[0]=r,t[1]=o);let s;t[2]!==i||t[3]!==n||t[4]!==o?(s=(0,$.jsxs)(`label`,{htmlFor:n,className:`typography-meta font-medium text-foreground`,children:[i,o]}),t[2]=i,t[3]=n,t[4]=o,t[5]=s):s=t[5];let c=a&&a,l;return t[6]!==s||t[7]!==c?(l=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8],l},st=e=>{let t=h(e.path),n=e.icon?Y[e.icon]:null,r=e.color?_e[e.color]:void 0,i=(0,$.jsx)(A,{name:n??`folder`,className:`h-3.5 w-3.5`,style:r?{color:r}:void 0});return(0,$.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`flex h-4 w-4 shrink-0 items-center justify-center overflow-hidden text-muted-foreground`,children:e.iconImage?(0,$.jsx)(q,{project:e,className:`size-full object-contain`,fallback:i}):i}),(0,$.jsx)(`span`,{className:`truncate`,children:t})]})},ct=({initialPrompt:e,onCreated:n,onCancel:r,isWindowed:i=!1})=>{let{t:a}=m(),[o,s]=X.useState(``),[c,u]=X.useState(()=>[{id:Pe(),prompt:``,models:[]}]),[d,f]=X.useState(``),[h,y]=X.useState([]),[b,x]=X.useState(!1),[S,C]=X.useState([]),[w,T]=X.useState(!1),[ee,te]=X.useState(!1),[oe,se]=X.useState(!0),N=X.useRef(null),P=l(e=>e.currentDirectory??null),F=X.useMemo(()=>{if(typeof window>`u`)return null;let e=window.__VSCODE_CONFIG__?.workspaceFolder;return typeof e==`string`&&e.trim().length>0?e.trim():null},[]),I=O(e=>e.activeProjectId),L=O(e=>e.setActiveProjectIdOnly),R=O(e=>e.projects),[z,ce]=X.useState(()=>I??null);X.useEffect(()=>{if(I){ce(I);return}!z&&R.length>0&&ce(R[0].id)},[I,R,z]);let B=X.useMemo(()=>z?R.find(e=>e.id===z)??null:null,[R,z]),le=B?.path??P,V=p(e=>{ce(e),e!==I&&L(e)}),H=X.useMemo(()=>{if(B?.path)return{id:B.id,path:B.path};let e=P??F;return e?{id:`path:${e}`,path:e}:null},[B,P,F]),[W]=X.useState(()=>typeof window<`u`&&t()),G=X.useMemo(()=>typeof navigator>`u`?!1:/Macintosh|Mac OS X/.test(navigator.userAgent||``),[]),me=ae(),q=X.useMemo(()=>{if(typeof window>`u`)return null;let e=window.__YURI_MACOS_MAJOR__;if(typeof e==`number`&&Number.isFinite(e)&&e>0)return e;if(typeof navigator>`u`)return null;let t=(navigator.userAgent||``).match(/Mac OS X (\d+)[._](\d+)/);if(!t)return null;let n=Number.parseInt(t[1],10),r=Number.parseInt(t[2],10);return Number.isNaN(n)?null:n===10?r:n},[]),J=X.useMemo(()=>W&&G||me?`pl-[5.5rem]`:`pl-3`,[W,G,me]),he=X.useMemo(()=>!W||!G||q===null?``:q>=26?`h-12`:q<=15?`h-14`:``,[W,G,q]),Y=p(async e=>{e.target.closest(`button, a, input, select, textarea`)||e.button===0&&W&&await v()}),ge=p(e=>{r&&e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),r())}),_e=!!r;X.useEffect(()=>{if(_e)return window.addEventListener(`keydown`,ge,!0),()=>window.removeEventListener(`keydown`,ge,!0)},[_e]);let[xe,Se]=X.useState(``),{isLoading:Ce,isGitRepository:Z}=We(le),we=X.useRef(!1),Te=Z===!0,Q=Te&&oe;X.useEffect(()=>{if(Z===!1){we.current=!0,se(!1);return}Z===!0&&we.current&&(we.current=!1,se(!0))},[Z]);let Ee=Me(e=>e.createMultiRun),De=Me(e=>e.error),Oe=Me(e=>e.clearError);X.useEffect(()=>{typeof e==`string`&&e.trim().length>0&&u(t=>{let n=[...t];return n.length>0&&!n[0].prompt.trim()&&(n[0]={...n[0],prompt:e}),n})},[e]),X.useEffect(()=>{if(!H)return;let e=!1;return te(!0),(async()=>{try{let t=await k(H);e||C(t)}catch{}finally{e||te(!1)}})(),()=>{e=!0}},[H]);let ke=p((e,t)=>{u(n=>n.map(n=>n.id===e?{...n,...t}:n))}),Ae=p(e=>{u(t=>t.filter(t=>t.id!==e))}),je=p(()=>{u(e=>[...e,{id:Pe(),prompt:``,models:[]}])}),Ne=async e=>{let t=e.target.files;if(!t)return;let n=0;for(let e=0;e<t.length;e++){let r=t[e];if(r.size>rt){D.error(a(`multirun.launcher.toast.fileTooLarge`,{fileName:r.name}));continue}try{let e=await new Promise((e,t)=>{let n=new FileReader;n.onload=()=>e(n.result),n.onerror=t,n.readAsDataURL(r)});y(t=>[...t,{id:Pe(),filename:r.name,mimeType:r.type||`application/octet-stream`,size:r.size,dataUrl:e}]),n++}catch(e){console.error(`File attach failed`,e),D.error(a(`multirun.launcher.toast.attachFailed`,{fileName:r.name}))}}n>0&&D.success(a(n===1?`multirun.launcher.toast.attachedSingle`:`multirun.launcher.toast.attachedPlural`,{count:n})),N.current&&(N.current.value=``)},Fe=e=>{y(t=>t.filter(t=>t.id!==e))},Ie=X.useMemo(()=>c.reduce((e,t)=>e+t.models.length,0),[c]),Le=async e=>{e.preventDefault();let t=c.filter(e=>e.prompt.trim()&&e.models.length>=1);if(t.length!==0&&!(Ie<1)){x(!0),Oe();try{z&&z!==I&&L(z);let e=h.map(e=>({mime:e.mimeType,filename:e.filename,url:e.dataUrl})),r=S.filter(e=>e.trim().length>0),i=t.map(e=>({prompt:e.prompt.trim(),models:e.models.map(e=>({providerID:e.providerID,modelID:e.modelID,displayName:e.displayName,variant:e.variant}))})),a={name:o.trim(),groups:i,agent:d||void 0,worktreeBaseBranch:Q?xe:void 0,isolateRuns:Q,files:e.length>0?e:void 0,setupCommands:r.length>0?r:void 0},s=await Ee(a);s&&(s.firstSessionId&&E.getState().setCurrentSession(s.firstSessionId),n?.())}finally{x(!1)}}},Re=!!(o.trim()&&c.some(e=>e.prompt.trim()&&e.models.length>=1)&&Ie>=1&&le&&!Ce&&(Z===!1||!Q||xe)),ze=S.filter(e=>e.trim()).length;return(0,$.jsxs)(`form`,{onSubmit:Le,className:`flex flex-col h-full bg-background`,children:[i?null:(0,$.jsxs)(`header`,{onMouseDown:Y,className:g(`relative flex h-12 shrink-0 items-center justify-center border-b app-region-drag select-none`,J,he),style:{borderColor:`var(--interactive-border)`},children:[(0,$.jsx)(`h1`,{className:`typography-ui-label font-medium`,children:a(`multirun.launcher.title`)}),r&&(0,$.jsx)(`div`,{className:`absolute right-0 flex items-center pr-3`,children:(0,$.jsxs)(ie,{children:[(0,$.jsx)(re,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:r,"aria-label":a(`multirun.launcher.actions.closeEsc`),className:`inline-flex h-9 w-9 items-center justify-center p-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-interactive-hover/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary app-region-no-drag`,children:(0,$.jsx)(A,{name:`close`,className:`h-5 w-5`})})}),(0,$.jsx)(M,{children:(0,$.jsx)(`p`,{children:a(`multirun.launcher.actions.closeEsc`)})})]})})]}),(0,$.jsx)(K,{className:`flex-1 min-h-0 overflow-auto`,size:64,hideTopShadow:!0,children:(0,$.jsx)(`div`,{className:`mx-auto w-full max-w-2xl px-4 sm:px-6 py-5`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,$.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-x-4 gap-y-3`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(ot,{htmlFor:`multirun-project`,required:!0,children:a(`multirun.launcher.project.label`)}),R.length>0?(0,$.jsxs)(pe,{value:z??void 0,onValueChange:V,children:[(0,$.jsx)(fe,{id:`multirun-project`,size:`lg`,className:`w-fit max-w-full`,children:B?(0,$.jsx)(ue,{children:st(B)}):(0,$.jsx)(ue,{placeholder:a(`multirun.launcher.project.placeholder`)})}),(0,$.jsx)(de,{fitContent:!0,children:R.map(e=>(0,$.jsx)(U,{value:e.id,className:`max-w-[24rem]`,children:st(e)},e.id))})]}):(0,$.jsx)(`p`,{className:`typography-micro text-muted-foreground py-2`,children:a(`multirun.launcher.project.empty`)})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(ot,{htmlFor:`group-name`,required:!0,info:(0,$.jsx)(at,{children:a(`multirun.launcher.groupName.info`)}),children:a(`multirun.launcher.groupName.label`)}),(0,$.jsx)(ne,{id:`group-name`,value:o,onChange:e=>s(e.target.value),placeholder:a(`multirun.launcher.groupName.placeholder`),className:`typography-meta w-full`,required:!0})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(ot,{htmlFor:`multirun-worktree-base-branch`,info:(0,$.jsx)(at,{children:a(`multirun.launcher.baseBranch.info`)}),children:a(`multirun.launcher.baseBranch.label`)}),(0,$.jsx)(Xe,{directory:le,value:xe,onChange:Se,disabled:!Q,id:`multirun-worktree-base-branch`}),(0,$.jsxs)(`label`,{className:`mt-1.5 flex w-fit items-center gap-1.5 typography-micro text-muted-foreground`,children:[(0,$.jsx)(j,{checked:oe,onChange:se,disabled:!Te,ariaLabel:a(`multirun.launcher.isolateRuns.label`)}),(0,$.jsx)(`span`,{children:a(`multirun.launcher.isolateRuns.label`)})]})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(ot,{htmlFor:`multirun-agent`,info:(0,$.jsx)(at,{children:a(`multirun.launcher.agent.info`)}),children:a(`multirun.launcher.agent.label`)}),(0,$.jsx)(Ze,{value:d,onChange:f,id:`multirun-agent`})]})]}),(0,$.jsxs)(be,{open:w,onOpenChange:T,children:[(0,$.jsxs)(ye,{className:`w-full flex items-center gap-2 py-1.5 px-2 -mx-2 rounded-lg hover:bg-[var(--interactive-hover)]/50 transition-colors group`,children:[(0,$.jsx)(A,{name:`terminal`,className:`h-3.5 w-3.5 text-muted-foreground/70`}),(0,$.jsx)(`span`,{className:`typography-meta font-medium text-muted-foreground group-hover:text-foreground transition-colors`,children:a(`multirun.launcher.setupCommands.label`)}),ze>0&&(0,$.jsx)(`span`,{className:`inline-flex items-center justify-center h-4 min-w-4 px-1 rounded-full typography-micro font-medium`,style:{backgroundColor:`var(--primary-base)`,color:`var(--primary-foreground)`,fontSize:`0.625rem`,lineHeight:1},children:ze}),(0,$.jsx)(A,{name:`arrow-down-s`,className:g(`h-3.5 w-3.5 text-muted-foreground/50 transition-transform duration-200 ml-auto`,w&&`rotate-180`)})]}),(0,$.jsx)(ve,{children:(0,$.jsx)(`div`,{className:`pt-2 space-y-1.5`,children:ee?(0,$.jsx)(`p`,{className:`typography-meta text-muted-foreground/70 px-2`,children:a(`multirun.launcher.setupCommands.loading`)}):(0,$.jsxs)($.Fragment,{children:[S.map((e,t)=>(0,$.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,$.jsx)(ne,{value:e,onChange:e=>{let n=[...S];n[t]=e.target.value,C(n)},placeholder:a(`multirun.launcher.setupCommands.commandPlaceholder`),className:`h-8 flex-1 font-mono text-xs`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>C(S.filter((e,n)=>n!==t)),className:`flex-shrink-0 flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:text-destructive hover:bg-destructive/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50`,"aria-label":a(`multirun.launcher.setupCommands.removeCommandAria`),children:(0,$.jsx)(A,{name:`close`,className:`h-3.5 w-3.5`})})]},`${e}-${t}`)),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>C([...S,``]),className:`flex items-center gap-1 typography-meta text-muted-foreground hover:text-foreground transition-colors px-1`,children:[(0,$.jsx)(A,{name:`add`,className:`h-3 w-3`}),a(`multirun.launcher.setupCommands.addCommand`)]})]})})})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(ot,{htmlFor:`prompt`,required:!0,children:a(`multirun.launcher.attachments.label`)}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,$.jsx)(`input`,{ref:N,type:`file`,multiple:!0,className:`hidden`,onChange:Ne,accept:`*/*`}),(0,$.jsxs)(ie,{children:[(0,$.jsx)(re,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>N.current?.click(),className:`inline-flex items-center gap-1 h-6 px-2 rounded-md typography-micro text-muted-foreground hover:text-foreground hover:bg-[var(--interactive-hover)]/50 transition-colors`,children:[(0,$.jsx)(A,{name:`attachment-2`,className:`h-3 w-3`}),a(`multirun.launcher.attachments.attach`)]})}),(0,$.jsx)(M,{children:a(`multirun.launcher.attachments.tooltip`)})]}),h.map(e=>(0,$.jsxs)(`div`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded-md typography-micro border`,style:{backgroundColor:`var(--surface-elevated)`,borderColor:`var(--interactive-border)`},children:[e.mimeType.startsWith(`image/`)?(0,$.jsx)(A,{name:`file-image`,className:`h-3 w-3 text-muted-foreground`}):(0,$.jsx)(A,{name:`file`,className:`h-3 w-3 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`truncate max-w-[100px]`,title:e.filename,children:e.filename}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>Fe(e.id),className:`text-muted-foreground hover:text-destructive`,children:(0,$.jsx)(A,{name:`close`,className:`h-3 w-3`})})]},e.id))]})]}),c.map((e,t)=>(0,$.jsx)(lt,{group:e,groupIndex:t,canRemove:c.length>1,onUpdate:ke,onRemove:Ae},e.id)),(0,$.jsxs)(`button`,{type:`button`,onClick:je,className:`flex items-center gap-1.5 py-2 px-3 -mx-3 rounded-lg typography-meta font-medium text-muted-foreground hover:text-foreground hover:bg-[var(--interactive-hover)]/50 transition-colors`,children:[(0,$.jsx)(A,{name:`add`,className:`h-3.5 w-3.5`}),a(`multirun.launcher.groups.addGroup`)]}),De&&(0,$.jsx)(`div`,{className:`px-3 py-2 rounded-lg typography-meta`,style:{backgroundColor:`var(--status-error-background)`,color:`var(--status-error)`,borderWidth:1,borderColor:`var(--status-error-border)`},children:De})]})})}),(0,$.jsx)(`div`,{className:`shrink-0 px-4 sm:px-6 py-3`,children:(0,$.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl flex items-center justify-end gap-2`,children:[!Q&&Z!==null?(0,$.jsxs)(`div`,{className:`mr-auto flex min-w-0 items-center gap-1.5 typography-micro text-muted-foreground`,children:[(0,$.jsx)(A,{name:`information`,className:`h-3.5 w-3.5 shrink-0`}),(0,$.jsx)(`span`,{className:`truncate`,children:a(`multirun.launcher.project.gitRequired`)})]}):null,(0,$.jsx)(_,{type:`button`,variant:`ghost`,size:`sm`,onClick:r,children:a(`multirun.launcher.actions.cancel`)}),(0,$.jsx)(_,{type:`submit`,size:`sm`,disabled:!Re||b,children:b?a(`multirun.launcher.actions.creating`):(0,$.jsx)($.Fragment,{children:a(`multirun.launcher.actions.startWithRunCount`,{count:Ie})})})]})})]})},lt=e=>{let t=(0,xe.c)(94),{group:n,groupIndex:r,canRemove:i,onUpdate:a,onRemove:o}=e,{t:s}=m(),[c,l]=X.useState(!1),[u,d]=X.useState(``),[f,h]=X.useState(!1),[g,_]=X.useState(``),v=X.useRef(null),y=X.useRef(null),b=X.useRef(null),x;t[0]!==n.id||t[1]!==n.models||t[2]!==a?(x=e=>{n.models.length>=it||a(n.id,{models:[...n.models,e]})},t[0]=n.id,t[1]=n.models,t[2]=a,t[3]=x):x=t[3];let S=p(x),C;t[4]!==n.id||t[5]!==n.models||t[6]!==a?(C=e=>{a(n.id,{models:n.models.filter((t,n)=>n!==e)})},t[4]=n.id,t[5]=n.models,t[6]=a,t[7]=C):C=t[7];let w=p(C),T;t[8]!==n.id||t[9]!==n.models||t[10]!==a?(T=(e,t)=>{a(n.id,{models:n.models.map((n,r)=>r===e?t:n)})},t[8]=n.id,t[9]=n.models,t[10]=a,t[11]=T):T=t[11];let ee=p(T),E;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(E=(e,t)=>{if(e.startsWith(`/`)){let n=e.indexOf(` `),r=e.indexOf(`
|
|
2
2
|
`),i=Math.min(n===-1?e.length:n,r===-1?e.length:r);if(t<=i&&n===-1){_(e.substring(1,i)),h(!0),l(!1);return}}h(!1);let n=e.substring(0,t),r=n.lastIndexOf(`@`);if(r!==-1){let e=r>0?n[r-1]:null,t=n.substring(r+1);(!e||/\s/.test(e))&&!t.includes(` `)&&!t.includes(`
|
|
3
3
|
`)?(d(t),l(!0)):l(!1);return}l(!1)},t[12]=E):E=t[12];let D=p(E),O;t[13]!==n.id||t[14]!==a?(O=e=>{a(n.id,{prompt:e})},t[13]=n.id,t[14]=a,t[15]=O):O=t[15];let k=p(O),te;t[16]!==n.prompt||t[17]!==k||t[18]!==D?(te=e=>{let t=n.prompt,r=v.current?.selectionStart??t.length,i=t.substring(0,r).lastIndexOf(`@`),a=e.relativePath&&e.relativePath.trim().length>0?e.relativePath.trim():e.path||e.name,o=z(t,i===-1?r:i,r,`@${a}`);k(o.text),l(!1),d(``),requestAnimationFrame(()=>{let e=v.current;e&&(e.selectionStart=o.caret,e.selectionEnd=o.caret,e.focus()),D(o.text,o.caret)})},t[16]=n.prompt,t[17]=k,t[18]=D,t[19]=te):te=t[19];let j=p(te),ne;t[20]!==n.prompt||t[21]!==k||t[22]!==D?(ne=e=>{let t=n.prompt,r=v.current?.selectionStart??t.length,i=t.substring(0,r).lastIndexOf(`@`),a=z(t,i===-1?r:i,r,`@${e}`);k(a.text),l(!1),d(``),requestAnimationFrame(()=>{let e=v.current;e&&(e.selectionStart=a.caret,e.selectionEnd=a.caret,e.focus()),D(a.text,a.caret)})},t[20]=n.prompt,t[21]=k,t[22]=D,t[23]=ne):ne=t[23];let re=p(ne),M;t[24]!==k||t[25]!==D?(M=e=>{let t=`/${e.name} `;k(t),h(!1),_(``),requestAnimationFrame(()=>{let e=v.current;e&&(e.focus(),e.selectionStart=e.value.length,e.selectionEnd=e.value.length),D(t,t.length)})},t[24]=k,t[25]=D,t[26]=M):M=t[26];let ie=p(M),ae;t[27]!==f||t[28]!==c?(ae=e=>{if(f&&b.current&&(e.key===`Enter`||e.key===`ArrowUp`||e.key===`ArrowDown`||e.key===`Escape`||e.key===`Tab`)){e.preventDefault(),b.current.handleKeyDown(e.key);return}c&&y.current&&(e.key===`Enter`||e.key===`ArrowUp`||e.key===`ArrowDown`||e.key===`Escape`||e.key===`Tab`)&&(e.preventDefault(),y.current.handleKeyDown(e.key))},t[27]=f,t[28]=c,t[29]=ae):ae=t[29];let oe=p(ae),se=r+1,N;t[30]!==s||t[31]!==se?(N=s(`multirun.launcher.groups.groupLabel`,{index:se}),t[30]=s,t[31]=se,t[32]=N):N=t[32];let P;t[33]===N?P=t[34]:(P=(0,$.jsx)(`span`,{className:`typography-meta font-medium text-foreground`,children:N}),t[33]=N,t[34]=P);let F;t[35]!==i||t[36]!==n.id||t[37]!==o||t[38]!==s?(F=i&&(0,$.jsx)(`button`,{type:`button`,onClick:()=>o(n.id),className:`inline-flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground hover:text-destructive hover:bg-destructive/10`,"aria-label":s(`multirun.launcher.groups.removeGroup`),children:(0,$.jsx)(A,{name:`close`,className:`h-3.5 w-3.5`})}),t[35]=i,t[36]=n.id,t[37]=o,t[38]=s,t[39]=F):F=t[39];let I;t[40]!==P||t[41]!==F?(I=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[P,F]}),t[40]=P,t[41]=F,t[42]=I):I=t[42];let L;t[43]===s?L=t[44]:(L=s(`multirun.launcher.groups.prompt.label`),t[43]=s,t[44]=L);let R;t[45]===L?R=t[46]:(R=(0,$.jsx)(ot,{required:!0,children:L}),t[45]=L,t[46]=R);let le=n.prompt,V;t[47]!==k||t[48]!==D?(V=e=>{let t=e.target.value;k(t);let n=e.target.selectionStart??t.length;D(t,n)},t[47]=k,t[48]=D,t[49]=V):V=t[49];let ue;t[50]===s?ue=t[51]:(ue=s(`multirun.launcher.groups.prompt.placeholder`),t[50]=s,t[51]=ue);let H;t[52]!==n.prompt||t[53]!==oe||t[54]!==V||t[55]!==ue?(H=(0,$.jsx)(me,{ref:v,value:le,onChange:V,onKeyDown:oe,placeholder:ue,className:`typography-meta min-h-[80px] max-h-[200px] resize-none overflow-y-auto field-sizing-content`,required:!0}),t[52]=n.prompt,t[53]=oe,t[54]=V,t[55]=ue,t[56]=H):H=t[56];let U;t[57]!==g||t[58]!==ie||t[59]!==f?(U=f?(0,$.jsx)(B,{ref:b,searchQuery:g,onCommandSelect:ie,onClose:()=>h(!1),style:{left:0,top:`auto`,bottom:`calc(100% + 6px)`,marginBottom:0,maxWidth:`100%`}}):null,t[57]=g,t[58]=ie,t[59]=f,t[60]=U):U=t[60];let de;t[61]!==re||t[62]!==j||t[63]!==u||t[64]!==c?(de=c?(0,$.jsx)(ce,{ref:y,searchQuery:u,onFileSelect:j,onAgentSelect:re,onSkillSelect:e=>re(e.name),onClose:()=>l(!1),style:{left:0,top:`auto`,bottom:`calc(100% + 6px)`,marginBottom:0,maxWidth:`100%`}}):null,t[61]=re,t[62]=j,t[63]=u,t[64]=c,t[65]=de):de=t[65];let W;t[66]!==H||t[67]!==U||t[68]!==de?(W=(0,$.jsxs)(`div`,{className:`relative`,children:[H,U,de]}),t[66]=H,t[67]=U,t[68]=de,t[69]=W):W=t[69];let G;t[70]!==R||t[71]!==W?(G=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[R,W]}),t[70]=R,t[71]=W,t[72]=G):G=t[72];let fe;t[73]===s?fe=t[74]:(fe=s(`multirun.launcher.models.info`,{max:it}),t[73]=s,t[74]=fe);let pe;t[75]===fe?pe=t[76]:(pe=(0,$.jsx)(at,{children:fe}),t[75]=fe,t[76]=pe);let K;t[77]===s?K=t[78]:(K=s(`multirun.launcher.models.label`),t[77]=s,t[78]=K);let q;t[79]!==pe||t[80]!==K?(q=(0,$.jsx)(ot,{required:!0,info:pe,children:K}),t[79]=pe,t[80]=K,t[81]=q):q=t[81];let J;t[82]!==n.models||t[83]!==S||t[84]!==w||t[85]!==ee?(J=(0,$.jsx)(Ie,{selectedModels:n.models,onAdd:S,onRemove:w,onUpdate:ee,minModels:1,maxModels:it}),t[82]=n.models,t[83]=S,t[84]=w,t[85]=ee,t[86]=J):J=t[86];let he;t[87]!==q||t[88]!==J?(he=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[q,J]}),t[87]=q,t[88]=J,t[89]=he):he=t[89];let Y;return t[90]!==I||t[91]!==G||t[92]!==he?(Y=(0,$.jsxs)(`div`,{className:`rounded-lg border border-border p-3 space-y-3`,children:[I,G,he]}),t[90]=I,t[91]=G,t[92]=he,t[93]=Y):Y=t[93],Y};export{Q as a,Pe as i,Ze as n,we as o,Ie as r,ct as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{n as t}from"./platform-sEg2IOLZ.js";import{t as n}from"./types-
|
|
1
|
+
import{a as e}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{n as t}from"./platform-sEg2IOLZ.js";import{t as n}from"./types-DUFadVpY.js";var r=e(`YuriUpdateConfig`);async function i(){if(!t())throw new n;let e=await r.getConfiguration();if(e.channel!==`stable`&&e.channel!==`beta`||typeof e.shellApiVersion!=`number`||!Number.isInteger(e.shellApiVersion)||e.shellApiVersion<1)throw Error(`Invalid native update configuration`);return{channel:e.channel,shellApiVersion:e.shellApiVersion}}export{i as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./runtime-switch-DEZ1K7qW.js";import{n as r}from"./runtime-fetch-D0YWp3FJ.js";import{a as i,i as a}from"./vendor-zustand-vDaAPGfl.js";import{ot as o,st as s}from"./vendor-base-ui-CzHs0bHY.js";import{r as c}from"./useUIStore-BerIUSLP.js";import{n as l}from"./vendor-react-DlzBev0S.js";import{d as u,f as d,p as f,r as p,t as m}from"./button-C-gRcs_2.js";import{Ar as h,Dr as g,Hi as _,Or as v,Tr as y,jr as b,ki as ee,kr as te,p as x,ri as S,w as ne}from"./useMobileNavigationStore-C8nCzxDH.js";import{n as C}from"./Icon-OJf0qBKf.js";import{k as re,l as ie,v as w,x as T}from"./gitApi-DSzxh9dp.js";import{t as ae}from"./input-CmLlZdeD.js";import{i as oe,n as se,t as ce}from"./tooltip-Degmpxnd.js";import{d as le,l as ue}from"./select-J8r9SxHt.js";import{_ as de,l as fe,o as pe,s as me,t as he,v as ge,y as E}from"./vendor-dnd-kit-core-DK4OoOTr.js";import{n as _e,o as D,s as ve,t as ye}from"./vendor-dnd-kit-sortable-Cv69eQm1.js";import{n as be}from"./textarea-BHgcxJdC.js";var O=e(s(),1),k=l(),xe=(e,t)=>{if(!e||typeof e!=`object`)return;let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0},Se=(e,t,n)=>{let r=xe(t.limit,`context`),i=xe(t.limit,`output`),a=r??n?.limit?.context,o=i??n?.limit?.output;return a===void 0&&o===void 0?n:{...n??{id:typeof t.id==`string`?t.id:``,providerId:e,name:typeof t.name==`string`?t.name:void 0},limit:{...n?.limit,...a===void 0?{}:{context:a},...o===void 0?{}:{output:o}}}};function Ce(e){let t=e.toLowerCase().trim();return{lower:t,compact:t.replace(/[^a-z0-9]/g,``),tokens:t.split(/[^a-z0-9]+/).filter(Boolean)}}function we(e,t){let n=Ce(t);if(!n.lower)return!0;let r=Ce(e);return r.lower.includes(n.lower)||n.compact.length>=2&&r.compact.includes(n.compact)?!0:n.tokens.length!==0&&n.tokens.every(e=>r.tokens.some(t=>t.startsWith(e)||t.includes(e)))}var Te=i()(a(e=>({collapsedSections:{},toggleSection:t=>e(e=>{let n={...e.collapsedSections};return n[t]?delete n[t]:n[t]=!0,{collapsedSections:n}})}),{name:`model-picker-collapsed-sections`,version:1})),A=o(),Ee={image:{icon:`file-image`,labelKey:`modalityImage`},video:{icon:`file-video`,labelKey:`modalityVideo`},audio:{icon:`file-music`,labelKey:`modalityAudio`}},De=e=>e.trim().toLowerCase(),j=e=>{let t=(0,k.c)(5),{iconName:n,label:r}=e,i;t[0]===n?i=t[1]:(i=(0,A.jsx)(C,{name:n,className:`size-3.5`}),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,A.jsx)(`span`,{className:`flex size-4 flex-shrink-0 items-center justify-center text-muted-foreground`,title:r,"aria-label":r,role:`img`,children:i}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a},Oe=(e,t)=>{let n=[];e?.tool_call&&t.capabilityToolCalling&&n.push({key:`tool_call`,icon:`tools`,label:t.capabilityToolCalling}),e?.reasoning&&t.capabilityReasoning&&n.push({key:`reasoning`,icon:`brain-ai-3`,label:t.capabilityReasoning});let r=[...e?.modalities?.input??[],...e?.modalities?.output??[]],i=Array.from(new Set(r.map(De).filter(Boolean)));for(let e of i){let r=Ee[e];if(!r)continue;let i=t[r.labelKey];i&&n.push({key:`modality-${e}`,icon:r.icon,label:i})}return n},ke=e=>new Intl.NumberFormat(f(),{notation:`compact`,compactDisplay:`short`,maximumFractionDigits:1,minimumFractionDigits:0}).format(e),M=e=>new Intl.NumberFormat(f(),{style:`currency`,currency:`USD`,maximumFractionDigits:4,minimumFractionDigits:2}).format(e),N=e=>_(e,void 0,{maxLength:40}),Ae=e=>{if(typeof e!=`number`||Number.isNaN(e))return``;if(e===0)return`0`;let t=ke(e);return t.endsWith(`.0`)?t.slice(0,-2):t},P=e=>typeof e!=`number`||!Number.isFinite(e)?`—`:M(e),F=(e,t)=>t?!0:e?!!(e.tool_call||e.reasoning||e.cost?.input!==void 0||e.cost?.output!==void 0||(e.modalities?.input?.length??0)>0||(e.modalities?.output?.length??0)>0):!1,je=e=>{let t=(0,k.c)(14),{metadata:n,providerName:r,providerID:i,modelID:a,active:o,labels:s,children:c}=e,{t:l}=d(),[f,p]=O.useState(!1),h=`${i}/${a}`,g,_;if(t[0]===o?(g=t[1],_=t[2]):(g=()=>{if(!o){p(!1);return}let e=window.setTimeout(()=>p(!0),450);return()=>window.clearTimeout(e)},_=[o],t[0]=o,t[1]=g,t[2]=_),O.useEffect(g,_),!F(n,r))return c;let v;if(t[3]!==o||t[4]!==c||t[5]!==f||t[6]!==s||t[7]!==n||t[8]!==h||t[9]!==r||t[10]!==l){let e=Oe(n,s),i=n?.cost?.input!==void 0||n?.cost?.output!==void 0,a;t[12]===c?a=t[13]:(a=(0,A.jsx)(oe,{asChild:!0,children:c}),t[12]=c,t[13]=a),v=(0,A.jsxs)(ce,{delayDuration:0,open:o&&f,onOpenChange:I,children:[a,o&&f?(0,A.jsx)(se,{side:`right`,sideOffset:8,className:`min-w-52 max-w-xs text-left transition-none data-[starting-style]:opacity-100 data-[starting-style]:scale-100 data-[ending-style]:opacity-100 data-[ending-style]:scale-100`,children:(0,A.jsxs)(`div`,{className:`flex flex-col gap-2 text-left text-xs`,children:[r&&s.provider?(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-muted-foreground`,children:[(0,A.jsx)(`span`,{className:`typography-meta font-medium`,children:s.provider}),(0,A.jsx)(`span`,{className:`typography-meta text-foreground`,children:r})]}):null,e.length>0?(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-muted-foreground`,children:[(0,A.jsx)(`span`,{className:`typography-meta font-medium shrink-0`,children:s.capabilities}),(0,A.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-1`,children:e.map(Be)})]}):null,i?(0,A.jsxs)(`div`,{className:`flex items-start justify-between gap-3 text-muted-foreground`,children:[s.costPerMillion?(0,A.jsx)(`span`,{className:`typography-meta font-medium shrink-0`,children:s.costPerMillion}):null,(0,A.jsxs)(`div`,{className:`flex flex-col items-end gap-0.5 min-w-0`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5 min-w-0`,children:[s.costInput?(0,A.jsx)(`span`,{className:`typography-meta shrink-0`,children:s.costInput}):null,(0,A.jsx)(`span`,{className:`typography-meta text-foreground tabular-nums`,children:P(n?.cost?.input)})]}),(0,A.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5 min-w-0`,children:[s.costOutput?(0,A.jsx)(`span`,{className:`typography-meta shrink-0`,children:s.costOutput}):null,(0,A.jsx)(`span`,{className:`typography-meta text-foreground tabular-nums`,children:P(n?.cost?.output)})]})]})]}):null,(0,A.jsx)(m,{variant:`ghost`,size:`xs`,className:`h-auto min-h-0 w-full min-w-0 justify-end gap-0 rounded-none p-0 text-right cursor-copy font-normal text-muted-foreground hover:bg-transparent active:bg-transparent`,"aria-label":l(`onboarding.common.copyToClipboard`),title:h,onClick:async e=>{e.stopPropagation();try{(await u(h)).ok?S.success(l(`contextSidebar.actions.copied`)):S.error(l(`filesView.toast.copyFailed`))}catch{S.error(l(`filesView.toast.copyFailed`))}},children:(0,A.jsx)(`span`,{className:`block w-full min-w-0 truncate text-right text-[10px] leading-tight`,children:h})})]})}):null]}),t[3]=o,t[4]=c,t[5]=f,t[6]=s,t[7]=n,t[8]=h,t[9]=r,t[10]=l,t[11]=v}else v=t[11];return v},Me=()=>{let e=0,t=new Set,n=new Map,r=e=>{let t=n.get(e);if(t)for(let e of t)e()};return{getSnapshot:()=>e,subscribe:e=>(t.add(e),()=>t.delete(e)),subscribeIndex:(e,t)=>{let r=n.get(e);return r||(r=new Set,n.set(e,r)),r.add(t),()=>{r.delete(t),r.size===0&&n.delete(e)}},set:n=>{if(e===n)return;let i=e;e=n,r(i),r(n);for(let e of t)e()}}},Ne=O.memo(e=>{let t=(0,k.c)(12),{store:n,index:r,children:i}=e,a;t[0]!==r||t[1]!==n?(a=()=>n.getSnapshot()===r,t[0]=r,t[1]=n,t[2]=a):a=t[2];let[o,s]=O.useState(a),c,l;t[3]!==r||t[4]!==n?(c=()=>{let e=()=>s(n.getSnapshot()===r);return e(),n.subscribeIndex(r,e)},l=[r,n],t[3]=r,t[4]=n,t[5]=c,t[6]=l):(c=t[5],l=t[6]),O.useEffect(c,l);let u;t[7]!==i||t[8]!==o?(u=i(o),t[7]=i,t[8]=o,t[9]=u):u=t[9];let d;return t[10]===u?d=t[11]:(d=(0,A.jsx)(A.Fragment,{children:u}),t[10]=u,t[11]=d),d}),Pe=e=>{let t=(0,k.c)(11),{store:n,flatModelList:r,footerContent:i,fallback:a}=e,o;t[0]===n?o=t[1]:(o=()=>n.getSnapshot(),t[0]=n,t[1]=o);let[s,c]=O.useState(o),l,u;t[2]===n?(l=t[3],u=t[4]):(l=()=>n.subscribe(()=>c(n.getSnapshot())),u=[n],t[2]=n,t[3]=l,t[4]=u),O.useEffect(l,u);let d=r[s],f;t[5]!==d||t[6]!==a||t[7]!==i?(f=typeof i==`function`?i(d):i??a,t[5]=d,t[6]=a,t[7]=i,t[8]=f):f=t[8];let p;return t[9]===f?p=t[10]:(p=(0,A.jsx)(A.Fragment,{children:f}),t[9]=f,t[10]=p),p},Fe=e=>{let t=(0,k.c)(21),{id:n,disabled:r,children:i}=e,a=r!==void 0&&r,o;t[0]!==a||t[1]!==n?(o={id:n,disabled:a},t[0]=a,t[1]=n,t[2]=o):o=t[2];let{attributes:s,listeners:c,setNodeRef:l,setActivatorNodeRef:u,transform:d,transition:f,isDragging:m}=D(o),h;t[3]===d?h=t[4]:(h=E.Transform.toString(d),t[3]=d,t[4]=h);let g;t[5]!==h||t[6]!==f?(g={transform:h,transition:f},t[5]=h,t[6]=f,t[7]=g):g=t[7];let _=m&&`opacity-60`,v;t[8]===_?v=t[9]:(v=p(_),t[8]=_,t[9]=v);let y;t[10]!==s||t[11]!==i||t[12]!==m||t[13]!==c||t[14]!==u?(y=i({attributes:s,listeners:c,setActivatorNodeRef:u,isDragging:m}),t[10]=s,t[11]=i,t[12]=m,t[13]=c,t[14]=u,t[15]=y):y=t[15];let b;return t[16]!==l||t[17]!==g||t[18]!==v||t[19]!==y?(b=(0,A.jsx)(`div`,{ref:l,style:g,className:v,children:y}),t[16]=l,t[17]=g,t[18]=v,t[19]=y,t[20]=b):b=t[20],b},Ie=e=>{let t=(0,k.c)(21),{id:n,disabled:r,children:i}=e,a=r!==void 0&&r,o;t[0]!==a||t[1]!==n?(o={id:n,disabled:a},t[0]=a,t[1]=n,t[2]=o):o=t[2];let{attributes:s,listeners:c,setNodeRef:l,setActivatorNodeRef:u,transform:d,transition:f,isDragging:m}=D(o),h;t[3]===d?h=t[4]:(h=E.Translate.toString(d),t[3]=d,t[4]=h);let g;t[5]!==h||t[6]!==f?(g={transform:h,transition:f},t[5]=h,t[6]=f,t[7]=g):g=t[7];let _=m&&`opacity-60`,v;t[8]===_?v=t[9]:(v=p(_),t[8]=_,t[9]=v);let y;t[10]!==s||t[11]!==i||t[12]!==m||t[13]!==c||t[14]!==u?(y=i({attributes:s,listeners:c,setActivatorNodeRef:u,isDragging:m}),t[10]=s,t[11]=i,t[12]=m,t[13]=c,t[14]=u,t[15]=y):y=t[15];let b;return t[16]!==l||t[17]!==g||t[18]!==v||t[19]!==y?(b=(0,A.jsx)(`div`,{ref:l,style:g,className:v,children:y}),t[16]=l,t[17]=g,t[18]=v,t[19]=y,t[20]=b):b=t[20],b},Le=32,Re=(e,t)=>{if(!t)return;if(!e){t.scrollIntoView({block:`nearest`});return}let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=r.top-n.top+e.scrollTop,a=i+r.height,o=e.scrollTop,s=o+e.clientHeight,c=i<o+Le?i-Le:a>s?a-e.clientHeight:o,l=Math.max(0,e.scrollHeight-e.clientHeight);e.scrollTop=Math.max(0,Math.min(c,l))},ze=({providers:e,favoriteModels:t,recentModels:n,getMetadata:r,searchQuery:i,onSearchQueryChange:a,onSelect:o,labels:s,selectedModel:c,hiddenModels:l=[],allowedProviderIds:u,allowedModelIdsByProvider:d,includeNotSelected:f=!1,onSelectNone:m,selectionCount:h,disabled:g=!1,maxHeightClassName:_=`max-h-[min(400px,calc(100dvh-12rem))] flex-1`,maxHeightStyle:v,sectionHeaderClassName:y,rowClassName:b,stickyHeaders:ee=!0,autoFocus:te=!0,onEscape:x,isFavorite:S,onToggleFavorite:ne,renderRowEnd:re,onActiveKeyDown:ie,onActiveEntryChange:w,onVariantKey:T,onReorderFavorite:oe,reorderFavoriteAriaLabel:se,reorderFavoriteTitle:ce,providerOrder:E,onReorderProvider:D,reorderProviderTitle:k,footerContent:xe,renderVersion:Ce,tooltipsEnabled:Ee=!0})=>{let De=O.useRef(null);De.current||=Me();let j=De.current,Oe=O.useRef([]),ke=O.useRef(null),M=O.useRef(!1),P=O.useRef(null),F=Te(e=>e.collapsedSections),Le=Te(e=>e.toggleSection),ze=O.useMemo(()=>new Set(Object.keys(F).filter(e=>F[e])),[F]),I=i.trim().length>0,[Be,L]=O.useState(()=>new Set),R=I?Be:ze,Ve=ge(de(me,{activationConstraint:{distance:8}})),He=ge(de(pe,{activationConstraint:{distance:8}})),z=O.useMemo(()=>!u||u.length===0?null:new Set(u),[u]),Ue=O.useMemo(()=>d?new Map(Object.entries(d).map(([e,t])=>[e,new Set(t)])):null,[d]),B=O.useCallback((e,t)=>!Ue||Ue.get(e)?.has(t)===!0,[Ue]),V=O.useMemo(()=>new Map(e.map(e=>[e.id,e])),[e]),H=O.useCallback((e,t)=>l.some(n=>n.providerID===e&&n.modelID===t),[l]),U=O.useCallback((e,t)=>{let n=i.trim();return!n||we(`${t} ${e}`,n)},[i]),W=O.useMemo(()=>t.filter(({model:e,providerID:t,modelID:n})=>{if(z&&!z.has(t)||!B(t,n)||H(t,n))return!1;let r=V.get(t)?.name||t;return U(N(e),r)}),[z,t,B,H,U,V]),G=O.useMemo(()=>n.filter(({model:e,providerID:t,modelID:n})=>{if(z&&!z.has(t)||!B(t,n)||H(t,n))return!1;let r=V.get(t)?.name||t;return U(N(e),r)}),[z,B,H,U,V,n]),We=O.useMemo(()=>{if(!E||E.length===0)return e;let t=new Map(E.map((e,t)=>[e,t])),n=e.filter(e=>t.has(e.id)).sort((e,n)=>(t.get(e.id)??0)-(t.get(n.id)??0)),r=e.filter(e=>!t.has(e.id));return[...n,...r]},[E,e]),K=O.useMemo(()=>We.filter(e=>!z||z.has(e.id)).map(e=>{let t=(Array.isArray(e.models)?e.models:[]).filter(t=>{let n=typeof t.id==`string`?t.id:``;return!n||H(e.id,n)||!B(e.id,n)?!1:U(N(t),e.name||e.id)});return{...e,models:t}}).filter(e=>e.models.length>0),[z,B,H,U,We]),q=O.useMemo(()=>{let e=[];return R.has(`favorites`)||W.forEach(t=>e.push(t)),R.has(`recent`)||G.forEach(t=>e.push(t)),K.forEach(t=>{R.has(`provider:${t.id}`)||t.models.forEach(n=>e.push({model:n,providerID:t.id,modelID:n.id}))}),e},[R,W,K,G]),Ge=q.length>0,Ke=!!oe&&i.trim().length===0&&W.length>1,qe=!!D&&i.trim().length===0&&!z&&K.length>1,Je=O.useMemo(()=>new Map(W.map(e=>[`${e.providerID}:${e.modelID}`,e])),[W]);O.useEffect(()=>{j.set(0)},[i,j]),O.useEffect(()=>{I||L(e=>e.size===0?e:new Set)},[I]);let Ye=O.useCallback(e=>{j.set(e),w?.(q[e])},[q,w,j]),J=O.useCallback(e=>{let t=q.length;if(t===0)return;M.current=!0,P.current=null;let n=(j.getSnapshot()+e+t)%t;j.set(n),w?.(q[n]),requestAnimationFrame(()=>Re(ke.current,Oe.current[n]))},[q,w,j]);O.useEffect(()=>{w?.(q[j.getSnapshot()])},[q,w,j]);let Xe=O.useCallback(e=>{if(!e.defaultPrevented){if(e.stopPropagation(),e.key===`ArrowLeft`||e.key===`ArrowRight`){let t=q[j.getSnapshot()];if(t&&T?.(e,t))return}if(ie?.(e,q[j.getSnapshot()]),!e.defaultPrevented){if(e.key===`ArrowDown`){e.preventDefault(),J(1);return}if(e.key===`ArrowUp`){e.preventDefault(),J(-1);return}if(e.key===`Enter`){e.preventDefault();let t=q[j.getSnapshot()];t&&!g&&o(t);return}e.key===`Escape`&&(e.preventDefault(),x?.())}}},[g,q,J,ie,x,o,T,j]),Ze=p(`model-picker-section-header typography-micro font-semibold text-muted-foreground uppercase tracking-wider flex items-center gap-2 px-2 py-1.5`,ee&&`sticky top-0 z-10 [background:linear-gradient(var(--surface-elevated),var(--surface-elevated)),linear-gradient(var(--surface-background),var(--surface-background))]`,y),Y=0,X=(e,t,n,i,a)=>{let l=Se(e.providerID,e.model,r?.(e.providerID,e.modelID)),u=V.get(e.providerID)?.name||e.providerID,d=Ae(l?.limit?.context),f=h?.(e)??0,m=c?.providerID===e.providerID&&c.modelID===e.modelID,_=S?.(e)??!1,v=e=>{let t={x:e.clientX,y:e.clientY},n=P.current,r=!n||n.x!==t.x||n.y!==t.y;P.current=t,!(M.current&&!n)&&(M.current&&!r||(M.current&&r&&(M.current=!1),Ye(i)))};return(0,A.jsx)(Ne,{store:j,index:i,renderVersion:Ce,children:t=>{let r=(0,A.jsxs)(`div`,{ref:e=>{Oe.current[i]=e},role:`option`,"aria-selected":m,"aria-disabled":g||void 0,tabIndex:-1,onClick:()=>{g||o(e)},onKeyDown:t=>{g||(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),o(e))},onMouseEnter:v,onMouseMove:v,className:p(`w-full text-left px-2 py-1.5 rounded-md typography-meta flex items-center gap-2 cursor-pointer`,!g&&(t?`bg-interactive-selection`:`hover:bg-interactive-hover/50`),g&&`cursor-not-allowed opacity-60`,b),children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-1 min-w-0`,children:[a?(0,A.jsx)(`button`,{type:`button`,ref:a.setActivatorNodeRef,...a.attributes,...a.listeners,disabled:g,onClick:e=>{e.preventDefault(),e.stopPropagation()},className:`model-favorite-drag-handle flex size-4 flex-shrink-0 items-center justify-center text-muted-foreground hover:text-foreground disabled:pointer-events-none`,"aria-label":se,title:ce,children:(0,A.jsx)(C,{name:`draggable`,className:`size-3.5`})}):null,n?(0,A.jsx)(le,{modelId:e.modelID,providerId:e.providerID,className:`h-3.5 w-3.5 flex-shrink-0`}):null,(0,A.jsx)(`span`,{className:`font-medium truncate`,children:N(e.model)}),d?(0,A.jsx)(`span`,{className:`typography-micro text-muted-foreground flex-shrink-0`,children:d}):null]}),f>0?(0,A.jsxs)(`span`,{className:`typography-micro text-muted-foreground flex-shrink-0`,children:[`x`,f]}):null,re?.(e,{isHighlighted:t,isSelected:m}),m?(0,A.jsx)(C,{name:`check`,className:`h-4 w-4 text-primary flex-shrink-0`}):null,ne?(0,A.jsx)(`button`,{type:`button`,disabled:g,onClick:t=>{t.preventDefault(),t.stopPropagation(),ne(e)},className:p(`model-favorite-button flex h-4 w-4 items-center justify-center hover:text-primary/80 flex-shrink-0 disabled:pointer-events-none`,_?`text-primary`:`text-muted-foreground`),"aria-label":_?s.unfavorite:s.favorite,title:_?s.unfavorite:s.favorite,children:(0,A.jsx)(C,{name:_?`star-fill`:`star`,className:`h-3.5 w-3.5`})}):null]});return(0,A.jsx)(je,{metadata:l,providerName:u,providerID:e.providerID,modelID:e.modelID,active:Ee&&t,labels:s,children:r})}},`${t}-${e.providerID}-${e.modelID}`)},Qe=e=>{if(!oe)return;let{active:t,over:n}=e;if(!n||t.id===n.id)return;let r=Je.get(String(t.id)),i=Je.get(String(n.id));!r||!i||oe(r,i)},$e=e=>{if(!D)return;let{active:t,over:n}=e;if(!n||t.id===n.id)return;let r=We.map(e=>e.id),i=r.indexOf(String(t.id)),a=r.indexOf(String(n.id));i!==-1&&a!==-1&&D(_e(r,i,a))},Z=e=>R.has(e),et=e=>{if(!I){Le(e);return}L(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Q=(e,t,n,r)=>{let i=Z(e),a=t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),et(e))};return r?(0,A.jsxs)(`div`,{ref:r.setActivatorNodeRef,...r.attributes,...r.listeners,role:`button`,tabIndex:0,"aria-expanded":!i,title:k,className:p(Ze,`w-full text-left cursor-grab select-none active:cursor-grabbing`),onClick:()=>et(e),onKeyDown:a,children:[(0,A.jsx)(C,{name:`draggable`,className:`size-3.5 flex-shrink-0 text-muted-foreground/70`}),t,(0,A.jsx)(`span`,{className:`min-w-0 truncate`,children:n}),(0,A.jsx)(`span`,{className:`ml-auto flex size-4 flex-shrink-0 items-center justify-center text-muted-foreground`,children:(0,A.jsx)(C,{name:i?`arrow-right-s`:`arrow-down-s`,className:`size-4`})})]}):(0,A.jsxs)(`button`,{type:`button`,className:p(Ze,`w-full text-left cursor-pointer`),onClick:()=>et(e),"aria-expanded":!i,children:[t,(0,A.jsx)(`span`,{className:`min-w-0 truncate`,children:n}),(0,A.jsx)(`span`,{className:`ml-auto flex size-4 flex-shrink-0 items-center justify-center text-muted-foreground`,children:(0,A.jsx)(C,{name:i?`arrow-right-s`:`arrow-down-s`,className:`size-4`})})]})},tt=(e,t,n)=>(0,A.jsxs)(A.Fragment,{children:[t>0?(0,A.jsx)(`div`,{className:`h-px bg-border/40 my-1`}):null,Q(`provider:${e.id}`,(0,A.jsx)(ue,{providerId:e.id,className:`h-4 w-4 flex-shrink-0`}),e.name||e.id,n),Z(`provider:${e.id}`)?null:e.models.map(t=>X({model:t,providerID:e.id,modelID:t.id},`provider`,!0,Y++))]});return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:`p-1.5 pb-1`,children:(0,A.jsxs)(`div`,{className:`relative`,children:[(0,A.jsx)(C,{name:`search`,className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground`}),(0,A.jsx)(ae,{type:`text`,placeholder:s.searchPlaceholder,value:i,onChange:e=>a(e.target.value),onKeyDown:Xe,className:`model-picker-search h-8 pl-8 typography-meta`,autoFocus:te})]})}),(0,A.jsx)(be,{ref:ke,outerClassName:_,className:`overlay-scrollbar-target--no-gutter`,style:v,children:(0,A.jsxs)(`div`,{className:`px-1`,children:[f?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 typography-meta text-muted-foreground hover:bg-interactive-hover/50`,onClick:m,children:[(0,A.jsx)(C,{name:`close`,className:`h-3.5 w-3.5`}),(0,A.jsx)(`span`,{children:s.notSelected}),c?null:(0,A.jsx)(C,{name:`check`,className:`h-4 w-4 text-primary ml-auto`})]}),(0,A.jsx)(`div`,{className:`h-px bg-border/40 my-1`})]}):null,Ge?null:(0,A.jsx)(`div`,{className:`px-2 py-4 text-center typography-meta text-muted-foreground`,children:s.noResults}),W.length>0?(0,A.jsxs)(`div`,{children:[Q(`favorites`,(0,A.jsx)(C,{name:`star-fill`,className:`h-4 w-4 text-primary`}),s.favorites),!Z(`favorites`)&&(Ke?(0,A.jsx)(he,{sensors:Ve,collisionDetection:fe,onDragEnd:Qe,children:(0,A.jsx)(ye,{items:W.map(e=>`${e.providerID}:${e.modelID}`),strategy:ve,children:W.map(e=>{let t=Y++;return(0,A.jsx)(Fe,{id:`${e.providerID}:${e.modelID}`,disabled:g,children:n=>X(e,`fav`,!0,t,n)},`fav-sortable-${e.providerID}-${e.modelID}`)})})}):W.map(e=>X(e,`fav`,!0,Y++)))]}):null,G.length>0?(0,A.jsxs)(`div`,{children:[W.length>0?(0,A.jsx)(`div`,{className:`h-px bg-border/40 my-1`}):null,Q(`recent`,(0,A.jsx)(C,{name:`time`,className:`h-4 w-4`}),s.recent),Z(`recent`)?null:G.map(e=>X(e,`recent`,!0,Y++))]}):null,(W.length>0||G.length>0)&&K.length>0?(0,A.jsx)(`div`,{className:`h-px bg-border/40 my-1`}):null,qe?(0,A.jsx)(he,{sensors:He,collisionDetection:fe,onDragEnd:$e,children:(0,A.jsx)(ye,{items:K.map(e=>e.id),strategy:ve,children:K.map((e,t)=>(0,A.jsx)(Ie,{id:e.id,disabled:g,children:n=>tt(e,t,n)},e.id))})}):K.map((e,t)=>(0,A.jsx)(`div`,{children:tt(e,t)},e.id))]})}),(0,A.jsx)(`div`,{className:`px-3 pt-1 pb-1.5 border-t border-border/40 typography-micro text-muted-foreground`,children:(0,A.jsx)(Pe,{store:j,flatModelList:q,footerContent:xe,fallback:s.keyboardHint})})]})};function I(){}function Be(e){let{key:t,icon:n,label:r}=e;return(0,A.jsx)(j,{iconName:n,label:r},t)}function L(e,t,n,r,i){let a=e.find(e=>e.id===n);if(!a)return null;let o=(Array.isArray(a.models)?a.models:[]).find(e=>e.id===r);return!o||t.some(e=>e.providerID===n&&e.modelID===r)?null:i===void 0?{provider:a,model:o,providerID:n,modelID:r}:{provider:a,model:o,providerID:n,modelID:r,variant:i}}var R=e=>{let t=(0,k.c)(30),n=ee(Ve),r=c(He),i=c(z),a=c(Ue),o=e?.currentProviderID??null,s=e?.currentModelID??null,l;if(t[0]!==r||t[1]!==a||t[2]!==n){let e;t[4]!==a||t[5]!==n?(e=e=>{let{providerID:t,modelID:r,variant:i}=e;return L(n,a,t,r,i)},t[4]=a,t[5]=n,t[6]=e):e=t[6],l=r.map(e).filter(B),t[0]=r,t[1]=a,t[2]=n,t[3]=l}else l=t[3];let u=l,d;if(t[7]!==s||t[8]!==o||t[9]!==r||t[10]!==a||t[11]!==n||t[12]!==i){bb0:{let e;t[14]!==a||t[15]!==n?(e=e=>{let{providerID:t,modelID:r,variant:i}=e;return L(n,a,t,r,i)},t[14]=a,t[15]=n,t[16]=e):e=t[16];let c;t[17]===r?c=t[18]:(c=e=>{let{providerID:t,modelID:n}=e;return!r.some(e=>e.providerID===t&&e.modelID===n)},t[17]=r,t[18]=c);let l=i.map(e).filter(V).filter(c);if(!o||!s){d=l;break bb0}if(r.some(e=>e.providerID===o&&e.modelID===s)){d=l;break bb0}let u;t[19]!==s||t[20]!==o?(u=e=>e.providerID===o&&e.modelID===s,t[19]=s,t[20]=o,t[21]=u):u=t[21];let f=l.findIndex(u);if(f===0){d=l;break bb0}if(f>0){let e=l.slice(),[t]=e.splice(f,1);e.unshift(t),d=e;break bb0}let p;t[22]!==s||t[23]!==o||t[24]!==a||t[25]!==n?(p=L(n,a,o,s),t[22]=s,t[23]=o,t[24]=a,t[25]=n,t[26]=p):p=t[26];let m=p;if(!m){d=l;break bb0}d=[m,...l]}t[7]=s,t[8]=o,t[9]=r,t[10]=a,t[11]=n,t[12]=i,t[13]=d}else d=t[13];let f=d,p;return t[27]!==u||t[28]!==f?(p={favoriteModelsList:u,recentModelsList:f},t[27]=u,t[28]=f,t[29]=p):p=t[29],p};function Ve(e){return e.providers}function He(e){return e.favoriteModels}function z(e){return e.recentModels}function Ue(e){return e.hiddenModels}function B(e){return e!==null}function V(e){return e!==null}var H=e=>{if(!e)return``;let t=e.replace(/\\/g,`/`);return t===`/`?`/`:t.replace(/\/+$/,``)};async function U(e){let t=H(e),n=await w(t);return{isDirty:!n.isClean,ahead:n.ahead,behind:n.behind,upstream:n.tracking}}var W=6e4,G=500,We=1048576,K=new Map,q=new Map,Ge=0,Ke=(e,t)=>e.length+t.length,qe=(e,t)=>{K.delete(e),K.set(e,{root:t,resolvedAt:Date.now()});let n=0;for(let[e,t]of K)n+=Ke(e,t.root);for(;K.size>G||n>We&&K.size>1;){let e=K.entries().next().value;if(!e)break;n-=Ke(e[0],e[1].root),K.delete(e[0])}};function Je(e){if(Ge+=1,typeof e==`string`&&e){let t=H(e);K.delete(t),q.delete(t);return}K.clear(),q.clear()}var Ye=async e=>re(e).catch(()=>e),J=async e=>{let t=K.get(e);if(t&&Date.now()-t.resolvedAt<W)return K.delete(e),K.set(e,t),t.root;t&&K.delete(e);let n=q.get(e);if(n)return n;let r=Ge,i=Ye(e).then(t=>(Ge===r&&qe(e,t),t)).catch(()=>e).finally(()=>{q.get(e)===i&&q.delete(e)});return q.set(e,i),i};async function Xe(e,t){let n=H(e);if(!n)return`HEAD`;try{let e=await J(n).catch(()=>n),r=t?.knownBranch?.trim();if(r&&e===n)return r;let i=await w(e);return(typeof i.current==`string`?i.current.trim():``)||`HEAD`}catch{return`HEAD`}}var Ze=e=>{let t=(e.branch||``).trim(),n=(e.head||``).trim();return t?`branch`:n?`detached`:`unborn`},Y=(e,t)=>({worktreeRoot:t,worktreeStatus:`ready`,headState:Ze(e),worktreeSource:`existing`}),X=e=>{let t=e.replace(/\\/g,`/`);return t===`/`?`/`:t.length>1?t.replace(/\/+$/,``):t},Qe=e=>e.trim().replace(/^refs\/heads\//,``).replace(/^heads\//,``).replace(/\s+/g,`-`).replace(/^\/+|\/+$/g,``).split(`/`).join(`-`).replace(/[^A-Za-z0-9._-]+/g,`-`).replace(/-+/g,`-`).replace(/^-+|-+$/g,``).slice(0,80),$e=e=>e.trim().replace(/^refs\/heads\//,``).replace(/^heads\//,``).replace(/\s+/g,`-`).replace(/^\/+|\/+$/g,``),Z=(e,t)=>{let n=X(e);n&&x.setState(e=>{let r=!1,i=e=>X(e.path)!==n||e.worktreeStatus===t?e:(r=!0,{...e,worktreeStatus:t}),a=e.availableWorktrees,o=!1,s=e.availableWorktrees.map(e=>{let t=i(e);return t!==e&&(o=!0),t});o&&(a=s);let c=e.availableWorktreesByProject;for(let[t,n]of e.availableWorktreesByProject){let r=!1,a=n.map(e=>{let t=i(e);return t!==e&&(r=!0),t});r&&(c===e.availableWorktreesByProject&&(c=new Map(e.availableWorktreesByProject)),c.set(t,a))}let l=e.worktreeMetadata;for(let[t,n]of e.worktreeMetadata){let r=i(n);r!==n&&(l===e.worktreeMetadata&&(l=new Map(e.worktreeMetadata)),l.set(t,r))}return r?{availableWorktrees:a,availableWorktreesByProject:c,worktreeMetadata:l}:{}})},et=e=>e?.status===`pending`?`pending`:e?.status===`failed`?`invalid`:`ready`,Q=e=>{let t=X(e),n=t.split(`/`).filter(Boolean);return n[n.length-1]??t},tt=e=>{let t=[];for(let n of e.setupCommands){let r=n.trim();r&&t.push(y(r,{rootWorktreePath:e.projectDirectory}))}let n=t.filter(Boolean).join(` && `);return n.trim().length>0?n:void 0},nt=(e,t)=>{let n=e.mode===`existing`?`existing`:`new`,r=Qe(e.worktreeName??e.preferredName??``),i=$e(e.branchName??(n===`new`?e.preferredName:void 0)??``),a=$e(e.existingBranch??e.branchName??``),o=(e.startRef||``).trim(),s=tt({projectDirectory:t,setupCommands:Array.isArray(e.setupCommands)?e.setupCommands:[]});return{mode:n,...r?{worktreeName:r}:{},...i?{branchName:i}:{},...a?{existingBranch:a}:{},...o?{startRef:o}:{},...s?{startCommand:s}:{},...e.setUpstream?{setUpstream:!0}:{},...e.upstreamRemote?{upstreamRemote:e.upstreamRemote}:{},...e.upstreamBranch?{upstreamBranch:e.upstreamBranch}:{},...e.ensureRemoteName?{ensureRemoteName:e.ensureRemoteName}:{},...e.ensureRemoteUrl?{ensureRemoteUrl:e.ensureRemoteUrl}:{},...e.returnAfterDirectoryCreated?{returnAfterDirectoryCreated:!0}:{}}},rt=(e,t)=>{if(e.size!==t.size)return!1;for(let[n,r]of e){let e=t.get(n);if(!e||e.length!==r.length)return!1;for(let t=0;t<r.length;t++){let n=r[t],i=e[t];if(n.path!==i.path||n.branch!==i.branch||n.name!==i.name||n.label!==i.label||n.projectDirectory!==i.projectDirectory||n.worktreeRoot!==i.worktreeRoot||n.headState!==i.headState||n.worktreeSource!==i.worktreeSource||n.source!==i.source)return!1}}return!0},it=new Map,at=new Map,ot=new Map,st=3e4,ct=e=>`${t()}\u0000${X(e)}`,lt=(e,t=ct(e))=>ot.get(t)??0,ut=e=>{let t=ct(e);ot.set(t,lt(e)+1),it.delete(t)},dt=async e=>{let t=await J(e).catch(()=>e),n=X(e);return(await T.worktree.list(e)).filter(e=>typeof e.path==`string`&&e.path.trim().length>0).map(e=>{let n=X(e.path),r=(e.branch||``).replace(/^refs\/heads\//,``).trim(),i=(e.name||``).trim(),a=Y(e,n);return{source:`sdk`,name:i||Q(n),path:n,projectDirectory:t,branch:r,label:r||i||Q(n),worktreeRoot:a.worktreeRoot,worktreeStatus:a.worktreeStatus,headState:a.headState,worktreeSource:a.worktreeSource}}).filter(e=>X(e.path)!==n).sort((e,t)=>{let n=(e.label||e.branch||e.path).toLowerCase(),r=(t.label||t.branch||t.path).toLowerCase();return n.localeCompare(r)})},ft=async(e,n,r)=>{for(;;){let i=lt(e,n),a=await dt(e);if(i===lt(e,n))return r===t()&&it.set(n,{value:a,at:Date.now()}),a}};async function pt(e){let n=X(e.path),r=t(),i=`${r}\u0000${n}`,a=it.get(i);if(a&&Date.now()-a.at<st)return a.value;let o=at.get(i);if(o)return o;let s=ft(n,i,r).finally(()=>{at.get(i)===s&&at.delete(i)});return at.set(i,s),s}var mt=(e,t)=>{let n=v(e.path),r=n?.status===`pending`?`pending`:n?.status===`failed`?`invalid`:t?.worktreeStatus;return r&&r!==e.worktreeStatus?{...e,worktreeStatus:r}:e},ht=e=>{let t=new Set([...e].map(X));if(t.size===0)return;let n=x.getState().worktreeMetadata,r=new Map(n);for(let[e,i]of n)t.has(X(i.path))&&r.delete(e);for(let[e,n]of ne.getState().attachments){let r=typeof n.worktreeRoot==`string`&&n.worktreeRoot.trim()?X(n.worktreeRoot):``,i=typeof n.cwd==`string`&&n.cwd.trim()?X(n.cwd):``;(r&&t.has(r)||i&&t.has(i))&&ne.getState().clearAttachment(e)}r.size!==n.size&&x.setState({worktreeMetadata:r})};async function gt(e,t={}){let n=X(e.path);ut(n);let r=await pt({...e,path:n});if(t.isCurrent&&!t.isCurrent())return{worktrees:r,addedDirectories:[],removedDirectories:[]};let i=r,a=[],o=[];return x.setState(e=>{let t=e.availableWorktreesByProject,s=t.get(n)??[],c=new Map(s.map(e=>[X(e.path),e])),l=r.map(e=>mt(e,c.get(X(e.path)))),u=new Set(l.map(e=>X(e.path)));if(a=l.filter(e=>!c.has(X(e.path))).map(e=>e.path),o=s.filter(e=>!u.has(X(e.path))).map(e=>e.path),i=l,s.length===l.length&&s.every((e,t)=>{let n=l[t];return n&&e.path===n.path&&e.branch===n.branch&&e.name===n.name&&e.label===n.label&&e.projectDirectory===n.projectDirectory&&e.worktreeRoot===n.worktreeRoot&&e.headState===n.headState&&e.worktreeSource===n.worktreeSource&&e.source===n.source&&e.worktreeStatus===n.worktreeStatus}))return{};let d=new Map(t);return d.set(n,l),{availableWorktreesByProject:d,availableWorktrees:[...d.values()].flat()}}),ht(o),{worktrees:i,addedDirectories:a,removedDirectories:o}}async function _t(e,t){let n=X(e.path),r=await J(n).catch(()=>n),i=nt(t,n),a=await T.worktree.create(n,i),o=typeof a?.name==`string`?a.name:``,s=typeof a?.branch==`string`?a.branch:``,c=typeof a?.path==`string`?a.path:``;if(!o||!c)throw Error(`Worktree create missing name/path`);let l={source:`sdk`,name:o,path:X(c),projectDirectory:r,branch:s,label:s||o,worktreeRoot:X(c),worktreeStatus:et(a?.bootstrapStatus),headState:s?`branch`:`unborn`,worktreeSource:`created-for-session`};a?.bootstrapStatus?h(l.path,a.bootstrapStatus):te(l.path),b(l.path,{onFailed:()=>Z(l.path,`invalid`),onReady:()=>Z(l.path,`ready`)}),ut(n),Je();let u=n;return x.setState(e=>{let t=new Map(e.availableWorktreesByProject),n=t.get(u)??[];return t.set(u,[...n.filter(e=>X(e.path)!==l.path),l]),{availableWorktreesByProject:t,availableWorktrees:[...t.values()].flat()}}),l}async function vt(e,t){let n=e.path,r=nt(t,n);return T.worktree.validate(n,r)}async function yt(e,t,n){let r=X(e.path),i=!!n?.deleteRemoteBranch,a=n?.deleteLocalBranch===!0,o=n?.remoteName;if(!(await T.worktree.remove(r,{directory:t.path,deleteLocalBranch:a}))?.success)throw Error(`Worktree removal failed`);g(t.path),ut(X(e.path)),Je();let s=X(t.path),c=r,l=x.getState().availableWorktreesByProject,u=new Map(l),d=u.get(c)??[];u.set(c,d.filter(e=>X(e.path)!==s)),ht([s]),x.setState({availableWorktreesByProject:u,availableWorktrees:x.getState().availableWorktrees.filter(e=>X(e.path)!==s)});let f=(t.branch||``).replace(/^refs\/heads\//,``).trim();i&&f&&await ie(r,{branch:f,remote:o}).catch(()=>void 0)}var bt=200,$=new Map,xt=[{key:`code`,Icon:`code-box`,label:`Code`},{key:`terminal`,Icon:`terminal-box`,label:`Terminal`},{key:`rocket`,Icon:`rocket`,label:`Rocket`},{key:`flask`,Icon:`flask`,label:`Lab`},{key:`gamepad`,Icon:`gamepad`,label:`Game`},{key:`briefcase`,Icon:`briefcase`,label:`Work`},{key:`home`,Icon:`home`,label:`Home`},{key:`globe`,Icon:`global`,label:`Web`},{key:`leaf`,Icon:`leaf`,label:`Nature`},{key:`shield`,Icon:`shield`,label:`Security`},{key:`palette`,Icon:`palette`,label:`Design`},{key:`server`,Icon:`server`,label:`Server`},{key:`phone`,Icon:`smartphone`,label:`Mobile`},{key:`database`,Icon:`database-2`,label:`Data`},{key:`lightbulb`,Icon:`lightbulb`,label:`Idea`},{key:`music`,Icon:`music`,label:`Music`},{key:`camera`,Icon:`camera`,label:`Media`},{key:`book`,Icon:`book-open`,label:`Docs`},{key:`heart`,Icon:`heart`,label:`Favorite`}],St=Object.fromEntries(xt.map(e=>[e.key,e.Icon])),Ct=[{key:`keyword`,label:`Purple`,cssVar:`var(--syntax-keyword)`},{key:`string`,label:`Green`,cssVar:`var(--syntax-string)`},{key:`number`,label:`Pink`,cssVar:`var(--syntax-number)`},{key:`type`,label:`Gold`,cssVar:`var(--syntax-type)`},{key:`constant`,label:`Cyan`,cssVar:`var(--syntax-constant)`},{key:`comment`,label:`Muted`,cssVar:`var(--syntax-comment)`},{key:`error`,label:`Red`,cssVar:`var(--status-error)`},{key:`primary`,label:`Blue`,cssVar:`var(--primary)`},{key:`success`,label:`Green`,cssVar:`var(--status-success)`}],wt=Object.fromEntries(Ct.map(e=>[e.key,e.cssVar])),Tt=(e,t)=>{if(typeof e!=`number`||e<=0)return null;let n=new URLSearchParams({v:String(e)});return typeof t?.iconColor==`string`&&t.iconColor.trim()&&n.set(`iconColor`,t.iconColor.trim()),(t?.themeVariant===`light`||t?.themeVariant===`dark`)&&n.set(`theme`,t.themeVariant),n},Et=(e,t)=>e?[n()||`same-origin`,e,t.toString()].join(`|`):null,Dt=(e,t,n)=>{let r=Tt(t,n);if(!r)return null;let i=Et(e,r);return i?{cacheKey:i,projectId:e,query:r}:null},Ot=()=>{for(;$.size>bt;){let e=$.keys().next().value;if(typeof e!=`string`)return;let t=$.get(e);t?.url&&typeof URL<`u`&&typeof URL.revokeObjectURL==`function`&&URL.revokeObjectURL(t.url),$.delete(e)}},kt=e=>{let t=$.get(e.cacheKey);if(t?.url)return Promise.resolve(t.url);if(t?.promise)return t.promise;let n=r(`/api/projects/${encodeURIComponent(e.projectId)}/icon`,{method:`GET`,headers:{Accept:`image/*`},query:e.query}).then(async t=>{if(!t.ok||typeof URL>`u`||typeof URL.createObjectURL!=`function`)return null;let n=await t.blob(),r=URL.createObjectURL(n);return $.set(e.cacheKey,{url:r}),Ot(),r}).catch(()=>null).finally(()=>{let t=$.get(e.cacheKey);t?.promise===n&&!t.url&&$.delete(e.cacheKey)});return $.set(e.cacheKey,{promise:n}),n},At=(e,t)=>{let n=(0,k.c)(10),r=e.id,i=e.iconImage?.updatedAt,a=t?.themeVariant,o=t?.iconColor,s;n[0]!==o||n[1]!==r||n[2]!==a||n[3]!==i?(s=Dt(r,i,{themeVariant:a,iconColor:o}),n[0]=o,n[1]=r,n[2]=a,n[3]=i,n[4]=s):s=n[4];let c=s,l;n[5]===c?l=n[6]:(l=()=>c?$.get(c.cacheKey)?.url??null:null,n[5]=c,n[6]=l);let[u,d]=O.useState(l),f,p;return n[7]===c?(f=n[8],p=n[9]):(f=()=>{if(!c){d(null);return}let e=$.get(c.cacheKey)?.url;if(e){d(e);return}let t=!1;return d(null),kt(c).then(e=>{t||d(e)}),()=>{t=!0}},p=[c],n[7]=c,n[8]=f,n[9]=p),O.useEffect(f,p),u},jt=e=>{let t=(0,k.c)(21),{project:n,options:r,className:i,alt:a,draggable:o,fallback:s,onError:c}=e,l=a===void 0?``:a,u=o!==void 0&&o,d=s===void 0?null:s,f=At(n,r),[p,m]=O.useState(!1),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>{m(!1)},t[0]=h):h=t[0];let g=n.iconImage?.updatedAt,_;if(t[1]!==n.id||t[2]!==f||t[3]!==g?(_=[f,n.id,g],t[1]=n.id,t[2]=f,t[3]=g,t[4]=_):_=t[4],O.useEffect(h,_),!f||p){let e;return t[5]===d?e=t[6]:(e=O.createElement(O.Fragment,null,d),t[5]=d,t[6]=e),e}let v;if(t[7]!==l||t[8]!==i||t[9]!==u||t[10]!==c||t[11]!==f){let e;t[13]===c?e=t[14]:(e=e=>{m(!0),c?.(e)},t[13]=c,t[14]=e);let n;t[15]!==l||t[16]!==i||t[17]!==u||t[18]!==f||t[19]!==e?(n={src:f,alt:l,className:i,draggable:u,onError:e},t[15]=l,t[16]=i,t[17]=u,t[18]=f,t[19]=e,t[20]=n):n=t[20],v=O.createElement(`img`,n),t[7]=l,t[8]=i,t[9]=u,t[10]=c,t[11]=f,t[12]=v}else v=t[12];return v};export{Se as _,jt as a,pt as c,rt as d,Xe as f,we as g,ze as h,St as i,yt as l,R as m,wt as n,_t as o,U as p,xt as r,gt as s,Ct as t,vt as u};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./runtime-switch-DEZ1K7qW.js";import{n as r}from"./runtime-fetch-D0YWp3FJ.js";import{a as i,i as a}from"./vendor-zustand-vDaAPGfl.js";import{ot as o,st as s}from"./vendor-base-ui-CzHs0bHY.js";import{r as c}from"./useUIStore-BerIUSLP.js";import{n as l}from"./vendor-react-DlzBev0S.js";import{d as u,f as d,p as f,r as p,t as m}from"./button-C-gRcs_2.js";import{Ar as h,Dr as g,Hi as _,Or as v,Tr as y,jr as b,ki as ee,kr as te,p as x,ri as S,w as ne}from"./useMobileNavigationStore-DHX2bCjA.js";import{n as C}from"./Icon-OJf0qBKf.js";import{k as re,l as ie,v as w,x as T}from"./gitApi-DxUmZcUw.js";import{t as ae}from"./input-CmLlZdeD.js";import{i as oe,n as se,t as ce}from"./tooltip-Degmpxnd.js";import{d as le,l as ue}from"./select-J8r9SxHt.js";import{_ as de,l as fe,o as pe,s as me,t as he,v as ge,y as E}from"./vendor-dnd-kit-core-DK4OoOTr.js";import{n as _e,o as D,s as ve,t as ye}from"./vendor-dnd-kit-sortable-Cv69eQm1.js";import{n as be}from"./textarea-BHgcxJdC.js";var O=e(s(),1),k=l(),xe=(e,t)=>{if(!e||typeof e!=`object`)return;let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0},Se=(e,t,n)=>{let r=xe(t.limit,`context`),i=xe(t.limit,`output`),a=r??n?.limit?.context,o=i??n?.limit?.output;return a===void 0&&o===void 0?n:{...n??{id:typeof t.id==`string`?t.id:``,providerId:e,name:typeof t.name==`string`?t.name:void 0},limit:{...n?.limit,...a===void 0?{}:{context:a},...o===void 0?{}:{output:o}}}};function Ce(e){let t=e.toLowerCase().trim();return{lower:t,compact:t.replace(/[^a-z0-9]/g,``),tokens:t.split(/[^a-z0-9]+/).filter(Boolean)}}function we(e,t){let n=Ce(t);if(!n.lower)return!0;let r=Ce(e);return r.lower.includes(n.lower)||n.compact.length>=2&&r.compact.includes(n.compact)?!0:n.tokens.length!==0&&n.tokens.every(e=>r.tokens.some(t=>t.startsWith(e)||t.includes(e)))}var Te=i()(a(e=>({collapsedSections:{},toggleSection:t=>e(e=>{let n={...e.collapsedSections};return n[t]?delete n[t]:n[t]=!0,{collapsedSections:n}})}),{name:`model-picker-collapsed-sections`,version:1})),A=o(),Ee={image:{icon:`file-image`,labelKey:`modalityImage`},video:{icon:`file-video`,labelKey:`modalityVideo`},audio:{icon:`file-music`,labelKey:`modalityAudio`}},De=e=>e.trim().toLowerCase(),j=e=>{let t=(0,k.c)(5),{iconName:n,label:r}=e,i;t[0]===n?i=t[1]:(i=(0,A.jsx)(C,{name:n,className:`size-3.5`}),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,A.jsx)(`span`,{className:`flex size-4 flex-shrink-0 items-center justify-center text-muted-foreground`,title:r,"aria-label":r,role:`img`,children:i}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a},Oe=(e,t)=>{let n=[];e?.tool_call&&t.capabilityToolCalling&&n.push({key:`tool_call`,icon:`tools`,label:t.capabilityToolCalling}),e?.reasoning&&t.capabilityReasoning&&n.push({key:`reasoning`,icon:`brain-ai-3`,label:t.capabilityReasoning});let r=[...e?.modalities?.input??[],...e?.modalities?.output??[]],i=Array.from(new Set(r.map(De).filter(Boolean)));for(let e of i){let r=Ee[e];if(!r)continue;let i=t[r.labelKey];i&&n.push({key:`modality-${e}`,icon:r.icon,label:i})}return n},ke=e=>new Intl.NumberFormat(f(),{notation:`compact`,compactDisplay:`short`,maximumFractionDigits:1,minimumFractionDigits:0}).format(e),M=e=>new Intl.NumberFormat(f(),{style:`currency`,currency:`USD`,maximumFractionDigits:4,minimumFractionDigits:2}).format(e),N=e=>_(e,void 0,{maxLength:40}),Ae=e=>{if(typeof e!=`number`||Number.isNaN(e))return``;if(e===0)return`0`;let t=ke(e);return t.endsWith(`.0`)?t.slice(0,-2):t},P=e=>typeof e!=`number`||!Number.isFinite(e)?`—`:M(e),F=(e,t)=>t?!0:e?!!(e.tool_call||e.reasoning||e.cost?.input!==void 0||e.cost?.output!==void 0||(e.modalities?.input?.length??0)>0||(e.modalities?.output?.length??0)>0):!1,je=e=>{let t=(0,k.c)(14),{metadata:n,providerName:r,providerID:i,modelID:a,active:o,labels:s,children:c}=e,{t:l}=d(),[f,p]=O.useState(!1),h=`${i}/${a}`,g,_;if(t[0]===o?(g=t[1],_=t[2]):(g=()=>{if(!o){p(!1);return}let e=window.setTimeout(()=>p(!0),450);return()=>window.clearTimeout(e)},_=[o],t[0]=o,t[1]=g,t[2]=_),O.useEffect(g,_),!F(n,r))return c;let v;if(t[3]!==o||t[4]!==c||t[5]!==f||t[6]!==s||t[7]!==n||t[8]!==h||t[9]!==r||t[10]!==l){let e=Oe(n,s),i=n?.cost?.input!==void 0||n?.cost?.output!==void 0,a;t[12]===c?a=t[13]:(a=(0,A.jsx)(oe,{asChild:!0,children:c}),t[12]=c,t[13]=a),v=(0,A.jsxs)(ce,{delayDuration:0,open:o&&f,onOpenChange:I,children:[a,o&&f?(0,A.jsx)(se,{side:`right`,sideOffset:8,className:`min-w-52 max-w-xs text-left transition-none data-[starting-style]:opacity-100 data-[starting-style]:scale-100 data-[ending-style]:opacity-100 data-[ending-style]:scale-100`,children:(0,A.jsxs)(`div`,{className:`flex flex-col gap-2 text-left text-xs`,children:[r&&s.provider?(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-muted-foreground`,children:[(0,A.jsx)(`span`,{className:`typography-meta font-medium`,children:s.provider}),(0,A.jsx)(`span`,{className:`typography-meta text-foreground`,children:r})]}):null,e.length>0?(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-muted-foreground`,children:[(0,A.jsx)(`span`,{className:`typography-meta font-medium shrink-0`,children:s.capabilities}),(0,A.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-1`,children:e.map(Be)})]}):null,i?(0,A.jsxs)(`div`,{className:`flex items-start justify-between gap-3 text-muted-foreground`,children:[s.costPerMillion?(0,A.jsx)(`span`,{className:`typography-meta font-medium shrink-0`,children:s.costPerMillion}):null,(0,A.jsxs)(`div`,{className:`flex flex-col items-end gap-0.5 min-w-0`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5 min-w-0`,children:[s.costInput?(0,A.jsx)(`span`,{className:`typography-meta shrink-0`,children:s.costInput}):null,(0,A.jsx)(`span`,{className:`typography-meta text-foreground tabular-nums`,children:P(n?.cost?.input)})]}),(0,A.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5 min-w-0`,children:[s.costOutput?(0,A.jsx)(`span`,{className:`typography-meta shrink-0`,children:s.costOutput}):null,(0,A.jsx)(`span`,{className:`typography-meta text-foreground tabular-nums`,children:P(n?.cost?.output)})]})]})]}):null,(0,A.jsx)(m,{variant:`ghost`,size:`xs`,className:`h-auto min-h-0 w-full min-w-0 justify-end gap-0 rounded-none p-0 text-right cursor-copy font-normal text-muted-foreground hover:bg-transparent active:bg-transparent`,"aria-label":l(`onboarding.common.copyToClipboard`),title:h,onClick:async e=>{e.stopPropagation();try{(await u(h)).ok?S.success(l(`contextSidebar.actions.copied`)):S.error(l(`filesView.toast.copyFailed`))}catch{S.error(l(`filesView.toast.copyFailed`))}},children:(0,A.jsx)(`span`,{className:`block w-full min-w-0 truncate text-right text-[10px] leading-tight`,children:h})})]})}):null]}),t[3]=o,t[4]=c,t[5]=f,t[6]=s,t[7]=n,t[8]=h,t[9]=r,t[10]=l,t[11]=v}else v=t[11];return v},Me=()=>{let e=0,t=new Set,n=new Map,r=e=>{let t=n.get(e);if(t)for(let e of t)e()};return{getSnapshot:()=>e,subscribe:e=>(t.add(e),()=>t.delete(e)),subscribeIndex:(e,t)=>{let r=n.get(e);return r||(r=new Set,n.set(e,r)),r.add(t),()=>{r.delete(t),r.size===0&&n.delete(e)}},set:n=>{if(e===n)return;let i=e;e=n,r(i),r(n);for(let e of t)e()}}},Ne=O.memo(e=>{let t=(0,k.c)(12),{store:n,index:r,children:i}=e,a;t[0]!==r||t[1]!==n?(a=()=>n.getSnapshot()===r,t[0]=r,t[1]=n,t[2]=a):a=t[2];let[o,s]=O.useState(a),c,l;t[3]!==r||t[4]!==n?(c=()=>{let e=()=>s(n.getSnapshot()===r);return e(),n.subscribeIndex(r,e)},l=[r,n],t[3]=r,t[4]=n,t[5]=c,t[6]=l):(c=t[5],l=t[6]),O.useEffect(c,l);let u;t[7]!==i||t[8]!==o?(u=i(o),t[7]=i,t[8]=o,t[9]=u):u=t[9];let d;return t[10]===u?d=t[11]:(d=(0,A.jsx)(A.Fragment,{children:u}),t[10]=u,t[11]=d),d}),Pe=e=>{let t=(0,k.c)(11),{store:n,flatModelList:r,footerContent:i,fallback:a}=e,o;t[0]===n?o=t[1]:(o=()=>n.getSnapshot(),t[0]=n,t[1]=o);let[s,c]=O.useState(o),l,u;t[2]===n?(l=t[3],u=t[4]):(l=()=>n.subscribe(()=>c(n.getSnapshot())),u=[n],t[2]=n,t[3]=l,t[4]=u),O.useEffect(l,u);let d=r[s],f;t[5]!==d||t[6]!==a||t[7]!==i?(f=typeof i==`function`?i(d):i??a,t[5]=d,t[6]=a,t[7]=i,t[8]=f):f=t[8];let p;return t[9]===f?p=t[10]:(p=(0,A.jsx)(A.Fragment,{children:f}),t[9]=f,t[10]=p),p},Fe=e=>{let t=(0,k.c)(21),{id:n,disabled:r,children:i}=e,a=r!==void 0&&r,o;t[0]!==a||t[1]!==n?(o={id:n,disabled:a},t[0]=a,t[1]=n,t[2]=o):o=t[2];let{attributes:s,listeners:c,setNodeRef:l,setActivatorNodeRef:u,transform:d,transition:f,isDragging:m}=D(o),h;t[3]===d?h=t[4]:(h=E.Transform.toString(d),t[3]=d,t[4]=h);let g;t[5]!==h||t[6]!==f?(g={transform:h,transition:f},t[5]=h,t[6]=f,t[7]=g):g=t[7];let _=m&&`opacity-60`,v;t[8]===_?v=t[9]:(v=p(_),t[8]=_,t[9]=v);let y;t[10]!==s||t[11]!==i||t[12]!==m||t[13]!==c||t[14]!==u?(y=i({attributes:s,listeners:c,setActivatorNodeRef:u,isDragging:m}),t[10]=s,t[11]=i,t[12]=m,t[13]=c,t[14]=u,t[15]=y):y=t[15];let b;return t[16]!==l||t[17]!==g||t[18]!==v||t[19]!==y?(b=(0,A.jsx)(`div`,{ref:l,style:g,className:v,children:y}),t[16]=l,t[17]=g,t[18]=v,t[19]=y,t[20]=b):b=t[20],b},Ie=e=>{let t=(0,k.c)(21),{id:n,disabled:r,children:i}=e,a=r!==void 0&&r,o;t[0]!==a||t[1]!==n?(o={id:n,disabled:a},t[0]=a,t[1]=n,t[2]=o):o=t[2];let{attributes:s,listeners:c,setNodeRef:l,setActivatorNodeRef:u,transform:d,transition:f,isDragging:m}=D(o),h;t[3]===d?h=t[4]:(h=E.Translate.toString(d),t[3]=d,t[4]=h);let g;t[5]!==h||t[6]!==f?(g={transform:h,transition:f},t[5]=h,t[6]=f,t[7]=g):g=t[7];let _=m&&`opacity-60`,v;t[8]===_?v=t[9]:(v=p(_),t[8]=_,t[9]=v);let y;t[10]!==s||t[11]!==i||t[12]!==m||t[13]!==c||t[14]!==u?(y=i({attributes:s,listeners:c,setActivatorNodeRef:u,isDragging:m}),t[10]=s,t[11]=i,t[12]=m,t[13]=c,t[14]=u,t[15]=y):y=t[15];let b;return t[16]!==l||t[17]!==g||t[18]!==v||t[19]!==y?(b=(0,A.jsx)(`div`,{ref:l,style:g,className:v,children:y}),t[16]=l,t[17]=g,t[18]=v,t[19]=y,t[20]=b):b=t[20],b},Le=32,Re=(e,t)=>{if(!t)return;if(!e){t.scrollIntoView({block:`nearest`});return}let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=r.top-n.top+e.scrollTop,a=i+r.height,o=e.scrollTop,s=o+e.clientHeight,c=i<o+Le?i-Le:a>s?a-e.clientHeight:o,l=Math.max(0,e.scrollHeight-e.clientHeight);e.scrollTop=Math.max(0,Math.min(c,l))},ze=({providers:e,favoriteModels:t,recentModels:n,getMetadata:r,searchQuery:i,onSearchQueryChange:a,onSelect:o,labels:s,selectedModel:c,hiddenModels:l=[],allowedProviderIds:u,allowedModelIdsByProvider:d,includeNotSelected:f=!1,onSelectNone:m,selectionCount:h,disabled:g=!1,maxHeightClassName:_=`max-h-[min(400px,calc(100dvh-12rem))] flex-1`,maxHeightStyle:v,sectionHeaderClassName:y,rowClassName:b,stickyHeaders:ee=!0,autoFocus:te=!0,onEscape:x,isFavorite:S,onToggleFavorite:ne,renderRowEnd:re,onActiveKeyDown:ie,onActiveEntryChange:w,onVariantKey:T,onReorderFavorite:oe,reorderFavoriteAriaLabel:se,reorderFavoriteTitle:ce,providerOrder:E,onReorderProvider:D,reorderProviderTitle:k,footerContent:xe,renderVersion:Ce,tooltipsEnabled:Ee=!0})=>{let De=O.useRef(null);De.current||=Me();let j=De.current,Oe=O.useRef([]),ke=O.useRef(null),M=O.useRef(!1),P=O.useRef(null),F=Te(e=>e.collapsedSections),Le=Te(e=>e.toggleSection),ze=O.useMemo(()=>new Set(Object.keys(F).filter(e=>F[e])),[F]),I=i.trim().length>0,[Be,L]=O.useState(()=>new Set),R=I?Be:ze,Ve=ge(de(me,{activationConstraint:{distance:8}})),He=ge(de(pe,{activationConstraint:{distance:8}})),z=O.useMemo(()=>!u||u.length===0?null:new Set(u),[u]),Ue=O.useMemo(()=>d?new Map(Object.entries(d).map(([e,t])=>[e,new Set(t)])):null,[d]),B=O.useCallback((e,t)=>!Ue||Ue.get(e)?.has(t)===!0,[Ue]),V=O.useMemo(()=>new Map(e.map(e=>[e.id,e])),[e]),H=O.useCallback((e,t)=>l.some(n=>n.providerID===e&&n.modelID===t),[l]),U=O.useCallback((e,t)=>{let n=i.trim();return!n||we(`${t} ${e}`,n)},[i]),W=O.useMemo(()=>t.filter(({model:e,providerID:t,modelID:n})=>{if(z&&!z.has(t)||!B(t,n)||H(t,n))return!1;let r=V.get(t)?.name||t;return U(N(e),r)}),[z,t,B,H,U,V]),G=O.useMemo(()=>n.filter(({model:e,providerID:t,modelID:n})=>{if(z&&!z.has(t)||!B(t,n)||H(t,n))return!1;let r=V.get(t)?.name||t;return U(N(e),r)}),[z,B,H,U,V,n]),We=O.useMemo(()=>{if(!E||E.length===0)return e;let t=new Map(E.map((e,t)=>[e,t])),n=e.filter(e=>t.has(e.id)).sort((e,n)=>(t.get(e.id)??0)-(t.get(n.id)??0)),r=e.filter(e=>!t.has(e.id));return[...n,...r]},[E,e]),K=O.useMemo(()=>We.filter(e=>!z||z.has(e.id)).map(e=>{let t=(Array.isArray(e.models)?e.models:[]).filter(t=>{let n=typeof t.id==`string`?t.id:``;return!n||H(e.id,n)||!B(e.id,n)?!1:U(N(t),e.name||e.id)});return{...e,models:t}}).filter(e=>e.models.length>0),[z,B,H,U,We]),q=O.useMemo(()=>{let e=[];return R.has(`favorites`)||W.forEach(t=>e.push(t)),R.has(`recent`)||G.forEach(t=>e.push(t)),K.forEach(t=>{R.has(`provider:${t.id}`)||t.models.forEach(n=>e.push({model:n,providerID:t.id,modelID:n.id}))}),e},[R,W,K,G]),Ge=q.length>0,Ke=!!oe&&i.trim().length===0&&W.length>1,qe=!!D&&i.trim().length===0&&!z&&K.length>1,Je=O.useMemo(()=>new Map(W.map(e=>[`${e.providerID}:${e.modelID}`,e])),[W]);O.useEffect(()=>{j.set(0)},[i,j]),O.useEffect(()=>{I||L(e=>e.size===0?e:new Set)},[I]);let Ye=O.useCallback(e=>{j.set(e),w?.(q[e])},[q,w,j]),J=O.useCallback(e=>{let t=q.length;if(t===0)return;M.current=!0,P.current=null;let n=(j.getSnapshot()+e+t)%t;j.set(n),w?.(q[n]),requestAnimationFrame(()=>Re(ke.current,Oe.current[n]))},[q,w,j]);O.useEffect(()=>{w?.(q[j.getSnapshot()])},[q,w,j]);let Xe=O.useCallback(e=>{if(!e.defaultPrevented){if(e.stopPropagation(),e.key===`ArrowLeft`||e.key===`ArrowRight`){let t=q[j.getSnapshot()];if(t&&T?.(e,t))return}if(ie?.(e,q[j.getSnapshot()]),!e.defaultPrevented){if(e.key===`ArrowDown`){e.preventDefault(),J(1);return}if(e.key===`ArrowUp`){e.preventDefault(),J(-1);return}if(e.key===`Enter`){e.preventDefault();let t=q[j.getSnapshot()];t&&!g&&o(t);return}e.key===`Escape`&&(e.preventDefault(),x?.())}}},[g,q,J,ie,x,o,T,j]),Ze=p(`model-picker-section-header typography-micro font-semibold text-muted-foreground uppercase tracking-wider flex items-center gap-2 px-2 py-1.5`,ee&&`sticky top-0 z-10 [background:linear-gradient(var(--surface-elevated),var(--surface-elevated)),linear-gradient(var(--surface-background),var(--surface-background))]`,y),Y=0,X=(e,t,n,i,a)=>{let l=Se(e.providerID,e.model,r?.(e.providerID,e.modelID)),u=V.get(e.providerID)?.name||e.providerID,d=Ae(l?.limit?.context),f=h?.(e)??0,m=c?.providerID===e.providerID&&c.modelID===e.modelID,_=S?.(e)??!1,v=e=>{let t={x:e.clientX,y:e.clientY},n=P.current,r=!n||n.x!==t.x||n.y!==t.y;P.current=t,!(M.current&&!n)&&(M.current&&!r||(M.current&&r&&(M.current=!1),Ye(i)))};return(0,A.jsx)(Ne,{store:j,index:i,renderVersion:Ce,children:t=>{let r=(0,A.jsxs)(`div`,{ref:e=>{Oe.current[i]=e},role:`option`,"aria-selected":m,"aria-disabled":g||void 0,tabIndex:-1,onClick:()=>{g||o(e)},onKeyDown:t=>{g||(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),o(e))},onMouseEnter:v,onMouseMove:v,className:p(`w-full text-left px-2 py-1.5 rounded-md typography-meta flex items-center gap-2 cursor-pointer`,!g&&(t?`bg-interactive-selection`:`hover:bg-interactive-hover/50`),g&&`cursor-not-allowed opacity-60`,b),children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-1 min-w-0`,children:[a?(0,A.jsx)(`button`,{type:`button`,ref:a.setActivatorNodeRef,...a.attributes,...a.listeners,disabled:g,onClick:e=>{e.preventDefault(),e.stopPropagation()},className:`model-favorite-drag-handle flex size-4 flex-shrink-0 items-center justify-center text-muted-foreground hover:text-foreground disabled:pointer-events-none`,"aria-label":se,title:ce,children:(0,A.jsx)(C,{name:`draggable`,className:`size-3.5`})}):null,n?(0,A.jsx)(le,{modelId:e.modelID,providerId:e.providerID,className:`h-3.5 w-3.5 flex-shrink-0`}):null,(0,A.jsx)(`span`,{className:`font-medium truncate`,children:N(e.model)}),d?(0,A.jsx)(`span`,{className:`typography-micro text-muted-foreground flex-shrink-0`,children:d}):null]}),f>0?(0,A.jsxs)(`span`,{className:`typography-micro text-muted-foreground flex-shrink-0`,children:[`x`,f]}):null,re?.(e,{isHighlighted:t,isSelected:m}),m?(0,A.jsx)(C,{name:`check`,className:`h-4 w-4 text-primary flex-shrink-0`}):null,ne?(0,A.jsx)(`button`,{type:`button`,disabled:g,onClick:t=>{t.preventDefault(),t.stopPropagation(),ne(e)},className:p(`model-favorite-button flex h-4 w-4 items-center justify-center hover:text-primary/80 flex-shrink-0 disabled:pointer-events-none`,_?`text-primary`:`text-muted-foreground`),"aria-label":_?s.unfavorite:s.favorite,title:_?s.unfavorite:s.favorite,children:(0,A.jsx)(C,{name:_?`star-fill`:`star`,className:`h-3.5 w-3.5`})}):null]});return(0,A.jsx)(je,{metadata:l,providerName:u,providerID:e.providerID,modelID:e.modelID,active:Ee&&t,labels:s,children:r})}},`${t}-${e.providerID}-${e.modelID}`)},Qe=e=>{if(!oe)return;let{active:t,over:n}=e;if(!n||t.id===n.id)return;let r=Je.get(String(t.id)),i=Je.get(String(n.id));!r||!i||oe(r,i)},$e=e=>{if(!D)return;let{active:t,over:n}=e;if(!n||t.id===n.id)return;let r=We.map(e=>e.id),i=r.indexOf(String(t.id)),a=r.indexOf(String(n.id));i!==-1&&a!==-1&&D(_e(r,i,a))},Z=e=>R.has(e),et=e=>{if(!I){Le(e);return}L(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Q=(e,t,n,r)=>{let i=Z(e),a=t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),et(e))};return r?(0,A.jsxs)(`div`,{ref:r.setActivatorNodeRef,...r.attributes,...r.listeners,role:`button`,tabIndex:0,"aria-expanded":!i,title:k,className:p(Ze,`w-full text-left cursor-grab select-none active:cursor-grabbing`),onClick:()=>et(e),onKeyDown:a,children:[(0,A.jsx)(C,{name:`draggable`,className:`size-3.5 flex-shrink-0 text-muted-foreground/70`}),t,(0,A.jsx)(`span`,{className:`min-w-0 truncate`,children:n}),(0,A.jsx)(`span`,{className:`ml-auto flex size-4 flex-shrink-0 items-center justify-center text-muted-foreground`,children:(0,A.jsx)(C,{name:i?`arrow-right-s`:`arrow-down-s`,className:`size-4`})})]}):(0,A.jsxs)(`button`,{type:`button`,className:p(Ze,`w-full text-left cursor-pointer`),onClick:()=>et(e),"aria-expanded":!i,children:[t,(0,A.jsx)(`span`,{className:`min-w-0 truncate`,children:n}),(0,A.jsx)(`span`,{className:`ml-auto flex size-4 flex-shrink-0 items-center justify-center text-muted-foreground`,children:(0,A.jsx)(C,{name:i?`arrow-right-s`:`arrow-down-s`,className:`size-4`})})]})},tt=(e,t,n)=>(0,A.jsxs)(A.Fragment,{children:[t>0?(0,A.jsx)(`div`,{className:`h-px bg-border/40 my-1`}):null,Q(`provider:${e.id}`,(0,A.jsx)(ue,{providerId:e.id,className:`h-4 w-4 flex-shrink-0`}),e.name||e.id,n),Z(`provider:${e.id}`)?null:e.models.map(t=>X({model:t,providerID:e.id,modelID:t.id},`provider`,!0,Y++))]});return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:`p-1.5 pb-1`,children:(0,A.jsxs)(`div`,{className:`relative`,children:[(0,A.jsx)(C,{name:`search`,className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground`}),(0,A.jsx)(ae,{type:`text`,placeholder:s.searchPlaceholder,value:i,onChange:e=>a(e.target.value),onKeyDown:Xe,className:`model-picker-search h-8 pl-8 typography-meta`,autoFocus:te})]})}),(0,A.jsx)(be,{ref:ke,outerClassName:_,className:`overlay-scrollbar-target--no-gutter`,style:v,children:(0,A.jsxs)(`div`,{className:`px-1`,children:[f?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 typography-meta text-muted-foreground hover:bg-interactive-hover/50`,onClick:m,children:[(0,A.jsx)(C,{name:`close`,className:`h-3.5 w-3.5`}),(0,A.jsx)(`span`,{children:s.notSelected}),c?null:(0,A.jsx)(C,{name:`check`,className:`h-4 w-4 text-primary ml-auto`})]}),(0,A.jsx)(`div`,{className:`h-px bg-border/40 my-1`})]}):null,Ge?null:(0,A.jsx)(`div`,{className:`px-2 py-4 text-center typography-meta text-muted-foreground`,children:s.noResults}),W.length>0?(0,A.jsxs)(`div`,{children:[Q(`favorites`,(0,A.jsx)(C,{name:`star-fill`,className:`h-4 w-4 text-primary`}),s.favorites),!Z(`favorites`)&&(Ke?(0,A.jsx)(he,{sensors:Ve,collisionDetection:fe,onDragEnd:Qe,children:(0,A.jsx)(ye,{items:W.map(e=>`${e.providerID}:${e.modelID}`),strategy:ve,children:W.map(e=>{let t=Y++;return(0,A.jsx)(Fe,{id:`${e.providerID}:${e.modelID}`,disabled:g,children:n=>X(e,`fav`,!0,t,n)},`fav-sortable-${e.providerID}-${e.modelID}`)})})}):W.map(e=>X(e,`fav`,!0,Y++)))]}):null,G.length>0?(0,A.jsxs)(`div`,{children:[W.length>0?(0,A.jsx)(`div`,{className:`h-px bg-border/40 my-1`}):null,Q(`recent`,(0,A.jsx)(C,{name:`time`,className:`h-4 w-4`}),s.recent),Z(`recent`)?null:G.map(e=>X(e,`recent`,!0,Y++))]}):null,(W.length>0||G.length>0)&&K.length>0?(0,A.jsx)(`div`,{className:`h-px bg-border/40 my-1`}):null,qe?(0,A.jsx)(he,{sensors:He,collisionDetection:fe,onDragEnd:$e,children:(0,A.jsx)(ye,{items:K.map(e=>e.id),strategy:ve,children:K.map((e,t)=>(0,A.jsx)(Ie,{id:e.id,disabled:g,children:n=>tt(e,t,n)},e.id))})}):K.map((e,t)=>(0,A.jsx)(`div`,{children:tt(e,t)},e.id))]})}),(0,A.jsx)(`div`,{className:`px-3 pt-1 pb-1.5 border-t border-border/40 typography-micro text-muted-foreground`,children:(0,A.jsx)(Pe,{store:j,flatModelList:q,footerContent:xe,fallback:s.keyboardHint})})]})};function I(){}function Be(e){let{key:t,icon:n,label:r}=e;return(0,A.jsx)(j,{iconName:n,label:r},t)}function L(e,t,n,r,i){let a=e.find(e=>e.id===n);if(!a)return null;let o=(Array.isArray(a.models)?a.models:[]).find(e=>e.id===r);return!o||t.some(e=>e.providerID===n&&e.modelID===r)?null:i===void 0?{provider:a,model:o,providerID:n,modelID:r}:{provider:a,model:o,providerID:n,modelID:r,variant:i}}var R=e=>{let t=(0,k.c)(30),n=ee(Ve),r=c(He),i=c(z),a=c(Ue),o=e?.currentProviderID??null,s=e?.currentModelID??null,l;if(t[0]!==r||t[1]!==a||t[2]!==n){let e;t[4]!==a||t[5]!==n?(e=e=>{let{providerID:t,modelID:r,variant:i}=e;return L(n,a,t,r,i)},t[4]=a,t[5]=n,t[6]=e):e=t[6],l=r.map(e).filter(B),t[0]=r,t[1]=a,t[2]=n,t[3]=l}else l=t[3];let u=l,d;if(t[7]!==s||t[8]!==o||t[9]!==r||t[10]!==a||t[11]!==n||t[12]!==i){bb0:{let e;t[14]!==a||t[15]!==n?(e=e=>{let{providerID:t,modelID:r,variant:i}=e;return L(n,a,t,r,i)},t[14]=a,t[15]=n,t[16]=e):e=t[16];let c;t[17]===r?c=t[18]:(c=e=>{let{providerID:t,modelID:n}=e;return!r.some(e=>e.providerID===t&&e.modelID===n)},t[17]=r,t[18]=c);let l=i.map(e).filter(V).filter(c);if(!o||!s){d=l;break bb0}if(r.some(e=>e.providerID===o&&e.modelID===s)){d=l;break bb0}let u;t[19]!==s||t[20]!==o?(u=e=>e.providerID===o&&e.modelID===s,t[19]=s,t[20]=o,t[21]=u):u=t[21];let f=l.findIndex(u);if(f===0){d=l;break bb0}if(f>0){let e=l.slice(),[t]=e.splice(f,1);e.unshift(t),d=e;break bb0}let p;t[22]!==s||t[23]!==o||t[24]!==a||t[25]!==n?(p=L(n,a,o,s),t[22]=s,t[23]=o,t[24]=a,t[25]=n,t[26]=p):p=t[26];let m=p;if(!m){d=l;break bb0}d=[m,...l]}t[7]=s,t[8]=o,t[9]=r,t[10]=a,t[11]=n,t[12]=i,t[13]=d}else d=t[13];let f=d,p;return t[27]!==u||t[28]!==f?(p={favoriteModelsList:u,recentModelsList:f},t[27]=u,t[28]=f,t[29]=p):p=t[29],p};function Ve(e){return e.providers}function He(e){return e.favoriteModels}function z(e){return e.recentModels}function Ue(e){return e.hiddenModels}function B(e){return e!==null}function V(e){return e!==null}var H=e=>{if(!e)return``;let t=e.replace(/\\/g,`/`);return t===`/`?`/`:t.replace(/\/+$/,``)};async function U(e){let t=H(e),n=await w(t);return{isDirty:!n.isClean,ahead:n.ahead,behind:n.behind,upstream:n.tracking}}var W=6e4,G=500,We=1048576,K=new Map,q=new Map,Ge=0,Ke=(e,t)=>e.length+t.length,qe=(e,t)=>{K.delete(e),K.set(e,{root:t,resolvedAt:Date.now()});let n=0;for(let[e,t]of K)n+=Ke(e,t.root);for(;K.size>G||n>We&&K.size>1;){let e=K.entries().next().value;if(!e)break;n-=Ke(e[0],e[1].root),K.delete(e[0])}};function Je(e){if(Ge+=1,typeof e==`string`&&e){let t=H(e);K.delete(t),q.delete(t);return}K.clear(),q.clear()}var Ye=async e=>re(e).catch(()=>e),J=async e=>{let t=K.get(e);if(t&&Date.now()-t.resolvedAt<W)return K.delete(e),K.set(e,t),t.root;t&&K.delete(e);let n=q.get(e);if(n)return n;let r=Ge,i=Ye(e).then(t=>(Ge===r&&qe(e,t),t)).catch(()=>e).finally(()=>{q.get(e)===i&&q.delete(e)});return q.set(e,i),i};async function Xe(e,t){let n=H(e);if(!n)return`HEAD`;try{let e=await J(n).catch(()=>n),r=t?.knownBranch?.trim();if(r&&e===n)return r;let i=await w(e);return(typeof i.current==`string`?i.current.trim():``)||`HEAD`}catch{return`HEAD`}}var Ze=e=>{let t=(e.branch||``).trim(),n=(e.head||``).trim();return t?`branch`:n?`detached`:`unborn`},Y=(e,t)=>({worktreeRoot:t,worktreeStatus:`ready`,headState:Ze(e),worktreeSource:`existing`}),X=e=>{let t=e.replace(/\\/g,`/`);return t===`/`?`/`:t.length>1?t.replace(/\/+$/,``):t},Qe=e=>e.trim().replace(/^refs\/heads\//,``).replace(/^heads\//,``).replace(/\s+/g,`-`).replace(/^\/+|\/+$/g,``).split(`/`).join(`-`).replace(/[^A-Za-z0-9._-]+/g,`-`).replace(/-+/g,`-`).replace(/^-+|-+$/g,``).slice(0,80),$e=e=>e.trim().replace(/^refs\/heads\//,``).replace(/^heads\//,``).replace(/\s+/g,`-`).replace(/^\/+|\/+$/g,``),Z=(e,t)=>{let n=X(e);n&&x.setState(e=>{let r=!1,i=e=>X(e.path)!==n||e.worktreeStatus===t?e:(r=!0,{...e,worktreeStatus:t}),a=e.availableWorktrees,o=!1,s=e.availableWorktrees.map(e=>{let t=i(e);return t!==e&&(o=!0),t});o&&(a=s);let c=e.availableWorktreesByProject;for(let[t,n]of e.availableWorktreesByProject){let r=!1,a=n.map(e=>{let t=i(e);return t!==e&&(r=!0),t});r&&(c===e.availableWorktreesByProject&&(c=new Map(e.availableWorktreesByProject)),c.set(t,a))}let l=e.worktreeMetadata;for(let[t,n]of e.worktreeMetadata){let r=i(n);r!==n&&(l===e.worktreeMetadata&&(l=new Map(e.worktreeMetadata)),l.set(t,r))}return r?{availableWorktrees:a,availableWorktreesByProject:c,worktreeMetadata:l}:{}})},et=e=>e?.status===`pending`?`pending`:e?.status===`failed`?`invalid`:`ready`,Q=e=>{let t=X(e),n=t.split(`/`).filter(Boolean);return n[n.length-1]??t},tt=e=>{let t=[];for(let n of e.setupCommands){let r=n.trim();r&&t.push(y(r,{rootWorktreePath:e.projectDirectory}))}let n=t.filter(Boolean).join(` && `);return n.trim().length>0?n:void 0},nt=(e,t)=>{let n=e.mode===`existing`?`existing`:`new`,r=Qe(e.worktreeName??e.preferredName??``),i=$e(e.branchName??(n===`new`?e.preferredName:void 0)??``),a=$e(e.existingBranch??e.branchName??``),o=(e.startRef||``).trim(),s=tt({projectDirectory:t,setupCommands:Array.isArray(e.setupCommands)?e.setupCommands:[]});return{mode:n,...r?{worktreeName:r}:{},...i?{branchName:i}:{},...a?{existingBranch:a}:{},...o?{startRef:o}:{},...s?{startCommand:s}:{},...e.setUpstream?{setUpstream:!0}:{},...e.upstreamRemote?{upstreamRemote:e.upstreamRemote}:{},...e.upstreamBranch?{upstreamBranch:e.upstreamBranch}:{},...e.ensureRemoteName?{ensureRemoteName:e.ensureRemoteName}:{},...e.ensureRemoteUrl?{ensureRemoteUrl:e.ensureRemoteUrl}:{},...e.returnAfterDirectoryCreated?{returnAfterDirectoryCreated:!0}:{}}},rt=(e,t)=>{if(e.size!==t.size)return!1;for(let[n,r]of e){let e=t.get(n);if(!e||e.length!==r.length)return!1;for(let t=0;t<r.length;t++){let n=r[t],i=e[t];if(n.path!==i.path||n.branch!==i.branch||n.name!==i.name||n.label!==i.label||n.projectDirectory!==i.projectDirectory||n.worktreeRoot!==i.worktreeRoot||n.headState!==i.headState||n.worktreeSource!==i.worktreeSource||n.source!==i.source)return!1}}return!0},it=new Map,at=new Map,ot=new Map,st=3e4,ct=e=>`${t()}\u0000${X(e)}`,lt=(e,t=ct(e))=>ot.get(t)??0,ut=e=>{let t=ct(e);ot.set(t,lt(e)+1),it.delete(t)},dt=async e=>{let t=await J(e).catch(()=>e),n=X(e);return(await T.worktree.list(e)).filter(e=>typeof e.path==`string`&&e.path.trim().length>0).map(e=>{let n=X(e.path),r=(e.branch||``).replace(/^refs\/heads\//,``).trim(),i=(e.name||``).trim(),a=Y(e,n);return{source:`sdk`,name:i||Q(n),path:n,projectDirectory:t,branch:r,label:r||i||Q(n),worktreeRoot:a.worktreeRoot,worktreeStatus:a.worktreeStatus,headState:a.headState,worktreeSource:a.worktreeSource}}).filter(e=>X(e.path)!==n).sort((e,t)=>{let n=(e.label||e.branch||e.path).toLowerCase(),r=(t.label||t.branch||t.path).toLowerCase();return n.localeCompare(r)})},ft=async(e,n,r)=>{for(;;){let i=lt(e,n),a=await dt(e);if(i===lt(e,n))return r===t()&&it.set(n,{value:a,at:Date.now()}),a}};async function pt(e){let n=X(e.path),r=t(),i=`${r}\u0000${n}`,a=it.get(i);if(a&&Date.now()-a.at<st)return a.value;let o=at.get(i);if(o)return o;let s=ft(n,i,r).finally(()=>{at.get(i)===s&&at.delete(i)});return at.set(i,s),s}var mt=(e,t)=>{let n=v(e.path),r=n?.status===`pending`?`pending`:n?.status===`failed`?`invalid`:t?.worktreeStatus;return r&&r!==e.worktreeStatus?{...e,worktreeStatus:r}:e},ht=e=>{let t=new Set([...e].map(X));if(t.size===0)return;let n=x.getState().worktreeMetadata,r=new Map(n);for(let[e,i]of n)t.has(X(i.path))&&r.delete(e);for(let[e,n]of ne.getState().attachments){let r=typeof n.worktreeRoot==`string`&&n.worktreeRoot.trim()?X(n.worktreeRoot):``,i=typeof n.cwd==`string`&&n.cwd.trim()?X(n.cwd):``;(r&&t.has(r)||i&&t.has(i))&&ne.getState().clearAttachment(e)}r.size!==n.size&&x.setState({worktreeMetadata:r})};async function gt(e,t={}){let n=X(e.path);ut(n);let r=await pt({...e,path:n});if(t.isCurrent&&!t.isCurrent())return{worktrees:r,addedDirectories:[],removedDirectories:[]};let i=r,a=[],o=[];return x.setState(e=>{let t=e.availableWorktreesByProject,s=t.get(n)??[],c=new Map(s.map(e=>[X(e.path),e])),l=r.map(e=>mt(e,c.get(X(e.path)))),u=new Set(l.map(e=>X(e.path)));if(a=l.filter(e=>!c.has(X(e.path))).map(e=>e.path),o=s.filter(e=>!u.has(X(e.path))).map(e=>e.path),i=l,s.length===l.length&&s.every((e,t)=>{let n=l[t];return n&&e.path===n.path&&e.branch===n.branch&&e.name===n.name&&e.label===n.label&&e.projectDirectory===n.projectDirectory&&e.worktreeRoot===n.worktreeRoot&&e.headState===n.headState&&e.worktreeSource===n.worktreeSource&&e.source===n.source&&e.worktreeStatus===n.worktreeStatus}))return{};let d=new Map(t);return d.set(n,l),{availableWorktreesByProject:d,availableWorktrees:[...d.values()].flat()}}),ht(o),{worktrees:i,addedDirectories:a,removedDirectories:o}}async function _t(e,t){let n=X(e.path),r=await J(n).catch(()=>n),i=nt(t,n),a=await T.worktree.create(n,i),o=typeof a?.name==`string`?a.name:``,s=typeof a?.branch==`string`?a.branch:``,c=typeof a?.path==`string`?a.path:``;if(!o||!c)throw Error(`Worktree create missing name/path`);let l={source:`sdk`,name:o,path:X(c),projectDirectory:r,branch:s,label:s||o,worktreeRoot:X(c),worktreeStatus:et(a?.bootstrapStatus),headState:s?`branch`:`unborn`,worktreeSource:`created-for-session`};a?.bootstrapStatus?h(l.path,a.bootstrapStatus):te(l.path),b(l.path,{onFailed:()=>Z(l.path,`invalid`),onReady:()=>Z(l.path,`ready`)}),ut(n),Je();let u=n;return x.setState(e=>{let t=new Map(e.availableWorktreesByProject),n=t.get(u)??[];return t.set(u,[...n.filter(e=>X(e.path)!==l.path),l]),{availableWorktreesByProject:t,availableWorktrees:[...t.values()].flat()}}),l}async function vt(e,t){let n=e.path,r=nt(t,n);return T.worktree.validate(n,r)}async function yt(e,t,n){let r=X(e.path),i=!!n?.deleteRemoteBranch,a=n?.deleteLocalBranch===!0,o=n?.remoteName;if(!(await T.worktree.remove(r,{directory:t.path,deleteLocalBranch:a}))?.success)throw Error(`Worktree removal failed`);g(t.path),ut(X(e.path)),Je();let s=X(t.path),c=r,l=x.getState().availableWorktreesByProject,u=new Map(l),d=u.get(c)??[];u.set(c,d.filter(e=>X(e.path)!==s)),ht([s]),x.setState({availableWorktreesByProject:u,availableWorktrees:x.getState().availableWorktrees.filter(e=>X(e.path)!==s)});let f=(t.branch||``).replace(/^refs\/heads\//,``).trim();i&&f&&await ie(r,{branch:f,remote:o}).catch(()=>void 0)}var bt=200,$=new Map,xt=[{key:`code`,Icon:`code-box`,label:`Code`},{key:`terminal`,Icon:`terminal-box`,label:`Terminal`},{key:`rocket`,Icon:`rocket`,label:`Rocket`},{key:`flask`,Icon:`flask`,label:`Lab`},{key:`gamepad`,Icon:`gamepad`,label:`Game`},{key:`briefcase`,Icon:`briefcase`,label:`Work`},{key:`home`,Icon:`home`,label:`Home`},{key:`globe`,Icon:`global`,label:`Web`},{key:`leaf`,Icon:`leaf`,label:`Nature`},{key:`shield`,Icon:`shield`,label:`Security`},{key:`palette`,Icon:`palette`,label:`Design`},{key:`server`,Icon:`server`,label:`Server`},{key:`phone`,Icon:`smartphone`,label:`Mobile`},{key:`database`,Icon:`database-2`,label:`Data`},{key:`lightbulb`,Icon:`lightbulb`,label:`Idea`},{key:`music`,Icon:`music`,label:`Music`},{key:`camera`,Icon:`camera`,label:`Media`},{key:`book`,Icon:`book-open`,label:`Docs`},{key:`heart`,Icon:`heart`,label:`Favorite`}],St=Object.fromEntries(xt.map(e=>[e.key,e.Icon])),Ct=[{key:`keyword`,label:`Purple`,cssVar:`var(--syntax-keyword)`},{key:`string`,label:`Green`,cssVar:`var(--syntax-string)`},{key:`number`,label:`Pink`,cssVar:`var(--syntax-number)`},{key:`type`,label:`Gold`,cssVar:`var(--syntax-type)`},{key:`constant`,label:`Cyan`,cssVar:`var(--syntax-constant)`},{key:`comment`,label:`Muted`,cssVar:`var(--syntax-comment)`},{key:`error`,label:`Red`,cssVar:`var(--status-error)`},{key:`primary`,label:`Blue`,cssVar:`var(--primary)`},{key:`success`,label:`Green`,cssVar:`var(--status-success)`}],wt=Object.fromEntries(Ct.map(e=>[e.key,e.cssVar])),Tt=(e,t)=>{if(typeof e!=`number`||e<=0)return null;let n=new URLSearchParams({v:String(e)});return typeof t?.iconColor==`string`&&t.iconColor.trim()&&n.set(`iconColor`,t.iconColor.trim()),(t?.themeVariant===`light`||t?.themeVariant===`dark`)&&n.set(`theme`,t.themeVariant),n},Et=(e,t)=>e?[n()||`same-origin`,e,t.toString()].join(`|`):null,Dt=(e,t,n)=>{let r=Tt(t,n);if(!r)return null;let i=Et(e,r);return i?{cacheKey:i,projectId:e,query:r}:null},Ot=()=>{for(;$.size>bt;){let e=$.keys().next().value;if(typeof e!=`string`)return;let t=$.get(e);t?.url&&typeof URL<`u`&&typeof URL.revokeObjectURL==`function`&&URL.revokeObjectURL(t.url),$.delete(e)}},kt=e=>{let t=$.get(e.cacheKey);if(t?.url)return Promise.resolve(t.url);if(t?.promise)return t.promise;let n=r(`/api/projects/${encodeURIComponent(e.projectId)}/icon`,{method:`GET`,headers:{Accept:`image/*`},query:e.query}).then(async t=>{if(!t.ok||typeof URL>`u`||typeof URL.createObjectURL!=`function`)return null;let n=await t.blob(),r=URL.createObjectURL(n);return $.set(e.cacheKey,{url:r}),Ot(),r}).catch(()=>null).finally(()=>{let t=$.get(e.cacheKey);t?.promise===n&&!t.url&&$.delete(e.cacheKey)});return $.set(e.cacheKey,{promise:n}),n},At=(e,t)=>{let n=(0,k.c)(10),r=e.id,i=e.iconImage?.updatedAt,a=t?.themeVariant,o=t?.iconColor,s;n[0]!==o||n[1]!==r||n[2]!==a||n[3]!==i?(s=Dt(r,i,{themeVariant:a,iconColor:o}),n[0]=o,n[1]=r,n[2]=a,n[3]=i,n[4]=s):s=n[4];let c=s,l;n[5]===c?l=n[6]:(l=()=>c?$.get(c.cacheKey)?.url??null:null,n[5]=c,n[6]=l);let[u,d]=O.useState(l),f,p;return n[7]===c?(f=n[8],p=n[9]):(f=()=>{if(!c){d(null);return}let e=$.get(c.cacheKey)?.url;if(e){d(e);return}let t=!1;return d(null),kt(c).then(e=>{t||d(e)}),()=>{t=!0}},p=[c],n[7]=c,n[8]=f,n[9]=p),O.useEffect(f,p),u},jt=e=>{let t=(0,k.c)(21),{project:n,options:r,className:i,alt:a,draggable:o,fallback:s,onError:c}=e,l=a===void 0?``:a,u=o!==void 0&&o,d=s===void 0?null:s,f=At(n,r),[p,m]=O.useState(!1),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>{m(!1)},t[0]=h):h=t[0];let g=n.iconImage?.updatedAt,_;if(t[1]!==n.id||t[2]!==f||t[3]!==g?(_=[f,n.id,g],t[1]=n.id,t[2]=f,t[3]=g,t[4]=_):_=t[4],O.useEffect(h,_),!f||p){let e;return t[5]===d?e=t[6]:(e=O.createElement(O.Fragment,null,d),t[5]=d,t[6]=e),e}let v;if(t[7]!==l||t[8]!==i||t[9]!==u||t[10]!==c||t[11]!==f){let e;t[13]===c?e=t[14]:(e=e=>{m(!0),c?.(e)},t[13]=c,t[14]=e);let n;t[15]!==l||t[16]!==i||t[17]!==u||t[18]!==f||t[19]!==e?(n={src:f,alt:l,className:i,draggable:u,onError:e},t[15]=l,t[16]=i,t[17]=u,t[18]=f,t[19]=e,t[20]=n):n=t[20],v=O.createElement(`img`,n),t[7]=l,t[8]=i,t[9]=u,t[10]=c,t[11]=f,t[12]=v}else v=t[12];return v};export{Se as _,jt as a,pt as c,rt as d,Xe as f,we as g,ze as h,St as i,yt as l,R as m,wt as n,_t as o,U as p,xt as r,gt as s,Ct as t,vt as u};
|