@openchambery/web 1.19.0-beta.22 → 1.19.0-beta.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/dist/assets/AgentAvatar-Dn37YqCC.js +1 -0
  2. package/dist/assets/{AssistantView-COjPqVYN.js → AssistantView-qaLWiFqg.js} +1 -1
  3. package/dist/assets/{ChatContainer-1UfTcM7y.js → ChatContainer-iztQ9VXj.js} +39 -41
  4. package/dist/assets/{ContextPanel-DqFjhkep.js → ContextPanel-BP4TZoMD.js} +11 -11
  5. package/dist/assets/{DiagramView-DTLmw9aQ.js → DiagramView-CAYxRLbQ.js} +1 -1
  6. package/dist/assets/{Icon-BAf2hhrw.js → Icon-Bs6GJIoO.js} +1 -1
  7. package/dist/assets/{MarkdownRendererImpl-DtDXVNL0.js → MarkdownRendererImpl-BRhz3S3H.js} +1 -1
  8. package/dist/assets/{MobileDetailNavigation-Cra616TS.js → MobileDetailNavigation-OP5_lnGU.js} +1 -1
  9. package/dist/assets/{MobileShareBridge-CYfJx34q.js → MobileShareBridge-DN6nr04u.js} +1 -1
  10. package/dist/assets/{MobileSurface-Cy_ouvVc.js → MobileSurface-usfqXmNR.js} +1 -1
  11. package/dist/assets/{MultiRunWindow-DVs6MZjv.js → MultiRunWindow-3v58Oysn.js} +1 -1
  12. package/dist/assets/{OnboardingScreen-CzxsmiJZ.js → OnboardingScreen-DRd1uYCr.js} +1 -1
  13. package/dist/assets/OverlayScrollbar-VZKKu-cu.js +2 -0
  14. package/dist/assets/{SettingsView-C1KgXp3x.js → SettingsView-Dd9PcmFb.js} +8 -8
  15. package/dist/assets/{SettingsWindow-BkiQFX0S.js → SettingsWindow-CdlQVVmH.js} +1 -1
  16. package/dist/assets/{TerminalView-CL9PoqxQ.js → TerminalView-DPjUCSDx.js} +1 -1
  17. package/dist/assets/{ToolOutputDialog-z6vyx5bl.js → ToolOutputDialog-CBVYymgq.js} +4 -4
  18. package/dist/assets/appThemeRegistry-RVZC3F7t.js +2 -0
  19. package/dist/assets/{clipboard-DyCy8o-j.js → clipboard-C7zcAKyC.js} +1 -1
  20. package/dist/assets/dialog-BUQDNX62.js +1 -0
  21. package/dist/assets/{es-L71xM_T9.js → es-CcbKrwi9.js} +1 -1
  22. package/dist/assets/{fr-DDeqVFFE.js → fr-D1YIDHP6.js} +1 -1
  23. package/dist/assets/{gitApi-BZs3g7kL.js → gitApi-CgA3koXa.js} +1 -1
  24. package/dist/assets/insertionBoundaries-DjMSISrk.js +4 -0
  25. package/dist/assets/{ja-Cb5UuJfO.js → ja-xE7L_-ZU.js} +1 -1
  26. package/dist/assets/{ko-BOQuwJW9.js → ko-QUUzIgbd.js} +1 -1
  27. package/dist/assets/{main-DVpZG9sL.js → main-BV-VRQtF.js} +2 -2
  28. package/dist/assets/{main-BIT8b73F.js → main-s_-Yui9S.js} +6 -6
  29. package/dist/assets/{miniChat-DQDvDpWt.js → miniChat-BiMipmeC.js} +2 -2
  30. package/dist/assets/{mobile-BJPgbqSO.js → mobile-6jfLITIP.js} +2 -2
  31. package/dist/assets/multirun-DC56R4Nz.js +4 -0
  32. package/dist/assets/{pl-CPR51X8e.js → pl-BQfz-_HE.js} +1 -1
  33. package/dist/assets/platform-ulFAVx1H.js +2 -0
  34. package/dist/assets/projectMeta-uCFBN0nt.js +3 -0
  35. package/dist/assets/{pt-BR-CCmlB4Wg.js → pt-BR-DaY3UW5q.js} +1 -1
  36. package/dist/assets/radio-BnCqxqRY.js +1 -0
  37. package/dist/assets/{renderElectronMiniChatApp-jaPPkkBN.js → renderElectronMiniChatApp-CyVwuICo.js} +2 -2
  38. package/dist/assets/renderMobileApp-BxBPBVuW.js +23 -0
  39. package/dist/assets/{runtimeConfig-X9sNIE9W.js → runtimeConfig-B2fiijyg.js} +1 -1
  40. package/dist/assets/{runtimeEndpointReset-D-MaZgY5.js → runtimeEndpointReset-Dgl79r45.js} +2 -2
  41. package/dist/assets/{shikiHighlight-DZ1bj7ag.js → shikiHighlight-cPXGiU_j.js} +1 -1
  42. package/dist/assets/{sortable-tabs-strip-C_ZQ75rK.js → sortable-tabs-strip-COl2MAH7.js} +1 -1
  43. package/dist/assets/{src-Brv0DCpZ.css → src-CQbD3-_X.css} +1 -1
  44. package/dist/assets/{store--ZgdDfa2.js → store-upwbPNfx.js} +2 -2
  45. package/dist/assets/{terminalApi-B36I-z14.js → terminalApi-HsIEks5U.js} +1 -1
  46. package/dist/assets/{uk-DWxkhZMt.js → uk-yWcUag_v.js} +1 -1
  47. package/dist/assets/{useAppFontEffects-C6Ghp0AX.js → useAppFontEffects-DprVScfM.js} +2 -2
  48. package/dist/assets/{useDesktopWindowControlsLayout-Cyxd6emd.js → useDesktopWindowControlsLayout-C-DuuXvA.js} +1 -1
  49. package/dist/assets/{useEffectiveDirectory-FcGKsobh.js → useEffectiveDirectory-CDvGJgR0.js} +1 -1
  50. package/dist/assets/{useFontPreferences-D9h4M7x4.js → useFontPreferences-DaFspdDd.js} +1 -1
  51. package/dist/assets/{useMobileNavigationStore-DkBMOv1J.js → useMobileNavigationStore-B60AlvAU.js} +8 -8
  52. package/dist/assets/{useSessionAutoCleanup-CbBIekcM.js → useSessionAutoCleanup-CnYnihYW.js} +1 -1
  53. package/dist/assets/{useWorkerHighlightedLines-CwQpUpt5.js → useWorkerHighlightedLines-DD1XE7Yk.js} +1 -1
  54. package/dist/assets/{zh-CN-CnBbxYt8.js → zh-CN-jktTX6F0.js} +1 -1
  55. package/dist/assets/{zh-TW-B6McpMc8.js → zh-TW-DS3LNe1V.js} +1 -1
  56. package/dist/index.html +5 -5
  57. package/dist/mini-chat.html +5 -5
  58. package/dist/mobile.html +5 -5
  59. package/package.json +1 -1
  60. package/dist/assets/AgentAvatar-CWn_73qY.js +0 -1
  61. package/dist/assets/OverlayScrollbar-DEM7AQRU.js +0 -2
  62. package/dist/assets/appThemeRegistry-h64RD_n6.js +0 -2
  63. package/dist/assets/dialog-BpUGcA8h.js +0 -1
  64. package/dist/assets/insertionBoundaries-B9vsqCQ4.js +0 -1
  65. package/dist/assets/multirun-CWV76MQl.js +0 -4
  66. package/dist/assets/platform-DxNH_0Fj.js +0 -2
  67. package/dist/assets/projectMeta-Ct-WdvZL.js +0 -3
  68. package/dist/assets/radio-C2gxi0gx.js +0 -1
  69. package/dist/assets/renderMobileApp-CVVQmLPI.js +0 -23
package/dist/index.html CHANGED
@@ -552,7 +552,7 @@
552
552
  opacity: 0.72;
553
553
  }
554
554
  </style>
555
- <script type="module" crossorigin src="/assets/main-DVpZG9sL.js"></script>
555
+ <script type="module" crossorigin src="/assets/main-BV-VRQtF.js"></script>
556
556
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-C0FnF6B9.js">
557
557
  <link rel="modulepreload" crossorigin href="/assets/vendor-base-ui-CnHfUmDN.js">
558
558
  <link rel="modulepreload" crossorigin href="/assets/vendor-zustand-B4dlGEM2.js">
@@ -565,12 +565,12 @@
565
565
  <link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-B9S0Rp5s.js">
566
566
  <link rel="modulepreload" crossorigin href="/assets/vendor-opencode-sdk-C07HQypa.js">
567
567
  <link rel="modulepreload" crossorigin href="/assets/vendor-aparajita-capacitor-secure-storage-CjQdwfjS.js">
568
- <link rel="modulepreload" crossorigin href="/assets/platform-DxNH_0Fj.js">
569
- <link rel="modulepreload" crossorigin href="/assets/terminalApi-B36I-z14.js">
568
+ <link rel="modulepreload" crossorigin href="/assets/platform-ulFAVx1H.js">
569
+ <link rel="modulepreload" crossorigin href="/assets/terminalApi-HsIEks5U.js">
570
570
  <link rel="modulepreload" crossorigin href="/assets/types-BuiqMmh_.js">
571
571
  <link rel="modulepreload" crossorigin href="/assets/capgoAdapter-DCowZ2ab.js">
572
- <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-X9sNIE9W.js">
573
- <link rel="stylesheet" crossorigin href="/assets/src-Brv0DCpZ.css">
572
+ <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-B2fiijyg.js">
573
+ <link rel="stylesheet" crossorigin href="/assets/src-CQbD3-_X.css">
574
574
  </head>
575
575
  <body class="h-full bg-background text-foreground">
576
576
  <!-- Keep the startup layer outside #root. React replaces every child of
@@ -74,7 +74,7 @@
74
74
  }
75
75
  </style>
76
76
 
77
- <script type="module" crossorigin src="/assets/miniChat-DQDvDpWt.js"></script>
77
+ <script type="module" crossorigin src="/assets/miniChat-BiMipmeC.js"></script>
78
78
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-C0FnF6B9.js">
79
79
  <link rel="modulepreload" crossorigin href="/assets/vendor-base-ui-CnHfUmDN.js">
80
80
  <link rel="modulepreload" crossorigin href="/assets/vendor-zustand-B4dlGEM2.js">
@@ -87,12 +87,12 @@
87
87
  <link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-B9S0Rp5s.js">
88
88
  <link rel="modulepreload" crossorigin href="/assets/vendor-opencode-sdk-C07HQypa.js">
89
89
  <link rel="modulepreload" crossorigin href="/assets/vendor-aparajita-capacitor-secure-storage-CjQdwfjS.js">
90
- <link rel="modulepreload" crossorigin href="/assets/platform-DxNH_0Fj.js">
91
- <link rel="modulepreload" crossorigin href="/assets/terminalApi-B36I-z14.js">
90
+ <link rel="modulepreload" crossorigin href="/assets/platform-ulFAVx1H.js">
91
+ <link rel="modulepreload" crossorigin href="/assets/terminalApi-HsIEks5U.js">
92
92
  <link rel="modulepreload" crossorigin href="/assets/types-BuiqMmh_.js">
93
93
  <link rel="modulepreload" crossorigin href="/assets/capgoAdapter-DCowZ2ab.js">
94
- <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-X9sNIE9W.js">
95
- <link rel="stylesheet" crossorigin href="/assets/src-Brv0DCpZ.css">
94
+ <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-B2fiijyg.js">
95
+ <link rel="stylesheet" crossorigin href="/assets/src-CQbD3-_X.css">
96
96
  </head>
97
97
  <body class="h-full bg-background text-foreground">
98
98
  <div id="root" class="h-full">
package/dist/mobile.html CHANGED
@@ -63,7 +63,7 @@
63
63
  })();
64
64
  </script>
65
65
 
66
- <script type="module" crossorigin src="/assets/mobile-BJPgbqSO.js"></script>
66
+ <script type="module" crossorigin src="/assets/mobile-6jfLITIP.js"></script>
67
67
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-C0FnF6B9.js">
68
68
  <link rel="modulepreload" crossorigin href="/assets/vendor-base-ui-CnHfUmDN.js">
69
69
  <link rel="modulepreload" crossorigin href="/assets/vendor-zustand-B4dlGEM2.js">
@@ -76,12 +76,12 @@
76
76
  <link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-B9S0Rp5s.js">
77
77
  <link rel="modulepreload" crossorigin href="/assets/vendor-opencode-sdk-C07HQypa.js">
78
78
  <link rel="modulepreload" crossorigin href="/assets/vendor-aparajita-capacitor-secure-storage-CjQdwfjS.js">
79
- <link rel="modulepreload" crossorigin href="/assets/platform-DxNH_0Fj.js">
80
- <link rel="modulepreload" crossorigin href="/assets/terminalApi-B36I-z14.js">
79
+ <link rel="modulepreload" crossorigin href="/assets/platform-ulFAVx1H.js">
80
+ <link rel="modulepreload" crossorigin href="/assets/terminalApi-HsIEks5U.js">
81
81
  <link rel="modulepreload" crossorigin href="/assets/types-BuiqMmh_.js">
82
82
  <link rel="modulepreload" crossorigin href="/assets/capgoAdapter-DCowZ2ab.js">
83
- <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-X9sNIE9W.js">
84
- <link rel="stylesheet" crossorigin href="/assets/src-Brv0DCpZ.css">
83
+ <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-B2fiijyg.js">
84
+ <link rel="stylesheet" crossorigin href="/assets/src-CQbD3-_X.css">
85
85
  </head>
86
86
  <body class="h-full bg-background text-foreground">
87
87
  <div id="root" class="h-full"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openchambery/web",
3
- "version": "1.19.0-beta.22",
3
+ "version": "1.19.0-beta.25",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./server/index.js",
@@ -1 +0,0 @@
1
- import"./rolldown-runtime-C0FnF6B9.js";import{nt as e,rt as t}from"./vendor-base-ui-CnHfUmDN.js";import{n}from"./vendor-react-DLPElpoQ.js";import{t as r}from"./utils-CJdWZupK.js";t();var i=n(),a=[{var:`--status-success`,class:`agent-success`},{var:`--syntax-keyword`,class:`agent-keyword`},{var:`--syntax-type`,class:`agent-type`},{var:`--syntax-function`,class:`agent-function`},{var:`--syntax-number`,class:`agent-number`},{var:`--status-info`,class:`agent-info`},{var:`--status-warning`,class:`agent-warning`},{var:`--syntax-variable`,class:`agent-variable`}];function o(e){if(!e||e===`build`)return a[0];let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t=(t<<5)-t+r,t&=t}return a[1+Math.abs(t)%(a.length-1)]}var s=5,c=Math.ceil(s/2);function l(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return t>>>0}function u(e){let t=Array.from({length:s},()=>Array.from({length:s},()=>!1));if(!e)return t;let n=l(e);for(let e=0;e<s;e++)for(let r=0;r<c;r++){let i=(n&1)==1;n>>>=1,t[e][r]=i,t[e][4-r]=i}return t}var d=e(),f=e=>{let t=(0,i.c)(27),{name:n,emoji:a,size:s,className:c,label:l}=e,f=s===void 0?16:s,m,h,g;if(t[0]!==c||t[1]!==a||t[2]!==n){m=o(n);let e;t[6]===n?e=t[7]:(e=u(n),t[6]=n,t[7]=e),h=e,g=r(`inline-flex aspect-square shrink-0 overflow-hidden rounded-sm`,a&&`items-center justify-center select-none`,m.class,c),t[0]=c,t[1]=a,t[2]=n,t[3]=m,t[4]=h,t[5]=g}else m=t[3],h=t[4],g=t[5];let _=`calc(${f}px * var(--dpt-n, 1))`,v=`calc(${f}px * var(--dpt-n, 1))`,y=`calc(${f}px * var(--dpt-n, 1))`,b=`calc(${f}px * var(--dpt-n, 1))`,x=`calc(${f}px * var(--dpt-n, 1))`,S=`calc(${f}px * var(--dpt-n, 1))`,C=`var(${m.var})`,w;t[8]!==_||t[9]!==v||t[10]!==y||t[11]!==b||t[12]!==x||t[13]!==S||t[14]!==C?(w={width:_,minWidth:v,maxWidth:y,height:b,minHeight:x,maxHeight:S,color:C},t[8]=_,t[9]=v,t[10]=y,t[11]=b,t[12]=x,t[13]=S,t[14]=C,t[15]=w):w=t[15];let T=l?`img`:void 0,E=!l||void 0,D;t[16]!==a||t[17]!==h||t[18]!==f?(D=a?(0,d.jsx)(`span`,{"aria-hidden":`true`,style:{fontSize:`calc(${f*.75}px * var(--dpt-n, 1))`,lineHeight:1},children:a}):(0,d.jsxs)(`svg`,{width:f,height:f,viewBox:`0 0 5 5`,shapeRendering:`crispEdges`,className:`oc-agent-avatar block h-full w-full`,"aria-hidden":`true`,children:[(0,d.jsx)(`rect`,{width:`5`,height:`5`,fill:`currentColor`,opacity:.14}),h.map(p)]}),t[16]=a,t[17]=h,t[18]=f,t[19]=D):D=t[19];let O;return t[20]!==l||t[21]!==w||t[22]!==T||t[23]!==E||t[24]!==D||t[25]!==g?(O=(0,d.jsx)(`span`,{className:g,style:w,role:T,"aria-label":l,"aria-hidden":E,children:D}),t[20]=l,t[21]=w,t[22]=T,t[23]=E,t[24]=D,t[25]=g,t[26]=O):O=t[26],O};function p(e,t){return e.map((e,n)=>e?(0,d.jsx)(`rect`,{x:n,y:t,width:`1`,height:`1`,fill:`currentColor`},`${n}-${t}`):null)}export{o as n,f as t};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-aparajita-capacitor-secure-storage-CjQdwfjS.js","assets/rolldown-runtime-C0FnF6B9.js"])))=>i.map(i=>d[i]);
2
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{$t as t,Xt as n}from"./persistence-aCOlo6ew.js";import{nt as r,rt as i}from"./vendor-base-ui-CnHfUmDN.js";import{n as a}from"./platform-DxNH_0Fj.js";import{o}from"./vendor-aparajita-capacitor-secure-storage-CjQdwfjS.js";import{n as s}from"./vendor-react-DLPElpoQ.js";import{t as c}from"./utils-CJdWZupK.js";var l=e(i(),1),u=s(),ee=.85,d=1.2,f=10/9,p=.9,m=`openchamber.designPtScale.v6`;function h(e){return!Number.isFinite(e)||e<=0?1:Math.min(d,Math.max(ee,e))}function g(e){if(!e)return p;let t=e.density,n=(e.xdpi+e.ydpi)/2;return!(t>0)||!(n>=50)||n>800?p:Math.min(p,h(n/t/163))}function _(){if(typeof window>`u`)return 1;try{let e=Number.parseFloat(window.localStorage.getItem(`openchamber.designPtScale.v6`)??``),t=window.Capacitor?.getPlatform?.();return t===`android`?Math.min(p,h(e)):t===`ios`?f:h(e)}catch{return 1}}function v(e){if(!(typeof window>`u`))try{window.localStorage.setItem(m,String(e))}catch{}}function y(e,t=document.documentElement){let n=h(e);t.style.setProperty(`--dpt`,`${n}px`),t.style.setProperty(`--dpt-n`,String(n))}async function b(){if(typeof document>`u`)return 1;y(_());let{Capacitor:e,registerPlugin:t}=await o(async()=>{let{Capacitor:e,registerPlugin:t}=await import(`./vendor-aparajita-capacitor-secure-storage-CjQdwfjS.js`).then(e=>e.i);return{Capacitor:e,registerPlugin:t}},__vite__mapDeps([0,1]));if(!e.isNativePlatform())return y(1),1;if(e.getPlatform()===`ios`)return y(f),v(f),f;if(e.getPlatform()!==`android`)return y(1),1;if(!e.isPluginAvailable(`OpenChamberPhysicalScale`))return y(p),v(p),p;try{let e=g(await t(`OpenChamberPhysicalScale`).getMetrics());return v(e),y(e),e}catch{return y(p),v(p),p}}var x={xs:0,sm:640,md:768,lg:1024,xl:1280,"2xl":1536},te={isMobile:!1,isTablet:!1,isDesktop:!0,deviceType:`desktop`,screenWidth:1024,breakpoint:`lg`,hasTouchInput:!1,hasTouchOnlyPointer:!1},S=()=>typeof window>`u`?!1:new URLSearchParams(window.location.search).get(`surface`)===`desktop`,C=e=>{if(typeof navigator>`u`)return{isExplicitTablet:!1};let t=navigator.userAgent||``,n=navigator.platform||``,r=/iPad/i.test(t)||(/Macintosh|MacIntel/i.test(t)||/MacIntel/i.test(n))&&e>1,i=/Android/i.test(t)&&!/Mobile/i.test(t),a=/Tablet/i.test(t);return{isExplicitTablet:r||i||a}},ne=(e,t,n)=>{if(typeof window>`u`)return;let r=document.documentElement,i=t===`mobile`,a=t===`tablet`;r.classList.remove(`device-mobile`,`device-tablet`,`device-desktop`),r.classList.add(t===`mobile`?`device-mobile`:t===`tablet`?`device-tablet`:`device-desktop`),e?(r.classList.add(`desktop-runtime`),r.style.setProperty(`--is-mobile`,`0`),r.style.setProperty(`--device-type`,`desktop`),r.style.setProperty(`--font-scale`,`1`),r.style.setProperty(`--has-coarse-pointer`,`0`),r.style.setProperty(`--has-touch-input`,`0`),r.classList.remove(`mobile-pointer`)):(r.classList.remove(`desktop-runtime`),r.style.setProperty(`--is-mobile`,i?`1`:`0`),r.style.setProperty(`--device-type`,t),r.style.setProperty(`--font-scale`,i?`0.9`:a?`0.95`:`1`),r.style.setProperty(`--has-coarse-pointer`,n?`1`:`0`),r.style.setProperty(`--has-touch-input`,n?`1`:`0`),n?r.classList.add(`mobile-pointer`):r.classList.remove(`mobile-pointer`)),y(e?1:_(),r)};function w(){let e=window.innerWidth,r=typeof window.matchMedia==`function`,i=r?window.matchMedia(`(pointer: coarse)`):null,o=r?window.matchMedia(`(hover: none)`):null,s=i?.matches??!1,c=o?.matches??!1,l=typeof navigator<`u`?navigator.maxTouchPoints??0:0,u=n()||t()||S(),{isExplicitTablet:ee}=C(l),d=s||c||l>0,f=s||c,p=e>x.md&&e<=x.lg,m=e<=x.md,h=d&&m,g=d&&!h&&(p||ee),_=!d||!g&&e>x.lg,v=`desktop`;u?(h=!1,g=!1,_=!0,v=`desktop`):a()?(h=!0,g=!1,_=!1,v=`mobile`):h?v=`mobile`:g?v=`tablet`:(_=!0,v=`desktop`),ne(u,v,d);let y=`xs`;for(let[t,n]of Object.entries(x))e>=n&&(y=t);return{isMobile:h,isTablet:g,isDesktop:_,deviceType:v,screenWidth:e,breakpoint:y,hasTouchInput:d,hasTouchOnlyPointer:f}}var T=(e,t)=>e.isMobile===t.isMobile&&e.isTablet===t.isTablet&&e.isDesktop===t.isDesktop&&e.deviceType===t.deviceType&&e.screenWidth===t.screenWidth&&e.breakpoint===t.breakpoint&&e.hasTouchInput===t.hasTouchInput&&e.hasTouchOnlyPointer===t.hasTouchOnlyPointer,E=new Set,D=null,O,k=null,A=()=>typeof window>`u`?te:(D||=w(),D),re=()=>{for(let e of E)e()},ie=()=>{O=void 0;let e=w();D&&T(D,e)||(D=e,re())},j=()=>{typeof window>`u`||O!==void 0||(O=window.requestAnimationFrame(ie))},M=(e,t)=>e?typeof e.addEventListener==`function`?(e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)):typeof e.addListener==`function`?(e.addListener(t),()=>e.removeListener(t)):()=>{}:()=>{},N=()=>{if(typeof window>`u`)return()=>{};D=w(),window.addEventListener(`resize`,j);let e=typeof window.matchMedia==`function`?window.matchMedia(`(pointer: coarse)`):null,t=typeof window.matchMedia==`function`?window.matchMedia(`(hover: none)`):null,n=M(e,j),r=M(t,j);return()=>{window.removeEventListener(`resize`,j),n(),r(),O!==void 0&&(window.cancelAnimationFrame(O),O=void 0)}},P=e=>typeof window>`u`?()=>{}:(E.add(e),k||=N(),()=>{E.delete(e),E.size===0&&k&&(k(),k=null,D=null)});function F(){if(typeof window>`u`||typeof window<`u`&&n())return!1;let e=document.documentElement,t=e.style.getPropertyValue(`--is-mobile`)||getComputedStyle(e).getPropertyValue(`--is-mobile`);return t===`1`||t===`true`}var I=()=>typeof window>`u`?!1:!!(navigator.standalone===!0||window.matchMedia?.(`(display-mode: standalone)`)?.matches||window.matchMedia?.(`(display-mode: fullscreen)`)?.matches),L=()=>{if(typeof window>`u`||n())return!1;let e=typeof navigator<`u`?navigator.maxTouchPoints??0:0;return I()&&e>0&&window.innerWidth>x.md};function ae(){let e=(0,u.c)(2),[t,n]=l.useState(R),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{if(typeof window>`u`)return;let e=()=>n(L()),t=window.matchMedia?.(`(display-mode: standalone)`),r=window.matchMedia?.(`(display-mode: fullscreen)`);e(),window.addEventListener(`resize`,e),window.addEventListener(`focus`,e);let i=t=>{t&&(typeof t.addEventListener==`function`?t.addEventListener(`change`,e):typeof t.addListener==`function`&&t.addListener(e))},a=t=>{t&&(typeof t.removeEventListener==`function`?t.removeEventListener(`change`,e):typeof t.removeListener==`function`&&t.removeListener(e))};return i(t),i(r),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`focus`,e),a(t),a(r)}},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),l.useEffect(r,i),t}function R(){return L()}var z=()=>typeof window>`u`?`portrait`:window.matchMedia?.(`(orientation: landscape)`)?.matches?`landscape`:`portrait`;function B(){let e=(0,u.c)(2),[t,n]=l.useState(z),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(orientation: landscape)`),t=()=>n(e.matches?`landscape`:`portrait`);return t(),M(e,t)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),l.useEffect(r,i),t}function V(){return l.useSyncExternalStore(P,A,H)}function H(){return te}var oe=r(),se=1e3,U=.5,ce={length:0,offset:0},le=(e,t)=>Math.abs(e.length-t.length)<U&&Math.abs(e.offset-t.offset)<U,W=e=>{let t=(0,u.c)(66),{containerRef:n,minThumbSize:r,hideDelayMs:i,className:a,disableHorizontal:o,observeMutations:s,suppressVisibility:ee,userIntentOnly:d}=e,f=r===void 0?32:r,p=i===void 0?1e3:i,m=o!==void 0&&o,h=s===void 0||s,g=ee!==void 0&&ee,_=d!==void 0&&d,[v,y]=l.useState(!1),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b={length:0,offset:0},t[0]=b):b=t[0];let[x,te]=l.useState(b),S;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(S={length:0,offset:0},t[1]=S):S=t[1];let[C,ne]=l.useState(S),w=l.useRef(null),T=l.useRef(null),E=l.useRef(null),D=l.useRef(!1),O=l.useRef(!1),k=l.useRef(0),A;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(A={pointerX:0,pointerY:0,scrollTop:0,scrollLeft:0},t[2]=A):A=t[2];let re=l.useRef(A),ie=l.useRef(null),j;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(j=new Set,t[3]=j):j=t[3];let M=l.useRef(j),N;t[4]!==n||t[5]!==m||t[6]!==f?(N=()=>{let e=n.current;if(!e)return;let{scrollHeight:t,clientHeight:r,scrollTop:i,scrollWidth:a,clientWidth:o,scrollLeft:s}=e,c=ce;if(t>r){let e=Math.max(r-16,0),n=r/t*e,a=Math.max(f,Math.min(e,n)),o=Math.max(e-a,0);c={length:a,offset:i/Math.max(t-r,1)*o}}te(e=>le(e,c)?e:c);let l=ce;if(!m&&a>o){let e=Math.max(o-16,0),t=o/a*e,n=Math.max(f,Math.min(e,t)),r=Math.max(e-n,0);l={length:n,offset:s/Math.max(a-o,1)*r}}ne(e=>le(e,l)?e:l)},t[4]=n,t[5]=m,t[6]=f,t[7]=N):N=t[7];let P=N,F;t[8]===P?F=t[9]:(F=()=>{E.current===null&&(E.current=requestAnimationFrame(()=>{E.current=null,P()}))},t[8]=P,t[9]=F);let I=F,L;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(L=(e,t)=>{if(!t){M.current.clear();return}let n=new Set;n.add(e),Array.from(e.children).forEach(e=>{n.add(e)}),M.current.forEach(e=>{n.has(e)||t.unobserve(e)}),n.forEach(e=>{M.current.has(e)||t.observe(e)}),M.current=n},t[10]=L):L=t[10];let ae=L,R;t[11]===p?R=t[12]:(R=()=>{w.current&&clearTimeout(w.current),!O.current&&(w.current=setTimeout(()=>y(!1),p))},t[11]=p,t[12]=R);let z=R,B;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(B=()=>{k.current=Date.now()},t[13]=B):B=t[13];let V=B,H;t[14]!==z||t[15]!==g||t[16]!==P||t[17]!==_?(H=()=>{T.current&&cancelAnimationFrame(T.current),T.current=requestAnimationFrame(()=>{if(P(),g&&!D.current){y(!1);return}if(_&&!D.current&&!(Date.now()-k.current<=se)){y(!1);return}y(!0),z()})},t[14]=z,t[15]=g,t[16]=P,t[17]=_,t[18]=H):H=t[18];let U=H,W,G;t[19]!==n||t[20]!==U||t[21]!==h||t[22]!==I||t[23]!==P||t[24]!==_?(W=()=>{let e=n.current;if(!e)return;P(),y(!1);let t=()=>U(),r=e=>{(e.key===`ArrowUp`||e.key===`ArrowDown`||e.key===`PageUp`||e.key===`PageDown`||e.key===`Home`||e.key===`End`||e.key===` `)&&V()};e.addEventListener(`scroll`,t,{passive:!0}),_&&(e.addEventListener(`wheel`,V,{passive:!0}),e.addEventListener(`touchstart`,V,{passive:!0}),e.addEventListener(`touchmove`,V,{passive:!0}),e.addEventListener(`keydown`,r));let i=typeof ResizeObserver<`u`?new ResizeObserver(()=>{I()}):null;ae(e,i);let a=h&&typeof MutationObserver<`u`?new MutationObserver(()=>{ae(e,i),I()}):null;a?.observe(e,{childList:!0});let o=()=>I(),s=()=>I();return e.addEventListener(`input`,o,!0),e.addEventListener(`load`,s,!0),()=>{e.removeEventListener(`scroll`,t),e.removeEventListener(`input`,o,!0),e.removeEventListener(`load`,s,!0),_&&(e.removeEventListener(`wheel`,V),e.removeEventListener(`touchstart`,V),e.removeEventListener(`touchmove`,V),e.removeEventListener(`keydown`,r)),i?.disconnect(),a?.disconnect(),M.current.clear(),w.current&&clearTimeout(w.current),T.current&&cancelAnimationFrame(T.current),E.current&&cancelAnimationFrame(E.current)}},G=[n,U,V,h,I,ae,P,_],t[19]=n,t[20]=U,t[21]=h,t[22]=I,t[23]=P,t[24]=_,t[25]=W,t[26]=G):(W=t[25],G=t[26]),l.useEffect(W,G);let ue,de;t[27]===g?(ue=t[28],de=t[29]):(ue=()=>{g&&(D.current||(y(!1),w.current&&=(clearTimeout(w.current),null)))},de=[g],t[27]=g,t[28]=ue,t[29]=de),l.useEffect(ue,de);let fe;t[30]===n?fe=t[31]:(fe=(e,t)=>{let r=n.current;r&&(D.current=!0,re.current={pointerX:e.clientX,pointerY:e.clientY,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft},ie.current=t,V(),y(!0),w.current&&clearTimeout(w.current),e.currentTarget.setPointerCapture(e.pointerId))},t[30]=n,t[31]=fe);let K=fe,pe;t[32]!==n||t[33]!==C.length||t[34]!==x.length?(pe=e=>{if(!D.current)return;let t=n.current;if(!t)return;let r=ie.current;if(r===`vertical`){let{pointerY:n,scrollTop:r}=re.current,i=e.clientY-n,a=t.clientHeight,o=Math.max(a-x.length,1),s=Math.max(t.scrollHeight-t.clientHeight,1);t.scrollTop=r+i/o*s}else if(r===`horizontal`){let{pointerX:n,scrollLeft:r}=re.current,i=e.clientX-n,a=t.clientWidth,o=Math.max(a-C.length,1),s=Math.max(t.scrollWidth-t.clientWidth,1);t.scrollLeft=r+i/o*s}},t[32]=n,t[33]=C.length,t[34]=x.length,t[35]=pe):pe=t[35];let q=pe,me;t[36]===z?me=t[37]:(me=e=>{D.current&&(D.current=!1,e.currentTarget.releasePointerCapture(e.pointerId),z())},t[36]=z,t[37]=me);let J=me,he;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(he=()=>{O.current=!0,w.current&&=(clearTimeout(w.current),null)},t[38]=he):he=t[38];let ge=he,_e;t[39]===z?_e=t[40]:(_e=()=>{O.current=!1,z()},t[39]=z,t[40]=_e);let Y=_e,ve=x.length>0,ye=C.length>0;if(!ve&&!ye)return null;let X;t[41]===a?X=t[42]:(X=c(`overlay-scrollbar`,a),t[41]=a,t[42]=X);let be=+!!v,Z;t[43]===be?Z=t[44]:(Z={opacity:be},t[43]=be,t[44]=Z);let Q;t[45]!==K||t[46]!==q||t[47]!==J||t[48]!==Y||t[49]!==ve||t[50]!==x.length||t[51]!==x.offset?(Q=ve&&(0,oe.jsx)(`div`,{className:`overlay-scrollbar__thumb overlay-scrollbar__thumb--vertical`,"data-overlay-scrollbar-thumb":`vertical`,style:{height:`${x.length}px`,top:`${8+x.offset}px`,right:`4px`},onPointerDown:e=>K(e,`vertical`),onPointerMove:q,onPointerUp:J,onPointerCancel:J,onMouseEnter:ge,onMouseLeave:Y}),t[45]=K,t[46]=q,t[47]=J,t[48]=Y,t[49]=ve,t[50]=x.length,t[51]=x.offset,t[52]=Q):Q=t[52];let $;t[53]!==K||t[54]!==q||t[55]!==J||t[56]!==Y||t[57]!==C.length||t[58]!==C.offset||t[59]!==ye?($=ye&&(0,oe.jsx)(`div`,{className:`overlay-scrollbar__thumb overlay-scrollbar__thumb--horizontal`,"data-overlay-scrollbar-thumb":`horizontal`,style:{width:`${C.length}px`,left:`${8+C.offset}px`,bottom:`4px`},onPointerDown:e=>K(e,`horizontal`),onPointerMove:q,onPointerUp:J,onPointerCancel:J,onMouseEnter:ge,onMouseLeave:Y}),t[53]=K,t[54]=q,t[55]=J,t[56]=Y,t[57]=C.length,t[58]=C.offset,t[59]=ye,t[60]=$):$=t[60];let xe;return t[61]!==X||t[62]!==Z||t[63]!==Q||t[64]!==$?(xe=(0,oe.jsxs)(`div`,{className:X,"aria-hidden":`true`,style:Z,children:[Q,$]}),t[61]=X,t[62]=Z,t[63]=Q,t[64]=$,t[65]=xe):xe=t[65],xe};W.displayName=`OverlayScrollbar`;var G=W;export{B as a,V as i,w as n,ae as o,F as r,b as s,G as t};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkdownRendererImpl-DtDXVNL0.js","assets/rolldown-runtime-C0FnF6B9.js","assets/useUIStore-Wyu09VUF.js","assets/vendor-zustand-B4dlGEM2.js","assets/vendor-base-ui-CnHfUmDN.js","assets/persistence-aCOlo6ew.js","assets/vendor-pathe-vBmvQE8f.js","assets/vendor-react-DLPElpoQ.js","assets/vendor-tanstack-query-core-BWz0ose6.js","assets/platform-DxNH_0Fj.js","assets/vendor-opencode-sdk-C07HQypa.js","assets/vendor-aparajita-capacitor-secure-storage-CjQdwfjS.js","assets/vendor-reactuses-core-DDoDDyM9.js","assets/vendor-lodash-es-DfLbG5Af.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/clipboard-DyCy8o-j.js","assets/store--ZgdDfa2.js","assets/useMobileNavigationStore-DkBMOv1J.js","assets/vendor-tanstack-react-query-D7pys_c9.js","assets/vendor-sonner-DVzioF3d.js","assets/useAssistantUIStore-DxZsjSPQ.js","assets/vendor-fuse.js-DB5wDJbI.js","assets/utils-CJdWZupK.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/useThemeSystem-DMzWVJaW.js","assets/markdownTheme-DidS-jC5.js","assets/vendor-pierre-diffs-BenIz2TM.js","assets/vendor-hast-util-to-html-B0p1k5Xa.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-DpDied8H.js","assets/useRuntimeAPIs-DSLXJybW.js","assets/url-BQHM4bC4.js","assets/markdown-worker-9Sn2jsDp.js","assets/useEffectiveDirectory-FcGKsobh.js","assets/FadeInOnReveal-BpIMrqet.js","assets/vendor-morphdom-BbKiNDAu.js","assets/vendor-beautiful-mermaid-DykqIK5D.js","assets/vendor-marked-WVekxjAN.js","assets/vendor-remend-C3cXc-tf.js","assets/vendor-katex-CNGgSigB.js","assets/vendor-dompurify-CeJNOzik.js"])))=>i.map(i=>d[i]);
2
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{nt as t,rt as n}from"./vendor-base-ui-CnHfUmDN.js";import{n as r}from"./platform-DxNH_0Fj.js";import{a as i,n as a,o}from"./vendor-aparajita-capacitor-secure-storage-CjQdwfjS.js";import{n as s}from"./vendor-react-DLPElpoQ.js";import{n as c}from"./vendor-reactuses-core-DDoDDyM9.js";import{t as l}from"./utils-CJdWZupK.js";import{a as u,c as d,i as f}from"./markdown-worker-9Sn2jsDp.js";import{r as p}from"./vendor-pierre-diffs-BenIz2TM.js";var m=s(),h=e(n(),1),g=`openchamber:chunk-import-reload`,_=250,v=3e4,y=[/Importing a module script failed/i,/Failed to fetch dynamically imported module/i,/error loading dynamically imported module/i,/Loading chunk \S+ failed/i,/ChunkLoadError/i];function b(e){if(e instanceof Error)return`${e.name}\n${e.message}\n${e.stack??``}`;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function x(e){let t=b(e);return y.some(e=>e.test(t))}function ee(e){return`1.19.0-beta.22:${b(e).slice(0,500)}`}function S(e){if(typeof window>`u`)return;let t=Date.now(),n=ee(e),r=null;try{let e=window.sessionStorage.getItem(g);if(e)try{r=JSON.parse(e)}catch{r=null}}catch{return}let i=typeof r?.timestamp==`number`?r.timestamp:0;if(!(r?.signature===n&&t-i<v)){try{window.sessionStorage.setItem(g,JSON.stringify({signature:n,timestamp:t}))}catch{return}console.error(`[refresh-debug] chunk-import-reload`,{error:b(e).slice(0,1e3)}),window.setTimeout(()=>{window.location.reload()},0)}}async function te(e,t={}){let n=t.retries??1,r;for(let t=0;t<=n;t+=1)try{return await e()}catch(e){if(r=e,!x(e)||t>=n)break;await new Promise(e=>setTimeout(e,_*(t+1)))}throw x(r)&&S(r),r}var C=e=>(0,h.lazy)(()=>te(e)),w=`__openchamberMobileBackRoute`,T=()=>typeof window>`u`||r()?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)}},E=e=>{let t=e?.[w];return typeof t==`number`&&Number.isFinite(t)?t:null},D=new class{routes=[];listeners=new Set;nextToken=1;history;removeHistoryListener=null;programmaticHistoryBackToken=null;pendingHistoryRemovals=new Map;animatedBackDriver=null;presentationCancelDriver=null;constructor(e=T()){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&&E(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()??{},[w]: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&&E(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||E(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&&E(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&&E(e)!==t.token&&t.onBack()===!1&&this.history&&this.history.pushState({...this.history.currentState()??{},[w]:t.token})}))}disposeHistoryListener(){this.removeHistoryListener?.(),this.removeHistoryListener=null,this.programmaticHistoryBackToken=null,this.pendingHistoryRemovals.clear()}notify(){this.listeners.forEach(e=>e())}},ne=e=>{let t=(0,m.c)(8),{id:n,active:r,layer:i,onBack:a,surfaceRef:o,underlayRef:s}=e,l=i===void 0?`root`:i,u=c(a),d,f;t[0]!==r||t[1]!==u||t[2]!==n||t[3]!==l||t[4]!==o||t[5]!==s?(d=()=>{if(r)return D.register({id:n,layer:l,onBack:u,getSurface:()=>o.current,getUnderlay:()=>s?.current??null})},f=[r,u,n,l,o,s],t[0]=r,t[1]=u,t[2]=n,t[3]=l,t[4]=o,t[5]=s,t[6]=d,t[7]=f):(d=t[6],f=t[7]),h.useEffect(d,f)},O=i(`OpenChamberNavigation`),k=e=>Math.min(1,Math.max(0,Number.isFinite(e)?e:0)),A=(e,t)=>!e||!t?!1:e.onBack()!==!1,j=e=>{let t=k(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)))},M=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??``)},N=(e,t)=>{let n=k(t),{surface:r}=e;r.style.transform=`translate3d(${n*100}%, 0, 0)`},re=e=>!e.surfaceConnected||e.topRouteToken!==e.routeToken||e.routeSurface!==e.outgoingSurface,ie=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)`},ae=async(e,t,n=typeof window<`u`&&window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches,r=j({progress:Number.parseFloat(e.style.transform.match(/translate3d\(([-\d.]+)%/)?.[1]??`0`)/100,commit:t}))=>ie(e,t?100:0,r,n),oe=class{pending=0;enqueue(){this.pending+=1}take(){return this.pending!==0&&(--this.pending,!0)}clear(){this.pending=0}},se=e=>{let t=(0,m.c)(4),{enabled:n,rootRoutesBlocked:i}=e,o,s;t[0]!==n||t[1]!==i?(o=()=>{if(!n||!r()||a.getPlatform()===`web`)return;let e=!1,t=null,o=null,s=0,c=0,l=0,u=new oe,d=[],f=e=>!!e&&(!i||e?.layer===`overlay`),p=()=>{let e=f(D.getTopRoute());O.setEnabled({enabled:e}).catch(ce)},m=()=>{if(D.cancelPresentation(),o)return;let e=D.getTopRoute();if(!f(e))return;let n=e.getSurface();if(!n)return;n.getAnimations().forEach(le),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(P),n.style.transition=`none`,n.style.animation=`none`,n.style.willChange=`transform`,r&&(r.style.removeProperty(`transform`),r.style.removeProperty(`will-change`)),l+=1,t={route:e,surface:n,underlay:r,surfaceTransition:i,surfaceAnimation:a,underlayTransition:s,underlayAnimation:c},N(t,0)},h=e=>{c=k(e),!s&&(s=window.requestAnimationFrame(()=>{s=0,t&&N(t,c)}))},g=F,_=(n,r,i)=>{if(o)return n&&f(D.getTopRoute())?(u.enqueue(),!0):!1;s&&=(window.cancelAnimationFrame(s),0),t||m(),t&&r!==void 0&&N(t,r);let a=t,d=l;if(t=null,!a){if(!n)return!1;let e=D.getTopRoute();return A(e,f(e))}o=a;let p=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1,h=j({progress:k(r??c),commit:n,velocityX:i,viewportWidth:window.innerWidth});return ae(a.surface,n,p,h).then(async()=>{d===l&&(!e&&n&&(a.route.onBack(),await g(a)),d===l&&(M(a),o===a&&(o=null),!e&&u.take()&&_(!0,0,0)))}),!0},v=D.setAnimatedBackDriver(e=>e!==D.getTopRoute()||!f(e)?!1:_(!0,0,0)),y=D.subscribe(p);return(async()=>{let t=await O.addListener(`backStarted`,m),n=await O.addListener(`backProgressed`,e=>h(e.progress??0)),r=await O.addListener(`backCancelled`,e=>_(!1,e.progress,e.velocityX)),i=await O.addListener(`backInvoked`,e=>_(!0,e.progress,e.velocityX));if(e){await Promise.all([t.remove(),n.remove(),r.remove(),i.remove()]);return}d.push(t,n,r,i),p()})().catch(I),p(),()=>{e=!0,l+=1,u.clear(),y(),v(),s&&window.cancelAnimationFrame(s),t&&M(t),o&&(o.surface.getAnimations().forEach(L),o.underlay?.getAnimations().forEach(R),M(o)),t=null,o=null,O.setEnabled({enabled:!1}).catch(z),d.forEach(B)}},s=[n,i],t[0]=n,t[1]=i,t[2]=o,t[3]=s):(o=t[2],s=t[3]),h.useEffect(o,s)};function ce(){}function le(e){return e.cancel()}function P(e){return e.cancel()}function F(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=D.getTopRoute();return re({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=D.subscribe(()=>{o()&&a()});s()})}function I(){}function L(e){return e.cancel()}function R(e){return e.cancel()}function z(){}function B(e){e.remove()}var V=null,H=()=>(V??=o(()=>import(`./MarkdownRendererImpl-DtDXVNL0.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47])).catch(e=>{throw V=null,e}),V),U=()=>{H().catch(()=>void 0)},W=h.createContext(!0),G=()=>h.useContext(W),K=t(),ue=C(()=>H().then(e=>({default:e.MarkdownRenderer}))),de=C(()=>H().then(e=>({default:e.SimpleMarkdownRenderer}))),fe=e=>e===`tool`?`markdown-content markdown-tool`:e===`reasoning`?`markdown-content markdown-reasoning`:`markdown-content leading-relaxed`,q=e=>{let t=(0,m.c)(14),n=typeof e.content==`string`?e.content:``,r=typeof e.variant==`string`?e.variant:`assistant`,i;t[0]!==n||t[1]!==e.reserveMeasuredHeight||t[2]!==r?(i=e.reserveMeasuredHeight?u(f(n,r)):void 0,t[0]=n,t[1]=e.reserveMeasuredHeight,t[2]=r,t[3]=i):i=t[3];let a=i,o;t[4]!==e.className||t[5]!==e.variant?(o=l(`relative break-words w-full min-w-0`,fe(e.variant),typeof e.className==`string`?e.className:void 0),t[4]=e.className,t[5]=e.variant,t[6]=o):o=t[6];let s;t[7]!==n||t[8]!==e.animated||t[9]!==a?(s=(0,K.jsx)(d,{animated:e.animated,content:n,reservedHeight:a}),t[7]=n,t[8]=e.animated,t[9]=a,t[10]=s):s=t[10];let c;return t[11]!==o||t[12]!==s?(c=(0,K.jsx)(`div`,{className:o,"aria-busy":`true`,"data-markdown-hydration":`deferred`,children:s}),t[11]=o,t[12]=s,t[13]=c):c=t[13],c},pe=e=>{let t=(0,m.c)(4);if(!G()&&e.isStreaming!==!0){let n;return t[0]===e?n=t[1]:(n=(0,K.jsx)(q,{...e,animated:!1,reserveMeasuredHeight:!0}),t[0]=e,t[1]=n),n}let n;return t[2]===e?n=t[3]:(n=(0,K.jsx)(h.Suspense,{fallback:(0,K.jsx)(q,{...e,reserveMeasuredHeight:!0}),children:(0,K.jsx)(ue,{...e})}),t[2]=e,t[3]=n),n},me=e=>{let t=(0,m.c)(4);if(!G()){let n;return t[0]===e?n=t[1]:(n=(0,K.jsx)(q,{...e,animated:!1}),t[0]=e,t[1]=n),n}let n;return t[2]===e?n=t[3]:(n=(0,K.jsx)(h.Suspense,{fallback:(0,K.jsx)(q,{...e}),children:(0,K.jsx)(de,{...e})}),t[2]=e,t[3]=n),n},he=e=>/^#[0-9a-fA-F]{6}$/.test(e),ge=e=>/^#[0-9a-fA-F]{8}$/.test(e),_e=(e,t)=>/^[0-9a-fA-F]{2}$/.test(t)?he(e)?`${e}${t}`:ge(e)?`${e.slice(0,7)}${t}`:e:e,J=(e,t)=>typeof e==`string`&&e.trim().length>0?e:t,Y=e=>{let t=e.colors.syntax.base,n=e.colors.syntax.tokens??{},r=(e,t)=>J(n[e],t);return[{name:`plain`,scope:[`source`,`support.type.property-name.css`],settings:{foreground:t.foreground}},{name:`classes`,scope:[`entity.name.type.class`],settings:{foreground:r(`className`,r(`class`,t.function))}},{name:`interfaces`,scope:[`entity.name.type.interface`,`entity.name.type`],settings:{foreground:r(`interface`,t.type)}},{name:`structs`,scope:[`entity.name.type.struct`],settings:{foreground:r(`struct`,t.function)}},{name:`enums`,scope:[`entity.name.type.enum`],settings:{foreground:r(`enum`,t.function)}},{name:`keys`,scope:[`meta.object-literal.key`,`support.type.property-name`],settings:{foreground:r(`key`,t.function)}},{name:`methods`,scope:[`entity.name.function.method`,`meta.function.method`],settings:{foreground:r(`method`,e.colors.status.success)}},{name:`functions`,scope:[`entity.name.function`,`support.function`,`meta.function-call.generic`],settings:{foreground:t.function,fontStyle:`bold`}},{name:`variables`,scope:[`variable`,`meta.variable`,`variable.other.object.property`],settings:{foreground:t.variable}},{name:`variablesOther`,scope:[`variable.other.object`,`variable.other.readwrite.alias`],settings:{foreground:r(`variableOther`,r(`method`,e.colors.status.success))}},{name:`globalVariables`,scope:[`variable.other.global`,`variable.language.this`],settings:{foreground:r(`variableGlobal`,t.number)}},{name:`localVariables`,scope:[`variable.other.local`],settings:{foreground:r(`variableLocal`,e.colors.surface.elevated)}},{name:`parameters`,scope:[`variable.parameter`,`meta.parameter`],settings:{foreground:r(`parameter`,t.foreground)}},{name:`properties`,scope:[`variable.other.property`,`meta.property`],settings:{foreground:r(`variableProperty`,e.colors.status.info)}},{name:`strings`,scope:[`string`,`string.other.link`,`markup.inline.raw.string.markdown`],settings:{foreground:t.string}},{name:`stringEscapeSequences`,scope:[`constant.character.escape`,`constant.other.placeholder`],settings:{foreground:r(`stringEscape`,t.foreground)}},{name:`keywords`,scope:[`keyword`],settings:{foreground:t.keyword}},{name:`keywordsControl`,scope:[`keyword.control.import`,`keyword.control.from`,`keyword.import`],settings:{foreground:r(`keywordImport`,t.operator)}},{name:`storageModifiers`,scope:[`storage.modifier`,`keyword.modifier`,`storage.type`],settings:{foreground:r(`storageModifier`,t.keyword)}},{name:`comments`,scope:[`comment`,`punctuation.definition.comment`],settings:{foreground:t.comment}},{name:`docComments`,scope:[`comment.documentation`,`comment.line.documentation`],settings:{foreground:r(`commentDoc`,e.colors.surface.mutedForeground)}},{name:`numbers`,scope:[`constant.numeric`],settings:{foreground:t.number}},{name:`booleans`,scope:[`constant.language`],settings:{foreground:r(`boolean`,t.type)}},{name:`operators`,scope:[`keyword.operator`],settings:{foreground:t.operator}},{name:`macros`,scope:[`entity.name.function.preprocessor`,`meta.preprocessor`],settings:{foreground:r(`macro`,t.keyword)}},{name:`preprocessor`,scope:[`meta.preprocessor`],settings:{foreground:r(`preprocessor`,r(`label`,t.number))}},{name:`urls`,scope:[`markup.underline.link`],settings:{foreground:r(`url`,e.colors.status.info)}},{name:`tags`,scope:[`entity.name.tag`],settings:{foreground:r(`tag`,t.keyword)}},{name:`jsxTags`,scope:[`support.class.component`],settings:{foreground:r(`jsxTag`,r(`label`,t.number))}},{name:`attributes`,scope:[`entity.other.attribute-name`,`meta.attribute`],settings:{foreground:r(`tagAttribute`,t.type)}},{name:`types`,scope:[`support.type`],settings:{foreground:t.type}},{name:`constants`,scope:[`variable.other.constant`,`variable.readonly`],settings:{foreground:r(`constant`,t.foreground)}},{name:`labels`,scope:[`entity.name.label`,`punctuation.definition.label`],settings:{foreground:r(`label`,r(`variableGlobal`,t.number))}},{name:`namespaces`,scope:[`entity.name.namespace`,`storage.modifier.namespace`,`markup.bold.markdown`],settings:{foreground:r(`namespace`,t.type)}},{name:`modules`,scope:[`entity.name.module`,`storage.modifier.module`],settings:{foreground:r(`module`,t.operator)}},{name:`typeParameters`,scope:[`variable.type.parameter`,`variable.parameter.type`],settings:{foreground:r(`typeParameter`,t.function)}},{name:`exceptions`,scope:[`keyword.control.exception`,`keyword.control.trycatch`],settings:{foreground:r(`exception`,r(`label`,t.number))}},{name:`decorators`,scope:[`meta.decorator`,`punctuation.decorator`,`entity.name.function.decorator`],settings:{foreground:r(`decorator`,t.type)}},{name:`calls`,scope:[`variable.function`],settings:{foreground:t.foreground}},{name:`punctuation`,scope:[`punctuation`,`punctuation.terminator`,`punctuation.definition.tag`,`punctuation.separator`,`punctuation.definition.string`,`punctuation.section.block`],settings:{foreground:r(`punctuation`,t.comment)}},{name:`yellow`,scope:[`storage.type.numeric.go`,`storage.type.byte.go`,`storage.type.boolean.go`,`storage.type.string.go`,`storage.type.uintptr.go`,`storage.type.error.go`,`storage.type.rune.go`,`constant.language.go`,`support.class.dart`,`keyword.other.documentation`,`storage.modifier.import.java`,`punctuation.definition.list.begin.markdown`,`punctuation.definition.quote.begin.markdown`,`meta.separator.markdown`,`entity.name.section.markdown`],settings:{foreground:t.type}},{name:`green`,scope:[],settings:{foreground:r(`method`,e.colors.status.success)}},{name:`cyan`,scope:[`markup.italic.markdown`,`support.type.python`,`variable.legacy.builtin.python`,`support.constant.property-value.css`,`storage.modifier.attribute.swift`],settings:{foreground:t.string}},{name:`blue`,scope:[],settings:{foreground:t.keyword}},{name:`purple`,scope:[`keyword.channel.go`,`keyword.other.platform.os.swift`],settings:{foreground:t.number}},{name:`magenta`,scope:[`punctuation.definition.heading.markdown`],settings:{foreground:r(`label`,r(`variableGlobal`,t.number))}},{name:`red`,scope:[],settings:{foreground:t.operator}},{name:`orange`,scope:[],settings:{foreground:t.function}}]},ve=e=>{let t=e.colors.surface,n=e.colors.interactive,r=e.colors.status,i=e.colors.syntax.base,a=e.colors.syntax.highlights??{},o=J(a.diffAddedBackground,r.successBackground),s=J(a.diffRemovedBackground,r.errorBackground);return{"editor.background":t.background,"editor.foreground":t.foreground,"editor.hoverHighlightBackground":J(n.hover,t.subtle),"editor.lineHighlightBackground":t.muted,"editor.selectionBackground":n.selection,"editor.selectionHighlightBackground":n.selection,"editor.findMatchBackground":i.type,"editor.findMatchHighlightBackground":_e(i.type,`cc`),"editor.findRangeHighlightBackground":t.muted,"editor.inactiveSelectionBackground":t.elevated,"editor.lineHighlightBorder":t.elevated,"editor.rangeHighlightBackground":J(n.active,n.borderHover),"notifications.background":t.elevated,"editorInlayHint.typeBackground":t.subtle,"editorInlayHint.typeForeground":t.foreground,"editorWhitespace.foreground":n.borderHover,"editorIndentGuide.background1":t.subtle,"editorHoverWidget.background":t.elevated,"editorLineNumber.activeForeground":J(a.lineNumberActive,t.foreground),"editorLineNumber.foreground":J(a.lineNumber,t.mutedForeground),"editorGutter.background":t.background,"editorGutter.modifiedBackground":r.info,"editorGutter.addedBackground":r.success,"editorGutter.deletedBackground":r.error,"editorBracketMatch.background":t.elevated,"editorBracketMatch.border":t.subtle,"editorError.foreground":r.error,"editorWarning.foreground":r.warning,"editorInfo.foreground":r.info,"diffEditor.insertedTextBackground":o,"diffEditor.removedTextBackground":s,"editorGroupHeader.tabsBackground":t.background,"editorGroup.border":n.border,"tab.activeBackground":t.background,"tab.inactiveBackground":t.muted,"tab.inactiveForeground":t.mutedForeground,"tab.activeForeground":t.foreground,"tab.hoverBackground":t.subtle,"tab.unfocusedHoverBackground":t.subtle,"tab.border":n.border,"tab.activeModifiedBorder":i.type,"tab.inactiveModifiedBorder":r.info,"tab.unfocusedActiveModifiedBorder":i.type,"tab.unfocusedInactiveModifiedBorder":r.info,"editorWidget.background":t.muted,"editorWidget.border":n.border,"editorSuggestWidget.background":t.background,"editorSuggestWidget.border":n.border,"editorSuggestWidget.foreground":t.foreground,"editorSuggestWidget.highlightForeground":t.mutedForeground,"editorSuggestWidget.selectedBackground":t.subtle,"peekView.border":n.border,"peekViewEditor.background":t.background,"peekViewEditor.matchHighlightBackground":t.subtle,"peekViewResult.background":t.muted,"peekViewResult.fileForeground":t.foreground,"peekViewResult.lineForeground":t.mutedForeground,"peekViewResult.matchHighlightBackground":t.subtle,"peekViewResult.selectionBackground":t.elevated,"peekViewResult.selectionForeground":t.mutedForeground,"peekViewTitle.background":t.subtle,"peekViewTitleDescription.foreground":t.mutedForeground,"peekViewTitleLabel.foreground":t.foreground,"merge.currentHeaderBackground":r.success,"merge.currentContentBackground":J(a.diffAdded,r.success),"merge.incomingHeaderBackground":r.info,"merge.incomingContentBackground":J(a.diffModified,r.info),"merge.border":n.border,"merge.commonContentBackground":t.subtle,"merge.commonHeaderBackground":t.muted,"panel.background":t.background,"panel.border":n.border,"panelTitle.activeBorder":n.borderHover,"panelTitle.activeForeground":t.foreground,"panelTitle.inactiveForeground":t.mutedForeground,"statusBar.background":t.background,"statusBar.foreground":t.foreground,"statusBar.border":n.border,"statusBar.debuggingBackground":r.error,"statusBar.debuggingForeground":r.errorForeground,"statusBar.noFolderBackground":t.subtle,"statusBar.noFolderForeground":t.mutedForeground,"titleBar.activeBackground":t.background,"titleBar.activeForeground":t.foreground,"titleBar.inactiveBackground":t.muted,"titleBar.inactiveForeground":t.mutedForeground,"titleBar.border":n.border,"menu.foreground":t.foreground,"menu.background":t.background,"menu.selectionForeground":t.foreground,"menu.selectionBackground":t.subtle,"menu.border":n.border,"editorInlayHint.foreground":t.mutedForeground,"editorInlayHint.background":t.subtle,"terminal.foreground":t.foreground,"terminal.background":t.background,"terminalCursor.foreground":t.foreground,"terminalCursor.background":t.background,"terminal.ansiRed":J(a.diffRemoved,r.error),"terminal.ansiGreen":J(a.diffAdded,r.success),"terminal.ansiYellow":r.warning,"terminal.ansiBlue":J(a.diffModified,r.info),"terminal.ansiMagenta":i.keyword,"terminal.ansiCyan":i.type,"activityBar.background":t.background,"activityBar.foreground":t.foreground,"activityBar.inactiveForeground":t.mutedForeground,"activityBar.activeBorder":t.foreground,"activityBar.border":n.border,"sideBar.background":t.background,"sideBar.foreground":t.foreground,"sideBar.border":n.border,"sideBarTitle.foreground":t.foreground,"sideBarSectionHeader.background":t.muted,"sideBarSectionHeader.foreground":t.foreground,"sideBarSectionHeader.border":n.border,"sideBar.activeBackground":t.subtle,"sideBar.activeForeground":t.foreground,"sideBar.hoverBackground":t.muted,"sideBar.hoverForeground":t.foreground,"list.warningForeground":r.warning,"list.errorForeground":r.error,"list.inactiveSelectionBackground":t.subtle,"list.activeSelectionBackground":t.elevated,"list.inactiveSelectionForeground":t.foreground,"list.activeSelectionForeground":t.foreground,"list.hoverForeground":t.foreground,"list.hoverBackground":t.muted,"input.background":t.muted,"input.foreground":t.foreground,"input.border":n.border,"input.placeholderForeground":t.mutedForeground,"inputOption.activeBorder":n.border,"inputOption.activeBackground":t.elevated,"inputOption.activeForeground":t.foreground,"inputValidation.infoBackground":r.infoBackground,"inputValidation.infoBorder":r.infoBorder,"inputValidation.warningBackground":r.warningBackground,"inputValidation.warningBorder":r.warningBorder,"inputValidation.errorBackground":r.errorBackground,"inputValidation.errorBorder":r.errorBorder,"dropdown.background":t.muted,"dropdown.foreground":t.foreground,"dropdown.border":n.border,"dropdown.listBackground":t.background,"badge.background":e.colors.primary.base,"activityBarBadge.background":e.colors.primary.base,"button.background":e.colors.primary.base,"button.foreground":J(e.colors.primary.foreground,t.background),"badge.foreground":J(e.colors.primary.foreground,t.background),"activityBarBadge.foreground":J(e.colors.primary.foreground,t.background)}};function ye(e){return{name:e.metadata.name,type:e.metadata.variant,colors:ve(e),tokenColors:Y(e)}}var be=e=>/^#[0-9a-fA-F]{8}$/.test(e),X=e=>be(e)?e.slice(0,7):e;function xe(e,t){return Object.defineProperty(e,"toString",{value:()=>t,enumerable:!1,configurable:!0}),Object.defineProperty(e,Symbol.toPrimitive,{value:()=>t,enumerable:!1,configurable:!0}),e}var Z=new Map,Q=new Set,Se=(e,t)=>{let n=e.colors?.[`editor.background`],r=e.colors?.[`editor.foreground`],i=n?X(n):void 0,a=r?X(r):void 0;if(!i||!a)throw Error(`Theme "${t}" is missing editor.background/editor.foreground`);let o=e.tokenColors??[];return xe({...e,name:t,fg:a,bg:i,settings:o},t)},Ce=e=>ye(e),$=e=>{let t=Z.get(e.metadata.id);if(t)return t;let n=Se(Ce(e),e.metadata.id);return Z.set(e.metadata.id,n),n},we=e=>{let t=e.metadata.id;if(Q.has(t))return;let n=$(e);p(t,async()=>n),Q.add(t)};export{W as a,ne as c,me as i,se as l,$ as n,U as o,pe as r,D as s,we as t,C as u};
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{$ as t,J as n,K as r,Q as i,X as a,Y as o,Z as s,nt as c,q as l,rt as u}from"./vendor-base-ui-CnHfUmDN.js";import{n as d}from"./vendor-react-DLPElpoQ.js";import{n as f}from"./clipboard-DyCy8o-j.js";import{t as p}from"./utils-CJdWZupK.js";import{n as m}from"./Icon-BAf2hhrw.js";var h=d(),g=e(u(),1),_=c(),v=0;function y(e,t){return e&&g.isValidElement(t)?{render:t}:{children:t}}function b(e){let t=(0,h.c)(4),r;t[0]===e?r=t[1]:({...r}=e,t[0]=e,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,_.jsx)(n,{...r}),t[2]=r,t[3]=i),i}function x(e){let t=(0,h.c)(10),n,i,a;t[0]===e?(n=t[1],i=t[2],a=t[3]):({asChild:n,children:i,...a}=e,t[0]=e,t[1]=n,t[2]=i,t[3]=a);let o;t[4]!==n||t[5]!==i?(o=y(n,i),t[4]=n,t[5]=i,t[6]=o):o=t[6];let s=o,c;return t[7]!==a||t[8]!==s?(c=(0,_.jsx)(r,{"data-slot":`dialog-trigger`,...a,...s}),t[7]=a,t[8]=s,t[9]=c):c=t[9],c}function S(e){let t=(0,h.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,_.jsx)(o,{...n}),t[2]=n,t[3]=r),r}var C=g.forwardRef((e,n)=>{let r=(0,h.c)(10),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=[],r[3]=o):o=r[3],g.useEffect(A,o);let s=n,c;r[4]===i?c=r[5]:(c=p(`fixed inset-0 z-50 bg-black/50 dark:bg-black/75`,`transition-opacity duration-150 ease-out`,`data-[starting-style]:opacity-0 data-[ending-style]:opacity-0`,i),r[4]=i,r[5]=c);let l;return r[6]!==a||r[7]!==s||r[8]!==c?(l=(0,_.jsx)(t,{ref:s,"data-slot":`dialog-overlay`,className:c,...a}),r[6]=a,r[7]=s,r[8]=c,r[9]=l):l=r[9],l});C.displayName=`DialogOverlay`;function w(e){let t=(0,h.c)(29),n,r,o,s,c,l;t[0]===e?(n=t[1],r=t[2],o=t[3],s=t[4],c=t[5],l=t[6]):({className:r,overlayClassName:s,containerClassName:o,children:n,showCloseButton:l,...c}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=o,t[4]=s,t[5]=c,t[6]=l);let u=l===void 0||l,{t:d}=f(),g;t[7]===s?g=t[8]:(g=p(`rounded-none`,s),t[7]=s,t[8]=g);let v;t[9]===g?v=t[10]:(v=(0,_.jsx)(C,{className:g}),t[9]=g,t[10]=v);let y=o??`items-center p-4`,b;t[11]===y?b=t[12]:(b=p(`fixed inset-0 z-50 flex justify-center pointer-events-none`,y),t[11]=y,t[12]=b);let x;t[13]===r?x=t[14]:(x=p(`relative pointer-events-auto bg-background text-foreground flex flex-col w-full max-w-lg max-h-full gap-4 rounded-xl border p-6 shadow-none overflow-y-auto pwa-dialog-content origin-center`,`transition-all duration-150 ease-out`,`data-[starting-style]:opacity-0 data-[starting-style]:scale-[0.98]`,`data-[ending-style]:opacity-0 data-[ending-style]:scale-[0.98]`,`data-[nested-dialog-open]:brightness-[0.55] dark:data-[nested-dialog-open]:brightness-[0.4]`,r),t[13]=r,t[14]=x);let w;t[15]!==u||t[16]!==d?(w=u&&(0,_.jsxs)(i,{"data-slot":`dialog-close`,className:`ring-offset-background focus:ring-ring data-[open]:bg-interactive-active data-[open]:text-foreground absolute top-2 right-2 rounded-lg opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none text-muted-foreground hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,_.jsx)(m,{name:`close`}),(0,_.jsx)(`span`,{className:`sr-only`,children:d(`dialog.common.actions.close`)})]}),t[15]=u,t[16]=d,t[17]=w):w=t[17];let T;t[18]!==n||t[19]!==c||t[20]!==x||t[21]!==w?(T=(0,_.jsxs)(a,{"data-slot":`dialog-content`,"data-state-slot":`dialog`,className:x,...c,children:[n,w]}),t[18]=n,t[19]=c,t[20]=x,t[21]=w,t[22]=T):T=t[22];let E;t[23]!==b||t[24]!==T?(E=(0,_.jsx)(`div`,{className:b,children:T}),t[23]=b,t[24]=T,t[25]=E):E=t[25];let D;return t[26]!==v||t[27]!==E?(D=(0,_.jsxs)(S,{children:[v,E]}),t[26]=v,t[27]=E,t[28]=D):D=t[28],D}function T(e){let t=(0,h.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=p(`flex flex-col gap-2 text-center sm:text-left`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,_.jsx)(`div`,{"data-slot":`dialog-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function E(e){let t=(0,h.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=p(`flex flex-col-reverse gap-2 bottom-safe-area sm:flex-row sm:justify-end`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,_.jsx)(`div`,{"data-slot":`dialog-footer`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function D(e){let t=(0,h.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=p(`typography-markdown leading-none font-semibold text-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,_.jsx)(l,{"data-slot":`dialog-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function O(e){let t=(0,h.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=p(`text-muted-foreground typography-ui-label`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,_.jsx)(s,{"data-slot":`dialog-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function k(){v=Math.max(0,v-1),v===0&&document.documentElement.classList.remove(`oc-dialog-open`)}function A(){return v+=1,document.documentElement.classList.add(`oc-dialog-open`),k}export{T as a,E as i,w as n,D as o,O as r,x as s,b as t};
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{A as t,E as n,b as r,t as i,y as a}from"./useUIStore-Wyu09VUF.js";import{$t as o,D as s,d as c,k as l,u,xn as d}from"./persistence-aCOlo6ew.js";import{a as f,i as p,r as m}from"./vendor-zustand-B4dlGEM2.js";import{nt as h,rt as g}from"./vendor-base-ui-CnHfUmDN.js";import{B as _,Ct as v,M as y,Mt as b}from"./platform-DxNH_0Fj.js";import{n as x}from"./vendor-react-DLPElpoQ.js";import{s as S}from"./vendor-tanstack-react-query-D7pys_c9.js";import{n as C}from"./vendor-reactuses-core-DDoDDyM9.js";import{n as ee}from"./clipboard-DyCy8o-j.js";import{To as w,_ as te,_r as ne,b as re,co as ie,ct as ae,dt as T,l as E,oa as D,pn as O,rn as oe,st as se,ut as k,wo as ce}from"./useMobileNavigationStore-DkBMOv1J.js";import{c as A,t as j}from"./utils-CJdWZupK.js";import{n as M}from"./Icon-BAf2hhrw.js";import{g as N,v as P}from"./gitApi-BZs3g7kL.js";import{A as le,M as F,p as I,s as ue}from"./projectMeta-Ct-WdvZL.js";var L=e(g(),1),R=e=>{if(!e)return``;let t=e.replace(/\\/g,`/`),n=t.startsWith(`//`),r=t.replace(/\/+/g,`/`);n&&!r.startsWith(`//`)&&(r=`/${r}`);let i=r===`/`,a=/^[A-Za-z]:\/$/.test(r);return!i&&!a&&(r=r.replace(/\/+$/,``)),r},z=e=>/^[A-Za-z]:\//.test(e)?e.toLowerCase():e,B=(e,t)=>{let n=R(t),r=R(e);if(!n||!r)return!1;let i=z(n),a=z(r);return a===i||a.startsWith(`${i}/`)},de=e=>{if(!e||typeof e!=`object`)return{};let t=e,n={};for(let[e,r]of Object.entries(t)){let t=R(e);if(!t||!r||typeof r!=`object`)continue;let i=r,a=Array.isArray(i.openPaths)?Array.from(new Set(i.openPaths.filter(e=>typeof e==`string`).map(e=>R(e)).filter(e=>B(e,t)))):[],o=Array.isArray(i.expandedPaths)?Array.from(new Set(i.expandedPaths.filter(e=>typeof e==`string`).map(e=>R(e)).filter(e=>B(e,t)))):[],s=typeof i.selectedPath==`string`?R(i.selectedPath):null,c=s&&B(s,t)?s:a[0]??null,l=typeof i.touchedAt==`number`&&Number.isFinite(i.touchedAt)?i.touchedAt:Date.now(),u=n[t];if(u){let e=Array.from(new Set([...u.openPaths,...a])),r=Array.from(new Set([...u.expandedPaths,...o]));n[t]={openPaths:e,selectedPath:u.selectedPath??c??e[0]??null,expandedPaths:r,touchedAt:Math.max(u.touchedAt,l)};continue}n[t]={openPaths:a,selectedPath:c,expandedPaths:o,touchedAt:l}}return n},V=(e,t)=>{let n=Object.entries(e);if(n.length<=t)return e;n.sort((e,t)=>(t[1]?.touchedAt??0)-(e[1]?.touchedAt??0));let r={};for(let[e,i]of n.slice(0,t))r[e]=i;return r},H=e=>e?{...e,touchedAt:Date.now()}:{openPaths:[],selectedPath:null,expandedPaths:[],touchedAt:Date.now()},fe=f()(m(p((e,t)=>({byRoot:{},addOpenPath:(t,n,r)=>{let i=R((t||``).trim()),a=R((n||``).trim());!i||!a||!r?.allowOutsideRoot&&!B(a,i)||e(e=>{let t=e.byRoot[i],n=H(t),r=n.openPaths.includes(a),o=r?n.openPaths:[...n.openPaths,a],s=n.selectedPath??a;return t&&r&&t.selectedPath===s?e:{byRoot:V({...e.byRoot,[i]:{...n,openPaths:o,selectedPath:s}},20)}})},removeOpenPath:(t,n)=>{let r=R((t||``).trim()),i=R((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=z(i),a=e=>z(e)===n,o=t.selectedPath?a(t.selectedPath):!1;if(!t.openPaths.some(a)&&!o)return e;let s=t.openPaths.filter(e=>!a(e)),c=o?s[0]??null:t.selectedPath;return{byRoot:V({...e.byRoot,[r]:{...t,openPaths:s,selectedPath:c,touchedAt:Date.now()}},20)}})},removeOpenPathsByPrefix:(t,n)=>{let r=R((t||``).trim()),i=R((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=z(i),a=n.endsWith(`/`)?n:`${n}/`,o=e=>{let t=z(e);return t===n||t.startsWith(a)},s=t.openPaths.filter(e=>!o(e));if(s.length===t.openPaths.length)return e;let c=t.selectedPath&&o(t.selectedPath)?s[0]??null:t.selectedPath;return{byRoot:V({...e.byRoot,[r]:{...t,openPaths:s,selectedPath:c,touchedAt:Date.now()}},20)}})},removeExpandedPathsByPrefix:(t,n)=>{let r=R((t||``).trim()),i=R((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=z(i),a=n.endsWith(`/`)?n:`${n}/`,o=t.expandedPaths.filter(e=>{let t=z(e);return t!==n&&!t.startsWith(a)});return o.length===t.expandedPaths.length?e:{byRoot:V({...e.byRoot,[r]:{...t,expandedPaths:o,touchedAt:Date.now()}},20)}})},setSelectedPath:(t,n,r)=>{let i=R((t||``).trim()),a=n?R(n.trim()):null;!i||a&&!r?.allowOutsideRoot&&!B(a,i)||e(e=>{let t=e.byRoot[i],n=H(t),r=a&&!n.openPaths.includes(a)?[...n.openPaths,a]:n.openPaths;return t&&t.selectedPath===a&&r===t.openPaths?e:{byRoot:V({...e.byRoot,[i]:{...n,openPaths:r,selectedPath:a}},20)}})},ensureSelectedPath:e=>{let n=R((e||``).trim());if(!n)return;let r=t().byRoot[n];if(!r||r.selectedPath)return;let i=r.openPaths[0]??null;i&&t().setSelectedPath(n,i)},toggleExpandedPath:(t,n)=>{let r=R((t||``).trim()),i=R((n||``).trim());!r||!i||!B(i,r)||e(e=>{let t=e.byRoot[r],n=H(t),a=n.expandedPaths.includes(i)?n.expandedPaths.filter(e=>e!==i):[...n.expandedPaths,i];return t&&t.expandedPaths===a&&t.selectedPath===n.selectedPath&&t.openPaths===n.openPaths?e:{byRoot:V({...e.byRoot,[r]:{...n,expandedPaths:a}},20)}})},expandPath:(t,n)=>{let r=R((t||``).trim()),i=R((n||``).trim());!r||!i||!B(i,r)||e(e=>{let t=e.byRoot[r],n=H(t);return n.expandedPaths.includes(i)&&t?e:{byRoot:V({...e.byRoot,[r]:{...n,expandedPaths:[...n.expandedPaths,i]}},20)}})},expandPaths:(t,n)=>{let r=R((t||``).trim());if(!r||!n||n.length===0)return;let i=n.map(e=>R((e||``).trim())).filter(e=>e&&B(e,r));i.length!==0&&e(e=>{let t=e.byRoot[r],n=H(t),a=new Set(n.expandedPaths),o=i.filter(e=>!a.has(e));return o.length===0?e:{byRoot:V({...e.byRoot,[r]:{...n,expandedPaths:[...n.expandedPaths,...o]}},20)}})}}),{name:`files-view-tabs-store`,version:2,storage:a(),migrate:e=>{if(!e||typeof e!=`object`)return{byRoot:{}};let t=e.byRoot;return{byRoot:de(t)}},partialize:e=>({byRoot:de(e.byRoot)})}),{name:`files-view-tabs-store`})),U=x(),pe=(e,t)=>{let n=(0,U.c)(4),r=t===void 0?200:t,[i,a]=L.useState(e),o,s;return n[0]!==r||n[1]!==e?(o=()=>{let t=window.setTimeout(()=>{a(e)},r);return()=>{window.clearTimeout(t)}},s=[e,r],n[0]=r,n[1]=e,n[2]=o,n[3]=s):(o=n[2],s=n[3]),L.useEffect(o,s),i},me=()=>{let e=(0,U.c)(17),t=E(W),n=O(),r;e[0]===t?r=e[1]:(r=e=>t?e.getAttachment(t):void 0,e[0]=t,e[1]=r);let i=re(r),a=E(G),o=E(he),s=w(K),c=w(ge),l=v(_e);if(t){let r;e[2]===i?r=e[3]:(r=te(i),e[2]=i,e[3]=r);let o=r;if(o)return o;let s;e[4]!==t||e[5]!==a?(s=a.get(t),e[4]=t,e[5]=a,e[6]=s):s=e[6];let c=s;if(c?.path)return c.path;let l;if(e[7]!==t||e[8]!==n){let r;e[10]===t?r=e[11]:(r=e=>e.id===t,e[10]=t,e[11]=r),l=n.find(r),e[7]=t,e[8]=n,e[9]=l}else l=e[9];let u=l;if(u?.directory)return u.directory}if(o?.open&&(o.bootstrapPendingDirectory||o.directoryOverride))return(o.bootstrapPendingDirectory||o.directoryOverride)??void 0;if(s){let t;if(e[12]!==s||e[13]!==c){let n;e[15]===s?n=e[16]:(n=e=>e.id===s,e[15]=s,e[16]=n),t=c.find(n),e[12]=s,e[13]=c,e[14]=t}else t=e[14];let n=t;if(n?.path)return n.path}return l??void 0};function W(e){return e.currentSessionId}function G(e){return e.worktreeMetadata}function he(e){return e.newSessionDraft}function K(e){return e.activeProjectId}function ge(e){return e.projects}function _e(e){return e.currentDirectory}var ve=.4,q=8,J=e=>{let t=e.gap??q,n=Math.max(0,e.popupBottom-e.boundaryTop-t),r=e.viewportHeight*ve,i=Math.floor(Math.min(n,r));return n>=120?Math.min(n,Math.max(120,i)):i},Y=(e,t=0)=>{let n=e.closest(`main`);if(!n)return null;let r=(e.closest(`.mobile-chat-screen__content`)?.parentElement??n.parentElement?.closest(`main`)??n).querySelector(`:scope > .oc-mobile-detail-navigation`)?.getBoundingClientRect().bottom,i=n.getBoundingClientRect().top;return Math.max(r===void 0?i:Math.max(r,i),t)},ye=(e,t)=>{let n=(0,U.c)(3),[r,i]=L.useState(void 0),a;return n[0]!==e||n[1]!==t?(a=()=>{if(!t)return;let n=()=>{let t=e.current;if(!t)return;let n=window.visualViewport,r=Y(t,n?.offsetTop??0);if(r===null)return;let a=n?.height??window.innerHeight,o=J({popupBottom:t.getBoundingClientRect().bottom,boundaryTop:r,viewportHeight:a});i(e=>e===o?e:o)};return n(),window.addEventListener(`resize`,n),window.addEventListener(`oc:keyboard-settled`,n),window.visualViewport?.addEventListener(`resize`,n),window.visualViewport?.addEventListener(`scroll`,n),()=>{window.removeEventListener(`resize`,n),window.removeEventListener(`oc:keyboard-settled`,n),window.visualViewport?.removeEventListener(`resize`,n),window.visualViewport?.removeEventListener(`scroll`,n)}},n[0]=e,n[1]=t,n[2]=a):a=n[2],L.useLayoutEffect(a),t?r:void 0},be=()=>{let e=null,t=!1,n=!1;return{pointerDown:(n,r)=>{e={x:n,y:r},t=!1},pointerMove:(n,r)=>{e&&Math.hypot(n-e.x,r-e.y)>6&&(t=!0)},pointerCancel:()=>{e=null,t=!1},pointerUp:r=>{if(!e)return!1;let i=!t;return e=null,t=!1,i?(n=!0,r(),!0):(n=!0,!1)},click:e=>n?(n=!1,!1):(e(),!0)}},X=h(),Z=L.forwardRef(({searchQuery:e,onFileSelect:t,onAgentSelect:n,onSessionSelect:r,onClose:a,style:o},c)=>{let{t:u}=ee(),d=me()??``,f=E(e=>e.currentSessionId),p=ne(e=>e.activeSessions),m=w(e=>e.activeProjectId),h=w(e=>e.projects),g=L.useMemo(()=>h.find(e=>e.id===m)?.path??null,[m,h]),_=L.useMemo(()=>{let e=g||d;return e?e.replace(/\\/g,`/`).replace(/\/+$/,``):null},[g,d]),v=fe(e=>_?e.byRoot[_]:void 0),y=D(e=>e.getVisibleAgents),x=b(e=>e.searchFiles),S=pe(e,180),te=l(),re=s(),[ie,T]=L.useState([]),[O,oe]=L.useState([]),[ce,N]=L.useState(!1),[P,F]=L.useState(0),I=L.useRef(0),[ue,R]=L.useState(360),[z,B]=L.useState({}),[de,V]=L.useState({}),H=L.useRef([]),U=L.useRef([]),W=L.useRef([]),G=L.useRef(null),he=L.useRef(null);he.current||=be();let K=i(e=>e.isMobile),ge=ye(G,K),_e=(e??``).trim(),ve=L.useMemo(()=>{if(!_||!v)return[];let e=[v.selectedPath,...v.openPaths.slice().reverse()].filter(e=>typeof e==`string`&&e.length>0),t=new Set,n=_e.toLowerCase();return e.filter(e=>{if(t.has(e))return!1;t.add(e);let r=e.startsWith(`${_}/`)?e.slice(_.length+1):e;return!n||r.toLowerCase().includes(n)}).slice(0,6).map(e=>{let t=e.replace(/\\/g,`/`),n=t.split(`/`).filter(Boolean).pop()||t;return{name:n,path:t,relativePath:t.startsWith(`${_}/`)?t.slice(_.length+1):t,extension:n.includes(`.`)?n.split(`.`).pop()?.toLowerCase():void 0}})},[_e,_,v]),q=L.useMemo(()=>_e.length>0?O:O.slice(0,2),[O,_e.length]),J=L.useMemo(()=>r?se({sessions:p,currentSessionId:f,searchQuery:_e}):[],[p,f,_e,r]),Y=ve,Z=ie;L.useEffect(()=>{let e=e=>{let t=e.target;!t||!G.current||G.current.contains(t)||a()};return document.addEventListener(`pointerdown`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0)}},[a]),L.useEffect(()=>{if(!d){T([]);return}let e=(S??``).trim(),t=k(e);if(!t){T([]);return}let n=!1;N(!0);let r={includeHidden:te,respectGitignore:!re};return Promise.all([x(d,t,80,{...r,type:`file`}),x(d,t,40,{...r,type:`directory`})]).then(([t,r])=>{if(n)return;let i=new Set(ve.map(e=>e.path));T(ae({files:t,directories:r,query:e,excludePaths:i,limit:20}))}).catch(()=>{n||T([])}).finally(()=>{n||N(!1)}),()=>{n=!0}},[d,S,ve,x,te,re]),L.useEffect(()=>{let t=y(),n=(e??``).trim().toLowerCase(),r=t.filter(e=>e.mode&&e.mode!==`primary`).filter(e=>!n||`${e.name} ${e.description??``}`.toLowerCase().includes(n)).map(e=>({name:e.name,description:e.description,mode:e.mode})).sort((e,t)=>e.name.localeCompare(t.name));oe(r)},[y,e]),L.useEffect(()=>{F(0),B({}),V({})},[Z,Y.length,q.length,J.length]),L.useEffect(()=>{I.current=P},[P]),L.useEffect(()=>{H.current[P]?.scrollIntoView({block:`nearest`})},[P]),L.useEffect(()=>{let e=null,t=()=>{e!==null&&cancelAnimationFrame(e),e=requestAnimationFrame(()=>{let e={},t={};U.current.forEach((n,r)=>{if(!n)return;let i=W.current[r]?.offsetWidth??n.scrollWidth,a=Math.max(0,i-n.clientWidth),o=a>8;if(e[r]=o,o){let e=Math.max(.6,a/110);t[r]=e}}),B(e),V(t)})};return t(),window.addEventListener(`resize`,t),()=>{e!==null&&cancelAnimationFrame(e),window.removeEventListener(`resize`,t)}},[Z,Y]),L.useEffect(()=>{let e=U.current[P];if(!e)return;let t=()=>{let t=e.clientWidth;t>0&&R(t)};if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>{n.disconnect()}},[P]);let xe=C(e=>{t(e)}),Se=C(e=>{n?.(e)}),Ce=C(e=>{r?.(e)}),we=(e,t)=>({onMouseDown:e=>e.preventDefault(),onPointerDown:e=>{e.pointerType===`touch`&&he.current?.pointerDown(e.clientX,e.clientY)},onPointerMove:e=>{e.pointerType===`touch`&&he.current?.pointerMove(e.clientX,e.clientY)},onPointerUp:e=>{e.pointerType===`touch`&&(he.current?.pointerUp(t)??!1)&&(e.preventDefault(),e.stopPropagation())},onPointerCancel:()=>he.current?.pointerCancel(),onClick:()=>{he.current?.click(t)},onMouseMove:()=>F(e)});L.useImperativeHandle(c,()=>({handleKeyDown:e=>{if(e===`Escape`){a();return}let t=q.length+J.length+Y.length+Z.length;if(t!==0){if(e===`ArrowDown`){F(e=>(e+1)%t);return}if(e===`ArrowUp`){F(e=>(e-1+t)%t);return}if(e===`Enter`||e===`Tab`){let e=(I.current%t+t)%t;if(e<q.length){let t=q[e];t&&Se(t.name);return}let n=e-q.length;if(n<J.length){let e=J[n];e&&Ce(e);return}let r=n-J.length,i=r<Y.length?Y[r]:Z[r-Y.length];i&&xe(i)}}}}),[Z,Y,q,J,a,xe,Se,Ce]);let Te=e=>{if(e.isDirectory)return(0,X.jsx)(M,{name:`folder-3-fill`,className:`h-3.5 w-3.5 text-current`});switch(e.extension?.toLowerCase()){case`ts`:case`tsx`:case`js`:case`jsx`:return(0,X.jsx)(M,{name:`code`,className:`h-3.5 w-3.5 text-current`});case`json`:return(0,X.jsx)(M,{name:`code`,className:`h-3.5 w-3.5 text-current`});case`md`:case`mdx`:return(0,X.jsx)(M,{name:`file`,className:`h-3.5 w-3.5 text-current`});case`png`:case`jpg`:case`jpeg`:case`gif`:case`svg`:return(0,X.jsx)(M,{name:`file-image`,className:`h-3.5 w-3.5 text-current`});default:return(0,X.jsx)(M,{name:`file-pdf`,className:`h-3.5 w-3.5 text-current`})}};return(0,X.jsxs)(`div`,{ref:G,className:`absolute z-[100] min-w-0 w-full max-w-[640px] max-h-64 bg-background border-2 border-border/60 rounded-xl shadow-none bottom-full mb-2 left-0 flex flex-col`,style:ge===void 0?o:{...o,maxHeight:ge},children:[(0,X.jsx)(le,{preventOverscroll:!0,outerClassName:`flex-1 min-h-0`,className:`px-0`,children:(0,X.jsxs)(`div`,{className:`pb-2`,children:[q.length>0&&(0,X.jsx)(`div`,{className:`px-3 pb-1 pt-2 typography-meta font-medium text-muted-foreground`,children:u(`chat.fileMentionAutocomplete.groups.agents`)}),q.map((e,t)=>(0,X.jsx)(`div`,{ref:e=>{H.current[t]=e},className:j(`flex items-start gap-2 px-3 py-1.5 cursor-pointer typography-ui-label rounded-lg`,K&&`min-h-11`,P===t&&`bg-interactive-selection text-interactive-selection-foreground`),...we(t,()=>Se(e.name)),children:(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`font-semibold truncate`,children:[`@`,e.name]}),e.description&&!K?(0,X.jsx)(`div`,{className:`typography-meta text-muted-foreground truncate`,children:e.description}):null]})},`agent-${e.name}`)),q.length===2&&_e.length===0&&O.length>2&&(0,X.jsx)(`div`,{className:`px-3 py-1 typography-meta text-muted-foreground`,children:u(`chat.fileMentionAutocomplete.searchMoreAgents`)}),J.length>0&&(0,X.jsx)(`div`,{className:`px-3 pb-1 pt-2 typography-meta font-medium text-muted-foreground`,children:u(`chat.fileMentionAutocomplete.groups.sessions`)}),J.map((e,t)=>{let n=q.length+t;return(0,X.jsxs)(`div`,{ref:e=>{H.current[n]=e},className:j(`flex items-center gap-2 px-3 py-1.5 cursor-pointer typography-ui-label rounded-lg`,K&&`min-h-11`,P===n&&`bg-interactive-selection text-interactive-selection-foreground`),...we(n,()=>Ce(e)),children:[(0,X.jsx)(M,{name:`chat-thread`,className:`h-4 w-4 flex-shrink-0 text-[var(--primary-base)]`}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.title||u(`chat.fileMentionAutocomplete.untitledSession`),children:e.title||u(`chat.fileMentionAutocomplete.untitledSession`)}),K?null:(0,X.jsx)(`span`,{className:`flex-shrink-0 typography-meta text-muted-foreground`,children:u(`chat.fileMentionAutocomplete.sessionType`)})]},`session-${e.id}`)}),Y.length>0&&(0,X.jsx)(`div`,{className:`px-3 pb-1 pt-2 typography-meta font-medium text-muted-foreground`,children:u(`chat.fileMentionAutocomplete.groups.recentFiles`)}),Y.map((e,t)=>{let n=q.length+J.length+t,r=e.relativePath||e.name,i=A(r,{maxLength:60}),a=P===n,o=z[n]??!1,s=de[n]??2.6;return(0,X.jsxs)(`div`,{ref:e=>{H.current[n]=e},className:j(`flex items-center gap-2 px-3 py-1.5 cursor-pointer typography-ui-label rounded-lg`,K&&`min-h-11`,a&&`bg-interactive-selection text-interactive-selection-foreground`),...we(n,()=>xe(e)),children:[Te(e),(0,X.jsxs)(`span`,{ref:e=>{U.current[n]=e},className:`relative flex-1 min-w-0 overflow-hidden file-mention-marquee-container`,style:a?{"--file-mention-marquee-width":`${ue}px`,"--file-mention-marquee-duration":`${s}s`}:void 0,"aria-label":r,children:[(0,X.jsx)(`span`,{ref:e=>{W.current[n]=e},className:`absolute invisible whitespace-nowrap pointer-events-none`,"aria-hidden":!0,children:r}),o&&a?(0,X.jsx)(`span`,{className:`inline-block whitespace-nowrap file-mention-marquee`,children:r}):(0,X.jsx)(`span`,{className:`block truncate`,children:i})]})]},`recent-${e.path}`)}),Z.length>0&&(0,X.jsx)(`div`,{className:`px-3 pb-1 pt-2 typography-meta font-medium text-muted-foreground`,children:u(`chat.fileMentionAutocomplete.groups.files`)}),Z.map((e,t)=>{let n=q.length+J.length+Y.length+t,r=e.relativePath||e.name,i=A(r,{maxLength:60}),a=P===n,o=z[n]??!1,s=de[n]??2.6;return(0,X.jsxs)(`div`,{ref:e=>{H.current[n]=e},className:j(`flex items-center gap-2 px-3 py-1.5 cursor-pointer typography-ui-label rounded-lg`,K&&`min-h-11`,a&&`bg-interactive-selection text-interactive-selection-foreground`),...we(n,()=>xe(e)),children:[Te(e),(0,X.jsxs)(`span`,{ref:e=>{U.current[n]=e},className:`relative flex-1 min-w-0 overflow-hidden file-mention-marquee-container`,style:a?{"--file-mention-marquee-width":`${ue}px`,"--file-mention-marquee-duration":`${s}s`}:void 0,"aria-label":r,children:[(0,X.jsx)(`span`,{ref:e=>{W.current[n]=e},className:`absolute invisible whitespace-nowrap pointer-events-none`,"aria-hidden":!0,children:r}),o&&a?(0,X.jsx)(`span`,{className:`inline-block whitespace-nowrap file-mention-marquee`,children:r}):(0,X.jsx)(`span`,{className:`block truncate`,children:i})]})]},e.path)}),ce&&Z.length===0?(0,X.jsx)(`div`,{className:`flex items-center justify-center py-3`,children:(0,X.jsx)(M,{name:`refresh`,className:`h-4 w-4 animate-spin text-muted-foreground`})}):null,!ce&&Z.length===0&&Y.length===0&&q.length===0&&J.length===0&&(0,X.jsx)(`div`,{className:`px-3 py-2 typography-ui-label text-muted-foreground`,children:u(`chat.fileMentionAutocomplete.empty`)})]})}),!K&&(0,X.jsx)(`div`,{className:`px-3 pt-1 pb-1.5 border-t typography-meta text-muted-foreground`,children:u(`chat.autocomplete.keyboardHint`)})]})}),xe=new Set([`new`,`fork`,`compact`,`undo`,`redo`,`model`,`goal`]),Se=(e,t)=>{if(!t||e.isSkill)return!1;let n=e.name?.trim().toLowerCase();return!!(n&&xe.has(n))},Ce=(e,t)=>!e||t({name:e}),we=` `,Te=(e,t)=>{let n=Math.max(0,Math.min(t,e.length)),r=n;for(;r>0&&!/\s/.test(e[r-1]);)--r;return r>=2&&e[r-1]===we&&e[r-2]===`/`&&(r-=2),e[r]===`/`?{start:r,end:n}:null},Ee=`text-[10px] leading-none uppercase font-bold tracking-tight px-1.5 py-1 rounded border flex-shrink-0`,De=j(Ee,`bg-[color-mix(in_srgb,var(--primary-base)_12%,transparent)] text-[color-mix(in_srgb,var(--primary-base)_70%,transparent)] border-[color-mix(in_srgb,var(--primary-base)_24%,transparent)]`),Oe=j(Ee,`bg-[color-mix(in_srgb,var(--status-success)_12%,transparent)] text-[color-mix(in_srgb,var(--status-success)_70%,transparent)] border-[color-mix(in_srgb,var(--status-success)_24%,transparent)]`),ke=j(Ee,`bg-[color-mix(in_srgb,var(--status-info)_12%,transparent)] text-[color-mix(in_srgb,var(--status-info)_70%,transparent)] border-[color-mix(in_srgb,var(--status-info)_24%,transparent)]`),Ae=j(Ee,`bg-[var(--surface-muted)] text-muted-foreground border-[var(--interactive-border)]/60`),je=(e,t)=>{let n=t.trim();if(!n)return[...e].sort((e,t)=>e.isBuiltIn===t.isBuiltIn?e.name.localeCompare(t.name):e.isBuiltIn?-1:1);let r=T(e,n,e=>[e.name,e.description??``]);return r.sort((e,t)=>e.score===t.score?e.item.isBuiltIn===t.item.isBuiltIn?e.item.name.localeCompare(t.item.name):e.item.isBuiltIn?-1:1:e.score-t.score),r.map(e=>e.item)},Me=(e,t)=>{let n=!!e.sessionID;return{hasSession:n,canStartSessionCommand:n||e.hasNewDraft,canUseReviewHandoffFlow:n&&!t&&!o()}},Ne=L.forwardRef(({searchQuery:e,onCommandSelect:t,onClose:n,directory:r,style:a,commandPolicy:o,commandContext:s},c)=>{let{t:l}=ee(),u=i(e=>e.isMobile),d=E(e=>e.currentSessionId),f=E(e=>!!e.newSessionDraft?.open),p=E(L.useCallback(e=>d?e.getDirectoryForSession(d):void 0,[d])),m=oe(d??``,p??void 0),h=L.useMemo(()=>s??{sessionID:d??null,hasMessages:m.length>0,hasNewDraft:f},[s,d,m.length,f]),{hasSession:g,canStartSessionCommand:_,canUseReviewHandoffFlow:v}=L.useMemo(()=>Me(h,u),[h,u]),y=h.hasMessages,[b,x]=L.useState([]),[S,C]=L.useState(!1),w=ce({directory:r}),te=L.useMemo(()=>w.data??[],[w.data]),ne=w.isFetching,re=ie({directory:r}),ae=L.useMemo(()=>re.data??[],[re.data]),[T,D]=L.useState(0),O=L.useRef(0),se=L.useRef(!1),k=L.useRef([]),A=L.useRef(null),N=ye(A,u),P=L.useRef(!1),F=L.useRef(null),I=L.useRef(!1);L.useEffect(()=>{let e=e=>{let t=e.target;!t||!A.current||A.current.contains(t)||n()};return document.addEventListener(`pointerdown`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0)}},[n]),L.useEffect(()=>{(async()=>{C(ne);try{let t=te.map((e,t)=>({id:`opencode:${e.scope??`global`}:${e.name}:${e.agent??``}:${e.model??``}:${t}`,name:e.name,source:`opencode`,description:e.description,agent:e.agent??void 0,model:e.model??void 0,isBuiltIn:e.isBuiltIn,isSkill:e.source===`skill`,scope:e.scope,reference:e.reference})),n=ae.map((e,t)=>({id:`skill:${e.scope}:${e.source??`opencode`}:${e.name}:${t}`,name:e.name,source:`skill`,description:e.description,isSkill:!0,scope:e.scope})),r=[{id:`openchamber:new`,name:`new`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.newDescription`),isBuiltIn:!0},...g&&!y?[{id:`openchamber:init`,name:`init`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.initDescription`),isBuiltIn:!0}]:[],...g?[{id:`openchamber:undo`,name:`undo`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.undoDescription`),isBuiltIn:!0},{id:`openchamber:redo`,name:`redo`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.redoDescription`),isBuiltIn:!0},{id:`openchamber:fork`,name:`fork`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.forkDescription`),isBuiltIn:!0},{id:`openchamber:timeline`,name:`timeline`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.timelineDescription`),isBuiltIn:!0}]:[],{id:`openchamber:model`,name:`model`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.modelDescription`),isBuiltIn:!0},{id:`openchamber:compact`,name:`compact`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.compactDescription`),isBuiltIn:!0},...g?[{id:`openchamber:summary`,name:`summary`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.summaryDescription`),isOpenChamber:!0}]:[],..._?[{id:`openchamber:workspace-review`,name:`workspace-review`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.workspaceReviewDescription`),isOpenChamber:!0}]:[],...v?[{id:`openchamber:handoff-review`,name:`handoff-review`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.handoffReviewDescription`),isOpenChamber:!0}]:[],..._?[{id:`openchamber:plan-feature`,name:`plan-feature`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.featurePlanDescription`),isOpenChamber:!0}]:[],..._?[{id:`openchamber:craft-goal`,name:`craft-goal`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.craftGoalDescription`),isOpenChamber:!0}]:[],..._?[{id:`openchamber:goal`,name:`goal`,source:`openchamber`,description:l(`chat.goal.button.armAria`),isBuiltIn:!0}]:[],..._?[{id:`openchamber:catch-up`,name:`catch-up`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.catchUpDescription`),isOpenChamber:!0}]:[],..._?[{id:`openchamber:debug`,name:`debug`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.debugDescription`),isOpenChamber:!0}]:[],..._?[{id:`openchamber:weigh`,name:`weigh`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.weighDescription`),isOpenChamber:!0}]:[],..._?[{id:`openchamber:explore`,name:`explore`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.exploreDescription`),isOpenChamber:!0}]:[],...t,...n],i=!y,a=r.filter(e=>(i||e.name!==`init`)&&(o?.(e)??!0));x(je(a,e))}catch{let t=!y,n=[{id:`openchamber:new`,name:`new`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.newDescription`),isBuiltIn:!0},...g&&!y?[{id:`openchamber:init`,name:`init`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.initDescription`),isBuiltIn:!0}]:[],...g?[{id:`openchamber:undo`,name:`undo`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.undoDescription`),isBuiltIn:!0},{id:`openchamber:redo`,name:`redo`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.redoDescription`),isBuiltIn:!0},{id:`openchamber:fork`,name:`fork`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.forkDescription`),isBuiltIn:!0},{id:`openchamber:timeline`,name:`timeline`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.timelineDescription`),isBuiltIn:!0}]:[],{id:`openchamber:model`,name:`model`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.modelDescription`),isBuiltIn:!0},{id:`openchamber:compact`,name:`compact`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.compactDescription`),isBuiltIn:!0},...g?[{id:`openchamber:summary`,name:`summary`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.summaryDescription`),isOpenChamber:!0}]:[],..._?[{id:`openchamber:workspace-review`,name:`workspace-review`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.workspaceReviewDescription`),isOpenChamber:!0}]:[],...v?[{id:`openchamber:handoff-review`,name:`handoff-review`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.handoffReviewDescription`),isOpenChamber:!0}]:[],..._?[{id:`openchamber:plan-feature`,name:`plan-feature`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.featurePlanDescription`),isOpenChamber:!0}]:[],..._?[{id:`openchamber:craft-goal`,name:`craft-goal`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.craftGoalDescription`),isOpenChamber:!0}]:[],..._?[{id:`openchamber:goal`,name:`goal`,source:`openchamber`,description:l(`chat.goal.button.armAria`),isBuiltIn:!0}]:[],..._?[{id:`openchamber:catch-up`,name:`catch-up`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.catchUpDescription`),isOpenChamber:!0}]:[],..._?[{id:`openchamber:debug`,name:`debug`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.debugDescription`),isOpenChamber:!0}]:[],..._?[{id:`openchamber:weigh`,name:`weigh`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.weighDescription`),isOpenChamber:!0}]:[],..._?[{id:`openchamber:explore`,name:`explore`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.exploreDescription`),isOpenChamber:!0}]:[]].filter(e=>(t||e.name!==`init`)&&(o?.(e)??!0));x(je(n,e))}finally{C(!1)}})()},[e,y,g,_,v,te,ne,ae,l,o]),L.useEffect(()=>{D(0)},[b]),L.useEffect(()=>{O.current=T},[T]),L.useEffect(()=>{k.current[T]?.scrollIntoView({block:`nearest`})},[T]),L.useImperativeHandle(c,()=>({handleKeyDown:e=>{let r=b.length;if(e===`Escape`){n();return}if(r!==0){if(e===`ArrowDown`){se.current=!0,D(e=>(e+1)%r);return}if(e===`ArrowUp`){se.current=!0,D(e=>(e-1+r)%r);return}if(e===`Enter`||e===`Tab`){let n=(O.current%r+r)%r,i=b[n];i&&t(i,Se(i,e===`Enter`))}}}}),[b,n,t]);let ue=e=>{switch(e.name){case`new`:return(0,X.jsx)(M,{name:`add`,className:`h-3.5 w-3.5`});case`init`:return(0,X.jsx)(M,{name:`file`,className:`h-3.5 w-3.5 text-green-500`});case`undo`:return(0,X.jsx)(M,{name:`arrow-go-back`,className:`h-3.5 w-3.5 text-orange-500`});case`redo`:return(0,X.jsx)(M,{name:`arrow-go-forward`,className:`h-3.5 w-3.5 text-orange-500`});case`timeline`:return(0,X.jsx)(M,{name:`time`,className:`h-3.5 w-3.5`});case`compact`:return(0,X.jsx)(M,{name:`scissors`,className:`h-3.5 w-3.5 text-purple-500`});case`goal`:return(0,X.jsx)(M,{name:`target`,className:`h-3.5 w-3.5`});case`review`:return(0,X.jsx)(M,{name:`search-eye`,className:`h-3.5 w-3.5 text-blue-500`});case`test`:case`build`:case`run`:return(0,X.jsx)(M,{name:`terminal-box`,className:`h-3.5 w-3.5 text-cyan-500`});default:return e.isBuiltIn?(0,X.jsx)(M,{name:`flashlight`,className:`h-3.5 w-3.5 text-yellow-500`}):(0,X.jsx)(M,{name:`command`,className:`h-3.5 w-3.5 text-muted-foreground`})}};return(0,X.jsxs)(`div`,{ref:A,className:`absolute z-[100] min-w-0 w-full max-w-[450px] max-h-64 bg-background border-2 border-border/60 rounded-xl shadow-none bottom-full mb-2 left-0 flex flex-col`,style:N===void 0?a:{...a,maxHeight:N},children:[(0,X.jsx)(le,{preventOverscroll:!0,outerClassName:`flex-1 min-h-0`,className:`px-0 pb-2`,children:S?(0,X.jsx)(`div`,{className:`flex items-center justify-center py-4`,children:(0,X.jsx)(M,{name:`refresh`,className:`h-4 w-4 animate-spin text-muted-foreground`})}):(0,X.jsxs)(`div`,{children:[b.map((e,n)=>{let r=e.isBuiltIn,i=e.isOpenChamber;return(0,X.jsxs)(`div`,{ref:e=>{k.current[n]=e},className:j(`flex gap-2 px-3 py-2 cursor-pointer rounded-lg`,u?`items-center`:`items-start`,n===T&&`bg-interactive-selection`),onMouseDown:e=>e.preventDefault(),onPointerDown:e=>{e.pointerType===`touch`&&(F.current={x:e.clientX,y:e.clientY},I.current=!1)},onPointerMove:e=>{if(e.pointerType!==`touch`||!F.current)return;let t=e.clientX-F.current.x,n=e.clientY-F.current.y;Math.hypot(t,n)>6&&(I.current=!0)},onPointerUp:n=>{if(n.pointerType!==`touch`)return;let r=I.current;F.current=null,I.current=!1,!r&&(n.preventDefault(),n.stopPropagation(),P.current=!0,t(e,Se(e,u)))},onPointerCancel:()=>{F.current=null,I.current=!1},onClick:()=>{if(P.current){P.current=!1;return}t(e,Se(e,u))},onMouseMove:()=>{se.current=!1,D(n)},children:[(0,X.jsx)(`div`,{className:j(!u&&`mt-0.5`),children:ue(e)}),(0,X.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsxs)(`span`,{className:`typography-ui-label font-medium`,children:[`/`,e.name]}),e.isSkill?(0,X.jsx)(`span`,{className:De,children:l(`chat.commandAutocomplete.badge.skill`)}):(0,X.jsx)(`span`,{className:De,children:l(`chat.commandAutocomplete.badge.command`)}),i?(0,X.jsx)(`span`,{className:Ae,children:`OpenChamber`}):r?(0,X.jsx)(`span`,{className:Ae,children:l(`chat.commandAutocomplete.badge.system`)}):e.scope?(0,X.jsx)(`span`,{className:e.scope===`project`?ke:Oe,children:e.scope}):null,e.agent&&(0,X.jsx)(`span`,{className:Ae,children:e.agent})]}),e.description&&!u&&(0,X.jsx)(`div`,{className:`typography-meta text-muted-foreground mt-0.5 truncate`,children:e.description})]})]},e.id)}),b.length===0&&(0,X.jsx)(`div`,{className:`px-3 py-2 typography-ui-label text-muted-foreground`,children:l(`chat.commandAutocomplete.empty`)})]})}),!u&&(0,X.jsx)(`div`,{className:`px-3 pt-1 pb-1.5 border-t typography-meta text-muted-foreground`,children:l(`chat.autocomplete.keyboardHint`)})]})});Ne.displayName=`CommandAutocomplete`;function Pe(e){return(e.description||e.content).replace(/\s+/g,` `).trim().slice(0,120)}var Fe=L.forwardRef((e,t)=>{let n=(0,U.c)(63),{searchQuery:r,onSnippetSelect:a,onClose:o,style:s}=e,{t:c}=ee(),l=L.useRef(null),u=i(Ie),d=ye(l,u),[f,p]=L.useState(0),m=L.useRef(0),h;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=[],n[0]=h):h=n[0];let[g,_]=L.useState(h),v;n[1]===Symbol.for(`react.memo_cache_sentinel`)?(v=[],n[1]=v):v=n[1];let y=L.useRef(v),b=F(Le),x=F(Re),S=F(ze),C=F(Be),w=i(Ve),te=i(He),ne,re;n[2]===x?(ne=n[3],re=n[4]):(ne=()=>{x()},re=[x],n[2]=x,n[3]=ne,n[4]=re),L.useEffect(ne,re);let ie,ae;n[5]!==r||n[6]!==b?(ie=()=>{let e=r.trim();if(!e.length){let e=[...b].sort(Ue);_(e),p(+!!e.length);return}let t=T(b,e,We);t.sort(Ge);let n=t.map(Ke);_(n),p(+!!n.length)},ae=[r,b],n[5]=r,n[6]=b,n[7]=ie,n[8]=ae):(ie=n[7],ae=n[8]),L.useEffect(ie,ae);let E,D;n[9]===f?(E=n[10],D=n[11]):(E=()=>{m.current=f,y.current[f]?.scrollIntoView({block:`nearest`})},D=[f],n[9]=f,n[10]=E,n[11]=D),L.useEffect(E,D);let O,oe;n[12]===o?(O=n[13],oe=n[14]):(oe=()=>{let e=e=>{let t=e.target;t&&l.current&&!l.current.contains(t)&&o()};return document.addEventListener(`pointerdown`,e,!0),()=>document.removeEventListener(`pointerdown`,e,!0)},O=[o],n[12]=o,n[13]=O,n[14]=oe),L.useEffect(oe,O);let se;n[15]!==a||n[16]!==r?(se=e=>{let t=r.trim(),n=e.aliases.includes(t)?t:e.name;a(e,n)},n[15]=a,n[16]=r,n[17]=se):se=n[17];let k=se,ce;n[18]!==o||n[19]!==C||n[20]!==w||n[21]!==te||n[22]!==S||n[23]!==b?(ce=()=>{let e=new Set(b.map(qe)),t=`new-snippet`,n=1;for(;e.has(t);)t=`new-snippet-${n++}`;S({name:t,scope:`global`}),C(t),te(`snippets`),w(!0),o()},n[18]=o,n[19]=C,n[20]=w,n[21]=te,n[22]=S,n[23]=b,n[24]=ce):ce=n[24];let A=ce,N,P;n[25]!==k||n[26]!==g||n[27]!==o||n[28]!==A?(N=()=>({handleKeyDown:e=>{if(e===`Escape`){o();return}let t=g.length+1;if(e===`ArrowDown`){p(e=>(e+1)%t);return}if(e===`ArrowUp`){p(e=>(e-1+t)%t);return}if(e===`Enter`||e===`Tab`){if(m.current===0){A();return}let e=g[m.current-1];e&&k(e)}}}),P=[k,g,o,A],n[25]=k,n[26]=g,n[27]=o,n[28]=A,n[29]=N,n[30]=P):(N=n[29],P=n[30]),L.useImperativeHandle(t,N,P);let I;n[31]!==d||n[32]!==s?(I=d===void 0?s:{...s,maxHeight:d},n[31]=d,n[32]=s,n[33]=I):I=n[33];let ue;n[34]===Symbol.for(`react.memo_cache_sentinel`)?(ue=e=>{y.current[0]=e},n[34]=ue):ue=n[34];let R=f===0&&`bg-interactive-selection`,z;n[35]===R?z=n[36]:(z=j(`flex items-center gap-2 px-3 py-1.5 cursor-pointer rounded-lg typography-ui-label`,R),n[35]=R,n[36]=z);let B,de;n[37]===Symbol.for(`react.memo_cache_sentinel`)?(B=()=>p(0),de=(0,X.jsx)(M,{name:`add`,className:`h-3.5 w-3.5 text-muted-foreground`}),n[37]=B,n[38]=de):(B=n[37],de=n[38]);let V;n[39]===c?V=n[40]:(V=c(`chat.snippetAutocomplete.action.addNew`),n[39]=c,n[40]=V);let H;n[41]===V?H=n[42]:(H=(0,X.jsx)(`span`,{className:`font-medium text-foreground`,children:V}),n[41]=V,n[42]=H);let fe;n[43]!==A||n[44]!==z||n[45]!==H?(fe=(0,X.jsxs)(`div`,{ref:ue,className:z,onClick:A,onMouseMove:B,children:[de,H]}),n[43]=A,n[44]=z,n[45]=H,n[46]=fe):fe=n[46];let pe;n[47]!==k||n[48]!==g||n[49]!==u||n[50]!==f||n[51]!==c?(pe=g.length?g.map((e,t)=>(0,X.jsx)(`div`,{ref:e=>{y.current[t+1]=e},className:j(`flex gap-2 px-3 py-1.5 cursor-pointer rounded-lg typography-ui-label`,u?`items-center`:`items-start`,t+1===f&&`bg-interactive-selection`),onClick:()=>k(e),onMouseMove:()=>p(t+1),children:(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsxs)(`span`,{className:`font-semibold truncate`,children:[`#`,e.name]}),(0,X.jsx)(`span`,{className:`text-[10px] leading-none uppercase font-bold tracking-tight px-1.5 py-1 rounded border flex-shrink-0 bg-[var(--surface-muted)] text-muted-foreground border-[var(--interactive-border)]/60`,children:c(`snippets.source.${e.source}`)})]}),!u&&(0,X.jsx)(`div`,{className:`typography-meta text-muted-foreground mt-0.5 truncate`,children:Pe(e)})]})},`${e.source}:${e.filePath}`)):(0,X.jsx)(`div`,{className:`px-3 py-2 typography-ui-label text-muted-foreground`,children:c(`chat.snippetAutocomplete.empty`)}),n[47]=k,n[48]=g,n[49]=u,n[50]=f,n[51]=c,n[52]=pe):pe=n[52];let me;n[53]!==fe||n[54]!==pe?(me=(0,X.jsxs)(le,{preventOverscroll:!0,outerClassName:`flex-1 min-h-0`,className:`px-0 pb-2`,children:[fe,pe]}),n[53]=fe,n[54]=pe,n[55]=me):me=n[55];let W;n[56]!==u||n[57]!==c?(W=!u&&(0,X.jsx)(`div`,{className:`px-3 pt-1 pb-1.5 border-t typography-meta text-muted-foreground`,children:c(`chat.snippetAutocomplete.footer`)}),n[56]=u,n[57]=c,n[58]=W):W=n[58];let G;return n[59]!==I||n[60]!==me||n[61]!==W?(G=(0,X.jsxs)(`div`,{ref:l,className:`absolute z-[100] min-w-0 w-full max-w-[450px] max-h-60 bg-background border-2 border-border/60 rounded-xl shadow-none bottom-full mb-2 left-0 flex flex-col`,style:I,children:[me,W]}),n[59]=I,n[60]=me,n[61]=W,n[62]=G):G=n[62],G});Fe.displayName=`SnippetAutocomplete`;function Ie(e){return e.isMobile}function Le(e){return e.snippets}function Re(e){return e.loadSnippets}function ze(e){return e.setSnippetDraft}function Be(e){return e.setSelectedSnippet}function Ve(e){return e.setSettingsDialogOpen}function He(e){return e.setSettingsPage}function Ue(e,t){return e.source===`project`&&t.source!==`project`?-1:e.source!==`project`&&t.source===`project`?1:e.name.localeCompare(t.name)}function We(e){return[e.name,...e.aliases]}function Ge(e,t){return e.score===t.score?e.item.source===`project`&&t.item.source!==`project`?-1:e.item.source!==`project`&&t.item.source===`project`?1:e.item.name.localeCompare(t.item.name):e.score-t.score}function Ke(e){return e.item}function qe(e){return e.name}var Je=2,Ye=e=>!!e&&typeof e==`object`&&!Array.isArray(e),Xe=e=>{let t=e?.trim().replace(/\\/g,`/`);return t?t.length>1?t.replace(/\/+$/,``):t:null},Ze=e=>Ye(e)&&Array.isArray(e.all)&&e.all.every(e=>typeof e==`string`)&&typeof e.current==`string`&&Ye(e.branches),Qe=(e,t)=>JSON.stringify([e,t]),$e=e=>`version`in e&&e.version===Je&&Ye(e.entries),et=e=>{if(!e)return null;try{let t=JSON.parse(e);return Ye(t)?t.version===Je&&Ye(t.entries)?{version:Je,entries:t.entries}:t:null}catch{return null}},tt=(e,t)=>{try{e.setItem(`oc.gitBranchCache`,JSON.stringify(t))}catch{}},nt=(e,t,n)=>{let r=Xe(e);if(!r||!t)return null;let i;try{i=n.getItem(`oc.gitBranchCache`)}catch{return null}let a=et(i);if(!a)return null;if($e(a))return Ze(a.entries[Qe(t,r)])?a.entries[Qe(t,r)]:null;let o={};for(let[e,n]of Object.entries(a)){let r=Xe(e);r&&Ze(n)&&(o[Qe(t,r)]=n)}return tt(n,{version:Je,entries:o}),o[Qe(t,r)]??null},rt=(e,t,n,r)=>{let i=Xe(e);if(!i||!t||!Ze(n))return;let a=null;try{a=r.getItem(`oc.gitBranchCache`)}catch{return}let o=et(a);tt(r,{version:Je,entries:{...o&&$e(o)?o.entries:{},[Qe(t,i)]:n}})},it=3e4,at=Xe,ot=(e,t=n())=>c.git.branches(at(e),t),st=(e,t=n())=>c.git.remotes(at(e),t),ct=async(e,t,n)=>{n.throwIfAborted();let r=d()?.git,i=t?.getGitBranches?await t.getGitBranches(e,{signal:n}):r?await r.getGitBranches(e,{signal:n}):await y(e,{signal:n});return n.throwIfAborted(),i},lt=async(e,t,n)=>{n.throwIfAborted();let r=d()?.git,i=t?.getRemotes?await t.getRemotes(e,{signal:n}):r?await r.getRemotes(e,{signal:n}):await _(e,{signal:n});return n.throwIfAborted(),i},ut=(e,t,i=n(),a=r())=>{let o=at(e),s=t;return{queryKey:ot(o,i),queryFn:async({signal:e})=>{if(!o)throw Error(`Git branches require a directory`);let t=await ct(o,s,e);return rt(o,i,t,a),t},staleTime:it,gcTime:1/0,initialData:()=>nt(o,i,a)??void 0,initialDataUpdatedAt:0}},dt=(e,t,r=n())=>{let i=at(e),a=t;return{queryKey:st(i,r),queryFn:({signal:e})=>{if(!i)throw Error(`Git remotes require a directory`);return lt(i,a,e)},staleTime:it,gcTime:1/0}},ft=(e,r,i)=>{let a=(0,U.c)(9),o=i===void 0||i,s=L.useSyncExternalStore(t,n,n),c,l,u;a[0]!==e||a[1]!==r||a[2]!==s?(c=at(e),u=S,l=ut(c,r,s),a[0]=e,a[1]=r,a[2]=s,a[3]=c,a[4]=l,a[5]=u):(c=a[3],l=a[4],u=a[5]);let d=o&&!!c,f;return a[6]!==l||a[7]!==d?(f={...l,enabled:d},a[6]=l,a[7]=d,a[8]=f):f=a[8],u(f)},pt=(e,r,i)=>{let a=(0,U.c)(9),o=i===void 0||i,s=L.useSyncExternalStore(t,n,n),c,l,u;a[0]!==e||a[1]!==r||a[2]!==s?(c=at(e),u=S,l=dt(c,r,s),a[0]=e,a[1]=r,a[2]=s,a[3]=c,a[4]=l,a[5]=u):(c=a[3],l=a[4],u=a[5]);let d=o&&!!c,f;return a[6]!==l||a[7]!==d?(f={...l,enabled:d},a[6]=l,a[7]=d,a[8]=f):f=a[8],u(f)},mt=(e,t,r=u,i=n())=>r.fetchQuery(ut(e,t,i)),ht=(e,t,r=u,i=n())=>r.fetchQuery({...ut(e,t,i),staleTime:0}),gt=e=>e instanceof Error?e.name===`AbortError`||e.name===`CancelledError`||e.name===`Error`&&e.message===`CancelledError`:!1,_t=1e4,vt=6e4,yt=5e3,bt=3e4,xt=6e4,St=25,Ct=40,wt=2,Tt=15e3,Et=500,Dt=30,Ot=20971520,kt=new Map,At=new Map,jt=new Map,Mt=new Map,Nt=new Map,Pt=(e,t)=>`${t}:${e}`,Ft=e=>At.get(e)??0,It=e=>{let t=Ft(e)+1;return At.set(e,t),t},Lt=e=>{let t=(jt.get(e)??0)+1;return jt.set(e,t),t},Rt=e=>{let t=kt.get(e);if(t)return t;let n=new Set;return kt.set(e,n),n},Q=()=>({isGitRepo:null,status:null,branches:null,branchesTransportIdentity:null,log:null,identity:null,diffCache:new Map,indexRevision:0,lastRepoCheckAt:0,lastStatusFetch:0,lastStatusChange:0,lastLogFetch:0,lastBranchesFetch:0,lastIdentityFetch:0,logMaxCount:25,isLoadingStatus:!1,isLoadingLog:!1,isLoadingBranches:!1,isLoadingIdentity:!1}),zt=(e,t=Dt,n=Ot)=>{let r=0;for(let t of e.values())r+=(t.original?.length??0)+(t.modified?.length??0);if(e.size<=t&&r<=n)return e;let i=Array.from(e.entries()).sort((e,t)=>e[1].fetchedAt-t[1].fetchedAt),a=new Map,o=0;for(let e=i.length-1;e>=0;e--){let[r,s]=i[e],c=(s.original?.length??0)+(s.modified?.length??0);if(a.size>=t)break;o+c>n&&a.size>0||(a.set(r,s),o+=c)}return a},Bt=(e,t)=>{if(!e&&!t)return!1;if(!e||!t)return!0;let n=new Set([...Object.keys(e),...Object.keys(t)]);for(let r of n){let n=e[r],i=t[r];if(!(!n&&!i)&&(!n||!i||n.insertions!==i.insertions||n.deletions!==i.deletions))return!0}return!1},Vt=(e,t)=>!e&&!t?!1:!e||!t||e.remote!==t.remote||e.branch!==t.branch||e.ahead!==t.ahead||e.behind!==t.behind,Ht=(e,t)=>{if(!e&&!t)return!1;if(!e||!t)return!0;let n=e.files??[],r=t.files??[];if(n.length!==r.length||e.ahead!==t.ahead||e.behind!==t.behind||e.current!==t.current||e.tracking!==t.tracking||e.isClean!==t.isClean||t.upstreamComparison!==void 0&&Vt(e.upstreamComparison,t.upstreamComparison))return!0;let i=new Set(n.map(e=>`${e.path}:${e.index}:${e.working_dir}`));for(let e of r)if(!i.has(`${e.path}:${e.index}:${e.working_dir}`))return!0;return!!(t.diffStats!==void 0&&Bt(e.diffStats,t.diffStats))},Ut=(e,t)=>{let n=new Set;if(!t)return n;let r=e?.files??[],i=t.files??[],a=new Map(r.map(e=>[e.path,e])),o=new Map(i.map(e=>[e.path,e])),s=new Set([...a.keys(),...o.keys()]);for(let e of s){let t=a.get(e),r=o.get(e);if(!t||!r){n.add(e);continue}if(t.index!==r.index||t.working_dir!==r.working_dir){n.add(e);continue}}if(t.diffStats!==void 0){let r=e?.diffStats??{},i=t.diffStats??{},a=new Set([...Object.keys(r),...Object.keys(i)]);for(let e of a){let t=r[e],a=i[e];if(!t||!a){n.add(e);continue}(t.insertions!==a.insertions||t.deletions!==a.deletions)&&n.add(e)}}return n},Wt=(e,t)=>{if(!e&&!t)return!1;if(!e||!t)return!0;let n=e.files??[],r=t.files??[],i=e=>{let t=e?.trim()??``;return t===`?`?``:t},a=new Map(n.map(e=>[e.path,i(e.index)])),o=new Map(r.map(e=>[e.path,i(e.index)])),s=new Set([...a.keys(),...o.keys()]);for(let e of s)if((a.get(e)??``)!==(o.get(e)??``))return!0;return!1},Gt=e=>!e||e.trim().length===0,Kt=e=>(e||``).trim()===`U`,qt=e=>{let t=(e.index||``).trim(),n=(e.working_dir||``).trim();if(Kt(t)||Kt(n))return e;let r=t===`?`||n===`?`?`A`:t||n||` `;return{...e,index:r,working_dir:` `}},Jt=e=>{let t=(e.index||``).trim(),n=(e.working_dir||``).trim();if(Kt(t)||Kt(n))return e;let r=n||(t===`A`||t===`?`?`?`:t)||` `;return{...e,index:` `,working_dir:r}},Yt=e=>Gt(e.index)&&Gt(e.working_dir),$=f()(m((e,t)=>({directories:new Map,activeDirectory:null,setActiveDirectory:n=>{let{activeDirectory:r,directories:i}=t();if(r!==n)if(r&&It(r),n&&It(n),n&&!i.has(n)){let t=new Map(i);t.set(n,Q()),e({activeDirectory:n,directories:t})}else e({activeDirectory:n})},getDirectoryState:e=>t().directories.get(e)??null,fetchStatus:async(n,r,i={})=>{let a=i.mode??`full`,o=Pt(n,a),s=Mt.get(o)??(a===`light`?Mt.get(Pt(n,`full`)):void 0);if(s)return s;let c=(async()=>{let{silent:a=!1}=i,{directories:o}=t(),s=o.get(n);if(s||=Q(),!a){let r=new Map(t().directories),i=r.get(n)??Q();r.set(n,{...i,isLoadingStatus:!0}),e({directories:r})}let c=!1;try{let a=Date.now(),o=s.isGitRepo!==!0||a-(s.lastRepoCheckAt||0)>vt,l=s.isGitRepo===!0;if(o&&(l=await r.checkIsGitRepository(n)),!l){let r=new Map(t().directories),i=r.get(n)??s;return r.set(n,{...i,isGitRepo:!1,status:null,isLoadingStatus:!1,lastRepoCheckAt:a,lastStatusFetch:a}),e({directories:r}),!1}let u=await r.getGitStatus(n,i.mode?{mode:i.mode}:void 0);if(Ht(s.status,u)){c=!0;let r=new Map(t().directories),i=r.get(n)??Q(),s=Ut(i.status,u),l=Wt(i.status,u),d=new Set((i.status?.files??[]).map(e=>e.path)),f=new Set((u.files??[]).map(e=>e.path)),p=new Map(i.diffCache);for(let e of d)f.has(e)||p.delete(e);for(let e of s)p.delete(e);let m=s.size>0;m&&It(n);let h={...u,diffStats:u.diffStats===void 0&&i.status?.diffStats!==void 0?i.status.diffStats:u.diffStats,upstreamComparison:u.upstreamComparison===void 0?i.status?.upstreamComparison:u.upstreamComparison};r.set(n,{...i,isGitRepo:!0,status:h,diffCache:p,indexRevision:l?i.indexRevision+1:i.indexRevision,lastRepoCheckAt:o?a:i.lastRepoCheckAt,lastStatusFetch:Date.now(),lastStatusChange:m?Date.now():i.lastStatusChange}),e({directories:r})}else{let r=new Map(t().directories),i=r.get(n)??Q();r.set(n,{...i,isGitRepo:!0,lastRepoCheckAt:o?a:i.lastRepoCheckAt,lastStatusFetch:Date.now(),lastStatusChange:i.lastStatusChange}),e({directories:r})}}catch(e){console.error(`Failed to fetch git status:`,e)}finally{if(!a){let r=new Map(t().directories),i=r.get(n)??Q();r.set(n,{...i,isLoadingStatus:!1}),e({directories:r})}}return c})();Mt.set(o,c);try{return await c}finally{Mt.get(o)===c&&Mt.delete(o)}},moveStatusPathsOptimistically:(n,r,i)=>{let a=new Set(r.map(e=>e.trim()).filter(Boolean));if(a.size===0)return null;let{directories:o}=t(),s=o.get(n),c=s?.status??null;if(!s||!c)return c;let l=!1,u=[];for(let e of c.files){if(!a.has(e.path)){u.push(e);continue}let t=i===`stage`?qt(e):Jt(e);t!==e&&(l=!0),Yt(t)?l=!0:u.push(t)}if(!l)return c;let d=new Map(o);return d.set(n,{...s,status:{...c,files:u,isClean:u.length===0},indexRevision:s.indexRevision+1,lastStatusChange:Date.now()}),e({directories:d}),c},restoreStatus:(n,r)=>{let{directories:i}=t(),a=i.get(n);if(!a)return;let o=new Map(i);o.set(n,{...a,status:r,indexRevision:a.indexRevision+1,lastStatusChange:Date.now()}),e({directories:o})},bumpIndexRevision:n=>{let{directories:r}=t(),i=r.get(n);if(!i)return;let a=new Map(r);a.set(n,{...i,indexRevision:i.indexRevision+1}),e({directories:a})},fetchBranches:async(r,i,a={})=>{let o=n(),s=Lt(r);{let n=new Map(t().directories),i=n.get(r)??Q();n.set(r,{...i,isLoadingBranches:!0}),e({directories:n})}try{let c=a.force?await ht(r,i,void 0,o):await mt(r,i,void 0,o);if(s!==jt.get(r)||o!==n())return;let l=new Map(t().directories),u=l.get(r)??Q();l.set(r,{...u,branches:c,branchesTransportIdentity:o,isLoadingBranches:!1,lastBranchesFetch:Date.now()}),e({directories:l})}catch(i){if(gt(i)||console.error(`Failed to fetch git branches:`,i),s!==jt.get(r)||o!==n())return;let a=new Map(t().directories),c=a.get(r)??Q();a.set(r,{...c,isLoadingBranches:!1}),e({directories:a})}},fetchLog:async(n,r,i)=>{let{directories:a}=t(),o=a.get(n),s=i??o?.logMaxCount??25;{let r=new Map(t().directories),i=r.get(n)??Q();r.set(n,{...i,isLoadingLog:!0}),e({directories:r})}try{let i=await r.getGitLog(n,{maxCount:s}),a=new Map(t().directories),o=a.get(n)??Q();a.set(n,{...o,log:i,isLoadingLog:!1,lastLogFetch:Date.now(),logMaxCount:s}),e({directories:a})}catch(r){console.error(`Failed to fetch git log:`,r);let i=new Map(t().directories),a=i.get(n)??Q();i.set(n,{...a,isLoadingLog:!1}),e({directories:i})}},fetchIdentity:async(n,r)=>{{let r=new Map(t().directories),i=r.get(n)??Q();r.set(n,{...i,isLoadingIdentity:!0}),e({directories:r})}try{let i=await r.getCurrentGitIdentity(n),a=new Map(t().directories),o=a.get(n)??Q();a.set(n,{...o,identity:i,isLoadingIdentity:!1,lastIdentityFetch:Date.now()}),e({directories:a})}catch(r){console.error(`Failed to fetch git identity:`,r);let i=new Map(t().directories),a=i.get(n)??Q();i.set(n,{...a,isLoadingIdentity:!1}),e({directories:i})}},fetchAll:async(n,r,i={})=>{let{directories:a}=t(),o=a.get(n);if(!o){o=Q();let t=new Map(a);t.set(n,o),e({directories:t})}let{force:s=!1,silentIfCached:c=!1}=i,l=Date.now();await t().fetchStatus(n,r,{silent:c&&!!o?.status});let u=t().directories.get(n);if(!u?.isGitRepo)return;await t().fetchBranches(n,r,{force:s});let d=l-(u.lastLogFetch||0);(s||d>_t||!u.log)&&await t().fetchLog(n,r),await t().fetchIdentity(n,r)},getDiff:(e,n)=>t().directories.get(e)?.diffCache.get(n)??null,setDiff:(n,r,i)=>{let a=new Map(t().directories),o=a.get(n)??Q(),s=new Map(o.diffCache);s.set(r,{...i,fetchedAt:Date.now()});let c=zt(s);a.set(n,{...o,diffCache:c}),e({directories:a})},clearDiffCache:n=>{It(n);let r=new Map(t().directories),i=r.get(n);i&&(r.set(n,{...i,diffCache:new Map}),e({directories:r}))},fetchAllDiffs:async(e,n)=>{let r=t().directories.get(e);if(!r?.status?.files||r.status.files.length===0)return;let i=r.status.files.map(e=>e.path).slice(0,St);await t().prefetchDiffs(e,n,i,{maxFiles:St})},prefetchDiffs:async(n,r,i,a={})=>{let o=t().directories.get(n);if(!o?.status?.files||o.status.files.length===0||i.length===0)return;let{maxFiles:s=Ct}=a,c=new Set(o.status.files.map(e=>e.path)),l=o.status.diffStats,u=Rt(n),d=[],f=new Set;for(let e of i){if(!e||f.has(e)||(f.add(e),!c.has(e))||o.diffCache.has(e)||u.has(e))continue;let t=l?.[e];t&&t.insertions+t.deletions>Et||d.push(e)}let p=d.slice(0,Math.max(1,s));if(p.length===0)return;let m=Ft(n);if(typeof document<`u`&&document.hidden)return;p.forEach(e=>u.add(e));let h=0,g=[],_=()=>{let e=h;return h+=1,e<p.length?p[e]:null},v=async e=>{let t=r.getGitFileDiff(n,{path:e}),i=new Promise((e,t)=>{setTimeout(()=>t(Error(`Timed out after ${Tt}ms`)),Tt)}),a=await Promise.race([t,i]);return{path:e,diff:{original:a.original??``,modified:a.modified??``,isBinary:a.isBinary}}},y=async()=>{for(;;){if(m!==Ft(n))return;let e=_();if(!e)return;try{g.push(await v(e))}catch{}finally{u.delete(e)}}},b=Math.min(wt,p.length);if(await Promise.allSettled(Array.from({length:b},()=>y())),p.forEach(e=>u.delete(e)),m!==Ft(n))return;let x=new Map(t().directories),S=x.get(n);if(!S)return;let C=new Map(S.diffCache),ee=Date.now();g.forEach(e=>{!e.diff.isBinary&&e.diff.original===``&&e.diff.modified===``||C.set(e.path,{...e.diff,fetchedAt:ee})});let w=zt(C);x.set(n,{...S,diffCache:w}),e({directories:x})},setLogMaxCount:(n,r)=>{let i=new Map(t().directories),a=i.get(n)??Q();i.set(n,{...a,logMaxCount:r}),e({directories:i})},ensureStatus:async(e,n)=>{let r=t().directories.get(e),i=Date.now();r?.status&&i-r.lastStatusFetch<yt||await t().fetchStatus(e,n,{silent:!!r?.status})},ensureAll:(e,n)=>{let r=Nt.get(e);if(r)return r;let i=(async()=>{let r=t().directories.get(e),i=Date.now();(!r?.status||r.status.diffStats===void 0||i-(r?.lastStatusFetch??0)>=yt)&&await t().fetchStatus(e,n,{silent:!!r?.status});let a=t().directories.get(e);if(!a?.isGitRepo)return;let o=[];(!a.branches||i-a.lastBranchesFetch>=bt)&&o.push(t().fetchBranches(e,n)),(!a.log||i-a.lastLogFetch>=_t)&&o.push(t().fetchLog(e,n)),(!a.identity||i-a.lastIdentityFetch>=xt)&&o.push(t().fetchIdentity(e,n)),o.length>0&&await Promise.all(o)})();return Nt.set(e,i),i.finally(()=>{Nt.get(e)===i&&Nt.delete(e)}),i},refresh:async(e,n={})=>{let{activeDirectory:r}=t();r&&await t().fetchAll(r,e,n)}}),{name:`git-store`})),Xt=e=>{let t=(0,U.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.status??null:null,t[0]=e,t[1]=n),$(n)},Zt=e=>{let r=(0,U.c)(3),i=L.useSyncExternalStore(t,n,n),a;return r[0]!==e||r[1]!==i?(a=t=>{if(!e)return null;let n=t.directories.get(e);return n?.branchesTransportIdentity===i?n.branches:null},r[0]=e,r[1]=i,r[2]=a):a=r[2],$(a)},Qt=e=>{let t=(0,U.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.log??null:null,t[0]=e,t[1]=n),$(n)},$t=e=>{let t=(0,U.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.isGitRepo??null:null,t[0]=e,t[1]=n),$(n)},en=e=>{let t=(0,U.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.status?.current?.trim()??null:null,t[0]=e,t[1]=n),$(n)},tn={current:new Map},nn=()=>$(cn),rn=e=>{let t=(0,U.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=new Map,t[0]=n):n=t[0];let r=L.useRef(n),i;return t[1]===e?i=t[2]:(i=t=>{let n=r.current,i=n.size===e.length;if(i)for(let r of e){let e=t.directories.get(r),a=n.get(r);if(!a||(e?.isGitRepo??null)!==a.isGitRepo||(e?.status?.current??null)!==a.branch){i=!1;break}}if(i)return n;let a=new Map;for(let n of e){let e=t.directories.get(n);a.set(n,{isGitRepo:e?.isGitRepo??null,branch:e?.status?.current??null})}return r.current=a,a},t[1]=e,t[2]=i),$(i)},an=e=>{let t=(0,U.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.isLoadingStatus??!1:!1,t[0]=e,t[1]=n),$(n)},on=e=>{let t=(0,U.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.isLoadingLog??!1:!1,t[0]=e,t[1]=n),$(n)},sn=e=>{let t=(0,U.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.isLoadingBranches??!1:!1,t[0]=e,t[1]=n),$(n)};function cn(e){let t=tn.current,n=t.size===e.directories.size;if(n){for(let[r,i]of e.directories)if(t.get(r)!==(i.status?.current??null)){n=!1;break}}if(n)return t;let r=new Map;for(let[t,n]of e.directories)r.set(t,n.status?.current??null);return tn.current=r,r}var ln=e=>{let t=String(e||``).trim().replace(/^remotes\//,``);if(!t)return null;let n=t.indexOf(`/`);return n<=0||n>=t.length-1?null:{remote:t.slice(0,n),branch:t.slice(n+1)}},un=e=>String(e||``).trim().replace(/^refs\/heads\//,``).replace(/^heads\//,``).replace(/^remotes\//,``),dn=e=>e.branchName?un(e.branchName):e.mode===`existing`?un(e.existingBranch||e.preferredName||``):un(e.preferredName||``),fn=async e=>{let t=await I(e);try{let n=ln((await N(e)).branches?.[t]?.tracking||null);if(n?.remote)return n.remote}catch{}try{let t=ln((await P(e)).tracking);if(t?.remote)return t.remote}catch{}return null},pn=async(e,t)=>{let n=await fn(e),r=un(t);return!n||!r?null:{setUpstream:!0,upstreamRemote:n,upstreamBranch:r}},mn=async(e,t,n)=>{let r=dn(t),i=n?.resolvedRootTrackingRemote,a=i===void 0?await pn(e,r):i&&un(r)?{setUpstream:!0,upstreamRemote:i,upstreamBranch:un(r)}:null;return a?{...t,setUpstream:t.setUpstream??a.setUpstream,upstreamRemote:t.upstreamRemote||a.upstreamRemote,upstreamBranch:t.upstreamBranch||a.upstreamBranch}:t},hn=async(e,t,n)=>{let r=await mn(e.path,t,n);return ue(e,r)},gn=`oc:lastWorktreeSourceBranch`,_n=({mode:e,sourceBranch:t,linkedPr:n,selectedBranch:r})=>e===`existing-branch`?r||null:n?null:t||null,vn=({branches:e,savedSourceBranch:t,rootBranch:n})=>t&&e.includes(t)&&t?{sourceBranch:t,shouldClearSavedSourceBranch:!1}:{sourceBranch:n&&e.includes(n)?n:e.includes(`main`)?`main`:e.includes(`master`)?`master`:e[0]??``,shouldClearSavedSourceBranch:!!t},yn=(e,t,n)=>{if(!e)return e;let r=t.length>0&&!/\s$/.test(t)&&!/^\s/.test(e)&&!/[([{]$/.test(t),i=n.length>0&&!/\s$/.test(e)&&!/^\s/.test(n)&&!/^[\])}.,;:!?]/.test(n);return`${r?` `:``}${e}${i?` `:``}`},bn=(e,t,n)=>{let r=yn(e,t,n);return`${t.length===0&&!/^\s/.test(r)?` `:``}${r}${n.length===0&&!/\s$/.test(r)?` `:``}`},xn=(e,t,n,r)=>{let i=e.slice(0,t),a=e.slice(n),o=bn(r,i,a),s=Math.max(0,o.indexOf(r)),c=i.length+s;return{text:`${i}${o}${a}`,caret:i.length+o.length,start:c,end:c+r.length}},Sn=(e,t)=>{let n=e=>`${e.kind}:${e.value}:${e.range.start}:${e.range.end}`;return new Set(e.map(n)).has(n(t))?[...e]:[...e,t]},Cn=(e,t)=>t<e.length&&e[t]===` `?t+1:t;export{ye as A,ft as C,Te as D,Ne as E,pe as M,fe as N,Ce as O,ht as S,Fe as T,Qt as _,gn as a,$ as b,hn as c,nn as d,en as f,an as g,on as h,bn as i,me as j,Z as k,fn as l,sn as m,Sn as n,vn as o,Zt as p,xn as r,_n as s,Cn as t,mn as u,rn as v,pt as w,$t as x,Xt as y};
@@ -1,4 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{t}from"./useUIStore-Wyu09VUF.js";import{Xt as n}from"./persistence-aCOlo6ew.js";import{a as r,r as i}from"./vendor-zustand-B4dlGEM2.js";import{nt as a,rt as o}from"./vendor-base-ui-CnHfUmDN.js";import{Ct as s,Nt as c}from"./platform-DxNH_0Fj.js";import{n as l}from"./vendor-react-DLPElpoQ.js";import{n as u}from"./vendor-reactuses-core-DDoDDyM9.js";import{l as d,n as f}from"./clipboard-DyCy8o-j.js";import{Kn as p,Rn as m,To as h,Ya as g,Za as _,_r as v,br as y,c as b,l as x,la as S,nr as C,oa as w,pa as T,zn as E}from"./useMobileNavigationStore-DkBMOv1J.js";import{n as D,t as ee}from"./utils-CJdWZupK.js";import{n as O}from"./Icon-BAf2hhrw.js";import{t as te}from"./button-DfF088a8.js";import{n as ne}from"./gitApi-BZs3g7kL.js";import{C as re,M as ie,N as k,O as ae,S as A,_ as j,a as oe,b as se,g as ce,h as le,i as M,j as ue,k as de,n as N,o as P,p as F,v as fe,x as pe,y as I}from"./projectMeta-Ct-WdvZL.js";import{t as L}from"./input-Ca2tUhgN.js";import{i as R,n as me,t as z}from"./tooltip-GC3dg3gO.js";import{o as he}from"./OverlayScrollbar-DEM7AQRU.js";import{n as B}from"./useRuntimeAPIs-DSLXJybW.js";import{E as ge,T as _e,a as V,b as H,c as ve,g as U,k as ye,l as W,m as G,o as K,p as q,r as be,x as J}from"./insertionBoundaries-B9vsqCQ4.js";import{n as Y,r as xe,t as Se}from"./collapsible-CVL-5iEB.js";var X=e(o(),1),Ce=l(),Z=/^[a-z0-9](?:[a-z0-9-]{0,48}[a-z0-9])?$/,Q=/^g[1-9]\d*$/,we=(e,t,n,r,i)=>{if(!Z.test(e)||t!==void 0&&!Q.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}},Te=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 we(n,void 0,t[1],t[2],void 0);if(t.length===4){let[,e,r,i]=t;return Q.test(e)?we(n,e,r,i,void 0):we(n,void 0,e,r,i)}let[,r,i,a,o]=t;return r===``?we(n,void 0,i,a,o):we(n,r,i,a,o)},Ee=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(`/`)},De=(e,t,n,r)=>{let i=[e];return r&&i.push(r),i.push(t,n,`fusion`),i.join(`/`)},Oe=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).substring(0,50),ke=(e,t)=>`${Oe(e)}-${Oe(t)}`.substring(0,60),Ae=(e,t)=>`${e}/${t}`,je=e=>{let t=e.replace(/\\/g,`/`);return t===`/`?`/`:t.length>1?t.replace(/\/+$/,``):t},Me=(e,t)=>{let n=je(t),r=e.directory,i=typeof r==`string`&&r.trim().length>0?e:{...e,directory:n};T(e.id,n),x.getState().markSessionAsOpenChamberCreated(e.id),v.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},Ne=()=>{let e=h.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=s.getState().currentDirectory??null;if(r&&r.trim().length>0){let e=r.replace(/\\/g,`/`).replace(/\/+$/,``)||r;return{id:`path:${e}`,path:e}}return null},Pe=r()(i(e=>({isLoading:!1,error:null,createMultiRun:async t=>{let n=t.name.trim(),{groups:r,agent:i,files:a,setupCommands:o}=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 s=Ne();if(!s)return e({error:`Select a project`,isLoading:!1}),null;let l=s.path,u=await ne(l)&&t.isolateRuns!==!1,d=Oe(n),f=u?await F(l):void 0,m=u?await W(l):null,h=[],g=o?.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 o=new Map;for(let p of n.models){let n=`${p.providerID}:${p.modelID}`,_=a.get(n)||1,v=(o.get(n)||0)+1;o.set(n,v);let y=ke(p.providerID,p.modelID),b=r.length>1?`g${e+1}`:void 0,S=_>1?Ae(d,`${y}/${v}`):Ae(d,y),w=b?`${b}/${S}`:S,T=Ee({groupSlug:d,runGroup:b,providerID:p.providerID,modelID:p.modelID,index:_>1?v:void 0});try{if(!u){let e=await c.withDirectory(l,()=>c.createSession({title:T}));Me(e,l),h.push({sessionId:e.id,worktreePath:l,providerID:p.providerID,modelID:p.modelID,variant:p.variant,prompt:i});continue}let e=await ve(s,{preferredName:w,mode:`new`,branchName:w,worktreeName:w,startRef:t.worktreeBaseBranch||`HEAD`,setupCommands:g,returnAfterDirectoryCreated:!0},{resolvedRootTrackingRemote:m}),n={...e,createdFromBranch:f,kind:`standard`};await E(s)&&await C(e.path);let r=await c.withDirectory(e.path,()=>c.createSession({title:T}));Me(r,e.path),x.getState().setWorktreeMetadata(r.id,n),h.push({sessionId:r.id,worktreePath:e.path,providerID:p.providerID,modelID:p.modelID,variant:p.variant,prompt:i})}catch(e){console.warn(`[MultiRun] Failed to create session:`,e)}}}let _=o?.filter(e=>e.trim().length>0)??[];_.length>0&&p(s,_).catch(()=>{console.warn(`[MultiRun] Failed to save worktree setup commands`)});let v=h.map(e=>e.sessionId),y=h[0]?.sessionId??null;if(v.length===0)return e({error:`Failed to create any sessions`,isLoading:!1}),null;let S=a?.map(e=>({type:`file`,mime:e.mime,filename:e.filename,url:e.url}));return(async()=>{try{let e=ie.getState().expandText;await Promise.allSettled(h.map(async t=>{try{let n=await e(t.prompt).catch(()=>t.prompt);await b({sessionId:t.sessionId,directory:t.worktreePath,content:n,providerID:t.providerID,modelID:t.modelID,variant:t.variant,agent:i,files:S})}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:v,firstSessionId:y}}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`})),$=a(),Fe=`h-7`,Ie=()=>`${Date.now()}-${Math.random().toString(36).substring(2,9)}`,Le=e=>{let t=(0,Ce.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=ee(`flex items-center gap-1.5 px-2 rounded-md bg-interactive-selection/20 border border-border/30`,Fe),t[0]=c):c=t[0];let l;t[1]!==n.modelID||t[2]!==n.providerID?(l=(0,$.jsx)(de,{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)(O,{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},Re=e=>{let n=(0,Ce.c)(131),{selectedModels:r,onAdd:i,onRemove:a,onUpdate:o,minModels:s,addButtonLabel:c,showChips:l,maxModels:u,addButtonClassName:d,dropdownSide:p,dropdownClassName:m,containerClassName:h,triggerIcon:g}=e,v=l===void 0||l,y=p===void 0?`top`:p,{t:b}=f(),x=w(ze),S=w(Be),C=t(Ve),T=t(He),{favoriteModelsList:E,recentModelsList:D}=ae(),ne=t(Ue),ie=t(We),[k,j]=X.useState(!1),[oe,se]=X.useState(``),[M,ue]=X.useState(null),de=X.useRef(null),N=X.useRef(null),P=u===1,F=u===void 0||r.length<u||P,I;if(n[0]!==r){I=new Map;for(let e of r){let t=`${e.providerID}:${e.modelID}`;I.set(t,(I.get(t)||0)+1)}n[0]=r,n[1]=I}else I=n[1];let L=I,R;n[2]===r?R=n[3]:(R=e=>r.filter(t=>t.providerID===e.providerID&&t.modelID===e.modelID).findIndex(t=>t.instanceId===e.instanceId)+1,n[2]=r,n[3]=R);let me=R,z,he;n[4]!==y||n[5]!==k?(z=()=>{if(!k||!N.current)return;let e=N.current.getBoundingClientRect();if(y===`bottom`){let t=(window.visualViewport?.height??document.documentElement.clientHeight??window.innerHeight)-e.bottom-16-112;ue(Math.max(160,Math.min(320,t)));return}let t=N.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;ue(Math.max(150,Math.min(300,r)))},he=[y,k],n[4]=y,n[5]=k,n[6]=z,n[7]=he):(z=n[6],he=n[7]),X.useEffect(z,he);let B,ge;n[8]!==F||n[9]!==k?(B=()=>{!F&&k&&(j(!1),se(``))},ge=[F,k],n[8]=F,n[9]=k,n[10]=B,n[11]=ge):(B=n[10],ge=n[11]),X.useEffect(B,ge);let _e,V;n[12]===k?(_e=n[13],V=n[14]):(_e=()=>{if(!k)return;let e=e=>{de.current&&!de.current.contains(e.target)&&(j(!1),se(``))};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},V=[k],n[12]=k,n[13]=_e,n[14]=V),X.useEffect(_e,V);let H;n[15]!==P||n[16]!==i||n[17]!==o||n[18]!==r.length?(H=e=>{let t={providerID:e.providerID,modelID:e.modelID,displayName:_(e.model,e.modelID)||e.modelID,instanceId:Ie()};P&&r.length>0&&o?o(0,t):i(t),P&&(j(!1),se(``))},n[15]=P,n[16]=i,n[17]=o,n[18]=r.length,n[19]=H):H=n[19];let ve=H,U;n[20]===b?U=n[21]:(U=b(`multirun.modelMultiSelect.search.placeholder`),n[20]=b,n[21]=U);let ye;n[22]===b?ye=n[23]:(ye=b(`multirun.modelMultiSelect.search.noResults`),n[22]=b,n[23]=ye);let W;n[24]===b?W=n[25]:(W=b(`multirun.modelMultiSelect.sections.favorites`),n[24]=b,n[25]=W);let G;n[26]===b?G=n[27]:(G=b(`multirun.modelMultiSelect.sections.recent`),n[26]=b,n[27]=G);let K;n[28]===b?K=n[29]:(K=b(`multirun.modelMultiSelect.keyboard.hint`),n[28]=b,n[29]=K);let q;n[30]===b?q=n[31]:(q=b(`settings.agents.modelSelector.actions.favorite`),n[30]=b,n[31]=q);let be;n[32]===b?be=n[33]:(be=b(`settings.agents.modelSelector.actions.unfavorite`),n[32]=b,n[33]=be);let J;n[34]===b?J=n[35]:(J=b(`chat.modelControls.provider`),n[34]=b,n[35]=J);let Y;n[36]===b?Y=n[37]:(Y=b(`chat.modelControls.capabilities`),n[36]=b,n[37]=Y);let xe;n[38]===b?xe=n[39]:(xe=b(`chat.modelControls.capability.toolCalling`),n[38]=b,n[39]=xe);let Se;n[40]===b?Se=n[41]:(Se=b(`chat.modelControls.capability.reasoning`),n[40]=b,n[41]=Se);let Z;n[42]===b?Z=n[43]:(Z=b(`chat.modelControls.modality.image`),n[42]=b,n[43]=Z);let Q;n[44]===b?Q=n[45]:(Q=b(`chat.modelControls.modality.video`),n[44]=b,n[45]=Q);let we;n[46]===b?we=n[47]:(we=b(`chat.modelControls.modality.audio`),n[46]=b,n[47]=we);let Te;n[48]===b?Te=n[49]:(Te=b(`chat.modelControls.costPerMillion`),n[48]=b,n[49]=Te);let Ee;n[50]===b?Ee=n[51]:(Ee=b(`chat.modelControls.costInput`),n[50]=b,n[51]=Ee);let De;n[52]===b?De=n[53]:(De=b(`chat.modelControls.costOutput`),n[52]=b,n[53]=De);let Oe;n[54]!==U||n[55]!==ye||n[56]!==W||n[57]!==G||n[58]!==K||n[59]!==q||n[60]!==be||n[61]!==J||n[62]!==Y||n[63]!==xe||n[64]!==Se||n[65]!==Z||n[66]!==Q||n[67]!==we||n[68]!==Te||n[69]!==Ee||n[70]!==De?(Oe={searchPlaceholder:U,noResults:ye,favorites:W,recent:G,keyboardHint:K,favorite:q,unfavorite:be,provider:J,capabilities:Y,capabilityToolCalling:xe,capabilityReasoning:Se,modalityImage:Z,modalityVideo:Q,modalityAudio:we,costPerMillion:Te,costInput:Ee,costOutput:De},n[54]=U,n[55]=ye,n[56]=W,n[57]=G,n[58]=K,n[59]=q,n[60]=be,n[61]=J,n[62]=Y,n[63]=xe,n[64]=Se,n[65]=Z,n[66]=Q,n[67]=we,n[68]=Te,n[69]=Ee,n[70]=De,n[71]=Oe):Oe=n[71];let ke=Oe,Ae;n[72]===h?Ae=n[73]:(Ae=ee(`relative`,h),n[72]=h,n[73]=Ae);let je;n[74]===d?je=n[75]:(je=ee(Fe,`!border-border/80 !bg-[var(--surface-subtle)] hover:!bg-[var(--interactive-hover)]/70`,d),n[74]=d,n[75]=je);let Me=!F,Ne;n[76]===k?Ne=n[77]:(Ne=()=>{j(!k)},n[76]=k,n[77]=Ne);let Pe;n[78]===g?Pe=n[79]:(Pe=g??(0,$.jsx)(O,{name:`add`,className:`h-3.5 w-3.5 mr-1`}),n[78]=g,n[79]=Pe);let Re;n[80]!==c||n[81]!==b?(Re=c??b(`multirun.modelMultiSelect.actions.addModel`),n[80]=c,n[81]=b,n[82]=Re):Re=n[82];let Ke;n[83]!==je||n[84]!==Me||n[85]!==Ne||n[86]!==Pe||n[87]!==Re?(Ke=(0,$.jsxs)(te,{ref:N,type:`button`,variant:`outline`,size:`sm`,className:je,disabled:Me,onClick:Ne,children:[Pe,Re]}),n[83]=je,n[84]=Me,n[85]=Ne,n[86]=Pe,n[87]=Re,n[88]=Ke):Ke=n[88];let qe;n[89]!==M||n[90]!==F||n[91]!==m||n[92]!==y||n[93]!==E||n[94]!==S||n[95]!==ve||n[96]!==ne||n[97]!==T||n[98]!==k||n[99]!==ke||n[100]!==L||n[101]!==ie||n[102]!==x||n[103]!==D||n[104]!==oe||n[105]!==C?(qe=k?(0,$.jsx)(`div`,{className:ee(`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`,y===`top`?`bottom-full mb-1`:`top-full mt-1`,m),style:{background:`linear-gradient(var(--surface-elevated),var(--surface-elevated)),linear-gradient(var(--surface-background),var(--surface-background))`},children:(0,$.jsx)(re,{providers:x,providerOrder:ie,favoriteModels:E,recentModels:D,getMetadata:S,hiddenModels:ne,searchQuery:oe,onSearchQueryChange:se,onSelect:ve,labels:ke,selectionCount:e=>L.get(`${e.providerID}:${e.modelID}`)||0,disabled:!F,maxHeightClassName:`flex-1`,maxHeightStyle:{maxHeight:M?`${M}px`:`300px`},stickyHeaders:!0,tooltipsEnabled:k,isFavorite:e=>T(e.providerID,e.modelID),onToggleFavorite:e=>C(e.providerID,e.modelID),onEscape:()=>{j(!1),se(``)}})}):null,n[89]=M,n[90]=F,n[91]=m,n[92]=y,n[93]=E,n[94]=S,n[95]=ve,n[96]=ne,n[97]=T,n[98]=k,n[99]=ke,n[100]=L,n[101]=ie,n[102]=x,n[103]=D,n[104]=oe,n[105]=C,n[106]=qe):qe=n[106];let Je;n[107]!==Ae||n[108]!==Ke||n[109]!==qe?(Je=(0,$.jsxs)(`div`,{className:Ae,ref:de,children:[Ke,qe]}),n[107]=Ae,n[108]=Ke,n[109]=qe,n[110]=Je):Je=n[110];let Ye;n[111]!==me||n[112]!==L||n[113]!==a||n[114]!==o||n[115]!==x||n[116]!==r||n[117]!==v||n[118]!==b?(Ye=v&&r.length>0&&(0,$.jsx)(`div`,{className:`flex flex-col gap-2 w-full`,children:r.map((e,t)=>{let n=`${e.providerID}:${e.modelID}`,r=L.get(n)||1,i=me(e),s=x.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)(Le,{model:e,instanceIndex:i,totalSameModel:r,onRemove:()=>a(t)}),l&&(0,$.jsxs)(le,{value:u,onValueChange:n=>{if(!o)return;let r=n===`__default__`?void 0:n;o(t,{...e,variant:r})},children:[(0,$.jsxs)(pe,{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)(O,{name:`brain-ai-3`,className:ee(`h-3.5 w-3.5 flex-shrink-0`,u===`__default__`?`text-muted-foreground`:`text-[color:var(--status-info)]`)}),(0,$.jsx)(A,{placeholder:b(`multirun.modelMultiSelect.variant.placeholder`),children:e=>e===`__default__`?b(`multirun.modelMultiSelect.variant.default`):e})]}),(0,$.jsxs)(ce,{fitContent:!0,children:[(0,$.jsx)(fe,{value:`__default__`,className:`pr-2 [&>span:first-child]:hidden`,children:b(`multirun.modelMultiSelect.variant.default`)}),c.map(Ge)]})]})]},e.instanceId)})}),n[111]=me,n[112]=L,n[113]=a,n[114]=o,n[115]=x,n[116]=r,n[117]=v,n[118]=b,n[119]=Ye):Ye=n[119];let Xe;n[120]!==Je||n[121]!==Ye?(Xe=(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 items-center`,children:[Je,Ye]}),n[120]=Je,n[121]=Ye,n[122]=Xe):Xe=n[122];let Ze;n[123]!==u||n[124]!==s||n[125]!==r.length||n[126]!==b?(Ze=s!==void 0&&r.length<s&&(0,$.jsx)(`p`,{className:`typography-micro text-muted-foreground`,children:u===void 0?b(`multirun.modelMultiSelect.validation.minOnly`,{min:s}):b(`multirun.modelMultiSelect.validation.minToMax`,{min:s,max:u})}),n[123]=u,n[124]=s,n[125]=r.length,n[126]=b,n[127]=Ze):Ze=n[127];let Qe;return n[128]!==Xe||n[129]!==Ze?(Qe=(0,$.jsxs)(`div`,{className:`space-y-2`,children:[Xe,Ze]}),n[128]=Xe,n[129]=Ze,n[130]=Qe):Qe=n[130],Qe};function ze(e){return e.providers}function Be(e){return e.getModelMetadata}function Ve(e){return e.toggleFavoriteModel}function He(e){return e.isFavoriteModel}function Ue(e){return e.hiddenModels}function We(e){return e.providerOrder}function Ge(e){return(0,$.jsx)(fe,{value:e,className:`pr-2 [&>span:first-child]:hidden`,children:e},e)}function Ke(e){let t=(0,Ce.c)(30),{git:n}=B(),r=q(e),i=J(e),a=U(e),o=G(e),s=H(Ze),c=H(Xe),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 f=r?.all,p;t[13]!==e||t[14]!==s||t[15]!==n||t[16]!==i||t[17]!==f?(p=[e,n,i,f,s],t[13]=e,t[14]=s,t[15]=n,t[16]=i,t[17]=f,t[18]=p):p=t[18],X.useEffect(d,p);let m=a||i===!0&&o,h;bb0:{if(!r?.all){let e;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[19]=e):e=t[19],h=e;break bb0}let e;t[20]===r.all?e=t[21]:(e=r.all.filter(Ye).sort(),t[20]=r.all,t[21]=e),h=e}let g=h,_;bb1:{if(!r?.all){let e;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[22]=e):e=t[22],_=e;break bb1}let e;t[23]===r.all?e=t[24]:(e=r.all.filter(Je).map(qe).sort(),t[23]=r.all,t[24]=e),_=e}let v=_,y;bb2:{if(!e){y=null;break bb2}if(i!==null){y=i;break bb2}if(m){y=null;break bb2}y=r?.all?!0:null}let b=y,x;return t[25]!==b||t[26]!==m||t[27]!==g||t[28]!==v?(x={localBranches:g,remoteBranches:v,isLoading:m,isGitRepository:b},t[25]=b,t[26]=m,t[27]=g,t[28]=v,t[29]=x):x=t[29],x}function qe(e){return e.replace(/^remotes\//,``)}function Je(e){return e.startsWith(`remotes/`)}function Ye(e){return!e.startsWith(`remotes/`)}function Xe(e){return e.fetchStatus}function Ze(e){return e.fetchBranches}var Qe=({directory:e,value:t,onChange:n,className:r,disabled:i,id:a})=>{let{t:o}=f(),{localBranches:s,remoteBranches:c,isLoading:l,isGitRepository:u}=Ke(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 F(e).catch(()=>null):null;if(a)return;let i=localStorage.getItem(V),{sourceBranch:o,shouldClearSavedSourceBranch:s}=K({branches:d,savedSourceBranch:i,rootBranch:t});if(s&&localStorage.removeItem(V),a||r&&d.includes(r))return;o&&n(o)}catch{}})(),()=>{a=!0}},[d,e,i,l,n,t]),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(le,{value:t,onValueChange:n,disabled:i||!u||l,children:[(0,$.jsx)(pe,{id:a,size:`lg`,className:r??`w-fit typography-meta text-foreground`,children:(0,$.jsx)(A,{placeholder:o(l?`multiRun.branchSelector.status.loadingBranches`:`multiRun.branchSelector.placeholder.selectSourceBranch`)})}),(0,$.jsx)(ce,{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)(j,{children:[(0,$.jsx)(I,{className:`font-semibold text-foreground`,children:o(`multiRun.branchSelector.groups.localBranches`)}),s.map(e=>(0,$.jsx)(fe,{value:e,className:`whitespace-normal break-all`,children:e},e))]}),s.length>0&&c.length>0&&(0,$.jsx)(se,{}),c.length>0&&(0,$.jsxs)(j,{children:[(0,$.jsx)(I,{className:`font-semibold text-foreground`,children:o(`multiRun.branchSelector.groups.remoteBranches`)}),c.map(e=>(0,$.jsx)(fe,{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`)})]})},$e=e=>{let t=(0,Ce.c)(36),{value:n,onChange:r,className:i,disabled:a,id:o,portalToBody:s}=e,{t:c}=f(),l=w(et),u=w(tt),d=w(nt),p;t[0]===l?p=t[1]:(p=l(),t[0]=l,t[1]=p);let m=p,h;t[2]===m?h=t[3]:(h=m.filter(rt),t[2]=m,t[3]=h);let g=h,_,v;t[4]!==m.length||t[5]!==u?(_=()=>{m.length===0&&u()},v=[m.length,u],t[4]=m.length,t[5]=u,t[6]=_,t[7]=v):(_=t[6],v=t[7]),X.useEffect(_,v);let y,b;t[8]!==d||t[9]!==a||t[10]!==r||t[11]!==g||t[12]!==n?(y=()=>{if(a)return;let e=n.trim();if(e.length>0&&g.some(t=>t.name===e))return;let t=typeof d==`string`&&d.trim().length>0?d.trim():null;if(t&&g.some(e=>e.name===t)){r(t);return}let i=g[0]?.name;i&&r(i)},b=[d,a,r,g,n],t[8]=d,t[9]=a,t[10]=r,t[11]=g,t[12]=n,t[13]=y,t[14]=b):(y=t[13],b=t[14]),X.useEffect(y,b);let x=n.trim().length>0?n:void 0,S;t[15]===i?S=t[16]:(S=ee(`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]=S);let C;t[17]===c?C=t[18]:(C=c(`multirun.agentSelector.placeholder`),t[17]=c,t[18]=C);let T;t[19]===C?T=t[20]:(T=(0,$.jsx)(A,{placeholder:C}),t[19]=C,t[20]=T);let E;t[21]!==o||t[22]!==S||t[23]!==T?(E=(0,$.jsx)(pe,{id:o,size:`lg`,className:S,children:T}),t[21]=o,t[22]=S,t[23]=T,t[24]=E):E=t[24];let D;t[25]===g?D=t[26]:(D=g.length>0&&(0,$.jsx)(j,{children:g.map(it)}),t[25]=g,t[26]=D);let O;t[27]!==s||t[28]!==D?(O=(0,$.jsx)(ce,{fitContent:!0,portalToBody:s,children:D}),t[27]=s,t[28]=D,t[29]=O):O=t[29];let te;return t[30]!==a||t[31]!==r||t[32]!==x||t[33]!==E||t[34]!==O?(te=(0,$.jsxs)(le,{value:x,onValueChange:r,disabled:a,children:[E,O]}),t[30]=a,t[31]=r,t[32]=x,t[33]=E,t[34]=O,t[35]=te):te=t[35],te};function et(e){return e.getVisibleAgents}function tt(e){return e.loadAgents}function nt(e){return e.currentAgentName}function rt(e){return g(e.mode)}function it(e){return(0,$.jsx)(fe,{value:e.name,className:`w-auto whitespace-nowrap`,children:e.name},e.name)}var at=10485760,ot=5,st=e=>{let t=(0,Ce.c)(3),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(R,{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)(O,{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)(z,{children:[r,(0,$.jsx)(me,{side:`top`,className:`max-w-[240px]`,children:n})]}),t[1]=n,t[2]=i),i},ct=e=>{let t=(0,Ce.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},lt=e=>{let t=D(e.path),n=e.icon?M[e.icon]:null,r=e.color?N[e.color]:void 0,i=(0,$.jsx)(O,{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)(oe,{project:e,className:`size-full object-contain`,fallback:i}):i}),(0,$.jsx)(`span`,{className:`truncate`,children:t})]})},ut=({initialPrompt:e,onCreated:t,onCancel:r,isWindowed:i=!1})=>{let{t:a}=f(),[o,c]=X.useState(``),[l,p]=X.useState(()=>[{id:Ie(),prompt:``,models:[]}]),[g,_]=X.useState(``),[v,b]=X.useState([]),[S,C]=X.useState(!1),[w,T]=X.useState([]),[E,D]=X.useState(!1),[ne,re]=X.useState(!1),[ie,ae]=X.useState(!0),j=X.useRef(null),oe=s(e=>e.currentDirectory??null),se=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},[]),M=h(e=>e.activeProjectId),de=h(e=>e.setActiveProjectIdOnly),N=h(e=>e.projects),[P,F]=X.useState(()=>M??null);X.useEffect(()=>{if(M){F(M);return}!P&&N.length>0&&F(N[0].id)},[M,N,P]);let I=X.useMemo(()=>P?N.find(e=>e.id===P)??null:null,[N,P]),B=I?.path??oe,ge=u(e=>{F(e),e!==M&&de(e)}),_e=X.useMemo(()=>{if(I?.path)return{id:I.id,path:I.path};let e=oe??se;return e?{id:`path:${e}`,path:e}:null},[I,oe,se]),[V]=X.useState(()=>typeof window<`u`&&n()),H=X.useMemo(()=>typeof navigator>`u`?!1:/Macintosh|Mac OS X/.test(navigator.userAgent||``),[]),ve=he(),U=X.useMemo(()=>{if(typeof window>`u`)return null;let e=window.__OPENCHAMBER_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},[]),ye=X.useMemo(()=>V&&H||ve?`pl-[5.5rem]`:`pl-3`,[V,H,ve]),W=X.useMemo(()=>!V||!H||U===null?``:U>=26?`h-12`:U<=15?`h-14`:``,[V,H,U]),G=u(async e=>{e.target.closest(`button, a, input, select, textarea`)||e.button===0&&V&&await d()}),K=u(e=>{r&&e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),r())}),q=!!r;X.useEffect(()=>{if(q)return window.addEventListener(`keydown`,K,!0),()=>window.removeEventListener(`keydown`,K,!0)},[q]);let[be,J]=X.useState(``),{isLoading:Ce,isGitRepository:Z}=Ke(B),Q=X.useRef(!1),we=Z===!0,Te=we&&ie;X.useEffect(()=>{if(Z===!1){Q.current=!0,ae(!1);return}Z===!0&&Q.current&&(Q.current=!1,ae(!0))},[Z]);let Ee=Pe(e=>e.createMultiRun),De=Pe(e=>e.error),Oe=Pe(e=>e.clearError);X.useEffect(()=>{typeof e==`string`&&e.trim().length>0&&p(t=>{let n=[...t];return n.length>0&&!n[0].prompt.trim()&&(n[0]={...n[0],prompt:e}),n})},[e]),X.useEffect(()=>{if(!_e)return;let e=!1;return re(!0),(async()=>{try{let t=await m(_e);e||T(t)}catch{}finally{e||re(!1)}})(),()=>{e=!0}},[_e]);let ke=u((e,t)=>{p(n=>n.map(n=>n.id===e?{...n,...t}:n))}),Ae=u(e=>{p(t=>t.filter(t=>t.id!==e))}),je=u(()=>{p(e=>[...e,{id:Ie(),prompt:``,models:[]}])}),Me=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>at){y.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)});b(t=>[...t,{id:Ie(),filename:r.name,mimeType:r.type||`application/octet-stream`,size:r.size,dataUrl:e}]),n++}catch(e){console.error(`File attach failed`,e),y.error(a(`multirun.launcher.toast.attachFailed`,{fileName:r.name}))}}n>0&&y.success(a(n===1?`multirun.launcher.toast.attachedSingle`:`multirun.launcher.toast.attachedPlural`,{count:n})),j.current&&(j.current.value=``)},Ne=e=>{b(t=>t.filter(t=>t.id!==e))},Fe=X.useMemo(()=>l.reduce((e,t)=>e+t.models.length,0),[l]),Le=async e=>{e.preventDefault();let n=l.filter(e=>e.prompt.trim()&&e.models.length>=1);if(n.length!==0&&!(Fe<1)){C(!0),Oe();try{P&&P!==M&&de(P);let e=v.map(e=>({mime:e.mimeType,filename:e.filename,url:e.dataUrl})),r=w.filter(e=>e.trim().length>0),i=n.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:g||void 0,worktreeBaseBranch:Te?be:void 0,isolateRuns:Te,files:e.length>0?e:void 0,setupCommands:r.length>0?r:void 0},s=await Ee(a);s&&(s.firstSessionId&&x.getState().setCurrentSession(s.firstSessionId),t?.())}finally{C(!1)}}},Re=!!(o.trim()&&l.some(e=>e.prompt.trim()&&e.models.length>=1)&&Fe>=1&&B&&!Ce&&(Z===!1||!Te||be)),ze=w.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:G,className:ee(`relative flex h-12 shrink-0 items-center justify-center border-b app-region-drag select-none`,ye,W),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)(z,{children:[(0,$.jsx)(R,{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)(O,{name:`close`,className:`h-5 w-5`})})}),(0,$.jsx)(me,{children:(0,$.jsx)(`p`,{children:a(`multirun.launcher.actions.closeEsc`)})})]})})]}),(0,$.jsx)(ue,{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)(ct,{htmlFor:`multirun-project`,required:!0,children:a(`multirun.launcher.project.label`)}),N.length>0?(0,$.jsxs)(le,{value:P??void 0,onValueChange:ge,children:[(0,$.jsx)(pe,{id:`multirun-project`,size:`lg`,className:`w-fit max-w-full`,children:I?(0,$.jsx)(A,{children:lt(I)}):(0,$.jsx)(A,{placeholder:a(`multirun.launcher.project.placeholder`)})}),(0,$.jsx)(ce,{fitContent:!0,children:N.map(e=>(0,$.jsx)(fe,{value:e.id,className:`max-w-[24rem]`,children:lt(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)(ct,{htmlFor:`group-name`,required:!0,info:(0,$.jsx)(st,{children:a(`multirun.launcher.groupName.info`)}),children:a(`multirun.launcher.groupName.label`)}),(0,$.jsx)(L,{id:`group-name`,value:o,onChange:e=>c(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)(ct,{htmlFor:`multirun-worktree-base-branch`,info:(0,$.jsx)(st,{children:a(`multirun.launcher.baseBranch.info`)}),children:a(`multirun.launcher.baseBranch.label`)}),(0,$.jsx)(Qe,{directory:B,value:be,onChange:J,disabled:!Te,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)(k,{checked:ie,onChange:ae,disabled:!we,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)(ct,{htmlFor:`multirun-agent`,info:(0,$.jsx)(st,{children:a(`multirun.launcher.agent.info`)}),children:a(`multirun.launcher.agent.label`)}),(0,$.jsx)($e,{value:g,onChange:_,id:`multirun-agent`})]})]}),(0,$.jsxs)(Se,{open:E,onOpenChange:D,children:[(0,$.jsxs)(xe,{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)(O,{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)(O,{name:`arrow-down-s`,className:ee(`h-3.5 w-3.5 text-muted-foreground/50 transition-transform duration-200 ml-auto`,E&&`rotate-180`)})]}),(0,$.jsx)(Y,{children:(0,$.jsx)(`div`,{className:`pt-2 space-y-1.5`,children:ne?(0,$.jsx)(`p`,{className:`typography-meta text-muted-foreground/70 px-2`,children:a(`multirun.launcher.setupCommands.loading`)}):(0,$.jsxs)($.Fragment,{children:[w.map((e,t)=>(0,$.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,$.jsx)(L,{value:e,onChange:e=>{let n=[...w];n[t]=e.target.value,T(n)},placeholder:a(`multirun.launcher.setupCommands.commandPlaceholder`),className:`h-8 flex-1 font-mono text-xs`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>T(w.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)(O,{name:`close`,className:`h-3.5 w-3.5`})})]},`${e}-${t}`)),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>T([...w,``]),className:`flex items-center gap-1 typography-meta text-muted-foreground hover:text-foreground transition-colors px-1`,children:[(0,$.jsx)(O,{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)(ct,{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:j,type:`file`,multiple:!0,className:`hidden`,onChange:Me,accept:`*/*`}),(0,$.jsxs)(z,{children:[(0,$.jsx)(R,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>j.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)(O,{name:`attachment-2`,className:`h-3 w-3`}),a(`multirun.launcher.attachments.attach`)]})}),(0,$.jsx)(me,{children:a(`multirun.launcher.attachments.tooltip`)})]}),v.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)(O,{name:`file-image`,className:`h-3 w-3 text-muted-foreground`}):(0,$.jsx)(O,{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:()=>Ne(e.id),className:`text-muted-foreground hover:text-destructive`,children:(0,$.jsx)(O,{name:`close`,className:`h-3 w-3`})})]},e.id))]})]}),l.map((e,t)=>(0,$.jsx)(dt,{group:e,groupIndex:t,canRemove:l.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)(O,{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:[!Te&&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)(O,{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)(te,{type:`button`,variant:`ghost`,size:`sm`,onClick:r,children:a(`multirun.launcher.actions.cancel`)}),(0,$.jsx)(te,{type:`submit`,size:`sm`,disabled:!Re||S,children:S?a(`multirun.launcher.actions.creating`):(0,$.jsx)($.Fragment,{children:a(`multirun.launcher.actions.startWithRunCount`,{count:Fe})})})]})})]})},dt=e=>{let t=(0,Ce.c)(104),{group:n,groupIndex:r,canRemove:i,onUpdate:a,onRemove:o}=e,{t:s}=f(),[c,l]=X.useState(!1),[d,p]=X.useState(``),[m,h]=X.useState(!1),[g,_]=X.useState(``),[v,y]=X.useState(!1),[b,x]=X.useState(``),S=X.useRef(null),C=X.useRef(null),w=X.useRef(null),T=X.useRef(null),E;t[0]!==n.id||t[1]!==n.models||t[2]!==a?(E=e=>{n.models.length>=ot||a(n.id,{models:[...n.models,e]})},t[0]=n.id,t[1]=n.models,t[2]=a,t[3]=E):E=t[3];let D=u(E),ee;t[4]!==n.id||t[5]!==n.models||t[6]!==a?(ee=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]=ee):ee=t[7];let te=u(ee),ne;t[8]!==n.id||t[9]!==n.models||t[10]!==a?(ne=(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]=ne):ne=t[11];let re=u(ne),ie;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(e,t)=>{if(e.startsWith(`/`)){let n=e.indexOf(` `),r=e.indexOf(`
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),y(!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);if((!e||/\s/.test(e))&&!t.includes(` `)&&!t.includes(`
3
- `)){x(t),y(!0),l(!1);return}}y(!1);let i=n.lastIndexOf(`@`);if(i!==-1){let e=i>0?n[i-1]:null,t=n.substring(i+1);(!e||/\s/.test(e))&&!t.includes(` `)&&!t.includes(`
4
- `)?(p(t),l(!0)):l(!1);return}l(!1)},t[12]=ie):ie=t[12];let k=u(ie),ae;t[13]!==n.id||t[14]!==a?(ae=e=>{a(n.id,{prompt:e})},t[13]=n.id,t[14]=a,t[15]=ae):ae=t[15];let A=u(ae),j;t[16]!==n.prompt||t[17]!==A||t[18]!==k?(j=e=>{let t=n.prompt,r=S.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=be(t,i===-1?r:i,r,`@${a}`);A(o.text),l(!1),p(``),requestAnimationFrame(()=>{let e=S.current;e&&(e.selectionStart=o.caret,e.selectionEnd=o.caret,e.focus()),k(o.text,o.caret)})},t[16]=n.prompt,t[17]=A,t[18]=k,t[19]=j):j=t[19];let oe=u(j),se;t[20]!==n.prompt||t[21]!==A||t[22]!==k?(se=e=>{let t=n.prompt,r=S.current?.selectionStart??t.length,i=t.substring(0,r).lastIndexOf(`@`),a=be(t,i===-1?r:i,r,`@${e}`);A(a.text),l(!1),p(``),requestAnimationFrame(()=>{let e=S.current;e&&(e.selectionStart=a.caret,e.selectionEnd=a.caret,e.focus()),k(a.text,a.caret)})},t[20]=n.prompt,t[21]=A,t[22]=k,t[23]=se):se=t[23];let ce=u(se),le;t[24]!==A||t[25]!==k?(le=e=>{let t=`/${e.name} `;A(t),h(!1),_(``),y(!1),requestAnimationFrame(()=>{let e=S.current;e&&(e.focus(),e.selectionStart=e.value.length,e.selectionEnd=e.value.length),k(t,t.length)})},t[24]=A,t[25]=k,t[26]=le):le=t[26];let M=u(le),ue;t[27]!==n.prompt||t[28]!==A||t[29]!==k?(ue=(e,t)=>{let r=n.prompt,i=S.current?.selectionStart??r.length,a=r.substring(0,i).lastIndexOf(`#`),o=a===-1?i:a,s=`${r.substring(0,o)}#${t} ${r.substring(i)}`,c=o+t.length+2;A(s),y(!1),x(``),requestAnimationFrame(()=>{let e=S.current;e&&(e.selectionStart=c,e.selectionEnd=c,e.focus()),k(s,c)})},t[27]=n.prompt,t[28]=A,t[29]=k,t[30]=ue):ue=t[30];let de=u(ue),N;t[31]!==m||t[32]!==c||t[33]!==v?(N=e=>{if(m&&w.current&&(e.key===`Enter`||e.key===`ArrowUp`||e.key===`ArrowDown`||e.key===`Escape`||e.key===`Tab`)){e.preventDefault(),w.current.handleKeyDown(e.key);return}c&&C.current&&(e.key===`Enter`||e.key===`ArrowUp`||e.key===`ArrowDown`||e.key===`Escape`||e.key===`Tab`)&&(e.preventDefault(),C.current.handleKeyDown(e.key)),v&&T.current&&(e.key===`Enter`||e.key===`ArrowUp`||e.key===`ArrowDown`||e.key===`Escape`||e.key===`Tab`)&&(e.preventDefault(),T.current.handleKeyDown(e.key))},t[31]=m,t[32]=c,t[33]=v,t[34]=N):N=t[34];let F=u(N),fe=r+1,pe;t[35]!==s||t[36]!==fe?(pe=s(`multirun.launcher.groups.groupLabel`,{index:fe}),t[35]=s,t[36]=fe,t[37]=pe):pe=t[37];let I;t[38]===pe?I=t[39]:(I=(0,$.jsx)(`span`,{className:`typography-meta font-medium text-foreground`,children:pe}),t[38]=pe,t[39]=I);let L;t[40]!==i||t[41]!==n.id||t[42]!==o||t[43]!==s?(L=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)(O,{name:`close`,className:`h-3.5 w-3.5`})}),t[40]=i,t[41]=n.id,t[42]=o,t[43]=s,t[44]=L):L=t[44];let R;t[45]!==I||t[46]!==L?(R=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[I,L]}),t[45]=I,t[46]=L,t[47]=R):R=t[47];let me;t[48]===s?me=t[49]:(me=s(`multirun.launcher.groups.prompt.label`),t[48]=s,t[49]=me);let z;t[50]===me?z=t[51]:(z=(0,$.jsx)(ct,{required:!0,children:me}),t[50]=me,t[51]=z);let he=n.prompt,B;t[52]!==A||t[53]!==k?(B=e=>{let t=e.target.value;A(t);let n=e.target.selectionStart??t.length;k(t,n)},t[52]=A,t[53]=k,t[54]=B):B=t[54];let V;t[55]===s?V=t[56]:(V=s(`multirun.launcher.groups.prompt.placeholder`),t[55]=s,t[56]=V);let H;t[57]!==n.prompt||t[58]!==F||t[59]!==B||t[60]!==V?(H=(0,$.jsx)(P,{ref:S,value:he,onChange:B,onKeyDown:F,placeholder:V,className:`typography-meta min-h-[80px] max-h-[200px] resize-none overflow-y-auto field-sizing-content`,required:!0}),t[57]=n.prompt,t[58]=F,t[59]=B,t[60]=V,t[61]=H):H=t[61];let ve;t[62]!==g||t[63]!==M||t[64]!==m?(ve=m?(0,$.jsx)(ge,{ref:w,searchQuery:g,onCommandSelect:M,onClose:()=>h(!1),style:{left:0,top:`auto`,bottom:`calc(100% + 6px)`,marginBottom:0,maxWidth:`100%`}}):null,t[62]=g,t[63]=M,t[64]=m,t[65]=ve):ve=t[65];let U;t[66]!==ce||t[67]!==oe||t[68]!==d||t[69]!==c?(U=c?(0,$.jsx)(ye,{ref:C,searchQuery:d,onFileSelect:oe,onAgentSelect:ce,onClose:()=>l(!1),style:{left:0,top:`auto`,bottom:`calc(100% + 6px)`,marginBottom:0,maxWidth:`100%`}}):null,t[66]=ce,t[67]=oe,t[68]=d,t[69]=c,t[70]=U):U=t[70];let W;t[71]!==de||t[72]!==v||t[73]!==b?(W=v?(0,$.jsx)(_e,{ref:T,searchQuery:b,onSnippetSelect:de,onClose:()=>y(!1),style:{left:0,top:`auto`,bottom:`calc(100% + 6px)`,marginBottom:0,maxWidth:`100%`}}):null,t[71]=de,t[72]=v,t[73]=b,t[74]=W):W=t[74];let G;t[75]!==H||t[76]!==ve||t[77]!==U||t[78]!==W?(G=(0,$.jsxs)(`div`,{className:`relative`,children:[H,ve,U,W]}),t[75]=H,t[76]=ve,t[77]=U,t[78]=W,t[79]=G):G=t[79];let K;t[80]!==z||t[81]!==G?(K=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[z,G]}),t[80]=z,t[81]=G,t[82]=K):K=t[82];let q;t[83]===s?q=t[84]:(q=s(`multirun.launcher.models.info`,{max:ot}),t[83]=s,t[84]=q);let J;t[85]===q?J=t[86]:(J=(0,$.jsx)(st,{children:q}),t[85]=q,t[86]=J);let Y;t[87]===s?Y=t[88]:(Y=s(`multirun.launcher.models.label`),t[87]=s,t[88]=Y);let xe;t[89]!==J||t[90]!==Y?(xe=(0,$.jsx)(ct,{required:!0,info:J,children:Y}),t[89]=J,t[90]=Y,t[91]=xe):xe=t[91];let Se;t[92]!==n.models||t[93]!==D||t[94]!==te||t[95]!==re?(Se=(0,$.jsx)(Re,{selectedModels:n.models,onAdd:D,onRemove:te,onUpdate:re,minModels:1,maxModels:ot}),t[92]=n.models,t[93]=D,t[94]=te,t[95]=re,t[96]=Se):Se=t[96];let Z;t[97]!==xe||t[98]!==Se?(Z=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[xe,Se]}),t[97]=xe,t[98]=Se,t[99]=Z):Z=t[99];let Q;return t[100]!==R||t[101]!==K||t[102]!==Z?(Q=(0,$.jsxs)(`div`,{className:`rounded-lg border border-border p-3 space-y-3`,children:[R,K,Z]}),t[100]=R,t[101]=K,t[102]=Z,t[103]=Q):Q=t[103],Q};export{De as a,Ie as i,$e as n,Te as o,Re as r,ut as t};