tarsk 0.5.32 → 0.5.34

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 (109) hide show
  1. package/dist/index.js +17709 -13937
  2. package/dist/public/assets/account-view-Ds03urJE.js +1 -0
  3. package/dist/public/assets/api-BHfaVqlR.js +1 -0
  4. package/dist/public/assets/browser-tab-Qs8cnQkf.js +1 -0
  5. package/dist/public/assets/commit-dialog-D4suPxEe.js +1 -0
  6. package/dist/public/assets/context-menu-S8y0c1Fx.js +1 -0
  7. package/dist/public/assets/create-repo-dialog-DPKIg1mY.js +1 -0
  8. package/dist/public/assets/{css.worker-DyDu5ynT.js → css.worker-CvXBzhp8.js} +2 -2
  9. package/dist/public/assets/dialogs-config-Ct6i8Iij.js +51 -0
  10. package/dist/public/assets/diff-view-rKDEnBLg.js +3 -0
  11. package/dist/public/assets/{dist-2eORHB3M.js → dist-oojFghRi.js} +5 -5
  12. package/dist/public/assets/explorer-tab-view-JbLbPVAn.js +2 -0
  13. package/dist/public/assets/explorer-tree-Dq44yA1j.js +1 -0
  14. package/dist/public/assets/explorer-view-BMrlX2hb.js +1 -0
  15. package/dist/public/assets/git-history-dialog-CDwIqSZQ.js +1 -0
  16. package/dist/public/assets/git-ops-button-B6rEla5u.js +2 -0
  17. package/dist/public/assets/history-view-CFot099O.js +7 -0
  18. package/dist/public/assets/{html.worker-IWNXhnIC.js → html.worker-BO6WuOEO.js} +3 -3
  19. package/dist/public/assets/index-6DhhjIBL.js +65 -0
  20. package/dist/public/assets/index-sEZ3wJXu.css +1 -0
  21. package/dist/public/assets/{json.worker-c4h5s80L.js → json.worker-BkJRGcCJ.js} +2 -2
  22. package/dist/public/assets/mcp-server-card-DQY1RUPX.js +1 -0
  23. package/dist/public/assets/merged-pr-dialog-H_fuSmiF.js +1 -0
  24. package/dist/public/assets/{monaco-BGyhgQtx.js → monaco-CZnIWXyV.js} +198 -198
  25. package/dist/public/assets/onboarding-DHCR18iU.js +1 -0
  26. package/dist/public/assets/project-settings-view-CiefnK73.js +1 -0
  27. package/dist/public/assets/providers-list-view-DVopskGo.js +1 -0
  28. package/dist/public/assets/pull-request-dialog-Csql6eob.js +1 -0
  29. package/dist/public/assets/pull-with-changes-dialog-DN0kE6os.js +1 -0
  30. package/dist/public/assets/push-before-pr-dialog-IhdlLvWt.js +1 -0
  31. package/dist/public/assets/radio-group-BaKkAEZR.js +1 -0
  32. package/dist/public/assets/react-vendor-CjZZeCRj.js +16 -0
  33. package/dist/public/assets/rolldown-runtime-aKtaBQYM.js +1 -0
  34. package/dist/public/assets/settings-general-view-BMTxN35t.js +1 -0
  35. package/dist/public/assets/settings-instructions-view-DULFg6dU.js +1 -0
  36. package/dist/public/assets/settings-list-Bdeuh4bJ.js +1 -0
  37. package/dist/public/assets/settings-mcp-servers-view-CRCtWjP2.js +5 -0
  38. package/dist/public/assets/settings-models-skeleton-CN2JkqZh.js +1 -0
  39. package/dist/public/assets/settings-models-view-DosllhVB.js +1 -0
  40. package/dist/public/assets/settings-rules-view-BVWuGrnB.js +8 -0
  41. package/dist/public/assets/settings-skills-view-DYtcAu9-.js +2 -0
  42. package/dist/public/assets/settings-slash-commands-view-DFyL1W2n.js +1 -0
  43. package/dist/public/assets/settings-subagents-view-aCbK95Sk.js +2 -0
  44. package/dist/public/assets/settings-system-prompt-view-BNM_15ry.js +1 -0
  45. package/dist/public/assets/settings-view-D5GE_CYR.js +2 -0
  46. package/dist/public/assets/skeleton-pSKdmWyJ.js +1 -0
  47. package/dist/public/assets/terminal-panel-Ds1tCgQA.js +2 -0
  48. package/dist/public/assets/{ts.worker-BwM5Ha3L.js → ts.worker-B0J26iPs.js} +33 -18
  49. package/dist/public/assets/ui-components-Di-9yNr4.js +1 -0
  50. package/dist/public/assets/{utils-Dt4Hs5eF.js → utils-DDDR42pW.js} +1 -1
  51. package/dist/public/assets/{whisper-wasm-BCJQtWoU.js → whisper-wasm-Cq5Ofwpd.js} +1 -1
  52. package/dist/public/index.html +10 -24
  53. package/dist/recommended-models.txt +13 -0
  54. package/package.json +8 -7
  55. package/dist/public/assets/account-view-DjLjq8T6.js +0 -1
  56. package/dist/public/assets/alert-dialog-BWqb8ENe.js +0 -1
  57. package/dist/public/assets/api-BbUzw5rb.js +0 -1
  58. package/dist/public/assets/browser-tab-BVsBMyo3.js +0 -1
  59. package/dist/public/assets/chat-input-container-Dh5eJPNP.js +0 -22
  60. package/dist/public/assets/commit-dialog-CfjW1f6P.js +0 -1
  61. package/dist/public/assets/context-menu-D_gX85jr.js +0 -1
  62. package/dist/public/assets/conversation-history-view-CKiv8CxD.js +0 -1
  63. package/dist/public/assets/create-repo-dialog-ByvOv7em.js +0 -1
  64. package/dist/public/assets/dialogs-config-CV8HzCCA.js +0 -51
  65. package/dist/public/assets/diff-view-CuEdnFtI.js +0 -3
  66. package/dist/public/assets/explorer-tab-view-CiDUcvE2.js +0 -2
  67. package/dist/public/assets/explorer-tree-cxPx2HiW.js +0 -1
  68. package/dist/public/assets/explorer-view-BCQNEBOZ.js +0 -1
  69. package/dist/public/assets/git-history-dialog-DKey5IQa.js +0 -1
  70. package/dist/public/assets/history-view-DDpROJvQ.js +0 -1
  71. package/dist/public/assets/index-BZwvl9X4.js +0 -29
  72. package/dist/public/assets/index-CihB-pLh.css +0 -1
  73. package/dist/public/assets/markdown-renderer-B1teF28W.js +0 -10
  74. package/dist/public/assets/mcp-server-card-CY-VLPhS.js +0 -1
  75. package/dist/public/assets/merged-pr-dialog-BfwdsytN.js +0 -1
  76. package/dist/public/assets/onboarding-BEy4bi0g.js +0 -1
  77. package/dist/public/assets/onboarding-dialog-GjczsXqi.js +0 -1
  78. package/dist/public/assets/page-toolbar-rWocuukR.js +0 -1
  79. package/dist/public/assets/project-settings-view-wlaXVds9.js +0 -1
  80. package/dist/public/assets/providers-list-view-BJsp9sta.js +0 -1
  81. package/dist/public/assets/pull-request-dialog-DDxX2W8n.js +0 -1
  82. package/dist/public/assets/pull-with-changes-dialog-BtXHWQ3k.js +0 -1
  83. package/dist/public/assets/push-before-pr-dialog-Cs54Vb76.js +0 -1
  84. package/dist/public/assets/radio-group-D2kNbZM6.js +0 -1
  85. package/dist/public/assets/react-vendor-DV_DP0Qd.js +0 -22
  86. package/dist/public/assets/resizable-jxPFsLog.js +0 -1
  87. package/dist/public/assets/rolldown-runtime-B1FJdls4.js +0 -1
  88. package/dist/public/assets/run-stop-button-N1JNjOlD.js +0 -2
  89. package/dist/public/assets/settings-general-view-BKcgxF5z.js +0 -1
  90. package/dist/public/assets/settings-instructions-view-DbQ3c3f1.js +0 -1
  91. package/dist/public/assets/settings-mcp-servers-view-D2_Brac1.js +0 -5
  92. package/dist/public/assets/settings-models-skeleton-BSV1GmZQ.js +0 -1
  93. package/dist/public/assets/settings-models-view-BhFuBHAE.js +0 -1
  94. package/dist/public/assets/settings-rules-view-qL__Zcav.js +0 -8
  95. package/dist/public/assets/settings-skills-view-Ccj8tTR9.js +0 -2
  96. package/dist/public/assets/settings-slash-commands-view-DyXAbQIp.js +0 -1
  97. package/dist/public/assets/settings-subagents-view-LcaON0Dq.js +0 -2
  98. package/dist/public/assets/settings-view-cLrxaSw4.js +0 -2
  99. package/dist/public/assets/side-panel-container-CCaF3ZtX.js +0 -2
  100. package/dist/public/assets/skeleton-DNfHG6mv.js +0 -1
  101. package/dist/public/assets/standard-list-item-PWOXi212.js +0 -1
  102. package/dist/public/assets/store-9Wm6Zyve.js +0 -4
  103. package/dist/public/assets/tab-context-BdML89mQ.js +0 -1
  104. package/dist/public/assets/tabs-BVcV8raO.js +0 -1
  105. package/dist/public/assets/terminal-panel-BG8UFUSX.js +0 -2
  106. package/dist/public/assets/textarea-CU-XhvgE.js +0 -1
  107. package/dist/public/assets/todos-view-DLC_0wx_.js +0 -1
  108. package/dist/public/assets/use-font-size-Bqn2rvp_.js +0 -1
  109. package/dist/public/assets/use-toast-CGSBJJb0.js +0 -1
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/explorer-tree-Dq44yA1j.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-6DhhjIBL.js","assets/monaco-CZnIWXyV.js","assets/monaco-Br_kD0ds.css","assets/history-view-CFot099O.js","assets/dialogs-config-Ct6i8Iij.js","assets/onboarding-DHCR18iU.js","assets/whisper-wasm-Cq5Ofwpd.js","assets/react-vendor-CjZZeCRj.js","assets/utils-DDDR42pW.js","assets/index-sEZ3wJXu.css","assets/api-BHfaVqlR.js","assets/context-menu-S8y0c1Fx.js","assets/ui-components-Di-9yNr4.js","assets/explorer-view-BMrlX2hb.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Qr as t,gi as n,io as r,li as i,lr as a,no as o}from"./dialogs-config-Ct6i8Iij.js";import{r as s}from"./monaco-CZnIWXyV.js";import{l as c,u as l}from"./history-view-CFot099O.js";import{A as u,S as d,i as f,n as p,r as m}from"./index-6DhhjIBL.js";var h=o(),g=e(r(),1),_=n(),v=(0,g.lazy)(()=>s(()=>import(`./explorer-tree-Dq44yA1j.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]))),y=(0,g.lazy)(()=>s(()=>import(`./explorer-view-BMrlX2hb.js`),__vite__mapDeps([15,1,2,3,4,5,6,7,8,9,10,11,12])));function b(){let e=(0,h.c)(18),n=u(x),[r,o]=(0,g.useState)(null),{pendingExplorerPath:s,setPendingExplorerPath:b,explorerClearPath:S,setExplorerClearPath:C}=d(),w,T;e[0]!==s||e[1]!==b?(w=()=>{s&&b(null)},T=[s,b],e[0]=s,e[1]=b,e[2]=w,e[3]=T):(w=e[2],T=e[3]),(0,g.useEffect)(w,T);let E,D;e[4]!==S||e[5]!==C?(E=()=>{S&&(o(e=>e&&(e.path===S||e.path.startsWith(S+`/`)?null:e)),C(null))},D=[S,C],e[4]=S,e[5]=C,e[6]=E,e[7]=D):(E=e[6],D=e[7]),(0,g.useEffect)(E,D);let O;e[8]!==r?.path||e[9]!==n?(O=(0,_.jsx)(m,{defaultSize:25,minSize:15,maxSize:50,className:`overflow-hidden border-r border-border`,children:(0,_.jsx)(a,{className:`h-full`,children:n?(0,_.jsx)(g.Suspense,{fallback:(0,_.jsx)(l,{}),children:(0,_.jsx)(v,{threadId:n,selectedPath:r?.path??null,onNodeSelect:o})}):(0,_.jsx)(`p`,{className:t(i.caption,`px-3 py-4 text-center`),children:`No thread selected.`})})}),e[8]=r?.path,e[9]=n,e[10]=O):O=e[10];let k;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,_.jsx)(p,{withHandle:!0}),e[11]=k):k=e[11];let A;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,_.jsx)(c,{}),e[12]=A):A=e[12];let j;e[13]===r?j=e[14]:(j=(0,_.jsx)(m,{className:`overflow-hidden`,children:(0,_.jsx)(g.Suspense,{fallback:A,children:(0,_.jsx)(y,{selectedFile:r})})}),e[13]=r,e[14]=j);let M;return e[15]!==O||e[16]!==j?(M=(0,_.jsx)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:(0,_.jsxs)(f,{direction:`horizontal`,className:`flex-1 overflow-hidden`,children:[O,k,j]})}),e[15]=O,e[16]=j,e[17]=M):M=e[17],M}function x(e){return e.selectedThreadId}export{b as default};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ca as t,Ea as n,Hi as r,Ka as i,Qr as a,Wa as o,gi as s,io as c,li as l,mr as u,no as d,wa as f}from"./dialogs-config-Ct6i8Iij.js";import{u as p}from"./onboarding-DHCR18iU.js";import{A as m,F as h,M as g,O as _,a as v,c as y,j as b,k as x,n as S,o as C,u as w}from"./history-view-CFot099O.js";import{S as T,T as E,b as D,v as ee,y as O}from"./index-6DhhjIBL.js";import{a as k,i as A,n as j,r as M,t as N}from"./context-menu-S8y0c1Fx.js";import{n as P,o as F,r as I,s as L,t as R}from"./api-BHfaVqlR.js";import{t as z}from"./ui-components-Di-9yNr4.js";var B=d(),V=e(c(),1),H=s(),U=V.forwardRef((e,t)=>{let n=(0,B.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 o;n[3]===r?o=n[4]:(o=a(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,r),n[3]=r,n[4]=o);let s;return n[5]!==i||n[6]!==t||n[7]!==o?(s=(0,H.jsx)(z,{ref:t,className:o,...i}),n[5]=i,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});U.displayName=z.displayName;var W=V.forwardRef((e,t)=>{let n=(0,B.c)(10),i,o;n[0]===e?(i=n[1],o=n[2]):({className:i,...o}=e,n[0]=e,n[1]=i,n[2]=o);let s;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,H.jsx)(r,{className:`mr-2 h-4 w-4 shrink-0 opacity-50`}),n[3]=s):s=n[3];let c;n[4]===i?c=n[5]:(c=a(`flex h-11 w-full rounded-md bg-transparent py-3 text-base outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),n[4]=i,n[5]=c);let l;return n[6]!==o||n[7]!==t||n[8]!==c?(l=(0,H.jsxs)(`div`,{className:`flex items-center border-b px-3`,"cmdk-input-wrapper":``,children:[s,(0,H.jsx)(z.Input,{ref:t,className:c,...o})]}),n[6]=o,n[7]=t,n[8]=c,n[9]=l):l=n[9],l});W.displayName=z.Input.displayName;var G=V.forwardRef((e,t)=>{let n=(0,B.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 o;n[3]===r?o=n[4]:(o=a(`max-h-[300px] overflow-y-auto overflow-x-hidden`,r),n[3]=r,n[4]=o);let s;return n[5]!==i||n[6]!==t||n[7]!==o?(s=(0,H.jsx)(z.List,{ref:t,className:o,...i}),n[5]=i,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});G.displayName=z.List.displayName;var K=V.forwardRef((e,t)=>{let n=(0,B.c)(4),r;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=a(l.bodyMuted,`py-6 text-center`),n[0]=r):r=n[0];let i;return n[1]!==e||n[2]!==t?(i=(0,H.jsx)(z.Empty,{ref:t,className:r,...e}),n[1]=e,n[2]=t,n[3]=i):i=n[3],i});K.displayName=z.Empty.displayName;var q=V.forwardRef((e,t)=>{let n=(0,B.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 o;n[3]===r?o=n[4]:(o=a(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,r),n[3]=r,n[4]=o);let s;return n[5]!==i||n[6]!==t||n[7]!==o?(s=(0,H.jsx)(z.Group,{ref:t,className:o,...i}),n[5]=i,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});q.displayName=z.Group.displayName;var J=V.forwardRef((e,t)=>{let n=(0,B.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 o;n[3]===r?o=n[4]:(o=a(`-mx-1 h-px bg-border`,r),n[3]=r,n[4]=o);let s;return n[5]!==i||n[6]!==t||n[7]!==o?(s=(0,H.jsx)(z.Separator,{ref:t,className:o,...i}),n[5]=i,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});J.displayName=z.Separator.displayName;var Y=V.forwardRef((e,t)=>{let n=(0,B.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 o;n[3]===r?o=n[4]:(o=a(a(l.body,`relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`),r),n[3]=r,n[4]=o);let s;return n[5]!==i||n[6]!==t||n[7]!==o?(s=(0,H.jsx)(z.Item,{ref:t,className:o,...i}),n[5]=i,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});Y.displayName=z.Item.displayName;var te=e=>{let t=(0,B.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=a(l.compact,`ml-auto tracking-widest text-muted-foreground`,n),t[3]=n,t[4]=i);let o;return t[5]!==r||t[6]!==i?(o=(0,H.jsx)(`span`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=o):o=t[7],o};te.displayName=`CommandShortcut`;var X=100,ne=500;function re(e){return e.trim().toLowerCase().split(/\s+/).filter(Boolean)}function Z(e,t){return t.length===0?!0:t.every(t=>e.haystack.includes(t))}function Q(e,t,n){if(t.length===0)return[];let r=[];for(let n of e)if(Z(n,t)&&(r.push(n.node),r.length>=ne))break;return r.sort((e,t)=>ie(e,t,n)).slice(0,X)}function ie(e,t,n){let r=n.trim().toLowerCase(),i=e.name.toLowerCase(),a=t.name.toLowerCase(),o=r?i.startsWith(r):!1;return o===(r?a.startsWith(r):!1)?e.type===t.type?e.path.localeCompare(t.path):e.type===`folder`?-1:1:o?-1:1}function ae(e){let r=(0,B.c)(38),{items:i,isReady:o,onRequestIndex:s,onOpenChange:c,onSelect:d}=e,f=o===void 0?!1:o,p=(0,V.useRef)(null),m=(0,V.useRef)(!1),h=(0,V.useRef)(!1),[g,_]=(0,V.useState)(!1),[v,y]=(0,V.useState)(``),b=(0,V.useDeferredValue)(v),x;r[0]===s?x=r[1]:(x=function(){h.current||(h.current=!0,s())},r[0]=s,r[1]=x);let S=x,C;r[2]!==b||r[3]!==i?(C=Q(i,re(b),b),r[2]=b,r[3]=i,r[4]=C):C=r[4];let w=C,T,E;r[5]!==c||r[6]!==v?(T=()=>{let e=v.trim().length>0;_(e),m.current!==e&&(m.current=e,c(e))},E=[c,v],r[5]=c,r[6]=v,r[7]=T,r[8]=E):(T=r[7],E=r[8]),(0,V.useEffect)(T,E);let k;r[9]===c?k=r[10]:(k=function(e){e||y(``),_(e),c(e),e&&requestAnimationFrame(()=>p.current?.focus())},r[9]=c,r[10]=k);let A=k,j;r[11]!==c||r[12]!==d?(j=function(e){d(e),_(!1),c(!1),y(``)},r[11]=c,r[12]=d,r[13]=j):j=r[13];let M=j,N;r[14]===S?N=r[15]:(N=e=>{S(),y(e.target.value)},r[14]=S,r[15]=N);let P;r[16]!==v||r[17]!==S||r[18]!==N?(P=(0,H.jsx)(D,{asChild:!0,children:(0,H.jsx)(`div`,{children:(0,H.jsx)(u,{ref:p,value:v,onPointerDown:S,onChange:N,placeholder:`Search files and folders`,className:`pr-[4px]`})})}),r[16]=v,r[17]=S,r[18]=N,r[19]=P):P=r[19];let F;r[20]===Symbol.for(`react.memo_cache_sentinel`)?(F=a(l.compact,`py-4`),r[20]=F):F=r[20];let I=f?`No matches found.`:`Indexing files and folders...`,L;r[21]===I?L=r[22]:(L=(0,H.jsx)(K,{className:F,children:I}),r[21]=I,r[22]=L);let R;if(r[23]!==M||r[24]!==w){let e;r[26]===M?e=r[27]:(e=e=>(0,H.jsxs)(Y,{value:e.path,onSelect:()=>M(e),className:e.ignored?`opacity-50`:void 0,children:[e.type===`folder`?(0,H.jsx)(t,{className:`h-4 w-4 text-muted-foreground`}):(0,H.jsx)(n,{className:`h-4 w-4 text-muted-foreground`}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`div`,{className:`truncate`,children:e.name}),(0,H.jsx)(`div`,{className:a(l.compact,`truncate text-muted-foreground`),children:e.path})]})]},e.path),r[26]=M,r[27]=e),R=w.map(e),r[23]=M,r[24]=w,r[25]=R}else R=r[25];let z;r[28]===R?z=r[29]:(z=(0,H.jsx)(q,{children:R}),r[28]=R,r[29]=z);let W;r[30]!==L||r[31]!==z?(W=(0,H.jsx)(O,{align:`start`,side:`bottom`,sideOffset:4,onOpenAutoFocus:$,className:`w-[var(--radix-popover-trigger-width)] p-0`,children:(0,H.jsx)(U,{shouldFilter:!1,children:(0,H.jsxs)(G,{children:[L,z]})})}),r[30]=L,r[31]=z,r[32]=W):W=r[32];let J;return r[33]!==A||r[34]!==g||r[35]!==W||r[36]!==P?(J=(0,H.jsxs)(ee,{open:g,onOpenChange:A,children:[P,W]}),r[33]=A,r[34]=g,r[35]=W,r[36]=P,r[37]=J):J=r[37],J}function $(e){return e.preventDefault()}function oe(e,t,n){return`explorer-dir:${e}:${t}:${n}`}function se(e){let t=(0,B.c)(12),{threadId:n,dirPath:r,version:i,children:a}=e,o;t[0]!==r||t[1]!==n||t[2]!==i?(o=oe(n,r,i),t[0]=r,t[1]=n,t[2]=i,t[3]=o):o=t[3];let s;t[4]!==r||t[5]!==n?(s=()=>F(n,r).then(ce),t[4]=r,t[5]=n,t[6]=s):s=t[6];let c=v(o,s),l;t[7]!==a||t[8]!==c?(l=a(c),t[7]=a,t[8]=c,t[9]=l):l=t[9];let u;return t[10]===l?u=t[11]:(u=(0,H.jsx)(H.Fragment,{children:l}),t[10]=l,t[11]=u),u}function ce(e){return e.entries}function le(e){let t=(0,B.c)(17),{defaultValue:n,onCommit:r,onCancel:i,level:a,basePadding:o,icon:s}=e,c=(0,V.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,V.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,m;t[5]!==i||t[6]!==r?(m=function(){let e=c.current?.value.trim()??``;e?r(e):i()},t[5]=i,t[6]=r,t[7]=m):m=t[7];let h=m,g;t[8]!==n||t[9]!==h||t[10]!==f?(g=(0,H.jsx)(`input`,{ref:c,defaultValue:n,onKeyDown:f,onBlur:h,className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`,onClick:ue}),t[8]=n,t[9]=h,t[10]=f,t[11]=g):g=t[11];let _;return t[12]!==o||t[13]!==s||t[14]!==a||t[15]!==g?(_=(0,H.jsxs)(p,{level:a,basePadding:o,children:[s,g]}),t[12]=o,t[13]=s,t[14]=a,t[15]=g,t[16]=_):_=t[16],_}function ue(e){return e.stopPropagation()}function de(e){return e.map(e=>({node:e,haystack:`${e.name} ${e.path}`.toLowerCase()}))}var fe=(0,V.memo)(function e({node:r,level:a,threadId:s,selectedPath:c,expandedPaths:l,getDirVersion:u,renamingPath:d,newItemIn:m,onToggleFolder:h,onSelectNode:g,onStartRename:_,onCommitRename:v,onCancelRename:b,onDelete:x,onNewFile:S,onNewFolder:C,onCommitNewItem:w,onCancelNewItem:T}){let E=l.has(r.path),D=d===r.path,ee=m?.dirPath===r.path&&E;return r.type===`folder`?(0,H.jsxs)(N,{children:[(0,H.jsx)(k,{asChild:!0,children:(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(p,{level:a,basePadding:10,selected:c===r.path,className:r.ignored?`opacity-50`:void 0,onClick:e=>{e.stopPropagation(),h(r)},children:[(0,H.jsx)(`span`,{className:`text-muted-foreground w-3 flex-shrink-0`,children:E?(0,H.jsx)(i,{className:`h-3 w-3`}):(0,H.jsx)(o,{className:`h-3 w-3`})}),D?(0,H.jsxs)(H.Fragment,{children:[E?(0,H.jsx)(f,{className:`h-4 w-4 flex-shrink-0`}):(0,H.jsx)(t,{className:`h-4 w-4 flex-shrink-0`}),(0,H.jsx)(`input`,{autoFocus:!0,defaultValue:r.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?v(r,t):b()}else e.key===`Escape`&&b()},onBlur:e=>{let t=e.target.value.trim();t?v(r,t):b()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`})]}):(0,H.jsxs)(H.Fragment,{children:[E?(0,H.jsx)(f,{className:`h-4 w-4 flex-shrink-0`}):(0,H.jsx)(t,{className:`h-4 w-4 flex-shrink-0`}),(0,H.jsx)(`span`,{className:`flex-1 truncate`,children:r.name})]})]}),E&&(0,H.jsx)(`div`,{children:(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(y,{}),children:(0,H.jsx)(se,{threadId:s,dirPath:r.path,version:u(r.path),children:r=>(0,H.jsxs)(H.Fragment,{children:[ee&&(0,H.jsx)(le,{defaultValue:``,level:a+1,basePadding:m.type===`folder`?10:22,icon:m.type===`folder`?(0,H.jsx)(t,{className:`h-4 w-4 flex-shrink-0`}):(0,H.jsx)(n,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:w,onCancel:T}),r.map(t=>(0,H.jsx)(e,{node:t,level:a+1,threadId:s,selectedPath:c,expandedPaths:l,getDirVersion:u,renamingPath:d,newItemIn:m,onToggleFolder:h,onSelectNode:g,onStartRename:_,onCommitRename:v,onCancelRename:b,onDelete:x,onNewFile:S,onNewFolder:C,onCommitNewItem:w,onCancelNewItem:T},t.path))]})})})})]})}),(0,H.jsxs)(j,{children:[(0,H.jsx)(M,{onSelect:()=>S(r.path),children:`New File...`}),(0,H.jsx)(M,{onSelect:()=>C(r.path),children:`New Folder...`}),(0,H.jsx)(A,{}),(0,H.jsx)(M,{onSelect:()=>_(r),children:`Rename...`}),(0,H.jsx)(M,{onSelect:()=>x(r),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]}):(0,H.jsxs)(N,{children:[(0,H.jsx)(k,{asChild:!0,children:(0,H.jsxs)(p,{level:a,basePadding:22,selected:c===r.path,className:r.ignored?`opacity-50`:void 0,onClick:()=>g(r),children:[(0,H.jsx)(n,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),D?(0,H.jsx)(`input`,{autoFocus:!0,defaultValue:r.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?v(r,t):b()}else e.key===`Escape`&&b()},onBlur:e=>{let t=e.target.value.trim();t?v(r,t):b()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`}):(0,H.jsx)(`span`,{className:`flex-1 truncate`,children:r.name})]})}),(0,H.jsxs)(j,{children:[(0,H.jsx)(M,{onSelect:()=>_(r),children:`Rename...`}),(0,H.jsx)(M,{onSelect:()=>x(r),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]})}),pe=new Map;function me({threadId:e,selectedPath:r,onNodeSelect:i}){let[a,o]=(0,V.useState)(()=>new Map([[``,0]])),[s,c]=(0,V.useState)(new Set),[l,u]=(0,V.useState)(null),[d,f]=(0,V.useState)(null),[p,v]=(0,V.useState)(null),[y,D]=(0,V.useState)(!1),[ee,O]=(0,V.useState)([]),[A,z]=(0,V.useState)(!1),[B,U]=(0,V.useState)(!1),W=(0,V.useRef)(null),G=(0,V.useRef)(0),K=(0,V.useRef)(null),{explorerRefreshTick:q,pendingExplorerPath:J}=T(),Y=(0,V.useMemo)(()=>`${e}:${q}`,[q,e]),te=(0,V.useCallback)(e=>{(0,V.startTransition)(()=>{D(t=>t===e?t:e)})},[]),X=(0,V.useCallback)(async()=>{if(!e)return;let t=pe.get(Y);if(t){O(t),z(!0);return}if(W.current!==Y){W.current=Y,O([]),z(!1);try{let t=de((await F(e,``,!0)).entries);pe.set(Y,t),O(t),z(!0)}catch{O([]),z(!1)}finally{W.current===Y&&(W.current=null)}}},[Y,e]),ne=(0,V.useCallback)(()=>{U(!0)},[]),re=(0,V.useCallback)(()=>{pe.delete(Y),O([]),z(!1)},[Y]),Z=(0,V.useCallback)(()=>{re(),B&&X()},[re,X,B]),Q=(0,V.useCallback)(e=>a.get(e)??0,[a]),ie=(0,V.useCallback)(e=>{o(t=>{let n=new Map(t);return n.set(e,(t.get(e)??0)+1),n})},[]),$=(0,V.useCallback)(t=>{e&&(C(oe(e,t,Q(t))),ie(t))},[ie,Q,e]),ce=(0,V.useCallback)(t=>{if(!e)return;let n=t.path.split(`/`);t.type===`file`&&n.pop();let r=[],i=``;for(let e of n)i=i?`${i}/${e}`:e,r.push(i);c(e=>{let t=new Set(e);for(let e of r)t.add(e);return t})},[e]);(0,V.useEffect)(()=>{if(!e)return;let t=K.current!==null&&K.current!==e;K.current=e,t&&(o(new Map([[``,0]])),c(new Set),u(null),f(null),G.current=q)},[q,e]),(0,V.useEffect)(()=>{!e||q<=G.current||(G.current=q,o(t=>{let n=new Set([``]);for(let e of s)n.add(e);let r=new Map(t);for(let i of n){let n=t.get(i)??0;C(oe(e,i,n)),r.set(i,n+1)}return r}))},[q,s,e]),(0,V.useEffect)(()=>{O([]),z(!1),U(!1),W.current=null},[Y]),(0,V.useEffect)(()=>{!B||!e||X()},[X,B,e]),(0,V.useEffect)(()=>{if(!J||!e)return;let t=J.split(`/`);t.pop();let n=[],r=``;for(let e of t)r=r?`${r}/${e}`:e,n.push(r);if(n.length!==0){c(e=>{let t=new Set(e);for(let e of n)t.add(e);return t});for(let e of n)o(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})}},[J,e]);function ue(e){s.has(e.path)?c(t=>{let n=new Set(t);return n.delete(e.path),n}):(c(t=>new Set(t).add(e.path)),o(t=>{if(t.has(e.path))return t;let n=new Map(t);return n.set(e.path,0),n}))}function me(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(0,t):``}function he(e){v(e)}async function ge(){if(!p)return;let t=p;v(null);try{await I(e,t.path),$(me(t.path)),Z(),c(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),o(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{E({title:`Error`,description:`Failed to move "${t.name}" to trash`,variant:`destructive`})}}function _e(e){f(null),u(e.path)}async function ve(t,n){if(n===t.name){u(null);return}u(null);try{await L(e,t.path,n),$(me(t.path)),Z(),t.type===`folder`&&(c(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),o(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{E({title:`Error`,description:`Failed to rename "${t.name}"`,variant:`destructive`})}}function ye(e){u(null),s.has(e)||(c(t=>new Set(t).add(e)),o(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})),f({dirPath:e,type:`file`})}function be(e){u(null),s.has(e)||(c(t=>new Set(t).add(e)),o(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})),f({dirPath:e,type:`folder`})}async function xe(t){if(!d)return;let{dirPath:n,type:r}=d;f(null);try{r===`file`?await R(e,n,t):await P(e,n,t),$(n),Z()}catch{E({title:`Error`,description:`Failed to create ${r} "${t}"`,variant:`destructive`})}}function Se(){f(null)}function Ce(e){ce(e),e.type===`file`&&i(e)}let we=d?.dirPath===``?(0,H.jsx)(le,{defaultValue:``,level:0,basePadding:d.type===`folder`?10:22,icon:d.type===`folder`?(0,H.jsx)(t,{className:`h-4 w-4 flex-shrink-0`}):(0,H.jsx)(n,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:xe,onCancel:Se}):null;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(_,{open:p!==null,onOpenChange:e=>!e&&v(null),children:(0,H.jsxs)(b,{children:[(0,H.jsx)(h,{children:`Move to Trash`}),(0,H.jsxs)(g,{children:[`Move “`,p?.name,`” to trash?`]}),(0,H.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[(0,H.jsx)(m,{children:`Cancel`}),(0,H.jsx)(x,{onClick:()=>void ge(),children:`Move to Trash`})]})]})}),(0,H.jsx)(`div`,{className:`border-b border-border bg-background px-2 py-2`,children:(0,H.jsx)(ae,{items:ee,isReady:A,onRequestIndex:ne,onOpenChange:te,onSelect:e=>Ce(e)},Y)}),(0,H.jsxs)(N,{children:[(0,H.jsx)(k,{asChild:!0,disabled:y,children:(0,H.jsx)(`div`,{className:`py-2 min-h-full`,children:(0,H.jsx)(S,{fallbackTitle:`Failed to load files`,onRetry:()=>$(``),children:(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(w,{}),children:(0,H.jsx)(se,{threadId:e,dirPath:``,version:Q(``),children:t=>(0,H.jsxs)(H.Fragment,{children:[we,t.map(t=>(0,H.jsx)(fe,{node:t,level:0,threadId:e,selectedPath:r,expandedPaths:s,getDirVersion:Q,renamingPath:l,newItemIn:d,onToggleFolder:ue,onSelectNode:i,onStartRename:_e,onCommitRename:ve,onCancelRename:()=>u(null),onDelete:he,onNewFile:ye,onNewFolder:be,onCommitNewItem:xe,onCancelNewItem:Se},t.path))]})})})})})}),(0,H.jsxs)(j,{children:[(0,H.jsx)(M,{onSelect:()=>ye(``),children:`New File...`}),(0,H.jsx)(M,{onSelect:()=>be(``),children:`New Folder...`})]})]})]})}export{me as default};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Da as t,Qr as n,Xr as r,gi as i,io as a,la as o,li as s,no as c}from"./dialogs-config-Ct6i8Iij.js";import{S as l}from"./react-vendor-CjZZeCRj.js";import{a as u,l as d,n as f,o as p}from"./history-view-CFot099O.js";import{n as m}from"./utils-DDDR42pW.js";import{A as h,C as g,T as _,o as v}from"./index-6DhhjIBL.js";import{a as y,c as b,i as x}from"./api-BHfaVqlR.js";var S=c(),C=e(a(),1),w=i(),T=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`ico`,`bmp`,`tiff`,`tif`]),E=new Set([`mp4`,`webm`,`mov`,`avi`]);function D(e){let t=e.split(`.`).pop()?.toLowerCase()??``;return T.has(t)?`image`:E.has(t)?`video`:null}function O(e){return(e.split(`.`).pop()?.toLowerCase()??``)===`md`}function k(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 A(e,t){return`explorer-file:${e}:${t}`}function j(e){let t=(0,S.c)(10),{threadId:n,path:r,onContentReady:i}=e,a;t[0]!==r||t[1]!==n?(a=A(n,r),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o;t[3]!==r||t[4]!==n?(o=()=>x(n,r),t[3]=r,t[4]=n,t[5]=o):o=t[5];let s=u(a,o),c,l;return t[6]!==i||t[7]!==s.content?(c=()=>{i({content:s.content,original:s.content})},l=[i,s.content],t[6]=i,t[7]=s.content,t[8]=c,t[9]=l):(c=t[8],l=t[9]),(0,C.useLayoutEffect)(c,l),null}function M({selectedFile:e}){let{resolvedTheme:i}=m(),a=h(e=>e.selectedThreadId),c=(0,C.useRef)(null),[u,x]=(0,C.useState)(null),[S,T]=(0,C.useState)(!1),[E,M]=(0,C.useState)(`edit`),[N,P]=(0,C.useState)(0),F=e?.type===`file`&&a&&!D(e.path)?e:null,I=u?.content??``,L=u?.original??``,R=F?`${a}:${F.path}:${N}`:null;(0,C.useEffect)(()=>()=>{c.current&&=(c.current.getModel()?.dispose(),c.current.dispose(),null)},[]),(0,C.useEffect)(()=>{e?.type===`file`?M(O(e.path)?`view`:`edit`):M(`edit`),x(null)},[e?.path,a]);async function z(){if(!(!a||!e)){T(!0);try{await b(a,e.path,I),x({content:I,original:I}),_({title:`Saved`,description:`${e.name} saved successfully.`})}catch(e){_({title:`Error`,description:e instanceof Error?e.message:`Failed to save file`,variant:`destructive`})}finally{T(!1)}}}function B(){!a||!F||(p(A(a,F.path)),x(null),P(e=>e+1))}return a?(0,w.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,w.jsxs)(v,{className:`justify-between`,children:[(0,w.jsxs)(`div`,{className:`flex flex-col`,children:[(0,w.jsx)(`span`,{className:n(s.label,`text-foreground`),children:e?e.name:`Select a file to edit`}),(0,w.jsx)(`span`,{className:n(s.compact,`text-muted-foreground`),children:e?e.path:`Browse and edit repository files`})]}),F&&u?(0,w.jsxs)(`div`,{className:`flex gap-2`,children:[O(F.path)?(0,w.jsxs)(`div`,{className:`flex rounded-full border border-input bg-background p-0.5`,children:[(0,w.jsx)(r,{size:`sm`,variant:E===`view`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>M(`view`),children:`View`}),(0,w.jsx)(r,{size:`sm`,variant:E===`edit`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>M(`edit`),children:`Edit`})]}):null,(0,w.jsxs)(r,{size:`sm`,onClick:()=>void z(),disabled:S||!I||I===L,children:[S?(0,w.jsx)(o,{className:`h-4 w-4 animate-spin`}):null,`Save`]})]}):null]}),(0,w.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:(0,w.jsx)(`div`,{className:`h-full relative overflow-hidden`,children:F?(0,w.jsxs)(f,{fallbackTitle:`Failed to load file`,onRetry:B,children:[(0,w.jsx)(C.Suspense,{fallback:(0,w.jsx)(d,{}),children:(0,w.jsx)(j,{threadId:a,path:F.path,onContentReady:x},R??void 0)}),u?O(F.path)&&E===`view`?(0,w.jsx)(`div`,{className:`h-full overflow-auto p-6`,children:(0,w.jsx)(g,{content:I,enableMermaid:!0})}):(0,w.jsx)(l,{height:`100%`,language:k(F.path),value:I,onChange:e=>x(t=>t&&{...t,content:e??``}),onMount:e=>{c.current=e},theme:i===`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,w.jsx)(d,{})]}):e?.type===`file`&&D(e.path)===`image`?(0,w.jsx)(`div`,{className:`flex items-center justify-center h-full p-4 overflow-auto`,children:(0,w.jsx)(`img`,{src:y(a,e.path),alt:e.name,className:`max-w-full max-h-full object-contain`})}):e?.type===`file`&&D(e.path)===`video`?(0,w.jsx)(`div`,{className:`flex items-center justify-center h-full p-4`,children:(0,w.jsx)(`video`,{src:y(a,e.path),controls:!0,className:`max-w-full max-h-full`})}):(0,w.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center p-8`,children:[(0,w.jsx)(t,{className:`h-10 w-10 text-muted-foreground/50`}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:n(s.label,`text-muted-foreground`),children:`No file selected`}),(0,w.jsx)(`p`,{className:n(s.bodyMuted,`mt-1`),children:`Select a file from the tree to edit it`})]})]})})})]}):(0,w.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center`,children:[(0,w.jsx)(t,{className:`h-8 w-8 text-muted-foreground`}),(0,w.jsx)(`p`,{className:s.bodyMuted,children:`Select a thread to browse its files`})]})}export{M as default};
@@ -0,0 +1 @@
1
+ import{Qr as e,Xr as t,_r as n,br as r,gi as i,gr as a,hr as o,la as s,li as c,no as l,vr as u,yr as d}from"./dialogs-config-Ct6i8Iij.js";var f=l(),p=i();function m(i){let l=(0,f.c)(28),{open:m,onOpenChange:g,commits:_,displayedCommits:v,isLoadingMore:y,onScroll:b,currentBranch:x}=i,S;l[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,p.jsx)(r,{children:`Commit History`}),l[0]=S):S=l[0];let C;l[1]===x?C=l[2]:(C=(0,p.jsxs)(d,{children:[S,(0,p.jsxs)(n,{children:[`Recent commits on branch `,x]})]}),l[1]=x,l[2]=C);let w;l[3]===v?w=l[4]:(w=v.length>0?v.map(h):(0,p.jsx)(`p`,{className:e(c.bodyMuted,`text-center py-8`),children:`No commits found`}),l[3]=v,l[4]=w);let T;l[5]===y?T=l[6]:(T=y&&(0,p.jsx)(`div`,{className:`p-3 text-center`,children:(0,p.jsx)(s,{className:`h-4 w-4 animate-spin inline`})}),l[5]=y,l[6]=T);let E;l[7]!==_.length||l[8]!==v.length||l[9]!==y?(E=v.length<_.length&&!y&&(0,p.jsx)(`div`,{className:e(c.caption,`p-3 text-center`),children:`Scroll to load more`}),l[7]=_.length,l[8]=v.length,l[9]=y,l[10]=E):E=l[10];let D;l[11]!==w||l[12]!==T||l[13]!==E?(D=(0,p.jsxs)(`div`,{className:`divide-y`,children:[w,T,E]}),l[11]=w,l[12]=T,l[13]=E,l[14]=D):D=l[14];let O;l[15]!==b||l[16]!==D?(O=(0,p.jsx)(`div`,{className:`flex-1 overflow-y-auto border rounded-lg`,onScroll:b,children:D}),l[15]=b,l[16]=D,l[17]=O):O=l[17];let k;l[18]===g?k=l[19]:(k=(0,p.jsx)(u,{children:(0,p.jsx)(t,{onClick:()=>g(!1),children:`Close`})}),l[18]=g,l[19]=k);let A;l[20]!==C||l[21]!==O||l[22]!==k?(A=(0,p.jsxs)(a,{className:`max-w-2xl max-h-[80vh] flex flex-col`,children:[C,O,k]}),l[20]=C,l[21]=O,l[22]=k,l[23]=A):A=l[23];let j;return l[24]!==g||l[25]!==m||l[26]!==A?(j=(0,p.jsx)(o,{open:m,onOpenChange:g,children:A}),l[24]=g,l[25]=m,l[26]=A,l[27]=j):j=l[27],j}function h(t){return(0,p.jsxs)(`div`,{className:`p-3 hover:bg-muted/50 transition-colors`,children:[(0,p.jsx)(`p`,{className:e(c.label,`break-words`),children:t.message}),(0,p.jsxs)(`p`,{className:e(c.bodyMuted,`mt-1`),children:[(0,p.jsx)(`span`,{className:c.mono,children:t.hash.substring(0,7)}),` •`,` `,t.author,` • `,new Date(t.date).toLocaleDateString()]})]},t.hash)}export{m as GitHistoryDialog};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/commit-dialog-D4suPxEe.js","assets/index-6DhhjIBL.js","assets/rolldown-runtime-aKtaBQYM.js","assets/monaco-CZnIWXyV.js","assets/monaco-Br_kD0ds.css","assets/history-view-CFot099O.js","assets/dialogs-config-Ct6i8Iij.js","assets/onboarding-DHCR18iU.js","assets/whisper-wasm-Cq5Ofwpd.js","assets/react-vendor-CjZZeCRj.js","assets/utils-DDDR42pW.js","assets/index-sEZ3wJXu.css","assets/pull-request-dialog-Csql6eob.js","assets/create-repo-dialog-DPKIg1mY.js","assets/git-history-dialog-CDwIqSZQ.js","assets/push-before-pr-dialog-IhdlLvWt.js","assets/pull-with-changes-dialog-DN0kE6os.js","assets/merged-pr-dialog-H_fuSmiF.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$n as t,$t as n,C as r,Ct as i,Ka as ee,Lt as a,Ma as te,Qn as ne,Qr as o,Qt as s,Ti as c,Xr as re,Zn as ie,Zt as ae,an as oe,b as l,ct as u,d,en as se,eo as f,er as ce,gi as p,h as m,io as h,ja as g,la as le,li as _,ln as v,ma as ue,mi as y,nn as de,no as b,rn as x,sn as fe,u as S,ut as pe,va as me,xa as C,xt as w,y as T,ya as he,z as E}from"./dialogs-config-Ct6i8Iij.js";import{r as D}from"./monaco-CZnIWXyV.js";import{A as ge,O,T as k,_ as _e,f as A,g as ve,h as j,k as M,m as ye,p as be}from"./index-6DhhjIBL.js";var N=e(h(),1),P=p();function xe(e,t){return t?`Creating PR...`:e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits?`Sync`:e.hasChanges?`Commit`:e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits?`Open PR`:e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges?`Create PR`:e.hasUnpushedCommits&&e.prExists?`Update PR`:`Commit`}function F(e,t){return t?(0,P.jsx)(le,{className:`h-3.5 w-3.5 animate-spin`}):e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits?(0,P.jsx)(f,{className:`h-3.5 w-3.5`}):e.hasChanges?(0,P.jsx)(C,{className:`h-3.5 w-3.5`}):e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits?(0,P.jsx)(g,{className:`h-3.5 w-3.5`}):(0,P.jsx)(he,{className:`h-3.5 w-3.5`})}function Se(e){if(e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits){let t=e.defaultBranch??`main`;return e.currentBranch===e.defaultBranch?`Your branch is behind the remote. This will pull the latest changes from origin/${t}`:`Your branch "${e.currentBranch}" is behind "${t}". This will rebase and sync with the latest changes`}return e.hasChanges?e.changedFilesCount>0?`Commit ${e.changedFilesCount} changed file${e.changedFilesCount===1?``:`s`}`:`No changes to commit`:e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits?`View pull request in GitHub`:e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges?`Create pull request for committed changes`:e.hasUnpushedCommits&&e.prExists?`Update pull request with unpushed commits`:`No actions available`}function I(e,t,n=!1){return t||n?!0:e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits||e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges?!1:!e.hasChanges&&!e.hasUnpushedCommits}function L(e){return e.hasChanges||e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges}var Ce=b();function R(e){let n=(0,Ce.c)(80),{branchStatus:r,remoteUrl:i,hasRemoteBranch:a,hasUnpushedCommits:s,canCreateRepo:ae,repoUrl:oe,isRefreshing:l,isBrandState:u,gitUser:d,isDirectCommitMode:se,isLoading:p,isLoadingHistory:m,onFetch:h,onPull:v,onPush:y,onOpenHistory:de,onCreatePR:b,onCreateRepo:x,onViewInGitHub:fe,onOpenChange:S}=e,pe=`h-8 w-8 rounded-l-none px-1${u?` border-transparent bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground`:``}`,C;n[0]===l?C=n[1]:(C=l?(0,P.jsx)(le,{className:`h-3.5 w-3.5 animate-spin`}):(0,P.jsx)(ee,{className:`h-3.5 w-3.5`}),n[0]=l,n[1]=C);let w;n[2]!==p||n[3]!==pe||n[4]!==C?(w=(0,P.jsx)(_e,{asChild:!0,children:(0,P.jsx)(re,{variant:`outline`,size:`sm`,className:pe,disabled:p,children:C})}),n[2]=p,n[3]=pe,n[4]=C,n[5]=w):w=n[5];let T;n[6]!==r||n[7]!==i?(T=r===`Behind`&&(0,P.jsxs)(`div`,{className:o(_.compact,`px-2 py-1 text-amber-600`),children:[`Branch is behind `,i?`origin`:`remote`]}),n[6]=r,n[7]=i,n[8]=T):T=n[8];let E;n[9]===d?E=n[10]:(E=d&&(0,P.jsxs)(`div`,{className:o(_.compact,`px-2 py-1 text-muted-foreground`),children:[(0,P.jsx)(`span`,{className:`font-medium`,children:`User:`}),` `,d]}),n[9]=d,n[10]=E);let D;n[11]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,P.jsx)(ve,{}),n[11]=D):D=n[11];let ge;n[12]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,P.jsx)(te,{className:`h-3.5 w-3.5 mr-2`}),n[12]=ge):ge=n[12];let O;n[13]!==p||n[14]!==h?(O=(0,P.jsx)(ce,{asChild:!0,children:(0,P.jsxs)(j,{onClick:h,disabled:p,children:[ge,`Fetch`]})}),n[13]=p,n[14]=h,n[15]=O):O=n[15];let k;n[16]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,P.jsx)(ne,{side:`right`,children:`Download latest information from remote without merging changes`}),n[16]=k):k=n[16];let A;n[17]===O?A=n[18]:(A=(0,P.jsx)(t,{children:(0,P.jsxs)(ie,{children:[O,k]})}),n[17]=O,n[18]=A);let M;n[19]!==a||n[20]!==p||n[21]!==v?(M=()=>{a&&!p&&v()},n[19]=a,n[20]=p,n[21]=v,n[22]=M):M=n[22];let N=!a||p?`opacity-50 cursor-not-allowed`:``,xe;n[23]===Symbol.for(`react.memo_cache_sentinel`)?(xe=(0,P.jsx)(f,{className:`h-3.5 w-3.5 mr-2`}),n[23]=xe):xe=n[23];let F;n[24]!==M||n[25]!==N?(F=(0,P.jsx)(ce,{asChild:!0,children:(0,P.jsxs)(j,{onClick:M,className:N,children:[xe,`Pull`]})}),n[24]=M,n[25]=N,n[26]=F):F=n[26];let Se=a?`Pull latest changes from remote`:`No remote branch to pull from`,I;n[27]===Se?I=n[28]:(I=(0,P.jsx)(ne,{side:`right`,children:Se}),n[27]=Se,n[28]=I);let L;n[29]!==F||n[30]!==I?(L=(0,P.jsx)(t,{children:(0,P.jsxs)(ie,{children:[F,I]})}),n[29]=F,n[30]=I,n[31]=L):L=n[31];let R;n[32]!==a||n[33]!==p||n[34]!==y?(R=!a&&(0,P.jsx)(t,{children:(0,P.jsxs)(ie,{children:[(0,P.jsx)(ce,{asChild:!0,children:(0,P.jsxs)(j,{onClick:y,disabled:p,children:[(0,P.jsx)(c,{className:`h-3.5 w-3.5 mr-2`}),`Push Branch to Remote`]})}),(0,P.jsx)(ne,{side:`right`,children:`Create remote branch and push local commits`})]})}),n[32]=a,n[33]=p,n[34]=y,n[35]=R):R=n[35];let z;n[36]!==s||n[37]!==p||n[38]!==y?(z=()=>{s&&!p&&y()},n[36]=s,n[37]=p,n[38]=y,n[39]=z):z=n[39];let we=!s||p?`opacity-50 cursor-not-allowed`:``,B;n[40]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,P.jsx)(c,{className:`h-3.5 w-3.5 mr-2`}),n[40]=B):B=n[40];let V;n[41]!==z||n[42]!==we?(V=(0,P.jsx)(ce,{asChild:!0,children:(0,P.jsxs)(j,{onClick:z,className:we,children:[B,`Push Commits`]})}),n[41]=z,n[42]=we,n[43]=V):V=n[43];let Te=s?p?`Push in progress...`:`Push your uncommitted commits to the remote branch`:`No commits to push - your branch is up to date with remote`,H;n[44]===Te?H=n[45]:(H=(0,P.jsx)(ne,{side:`right`,children:Te}),n[44]=Te,n[45]=H);let U;n[46]!==V||n[47]!==H?(U=(0,P.jsx)(t,{children:(0,P.jsxs)(ie,{children:[V,H]})}),n[46]=V,n[47]=H,n[48]=U):U=n[48];let Ee=p||m,De;n[49]===Symbol.for(`react.memo_cache_sentinel`)?(De=(0,P.jsx)(ue,{className:`h-3.5 w-3.5 mr-2`}),n[49]=De):De=n[49];let W;n[50]!==de||n[51]!==Ee?(W=(0,P.jsxs)(j,{onClick:de,disabled:Ee,children:[De,`History`]}),n[50]=de,n[51]=Ee,n[52]=W):W=n[52];let G;n[53]!==se||n[54]!==p||n[55]!==b?(G=!se&&(0,P.jsxs)(j,{onClick:b,disabled:p,children:[(0,P.jsx)(he,{className:`h-3.5 w-3.5 mr-2`}),`Create Pull Request`]}),n[53]=se,n[54]=p,n[55]=b,n[56]=G):G=n[56];let K;n[57]!==ae||n[58]!==p||n[59]!==x?(K=ae&&(0,P.jsxs)(j,{onClick:x,disabled:p,children:[(0,P.jsx)(me,{className:`h-3.5 w-3.5 mr-2`}),`Create Repo`]}),n[57]=ae,n[58]=p,n[59]=x,n[60]=K):K=n[60];let q;n[61]!==p||n[62]!==fe||n[63]!==oe?(q=oe&&(0,P.jsxs)(j,{onClick:fe,disabled:p,children:[(0,P.jsx)(g,{className:`h-3.5 w-3.5 mr-2`}),`View in GitHub`]}),n[61]=p,n[62]=fe,n[63]=oe,n[64]=q):q=n[64];let J;n[65]!==A||n[66]!==L||n[67]!==R||n[68]!==U||n[69]!==W||n[70]!==G||n[71]!==K||n[72]!==q||n[73]!==T||n[74]!==E?(J=(0,P.jsxs)(ye,{align:`end`,children:[T,E,D,A,L,R,U,W,G,K,q]}),n[65]=A,n[66]=L,n[67]=R,n[68]=U,n[69]=W,n[70]=G,n[71]=K,n[72]=q,n[73]=T,n[74]=E,n[75]=J):J=n[75];let Y;return n[76]!==S||n[77]!==w||n[78]!==J?(Y=(0,P.jsxs)(be,{onOpenChange:S,children:[w,J]}),n[76]=S,n[77]=w,n[78]=J,n[79]=Y):Y=n[79],Y}function z(){return{autoGenerateCommitMessage:S(),autoGeneratePRInfo:d(),privateRepositoryDefault:m()}}function we(e){e.autoGenerateCommitMessage!==void 0&&T(e.autoGenerateCommitMessage),e.autoGeneratePRInfo!==void 0&&l(e.autoGeneratePRInfo),e.privateRepositoryDefault!==void 0&&r(e.privateRepositoryDefault)}function B(e){return e?!0:(k({title:`Error`,description:`No thread selected`,variant:`destructive`}),!1)}function V(e){let t=e.split(`/`);return t.length>=2?{provider:t[0],model:t.slice(1).join(`/`)}:{provider:void 0,model:e}}function Te(e,t,n){let[r,i]=(0,N.useState)(!1),[ee,a]=(0,N.useState)(!1),te=()=>n?.id?n.provider?{provider:n.provider,model:n.id}:V(n.id):{provider:void 0,model:void 0};return{isGeneratingMessage:r,isGeneratingPRInfo:ee,generateCommitMessageWithAI:(0,N.useCallback)(async()=>{if(!e)return null;try{i(!0);let{provider:t,model:n}=te();return await u(e,n,t)}catch(e){return console.error(`Failed to generate commit message:`,e),k({title:`Error`,description:e instanceof Error?e.message:`Failed to generate commit message`,variant:`destructive`}),null}finally{i(!1)}},[e,n]),generatePRInfoWithAI:(0,N.useCallback)(async()=>{if(!e)return null;try{a(!0);let{provider:t,model:n}=te();return await pe(e,n,t)}catch(e){return console.error(`Failed to generate PR info:`,e),k({title:`Error`,description:e instanceof Error?e.message:`Failed to generate PR info`,variant:`destructive`}),null}finally{a(!1)}},[e,n])}}var H=(0,N.lazy)(()=>D(()=>import(`./commit-dialog-D4suPxEe.js`).then(e=>({default:e.CommitDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))),U=(0,N.lazy)(()=>D(()=>import(`./pull-request-dialog-Csql6eob.js`).then(e=>({default:e.PullRequestDialog})),__vite__mapDeps([12,1,2,3,4,5,6,7,8,9,10,11]))),Ee=(0,N.lazy)(()=>D(()=>import(`./create-repo-dialog-DPKIg1mY.js`).then(e=>({default:e.CreateRepoDialog})),__vite__mapDeps([13,1,2,3,4,5,6,7,8,9,10,11]))),De=(0,N.lazy)(()=>D(()=>import(`./git-history-dialog-CDwIqSZQ.js`).then(e=>({default:e.GitHistoryDialog})),__vite__mapDeps([14,6,2]))),W=(0,N.lazy)(()=>D(()=>import(`./push-before-pr-dialog-IhdlLvWt.js`).then(e=>({default:e.PushBeforePRDialog})),__vite__mapDeps([15,6,2]))),G=(0,N.lazy)(()=>D(()=>import(`./pull-with-changes-dialog-DN0kE6os.js`).then(e=>({default:e.PullWithChangesDialog})),__vite__mapDeps([16,5,2,6]))),K=(0,N.lazy)(()=>D(()=>import(`./merged-pr-dialog-H_fuSmiF.js`).then(e=>({default:e.MergedPRDialog})),__vite__mapDeps([17,6,2])));function q(){return null}function J({projectId:e,threadId:r}){let ee=M(),te=ge(e=>e.projectModelSelections[r]),o=ge(t=>t.projects.find(t=>t.projectId===e)),[c,l]=(0,N.useState)(!1),[u,d]=(0,N.useState)(!1),[f,p]=(0,N.useState)(!1),[m,h]=(0,N.useState)(!1),[g,le]=(0,N.useState)(``),[_,ue]=(0,N.useState)(``),[b,S]=(0,N.useState)(``),[pe,me]=(0,N.useState)(!1),[C,T]=(0,N.useState)(null),he=(0,N.useRef)(!1),D=(0,N.useRef)(!1),_e=(0,N.useRef)(_),ve=(0,N.useRef)(b);_e.current=_,ve.current=b;let[j,ye]=(0,N.useState)(!1),[be,Ce]=(0,N.useState)([]),[V,J]=(0,N.useState)(!1),[Y,Oe]=(0,N.useState)([]),[ke,Ae]=(0,N.useState)(!1),[je,Me]=(0,N.useState)(!1),[Ne,Pe]=(0,N.useState)(``),[Fe,Ie]=(0,N.useState)(``),[Le,Re]=(0,N.useState)(``),[ze,Be]=(0,N.useState)(!1),[Ve,He]=(0,N.useState)(!1),[Ue,We]=(0,N.useState)(!1),[Ge,Ke]=(0,N.useState)(!1),X=A(),{fetchUnifiedStatus:qe}=X,Z=Te(r,e,te);async function Q(){fe();let e=await a();ee({type:O.SetProjects,projects:e.projects})}let[$,Je]=(0,N.useState)(()=>z()),Ye=o?.commitMethod===y.Direct;(0,N.useEffect)(()=>{je&&o?.name&&!Ne&&Pe(o.name)},[je,o?.name,Ne]),(0,N.useEffect)(()=>{we($)},[$]);function Xe(){ze||(Be(!0),i().then(e=>Re(e)).catch(()=>{}))}(0,N.useEffect)(()=>{if(!f){D.current=!1;return}if(f&&$.autoGenerateCommitMessage&&!g.trim()&&r&&!D.current){D.current=!0;async function e(){let e=await Z.generateCommitMessageWithAI();e&&le(e)}e()}},[f,$.autoGenerateCommitMessage,r,Z.generateCommitMessageWithAI,g]),(0,N.useEffect)(()=>{if(!m){he.current=!1;return}if(m&&$.autoGeneratePRInfo&&!_e.current.trim()&&!ve.current.trim()&&r&&!he.current){he.current=!0;async function e(){let e=await Z.generatePRInfoWithAI();e&&(ue(e.title),S(e.description),k({title:`Success`,description:`PR title and description generated`}))}e()}},[m,$.autoGeneratePRInfo,r,Z.generatePRInfoWithAI]),(0,N.useEffect)(()=>{X.prExists&&X.prState===`MERGED`&&Ke(!0),u&&X.prExists&&X.prState===`OPEN`&&d(!1)},[X.prExists,X.prState,r,u]),(0,N.useEffect)(()=>{if(!u)return;let e=setTimeout(()=>{d(!1)},15e3);return()=>clearTimeout(e)},[u]);async function Ze(){if(g.trim()&&B(r))try{l(!0),await ae(r,g),le(``),p(!1),await X.fetchUnifiedStatus(!0),Q(),k({title:`Changes committed successfully`,description:`Your changes have been committed to '${X.currentBranch}'.`}),Ue&&(We(!1),await rt())}catch(e){console.error(`Failed to commit:`,e),k({title:`Commit failed`,description:e instanceof Error?e.message:`Failed to commit changes`,variant:`destructive`})}finally{l(!1)}}async function Qe(){if(X.status===`Behind`&&!X.hasChanges&&!X.hasUnpushedCommits){await st();return}if(X.hasChanges){p(!0);return}if(X.prExists&&X.prState===`OPEN`&&!X.hasChanges&&!X.hasUnpushedCommits){X.prUrl&&await v(X.prUrl);return}if(X.commitsAheadOfDefault&&!X.prExists&&!X.hasChanges){h(!0);return}if(X.hasUnpushedCommits&&X.prExists){await tt();return}}async function $e(){let e=await Z.generateCommitMessageWithAI();e&&le(e)}async function et(){if(B(r))try{l(!0),await se(r),await X.fetchUnifiedStatus()}catch(e){console.error(`Failed to fetch:`,e)}finally{l(!1)}}async function tt(){if(B(r))try{l(!0),await x(r),await X.fetchUnifiedStatus(!0),Q(),X.hasRemoteBranch?k({title:`Branch pushed successfully`,description:`Your branch '${X.currentBranch}' has been pushed to the remote.`}):k({title:`Push completed`,description:`Changes have been pushed successfully.`})}catch(e){console.error(`Failed to push:`,e),k({title:`Push failed`,description:e instanceof Error?e.message:`Failed to push to remote`,variant:`destructive`})}finally{l(!1)}}async function nt(){if(B(r)){if(X.hasChanges){He(!0);return}await rt()}}async function rt(){try{l(!0),await de(r),await X.fetchUnifiedStatus(!0),Q(),k({title:`Pull successful`,description:`Latest changes have been pulled from remote.`})}catch(e){console.error(`Failed to pull:`,e),k({title:`Pull failed`,description:e instanceof Error?e.message:`Failed to pull from remote`,variant:`destructive`})}finally{l(!1)}}function it(){He(!1),We(!0),p(!0)}async function at(){He(!1),await rt()}async function ot(){if(r)try{l(!0);let e=await s(r);fe();let t=await a();ee({type:O.SetProjects,projects:t.projects}),k({title:`New branch created`,description:`Created new branch "${e.branchName}" on current thread`}),Ke(!1),await X.fetchUnifiedStatus(!0),setTimeout(()=>void X.fetchUnifiedStatus(!0),1500)}catch(e){console.error(`Failed to create new branch:`,e),k({title:`Failed to create new branch`,description:e instanceof Error?e.message:`Unknown error occurred`,variant:`destructive`})}finally{l(!1)}}async function st(){if(B(r))try{l(!0),await oe(r),await X.fetchUnifiedStatus(!0),Q(),k({title:`Branch synced successfully`,description:`Your branch '${X.currentBranch}' has been synced with the latest changes`})}catch(e){console.error(`[sync] ✗ Failed to sync branch:`,e),k({title:`Sync failed`,description:e instanceof Error?e.message:`Failed to sync with default branch`,variant:`destructive`})}finally{l(!1)}}async function ct(){if(B(r))try{l(!0),d(!0);let e=await n(r,_,b);e.prUrl&&await v(e.prUrl),ue(``),S(``),h(!1),await X.fetchUnifiedStatus(!0),Q();let t=0,i=setInterval(async()=>{if(t++,t>=6){clearInterval(i);return}await X.fetchUnifiedStatus(!0)},2e3)}catch(e){console.error(`Failed to create PR:`,e);let t=e instanceof Error?e.message:`Failed to create PR`;t.includes(`push the current branch`)||t.includes(`--head flag`)?(h(!1),dt({title:_,description:b})):(d(!1),k({title:`Create PR Failed`,description:t,variant:`destructive`}))}finally{l(!1)}}async function lt(){if(B(r))try{l(!0);let e=await E(r,Ne,Fe,$.privateRepositoryDefault);e.repoUrl&&setTimeout(()=>{v(e.repoUrl)},3e3),Pe(``),Ie(``),Me(!1),await X.fetchUnifiedStatus(),Q()}catch(e){console.error(`Failed to create repo:`,e)}finally{l(!1)}}async function ut(){let e=await Z.generatePRInfoWithAI();e&&(ue(e.title),S(e.description),k({title:`Success`,description:`PR title and description generated`}))}async function dt(e){let t=e??C;if(!(!r||!t))try{l(!0),d(!0);try{await x(r)}catch(e){let t=e?.message??``;if(t.includes(`non-fast-forward`)||t.includes(`Updates were rejected because the tip of your current branch is behind`)){k({title:`Syncing branch before push`,description:`Your branch is behind remote. Pulling latest changes first...`});try{await oe(r),await x(r)}catch{throw e}}else throw e}let e=await n(r,t.title,t.description);e.prUrl&&await v(e.prUrl),ue(``),S(``),T(null),me(!1),await X.fetchUnifiedStatus(!0),Q();let i=0,ee=setInterval(async()=>{if(i++,i>=6){clearInterval(ee);return}await X.fetchUnifiedStatus(!0)},2e3)}catch(e){console.error(`Failed to push and create PR:`,e);let t=e instanceof Error?e.message:`Failed to push and create PR`;d(!1),k({title:`Push & Create PR Failed`,description:t,variant:`destructive`})}finally{l(!1)}}async function ft(){if(B(r))try{J(!0);let e=await w(r,100);Ce(e),Oe(e.slice(0,10)),ye(!0)}catch(e){console.error(`Failed to fetch git history:`,e)}finally{J(!1)}}function pt(){ke||(Ae(!0),setTimeout(()=>{let e=Y.length+10;Oe(be.slice(0,e)),Ae(!1)},300))}function mt(e){let t=e.currentTarget;t.scrollHeight-t.scrollTop-t.clientHeight<100&&Y.length<be.length&&!ke&&pt()}let ht=L(X);function gt(){X.repoUrl&&v(X.repoUrl)}function _t(){me(!1),T(null)}function vt(){Ke(!1),X.fetchUnifiedStatus(!0)}return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-0`,children:[(0,P.jsx)(t,{children:(0,P.jsxs)(ie,{children:[(0,P.jsx)(ce,{asChild:!0,children:(0,P.jsxs)(re,{variant:`outline`,size:`sm`,className:`h-8 rounded-r-none border-r-0 gap-1.5${ht?` border-transparent bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground`:``}`,disabled:I(X,c,u),onClick:Qe,children:[F(X,u),xe(X,u)]})}),(0,P.jsx)(ne,{children:Se(X)})]})}),(0,P.jsx)(R,{branchStatus:X.status,remoteUrl:X.remoteUrl,hasRemoteBranch:X.hasRemoteBranch,hasUnpushedCommits:X.hasUnpushedCommits,canCreateRepo:X.canCreateRepo,repoUrl:X.repoUrl,isRefreshing:X.isRefreshing,isBrandState:ht,gitUser:Le,isDirectCommitMode:Ye,isLoading:c||u,isLoadingHistory:V,onFetch:()=>void et(),onPull:()=>void nt(),onPush:()=>void tt(),onOpenHistory:()=>void ft(),onCreatePR:()=>h(!0),onCreateRepo:()=>Me(!0),onViewInGitHub:gt,onOpenChange:e=>{e&&(Xe(),qe(!0))}})]}),f&&(0,P.jsx)(N.Suspense,{fallback:(0,P.jsx)(q,{}),children:(0,P.jsx)(H,{open:f,onOpenChange:p,commitMessage:g,onCommitMessageChange:le,autoGenerateCommitMessage:$.autoGenerateCommitMessage,onAutoGenerateChange:e=>Je(t=>({...t,autoGenerateCommitMessage:e})),isGeneratingMessage:Z.isGeneratingMessage,isLoading:c,onGenerateMessage:$e,onCommit:Ze,currentBranch:X.currentBranch})}),m&&(0,P.jsx)(N.Suspense,{fallback:(0,P.jsx)(q,{}),children:(0,P.jsx)(U,{open:m,onOpenChange:h,prTitle:_,onPrTitleChange:ue,prDescription:b,onPrDescriptionChange:S,isGeneratingPRInfo:Z.isGeneratingPRInfo,isLoading:c,onGeneratePRInfo:ut,onCreatePR:ct,currentBranch:X.currentBranch,autoGeneratePRInfo:$.autoGeneratePRInfo,onAutoGeneratePRInfoChange:e=>Je(t=>({...t,autoGeneratePRInfo:e}))})}),pe&&(0,P.jsx)(N.Suspense,{fallback:(0,P.jsx)(q,{}),children:(0,P.jsx)(W,{open:pe,onOpenChange:me,isLoading:c,onPushAndCreatePR:dt,onCancel:_t})}),je&&(0,P.jsx)(N.Suspense,{fallback:(0,P.jsx)(q,{}),children:(0,P.jsx)(Ee,{open:je,onOpenChange:Me,repoName:Ne,onRepoNameChange:Pe,repoDescription:Fe,onRepoDescriptionChange:Ie,isPrivateRepo:$.privateRepositoryDefault,onPrivateRepoChange:e=>Je(t=>({...t,privateRepositoryDefault:e})),isLoading:c,onCreateRepo:lt})}),j&&(0,P.jsx)(N.Suspense,{fallback:(0,P.jsx)(q,{}),children:(0,P.jsx)(De,{open:j,onOpenChange:ye,commits:be,displayedCommits:Y,isLoadingMore:ke,onScroll:mt,currentBranch:X.currentBranch})}),Ve&&(0,P.jsx)(N.Suspense,{fallback:(0,P.jsx)(q,{}),children:(0,P.jsx)(G,{open:Ve,onOpenChange:He,onCommitFirst:it,onStashAndPull:at,onCancel:()=>He(!1),isLoading:c})}),Ge&&(0,P.jsx)(N.Suspense,{fallback:(0,P.jsx)(q,{}),children:(0,P.jsx)(K,{open:Ge,onOpenChange:Ke,onNewBranch:ot,onJustOpen:vt,isLoading:c})})]})}export{J as GitOpsButton};
@@ -0,0 +1,7 @@
1
+ import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{$n as n,Ar as r,Br as i,Cr as a,Dr as o,Er as s,Fa as c,Fr as l,Ga as u,Gr as d,Ir as f,Jr as p,Ka as m,Kr as h,Mr as g,N as _,Nr as v,Oi as y,Or as b,Qn as x,Qr as S,Rr as C,Sr as w,Tr as T,Ua as E,Ur as D,Vr as O,Wa as ee,Wr as k,Xr as A,Yr as j,Zn as M,Zr as N,ar as te,ci as P,dr as F,er as ne,gi as I,io as L,ir as R,jr as re,kr as ie,la as ae,li as z,lr as oe,no as se,or as ce,qa as le,qr as B,ro as ue,rr as de,s as fe,sr as pe,tr as me,ur as he,vi as V,wr as ge,xi as _e,xr as ve,yt as ye}from"./dialogs-config-Ct6i8Iij.js";var H=se(),U=e(L(),1),W=I(),be=`AlertDialog`,[xe,Se]=p(be,[r]),G=r(),Ce=e=>{let{__scopeAlertDialog:t,...n}=e,r=G(t);return(0,W.jsx)(s,{...r,...n,modal:!0})};Ce.displayName=be;var we=`AlertDialogTrigger`,Te=U.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=G(n);return(0,W.jsx)(b,{...i,...r,ref:t})});Te.displayName=we;var Ee=`AlertDialogPortal`,De=e=>{let{__scopeAlertDialog:t,...n}=e,r=G(t);return(0,W.jsx)(T,{...r,...n})};De.displayName=Ee;var Oe=`AlertDialogOverlay`,ke=U.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=G(n);return(0,W.jsx)(ge,{...i,...r,ref:t})});ke.displayName=Oe;var K=`AlertDialogContent`,[Ae,je]=xe(K),Me=k(`AlertDialogContent`),Ne=U.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,a=G(n),o=U.useRef(null),s=V(t,o),c=U.useRef(null);return(0,W.jsx)(ie,{contentName:K,titleName:Pe,docsSlug:`alert-dialog`,children:(0,W.jsx)(Ae,{scope:n,cancelRef:c,children:(0,W.jsxs)(w,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:j(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,W.jsx)(Me,{children:r}),(0,W.jsx)(He,{contentRef:o})]})})})});Ne.displayName=K;var Pe=`AlertDialogTitle`,Fe=U.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=G(n);return(0,W.jsx)(o,{...i,...r,ref:t})});Fe.displayName=Pe;var Ie=`AlertDialogDescription`,Le=U.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=G(n);return(0,W.jsx)(a,{...i,...r,ref:t})});Le.displayName=Ie;var Re=`AlertDialogAction`,ze=U.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=G(n);return(0,W.jsx)(ve,{...i,...r,ref:t})});ze.displayName=Re;var Be=`AlertDialogCancel`,Ve=U.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=je(Be,n),a=G(n),o=V(t,i);return(0,W.jsx)(ve,{...a,...r,ref:o})});Ve.displayName=Be;var He=({contentRef:e})=>{let t=`\`${K}\` requires a description for the component to be accessible for screen reader users.
2
+
3
+ You can add a description to the \`${K}\` by passing a \`${Ie}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
4
+
5
+ Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${K}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
6
+
7
+ For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return U.useEffect(()=>{document.getElementById(e.current?.getAttribute(`aria-describedby`))||console.warn(t)},[t,e]),null},Ue=Ce,We=De,Ge=ke,Ke=Ne,qe=ze,Je=Ve,Ye=Fe,Xe=Le,Ze=Ue,Qe=We,$e=U.forwardRef((e,t)=>{let n=(0,H.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=S(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(Ge,{className:a,...i,ref:t}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});$e.displayName=Ge.displayName;var et=U.forwardRef((e,t)=>{let n=(0,H.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]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,W.jsx)($e,{}),n[3]=a):a=n[3];let o;n[4]===r?o=n[5]:(o=S(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,r),n[4]=r,n[5]=o);let s;return n[6]!==i||n[7]!==t||n[8]!==o?(s=(0,W.jsxs)(Qe,{children:[a,(0,W.jsx)(Ke,{ref:t,className:o,...i})]}),n[6]=i,n[7]=t,n[8]=o,n[9]=s):s=n[9],s});et.displayName=Ke.displayName;var tt=e=>{let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=S(`flex flex-col space-y-2 text-center sm:text-left`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,W.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};tt.displayName=`AlertDialogHeader`;var nt=e=>{let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=S(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,W.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};nt.displayName=`AlertDialogFooter`;var rt=U.forwardRef((e,t)=>{let n=(0,H.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=S(z.dialogTitle,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(Ye,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});rt.displayName=Ye.displayName;var it=U.forwardRef((e,t)=>{let n=(0,H.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=S(z.dialogDescription,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(Xe,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});it.displayName=Xe.displayName;var at=U.forwardRef((e,t)=>{let n=(0,H.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=S(N(),r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(qe,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});at.displayName=qe.displayName;var ot=U.forwardRef((e,t)=>{let n=(0,H.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=S(N({variant:`outline`}),`mt-2 sm:mt-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(Je,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ot.displayName=Je.displayName;function st(e){let t=(0,H.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=S(P.settingsPage,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,W.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function ct(e){let t=(0,H.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=S(P.accountPage,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,W.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function lt(e){let t=(0,H.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=S(P.formPage,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,W.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function ut(e){let t=(0,H.c)(16),{title:n,description:r,action:i,className:a,titleClassName:o}=e,s;t[0]===a?s=t[1]:(s=S(`flex items-center justify-between mb-6`,a),t[0]=a,t[1]=s);let c;t[2]===o?c=t[3]:(c=S(z.pageTitle,o),t[2]=o,t[3]=c);let l;t[4]!==c||t[5]!==n?(l=(0,W.jsx)(`h1`,{className:c,children:n}),t[4]=c,t[5]=n,t[6]=l):l=t[6];let u;t[7]===r?u=t[8]:(u=r?(0,W.jsx)(`p`,{className:z.pageSubtitle,children:r}):null,t[7]=r,t[8]=u);let d;t[9]!==l||t[10]!==u?(d=(0,W.jsxs)(`div`,{children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11];let f;return t[12]!==i||t[13]!==s||t[14]!==d?(f=(0,W.jsxs)(`div`,{className:s,children:[d,i]}),t[12]=i,t[13]=s,t[14]=d,t[15]=f):f=t[15],f}function dt(e){let t=(0,H.c)(5),{title:n,className:r}=e,i;t[0]===r?i=t[1]:(i=S(z.sectionTitle,`mb-3`,r),t[0]=r,t[1]=i);let a;return t[2]!==i||t[3]!==n?(a=(0,W.jsx)(`h2`,{className:i,children:n}),t[2]=i,t[3]=n,t[4]=a):a=t[4],a}function ft(e){let t=(0,H.c)(6),{children:n,variant:r,className:i}=e,a=r===void 0?`info`:r,o;t[0]!==i||t[1]!==a?(o=S(a===`hint`?z.hintBanner:a===`success`?S(z.body,`text-green-700 bg-green-50 dark:text-green-400 dark:bg-green-950/30 rounded-md px-3 py-2 mb-4`):a===`error`?S(z.error,`bg-destructive/10 rounded-md px-3 py-2 mb-4`):z.infoBanner,i),t[0]=i,t[1]=a,t[2]=o):o=t[2];let s;return t[3]!==n||t[4]!==o?(s=(0,W.jsx)(`div`,{className:o,children:n}),t[3]=n,t[4]=o,t[5]=s):s=t[5],s}function pt(e){let t=(0,H.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=S(`flex-1 overflow-auto`,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,W.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function mt(e){let t=(0,H.c)(10),{children:n,title:r,action:i}=e,a;t[0]===r?a=t[1]:(a=r?(0,W.jsx)(`h2`,{className:S(z.emptyStateTitle,`mb-2`),children:r}):null,t[0]=r,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,W.jsx)(`p`,{className:z.bodyMuted,children:n}),t[2]=n,t[3]=o);let s;t[4]===i?s=t[5]:(s=i?(0,W.jsx)(`div`,{className:`mt-4`,children:i}):null,t[4]=i,t[5]=s);let c;return t[6]!==a||t[7]!==o||t[8]!==s?(c=(0,W.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,W.jsxs)(`div`,{className:`text-center`,children:[a,o,s]})}),t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function ht(e){let t=(0,H.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=S(`h-full flex flex-col overflow-hidden`,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,W.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function gt(e){let t=(0,H.c)(14),{title:n,description:r,action:i,children:a,className:o}=e,s;t[0]===n?s=t[1]:(s=(0,W.jsx)(dt,{title:n,className:`mb-1`}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=r?(0,W.jsx)(`p`,{className:z.bodyMuted,children:r}):null,t[2]=r,t[3]=c);let l;t[4]!==s||t[5]!==c?(l=(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[s,c]}),t[4]=s,t[5]=c,t[6]=l):l=t[6];let u;t[7]!==i||t[8]!==l?(u=(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-4 mb-3`,children:[l,i]}),t[7]=i,t[8]=l,t[9]=u):u=t[9];let d;return t[10]!==a||t[11]!==o||t[12]!==u?(d=(0,W.jsxs)(`div`,{className:o,children:[u,a]}),t[10]=a,t[11]=o,t[12]=u,t[13]=d):d=t[13],d}var _t=e(ue(),1);function vt(e){let t=U.useRef({value:e,previous:e});return U.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var yt=[` `,`Enter`,`ArrowUp`,`ArrowDown`],bt=[` `,`Enter`],q=`Select`,[xt,St,Ct]=fe(q),[wt,Tt]=p(q,[Ct,pe]),Et=pe(),[Dt,J]=wt(q),[Ot,kt]=wt(q),At=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:f,disabled:p,required:m,form:g}=e,_=Et(t),[v,y]=U.useState(null),[b,x]=U.useState(null),[S,C]=U.useState(!1),w=F(l),[T,E]=d({prop:r,defaultProp:i??!1,onChange:a,caller:q}),[D,O]=d({prop:o,defaultProp:s,onChange:c,caller:q}),ee=U.useRef(null),k=v?g||!!v.closest(`form`):!0,[A,j]=U.useState(new Set),M=Array.from(A).map(e=>e.props.value).join(`;`);return(0,W.jsx)(ce,{..._,children:(0,W.jsxs)(Dt,{required:m,scope:t,trigger:v,onTriggerChange:y,valueNode:b,onValueNodeChange:x,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:h(),value:D,onValueChange:O,open:T,onOpenChange:E,dir:w,triggerPointerDownPosRef:ee,disabled:p,children:[(0,W.jsx)(xt.Provider,{scope:t,children:(0,W.jsx)(Ot,{scope:e.__scopeSelect,onNativeOptionAdd:U.useCallback(e=>{j(t=>new Set(t).add(e))},[]),onNativeOptionRemove:U.useCallback(e=>{j(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),k?(0,W.jsxs)(Cn,{"aria-hidden":!0,required:m,tabIndex:-1,name:u,autoComplete:f,value:D,onChange:e=>O(e.target.value),disabled:p,form:g,children:[D===void 0?(0,W.jsx)(`option`,{value:``}):null,Array.from(A)]},M):null]})})};At.displayName=q;var jt=`SelectTrigger`,Mt=U.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=Et(n),o=J(jt,n),s=o.disabled||r,c=V(t,o.onTriggerChange),l=St(n),u=U.useRef(`touch`),[d,f,p]=Tn(e=>{let t=l().filter(e=>!e.disabled),n=En(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,W.jsx)(de,{asChild:!0,...a,children:(0,W.jsx)(O.button,{type:`button`,role:`combobox`,"aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":wn(o.value)?``:void 0,...i,ref:c,onClick:j(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:j(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:j(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&yt.includes(e.key)&&(m(),e.preventDefault())})})})});Mt.displayName=jt;var Nt=`SelectValue`,Pt=U.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=J(Nt,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=V(t,c.onValueNodeChange);return B(()=>{l(u)},[l,u]),(0,W.jsx)(O.span,{...s,ref:d,style:{pointerEvents:`none`},children:wn(c.value)?(0,W.jsx)(W.Fragment,{children:o}):a})});Pt.displayName=Nt;var Ft=`SelectIcon`,It=U.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,W.jsx)(O.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});It.displayName=Ft;var Lt=`SelectPortal`,Rt=e=>(0,W.jsx)(l,{asChild:!0,...e});Rt.displayName=Lt;var Y=`SelectContent`,zt=U.forwardRef((e,t)=>{let n=J(Y,e.__scopeSelect),[r,i]=U.useState();if(B(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?_t.createPortal((0,W.jsx)(Bt,{scope:e.__scopeSelect,children:(0,W.jsx)(xt.Slot,{scope:e.__scopeSelect,children:(0,W.jsx)(`div`,{children:e.children})})}),t):null}return(0,W.jsx)(Ut,{...e,ref:t})});zt.displayName=Y;var X=10,[Bt,Z]=wt(Y),Vt=`SelectContentImpl`,Ht=D(`SelectContent.RemoveScroll`),Ut=U.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:p,collisionPadding:m,sticky:h,hideWhenDetached:_,avoidCollisions:y,...b}=e,x=J(Y,n),[S,w]=U.useState(null),[T,E]=U.useState(null),D=V(t,e=>w(e)),[O,ee]=U.useState(null),[k,A]=U.useState(null),M=St(n),[N,te]=U.useState(!1),P=U.useRef(!1);U.useEffect(()=>{if(S)return re(S)},[S]),v();let F=U.useCallback(e=>{let[t,...n]=M().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&T&&(T.scrollTop=0),n===r&&T&&(T.scrollTop=T.scrollHeight),n?.focus(),document.activeElement!==i))return},[M,T]),ne=U.useCallback(()=>F([O,S]),[F,O,S]);U.useEffect(()=>{N&&ne()},[N,ne]);let{onOpenChange:I,triggerPointerDownPosRef:L}=x;U.useEffect(()=>{if(S){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(L.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(L.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():S.contains(n.target)||I(!1),document.removeEventListener(`pointermove`,t),L.current=null};return L.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[S,I,L]),U.useEffect(()=>{let e=()=>I(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[I]);let[R,ie]=Tn(e=>{let t=M().filter(e=>!e.disabled),n=En(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),ae=U.useCallback((e,t,n)=>{let r=!P.current&&!n;(x.value!==void 0&&x.value===t||r)&&(ee(e),r&&(P.current=!0))},[x.value]),z=U.useCallback(()=>S?.focus(),[S]),oe=U.useCallback((e,t,n)=>{let r=!P.current&&!n;(x.value!==void 0&&x.value===t||r)&&A(e)},[x.value]),se=r===`popper`?qt:Gt,ce=se===qt?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:p,collisionPadding:m,sticky:h,hideWhenDetached:_,avoidCollisions:y}:{};return(0,W.jsx)(Bt,{scope:n,content:S,viewport:T,onViewportChange:E,itemRefCallback:ae,selectedItem:O,onItemLeave:z,itemTextRefCallback:oe,focusSelectedItem:ne,selectedItemText:k,position:r,isPositioned:N,searchRef:R,children:(0,W.jsx)(g,{as:Ht,allowPinchZoom:!0,children:(0,W.jsx)(f,{asChild:!0,trapped:x.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:j(i,e=>{x.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,W.jsx)(C,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:(0,W.jsx)(se,{role:`listbox`,id:x.contentId,"data-state":x.open?`open`:`closed`,dir:x.dir,onContextMenu:e=>e.preventDefault(),...b,...ce,onPlaced:()=>te(!0),ref:D,style:{display:`flex`,flexDirection:`column`,outline:`none`,...b.style},onKeyDown:j(b.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ie(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=M().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()}})})})})})})});Ut.displayName=Vt;var Wt=`SelectItemAlignedPosition`,Gt=U.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=J(Y,n),o=Z(Y,n),[s,c]=U.useState(null),[l,u]=U.useState(null),d=V(t,e=>u(e)),f=St(n),p=U.useRef(!1),m=U.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=U.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-X,d=he(a,[X,Math.max(X,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-X,d=he(a,[X,Math.max(X,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-X*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-X,D=c-E,O=g.offsetHeight/2,ee=g.offsetTop+O,k=m+v+ee,A=x-k;if(k<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=k+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+A;s.style.height=t+`px`,h.scrollTop=k-E+h.offsetTop}s.style.margin=`${X}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);B(()=>y(),[y]);let[b,x]=U.useState();return B(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]),(0,W.jsx)(Jt,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:U.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,W.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,W.jsx)(O.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});Gt.displayName=Wt;var Kt=`SelectPopperPosition`,qt=U.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=X,...a}=e,o=Et(n);return(0,W.jsx)(te,{...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)`}})});qt.displayName=Kt;var[Jt,Yt]=wt(Y,{}),Xt=`SelectViewport`,Zt=U.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=Z(Xt,n),o=Yt(Xt,n),s=V(t,a.onViewportChange),c=U.useRef(0);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,W.jsx)(xt.Slot,{scope:n,children:(0,W.jsx)(O.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:j(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-X*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`)}}}c.current=t.scrollTop})})})]})});Zt.displayName=Xt;var Qt=`SelectGroup`,[$t,en]=wt(Qt),tn=U.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=h();return(0,W.jsx)($t,{scope:n,id:i,children:(0,W.jsx)(O.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});tn.displayName=Qt;var nn=`SelectLabel`,rn=U.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=en(nn,n);return(0,W.jsx)(O.div,{id:i.id,...r,ref:t})});rn.displayName=nn;var an=`SelectItem`,[on,sn]=wt(an),cn=U.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=J(an,n),c=Z(an,n),l=s.value===r,[u,d]=U.useState(a??``),[f,p]=U.useState(!1),m=V(t,e=>c.itemRefCallback?.(e,r,i)),g=h(),_=U.useRef(`touch`),v=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r===``)throw Error(`A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,W.jsx)(on,{scope:n,value:r,disabled:i,textId:g,isSelected:l,onItemTextChange:U.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,W.jsx)(xt.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,W.jsx)(O.div,{role:`option`,"aria-labelledby":g,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:j(o.onFocus,()=>p(!0)),onBlur:j(o.onBlur,()=>p(!1)),onClick:j(o.onClick,()=>{_.current!==`mouse`&&v()}),onPointerUp:j(o.onPointerUp,()=>{_.current===`mouse`&&v()}),onPointerDown:j(o.onPointerDown,e=>{_.current=e.pointerType}),onPointerMove:j(o.onPointerMove,e=>{_.current=e.pointerType,i?c.onItemLeave?.():_.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:j(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:j(o.onKeyDown,e=>{c.searchRef?.current!==``&&e.key===` `||(bt.includes(e.key)&&v(),e.key===` `&&e.preventDefault())})})})})});cn.displayName=an;var ln=`SelectItemText`,un=U.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=J(ln,n),s=Z(ln,n),c=sn(ln,n),l=kt(ln,n),[u,d]=U.useState(null),f=V(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=U.useMemo(()=>(0,W.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return B(()=>(h(m),()=>g(m)),[h,g,m]),(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(O.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?_t.createPortal(a.children,o.valueNode):null]})});un.displayName=ln;var dn=`SelectItemIndicator`,fn=U.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return sn(dn,n).isSelected?(0,W.jsx)(O.span,{"aria-hidden":!0,...r,ref:t}):null});fn.displayName=dn;var pn=`SelectScrollUpButton`,mn=U.forwardRef((e,t)=>{let n=Z(pn,e.__scopeSelect),r=Yt(pn,e.__scopeSelect),[i,a]=U.useState(!1),o=V(t,r.onScrollButtonChange);return B(()=>{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,W.jsx)(_n,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});mn.displayName=pn;var hn=`SelectScrollDownButton`,gn=U.forwardRef((e,t)=>{let n=Z(hn,e.__scopeSelect),r=Yt(hn,e.__scopeSelect),[i,a]=U.useState(!1),o=V(t,r.onScrollButtonChange);return B(()=>{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,W.jsx)(_n,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});gn.displayName=hn;var _n=U.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Z(`SelectScrollButton`,n),o=U.useRef(null),s=St(n),c=U.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return U.useEffect(()=>()=>c(),[c]),B(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,W.jsx)(O.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:j(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:j(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:j(i.onPointerLeave,()=>{c()})})}),vn=`SelectSeparator`,yn=U.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,W.jsx)(O.div,{"aria-hidden":!0,...r,ref:t})});yn.displayName=vn;var bn=`SelectArrow`,xn=U.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Et(n),a=J(bn,n),o=Z(bn,n);return a.open&&o.position===`popper`?(0,W.jsx)(R,{...i,...r,ref:t}):null});xn.displayName=bn;var Sn=`SelectBubbleInput`,Cn=U.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=U.useRef(null),a=V(r,i),o=vt(t);return U.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,W.jsx)(O.select,{...n,style:{...me,...n.style},ref:a,defaultValue:t})});Cn.displayName=Sn;function wn(e){return e===``||e===void 0}function Tn(e){let t=i(e),n=U.useRef(``),r=U.useRef(0),a=U.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]),o=U.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return U.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,a,o]}function En(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=Dn(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 Dn(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var On=At,kn=Mt,An=Pt,jn=It,Mn=Rt,Nn=zt,Pn=Zt,Fn=rn,In=cn,Ln=un,Rn=fn,zn=mn,Bn=gn,Vn=yn,Hn=On,Un=An,Wn=U.forwardRef((e,t)=>{let n=(0,H.c)(12),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]===i?o=n[5]:(o=S(`flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,i),n[4]=i,n[5]=o);let s;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,W.jsx)(jn,{asChild:!0,children:(0,W.jsx)(m,{className:`h-4 w-4 opacity-50`})}),n[6]=s):s=n[6];let c;return n[7]!==r||n[8]!==a||n[9]!==t||n[10]!==o?(c=(0,W.jsxs)(kn,{ref:t,className:o,...a,children:[r,s]}),n[7]=r,n[8]=a,n[9]=t,n[10]=o,n[11]=c):c=n[11],c});Wn.displayName=kn.displayName;var Gn=U.forwardRef((e,t)=>{let n=(0,H.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=S(`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,W.jsx)(E,{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,W.jsx)(zn,{ref:t,className:a,...i,children:o}),n[6]=i,n[7]=t,n[8]=a,n[9]=s):s=n[9],s});Gn.displayName=zn.displayName;var Kn=U.forwardRef((e,t)=>{let n=(0,H.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=S(`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,W.jsx)(m,{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,W.jsx)(Bn,{ref:t,className:a,...i,children:o}),n[6]=i,n[7]=t,n[8]=a,n[9]=s):s=n[9],s});Kn.displayName=Bn.displayName;var qn=U.forwardRef((e,t)=>{let n=(0,H.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=S(`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,W.jsx)(Gn,{}),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)]`,f;n[9]===d?f=n[10]:(f=S(`p-1`,d),n[9]=d,n[10]=f);let p;n[11]!==r||n[12]!==f?(p=(0,W.jsx)(Pn,{className:f,children:r}),n[11]=r,n[12]=f,n[13]=p):p=n[13];let m;n[14]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,W.jsx)(Kn,{}),n[14]=m):m=n[14];let h;return n[15]!==s||n[16]!==a||n[17]!==t||n[18]!==l||n[19]!==p?(h=(0,W.jsx)(Mn,{children:(0,W.jsxs)(Nn,{ref:t,className:l,position:s,...a,children:[u,p,m]})}),n[15]=s,n[16]=a,n[17]=t,n[18]=l,n[19]=p,n[20]=h):h=n[20],h});qn.displayName=Nn.displayName;var Jn=U.forwardRef((e,t)=>{let n=(0,H.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=S(`py-1.5 pl-8 pr-2 text-base font-semibold`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(Fn,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Jn.displayName=Fn.displayName;var Yn=U.forwardRef((e,t)=>{let n=(0,H.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=S(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-base 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,W.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,W.jsx)(Rn,{children:(0,W.jsx)(le,{className:`h-4 w-4`})})}),n[6]=s):s=n[6];let c;n[7]===r?c=n[8]:(c=(0,W.jsx)(Ln,{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,W.jsxs)(In,{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});Yn.displayName=In.displayName;var Xn=U.forwardRef((e,t)=>{let n=(0,H.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=S(`-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,W.jsx)(Vn,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Xn.displayName=Vn.displayName;function Zn(e){let t=(0,H.c)(14),{className:n,label:r,size:i}=e,a=i===void 0?`md`:i,o=a===`sm`?`h-4 w-4`:a===`lg`?`h-8 w-8`:`h-6 w-6`,s;t[0]===n?s=t[1]:(s=S(`flex h-full items-center justify-center`,n),t[0]=n,t[1]=s);let c;t[2]===o?c=t[3]:(c=S(o,`animate-spin mx-auto text-muted-foreground`),t[2]=o,t[3]=c);let l;t[4]===c?l=t[5]:(l=(0,W.jsx)(ae,{className:c}),t[4]=c,t[5]=l);let u;t[6]===r?u=t[7]:(u=r?(0,W.jsx)(`p`,{className:S(z.bodyMuted,`mt-2`),children:r}):null,t[6]=r,t[7]=u);let d;t[8]!==l||t[9]!==u?(d=(0,W.jsxs)(`div`,{className:`text-center`,children:[l,u]}),t[8]=l,t[9]=u,t[10]=d):d=t[10];let f;return t[11]!==s||t[12]!==d?(f=(0,W.jsx)(`div`,{className:s,children:d}),t[11]=s,t[12]=d,t[13]=f):f=t[13],f}function Qn(){let e=(0,H.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,W.jsx)(`div`,{className:`space-y-1 px-2 py-2`,children:[1,2,3].map($n)}),e[0]=t):t=e[0],t}function $n(e){return(0,W.jsx)(`div`,{className:`animate-pulse h-7 bg-muted rounded-full`},e)}function er(){let e=(0,H.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,W.jsx)(`div`,{className:`animate-pulse h-4 bg-muted rounded mx-4 my-1`}),e[0]=t):t=e[0],t}var tr=new Map;function nr(e,t){let n=tr.get(e);return n||(n={promise:t().catch(t=>{throw tr.delete(e),t})},tr.set(e,n)),n.promise}function rr(e){tr.delete(e)}function ir(e){for(let t of tr.keys())t.startsWith(e)&&tr.delete(t)}function ar(e,t){return(0,U.use)(nr(e,t))}var or=U.forwardRef((e,t)=>{let n=(0,H.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=S(`rounded-lg border bg-card text-card-foreground shadow-sm`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});or.displayName=`Card`;var sr=U.forwardRef((e,t)=>{let n=(0,H.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=S(`flex flex-col space-y-1.5 p-6`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});sr.displayName=`CardHeader`;var cr=U.forwardRef((e,t)=>{let n=(0,H.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=S(z.sectionTitle,`leading-none tracking-tight`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});cr.displayName=`CardTitle`;var lr=U.forwardRef((e,t)=>{let n=(0,H.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=S(z.bodyMuted,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});lr.displayName=`CardDescription`;var ur=U.forwardRef((e,t)=>{let n=(0,H.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=S(`p-6 pt-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ur.displayName=`CardContent`;var dr=U.forwardRef((e,t)=>{let n=(0,H.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=S(`flex items-center p-6 pt-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});dr.displayName=`CardFooter`;var fr=class extends U.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`AsyncErrorBoundary caught an error:`,e,t)}handleRetry=()=>{this.setState({error:null}),this.props.onRetry?.()};render(){let{error:e}=this.state;return e?this.props.renderFallback?this.props.renderFallback(e,this.handleRetry):(0,W.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,W.jsxs)(or,{className:`max-w-md`,children:[(0,W.jsx)(sr,{children:(0,W.jsx)(cr,{className:`text-destructive`,children:this.props.fallbackTitle??`Something went wrong`})}),(0,W.jsxs)(ur,{className:`space-y-4`,children:[(0,W.jsx)(`p`,{className:z.body,children:e.message}),(0,W.jsx)(A,{variant:`outline`,onClick:this.handleRetry,children:`Retry`})]})]})}):this.props.children}},pr=U.forwardRef((e,t)=>{let n=(0,H.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=S(`w-full caption-bottom`,z.body,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(`div`,{className:`relative w-full overflow-auto`,children:(0,W.jsx)(`table`,{ref:t,className:a,...i})}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});pr.displayName=`Table`;var mr=U.forwardRef((e,t)=>{let n=(0,H.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=S(`[&_tr]:border-b`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.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 hr=U.forwardRef((e,t)=>{let n=(0,H.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=S(`[&_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,W.jsx)(`tbody`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});hr.displayName=`TableBody`;var gr=U.forwardRef((e,t)=>{let n=(0,H.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=S(`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,W.jsx)(`tfoot`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});gr.displayName=`TableFooter`;var _r=U.forwardRef((e,t)=>{let n=(0,H.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=S(`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,W.jsx)(`tr`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});_r.displayName=`TableRow`;var Q=U.forwardRef((e,t)=>{let n=(0,H.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=S(`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,W.jsx)(`th`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Q.displayName=`TableHead`;var $=U.forwardRef((e,t)=>{let n=(0,H.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=S(`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,W.jsx)(`td`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});$.displayName=`TableCell`;var vr=U.forwardRef((e,t)=>{let n=(0,H.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=S(z.caption,`mt-4`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(`caption`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});vr.displayName=`TableCaption`;var yr=t({ConversationHistoryView:()=>Dr,default:()=>Dr}),br=`__ALL_PROJECTS__`;function xr(e){let t=(0,H.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,W.jsx)(W.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,W.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,W.jsxs)(W.Fragment,{children:[a,o]}),t[6]=a,t[7]=s),s}function Sr(e,t){let n=`${t} - `,r=e.title??e.threadId;return r.startsWith(n)?r.slice(n.length):r}async function Cr(e){let t=[],n=new Set,r=``;for(let i of e)try{let e=await ye(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 wr(e,t){return e.type===`thread`?`conversation-history:thread:${e.threadId}:${t}`:e.type===`project`?`conversation-history:project:${e.projectId}:${t}`:`conversation-history:all:${t}`}async function Tr(e,t){if(e.type===`thread`)return await ye(e.threadId);if(e.type===`project`){let n=t.find(t=>t.projectId===e.projectId);if(!n||n.threads.length===0)return{threadId:e.projectId,messages:[],lastUpdated:new Date().toISOString(),conversationIds:[]};let r=await Cr(n.threads);return{threadId:e.projectId,...r}}return{threadId:br,...await Cr(t.flatMap(e=>e.threads))}}function Er(e){let t=(0,H.c)(45),{scope:r,projects:i,loadVersion:a,currentPromptIndex:o,onPromptIndexChange:s}=e,l;t[0]!==a||t[1]!==r?(l=wr(r,a),t[0]=a,t[1]=r,t[2]=l):l=t[2];let d;t[3]!==i||t[4]!==r?(d=()=>Tr(r,i),t[3]=i,t[4]=r,t[5]=d):d=t[5];let f=ar(l,d),p;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=function(e){return new Date(e).toLocaleString()},t[6]=p):p=t[6];let m=p,h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=function(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}},t[7]=h):h=t[7];let g=h,_;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(_=function(e){return{inputTokens:e.inputTokens??0,outputTokens:e.outputTokens??0}},t[8]=_):_=t[8];let v=_,y;t[9]!==o||t[10]!==f.messages||t[11]!==s?(y=function(){f.messages&&o<f.messages.length-1&&s(o+1)},t[9]=o,t[10]=f.messages,t[11]=s,t[12]=y):y=t[12];let b=y,C;t[13]!==o||t[14]!==s?(C=function(){o>0&&s(o-1)},t[13]=o,t[14]=s,t[15]=C):C=t[15];let w=C;if(!f.messages?.length){let e;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,W.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,W.jsxs)(`div`,{className:`max-w-md text-center space-y-2`,children:[(0,W.jsx)(`h3`,{className:z.emptyStateTitle,children:`No history`}),(0,W.jsx)(`p`,{className:z.bodyMuted,children:`No conversation history found for this thread.`})]})}),t[16]=e):e=t[16],e}let T=o===0,E;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,W.jsx)(u,{className:`h-4 w-4 mr-1`}),t[17]=E):E=t[17];let D;t[18]!==w||t[19]!==T?(D=(0,W.jsx)(A,{variant:`outline`,size:`sm`,onClick:w,disabled:T,children:E}),t[18]=w,t[19]=T,t[20]=D):D=t[20];let O=o>=f.messages.length-1,k;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,W.jsx)(ee,{className:`h-4 w-4 ml-1`}),t[21]=k):k=t[21];let j;t[22]!==b||t[23]!==O?(j=(0,W.jsx)(A,{variant:`outline`,size:`sm`,onClick:b,disabled:O,children:k}),t[22]=b,t[23]=O,t[24]=j):j=t[24];let N;t[25]!==D||t[26]!==j?(N=(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[D,j]}),t[25]=D,t[26]=j,t[27]=N):N=t[27];let te=o+1,P;t[28]!==f.messages.length||t[29]!==te?(P=(0,W.jsxs)(`div`,{className:z.bodyMuted,children:[te,` of `,f.messages.length,` messages`]}),t[28]=f.messages.length,t[29]=te,t[30]=P):P=t[30];let F;t[31]!==N||t[32]!==P?(F=(0,W.jsxs)(`div`,{className:`flex items-center justify-between border-b py-3 px-0`,children:[N,P]}),t[31]=N,t[32]=P,t[33]=F):F=t[33];let I;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,W.jsx)(mr,{children:(0,W.jsxs)(_r,{children:[(0,W.jsx)(Q,{children:`Prompt`}),(0,W.jsx)(Q,{children:`Answer`}),(0,W.jsx)(Q,{className:`w-24`,children:`Model`}),(0,W.jsx)(Q,{className:`w-24 text-right`,children:`Duration`}),(0,W.jsx)(Q,{className:`w-20 text-right`,children:`Input Tokens`}),(0,W.jsx)(Q,{className:`w-20 text-right`,children:`Output Tokens`}),(0,W.jsx)(Q,{className:`w-32 text-right`,children:`Timestamp`})]})}),t[34]=I):I=t[34];let L;if(t[35]!==o||t[36]!==f.messages){let e;t[38]===o?e=t[39]:(e=(e,t)=>{let{inputTokens:r,outputTokens:i}=v(e);return(0,W.jsxs)(_r,{className:t===o?`bg-muted/50`:``,children:[(0,W.jsx)($,{className:`max-w-md`,children:(0,W.jsx)(`div`,{className:z.body,children:(0,W.jsx)(xr,{text:e.request.message})})}),(0,W.jsx)($,{className:`max-w-md`,children:e.response?(0,W.jsx)(`div`,{className:z.body,children:(0,W.jsx)(xr,{text:e.response.content})}):(0,W.jsx)(`span`,{className:S(z.bodyMuted,`italic`),children:`No response`})}),(0,W.jsx)($,{children:(0,W.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,W.jsx)(c,{className:`h-3 w-3 text-muted-foreground`}),(0,W.jsx)(`span`,{className:`text-muted-foreground`,children:e.request.model})]})}),(0,W.jsx)($,{className:S(z.caption,`text-right`),children:e.response?(0,W.jsx)(n,{children:(0,W.jsxs)(M,{children:[(0,W.jsx)(ne,{asChild:!0,children:(0,W.jsx)(`div`,{className:`cursor-help`,children:g(e.timestamp,e.response.completedAt).display})}),(0,W.jsx)(x,{children:(0,W.jsx)(`p`,{children:g(e.timestamp,e.response.completedAt).tooltip})})]})}):(0,W.jsx)(`span`,{className:`text-muted-foreground italic`,children:`-`})}),(0,W.jsx)($,{className:S(z.bodyMuted,`text-right`),children:r>0?r.toLocaleString():`-`}),(0,W.jsx)($,{className:S(z.bodyMuted,`text-right`),children:i>0?i.toLocaleString():`-`}),(0,W.jsx)($,{className:S(z.bodyMuted,`text-right`),children:m(e.timestamp)})]},e.id)},t[38]=o,t[39]=e),L=f.messages.map(e),t[35]=o,t[36]=f.messages,t[37]=L}else L=t[37];let R;t[40]===L?R=t[41]:(R=(0,W.jsx)(oe,{className:`h-full`,children:(0,W.jsx)(`div`,{className:`py-4`,children:(0,W.jsxs)(pr,{children:[I,(0,W.jsx)(hr,{children:L})]})})}),t[40]=L,t[41]=R);let re;return t[42]!==F||t[43]!==R?(re=(0,W.jsxs)(W.Fragment,{children:[F,R]}),t[42]=F,t[43]=R,t[44]=re):re=t[44],re}var Dr=(0,U.memo)(function({isOpen:e,onClose:t,initialFilter:n,projects:r,inline:i}){let[a,o]=(0,U.useState)(0),[s,c]=(0,U.useState)(``),[l,u]=(0,U.useState)(``),[d,f]=(0,U.useState)(!1),[p,m]=(0,U.useState)(!1),[h,g]=(0,U.useState)(0),[v,b]=(0,U.useState)(null),[x,S]=(0,U.useState)(null),C=(0,U.useMemo)(()=>l?{type:`thread`,threadId:l}:s===br?{type:`all`}:s?{type:`project`,projectId:s}:null,[s,l]),w=C?wr(C,h):null;(0,U.useEffect)(()=>{e&&n?n.type===`thread`?(u(n.id),c(``),o(0)):n.type===`project`&&(c(n.id),u(``),o(0)):e&&!n?(c(br),u(``),o(0)):e||(u(``),c(``),o(0),S(null),b(null))},[e,n]);let T=e=>{u(e),c(``),o(0),b(null),S(null)},E=e=>{c(e),u(``),o(0),b(null),S(null)},D=(0,U.useCallback)(()=>{if(l){let e=r.flatMap(e=>e.threads).find(e=>e.threadId===l),t=r.find(e=>e.threads.some(e=>e.threadId===l)),n=e?Sr(e,t?.name??t?.projectId??``):l;return{options:{threadId:l},title:`Clear Thread History`,description:`Permanently delete all conversation history for "${n}"? This cannot be undone.`}}if(s&&s!==br){let e=r.find(e=>e.projectId===s)?.name??s;return{options:{projectId:s},title:`Clear Project History`,description:`Permanently delete all conversation history for "${e}"? This cannot be undone.`}}return{options:void 0,title:`Clear All History`,description:`Permanently delete all conversation history across every project and thread? This cannot be undone.`}},[r,s,l]),O=(0,U.useCallback)(async()=>{let e=D();m(!0),S(null);try{await _(e.options),w&&rr(w),b(w),o(0),f(!1)}catch(e){S(e instanceof Error?e.message:`Failed to clear conversation history`)}finally{m(!1)}},[D,w]);function ee(){C&&rr(wr(C,h)),g(e=>e+1),b(null),S(null)}let k=D();if(!e)return null;let j=(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(Hn,{value:s,onValueChange:E,children:[(0,W.jsx)(Wn,{className:`w-48`,children:(0,W.jsx)(Un,{placeholder:`Select project`})}),(0,W.jsxs)(qn,{children:[(0,W.jsx)(Yn,{value:br,children:`All Projects`}),r.map(e=>(0,W.jsx)(Yn,{value:e.projectId,children:e.name??e.projectId},e.projectId))]})]}),(0,W.jsxs)(Hn,{value:l,onValueChange:T,children:[(0,W.jsx)(Wn,{className:`w-48`,children:(0,W.jsx)(Un,{placeholder:`Select thread`})}),(0,W.jsx)(qn,{children:r.flatMap(e=>e.threads.map(t=>(0,W.jsx)(Yn,{value:t.threadId,children:Sr(t,e.name??e.projectId)},t.threadId)))})]}),(0,W.jsxs)(A,{variant:`outline`,size:`sm`,onClick:()=>f(!0),disabled:p,children:[(0,W.jsx)(y,{className:`h-4 w-4 mr-2`}),`Clear`]})]}),M=(0,W.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,W.jsx)(`div`,{className:i?void 0:`border-b px-6 py-4`,children:(0,W.jsx)(ut,{title:`History`,description:i?`View and browse conversation history across projects and threads.`:void 0,action:(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[j,i?null:(0,W.jsx)(A,{variant:`action`,size:`icon-sm`,onClick:t,children:(0,W.jsx)(_e,{})})]})})}),(0,W.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:x?(0,W.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,W.jsxs)(or,{className:`max-w-md`,children:[(0,W.jsx)(sr,{children:(0,W.jsx)(cr,{className:`text-destructive`,children:`Error`})}),(0,W.jsxs)(ur,{className:`space-y-4`,children:[(0,W.jsx)(`p`,{children:x}),(0,W.jsx)(A,{onClick:()=>S(null),children:`Dismiss`})]})]})}):v&&v===w?(0,W.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,W.jsxs)(`div`,{className:`max-w-md text-center space-y-2`,children:[(0,W.jsx)(`h3`,{className:z.emptyStateTitle,children:`No history`}),(0,W.jsx)(`p`,{className:z.bodyMuted,children:`No conversation history found for this thread.`})]})}):C?(0,W.jsx)(fr,{fallbackTitle:`Failed to load conversation history`,onRetry:ee,children:(0,W.jsx)(U.Suspense,{fallback:(0,W.jsx)(Zn,{label:`Loading conversation history...`,size:`lg`}),children:(0,W.jsx)(Er,{scope:C,projects:r,loadVersion:h,currentPromptIndex:a,onPromptIndexChange:o},w??void 0)})}):(0,W.jsx)(Zn,{label:`Loading conversation history...`,size:`lg`})})]});return(0,W.jsxs)(W.Fragment,{children:[i?(0,W.jsx)(pt,{children:(0,W.jsx)(st,{className:`max-w-none w-full h-full flex flex-col min-h-0`,children:M})}):(0,W.jsx)(`div`,{className:`fixed inset-0 z-50 bg-background`,children:M}),(0,W.jsx)(Ze,{open:d,onOpenChange:f,children:(0,W.jsxs)(et,{children:[(0,W.jsxs)(tt,{children:[(0,W.jsx)(rt,{children:k.title}),(0,W.jsx)(it,{children:k.description})]}),(0,W.jsxs)(nt,{children:[(0,W.jsx)(ot,{disabled:p,children:`Cancel`}),(0,W.jsx)(at,{onClick:e=>{e.preventDefault(),O()},disabled:p,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:p?`Clearing...`:`Clear`})]})]})})]})});export{ot as A,dt as C,pt as D,st as E,rt as F,it as M,nt as N,Ze as O,tt as P,ut as S,mt as T,vt as _,ar as a,gt as b,er as c,Hn as d,qn as f,Un as g,Wn as h,ur as i,et as j,at as k,Zn as l,Xn as m,fr as n,rr as o,Yn as p,or as r,ir as s,yr as t,Qn as u,ct as v,ht as w,ft as x,lt as y};