tarsk 0.5.55 → 0.5.56

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 (87) hide show
  1. package/dist/index.js +4327 -3093
  2. package/dist/public/assets/{account-view-CkhRveFm.js → account-view-DfAwxT4c.js} +1 -1
  3. package/dist/public/assets/api-BqZXzYni.js +1 -0
  4. package/dist/public/assets/{browser-tab-DbT2QjH_.js → browser-tab-Dekah8E_.js} +2 -2
  5. package/dist/public/assets/commit-dialog-BE6c536I.js +1 -0
  6. package/dist/public/assets/context-menu-RForU18o.js +1 -0
  7. package/dist/public/assets/create-repo-dialog-CS5xTOjf.js +1 -0
  8. package/dist/public/assets/dialogs-config-DuZySBOC.js +51 -0
  9. package/dist/public/assets/diff-view-xkMUFRnl.js +3 -0
  10. package/dist/public/assets/{explorer-tab-view-JIMdE8cA.js → explorer-tab-view-Bn8bbyLL.js} +2 -2
  11. package/dist/public/assets/{explorer-tree-B60M0QAV.js → explorer-tree-E_aVMvGb.js} +1 -1
  12. package/dist/public/assets/{explorer-view-BBaEk8i9.js → explorer-view-BajvTTr7.js} +2 -2
  13. package/dist/public/assets/git-history-dialog-Dhp1fu13.js +1 -0
  14. package/dist/public/assets/git-ops-button-VSTuEaDQ.js +2 -0
  15. package/dist/public/assets/history-view-BmWodDne.js +9 -0
  16. package/dist/public/assets/index-Bn5BGXYs.js +82 -0
  17. package/dist/public/assets/mcp-server-card-DoQMX_2Q.js +1 -0
  18. package/dist/public/assets/merged-pr-dialog-DVx11597.js +1 -0
  19. package/dist/public/assets/model-star-rating-DNzhEsM9.js +1 -0
  20. package/dist/public/assets/onboarding-BB-AWm5a.js +1 -0
  21. package/dist/public/assets/project-settings-view-vWXNRi1m.js +1 -0
  22. package/dist/public/assets/providers-list-view-BkHi507c.js +1 -0
  23. package/dist/public/assets/pull-request-dialog-DdTJdeTq.js +1 -0
  24. package/dist/public/assets/pull-with-changes-dialog-BhHXdwjP.js +1 -0
  25. package/dist/public/assets/push-before-pr-dialog-CR8taQ6a.js +1 -0
  26. package/dist/public/assets/radio-group-DD9C3pbb.js +1 -0
  27. package/dist/public/assets/react-vendor-DgF6pNAi.js +16 -0
  28. package/dist/public/assets/settings-general-view-BMaOafTr.js +1 -0
  29. package/dist/public/assets/settings-instructions-view-Bh_sbTdf.js +1 -0
  30. package/dist/public/assets/{settings-list-CICo_cz2.js → settings-list-CJXD22wL.js} +1 -1
  31. package/dist/public/assets/settings-mcp-servers-view-DBI-Ei0T.js +5 -0
  32. package/dist/public/assets/{settings-models-skeleton-MXSIpmT8.js → settings-models-skeleton-B1upm3Q7.js} +1 -1
  33. package/dist/public/assets/settings-models-view-ZSYWApz0.js +1 -0
  34. package/dist/public/assets/settings-rules-view-CtoRjnSE.js +8 -0
  35. package/dist/public/assets/settings-skills-view-B2ZQgbdD.js +3 -0
  36. package/dist/public/assets/{settings-slash-commands-view-j8NdZX1V.js → settings-slash-commands-view-BAyiz9VV.js} +1 -1
  37. package/dist/public/assets/settings-subagents-view-C9q0vEYM.js +2 -0
  38. package/dist/public/assets/{settings-system-prompt-view-DPMiLsrM.js → settings-system-prompt-view-BAUeOM2Z.js} +1 -1
  39. package/dist/public/assets/settings-view-DqZ7FR61.js +2 -0
  40. package/dist/public/assets/skeleton-CQM5jDQH.js +1 -0
  41. package/dist/public/assets/slug-utils-Dp6TXVav.js +1 -0
  42. package/dist/public/assets/{tabs-0fGgot48.js → tabs-zGMLk83Y.js} +1 -1
  43. package/dist/public/assets/tasks-view-Bw35pfFo.js +3 -0
  44. package/dist/public/assets/{terminal-panel-D6RjOZfD.js → terminal-panel-DZaWc68b.js} +2 -2
  45. package/dist/public/assets/{ui-components-BJRW2LJq.js → ui-components-CEtP7zEi.js} +1 -1
  46. package/dist/public/assets/{use-deferred-search-DOfdC3JO.js → use-deferred-search-2yKJewrg.js} +1 -1
  47. package/dist/public/assets/{utils-DPYK-CSn.js → utils-Dt3EZ8O5.js} +1 -1
  48. package/dist/public/assets/{vosk-speech-Ce0kC8Ck.js → vosk-speech-DyMTC-lJ.js} +1 -1
  49. package/dist/public/assets/{web-Cp_I5n5Z.js → web-C9AHiVGO.js} +1 -1
  50. package/dist/public/assets/{web-BFYPtzjF.js → web-CsOG2q4F.js} +1 -1
  51. package/dist/public/assets/{web-DGEc3VyT.js → web-CwGTNQsf.js} +1 -1
  52. package/dist/public/assets/{web-DLSR_y_6.js → web-srh-E-w5.js} +1 -1
  53. package/dist/public/index.html +7 -7
  54. package/dist/recommended-models.txt +5 -4
  55. package/package.json +2 -1
  56. package/dist/public/assets/api-BUjKoVUu.js +0 -1
  57. package/dist/public/assets/commit-dialog-DRMKciNP.js +0 -1
  58. package/dist/public/assets/context-menu-DO3hiSAo.js +0 -1
  59. package/dist/public/assets/create-repo-dialog-CXiWjkFb.js +0 -1
  60. package/dist/public/assets/dialogs-config-86QTDk4G.js +0 -51
  61. package/dist/public/assets/diff-view-D_xoUbUb.js +0 -3
  62. package/dist/public/assets/git-history-dialog-DfzFi0Nx.js +0 -1
  63. package/dist/public/assets/git-ops-button-C_4iUio-.js +0 -2
  64. package/dist/public/assets/history-view-BsN806ip.js +0 -9
  65. package/dist/public/assets/index-C2iIghSR.js +0 -81
  66. package/dist/public/assets/mcp-server-card-DUJUtQq-.js +0 -1
  67. package/dist/public/assets/merged-pr-dialog-DVNtED4V.js +0 -1
  68. package/dist/public/assets/model-star-rating-DrR6jzjq.js +0 -1
  69. package/dist/public/assets/onboarding-DCrFdRM5.js +0 -1
  70. package/dist/public/assets/project-settings-view-DRL5CTSQ.js +0 -1
  71. package/dist/public/assets/providers-list-view-DkmgzncX.js +0 -1
  72. package/dist/public/assets/pull-request-dialog-CPjzwrdo.js +0 -1
  73. package/dist/public/assets/pull-with-changes-dialog-DLfDpEEX.js +0 -1
  74. package/dist/public/assets/push-before-pr-dialog-v-3J53Hw.js +0 -1
  75. package/dist/public/assets/radio-group-C7-1cZ2t.js +0 -1
  76. package/dist/public/assets/react-vendor-DK2COBjg.js +0 -16
  77. package/dist/public/assets/settings-general-view-BZZs0t0d.js +0 -1
  78. package/dist/public/assets/settings-instructions-view-CE-ugC91.js +0 -1
  79. package/dist/public/assets/settings-mcp-servers-view-DKviDm0q.js +0 -5
  80. package/dist/public/assets/settings-models-view-DWqPx-2m.js +0 -1
  81. package/dist/public/assets/settings-rules-view-Cq-60UOT.js +0 -8
  82. package/dist/public/assets/settings-skills-view-B6srjIvU.js +0 -3
  83. package/dist/public/assets/settings-subagents-view-4LusGYrq.js +0 -2
  84. package/dist/public/assets/settings-view-0Idf-mDz.js +0 -2
  85. package/dist/public/assets/skeleton-BvvAbfo4.js +0 -1
  86. package/dist/public/assets/slug-utils-jE4NOx-f.js +0 -1
  87. package/dist/public/assets/tasks-view-DD03SZ7R.js +0 -3
@@ -0,0 +1,3 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$ as t,$r as n,$t as r,Aa as i,Ba as a,Bs as o,Fi as s,Fo as c,Ia as l,K as u,Li as d,Ls as f,Po as p,Ra as m,Rr as h,Rs as g,Rt as _,Vr as v,_a as y,ai as b,c as x,ii as S,io as C,ja as w,lt as T,no as E,ps as D,qi as O,qn as k,qo as A,ri as ee,st as te,ti as ne,to as j,zr as M}from"./dialogs-config-DuZySBOC.js";import{N}from"./react-vendor-DgF6pNAi.js";import{t as P}from"./monaco-CZnIWXyV.js";import{I as F,a as re,l as I,n as L,o as ie}from"./history-view-BmWodDne.js";import{d as R}from"./onboarding-BB-AWm5a.js";import{n as ae}from"./utils-Dt3EZ8O5.js";import{C as oe,H as se,I as ce,K as le,U as ue,V as de,W as fe,d as pe,f as me,h as he,m as ge,p as _e}from"./index-Bn5BGXYs.js";import{a as ve,n as z,r as B,t as ye}from"./context-menu-RForU18o.js";var V=e(o(),1),H=g(),U=f();function be(e){let t=(0,H.c)(20),{children:n,title:r,subtitle:i,headerAction:a,footer:o}=e,s;t[0]===r?s=t[1]:(s=r&&(0,U.jsx)(`span`,{className:D.sectionTitle,children:r}),t[0]=r,t[1]=s);let c;t[2]===s?c=t[3]:(c=(0,U.jsx)(`div`,{className:`flex items-center gap-2`,children:s}),t[2]=s,t[3]=c);let l;t[4]===a?l=t[5]:(l=a&&(0,U.jsx)(`div`,{className:`flex items-center gap-2 ml-auto`,children:a}),t[4]=a,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]!==i||t[10]!==u?(d=(0,U.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-1 border-b border-sidebar-border px-4 py-6`,children:[u,i]}),t[9]=i,t[10]=u,t[11]=d):d=t[11];let f;t[12]===n?f=t[13]:(f=(0,U.jsx)(x,{className:`min-h-0 flex-1`,children:n}),t[12]=n,t[13]=f);let p;t[14]===o?p=t[15]:(p=o&&(0,U.jsx)(`div`,{className:`border-t border-sidebar-border`,children:o}),t[14]=o,t[15]=p);let m;return t[16]!==d||t[17]!==f||t[18]!==p?(m=(0,U.jsxs)(`div`,{className:`flex h-full min-h-0 w-full flex-col`,children:[d,f,p]}),t[16]=d,t[17]=f,t[18]=p,t[19]=m):m=t[19],m}function xe(e){let t=[],n={};return e.forEach((e,r)=>{let i=e.path.split(`/`),a=t,o=``;for(let e=0;e<i.length-1;e++){if(o=o?`${o}/${i[e]}`:i[e],!n[o]){let t={id:`dir:${o}`,name:i[e],children:[]};n[o]=t,a.push(t)}a=n[o].children}a.push({id:`file:${e.path}`,name:i[i.length-1],fileIndex:r,status:e.status})}),t}var W={added:`text-green-500`,deleted:`text-red-500`,untracked:`text-green-500`,renamed:`text-blue-500`,modified:`text-orange-500`},G={added:`A`,deleted:`D`,untracked:`U`,renamed:`R`,modified:`M`};function K(e){return d(d(D.compact,`status-badge font-mono font-semibold`),W[e]??`text-orange-500`)}function Se(e){return G[e]??`M`}var q=F(e=>(0,U.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,U.jsxs)(`span`,{className:e.v0,children:[e.v1,` file`,e.v2]}),(0,U.jsxs)(`span`,{className:e.v3,children:[`+`,e.v4]}),(0,U.jsxs)(`span`,{className:e.v5,children:[`-`,e.v6]})]}),{name:`JSX_stats_1`,portals:[`v1`,`v2`,`v4`,`v6`]}),Ce=F(e=>e.v0,{name:`DiffTree_1`,portals:[`v0`]}),J=F(e=>e.v0,{name:`DiffTree_2`,portals:[`v0`]}),we=F(e=>e.v0,{name:`DiffTree_3`,portals:[`v0`]}),Te=function(e){let t=(0,H.c)(32),{treeData:n,files:r,error:i,selectedFileIndex:a,onFileSelect:o,onRevertFile:s}=e,c;t[0]===r?c=t[1]:(c=r.reduce(De,0),t[0]=r,t[1]=c);let l=c,u;t[2]===r?u=t[3]:(u=r.reduce(ke,0),t[2]=r,t[3]=u);let f=u,m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=d(D.compact,`text-muted-foreground`),t[4]=m):m=t[4];let h=r.length,g=r.length===1?``:`s`,_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=d(D.compact,`text-green-500`),t[5]=_):_=t[5];let v;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=d(D.compact,`text-red-500`),t[6]=v):v=t[6];let b;t[7]!==r.length||t[8]!==g||t[9]!==l||t[10]!==f?(b=(0,U.jsx)(q,{v0:m,v1:h,v2:g,v3:_,v4:l,v5:v,v6:f}),t[7]=r.length,t[8]=g,t[9]=l,t[10]=f,t[11]=b):b=t[11];let x=b;if(i){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=d(D.compact,`text-destructive text-center`),t[12]=e):e=t[12];let n;t[13]===i?n=t[14]:(n=(0,U.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,U.jsx)(`p`,{className:e,children:i})}),t[13]=i,t[14]=n);let r;return t[15]!==x||t[16]!==n?(r=(0,U.jsx)(Ce,{v0:(0,U.jsx)(be,{title:`Review Changes`,subtitle:x,children:n})}),t[15]=x,t[16]=n,t[17]=r):r=t[17],r}if(r.length===0){let e;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,U.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,U.jsx)(`p`,{className:d(D.compact,D.bodyMuted,`text-center`),children:`No changes to review`})}),t[18]=e):e=t[18];let n;return t[19]===x?n=t[20]:(n=(0,U.jsx)(J,{v0:(0,U.jsx)(be,{title:`Review Changes`,subtitle:x,children:e})}),t[19]=x,t[20]=n),n}let S;t[21]!==r||t[22]!==o||t[23]!==s||t[24]!==a?(S=(e,t)=>{let{isOpen:n,toggle:i}=t,c=!!e.children,l=(0,U.jsxs)(R,{onClick:()=>{c?i():e.fileIndex!==void 0&&o(e.fileIndex)},selected:!c&&e.fileIndex===a,className:`gap-1.5`,children:[c?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(p,{className:d(`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform`,n&&`rotate-90`)}),n?(0,U.jsx)(E,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}):(0,U.jsx)(j,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}):(0,U.jsx)(C,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,U.jsx)(`span`,{className:`truncate flex-1 min-w-0`,children:e.name}),!c&&e.status&&(0,U.jsx)(`span`,{className:K(e.status),children:Se(e.status)})]});return c?l:(0,U.jsxs)(ye,{children:[(0,U.jsx)(ve,{asChild:!0,children:(0,U.jsx)(`div`,{children:l})}),(0,U.jsx)(z,{children:(0,U.jsxs)(B,{onClick:()=>{e.fileIndex!==void 0&&s?.(r[e.fileIndex])},children:[(0,U.jsx)(y,{className:`mr-2 h-3.5 w-3.5`}),`Revert Change`]})})]})},t[21]=r,t[22]=o,t[23]=s,t[24]=a,t[25]=S):S=t[25];let w;t[26]!==S||t[27]!==n?(w=(0,U.jsx)(`div`,{className:`px-1 pt-3 pb-2`,children:(0,U.jsx)(de,{nodes:n,defaultOpen:!0,resetKey:n,indent:16,childContainerClassName:`ml-4 border-l border-sidebar-border pl-2`,renderNode:S})}),t[26]=S,t[27]=n,t[28]=w):w=t[28];let T;return t[29]!==x||t[30]!==w?(T=(0,U.jsx)(we,{v0:(0,U.jsx)(be,{title:`Review Changes`,subtitle:x,children:w})}),t[29]=x,t[30]=w,t[31]=T):T=t[31],T};function Y(e){return e.type===`add`}function Ee(e,t){return e+t.changes.filter(Y).length}function De(e,t){return e+t.hunks.reduce(Ee,0)}function Oe(e){return e.type===`delete`}function X(e,t){return e+t.changes.filter(Oe).length}function ke(e,t){return e+t.hunks.reduce(X,0)}var Ae=F(e=>(0,U.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,U.jsx)(`div`,{className:e.v0,children:e.v1}),(0,U.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 overflow-auto bg-background`,children:(0,U.jsx)(`img`,{src:e.v2,alt:e.v3,className:`max-w-full max-h-full object-contain`})})]}),{name:`DiffImageSingle_1`,portals:[`v1`]}),je=function(e){let t=(0,H.c)(5),{threadId:n,filePath:r,version:i,label:a}=e,o=Ne(n,r,i),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=d(D.caption,`px-3 py-1.5 border-b text-muted-foreground bg-muted/30`),t[0]=s):s=t[0];let c=`${a} - ${r}`,l;return t[1]!==a||t[2]!==o||t[3]!==c?(l=(0,U.jsx)(Ae,{v0:s,v1:a,v2:o,v3:c}),t[1]=a,t[2]=o,t[3]=c,t[4]=l):l=t[4],l};function Me(e,t,n){return`git-media:${e}:${t}:${n}`}function Ne(e,t,n){let r=(0,H.c)(13),i;r[0]!==t||r[1]!==e||r[2]!==n?(i=Me(e,t,n),r[0]=t,r[1]=e,r[2]=n,r[3]=i):i=r[3];let a;r[4]!==t||r[5]!==e||r[6]!==n?(a=()=>T(e,t,n),r[4]=t,r[5]=e,r[6]=n,r[7]=a):a=r[7];let o=re(i,a),s;r[8]===o?s=r[9]:(s=URL.createObjectURL(o),r[8]=o,r[9]=s);let c=s,l,u;return r[10]===c?(l=r[11],u=r[12]):(l=()=>()=>{URL.revokeObjectURL(c)},u=[c],r[10]=c,r[11]=l,r[12]=u),(0,V.useEffect)(l,u),c}function Pe(e){let t=(0,H.c)(23),{threadId:n,file:r}=e,i=r.status===`modified`||r.status===`deleted`||r.status===`renamed`,a=r.status===`modified`||r.status===`added`||r.status===`untracked`||r.status===`renamed`;if(i&&a){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,U.jsx)(I,{label:`Loading before...`}),t[0]=e):e=t[0];let i=r.status===`renamed`&&r.oldPath?r.oldPath:r.path,a;t[1]!==i||t[2]!==n?(a=(0,U.jsx)(`div`,{className:`flex-1 border-r border-border`,children:(0,U.jsx)(V.Suspense,{fallback:e,children:(0,U.jsx)(je,{threadId:n,filePath:i,version:`old`,label:`Before`})})}),t[1]=i,t[2]=n,t[3]=a):a=t[3];let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,U.jsx)(I,{label:`Loading after...`}),t[4]=o):o=t[4];let s;t[5]!==r.path||t[6]!==n?(s=(0,U.jsx)(`div`,{className:`flex-1`,children:(0,U.jsx)(V.Suspense,{fallback:o,children:(0,U.jsx)(je,{threadId:n,filePath:r.path,version:`new`,label:`After`})})}),t[5]=r.path,t[6]=n,t[7]=s):s=t[7];let c;return t[8]!==a||t[9]!==s?(c=(0,U.jsxs)(`div`,{className:`flex h-full`,children:[a,s]}),t[8]=a,t[9]=s,t[10]=c):c=t[10],c}let o=a?`new`:`old`,s=a?`Added`:`Deleted`,c;t[11]===s?c=t[12]:(c=s.toLowerCase(),t[11]=s,t[12]=c);let l=`Loading ${c} image...`,u;t[13]===l?u=t[14]:(u=(0,U.jsx)(I,{label:l}),t[13]=l,t[14]=u);let d;t[15]!==r.path||t[16]!==s||t[17]!==n||t[18]!==o?(d=(0,U.jsx)(je,{threadId:n,filePath:r.path,version:o,label:s}),t[15]=r.path,t[16]=s,t[17]=n,t[18]=o,t[19]=d):d=t[19];let f;return t[20]!==u||t[21]!==d?(f=(0,U.jsx)(`div`,{className:`flex h-full flex-col`,children:(0,U.jsx)(V.Suspense,{fallback:u,children:d})}),t[20]=u,t[21]=d,t[22]=f):f=t[22],f}function Fe(e){let t=(0,H.c)(4),{isOpen:n}=e,r=(n===void 0?!0:n)&&`ml-[-40px]`,i;t[0]===r?i=t[1]:(i=d(`z-10 shrink-0`,r),t[0]=r,t[1]=i);let a;return t[2]===i?a=t[3]:(a=(0,U.jsx)(me,{withHandle:!0,className:i}),t[2]=i,t[3]=a),a}function Ie(e){let t=(0,H.c)(36),{open:r,lineNumber:i,lineContent:a,initialComment:o,isEditing:c,onSave:l,onDelete:u,onClose:f}=e,[p,m]=(0,V.useState)((o===void 0?``:o)??``),h;t[0]!==l||t[1]!==p?(h=()=>{p.trim()&&l(p.trim())},t[0]=l,t[1]=p,t[2]=h):h=t[2];let g=h,_;t[3]===g?_=t[4]:(_=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),g())},t[3]=g,t[4]=_);let v=_,y;t[5]===f?y=t[6]:(y=e=>{e||f()},t[5]=f,t[6]=y);let x;t[7]===i?x=t[8]:(x=(0,U.jsx)(S,{children:(0,U.jsxs)(b,{children:[`Comment on line `,i]})}),t[7]=i,t[8]=x);let C;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(C=d(D.compact,`font-mono rounded bg-muted px-3 py-2 text-muted-foreground overflow-x-auto whitespace-pre`),t[9]=C):C=t[9];let w=a||` `,T;t[10]===w?T=t[11]:(T=(0,U.jsx)(`div`,{className:C,children:w}),t[10]=w,t[11]=T);let E;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>m(e.target.value),t[12]=E):E=t[12];let O;t[13]!==v||t[14]!==p?(O=(0,U.jsx)(se,{autoFocus:!0,placeholder:`Add a comment... (Cmd+Enter to save)`,value:p,onChange:E,onKeyDown:v,rows:12,className:`resize-none text-base`}),t[13]=v,t[14]=p,t[15]=O):O=t[15];let k;t[16]!==c||t[17]!==u?(k=c&&u&&(0,U.jsx)(s,{variant:`destructive`,size:`sm`,onClick:u,className:`mr-auto`,children:`Delete`}),t[16]=c,t[17]=u,t[18]=k):k=t[18];let A;t[19]===p?A=t[20]:(A=p.trim(),t[19]=p,t[20]=A);let te=!A,j;t[21]!==g||t[22]!==te?(j=(0,U.jsx)(s,{size:`sm`,onClick:g,disabled:te,children:`Save`}),t[21]=g,t[22]=te,t[23]=j):j=t[23];let M;t[24]!==k||t[25]!==j?(M=(0,U.jsxs)(ee,{className:`gap-2 sm:gap-0`,children:[k,j]}),t[24]=k,t[25]=j,t[26]=M):M=t[26];let N;t[27]!==O||t[28]!==M||t[29]!==x||t[30]!==T?(N=(0,U.jsxs)(ne,{className:`max-w-2xl`,children:[x,T,O,M]}),t[27]=O,t[28]=M,t[29]=x,t[30]=T,t[31]=N):N=t[31];let P;return t[32]!==r||t[33]!==N||t[34]!==y?(P=(0,U.jsx)(n,{open:r,onOpenChange:y,children:N}),t[32]=r,t[33]=N,t[34]=y,t[35]=P):P=t[35],P}var Le=F(e=>e.v0,{name:`ReviewLoadingFallback_1`,portals:[`v0`]}),Z=F(e=>(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,U.jsxs)(`div`,{className:`space-y-4 text-center`,children:[(0,U.jsx)(`p`,{className:e.v0,children:`Loading review changes is taking longer than expected.`}),e.v1]})}),{name:`ReviewLoadingFallback_2`,portals:[`v1`]}),Re=function(e){let t=(0,H.c)(5),{onRetry:n}=e,[r,i]=(0,V.useState)(!1),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{let e=window.setTimeout(()=>{i(!0)},15e3);return()=>{window.clearTimeout(e)}},o=[],t[0]=a,t[1]=o):(a=t[0],o=t[1]),(0,V.useEffect)(a,o),!r){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,U.jsx)(Le,{v0:(0,U.jsx)(I,{label:`Loading review changes...`})}),t[2]=e):e=t[2],e}let c;return t[3]===n?c=t[4]:(c=(0,U.jsx)(Z,{v0:D.bodyMuted,v1:(0,U.jsx)(s,{variant:`outline`,onClick:n,children:`Retry`})}),t[3]=n,t[4]=c),c},ze=A(`app.diff-view.ui`);function Be(e,t){return`git-diff:${e}:${t}`}function Ve(){return Error(`Loading review changes timed out. Please try again.`)}async function He(e,t=15e3){return Promise.race([te(e),new Promise((e,n)=>{window.setTimeout(()=>n(Ve()),t)})])}function Ue({threadId:e,onExit:n,loadVersion:o,cachedState:f,onCachedStateChange:g}){let y=re(Be(e,o),()=>He(e)),b=ue(),x=fe(e=>e.diffComments),S=fe(e=>e.projectModelSelections),{resolvedTheme:C}=ae(),T=oe(),{fetchUnifiedStatus:E}=ce(),[A,ee]=(0,V.useState)(f?.files??y.files??[]),[ne,j]=(0,V.useState)(null),[F,I]=(0,V.useState)(f?.selectedFileIndex??0),[L,ie]=(0,V.useState)(!1),[R,se]=(0,V.useState)(!1),[de,me]=(0,V.useState)(!1),[ve,z]=(0,V.useState)(!0),B=(0,V.useRef)(null);(0,V.useEffect)(()=>{ee(y.files??[]),I(e=>{let t=f?.selectedFileIndex??e,n=Math.max((y.files?.length??1)-1,0);return Math.min(t,n)})},[f?.selectedFileIndex,y.files]),(0,V.useEffect)(()=>{z(!0)},[e]);let ye=(0,V.useCallback)(e=>{I(e),T&&z(!1)},[T]);(0,V.useEffect)(()=>{g&&g(e=>{let t=A,n=Math.max(t.length-1,0),r=Math.min(F,n);return e?.files===t&&e.selectedFileIndex===r?e:{files:t,selectedFileIndex:r}})},[A,g,F]);let H=(0,V.useCallback)(()=>{z(!0)},[]),be=T&&!ve,W=(0,V.useMemo)(()=>x[e]??[],[x,e]),G=(0,V.useCallback)(t=>{let n=x[e]??[],r=typeof t==`function`?t(n):t;b({type:le.SetDiffComments,threadId:e,comments:r})},[b,e,x]),[K,Se]=(0,V.useState)(null),[q,Ce]=(0,V.useState)(null),[J,we]=(0,V.useState)(null),Y=(0,V.useRef)(null),Ee=(0,V.useRef)(W),De=(0,V.useRef)(K),Oe=(0,V.useRef)({isFullView:L,selectedFileIndex:F,files:A}),X=(0,V.useRef)({original:[],modified:[]}),ke=(0,V.useRef)(!0);(0,V.useEffect)(()=>{Ee.current=W},[W]),(0,V.useEffect)(()=>{De.current=K},[K]),(0,V.useEffect)(()=>{Oe.current={isFullView:L,selectedFileIndex:F,files:A}},[L,F,A]);let Ae=(0,V.useCallback)(()=>{B.current&&(R?B.current.expand():B.current.collapse())},[R]),je=(0,V.useCallback)(async()=>{if(e){j(null);try{ee((await te(e)).files||[]),I(0)}catch(e){j(e instanceof Error?e.message:`Failed to load diff`)}}},[e]),Me=(0,V.useCallback)(async t=>{try{await r(e,t.path),await Promise.all([je(),E(!0)])}catch(e){j(e instanceof Error?e.message:`Failed to revert file`)}},[e,je,E]),Ne=(0,V.useRef)(!1);(0,V.useEffect)(()=>{if((x[e]??[]).length>0){Ne.current=!0;return}_(e).then(t=>{t.diffComments&&t.diffComments.length>0&&b({type:le.SetDiffComments,threadId:e,comments:t.diffComments}),Ne.current=!0}).catch(()=>{Ne.current=!0})},[e]),(0,V.useEffect)(()=>{Ne.current&&k(e,{diffComments:W}).catch(()=>{})},[e,W]);let Le=(0,V.useMemo)(()=>xe(A),[A]),Z=e=>{if(e.hunks.length===0)return null;let t=1/0,n=0;return e.hunks.forEach(e=>{let r=Math.min(e.oldStart,e.newStart),i=e.oldStart+e.oldLines,a=e.newStart+e.newLines,o=Math.max(i,a);t=Math.min(t,r),n=Math.max(n,o)}),t===1/0?null:{startLine:Math.max(1,t-2),endLine:n+2}},Re=(e,t,n)=>e.split(`
2
+ `).slice(t-1,n).join(`
3
+ `),Ve=e=>{let t=Z(e);return t?t.startLine<=1:!0},Ue=e=>({ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,md:`markdown`,css:`css`,scss:`scss`,html:`html`,py:`python`,rb:`ruby`,go:`go`,rs:`rust`,java:`java`,kt:`kotlin`,swift:`swift`,c:`c`,cpp:`cpp`,h:`c`,hpp:`cpp`,sh:`shell`,yaml:`yaml`,yml:`yaml`,xml:`xml`,sql:`sql`})[e.split(`.`).pop()??``]||`plaintext`,Q=A[F],We=Q?.isBinary??!1,Ge=Q?L?Q.oldContent:(()=>{let e=Z(Q);return e?Re(Q.oldContent,e.startLine,e.endLine):Q.oldContent})():``,Ke=Q?L?Q.newContent:(()=>{let e=Z(Q);return e?Re(Q.newContent,e.startLine,e.endLine):Q.newContent})():``,$=(0,V.useCallback)(()=>{if(!ke.current)return;let e=Y.current;if(!e)return;let{isFullView:t,selectedFileIndex:n,files:r}=Oe.current,i=Ee.current,a=De.current,o=r[n];if(!o)return;let s=(e,r)=>{let s=t?null:Z(o),c=i.filter(e=>e.fileIndex===n&&e.side===r),l=new Set(c.map(e=>s?e.lineNumber-s.startLine+1:e.lineNumber)),u=e.getModel()?.getLineCount()??0,d=[];for(let e=1;e<=u;e++)l.has(e)||d.push({range:{startLineNumber:e,startColumn:1,endLineNumber:e,endColumn:1},options:{isWholeLine:!0,glyphMarginClassName:`diff-gutter-add-comment`,glyphMarginHoverMessage:{value:`$(add) Click to add a comment`},stickiness:P.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}});let f=c.map(e=>{let t=s?e.lineNumber-s.startLine+1:e.lineNumber;if(t<1)return null;let n=i.indexOf(e)===a;return{range:{startLineNumber:t,startColumn:1,endLineNumber:t,endColumn:1},options:{isWholeLine:!0,className:n?`diff-comment-active-line`:`diff-comment-marked-line`,glyphMarginClassName:n?`diff-comment-glyph-active`:`diff-comment-glyph`,glyphMarginHoverMessage:{value:e.comment},stickiness:P.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}}}).filter(e=>e!==null);d.push(...f);let p=r===`original`?X.current.original:X.current.modified,m=e.deltaDecorations(p,d);r===`original`?X.current.original=m:X.current.modified=m};s(e.getOriginalEditor(),`original`),s(e.getModifiedEditor(),`modified`)},[]);(0,V.useEffect)(()=>{$()},[$,W,K,F,L,Q]),(0,V.useEffect)(()=>()=>{Y.current=null,X.current={original:[],modified:[]}},[F]),(0,V.useEffect)(()=>()=>{ke.current=!1,Y.current&&=(Y.current.getOriginalEditor().getModel()?.dispose(),Y.current.getModifiedEditor().getModel()?.dispose(),Y.current.dispose(),null),X.current={original:[],modified:[]}},[]);let qe=(0,V.useCallback)(e=>{Y.current=e;let t=e=>e===P.MouseTargetType.GUTTER_GLYPH_MARGIN||e===P.MouseTargetType.GUTTER_LINE_NUMBERS||e===P.MouseTargetType.GUTTER_LINE_DECORATIONS||e===P.MouseTargetType.GUTTER_VIEW_ZONE,n=(e,n)=>{e.onMouseDown(r=>{if(!r.target?.position||!t(r.target.type))return;let i=r.target.position.lineNumber,{isFullView:a,selectedFileIndex:o,files:s}=Oe.current,c=s[o];if(!c)return;let l=a?null:Z(c),u=l?l.startLine+i-1:i,d=e.getModel()?.getLineContent(i)??``,f=Ee.current.find(e=>e.fileIndex===o&&e.lineNumber===u&&e.side===n);f?we(f):Ce({lineNumber:u,lineContent:d,side:n})})};n(e.getOriginalEditor(),`original`),n(e.getModifiedEditor(),`modified`),setTimeout(()=>{Y.current===e&&$()},150)},[$]),Je=(0,V.useCallback)(e=>{if(q&&Q){let t={id:`comment-${Date.now()}`,filePath:Q.path,fileIndex:F,lineNumber:q.lineNumber,lineContent:q.lineContent,comment:e,side:q.side};G(e=>[...e,t]),Ce(null)}else J&&(G(t=>t.map(t=>t.id===J.id?{...t,comment:e}:t)),we(null))},[q,J,Q,F,G]),Ye=(0,V.useCallback)(()=>{J&&(G(e=>e.filter(e=>e.id!==J.id)),we(null))},[J,G]),Xe=(0,V.useCallback)(e=>{if(W.length===0)return;let t=(e%W.length+W.length)%W.length,n=W[t];Se(t),I(n.fileIndex),T&&z(!1),setTimeout(()=>{let e=Y.current;if(!e)return;let t=A[n.fileIndex];if(!t)return;let r=L?null:Z(t),i=r?n.lineNumber-r.startLine+1:n.lineNumber;(n.side===`original`?e.getOriginalEditor():e.getModifiedEditor()).revealLineInCenter(Math.max(1,i)),$()},100)},[W,A,L,$,T]),Ze=(0,V.useCallback)(()=>{Xe((K??0)-1)},[Xe,K]),Qe=(0,V.useCallback)(()=>{Xe((K??-1)+1)},[Xe,K]),$e=(0,V.useCallback)(async()=>{let r=S[e];if(!r)try{let e=await t(),n=Object.values(e).flat();if(n.length>0)r=n[0];else{ze.error(`No models available to process comments`);return}}catch(e){ze.error(`Failed to load models:`,e);return}let i=r.id,a=r.provider;try{let{prompt:t}=await u(e,W);G([]),b({type:le.SetPendingChatMessage,message:{threadId:e,message:t,model:i,provider:a}}),n()}catch(e){ze.error(`Failed to fix comments:`,e),typeof window<`u`&&window.alert(`Failed to process comments. Please try again.`)}},[W,S,b,e,n,G]),et={readOnly:!0,renderSideBySide:!T,ignoreTrimWhitespace:!1,renderOverviewRuler:!0,scrollBeyondLastLine:!1,minimap:{enabled:!1},folding:!1,glyphMargin:!0,lineNumbers:Q&&(L||Ve(Q))?`on`:`off`,diffWordWrap:`on`,originalEditable:!1,automaticLayout:!0},tt=(0,U.jsx)(`div`,{className:`flex h-full min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden`,children:(0,U.jsx)(Te,{treeData:Le,files:A,error:ne,selectedFileIndex:F,onFileSelect:ye,onRevertFile:Me})}),nt=(0,U.jsxs)(`div`,{className:`diff-editor-panel flex h-full min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden bg-transparent`,children:[(0,U.jsxs)(pe,{className:d(`bg-transparent`,R&&`h-auto py-3 flex-col items-start gap-3 md:flex-row md:items-center md:h-[71px] md:py-0 md:gap-2 justify-between`),children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[be?(0,U.jsxs)(s,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground shrink-0`,onClick:H,children:[(0,U.jsx)(i,{className:`h-4 w-4`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Show file tree`})]}):(0,U.jsxs)(s,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground shrink-0`,onClick:Ae,children:[R?(0,U.jsx)(i,{className:`h-4 w-4`}):(0,U.jsx)(w,{className:`h-4 w-4`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Toggle file tree`})]}),(0,U.jsx)(`span`,{className:d(D.label,`text-foreground`),children:Q?Q.path:`Review Changes`})]}),(0,U.jsxs)(`div`,{className:d(`flex items-center gap-2`,R&&`ml-0`,!R&&`ml-auto`,`md:ml-auto`),children:[!We&&(0,U.jsx)(s,{variant:`ghost`,size:`sm`,onClick:()=>ie(e=>!e),disabled:!Q,className:d(D.compact,`h-8 gap-1 px-2`),children:L?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(l,{className:`h-3 w-3`}),` Show changes only`]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(a,{className:`h-3 w-3`}),` Show full file`]})}),W.length>0&&(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsxs)(h,{children:[(0,U.jsx)(v,{asChild:!0,children:(0,U.jsx)(s,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:Ze,disabled:(K??0)===0,children:(0,U.jsx)(c,{className:`h-3 w-3`})})}),(0,U.jsx)(M,{children:`Previous comment`})]}),(0,U.jsx)(`span`,{className:d(D.caption,`whitespace-nowrap`),children:W.length===1?`1 Comment`:`Comment ${(K??0)+1} of ${W.length}`}),(0,U.jsxs)(h,{children:[(0,U.jsx)(v,{asChild:!0,children:(0,U.jsx)(s,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:Qe,disabled:(K??0)===W.length-1,children:(0,U.jsx)(p,{className:`h-3 w-3`})})}),(0,U.jsx)(M,{children:`Next comment`})]})]}),W.length>0&&(0,U.jsxs)(h,{children:[(0,U.jsx)(v,{asChild:!0,children:(0,U.jsxs)(s,{size:`sm`,onClick:$e,className:d(D.compact,`h-8 gap-1 px-3 bg-foreground text-background hover:bg-foreground/90`),children:[(0,U.jsx)(m,{className:`h-3 w-3`}),`Fix all comments`]})}),(0,U.jsx)(M,{children:`Send all comments to Tarsk for resolution`})]})]})]}),(0,U.jsxs)(`div`,{className:`flex-1 bg-transparent relative`,children:[We&&Q?(0,U.jsx)(Pe,{threadId:e,file:Q}):(0,U.jsx)(N,{height:`100%`,language:Ue(Q?.path||``),original:Ge,modified:Ke,theme:C===`dark`?`vs-dark`:`vs-light`,onMount:qe,options:et},`diff-${F}`),(0,U.jsxs)(`div`,{className:`pointer-events-none absolute bottom-4 right-4 z-20 flex flex-col items-end gap-3`,children:[de&&(0,U.jsxs)(`div`,{className:`pointer-events-auto w-[min(100%,48rem)] rounded-2xl bg-background/50 p-4 backdrop-blur-md`,children:[(0,U.jsx)(`div`,{className:`mb-3 flex items-center justify-end`,children:(0,U.jsxs)(s,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>me(!1),children:[(0,U.jsx)(O,{className:`h-4 w-4`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Close chat`})]})}),(0,U.jsx)(he,{})]}),!de&&(0,U.jsxs)(h,{children:[(0,U.jsx)(v,{asChild:!0,children:(0,U.jsxs)(s,{size:`icon`,className:`pointer-events-auto h-12 w-12 rounded-full shadow-lg`,onClick:()=>me(!0),children:[(0,U.jsx)(m,{className:`h-5 w-5`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Open review chat`})]})}),(0,U.jsx)(M,{children:`Chat about this diff`})]})]})]})]});return(0,U.jsxs)(`div`,{className:`diff-view-root flex h-full min-h-0 w-full flex-col`,children:[(0,U.jsx)(`div`,{className:`diff-body flex min-h-0 w-full flex-1 overflow-hidden`,children:T?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{className:d(`flex min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden`,!ve&&`hidden`),children:tt}),(0,U.jsx)(`div`,{className:d(`flex min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden`,ve&&`hidden`),children:nt})]}):(0,U.jsxs)(ge,{direction:`horizontal`,children:[(0,U.jsx)(_e,{ref:B,defaultSize:25,minSize:12,maxSize:40,collapsible:!0,collapsedSize:0,onCollapse:()=>se(!0),onExpand:()=>se(!1),className:`border-r border-transparent`,children:tt}),(0,U.jsx)(Fe,{isOpen:!R}),(0,U.jsx)(_e,{className:`overflow-hidden border-l border-border bg-transparent`,children:nt})]})}),(0,U.jsx)(Ie,{open:q!==null||J!==null,lineNumber:J?.lineNumber??q?.lineNumber??0,lineContent:J?.lineContent??q?.lineContent??``,initialComment:J?.comment,isEditing:J!==null,onSave:Je,onDelete:Ye,onClose:()=>{Ce(null),we(null)}},`${J?.id??``}-${q?.lineNumber??``}-${q?.side??``}`)]})}function Q(e){let t=(0,H.c)(23),[n,r]=(0,V.useState)(0),[i,a]=(0,V.useState)(0),o=(0,V.useRef)(0),s=!!e.cachedState,c;t[0]===e.threadId?c=t[1]:(c=()=>{r(t=>(ie(Be(e.threadId,t)),t+1)),a(Ge)},t[0]=e.threadId,t[1]=c);let l=c,u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>{a(0),r(0),o.current=0},t[2]=u):u=t[2];let d;t[3]===e.threadId?d=t[4]:(d=[e.threadId],t[3]=e.threadId,t[4]=d),(0,V.useEffect)(u,d);let f,p;t[5]!==e.refreshTrigger||t[6]!==e.threadId?(f=()=>{!e.refreshTrigger||e.refreshTrigger<=o.current||(o.current=e.refreshTrigger,r(t=>(ie(Be(e.threadId,t)),t+1)),a(We))},p=[e.refreshTrigger,e.threadId],t[5]=e.refreshTrigger,t[6]=e.threadId,t[7]=f,t[8]=p):(f=t[7],p=t[8]),(0,V.useEffect)(f,p);let m=`${e.threadId}:${i}`,h;t[9]!==l||t[10]!==s?(h=s?null:(0,U.jsx)(Re,{onRetry:l}),t[9]=l,t[10]=s,t[11]=h):h=t[11];let g=`${e.threadId}:${n}`,_;t[12]!==n||t[13]!==e||t[14]!==g?(_=(0,U.jsx)(Ue,{...e,loadVersion:n},g),t[12]=n,t[13]=e,t[14]=g,t[15]=_):_=t[15];let v;t[16]!==h||t[17]!==_?(v=(0,U.jsx)(V.Suspense,{fallback:h,children:_}),t[16]=h,t[17]=_,t[18]=v):v=t[18];let y;return t[19]!==l||t[20]!==m||t[21]!==v?(y=(0,U.jsx)(L,{fallbackTitle:`Failed to load review changes`,onRetry:l,children:v},m),t[19]=l,t[20]=m,t[21]=v,t[22]=y):y=t[22],y}function We(e){return e+1}function Ge(e){return e+1}export{Q as DiffView,Q as default};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/explorer-tree-B60M0QAV.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-C2iIghSR.js","assets/monaco-CZnIWXyV.js","assets/monaco-Br_kD0ds.css","assets/history-view-BsN806ip.js","assets/dialogs-config-86QTDk4G.js","assets/onboarding-DCrFdRM5.js","assets/vosk-speech-Ce0kC8Ck.js","assets/react-vendor-DK2COBjg.js","assets/utils-DPYK-CSn.js","assets/index-DhnUeGIU.css","assets/api-BUjKoVUu.js","assets/context-menu-DO3hiSAo.js","assets/ui-components-BJRW2LJq.js","assets/explorer-view-BBaEk8i9.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Fs as t,Ii as n,Is as r,Rs as i,c as a,fs as o}from"./dialogs-config-86QTDk4G.js";import{r as s}from"./monaco-CZnIWXyV.js";import{l as c,n as l,u}from"./history-view-BsN806ip.js";import{C as d,F as f,P as p,W as m,f as h,m as g,p as _}from"./index-C2iIghSR.js";var v=r(),y=e(i(),1),b=t(),x=(0,y.lazy)(()=>s(()=>import(`./explorer-tree-B60M0QAV.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]))),S=(0,y.lazy)(()=>s(()=>import(`./explorer-view-BBaEk8i9.js`),__vite__mapDeps([15,1,2,3,4,5,6,7,8,9,10,11,12])));function C(){let e=(0,v.c)(49),t=m(w),r=d(),[i,s]=(0,y.useState)(null),[C,T]=(0,y.useState)(!0),{pendingExplorerPath:E,setPendingExplorerPath:D,explorerClearPath:O,setExplorerClearPath:k}=p(),A;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>{T(!0)},e[0]=A):A=e[0];let j;e[1]===t?j=e[2]:(j=[t],e[1]=t,e[2]=j),(0,y.useEffect)(A,j);let M;e[3]===r?M=e[4]:(M=e=>{s(e),r&&T(!1)},e[3]=r,e[4]=M);let N=M,P;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>{T(!0)},e[5]=P):P=e[5];let F=P,I;e[6]===r?I=e[7]:(I=e=>{s(e),r&&T(!1)},e[6]=r,e[7]=I);let L=I,R,z;e[8]!==r||e[9]!==E||e[10]!==D?(R=()=>{E&&(s({name:E.split(`/`).pop()??E,path:E,type:`file`}),r&&T(!1),D(null))},z=[r,E,D],e[8]=r,e[9]=E,e[10]=D,e[11]=R,e[12]=z):(R=e[11],z=e[12]),(0,y.useEffect)(R,z);let B,V;e[13]!==O||e[14]!==r||e[15]!==i||e[16]!==k?(B=()=>{O&&(i&&(i.path===O||i.path.startsWith(O+`/`))&&(s(null),r&&T(!0)),k(null))},V=[O,r,i,k],e[13]=O,e[14]=r,e[15]=i,e[16]=k,e[17]=B,e[18]=V):(B=e[17],V=e[18]),(0,y.useEffect)(B,V);let H;e[19]!==N||e[20]!==i?.path||e[21]!==t?(H=(0,b.jsx)(a,{className:`h-full`,children:t?(0,b.jsx)(f,{threadId:t,children:(0,b.jsx)(l,{fallbackTitle:`Failed to load files`,children:(0,b.jsx)(y.Suspense,{fallback:(0,b.jsx)(u,{}),children:(0,b.jsx)(x,{threadId:t,selectedPath:i?.path??null,onNodeSelect:N})})})}):(0,b.jsx)(`p`,{className:n(o.caption,`px-3 py-4 text-center`),children:`No thread selected.`})}),e[19]=N,e[20]=i?.path,e[21]=t,e[22]=H):H=e[22];let U=H,W;e[23]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,b.jsx)(c,{}),e[23]=W):W=e[23];let G=r&&!C,K;e[24]!==L||e[25]!==i||e[26]!==G?(K=(0,b.jsx)(y.Suspense,{fallback:W,children:(0,b.jsx)(S,{selectedFile:i,showTreeBackButton:G,onShowTree:F,onFileCreated:L})}),e[24]=L,e[25]=i,e[26]=G,e[27]=K):K=e[27];let q=K;if(r){let t=!C&&`hidden`,r;e[28]===t?r=e[29]:(r=n(`flex-1 min-h-0 overflow-hidden`,t),e[28]=t,e[29]=r);let i;e[30]!==U||e[31]!==r?(i=(0,b.jsx)(`div`,{className:r,children:U}),e[30]=U,e[31]=r,e[32]=i):i=e[32];let a=C&&`hidden`,o;e[33]===a?o=e[34]:(o=n(`flex-1 min-h-0 overflow-hidden`,a),e[33]=a,e[34]=o);let s;e[35]!==q||e[36]!==o?(s=(0,b.jsx)(`div`,{className:o,children:q}),e[35]=q,e[36]=o,e[37]=s):s=e[37];let c;return e[38]!==i||e[39]!==s?(c=(0,b.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:[i,s]}),e[38]=i,e[39]=s,e[40]=c):c=e[40],c}let J;e[41]===U?J=e[42]:(J=(0,b.jsx)(_,{defaultSize:25,minSize:15,maxSize:50,className:`overflow-hidden border-r border-border`,children:U}),e[41]=U,e[42]=J);let Y;e[43]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,b.jsx)(h,{withHandle:!0}),e[43]=Y):Y=e[43];let X;e[44]===q?X=e[45]:(X=(0,b.jsx)(_,{className:`overflow-hidden`,children:q}),e[44]=q,e[45]=X);let Z;return e[46]!==J||e[47]!==X?(Z=(0,b.jsx)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:(0,b.jsxs)(g,{direction:`horizontal`,className:`flex-1 overflow-hidden`,children:[J,Y,X]})}),e[46]=J,e[47]=X,e[48]=Z):Z=e[48],Z}function w(e){return e.selectedThreadId}export{C as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/explorer-tree-E_aVMvGb.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-Bn5BGXYs.js","assets/monaco-CZnIWXyV.js","assets/monaco-Br_kD0ds.css","assets/history-view-BmWodDne.js","assets/dialogs-config-DuZySBOC.js","assets/onboarding-BB-AWm5a.js","assets/vosk-speech-DyMTC-lJ.js","assets/react-vendor-DgF6pNAi.js","assets/utils-Dt3EZ8O5.js","assets/index-DhnUeGIU.css","assets/api-BqZXzYni.js","assets/context-menu-RForU18o.js","assets/ui-components-CEtP7zEi.js","assets/explorer-view-BajvTTr7.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Bs as t,Li as n,Ls as r,Rs as i,c as a,ps as o}from"./dialogs-config-DuZySBOC.js";import{r as s}from"./monaco-CZnIWXyV.js";import{l as c,n as l,u}from"./history-view-BmWodDne.js";import{C as d,F as f,P as p,W as m,f as h,m as g,p as _}from"./index-Bn5BGXYs.js";var v=i(),y=e(t(),1),b=r(),x=(0,y.lazy)(()=>s(()=>import(`./explorer-tree-E_aVMvGb.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]))),S=(0,y.lazy)(()=>s(()=>import(`./explorer-view-BajvTTr7.js`),__vite__mapDeps([15,1,2,3,4,5,6,7,8,9,10,11,12])));function C(){let e=(0,v.c)(49),t=m(w),r=d(),[i,s]=(0,y.useState)(null),[C,T]=(0,y.useState)(!0),{pendingExplorerPath:E,setPendingExplorerPath:D,explorerClearPath:O,setExplorerClearPath:k}=p(),A;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>{T(!0)},e[0]=A):A=e[0];let j;e[1]===t?j=e[2]:(j=[t],e[1]=t,e[2]=j),(0,y.useEffect)(A,j);let M;e[3]===r?M=e[4]:(M=e=>{s(e),r&&T(!1)},e[3]=r,e[4]=M);let N=M,P;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>{T(!0)},e[5]=P):P=e[5];let F=P,I;e[6]===r?I=e[7]:(I=e=>{s(e),r&&T(!1)},e[6]=r,e[7]=I);let L=I,R,z;e[8]!==r||e[9]!==E||e[10]!==D?(R=()=>{E&&(s({name:E.split(`/`).pop()??E,path:E,type:`file`}),r&&T(!1),D(null))},z=[r,E,D],e[8]=r,e[9]=E,e[10]=D,e[11]=R,e[12]=z):(R=e[11],z=e[12]),(0,y.useEffect)(R,z);let B,V;e[13]!==O||e[14]!==r||e[15]!==i||e[16]!==k?(B=()=>{O&&(i&&(i.path===O||i.path.startsWith(O+`/`))&&(s(null),r&&T(!0)),k(null))},V=[O,r,i,k],e[13]=O,e[14]=r,e[15]=i,e[16]=k,e[17]=B,e[18]=V):(B=e[17],V=e[18]),(0,y.useEffect)(B,V);let H;e[19]!==N||e[20]!==i?.path||e[21]!==t?(H=(0,b.jsx)(a,{className:`h-full`,children:t?(0,b.jsx)(f,{threadId:t,children:(0,b.jsx)(l,{fallbackTitle:`Failed to load files`,children:(0,b.jsx)(y.Suspense,{fallback:(0,b.jsx)(u,{}),children:(0,b.jsx)(x,{threadId:t,selectedPath:i?.path??null,onNodeSelect:N})})})}):(0,b.jsx)(`p`,{className:n(o.caption,`px-3 py-4 text-center`),children:`No thread selected.`})}),e[19]=N,e[20]=i?.path,e[21]=t,e[22]=H):H=e[22];let U=H,W;e[23]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,b.jsx)(c,{}),e[23]=W):W=e[23];let G=r&&!C,K;e[24]!==L||e[25]!==i||e[26]!==G?(K=(0,b.jsx)(y.Suspense,{fallback:W,children:(0,b.jsx)(S,{selectedFile:i,showTreeBackButton:G,onShowTree:F,onFileCreated:L})}),e[24]=L,e[25]=i,e[26]=G,e[27]=K):K=e[27];let q=K;if(r){let t=!C&&`hidden`,r;e[28]===t?r=e[29]:(r=n(`flex-1 min-h-0 overflow-hidden`,t),e[28]=t,e[29]=r);let i;e[30]!==U||e[31]!==r?(i=(0,b.jsx)(`div`,{className:r,children:U}),e[30]=U,e[31]=r,e[32]=i):i=e[32];let a=C&&`hidden`,o;e[33]===a?o=e[34]:(o=n(`flex-1 min-h-0 overflow-hidden`,a),e[33]=a,e[34]=o);let s;e[35]!==q||e[36]!==o?(s=(0,b.jsx)(`div`,{className:o,children:q}),e[35]=q,e[36]=o,e[37]=s):s=e[37];let c;return e[38]!==i||e[39]!==s?(c=(0,b.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:[i,s]}),e[38]=i,e[39]=s,e[40]=c):c=e[40],c}let J;e[41]===U?J=e[42]:(J=(0,b.jsx)(_,{defaultSize:25,minSize:15,maxSize:50,className:`overflow-hidden border-r border-border`,children:U}),e[41]=U,e[42]=J);let Y;e[43]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,b.jsx)(h,{withHandle:!0}),e[43]=Y):Y=e[43];let X;e[44]===q?X=e[45]:(X=(0,b.jsx)(_,{className:`overflow-hidden`,children:q}),e[44]=q,e[45]=X);let Z;return e[46]!==J||e[47]!==X?(Z=(0,b.jsx)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:(0,b.jsxs)(g,{direction:`horizontal`,className:`flex-1 overflow-hidden`,children:[J,Y,X]})}),e[46]=J,e[47]=X,e[48]=Z):Z=e[48],Z}function w(e){return e.selectedThreadId}export{C as default};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Br as t,Fo as n,Fs as r,Ii as i,Is as a,Lr as o,No as s,Pi as c,Rr as l,Rs as u,Zr as d,eo as f,fa as p,fs as m,ro as h,to as g,va as _}from"./dialogs-config-86QTDk4G.js";import{A as v,F as y,M as b,O as x,a as S,c as C,j as w,k as T,n as E,o as D,u as O}from"./history-view-BsN806ip.js";import{d as k}from"./onboarding-DCrFdRM5.js";import{B as A,I as j,M as ee,N as te,P as M,S as N,j as ne}from"./index-C2iIghSR.js";import{a as P,i as F,n as I,r as L,t as R}from"./context-menu-DO3hiSAo.js";import{l as z,n as re,o as ie,r as ae,s as oe,t as se}from"./api-BUjKoVUu.js";import{t as B}from"./ui-components-BJRW2LJq.js";var V=a(),H=e(u(),1),U=r(),W=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let o;n[3]===r?o=n[4]:(o=i(`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]!==a||n[6]!==t||n[7]!==o?(s=(0,U.jsx)(B,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});W.displayName=B.displayName;var G=H.forwardRef((e,t)=>{let n=(0,V.c)(10),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let o;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,U.jsx)(p,{className:`mr-2 h-4 w-4 shrink-0 opacity-50`}),n[3]=o):o=n[3];let s;n[4]===r?s=n[5]:(s=i(`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`,r),n[4]=r,n[5]=s);let c;return n[6]!==a||n[7]!==t||n[8]!==s?(c=(0,U.jsxs)(`div`,{className:`flex items-center border-b px-3`,"cmdk-input-wrapper":``,children:[o,(0,U.jsx)(B.Input,{ref:t,className:s,...a})]}),n[6]=a,n[7]=t,n[8]=s,n[9]=c):c=n[9],c});G.displayName=B.Input.displayName;var K=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let o;n[3]===r?o=n[4]:(o=i(`max-h-[300px] overflow-y-auto overflow-x-hidden`,r),n[3]=r,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,U.jsx)(B.List,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});K.displayName=B.List.displayName;var q=H.forwardRef((e,t)=>{let n=(0,V.c)(4),r;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=i(m.bodyMuted,`py-6 text-center`),n[0]=r):r=n[0];let a;return n[1]!==e||n[2]!==t?(a=(0,U.jsx)(B.Empty,{ref:t,className:r,...e}),n[1]=e,n[2]=t,n[3]=a):a=n[3],a});q.displayName=B.Empty.displayName;var J=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let o;n[3]===r?o=n[4]:(o=i(`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]!==a||n[6]!==t||n[7]!==o?(s=(0,U.jsx)(B.Group,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});J.displayName=B.Group.displayName;var ce=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let o;n[3]===r?o=n[4]:(o=i(`-mx-1 h-px bg-border`,r),n[3]=r,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,U.jsx)(B.Separator,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});ce.displayName=B.Separator.displayName;var le=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let o;n[3]===r?o=n[4]:(o=i(i(m.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]!==a||n[6]!==t||n[7]!==o?(s=(0,U.jsx)(B.Item,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});le.displayName=B.Item.displayName;var Y=e=>{let t=(0,V.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let a;t[3]===n?a=t[4]:(a=i(m.compact,`ml-auto tracking-widest text-muted-foreground`,n),t[3]=n,t[4]=a);let o;return t[5]!==r||t[6]!==a?(o=(0,U.jsx)(`span`,{className:a,...r}),t[5]=r,t[6]=a,t[7]=o):o=t[7],o};Y.displayName=`CommandShortcut`;var X=100,ue=500;function Z(e){return e.trim().toLowerCase().split(/\s+/).filter(Boolean)}function de(e,t){return t.length===0?!0:t.every(t=>e.haystack.includes(t))}function fe(e,t,n){if(t.length===0)return[];let r=[];for(let n of e)if(de(n,t)&&(r.push(n.node),r.length>=ue))break;return r.sort((e,t)=>pe(e,t,n)).slice(0,X)}function pe(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 me(e){let t=(0,V.c)(38),{items:n,isReady:r,onRequestIndex:a,onOpenChange:o,onSelect:s}=e,c=r===void 0?!1:r,l=(0,H.useRef)(null),u=(0,H.useRef)(!1),p=(0,H.useRef)(!1),[h,g]=(0,H.useState)(!1),[_,v]=(0,H.useState)(``),y=(0,H.useDeferredValue)(_),b;t[0]===a?b=t[1]:(b=function(){p.current||(p.current=!0,a())},t[0]=a,t[1]=b);let x=b,S;t[2]!==y||t[3]!==n?(S=fe(n,Z(y),y),t[2]=y,t[3]=n,t[4]=S):S=t[4];let C=S,w,T;t[5]!==o||t[6]!==_?(w=()=>{let e=_.trim().length>0;g(e),u.current!==e&&(u.current=e,o(e))},T=[o,_],t[5]=o,t[6]=_,t[7]=w,t[8]=T):(w=t[7],T=t[8]),(0,H.useEffect)(w,T);let E;t[9]===o?E=t[10]:(E=function(e){e||v(``),g(e),o(e),e&&requestAnimationFrame(()=>l.current?.focus())},t[9]=o,t[10]=E);let D=E,O;t[11]!==o||t[12]!==s?(O=function(e){s(e),g(!1),o(!1),v(``)},t[11]=o,t[12]=s,t[13]=O):O=t[13];let k=O,A;t[14]===x?A=t[15]:(A=e=>{x(),v(e.target.value)},t[14]=x,t[15]=A);let j;t[16]!==_||t[17]!==x||t[18]!==A?(j=(0,U.jsx)(te,{asChild:!0,children:(0,U.jsx)(`div`,{children:(0,U.jsx)(d,{ref:l,value:_,onPointerDown:x,onChange:A,placeholder:`Search files and folders`,className:`pr-[4px]`})})}),t[16]=_,t[17]=x,t[18]=A,t[19]=j):j=t[19];let M;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(M=i(m.compact,`py-4`),t[20]=M):M=t[20];let P=c?`No matches found.`:`Indexing files and folders...`,F;t[21]===P?F=t[22]:(F=(0,U.jsx)(q,{className:M,children:P}),t[21]=P,t[22]=F);let I;if(t[23]!==k||t[24]!==C){let e;t[26]===k?e=t[27]:(e=e=>(0,U.jsxs)(le,{value:e.path,onSelect:()=>k(e),className:e.ignored?`opacity-50`:void 0,children:[e.type===`folder`?(0,U.jsx)(f,{className:`h-4 w-4 text-muted-foreground`}):(0,U.jsx)(N,{filename:e.name}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`truncate`,children:e.name}),(0,U.jsx)(`div`,{className:i(m.compact,`truncate text-muted-foreground`),children:e.path})]})]},e.path),t[26]=k,t[27]=e),I=C.map(e),t[23]=k,t[24]=C,t[25]=I}else I=t[25];let L;t[28]===I?L=t[29]:(L=(0,U.jsx)(J,{children:I}),t[28]=I,t[29]=L);let R;t[30]!==F||t[31]!==L?(R=(0,U.jsx)(ee,{align:`start`,side:`bottom`,sideOffset:4,onOpenAutoFocus:Q,className:`w-[var(--radix-popover-trigger-width)] p-0`,children:(0,U.jsx)(W,{shouldFilter:!1,children:(0,U.jsxs)(K,{children:[F,L]})})}),t[30]=F,t[31]=L,t[32]=R):R=t[32];let z;return t[33]!==D||t[34]!==h||t[35]!==R||t[36]!==j?(z=(0,U.jsxs)(ne,{open:h,onOpenChange:D,children:[j,R]}),t[33]=D,t[34]=h,t[35]=R,t[36]=j,t[37]=z):z=t[37],z}function Q(e){return e.preventDefault()}function he(e,t,n){return`explorer-dir:${e}:${t}:${n}`}function ge(e){let t=(0,V.c)(12),{threadId:n,dirPath:r,version:i,children:a}=e,o;t[0]!==r||t[1]!==n||t[2]!==i?(o=he(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=()=>ie(n,r).then(_e),t[4]=r,t[5]=n,t[6]=s):s=t[6];let c=S(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,U.jsx)(U.Fragment,{children:l}),t[10]=l,t[11]=u),u}function _e(e){return e.entries}function ve(e){let t=(0,V.c)(17),{defaultValue:n,onCommit:r,onCancel:i,level:a,basePadding:o,icon:s}=e,c=(0,H.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,H.useEffect)(l,u);let d;t[2]!==i||t[3]!==r?(d=function(e){if(e.key===`Enter`){let e=c.current?.value.trim()??``;e?r(e):i()}else e.key===`Escape`&&i()},t[2]=i,t[3]=r,t[4]=d):d=t[4];let f=d,p;t[5]!==i||t[6]!==r?(p=function(){let e=c.current?.value.trim()??``;e?r(e):i()},t[5]=i,t[6]=r,t[7]=p):p=t[7];let m=p,h;t[8]!==n||t[9]!==m||t[10]!==f?(h=(0,U.jsx)(`input`,{ref:c,defaultValue:n,onKeyDown:f,onBlur:m,className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`,onClick:$}),t[8]=n,t[9]=m,t[10]=f,t[11]=h):h=t[11];let g;return t[12]!==o||t[13]!==s||t[14]!==a||t[15]!==h?(g=(0,U.jsxs)(k,{level:a,basePadding:o,children:[s,h]}),t[12]=o,t[13]=s,t[14]=a,t[15]=h,t[16]=g):g=t[16],g}function $(e){return e.stopPropagation()}function ye(e){return e.map(e=>({node:e,haystack:`${e.name} ${e.path}`.toLowerCase()}))}function be(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(0,t):``}var xe=(0,H.memo)(function e({node:t,level:r,threadId:i,selectedPath:a,expandedPaths:o,getDirVersion:c,renamingPath:l,newItemIn:u,onToggleFolder:d,onSelectNode:p,onStartRename:m,onCommitRename:_,onCancelRename:v,onDelete:y,onOpen:b,onCopyReference:x,onNewFile:S,onNewFolder:w,onCommitNewItem:T,onCancelNewItem:E}){let D=o.has(t.path),O=l===t.path,A=u?.dirPath===t.path&&D;return t.type===`folder`?(0,U.jsxs)(R,{children:[(0,U.jsx)(P,{asChild:!0,children:(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(k,{level:r,basePadding:10,selected:a===t.path,className:t.ignored?`opacity-50`:void 0,onClick:e=>{e.stopPropagation(),d(t)},children:[(0,U.jsx)(`span`,{className:`text-muted-foreground w-3 flex-shrink-0`,children:D?(0,U.jsx)(n,{className:`h-3 w-3`}):(0,U.jsx)(s,{className:`h-3 w-3`})}),O?(0,U.jsxs)(U.Fragment,{children:[D?(0,U.jsx)(g,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(f,{className:`h-4 w-4 flex-shrink-0`}),(0,U.jsx)(`input`,{autoFocus:!0,defaultValue:t.name,onKeyDown:e=>{if(e.key===`Enter`){let n=e.target.value.trim();n?_(t,n):v()}else e.key===`Escape`&&v()},onBlur:e=>{let n=e.target.value.trim();n?_(t,n):v()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`})]}):(0,U.jsxs)(U.Fragment,{children:[D?(0,U.jsx)(g,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(f,{className:`h-4 w-4 flex-shrink-0`}),(0,U.jsx)(`span`,{className:`flex-1 truncate`,children:t.name})]})]}),D&&(0,U.jsx)(`div`,{children:(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(C,{}),children:(0,U.jsx)(ge,{threadId:i,dirPath:t.path,version:c(t.path),children:t=>(0,U.jsxs)(U.Fragment,{children:[A&&(0,U.jsx)(ve,{defaultValue:``,level:r+1,basePadding:u.type===`folder`?10:22,icon:u.type===`folder`?(0,U.jsx)(f,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(h,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:T,onCancel:E}),t.map(t=>(0,U.jsx)(e,{node:t,level:r+1,threadId:i,selectedPath:a,expandedPaths:o,getDirVersion:c,renamingPath:l,newItemIn:u,onToggleFolder:d,onSelectNode:p,onStartRename:m,onCommitRename:_,onCancelRename:v,onDelete:y,onOpen:b,onCopyReference:x,onNewFile:S,onNewFolder:w,onCommitNewItem:T,onCancelNewItem:E},t.path))]})})})})]})}),(0,U.jsxs)(I,{children:[(0,U.jsx)(L,{onSelect:()=>b(t),children:`Open`}),(0,U.jsx)(F,{}),(0,U.jsx)(L,{onSelect:()=>S(t.path),children:`New File...`}),(0,U.jsx)(L,{onSelect:()=>w(t.path),children:`New Folder...`}),(0,U.jsx)(F,{}),(0,U.jsx)(L,{onSelect:()=>x(t),children:`Copy Reference`}),(0,U.jsx)(L,{onSelect:()=>m(t),children:`Rename...`}),(0,U.jsx)(L,{onSelect:()=>y(t),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]}):(0,U.jsxs)(R,{children:[(0,U.jsx)(P,{asChild:!0,children:(0,U.jsxs)(k,{level:r,basePadding:22,selected:a===t.path,className:t.ignored?`opacity-50`:void 0,onClick:()=>p(t),children:[(0,U.jsx)(N,{filename:t.name}),O?(0,U.jsx)(`input`,{autoFocus:!0,defaultValue:t.name,onKeyDown:e=>{if(e.key===`Enter`){let n=e.target.value.trim();n?_(t,n):v()}else e.key===`Escape`&&v()},onBlur:e=>{let n=e.target.value.trim();n?_(t,n):v()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`}):(0,U.jsx)(`span`,{className:`flex-1 truncate`,children:t.name})]})}),(0,U.jsxs)(I,{children:[(0,U.jsx)(L,{onSelect:()=>b(t),children:`Open`}),(0,U.jsx)(F,{}),(0,U.jsx)(L,{onSelect:()=>S(be(t.path)),children:`New File...`}),(0,U.jsx)(L,{onSelect:()=>w(be(t.path)),children:`New Folder...`}),(0,U.jsx)(F,{}),(0,U.jsx)(L,{onSelect:()=>x(t),children:`Copy Reference`}),(0,U.jsx)(L,{onSelect:()=>m(t),children:`Rename...`}),(0,U.jsx)(L,{onSelect:()=>y(t),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]})}),Se=new Map;function Ce({threadId:e,selectedPath:n,onNodeSelect:r}){let[i,a]=(0,H.useState)(()=>new Map([[``,0]])),[s,u]=(0,H.useState)(new Set),[d,p]=(0,H.useState)(null),[m,g]=(0,H.useState)(null),[S,C]=(0,H.useState)(null),[k,ee]=(0,H.useState)(!1),[te,N]=(0,H.useState)([]),[ne,F]=(0,H.useState)(!1),[B,V]=(0,H.useState)(!1),W=(0,H.useRef)(null),G=(0,H.useRef)(0),K=(0,H.useRef)(null),{explorerRefreshTick:q,pendingExplorerPath:J,setExplorerClearPath:ce,triggerExplorerRefresh:le}=M(),{fetchUnifiedStatus:Y}=j(),X=(0,H.useMemo)(()=>`${e}:${q}`,[q,e]),ue=(0,H.useCallback)(e=>{(0,H.startTransition)(()=>{ee(t=>t===e?t:e)})},[]),Z=(0,H.useCallback)(async()=>{if(!e)return;let t=Se.get(X);if(t){N(t),F(!0);return}if(W.current!==X){W.current=X,N([]),F(!1);try{let t=ye((await ie(e,``,!0)).entries);Se.set(X,t),N(t),F(!0)}catch{N([]),F(!1)}finally{W.current===X&&(W.current=null)}}},[X,e]),de=(0,H.useCallback)(()=>{V(!0)},[]),fe=(0,H.useCallback)(()=>{Se.delete(X),N([]),F(!1)},[X]),pe=(0,H.useCallback)(()=>{fe(),B&&Z()},[fe,Z,B]),Q=(0,H.useCallback)(e=>i.get(e)??0,[i]),_e=(0,H.useCallback)(e=>{a(t=>{let n=new Map(t);return n.set(e,(t.get(e)??0)+1),n})},[]),$=(0,H.useCallback)(t=>{e&&(D(he(e,t,Q(t))),_e(t))},[_e,Q,e]),Ce=(0,H.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);u(e=>{let t=new Set(e);for(let e of r)t.add(e);return t})},[e]);(0,H.useEffect)(()=>{if(!e)return;let t=K.current!==null&&K.current!==e;K.current=e,t&&(a(new Map([[``,0]])),u(new Set),p(null),g(null),G.current=q)},[q,e]),(0,H.useEffect)(()=>{!e||q<=G.current||(G.current=q,a(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;D(he(e,i,n)),r.set(i,n+1)}return r}))},[q,s,e]),(0,H.useEffect)(()=>{N([]),F(!1),V(!1),W.current=null},[X]),(0,H.useEffect)(()=>{!B||!e||Z()},[Z,B,e]),(0,H.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){u(e=>{let t=new Set(e);for(let e of n)t.add(e);return t});for(let e of n)a(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})}},[J,e]);function we(e){s.has(e.path)?u(t=>{let n=new Set(t);return n.delete(e.path),n}):(u(t=>new Set(t).add(e.path)),a(t=>{if(t.has(e.path))return t;let n=new Map(t);return n.set(e.path,0),n}))}function Te(e){C(e)}async function Ee(t){try{await oe(e,t.path)}catch{A({title:`Error`,description:`Failed to open "${t.name}"`,variant:`destructive`})}}async function De(e){try{await navigator.clipboard.writeText(e.path);let t=A({title:`Copied`,description:`Reference copied to clipboard.`});window.setTimeout(()=>{t.dismiss()},2e3)}catch{A({title:`Error`,description:`Failed to copy reference for "${e.name}"`,variant:`destructive`})}}async function Oe(){if(!S)return;let t=S;C(null);try{await ae(e,t.path),ce(t.path),$(be(t.path)),pe(),Y(!0),u(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),a(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n})}catch{A({title:`Error`,description:`Failed to move "${t.name}" to trash`,variant:`destructive`})}}function ke(e){g(null),p(e.path)}async function Ae(t,n){if(n===t.name){p(null);return}p(null);try{await z(e,t.path,n),$(be(t.path)),pe(),Y(!0),t.type===`folder`&&(u(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),a(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}))}catch{A({title:`Error`,description:`Failed to rename "${t.name}"`,variant:`destructive`})}}function je(e){p(null),s.has(e)||(u(t=>new Set(t).add(e)),a(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})),g({dirPath:e,type:`file`})}function Me(e){p(null),s.has(e)||(u(t=>new Set(t).add(e)),a(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})),g({dirPath:e,type:`folder`})}async function Ne(t){if(!m)return;let{dirPath:n,type:r}=m;g(null);try{r===`file`?await se(e,n,t):await re(e,n,t),$(n),pe(),Y(!0)}catch{A({title:`Error`,description:`Failed to create ${r} "${t}"`,variant:`destructive`})}}function Pe(){g(null)}function Fe(e){Ce(e),e.type===`file`&&r(e)}let Ie=m?.dirPath===``?(0,U.jsx)(ve,{defaultValue:``,level:0,basePadding:m.type===`folder`?10:22,icon:m.type===`folder`?(0,U.jsx)(f,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(h,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:Ne,onCancel:Pe}):null;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(x,{open:S!==null,onOpenChange:e=>!e&&C(null),children:(0,U.jsxs)(w,{children:[(0,U.jsx)(y,{children:`Move to Trash`}),(0,U.jsxs)(b,{children:[`Move “`,S?.name,`” to trash?`]}),(0,U.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[(0,U.jsx)(v,{children:`Cancel`}),(0,U.jsx)(T,{onClick:()=>void Oe(),children:`Move to Trash`})]})]})}),(0,U.jsx)(`div`,{className:`border-b border-border bg-background px-2 py-2`,children:(0,U.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,U.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,U.jsx)(me,{items:te,isReady:ne,onRequestIndex:de,onOpenChange:ue,onSelect:e=>Fe(e)},X)}),(0,U.jsxs)(o,{children:[(0,U.jsx)(t,{asChild:!0,children:(0,U.jsx)(c,{variant:`ghost`,size:`icon-sm`,onClick:le,"aria-label":`Refresh file listing`,children:(0,U.jsx)(_,{className:`h-4 w-4`})})}),(0,U.jsx)(l,{children:`Refresh`})]})]})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(P,{asChild:!0,disabled:k,children:(0,U.jsx)(`div`,{className:`py-2 min-h-full`,children:(0,U.jsx)(E,{fallbackTitle:`Failed to load files`,onRetry:()=>$(``),children:(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(O,{}),children:(0,U.jsx)(ge,{threadId:e,dirPath:``,version:Q(``),children:t=>(0,U.jsxs)(U.Fragment,{children:[Ie,t.map(t=>(0,U.jsx)(xe,{node:t,level:0,threadId:e,selectedPath:n,expandedPaths:s,getDirVersion:Q,renamingPath:d,newItemIn:m,onToggleFolder:we,onSelectNode:r,onStartRename:ke,onCommitRename:Ae,onCancelRename:()=>p(null),onDelete:Te,onOpen:Ee,onCopyReference:De,onNewFile:je,onNewFolder:Me,onCommitNewItem:Ne,onCancelNewItem:Pe},t.path))]})})})})})}),(0,U.jsxs)(I,{children:[(0,U.jsx)(L,{onSelect:()=>je(``),children:`New File...`}),(0,U.jsx)(L,{onSelect:()=>Me(``),children:`New Folder...`})]})]})]})}export{Ce as default};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Bs as t,Fi as n,Io as r,Li as i,Ls as a,Po as o,Qr as s,Rr as c,Rs as l,Vr as u,io as d,no as f,pa as p,ps as m,to as h,ya as g,zr as _}from"./dialogs-config-DuZySBOC.js";import{A as v,F as y,M as b,O as x,a as S,c as C,j as w,k as T,n as E,o as D,u as O}from"./history-view-BmWodDne.js";import{d as k}from"./onboarding-BB-AWm5a.js";import{B as A,I as j,M as ee,N as te,P as M,S as N,j as ne}from"./index-Bn5BGXYs.js";import{a as P,i as F,n as I,r as L,t as R}from"./context-menu-RForU18o.js";import{l as z,n as re,o as ie,r as ae,s as oe,t as se}from"./api-BqZXzYni.js";import{t as B}from"./ui-components-CEtP7zEi.js";var V=l(),H=e(t(),1),U=a(),W=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let o;n[3]===r?o=n[4]:(o=i(`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]!==a||n[6]!==t||n[7]!==o?(s=(0,U.jsx)(B,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});W.displayName=B.displayName;var G=H.forwardRef((e,t)=>{let n=(0,V.c)(10),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let o;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,U.jsx)(p,{className:`mr-2 h-4 w-4 shrink-0 opacity-50`}),n[3]=o):o=n[3];let s;n[4]===r?s=n[5]:(s=i(`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`,r),n[4]=r,n[5]=s);let c;return n[6]!==a||n[7]!==t||n[8]!==s?(c=(0,U.jsxs)(`div`,{className:`flex items-center border-b px-3`,"cmdk-input-wrapper":``,children:[o,(0,U.jsx)(B.Input,{ref:t,className:s,...a})]}),n[6]=a,n[7]=t,n[8]=s,n[9]=c):c=n[9],c});G.displayName=B.Input.displayName;var K=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let o;n[3]===r?o=n[4]:(o=i(`max-h-[300px] overflow-y-auto overflow-x-hidden`,r),n[3]=r,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,U.jsx)(B.List,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});K.displayName=B.List.displayName;var q=H.forwardRef((e,t)=>{let n=(0,V.c)(4),r;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=i(m.bodyMuted,`py-6 text-center`),n[0]=r):r=n[0];let a;return n[1]!==e||n[2]!==t?(a=(0,U.jsx)(B.Empty,{ref:t,className:r,...e}),n[1]=e,n[2]=t,n[3]=a):a=n[3],a});q.displayName=B.Empty.displayName;var J=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let o;n[3]===r?o=n[4]:(o=i(`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]!==a||n[6]!==t||n[7]!==o?(s=(0,U.jsx)(B.Group,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});J.displayName=B.Group.displayName;var ce=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let o;n[3]===r?o=n[4]:(o=i(`-mx-1 h-px bg-border`,r),n[3]=r,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,U.jsx)(B.Separator,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});ce.displayName=B.Separator.displayName;var le=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let o;n[3]===r?o=n[4]:(o=i(i(m.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]!==a||n[6]!==t||n[7]!==o?(s=(0,U.jsx)(B.Item,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});le.displayName=B.Item.displayName;var Y=e=>{let t=(0,V.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let a;t[3]===n?a=t[4]:(a=i(m.compact,`ml-auto tracking-widest text-muted-foreground`,n),t[3]=n,t[4]=a);let o;return t[5]!==r||t[6]!==a?(o=(0,U.jsx)(`span`,{className:a,...r}),t[5]=r,t[6]=a,t[7]=o):o=t[7],o};Y.displayName=`CommandShortcut`;var X=100,ue=500;function Z(e){return e.trim().toLowerCase().split(/\s+/).filter(Boolean)}function de(e,t){return t.length===0?!0:t.every(t=>e.haystack.includes(t))}function fe(e,t,n){if(t.length===0)return[];let r=[];for(let n of e)if(de(n,t)&&(r.push(n.node),r.length>=ue))break;return r.sort((e,t)=>pe(e,t,n)).slice(0,X)}function pe(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 me(e){let t=(0,V.c)(38),{items:n,isReady:r,onRequestIndex:a,onOpenChange:o,onSelect:c}=e,l=r===void 0?!1:r,u=(0,H.useRef)(null),d=(0,H.useRef)(!1),f=(0,H.useRef)(!1),[p,g]=(0,H.useState)(!1),[_,v]=(0,H.useState)(``),y=(0,H.useDeferredValue)(_),b;t[0]===a?b=t[1]:(b=function(){f.current||(f.current=!0,a())},t[0]=a,t[1]=b);let x=b,S;t[2]!==y||t[3]!==n?(S=fe(n,Z(y),y),t[2]=y,t[3]=n,t[4]=S):S=t[4];let C=S,w,T;t[5]!==o||t[6]!==_?(w=()=>{let e=_.trim().length>0;g(e),d.current!==e&&(d.current=e,o(e))},T=[o,_],t[5]=o,t[6]=_,t[7]=w,t[8]=T):(w=t[7],T=t[8]),(0,H.useEffect)(w,T);let E;t[9]===o?E=t[10]:(E=function(e){e||v(``),g(e),o(e),e&&requestAnimationFrame(()=>u.current?.focus())},t[9]=o,t[10]=E);let D=E,O;t[11]!==o||t[12]!==c?(O=function(e){c(e),g(!1),o(!1),v(``)},t[11]=o,t[12]=c,t[13]=O):O=t[13];let k=O,A;t[14]===x?A=t[15]:(A=e=>{x(),v(e.target.value)},t[14]=x,t[15]=A);let j;t[16]!==_||t[17]!==x||t[18]!==A?(j=(0,U.jsx)(te,{asChild:!0,children:(0,U.jsx)(`div`,{children:(0,U.jsx)(s,{ref:u,value:_,onPointerDown:x,onChange:A,placeholder:`Search files and folders`,className:`pr-[4px]`})})}),t[16]=_,t[17]=x,t[18]=A,t[19]=j):j=t[19];let M;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(M=i(m.compact,`py-4`),t[20]=M):M=t[20];let P=l?`No matches found.`:`Indexing files and folders...`,F;t[21]===P?F=t[22]:(F=(0,U.jsx)(q,{className:M,children:P}),t[21]=P,t[22]=F);let I;if(t[23]!==k||t[24]!==C){let e;t[26]===k?e=t[27]:(e=e=>(0,U.jsxs)(le,{value:e.path,onSelect:()=>k(e),className:e.ignored?`opacity-50`:void 0,children:[e.type===`folder`?(0,U.jsx)(h,{className:`h-4 w-4 text-muted-foreground`}):(0,U.jsx)(N,{filename:e.name}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`truncate`,children:e.name}),(0,U.jsx)(`div`,{className:i(m.compact,`truncate text-muted-foreground`),children:e.path})]})]},e.path),t[26]=k,t[27]=e),I=C.map(e),t[23]=k,t[24]=C,t[25]=I}else I=t[25];let L;t[28]===I?L=t[29]:(L=(0,U.jsx)(J,{children:I}),t[28]=I,t[29]=L);let R;t[30]!==F||t[31]!==L?(R=(0,U.jsx)(ee,{align:`start`,side:`bottom`,sideOffset:4,onOpenAutoFocus:Q,className:`w-[var(--radix-popover-trigger-width)] p-0`,children:(0,U.jsx)(W,{shouldFilter:!1,children:(0,U.jsxs)(K,{children:[F,L]})})}),t[30]=F,t[31]=L,t[32]=R):R=t[32];let z;return t[33]!==D||t[34]!==p||t[35]!==R||t[36]!==j?(z=(0,U.jsxs)(ne,{open:p,onOpenChange:D,children:[j,R]}),t[33]=D,t[34]=p,t[35]=R,t[36]=j,t[37]=z):z=t[37],z}function Q(e){return e.preventDefault()}function he(e,t,n){return`explorer-dir:${e}:${t}:${n}`}function ge(e){let t=(0,V.c)(12),{threadId:n,dirPath:r,version:i,children:a}=e,o;t[0]!==r||t[1]!==n||t[2]!==i?(o=he(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=()=>ie(n,r).then(_e),t[4]=r,t[5]=n,t[6]=s):s=t[6];let c=S(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,U.jsx)(U.Fragment,{children:l}),t[10]=l,t[11]=u),u}function _e(e){return e.entries}function ve(e){let t=(0,V.c)(17),{defaultValue:n,onCommit:r,onCancel:i,level:a,basePadding:o,icon:s}=e,c=(0,H.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,H.useEffect)(l,u);let d;t[2]!==i||t[3]!==r?(d=function(e){if(e.key===`Enter`){let e=c.current?.value.trim()??``;e?r(e):i()}else e.key===`Escape`&&i()},t[2]=i,t[3]=r,t[4]=d):d=t[4];let f=d,p;t[5]!==i||t[6]!==r?(p=function(){let e=c.current?.value.trim()??``;e?r(e):i()},t[5]=i,t[6]=r,t[7]=p):p=t[7];let m=p,h;t[8]!==n||t[9]!==m||t[10]!==f?(h=(0,U.jsx)(`input`,{ref:c,defaultValue:n,onKeyDown:f,onBlur:m,className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`,onClick:$}),t[8]=n,t[9]=m,t[10]=f,t[11]=h):h=t[11];let g;return t[12]!==o||t[13]!==s||t[14]!==a||t[15]!==h?(g=(0,U.jsxs)(k,{level:a,basePadding:o,children:[s,h]}),t[12]=o,t[13]=s,t[14]=a,t[15]=h,t[16]=g):g=t[16],g}function $(e){return e.stopPropagation()}function ye(e){return e.map(e=>({node:e,haystack:`${e.name} ${e.path}`.toLowerCase()}))}function be(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(0,t):``}var xe=(0,H.memo)(function e({node:t,level:n,threadId:i,selectedPath:a,expandedPaths:s,getDirVersion:c,renamingPath:l,newItemIn:u,onToggleFolder:p,onSelectNode:m,onStartRename:g,onCommitRename:_,onCancelRename:v,onDelete:y,onOpen:b,onCopyReference:x,onNewFile:S,onNewFolder:w,onCommitNewItem:T,onCancelNewItem:E}){let D=s.has(t.path),O=l===t.path,A=u?.dirPath===t.path&&D;return t.type===`folder`?(0,U.jsxs)(R,{children:[(0,U.jsx)(P,{asChild:!0,children:(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(k,{level:n,basePadding:10,selected:a===t.path,className:t.ignored?`opacity-50`:void 0,onClick:e=>{e.stopPropagation(),p(t)},children:[(0,U.jsx)(`span`,{className:`text-muted-foreground w-3 flex-shrink-0`,children:D?(0,U.jsx)(r,{className:`h-3 w-3`}):(0,U.jsx)(o,{className:`h-3 w-3`})}),O?(0,U.jsxs)(U.Fragment,{children:[D?(0,U.jsx)(f,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(h,{className:`h-4 w-4 flex-shrink-0`}),(0,U.jsx)(`input`,{autoFocus:!0,defaultValue:t.name,onKeyDown:e=>{if(e.key===`Enter`){let n=e.target.value.trim();n?_(t,n):v()}else e.key===`Escape`&&v()},onBlur:e=>{let n=e.target.value.trim();n?_(t,n):v()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`})]}):(0,U.jsxs)(U.Fragment,{children:[D?(0,U.jsx)(f,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(h,{className:`h-4 w-4 flex-shrink-0`}),(0,U.jsx)(`span`,{className:`flex-1 truncate`,children:t.name})]})]}),D&&(0,U.jsx)(`div`,{children:(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(C,{}),children:(0,U.jsx)(ge,{threadId:i,dirPath:t.path,version:c(t.path),children:t=>(0,U.jsxs)(U.Fragment,{children:[A&&(0,U.jsx)(ve,{defaultValue:``,level:n+1,basePadding:u.type===`folder`?10:22,icon:u.type===`folder`?(0,U.jsx)(h,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(d,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:T,onCancel:E}),t.map(t=>(0,U.jsx)(e,{node:t,level:n+1,threadId:i,selectedPath:a,expandedPaths:s,getDirVersion:c,renamingPath:l,newItemIn:u,onToggleFolder:p,onSelectNode:m,onStartRename:g,onCommitRename:_,onCancelRename:v,onDelete:y,onOpen:b,onCopyReference:x,onNewFile:S,onNewFolder:w,onCommitNewItem:T,onCancelNewItem:E},t.path))]})})})})]})}),(0,U.jsxs)(I,{children:[(0,U.jsx)(L,{onSelect:()=>b(t),children:`Open`}),(0,U.jsx)(F,{}),(0,U.jsx)(L,{onSelect:()=>S(t.path),children:`New File...`}),(0,U.jsx)(L,{onSelect:()=>w(t.path),children:`New Folder...`}),(0,U.jsx)(F,{}),(0,U.jsx)(L,{onSelect:()=>x(t),children:`Copy Reference`}),(0,U.jsx)(L,{onSelect:()=>g(t),children:`Rename...`}),(0,U.jsx)(L,{onSelect:()=>y(t),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]}):(0,U.jsxs)(R,{children:[(0,U.jsx)(P,{asChild:!0,children:(0,U.jsxs)(k,{level:n,basePadding:22,selected:a===t.path,className:t.ignored?`opacity-50`:void 0,onClick:()=>m(t),children:[(0,U.jsx)(N,{filename:t.name}),O?(0,U.jsx)(`input`,{autoFocus:!0,defaultValue:t.name,onKeyDown:e=>{if(e.key===`Enter`){let n=e.target.value.trim();n?_(t,n):v()}else e.key===`Escape`&&v()},onBlur:e=>{let n=e.target.value.trim();n?_(t,n):v()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`}):(0,U.jsx)(`span`,{className:`flex-1 truncate`,children:t.name})]})}),(0,U.jsxs)(I,{children:[(0,U.jsx)(L,{onSelect:()=>b(t),children:`Open`}),(0,U.jsx)(F,{}),(0,U.jsx)(L,{onSelect:()=>S(be(t.path)),children:`New File...`}),(0,U.jsx)(L,{onSelect:()=>w(be(t.path)),children:`New Folder...`}),(0,U.jsx)(F,{}),(0,U.jsx)(L,{onSelect:()=>x(t),children:`Copy Reference`}),(0,U.jsx)(L,{onSelect:()=>g(t),children:`Rename...`}),(0,U.jsx)(L,{onSelect:()=>y(t),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]})}),Se=new Map;function Ce({threadId:e,selectedPath:t,onNodeSelect:r}){let[i,a]=(0,H.useState)(()=>new Map([[``,0]])),[o,s]=(0,H.useState)(new Set),[l,f]=(0,H.useState)(null),[p,m]=(0,H.useState)(null),[S,C]=(0,H.useState)(null),[k,ee]=(0,H.useState)(!1),[te,N]=(0,H.useState)([]),[ne,F]=(0,H.useState)(!1),[B,V]=(0,H.useState)(!1),W=(0,H.useRef)(null),G=(0,H.useRef)(0),K=(0,H.useRef)(null),{explorerRefreshTick:q,pendingExplorerPath:J,setExplorerClearPath:ce,triggerExplorerRefresh:le}=M(),{fetchUnifiedStatus:Y}=j(),X=(0,H.useMemo)(()=>`${e}:${q}`,[q,e]),ue=(0,H.useCallback)(e=>{(0,H.startTransition)(()=>{ee(t=>t===e?t:e)})},[]),Z=(0,H.useCallback)(async()=>{if(!e)return;let t=Se.get(X);if(t){N(t),F(!0);return}if(W.current!==X){W.current=X,N([]),F(!1);try{let t=ye((await ie(e,``,!0)).entries);Se.set(X,t),N(t),F(!0)}catch{N([]),F(!1)}finally{W.current===X&&(W.current=null)}}},[X,e]),de=(0,H.useCallback)(()=>{V(!0)},[]),fe=(0,H.useCallback)(()=>{Se.delete(X),N([]),F(!1)},[X]),pe=(0,H.useCallback)(()=>{fe(),B&&Z()},[fe,Z,B]),Q=(0,H.useCallback)(e=>i.get(e)??0,[i]),_e=(0,H.useCallback)(e=>{a(t=>{let n=new Map(t);return n.set(e,(t.get(e)??0)+1),n})},[]),$=(0,H.useCallback)(t=>{e&&(D(he(e,t,Q(t))),_e(t))},[_e,Q,e]),Ce=(0,H.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);s(e=>{let t=new Set(e);for(let e of r)t.add(e);return t})},[e]);(0,H.useEffect)(()=>{if(!e)return;let t=K.current!==null&&K.current!==e;K.current=e,t&&(a(new Map([[``,0]])),s(new Set),f(null),m(null),G.current=q)},[q,e]),(0,H.useEffect)(()=>{!e||q<=G.current||(G.current=q,a(t=>{let n=new Set([``]);for(let e of o)n.add(e);let r=new Map(t);for(let i of n){let n=t.get(i)??0;D(he(e,i,n)),r.set(i,n+1)}return r}))},[q,o,e]),(0,H.useEffect)(()=>{N([]),F(!1),V(!1),W.current=null},[X]),(0,H.useEffect)(()=>{!B||!e||Z()},[Z,B,e]),(0,H.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){s(e=>{let t=new Set(e);for(let e of n)t.add(e);return t});for(let e of n)a(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})}},[J,e]);function we(e){o.has(e.path)?s(t=>{let n=new Set(t);return n.delete(e.path),n}):(s(t=>new Set(t).add(e.path)),a(t=>{if(t.has(e.path))return t;let n=new Map(t);return n.set(e.path,0),n}))}function Te(e){C(e)}async function Ee(t){try{await oe(e,t.path)}catch{A({title:`Error`,description:`Failed to open "${t.name}"`,variant:`destructive`})}}async function De(e){try{await navigator.clipboard.writeText(e.path);let t=A({title:`Copied`,description:`Reference copied to clipboard.`});window.setTimeout(()=>{t.dismiss()},2e3)}catch{A({title:`Error`,description:`Failed to copy reference for "${e.name}"`,variant:`destructive`})}}async function Oe(){if(!S)return;let t=S;C(null);try{await ae(e,t.path),ce(t.path),$(be(t.path)),pe(),Y(!0),s(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),a(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n})}catch{A({title:`Error`,description:`Failed to move "${t.name}" to trash`,variant:`destructive`})}}function ke(e){m(null),f(e.path)}async function Ae(t,n){if(n===t.name){f(null);return}f(null);try{await z(e,t.path,n),$(be(t.path)),pe(),Y(!0),t.type===`folder`&&(s(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),a(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}))}catch{A({title:`Error`,description:`Failed to rename "${t.name}"`,variant:`destructive`})}}function je(e){f(null),o.has(e)||(s(t=>new Set(t).add(e)),a(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})),m({dirPath:e,type:`file`})}function Me(e){f(null),o.has(e)||(s(t=>new Set(t).add(e)),a(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})),m({dirPath:e,type:`folder`})}async function Ne(t){if(!p)return;let{dirPath:n,type:r}=p;m(null);try{r===`file`?await se(e,n,t):await re(e,n,t),$(n),pe(),Y(!0)}catch{A({title:`Error`,description:`Failed to create ${r} "${t}"`,variant:`destructive`})}}function Pe(){m(null)}function Fe(e){Ce(e),e.type===`file`&&r(e)}let Ie=p?.dirPath===``?(0,U.jsx)(ve,{defaultValue:``,level:0,basePadding:p.type===`folder`?10:22,icon:p.type===`folder`?(0,U.jsx)(h,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(d,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:Ne,onCancel:Pe}):null;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(x,{open:S!==null,onOpenChange:e=>!e&&C(null),children:(0,U.jsxs)(w,{children:[(0,U.jsx)(y,{children:`Move to Trash`}),(0,U.jsxs)(b,{children:[`Move “`,S?.name,`” to trash?`]}),(0,U.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[(0,U.jsx)(v,{children:`Cancel`}),(0,U.jsx)(T,{onClick:()=>void Oe(),children:`Move to Trash`})]})]})}),(0,U.jsx)(`div`,{className:`border-b border-border bg-background px-2 py-2`,children:(0,U.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,U.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,U.jsx)(me,{items:te,isReady:ne,onRequestIndex:de,onOpenChange:ue,onSelect:e=>Fe(e)},X)}),(0,U.jsxs)(c,{children:[(0,U.jsx)(u,{asChild:!0,children:(0,U.jsx)(n,{variant:`ghost`,size:`icon-sm`,onClick:le,"aria-label":`Refresh file listing`,children:(0,U.jsx)(g,{className:`h-4 w-4`})})}),(0,U.jsx)(_,{children:`Refresh`})]})]})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(P,{asChild:!0,disabled:k,children:(0,U.jsx)(`div`,{className:`py-2 min-h-full`,children:(0,U.jsx)(E,{fallbackTitle:`Failed to load files`,onRetry:()=>$(``),children:(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(O,{}),children:(0,U.jsx)(ge,{threadId:e,dirPath:``,version:Q(``),children:n=>(0,U.jsxs)(U.Fragment,{children:[Ie,n.map(n=>(0,U.jsx)(xe,{node:n,level:0,threadId:e,selectedPath:t,expandedPaths:o,getDirVersion:Q,renamingPath:l,newItemIn:p,onToggleFolder:we,onSelectNode:r,onStartRename:ke,onCommitRename:Ae,onCancelRename:()=>f(null),onDelete:Te,onOpen:Ee,onCopyReference:De,onNewFile:je,onNewFolder:Me,onCommitNewItem:Ne,onCancelNewItem:Pe},n.path))]})})})})})}),(0,U.jsxs)(I,{children:[(0,U.jsx)(L,{onSelect:()=>je(``),children:`New File...`}),(0,U.jsx)(L,{onSelect:()=>Me(``),children:`New Folder...`})]})]})]})}export{Ce as default};
@@ -1,4 +1,4 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ba as t,Fs as n,Ii as r,Io as i,Is as a,Ko as o,Pi as s,Rs as c,Sa as l,To as u,ao as d,at as ee,ba as f,fs as p,ka as te,mo as m,ns as ne,oo as h,rr as re,rs as g}from"./dialogs-config-86QTDk4G.js";import{M as ie}from"./react-vendor-DK2COBjg.js";import{I as _,a as v,l as y,n as b,o as x}from"./history-view-BsN806ip.js";import{n as ae}from"./utils-DPYK-CSn.js";import{A as oe,B as S,D as C,E as w,P as T,R as se,T as ce,W as le,d as ue}from"./index-C2iIghSR.js";import{a as E,c as de,i as D,o as O,s as fe,t as pe,u as me}from"./api-BUjKoVUu.js";var k=a(),A=n(),j=e(c(),1),M=_(e=>(0,A.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center`,children:[e.v0,(0,A.jsx)(`p`,{className:e.v1,children:`Select a thread to browse its files`})]}),{name:`ExplorerView_1`,portals:[`v0`]}),N=_(e=>(0,A.jsxs)(`div`,{className:`explorer-view-root flex flex-col h-full print:block print:h-auto`,children:[e.v0,(0,A.jsx)(`div`,{className:`flex-1 overflow-hidden print:overflow-visible print:flex-none`,children:(0,A.jsx)(`div`,{className:`h-full relative overflow-hidden print:h-auto print:overflow-visible`,children:e.v1})}),e.v2]}),{name:`ExplorerView_2`,portals:[`v0`,`v1`,`v2`]}),P=function({selectedFile:e,showTreeBackButton:n=!1,onShowTree:a,onFileCreated:o}){let{resolvedTheme:c}=ae(),d=le(e=>e.selectedThreadId),{triggerExplorerRefresh:m}=T(),g=(0,j.useRef)(null),_=(0,j.useRef)(null),v=(0,j.useRef)(!1),[E,D]=(0,j.useState)(null),[O,k]=(0,j.useState)(!1),[P,F]=(0,j.useState)(!1),[U,W]=(0,j.useState)(`edit`),[ve,ye]=(0,j.useState)(0),[G,be]=(0,j.useState)(null),[K,q]=(0,j.useState)(!1),xe=e?.path??null;(0,j.useEffect)(()=>{d&&ee(d).then(be).catch(()=>{})},[d]);let Se=async()=>{if(!(!G||K)){q(!0);try{await navigator.clipboard.writeText(G),S({title:`Copied`,description:`Repository folder path copied to clipboard.`})}catch(e){V(`Failed to copy explorer folder path`,{threadId:d,folderPath:G},e),S({title:`Error`,description:`Failed to copy path to clipboard.`,variant:`destructive`})}finally{q(!1)}}},Ce=async()=>{if(d)try{await fe(d,`.`)}catch(e){V(`Failed to open explorer repository folder`,{threadId:d,folderPath:G},e),S({title:`Error`,description:`Failed to open repository folder.`,variant:`destructive`})}},we=(0,j.useCallback)(async e=>{if(d)try{let t=await L(d,e);await pe(d,``,t);let n={name:t,path:t,type:`file`};_.current=t,v.current=!0,o?.(n),m(),S({title:`Created`,description:`${t} created successfully.`})}catch(t){V(`Failed to create explorer file`,{threadId:d,extension:e},t),S({title:`Error`,description:`Failed to create file.`,variant:`destructive`})}},[d,o,m]),J=e?ne(e.path,e.name):null,Y=e?.type===`file`&&d&&!J?e:null,X=Y?`${d}:${Y.path}:${ve}`:null,Z=E&&E.key===X?E:null,Q=Z?.content??``,Te=Z?.original??``;(0,j.useEffect)(()=>()=>{g.current&&=(g.current.getModel()?.dispose(),g.current.dispose(),null)},[]),(0,j.useEffect)(()=>{e?.type===`file`?_.current===e.path?(_.current=null,W(`edit`)):W(R(e.path)?`view`:`edit`):W(`edit`)},[xe,d]);async function $(){if(!(!d||!e||!X)){k(!0);try{await me(d,e.path,Q),D({key:X,content:Q,original:Q}),S({title:`Saved`,description:`${e.name} saved successfully.`})}catch(t){V(`Failed to save explorer file`,{threadId:d,path:e.path},t),S({title:`Error`,description:t instanceof Error?t.message:`Failed to save file`,variant:`destructive`})}finally{k(!1)}}}async function Ee(){if(!(!d||!e||P)){F(!0);try{if(!re()){if(typeof window>`u`)return;let t=document.querySelector(`[data-markdown-print-content]`);if(!(t instanceof HTMLElement)){S({title:`Print unavailable`,description:`Couldn't find the markdown preview to print.`,variant:`destructive`});return}let n=`<!doctype html>
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Aa as t,Bs as n,Ca as r,Eo as i,Fi as a,Li as o,Lo as s,Ls as c,Rs as l,Va as u,at as d,ho as f,ir as ee,is as p,oo as m,ps as h,qo as g,rs as te,so as _,xa as ne}from"./dialogs-config-DuZySBOC.js";import{M as re}from"./react-vendor-DgF6pNAi.js";import{I as v,a as y,l as b,n as x,o as S}from"./history-view-BmWodDne.js";import{n as ie}from"./utils-Dt3EZ8O5.js";import{A as ae,B as C,D as w,E as T,P as oe,R as se,T as ce,W as le,d as ue}from"./index-Bn5BGXYs.js";import{a as E,c as de,i as D,o as O,s as fe,t as pe,u as me}from"./api-BqZXzYni.js";var k=l(),A=c(),j=e(n(),1),M=v(e=>(0,A.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center`,children:[e.v0,(0,A.jsx)(`p`,{className:e.v1,children:`Select a thread to browse its files`})]}),{name:`ExplorerView_1`,portals:[`v0`]}),N=v(e=>(0,A.jsxs)(`div`,{className:`explorer-view-root flex flex-col h-full print:block print:h-auto`,children:[e.v0,(0,A.jsx)(`div`,{className:`flex-1 overflow-hidden print:overflow-visible print:flex-none`,children:(0,A.jsx)(`div`,{className:`h-full relative overflow-hidden print:h-auto print:overflow-visible`,children:e.v1})}),e.v2]}),{name:`ExplorerView_2`,portals:[`v0`,`v1`,`v2`]}),P=function({selectedFile:e,showTreeBackButton:n=!1,onShowTree:c,onFileCreated:l}){let{resolvedTheme:f}=ie(),p=le(e=>e.selectedThreadId),{triggerExplorerRefresh:m}=oe(),g=(0,j.useRef)(null),v=(0,j.useRef)(null),y=(0,j.useRef)(!1),[E,D]=(0,j.useState)(null),[O,k]=(0,j.useState)(!1),[P,F]=(0,j.useState)(!1),[U,W]=(0,j.useState)(`edit`),[ve,ye]=(0,j.useState)(0),[G,be]=(0,j.useState)(null),[K,q]=(0,j.useState)(!1),xe=e?.path??null;(0,j.useEffect)(()=>{p&&d(p).then(be).catch(()=>{})},[p]);let Se=async()=>{if(!(!G||K)){q(!0);try{await navigator.clipboard.writeText(G),C({title:`Copied`,description:`Repository folder path copied to clipboard.`})}catch(e){V(`Failed to copy explorer folder path`,{threadId:p,folderPath:G},e),C({title:`Error`,description:`Failed to copy path to clipboard.`,variant:`destructive`})}finally{q(!1)}}},Ce=async()=>{if(p)try{await fe(p,`.`)}catch(e){V(`Failed to open explorer repository folder`,{threadId:p,folderPath:G},e),C({title:`Error`,description:`Failed to open repository folder.`,variant:`destructive`})}},we=(0,j.useCallback)(async e=>{if(p)try{let t=await L(p,e);await pe(p,``,t);let n={name:t,path:t,type:`file`};v.current=t,y.current=!0,l?.(n),m(),C({title:`Created`,description:`${t} created successfully.`})}catch(t){V(`Failed to create explorer file`,{threadId:p,extension:e},t),C({title:`Error`,description:`Failed to create file.`,variant:`destructive`})}},[p,l,m]),J=e?te(e.path,e.name):null,Y=e?.type===`file`&&p&&!J?e:null,X=Y?`${p}:${Y.path}:${ve}`:null,Z=E&&E.key===X?E:null,Q=Z?.content??``,Te=Z?.original??``;(0,j.useEffect)(()=>()=>{g.current&&=(g.current.getModel()?.dispose(),g.current.dispose(),null)},[]),(0,j.useEffect)(()=>{e?.type===`file`?v.current===e.path?(v.current=null,W(`edit`)):W(R(e.path)?`view`:`edit`):W(`edit`)},[xe,p]);async function $(){if(!(!p||!e||!X)){k(!0);try{await me(p,e.path,Q),D({key:X,content:Q,original:Q}),C({title:`Saved`,description:`${e.name} saved successfully.`})}catch(t){V(`Failed to save explorer file`,{threadId:p,path:e.path},t),C({title:`Error`,description:t instanceof Error?t.message:`Failed to save file`,variant:`destructive`})}finally{k(!1)}}}async function Ee(){if(!(!p||!e||P)){F(!0);try{if(!ee()){if(typeof window>`u`)return;let t=document.querySelector(`[data-markdown-print-content]`);if(!(t instanceof HTMLElement)){C({title:`Print unavailable`,description:`Couldn't find the markdown preview to print.`,variant:`destructive`});return}let n=`<!doctype html>
2
2
  <html>
3
3
  <head>
4
4
  <meta charset="utf-8" />
@@ -72,4 +72,4 @@ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ba as t,Fs as n,Ii as
72
72
  }, { once: true });
73
73
  <\/script>
74
74
  </body>
75
- </html>`,r=window.open(``,`_blank`,`noopener,noreferrer`);if(!r){S({title:`Print blocked`,description:`Allow pop-ups to print this file.`,variant:`destructive`});return}r.document.open(),r.document.write(n),r.document.close();return}S({title:`PDF created`,description:`Opened ${(await de(d,e.path)).outputPath.split(/[\\/]/).pop()??`the PDF`} in your default app.`})}catch(t){V(`Failed to print markdown file as PDF`,{threadId:d,path:e.path},t),S({title:`PDF export failed`,description:t instanceof Error?t.message:`Failed to convert this markdown file to PDF.`,variant:`destructive`})}finally{F(!1)}}}function De(){!d||!Y||(x(B(d,Y.path)),ye(e=>e+1))}return d?(0,A.jsx)(N,{v0:(0,A.jsxs)(ue,{className:`justify-between print:hidden`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[n&&a?(0,A.jsxs)(s,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0 text-muted-foreground electrobun-webkit-app-region-no-drag`,onClick:a,children:[(0,A.jsx)(te,{className:`h-4 w-4`}),(0,A.jsx)(`span`,{className:`sr-only`,children:`Show file tree`})]}):null,(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,A.jsx)(`span`,{className:r(p.label,`truncate text-foreground`),children:e?e.name:`Select a file to edit`}),(0,A.jsx)(`span`,{className:r(p.compact,`truncate text-muted-foreground`),children:e?e.path:`Browse and edit repository files`})]})]}),(0,A.jsxs)(`div`,{className:`flex gap-2`,children:[Y&&Z?(0,A.jsxs)(A.Fragment,{children:[R(Y.path)?(0,A.jsxs)(`div`,{className:`flex rounded-full border border-input bg-background p-0.5`,children:[(0,A.jsx)(s,{size:`sm`,variant:U===`view`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>W(`view`),children:`View`}),(0,A.jsx)(s,{size:`sm`,variant:U===`edit`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>W(`edit`),children:`Edit`})]}):null,R(Y.path)&&U===`view`?(0,A.jsxs)(s,{size:`sm`,variant:`outline`,onClick:()=>void Ee(),disabled:P,children:[P?(0,A.jsx)(t,{className:`h-4 w-4 animate-spin`}):(0,A.jsx)(f,{className:`h-4 w-4`}),P?`Printing…`:`Print`]}):null,(0,A.jsxs)(s,{size:`sm`,onClick:()=>void $(),disabled:O||!Q||Q===Te,children:[O?(0,A.jsx)(t,{className:`h-4 w-4 animate-spin`}):null,`Save`]})]}):null,e?null:(0,A.jsxs)(ce,{children:[(0,A.jsx)(oe,{asChild:!0,children:(0,A.jsxs)(s,{size:`sm`,className:`gap-1.5`,children:[(0,A.jsx)(l,{className:`h-3.5 w-3.5`}),`New file`]})}),(0,A.jsx)(w,{align:`end`,children:I.map(({label:e,ext:t,icon:n})=>(0,A.jsxs)(C,{onSelect:()=>void we(t),children:[(0,A.jsx)(n,{className:`h-4 w-4`}),e]},t))})]})]})]}),v1:Y?(0,A.jsxs)(b,{fallbackTitle:`Failed to load file`,onRetry:De,children:[(0,A.jsx)(j.Suspense,{fallback:(0,A.jsx)(y,{}),children:(0,A.jsx)(he,{threadId:d,path:Y.path,contentKey:X??``,onContentReady:D},X??void 0)}),Z?R(Y.path)&&U===`view`?(0,A.jsx)(`div`,{className:`h-full overflow-auto p-6 print:h-auto print:overflow-visible print:p-0`,children:(0,A.jsx)(`div`,{className:`mx-auto max-w-4xl print:max-w-none`,"data-markdown-print-content":!0,children:(0,A.jsx)(se,{content:Q,enableMermaid:!0})})}):(0,A.jsx)(ie,{height:`100%`,language:z(Y.path),value:Q,onChange:e=>D(t=>t&&{...t,content:e??``}),onMount:e=>{g.current=e,v.current&&(v.current=!1,e.focus())},theme:c===`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,A.jsx)(y,{})]},X??void 0):e?.type===`file`&&J===`image`?(0,A.jsx)(b,{fallbackTitle:`Failed to load image`,onRetry:()=>{!d||!e||x(H(d,e.path))},children:(0,A.jsx)(j.Suspense,{fallback:(0,A.jsx)(y,{}),children:(0,A.jsx)(ge,{threadId:d,path:e.path,alt:e.name})})},e.path):e?.type===`file`&&J===`video`?(0,A.jsx)(b,{fallbackTitle:`Failed to load video`,onRetry:()=>{!d||!e||x(H(d,e.path))},children:(0,A.jsx)(j.Suspense,{fallback:(0,A.jsx)(y,{}),children:(0,A.jsx)(_e,{threadId:d,path:e.path})})},e.path):(0,A.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center p-8`,children:[(0,A.jsx)(`h2`,{className:r(p.pageTitle,`text-foreground`),children:`File Explorer`}),(0,A.jsx)(`p`,{className:r(p.pageSubtitle),children:`Browse and edit files`})]}),v2:e?null:(0,A.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 px-4 py-2`,children:G?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`button`,{type:`button`,onClick:()=>void Ce(),className:r(p.compact,`min-w-0 flex-1 truncate text-left font-mono text-muted-foreground hover:text-foreground hover:underline`),title:G,children:G}),(0,A.jsxs)(s,{variant:`ghost`,size:`icon`,className:`h-7 w-7 shrink-0`,onClick:()=>void Se(),disabled:K,children:[K?(0,A.jsx)(i,{className:`h-3.5 w-3.5`}):(0,A.jsx)(u,{className:`h-3.5 w-3.5`}),(0,A.jsx)(`span`,{className:`sr-only`,children:`Copy path`})]})]}):(0,A.jsx)(`p`,{className:r(p.compact,`text-muted-foreground/50 italic`),children:`Loading path...`})})}):(0,A.jsx)(M,{v0:(0,A.jsx)(h,{className:`h-8 w-8 text-muted-foreground`}),v1:p.bodyMuted})},F=o(`explorer.preview`),I=[{label:`Markdown`,ext:`md`,icon:h},{label:`TypeScript`,ext:`ts`,icon:m},{label:`Text`,ext:`txt`,icon:d}];async function L(e,t){try{let n=await O(e,``),r=new Set(n.entries.map(e=>e.name)),i=`untitled`,a=`${i}.${t}`,o=2;for(;r.has(a);)a=`${i}${o}.${t}`,o++;return a}catch{return`untitled.${t}`}}function R(e){return g(e)===`md`}function z(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`}[g(e)]??`plaintext`}function B(e,t){return`explorer-file:${e}:${t}`}function he(e){let t=(0,k.c)(11),{threadId:n,path:r,contentKey:i,onContentReady:a}=e,o;t[0]!==r||t[1]!==n?(o=B(n,r),t[0]=r,t[1]=n,t[2]=o):o=t[2];let s;t[3]!==r||t[4]!==n?(s=async()=>{try{return await E(n,r)}catch(e){let t=e;throw V(`Failed to load explorer file preview`,{threadId:n,path:r},t),t}},t[3]=r,t[4]=n,t[5]=s):s=t[5];let c=v(o,s),l,u;return t[6]!==i||t[7]!==a||t[8]!==c.content?(l=()=>{a({key:i,content:c.content,original:c.content})},u=[a,c.content,i],t[6]=i,t[7]=a,t[8]=c.content,t[9]=l,t[10]=u):(l=t[9],u=t[10]),(0,j.useLayoutEffect)(l,u),null}function V(e,t,n){F.error(e,{...t,error:n})}function H(e,t){return`explorer-media:${e}:${t}`}function U(e,t){let n=(0,k.c)(11),r;n[0]!==t||n[1]!==e?(r=H(e,t),n[0]=t,n[1]=e,n[2]=r):r=n[2];let i;n[3]!==t||n[4]!==e?(i=async()=>{try{return await D(e,t)}catch(n){let r=n;throw V(`Failed to load explorer media preview`,{threadId:e,path:t},r),r}},n[3]=t,n[4]=e,n[5]=i):i=n[5];let a=v(r,i),o;n[6]===a?o=n[7]:(o=URL.createObjectURL(a),n[6]=a,n[7]=o);let s=o,c,l;return n[8]===s?(c=n[9],l=n[10]):(c=()=>()=>{URL.revokeObjectURL(s)},l=[s],n[8]=s,n[9]=c,n[10]=l),(0,j.useEffect)(c,l),s}function ge(e){let t=(0,k.c)(3),{threadId:n,path:r,alt:i}=e,a=U(n,r),o;return t[0]!==i||t[1]!==a?(o=(0,A.jsx)(`div`,{className:`flex items-center justify-center h-full p-4 overflow-auto`,children:(0,A.jsx)(`img`,{src:a,alt:i,className:`max-w-full max-h-full object-contain`})}),t[0]=i,t[1]=a,t[2]=o):o=t[2],o}function _e(e){let t=(0,k.c)(2),{threadId:n,path:r}=e,i=U(n,r),a;return t[0]===i?a=t[1]:(a=(0,A.jsx)(`div`,{className:`flex items-center justify-center h-full p-4`,children:(0,A.jsx)(`video`,{src:i,controls:!0,className:`max-w-full max-h-full`})}),t[0]=i,t[1]=a),a}export{P as default};
75
+ </html>`,r=window.open(``,`_blank`,`noopener,noreferrer`);if(!r){C({title:`Print blocked`,description:`Allow pop-ups to print this file.`,variant:`destructive`});return}r.document.open(),r.document.write(n),r.document.close();return}C({title:`PDF created`,description:`Opened ${(await de(p,e.path)).outputPath.split(/[\\/]/).pop()??`the PDF`} in your default app.`})}catch(t){V(`Failed to print markdown file as PDF`,{threadId:p,path:e.path},t),C({title:`PDF export failed`,description:t instanceof Error?t.message:`Failed to convert this markdown file to PDF.`,variant:`destructive`})}finally{F(!1)}}}function De(){!p||!Y||(S(B(p,Y.path)),ye(e=>e+1))}return p?(0,A.jsx)(N,{v0:(0,A.jsxs)(ue,{className:`justify-between print:hidden`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[n&&c?(0,A.jsxs)(a,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0 text-muted-foreground electrobun-webkit-app-region-no-drag`,onClick:c,children:[(0,A.jsx)(t,{className:`h-4 w-4`}),(0,A.jsx)(`span`,{className:`sr-only`,children:`Show file tree`})]}):null,(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,A.jsx)(`span`,{className:o(h.label,`truncate text-foreground`),children:e?e.name:`Select a file to edit`}),(0,A.jsx)(`span`,{className:o(h.compact,`truncate text-muted-foreground`),children:e?e.path:`Browse and edit repository files`})]})]}),(0,A.jsxs)(`div`,{className:`flex gap-2`,children:[Y&&Z?(0,A.jsxs)(A.Fragment,{children:[R(Y.path)?(0,A.jsxs)(`div`,{className:`flex rounded-full border border-input bg-background p-0.5`,children:[(0,A.jsx)(a,{size:`sm`,variant:U===`view`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>W(`view`),children:`View`}),(0,A.jsx)(a,{size:`sm`,variant:U===`edit`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>W(`edit`),children:`Edit`})]}):null,R(Y.path)&&U===`view`?(0,A.jsxs)(a,{size:`sm`,variant:`outline`,onClick:()=>void Ee(),disabled:P,children:[P?(0,A.jsx)(u,{className:`h-4 w-4 animate-spin`}):(0,A.jsx)(ne,{className:`h-4 w-4`}),P?`Printing…`:`Print`]}):null,(0,A.jsxs)(a,{size:`sm`,onClick:()=>void $(),disabled:O||!Q||Q===Te,children:[O?(0,A.jsx)(u,{className:`h-4 w-4 animate-spin`}):null,`Save`]})]}):null,e?null:(0,A.jsxs)(ce,{children:[(0,A.jsx)(ae,{asChild:!0,children:(0,A.jsxs)(a,{size:`sm`,className:`gap-1.5`,children:[(0,A.jsx)(r,{className:`h-3.5 w-3.5`}),`New file`]})}),(0,A.jsx)(T,{align:`end`,children:I.map(({label:e,ext:t,icon:n})=>(0,A.jsxs)(w,{onSelect:()=>void we(t),children:[(0,A.jsx)(n,{className:`h-4 w-4`}),e]},t))})]})]})]}),v1:Y?(0,A.jsxs)(x,{fallbackTitle:`Failed to load file`,onRetry:De,children:[(0,A.jsx)(j.Suspense,{fallback:(0,A.jsx)(b,{}),children:(0,A.jsx)(he,{threadId:p,path:Y.path,contentKey:X??``,onContentReady:D},X??void 0)}),Z?R(Y.path)&&U===`view`?(0,A.jsx)(`div`,{className:`h-full overflow-auto p-6 print:h-auto print:overflow-visible print:p-0`,children:(0,A.jsx)(`div`,{className:`mx-auto max-w-4xl print:max-w-none`,"data-markdown-print-content":!0,children:(0,A.jsx)(se,{content:Q,enableMermaid:!0})})}):(0,A.jsx)(re,{height:`100%`,language:z(Y.path),value:Q,onChange:e=>D(t=>t&&{...t,content:e??``}),onMount:e=>{g.current=e,y.current&&(y.current=!1,e.focus())},theme:f===`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,A.jsx)(b,{})]},X??void 0):e?.type===`file`&&J===`image`?(0,A.jsx)(x,{fallbackTitle:`Failed to load image`,onRetry:()=>{!p||!e||S(H(p,e.path))},children:(0,A.jsx)(j.Suspense,{fallback:(0,A.jsx)(b,{}),children:(0,A.jsx)(ge,{threadId:p,path:e.path,alt:e.name})})},e.path):e?.type===`file`&&J===`video`?(0,A.jsx)(x,{fallbackTitle:`Failed to load video`,onRetry:()=>{!p||!e||S(H(p,e.path))},children:(0,A.jsx)(j.Suspense,{fallback:(0,A.jsx)(b,{}),children:(0,A.jsx)(_e,{threadId:p,path:e.path})})},e.path):(0,A.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center p-8`,children:[(0,A.jsx)(`h2`,{className:o(h.pageTitle,`text-foreground`),children:`File Explorer`}),(0,A.jsx)(`p`,{className:o(h.pageSubtitle),children:`Browse and edit files`})]}),v2:e?null:(0,A.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 px-4 py-2`,children:G?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`button`,{type:`button`,onClick:()=>void Ce(),className:o(h.compact,`min-w-0 flex-1 truncate text-left font-mono text-muted-foreground hover:text-foreground hover:underline`),title:G,children:G}),(0,A.jsxs)(a,{variant:`ghost`,size:`icon`,className:`h-7 w-7 shrink-0`,onClick:()=>void Se(),disabled:K,children:[K?(0,A.jsx)(s,{className:`h-3.5 w-3.5`}):(0,A.jsx)(i,{className:`h-3.5 w-3.5`}),(0,A.jsx)(`span`,{className:`sr-only`,children:`Copy path`})]})]}):(0,A.jsx)(`p`,{className:o(h.compact,`text-muted-foreground/50 italic`),children:`Loading path...`})})}):(0,A.jsx)(M,{v0:(0,A.jsx)(_,{className:`h-8 w-8 text-muted-foreground`}),v1:h.bodyMuted})},F=g(`explorer.preview`),I=[{label:`Markdown`,ext:`md`,icon:_},{label:`TypeScript`,ext:`ts`,icon:f},{label:`Text`,ext:`txt`,icon:m}];async function L(e,t){try{let n=await O(e,``),r=new Set(n.entries.map(e=>e.name)),i=`untitled`,a=`${i}.${t}`,o=2;for(;r.has(a);)a=`${i}${o}.${t}`,o++;return a}catch{return`untitled.${t}`}}function R(e){return p(e)===`md`}function z(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`}[p(e)]??`plaintext`}function B(e,t){return`explorer-file:${e}:${t}`}function he(e){let t=(0,k.c)(11),{threadId:n,path:r,contentKey:i,onContentReady:a}=e,o;t[0]!==r||t[1]!==n?(o=B(n,r),t[0]=r,t[1]=n,t[2]=o):o=t[2];let s;t[3]!==r||t[4]!==n?(s=async()=>{try{return await E(n,r)}catch(e){let t=e;throw V(`Failed to load explorer file preview`,{threadId:n,path:r},t),t}},t[3]=r,t[4]=n,t[5]=s):s=t[5];let c=y(o,s),l,u;return t[6]!==i||t[7]!==a||t[8]!==c.content?(l=()=>{a({key:i,content:c.content,original:c.content})},u=[a,c.content,i],t[6]=i,t[7]=a,t[8]=c.content,t[9]=l,t[10]=u):(l=t[9],u=t[10]),(0,j.useLayoutEffect)(l,u),null}function V(e,t,n){F.error(e,{...t,error:n})}function H(e,t){return`explorer-media:${e}:${t}`}function U(e,t){let n=(0,k.c)(11),r;n[0]!==t||n[1]!==e?(r=H(e,t),n[0]=t,n[1]=e,n[2]=r):r=n[2];let i;n[3]!==t||n[4]!==e?(i=async()=>{try{return await D(e,t)}catch(n){let r=n;throw V(`Failed to load explorer media preview`,{threadId:e,path:t},r),r}},n[3]=t,n[4]=e,n[5]=i):i=n[5];let a=y(r,i),o;n[6]===a?o=n[7]:(o=URL.createObjectURL(a),n[6]=a,n[7]=o);let s=o,c,l;return n[8]===s?(c=n[9],l=n[10]):(c=()=>()=>{URL.revokeObjectURL(s)},l=[s],n[8]=s,n[9]=c,n[10]=l),(0,j.useEffect)(c,l),s}function ge(e){let t=(0,k.c)(3),{threadId:n,path:r,alt:i}=e,a=U(n,r),o;return t[0]!==i||t[1]!==a?(o=(0,A.jsx)(`div`,{className:`flex items-center justify-center h-full p-4 overflow-auto`,children:(0,A.jsx)(`img`,{src:a,alt:i,className:`max-w-full max-h-full object-contain`})}),t[0]=i,t[1]=a,t[2]=o):o=t[2],o}function _e(e){let t=(0,k.c)(2),{threadId:n,path:r}=e,i=U(n,r),a;return t[0]===i?a=t[1]:(a=(0,A.jsx)(`div`,{className:`flex items-center justify-center h-full p-4`,children:(0,A.jsx)(`video`,{src:i,controls:!0,className:`max-w-full max-h-full`})}),t[0]=i,t[1]=a),a}export{P as default};
@@ -0,0 +1 @@
1
+ import{$r as e,Fi as t,Li as n,Ls as r,Rs as i,Va as a,ai as o,ii as s,ni as c,ps as l,ri as u,ti as d}from"./dialogs-config-DuZySBOC.js";var f=i(),p=r();function m(r){let i=(0,f.c)(28),{open:m,onOpenChange:g,commits:_,displayedCommits:v,isLoadingMore:y,onScroll:b,currentBranch:x}=r,S;i[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,p.jsx)(o,{children:`Commit History`}),i[0]=S):S=i[0];let C;i[1]===x?C=i[2]:(C=(0,p.jsxs)(s,{children:[S,(0,p.jsxs)(c,{children:[`Recent commits on branch `,x]})]}),i[1]=x,i[2]=C);let w;i[3]===v?w=i[4]:(w=v.length>0?v.map(h):(0,p.jsx)(`p`,{className:n(l.bodyMuted,`text-center py-8`),children:`No commits found`}),i[3]=v,i[4]=w);let T;i[5]===y?T=i[6]:(T=y&&(0,p.jsx)(`div`,{className:`p-3 text-center`,children:(0,p.jsx)(a,{className:`h-4 w-4 animate-spin inline`})}),i[5]=y,i[6]=T);let E;i[7]!==_.length||i[8]!==v.length||i[9]!==y?(E=v.length<_.length&&!y&&(0,p.jsx)(`div`,{className:n(l.caption,`p-3 text-center`),children:`Scroll to load more`}),i[7]=_.length,i[8]=v.length,i[9]=y,i[10]=E):E=i[10];let D;i[11]!==w||i[12]!==T||i[13]!==E?(D=(0,p.jsxs)(`div`,{className:`divide-y`,children:[w,T,E]}),i[11]=w,i[12]=T,i[13]=E,i[14]=D):D=i[14];let O;i[15]!==b||i[16]!==D?(O=(0,p.jsx)(`div`,{className:`flex-1 overflow-y-auto border rounded-lg`,onScroll:b,children:D}),i[15]=b,i[16]=D,i[17]=O):O=i[17];let k;i[18]===g?k=i[19]:(k=(0,p.jsx)(u,{children:(0,p.jsx)(t,{onClick:()=>g(!1),children:`Close`})}),i[18]=g,i[19]=k);let A;i[20]!==C||i[21]!==O||i[22]!==k?(A=(0,p.jsxs)(d,{className:`max-w-2xl max-h-[80vh] flex flex-col`,children:[C,O,k]}),i[20]=C,i[21]=O,i[22]=k,i[23]=A):A=i[23];let j;return i[24]!==g||i[25]!==m||i[26]!==A?(j=(0,p.jsx)(e,{open:m,onOpenChange:g,children:A}),i[24]=g,i[25]=m,i[26]=A,i[27]=j):j=i[27],j}function h(e){return(0,p.jsxs)(`div`,{className:`p-3 hover:bg-muted/50 transition-colors`,children:[(0,p.jsx)(`p`,{className:n(l.label,`break-words`),children:e.message}),(0,p.jsxs)(`p`,{className:n(l.bodyMuted,`mt-1`),children:[(0,p.jsx)(`span`,{className:l.mono,children:e.hash.substring(0,7)}),` •`,` `,e.author,` • `,new Date(e.date).toLocaleDateString()]})]},e.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-BE6c536I.js","assets/index-Bn5BGXYs.js","assets/rolldown-runtime-aKtaBQYM.js","assets/monaco-CZnIWXyV.js","assets/monaco-Br_kD0ds.css","assets/history-view-BmWodDne.js","assets/dialogs-config-DuZySBOC.js","assets/onboarding-BB-AWm5a.js","assets/vosk-speech-DyMTC-lJ.js","assets/react-vendor-DgF6pNAi.js","assets/utils-Dt3EZ8O5.js","assets/index-DhnUeGIU.css","assets/pull-request-dialog-DdTJdeTq.js","assets/create-repo-dialog-CS5xTOjf.js","assets/git-history-dialog-Dhp1fu13.js","assets/push-before-pr-dialog-CR8taQ6a.js","assets/pull-with-changes-dialog-BhHXdwjP.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Br as t,Bs as n,C as r,Fi as ee,Gt as te,Ho as i,Io as ne,Jt as a,Ki as re,Li as ie,Ls as o,Ot as ae,Qa as s,Rr as c,Rs as l,So as u,Va as d,Vr as oe,Wo as f,Xt as se,Y as p,Za as ce,Zi as m,Zt as le,ct as h,dt as ue,en as de,ht as fe,in as pe,ks as me,ps as he,q as g,qa as ge,qn as _,qo as v,qt as y,sn as _e,xo as ve,ya as ye,zr as b}from"./dialogs-config-DuZySBOC.js";import{r as x}from"./monaco-CZnIWXyV.js";import{A as be,B as S,D as C,E as xe,I as Se,K as w,O as Ce,T as we,U as Te,W as Ee,k as De,v as Oe,y as ke}from"./index-Bn5BGXYs.js";var T=e(n(),1),E=o();function D(e){return!e.hasChanges&&e.defaultBranchBehind>0}function O(e){return e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits}function k(e){return e.hasUnpushedCommits&&e.prExists}function Ae(e,t){return t?`Creating PR...`:e.hasChanges?`Commit`:k(e)?`Update PR`:O(e)?`Open PR`:e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges?`Create PR`:D(e)?`Sync`:`Commit`}function je(e,t,n=!1){return t||n||e.hasChanges||k(e)||O(e)||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges||!e.hasChanges&&!e.hasUnpushedCommits&&!D(e)?null:D(e)?(0,E.jsx)(f,{className:`h-3.5 w-3.5`}):(0,E.jsx)(s,{className:`h-3.5 w-3.5`})}function Me(e){if(e.hasChanges)return e.changedFilesCount>0?`Commit ${e.changedFilesCount} changed file${e.changedFilesCount===1?``:`s`}`:`No changes to commit`;if(k(e))return`Update pull request with unpushed commits`;if(O(e))return`View pull request in GitHub`;if(e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges)return`Create pull request for committed changes`;if(D(e)){let t=e.defaultBranch??`main`,n=`${e.defaultBranchBehind} commit${e.defaultBranchBehind===1?``:`s`} behind origin/${t}`,r=e.defaultBranchAhead>0?`, ${e.defaultBranchAhead} commit${e.defaultBranchAhead===1?``:`s`} ahead`:``;return e.currentBranch===e.defaultBranch?`Your branch is ${n}${r}. Click to pull the latest changes.`:`Your branch "${e.currentBranch}" is ${n}${r}. Click to rebase onto the latest ${t}.`}return`No actions available`}function Ne(e,t,n=!1){return t||n?!0:O(e)||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges||D(e)?!1:!e.hasChanges&&!e.hasUnpushedCommits}function Pe(e){return e.hasChanges||O(e)||k(e)||D(e)||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges}var Fe=l();function Ie(e){let n=(0,Fe.c)(108),{branchStatus:r,remoteUrl:te,hasRemoteBranch:a,hasUnpushedCommits:o,canCreateRepo:ae,repoUrl:l,isRefreshing:se,isCreatingPR:p,isBrandState:le,hasChanges:h,commitsAheadOfDefault:ue,prExists:de,defaultBranch:fe,defaultBranchAhead:pe,defaultBranchBehind:me,gitUser:g,isDirectCommitMode:_,autoGenerateCommitMessage:v,isLoading:y,isLoadingHistory:_e,isQuickCommitting:x,onFetch:S,onPull:Se,onPush:w,onOpenHistory:Te,onCreatePR:Ee,onCreateRepo:Oe,onViewInGitHub:ke,onQuickCommit:T,onSyncWithDefault:D,onOpenChange:O,open:k,layout:Ae}=e,je=p===void 0?!1:p,Me=Ae===void 0?`bar`:Ae,Ne=!!fe&&!!te&&me>0,Pe=!h&&!y,Ie=Me===`bar`&&`w-8 rounded-l-none`,A=Me===`menu`&&`w-full justify-start gap-2 rounded-md`,Le=le&&Me===`bar`&&` border-transparent bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground`,j;n[0]!==Ie||n[1]!==A||n[2]!==Le?(j=ie(`h-8 px-1`,Ie,A,Le),n[0]=Ie,n[1]=A,n[2]=Le,n[3]=j):j=n[3];let Re=y||je,ze;n[4]===Me?ze=n[5]:(ze=Me===`menu`&&(0,E.jsx)(`span`,{children:`More git actions`}),n[4]=Me,n[5]=ze);let Be;n[6]!==je||n[7]!==se?(Be=je||se?(0,E.jsx)(d,{className:`h-3.5 w-3.5 animate-spin`}):(0,E.jsx)(ne,{className:`h-3.5 w-3.5`}),n[6]=je,n[7]=se,n[8]=Be):Be=n[8];let Ve;n[9]!==j||n[10]!==Re||n[11]!==ze||n[12]!==Be?(Ve=(0,E.jsx)(be,{asChild:!0,children:(0,E.jsxs)(ee,{variant:`outline`,size:`sm`,className:j,disabled:Re,children:[ze,Be]})}),n[9]=j,n[10]=Re,n[11]=ze,n[12]=Be,n[13]=Ve):Ve=n[13];let M;n[14]!==r||n[15]!==te?(M=r===`Behind`&&(0,E.jsxs)(`div`,{className:ie(he.compact,`px-2 py-1 text-amber-600`),children:[`Branch is behind `,te?`origin`:`remote`]}),n[14]=r,n[15]=te,n[16]=M):M=n[16];let N;n[17]===g?N=n[18]:(N=g&&(0,E.jsxs)(`div`,{className:ie(he.compact,`px-2 py-1 text-muted-foreground`),children:[(0,E.jsx)(`span`,{className:`font-medium`,children:`User:`}),` `,g]}),n[17]=g,n[18]=N);let He;n[19]===Symbol.for(`react.memo_cache_sentinel`)?(He=(0,E.jsx)(Ce,{}),n[19]=He):He=n[19];let P;n[20]!==Pe||n[21]!==fe||n[22]!==pe||n[23]!==me||n[24]!==h||n[25]!==D||n[26]!==Ne?(P=Ne&&(0,E.jsx)(t,{children:(0,E.jsxs)(c,{children:[(0,E.jsx)(oe,{asChild:!0,children:(0,E.jsxs)(C,{onClick:()=>{Pe&&D()},className:Pe?``:`opacity-50 cursor-not-allowed`,children:[(0,E.jsx)(ye,{className:`h-3.5 w-3.5 mr-2`}),`Sync with `,fe,(0,E.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 pl-3 text-xs tabular-nums text-muted-foreground`,children:[pe>0&&(0,E.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,E.jsx)(i,{className:`h-3 w-3`}),pe]}),me>0&&(0,E.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,E.jsx)(f,{className:`h-3 w-3`}),me]})]})]})}),(0,E.jsx)(b,{side:`right`,children:h?`Commit or stash changes before syncing with the default branch`:`Pull latest changes from origin/${fe} onto your current branch`})]})}),n[20]=Pe,n[21]=fe,n[22]=pe,n[23]=me,n[24]=h,n[25]=D,n[26]=Ne,n[27]=P):P=n[27];let F;n[28]!==v||n[29]!==h||n[30]!==y||n[31]!==x||n[32]!==T?(F=h&&v&&(0,E.jsx)(t,{children:(0,E.jsxs)(c,{children:[(0,E.jsx)(oe,{asChild:!0,children:(0,E.jsxs)(C,{onClick:T,disabled:y||x,children:[x?(0,E.jsx)(d,{className:`h-3.5 w-3.5 mr-2 animate-spin`}):(0,E.jsx)(re,{className:`h-3.5 w-3.5 mr-2`}),`Quick Commit`,(0,E.jsx)(De,{children:`⌘⇧C`})]})}),(0,E.jsx)(b,{side:`right`,children:`Generate the commit message and commit`})]})}),n[28]=v,n[29]=h,n[30]=y,n[31]=x,n[32]=T,n[33]=F):F=n[33];let Ue;n[34]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=(0,E.jsx)(u,{className:`h-3.5 w-3.5 mr-2`}),n[34]=Ue):Ue=n[34];let I;n[35]!==y||n[36]!==S?(I=(0,E.jsx)(oe,{asChild:!0,children:(0,E.jsxs)(C,{onClick:S,disabled:y,children:[Ue,`Fetch`]})}),n[35]=y,n[36]=S,n[37]=I):I=n[37];let We;n[38]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,E.jsx)(b,{side:`right`,children:`Download latest information from remote without merging changes`}),n[38]=We):We=n[38];let L;n[39]===I?L=n[40]:(L=(0,E.jsx)(t,{children:(0,E.jsxs)(c,{children:[I,We]})}),n[39]=I,n[40]=L);let R;n[41]!==a||n[42]!==y||n[43]!==Se?(R=()=>{a&&!y&&Se()},n[41]=a,n[42]=y,n[43]=Se,n[44]=R):R=n[44];let z=!a||y?`opacity-50 cursor-not-allowed`:``,B;n[45]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,E.jsx)(f,{className:`h-3.5 w-3.5 mr-2`}),n[45]=B):B=n[45];let V;n[46]!==R||n[47]!==z?(V=(0,E.jsx)(oe,{asChild:!0,children:(0,E.jsxs)(C,{onClick:R,className:z,children:[B,`Pull`]})}),n[46]=R,n[47]=z,n[48]=V):V=n[48];let Ge=a?`Pull latest changes from remote`:`No remote branch to pull from`,H;n[49]===Ge?H=n[50]:(H=(0,E.jsx)(b,{side:`right`,children:Ge}),n[49]=Ge,n[50]=H);let U;n[51]!==V||n[52]!==H?(U=(0,E.jsx)(t,{children:(0,E.jsxs)(c,{children:[V,H]})}),n[51]=V,n[52]=H,n[53]=U):U=n[53];let Ke;n[54]!==a||n[55]!==y||n[56]!==w?(Ke=!a&&(0,E.jsx)(t,{children:(0,E.jsxs)(c,{children:[(0,E.jsx)(oe,{asChild:!0,children:(0,E.jsxs)(C,{onClick:w,disabled:y,children:[(0,E.jsx)(m,{className:`h-3.5 w-3.5 mr-2`}),`Push Branch to Remote`]})}),(0,E.jsx)(b,{side:`right`,children:`Create remote branch and push local commits`})]})}),n[54]=a,n[55]=y,n[56]=w,n[57]=Ke):Ke=n[57];let qe;n[58]!==o||n[59]!==y||n[60]!==w?(qe=()=>{o&&!y&&w()},n[58]=o,n[59]=y,n[60]=w,n[61]=qe):qe=n[61];let Je=!o||y?`opacity-50 cursor-not-allowed`:``,Ye;n[62]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=(0,E.jsx)(m,{className:`h-3.5 w-3.5 mr-2`}),n[62]=Ye):Ye=n[62];let W;n[63]!==qe||n[64]!==Je?(W=(0,E.jsx)(oe,{asChild:!0,children:(0,E.jsxs)(C,{onClick:qe,className:Je,children:[Ye,`Push Commits`]})}),n[63]=qe,n[64]=Je,n[65]=W):W=n[65];let G=o?y?`Push in progress...`:`Push your uncommitted commits to the remote branch`:`No commits to push - your branch is up to date with remote`,Xe;n[66]===G?Xe=n[67]:(Xe=(0,E.jsx)(b,{side:`right`,children:G}),n[66]=G,n[67]=Xe);let K;n[68]!==W||n[69]!==Xe?(K=(0,E.jsx)(t,{children:(0,E.jsxs)(c,{children:[W,Xe]})}),n[68]=W,n[69]=Xe,n[70]=K):K=n[70];let Ze=y||_e,Qe;n[71]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=(0,E.jsx)(ge,{className:`h-3.5 w-3.5 mr-2`}),n[71]=Qe):Qe=n[71];let q;n[72]!==Te||n[73]!==Ze?(q=(0,E.jsxs)(C,{onClick:Te,disabled:Ze,children:[Qe,`History`]}),n[72]=Te,n[73]=Ze,n[74]=q):q=n[74];let J;n[75]!==ue||n[76]!==h||n[77]!==_||n[78]!==y||n[79]!==Ee||n[80]!==de?(J=!_&&ue&&!de&&!h&&(0,E.jsxs)(C,{onClick:Ee,disabled:y,children:[(0,E.jsx)(s,{className:`h-3.5 w-3.5 mr-2`}),`Create Pull Request`,(0,E.jsx)(De,{children:`⌘⇧P`})]}),n[75]=ue,n[76]=h,n[77]=_,n[78]=y,n[79]=Ee,n[80]=de,n[81]=J):J=n[81];let Y;n[82]!==ae||n[83]!==y||n[84]!==Oe?(Y=ae&&(0,E.jsxs)(C,{onClick:Oe,disabled:y,children:[(0,E.jsx)(ce,{className:`h-3.5 w-3.5 mr-2`}),`Create Repo`]}),n[82]=ae,n[83]=y,n[84]=Oe,n[85]=Y):Y=n[85];let X;n[86]!==y||n[87]!==ke||n[88]!==l?(X=l&&(0,E.jsxs)(C,{onClick:ke,disabled:y,children:[(0,E.jsx)(ve,{className:`h-3.5 w-3.5 mr-2`}),`View in GitHub`,(0,E.jsx)(De,{children:`⌘⇧G`})]}),n[86]=y,n[87]=ke,n[88]=l,n[89]=X):X=n[89];let Z;n[90]!==M||n[91]!==N||n[92]!==P||n[93]!==F||n[94]!==L||n[95]!==U||n[96]!==Ke||n[97]!==K||n[98]!==q||n[99]!==J||n[100]!==Y||n[101]!==X?(Z=(0,E.jsxs)(xe,{align:`end`,children:[M,N,He,P,F,L,U,Ke,K,q,J,Y,X]}),n[90]=M,n[91]=N,n[92]=P,n[93]=F,n[94]=L,n[95]=U,n[96]=Ke,n[97]=K,n[98]=q,n[99]=J,n[100]=Y,n[101]=X,n[102]=Z):Z=n[102];let $e;return n[103]!==O||n[104]!==k||n[105]!==Ve||n[106]!==Z?($e=(0,E.jsxs)(we,{open:k,onOpenChange:O,children:[Ve,Z]}),n[103]=O,n[104]=k,n[105]=Ve,n[106]=Z,n[107]=$e):$e=n[107],$e}function A(e){return e?!0:(S({title:`Error`,description:`No thread selected`,variant:`destructive`}),!1)}function Le(e){let t=e.split(`/`);return t.length>=2?{provider:t[0],model:t.slice(1).join(`/`)}:{provider:void 0,model:e}}var j=v(`app.use-ai-generation.hook`);function Re(e,t,n){let[r,ee]=(0,T.useState)(!1),[te,i]=(0,T.useState)(!1),ne=()=>n?.id?n.provider?{provider:n.provider,model:n.id}:Le(n.id):{provider:void 0,model:void 0};return{isGeneratingMessage:r,isGeneratingPRInfo:te,generateCommitMessageWithAI:(0,T.useCallback)(async()=>{if(!e)return null;try{ee(!0);let{provider:t,model:n}=ne();return await g(e,n,t)}catch(e){return j.error(`Failed to generate commit message:`,e),S({title:`Error`,description:e instanceof Error?e.message:`Failed to generate commit message`,variant:`destructive`}),null}finally{ee(!1)}},[e,n]),generatePRInfoWithAI:(0,T.useCallback)(async()=>{if(!e)return null;try{i(!0);let{provider:t,model:n}=ne();return await p(e,n,t)}catch(e){return j.error(`Failed to generate PR info:`,e),S({title:`Error`,description:e instanceof Error?e.message:`Failed to generate PR info`,variant:`destructive`}),null}finally{i(!1)}},[e,n])}}var ze=(0,T.lazy)(()=>x(()=>import(`./commit-dialog-BE6c536I.js`).then(e=>({default:e.CommitDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))),Be=(0,T.lazy)(()=>x(()=>import(`./pull-request-dialog-DdTJdeTq.js`).then(e=>({default:e.PullRequestDialog})),__vite__mapDeps([12,1,2,3,4,5,6,7,8,9,10,11]))),Ve=(0,T.lazy)(()=>x(()=>import(`./create-repo-dialog-CS5xTOjf.js`).then(e=>({default:e.CreateRepoDialog})),__vite__mapDeps([13,1,2,3,4,5,6,7,8,9,10,11]))),M=(0,T.lazy)(()=>x(()=>import(`./git-history-dialog-Dhp1fu13.js`).then(e=>({default:e.GitHistoryDialog})),__vite__mapDeps([14,6,2]))),N=(0,T.lazy)(()=>x(()=>import(`./push-before-pr-dialog-CR8taQ6a.js`).then(e=>({default:e.PushBeforePRDialog})),__vite__mapDeps([15,6,2]))),He=(0,T.lazy)(()=>x(()=>import(`./pull-with-changes-dialog-BhHXdwjP.js`).then(e=>({default:e.PullWithChangesDialog})),__vite__mapDeps([16,5,2,6]))),P=v(`app.git-ops-button.ui`);function F(){return null}async function Ue(e,t,n,r){r&&(await _(e,{title:r}),n({type:w.UpdateThreadTitle,projectId:t,threadId:e,title:r}))}function I({projectId:e,threadId:n,layout:i=`bar`}){let ne=Te(),re=Ee(e=>e.projectModelSelections[n]),o=Ee(t=>t.projects.find(t=>t.projectId===e)),[s,l]=(0,T.useState)(!1),[u,d]=(0,T.useState)(!1),[f,p]=(0,T.useState)(!1),[ce,m]=(0,T.useState)(!1),[he,g]=(0,T.useState)(``),[ge,_]=(0,T.useState)(``),[v,ve]=(0,T.useState)(``),[ye,x]=(0,T.useState)(!1),[be,C]=(0,T.useState)(null),xe=(0,T.useRef)(!1),Ce=(0,T.useRef)(!1),we=(0,T.useRef)(ge),De=(0,T.useRef)(v);we.current=ge,De.current=v;let[D,O]=(0,T.useState)(!1),[k,Fe]=(0,T.useState)([]),[Le,j]=(0,T.useState)(!1),[I,We]=(0,T.useState)([]),[L,R]=(0,T.useState)(!1),[z,B]=(0,T.useState)(!1),[V,Ge]=(0,T.useState)(``),[H,U]=(0,T.useState)(``),[Ke,qe]=(0,T.useState)(``),[Je,Ye]=(0,T.useState)(!1),[W,G]=(0,T.useState)(!1),[Xe,K]=(0,T.useState)(!1),[Ze,Qe]=(0,T.useState)(!1),q=(0,T.useRef)(!1),J=Se(),{fetchUnifiedStatus:Y}=J,X=Re(n,e,re),Z=(0,T.useRef)(null),$e=(0,T.useRef)(()=>{}),et=(0,T.useRef)(()=>{}),tt=(0,T.useRef)(()=>{}),nt=(0,T.useRef)(()=>{});(0,T.useEffect)(()=>()=>{Z.current!==null&&(clearInterval(Z.current),Z.current=null)},[]);async function Q(){pe();let e=await ae();ne({type:w.SetProjects,projects:e.projects})}let[$,rt]=(0,T.useState)(()=>Oe()),it=o?.commitMethod===me.Direct;(0,T.useEffect)(()=>{z&&o?.name&&!V&&Ge(o.name)},[z,o?.name,V]),(0,T.useEffect)(()=>{ke($)},[$]);function at(){Je||(Ye(!0),ue().then(e=>qe(e)).catch(()=>{}))}function ot(e){Qe(e),e&&(at(),Y(!0))}(0,T.useEffect)(()=>{if(!f){Ce.current=!1;return}if(f&&$.autoGenerateCommitMessage&&!he.trim()&&n&&!Ce.current){Ce.current=!0;async function e(){let e=await X.generateCommitMessageWithAI();e&&g(e)}e()}},[f,$.autoGenerateCommitMessage,n,X.generateCommitMessageWithAI,he]),(0,T.useEffect)(()=>{if(!ce){xe.current=!1;return}if(ce&&$.autoGeneratePRInfo&&!we.current.trim()&&!De.current.trim()&&n&&!xe.current){xe.current=!0;async function e(){let e=await X.generatePRInfoWithAI();e&&(_(e.title),ve(e.description),S({title:`Success`,description:`PR title and description generated`}))}e()}},[ce,$.autoGeneratePRInfo,n,X.generatePRInfoWithAI]),$e.current=dt,et.current=()=>m(!0),tt.current=Dt,nt.current=()=>{s||u||ot(!0)},(0,T.useEffect)(()=>{function e(e){let t=e.key.toLowerCase();if((e.metaKey||e.ctrlKey)&&e.shiftKey&&!e.altKey){if(t===`c`){J.hasChanges&&$.autoGenerateCommitMessage&&!s&&(e.preventDefault(),$e.current());return}if(t===`p`){J.commitsAheadOfDefault&&!J.prExists&&!J.hasChanges&&!s&&!it&&(e.preventDefault(),et.current());return}if(t===`g`){J.repoUrl&&!s&&(e.preventDefault(),tt.current());return}t===`b`&&!s&&!u&&(e.preventDefault(),nt.current())}}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[J.commitsAheadOfDefault,J.hasChanges,J.prExists,J.repoUrl,$.autoGenerateCommitMessage,s,u,it]),(0,T.useEffect)(()=>{u&&J.prExists&&J.prState===`OPEN`&&d(!1)},[J.prExists,J.prState,u]),(0,T.useEffect)(()=>{if(!u)return;let e=setTimeout(()=>{d(!1)},15e3);return()=>clearTimeout(e)},[u]),(0,T.useEffect)(()=>{let e=J.prExists&&J.prState===`OPEN`&&!J.hasChanges&&!J.hasUnpushedCommits;e&&!q.current&&Q(),q.current=e},[J.hasChanges,J.hasUnpushedCommits,J.prExists,J.prState]);async function st(){if(he.trim()&&A(n))try{l(!0),await te(n,he),g(``),p(!1),await J.fetchUnifiedStatus(!0),Q(),S({title:`Changes committed successfully`,description:`Your changes have been committed to '${J.currentBranch}'.`}),Xe&&(K(!1),await ht())}catch(e){P.error(`Failed to commit:`,e),S({title:`Commit failed`,description:e instanceof Error?e.message:`Failed to commit changes`,variant:`destructive`})}finally{l(!1)}}async function ct(){if(!A(n))return;let e=J.prUrl;if(!e)try{e=(await fe(n)).url}catch(e){P.error(`Failed to fetch pull request URL:`,e),S({title:`Could not open pull request`,description:e instanceof Error?e.message:`Failed to fetch pull request URL`,variant:`destructive`});return}if(!e){S({title:`Could not open pull request`,description:`Pull request URL is unavailable. Try refreshing git status.`,variant:`destructive`});return}try{await _e(e)}catch(e){P.error(`Failed to open pull request:`,e),S({title:`Could not open pull request`,description:e instanceof Error?e.message:`Failed to open URL in browser`,variant:`destructive`})}}async function lt(){if(J.hasChanges){p(!0);return}if(J.hasUnpushedCommits&&J.prExists){await pt();return}if(J.prExists&&J.prState===`OPEN`&&!J.hasChanges&&!J.hasUnpushedCommits){await ct();return}if(J.commitsAheadOfDefault&&!J.prExists&&!J.hasChanges){m(!0);return}if(J.defaultBranchBehind>0){await vt();return}}async function ut(){let e=await X.generateCommitMessageWithAI();e&&g(e)}async function dt(){if(A(n))try{l(!0);let e=await X.generateCommitMessageWithAI();if(!e){S({title:`Quick Commit failed`,description:`Could not generate commit message`,variant:`destructive`});return}await te(n,e),await J.fetchUnifiedStatus(!0),Q(),S({title:`Changes committed successfully`,description:`Committed: ${e}`})}catch(e){P.error(`Quick commit failed:`,e),S({title:`Quick Commit failed`,description:e instanceof Error?e.message:`Failed to commit changes`,variant:`destructive`})}finally{l(!1)}}async function ft(){if(A(n))try{l(!0),await a(n),await J.fetchUnifiedStatus()}catch(e){P.error(`Failed to fetch:`,e)}finally{l(!1)}}async function pt(){if(A(n))try{l(!0),await le(n),await J.fetchUnifiedStatus(!0),Q(),J.hasRemoteBranch?S({title:`Branch pushed successfully`,description:`Your branch '${J.currentBranch}' has been pushed to the remote.`}):S({title:`Push completed`,description:`Changes have been pushed successfully.`})}catch(e){P.error(`Failed to push:`,e),S({title:`Push failed`,description:e instanceof Error?e.message:`Failed to push to remote`,variant:`destructive`})}finally{l(!1)}}async function mt(){if(A(n)){if(J.hasChanges){G(!0);return}await ht()}}async function ht(){try{l(!0),await se(n),await J.fetchUnifiedStatus(!0),Q(),S({title:`Pull successful`,description:`Latest changes have been pulled from remote.`})}catch(e){P.error(`Failed to pull:`,e),S({title:`Pull failed`,description:e instanceof Error?e.message:`Failed to pull from remote`,variant:`destructive`})}finally{l(!1)}}function gt(){G(!1),K(!0),p(!0)}async function _t(){G(!1),await ht()}async function vt(){if(A(n))try{l(!0),await de(n),await J.fetchUnifiedStatus(!0),Q(),S({title:`Branch synced successfully`,description:`Your branch '${J.currentBranch}' has been synced with the latest changes`})}catch(e){P.error(`[sync] ✗ Failed to sync branch:`,e),S({title:`Sync failed`,description:e instanceof Error?e.message:`Failed to sync with default branch`,variant:`destructive`})}finally{l(!1)}}async function yt(){if(A(n))try{l(!0),d(!0);let t=await y(n,ge,v);await Ue(n,e,ne,t.title??ge),t.prUrl&&await _e(t.prUrl),_(``),ve(``),m(!1),await J.fetchUnifiedStatus(!0),Q();let r=0;Z.current!==null&&clearInterval(Z.current),Z.current=setInterval(async()=>{if(r++,r>=6){Z.current!==null&&(clearInterval(Z.current),Z.current=null);return}await J.fetchUnifiedStatus(!0)},2e3)}catch(e){P.error(`Failed to create PR:`,e);let t=e instanceof Error?e.message:`Failed to create PR`;t.includes(`push the current branch`)||t.includes(`--head flag`)?(m(!1),St({title:ge,description:v})):(d(!1),S({title:`Create PR Failed`,description:t,variant:`destructive`}))}finally{l(!1)}}async function bt(){if(A(n))try{l(!0);let e=await r(n,V,H,$.privateRepositoryDefault);e.repoUrl&&setTimeout(()=>{_e(e.repoUrl)},3e3),Ge(``),U(``),B(!1),await J.fetchUnifiedStatus(),Q()}catch(e){P.error(`Failed to create repo:`,e)}finally{l(!1)}}async function xt(){let e=await X.generatePRInfoWithAI();e&&(_(e.title),ve(e.description),S({title:`Success`,description:`PR title and description generated`}))}async function St(t){let r=t??be;if(!(!n||!r))try{l(!0),d(!0);try{await le(n)}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`)){S({title:`Syncing branch before push`,description:`Your branch is behind remote. Pulling latest changes first...`});try{await de(n),await le(n)}catch{throw e}}else throw e}let t=await y(n,r.title,r.description);await Ue(n,e,ne,t.title??r.title),t.prUrl&&await _e(t.prUrl),_(``),ve(``),C(null),x(!1),await J.fetchUnifiedStatus(!0),Q();let ee=0;Z.current!==null&&clearInterval(Z.current),Z.current=setInterval(async()=>{if(ee++,ee>=6){Z.current!==null&&(clearInterval(Z.current),Z.current=null);return}await J.fetchUnifiedStatus(!0)},2e3)}catch(e){P.error(`Failed to push and create PR:`,e);let t=e instanceof Error?e.message:`Failed to push and create PR`;d(!1),S({title:`Push & Create PR Failed`,description:t,variant:`destructive`})}finally{l(!1)}}async function Ct(){if(A(n))try{j(!0);let e=await h(n,100);Fe(e),We(e.slice(0,10)),O(!0)}catch(e){P.error(`Failed to fetch git history:`,e)}finally{j(!1)}}function wt(){L||(R(!0),setTimeout(()=>{let e=I.length+10;We(k.slice(0,e)),R(!1)},300))}function Tt(e){let t=e.currentTarget;t.scrollHeight-t.scrollTop-t.clientHeight<100&&I.length<k.length&&!L&&wt()}let Et=Pe(J);function Dt(){J.repoUrl&&_e(J.repoUrl)}function Ot(){x(!1),C(null)}return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{className:ie(`flex items-center gap-0`,i===`menu`&&`w-full flex-col gap-1 [&_button]:w-full [&_button]:justify-start`),children:[(0,E.jsx)(t,{children:(0,E.jsxs)(c,{children:[(0,E.jsx)(oe,{asChild:!0,children:(0,E.jsxs)(ee,{variant:`outline`,size:`sm`,className:ie(`h-8 gap-1.5`,i===`bar`&&`rounded-r-none border-r-0`,i===`menu`&&`rounded-md border`,Et&&` border-transparent bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground`),disabled:Ne(J,s,u),onClick:lt,children:[je(J,u,s),Ae(J,u)]})}),(0,E.jsx)(b,{children:Me(J)})]})}),(0,E.jsx)(Ie,{branchStatus:J.status,remoteUrl:J.remoteUrl,hasRemoteBranch:J.hasRemoteBranch,hasUnpushedCommits:J.hasUnpushedCommits,canCreateRepo:J.canCreateRepo,repoUrl:J.repoUrl,isRefreshing:J.isRefreshing,isCreatingPR:u,isBrandState:Et,hasChanges:J.hasChanges,commitsAheadOfDefault:J.commitsAheadOfDefault,prExists:J.prExists,defaultBranch:J.defaultBranch??null,defaultBranchAhead:J.defaultBranchAhead,defaultBranchBehind:J.defaultBranchBehind,gitUser:Ke,isDirectCommitMode:it,autoGenerateCommitMessage:$.autoGenerateCommitMessage,isLoading:s,isLoadingHistory:Le,isQuickCommitting:X.isGeneratingMessage&&s,onFetch:()=>void ft(),onPull:()=>void mt(),onPush:()=>void pt(),onOpenHistory:()=>void Ct(),onCreatePR:()=>m(!0),onCreateRepo:()=>B(!0),onViewInGitHub:Dt,onQuickCommit:()=>void dt(),onSyncWithDefault:()=>void vt(),open:Ze,onOpenChange:ot,layout:i})]}),f&&(0,E.jsx)(T.Suspense,{fallback:(0,E.jsx)(F,{}),children:(0,E.jsx)(ze,{open:f,onOpenChange:p,commitMessage:he,onCommitMessageChange:g,autoGenerateCommitMessage:$.autoGenerateCommitMessage,onAutoGenerateChange:e=>rt(t=>({...t,autoGenerateCommitMessage:e})),isGeneratingMessage:X.isGeneratingMessage,isLoading:s,onGenerateMessage:ut,onCommit:st,currentBranch:J.currentBranch})}),ce&&(0,E.jsx)(T.Suspense,{fallback:(0,E.jsx)(F,{}),children:(0,E.jsx)(Be,{open:ce,onOpenChange:m,prTitle:ge,onPrTitleChange:_,prDescription:v,onPrDescriptionChange:ve,isGeneratingPRInfo:X.isGeneratingPRInfo,isLoading:s,onGeneratePRInfo:xt,onCreatePR:yt,currentBranch:J.currentBranch,autoGeneratePRInfo:$.autoGeneratePRInfo,onAutoGeneratePRInfoChange:e=>rt(t=>({...t,autoGeneratePRInfo:e}))})}),ye&&(0,E.jsx)(T.Suspense,{fallback:(0,E.jsx)(F,{}),children:(0,E.jsx)(N,{open:ye,onOpenChange:x,isLoading:s,onPushAndCreatePR:St,onCancel:Ot})}),z&&(0,E.jsx)(T.Suspense,{fallback:(0,E.jsx)(F,{}),children:(0,E.jsx)(Ve,{open:z,onOpenChange:B,repoName:V,onRepoNameChange:Ge,repoDescription:H,onRepoDescriptionChange:U,isPrivateRepo:$.privateRepositoryDefault,onPrivateRepoChange:e=>rt(t=>({...t,privateRepositoryDefault:e})),isLoading:s,onCreateRepo:bt})}),D&&(0,E.jsx)(T.Suspense,{fallback:(0,E.jsx)(F,{}),children:(0,E.jsx)(M,{open:D,onOpenChange:O,commits:k,displayedCommits:I,isLoadingMore:L,onScroll:Tt,currentBranch:J.currentBranch})}),W&&(0,E.jsx)(T.Suspense,{fallback:(0,E.jsx)(F,{}),children:(0,E.jsx)(He,{open:W,onOpenChange:G,onCommitFirst:gt,onStashAndPull:_t,onCancel:()=>G(!1),isLoading:s})})]})}export{I as GitOpsButton};
@@ -0,0 +1,9 @@
1
+ import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{Ai as n,Br as r,Bs as i,Ci as a,Ei as o,Fi as s,Fo as c,Gr as l,Hr as u,Ii as d,Io as f,Jr as p,Kr as m,Li as h,Lo as g,Ls as _,Mi as v,Ni as y,No as b,Oi as x,Pi as S,Po as C,Rr as ee,Rs as w,Ti as T,To as te,Va as E,Vr as D,Wi as O,Wr as k,_ as A,_i as j,bi as ne,c as re,ci as ie,di as M,ea as N,fi as P,fs as F,gi as ae,hi as oe,ji as se,ki as ce,l as le,li as ue,mi as de,oi as fe,ot as pe,pi as me,ps as I,qi as he,qo as ge,qr as _e,s as ve,si as ye,u as be,ui as xe,vi as Se,xi as Ce,zr as we,zs as Te}from"./dialogs-config-DuZySBOC.js";var L=w(),Ee=Object,De=Map,Oe=Set,ke=Oe.prototype.has,Ae=Oe.prototype.add,je=De.prototype.has,Me=De.prototype.get,Ne=De.prototype.set,Pe=1,Fe=2,Ie=4,Le=8,Re=16,ze=32,R=`__t`,Be=`__p`,Ve=`__e`,He=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ue=`http://www.w3.org/1999/xlink`,We=`http://www.w3.org/2000/xmlns/`,Ge=120,Ke=new Oe([`href`,`list`,`form`,`tabIndex`,`download`]),qe=new Oe([`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`isindex`,`keygen`,`link`,`menuitem`,`meta`,`nextid`,`param`,`source`,`track`,`wbr`]);if(typeof window>`u`)throw Error(`See http://million.dev/docs/install to install the compiler.`);var z=document;z.createElement(`template`);var Je=z.createElement(`template`),Ye=Je.content,Xe=z.createElementNS(`http://www.w3.org/2000/svg`,`svg`),B=Node.prototype,Ze=Element.prototype,Qe=CharacterData.prototype,$e=Ee.getOwnPropertyDescriptor,et=B.insertBefore,tt=B.cloneNode,nt=B.replaceChild,rt=Ze.remove,it=B.addEventListener,at=Ze.removeAttribute,ot=Ze.setAttribute,st=Ze.setAttributeNS,ct=$e(B,`textContent`).set,lt=$e(B,`firstChild`).get,ut=$e(B,`nextSibling`).get,dt=$e(Qe,`data`).set,ft=(e,t)=>{let n=t?Xe:Je;return n.innerHTML=e,(t?Xe:Ye).firstChild};z[Ve]=new Oe;var pt=(e,t,n)=>{let r=t.toLowerCase(),i=!1;r.endsWith(`capture`)&&(r=r.slice(0,-7),i=!0);let a=`$$${r}`;ke.call(z[Ve],r)||(it.call(z,r,e=>{let t=e.target;for(;t;){let n=t[a];n&&(Ee.defineProperty(e,`currentTarget`,{configurable:!0,get(){return t}}),n(e)),t=t.parentNode}},{capture:i}),Ae.call(z[Ve],r));let o=t=>{t?`key`in t&&t.key===e[a]?.key||(e[a]=t):e[a]=null};return o(n),o},V=(e,t)=>{let n=lt.call(e);if(t)for(let e=0;e<t&&n;++e)n=ut.call(n);return n},mt=new WeakSet,ht=e=>{if(mt.has(e))return;e.nodeType===8&&e.parentNode?.removeChild(e);let t=lt.call(e);for(;t;)ht(t),t=t.nextSibling;mt.add(e)},gt=(e,t,n)=>{let r=z.createTextNode(t),i=V(e,n);return et.call(e,r,i),r},_t=(e,t)=>{dt.call(e,t)},vt=(e,t,n)=>{typeof n!=`number`||He.test(t)?e.style[t]=n:typeof n==`string`?e.style.cssText=n:t.startsWith(`-`)?e.style.setProperty(t,String(n)):n==null?e.style[t]=``:e.style[t]=`${String(n)}px`},yt=(e,t,n)=>{t=t.replace(/xlink(?:H|:h)/,`h`).replace(/sName$/,`s`),t.startsWith(`xmlns`)?st.call(e,We,t,String(n)):t.startsWith(`xlink`)&&st.call(e,Ue,`href`,String(n))},bt=(e,t,n)=>{let r=n==null;if(n=r?``:n,t in e&&e[t]!==void 0&&e[t]!==null&&!(e instanceof SVGElement)&&ke.call(Ke,t))try{e[t]=n}catch{}else !r&&n!==``&&(n!==!1||t.includes(`-`))?ot.call(e,t,String(n)):at.call(e,t);let i=e instanceof HTMLInputElement,a=e instanceof HTMLSelectElement,o=e instanceof HTMLTextAreaElement;t===`value`&&(i||a||o)&&(ot.call(e,t,String(n)),e.value=n)},xt=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]);function St(e){return xt.get(e)||e}var Ct=Object.defineProperty,wt=(e,t,n)=>t in e?Ct(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,H=(e,t,n)=>(wt(e,typeof t==`symbol`?t:t+``,n),n),Tt=class{constructor(){H(this,`r`),H(this,`e`),H(this,`l`),H(this,`g`),H(this,`_u`),H(this,`_t`),H(this,`d`),H(this,`k`),H(this,`c`)}},Et=(e,t=[],n=[])=>{if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`bigint`||e===!0)return String(e);if(e==null||e===!1)return``;if(typeof e==`object`&&`$`in e)return t.push({p:n,e:[{t:Pe,n:null,v:null,h:e.$,i:0,l:null,p:null,b:null}],i:[]}),`<slot/>`;let r=``,i=``,a={p:n,e:[],i:[]};for(let t in e.props){let n=e.props[t];if(t===`key`||t===`ref`||t===`children`)continue;let i=St(t);if(i&&(t=i),t===`className`&&(t=`class`),t.startsWith(`on`)){`$`in n?a.e.push({t:Ie,n:t.slice(2),v:null,h:n.$,i:null,l:null,p:null,b:null}):a.i.push({t:Ie,n:t.slice(2),v:null,h:null,i:null,l:n,p:null,b:null});continue}if(n){if(typeof n==`object`&&`$`in n){t===`style`?a.e.push({t:Le,n:t,v:null,h:n.$,i:null,l:null,p:null,b:null}):t.charCodeAt(0)===Ge?a.e.push({t:Re,n:t,v:null,h:n.$,i:null,l:null,p:null,b:null}):a.e.push({t:Fe,n:t,v:null,h:n.$,i:null,l:null,p:null,b:null});continue}if(t===`style`&&typeof n==`object`){let e=``;for(let t in n){if(typeof n[t]==`object`){a.e.push({t:Le,n:t,v:null,h:n[t].$,i:null,l:null,p:null,b:null});continue}let r=``;for(let e=0,n=t.length;e<n;++e){let n=t.charCodeAt(e);n<97?r+=`-${String.fromCharCode(n+32)}`:r+=t[e]}e+=`${r}:${String(n[t])};`}r+=` style="${e}"`;continue}r+=` ${t}="${String(n)}"`}}if(ke.call(qe,e.type))return a.e.length&&t.push(a),`<${e.type}${r} />`;let o=!1;for(let r=0,s=e.props.children?.length||0,c=0;r<s;++r){let s=e.props.children?.[r];if(s==null||s===!1)continue;if(typeof s==`object`&&`$`in s){a.e.push({t:Pe,n:null,v:null,h:s.$,i:r,l:null,p:null,b:null});continue}if(s instanceof Tt){a.i.push({t:ze,n:null,v:null,h:null,i:r,l:null,p:null,b:s});continue}if(typeof s==`string`||typeof s==`number`||typeof s==`bigint`){let e=typeof s==`number`||typeof s==`bigint`?String(s):s;if(o){a.i.push({t:Pe,n:null,v:e,h:null,i:r,l:null,p:null,b:null});continue}o=!0,i+=e,c++;continue}o=!1;let l=n.slice();l.push(c++),i+=Et(s,t,l)}return(a.i.length||a.e.length)&&t.push(a),`<${e.type}${r}>${i}</${e.type}>`},Dt=Object.defineProperty,Ot=(e,t,n)=>t in e?Dt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kt=(e,t,n)=>(Ot(e,typeof t==`symbol`?t:t+``,n),n),At=e=>new jt(e),jt=class extends Tt{constructor(e){super(),kt(this,`b`),this.b=e}v(){}p(e){let t=this.b,n=e.b,r=t.length,i=n.length,a=this.t();if(this===e||i===0&&r===0)return a;if(this.b=n,i===0)return Ft.call(this),a;if(r===0)return Nt.call(e,a),a;let o=0,s=0,c=r-1,l=i-1,u=t[0],d=n[0],f=t[c],p=n[l],m;for(;o<=c&&s<=l;){if(!u){u=t[++o];continue}if(!f){f=t[--c];continue}let e=u.k,r=d.k;if(e===r){Ut.call(u,d),n[s]=u,u=t[++o],d=n[++s];continue}let i=f.k,h=p.k;if(i===h){Ut.call(f,p),n[l]=f,f=t[--c],p=n[--l];continue}if(e===h){Ut.call(u,p),n[l]=u;let e=n[l+1];Wt.call(u,e,e?.l||null),u=t[++o],p=n[--l];continue}if(i===r){Ut.call(f,d),n[s]=f;let e=t[o];Wt.call(f,e,e?.l||null),f=t[--c],d=n[++s];continue}if(!m){m=new De;for(let e=o;e<=c;e++)Ne.call(m,t[e].k,e)}let g=m.get(r);if(g===void 0)Ht.call(d,a,u.l||null);else{let e=t[g];Wt.call(e,u,null),Ut.call(e,d),n[s]=e,t[g]=null}d=n[++s]}if(o<=c||s<=l)if(o>c){let e=n[l+1];for(let t=s;t<=l;++t)Ht.call(n[t],a,e?e.l:null)}else for(let e=o;e<=c;++e)Gt.call(t[e]);return a}m(e,t=null){if(this._t)return this._t;for(let n=0,r=this.b.length;n<r;++n){let r=this.b[n];Ht.call(r,e,t)}return this._t=e,e}x(){let e=this.t();if(e)ct.call(e,``);else for(let e=0,t=this.b.length;e<t;++e)Gt.call(this.b[e]);this.b=[]}u(){return!0}s(){return this.b.map(e=>e.s()).join(``)}t(){return this._t||=this.b[0].t(),this._t}},Mt=jt.prototype,Nt=Mt.m,Pt=Mt.p,Ft=Mt.x,It=new Proxy({},{get(e,t){return{$:t}}}),Lt=(e,t,n,r)=>{let i=e(It),a=[],o=ft(Et(t?t(i):i,a),r);return ht(o),(e,t,r)=>new zt(o,a,e,t??e?.key??null,r??n??null,null)},Rt=(e,t)=>{if((`b`in e||`b`in t)&&Pt.call(e,t),e.l||Ht.call(e,void 0,null,null),e.k&&e.k===t.k||e.r===t.r)return Ut.call(e,t);let n=Ht.call(t,e.t(),e.l,null);return Gt.call(e),e.k=t.k,n},zt=class extends Tt{constructor(e,t,n,r,i,a){super(),this.r=e,this.d=n,this.e=t,this.k=r,this.c=Array(t.length),i?this._u=i:this._u=null,a?this.g=a:this.g=null}m(e,t=null,n){if(this.l)return this.l;let r=n??tt.call(this.r,!0),i=this.g?.(r);i&&(this.c=i);for(let e=0,t=this.e.length;e<t;++e){let t=this.e[e],a=i?.[e]??Bt(t.p,r,this.c,e);for(let e=0,r=t.e.length;e<r;++e){let i=t.e[e],o=this.d[i.h];if(i.t&Pe){if(o instanceof Tt){let e=V(a,i.i);n?o.m(a,e,e):o.m(a,e);continue}if(a[R]||(a[R]=Array(r)),o&&typeof o==`object`&&`foreign`in o){if(n){let e=V(a,i.i);o.reset(e)}let t=o.current;a[R][e]=t,n||et.call(a,t,V(a,i.i));continue}if(n){a[R][e]=V(a,i.i);continue}a[R][e]=gt(a,o==null||o===!1?``:String(o),i.i)}else if(i.t&Ie){let e=pt(a,i.n,o);a[Be+i.n]=e}else if(i.t&Fe)bt(a,i.n,o);else if(i.t&Le)if(typeof o==`string`||typeof o==`number`)vt(a,i.n,o);else for(let e in o)vt(a,e,o[e]);else yt(a,i.n,o)}let o=t.i?.length;if(o)for(let e=0;e<o;++e){let r=t.i[e];if(r.t&Pe)r.v&&!n&&gt(a,r.v,r.i);else if(r.t&Ie)pt(a,r.n,r.l);else{let e=V(a,r.i);n?r.b.m(a,e,e):r.b.m(a,e)}}}return e&&!n&&et.call(e,r,t),this.l=r,r}p(e){let t=this.l;if(!e.d)return t;let n=this.d;if(!Kt.call(this,n,e.d))return t;this.d=e.d;for(let r=0,i=this.e.length;r<i;++r){let i=this.e[r],a=this.c[r]??Bt(i.p,t,this.c,r);for(let t=0,o=i.e.length;t<o;++t){let o=i.e[t],s=n[o.h],c=e.d[o.h];if(c!==s){if(o.t&Ie){a[Be+o.n](c);continue}if(o.t&Pe){if(s instanceof Tt){let n=e.e?.[r]?.e[t],i=e.d[n.h];s.p(i);continue}if(c&&typeof c==`object`&&`foreign`in c){let e=a[R][t];if(c.unstable&&s!==c){let n=c.current;a[R][t]=n,nt.call(a,n,e)}else c.current=e;continue}_t(a[R][t],c==null||c===!1?``:String(c))}else if(o.t&Fe)bt(a,o.n,c);else if(o.t&Le)if(typeof c==`string`||typeof c==`number`)vt(a,o.n,c);else for(let e in c)c[e]!==s[e]&&vt(a,e,c[e]);else yt(a,o.n,c)}}}return t}v(e=null,t=null){et.call(this.t(),this.l,e?e.l:t)}x(){rt.call(this.l),this.l=null}u(e,t){return this._u?this._u(e,t):!0}s(){return String(this.l?.outerHTML)}t(){return this._t||=this.l?.parentElement,this._t}},Bt=(e,t,n,r)=>{let i=e.length;if(!i)return t;let a=n&&r!==void 0;if(a&&n[r])return n[r];for(let n=0;n<i;++n){let r=e[n];t=V(t,r)}return a&&(n[r]=t),t},Vt=zt.prototype,Ht=Vt.m,Ut=Vt.p,Wt=Vt.v,Gt=Vt.x,Kt=Vt.u,U=e(i(),1),qt={noSlot:!1},Jt=e(Te(),1),Yt=`slot`,Xt=({effect:e,deps:t})=>((0,U.useEffect)(e,t||[]),null),W=new Map,Zt=(0,U.createContext)(!1),Qt=(e,t,n)=>{let r={ref:t},i=0;for(let t in e){let a=e[t];if((0,U.isValidElement)(a)||Array.isArray(a)&&a.length&&(0,U.isValidElement)(a[0])){r[t]=en(a,!1,n,i++);continue}r[t]=e[t]}return r},$t=(e,t)=>(0,U.createElement)(Yt,{suppressHydrationWarning:!0,id:t},e),en=(e,t,n,r,i)=>{let a=n?.[r]?.current,o=(0,U.isValidElement)(e)&&typeof e.type==`function`&&`_c`in e.type,s=o&&e.type._c;if(typeof window>`u`)return o?s?e:$t($t(e),i):$t(e,i);if(s){let t=e.type(e.props);if(W.has(t.type)){let e=W.get(t.type);if(typeof e==`function`)return e(t.props)}}let c=a??(i?document.getElementById(i):null)??document.createElement(`slot`),l={foreign:!0,current:c,portal:(0,Jt.createPortal)((0,U.createElement)(U.Fragment,{children:e}),c,i),reset:e=>{e.childNodes.forEach(t=>e.removeChild(t))},unstable:t};return n&&(n[r]=l),l},tn=e=>{if(typeof e!=`object`||!e||!(`type`in e))return typeof e==`number`?String(e):e;let t=e.type;if(typeof t==`function`)return tn(t(e.props??{}));if(typeof t==`object`&&`$`in t)return t;let n={...e.props};return`css`in n&&`__EMOTION_TYPE_PLEASE_DO_NOT_USE__`in n&&(n.style=n.css.styles,t=n.__EMOTION_TYPE_PLEASE_DO_NOT_USE__,delete n.__EMOTION_TYPE_PLEASE_DO_NOT_USE__,delete n.css),e.props?.children!=null&&(n.children=nn(e.props.children).map(e=>tn(e))),{type:t,props:n}},nn=e=>{if(e==null)return[];if(typeof e==`object`&&`type`in e&&e.type===U.Fragment)return nn(e.props.children);if(!Array.isArray(e)||typeof e==`object`&&`$`in e)return[e];let t=e.flat(1/0),n=[];for(let e=0,r=t.length;e<r;++e)n.push(...nn(t[e]));return n},rn=typeof window>`u`?U.useEffect:U.useLayoutEffect;function an(e,t,n){if(!e||t(e))return e;let r=n?e.return:e.child;for(;r;){let e=an(r,t,n);if(e)return e;r=n?null:r.sibling}}function on(){let e=(0,U.useRef)();return(0,U.useState)(()=>{let t=Function.prototype.bind;Function.prototype.bind=function(n,r){return n===null&&typeof r?.type==`function`&&(e.current=r,Function.prototype.bind=t),t.apply(this,arguments)}}),e.current}function sn(e){let t=on(),n=(0,U.useRef)({el:null,depth:0});return rn(()=>{n.current.el=an(t,t=>(n.current.depth++,typeof t.type==`string`&&(e===void 0||t.type===e)),!0)?.stateNode},[t]),n}function cn(){let e=on(),t=(0,U.useRef)({el:null,depth:0});return rn(()=>{t.current.el=an(e,e=>(t.current.depth++,e.stateNode?.containerInfo!=null),!0)?.stateNode.containerInfo},[e]),t}var ln=(e,t={})=>{let n=t?.experimental_noSlot??qt.noSlot,r=t?.block,i=t?.svg?`g`:Yt;e&&(r=Lt(e,tn,t?.shouldUpdate,t?.svg));let a=(e,a)=>{let o=cn(),s=sn(),c=e._hmr,l=(0,U.useRef)(null),u=(0,U.useRef)(null),d=(0,U.useRef)([]);e=Qt(e,a,d.current),u.current?.(e);let f=(0,U.useCallback)(()=>{if(!l.current&&!n)return;let i=r(e,e.key);return c&&l.current?.textContent&&(l.current.textContent=``),n&&(l.current=s.current?.el??o.current?.el,(e.scoped||s.current&&o.current&&s.current.depth>o.current.depth)&&(l.current=o.current.el),l.current.childNodes.length&&console.error(Error(`\`experimental_options.noSlot\` does not support having siblings at the moment.
2
+ The block element should be the only child of the \`${tt.call(l.current).outerHTML}\` element.
3
+ To avoid this error, \`experimental_options.noSlot\` should be false`))),(u.current===null||c)&&(Ht.call(i,l.current,null),u.current=e=>{Rt(i,r(e,e.key,t?.shouldUpdate))}),()=>{Gt.call(i)}},[]),p=(0,U.useMemo)(()=>n?null:(0,U.createElement)(t?.as??i,{ref:l}),[]),m=d.current.length,h=Array(m);for(let e=0;e<m;++e)h[e]=d.current[e]?.portal;return(0,U.createElement)(U.Fragment,{},p,(0,U.createElement)(Xt,{effect:f,deps:c?[c]:[]}),h)};return je.call(W,a)||Ne.call(W,a,ln),t?.name&&(e&&(e.displayName=`Million(Render(${t.name}))`),a.displayName=`Million(Block(${t.name}))`),a};(0,U.memo)(({each:e,children:t,memo:n,svg:r,as:i,...a})=>{let o=(0,U.useRef)(null),[s]=(0,U.useState)(()=>({current:Array(e.length)})),c=(0,U.useRef)(null),l=(0,U.useRef)({each:null,children:null,mounted:!1}),[,u]=(0,U.useState)(!1);if(c.current&&(e!==l.current.each||!n)){let r=un(e,t,l,s,n);Pt.call(c.current,At(r))}let d=(0,U.createElement)(U.Fragment,null,(0,U.createElement)(i??(r?`g`:`slot`),{...a,ref:o}),...s.current.map(e=>e.portal));return(0,U.useEffect)(()=>{!o.current||c.current||l.current.mounted||(c.current=At(un(e,t,l,s,n)),je.call(W,d)||Ne.call(W,d,c.current),Nt.call(c.current,o.current),l.current.mounted=!0,u(!0))},[o.current]),d});var un=(e,t,n,r,i)=>{let a=Array(e.length),o=n.current;for(let n=0,s=e.length;n<s;++n){if(i&&o.each&&o.each[n]===e[n]){a[n]=o.children?.[n];continue}let s=t(e[n],n);if(je.call(W,s.type)){o.block||=Me.call(W,s.type),a[n]=o.block(s.props,r,n);continue}if(typeof s.type==`function`&&`_c`in s.type){let e=s.type(s.props);if(je.call(W,e.type)){let t=Me.call(W,e.type);if(typeof t==`function`){a[n]=t(e.props);continue}}}let c=Lt(e=>e?.scope),l=(e,t,n)=>c({scope:en((0,U.createElement)(s.type,e),!1,t.current,n)},s.key?String(s.key):void 0);Ne.call(W,s.type,l),o.block=l,a[n]=l(s.props,r,n)}return o.each=e,o.children=a,a};function dn(e,t){return e===t||e!==e&&t!==t}function fn(e,t){for(let n in e)if(!dn(e[n],t[n]))return!0;return!1}function pn(e,{portals:t,...n}){let r=`CompiledBlock(Inner(${n.name}))`,i=ln(t=>e(t),{...n,scoped:void 0,name:r,shouldUpdate:fn}),a=t?.length||0,o=t&&a>0?e=>{let n=(0,U.useContext)(Zt),[r]=(0,U.useState)(()=>[]),o={...e,scoped:n};for(let e=0;e<a;e++){let n=t[e];o[n]=en(o[n],!1,r,e)}let s=[];for(let e=0,t=r.length;e<t;e++)s[e]=r[e].portal;return(0,U.createElement)(U.Fragment,null,(0,U.createElement)(i,o),s)}:e=>(0,U.createElement)(i,e);return n.name&&(o.displayName=`Million(CompiledBlock(Outer(${n.name})))`),o}typeof window<`u`&&(window.__MILLION_DATA__={version:`3.1.11`});var G=_(),mn=`AlertDialog`,[hn,gn]=y(mn,[oe]),K=oe(),_n=e=>{let{__scopeAlertDialog:t,...n}=e,r=K(t);return(0,G.jsx)(M,{...r,...n,modal:!0})};_n.displayName=mn;var vn=`AlertDialogTrigger`,yn=U.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=K(n);return(0,G.jsx)(me,{...i,...r,ref:t})});yn.displayName=vn;var bn=`AlertDialogPortal`,xn=e=>{let{__scopeAlertDialog:t,...n}=e,r=K(t);return(0,G.jsx)(xe,{...r,...n})};xn.displayName=bn;var Sn=`AlertDialogOverlay`,Cn=U.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=K(n);return(0,G.jsx)(ue,{...i,...r,ref:t})});Cn.displayName=Sn;var wn=`AlertDialogContent`,[Tn,En]=hn(wn),Dn=ce(`AlertDialogContent`),On=U.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,a=K(n),o=U.useRef(null),s=O(t,o),c=U.useRef(null);return(0,G.jsx)(de,{contentName:wn,titleName:kn,docsSlug:`alert-dialog`,children:(0,G.jsx)(Tn,{scope:n,cancelRef:c,children:(0,G.jsxs)(ye,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:S(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,G.jsx)(Dn,{children:r}),(0,G.jsx)(Ln,{contentRef:o})]})})})});On.displayName=wn;var kn=`AlertDialogTitle`,An=U.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=K(n);return(0,G.jsx)(P,{...i,...r,ref:t})});An.displayName=kn;var jn=`AlertDialogDescription`,Mn=U.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=K(n);return(0,G.jsx)(ie,{...i,...r,ref:t})});Mn.displayName=jn;var Nn=`AlertDialogAction`,Pn=U.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=K(n);return(0,G.jsx)(fe,{...i,...r,ref:t})});Pn.displayName=Nn;var Fn=`AlertDialogCancel`,In=U.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=En(Fn,n),a=K(n),o=O(t,i);return(0,G.jsx)(fe,{...a,...r,ref:o})});In.displayName=Fn;var Ln=({contentRef:e})=>{let t=`\`${wn}\` requires a description for the component to be accessible for screen reader users.
4
+
5
+ You can add a description to the \`${wn}\` by passing a \`${jn}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
6
+
7
+ 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 \`${wn}\`. 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.
8
+
9
+ 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},Rn=_n,zn=xn,Bn=Cn,Vn=On,Hn=Pn,Un=In,Wn=An,Gn=Mn,Kn=Rn,qn=zn,Jn=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(`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,G.jsx)(Bn,{className:a,...i,ref:t}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Jn.displayName=Bn.displayName;var Yn=U.forwardRef((e,t)=>{let n=(0,L.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,G.jsx)(Jn,{}),n[3]=a):a=n[3];let o;n[4]===r?o=n[5]:(o=h(`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,G.jsxs)(qn,{children:[a,(0,G.jsx)(Vn,{ref:t,className:o,...i})]}),n[6]=i,n[7]=t,n[8]=o,n[9]=s):s=n[9],s});Yn.displayName=Vn.displayName;var Xn=e=>{let t=(0,L.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=h(`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,G.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};Xn.displayName=`AlertDialogHeader`;var Zn=e=>{let t=(0,L.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=h(`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,G.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};Zn.displayName=`AlertDialogFooter`;var Qn=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(I.dialogTitle,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(Wn,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Qn.displayName=Wn.displayName;var $n=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(I.dialogDescription,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(Gn,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});$n.displayName=Gn.displayName;var er=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(d(),r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(Hn,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});er.displayName=Hn.displayName;var tr=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(d({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,G.jsx)(Un,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});tr.displayName=Un.displayName;var nr=pn(e=>(0,G.jsxs)(`div`,{className:e.v0,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:e.v1,children:e.v2}),e.v3]}),e.v4]}),{name:`PageHeader_1`,portals:[`v2`,`v3`,`v4`]}),rr=function(e){let t=(0,L.c)(12),{title:n,description:r,action:i,className:a,titleClassName:o}=e,s;t[0]===a?s=t[1]:(s=h(`flex items-center justify-between mb-6`,a),t[0]=a,t[1]=s);let c;t[2]===o?c=t[3]:(c=h(I.pageTitle,o),t[2]=o,t[3]=c);let l;t[4]===r?l=t[5]:(l=r?(0,G.jsx)(`p`,{className:I.pageSubtitle,children:r}):null,t[4]=r,t[5]=l);let u;return t[6]!==i||t[7]!==s||t[8]!==c||t[9]!==l||t[10]!==n?(u=(0,G.jsx)(nr,{v0:s,v1:c,v2:n,v3:l,v4:i}),t[6]=i,t[7]=s,t[8]=c,t[9]=l,t[10]=n,t[11]=u):u=t[11],u};function ir(e){let t=(0,L.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=h(F.settingsPage,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,G.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function ar(e){let t=(0,L.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=h(F.accountPage,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,G.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function or(e){let t=(0,L.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=h(F.formPage,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,G.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function sr(e){let t=(0,L.c)(5),{title:n,className:r}=e,i;t[0]===r?i=t[1]:(i=h(I.sectionTitle,`mb-3`,r),t[0]=r,t[1]=i);let a;return t[2]!==i||t[3]!==n?(a=(0,G.jsx)(`h2`,{className:i,children:n}),t[2]=i,t[3]=n,t[4]=a):a=t[4],a}function cr(e){let t=(0,L.c)(6),{children:n,variant:r,className:i}=e,a=r===void 0?`info`:r,o;t[0]!==i||t[1]!==a?(o=h(a===`hint`?I.hintBanner:a===`success`?h(I.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`?h(I.error,`bg-destructive/10 rounded-md px-3 py-2 mb-4`):I.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,G.jsx)(`div`,{className:o,children:n}),t[3]=n,t[4]=o,t[5]=s):s=t[5],s}function lr(e){let t=(0,L.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=h(`flex-1 overflow-auto`,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,G.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function ur(e){let t=(0,L.c)(10),{children:n,title:r,action:i}=e,a;t[0]===r?a=t[1]:(a=r?(0,G.jsx)(`h2`,{className:h(I.emptyStateTitle,`mb-2`),children:r}):null,t[0]=r,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,G.jsx)(`p`,{className:I.bodyMuted,children:n}),t[2]=n,t[3]=o);let s;t[4]===i?s=t[5]:(s=i?(0,G.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,G.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,G.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 dr(e){let t=(0,L.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=h(`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,G.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function fr(e){let t=(0,L.c)(14),{title:n,description:r,action:i,children:a,className:o}=e,s;t[0]===n?s=t[1]:(s=(0,G.jsx)(sr,{title:n,className:`mb-1`}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=r?(0,G.jsx)(`p`,{className:I.bodyMuted,children:r}):null,t[2]=r,t[3]=c);let l;t[4]!==s||t[5]!==c?(l=(0,G.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,G.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,G.jsxs)(`div`,{className:o,children:[u,a]}),t[10]=a,t[11]=o,t[12]=u,t[13]=d):d=t[13],d}function pr(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 mr=[` `,`Enter`,`ArrowUp`,`ArrowDown`],hr=[` `,`Enter`],q=`Select`,[gr,_r,vr]=ve(q),[yr,br]=y(q,[vr,p]),xr=p(),[Sr,J]=yr(q),[Cr,wr]=yr(q),Tr=e=>{let{__scopeSelect:t,children:r,open:i,defaultOpen:a,onOpenChange:o,value:s,defaultValue:c,onValueChange:l,dir:u,name:d,autoComplete:f,disabled:p,required:m,form:h}=e,g=xr(t),[_,v]=U.useState(null),[y,b]=U.useState(null),[x,S]=U.useState(!1),C=be(u),[ee,w]=n({prop:i,defaultProp:a??!1,onChange:o,caller:q}),[T,te]=n({prop:s,defaultProp:c,onChange:l,caller:q}),E=U.useRef(null),D=_?h||!!_.closest(`form`):!0,[O,k]=U.useState(new Set),A=Array.from(O).map(e=>e.props.value).join(`;`);return(0,G.jsx)(_e,{...g,children:(0,G.jsxs)(Sr,{required:m,scope:t,trigger:_,onTriggerChange:v,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:x,onValueNodeHasChildrenChange:S,contentId:se(),value:T,onValueChange:te,open:ee,onOpenChange:w,dir:C,triggerPointerDownPosRef:E,disabled:p,children:[(0,G.jsx)(gr.Provider,{scope:t,children:(0,G.jsx)(Cr,{scope:e.__scopeSelect,onNativeOptionAdd:U.useCallback(e=>{k(t=>new Set(t).add(e))},[]),onNativeOptionRemove:U.useCallback(e=>{k(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:r})}),D?(0,G.jsxs)(_i,{"aria-hidden":!0,required:m,tabIndex:-1,name:d,autoComplete:f,value:T,onChange:e=>te(e.target.value),disabled:p,form:h,children:[T===void 0?(0,G.jsx)(`option`,{value:``}):null,Array.from(O)]},A):null]})})};Tr.displayName=q;var Er=`SelectTrigger`,Dr=U.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=xr(n),s=J(Er,n),c=s.disabled||r,l=O(t,s.onTriggerChange),u=_r(n),d=U.useRef(`touch`),[f,p,m]=yi(e=>{let t=u().filter(e=>!e.disabled),n=bi(t,e,t.find(e=>e.value===s.value));n!==void 0&&s.onValueChange(n.value)}),h=e=>{c||(s.onOpenChange(!0),m()),e&&(s.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,G.jsx)(k,{asChild:!0,...a,children:(0,G.jsx)(o.button,{type:`button`,role:`combobox`,"aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":`none`,dir:s.dir,"data-state":s.open?`open`:`closed`,disabled:c,"data-disabled":c?``:void 0,"data-placeholder":vi(s.value)?``:void 0,...i,ref:l,onClick:S(i.onClick,e=>{e.currentTarget.focus(),d.current!==`mouse`&&h(e)}),onPointerDown:S(i.onPointerDown,e=>{d.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(h(e),e.preventDefault())}),onKeyDown:S(i.onKeyDown,e=>{let t=f.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&p(e.key),!(t&&e.key===` `)&&mr.includes(e.key)&&(h(),e.preventDefault())})})})});Dr.displayName=Er;var Or=`SelectValue`,kr=U.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:s=``,...c}=e,l=J(Or,n),{onValueNodeHasChildrenChange:u}=l,d=a!==void 0,f=O(t,l.onValueNodeChange);return v(()=>{u(d)},[u,d]),(0,G.jsx)(o.span,{...c,ref:f,style:{pointerEvents:`none`},children:vi(l.value)?(0,G.jsx)(G.Fragment,{children:s}):a})});kr.displayName=Or;var Ar=`SelectIcon`,jr=U.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,G.jsx)(o.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});jr.displayName=Ar;var Mr=`SelectPortal`,Nr=e=>(0,G.jsx)(ne,{asChild:!0,...e});Nr.displayName=Mr;var Y=`SelectContent`,Pr=U.forwardRef((e,t)=>{let n=J(Y,e.__scopeSelect),[r,i]=U.useState();if(v(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?Jt.createPortal((0,G.jsx)(Fr,{scope:e.__scopeSelect,children:(0,G.jsx)(gr.Slot,{scope:e.__scopeSelect,children:(0,G.jsx)(`div`,{children:e.children})})}),t):null}return(0,G.jsx)(Rr,{...e,ref:t})});Pr.displayName=Y;var X=10,[Fr,Z]=yr(Y),Ir=`SelectContentImpl`,Lr=x(`SelectContent.RemoveScroll`),Rr=U.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:o,onPointerDownOutside:s,side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:m,sticky:h,hideWhenDetached:g,avoidCollisions:_,...v}=e,y=J(Y,n),[b,x]=U.useState(null),[C,ee]=U.useState(null),w=O(t,e=>x(e)),[T,te]=U.useState(null),[E,D]=U.useState(null),k=_r(n),[A,ne]=U.useState(!1),re=U.useRef(!1);U.useEffect(()=>{if(b)return ae(b)},[b]),Se();let ie=U.useCallback(e=>{let[t,...n]=k().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&&C&&(C.scrollTop=0),n===r&&C&&(C.scrollTop=C.scrollHeight),n?.focus(),document.activeElement!==i))return},[k,C]),M=U.useCallback(()=>ie([T,b]),[ie,T,b]);U.useEffect(()=>{A&&M()},[A,M]);let{onOpenChange:N,triggerPointerDownPosRef:P}=y;U.useEffect(()=>{if(b){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(P.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(P.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():b.contains(n.target)||N(!1),document.removeEventListener(`pointermove`,t),P.current=null};return P.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[b,N,P]),U.useEffect(()=>{let e=()=>N(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[N]);let[F,oe]=yi(e=>{let t=k().filter(e=>!e.disabled),n=bi(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),se=U.useCallback((e,t,n)=>{let r=!re.current&&!n;(y.value!==void 0&&y.value===t||r)&&(te(e),r&&(re.current=!0))},[y.value]),ce=U.useCallback(()=>b?.focus(),[b]),le=U.useCallback((e,t,n)=>{let r=!re.current&&!n;(y.value!==void 0&&y.value===t||r)&&D(e)},[y.value]),ue=r===`popper`?Hr:Br,de=ue===Hr?{side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:m,sticky:h,hideWhenDetached:g,avoidCollisions:_}:{};return(0,G.jsx)(Fr,{scope:n,content:b,viewport:C,onViewportChange:ee,itemRefCallback:se,selectedItem:T,onItemLeave:ce,itemTextRefCallback:le,focusSelectedItem:M,selectedItemText:E,position:r,isPositioned:A,searchRef:F,children:(0,G.jsx)(j,{as:Lr,allowPinchZoom:!0,children:(0,G.jsx)(Ce,{asChild:!0,trapped:y.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:S(i,e=>{y.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,G.jsx)(a,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:(0,G.jsx)(ue,{role:`listbox`,id:y.contentId,"data-state":y.open?`open`:`closed`,dir:y.dir,onContextMenu:e=>e.preventDefault(),...v,...de,onPlaced:()=>ne(!0),ref:w,style:{display:`flex`,flexDirection:`column`,outline:`none`,...v.style},onKeyDown:S(v.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&oe(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=k().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(()=>ie(t)),e.preventDefault()}})})})})})})});Rr.displayName=Ir;var zr=`SelectItemAlignedPosition`,Br=U.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=J(Y,n),s=Z(Y,n),[c,l]=U.useState(null),[u,d]=U.useState(null),f=O(t,e=>d(e)),p=_r(n),m=U.useRef(!1),h=U.useRef(!0),{viewport:g,selectedItem:_,selectedItemText:y,focusSelectedItem:b}=s,x=U.useCallback(()=>{if(a.trigger&&a.valueNode&&c&&u&&g&&_&&y){let e=a.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=y.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-X,d=le(a,[X,Math.max(X,u-l)]);c.style.minWidth=s+`px`,c.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-X,d=le(a,[X,Math.max(X,u-l)]);c.style.minWidth=s+`px`,c.style.right=d+`px`}let o=p(),s=window.innerHeight-X*2,l=g.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),h=parseInt(d.paddingTop,10),v=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=f+h+l+b+v,S=Math.min(_.offsetHeight*5,x),C=window.getComputedStyle(g),ee=parseInt(C.paddingTop,10),w=parseInt(C.paddingBottom,10),T=e.top+e.height/2-X,te=s-T,E=_.offsetHeight/2,D=_.offsetTop+E,O=f+h+D,k=x-O;if(O<=T){let e=o.length>0&&_===o[o.length-1].ref.current;c.style.bottom=`0px`;let t=u.clientHeight-g.offsetTop-g.offsetHeight,n=O+Math.max(te,E+(e?w:0)+t+v);c.style.height=n+`px`}else{let e=o.length>0&&_===o[0].ref.current;c.style.top=`0px`;let t=Math.max(T,f+g.offsetTop+(e?ee:0)+E)+k;c.style.height=t+`px`,g.scrollTop=O-T+g.offsetTop}c.style.margin=`${X}px 0`,c.style.minHeight=S+`px`,c.style.maxHeight=s+`px`,r?.(),requestAnimationFrame(()=>m.current=!0)}},[p,a.trigger,a.valueNode,c,u,g,_,y,a.dir,r]);v(()=>x(),[x]);let[S,C]=U.useState();return v(()=>{u&&C(window.getComputedStyle(u).zIndex)},[u]),(0,G.jsx)(Ur,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:m,onScrollButtonChange:U.useCallback(e=>{e&&h.current===!0&&(x(),b?.(),h.current=!1)},[x,b]),children:(0,G.jsx)(`div`,{ref:l,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:S},children:(0,G.jsx)(o.div,{...i,ref:f,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});Br.displayName=zr;var Vr=`SelectPopperPosition`,Hr=U.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=X,...a}=e,o=xr(n);return(0,G.jsx)(m,{...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)`}})});Hr.displayName=Vr;var[Ur,Wr]=yr(Y,{}),Gr=`SelectViewport`,Kr=U.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=Z(Gr,n),s=Wr(Gr,n),c=O(t,a.onViewportChange),l=U.useRef(0);return(0,G.jsxs)(G.Fragment,{children:[(0,G.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,G.jsx)(gr.Slot,{scope:n,children:(0,G.jsx)(o.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:c,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:S(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=s;if(r?.current&&n){let e=Math.abs(l.current-t.scrollTop);if(e>0){let r=window.innerHeight-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`)}}}l.current=t.scrollTop})})})]})});Kr.displayName=Gr;var qr=`SelectGroup`,[Jr,Yr]=yr(qr),Xr=U.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=se();return(0,G.jsx)(Jr,{scope:n,id:i,children:(0,G.jsx)(o.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Xr.displayName=qr;var Zr=`SelectLabel`,Qr=U.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Yr(Zr,n);return(0,G.jsx)(o.div,{id:i.id,...r,ref:t})});Qr.displayName=Zr;var $r=`SelectItem`,[ei,ti]=yr($r),ni=U.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...s}=e,c=J($r,n),l=Z($r,n),u=c.value===r,[d,f]=U.useState(a??``),[p,m]=U.useState(!1),h=O(t,e=>l.itemRefCallback?.(e,r,i)),g=se(),_=U.useRef(`touch`),v=()=>{i||(c.onValueChange(r),c.onOpenChange(!1))};if(r===``)throw Error(`A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,G.jsx)(ei,{scope:n,value:r,disabled:i,textId:g,isSelected:u,onItemTextChange:U.useCallback(e=>{f(t=>t||(e?.textContent??``).trim())},[]),children:(0,G.jsx)(gr.ItemSlot,{scope:n,value:r,disabled:i,textValue:d,children:(0,G.jsx)(o.div,{role:`option`,"aria-labelledby":g,"data-highlighted":p?``:void 0,"aria-selected":u&&p,"data-state":u?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...s,ref:h,onFocus:S(s.onFocus,()=>m(!0)),onBlur:S(s.onBlur,()=>m(!1)),onClick:S(s.onClick,()=>{_.current!==`mouse`&&v()}),onPointerUp:S(s.onPointerUp,()=>{_.current===`mouse`&&v()}),onPointerDown:S(s.onPointerDown,e=>{_.current=e.pointerType}),onPointerMove:S(s.onPointerMove,e=>{_.current=e.pointerType,i?l.onItemLeave?.():_.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:S(s.onPointerLeave,e=>{e.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:S(s.onKeyDown,e=>{l.searchRef?.current!==``&&e.key===` `||(hr.includes(e.key)&&v(),e.key===` `&&e.preventDefault())})})})})});ni.displayName=$r;var ri=`SelectItemText`,ii=U.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,s=J(ri,n),c=Z(ri,n),l=ti(ri,n),u=wr(ri,n),[d,f]=U.useState(null),p=O(t,e=>f(e),l.onItemTextChange,e=>c.itemTextRefCallback?.(e,l.value,l.disabled)),m=d?.textContent,h=U.useMemo(()=>(0,G.jsx)(`option`,{value:l.value,disabled:l.disabled,children:m},l.value),[l.disabled,l.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=u;return v(()=>(g(h),()=>_(h)),[g,_,h]),(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(o.span,{id:l.textId,...a,ref:p}),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren?Jt.createPortal(a.children,s.valueNode):null]})});ii.displayName=ri;var ai=`SelectItemIndicator`,oi=U.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return ti(ai,n).isSelected?(0,G.jsx)(o.span,{"aria-hidden":!0,...r,ref:t}):null});oi.displayName=ai;var si=`SelectScrollUpButton`,ci=U.forwardRef((e,t)=>{let n=Z(si,e.__scopeSelect),r=Wr(si,e.__scopeSelect),[i,a]=U.useState(!1),o=O(t,r.onScrollButtonChange);return v(()=>{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,G.jsx)(di,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});ci.displayName=si;var li=`SelectScrollDownButton`,ui=U.forwardRef((e,t)=>{let n=Z(li,e.__scopeSelect),r=Wr(li,e.__scopeSelect),[i,a]=U.useState(!1),o=O(t,r.onScrollButtonChange);return v(()=>{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,G.jsx)(di,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});ui.displayName=li;var di=U.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Z(`SelectScrollButton`,n),s=U.useRef(null),c=_r(n),l=U.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return U.useEffect(()=>()=>l(),[l]),v(()=>{c().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[c]),(0,G.jsx)(o.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:S(i.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:S(i.onPointerMove,()=>{a.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:S(i.onPointerLeave,()=>{l()})})}),fi=`SelectSeparator`,pi=U.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,G.jsx)(o.div,{"aria-hidden":!0,...r,ref:t})});pi.displayName=fi;var mi=`SelectArrow`,hi=U.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=xr(n),a=J(mi,n),o=Z(mi,n);return a.open&&o.position===`popper`?(0,G.jsx)(l,{...i,...r,ref:t}):null});hi.displayName=mi;var gi=`SelectBubbleInput`,_i=U.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=U.useRef(null),a=O(r,i),s=pr(t);return U.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(s!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[s,t]),(0,G.jsx)(o.select,{...n,style:{...u,...n.style},ref:a,defaultValue:t})});_i.displayName=gi;function vi(e){return e===``||e===void 0}function yi(e){let t=T(e),n=U.useRef(``),r=U.useRef(0),i=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]),a=U.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return U.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function bi(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=xi(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 xi(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Si=Tr,Ci=Dr,wi=kr,Ti=jr,Ei=Nr,Di=Pr,Oi=Kr,ki=Qr,Ai=ni,ji=ii,Mi=oi,Ni=ci,Pi=ui,Fi=pi,Ii=Si,Li=wi,Ri=U.forwardRef((e,t)=>{let n=(0,L.c)(12),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]===i?o=n[5]:(o=h(`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,G.jsx)(Ti,{asChild:!0,children:(0,G.jsx)(f,{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,G.jsxs)(Ci,{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});Ri.displayName=Ci.displayName;var zi=U.forwardRef((e,t)=>{let n=(0,L.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=h(`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,G.jsx)(b,{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,G.jsx)(Ni,{ref:t,className:a,...i,children:o}),n[6]=i,n[7]=t,n[8]=a,n[9]=s):s=n[9],s});zi.displayName=Ni.displayName;var Bi=U.forwardRef((e,t)=>{let n=(0,L.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=h(`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,G.jsx)(f,{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,G.jsx)(Pi,{ref:t,className:a,...i,children:o}),n[6]=i,n[7]=t,n[8]=a,n[9]=s):s=n[9],s});Bi.displayName=Pi.displayName;var Vi=U.forwardRef((e,t)=>{let n=(0,L.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=h(`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,G.jsx)(zi,{}),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=h(`p-1`,d),n[9]=d,n[10]=f);let p;n[11]!==r||n[12]!==f?(p=(0,G.jsx)(Oi,{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,G.jsx)(Bi,{}),n[14]=m):m=n[14];let g;return n[15]!==s||n[16]!==a||n[17]!==t||n[18]!==l||n[19]!==p?(g=(0,G.jsx)(Ei,{children:(0,G.jsxs)(Di,{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]=g):g=n[20],g});Vi.displayName=Di.displayName;var Hi=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(`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,G.jsx)(ki,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Hi.displayName=ki.displayName;var Ui=U.forwardRef((e,t)=>{let n=(0,L.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=h(`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,G.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,G.jsx)(Mi,{children:(0,G.jsx)(g,{className:`h-4 w-4`})})}),n[6]=s):s=n[6];let c;n[7]===r?c=n[8]:(c=(0,G.jsx)(ji,{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,G.jsxs)(Ai,{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});Ui.displayName=Ai.displayName;var Wi=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(`-mx-1 my-1 h-px bg-muted`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(Fi,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Wi.displayName=Fi.displayName;function Gi(e){let t=(0,L.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=h(`flex h-full items-center justify-center`,n),t[0]=n,t[1]=s);let c;t[2]===o?c=t[3]:(c=h(o,`animate-spin mx-auto text-muted-foreground`),t[2]=o,t[3]=c);let l;t[4]===c?l=t[5]:(l=(0,G.jsx)(E,{className:c}),t[4]=c,t[5]=l);let u;t[6]===r?u=t[7]:(u=r?(0,G.jsx)(`p`,{className:h(I.bodyMuted,`mt-2`),children:r}):null,t[6]=r,t[7]=u);let d;t[8]!==l||t[9]!==u?(d=(0,G.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,G.jsx)(`div`,{className:s,children:d}),t[11]=s,t[12]=d,t[13]=f):f=t[13],f}function Ki(){let e=(0,L.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsx)(`div`,{className:`space-y-1 px-2 py-2`,children:[1,2,3].map(qi)}),e[0]=t):t=e[0],t}function qi(e){return(0,G.jsx)(`div`,{className:`animate-pulse h-7 bg-muted rounded-full`},e)}function Ji(){let e=(0,L.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsx)(`div`,{className:`animate-pulse h-4 bg-muted rounded mx-4 my-1`}),e[0]=t):t=e[0],t}var Yi=new Map;function Xi(e,t){let n=Yi.get(e);return n||(n={promise:t().catch(t=>{throw Yi.delete(e),t})},Yi.set(e,n)),n.promise}function Zi(e){Yi.delete(e)}function Qi(e){for(let t of Yi.keys())t.startsWith(e)&&Yi.delete(t)}function $i(e,t){return(0,U.use)(Xi(e,t))}var ea=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(`w-full caption-bottom`,I.body,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(`div`,{className:`relative w-full overflow-auto`,children:(0,G.jsx)(`table`,{ref:t,className:a,...i})}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ea.displayName=`Table`;var ta=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(`[&_tr]:border-b`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(`thead`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ta.displayName=`TableHeader`;var na=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(`[&_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,G.jsx)(`tbody`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});na.displayName=`TableBody`;var ra=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(`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,G.jsx)(`tfoot`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ra.displayName=`TableFooter`;var ia=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(`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,G.jsx)(`tr`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ia.displayName=`TableRow`;var Q=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(`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,G.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,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(`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,G.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 aa=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(I.caption,`mt-4`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(`caption`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});aa.displayName=`TableCaption`;var oa=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(`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,G.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});oa.displayName=`Card`;var sa=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(`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,G.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});sa.displayName=`CardHeader`;var ca=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(I.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,G.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ca.displayName=`CardTitle`;var la=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(I.bodyMuted,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});la.displayName=`CardDescription`;var ua=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(`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,G.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ua.displayName=`CardContent`;var da=U.forwardRef((e,t)=>{let n=(0,L.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=h(`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,G.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});da.displayName=`CardFooter`;var fa=ge(`app.async-error-boundary.ui`),pa=class extends U.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){fa.error(`AsyncErrorBoundary caught an error`,{error:e,info: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,G.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,G.jsxs)(oa,{className:`max-w-md`,children:[(0,G.jsx)(sa,{children:(0,G.jsx)(ca,{className:`text-destructive`,children:this.props.fallbackTitle??`Something went wrong`})}),(0,G.jsxs)(ua,{className:`space-y-4`,children:[(0,G.jsx)(`p`,{className:I.body,children:e.message}),(0,G.jsx)(s,{variant:`outline`,onClick:this.handleRetry,children:`Retry`})]})]})}):this.props.children}},ma=t({ConversationHistoryView:()=>Ta,default:()=>Ta}),ha=pn(e=>(0,G.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,G.jsxs)(`div`,{className:`max-w-md text-center space-y-2`,children:[(0,G.jsx)(`h3`,{className:e.v0,children:`No history`}),(0,G.jsx)(`p`,{className:e.v1,children:`No conversation history found for this thread.`})]})}),{name:`ConversationHistoryContent_1`}),ga=pn(e=>(0,G.jsxs)(`slot`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between border-b py-3 px-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.v0,e.v1]}),(0,G.jsxs)(`div`,{className:e.v2,children:[e.v3,` of `,e.v4,` messages`]})]}),e.v5]}),{name:`ConversationHistoryContent_2`,portals:[`v0`,`v1`,`v3`,`v4`,`v5`]}),_a=function(e){let t=(0,L.c)(39),{scope:n,projects:i,loadVersion:a,currentPromptIndex:o,onPromptIndexChange:l}=e,u;t[0]!==a||t[1]!==n?(u=Ca(n,a),t[0]=a,t[1]=n,t[2]=u):u=t[2];let d;t[3]!==i||t[4]!==n?(d=()=>wa(n,i),t[3]=i,t[4]=n,t[5]=d):d=t[5];let f=$i(u,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,g;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(g=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]=g):g=t[7];let _=g,v;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(v=function(e){return{inputTokens:e.inputTokens??0,outputTokens:e.outputTokens??0}},t[8]=v):v=t[8];let y=v,b;t[9]!==o||t[10]!==f.messages||t[11]!==l?(b=function(){f.messages&&o<f.messages.length-1&&l(o+1)},t[9]=o,t[10]=f.messages,t[11]=l,t[12]=b):b=t[12];let x=b,S;t[13]!==o||t[14]!==l?(S=function(){o>0&&l(o-1)},t[13]=o,t[14]=l,t[15]=S):S=t[15];let w=S;if(!f.messages?.length){let e;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(ha,{v0:I.emptyStateTitle,v1:I.bodyMuted}),t[16]=e):e=t[16],e}let T=o===0,E;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,G.jsx)(c,{className:`h-4 w-4 mr-1`}),t[17]=E):E=t[17];let O;t[18]!==w||t[19]!==T?(O=(0,G.jsx)(s,{variant:`outline`,size:`sm`,onClick:w,disabled:T,children:E}),t[18]=w,t[19]=T,t[20]=O):O=t[20];let k=o>=f.messages.length-1,A;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,G.jsx)(C,{className:`h-4 w-4 ml-1`}),t[21]=A):A=t[21];let j;t[22]!==x||t[23]!==k?(j=(0,G.jsx)(s,{variant:`outline`,size:`sm`,onClick:x,disabled:k,children:A}),t[22]=x,t[23]=k,t[24]=j):j=t[24];let ne=o+1,ie=f.messages.length,M;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,G.jsx)(ta,{children:(0,G.jsxs)(ia,{children:[(0,G.jsx)(Q,{children:`Prompt`}),(0,G.jsx)(Q,{children:`Answer`}),(0,G.jsx)(Q,{className:`w-24`,children:`Model`}),(0,G.jsx)(Q,{className:`w-24 text-right`,children:`Duration`}),(0,G.jsx)(Q,{className:`w-20 text-right`,children:`Input Tokens`}),(0,G.jsx)(Q,{className:`w-20 text-right`,children:`Output Tokens`}),(0,G.jsx)(Q,{className:`w-32 text-right`,children:`Timestamp`})]})}),t[25]=M):M=t[25];let N;if(t[26]!==o||t[27]!==f.messages){let e;t[29]===o?e=t[30]:(e=(e,t)=>{let{inputTokens:n,outputTokens:i}=y(e);return(0,G.jsxs)(ia,{className:t===o?`bg-muted/50`:``,children:[(0,G.jsx)($,{className:`max-w-md`,children:(0,G.jsx)(`div`,{className:I.body,children:(0,G.jsx)(ba,{text:e.request.message})})}),(0,G.jsx)($,{className:`max-w-md`,children:e.response?(0,G.jsx)(`div`,{className:I.body,children:(0,G.jsx)(ba,{text:e.response.content})}):(0,G.jsx)(`span`,{className:h(I.bodyMuted,`italic`),children:`No response`})}),(0,G.jsx)($,{children:(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(te,{className:`h-3 w-3 text-muted-foreground`}),(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:e.request.model})]})}),(0,G.jsx)($,{className:h(I.caption,`text-right`),children:e.response?(0,G.jsx)(r,{children:(0,G.jsxs)(ee,{children:[(0,G.jsx)(D,{asChild:!0,children:(0,G.jsx)(`div`,{className:`cursor-help`,children:_(e.timestamp,e.response.completedAt).display})}),(0,G.jsx)(we,{children:(0,G.jsx)(`p`,{children:_(e.timestamp,e.response.completedAt).tooltip})})]})}):(0,G.jsx)(`span`,{className:`text-muted-foreground italic`,children:`-`})}),(0,G.jsx)($,{className:h(I.bodyMuted,`text-right`),children:n>0?n.toLocaleString():`-`}),(0,G.jsx)($,{className:h(I.bodyMuted,`text-right`),children:i>0?i.toLocaleString():`-`}),(0,G.jsx)($,{className:h(I.bodyMuted,`text-right`),children:m(e.timestamp)})]},e.id)},t[29]=o,t[30]=e),N=f.messages.map(e),t[26]=o,t[27]=f.messages,t[28]=N}else N=t[28];let P;t[31]===N?P=t[32]:(P=(0,G.jsx)(re,{className:`h-full`,children:(0,G.jsx)(`div`,{className:`py-4`,children:(0,G.jsxs)(ea,{children:[M,(0,G.jsx)(na,{children:N})]})})}),t[31]=N,t[32]=P);let F;return t[33]!==f.messages.length||t[34]!==O||t[35]!==j||t[36]!==ne||t[37]!==P?(F=(0,G.jsx)(ga,{v0:O,v1:j,v2:I.bodyMuted,v3:ne,v4:ie,v5:P}),t[33]=f.messages.length,t[34]=O,t[35]=j,t[36]=ne,t[37]=P,t[38]=F):F=t[38],F},va=ge(`app.conversation-history-view.ui`),ya=`__ALL_PROJECTS__`;function ba(e){let t=(0,L.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,G.jsx)(G.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,G.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,G.jsxs)(G.Fragment,{children:[a,o]}),t[6]=a,t[7]=s),s}function xa(e,t){let n=`${t} - `,r=e.title??e.threadId;return r.startsWith(n)?r.slice(n.length):r}async function Sa(e){let t=[],n=new Set,r=``;for(let i of e)try{let e=await pe(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){va.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 Ca(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 wa(e,t){if(e.type===`thread`)return await pe(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 Sa(n.threads);return{threadId:e.projectId,...r}}return{threadId:ya,...await Sa(t.flatMap(e=>e.threads))}}var Ta=(0,U.memo)(function({isOpen:e,onClose:t,initialFilter:n,projects:r,inline:i}){let[a,o]=(0,U.useState)(0),[c,l]=(0,U.useState)(``),[u,d]=(0,U.useState)(``),[f,p]=(0,U.useState)(!1),[m,h]=(0,U.useState)(!1),[g,_]=(0,U.useState)(0),[v,y]=(0,U.useState)(null),[b,x]=(0,U.useState)(null),S=(0,U.useMemo)(()=>u?{type:`thread`,threadId:u}:c===ya?{type:`all`}:c?{type:`project`,projectId:c}:null,[c,u]),C=S?Ca(S,g):null;(0,U.useEffect)(()=>{e&&n?n.type===`thread`?(d(n.id),l(``),o(0)):n.type===`project`&&(l(n.id),d(``),o(0)):e&&!n?(l(ya),d(``),o(0)):e||(d(``),l(``),o(0),x(null),y(null))},[e,n]);let ee=e=>{d(e),l(``),o(0),y(null),x(null)},w=e=>{l(e),d(``),o(0),y(null),x(null)},T=(0,U.useCallback)(()=>{if(u){let e=r.flatMap(e=>e.threads).find(e=>e.threadId===u),t=r.find(e=>e.threads.some(e=>e.threadId===u)),n=e?xa(e,t?.name??t?.projectId??``):u;return{options:{threadId:u},title:`Clear Thread History`,description:`Permanently delete all conversation history for "${n}"? This cannot be undone.`}}if(c&&c!==ya){let e=r.find(e=>e.projectId===c)?.name??c;return{options:{projectId:c},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,c,u]),te=(0,U.useCallback)(async()=>{let e=T();h(!0),x(null);try{await A(e.options),C&&Zi(C),y(C),o(0),p(!1)}catch(e){x(e instanceof Error?e.message:`Failed to clear conversation history`)}finally{h(!1)}},[T,C]);function E(){S&&Zi(Ca(S,g)),_(e=>e+1),y(null),x(null)}let D=T();if(!e)return null;let O=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Ii,{value:c,onValueChange:w,children:[(0,G.jsx)(Ri,{className:`w-48`,children:(0,G.jsx)(Li,{placeholder:`Select project`})}),(0,G.jsxs)(Vi,{children:[(0,G.jsx)(Ui,{value:ya,children:`All Projects`}),r.map(e=>(0,G.jsx)(Ui,{value:e.projectId,children:e.name??e.projectId},e.projectId))]})]}),(0,G.jsxs)(Ii,{value:u,onValueChange:ee,children:[(0,G.jsx)(Ri,{className:`w-48`,children:(0,G.jsx)(Li,{placeholder:`Select thread`})}),(0,G.jsx)(Vi,{children:r.flatMap(e=>e.threads.map(t=>(0,G.jsx)(Ui,{value:t.threadId,children:xa(t,e.name??e.projectId)},t.threadId)))})]}),(0,G.jsxs)(s,{variant:`outline`,size:`sm`,onClick:()=>p(!0),disabled:m,children:[(0,G.jsx)(N,{className:`h-4 w-4 mr-2`}),`Clear`]})]}),k=(0,G.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,G.jsx)(`div`,{className:i?void 0:`border-b px-6 py-4`,children:(0,G.jsx)(rr,{title:`History`,description:i?`View and browse conversation history across projects and threads.`:void 0,action:(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[O,i?null:(0,G.jsx)(s,{variant:`action`,size:`icon-sm`,onClick:t,children:(0,G.jsx)(he,{})})]})})}),(0,G.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:b?(0,G.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,G.jsxs)(oa,{className:`max-w-md`,children:[(0,G.jsx)(sa,{children:(0,G.jsx)(ca,{className:`text-destructive`,children:`Error`})}),(0,G.jsxs)(ua,{className:`space-y-4`,children:[(0,G.jsx)(`p`,{children:b}),(0,G.jsx)(s,{onClick:()=>x(null),children:`Dismiss`})]})]})}):v&&v===C?(0,G.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,G.jsxs)(`div`,{className:`max-w-md text-center space-y-2`,children:[(0,G.jsx)(`h3`,{className:I.emptyStateTitle,children:`No history`}),(0,G.jsx)(`p`,{className:I.bodyMuted,children:`No conversation history found for this thread.`})]})}):S?(0,G.jsx)(pa,{fallbackTitle:`Failed to load conversation history`,onRetry:E,children:(0,G.jsx)(U.Suspense,{fallback:(0,G.jsx)(Gi,{label:`Loading conversation history...`,size:`lg`}),children:(0,G.jsx)(_a,{scope:S,projects:r,loadVersion:g,currentPromptIndex:a,onPromptIndexChange:o},C??void 0)})}):(0,G.jsx)(Gi,{label:`Loading conversation history...`,size:`lg`})})]});return(0,G.jsxs)(G.Fragment,{children:[i?(0,G.jsx)(lr,{children:(0,G.jsx)(ir,{className:`max-w-none w-full h-full flex flex-col min-h-0`,children:k})}):(0,G.jsx)(`div`,{className:`fixed inset-0 z-50 bg-background`,children:k}),(0,G.jsx)(Kn,{open:f,onOpenChange:p,children:(0,G.jsxs)(Yn,{children:[(0,G.jsxs)(Xn,{children:[(0,G.jsx)(Qn,{children:D.title}),(0,G.jsx)($n,{children:D.description})]}),(0,G.jsxs)(Zn,{children:[(0,G.jsx)(tr,{disabled:m,children:`Cancel`}),(0,G.jsx)(er,{onClick:e=>{e.preventDefault(),te()},disabled:m,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:m?`Clearing...`:`Clear`})]})]})})]})});export{tr as A,sr as C,lr as D,ir as E,Qn as F,pn as I,$n as M,Zn as N,Kn as O,Xn as P,rr as S,ur as T,pr as _,$i as a,fr as b,Ji as c,Ii as d,Vi as f,Li as g,Ri as h,ua as i,Yn as j,er as k,Gi as l,Wi as m,pa as n,Zi as o,Ui as p,oa as r,Qi as s,ma as t,Ki as u,ar as v,dr as w,cr as x,or as y};