tarsk 0.4.12 → 0.4.13

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 (26) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/public/assets/{account-view-BvHnxfR-.js → account-view-CXpwWuJZ.js} +1 -1
  3. package/dist/public/assets/{browser-tab-DYDpQIZc.js → browser-tab-BdzIB5R4.js} +1 -1
  4. package/dist/public/assets/{context-menu-CoedP3Pg.js → context-menu-CC9JLx5B.js} +1 -1
  5. package/dist/public/assets/conversation-history-view-C6iUsZjA.js +1 -0
  6. package/dist/public/assets/{diff-view-BAPFEZbh.js → diff-view-C-Kz7R_T.js} +1 -1
  7. package/dist/public/assets/{explorer-tab-view-Dxet8lje.js → explorer-tab-view-DC8arYcw.js} +2 -2
  8. package/dist/public/assets/{explorer-tree-DYE9rGNc.js → explorer-tree-BwLCrdfR.js} +1 -1
  9. package/dist/public/assets/{explorer-view-DgNDIV-D.js → explorer-view-CPCrOqXp.js} +1 -1
  10. package/dist/public/assets/history-view-CAVl9GFy.js +1 -0
  11. package/dist/public/assets/{index-BOioHxIi.js → index-DIWoaAFy.js} +6 -6
  12. package/dist/public/assets/{onboarding-QnvOtCAY.js → onboarding-DTzcWokE.js} +1 -1
  13. package/dist/public/assets/onboarding-dialog-BQvu_Nac.js +1 -0
  14. package/dist/public/assets/{project-settings-view-Bi5zT3_9.js → project-settings-view-CZPKYKCu.js} +1 -1
  15. package/dist/public/assets/{provider-details-view-3tvO3r6m.js → provider-details-view-BBvKe6Am.js} +1 -1
  16. package/dist/public/assets/{providers-sidebar-CFwpsg_Y.js → providers-sidebar-DSrnVDNy.js} +1 -1
  17. package/dist/public/assets/{react-vendor-Bi5X_3XM.js → react-vendor-9yNfIRPs.js} +1 -1
  18. package/dist/public/assets/{settings-view-DWnpQjWE.js → settings-view-D6FAPBQP.js} +2 -2
  19. package/dist/public/assets/{terminal-panel-CLpupIW9.js → terminal-panel-Zyr6xth3.js} +1 -1
  20. package/dist/public/assets/todos-view-yiH-gaUK.js +1 -0
  21. package/dist/public/index.html +4 -4
  22. package/package.json +1 -1
  23. package/dist/public/assets/conversation-history-view-CH3HrZK9.js +0 -1
  24. package/dist/public/assets/history-view-BIN8vsvx.js +0 -1
  25. package/dist/public/assets/onboarding-dialog-80pqyrMv.js +0 -1
  26. package/dist/public/assets/todos-view-D2xLDhsC.js +0 -1
package/dist/index.js CHANGED
@@ -4710,7 +4710,7 @@ var devServerCache = new DevServerCache();
4710
4710
  // src/agent/agent.prompt-loader.ts
4711
4711
  function buildDefaultPrompt(tools) {
4712
4712
  const toolList = tools.map((t) => t.name).join(", ");
4713
- return `You are a helpful coding assistant. You have access to ${toolList} tools. Use them to explore and modify the codebase as needed. Break tasks down into smaller, manageable steps using the todo tool. Skills are created and stored in .agents/skills/ . `;
4713
+ return `You are a helpful coding assistant. You have access to ${toolList} tools. Use them to explore and modify the codebase as needed. Skills are created and stored in .agents/skills/ . `;
4714
4714
  }
4715
4715
  var PLAN_MODE_INSTRUCTIONS = `
4716
4716
 
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{Ni as t,Vn as n,Wt as r,X as i,br as a,jn as o,oi as s,qi as c,ra as l,ta as u}from"./dialogs-config-Ofxg1Bn0.js";import{b as d}from"./index-BOioHxIi.js";var f=e(l(),1),p=u(),m=a();function h(e){let t=(0,p.c)(8),r,i;t[0]===e?(r=t[1],i=t[2]):({className:r,...i}=e,t[0]=e,t[1]=r,t[2]=i);let a;t[3]===r?a=t[4]:(a=n(`animate-pulse rounded-md bg-muted`,r),t[3]=r,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,m.jsx)(`div`,{className:a,...i}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o}function g(){let[e,n]=(0,f.useState)(null),[a,l]=(0,f.useState)(!0);(0,f.useEffect)(()=>{u();let e=()=>{document.visibilityState===`visible`&&u()};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]);async function u(){l(!0);try{n(await i())}catch(e){d({title:`Error`,description:e instanceof Error?e.message:`Failed to load account info`,variant:`destructive`})}finally{l(!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)(t,{className:`h-4 w-4`}),`Current Plan`]}),(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(`span`,{className:`text-lg font-semibold`,children:_?`Unlimited Pro`:`Pay as you go`}),_&&(0,m.jsx)(`span`,{className:`rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary`,children:`Active`})]}),(0,m.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:_?`You have unlimited prompts with no restrictions.`:`Purchase prompts as needed. Upgrade to Pro for unlimited access.`})]})]}),!_&&(0,m.jsxs)(`div`,{className:`space-y-3`,children:[(0,m.jsx)(`h2`,{className:`text-sm font-semibold text-muted-foreground uppercase tracking-wide`,children:`Add Prompts`}),(0,m.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,m.jsxs)(`div`,{className:`space-y-1`,children:[(0,m.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,m.jsx)(`span`,{className:`font-semibold`,children:`1,000 Prompts`})}),(0,m.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Top up your balance with 1,000 additional prompts for $5.`})]}),(0,m.jsx)(o,{onClick:p,className:`shrink-0`,children:`Top Up Balance`})]}),(0,m.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,m.jsxs)(`div`,{className:`space-y-1`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(t,{className:`h-4 w-4 text-primary`}),(0,m.jsx)(`span`,{className:`font-semibold`,children:`Unlimited Pro Plan`})]}),(0,m.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Unlimited prompts for $100 and lifetime access to Tarsk.`}),(0,m.jsxs)(`ul`,{className:`text-sm text-muted-foreground space-y-0.5`,children:[(0,m.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,m.jsx)(c,{className:`h-3 w-3 text-primary`}),`Unlimited prompts`]}),(0,m.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,m.jsx)(c,{className:`h-3 w-3 text-primary`}),`Priority access`]})]})]}),(0,m.jsx)(o,{onClick:g,className:`shrink-0`,children:`Purchase`})]})]})]})]})}export{g as default};
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{Ni as t,Vn as n,Wt as r,X as i,br as a,jn as o,oi as s,qi as c,ra as l,ta as u}from"./dialogs-config-Ofxg1Bn0.js";import{b as d}from"./index-DIWoaAFy.js";var f=e(l(),1),p=u(),m=a();function h(e){let t=(0,p.c)(8),r,i;t[0]===e?(r=t[1],i=t[2]):({className:r,...i}=e,t[0]=e,t[1]=r,t[2]=i);let a;t[3]===r?a=t[4]:(a=n(`animate-pulse rounded-md bg-muted`,r),t[3]=r,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,m.jsx)(`div`,{className:a,...i}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o}function g(){let[e,n]=(0,f.useState)(null),[a,l]=(0,f.useState)(!0);(0,f.useEffect)(()=>{u();let e=()=>{document.visibilityState===`visible`&&u()};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]);async function u(){l(!0);try{n(await i())}catch(e){d({title:`Error`,description:e instanceof Error?e.message:`Failed to load account info`,variant:`destructive`})}finally{l(!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)(t,{className:`h-4 w-4`}),`Current Plan`]}),(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(`span`,{className:`text-lg font-semibold`,children:_?`Unlimited Pro`:`Pay as you go`}),_&&(0,m.jsx)(`span`,{className:`rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary`,children:`Active`})]}),(0,m.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:_?`You have unlimited prompts with no restrictions.`:`Purchase prompts as needed. Upgrade to Pro for unlimited access.`})]})]}),!_&&(0,m.jsxs)(`div`,{className:`space-y-3`,children:[(0,m.jsx)(`h2`,{className:`text-sm font-semibold text-muted-foreground uppercase tracking-wide`,children:`Add Prompts`}),(0,m.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,m.jsxs)(`div`,{className:`space-y-1`,children:[(0,m.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,m.jsx)(`span`,{className:`font-semibold`,children:`1,000 Prompts`})}),(0,m.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Top up your balance with 1,000 additional prompts for $5.`})]}),(0,m.jsx)(o,{onClick:p,className:`shrink-0`,children:`Top Up Balance`})]}),(0,m.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,m.jsxs)(`div`,{className:`space-y-1`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(t,{className:`h-4 w-4 text-primary`}),(0,m.jsx)(`span`,{className:`font-semibold`,children:`Unlimited Pro Plan`})]}),(0,m.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Unlimited prompts for $100 and lifetime access to Tarsk.`}),(0,m.jsxs)(`ul`,{className:`text-sm text-muted-foreground space-y-0.5`,children:[(0,m.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,m.jsx)(c,{className:`h-3 w-3 text-primary`}),`Unlimited prompts`]}),(0,m.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,m.jsx)(c,{className:`h-3 w-3 text-primary`}),`Priority access`]})]})]}),(0,m.jsx)(o,{onClick:g,className:`shrink-0`,children:`Purchase`})]})]})]})]})}export{g as default};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{Ai as t,Wt as n,br as r,ra as i,ta as a}from"./dialogs-config-Ofxg1Bn0.js";import{c as o}from"./index-BOioHxIi.js";var s=a(),c=e(i(),1),l=r();function u(){let e=(0,s.c)(20),{devServerUrl:r}=o(),[i,a]=(0,c.useState)(``),[u,d]=(0,c.useState)(``),f=(0,c.useRef)(null),p,m;e[0]===r?(p=e[1],m=e[2]):(p=()=>{r&&(a(r),d(r))},m=[r],e[0]=r,e[1]=p,e[2]=m),(0,c.useEffect)(p,m);let h;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(h=e=>{let t=e.trim();t&&(!t.startsWith(`http://`)&&!t.startsWith(`https://`)&&(t=`http://`+t),a(t),d(t))},e[3]=h):h=e[3];let g=h,_;e[4]===i?_=e[5]:(_=e=>{e.key===`Enter`&&g(i)},e[4]=i,e[5]=_);let v=_,y;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>a(e.target.value),e[6]=y):y=e[6];let b;e[7]!==v||e[8]!==i?(b=(0,l.jsx)(`input`,{type:`text`,value:i,onChange:y,onKeyDown:v,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[7]=v,e[8]=i,e[9]=b):b=e[9];let x;e[10]===u?x=e[11]:(x=u&&(0,l.jsx)(`button`,{onClick:()=>void n(u),title:`Open in external browser`,className:`p-1.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors`,children:(0,l.jsx)(t,{size:15})}),e[10]=u,e[11]=x);let S;e[12]!==b||e[13]!==x?(S=(0,l.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 border-b border-border shrink-0`,children:[b,x]}),e[12]=b,e[13]=x,e[14]=S):S=e[14];let C;e[15]===u?C=e[16]:(C=u?(0,l.jsx)(`iframe`,{ref:f,src:u,className:`flex-1 w-full border-none`,title:`Browser`}):(0,l.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-muted-foreground text-sm`,children:`Enter a URL to browse`}),e[15]=u,e[16]=C);let w;return e[17]!==S||e[18]!==C?(w=(0,l.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden`,children:[S,C]}),e[17]=S,e[18]=C,e[19]=w):w=e[19],w}export{u as BrowserTab};
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{Ai as t,Wt as n,br as r,ra as i,ta as a}from"./dialogs-config-Ofxg1Bn0.js";import{c as o}from"./index-DIWoaAFy.js";var s=a(),c=e(i(),1),l=r();function u(){let e=(0,s.c)(20),{devServerUrl:r}=o(),[i,a]=(0,c.useState)(``),[u,d]=(0,c.useState)(``),f=(0,c.useRef)(null),p,m;e[0]===r?(p=e[1],m=e[2]):(p=()=>{r&&(a(r),d(r))},m=[r],e[0]=r,e[1]=p,e[2]=m),(0,c.useEffect)(p,m);let h;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(h=e=>{let t=e.trim();t&&(!t.startsWith(`http://`)&&!t.startsWith(`https://`)&&(t=`http://`+t),a(t),d(t))},e[3]=h):h=e[3];let g=h,_;e[4]===i?_=e[5]:(_=e=>{e.key===`Enter`&&g(i)},e[4]=i,e[5]=_);let v=_,y;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>a(e.target.value),e[6]=y):y=e[6];let b;e[7]!==v||e[8]!==i?(b=(0,l.jsx)(`input`,{type:`text`,value:i,onChange:y,onKeyDown:v,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[7]=v,e[8]=i,e[9]=b):b=e[9];let x;e[10]===u?x=e[11]:(x=u&&(0,l.jsx)(`button`,{onClick:()=>void n(u),title:`Open in external browser`,className:`p-1.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors`,children:(0,l.jsx)(t,{size:15})}),e[10]=u,e[11]=x);let S;e[12]!==b||e[13]!==x?(S=(0,l.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 border-b border-border shrink-0`,children:[b,x]}),e[12]=b,e[13]=x,e[14]=S):S=e[14];let C;e[15]===u?C=e[16]:(C=u?(0,l.jsx)(`iframe`,{ref:f,src:u,className:`flex-1 w-full border-none`,title:`Browser`}):(0,l.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-muted-foreground text-sm`,children:`Enter a URL to browse`}),e[15]=u,e[16]=C);let w;return e[17]!==S||e[18]!==C?(w=(0,l.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden`,children:[S,C]}),e[17]=S,e[18]=C,e[19]=w):w=e[19],w}export{u as BrowserTab};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{Vn as t,Wi as n,br as r,qi as i,ra as a,ta as o,zi as s}from"./dialogs-config-Ofxg1Bn0.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-Bi5X_3XM.js";var b=o(),x=e(a(),1),S=r(),C=y,w=u,T=x.forwardRef((e,r)=>{let i=(0,b.c)(14),a,o,s,c;i[0]===e?(a=i[1],o=i[2],s=i[3],c=i[4]):({className:o,inset:s,children:a,...c}=e,i[0]=e,i[1]=a,i[2]=o,i[3]=s,i[4]=c);let l=s&&`pl-8`,u;i[5]!==o||i[6]!==l?(u=t(`flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground`,l,o),i[5]=o,i[6]=l,i[7]=u):u=i[7];let d;i[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,S.jsx)(n,{className:`ml-auto h-4 w-4`}),i[8]=d):d=i[8];let f;return i[9]!==a||i[10]!==c||i[11]!==r||i[12]!==u?(f=(0,S.jsxs)(p,{ref:r,className:u,...c,children:[a,d]}),i[9]=a,i[10]=c,i[11]=r,i[12]=u,i[13]=f):f=i[13],f});T.displayName=p.displayName;var E=x.forwardRef((e,n)=>{let r=(0,b.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=t(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==n||r[7]!==o?(s=(0,S.jsx)(g,{ref:n,className:o,...a}),r[5]=a,r[6]=n,r[7]=o,r[8]=s):s=r[8],s});E.displayName=g.displayName;var D=x.forwardRef((e,n)=>{let r=(0,b.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=t(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==n||r[7]!==o?(s=(0,S.jsx)(_,{children:(0,S.jsx)(m,{ref:n,className:o,...a})}),r[5]=a,r[6]=n,r[7]=o,r[8]=s):s=r[8],s});D.displayName=m.displayName;var O=x.forwardRef((e,n)=>{let r=(0,b.c)(11),i,a,o;r[0]===e?(i=r[1],a=r[2],o=r[3]):({className:i,inset:a,...o}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o);let s=a&&`pl-8`,c;r[4]!==i||r[5]!==s?(c=t(`relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,s,i),r[4]=i,r[5]=s,r[6]=c):c=r[6];let l;return r[7]!==o||r[8]!==n||r[9]!==c?(l=(0,S.jsx)(d,{ref:n,className:c,...o}),r[7]=o,r[8]=n,r[9]=c,r[10]=l):l=r[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=t(`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)(i,{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,n)=>{let r=(0,b.c)(12),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 l;r[4]===a?l=r[5]:(l=t(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,a),r[4]=a,r[5]=l);let u;r[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)(s,{className:`h-2 w-2 fill-current`})})}),r[6]=u):u=r[6];let d;return r[7]!==i||r[8]!==o||r[9]!==n||r[10]!==l?(d=(0,S.jsxs)(f,{ref:n,className:l,...o,children:[u,i]}),r[7]=i,r[8]=o,r[9]=n,r[10]=l,r[11]=d):d=r[11],d});A.displayName=f.displayName;var j=x.forwardRef((e,n)=>{let r=(0,b.c)(11),i,a,o;r[0]===e?(i=r[1],a=r[2],o=r[3]):({className:i,inset:a,...o}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o);let s=a&&`pl-8`,c;r[4]!==i||r[5]!==s?(c=t(`px-2 py-1.5 text-sm font-semibold text-foreground`,s,i),r[4]=i,r[5]=s,r[6]=c):c=r[6];let l;return r[7]!==o||r[8]!==n||r[9]!==c?(l=(0,S.jsx)(h,{ref:n,className:c,...o}),r[7]=o,r[8]=n,r[9]=c,r[10]=l):l=r[10],l});j.displayName=h.displayName;var M=x.forwardRef((e,n)=>{let r=(0,b.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=t(`-mx-1 my-1 h-px bg-border`,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==n||r[7]!==o?(s=(0,S.jsx)(l,{ref:n,className:o,...a}),r[5]=a,r[6]=n,r[7]=o,r[8]=s):s=r[8],s});M.displayName=l.displayName;var N=e=>{let n=(0,b.c)(8),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=t(`ml-auto text-xs tracking-widest text-muted-foreground`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==a?(o=(0,S.jsx)(`span`,{className:a,...i}),n[5]=i,n[6]=a,n[7]=o):o=n[7],o};N.displayName=`ContextMenuShortcut`;export{w as a,M as i,D as n,O as r,C as t};
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{Vn as t,Wi as n,br as r,qi as i,ra as a,ta as o,zi as s}from"./dialogs-config-Ofxg1Bn0.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-9yNfIRPs.js";var b=o(),x=e(a(),1),S=r(),C=y,w=u,T=x.forwardRef((e,r)=>{let i=(0,b.c)(14),a,o,s,c;i[0]===e?(a=i[1],o=i[2],s=i[3],c=i[4]):({className:o,inset:s,children:a,...c}=e,i[0]=e,i[1]=a,i[2]=o,i[3]=s,i[4]=c);let l=s&&`pl-8`,u;i[5]!==o||i[6]!==l?(u=t(`flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground`,l,o),i[5]=o,i[6]=l,i[7]=u):u=i[7];let d;i[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,S.jsx)(n,{className:`ml-auto h-4 w-4`}),i[8]=d):d=i[8];let f;return i[9]!==a||i[10]!==c||i[11]!==r||i[12]!==u?(f=(0,S.jsxs)(p,{ref:r,className:u,...c,children:[a,d]}),i[9]=a,i[10]=c,i[11]=r,i[12]=u,i[13]=f):f=i[13],f});T.displayName=p.displayName;var E=x.forwardRef((e,n)=>{let r=(0,b.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=t(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==n||r[7]!==o?(s=(0,S.jsx)(g,{ref:n,className:o,...a}),r[5]=a,r[6]=n,r[7]=o,r[8]=s):s=r[8],s});E.displayName=g.displayName;var D=x.forwardRef((e,n)=>{let r=(0,b.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=t(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==n||r[7]!==o?(s=(0,S.jsx)(_,{children:(0,S.jsx)(m,{ref:n,className:o,...a})}),r[5]=a,r[6]=n,r[7]=o,r[8]=s):s=r[8],s});D.displayName=m.displayName;var O=x.forwardRef((e,n)=>{let r=(0,b.c)(11),i,a,o;r[0]===e?(i=r[1],a=r[2],o=r[3]):({className:i,inset:a,...o}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o);let s=a&&`pl-8`,c;r[4]!==i||r[5]!==s?(c=t(`relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,s,i),r[4]=i,r[5]=s,r[6]=c):c=r[6];let l;return r[7]!==o||r[8]!==n||r[9]!==c?(l=(0,S.jsx)(d,{ref:n,className:c,...o}),r[7]=o,r[8]=n,r[9]=c,r[10]=l):l=r[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=t(`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)(i,{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,n)=>{let r=(0,b.c)(12),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 l;r[4]===a?l=r[5]:(l=t(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,a),r[4]=a,r[5]=l);let u;r[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)(s,{className:`h-2 w-2 fill-current`})})}),r[6]=u):u=r[6];let d;return r[7]!==i||r[8]!==o||r[9]!==n||r[10]!==l?(d=(0,S.jsxs)(f,{ref:n,className:l,...o,children:[u,i]}),r[7]=i,r[8]=o,r[9]=n,r[10]=l,r[11]=d):d=r[11],d});A.displayName=f.displayName;var j=x.forwardRef((e,n)=>{let r=(0,b.c)(11),i,a,o;r[0]===e?(i=r[1],a=r[2],o=r[3]):({className:i,inset:a,...o}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o);let s=a&&`pl-8`,c;r[4]!==i||r[5]!==s?(c=t(`px-2 py-1.5 text-sm font-semibold text-foreground`,s,i),r[4]=i,r[5]=s,r[6]=c):c=r[6];let l;return r[7]!==o||r[8]!==n||r[9]!==c?(l=(0,S.jsx)(h,{ref:n,className:c,...o}),r[7]=o,r[8]=n,r[9]=c,r[10]=l):l=r[10],l});j.displayName=h.displayName;var M=x.forwardRef((e,n)=>{let r=(0,b.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=t(`-mx-1 my-1 h-px bg-border`,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==n||r[7]!==o?(s=(0,S.jsx)(l,{ref:n,className:o,...a}),r[5]=a,r[6]=n,r[7]=o,r[8]=s):s=r[8],s});M.displayName=l.displayName;var N=e=>{let n=(0,b.c)(8),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=t(`ml-auto text-xs tracking-widest text-muted-foreground`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==a?(o=(0,S.jsx)(`span`,{className:a,...i}),n[5]=i,n[6]=a,n[7]=o):o=n[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"./dialogs-config-Ofxg1Bn0.js";import{t as e}from"./history-view-CAVl9GFy.js";export{e as ConversationHistoryView,e as default};
@@ -1,3 +1,3 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{Bn as t,En as n,Fn as r,Gi as i,Gr as a,In as o,K as s,Q as c,Rn as l,Si as u,Tt as d,Vn as f,Wi as p,Xr as m,Zr as h,_n as g,br as _,it as v,jn as y,li as b,oi as x,ra as S,ri as C,si as w,ta as T,wi as E,xi as D,zn as O,zt as k}from"./dialogs-config-Ofxg1Bn0.js";import{_ as ee}from"./react-vendor-Bi5X_3XM.js";import{a as A,t as j}from"./store-BuY90jLM.js";import{t as M}from"./textarea-CxhrnOOz.js";import{c as N,s as P,u as te}from"./history-view-BIN8vsvx.js";import{n as ne}from"./utils-7CkwsQJ0.js";import"./onboarding-QnvOtCAY.js";import{d as re,l as ie,n as ae,r as oe,t as se,x as F,y as I}from"./index-BOioHxIi.js";import"./monaco-CgzMkQ7t.js";import{a as L,n as R,r as ce,t as z}from"./context-menu-CoedP3Pg.js";var B=e(S(),1),V=T(),H=_();function U(e){let t=(0,V.c)(17),{children:r,title:i,headerAction:a,footer:o}=e,s;t[0]===i?s=t[1]:(s=i&&(0,H.jsx)(`span`,{className:`text-sm font-semibold tracking-tight`,children:i}),t[0]=i,t[1]=s);let c;t[2]===s?c=t[3]:(c=(0,H.jsx)(`div`,{className:`flex items-center gap-2`,children:s}),t[2]=s,t[3]=c);let l;t[4]===a?l=t[5]:(l=a&&(0,H.jsx)(`div`,{className:`flex items-center gap-2 ml-auto`,children:a}),t[4]=a,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,H.jsxs)(`div`,{className:`flex items-center justify-between border-b border-sidebar-border px-4 py-6`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===r?d=t[10]:(d=(0,H.jsx)(n,{className:`flex-1`,children:r}),t[9]=r,t[10]=d);let f;t[11]===o?f=t[12]:(f=o&&(0,H.jsx)(`div`,{className:`border-t border-sidebar-border`,children:o}),t[11]=o,t[12]=f);let p;return t[13]!==u||t[14]!==d||t[15]!==f?(p=(0,H.jsxs)(`div`,{className:`flex flex-col h-full`,children:[u,d,f]}),t[13]=u,t[14]=d,t[15]=f,t[16]=p):p=t[16],p}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 f(`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:o,selectedFileIndex:s,onFileSelect:c,onRevertFile:l}=e,d;t[0]===r?d=t[1]:(d=r.reduce(pe,0),t[0]=r,t[1]=d);let m=d,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`,v;t[4]!==r.length||t[5]!==_?(v=(0,H.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[r.length,` file`,_]}),t[4]=r.length,t[5]=_,t[6]=v):v=t[6];let y;t[7]===m?y=t[8]:(y=(0,H.jsxs)(`span`,{className:`text-xs text-green-500`,children:[`+`,m]}),t[7]=m,t[8]=y);let x;t[9]===g?x=t[10]:(x=(0,H.jsxs)(`span`,{className:`text-xs text-red-500`,children:[`-`,g]}),t[9]=g,t[10]=x);let S;t[11]!==v||t[12]!==y||t[13]!==x?(S=(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[v,y,x]}),t[11]=v,t[12]=y,t[13]=x,t[14]=S):S=t[14];let C=S;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)(b,{className:`h-6 w-6 animate-spin text-muted-foreground`})}),t[15]=e):e=t[15];let n;return t[16]===C?n=t[17]:(n=(0,H.jsx)(U,{title:`Review Changes`,headerAction:C,children:e}),t[16]=C,t[17]=n),n}if(o){let e;t[18]===o?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:o})}),t[18]=o,t[19]=e);let n;return t[20]!==C||t[21]!==e?(n=(0,H.jsx)(U,{title:`Review Changes`,headerAction:C,children:e}),t[20]=C,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]===C?n=t[25]:(n=(0,H.jsx)(U,{title:`Review Changes`,headerAction:C,children:e}),t[24]=C,t[25]=n),n}let w;t[26]!==r||t[27]!==c||t[28]!==l||t[29]!==s?(w=(e,t)=>{let{isOpen:n,toggle:i}=t,o=!!e.children,d=(0,H.jsxs)(I,{onClick:()=>{o?i():e.fileIndex!==void 0&&c(e.fileIndex)},selected:!o&&e.fileIndex===s,className:`gap-1.5`,children:[o?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(p,{className:f(`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform`,n&&`rotate-90`)}),n?(0,H.jsx)(u,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}):(0,H.jsx)(D,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}):(0,H.jsx)(E,{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}),!o&&e.status&&(0,H.jsx)(`span`,{className:K(e.status),children:ue(e.status)})]});return o?d:(0,H.jsxs)(z,{children:[(0,H.jsx)(L,{asChild:!0,children:d}),(0,H.jsx)(R,{children:(0,H.jsxs)(ce,{onClick:()=>{e.fileIndex!==void 0&&l?.(r[e.fileIndex])},children:[(0,H.jsx)(a,{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]=w):w=t[30];let T;t[31]!==w||t[32]!==n?(T=(0,H.jsx)(`div`,{className:`flex-1 overflow-y-auto pt-3 pb-2 px-1`,children:(0,H.jsx)(F,{nodes:n,defaultOpen:!0,resetKey:n,indent:16,childContainerClassName:`ml-4 border-l border-sidebar-border pl-2`,renderNode:w})}),t[31]=w,t[32]=n,t[33]=T):T=t[33];let O;return t[34]!==C||t[35]!==T?(O=(0,H.jsx)(U,{title:`Review Changes`,headerAction:C,children:T}),t[34]=C,t[35]=T,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?`mr-[-40px]`:``,i;return t[0]===r?i=t[1]:(i=(0,H.jsx)(se,{withHandle:!0,className:r}),t[0]=r,t[1]=i),i}function ge(e){let n=(0,V.c)(35),{open:i,lineNumber:a,lineContent:s,initialComment:c,isEditing:u,onSave:d,onDelete:f,onClose:p}=e,[m,h]=(0,B.useState)((c===void 0?``:c)??``),g;n[0]!==d||n[1]!==m?(g=()=>{m.trim()&&d(m.trim())},n[0]=d,n[1]=m,n[2]=g):g=n[2];let _=g,v;n[3]===_?v=n[4]:(v=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),_())},n[3]=_,n[4]=v);let b=v,x;n[5]===p?x=n[6]:(x=e=>{e||p()},n[5]=p,n[6]=x);let S;n[7]===a?S=n[8]:(S=(0,H.jsx)(O,{children:(0,H.jsxs)(t,{className:`text-sm font-medium`,children:[`Comment on line `,a]})}),n[7]=a,n[8]=S);let C=s||` `,w;n[9]===C?w=n[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}),n[9]=C,n[10]=w);let T;n[11]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>h(e.target.value),n[11]=T):T=n[11];let E;n[12]!==b||n[13]!==m?(E=(0,H.jsx)(M,{autoFocus:!0,placeholder:`Add a comment... (Cmd+Enter to save)`,value:m,onChange:T,onKeyDown:b,rows:12,className:`resize-none text-sm`}),n[12]=b,n[13]=m,n[14]=E):E=n[14];let D;n[15]!==u||n[16]!==f?(D=u&&f&&(0,H.jsx)(y,{variant:`destructive`,size:`sm`,onClick:f,className:`mr-auto`,children:`Delete`}),n[15]=u,n[16]=f,n[17]=D):D=n[17];let k;n[18]===m?k=n[19]:(k=m.trim(),n[18]=m,n[19]=k);let ee=!k,A;n[20]!==_||n[21]!==ee?(A=(0,H.jsx)(y,{size:`sm`,onClick:_,disabled:ee,children:`Save`}),n[20]=_,n[21]=ee,n[22]=A):A=n[22];let j;n[23]!==D||n[24]!==A?(j=(0,H.jsxs)(l,{className:`gap-2 sm:gap-0`,children:[D,A]}),n[23]=D,n[24]=A,n[25]=j):j=n[25];let N;n[26]!==j||n[27]!==S||n[28]!==w||n[29]!==E?(N=(0,H.jsxs)(o,{className:`max-w-2xl`,children:[S,w,E,j]}),n[26]=j,n[27]=S,n[28]=w,n[29]=E,n[30]=N):N=n[30];let P;return n[31]!==i||n[32]!==N||n[33]!==x?(P=(0,H.jsx)(r,{open:i,onOpenChange:x,children:N}),n[31]=i,n[32]=N,n[33]=x,n[34]=P):P=n[34],P}function X({threadId:e,onExit:t}){let{state:n,dispatch:r}=A(),{resolvedTheme:a}=ne(),[o,l]=(0,B.useState)([]),[u,_]=(0,B.useState)(!0),[b,S]=(0,B.useState)(null),[T,E]=(0,B.useState)(0),[D,O]=(0,B.useState)(!1),[M,se]=(0,B.useState)(!1),F=(0,B.useRef)(null),I=(0,B.useMemo)(()=>n.diffComments[e]??[],[n.diffComments,e]),L=(0,B.useCallback)(t=>{let i=n.diffComments[e]??[],a=typeof t==`function`?t(i):t;r({type:j.SetDiffComments,threadId:e,comments:a})},[r,e,n.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:D,selectedFileIndex:T,files:o}),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:D,selectedFileIndex:T,files:o}},[D,T,o]);let pe=(0,B.useCallback)(()=>{F.current&&(M?F.current.expand():F.current.collapse())},[M]),Y=(0,B.useCallback)(async()=>{if(e){_(!0),S(null);try{l((await v(e)).files||[]),E(0)}catch(e){S(e instanceof Error?e.message:`Failed to load diff`)}finally{_(!1)}}},[e]);(0,B.useEffect)(()=>{Y()},[Y]);let me=(0,B.useCallback)(async t=>{try{await k(e,t.path),await Y()}catch(e){S(e instanceof Error?e.message:`Failed to revert file`)}},[e,Y]),X=(0,B.useRef)(!1);(0,B.useEffect)(()=>{if((n.diffComments[e]??[]).length>0){X.current=!0;return}d(e).then(t=>{t.diffComments&&t.diffComments.length>0&&r({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(o),[o]),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(`
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{Bn as t,En as n,Fn as r,Gi as i,Gr as a,In as o,K as s,Q as c,Rn as l,Si as u,Tt as d,Vn as f,Wi as p,Xr as m,Zr as h,_n as g,br as _,it as v,jn as y,li as b,oi as x,ra as S,ri as C,si as w,ta as T,wi as E,xi as D,zn as O,zt as k}from"./dialogs-config-Ofxg1Bn0.js";import{_ as ee}from"./react-vendor-9yNfIRPs.js";import{a as A,t as j}from"./store-BuY90jLM.js";import{t as M}from"./textarea-CxhrnOOz.js";import{c as N,s as P,u as te}from"./history-view-CAVl9GFy.js";import{n as ne}from"./utils-7CkwsQJ0.js";import"./onboarding-DTzcWokE.js";import{d as re,l as ie,n as ae,r as oe,t as se,x as F,y as I}from"./index-DIWoaAFy.js";import"./monaco-CgzMkQ7t.js";import{a as L,n as R,r as ce,t as z}from"./context-menu-CC9JLx5B.js";var B=e(S(),1),V=T(),H=_();function U(e){let t=(0,V.c)(17),{children:r,title:i,headerAction:a,footer:o}=e,s;t[0]===i?s=t[1]:(s=i&&(0,H.jsx)(`span`,{className:`text-sm font-semibold tracking-tight`,children:i}),t[0]=i,t[1]=s);let c;t[2]===s?c=t[3]:(c=(0,H.jsx)(`div`,{className:`flex items-center gap-2`,children:s}),t[2]=s,t[3]=c);let l;t[4]===a?l=t[5]:(l=a&&(0,H.jsx)(`div`,{className:`flex items-center gap-2 ml-auto`,children:a}),t[4]=a,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,H.jsxs)(`div`,{className:`flex items-center justify-between border-b border-sidebar-border px-4 py-6`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===r?d=t[10]:(d=(0,H.jsx)(n,{className:`flex-1`,children:r}),t[9]=r,t[10]=d);let f;t[11]===o?f=t[12]:(f=o&&(0,H.jsx)(`div`,{className:`border-t border-sidebar-border`,children:o}),t[11]=o,t[12]=f);let p;return t[13]!==u||t[14]!==d||t[15]!==f?(p=(0,H.jsxs)(`div`,{className:`flex flex-col h-full`,children:[u,d,f]}),t[13]=u,t[14]=d,t[15]=f,t[16]=p):p=t[16],p}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 f(`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:o,selectedFileIndex:s,onFileSelect:c,onRevertFile:l}=e,d;t[0]===r?d=t[1]:(d=r.reduce(pe,0),t[0]=r,t[1]=d);let m=d,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`,v;t[4]!==r.length||t[5]!==_?(v=(0,H.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[r.length,` file`,_]}),t[4]=r.length,t[5]=_,t[6]=v):v=t[6];let y;t[7]===m?y=t[8]:(y=(0,H.jsxs)(`span`,{className:`text-xs text-green-500`,children:[`+`,m]}),t[7]=m,t[8]=y);let x;t[9]===g?x=t[10]:(x=(0,H.jsxs)(`span`,{className:`text-xs text-red-500`,children:[`-`,g]}),t[9]=g,t[10]=x);let S;t[11]!==v||t[12]!==y||t[13]!==x?(S=(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[v,y,x]}),t[11]=v,t[12]=y,t[13]=x,t[14]=S):S=t[14];let C=S;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)(b,{className:`h-6 w-6 animate-spin text-muted-foreground`})}),t[15]=e):e=t[15];let n;return t[16]===C?n=t[17]:(n=(0,H.jsx)(U,{title:`Review Changes`,headerAction:C,children:e}),t[16]=C,t[17]=n),n}if(o){let e;t[18]===o?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:o})}),t[18]=o,t[19]=e);let n;return t[20]!==C||t[21]!==e?(n=(0,H.jsx)(U,{title:`Review Changes`,headerAction:C,children:e}),t[20]=C,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]===C?n=t[25]:(n=(0,H.jsx)(U,{title:`Review Changes`,headerAction:C,children:e}),t[24]=C,t[25]=n),n}let w;t[26]!==r||t[27]!==c||t[28]!==l||t[29]!==s?(w=(e,t)=>{let{isOpen:n,toggle:i}=t,o=!!e.children,d=(0,H.jsxs)(I,{onClick:()=>{o?i():e.fileIndex!==void 0&&c(e.fileIndex)},selected:!o&&e.fileIndex===s,className:`gap-1.5`,children:[o?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(p,{className:f(`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform`,n&&`rotate-90`)}),n?(0,H.jsx)(u,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}):(0,H.jsx)(D,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}):(0,H.jsx)(E,{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}),!o&&e.status&&(0,H.jsx)(`span`,{className:K(e.status),children:ue(e.status)})]});return o?d:(0,H.jsxs)(z,{children:[(0,H.jsx)(L,{asChild:!0,children:d}),(0,H.jsx)(R,{children:(0,H.jsxs)(ce,{onClick:()=>{e.fileIndex!==void 0&&l?.(r[e.fileIndex])},children:[(0,H.jsx)(a,{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]=w):w=t[30];let T;t[31]!==w||t[32]!==n?(T=(0,H.jsx)(`div`,{className:`flex-1 overflow-y-auto pt-3 pb-2 px-1`,children:(0,H.jsx)(F,{nodes:n,defaultOpen:!0,resetKey:n,indent:16,childContainerClassName:`ml-4 border-l border-sidebar-border pl-2`,renderNode:w})}),t[31]=w,t[32]=n,t[33]=T):T=t[33];let O;return t[34]!==C||t[35]!==T?(O=(0,H.jsx)(U,{title:`Review Changes`,headerAction:C,children:T}),t[34]=C,t[35]=T,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?`mr-[-40px]`:``,i;return t[0]===r?i=t[1]:(i=(0,H.jsx)(se,{withHandle:!0,className:r}),t[0]=r,t[1]=i),i}function ge(e){let n=(0,V.c)(35),{open:i,lineNumber:a,lineContent:s,initialComment:c,isEditing:u,onSave:d,onDelete:f,onClose:p}=e,[m,h]=(0,B.useState)((c===void 0?``:c)??``),g;n[0]!==d||n[1]!==m?(g=()=>{m.trim()&&d(m.trim())},n[0]=d,n[1]=m,n[2]=g):g=n[2];let _=g,v;n[3]===_?v=n[4]:(v=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),_())},n[3]=_,n[4]=v);let b=v,x;n[5]===p?x=n[6]:(x=e=>{e||p()},n[5]=p,n[6]=x);let S;n[7]===a?S=n[8]:(S=(0,H.jsx)(O,{children:(0,H.jsxs)(t,{className:`text-sm font-medium`,children:[`Comment on line `,a]})}),n[7]=a,n[8]=S);let C=s||` `,w;n[9]===C?w=n[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}),n[9]=C,n[10]=w);let T;n[11]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>h(e.target.value),n[11]=T):T=n[11];let E;n[12]!==b||n[13]!==m?(E=(0,H.jsx)(M,{autoFocus:!0,placeholder:`Add a comment... (Cmd+Enter to save)`,value:m,onChange:T,onKeyDown:b,rows:12,className:`resize-none text-sm`}),n[12]=b,n[13]=m,n[14]=E):E=n[14];let D;n[15]!==u||n[16]!==f?(D=u&&f&&(0,H.jsx)(y,{variant:`destructive`,size:`sm`,onClick:f,className:`mr-auto`,children:`Delete`}),n[15]=u,n[16]=f,n[17]=D):D=n[17];let k;n[18]===m?k=n[19]:(k=m.trim(),n[18]=m,n[19]=k);let ee=!k,A;n[20]!==_||n[21]!==ee?(A=(0,H.jsx)(y,{size:`sm`,onClick:_,disabled:ee,children:`Save`}),n[20]=_,n[21]=ee,n[22]=A):A=n[22];let j;n[23]!==D||n[24]!==A?(j=(0,H.jsxs)(l,{className:`gap-2 sm:gap-0`,children:[D,A]}),n[23]=D,n[24]=A,n[25]=j):j=n[25];let N;n[26]!==j||n[27]!==S||n[28]!==w||n[29]!==E?(N=(0,H.jsxs)(o,{className:`max-w-2xl`,children:[S,w,E,j]}),n[26]=j,n[27]=S,n[28]=w,n[29]=E,n[30]=N):N=n[30];let P;return n[31]!==i||n[32]!==N||n[33]!==x?(P=(0,H.jsx)(r,{open:i,onOpenChange:x,children:N}),n[31]=i,n[32]=N,n[33]=x,n[34]=P):P=n[34],P}function X({threadId:e,onExit:t}){let{state:n,dispatch:r}=A(),{resolvedTheme:a}=ne(),[o,l]=(0,B.useState)([]),[u,_]=(0,B.useState)(!0),[b,S]=(0,B.useState)(null),[T,E]=(0,B.useState)(0),[D,O]=(0,B.useState)(!1),[M,se]=(0,B.useState)(!1),F=(0,B.useRef)(null),I=(0,B.useMemo)(()=>n.diffComments[e]??[],[n.diffComments,e]),L=(0,B.useCallback)(t=>{let i=n.diffComments[e]??[],a=typeof t==`function`?t(i):t;r({type:j.SetDiffComments,threadId:e,comments:a})},[r,e,n.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:D,selectedFileIndex:T,files:o}),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:D,selectedFileIndex:T,files:o}},[D,T,o]);let pe=(0,B.useCallback)(()=>{F.current&&(M?F.current.expand():F.current.collapse())},[M]),Y=(0,B.useCallback)(async()=>{if(e){_(!0),S(null);try{l((await v(e)).files||[]),E(0)}catch(e){S(e instanceof Error?e.message:`Failed to load diff`)}finally{_(!1)}}},[e]);(0,B.useEffect)(()=>{Y()},[Y]);let me=(0,B.useCallback)(async t=>{try{await k(e,t.path),await Y()}catch(e){S(e instanceof Error?e.message:`Failed to revert file`)}},[e,Y]),X=(0,B.useRef)(!1);(0,B.useEffect)(()=>{if((n.diffComments[e]??[]).length>0){X.current=!0;return}d(e).then(t=>{t.diffComments&&t.diffComments.length>0&&r({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(o),[o]),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
2
  `).slice(t-1,n).join(`
3
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=o[T],xe=Q?D?Q.oldContent:(()=>{let e=Z(Q);return e?ve(Q.oldContent,e.startLine,e.endLine):Q.oldContent})():``,Se=Q?D?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,T,D,Q]),(0,B.useEffect)(()=>()=>{G.current=null,J.current={original:[],modified:[]}},[T]),(0,B.useEffect)(()=>()=>{fe.current=!1,G.current=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:T,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,T,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),E(n.fileIndex),setTimeout(()=>{let e=G.current;if(!e)return;let t=o[n.fileIndex];if(!t)return;let r=D?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,o,D,$]),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 i=n.projectModelSelections[e];if(!i)try{let e=await c(),t=Object.values(e).flat();if(t.length>0)i=t[0];else{console.error(`No models available to process comments`);return}}catch(e){console.error(`Failed to load models:`,e);return}let a=i.id,o=i.provider;try{let{prompt:n}=await s(e,I);L([]),r({type:j.SetPendingChatMessage,message:{threadId:e,message:n,model:a,provider:o}}),t()}catch(e){console.error(`Failed to fix comments:`,e),typeof window<`u`&&window.alert(`Failed to process comments. Please try again.`)}},[I,n.projectModelSelections,r,e,t,L]),Ae={readOnly:!0,renderSideBySide:!0,ignoreTrimWhitespace:!1,renderOverviewRuler:!0,scrollBeyondLastLine:!1,minimap:{enabled:!1},folding:!1,lineNumbers:Q&&(D||ye(Q))?`on`:`off`,diffWordWrap:`on`,originalEditable:!1,automaticLayout:!0,theme:a===`dark`?`vs-dark`:`vs-light`};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)(oe,{direction:`horizontal`,children:[(0,H.jsx)(ae,{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)(ie,{className:f(`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.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,H.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:Q?Q.path:`Review Changes`})}),(0,H.jsxs)(`div`,{className:f(`flex items-center gap-2`,M&&`ml-0`,!M&&`ml-auto`,`md:ml-auto`),children:[(0,H.jsx)(y,{variant:`ghost`,size:`sm`,onClick:()=>O(e=>!e),disabled:!Q,className:`h-8 gap-1 px-2 text-xs`,children:D?(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)(w,{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)(y,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:De,disabled:(R??0)===0,children:(0,H.jsx)(i,{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)(y,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:Oe,disabled:(R??0)===I.length-1,children:(0,H.jsx)(p,{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)(y,{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)(x,{className:`h-3 w-3`}),`Fix all comments`]})}),(0,H.jsx)(N,{children:`Send all comments to Tarsk for resolution`})]}),(0,H.jsxs)(y,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground shrink-0`,onClick:pe,children:[M?(0,H.jsx)(m,{className:`h-4 w-4`}):(0,H.jsx)(h,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Toggle file tree`})]})]})]}),(0,H.jsxs)(`div`,{className:`flex-1 bg-transparent relative`,children:[(0,H.jsx)(ee,{height:`100%`,language:be(Q?.path||``),original:xe,modified:Se,onMount:Ce,options:Ae},`diff-${T}`),(0,H.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0`,children:(0,H.jsx)(re,{})})]})]})}),(0,H.jsx)(he,{isOpen:!M}),(0,H.jsx)(ae,{ref:F,defaultSize:25,minSize:12,maxSize:40,collapsible:!0,collapsedSize:0,onCollapse:()=>se(!0),onExpand:()=>se(!1),className:`border-l border-transparent ml-[40px]`,children:(0,H.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,H.jsx)(de,{treeData:_e,files:o,isLoading:u,error:b,selectedFileIndex:T,onFileSelect:E,onRevertFile:me})})})]})}),(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};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/explorer-tree-DYE9rGNc.js","assets/rolldown-runtime-Dw2cE7zH.js","assets/index-BOioHxIi.js","assets/react-vendor-Bi5X_3XM.js","assets/history-view-BIN8vsvx.js","assets/dialogs-config-Ofxg1Bn0.js","assets/monaco-CgzMkQ7t.js","assets/onboarding-QnvOtCAY.js","assets/textarea-CxhrnOOz.js","assets/store-BuY90jLM.js","assets/utils-7CkwsQJ0.js","assets/index-BVLzVjoR.css","assets/api-BfUK32d1.js","assets/context-menu-CoedP3Pg.js","assets/explorer-view-DgNDIV-D.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{En as t,br as n,ra as r,ta as i}from"./dialogs-config-Ofxg1Bn0.js";import{_t as a}from"./react-vendor-Bi5X_3XM.js";import{a as o}from"./store-BuY90jLM.js";import{c as s,n as c,r as l,t as u}from"./index-BOioHxIi.js";var d=i(),f=e(r(),1),p=n(),m=(0,f.lazy)(()=>a(()=>import(`./explorer-tree-DYE9rGNc.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]))),h=(0,f.lazy)(()=>a(()=>import(`./explorer-view-DgNDIV-D.js`),__vite__mapDeps([14,1,2,3,4,5,6,7,8,9,10,11,12])));function g(){let e=(0,d.c)(17),{state:n}=o(),r=n.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)(t,{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};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/explorer-tree-BwLCrdfR.js","assets/rolldown-runtime-Dw2cE7zH.js","assets/index-DIWoaAFy.js","assets/react-vendor-9yNfIRPs.js","assets/history-view-CAVl9GFy.js","assets/dialogs-config-Ofxg1Bn0.js","assets/monaco-CgzMkQ7t.js","assets/onboarding-DTzcWokE.js","assets/textarea-CxhrnOOz.js","assets/store-BuY90jLM.js","assets/utils-7CkwsQJ0.js","assets/index-BVLzVjoR.css","assets/api-BfUK32d1.js","assets/context-menu-CC9JLx5B.js","assets/explorer-view-CPCrOqXp.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{En as t,br as n,ra as r,ta as i}from"./dialogs-config-Ofxg1Bn0.js";import{_t as a}from"./react-vendor-9yNfIRPs.js";import{a as o}from"./store-BuY90jLM.js";import{c as s,n as c,r as l,t as u}from"./index-DIWoaAFy.js";var d=i(),f=e(r(),1),p=n(),m=(0,f.lazy)(()=>a(()=>import(`./explorer-tree-BwLCrdfR.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]))),h=(0,f.lazy)(()=>a(()=>import(`./explorer-view-CPCrOqXp.js`),__vite__mapDeps([14,1,2,3,4,5,6,7,8,9,10,11,12])));function g(){let e=(0,d.c)(17),{state:n}=o(),r=n.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)(t,{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};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{Ki as t,Si as n,Wi as r,br as i,li as a,ra as o,ta as s,wi as c,xi as l}from"./dialogs-config-Ofxg1Bn0.js";import"./react-vendor-Bi5X_3XM.js";import"./history-view-BIN8vsvx.js";import{_ as u,b as d,c as f,g as p,h as m,m as h,p as g,v as _,y as v}from"./index-BOioHxIi.js";import{a as y,i as ee,n as b,r as x,t as S}from"./context-menu-CoedP3Pg.js";import{n as C,o as w,r as T,s as E,t as D}from"./api-BfUK32d1.js";var O=s(),k=e(o(),1),A=i();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 i=(0,O.c)(101),{node:o,level:s,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;i[0]!==d||i[1]!==o.path?(F=d.has(o.path),i[0]=d,i[1]=o.path,i[2]=F):F=i[2];let I=F,L;i[3]!==p||i[4]!==o.path?(L=p.has(o.path),i[3]=p,i[4]=o.path,i[5]=L):L=i[5];let R=L,z,B;if(i[6]!==d||i[7]!==I||i[8]!==R||i[9]!==s||i[10]!==f||i[11]!==p||i[12]!==h||i[13]!==o||i[14]!==P||i[15]!==T||i[16]!==j||i[17]!==w||i[18]!==E||i[19]!==D||i[20]!==k||i[21]!==_||i[22]!==C||i[23]!==g||i[24]!==m||i[25]!==u){B=Symbol.for(`react.early_return_sentinel`);bb0:{let e=f.get(o.path)??[];z=m===o.path;let O=h?.dirPath===o.path&&I;if(o.type===`folder`){let M=o.ignored?`opacity-50`:void 0,F;i[28]!==o||i[29]!==g?(F=e=>{e.stopPropagation(),g(o)},i[28]=o,i[29]=g,i[30]=F):F=i[30];let L;i[31]!==I||i[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)(t,{className:`h-3 w-3`}):(0,A.jsx)(r,{className:`h-3 w-3`})}),i[31]=I,i[32]=R,i[33]=L):L=i[33];let V;i[34]!==I||i[35]!==z||i[36]!==o||i[37]!==T||i[38]!==w?(V=z?(0,A.jsxs)(A.Fragment,{children:[I?(0,A.jsx)(n,{className:`h-4 w-4 flex-shrink-0`}):(0,A.jsx)(l,{className:`h-4 w-4 flex-shrink-0`}),(0,A.jsx)(`input`,{autoFocus:!0,defaultValue:o.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?w(o,t):T()}else e.key===`Escape`&&T()},onBlur:e=>{let t=e.target.value.trim();t?w(o,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)(n,{className:`h-4 w-4 flex-shrink-0`}):(0,A.jsx)(l,{className:`h-4 w-4 flex-shrink-0`}),(0,A.jsx)(`span`,{className:`flex-1 truncate`,children:o.name})]}),i[34]=I,i[35]=z,i[36]=o,i[37]=T,i[38]=w,i[39]=V):V=i[39];let H;i[40]!==s||i[41]!==M||i[42]!==F||i[43]!==L||i[44]!==V?(H=(0,A.jsxs)(v,{level:s,basePadding:10,className:M,onClick:F,children:[L,V]}),i[40]=s,i[41]=M,i[42]=F,i[43]=L,i[44]=V,i[45]=H):H=i[45];let U=I&&(0,A.jsx)(`div`,{children:R&&!f.has(o.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:s+1,basePadding:h.type===`folder`?10:22,icon:h.type===`folder`?(0,A.jsx)(l,{className:`h-4 w-4 flex-shrink-0`}):(0,A.jsx)(c,{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:s+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;i[46]!==H||i[47]!==U?(W=(0,A.jsxs)(`div`,{children:[H,U]}),i[46]=H,i[47]=U,i[48]=W):W=i[48];let G=W,K;i[49]===G?K=i[50]:(K=(0,A.jsx)(y,{asChild:!0,children:G}),i[49]=G,i[50]=K);let q;i[51]!==o.path||i[52]!==D?(q=(0,A.jsx)(x,{onSelect:()=>D(o.path),children:`New File...`}),i[51]=o.path,i[52]=D,i[53]=q):q=i[53];let J;i[54]!==o.path||i[55]!==k?(J=(0,A.jsx)(x,{onSelect:()=>k(o.path),children:`New Folder...`}),i[54]=o.path,i[55]=k,i[56]=J):J=i[56];let Y;i[57]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,A.jsx)(ee,{}),i[57]=Y):Y=i[57];let X;i[58]!==o||i[59]!==C?(X=(0,A.jsx)(x,{onSelect:()=>C(o),children:`Rename...`}),i[58]=o,i[59]=C,i[60]=X):X=i[60];let Z;i[61]!==o||i[62]!==E?(Z=(0,A.jsx)(x,{onSelect:()=>E(o),className:`text-destructive focus:text-destructive`,children:`Delete`}),i[61]=o,i[62]=E,i[63]=Z):Z=i[63];let Q;i[64]!==q||i[65]!==J||i[66]!==X||i[67]!==Z?(Q=(0,A.jsxs)(b,{children:[q,J,Y,X,Z]}),i[64]=q,i[65]=J,i[66]=X,i[67]=Z,i[68]=Q):Q=i[68];let $;i[69]!==K||i[70]!==Q?($=(0,A.jsxs)(S,{children:[K,Q]}),i[69]=K,i[70]=Q,i[71]=$):$=i[71],B=$;break bb0}}i[6]=d,i[7]=I,i[8]=R,i[9]=s,i[10]=f,i[11]=p,i[12]=h,i[13]=o,i[14]=P,i[15]=T,i[16]=j,i[17]=w,i[18]=E,i[19]=D,i[20]=k,i[21]=_,i[22]=C,i[23]=g,i[24]=m,i[25]=u,i[26]=z,i[27]=B}else z=i[26],B=i[27];if(B!==Symbol.for(`react.early_return_sentinel`))return B;let V=u===o.path,H=o.ignored?`opacity-50`:void 0,U;i[72]!==o||i[73]!==_?(U=()=>_(o),i[72]=o,i[73]=_,i[74]=U):U=i[74];let W;i[75]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,A.jsx)(c,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),i[75]=W):W=i[75];let G;i[76]!==z||i[77]!==o||i[78]!==T||i[79]!==w?(G=z?(0,A.jsx)(`input`,{autoFocus:!0,defaultValue:o.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?w(o,t):T()}else e.key===`Escape`&&T()},onBlur:e=>{let t=e.target.value.trim();t?w(o,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:o.name}),i[76]=z,i[77]=o,i[78]=T,i[79]=w,i[80]=G):G=i[80];let K;i[81]!==s||i[82]!==V||i[83]!==H||i[84]!==U||i[85]!==G?(K=(0,A.jsxs)(v,{level:s,basePadding:22,selected:V,className:H,onClick:U,children:[W,G]}),i[81]=s,i[82]=V,i[83]=H,i[84]=U,i[85]=G,i[86]=K):K=i[86];let q=K,J;i[87]===q?J=i[88]:(J=(0,A.jsx)(y,{asChild:!0,children:q}),i[87]=q,i[88]=J);let Y;i[89]!==o||i[90]!==C?(Y=(0,A.jsx)(x,{onSelect:()=>C(o),children:`Rename...`}),i[89]=o,i[90]=C,i[91]=Y):Y=i[91];let X;i[92]!==o||i[93]!==E?(X=(0,A.jsx)(x,{onSelect:()=>E(o),className:`text-destructive focus:text-destructive`,children:`Delete`}),i[92]=o,i[93]=E,i[94]=X):X=i[94];let Z;i[95]!==Y||i[96]!==X?(Z=(0,A.jsxs)(b,{children:[Y,X]}),i[95]=Y,i[96]=X,i[97]=Z):Z=i[97];let Q;return i[98]!==J||i[99]!==Z?(Q=(0,A.jsxs)(S,{children:[J,Z]}),i[98]=J,i[99]=Z,i[100]=Q):Q=i[100],Q}function M(e){return e.stopPropagation()}function N(e){return e.stopPropagation()}function P({threadId:e,selectedPath:t,onFileSelect:n}){let[r,i]=(0,k.useState)(new Map),[a,o]=(0,k.useState)(new Set),[s,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}=f();async function L(t){if(!(!e||r.has(t))){v(e=>new Set(e).add(t));try{let n=await w(e,t);i(e=>new Map(e).set(t,n.entries))}catch{d({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);i(e=>new Map(e).set(t,n.entries))}catch{d({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&&(i(new Map),o(new Set),v(new Set),O(null),M(null),L(``))},[e]),(0,k.useEffect)(()=>{if(F>0&&e){R(``);for(let e of a)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){o(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){a.has(e.path)?o(t=>{let n=new Set(t);return n.delete(e.path),n}):(o(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)),o(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),i(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{d({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`&&(o(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),i(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{d({title:`Error`,description:`Failed to rename "${t.name}"`,variant:`destructive`})}}function G(e){O(null),a.has(e)||(o(t=>new Set(t).add(e)),L(e)),M({dirPath:e,type:`file`})}function K(e){O(null),a.has(e)||(o(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{d({title:`Error`,description:`Failed to create ${r} "${t}"`,variant:`destructive`})}}function J(){M(null)}let Y=r.get(``)??[],X=s.has(``),Z=j?.dirPath===``?(0,A.jsx)(te,{defaultValue:``,level:0,basePadding:j.type===`folder`?10:22,icon:j.type===`folder`?(0,A.jsx)(l,{className:`h-4 w-4 flex-shrink-0`}):(0,A.jsx)(c,{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)(u,{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:a,loadedDirs:r,loadingPaths:s,renamingPath:ee,newItemIn:j,onToggleFolder:z,onSelectFile:n,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
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{Ki as t,Si as n,Wi as r,br as i,li as a,ra as o,ta as s,wi as c,xi as l}from"./dialogs-config-Ofxg1Bn0.js";import"./react-vendor-9yNfIRPs.js";import"./history-view-CAVl9GFy.js";import{_ as u,b as d,c as f,g as p,h as m,m as h,p as g,v as _,y as v}from"./index-DIWoaAFy.js";import{a as y,i as ee,n as b,r as x,t as S}from"./context-menu-CC9JLx5B.js";import{n as C,o as w,r as T,s as E,t as D}from"./api-BfUK32d1.js";var O=s(),k=e(o(),1),A=i();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 i=(0,O.c)(101),{node:o,level:s,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;i[0]!==d||i[1]!==o.path?(F=d.has(o.path),i[0]=d,i[1]=o.path,i[2]=F):F=i[2];let I=F,L;i[3]!==p||i[4]!==o.path?(L=p.has(o.path),i[3]=p,i[4]=o.path,i[5]=L):L=i[5];let R=L,z,B;if(i[6]!==d||i[7]!==I||i[8]!==R||i[9]!==s||i[10]!==f||i[11]!==p||i[12]!==h||i[13]!==o||i[14]!==P||i[15]!==T||i[16]!==j||i[17]!==w||i[18]!==E||i[19]!==D||i[20]!==k||i[21]!==_||i[22]!==C||i[23]!==g||i[24]!==m||i[25]!==u){B=Symbol.for(`react.early_return_sentinel`);bb0:{let e=f.get(o.path)??[];z=m===o.path;let O=h?.dirPath===o.path&&I;if(o.type===`folder`){let M=o.ignored?`opacity-50`:void 0,F;i[28]!==o||i[29]!==g?(F=e=>{e.stopPropagation(),g(o)},i[28]=o,i[29]=g,i[30]=F):F=i[30];let L;i[31]!==I||i[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)(t,{className:`h-3 w-3`}):(0,A.jsx)(r,{className:`h-3 w-3`})}),i[31]=I,i[32]=R,i[33]=L):L=i[33];let V;i[34]!==I||i[35]!==z||i[36]!==o||i[37]!==T||i[38]!==w?(V=z?(0,A.jsxs)(A.Fragment,{children:[I?(0,A.jsx)(n,{className:`h-4 w-4 flex-shrink-0`}):(0,A.jsx)(l,{className:`h-4 w-4 flex-shrink-0`}),(0,A.jsx)(`input`,{autoFocus:!0,defaultValue:o.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?w(o,t):T()}else e.key===`Escape`&&T()},onBlur:e=>{let t=e.target.value.trim();t?w(o,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)(n,{className:`h-4 w-4 flex-shrink-0`}):(0,A.jsx)(l,{className:`h-4 w-4 flex-shrink-0`}),(0,A.jsx)(`span`,{className:`flex-1 truncate`,children:o.name})]}),i[34]=I,i[35]=z,i[36]=o,i[37]=T,i[38]=w,i[39]=V):V=i[39];let H;i[40]!==s||i[41]!==M||i[42]!==F||i[43]!==L||i[44]!==V?(H=(0,A.jsxs)(v,{level:s,basePadding:10,className:M,onClick:F,children:[L,V]}),i[40]=s,i[41]=M,i[42]=F,i[43]=L,i[44]=V,i[45]=H):H=i[45];let U=I&&(0,A.jsx)(`div`,{children:R&&!f.has(o.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:s+1,basePadding:h.type===`folder`?10:22,icon:h.type===`folder`?(0,A.jsx)(l,{className:`h-4 w-4 flex-shrink-0`}):(0,A.jsx)(c,{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:s+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;i[46]!==H||i[47]!==U?(W=(0,A.jsxs)(`div`,{children:[H,U]}),i[46]=H,i[47]=U,i[48]=W):W=i[48];let G=W,K;i[49]===G?K=i[50]:(K=(0,A.jsx)(y,{asChild:!0,children:G}),i[49]=G,i[50]=K);let q;i[51]!==o.path||i[52]!==D?(q=(0,A.jsx)(x,{onSelect:()=>D(o.path),children:`New File...`}),i[51]=o.path,i[52]=D,i[53]=q):q=i[53];let J;i[54]!==o.path||i[55]!==k?(J=(0,A.jsx)(x,{onSelect:()=>k(o.path),children:`New Folder...`}),i[54]=o.path,i[55]=k,i[56]=J):J=i[56];let Y;i[57]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,A.jsx)(ee,{}),i[57]=Y):Y=i[57];let X;i[58]!==o||i[59]!==C?(X=(0,A.jsx)(x,{onSelect:()=>C(o),children:`Rename...`}),i[58]=o,i[59]=C,i[60]=X):X=i[60];let Z;i[61]!==o||i[62]!==E?(Z=(0,A.jsx)(x,{onSelect:()=>E(o),className:`text-destructive focus:text-destructive`,children:`Delete`}),i[61]=o,i[62]=E,i[63]=Z):Z=i[63];let Q;i[64]!==q||i[65]!==J||i[66]!==X||i[67]!==Z?(Q=(0,A.jsxs)(b,{children:[q,J,Y,X,Z]}),i[64]=q,i[65]=J,i[66]=X,i[67]=Z,i[68]=Q):Q=i[68];let $;i[69]!==K||i[70]!==Q?($=(0,A.jsxs)(S,{children:[K,Q]}),i[69]=K,i[70]=Q,i[71]=$):$=i[71],B=$;break bb0}}i[6]=d,i[7]=I,i[8]=R,i[9]=s,i[10]=f,i[11]=p,i[12]=h,i[13]=o,i[14]=P,i[15]=T,i[16]=j,i[17]=w,i[18]=E,i[19]=D,i[20]=k,i[21]=_,i[22]=C,i[23]=g,i[24]=m,i[25]=u,i[26]=z,i[27]=B}else z=i[26],B=i[27];if(B!==Symbol.for(`react.early_return_sentinel`))return B;let V=u===o.path,H=o.ignored?`opacity-50`:void 0,U;i[72]!==o||i[73]!==_?(U=()=>_(o),i[72]=o,i[73]=_,i[74]=U):U=i[74];let W;i[75]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,A.jsx)(c,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),i[75]=W):W=i[75];let G;i[76]!==z||i[77]!==o||i[78]!==T||i[79]!==w?(G=z?(0,A.jsx)(`input`,{autoFocus:!0,defaultValue:o.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?w(o,t):T()}else e.key===`Escape`&&T()},onBlur:e=>{let t=e.target.value.trim();t?w(o,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:o.name}),i[76]=z,i[77]=o,i[78]=T,i[79]=w,i[80]=G):G=i[80];let K;i[81]!==s||i[82]!==V||i[83]!==H||i[84]!==U||i[85]!==G?(K=(0,A.jsxs)(v,{level:s,basePadding:22,selected:V,className:H,onClick:U,children:[W,G]}),i[81]=s,i[82]=V,i[83]=H,i[84]=U,i[85]=G,i[86]=K):K=i[86];let q=K,J;i[87]===q?J=i[88]:(J=(0,A.jsx)(y,{asChild:!0,children:q}),i[87]=q,i[88]=J);let Y;i[89]!==o||i[90]!==C?(Y=(0,A.jsx)(x,{onSelect:()=>C(o),children:`Rename...`}),i[89]=o,i[90]=C,i[91]=Y):Y=i[91];let X;i[92]!==o||i[93]!==E?(X=(0,A.jsx)(x,{onSelect:()=>E(o),className:`text-destructive focus:text-destructive`,children:`Delete`}),i[92]=o,i[93]=E,i[94]=X):X=i[94];let Z;i[95]!==Y||i[96]!==X?(Z=(0,A.jsxs)(b,{children:[Y,X]}),i[95]=Y,i[96]=X,i[97]=Z):Z=i[97];let Q;return i[98]!==J||i[99]!==Z?(Q=(0,A.jsxs)(S,{children:[J,Z]}),i[98]=J,i[99]=Z,i[100]=Q):Q=i[100],Q}function M(e){return e.stopPropagation()}function N(e){return e.stopPropagation()}function P({threadId:e,selectedPath:t,onFileSelect:n}){let[r,i]=(0,k.useState)(new Map),[a,o]=(0,k.useState)(new Set),[s,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}=f();async function L(t){if(!(!e||r.has(t))){v(e=>new Set(e).add(t));try{let n=await w(e,t);i(e=>new Map(e).set(t,n.entries))}catch{d({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);i(e=>new Map(e).set(t,n.entries))}catch{d({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&&(i(new Map),o(new Set),v(new Set),O(null),M(null),L(``))},[e]),(0,k.useEffect)(()=>{if(F>0&&e){R(``);for(let e of a)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){o(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){a.has(e.path)?o(t=>{let n=new Set(t);return n.delete(e.path),n}):(o(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)),o(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),i(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{d({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`&&(o(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),i(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{d({title:`Error`,description:`Failed to rename "${t.name}"`,variant:`destructive`})}}function G(e){O(null),a.has(e)||(o(t=>new Set(t).add(e)),L(e)),M({dirPath:e,type:`file`})}function K(e){O(null),a.has(e)||(o(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{d({title:`Error`,description:`Failed to create ${r} "${t}"`,variant:`destructive`})}}function J(){M(null)}let Y=r.get(``)??[],X=s.has(``),Z=j?.dirPath===``?(0,A.jsx)(te,{defaultValue:``,level:0,basePadding:j.type===`folder`?10:22,icon:j.type===`folder`?(0,A.jsx)(l,{className:`h-4 w-4 flex-shrink-0`}):(0,A.jsx)(c,{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)(u,{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:a,loadedDirs:r,loadingPaths:s,renamingPath:ee,newItemIn:j,onToggleFolder:z,onSelectFile:n,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{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{Ti as t,br as n,jn as r,li as i,ra as a}from"./dialogs-config-Ofxg1Bn0.js";import{g as o}from"./react-vendor-Bi5X_3XM.js";import{a as s}from"./store-BuY90jLM.js";import{n as c}from"./utils-7CkwsQJ0.js";import{b as l,l as u}from"./index-BOioHxIi.js";import"./monaco-CgzMkQ7t.js";import{a as d,c as f,i as p}from"./api-BfUK32d1.js";var m=e(a(),1),h=n(),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:n}=s(),{resolvedTheme:a}=c(),g=n.selectedThreadId,[_,b]=(0,m.useState)(``),[x,S]=(0,m.useState)(``),[C,w]=(0,m.useState)(!1),[T,E]=(0,m.useState)(!1);async function D(){if(!(!g||!e)){E(!0);try{await f(g,e.path,_),S(_),l({title:`Saved`,description:`${e.name} saved successfully.`})}catch(e){l({title:`Error`,description:e instanceof Error?e.message:`Failed to save file`,variant:`destructive`})}finally{E(!1)}}}let O=(0,m.useCallback)(async e=>{if(g){w(!0);try{let t=await p(g,e.path);b(t.content),S(t.content)}catch(e){l({title:`Error`,description:e instanceof Error?e.message:`Failed to load file`,variant:`destructive`})}finally{w(!1)}}},[g]);return(0,m.useEffect)(()=>{e&&g?v(e.path)||O(e):(b(``),S(``))},[e,g,O]),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 D(),disabled:T||!_||_===x,children:[T?(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:C?(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:_,onChange:e=>b(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)(t,{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)(t,{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{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{Ti as t,br as n,jn as r,li as i,ra as a}from"./dialogs-config-Ofxg1Bn0.js";import{g as o}from"./react-vendor-9yNfIRPs.js";import{a as s}from"./store-BuY90jLM.js";import{n as c}from"./utils-7CkwsQJ0.js";import{b as l,l as u}from"./index-DIWoaAFy.js";import"./monaco-CgzMkQ7t.js";import{a as d,c as f,i as p}from"./api-BfUK32d1.js";var m=e(a(),1),h=n(),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:n}=s(),{resolvedTheme:a}=c(),g=n.selectedThreadId,[_,b]=(0,m.useState)(``),[x,S]=(0,m.useState)(``),[C,w]=(0,m.useState)(!1),[T,E]=(0,m.useState)(!1);async function D(){if(!(!g||!e)){E(!0);try{await f(g,e.path,_),S(_),l({title:`Saved`,description:`${e.name} saved successfully.`})}catch(e){l({title:`Error`,description:e instanceof Error?e.message:`Failed to save file`,variant:`destructive`})}finally{E(!1)}}}let O=(0,m.useCallback)(async e=>{if(g){w(!0);try{let t=await p(g,e.path);b(t.content),S(t.content)}catch(e){l({title:`Error`,description:e instanceof Error?e.message:`Failed to load file`,variant:`destructive`})}finally{w(!1)}}},[g]);return(0,m.useEffect)(()=>{e&&g?v(e.path)||O(e):(b(``),S(``))},[e,g,O]),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 D(),disabled:T||!_||_===x,children:[T?(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:C?(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:_,onChange:e=>b(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)(t,{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)(t,{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{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{Cr as t,Dn as n,En as r,Er as i,Gi as a,Ki as o,On as s,Pi as c,Ri as l,Sr as u,Ui as d,Vn as f,Wi as p,_r as m,a as h,ar as g,br as _,dr as v,fr as y,gr as b,hr as x,i as S,ir as C,jn as w,lr as T,mr as E,n as D,na as O,nr as k,nt as A,or as j,qi as M,r as N,ra as P,rr as ee,sr as te,ta as ne,u as re,vr as F,yr as ie}from"./dialogs-config-Ofxg1Bn0.js";var ae=[`top`,`right`,`bottom`,`left`],I=Math.min,L=Math.max,oe=Math.round,se=Math.floor,R=e=>({x:e,y:e}),ce={left:`right`,right:`left`,bottom:`top`,top:`bottom`},le={start:`end`,end:`start`};function ue(e,t,n){return L(e,I(t,n))}function z(e,t){return typeof e==`function`?e(t):e}function B(e){return e.split(`-`)[0]}function de(e){return e.split(`-`)[1]}function fe(e){return e===`x`?`y`:`x`}function pe(e){return e===`y`?`height`:`width`}var me=new Set([`top`,`bottom`]);function V(e){return me.has(B(e))?`y`:`x`}function he(e){return fe(V(e))}function ge(e,t,n){n===void 0&&(n=!1);let r=de(e),i=he(e),a=pe(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Te(o)),[o,Te(o)]}function _e(e){let t=Te(e);return[ve(e),t,ve(t)]}function ve(e){return e.replace(/start|end/g,e=>le[e])}var ye=[`left`,`right`],be=[`right`,`left`],xe=[`top`,`bottom`],Se=[`bottom`,`top`];function Ce(e,t,n){switch(e){case`top`:case`bottom`:return n?t?be:ye:t?ye:be;case`left`:case`right`:return t?xe:Se;default:return[]}}function we(e,t,n,r){let i=de(e),a=Ce(B(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(ve)))),a}function Te(e){return e.replace(/left|right|bottom|top/g,e=>ce[e])}function Ee(e){return{top:0,right:0,bottom:0,left:0,...e}}function De(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Ee(e)}function Oe(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 ke(e,t,n){let{reference:r,floating:i}=e,a=V(t),o=he(t),s=pe(o),c=B(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(de(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 Ae(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}=z(t,e),p=De(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Oe(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=Oe(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 je=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}=ke(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??Ae},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}=ke(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}},Me=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}=z(e,t)||{};if(l==null)return{};let d=De(u),f={x:n,y:r},p=he(i),m=pe(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=I(d[_],T),D=I(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=ue(O,A,k),M=!c.arrow&&de(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}}}),Ne=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}=z(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=B(r),_=V(o),v=B(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Te(o)]:_e(o)),x=p!==`none`;!d&&x&&b.push(...we(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=ge(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`&&_!==V(t))||T.every(e=>V(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=V(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 Pe(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Fe(e){return ae.some(t=>e[t]>=0)}var Ie=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=z(e,t);switch(i){case`referenceHidden`:{let e=Pe(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Fe(e)}}}case`escaped`:{let e=Pe(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Fe(e)}}}default:return{}}}}},Le=new Set([`left`,`top`]);async function Re(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=B(n),s=de(n),c=V(n)===`y`,l=Le.has(o)?-1:1,u=a&&c?-1:1,d=z(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 ze=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 Re(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}}}}},Be=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}=z(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=V(B(i)),p=fe(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=ue(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=ue(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}}}}}},Ve=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}=z(e,t),u={x:n,y:r},d=V(i),f=fe(d),p=u[f],m=u[d],h=z(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=Le.has(B(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}}}},He=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}=z(e,t),u=await o.detectOverflow(t,l),d=B(i),f=de(i),p=V(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=I(h-u[g],v),x=I(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=L(u.left,0),t=L(u.right,0),n=L(u.top,0),r=L(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:L(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:L(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 Ue(){return typeof window<`u`}function We(e){return Ge(e)?(e.nodeName||``).toLowerCase():`#document`}function H(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function U(e){return((Ge(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Ge(e){return Ue()?e instanceof Node||e instanceof H(e).Node:!1}function W(e){return Ue()?e instanceof Element||e instanceof H(e).Element:!1}function G(e){return Ue()?e instanceof HTMLElement||e instanceof H(e).HTMLElement:!1}function Ke(e){return!Ue()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof H(e).ShadowRoot}var qe=new Set([`inline`,`contents`]);function Je(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=K(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!qe.has(i)}var Ye=new Set([`table`,`td`,`th`]);function Xe(e){return Ye.has(We(e))}var Ze=[`:popover-open`,`:modal`];function Qe(e){return Ze.some(t=>{try{return e.matches(t)}catch{return!1}})}var $e=[`transform`,`translate`,`scale`,`rotate`,`perspective`],et=[`transform`,`translate`,`scale`,`rotate`,`perspective`,`filter`],tt=[`paint`,`layout`,`strict`,`content`];function nt(e){let t=it(),n=W(e)?K(e):e;return $e.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)||et.some(e=>(n.willChange||``).includes(e))||tt.some(e=>(n.contain||``).includes(e))}function rt(e){let t=q(e);for(;G(t)&&!ot(t);){if(nt(t))return t;if(Qe(t))return null;t=q(t)}return null}function it(){return typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter`,`none`)}var at=new Set([`html`,`body`,`#document`]);function ot(e){return at.has(We(e))}function K(e){return H(e).getComputedStyle(e)}function st(e){return W(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function q(e){if(We(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Ke(e)&&e.host||U(e);return Ke(t)?t.host:t}function ct(e){let t=q(e);return ot(t)?e.ownerDocument?e.ownerDocument.body:e.body:G(t)&&Je(t)?t:ct(t)}function lt(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=ct(e),i=r===e.ownerDocument?.body,a=H(r);if(i){let e=ut(a);return t.concat(a,a.visualViewport||[],Je(r)?r:[],e&&n?lt(e):[])}return t.concat(r,lt(r,[],n))}function ut(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function dt(e){let t=K(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=G(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=oe(n)!==a||oe(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function ft(e){return W(e)?e:e.contextElement}function pt(e){let t=ft(e);if(!G(t))return R(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=dt(t),o=(a?oe(n.width):n.width)/r,s=(a?oe(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var mt=R(0);function ht(e){let t=H(e);return!it()||!t.visualViewport?mt:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function gt(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==H(e)?!1:t}function _t(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=ft(e),o=R(1);t&&(r?W(r)&&(o=pt(r)):o=pt(e));let s=gt(a,n,r)?ht(a):R(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=H(a),t=r&&W(r)?H(r):r,n=e,i=ut(n);for(;i&&r&&t!==n;){let e=pt(i),t=i.getBoundingClientRect(),r=K(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=H(i),i=ut(n)}}return Oe({width:u,height:d,x:c,y:l})}function vt(e,t){let n=st(e).scrollLeft;return t?t.left+n:_t(U(e)).left+n}function yt(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-vt(e,n),y:n.top+t.scrollTop}}function bt(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=U(r),s=t?Qe(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=R(1),u=R(0),d=G(r);if((d||!d&&!a)&&((We(r)!==`body`||Je(o))&&(c=st(r)),G(r))){let e=_t(r);l=pt(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?yt(o,c):R(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 xt(e){return Array.from(e.getClientRects())}function St(e){let t=U(e),n=st(e),r=e.ownerDocument.body,i=L(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=L(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+vt(e),s=-n.scrollTop;return K(r).direction===`rtl`&&(o+=L(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var Ct=25;function wt(e,t){let n=H(e),r=U(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=it();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=vt(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<=Ct&&(a-=o)}else l<=Ct&&(a+=l);return{width:a,height:o,x:s,y:c}}var Tt=new Set([`absolute`,`fixed`]);function Et(e,t){let n=_t(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=G(e)?pt(e):R(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Dt(e,t,n){let r;if(t===`viewport`)r=wt(e,n);else if(t===`document`)r=St(U(e));else if(W(t))r=Et(t,n);else{let n=ht(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Oe(r)}function Ot(e,t){let n=q(e);return n===t||!W(n)||ot(n)?!1:K(n).position===`fixed`||Ot(n,t)}function kt(e,t){let n=t.get(e);if(n)return n;let r=lt(e,[],!1).filter(e=>W(e)&&We(e)!==`body`),i=null,a=K(e).position===`fixed`,o=a?q(e):e;for(;W(o)&&!ot(o);){let t=K(o),n=nt(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&Tt.has(i.position)||Je(o)&&!n&&Ot(e,o))?r=r.filter(e=>e!==o):i=t,o=q(o)}return t.set(e,r),r}function At(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Qe(t)?[]:kt(t,this._c):[].concat(n),r],o=a[0],s=a.reduce((e,n)=>{let r=Dt(t,n,i);return e.top=L(r.top,e.top),e.right=I(r.right,e.right),e.bottom=I(r.bottom,e.bottom),e.left=L(r.left,e.left),e},Dt(t,o,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function jt(e){let{width:t,height:n}=dt(e);return{width:t,height:n}}function Mt(e,t,n){let r=G(t),i=U(t),a=n===`fixed`,o=_t(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=R(0);function l(){c.x=vt(i)}if(r||!r&&!a)if((We(t)!==`body`||Je(i))&&(s=st(t)),r){let e=_t(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?yt(i,s):R(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 Nt(e){return K(e).position===`static`}function Pt(e,t){if(!G(e)||K(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return U(e)===n&&(n=n.ownerDocument.body),n}function Ft(e,t){let n=H(e);if(Qe(e))return n;if(!G(e)){let t=q(e);for(;t&&!ot(t);){if(W(t)&&!Nt(t))return t;t=q(t)}return n}let r=Pt(e,t);for(;r&&Xe(r)&&Nt(r);)r=Pt(r,t);return r&&ot(r)&&Nt(r)&&!nt(r)?n:r||rt(e)||n}var It=async function(e){let t=this.getOffsetParent||Ft,n=this.getDimensions,r=await n(e.floating);return{reference:Mt(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Lt(e){return K(e).direction===`rtl`}var Rt={convertOffsetParentRelativeRectToViewportRelativeRect:bt,getDocumentElement:U,getClippingRect:At,getOffsetParent:Ft,getElementRects:It,getClientRects:xt,getDimensions:jt,getScale:pt,isElement:W,isRTL:Lt};function zt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Bt(e,t){let n=null,r,i=U(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=se(d),h=se(i.clientWidth-(u+f)),g=se(i.clientHeight-(d+p)),_=se(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:L(0,I(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&&!zt(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 Vt(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=ft(e),u=i||a?[...l?lt(l):[],...lt(t)]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Bt(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?_t(e):null;c&&g();function g(){let t=_t(e);h&&!zt(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 Ht=ze,Ut=Be,Wt=Ne,Gt=He,Kt=Ie,qt=Me,Jt=Ve,Yt=(e,t,n)=>{let r=new Map,i={platform:Rt,...n},a={...i.platform,_c:r};return je(e,t,{...i,platform:a})},J=e(P(),1),Xt=e(O(),1),Zt=typeof document<`u`?J.useLayoutEffect:function(){};function Qt(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(!Qt(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)&&!Qt(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function $t(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function en(e,t){let n=$t(e);return Math.round(t*n)/n}function tn(e){let t=J.useRef(e);return Zt(()=>{t.current=e}),t}function nn(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]=J.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=J.useState(r);Qt(f,r)||p(r);let[m,h]=J.useState(null),[g,_]=J.useState(null),v=J.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=J.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=J.useRef(null),C=J.useRef(null),w=J.useRef(u),T=c!=null,E=tn(c),D=tn(i),O=tn(l),k=J.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),Yt(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!Qt(w.current,t)&&(w.current=t,Xt.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);Zt(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=J.useRef(!1);Zt(()=>(A.current=!0,()=>{A.current=!1}),[]),Zt(()=>{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=J.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=J.useMemo(()=>({reference:b,floating:x}),[b,x]),N=J.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=en(M.floating,u.x),r=en(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...$t(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return J.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var rn=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?{}:qt({element:r.current,padding:i}).fn(n):r?qt({element:r,padding:i}).fn(n):{}}}},an=(e,t)=>({...Ht(e),options:[e,t]}),on=(e,t)=>({...Ut(e),options:[e,t]}),sn=(e,t)=>({...Jt(e),options:[e,t]}),cn=(e,t)=>({...Wt(e),options:[e,t]}),ln=(e,t)=>({...Gt(e),options:[e,t]}),un=(e,t)=>({...Kt(e),options:[e,t]}),dn=(e,t)=>({...rn(e),options:[e,t]}),Y=_(),fn=`Arrow`,pn=J.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,Y.jsx)(y.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,Y.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});pn.displayName=fn;var mn=pn;function hn(e){let[t,n]=J.useState(void 0);return F(()=>{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 gn=`Popper`,[_n,vn]=ie(gn),[yn,bn]=_n(gn),xn=e=>{let{__scopePopper:t,children:n}=e,[r,i]=J.useState(null);return(0,Y.jsx)(yn,{scope:t,anchor:r,onAnchorChange:i,children:n})};xn.displayName=gn;var Sn=`PopperAnchor`,Cn=J.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=bn(Sn,n),o=J.useRef(null),s=u(t,o),c=J.useRef(null);return J.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,Y.jsx)(y.div,{...i,ref:s})});Cn.displayName=Sn;var wn=`PopperContent`,[Tn,En]=_n(wn),Dn=J.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:l=[],collisionPadding:d=0,sticky:f=`partial`,hideWhenDetached:p=!1,updatePositionStrategy:m=`optimized`,onPlaced:h,...g}=e,_=bn(wn,n),[b,x]=J.useState(null),S=u(t,e=>x(e)),[C,w]=J.useState(null),T=hn(C),E=T?.width??0,D=T?.height??0,O=r+(a===`center`?``:`-`+a),k=typeof d==`number`?d:{top:0,right:0,bottom:0,left:0,...d},A=Array.isArray(l)?l:[l],j=A.length>0,M={padding:k,boundary:A.filter(jn),altBoundary:j},{refs:N,floatingStyles:P,placement:ee,isPositioned:te,middlewareData:ne}=nn({strategy:`fixed`,placement:O,whileElementsMounted:(...e)=>Vt(...e,{animationFrame:m===`always`}),elements:{reference:_.anchor},middleware:[an({mainAxis:i+D,alignmentAxis:o}),c&&on({mainAxis:!0,crossAxis:!1,limiter:f===`partial`?sn():void 0,...M}),c&&cn({...M}),ln({...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`)}}),C&&dn({element:C,padding:s}),Mn({arrowWidth:E,arrowHeight:D}),p&&un({strategy:`referenceHidden`,...M})]}),[re,ie]=Nn(ee),ae=v(h);F(()=>{te&&ae?.()},[te,ae]);let I=ne.arrow?.x,L=ne.arrow?.y,oe=ne.arrow?.centerOffset!==0,[se,R]=J.useState();return F(()=>{b&&R(window.getComputedStyle(b).zIndex)},[b]),(0,Y.jsx)(`div`,{ref:N.setFloating,"data-radix-popper-content-wrapper":``,style:{...P,transform:te?P.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:se,"--radix-popper-transform-origin":[ne.transformOrigin?.x,ne.transformOrigin?.y].join(` `),...ne.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,Y.jsx)(Tn,{scope:n,placedSide:re,onArrowChange:w,arrowX:I,arrowY:L,shouldHideArrow:oe,children:(0,Y.jsx)(y.div,{"data-side":re,"data-align":ie,...g,ref:S,style:{...g.style,animation:te?void 0:`none`}})})})});Dn.displayName=wn;var On=`PopperArrow`,kn={top:`bottom`,right:`left`,bottom:`top`,left:`right`},An=J.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=En(On,n),a=kn[i.placedSide];return(0,Y.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,Y.jsx)(mn,{...r,ref:t,style:{...r.style,display:`block`}})})});An.displayName=On;function jn(e){return e!==null}var Mn=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]=Nn(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 Nn(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var Pn=xn,Fn=Cn,In=Dn,Ln=An,Rn=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`}),zn=`VisuallyHidden`,Bn=J.forwardRef((e,t)=>(0,Y.jsx)(y.span,{...e,ref:t,style:{...Rn,...e.style}}));Bn.displayName=zn;var Vn=Bn,[Hn,Un]=ie(`Tooltip`,[vn]),Wn=vn(),Gn=`TooltipProvider`,Kn=700,qn=`tooltip.open`,[Jn,Yn]=Hn(Gn),Xn=e=>{let{__scopeTooltip:t,delayDuration:n=Kn,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=J.useRef(!0),s=J.useRef(!1),c=J.useRef(0);return J.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,Y.jsx)(Jn,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:J.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:J.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:J.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};Xn.displayName=Gn;var Zn=`Tooltip`,[Qn,$n]=Hn(Zn),er=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Yn(Zn,e.__scopeTooltip),l=Wn(t),[u,d]=J.useState(null),f=m(),p=J.useRef(0),h=o??c.disableHoverableContent,g=s??c.delayDuration,_=J.useRef(!1),[v,y]=b({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(qn))):c.onClose(),a?.(e)},caller:Zn}),x=J.useMemo(()=>v?_.current?`delayed-open`:`instant-open`:`closed`,[v]),S=J.useCallback(()=>{window.clearTimeout(p.current),p.current=0,_.current=!1,y(!0)},[y]),C=J.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y(!1)},[y]),w=J.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{_.current=!0,y(!0),p.current=0},g)},[g,y]);return J.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,Y.jsx)(Pn,{...l,children:(0,Y.jsx)(Qn,{scope:t,contentId:f,open:v,stateAttribute:x,trigger:u,onTriggerChange:d,onTriggerEnter:J.useCallback(()=>{c.isOpenDelayedRef.current?w():S()},[c.isOpenDelayedRef,w,S]),onTriggerLeave:J.useCallback(()=>{h?C():(window.clearTimeout(p.current),p.current=0)},[C,h]),onOpen:S,onClose:C,disableHoverableContent:h,children:n})})};er.displayName=Zn;var tr=`TooltipTrigger`,nr=J.forwardRef((e,n)=>{let{__scopeTooltip:r,...i}=e,a=$n(tr,r),o=Yn(tr,r),s=Wn(r),c=u(n,J.useRef(null),a.onTriggerChange),l=J.useRef(!1),d=J.useRef(!1),f=J.useCallback(()=>l.current=!1,[]);return J.useEffect(()=>()=>document.removeEventListener(`pointerup`,f),[f]),(0,Y.jsx)(Fn,{asChild:!0,...s,children:(0,Y.jsx)(y.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...i,ref:c,onPointerMove:t(e.onPointerMove,e=>{e.pointerType!==`touch`&&!d.current&&!o.isPointerInTransitRef.current&&(a.onTriggerEnter(),d.current=!0)}),onPointerLeave:t(e.onPointerLeave,()=>{a.onTriggerLeave(),d.current=!1}),onPointerDown:t(e.onPointerDown,()=>{a.open&&a.onClose(),l.current=!0,document.addEventListener(`pointerup`,f,{once:!0})}),onFocus:t(e.onFocus,()=>{l.current||a.onOpen()}),onBlur:t(e.onBlur,a.onClose),onClick:t(e.onClick,a.onClose)})})});nr.displayName=tr;var rr=`TooltipPortal`,[ir,ar]=Hn(rr,{forceMount:void 0}),or=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=$n(rr,t);return(0,Y.jsx)(ir,{scope:t,forceMount:n,children:(0,Y.jsx)(g,{present:n||a.open,children:(0,Y.jsx)(j,{asChild:!0,container:i,children:r})})})};or.displayName=rr;var sr=`TooltipContent`,cr=J.forwardRef((e,t)=>{let n=ar(sr,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=$n(sr,e.__scopeTooltip);return(0,Y.jsx)(g,{present:r||o.open,children:o.disableHoverableContent?(0,Y.jsx)(pr,{side:i,...a,ref:t}):(0,Y.jsx)(lr,{side:i,...a,ref:t})})}),lr=J.forwardRef((e,t)=>{let n=$n(sr,e.__scopeTooltip),r=Yn(sr,e.__scopeTooltip),i=J.useRef(null),a=u(t,i),[o,s]=J.useState(null),{trigger:c,onClose:l}=n,d=i.current,{onPointerInTransitChange:f}=r,p=J.useCallback(()=>{s(null),f(!1)},[f]),m=J.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=_r(r,gr(r,n.getBoundingClientRect())),a=vr(t.getBoundingClientRect());s(br([...i,...a])),f(!0)},[f]);return J.useEffect(()=>()=>p(),[p]),J.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]),J.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=!yr(n,o);r?p():i&&(p(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,d,o,l,p]),(0,Y.jsx)(pr,{...e,ref:a})}),[ur,dr]=Hn(Zn,{isInside:!1}),fr=x(`TooltipContent`),pr=J.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=$n(sr,n),l=Wn(n),{onClose:u}=c;return J.useEffect(()=>(document.addEventListener(qn,u),()=>document.removeEventListener(qn,u)),[u]),J.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,Y.jsx)(T,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,Y.jsxs)(In,{"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,Y.jsx)(fr,{children:r}),(0,Y.jsx)(ur,{scope:n,isInside:!0,children:(0,Y.jsx)(Vn,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});cr.displayName=sr;var mr=`TooltipArrow`,hr=J.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Wn(n);return dr(mr,n).isInside?null:(0,Y.jsx)(Ln,{...i,...r,ref:t})});hr.displayName=mr;function gr(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 _r(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 vr(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 yr(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 br(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),xr(t)}function xr(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 Sr=Xn,Cr=er,wr=nr,Tr=cr,X=ne(),Er=Sr,Dr=Cr,Or=wr,kr=J.forwardRef((e,t)=>{let n=(0,X.c)(11),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:r,sideOffset:a,...i}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o=a===void 0?4:a,s;n[4]===r?s=n[5]:(s=f(`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,Y.jsx)(Tr,{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});kr.displayName=Tr.displayName;function Ar(e){let t=J.useRef({value:e,previous:e});return J.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var jr=J.forwardRef((e,t)=>{let n=(0,X.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=f(`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,Y.jsx)(`div`,{className:`relative w-full overflow-auto`,children:(0,Y.jsx)(`table`,{ref:t,className:a,...i})}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});jr.displayName=`Table`;var Mr=J.forwardRef((e,t)=>{let n=(0,X.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=f(`[&_tr]:border-b`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,Y.jsx)(`thead`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Mr.displayName=`TableHeader`;var Nr=J.forwardRef((e,t)=>{let n=(0,X.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=f(`[&_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,Y.jsx)(`tbody`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Nr.displayName=`TableBody`;var Pr=J.forwardRef((e,t)=>{let n=(0,X.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=f(`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,Y.jsx)(`tfoot`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Pr.displayName=`TableFooter`;var Fr=J.forwardRef((e,t)=>{let n=(0,X.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=f(`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,Y.jsx)(`tr`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Fr.displayName=`TableRow`;var Z=J.forwardRef((e,t)=>{let n=(0,X.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=f(`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,Y.jsx)(`th`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Z.displayName=`TableHead`;var Q=J.forwardRef((e,t)=>{let n=(0,X.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=f(`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,Y.jsx)(`td`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Q.displayName=`TableCell`;var Ir=J.forwardRef((e,t)=>{let n=(0,X.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=f(`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,Y.jsx)(`caption`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Ir.displayName=`TableCaption`;var Lr=[` `,`Enter`,`ArrowUp`,`ArrowDown`],Rr=[` `,`Enter`],zr=`Select`,[Br,Vr,Hr]=re(zr),[Ur,Wr]=ie(zr,[Hr,vn]),Gr=vn(),[Kr,qr]=Ur(zr),[Jr,Yr]=Ur(zr),Xr=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:c,onValueChange:l,dir:u,name:d,autoComplete:f,disabled:p,required:h,form:g}=e,_=Gr(t),[v,y]=J.useState(null),[x,S]=J.useState(null),[C,w]=J.useState(!1),T=s(u),[E,D]=b({prop:r,defaultProp:i??!1,onChange:a,caller:zr}),[O,k]=b({prop:o,defaultProp:c,onChange:l,caller:zr}),A=J.useRef(null),j=v?g||!!v.closest(`form`):!0,[M,N]=J.useState(new Set),P=Array.from(M).map(e=>e.props.value).join(`;`);return(0,Y.jsx)(Pn,{..._,children:(0,Y.jsxs)(Kr,{required:h,scope:t,trigger:v,onTriggerChange:y,valueNode:x,onValueNodeChange:S,valueNodeHasChildren:C,onValueNodeHasChildrenChange:w,contentId:m(),value:O,onValueChange:k,open:E,onOpenChange:D,dir:T,triggerPointerDownPosRef:A,disabled:p,children:[(0,Y.jsx)(Br.Provider,{scope:t,children:(0,Y.jsx)(Jr,{scope:e.__scopeSelect,onNativeOptionAdd:J.useCallback(e=>{N(t=>new Set(t).add(e))},[]),onNativeOptionRemove:J.useCallback(e=>{N(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),j?(0,Y.jsxs)(Wi,{"aria-hidden":!0,required:h,tabIndex:-1,name:d,autoComplete:f,value:O,onChange:e=>k(e.target.value),disabled:p,form:g,children:[O===void 0?(0,Y.jsx)(`option`,{value:``}):null,Array.from(M)]},P):null]})})};Xr.displayName=zr;var Zr=`SelectTrigger`,Qr=J.forwardRef((e,n)=>{let{__scopeSelect:r,disabled:i=!1,...a}=e,o=Gr(r),s=qr(Zr,r),c=s.disabled||i,l=u(n,s.onTriggerChange),d=Vr(r),f=J.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,Y.jsx)(Fn,{asChild:!0,...o,children:(0,Y.jsx)(y.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,...a,ref:l,onClick:t(a.onClick,e=>{e.currentTarget.focus(),f.current!==`mouse`&&g(e)}),onPointerDown:t(a.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:t(a.onKeyDown,e=>{let t=p.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&m(e.key),!(t&&e.key===` `)&&Lr.includes(e.key)&&(g(),e.preventDefault())})})})});Qr.displayName=Zr;var $r=`SelectValue`,ei=J.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=qr($r,n),{onValueNodeHasChildrenChange:l}=c,d=a!==void 0,f=u(t,c.onValueNodeChange);return F(()=>{l(d)},[l,d]),(0,Y.jsx)(y.span,{...s,ref:f,style:{pointerEvents:`none`},children:Gi(c.value)?(0,Y.jsx)(Y.Fragment,{children:o}):a})});ei.displayName=$r;var ti=`SelectIcon`,ni=J.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,Y.jsx)(y.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});ni.displayName=ti;var ri=`SelectPortal`,ii=e=>(0,Y.jsx)(j,{asChild:!0,...e});ii.displayName=ri;var ai=`SelectContent`,oi=J.forwardRef((e,t)=>{let n=qr(ai,e.__scopeSelect),[r,i]=J.useState();if(F(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?Xt.createPortal((0,Y.jsx)(si,{scope:e.__scopeSelect,children:(0,Y.jsx)(Br.Slot,{scope:e.__scopeSelect,children:(0,Y.jsx)(`div`,{children:e.children})})}),t):null}return(0,Y.jsx)(di,{...e,ref:t})});oi.displayName=ai;var $=10,[si,ci]=Ur(ai),li=`SelectContentImpl`,ui=E(`SelectContent.RemoveScroll`),di=J.forwardRef((e,n)=>{let{__scopeSelect:r,position:i=`item-aligned`,onCloseAutoFocus:a,onEscapeKeyDown:o,onPointerDownOutside:s,side:c,sideOffset:l,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:_,avoidCollisions:v,...y}=e,b=qr(ai,r),[x,S]=J.useState(null),[w,E]=J.useState(null),D=u(n,e=>S(e)),[O,A]=J.useState(null),[j,M]=J.useState(null),N=Vr(r),[P,ne]=J.useState(!1),re=J.useRef(!1);J.useEffect(()=>{if(x)return k(x)},[x]),C();let F=J.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&&w&&(w.scrollTop=0),n===r&&w&&(w.scrollTop=w.scrollHeight),n?.focus(),document.activeElement!==i))return},[N,w]),ie=J.useCallback(()=>F([O,x]),[F,O,x]);J.useEffect(()=>{P&&ie()},[P,ie]);let{onOpenChange:ae,triggerPointerDownPosRef:I}=b;J.useEffect(()=>{if(x){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(I.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(I.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():x.contains(n.target)||ae(!1),document.removeEventListener(`pointermove`,t),I.current=null};return I.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[x,ae,I]),J.useEffect(()=>{let e=()=>ae(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[ae]);let[L,oe]=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())}),se=J.useCallback((e,t,n)=>{let r=!re.current&&!n;(b.value!==void 0&&b.value===t||r)&&(A(e),r&&(re.current=!0))},[b.value]),R=J.useCallback(()=>x?.focus(),[x]),ce=J.useCallback((e,t,n)=>{let r=!re.current&&!n;(b.value!==void 0&&b.value===t||r)&&M(e)},[b.value]),le=i===`popper`?hi:pi,ue=le===hi?{side:c,sideOffset:l,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:_,avoidCollisions:v}:{};return(0,Y.jsx)(si,{scope:r,content:x,viewport:w,onViewportChange:E,itemRefCallback:se,selectedItem:O,onItemLeave:R,itemTextRefCallback:ce,focusSelectedItem:ie,selectedItemText:j,position:i,isPositioned:P,searchRef:L,children:(0,Y.jsx)(ee,{as:ui,allowPinchZoom:!0,children:(0,Y.jsx)(te,{asChild:!0,trapped:b.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:t(a,e=>{b.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,Y.jsx)(T,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:(0,Y.jsx)(le,{role:`listbox`,id:b.contentId,"data-state":b.open?`open`:`closed`,dir:b.dir,onContextMenu:e=>e.preventDefault(),...y,...ue,onPlaced:()=>ne(!0),ref:D,style:{display:`flex`,flexDirection:`column`,outline:`none`,...y.style},onKeyDown:t(y.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&oe(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(()=>F(t)),e.preventDefault()}})})})})})})});di.displayName=li;var fi=`SelectItemAlignedPosition`,pi=J.forwardRef((e,t)=>{let{__scopeSelect:r,onPlaced:i,...a}=e,o=qr(ai,r),s=ci(ai,r),[c,l]=J.useState(null),[d,f]=J.useState(null),p=u(t,e=>f(e)),m=Vr(r),h=J.useRef(!1),g=J.useRef(!0),{viewport:_,selectedItem:v,selectedItemText:b,focusSelectedItem:x}=s,S=J.useCallback(()=>{if(o.trigger&&o.valueNode&&c&&d&&_&&v&&b){let e=o.trigger.getBoundingClientRect(),t=d.getBoundingClientRect(),r=o.valueNode.getBoundingClientRect(),a=b.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),y=parseInt(f.borderBottomWidth,10),x=parseInt(f.paddingBottom,10),S=p+g+u+x+y,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+y);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,b,o.dir,i]);F(()=>S(),[S]);let[C,w]=J.useState();return F(()=>{d&&w(window.getComputedStyle(d).zIndex)},[d]),(0,Y.jsx)(gi,{scope:r,contentWrapper:c,shouldExpandOnScrollRef:h,onScrollButtonChange:J.useCallback(e=>{e&&g.current===!0&&(S(),x?.(),g.current=!1)},[S,x]),children:(0,Y.jsx)(`div`,{ref:l,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:C},children:(0,Y.jsx)(y.div,{...a,ref:p,style:{boxSizing:`border-box`,maxHeight:`100%`,...a.style}})})})});pi.displayName=fi;var mi=`SelectPopperPosition`,hi=J.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=$,...a}=e,o=Gr(n);return(0,Y.jsx)(In,{...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]=Ur(ai,{}),vi=`SelectViewport`,yi=J.forwardRef((e,n)=>{let{__scopeSelect:r,nonce:i,...a}=e,o=ci(vi,r),s=_i(vi,r),c=u(n,o.onViewportChange),l=J.useRef(0);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.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:i}),(0,Y.jsx)(Br.Slot,{scope:r,children:(0,Y.jsx)(y.div,{"data-radix-select-viewport":``,role:`presentation`,...a,ref:c,style:{position:`relative`,flex:1,overflow:`hidden auto`,...a.style},onScroll:t(a.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=s;if(r?.current&&n){let e=Math.abs(l.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`)}}}l.current=t.scrollTop})})})]})});yi.displayName=vi;var bi=`SelectGroup`,[xi,Si]=Ur(bi),Ci=J.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=m();return(0,Y.jsx)(xi,{scope:n,id:i,children:(0,Y.jsx)(y.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Ci.displayName=bi;var wi=`SelectLabel`,Ti=J.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Si(wi,n);return(0,Y.jsx)(y.div,{id:i.id,...r,ref:t})});Ti.displayName=wi;var Ei=`SelectItem`,[Di,Oi]=Ur(Ei),ki=J.forwardRef((e,n)=>{let{__scopeSelect:r,value:i,disabled:a=!1,textValue:o,...s}=e,c=qr(Ei,r),l=ci(Ei,r),d=c.value===i,[f,p]=J.useState(o??``),[h,g]=J.useState(!1),_=u(n,e=>l.itemRefCallback?.(e,i,a)),v=m(),b=J.useRef(`touch`),x=()=>{a||(c.onValueChange(i),c.onOpenChange(!1))};if(i===``)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,Y.jsx)(Di,{scope:r,value:i,disabled:a,textId:v,isSelected:d,onItemTextChange:J.useCallback(e=>{p(t=>t||(e?.textContent??``).trim())},[]),children:(0,Y.jsx)(Br.ItemSlot,{scope:r,value:i,disabled:a,textValue:f,children:(0,Y.jsx)(y.div,{role:`option`,"aria-labelledby":v,"data-highlighted":h?``:void 0,"aria-selected":d&&h,"data-state":d?`checked`:`unchecked`,"aria-disabled":a||void 0,"data-disabled":a?``:void 0,tabIndex:a?void 0:-1,...s,ref:_,onFocus:t(s.onFocus,()=>g(!0)),onBlur:t(s.onBlur,()=>g(!1)),onClick:t(s.onClick,()=>{b.current!==`mouse`&&x()}),onPointerUp:t(s.onPointerUp,()=>{b.current===`mouse`&&x()}),onPointerDown:t(s.onPointerDown,e=>{b.current=e.pointerType}),onPointerMove:t(s.onPointerMove,e=>{b.current=e.pointerType,a?l.onItemLeave?.():b.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:t(s.onPointerLeave,e=>{e.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:t(s.onKeyDown,e=>{l.searchRef?.current!==``&&e.key===` `||(Rr.includes(e.key)&&x(),e.key===` `&&e.preventDefault())})})})})});ki.displayName=Ei;var Ai=`SelectItemText`,ji=J.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=qr(Ai,n),s=ci(Ai,n),c=Oi(Ai,n),l=Yr(Ai,n),[d,f]=J.useState(null),p=u(t,e=>f(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),m=d?.textContent,h=J.useMemo(()=>(0,Y.jsx)(`option`,{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=l;return F(()=>(g(h),()=>_(h)),[g,_,h]),(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(y.span,{id:c.textId,...a,ref:p}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Xt.createPortal(a.children,o.valueNode):null]})});ji.displayName=Ai;var Mi=`SelectItemIndicator`,Ni=J.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return Oi(Mi,n).isSelected?(0,Y.jsx)(y.span,{"aria-hidden":!0,...r,ref:t}):null});Ni.displayName=Mi;var Pi=`SelectScrollUpButton`,Fi=J.forwardRef((e,t)=>{let n=ci(Pi,e.__scopeSelect),r=_i(Pi,e.__scopeSelect),[i,a]=J.useState(!1),o=u(t,r.onScrollButtonChange);return F(()=>{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,Y.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=J.forwardRef((e,t)=>{let n=ci(Ii,e.__scopeSelect),r=_i(Ii,e.__scopeSelect),[i,a]=J.useState(!1),o=u(t,r.onScrollButtonChange);return F(()=>{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,Y.jsx)(Ri,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});Li.displayName=Ii;var Ri=J.forwardRef((e,n)=>{let{__scopeSelect:r,onAutoScroll:i,...a}=e,o=ci(`SelectScrollButton`,r),s=J.useRef(null),c=Vr(r),l=J.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return J.useEffect(()=>()=>l(),[l]),F(()=>{c().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[c]),(0,Y.jsx)(y.div,{"aria-hidden":!0,...a,ref:n,style:{flexShrink:0,...a.style},onPointerDown:t(a.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(i,50))}),onPointerMove:t(a.onPointerMove,()=>{o.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(i,50))}),onPointerLeave:t(a.onPointerLeave,()=>{l()})})}),zi=`SelectSeparator`,Bi=J.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,Y.jsx)(y.div,{"aria-hidden":!0,...r,ref:t})});Bi.displayName=zi;var Vi=`SelectArrow`,Hi=J.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Gr(n),a=qr(Vi,n),o=ci(Vi,n);return a.open&&o.position===`popper`?(0,Y.jsx)(Ln,{...i,...r,ref:t}):null});Hi.displayName=Vi;var Ui=`SelectBubbleInput`,Wi=J.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=J.useRef(null),a=u(r,i),o=Ar(t);return J.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,Y.jsx)(y.select,{...n,style:{...Rn,...n.style},ref:a,defaultValue:t})});Wi.displayName=Ui;function Gi(e){return e===``||e===void 0}function Ki(e){let t=v(e),n=J.useRef(``),r=J.useRef(0),i=J.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=J.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return J.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=J.forwardRef((e,t)=>{let n=(0,X.c)(12),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let s;n[4]===i?s=n[5]:(s=f(`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]=s);let c;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Y.jsx)(Qi,{asChild:!0,children:(0,Y.jsx)(o,{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]!==s?(l=(0,Y.jsxs)(Xi,{ref:t,className:s,...a,children:[r,c]}),n[7]=r,n[8]=a,n[9]=t,n[10]=s,n[11]=l):l=n[11],l});da.displayName=Xi.displayName;var fa=J.forwardRef((e,t)=>{let n=(0,X.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=f(`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,Y.jsx)(d,{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,Y.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=J.forwardRef((e,t)=>{let n=(0,X.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=f(`flex cursor-default items-center justify-center py-1`,r),n[3]=r,n[4]=a);let s;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Y.jsx)(o,{className:`h-4 w-4`}),n[5]=s):s=n[5];let c;return n[6]!==i||n[7]!==t||n[8]!==a?(c=(0,Y.jsx)(sa,{ref:t,className:a,...i,children:s}),n[6]=i,n[7]=t,n[8]=a,n[9]=c):c=n[9],c});pa.displayName=sa.displayName;var ma=J.forwardRef((e,t)=>{let n=(0,X.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=f(`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,Y.jsx)(fa,{}),n[8]=u):u=n[8];let d=s===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`,p;n[9]===d?p=n[10]:(p=f(`p-1`,d),n[9]=d,n[10]=p);let m;n[11]!==r||n[12]!==p?(m=(0,Y.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,Y.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,Y.jsx)($i,{children:(0,Y.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=J.forwardRef((e,t)=>{let n=(0,X.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=f(`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,Y.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=J.forwardRef((e,t)=>{let n=(0,X.c)(14),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=f(`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`,i),n[4]=i,n[5]=o);let s;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Y.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,Y.jsx)(aa,{children:(0,Y.jsx)(M,{className:`h-4 w-4`})})}),n[6]=s):s=n[6];let c;n[7]===r?c=n[8]:(c=(0,Y.jsx)(ia,{children:r}),n[7]=r,n[8]=c);let l;return n[9]!==a||n[10]!==t||n[11]!==o||n[12]!==c?(l=(0,Y.jsxs)(ra,{ref:t,className:o,...a,children:[s,c]}),n[9]=a,n[10]=t,n[11]=o,n[12]=c,n[13]=l):l=n[13],l});ga.displayName=ra.displayName;var _a=J.forwardRef((e,t)=>{let n=(0,X.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=f(`-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,Y.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,X.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,Y.jsx)(Y.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,Y.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,Y.jsxs)(Y.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 A(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:o,inline:s}){let[u,d]=(0,J.useState)(null),[f,m]=(0,J.useState)(!1),[g,_]=(0,J.useState)(null),[v,y]=(0,J.useState)(0),[b,x]=(0,J.useState)(``),[C,T]=(0,J.useState)(``),E=(0,J.useCallback)(async e=>{m(!0),_(null);try{d(await A(e))}catch(e){_(e instanceof Error?e.message:`Failed to load conversation history`)}finally{m(!1)}},[]),O=(0,J.useCallback)(async e=>{if(e){m(!0),_(null);try{let t=o.find(t=>t.projectId===e);if(!t||t.threads.length===0){d({threadId:e,messages:[],lastUpdated:new Date().toISOString(),conversationIds:[]});return}d({threadId:e,...await xa(t.threads)})}catch(e){_(e instanceof Error?e.message:`Failed to load project history`)}finally{m(!1)}}},[o]),k=(0,J.useCallback)(async()=>{m(!0),_(null);try{d({threadId:va,...await xa(o.flatMap(e=>e.threads))})}catch(e){_(e instanceof Error?e.message:`Failed to load all projects history`)}finally{m(!1)}},[o]);(0,J.useEffect)(()=>{e&&n?n.type===`thread`?(T(n.id),x(``),y(0),E(n.id)):n.type===`project`&&(x(n.id),T(``),y(0),O(n.id)):e||(d(null),T(``),x(``),y(0),_(null))},[e,n,E,O]);let j=e=>{T(e),x(``),y(0),E(e)},M=e=>{x(e),T(``),y(0),e===va?k():O(e)},P=e=>new Date(e).toLocaleString(),ee=(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}},te=e=>({inputTokens:e.inputTokens??0,outputTokens:e.outputTokens??0});return e?(0,Y.jsx)(`div`,{className:s?`h-full bg-background`:`fixed inset-0 z-50 bg-background`,children:(0,Y.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!s&&(0,Y.jsxs)(`div`,{className:`flex items-center justify-between border-b p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,Y.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Conversation History`}),n?.type===`thread`&&(0,Y.jsxs)(la,{value:C,onValueChange:j,children:[(0,Y.jsx)(da,{className:`w-48`,children:(0,Y.jsx)(ua,{placeholder:`Select thread`})}),(0,Y.jsx)(ma,{children:o.flatMap(e=>e.threads.map(t=>(0,Y.jsx)(ga,{value:t.threadId,children:ba(t,e.name??e.projectId)},t.threadId)))})]}),(0,Y.jsxs)(la,{value:b,onValueChange:M,children:[(0,Y.jsx)(da,{className:`w-48`,children:(0,Y.jsx)(ua,{placeholder:`Select project`})}),(0,Y.jsxs)(ma,{children:[(0,Y.jsx)(ga,{value:va,children:`All Projects`}),o.map(e=>(0,Y.jsx)(ga,{value:e.projectId,children:e.name??e.projectId},e.projectId))]})]})]}),(0,Y.jsx)(w,{variant:`action`,size:`icon-sm`,onClick:t,children:(0,Y.jsx)(i,{})})]}),u?.messages&&u.messages.length>0&&(0,Y.jsxs)(`div`,{className:`flex items-center justify-between border-b p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(w,{variant:`outline`,size:`sm`,onClick:()=>{v>0&&y(v-1)},disabled:v===0,children:(0,Y.jsx)(a,{className:`h-4 w-4 mr-1`})}),(0,Y.jsx)(w,{variant:`outline`,size:`sm`,onClick:()=>{u?.messages&&v<u.messages.length-1&&y(v+1)},disabled:!u||v>=u.messages.length-1,children:(0,Y.jsx)(p,{className:`h-4 w-4 ml-1`})})]}),(0,Y.jsxs)(`div`,{className:`text-sm text-muted-foreground`,children:[v+1,` of `,u?.messages.length??0,` messages`]})]}),(0,Y.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:f?(0,Y.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,Y.jsxs)(`div`,{className:`text-center`,children:[(0,Y.jsx)(l,{className:`h-8 w-8 animate-spin mx-auto mb-2`}),(0,Y.jsx)(`p`,{children:`Loading conversation history...`})]})}):g?(0,Y.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,Y.jsxs)(D,{className:`max-w-md`,children:[(0,Y.jsx)(S,{children:(0,Y.jsx)(h,{className:`text-destructive`,children:`Error`})}),(0,Y.jsxs)(N,{children:[(0,Y.jsx)(`p`,{children:g}),(0,Y.jsx)(w,{onClick:t,className:`mt-4`,children:`Close`})]})]})}):u?.messages?.length&&u.messages.length>0?(0,Y.jsx)(r,{className:`h-full`,children:(0,Y.jsx)(`div`,{className:`p-4`,children:(0,Y.jsxs)(jr,{children:[(0,Y.jsx)(Mr,{children:(0,Y.jsxs)(Fr,{children:[(0,Y.jsx)(Z,{children:`Prompt`}),(0,Y.jsx)(Z,{children:`Answer`}),(0,Y.jsx)(Z,{className:`w-24`,children:`Model`}),(0,Y.jsx)(Z,{className:`w-24 text-right`,children:`Duration`}),(0,Y.jsx)(Z,{className:`w-20 text-right`,children:`Input Tokens`}),(0,Y.jsx)(Z,{className:`w-20 text-right`,children:`Output Tokens`}),(0,Y.jsx)(Z,{className:`w-32 text-right`,children:`Timestamp`})]})}),(0,Y.jsx)(Nr,{children:u.messages.map((e,t)=>{let{inputTokens:n,outputTokens:r}=te(e);return(0,Y.jsxs)(Fr,{className:t===v?`bg-muted/50`:``,children:[(0,Y.jsx)(Q,{className:`max-w-md`,children:(0,Y.jsx)(`div`,{className:`text-sm`,children:(0,Y.jsx)(ya,{text:e.request.message})})}),(0,Y.jsx)(Q,{className:`max-w-md`,children:e.response?(0,Y.jsx)(`div`,{className:`text-sm`,children:(0,Y.jsx)(ya,{text:e.response.content})}):(0,Y.jsx)(`span`,{className:`text-muted-foreground italic`,children:`No response`})}),(0,Y.jsx)(Q,{className:`text-sm`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(c,{className:`h-3 w-3 text-muted-foreground`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e.request.model})]})}),(0,Y.jsx)(Q,{className:`text-sm text-right`,children:e.response?(0,Y.jsx)(Er,{children:(0,Y.jsxs)(Dr,{children:[(0,Y.jsx)(Or,{asChild:!0,children:(0,Y.jsx)(`div`,{className:`cursor-help`,children:ee(e.timestamp,e.response.completedAt).display})}),(0,Y.jsx)(kr,{children:(0,Y.jsx)(`p`,{children:ee(e.timestamp,e.response.completedAt).tooltip})})]})}):(0,Y.jsx)(`span`,{className:`text-muted-foreground italic`,children:`-`})}),(0,Y.jsx)(Q,{className:`text-sm text-muted-foreground text-right`,children:n>0?n.toLocaleString():`-`}),(0,Y.jsx)(Q,{className:`text-sm text-muted-foreground text-right`,children:r>0?r.toLocaleString():`-`}),(0,Y.jsx)(Q,{className:`text-sm text-muted-foreground text-right`,children:P(e.timestamp)})]},e.id)})})]})})}):(0,Y.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,Y.jsxs)(`div`,{className:`max-w-md text-center space-y-2`,children:[(0,Y.jsx)(`h3`,{className:`text-lg font-semibold`,children:`No History`}),(0,Y.jsx)(`p`,{className:`text-muted-foreground`,children:`No conversation history found for this thread.`})]})})})]})}):null}export{hn as _,da as a,kr as c,Bn as d,Fn as f,vn as g,Pn as h,ga as i,Er as l,In as m,la as n,Ar as o,Ln as p,ma as r,Dr as s,Sa as t,Or as u};