tarsk 0.4.21 → 0.4.23

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 (49) hide show
  1. package/dist/index.js +543 -352
  2. package/dist/public/assets/{account-view-D1kGyryt.js → account-view-D5WVMsrD.js} +1 -1
  3. package/dist/public/assets/{alert-dialog-Bk7neo_n.js → alert-dialog-2Kcr7vcf.js} +1 -1
  4. package/dist/public/assets/{api-DL5XaoTS.js → api-XK7H2gI0.js} +1 -1
  5. package/dist/public/assets/{browser-tab-BUOT-D_w.js → browser-tab-CgLMsYM8.js} +1 -1
  6. package/dist/public/assets/chat-input-container-VXGAcgnU.js +1 -0
  7. package/dist/public/assets/context-menu-sx0fb5uQ.js +1 -0
  8. package/dist/public/assets/conversation-history-view-IVxKEbP_.js +1 -0
  9. package/dist/public/assets/{dialogs-config-DmDjliuA.js → dialogs-config-3Hr2GRdt.js} +2 -2
  10. package/dist/public/assets/{diff-view-DXIv51Tn.js → diff-view-v-bVp3Zf.js} +2 -2
  11. package/dist/public/assets/{explorer-tab-view-tyn_6pBh.js → explorer-tab-view-CsPSJADk.js} +2 -2
  12. package/dist/public/assets/explorer-tree-DXXm8_b9.js +1 -0
  13. package/dist/public/assets/{explorer-view-Bw3-gTSX.js → explorer-view-8g0_dmv4.js} +1 -1
  14. package/dist/public/assets/history-view-Cyhu-ped.js +1 -0
  15. package/dist/public/assets/index-DsX2aOD3.js +50 -0
  16. package/dist/public/assets/onboarding-DzgFi5ix.js +1 -0
  17. package/dist/public/assets/onboarding-dialog-lFFrB1GZ.js +1 -0
  18. package/dist/public/assets/{page-toolbar-CvreDTwj.js → page-toolbar-De9hbhUD.js} +1 -1
  19. package/dist/public/assets/{project-settings-view-BJYR_l3u.js → project-settings-view-CVYvsVWo.js} +1 -1
  20. package/dist/public/assets/{provider-details-view-B1eTEo0M.js → provider-details-view-Cp_INkPg.js} +1 -1
  21. package/dist/public/assets/providers-sidebar-Dc3Gk1we.js +1 -0
  22. package/dist/public/assets/react-vendor-4OUTOTE0.js +17 -0
  23. package/dist/public/assets/resizable-D62plzWh.js +1 -0
  24. package/dist/public/assets/{run-stop-button-iZHomql0.js → run-stop-button-ClYpPnNG.js} +2 -2
  25. package/dist/public/assets/{settings-view-C38jeeqJ.js → settings-view-BWQrM94z.js} +2 -2
  26. package/dist/public/assets/{side-panel-container-BqWSTCOr.js → side-panel-container-Bkpb7_cb.js} +2 -2
  27. package/dist/public/assets/{standard-list-item-CpBjveM0.js → standard-list-item-DUKJ8HEG.js} +1 -1
  28. package/dist/public/assets/{store-CAPnOXso.js → store-CJdxpohI.js} +1 -1
  29. package/dist/public/assets/{tab-context-Bmd79Rk0.js → tab-context-D2auNMAI.js} +1 -1
  30. package/dist/public/assets/{tabs-DEmnnGvq.js → tabs-DI_KCGYt.js} +1 -1
  31. package/dist/public/assets/{terminal-panel-r8cb3-tk.js → terminal-panel-4EVJwsCQ.js} +2 -2
  32. package/dist/public/assets/{textarea-BjfyGfGR.js → textarea-Dg4M60Yx.js} +1 -1
  33. package/dist/public/assets/todos-view-D3JYa8fa.js +1 -0
  34. package/dist/public/assets/{use-toast-C9B1H3P9.js → use-toast-C3jyoS6i.js} +1 -1
  35. package/dist/public/assets/{utils-BG_JNnOl.js → utils-4yrqj6yI.js} +1 -1
  36. package/dist/public/index.html +18 -18
  37. package/package.json +1 -1
  38. package/dist/public/assets/chat-input-container-2a99CMGs.js +0 -1
  39. package/dist/public/assets/context-menu-DHHElhQ1.js +0 -1
  40. package/dist/public/assets/conversation-history-view-HVFzgO9e.js +0 -1
  41. package/dist/public/assets/explorer-tree-DOg67ane.js +0 -1
  42. package/dist/public/assets/history-view-BOjZoBCb.js +0 -1
  43. package/dist/public/assets/index-DAw9BEzt.js +0 -50
  44. package/dist/public/assets/onboarding-BgEjTEKs.js +0 -1
  45. package/dist/public/assets/onboarding-dialog-EiVl-ynw.js +0 -1
  46. package/dist/public/assets/providers-sidebar-Df50eL_5.js +0 -1
  47. package/dist/public/assets/react-vendor-CaS5zjF7.js +0 -17
  48. package/dist/public/assets/resizable-DJ5w1ZWX.js +0 -1
  49. package/dist/public/assets/todos-view-MAb840dD.js +0 -1
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{$i as t,Cr as n,Gt as r,Pn as i,Wn as a,Z as o,fi as s,la as c,sa as l,zi as u}from"./dialogs-config-DmDjliuA.js";import{t as d}from"./use-toast-C9B1H3P9.js";var f=e(c(),1),p=l(),m=n();function h(e){let t=(0,p.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=a(`animate-pulse rounded-md bg-muted`,n),t[3]=n,t[4]=i);let o;return t[5]!==r||t[6]!==i?(o=(0,m.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=o):o=t[7],o}function g(){let[e,n]=(0,f.useState)(null),[a,c]=(0,f.useState)(!0);(0,f.useEffect)(()=>{l();let e=()=>{document.visibilityState===`visible`&&l()};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]);async function l(){c(!0);try{n(await o())}catch(e){d({title:`Error`,description:e instanceof Error?e.message:`Failed to load account info`,variant:`destructive`})}finally{c(!1)}}function p(){r(`https://buy.stripe.com/14AcN6feK0Jjbheb2H3Nm03?client_reference_id=${e?.clientReferenceId??``}`)}function g(){r(`https://buy.stripe.com/9B67sMd6CgIh70Y0o33Nm04?client_reference_id=${e?.clientReferenceId??``}`)}if(a)return(0,m.jsxs)(`div`,{className:`max-w-2xl mx-auto p-6`,children:[(0,m.jsxs)(`div`,{className:`mb-6`,children:[(0,m.jsx)(h,{className:`h-8 w-32 mb-2`}),(0,m.jsx)(h,{className:`h-4 w-64`})]}),(0,m.jsxs)(`div`,{className:`space-y-6`,children:[(0,m.jsxs)(`div`,{className:`flex gap-4`,children:[(0,m.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-2`,children:[(0,m.jsx)(h,{className:`h-4 w-20`}),(0,m.jsx)(h,{className:`h-9 w-28`})]}),(0,m.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-3`,children:[(0,m.jsx)(h,{className:`h-4 w-24`}),(0,m.jsx)(h,{className:`h-6 w-32`}),(0,m.jsx)(h,{className:`h-4 w-full`})]})]}),(0,m.jsxs)(`div`,{className:`space-y-3`,children:[(0,m.jsx)(h,{className:`h-4 w-24`}),(0,m.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,m.jsxs)(`div`,{className:`space-y-1 flex-1`,children:[(0,m.jsx)(h,{className:`h-5 w-28`}),(0,m.jsx)(h,{className:`h-4 w-64`})]}),(0,m.jsx)(h,{className:`h-9 w-28 shrink-0`})]}),(0,m.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,m.jsxs)(`div`,{className:`space-y-1 flex-1`,children:[(0,m.jsx)(h,{className:`h-5 w-36`}),(0,m.jsx)(h,{className:`h-4 w-56`}),(0,m.jsx)(h,{className:`h-4 w-32`})]}),(0,m.jsx)(h,{className:`h-9 w-24 shrink-0`})]})]})]})]});let _=e?.plan===`unlimited-pro`;return(0,m.jsxs)(`div`,{className:`max-w-2xl mx-auto p-6`,children:[(0,m.jsxs)(`div`,{className:`mb-6`,children:[(0,m.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Account`}),(0,m.jsx)(`p`,{className:`text-muted-foreground`,children:`Manage your Tarsk plan and prompt balance.`})]}),(0,m.jsxs)(`div`,{className:`space-y-6`,children:[(0,m.jsxs)(`div`,{className:`flex gap-4`,children:[(0,m.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-2`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-muted-foreground`,children:[(0,m.jsx)(s,{className:`h-4 w-4`}),`Balance`]}),(0,m.jsx)(`div`,{className:`flex items-end gap-2`,children:_?(0,m.jsx)(`span`,{className:`text-3xl font-bold`,children:`Unlimited`}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:`text-3xl font-bold`,children:e?.promptsRemaining.toLocaleString()??0}),(0,m.jsx)(`span`,{className:`text-muted-foreground mb-1 text-sm`,children:`prompts remaining`})]})})]}),(0,m.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-3`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-muted-foreground`,children:[(0,m.jsx)(u,{className:`h-4 w-4`}),`Current Plan`]}),(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(`span`,{className:`text-lg font-semibold`,children:_?`Unlimited Pro`:`Pay as you go`}),_&&(0,m.jsx)(`span`,{className:`rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary`,children:`Active`})]}),(0,m.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:_?`You have unlimited prompts with no restrictions.`:`Purchase prompts as needed. Upgrade to Pro for unlimited access.`})]})]}),!_&&(0,m.jsxs)(`div`,{className:`space-y-3`,children:[(0,m.jsx)(`h2`,{className:`text-sm font-semibold text-muted-foreground uppercase tracking-wide`,children:`Add Prompts`}),(0,m.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,m.jsxs)(`div`,{className:`space-y-1`,children:[(0,m.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,m.jsx)(`span`,{className:`font-semibold`,children:`1,000 Prompts`})}),(0,m.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Top up your balance with 1,000 additional prompts for $5.`})]}),(0,m.jsx)(i,{onClick:p,className:`shrink-0`,children:`Top Up Balance`})]}),(0,m.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,m.jsxs)(`div`,{className:`space-y-1`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(u,{className:`h-4 w-4 text-primary`}),(0,m.jsx)(`span`,{className:`font-semibold`,children:`Unlimited Pro Plan`})]}),(0,m.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Unlimited prompts for $100 and lifetime access to Tarsk.`}),(0,m.jsxs)(`ul`,{className:`text-sm text-muted-foreground space-y-0.5`,children:[(0,m.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,m.jsx)(t,{className:`h-3 w-3 text-primary`}),`Unlimited prompts`]}),(0,m.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,m.jsx)(t,{className:`h-3 w-3 text-primary`}),`Priority access`]})]})]}),(0,m.jsx)(i,{onClick:g,className:`shrink-0`,children:`Purchase`})]})]})]})]})}export{g as default};
1
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Cr as t,Gt as n,Pn as r,Vi as i,Wn as a,Z as o,da as s,la as c,pi as l,ta as u}from"./dialogs-config-3Hr2GRdt.js";import{t as d}from"./use-toast-C3jyoS6i.js";var f=e(s(),1),p=c(),m=t();function h(e){let t=(0,p.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=a(`animate-pulse rounded-md bg-muted`,n),t[3]=n,t[4]=i);let o;return t[5]!==r||t[6]!==i?(o=(0,m.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=o):o=t[7],o}function g(){let[e,t]=(0,f.useState)(null),[a,s]=(0,f.useState)(!0);(0,f.useEffect)(()=>{c();let e=()=>{document.visibilityState===`visible`&&c()};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]);async function c(){s(!0);try{t(await o())}catch(e){d({title:`Error`,description:e instanceof Error?e.message:`Failed to load account info`,variant:`destructive`})}finally{s(!1)}}function p(){n(`https://buy.stripe.com/14AcN6feK0Jjbheb2H3Nm03?client_reference_id=${e?.clientReferenceId??``}`)}function g(){n(`https://buy.stripe.com/9B67sMd6CgIh70Y0o33Nm04?client_reference_id=${e?.clientReferenceId??``}`)}if(a)return(0,m.jsxs)(`div`,{className:`max-w-2xl mx-auto p-6`,children:[(0,m.jsxs)(`div`,{className:`mb-6`,children:[(0,m.jsx)(h,{className:`h-8 w-32 mb-2`}),(0,m.jsx)(h,{className:`h-4 w-64`})]}),(0,m.jsxs)(`div`,{className:`space-y-6`,children:[(0,m.jsxs)(`div`,{className:`flex gap-4`,children:[(0,m.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-2`,children:[(0,m.jsx)(h,{className:`h-4 w-20`}),(0,m.jsx)(h,{className:`h-9 w-28`})]}),(0,m.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-3`,children:[(0,m.jsx)(h,{className:`h-4 w-24`}),(0,m.jsx)(h,{className:`h-6 w-32`}),(0,m.jsx)(h,{className:`h-4 w-full`})]})]}),(0,m.jsxs)(`div`,{className:`space-y-3`,children:[(0,m.jsx)(h,{className:`h-4 w-24`}),(0,m.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,m.jsxs)(`div`,{className:`space-y-1 flex-1`,children:[(0,m.jsx)(h,{className:`h-5 w-28`}),(0,m.jsx)(h,{className:`h-4 w-64`})]}),(0,m.jsx)(h,{className:`h-9 w-28 shrink-0`})]}),(0,m.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,m.jsxs)(`div`,{className:`space-y-1 flex-1`,children:[(0,m.jsx)(h,{className:`h-5 w-36`}),(0,m.jsx)(h,{className:`h-4 w-56`}),(0,m.jsx)(h,{className:`h-4 w-32`})]}),(0,m.jsx)(h,{className:`h-9 w-24 shrink-0`})]})]})]})]});let _=e?.plan===`unlimited-pro`;return(0,m.jsxs)(`div`,{className:`max-w-2xl mx-auto p-6`,children:[(0,m.jsxs)(`div`,{className:`mb-6`,children:[(0,m.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Account`}),(0,m.jsx)(`p`,{className:`text-muted-foreground`,children:`Manage your Tarsk plan and prompt balance.`})]}),(0,m.jsxs)(`div`,{className:`space-y-6`,children:[(0,m.jsxs)(`div`,{className:`flex gap-4`,children:[(0,m.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-2`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-muted-foreground`,children:[(0,m.jsx)(l,{className:`h-4 w-4`}),`Balance`]}),(0,m.jsx)(`div`,{className:`flex items-end gap-2`,children:_?(0,m.jsx)(`span`,{className:`text-3xl font-bold`,children:`Unlimited`}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:`text-3xl font-bold`,children:e?.promptsRemaining.toLocaleString()??0}),(0,m.jsx)(`span`,{className:`text-muted-foreground mb-1 text-sm`,children:`prompts remaining`})]})})]}),(0,m.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-3`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-muted-foreground`,children:[(0,m.jsx)(i,{className:`h-4 w-4`}),`Current Plan`]}),(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(`span`,{className:`text-lg font-semibold`,children:_?`Unlimited Pro`:`Pay as you go`}),_&&(0,m.jsx)(`span`,{className:`rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary`,children:`Active`})]}),(0,m.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:_?`You have unlimited prompts with no restrictions.`:`Purchase prompts as needed. Upgrade to Pro for unlimited access.`})]})]}),!_&&(0,m.jsxs)(`div`,{className:`space-y-3`,children:[(0,m.jsx)(`h2`,{className:`text-sm font-semibold text-muted-foreground uppercase tracking-wide`,children:`Add Prompts`}),(0,m.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,m.jsxs)(`div`,{className:`space-y-1`,children:[(0,m.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,m.jsx)(`span`,{className:`font-semibold`,children:`1,000 Prompts`})}),(0,m.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Top up your balance with 1,000 additional prompts for $5.`})]}),(0,m.jsx)(r,{onClick:p,className:`shrink-0`,children:`Top Up Balance`})]}),(0,m.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,m.jsxs)(`div`,{className:`space-y-1`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(i,{className:`h-4 w-4 text-primary`}),(0,m.jsx)(`span`,{className:`font-semibold`,children:`Unlimited Pro Plan`})]}),(0,m.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Unlimited prompts for $100 and lifetime access to Tarsk.`}),(0,m.jsxs)(`ul`,{className:`text-sm text-muted-foreground space-y-0.5`,children:[(0,m.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,m.jsx)(u,{className:`h-3 w-3 text-primary`}),`Unlimited prompts`]}),(0,m.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,m.jsx)(u,{className:`h-3 w-3 text-primary`}),`Priority access`]})]})]}),(0,m.jsx)(r,{onClick:g,className:`shrink-0`,children:`Purchase`})]})]})]})]})}export{g as default};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Cr as t,Fn as n,Wn as r,la as i,sa as a}from"./dialogs-config-DmDjliuA.js";import{at as o,ct as s,it as c,lt as l,ot as u,rt as d,st as f,ut as p}from"./react-vendor-CaS5zjF7.js";var m=a(),h=e(i(),1),g=t(),_=l,v=s,y=h.forwardRef((e,t)=>{let n=(0,m.c)(9),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=r(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,i),n[3]=i,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,g.jsx)(f,{className:o,...a,ref:t}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});y.displayName=f.displayName;var b=h.forwardRef((e,t)=>{let n=(0,m.c)(10),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let s;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,g.jsx)(y,{}),n[3]=s):s=n[3];let c;n[4]===i?c=n[5]:(c=r(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,i),n[4]=i,n[5]=c);let l;return n[6]!==a||n[7]!==t||n[8]!==c?(l=(0,g.jsxs)(v,{children:[s,(0,g.jsx)(o,{ref:t,className:c,...a})]}),n[6]=a,n[7]=t,n[8]=c,n[9]=l):l=n[9],l});b.displayName=o.displayName;var x=e=>{let t=(0,m.c)(8),n,i;t[0]===e?(n=t[1],i=t[2]):({className:n,...i}=e,t[0]=e,t[1]=n,t[2]=i);let a;t[3]===n?a=t[4]:(a=r(`flex flex-col space-y-2 text-center sm:text-left`,n),t[3]=n,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,g.jsx)(`div`,{className:a,...i}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o};x.displayName=`AlertDialogHeader`;var S=e=>{let t=(0,m.c)(8),n,i;t[0]===e?(n=t[1],i=t[2]):({className:n,...i}=e,t[0]=e,t[1]=n,t[2]=i);let a;t[3]===n?a=t[4]:(a=r(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,n),t[3]=n,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,g.jsx)(`div`,{className:a,...i}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o};S.displayName=`AlertDialogFooter`;var C=h.forwardRef((e,t)=>{let n=(0,m.c)(9),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=r(`text-lg font-semibold`,i),n[3]=i,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,g.jsx)(p,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});C.displayName=p.displayName;var w=h.forwardRef((e,t)=>{let n=(0,m.c)(9),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=r(`text-sm text-muted-foreground`,i),n[3]=i,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,g.jsx)(u,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});w.displayName=u.displayName;var T=h.forwardRef((e,t)=>{let i=(0,m.c)(9),a,o;i[0]===e?(a=i[1],o=i[2]):({className:a,...o}=e,i[0]=e,i[1]=a,i[2]=o);let s;i[3]===a?s=i[4]:(s=r(n(),a),i[3]=a,i[4]=s);let c;return i[5]!==o||i[6]!==t||i[7]!==s?(c=(0,g.jsx)(d,{ref:t,className:s,...o}),i[5]=o,i[6]=t,i[7]=s,i[8]=c):c=i[8],c});T.displayName=d.displayName;var E=h.forwardRef((e,t)=>{let i=(0,m.c)(9),a,o;i[0]===e?(a=i[1],o=i[2]):({className:a,...o}=e,i[0]=e,i[1]=a,i[2]=o);let s;i[3]===a?s=i[4]:(s=r(n({variant:`outline`}),`mt-2 sm:mt-0`,a),i[3]=a,i[4]=s);let l;return i[5]!==o||i[6]!==t||i[7]!==s?(l=(0,g.jsx)(c,{ref:t,className:s,...o}),i[5]=o,i[6]=t,i[7]=s,i[8]=l):l=i[8],l});E.displayName=c.displayName;export{w as a,C as c,b as i,T as n,S as o,E as r,x as s,_ as t};
1
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Cr as t,Fn as n,Wn as r,da as i,la as a}from"./dialogs-config-3Hr2GRdt.js";import{at as o,ct as s,it as c,lt as l,ot as u,rt as d,st as f,ut as p}from"./react-vendor-4OUTOTE0.js";var m=a(),h=e(i(),1),g=t(),_=l,v=s,y=h.forwardRef((e,t)=>{let n=(0,m.c)(9),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=r(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,i),n[3]=i,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,g.jsx)(f,{className:o,...a,ref:t}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});y.displayName=f.displayName;var b=h.forwardRef((e,t)=>{let n=(0,m.c)(10),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let s;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,g.jsx)(y,{}),n[3]=s):s=n[3];let c;n[4]===i?c=n[5]:(c=r(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,i),n[4]=i,n[5]=c);let l;return n[6]!==a||n[7]!==t||n[8]!==c?(l=(0,g.jsxs)(v,{children:[s,(0,g.jsx)(o,{ref:t,className:c,...a})]}),n[6]=a,n[7]=t,n[8]=c,n[9]=l):l=n[9],l});b.displayName=o.displayName;var x=e=>{let t=(0,m.c)(8),n,i;t[0]===e?(n=t[1],i=t[2]):({className:n,...i}=e,t[0]=e,t[1]=n,t[2]=i);let a;t[3]===n?a=t[4]:(a=r(`flex flex-col space-y-2 text-center sm:text-left`,n),t[3]=n,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,g.jsx)(`div`,{className:a,...i}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o};x.displayName=`AlertDialogHeader`;var S=e=>{let t=(0,m.c)(8),n,i;t[0]===e?(n=t[1],i=t[2]):({className:n,...i}=e,t[0]=e,t[1]=n,t[2]=i);let a;t[3]===n?a=t[4]:(a=r(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,n),t[3]=n,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,g.jsx)(`div`,{className:a,...i}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o};S.displayName=`AlertDialogFooter`;var C=h.forwardRef((e,t)=>{let n=(0,m.c)(9),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=r(`text-lg font-semibold`,i),n[3]=i,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,g.jsx)(p,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});C.displayName=p.displayName;var w=h.forwardRef((e,t)=>{let n=(0,m.c)(9),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=r(`text-sm text-muted-foreground`,i),n[3]=i,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,g.jsx)(u,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});w.displayName=u.displayName;var T=h.forwardRef((e,t)=>{let i=(0,m.c)(9),a,o;i[0]===e?(a=i[1],o=i[2]):({className:a,...o}=e,i[0]=e,i[1]=a,i[2]=o);let s;i[3]===a?s=i[4]:(s=r(n(),a),i[3]=a,i[4]=s);let c;return i[5]!==o||i[6]!==t||i[7]!==s?(c=(0,g.jsx)(d,{ref:t,className:s,...o}),i[5]=o,i[6]=t,i[7]=s,i[8]=c):c=i[8],c});T.displayName=d.displayName;var E=h.forwardRef((e,t)=>{let i=(0,m.c)(9),a,o;i[0]===e?(a=i[1],o=i[2]):({className:a,...o}=e,i[0]=e,i[1]=a,i[2]=o);let s;i[3]===a?s=i[4]:(s=r(n({variant:`outline`}),`mt-2 sm:mt-0`,a),i[3]=a,i[4]=s);let l;return i[5]!==o||i[6]!==t||i[7]!==s?(l=(0,g.jsx)(c,{ref:t,className:s,...o}),i[5]=o,i[6]=t,i[7]=s,i[8]=l):l=i[8],l});E.displayName=c.displayName;export{w as a,C as c,b as i,T as n,S as o,E as r,x as s,_ as t};
@@ -1 +1 @@
1
- import{Cn as e,Dn as t,En as n,On as r,Sn as i,Tn as a,wn as o}from"./dialogs-config-DmDjliuA.js";async function s(t,n){return o(`api/threads/${e(t)}/explorer?path=${encodeURIComponent(n)}`)}async function c(t,n){return o(`api/threads/${e(t)}/ai-file?path=${encodeURIComponent(n)}`)}async function l(t,n,i){return r(`api/threads/${e(t)}/ai-file`,{path:n,content:i})}async function u(t,n){return i(`api/threads/${e(t)}/explorer?path=${encodeURIComponent(n)}`)}async function d(t,r,i){return n(`api/threads/${e(t)}/explorer`,{path:r,newName:i})}async function f(n,r,i){return t(`api/threads/${e(n)}/explorer/file`,{dirPath:r,name:i})}function p(t,n){return`${a()}/api/threads/${e(t)}/explorer/media?path=${encodeURIComponent(n)}`}async function m(n,r,i){return t(`api/threads/${e(n)}/explorer/folder`,{dirPath:r,name:i})}export{p as a,l as c,c as i,m as n,s as o,u as r,d as s,f as t};
1
+ import{Cn as e,Dn as t,En as n,On as r,Sn as i,Tn as a,wn as o}from"./dialogs-config-3Hr2GRdt.js";async function s(t,n){return o(`api/threads/${e(t)}/explorer?path=${encodeURIComponent(n)}`)}async function c(t,n){return o(`api/threads/${e(t)}/ai-file?path=${encodeURIComponent(n)}`)}async function l(t,n,i){return r(`api/threads/${e(t)}/ai-file`,{path:n,content:i})}async function u(t,n){return i(`api/threads/${e(t)}/explorer?path=${encodeURIComponent(n)}`)}async function d(t,r,i){return n(`api/threads/${e(t)}/explorer`,{path:r,newName:i})}async function f(n,r,i){return t(`api/threads/${e(n)}/explorer/file`,{dirPath:r,name:i})}function p(t,n){return`${a()}/api/threads/${e(t)}/explorer/media?path=${encodeURIComponent(n)}`}async function m(n,r,i){return t(`api/threads/${e(n)}/explorer/folder`,{dirPath:r,name:i})}export{p as a,l as c,c as i,m as n,s as o,u as r,d as s,f as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Cr as t,Gt as n,Ii as r,Rr as i,Wr as a,Xr as o,la as s,sa as c,si as l}from"./dialogs-config-DmDjliuA.js";import{a as u}from"./store-CAPnOXso.js";import{n as d}from"./tab-context-Bmd79Rk0.js";import{t as f}from"./run-stop-button-iZHomql0.js";var p=c(),m=e(s(),1),h=t();function g(){let e=(0,p.c)(41),{devServerUrl:t,browserResetTrigger:s}=d(),{state:c}=u(),{selectedProjectId:g,projects:_}=c,v;if(e[0]!==_||e[1]!==g){let t;e[3]===g?t=e[4]:(t=e=>e.projectId===g,e[3]=g,e[4]=t),v=_.find(t),e[0]=_,e[1]=g,e[2]=v}else v=e[2];let y=v,[b,x]=(0,m.useState)(``),[S,C]=(0,m.useState)(``),[w,T]=(0,m.useState)(`desktop`),E=(0,m.useRef)(null),D;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>{C(``),x(``),E.current&&(E.current.src=``)},e[5]=D):D=e[5];let O;e[6]===s?O=e[7]:(O=[s],e[6]=s,e[7]=O),(0,m.useEffect)(D,O);let k,A;e[8]===t?(k=e[9],A=e[10]):(k=()=>{t&&(x(t),C(t))},A=[t],e[8]=t,e[9]=k,e[10]=A),(0,m.useEffect)(k,A);let j;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>{let t=e.trim();t&&(!t.startsWith(`http://`)&&!t.startsWith(`https://`)&&(t=`http://`+t),x(t),C(t))},e[11]=j):j=e[11];let M=j,N;e[12]===b?N=e[13]:(N=e=>{e.key===`Enter`&&M(b)},e[12]=b,e[13]=N);let P=N,F;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>{if(E.current){let e=E.current.src;E.current.src=``,setTimeout(()=>{E.current&&(E.current.src=e)},0)}},e[14]=F):F=e[14];let I=F,L;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(L={desktop:{width:`100%`,height:`100%`},tablet:{width:`768px`,height:`1024px`},mobile:{width:`375px`,height:`667px`}},e[15]=L):L=e[15];let R=L[w],z;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(z=e=>x(e.target.value),e[16]=z):z=e[16];let B;e[17]!==P||e[18]!==b?(B=(0,h.jsx)(`input`,{type:`text`,value:b,onChange:z,onKeyDown:P,placeholder:`Enter URL...`,className:`flex-1 px-4 py-1.5 text-sm bg-muted rounded-full border border-border outline-none focus:ring-1 focus:ring-ring font-mono`,spellCheck:!1}),e[17]=P,e[18]=b,e[19]=B):B=e[19];let V;e[20]===S?V=e[21]:(V=S&&(0,h.jsx)(`button`,{onClick:I,title:`Refresh page`,className:`p-1.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors`,children:(0,h.jsx)(o,{size:15})}),e[20]=S,e[21]=V);let H;e[22]!==w||e[23]!==S?(H=S&&(0,h.jsxs)(`div`,{className:`flex items-center bg-muted rounded-md p-0.5`,children:[(0,h.jsx)(`button`,{onClick:()=>T(`desktop`),title:`Desktop view`,className:`p-1.5 rounded transition-colors ${w===`desktop`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground hover:bg-background/50`}`,children:(0,h.jsx)(l,{size:15})}),(0,h.jsx)(`button`,{onClick:()=>T(`tablet`),title:`Tablet view`,className:`p-1.5 rounded transition-colors ${w===`tablet`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground hover:bg-background/50`}`,children:(0,h.jsx)(i,{size:15})}),(0,h.jsx)(`button`,{onClick:()=>T(`mobile`),title:`Mobile view`,className:`p-1.5 rounded transition-colors ${w===`mobile`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground hover:bg-background/50`}`,children:(0,h.jsx)(a,{size:15})})]}),e[22]=w,e[23]=S,e[24]=H):H=e[24];let U;e[25]===S?U=e[26]:(U=S&&(0,h.jsx)(`button`,{onClick:()=>void n(S),title:`Open in external browser`,className:`p-1.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors`,children:(0,h.jsx)(r,{size:15})}),e[25]=S,e[26]=U);let W;e[27]!==B||e[28]!==V||e[29]!==H||e[30]!==U?(W=(0,h.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 border-b border-border shrink-0`,children:[B,V,H,U]}),e[27]=B,e[28]=V,e[29]=H,e[30]=U,e[31]=W):W=e[31];let G;e[32]!==R||e[33]!==w||e[34]!==S||e[35]!==y||e[36]!==g?(G=S?(0,h.jsx)(`div`,{className:`flex-1 flex items-center justify-center bg-background`,children:w===`desktop`?(0,h.jsx)(`iframe`,{ref:E,src:S,className:`flex-1 w-full h-full border-none`,title:`Browser`}):(0,h.jsx)(`div`,{className:`bg-white border border-border rounded-lg shadow-lg overflow-hidden transition-all duration-200`,style:{width:R.width,height:R.height,maxWidth:`100%`,maxHeight:`100%`},children:(0,h.jsx)(`iframe`,{ref:E,src:S,className:`w-full h-full border-none`,title:`Browser`})})}):(0,h.jsx)(`div`,{className:`flex-1 flex flex-col items-center justify-center gap-6 text-muted-foreground`,children:g&&y?.runCommand?(0,h.jsx)(f,{projectId:g,runCommand:y.runCommand,large:!0}):(0,h.jsx)(`p`,{className:`text-sm`,children:`Enter a URL to browse`})}),e[32]=R,e[33]=w,e[34]=S,e[35]=y,e[36]=g,e[37]=G):G=e[37];let K;return e[38]!==W||e[39]!==G?(K=(0,h.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden`,children:[W,G]}),e[38]=W,e[39]=G,e[40]=K):K=e[40],K}export{g as BrowserTab};
1
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Cr as t,Gt as n,Ri as r,Rr as i,Wr as a,Xr as o,ci as s,da as c,la as l}from"./dialogs-config-3Hr2GRdt.js";import{a as u}from"./store-CJdxpohI.js";import{n as d}from"./tab-context-D2auNMAI.js";import{t as f}from"./run-stop-button-ClYpPnNG.js";var p=l(),m=e(c(),1),h=t();function g(){let e=(0,p.c)(41),{devServerUrl:t,browserResetTrigger:c}=d(),{state:l}=u(),{selectedProjectId:g,projects:_}=l,v;if(e[0]!==_||e[1]!==g){let t;e[3]===g?t=e[4]:(t=e=>e.projectId===g,e[3]=g,e[4]=t),v=_.find(t),e[0]=_,e[1]=g,e[2]=v}else v=e[2];let y=v,[b,x]=(0,m.useState)(``),[S,C]=(0,m.useState)(``),[w,T]=(0,m.useState)(`desktop`),E=(0,m.useRef)(null),D;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>{C(``),x(``),E.current&&(E.current.src=``)},e[5]=D):D=e[5];let O;e[6]===c?O=e[7]:(O=[c],e[6]=c,e[7]=O),(0,m.useEffect)(D,O);let k,A;e[8]===t?(k=e[9],A=e[10]):(k=()=>{t&&(x(t),C(t))},A=[t],e[8]=t,e[9]=k,e[10]=A),(0,m.useEffect)(k,A);let j;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>{let t=e.trim();t&&(!t.startsWith(`http://`)&&!t.startsWith(`https://`)&&(t=`http://`+t),x(t),C(t))},e[11]=j):j=e[11];let M=j,N;e[12]===b?N=e[13]:(N=e=>{e.key===`Enter`&&M(b)},e[12]=b,e[13]=N);let P=N,F;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>{if(E.current){let e=E.current.src;E.current.src=``,setTimeout(()=>{E.current&&(E.current.src=e)},0)}},e[14]=F):F=e[14];let I=F,L;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(L={desktop:{width:`100%`,height:`100%`},tablet:{width:`768px`,height:`1024px`},mobile:{width:`375px`,height:`667px`}},e[15]=L):L=e[15];let R=L[w],z;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(z=e=>x(e.target.value),e[16]=z):z=e[16];let B;e[17]!==P||e[18]!==b?(B=(0,h.jsx)(`input`,{type:`text`,value:b,onChange:z,onKeyDown:P,placeholder:`Enter URL...`,className:`flex-1 px-4 py-1.5 text-sm bg-muted rounded-full border border-border outline-none focus:ring-1 focus:ring-ring font-mono`,spellCheck:!1}),e[17]=P,e[18]=b,e[19]=B):B=e[19];let V;e[20]===S?V=e[21]:(V=S&&(0,h.jsx)(`button`,{onClick:I,title:`Refresh page`,className:`p-1.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors`,children:(0,h.jsx)(o,{size:15})}),e[20]=S,e[21]=V);let H;e[22]!==w||e[23]!==S?(H=S&&(0,h.jsxs)(`div`,{className:`flex items-center bg-muted rounded-md p-0.5`,children:[(0,h.jsx)(`button`,{onClick:()=>T(`desktop`),title:`Desktop view`,className:`p-1.5 rounded transition-colors ${w===`desktop`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground hover:bg-background/50`}`,children:(0,h.jsx)(s,{size:15})}),(0,h.jsx)(`button`,{onClick:()=>T(`tablet`),title:`Tablet view`,className:`p-1.5 rounded transition-colors ${w===`tablet`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground hover:bg-background/50`}`,children:(0,h.jsx)(i,{size:15})}),(0,h.jsx)(`button`,{onClick:()=>T(`mobile`),title:`Mobile view`,className:`p-1.5 rounded transition-colors ${w===`mobile`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground hover:bg-background/50`}`,children:(0,h.jsx)(a,{size:15})})]}),e[22]=w,e[23]=S,e[24]=H):H=e[24];let U;e[25]===S?U=e[26]:(U=S&&(0,h.jsx)(`button`,{onClick:()=>void n(S),title:`Open in external browser`,className:`p-1.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors`,children:(0,h.jsx)(r,{size:15})}),e[25]=S,e[26]=U);let W;e[27]!==B||e[28]!==V||e[29]!==H||e[30]!==U?(W=(0,h.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 border-b border-border shrink-0`,children:[B,V,H,U]}),e[27]=B,e[28]=V,e[29]=H,e[30]=U,e[31]=W):W=e[31];let G;e[32]!==R||e[33]!==w||e[34]!==S||e[35]!==y||e[36]!==g?(G=S?(0,h.jsx)(`div`,{className:`flex-1 flex items-center justify-center bg-background`,children:w===`desktop`?(0,h.jsx)(`iframe`,{ref:E,src:S,className:`flex-1 w-full h-full border-none`,title:`Browser`}):(0,h.jsx)(`div`,{className:`bg-white border border-border rounded-lg shadow-lg overflow-hidden transition-all duration-200`,style:{width:R.width,height:R.height,maxWidth:`100%`,maxHeight:`100%`},children:(0,h.jsx)(`iframe`,{ref:E,src:S,className:`w-full h-full border-none`,title:`Browser`})})}):(0,h.jsx)(`div`,{className:`flex-1 flex flex-col items-center justify-center gap-6 text-muted-foreground`,children:g&&y?.runCommand?(0,h.jsx)(f,{projectId:g,runCommand:y.runCommand,large:!0}):(0,h.jsx)(`p`,{className:`text-sm`,children:`Enter a URL to browse`})}),e[32]=R,e[33]=w,e[34]=S,e[35]=y,e[36]=g,e[37]=G):G=e[37];let K;return e[38]!==W||e[39]!==G?(K=(0,h.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden`,children:[W,G]}),e[38]=W,e[39]=G,e[40]=K):K=e[40],K}export{g as BrowserTab};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{$ as t,$r as n,Ci as r,Cr as i,D as a,Di as o,Fi as s,Hn as c,Jr as l,Ki as u,Lr as d,Nr as f,Or as p,Pi as m,Pn as h,Q as g,Qr as _,Rn as v,Tn as y,Tt as b,Un as x,Vr as S,Wn as C,Y as w,Yi as T,Yt as E,Zi as D,_i as O,aa as k,bn as A,cn as j,d as M,da as N,di as P,fi as F,fn as I,ji as L,jt as R,kr as z,kt as ee,la as te,m as ne,ni as re,nt as ie,on as ae,pn as B,qi as V,ta as oe,tt as se,vi as H,w as U,xi as W,xn as G,y as K,zn as ce}from"./dialogs-config-3Hr2GRdt.js";import{gt as q}from"./react-vendor-4OUTOTE0.js";import{a as le,l as J,s as ue,t as Y,u as de}from"./store-CJdxpohI.js";import{c as fe,s as pe,u as X}from"./history-view-Cyhu-ped.js";import{a as me,c as he,i as ge,o as _e,s as ve,t as ye}from"./alert-dialog-2Kcr7vcf.js";import{n as be}from"./tab-context-D2auNMAI.js";import{r as xe}from"./onboarding-DzgFi5ix.js";var Z=te(),Q=e(N(),1),$=i();function Se(e){let t=(0,Z.c)(24),{node:n,level:r,renderNode:i,defaultOpen:a,indent:o,childContainerClassName:s,openState:c,onToggle:l}=e,u=!!(n.children&&n.children.length>0),d=c[n.id]??a,f;t[0]!==n.id||t[1]!==l?(f=()=>l(n.id),t[0]=n.id,t[1]=l,t[2]=f):f=t[2];let p=f,m;t[3]!==u||t[4]!==d||t[5]!==r||t[6]!==n||t[7]!==i||t[8]!==p?(m=i(n,{isOpen:d,level:r,toggle:p,hasChildren:u}),t[3]=u,t[4]=d,t[5]=r,t[6]=n,t[7]=i,t[8]=p,t[9]=m):m=t[9];let h;t[10]!==s||t[11]!==a||t[12]!==u||t[13]!==o||t[14]!==d||t[15]!==r||t[16]!==n.children||t[17]!==l||t[18]!==c||t[19]!==i?(h=u&&d&&(0,$.jsx)(`div`,{style:{paddingLeft:o},className:s,children:n.children.map(e=>(0,$.jsx)(Se,{node:e,level:r+1,renderNode:i,defaultOpen:a,indent:o,childContainerClassName:s,openState:c,onToggle:l},e.id))}),t[10]=s,t[11]=a,t[12]=u,t[13]=o,t[14]=d,t[15]=r,t[16]=n.children,t[17]=l,t[18]=c,t[19]=i,t[20]=h):h=t[20];let g;return t[21]!==m||t[22]!==h?(g=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[m,h]}),t[21]=m,t[22]=h,t[23]=g):g=t[23],g}function Ce(e){let t=(0,Z.c)(23),{nodes:n,renderNode:r,resetKey:i,defaultOpen:a,indent:o,childContainerClassName:s,className:c}=e,l=a===void 0?!1:a,u=o===void 0?16:o,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d={},t[0]=d):d=t[0];let[f,p]=(0,Q.useState)(d),[m,h]=(0,Q.useState)(i);i!==m&&(h(i),p({}));let g;t[1]===l?g=t[2]:(g=e=>{p(t=>({...t,[e]:!(t[e]??l)}))},t[1]=l,t[2]=g);let _=g,v;t[3]===c?v=t[4]:(v=C(`min-w-0`,c),t[3]=c,t[4]=v);let y;if(t[5]!==s||t[6]!==l||t[7]!==_||t[8]!==u||t[9]!==n||t[10]!==f||t[11]!==r){let e;t[13]!==s||t[14]!==l||t[15]!==_||t[16]!==u||t[17]!==f||t[18]!==r?(e=e=>(0,$.jsx)(Se,{node:e,level:0,renderNode:r,defaultOpen:l,indent:u,childContainerClassName:s,openState:f,onToggle:_},e.id),t[13]=s,t[14]=l,t[15]=_,t[16]=u,t[17]=f,t[18]=r,t[19]=e):e=t[19],y=n.map(e),t[5]=s,t[6]=l,t[7]=_,t[8]=u,t[9]=n,t[10]=f,t[11]=r,t[12]=y}else y=t[12];let b;return t[20]!==v||t[21]!==y?(b=(0,$.jsx)(`div`,{className:v,children:y}),t[20]=v,t[21]=y,t[22]=b):b=t[22],b}var we=(0,Q.createContext)({todos:[],setTodos:()=>{}});function Te(e){let t=(0,Z.c)(10),{children:n,threadId:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=[],t[0]=i):i=t[0];let[a,o]=(0,Q.useState)(i),s=(0,Q.useRef)(-1),c;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=(e,t)=>{t>=s.current&&(s.current=t,o(e))},t[1]=c):c=t[1];let l=c,u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>{s.current=-1,o([])},t[2]=u):u=t[2];let d;t[3]===r?d=t[4]:(d=[r],t[3]=r,t[4]=d),(0,Q.useEffect)(u,d);let f;t[5]===a?f=t[6]:(f={todos:a,setTodos:l},t[5]=a,t[6]=f);let p;return t[7]!==n||t[8]!==f?(p=(0,$.jsx)(we.Provider,{value:f,children:n}),t[7]=n,t[8]=f,t[9]=p):p=t[9],p}function Ee(e){let t=[e.result,e.content],n=[];for(let e of t)if(typeof e==`string`)n.push(e);else if(Array.isArray(e))for(let t of e)typeof t==`object`&&t&&`text`in t&&typeof t.text==`string`&&n.push(t.text);for(let e of n){let t=e.trim();if(t.startsWith(`{`))try{let e=JSON.parse(t);if(e&&Array.isArray(e.todos))return e.todos}catch(e){console.error(`Failed to parse todo JSON:`,e)}}return null}function De(e){let t=(0,Z.c)(5),{todos:n,sequence:r}=e,{setTodos:i}=(0,Q.useContext)(we),a,o;return t[0]!==r||t[1]!==i||t[2]!==n?(a=()=>{i(n,r)},o=[n,i,r],t[0]=r,t[1]=i,t[2]=n,t[3]=a,t[4]=o):(a=t[3],o=t[4]),(0,Q.useEffect)(a,o),null}var Oe=new Map,ke=new Map;function Ae(e){return Oe.get(e)}function je(e,t){let n=ke.get(e);return n||(n=new Set,ke.set(e,n)),n.add(t),()=>{n.delete(t),n.size===0&&ke.delete(e)}}function Me(e){let t=ke.get(e);if(t)for(let e of t)e()}function Ne(e,t){return async function(n,r){let i=await fetch(e+`/api/browser-js/execute-tool`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({threadId:t,toolName:n,params:r})});if(!i.ok){let e=await i.text();try{let t=JSON.parse(e).error||{};e=t.details||t.message||e}catch{}return{text:null,error:`Tool `+n+` failed: `+e}}let a=await i.json();return{text:a.content&&a.content[0]?a.content[0].text:null,error:null}}}function Pe(e,t,n){if(Oe.has(e))return;Oe.set(e,{status:`running`}),Me(e);let r=y();(async()=>{try{let i=Ne(r,n),a=Object.getPrototypeOf(async function(){}).constructor,o=await new a(`callTool`,t)(i),s=o===void 0?null:o;Oe.set(e,{status:`success`,result:s}),Me(e),await I(e,s)}catch(t){let n=t instanceof Error?t.stack||t.message:String(t);Oe.set(e,{status:`error`,error:n}),Me(e);try{await I(e,{error:n})}catch(e){console.error(`[browser-js-executor] failed to submit error result`,e)}}})()}var Fe=()=>{if(typeof window>`u`)return null;let e=window.SpeechRecognition||window.webkitSpeechRecognition;return e?new e:null};function Ie(){let e=(0,Z.c)(14),[t,n]=(0,Q.useState)(!1),[r,i]=(0,Q.useState)(``),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(!1),l=(0,Q.useRef)(null),u=(0,Q.useRef)(``),d,f;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>{try{let e=Fe();e?(e.continuous=!0,e.interimResults=!0,e.lang=`en-US`,e.onstart=()=>{n(!0),o(null),u.current=``},e.onresult=e=>{let t=``;for(let n=e.resultIndex;n<e.results.length;n++){let r=e.results[n][0].transcript;e.results[n].isFinal?i(e=>e+r+` `):t+=r}u.current=t},e.onerror=e=>{console.error(`Speech recognition error:`,e.error),o(e.error||`An error occurred during speech recognition`)},e.onend=()=>{n(!1)},l.current=e,c(!0)):(c(!1),o(`Speech Recognition API is not supported in your browser`))}catch(e){console.error(`Failed to initialize speech recognition:`,e),c(!1),o(`Failed to initialize speech recognition`)}return()=>{l.current&&l.current.abort()}},f=[],e[0]=d,e[1]=f):(d=e[0],f=e[1]),(0,Q.useEffect)(d,f);let p;e[2]===t?p=e[3]:(p=()=>{l.current&&!t&&l.current.start()},e[2]=t,e[3]=p);let m=p,h;e[4]===t?h=e[5]:(h=()=>{l.current&&t&&l.current.stop()},e[4]=t,e[5]=h);let g=h,_;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>{i(``),u.current=``},e[6]=_):_=e[6];let v=_,y;return e[7]!==a||e[8]!==t||e[9]!==s||e[10]!==m||e[11]!==g||e[12]!==r?(y={isListening:t,transcript:r,error:a,startListening:m,stopListening:g,resetTranscript:v,isSupported:s},e[7]=a,e[8]=t,e[9]=s,e[10]=m,e[11]=g,e[12]=r,e[13]=y):y=e[13],y}function Le({initialValue:e}={}){let{state:n,dispatch:r}=le(),[i,a]=(0,Q.useState)(e??``),[o,s]=(0,Q.useState)(-1),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(0),[f,p]=(0,Q.useState)([]),[m,h]=(0,Q.useState)(()=>(n.selectedThreadId?n.projectModelSelections[n.selectedThreadId]:void 0)??null),_=(0,Q.useRef)(m?.id??``),v=(0,Q.useRef)(m?.provider??``),y=(0,Q.useRef)(null),[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)([]),[D,O]=(0,Q.useState)(!1),[k,j]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)(!1),[P,F]=(0,Q.useState)([]),[I,L]=(0,Q.useState)(null),[R,z]=(0,Q.useState)([]),[ee,te]=(0,Q.useState)(!1),[ne,re]=(0,Q.useState)(``),[ie,ae]=(0,Q.useState)(0),[B,V]=(0,Q.useState)([]),[oe,H]=(0,Q.useState)([]),[W,G]=(0,Q.useState)(!1),[K,ce]=(0,Q.useState)(``),q=(0,Q.useRef)(null),J=(0,Q.useRef)(null),ue=(0,Q.useRef)(null),de=(0,Q.useRef)(null),fe=(0,Q.useRef)(null),pe=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{_.current=m?.id??``,v.current=m?.provider??``},[m?.id,m?.provider]);let X=(0,Q.useCallback)((e,t)=>{h(e);let i=n.selectedThreadId;if(!i||(r({type:Y.SetProjectModel,threadId:i,model:e}),t?.persist===!1))return;let a=`${i}:${e.provider??``}:${e.id}`;y.current!==a&&(y.current=a,console.log(`[useChatInputState] Persisting model to thread:`,{threadId:i,model:{id:e.id,provider:e.provider}}),A(i,{model:e.id,modelProvider:e.provider}).then(()=>{y.current===a&&(y.current=null),console.log(`[useChatInputState] Model persisted successfully`)}).catch(e=>{y.current===a&&(y.current=null),console.error(`Failed to save model to thread:`,e)}))},[n.selectedThreadId,r]);(0,Q.useEffect)(()=>{(async()=>{let e=n.selectedProjectId?n.projects.find(e=>e.projectId===n.selectedProjectId)?.threads.find(e=>e.threadId===n.selectedThreadId):void 0,r=n.selectedThreadId?n.projectModelSelections[n.selectedThreadId]:void 0,i=e?.model??r?.id??null,a=e?.modelProvider??r?.provider??null;console.log(`[useChatInputState] Loading models for thread:`,{threadId:n.selectedThreadId,projectId:n.selectedProjectId,currentThread:e?{model:e.model,modelProvider:e.modelProvider}:void 0,storedModel:r?{id:r.id,provider:r.provider}:void 0,savedModelId:i,savedModelProvider:a});try{let e=await t(),n=Object.values(e).flat();if(n.length===0){p([]),h(null);return}p(n);let r=i&&a?n.find(e=>e.id===i&&e.provider===a)??null:null,o=n[0],s=r??o,c=!r&&!!(i||a),l=_.current===s.id&&v.current===s.provider;console.log(`[useChatInputState] Model selection decision:`,{matchedSavedModel:r?{id:r.id}:null,fallbackModel:{id:o.id},modelToSelect:{id:s.id},shouldPersistFallback:c,hasSameSelection:l,currentSelected:{id:_.current,provider:v.current}}),l||X(s,{persist:c})}catch(e){console.error(`Failed to load enabled models:`,e)}})()},[n.selectedThreadId,n.selectedProjectId,n.projects,X]);let me=(0,Q.useRef)(X);(0,Q.useEffect)(()=>{me.current=X},[X]),(0,Q.useEffect)(()=>{n.configUpdatedAt!==0&&(async()=>{try{let e=await t(),n=Object.values(e).flat();if(n.length>0){p(n);let e=_.current,t=v.current;n.some(n=>n.id===e&&n.provider===t)||me.current(n[0],{persist:!0})}}catch(e){console.error(`Failed to reload enabled models:`,e)}})()},[n.configUpdatedAt]),(0,Q.useEffect)(()=>{!M||P.length>0||(async()=>{try{let e=await g(),t=Object.values(e).flat();t.length>0&&(F(t),L(e=>e??t[0]))}catch(e){console.error(`Failed to load image models:`,e)}})()},[M,P.length]);let[he,ge]=(0,Q.useState)(n.selectedThreadId);return(0,Q.useEffect)(()=>{n.selectedThreadId!==he&&setTimeout(()=>{ge(n.selectedThreadId),z([]),te(!1),V([]),H([]),G(!1),O(!1),N(!1),j(!1)},0)},[n.selectedThreadId,he]),(0,Q.useEffect)(()=>{n.selectedThreadId&&b(n.selectedThreadId).then(({commands:e,skills:t})=>{console.log(`Loaded slash commands:`,e,`skills:`,t),V(e),H(t)}).catch(e=>console.error(`Failed to load slash commands and skills:`,e))},[n.selectedThreadId]),(0,Q.useEffect)(()=>{n.focusChatInput&&n.selectedThreadId&&!n.isStreaming&&(J.current?.focus(),r({type:Y.ClearFocusChatInput}))},[n.focusChatInput,n.selectedThreadId,n.isStreaming,r]),(0,Q.useEffect)(()=>{let e=e=>{ue.current&&!ue.current.contains(e.target)&&S(!1),de.current&&!de.current.contains(e.target)&&w(!1)};if(x||C)return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[x,C]),{message:i,setMessage:a,historyIndex:o,setHistoryIndex:s,draftMessage:c,setDraftMessage:l,cursorPosition:u,setCursorPosition:d,availableModels:f,setAvailableModels:p,selectedModel:m,setSelectedModel:X,selectedModelIdRef:_,showModelMenu:x,setShowModelMenu:S,showPlusMenu:C,setShowPlusMenu:w,attachments:T,setAttachments:E,planMode:D,setPlanMode:O,ralphMode:k,setRalphMode:j,imageMode:M,setImageMode:N,availableImageModels:P,setAvailableImageModels:F,selectedImageModel:I,setSelectedImageModel:L,allFiles:R,setAllFiles:z,showSuggestions:ee,setShowSuggestions:te,suggestionQuery:ne,setSuggestionQuery:re,selectedIndex:ie,setSelectedIndex:ae,slashCommands:B,setSlashCommands:V,skills:oe,setSkills:H,showCommandSuggestions:W,setShowCommandSuggestions:G,commandQuery:K,setCommandQuery:ce,fileInputRef:q,textareaRef:J,modelMenuRef:ue,plusMenuRef:de,suggestionsRef:fe,commandSuggestionsRef:pe,handleNewChat:async()=>{if(n.selectedThreadId)try{let e=await U(n.selectedThreadId);r({type:Y.ClearMessages}),console.log(`New conversation started:`,e);let t=await se(n.selectedThreadId);r({type:Y.SetMessages,messages:t.messages})}catch(e){console.error(`Failed to start new chat:`,e)}},state:n,dispatch:r}}var Re=e=>{M(e)};function ze(e){let t=(0,Z.c)(102),{message:n,setMessage:r,attachments:i,selectedModel:a,onSend:o,isStreaming:s,selectedThreadId:c,isListening:l,stopListening:u,resetTranscript:d,dispatch:f,historyIndex:p,setHistoryIndex:m,draftMessage:h,setDraftMessage:g,cursorPosition:_,setCursorPosition:v,showSuggestions:y,setShowSuggestions:b,suggestionQuery:x,setSuggestionQuery:S,allFiles:C,setAllFiles:w,selectedIndex:T,setSelectedIndex:E,showCommandSuggestions:D,setShowCommandSuggestions:O,commandQuery:k,setCommandQuery:A,slashCommands:j,skills:M,textareaRef:N,setAttachments:P,planMode:F,setPlanMode:I,ralphMode:L,setRalphMode:R,imageMode:z,setImageMode:te,selectedImageModel:re}=e,ie;t[0]!==i||t[1]!==f||t[2]!==z||t[3]!==l||t[4]!==s||t[5]!==n||t[6]!==o||t[7]!==F||t[8]!==L||t[9]!==d||t[10]!==re||t[11]!==a||t[12]!==c||t[13]!==P||t[14]!==g||t[15]!==m||t[16]!==r||t[17]!==u||t[18]!==N?(ie=()=>{if(!n.trim()&&i.length===0||!c)return;let e=z?re:a;e&&(l&&(u(),d()),s?f({type:Y.EnqueueChatMessage,message:{id:`queued-${Date.now()}`,threadId:c,message:n,model:e.id,attachments:i,provider:e.provider,planMode:F,imageMode:z,ralphMode:L}}):o(n,e.id,i,e.provider,F,z,L),Re(n),r(``),P([]),m(-1),g(``),N.current&&(N.current.style.height=`auto`))},t[0]=i,t[1]=f,t[2]=z,t[3]=l,t[4]=s,t[5]=n,t[6]=o,t[7]=F,t[8]=L,t[9]=d,t[10]=re,t[11]=a,t[12]=c,t[13]=P,t[14]=g,t[15]=m,t[16]=r,t[17]=u,t[18]=N,t[19]=ie):ie=t[19];let ae=ie,B;t[20]!==_||t[21]!==n||t[22]!==r||t[23]!==b||t[24]!==x||t[25]!==N?(B=e=>{let t=n.substring(0,_-x.length-1);r(`${t}${e} ${n.substring(_)}`),b(!1),setTimeout(()=>{if(N.current){N.current.focus();let n=t.length+e.length+1;N.current.setSelectionRange(n,n)}},0)},t[20]=_,t[21]=n,t[22]=r,t[23]=b,t[24]=x,t[25]=N,t[26]=B):B=t[26];let V=B,oe;t[27]!==k||t[28]!==_||t[29]!==n||t[30]!==te||t[31]!==r||t[32]!==I||t[33]!==R||t[34]!==O||t[35]!==N?(oe=e=>{let t=n.substring(0,_-k.length-1),i=n.substring(_);r(`${t}${e.content}${i}`),O(!1),setTimeout(()=>{if(N.current){N.current.focus();let n=t.length+e.content.length;N.current.setSelectionRange(n,n)}},0),e.metadata.mode===`plan`?(I(!0),R(!1),te(!1)):e.metadata.mode===`ralph`&&(R(!0),I(!1),te(!1))},t[27]=k,t[28]=_,t[29]=n,t[30]=te,t[31]=r,t[32]=I,t[33]=R,t[34]=O,t[35]=N,t[36]=oe):oe=t[36];let se=oe,H;t[37]!==k||t[38]!==_||t[39]!==n||t[40]!==r||t[41]!==O||t[42]!==N?(H=e=>{let t=n.substring(0,_-k.length-1),i=n.substring(_),a=e.name.includes(` `)?`/"${e.name}"`:`/${e.name}`;r(`${t}${a}${i}`),O(!1),setTimeout(()=>{if(N.current){N.current.focus();let e=t.length+a.length;N.current.setSelectionRange(e,e)}},0)},t[37]=k,t[38]=_,t[39]=n,t[40]=r,t[41]=O,t[42]=N,t[43]=H):H=t[43];let U=H,W,G,K,ce;if(t[44]!==C||t[45]!==k||t[46]!==h||t[47]!==ae||t[48]!==p||t[49]!==se||t[50]!==V||t[51]!==U||t[52]!==n||t[53]!==T||t[54]!==c||t[55]!==w||t[56]!==A||t[57]!==v||t[58]!==g||t[59]!==m||t[60]!==r||t[61]!==E||t[62]!==O||t[63]!==b||t[64]!==S||t[65]!==D||t[66]!==y||t[67]!==M||t[68]!==j||t[69]!==x){K=e=>{if(D){if(e.key===`ArrowDown`){e.preventDefault(),E((T+1)%W.length);return}if(e.key===`ArrowUp`){e.preventDefault(),E((T-1+W.length)%W.length);return}if(e.key===`Enter`||e.key===`Tab`){e.preventDefault();let t=W[T];t&&(t.type===`command`?se(t.data):U(t.data));return}if(e.key===`Escape`){O(!1);return}}if(y){let t=G.length>0;if(e.key===`ArrowDown`&&t){e.preventDefault(),E((T+1)%G.length);return}if(e.key===`ArrowUp`&&t){e.preventDefault(),E((T-1+G.length)%G.length);return}if(e.key===`Enter`||e.key===`Tab`){e.preventDefault(),G[T]&&V(G[T]);return}if(e.key===`Escape`){b(!1);return}}if(e.key===`Enter`&&!e.shiftKey){e.preventDefault(),ae();return}let t=ne();t.length!==0&&(e.key===`ArrowUp`?(e.preventDefault(),p===-1?(g(n),m(t.length-1),r(t[t.length-1])):p>0&&(m(p-1),r(t[p-1]))):e.key===`ArrowDown`&&(e.preventDefault(),p>0?(m(p-1),r(t[p-1])):p===0&&(m(-1),r(h))))};let e;t[74]!==C||t[75]!==c||t[76]!==w||t[77]!==A||t[78]!==v||t[79]!==r||t[80]!==E||t[81]!==O||t[82]!==b||t[83]!==S?(e=e=>{let t=e.target.value,n=e.target.selectionStart;r(t),v(n);let i=t.substring(0,n),a=i.lastIndexOf(`/`);if(a!==-1){let e=a>0?i[a-1]:``;if(a===0||/\s/.test(e)){let e=i.substring(a+1);e.includes(` `)?O(!1):(A(e),O(!0),b(!1),E(0))}else O(!1)}else{O(!1);let e=i.lastIndexOf(`#`);if(e!==-1){let t=e>0?i[e-1]:``;if(e===0||/\s/.test(t)){let t=i.substring(e+1);t.includes(` `)?b(!1):(S(t),b(!0),E(0),C.length===0&&c&&ee(c).then(e=>{w(e)}).catch(He))}else b(!1)}else b(!1)}let o=e.target;o.style.height=`auto`,o.style.height=`${Math.min(o.scrollHeight,160)}px`},t[74]=C,t[75]=c,t[76]=w,t[77]=A,t[78]=v,t[79]=r,t[80]=E,t[81]=O,t[82]=b,t[83]=S,t[84]=e):e=t[84],ce=e;let i;if(t[85]!==k||t[86]!==M||t[87]!==j){let e;t[89]===k?e=t[90]:(e=e=>e.name.toLowerCase().includes(k.toLowerCase()),t[89]=k,t[90]=e);let n=j.filter(e),r;t[91]===k?r=t[92]:(r=e=>e.name.toLowerCase().includes(k.toLowerCase()),t[91]=k,t[92]=r);let a=M.filter(r);i=[...n.map(Ve),...a.map(Be)],t[85]=k,t[86]=M,t[87]=j,t[88]=i}else i=t[88];W=i.slice(0,10),G=y?C.filter(e=>e.toLowerCase().includes(x.toLowerCase())).slice(0,10):[],t[44]=C,t[45]=k,t[46]=h,t[47]=ae,t[48]=p,t[49]=se,t[50]=V,t[51]=U,t[52]=n,t[53]=T,t[54]=c,t[55]=w,t[56]=A,t[57]=v,t[58]=g,t[59]=m,t[60]=r,t[61]=E,t[62]=O,t[63]=b,t[64]=S,t[65]=D,t[66]=y,t[67]=M,t[68]=j,t[69]=x,t[70]=W,t[71]=G,t[72]=K,t[73]=ce}else W=t[70],G=t[71],K=t[72],ce=t[73];let q;return t[93]!==W||t[94]!==G||t[95]!==K||t[96]!==ae||t[97]!==ce||t[98]!==se||t[99]!==V||t[100]!==U?(q={handleSend:ae,handleKeyDown:K,handleTextareaInput:ce,insertFileReference:V,insertCommand:se,insertSkill:U,allSuggestions:W,fileSuggestions:G},t[93]=W,t[94]=G,t[95]=K,t[96]=ae,t[97]=ce,t[98]=se,t[99]=V,t[100]=U,t[101]=q):q=t[101],q}function Be(e){return{type:`skill`,data:e}}function Ve(e){return{type:`command`,data:e}}function He(e){return console.error(`Failed to fetch files:`,e)}function Ue(e){let t=(0,Z.c)(21),{visible:n,commands:r,skills:i,query:a,selectedIndex:o,onSelectCommand:s,onSelectSkill:c,onMouseEnterSuggestion:l,containerRef:u}=e;if(!n)return null;let f;if(t[0]!==r||t[1]!==a||t[2]!==i){let e;t[4]===a?e=t[5]:(e=e=>e.name.toLowerCase().includes(a.toLowerCase()),t[4]=a,t[5]=e);let n=r.filter(e),o;t[6]===a?o=t[7]:(o=e=>e.name.toLowerCase().includes(a.toLowerCase()),t[6]=a,t[7]=o);let s=i.filter(o);f=[...n.map(Ge),...s.map(We)].slice(0,10),t[0]=r,t[1]=a,t[2]=i,t[3]=f}else f=t[3];let m=f,h;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(d,{className:`h-3 w-3`}),t[8]=h):h=t[8];let g=a&&` matching "${a}"`,_;t[9]===g?_=t[10]:(_=(0,$.jsxs)(`div`,{className:`px-2 py-1.5 text-xs font-semibold text-muted-foreground border-b border-border/50 mb-1 flex items-center gap-2`,children:[h,`Commands & Skills`,g]}),t[9]=g,t[10]=_);let v;t[11]!==m||t[12]!==l||t[13]!==s||t[14]!==c||t[15]!==o?(v=m.length>0?m.map((e,t)=>{let n=t===o;if(e.type===`command`){let r=e.data;return(0,$.jsxs)(`button`,{type:`button`,className:C(`flex w-full flex-col gap-1 rounded-lg px-3 py-2 text-left transition-colors`,n?`bg-accent text-accent-foreground`:`text-popover-foreground hover:bg-accent/50`),onClick:()=>s(r),onMouseEnter:()=>l(t),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(d,{className:`h-3 w-3 text-muted-foreground`}),(0,$.jsxs)(`span`,{className:`font-medium`,children:[`/`,r.name]}),r.metadata.argumentHint&&(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:r.metadata.argumentHint}),r.scope===`project`&&(0,$.jsx)(`span`,{className:`ml-auto text-[10px] rounded-full bg-primary/10 px-1.5 py-0.5 text-primary`,children:`project`})]}),r.metadata.description&&(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:r.metadata.description})]},`cmd-${r.name}`)}else{let r=e.data;return(0,$.jsxs)(`button`,{type:`button`,className:C(`flex w-full flex-col gap-1 rounded-lg px-3 py-2 text-left transition-colors`,n?`bg-accent text-accent-foreground`:`text-popover-foreground hover:bg-accent/50`),onClick:()=>c(r),onMouseEnter:()=>l(t),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(p,{className:`h-3 w-3 text-amber-500`}),(0,$.jsxs)(`span`,{className:`font-medium`,children:[`/`,r.name]}),(0,$.jsx)(`span`,{className:`ml-auto text-[10px] rounded-full bg-amber-500/10 px-1.5 py-0.5 text-amber-700 dark:text-amber-400`,children:`skill`}),r.scope===`project`&&(0,$.jsx)(`span`,{className:`text-[10px] rounded-full bg-primary/10 px-1.5 py-0.5 text-primary`,children:`project`})]}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:r.description})]},`skill-${r.name}`)}}):(0,$.jsxs)(`div`,{className:`px-3 py-4 text-center text-xs text-muted-foreground`,children:[`No commands or skills found.`,(0,$.jsx)(`br`,{}),(0,$.jsxs)(`span`,{className:`text-[10px]`,children:[`Create commands in `,(0,$.jsx)(`code`,{className:`bg-muted px-1 rounded`,children:`.agents/commands/`}),` or skills in `,(0,$.jsx)(`code`,{className:`bg-muted px-1 rounded`,children:`.agents/skills/`})]})]}),t[11]=m,t[12]=l,t[13]=s,t[14]=c,t[15]=o,t[16]=v):v=t[16];let y;return t[17]!==u||t[18]!==_||t[19]!==v?(y=(0,$.jsxs)(`div`,{ref:u,className:`absolute bottom-full left-0 mb-2 w-full max-h-64 overflow-y-auto rounded-xl border border-border bg-popover p-1 shadow-lg z-50 animate-in fade-in slide-in-from-bottom-2`,children:[_,v]}),t[17]=u,t[18]=_,t[19]=v,t[20]=y):y=t[20],y}function We(e){return{type:`skill`,data:e}}function Ge(e){return{type:`command`,data:e}}function Ke(e){return e.startsWith(`image/`)}function qe(e){let t=(0,Z.c)(7),{attachments:n,onRemove:r}=e;if(n.length===0)return null;let i;if(t[0]!==n||t[1]!==r){let e;t[3]===r?e=t[4]:(e=(e,t)=>(0,$.jsx)(`div`,{className:`group relative flex items-center gap-1 rounded-md bg-muted text-xs text-muted-foreground`,children:Ke(e.mimeType)?(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(`img`,{src:`data:${e.mimeType};base64,${e.content}`,alt:e.fileName,className:`h-16 w-16 rounded-md object-cover`}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>r(t),className:`absolute -right-1.5 -top-1.5 flex h-4 w-4 items-center justify-center rounded-full bg-foreground text-background opacity-0 transition-opacity group-hover:opacity-100`,children:[(0,$.jsx)(z,{className:`h-2.5 w-2.5`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Remove attachment`})]})]}):(0,$.jsxs)(`span`,{className:`flex items-center gap-1 px-2 py-1`,children:[(0,$.jsx)(re,{className:`h-3 w-3`}),e.fileName,(0,$.jsxs)(`button`,{type:`button`,onClick:()=>r(t),className:`ml-1 hover:text-foreground`,children:[(0,$.jsx)(z,{className:`h-3 w-3`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Remove attachment`})]})]})},t),t[3]=r,t[4]=e),i=n.map(e),t[0]=n,t[1]=r,t[2]=i}else i=t[2];let a;return t[5]===i?a=t[6]:(a=(0,$.jsx)(`div`,{className:`mb-2 flex flex-wrap gap-1.5`,children:i}),t[5]=i,t[6]=a),a}function Je(e,t){let n=e.target.files;if(!n||n.length===0)return;let r=Array.from(n),i=r.length,a=Array.from({length:i}),o=0;e.target.value=``,r.forEach((e,n)=>{let r=new FileReader;r.onload=()=>{let s=r.result.split(`,`)[1];a[n]={fileName:e.name,content:s,mimeType:e.type||`application/octet-stream`},o+=1,o===i&&t(a)},r.readAsDataURL(e)})}function Ye(e){let t=(0,Z.c)(16),{showSuggestions:n,fileSuggestions:r,suggestionQuery:i,selectedIndex:a,onSelectFile:o,onMouseEnterSuggestion:c,containerRef:u}=e;if(!n||r.length===0)return null;let d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(l,{className:`h-3 w-3`}),t[0]=d):d=t[0];let f;t[1]===i?f=t[2]:(f=(0,$.jsxs)(`div`,{className:`px-2 py-1.5 text-xs font-semibold text-muted-foreground border-b border-border/50 mb-1 flex items-center gap-2`,children:[d,`Files matching "`,i,`"`]}),t[1]=i,t[2]=f);let p;if(t[3]!==r||t[4]!==c||t[5]!==o||t[6]!==a){let e;t[8]!==c||t[9]!==o||t[10]!==a?(e=(e,t)=>{let n=e.split(`/`).pop()??e;return(0,$.jsxs)(`button`,{type:`button`,className:C(`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm text-left transition-colors`,t===a?`bg-accent text-accent-foreground`:`text-popover-foreground hover:bg-accent/50`),onClick:()=>o(e),onMouseEnter:()=>c(t),children:[e.endsWith(`.ts`)||e.endsWith(`.tsx`)||e.endsWith(`.js`)||e.endsWith(`.jsx`)?(0,$.jsx)(s,{className:`h-4 w-4 text-blue-500`}):(0,$.jsx)(m,{className:`h-4 w-4 text-muted-foreground`}),(0,$.jsxs)(`div`,{className:`flex flex-col overflow-hidden`,children:[(0,$.jsx)(`span`,{className:`truncate font-medium`,children:n}),(0,$.jsx)(`span`,{className:`truncate text-[10px] text-muted-foreground opacity-70`,children:e})]})]},e)},t[8]=c,t[9]=o,t[10]=a,t[11]=e):e=t[11],p=r.map(e),t[3]=r,t[4]=c,t[5]=o,t[6]=a,t[7]=p}else p=t[7];let h;return t[12]!==u||t[13]!==f||t[14]!==p?(h=(0,$.jsxs)(`div`,{ref:u,className:`absolute bottom-full left-0 mb-2 w-full max-h-64 overflow-y-auto rounded-xl border border-border bg-popover p-1 shadow-lg z-50 animate-in fade-in slide-in-from-bottom-2`,children:[f,p]}),t[12]=u,t[13]=f,t[14]=p,t[15]=h):h=t[15],h}function Xe(e){let t=(0,Z.c)(3),{provider:n}=e;if(!n)return null;let r=`https://models.tarsk.io/svg/${n}.svg`,i=`${n} logo`,a;return t[0]!==r||t[1]!==i?(a=(0,$.jsx)(`img`,{src:r,alt:i,className:`h-3.5 w-3.5 flex-shrink-0`,onError:Ze}),t[0]=r,t[1]=i,t[2]=a):a=t[2],a}function Ze(e){e.currentTarget.style.visibility=`hidden`}function Qe(e){let t=(0,Z.c)(26),{availableModels:n,selectedModel:r,onModelSelect:i}=e,[a,o]=Q.useState(!1),s=Q.useRef(null),c,l;t[0]===a?(c=t[1],l=t[2]):(c=()=>{let e=e=>{s.current&&!s.current.contains(e.target)&&o(!1)};if(a)return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},l=[a],t[0]=a,t[1]=c,t[2]=l),Q.useEffect(c,l);let u;t[3]===i?u=t[4]:(u=e=>{i(e),o(!1)},t[3]=i,t[4]=u);let d=u,f;t[5]===a?f=t[6]:(f=()=>o(!a),t[5]=a,t[6]=f);let p=r?.provider,m;t[7]===p?m=t[8]:(m=(0,$.jsx)(Xe,{provider:p}),t[7]=p,t[8]=m);let g;t[9]===r?g=t[10]:(g=r?xe(r.id):`No model`,t[9]=r,t[10]=g);let _;t[11]===g?_=t[12]:(_=(0,$.jsx)(`span`,{className:`text-xs font-medium`,children:g}),t[11]=g,t[12]=_);let v;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(D,{className:`h-3 w-3`}),t[13]=v):v=t[13];let y;t[14]!==f||t[15]!==m||t[16]!==_?(y=(0,$.jsxs)(h,{variant:`action`,size:`icon-sm`,className:`gap-1 w-auto px-2`,onClick:f,children:[m,_,v]}),t[14]=f,t[15]=m,t[16]=_,t[17]=y):y=t[17];let b;t[18]!==n||t[19]!==d||t[20]!==r?.id||t[21]!==a?(b=a&&(0,$.jsx)(`div`,{className:`absolute bottom-full left-0 mb-1 w-80 max-h-80 overflow-y-auto rounded-lg border border-border bg-popover p-1 shadow-md z-50`,children:Object.entries(n.reduce($e,{})).map(e=>{let[t,n]=e;return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-semibold text-muted-foreground uppercase tracking-wide`,children:[(0,$.jsx)(Xe,{provider:t}),t]}),n.map(e=>(0,$.jsx)(`button`,{type:`button`,className:`flex w-full items-center whitespace-nowrap rounded-md px-3 py-1.5 pl-8 text-sm text-popover-foreground hover:bg-accent ${e.id===r?.id?`bg-accent font-medium`:``}`,onClick:()=>d(e),children:xe(e.id)},e.id))]},t)})}),t[18]=n,t[19]=d,t[20]=r?.id,t[21]=a,t[22]=b):b=t[22];let x;return t[23]!==y||t[24]!==b?(x=(0,$.jsxs)(`div`,{className:`relative`,ref:s,children:[y,b]}),t[23]=y,t[24]=b,t[25]=x):x=t[25],x}function $e(e,t){let n=t.provider??`Other`;return e[n]||(e[n]=[]),e[n].push(t),e}var et=[{value:`build`,label:`Build`,icon:r},{value:`plan`,label:`Plan`,icon:H},{value:`image`,label:`Image`,icon:W},{value:`ralph`,label:`Ralph`,icon:_}];function tt(e,t,n){return n?`ralph`:e?`plan`:t?`image`:`build`}function nt(e){let t=(0,Z.c)(31),{planMode:n,imageMode:r,ralphMode:i,setPlanMode:a,setImageMode:o,setRalphMode:s}=e,[c,l]=Q.useState(!1),u=Q.useRef(null),d;t[0]!==r||t[1]!==n||t[2]!==i?(d=tt(n,r,i),t[0]=r,t[1]=n,t[2]=i,t[3]=d):d=t[3];let f=d,p;t[4]===f?p=t[5]:(p=et.find(e=>e.value===f),t[4]=f,t[5]=p);let m=p,g=m.icon,_,v;t[6]===c?(_=t[7],v=t[8]):(_=()=>{let e=function(e){u.current&&!u.current.contains(e.target)&&l(!1)};if(c)return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},v=[c],t[6]=c,t[7]=_,t[8]=v),Q.useEffect(_,v);let y;t[9]!==o||t[10]!==a||t[11]!==s?(y=function(e){a(e===`plan`),o(e===`image`),s(e===`ralph`),l(!1)},t[9]=o,t[10]=a,t[11]=s,t[12]=y):y=t[12];let b=y,x;t[13]===c?x=t[14]:(x=()=>l(!c),t[13]=c,t[14]=x);let S;t[15]===g?S=t[16]:(S=(0,$.jsx)(g,{className:`h-3.5 w-3.5`}),t[15]=g,t[16]=S);let C;t[17]===m.label?C=t[18]:(C=(0,$.jsx)(`span`,{className:`text-xs font-medium`,children:m.label}),t[17]=m.label,t[18]=C);let w;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(D,{className:`h-3 w-3`}),t[19]=w):w=t[19];let T;t[20]!==x||t[21]!==S||t[22]!==C?(T=(0,$.jsxs)(h,{variant:`action`,size:`icon-sm`,className:`gap-1 w-auto px-2`,onClick:x,children:[S,C,w]}),t[20]=x,t[21]=S,t[22]=C,t[23]=T):T=t[23];let E;t[24]!==f||t[25]!==c||t[26]!==b?(E=c&&(0,$.jsx)(`div`,{className:`absolute bottom-full right-0 mb-1 w-40 rounded-lg border border-border bg-popover p-1 shadow-md z-50`,children:et.map(e=>{let t=e.icon,n=e.value===f;return(0,$.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-md px-3 py-2 text-sm text-popover-foreground hover:bg-accent`,onClick:()=>b(e.value),children:[(0,$.jsx)(t,{className:`h-3.5 w-3.5`}),e.label,n&&(0,$.jsx)(oe,{className:`ml-auto h-3.5 w-3.5`})]},e.value)})}),t[24]=f,t[25]=c,t[26]=b,t[27]=E):E=t[27];let O;return t[28]!==T||t[29]!==E?(O=(0,$.jsxs)(`div`,{className:`relative`,ref:u,children:[T,E]}),t[28]=T,t[29]=E,t[30]=O):O=t[30],O}function rt(e){let t=(0,Z.c)(17),{onFileAttach:r}=e,[i,a]=Q.useState(!1),o=Q.useRef(null),s,c;t[0]===i?(s=t[1],c=t[2]):(s=()=>{let e=e=>{o.current&&!o.current.contains(e.target)&&a(!1)};if(i)return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},c=[i],t[0]=i,t[1]=s,t[2]=c),Q.useEffect(s,c);let l;t[3]===r?l=t[4]:(l=function(){r(),a(!1)},t[3]=r,t[4]=l);let u=l,d;t[5]===i?d=t[6]:(d=()=>a(!i),t[5]=i,t[6]=d);let f,p;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(n,{}),p=(0,$.jsx)(`span`,{className:`sr-only`,children:`More options`}),t[7]=f,t[8]=p):(f=t[7],p=t[8]);let m;t[9]===d?m=t[10]:(m=(0,$.jsxs)(h,{variant:`action`,size:`icon-sm`,onClick:d,children:[f,p]}),t[9]=d,t[10]=m);let g;t[11]!==u||t[12]!==i?(g=i&&(0,$.jsx)(`div`,{className:`absolute bottom-full left-0 mb-1 w-48 rounded-lg border border-border bg-popover p-1 shadow-md z-50`,children:(0,$.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-md px-3 py-2 text-sm text-popover-foreground hover:bg-accent`,onClick:u,children:[(0,$.jsx)(re,{className:`h-3.5 w-3.5`}),`Attach File`]})}),t[11]=u,t[12]=i,t[13]=g):g=t[13];let _;return t[14]!==m||t[15]!==g?(_=(0,$.jsxs)(`div`,{className:`relative`,ref:o,children:[m,g]}),t[14]=m,t[15]=g,t[16]=_):_=t[16],_}function it(e){let t=(0,Z.c)(14),{onToggleSpeech:n}=e,{isListening:r,isSupported:i}=Ie();if(!i)return null;let a=r?`bg-red-500/20 text-red-500 hover:bg-red-500/30`:`text-muted-foreground hover:text-background`,o;t[0]===r?o=t[1]:(o=r?(0,$.jsx)(F,{}):(0,$.jsx)(P,{}),t[0]=r,t[1]=o);let s=r?`Stop listening`:`Start listening`,c;t[2]===s?c=t[3]:(c=(0,$.jsx)(`span`,{className:`sr-only`,children:s}),t[2]=s,t[3]=c);let l;t[4]!==n||t[5]!==a||t[6]!==o||t[7]!==c?(l=(0,$.jsx)(X,{asChild:!0,children:(0,$.jsxs)(h,{variant:`ghost`,size:`icon-sm`,className:a,onClick:n,children:[o,c]})}),t[4]=n,t[5]=a,t[6]=o,t[7]=c,t[8]=l):l=t[8];let u=r?`Stop listening`:`Start listening`,d;t[9]===u?d=t[10]:(d=(0,$.jsx)(fe,{side:`top`,className:`bg-popover text-popover-foreground`,children:u}),t[9]=u,t[10]=d);let f;return t[11]!==l||t[12]!==d?(f=(0,$.jsxs)(pe,{children:[l,d]}),t[11]=l,t[12]=d,t[13]=f):f=t[13],f}function at(e){let t=(0,Z.c)(8),{queuedMessages:n,onRemoveQueuedMessage:r}=e;if(n.length===0)return null;let i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:`Queued messages`}),t[0]=i):i=t[0];let a;if(t[1]!==r||t[2]!==n){let e;t[4]===r?e=t[5]:(e=e=>(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3 rounded-md border border-border/60 bg-background px-3 py-2 text-sm`,children:[(0,$.jsx)(`p`,{className:`flex-1 whitespace-pre-wrap text-foreground`,children:e.message}),(0,$.jsx)(`button`,{type:`button`,className:`rounded-full p-1 text-muted-foreground transition-colors hover:bg-foreground hover:text-background`,onClick:()=>r(e.id),"aria-label":`Remove queued message`,children:(0,$.jsx)(z,{className:`h-3.5 w-3.5`})})]},e.id),t[4]=r,t[5]=e),a=n.map(e),t[1]=r,t[2]=n,t[3]=a}else a=t[3];let o;return t[6]===a?o=t[7]:(o=(0,$.jsxs)(`div`,{className:`mb-3 rounded-lg border border-border/60 bg-muted/30 px-4 py-3`,children:[i,(0,$.jsx)(`div`,{className:`mt-2 flex flex-col gap-2`,children:a})]}),t[6]=a,t[7]=o),o}function ot(e){let t=(0,Z.c)(146),{onSend:n,onStop:r,isStreaming:i,disabled:a,initialValue:o,queuedMessages:s,onRemoveQueuedMessage:c,isOverlay:l}=e,u=i===void 0?!1:i,d=l===void 0?!1:l,{isListening:p,transcript:m,startListening:g,stopListening:_,resetTranscript:v}=Ie(),y;t[0]===o?y=t[1]:(y={initialValue:o},t[0]=o,t[1]=y);let{message:b,setMessage:x,historyIndex:C,setHistoryIndex:w,draftMessage:T,setDraftMessage:E,cursorPosition:D,setCursorPosition:O,availableModels:A,selectedModel:j,setSelectedModel:M,attachments:N,setAttachments:P,planMode:F,setPlanMode:I,ralphMode:L,setRalphMode:R,imageMode:z,setImageMode:ee,availableImageModels:te,selectedImageModel:ne,setSelectedImageModel:re,allFiles:ie,setAllFiles:ae,showSuggestions:B,setShowSuggestions:V,suggestionQuery:oe,setSuggestionQuery:se,selectedIndex:H,setSelectedIndex:U,slashCommands:W,skills:G,showCommandSuggestions:K,setShowCommandSuggestions:ce,commandQuery:q,setCommandQuery:le,fileInputRef:J,textareaRef:ue,suggestionsRef:Y,commandSuggestionsRef:de,state:fe,dispatch:pe}=Le(y),X=z?ne:j,me=z?te:A,he=fe.selectedThreadId??void 0,ge;t[2]!==ie||t[3]!==N||t[4]!==q||t[5]!==D||t[6]!==pe||t[7]!==T||t[8]!==C||t[9]!==z||t[10]!==p||t[11]!==u||t[12]!==b||t[13]!==n||t[14]!==F||t[15]!==L||t[16]!==v||t[17]!==ne||t[18]!==H||t[19]!==j||t[20]!==ae||t[21]!==P||t[22]!==le||t[23]!==O||t[24]!==E||t[25]!==w||t[26]!==ee||t[27]!==x||t[28]!==I||t[29]!==R||t[30]!==U||t[31]!==ce||t[32]!==V||t[33]!==se||t[34]!==K||t[35]!==B||t[36]!==G||t[37]!==W||t[38]!==_||t[39]!==oe||t[40]!==he||t[41]!==ue?(ge={message:b,setMessage:x,attachments:N,selectedModel:j,onSend:n,isStreaming:u,selectedThreadId:he,isListening:p,stopListening:_,resetTranscript:v,dispatch:pe,historyIndex:C,setHistoryIndex:w,draftMessage:T,setDraftMessage:E,cursorPosition:D,setCursorPosition:O,showSuggestions:B,setShowSuggestions:V,suggestionQuery:oe,setSuggestionQuery:se,allFiles:ie,setAllFiles:ae,selectedIndex:H,setSelectedIndex:U,showCommandSuggestions:K,setShowCommandSuggestions:ce,commandQuery:q,setCommandQuery:le,slashCommands:W,skills:G,textareaRef:ue,setAttachments:P,planMode:F,setPlanMode:I,ralphMode:L,setRalphMode:R,imageMode:z,setImageMode:ee,selectedImageModel:ne},t[2]=ie,t[3]=N,t[4]=q,t[5]=D,t[6]=pe,t[7]=T,t[8]=C,t[9]=z,t[10]=p,t[11]=u,t[12]=b,t[13]=n,t[14]=F,t[15]=L,t[16]=v,t[17]=ne,t[18]=H,t[19]=j,t[20]=ae,t[21]=P,t[22]=le,t[23]=O,t[24]=E,t[25]=w,t[26]=ee,t[27]=x,t[28]=I,t[29]=R,t[30]=U,t[31]=ce,t[32]=V,t[33]=se,t[34]=K,t[35]=B,t[36]=G,t[37]=W,t[38]=_,t[39]=oe,t[40]=he,t[41]=ue,t[42]=ge):ge=t[42];let{handleSend:_e,handleKeyDown:ve,handleTextareaInput:ye,insertFileReference:be,insertCommand:xe,insertSkill:Se,fileSuggestions:Ce}=ze(ge),we=Q.useRef(``),Te,Ee;t[43]!==x||t[44]!==m?(Te=()=>{if(m&&m!==we.current){let e=m.substring(we.current.length);x(t=>(t.endsWith(` `),t+e)),we.current=m}},Ee=[m,x],t[43]=x,t[44]=m,t[45]=Te,t[46]=Ee):(Te=t[45],Ee=t[46]),Q.useEffect(Te,Ee);let De;t[47]===P?De=t[48]:(De=e=>{let t=e.clipboardData?.items;if(!t)return;let n=Array.from(t).filter(ct);if(n.length!==0){e.preventDefault();for(let e of n){let t=e.getAsFile();if(!t)continue;let n=new FileReader;n.onload=()=>{let e=n.result.split(`,`)[1];P(n=>[...n,{fileName:t.name||`pasted-image.${t.type.split(`/`)[1]||`png`}`,content:e,mimeType:t.type}])},n.readAsDataURL(t)}}},t[47]=P,t[48]=De);let Oe=De,ke;t[49]!==p||t[50]!==v||t[51]!==g||t[52]!==_?(ke=()=>{p?(_(),v()):(v(),g())},t[49]=p,t[50]=v,t[51]=g,t[52]=_,t[53]=ke):ke=t[53];let Ae=ke,je=d?`absolute inset-x-0 bottom-0 mx-auto w-full max-w-3xl px-4 pb-4 pointer-events-none`:`relative mx-auto w-full max-w-3xl px-4 pb-4`,Me=`flex flex-col rounded-2xl border focus-within:ring-2 focus-within:ring-brand pointer-events-auto ${d?`border-border/50 bg-background/80 shadow-lg backdrop-blur-sm`:`border-border bg-background shadow-2xl`}`,Ne;t[54]!==c||t[55]!==s?(Ne=(0,$.jsx)(at,{queuedMessages:s,onRemoveQueuedMessage:c}),t[54]=c,t[55]=s,t[56]=Ne):Ne=t[56];let Pe=L?`Describe stories for Ralph to implement autonomously...`:F?`Describe what you want Tarsk to plan...`:z?`Describe the image you want to generate...`:`Ask Tarsk anything, # for files, / for commands & skills`,Fe;t[57]!==a||t[58]!==ve||t[59]!==Oe||t[60]!==ye||t[61]!==b||t[62]!==Pe||t[63]!==ue?(Fe=(0,$.jsx)(`textarea`,{ref:ue,value:b,onChange:ye,onKeyDown:ve,onPaste:Oe,placeholder:Pe,rows:1,className:`w-full resize-none bg-transparent px-6 pt-4 pb-4 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none`,disabled:a}),t[57]=a,t[58]=ve,t[59]=Oe,t[60]=ye,t[61]=b,t[62]=Pe,t[63]=ue,t[64]=Fe):Fe=t[64];let Re;t[65]!==q||t[66]!==de||t[67]!==xe||t[68]!==Se||t[69]!==H||t[70]!==U||t[71]!==K||t[72]!==G||t[73]!==W?(Re=(0,$.jsx)(Ue,{visible:K,commands:W,skills:G,query:q,selectedIndex:H,onSelectCommand:xe,onSelectSkill:Se,onMouseEnterSuggestion:U,containerRef:de}),t[65]=q,t[66]=de,t[67]=xe,t[68]=Se,t[69]=H,t[70]=U,t[71]=K,t[72]=G,t[73]=W,t[74]=Re):Re=t[74];let Be;t[75]!==Ce||t[76]!==be||t[77]!==H||t[78]!==U||t[79]!==B||t[80]!==oe||t[81]!==Y?(Be=(0,$.jsx)(Ye,{showSuggestions:B,fileSuggestions:Ce,suggestionQuery:oe,selectedIndex:H,onSelectFile:be,onMouseEnterSuggestion:U,containerRef:Y}),t[75]=Ce,t[76]=be,t[77]=H,t[78]=U,t[79]=B,t[80]=oe,t[81]=Y,t[82]=Be):Be=t[82];let Ve;t[83]!==N||t[84]!==j?.id||t[85]!==j?.name||t[86]!==j?.supportsImages||t[87]!==P?(Ve=N.length>0&&(0,$.jsxs)(`div`,{className:`px-4`,children:[(0,$.jsx)(qe,{attachments:N,onRemove:e=>P(t=>t.filter((t,n)=>n!==e))}),N.some(st)&&j?.supportsImages===!1&&(0,$.jsxs)(`div`,{className:`mb-2 flex items-center gap-1.5 text-xs text-amber-500`,children:[(0,$.jsx)(f,{className:`h-3 w-3 shrink-0`}),(0,$.jsxs)(`span`,{children:[`Images are not supported by `,j?.name||j?.id]})]})]}),t[83]=N,t[84]=j?.id,t[85]=j?.name,t[86]=j?.supportsImages,t[87]=P,t[88]=Ve):Ve=t[88];let He;t[89]===J?He=t[90]:(He=(0,$.jsx)(rt,{onFileAttach:()=>J.current?.click()}),t[89]=J,t[90]=He);let We;t[91]===Ae?We=t[92]:(We=(0,$.jsx)(it,{onToggleSpeech:Ae}),t[91]=Ae,t[92]=We);let Ge=z?re:M,Ke;t[93]!==me||t[94]!==X||t[95]!==Ge?(Ke=(0,$.jsx)(Qe,{availableModels:me,selectedModel:X,onModelSelect:Ge}),t[93]=me,t[94]=X,t[95]=Ge,t[96]=Ke):Ke=t[96];let Xe;t[97]!==He||t[98]!==We||t[99]!==Ke?(Xe=(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[He,We,Ke]}),t[97]=He,t[98]=We,t[99]=Ke,t[100]=Xe):Xe=t[100];let Ze;t[101]!==z||t[102]!==F||t[103]!==L||t[104]!==ee||t[105]!==I||t[106]!==R?(Ze=(0,$.jsx)(nt,{planMode:F,imageMode:z,ralphMode:L,setPlanMode:I,setImageMode:ee,setRalphMode:R}),t[101]=z,t[102]=F,t[103]=L,t[104]=ee,t[105]=I,t[106]=R,t[107]=Ze):Ze=t[107];let $e=u?r:_e,et;t[108]!==N.length||t[109]!==a||t[110]!==X||t[111]!==u||t[112]!==b?(et=!u&&((a??!1)||!b.trim()&&N.length===0||!X),t[108]=N.length,t[109]=a,t[110]=X,t[111]=u,t[112]=b,t[113]=et):et=t[113];let tt;t[114]===u?tt=t[115]:(tt=u?(0,$.jsx)(S,{className:`h-3 w-3 fill-current`}):(0,$.jsx)(k,{className:`h-3 w-3`}),t[114]=u,t[115]=tt);let ot=u?`Stop generation`:`Send message`,lt;t[116]===ot?lt=t[117]:(lt=(0,$.jsx)(`span`,{className:`sr-only`,children:ot}),t[116]=ot,t[117]=lt);let ut;t[118]!==$e||t[119]!==et||t[120]!==tt||t[121]!==lt?(ut=(0,$.jsxs)(h,{size:`icon`,className:`h-7 w-7 rounded-full`,onClick:$e,disabled:et,children:[tt,lt]}),t[118]=$e,t[119]=et,t[120]=tt,t[121]=lt,t[122]=ut):ut=t[122];let dt;t[123]!==Ze||t[124]!==ut?(dt=(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[Ze,ut]}),t[123]=Ze,t[124]=ut,t[125]=dt):dt=t[125];let ft;t[126]!==Xe||t[127]!==dt?(ft=(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-3 pb-2`,children:[Xe,dt]}),t[126]=Xe,t[127]=dt,t[128]=ft):ft=t[128];let pt;t[129]!==Me||t[130]!==Ne||t[131]!==Fe||t[132]!==Re||t[133]!==Be||t[134]!==Ve||t[135]!==ft?(pt=(0,$.jsxs)(`div`,{className:Me,children:[Ne,Fe,Re,Be,Ve,ft]}),t[129]=Me,t[130]=Ne,t[131]=Fe,t[132]=Re,t[133]=Be,t[134]=Ve,t[135]=ft,t[136]=pt):pt=t[136];let mt;t[137]===P?mt=t[138]:(mt=e=>Je(e,e=>P(t=>[...t,...e])),t[137]=P,t[138]=mt);let ht;t[139]!==J||t[140]!==mt?(ht=(0,$.jsx)(`input`,{ref:J,type:`file`,multiple:!0,className:`hidden`,onChange:mt}),t[139]=J,t[140]=mt,t[141]=ht):ht=t[141];let gt;return t[142]!==je||t[143]!==pt||t[144]!==ht?(gt=(0,$.jsxs)(`div`,{className:je,children:[pt,ht]}),t[142]=je,t[143]=pt,t[144]=ht,t[145]=gt):gt=t[145],gt}function st(e){return e.mimeType.startsWith(`image/`)}function ct(e){return e.type.startsWith(`image/`)}function lt({threadId:e}){let[t,n]=(0,Q.useState)(!1),[r,i]=(0,Q.useState)(null);return(0,Q.useEffect)(()=>{e&&ie(e).then(i).catch(()=>{})},[e]),(0,$.jsx)(`div`,{className:`flex items-center justify-end gap-2 px-8 py-2 mt-[-1rem] min-h-[2.25rem]`,children:e&&(0,$.jsxs)(pe,{children:[(0,$.jsx)(X,{asChild:!0,children:(0,$.jsx)(h,{variant:`ghost`,size:`icon`,className:`h-6 w-6 opacity-50 hover:opacity-80`,onClick:async()=>{if(!(!e||t)){n(!0);try{let t=await ie(e);await navigator.clipboard.writeText(t)}finally{n(!1)}}},disabled:t,"aria-label":`Copy repository folder path`,children:(0,$.jsx)(L,{className:`h-3 w-3`})})}),(0,$.jsxs)(fe,{side:`top`,className:`bg-slate-900 text-white`,children:[(0,$.jsx)(`div`,{children:`Copy repository folder path`}),r&&(0,$.jsx)(`div`,{className:`opacity-70 text-xs`,children:r})]})]})})}function ut(e,t){if(!(!t||!e.includes(`"run_js"`)))try{let n=JSON.parse(e.trim());if(!Array.isArray(n))return;for(let e of n)e?.type===`tool_use`&&e?.name===`run_js`&&e?.id&&e?.input?.code&&Pe(e.id,e.input.code,t)}catch{}}function dt(){let{state:e,dispatch:t}=le(),[n,r]=(0,Q.useState)(null),[i,o]=(0,Q.useState)(!1),s=(0,Q.useRef)(``),c=(0,Q.useRef)(``),l=(0,Q.useRef)([]),u=(0,Q.useRef)(!1),d=(0,Q.useRef)(null),f=(0,Q.useRef)(null),p=(0,Q.useRef)(()=>{}),[m,h]=(0,Q.useState)(null),g=(0,Q.useRef)(!1),_=(0,Q.useRef)(!1),v=(0,Q.useRef)(null),y=(0,Q.useRef)(null),b=(0,Q.useRef)(null),{selectedThreadId:x,selectedProjectId:S,messages:C,queuedChatMessages:T,isStreaming:D,streamingModel:O,processingThreadIds:k}=e,M=!!(x&&k.includes(x)),N=(0,Q.useCallback)(n=>{if(d.current=null,f.current=null,g.current){g.current=!1;return}let r=l.current,i=ue(r)||`...`;if(v.current&&(r.length===0||i===`...`)){let r={messageId:`msg-${Date.now()}-error`,sender:`agent`,content:`Error: ${v.current}`,contentType:`text`,timestamp:new Date().toISOString(),model:e.streamingModel||n,isThinking:!1};t({type:Y.AddMessage,message:r}),t({type:Y.ResetStream}),x&&t({type:Y.RemoveProcessingThread,threadId:x}),v.current=null;return}let a={messageId:`msg-${Date.now()}-agent`,sender:`agent`,content:i,contentType:`markdown`,timestamp:new Date().toISOString(),model:e.streamingModel||n,isThinking:!1};s.current=``,c.current=``,l.current=[],v.current=null,t({type:Y.AddMessage,message:a}),t({type:Y.ResetStream}),x&&(t({type:Y.MarkThreadCompleted,threadId:x}),t({type:Y.RemoveProcessingThread,threadId:x}))},[e.streamingModel,t,x]);(0,Q.useEffect)(()=>{p.current=N},[N]);let P=(0,Q.useCallback)(()=>{x&&h(x),g.current=!0,x&&j(x),d.current&&=(d.current.abort(),null),f.current&&=(f.current(),null),s.current=``,c.current=``,l.current=[],v.current=null;let n={messageId:`msg-${Date.now()}-stopped`,sender:`agent`,content:`I've stopped working on your request.`,contentType:`text`,timestamp:new Date().toISOString(),model:e.streamingModel||`default`,isThinking:!1};t({type:Y.AddMessage,message:n}),t({type:Y.ResetStream}),x&&(t({type:Y.MarkThreadCompleted,threadId:x}),t({type:Y.RemoveProcessingThread,threadId:x}))},[x,t,e.streamingModel]);(0,Q.useEffect)(()=>{_.current&&!D&&d.current&&(d.current.abort(),d.current=null,f.current&&=(f.current(),null),p.current(O||`default`)),_.current=D},[D,O]),(0,Q.useEffect)(()=>{if(y.current&&=(clearTimeout(y.current),null),D){let e=12e4,t=n=>{y.current&&=(clearTimeout(y.current),null),y.current=setTimeout(()=>{let n=Date.now(),r=b?.current??null;if(r!=null){let i=n-r;if(i<e){t(e-i);return}}console.warn(`[stream-safety] Streaming stuck for 2 minutes with no activity, auto-finalizing`),d.current&&=(d.current.abort(),null),f.current&&=(f.current(),null),p.current(O||`default`)},n)},n=e;if(b?.current!=null){let t=Date.now()-b.current;n=t>=e?0:e-t}t(n)}return()=>{y.current&&=(clearTimeout(y.current),null)}},[D,O]),(0,Q.useEffect)(()=>()=>{d.current&&=(d.current.abort(),null),f.current&&=(f.current(),null),s.current=``,c.current=``,l.current=[],u.current=!1,v.current=null,t({type:Y.ResetStream})},[x,t]),(0,Q.useEffect)(()=>{if(!x)return;let e=!1;async function n(){try{let n=await se(x);e||t({type:Y.SetMessages,messages:n.messages})}catch(n){console.error(`Failed to load chat history:`,n),e||t({type:Y.SetMessages,messages:[]})}}return n(),()=>{e=!0}},[x,S,t]),(0,Q.useEffect)(()=>{if(!x||!M||D)return;let e=new AbortController;return d.current=e,t({type:Y.ResetStream}),t({type:Y.SetStreaming,isStreaming:!0}),s.current=``,c.current=``,l.current=[],u.current=!1,v.current=null,B(x,e.signal).then(n=>{if(!n||e.signal.aborted){p.current(`default`);return}f.current=E(n,e=>{if(e.type===`error`){let t=e.content||`Unknown error occurred`;v.current=t,r(t);return}if(e.type!==`message`){if(e.type===`toolcall_delta`){e.partial?.content?.[0]?.id&&e.delta&&t({type:Y.UpdateToolCallProgress,toolCallId:e.partial.content[0].id,progress:{toolCallId:e.partial.content[0].id,toolName:e.partial.content[0].name,delta:e.delta,partial:e.partial}});return}if(e.model&&t({type:Y.SetStreamModel,model:e.model}),e.type===`thinking`||e.isThinking){let n=e.content??``;ut(n,x),c.current+=n;let r=J(l.current,`thinking`,n);l.current=r,t({type:Y.AppendStreamChunk,chunkType:`thinking`,content:n,segments:r})}else if(e.type===`result`)u.current=!0,s.current=e.content??``,l.current=de(l.current,e.content??``),t({type:Y.SetStreamContent,content:e.content??``});else{if(u.current)return;s.current+=e.content??``;let n=J(l.current,`content`,e.content??``);l.current=n,t({type:Y.AppendStreamChunk,chunkType:`content`,content:e.content??``,segments:n})}}},()=>{p.current(`default`)},e=>{if(e.includes(`AbortError`)||e.includes(`canceled`)||e.includes(`BodyStreamBuffer was aborted`)){p.current(`default`);return}v.current=e,r(e)},e=>{if(e.role===`assistant`){let n=e.content??``,r=typeof n==`string`?n:JSON.stringify(n);if(e.isThinking??!1){c.current+=r;let e=J(l.current,`thinking`,r);l.current=e,t({type:Y.AppendStreamChunk,chunkType:`thinking`,content:r,segments:e});return}let i=!1;if(typeof n==`object`&&Array.isArray(n)&&n.length>0)i=!0;else if(typeof r==`string`&&r.trim().startsWith(`[`))try{let e=JSON.parse(r);i=Array.isArray(e)&&e.length>0}catch{}if(i)u.current=!0,s.current=r,l.current=de(l.current,r),t({type:Y.SetStreamContent,content:r});else{s.current+=r;let e=J(l.current,`content`,r);l.current=e,t({type:Y.AppendStreamChunk,chunkType:`content`,content:r,segments:e})}}else if(e.role===`tool`){let n=e.content??``,r=typeof n==`string`?n:JSON.stringify(n);if(r){s.current+=r;let e=J(l.current,`content`,r);l.current=e,t({type:Y.AppendStreamChunk,chunkType:`content`,content:r,segments:e})}}})}).catch(e=>{if(e instanceof Error&&e.name===`AbortError`){t({type:Y.ResetStream});return}if(e instanceof Error&&e.message.includes(`not currently processing`)){t({type:Y.ResetStream});return}console.error(`Failed to subscribe to chat stream:`,e),t({type:Y.ResetStream})}),()=>{e.abort(),f.current&&=(f.current(),null)}},[x,M]);let F=(0,Q.useCallback)(async(n,i,m,g,_,y,b)=>{if(!x)return;r(null),h(null),d.current&&d.current.abort(),f.current&&f.current();let C=`msg-${Date.now()}`,T;try{let e=await a(x,C);e.success&&e.stashed&&e.checkpointRef&&(T=e.checkpointRef)}catch{}let D={messageId:C,sender:`user`,content:n,contentType:`text`,timestamp:new Date().toISOString(),model:i,attachments:m.map(e=>({fileName:e.fileName,content:e.content,mimeType:e.mimeType})),checkpointRef:T};t({type:Y.AddMessage,message:D});let O=n.trim().replace(/\n/g,` `).slice(0,100);if(S&&x&&(A(x,{title:O}).catch(e=>{console.error(`Failed to update thread title:`,e)}),t({type:Y.UpdateThreadTitle,projectId:S,threadId:x,title:O})),y){let e=g??void 0;if(!e&&typeof i==`string`){let t=i.split(/[:/]/)[0]?.trim();t&&(e=t)}if(!e){let e={messageId:`msg-${Date.now()}-error`,sender:`agent`,content:`Image generation is not available because no provider is configured for the selected model.`,contentType:`text`,timestamp:new Date().toISOString(),model:i,isThinking:!1};t({type:Y.AddMessage,message:e}),t({type:Y.ResetStream});return}t({type:Y.SetStreaming,isStreaming:!0});try{let r=await w(n,i,e,x),a={messageId:`msg-${Date.now()}-agent`,sender:`agent`,content:n,contentType:`text`,timestamp:new Date().toISOString(),model:i,isThinking:!1,generatedImageUrl:r.imageUrl,generatedImageData:r.imageData};t({type:Y.AddMessage,message:a})}catch(e){let n=e instanceof Error?e.message:`Image generation failed`,r={messageId:`msg-${Date.now()}-error`,sender:`agent`,content:`Error: ${n}`,contentType:`text`,timestamp:new Date().toISOString(),model:i,isThinking:!1};t({type:Y.AddMessage,message:r})}finally{t({type:Y.ResetStream})}return}t({type:Y.ResetStream}),t({type:Y.SetStreaming,isStreaming:!0}),s.current=``,u.current=!1;let k=new AbortController;d.current=k;try{let a=await ae(x,n,i,m,k.signal,g,_,b);if(!a){p.current(i);return}f.current=E(a,n=>{if(n.type===`error`){let e=n.content||`Unknown error occurred`;v.current=e,r(e);return}if(n.type!==`message`){if(n.type===`toolcall_delta`){if(n.partial?.content?.[0]?.id&&n.delta){let e=n.partial.content[0].id,r=n.partial.content[0].name;t({type:Y.UpdateToolCallProgress,toolCallId:e,progress:{toolCallId:e,toolName:r,delta:n.delta,partial:n.partial}})}return}if(n.model&&t({type:Y.SetStreamModel,model:n.model}),n.type===`thinking`||n.isThinking){let r=n.content??``;ut(r,e.selectedThreadId),c.current+=r;let i=J(l.current,`thinking`,r);l.current=i,t({type:Y.AppendStreamChunk,chunkType:`thinking`,content:r,segments:i})}else if(n.type===`result`)u.current=!0,s.current=n.content??``,l.current=de(l.current,n.content??``),t({type:Y.SetStreamContent,content:n.content??``});else{if(u.current)return;s.current+=n.content??``;let e=J(l.current,`content`,n.content??``);l.current=e,t({type:Y.AppendStreamChunk,chunkType:`content`,content:n.content??``,segments:e})}}},()=>{p.current(i)},e=>{if(e.includes(`AbortError`)||e.includes(`canceled`)||e.includes(`BodyStreamBuffer was aborted`)){p.current(i);return}v.current=e,r(e)},e=>{if(e.role===`assistant`){let n=e.content??``,r=typeof n==`string`?n:JSON.stringify(n);if(e.isThinking??!1){c.current+=r;let e=J(l.current,`thinking`,r);l.current=e,t({type:Y.AppendStreamChunk,chunkType:`thinking`,content:r,segments:e});return}let i=!1;if(typeof n==`object`&&Array.isArray(n)&&n.length>0)i=!0;else if(typeof r==`string`&&r.trim().startsWith(`[`))try{let e=JSON.parse(r);i=Array.isArray(e)&&e.length>0}catch{}if(i)u.current=!0,s.current=r,l.current=de(l.current,r),t({type:Y.SetStreamContent,content:r});else{s.current+=r;let e=J(l.current,`content`,r);l.current=e,t({type:Y.AppendStreamChunk,chunkType:`content`,content:r,segments:e})}}else if(e.role===`tool`){let n=e.content??``,r=typeof n==`string`?n:JSON.stringify(n);if(r){s.current+=r;let e=J(l.current,`content`,r);l.current=e,t({type:Y.AppendStreamChunk,chunkType:`content`,content:r,segments:e})}}})}catch(e){if(e instanceof Error&&e.name===`AbortError`||e instanceof Error&&e.message.includes(`BodyStreamBuffer was aborted`))return;if(e instanceof K){t({type:Y.ResetStream}),o(!0);return}r(e instanceof Error?e.message:`Failed to send message. Please ensure the CLI server is running on localhost:641`),v.current=e instanceof Error?e.message:`Failed to send message. Please ensure the CLI server is running on localhost:641`,t({type:Y.ResetStream})}},[x,S,t]);(0,Q.useEffect)(()=>{let n=e.pendingChatMessage;if(!n||D||n.threadId!==x)return;let r=setTimeout(()=>{t({type:Y.ClearPendingChatMessage}),F(n.message,n.model,[],n.provider)},100);return()=>clearTimeout(r)},[e.pendingChatMessage,D,x,t,F]);let I=(0,Q.useMemo)(()=>x?T.filter(e=>e.threadId===x):[],[x,T]),L=(0,Q.useRef)(!1);return(0,Q.useEffect)(()=>{if(D||!x||I.length===0||L.current)return;let[e]=I;L.current=!0,t({type:Y.RemoveQueuedChatMessage,queuedMessageId:e.id});let n=setTimeout(()=>{F(e.message,e.model,e.attachments,e.provider,e.planMode,e.imageMode,e.ralphMode),L.current=!1},0);return()=>{clearTimeout(n),L.current=!1}},[t,F,D,I,x]),{error:n,setError:r,handleSend:F,handleStop:P,isStreaming:D,selectedThreadId:x,queuedMessagesForThread:I,handleRemoveQueuedMessage:(0,Q.useCallback)(e=>{let n=I.find(t=>t.id===e);t({type:Y.RemoveQueuedChatMessage,queuedMessageId:e}),!(!n||D||C.length>0||!x)&&F(n.message,n.model,n.attachments,n.provider,n.planMode,n.imageMode,n.ralphMode)},[t,F,D,C.length,I,x]),showEmptyBalanceDialog:i,setShowEmptyBalanceDialog:o}}function ft(e){let t=(0,Z.c)(10),{open:n,onClose:r}=e,i=q(),a;t[0]===r?a=t[1]:(a=e=>{e||r()},t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsxs)(ve,{children:[(0,$.jsx)(he,{children:`Balance empty`}),(0,$.jsx)(me,{children:`You have no prompts remaining. Purchase additional prompts to continue.`})]}),t[2]=o):o=t[2];let s;t[3]!==i||t[4]!==r?(s=(0,$.jsxs)(ge,{children:[o,(0,$.jsx)(_e,{children:(0,$.jsx)(h,{onClick:()=>{r(),i(`/settings/account`)},children:`Go to Account`})})]}),t[3]=i,t[4]=r,t[5]=s):s=t[5];let c;return t[6]!==n||t[7]!==a||t[8]!==s?(c=(0,$.jsx)(ye,{open:n,onOpenChange:a,children:s}),t[6]=n,t[7]=a,t[8]=s,t[9]=c):c=t[9],c}var pt=3e4;function mt(e){let[t,n]=(0,Q.useState)(!1),[r,i]=(0,Q.useState)(0),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(``),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(void 0),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(`Up to date`),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(void 0),[D,O]=(0,Q.useState)(void 0),[k,A]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(!1),N=(0,Q.useRef)(!0),P=(0,Q.useCallback)(e=>{n(e.hasChanges),i(e.changedFilesCount),o(e.hasUnpushedCommits),c(e.currentBranch),v(e.hasRemoteBranch),u(e.isOnGitHub),f(e.remoteUrl),m(e.canCreateRepo),g(e.repoUrl),b(e.status),S(e.defaultBranch??null),w(e.prExists),E(e.prUrl),O(e.prState),A(e.commitsAheadOfDefault??!1)},[]),F=(0,Q.useCallback)(async(t=!1)=>{if(!e)return;let n=setTimeout(()=>M(!0),100);try{let n=`unified-git-status-${e}`;t&&G.invalidate(n),P(await G.get(n,()=>R(e,t),pt))}catch(e){console.error(`Failed to fetch unified git status:`,e)}finally{clearTimeout(n),M(!1)}},[e,P]);return(0,Q.useEffect)(()=>{e&&(async()=>{if(N.current){let t=`unified-git-status-${e}`,n=G.getSync(t);n&&P(n),N.current=!1}await F()})()},[e,F,P]),{hasChanges:t,changedFilesCount:r,hasUnpushedCommits:a,hasRemoteBranch:_,currentBranch:s,isOnGitHub:l,remoteUrl:d,canCreateRepo:p,repoUrl:h,status:y,defaultBranch:x,prExists:C,prUrl:T,prState:D,commitsAheadOfDefault:k,isRefreshing:j,fetchUnifiedStatus:F}}function ht(e){let t=(0,Z.c)(13),{todos:n}=e,r;t[0]===n?r=t[1]:(r=n.filter(_t),t[0]=n,t[1]=r);let i=r.length,a;t[2]===n.length?a=t[3]:(a=n.length===0&&(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No todo items.`}),t[2]=n.length,t[3]=a);let o;t[4]===n?o=t[5]:(o=n.map(gt),t[4]=n,t[5]=o);let s;t[6]!==i||t[7]!==n.length?(s=n.length>0&&(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground pt-1`,children:[i,`/`,n.length,` completed`]}),t[6]=i,t[7]=n.length,t[8]=s):s=t[8];let c;return t[9]!==a||t[10]!==o||t[11]!==s?(c=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[a,o,s]}),t[9]=a,t[10]=o,t[11]=s,t[12]=c):c=t[12],c}function gt(e){return(0,$.jsxs)(`div`,{className:`flex items-start gap-2 text-sm`,children:[e.status===`done`?(0,$.jsx)(T,{className:`h-4 w-4 shrink-0 mt-0.5 text-brand`}):e.status===`working`?(0,$.jsx)(u,{className:`h-4 w-4 shrink-0 mt-0.5 text-yellow-500`}):(0,$.jsx)(V,{className:`h-4 w-4 shrink-0 mt-0.5 text-muted-foreground`}),(0,$.jsx)(`span`,{className:e.status===`done`?`line-through text-muted-foreground`:`text-foreground`,children:e.description})]},e.id)}function _t(e){return e.status===`done`}function vt(){let e=(0,Z.c)(16),{todos:t}=(0,Q.useContext)(we),[n,r]=(0,Q.useState)(!1),i;e[0]===t?i=e[1]:(i=t.filter(yt),e[0]=t,e[1]=i);let a=i.length;if(t.length-a<=0)return null;let o,s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>r(!0),s=(0,$.jsx)(O,{className:`h-3.5 w-3.5 mr-1`}),e[2]=o,e[3]=s):(o=e[2],s=e[3]);let l;e[4]!==a||e[5]!==t.length?(l=(0,$.jsxs)(h,{variant:`outline`,size:`sm`,className:`h-7 px-2 text-xs bg-background ml-2`,onClick:o,children:[s,a,` of `,t.length,` complete`]}),e[4]=a,e[5]=t.length,e[6]=l):l=e[6];let u;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(c,{children:(0,$.jsx)(x,{children:`Tasks`})}),e[7]=u):u=e[7];let d;e[8]===t?d=e[9]:(d=(0,$.jsxs)(ce,{className:`max-w-md`,children:[u,(0,$.jsx)(ht,{todos:t})]}),e[8]=t,e[9]=d);let f;e[10]!==n||e[11]!==d?(f=(0,$.jsx)(v,{open:n,onOpenChange:r,children:d}),e[10]=n,e[11]=d,e[12]=f):f=e[12];let p;return e[13]!==l||e[14]!==f?(p=(0,$.jsxs)($.Fragment,{children:[l,f]}),e[13]=l,e[14]=f,e[15]=p):p=e[15],p}function yt(e){return e.status===`done`}function bt(e){let t=(0,Z.c)(34),{messages:r}=e,i;t[0]===r?i=t[1]:(i=r===void 0?[]:r,t[0]=r,t[1]=i);let a=i,{state:s,dispatch:c}=le(),{isCreatingProject:l,selectedThreadId:u}=s,{handleSend:d,handleStop:f,isStreaming:p,queuedMessagesForThread:m,handleRemoveQueuedMessage:g,showEmptyBalanceDialog:_,setShowEmptyBalanceDialog:v}=dt(),y=s.pendingChatMessage?.threadId===u,b=p||y,x=a.length>0,{hasChanges:S,changedFilesCount:C}=mt(u??void 0),{setActiveMainTab:w}=be(),T;t[2]!==c||t[3]!==u?(T=async()=>{if(u)try{let e=await U(u);c({type:Y.ClearMessages}),console.log(`New conversation started:`,e);let t=await se(u);c({type:Y.SetMessages,messages:t.messages})}catch(e){console.error(`Failed to start new chat:`,e)}},t[2]=c,t[3]=u,t[4]=T):T=t[4];let E=T,D;t[5]===v?D=t[6]:(D=()=>v(!1),t[5]=v,t[6]=D);let O;t[7]!==_||t[8]!==D?(O=(0,$.jsx)(ft,{open:_,onClose:D}),t[7]=_,t[8]=D,t[9]=O):O=t[9];let k;t[10]!==C||t[11]!==E||t[12]!==S||t[13]!==x||t[14]!==w?(k=x&&(0,$.jsxs)(`div`,{className:`absolute -top-8 left-0 z-10 ml-8`,children:[(0,$.jsxs)(h,{variant:`outline`,size:`sm`,className:`h-7 px-2 text-xs bg-background`,onClick:E,children:[(0,$.jsx)(n,{className:`h-3.5 w-3.5 mr-1`}),`New Chat`]}),S&&(0,$.jsxs)(h,{variant:`outline`,size:`sm`,className:`h-7 px-2 text-xs bg-background ml-2`,onClick:()=>w(`review`),children:[(0,$.jsx)(o,{className:`h-3.5 w-3.5 mr-1`}),C,` `,C===1?`File`:`Files`,` Changed`]}),(0,$.jsx)(vt,{})]}),t[10]=C,t[11]=E,t[12]=S,t[13]=x,t[14]=w,t[15]=k):k=t[15];let A=!u&&!l,j;t[16]!==b||t[17]!==g||t[18]!==d||t[19]!==f||t[20]!==m||t[21]!==A?(j=(0,$.jsx)(ot,{onSend:d,onStop:f,isStreaming:b,disabled:A,initialValue:``,queuedMessages:m,onRemoveQueuedMessage:g,isOverlay:!1}),t[16]=b,t[17]=g,t[18]=d,t[19]=f,t[20]=m,t[21]=A,t[22]=j):j=t[22];let M;t[23]!==k||t[24]!==j?(M=(0,$.jsxs)(`div`,{className:`relative`,children:[k,j]}),t[23]=k,t[24]=j,t[25]=M):M=t[25];let N=u??void 0,P;t[26]===N?P=t[27]:(P=(0,$.jsx)(lt,{threadId:N}),t[26]=N,t[27]=P);let F;t[28]!==P||t[29]!==M?(F=(0,$.jsxs)(`div`,{className:`relative mx-auto min-w-[400px] w-[90vw] max-w-3xl`,children:[M,P]}),t[28]=P,t[29]=M,t[30]=F):F=t[30];let I;return t[31]!==F||t[32]!==O?(I=(0,$.jsxs)($.Fragment,{children:[O,F]}),t[31]=F,t[32]=O,t[33]=I):I=t[33],I}export{je as a,Ee as c,Ae as i,Ce as l,mt as n,De as o,Pe as r,Te as s,bt as t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Cr as t,Qi as n,Wn as r,da as i,la as a,qi as o,ta as s}from"./dialogs-config-3Hr2GRdt.js";import{a as c,d as l,h as u,i as d,l as f,m as p,n as m,o as h,p as g,s as _,t as v,u as y}from"./react-vendor-4OUTOTE0.js";var b=a(),x=e(i(),1),S=t(),C=y,w=u,T=x.forwardRef((e,t)=>{let i=(0,b.c)(14),a,o,s,c;i[0]===e?(a=i[1],o=i[2],s=i[3],c=i[4]):({className:o,inset:s,children:a,...c}=e,i[0]=e,i[1]=a,i[2]=o,i[3]=s,i[4]=c);let l=s&&`pl-8`,u;i[5]!==o||i[6]!==l?(u=r(`flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground`,l,o),i[5]=o,i[6]=l,i[7]=u):u=i[7];let d;i[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,S.jsx)(n,{className:`ml-auto h-4 w-4`}),i[8]=d):d=i[8];let f;return i[9]!==a||i[10]!==c||i[11]!==t||i[12]!==u?(f=(0,S.jsxs)(p,{ref:t,className:u,...c,children:[a,d]}),i[9]=a,i[10]=c,i[11]=t,i[12]=u,i[13]=f):f=i[13],f});T.displayName=p.displayName;var E=x.forwardRef((e,t)=>{let n=(0,b.c)(9),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=r(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,i),n[3]=i,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,S.jsx)(g,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});E.displayName=g.displayName;var D=x.forwardRef((e,t)=>{let n=(0,b.c)(9),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=r(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,i),n[3]=i,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,S.jsx)(_,{children:(0,S.jsx)(m,{ref:t,className:o,...a})}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});D.displayName=m.displayName;var O=x.forwardRef((e,t)=>{let n=(0,b.c)(11),i,a,o;n[0]===e?(i=n[1],a=n[2],o=n[3]):({className:i,inset:a,...o}=e,n[0]=e,n[1]=i,n[2]=a,n[3]=o);let s=a&&`pl-8`,c;n[4]!==i||n[5]!==s?(c=r(`relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,s,i),n[4]=i,n[5]=s,n[6]=c):c=n[6];let l;return n[7]!==o||n[8]!==t||n[9]!==c?(l=(0,S.jsx)(d,{ref:t,className:c,...o}),n[7]=o,n[8]=t,n[9]=c,n[10]=l):l=n[10],l});O.displayName=d.displayName;var k=x.forwardRef((e,t)=>{let n=(0,b.c)(14),i,a,o,l;n[0]===e?(i=n[1],a=n[2],o=n[3],l=n[4]):({className:o,children:a,checked:i,...l}=e,n[0]=e,n[1]=i,n[2]=a,n[3]=o,n[4]=l);let u;n[5]===o?u=n[6]:(u=r(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,o),n[5]=o,n[6]=u);let d;n[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,S.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,S.jsx)(c,{children:(0,S.jsx)(s,{className:`h-4 w-4`})})}),n[7]=d):d=n[7];let f;return n[8]!==i||n[9]!==a||n[10]!==l||n[11]!==t||n[12]!==u?(f=(0,S.jsxs)(v,{ref:t,className:u,checked:i,...l,children:[d,a]}),n[8]=i,n[9]=a,n[10]=l,n[11]=t,n[12]=u,n[13]=f):f=n[13],f});k.displayName=v.displayName;var A=x.forwardRef((e,t)=>{let n=(0,b.c)(12),i,a,s;n[0]===e?(i=n[1],a=n[2],s=n[3]):({className:a,children:i,...s}=e,n[0]=e,n[1]=i,n[2]=a,n[3]=s);let l;n[4]===a?l=n[5]:(l=r(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,a),n[4]=a,n[5]=l);let u;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,S.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,S.jsx)(c,{children:(0,S.jsx)(o,{className:`h-2 w-2 fill-current`})})}),n[6]=u):u=n[6];let d;return n[7]!==i||n[8]!==s||n[9]!==t||n[10]!==l?(d=(0,S.jsxs)(f,{ref:t,className:l,...s,children:[u,i]}),n[7]=i,n[8]=s,n[9]=t,n[10]=l,n[11]=d):d=n[11],d});A.displayName=f.displayName;var j=x.forwardRef((e,t)=>{let n=(0,b.c)(11),i,a,o;n[0]===e?(i=n[1],a=n[2],o=n[3]):({className:i,inset:a,...o}=e,n[0]=e,n[1]=i,n[2]=a,n[3]=o);let s=a&&`pl-8`,c;n[4]!==i||n[5]!==s?(c=r(`px-2 py-1.5 text-sm font-semibold text-foreground`,s,i),n[4]=i,n[5]=s,n[6]=c):c=n[6];let l;return n[7]!==o||n[8]!==t||n[9]!==c?(l=(0,S.jsx)(h,{ref:t,className:c,...o}),n[7]=o,n[8]=t,n[9]=c,n[10]=l):l=n[10],l});j.displayName=h.displayName;var M=x.forwardRef((e,t)=>{let n=(0,b.c)(9),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=r(`-mx-1 my-1 h-px bg-border`,i),n[3]=i,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,S.jsx)(l,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});M.displayName=l.displayName;var N=e=>{let t=(0,b.c)(8),n,i;t[0]===e?(n=t[1],i=t[2]):({className:n,...i}=e,t[0]=e,t[1]=n,t[2]=i);let a;t[3]===n?a=t[4]:(a=r(`ml-auto text-xs tracking-widest text-muted-foreground`,n),t[3]=n,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,S.jsx)(`span`,{className:a,...i}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o};N.displayName=`ContextMenuShortcut`;export{w as a,M as i,D as n,O as r,C as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./history-view-Cyhu-ped.js";export{e as ConversationHistoryView,e as default};