tarsk 0.5.43 → 0.5.44

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 (78) hide show
  1. package/dist/index.js +318 -144
  2. package/dist/public/assets/{account-view-xKotpUyx.js → account-view-CTizS7Yb.js} +1 -1
  3. package/dist/public/assets/{api-D6uLdHBQ.js → api-Cuj9iSVv.js} +1 -1
  4. package/dist/public/assets/{browser-tab-DxigYzoT.js → browser-tab-DSpOIu84.js} +1 -1
  5. package/dist/public/assets/commit-dialog-kTaKOsNO.js +1 -0
  6. package/dist/public/assets/{context-menu-rC7iWcty.js → context-menu-DRXV-Suu.js} +1 -1
  7. package/dist/public/assets/create-repo-dialog-gIZLk6LZ.js +1 -0
  8. package/dist/public/assets/dialogs-config-CxRnlUcQ.js +51 -0
  9. package/dist/public/assets/diff-view-B2OdJMRe.js +3 -0
  10. package/dist/public/assets/explorer-tab-view-fejcb7N1.js +2 -0
  11. package/dist/public/assets/{explorer-tree-BC4fBpxi.js → explorer-tree-C2kLAwI0.js} +1 -1
  12. package/dist/public/assets/{explorer-view-DIM08sdy.js → explorer-view-BmKKHyrH.js} +1 -1
  13. package/dist/public/assets/git-history-dialog-B2ABiCXZ.js +1 -0
  14. package/dist/public/assets/git-ops-button-Bxx_jyqR.js +2 -0
  15. package/dist/public/assets/history-view-DebwP9D7.js +9 -0
  16. package/dist/public/assets/{index-DKOXV50p.css → index-C2_gO3dh.css} +1 -1
  17. package/dist/public/assets/index-D9aY24hf.js +89 -0
  18. package/dist/public/assets/{mcp-server-card-Cy4RU2_Q.js → mcp-server-card-B6iwOybN.js} +1 -1
  19. package/dist/public/assets/merged-pr-dialog-CObeSEaB.js +1 -0
  20. package/dist/public/assets/{model-star-rating-BmkpdXfr.js → model-star-rating-BgdOyTTO.js} +1 -1
  21. package/dist/public/assets/onboarding-BN_K08ma.js +1 -0
  22. package/dist/public/assets/project-settings-view-BDvHOmF8.js +1 -0
  23. package/dist/public/assets/providers-list-view-DydWz8z3.js +1 -0
  24. package/dist/public/assets/pull-request-dialog-LJhZpT8C.js +1 -0
  25. package/dist/public/assets/pull-with-changes-dialog-BPIj9wIk.js +1 -0
  26. package/dist/public/assets/push-before-pr-dialog-DzBp93KT.js +1 -0
  27. package/dist/public/assets/{radio-group-CbatNaj1.js → radio-group-B9xMCZ1X.js} +1 -1
  28. package/dist/public/assets/react-vendor-CE5Dmjd0.js +16 -0
  29. package/dist/public/assets/settings-general-view-D_44BPVr.js +1 -0
  30. package/dist/public/assets/{settings-instructions-view-DMAjbi6E.js → settings-instructions-view-Y6EK67-G.js} +1 -1
  31. package/dist/public/assets/{settings-list-B8hiBkBz.js → settings-list-BZDwK9bE.js} +1 -1
  32. package/dist/public/assets/settings-mcp-servers-view-B8IqOOnN.js +5 -0
  33. package/dist/public/assets/{settings-models-skeleton-DPnYbg69.js → settings-models-skeleton-DAEnT4kC.js} +1 -1
  34. package/dist/public/assets/settings-models-view-CluPgRkw.js +1 -0
  35. package/dist/public/assets/{settings-rules-view-DBk7DzV2.js → settings-rules-view-CxHrCDwn.js} +3 -3
  36. package/dist/public/assets/settings-skills-view-BE9u6FvJ.js +2 -0
  37. package/dist/public/assets/settings-slash-commands-view-CVOZ3GH3.js +1 -0
  38. package/dist/public/assets/{settings-subagents-view-D98Nxoly.js → settings-subagents-view-mguSf6zE.js} +2 -2
  39. package/dist/public/assets/settings-system-prompt-view-0sXVxXh3.js +1 -0
  40. package/dist/public/assets/settings-view-BE8EW7s7.js +2 -0
  41. package/dist/public/assets/{skeleton-BHhGML7J.js → skeleton-CVhaOA8k.js} +1 -1
  42. package/dist/public/assets/{slug-utils-DyRUJ1NS.js → slug-utils-DGOwJkKI.js} +1 -1
  43. package/dist/public/assets/{terminal-panel-DTOx74_o.js → terminal-panel-PjkgqbY6.js} +1 -1
  44. package/dist/public/assets/{ui-components-Jc6oi6bz.js → ui-components-DaffuSG7.js} +1 -1
  45. package/dist/public/assets/{use-deferred-search-B7EdyRbt.js → use-deferred-search-b843Ztu9.js} +1 -1
  46. package/dist/public/assets/{utils-tgi5ym_d.js → utils-BIt9KCVx.js} +1 -1
  47. package/dist/public/assets/vosk-speech-CgILeNJR.js +2 -0
  48. package/dist/public/assets/{web-CUAWBWPy.js → web-BBGaE-6B.js} +1 -1
  49. package/dist/public/assets/{web-C3vJZ_3_.js → web-D6dBzWD1.js} +1 -1
  50. package/dist/public/index.html +8 -8
  51. package/package.json +1 -1
  52. package/dist/public/assets/commit-dialog-CLQM9ah3.js +0 -1
  53. package/dist/public/assets/create-repo-dialog-C6k5wZPW.js +0 -1
  54. package/dist/public/assets/dialogs-config-CjKh5Rl2.js +0 -51
  55. package/dist/public/assets/diff-view-DWDWI5nl.js +0 -3
  56. package/dist/public/assets/explorer-tab-view-B0kT8Hl6.js +0 -2
  57. package/dist/public/assets/git-history-dialog-CuxOTngT.js +0 -1
  58. package/dist/public/assets/git-ops-button-C04zFAnF.js +0 -2
  59. package/dist/public/assets/history-view-ar7GLZ-R.js +0 -9
  60. package/dist/public/assets/index--HY4BbcM.js +0 -90
  61. package/dist/public/assets/merged-pr-dialog-Bo07VouF.js +0 -1
  62. package/dist/public/assets/onboarding-ClZrOxX7.js +0 -1
  63. package/dist/public/assets/project-settings-view-Dm9pQAp_.js +0 -1
  64. package/dist/public/assets/providers-list-view-D5gHsjl_.js +0 -1
  65. package/dist/public/assets/pull-request-dialog-8AYlOUNX.js +0 -1
  66. package/dist/public/assets/pull-with-changes-dialog-CSa5OE-d.js +0 -1
  67. package/dist/public/assets/push-before-pr-dialog-D5W_xsqv.js +0 -1
  68. package/dist/public/assets/react-vendor-DwQYi7es.js +0 -16
  69. package/dist/public/assets/settings-general-view-BP5ULy9A.js +0 -1
  70. package/dist/public/assets/settings-mcp-servers-view-OimQz-Rd.js +0 -5
  71. package/dist/public/assets/settings-models-view-Fq3WtdKG.js +0 -1
  72. package/dist/public/assets/settings-skills-view-CmOw-WMM.js +0 -2
  73. package/dist/public/assets/settings-slash-commands-view-FsrF5FkK.js +0 -1
  74. package/dist/public/assets/settings-system-prompt-view-B6Hy9ZyK.js +0 -1
  75. package/dist/public/assets/settings-view-J-rjoRcU.js +0 -2
  76. package/dist/public/assets/whisper-wasm-CWcbC1MB.js +0 -2
  77. package/dist/public/wasm/libmain-CWYJvMY5.js +0 -3318
  78. package/dist/public/wasm/libmain-D9-QM3iM.mjs +0 -3301
@@ -0,0 +1,3 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{At as t,Co as n,Da as r,Fo as i,Fr as a,G as o,Gt as s,Ia as c,Ir as l,Ki as u,Lo as d,Lr as f,Ma as p,Nn as m,Nr as h,Oa as g,Pa as _,Po as v,Q as y,Qa as b,So as x,Za as S,_r as C,c as w,eo as T,ga as E,gr as D,hi as O,it as k,ji as A,jr as j,ot as M,pi as N,yr as P}from"./dialogs-config-CxRnlUcQ.js";import{w as F}from"./react-vendor-CE5Dmjd0.js";import{t as I}from"./monaco-CZnIWXyV.js";import{I as L,a as ee,l as R,n as z,o as te}from"./history-view-DebwP9D7.js";import{d as ne}from"./onboarding-BN_K08ma.js";import{n as re}from"./utils-BIt9KCVx.js";import{B as ie,H as ae,L as oe,R as se,b as ce,f as B,g as le,m as ue,p as de,s as fe,z as pe}from"./index-D9aY24hf.js";import{a as me,n as he,r as ge,t as _e}from"./context-menu-DRXV-Suu.js";var V=e(d(),1),H=i(),U=v();function ve(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:A.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 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)(w,{className:`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 flex-col h-full`,children:[d,f,p]}),t[16]=d,t[17]=f,t[18]=p,t[19]=m):m=t[19],m}function ye(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 O(O(A.compact,`status-badge font-mono font-semibold`),W[e]??`text-orange-500`)}function be(e){return G[e]??`M`}var q=L(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`]}),xe=L(e=>e.v0,{name:`DiffTree_1`,portals:[`v0`]}),J=L(e=>e.v0,{name:`DiffTree_2`,portals:[`v0`]}),Se=L(e=>e.v0,{name:`DiffTree_3`,portals:[`v0`]}),Ce=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(Te,0),t[0]=r,t[1]=c);let l=c,u;t[2]===r?u=t[3]:(u=r.reduce(De,0),t[2]=r,t[3]=u);let d=u,f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=O(A.compact,`text-muted-foreground`),t[4]=f):f=t[4];let p=r.length,m=r.length===1?``:`s`,h;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(h=O(A.compact,`text-green-500`),t[5]=h):h=t[5];let g;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(g=O(A.compact,`text-red-500`),t[6]=g):g=t[6];let _;t[7]!==r.length||t[8]!==m||t[9]!==l||t[10]!==d?(_=(0,U.jsx)(q,{v0:f,v1:p,v2:m,v3:h,v4:l,v5:g,v6:d}),t[7]=r.length,t[8]=m,t[9]=l,t[10]=d,t[11]=_):_=t[11];let v=_;if(i){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=O(A.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]!==v||t[16]!==n?(r=(0,U.jsx)(xe,{v0:(0,U.jsx)(ve,{title:`Review Changes`,subtitle:v,children:n})}),t[15]=v,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:O(A.compact,A.bodyMuted,`text-center`),children:`No changes to review`})}),t[18]=e):e=t[18];let n;return t[19]===v?n=t[20]:(n=(0,U.jsx)(J,{v0:(0,U.jsx)(ve,{title:`Review Changes`,subtitle:v,children:e})}),t[19]=v,t[20]=n),n}let y;t[21]!==r||t[22]!==o||t[23]!==s||t[24]!==a?(y=(e,t)=>{let{isOpen:n,toggle:i}=t,c=!!e.children,l=(0,U.jsxs)(ne,{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)(x,{className:O(`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform`,n&&`rotate-90`)}),n?(0,U.jsx)(b,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}):(0,U.jsx)(S,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}):(0,U.jsx)(T,{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:be(e.status)})]});return c?l:(0,U.jsxs)(_e,{children:[(0,U.jsx)(me,{asChild:!0,children:l}),(0,U.jsx)(he,{children:(0,U.jsxs)(ge,{onClick:()=>{e.fileIndex!==void 0&&s?.(r[e.fileIndex])},children:[(0,U.jsx)(E,{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]=y):y=t[25];let C;t[26]!==y||t[27]!==n?(C=(0,U.jsx)(`div`,{className:`flex-1 overflow-y-auto pt-3 pb-2 px-1`,children:(0,U.jsx)(oe,{nodes:n,defaultOpen:!0,resetKey:n,indent:16,childContainerClassName:`ml-4 border-l border-sidebar-border pl-2`,renderNode:y})}),t[26]=y,t[27]=n,t[28]=C):C=t[28];let w;return t[29]!==v||t[30]!==C?(w=(0,U.jsx)(Se,{v0:(0,U.jsx)(ve,{title:`Review Changes`,subtitle:v,children:C})}),t[29]=v,t[30]=C,t[31]=w):w=t[31],w};function Y(e){return e.type===`add`}function we(e,t){return e+t.changes.filter(Y).length}function Te(e,t){return e+t.hunks.reduce(we,0)}function Ee(e){return e.type===`delete`}function X(e,t){return e+t.changes.filter(Ee).length}function De(e,t){return e+t.hunks.reduce(X,0)}var Oe=L(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`]}),ke=function(e){let t=(0,H.c)(5),{threadId:n,filePath:r,version:i,label:a}=e,o=je(n,r,i),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=O(A.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)(Oe,{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 Ae(e,t,n){return`git-media:${e}:${t}:${n}`}function je(e,t,n){let r=(0,H.c)(13),i;r[0]!==t||r[1]!==e||r[2]!==n?(i=Ae(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=()=>M(e,t,n),r[4]=t,r[5]=e,r[6]=n,r[7]=a):a=r[7];let o=ee(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 Me(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)(R,{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)(ke,{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)(R,{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)(ke,{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)(R,{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)(ke,{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 Ne(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=O(`z-10 shrink-0`,r),t[0]=r,t[1]=i);let a;return t[2]===i?a=t[3]:(a=(0,U.jsx)(B,{withHandle:!0,className:i}),t[2]=i,t[3]=a),a}function Pe(e){let t=(0,H.c)(36),{open:n,lineNumber:r,lineContent:i,initialComment:o,isEditing:s,onSave:c,onDelete:u,onClose:d}=e,[p,m]=(0,V.useState)((o===void 0?``:o)??``),g;t[0]!==c||t[1]!==p?(g=()=>{p.trim()&&c(p.trim())},t[0]=c,t[1]=p,t[2]=g):g=t[2];let _=g,v;t[3]===_?v=t[4]:(v=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),_())},t[3]=_,t[4]=v);let y=v,b;t[5]===d?b=t[6]:(b=e=>{e||d()},t[5]=d,t[6]=b);let x;t[7]===r?x=t[8]:(x=(0,U.jsx)(l,{children:(0,U.jsxs)(f,{children:[`Comment on line `,r]})}),t[7]=r,t[8]=x);let S;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(S=O(A.compact,`font-mono rounded bg-muted px-3 py-2 text-muted-foreground overflow-x-auto whitespace-pre`),t[9]=S):S=t[9];let C=i||` `,w;t[10]===C?w=t[11]:(w=(0,U.jsx)(`div`,{className:S,children:C}),t[10]=C,t[11]=w);let T;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>m(e.target.value),t[12]=T):T=t[12];let E;t[13]!==y||t[14]!==p?(E=(0,U.jsx)(se,{autoFocus:!0,placeholder:`Add a comment... (Cmd+Enter to save)`,value:p,onChange:T,onKeyDown:y,rows:12,className:`resize-none text-base`}),t[13]=y,t[14]=p,t[15]=E):E=t[15];let D;t[16]!==s||t[17]!==u?(D=s&&u&&(0,U.jsx)(N,{variant:`destructive`,size:`sm`,onClick:u,className:`mr-auto`,children:`Delete`}),t[16]=s,t[17]=u,t[18]=D):D=t[18];let k;t[19]===p?k=t[20]:(k=p.trim(),t[19]=p,t[20]=k);let M=!k,P;t[21]!==_||t[22]!==M?(P=(0,U.jsx)(N,{size:`sm`,onClick:_,disabled:M,children:`Save`}),t[21]=_,t[22]=M,t[23]=P):P=t[23];let F;t[24]!==D||t[25]!==P?(F=(0,U.jsxs)(a,{className:`gap-2 sm:gap-0`,children:[D,P]}),t[24]=D,t[25]=P,t[26]=F):F=t[26];let I;t[27]!==E||t[28]!==F||t[29]!==x||t[30]!==w?(I=(0,U.jsxs)(h,{className:`max-w-2xl`,children:[x,w,E,F]}),t[27]=E,t[28]=F,t[29]=x,t[30]=w,t[31]=I):I=t[31];let L;return t[32]!==n||t[33]!==I||t[34]!==b?(L=(0,U.jsx)(j,{open:n,onOpenChange:b,children:I}),t[32]=n,t[33]=I,t[34]=b,t[35]=L):L=t[35],L}var Fe=L(e=>e.v0,{name:`ReviewLoadingFallback_1`,portals:[`v0`]}),Z=L(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`]}),Ie=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)(Fe,{v0:(0,U.jsx)(R,{label:`Loading review changes...`})}),t[2]=e):e=t[2],e}let s;return t[3]===n?s=t[4]:(s=(0,U.jsx)(Z,{v0:A.bodyMuted,v1:(0,U.jsx)(N,{variant:`outline`,onClick:n,children:`Retry`})}),t[3]=n,t[4]=s),s};function Le(e,t){return`git-diff:${e}:${t}`}function Re(){return Error(`Loading review changes timed out. Please try again.`)}async function ze(e,t=15e3){return Promise.race([k(e),new Promise((e,n)=>{window.setTimeout(()=>n(Re()),t)})])}function Be({threadId:e,onExit:i,loadVersion:a}){let l=ee(Le(e,a),()=>ze(e)),d=pe(),f=ie(e=>e.diffComments),h=ie(e=>e.projectModelSelections),{resolvedTheme:v}=re(),b=ce(),[S,w]=(0,V.useState)(l.files||[]),[T,E]=(0,V.useState)(null),[j,M]=(0,V.useState)(0),[L,R]=(0,V.useState)(!1),[z,te]=(0,V.useState)(!1),[ne,oe]=(0,V.useState)(!1),[se,B]=(0,V.useState)(!0),me=(0,V.useRef)(null);(0,V.useEffect)(()=>{B(!0)},[e]);let he=(0,V.useCallback)(e=>{M(e),b&&B(!1)},[b]),ge=(0,V.useCallback)(()=>{B(!0)},[]),_e=b&&!se,H=b&&se,ve=b&&!se,W=(0,V.useMemo)(()=>f[e]??[],[f,e]),G=(0,V.useCallback)(t=>{let n=f[e]??[],r=typeof t==`function`?t(n):t;d({type:ae.SetDiffComments,threadId:e,comments:r})},[d,e,f]),[K,be]=(0,V.useState)(null),[q,xe]=(0,V.useState)(null),[J,Se]=(0,V.useState)(null),Y=(0,V.useRef)(null),we=(0,V.useRef)(W),Te=(0,V.useRef)(K),Ee=(0,V.useRef)({isFullView:L,selectedFileIndex:j,files:S}),X=(0,V.useRef)({original:[],modified:[]}),De=(0,V.useRef)(!0);(0,V.useEffect)(()=>{we.current=W},[W]),(0,V.useEffect)(()=>{Te.current=K},[K]),(0,V.useEffect)(()=>{Ee.current={isFullView:L,selectedFileIndex:j,files:S}},[L,j,S]);let Oe=(0,V.useCallback)(()=>{me.current&&(z?me.current.expand():me.current.collapse())},[z]),ke=(0,V.useCallback)(async()=>{if(e){E(null);try{w((await k(e)).files||[]),M(0)}catch(e){E(e instanceof Error?e.message:`Failed to load diff`)}}},[e]),Ae=(0,V.useCallback)(async t=>{try{await s(e,t.path),await ke()}catch(e){E(e instanceof Error?e.message:`Failed to revert file`)}},[e,ke]),je=(0,V.useRef)(!1);(0,V.useEffect)(()=>{if((f[e]??[]).length>0){je.current=!0;return}t(e).then(t=>{t.diffComments&&t.diffComments.length>0&&d({type:ae.SetDiffComments,threadId:e,comments:t.diffComments}),je.current=!0}).catch(()=>{je.current=!0})},[e]),(0,V.useEffect)(()=>{je.current&&m(e,{diffComments:W}).catch(()=>{})},[e,W]);let Fe=(0,V.useMemo)(()=>ye(S),[S]),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}},Ie=(e,t,n)=>e.split(`
2
+ `).slice(t-1,n).join(`
3
+ `),Re=e=>{let t=Z(e);return t?t.startLine<=1:!0},Be=e=>({ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,md:`markdown`,css:`css`,scss:`scss`,html:`html`,py:`python`,rb:`ruby`,go:`go`,rs:`rust`,java:`java`,kt:`kotlin`,swift:`swift`,c:`c`,cpp:`cpp`,h:`c`,hpp:`cpp`,sh:`shell`,yaml:`yaml`,yml:`yaml`,xml:`xml`,sql:`sql`})[e.split(`.`).pop()??``]||`plaintext`,Q=S[j],Ve=Q?.isBinary??!1,He=Q?L?Q.oldContent:(()=>{let e=Z(Q);return e?Ie(Q.oldContent,e.startLine,e.endLine):Q.oldContent})():``,Ue=Q?L?Q.newContent:(()=>{let e=Z(Q);return e?Ie(Q.newContent,e.startLine,e.endLine):Q.newContent})():``,$=(0,V.useCallback)(()=>{if(!De.current)return;let e=Y.current;if(!e)return;let{isFullView:t,selectedFileIndex:n,files:r}=Ee.current,i=we.current,a=Te.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:I.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:I.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,j,L,Q]),(0,V.useEffect)(()=>()=>{Y.current=null,X.current={original:[],modified:[]}},[j]),(0,V.useEffect)(()=>()=>{De.current=!1,Y.current&&=(Y.current.getOriginalEditor().getModel()?.dispose(),Y.current.getModifiedEditor().getModel()?.dispose(),Y.current.dispose(),null),X.current={original:[],modified:[]}},[]);let We=(0,V.useCallback)(e=>{Y.current=e;let t=e=>e===I.MouseTargetType.GUTTER_GLYPH_MARGIN||e===I.MouseTargetType.GUTTER_LINE_NUMBERS||e===I.MouseTargetType.GUTTER_LINE_DECORATIONS||e===I.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}=Ee.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=we.current.find(e=>e.fileIndex===o&&e.lineNumber===u&&e.side===n);f?Se(f):xe({lineNumber:u,lineContent:d,side:n})})};n(e.getOriginalEditor(),`original`),n(e.getModifiedEditor(),`modified`),setTimeout(()=>{Y.current===e&&$()},150)},[$]),Ge=(0,V.useCallback)(e=>{if(q&&Q){let t={id:`comment-${Date.now()}`,filePath:Q.path,fileIndex:j,lineNumber:q.lineNumber,lineContent:q.lineContent,comment:e,side:q.side};G(e=>[...e,t]),xe(null)}else J&&(G(t=>t.map(t=>t.id===J.id?{...t,comment:e}:t)),Se(null))},[q,J,Q,j,G]),Ke=(0,V.useCallback)(()=>{J&&(G(e=>e.filter(e=>e.id!==J.id)),Se(null))},[J,G]),qe=(0,V.useCallback)(e=>{if(W.length===0)return;let t=(e%W.length+W.length)%W.length,n=W[t];be(t),M(n.fileIndex),b&&B(!1),setTimeout(()=>{let e=Y.current;if(!e)return;let t=S[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,S,L,$,b]),Je=(0,V.useCallback)(()=>{qe((K??0)-1)},[qe,K]),Ye=(0,V.useCallback)(()=>{qe((K??-1)+1)},[qe,K]),Xe=(0,V.useCallback)(async()=>{let t=h[e];if(!t)try{let e=await y(),n=Object.values(e).flat();if(n.length>0)t=n[0];else{console.error(`No models available to process comments`);return}}catch(e){console.error(`Failed to load models:`,e);return}let n=t.id,r=t.provider;try{let{prompt:t}=await o(e,W);G([]),d({type:ae.SetPendingChatMessage,message:{threadId:e,message:t,model:n,provider:r}}),i()}catch(e){console.error(`Failed to fix comments:`,e),typeof window<`u`&&window.alert(`Failed to process comments. Please try again.`)}},[W,h,d,e,i,G]),Ze={readOnly:!0,renderSideBySide:!b,ignoreTrimWhitespace:!1,renderOverviewRuler:!0,scrollBeyondLastLine:!1,minimap:{enabled:!1},folding:!1,glyphMargin:!0,lineNumbers:Q&&(L||Re(Q))?`on`:`off`,diffWordWrap:`on`,originalEditable:!1,automaticLayout:!0};return(0,U.jsxs)(`div`,{className:`diff-view-root flex h-full flex-col`,children:[(0,U.jsx)(`div`,{className:`diff-body flex flex-1 overflow-hidden`,children:(0,U.jsxs)(ue,{direction:`horizontal`,children:[(0,U.jsx)(de,{ref:me,defaultSize:b?100:25,minSize:b?50:12,maxSize:b?100:40,collapsible:!0,collapsedSize:0,onCollapse:()=>te(!0),onExpand:()=>te(!1),className:O(`border-r border-transparent`,_e&&`hidden`),children:(0,U.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,U.jsx)(Ce,{treeData:Fe,files:S,error:T,selectedFileIndex:j,onFileSelect:he,onRevertFile:Ae})})}),!b&&(0,U.jsx)(Ne,{isOpen:!z}),(0,U.jsx)(de,{className:O(`overflow-hidden border-l border-border bg-transparent`,H&&`hidden`),children:(0,U.jsxs)(`div`,{className:`diff-editor-panel flex h-full bg-transparent flex-col overflow-hidden`,children:[(0,U.jsxs)(fe,{className:O(`bg-transparent`,z&&`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:[ve?(0,U.jsxs)(N,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground shrink-0`,onClick:ge,children:[(0,U.jsx)(r,{className:`h-4 w-4`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Show file tree`})]}):(0,U.jsxs)(N,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground shrink-0`,onClick:Oe,children:[z?(0,U.jsx)(r,{className:`h-4 w-4`}):(0,U.jsx)(g,{className:`h-4 w-4`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Toggle file tree`})]}),(0,U.jsx)(`span`,{className:O(A.label,`text-foreground`),children:Q?Q.path:`Review Changes`})]}),(0,U.jsxs)(`div`,{className:O(`flex items-center gap-2`,z&&`ml-0`,!z&&`ml-auto`,`md:ml-auto`),children:[!Ve&&(0,U.jsx)(N,{variant:`ghost`,size:`sm`,onClick:()=>R(e=>!e),disabled:!Q,className:O(A.compact,`h-8 gap-1 px-2`),children:L?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(p,{className:`h-3 w-3`}),` Show changes only`]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(c,{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)(D,{children:[(0,U.jsx)(P,{asChild:!0,children:(0,U.jsx)(N,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:Je,disabled:(K??0)===0,children:(0,U.jsx)(n,{className:`h-3 w-3`})})}),(0,U.jsx)(C,{children:`Previous comment`})]}),(0,U.jsx)(`span`,{className:O(A.caption,`whitespace-nowrap`),children:W.length===1?`1 Comment`:`Comment ${(K??0)+1} of ${W.length}`}),(0,U.jsxs)(D,{children:[(0,U.jsx)(P,{asChild:!0,children:(0,U.jsx)(N,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:Ye,disabled:(K??0)===W.length-1,children:(0,U.jsx)(x,{className:`h-3 w-3`})})}),(0,U.jsx)(C,{children:`Next comment`})]})]}),W.length>0&&(0,U.jsxs)(D,{children:[(0,U.jsx)(P,{asChild:!0,children:(0,U.jsxs)(N,{size:`sm`,onClick:Xe,className:O(A.compact,`h-8 gap-1 px-3 bg-foreground text-background hover:bg-foreground/90`),children:[(0,U.jsx)(_,{className:`h-3 w-3`}),`Fix all comments`]})}),(0,U.jsx)(C,{children:`Send all comments to Tarsk for resolution`})]})]})]}),(0,U.jsxs)(`div`,{className:`flex-1 bg-transparent relative`,children:[Ve&&Q?(0,U.jsx)(Me,{threadId:e,file:Q}):(0,U.jsx)(F,{height:`100%`,language:Be(Q?.path||``),original:He,modified:Ue,theme:v===`dark`?`vs-dark`:`vs-light`,onMount:We,options:Ze},`diff-${j}`),(0,U.jsxs)(`div`,{className:`pointer-events-none absolute bottom-4 right-4 z-20 flex flex-col items-end gap-3`,children:[ne&&(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)(N,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>oe(!1),children:[(0,U.jsx)(u,{className:`h-4 w-4`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Close chat`})]})}),(0,U.jsx)(le,{})]}),!ne&&(0,U.jsxs)(D,{children:[(0,U.jsx)(P,{asChild:!0,children:(0,U.jsxs)(N,{size:`icon`,className:`pointer-events-auto h-12 w-12 rounded-full shadow-lg`,onClick:()=>oe(!0),children:[(0,U.jsx)(_,{className:`h-5 w-5`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Open review chat`})]})}),(0,U.jsx)(C,{children:`Chat about this diff`})]})]})]})]})})]})}),(0,U.jsx)(Pe,{open:q!==null||J!==null,lineNumber:J?.lineNumber??q?.lineNumber??0,lineContent:J?.lineContent??q?.lineContent??``,initialComment:J?.comment,isEditing:J!==null,onSave:Ge,onDelete:Ke,onClose:()=>{xe(null),Se(null)}},`${J?.id??``}-${q?.lineNumber??``}-${q?.side??``}`)]})}function Q(e){let t=(0,H.c)(22),[n,r]=(0,V.useState)(0),[i,a]=(0,V.useState)(0),o=(0,V.useRef)(0),s;t[0]===e.threadId?s=t[1]:(s=()=>{r(t=>(te(Le(e.threadId,t)),t+1)),a(He)},t[0]=e.threadId,t[1]=s);let c=s,l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{a(0),r(0),o.current=0},t[2]=l):l=t[2];let u;t[3]===e.threadId?u=t[4]:(u=[e.threadId],t[3]=e.threadId,t[4]=u),(0,V.useEffect)(l,u);let d,f;t[5]!==e.refreshTrigger||t[6]!==e.threadId?(d=()=>{!e.refreshTrigger||e.refreshTrigger<=o.current||(o.current=e.refreshTrigger,r(t=>(te(Le(e.threadId,t)),t+1)),a(Ve))},f=[e.refreshTrigger,e.threadId],t[5]=e.refreshTrigger,t[6]=e.threadId,t[7]=d,t[8]=f):(d=t[7],f=t[8]),(0,V.useEffect)(d,f);let p=`${e.threadId}:${i}`,m;t[9]===c?m=t[10]:(m=(0,U.jsx)(Ie,{onRetry:c}),t[9]=c,t[10]=m);let h=`${e.threadId}:${n}`,g;t[11]!==n||t[12]!==e||t[13]!==h?(g=(0,U.jsx)(Be,{...e,loadVersion:n},h),t[11]=n,t[12]=e,t[13]=h,t[14]=g):g=t[14];let _;t[15]!==m||t[16]!==g?(_=(0,U.jsx)(V.Suspense,{fallback:m,children:g}),t[15]=m,t[16]=g,t[17]=_):_=t[17];let v;return t[18]!==c||t[19]!==p||t[20]!==_?(v=(0,U.jsx)(z,{fallbackTitle:`Failed to load review changes`,onRetry:c,children:_},p),t[18]=c,t[19]=p,t[20]=_,t[21]=v):v=t[21],v}function Ve(e){return e+1}function He(e){return e+1}export{Q as DiffView,Q as default};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/explorer-tree-C2kLAwI0.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-D9aY24hf.js","assets/monaco-CZnIWXyV.js","assets/monaco-Br_kD0ds.css","assets/history-view-DebwP9D7.js","assets/dialogs-config-CxRnlUcQ.js","assets/onboarding-BN_K08ma.js","assets/vosk-speech-CgILeNJR.js","assets/react-vendor-CE5Dmjd0.js","assets/utils-BIt9KCVx.js","assets/index-C2_gO3dh.css","assets/api-Cuj9iSVv.js","assets/context-menu-DRXV-Suu.js","assets/ui-components-DaffuSG7.js","assets/explorer-view-BmKKHyrH.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Fo as t,Lo as n,Po as r,c as ee,hi as i,ji as a}from"./dialogs-config-CxRnlUcQ.js";import{r as o}from"./monaco-CZnIWXyV.js";import{l as te,u as s}from"./history-view-DebwP9D7.js";import{B as c,M as l,b as u,f as d,m as f,p}from"./index-D9aY24hf.js";var ne=t(),m=e(n(),1),h=r(),g=(0,m.lazy)(()=>o(()=>import(`./explorer-tree-C2kLAwI0.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]))),_=(0,m.lazy)(()=>o(()=>import(`./explorer-view-BmKKHyrH.js`),__vite__mapDeps([15,1,2,3,4,5,6,7,8,9,10,11,12])));function v(){let e=(0,ne.c)(47),t=c(y),n=u(),[r,o]=(0,m.useState)(null),[v,b]=(0,m.useState)(!0),{pendingExplorerPath:x,setPendingExplorerPath:S,explorerClearPath:C,setExplorerClearPath:w}=l(),T;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>{b(!0)},e[0]=T):T=e[0];let E;e[1]===t?E=e[2]:(E=[t],e[1]=t,e[2]=E),(0,m.useEffect)(T,E);let D;e[3]===n?D=e[4]:(D=e=>{o(e),n&&b(!1)},e[3]=n,e[4]=D);let O=D,k;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>{b(!0)},e[5]=k):k=e[5];let A=k,j;e[6]===n?j=e[7]:(j=e=>{o(e),n&&b(!1)},e[6]=n,e[7]=j);let M=j,N,P;e[8]!==n||e[9]!==x||e[10]!==S?(N=()=>{x&&(o({name:x.split(`/`).pop()??x,path:x,type:`file`}),n&&b(!1),S(null))},P=[n,x,S],e[8]=n,e[9]=x,e[10]=S,e[11]=N,e[12]=P):(N=e[11],P=e[12]),(0,m.useEffect)(N,P);let F,I;e[13]!==C||e[14]!==n||e[15]!==r||e[16]!==w?(F=()=>{C&&(r&&(r.path===C||r.path.startsWith(C+`/`))&&(o(null),n&&b(!0)),w(null))},I=[C,n,r,w],e[13]=C,e[14]=n,e[15]=r,e[16]=w,e[17]=F,e[18]=I):(F=e[17],I=e[18]),(0,m.useEffect)(F,I);let L=n&&!v,R=n&&v,z=n?100:25,B=n?50:15,V=n?100:50,H=L&&`hidden`,U;e[19]===H?U=e[20]:(U=i(`overflow-hidden border-r border-border`,H),e[19]=H,e[20]=U);let W;e[21]!==O||e[22]!==r?.path||e[23]!==t?(W=(0,h.jsx)(ee,{className:`h-full`,children:t?(0,h.jsx)(m.Suspense,{fallback:(0,h.jsx)(s,{}),children:(0,h.jsx)(g,{threadId:t,selectedPath:r?.path??null,onNodeSelect:O})}):(0,h.jsx)(`p`,{className:i(a.caption,`px-3 py-4 text-center`),children:`No thread selected.`})}),e[21]=O,e[22]=r?.path,e[23]=t,e[24]=W):W=e[24];let G;e[25]!==B||e[26]!==V||e[27]!==U||e[28]!==W||e[29]!==z?(G=(0,h.jsx)(p,{defaultSize:z,minSize:B,maxSize:V,className:U,children:W}),e[25]=B,e[26]=V,e[27]=U,e[28]=W,e[29]=z,e[30]=G):G=e[30];let K;e[31]===n?K=e[32]:(K=!n&&(0,h.jsx)(d,{withHandle:!0}),e[31]=n,e[32]=K);let q=R&&`hidden`,J;e[33]===q?J=e[34]:(J=i(`overflow-hidden`,q),e[33]=q,e[34]=J);let Y;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,h.jsx)(te,{}),e[35]=Y):Y=e[35];let X=n&&!v,Z;e[36]!==M||e[37]!==r||e[38]!==X?(Z=(0,h.jsx)(m.Suspense,{fallback:Y,children:(0,h.jsx)(_,{selectedFile:r,showTreeBackButton:X,onShowTree:A,onFileCreated:M})}),e[36]=M,e[37]=r,e[38]=X,e[39]=Z):Z=e[39];let Q;e[40]!==J||e[41]!==Z?(Q=(0,h.jsx)(p,{className:J,children:Z}),e[40]=J,e[41]=Z,e[42]=Q):Q=e[42];let $;return e[43]!==G||e[44]!==K||e[45]!==Q?($=(0,h.jsx)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:(0,h.jsxs)(f,{direction:`horizontal`,className:`flex-1 overflow-hidden`,children:[G,K,Q]})}),e[43]=G,e[44]=K,e[45]=Q,e[46]=$):$=e[46],$}function y(e){return e.selectedThreadId}export{v as default};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$a as t,Ar as n,Co as r,Fo as i,Hi as a,Lo as o,Qa as s,To as c,hi as l,ji as u,pa as d,to as f}from"./dialogs-config-CjKh5Rl2.js";import{d as p}from"./onboarding-ClZrOxX7.js";import{A as m,I as h,M as g,N as _,a as v,c as y,j as b,k as x,n as S,o as C,u as w}from"./history-view-ar7GLZ-R.js";import{A as T,I as E,M as D,O,k}from"./index--HY4BbcM.js";import{a as A,i as j,n as M,r as N,t as P}from"./context-menu-rC7iWcty.js";import{c as F,n as I,o as L,r as R,s as z,t as B}from"./api-D6uLdHBQ.js";import{t as V}from"./ui-components-Jc6oi6bz.js";var H=i(),U=e(o(),1),W=a(),G=U.forwardRef((e,t)=>{let n=(0,H.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=l(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(V,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});G.displayName=V.displayName;var K=U.forwardRef((e,t)=>{let n=(0,H.c)(10),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,W.jsx)(d,{className:`mr-2 h-4 w-4 shrink-0 opacity-50`}),n[3]=a):a=n[3];let o;n[4]===r?o=n[5]:(o=l(`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]=o);let s;return n[6]!==i||n[7]!==t||n[8]!==o?(s=(0,W.jsxs)(`div`,{className:`flex items-center border-b px-3`,"cmdk-input-wrapper":``,children:[a,(0,W.jsx)(V.Input,{ref:t,className:o,...i})]}),n[6]=i,n[7]=t,n[8]=o,n[9]=s):s=n[9],s});K.displayName=V.Input.displayName;var q=U.forwardRef((e,t)=>{let n=(0,H.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=l(`max-h-[300px] overflow-y-auto overflow-x-hidden`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(V.List,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});q.displayName=V.List.displayName;var J=U.forwardRef((e,t)=>{let n=(0,H.c)(4),r;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=l(u.bodyMuted,`py-6 text-center`),n[0]=r):r=n[0];let i;return n[1]!==e||n[2]!==t?(i=(0,W.jsx)(V.Empty,{ref:t,className:r,...e}),n[1]=e,n[2]=t,n[3]=i):i=n[3],i});J.displayName=V.Empty.displayName;var Y=U.forwardRef((e,t)=>{let n=(0,H.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=l(`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]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(V.Group,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Y.displayName=V.Group.displayName;var ee=U.forwardRef((e,t)=>{let n=(0,H.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=l(`-mx-1 h-px bg-border`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(V.Separator,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ee.displayName=V.Separator.displayName;var te=U.forwardRef((e,t)=>{let n=(0,H.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=l(l(u.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]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(V.Item,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});te.displayName=V.Item.displayName;var X=e=>{let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=l(u.compact,`ml-auto tracking-widest text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,W.jsx)(`span`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};X.displayName=`CommandShortcut`;var ne=100,Z=500;function re(e){return e.trim().toLowerCase().split(/\s+/).filter(Boolean)}function ie(e,t){return t.length===0?!0:t.every(t=>e.haystack.includes(t))}function ae(e,t,n){if(t.length===0)return[];let r=[];for(let n of e)if(ie(n,t)&&(r.push(n.node),r.length>=Z))break;return r.sort((e,t)=>Q(e,t,n)).slice(0,ne)}function Q(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 oe(e){let t=(0,H.c)(38),{items:r,isReady:i,onRequestIndex:a,onOpenChange:o,onSelect:c}=e,d=i===void 0?!1:i,p=(0,U.useRef)(null),m=(0,U.useRef)(!1),h=(0,U.useRef)(!1),[g,_]=(0,U.useState)(!1),[v,y]=(0,U.useState)(``),b=(0,U.useDeferredValue)(v),x;t[0]===a?x=t[1]:(x=function(){h.current||(h.current=!0,a())},t[0]=a,t[1]=x);let S=x,C;t[2]!==b||t[3]!==r?(C=ae(r,re(b),b),t[2]=b,t[3]=r,t[4]=C):C=t[4];let w=C,E,D;t[5]!==o||t[6]!==v?(E=()=>{let e=v.trim().length>0;_(e),m.current!==e&&(m.current=e,o(e))},D=[o,v],t[5]=o,t[6]=v,t[7]=E,t[8]=D):(E=t[7],D=t[8]),(0,U.useEffect)(E,D);let A;t[9]===o?A=t[10]:(A=function(e){e||y(``),_(e),o(e),e&&requestAnimationFrame(()=>p.current?.focus())},t[9]=o,t[10]=A);let j=A,M;t[11]!==o||t[12]!==c?(M=function(e){c(e),_(!1),o(!1),y(``)},t[11]=o,t[12]=c,t[13]=M):M=t[13];let N=M,P;t[14]===S?P=t[15]:(P=e=>{S(),y(e.target.value)},t[14]=S,t[15]=P);let F;t[16]!==v||t[17]!==S||t[18]!==P?(F=(0,W.jsx)(T,{asChild:!0,children:(0,W.jsx)(`div`,{children:(0,W.jsx)(n,{ref:p,value:v,onPointerDown:S,onChange:P,placeholder:`Search files and folders`,className:`pr-[4px]`})})}),t[16]=v,t[17]=S,t[18]=P,t[19]=F):F=t[19];let I;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(I=l(u.compact,`py-4`),t[20]=I):I=t[20];let L=d?`No matches found.`:`Indexing files and folders...`,R;t[21]===L?R=t[22]:(R=(0,W.jsx)(J,{className:I,children:L}),t[21]=L,t[22]=R);let z;if(t[23]!==N||t[24]!==w){let e;t[26]===N?e=t[27]:(e=e=>(0,W.jsxs)(te,{value:e.path,onSelect:()=>N(e),className:e.ignored?`opacity-50`:void 0,children:[e.type===`folder`?(0,W.jsx)(s,{className:`h-4 w-4 text-muted-foreground`}):(0,W.jsx)(f,{className:`h-4 w-4 text-muted-foreground`}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`div`,{className:`truncate`,children:e.name}),(0,W.jsx)(`div`,{className:l(u.compact,`truncate text-muted-foreground`),children:e.path})]})]},e.path),t[26]=N,t[27]=e),z=w.map(e),t[23]=N,t[24]=w,t[25]=z}else z=t[25];let B;t[28]===z?B=t[29]:(B=(0,W.jsx)(Y,{children:z}),t[28]=z,t[29]=B);let V;t[30]!==R||t[31]!==B?(V=(0,W.jsx)(k,{align:`start`,side:`bottom`,sideOffset:4,onOpenAutoFocus:se,className:`w-[var(--radix-popover-trigger-width)] p-0`,children:(0,W.jsx)(G,{shouldFilter:!1,children:(0,W.jsxs)(q,{children:[R,B]})})}),t[30]=R,t[31]=B,t[32]=V):V=t[32];let K;return t[33]!==j||t[34]!==g||t[35]!==V||t[36]!==F?(K=(0,W.jsxs)(O,{open:g,onOpenChange:j,children:[F,V]}),t[33]=j,t[34]=g,t[35]=V,t[36]=F,t[37]=K):K=t[37],K}function se(e){return e.preventDefault()}function ce(e,t,n){return`explorer-dir:${e}:${t}:${n}`}function le(e){let t=(0,H.c)(12),{threadId:n,dirPath:r,version:i,children:a}=e,o;t[0]!==r||t[1]!==n||t[2]!==i?(o=ce(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=()=>L(n,r).then($),t[4]=r,t[5]=n,t[6]=s):s=t[6];let c=v(o,s),l;t[7]!==a||t[8]!==c?(l=a(c),t[7]=a,t[8]=c,t[9]=l):l=t[9];let u;return t[10]===l?u=t[11]:(u=(0,W.jsx)(W.Fragment,{children:l}),t[10]=l,t[11]=u),u}function $(e){return e.entries}function ue(e){let t=(0,H.c)(17),{defaultValue:n,onCommit:r,onCancel:i,level:a,basePadding:o,icon:s}=e,c=(0,U.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,U.useEffect)(l,u);let d;t[2]!==i||t[3]!==r?(d=function(e){if(e.key===`Enter`){let e=c.current?.value.trim()??``;e?r(e):i()}else e.key===`Escape`&&i()},t[2]=i,t[3]=r,t[4]=d):d=t[4];let f=d,m;t[5]!==i||t[6]!==r?(m=function(){let e=c.current?.value.trim()??``;e?r(e):i()},t[5]=i,t[6]=r,t[7]=m):m=t[7];let h=m,g;t[8]!==n||t[9]!==h||t[10]!==f?(g=(0,W.jsx)(`input`,{ref:c,defaultValue:n,onKeyDown:f,onBlur:h,className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`,onClick:de}),t[8]=n,t[9]=h,t[10]=f,t[11]=g):g=t[11];let _;return t[12]!==o||t[13]!==s||t[14]!==a||t[15]!==g?(_=(0,W.jsxs)(p,{level:a,basePadding:o,children:[s,g]}),t[12]=o,t[13]=s,t[14]=a,t[15]=g,t[16]=_):_=t[16],_}function de(e){return e.stopPropagation()}function fe(e){return e.map(e=>({node:e,haystack:`${e.name} ${e.path}`.toLowerCase()}))}var pe=(0,U.memo)(function e({node:n,level:i,threadId:a,selectedPath:o,expandedPaths:l,getDirVersion:u,renamingPath:d,newItemIn:m,onToggleFolder:h,onSelectNode:g,onStartRename:_,onCommitRename:v,onCancelRename:b,onDelete:x,onOpen:S,onNewFile:C,onNewFolder:w,onCommitNewItem:T,onCancelNewItem:E}){let D=l.has(n.path),O=d===n.path,k=m?.dirPath===n.path&&D;return n.type===`folder`?(0,W.jsxs)(P,{children:[(0,W.jsx)(A,{asChild:!0,children:(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(p,{level:i,basePadding:10,selected:o===n.path,className:n.ignored?`opacity-50`:void 0,onClick:e=>{e.stopPropagation(),h(n)},children:[(0,W.jsx)(`span`,{className:`text-muted-foreground w-3 flex-shrink-0`,children:D?(0,W.jsx)(c,{className:`h-3 w-3`}):(0,W.jsx)(r,{className:`h-3 w-3`})}),O?(0,W.jsxs)(W.Fragment,{children:[D?(0,W.jsx)(t,{className:`h-4 w-4 flex-shrink-0`}):(0,W.jsx)(s,{className:`h-4 w-4 flex-shrink-0`}),(0,W.jsx)(`input`,{autoFocus:!0,defaultValue:n.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?v(n,t):b()}else e.key===`Escape`&&b()},onBlur:e=>{let t=e.target.value.trim();t?v(n,t):b()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`})]}):(0,W.jsxs)(W.Fragment,{children:[D?(0,W.jsx)(t,{className:`h-4 w-4 flex-shrink-0`}):(0,W.jsx)(s,{className:`h-4 w-4 flex-shrink-0`}),(0,W.jsx)(`span`,{className:`flex-1 truncate`,children:n.name})]})]}),D&&(0,W.jsx)(`div`,{children:(0,W.jsx)(U.Suspense,{fallback:(0,W.jsx)(y,{}),children:(0,W.jsx)(le,{threadId:a,dirPath:n.path,version:u(n.path),children:t=>(0,W.jsxs)(W.Fragment,{children:[k&&(0,W.jsx)(ue,{defaultValue:``,level:i+1,basePadding:m.type===`folder`?10:22,icon:m.type===`folder`?(0,W.jsx)(s,{className:`h-4 w-4 flex-shrink-0`}):(0,W.jsx)(f,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:T,onCancel:E}),t.map(t=>(0,W.jsx)(e,{node:t,level:i+1,threadId:a,selectedPath:o,expandedPaths:l,getDirVersion:u,renamingPath:d,newItemIn:m,onToggleFolder:h,onSelectNode:g,onStartRename:_,onCommitRename:v,onCancelRename:b,onDelete:x,onOpen:S,onNewFile:C,onNewFolder:w,onCommitNewItem:T,onCancelNewItem:E},t.path))]})})})})]})}),(0,W.jsxs)(M,{children:[(0,W.jsx)(N,{onSelect:()=>S(n),children:`Open`}),(0,W.jsx)(j,{}),(0,W.jsx)(N,{onSelect:()=>C(n.path),children:`New File...`}),(0,W.jsx)(N,{onSelect:()=>w(n.path),children:`New Folder...`}),(0,W.jsx)(j,{}),(0,W.jsx)(N,{onSelect:()=>_(n),children:`Rename...`}),(0,W.jsx)(N,{onSelect:()=>x(n),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]}):(0,W.jsxs)(P,{children:[(0,W.jsx)(A,{asChild:!0,children:(0,W.jsxs)(p,{level:i,basePadding:22,selected:o===n.path,className:n.ignored?`opacity-50`:void 0,onClick:()=>g(n),children:[(0,W.jsx)(f,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),O?(0,W.jsx)(`input`,{autoFocus:!0,defaultValue:n.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?v(n,t):b()}else e.key===`Escape`&&b()},onBlur:e=>{let t=e.target.value.trim();t?v(n,t):b()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`}):(0,W.jsx)(`span`,{className:`flex-1 truncate`,children:n.name})]})}),(0,W.jsxs)(M,{children:[(0,W.jsx)(N,{onSelect:()=>S(n),children:`Open`}),(0,W.jsx)(j,{}),(0,W.jsx)(N,{onSelect:()=>_(n),children:`Rename...`}),(0,W.jsx)(N,{onSelect:()=>x(n),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]})}),me=new Map;function he({threadId:e,selectedPath:t,onNodeSelect:n}){let[r,i]=(0,U.useState)(()=>new Map([[``,0]])),[a,o]=(0,U.useState)(new Set),[c,l]=(0,U.useState)(null),[u,d]=(0,U.useState)(null),[p,v]=(0,U.useState)(null),[y,T]=(0,U.useState)(!1),[O,k]=(0,U.useState)([]),[j,V]=(0,U.useState)(!1),[H,G]=(0,U.useState)(!1),K=(0,U.useRef)(null),q=(0,U.useRef)(0),J=(0,U.useRef)(null),{explorerRefreshTick:Y,pendingExplorerPath:ee,setExplorerClearPath:te}=D(),X=(0,U.useMemo)(()=>`${e}:${Y}`,[Y,e]),ne=(0,U.useCallback)(e=>{(0,U.startTransition)(()=>{T(t=>t===e?t:e)})},[]),Z=(0,U.useCallback)(async()=>{if(!e)return;let t=me.get(X);if(t){k(t),V(!0);return}if(K.current!==X){K.current=X,k([]),V(!1);try{let t=fe((await L(e,``,!0)).entries);me.set(X,t),k(t),V(!0)}catch{k([]),V(!1)}finally{K.current===X&&(K.current=null)}}},[X,e]),re=(0,U.useCallback)(()=>{G(!0)},[]),ie=(0,U.useCallback)(()=>{me.delete(X),k([]),V(!1)},[X]),ae=(0,U.useCallback)(()=>{ie(),H&&Z()},[ie,Z,H]),Q=(0,U.useCallback)(e=>r.get(e)??0,[r]),se=(0,U.useCallback)(e=>{i(t=>{let n=new Map(t);return n.set(e,(t.get(e)??0)+1),n})},[]),$=(0,U.useCallback)(t=>{e&&(C(ce(e,t,Q(t))),se(t))},[se,Q,e]),de=(0,U.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);o(e=>{let t=new Set(e);for(let e of r)t.add(e);return t})},[e]);(0,U.useEffect)(()=>{if(!e)return;let t=J.current!==null&&J.current!==e;J.current=e,t&&(i(new Map([[``,0]])),o(new Set),l(null),d(null),q.current=Y)},[Y,e]),(0,U.useEffect)(()=>{!e||Y<=q.current||(q.current=Y,i(t=>{let n=new Set([``]);for(let e of a)n.add(e);let r=new Map(t);for(let i of n){let n=t.get(i)??0;C(ce(e,i,n)),r.set(i,n+1)}return r}))},[Y,a,e]),(0,U.useEffect)(()=>{k([]),V(!1),G(!1),K.current=null},[X]),(0,U.useEffect)(()=>{!H||!e||Z()},[Z,H,e]),(0,U.useEffect)(()=>{if(!ee||!e)return;let t=ee.split(`/`);t.pop();let n=[],r=``;for(let e of t)r=r?`${r}/${e}`:e,n.push(r);if(n.length!==0){o(e=>{let t=new Set(e);for(let e of n)t.add(e);return t});for(let e of n)i(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})}},[ee,e]);function he(e){a.has(e.path)?o(t=>{let n=new Set(t);return n.delete(e.path),n}):(o(t=>new Set(t).add(e.path)),i(t=>{if(t.has(e.path))return t;let n=new Map(t);return n.set(e.path,0),n}))}function ge(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(0,t):``}function _e(e){v(e)}async function ve(t){try{await z(e,t.path)}catch{E({title:`Error`,description:`Failed to open "${t.name}"`,variant:`destructive`})}}async function ye(){if(!p)return;let t=p;v(null);try{await R(e,t.path),te(t.path),$(ge(t.path)),ae(),o(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),i(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n})}catch{E({title:`Error`,description:`Failed to move "${t.name}" to trash`,variant:`destructive`})}}function be(e){d(null),l(e.path)}async function xe(t,n){if(n===t.name){l(null);return}l(null);try{await F(e,t.path,n),$(ge(t.path)),ae(),t.type===`folder`&&(o(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),i(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}))}catch{E({title:`Error`,description:`Failed to rename "${t.name}"`,variant:`destructive`})}}function Se(e){l(null),a.has(e)||(o(t=>new Set(t).add(e)),i(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})),d({dirPath:e,type:`file`})}function Ce(e){l(null),a.has(e)||(o(t=>new Set(t).add(e)),i(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})),d({dirPath:e,type:`folder`})}async function we(t){if(!u)return;let{dirPath:n,type:r}=u;d(null);try{r===`file`?await B(e,n,t):await I(e,n,t),$(n),ae()}catch{E({title:`Error`,description:`Failed to create ${r} "${t}"`,variant:`destructive`})}}function Te(){d(null)}function Ee(e){de(e),e.type===`file`&&n(e)}let De=u?.dirPath===``?(0,W.jsx)(ue,{defaultValue:``,level:0,basePadding:u.type===`folder`?10:22,icon:u.type===`folder`?(0,W.jsx)(s,{className:`h-4 w-4 flex-shrink-0`}):(0,W.jsx)(f,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:we,onCancel:Te}):null;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(x,{open:p!==null,onOpenChange:e=>!e&&v(null),children:(0,W.jsxs)(g,{children:[(0,W.jsx)(h,{children:`Move to Trash`}),(0,W.jsxs)(_,{children:[`Move “`,p?.name,`” to trash?`]}),(0,W.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[(0,W.jsx)(b,{children:`Cancel`}),(0,W.jsx)(m,{onClick:()=>void ye(),children:`Move to Trash`})]})]})}),(0,W.jsx)(`div`,{className:`border-b border-border bg-background px-2 py-2`,children:(0,W.jsx)(oe,{items:O,isReady:j,onRequestIndex:re,onOpenChange:ne,onSelect:e=>Ee(e)},X)}),(0,W.jsxs)(P,{children:[(0,W.jsx)(A,{asChild:!0,disabled:y,children:(0,W.jsx)(`div`,{className:`py-2 min-h-full`,children:(0,W.jsx)(S,{fallbackTitle:`Failed to load files`,onRetry:()=>$(``),children:(0,W.jsx)(U.Suspense,{fallback:(0,W.jsx)(w,{}),children:(0,W.jsx)(le,{threadId:e,dirPath:``,version:Q(``),children:r=>(0,W.jsxs)(W.Fragment,{children:[De,r.map(r=>(0,W.jsx)(pe,{node:r,level:0,threadId:e,selectedPath:t,expandedPaths:a,getDirVersion:Q,renamingPath:c,newItemIn:u,onToggleFolder:he,onSelectNode:n,onStartRename:be,onCommitRename:xe,onCancelRename:()=>l(null),onDelete:_e,onOpen:ve,onNewFile:Se,onNewFolder:Ce,onCommitNewItem:we,onCancelNewItem:Te},r.path))]})})})})})}),(0,W.jsxs)(M,{children:[(0,W.jsx)(N,{onSelect:()=>Se(``),children:`New File...`}),(0,W.jsx)(N,{onSelect:()=>Ce(``),children:`New Folder...`})]})]})]})}export{he as default};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ar as t,Fo as n,Lo as r,Po as i,Qa as a,So as o,Za as s,eo as c,fa as l,hi as u,ji as d,wo as f}from"./dialogs-config-CxRnlUcQ.js";import{A as p,F as m,M as h,O as g,a as _,c as v,j as y,k as b,n as x,o as S,u as C}from"./history-view-DebwP9D7.js";import{d as w}from"./onboarding-BN_K08ma.js";import{A as T,I as E,M as D,O,k}from"./index-D9aY24hf.js";import{a as A,i as j,n as M,r as N,t as P}from"./context-menu-DRXV-Suu.js";import{c as F,n as I,o as L,r as R,s as z,t as B}from"./api-Cuj9iSVv.js";import{t as V}from"./ui-components-DaffuSG7.js";var H=n(),U=e(r(),1),W=i(),G=U.forwardRef((e,t)=>{let n=(0,H.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=u(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(V,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});G.displayName=V.displayName;var K=U.forwardRef((e,t)=>{let n=(0,H.c)(10),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,W.jsx)(l,{className:`mr-2 h-4 w-4 shrink-0 opacity-50`}),n[3]=a):a=n[3];let o;n[4]===r?o=n[5]:(o=u(`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]=o);let s;return n[6]!==i||n[7]!==t||n[8]!==o?(s=(0,W.jsxs)(`div`,{className:`flex items-center border-b px-3`,"cmdk-input-wrapper":``,children:[a,(0,W.jsx)(V.Input,{ref:t,className:o,...i})]}),n[6]=i,n[7]=t,n[8]=o,n[9]=s):s=n[9],s});K.displayName=V.Input.displayName;var q=U.forwardRef((e,t)=>{let n=(0,H.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=u(`max-h-[300px] overflow-y-auto overflow-x-hidden`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(V.List,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});q.displayName=V.List.displayName;var J=U.forwardRef((e,t)=>{let n=(0,H.c)(4),r;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=u(d.bodyMuted,`py-6 text-center`),n[0]=r):r=n[0];let i;return n[1]!==e||n[2]!==t?(i=(0,W.jsx)(V.Empty,{ref:t,className:r,...e}),n[1]=e,n[2]=t,n[3]=i):i=n[3],i});J.displayName=V.Empty.displayName;var Y=U.forwardRef((e,t)=>{let n=(0,H.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=u(`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]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(V.Group,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Y.displayName=V.Group.displayName;var ee=U.forwardRef((e,t)=>{let n=(0,H.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=u(`-mx-1 h-px bg-border`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(V.Separator,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ee.displayName=V.Separator.displayName;var te=U.forwardRef((e,t)=>{let n=(0,H.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=u(u(d.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]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(V.Item,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});te.displayName=V.Item.displayName;var X=e=>{let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=u(d.compact,`ml-auto tracking-widest text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,W.jsx)(`span`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};X.displayName=`CommandShortcut`;var ne=100,Z=500;function re(e){return e.trim().toLowerCase().split(/\s+/).filter(Boolean)}function ie(e,t){return t.length===0?!0:t.every(t=>e.haystack.includes(t))}function ae(e,t,n){if(t.length===0)return[];let r=[];for(let n of e)if(ie(n,t)&&(r.push(n.node),r.length>=Z))break;return r.sort((e,t)=>Q(e,t,n)).slice(0,ne)}function Q(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 oe(e){let n=(0,H.c)(38),{items:r,isReady:i,onRequestIndex:a,onOpenChange:o,onSelect:l}=e,f=i===void 0?!1:i,p=(0,U.useRef)(null),m=(0,U.useRef)(!1),h=(0,U.useRef)(!1),[g,_]=(0,U.useState)(!1),[v,y]=(0,U.useState)(``),b=(0,U.useDeferredValue)(v),x;n[0]===a?x=n[1]:(x=function(){h.current||(h.current=!0,a())},n[0]=a,n[1]=x);let S=x,C;n[2]!==b||n[3]!==r?(C=ae(r,re(b),b),n[2]=b,n[3]=r,n[4]=C):C=n[4];let w=C,E,D;n[5]!==o||n[6]!==v?(E=()=>{let e=v.trim().length>0;_(e),m.current!==e&&(m.current=e,o(e))},D=[o,v],n[5]=o,n[6]=v,n[7]=E,n[8]=D):(E=n[7],D=n[8]),(0,U.useEffect)(E,D);let A;n[9]===o?A=n[10]:(A=function(e){e||y(``),_(e),o(e),e&&requestAnimationFrame(()=>p.current?.focus())},n[9]=o,n[10]=A);let j=A,M;n[11]!==o||n[12]!==l?(M=function(e){l(e),_(!1),o(!1),y(``)},n[11]=o,n[12]=l,n[13]=M):M=n[13];let N=M,P;n[14]===S?P=n[15]:(P=e=>{S(),y(e.target.value)},n[14]=S,n[15]=P);let F;n[16]!==v||n[17]!==S||n[18]!==P?(F=(0,W.jsx)(T,{asChild:!0,children:(0,W.jsx)(`div`,{children:(0,W.jsx)(t,{ref:p,value:v,onPointerDown:S,onChange:P,placeholder:`Search files and folders`,className:`pr-[4px]`})})}),n[16]=v,n[17]=S,n[18]=P,n[19]=F):F=n[19];let I;n[20]===Symbol.for(`react.memo_cache_sentinel`)?(I=u(d.compact,`py-4`),n[20]=I):I=n[20];let L=f?`No matches found.`:`Indexing files and folders...`,R;n[21]===L?R=n[22]:(R=(0,W.jsx)(J,{className:I,children:L}),n[21]=L,n[22]=R);let z;if(n[23]!==N||n[24]!==w){let e;n[26]===N?e=n[27]:(e=e=>(0,W.jsxs)(te,{value:e.path,onSelect:()=>N(e),className:e.ignored?`opacity-50`:void 0,children:[e.type===`folder`?(0,W.jsx)(s,{className:`h-4 w-4 text-muted-foreground`}):(0,W.jsx)(c,{className:`h-4 w-4 text-muted-foreground`}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`div`,{className:`truncate`,children:e.name}),(0,W.jsx)(`div`,{className:u(d.compact,`truncate text-muted-foreground`),children:e.path})]})]},e.path),n[26]=N,n[27]=e),z=w.map(e),n[23]=N,n[24]=w,n[25]=z}else z=n[25];let B;n[28]===z?B=n[29]:(B=(0,W.jsx)(Y,{children:z}),n[28]=z,n[29]=B);let V;n[30]!==R||n[31]!==B?(V=(0,W.jsx)(k,{align:`start`,side:`bottom`,sideOffset:4,onOpenAutoFocus:se,className:`w-[var(--radix-popover-trigger-width)] p-0`,children:(0,W.jsx)(G,{shouldFilter:!1,children:(0,W.jsxs)(q,{children:[R,B]})})}),n[30]=R,n[31]=B,n[32]=V):V=n[32];let K;return n[33]!==j||n[34]!==g||n[35]!==V||n[36]!==F?(K=(0,W.jsxs)(O,{open:g,onOpenChange:j,children:[F,V]}),n[33]=j,n[34]=g,n[35]=V,n[36]=F,n[37]=K):K=n[37],K}function se(e){return e.preventDefault()}function ce(e,t,n){return`explorer-dir:${e}:${t}:${n}`}function le(e){let t=(0,H.c)(12),{threadId:n,dirPath:r,version:i,children:a}=e,o;t[0]!==r||t[1]!==n||t[2]!==i?(o=ce(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=()=>L(n,r).then($),t[4]=r,t[5]=n,t[6]=s):s=t[6];let c=_(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,W.jsx)(W.Fragment,{children:l}),t[10]=l,t[11]=u),u}function $(e){return e.entries}function ue(e){let t=(0,H.c)(17),{defaultValue:n,onCommit:r,onCancel:i,level:a,basePadding:o,icon:s}=e,c=(0,U.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,U.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,W.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:de}),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,W.jsxs)(w,{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 de(e){return e.stopPropagation()}function fe(e){return e.map(e=>({node:e,haystack:`${e.name} ${e.path}`.toLowerCase()}))}var pe=(0,U.memo)(function e({node:t,level:n,threadId:r,selectedPath:i,expandedPaths:l,getDirVersion:u,renamingPath:d,newItemIn:p,onToggleFolder:m,onSelectNode:h,onStartRename:g,onCommitRename:_,onCancelRename:y,onDelete:b,onOpen:x,onNewFile:S,onNewFolder:C,onCommitNewItem:T,onCancelNewItem:E}){let D=l.has(t.path),O=d===t.path,k=p?.dirPath===t.path&&D;return t.type===`folder`?(0,W.jsxs)(P,{children:[(0,W.jsx)(A,{asChild:!0,children:(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(w,{level:n,basePadding:10,selected:i===t.path,className:t.ignored?`opacity-50`:void 0,onClick:e=>{e.stopPropagation(),m(t)},children:[(0,W.jsx)(`span`,{className:`text-muted-foreground w-3 flex-shrink-0`,children:D?(0,W.jsx)(f,{className:`h-3 w-3`}):(0,W.jsx)(o,{className:`h-3 w-3`})}),O?(0,W.jsxs)(W.Fragment,{children:[D?(0,W.jsx)(a,{className:`h-4 w-4 flex-shrink-0`}):(0,W.jsx)(s,{className:`h-4 w-4 flex-shrink-0`}),(0,W.jsx)(`input`,{autoFocus:!0,defaultValue:t.name,onKeyDown:e=>{if(e.key===`Enter`){let n=e.target.value.trim();n?_(t,n):y()}else e.key===`Escape`&&y()},onBlur:e=>{let n=e.target.value.trim();n?_(t,n):y()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`})]}):(0,W.jsxs)(W.Fragment,{children:[D?(0,W.jsx)(a,{className:`h-4 w-4 flex-shrink-0`}):(0,W.jsx)(s,{className:`h-4 w-4 flex-shrink-0`}),(0,W.jsx)(`span`,{className:`flex-1 truncate`,children:t.name})]})]}),D&&(0,W.jsx)(`div`,{children:(0,W.jsx)(U.Suspense,{fallback:(0,W.jsx)(v,{}),children:(0,W.jsx)(le,{threadId:r,dirPath:t.path,version:u(t.path),children:t=>(0,W.jsxs)(W.Fragment,{children:[k&&(0,W.jsx)(ue,{defaultValue:``,level:n+1,basePadding:p.type===`folder`?10:22,icon:p.type===`folder`?(0,W.jsx)(s,{className:`h-4 w-4 flex-shrink-0`}):(0,W.jsx)(c,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:T,onCancel:E}),t.map(t=>(0,W.jsx)(e,{node:t,level:n+1,threadId:r,selectedPath:i,expandedPaths:l,getDirVersion:u,renamingPath:d,newItemIn:p,onToggleFolder:m,onSelectNode:h,onStartRename:g,onCommitRename:_,onCancelRename:y,onDelete:b,onOpen:x,onNewFile:S,onNewFolder:C,onCommitNewItem:T,onCancelNewItem:E},t.path))]})})})})]})}),(0,W.jsxs)(M,{children:[(0,W.jsx)(N,{onSelect:()=>x(t),children:`Open`}),(0,W.jsx)(j,{}),(0,W.jsx)(N,{onSelect:()=>S(t.path),children:`New File...`}),(0,W.jsx)(N,{onSelect:()=>C(t.path),children:`New Folder...`}),(0,W.jsx)(j,{}),(0,W.jsx)(N,{onSelect:()=>g(t),children:`Rename...`}),(0,W.jsx)(N,{onSelect:()=>b(t),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]}):(0,W.jsxs)(P,{children:[(0,W.jsx)(A,{asChild:!0,children:(0,W.jsxs)(w,{level:n,basePadding:22,selected:i===t.path,className:t.ignored?`opacity-50`:void 0,onClick:()=>h(t),children:[(0,W.jsx)(c,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),O?(0,W.jsx)(`input`,{autoFocus:!0,defaultValue:t.name,onKeyDown:e=>{if(e.key===`Enter`){let n=e.target.value.trim();n?_(t,n):y()}else e.key===`Escape`&&y()},onBlur:e=>{let n=e.target.value.trim();n?_(t,n):y()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`}):(0,W.jsx)(`span`,{className:`flex-1 truncate`,children:t.name})]})}),(0,W.jsxs)(M,{children:[(0,W.jsx)(N,{onSelect:()=>x(t),children:`Open`}),(0,W.jsx)(j,{}),(0,W.jsx)(N,{onSelect:()=>g(t),children:`Rename...`}),(0,W.jsx)(N,{onSelect:()=>b(t),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]})}),me=new Map;function he({threadId:e,selectedPath:t,onNodeSelect:n}){let[r,i]=(0,U.useState)(()=>new Map([[``,0]])),[a,o]=(0,U.useState)(new Set),[l,u]=(0,U.useState)(null),[d,f]=(0,U.useState)(null),[_,v]=(0,U.useState)(null),[w,T]=(0,U.useState)(!1),[O,k]=(0,U.useState)([]),[j,V]=(0,U.useState)(!1),[H,G]=(0,U.useState)(!1),K=(0,U.useRef)(null),q=(0,U.useRef)(0),J=(0,U.useRef)(null),{explorerRefreshTick:Y,pendingExplorerPath:ee,setExplorerClearPath:te}=D(),X=(0,U.useMemo)(()=>`${e}:${Y}`,[Y,e]),ne=(0,U.useCallback)(e=>{(0,U.startTransition)(()=>{T(t=>t===e?t:e)})},[]),Z=(0,U.useCallback)(async()=>{if(!e)return;let t=me.get(X);if(t){k(t),V(!0);return}if(K.current!==X){K.current=X,k([]),V(!1);try{let t=fe((await L(e,``,!0)).entries);me.set(X,t),k(t),V(!0)}catch{k([]),V(!1)}finally{K.current===X&&(K.current=null)}}},[X,e]),re=(0,U.useCallback)(()=>{G(!0)},[]),ie=(0,U.useCallback)(()=>{me.delete(X),k([]),V(!1)},[X]),ae=(0,U.useCallback)(()=>{ie(),H&&Z()},[ie,Z,H]),Q=(0,U.useCallback)(e=>r.get(e)??0,[r]),se=(0,U.useCallback)(e=>{i(t=>{let n=new Map(t);return n.set(e,(t.get(e)??0)+1),n})},[]),$=(0,U.useCallback)(t=>{e&&(S(ce(e,t,Q(t))),se(t))},[se,Q,e]),de=(0,U.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);o(e=>{let t=new Set(e);for(let e of r)t.add(e);return t})},[e]);(0,U.useEffect)(()=>{if(!e)return;let t=J.current!==null&&J.current!==e;J.current=e,t&&(i(new Map([[``,0]])),o(new Set),u(null),f(null),q.current=Y)},[Y,e]),(0,U.useEffect)(()=>{!e||Y<=q.current||(q.current=Y,i(t=>{let n=new Set([``]);for(let e of a)n.add(e);let r=new Map(t);for(let i of n){let n=t.get(i)??0;S(ce(e,i,n)),r.set(i,n+1)}return r}))},[Y,a,e]),(0,U.useEffect)(()=>{k([]),V(!1),G(!1),K.current=null},[X]),(0,U.useEffect)(()=>{!H||!e||Z()},[Z,H,e]),(0,U.useEffect)(()=>{if(!ee||!e)return;let t=ee.split(`/`);t.pop();let n=[],r=``;for(let e of t)r=r?`${r}/${e}`:e,n.push(r);if(n.length!==0){o(e=>{let t=new Set(e);for(let e of n)t.add(e);return t});for(let e of n)i(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})}},[ee,e]);function he(e){a.has(e.path)?o(t=>{let n=new Set(t);return n.delete(e.path),n}):(o(t=>new Set(t).add(e.path)),i(t=>{if(t.has(e.path))return t;let n=new Map(t);return n.set(e.path,0),n}))}function ge(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(0,t):``}function _e(e){v(e)}async function ve(t){try{await z(e,t.path)}catch{E({title:`Error`,description:`Failed to open "${t.name}"`,variant:`destructive`})}}async function ye(){if(!_)return;let t=_;v(null);try{await R(e,t.path),te(t.path),$(ge(t.path)),ae(),o(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),i(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n})}catch{E({title:`Error`,description:`Failed to move "${t.name}" to trash`,variant:`destructive`})}}function be(e){f(null),u(e.path)}async function xe(t,n){if(n===t.name){u(null);return}u(null);try{await F(e,t.path,n),$(ge(t.path)),ae(),t.type===`folder`&&(o(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),i(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}))}catch{E({title:`Error`,description:`Failed to rename "${t.name}"`,variant:`destructive`})}}function Se(e){u(null),a.has(e)||(o(t=>new Set(t).add(e)),i(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})),f({dirPath:e,type:`file`})}function Ce(e){u(null),a.has(e)||(o(t=>new Set(t).add(e)),i(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})),f({dirPath:e,type:`folder`})}async function we(t){if(!d)return;let{dirPath:n,type:r}=d;f(null);try{r===`file`?await B(e,n,t):await I(e,n,t),$(n),ae()}catch{E({title:`Error`,description:`Failed to create ${r} "${t}"`,variant:`destructive`})}}function Te(){f(null)}function Ee(e){de(e),e.type===`file`&&n(e)}let De=d?.dirPath===``?(0,W.jsx)(ue,{defaultValue:``,level:0,basePadding:d.type===`folder`?10:22,icon:d.type===`folder`?(0,W.jsx)(s,{className:`h-4 w-4 flex-shrink-0`}):(0,W.jsx)(c,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:we,onCancel:Te}):null;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(g,{open:_!==null,onOpenChange:e=>!e&&v(null),children:(0,W.jsxs)(y,{children:[(0,W.jsx)(m,{children:`Move to Trash`}),(0,W.jsxs)(h,{children:[`Move “`,_?.name,`” to trash?`]}),(0,W.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[(0,W.jsx)(p,{children:`Cancel`}),(0,W.jsx)(b,{onClick:()=>void ye(),children:`Move to Trash`})]})]})}),(0,W.jsx)(`div`,{className:`border-b border-border bg-background px-2 py-2`,children:(0,W.jsx)(oe,{items:O,isReady:j,onRequestIndex:re,onOpenChange:ne,onSelect:e=>Ee(e)},X)}),(0,W.jsxs)(P,{children:[(0,W.jsx)(A,{asChild:!0,disabled:w,children:(0,W.jsx)(`div`,{className:`py-2 min-h-full`,children:(0,W.jsx)(x,{fallbackTitle:`Failed to load files`,onRetry:()=>$(``),children:(0,W.jsx)(U.Suspense,{fallback:(0,W.jsx)(C,{}),children:(0,W.jsx)(le,{threadId:e,dirPath:``,version:Q(``),children:r=>(0,W.jsxs)(W.Fragment,{children:[De,r.map(r=>(0,W.jsx)(pe,{node:r,level:0,threadId:e,selectedPath:t,expandedPaths:a,getDirVersion:Q,renamingPath:l,newItemIn:d,onToggleFolder:he,onSelectNode:n,onStartRename:be,onCommitRename:xe,onCancelRename:()=>u(null),onDelete:_e,onOpen:ve,onNewFile:Se,onNewFolder:Ce,onCommitNewItem:we,onCancelNewItem:Te},r.path))]})})})})})}),(0,W.jsxs)(M,{children:[(0,W.jsx)(N,{onSelect:()=>Se(``),children:`New File...`}),(0,W.jsx)(N,{onSelect:()=>Ce(``),children:`New Folder...`})]})]})]})}export{he as default};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ci as t,Eo as n,Fo as r,Hi as i,Lo as a,Oa as o,Ra as s,Si as c,hi as l,ho as u,ji as d,no as f,nt as ee,oo as p,pi as m,ro as h,xa as te}from"./dialogs-config-CjKh5Rl2.js";import{C as ne}from"./react-vendor-DwQYi7es.js";import{O as g,a as _,l as v,n as y,o as b}from"./history-view-ar7GLZ-R.js";import{n as re}from"./utils-tgi5ym_d.js";import{B as x,C as S,D as C,I as w,M as T,P as E,S as D,u as ie,w as ae}from"./index--HY4BbcM.js";import{a as O,i as k,l as oe,o as A,s as se,t as ce}from"./api-D6uLdHBQ.js";var j=r(),M=i(),N=e(a(),1),P=g(e=>(0,M.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center`,children:[e.v0,(0,M.jsx)(`p`,{className:e.v1,children:`Select a thread to browse its files`})]}),{name:`ExplorerView_1`,portals:[`v0`]}),F=g(e=>(0,M.jsxs)(`div`,{className:`flex flex-col h-full`,children:[e.v0,(0,M.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:(0,M.jsx)(`div`,{className:`h-full relative overflow-hidden`,children:e.v1})}),e.v2]}),{name:`ExplorerView_2`,portals:[`v0`,`v1`,`v2`]}),I=function({selectedFile:e,showTreeBackButton:t=!1,onShowTree:r,onFileCreated:i}){let{resolvedTheme:a}=re(),f=x(e=>e.selectedThreadId),{triggerExplorerRefresh:p}=T(),g=(0,N.useRef)(null),_=(0,N.useRef)(null),O=(0,N.useRef)(!1),[k,A]=(0,N.useState)(null),[j,I]=(0,N.useState)(!1),[W,K]=(0,N.useState)(`edit`),[ue,de]=(0,N.useState)(0),[q,fe]=(0,N.useState)(null),[J,Y]=(0,N.useState)(!1);(0,N.useEffect)(()=>{f&&ee(f).then(fe).catch(()=>{})},[f]);let pe=async()=>{if(!(!q||J)){Y(!0);try{await navigator.clipboard.writeText(q),w({title:`Copied`,description:`Repository folder path copied to clipboard.`})}catch{w({title:`Error`,description:`Failed to copy path to clipboard.`,variant:`destructive`})}finally{Y(!1)}}},me=async()=>{if(f)try{await se(f,`.`)}catch{w({title:`Error`,description:`Failed to open repository folder.`,variant:`destructive`})}},he=(0,N.useCallback)(async e=>{if(f)try{let t=await R(f,e);await ce(f,``,t);let n={name:t,path:t,type:`file`};_.current=t,O.current=!0,i?.(n),p(),w({title:`Created`,description:`${t} created successfully.`})}catch{w({title:`Error`,description:`Failed to create file.`,variant:`destructive`})}},[f,i,p]),X=e?c(e.path,e.name):null,Z=e?.type===`file`&&f&&!X?e:null,Q=k?.content??``,ge=k?.original??``,$=Z?`${f}:${Z.path}:${ue}`:null;(0,N.useEffect)(()=>()=>{g.current&&=(g.current.getModel()?.dispose(),g.current.dispose(),null)},[]),(0,N.useEffect)(()=>{e?.type===`file`?_.current===e.path?(_.current=null,K(`edit`)):K(z(e.path)?`view`:`edit`):K(`edit`),A(null)},[e?.path,f]);async function _e(){if(!(!f||!e)){I(!0);try{await oe(f,e.path,Q),A({content:Q,original:Q}),w({title:`Saved`,description:`${e.name} saved successfully.`})}catch(e){w({title:`Error`,description:e instanceof Error?e.message:`Failed to save file`,variant:`destructive`})}finally{I(!1)}}}function ve(){!f||!Z||(b(V(f,Z.path)),A(null),de(e=>e+1))}return f?(0,M.jsx)(F,{v0:(0,M.jsxs)(ie,{className:`justify-between`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[t&&r?(0,M.jsxs)(m,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0 text-muted-foreground electrobun-webkit-app-region-no-drag`,onClick:r,children:[(0,M.jsx)(o,{className:`h-4 w-4`}),(0,M.jsx)(`span`,{className:`sr-only`,children:`Show file tree`})]}):null,(0,M.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,M.jsx)(`span`,{className:l(d.label,`truncate text-foreground`),children:e?e.name:`Select a file to edit`}),(0,M.jsx)(`span`,{className:l(d.compact,`truncate text-muted-foreground`),children:e?e.path:`Browse and edit repository files`})]})]}),(0,M.jsxs)(`div`,{className:`flex gap-2`,children:[Z&&k?(0,M.jsxs)(M.Fragment,{children:[z(Z.path)?(0,M.jsxs)(`div`,{className:`flex rounded-full border border-input bg-background p-0.5`,children:[(0,M.jsx)(m,{size:`sm`,variant:W===`view`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>K(`view`),children:`View`}),(0,M.jsx)(m,{size:`sm`,variant:W===`edit`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>K(`edit`),children:`Edit`})]}):null,(0,M.jsxs)(m,{size:`sm`,onClick:()=>void _e(),disabled:j||!Q||Q===ge,children:[j?(0,M.jsx)(s,{className:`h-4 w-4 animate-spin`}):null,`Save`]})]}):null,e?null:(0,M.jsxs)(D,{children:[(0,M.jsx)(C,{asChild:!0,children:(0,M.jsxs)(m,{size:`sm`,className:`gap-1.5`,children:[(0,M.jsx)(te,{className:`h-3.5 w-3.5`}),`New file`]})}),(0,M.jsx)(S,{align:`end`,children:L.map(({label:e,ext:t,icon:n})=>(0,M.jsxs)(ae,{onSelect:()=>void he(t),children:[(0,M.jsx)(n,{className:`h-4 w-4`}),e]},t))})]})]})]}),v1:Z?(0,M.jsxs)(y,{fallbackTitle:`Failed to load file`,onRetry:ve,children:[(0,M.jsx)(N.Suspense,{fallback:(0,M.jsx)(v,{}),children:(0,M.jsx)(H,{threadId:f,path:Z.path,onContentReady:A},$??void 0)}),k?z(Z.path)&&W===`view`?(0,M.jsx)(`div`,{className:`h-full overflow-auto p-6`,children:(0,M.jsx)(E,{content:Q,enableMermaid:!0})}):(0,M.jsx)(ne,{height:`100%`,language:B(Z.path),value:Q,onChange:e=>A(t=>t&&{...t,content:e??``}),onMount:e=>{g.current=e,O.current&&(O.current=!1,e.focus())},theme:a===`dark`?`vs-dark`:`vs-light`,options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:`on`,automaticLayout:!0,fontSize:13,lineNumbers:`on`,renderLineHighlight:`line`,scrollbar:{vertical:`auto`,horizontal:`auto`}}}):(0,M.jsx)(v,{})]}):e?.type===`file`&&X===`image`?(0,M.jsx)(y,{fallbackTitle:`Failed to load image`,onRetry:()=>{!f||!e||b(U(f,e.path))},children:(0,M.jsx)(N.Suspense,{fallback:(0,M.jsx)(v,{}),children:(0,M.jsx)(G,{threadId:f,path:e.path,alt:e.name})})}):e?.type===`file`&&X===`video`?(0,M.jsx)(y,{fallbackTitle:`Failed to load video`,onRetry:()=>{!f||!e||b(U(f,e.path))},children:(0,M.jsx)(N.Suspense,{fallback:(0,M.jsx)(v,{}),children:(0,M.jsx)(le,{threadId:f,path:e.path})})}):(0,M.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center p-8`,children:[(0,M.jsx)(`h2`,{className:l(d.pageTitle,`text-foreground`),children:`File Explorer`}),(0,M.jsx)(`p`,{className:l(d.pageSubtitle),children:`Browse and edit files`})]}),v2:e?null:(0,M.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 px-4 py-2`,children:q?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`button`,{type:`button`,onClick:()=>void me(),className:l(d.compact,`min-w-0 flex-1 truncate text-left font-mono text-muted-foreground hover:text-foreground hover:underline`),title:q,children:q}),(0,M.jsxs)(m,{variant:`ghost`,size:`icon`,className:`h-7 w-7 shrink-0`,onClick:()=>void pe(),disabled:J,children:[J?(0,M.jsx)(n,{className:`h-3.5 w-3.5`}):(0,M.jsx)(u,{className:`h-3.5 w-3.5`}),(0,M.jsx)(`span`,{className:`sr-only`,children:`Copy path`})]})]}):(0,M.jsx)(`p`,{className:l(d.compact,`text-muted-foreground/50 italic`),children:`Loading path...`})})}):(0,M.jsx)(P,{v0:(0,M.jsx)(h,{className:`h-8 w-8 text-muted-foreground`}),v1:d.bodyMuted})},L=[{label:`Markdown`,ext:`md`,icon:h},{label:`TypeScript`,ext:`ts`,icon:p},{label:`Text`,ext:`txt`,icon:f}];async function R(e,t){try{let n=await A(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 z(e){return t(e)===`md`}function B(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`}[t(e)]??`plaintext`}function V(e,t){return`explorer-file:${e}:${t}`}function H(e){let t=(0,j.c)(10),{threadId:n,path:r,onContentReady:i}=e,a;t[0]!==r||t[1]!==n?(a=V(n,r),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o;t[3]!==r||t[4]!==n?(o=()=>O(n,r),t[3]=r,t[4]=n,t[5]=o):o=t[5];let s=_(a,o),c,l;return t[6]!==i||t[7]!==s.content?(c=()=>{i({content:s.content,original:s.content})},l=[i,s.content],t[6]=i,t[7]=s.content,t[8]=c,t[9]=l):(c=t[8],l=t[9]),(0,N.useLayoutEffect)(c,l),null}function U(e,t){return`explorer-media:${e}:${t}`}function W(e,t){let n=(0,j.c)(11),r;n[0]!==t||n[1]!==e?(r=U(e,t),n[0]=t,n[1]=e,n[2]=r):r=n[2];let i;n[3]!==t||n[4]!==e?(i=()=>k(e,t),n[3]=t,n[4]=e,n[5]=i):i=n[5];let a=_(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,N.useEffect)(c,l),s}function G(e){let t=(0,j.c)(3),{threadId:n,path:r,alt:i}=e,a=W(n,r),o;return t[0]!==i||t[1]!==a?(o=(0,M.jsx)(`div`,{className:`flex items-center justify-center h-full p-4 overflow-auto`,children:(0,M.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 le(e){let t=(0,j.c)(2),{threadId:n,path:r}=e,i=W(n,r),a;return t[0]===i?a=t[1]:(a=(0,M.jsx)(`div`,{className:`flex items-center justify-center h-full p-4`,children:(0,M.jsx)(`video`,{src:i,controls:!0,className:`max-w-full max-h-full`})}),t[0]=i,t[1]=a),a}export{I as default};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ci as t,Da as n,Fo as r,La as i,Lo as a,Po as o,Si as s,To as c,ao as l,ba as ee,hi as u,ji as d,mo as f,no as p,nt as te,pi as m,to as h}from"./dialogs-config-CxRnlUcQ.js";import{C as ne}from"./react-vendor-CE5Dmjd0.js";import{I as g,a as _,l as v,n as y,o as b}from"./history-view-DebwP9D7.js";import{n as re}from"./utils-BIt9KCVx.js";import{B as x,C as S,D as C,I as w,M as T,P as E,S as D,s as ie,w as ae}from"./index-D9aY24hf.js";import{a as O,i as k,l as oe,o as A,s as se,t as ce}from"./api-Cuj9iSVv.js";var j=r(),M=o(),N=e(a(),1),P=g(e=>(0,M.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center`,children:[e.v0,(0,M.jsx)(`p`,{className:e.v1,children:`Select a thread to browse its files`})]}),{name:`ExplorerView_1`,portals:[`v0`]}),F=g(e=>(0,M.jsxs)(`div`,{className:`flex flex-col h-full`,children:[e.v0,(0,M.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:(0,M.jsx)(`div`,{className:`h-full relative overflow-hidden`,children:e.v1})}),e.v2]}),{name:`ExplorerView_2`,portals:[`v0`,`v1`,`v2`]}),I=function({selectedFile:e,showTreeBackButton:t=!1,onShowTree:r,onFileCreated:a}){let{resolvedTheme:o}=re(),l=x(e=>e.selectedThreadId),{triggerExplorerRefresh:h}=T(),g=(0,N.useRef)(null),_=(0,N.useRef)(null),O=(0,N.useRef)(!1),[k,A]=(0,N.useState)(null),[j,I]=(0,N.useState)(!1),[W,K]=(0,N.useState)(`edit`),[ue,de]=(0,N.useState)(0),[q,fe]=(0,N.useState)(null),[J,Y]=(0,N.useState)(!1);(0,N.useEffect)(()=>{l&&te(l).then(fe).catch(()=>{})},[l]);let pe=async()=>{if(!(!q||J)){Y(!0);try{await navigator.clipboard.writeText(q),w({title:`Copied`,description:`Repository folder path copied to clipboard.`})}catch{w({title:`Error`,description:`Failed to copy path to clipboard.`,variant:`destructive`})}finally{Y(!1)}}},me=async()=>{if(l)try{await se(l,`.`)}catch{w({title:`Error`,description:`Failed to open repository folder.`,variant:`destructive`})}},he=(0,N.useCallback)(async e=>{if(l)try{let t=await R(l,e);await ce(l,``,t);let n={name:t,path:t,type:`file`};_.current=t,O.current=!0,a?.(n),h(),w({title:`Created`,description:`${t} created successfully.`})}catch{w({title:`Error`,description:`Failed to create file.`,variant:`destructive`})}},[l,a,h]),X=e?s(e.path,e.name):null,Z=e?.type===`file`&&l&&!X?e:null,Q=k?.content??``,ge=k?.original??``,$=Z?`${l}:${Z.path}:${ue}`:null;(0,N.useEffect)(()=>()=>{g.current&&=(g.current.getModel()?.dispose(),g.current.dispose(),null)},[]),(0,N.useEffect)(()=>{e?.type===`file`?_.current===e.path?(_.current=null,K(`edit`)):K(z(e.path)?`view`:`edit`):K(`edit`),A(null)},[e?.path,l]);async function _e(){if(!(!l||!e)){I(!0);try{await oe(l,e.path,Q),A({content:Q,original:Q}),w({title:`Saved`,description:`${e.name} saved successfully.`})}catch(e){w({title:`Error`,description:e instanceof Error?e.message:`Failed to save file`,variant:`destructive`})}finally{I(!1)}}}function ve(){!l||!Z||(b(V(l,Z.path)),A(null),de(e=>e+1))}return l?(0,M.jsx)(F,{v0:(0,M.jsxs)(ie,{className:`justify-between`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[t&&r?(0,M.jsxs)(m,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0 text-muted-foreground electrobun-webkit-app-region-no-drag`,onClick:r,children:[(0,M.jsx)(n,{className:`h-4 w-4`}),(0,M.jsx)(`span`,{className:`sr-only`,children:`Show file tree`})]}):null,(0,M.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,M.jsx)(`span`,{className:u(d.label,`truncate text-foreground`),children:e?e.name:`Select a file to edit`}),(0,M.jsx)(`span`,{className:u(d.compact,`truncate text-muted-foreground`),children:e?e.path:`Browse and edit repository files`})]})]}),(0,M.jsxs)(`div`,{className:`flex gap-2`,children:[Z&&k?(0,M.jsxs)(M.Fragment,{children:[z(Z.path)?(0,M.jsxs)(`div`,{className:`flex rounded-full border border-input bg-background p-0.5`,children:[(0,M.jsx)(m,{size:`sm`,variant:W===`view`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>K(`view`),children:`View`}),(0,M.jsx)(m,{size:`sm`,variant:W===`edit`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>K(`edit`),children:`Edit`})]}):null,(0,M.jsxs)(m,{size:`sm`,onClick:()=>void _e(),disabled:j||!Q||Q===ge,children:[j?(0,M.jsx)(i,{className:`h-4 w-4 animate-spin`}):null,`Save`]})]}):null,e?null:(0,M.jsxs)(D,{children:[(0,M.jsx)(C,{asChild:!0,children:(0,M.jsxs)(m,{size:`sm`,className:`gap-1.5`,children:[(0,M.jsx)(ee,{className:`h-3.5 w-3.5`}),`New file`]})}),(0,M.jsx)(S,{align:`end`,children:L.map(({label:e,ext:t,icon:n})=>(0,M.jsxs)(ae,{onSelect:()=>void he(t),children:[(0,M.jsx)(n,{className:`h-4 w-4`}),e]},t))})]})]})]}),v1:Z?(0,M.jsxs)(y,{fallbackTitle:`Failed to load file`,onRetry:ve,children:[(0,M.jsx)(N.Suspense,{fallback:(0,M.jsx)(v,{}),children:(0,M.jsx)(H,{threadId:l,path:Z.path,onContentReady:A},$??void 0)}),k?z(Z.path)&&W===`view`?(0,M.jsx)(`div`,{className:`h-full overflow-auto p-6`,children:(0,M.jsx)(E,{content:Q,enableMermaid:!0})}):(0,M.jsx)(ne,{height:`100%`,language:B(Z.path),value:Q,onChange:e=>A(t=>t&&{...t,content:e??``}),onMount:e=>{g.current=e,O.current&&(O.current=!1,e.focus())},theme:o===`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,M.jsx)(v,{})]}):e?.type===`file`&&X===`image`?(0,M.jsx)(y,{fallbackTitle:`Failed to load image`,onRetry:()=>{!l||!e||b(U(l,e.path))},children:(0,M.jsx)(N.Suspense,{fallback:(0,M.jsx)(v,{}),children:(0,M.jsx)(G,{threadId:l,path:e.path,alt:e.name})})}):e?.type===`file`&&X===`video`?(0,M.jsx)(y,{fallbackTitle:`Failed to load video`,onRetry:()=>{!l||!e||b(U(l,e.path))},children:(0,M.jsx)(N.Suspense,{fallback:(0,M.jsx)(v,{}),children:(0,M.jsx)(le,{threadId:l,path:e.path})})}):(0,M.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center p-8`,children:[(0,M.jsx)(`h2`,{className:u(d.pageTitle,`text-foreground`),children:`File Explorer`}),(0,M.jsx)(`p`,{className:u(d.pageSubtitle),children:`Browse and edit files`})]}),v2:e?null:(0,M.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 px-4 py-2`,children:q?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`button`,{type:`button`,onClick:()=>void me(),className:u(d.compact,`min-w-0 flex-1 truncate text-left font-mono text-muted-foreground hover:text-foreground hover:underline`),title:q,children:q}),(0,M.jsxs)(m,{variant:`ghost`,size:`icon`,className:`h-7 w-7 shrink-0`,onClick:()=>void pe(),disabled:J,children:[J?(0,M.jsx)(c,{className:`h-3.5 w-3.5`}):(0,M.jsx)(f,{className:`h-3.5 w-3.5`}),(0,M.jsx)(`span`,{className:`sr-only`,children:`Copy path`})]})]}):(0,M.jsx)(`p`,{className:u(d.compact,`text-muted-foreground/50 italic`),children:`Loading path...`})})}):(0,M.jsx)(P,{v0:(0,M.jsx)(p,{className:`h-8 w-8 text-muted-foreground`}),v1:d.bodyMuted})},L=[{label:`Markdown`,ext:`md`,icon:p},{label:`TypeScript`,ext:`ts`,icon:l},{label:`Text`,ext:`txt`,icon:h}];async function R(e,t){try{let n=await A(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 z(e){return t(e)===`md`}function B(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`}[t(e)]??`plaintext`}function V(e,t){return`explorer-file:${e}:${t}`}function H(e){let t=(0,j.c)(10),{threadId:n,path:r,onContentReady:i}=e,a;t[0]!==r||t[1]!==n?(a=V(n,r),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o;t[3]!==r||t[4]!==n?(o=()=>O(n,r),t[3]=r,t[4]=n,t[5]=o):o=t[5];let s=_(a,o),c,l;return t[6]!==i||t[7]!==s.content?(c=()=>{i({content:s.content,original:s.content})},l=[i,s.content],t[6]=i,t[7]=s.content,t[8]=c,t[9]=l):(c=t[8],l=t[9]),(0,N.useLayoutEffect)(c,l),null}function U(e,t){return`explorer-media:${e}:${t}`}function W(e,t){let n=(0,j.c)(11),r;n[0]!==t||n[1]!==e?(r=U(e,t),n[0]=t,n[1]=e,n[2]=r):r=n[2];let i;n[3]!==t||n[4]!==e?(i=()=>k(e,t),n[3]=t,n[4]=e,n[5]=i):i=n[5];let a=_(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,N.useEffect)(c,l),s}function G(e){let t=(0,j.c)(3),{threadId:n,path:r,alt:i}=e,a=W(n,r),o;return t[0]!==i||t[1]!==a?(o=(0,M.jsx)(`div`,{className:`flex items-center justify-center h-full p-4 overflow-auto`,children:(0,M.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 le(e){let t=(0,j.c)(2),{threadId:n,path:r}=e,i=W(n,r),a;return t[0]===i?a=t[1]:(a=(0,M.jsx)(`div`,{className:`flex items-center justify-center h-full p-4`,children:(0,M.jsx)(`video`,{src:i,controls:!0,className:`max-w-full max-h-full`})}),t[0]=i,t[1]=a),a}export{I as default};
@@ -0,0 +1 @@
1
+ import{Fo as e,Fr as t,Ir as n,La as r,Lr as i,Nr as a,Po as o,Pr as s,hi as c,ji as l,jr as u,pi as d}from"./dialogs-config-CxRnlUcQ.js";var f=e(),p=o();function m(e){let o=(0,f.c)(28),{open:m,onOpenChange:g,commits:_,displayedCommits:v,isLoadingMore:y,onScroll:b,currentBranch:x}=e,S;o[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,p.jsx)(i,{children:`Commit History`}),o[0]=S):S=o[0];let C;o[1]===x?C=o[2]:(C=(0,p.jsxs)(n,{children:[S,(0,p.jsxs)(s,{children:[`Recent commits on branch `,x]})]}),o[1]=x,o[2]=C);let w;o[3]===v?w=o[4]:(w=v.length>0?v.map(h):(0,p.jsx)(`p`,{className:c(l.bodyMuted,`text-center py-8`),children:`No commits found`}),o[3]=v,o[4]=w);let T;o[5]===y?T=o[6]:(T=y&&(0,p.jsx)(`div`,{className:`p-3 text-center`,children:(0,p.jsx)(r,{className:`h-4 w-4 animate-spin inline`})}),o[5]=y,o[6]=T);let E;o[7]!==_.length||o[8]!==v.length||o[9]!==y?(E=v.length<_.length&&!y&&(0,p.jsx)(`div`,{className:c(l.caption,`p-3 text-center`),children:`Scroll to load more`}),o[7]=_.length,o[8]=v.length,o[9]=y,o[10]=E):E=o[10];let D;o[11]!==w||o[12]!==T||o[13]!==E?(D=(0,p.jsxs)(`div`,{className:`divide-y`,children:[w,T,E]}),o[11]=w,o[12]=T,o[13]=E,o[14]=D):D=o[14];let O;o[15]!==b||o[16]!==D?(O=(0,p.jsx)(`div`,{className:`flex-1 overflow-y-auto border rounded-lg`,onScroll:b,children:D}),o[15]=b,o[16]=D,o[17]=O):O=o[17];let k;o[18]===g?k=o[19]:(k=(0,p.jsx)(t,{children:(0,p.jsx)(d,{onClick:()=>g(!1),children:`Close`})}),o[18]=g,o[19]=k);let A;o[20]!==C||o[21]!==O||o[22]!==k?(A=(0,p.jsxs)(a,{className:`max-w-2xl max-h-[80vh] flex flex-col`,children:[C,O,k]}),o[20]=C,o[21]=O,o[22]=k,o[23]=A):A=o[23];let j;return o[24]!==g||o[25]!==m||o[26]!==A?(j=(0,p.jsx)(u,{open:m,onOpenChange:g,children:A}),o[24]=g,o[25]=m,o[26]=A,o[27]=j):j=o[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:c(l.label,`break-words`),children:e.message}),(0,p.jsxs)(`p`,{className:c(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-kTaKOsNO.js","assets/index-D9aY24hf.js","assets/rolldown-runtime-aKtaBQYM.js","assets/monaco-CZnIWXyV.js","assets/monaco-Br_kD0ds.css","assets/history-view-DebwP9D7.js","assets/dialogs-config-CxRnlUcQ.js","assets/onboarding-BN_K08ma.js","assets/vosk-speech-CgILeNJR.js","assets/react-vendor-CE5Dmjd0.js","assets/utils-BIt9KCVx.js","assets/index-C2_gO3dh.css","assets/pull-request-dialog-LJhZpT8C.js","assets/create-repo-dialog-gIZLk6LZ.js","assets/git-history-dialog-B2ABiCXZ.js","assets/push-before-pr-dialog-DzBp93KT.js","assets/pull-with-changes-dialog-BPIj9wIk.js","assets/merged-pr-dialog-CObeSEaB.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$n as t,Bi as n,Bt as r,C as i,Ct as a,Fo as o,Gi as s,Ha as ee,Ht as te,J as c,Jt as ne,K as l,Ka as u,Kt as re,La as d,Lo as f,Lt as ie,Mo as p,Nn as m,Po as ae,Rt as oe,Ut as se,Xi as ce,Xt as h,Ya as g,_r as le,ar as _,at as ue,co as de,cr as v,ct as fe,dr as y,er as b,et as pe,g as me,gr as he,hi as ge,ji as _e,lo as ve,lr as x,pi as ye,pr as be,qa as xe,rr as S,vr as Se,wo as Ce,yr as we,zt as C}from"./dialogs-config-CxRnlUcQ.js";import{r as w}from"./monaco-CZnIWXyV.js";import{B as T,C as Te,D as Ee,E as De,H as E,I as D,S as Oe,T as ke,w as O,y as k,z as Ae}from"./index-D9aY24hf.js";var A=e(f(),1),j=ae();function je(e,t){return t?`Creating PR...`:e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits?`Sync`:e.hasChanges?`Commit`:e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits?`Open PR`:e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges?`Create PR`:e.hasUnpushedCommits&&e.prExists?`Update PR`:`Commit`}function M(e,t,n=!1){return t||n?(0,j.jsx)(d,{className:`h-3.5 w-3.5 animate-spin`}):e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits?(0,j.jsx)(p,{className:`h-3.5 w-3.5`}):e.hasChanges?(0,j.jsx)(g,{className:`h-3.5 w-3.5`}):e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits?(0,j.jsx)(de,{className:`h-3.5 w-3.5`}):(0,j.jsx)(xe,{className:`h-3.5 w-3.5`})}function Me(e){if(e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits){let t=e.defaultBranch??`main`;return e.currentBranch===e.defaultBranch?`Your branch is behind the remote. This will pull the latest changes from origin/${t}`:`Your branch "${e.currentBranch}" is behind "${t}". This will rebase and sync with the latest changes`}return e.hasChanges?e.changedFilesCount>0?`Commit ${e.changedFilesCount} changed file${e.changedFilesCount===1?``:`s`}`:`No changes to commit`:e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits?`View pull request in GitHub`:e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges?`Create pull request for committed changes`:e.hasUnpushedCommits&&e.prExists?`Update pull request with unpushed commits`:`No actions available`}function N(e,t,n=!1){return t||n?!0:e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits||e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges?!1:!e.hasChanges&&!e.hasUnpushedCommits}function P(e){return e.hasChanges||e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges}var Ne=o();function Pe(e){let t=(0,Ne.c)(94),{branchStatus:n,remoteUrl:r,hasRemoteBranch:i,hasUnpushedCommits:a,canCreateRepo:o,repoUrl:te,isRefreshing:c,isBrandState:ne,hasChanges:l,gitUser:re,isDirectCommitMode:f,autoGenerateCommitMessage:ie,isLoading:m,isLoadingHistory:ae,isQuickCommitting:oe,onFetch:se,onPull:h,onPush:g,onOpenHistory:_,onCreatePR:ue,onCreateRepo:v,onViewInGitHub:fe,onQuickCommit:y,onOpenChange:b,layout:pe}=e,me=pe===void 0?`bar`:pe,x=me===`bar`&&`w-8 rounded-l-none`,be=me===`menu`&&`w-full justify-start gap-2 rounded-md`,S=ne&&` border-transparent bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground`,C;t[0]!==x||t[1]!==be||t[2]!==S?(C=ge(`h-8 px-1`,x,be,S),t[0]=x,t[1]=be,t[2]=S,t[3]=C):C=t[3];let w;t[4]===c?w=t[5]:(w=c?(0,j.jsx)(d,{className:`h-3.5 w-3.5 animate-spin`}):(0,j.jsx)(Ce,{className:`h-3.5 w-3.5`}),t[4]=c,t[5]=w);let T;t[6]===me?T=t[7]:(T=me===`menu`&&(0,j.jsx)(`span`,{children:`More git actions`}),t[6]=me,t[7]=T);let E;t[8]!==m||t[9]!==C||t[10]!==w||t[11]!==T?(E=(0,j.jsx)(Ee,{asChild:!0,children:(0,j.jsxs)(ye,{variant:`outline`,size:`sm`,className:C,disabled:m,children:[w,T]})}),t[8]=m,t[9]=C,t[10]=w,t[11]=T,t[12]=E):E=t[12];let D;t[13]!==n||t[14]!==r?(D=n===`Behind`&&(0,j.jsxs)(`div`,{className:ge(_e.compact,`px-2 py-1 text-amber-600`),children:[`Branch is behind `,r?`origin`:`remote`]}),t[13]=n,t[14]=r,t[15]=D):D=t[15];let k;t[16]===re?k=t[17]:(k=re&&(0,j.jsxs)(`div`,{className:ge(_e.compact,`px-2 py-1 text-muted-foreground`),children:[(0,j.jsx)(`span`,{className:`font-medium`,children:`User:`}),` `,re]}),t[16]=re,t[17]=k);let Ae;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=(0,j.jsx)(ke,{}),t[18]=Ae):Ae=t[18];let A;t[19]!==ie||t[20]!==l||t[21]!==m||t[22]!==oe||t[23]!==y?(A=l&&ie&&(0,j.jsx)(Se,{children:(0,j.jsxs)(he,{children:[(0,j.jsx)(we,{asChild:!0,children:(0,j.jsxs)(O,{onClick:y,disabled:m||oe,children:[oe?(0,j.jsx)(d,{className:`h-3.5 w-3.5 mr-2 animate-spin`}):(0,j.jsx)(s,{className:`h-3.5 w-3.5 mr-2`}),`Quick Commit`,(0,j.jsx)(De,{children:`⌘⇧C`})]})}),(0,j.jsx)(le,{side:`right`,children:`Generate the commit message and commit`})]})}),t[19]=ie,t[20]=l,t[21]=m,t[22]=oe,t[23]=y,t[24]=A):A=t[24];let je;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(je=(0,j.jsx)(ve,{className:`h-3.5 w-3.5 mr-2`}),t[25]=je):je=t[25];let M;t[26]!==m||t[27]!==se?(M=(0,j.jsx)(we,{asChild:!0,children:(0,j.jsxs)(O,{onClick:se,disabled:m,children:[je,`Fetch`]})}),t[26]=m,t[27]=se,t[28]=M):M=t[28];let Me;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(Me=(0,j.jsx)(le,{side:`right`,children:`Download latest information from remote without merging changes`}),t[29]=Me):Me=t[29];let N;t[30]===M?N=t[31]:(N=(0,j.jsx)(Se,{children:(0,j.jsxs)(he,{children:[M,Me]})}),t[30]=M,t[31]=N);let P;t[32]!==i||t[33]!==m||t[34]!==h?(P=()=>{i&&!m&&h()},t[32]=i,t[33]=m,t[34]=h,t[35]=P):P=t[35];let Pe=!i||m?`opacity-50 cursor-not-allowed`:``,Fe;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=(0,j.jsx)(p,{className:`h-3.5 w-3.5 mr-2`}),t[36]=Fe):Fe=t[36];let F;t[37]!==P||t[38]!==Pe?(F=(0,j.jsx)(we,{asChild:!0,children:(0,j.jsxs)(O,{onClick:P,className:Pe,children:[Fe,`Pull`]})}),t[37]=P,t[38]=Pe,t[39]=F):F=t[39];let I=i?`Pull latest changes from remote`:`No remote branch to pull from`,L;t[40]===I?L=t[41]:(L=(0,j.jsx)(le,{side:`right`,children:I}),t[40]=I,t[41]=L);let R;t[42]!==F||t[43]!==L?(R=(0,j.jsx)(Se,{children:(0,j.jsxs)(he,{children:[F,L]})}),t[42]=F,t[43]=L,t[44]=R):R=t[44];let z;t[45]!==i||t[46]!==m||t[47]!==g?(z=!i&&(0,j.jsx)(Se,{children:(0,j.jsxs)(he,{children:[(0,j.jsx)(we,{asChild:!0,children:(0,j.jsxs)(O,{onClick:g,disabled:m,children:[(0,j.jsx)(ce,{className:`h-3.5 w-3.5 mr-2`}),`Push Branch to Remote`]})}),(0,j.jsx)(le,{side:`right`,children:`Create remote branch and push local commits`})]})}),t[45]=i,t[46]=m,t[47]=g,t[48]=z):z=t[48];let B;t[49]!==a||t[50]!==m||t[51]!==g?(B=()=>{a&&!m&&g()},t[49]=a,t[50]=m,t[51]=g,t[52]=B):B=t[52];let Ie=!a||m?`opacity-50 cursor-not-allowed`:``,Le;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(Le=(0,j.jsx)(ce,{className:`h-3.5 w-3.5 mr-2`}),t[53]=Le):Le=t[53];let V;t[54]!==B||t[55]!==Ie?(V=(0,j.jsx)(we,{asChild:!0,children:(0,j.jsxs)(O,{onClick:B,className:Ie,children:[Le,`Push Commits`]})}),t[54]=B,t[55]=Ie,t[56]=V):V=t[56];let Re=a?m?`Push in progress...`:`Push your uncommitted commits to the remote branch`:`No commits to push - your branch is up to date with remote`,H;t[57]===Re?H=t[58]:(H=(0,j.jsx)(le,{side:`right`,children:Re}),t[57]=Re,t[58]=H);let U;t[59]!==V||t[60]!==H?(U=(0,j.jsx)(Se,{children:(0,j.jsxs)(he,{children:[V,H]})}),t[59]=V,t[60]=H,t[61]=U):U=t[61];let ze=m||ae,Be;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(Be=(0,j.jsx)(ee,{className:`h-3.5 w-3.5 mr-2`}),t[62]=Be):Be=t[62];let W;t[63]!==_||t[64]!==ze?(W=(0,j.jsxs)(O,{onClick:_,disabled:ze,children:[Be,`History`]}),t[63]=_,t[64]=ze,t[65]=W):W=t[65];let G;t[66]!==f||t[67]!==m||t[68]!==ue?(G=!f&&(0,j.jsxs)(O,{onClick:ue,disabled:m,children:[(0,j.jsx)(xe,{className:`h-3.5 w-3.5 mr-2`}),`Create Pull Request`,(0,j.jsx)(De,{children:`⌘⇧P`})]}),t[66]=f,t[67]=m,t[68]=ue,t[69]=G):G=t[69];let K;t[70]!==o||t[71]!==m||t[72]!==v?(K=o&&(0,j.jsxs)(O,{onClick:v,disabled:m,children:[(0,j.jsx)(u,{className:`h-3.5 w-3.5 mr-2`}),`Create Repo`]}),t[70]=o,t[71]=m,t[72]=v,t[73]=K):K=t[73];let q;t[74]!==m||t[75]!==fe||t[76]!==te?(q=te&&(0,j.jsxs)(O,{onClick:fe,disabled:m,children:[(0,j.jsx)(de,{className:`h-3.5 w-3.5 mr-2`}),`View in GitHub`]}),t[74]=m,t[75]=fe,t[76]=te,t[77]=q):q=t[77];let J;t[78]!==k||t[79]!==A||t[80]!==N||t[81]!==R||t[82]!==z||t[83]!==U||t[84]!==W||t[85]!==G||t[86]!==K||t[87]!==q||t[88]!==D?(J=(0,j.jsxs)(Te,{align:`end`,children:[D,k,Ae,A,N,R,z,U,W,G,K,q]}),t[78]=k,t[79]=A,t[80]=N,t[81]=R,t[82]=z,t[83]=U,t[84]=W,t[85]=G,t[86]=K,t[87]=q,t[88]=D,t[89]=J):J=t[89];let Ve;return t[90]!==b||t[91]!==J||t[92]!==E?(Ve=(0,j.jsxs)(Oe,{onOpenChange:b,children:[E,J]}),t[90]=b,t[91]=J,t[92]=E,t[93]=Ve):Ve=t[93],Ve}function Fe(){return{autoGenerateCommitMessage:t(),autoGeneratePRInfo:b(),privateRepositoryDefault:_(),newChatOnNewBranch:S()}}function F(e){e.autoGenerateCommitMessage!==void 0&&v(e.autoGenerateCommitMessage),e.autoGeneratePRInfo!==void 0&&x(e.autoGeneratePRInfo),e.privateRepositoryDefault!==void 0&&be(e.privateRepositoryDefault),e.newChatOnNewBranch!==void 0&&y(e.newChatOnNewBranch)}function I(e){return e?!0:(D({title:`Error`,description:`No thread selected`,variant:`destructive`}),!1)}function L(e){let t=e.split(`/`);return t.length>=2?{provider:t[0],model:t.slice(1).join(`/`)}:{provider:void 0,model:e}}function R(e,t,n){let[r,i]=(0,A.useState)(!1),[a,o]=(0,A.useState)(!1),s=()=>n?.id?n.provider?{provider:n.provider,model:n.id}:L(n.id):{provider:void 0,model:void 0};return{isGeneratingMessage:r,isGeneratingPRInfo:a,generateCommitMessageWithAI:(0,A.useCallback)(async()=>{if(!e)return null;try{i(!0);let{provider:t,model:n}=s();return await l(e,n,t)}catch(e){return console.error(`Failed to generate commit message:`,e),D({title:`Error`,description:e instanceof Error?e.message:`Failed to generate commit message`,variant:`destructive`}),null}finally{i(!1)}},[e,n]),generatePRInfoWithAI:(0,A.useCallback)(async()=>{if(!e)return null;try{o(!0);let{provider:t,model:n}=s();return await c(e,n,t)}catch(e){return console.error(`Failed to generate PR info:`,e),D({title:`Error`,description:e instanceof Error?e.message:`Failed to generate PR info`,variant:`destructive`}),null}finally{o(!1)}},[e,n])}}var z=(0,A.lazy)(()=>w(()=>import(`./commit-dialog-kTaKOsNO.js`).then(e=>({default:e.CommitDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))),B=(0,A.lazy)(()=>w(()=>import(`./pull-request-dialog-LJhZpT8C.js`).then(e=>({default:e.PullRequestDialog})),__vite__mapDeps([12,1,2,3,4,5,6,7,8,9,10,11]))),Ie=(0,A.lazy)(()=>w(()=>import(`./create-repo-dialog-gIZLk6LZ.js`).then(e=>({default:e.CreateRepoDialog})),__vite__mapDeps([13,1,2,3,4,5,6,7,8,9,10,11]))),Le=(0,A.lazy)(()=>w(()=>import(`./git-history-dialog-B2ABiCXZ.js`).then(e=>({default:e.GitHistoryDialog})),__vite__mapDeps([14,6,2]))),V=(0,A.lazy)(()=>w(()=>import(`./push-before-pr-dialog-DzBp93KT.js`).then(e=>({default:e.PushBeforePRDialog})),__vite__mapDeps([15,6,2]))),Re=(0,A.lazy)(()=>w(()=>import(`./pull-with-changes-dialog-BPIj9wIk.js`).then(e=>({default:e.PullWithChangesDialog})),__vite__mapDeps([16,5,2,6]))),H=(0,A.lazy)(()=>w(()=>import(`./merged-pr-dialog-CObeSEaB.js`).then(e=>({default:e.MergedPRDialog})),__vite__mapDeps([17,6,2,7,5])));function U(){return null}async function ze(e,t,n,r){r&&(await m(e,{title:r}),n({type:E.UpdateThreadTitle,projectId:t,threadId:e,title:r}))}function Be({projectId:e,threadId:t,layout:o=`bar`}){let s=Ae(),ee=T(e=>e.projectModelSelections[t]),c=T(t=>t.projects.find(t=>t.projectId===e)),[l,u]=(0,A.useState)(!1),[d,f]=(0,A.useState)(!1),[p,ae]=(0,A.useState)(!1),[ce,g]=(0,A.useState)(!1),[_,de]=(0,A.useState)(``),[v,y]=(0,A.useState)(``),[b,_e]=(0,A.useState)(``),[ve,x]=(0,A.useState)(!1),[be,xe]=(0,A.useState)(null),S=(0,A.useRef)(!1),Ce=(0,A.useRef)(!1),w=(0,A.useRef)(v),Te=(0,A.useRef)(b);w.current=v,Te.current=b;let[Ee,De]=(0,A.useState)(!1),[Oe,ke]=(0,A.useState)([]),[O,Ne]=(0,A.useState)(!1),[L,Be]=(0,A.useState)([]),[W,G]=(0,A.useState)(!1),[K,q]=(0,A.useState)(!1),[J,Ve]=(0,A.useState)(``),[He,Ue]=(0,A.useState)(``),[We,Ge]=(0,A.useState)(``),[Ke,qe]=(0,A.useState)(!1),[Je,Ye]=(0,A.useState)(!1),[Xe,Ze]=(0,A.useState)(!1),[Qe,$e]=(0,A.useState)(!1),et=(0,A.useRef)(null),tt=(0,A.useRef)(!1),Y=k(),{fetchUnifiedStatus:nt}=Y,X=R(t,e,ee),Z=(0,A.useRef)(null),rt=(0,A.useRef)(()=>{}),it=(0,A.useRef)(()=>{});(0,A.useEffect)(()=>()=>{Z.current!==null&&(clearInterval(Z.current),Z.current=null)},[]);async function Q(){ne();let e=await a();s({type:E.SetProjects,projects:e.projects})}let[$,at]=(0,A.useState)(()=>Fe()),ot=c?.commitMethod===n.Direct;(0,A.useEffect)(()=>{K&&c?.name&&!J&&Ve(c.name)},[K,c?.name,J]),(0,A.useEffect)(()=>{F($)},[$]);function st(){Ke||(qe(!0),fe().then(e=>Ge(e)).catch(()=>{}))}(0,A.useEffect)(()=>{if(!p){Ce.current=!1;return}if(p&&$.autoGenerateCommitMessage&&!_.trim()&&t&&!Ce.current){Ce.current=!0;async function e(){let e=await X.generateCommitMessageWithAI();e&&de(e)}e()}},[p,$.autoGenerateCommitMessage,t,X.generateCommitMessageWithAI,_]),(0,A.useEffect)(()=>{if(!ce){S.current=!1;return}if(ce&&$.autoGeneratePRInfo&&!w.current.trim()&&!Te.current.trim()&&t&&!S.current){S.current=!0;async function e(){let e=await X.generatePRInfoWithAI();e&&(y(e.title),_e(e.description),D({title:`Success`,description:`PR title and description generated`}))}e()}},[ce,$.autoGeneratePRInfo,t,X.generatePRInfoWithAI]),rt.current=dt,it.current=()=>g(!0),(0,A.useEffect)(()=>{function e(e){let t=e.key.toLowerCase();if((e.metaKey||e.ctrlKey)&&e.shiftKey&&!e.altKey){if(t===`c`){Y.hasChanges&&$.autoGenerateCommitMessage&&!l&&(e.preventDefault(),rt.current());return}t===`p`&&Y.commitsAheadOfDefault&&!Y.prExists&&!Y.hasChanges&&!l&&!ot&&(e.preventDefault(),it.current())}}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Y.commitsAheadOfDefault,Y.hasChanges,Y.prExists,$.autoGenerateCommitMessage,l,ot]),(0,A.useEffect)(()=>{Y.prExists&&Y.prState===`MERGED`&&et.current!==t&&(et.current=t,$e(!0)),d&&Y.prExists&&Y.prState===`OPEN`&&f(!1)},[Y.prExists,Y.prState,t,d]),(0,A.useEffect)(()=>{if(!d)return;let e=setTimeout(()=>{f(!1)},15e3);return()=>clearTimeout(e)},[d]),(0,A.useEffect)(()=>{let e=Y.prExists&&Y.prState===`OPEN`&&!Y.hasChanges&&!Y.hasUnpushedCommits;e&&!tt.current&&Q(),tt.current=e},[Y.hasChanges,Y.hasUnpushedCommits,Y.prExists,Y.prState]);async function ct(){if(_.trim()&&I(t))try{u(!0),await ie(t,_),de(``),ae(!1),await Y.fetchUnifiedStatus(!0),Q(),D({title:`Changes committed successfully`,description:`Your changes have been committed to '${Y.currentBranch}'.`}),Xe&&(Ze(!1),await ht())}catch(e){console.error(`Failed to commit:`,e),D({title:`Commit failed`,description:e instanceof Error?e.message:`Failed to commit changes`,variant:`destructive`})}finally{u(!1)}}async function lt(){if(Y.status===`Behind`&&!Y.hasChanges&&!Y.hasUnpushedCommits){await yt();return}if(Y.hasChanges){ae(!0);return}if(Y.prExists&&Y.prState===`OPEN`&&!Y.hasChanges&&!Y.hasUnpushedCommits){Y.prUrl&&await h(Y.prUrl);return}if(Y.commitsAheadOfDefault&&!Y.prExists&&!Y.hasChanges){g(!0);return}if(Y.hasUnpushedCommits&&Y.prExists){await pt();return}}async function ut(){let e=await X.generateCommitMessageWithAI();e&&de(e)}async function dt(){if(I(t))try{u(!0);let e=await X.generateCommitMessageWithAI();if(!e){D({title:`Quick Commit failed`,description:`Could not generate commit message`,variant:`destructive`});return}await ie(t,e),await Y.fetchUnifiedStatus(!0),Q(),D({title:`Changes committed successfully`,description:`Committed: ${e}`})}catch(e){console.error(`Quick commit failed:`,e),D({title:`Quick Commit failed`,description:e instanceof Error?e.message:`Failed to commit changes`,variant:`destructive`})}finally{u(!1)}}async function ft(){if(I(t))try{u(!0),await r(t),await Y.fetchUnifiedStatus()}catch(e){console.error(`Failed to fetch:`,e)}finally{u(!1)}}async function pt(){if(I(t))try{u(!0),await se(t),await Y.fetchUnifiedStatus(!0),Q(),Y.hasRemoteBranch?D({title:`Branch pushed successfully`,description:`Your branch '${Y.currentBranch}' has been pushed to the remote.`}):D({title:`Push completed`,description:`Changes have been pushed successfully.`})}catch(e){console.error(`Failed to push:`,e),D({title:`Push failed`,description:e instanceof Error?e.message:`Failed to push to remote`,variant:`destructive`})}finally{u(!1)}}async function mt(){if(I(t)){if(Y.hasChanges){Ye(!0);return}await ht()}}async function ht(){try{u(!0),await te(t),await Y.fetchUnifiedStatus(!0),Q(),D({title:`Pull successful`,description:`Latest changes have been pulled from remote.`})}catch(e){console.error(`Failed to pull:`,e),D({title:`Pull failed`,description:e instanceof Error?e.message:`Failed to pull from remote`,variant:`destructive`})}finally{u(!1)}}function gt(){Ye(!1),Ze(!0),ae(!0)}async function _t(){Ye(!1),await ht()}async function vt(){if(t)try{u(!0);let n=await oe(t);if($.newChatOnNewBranch){let n=`New Chat`;await m(t,{title:n}),e&&s({type:E.UpdateThreadTitle,projectId:e,threadId:t,title:n}),await me(t),s({type:E.ClearMessages}),setTimeout(()=>{(async()=>{try{let e=await pe(t);s({type:E.SetMessages,messages:e.messages})}catch(e){console.error(`Failed to refresh chat history after starting new chat:`,e)}})()},0)}ne();let r=await a();s({type:E.SetProjects,projects:r.projects}),D({title:`New branch created`,description:`Created new branch "${n.branchName}" on current thread`}),$e(!1),await Y.fetchUnifiedStatus(!0),setTimeout(()=>void Y.fetchUnifiedStatus(!0),1500)}catch(e){console.error(`Failed to create new branch:`,e),D({title:`Failed to create new branch`,description:e instanceof Error?e.message:`Unknown error occurred`,variant:`destructive`})}finally{u(!1)}}async function yt(){if(I(t))try{u(!0),await re(t),await Y.fetchUnifiedStatus(!0),Q(),D({title:`Branch synced successfully`,description:`Your branch '${Y.currentBranch}' has been synced with the latest changes`})}catch(e){console.error(`[sync] ✗ Failed to sync branch:`,e),D({title:`Sync failed`,description:e instanceof Error?e.message:`Failed to sync with default branch`,variant:`destructive`})}finally{u(!1)}}async function bt(){if(I(t))try{u(!0),f(!0);let n=await C(t,v,b);await ze(t,e,s,n.title??v),n.prUrl&&await h(n.prUrl),y(``),_e(``),g(!1),await Y.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 Y.fetchUnifiedStatus(!0)},2e3)}catch(e){console.error(`Failed to create PR:`,e);let t=e instanceof Error?e.message:`Failed to create PR`;t.includes(`push the current branch`)||t.includes(`--head flag`)?(g(!1),Ct({title:v,description:b})):(f(!1),D({title:`Create PR Failed`,description:t,variant:`destructive`}))}finally{u(!1)}}async function xt(){if(I(t))try{u(!0);let e=await i(t,J,He,$.privateRepositoryDefault);e.repoUrl&&setTimeout(()=>{h(e.repoUrl)},3e3),Ve(``),Ue(``),q(!1),await Y.fetchUnifiedStatus(),Q()}catch(e){console.error(`Failed to create repo:`,e)}finally{u(!1)}}async function St(){let e=await X.generatePRInfoWithAI();e&&(y(e.title),_e(e.description),D({title:`Success`,description:`PR title and description generated`}))}async function Ct(n){let r=n??be;if(!(!t||!r))try{u(!0),f(!0);try{await se(t)}catch(e){let n=e?.message??``;if(n.includes(`non-fast-forward`)||n.includes(`Updates were rejected because the tip of your current branch is behind`)){D({title:`Syncing branch before push`,description:`Your branch is behind remote. Pulling latest changes first...`});try{await re(t),await se(t)}catch{throw e}}else throw e}let n=await C(t,r.title,r.description);await ze(t,e,s,n.title??r.title),n.prUrl&&await h(n.prUrl),y(``),_e(``),xe(null),x(!1),await Y.fetchUnifiedStatus(!0),Q();let i=0;Z.current!==null&&clearInterval(Z.current),Z.current=setInterval(async()=>{if(i++,i>=6){Z.current!==null&&(clearInterval(Z.current),Z.current=null);return}await Y.fetchUnifiedStatus(!0)},2e3)}catch(e){console.error(`Failed to push and create PR:`,e);let t=e instanceof Error?e.message:`Failed to push and create PR`;f(!1),D({title:`Push & Create PR Failed`,description:t,variant:`destructive`})}finally{u(!1)}}async function wt(){if(I(t))try{Ne(!0);let e=await ue(t,100);ke(e),Be(e.slice(0,10)),De(!0)}catch(e){console.error(`Failed to fetch git history:`,e)}finally{Ne(!1)}}function Tt(){W||(G(!0),setTimeout(()=>{let e=L.length+10;Be(Oe.slice(0,e)),G(!1)},300))}function Et(e){let t=e.currentTarget;t.scrollHeight-t.scrollTop-t.clientHeight<100&&L.length<Oe.length&&!W&&Tt()}let Dt=P(Y);function Ot(){Y.repoUrl&&h(Y.repoUrl)}function kt(){x(!1),xe(null)}function At(){$e(!1),Y.fetchUnifiedStatus(!0)}return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:ge(`flex items-center gap-0`,o===`menu`&&`w-full flex-col gap-1 [&_button]:w-full [&_button]:justify-start`),children:[(0,j.jsx)(Se,{children:(0,j.jsxs)(he,{children:[(0,j.jsx)(we,{asChild:!0,children:(0,j.jsxs)(ye,{variant:`outline`,size:`sm`,className:ge(`h-8 gap-1.5`,o===`bar`&&`rounded-r-none border-r-0`,o===`menu`&&`rounded-md border`,Dt&&` border-transparent bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground`),disabled:N(Y,l,d),onClick:lt,children:[M(Y,d,l),je(Y,d)]})}),(0,j.jsx)(le,{children:Me(Y)})]})}),(0,j.jsx)(Pe,{branchStatus:Y.status,remoteUrl:Y.remoteUrl,hasRemoteBranch:Y.hasRemoteBranch,hasUnpushedCommits:Y.hasUnpushedCommits,canCreateRepo:Y.canCreateRepo,repoUrl:Y.repoUrl,isRefreshing:Y.isRefreshing,isBrandState:Dt,hasChanges:Y.hasChanges,gitUser:We,isDirectCommitMode:ot,autoGenerateCommitMessage:$.autoGenerateCommitMessage,isLoading:l||d,isLoadingHistory:O,isQuickCommitting:X.isGeneratingMessage&&l,onFetch:()=>void ft(),onPull:()=>void mt(),onPush:()=>void pt(),onOpenHistory:()=>void wt(),onCreatePR:()=>g(!0),onCreateRepo:()=>q(!0),onViewInGitHub:Ot,onQuickCommit:()=>void dt(),onOpenChange:e=>{e&&(st(),nt(!0))},layout:o})]}),p&&(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(U,{}),children:(0,j.jsx)(z,{open:p,onOpenChange:ae,commitMessage:_,onCommitMessageChange:de,autoGenerateCommitMessage:$.autoGenerateCommitMessage,onAutoGenerateChange:e=>at(t=>({...t,autoGenerateCommitMessage:e})),isGeneratingMessage:X.isGeneratingMessage,isLoading:l,onGenerateMessage:ut,onCommit:ct,currentBranch:Y.currentBranch})}),ce&&(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(U,{}),children:(0,j.jsx)(B,{open:ce,onOpenChange:g,prTitle:v,onPrTitleChange:y,prDescription:b,onPrDescriptionChange:_e,isGeneratingPRInfo:X.isGeneratingPRInfo,isLoading:l,onGeneratePRInfo:St,onCreatePR:bt,currentBranch:Y.currentBranch,autoGeneratePRInfo:$.autoGeneratePRInfo,onAutoGeneratePRInfoChange:e=>at(t=>({...t,autoGeneratePRInfo:e}))})}),ve&&(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(U,{}),children:(0,j.jsx)(V,{open:ve,onOpenChange:x,isLoading:l,onPushAndCreatePR:Ct,onCancel:kt})}),K&&(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(U,{}),children:(0,j.jsx)(Ie,{open:K,onOpenChange:q,repoName:J,onRepoNameChange:Ve,repoDescription:He,onRepoDescriptionChange:Ue,isPrivateRepo:$.privateRepositoryDefault,onPrivateRepoChange:e=>at(t=>({...t,privateRepositoryDefault:e})),isLoading:l,onCreateRepo:xt})}),Ee&&(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(U,{}),children:(0,j.jsx)(Le,{open:Ee,onOpenChange:De,commits:Oe,displayedCommits:L,isLoadingMore:W,onScroll:Et,currentBranch:Y.currentBranch})}),Je&&(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(U,{}),children:(0,j.jsx)(Re,{open:Je,onOpenChange:Ye,onCommitFirst:gt,onStashAndPull:_t,onCancel:()=>Ye(!1),isLoading:l})}),Qe&&(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(U,{}),children:(0,j.jsx)(H,{open:Qe,onOpenChange:$e,onNewBranch:vt,onJustOpen:At,newChatOnNewBranch:$.newChatOnNewBranch,onNewChatOnNewBranchChange:e=>at(t=>({...t,newChatOnNewBranch:e})),isLoading:l,projectName:c?.name})})]})}export{Be as GitOpsButton};
@@ -0,0 +1,9 @@
1
+ import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{$i as n,$r as r,Ai as i,Br as a,Co as o,Cr as s,Er as c,Fo as l,Gr as u,Hr as d,Io as f,Jr as p,Ki as m,Kr as h,La as g,Lo as _,Po as v,Qr as y,Rr as b,So as x,Sr as S,To as C,Tr as w,Ui as T,Ur as E,Vr as D,Wr as O,Xr as ee,Yr as k,_ as A,_r as te,br as j,c as ne,ci as re,di as ie,fi as M,fo as ae,gr as oe,hi as N,ii as P,ji as F,l as se,li as ce,mi as le,oi as ue,pi as I,qr as de,ri as fe,rt as pe,s as me,si as he,ti as ge,u as _e,ui as L,vr as ve,wo as ye,wr as be,xo as xe,yr as Se,zr as Ce}from"./dialogs-config-CxRnlUcQ.js";var R=l(),we=Object,Te=Map,Ee=Set,De=Ee.prototype.has,Oe=Ee.prototype.add,ke=Te.prototype.has,Ae=Te.prototype.get,je=Te.prototype.set,Me=1,Ne=2,Pe=4,Fe=8,Ie=16,Le=32,z=`__t`,Re=`__p`,ze=`__e`,Be=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ve=`http://www.w3.org/1999/xlink`,He=`http://www.w3.org/2000/xmlns/`,Ue=120,We=new Ee([`href`,`list`,`form`,`tabIndex`,`download`]),Ge=new Ee([`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 B=document;B.createElement(`template`);var Ke=B.createElement(`template`),qe=Ke.content,Je=B.createElementNS(`http://www.w3.org/2000/svg`,`svg`),V=Node.prototype,Ye=Element.prototype,Xe=CharacterData.prototype,Ze=we.getOwnPropertyDescriptor,Qe=V.insertBefore,$e=V.cloneNode,et=V.replaceChild,tt=Ye.remove,nt=V.addEventListener,rt=Ye.removeAttribute,it=Ye.setAttribute,at=Ye.setAttributeNS,ot=Ze(V,`textContent`).set,st=Ze(V,`firstChild`).get,ct=Ze(V,`nextSibling`).get,lt=Ze(Xe,`data`).set,ut=(e,t)=>{let n=t?Je:Ke;return n.innerHTML=e,(t?Je:qe).firstChild};B[ze]=new Ee;var dt=(e,t,n)=>{let r=t.toLowerCase(),i=!1;r.endsWith(`capture`)&&(r=r.slice(0,-7),i=!0);let a=`$$${r}`;De.call(B[ze],r)||(nt.call(B,r,e=>{let t=e.target;for(;t;){let n=t[a];n&&(we.defineProperty(e,`currentTarget`,{configurable:!0,get(){return t}}),n(e)),t=t.parentNode}},{capture:i}),Oe.call(B[ze],r));let o=t=>{t?`key`in t&&t.key===e[a]?.key||(e[a]=t):e[a]=null};return o(n),o},H=(e,t)=>{let n=st.call(e);if(t)for(let e=0;e<t&&n;++e)n=ct.call(n);return n},ft=new WeakSet,pt=e=>{if(ft.has(e))return;e.nodeType===8&&e.parentNode?.removeChild(e);let t=st.call(e);for(;t;)pt(t),t=t.nextSibling;ft.add(e)},mt=(e,t,n)=>{let r=B.createTextNode(t),i=H(e,n);return Qe.call(e,r,i),r},ht=(e,t)=>{lt.call(e,t)},gt=(e,t,n)=>{typeof n!=`number`||Be.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`},_t=(e,t,n)=>{t=t.replace(/xlink(?:H|:h)/,`h`).replace(/sName$/,`s`),t.startsWith(`xmlns`)?at.call(e,He,t,String(n)):t.startsWith(`xlink`)&&at.call(e,Ve,`href`,String(n))},vt=(e,t,n)=>{let r=n==null;if(n=r?``:n,t in e&&e[t]!==void 0&&e[t]!==null&&!(e instanceof SVGElement)&&De.call(We,t))try{e[t]=n}catch{}else !r&&n!==``&&(n!==!1||t.includes(`-`))?it.call(e,t,String(n)):rt.call(e,t);let i=e instanceof HTMLInputElement,a=e instanceof HTMLSelectElement,o=e instanceof HTMLTextAreaElement;t===`value`&&(i||a||o)&&(it.call(e,t,String(n)),e.value=n)},yt=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 bt(e){return yt.get(e)||e}var xt=Object.defineProperty,St=(e,t,n)=>t in e?xt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,U=(e,t,n)=>(St(e,typeof t==`symbol`?t:t+``,n),n),Ct=class{constructor(){U(this,`r`),U(this,`e`),U(this,`l`),U(this,`g`),U(this,`_u`),U(this,`_t`),U(this,`d`),U(this,`k`),U(this,`c`)}},wt=(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:Me,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=bt(t);if(i&&(t=i),t===`className`&&(t=`class`),t.startsWith(`on`)){`$`in n?a.e.push({t:Pe,n:t.slice(2),v:null,h:n.$,i:null,l:null,p:null,b:null}):a.i.push({t:Pe,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:Fe,n:t,v:null,h:n.$,i:null,l:null,p:null,b:null}):t.charCodeAt(0)===Ue?a.e.push({t:Ie,n:t,v:null,h:n.$,i:null,l:null,p:null,b:null}):a.e.push({t:Ne,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:Fe,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(De.call(Ge,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:Me,n:null,v:null,h:s.$,i:r,l:null,p:null,b:null});continue}if(s instanceof Ct){a.i.push({t:Le,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:Me,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+=wt(s,t,l)}return(a.i.length||a.e.length)&&t.push(a),`<${e.type}${r}>${i}</${e.type}>`},Tt=Object.defineProperty,Et=(e,t,n)=>t in e?Tt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Dt=(e,t,n)=>(Et(e,typeof t==`symbol`?t:t+``,n),n),Ot=e=>new kt(e),kt=class extends Ct{constructor(e){super(),Dt(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 Nt.call(this),a;if(r===0)return jt.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){Vt.call(u,d),n[s]=u,u=t[++o],d=n[++s];continue}let i=f.k,h=p.k;if(i===h){Vt.call(f,p),n[l]=f,f=t[--c],p=n[--l];continue}if(e===h){Vt.call(u,p),n[l]=u;let e=n[l+1];Ht.call(u,e,e?.l||null),u=t[++o],p=n[--l];continue}if(i===r){Vt.call(f,d),n[s]=f;let e=t[o];Ht.call(f,e,e?.l||null),f=t[--c],d=n[++s];continue}if(!m){m=new Te;for(let e=o;e<=c;e++)je.call(m,t[e].k,e)}let g=m.get(r);if(g===void 0)Bt.call(d,a,u.l||null);else{let e=t[g];Ht.call(e,u,null),Vt.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)Bt.call(n[t],a,e?e.l:null)}else for(let e=o;e<=c;++e)Ut.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];Bt.call(r,e,t)}return this._t=e,e}x(){let e=this.t();if(e)ot.call(e,``);else for(let e=0,t=this.b.length;e<t;++e)Ut.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}},At=kt.prototype,jt=At.m,Mt=At.p,Nt=At.x,Pt=new Proxy({},{get(e,t){return{$:t}}}),Ft=(e,t,n,r)=>{let i=e(Pt),a=[],o=ut(wt(t?t(i):i,a),r);return pt(o),(e,t,r)=>new Lt(o,a,e,t??e?.key??null,r??n??null,null)},It=(e,t)=>{if((`b`in e||`b`in t)&&Mt.call(e,t),e.l||Bt.call(e,void 0,null,null),e.k&&e.k===t.k||e.r===t.r)return Vt.call(e,t);let n=Bt.call(t,e.t(),e.l,null);return Ut.call(e),e.k=t.k,n},Lt=class extends Ct{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??$e.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]??Rt(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&Me){if(o instanceof Ct){let e=H(a,i.i);n?o.m(a,e,e):o.m(a,e);continue}if(a[z]||(a[z]=Array(r)),o&&typeof o==`object`&&`foreign`in o){if(n){let e=H(a,i.i);o.reset(e)}let t=o.current;a[z][e]=t,n||Qe.call(a,t,H(a,i.i));continue}if(n){a[z][e]=H(a,i.i);continue}a[z][e]=mt(a,o==null||o===!1?``:String(o),i.i)}else if(i.t&Pe){let e=dt(a,i.n,o);a[Re+i.n]=e}else if(i.t&Ne)vt(a,i.n,o);else if(i.t&Fe)if(typeof o==`string`||typeof o==`number`)gt(a,i.n,o);else for(let e in o)gt(a,e,o[e]);else _t(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&Me)r.v&&!n&&mt(a,r.v,r.i);else if(r.t&Pe)dt(a,r.n,r.l);else{let e=H(a,r.i);n?r.b.m(a,e,e):r.b.m(a,e)}}}return e&&!n&&Qe.call(e,r,t),this.l=r,r}p(e){let t=this.l;if(!e.d)return t;let n=this.d;if(!Wt.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]??Rt(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&Pe){a[Re+o.n](c);continue}if(o.t&Me){if(s instanceof Ct){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[z][t];if(c.unstable&&s!==c){let n=c.current;a[z][t]=n,et.call(a,n,e)}else c.current=e;continue}ht(a[z][t],c==null||c===!1?``:String(c))}else if(o.t&Ne)vt(a,o.n,c);else if(o.t&Fe)if(typeof c==`string`||typeof c==`number`)gt(a,o.n,c);else for(let e in c)c[e]!==s[e]&&gt(a,e,c[e]);else _t(a,o.n,c)}}}return t}v(e=null,t=null){Qe.call(this.t(),this.l,e?e.l:t)}x(){tt.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}},Rt=(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=H(t,r)}return a&&(n[r]=t),t},zt=Lt.prototype,Bt=zt.m,Vt=zt.p,Ht=zt.v,Ut=zt.x,Wt=zt.u,W=e(_(),1),Gt={noSlot:!1},Kt=e(f(),1),qt=`slot`,Jt=({effect:e,deps:t})=>((0,W.useEffect)(e,t||[]),null),G=new Map,Yt=(0,W.createContext)(!1),Xt=(e,t,n)=>{let r={ref:t},i=0;for(let t in e){let a=e[t];if((0,W.isValidElement)(a)||Array.isArray(a)&&a.length&&(0,W.isValidElement)(a[0])){r[t]=Qt(a,!1,n,i++);continue}r[t]=e[t]}return r},Zt=(e,t)=>(0,W.createElement)(qt,{suppressHydrationWarning:!0,id:t},e),Qt=(e,t,n,r,i)=>{let a=n?.[r]?.current,o=(0,W.isValidElement)(e)&&typeof e.type==`function`&&`_c`in e.type,s=o&&e.type._c;if(typeof window>`u`)return o?s?e:Zt(Zt(e),i):Zt(e,i);if(s){let t=e.type(e.props);if(G.has(t.type)){let e=G.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,Kt.createPortal)((0,W.createElement)(W.Fragment,{children:e}),c,i),reset:e=>{e.childNodes.forEach(t=>e.removeChild(t))},unstable:t};return n&&(n[r]=l),l},$t=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 $t(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=en(e.props.children).map(e=>$t(e))),{type:t,props:n}},en=e=>{if(e==null)return[];if(typeof e==`object`&&`type`in e&&e.type===W.Fragment)return en(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(...en(t[e]));return n},tn=typeof window>`u`?W.useEffect:W.useLayoutEffect;function nn(e,t,n){if(!e||t(e))return e;let r=n?e.return:e.child;for(;r;){let e=nn(r,t,n);if(e)return e;r=n?null:r.sibling}}function rn(){let e=(0,W.useRef)();return(0,W.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 an(e){let t=rn(),n=(0,W.useRef)({el:null,depth:0});return tn(()=>{n.current.el=nn(t,t=>(n.current.depth++,typeof t.type==`string`&&(e===void 0||t.type===e)),!0)?.stateNode},[t]),n}function on(){let e=rn(),t=(0,W.useRef)({el:null,depth:0});return tn(()=>{t.current.el=nn(e,e=>(t.current.depth++,e.stateNode?.containerInfo!=null),!0)?.stateNode.containerInfo},[e]),t}var sn=(e,t={})=>{let n=t?.experimental_noSlot??Gt.noSlot,r=t?.block,i=t?.svg?`g`:qt;e&&(r=Ft(e,$t,t?.shouldUpdate,t?.svg));let a=(e,a)=>{let o=on(),s=an(),c=e._hmr,l=(0,W.useRef)(null),u=(0,W.useRef)(null),d=(0,W.useRef)([]);e=Xt(e,a,d.current),u.current?.(e);let f=(0,W.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 \`${$e.call(l.current).outerHTML}\` element.
3
+ To avoid this error, \`experimental_options.noSlot\` should be false`))),(u.current===null||c)&&(Bt.call(i,l.current,null),u.current=e=>{It(i,r(e,e.key,t?.shouldUpdate))}),()=>{Ut.call(i)}},[]),p=(0,W.useMemo)(()=>n?null:(0,W.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,W.createElement)(W.Fragment,{},p,(0,W.createElement)(Jt,{effect:f,deps:c?[c]:[]}),h)};return ke.call(G,a)||je.call(G,a,sn),t?.name&&(e&&(e.displayName=`Million(Render(${t.name}))`),a.displayName=`Million(Block(${t.name}))`),a};(0,W.memo)(({each:e,children:t,memo:n,svg:r,as:i,...a})=>{let o=(0,W.useRef)(null),[s]=(0,W.useState)(()=>({current:Array(e.length)})),c=(0,W.useRef)(null),l=(0,W.useRef)({each:null,children:null,mounted:!1}),[,u]=(0,W.useState)(!1);if(c.current&&(e!==l.current.each||!n)){let r=cn(e,t,l,s,n);Mt.call(c.current,Ot(r))}let d=(0,W.createElement)(W.Fragment,null,(0,W.createElement)(i??(r?`g`:`slot`),{...a,ref:o}),...s.current.map(e=>e.portal));return(0,W.useEffect)(()=>{!o.current||c.current||l.current.mounted||(c.current=Ot(cn(e,t,l,s,n)),ke.call(G,d)||je.call(G,d,c.current),jt.call(c.current,o.current),l.current.mounted=!0,u(!0))},[o.current]),d});var cn=(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(ke.call(G,s.type)){o.block||=Ae.call(G,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(ke.call(G,e.type)){let t=Ae.call(G,e.type);if(typeof t==`function`){a[n]=t(e.props);continue}}}let c=Ft(e=>e?.scope),l=(e,t,n)=>c({scope:Qt((0,W.createElement)(s.type,e),!1,t.current,n)},s.key?String(s.key):void 0);je.call(G,s.type,l),o.block=l,a[n]=l(s.props,r,n)}return o.each=e,o.children=a,a};function ln(e,t){return e===t||e!==e&&t!==t}function un(e,t){for(let n in e)if(!ln(e[n],t[n]))return!0;return!1}function dn(e,{portals:t,...n}){let r=`CompiledBlock(Inner(${n.name}))`,i=sn(t=>e(t),{...n,scoped:void 0,name:r,shouldUpdate:un}),a=t?.length||0,o=t&&a>0?e=>{let n=(0,W.useContext)(Yt),[r]=(0,W.useState)(()=>[]),o={...e,scoped:n};for(let e=0;e<a;e++){let n=t[e];o[n]=Qt(o[n],!1,r,e)}let s=[];for(let e=0,t=r.length;e<t;e++)s[e]=r[e].portal;return(0,W.createElement)(W.Fragment,null,(0,W.createElement)(i,o),s)}:e=>(0,W.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 K=v(),fn=`AlertDialog`,[pn,mn]=ie(fn,[de]),q=de(),hn=e=>{let{__scopeAlertDialog:t,...n}=e,r=q(t);return(0,K.jsx)(E,{...r,...n,modal:!0})};hn.displayName=fn;var gn=`AlertDialogTrigger`,_n=W.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=q(n);return(0,K.jsx)(u,{...i,...r,ref:t})});_n.displayName=gn;var vn=`AlertDialogPortal`,yn=e=>{let{__scopeAlertDialog:t,...n}=e,r=q(t);return(0,K.jsx)(d,{...r,...n})};yn.displayName=vn;var bn=`AlertDialogOverlay`,xn=W.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=q(n);return(0,K.jsx)(D,{...i,...r,ref:t})});xn.displayName=bn;var Sn=`AlertDialogContent`,[Cn,wn]=pn(Sn),Tn=he(`AlertDialogContent`),En=W.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,a=q(n),o=W.useRef(null),s=T(t,o),c=W.useRef(null);return(0,K.jsx)(h,{contentName:Sn,titleName:Dn,docsSlug:`alert-dialog`,children:(0,K.jsx)(Cn,{scope:n,cancelRef:c,children:(0,K.jsxs)(Ce,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:M(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,K.jsx)(Tn,{children:r}),(0,K.jsx)(Fn,{contentRef:o})]})})})});En.displayName=Sn;var Dn=`AlertDialogTitle`,On=W.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=q(n);return(0,K.jsx)(O,{...i,...r,ref:t})});On.displayName=Dn;var kn=`AlertDialogDescription`,An=W.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=q(n);return(0,K.jsx)(a,{...i,...r,ref:t})});An.displayName=kn;var jn=`AlertDialogAction`,Mn=W.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=q(n);return(0,K.jsx)(b,{...i,...r,ref:t})});Mn.displayName=jn;var Nn=`AlertDialogCancel`,Pn=W.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=wn(Nn,n),a=q(n),o=T(t,i);return(0,K.jsx)(b,{...a,...r,ref:o})});Pn.displayName=Nn;var Fn=({contentRef:e})=>{let t=`\`${Sn}\` requires a description for the component to be accessible for screen reader users.
4
+
5
+ You can add a description to the \`${Sn}\` by passing a \`${kn}\` 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 \`${Sn}\`. 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 W.useEffect(()=>{document.getElementById(e.current?.getAttribute(`aria-describedby`))||console.warn(t)},[t,e]),null},In=hn,Ln=yn,Rn=xn,zn=En,Bn=Mn,Vn=Pn,Hn=On,Un=An,Wn=In,Gn=Ln,Kn=W.forwardRef((e,t)=>{let n=(0,R.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=N(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,K.jsx)(Rn,{className:a,...i,ref:t}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Kn.displayName=Rn.displayName;var qn=W.forwardRef((e,t)=>{let n=(0,R.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,K.jsx)(Kn,{}),n[3]=a):a=n[3];let o;n[4]===r?o=n[5]:(o=N(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,r),n[4]=r,n[5]=o);let s;return n[6]!==i||n[7]!==t||n[8]!==o?(s=(0,K.jsxs)(Gn,{children:[a,(0,K.jsx)(zn,{ref:t,className:o,...i})]}),n[6]=i,n[7]=t,n[8]=o,n[9]=s):s=n[9],s});qn.displayName=zn.displayName;var Jn=e=>{let t=(0,R.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=N(`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,K.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};Jn.displayName=`AlertDialogHeader`;var Yn=e=>{let t=(0,R.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=N(`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,K.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};Yn.displayName=`AlertDialogFooter`;var Xn=W.forwardRef((e,t)=>{let n=(0,R.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=N(F.dialogTitle,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,K.jsx)(Hn,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Xn.displayName=Hn.displayName;var Zn=W.forwardRef((e,t)=>{let n=(0,R.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=N(F.dialogDescription,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,K.jsx)(Un,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Zn.displayName=Un.displayName;var Qn=W.forwardRef((e,t)=>{let n=(0,R.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=N(le(),r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,K.jsx)(Bn,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Qn.displayName=Bn.displayName;var $n=W.forwardRef((e,t)=>{let n=(0,R.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=N(le({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,K.jsx)(Vn,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});$n.displayName=Vn.displayName;var er=dn(e=>(0,K.jsxs)(`div`,{className:e.v0,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h1`,{className:e.v1,children:e.v2}),e.v3]}),e.v4]}),{name:`PageHeader_1`,portals:[`v2`,`v3`,`v4`]}),tr=function(e){let t=(0,R.c)(12),{title:n,description:r,action:i,className:a,titleClassName:o}=e,s;t[0]===a?s=t[1]:(s=N(`flex items-center justify-between mb-6`,a),t[0]=a,t[1]=s);let c;t[2]===o?c=t[3]:(c=N(F.pageTitle,o),t[2]=o,t[3]=c);let l;t[4]===r?l=t[5]:(l=r?(0,K.jsx)(`p`,{className:F.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,K.jsx)(er,{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 nr(e){let t=(0,R.c)(5),{children:n,className:r}=e,a;t[0]===r?a=t[1]:(a=N(i.settingsPage,r),t[0]=r,t[1]=a);let o;return t[2]!==n||t[3]!==a?(o=(0,K.jsx)(`div`,{className:a,children:n}),t[2]=n,t[3]=a,t[4]=o):o=t[4],o}function rr(e){let t=(0,R.c)(5),{children:n,className:r}=e,a;t[0]===r?a=t[1]:(a=N(i.accountPage,r),t[0]=r,t[1]=a);let o;return t[2]!==n||t[3]!==a?(o=(0,K.jsx)(`div`,{className:a,children:n}),t[2]=n,t[3]=a,t[4]=o):o=t[4],o}function ir(e){let t=(0,R.c)(5),{children:n,className:r}=e,a;t[0]===r?a=t[1]:(a=N(i.formPage,r),t[0]=r,t[1]=a);let o;return t[2]!==n||t[3]!==a?(o=(0,K.jsx)(`div`,{className:a,children:n}),t[2]=n,t[3]=a,t[4]=o):o=t[4],o}function ar(e){let t=(0,R.c)(5),{title:n,className:r}=e,i;t[0]===r?i=t[1]:(i=N(F.sectionTitle,`mb-3`,r),t[0]=r,t[1]=i);let a;return t[2]!==i||t[3]!==n?(a=(0,K.jsx)(`h2`,{className:i,children:n}),t[2]=i,t[3]=n,t[4]=a):a=t[4],a}function or(e){let t=(0,R.c)(6),{children:n,variant:r,className:i}=e,a=r===void 0?`info`:r,o;t[0]!==i||t[1]!==a?(o=N(a===`hint`?F.hintBanner:a===`success`?N(F.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`?N(F.error,`bg-destructive/10 rounded-md px-3 py-2 mb-4`):F.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,K.jsx)(`div`,{className:o,children:n}),t[3]=n,t[4]=o,t[5]=s):s=t[5],s}function sr(e){let t=(0,R.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=N(`flex-1 overflow-auto`,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,K.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function cr(e){let t=(0,R.c)(10),{children:n,title:r,action:i}=e,a;t[0]===r?a=t[1]:(a=r?(0,K.jsx)(`h2`,{className:N(F.emptyStateTitle,`mb-2`),children:r}):null,t[0]=r,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,K.jsx)(`p`,{className:F.bodyMuted,children:n}),t[2]=n,t[3]=o);let s;t[4]===i?s=t[5]:(s=i?(0,K.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,K.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,K.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 lr(e){let t=(0,R.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=N(`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,K.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,R.c)(14),{title:n,description:r,action:i,children:a,className:o}=e,s;t[0]===n?s=t[1]:(s=(0,K.jsx)(ar,{title:n,className:`mb-1`}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=r?(0,K.jsx)(`p`,{className:F.bodyMuted,children:r}):null,t[2]=r,t[3]=c);let l;t[4]!==s||t[5]!==c?(l=(0,K.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,K.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,K.jsxs)(`div`,{className:o,children:[u,a]}),t[10]=a,t[11]=o,t[12]=u,t[13]=d):d=t[13],d}function dr(e){let t=W.useRef({value:e,previous:e});return W.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var fr=[` `,`Enter`,`ArrowUp`,`ArrowDown`],pr=[` `,`Enter`],J=`Select`,[mr,hr,gr]=me(J),[_r,vr]=ie(J,[gr,c]),yr=c(),[br,Y]=_r(J),[xr,Sr]=_r(J),Cr=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m}=e,h=yr(t),[g,_]=W.useState(null),[v,y]=W.useState(null),[b,x]=W.useState(!1),S=_e(l),[C,T]=re({prop:r,defaultProp:i??!1,onChange:a,caller:J}),[E,D]=re({prop:o,defaultProp:s,onChange:c,caller:J}),O=W.useRef(null),ee=g?m||!!g.closest(`form`):!0,[k,A]=W.useState(new Set),te=Array.from(k).map(e=>e.props.value).join(`;`);return(0,K.jsx)(w,{...h,children:(0,K.jsxs)(br,{required:p,scope:t,trigger:g,onTriggerChange:_,valueNode:v,onValueNodeChange:y,valueNodeHasChildren:b,onValueNodeHasChildrenChange:x,contentId:ce(),value:E,onValueChange:D,open:C,onOpenChange:T,dir:S,triggerPointerDownPosRef:O,disabled:f,children:[(0,K.jsx)(mr.Provider,{scope:t,children:(0,K.jsx)(xr,{scope:e.__scopeSelect,onNativeOptionAdd:W.useCallback(e=>{A(t=>new Set(t).add(e))},[]),onNativeOptionRemove:W.useCallback(e=>{A(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),ee?(0,K.jsxs)(gi,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:E,onChange:e=>D(e.target.value),disabled:f,form:m,children:[E===void 0?(0,K.jsx)(`option`,{value:``}):null,Array.from(k)]},te):null]})})};Cr.displayName=J;var wr=`SelectTrigger`,Tr=W.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=yr(n),o=Y(wr,n),s=o.disabled||r,c=T(t,o.onTriggerChange),l=hr(n),u=W.useRef(`touch`),[d,f,p]=vi(e=>{let t=l().filter(e=>!e.disabled),n=yi(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,K.jsx)(S,{asChild:!0,...a,children:(0,K.jsx)(P.button,{type:`button`,role:`combobox`,"aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":_i(o.value)?``:void 0,...i,ref:c,onClick:M(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:M(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:M(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&fr.includes(e.key)&&(m(),e.preventDefault())})})})});Tr.displayName=wr;var Er=`SelectValue`,Dr=W.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=Y(Er,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=T(t,c.onValueNodeChange);return L(()=>{l(u)},[l,u]),(0,K.jsx)(P.span,{...s,ref:d,style:{pointerEvents:`none`},children:_i(c.value)?(0,K.jsx)(K.Fragment,{children:o}):a})});Dr.displayName=Er;var Or=`SelectIcon`,kr=W.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,K.jsx)(P.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});kr.displayName=Or;var Ar=`SelectPortal`,jr=e=>(0,K.jsx)(y,{asChild:!0,...e});jr.displayName=Ar;var Mr=`SelectContent`,Nr=W.forwardRef((e,t)=>{let n=Y(Mr,e.__scopeSelect),[r,i]=W.useState();if(L(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?Kt.createPortal((0,K.jsx)(Pr,{scope:e.__scopeSelect,children:(0,K.jsx)(mr.Slot,{scope:e.__scopeSelect,children:(0,K.jsx)(`div`,{children:e.children})})}),t):null}return(0,K.jsx)(Lr,{...e,ref:t})});Nr.displayName=Mr;var X=10,[Pr,Z]=_r(Mr),Fr=`SelectContentImpl`,Ir=ue(`SelectContent.RemoveScroll`),Lr=W.forwardRef((e,t)=>{let{__scopeSelect:n,position:i=`item-aligned`,onCloseAutoFocus:a,onEscapeKeyDown:o,onPointerDownOutside:s,side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:_,avoidCollisions:v,...y}=e,b=Y(Mr,n),[x,S]=W.useState(null),[C,w]=W.useState(null),E=T(t,e=>S(e)),[D,O]=W.useState(null),[A,te]=W.useState(null),j=hr(n),[ne,re]=W.useState(!1),ie=W.useRef(!1);W.useEffect(()=>{if(x)return p(x)},[x]),ee();let ae=W.useCallback(e=>{let[t,...n]=j().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},[j,C]),oe=W.useCallback(()=>ae([D,x]),[ae,D,x]);W.useEffect(()=>{ne&&oe()},[ne,oe]);let{onOpenChange:N,triggerPointerDownPosRef:P}=b;W.useEffect(()=>{if(x){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():x.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})}}},[x,N,P]),W.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,se]=vi(e=>{let t=j().filter(e=>!e.disabled),n=yi(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),ce=W.useCallback((e,t,n)=>{let r=!ie.current&&!n;(b.value!==void 0&&b.value===t||r)&&(O(e),r&&(ie.current=!0))},[b.value]),le=W.useCallback(()=>x?.focus(),[x]),ue=W.useCallback((e,t,n)=>{let r=!ie.current&&!n;(b.value!==void 0&&b.value===t||r)&&te(e)},[b.value]),I=i===`popper`?Vr:zr,de=I===Vr?{side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:_,avoidCollisions:v}:{};return(0,K.jsx)(Pr,{scope:n,content:x,viewport:C,onViewportChange:w,itemRefCallback:ce,selectedItem:D,onItemLeave:le,itemTextRefCallback:ue,focusSelectedItem:oe,selectedItemText:A,position:i,isPositioned:ne,searchRef:F,children:(0,K.jsx)(k,{as:Ir,allowPinchZoom:!0,children:(0,K.jsx)(r,{asChild:!0,trapped:b.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:M(a,e=>{b.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,K.jsx)(ge,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:(0,K.jsx)(I,{role:`listbox`,id:b.contentId,"data-state":b.open?`open`:`closed`,dir:b.dir,onContextMenu:e=>e.preventDefault(),...y,...de,onPlaced:()=>re(!0),ref:E,style:{display:`flex`,flexDirection:`column`,outline:`none`,...y.style},onKeyDown:M(y.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&se(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=j().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(()=>ae(t)),e.preventDefault()}})})})})})})});Lr.displayName=Fr;var Rr=`SelectItemAlignedPosition`,zr=W.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=Y(Mr,n),o=Z(Mr,n),[s,c]=W.useState(null),[l,u]=W.useState(null),d=T(t,e=>u(e)),f=hr(n),p=W.useRef(!1),m=W.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=W.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-X,d=se(a,[X,Math.max(X,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-X,d=se(a,[X,Math.max(X,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-X*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-X,D=c-E,O=g.offsetHeight/2,ee=g.offsetTop+O,k=m+v+ee,A=x-k;if(k<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=k+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+A;s.style.height=t+`px`,h.scrollTop=k-E+h.offsetTop}s.style.margin=`${X}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);L(()=>y(),[y]);let[b,x]=W.useState();return L(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]),(0,K.jsx)(Hr,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:W.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,K.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,K.jsx)(P.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});zr.displayName=Rr;var Br=`SelectPopperPosition`,Vr=W.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=X,...a}=e,o=yr(n);return(0,K.jsx)(be,{...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)`}})});Vr.displayName=Br;var[Hr,Ur]=_r(Mr,{}),Wr=`SelectViewport`,Gr=W.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=Z(Wr,n),o=Ur(Wr,n),s=T(t,a.onViewportChange),c=W.useRef(0);return(0,K.jsxs)(K.Fragment,{children:[(0,K.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,K.jsx)(mr.Slot,{scope:n,children:(0,K.jsx)(P.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:M(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-X*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});Gr.displayName=Wr;var Kr=`SelectGroup`,[qr,Jr]=_r(Kr),Yr=W.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=ce();return(0,K.jsx)(qr,{scope:n,id:i,children:(0,K.jsx)(P.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Yr.displayName=Kr;var Xr=`SelectLabel`,Zr=W.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Jr(Xr,n);return(0,K.jsx)(P.div,{id:i.id,...r,ref:t})});Zr.displayName=Xr;var Qr=`SelectItem`,[$r,ei]=_r(Qr),ti=W.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=Y(Qr,n),c=Z(Qr,n),l=s.value===r,[u,d]=W.useState(a??``),[f,p]=W.useState(!1),m=T(t,e=>c.itemRefCallback?.(e,r,i)),h=ce(),g=W.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r===``)throw Error(`A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,K.jsx)($r,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:W.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,K.jsx)(mr.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,K.jsx)(P.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:M(o.onFocus,()=>p(!0)),onBlur:M(o.onBlur,()=>p(!1)),onClick:M(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:M(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:M(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:M(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:M(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:M(o.onKeyDown,e=>{c.searchRef?.current!==``&&e.key===` `||(pr.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});ti.displayName=Qr;var ni=`SelectItemText`,ri=W.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=Y(ni,n),s=Z(ni,n),c=ei(ni,n),l=Sr(ni,n),[u,d]=W.useState(null),f=T(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=W.useMemo(()=>(0,K.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return L(()=>(h(m),()=>g(m)),[h,g,m]),(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(P.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Kt.createPortal(a.children,o.valueNode):null]})});ri.displayName=ni;var ii=`SelectItemIndicator`,ai=W.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return ei(ii,n).isSelected?(0,K.jsx)(P.span,{"aria-hidden":!0,...r,ref:t}):null});ai.displayName=ii;var oi=`SelectScrollUpButton`,si=W.forwardRef((e,t)=>{let n=Z(oi,e.__scopeSelect),r=Ur(oi,e.__scopeSelect),[i,a]=W.useState(!1),o=T(t,r.onScrollButtonChange);return L(()=>{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,K.jsx)(ui,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});si.displayName=oi;var ci=`SelectScrollDownButton`,li=W.forwardRef((e,t)=>{let n=Z(ci,e.__scopeSelect),r=Ur(ci,e.__scopeSelect),[i,a]=W.useState(!1),o=T(t,r.onScrollButtonChange);return L(()=>{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,K.jsx)(ui,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});li.displayName=ci;var ui=W.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Z(`SelectScrollButton`,n),o=W.useRef(null),s=hr(n),c=W.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return W.useEffect(()=>()=>c(),[c]),L(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,K.jsx)(P.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:M(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:M(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:M(i.onPointerLeave,()=>{c()})})}),di=`SelectSeparator`,fi=W.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,K.jsx)(P.div,{"aria-hidden":!0,...r,ref:t})});fi.displayName=di;var pi=`SelectArrow`,mi=W.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=yr(n),a=Y(pi,n),o=Z(pi,n);return a.open&&o.position===`popper`?(0,K.jsx)(s,{...i,...r,ref:t}):null});mi.displayName=pi;var hi=`SelectBubbleInput`,gi=W.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=W.useRef(null),a=T(r,i),o=dr(t);return W.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,K.jsx)(P.select,{...n,style:{...j,...n.style},ref:a,defaultValue:t})});gi.displayName=hi;function _i(e){return e===``||e===void 0}function vi(e){let t=fe(e),n=W.useRef(``),r=W.useRef(0),i=W.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=W.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return W.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function yi(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=bi(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 bi(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var xi=Cr,Si=Tr,Ci=Dr,wi=kr,Ti=jr,Ei=Nr,Di=Gr,Oi=Zr,ki=ti,Ai=ri,ji=ai,Mi=si,Ni=li,Pi=fi,Fi=xi,Ii=Ci,Li=W.forwardRef((e,t)=>{let n=(0,R.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=N(`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,K.jsx)(wi,{asChild:!0,children:(0,K.jsx)(ye,{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,K.jsxs)(Si,{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});Li.displayName=Si.displayName;var Ri=W.forwardRef((e,t)=>{let n=(0,R.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=N(`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,K.jsx)(xe,{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,K.jsx)(Mi,{ref:t,className:a,...i,children:o}),n[6]=i,n[7]=t,n[8]=a,n[9]=s):s=n[9],s});Ri.displayName=Mi.displayName;var zi=W.forwardRef((e,t)=>{let n=(0,R.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=N(`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,K.jsx)(ye,{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,K.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=W.forwardRef((e,t)=>{let n=(0,R.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=N(`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,K.jsx)(Ri,{}),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=N(`p-1`,d),n[9]=d,n[10]=f);let p;n[11]!==r||n[12]!==f?(p=(0,K.jsx)(Di,{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,K.jsx)(zi,{}),n[14]=m):m=n[14];let h;return n[15]!==s||n[16]!==a||n[17]!==t||n[18]!==l||n[19]!==p?(h=(0,K.jsx)(Ti,{children:(0,K.jsxs)(Ei,{ref:t,className:l,position:s,...a,children:[u,p,m]})}),n[15]=s,n[16]=a,n[17]=t,n[18]=l,n[19]=p,n[20]=h):h=n[20],h});Bi.displayName=Ei.displayName;var Vi=W.forwardRef((e,t)=>{let n=(0,R.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=N(`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,K.jsx)(Oi,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Vi.displayName=Oi.displayName;var Hi=W.forwardRef((e,t)=>{let n=(0,R.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=N(`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,K.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,K.jsx)(ji,{children:(0,K.jsx)(C,{className:`h-4 w-4`})})}),n[6]=s):s=n[6];let c;n[7]===r?c=n[8]:(c=(0,K.jsx)(Ai,{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,K.jsxs)(ki,{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});Hi.displayName=ki.displayName;var Ui=W.forwardRef((e,t)=>{let n=(0,R.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=N(`-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,K.jsx)(Pi,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Ui.displayName=Pi.displayName;function Wi(e){let t=(0,R.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=N(`flex h-full items-center justify-center`,n),t[0]=n,t[1]=s);let c;t[2]===o?c=t[3]:(c=N(o,`animate-spin mx-auto text-muted-foreground`),t[2]=o,t[3]=c);let l;t[4]===c?l=t[5]:(l=(0,K.jsx)(g,{className:c}),t[4]=c,t[5]=l);let u;t[6]===r?u=t[7]:(u=r?(0,K.jsx)(`p`,{className:N(F.bodyMuted,`mt-2`),children:r}):null,t[6]=r,t[7]=u);let d;t[8]!==l||t[9]!==u?(d=(0,K.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,K.jsx)(`div`,{className:s,children:d}),t[11]=s,t[12]=d,t[13]=f):f=t[13],f}function Gi(){let e=(0,R.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsx)(`div`,{className:`space-y-1 px-2 py-2`,children:[1,2,3].map(Ki)}),e[0]=t):t=e[0],t}function Ki(e){return(0,K.jsx)(`div`,{className:`animate-pulse h-7 bg-muted rounded-full`},e)}function qi(){let e=(0,R.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsx)(`div`,{className:`animate-pulse h-4 bg-muted rounded mx-4 my-1`}),e[0]=t):t=e[0],t}var Ji=new Map;function Yi(e,t){let n=Ji.get(e);return n||(n={promise:t().catch(t=>{throw Ji.delete(e),t})},Ji.set(e,n)),n.promise}function Xi(e){Ji.delete(e)}function Zi(e){for(let t of Ji.keys())t.startsWith(e)&&Ji.delete(t)}function Qi(e,t){return(0,W.use)(Yi(e,t))}var $i=W.forwardRef((e,t)=>{let n=(0,R.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=N(`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,K.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});$i.displayName=`Card`;var ea=W.forwardRef((e,t)=>{let n=(0,R.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=N(`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,K.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ea.displayName=`CardHeader`;var ta=W.forwardRef((e,t)=>{let n=(0,R.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=N(F.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,K.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ta.displayName=`CardTitle`;var na=W.forwardRef((e,t)=>{let n=(0,R.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=N(F.bodyMuted,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,K.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});na.displayName=`CardDescription`;var ra=W.forwardRef((e,t)=>{let n=(0,R.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=N(`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,K.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ra.displayName=`CardContent`;var ia=W.forwardRef((e,t)=>{let n=(0,R.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=N(`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,K.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ia.displayName=`CardFooter`;var aa=class extends W.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`AsyncErrorBoundary caught an error:`,e,t)}handleRetry=()=>{this.setState({error:null}),this.props.onRetry?.()};render(){let{error:e}=this.state;return e?this.props.renderFallback?this.props.renderFallback(e,this.handleRetry):(0,K.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,K.jsxs)($i,{className:`max-w-md`,children:[(0,K.jsx)(ea,{children:(0,K.jsx)(ta,{className:`text-destructive`,children:this.props.fallbackTitle??`Something went wrong`})}),(0,K.jsxs)(ra,{className:`space-y-4`,children:[(0,K.jsx)(`p`,{className:F.body,children:e.message}),(0,K.jsx)(I,{variant:`outline`,onClick:this.handleRetry,children:`Retry`})]})]})}):this.props.children}},oa=W.forwardRef((e,t)=>{let n=(0,R.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=N(`w-full caption-bottom`,F.body,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,K.jsx)(`div`,{className:`relative w-full overflow-auto`,children:(0,K.jsx)(`table`,{ref:t,className:a,...i})}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});oa.displayName=`Table`;var sa=W.forwardRef((e,t)=>{let n=(0,R.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=N(`[&_tr]:border-b`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,K.jsx)(`thead`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});sa.displayName=`TableHeader`;var ca=W.forwardRef((e,t)=>{let n=(0,R.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=N(`[&_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,K.jsx)(`tbody`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ca.displayName=`TableBody`;var la=W.forwardRef((e,t)=>{let n=(0,R.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=N(`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,K.jsx)(`tfoot`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});la.displayName=`TableFooter`;var ua=W.forwardRef((e,t)=>{let n=(0,R.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=N(`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,K.jsx)(`tr`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ua.displayName=`TableRow`;var Q=W.forwardRef((e,t)=>{let n=(0,R.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=N(`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,K.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 $=W.forwardRef((e,t)=>{let n=(0,R.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=N(`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,K.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 da=W.forwardRef((e,t)=>{let n=(0,R.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=N(F.caption,`mt-4`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,K.jsx)(`caption`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});da.displayName=`TableCaption`;var fa=t({ConversationHistoryView:()=>Sa,default:()=>Sa}),pa=dn(e=>(0,K.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,K.jsxs)(`div`,{className:`max-w-md text-center space-y-2`,children:[(0,K.jsx)(`h3`,{className:e.v0,children:`No history`}),(0,K.jsx)(`p`,{className:e.v1,children:`No conversation history found for this thread.`})]})}),{name:`ConversationHistoryContent_1`}),ma=dn(e=>(0,K.jsxs)(`slot`,{children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between border-b py-3 px-0`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.v0,e.v1]}),(0,K.jsxs)(`div`,{className:e.v2,children:[e.v3,` of `,e.v4,` messages`]})]}),e.v5]}),{name:`ConversationHistoryContent_2`,portals:[`v0`,`v1`,`v3`,`v4`,`v5`]}),ha=function(e){let t=(0,R.c)(39),{scope:n,projects:r,loadVersion:i,currentPromptIndex:a,onPromptIndexChange:s}=e,c;t[0]!==i||t[1]!==n?(c=ba(n,i),t[0]=i,t[1]=n,t[2]=c):c=t[2];let l;t[3]!==r||t[4]!==n?(l=()=>xa(n,r),t[3]=r,t[4]=n,t[5]=l):l=t[5];let u=Qi(c,l),d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=function(e){return new Date(e).toLocaleString()},t[6]=d):d=t[6];let f=d,p;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(p=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]=p):p=t[7];let m=p,h;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(h=function(e){return{inputTokens:e.inputTokens??0,outputTokens:e.outputTokens??0}},t[8]=h):h=t[8];let g=h,_;t[9]!==a||t[10]!==u.messages||t[11]!==s?(_=function(){u.messages&&a<u.messages.length-1&&s(a+1)},t[9]=a,t[10]=u.messages,t[11]=s,t[12]=_):_=t[12];let v=_,y;t[13]!==a||t[14]!==s?(y=function(){a>0&&s(a-1)},t[13]=a,t[14]=s,t[15]=y):y=t[15];let b=y;if(!u.messages?.length){let e;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,K.jsx)(pa,{v0:F.emptyStateTitle,v1:F.bodyMuted}),t[16]=e):e=t[16],e}let S=a===0,C;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,K.jsx)(o,{className:`h-4 w-4 mr-1`}),t[17]=C):C=t[17];let w;t[18]!==b||t[19]!==S?(w=(0,K.jsx)(I,{variant:`outline`,size:`sm`,onClick:b,disabled:S,children:C}),t[18]=b,t[19]=S,t[20]=w):w=t[20];let T=a>=u.messages.length-1,E;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,K.jsx)(x,{className:`h-4 w-4 ml-1`}),t[21]=E):E=t[21];let D;t[22]!==v||t[23]!==T?(D=(0,K.jsx)(I,{variant:`outline`,size:`sm`,onClick:v,disabled:T,children:E}),t[22]=v,t[23]=T,t[24]=D):D=t[24];let O=a+1,ee=u.messages.length,k;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,K.jsx)(sa,{children:(0,K.jsxs)(ua,{children:[(0,K.jsx)(Q,{children:`Prompt`}),(0,K.jsx)(Q,{children:`Answer`}),(0,K.jsx)(Q,{className:`w-24`,children:`Model`}),(0,K.jsx)(Q,{className:`w-24 text-right`,children:`Duration`}),(0,K.jsx)(Q,{className:`w-20 text-right`,children:`Input Tokens`}),(0,K.jsx)(Q,{className:`w-20 text-right`,children:`Output Tokens`}),(0,K.jsx)(Q,{className:`w-32 text-right`,children:`Timestamp`})]})}),t[25]=k):k=t[25];let A;if(t[26]!==a||t[27]!==u.messages){let e;t[29]===a?e=t[30]:(e=(e,t)=>{let{inputTokens:n,outputTokens:r}=g(e);return(0,K.jsxs)(ua,{className:t===a?`bg-muted/50`:``,children:[(0,K.jsx)($,{className:`max-w-md`,children:(0,K.jsx)(`div`,{className:F.body,children:(0,K.jsx)(_a,{text:e.request.message})})}),(0,K.jsx)($,{className:`max-w-md`,children:e.response?(0,K.jsx)(`div`,{className:F.body,children:(0,K.jsx)(_a,{text:e.response.content})}):(0,K.jsx)(`span`,{className:N(F.bodyMuted,`italic`),children:`No response`})}),(0,K.jsx)($,{children:(0,K.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(ae,{className:`h-3 w-3 text-muted-foreground`}),(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:e.request.model})]})}),(0,K.jsx)($,{className:N(F.caption,`text-right`),children:e.response?(0,K.jsx)(ve,{children:(0,K.jsxs)(oe,{children:[(0,K.jsx)(Se,{asChild:!0,children:(0,K.jsx)(`div`,{className:`cursor-help`,children:m(e.timestamp,e.response.completedAt).display})}),(0,K.jsx)(te,{children:(0,K.jsx)(`p`,{children:m(e.timestamp,e.response.completedAt).tooltip})})]})}):(0,K.jsx)(`span`,{className:`text-muted-foreground italic`,children:`-`})}),(0,K.jsx)($,{className:N(F.bodyMuted,`text-right`),children:n>0?n.toLocaleString():`-`}),(0,K.jsx)($,{className:N(F.bodyMuted,`text-right`),children:r>0?r.toLocaleString():`-`}),(0,K.jsx)($,{className:N(F.bodyMuted,`text-right`),children:f(e.timestamp)})]},e.id)},t[29]=a,t[30]=e),A=u.messages.map(e),t[26]=a,t[27]=u.messages,t[28]=A}else A=t[28];let j;t[31]===A?j=t[32]:(j=(0,K.jsx)(ne,{className:`h-full`,children:(0,K.jsx)(`div`,{className:`py-4`,children:(0,K.jsxs)(oa,{children:[k,(0,K.jsx)(ca,{children:A})]})})}),t[31]=A,t[32]=j);let re;return t[33]!==u.messages.length||t[34]!==w||t[35]!==D||t[36]!==O||t[37]!==j?(re=(0,K.jsx)(ma,{v0:w,v1:D,v2:F.bodyMuted,v3:O,v4:ee,v5:j}),t[33]=u.messages.length,t[34]=w,t[35]=D,t[36]=O,t[37]=j,t[38]=re):re=t[38],re},ga=`__ALL_PROJECTS__`;function _a(e){let t=(0,R.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,K.jsx)(K.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,K.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,K.jsxs)(K.Fragment,{children:[a,o]}),t[6]=a,t[7]=s),s}function va(e,t){let n=`${t} - `,r=e.title??e.threadId;return r.startsWith(n)?r.slice(n.length):r}async function ya(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){console.warn(`Failed to load history for thread ${i.threadId}:`,e)}return t.sort((e,t)=>new Date(t.timestamp).getTime()-new Date(e.timestamp).getTime()),{messages:t,conversationIds:Array.from(n),lastUpdated:r??new Date().toISOString()}}function ba(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 xa(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 ya(n.threads);return{threadId:e.projectId,...r}}return{threadId:ga,...await ya(t.flatMap(e=>e.threads))}}var Sa=(0,W.memo)(function({isOpen:e,onClose:t,initialFilter:r,projects:i,inline:a}){let[o,s]=(0,W.useState)(0),[c,l]=(0,W.useState)(``),[u,d]=(0,W.useState)(``),[f,p]=(0,W.useState)(!1),[h,g]=(0,W.useState)(!1),[_,v]=(0,W.useState)(0),[y,b]=(0,W.useState)(null),[x,S]=(0,W.useState)(null),C=(0,W.useMemo)(()=>u?{type:`thread`,threadId:u}:c===ga?{type:`all`}:c?{type:`project`,projectId:c}:null,[c,u]),w=C?ba(C,_):null;(0,W.useEffect)(()=>{e&&r?r.type===`thread`?(d(r.id),l(``),s(0)):r.type===`project`&&(l(r.id),d(``),s(0)):e&&!r?(l(ga),d(``),s(0)):e||(d(``),l(``),s(0),S(null),b(null))},[e,r]);let T=e=>{d(e),l(``),s(0),b(null),S(null)},E=e=>{l(e),d(``),s(0),b(null),S(null)},D=(0,W.useCallback)(()=>{if(u){let e=i.flatMap(e=>e.threads).find(e=>e.threadId===u),t=i.find(e=>e.threads.some(e=>e.threadId===u)),n=e?va(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!==ga){let e=i.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.`}},[i,c,u]),O=(0,W.useCallback)(async()=>{let e=D();g(!0),S(null);try{await A(e.options),w&&Xi(w),b(w),s(0),p(!1)}catch(e){S(e instanceof Error?e.message:`Failed to clear conversation history`)}finally{g(!1)}},[D,w]);function ee(){C&&Xi(ba(C,_)),v(e=>e+1),b(null),S(null)}let k=D();if(!e)return null;let te=(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(Fi,{value:c,onValueChange:E,children:[(0,K.jsx)(Li,{className:`w-48`,children:(0,K.jsx)(Ii,{placeholder:`Select project`})}),(0,K.jsxs)(Bi,{children:[(0,K.jsx)(Hi,{value:ga,children:`All Projects`}),i.map(e=>(0,K.jsx)(Hi,{value:e.projectId,children:e.name??e.projectId},e.projectId))]})]}),(0,K.jsxs)(Fi,{value:u,onValueChange:T,children:[(0,K.jsx)(Li,{className:`w-48`,children:(0,K.jsx)(Ii,{placeholder:`Select thread`})}),(0,K.jsx)(Bi,{children:i.flatMap(e=>e.threads.map(t=>(0,K.jsx)(Hi,{value:t.threadId,children:va(t,e.name??e.projectId)},t.threadId)))})]}),(0,K.jsxs)(I,{variant:`outline`,size:`sm`,onClick:()=>p(!0),disabled:h,children:[(0,K.jsx)(n,{className:`h-4 w-4 mr-2`}),`Clear`]})]}),j=(0,K.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,K.jsx)(`div`,{className:a?void 0:`border-b px-6 py-4`,children:(0,K.jsx)(tr,{title:`History`,description:a?`View and browse conversation history across projects and threads.`:void 0,action:(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[te,a?null:(0,K.jsx)(I,{variant:`action`,size:`icon-sm`,onClick:t,children:(0,K.jsx)(m,{})})]})})}),(0,K.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:x?(0,K.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,K.jsxs)($i,{className:`max-w-md`,children:[(0,K.jsx)(ea,{children:(0,K.jsx)(ta,{className:`text-destructive`,children:`Error`})}),(0,K.jsxs)(ra,{className:`space-y-4`,children:[(0,K.jsx)(`p`,{children:x}),(0,K.jsx)(I,{onClick:()=>S(null),children:`Dismiss`})]})]})}):y&&y===w?(0,K.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,K.jsxs)(`div`,{className:`max-w-md text-center space-y-2`,children:[(0,K.jsx)(`h3`,{className:F.emptyStateTitle,children:`No history`}),(0,K.jsx)(`p`,{className:F.bodyMuted,children:`No conversation history found for this thread.`})]})}):C?(0,K.jsx)(aa,{fallbackTitle:`Failed to load conversation history`,onRetry:ee,children:(0,K.jsx)(W.Suspense,{fallback:(0,K.jsx)(Wi,{label:`Loading conversation history...`,size:`lg`}),children:(0,K.jsx)(ha,{scope:C,projects:i,loadVersion:_,currentPromptIndex:o,onPromptIndexChange:s},w??void 0)})}):(0,K.jsx)(Wi,{label:`Loading conversation history...`,size:`lg`})})]});return(0,K.jsxs)(K.Fragment,{children:[a?(0,K.jsx)(sr,{children:(0,K.jsx)(nr,{className:`max-w-none w-full h-full flex flex-col min-h-0`,children:j})}):(0,K.jsx)(`div`,{className:`fixed inset-0 z-50 bg-background`,children:j}),(0,K.jsx)(Wn,{open:f,onOpenChange:p,children:(0,K.jsxs)(qn,{children:[(0,K.jsxs)(Jn,{children:[(0,K.jsx)(Xn,{children:k.title}),(0,K.jsx)(Zn,{children:k.description})]}),(0,K.jsxs)(Yn,{children:[(0,K.jsx)($n,{disabled:h,children:`Cancel`}),(0,K.jsx)(Qn,{onClick:e=>{e.preventDefault(),O()},disabled:h,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:h?`Clearing...`:`Clear`})]})]})})]})});export{$n as A,ar as C,sr as D,nr as E,Xn as F,dn as I,Zn as M,Yn as N,Wn as O,Jn as P,tr as S,cr as T,dr as _,Qi as a,ur as b,qi as c,Fi as d,Bi as f,Ii as g,Li as h,ra as i,qn as j,Qn as k,Wi as l,Ui as m,aa as n,Xi as o,Hi as p,$i as r,Zi as s,fa as t,Gi as u,rr as v,lr as w,or as x,ir as y};