tarsk 0.4.18 → 0.4.19

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 (43) hide show
  1. package/dist/index.js +2 -1
  2. package/dist/public/assets/{account-view-BCTSx-mj.js → account-view-Bbhl_jIc.js} +1 -1
  3. package/dist/public/assets/{api-CTYLCFyl.js → api-B28NOxKR.js} +1 -1
  4. package/dist/public/assets/{browser-tab-DU0hQ0Qt.js → browser-tab-os7ReSAI.js} +1 -1
  5. package/dist/public/assets/context-menu-Bs2ogSXU.js +1 -0
  6. package/dist/public/assets/conversation-history-view-DjyJh65Y.js +1 -0
  7. package/dist/public/assets/{dialogs-config-jWciSgHl.js → dialogs-config-D3xml4W2.js} +1 -1
  8. package/dist/public/assets/diff-view-702Bpg9H.js +3 -0
  9. package/dist/public/assets/explorer-tab-view-BvmxzUAs.js +2 -0
  10. package/dist/public/assets/explorer-tree-mCR_Wwfz.js +1 -0
  11. package/dist/public/assets/{explorer-view-Cbl_shds.js → explorer-view-BN9RAXjq.js} +1 -1
  12. package/dist/public/assets/history-view-BnRtfSte.js +1 -0
  13. package/dist/public/assets/index-BQ391mCU.css +1 -0
  14. package/dist/public/assets/index-CSGl7zru.js +51 -0
  15. package/dist/public/assets/onboarding-dialog-Ic62dkfi.js +1 -0
  16. package/dist/public/assets/onboarding-eQed-ZzK.js +1 -0
  17. package/dist/public/assets/{project-settings-view-Bu1Pw54-.js → project-settings-view-BsGGUbat.js} +1 -1
  18. package/dist/public/assets/{provider-details-view-BdnybbeE.js → provider-details-view-Di1Hw9Bi.js} +1 -1
  19. package/dist/public/assets/providers-sidebar-klkFVN5y.js +1 -0
  20. package/dist/public/assets/react-vendor-DcsTuVun.js +17 -0
  21. package/dist/public/assets/{settings-view--SOtQ4dD.js → settings-view-CF-gBfNl.js} +2 -2
  22. package/dist/public/assets/{store-CHZlq7-o.js → store-erJP4KTe.js} +1 -1
  23. package/dist/public/assets/{tab-context-Dt4dsRtJ.js → tab-context-CnzSKG0L.js} +1 -1
  24. package/dist/public/assets/{terminal-panel-BSrV0okI.js → terminal-panel-BhJSKgOW.js} +2 -2
  25. package/dist/public/assets/{textarea-QU8Nv9O7.js → textarea-C1e4J_5m.js} +1 -1
  26. package/dist/public/assets/todos-view-BtDv09d6.js +1 -0
  27. package/dist/public/assets/{use-toast-CoI8ds2n.js → use-toast-BZ7ir6gB.js} +1 -1
  28. package/dist/public/assets/{utils-CCEUAD_u.js → utils-CLxr_0Ql.js} +1 -1
  29. package/dist/public/index.html +11 -11
  30. package/package.json +1 -1
  31. package/dist/public/assets/context-menu-Dy4KkPRW.js +0 -1
  32. package/dist/public/assets/conversation-history-view-Dors7tOx.js +0 -1
  33. package/dist/public/assets/diff-view-dDf3oLmb.js +0 -3
  34. package/dist/public/assets/explorer-tab-view-HfudmHM2.js +0 -2
  35. package/dist/public/assets/explorer-tree-qIt5h_Zr.js +0 -1
  36. package/dist/public/assets/history-view-D0-oG6k6.js +0 -1
  37. package/dist/public/assets/index-DYQT8pCu.js +0 -51
  38. package/dist/public/assets/index-wptl__nQ.css +0 -1
  39. package/dist/public/assets/onboarding-DSX8c4T-.js +0 -1
  40. package/dist/public/assets/onboarding-dialog-nou5aY1L.js +0 -1
  41. package/dist/public/assets/providers-sidebar-F0N6061Y.js +0 -1
  42. package/dist/public/assets/react-vendor-C9VUgcc-.js +0 -17
  43. package/dist/public/assets/todos-view-DDLe_Dhz.js +0 -1
package/dist/index.js CHANGED
@@ -14110,7 +14110,8 @@ async function checkVp(c) {
14110
14110
  });
14111
14111
  const installed = result.status === 0;
14112
14112
  return c.json({ installed });
14113
- } catch (_) {
14113
+ } catch (error) {
14114
+ console.error("Failed to check vp installation:", error);
14114
14115
  return c.json({ installed: false });
14115
14116
  }
14116
14117
  }
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Cr as t,Gt as n,Pn as r,Vi as i,Wn as a,Z as o,da as s,la as c,mi as l,ta as u}from"./dialogs-config-jWciSgHl.js";import{t as d}from"./use-toast-CoI8ds2n.js";var f=e(s(),1),p=c(),m=t();function h(e){let t=(0,p.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=a(`animate-pulse rounded-md bg-muted`,n),t[3]=n,t[4]=i);let o;return t[5]!==r||t[6]!==i?(o=(0,m.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=o):o=t[7],o}function g(){let[e,t]=(0,f.useState)(null),[a,s]=(0,f.useState)(!0);(0,f.useEffect)(()=>{c();let e=()=>{document.visibilityState===`visible`&&c()};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]);async function c(){s(!0);try{t(await o())}catch(e){d({title:`Error`,description:e instanceof Error?e.message:`Failed to load account info`,variant:`destructive`})}finally{s(!1)}}function p(){n(`https://buy.stripe.com/14AcN6feK0Jjbheb2H3Nm03?client_reference_id=${e?.clientReferenceId??``}`)}function g(){n(`https://buy.stripe.com/9B67sMd6CgIh70Y0o33Nm04?client_reference_id=${e?.clientReferenceId??``}`)}if(a)return(0,m.jsxs)(`div`,{className:`max-w-2xl mx-auto p-6`,children:[(0,m.jsxs)(`div`,{className:`mb-6`,children:[(0,m.jsx)(h,{className:`h-8 w-32 mb-2`}),(0,m.jsx)(h,{className:`h-4 w-64`})]}),(0,m.jsxs)(`div`,{className:`space-y-6`,children:[(0,m.jsxs)(`div`,{className:`flex gap-4`,children:[(0,m.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-2`,children:[(0,m.jsx)(h,{className:`h-4 w-20`}),(0,m.jsx)(h,{className:`h-9 w-28`})]}),(0,m.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-3`,children:[(0,m.jsx)(h,{className:`h-4 w-24`}),(0,m.jsx)(h,{className:`h-6 w-32`}),(0,m.jsx)(h,{className:`h-4 w-full`})]})]}),(0,m.jsxs)(`div`,{className:`space-y-3`,children:[(0,m.jsx)(h,{className:`h-4 w-24`}),(0,m.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,m.jsxs)(`div`,{className:`space-y-1 flex-1`,children:[(0,m.jsx)(h,{className:`h-5 w-28`}),(0,m.jsx)(h,{className:`h-4 w-64`})]}),(0,m.jsx)(h,{className:`h-9 w-28 shrink-0`})]}),(0,m.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,m.jsxs)(`div`,{className:`space-y-1 flex-1`,children:[(0,m.jsx)(h,{className:`h-5 w-36`}),(0,m.jsx)(h,{className:`h-4 w-56`}),(0,m.jsx)(h,{className:`h-4 w-32`})]}),(0,m.jsx)(h,{className:`h-9 w-24 shrink-0`})]})]})]})]});let _=e?.plan===`unlimited-pro`;return(0,m.jsxs)(`div`,{className:`max-w-2xl mx-auto p-6`,children:[(0,m.jsxs)(`div`,{className:`mb-6`,children:[(0,m.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Account`}),(0,m.jsx)(`p`,{className:`text-muted-foreground`,children:`Manage your Tarsk plan and prompt balance.`})]}),(0,m.jsxs)(`div`,{className:`space-y-6`,children:[(0,m.jsxs)(`div`,{className:`flex gap-4`,children:[(0,m.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-2`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-muted-foreground`,children:[(0,m.jsx)(l,{className:`h-4 w-4`}),`Balance`]}),(0,m.jsx)(`div`,{className:`flex items-end gap-2`,children:_?(0,m.jsx)(`span`,{className:`text-3xl font-bold`,children:`Unlimited`}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:`text-3xl font-bold`,children:e?.promptsRemaining.toLocaleString()??0}),(0,m.jsx)(`span`,{className:`text-muted-foreground mb-1 text-sm`,children:`prompts remaining`})]})})]}),(0,m.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-3`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-muted-foreground`,children:[(0,m.jsx)(i,{className:`h-4 w-4`}),`Current Plan`]}),(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(`span`,{className:`text-lg font-semibold`,children:_?`Unlimited Pro`:`Pay as you go`}),_&&(0,m.jsx)(`span`,{className:`rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary`,children:`Active`})]}),(0,m.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:_?`You have unlimited prompts with no restrictions.`:`Purchase prompts as needed. Upgrade to Pro for unlimited access.`})]})]}),!_&&(0,m.jsxs)(`div`,{className:`space-y-3`,children:[(0,m.jsx)(`h2`,{className:`text-sm font-semibold text-muted-foreground uppercase tracking-wide`,children:`Add Prompts`}),(0,m.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,m.jsxs)(`div`,{className:`space-y-1`,children:[(0,m.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,m.jsx)(`span`,{className:`font-semibold`,children:`1,000 Prompts`})}),(0,m.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Top up your balance with 1,000 additional prompts for $5.`})]}),(0,m.jsx)(r,{onClick:p,className:`shrink-0`,children:`Top Up Balance`})]}),(0,m.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,m.jsxs)(`div`,{className:`space-y-1`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(i,{className:`h-4 w-4 text-primary`}),(0,m.jsx)(`span`,{className:`font-semibold`,children:`Unlimited Pro Plan`})]}),(0,m.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Unlimited prompts for $100 and lifetime access to Tarsk.`}),(0,m.jsxs)(`ul`,{className:`text-sm text-muted-foreground space-y-0.5`,children:[(0,m.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,m.jsx)(u,{className:`h-3 w-3 text-primary`}),`Unlimited prompts`]}),(0,m.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,m.jsx)(u,{className:`h-3 w-3 text-primary`}),`Priority access`]})]})]}),(0,m.jsx)(r,{onClick:g,className:`shrink-0`,children:`Purchase`})]})]})]})]})}export{g as default};
1
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{$i as t,Cr as n,Gt as r,Pn as i,Wn as a,Z as o,fi as s,la as c,sa as l,zi as u}from"./dialogs-config-D3xml4W2.js";import{t as d}from"./use-toast-BZ7ir6gB.js";var f=e(c(),1),p=l(),m=n();function h(e){let t=(0,p.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=a(`animate-pulse rounded-md bg-muted`,n),t[3]=n,t[4]=i);let o;return t[5]!==r||t[6]!==i?(o=(0,m.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=o):o=t[7],o}function g(){let[e,n]=(0,f.useState)(null),[a,c]=(0,f.useState)(!0);(0,f.useEffect)(()=>{l();let e=()=>{document.visibilityState===`visible`&&l()};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]);async function l(){c(!0);try{n(await o())}catch(e){d({title:`Error`,description:e instanceof Error?e.message:`Failed to load account info`,variant:`destructive`})}finally{c(!1)}}function p(){r(`https://buy.stripe.com/14AcN6feK0Jjbheb2H3Nm03?client_reference_id=${e?.clientReferenceId??``}`)}function g(){r(`https://buy.stripe.com/9B67sMd6CgIh70Y0o33Nm04?client_reference_id=${e?.clientReferenceId??``}`)}if(a)return(0,m.jsxs)(`div`,{className:`max-w-2xl mx-auto p-6`,children:[(0,m.jsxs)(`div`,{className:`mb-6`,children:[(0,m.jsx)(h,{className:`h-8 w-32 mb-2`}),(0,m.jsx)(h,{className:`h-4 w-64`})]}),(0,m.jsxs)(`div`,{className:`space-y-6`,children:[(0,m.jsxs)(`div`,{className:`flex gap-4`,children:[(0,m.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-2`,children:[(0,m.jsx)(h,{className:`h-4 w-20`}),(0,m.jsx)(h,{className:`h-9 w-28`})]}),(0,m.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-3`,children:[(0,m.jsx)(h,{className:`h-4 w-24`}),(0,m.jsx)(h,{className:`h-6 w-32`}),(0,m.jsx)(h,{className:`h-4 w-full`})]})]}),(0,m.jsxs)(`div`,{className:`space-y-3`,children:[(0,m.jsx)(h,{className:`h-4 w-24`}),(0,m.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,m.jsxs)(`div`,{className:`space-y-1 flex-1`,children:[(0,m.jsx)(h,{className:`h-5 w-28`}),(0,m.jsx)(h,{className:`h-4 w-64`})]}),(0,m.jsx)(h,{className:`h-9 w-28 shrink-0`})]}),(0,m.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,m.jsxs)(`div`,{className:`space-y-1 flex-1`,children:[(0,m.jsx)(h,{className:`h-5 w-36`}),(0,m.jsx)(h,{className:`h-4 w-56`}),(0,m.jsx)(h,{className:`h-4 w-32`})]}),(0,m.jsx)(h,{className:`h-9 w-24 shrink-0`})]})]})]})]});let _=e?.plan===`unlimited-pro`;return(0,m.jsxs)(`div`,{className:`max-w-2xl mx-auto p-6`,children:[(0,m.jsxs)(`div`,{className:`mb-6`,children:[(0,m.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Account`}),(0,m.jsx)(`p`,{className:`text-muted-foreground`,children:`Manage your Tarsk plan and prompt balance.`})]}),(0,m.jsxs)(`div`,{className:`space-y-6`,children:[(0,m.jsxs)(`div`,{className:`flex gap-4`,children:[(0,m.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-2`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-muted-foreground`,children:[(0,m.jsx)(s,{className:`h-4 w-4`}),`Balance`]}),(0,m.jsx)(`div`,{className:`flex items-end gap-2`,children:_?(0,m.jsx)(`span`,{className:`text-3xl font-bold`,children:`Unlimited`}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:`text-3xl font-bold`,children:e?.promptsRemaining.toLocaleString()??0}),(0,m.jsx)(`span`,{className:`text-muted-foreground mb-1 text-sm`,children:`prompts remaining`})]})})]}),(0,m.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-3`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-muted-foreground`,children:[(0,m.jsx)(u,{className:`h-4 w-4`}),`Current Plan`]}),(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(`span`,{className:`text-lg font-semibold`,children:_?`Unlimited Pro`:`Pay as you go`}),_&&(0,m.jsx)(`span`,{className:`rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary`,children:`Active`})]}),(0,m.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:_?`You have unlimited prompts with no restrictions.`:`Purchase prompts as needed. Upgrade to Pro for unlimited access.`})]})]}),!_&&(0,m.jsxs)(`div`,{className:`space-y-3`,children:[(0,m.jsx)(`h2`,{className:`text-sm font-semibold text-muted-foreground uppercase tracking-wide`,children:`Add Prompts`}),(0,m.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,m.jsxs)(`div`,{className:`space-y-1`,children:[(0,m.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,m.jsx)(`span`,{className:`font-semibold`,children:`1,000 Prompts`})}),(0,m.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Top up your balance with 1,000 additional prompts for $5.`})]}),(0,m.jsx)(i,{onClick:p,className:`shrink-0`,children:`Top Up Balance`})]}),(0,m.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,m.jsxs)(`div`,{className:`space-y-1`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(u,{className:`h-4 w-4 text-primary`}),(0,m.jsx)(`span`,{className:`font-semibold`,children:`Unlimited Pro Plan`})]}),(0,m.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Unlimited prompts for $100 and lifetime access to Tarsk.`}),(0,m.jsxs)(`ul`,{className:`text-sm text-muted-foreground space-y-0.5`,children:[(0,m.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,m.jsx)(t,{className:`h-3 w-3 text-primary`}),`Unlimited prompts`]}),(0,m.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,m.jsx)(t,{className:`h-3 w-3 text-primary`}),`Priority access`]})]})]}),(0,m.jsx)(i,{onClick:g,className:`shrink-0`,children:`Purchase`})]})]})]})]})}export{g as default};
@@ -1 +1 @@
1
- import{Cn as e,Dn as t,En as n,On as r,Sn as i,Tn as a,wn as o}from"./dialogs-config-jWciSgHl.js";async function s(t,n){return o(`api/threads/${e(t)}/explorer?path=${encodeURIComponent(n)}`)}async function c(t,n){return o(`api/threads/${e(t)}/ai-file?path=${encodeURIComponent(n)}`)}async function l(t,n,i){return r(`api/threads/${e(t)}/ai-file`,{path:n,content:i})}async function u(t,n){return i(`api/threads/${e(t)}/explorer?path=${encodeURIComponent(n)}`)}async function d(t,r,i){return n(`api/threads/${e(t)}/explorer`,{path:r,newName:i})}async function f(n,r,i){return t(`api/threads/${e(n)}/explorer/file`,{dirPath:r,name:i})}function p(t,n){return`${a()}/api/threads/${e(t)}/explorer/media?path=${encodeURIComponent(n)}`}async function m(n,r,i){return t(`api/threads/${e(n)}/explorer/folder`,{dirPath:r,name:i})}export{p as a,l as c,c as i,m as n,s as o,u as r,d as s,f as t};
1
+ import{Cn as e,Dn as t,En as n,On as r,Sn as i,Tn as a,wn as o}from"./dialogs-config-D3xml4W2.js";async function s(t,n){return o(`api/threads/${e(t)}/explorer?path=${encodeURIComponent(n)}`)}async function c(t,n){return o(`api/threads/${e(t)}/ai-file?path=${encodeURIComponent(n)}`)}async function l(t,n,i){return r(`api/threads/${e(t)}/ai-file`,{path:n,content:i})}async function u(t,n){return i(`api/threads/${e(t)}/explorer?path=${encodeURIComponent(n)}`)}async function d(t,r,i){return n(`api/threads/${e(t)}/explorer`,{path:r,newName:i})}async function f(n,r,i){return t(`api/threads/${e(n)}/explorer/file`,{dirPath:r,name:i})}function p(t,n){return`${a()}/api/threads/${e(t)}/explorer/media?path=${encodeURIComponent(n)}`}async function m(n,r,i){return t(`api/threads/${e(n)}/explorer/folder`,{dirPath:r,name:i})}export{p as a,l as c,c as i,m as n,s as o,u as r,d as s,f as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Cr as t,Gt as n,Ri as r,Rr as i,Wr as a,Xr as o,da as s,la as c,li as l}from"./dialogs-config-jWciSgHl.js";import{a as u}from"./store-CHZlq7-o.js";import{n as d}from"./tab-context-Dt4dsRtJ.js";import{i as f}from"./index-DYQT8pCu.js";var p=c(),m=e(s(),1),h=t();function g(){let e=(0,p.c)(41),{devServerUrl:t,browserResetTrigger:s}=d(),{state:c}=u(),{selectedProjectId:g,projects:_}=c,v;if(e[0]!==_||e[1]!==g){let t;e[3]===g?t=e[4]:(t=e=>e.projectId===g,e[3]=g,e[4]=t),v=_.find(t),e[0]=_,e[1]=g,e[2]=v}else v=e[2];let y=v,[b,x]=(0,m.useState)(``),[S,C]=(0,m.useState)(``),[w,T]=(0,m.useState)(`desktop`),E=(0,m.useRef)(null),D;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>{C(``),x(``),E.current&&(E.current.src=``)},e[5]=D):D=e[5];let O;e[6]===s?O=e[7]:(O=[s],e[6]=s,e[7]=O),(0,m.useEffect)(D,O);let k,A;e[8]===t?(k=e[9],A=e[10]):(k=()=>{t&&(x(t),C(t))},A=[t],e[8]=t,e[9]=k,e[10]=A),(0,m.useEffect)(k,A);let j;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>{let t=e.trim();t&&(!t.startsWith(`http://`)&&!t.startsWith(`https://`)&&(t=`http://`+t),x(t),C(t))},e[11]=j):j=e[11];let M=j,N;e[12]===b?N=e[13]:(N=e=>{e.key===`Enter`&&M(b)},e[12]=b,e[13]=N);let P=N,F;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>{if(E.current){let e=E.current.src;E.current.src=``,setTimeout(()=>{E.current&&(E.current.src=e)},0)}},e[14]=F):F=e[14];let I=F,L;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(L={desktop:{width:`100%`,height:`100%`},tablet:{width:`768px`,height:`1024px`},mobile:{width:`375px`,height:`667px`}},e[15]=L):L=e[15];let R=L[w],z;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(z=e=>x(e.target.value),e[16]=z):z=e[16];let B;e[17]!==P||e[18]!==b?(B=(0,h.jsx)(`input`,{type:`text`,value:b,onChange:z,onKeyDown:P,placeholder:`Enter URL...`,className:`flex-1 px-4 py-1.5 text-sm bg-muted rounded-full border border-border outline-none focus:ring-1 focus:ring-ring font-mono`,spellCheck:!1}),e[17]=P,e[18]=b,e[19]=B):B=e[19];let V;e[20]===S?V=e[21]:(V=S&&(0,h.jsx)(`button`,{onClick:I,title:`Refresh page`,className:`p-1.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors`,children:(0,h.jsx)(o,{size:15})}),e[20]=S,e[21]=V);let H;e[22]!==w||e[23]!==S?(H=S&&(0,h.jsxs)(`div`,{className:`flex items-center bg-muted rounded-md p-0.5`,children:[(0,h.jsx)(`button`,{onClick:()=>T(`desktop`),title:`Desktop view`,className:`p-1.5 rounded transition-colors ${w===`desktop`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground hover:bg-background/50`}`,children:(0,h.jsx)(l,{size:15})}),(0,h.jsx)(`button`,{onClick:()=>T(`tablet`),title:`Tablet view`,className:`p-1.5 rounded transition-colors ${w===`tablet`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground hover:bg-background/50`}`,children:(0,h.jsx)(i,{size:15})}),(0,h.jsx)(`button`,{onClick:()=>T(`mobile`),title:`Mobile view`,className:`p-1.5 rounded transition-colors ${w===`mobile`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground hover:bg-background/50`}`,children:(0,h.jsx)(a,{size:15})})]}),e[22]=w,e[23]=S,e[24]=H):H=e[24];let U;e[25]===S?U=e[26]:(U=S&&(0,h.jsx)(`button`,{onClick:()=>void n(S),title:`Open in external browser`,className:`p-1.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors`,children:(0,h.jsx)(r,{size:15})}),e[25]=S,e[26]=U);let W;e[27]!==B||e[28]!==V||e[29]!==H||e[30]!==U?(W=(0,h.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 border-b border-border shrink-0`,children:[B,V,H,U]}),e[27]=B,e[28]=V,e[29]=H,e[30]=U,e[31]=W):W=e[31];let G;e[32]!==R||e[33]!==w||e[34]!==S||e[35]!==y||e[36]!==g?(G=S?(0,h.jsx)(`div`,{className:`flex-1 flex items-center justify-center bg-background`,children:w===`desktop`?(0,h.jsx)(`iframe`,{ref:E,src:S,className:`flex-1 w-full h-full border-none`,title:`Browser`}):(0,h.jsx)(`div`,{className:`bg-white border border-border rounded-lg shadow-lg overflow-hidden transition-all duration-200`,style:{width:R.width,height:R.height,maxWidth:`100%`,maxHeight:`100%`},children:(0,h.jsx)(`iframe`,{ref:E,src:S,className:`w-full h-full border-none`,title:`Browser`})})}):(0,h.jsx)(`div`,{className:`flex-1 flex flex-col items-center justify-center gap-6 text-muted-foreground`,children:g&&y?.runCommand?(0,h.jsx)(f,{projectId:g,runCommand:y.runCommand,large:!0}):(0,h.jsx)(`p`,{className:`text-sm`,children:`Enter a URL to browse`})}),e[32]=R,e[33]=w,e[34]=S,e[35]=y,e[36]=g,e[37]=G):G=e[37];let K;return e[38]!==W||e[39]!==G?(K=(0,h.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden`,children:[W,G]}),e[38]=W,e[39]=G,e[40]=K):K=e[40],K}export{g as BrowserTab};
1
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Cr as t,Gt as n,Ii as r,Rr as i,Wr as a,Xr as o,la as s,sa as c,si as l}from"./dialogs-config-D3xml4W2.js";import{a as u}from"./store-erJP4KTe.js";import{n as d}from"./tab-context-CnzSKG0L.js";import{i as f}from"./index-CSGl7zru.js";var p=c(),m=e(s(),1),h=t();function g(){let e=(0,p.c)(41),{devServerUrl:t,browserResetTrigger:s}=d(),{state:c}=u(),{selectedProjectId:g,projects:_}=c,v;if(e[0]!==_||e[1]!==g){let t;e[3]===g?t=e[4]:(t=e=>e.projectId===g,e[3]=g,e[4]=t),v=_.find(t),e[0]=_,e[1]=g,e[2]=v}else v=e[2];let y=v,[b,x]=(0,m.useState)(``),[S,C]=(0,m.useState)(``),[w,T]=(0,m.useState)(`desktop`),E=(0,m.useRef)(null),D;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>{C(``),x(``),E.current&&(E.current.src=``)},e[5]=D):D=e[5];let O;e[6]===s?O=e[7]:(O=[s],e[6]=s,e[7]=O),(0,m.useEffect)(D,O);let k,A;e[8]===t?(k=e[9],A=e[10]):(k=()=>{t&&(x(t),C(t))},A=[t],e[8]=t,e[9]=k,e[10]=A),(0,m.useEffect)(k,A);let j;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>{let t=e.trim();t&&(!t.startsWith(`http://`)&&!t.startsWith(`https://`)&&(t=`http://`+t),x(t),C(t))},e[11]=j):j=e[11];let M=j,N;e[12]===b?N=e[13]:(N=e=>{e.key===`Enter`&&M(b)},e[12]=b,e[13]=N);let P=N,F;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>{if(E.current){let e=E.current.src;E.current.src=``,setTimeout(()=>{E.current&&(E.current.src=e)},0)}},e[14]=F):F=e[14];let I=F,L;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(L={desktop:{width:`100%`,height:`100%`},tablet:{width:`768px`,height:`1024px`},mobile:{width:`375px`,height:`667px`}},e[15]=L):L=e[15];let R=L[w],z;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(z=e=>x(e.target.value),e[16]=z):z=e[16];let B;e[17]!==P||e[18]!==b?(B=(0,h.jsx)(`input`,{type:`text`,value:b,onChange:z,onKeyDown:P,placeholder:`Enter URL...`,className:`flex-1 px-4 py-1.5 text-sm bg-muted rounded-full border border-border outline-none focus:ring-1 focus:ring-ring font-mono`,spellCheck:!1}),e[17]=P,e[18]=b,e[19]=B):B=e[19];let V;e[20]===S?V=e[21]:(V=S&&(0,h.jsx)(`button`,{onClick:I,title:`Refresh page`,className:`p-1.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors`,children:(0,h.jsx)(o,{size:15})}),e[20]=S,e[21]=V);let H;e[22]!==w||e[23]!==S?(H=S&&(0,h.jsxs)(`div`,{className:`flex items-center bg-muted rounded-md p-0.5`,children:[(0,h.jsx)(`button`,{onClick:()=>T(`desktop`),title:`Desktop view`,className:`p-1.5 rounded transition-colors ${w===`desktop`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground hover:bg-background/50`}`,children:(0,h.jsx)(l,{size:15})}),(0,h.jsx)(`button`,{onClick:()=>T(`tablet`),title:`Tablet view`,className:`p-1.5 rounded transition-colors ${w===`tablet`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground hover:bg-background/50`}`,children:(0,h.jsx)(i,{size:15})}),(0,h.jsx)(`button`,{onClick:()=>T(`mobile`),title:`Mobile view`,className:`p-1.5 rounded transition-colors ${w===`mobile`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground hover:bg-background/50`}`,children:(0,h.jsx)(a,{size:15})})]}),e[22]=w,e[23]=S,e[24]=H):H=e[24];let U;e[25]===S?U=e[26]:(U=S&&(0,h.jsx)(`button`,{onClick:()=>void n(S),title:`Open in external browser`,className:`p-1.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors`,children:(0,h.jsx)(r,{size:15})}),e[25]=S,e[26]=U);let W;e[27]!==B||e[28]!==V||e[29]!==H||e[30]!==U?(W=(0,h.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 border-b border-border shrink-0`,children:[B,V,H,U]}),e[27]=B,e[28]=V,e[29]=H,e[30]=U,e[31]=W):W=e[31];let G;e[32]!==R||e[33]!==w||e[34]!==S||e[35]!==y||e[36]!==g?(G=S?(0,h.jsx)(`div`,{className:`flex-1 flex items-center justify-center bg-background`,children:w===`desktop`?(0,h.jsx)(`iframe`,{ref:E,src:S,className:`flex-1 w-full h-full border-none`,title:`Browser`}):(0,h.jsx)(`div`,{className:`bg-white border border-border rounded-lg shadow-lg overflow-hidden transition-all duration-200`,style:{width:R.width,height:R.height,maxWidth:`100%`,maxHeight:`100%`},children:(0,h.jsx)(`iframe`,{ref:E,src:S,className:`w-full h-full border-none`,title:`Browser`})})}):(0,h.jsx)(`div`,{className:`flex-1 flex flex-col items-center justify-center gap-6 text-muted-foreground`,children:g&&y?.runCommand?(0,h.jsx)(f,{projectId:g,runCommand:y.runCommand,large:!0}):(0,h.jsx)(`p`,{className:`text-sm`,children:`Enter a URL to browse`})}),e[32]=R,e[33]=w,e[34]=S,e[35]=y,e[36]=g,e[37]=G):G=e[37];let K;return e[38]!==W||e[39]!==G?(K=(0,h.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden`,children:[W,G]}),e[38]=W,e[39]=G,e[40]=K):K=e[40],K}export{g as BrowserTab};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{$i as t,Cr as n,Gi as r,Wn as i,Xi as a,la as o,sa as s}from"./dialogs-config-D3xml4W2.js";import{a as c,d as l,h as u,i as d,l as f,m as p,n as m,o as h,p as g,s as _,t as v,u as y}from"./react-vendor-DcsTuVun.js";var b=s(),x=e(o(),1),S=n(),C=y,w=u,T=x.forwardRef((e,t)=>{let n=(0,b.c)(14),r,o,s,c;n[0]===e?(r=n[1],o=n[2],s=n[3],c=n[4]):({className:o,inset:s,children:r,...c}=e,n[0]=e,n[1]=r,n[2]=o,n[3]=s,n[4]=c);let l=s&&`pl-8`,u;n[5]!==o||n[6]!==l?(u=i(`flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground`,l,o),n[5]=o,n[6]=l,n[7]=u):u=n[7];let d;n[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,S.jsx)(a,{className:`ml-auto h-4 w-4`}),n[8]=d):d=n[8];let f;return n[9]!==r||n[10]!==c||n[11]!==t||n[12]!==u?(f=(0,S.jsxs)(p,{ref:t,className:u,...c,children:[r,d]}),n[9]=r,n[10]=c,n[11]=t,n[12]=u,n[13]=f):f=n[13],f});T.displayName=p.displayName;var E=x.forwardRef((e,t)=>{let n=(0,b.c)(9),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let o;n[3]===r?o=n[4]:(o=i(`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[3]=r,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,S.jsx)(g,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});E.displayName=g.displayName;var D=x.forwardRef((e,t)=>{let n=(0,b.c)(9),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let o;n[3]===r?o=n[4]:(o=i(`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`,r),n[3]=r,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,S.jsx)(_,{children:(0,S.jsx)(m,{ref:t,className:o,...a})}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});D.displayName=m.displayName;var O=x.forwardRef((e,t)=>{let n=(0,b.c)(11),r,a,o;n[0]===e?(r=n[1],a=n[2],o=n[3]):({className:r,inset:a,...o}=e,n[0]=e,n[1]=r,n[2]=a,n[3]=o);let s=a&&`pl-8`,c;n[4]!==r||n[5]!==s?(c=i(`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,r),n[4]=r,n[5]=s,n[6]=c):c=n[6];let l;return n[7]!==o||n[8]!==t||n[9]!==c?(l=(0,S.jsx)(d,{ref:t,className:c,...o}),n[7]=o,n[8]=t,n[9]=c,n[10]=l):l=n[10],l});O.displayName=d.displayName;var k=x.forwardRef((e,n)=>{let r=(0,b.c)(14),a,o,s,l;r[0]===e?(a=r[1],o=r[2],s=r[3],l=r[4]):({className:s,children:o,checked:a,...l}=e,r[0]=e,r[1]=a,r[2]=o,r[3]=s,r[4]=l);let u;r[5]===s?u=r[6]:(u=i(`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]=u);let d;r[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,S.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,S.jsx)(c,{children:(0,S.jsx)(t,{className:`h-4 w-4`})})}),r[7]=d):d=r[7];let f;return r[8]!==a||r[9]!==o||r[10]!==l||r[11]!==n||r[12]!==u?(f=(0,S.jsxs)(v,{ref:n,className:u,checked:a,...l,children:[d,o]}),r[8]=a,r[9]=o,r[10]=l,r[11]=n,r[12]=u,r[13]=f):f=r[13],f});k.displayName=v.displayName;var A=x.forwardRef((e,t)=>{let n=(0,b.c)(12),a,o,s;n[0]===e?(a=n[1],o=n[2],s=n[3]):({className:o,children:a,...s}=e,n[0]=e,n[1]=a,n[2]=o,n[3]=s);let l;n[4]===o?l=n[5]:(l=i(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,o),n[4]=o,n[5]=l);let u;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,S.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,S.jsx)(c,{children:(0,S.jsx)(r,{className:`h-2 w-2 fill-current`})})}),n[6]=u):u=n[6];let d;return n[7]!==a||n[8]!==s||n[9]!==t||n[10]!==l?(d=(0,S.jsxs)(f,{ref:t,className:l,...s,children:[u,a]}),n[7]=a,n[8]=s,n[9]=t,n[10]=l,n[11]=d):d=n[11],d});A.displayName=f.displayName;var j=x.forwardRef((e,t)=>{let n=(0,b.c)(11),r,a,o;n[0]===e?(r=n[1],a=n[2],o=n[3]):({className:r,inset:a,...o}=e,n[0]=e,n[1]=r,n[2]=a,n[3]=o);let s=a&&`pl-8`,c;n[4]!==r||n[5]!==s?(c=i(`px-2 py-1.5 text-sm font-semibold text-foreground`,s,r),n[4]=r,n[5]=s,n[6]=c):c=n[6];let l;return n[7]!==o||n[8]!==t||n[9]!==c?(l=(0,S.jsx)(h,{ref:t,className:c,...o}),n[7]=o,n[8]=t,n[9]=c,n[10]=l):l=n[10],l});j.displayName=h.displayName;var M=x.forwardRef((e,t)=>{let n=(0,b.c)(9),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let o;n[3]===r?o=n[4]:(o=i(`-mx-1 my-1 h-px bg-border`,r),n[3]=r,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,S.jsx)(l,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});M.displayName=l.displayName;var N=e=>{let t=(0,b.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let a;t[3]===n?a=t[4]:(a=i(`ml-auto text-xs tracking-widest text-muted-foreground`,n),t[3]=n,t[4]=a);let o;return t[5]!==r||t[6]!==a?(o=(0,S.jsx)(`span`,{className:a,...r}),t[5]=r,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-BnRtfSte.js";export{e as ConversationHistoryView,e as default};
@@ -48,4 +48,4 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
48
48
  Is it ok to install Vite Plus using the following command?
49
49
 
50
50
  macOS / Linux: curl -fsSL https://vite.plus | bash
51
- Windows: irm https://vite.plus/ps1 | iex`)){O(!1);return}let{success:e,error:t}=await FI();if(!e){window.alert(`Failed to install Vite Plus:\n${t||`Unknown error`}`),O(!1);return}}}catch(e){console.error(`Vite Plus check/install failed:`,e)}finally{O(!1)}}let e=ne.trim();g(``),v(!1),l(1),t(!1),s(`choice`),i(e,N,x).catch(()=>{})},de=e=>e.trim().toLowerCase().replace(/\s+/g,`-`).replace(/-+/g,`-`).replace(/^-|-$/g,``),I=o===`choice`?1:c,fe=e=>e===1?I>1:e===2?I>=2:e===3?I>=2&&(o===`clone`?u.trim().length>0:ce):!1,pe=e=>{e===1?(s(`choice`),l(1),d(``),g(``)):l(e)};return(0,B.jsx)(ZP,{open:e,onOpenChange:e=>!e&&oe(),children:(0,B.jsxs)(eF,{className:`max-w-2xl h-[min(42rem,90dvh)] flex flex-col p-0 overflow-hidden`,children:[(0,B.jsxs)(`div`,{className:`px-6 pt-6 pb-2`,children:[(0,B.jsxs)(`div`,{className:`mx-auto flex items-center gap-1 mb-6 w-2/3`,children:[(0,B.jsx)(`button`,{type:`button`,onClick:()=>fe(1)&&pe(1),className:G(`flex items-center justify-center h-8 w-8 rounded-full text-sm font-medium shrink-0 transition-colors transition-transform duration-300 ease-out`,I===1?`bg-primary text-primary-foreground scale-110`:I>1?`bg-brand text-brand-foreground`:`bg-muted text-muted-foreground`,fe(1)&&`cursor-pointer hover:opacity-90`),"aria-label":`Go to step 1`,children:`1`}),(0,B.jsx)(`div`,{className:`h-0.5 flex-1 min-w-0 relative rounded-full overflow-hidden bg-muted`,children:(0,B.jsx)(`div`,{className:`absolute inset-y-0 left-0 bg-brand transition-[width] duration-300 ease-out rounded-full`,style:{width:I>=2?`100%`:`0%`}})}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>fe(2)&&pe(2),className:G(`flex items-center justify-center h-8 w-8 rounded-full text-sm font-medium shrink-0 transition-colors transition-transform duration-300 ease-out`,I===2?`bg-primary text-primary-foreground scale-110`:I>2?`bg-brand text-brand-foreground`:`bg-muted text-muted-foreground`,fe(2)&&`cursor-pointer hover:opacity-90`),"aria-label":`Go to step 2`,children:`2`}),(0,B.jsx)(`div`,{className:`h-0.5 flex-1 min-w-0 relative rounded-full overflow-hidden bg-muted`,children:(0,B.jsx)(`div`,{className:`absolute inset-y-0 left-0 bg-brand transition-[width] duration-300 ease-out rounded-full`,style:{width:I>=3?`100%`:`0%`}})}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>fe(3)&&pe(3),className:G(`flex items-center justify-center h-8 w-8 rounded-full text-sm font-medium shrink-0 transition-colors transition-transform duration-300 ease-out`,I===3?`bg-primary text-primary-foreground scale-110`:`bg-muted text-muted-foreground`,fe(3)&&`cursor-pointer hover:opacity-90`),"aria-label":`Go to step 3`,children:`3`})]}),(0,B.jsxs)(tF,{children:[(0,B.jsxs)(rF,{children:[I===1&&`New Project`,I===2&&o===`clone`&&`Clone Repository`,I===2&&o===`webapp`&&`Create App`,I===3&&o===`clone`&&`Clone Repository`,I===3&&o===`webapp`&&(P===`Capacitor Plugin`?`Create Capacitor Plugin`:P?`Create ${P} App`:`Create App`)]}),(0,B.jsxs)(iF,{children:[I===1&&`Choose how to add a new project.`,I===2&&o===`clone`&&`Enter a git repository URL to clone.`,I===2&&o===`webapp`&&`Choose a template type.`,I===3&&o===`clone`&&`Choose commit workflow.`,I===3&&o===`webapp`&&`Name your project and choose variation, package manager, and commit workflow.`]})]})]}),I===1&&(0,B.jsx)(hI,{className:`flex-1 min-h-0 overflow-hidden`,children:(0,B.jsx)(`div`,{className:`px-6 py-4`,children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,B.jsx)(wz,{role:`button`,tabIndex:0,className:`cursor-pointer transition-colors hover:border-primary/50 hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:ae,onKeyDown:e=>e.key===`Enter`&&ae(),children:(0,B.jsxs)(Oz,{className:`flex items-start gap-4 p-4`,children:[(0,B.jsx)(`div`,{className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-lg bg-brand text-brand-foreground`,children:(0,B.jsx)(sp,{className:`h-6 w-6`})}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,B.jsx)(`p`,{className:`font-semibold`,children:`Clone repo`}),(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Connect an existing repository by URL`})]})]})}),(0,B.jsx)(wz,{role:`button`,tabIndex:0,className:`cursor-pointer transition-colors hover:border-primary/50 hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:ie,onKeyDown:e=>e.key===`Enter`&&ie(),children:(0,B.jsxs)(Oz,{className:`flex items-start gap-4 p-4`,children:[(0,B.jsx)(`div`,{className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-lg bg-brand text-brand-foreground`,children:(0,B.jsx)(ub,{className:`h-6 w-6`})}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,B.jsx)(`p`,{className:`font-semibold`,children:`Create App`}),(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Scaffold a new React, Vue, Next.js, or other template`})]})]})}),(0,B.jsx)(wz,{role:`button`,tabIndex:0,className:`cursor-pointer transition-colors hover:border-primary/50 hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:()=>{oe(),a()},onKeyDown:e=>{e.key===`Enter`&&(oe(),a())},children:(0,B.jsxs)(Oz,{className:`flex items-start gap-4 p-4`,children:[(0,B.jsx)(`div`,{className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-lg bg-brand text-brand-foreground`,children:(0,B.jsx)(yf,{className:`h-6 w-6`})}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,B.jsx)(`p`,{className:`font-semibold`,children:`Open Folder`}),(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Create a project from an existing local folder`})]})]})})]})})}),I===2&&o===`clone`&&(0,B.jsx)(hI,{className:`flex-1 min-h-0 overflow-hidden`,children:(0,B.jsx)(`div`,{className:`px-6 py-4`,children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,B.jsx)(DF,{htmlFor:`gitUrl`,children:`Repository URL`}),(0,B.jsx)(xF,{id:`gitUrl`,placeholder:`https://github.com/user/repo.git`,value:u,onChange:e=>d(e.target.value),onKeyDown:e=>e.key===`Enter`&&ce&&l(3)})]})})}),I===2&&o===`webapp`&&(0,B.jsx)(`div`,{className:`flex flex-col flex-1 min-h-0 px-6 pb-4`,children:(0,B.jsx)(`div`,{className:`flex-1 min-h-0 flex flex-col py-2`,children:(0,B.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto -mx-1`,children:(0,B.jsx)(`div`,{className:`grid grid-cols-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-2 p-1 mr-2`,children:T?(0,B.jsx)(`p`,{className:`col-span-full p-4 text-sm text-muted-foreground`,children:`Loading…`}):A.map(e=>{let t=j[e]?.[0]?.type,n=t?nB[t]:null;return(0,B.jsxs)(`button`,{type:`button`,onClick:()=>b(M[e]??``),onDoubleClick:()=>{b(M[e]??``),l(3)},className:G(`flex flex-col items-center gap-2 rounded-lg border px-3 py-3 text-center transition-colors`,P===e?`border-primary bg-accent text-accent-foreground`:`border-border bg-card hover:bg-muted/50 hover:border-muted-foreground/30 shadow-sm`),children:[n?(0,B.jsx)(`img`,{src:`/template-types/${n}`,alt:``,className:G(`size-8 shrink-0 transition-opacity duration-300`,ee.has(n)?`opacity-100`:`opacity-0`),onLoad:()=>te(n),"aria-hidden":!0}):null,(0,B.jsx)(`span`,{className:`font-medium text-sm truncate w-full`,children:e})]},e)})})})})}),I===3&&o===`webapp`&&(0,B.jsx)(hI,{className:`flex-1 min-h-0 overflow-hidden`,children:(0,B.jsxs)(`div`,{className:`px-6 py-4 flex flex-col gap-6`,children:[(0,B.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,B.jsx)(DF,{htmlFor:`projectName`,children:`Project name`}),(0,B.jsx)(xF,{id:`projectName`,placeholder:`My App`,value:ne,onChange:e=>{g(e.target.value),v(!0)},className:`max-w-xs`})]}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[F.length>1&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(DF,{className:`text-sm font-medium`,children:`Variation`}),(0,B.jsx)($z,{type:`single`,value:N,onValueChange:e=>e&&b(e),variant:`outline`,className:`flex flex-wrap gap-0 justify-start [&>button]:rounded-none [&>button:first-child]:rounded-l-md [&>button:last-child]:rounded-r-md [&>button:not(:first-child)]:-ml-px`,children:F.map(e=>(0,B.jsx)(eB,{value:e.id,className:`text-sm`,children:e.variationName},e.id))})]}),(0,B.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[re?.description??F[0]?.description??``,re?.url&&(0,B.jsxs)(B.Fragment,{children:[` `,(0,B.jsxs)(`a`,{href:re.url,target:`_blank`,rel:`noreferrer`,className:`text-brand hover:underline hover:text-brand/80 inline-flex items-center gap-0.5`,children:[`Documentation `,(0,B.jsx)(mu,{className:`h-3 w-3`})]})]})]})]}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,B.jsx)(DF,{className:`text-sm font-medium`,children:`Package manager`}),(0,B.jsx)($z,{type:`single`,value:x,onValueChange:e=>{e&&(S(e),HR(e))},variant:`outline`,className:`flex flex-wrap gap-0 justify-start [&>button]:rounded-none [&>button:first-child]:rounded-l-md [&>button:last-child]:rounded-r-md [&>button:not(:first-child)]:-ml-px`,children:Object.values(Cz).map(e=>(0,B.jsx)(eB,{value:e.id,className:`text-sm`,children:e.label},e.id))})]}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,B.jsx)(DF,{className:`text-sm font-medium`,children:`Commit method`}),(0,B.jsxs)($z,{type:`single`,value:f,onValueChange:e=>{(e===$.PullRequest||e===$.Direct)&&(p(e),WR(e))},variant:`outline`,className:`flex flex-wrap gap-0 justify-start [&>button]:rounded-none [&>button:first-child]:rounded-l-md [&>button:last-child]:rounded-r-md [&>button:not(:first-child)]:-ml-px`,children:[(0,B.jsx)(eB,{value:$.PullRequest,className:`text-sm`,children:`Pull Requests`}),(0,B.jsx)(eB,{value:$.Direct,className:`text-sm`,children:`Direct Commits`})]}),(0,B.jsx)(`p`,{className:`text-xs text-slate-600 dark:text-slate-400`,children:f===$.PullRequest?`Creates a feature branch and allows you to create pull requests.`:`Commits directly to the main branch without creating feature branches.`})]})]})}),I===3&&o===`clone`&&(0,B.jsx)(hI,{className:`flex-1 min-h-0 overflow-hidden`,children:(0,B.jsx)(`div`,{className:`px-6 py-4 flex flex-col gap-6`,children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,B.jsx)(DF,{className:`text-sm font-medium`,children:`Commit method`}),(0,B.jsxs)($z,{type:`single`,value:f,onValueChange:e=>{(e===$.PullRequest||e===$.Direct)&&(p(e),WR(e))},variant:`outline`,className:`flex flex-wrap gap-0 justify-start [&>button]:rounded-none [&>button:first-child]:rounded-l-md [&>button:last-child]:rounded-r-md [&>button:not(:first-child)]:-ml-px`,children:[(0,B.jsx)(eB,{value:$.PullRequest,className:`text-sm`,children:`Pull Requests`}),(0,B.jsx)(eB,{value:$.Direct,className:`text-sm`,children:`Direct Commits`})]}),(0,B.jsx)(`p`,{className:`text-xs text-slate-600 dark:text-slate-400`,children:f===$.PullRequest?`Creates a feature branch and allows you to create pull requests.`:`Commits directly to the main branch without creating feature branches.`})]})})}),(0,B.jsx)(`div`,{className:`px-6 py-4 border-t border-border bg-muted/10 min-h-[4.5rem] flex flex-col justify-end`,children:(0,B.jsxs)(nF,{children:[I>1&&(0,B.jsx)(bF,{variant:`ghost`,onClick:se,children:`Back`}),I===2&&(0,B.jsx)(bF,{onClick:()=>l(3),disabled:!ce,children:`Next`}),I===3&&o===`clone`&&(0,B.jsx)(bF,{onClick:le,children:`Clone Repository`}),I===3&&o===`webapp`&&(0,B.jsx)(bF,{onClick:ue,disabled:!ne.trim()||D,children:D?`Preparing...`:`Create App`})]})})]})})}export{yL as $,Wa as $i,GN as $n,ex as $r,XL as $t,II as A,Af as Ai,AF as An,wA as Ar,hR as At,FR as B,Ml as Bi,iF as Bn,_E as Br,zL as Bt,sR as C,Mm as Ci,X as Cn,IA as Cr,LI as Ct,HL as D,bp as Di,Y as Dn,MA as Dr,jR as Dt,TL as E,xp as Ei,CI as En,R as Er,QL as Et,GL as F,Bu as Fi,yF as Fn,lO as Fr,PL as Ft,bL as G,ic as Gi,XP as Gn,AC as Gr,BI as Gt,vL as H,Wc as Hi,tF as Hn,L as Hr,TR as Ht,OR as I,_u as Ii,vF as In,UD as Ir,FL as It,OL as J,Uo as Ji,JP as Jn,vC as Jr,fL as Jt,gL as K,Ms as Ki,qP as Kn,kC as Kr,JI as Kt,XI as L,gu as Li,uF as Ln,fD as Lr,LL as Lt,QI as M,uf as Mi,DF as Mn,YO as Mr,RL as Mt,PR as N,Ed as Ni,xF as Nn,yO as Nr,kL as Nt,VL as O,cp as Oi,SI as On,OA as Or,AR as Ot,NR as P,_d as Pi,bF as Pn,vO as Pr,IL as Pt,xL as Q,Ga as Qi,KN as Qn,ix as Qr,qL as Qt,pR as R,mu as Ri,ZP as Rn,QE as Rr,jL as Rt,_R as S,Xm as Si,TI as Sn,RA as Sr,RI as St,cR as T,zp as Ti,vI as Tn,z as Tr,dR as Tt,SL as U,Ic as Ui,rF as Un,Rw as Ur,ZI as Ut,CL as V,Xc as Vi,nF as Vn,oE as Vr,ML as Vt,_L as W,Pc as Wi,G as Wn,Ow as Wr,rR as Wt,NL as X,oo as Xi,qN as Xn,DS as Xr,lR as Xt,wL as Y,_o as Yi,XN as Yn,pC as Yr,lL as Yt,VI as Z,Ka as Zi,YN as Zn,TS as Zr,UL as Zt,XR as _,Og as _i,pL as _n,JA as _r,wR as _t,Ez as a,xt as aa,qy as ai,nL as an,cN as ar,aR as at,AI as b,vh as bi,eL as bn,UA as br,YL as bt,xz as c,We as ca,kv as ci,cL as cn,Rj as cr,GI as ct,ez as d,i as da,dv as di,yR as dn,vj as dr,oR as dt,Va as ea,ub as ei,WL as en,UN as er,HI as et,qR as f,rv as fi,bR as fn,uj as fr,KL as ft,JR as g,f_ as gi,hL as gn,nj as gr,xR as gt,ZR as h,y_ as hi,uL as hn,V as hr,CR as ht,Tz as i,vr as ia,Zy as ii,MR as in,dN as ir,gR as it,fR as j,yf as ji,kF as jn,mk as jr,DL as jt,qI as k,sp as ki,hI as kn,TA as kr,JL as kt,lz as l,c as la,Ov as li,nR as ln,Ij as lr,ER as lt,$R as m,ev as mi,eR as mn,H as mr,kR as mt,wz as n,Kr as na,tb as ni,DR as nn,WN as nr,iL as nt,$ as o,st as oa,Iy as oi,aL as on,$M as or,BL as ot,YR as p,nv as pi,oL as pn,_j as pr,SR as pt,tL as q,Qo as qi,YP as qn,OC as qr,dL as qt,Oz as r,Lr as ra,Qy as ri,zI as rn,RN as rr,mR as rt,Sz as s,et as sa,cy as si,tR as sn,Uj as sr,WI as st,tB as t,Ma as ta,lb as ti,EL as tn,JN as tr,rL as tt,tz as u,o as ua,mv as ui,ZL as un,Cj as ur,$L as ut,QR as v,Sg as vi,mL as vn,ZA as vr,UI as vt,sL as w,Gp as wi,J as wn,PA as wr,uR as wt,vR as x,eh as xi,Z as xn,BA as xr,KI as xt,jI as y,sg as yi,iR as yn,GA as yr,YI as yt,$I as z,Rl as zi,eF as zn,NE as zr,AL as zt};
51
+ Windows: irm https://vite.plus/ps1 | iex`)){O(!1);return}let{success:e,error:t}=await FI();if(!e){window.alert(`Failed to install Vite Plus:\n${t||`Unknown error`}`),O(!1);return}}}catch(e){console.error(`Vite Plus check/install failed:`,e)}finally{O(!1)}}let e=ne.trim();g(``),v(!1),l(1),t(!1),s(`choice`),i(e,N,x).catch(()=>{})},de=e=>e.trim().toLowerCase().replace(/\s+/g,`-`).replace(/-+/g,`-`).replace(/^-|-$/g,``),I=o===`choice`?1:c,fe=e=>e===1?I>1:e===2?I>=2:e===3?I>=2&&(o===`clone`?u.trim().length>0:ce):!1,pe=e=>{e===1?(s(`choice`),l(1),d(``),g(``)):l(e)};return(0,B.jsx)(ZP,{open:e,onOpenChange:e=>!e&&oe(),children:(0,B.jsxs)(eF,{className:`max-w-2xl h-[min(42rem,90dvh)] flex flex-col p-0 overflow-hidden`,children:[(0,B.jsxs)(`div`,{className:`px-6 pt-6 pb-2`,children:[(0,B.jsxs)(`div`,{className:`mx-auto flex items-center gap-1 mb-6 w-2/3`,children:[(0,B.jsx)(`button`,{type:`button`,onClick:()=>fe(1)&&pe(1),className:G(`flex items-center justify-center h-8 w-8 rounded-full text-sm font-medium shrink-0 transition-colors transition-transform duration-300 ease-out`,I===1?`bg-primary text-primary-foreground scale-110`:I>1?`bg-brand text-brand-foreground`:`bg-muted text-muted-foreground`,fe(1)&&`cursor-pointer hover:opacity-90`),"aria-label":`Go to step 1`,children:`1`}),(0,B.jsx)(`div`,{className:`h-0.5 flex-1 min-w-0 relative rounded-full overflow-hidden bg-muted`,children:(0,B.jsx)(`div`,{className:`absolute inset-y-0 left-0 bg-brand transition-[width] duration-300 ease-out rounded-full`,style:{width:I>=2?`100%`:`0%`}})}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>fe(2)&&pe(2),className:G(`flex items-center justify-center h-8 w-8 rounded-full text-sm font-medium shrink-0 transition-colors transition-transform duration-300 ease-out`,I===2?`bg-primary text-primary-foreground scale-110`:I>2?`bg-brand text-brand-foreground`:`bg-muted text-muted-foreground`,fe(2)&&`cursor-pointer hover:opacity-90`),"aria-label":`Go to step 2`,children:`2`}),(0,B.jsx)(`div`,{className:`h-0.5 flex-1 min-w-0 relative rounded-full overflow-hidden bg-muted`,children:(0,B.jsx)(`div`,{className:`absolute inset-y-0 left-0 bg-brand transition-[width] duration-300 ease-out rounded-full`,style:{width:I>=3?`100%`:`0%`}})}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>fe(3)&&pe(3),className:G(`flex items-center justify-center h-8 w-8 rounded-full text-sm font-medium shrink-0 transition-colors transition-transform duration-300 ease-out`,I===3?`bg-primary text-primary-foreground scale-110`:`bg-muted text-muted-foreground`,fe(3)&&`cursor-pointer hover:opacity-90`),"aria-label":`Go to step 3`,children:`3`})]}),(0,B.jsxs)(tF,{children:[(0,B.jsxs)(rF,{children:[I===1&&`New Project`,I===2&&o===`clone`&&`Clone Repository`,I===2&&o===`webapp`&&`Create App`,I===3&&o===`clone`&&`Clone Repository`,I===3&&o===`webapp`&&(P===`Capacitor Plugin`?`Create Capacitor Plugin`:P?`Create ${P} App`:`Create App`)]}),(0,B.jsxs)(iF,{children:[I===1&&`Choose how to add a new project.`,I===2&&o===`clone`&&`Enter a git repository URL to clone.`,I===2&&o===`webapp`&&`Choose a template type.`,I===3&&o===`clone`&&`Choose commit workflow.`,I===3&&o===`webapp`&&`Name your project and choose variation, package manager, and commit workflow.`]})]})]}),I===1&&(0,B.jsx)(hI,{className:`flex-1 min-h-0 overflow-hidden`,children:(0,B.jsx)(`div`,{className:`px-6 py-4`,children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,B.jsx)(wz,{role:`button`,tabIndex:0,className:`cursor-pointer transition-colors hover:border-primary/50 hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:ae,onKeyDown:e=>e.key===`Enter`&&ae(),children:(0,B.jsxs)(Oz,{className:`flex items-start gap-4 p-4`,children:[(0,B.jsx)(`div`,{className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-lg bg-brand text-brand-foreground`,children:(0,B.jsx)(sp,{className:`h-6 w-6`})}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,B.jsx)(`p`,{className:`font-semibold`,children:`Clone repo`}),(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Connect an existing repository by URL`})]})]})}),(0,B.jsx)(wz,{role:`button`,tabIndex:0,className:`cursor-pointer transition-colors hover:border-primary/50 hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:ie,onKeyDown:e=>e.key===`Enter`&&ie(),children:(0,B.jsxs)(Oz,{className:`flex items-start gap-4 p-4`,children:[(0,B.jsx)(`div`,{className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-lg bg-brand text-brand-foreground`,children:(0,B.jsx)(ub,{className:`h-6 w-6`})}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,B.jsx)(`p`,{className:`font-semibold`,children:`Create App`}),(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Scaffold a new React, Vue, Next.js, or other template`})]})]})}),(0,B.jsx)(wz,{role:`button`,tabIndex:0,className:`cursor-pointer transition-colors hover:border-primary/50 hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:()=>{oe(),a()},onKeyDown:e=>{e.key===`Enter`&&(oe(),a())},children:(0,B.jsxs)(Oz,{className:`flex items-start gap-4 p-4`,children:[(0,B.jsx)(`div`,{className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-lg bg-brand text-brand-foreground`,children:(0,B.jsx)(yf,{className:`h-6 w-6`})}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,B.jsx)(`p`,{className:`font-semibold`,children:`Open Folder`}),(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Create a project from an existing local folder`})]})]})})]})})}),I===2&&o===`clone`&&(0,B.jsx)(hI,{className:`flex-1 min-h-0 overflow-hidden`,children:(0,B.jsx)(`div`,{className:`px-6 py-4`,children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,B.jsx)(DF,{htmlFor:`gitUrl`,children:`Repository URL`}),(0,B.jsx)(xF,{id:`gitUrl`,placeholder:`https://github.com/user/repo.git`,value:u,onChange:e=>d(e.target.value),onKeyDown:e=>e.key===`Enter`&&ce&&l(3)})]})})}),I===2&&o===`webapp`&&(0,B.jsx)(`div`,{className:`flex flex-col flex-1 min-h-0 px-6 pb-4`,children:(0,B.jsx)(`div`,{className:`flex-1 min-h-0 flex flex-col py-2`,children:(0,B.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto -mx-1`,children:(0,B.jsx)(`div`,{className:`grid grid-cols-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-2 p-1 mr-2`,children:T?(0,B.jsx)(`p`,{className:`col-span-full p-4 text-sm text-muted-foreground`,children:`Loading…`}):A.map(e=>{let t=j[e]?.[0]?.type,n=t?nB[t]:null;return(0,B.jsxs)(`button`,{type:`button`,onClick:()=>b(M[e]??``),onDoubleClick:()=>{b(M[e]??``),l(3)},className:G(`flex flex-col items-center gap-2 rounded-lg border px-3 py-3 text-center transition-colors`,P===e?`border-primary bg-accent text-accent-foreground`:`border-border bg-card hover:bg-muted/50 hover:border-muted-foreground/30 shadow-sm`),children:[n?(0,B.jsx)(`img`,{src:`/template-types/${n}`,alt:``,className:G(`size-8 shrink-0 transition-opacity duration-300`,ee.has(n)?`opacity-100`:`opacity-0`),onLoad:()=>te(n),"aria-hidden":!0}):null,(0,B.jsx)(`span`,{className:`font-medium text-sm truncate w-full`,children:e})]},e)})})})})}),I===3&&o===`webapp`&&(0,B.jsx)(hI,{className:`flex-1 min-h-0 overflow-hidden`,children:(0,B.jsxs)(`div`,{className:`px-6 py-4 flex flex-col gap-6`,children:[(0,B.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,B.jsx)(DF,{htmlFor:`projectName`,children:`Project name`}),(0,B.jsx)(xF,{id:`projectName`,placeholder:`My App`,value:ne,onChange:e=>{g(e.target.value),v(!0)},className:`max-w-xs`})]}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[F.length>1&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(DF,{className:`text-sm font-medium`,children:`Variation`}),(0,B.jsx)($z,{type:`single`,value:N,onValueChange:e=>e&&b(e),variant:`outline`,className:`flex flex-wrap gap-0 justify-start [&>button]:rounded-none [&>button:first-child]:rounded-l-md [&>button:last-child]:rounded-r-md [&>button:not(:first-child)]:-ml-px`,children:F.map(e=>(0,B.jsx)(eB,{value:e.id,className:`text-sm`,children:e.variationName},e.id))})]}),(0,B.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[re?.description??F[0]?.description??``,re?.url&&(0,B.jsxs)(B.Fragment,{children:[` `,(0,B.jsxs)(`a`,{href:re.url,target:`_blank`,rel:`noreferrer`,className:`text-brand hover:underline hover:text-brand/80 inline-flex items-center gap-0.5`,children:[`Documentation `,(0,B.jsx)(mu,{className:`h-3 w-3`})]})]})]})]}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,B.jsx)(DF,{className:`text-sm font-medium`,children:`Package manager`}),(0,B.jsx)($z,{type:`single`,value:x,onValueChange:e=>{e&&(S(e),HR(e))},variant:`outline`,className:`flex flex-wrap gap-0 justify-start [&>button]:rounded-none [&>button:first-child]:rounded-l-md [&>button:last-child]:rounded-r-md [&>button:not(:first-child)]:-ml-px`,children:Object.values(Cz).map(e=>(0,B.jsx)(eB,{value:e.id,className:`text-sm`,children:e.label},e.id))})]}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,B.jsx)(DF,{className:`text-sm font-medium`,children:`Commit method`}),(0,B.jsxs)($z,{type:`single`,value:f,onValueChange:e=>{(e===$.PullRequest||e===$.Direct)&&(p(e),WR(e))},variant:`outline`,className:`flex flex-wrap gap-0 justify-start [&>button]:rounded-none [&>button:first-child]:rounded-l-md [&>button:last-child]:rounded-r-md [&>button:not(:first-child)]:-ml-px`,children:[(0,B.jsx)(eB,{value:$.PullRequest,className:`text-sm`,children:`Pull Requests`}),(0,B.jsx)(eB,{value:$.Direct,className:`text-sm`,children:`Direct Commits`})]}),(0,B.jsx)(`p`,{className:`text-xs text-slate-600 dark:text-slate-400`,children:f===$.PullRequest?`Creates a feature branch and allows you to create pull requests.`:`Commits directly to the main branch without creating feature branches.`})]})]})}),I===3&&o===`clone`&&(0,B.jsx)(hI,{className:`flex-1 min-h-0 overflow-hidden`,children:(0,B.jsx)(`div`,{className:`px-6 py-4 flex flex-col gap-6`,children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,B.jsx)(DF,{className:`text-sm font-medium`,children:`Commit method`}),(0,B.jsxs)($z,{type:`single`,value:f,onValueChange:e=>{(e===$.PullRequest||e===$.Direct)&&(p(e),WR(e))},variant:`outline`,className:`flex flex-wrap gap-0 justify-start [&>button]:rounded-none [&>button:first-child]:rounded-l-md [&>button:last-child]:rounded-r-md [&>button:not(:first-child)]:-ml-px`,children:[(0,B.jsx)(eB,{value:$.PullRequest,className:`text-sm`,children:`Pull Requests`}),(0,B.jsx)(eB,{value:$.Direct,className:`text-sm`,children:`Direct Commits`})]}),(0,B.jsx)(`p`,{className:`text-xs text-slate-600 dark:text-slate-400`,children:f===$.PullRequest?`Creates a feature branch and allows you to create pull requests.`:`Commits directly to the main branch without creating feature branches.`})]})})}),(0,B.jsx)(`div`,{className:`px-6 py-4 border-t border-border bg-muted/10 min-h-[4.5rem] flex flex-col justify-end`,children:(0,B.jsxs)(nF,{children:[I>1&&(0,B.jsx)(bF,{variant:`ghost`,onClick:se,children:`Back`}),I===2&&(0,B.jsx)(bF,{onClick:()=>l(3),disabled:!ce,children:`Next`}),I===3&&o===`clone`&&(0,B.jsx)(bF,{onClick:le,children:`Clone Repository`}),I===3&&o===`webapp`&&(0,B.jsx)(bF,{onClick:ue,disabled:!ne.trim()||D,children:D?`Preparing...`:`Create App`})]})})]})})}export{yL as $,Ma as $i,GN as $n,ex as $r,XL as $t,II as A,uf as Ai,AF as An,wA as Ar,hR as At,FR as B,Wc as Bi,iF as Bn,_E as Br,zL as Bt,sR as C,zp as Ci,X as Cn,IA as Cr,LI as Ct,HL as D,sp as Di,Y as Dn,MA as Dr,jR as Dt,TL as E,cp as Ei,CI as En,R as Er,QL as Et,GL as F,gu as Fi,yF as Fn,lO as Fr,PL as Ft,bL as G,Qo as Gi,XP as Gn,AC as Gr,BI as Gt,vL as H,Pc as Hi,tF as Hn,L as Hr,TR as Ht,OR as I,mu as Ii,vF as In,UD as Ir,FL as It,OL as J,oo as Ji,JP as Jn,vC as Jr,fL as Jt,gL as K,Uo as Ki,qP as Kn,kC as Kr,JI as Kt,XI as L,Rl as Li,uF as Ln,fD as Lr,LL as Lt,QI as M,_d as Mi,DF as Mn,YO as Mr,RL as Mt,PR as N,Bu as Ni,xF as Nn,yO as Nr,kL as Nt,VL as O,Af as Oi,SI as On,OA as Or,AR as Ot,NR as P,_u as Pi,bF as Pn,vO as Pr,IL as Pt,xL as Q,Va as Qi,KN as Qn,ix as Qr,qL as Qt,pR as R,Ml as Ri,ZP as Rn,QE as Rr,jL as Rt,_R as S,Gp as Si,TI as Sn,RA as Sr,RI as St,cR as T,bp as Ti,vI as Tn,z as Tr,dR as Tt,SL as U,ic as Ui,rF as Un,Rw as Ur,ZI as Ut,CL as V,Ic as Vi,nF as Vn,oE as Vr,ML as Vt,_L as W,Ms as Wi,G as Wn,Ow as Wr,rR as Wt,NL as X,Ga as Xi,qN as Xn,DS as Xr,lR as Xt,wL as Y,Ka as Yi,XN as Yn,pC as Yr,lL as Yt,VI as Z,Wa as Zi,YN as Zn,TS as Zr,UL as Zt,XR as _,sg as _i,pL as _n,JA as _r,wR as _t,Ez as a,et as aa,cy as ai,nL as an,cN as ar,aR as at,AI as b,Xm as bi,eL as bn,UA as br,YL as bt,xz as c,o as ca,mv as ci,cL as cn,Rj as cr,GI as ct,ez as d,nv as di,yR as dn,vj as dr,oR as dt,Kr as ea,ub as ei,WL as en,UN as er,HI as et,qR as f,ev as fi,bR as fn,uj as fr,KL as ft,JR as g,Sg as gi,hL as gn,nj as gr,xR as gt,ZR as h,Og as hi,uL as hn,V as hr,CR as ht,Tz as i,st as ia,Iy as ii,MR as in,dN as ir,gR as it,fR as j,Ed as ji,kF as jn,mk as jr,DL as jt,qI as k,yf as ki,hI as kn,TA as kr,JL as kt,lz as l,i as la,dv as li,nR as ln,Ij as lr,ER as lt,$R as m,f_ as mi,eR as mn,H as mr,kR as mt,wz as n,vr as na,Zy as ni,DR as nn,WN as nr,iL as nt,$ as o,We as oa,kv as oi,aL as on,$M as or,BL as ot,YR as p,y_ as pi,oL as pn,_j as pr,SR as pt,tL as q,_o as qi,YP as qn,OC as qr,dL as qt,Oz as r,xt as ra,qy as ri,zI as rn,RN as rr,mR as rt,Sz as s,c as sa,Ov as si,tR as sn,Uj as sr,WI as st,tB as t,Lr as ta,lb as ti,EL as tn,JN as tr,rL as tt,tz as u,rv as ui,ZL as un,Cj as ur,$L as ut,QR as v,vh as vi,mL as vn,ZA as vr,UI as vt,sL as w,xp as wi,J as wn,PA as wr,uR as wt,vR as x,Mm as xi,Z as xn,BA as xr,KI as xt,jI as y,eh as yi,iR as yn,GA as yr,YI as yt,$I as z,Xc as zi,eF as zn,NE as zr,AL as zt};
@@ -0,0 +1,3 @@
1
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{$ as t,Bt as n,Cr as r,Et as i,Hn as a,Oi as o,Pn as s,Rn as c,Un as l,Vn as u,Wn as d,Xi as f,Zi as p,Zr as m,at as h,bn as g,fi as _,hi as v,ji as y,ki as b,kn as x,la as S,li as C,ni as w,pi as T,q as E,ri as D,sa as O,zn as ee}from"./dialogs-config-D3xml4W2.js";import{_ as k}from"./react-vendor-DcsTuVun.js";import{a as A,t as j}from"./store-erJP4KTe.js";import{t as M}from"./textarea-C1e4J_5m.js";import{c as N,s as P,u as te}from"./history-view-BnRtfSte.js";import{n as ne}from"./utils-CLxr_0Ql.js";import{a as re,b as ie,d as ae,n as oe,r as se,t as F,y as I}from"./index-CSGl7zru.js";import{a as L,n as R,r as ce,t as z}from"./context-menu-Bs2ogSXU.js";var B=e(S(),1),V=O(),H=r();function U(e){let t=(0,V.c)(17),{children:n,title:r,headerAction:i,footer:a}=e,o;t[0]===r?o=t[1]:(o=r&&(0,H.jsx)(`span`,{className:`text-sm font-semibold tracking-tight`,children:r}),t[0]=r,t[1]=o);let s;t[2]===o?s=t[3]:(s=(0,H.jsx)(`div`,{className:`flex items-center gap-2`,children:o}),t[2]=o,t[3]=s);let c;t[4]===i?c=t[5]:(c=i&&(0,H.jsx)(`div`,{className:`flex items-center gap-2 ml-auto`,children:i}),t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,H.jsxs)(`div`,{className:`flex items-center justify-between border-b border-sidebar-border px-4 py-6`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]===n?u=t[10]:(u=(0,H.jsx)(x,{className:`flex-1`,children:n}),t[9]=n,t[10]=u);let d;t[11]===a?d=t[12]:(d=a&&(0,H.jsx)(`div`,{className:`border-t border-sidebar-border`,children:a}),t[11]=a,t[12]=d);let f;return t[13]!==l||t[14]!==u||t[15]!==d?(f=(0,H.jsxs)(`div`,{className:`flex flex-col h-full`,children:[l,u,d]}),t[13]=l,t[14]=u,t[15]=d,t[16]=f):f=t[16],f}function le(e){let t=[],n={};return e.forEach((e,r)=>{let i=e.path.split(`/`),a=t,o=``;for(let e=0;e<i.length-1;e++){if(o=o?`${o}/${i[e]}`:i[e],!n[o]){let t={id:`dir:${o}`,name:i[e],children:[]};n[o]=t,a.push(t)}a=n[o].children}a.push({id:`file:${e.path}`,name:i[i.length-1],fileIndex:r,status:e.status})}),t}var W={added:`text-green-500`,deleted:`text-red-500`,untracked:`text-green-500`,renamed:`text-blue-500`,modified:`text-orange-500`},G={added:`A`,deleted:`D`,untracked:`U`,renamed:`R`,modified:`M`};function K(e){return d(`status-badge font-mono text-xs font-semibold`,W[e]??`text-orange-500`)}function ue(e){return G[e]??`M`}function de(e){let t=(0,V.c)(37),{treeData:n,files:r,isLoading:i,error:a,selectedFileIndex:s,onFileSelect:c,onRevertFile:l}=e,u;t[0]===r?u=t[1]:(u=r.reduce(pe,0),t[0]=r,t[1]=u);let p=u,h;t[2]===r?h=t[3]:(h=r.reduce(q,0),t[2]=r,t[3]=h);let g=h,_=r.length===1?``:`s`,x;t[4]!==r.length||t[5]!==_?(x=(0,H.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[r.length,` file`,_]}),t[4]=r.length,t[5]=_,t[6]=x):x=t[6];let S;t[7]===p?S=t[8]:(S=(0,H.jsxs)(`span`,{className:`text-xs text-green-500`,children:[`+`,p]}),t[7]=p,t[8]=S);let C;t[9]===g?C=t[10]:(C=(0,H.jsxs)(`span`,{className:`text-xs text-red-500`,children:[`-`,g]}),t[9]=g,t[10]=C);let w;t[11]!==x||t[12]!==S||t[13]!==C?(w=(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[x,S,C]}),t[11]=x,t[12]=S,t[13]=C,t[14]=w):w=t[14];let T=w;if(i){let e;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(`div`,{className:`flex-1 flex items-center justify-center pt-3 pb-2`,children:(0,H.jsx)(v,{className:`h-6 w-6 animate-spin text-muted-foreground`})}),t[15]=e):e=t[15];let n;return t[16]===T?n=t[17]:(n=(0,H.jsx)(U,{title:`Review Changes`,headerAction:T,children:e}),t[16]=T,t[17]=n),n}if(a){let e;t[18]===a?e=t[19]:(e=(0,H.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,H.jsx)(`p`,{className:`text-destructive text-xs text-center`,children:a})}),t[18]=a,t[19]=e);let n;return t[20]!==T||t[21]!==e?(n=(0,H.jsx)(U,{title:`Review Changes`,headerAction:T,children:e}),t[20]=T,t[21]=e,t[22]=n):n=t[22],n}if(r.length===0){let e;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,H.jsx)(`p`,{className:`text-muted-foreground text-xs text-center`,children:`No changes to review`})}),t[23]=e):e=t[23];let n;return t[24]===T?n=t[25]:(n=(0,H.jsx)(U,{title:`Review Changes`,headerAction:T,children:e}),t[24]=T,t[25]=n),n}let E;t[26]!==r||t[27]!==c||t[28]!==l||t[29]!==s?(E=(e,t)=>{let{isOpen:n,toggle:i}=t,a=!!e.children,u=(0,H.jsxs)(I,{onClick:()=>{a?i():e.fileIndex!==void 0&&c(e.fileIndex)},selected:!a&&e.fileIndex===s,className:`gap-1.5`,children:[a?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(f,{className:d(`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform`,n&&`rotate-90`)}),n?(0,H.jsx)(b,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}):(0,H.jsx)(o,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}):(0,H.jsx)(y,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,H.jsx)(`span`,{className:`truncate flex-1 min-w-0`,children:e.name}),!a&&e.status&&(0,H.jsx)(`span`,{className:K(e.status),children:ue(e.status)})]});return a?u:(0,H.jsxs)(z,{children:[(0,H.jsx)(L,{asChild:!0,children:u}),(0,H.jsx)(R,{children:(0,H.jsxs)(ce,{onClick:()=>{e.fileIndex!==void 0&&l?.(r[e.fileIndex])},children:[(0,H.jsx)(m,{className:`mr-2 h-3.5 w-3.5`}),`Revert Change`]})})]})},t[26]=r,t[27]=c,t[28]=l,t[29]=s,t[30]=E):E=t[30];let D;t[31]!==E||t[32]!==n?(D=(0,H.jsx)(`div`,{className:`flex-1 overflow-y-auto pt-3 pb-2 px-1`,children:(0,H.jsx)(ie,{nodes:n,defaultOpen:!0,resetKey:n,indent:16,childContainerClassName:`ml-4 border-l border-sidebar-border pl-2`,renderNode:E})}),t[31]=E,t[32]=n,t[33]=D):D=t[33];let O;return t[34]!==T||t[35]!==D?(O=(0,H.jsx)(U,{title:`Review Changes`,headerAction:T,children:D}),t[34]=T,t[35]=D,t[36]=O):O=t[36],O}function q(e,t){return e+t.hunks.reduce(J,0)}function J(e,t){return e+t.changes.filter(fe).length}function fe(e){return e.type===`delete`}function pe(e,t){return e+t.hunks.reduce(Y,0)}function Y(e,t){return e+t.changes.filter(me).length}function me(e){return e.type===`add`}function he(e){let t=(0,V.c)(2),{isOpen:n}=e,r=n===void 0||n?`ml-[-40px]`:``,i;return t[0]===r?i=t[1]:(i=(0,H.jsx)(F,{withHandle:!0,className:r}),t[0]=r,t[1]=i),i}function ge(e){let t=(0,V.c)(35),{open:n,lineNumber:r,lineContent:i,initialComment:o,isEditing:d,onSave:f,onDelete:p,onClose:m}=e,[h,g]=(0,B.useState)((o===void 0?``:o)??``),_;t[0]!==f||t[1]!==h?(_=()=>{h.trim()&&f(h.trim())},t[0]=f,t[1]=h,t[2]=_):_=t[2];let v=_,y;t[3]===v?y=t[4]:(y=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),v())},t[3]=v,t[4]=y);let b=y,x;t[5]===m?x=t[6]:(x=e=>{e||m()},t[5]=m,t[6]=x);let S;t[7]===r?S=t[8]:(S=(0,H.jsx)(a,{children:(0,H.jsxs)(l,{className:`text-sm font-medium`,children:[`Comment on line `,r]})}),t[7]=r,t[8]=S);let C=i||` `,w;t[9]===C?w=t[10]:(w=(0,H.jsx)(`div`,{className:`rounded bg-muted px-3 py-2 font-mono text-xs text-muted-foreground overflow-x-auto whitespace-pre`,children:C}),t[9]=C,t[10]=w);let T;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>g(e.target.value),t[11]=T):T=t[11];let E;t[12]!==b||t[13]!==h?(E=(0,H.jsx)(M,{autoFocus:!0,placeholder:`Add a comment... (Cmd+Enter to save)`,value:h,onChange:T,onKeyDown:b,rows:12,className:`resize-none text-sm`}),t[12]=b,t[13]=h,t[14]=E):E=t[14];let D;t[15]!==d||t[16]!==p?(D=d&&p&&(0,H.jsx)(s,{variant:`destructive`,size:`sm`,onClick:p,className:`mr-auto`,children:`Delete`}),t[15]=d,t[16]=p,t[17]=D):D=t[17];let O;t[18]===h?O=t[19]:(O=h.trim(),t[18]=h,t[19]=O);let k=!O,A;t[20]!==v||t[21]!==k?(A=(0,H.jsx)(s,{size:`sm`,onClick:v,disabled:k,children:`Save`}),t[20]=v,t[21]=k,t[22]=A):A=t[22];let j;t[23]!==D||t[24]!==A?(j=(0,H.jsxs)(u,{className:`gap-2 sm:gap-0`,children:[D,A]}),t[23]=D,t[24]=A,t[25]=j):j=t[25];let N;t[26]!==j||t[27]!==S||t[28]!==w||t[29]!==E?(N=(0,H.jsxs)(ee,{className:`max-w-2xl`,children:[S,w,E,j]}),t[26]=j,t[27]=S,t[28]=w,t[29]=E,t[30]=N):N=t[30];let P;return t[31]!==n||t[32]!==N||t[33]!==x?(P=(0,H.jsx)(c,{open:n,onOpenChange:x,children:N}),t[31]=n,t[32]=N,t[33]=x,t[34]=P):P=t[34],P}function X({threadId:e,onExit:r}){let{state:a,dispatch:o}=A(),{resolvedTheme:c}=ne(),[l,u]=(0,B.useState)([]),[m,v]=(0,B.useState)(!0),[y,b]=(0,B.useState)(null),[x,S]=(0,B.useState)(0),[O,ee]=(0,B.useState)(!1),[M,ie]=(0,B.useState)(!1),F=(0,B.useRef)(null),I=(0,B.useMemo)(()=>a.diffComments[e]??[],[a.diffComments,e]),L=(0,B.useCallback)(t=>{let n=a.diffComments[e]??[],r=typeof t==`function`?t(n):t;o({type:j.SetDiffComments,threadId:e,comments:r})},[o,e,a.diffComments]),[R,ce]=(0,B.useState)(null),[z,V]=(0,B.useState)(null),[U,W]=(0,B.useState)(null),G=(0,B.useRef)(null),K=(0,B.useRef)(I),ue=(0,B.useRef)(R),q=(0,B.useRef)({isFullView:O,selectedFileIndex:x,files:l}),J=(0,B.useRef)({original:[],modified:[]}),fe=(0,B.useRef)(!0);(0,B.useEffect)(()=>{K.current=I},[I]),(0,B.useEffect)(()=>{ue.current=R},[R]),(0,B.useEffect)(()=>{q.current={isFullView:O,selectedFileIndex:x,files:l}},[O,x,l]);let pe=(0,B.useCallback)(()=>{F.current&&(M?F.current.expand():F.current.collapse())},[M]),Y=(0,B.useCallback)(async()=>{if(e){v(!0),b(null);try{u((await h(e)).files||[]),S(0)}catch(e){b(e instanceof Error?e.message:`Failed to load diff`)}finally{v(!1)}}},[e]);(0,B.useEffect)(()=>{Y()},[Y]);let me=(0,B.useCallback)(async t=>{try{await n(e,t.path),await Y()}catch(e){b(e instanceof Error?e.message:`Failed to revert file`)}},[e,Y]),X=(0,B.useRef)(!1);(0,B.useEffect)(()=>{if((a.diffComments[e]??[]).length>0){X.current=!0;return}i(e).then(t=>{t.diffComments&&t.diffComments.length>0&&o({type:j.SetDiffComments,threadId:e,comments:t.diffComments}),X.current=!0}).catch(()=>{X.current=!0})},[e]),(0,B.useEffect)(()=>{X.current&&g(e,{diffComments:I}).catch(()=>{})},[e,I]);let _e=(0,B.useMemo)(()=>le(l),[l]),Z=e=>{if(e.hunks.length===0)return null;let t=1/0,n=0;return e.hunks.forEach(e=>{let r=Math.min(e.oldStart,e.newStart),i=e.oldStart+e.oldLines,a=e.newStart+e.newLines,o=Math.max(i,a);t=Math.min(t,r),n=Math.max(n,o)}),t===1/0?null:{startLine:Math.max(1,t-2),endLine:n+2}},ve=(e,t,n)=>e.split(`
2
+ `).slice(t-1,n).join(`
3
+ `),ye=e=>{let t=Z(e);return t?t.startLine<=1:!0},be=e=>({ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,md:`markdown`,css:`css`,scss:`scss`,html:`html`,py:`python`,rb:`ruby`,go:`go`,rs:`rust`,java:`java`,kt:`kotlin`,swift:`swift`,c:`c`,cpp:`cpp`,h:`c`,hpp:`cpp`,sh:`shell`,yaml:`yaml`,yml:`yaml`,xml:`xml`,sql:`sql`})[e.split(`.`).pop()??``]||`plaintext`,Q=l[x],xe=Q?O?Q.oldContent:(()=>{let e=Z(Q);return e?ve(Q.oldContent,e.startLine,e.endLine):Q.oldContent})():``,Se=Q?O?Q.newContent:(()=>{let e=Z(Q);return e?ve(Q.newContent,e.startLine,e.endLine):Q.newContent})():``,$=(0,B.useCallback)(()=>{if(!fe.current)return;let e=G.current;if(!e)return;let{isFullView:t,selectedFileIndex:n,files:r}=q.current,i=K.current,a=ue.current,o=r[n];if(!o)return;let s=(e,r)=>{let s=t?null:Z(o),c=i.filter(e=>e.fileIndex===n&&e.side===r).map(e=>{let t=s?e.lineNumber-s.startLine+1:e.lineNumber;if(t<1)return null;let n=i.indexOf(e)===a;return{range:{startLineNumber:t,startColumn:1,endLineNumber:t,endColumn:1},options:{isWholeLine:!0,className:n?`diff-comment-active-line`:`diff-comment-marked-line`,glyphMarginHoverMessage:{value:e.comment}}}}).filter(e=>e!==null),l=r===`original`?J.current.original:J.current.modified,u=e.deltaDecorations(l,c);r===`original`?J.current.original=u:J.current.modified=u};s(e.getOriginalEditor(),`original`),s(e.getModifiedEditor(),`modified`)},[]);(0,B.useEffect)(()=>{$()},[$,I,R,x,O,Q]),(0,B.useEffect)(()=>()=>{G.current=null,J.current={original:[],modified:[]}},[x]),(0,B.useEffect)(()=>()=>{fe.current=!1,G.current&&=(G.current.getOriginalEditor().getModel()?.dispose(),G.current.getModifiedEditor().getModel()?.dispose(),G.current.dispose(),null),J.current={original:[],modified:[]}},[]);let Ce=(0,B.useCallback)(e=>{G.current=e;let t=(e,t)=>{e.onMouseDown(n=>{if(!n.target?.position)return;let r=n.target.position.lineNumber,{isFullView:i,selectedFileIndex:a,files:o}=q.current,s=o[a];if(!s)return;let c=i?null:Z(s),l=c?c.startLine+r-1:r,u=e.getModel()?.getLineContent(r)??``,d=K.current.find(e=>e.fileIndex===a&&e.lineNumber===l&&e.side===t);d?W(d):V({lineNumber:l,lineContent:u,side:t})})};t(e.getOriginalEditor(),`original`),t(e.getModifiedEditor(),`modified`),setTimeout(()=>{G.current===e&&$()},150)},[$]),we=(0,B.useCallback)(e=>{if(z&&Q){let t={id:`comment-${Date.now()}`,filePath:Q.path,fileIndex:x,lineNumber:z.lineNumber,lineContent:z.lineContent,comment:e,side:z.side};L(e=>[...e,t]),V(null)}else U&&(L(t=>t.map(t=>t.id===U.id?{...t,comment:e}:t)),W(null))},[z,U,Q,x,L]),Te=(0,B.useCallback)(()=>{U&&(L(e=>e.filter(e=>e.id!==U.id)),W(null))},[U,L]),Ee=(0,B.useCallback)(e=>{if(I.length===0)return;let t=(e%I.length+I.length)%I.length,n=I[t];ce(t),S(n.fileIndex),setTimeout(()=>{let e=G.current;if(!e)return;let t=l[n.fileIndex];if(!t)return;let r=O?null:Z(t),i=r?n.lineNumber-r.startLine+1:n.lineNumber;(n.side===`original`?e.getOriginalEditor():e.getModifiedEditor()).revealLineInCenter(Math.max(1,i)),$()},100)},[I,l,O,$]),De=(0,B.useCallback)(()=>{Ee((R??0)-1)},[Ee,R]),Oe=(0,B.useCallback)(()=>{Ee((R??-1)+1)},[Ee,R]),ke=(0,B.useCallback)(async()=>{let n=a.projectModelSelections[e];if(!n)try{let e=await t(),r=Object.values(e).flat();if(r.length>0)n=r[0];else{console.error(`No models available to process comments`);return}}catch(e){console.error(`Failed to load models:`,e);return}let i=n.id,s=n.provider;try{let{prompt:t}=await E(e,I);L([]),o({type:j.SetPendingChatMessage,message:{threadId:e,message:t,model:i,provider:s}}),r()}catch(e){console.error(`Failed to fix comments:`,e),typeof window<`u`&&window.alert(`Failed to process comments. Please try again.`)}},[I,a.projectModelSelections,o,e,r,L]),Ae={readOnly:!0,renderSideBySide:!0,ignoreTrimWhitespace:!1,renderOverviewRuler:!0,scrollBeyondLastLine:!1,minimap:{enabled:!1},folding:!1,lineNumbers:Q&&(O||ye(Q))?`on`:`off`,diffWordWrap:`on`,originalEditable:!1,automaticLayout:!0};return(0,H.jsxs)(`div`,{className:`diff-view-root flex h-full flex-col`,children:[(0,H.jsx)(`div`,{className:`diff-body flex flex-1 overflow-hidden`,children:(0,H.jsxs)(se,{direction:`horizontal`,children:[(0,H.jsx)(oe,{ref:F,defaultSize:25,minSize:12,maxSize:40,collapsible:!0,collapsedSize:0,onCollapse:()=>ie(!0),onExpand:()=>ie(!1),className:`border-r border-transparent`,children:(0,H.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,H.jsx)(de,{treeData:_e,files:l,isLoading:m,error:y,selectedFileIndex:x,onFileSelect:S,onRevertFile:me})})}),(0,H.jsx)(he,{isOpen:!M}),(0,H.jsx)(oe,{className:`overflow-hidden bg-transparent`,children:(0,H.jsxs)(`div`,{className:`diff-editor-panel flex h-full bg-transparent flex-col overflow-hidden`,children:[(0,H.jsxs)(re,{className:d(`bg-transparent`,M&&`h-auto py-3 flex-col items-start gap-3 md:flex-row md:items-center md:h-[71px] md:py-0 md:gap-2 justify-between`),children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(s,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground shrink-0`,onClick:pe,children:[M?(0,H.jsx)(w,{className:`h-4 w-4`}):(0,H.jsx)(D,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Toggle file tree`})]}),(0,H.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:Q?Q.path:`Review Changes`})]}),(0,H.jsxs)(`div`,{className:d(`flex items-center gap-2`,M&&`ml-0`,!M&&`ml-auto`,`md:ml-auto`),children:[(0,H.jsx)(s,{variant:`ghost`,size:`sm`,onClick:()=>ee(e=>!e),disabled:!Q,className:`h-8 gap-1 px-2 text-xs`,children:O?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(C,{className:`h-3 w-3`}),` Show changes only`]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(T,{className:`h-3 w-3`}),` Show full file`]})}),I.length>0&&(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(P,{children:[(0,H.jsx)(te,{asChild:!0,children:(0,H.jsx)(s,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:De,disabled:(R??0)===0,children:(0,H.jsx)(p,{className:`h-3 w-3`})})}),(0,H.jsx)(N,{children:`Previous comment`})]}),(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap`,children:I.length===1?`1 Comment`:`Comment ${(R??0)+1} of ${I.length}`}),(0,H.jsxs)(P,{children:[(0,H.jsx)(te,{asChild:!0,children:(0,H.jsx)(s,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:Oe,disabled:(R??0)===I.length-1,children:(0,H.jsx)(f,{className:`h-3 w-3`})})}),(0,H.jsx)(N,{children:`Next comment`})]})]}),I.length>0&&(0,H.jsxs)(P,{children:[(0,H.jsx)(te,{asChild:!0,children:(0,H.jsxs)(s,{size:`sm`,onClick:ke,className:`h-8 gap-1 px-3 text-xs bg-foreground text-background hover:bg-foreground/90`,children:[(0,H.jsx)(_,{className:`h-3 w-3`}),`Fix all comments`]})}),(0,H.jsx)(N,{children:`Send all comments to Tarsk for resolution`})]})]})]}),(0,H.jsxs)(`div`,{className:`flex-1 bg-transparent relative`,children:[(0,H.jsx)(k,{height:`100%`,language:be(Q?.path||``),original:xe,modified:Se,theme:c===`dark`?`vs-dark`:`vs-light`,onMount:Ce,options:Ae},`diff-${x}`),(0,H.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0`,children:(0,H.jsx)(ae,{})})]})]})})]})}),(0,H.jsx)(ge,{open:z!==null||U!==null,lineNumber:U?.lineNumber??z?.lineNumber??0,lineContent:U?.lineContent??z?.lineContent??``,initialComment:U?.comment,isEditing:U!==null,onSave:we,onDelete:Te,onClose:()=>{V(null),W(null)}},`${U?.id??``}-${z?.lineNumber??``}-${z?.side??``}`)]})}export{X as DiffView,X as default};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/explorer-tree-mCR_Wwfz.js","assets/rolldown-runtime-B1FJdls4.js","assets/index-CSGl7zru.js","assets/react-vendor-DcsTuVun.js","assets/history-view-BnRtfSte.js","assets/dialogs-config-D3xml4W2.js","assets/monaco-DvsnxTfD.js","assets/onboarding-eQed-ZzK.js","assets/textarea-C1e4J_5m.js","assets/use-toast-BZ7ir6gB.js","assets/store-erJP4KTe.js","assets/tab-context-CnzSKG0L.js","assets/utils-CLxr_0Ql.js","assets/index-BQ391mCU.css","assets/api-B28NOxKR.js","assets/context-menu-Bs2ogSXU.js","assets/explorer-view-BN9RAXjq.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Cr as t,kn as n,la as r,sa as i}from"./dialogs-config-D3xml4W2.js";import{vt as a}from"./react-vendor-DcsTuVun.js";import{a as o}from"./store-erJP4KTe.js";import{n as s}from"./tab-context-CnzSKG0L.js";import{n as c,r as l,t as u}from"./index-CSGl7zru.js";var d=i(),f=e(r(),1),p=t(),m=(0,f.lazy)(()=>a(()=>import(`./explorer-tree-mCR_Wwfz.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]))),h=(0,f.lazy)(()=>a(()=>import(`./explorer-view-BN9RAXjq.js`),__vite__mapDeps([16,1,2,3,4,5,6,7,8,9,10,11,12,13,14])));function g(){let e=(0,d.c)(17),{state:t}=o(),r=t.selectedThreadId,[i,a]=(0,f.useState)(null),{pendingExplorerPath:g,setPendingExplorerPath:v,explorerClearPath:y,setExplorerClearPath:b}=s(),x,S;e[0]!==g||e[1]!==v?(x=()=>{g&&(a({name:g.split(`/`).pop()??g,type:`file`,path:g}),v(null))},S=[g,v],e[0]=g,e[1]=v,e[2]=x,e[3]=S):(x=e[2],S=e[3]),(0,f.useEffect)(x,S);let C,w;e[4]!==y||e[5]!==b?(C=()=>{y&&(a(e=>e&&(e.path===y||e.path.startsWith(y+`/`)?null:e)),b(null))},w=[y,b],e[4]=y,e[5]=b,e[6]=C,e[7]=w):(C=e[6],w=e[7]),(0,f.useEffect)(C,w);let T;e[8]!==i?.path||e[9]!==r?(T=(0,p.jsx)(c,{defaultSize:25,minSize:15,maxSize:50,className:`overflow-hidden border-r border-border`,children:(0,p.jsx)(n,{className:`h-full`,children:r?(0,p.jsx)(f.Suspense,{fallback:(0,p.jsx)(`div`,{className:`space-y-1 px-2 py-2`,children:[1,2,3].map(_)}),children:(0,p.jsx)(m,{threadId:r,selectedPath:i?.path??null,onFileSelect:a})}):(0,p.jsx)(`p`,{className:`px-3 py-4 text-xs text-muted-foreground text-center`,children:`No thread selected.`})})}),e[8]=i?.path,e[9]=r,e[10]=T):T=e[10];let E;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,p.jsx)(u,{withHandle:!0}),e[11]=E):E=e[11];let D;e[12]===i?D=e[13]:(D=(0,p.jsx)(c,{className:`overflow-hidden`,children:(0,p.jsx)(f.Suspense,{fallback:null,children:(0,p.jsx)(h,{selectedFile:i})})}),e[12]=i,e[13]=D);let O;return e[14]!==T||e[15]!==D?(O=(0,p.jsx)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:(0,p.jsxs)(l,{direction:`horizontal`,className:`flex-1 overflow-hidden`,children:[T,E,D]})}),e[14]=T,e[15]=D,e[16]=O):O=e[16],O}function _(e){return(0,p.jsx)(`div`,{className:`animate-pulse h-7 bg-muted rounded-full`},e)}export{g as default};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Cr as t,Oi as n,Qi as r,Xi as i,hi as a,ji as o,ki as s,la as c,sa as l}from"./dialogs-config-D3xml4W2.js";import{t as u}from"./use-toast-BZ7ir6gB.js";import{n as d}from"./tab-context-CnzSKG0L.js";import{_ as f,g as p,h as m,m as h,p as g,v as _,y as v}from"./index-CSGl7zru.js";import{a as y,i as ee,n as b,r as x,t as S}from"./context-menu-Bs2ogSXU.js";import{n as C,o as w,r as T,s as E,t as D}from"./api-B28NOxKR.js";var O=l(),k=e(c(),1),A=t();function te(e){let t=(0,O.c)(17),{defaultValue:n,onCommit:r,onCancel:i,level:a,basePadding:o,icon:s}=e,c=(0,k.useRef)(null),l,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{c.current?.focus(),c.current?.select()},u=[],t[0]=l,t[1]=u):(l=t[0],u=t[1]),(0,k.useEffect)(l,u);let d;t[2]!==i||t[3]!==r?(d=function(e){if(e.key===`Enter`){let e=c.current?.value.trim()??``;e?r(e):i()}else e.key===`Escape`&&i()},t[2]=i,t[3]=r,t[4]=d):d=t[4];let f=d,p;t[5]!==i||t[6]!==r?(p=function(){let e=c.current?.value.trim()??``;e?r(e):i()},t[5]=i,t[6]=r,t[7]=p):p=t[7];let m=p,h;t[8]!==n||t[9]!==m||t[10]!==f?(h=(0,A.jsx)(`input`,{ref:c,defaultValue:n,onKeyDown:f,onBlur:m,className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-sm`,onClick:j}),t[8]=n,t[9]=m,t[10]=f,t[11]=h):h=t[11];let g;return t[12]!==o||t[13]!==s||t[14]!==a||t[15]!==h?(g=(0,A.jsxs)(v,{level:a,basePadding:o,children:[s,h]}),t[12]=o,t[13]=s,t[14]=a,t[15]=h,t[16]=g):g=t[16],g}function j(e){return e.stopPropagation()}function ne(e){let t=(0,O.c)(101),{node:c,level:l,selectedPath:u,expandedPaths:d,loadedDirs:f,loadingPaths:p,renamingPath:m,newItemIn:h,onToggleFolder:g,onSelectFile:_,onStartRename:C,onCommitRename:w,onCancelRename:T,onDelete:E,onNewFile:D,onNewFolder:k,onCommitNewItem:j,onCancelNewItem:P}=e,F;t[0]!==d||t[1]!==c.path?(F=d.has(c.path),t[0]=d,t[1]=c.path,t[2]=F):F=t[2];let I=F,L;t[3]!==p||t[4]!==c.path?(L=p.has(c.path),t[3]=p,t[4]=c.path,t[5]=L):L=t[5];let R=L,z,B;if(t[6]!==d||t[7]!==I||t[8]!==R||t[9]!==l||t[10]!==f||t[11]!==p||t[12]!==h||t[13]!==c||t[14]!==P||t[15]!==T||t[16]!==j||t[17]!==w||t[18]!==E||t[19]!==D||t[20]!==k||t[21]!==_||t[22]!==C||t[23]!==g||t[24]!==m||t[25]!==u){B=Symbol.for(`react.early_return_sentinel`);bb0:{let e=f.get(c.path)??[];z=m===c.path;let O=h?.dirPath===c.path&&I;if(c.type===`folder`){let M=c.ignored?`opacity-50`:void 0,F;t[28]!==c||t[29]!==g?(F=e=>{e.stopPropagation(),g(c)},t[28]=c,t[29]=g,t[30]=F):F=t[30];let L;t[31]!==I||t[32]!==R?(L=(0,A.jsx)(`span`,{className:`text-muted-foreground w-3 flex-shrink-0`,children:R?(0,A.jsx)(a,{className:`h-3 w-3 animate-spin`}):I?(0,A.jsx)(r,{className:`h-3 w-3`}):(0,A.jsx)(i,{className:`h-3 w-3`})}),t[31]=I,t[32]=R,t[33]=L):L=t[33];let V;t[34]!==I||t[35]!==z||t[36]!==c||t[37]!==T||t[38]!==w?(V=z?(0,A.jsxs)(A.Fragment,{children:[I?(0,A.jsx)(s,{className:`h-4 w-4 flex-shrink-0`}):(0,A.jsx)(n,{className:`h-4 w-4 flex-shrink-0`}),(0,A.jsx)(`input`,{autoFocus:!0,defaultValue:c.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?w(c,t):T()}else e.key===`Escape`&&T()},onBlur:e=>{let t=e.target.value.trim();t?w(c,t):T()},onClick:N,className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-sm`})]}):(0,A.jsxs)(A.Fragment,{children:[I?(0,A.jsx)(s,{className:`h-4 w-4 flex-shrink-0`}):(0,A.jsx)(n,{className:`h-4 w-4 flex-shrink-0`}),(0,A.jsx)(`span`,{className:`flex-1 truncate`,children:c.name})]}),t[34]=I,t[35]=z,t[36]=c,t[37]=T,t[38]=w,t[39]=V):V=t[39];let H;t[40]!==l||t[41]!==M||t[42]!==F||t[43]!==L||t[44]!==V?(H=(0,A.jsxs)(v,{level:l,basePadding:10,className:M,onClick:F,children:[L,V]}),t[40]=l,t[41]=M,t[42]=F,t[43]=L,t[44]=V,t[45]=H):H=t[45];let U=I&&(0,A.jsx)(`div`,{children:R&&!f.has(c.path)?(0,A.jsx)(`div`,{className:`animate-pulse h-4 bg-muted rounded mx-4 my-1`}):(0,A.jsxs)(A.Fragment,{children:[O&&(0,A.jsx)(te,{defaultValue:``,level:l+1,basePadding:h.type===`folder`?10:22,icon:h.type===`folder`?(0,A.jsx)(n,{className:`h-4 w-4 flex-shrink-0`}):(0,A.jsx)(o,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:j,onCancel:P}),e.map(e=>(0,A.jsx)(ne,{node:e,level:l+1,selectedPath:u,expandedPaths:d,loadedDirs:f,loadingPaths:p,renamingPath:m,newItemIn:h,onToggleFolder:g,onSelectFile:_,onStartRename:C,onCommitRename:w,onCancelRename:T,onDelete:E,onNewFile:D,onNewFolder:k,onCommitNewItem:j,onCancelNewItem:P},e.path))]})}),W;t[46]!==H||t[47]!==U?(W=(0,A.jsxs)(`div`,{children:[H,U]}),t[46]=H,t[47]=U,t[48]=W):W=t[48];let G=W,K;t[49]===G?K=t[50]:(K=(0,A.jsx)(y,{asChild:!0,children:G}),t[49]=G,t[50]=K);let q;t[51]!==c.path||t[52]!==D?(q=(0,A.jsx)(x,{onSelect:()=>D(c.path),children:`New File...`}),t[51]=c.path,t[52]=D,t[53]=q):q=t[53];let J;t[54]!==c.path||t[55]!==k?(J=(0,A.jsx)(x,{onSelect:()=>k(c.path),children:`New Folder...`}),t[54]=c.path,t[55]=k,t[56]=J):J=t[56];let Y;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,A.jsx)(ee,{}),t[57]=Y):Y=t[57];let X;t[58]!==c||t[59]!==C?(X=(0,A.jsx)(x,{onSelect:()=>C(c),children:`Rename...`}),t[58]=c,t[59]=C,t[60]=X):X=t[60];let Z;t[61]!==c||t[62]!==E?(Z=(0,A.jsx)(x,{onSelect:()=>E(c),className:`text-destructive focus:text-destructive`,children:`Delete`}),t[61]=c,t[62]=E,t[63]=Z):Z=t[63];let Q;t[64]!==q||t[65]!==J||t[66]!==X||t[67]!==Z?(Q=(0,A.jsxs)(b,{children:[q,J,Y,X,Z]}),t[64]=q,t[65]=J,t[66]=X,t[67]=Z,t[68]=Q):Q=t[68];let $;t[69]!==K||t[70]!==Q?($=(0,A.jsxs)(S,{children:[K,Q]}),t[69]=K,t[70]=Q,t[71]=$):$=t[71],B=$;break bb0}}t[6]=d,t[7]=I,t[8]=R,t[9]=l,t[10]=f,t[11]=p,t[12]=h,t[13]=c,t[14]=P,t[15]=T,t[16]=j,t[17]=w,t[18]=E,t[19]=D,t[20]=k,t[21]=_,t[22]=C,t[23]=g,t[24]=m,t[25]=u,t[26]=z,t[27]=B}else z=t[26],B=t[27];if(B!==Symbol.for(`react.early_return_sentinel`))return B;let V=u===c.path,H=c.ignored?`opacity-50`:void 0,U;t[72]!==c||t[73]!==_?(U=()=>_(c),t[72]=c,t[73]=_,t[74]=U):U=t[74];let W;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,A.jsx)(o,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),t[75]=W):W=t[75];let G;t[76]!==z||t[77]!==c||t[78]!==T||t[79]!==w?(G=z?(0,A.jsx)(`input`,{autoFocus:!0,defaultValue:c.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?w(c,t):T()}else e.key===`Escape`&&T()},onBlur:e=>{let t=e.target.value.trim();t?w(c,t):T()},onClick:M,className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-sm`}):(0,A.jsx)(`span`,{className:`flex-1 truncate`,children:c.name}),t[76]=z,t[77]=c,t[78]=T,t[79]=w,t[80]=G):G=t[80];let K;t[81]!==l||t[82]!==V||t[83]!==H||t[84]!==U||t[85]!==G?(K=(0,A.jsxs)(v,{level:l,basePadding:22,selected:V,className:H,onClick:U,children:[W,G]}),t[81]=l,t[82]=V,t[83]=H,t[84]=U,t[85]=G,t[86]=K):K=t[86];let q=K,J;t[87]===q?J=t[88]:(J=(0,A.jsx)(y,{asChild:!0,children:q}),t[87]=q,t[88]=J);let Y;t[89]!==c||t[90]!==C?(Y=(0,A.jsx)(x,{onSelect:()=>C(c),children:`Rename...`}),t[89]=c,t[90]=C,t[91]=Y):Y=t[91];let X;t[92]!==c||t[93]!==E?(X=(0,A.jsx)(x,{onSelect:()=>E(c),className:`text-destructive focus:text-destructive`,children:`Delete`}),t[92]=c,t[93]=E,t[94]=X):X=t[94];let Z;t[95]!==Y||t[96]!==X?(Z=(0,A.jsxs)(b,{children:[Y,X]}),t[95]=Y,t[96]=X,t[97]=Z):Z=t[97];let Q;return t[98]!==J||t[99]!==Z?(Q=(0,A.jsxs)(S,{children:[J,Z]}),t[98]=J,t[99]=Z,t[100]=Q):Q=t[100],Q}function M(e){return e.stopPropagation()}function N(e){return e.stopPropagation()}function P({threadId:e,selectedPath:t,onFileSelect:r}){let[i,a]=(0,k.useState)(new Map),[s,c]=(0,k.useState)(new Set),[l,v]=(0,k.useState)(new Set),[ee,O]=(0,k.useState)(null),[j,M]=(0,k.useState)(null),[N,P]=(0,k.useState)(null),{explorerRefreshTick:F,pendingExplorerPath:I}=d();async function L(t){if(!(!e||i.has(t))){v(e=>new Set(e).add(t));try{let n=await w(e,t);a(e=>new Map(e).set(t,n.entries))}catch{u({title:`Error`,description:`Failed to load directory`,variant:`destructive`})}finally{v(e=>{let n=new Set(e);return n.delete(t),n})}}}let R=(0,k.useCallback)(async t=>{if(e){v(e=>new Set(e).add(t));try{let n=await w(e,t);a(e=>new Map(e).set(t,n.entries))}catch{u({title:`Error`,description:`Failed to reload directory`,variant:`destructive`})}finally{v(e=>{let n=new Set(e);return n.delete(t),n})}}},[e]);(0,k.useEffect)(()=>{e&&(a(new Map),c(new Set),v(new Set),O(null),M(null),L(``))},[e]),(0,k.useEffect)(()=>{if(F>0&&e){R(``);for(let e of s)R(e)}},[F]),(0,k.useEffect)(()=>{if(!I||!e)return;let t=I.split(`/`);t.pop();let n=[],r=``;for(let e of t)r=r?`${r}/${e}`:e,n.push(r);if(n.length!==0){c(e=>{let t=new Set(e);for(let e of n)t.add(e);return t});for(let e of n)L(e)}},[I,e]);function z(e){s.has(e.path)?c(t=>{let n=new Set(t);return n.delete(e.path),n}):(c(t=>new Set(t).add(e.path)),L(e.path))}function B(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(0,t):``}function V(e){P(e)}async function H(){if(!N)return;let t=N;P(null);try{await T(e,t.path),await R(B(t.path)),c(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),a(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n})}catch{u({title:`Error`,description:`Failed to move "${t.name}" to trash`,variant:`destructive`})}}function U(e){M(null),O(e.path)}async function W(t,n){if(n===t.name){O(null);return}O(null);try{await E(e,t.path,n),await R(B(t.path)),t.type===`folder`&&(c(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),a(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}))}catch{u({title:`Error`,description:`Failed to rename "${t.name}"`,variant:`destructive`})}}function G(e){O(null),s.has(e)||(c(t=>new Set(t).add(e)),L(e)),M({dirPath:e,type:`file`})}function K(e){O(null),s.has(e)||(c(t=>new Set(t).add(e)),L(e)),M({dirPath:e,type:`folder`})}async function q(t){if(!j)return;let{dirPath:n,type:r}=j;M(null);try{r===`file`?await D(e,n,t):await C(e,n,t),await R(n)}catch{u({title:`Error`,description:`Failed to create ${r} "${t}"`,variant:`destructive`})}}function J(){M(null)}let Y=i.get(``)??[],X=l.has(``),Z=j?.dirPath===``?(0,A.jsx)(te,{defaultValue:``,level:0,basePadding:j.type===`folder`?10:22,icon:j.type===`folder`?(0,A.jsx)(n,{className:`h-4 w-4 flex-shrink-0`}):(0,A.jsx)(o,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:q,onCancel:J}):null;return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(g,{open:N!==null,onOpenChange:e=>!e&&P(null),children:(0,A.jsxs)(p,{children:[(0,A.jsx)(_,{children:`Move to Trash`}),(0,A.jsxs)(f,{children:[`Move “`,N?.name,`” to trash?`]}),(0,A.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[(0,A.jsx)(m,{children:`Cancel`}),(0,A.jsx)(h,{onClick:()=>void H(),children:`Move to Trash`})]})]})}),(0,A.jsxs)(S,{children:[(0,A.jsx)(y,{asChild:!0,children:(0,A.jsx)(`div`,{className:`py-2 min-h-full`,children:X?(0,A.jsx)(`div`,{className:`space-y-1 px-2`,children:[1,2,3].map(e=>(0,A.jsx)(`div`,{className:`animate-pulse h-7 bg-muted rounded-full`},e))}):(0,A.jsxs)(A.Fragment,{children:[Z,Y.map(e=>(0,A.jsx)(ne,{node:e,level:0,selectedPath:t,expandedPaths:s,loadedDirs:i,loadingPaths:l,renamingPath:ee,newItemIn:j,onToggleFolder:z,onSelectFile:r,onStartRename:U,onCommitRename:W,onCancelRename:()=>O(null),onDelete:V,onNewFile:G,onNewFolder:K,onCommitNewItem:q,onCancelNewItem:J},e.path))]})})}),(0,A.jsxs)(b,{children:[(0,A.jsx)(x,{onSelect:()=>G(``),children:`New File...`}),(0,A.jsx)(x,{onSelect:()=>K(``),children:`New Folder...`})]})]})]})}export{P as default};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Cr as t,Pi as n,Pn as r,_i as i,da as a}from"./dialogs-config-jWciSgHl.js";import{g as o}from"./react-vendor-C9VUgcc-.js";import{a as s}from"./store-CHZlq7-o.js";import{t as c}from"./use-toast-CoI8ds2n.js";import{n as l}from"./utils-CCEUAD_u.js";import{a as u}from"./index-DYQT8pCu.js";import{a as d,c as f,i as p}from"./api-CTYLCFyl.js";var m=e(a(),1),h=t(),g=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`ico`,`bmp`,`tiff`,`tif`]),_=new Set([`mp4`,`webm`,`mov`,`avi`]);function v(e){let t=e.split(`.`).pop()?.toLowerCase()??``;return g.has(t)?`image`:_.has(t)?`video`:null}function y(e){return{ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,md:`markdown`,mdc:`markdown`,css:`css`,scss:`scss`,html:`html`,py:`python`,sh:`shell`,yaml:`yaml`,yml:`yaml`,xml:`xml`,sql:`sql`}[e.split(`.`).pop()??``]??`plaintext`}function b({selectedFile:e}){let{state:t}=s(),{resolvedTheme:a}=l(),g=t.selectedThreadId,_=(0,m.useRef)(null),[b,x]=(0,m.useState)(``),[S,C]=(0,m.useState)(``),[w,T]=(0,m.useState)(!1),[E,D]=(0,m.useState)(!1);(0,m.useEffect)(()=>()=>{_.current&&=(_.current.getModel()?.dispose(),_.current.dispose(),null)},[]);async function O(){if(!(!g||!e)){D(!0);try{await f(g,e.path,b),C(b),c({title:`Saved`,description:`${e.name} saved successfully.`})}catch(e){c({title:`Error`,description:e instanceof Error?e.message:`Failed to save file`,variant:`destructive`})}finally{D(!1)}}}let k=(0,m.useCallback)(async e=>{if(g){T(!0);try{let t=await p(g,e.path);x(t.content),C(t.content)}catch(e){c({title:`Error`,description:e instanceof Error?e.message:`Failed to load file`,variant:`destructive`})}finally{T(!1)}}},[g]);return(0,m.useEffect)(()=>{e&&g?v(e.path)||k(e):(x(``),C(``))},[e,g,k]),g?(0,h.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,h.jsxs)(u,{className:`justify-between`,children:[(0,h.jsxs)(`div`,{className:`flex flex-col`,children:[(0,h.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:e?e.name:`Select a file to edit`}),(0,h.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e?e.path:`Browse and edit repository files`})]}),e&&!v(e.path)&&(0,h.jsx)(`div`,{className:`flex gap-1`,children:(0,h.jsxs)(r,{size:`sm`,onClick:()=>void O(),disabled:E||!b||b===S,children:[E?(0,h.jsx)(i,{className:`h-4 w-4 animate-spin`}):null,`Save`]})})]}),(0,h.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:(0,h.jsx)(`div`,{className:`h-full relative overflow-hidden`,children:w?(0,h.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,h.jsx)(i,{className:`h-6 w-6 animate-spin text-muted-foreground`})}):e&&v(e.path)===`image`?(0,h.jsx)(`div`,{className:`flex items-center justify-center h-full p-4 overflow-auto`,children:(0,h.jsx)(`img`,{src:d(g,e.path),alt:e.name,className:`max-w-full max-h-full object-contain`})}):e&&v(e.path)===`video`?(0,h.jsx)(`div`,{className:`flex items-center justify-center h-full p-4`,children:(0,h.jsx)(`video`,{src:d(g,e.path),controls:!0,className:`max-w-full max-h-full`})}):e?(0,h.jsx)(o,{height:`100%`,language:y(e.path),value:b,onChange:e=>x(e??``),onMount:e=>{_.current=e},theme:a===`dark`?`vs-dark`:`vs-light`,options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:`on`,automaticLayout:!0,fontSize:13,lineNumbers:`on`,renderLineHighlight:`line`,scrollbar:{vertical:`auto`,horizontal:`auto`}}}):(0,h.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center p-8`,children:[(0,h.jsx)(n,{className:`h-10 w-10 text-muted-foreground/50`}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`No file selected`}),(0,h.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:`Select a file from the tree to edit it`})]})]})})})]}):(0,h.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center`,children:[(0,h.jsx)(n,{className:`h-8 w-8 text-muted-foreground`}),(0,h.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Select a thread to browse its files`})]})}export{b as default};
1
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Cr as t,Mi as n,Pn as r,hi as i,la as a}from"./dialogs-config-D3xml4W2.js";import{g as o}from"./react-vendor-DcsTuVun.js";import{a as s}from"./store-erJP4KTe.js";import{t as c}from"./use-toast-BZ7ir6gB.js";import{n as l}from"./utils-CLxr_0Ql.js";import{a as u}from"./index-CSGl7zru.js";import{a as d,c as f,i as p}from"./api-B28NOxKR.js";var m=e(a(),1),h=t(),g=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`ico`,`bmp`,`tiff`,`tif`]),_=new Set([`mp4`,`webm`,`mov`,`avi`]);function v(e){let t=e.split(`.`).pop()?.toLowerCase()??``;return g.has(t)?`image`:_.has(t)?`video`:null}function y(e){return{ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,md:`markdown`,mdc:`markdown`,css:`css`,scss:`scss`,html:`html`,py:`python`,sh:`shell`,yaml:`yaml`,yml:`yaml`,xml:`xml`,sql:`sql`}[e.split(`.`).pop()??``]??`plaintext`}function b({selectedFile:e}){let{state:t}=s(),{resolvedTheme:a}=l(),g=t.selectedThreadId,_=(0,m.useRef)(null),[b,x]=(0,m.useState)(``),[S,C]=(0,m.useState)(``),[w,T]=(0,m.useState)(!1),[E,D]=(0,m.useState)(!1);(0,m.useEffect)(()=>()=>{_.current&&=(_.current.getModel()?.dispose(),_.current.dispose(),null)},[]);async function O(){if(!(!g||!e)){D(!0);try{await f(g,e.path,b),C(b),c({title:`Saved`,description:`${e.name} saved successfully.`})}catch(e){c({title:`Error`,description:e instanceof Error?e.message:`Failed to save file`,variant:`destructive`})}finally{D(!1)}}}let k=(0,m.useCallback)(async e=>{if(g){T(!0);try{let t=await p(g,e.path);x(t.content),C(t.content)}catch(e){c({title:`Error`,description:e instanceof Error?e.message:`Failed to load file`,variant:`destructive`})}finally{T(!1)}}},[g]);return(0,m.useEffect)(()=>{e&&g?v(e.path)||k(e):(x(``),C(``))},[e,g,k]),g?(0,h.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,h.jsxs)(u,{className:`justify-between`,children:[(0,h.jsxs)(`div`,{className:`flex flex-col`,children:[(0,h.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:e?e.name:`Select a file to edit`}),(0,h.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e?e.path:`Browse and edit repository files`})]}),e&&!v(e.path)&&(0,h.jsx)(`div`,{className:`flex gap-1`,children:(0,h.jsxs)(r,{size:`sm`,onClick:()=>void O(),disabled:E||!b||b===S,children:[E?(0,h.jsx)(i,{className:`h-4 w-4 animate-spin`}):null,`Save`]})})]}),(0,h.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:(0,h.jsx)(`div`,{className:`h-full relative overflow-hidden`,children:w?(0,h.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,h.jsx)(i,{className:`h-6 w-6 animate-spin text-muted-foreground`})}):e&&v(e.path)===`image`?(0,h.jsx)(`div`,{className:`flex items-center justify-center h-full p-4 overflow-auto`,children:(0,h.jsx)(`img`,{src:d(g,e.path),alt:e.name,className:`max-w-full max-h-full object-contain`})}):e&&v(e.path)===`video`?(0,h.jsx)(`div`,{className:`flex items-center justify-center h-full p-4`,children:(0,h.jsx)(`video`,{src:d(g,e.path),controls:!0,className:`max-w-full max-h-full`})}):e?(0,h.jsx)(o,{height:`100%`,language:y(e.path),value:b,onChange:e=>x(e??``),onMount:e=>{_.current=e},theme:a===`dark`?`vs-dark`:`vs-light`,options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:`on`,automaticLayout:!0,fontSize:13,lineNumbers:`on`,renderLineHighlight:`line`,scrollbar:{vertical:`auto`,horizontal:`auto`}}}):(0,h.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center p-8`,children:[(0,h.jsx)(n,{className:`h-10 w-10 text-muted-foreground/50`}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`No file selected`}),(0,h.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:`Select a file from the tree to edit it`})]})]})})})]}):(0,h.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center`,children:[(0,h.jsx)(n,{className:`h-8 w-8 text-muted-foreground`}),(0,h.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Select a thread to browse its files`})]})}export{b as default};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{$i as t,An as n,Bi as r,Cr as i,Er as a,Pn as o,Qi as s,Sr as c,Tr as l,Wi as u,Wn as d,Xi as f,Yi as p,Zi as m,_r as h,a as g,ar as _,br as v,ca as y,cr as b,fr as x,hr as S,i as C,jn as w,kn as T,kr as E,la as D,lr as O,mr as k,n as A,or as j,r as M,rt as N,sa as ee,sr as te,u as ne,ur as re,vr as ie,xr as P,yr as ae}from"./dialogs-config-D3xml4W2.js";var oe=[`top`,`right`,`bottom`,`left`],F=Math.min,I=Math.max,se=Math.round,ce=Math.floor,L=e=>({x:e,y:e}),le={left:`right`,right:`left`,bottom:`top`,top:`bottom`},ue={start:`end`,end:`start`};function de(e,t,n){return I(e,F(t,n))}function R(e,t){return typeof e==`function`?e(t):e}function z(e){return e.split(`-`)[0]}function fe(e){return e.split(`-`)[1]}function pe(e){return e===`x`?`y`:`x`}function me(e){return e===`y`?`height`:`width`}var he=new Set([`top`,`bottom`]);function B(e){return he.has(z(e))?`y`:`x`}function ge(e){return pe(B(e))}function _e(e,t,n){n===void 0&&(n=!1);let r=fe(e),i=ge(e),a=me(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Ee(o)),[o,Ee(o)]}function ve(e){let t=Ee(e);return[ye(e),t,ye(t)]}function ye(e){return e.replace(/start|end/g,e=>ue[e])}var be=[`left`,`right`],xe=[`right`,`left`],Se=[`top`,`bottom`],Ce=[`bottom`,`top`];function we(e,t,n){switch(e){case`top`:case`bottom`:return n?t?xe:be:t?be:xe;case`left`:case`right`:return t?Se:Ce;default:return[]}}function Te(e,t,n,r){let i=fe(e),a=we(z(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(ye)))),a}function Ee(e){return e.replace(/left|right|bottom|top/g,e=>le[e])}function De(e){return{top:0,right:0,bottom:0,left:0,...e}}function Oe(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:De(e)}function ke(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Ae(e,t,n){let{reference:r,floating:i}=e,a=B(t),o=ge(t),s=me(o),c=z(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(fe(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function je(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=R(t,e),p=Oe(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=ke(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=ke(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Me=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=a.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Ae(l,r,c),f=r,p={},m=0;for(let n=0;n<s.length;n++){let{name:a,fn:h}=s[n],{x:g,y:_,data:v,reset:y}=await h({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:p,rects:l,platform:{...o,detectOverflow:o.detectOverflow??je},elements:{reference:e,floating:t}});u=g??u,d=_??d,p={...p,[a]:{...p[a],...v}},y&&m<=50&&(m++,typeof y==`object`&&(y.placement&&(f=y.placement),y.rects&&(l=y.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):y.rects),{x:u,y:d}=Ae(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}},Ne=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=R(e,t)||{};if(l==null)return{};let d=Oe(u),f={x:n,y:r},p=ge(i),m=me(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=F(d[_],T),D=F(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=de(O,A,k),M=!c.arrow&&fe(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,N=M?A<O?A-O:A-k:0;return{[p]:f[p]+N,data:{[p]:j,centerOffset:A-j-N,...M&&{alignmentOffset:N}},reset:M}}}),Pe=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=R(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=z(r),_=B(o),v=z(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Ee(o)]:ve(o)),x=p!==`none`;!d&&x&&b.push(...Te(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=_e(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==B(t))||T.every(e=>B(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=B(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function Fe(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ie(e){return oe.some(t=>e[t]>=0)}var Le=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=R(e,t);switch(i){case`referenceHidden`:{let e=Fe(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Ie(e)}}}case`escaped`:{let e=Fe(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Ie(e)}}}default:return{}}}}},Re=new Set([`left`,`top`]);async function ze(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=z(n),s=fe(n),c=B(n)===`y`,l=Re.has(o)?-1:1,u=a&&c?-1:1,d=R(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Be=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await ze(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Ve=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=R(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=B(z(i)),p=pe(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=de(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=de(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},He=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=R(e,t),u={x:n,y:r},d=B(i),f=pe(d),p=u[f],m=u[d],h=R(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Re.has(z(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Ue=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=R(e,t),u=await o.detectOverflow(t,l),d=z(i),f=fe(i),p=B(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=F(h-u[g],v),x=F(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=I(u.left,0),t=I(u.right,0),n=I(u.top,0),r=I(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:I(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:I(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function We(){return typeof window<`u`}function Ge(e){return Ke(e)?(e.nodeName||``).toLowerCase():`#document`}function V(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function H(e){return((Ke(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Ke(e){return We()?e instanceof Node||e instanceof V(e).Node:!1}function U(e){return We()?e instanceof Element||e instanceof V(e).Element:!1}function W(e){return We()?e instanceof HTMLElement||e instanceof V(e).HTMLElement:!1}function qe(e){return!We()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof V(e).ShadowRoot}var Je=new Set([`inline`,`contents`]);function Ye(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=G(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Je.has(i)}var Xe=new Set([`table`,`td`,`th`]);function Ze(e){return Xe.has(Ge(e))}var Qe=[`:popover-open`,`:modal`];function $e(e){return Qe.some(t=>{try{return e.matches(t)}catch{return!1}})}var et=[`transform`,`translate`,`scale`,`rotate`,`perspective`],tt=[`transform`,`translate`,`scale`,`rotate`,`perspective`,`filter`],nt=[`paint`,`layout`,`strict`,`content`];function rt(e){let t=at(),n=U(e)?G(e):e;return et.some(e=>n[e]?n[e]!==`none`:!1)||(n.containerType?n.containerType!==`normal`:!1)||!t&&(n.backdropFilter?n.backdropFilter!==`none`:!1)||!t&&(n.filter?n.filter!==`none`:!1)||tt.some(e=>(n.willChange||``).includes(e))||nt.some(e=>(n.contain||``).includes(e))}function it(e){let t=K(e);for(;W(t)&&!st(t);){if(rt(t))return t;if($e(t))return null;t=K(t)}return null}function at(){return typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter`,`none`)}var ot=new Set([`html`,`body`,`#document`]);function st(e){return ot.has(Ge(e))}function G(e){return V(e).getComputedStyle(e)}function ct(e){return U(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function K(e){if(Ge(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||qe(e)&&e.host||H(e);return qe(t)?t.host:t}function lt(e){let t=K(e);return st(t)?e.ownerDocument?e.ownerDocument.body:e.body:W(t)&&Ye(t)?t:lt(t)}function ut(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=lt(e),i=r===e.ownerDocument?.body,a=V(r);if(i){let e=dt(a);return t.concat(a,a.visualViewport||[],Ye(r)?r:[],e&&n?ut(e):[])}return t.concat(r,ut(r,[],n))}function dt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ft(e){let t=G(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=W(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=se(n)!==a||se(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function pt(e){return U(e)?e:e.contextElement}function mt(e){let t=pt(e);if(!W(t))return L(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=ft(t),o=(a?se(n.width):n.width)/r,s=(a?se(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var ht=L(0);function gt(e){let t=V(e);return!at()||!t.visualViewport?ht:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function _t(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==V(e)?!1:t}function vt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=pt(e),o=L(1);t&&(r?U(r)&&(o=mt(r)):o=mt(e));let s=_t(a,n,r)?gt(a):L(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=V(a),t=r&&U(r)?V(r):r,n=e,i=dt(n);for(;i&&r&&t!==n;){let e=mt(i),t=i.getBoundingClientRect(),r=G(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=V(i),i=dt(n)}}return ke({width:u,height:d,x:c,y:l})}function yt(e,t){let n=ct(e).scrollLeft;return t?t.left+n:vt(H(e)).left+n}function bt(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-yt(e,n),y:n.top+t.scrollTop}}function xt(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=H(r),s=t?$e(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=L(1),u=L(0),d=W(r);if((d||!d&&!a)&&((Ge(r)!==`body`||Ye(o))&&(c=ct(r)),W(r))){let e=vt(r);l=mt(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?bt(o,c):L(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function St(e){return Array.from(e.getClientRects())}function Ct(e){let t=H(e),n=ct(e),r=e.ownerDocument.body,i=I(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=I(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+yt(e),s=-n.scrollTop;return G(r).direction===`rtl`&&(o+=I(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var wt=25;function Tt(e,t){let n=V(e),r=H(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=at();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=yt(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=wt&&(a-=o)}else l<=wt&&(a+=l);return{width:a,height:o,x:s,y:c}}var Et=new Set([`absolute`,`fixed`]);function Dt(e,t){let n=vt(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=W(e)?mt(e):L(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Ot(e,t,n){let r;if(t===`viewport`)r=Tt(e,n);else if(t===`document`)r=Ct(H(e));else if(U(t))r=Dt(t,n);else{let n=gt(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return ke(r)}function kt(e,t){let n=K(e);return n===t||!U(n)||st(n)?!1:G(n).position===`fixed`||kt(n,t)}function At(e,t){let n=t.get(e);if(n)return n;let r=ut(e,[],!1).filter(e=>U(e)&&Ge(e)!==`body`),i=null,a=G(e).position===`fixed`,o=a?K(e):e;for(;U(o)&&!st(o);){let t=G(o),n=rt(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&Et.has(i.position)||Ye(o)&&!n&&kt(e,o))?r=r.filter(e=>e!==o):i=t,o=K(o)}return t.set(e,r),r}function jt(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?$e(t)?[]:At(t,this._c):[].concat(n),r],o=a[0],s=a.reduce((e,n)=>{let r=Ot(t,n,i);return e.top=I(r.top,e.top),e.right=F(r.right,e.right),e.bottom=F(r.bottom,e.bottom),e.left=I(r.left,e.left),e},Ot(t,o,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function Mt(e){let{width:t,height:n}=ft(e);return{width:t,height:n}}function Nt(e,t,n){let r=W(t),i=H(t),a=n===`fixed`,o=vt(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=L(0);function l(){c.x=yt(i)}if(r||!r&&!a)if((Ge(t)!==`body`||Ye(i))&&(s=ct(t)),r){let e=vt(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?bt(i,s):L(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function Pt(e){return G(e).position===`static`}function Ft(e,t){if(!W(e)||G(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return H(e)===n&&(n=n.ownerDocument.body),n}function It(e,t){let n=V(e);if($e(e))return n;if(!W(e)){let t=K(e);for(;t&&!st(t);){if(U(t)&&!Pt(t))return t;t=K(t)}return n}let r=Ft(e,t);for(;r&&Ze(r)&&Pt(r);)r=Ft(r,t);return r&&st(r)&&Pt(r)&&!rt(r)?n:r||it(e)||n}var Lt=async function(e){let t=this.getOffsetParent||It,n=this.getDimensions,r=await n(e.floating);return{reference:Nt(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Rt(e){return G(e).direction===`rtl`}var zt={convertOffsetParentRelativeRectToViewportRelativeRect:xt,getDocumentElement:H,getClippingRect:jt,getOffsetParent:It,getElementRects:Lt,getClientRects:St,getDimensions:Mt,getScale:mt,isElement:U,isRTL:Rt};function Bt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Vt(e,t){let n=null,r,i=H(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=ce(d),h=ce(i.clientWidth-(u+f)),g=ce(i.clientHeight-(d+p)),_=ce(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:I(0,F(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!Bt(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function Ht(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=pt(e),u=i||a?[...l?ut(l):[],...ut(t)]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Vt(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),p.observe(t));let m,h=c?vt(e):null;c&&g();function g(){let t=vt(e);h&&!Bt(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Ut=Be,Wt=Ve,Gt=Pe,Kt=Ue,qt=Le,Jt=Ne,Yt=He,Xt=(e,t,n)=>{let r=new Map,i={platform:zt,...n},a={...i.platform,_c:r};return Me(e,t,{...i,platform:a})},q=e(D(),1),Zt=e(y(),1),Qt=typeof document<`u`?q.useLayoutEffect:function(){};function $t(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!$t(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!$t(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function en(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function tn(e,t){let n=en(e);return Math.round(t*n)/n}function nn(e){let t=q.useRef(e);return Qt(()=>{t.current=e}),t}function rn(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=q.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=q.useState(r);$t(f,r)||p(r);let[m,h]=q.useState(null),[g,_]=q.useState(null),v=q.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=q.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=q.useRef(null),C=q.useRef(null),w=q.useRef(u),T=c!=null,E=nn(c),D=nn(i),O=nn(l),k=q.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),Xt(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!$t(w.current,t)&&(w.current=t,Zt.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);Qt(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=q.useRef(!1);Qt(()=>(A.current=!0,()=>{A.current=!1}),[]),Qt(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=q.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=q.useMemo(()=>({reference:b,floating:x}),[b,x]),N=q.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=tn(M.floating,u.x),r=tn(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...en(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return q.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var an=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Jt({element:r.current,padding:i}).fn(n):r?Jt({element:r,padding:i}).fn(n):{}}}},on=(e,t)=>({...Ut(e),options:[e,t]}),sn=(e,t)=>({...Wt(e),options:[e,t]}),cn=(e,t)=>({...Yt(e),options:[e,t]}),ln=(e,t)=>({...Gt(e),options:[e,t]}),un=(e,t)=>({...Kt(e),options:[e,t]}),dn=(e,t)=>({...qt(e),options:[e,t]}),fn=(e,t)=>({...an(e),options:[e,t]}),J=i(),pn=`Arrow`,mn=q.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,J.jsx)(S.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,J.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});mn.displayName=pn;var hn=mn;function gn(e){let[t,n]=q.useState(void 0);return P(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var _n=`Popper`,[vn,yn]=c(_n),[bn,xn]=vn(_n),Sn=e=>{let{__scopePopper:t,children:n}=e,[r,i]=q.useState(null);return(0,J.jsx)(bn,{scope:t,anchor:r,onAnchorChange:i,children:n})};Sn.displayName=_n;var Cn=`PopperAnchor`,wn=q.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=xn(Cn,n),o=q.useRef(null),s=l(t,o),c=q.useRef(null);return q.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,J.jsx)(S.div,{...i,ref:s})});wn.displayName=Cn;var Tn=`PopperContent`,[En,Dn]=vn(Tn),On=q.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f=`partial`,hideWhenDetached:p=!1,updatePositionStrategy:m=`optimized`,onPlaced:h,...g}=e,_=xn(Tn,n),[v,y]=q.useState(null),b=l(t,e=>y(e)),[x,C]=q.useState(null),w=gn(x),T=w?.width??0,E=w?.height??0,D=r+(a===`center`?``:`-`+a),O=typeof d==`number`?d:{top:0,right:0,bottom:0,left:0,...d},A=Array.isArray(u)?u:[u],j=A.length>0,M={padding:O,boundary:A.filter(Mn),altBoundary:j},{refs:N,floatingStyles:ee,placement:te,isPositioned:ne,middlewareData:re}=rn({strategy:`fixed`,placement:D,whileElementsMounted:(...e)=>Ht(...e,{animationFrame:m===`always`}),elements:{reference:_.anchor},middleware:[on({mainAxis:i+E,alignmentAxis:o}),c&&sn({mainAxis:!0,crossAxis:!1,limiter:f===`partial`?cn():void 0,...M}),c&&ln({...M}),un({...M,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),x&&fn({element:x,padding:s}),Nn({arrowWidth:T,arrowHeight:E}),p&&dn({strategy:`referenceHidden`,...M})]}),[ie,ae]=Pn(te),oe=k(h);P(()=>{ne&&oe?.()},[ne,oe]);let F=re.arrow?.x,I=re.arrow?.y,se=re.arrow?.centerOffset!==0,[ce,L]=q.useState();return P(()=>{v&&L(window.getComputedStyle(v).zIndex)},[v]),(0,J.jsx)(`div`,{ref:N.setFloating,"data-radix-popper-content-wrapper":``,style:{...ee,transform:ne?ee.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ce,"--radix-popper-transform-origin":[re.transformOrigin?.x,re.transformOrigin?.y].join(` `),...re.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,J.jsx)(En,{scope:n,placedSide:ie,onArrowChange:C,arrowX:F,arrowY:I,shouldHideArrow:se,children:(0,J.jsx)(S.div,{"data-side":ie,"data-align":ae,...g,ref:b,style:{...g.style,animation:ne?void 0:`none`}})})})});On.displayName=Tn;var kn=`PopperArrow`,An={top:`bottom`,right:`left`,bottom:`top`,left:`right`},jn=q.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=Dn(kn,n),a=An[i.placedSide];return(0,J.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,J.jsx)(hn,{...r,ref:t,style:{...r.style,display:`block`}})})});jn.displayName=kn;function Mn(e){return e!==null}var Nn=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Pn(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function Pn(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var Fn=Sn,In=wn,Ln=On,Rn=jn,zn=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),Bn=`VisuallyHidden`,Vn=q.forwardRef((e,t)=>(0,J.jsx)(S.span,{...e,ref:t,style:{...zn,...e.style}}));Vn.displayName=Bn;var Hn=Vn,[Un,Wn]=c(`Tooltip`,[yn]),Gn=yn(),Kn=`TooltipProvider`,qn=700,Jn=`tooltip.open`,[Yn,Xn]=Un(Kn),Zn=e=>{let{__scopeTooltip:t,delayDuration:n=qn,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=q.useRef(!0),s=q.useRef(!1),c=q.useRef(0);return q.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,J.jsx)(Yn,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:q.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:q.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:q.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};Zn.displayName=Kn;var Qn=`Tooltip`,[$n,er]=Un(Qn),tr=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Xn(Qn,e.__scopeTooltip),l=Gn(t),[u,d]=q.useState(null),f=v(),p=q.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=q.useRef(!1),[_,y]=ae({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(Jn))):c.onClose(),a?.(e)},caller:Qn}),b=q.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),x=q.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,y(!0)},[y]),S=q.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y(!1)},[y]),C=q.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,y(!0),p.current=0},h)},[h,y]);return q.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,J.jsx)(Fn,{...l,children:(0,J.jsx)($n,{scope:t,contentId:f,open:_,stateAttribute:b,trigger:u,onTriggerChange:d,onTriggerEnter:q.useCallback(()=>{c.isOpenDelayedRef.current?C():x()},[c.isOpenDelayedRef,C,x]),onTriggerLeave:q.useCallback(()=>{m?S():(window.clearTimeout(p.current),p.current=0)},[S,m]),onOpen:x,onClose:S,disableHoverableContent:m,children:n})})};tr.displayName=Qn;var nr=`TooltipTrigger`,rr=q.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=er(nr,n),o=Xn(nr,n),s=Gn(n),c=l(t,q.useRef(null),i.onTriggerChange),u=q.useRef(!1),d=q.useRef(!1),f=q.useCallback(()=>u.current=!1,[]);return q.useEffect(()=>()=>document.removeEventListener(`pointerup`,f),[f]),(0,J.jsx)(In,{asChild:!0,...s,children:(0,J.jsx)(S.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:c,onPointerMove:a(e.onPointerMove,e=>{e.pointerType!==`touch`&&!d.current&&!o.isPointerInTransitRef.current&&(i.onTriggerEnter(),d.current=!0)}),onPointerLeave:a(e.onPointerLeave,()=>{i.onTriggerLeave(),d.current=!1}),onPointerDown:a(e.onPointerDown,()=>{i.open&&i.onClose(),u.current=!0,document.addEventListener(`pointerup`,f,{once:!0})}),onFocus:a(e.onFocus,()=>{u.current||i.onOpen()}),onBlur:a(e.onBlur,i.onClose),onClick:a(e.onClick,i.onClose)})})});rr.displayName=nr;var ir=`TooltipPortal`,[ar,or]=Un(ir,{forceMount:void 0}),sr=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=er(ir,t);return(0,J.jsx)(ar,{scope:t,forceMount:n,children:(0,J.jsx)(b,{present:n||a.open,children:(0,J.jsx)(O,{asChild:!0,container:i,children:r})})})};sr.displayName=ir;var cr=`TooltipContent`,lr=q.forwardRef((e,t)=>{let n=or(cr,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=er(cr,e.__scopeTooltip);return(0,J.jsx)(b,{present:r||o.open,children:o.disableHoverableContent?(0,J.jsx)(mr,{side:i,...a,ref:t}):(0,J.jsx)(ur,{side:i,...a,ref:t})})}),ur=q.forwardRef((e,t)=>{let n=er(cr,e.__scopeTooltip),r=Xn(cr,e.__scopeTooltip),i=q.useRef(null),a=l(t,i),[o,s]=q.useState(null),{trigger:c,onClose:u}=n,d=i.current,{onPointerInTransitChange:f}=r,p=q.useCallback(()=>{s(null),f(!1)},[f]),m=q.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=vr(r,_r(r,n.getBoundingClientRect())),a=yr(t.getBoundingClientRect());s(xr([...i,...a])),f(!0)},[f]);return q.useEffect(()=>()=>p(),[p]),q.useEffect(()=>{if(c&&d){let e=e=>m(e,d),t=e=>m(e,c);return c.addEventListener(`pointerleave`,e),d.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),d.removeEventListener(`pointerleave`,t)}}},[c,d,m,p]),q.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||d?.contains(t),i=!br(n,o);r?p():i&&(p(),u())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,d,o,u,p]),(0,J.jsx)(mr,{...e,ref:a})}),[dr,fr]=Un(Qn,{isInside:!1}),pr=ie(`TooltipContent`),mr=q.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=er(cr,n),l=Gn(n),{onClose:u}=c;return q.useEffect(()=>(document.addEventListener(Jn,u),()=>document.removeEventListener(Jn,u)),[u]),q.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,J.jsx)(x,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,J.jsxs)(Ln,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,J.jsx)(pr,{children:r}),(0,J.jsx)(dr,{scope:n,isInside:!0,children:(0,J.jsx)(Hn,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});lr.displayName=cr;var hr=`TooltipArrow`,gr=q.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Gn(n);return fr(hr,n).isInside?null:(0,J.jsx)(Rn,{...i,...r,ref:t})});gr.displayName=hr;function _r(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function vr(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function yr(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function br(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function xr(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:e.y>t.y?1:0),Sr(t)}function Sr(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Cr=Zn,wr=tr,Tr=rr,Er=lr,Y=ee(),Dr=Cr,Or=wr,kr=Tr,Ar=q.forwardRef((e,t)=>{let n=(0,Y.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=d(`z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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,J.jsx)(Er,{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});Ar.displayName=Er.displayName;function jr(e){let t=q.useRef({value:e,previous:e});return q.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Mr=q.forwardRef((e,t)=>{let n=(0,Y.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=d(`w-full caption-bottom text-sm`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,J.jsx)(`div`,{className:`relative w-full overflow-auto`,children:(0,J.jsx)(`table`,{ref:t,className:a,...i})}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Mr.displayName=`Table`;var Nr=q.forwardRef((e,t)=>{let n=(0,Y.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=d(`[&_tr]:border-b`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,J.jsx)(`thead`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Nr.displayName=`TableHeader`;var Pr=q.forwardRef((e,t)=>{let n=(0,Y.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=d(`[&_tr:last-child]:border-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,J.jsx)(`tbody`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Pr.displayName=`TableBody`;var Fr=q.forwardRef((e,t)=>{let n=(0,Y.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=d(`border-t bg-muted/50 font-medium [&>tr]:last:border-b-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,J.jsx)(`tfoot`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Fr.displayName=`TableFooter`;var Ir=q.forwardRef((e,t)=>{let n=(0,Y.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=d(`border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,J.jsx)(`tr`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Ir.displayName=`TableRow`;var X=q.forwardRef((e,t)=>{let n=(0,Y.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=d(`h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,J.jsx)(`th`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});X.displayName=`TableHead`;var Z=q.forwardRef((e,t)=>{let n=(0,Y.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=d(`p-4 align-middle [&:has([role=checkbox])]:pr-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,J.jsx)(`td`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Z.displayName=`TableCell`;var Lr=q.forwardRef((e,t)=>{let n=(0,Y.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=d(`mt-4 text-sm text-muted-foreground`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,J.jsx)(`caption`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Lr.displayName=`TableCaption`;var Rr=[` `,`Enter`,`ArrowUp`,`ArrowDown`],zr=[` `,`Enter`],Br=`Select`,[Vr,Hr,Ur]=ne(Br),[Wr,Gr]=c(Br,[Ur,yn]),Kr=yn(),[qr,Q]=Wr(Br),[Jr,Yr]=Wr(Br),Xr=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m}=e,h=Kr(t),[g,_]=q.useState(null),[y,b]=q.useState(null),[x,S]=q.useState(!1),C=w(l),[T,E]=ae({prop:r,defaultProp:i??!1,onChange:a,caller:Br}),[D,O]=ae({prop:o,defaultProp:s,onChange:c,caller:Br}),k=q.useRef(null),A=g?m||!!g.closest(`form`):!0,[j,M]=q.useState(new Set),N=Array.from(j).map(e=>e.props.value).join(`;`);return(0,J.jsx)(Fn,{...h,children:(0,J.jsxs)(qr,{required:p,scope:t,trigger:g,onTriggerChange:_,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:x,onValueNodeHasChildrenChange:S,contentId:v(),value:D,onValueChange:O,open:T,onOpenChange:E,dir:C,triggerPointerDownPosRef:k,disabled:f,children:[(0,J.jsx)(Vr.Provider,{scope:t,children:(0,J.jsx)(Jr,{scope:e.__scopeSelect,onNativeOptionAdd:q.useCallback(e=>{M(t=>new Set(t).add(e))},[]),onNativeOptionRemove:q.useCallback(e=>{M(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),A?(0,J.jsxs)(Wi,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:D,onChange:e=>O(e.target.value),disabled:f,form:m,children:[D===void 0?(0,J.jsx)(`option`,{value:``}):null,Array.from(j)]},N):null]})})};Xr.displayName=Br;var Zr=`SelectTrigger`,Qr=q.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,o=Kr(n),s=Q(Zr,n),c=s.disabled||r,u=l(t,s.onTriggerChange),d=Hr(n),f=q.useRef(`touch`),[p,m,h]=Ki(e=>{let t=d().filter(e=>!e.disabled),n=qi(t,e,t.find(e=>e.value===s.value));n!==void 0&&s.onValueChange(n.value)}),g=e=>{c||(s.onOpenChange(!0),h()),e&&(s.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,J.jsx)(In,{asChild:!0,...o,children:(0,J.jsx)(S.button,{type:`button`,role:`combobox`,"aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":`none`,dir:s.dir,"data-state":s.open?`open`:`closed`,disabled:c,"data-disabled":c?``:void 0,"data-placeholder":Gi(s.value)?``:void 0,...i,ref:u,onClick:a(i.onClick,e=>{e.currentTarget.focus(),f.current!==`mouse`&&g(e)}),onPointerDown:a(i.onPointerDown,e=>{f.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(g(e),e.preventDefault())}),onKeyDown:a(i.onKeyDown,e=>{let t=p.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&m(e.key),!(t&&e.key===` `)&&Rr.includes(e.key)&&(g(),e.preventDefault())})})})});Qr.displayName=Zr;var $r=`SelectValue`,ei=q.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=Q($r,n),{onValueNodeHasChildrenChange:u}=c,d=a!==void 0,f=l(t,c.onValueNodeChange);return P(()=>{u(d)},[u,d]),(0,J.jsx)(S.span,{...s,ref:f,style:{pointerEvents:`none`},children:Gi(c.value)?(0,J.jsx)(J.Fragment,{children:o}):a})});ei.displayName=$r;var ti=`SelectIcon`,ni=q.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,J.jsx)(S.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});ni.displayName=ti;var ri=`SelectPortal`,ii=e=>(0,J.jsx)(O,{asChild:!0,...e});ii.displayName=ri;var ai=`SelectContent`,oi=q.forwardRef((e,t)=>{let n=Q(ai,e.__scopeSelect),[r,i]=q.useState();if(P(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?Zt.createPortal((0,J.jsx)(si,{scope:e.__scopeSelect,children:(0,J.jsx)(Vr.Slot,{scope:e.__scopeSelect,children:(0,J.jsx)(`div`,{children:e.children})})}),t):null}return(0,J.jsx)(di,{...e,ref:t})});oi.displayName=ai;var $=10,[si,ci]=Wr(ai),li=`SelectContentImpl`,ui=h(`SelectContent.RemoveScroll`),di=q.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:o,onPointerDownOutside:s,side:c,sideOffset:u,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:v,avoidCollisions:y,...b}=e,S=Q(ai,n),[C,w]=q.useState(null),[T,E]=q.useState(null),D=l(t,e=>w(e)),[O,k]=q.useState(null),[A,M]=q.useState(null),N=Hr(n),[ee,ne]=q.useState(!1),ie=q.useRef(!1);q.useEffect(()=>{if(C)return _(C)},[C]),te();let P=q.useCallback(e=>{let[t,...n]=N().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&T&&(T.scrollTop=0),n===r&&T&&(T.scrollTop=T.scrollHeight),n?.focus(),document.activeElement!==i))return},[N,T]),ae=q.useCallback(()=>P([O,C]),[P,O,C]);q.useEffect(()=>{ee&&ae()},[ee,ae]);let{onOpenChange:oe,triggerPointerDownPosRef:F}=S;q.useEffect(()=>{if(C){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(F.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(F.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():C.contains(n.target)||oe(!1),document.removeEventListener(`pointermove`,t),F.current=null};return F.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[C,oe,F]),q.useEffect(()=>{let e=()=>oe(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[oe]);let[I,se]=Ki(e=>{let t=N().filter(e=>!e.disabled),n=qi(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),ce=q.useCallback((e,t,n)=>{let r=!ie.current&&!n;(S.value!==void 0&&S.value===t||r)&&(k(e),r&&(ie.current=!0))},[S.value]),L=q.useCallback(()=>C?.focus(),[C]),le=q.useCallback((e,t,n)=>{let r=!ie.current&&!n;(S.value!==void 0&&S.value===t||r)&&M(e)},[S.value]),ue=r===`popper`?hi:pi,de=ue===hi?{side:c,sideOffset:u,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:v,avoidCollisions:y}:{};return(0,J.jsx)(si,{scope:n,content:C,viewport:T,onViewportChange:E,itemRefCallback:ce,selectedItem:O,onItemLeave:L,itemTextRefCallback:le,focusSelectedItem:ae,selectedItemText:A,position:r,isPositioned:ee,searchRef:I,children:(0,J.jsx)(j,{as:ui,allowPinchZoom:!0,children:(0,J.jsx)(re,{asChild:!0,trapped:S.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:a(i,e=>{S.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,J.jsx)(x,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>S.onOpenChange(!1),children:(0,J.jsx)(ue,{role:`listbox`,id:S.contentId,"data-state":S.open?`open`:`closed`,dir:S.dir,onContextMenu:e=>e.preventDefault(),...b,...de,onPlaced:()=>ne(!0),ref:D,style:{display:`flex`,flexDirection:`column`,outline:`none`,...b.style},onKeyDown:a(b.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&se(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=N().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>P(t)),e.preventDefault()}})})})})})})});di.displayName=li;var fi=`SelectItemAlignedPosition`,pi=q.forwardRef((e,t)=>{let{__scopeSelect:r,onPlaced:i,...a}=e,o=Q(ai,r),s=ci(ai,r),[c,u]=q.useState(null),[d,f]=q.useState(null),p=l(t,e=>f(e)),m=Hr(r),h=q.useRef(!1),g=q.useRef(!0),{viewport:_,selectedItem:v,selectedItemText:y,focusSelectedItem:b}=s,x=q.useCallback(()=>{if(o.trigger&&o.valueNode&&c&&d&&_&&v&&y){let e=o.trigger.getBoundingClientRect(),t=d.getBoundingClientRect(),r=o.valueNode.getBoundingClientRect(),a=y.getBoundingClientRect();if(o.dir!==`rtl`){let i=a.left-t.left,o=r.left-i,s=e.left-o,l=e.width+s,u=Math.max(l,t.width),d=window.innerWidth-$,f=n(o,[$,Math.max($,d-u)]);c.style.minWidth=l+`px`,c.style.left=f+`px`}else{let i=t.right-a.right,o=window.innerWidth-r.right-i,s=window.innerWidth-e.right-o,l=e.width+s,u=Math.max(l,t.width),d=window.innerWidth-$,f=n(o,[$,Math.max($,d-u)]);c.style.minWidth=l+`px`,c.style.right=f+`px`}let s=m(),l=window.innerHeight-$*2,u=_.scrollHeight,f=window.getComputedStyle(d),p=parseInt(f.borderTopWidth,10),g=parseInt(f.paddingTop,10),b=parseInt(f.borderBottomWidth,10),x=parseInt(f.paddingBottom,10),S=p+g+u+x+b,C=Math.min(v.offsetHeight*5,S),w=window.getComputedStyle(_),T=parseInt(w.paddingTop,10),E=parseInt(w.paddingBottom,10),D=e.top+e.height/2-$,O=l-D,k=v.offsetHeight/2,A=v.offsetTop+k,j=p+g+A,M=S-j;if(j<=D){let e=s.length>0&&v===s[s.length-1].ref.current;c.style.bottom=`0px`;let t=d.clientHeight-_.offsetTop-_.offsetHeight,n=j+Math.max(O,k+(e?E:0)+t+b);c.style.height=n+`px`}else{let e=s.length>0&&v===s[0].ref.current;c.style.top=`0px`;let t=Math.max(D,p+_.offsetTop+(e?T:0)+k)+M;c.style.height=t+`px`,_.scrollTop=j-D+_.offsetTop}c.style.margin=`${$}px 0`,c.style.minHeight=C+`px`,c.style.maxHeight=l+`px`,i?.(),requestAnimationFrame(()=>h.current=!0)}},[m,o.trigger,o.valueNode,c,d,_,v,y,o.dir,i]);P(()=>x(),[x]);let[C,w]=q.useState();return P(()=>{d&&w(window.getComputedStyle(d).zIndex)},[d]),(0,J.jsx)(gi,{scope:r,contentWrapper:c,shouldExpandOnScrollRef:h,onScrollButtonChange:q.useCallback(e=>{e&&g.current===!0&&(x(),b?.(),g.current=!1)},[x,b]),children:(0,J.jsx)(`div`,{ref:u,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:C},children:(0,J.jsx)(S.div,{...a,ref:p,style:{boxSizing:`border-box`,maxHeight:`100%`,...a.style}})})})});pi.displayName=fi;var mi=`SelectPopperPosition`,hi=q.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=$,...a}=e,o=Kr(n);return(0,J.jsx)(Ln,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});hi.displayName=mi;var[gi,_i]=Wr(ai,{}),vi=`SelectViewport`,yi=q.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,o=ci(vi,n),s=_i(vi,n),c=l(t,o.onViewportChange),u=q.useRef(0);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,J.jsx)(Vr.Slot,{scope:n,children:(0,J.jsx)(S.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:c,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:a(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=s;if(r?.current&&n){let e=Math.abs(u.current-t.scrollTop);if(e>0){let r=window.innerHeight-$*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}u.current=t.scrollTop})})})]})});yi.displayName=vi;var bi=`SelectGroup`,[xi,Si]=Wr(bi),Ci=q.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=v();return(0,J.jsx)(xi,{scope:n,id:i,children:(0,J.jsx)(S.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Ci.displayName=bi;var wi=`SelectLabel`,Ti=q.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Si(wi,n);return(0,J.jsx)(S.div,{id:i.id,...r,ref:t})});Ti.displayName=wi;var Ei=`SelectItem`,[Di,Oi]=Wr(Ei),ki=q.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:o,...s}=e,c=Q(Ei,n),u=ci(Ei,n),d=c.value===r,[f,p]=q.useState(o??``),[m,h]=q.useState(!1),g=l(t,e=>u.itemRefCallback?.(e,r,i)),_=v(),y=q.useRef(`touch`),b=()=>{i||(c.onValueChange(r),c.onOpenChange(!1))};if(r===``)throw Error(`A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,J.jsx)(Di,{scope:n,value:r,disabled:i,textId:_,isSelected:d,onItemTextChange:q.useCallback(e=>{p(t=>t||(e?.textContent??``).trim())},[]),children:(0,J.jsx)(Vr.ItemSlot,{scope:n,value:r,disabled:i,textValue:f,children:(0,J.jsx)(S.div,{role:`option`,"aria-labelledby":_,"data-highlighted":m?``:void 0,"aria-selected":d&&m,"data-state":d?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...s,ref:g,onFocus:a(s.onFocus,()=>h(!0)),onBlur:a(s.onBlur,()=>h(!1)),onClick:a(s.onClick,()=>{y.current!==`mouse`&&b()}),onPointerUp:a(s.onPointerUp,()=>{y.current===`mouse`&&b()}),onPointerDown:a(s.onPointerDown,e=>{y.current=e.pointerType}),onPointerMove:a(s.onPointerMove,e=>{y.current=e.pointerType,i?u.onItemLeave?.():y.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:a(s.onPointerLeave,e=>{e.currentTarget===document.activeElement&&u.onItemLeave?.()}),onKeyDown:a(s.onKeyDown,e=>{u.searchRef?.current!==``&&e.key===` `||(zr.includes(e.key)&&b(),e.key===` `&&e.preventDefault())})})})})});ki.displayName=Ei;var Ai=`SelectItemText`,ji=q.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=Q(Ai,n),s=ci(Ai,n),c=Oi(Ai,n),u=Yr(Ai,n),[d,f]=q.useState(null),p=l(t,e=>f(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),m=d?.textContent,h=q.useMemo(()=>(0,J.jsx)(`option`,{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=u;return P(()=>(g(h),()=>_(h)),[g,_,h]),(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(S.span,{id:c.textId,...a,ref:p}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Zt.createPortal(a.children,o.valueNode):null]})});ji.displayName=Ai;var Mi=`SelectItemIndicator`,Ni=q.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return Oi(Mi,n).isSelected?(0,J.jsx)(S.span,{"aria-hidden":!0,...r,ref:t}):null});Ni.displayName=Mi;var Pi=`SelectScrollUpButton`,Fi=q.forwardRef((e,t)=>{let n=ci(Pi,e.__scopeSelect),r=_i(Pi,e.__scopeSelect),[i,a]=q.useState(!1),o=l(t,r.onScrollButtonChange);return P(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,J.jsx)(Ri,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});Fi.displayName=Pi;var Ii=`SelectScrollDownButton`,Li=q.forwardRef((e,t)=>{let n=ci(Ii,e.__scopeSelect),r=_i(Ii,e.__scopeSelect),[i,a]=q.useState(!1),o=l(t,r.onScrollButtonChange);return P(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,J.jsx)(Ri,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});Li.displayName=Ii;var Ri=q.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,o=ci(`SelectScrollButton`,n),s=q.useRef(null),c=Hr(n),l=q.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return q.useEffect(()=>()=>l(),[l]),P(()=>{c().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[c]),(0,J.jsx)(S.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:a(i.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:a(i.onPointerMove,()=>{o.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:a(i.onPointerLeave,()=>{l()})})}),zi=`SelectSeparator`,Bi=q.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,J.jsx)(S.div,{"aria-hidden":!0,...r,ref:t})});Bi.displayName=zi;var Vi=`SelectArrow`,Hi=q.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Kr(n),a=Q(Vi,n),o=ci(Vi,n);return a.open&&o.position===`popper`?(0,J.jsx)(Rn,{...i,...r,ref:t}):null});Hi.displayName=Vi;var Ui=`SelectBubbleInput`,Wi=q.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=q.useRef(null),a=l(r,i),o=jr(t);return q.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,J.jsx)(S.select,{...n,style:{...zn,...n.style},ref:a,defaultValue:t})});Wi.displayName=Ui;function Gi(e){return e===``||e===void 0}function Ki(e){let t=k(e),n=q.useRef(``),r=q.useRef(0),i=q.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=q.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return q.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function qi(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Ji(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function Ji(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Yi=Xr,Xi=Qr,Zi=ei,Qi=ni,$i=ii,ea=oi,ta=yi,na=Ti,ra=ki,ia=ji,aa=Ni,oa=Fi,sa=Li,ca=Bi,la=Yi,ua=Zi,da=q.forwardRef((e,t)=>{let n=(0,Y.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=d(`flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,i),n[4]=i,n[5]=o);let c;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,J.jsx)(Qi,{asChild:!0,children:(0,J.jsx)(s,{className:`h-4 w-4 opacity-50`})}),n[6]=c):c=n[6];let l;return n[7]!==r||n[8]!==a||n[9]!==t||n[10]!==o?(l=(0,J.jsxs)(Xi,{ref:t,className:o,...a,children:[r,c]}),n[7]=r,n[8]=a,n[9]=t,n[10]=o,n[11]=l):l=n[11],l});da.displayName=Xi.displayName;var fa=q.forwardRef((e,t)=>{let n=(0,Y.c)(10),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=d(`flex cursor-default items-center justify-center py-1`,r),n[3]=r,n[4]=a);let o;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,J.jsx)(p,{className:`h-4 w-4`}),n[5]=o):o=n[5];let s;return n[6]!==i||n[7]!==t||n[8]!==a?(s=(0,J.jsx)(oa,{ref:t,className:a,...i,children:o}),n[6]=i,n[7]=t,n[8]=a,n[9]=s):s=n[9],s});fa.displayName=oa.displayName;var pa=q.forwardRef((e,t)=>{let n=(0,Y.c)(10),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=d(`flex cursor-default items-center justify-center py-1`,r),n[3]=r,n[4]=a);let o;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,J.jsx)(s,{className:`h-4 w-4`}),n[5]=o):o=n[5];let c;return n[6]!==i||n[7]!==t||n[8]!==a?(c=(0,J.jsx)(sa,{ref:t,className:a,...i,children:o}),n[6]=i,n[7]=t,n[8]=a,n[9]=c):c=n[9],c});pa.displayName=sa.displayName;var ma=q.forwardRef((e,t)=>{let n=(0,Y.c)(21),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({className:i,children:r,position:o,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let s=o===void 0?`popper`:o,c=s===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,l;n[5]!==i||n[6]!==c?(l=d(`relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover 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`,c,i),n[5]=i,n[6]=c,n[7]=l):l=n[7];let u;n[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,J.jsx)(fa,{}),n[8]=u):u=n[8];let f=s===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`,p;n[9]===f?p=n[10]:(p=d(`p-1`,f),n[9]=f,n[10]=p);let m;n[11]!==r||n[12]!==p?(m=(0,J.jsx)(ta,{className:p,children:r}),n[11]=r,n[12]=p,n[13]=m):m=n[13];let h;n[14]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,J.jsx)(pa,{}),n[14]=h):h=n[14];let g;return n[15]!==s||n[16]!==a||n[17]!==t||n[18]!==l||n[19]!==m?(g=(0,J.jsx)($i,{children:(0,J.jsxs)(ea,{ref:t,className:l,position:s,...a,children:[u,m,h]})}),n[15]=s,n[16]=a,n[17]=t,n[18]=l,n[19]=m,n[20]=g):g=n[20],g});ma.displayName=ea.displayName;var ha=q.forwardRef((e,t)=>{let n=(0,Y.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=d(`py-1.5 pl-8 pr-2 text-sm font-semibold`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,J.jsx)(na,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ha.displayName=na.displayName;var ga=q.forwardRef((e,n)=>{let r=(0,Y.c)(14),i,a,o;r[0]===e?(i=r[1],a=r[2],o=r[3]):({className:a,children:i,...o}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o);let s;r[4]===a?s=r[5]:(s=d(`relative flex w-full 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]=s);let c;r[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,J.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,J.jsx)(aa,{children:(0,J.jsx)(t,{className:`h-4 w-4`})})}),r[6]=c):c=r[6];let l;r[7]===i?l=r[8]:(l=(0,J.jsx)(ia,{children:i}),r[7]=i,r[8]=l);let u;return r[9]!==o||r[10]!==n||r[11]!==s||r[12]!==l?(u=(0,J.jsxs)(ra,{ref:n,className:s,...o,children:[c,l]}),r[9]=o,r[10]=n,r[11]=s,r[12]=l,r[13]=u):u=r[13],u});ga.displayName=ra.displayName;var _a=q.forwardRef((e,t)=>{let n=(0,Y.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=d(`-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,J.jsx)(ca,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});_a.displayName=ca.displayName;var va=`__ALL_PROJECTS__`;function ya(e){let t=(0,Y.c)(8),{text:n,maxLength:r}=e,i=r===void 0?100:r;if(n.length<=i){let e;return t[0]===n?e=t[1]:(e=(0,J.jsx)(J.Fragment,{children:n}),t[0]=n,t[1]=e),e}let a;t[2]!==i||t[3]!==n?(a=n.substring(0,i),t[2]=i,t[3]=n,t[4]=a):a=t[4];let o;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,J.jsx)(`span`,{className:`text-muted-foreground ml-2`,children:`...`}),t[5]=o):o=t[5];let s;return t[6]===a?s=t[7]:(s=(0,J.jsxs)(J.Fragment,{children:[a,o]}),t[6]=a,t[7]=s),s}function ba(e,t){let n=`${t} - `,r=e.title??e.threadId;return r.startsWith(n)?r.slice(n.length):r}async function xa(e){let t=[],n=new Set,r=``;for(let i of e)try{let e=await N(i.threadId);e?.messages&&(t.push(...e.messages),e.conversationIds&&e.conversationIds.forEach(e=>n.add(e)),e.lastUpdated>r&&(r=e.lastUpdated))}catch(e){console.warn(`Failed to load history for thread ${i.threadId}:`,e)}return t.sort((e,t)=>new Date(t.timestamp).getTime()-new Date(e.timestamp).getTime()),{messages:t,conversationIds:Array.from(n),lastUpdated:r??new Date().toISOString()}}function Sa({isOpen:e,onClose:t,initialFilter:n,projects:i,inline:a}){let[s,c]=(0,q.useState)(null),[l,d]=(0,q.useState)(!1),[p,h]=(0,q.useState)(null),[_,v]=(0,q.useState)(0),[y,b]=(0,q.useState)(``),[x,S]=(0,q.useState)(``),w=(0,q.useCallback)(async e=>{d(!0),h(null);try{c(await N(e))}catch(e){h(e instanceof Error?e.message:`Failed to load conversation history`)}finally{d(!1)}},[]),D=(0,q.useCallback)(async e=>{if(e){d(!0),h(null);try{let t=i.find(t=>t.projectId===e);if(!t||t.threads.length===0){c({threadId:e,messages:[],lastUpdated:new Date().toISOString(),conversationIds:[]});return}c({threadId:e,...await xa(t.threads)})}catch(e){h(e instanceof Error?e.message:`Failed to load project history`)}finally{d(!1)}}},[i]),O=(0,q.useCallback)(async()=>{d(!0),h(null);try{c({threadId:va,...await xa(i.flatMap(e=>e.threads))})}catch(e){h(e instanceof Error?e.message:`Failed to load all projects history`)}finally{d(!1)}},[i]);(0,q.useEffect)(()=>{e&&n?n.type===`thread`?(S(n.id),b(``),v(0),w(n.id)):n.type===`project`&&(b(n.id),S(``),v(0),D(n.id)):e||(c(null),S(``),b(``),v(0),h(null))},[e,n,w,D]);let k=e=>{S(e),b(``),v(0),w(e)},j=e=>{b(e),S(``),v(0),e===va?O():D(e)},ee=e=>new Date(e).toLocaleString(),te=(e,t)=>{let n=new Date(e),r=new Date(t).getTime()-n.getTime();if(r<0)return{display:`0:00`,tooltip:`0 seconds`};let i=Math.floor(r/1e3),a=Math.floor(i/60),o=i%60,s=`${a}:${o.toString().padStart(2,`0`)}`,c;return c=a===0?`${o} second${o===1?``:`s`}`:o===0?`${a} minute${a===1?``:`s`}`:`${a} minute${a===1?``:`s`} ${o} second${o===1?``:`s`}`,{display:s,tooltip:c}},ne=e=>({inputTokens:e.inputTokens??0,outputTokens:e.outputTokens??0});return e?(0,J.jsx)(`div`,{className:a?`h-full bg-background`:`fixed inset-0 z-50 bg-background`,children:(0,J.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!a&&(0,J.jsxs)(`div`,{className:`flex items-center justify-between border-b p-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,J.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Conversation History`}),n?.type===`thread`&&(0,J.jsxs)(la,{value:x,onValueChange:k,children:[(0,J.jsx)(da,{className:`w-48`,children:(0,J.jsx)(ua,{placeholder:`Select thread`})}),(0,J.jsx)(ma,{children:i.flatMap(e=>e.threads.map(t=>(0,J.jsx)(ga,{value:t.threadId,children:ba(t,e.name??e.projectId)},t.threadId)))})]}),(0,J.jsxs)(la,{value:y,onValueChange:j,children:[(0,J.jsx)(da,{className:`w-48`,children:(0,J.jsx)(ua,{placeholder:`Select project`})}),(0,J.jsxs)(ma,{children:[(0,J.jsx)(ga,{value:va,children:`All Projects`}),i.map(e=>(0,J.jsx)(ga,{value:e.projectId,children:e.name??e.projectId},e.projectId))]})]})]}),(0,J.jsx)(o,{variant:`action`,size:`icon-sm`,onClick:t,children:(0,J.jsx)(E,{})})]}),s?.messages&&s.messages.length>0&&(0,J.jsxs)(`div`,{className:`flex items-center justify-between border-b p-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(o,{variant:`outline`,size:`sm`,onClick:()=>{_>0&&v(_-1)},disabled:_===0,children:(0,J.jsx)(m,{className:`h-4 w-4 mr-1`})}),(0,J.jsx)(o,{variant:`outline`,size:`sm`,onClick:()=>{s?.messages&&_<s.messages.length-1&&v(_+1)},disabled:!s||_>=s.messages.length-1,children:(0,J.jsx)(f,{className:`h-4 w-4 ml-1`})})]}),(0,J.jsxs)(`div`,{className:`text-sm text-muted-foreground`,children:[_+1,` of `,s?.messages.length??0,` messages`]})]}),(0,J.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:l?(0,J.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,J.jsxs)(`div`,{className:`text-center`,children:[(0,J.jsx)(u,{className:`h-8 w-8 animate-spin mx-auto mb-2`}),(0,J.jsx)(`p`,{children:`Loading conversation history...`})]})}):p?(0,J.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,J.jsxs)(A,{className:`max-w-md`,children:[(0,J.jsx)(C,{children:(0,J.jsx)(g,{className:`text-destructive`,children:`Error`})}),(0,J.jsxs)(M,{children:[(0,J.jsx)(`p`,{children:p}),(0,J.jsx)(o,{onClick:t,className:`mt-4`,children:`Close`})]})]})}):s?.messages?.length&&s.messages.length>0?(0,J.jsx)(T,{className:`h-full`,children:(0,J.jsx)(`div`,{className:`p-4`,children:(0,J.jsxs)(Mr,{children:[(0,J.jsx)(Nr,{children:(0,J.jsxs)(Ir,{children:[(0,J.jsx)(X,{children:`Prompt`}),(0,J.jsx)(X,{children:`Answer`}),(0,J.jsx)(X,{className:`w-24`,children:`Model`}),(0,J.jsx)(X,{className:`w-24 text-right`,children:`Duration`}),(0,J.jsx)(X,{className:`w-20 text-right`,children:`Input Tokens`}),(0,J.jsx)(X,{className:`w-20 text-right`,children:`Output Tokens`}),(0,J.jsx)(X,{className:`w-32 text-right`,children:`Timestamp`})]})}),(0,J.jsx)(Pr,{children:s.messages.map((e,t)=>{let{inputTokens:n,outputTokens:i}=ne(e);return(0,J.jsxs)(Ir,{className:t===_?`bg-muted/50`:``,children:[(0,J.jsx)(Z,{className:`max-w-md`,children:(0,J.jsx)(`div`,{className:`text-sm`,children:(0,J.jsx)(ya,{text:e.request.message})})}),(0,J.jsx)(Z,{className:`max-w-md`,children:e.response?(0,J.jsx)(`div`,{className:`text-sm`,children:(0,J.jsx)(ya,{text:e.response.content})}):(0,J.jsx)(`span`,{className:`text-muted-foreground italic`,children:`No response`})}),(0,J.jsx)(Z,{className:`text-sm`,children:(0,J.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(r,{className:`h-3 w-3 text-muted-foreground`}),(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:e.request.model})]})}),(0,J.jsx)(Z,{className:`text-sm text-right`,children:e.response?(0,J.jsx)(Dr,{children:(0,J.jsxs)(Or,{children:[(0,J.jsx)(kr,{asChild:!0,children:(0,J.jsx)(`div`,{className:`cursor-help`,children:te(e.timestamp,e.response.completedAt).display})}),(0,J.jsx)(Ar,{children:(0,J.jsx)(`p`,{children:te(e.timestamp,e.response.completedAt).tooltip})})]})}):(0,J.jsx)(`span`,{className:`text-muted-foreground italic`,children:`-`})}),(0,J.jsx)(Z,{className:`text-sm text-muted-foreground text-right`,children:n>0?n.toLocaleString():`-`}),(0,J.jsx)(Z,{className:`text-sm text-muted-foreground text-right`,children:i>0?i.toLocaleString():`-`}),(0,J.jsx)(Z,{className:`text-sm text-muted-foreground text-right`,children:ee(e.timestamp)})]},e.id)})})]})})}):(0,J.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,J.jsxs)(`div`,{className:`max-w-md text-center space-y-2`,children:[(0,J.jsx)(`h3`,{className:`text-lg font-semibold`,children:`No History`}),(0,J.jsx)(`p`,{className:`text-muted-foreground`,children:`No conversation history found for this thread.`})]})})})]})}):null}export{gn as _,da as a,Ar as c,Vn as d,In as f,yn as g,Fn as h,ga as i,Dr as l,Ln as m,la as n,jr as o,Rn as p,ma as r,Or as s,Sa as t,kr as u};