tarsk 0.4.31 → 0.5.32

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 (88) hide show
  1. package/dist/index.js +767 -288
  2. package/dist/public/assets/{account-view-Cdp8xegU.js → account-view-DjLjq8T6.js} +1 -1
  3. package/dist/public/assets/alert-dialog-BWqb8ENe.js +1 -0
  4. package/dist/public/assets/api-BbUzw5rb.js +1 -0
  5. package/dist/public/assets/{browser-tab-Ban23pgA.js → browser-tab-BVsBMyo3.js} +1 -1
  6. package/dist/public/assets/chat-input-container-Dh5eJPNP.js +22 -0
  7. package/dist/public/assets/commit-dialog-CfjW1f6P.js +1 -0
  8. package/dist/public/assets/{context-menu-D93N09Jw.js → context-menu-D_gX85jr.js} +1 -1
  9. package/dist/public/assets/conversation-history-view-CKiv8CxD.js +1 -0
  10. package/dist/public/assets/create-repo-dialog-ByvOv7em.js +1 -0
  11. package/dist/public/assets/{dialogs-config-VlhyoYms.js → dialogs-config-CV8HzCCA.js} +3 -3
  12. package/dist/public/assets/diff-view-CuEdnFtI.js +3 -0
  13. package/dist/public/assets/{explorer-tab-view-Bbboiq-d.js → explorer-tab-view-CiDUcvE2.js} +2 -2
  14. package/dist/public/assets/explorer-tree-cxPx2HiW.js +1 -0
  15. package/dist/public/assets/{explorer-view-CMcJFEtT.js → explorer-view-BCQNEBOZ.js} +1 -1
  16. package/dist/public/assets/git-history-dialog-DKey5IQa.js +1 -0
  17. package/dist/public/assets/history-view-DDpROJvQ.js +1 -0
  18. package/dist/public/assets/index-BZwvl9X4.js +29 -0
  19. package/dist/public/assets/index-CihB-pLh.css +1 -0
  20. package/dist/public/assets/{markdown-renderer-BPXg5AUu.js → markdown-renderer-B1teF28W.js} +4 -4
  21. package/dist/public/assets/mcp-server-card-CY-VLPhS.js +1 -0
  22. package/dist/public/assets/merged-pr-dialog-BfwdsytN.js +1 -0
  23. package/dist/public/assets/onboarding-BEy4bi0g.js +1 -0
  24. package/dist/public/assets/onboarding-dialog-GjczsXqi.js +1 -0
  25. package/dist/public/assets/{page-toolbar-CU9dGLvm.js → page-toolbar-rWocuukR.js} +1 -1
  26. package/dist/public/assets/{project-settings-view-BAs5RYWR.js → project-settings-view-wlaXVds9.js} +1 -1
  27. package/dist/public/assets/providers-list-view-BJsp9sta.js +1 -0
  28. package/dist/public/assets/pull-request-dialog-DDxX2W8n.js +1 -0
  29. package/dist/public/assets/pull-with-changes-dialog-BtXHWQ3k.js +1 -0
  30. package/dist/public/assets/push-before-pr-dialog-Cs54Vb76.js +1 -0
  31. package/dist/public/assets/{radio-group-CRwVSJCp.js → radio-group-D2kNbZM6.js} +1 -1
  32. package/dist/public/assets/react-vendor-DV_DP0Qd.js +22 -0
  33. package/dist/public/assets/resizable-jxPFsLog.js +1 -0
  34. package/dist/public/assets/run-stop-button-N1JNjOlD.js +2 -0
  35. package/dist/public/assets/settings-general-view-BKcgxF5z.js +1 -0
  36. package/dist/public/assets/{settings-instructions-view-DQRSZId7.js → settings-instructions-view-DbQ3c3f1.js} +1 -1
  37. package/dist/public/assets/settings-mcp-servers-view-D2_Brac1.js +5 -0
  38. package/dist/public/assets/{settings-models-skeleton-qdDMv5hS.js → settings-models-skeleton-BSV1GmZQ.js} +1 -1
  39. package/dist/public/assets/settings-models-view-BhFuBHAE.js +1 -0
  40. package/dist/public/assets/settings-rules-view-qL__Zcav.js +8 -0
  41. package/dist/public/assets/settings-skills-view-Ccj8tTR9.js +2 -0
  42. package/dist/public/assets/{settings-slash-commands-view-Cm5cy2My.js → settings-slash-commands-view-DyXAbQIp.js} +1 -1
  43. package/dist/public/assets/settings-subagents-view-LcaON0Dq.js +2 -0
  44. package/dist/public/assets/settings-view-cLrxaSw4.js +2 -0
  45. package/dist/public/assets/{side-panel-container-Cg99BH1l.js → side-panel-container-CCaF3ZtX.js} +2 -2
  46. package/dist/public/assets/{skeleton-B1fuNMHm.js → skeleton-DNfHG6mv.js} +1 -1
  47. package/dist/public/assets/standard-list-item-PWOXi212.js +1 -0
  48. package/dist/public/assets/store-9Wm6Zyve.js +4 -0
  49. package/dist/public/assets/{tab-context-BYpxvaoz.js → tab-context-BdML89mQ.js} +1 -1
  50. package/dist/public/assets/{tabs-ywSKq3qp.js → tabs-BVcV8raO.js} +1 -1
  51. package/dist/public/assets/{terminal-panel-C9XWZHaD.js → terminal-panel-BG8UFUSX.js} +2 -2
  52. package/dist/public/assets/{textarea-DuuNwegn.js → textarea-CU-XhvgE.js} +1 -1
  53. package/dist/public/assets/todos-view-DLC_0wx_.js +1 -0
  54. package/dist/public/assets/use-font-size-Bqn2rvp_.js +1 -0
  55. package/dist/public/assets/{use-toast-BF5WtiOJ.js → use-toast-CGSBJJb0.js} +1 -1
  56. package/dist/public/assets/{utils-CheqpoJ4.js → utils-Dt4Hs5eF.js} +1 -1
  57. package/dist/public/assets/{whisper-wasm-C_Ot631g.js → whisper-wasm-BCJQtWoU.js} +2 -2
  58. package/dist/public/busy.svg +3 -0
  59. package/dist/public/index.html +22 -22
  60. package/package.json +1 -1
  61. package/dist/public/assets/alert-dialog-DAJFcjdR.js +0 -1
  62. package/dist/public/assets/api-BYFUablr.js +0 -1
  63. package/dist/public/assets/chat-input-container-Bc7nCdKX.js +0 -21
  64. package/dist/public/assets/conversation-history-view-qm_qW0aD.js +0 -1
  65. package/dist/public/assets/diff-view-DUmzPmed.js +0 -3
  66. package/dist/public/assets/explorer-tree-CX03Vh31.js +0 -1
  67. package/dist/public/assets/history-view-Cub-F9g6.js +0 -1
  68. package/dist/public/assets/index-C-dv630o.css +0 -1
  69. package/dist/public/assets/index-DaJT5K7g.js +0 -29
  70. package/dist/public/assets/mcp-server-card-BCZmpcVY.js +0 -1
  71. package/dist/public/assets/onboarding-BPUo1aJX.js +0 -1
  72. package/dist/public/assets/onboarding-dialog-vqz8baom.js +0 -1
  73. package/dist/public/assets/providers-list-view-67A5O5vd.js +0 -1
  74. package/dist/public/assets/react-vendor-CtZx3FWA.js +0 -22
  75. package/dist/public/assets/resizable-AKojmHeo.js +0 -1
  76. package/dist/public/assets/run-stop-button-DYoC8i6e.js +0 -2
  77. package/dist/public/assets/settings-general-view-mu1Qq8cl.js +0 -1
  78. package/dist/public/assets/settings-mcp-servers-view-BqJMRVZJ.js +0 -5
  79. package/dist/public/assets/settings-models-view-DSrdZZfF.js +0 -1
  80. package/dist/public/assets/settings-rules-view-Dt_lfKVv.js +0 -8
  81. package/dist/public/assets/settings-skills-view-Djrk38ol.js +0 -2
  82. package/dist/public/assets/settings-subagents-view-CsGwbSvQ.js +0 -2
  83. package/dist/public/assets/settings-view-DuTfugUO.js +0 -2
  84. package/dist/public/assets/standard-list-item-0m99qNoa.js +0 -1
  85. package/dist/public/assets/store-DUqJt-K-.js +0 -4
  86. package/dist/public/assets/todos-view-CRzNrsfP.js +0 -1
  87. package/dist/public/assets/use-font-size-D2A0_bAi.js +0 -1
  88. /package/dist/public/assets/{dist-CAVGqbBm.js → dist-2eORHB3M.js} +0 -0
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Ci as t,Er as n,Fr as r,Xi as i,en as a,la as o,ot as s,ya as c}from"./dialogs-config-VlhyoYms.js";import{t as l}from"./use-toast-BF5WtiOJ.js";import{t as u}from"./skeleton-B1fuNMHm.js";var d=e(c(),1),f=r();function p(){let[e,r]=(0,d.useState)(null),[c,p]=(0,d.useState)(!0);(0,d.useEffect)(()=>{m();let e=()=>{document.visibilityState===`visible`&&m()};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]);async function m(){p(!0);try{r(await s())}catch(e){l({title:`Error`,description:e instanceof Error?e.message:`Failed to load account info`,variant:`destructive`})}finally{p(!1)}}function h(){a(`https://buy.stripe.com/14AcN6feK0Jjbheb2H3Nm03?client_reference_id=${e?.clientReferenceId??``}`)}function g(){a(`https://buy.stripe.com/9B67sMd6CgIh70Y0o33Nm04?client_reference_id=${e?.clientReferenceId??``}`)}if(c)return(0,f.jsxs)(`div`,{className:`max-w-2xl mx-auto p-6`,children:[(0,f.jsxs)(`div`,{className:`mb-6`,children:[(0,f.jsx)(u,{className:`h-8 w-32 mb-2`}),(0,f.jsx)(u,{className:`h-4 w-64`})]}),(0,f.jsxs)(`div`,{className:`space-y-6`,children:[(0,f.jsxs)(`div`,{className:`flex gap-4`,children:[(0,f.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-2`,children:[(0,f.jsx)(u,{className:`h-4 w-20`}),(0,f.jsx)(u,{className:`h-9 w-28`})]}),(0,f.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-3`,children:[(0,f.jsx)(u,{className:`h-4 w-24`}),(0,f.jsx)(u,{className:`h-6 w-32`}),(0,f.jsx)(u,{className:`h-4 w-full`})]})]}),(0,f.jsxs)(`div`,{className:`space-y-3`,children:[(0,f.jsx)(u,{className:`h-4 w-24`}),(0,f.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,f.jsxs)(`div`,{className:`space-y-1 flex-1`,children:[(0,f.jsx)(u,{className:`h-5 w-28`}),(0,f.jsx)(u,{className:`h-4 w-64`})]}),(0,f.jsx)(u,{className:`h-9 w-28 shrink-0`})]}),(0,f.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,f.jsxs)(`div`,{className:`space-y-1 flex-1`,children:[(0,f.jsx)(u,{className:`h-5 w-36`}),(0,f.jsx)(u,{className:`h-4 w-56`}),(0,f.jsx)(u,{className:`h-4 w-32`})]}),(0,f.jsx)(u,{className:`h-9 w-24 shrink-0`})]})]})]})]});let _=e?.plan===`unlimited-pro`;return(0,f.jsxs)(`div`,{className:`max-w-2xl mx-auto p-6`,children:[(0,f.jsxs)(`div`,{className:`mb-6`,children:[(0,f.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Account`}),(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:`Manage your Tarsk plan and prompt balance.`})]}),(0,f.jsxs)(`div`,{className:`space-y-6`,children:[(0,f.jsxs)(`div`,{className:`flex gap-4`,children:[(0,f.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-2`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-muted-foreground`,children:[(0,f.jsx)(t,{className:`h-4 w-4`}),`Balance`]}),(0,f.jsx)(`div`,{className:`flex items-end gap-2`,children:_?(0,f.jsx)(`span`,{className:`text-3xl font-bold`,children:`Unlimited`}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`span`,{className:`text-3xl font-bold`,children:e?.promptsRemaining.toLocaleString()??0}),(0,f.jsx)(`span`,{className:`text-muted-foreground mb-1 text-sm`,children:`prompts remaining`})]})})]}),(0,f.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-muted-foreground`,children:[(0,f.jsx)(i,{className:`h-4 w-4`}),`Current Plan`]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`text-lg font-semibold`,children:_?`Unlimited Pro`:`Pay as you go`}),_&&(0,f.jsx)(`span`,{className:`rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary`,children:`Active`})]}),(0,f.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,f.jsxs)(`div`,{className:`space-y-3`,children:[(0,f.jsx)(`h2`,{className:`text-sm font-semibold text-muted-foreground uppercase tracking-wide`,children:`Add Prompts`}),(0,f.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,f.jsxs)(`div`,{className:`space-y-1`,children:[(0,f.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,f.jsx)(`span`,{className:`font-semibold`,children:`1,000 Prompts`})}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Top up your balance with 1,000 additional prompts for $5.`})]}),(0,f.jsx)(n,{onClick:h,className:`shrink-0`,children:`Top Up Balance`})]}),(0,f.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,f.jsxs)(`div`,{className:`space-y-1`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(i,{className:`h-4 w-4 text-primary`}),(0,f.jsx)(`span`,{className:`font-semibold`,children:`Unlimited Pro Plan`})]}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Unlimited prompts for $100 and lifetime access to Tarsk.`}),(0,f.jsxs)(`ul`,{className:`text-sm text-muted-foreground space-y-0.5`,children:[(0,f.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,f.jsx)(o,{className:`h-3 w-3 text-primary`}),`Unlimited prompts`]}),(0,f.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,f.jsx)(o,{className:`h-3 w-3 text-primary`}),`Priority access`]})]})]}),(0,f.jsx)(n,{onClick:g,className:`shrink-0`,children:`Purchase`})]})]})]})]})}export{p as default};
1
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Hr as t,Nr as n,Oa as r,aa as i,ft as a,ji as o,sn as s,va as c}from"./dialogs-config-CV8HzCCA.js";import{t as l}from"./use-toast-CGSBJJb0.js";import{t as u}from"./skeleton-DNfHG6mv.js";var d=e(r(),1),f=t();function p(){let[e,t]=(0,d.useState)(null),[r,p]=(0,d.useState)(!0);(0,d.useEffect)(()=>{m();let e=()=>{document.visibilityState===`visible`&&m()};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]);async function m(){p(!0);try{t(await a())}catch(e){l({title:`Error`,description:e instanceof Error?e.message:`Failed to load account info`,variant:`destructive`})}finally{p(!1)}}function h(){s(`https://buy.stripe.com/14AcN6feK0Jjbheb2H3Nm03?client_reference_id=${e?.clientReferenceId??``}`)}function g(){s(`https://buy.stripe.com/9B67sMd6CgIh70Y0o33Nm04?client_reference_id=${e?.clientReferenceId??``}`)}if(r)return(0,f.jsxs)(`div`,{className:`max-w-2xl mx-auto p-6`,children:[(0,f.jsxs)(`div`,{className:`mb-6`,children:[(0,f.jsx)(u,{className:`h-8 w-32 mb-2`}),(0,f.jsx)(u,{className:`h-4 w-64`})]}),(0,f.jsxs)(`div`,{className:`space-y-6`,children:[(0,f.jsxs)(`div`,{className:`flex gap-4`,children:[(0,f.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-2`,children:[(0,f.jsx)(u,{className:`h-4 w-20`}),(0,f.jsx)(u,{className:`h-9 w-28`})]}),(0,f.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-3`,children:[(0,f.jsx)(u,{className:`h-4 w-24`}),(0,f.jsx)(u,{className:`h-6 w-32`}),(0,f.jsx)(u,{className:`h-4 w-full`})]})]}),(0,f.jsxs)(`div`,{className:`space-y-3`,children:[(0,f.jsx)(u,{className:`h-4 w-24`}),(0,f.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,f.jsxs)(`div`,{className:`space-y-1 flex-1`,children:[(0,f.jsx)(u,{className:`h-5 w-28`}),(0,f.jsx)(u,{className:`h-4 w-64`})]}),(0,f.jsx)(u,{className:`h-9 w-28 shrink-0`})]}),(0,f.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,f.jsxs)(`div`,{className:`space-y-1 flex-1`,children:[(0,f.jsx)(u,{className:`h-5 w-36`}),(0,f.jsx)(u,{className:`h-4 w-56`}),(0,f.jsx)(u,{className:`h-4 w-32`})]}),(0,f.jsx)(u,{className:`h-9 w-24 shrink-0`})]})]})]})]});let _=e?.plan===`unlimited-pro`;return(0,f.jsxs)(`div`,{className:`max-w-2xl mx-auto p-6`,children:[(0,f.jsxs)(`div`,{className:`mb-6`,children:[(0,f.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Account`}),(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:`Manage your Tarsk plan and prompt balance.`})]}),(0,f.jsxs)(`div`,{className:`space-y-6`,children:[(0,f.jsxs)(`div`,{className:`flex gap-4`,children:[(0,f.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-2`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-muted-foreground`,children:[(0,f.jsx)(o,{className:`h-4 w-4`}),`Balance`]}),(0,f.jsx)(`div`,{className:`flex items-end gap-2`,children:_?(0,f.jsx)(`span`,{className:`text-3xl font-bold`,children:`Unlimited`}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`span`,{className:`text-3xl font-bold`,children:e?.promptsRemaining.toLocaleString()??0}),(0,f.jsx)(`span`,{className:`text-muted-foreground mb-1 text-sm`,children:`prompts remaining`})]})})]}),(0,f.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-muted-foreground`,children:[(0,f.jsx)(i,{className:`h-4 w-4`}),`Current Plan`]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`text-lg font-semibold`,children:_?`Unlimited Pro`:`Pay as you go`}),_&&(0,f.jsx)(`span`,{className:`rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary`,children:`Active`})]}),(0,f.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,f.jsxs)(`div`,{className:`space-y-3`,children:[(0,f.jsx)(`h2`,{className:`text-sm font-semibold text-muted-foreground uppercase tracking-wide`,children:`Add Prompts`}),(0,f.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,f.jsxs)(`div`,{className:`space-y-1`,children:[(0,f.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,f.jsx)(`span`,{className:`font-semibold`,children:`1,000 Prompts`})}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Top up your balance with 1,000 additional prompts for $5.`})]}),(0,f.jsx)(n,{onClick:h,className:`shrink-0`,children:`Top Up Balance`})]}),(0,f.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,f.jsxs)(`div`,{className:`space-y-1`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(i,{className:`h-4 w-4 text-primary`}),(0,f.jsx)(`span`,{className:`font-semibold`,children:`Unlimited Pro Plan`})]}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Unlimited prompts for $100 and lifetime access to Tarsk.`}),(0,f.jsxs)(`ul`,{className:`text-sm text-muted-foreground space-y-0.5`,children:[(0,f.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,f.jsx)(c,{className:`h-3 w-3 text-primary`}),`Unlimited prompts`]}),(0,f.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,f.jsx)(c,{className:`h-3 w-3 text-primary`}),`Priority access`]})]})]}),(0,f.jsx)(n,{onClick:g,className:`shrink-0`,children:`Purchase`})]})]})]})]})}export{p as default};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Ea as t,Fr as n,Hr as r,Oa as i,Pr as a}from"./dialogs-config-CV8HzCCA.js";import{_t as o,dt as s,ft as c,gt as l,ht as u,mt as d,pt as f,ut as p}from"./react-vendor-DV_DP0Qd.js";var m=t(),h=e(i(),1),g=r(),_=l,v=u,y=h.forwardRef((e,t)=>{let r=(0,m.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=n(`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),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==t||r[7]!==o?(s=(0,g.jsx)(d,{className:o,...a,ref:t}),r[5]=a,r[6]=t,r[7]=o,r[8]=s):s=r[8],s});y.displayName=d.displayName;var b=h.forwardRef((e,t)=>{let r=(0,m.c)(10),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,g.jsx)(y,{}),r[3]=o):o=r[3];let s;r[4]===i?s=r[5]:(s=n(`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),r[4]=i,r[5]=s);let l;return r[6]!==a||r[7]!==t||r[8]!==s?(l=(0,g.jsxs)(v,{children:[o,(0,g.jsx)(c,{ref:t,className:s,...a})]}),r[6]=a,r[7]=t,r[8]=s,r[9]=l):l=r[9],l});b.displayName=c.displayName;var x=e=>{let t=(0,m.c)(8),r,i;t[0]===e?(r=t[1],i=t[2]):({className:r,...i}=e,t[0]=e,t[1]=r,t[2]=i);let a;t[3]===r?a=t[4]:(a=n(`flex flex-col space-y-2 text-center sm:text-left`,r),t[3]=r,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),r,i;t[0]===e?(r=t[1],i=t[2]):({className:r,...i}=e,t[0]=e,t[1]=r,t[2]=i);let a;t[3]===r?a=t[4]:(a=n(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,r),t[3]=r,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 r=(0,m.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let s;r[3]===i?s=r[4]:(s=n(`text-lg font-semibold`,i),r[3]=i,r[4]=s);let c;return r[5]!==a||r[6]!==t||r[7]!==s?(c=(0,g.jsx)(o,{ref:t,className:s,...a}),r[5]=a,r[6]=t,r[7]=s,r[8]=c):c=r[8],c});C.displayName=o.displayName;var w=h.forwardRef((e,t)=>{let r=(0,m.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=n(`text-sm text-muted-foreground`,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==t||r[7]!==o?(s=(0,g.jsx)(f,{ref:t,className:o,...a}),r[5]=a,r[6]=t,r[7]=o,r[8]=s):s=r[8],s});w.displayName=f.displayName;var T=h.forwardRef((e,t)=>{let r=(0,m.c)(9),i,o;r[0]===e?(i=r[1],o=r[2]):({className:i,...o}=e,r[0]=e,r[1]=i,r[2]=o);let s;r[3]===i?s=r[4]:(s=n(a(),i),r[3]=i,r[4]=s);let c;return r[5]!==o||r[6]!==t||r[7]!==s?(c=(0,g.jsx)(p,{ref:t,className:s,...o}),r[5]=o,r[6]=t,r[7]=s,r[8]=c):c=r[8],c});T.displayName=p.displayName;var E=h.forwardRef((e,t)=>{let r=(0,m.c)(9),i,o;r[0]===e?(i=r[1],o=r[2]):({className:i,...o}=e,r[0]=e,r[1]=i,r[2]=o);let c;r[3]===i?c=r[4]:(c=n(a({variant:`outline`}),`mt-2 sm:mt-0`,i),r[3]=i,r[4]=c);let l;return r[5]!==o||r[6]!==t||r[7]!==c?(l=(0,g.jsx)(s,{ref:t,className:c,...o}),r[5]=o,r[6]=t,r[7]=c,r[8]=l):l=r[8],l});E.displayName=s.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};
@@ -0,0 +1 @@
1
+ import{Bn as e,Gn as t,Hn as n,Un as r,Vn as i,Wn as a,zn as o}from"./dialogs-config-CV8HzCCA.js";async function s(t,n){return i(`api/threads/${e(t)}/explorer?path=${encodeURIComponent(n)}`)}async function c(t,n){return i(`api/threads/${e(t)}/ai-file?path=${encodeURIComponent(n)}`)}async function l(n,r,i){return t(`api/threads/${e(n)}/ai-file`,{path:r,content:i})}async function u(t,n){return o(`api/threads/${e(t)}/explorer?path=${encodeURIComponent(n)}`)}async function d(t,n,i){return r(`api/threads/${e(t)}/explorer`,{path:n,newName:i})}async function f(t,n,r){return a(`api/threads/${e(t)}/explorer/file`,{dirPath:n,name:r})}function p(t,r){return`${n()}/api/threads/${e(t)}/explorer/media?path=${encodeURIComponent(r)}`}async function m(t,n,r){return a(`api/threads/${e(t)}/explorer/folder`,{dirPath:n,name:r})}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{Fr as t,Xr as n,_a as r,en as i,qi as a,si as o,ti as s,ya as c,yi as l}from"./dialogs-config-VlhyoYms.js";import{a as u}from"./store-DUqJt-K-.js";import{n as d}from"./tab-context-BYpxvaoz.js";import{t as f}from"./run-stop-button-DYoC8i6e.js";var p=r(),m=e(c(),1),h=t();function g(){let e=(0,p.c)(41),{devServerUrl:t,browserResetTrigger:r}=d(),{state:c}=u(),{selectedProjectId:g,projects:_}=c,v;if(e[0]!==_||e[1]!==g){let t;e[3]===g?t=e[4]:(t=e=>e.projectId===g,e[3]=g,e[4]=t),v=_.find(t),e[0]=_,e[1]=g,e[2]=v}else v=e[2];let y=v,[b,x]=(0,m.useState)(``),[S,C]=(0,m.useState)(``),[w,T]=(0,m.useState)(`desktop`),E=(0,m.useRef)(null),D;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>{C(``),x(``),E.current&&(E.current.src=``)},e[5]=D):D=e[5];let O;e[6]===r?O=e[7]:(O=[r],e[6]=r,e[7]=O),(0,m.useEffect)(D,O);let k,A;e[8]===t?(k=e[9],A=e[10]):(k=()=>{t&&(x(t),C(t))},A=[t],e[8]=t,e[9]=k,e[10]=A),(0,m.useEffect)(k,A);let j;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>{let t=e.trim();t&&(!t.startsWith(`http://`)&&!t.startsWith(`https://`)&&(t=`http://`+t),x(t),C(t))},e[11]=j):j=e[11];let M=j,N;e[12]===b?N=e[13]:(N=e=>{e.key===`Enter`&&M(b)},e[12]=b,e[13]=N);let P=N,F;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>{if(E.current){let e=E.current.src;E.current.src=``,setTimeout(()=>{E.current&&(E.current.src=e)},0)}},e[14]=F):F=e[14];let I=F,L;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(L={desktop:{width:`100%`,height:`100%`},tablet:{width:`768px`,height:`1024px`},mobile:{width:`375px`,height:`667px`}},e[15]=L):L=e[15];let R=L[w],z;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(z=e=>x(e.target.value),e[16]=z):z=e[16];let B;e[17]!==P||e[18]!==b?(B=(0,h.jsx)(`input`,{type:`text`,value:b,onChange:z,onKeyDown:P,placeholder:`Enter URL...`,className:`flex-1 px-4 py-1.5 text-sm bg-muted rounded-full border border-border outline-none focus:ring-1 focus:ring-ring font-mono`,spellCheck:!1}),e[17]=P,e[18]=b,e[19]=B):B=e[19];let V;e[20]===S?V=e[21]:(V=S&&(0,h.jsx)(`button`,{onClick:I,title:`Refresh page`,className:`p-1.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors`,children:(0,h.jsx)(o,{size:15})}),e[20]=S,e[21]=V);let H;e[22]!==w||e[23]!==S?(H=S&&(0,h.jsxs)(`div`,{className:`flex items-center bg-muted rounded-md p-0.5`,children:[(0,h.jsx)(`button`,{onClick:()=>T(`desktop`),title:`Desktop view`,className:`p-1.5 rounded transition-colors ${w===`desktop`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground hover:bg-background/50`}`,children:(0,h.jsx)(l,{size:15})}),(0,h.jsx)(`button`,{onClick:()=>T(`tablet`),title:`Tablet view`,className:`p-1.5 rounded transition-colors ${w===`tablet`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground hover:bg-background/50`}`,children:(0,h.jsx)(n,{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)(s,{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 i(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)(a,{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{Di as t,Ea as n,Hr as r,Oa as i,ci as a,hi as o,na as s,ri as c,sn as l}from"./dialogs-config-CV8HzCCA.js";import{a as u}from"./store-9Wm6Zyve.js";import{n as d}from"./tab-context-BdML89mQ.js";import{t as f}from"./run-stop-button-N1JNjOlD.js";var p=n(),m=e(i(),1),h=r();function g(){let e=(0,p.c)(41),{devServerUrl:n,browserResetTrigger:r}=d(),{state:i}=u(),{selectedProjectId:g,projects:_}=i,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]===r?O=e[7]:(O=[r],e[6]=r,e[7]=O),(0,m.useEffect)(D,O);let k,A;e[8]===n?(k=e[9],A=e[10]):(k=()=>{n&&(x(n),C(n))},A=[n],e[8]=n,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)(t,{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)(c,{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 l(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)(s,{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,22 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/commit-dialog-CfjW1f6P.js","assets/history-view-DDpROJvQ.js","assets/rolldown-runtime-B1FJdls4.js","assets/dialogs-config-CV8HzCCA.js","assets/onboarding-BEy4bi0g.js","assets/textarea-CU-XhvgE.js","assets/pull-request-dialog-DDxX2W8n.js","assets/create-repo-dialog-ByvOv7em.js","assets/git-history-dialog-DKey5IQa.js","assets/push-before-pr-dialog-Cs54Vb76.js","assets/pull-with-changes-dialog-BtXHWQ3k.js","assets/merged-pr-dialog-BfwdsytN.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{$i as t,$n as n,$r as r,$t as i,A as a,Ai as o,An as s,B as c,Bi as l,Cn as u,Ct as d,Ea as f,Ei as p,Fi as m,Fr as h,Gi as g,Gt as _,Hn as v,Hr as y,Ht as b,I as x,Ii as S,It as C,Jt as w,Ki as T,Kr as E,Kt as D,Ln as O,Ni as k,Nr as A,Oa as j,Pi as M,Qi as N,Qn as P,Qr as ee,Qt as F,Ri as I,Rn as L,S as R,Sa as z,Si as te,T as B,Tn as V,Ui as ne,Vt as H,Wi as re,Xt as U,Yi as W,Yn as G,Yt as K,Zn as ie,Zr as ae,Zt as oe,_a as se,_i as ce,_t as q,an as le,b as ue,dn as de,dt as fe,en as pe,er as me,f as J,fa as he,fi as ge,g as _e,gt as ve,ha as ye,ii as be,j as xe,kn as Se,la as Ce,lt as we,m as Te,ma as Ee,mt as De,na as Oe,ni as ke,nr as Ae,oi as je,p as Me,pa as Ne,pi as Pe,pt as Fe,q as Ie,qi as Le,qr as Re,qt as ze,ra as Be,rn as Ve,rr as He,sn as Ue,tn as We,tr as Ge,tt as Ke,ua as qe,ut as Je,v as Ye,va as Xe,vi as Ze,vt as Qe,wa as $e,x as et,xt as tt,ya as nt,z as rt,zi as it}from"./dialogs-config-CV8HzCCA.js";import{$ as at,Ct as ot,G as st,H as ct,J as lt,Q as ut,U as dt,W as ft,X as pt,Y as mt,at as ht,ct as gt,et as _t,it as vt,nt as yt,ot as bt,q as xt,rt as St,st as Ct,tt as wt}from"./react-vendor-DV_DP0Qd.js";import{Pt as Tt}from"./monaco-BGyhgQtx.js";import{a as Et,d as Dt,l as Ot,s as kt,t as Y,u as At}from"./store-9Wm6Zyve.js";import{c as jt,l as Mt,s as Nt,u as Pt}from"./history-view-DDpROJvQ.js";import{n as Ft,t as It}from"./use-toast-CGSBJJb0.js";import{a as Lt,c as Rt,i as zt,o as Bt,s as Vt,t as Ht}from"./alert-dialog-BWqb8ENe.js";import{n as Ut}from"./tab-context-BdML89mQ.js";import{s as Wt}from"./onboarding-BEy4bi0g.js";import{i as Gt,n as Kt,r as qt,t as Jt}from"./whisper-wasm-BCJQtWoU.js";import{n as Yt}from"./utils-Dt4Hs5eF.js";var X=f(),Z=e(j(),1),Q=y();function Xt(e){let t=(0,X.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,Q.jsx)(`div`,{style:{paddingLeft:o},className:s,children:n.children.map(e=>(0,Q.jsx)(Xt,{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,Q.jsxs)(`div`,{className:p,children:[m,h]}),t[26]=p,t[27]=m,t[28]=h,t[29]=g):g=t[29],g}function Zt(e){let t=(0,X.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,Z.useState)(f),[g,_]=(0,Z.useState)(i);i!==g&&(_(i),m({}));let v;t[1]===o?v=t[2]:(v=o?new Set(o):void 0,t[1]=o,t[2]=v);let y=v,b;t[3]===u?b=t[4]:(b=e=>{m(t=>({...t,[e]:!(t[e]??u)}))},t[3]=u,t[4]=b);let x=b,S;t[5]===l?S=t[6]:(S=h(`min-w-0`,l),t[5]=l,t[6]=S);let C;if(t[7]!==c||t[8]!==u||t[9]!==y||t[10]!==x||t[11]!==d||t[12]!==n||t[13]!==p||t[14]!==r){let e;t[16]!==c||t[17]!==u||t[18]!==y||t[19]!==x||t[20]!==d||t[21]!==p||t[22]!==r?(e=e=>(0,Q.jsx)(Xt,{node:e,level:0,renderNode:r,defaultOpen:u,indent:d,childContainerClassName:c,openState:p,onToggle:x,forceOpenIds:y},e.id),t[16]=c,t[17]=u,t[18]=y,t[19]=x,t[20]=d,t[21]=p,t[22]=r,t[23]=e):e=t[23],C=n.map(e),t[7]=c,t[8]=u,t[9]=y,t[10]=x,t[11]=d,t[12]=n,t[13]=p,t[14]=r,t[15]=C}else C=t[15];let w;return t[24]!==S||t[25]!==C?(w=(0,Q.jsx)(`div`,{className:S,children:C}),t[24]=S,t[25]=C,t[26]=w):w=t[26],w}var Qt=Ct,$t=gt,en=Z.forwardRef((e,t)=>{let n=(0,X.c)(13),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({className:r,align:a,sideOffset:o,...i}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let s=a===void 0?`center`:a,c=o===void 0?4:o,l;n[5]===r?l=n[6]:(l=h(`z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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[5]=r,n[6]=l);let u;return n[7]!==s||n[8]!==i||n[9]!==t||n[10]!==c||n[11]!==l?(u=(0,Q.jsx)(bt,{children:(0,Q.jsx)(ht,{ref:t,align:s,sideOffset:c,className:l,...i})}),n[7]=s,n[8]=i,n[9]=t,n[10]=c,n[11]=l,n[12]=u):u=n[12],u});en.displayName=ht.displayName;var tn=(0,Z.createContext)({todos:[],setTodos:()=>{}});function nn(e){let t=(0,X.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,Z.useState)(i),s=(0,Z.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,Z.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,Q.jsx)(tn.Provider,{value:f,children:n}),t[7]=n,t[8]=f,t[9]=p):p=t[9],p}function rn(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 an(e){let t=(0,X.c)(5),{todos:n,sequence:r}=e,{setTodos:i}=(0,Z.useContext)(tn),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,Z.useEffect)(a,o),null}var on=new Map,sn=new Map;function cn(e){return on.get(e)}function ln(e,t){let n=sn.get(e);return n||(n=new Set,sn.set(e,n)),n.add(t),()=>{n.delete(t),n.size===0&&sn.delete(e)}}function un(e){let t=sn.get(e);if(t)for(let e of t)e()}function dn(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 fn(e,t,n){if(on.has(e))return;on.set(e,{status:`running`}),un(e);let r=v();(async()=>{try{let i=dn(r,n),a=Object.getPrototypeOf(async function(){}).constructor,o=await new a(`callTool`,t)(i),s=o===void 0?null:o;on.set(e,{status:`success`,result:s}),un(e),await Se(e,s)}catch(t){let n=t instanceof Error?t.stack||t.message:String(t);on.set(e,{status:`error`,error:n}),un(e);try{await Se(e,{error:n})}catch(e){console.error(`[browser-js-executor] failed to submit error result`,e)}}})()}function pn({initialValue:e}={}){let{state:t,dispatch:n}=Et(),[r,i]=(0,Z.useState)(()=>{let n=t.selectedThreadId;return n&&t.chatInputDrafts[n]?t.chatInputDrafts[n]:e??``}),[a,o]=(0,Z.useState)(-1),[s,c]=(0,Z.useState)(``),[l,u]=(0,Z.useState)(0),d=(0,Z.useRef)(r);(0,Z.useEffect)(()=>{d.current=r},[r]);let f=(0,Z.useRef)(t.chatInputDrafts);(0,Z.useEffect)(()=>{f.current=t.chatInputDrafts},[t.chatInputDrafts]);let p=(0,Z.useRef)(!0);(0,Z.useEffect)(()=>(p.current=!0,()=>{p.current=!1}),[]);let[m,h]=(0,Z.useState)([]),[g,_]=(0,Z.useState)(()=>(t.selectedThreadId?t.projectModelSelections[t.selectedThreadId]:void 0)??null),v=(0,Z.useRef)(g?.id??``),y=(0,Z.useRef)(g?.provider??``),b=(0,Z.useRef)(null),[S,C]=(0,Z.useState)(!1),[w,T]=(0,Z.useState)(!1),[E,D]=(0,Z.useState)([]),[k,A]=(0,Z.useState)(!1),[j,M]=(0,Z.useState)(!1),[N,P]=(0,Z.useState)(!1),[ee,F]=(0,Z.useState)([]),[I,L]=(0,Z.useState)(null),[R,z]=(0,Z.useState)([]),[te,B]=(0,Z.useState)(!1),[V,ne]=(0,Z.useState)(``),[re,U]=(0,Z.useState)(0),[W,G]=(0,Z.useState)([]),[K,ie]=(0,Z.useState)([]),[ae,oe]=(0,Z.useState)(!1),[se,ce]=(0,Z.useState)(``),q=(0,Z.useRef)(null),le=(0,Z.useRef)(null),ue=(0,Z.useRef)(null),de=(0,Z.useRef)(null),fe=(0,Z.useRef)(null),pe=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{v.current=g?.id??``,y.current=g?.provider??``},[g?.id,g?.provider]);let me=(0,Z.useCallback)((e,r)=>{_(e);let i=t.selectedThreadId;if(!i||(n({type:Y.SetProjectModel,threadId:i,model:e}),r?.persist===!1))return;let a=`${i}:${e.provider??``}:${e.id}`;b.current!==a&&(b.current=a,console.log(`[useChatInputState] Persisting model to thread:`,{threadId:i,model:{id:e.id,provider:e.provider}}),O(i,{model:e.id,modelProvider:e.provider}).then(()=>{b.current===a&&(b.current=null),console.log(`[useChatInputState] Model persisted successfully`)}).catch(e=>{b.current===a&&(b.current=null),console.error(`Failed to save model to thread:`,e)}))},[t.selectedThreadId,n]);(0,Z.useEffect)(()=>{(async()=>{let e=t.selectedProjectId?t.projects.find(e=>e.projectId===t.selectedProjectId)?.threads.find(e=>e.threadId===t.selectedThreadId):void 0,n=t.selectedThreadId?t.projectModelSelections[t.selectedThreadId]:void 0,r=e?.model??n?.id??null,i=e?.modelProvider??n?.provider??null;console.log(`[useChatInputState] Loading models for thread:`,{threadId:t.selectedThreadId,projectId:t.selectedProjectId,currentThread:e?{model:e.model,modelProvider:e.modelProvider}:void 0,storedModel:n?{id:n.id,provider:n.provider}:void 0,savedModelId:r,savedModelProvider:i});try{let e=await De(),t=Object.values(e).flat();if(t.length===0){h([]),_(null);return}h(t);let n=r&&i?t.find(e=>e.id===r&&e.provider===i)??null:null,a=t[0],o=n??a,s=!n&&!!(r||i),c=v.current===o.id&&y.current===o.provider;console.log(`[useChatInputState] Model selection decision:`,{matchedSavedModel:n?{id:n.id}:null,fallbackModel:{id:a.id},modelToSelect:{id:o.id},shouldPersistFallback:s,hasSameSelection:c,currentSelected:{id:v.current,provider:y.current}}),c||me(o,{persist:s})}catch(e){console.error(`Failed to load enabled models:`,e)}})()},[t.selectedThreadId,t.selectedProjectId,t.projects,me]);let J=(0,Z.useRef)(me);(0,Z.useEffect)(()=>{J.current=me},[me]),(0,Z.useEffect)(()=>{t.configUpdatedAt!==0&&(async()=>{try{let e=await De(),t=Object.values(e).flat();if(t.length>0){h(t);let e=v.current,n=y.current;t.some(t=>t.id===e&&t.provider===n)||J.current(t[0],{persist:!0})}}catch(e){console.error(`Failed to reload enabled models:`,e)}})()},[t.configUpdatedAt]),(0,Z.useEffect)(()=>{!N||ee.length>0||(async()=>{try{let e=await Fe(),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)}})()},[N,ee.length]);let[he,ge]=(0,Z.useState)(t.selectedThreadId);(0,Z.useEffect)(()=>{if(t.selectedThreadId!==he){he&&d.current.trim()&&f.current[he]!==d.current&&n({type:Y.SetChatInputDraft,threadId:he,draft:d.current});let e=!1;return queueMicrotask(()=>{e||!p.current||(ge(t.selectedThreadId),i(t.selectedThreadId?f.current[t.selectedThreadId]??``:``),z([]),B(!1),G([]),ie([]),oe(!1),A(!1),P(!1),M(!1))}),()=>{e=!0}}},[t.selectedThreadId,he]),(0,Z.useEffect)(()=>{t.selectedThreadId&&H(t.selectedThreadId).then(({commands:e,skills:t})=>{console.log(`Loaded slash commands:`,e,`skills:`,t),G(e),ie(t)}).catch(e=>console.error(`Failed to load slash commands and skills:`,e))},[t.selectedThreadId]);let _e=t.selectedThreadId?t.chatInputDrafts[t.selectedThreadId]??``:``;return(0,Z.useEffect)(()=>{t.selectedThreadId&&i(_e)},[t.selectedThreadId,_e]),(0,Z.useLayoutEffect)(()=>{let e=le.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,160)}px`)},[r]),(0,Z.useEffect)(()=>{t.focusChatInput&&t.selectedThreadId&&!t.isStreaming&&(le.current?.focus(),n({type:Y.ClearFocusChatInput}))},[t.focusChatInput,t.selectedThreadId,t.isStreaming,n]),(0,Z.useEffect)(()=>{let e=t.selectedThreadId;return()=>{e&&d.current.trim()&&f.current[e]!==d.current&&n({type:Y.SetChatInputDraft,threadId:e,draft:d.current})}},[t.selectedThreadId,n]),(0,Z.useEffect)(()=>{let e=e=>{ue.current&&!ue.current.contains(e.target)&&C(!1),de.current&&!de.current.contains(e.target)&&T(!1)};if(S||w)return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[S,w]),{message:r,setMessage:i,historyIndex:a,setHistoryIndex:o,draftMessage:s,setDraftMessage:c,cursorPosition:l,setCursorPosition:u,availableModels:m,setAvailableModels:h,selectedModel:g,setSelectedModel:me,selectedModelIdRef:v,showModelMenu:S,setShowModelMenu:C,showPlusMenu:w,setShowPlusMenu:T,attachments:E,setAttachments:D,planMode:k,setPlanMode:A,ralphMode:j,setRalphMode:M,imageMode:N,setImageMode:P,availableImageModels:ee,setAvailableImageModels:F,selectedImageModel:I,setSelectedImageModel:L,allFiles:R,setAllFiles:z,showSuggestions:te,setShowSuggestions:B,suggestionQuery:V,setSuggestionQuery:ne,selectedIndex:re,setSelectedIndex:U,slashCommands:W,setSlashCommands:G,skills:K,setSkills:ie,showCommandSuggestions:ae,setShowCommandSuggestions:oe,commandQuery:se,setCommandQuery:ce,fileInputRef:q,textareaRef:le,modelMenuRef:ue,plusMenuRef:de,suggestionsRef:fe,commandSuggestionsRef:pe,handleNewChat:async()=>{if(t.selectedThreadId)try{let e=await x(t.selectedThreadId);n({type:Y.ClearMessages}),console.log(`New conversation started:`,e);let r=await ve(t.selectedThreadId);n({type:Y.SetMessages,messages:r.messages})}catch(e){console.error(`Failed to start new chat:`,e)}},state:t,dispatch:n}}var mn=e=>{J(e)};function hn(e){let t=(0,X.c)(104),{message:n,setMessage:r,userTasks:i,onMatchedUserTaskSend:a,attachments:o,selectedModel:s,onSend:c,isStreaming:l,selectedThreadId:u,isListening:d,stopListening:f,resetTranscript:p,dispatch:m,historyIndex:h,setHistoryIndex:g,draftMessage:v,setDraftMessage:y,cursorPosition:b,setCursorPosition:x,showSuggestions:S,setShowSuggestions:C,suggestionQuery:w,setSuggestionQuery:T,allFiles:E,setAllFiles:D,selectedIndex:O,setSelectedIndex:k,showCommandSuggestions:A,setShowCommandSuggestions:j,commandQuery:M,setCommandQuery:N,slashCommands:P,skills:ee,textareaRef:F,setAttachments:I,planMode:L,setPlanMode:R,ralphMode:z,setRalphMode:te,imageMode:B,setImageMode:V,selectedImageModel:ne}=e,H;t[0]!==o||t[1]!==m||t[2]!==B||t[3]!==d||t[4]!==l||t[5]!==n||t[6]!==a||t[7]!==c||t[8]!==L||t[9]!==z||t[10]!==p||t[11]!==ne||t[12]!==s||t[13]!==u||t[14]!==I||t[15]!==y||t[16]!==g||t[17]!==r||t[18]!==f||t[19]!==F||t[20]!==i?(H=()=>{if(!n.trim()&&o.length===0||!u)return;let e=B?ne:s;if(!e)return;d&&(f(),p()),l?m({type:Y.EnqueueChatMessage,message:{id:`queued-${Date.now()}`,threadId:u,message:n,model:e.id,attachments:o,provider:e.provider,planMode:L,imageMode:B,ralphMode:z}}):c(n,e.id,o,e.provider,L,B,z);let t=n,h=i.find(e=>e.content===t);mn(n),r(``),I([]),h&&a?.(h),g(-1),y(``),u&&m({type:Y.ClearChatInputDraft,threadId:u}),F.current&&(F.current.style.height=`auto`)},t[0]=o,t[1]=m,t[2]=B,t[3]=d,t[4]=l,t[5]=n,t[6]=a,t[7]=c,t[8]=L,t[9]=z,t[10]=p,t[11]=ne,t[12]=s,t[13]=u,t[14]=I,t[15]=y,t[16]=g,t[17]=r,t[18]=f,t[19]=F,t[20]=i,t[21]=H):H=t[21];let re=H,U;t[22]!==b||t[23]!==n||t[24]!==r||t[25]!==C||t[26]!==w||t[27]!==F?(U=e=>{let t=n.substring(0,b-w.length-1);r(`${t}${e} ${n.substring(b)}`),C(!1),setTimeout(()=>{if(F.current){F.current.focus();let n=t.length+e.length+1;F.current.setSelectionRange(n,n)}},0)},t[22]=b,t[23]=n,t[24]=r,t[25]=C,t[26]=w,t[27]=F,t[28]=U):U=t[28];let W=U,G;t[29]!==M||t[30]!==b||t[31]!==n||t[32]!==V||t[33]!==r||t[34]!==R||t[35]!==te||t[36]!==j||t[37]!==F?(G=e=>{let t=n.substring(0,b-M.length-1),i=n.substring(b);r(`${t}${e.content}${i}`),j(!1),setTimeout(()=>{if(F.current){F.current.focus();let n=t.length+e.content.length;F.current.setSelectionRange(n,n)}},0),e.metadata.mode===`plan`?(R(!0),te(!1),V(!1)):e.metadata.mode===`ralph`&&(te(!0),R(!1),V(!1))},t[29]=M,t[30]=b,t[31]=n,t[32]=V,t[33]=r,t[34]=R,t[35]=te,t[36]=j,t[37]=F,t[38]=G):G=t[38];let K=G,ie;t[39]!==M||t[40]!==b||t[41]!==n||t[42]!==r||t[43]!==j||t[44]!==F?(ie=e=>{let t=n.substring(0,b-M.length-1),i=n.substring(b),a=e.name.includes(` `)?`/"${e.name}"`:`/${e.name}`;r(`${t}${a}${i}`),j(!1),setTimeout(()=>{if(F.current){F.current.focus();let e=t.length+a.length;F.current.setSelectionRange(e,e)}},0)},t[39]=M,t[40]=b,t[41]=n,t[42]=r,t[43]=j,t[44]=F,t[45]=ie):ie=t[45];let ae=ie,oe,se,ce,q;if(t[46]!==E||t[47]!==M||t[48]!==v||t[49]!==re||t[50]!==h||t[51]!==K||t[52]!==W||t[53]!==ae||t[54]!==n||t[55]!==O||t[56]!==u||t[57]!==D||t[58]!==N||t[59]!==x||t[60]!==y||t[61]!==g||t[62]!==r||t[63]!==k||t[64]!==j||t[65]!==C||t[66]!==T||t[67]!==A||t[68]!==S||t[69]!==ee||t[70]!==P||t[71]!==w){ce=e=>{if(A){if(e.key===`ArrowDown`){e.preventDefault(),k((O+1)%oe.length);return}if(e.key===`ArrowUp`){e.preventDefault(),k((O-1+oe.length)%oe.length);return}if(e.key===`Enter`||e.key===`Tab`){e.preventDefault();let t=oe[O];t&&(t.type===`command`?K(t.data):ae(t.data));return}if(e.key===`Escape`){j(!1);return}}if(S){let t=se.length>0;if(e.key===`ArrowDown`&&t){e.preventDefault(),k((O+1)%se.length);return}if(e.key===`ArrowUp`&&t){e.preventDefault(),k((O-1+se.length)%se.length);return}if(e.key===`Enter`||e.key===`Tab`){e.preventDefault(),se[O]&&W(se[O]);return}if(e.key===`Escape`){C(!1);return}}if(e.key===`Enter`&&!e.shiftKey){e.preventDefault(),re();return}let t=_e();t.length!==0&&(e.key===`ArrowUp`?(e.preventDefault(),h===-1?(y(n),g(t.length-1),r(t[t.length-1])):h>0&&(g(h-1),r(t[h-1]))):e.key===`ArrowDown`&&(e.preventDefault(),h>0?(g(h-1),r(t[h-1])):h===0&&(g(-1),r(v))))};let e;t[76]!==E||t[77]!==u||t[78]!==D||t[79]!==N||t[80]!==x||t[81]!==r||t[82]!==k||t[83]!==j||t[84]!==C||t[85]!==T?(e=e=>{let t=e.target.value,n=e.target.selectionStart;r(t),x(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(` `)?j(!1):(N(e),j(!0),C(!1),k(0))}else j(!1)}else{j(!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(` `)?C(!1):(T(t),C(!0),k(0),E.length===0&&u&&_(u).then(e=>{D(e)}).catch(vn))}else C(!1)}else C(!1)}let o=e.target;o.style.height=`auto`,o.style.height=`${Math.min(o.scrollHeight,160)}px`},t[76]=E,t[77]=u,t[78]=D,t[79]=N,t[80]=x,t[81]=r,t[82]=k,t[83]=j,t[84]=C,t[85]=T,t[86]=e):e=t[86],q=e;let i;if(t[87]!==M||t[88]!==ee||t[89]!==P){let e;t[91]===M?e=t[92]:(e=e=>e.name.toLowerCase().includes(M.toLowerCase()),t[91]=M,t[92]=e);let n=P.filter(e),r;t[93]===M?r=t[94]:(r=e=>e.name.toLowerCase().includes(M.toLowerCase()),t[93]=M,t[94]=r);let a=ee.filter(r);i=[...n.map(_n),...a.map(gn)],t[87]=M,t[88]=ee,t[89]=P,t[90]=i}else i=t[90];oe=i.slice(0,10),se=S?E.filter(e=>e.toLowerCase().includes(w.toLowerCase())).slice(0,10):[],t[46]=E,t[47]=M,t[48]=v,t[49]=re,t[50]=h,t[51]=K,t[52]=W,t[53]=ae,t[54]=n,t[55]=O,t[56]=u,t[57]=D,t[58]=N,t[59]=x,t[60]=y,t[61]=g,t[62]=r,t[63]=k,t[64]=j,t[65]=C,t[66]=T,t[67]=A,t[68]=S,t[69]=ee,t[70]=P,t[71]=w,t[72]=oe,t[73]=se,t[74]=ce,t[75]=q}else oe=t[72],se=t[73],ce=t[74],q=t[75];let le;return t[95]!==oe||t[96]!==se||t[97]!==ce||t[98]!==re||t[99]!==q||t[100]!==K||t[101]!==W||t[102]!==ae?(le={handleSend:re,handleKeyDown:ce,handleTextareaInput:q,insertFileReference:W,insertCommand:K,insertSkill:ae,allSuggestions:oe,fileSuggestions:se},t[95]=oe,t[96]=se,t[97]=ce,t[98]=re,t[99]=q,t[100]=K,t[101]=W,t[102]=ae,t[103]=le):le=t[103],le}function gn(e){return{type:`skill`,data:e}}function _n(e){return{type:`command`,data:e}}function vn(e){return console.error(`Failed to fetch files:`,e)}function yn(e){let t=(0,X.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 d;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);d=[...n.map(xn),...s.map(bn)].slice(0,10),t[0]=r,t[1]=a,t[2]=i,t[3]=d}else d=t[3];let f=d,p;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(ke,{className:`h-3 w-3`}),t[8]=p):p=t[8];let m=a&&` matching "${a}"`,g;t[9]===m?g=t[10]:(g=(0,Q.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:[p,`Commands & Skills`,m]}),t[9]=m,t[10]=g);let _;t[11]!==f||t[12]!==l||t[13]!==s||t[14]!==c||t[15]!==o?(_=f.length>0?f.map((e,t)=>{let n=t===o;if(e.type===`command`){let r=e.data;return(0,Q.jsxs)(`button`,{type:`button`,className:h(`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,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(ke,{className:`h-3 w-3 text-muted-foreground`}),(0,Q.jsxs)(`span`,{className:`font-medium`,children:[`/`,r.name]}),r.metadata.argumentHint&&(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:r.metadata.argumentHint}),r.scope===`project`&&(0,Q.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,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:r.metadata.description})]},`cmd-${r.name}`)}else{let r=e.data;return(0,Q.jsxs)(`button`,{type:`button`,className:h(`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,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(E,{className:`h-3 w-3 text-amber-500`}),(0,Q.jsxs)(`span`,{className:`font-medium`,children:[`/`,r.name]}),(0,Q.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,Q.jsx)(`span`,{className:`text-[10px] rounded-full bg-primary/10 px-1.5 py-0.5 text-primary`,children:`project`})]}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:r.description})]},`skill-${r.name}`)}}):(0,Q.jsxs)(`div`,{className:`px-3 py-4 text-center text-xs text-muted-foreground`,children:[`No commands or skills found.`,(0,Q.jsx)(`br`,{}),(0,Q.jsxs)(`span`,{className:`text-[10px]`,children:[`Create commands in `,(0,Q.jsx)(`code`,{className:`bg-muted px-1 rounded`,children:`.agents/commands/`}),` or skills in `,(0,Q.jsx)(`code`,{className:`bg-muted px-1 rounded`,children:`.agents/skills/`})]})]}),t[11]=f,t[12]=l,t[13]=s,t[14]=c,t[15]=o,t[16]=_):_=t[16];let v;return t[17]!==u||t[18]!==g||t[19]!==_?(v=(0,Q.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:[g,_]}),t[17]=u,t[18]=g,t[19]=_,t[20]=v):v=t[20],v}function bn(e){return{type:`skill`,data:e}}function xn(e){return{type:`command`,data:e}}function Sn(e){return e.startsWith(`image/`)}function Cn(e){let t=(0,X.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,Q.jsx)(`div`,{className:`group relative flex items-center gap-1 rounded-md bg-muted text-xs text-muted-foreground`,children:Sn(e.mimeType)?(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(`img`,{src:`data:${e.mimeType};base64,${e.content}`,alt:e.fileName,className:`h-16 w-16 rounded-md object-cover`}),(0,Q.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,Q.jsx)(Re,{className:`h-2.5 w-2.5`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Remove attachment`})]})]}):(0,Q.jsxs)(`span`,{className:`flex items-center gap-1 px-2 py-1`,children:[(0,Q.jsx)(te,{className:`h-3 w-3`}),e.fileName,(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>r(t),className:`ml-1 hover:text-foreground`,children:[(0,Q.jsx)(Re,{className:`h-3 w-3`}),(0,Q.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,Q.jsx)(`div`,{className:`mb-2 flex flex-wrap gap-1.5`,children:i}),t[5]=i,t[6]=a),a}function wn(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 Tn(e){let n=(0,X.c)(16),{showSuggestions:r,fileSuggestions:i,suggestionQuery:a,selectedIndex:o,onSelectFile:s,onMouseEnterSuggestion:c,containerRef:l}=e;if(!r||i.length===0)return null;let u;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(Pe,{className:`h-3 w-3`}),n[0]=u):u=n[0];let d;n[1]===a?d=n[2]:(d=(0,Q.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:[u,`Files matching "`,a,`"`]}),n[1]=a,n[2]=d);let f;if(n[3]!==i||n[4]!==c||n[5]!==s||n[6]!==o){let e;n[8]!==c||n[9]!==s||n[10]!==o?(e=(e,n)=>{let r=e.split(`/`).pop()??e;return(0,Q.jsxs)(`button`,{type:`button`,className:h(`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm text-left transition-colors`,n===o?`bg-accent text-accent-foreground`:`text-popover-foreground hover:bg-accent/50`),onClick:()=>s(e),onMouseEnter:()=>c(n),children:[e.endsWith(`.ts`)||e.endsWith(`.tsx`)||e.endsWith(`.js`)||e.endsWith(`.jsx`)?(0,Q.jsx)(t,{className:`h-4 w-4 text-blue-500`}):(0,Q.jsx)(N,{className:`h-4 w-4 text-muted-foreground`}),(0,Q.jsxs)(`div`,{className:`flex flex-col overflow-hidden`,children:[(0,Q.jsx)(`span`,{className:`truncate font-medium`,children:r}),(0,Q.jsx)(`span`,{className:`truncate text-[10px] text-muted-foreground opacity-70`,children:e})]})]},e)},n[8]=c,n[9]=s,n[10]=o,n[11]=e):e=n[11],f=i.map(e),n[3]=i,n[4]=c,n[5]=s,n[6]=o,n[7]=f}else f=n[7];let p;return n[12]!==l||n[13]!==d||n[14]!==f?(p=(0,Q.jsxs)(`div`,{ref:l,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:[d,f]}),n[12]=l,n[13]=d,n[14]=f,n[15]=p):p=n[15],p}function En(e){let t=(0,X.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,Q.jsx)(`img`,{src:r,alt:i,className:`h-3.5 w-3.5 flex-shrink-0 dark:invert`,onError:Dn}),t[0]=r,t[1]=i,t[2]=a):a=t[2],a}function Dn(e){e.currentTarget.style.visibility=`hidden`}function On(e){let t=(0,X.c)(26),{availableModels:n,selectedModel:r,onModelSelect:i}=e,[a,o]=Z.useState(!1),s=Z.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),Z.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,Q.jsx)(En,{provider:p}),t[7]=p,t[8]=m);let h;t[9]===r?h=t[10]:(h=r?Wt(r.id):`No model`,t[9]=r,t[10]=h);let g;t[11]===h?g=t[12]:(g=(0,Q.jsx)(`span`,{className:`text-base font-medium`,children:h}),t[11]=h,t[12]=g);let _;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(Ee,{className:`h-3 w-3`}),t[13]=_):_=t[13];let v;t[14]!==f||t[15]!==m||t[16]!==g?(v=(0,Q.jsxs)(A,{variant:`action`,size:`icon-sm`,className:`gap-1 w-auto px-2`,onClick:f,children:[m,g,_]}),t[14]=f,t[15]=m,t[16]=g,t[17]=v):v=t[17];let y;t[18]!==n||t[19]!==d||t[20]!==r?.id||t[21]!==a?(y=a&&(0,Q.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(kn,{})).map(e=>{let[t,n]=e;return(0,Q.jsxs)(`div`,{children:[(0,Q.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,Q.jsx)(En,{provider:t}),t]}),n.map(e=>(0,Q.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:Wt(e.id)},e.id))]},t)})}),t[18]=n,t[19]=d,t[20]=r?.id,t[21]=a,t[22]=y):y=t[22];let b;return t[23]!==v||t[24]!==y?(b=(0,Q.jsxs)(`div`,{className:`relative`,ref:s,children:[v,y]}),t[23]=v,t[24]=y,t[25]=b):b=t[25],b}function kn(e,t){let n=t.provider??`Other`;return e[n]||(e[n]=[]),e[n].push(t),e}var An=[{value:`build`,label:`Build`,icon:l},{value:`plan`,label:`Plan`,icon:S},{value:`image`,label:`Image`,icon:I},{value:`ralph`,label:`Ralph`,icon:ce}];function jn(e,t,n){return n?`ralph`:e?`plan`:t?`image`:`build`}function Mn(e){let t=(0,X.c)(31),{planMode:n,imageMode:r,ralphMode:i,setPlanMode:a,setImageMode:o,setRalphMode:s}=e,[c,l]=Z.useState(!1),u=Z.useRef(null),d;t[0]!==r||t[1]!==n||t[2]!==i?(d=jn(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=An.find(e=>e.value===f),t[4]=f,t[5]=p);let m=p,h=m.icon,g,_;t[6]===c?(g=t[7],_=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)}},_=[c],t[6]=c,t[7]=g,t[8]=_),Z.useEffect(g,_);let v;t[9]!==o||t[10]!==a||t[11]!==s?(v=function(e){a(e===`plan`),o(e===`image`),s(e===`ralph`),l(!1)},t[9]=o,t[10]=a,t[11]=s,t[12]=v):v=t[12];let y=v,b;t[13]===c?b=t[14]:(b=()=>l(!c),t[13]=c,t[14]=b);let x;t[15]===h?x=t[16]:(x=(0,Q.jsx)(h,{className:`h-3.5 w-3.5`}),t[15]=h,t[16]=x);let S;t[17]===m.label?S=t[18]:(S=(0,Q.jsx)(`span`,{className:`text-base font-medium`,children:m.label}),t[17]=m.label,t[18]=S);let C;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(Ee,{className:`h-3 w-3`}),t[19]=C):C=t[19];let w;t[20]!==b||t[21]!==x||t[22]!==S?(w=(0,Q.jsxs)(A,{variant:`action`,size:`icon-sm`,className:`gap-1 w-auto px-2`,onClick:b,children:[x,S,C]}),t[20]=b,t[21]=x,t[22]=S,t[23]=w):w=t[23];let T;t[24]!==f||t[25]!==c||t[26]!==y?(T=c&&(0,Q.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:An.map(e=>{let t=e.icon,n=e.value===f;return(0,Q.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:()=>y(e.value),children:[(0,Q.jsx)(t,{className:`h-3.5 w-3.5`}),e.label,n&&(0,Q.jsx)(Xe,{className:`ml-auto h-3.5 w-3.5`})]},e.value)})}),t[24]=f,t[25]=c,t[26]=y,t[27]=T):T=t[27];let E;return t[28]!==w||t[29]!==T?(E=(0,Q.jsxs)(`div`,{className:`relative`,ref:u,children:[w,T]}),t[28]=w,t[29]=T,t[30]=E):E=t[30],E}var Nn=at,Pn=vt,Fn=wt,In=Z.forwardRef((e,t)=>{let n=(0,X.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=h(`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,Q.jsx)(ye,{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,Q.jsxs)(St,{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});In.displayName=St.displayName;var Ln=Z.forwardRef((e,t)=>{let n=(0,X.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=h(`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,Q.jsx)(yt,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Ln.displayName=yt.displayName;var Rn=Z.forwardRef((e,t)=>{let n=(0,X.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=h(`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,Q.jsx)(pt,{children:(0,Q.jsx)(st,{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});Rn.displayName=st.displayName;var zn=Z.forwardRef((e,t)=>{let n=(0,X.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=h(`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,Q.jsx)(xt,{ref:t,className:s,...a}),n[7]=a,n[8]=t,n[9]=s,n[10]=c):c=n[10],c});zn.displayName=xt.displayName;var Bn=Z.forwardRef((e,t)=>{let n=(0,X.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=h(`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,Q.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,Q.jsx)(lt,{children:(0,Q.jsx)(Xe,{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,Q.jsxs)(ft,{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});Bn.displayName=ft.displayName;var Vn=Z.forwardRef((e,t)=>{let n=(0,X.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=h(`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,Q.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,Q.jsx)(lt,{children:(0,Q.jsx)(qe,{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,Q.jsxs)(ut,{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});Vn.displayName=ut.displayName;var Hn=Z.forwardRef((e,t)=>{let n=(0,X.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=h(`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,Q.jsx)(mt,{ref:t,className:s,...a}),n[7]=a,n[8]=t,n[9]=s,n[10]=c):c=n[10],c});Hn.displayName=mt.displayName;var Un=Z.forwardRef((e,t)=>{let n=(0,X.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=h(`-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,Q.jsx)(_t,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Un.displayName=_t.displayName;var Wn=e=>{let t=(0,X.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=h(`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,Q.jsx)(`span`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};Wn.displayName=`DropdownMenuShortcut`;function Gn(e){let t=(0,X.c)(19),{disabled:n,canAddTask:r,onFileAttach:i,onAddTask:a}=e,o=n===void 0?!1:n,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=function(e){e()},t[0]=s):s=t[0];let c=s,l,u;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(Ze,{}),u=(0,Q.jsx)(`span`,{className:`sr-only`,children:`More options`}),t[1]=l,t[2]=u):(l=t[1],u=t[2]);let d;t[3]===o?d=t[4]:(d=(0,Q.jsx)(Pn,{asChild:!0,children:(0,Q.jsxs)(A,{variant:`action`,size:`icon-sm`,disabled:o,children:[l,u]})}),t[3]=o,t[4]=d);let f;t[5]===i?f=t[6]:(f=()=>c(i),t[5]=i,t[6]=f);let p;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(te,{className:`mr-2 h-3.5 w-3.5`}),t[7]=p):p=t[7];let h;t[8]===f?h=t[9]:(h=(0,Q.jsxs)(zn,{onClick:f,children:[p,`Attach File`]}),t[8]=f,t[9]=h);let g;t[10]!==r||t[11]!==a?(g=r&&(0,Q.jsxs)(zn,{onClick:()=>c(a),children:[(0,Q.jsx)(m,{className:`mr-2 h-3.5 w-3.5`}),`Add to Pending Tasks`]}),t[10]=r,t[11]=a,t[12]=g):g=t[12];let _;t[13]!==h||t[14]!==g?(_=(0,Q.jsxs)(Rn,{align:`start`,side:`top`,className:`w-56`,children:[h,g]}),t[13]=h,t[14]=g,t[15]=_):_=t[15];let v;return t[16]!==_||t[17]!==d?(v=(0,Q.jsxs)(Nn,{children:[d,_]}),t[16]=_,t[17]=d,t[18]=v):v=t[18],v}var $=Gt(`useWhisperSpeech`),Kn=150;function qn(e){let t=new URLSearchParams;return t.set(`model`,e),`/api/voice-model/download?${t.toString()}`}function Jn(){if(typeof SharedArrayBuffer>`u`)return 1;let e=navigator.hardwareConcurrency;return!e||e<=2?1:e<=4?2:Math.min(4,e-2)}function Yn(){return typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now()}function Xn(){let[e,t]=(0,Z.useState)(`idle`),[n,r]=(0,Z.useState)(null),[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(null),[c,l]=(0,Z.useState)(``),[u,d]=(0,Z.useState)(null),[f,p]=(0,Z.useState)(0),[m,h]=(0,Z.useState)(()=>ue()),g=(0,Z.useRef)(null),_=(0,Z.useRef)(null),v=(0,Z.useRef)(null),y=(0,Z.useRef)(null),b=(0,Z.useRef)(null),x=(0,Z.useRef)(!1),S=(0,Z.useRef)(null),C=(0,Z.useRef)(null),w=(0,Z.useRef)(!1),T=(0,Z.useCallback)(e=>{w.current=e,a(e)},[]);(0,Z.useEffect)(()=>{if(typeof window>`u`)return;function e(e){e.key===`tarsk.general.voiceModel`&&h(ue())}function t(){h(ue())}return window.addEventListener(`storage`,e),window.addEventListener(`tarsk:voice-model-changed`,t),()=>{window.removeEventListener(`storage`,e),window.removeEventListener(`tarsk:voice-model-changed`,t)}},[]),(0,Z.useEffect)(()=>{g.current=null,_.current=null,C.current=null,T(!1),p(0),d(null),t(`idle`)},[m,T]),(0,Z.useEffect)(()=>()=>{S.current!==null&&window.clearTimeout(S.current),v.current&&v.current.getTracks().forEach(e=>e.stop())},[]);let E=(0,Z.useCallback)(async()=>{if(e===`ready`||e===`needs-model`||e===`error`)return e;if(C.current)return C.current;let n=qn(m);async function i(){t(`checking-support`),T(!1),p(0),d(null),$.separator(`VOICE SESSION START`),$.info(`Checking WASM support`,{userAgent:navigator.userAgent,platform:navigator.platform,model:m,url:n});try{let e=new qt;g.current=e;let i=await e.checkWasmSupport();if($.info(`WASM SIMD support check result`,{supported:i}),r(i),!i)return $.error(`WASM SIMD not supported — voice input disabled`),t(`error`),d(`WebAssembly SIMD is not supported in this environment.`),`error`;let a=new Kt;_.current=a,$.info(`Checking IndexedDB model cache`,{url:n});try{let r=await a.loadModelByUrl(n);return $.info(`Cached model found — initializing WASM`,{sizeBytes:r.byteLength,sizeMB:(r.byteLength/1024/1024).toFixed(2),model:m}),T(!0),t(`initializing`),await e.initModel(r),$.info(`WASM model initialized from cache — ready`),t(`ready`),`ready`}catch(e){return $.info(`Model not in cache — download required`,{reason:e instanceof Error?e.message:String(e),model:m}),t(`needs-model`),`needs-model`}}catch(e){let n=e instanceof Error?e.message:`Unknown error`;return $.error(`Failed to check speech recognition support`,{error:n}),t(`error`),d(`Failed to check speech recognition support: ${n}`),`error`}}let a=i();C.current=a;try{return await a}finally{C.current=null}},[e,m,T]),D=(0,Z.useCallback)(async()=>{if(!g.current||!_.current)return;let e=qn(m);t(`downloading-model`),p(0),d(null),$.info(`Model download requested`,{url:e,model:m});try{let n=await _.current.loadModelByUrl(e,e=>{p(e),e%10==0&&$.debug(`Model download progress`,{progress:e,model:m})});$.info(`Model download complete — initializing WASM`,{sizeBytes:n.byteLength,sizeMB:(n.byteLength/1024/1024).toFixed(2),model:m}),t(`initializing`),await g.current.initModel(n),$.info(`WASM model initialized after download — ready`),T(!0),t(`ready`)}catch(e){let n=e instanceof Error?e.message:`An unknown error occurred.`;$.error(`Model download or initialization failed`,{error:n,model:m}),t(`needs-model`),d(n)}},[m,T]),O=(0,Z.useCallback)(async()=>{if(!(!g.current||!w.current)){if(x.current=!1,t(`requesting-mic`),d(null),l(``),$.separator(`RECORDING START`),$.info(`Requesting microphone access`),!navigator.mediaDevices?.getUserMedia){$.error(`navigator.mediaDevices.getUserMedia not available in this environment`),t(`ready`),s(!1),d(`Microphone is not available in this environment.`);return}try{let e=Yn(),n=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,autoGainControl:!0,noiseSuppression:!0}}),r=n.getAudioTracks();$.info(`Microphone access granted`,{durationMs:Math.round(Yn()-e),trackCount:r.length,tracks:r.map(e=>({label:e.label,readyState:e.readyState,settings:e.getSettings()}))}),v.current=n,s(!0);let i=new AbortController;y.current=i,t(`recording`),$.info(`Recording started`),b.current=Jt(n,{signal:i.signal,recordingDurationMs:12e4,logLevel:0},{onError:e=>{$.error(`Audio conversion error during recording`,{error:e instanceof Error?e.message:String(e)})}})}catch(e){if(t(`ready`),e instanceof DOMException&&e.name===`NotAllowedError`)$.error(`Microphone access denied (NotAllowedError)`),s(!1),d(`Microphone access was denied. Please allow microphone access to use voice input.`);else if(e instanceof DOMException&&e.name===`NotFoundError`)$.error(`No microphone found (NotFoundError)`),s(!1),d(`No microphone was found. Please connect a microphone to use voice input.`);else{let t=e instanceof Error?e.message:`Unknown error`;$.error(`Microphone error`,{error:t,type:e instanceof DOMException?e.name:typeof e}),d(`Microphone error: ${t}`)}}}},[]),k=(0,Z.useCallback)(async()=>{if(!b.current){$.info(`stopListening called but no active recording`),v.current&&=(v.current.getTracks().forEach(e=>e.stop()),null),w.current&&t(`ready`);return}$.info(`Stopping recording — waiting for audio data`);let e=Yn();y.current?.abort(),t(`transcribing`);try{let n=Yn(),r=await b.current;if(x.current){$.info(`Transcription cancelled by user`),t(`ready`);return}let i=(r.audioData.length/16e3).toFixed(2),a=Math.round(Yn()-n);$.info(`Audio capture complete — starting transcription`,{sampleCount:r.audioData.length,durationSec:i,sampleRate:16e3,conversionDurationMs:a,stopToConversionReadyMs:Math.round(Yn()-e)}),v.current&&=(v.current.getTracks().forEach(e=>e.stop()),null);let o=Yn(),s=Jn(),c=g.current.createSession(),u=``,d=``,f=null;function p(e=!1){if(!d)return;let t=d.trim();if(e){S.current!==null&&(window.clearTimeout(S.current),S.current=null),d=``,l(t);return}S.current===null&&(S.current=window.setTimeout(()=>{S.current=null;let e=d.trim();d=``,e&&l(e)},Kn))}let m=c.streaming(r.audioData,{language:`en`,threads:s,translate:!1}),h=``,_=0;for await(let e of m){if(x.current)break;_++,f===null&&(f=Math.round(Yn()-o)),u+=e.text.trim()+` `,h=u,d=h,$.debug(`Transcription segment received`,{index:_,text:e.text,timeStart:e.timeStart,timeEnd:e.timeEnd}),p()}p(!0),$.info(`Transcription complete`,{segmentCount:_,durationMs:Math.round(Yn()-o),timeToFirstSegmentMs:f,threadCount:s,totalStopToReadyMs:Math.round(Yn()-e),textLength:h.trim().length,text:h.trim().slice(0,100)}),t(`ready`)}catch(e){if(x.current){t(`ready`);return}let n=e instanceof Error?e.message:`Unknown transcription error`;if($.error(`Transcription failed`,{error:n,errorType:e instanceof Error?e.constructor.name:typeof e,stack:e instanceof Error?e.stack?.split(`
3
+ `).slice(0,5).join(` | `):void 0}),g.current&&n.includes(`Aborted`)){$.info(`WASM aborted — reinitializing model for next attempt`),t(`initializing`);try{await g.current.restartModel(),$.info(`WASM reinitialized successfully`)}catch(e){$.error(`WASM reinitialization failed`,{error:e instanceof Error?e.message:String(e)})}}t(`ready`),d(`Transcription failed: ${n}`)}finally{S.current!==null&&(window.clearTimeout(S.current),S.current=null),b.current=null,y.current=null}},[]),A=(0,Z.useCallback)(()=>{l(``),d(null)},[]);return{state:e,isSupported:n===!0,isWasmSupported:n,isModelLoaded:i,isMicrophoneAvailable:o,transcript:c,error:u,downloadProgress:f,startListening:O,stopListening:k,requestModelDownload:D,ensureReady:E,resetTranscript:A}}var Zn=Z.forwardRef((e,t)=>{let n=(0,X.c)(13),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:r,value:a,...i}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]===r?o=n[5]:(o=h(`relative h-4 w-full overflow-hidden rounded-full bg-secondary`,r),n[4]=r,n[5]=o);let s=`translateX(-${100-(a||0)}%)`,c;n[6]===s?c=n[7]:(c=(0,Q.jsx)(ct,{className:`h-full w-full flex-1 bg-primary transition-all`,style:{transform:s}}),n[6]=s,n[7]=c);let l;return n[8]!==i||n[9]!==t||n[10]!==o||n[11]!==c?(l=(0,Q.jsx)(dt,{ref:t,className:o,...i,children:c}),n[8]=i,n[9]=t,n[10]=o,n[11]=c,n[12]=l):l=n[12],l});Zn.displayName=dt.displayName;var Qn=75;function $n(e){let t=(0,X.c)(11),{open:r,onOpenChange:i,onConfirm:a,downloading:o,progress:s,error:c}=e,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsxs)(Ae,{children:[(0,Q.jsx)(He,{children:`Download Voice Model`}),(0,Q.jsxs)(me,{children:[`To enable voice-to-text, a voice model needs to be downloaded. This is a one-time download of approximately `,Qn,`MB. The model will be cached locally for future use.`]})]}),t[0]=l):l=t[0];let u;t[1]!==o||t[2]!==c||t[3]!==a||t[4]!==i||t[5]!==s?(u=(0,Q.jsxs)(n,{children:[l,o?(0,Q.jsxs)(`div`,{className:`space-y-3 py-4`,children:[(0,Q.jsx)(Zn,{value:s,className:`w-full`}),(0,Q.jsx)(`p`,{className:`text-center text-sm text-muted-foreground`,children:s<100?`Downloading model... ${s}%`:`Initializing model...`})]}):c?(0,Q.jsxs)(`div`,{className:`space-y-4 py-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3 rounded-md bg-destructive/10 p-3 text-sm text-destructive`,children:[(0,Q.jsx)(Ne,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,Q.jsx)(`p`,{children:c})]}),(0,Q.jsxs)(Ge,{children:[(0,Q.jsx)(A,{variant:`outline`,onClick:()=>i(!1),children:`Cancel`}),(0,Q.jsx)(A,{onClick:a,children:`Try Again`})]})]}):(0,Q.jsxs)(Ge,{children:[(0,Q.jsx)(A,{variant:`outline`,onClick:()=>i(!1),children:`Cancel`}),(0,Q.jsx)(A,{onClick:a,children:`Download Model`})]})]}),t[1]=o,t[2]=c,t[3]=a,t[4]=i,t[5]=s,t[6]=u):u=t[6];let d;return t[7]!==i||t[8]!==r||t[9]!==u?(d=(0,Q.jsx)(P,{open:r,onOpenChange:i,children:u}),t[7]=i,t[8]=r,t[9]=u,t[10]=d):d=t[10],d}function er(e){let t=(0,X.c)(67),{onTranscript:n,children:r}=e,{state:i,isWasmSupported:a,transcript:s,error:c,downloadProgress:l,startListening:u,stopListening:d,requestModelDownload:f,ensureReady:p,resetTranscript:m}=Xn(),{toast:h}=Ft(),[g,_]=(0,Z.useState)(!1),v=(0,Z.useRef)(``),y=(0,Z.useRef)(null),b=i===`recording`,x=i===`transcribing`,S=b||x,C=i===`needs-model`,w=i===`downloading-model`||i===`initializing`,T=i===`checking-support`,E,D;t[0]!==g||t[1]!==c||t[2]!==h?(E=()=>{c&&c!==y.current&&!g&&h({title:`Voice Input Error`,description:c,variant:`destructive`}),y.current=c},D=[c,g,h],t[0]=g,t[1]=c,t[2]=h,t[3]=E,t[4]=D):(E=t[3],D=t[4]),(0,Z.useEffect)(E,D);let O,A;t[5]!==n||t[6]!==s?(O=()=>{if(s&&s!==v.current){let e=s.substring(v.current.length);v.current=s,n(e)}},A=[s,n],t[5]=n,t[6]=s,t[7]=O,t[8]=A):(O=t[7],A=t[8]),(0,Z.useEffect)(O,A);let j,M;t[9]===s?(j=t[10],M=t[11]):(j=()=>{s||(v.current=``)},M=[s],t[9]=s,t[10]=j,t[11]=M),(0,Z.useEffect)(j,M);let N;t[12]!==p||t[13]!==S||t[14]!==C||t[15]!==m||t[16]!==u||t[17]!==i||t[18]!==d?(N=async()=>{if(S){d();return}if(C){_(!0);return}if(i===`ready`){m(),u();return}if(i===`idle`){let e=await p();e===`needs-model`?_(!0):e===`ready`&&(m(),u())}},t[12]=p,t[13]=S,t[14]=C,t[15]=m,t[16]=u,t[17]=i,t[18]=d,t[19]=N):N=t[19];let P=N,ee;t[20]===f?ee=t[21]:(ee=()=>{f()},t[20]=f,t[21]=ee);let F=ee,I,L;t[22]!==g||t[23]!==i?(L=()=>{i===`ready`&&g&&_(!1)},I=[i,g],t[22]=g,t[23]=i,t[24]=I,t[25]=L):(I=t[24],L=t[25]),(0,Z.useEffect)(L,I);let R;t[26]!==c||t[27]!==T||t[28]!==w||t[29]!==b||t[30]!==x||t[31]!==a||t[32]!==C?(R=()=>T?`Checking voice input support...`:a===!1?`Voice input not supported in this browser`:c||(w?`Downloading speech model...`:x?`Transcribing...`:b?`Stop listening`:C?`Click to download speech model`:`Start listening`),t[26]=c,t[27]=T,t[28]=w,t[29]=b,t[30]=x,t[31]=a,t[32]=C,t[33]=R):R=t[33];let z=R,te;t[34]!==w||t[35]!==b||t[36]!==x?(te=()=>w||x?(0,Q.jsx)(k,{className:`h-3 w-3 animate-spin`}):b?(0,Q.jsxs)(`span`,{className:`recording-waveform`,"aria-hidden":!0,children:[(0,Q.jsx)(`span`,{className:`recording-waveform-bar`,style:{animationDelay:`0ms`}}),(0,Q.jsx)(`span`,{className:`recording-waveform-bar`,style:{animationDelay:`150ms`}}),(0,Q.jsx)(`span`,{className:`recording-waveform-bar`,style:{animationDelay:`75ms`}}),(0,Q.jsx)(`span`,{className:`recording-waveform-bar`,style:{animationDelay:`225ms`}})]}):(0,Q.jsx)(o,{className:`h-3 w-3`}),t[34]=w,t[35]=b,t[36]=x,t[37]=te):te=t[37];let B=te,V,ne;t[38]!==r||t[39]!==B||t[40]!==z||t[41]!==P||t[42]!==T||t[43]!==w||t[44]!==b||t[45]!==x||t[46]!==a||t[47]!==C?(V=z(),ne=r({onClick:P,disabled:T||w||x||a===!1,icon:B(),label:V,isRecording:b,isTranscribing:x,isDownloading:w,needsModel:C,isSupported:a!==!1}),t[38]=r,t[39]=B,t[40]=z,t[41]=P,t[42]=T,t[43]=w,t[44]=b,t[45]=x,t[46]=a,t[47]=C,t[48]=V,t[49]=ne):(V=t[48],ne=t[49]);let H=ne,re;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Q.jsx)(`style`,{children:`
4
+ .recording-waveform {
5
+ display: flex;
6
+ align-items: center;
7
+ gap: 2px;
8
+ height: 16px;
9
+ }
10
+ .recording-waveform-bar {
11
+ display: block;
12
+ width: 3px;
13
+ height: 4px;
14
+ border-radius: 2px;
15
+ background: currentColor;
16
+ animation: waveform-bounce 0.7s ease-in-out infinite alternate;
17
+ }
18
+ @keyframes waveform-bounce {
19
+ from { height: 3px; }
20
+ to { height: 14px; }
21
+ }
22
+ `}),t[50]=re):re=t[50];let U;t[51]===H?U=t[52]:(U=(0,Q.jsx)(Pt,{asChild:!0,children:H}),t[51]=H,t[52]=U);let W;t[53]===V?W=t[54]:(W=(0,Q.jsx)(jt,{side:`top`,className:`bg-popover text-popover-foreground max-w-64`,children:V}),t[53]=V,t[54]=W);let G;t[55]!==U||t[56]!==W?(G=(0,Q.jsxs)(Nt,{children:[U,W]}),t[55]=U,t[56]=W,t[57]=G):G=t[57];let K;t[58]!==g||t[59]!==l||t[60]!==c||t[61]!==F||t[62]!==w?(K=(0,Q.jsx)($n,{open:g,onOpenChange:_,onConfirm:F,downloading:w,progress:l,error:c}),t[58]=g,t[59]=l,t[60]=c,t[61]=F,t[62]=w,t[63]=K):K=t[63];let ie;return t[64]!==G||t[65]!==K?(ie=(0,Q.jsxs)(Q.Fragment,{children:[re,G,K]}),t[64]=G,t[65]=K,t[66]=ie):ie=t[66],ie}function tr(e){let t=(0,X.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,Q.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,Q.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,Q.jsx)(`p`,{className:`flex-1 whitespace-pre-wrap text-foreground`,children:e.message}),(0,Q.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,Q.jsx)(Re,{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,Q.jsxs)(`div`,{className:`mb-3 rounded-lg border border-border/60 bg-muted/30 px-4 py-3`,children:[i,(0,Q.jsx)(`div`,{className:`mt-2 flex flex-col gap-2`,children:a})]}),t[6]=a,t[7]=o),o}function nr(e){let t=(0,X.c)(28),{onSpeechClick:n,speechDisabled:r,icon:i,label:a,isRecording:o,isTranscribing:s,isDownloading:c,isSupported:l,hasMessageText:u,setIsVoiceActive:d,isStreaming:f,disabled:p,canSubmitMessage:m,attachmentsLength:h,effectiveModel:g,onStop:_,onSend:v}=e,y,b;t[0]!==u||t[1]!==c||t[2]!==o||t[3]!==s||t[4]!==d?(y=()=>{u||d(o||s||c)},b=[u,c,o,s,d],t[0]=u,t[1]=c,t[2]=o,t[3]=s,t[4]=d,t[5]=y,t[6]=b):(y=t[5],b=t[6]),(0,Z.useEffect)(y,b);let x=!f&&((p??!1)||!m&&r||!u&&h>0&&!g||u&&!g),S;t[7]!==m||t[8]!==f||t[9]!==v||t[10]!==n||t[11]!==_?(S=function(){if(f){_?.();return}if(m){v();return}n()},t[7]=m,t[8]=f,t[9]=v,t[10]=n,t[11]=_,t[12]=S):S=t[12];let C=S,w=f?`Stop generation`:m?`Send message`:a,T=`h-7 w-7 rounded-full ${o?`bg-primary text-primary-foreground hover:bg-primary/90`:``}`,E;t[13]!==m||t[14]!==i||t[15]!==f?(E=f?(0,Q.jsx)(je,{className:`h-3 w-3 fill-current`}):m?(0,Q.jsx)(z,{className:`h-3 w-3`}):i,t[13]=m,t[14]=i,t[15]=f,t[16]=E):E=t[16];let D;t[17]===w?D=t[18]:(D=(0,Q.jsx)(`span`,{className:`sr-only`,children:w}),t[17]=w,t[18]=D);let O;t[19]===l?O=t[20]:(O=!l&&(0,Q.jsx)(`span`,{className:`sr-only`,children:`Voice input not supported`}),t[19]=l,t[20]=O);let k;return t[21]!==C||t[22]!==x||t[23]!==T||t[24]!==E||t[25]!==D||t[26]!==O?(k=(0,Q.jsxs)(A,{size:`icon`,className:T,onClick:C,disabled:x,children:[E,D,O]}),t[21]=C,t[22]=x,t[23]=T,t[24]=E,t[25]=D,t[26]=O,t[27]=k):k=t[27],k}function rr(e){let t=(0,X.c)(155),{onSend:n,onStop:r,isStreaming:i,disabled:a,initialValue:o,queuedMessages:s,onRemoveQueuedMessage:c,isOverlay:l,userTasks:u,onMatchedUserTaskSend:d,onUserTaskCreated:f}=e,p=i===void 0?!1:i,m=l===void 0?!1:l,h;t[0]===u?h=t[1]:(h=u===void 0?[]:u,t[0]=u,t[1]=h);let g=h,_;t[2]===o?_=t[3]:(_={initialValue:o},t[2]=o,t[3]=_);let{message:v,setMessage:y,historyIndex:b,setHistoryIndex:x,draftMessage:S,setDraftMessage:C,cursorPosition:w,setCursorPosition:T,availableModels:E,selectedModel:D,setSelectedModel:O,attachments:k,setAttachments:A,planMode:j,setPlanMode:M,ralphMode:N,setRalphMode:P,imageMode:F,setImageMode:I,availableImageModels:L,selectedImageModel:R,setSelectedImageModel:z,allFiles:te,setAllFiles:B,showSuggestions:V,setShowSuggestions:ne,suggestionQuery:H,setSuggestionQuery:re,selectedIndex:U,setSelectedIndex:W,slashCommands:G,skills:K,showCommandSuggestions:ie,setShowCommandSuggestions:ae,commandQuery:oe,setCommandQuery:se,fileInputRef:ce,textareaRef:q,suggestionsRef:le,commandSuggestionsRef:ue,state:de,dispatch:fe}=pn(_),pe=F?R:D,me=F?L:E,J;t[4]===v?J=t[5]:(J=v.trim(),t[4]=v,t[5]=J);let he=J.length>0,ge=he||k.length>0,[_e,ve]=Z.useState(!1),ye,be;t[6]===he?(ye=t[7],be=t[8]):(ye=()=>{he&&ve(!1)},be=[he],t[6]=he,t[7]=ye,t[8]=be),(0,Z.useEffect)(ye,be);let xe=de.selectedThreadId??void 0,Se;t[9]!==te||t[10]!==k||t[11]!==oe||t[12]!==w||t[13]!==fe||t[14]!==S||t[15]!==b||t[16]!==F||t[17]!==p||t[18]!==v||t[19]!==d||t[20]!==n||t[21]!==j||t[22]!==N||t[23]!==R||t[24]!==U||t[25]!==D||t[26]!==B||t[27]!==A||t[28]!==se||t[29]!==T||t[30]!==C||t[31]!==x||t[32]!==I||t[33]!==y||t[34]!==M||t[35]!==P||t[36]!==W||t[37]!==ae||t[38]!==ne||t[39]!==re||t[40]!==ie||t[41]!==V||t[42]!==K||t[43]!==G||t[44]!==H||t[45]!==xe||t[46]!==q||t[47]!==g?(Se={message:v,setMessage:y,userTasks:g,onMatchedUserTaskSend:d,attachments:k,selectedModel:D,onSend:n,isStreaming:p,selectedThreadId:xe,isListening:!1,stopListening:cr,resetTranscript:sr,dispatch:fe,historyIndex:b,setHistoryIndex:x,draftMessage:S,setDraftMessage:C,cursorPosition:w,setCursorPosition:T,showSuggestions:V,setShowSuggestions:ne,suggestionQuery:H,setSuggestionQuery:re,allFiles:te,setAllFiles:B,selectedIndex:U,setSelectedIndex:W,showCommandSuggestions:ie,setShowCommandSuggestions:ae,commandQuery:oe,setCommandQuery:se,slashCommands:G,skills:K,textareaRef:q,setAttachments:A,planMode:j,setPlanMode:M,ralphMode:N,setRalphMode:P,imageMode:F,setImageMode:I,selectedImageModel:R},t[9]=te,t[10]=k,t[11]=oe,t[12]=w,t[13]=fe,t[14]=S,t[15]=b,t[16]=F,t[17]=p,t[18]=v,t[19]=d,t[20]=n,t[21]=j,t[22]=N,t[23]=R,t[24]=U,t[25]=D,t[26]=B,t[27]=A,t[28]=se,t[29]=T,t[30]=C,t[31]=x,t[32]=I,t[33]=y,t[34]=M,t[35]=P,t[36]=W,t[37]=ae,t[38]=ne,t[39]=re,t[40]=ie,t[41]=V,t[42]=K,t[43]=G,t[44]=H,t[45]=xe,t[46]=q,t[47]=g,t[48]=Se):Se=t[48];let{handleSend:Ce,handleKeyDown:we,handleTextareaInput:Te,insertFileReference:Ee,insertCommand:De,insertSkill:Oe,fileSuggestions:ke}=hn(Se),Ae;t[49]===y?Ae=t[50]:(Ae=e=>{y(t=>(t.endsWith(` `),t+e))},t[49]=y,t[50]=Ae);let je=Ae,Me;t[51]===A?Me=t[52]:(Me=e=>{let t=e.clipboardData?.items;if(!t)return;let n=Array.from(t).filter(or);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];A(n=>[...n,{fileName:t.name||`pasted-image.${t.type.split(`/`)[1]||`png`}`,content:e,mimeType:t.type}])},n.readAsDataURL(t)}}},t[51]=A,t[52]=Me);let Ne=Me,Pe=m?`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`,Fe=`flex flex-col rounded-2xl border focus-within:ring-2 focus-within:ring-brand pointer-events-auto ${m?`border-border/50 shadow-lg backdrop-blur-sm`:`border-border shadow-2xl`}`,Le=m?`linear-gradient(to right, transparent 0, transparent 40px, hsl(var(--background) / 0.8) 40px)`:`linear-gradient(to right, transparent 0, transparent 40px, hsl(var(--background)) 40px)`,Re;t[53]===Le?Re=t[54]:(Re={backgroundImage:Le},t[53]=Le,t[54]=Re);let ze;t[55]!==c||t[56]!==s?(ze=(0,Q.jsx)(tr,{queuedMessages:s,onRemoveQueuedMessage:c}),t[55]=c,t[56]=s,t[57]=ze):ze=t[57];let Be=N?`Describe stories for Ralph to implement autonomously...`:j?`Describe what you want Tarsk to plan...`:F?`Describe the image you want to generate...`:_e?`Dictate your message...`:`Ask Tarsk anything, # for files, / for commands & skills`,Ve;t[58]!==a||t[59]!==we||t[60]!==Ne||t[61]!==Te||t[62]!==v||t[63]!==Be||t[64]!==q?(Ve=(0,Q.jsx)(`textarea`,{ref:q,value:v,onChange:Te,onKeyDown:we,onPaste:Ne,placeholder:Be,rows:1,className:`w-full resize-none bg-transparent px-6 pt-4 pb-4 text-base text-foreground placeholder:text-muted-foreground focus:outline-none`,disabled:a}),t[58]=a,t[59]=we,t[60]=Ne,t[61]=Te,t[62]=v,t[63]=Be,t[64]=q,t[65]=Ve):Ve=t[65];let He;t[66]!==oe||t[67]!==ue||t[68]!==De||t[69]!==Oe||t[70]!==U||t[71]!==W||t[72]!==ie||t[73]!==K||t[74]!==G?(He=(0,Q.jsx)(yn,{visible:ie,commands:G,skills:K,query:oe,selectedIndex:U,onSelectCommand:De,onSelectSkill:Oe,onMouseEnterSuggestion:W,containerRef:ue}),t[66]=oe,t[67]=ue,t[68]=De,t[69]=Oe,t[70]=U,t[71]=W,t[72]=ie,t[73]=K,t[74]=G,t[75]=He):He=t[75];let Ue;t[76]!==ke||t[77]!==Ee||t[78]!==U||t[79]!==W||t[80]!==V||t[81]!==H||t[82]!==le?(Ue=(0,Q.jsx)(Tn,{showSuggestions:V,fileSuggestions:ke,suggestionQuery:H,selectedIndex:U,onSelectFile:Ee,onMouseEnterSuggestion:W,containerRef:le}),t[76]=ke,t[77]=Ee,t[78]=U,t[79]=W,t[80]=V,t[81]=H,t[82]=le,t[83]=Ue):Ue=t[83];let We;t[84]!==k||t[85]!==D?.id||t[86]!==D?.name||t[87]!==D?.supportsImages||t[88]!==A?(We=k.length>0&&(0,Q.jsxs)(`div`,{className:`px-4`,children:[(0,Q.jsx)(Cn,{attachments:k,onRemove:e=>A(t=>t.filter((t,n)=>n!==e))}),k.some(ar)&&D?.supportsImages===!1&&(0,Q.jsxs)(`div`,{className:`mb-2 flex items-center gap-1.5 text-xs text-amber-500`,children:[(0,Q.jsx)(ee,{className:`h-3 w-3 shrink-0`}),(0,Q.jsxs)(`span`,{children:[`Images are not supported by `,D?.name||D?.id]})]})]}),t[84]=k,t[85]=D?.id,t[86]=D?.name,t[87]=D?.supportsImages,t[88]=A,t[89]=We):We=t[89];let Ge;t[90]===ce?Ge=t[91]:(Ge=()=>ce.current?.click(),t[90]=ce,t[91]=Ge);let Ke;t[92]!==fe||t[93]!==v||t[94]!==f||t[95]!==A||t[96]!==y||t[97]!==de.selectedThreadId||t[98]!==q?(Ke=()=>{let e=de.selectedThreadId;if(!e)return;let t=v.trim();t&&Ie(e,t).then(t=>{f?.(t),y(``),A([]),fe({type:Y.ClearChatInputDraft,threadId:e}),q.current&&(q.current.style.height=`auto`)}).catch(ir)},t[92]=fe,t[93]=v,t[94]=f,t[95]=A,t[96]=y,t[97]=de.selectedThreadId,t[98]=q,t[99]=Ke):Ke=t[99];let qe;t[100]!==a||t[101]!==he||t[102]!==Ge||t[103]!==Ke?(qe=(0,Q.jsx)(Gn,{disabled:a,canAddTask:he,onFileAttach:Ge,onAddTask:Ke}),t[100]=a,t[101]=he,t[102]=Ge,t[103]=Ke,t[104]=qe):qe=t[104];let Je=F?z:O,Ye;t[105]!==me||t[106]!==pe||t[107]!==Je?(Ye=(0,Q.jsx)(On,{availableModels:me,selectedModel:pe,onModelSelect:Je}),t[105]=me,t[106]=pe,t[107]=Je,t[108]=Ye):Ye=t[108];let Xe;t[109]!==qe||t[110]!==Ye?(Xe=(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[qe,Ye]}),t[109]=qe,t[110]=Ye,t[111]=Xe):Xe=t[111];let Ze;t[112]!==F||t[113]!==j||t[114]!==N||t[115]!==I||t[116]!==M||t[117]!==P?(Ze=(0,Q.jsx)(Mn,{planMode:j,imageMode:F,ralphMode:N,setPlanMode:M,setImageMode:I,setRalphMode:P}),t[112]=F,t[113]=j,t[114]=N,t[115]=I,t[116]=M,t[117]=P,t[118]=Ze):Ze=t[118];let Qe;t[119]!==k.length||t[120]!==ge||t[121]!==a||t[122]!==pe||t[123]!==Ce||t[124]!==he||t[125]!==p||t[126]!==r?(Qe=e=>{let{onClick:t,disabled:n,icon:i,label:o,isRecording:s,isTranscribing:c,isDownloading:l,isSupported:u}=e;return(0,Q.jsx)(nr,{onSpeechClick:t,speechDisabled:n,icon:i,label:o,isRecording:s,isTranscribing:c,isDownloading:l,isSupported:u,hasMessageText:he,setIsVoiceActive:ve,isStreaming:p,disabled:a,canSubmitMessage:ge,attachmentsLength:k.length,effectiveModel:pe,onStop:r,onSend:Ce})},t[119]=k.length,t[120]=ge,t[121]=a,t[122]=pe,t[123]=Ce,t[124]=he,t[125]=p,t[126]=r,t[127]=Qe):Qe=t[127];let $e;t[128]!==je||t[129]!==Qe?($e=(0,Q.jsx)(er,{onTranscript:je,children:Qe}),t[128]=je,t[129]=Qe,t[130]=$e):$e=t[130];let et;t[131]!==Ze||t[132]!==$e?(et=(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[Ze,$e]}),t[131]=Ze,t[132]=$e,t[133]=et):et=t[133];let tt;t[134]!==Xe||t[135]!==et?(tt=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between px-3 pb-2`,children:[Xe,et]}),t[134]=Xe,t[135]=et,t[136]=tt):tt=t[136];let nt;t[137]!==Fe||t[138]!==Re||t[139]!==ze||t[140]!==Ve||t[141]!==He||t[142]!==Ue||t[143]!==We||t[144]!==tt?(nt=(0,Q.jsxs)(`div`,{className:Fe,style:Re,children:[ze,Ve,He,Ue,We,tt]}),t[137]=Fe,t[138]=Re,t[139]=ze,t[140]=Ve,t[141]=He,t[142]=Ue,t[143]=We,t[144]=tt,t[145]=nt):nt=t[145];let rt;t[146]===A?rt=t[147]:(rt=e=>wn(e,e=>A(t=>[...t,...e])),t[146]=A,t[147]=rt);let it;t[148]!==ce||t[149]!==rt?(it=(0,Q.jsx)(`input`,{ref:ce,type:`file`,multiple:!0,className:`hidden`,onChange:rt}),t[148]=ce,t[149]=rt,t[150]=it):it=t[150];let at;return t[151]!==Pe||t[152]!==nt||t[153]!==it?(at=(0,Q.jsxs)(`div`,{className:Pe,children:[nt,it]}),t[151]=Pe,t[152]=nt,t[153]=it,t[154]=at):at=t[154],at}function ir(e){console.error(`Failed to create user task:`,e)}function ar(e){return e.mimeType.startsWith(`image/`)}function or(e){return e.type.startsWith(`image/`)}function sr(){}function cr(){}function lr(e){let t=(0,X.c)(24),{currentBranch:n,availableBranches:r,isLoadingBranches:i,isCheckingOut:a,onLoadBranches:o,onCheckoutBranch:s,onCreateBranch:c}=e,l;t[0]===o?l=t[1]:(l=e=>{e&&o()},t[0]=o,t[1]=l);let u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(Le,{className:`h-3.5 w-3.5 shrink-0`}),t[2]=u):u=t[2];let d=n||`Unknown`,f;t[3]===d?f=t[4]:(f=(0,Q.jsx)(Pn,{asChild:!0,children:(0,Q.jsxs)(A,{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:[u,d]})}),t[3]=d,t[4]=f);let p,m;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(Ze,{className:`h-3.5 w-3.5 mr-2 shrink-0`}),m=(0,Q.jsx)(`span`,{children:`Create branch`}),t[5]=p,t[6]=m):(p=t[5],m=t[6]);let h;t[7]!==a||t[8]!==c?(h=(0,Q.jsxs)(zn,{onClick:c,disabled:a,children:[p,m]}),t[7]=a,t[8]=c,t[9]=h):h=t[9];let g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Q.jsx)(Un,{}),t[10]=g):g=t[10];let _;t[11]!==r||t[12]!==n||t[13]!==a||t[14]!==i||t[15]!==s?(_=i?(0,Q.jsxs)(`div`,{className:`px-2 py-1.5 text-xs text-muted-foreground flex items-center gap-2`,children:[(0,Q.jsx)(k,{className:`h-3 w-3 animate-spin`}),`Loading branches...`]}):r.length===0?(0,Q.jsx)(`div`,{className:`px-2 py-1.5 text-xs text-muted-foreground`,children:`No branches found`}):r.map(e=>(0,Q.jsxs)(zn,{disabled:e===n||a,onClick:()=>s(e),children:[(0,Q.jsx)(Le,{className:`h-3.5 w-3.5 mr-2 shrink-0`}),(0,Q.jsx)(`span`,{className:e===n?`font-semibold text-foreground`:``,children:e}),e===n&&(0,Q.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:`current`})]},e)),t[11]=r,t[12]=n,t[13]=a,t[14]=i,t[15]=s,t[16]=_):_=t[16];let v;t[17]!==h||t[18]!==_?(v=(0,Q.jsxs)(Rn,{align:`start`,children:[h,g,_]}),t[17]=h,t[18]=_,t[19]=v):v=t[19];let y;return t[20]!==l||t[21]!==v||t[22]!==f?(y=(0,Q.jsxs)(Nn,{onOpenChange:l,children:[f,v]}),t[20]=l,t[21]=v,t[22]=f,t[23]=y):y=t[23],y}function ur(e){let t=(0,X.c)(35),{open:r,onOpenChange:i,branchName:a,onBranchNameChange:o,isLoading:s,onCreateBranch:c}=e,l;t[0]!==a||t[1]!==s||t[2]!==c?(l=e=>{e.key===`Enter`&&a.trim()&&!s&&c()},t[0]=a,t[1]=s,t[2]=c,t[3]=l):l=t[3];let u=l,d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsxs)(Ae,{children:[(0,Q.jsx)(He,{children:`New Branch`}),(0,Q.jsx)(me,{children:`Enter a name for the new branch. It will be created from the default branch.`})]}),t[4]=d):d=t[4];let f;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(G,{htmlFor:`branch-name`,children:`Branch Name`}),t[5]=f):f=t[5];let p;t[6]===o?p=t[7]:(p=e=>o(e.target.value),t[6]=o,t[7]=p);let m;t[8]!==a||t[9]!==u||t[10]!==s||t[11]!==p?(m=(0,Q.jsx)(`div`,{className:`grid gap-4 py-4`,children:(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[f,(0,Q.jsx)(ie,{id:`branch-name`,placeholder:`e.g. feature/my-feature`,value:a,onChange:p,onKeyDown:u,disabled:s,autoFocus:!0})]})}),t[8]=a,t[9]=u,t[10]=s,t[11]=p,t[12]=m):m=t[12];let h;t[13]===i?h=t[14]:(h=()=>i(!1),t[13]=i,t[14]=h);let g;t[15]!==s||t[16]!==h?(g=(0,Q.jsx)(A,{variant:`outline`,onClick:h,disabled:s,children:`Cancel`}),t[15]=s,t[16]=h,t[17]=g):g=t[17];let _;t[18]!==a||t[19]!==s?(_=s||!a.trim(),t[18]=a,t[19]=s,t[20]=_):_=t[20];let v=s?`Creating...`:`Create Branch`,y;t[21]!==c||t[22]!==_||t[23]!==v?(y=(0,Q.jsx)(A,{onClick:c,disabled:_,children:v}),t[21]=c,t[22]=_,t[23]=v,t[24]=y):y=t[24];let b;t[25]!==y||t[26]!==g?(b=(0,Q.jsxs)(Ge,{children:[g,y]}),t[25]=y,t[26]=g,t[27]=b):b=t[27];let x;t[28]!==b||t[29]!==m?(x=(0,Q.jsxs)(n,{children:[d,m,b]}),t[28]=b,t[29]=m,t[30]=x):x=t[30];let S;return t[31]!==i||t[32]!==r||t[33]!==x?(S=(0,Q.jsx)(P,{open:r,onOpenChange:i,children:x}),t[31]=i,t[32]=r,t[33]=x,t[34]=S):S=t[34],S}function dr(e){let t=(0,X.c)(8),{collapsed:n}=e,{theme:r,setTheme:i}=Yt();if(n)return null;let a;t[0]!==i||t[1]!==r?(a=()=>i(r===`dark`?`light`:`dark`),t[0]=i,t[1]=r,t[2]=a):a=t[2];let o,s,c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(be,{className:`h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0`}),s=(0,Q.jsx)(p,{className:`absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100`}),c=(0,Q.jsx)(`span`,{className:`sr-only`,children:`Toggle theme`}),t[3]=o,t[4]=s,t[5]=c):(o=t[3],s=t[4],c=t[5]);let l;return t[6]===a?l=t[7]:(l=(0,Q.jsxs)(A,{variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground hover:text-background`,onClick:a,children:[o,s,c]}),t[6]=a,t[7]=l),l}var fr=[{key:`systemPrompt`,label:`System prompt`,color:`#9CA3AF`},{key:`toolDefinitions`,label:`Tool definitions`,color:`#B088F0`},{key:`rules`,label:`Rules`,color:`#88D088`},{key:`skills`,label:`Skills`,color:`#D0A000`},{key:`subagentDefinitions`,label:`Subagent definitions`,color:`#2080D0`},{key:`conversation`,label:`Conversation`,color:`#E09030`}];function pr(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}function mr(e){return e>=1e6?`${Math.round(e/1e6)}M`:e>=1e3?`${Math.round(e/1e3)}K`:e.toString()}function hr(e){let t=(0,X.c)(49),{breakdown:n,onClose:r}=e,{categories:i,totalTokens:a,contextWindow:o,percentageFull:s}=n,c,l,u,d,f,p;if(t[0]!==i||t[1]!==o||t[2]!==r||t[3]!==s||t[4]!==a){let e;t[11]===i?e=t[12]:(e=e=>i[e.key]>0,t[11]=i,t[12]=e);let n=fr.filter(e);d=`w-72 space-y-3`;let m;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Context`}),t[13]=m):m=t[13];let h;t[14]===r?h=t[15]:(h=r&&(0,Q.jsxs)(A,{variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground hover:text-background`,onClick:r,children:[(0,Q.jsx)(Re,{className:`h-4 w-4`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Close`})]}),t[14]=r,t[15]=h),t[16]===h?f=t[17]:(f=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[m,h]}),t[16]=h,t[17]=f);let g;t[18]===s?g=t[19]:(g=(0,Q.jsxs)(`span`,{children:[s,`% Full`]}),t[18]=s,t[19]=g);let _;t[20]===a?_=t[21]:(_=pr(a),t[20]=a,t[21]=_);let v;t[22]===o?v=t[23]:(v=mr(o),t[22]=o,t[23]=v);let y;t[24]!==_||t[25]!==v?(y=(0,Q.jsxs)(`span`,{children:[`~`,_,` / `,v,` Tokens`]}),t[24]=_,t[25]=v,t[26]=y):y=t[26],t[27]!==g||t[28]!==y?(p=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[g,y]}),t[27]=g,t[28]=y,t[29]=p):p=t[29],u=`h-2 w-full overflow-hidden rounded-full bg-muted/60`,c=`flex h-full w-full`;let b;t[30]!==i||t[31]!==o?(b=e=>{let t=i[e.key],n=o>0?t/o*100:0;return(0,Q.jsx)(`div`,{style:{width:`${Math.max(n,t>0?.5:0)}%`,backgroundColor:e.color}},e.key)},t[30]=i,t[31]=o,t[32]=b):b=t[32],l=n.map(b),t[0]=i,t[1]=o,t[2]=r,t[3]=s,t[4]=a,t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p}else c=t[5],l=t[6],u=t[7],d=t[8],f=t[9],p=t[10];let m;t[33]!==c||t[34]!==l?(m=(0,Q.jsx)(`div`,{className:c,children:l}),t[33]=c,t[34]=l,t[35]=m):m=t[35];let h;t[36]!==u||t[37]!==m?(h=(0,Q.jsx)(`div`,{className:u,children:m}),t[36]=u,t[37]=m,t[38]=h):h=t[38];let g;t[39]===i?g=t[40]:(g=fr.map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`h-2.5 w-2.5 shrink-0 rounded-sm`,style:{backgroundColor:e.color}}),(0,Q.jsx)(`span`,{children:e.label})]}),(0,Q.jsx)(`span`,{className:`tabular-nums`,children:pr(i[e.key])})]},e.key)),t[39]=i,t[40]=g);let _;t[41]===g?_=t[42]:(_=(0,Q.jsx)(`div`,{className:`space-y-1.5`,children:g}),t[41]=g,t[42]=_);let v;return t[43]!==_||t[44]!==d||t[45]!==f||t[46]!==p||t[47]!==h?(v=(0,Q.jsxs)(`div`,{className:d,children:[f,p,h,_]}),t[43]=_,t[44]=d,t[45]=f,t[46]=p,t[47]=h,t[48]=v):v=t[48],v}function gr({threadId:e,currentConversationId:t,initialBreakdown:n,refreshKey:r,children:i}){let[a,o]=(0,Z.useState)(n??null),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(null),[d,f]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(!!n);return(0,Z.useEffect)(()=>{o(n??null),m(!!n),u(null)},[n,r]),(0,Z.useEffect)(()=>{if(!d||!e||!t||p)return;async function n(){c(!0),u(null);try{let n=t;if(!n)return;o(await q(e,n)),m(!0)}catch(e){console.error(`[TokenUsageTooltip] Failed to load context data:`,e),u(`Failed to load context data`)}finally{c(!1)}}n()},[d,e,t,p]),!e||e===``?(0,Q.jsx)(Q.Fragment,{children:i}):(0,Q.jsxs)(Qt,{open:d,onOpenChange:f,children:[(0,Q.jsx)($t,{asChild:!0,children:i}),(0,Q.jsxs)(en,{side:`top`,align:`end`,className:`w-auto p-4`,children:[s&&(0,Q.jsxs)(`div`,{className:`flex w-72 items-center gap-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(nt,{className:`h-3 w-3 animate-pulse`}),(0,Q.jsx)(`span`,{children:`Loading context...`})]}),l&&!s&&(0,Q.jsxs)(`div`,{className:`flex w-72 items-center gap-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(nt,{className:`h-3 w-3`}),(0,Q.jsx)(`span`,{children:l})]}),!s&&!l&&a&&(0,Q.jsx)(hr,{breakdown:a,onClose:()=>f(!1)})]})]})}function _r(e,t){return`${e.filter(e=>e.sender===`agent`).length}:${t?`streaming`:`idle`}`}function vr(e){return e>75?`text-red-500`:e>50?`text-orange-500`:`text-muted-foreground`}function yr(e){let t=(0,X.c)(8),{percentage:n}=e,r=2*Math.PI*7,i=r*(1-Math.min(n,100)/100),a;t[0]===n?a=t[1]:(a=vr(n),t[0]=n,t[1]=a);let o=`h-4 w-4 ${a}`,s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(`circle`,{className:`text-muted-foreground/25`,cx:`10`,cy:`10`,r:7,fill:`none`,stroke:`currentColor`,strokeWidth:`3`}),t[2]=s):s=t[2];let c;t[3]===i?c=t[4]:(c=(0,Q.jsx)(`circle`,{cx:`10`,cy:`10`,r:7,fill:`none`,stroke:`currentColor`,strokeWidth:`3`,strokeLinecap:`round`,strokeDasharray:r,strokeDashoffset:i,transform:`rotate(-90 10 10)`}),t[3]=i,t[4]=c);let l;return t[5]!==o||t[6]!==c?(l=(0,Q.jsxs)(`svg`,{className:o,viewBox:`0 0 20 20`,"aria-hidden":`true`,children:[s,c]}),t[5]=o,t[6]=c,t[7]=l):l=t[7],l}function br(e){let t=(0,X.c)(22),{threadId:n,isStreaming:i,messages:a}=e,o=i===void 0?!1:i,s;t[0]===a?s=t[1]:(s=a===void 0?[]:a,t[0]=a,t[1]=s);let c=s,[l,u]=(0,Z.useState)(),[d,f]=(0,Z.useState)(),p;t[2]!==o||t[3]!==c?(p=_r(c,o),t[2]=o,t[3]=c,t[4]=p):p=t[4];let m=p,h;t[5]===n?h=t[6]:(h=()=>{(async function(){if(!n){u(void 0),f(void 0);return}try{let e=(await b(n)).currentConversationId;if(u(e),!e){f(void 0);return}f(await q(n,e))}catch(e){console.error(`Failed to fetch thread usage data:`,e),f(void 0)}})()},t[5]=n,t[6]=h);let g;if(t[7]!==n||t[8]!==m?(g=[n,m],t[7]=n,t[8]=m,t[9]=g):g=t[9],(0,Z.useEffect)(h,g),!n||n===``)return null;let _=d?.percentageFull,v=typeof _==`number`&&_>25,y;t[10]!==_||t[11]!==v?(y=v?(0,Q.jsx)(yr,{percentage:_}):(0,Q.jsx)(r,{className:`h-4 w-4`}),t[10]=_,t[11]=v,t[12]=y):y=t[12];let x;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsx)(`span`,{className:`sr-only`,children:`View token usage`}),t[13]=x):x=t[13];let S;t[14]===y?S=t[15]:(S=(0,Q.jsxs)(A,{variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground hover:text-background`,children:[y,x]}),t[14]=y,t[15]=S);let C;return t[16]!==d||t[17]!==l||t[18]!==S||t[19]!==n||t[20]!==m?(C=(0,Q.jsx)(gr,{threadId:n,currentConversationId:l,initialBreakdown:d,refreshKey:m,children:S}),t[16]=d,t[17]=l,t[18]=S,t[19]=n,t[20]=m,t[21]=C):C=t[21],C}var xr=`[gitops-timing]`;function Sr(e){let t=performance.now();return console.log(`${xr} start ${e}`),{done(n){let r=Math.round(performance.now()-t);console.log(`${xr} end ${e} ${r}ms${n?` ${n}`:``}`)}}}function Cr(e){let t=[],n=performance.now();async function r(n,r){let i=performance.now();try{return await r()}finally{let r=Math.round(performance.now()-i);t.push({step:n,ms:r}),console.log(`${xr} ${e} step=${n} ${r}ms`)}}function i(n,r,i){t.push({step:n,ms:r}),console.log(`${xr} ${e} step=${n} ${r}ms${i?` ${i}`:``}`)}function a(r){let i=Math.round(performance.now()-n),a=t.reduce((e,t)=>t.ms>=e.ms?t:e,{step:`none`,ms:0}),o=t.map(e=>`${e.step}:${e.ms}`).join(` `);console.log(`${xr} ${e} summary total=${i}ms slowest=${a.step}@${a.ms}ms breakdown=[${o}]${r?` ${r}`:``}`)}return{step:r,record:i,summary:a}}var wr=3e4,Tr={hasChanges:!1,changedFilesCount:0,hasUnpushedCommits:!1,currentBranch:``,hasRemoteBranch:!1,isOnGitHub:!1,remoteUrl:``,canCreateRepo:!1,repoUrl:void 0,status:`Up to date`,defaultBranch:null,prExists:!1,prUrl:void 0,prState:void 0,commitsAheadOfDefault:!1},Er=new Map,Dr=new Map;function Or(e,t){let n=Er.get(e);if(n)for(let e of n)e(t)}function kr(e,t){let n=Er.get(e);return n||(n=new Set,Er.set(e,n)),n.add(t),()=>{n.delete(t),n.size===0&&Er.delete(e)}}function Ar(e){return`unified-git-status-${e}`}function jr(e){return L.getSync(Ar(e))}function Mr(e){let[t,n]=(0,Z.useState)(Tr),[r,i]=(0,Z.useState)(!1),a=(0,Z.useRef)(void 0),o=(0,Z.useRef)(0),s=(0,Z.useCallback)(e=>{n(e)},[]),c=(0,Z.useRef)(s);c.current=s;let l=(0,Z.useCallback)(async(t=!1)=>{if(!e)return;let n=++o.current,r=Cr(`hook fetch thread=${e} force=${t}`),a=setTimeout(()=>{o.current===n&&i(!0)},100);try{let i=Ar(e),a=performance.now(),c=jr(e);r.record(`local-cache-check`,Math.round(performance.now()-a),`result=${c?`hit`:`miss`}`),t&&(L.invalidate(i),r.record(`invalidate-local-cache`,0));let l=await r.step(`ttl-cache-get`,()=>L.get(i,()=>D(e,t),wr));if(o.current!==n){r.summary(`stale-request`);return}await r.step(`update-state`,async()=>{s(l),Or(e,l)}),r.summary(`branch=${l.currentBranch} changes=${l.changedFilesCount} prExists=${l.prExists}`)}catch(e){if(o.current!==n)return;console.error(`Failed to fetch unified git status:`,e),r.summary(`error`)}finally{clearTimeout(a),o.current===n&&i(!1)}},[e,s]),u=(0,Z.useRef)(l);return u.current=l,(0,Z.useEffect)(()=>{if(e)return kr(e,e=>{c.current(e)})},[e]),(0,Z.useEffect)(()=>{if(o.current+=1,i(!1),!e){a.current=void 0,n(Tr);return}let t=a.current!==e,r=jr(e);if(t&&(console.log(`[gitops-timing] hook thread changed ${a.current??`none`} -> ${e}`),a.current=e),n(r??Tr),console.log(r?`[gitops-timing] hook load thread=${e} local cache=hit`:`[gitops-timing] hook load thread=${e} local cache=miss`),Dr.get(e)){console.log(`[gitops-timing] hook initial fetch already in flight thread=${e}`);return}console.log(`[gitops-timing] hook starting initial fetch thread=${e}`);let s=u.current(!1).finally(()=>{console.log(`[gitops-timing] hook initial fetch settled thread=${e}`),Dr.delete(e)});Dr.set(e,s)},[e]),{hasChanges:t.hasChanges,changedFilesCount:t.changedFilesCount,hasUnpushedCommits:t.hasUnpushedCommits,hasRemoteBranch:t.hasRemoteBranch,currentBranch:t.currentBranch,isOnGitHub:t.isOnGitHub,remoteUrl:t.remoteUrl,canCreateRepo:t.canCreateRepo,repoUrl:t.repoUrl,status:t.status,defaultBranch:t.defaultBranch,prExists:t.prExists,prUrl:t.prUrl,prState:t.prState,commitsAheadOfDefault:t.commitsAheadOfDefault,isRefreshing:r,fetchUnifiedStatus:l}}var Nr=`panda.koala.penguin.bunny.kitten.puppy.hamster.otter.hedgehog.sloth.dolphin.owl.fox.deer.koala.walrus.bouncy.sparkly.fluffy.jolly.zesty.peppy.snappy.perky.breezy.chirpy.dizzy.fizzy.glossy.groggy.loopy.quirky.umbrella.taco.pickle.waffle.bubble.puzzle.rocket.tornado.volcano.rainbow.diamond.crystal.lantern.treasure.whisper.echo.boing.splat.whoosh.crunch.splash.jingle.wiggle.giggle.scramble.tumble.fumble.jumble.rumble.mumble.stumble.hustle.castle.island.mountain.forest.meadow.lagoon.canyon.geyser.oasis.glacier.waterfall.volcano.tundra.savanna.jungle.desert.magic.dream.wonder.spark.glow.shimmer.twinkle.radiance.harmony.melody.rhythm.symphony.adventure.journey.quest.odyssey`.split(`.`);function Pr(){return Nr[Math.floor(Math.random()*Nr.length)]??`branch`}function Fr(){let e=Pr(),t=Pr();for(;t===e;)t=Pr();return`${e}-${t}`}function Ir(e){let[t,n]=(0,Z.useState)([]),[r,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(!1),[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(``),[f,p]=(0,Z.useState)(!1),[m,h]=(0,Z.useState)(`main`),g=Mr(e);(0,Z.useEffect)(()=>{if(!c){d(``);return}d(Fr())},[c]),(0,Z.useEffect)(()=>{g.defaultBranch&&h(g.defaultBranch)},[g.defaultBranch]);async function _(){if(!(!e||r)){a(!0);try{n((await i(e)).branches)}catch{n([])}finally{a(!1)}}}async function v(t){if(!(!e||t===g.currentBranch)){s(!0);try{await w(e,t),await g.fetchUnifiedStatus(!0),It({title:`Switched to branch "${t}"`})}catch(e){It({title:`Failed to switch branch`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}finally{s(!1)}}}function y(){l(!0)}async function b(){if(!(!e||!u.trim()||f)){p(!0);try{let t=await U(e,m,u);l(!1),await _(),await g.fetchUnifiedStatus(!0),It({title:`Branch created`,description:`Created branch "${t.branchName}" from ${m}`})}catch(e){It({title:`Failed to create branch`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}finally{p(!1)}}}return{currentBranch:g.currentBranch,availableBranches:t,isLoadingBranches:r,isCheckingOut:o,loadBranches:_,checkoutBranch:v,fetchUnifiedStatus:g.fetchUnifiedStatus,isCreateDialogOpen:c,setIsCreateDialogOpen:l,newBranchName:u,setNewBranchName:d,isCreatingBranch:f,createBranch:b,openCreateBranchDialog:y,defaultBranch:m}}function Lr({threadId:e,isStreaming:t=!1,messages:n=[]}){let[r,i]=(0,Z.useState)(!1),[a,o]=(0,Z.useState)(null),s=Ir(e);return(0,Z.useEffect)(()=>{e&&Qe(e).then(o).catch(()=>{})},[e]),(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-8 py-2 mt-[-1rem] min-h-[2.25rem]`,children:[e&&(0,Q.jsx)(lr,{currentBranch:s.currentBranch,availableBranches:s.availableBranches,isLoadingBranches:s.isLoadingBranches,isCheckingOut:s.isCheckingOut,onLoadBranches:s.loadBranches,onCheckoutBranch:s.checkoutBranch,onCreateBranch:s.openCreateBranchDialog}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(dr,{collapsed:!1}),(0,Q.jsx)(br,{threadId:e,isStreaming:t,messages:n}),e&&(0,Q.jsxs)(Nt,{children:[(0,Q.jsx)(Pt,{asChild:!0,children:(0,Q.jsx)(A,{variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground hover:text-background`,onClick:async()=>{if(!(!e||r)){i(!0);try{let t=await Qe(e);await navigator.clipboard.writeText(t)}finally{i(!1)}}},disabled:r,"aria-label":`Copy repository folder path`,children:(0,Q.jsx)(W,{className:`h-4 w-4`})})}),(0,Q.jsxs)(jt,{side:`top`,className:`bg-slate-900 text-white`,children:[(0,Q.jsx)(`div`,{children:`Copy repository folder path`}),a&&(0,Q.jsx)(`div`,{className:`opacity-70 text-xs`,children:a})]})]})]})]}),(0,Q.jsx)(ur,{open:s.isCreateDialogOpen,onOpenChange:s.setIsCreateDialogOpen,branchName:s.newBranchName,onBranchNameChange:s.setNewBranchName,isLoading:s.isCreatingBranch,onCreateBranch:()=>void s.createBranch()})]})}var Rr=new Set,zr=new Map,Br=5e3;function Vr(e){Rr.add(e);let t=zr.get(e);t&&clearTimeout(t),zr.set(e,setTimeout(()=>{Rr.delete(e),zr.delete(e)},Br))}function Hr(e){return Rr.has(e)}function Ur(e){return e.filter(e=>!Rr.has(e))}function Wr(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&&fn(e.id,e.input.code,t)}catch{}}function Gr(){let{state:e,dispatch:t}=Et(),[n,r]=(0,Z.useState)(null),[i,a]=(0,Z.useState)(!1),[o,c]=(0,Z.useState)(null),l=(0,Z.useRef)(null),d=(0,Z.useRef)(new Map),{selectedThreadId:f,selectedProjectId:p,messages:m,queuedChatMessages:h,isStreaming:g,processingThreadIds:_}=e;l.current=f;let v=(0,Z.useCallback)((e,n,r)=>{if(d.current.get(e)!==r){d.current.has(e)||(Vr(e),t({type:Y.ResetStream,threadId:e}),t({type:Y.RemoveProcessingThread,threadId:e}));return}if(d.current.delete(e),t({type:Y.ClearToolCallProgress}),r.stopHandled)return;Vr(e);let i=kt(r.segments)||`...`;if(r.error&&(r.segments.length===0||i===`...`)){let i={messageId:`msg-${Date.now()}-error`,sender:`agent`,content:`Error: ${r.error}`,contentType:`text`,timestamp:new Date().toISOString(),model:n||`default`,isThinking:!1};t({type:Y.AddMessage,message:i,threadId:e}),t({type:Y.ResetStream,threadId:e}),t({type:Y.RemoveProcessingThread,threadId:e});return}let a={messageId:`msg-${Date.now()}-agent`,sender:`agent`,content:i,contentType:`markdown`,timestamp:new Date().toISOString(),model:n||`default`,isThinking:!1};t({type:Y.AddMessage,message:a,threadId:e}),t({type:Y.ResetStream,threadId:e}),t({type:Y.MarkThreadCompleted,threadId:e}),t({type:Y.RemoveProcessingThread,threadId:e})},[t]),y=(0,Z.useCallback)(()=>{if(!f)return;c(f);let n=d.current.get(f);n&&(n.stopHandled=!0,n.controller.abort(),n.cancel?.(),d.current.delete(f)),V(f);let r={messageId:`msg-${Date.now()}-stopped`,sender:`agent`,content:`I've stopped working on your request.`,contentType:`text`,timestamp:new Date().toISOString(),model:e.streamingModel||`default`,isThinking:!1};t({type:Y.AddMessage,message:r,threadId:f}),t({type:Y.ClearToolCallProgress}),t({type:Y.ResetStream,threadId:f}),t({type:Y.MarkThreadCompleted,threadId:f}),t({type:Y.RemoveProcessingThread,threadId:f}),Vr(f)},[f,t,e.streamingModel]);(0,Z.useEffect)(()=>()=>{for(let[e,n]of d.current.entries())n.controller.abort(),n.cancel?.(),t({type:Y.ResetStream,threadId:e});d.current.clear()},[t]),(0,Z.useEffect)(()=>{if(!f)return;let e=!1;async function n(){try{let n=await ve(f);e||t({type:Y.SetMessages,messages:n.messages})}catch(n){console.error(`Failed to load chat history:`,n),e||t({type:Y.SetMessages,messages:[]})}}return n(),()=>{e=!0}},[f,p,t]);let b=(0,Z.useCallback)((e,n,i)=>{let o=d.current.get(e);o&&(o.controller.abort(),o.cancel?.());let s=new AbortController,c={controller:s,cancel:null,segments:[],assistantMessage:``,assistantThinking:``,hasStructuredContent:!1,error:null,stopHandled:!1};return d.current.set(e,c),t({type:Y.ResetStream,threadId:e}),t({type:Y.SetStreaming,isStreaming:!0,threadId:e}),n(s.signal).then(n=>{if(!n||s.signal.aborted){v(e,i,c);return}c.cancel=de(n,n=>{if(t({type:Y.IncrementStreamEventCount,threadId:e}),n.type===`error`){let t=n.content||`Unknown error occurred`;c.error=t,e===l.current&&r(t);return}if(n.type!==`message`){if(n.type===`long_running_confirmation`){let r=n.prompt;if(!r)return;c.segments=At(c.segments,r),t({type:Y.AppendStreamChunk,chunkType:`content`,content:``,segments:c.segments,threadId:e});return}if(n.type===`toolcall_delta`){n.partial?.content?.[0]?.id&&n.delta&&t({type:Y.UpdateToolCallProgress,toolCallId:n.partial.content[0].id,progress:{toolCallId:n.partial.content[0].id,toolName:n.partial.content[0].name,delta:n.delta,partial:n.partial}});return}if(n.model&&t({type:Y.SetStreamModel,model:n.model,threadId:e}),n.type===`thinking`||n.isThinking){let r=n.content??``;Wr(r,e),c.assistantThinking+=r,c.segments=Ot(c.segments,`thinking`,r),t({type:Y.AppendStreamChunk,chunkType:`thinking`,content:r,segments:c.segments,threadId:e})}else if(n.type===`result`){c.hasStructuredContent=!0;let r=n.content??``;c.assistantMessage=r,c.segments=Dt(c.segments,r),t({type:Y.SetStreamContent,content:r,threadId:e}),typeof r==`string`&&Wr(r,e)}else{if(c.hasStructuredContent)return;let r=n.content??``;c.assistantMessage+=r,c.segments=Ot(c.segments,`content`,r),t({type:Y.AppendStreamChunk,chunkType:`content`,content:r,segments:c.segments,threadId:e})}}},()=>{v(e,i,c)},t=>{if(t.includes(`AbortError`)||t.includes(`canceled`)||t.includes(`BodyStreamBuffer was aborted`)){v(e,i,c);return}c.error=t,e===l.current&&r(t)},n=>{if(t({type:Y.IncrementStreamEventCount,threadId:e}),n.role===`assistant`){let r=n.content??``,i=typeof r==`string`?r:JSON.stringify(r);if(n.isThinking??!1){c.assistantThinking+=i,c.segments=Ot(c.segments,`thinking`,i),t({type:Y.AppendStreamChunk,chunkType:`thinking`,content:i,segments:c.segments,threadId:e});return}let a=!1;if(typeof r==`object`&&Array.isArray(r)&&r.length>0)a=!0;else if(typeof i==`string`&&i.trim().startsWith(`[`))try{let e=JSON.parse(i);a=Array.isArray(e)&&e.length>0}catch{}a?(c.hasStructuredContent=!0,c.assistantMessage=i,c.segments=Dt(c.segments,i),t({type:Y.SetStreamContent,content:i,threadId:e}),Wr(i,e)):(c.assistantMessage+=i,c.segments=Ot(c.segments,`content`,i),t({type:Y.AppendStreamChunk,chunkType:`content`,content:i,segments:c.segments,threadId:e}))}else if(n.role===`tool`){let r=n.content??``,i=typeof r==`string`?r:JSON.stringify(r);i&&(c.assistantMessage+=i,c.segments=Ot(c.segments,`content`,i),t({type:Y.AppendStreamChunk,chunkType:`content`,content:i,segments:c.segments,threadId:e}))}})}).catch(n=>{if(d.current.delete(e),n instanceof Error&&n.name===`AbortError`){t({type:Y.ResetStream,threadId:e});return}if(n instanceof xe){t({type:Y.ResetStream,threadId:e}),a(!0);return}if(n instanceof Error&&n.message.includes(`not currently processing`)){t({type:Y.ResetStream,threadId:e});return}let i=n instanceof Error?n.message:`Failed to send message. Please ensure the CLI server is running on localhost:641`;e===l.current&&r(i),console.error(`Failed to subscribe to chat stream:`,n),t({type:Y.ResetStream,threadId:e})}),s},[t,v]);(0,Z.useEffect)(()=>{for(let t of _)d.current.has(t)||e.threadStreamingStates[t]?.isStreaming||Hr(t)||b(t,e=>s(t,e),`default`)},[b,_,e.threadStreamingStates]);let x=(0,Z.useCallback)(async(e,n,i,a,o,s,l)=>{if(!f)return;let d=f;r(null),c(null);let m=`msg-${Date.now()}`,h;try{let e=await rt(d,m);e.success&&e.stashed&&e.checkpointRef&&(h=e.checkpointRef)}catch{}let g={messageId:m,sender:`user`,content:e,contentType:`text`,timestamp:new Date().toISOString(),model:n,attachments:i.map(e=>({fileName:e.fileName,content:e.content,mimeType:e.mimeType})),checkpointRef:h};t({type:Y.AddMessage,message:g,threadId:d});let _=e.trim().replace(/\n/g,` `).slice(0,100);if(p&&(O(d,{title:_}).catch(e=>{console.error(`Failed to update thread title:`,e)}),t({type:Y.UpdateThreadTitle,projectId:p,threadId:d,title:_})),s){let r=a??void 0;if(!r&&typeof n==`string`){let e=n.split(/[:/]/)[0]?.trim();e&&(r=e)}if(!r){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:n,isThinking:!1};t({type:Y.AddMessage,message:e,threadId:d}),t({type:Y.ResetStream,threadId:d});return}t({type:Y.SetStreaming,isStreaming:!0,threadId:d});try{let i=await Je(e,n,r,d),a={messageId:`msg-${Date.now()}-agent`,sender:`agent`,content:e,contentType:`text`,timestamp:new Date().toISOString(),model:n,isThinking:!1,generatedImageUrl:i.imageUrl,generatedImageData:i.imageData};t({type:Y.AddMessage,message:a,threadId:d})}catch(e){let r=e instanceof Error?e.message:`Image generation failed`,i={messageId:`msg-${Date.now()}-error`,sender:`agent`,content:`Error: ${r}`,contentType:`text`,timestamp:new Date().toISOString(),model:n,isThinking:!1};t({type:Y.AddMessage,message:i,threadId:d})}finally{t({type:Y.ResetStream,threadId:d})}return}b(d,t=>u(d,e,n,i,t,a,o,l,h),n)},[f,p,t,b]);(0,Z.useEffect)(()=>{let n=e.pendingChatMessage;if(!n||g||n.threadId!==f)return;let r=setTimeout(()=>{t({type:Y.ClearPendingChatMessage}),x(n.message,n.model,[],n.provider)},100);return()=>clearTimeout(r)},[e.pendingChatMessage,g,f,t,x]);let S=(0,Z.useMemo)(()=>f?h.filter(e=>e.threadId===f):[],[f,h]),C=(0,Z.useRef)(!1);return(0,Z.useEffect)(()=>{if(g||!f||S.length===0||C.current)return;let[e]=S;C.current=!0,t({type:Y.RemoveQueuedChatMessage,queuedMessageId:e.id});let n=setTimeout(()=>{x(e.message,e.model,e.attachments,e.provider,e.planMode,e.imageMode,e.ralphMode),C.current=!1},0);return()=>{clearTimeout(n),C.current=!1}},[t,x,g,S,f]),{error:n,setError:r,handleSend:x,handleStop:y,isStreaming:g,selectedThreadId:f,queuedMessagesForThread:S,handleRemoveQueuedMessage:(0,Z.useCallback)(e=>{let n=S.find(t=>t.id===e);t({type:Y.RemoveQueuedChatMessage,queuedMessageId:e}),!(!n||g||m.length>0||!f)&&x(n.message,n.model,n.attachments,n.provider,n.planMode,n.imageMode,n.ralphMode)},[t,x,g,m.length,S,f]),showEmptyBalanceDialog:i,setShowEmptyBalanceDialog:a}}function Kr(e){let t=(0,X.c)(10),{open:n,onClose:r}=e,i=ot(),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,Q.jsxs)(Vt,{children:[(0,Q.jsx)(Rt,{children:`Balance empty`}),(0,Q.jsx)(Lt,{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,Q.jsxs)(zt,{children:[o,(0,Q.jsx)(Bt,{children:(0,Q.jsx)(A,{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,Q.jsx)(Ht,{open:n,onOpenChange:a,children:s}),t[6]=n,t[7]=a,t[8]=s,t[9]=c):c=t[9],c}function qr(e){let t=(0,X.c)(13),{todos:n}=e,r;t[0]===n?r=t[1]:(r=n.filter(Yr),t[0]=n,t[1]=r);let i=r.length,a;t[2]===n.length?a=t[3]:(a=n.length===0&&(0,Q.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(Jr),t[4]=n,t[5]=o);let s;t[6]!==i||t[7]!==n.length?(s=n.length>0&&(0,Q.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,Q.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 Jr(e){return(0,Q.jsxs)(`div`,{className:`flex items-start gap-2 text-sm`,children:[e.status===`done`?(0,Q.jsx)(he,{className:`h-4 w-4 shrink-0 mt-0.5 text-brand`}):e.status===`working`?(0,Q.jsx)(Ce,{className:`h-4 w-4 shrink-0 mt-0.5 text-yellow-500`}):(0,Q.jsx)(qe,{className:`h-4 w-4 shrink-0 mt-0.5 text-muted-foreground`}),(0,Q.jsx)(`span`,{className:e.status===`done`?`line-through text-muted-foreground`:`text-foreground`,children:e.description})]},e.id)}function Yr(e){return e.status===`done`}function Xr(){let e=(0,X.c)(16),{todos:t}=(0,Z.useContext)(tn),[r,i]=(0,Z.useState)(!1),a;e[0]===t?a=e[1]:(a=t.filter(Zr),e[0]=t,e[1]=a);let o=a.length;if(t.length-o<=0)return null;let s,c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>i(!0),c=(0,Q.jsx)(M,{className:`h-4 w-4 shrink-0`}),e[2]=s,e[3]=c):(s=e[2],c=e[3]);let l;e[4]!==o||e[5]!==t.length?(l=(0,Q.jsxs)(A,{variant:`outline`,size:`sm`,className:`gap-2 bg-background ml-2`,onClick:s,children:[c,o,` of `,t.length,` complete`]}),e[4]=o,e[5]=t.length,e[6]=l):l=e[6];let u;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(Ae,{children:(0,Q.jsx)(He,{children:`Agent Todos`})}),e[7]=u):u=e[7];let d;e[8]===t?d=e[9]:(d=(0,Q.jsxs)(n,{className:`max-w-md`,children:[u,(0,Q.jsx)(qr,{todos:t})]}),e[8]=t,e[9]=d);let f;e[10]!==r||e[11]!==d?(f=(0,Q.jsx)(P,{open:r,onOpenChange:i,children:d}),e[10]=r,e[11]=d,e[12]=f):f=e[12];let p;return e[13]!==l||e[14]!==f?(p=(0,Q.jsxs)(Q.Fragment,{children:[l,f]}),e[13]=l,e[14]=f,e[15]=p):p=e[15],p}function Zr(e){return e.status===`done`}function Qr(e){let t=(0,X.c)(25),{tasks:n,disabled:r,onSelectTask:i,onRemoveTask:a}=e,o=r===void 0?!1:r,[s,c]=(0,Z.useState)(!1),l=n.length,u=`${l} Pending Tasks`;if(l===0)return null;let d;t[0]===i?d=t[1]:(d=function(e){i(e),c(!1)},t[0]=i,t[1]=d);let f=d,p;t[2]!==a||t[3]!==l?(p=function(e){a(e),l===1&&c(!1)},t[2]=a,t[3]=l,t[4]=p):p=t[4];let m=p,h;t[5]===u?h=t[6]:(h=(0,Q.jsx)(`span`,{children:u}),t[5]=u,t[6]=h);let g;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Q.jsx)(Ee,{className:`h-4 w-4 shrink-0`}),t[7]=g):g=t[7];let _;t[8]!==o||t[9]!==h?(_=(0,Q.jsx)($t,{asChild:!0,children:(0,Q.jsxs)(A,{variant:`outline`,size:`sm`,className:`gap-2 bg-background`,disabled:o,children:[h,g]})}),t[8]=o,t[9]=h,t[10]=_):_=t[10];let v;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(`div`,{className:`px-2 pb-1 pt-1 text-xs font-medium text-muted-foreground`,children:`Tasks`}),t[11]=v):v=t[11];let y;if(t[12]!==m||t[13]!==f||t[14]!==n){let e;t[16]!==m||t[17]!==f?(e=e=>(0,Q.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-transparent px-2 py-2 hover:bg-accent`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-start gap-2 text-left`,onClick:()=>f(e),children:[(0,Q.jsx)(ge,{className:`mt-0.5 h-4 w-4 shrink-0 text-muted-foreground`}),(0,Q.jsx)(`span`,{className:`line-clamp-3 text-sm text-foreground`,children:e.content})]}),(0,Q.jsxs)(A,{type:`button`,variant:`ghost`,size:`icon`,className:`h-7 w-7 shrink-0`,onClick:()=>m(e.id),children:[(0,Q.jsx)(Re,{className:`h-4 w-4`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Remove task`})]})]},e.id),t[16]=m,t[17]=f,t[18]=e):e=t[18],y=n.map(e),t[12]=m,t[13]=f,t[14]=n,t[15]=y}else y=t[15];let b;t[19]===y?b=t[20]:(b=(0,Q.jsx)(en,{align:`start`,className:`w-96 p-2`,children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[v,y]})}),t[19]=y,t[20]=b);let x;return t[21]!==s||t[22]!==_||t[23]!==b?(x=(0,Q.jsxs)(Qt,{open:s,onOpenChange:c,children:[_,b]}),t[21]=s,t[22]=_,t[23]=b,t[24]=x):x=t[24],x}function $r(e,t){return t?`Creating PR...`:e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits?`Sync`:e.hasChanges?`Commit`:e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits?`Open PR`:e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges?`Create PR`:e.hasUnpushedCommits&&e.prExists?`Update PR`:`Commit`}function ei(e,t){return t?(0,Q.jsx)(k,{className:`h-3.5 w-3.5 animate-spin`}):e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits?(0,Q.jsx)($e,{className:`h-3.5 w-3.5`}):e.hasChanges?(0,Q.jsx)(T,{className:`h-3.5 w-3.5`}):e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits?(0,Q.jsx)(Oe,{className:`h-3.5 w-3.5`}):(0,Q.jsx)(re,{className:`h-3.5 w-3.5`})}function ti(e){if(e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits){let t=e.defaultBranch??`main`;return e.currentBranch===e.defaultBranch?`Your branch is behind the remote. This will pull the latest changes from origin/${t}`:`Your branch "${e.currentBranch}" is behind "${t}". This will rebase and sync with the latest changes`}return e.hasChanges?e.changedFilesCount>0?`Commit ${e.changedFilesCount} changed file${e.changedFilesCount===1?``:`s`}`:`No changes to commit`:e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits?`View pull request in GitHub`:e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges?`Create pull request for committed changes`:e.hasUnpushedCommits&&e.prExists?`Update pull request with unpushed commits`:`No actions available`}function ni(e,t,n=!1){return t||n?!0:e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits||e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges?!1:!e.hasChanges&&!e.hasUnpushedCommits}function ri(e){return e.hasChanges||e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges}function ii(e){let t=(0,X.c)(80),{branchStatus:n,remoteUrl:r,hasRemoteBranch:i,hasUnpushedCommits:a,canCreateRepo:o,repoUrl:s,isRefreshing:c,isBrandState:l,gitUser:u,isDirectCommitMode:d,isLoading:f,isLoadingHistory:p,onFetch:m,onPull:h,onPush:g,onOpenHistory:_,onCreatePR:v,onCreateRepo:y,onViewInGitHub:b,onOpenChange:x}=e,S=`h-8 w-8 rounded-l-none px-1 border-transparent${l?` bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground`:``}`,C;t[0]===c?C=t[1]:(C=c?(0,Q.jsx)(k,{className:`h-3.5 w-3.5 animate-spin`}):(0,Q.jsx)(se,{className:`h-3.5 w-3.5`}),t[0]=c,t[1]=C);let w;t[2]!==f||t[3]!==S||t[4]!==C?(w=(0,Q.jsx)(Pn,{asChild:!0,children:(0,Q.jsx)(A,{variant:`outline`,size:`sm`,className:S,disabled:f,children:C})}),t[2]=f,t[3]=S,t[4]=C,t[5]=w):w=t[5];let T;t[6]!==n||t[7]!==r?(T=n===`Behind`&&(0,Q.jsxs)(`div`,{className:`px-2 py-1 text-xs text-amber-600`,children:[`Branch is behind `,r?`origin`:`remote`]}),t[6]=n,t[7]=r,t[8]=T):T=t[8];let E;t[9]===u?E=t[10]:(E=u&&(0,Q.jsxs)(`div`,{className:`px-2 py-1 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:`User:`}),` `,u]}),t[9]=u,t[10]=E);let D;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsx)(Un,{}),t[11]=D):D=t[11];let O;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(Be,{className:`h-3.5 w-3.5 mr-2`}),t[12]=O):O=t[12];let j;t[13]!==f||t[14]!==m?(j=(0,Q.jsx)(Pt,{asChild:!0,children:(0,Q.jsxs)(zn,{onClick:m,disabled:f,children:[O,`Fetch`]})}),t[13]=f,t[14]=m,t[15]=j):j=t[15];let M;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(jt,{side:`right`,children:`Download latest information from remote without merging changes`}),t[16]=M):M=t[16];let N;t[17]===j?N=t[18]:(N=(0,Q.jsx)(Mt,{children:(0,Q.jsxs)(Nt,{children:[j,M]})}),t[17]=j,t[18]=N);let P;t[19]!==i||t[20]!==f||t[21]!==h?(P=()=>{i&&!f&&h()},t[19]=i,t[20]=f,t[21]=h,t[22]=P):P=t[22];let ee=!i||f?`opacity-50 cursor-not-allowed`:``,F;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)($e,{className:`h-3.5 w-3.5 mr-2`}),t[23]=F):F=t[23];let I;t[24]!==P||t[25]!==ee?(I=(0,Q.jsx)(Pt,{asChild:!0,children:(0,Q.jsxs)(zn,{onClick:P,className:ee,children:[F,`Pull`]})}),t[24]=P,t[25]=ee,t[26]=I):I=t[26];let L=i?`Pull latest changes from remote`:`No remote branch to pull from`,R;t[27]===L?R=t[28]:(R=(0,Q.jsx)(jt,{side:`right`,children:L}),t[27]=L,t[28]=R);let z;t[29]!==I||t[30]!==R?(z=(0,Q.jsx)(Mt,{children:(0,Q.jsxs)(Nt,{children:[I,R]})}),t[29]=I,t[30]=R,t[31]=z):z=t[31];let te;t[32]!==i||t[33]!==f||t[34]!==g?(te=!i&&(0,Q.jsx)(Mt,{children:(0,Q.jsxs)(Nt,{children:[(0,Q.jsx)(Pt,{asChild:!0,children:(0,Q.jsxs)(zn,{onClick:g,disabled:f,children:[(0,Q.jsx)(ae,{className:`h-3.5 w-3.5 mr-2`}),`Push Branch to Remote`]})}),(0,Q.jsx)(jt,{side:`right`,children:`Create remote branch and push local commits`})]})}),t[32]=i,t[33]=f,t[34]=g,t[35]=te):te=t[35];let B;t[36]!==a||t[37]!==f||t[38]!==g?(B=()=>{a&&!f&&g()},t[36]=a,t[37]=f,t[38]=g,t[39]=B):B=t[39];let V=!a||f?`opacity-50 cursor-not-allowed`:``,H;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Q.jsx)(ae,{className:`h-3.5 w-3.5 mr-2`}),t[40]=H):H=t[40];let U;t[41]!==B||t[42]!==V?(U=(0,Q.jsx)(Pt,{asChild:!0,children:(0,Q.jsxs)(zn,{onClick:B,className:V,children:[H,`Push Commits`]})}),t[41]=B,t[42]=V,t[43]=U):U=t[43];let W=a?f?`Push in progress...`:`Push your uncommitted commits to the remote branch`:`No commits to push - your branch is up to date with remote`,G;t[44]===W?G=t[45]:(G=(0,Q.jsx)(jt,{side:`right`,children:W}),t[44]=W,t[45]=G);let K;t[46]!==U||t[47]!==G?(K=(0,Q.jsx)(Mt,{children:(0,Q.jsxs)(Nt,{children:[U,G]})}),t[46]=U,t[47]=G,t[48]=K):K=t[48];let ie=f||p,oe;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Q.jsx)(it,{className:`h-3.5 w-3.5 mr-2`}),t[49]=oe):oe=t[49];let ce;t[50]!==_||t[51]!==ie?(ce=(0,Q.jsxs)(zn,{onClick:_,disabled:ie,children:[oe,`History`]}),t[50]=_,t[51]=ie,t[52]=ce):ce=t[52];let q;t[53]!==d||t[54]!==f||t[55]!==v?(q=!d&&(0,Q.jsxs)(zn,{onClick:v,disabled:f,children:[(0,Q.jsx)(re,{className:`h-3.5 w-3.5 mr-2`}),`Create Pull Request`]}),t[53]=d,t[54]=f,t[55]=v,t[56]=q):q=t[56];let le;t[57]!==o||t[58]!==f||t[59]!==y?(le=o&&(0,Q.jsxs)(zn,{onClick:y,disabled:f,children:[(0,Q.jsx)(ne,{className:`h-3.5 w-3.5 mr-2`}),`Create Repo`]}),t[57]=o,t[58]=f,t[59]=y,t[60]=le):le=t[60];let ue;t[61]!==f||t[62]!==b||t[63]!==s?(ue=s&&(0,Q.jsxs)(zn,{onClick:b,disabled:f,children:[(0,Q.jsx)(Oe,{className:`h-3.5 w-3.5 mr-2`}),`View in GitHub`]}),t[61]=f,t[62]=b,t[63]=s,t[64]=ue):ue=t[64];let de;t[65]!==N||t[66]!==z||t[67]!==te||t[68]!==K||t[69]!==ce||t[70]!==q||t[71]!==le||t[72]!==ue||t[73]!==T||t[74]!==E?(de=(0,Q.jsxs)(Rn,{align:`end`,children:[T,E,D,N,z,te,K,ce,q,le,ue]}),t[65]=N,t[66]=z,t[67]=te,t[68]=K,t[69]=ce,t[70]=q,t[71]=le,t[72]=ue,t[73]=T,t[74]=E,t[75]=de):de=t[75];let fe;return t[76]!==x||t[77]!==w||t[78]!==de?(fe=(0,Q.jsxs)(Nn,{onOpenChange:x,children:[w,de]}),t[76]=x,t[77]=w,t[78]=de,t[79]=fe):fe=t[79],fe}function ai(){return{autoGenerateCommitMessage:Me(),autoGeneratePRInfo:Te(),privateRepositoryDefault:Ye()}}function oi(e){e.autoGenerateCommitMessage!==void 0&&et(e.autoGenerateCommitMessage),e.autoGeneratePRInfo!==void 0&&R(e.autoGeneratePRInfo),e.privateRepositoryDefault!==void 0&&B(e.privateRepositoryDefault)}function si(e){return e?!0:(It({title:`Error`,description:`No thread selected`,variant:`destructive`}),!1)}function ci(e){let t=e.split(`/`);return t.length>=2?{provider:t[0],model:t.slice(1).join(`/`)}:{provider:void 0,model:e}}function li(e,t,n){let[r,i]=(0,Z.useState)(!1),[a,o]=(0,Z.useState)(!1),s=()=>{let t=e?n[e]:void 0;return t?.id?t.provider?{provider:t.provider,model:t.id}:ci(t.id):{provider:void 0,model:void 0}};return{isGeneratingMessage:r,isGeneratingPRInfo:a,generateCommitMessageWithAI:(0,Z.useCallback)(async()=>{if(!e)return null;try{i(!0);let{provider:t,model:n}=s();return await we(e,n,t)}catch(e){return console.error(`Failed to generate commit message:`,e),It({title:`Error`,description:e instanceof Error?e.message:`Failed to generate commit message`,variant:`destructive`}),null}finally{i(!1)}},[e,n]),generatePRInfoWithAI:(0,Z.useCallback)(async()=>{if(!e)return null;try{o(!0);let{provider:t,model:n}=s();return await fe(e,n,t)}catch(e){return console.error(`Failed to generate PR info:`,e),It({title:`Error`,description:e instanceof Error?e.message:`Failed to generate PR info`,variant:`destructive`}),null}finally{o(!1)}},[e,n])}}var ui=(0,Z.lazy)(()=>Tt(()=>import(`./commit-dialog-CfjW1f6P.js`).then(e=>({default:e.CommitDialog})),__vite__mapDeps([0,1,2,3,4,5]))),di=(0,Z.lazy)(()=>Tt(()=>import(`./pull-request-dialog-DDxX2W8n.js`).then(e=>({default:e.PullRequestDialog})),__vite__mapDeps([6,1,2,3,4,5]))),fi=(0,Z.lazy)(()=>Tt(()=>import(`./create-repo-dialog-ByvOv7em.js`).then(e=>({default:e.CreateRepoDialog})),__vite__mapDeps([7,3,2,4,1,5]))),pi=(0,Z.lazy)(()=>Tt(()=>import(`./git-history-dialog-DKey5IQa.js`).then(e=>({default:e.GitHistoryDialog})),__vite__mapDeps([8,3,2]))),mi=(0,Z.lazy)(()=>Tt(()=>import(`./push-before-pr-dialog-Cs54Vb76.js`).then(e=>({default:e.PushBeforePRDialog})),__vite__mapDeps([9,3,2]))),hi=(0,Z.lazy)(()=>Tt(()=>import(`./pull-with-changes-dialog-BtXHWQ3k.js`).then(e=>({default:e.PullWithChangesDialog})),__vite__mapDeps([10,3,2]))),gi=(0,Z.lazy)(()=>Tt(()=>import(`./merged-pr-dialog-BfwdsytN.js`).then(e=>({default:e.MergedPRDialog})),__vite__mapDeps([11,3,2])));function _i(){return null}function vi({projectId:e,threadId:t}){let{state:n,dispatch:r}=Et(),[i,o]=(0,Z.useState)(!1),[s,l]=(0,Z.useState)(!1),[u,f]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(!1),[h,g]=(0,Z.useState)(``),[_,v]=(0,Z.useState)(``),[y,b]=(0,Z.useState)(``),[x,S]=(0,Z.useState)(!1),[w,T]=(0,Z.useState)(null),E=(0,Z.useRef)(!1),D=(0,Z.useRef)(!1),O=(0,Z.useRef)(_),k=(0,Z.useRef)(y);O.current=_,k.current=y;let[j,M]=(0,Z.useState)(!1),[N,P]=(0,Z.useState)([]),[ee,I]=(0,Z.useState)(!1),[L,R]=(0,Z.useState)([]),[z,te]=(0,Z.useState)(!1),[B,V]=(0,Z.useState)(!1),[ne,H]=(0,Z.useState)(``),[re,W]=(0,Z.useState)(``),[G,ie]=(0,Z.useState)(``),[ae,se]=(0,Z.useState)(!1),[ce,q]=(0,Z.useState)(!1),[ue,de]=(0,Z.useState)(!1),[fe,me]=(0,Z.useState)(!1);Sr(`GitOpsButton mount thread=${t}`).done();let J=Mr(t),he=li(t,e,n.projectModelSelections);async function ge(){let e=Sr(`GitOpsButton refreshProjectsList thread=${t}`);le();let n=await C();r({type:Y.SetProjects,projects:n.projects}),e.done()}let[_e,ve]=(0,Z.useState)(()=>ai()),ye=n.projects.find(t=>t.projectId===e),be=ye?.commitMethod===a.Direct;(0,Z.useEffect)(()=>{let e=Sr(`GitOpsButton focus listener setup thread=${t}`);function n(){document.visibilityState===`visible`&&J.fetchUnifiedStatus(!1)}return document.addEventListener(`visibilitychange`,n),window.addEventListener(`focus`,n),e.done(),()=>{document.removeEventListener(`visibilitychange`,n),window.removeEventListener(`focus`,n)}},[J.fetchUnifiedStatus,t]),(0,Z.useEffect)(()=>{B&&ye?.name&&!ne&&H(ye.name)},[B,ye?.name,ne]),(0,Z.useEffect)(()=>{oi(_e)},[_e]);function xe(){ae||(se(!0),d().then(e=>ie(e)).catch(()=>{}))}(0,Z.useEffect)(()=>{if(!u){D.current=!1;return}if(u&&_e.autoGenerateCommitMessage&&!h.trim()&&t&&!D.current){D.current=!0;async function e(){let e=await he.generateCommitMessageWithAI();e&&g(e)}e()}},[u,_e.autoGenerateCommitMessage,t,he.generateCommitMessageWithAI,h]),(0,Z.useEffect)(()=>{if(!p){E.current=!1;return}if(p&&_e.autoGeneratePRInfo&&!O.current.trim()&&!k.current.trim()&&t&&!E.current){E.current=!0;async function e(){let e=await he.generatePRInfoWithAI();e&&(v(e.title),b(e.description),It({title:`Success`,description:`PR title and description generated`}))}e()}},[p,_e.autoGeneratePRInfo,t,he.generatePRInfoWithAI]),(0,Z.useEffect)(()=>{J.prExists&&J.prState===`MERGED`&&me(!0),s&&J.prExists&&J.prState===`OPEN`&&l(!1)},[J.prExists,J.prState,t,s]),(0,Z.useEffect)(()=>{if(!s)return;let e=setTimeout(()=>{l(!1)},15e3);return()=>clearTimeout(e)},[s]),(0,Z.useEffect)(()=>{if(!n.isStreaming&&n.completedThreadIds.includes(n.selectedThreadId??``)){let e=setTimeout(()=>{J.fetchUnifiedStatus(!1),r({type:Y.ClearThreadCompleted,threadId:n.selectedThreadId??``})},1e3);return()=>clearTimeout(e)}},[n.isStreaming,n.completedThreadIds,n.selectedThreadId,J,r]);async function Se(){if(h.trim()&&si(t))try{o(!0),await K(t,h),g(``),f(!1),await J.fetchUnifiedStatus(!0),ge(),It({title:`Changes committed successfully`,description:`Your changes have been committed to '${J.currentBranch}'.`}),ue&&(de(!1),await Oe())}catch(e){console.error(`Failed to commit:`,e),It({title:`Commit failed`,description:e instanceof Error?e.message:`Failed to commit changes`,variant:`destructive`})}finally{o(!1)}}async function Ce(){if(J.status===`Behind`&&!J.hasChanges&&!J.hasUnpushedCommits){await Me();return}if(J.hasChanges){f(!0);return}if(J.prExists&&J.prState===`OPEN`&&!J.hasChanges&&!J.hasUnpushedCommits){J.prUrl&&await Ue(J.prUrl);return}if(J.commitsAheadOfDefault&&!J.prExists&&!J.hasChanges){m(!0);return}if(J.hasUnpushedCommits&&J.prExists){await Ee();return}}async function we(){let e=await he.generateCommitMessageWithAI();e&&g(e)}async function Te(){if(si(t))try{o(!0),await F(t),await J.fetchUnifiedStatus()}catch(e){console.error(`Failed to fetch:`,e)}finally{o(!1)}}async function Ee(){if(si(t))try{o(!0),await We(t),await J.fetchUnifiedStatus(!0),ge(),J.hasRemoteBranch?It({title:`Branch pushed successfully`,description:`Your branch '${J.currentBranch}' has been pushed to the remote.`}):It({title:`Push completed`,description:`Changes have been pushed successfully.`})}catch(e){console.error(`Failed to push:`,e),It({title:`Push failed`,description:e instanceof Error?e.message:`Failed to push to remote`,variant:`destructive`})}finally{o(!1)}}async function De(){if(si(t)){if(J.hasChanges){q(!0);return}await Oe()}}async function Oe(){try{o(!0),await pe(t),await J.fetchUnifiedStatus(!0),ge(),It({title:`Pull successful`,description:`Latest changes have been pulled from remote.`})}catch(e){console.error(`Failed to pull:`,e),It({title:`Pull failed`,description:e instanceof Error?e.message:`Failed to pull from remote`,variant:`destructive`})}finally{o(!1)}}function ke(){q(!1),de(!0),f(!0)}async function Ae(){q(!1),await Oe()}async function je(){if(t)try{o(!0);let e=await U(t);le();let n=await C();r({type:Y.SetProjects,projects:n.projects}),It({title:`New branch created`,description:`Created new branch "${e.branchName}" on current thread`}),me(!1),await J.fetchUnifiedStatus(!0),setTimeout(()=>void J.fetchUnifiedStatus(!0),1500)}catch(e){console.error(`Failed to create new branch:`,e),It({title:`Failed to create new branch`,description:e instanceof Error?e.message:`Unknown error occurred`,variant:`destructive`})}finally{o(!1)}}async function Me(){if(si(t))try{o(!0),await Ve(t),await J.fetchUnifiedStatus(!0),ge(),It({title:`Branch synced successfully`,description:`Your branch '${J.currentBranch}' has been synced with the latest changes`})}catch(e){console.error(`[sync] ✗ Failed to sync branch:`,e),It({title:`Sync failed`,description:e instanceof Error?e.message:`Failed to sync with default branch`,variant:`destructive`})}finally{o(!1)}}async function Ne(){if(si(t))try{o(!0),l(!0);let e=await oe(t,_,y);e.prUrl&&await Ue(e.prUrl),v(``),b(``),m(!1),await J.fetchUnifiedStatus(!0),ge();let n=0,r=setInterval(async()=>{if(n++,n>=6){clearInterval(r);return}await J.fetchUnifiedStatus(!0)},2e3)}catch(e){console.error(`Failed to create PR:`,e);let t=e instanceof Error?e.message:`Failed to create PR`;t.includes(`push the current branch`)||t.includes(`--head flag`)?(m(!1),Ie({title:_,description:y})):(l(!1),It({title:`Create PR Failed`,description:t,variant:`destructive`}))}finally{o(!1)}}async function Pe(){if(si(t))try{o(!0);let e=await c(t,ne,re,_e.privateRepositoryDefault);e.repoUrl&&setTimeout(()=>{Ue(e.repoUrl)},3e3),H(``),W(``),V(!1),await J.fetchUnifiedStatus(),ge()}catch(e){console.error(`Failed to create repo:`,e)}finally{o(!1)}}async function Fe(){let e=await he.generatePRInfoWithAI();e&&(v(e.title),b(e.description),It({title:`Success`,description:`PR title and description generated`}))}async function Ie(e){let n=e??w;if(!(!t||!n))try{o(!0),l(!0);try{await We(t)}catch(e){let n=e?.message??``;if(n.includes(`non-fast-forward`)||n.includes(`Updates were rejected because the tip of your current branch is behind`)){It({title:`Syncing branch before push`,description:`Your branch is behind remote. Pulling latest changes first...`});try{await Ve(t),await We(t)}catch{throw e}}else throw e}let e=await oe(t,n.title,n.description);e.prUrl&&await Ue(e.prUrl),v(``),b(``),T(null),S(!1),await J.fetchUnifiedStatus(!0),ge();let r=0,i=setInterval(async()=>{if(r++,r>=6){clearInterval(i);return}await J.fetchUnifiedStatus(!0)},2e3)}catch(e){console.error(`Failed to push and create PR:`,e);let t=e instanceof Error?e.message:`Failed to push and create PR`;l(!1),It({title:`Push & Create PR Failed`,description:t,variant:`destructive`})}finally{o(!1)}}async function Le(){if(si(t))try{I(!0);let e=await tt(t,100);P(e),R(e.slice(0,10)),M(!0)}catch(e){console.error(`Failed to fetch git history:`,e)}finally{I(!1)}}function Re(){z||(te(!0),setTimeout(()=>{let e=L.length+10;R(N.slice(0,e)),te(!1)},300))}function ze(e){let t=e.currentTarget;t.scrollHeight-t.scrollTop-t.clientHeight<100&&L.length<N.length&&!z&&Re()}let Be=ri(J);function He(){J.repoUrl&&Ue(J.repoUrl)}function Ge(){S(!1),T(null)}function Ke(){me(!1),J.fetchUnifiedStatus(!0)}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-0`,children:[(0,Q.jsx)(Mt,{children:(0,Q.jsxs)(Nt,{children:[(0,Q.jsx)(Pt,{asChild:!0,children:(0,Q.jsxs)(A,{variant:`outline`,size:`sm`,className:`h-8 rounded-r-none border-r-0 gap-1.5 border-transparent${Be?` bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground`:``}`,disabled:ni(J,i,s),onClick:Ce,children:[ei(J,s),$r(J,s)]})}),(0,Q.jsx)(jt,{children:ti(J)})]})}),(0,Q.jsx)(ii,{branchStatus:J.status,remoteUrl:J.remoteUrl,hasRemoteBranch:J.hasRemoteBranch,hasUnpushedCommits:J.hasUnpushedCommits,canCreateRepo:J.canCreateRepo,repoUrl:J.repoUrl,isRefreshing:J.isRefreshing,isBrandState:Be,gitUser:G,isDirectCommitMode:be,isLoading:i||s,isLoadingHistory:ee,onFetch:()=>void Te(),onPull:()=>void De(),onPush:()=>void Ee(),onOpenHistory:()=>void Le(),onCreatePR:()=>m(!0),onCreateRepo:()=>V(!0),onViewInGitHub:He,onOpenChange:e=>{e&&xe()}})]}),(0,Q.jsxs)(Z.Suspense,{fallback:(0,Q.jsx)(_i,{}),children:[(0,Q.jsx)(ui,{open:u,onOpenChange:f,commitMessage:h,onCommitMessageChange:g,autoGenerateCommitMessage:_e.autoGenerateCommitMessage,onAutoGenerateChange:e=>ve(t=>({...t,autoGenerateCommitMessage:e})),isGeneratingMessage:he.isGeneratingMessage,isLoading:i,onGenerateMessage:we,onCommit:Se,currentBranch:J.currentBranch}),(0,Q.jsx)(di,{open:p,onOpenChange:m,prTitle:_,onPrTitleChange:v,prDescription:y,onPrDescriptionChange:b,isGeneratingPRInfo:he.isGeneratingPRInfo,isLoading:i,onGeneratePRInfo:Fe,onCreatePR:Ne,currentBranch:J.currentBranch,autoGeneratePRInfo:_e.autoGeneratePRInfo,onAutoGeneratePRInfoChange:e=>ve(t=>({...t,autoGeneratePRInfo:e}))}),(0,Q.jsx)(mi,{open:x,onOpenChange:S,isLoading:i,onPushAndCreatePR:Ie,onCancel:Ge}),(0,Q.jsx)(fi,{open:B,onOpenChange:V,repoName:ne,onRepoNameChange:H,repoDescription:re,onRepoDescriptionChange:W,isPrivateRepo:_e.privateRepositoryDefault,onPrivateRepoChange:e=>ve(t=>({...t,privateRepositoryDefault:e})),isLoading:i,onCreateRepo:Pe}),(0,Q.jsx)(pi,{open:j,onOpenChange:M,commits:N,displayedCommits:L,isLoadingMore:z,onScroll:ze,currentBranch:J.currentBranch}),(0,Q.jsx)(hi,{open:ce,onOpenChange:q,onCommitFirst:ke,onStashAndPull:Ae,onCancel:()=>q(!1),isLoading:i}),(0,Q.jsx)(gi,{open:fe,onOpenChange:me,onNewBranch:je,onJustOpen:Ke,isLoading:i})]})]})}function yi(e){let t=(0,X.c)(59),{messages:n}=e,r;t[0]===n?r=t[1]:(r=n===void 0?[]:n,t[0]=n,t[1]=r);let i=r,{state:a,dispatch:o}=Et(),{isCreatingProject:s,selectedThreadId:c,selectedProjectId:l}=a,{handleSend:u,handleStop:d,isStreaming:f,queuedMessagesForThread:p,handleRemoveQueuedMessage:m,showEmptyBalanceDialog:h,setShowEmptyBalanceDialog:_}=Gr(),v=a.pendingChatMessage?.threadId===c,y=f||v,b=i.length>0,{hasChanges:S,changedFilesCount:C}=Mr(c??void 0),{setActiveMainTab:w}=Ut(),{toast:T}=Ft(),E;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(E=[],t[2]=E):E=t[2];let[D,O]=(0,Z.useState)(E),k,j;t[3]!==c||t[4]!==T?(k=()=>{if(!c){O([]);return}let e=!1;return(async function(){try{let t=await ze(c);e||O(t)}catch(t){e||(console.error(`Failed to load user tasks:`,t),T({title:`Could not load tasks`,description:`Failed to load UserTasks for this thread.`,variant:`destructive`}))}})(),()=>{e=!0}},j=[c,T],t[3]=c,t[4]=T,t[5]=k,t[6]=j):(k=t[5],j=t[6]),(0,Z.useEffect)(k,j);let M;t[7]!==o||t[8]!==c?(M=async()=>{if(c)try{let e=await x(c);o({type:Y.ClearMessages}),console.log(`New conversation started:`,e);let t=await ve(c);o({type:Y.SetMessages,messages:t.messages})}catch(e){console.error(`Failed to start new chat:`,e)}},t[7]=o,t[8]=c,t[9]=M):M=t[9];let N=M,P;t[10]!==c||t[11]!==T?(P=async function(e){if(c)try{await Ke(c,e),O(t=>t.filter(t=>t.id!==e))}catch(e){console.error(`Failed to delete user task:`,e),T({title:`Could not remove task`,description:`Failed to delete the selected task.`,variant:`destructive`})}},t[10]=c,t[11]=T,t[12]=P):P=t[12];let ee=P,F;t[13]!==o||t[14]!==c?(F=function(e){c&&o({type:Y.SetChatInputDraft,threadId:c,draft:e.content})},t[13]=o,t[14]=c,t[15]=F):F=t[15];let I=F,L;t[16]===_?L=t[17]:(L=()=>_(!1),t[16]=_,t[17]=L);let R;t[18]!==h||t[19]!==L?(R=(0,Q.jsx)(Kr,{open:h,onClose:L}),t[18]=h,t[19]=L,t[20]=R):R=t[20];let z;t[21]!==C||t[22]!==y||t[23]!==N||t[24]!==ee||t[25]!==I||t[26]!==S||t[27]!==b||t[28]!==s||t[29]!==l||t[30]!==c||t[31]!==w||t[32]!==D?(z=(b||S||D.length>0||c&&l)&&(0,Q.jsxs)(`div`,{className:`absolute -top-12 left-0 z-10 ml-8 flex flex-wrap items-center gap-2`,children:[b&&(0,Q.jsxs)(A,{variant:`outline`,size:`sm`,className:`gap-2`,onClick:N,children:[(0,Q.jsx)(Ze,{className:`h-4 w-4 shrink-0`}),`New Chat`]}),S&&(0,Q.jsxs)(A,{variant:`outline`,size:`sm`,className:`gap-2`,onClick:()=>w(`review`),children:[(0,Q.jsx)(g,{className:`h-4 w-4 shrink-0`}),C,` `,C===1?`File`:`Files`,` Changed`]}),D.length>0&&(0,Q.jsx)(Qr,{tasks:D,disabled:y||!c&&!s,onSelectTask:I,onRemoveTask:e=>{ee(e)}}),c&&l&&(0,Q.jsx)(vi,{projectId:l,threadId:c}),b&&(0,Q.jsx)(Xr,{})]}),t[21]=C,t[22]=y,t[23]=N,t[24]=ee,t[25]=I,t[26]=S,t[27]=b,t[28]=s,t[29]=l,t[30]=c,t[31]=w,t[32]=D,t[33]=z):z=t[33];let te=!c&&!s,B;t[34]===ee?B=t[35]:(B=e=>{ee(e.id)},t[34]=ee,t[35]=B);let V;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(V=e=>{O(t=>[...t,e])},t[36]=V):V=t[36];let ne;t[37]!==y||t[38]!==m||t[39]!==u||t[40]!==d||t[41]!==p||t[42]!==te||t[43]!==B||t[44]!==D?(ne=(0,Q.jsx)(rr,{onSend:u,onStop:d,isStreaming:y,disabled:te,initialValue:``,queuedMessages:p,onRemoveQueuedMessage:m,isOverlay:!1,userTasks:D,onMatchedUserTaskSend:B,onUserTaskCreated:V}),t[37]=y,t[38]=m,t[39]=u,t[40]=d,t[41]=p,t[42]=te,t[43]=B,t[44]=D,t[45]=ne):ne=t[45];let H;t[46]!==z||t[47]!==ne?(H=(0,Q.jsxs)(`div`,{className:`relative`,children:[z,ne]}),t[46]=z,t[47]=ne,t[48]=H):H=t[48];let re=c??void 0,U;t[49]!==y||t[50]!==i||t[51]!==re?(U=(0,Q.jsx)(Lr,{threadId:re,isStreaming:y,messages:i}),t[49]=y,t[50]=i,t[51]=re,t[52]=U):U=t[52];let W;t[53]!==H||t[54]!==U?(W=(0,Q.jsxs)(`div`,{className:`relative mx-auto min-w-[400px] w-[90vw] max-w-3xl`,children:[H,U]}),t[53]=H,t[54]=U,t[55]=W):W=t[55];let G;return t[56]!==R||t[57]!==W?(G=(0,Q.jsxs)(Q.Fragment,{children:[R,W]}),t[56]=R,t[57]=W,t[58]=G):G=t[58],G}export{en as _,zn as a,In as c,cn as d,ln as f,Qt as g,rn as h,Rn as i,Pn as l,nn as m,Ur as n,Fn as o,an as p,Nn as r,Ln as s,yi as t,fn as u,$t as v,Zt as y};
@@ -0,0 +1 @@
1
+ import{$n as e,Ea as t,Hr as n,Ni as r,Nr as i,Qn as a,Yn as o,er as ee,nr as te,rr as s,si as c,tr as l}from"./dialogs-config-CV8HzCCA.js";import{t as u}from"./textarea-CU-XhvgE.js";import{c as d,l as f,s as p,u as m}from"./history-view-DDpROJvQ.js";import{o as h}from"./onboarding-BEy4bi0g.js";var g=t(),_=n();function v(t){let n=(0,g.c)(57),{open:v,onOpenChange:y,commitMessage:b,onCommitMessageChange:x,autoGenerateCommitMessage:S,onAutoGenerateChange:C,isGeneratingMessage:w,isLoading:T,onGenerateMessage:E,onCommit:D,currentBranch:O}=t,k;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,_.jsx)(s,{children:`Commit Changes`}),n[0]=k):k=n[0];let A;n[1]===O?A=n[2]:(A=(0,_.jsxs)(te,{children:[k,(0,_.jsxs)(ee,{children:[`Enter a commit message for your changes on branch `,O]})]}),n[1]=O,n[2]=A);let j;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,_.jsx)(o,{htmlFor:`commit-message`,children:`Commit Message`}),n[3]=j):j=n[3];let M;n[4]===x?M=n[5]:(M=e=>x(e.target.value),n[4]=x,n[5]=M);let N;n[6]!==b||n[7]!==M?(N=(0,_.jsx)(u,{id:`commit-message`,placeholder:`Enter commit message...`,value:b,onChange:M,rows:4,className:`pr-10`}),n[6]=b,n[7]=M,n[8]=N):N=n[8];let P=w||T,F;n[9]===w?F=n[10]:(F=w?(0,_.jsx)(r,{className:`h-3.5 w-3.5 animate-spin`}):(0,_.jsx)(c,{className:`h-3.5 w-3.5`}),n[9]=w,n[10]=F);let I;n[11]!==E||n[12]!==P||n[13]!==F?(I=(0,_.jsx)(m,{asChild:!0,children:(0,_.jsx)(i,{type:`button`,variant:`ghost`,size:`icon`,className:`absolute top-2 right-2 h-6 w-6`,onClick:E,disabled:P,children:F})}),n[11]=E,n[12]=P,n[13]=F,n[14]=I):I=n[14];let L=w?`Generating commit message...`:`Generate commit message with AI`,R;n[15]===L?R=n[16]:(R=(0,_.jsx)(d,{children:L}),n[15]=L,n[16]=R);let z;n[17]!==R||n[18]!==I?(z=(0,_.jsx)(f,{children:(0,_.jsxs)(p,{children:[I,R]})}),n[17]=R,n[18]=I,n[19]=z):z=n[19];let B;n[20]!==z||n[21]!==N?(B=(0,_.jsxs)(`div`,{className:`grid gap-2`,children:[j,(0,_.jsxs)(`div`,{className:`relative`,children:[N,z]})]}),n[20]=z,n[21]=N,n[22]=B):B=n[22];let V;n[23]===C?V=n[24]:(V=e=>C(e===!0),n[23]=C,n[24]=V);let H;n[25]!==S||n[26]!==V?(H=(0,_.jsx)(h,{id:`auto-generate`,checked:S,onCheckedChange:V}),n[25]=S,n[26]=V,n[27]=H):H=n[27];let U;n[28]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,_.jsx)(o,{htmlFor:`auto-generate`,className:`text-sm font-normal`,children:`Auto generate commit messages`}),n[28]=U):U=n[28];let W;n[29]===H?W=n[30]:(W=(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[H,U]}),n[29]=H,n[30]=W);let G;n[31]!==B||n[32]!==W?(G=(0,_.jsxs)(`div`,{className:`grid gap-4 py-4`,children:[B,W]}),n[31]=B,n[32]=W,n[33]=G):G=n[33];let K;n[34]===y?K=n[35]:(K=()=>y(!1),n[34]=y,n[35]=K);let q;n[36]!==T||n[37]!==K?(q=(0,_.jsx)(i,{variant:`outline`,onClick:K,disabled:T,children:`Cancel`}),n[36]=T,n[37]=K,n[38]=q):q=n[38];let J;n[39]!==b||n[40]!==T?(J=T||!b.trim(),n[39]=b,n[40]=T,n[41]=J):J=n[41];let Y=T?`Committing...`:`Commit`,X;n[42]!==D||n[43]!==J||n[44]!==Y?(X=(0,_.jsx)(i,{onClick:D,disabled:J,children:Y}),n[42]=D,n[43]=J,n[44]=Y,n[45]=X):X=n[45];let Z;n[46]!==q||n[47]!==X?(Z=(0,_.jsxs)(l,{children:[q,X]}),n[46]=q,n[47]=X,n[48]=Z):Z=n[48];let Q;n[49]!==G||n[50]!==A||n[51]!==Z?(Q=(0,_.jsxs)(e,{children:[A,G,Z]}),n[49]=G,n[50]=A,n[51]=Z,n[52]=Q):Q=n[52];let $;return n[53]!==y||n[54]!==v||n[55]!==Q?($=(0,_.jsx)(a,{open:v,onOpenChange:y,children:Q}),n[53]=y,n[54]=v,n[55]=Q,n[56]=$):$=n[56],$}export{v as CommitDialog};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Fr as t,Or as n,_a as r,la as i,oa as a,ta as o,ya as s}from"./dialogs-config-VlhyoYms.js";import{C as c,T as l,_ as u,b as d,d as f,f as p,g as m,h,m as g,w as _,x as v,y}from"./react-vendor-CtZx3FWA.js";var b=r(),x=e(s(),1),S=t(),C=d,w=l,T=x.forwardRef((e,t)=>{let r=(0,b.c)(14),i,o,s,c;r[0]===e?(i=r[1],o=r[2],s=r[3],c=r[4]):({className:o,inset:s,children:i,...c}=e,r[0]=e,r[1]=i,r[2]=o,r[3]=s,r[4]=c);let l=s&&`pl-8`,u;r[5]!==o||r[6]!==l?(u=n(`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),r[5]=o,r[6]=l,r[7]=u):u=r[7];let d;r[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,S.jsx)(a,{className:`ml-auto h-4 w-4`}),r[8]=d):d=r[8];let f;return r[9]!==i||r[10]!==c||r[11]!==t||r[12]!==u?(f=(0,S.jsxs)(_,{ref:t,className:u,...c,children:[i,d]}),r[9]=i,r[10]=c,r[11]=t,r[12]=u,r[13]=f):f=r[13],f});T.displayName=_.displayName;var E=x.forwardRef((e,t)=>{let r=(0,b.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=n(`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),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==t||r[7]!==o?(s=(0,S.jsx)(c,{ref:t,className:o,...a}),r[5]=a,r[6]=t,r[7]=o,r[8]=s):s=r[8],s});E.displayName=c.displayName;var D=x.forwardRef((e,t)=>{let r=(0,b.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=n(`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),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==t||r[7]!==o?(s=(0,S.jsx)(u,{children:(0,S.jsx)(p,{ref:t,className:o,...a})}),r[5]=a,r[6]=t,r[7]=o,r[8]=s):s=r[8],s});D.displayName=p.displayName;var O=x.forwardRef((e,t)=>{let r=(0,b.c)(11),i,a,o;r[0]===e?(i=r[1],a=r[2],o=r[3]):({className:i,inset:a,...o}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o);let s=a&&`pl-8`,c;r[4]!==i||r[5]!==s?(c=n(`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),r[4]=i,r[5]=s,r[6]=c):c=r[6];let l;return r[7]!==o||r[8]!==t||r[9]!==c?(l=(0,S.jsx)(g,{ref:t,className:c,...o}),r[7]=o,r[8]=t,r[9]=c,r[10]=l):l=r[10],l});O.displayName=g.displayName;var k=x.forwardRef((e,t)=>{let r=(0,b.c)(14),a,o,s,c;r[0]===e?(a=r[1],o=r[2],s=r[3],c=r[4]):({className:s,children:o,checked:a,...c}=e,r[0]=e,r[1]=a,r[2]=o,r[3]=s,r[4]=c);let l;r[5]===s?l=r[6]:(l=n(`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),r[5]=s,r[6]=l);let u;r[7]===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)(h,{children:(0,S.jsx)(i,{className:`h-4 w-4`})})}),r[7]=u):u=r[7];let d;return r[8]!==a||r[9]!==o||r[10]!==c||r[11]!==t||r[12]!==l?(d=(0,S.jsxs)(f,{ref:t,className:l,checked:a,...c,children:[u,o]}),r[8]=a,r[9]=o,r[10]=c,r[11]=t,r[12]=l,r[13]=d):d=r[13],d});k.displayName=f.displayName;var A=x.forwardRef((e,t)=>{let r=(0,b.c)(12),i,a,s;r[0]===e?(i=r[1],a=r[2],s=r[3]):({className:a,children:i,...s}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=s);let c;r[4]===a?c=r[5]:(c=n(`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),r[4]=a,r[5]=c);let l;r[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,S.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,S.jsx)(h,{children:(0,S.jsx)(o,{className:`h-2 w-2 fill-current`})})}),r[6]=l):l=r[6];let u;return r[7]!==i||r[8]!==s||r[9]!==t||r[10]!==c?(u=(0,S.jsxs)(y,{ref:t,className:c,...s,children:[l,i]}),r[7]=i,r[8]=s,r[9]=t,r[10]=c,r[11]=u):u=r[11],u});A.displayName=y.displayName;var j=x.forwardRef((e,t)=>{let r=(0,b.c)(11),i,a,o;r[0]===e?(i=r[1],a=r[2],o=r[3]):({className:i,inset:a,...o}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o);let s=a&&`pl-8`,c;r[4]!==i||r[5]!==s?(c=n(`px-2 py-1.5 text-sm font-semibold text-foreground`,s,i),r[4]=i,r[5]=s,r[6]=c):c=r[6];let l;return r[7]!==o||r[8]!==t||r[9]!==c?(l=(0,S.jsx)(m,{ref:t,className:c,...o}),r[7]=o,r[8]=t,r[9]=c,r[10]=l):l=r[10],l});j.displayName=m.displayName;var M=x.forwardRef((e,t)=>{let r=(0,b.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=n(`-mx-1 my-1 h-px bg-border`,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==t||r[7]!==o?(s=(0,S.jsx)(v,{ref:t,className:o,...a}),r[5]=a,r[6]=t,r[7]=o,r[8]=s):s=r[8],s});M.displayName=v.displayName;var N=e=>{let t=(0,b.c)(8),r,i;t[0]===e?(r=t[1],i=t[2]):({className:r,...i}=e,t[0]=e,t[1]=r,t[2]=i);let a;t[3]===r?a=t[4]:(a=n(`ml-auto text-xs tracking-widest text-muted-foreground`,r),t[3]=r,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{Ea as t,Fr as n,Hr as r,Oa as i,ha as a,ua as o,va as s}from"./dialogs-config-CV8HzCCA.js";import{C as c,T as l,_ as u,b as d,d as f,f as p,g as m,h,m as g,w as _,x as v,y}from"./react-vendor-DV_DP0Qd.js";var b=t(),x=e(i(),1),S=r(),C=d,w=l,T=x.forwardRef((e,t)=>{let r=(0,b.c)(14),i,o,s,c;r[0]===e?(i=r[1],o=r[2],s=r[3],c=r[4]):({className:o,inset:s,children:i,...c}=e,r[0]=e,r[1]=i,r[2]=o,r[3]=s,r[4]=c);let l=s&&`pl-8`,u;r[5]!==o||r[6]!==l?(u=n(`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),r[5]=o,r[6]=l,r[7]=u):u=r[7];let d;r[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,S.jsx)(a,{className:`ml-auto h-4 w-4`}),r[8]=d):d=r[8];let f;return r[9]!==i||r[10]!==c||r[11]!==t||r[12]!==u?(f=(0,S.jsxs)(_,{ref:t,className:u,...c,children:[i,d]}),r[9]=i,r[10]=c,r[11]=t,r[12]=u,r[13]=f):f=r[13],f});T.displayName=_.displayName;var E=x.forwardRef((e,t)=>{let r=(0,b.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=n(`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),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==t||r[7]!==o?(s=(0,S.jsx)(c,{ref:t,className:o,...a}),r[5]=a,r[6]=t,r[7]=o,r[8]=s):s=r[8],s});E.displayName=c.displayName;var D=x.forwardRef((e,t)=>{let r=(0,b.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=n(`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),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==t||r[7]!==o?(s=(0,S.jsx)(u,{children:(0,S.jsx)(p,{ref:t,className:o,...a})}),r[5]=a,r[6]=t,r[7]=o,r[8]=s):s=r[8],s});D.displayName=p.displayName;var O=x.forwardRef((e,t)=>{let r=(0,b.c)(11),i,a,o;r[0]===e?(i=r[1],a=r[2],o=r[3]):({className:i,inset:a,...o}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o);let s=a&&`pl-8`,c;r[4]!==i||r[5]!==s?(c=n(`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),r[4]=i,r[5]=s,r[6]=c):c=r[6];let l;return r[7]!==o||r[8]!==t||r[9]!==c?(l=(0,S.jsx)(g,{ref:t,className:c,...o}),r[7]=o,r[8]=t,r[9]=c,r[10]=l):l=r[10],l});O.displayName=g.displayName;var k=x.forwardRef((e,t)=>{let r=(0,b.c)(14),i,a,o,c;r[0]===e?(i=r[1],a=r[2],o=r[3],c=r[4]):({className:o,children:a,checked:i,...c}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o,r[4]=c);let l;r[5]===o?l=r[6]:(l=n(`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),r[5]=o,r[6]=l);let u;r[7]===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)(h,{children:(0,S.jsx)(s,{className:`h-4 w-4`})})}),r[7]=u):u=r[7];let d;return r[8]!==i||r[9]!==a||r[10]!==c||r[11]!==t||r[12]!==l?(d=(0,S.jsxs)(f,{ref:t,className:l,checked:i,...c,children:[u,a]}),r[8]=i,r[9]=a,r[10]=c,r[11]=t,r[12]=l,r[13]=d):d=r[13],d});k.displayName=f.displayName;var A=x.forwardRef((e,t)=>{let r=(0,b.c)(12),i,a,s;r[0]===e?(i=r[1],a=r[2],s=r[3]):({className:a,children:i,...s}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=s);let c;r[4]===a?c=r[5]:(c=n(`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),r[4]=a,r[5]=c);let l;r[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,S.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,S.jsx)(h,{children:(0,S.jsx)(o,{className:`h-2 w-2 fill-current`})})}),r[6]=l):l=r[6];let u;return r[7]!==i||r[8]!==s||r[9]!==t||r[10]!==c?(u=(0,S.jsxs)(y,{ref:t,className:c,...s,children:[l,i]}),r[7]=i,r[8]=s,r[9]=t,r[10]=c,r[11]=u):u=r[11],u});A.displayName=y.displayName;var j=x.forwardRef((e,t)=>{let r=(0,b.c)(11),i,a,o;r[0]===e?(i=r[1],a=r[2],o=r[3]):({className:i,inset:a,...o}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o);let s=a&&`pl-8`,c;r[4]!==i||r[5]!==s?(c=n(`px-2 py-1.5 text-sm font-semibold text-foreground`,s,i),r[4]=i,r[5]=s,r[6]=c):c=r[6];let l;return r[7]!==o||r[8]!==t||r[9]!==c?(l=(0,S.jsx)(m,{ref:t,className:c,...o}),r[7]=o,r[8]=t,r[9]=c,r[10]=l):l=r[10],l});j.displayName=m.displayName;var M=x.forwardRef((e,t)=>{let r=(0,b.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=n(`-mx-1 my-1 h-px bg-border`,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==t||r[7]!==o?(s=(0,S.jsx)(v,{ref:t,className:o,...a}),r[5]=a,r[6]=t,r[7]=o,r[8]=s):s=r[8],s});M.displayName=v.displayName;var N=e=>{let t=(0,b.c)(8),r,i;t[0]===e?(r=t[1],i=t[2]):({className:r,...i}=e,t[0]=e,t[1]=r,t[2]=i);let a;t[3]===r?a=t[4]:(a=n(`ml-auto text-xs tracking-widest text-muted-foreground`,r),t[3]=r,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-DDpROJvQ.js";export{e as ConversationHistoryView,e as default};
@@ -0,0 +1 @@
1
+ import{$n as e,Ea as t,Hr as n,Nr as r,Qn as i,Yn as a,Zn as o,er as s,nr as c,rr as l,tr as u}from"./dialogs-config-CV8HzCCA.js";import{t as d}from"./textarea-CU-XhvgE.js";import{o as f}from"./onboarding-BEy4bi0g.js";var p=t(),m=n();function h(t){let n=(0,p.c)(48),{open:h,onOpenChange:g,repoName:_,onRepoNameChange:v,repoDescription:y,onRepoDescriptionChange:b,isPrivateRepo:x,onPrivateRepoChange:S,isLoading:C,onCreateRepo:w}=t,T;n[0]!==g||n[1]!==b||n[2]!==v?(T=e=>{e||(v(``),b(``)),g(e)},n[0]=g,n[1]=b,n[2]=v,n[3]=T):T=n[3];let E;n[4]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,m.jsxs)(c,{children:[(0,m.jsx)(l,{children:`Create GitHub Repository`}),(0,m.jsx)(s,{children:`Create a new GitHub repository and push your local repository`})]}),n[4]=E):E=n[4];let D;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,m.jsx)(a,{htmlFor:`repo-name`,children:`Repository Name (optional)`}),n[5]=D):D=n[5];let O;n[6]===v?O=n[7]:(O=e=>v(e.target.value),n[6]=v,n[7]=O);let k;n[8]!==_||n[9]!==O?(k=(0,m.jsxs)(`div`,{className:`grid gap-2`,children:[D,(0,m.jsx)(o,{id:`repo-name`,placeholder:`Leave empty to use current folder name`,value:_,onChange:O})]}),n[8]=_,n[9]=O,n[10]=k):k=n[10];let A;n[11]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,m.jsx)(a,{htmlFor:`repo-description`,children:`Description (optional)`}),n[11]=A):A=n[11];let j;n[12]===b?j=n[13]:(j=e=>b(e.target.value),n[12]=b,n[13]=j);let M;n[14]!==y||n[15]!==j?(M=(0,m.jsxs)(`div`,{className:`grid gap-2`,children:[A,(0,m.jsx)(d,{id:`repo-description`,placeholder:`Enter repository description...`,value:y,onChange:j,rows:3})]}),n[14]=y,n[15]=j,n[16]=M):M=n[16];let N;n[17]===S?N=n[18]:(N=e=>S(e===!0),n[17]=S,n[18]=N);let P;n[19]!==x||n[20]!==N?(P=(0,m.jsx)(f,{id:`repo-private`,checked:x,onCheckedChange:N}),n[19]=x,n[20]=N,n[21]=P):P=n[21];let F;n[22]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,m.jsx)(a,{htmlFor:`repo-private`,className:`text-sm font-normal`,children:`Private repository`}),n[22]=F):F=n[22];let I;n[23]===P?I=n[24]:(I=(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[P,F]}),n[23]=P,n[24]=I);let L;n[25]!==I||n[26]!==k||n[27]!==M?(L=(0,m.jsxs)(`div`,{className:`grid gap-4 py-4`,children:[k,M,I]}),n[25]=I,n[26]=k,n[27]=M,n[28]=L):L=n[28];let R;n[29]===g?R=n[30]:(R=()=>g(!1),n[29]=g,n[30]=R);let z;n[31]!==C||n[32]!==R?(z=(0,m.jsx)(r,{variant:`outline`,onClick:R,disabled:C,children:`Cancel`}),n[31]=C,n[32]=R,n[33]=z):z=n[33];let B=C?`Creating...`:`Create & Push`,V;n[34]!==C||n[35]!==w||n[36]!==B?(V=(0,m.jsx)(r,{onClick:w,disabled:C,children:B}),n[34]=C,n[35]=w,n[36]=B,n[37]=V):V=n[37];let H;n[38]!==z||n[39]!==V?(H=(0,m.jsxs)(u,{children:[z,V]}),n[38]=z,n[39]=V,n[40]=H):H=n[40];let U;n[41]!==L||n[42]!==H?(U=(0,m.jsxs)(e,{children:[E,L,H]}),n[41]=L,n[42]=H,n[43]=U):U=n[43];let W;return n[44]!==h||n[45]!==T||n[46]!==U?(W=(0,m.jsx)(i,{open:h,onOpenChange:T,children:U}),n[44]=h,n[45]=T,n[46]=U,n[47]=W):W=n[47],W}export{h as CreateRepoDialog};