tarsk 0.4.22 → 0.4.24

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 (50) hide show
  1. package/dist/index.js +491 -200
  2. package/dist/public/assets/{account-view-pOQZWJfl.js → account-view-D5WVMsrD.js} +1 -1
  3. package/dist/public/assets/{alert-dialog-BeLER45U.js → alert-dialog-JOYww-on.js} +1 -1
  4. package/dist/public/assets/{api-Bagaj1rQ.js → api-XK7H2gI0.js} +1 -1
  5. package/dist/public/assets/{browser-tab-DmootUHa.js → browser-tab-xojjEFYj.js} +1 -1
  6. package/dist/public/assets/chat-input-container-fUw0AY1R.js +1 -0
  7. package/dist/public/assets/{context-menu-BlG_bTqN.js → context-menu-5lS4H_pS.js} +1 -1
  8. package/dist/public/assets/conversation-history-view-IVxKEbP_.js +1 -0
  9. package/dist/public/assets/{dialogs-config-Dwpv4SNp.js → dialogs-config-3Hr2GRdt.js} +2 -2
  10. package/dist/public/assets/{diff-view-B8Grak1p.js → diff-view-DWNDi8zT.js} +2 -2
  11. package/dist/public/assets/{explorer-tab-view-lFzzjVe8.js → explorer-tab-view-BtTXy75I.js} +2 -2
  12. package/dist/public/assets/explorer-tree-DdPiBm7Y.js +1 -0
  13. package/dist/public/assets/{explorer-view-DjN4dtgh.js → explorer-view-06kjYKL2.js} +1 -1
  14. package/dist/public/assets/history-view-Cyhu-ped.js +1 -0
  15. package/dist/public/assets/index-CoryOY5D.css +1 -0
  16. package/dist/public/assets/index-DJNTxm7E.js +50 -0
  17. package/dist/public/assets/onboarding-DzgFi5ix.js +1 -0
  18. package/dist/public/assets/onboarding-dialog-lFFrB1GZ.js +1 -0
  19. package/dist/public/assets/{page-toolbar-CBE5_3E3.js → page-toolbar-De9hbhUD.js} +1 -1
  20. package/dist/public/assets/{project-settings-view-B13GlkU6.js → project-settings-view-DF-F7P8K.js} +1 -1
  21. package/dist/public/assets/{provider-details-view-BQQKYvR8.js → provider-details-view-CbGbbmaI.js} +1 -1
  22. package/dist/public/assets/{providers-sidebar-C2RknYQn.js → providers-sidebar-Dc3Gk1we.js} +1 -1
  23. package/dist/public/assets/{react-vendor-CYvpNUsM.js → react-vendor-BX34Jw0L.js} +5 -5
  24. package/dist/public/assets/resizable-asBmgm9X.js +1 -0
  25. package/dist/public/assets/{run-stop-button-1ECLRujs.js → run-stop-button-MczHUMXL.js} +2 -2
  26. package/dist/public/assets/{settings-view-CxiVTevy.js → settings-view-CtiXQd-N.js} +2 -2
  27. package/dist/public/assets/{side-panel-container-B9Dn9qD2.js → side-panel-container-5txNmqNe.js} +2 -2
  28. package/dist/public/assets/{standard-list-item-BJWg4I9s.js → standard-list-item-DUKJ8HEG.js} +1 -1
  29. package/dist/public/assets/store-xK3nfJ3V.js +2 -0
  30. package/dist/public/assets/{tab-context-COCYkRNN.js → tab-context-D2auNMAI.js} +1 -1
  31. package/dist/public/assets/tabs-B7OXJglU.js +1 -0
  32. package/dist/public/assets/{terminal-panel-Cea0pLdX.js → terminal-panel-D3OZDoCd.js} +2 -2
  33. package/dist/public/assets/{textarea-C5IMo2ya.js → textarea-Dg4M60Yx.js} +1 -1
  34. package/dist/public/assets/todos-view-CzW8DtQ9.js +1 -0
  35. package/dist/public/assets/{use-toast-rlEtMnzM.js → use-toast-C3jyoS6i.js} +1 -1
  36. package/dist/public/assets/{utils-C3gmypZX.js → utils-4yrqj6yI.js} +1 -1
  37. package/dist/public/index.html +19 -19
  38. package/package.json +1 -1
  39. package/dist/public/assets/chat-input-container-CfXgimBQ.js +0 -1
  40. package/dist/public/assets/conversation-history-view-DjO711iz.js +0 -1
  41. package/dist/public/assets/explorer-tree-CyWyxQvY.js +0 -1
  42. package/dist/public/assets/history-view-BvAOaO8q.js +0 -1
  43. package/dist/public/assets/index-BPF49zet.css +0 -1
  44. package/dist/public/assets/index-C7dA1l3u.js +0 -50
  45. package/dist/public/assets/onboarding-dialog-DSmKEXk4.js +0 -1
  46. package/dist/public/assets/onboarding-vGz3IczM.js +0 -1
  47. package/dist/public/assets/resizable-C82J5y6K.js +0 -1
  48. package/dist/public/assets/store-Cn1lT5YJ.js +0 -2
  49. package/dist/public/assets/tabs-M7nUZf6O.js +0 -1
  50. package/dist/public/assets/todos-view-DDVfCfgF.js +0 -1
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Bi as t,Cr as n,Gt as r,Pn as i,Wn as a,Z as o,ca as s,ea as c,fi as l,ua as u}from"./dialogs-config-Dwpv4SNp.js";import{t as d}from"./use-toast-rlEtMnzM.js";var f=e(u(),1),p=s(),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,s]=(0,f.useState)(!0);(0,f.useEffect)(()=>{u();let e=()=>{document.visibilityState===`visible`&&u()};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]);async function u(){s(!0);try{n(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(){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)(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)(t,{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)(t,{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)(c,{className:`h-3 w-3 text-primary`}),`Unlimited prompts`]}),(0,m.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,m.jsx)(c,{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,ca as i,ua as a}from"./dialogs-config-Dwpv4SNp.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-CYvpNUsM.js";var m=i(),h=e(a(),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-BX34Jw0L.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-Dwpv4SNp.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,Li as r,Rr as i,Wr as a,Xr as o,ca as s,si as c,ua as l}from"./dialogs-config-Dwpv4SNp.js";import{a as u}from"./store-Cn1lT5YJ.js";import{n as d}from"./tab-context-COCYkRNN.js";import{t as f}from"./run-stop-button-1ECLRujs.js";var p=s(),m=e(l(),1),h=t();function g(){let e=(0,p.c)(41),{devServerUrl:t,browserResetTrigger:s}=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]===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)(c,{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-xK3nfJ3V.js";import{n as d}from"./tab-context-D2auNMAI.js";import{t as f}from"./run-stop-button-MczHUMXL.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,Lt as f,Mt as p,Nr as m,Or as h,Pi as g,Pn as _,Q as v,Qi as y,Qr as b,Rn as x,Tn as S,Tt as C,Un as w,Vr as T,Wn as E,Y as D,Yi as O,Yt as k,Zi as A,_i as j,aa as M,bn as N,cn as P,d as F,da as I,di as L,fi as R,fn as z,gi as ee,ji as te,jt as ne,ki as re,kr as ie,kt as ae,la as B,m as oe,ni as V,nt as H,on as U,pn as W,qi as G,ta as K,tt as q,vi as se,w as J,xi as ce,xn as le,y as ue,zn as de}from"./dialogs-config-3Hr2GRdt.js";import{B as fe,G as pe,H as me,J as he,K as ge,L as _e,R as ve,U as ye,V as be,X as xe,Y as Se,Z as Ce,gt as we,q as Te}from"./react-vendor-BX34Jw0L.js";import{a as Ee,l as Y,s as De,t as X,u as Oe}from"./store-xK3nfJ3V.js";import{c as ke,s as Ae,u as je}from"./history-view-Cyhu-ped.js";import{t as Me}from"./use-toast-C3jyoS6i.js";import{a as Ne,c as Pe,i as Fe,o as Ie,s as Le,t as Re}from"./alert-dialog-JOYww-on.js";import{n as ze}from"./tab-context-D2auNMAI.js";import{r as Be}from"./onboarding-DzgFi5ix.js";var Z=B(),Q=e(I(),1),$=i();function Ve(e){let t=(0,Z.c)(30),{node:n,level:r,renderNode:i,defaultOpen:a,indent:o,childContainerClassName:s,openState:c,onToggle:l,forceOpenIds:u}=e,d=!!(n.children&&n.children.length>0),f,p,m;if(t[0]!==a||t[1]!==u||t[2]!==d||t[3]!==r||t[4]!==n||t[5]!==l||t[6]!==c||t[7]!==i){f=u?.has(n.id)||(c[n.id]??a);let e;t[11]!==n.id||t[12]!==l?(e=()=>l(n.id),t[11]=n.id,t[12]=l,t[13]=e):e=t[13];let o=e;p=`min-w-0`,m=i(n,{isOpen:f,level:r,toggle:o,hasChildren:d}),t[0]=a,t[1]=u,t[2]=d,t[3]=r,t[4]=n,t[5]=l,t[6]=c,t[7]=i,t[8]=f,t[9]=p,t[10]=m}else f=t[8],p=t[9],m=t[10];let h;t[14]!==s||t[15]!==a||t[16]!==u||t[17]!==d||t[18]!==o||t[19]!==f||t[20]!==r||t[21]!==n.children||t[22]!==l||t[23]!==c||t[24]!==i?(h=d&&f&&(0,$.jsx)(`div`,{style:{paddingLeft:o},className:s,children:n.children.map(e=>(0,$.jsx)(Ve,{node:e,level:r+1,renderNode:i,defaultOpen:a,indent:o,childContainerClassName:s,openState:c,onToggle:l,forceOpenIds:u},e.id))}),t[14]=s,t[15]=a,t[16]=u,t[17]=d,t[18]=o,t[19]=f,t[20]=r,t[21]=n.children,t[22]=l,t[23]=c,t[24]=i,t[25]=h):h=t[25];let g;return t[26]!==p||t[27]!==m||t[28]!==h?(g=(0,$.jsxs)(`div`,{className:p,children:[m,h]}),t[26]=p,t[27]=m,t[28]=h,t[29]=g):g=t[29],g}function He(e){let t=(0,Z.c)(27),{nodes:n,renderNode:r,resetKey:i,defaultOpen:a,forceOpenIds:o,indent:s,childContainerClassName:c,className:l}=e,u=a===void 0?!1:a,d=s===void 0?16:s,f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f={},t[0]=f):f=t[0];let[p,m]=(0,Q.useState)(f),[h,g]=(0,Q.useState)(i);i!==h&&(g(i),m({}));let _;t[1]===o?_=t[2]:(_=o?new Set(o):void 0,t[1]=o,t[2]=_);let v=_,y;t[3]===u?y=t[4]:(y=e=>{m(t=>({...t,[e]:!(t[e]??u)}))},t[3]=u,t[4]=y);let b=y,x;t[5]===l?x=t[6]:(x=E(`min-w-0`,l),t[5]=l,t[6]=x);let S;if(t[7]!==c||t[8]!==u||t[9]!==v||t[10]!==b||t[11]!==d||t[12]!==n||t[13]!==p||t[14]!==r){let e;t[16]!==c||t[17]!==u||t[18]!==v||t[19]!==b||t[20]!==d||t[21]!==p||t[22]!==r?(e=e=>(0,$.jsx)(Ve,{node:e,level:0,renderNode:r,defaultOpen:u,indent:d,childContainerClassName:c,openState:p,onToggle:b,forceOpenIds:v},e.id),t[16]=c,t[17]=u,t[18]=v,t[19]=b,t[20]=d,t[21]=p,t[22]=r,t[23]=e):e=t[23],S=n.map(e),t[7]=c,t[8]=u,t[9]=v,t[10]=b,t[11]=d,t[12]=n,t[13]=p,t[14]=r,t[15]=S}else S=t[15];let C;return t[24]!==x||t[25]!==S?(C=(0,$.jsx)(`div`,{className:x,children:S}),t[24]=x,t[25]=S,t[26]=C):C=t[26],C}var Ue=(0,Q.createContext)({todos:[],setTodos:()=>{}});function We(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)(Ue.Provider,{value:f,children:n}),t[7]=n,t[8]=f,t[9]=p):p=t[9],p}function Ge(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 Ke(e){let t=(0,Z.c)(5),{todos:n,sequence:r}=e,{setTodos:i}=(0,Q.useContext)(Ue),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 qe=new Map,Je=new Map;function Ye(e){return qe.get(e)}function Xe(e,t){let n=Je.get(e);return n||(n=new Set,Je.set(e,n)),n.add(t),()=>{n.delete(t),n.size===0&&Je.delete(e)}}function Ze(e){let t=Je.get(e);if(t)for(let e of t)e()}function Qe(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 $e(e,t,n){if(qe.has(e))return;qe.set(e,{status:`running`}),Ze(e);let r=S();(async()=>{try{let i=Qe(r,n),a=Object.getPrototypeOf(async function(){}).constructor,o=await new a(`callTool`,t)(i),s=o===void 0?null:o;qe.set(e,{status:`success`,result:s}),Ze(e),await z(e,s)}catch(t){let n=t instanceof Error?t.stack||t.message:String(t);qe.set(e,{status:`error`,error:n}),Ze(e);try{await z(e,{error:n})}catch(e){console.error(`[browser-js-executor] failed to submit error result`,e)}}})()}var et=()=>{if(typeof window>`u`)return null;let e=window.SpeechRecognition||window.webkitSpeechRecognition;return e?new e:null};function tt(){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=et();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 nt({initialValue:e}={}){let{state:n,dispatch:r}=Ee(),[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),g=(0,Q.useRef)(m?.id??``),_=(0,Q.useRef)(m?.provider??``),y=(0,Q.useRef)(null),[b,x]=(0,Q.useState)(!1),[S,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)([]),[D,O]=(0,Q.useState)(!1),[k,A]=(0,Q.useState)(!1),[j,M]=(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,oe]=(0,Q.useState)([]),[V,H]=(0,Q.useState)([]),[U,W]=(0,Q.useState)(!1),[G,K]=(0,Q.useState)(``),se=(0,Q.useRef)(null),ce=(0,Q.useRef)(null),le=(0,Q.useRef)(null),ue=(0,Q.useRef)(null),de=(0,Q.useRef)(null),fe=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{g.current=m?.id??``,_.current=m?.provider??``},[m?.id,m?.provider]);let pe=(0,Q.useCallback)((e,t)=>{h(e);let i=n.selectedThreadId;if(!i||(r({type:X.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}}),N(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=g.current===s.id&&_.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:g.current,provider:_.current}}),l||pe(s,{persist:c})}catch(e){console.error(`Failed to load enabled models:`,e)}})()},[n.selectedThreadId,n.selectedProjectId,n.projects,pe]);let me=(0,Q.useRef)(pe);(0,Q.useEffect)(()=>{me.current=pe},[pe]),(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=g.current,t=_.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)(()=>{!j||P.length>0||(async()=>{try{let e=await v(),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)}})()},[j,P.length]);let[he,ge]=(0,Q.useState)(n.selectedThreadId);return(0,Q.useEffect)(()=>{n.selectedThreadId!==he&&setTimeout(()=>{ge(n.selectedThreadId),z([]),te(!1),oe([]),H([]),W(!1),O(!1),M(!1),A(!1)},0)},[n.selectedThreadId,he]),(0,Q.useEffect)(()=>{n.selectedThreadId&&C(n.selectedThreadId).then(({commands:e,skills:t})=>{console.log(`Loaded slash commands:`,e,`skills:`,t),oe(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&&(ce.current?.focus(),r({type:X.ClearFocusChatInput}))},[n.focusChatInput,n.selectedThreadId,n.isStreaming,r]),(0,Q.useEffect)(()=>{let e=e=>{le.current&&!le.current.contains(e.target)&&x(!1),ue.current&&!ue.current.contains(e.target)&&w(!1)};if(b||S)return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[b,S]),{message:i,setMessage:a,historyIndex:o,setHistoryIndex:s,draftMessage:c,setDraftMessage:l,cursorPosition:u,setCursorPosition:d,availableModels:f,setAvailableModels:p,selectedModel:m,setSelectedModel:pe,selectedModelIdRef:g,showModelMenu:b,setShowModelMenu:x,showPlusMenu:S,setShowPlusMenu:w,attachments:T,setAttachments:E,planMode:D,setPlanMode:O,ralphMode:k,setRalphMode:A,imageMode:j,setImageMode:M,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:oe,skills:V,setSkills:H,showCommandSuggestions:U,setShowCommandSuggestions:W,commandQuery:G,setCommandQuery:K,fileInputRef:se,textareaRef:ce,modelMenuRef:le,plusMenuRef:ue,suggestionsRef:de,commandSuggestionsRef:fe,handleNewChat:async()=>{if(n.selectedThreadId)try{let e=await J(n.selectedThreadId);r({type:X.ClearMessages}),console.log(`New conversation started:`,e);let t=await q(n.selectedThreadId);r({type:X.SetMessages,messages:t.messages})}catch(e){console.error(`Failed to start new chat:`,e)}},state:n,dispatch:r}}var rt=e=>{F(e)};function it(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:ee,selectedImageModel:te}=e,ne;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]!==te||t[11]!==a||t[12]!==c||t[13]!==P||t[14]!==g||t[15]!==m||t[16]!==r||t[17]!==u||t[18]!==N?(ne=()=>{if(!n.trim()&&i.length===0||!c)return;let e=z?te:a;e&&(l&&(u(),d()),s?f({type:X.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),rt(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]=te,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]=ne):ne=t[19];let re=ne,ie;t[20]!==_||t[21]!==n||t[22]!==r||t[23]!==b||t[24]!==x||t[25]!==N?(ie=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]=ie):ie=t[26];let B=ie,V;t[27]!==k||t[28]!==_||t[29]!==n||t[30]!==ee||t[31]!==r||t[32]!==I||t[33]!==R||t[34]!==O||t[35]!==N?(V=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),ee(!1)):e.metadata.mode===`ralph`&&(R(!0),I(!1),ee(!1))},t[27]=k,t[28]=_,t[29]=n,t[30]=ee,t[31]=r,t[32]=I,t[33]=R,t[34]=O,t[35]=N,t[36]=V):V=t[36];let H=V,U;t[37]!==k||t[38]!==_||t[39]!==n||t[40]!==r||t[41]!==O||t[42]!==N?(U=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]=U):U=t[43];let W=U,G,K,q,se;if(t[44]!==C||t[45]!==k||t[46]!==h||t[47]!==re||t[48]!==p||t[49]!==H||t[50]!==B||t[51]!==W||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){q=e=>{if(D){if(e.key===`ArrowDown`){e.preventDefault(),E((T+1)%G.length);return}if(e.key===`ArrowUp`){e.preventDefault(),E((T-1+G.length)%G.length);return}if(e.key===`Enter`||e.key===`Tab`){e.preventDefault();let t=G[T];t&&(t.type===`command`?H(t.data):W(t.data));return}if(e.key===`Escape`){O(!1);return}}if(y){let t=K.length>0;if(e.key===`ArrowDown`&&t){e.preventDefault(),E((T+1)%K.length);return}if(e.key===`ArrowUp`&&t){e.preventDefault(),E((T-1+K.length)%K.length);return}if(e.key===`Enter`||e.key===`Tab`){e.preventDefault(),K[T]&&B(K[T]);return}if(e.key===`Escape`){b(!1);return}}if(e.key===`Enter`&&!e.shiftKey){e.preventDefault(),re();return}let t=oe();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&&ae(c).then(e=>{w(e)}).catch(st))}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],se=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(ot),...a.map(at)],t[85]=k,t[86]=M,t[87]=j,t[88]=i}else i=t[88];G=i.slice(0,10),K=y?C.filter(e=>e.toLowerCase().includes(x.toLowerCase())).slice(0,10):[],t[44]=C,t[45]=k,t[46]=h,t[47]=re,t[48]=p,t[49]=H,t[50]=B,t[51]=W,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]=G,t[71]=K,t[72]=q,t[73]=se}else G=t[70],K=t[71],q=t[72],se=t[73];let J;return t[93]!==G||t[94]!==K||t[95]!==q||t[96]!==re||t[97]!==se||t[98]!==H||t[99]!==B||t[100]!==W?(J={handleSend:re,handleKeyDown:q,handleTextareaInput:se,insertFileReference:B,insertCommand:H,insertSkill:W,allSuggestions:G,fileSuggestions:K},t[93]=G,t[94]=K,t[95]=q,t[96]=re,t[97]=se,t[98]=H,t[99]=B,t[100]=W,t[101]=J):J=t[101],J}function at(e){return{type:`skill`,data:e}}function ot(e){return{type:`command`,data:e}}function st(e){return console.error(`Failed to fetch files:`,e)}function ct(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(ut),...s.map(lt)].slice(0,10),t[0]=r,t[1]=a,t[2]=i,t[3]=f}else f=t[3];let p=f,m;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(d,{className:`h-3 w-3`}),t[8]=m):m=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:[m,`Commands & Skills`,g]}),t[9]=g,t[10]=_);let v;t[11]!==p||t[12]!==l||t[13]!==s||t[14]!==c||t[15]!==o?(v=p.length>0?p.map((e,t)=>{let n=t===o;if(e.type===`command`){let r=e.data;return(0,$.jsxs)(`button`,{type:`button`,className:E(`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:E(`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)(h,{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]=p,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 lt(e){return{type:`skill`,data:e}}function ut(e){return{type:`command`,data:e}}function dt(e){return e.startsWith(`image/`)}function ft(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:dt(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)(ie,{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)(V,{className:`h-3 w-3`}),e.fileName,(0,$.jsxs)(`button`,{type:`button`,onClick:()=>r(t),className:`ml-1 hover:text-foreground`,children:[(0,$.jsx)(ie,{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 pt(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 mt(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:E(`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)(g,{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 m;return t[12]!==u||t[13]!==f||t[14]!==p?(m=(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]=m):m=t[15],m}function ht(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:gt}),t[0]=r,t[1]=i,t[2]=a):a=t[2],a}function gt(e){e.currentTarget.style.visibility=`hidden`}function _t(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)(ht,{provider:p}),t[7]=p,t[8]=m);let h;t[9]===r?h=t[10]:(h=r?Be(r.id):`No model`,t[9]=r,t[10]=h);let g;t[11]===h?g=t[12]:(g=(0,$.jsx)(`span`,{className:`text-xs font-medium`,children:h}),t[11]=h,t[12]=g);let v;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(A,{className:`h-3 w-3`}),t[13]=v):v=t[13];let y;t[14]!==f||t[15]!==m||t[16]!==g?(y=(0,$.jsxs)(_,{variant:`action`,size:`icon-sm`,className:`gap-1 w-auto px-2`,onClick:f,children:[m,g,v]}),t[14]=f,t[15]=m,t[16]=g,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(vt,{})).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)(ht,{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:Be(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 vt(e,t){let n=t.provider??`Other`;return e[n]||(e[n]=[]),e[n].push(t),e}var yt=[{value:`build`,label:`Build`,icon:r},{value:`plan`,label:`Plan`,icon:se},{value:`image`,label:`Image`,icon:ce},{value:`ralph`,label:`Ralph`,icon:b}];function bt(e,t,n){return n?`ralph`:e?`plan`:t?`image`:`build`}function xt(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=bt(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=yt.find(e=>e.value===f),t[4]=f,t[5]=p);let m=p,h=m.icon,g,v;t[6]===c?(g=t[7],v=t[8]):(g=()=>{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]=g,t[8]=v),Q.useEffect(g,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]===h?S=t[16]:(S=(0,$.jsx)(h,{className:`h-3.5 w-3.5`}),t[15]=h,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)(A,{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)(_,{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:yt.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)(K,{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 D;return t[28]!==T||t[29]!==E?(D=(0,$.jsxs)(`div`,{className:`relative`,ref:u,children:[T,E]}),t[28]=T,t[29]=E,t[30]=D):D=t[30],D}function St(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)(_,{variant:`action`,size:`icon-sm`,onClick:d,children:[f,p]}),t[9]=d,t[10]=m);let h;t[11]!==u||t[12]!==i?(h=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)(V,{className:`h-3.5 w-3.5`}),`Attach File`]})}),t[11]=u,t[12]=i,t[13]=h):h=t[13];let g;return t[14]!==m||t[15]!==h?(g=(0,$.jsxs)(`div`,{className:`relative`,ref:o,children:[m,h]}),t[14]=m,t[15]=h,t[16]=g):g=t[16],g}function Ct(e){let t=(0,Z.c)(14),{onToggleSpeech:n}=e,{isListening:r,isSupported:i}=tt();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)(R,{}):(0,$.jsx)(L,{}),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)(je,{asChild:!0,children:(0,$.jsxs)(_,{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)(ke,{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)(Ae,{children:[l,d]}),t[11]=l,t[12]=d,t[13]=f):f=t[13],f}function wt(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)(ie,{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 Tt(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:f,transcript:p,startListening:h,stopListening:g,resetTranscript:v}=tt(),y;t[0]===o?y=t[1]:(y={initialValue:o},t[0]=o,t[1]=y);let{message:b,setMessage:x,historyIndex:S,setHistoryIndex:C,draftMessage:w,setDraftMessage:E,cursorPosition:D,setCursorPosition:O,availableModels:k,selectedModel:A,setSelectedModel:j,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:oe,suggestionQuery:V,setSuggestionQuery:H,selectedIndex:U,setSelectedIndex:W,slashCommands:G,skills:K,showCommandSuggestions:q,setShowCommandSuggestions:se,commandQuery:J,setCommandQuery:ce,fileInputRef:le,textareaRef:ue,suggestionsRef:de,commandSuggestionsRef:fe,state:pe,dispatch:me}=nt(y),he=z?ne:A,ge=z?te:k,_e=pe.selectedThreadId??void 0,ve;t[2]!==ie||t[3]!==N||t[4]!==J||t[5]!==D||t[6]!==me||t[7]!==w||t[8]!==S||t[9]!==z||t[10]!==f||t[11]!==u||t[12]!==b||t[13]!==n||t[14]!==F||t[15]!==L||t[16]!==v||t[17]!==ne||t[18]!==U||t[19]!==A||t[20]!==ae||t[21]!==P||t[22]!==ce||t[23]!==O||t[24]!==E||t[25]!==C||t[26]!==ee||t[27]!==x||t[28]!==I||t[29]!==R||t[30]!==W||t[31]!==se||t[32]!==oe||t[33]!==H||t[34]!==q||t[35]!==B||t[36]!==K||t[37]!==G||t[38]!==g||t[39]!==V||t[40]!==_e||t[41]!==ue?(ve={message:b,setMessage:x,attachments:N,selectedModel:A,onSend:n,isStreaming:u,selectedThreadId:_e,isListening:f,stopListening:g,resetTranscript:v,dispatch:me,historyIndex:S,setHistoryIndex:C,draftMessage:w,setDraftMessage:E,cursorPosition:D,setCursorPosition:O,showSuggestions:B,setShowSuggestions:oe,suggestionQuery:V,setSuggestionQuery:H,allFiles:ie,setAllFiles:ae,selectedIndex:U,setSelectedIndex:W,showCommandSuggestions:q,setShowCommandSuggestions:se,commandQuery:J,setCommandQuery:ce,slashCommands:G,skills:K,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]=J,t[5]=D,t[6]=me,t[7]=w,t[8]=S,t[9]=z,t[10]=f,t[11]=u,t[12]=b,t[13]=n,t[14]=F,t[15]=L,t[16]=v,t[17]=ne,t[18]=U,t[19]=A,t[20]=ae,t[21]=P,t[22]=ce,t[23]=O,t[24]=E,t[25]=C,t[26]=ee,t[27]=x,t[28]=I,t[29]=R,t[30]=W,t[31]=se,t[32]=oe,t[33]=H,t[34]=q,t[35]=B,t[36]=K,t[37]=G,t[38]=g,t[39]=V,t[40]=_e,t[41]=ue,t[42]=ve):ve=t[42];let{handleSend:ye,handleKeyDown:be,handleTextareaInput:xe,insertFileReference:Se,insertCommand:Ce,insertSkill:we,fileSuggestions:Te}=it(ve),Ee=Q.useRef(``),Y,De;t[43]!==x||t[44]!==p?(Y=()=>{if(p&&p!==Ee.current){let e=p.substring(Ee.current.length);x(t=>(t.endsWith(` `),t+e)),Ee.current=p}},De=[p,x],t[43]=x,t[44]=p,t[45]=Y,t[46]=De):(Y=t[45],De=t[46]),Q.useEffect(Y,De);let X;t[47]===P?X=t[48]:(X=e=>{let t=e.clipboardData?.items;if(!t)return;let n=Array.from(t).filter(Dt);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]=X);let Oe=X,ke;t[49]!==f||t[50]!==v||t[51]!==h||t[52]!==g?(ke=()=>{f?(g(),v()):(v(),h())},t[49]=f,t[50]=v,t[51]=h,t[52]=g,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)(wt,{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]!==be||t[59]!==Oe||t[60]!==xe||t[61]!==b||t[62]!==Pe||t[63]!==ue?(Fe=(0,$.jsx)(`textarea`,{ref:ue,value:b,onChange:xe,onKeyDown:be,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]=be,t[59]=Oe,t[60]=xe,t[61]=b,t[62]=Pe,t[63]=ue,t[64]=Fe):Fe=t[64];let Ie;t[65]!==J||t[66]!==fe||t[67]!==Ce||t[68]!==we||t[69]!==U||t[70]!==W||t[71]!==q||t[72]!==K||t[73]!==G?(Ie=(0,$.jsx)(ct,{visible:q,commands:G,skills:K,query:J,selectedIndex:U,onSelectCommand:Ce,onSelectSkill:we,onMouseEnterSuggestion:W,containerRef:fe}),t[65]=J,t[66]=fe,t[67]=Ce,t[68]=we,t[69]=U,t[70]=W,t[71]=q,t[72]=K,t[73]=G,t[74]=Ie):Ie=t[74];let Le;t[75]!==Te||t[76]!==Se||t[77]!==U||t[78]!==W||t[79]!==B||t[80]!==V||t[81]!==de?(Le=(0,$.jsx)(mt,{showSuggestions:B,fileSuggestions:Te,suggestionQuery:V,selectedIndex:U,onSelectFile:Se,onMouseEnterSuggestion:W,containerRef:de}),t[75]=Te,t[76]=Se,t[77]=U,t[78]=W,t[79]=B,t[80]=V,t[81]=de,t[82]=Le):Le=t[82];let Re;t[83]!==N||t[84]!==A?.id||t[85]!==A?.name||t[86]!==A?.supportsImages||t[87]!==P?(Re=N.length>0&&(0,$.jsxs)(`div`,{className:`px-4`,children:[(0,$.jsx)(ft,{attachments:N,onRemove:e=>P(t=>t.filter((t,n)=>n!==e))}),N.some(Et)&&A?.supportsImages===!1&&(0,$.jsxs)(`div`,{className:`mb-2 flex items-center gap-1.5 text-xs text-amber-500`,children:[(0,$.jsx)(m,{className:`h-3 w-3 shrink-0`}),(0,$.jsxs)(`span`,{children:[`Images are not supported by `,A?.name||A?.id]})]})]}),t[83]=N,t[84]=A?.id,t[85]=A?.name,t[86]=A?.supportsImages,t[87]=P,t[88]=Re):Re=t[88];let ze;t[89]===le?ze=t[90]:(ze=(0,$.jsx)(St,{onFileAttach:()=>le.current?.click()}),t[89]=le,t[90]=ze);let Be;t[91]===Ae?Be=t[92]:(Be=(0,$.jsx)(Ct,{onToggleSpeech:Ae}),t[91]=Ae,t[92]=Be);let Ve=z?re:j,He;t[93]!==ge||t[94]!==he||t[95]!==Ve?(He=(0,$.jsx)(_t,{availableModels:ge,selectedModel:he,onModelSelect:Ve}),t[93]=ge,t[94]=he,t[95]=Ve,t[96]=He):He=t[96];let Ue;t[97]!==ze||t[98]!==Be||t[99]!==He?(Ue=(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[ze,Be,He]}),t[97]=ze,t[98]=Be,t[99]=He,t[100]=Ue):Ue=t[100];let We;t[101]!==z||t[102]!==F||t[103]!==L||t[104]!==ee||t[105]!==I||t[106]!==R?(We=(0,$.jsx)(xt,{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]=We):We=t[107];let Ge=u?r:ye,Ke;t[108]!==N.length||t[109]!==a||t[110]!==he||t[111]!==u||t[112]!==b?(Ke=!u&&((a??!1)||!b.trim()&&N.length===0||!he),t[108]=N.length,t[109]=a,t[110]=he,t[111]=u,t[112]=b,t[113]=Ke):Ke=t[113];let qe;t[114]===u?qe=t[115]:(qe=u?(0,$.jsx)(T,{className:`h-3 w-3 fill-current`}):(0,$.jsx)(M,{className:`h-3 w-3`}),t[114]=u,t[115]=qe);let Je=u?`Stop generation`:`Send message`,Ye;t[116]===Je?Ye=t[117]:(Ye=(0,$.jsx)(`span`,{className:`sr-only`,children:Je}),t[116]=Je,t[117]=Ye);let Xe;t[118]!==Ge||t[119]!==Ke||t[120]!==qe||t[121]!==Ye?(Xe=(0,$.jsxs)(_,{size:`icon`,className:`h-7 w-7 rounded-full`,onClick:Ge,disabled:Ke,children:[qe,Ye]}),t[118]=Ge,t[119]=Ke,t[120]=qe,t[121]=Ye,t[122]=Xe):Xe=t[122];let Ze;t[123]!==We||t[124]!==Xe?(Ze=(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[We,Xe]}),t[123]=We,t[124]=Xe,t[125]=Ze):Ze=t[125];let Qe;t[126]!==Ue||t[127]!==Ze?(Qe=(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-3 pb-2`,children:[Ue,Ze]}),t[126]=Ue,t[127]=Ze,t[128]=Qe):Qe=t[128];let $e;t[129]!==Me||t[130]!==Ne||t[131]!==Fe||t[132]!==Ie||t[133]!==Le||t[134]!==Re||t[135]!==Qe?($e=(0,$.jsxs)(`div`,{className:Me,children:[Ne,Fe,Ie,Le,Re,Qe]}),t[129]=Me,t[130]=Ne,t[131]=Fe,t[132]=Ie,t[133]=Le,t[134]=Re,t[135]=Qe,t[136]=$e):$e=t[136];let et;t[137]===P?et=t[138]:(et=e=>pt(e,e=>P(t=>[...t,...e])),t[137]=P,t[138]=et);let rt;t[139]!==le||t[140]!==et?(rt=(0,$.jsx)(`input`,{ref:le,type:`file`,multiple:!0,className:`hidden`,onChange:et}),t[139]=le,t[140]=et,t[141]=rt):rt=t[141];let at;return t[142]!==je||t[143]!==$e||t[144]!==rt?(at=(0,$.jsxs)(`div`,{className:je,children:[$e,rt]}),t[142]=je,t[143]=$e,t[144]=rt,t[145]=at):at=t[145],at}function Et(e){return e.mimeType.startsWith(`image/`)}function Dt(e){return e.type.startsWith(`image/`)}var Ot=ge,kt=Ce,At=he,jt=Q.forwardRef((e,t)=>{let n=(0,Z.c)(14),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({className:i,inset:a,children:r,...o}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let s=a&&`pl-8`,c;n[5]!==i||n[6]!==s?(c=E(`flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,s,i),n[5]=i,n[6]=s,n[7]=c):c=n[7];let l;n[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(y,{className:`ml-auto`}),n[8]=l):l=n[8];let u;return n[9]!==r||n[10]!==o||n[11]!==t||n[12]!==c?(u=(0,$.jsxs)(xe,{ref:t,className:c,...o,children:[r,l]}),n[9]=r,n[10]=o,n[11]=t,n[12]=c,n[13]=u):u=n[13],u});jt.displayName=xe.displayName;var Mt=Q.forwardRef((e,t)=>{let n=(0,Z.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=E(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,$.jsx)(Se,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Mt.displayName=Se.displayName;var Nt=Q.forwardRef((e,t)=>{let n=(0,Z.c)(11),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:r,sideOffset:a,...i}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o=a===void 0?4:a,s;n[4]===r?s=n[5]:(s=E(`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`,r),n[4]=r,n[5]=s);let c;return n[6]!==i||n[7]!==t||n[8]!==o||n[9]!==s?(c=(0,$.jsx)(ye,{children:(0,$.jsx)(ve,{ref:t,sideOffset:o,className:s,...i})}),n[6]=i,n[7]=t,n[8]=o,n[9]=s,n[10]=c):c=n[10],c});Nt.displayName=ve.displayName;var Pt=Q.forwardRef((e,t)=>{let n=(0,Z.c)(11),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:r,inset:i,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o=i&&`pl-8`,s;n[4]!==r||n[5]!==o?(s=E(`relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,o,r),n[4]=r,n[5]=o,n[6]=s):s=n[6];let c;return n[7]!==a||n[8]!==t||n[9]!==s?(c=(0,$.jsx)(fe,{ref:t,className:s,...a}),n[7]=a,n[8]=t,n[9]=s,n[10]=c):c=n[10],c});Pt.displayName=fe.displayName;var Ft=Q.forwardRef((e,t)=>{let n=(0,Z.c)(14),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({className:a,children:i,checked:r,...o}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let s;n[5]===a?s=n[6]:(s=E(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,a),n[5]=a,n[6]=s);let c;n[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,$.jsx)(be,{children:(0,$.jsx)(K,{className:`h-4 w-4`})})}),n[7]=c):c=n[7];let l;return n[8]!==r||n[9]!==i||n[10]!==o||n[11]!==t||n[12]!==s?(l=(0,$.jsxs)(_e,{ref:t,className:s,checked:r,...o,children:[c,i]}),n[8]=r,n[9]=i,n[10]=o,n[11]=t,n[12]=s,n[13]=l):l=n[13],l});Ft.displayName=_e.displayName;var It=Q.forwardRef((e,t)=>{let n=(0,Z.c)(12),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]===i?o=n[5]:(o=E(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,i),n[4]=i,n[5]=o);let s;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,$.jsx)(be,{children:(0,$.jsx)(G,{className:`h-2 w-2 fill-current`})})}),n[6]=s):s=n[6];let c;return n[7]!==r||n[8]!==a||n[9]!==t||n[10]!==o?(c=(0,$.jsxs)(pe,{ref:t,className:o,...a,children:[s,r]}),n[7]=r,n[8]=a,n[9]=t,n[10]=o,n[11]=c):c=n[11],c});It.displayName=pe.displayName;var Lt=Q.forwardRef((e,t)=>{let n=(0,Z.c)(11),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:r,inset:i,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o=i&&`pl-8`,s;n[4]!==r||n[5]!==o?(s=E(`px-2 py-1.5 text-sm font-semibold`,o,r),n[4]=r,n[5]=o,n[6]=s):s=n[6];let c;return n[7]!==a||n[8]!==t||n[9]!==s?(c=(0,$.jsx)(me,{ref:t,className:s,...a}),n[7]=a,n[8]=t,n[9]=s,n[10]=c):c=n[10],c});Lt.displayName=me.displayName;var Rt=Q.forwardRef((e,t)=>{let n=(0,Z.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=E(`-mx-1 my-1 h-px bg-muted`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,$.jsx)(Te,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Rt.displayName=Te.displayName;var zt=e=>{let t=(0,Z.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=E(`ml-auto text-xs tracking-widest opacity-60`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`span`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};zt.displayName=`DropdownMenuShortcut`;function Bt(e){let t=(0,Z.c)(17),{currentBranch:n,availableBranches:r,isLoadingBranches:i,isCheckingOut:a,onLoadBranches:o,onCheckoutBranch:s}=e,c;t[0]===o?c=t[1]:(c=e=>{e&&o()},t[0]=o,t[1]=c);let l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(re,{className:`h-3.5 w-3.5 shrink-0`}),t[2]=l):l=t[2];let u=n||`Unknown`,d;t[3]===u?d=t[4]:(d=(0,$.jsx)(kt,{asChild:!0,children:(0,$.jsxs)(_,{variant:`outline`,size:`sm`,className:`h-7 px-2 text-xs bg-background gap-1.5 border-none text-muted-foreground hover:bg-accent hover:text-accent-foreground`,children:[l,u]})}),t[3]=u,t[4]=d);let f;t[5]!==r||t[6]!==n||t[7]!==a||t[8]!==i||t[9]!==s?(f=i?(0,$.jsxs)(`div`,{className:`px-2 py-1.5 text-xs text-muted-foreground flex items-center gap-2`,children:[(0,$.jsx)(ee,{className:`h-3 w-3 animate-spin`}),`Loading branches...`]}):r.length===0?(0,$.jsx)(`div`,{className:`px-2 py-1.5 text-xs text-muted-foreground`,children:`No branches found`}):r.map(e=>(0,$.jsxs)(Pt,{disabled:e===n||a,onClick:()=>s(e),children:[(0,$.jsx)(re,{className:`h-3.5 w-3.5 mr-2 shrink-0`}),(0,$.jsx)(`span`,{className:e===n?`font-semibold text-foreground`:``,children:e}),e===n&&(0,$.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:`current`})]},e)),t[5]=r,t[6]=n,t[7]=a,t[8]=i,t[9]=s,t[10]=f):f=t[10];let p;t[11]===f?p=t[12]:(p=(0,$.jsx)(Nt,{align:`start`,children:f}),t[11]=f,t[12]=p);let m;return t[13]!==c||t[14]!==d||t[15]!==p?(m=(0,$.jsxs)(Ot,{onOpenChange:c,children:[d,p]}),t[13]=c,t[14]=d,t[15]=p,t[16]=m):m=t[16],m}var Vt=3e4;function Ht(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&&le.invalidate(n),P(await le.get(n,()=>ne(e,t),Vt))}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=le.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 Ut(e){let[t,n]=(0,Q.useState)([]),[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(!1),s=Ht(e);async function c(){if(!(!e||r)){i(!0);try{n((await f(e)).branches)}catch{n([])}finally{i(!1)}}}async function l(t){if(!(!e||t===s.currentBranch)){o(!0);try{await p(e,t),await s.fetchUnifiedStatus(!0),Me({title:`Switched to branch "${t}"`})}catch(e){Me({title:`Failed to switch branch`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}finally{o(!1)}}}return{currentBranch:s.currentBranch,availableBranches:t,isLoadingBranches:r,isCheckingOut:a,loadBranches:c,checkoutBranch:l,fetchUnifiedStatus:s.fetchUnifiedStatus}}function Wt({threadId:e}){let[t,n]=(0,Q.useState)(!1),[r,i]=(0,Q.useState)(null),a=Ut(e);return(0,Q.useEffect)(()=>{e&&H(e).then(i).catch(()=>{})},[e]),(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-8 py-2 mt-[-1rem] min-h-[2.25rem]`,children:[e&&(0,$.jsx)(Bt,{currentBranch:a.currentBranch,availableBranches:a.availableBranches,isLoadingBranches:a.isLoadingBranches,isCheckingOut:a.isCheckingOut,onLoadBranches:a.loadBranches,onCheckoutBranch:a.checkoutBranch}),(0,$.jsx)(`div`,{className:`flex items-center gap-2`,children:e&&(0,$.jsxs)(Ae,{children:[(0,$.jsx)(je,{asChild:!0,children:(0,$.jsx)(_,{variant:`outline`,size:`sm`,className:`h-7 px-2 text-xs bg-background`,onClick:async()=>{if(!(!e||t)){n(!0);try{let t=await H(e);await navigator.clipboard.writeText(t)}finally{n(!1)}}},disabled:t,"aria-label":`Copy repository folder path`,children:(0,$.jsx)(te,{className:`h-3.5 w-3.5 mr-1`})})}),(0,$.jsxs)(ke,{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 Gt(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&&$e(e.id,e.input.code,t)}catch{}}function Kt(){let{state:e,dispatch:t}=Ee(),[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:w,isStreaming:T,streamingModel:E,processingThreadIds:O}=e,A=!!(x&&O.includes(x)),j=(0,Q.useCallback)(n=>{if(d.current=null,f.current=null,g.current){g.current=!1;return}let r=l.current,i=De(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:X.AddMessage,message:r}),t({type:X.ResetStream}),x&&t({type:X.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:X.AddMessage,message:a}),t({type:X.ResetStream}),x&&(t({type:X.MarkThreadCompleted,threadId:x}),t({type:X.RemoveProcessingThread,threadId:x}))},[e.streamingModel,t,x]);(0,Q.useEffect)(()=>{p.current=j},[j]);let M=(0,Q.useCallback)(()=>{x&&h(x),g.current=!0,x&&P(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:X.AddMessage,message:n}),t({type:X.ResetStream}),x&&(t({type:X.MarkThreadCompleted,threadId:x}),t({type:X.RemoveProcessingThread,threadId:x}))},[x,t,e.streamingModel]);(0,Q.useEffect)(()=>{_.current&&!T&&d.current&&(d.current.abort(),d.current=null,f.current&&=(f.current(),null),p.current(E||`default`)),_.current=T},[T,E]),(0,Q.useEffect)(()=>{if(y.current&&=(clearTimeout(y.current),null),T){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(E||`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)}},[T,E]),(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:X.ResetStream})},[x,t]),(0,Q.useEffect)(()=>{if(!x)return;let e=!1;async function n(){try{let n=await q(x);e||t({type:X.SetMessages,messages:n.messages})}catch(n){console.error(`Failed to load chat history:`,n),e||t({type:X.SetMessages,messages:[]})}}return n(),()=>{e=!0}},[x,S,t]),(0,Q.useEffect)(()=>{if(!x||!A||T)return;let e=new AbortController;return d.current=e,t({type:X.ResetStream}),t({type:X.SetStreaming,isStreaming:!0}),s.current=``,c.current=``,l.current=[],u.current=!1,v.current=null,W(x,e.signal).then(n=>{if(!n||e.signal.aborted){p.current(`default`);return}f.current=k(n,e=>{if(t({type:X.IncrementStreamEventCount}),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:X.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:X.SetStreamModel,model:e.model}),e.type===`thinking`||e.isThinking){let n=e.content??``;Gt(n,x),c.current+=n;let r=Y(l.current,`thinking`,n);l.current=r,t({type:X.AppendStreamChunk,chunkType:`thinking`,content:n,segments:r})}else if(e.type===`result`)u.current=!0,s.current=e.content??``,l.current=Oe(l.current,e.content??``),t({type:X.SetStreamContent,content:e.content??``});else{if(u.current)return;s.current+=e.content??``;let n=Y(l.current,`content`,e.content??``);l.current=n,t({type:X.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(t({type:X.IncrementStreamEventCount}),e.role===`assistant`){let n=e.content??``,r=typeof n==`string`?n:JSON.stringify(n);if(e.isThinking??!1){c.current+=r;let e=Y(l.current,`thinking`,r);l.current=e,t({type:X.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=Oe(l.current,r),t({type:X.SetStreamContent,content:r});else{s.current+=r;let e=Y(l.current,`content`,r);l.current=e,t({type:X.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=Y(l.current,`content`,r);l.current=e,t({type:X.AppendStreamChunk,chunkType:`content`,content:r,segments:e})}}})}).catch(e=>{if(e instanceof Error&&e.name===`AbortError`){t({type:X.ResetStream});return}if(e instanceof Error&&e.message.includes(`not currently processing`)){t({type:X.ResetStream});return}console.error(`Failed to subscribe to chat stream:`,e),t({type:X.ResetStream})}),()=>{e.abort(),f.current&&=(f.current(),null)}},[x,A]);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()}`,w;try{let e=await a(x,C);e.success&&e.stashed&&e.checkpointRef&&(w=e.checkpointRef)}catch{}let T={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:w};t({type:X.AddMessage,message:T});let E=n.trim().replace(/\n/g,` `).slice(0,100);if(S&&x&&(N(x,{title:E}).catch(e=>{console.error(`Failed to update thread title:`,e)}),t({type:X.UpdateThreadTitle,projectId:S,threadId:x,title:E})),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:X.AddMessage,message:e}),t({type:X.ResetStream});return}t({type:X.SetStreaming,isStreaming:!0});try{let r=await D(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:X.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:X.AddMessage,message:r})}finally{t({type:X.ResetStream})}return}t({type:X.ResetStream}),t({type:X.SetStreaming,isStreaming:!0}),s.current=``,u.current=!1;let O=new AbortController;d.current=O;try{let a=await U(x,n,i,m,O.signal,g,_,b);if(!a){p.current(i);return}f.current=k(a,n=>{if(t({type:X.IncrementStreamEventCount}),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:X.UpdateToolCallProgress,toolCallId:e,progress:{toolCallId:e,toolName:r,delta:n.delta,partial:n.partial}})}return}if(n.model&&t({type:X.SetStreamModel,model:n.model}),n.type===`thinking`||n.isThinking){let r=n.content??``;Gt(r,e.selectedThreadId),c.current+=r;let i=Y(l.current,`thinking`,r);l.current=i,t({type:X.AppendStreamChunk,chunkType:`thinking`,content:r,segments:i})}else if(n.type===`result`)u.current=!0,s.current=n.content??``,l.current=Oe(l.current,n.content??``),t({type:X.SetStreamContent,content:n.content??``});else{if(u.current)return;s.current+=n.content??``;let e=Y(l.current,`content`,n.content??``);l.current=e,t({type:X.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(t({type:X.IncrementStreamEventCount}),e.role===`assistant`){let n=e.content??``,r=typeof n==`string`?n:JSON.stringify(n);if(e.isThinking??!1){c.current+=r;let e=Y(l.current,`thinking`,r);l.current=e,t({type:X.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=Oe(l.current,r),t({type:X.SetStreamContent,content:r});else{s.current+=r;let e=Y(l.current,`content`,r);l.current=e,t({type:X.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=Y(l.current,`content`,r);l.current=e,t({type:X.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 ue){t({type:X.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:X.ResetStream})}},[x,S,t]);(0,Q.useEffect)(()=>{let n=e.pendingChatMessage;if(!n||T||n.threadId!==x)return;let r=setTimeout(()=>{t({type:X.ClearPendingChatMessage}),F(n.message,n.model,[],n.provider)},100);return()=>clearTimeout(r)},[e.pendingChatMessage,T,x,t,F]);let I=(0,Q.useMemo)(()=>x?w.filter(e=>e.threadId===x):[],[x,w]),L=(0,Q.useRef)(!1);return(0,Q.useEffect)(()=>{if(T||!x||I.length===0||L.current)return;let[e]=I;L.current=!0,t({type:X.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,T,I,x]),{error:n,setError:r,handleSend:F,handleStop:M,isStreaming:T,selectedThreadId:x,queuedMessagesForThread:I,handleRemoveQueuedMessage:(0,Q.useCallback)(e=>{let n=I.find(t=>t.id===e);t({type:X.RemoveQueuedChatMessage,queuedMessageId:e}),!(!n||T||C.length>0||!x)&&F(n.message,n.model,n.attachments,n.provider,n.planMode,n.imageMode,n.ralphMode)},[t,F,T,C.length,I,x]),showEmptyBalanceDialog:i,setShowEmptyBalanceDialog:o}}function qt(e){let t=(0,Z.c)(10),{open:n,onClose:r}=e,i=we(),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)(Le,{children:[(0,$.jsx)(Pe,{children:`Balance empty`}),(0,$.jsx)(Ne,{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)(Fe,{children:[o,(0,$.jsx)(Ie,{children:(0,$.jsx)(_,{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)(Re,{open:n,onOpenChange:a,children:s}),t[6]=n,t[7]=a,t[8]=s,t[9]=c):c=t[9],c}function Jt(e){let t=(0,Z.c)(13),{todos:n}=e,r;t[0]===n?r=t[1]:(r=n.filter(Xt),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(Yt),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 Yt(e){return(0,$.jsxs)(`div`,{className:`flex items-start gap-2 text-sm`,children:[e.status===`done`?(0,$.jsx)(O,{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)(G,{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 Xt(e){return e.status===`done`}function Zt(){let e=(0,Z.c)(16),{todos:t}=(0,Q.useContext)(Ue),[n,r]=(0,Q.useState)(!1),i;e[0]===t?i=e[1]:(i=t.filter(Qt),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)(j,{className:`h-4 w-4 shrink-0`}),e[2]=o,e[3]=s):(o=e[2],s=e[3]);let l;e[4]!==a||e[5]!==t.length?(l=(0,$.jsxs)(_,{variant:`outline`,size:`sm`,className:`gap-2 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)(w,{children:`Tasks`})}),e[7]=u):u=e[7];let d;e[8]===t?d=e[9]:(d=(0,$.jsxs)(de,{className:`max-w-md`,children:[u,(0,$.jsx)(Jt,{todos:t})]}),e[8]=t,e[9]=d);let f;e[10]!==n||e[11]!==d?(f=(0,$.jsx)(x,{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 Qt(e){return e.status===`done`}function $t(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}=Ee(),{isCreatingProject:l,selectedThreadId:u}=s,{handleSend:d,handleStop:f,isStreaming:p,queuedMessagesForThread:m,handleRemoveQueuedMessage:h,showEmptyBalanceDialog:g,setShowEmptyBalanceDialog:v}=Kt(),y=s.pendingChatMessage?.threadId===u,b=p||y,x=a.length>0,{hasChanges:S,changedFilesCount:C}=Ht(u??void 0),{setActiveMainTab:w}=ze(),T;t[2]!==c||t[3]!==u?(T=async()=>{if(u)try{let e=await J(u);c({type:X.ClearMessages}),console.log(`New conversation started:`,e);let t=await q(u);c({type:X.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]!==g||t[8]!==D?(O=(0,$.jsx)(qt,{open:g,onClose:D}),t[7]=g,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-12 left-0 z-10 ml-8`,children:[(0,$.jsxs)(_,{variant:`outline`,size:`sm`,className:`gap-2`,onClick:E,children:[(0,$.jsx)(n,{className:`h-4 w-4 shrink-0`}),`New Chat`]}),S&&(0,$.jsxs)(_,{variant:`outline`,size:`sm`,className:`gap-2 ml-2`,onClick:()=>w(`review`),children:[(0,$.jsx)(o,{className:`h-4 w-4 shrink-0`}),C,` `,C===1?`File`:`Files`,` Changed`]}),(0,$.jsx)(Zt,{})]}),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]!==h||t[18]!==d||t[19]!==f||t[20]!==m||t[21]!==A?(j=(0,$.jsx)(Tt,{onSend:d,onStop:f,isStreaming:b,disabled:A,initialValue:``,queuedMessages:m,onRemoveQueuedMessage:h,isOverlay:!1}),t[16]=b,t[17]=h,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)(Wt,{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{He as _,Pt as a,Mt as c,$e as d,Ye as f,Ge as g,We as h,Nt as i,jt as l,Ke as m,Ht as n,Rt as o,Xe as p,Ot as r,At as s,$t as t,kt as u};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Cr as t,Ki as n,Wn as r,Zi as i,ca as a,ea as o,ua as s}from"./dialogs-config-Dwpv4SNp.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-CYvpNUsM.js";var b=a(),x=e(s(),1),S=t(),C=y,w=u,T=x.forwardRef((e,t)=>{let n=(0,b.c)(14),a,o,s,c;n[0]===e?(a=n[1],o=n[2],s=n[3],c=n[4]):({className:o,inset:s,children:a,...c}=e,n[0]=e,n[1]=a,n[2]=o,n[3]=s,n[4]=c);let l=s&&`pl-8`,u;n[5]!==o||n[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),n[5]=o,n[6]=l,n[7]=u):u=n[7];let d;n[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,S.jsx)(i,{className:`ml-auto h-4 w-4`}),n[8]=d):d=n[8];let f;return n[9]!==a||n[10]!==c||n[11]!==t||n[12]!==u?(f=(0,S.jsxs)(p,{ref:t,className:u,...c,children:[a,d]}),n[9]=a,n[10]=c,n[11]=t,n[12]=u,n[13]=f):f=n[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,s,l;n[0]===e?(i=n[1],a=n[2],s=n[3],l=n[4]):({className:s,children:a,checked:i,...l}=e,n[0]=e,n[1]=i,n[2]=a,n[3]=s,n[4]=l);let u;n[5]===s?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`,s),n[5]=s,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)(o,{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 i=(0,b.c)(12),a,o,s;i[0]===e?(a=i[1],o=i[2],s=i[3]):({className:o,children:a,...s}=e,i[0]=e,i[1]=a,i[2]=o,i[3]=s);let l;i[4]===o?l=i[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`,o),i[4]=o,i[5]=l);let u;i[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)(n,{className:`h-2 w-2 fill-current`})})}),i[6]=u):u=i[6];let d;return i[7]!==a||i[8]!==s||i[9]!==t||i[10]!==l?(d=(0,S.jsxs)(f,{ref:t,className:l,...s,children:[u,a]}),i[7]=a,i[8]=s,i[9]=t,i[10]=l,i[11]=d):d=i[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};
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-BX34Jw0L.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};