tarsk 0.5.49 → 0.5.50

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 (83) hide show
  1. package/dist/index.js +10644 -8487
  2. package/dist/public/assets/{account-view-DxHV7OtO.js → account-view-orctnHTc.js} +1 -1
  3. package/dist/public/assets/{api-Dhzdgb40.js → api-_tZksLaY.js} +1 -1
  4. package/dist/public/assets/{browser-tab-qhf-xKwZ.js → browser-tab-bfjSH9LH.js} +1 -1
  5. package/dist/public/assets/commit-dialog-BAFsxiuw.js +1 -0
  6. package/dist/public/assets/{context-menu-PIC-g8wy.js → context-menu-CeBh_Q21.js} +1 -1
  7. package/dist/public/assets/{create-repo-dialog-CsjpTBPU.js → create-repo-dialog-D6cKAxMh.js} +1 -1
  8. package/dist/public/assets/{dialogs-config-BEazgV7k.js → dialogs-config-COzptu1b.js} +14 -14
  9. package/dist/public/assets/diff-view-CFu5DBIy.js +3 -0
  10. package/dist/public/assets/{explorer-tab-view--ib_BjId.js → explorer-tab-view-yR_3TyF7.js} +2 -2
  11. package/dist/public/assets/explorer-tree-DKrWFiee.js +1 -0
  12. package/dist/public/assets/explorer-view-DYbdTXTm.js +1 -0
  13. package/dist/public/assets/git-history-dialog-CTJwMGDA.js +1 -0
  14. package/dist/public/assets/git-ops-button-DM9h9L8O.js +2 -0
  15. package/dist/public/assets/history-view-BJ65FVAN.js +9 -0
  16. package/dist/public/assets/index-BMgOr4si.js +73 -0
  17. package/dist/public/assets/index-DzUALYN4.css +1 -0
  18. package/dist/public/assets/{mcp-server-card-ChdAZekt.js → mcp-server-card-7DWtYR7B.js} +1 -1
  19. package/dist/public/assets/{merged-pr-dialog-DAXqT4Xe.js → merged-pr-dialog-D6ReZlV4.js} +1 -1
  20. package/dist/public/assets/model-star-rating-DmWIerry.js +1 -0
  21. package/dist/public/assets/onboarding-pVfMmu_a.js +1 -0
  22. package/dist/public/assets/project-settings-view-CvPC_OvN.js +1 -0
  23. package/dist/public/assets/providers-list-view-BEBGDXvF.js +1 -0
  24. package/dist/public/assets/pull-request-dialog-DD9Yxl2t.js +1 -0
  25. package/dist/public/assets/pull-with-changes-dialog-yEIyN-rw.js +1 -0
  26. package/dist/public/assets/push-before-pr-dialog-09SWB4nh.js +1 -0
  27. package/dist/public/assets/{radio-group-n9qyUxmu.js → radio-group-DAndqwXy.js} +1 -1
  28. package/dist/public/assets/react-vendor-CEpXTE2b.js +16 -0
  29. package/dist/public/assets/settings-general-view-Crc9BTRv.js +1 -0
  30. package/dist/public/assets/settings-instructions-view-CB-cGPIr.js +1 -0
  31. package/dist/public/assets/settings-list-C5XuK_4u.js +1 -0
  32. package/dist/public/assets/settings-mcp-servers-view-CZR7I1h2.js +5 -0
  33. package/dist/public/assets/{settings-models-skeleton-Cse6L-Nd.js → settings-models-skeleton-ZtGznNlV.js} +1 -1
  34. package/dist/public/assets/settings-models-view-CB0rRPNa.js +1 -0
  35. package/dist/public/assets/settings-rules-view-BnoxoZfX.js +8 -0
  36. package/dist/public/assets/settings-skills-view-DKXDiK3e.js +3 -0
  37. package/dist/public/assets/settings-slash-commands-view-DtTuDEFe.js +1 -0
  38. package/dist/public/assets/settings-subagents-view-DNcPuqd5.js +2 -0
  39. package/dist/public/assets/{settings-system-prompt-view-B1vc2cgC.js → settings-system-prompt-view-BLkM6rN5.js} +1 -1
  40. package/dist/public/assets/{settings-view-DLBIkYoA.js → settings-view-BX2dUb7a.js} +2 -2
  41. package/dist/public/assets/{skeleton-6mGMglV0.js → skeleton-CxK1dTki.js} +1 -1
  42. package/dist/public/assets/slug-utils-D3-onmIf.js +1 -0
  43. package/dist/public/assets/{tabs-iUSYYupj.js → tabs-Tmfp1NOE.js} +1 -1
  44. package/dist/public/assets/{terminal-panel-DIpnKR-N.js → terminal-panel-DKkr68gm.js} +1 -1
  45. package/dist/public/assets/todos-view-_rD_cv7x.js +17 -0
  46. package/dist/public/assets/{ui-components-kSaUEA_X.js → ui-components-BhYSDqpD.js} +1 -1
  47. package/dist/public/assets/{use-deferred-search-DGJskNBr.js → use-deferred-search-DXiiWEeH.js} +1 -1
  48. package/dist/public/assets/{utils-CECQ_-6N.js → utils-DDUhUTLy.js} +1 -1
  49. package/dist/public/assets/{vosk-speech-CgILeNJR.js → vosk-speech-BHa2mKnm.js} +2 -2
  50. package/dist/public/assets/{web-BWAZk7ug.js → web-3Ems3Koj.js} +1 -1
  51. package/dist/public/assets/{web-BD1sqxMq.js → web-6JeYEnKU.js} +1 -1
  52. package/dist/public/assets/{web-DGalafxk.js → web-BYoghlKk.js} +1 -1
  53. package/dist/public/assets/{web-Dt5YgbhM.js → web-Dgmyivst.js} +1 -1
  54. package/dist/public/index.html +8 -8
  55. package/package.json +1 -1
  56. package/dist/public/assets/commit-dialog-DcVXFOBP.js +0 -1
  57. package/dist/public/assets/diff-view-CGEl0YbC.js +0 -3
  58. package/dist/public/assets/explorer-tree-CiPMm5ck.js +0 -1
  59. package/dist/public/assets/explorer-view-odyQutTO.js +0 -1
  60. package/dist/public/assets/git-history-dialog-qUZ7Qsp4.js +0 -1
  61. package/dist/public/assets/git-ops-button-Bced-_39.js +0 -2
  62. package/dist/public/assets/history-view-BMVTxWTg.js +0 -9
  63. package/dist/public/assets/index-C7FLshNp.css +0 -1
  64. package/dist/public/assets/index-_SOdLUMq.js +0 -73
  65. package/dist/public/assets/model-star-rating-BzpXBjSo.js +0 -1
  66. package/dist/public/assets/onboarding-Bi5MieW-.js +0 -1
  67. package/dist/public/assets/project-settings-view-CHV6lJG4.js +0 -1
  68. package/dist/public/assets/providers-list-view-Dgid2Wui.js +0 -1
  69. package/dist/public/assets/pull-request-dialog-BFgRF5AH.js +0 -1
  70. package/dist/public/assets/pull-with-changes-dialog-oGP-j8Yw.js +0 -1
  71. package/dist/public/assets/push-before-pr-dialog-BQ0QC6Qu.js +0 -1
  72. package/dist/public/assets/react-vendor-iDwBzcYF.js +0 -16
  73. package/dist/public/assets/settings-general-view-Vwi9J6Tn.js +0 -1
  74. package/dist/public/assets/settings-instructions-view-8YIr0PO3.js +0 -1
  75. package/dist/public/assets/settings-list-owWkHWxE.js +0 -1
  76. package/dist/public/assets/settings-mcp-servers-view-CCXW_uet.js +0 -5
  77. package/dist/public/assets/settings-models-view-BAxf3eJq.js +0 -1
  78. package/dist/public/assets/settings-rules-view-D3KLTKVZ.js +0 -8
  79. package/dist/public/assets/settings-skills-view-DaqOna-w.js +0 -3
  80. package/dist/public/assets/settings-slash-commands-view-CN8_DTYX.js +0 -1
  81. package/dist/public/assets/settings-subagents-view-BIejA-ck.js +0 -2
  82. package/dist/public/assets/slug-utils-BT1eqWhW.js +0 -1
  83. package/dist/public/assets/todos-view-BK6i_oPT.js +0 -17
@@ -0,0 +1,3 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$ as t,$i as n,$r as r,Ao as i,Do as a,Fr as o,It as s,K as c,Ka as l,Lr as u,Ni as d,Oo as f,Pr as p,Qo as m,Sa as h,Un as g,Yr as _,Zo as v,Zr as y,Zt as ee,c as b,co as x,ei as S,fo as C,fs as w,io as T,ji as E,ls as D,lt as O,ro as k,st as A,ti as j,uo as M,us as N}from"./dialogs-config-COzptu1b.js";import{N as P}from"./react-vendor-CEpXTE2b.js";import{t as F}from"./monaco-CZnIWXyV.js";import{I,a as te,l as L,n as R,o as ne}from"./history-view-BJ65FVAN.js";import{d as re}from"./onboarding-pVfMmu_a.js";import{n as ie}from"./utils-DDUhUTLy.js";import{B as ae,F as oe,I as se,L as ce,R as le,c as ue,d as de,f as fe,l as z,u as pe,y as me}from"./index-BMgOr4si.js";import{a as B,n as he,r as ge,t as _e}from"./context-menu-CeBh_Q21.js";var V=e(w(),1),H=N(),U=D();function W(e){let t=(0,H.c)(20),{children:r,title:i,subtitle:a,headerAction:o,footer:s}=e,c;t[0]===i?c=t[1]:(c=i&&(0,U.jsx)(`span`,{className:n.sectionTitle,children:i}),t[0]=i,t[1]=c);let l;t[2]===c?l=t[3]:(l=(0,U.jsx)(`div`,{className:`flex items-center gap-2`,children:c}),t[2]=c,t[3]=l);let u;t[4]===o?u=t[5]:(u=o&&(0,U.jsx)(`div`,{className:`flex items-center gap-2 ml-auto`,children:o}),t[4]=o,t[5]=u);let d;t[6]!==l||t[7]!==u?(d=(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[l,u]}),t[6]=l,t[7]=u,t[8]=d):d=t[8];let f;t[9]!==a||t[10]!==d?(f=(0,U.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-1 border-b border-sidebar-border px-4 py-6`,children:[d,a]}),t[9]=a,t[10]=d,t[11]=f):f=t[11];let p;t[12]===r?p=t[13]:(p=(0,U.jsx)(b,{className:`min-h-0 flex-1`,children:r}),t[12]=r,t[13]=p);let m;t[14]===s?m=t[15]:(m=s&&(0,U.jsx)(`div`,{className:`border-t border-sidebar-border`,children:s}),t[14]=s,t[15]=m);let h;return t[16]!==f||t[17]!==p||t[18]!==m?(h=(0,U.jsxs)(`div`,{className:`flex h-full min-h-0 w-full flex-col`,children:[f,p,m]}),t[16]=f,t[17]=p,t[18]=m,t[19]=h):h=t[19],h}function ve(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 G={added:`text-green-500`,deleted:`text-red-500`,untracked:`text-green-500`,renamed:`text-blue-500`,modified:`text-orange-500`},ye={added:`A`,deleted:`D`,untracked:`U`,renamed:`R`,modified:`M`};function K(e){return d(d(n.compact,`status-badge font-mono font-semibold`),G[e]??`text-orange-500`)}function be(e){return ye[e]??`M`}var q=I(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=I(e=>e.v0,{name:`DiffTree_1`,portals:[`v0`]}),J=I(e=>e.v0,{name:`DiffTree_2`,portals:[`v0`]}),Se=I(e=>e.v0,{name:`DiffTree_3`,portals:[`v0`]}),Ce=function(e){let t=(0,H.c)(32),{treeData:r,files:o,error:s,selectedFileIndex:c,onFileSelect:u,onRevertFile:p}=e,m;t[0]===o?m=t[1]:(m=o.reduce(Y,0),t[0]=o,t[1]=m);let h=m,g;t[2]===o?g=t[3]:(g=o.reduce(Oe,0),t[2]=o,t[3]=g);let _=g,y;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(y=d(n.compact,`text-muted-foreground`),t[4]=y):y=t[4];let ee=o.length,b=o.length===1?``:`s`,x;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(x=d(n.compact,`text-green-500`),t[5]=x):x=t[5];let S;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(S=d(n.compact,`text-red-500`),t[6]=S):S=t[6];let C;t[7]!==o.length||t[8]!==b||t[9]!==h||t[10]!==_?(C=(0,U.jsx)(q,{v0:y,v1:ee,v2:b,v3:x,v4:h,v5:S,v6:_}),t[7]=o.length,t[8]=b,t[9]=h,t[10]=_,t[11]=C):C=t[11];let w=C;if(s){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=d(n.compact,`text-destructive text-center`),t[12]=e):e=t[12];let r;t[13]===s?r=t[14]:(r=(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:s})}),t[13]=s,t[14]=r);let i;return t[15]!==w||t[16]!==r?(i=(0,U.jsx)(xe,{v0:(0,U.jsx)(W,{title:`Review Changes`,subtitle:w,children:r})}),t[15]=w,t[16]=r,t[17]=i):i=t[17],i}if(o.length===0){let e;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,U.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,U.jsx)(`p`,{className:d(n.compact,n.bodyMuted,`text-center`),children:`No changes to review`})}),t[18]=e):e=t[18];let r;return t[19]===w?r=t[20]:(r=(0,U.jsx)(J,{v0:(0,U.jsx)(W,{title:`Review Changes`,subtitle:w,children:e})}),t[19]=w,t[20]=r),r}let T;t[21]!==o||t[22]!==u||t[23]!==p||t[24]!==c?(T=(e,t)=>{let{isOpen:n,toggle:r}=t,s=!!e.children,m=(0,U.jsxs)(re,{onClick:()=>{s?r():e.fileIndex!==void 0&&u(e.fileIndex)},selected:!s&&e.fileIndex===c,className:`gap-1.5`,children:[s?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(v,{className:d(`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform`,n&&`rotate-90`)}),n?(0,U.jsx)(f,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}):(0,U.jsx)(a,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}):(0,U.jsx)(i,{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}),!s&&e.status&&(0,U.jsx)(`span`,{className:K(e.status),children:be(e.status)})]});return s?m:(0,U.jsxs)(_e,{children:[(0,U.jsx)(B,{asChild:!0,children:(0,U.jsx)(`div`,{children:m})}),(0,U.jsx)(he,{children:(0,U.jsxs)(ge,{onClick:()=>{e.fileIndex!==void 0&&p?.(o[e.fileIndex])},children:[(0,U.jsx)(l,{className:`mr-2 h-3.5 w-3.5`}),`Revert Change`]})})]})},t[21]=o,t[22]=u,t[23]=p,t[24]=c,t[25]=T):T=t[25];let E;t[26]!==T||t[27]!==r?(E=(0,U.jsx)(`div`,{className:`px-1 pt-3 pb-2`,children:(0,U.jsx)(oe,{nodes:r,defaultOpen:!0,resetKey:r,indent:16,childContainerClassName:`ml-4 border-l border-sidebar-border pl-2`,renderNode:T})}),t[26]=T,t[27]=r,t[28]=E):E=t[28];let D;return t[29]!==w||t[30]!==E?(D=(0,U.jsx)(Se,{v0:(0,U.jsx)(W,{title:`Review Changes`,subtitle:w,children:E})}),t[29]=w,t[30]=E,t[31]=D):D=t[31],D};function we(e){return e.type===`add`}function Te(e,t){return e+t.changes.filter(we).length}function Y(e,t){return e+t.hunks.reduce(Te,0)}function Ee(e){return e.type===`delete`}function De(e,t){return e+t.changes.filter(Ee).length}function Oe(e,t){return e+t.hunks.reduce(De,0)}var ke=I(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`]}),X=function(e){let t=(0,H.c)(5),{threadId:r,filePath:i,version:a,label:o}=e,s=Z(r,i,a),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=d(n.caption,`px-3 py-1.5 border-b text-muted-foreground bg-muted/30`),t[0]=c):c=t[0];let l=`${o} - ${i}`,u;return t[1]!==o||t[2]!==s||t[3]!==l?(u=(0,U.jsx)(ke,{v0:c,v1:o,v2:s,v3:l}),t[1]=o,t[2]=s,t[3]=l,t[4]=u):u=t[4],u};function Ae(e,t,n){return`git-media:${e}:${t}:${n}`}function Z(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=()=>O(e,t,n),r[4]=t,r[5]=e,r[6]=n,r[7]=a):a=r[7];let o=te(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 je(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)(L,{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)(X,{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)(L,{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)(X,{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)(L,{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)(X,{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 Me(e){let t=(0,H.c)(4),{isOpen:n}=e,r=(n===void 0?!0:n)&&`ml-[-40px]`,i;t[0]===r?i=t[1]:(i=d(`z-10 shrink-0`,r),t[0]=r,t[1]=i);let a;return t[2]===i?a=t[3]:(a=(0,U.jsx)(z,{withHandle:!0,className:i}),t[2]=i,t[3]=a),a}function Ne(e){let t=(0,H.c)(36),{open:i,lineNumber:a,lineContent:o,initialComment:s,isEditing:c,onSave:l,onDelete:u,onClose:f}=e,[p,m]=(0,V.useState)((s===void 0?``:s)??``),h;t[0]!==l||t[1]!==p?(h=()=>{p.trim()&&l(p.trim())},t[0]=l,t[1]=p,t[2]=h):h=t[2];let g=h,v;t[3]===g?v=t[4]:(v=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),g())},t[3]=g,t[4]=v);let ee=v,b;t[5]===f?b=t[6]:(b=e=>{e||f()},t[5]=f,t[6]=b);let x;t[7]===a?x=t[8]:(x=(0,U.jsx)(S,{children:(0,U.jsxs)(j,{children:[`Comment on line `,a]})}),t[7]=a,t[8]=x);let C;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(C=d(n.compact,`font-mono rounded bg-muted px-3 py-2 text-muted-foreground overflow-x-auto whitespace-pre`),t[9]=C):C=t[9];let w=o||` `,T;t[10]===w?T=t[11]:(T=(0,U.jsx)(`div`,{className:C,children:w}),t[10]=w,t[11]=T);let D;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>m(e.target.value),t[12]=D):D=t[12];let O;t[13]!==ee||t[14]!==p?(O=(0,U.jsx)(se,{autoFocus:!0,placeholder:`Add a comment... (Cmd+Enter to save)`,value:p,onChange:D,onKeyDown:ee,rows:12,className:`resize-none text-base`}),t[13]=ee,t[14]=p,t[15]=O):O=t[15];let k;t[16]!==c||t[17]!==u?(k=c&&u&&(0,U.jsx)(E,{variant:`destructive`,size:`sm`,onClick:u,className:`mr-auto`,children:`Delete`}),t[16]=c,t[17]=u,t[18]=k):k=t[18];let A;t[19]===p?A=t[20]:(A=p.trim(),t[19]=p,t[20]=A);let M=!A,N;t[21]!==g||t[22]!==M?(N=(0,U.jsx)(E,{size:`sm`,onClick:g,disabled:M,children:`Save`}),t[21]=g,t[22]=M,t[23]=N):N=t[23];let P;t[24]!==k||t[25]!==N?(P=(0,U.jsxs)(r,{className:`gap-2 sm:gap-0`,children:[k,N]}),t[24]=k,t[25]=N,t[26]=P):P=t[26];let F;t[27]!==O||t[28]!==P||t[29]!==x||t[30]!==T?(F=(0,U.jsxs)(y,{className:`max-w-2xl`,children:[x,T,O,P]}),t[27]=O,t[28]=P,t[29]=x,t[30]=T,t[31]=F):F=t[31];let I;return t[32]!==i||t[33]!==F||t[34]!==b?(I=(0,U.jsx)(_,{open:i,onOpenChange:b,children:F}),t[32]=i,t[33]=F,t[34]=b,t[35]=I):I=t[35],I}var Pe=I(e=>e.v0,{name:`ReviewLoadingFallback_1`,portals:[`v0`]}),Fe=I(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:r}=e,[i,a]=(0,V.useState)(!1),o,s;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{let e=window.setTimeout(()=>{a(!0)},15e3);return()=>{window.clearTimeout(e)}},s=[],t[0]=o,t[1]=s):(o=t[0],s=t[1]),(0,V.useEffect)(o,s),!i){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,U.jsx)(Pe,{v0:(0,U.jsx)(L,{label:`Loading review changes...`})}),t[2]=e):e=t[2],e}let c;return t[3]===r?c=t[4]:(c=(0,U.jsx)(Fe,{v0:n.bodyMuted,v1:(0,U.jsx)(E,{variant:`outline`,onClick:r,children:`Retry`})}),t[3]=r,t[4]=c),c};function Le(e,t){return`git-diff:${e}:${t}`}function Q(){return Error(`Loading review changes timed out. Please try again.`)}async function Re(e,t=15e3){return Promise.race([A(e),new Promise((e,n)=>{window.setTimeout(()=>n(Q()),t)})])}function ze({threadId:e,onExit:r,loadVersion:i}){let a=te(Le(e,i),()=>Re(e)),l=ce(),f=le(e=>e.diffComments),_=le(e=>e.projectModelSelections),{resolvedTheme:y}=ie(),b=me(),[S,w]=(0,V.useState)(a.files||[]),[D,O]=(0,V.useState)(null),[j,N]=(0,V.useState)(0),[I,L]=(0,V.useState)(!1),[R,ne]=(0,V.useState)(!1),[re,oe]=(0,V.useState)(!1),[se,z]=(0,V.useState)(!0),B=(0,V.useRef)(null);(0,V.useEffect)(()=>{z(!0)},[e]);let he=(0,V.useCallback)(e=>{N(e),b&&z(!1)},[b]),ge=(0,V.useCallback)(()=>{z(!0)},[]),_e=b&&!se,H=(0,V.useMemo)(()=>f[e]??[],[f,e]),W=(0,V.useCallback)(t=>{let n=f[e]??[],r=typeof t==`function`?t(n):t;l({type:ae.SetDiffComments,threadId:e,comments:r})},[l,e,f]),[G,ye]=(0,V.useState)(null),[K,be]=(0,V.useState)(null),[q,xe]=(0,V.useState)(null),J=(0,V.useRef)(null),Se=(0,V.useRef)(H),we=(0,V.useRef)(G),Te=(0,V.useRef)({isFullView:I,selectedFileIndex:j,files:S}),Y=(0,V.useRef)({original:[],modified:[]}),Ee=(0,V.useRef)(!0);(0,V.useEffect)(()=>{Se.current=H},[H]),(0,V.useEffect)(()=>{we.current=G},[G]),(0,V.useEffect)(()=>{Te.current={isFullView:I,selectedFileIndex:j,files:S}},[I,j,S]);let De=(0,V.useCallback)(()=>{B.current&&(R?B.current.expand():B.current.collapse())},[R]),Oe=(0,V.useCallback)(async()=>{if(e){O(null);try{w((await A(e)).files||[]),N(0)}catch(e){O(e instanceof Error?e.message:`Failed to load diff`)}}},[e]),ke=(0,V.useCallback)(async t=>{try{await ee(e,t.path),await Oe()}catch(e){O(e instanceof Error?e.message:`Failed to revert file`)}},[e,Oe]),X=(0,V.useRef)(!1);(0,V.useEffect)(()=>{if((f[e]??[]).length>0){X.current=!0;return}s(e).then(t=>{t.diffComments&&t.diffComments.length>0&&l({type:ae.SetDiffComments,threadId:e,comments:t.diffComments}),X.current=!0}).catch(()=>{X.current=!0})},[e]),(0,V.useEffect)(()=>{X.current&&g(e,{diffComments:H}).catch(()=>{})},[e,H]);let Ae=(0,V.useMemo)(()=>ve(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}},Pe=(e,t,n)=>e.split(`
2
+ `).slice(t-1,n).join(`
3
+ `),Fe=e=>{let t=Z(e);return t?t.startLine<=1:!0},Ie=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],ze=Q?.isBinary??!1,Be=Q?I?Q.oldContent:(()=>{let e=Z(Q);return e?Pe(Q.oldContent,e.startLine,e.endLine):Q.oldContent})():``,Ve=Q?I?Q.newContent:(()=>{let e=Z(Q);return e?Pe(Q.newContent,e.startLine,e.endLine):Q.newContent})():``,$=(0,V.useCallback)(()=>{if(!Ee.current)return;let e=J.current;if(!e)return;let{isFullView:t,selectedFileIndex:n,files:r}=Te.current,i=Se.current,a=we.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:F.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:F.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}}}).filter(e=>e!==null);d.push(...f);let p=r===`original`?Y.current.original:Y.current.modified,m=e.deltaDecorations(p,d);r===`original`?Y.current.original=m:Y.current.modified=m};s(e.getOriginalEditor(),`original`),s(e.getModifiedEditor(),`modified`)},[]);(0,V.useEffect)(()=>{$()},[$,H,G,j,I,Q]),(0,V.useEffect)(()=>()=>{J.current=null,Y.current={original:[],modified:[]}},[j]),(0,V.useEffect)(()=>()=>{Ee.current=!1,J.current&&=(J.current.getOriginalEditor().getModel()?.dispose(),J.current.getModifiedEditor().getModel()?.dispose(),J.current.dispose(),null),Y.current={original:[],modified:[]}},[]);let He=(0,V.useCallback)(e=>{J.current=e;let t=e=>e===F.MouseTargetType.GUTTER_GLYPH_MARGIN||e===F.MouseTargetType.GUTTER_LINE_NUMBERS||e===F.MouseTargetType.GUTTER_LINE_DECORATIONS||e===F.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}=Te.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=Se.current.find(e=>e.fileIndex===o&&e.lineNumber===u&&e.side===n);f?xe(f):be({lineNumber:u,lineContent:d,side:n})})};n(e.getOriginalEditor(),`original`),n(e.getModifiedEditor(),`modified`),setTimeout(()=>{J.current===e&&$()},150)},[$]),Ue=(0,V.useCallback)(e=>{if(K&&Q){let t={id:`comment-${Date.now()}`,filePath:Q.path,fileIndex:j,lineNumber:K.lineNumber,lineContent:K.lineContent,comment:e,side:K.side};W(e=>[...e,t]),be(null)}else q&&(W(t=>t.map(t=>t.id===q.id?{...t,comment:e}:t)),xe(null))},[K,q,Q,j,W]),We=(0,V.useCallback)(()=>{q&&(W(e=>e.filter(e=>e.id!==q.id)),xe(null))},[q,W]),Ge=(0,V.useCallback)(e=>{if(H.length===0)return;let t=(e%H.length+H.length)%H.length,n=H[t];ye(t),N(n.fileIndex),b&&z(!1),setTimeout(()=>{let e=J.current;if(!e)return;let t=S[n.fileIndex];if(!t)return;let r=I?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)},[H,S,I,$,b]),Ke=(0,V.useCallback)(()=>{Ge((G??0)-1)},[Ge,G]),qe=(0,V.useCallback)(()=>{Ge((G??-1)+1)},[Ge,G]),Je=(0,V.useCallback)(async()=>{let n=_[e];if(!n)try{let e=await t(),r=Object.values(e).flat();if(r.length>0)n=r[0];else{console.error(`No models available to process comments`);return}}catch(e){console.error(`Failed to load models:`,e);return}let i=n.id,a=n.provider;try{let{prompt:t}=await c(e,H);W([]),l({type:ae.SetPendingChatMessage,message:{threadId:e,message:t,model:i,provider:a}}),r()}catch(e){console.error(`Failed to fix comments:`,e),typeof window<`u`&&window.alert(`Failed to process comments. Please try again.`)}},[H,_,l,e,r,W]),Ye={readOnly:!0,renderSideBySide:!b,ignoreTrimWhitespace:!1,renderOverviewRuler:!0,scrollBeyondLastLine:!1,minimap:{enabled:!1},folding:!1,glyphMargin:!0,lineNumbers:Q&&(I||Fe(Q))?`on`:`off`,diffWordWrap:`on`,originalEditable:!1,automaticLayout:!0},Xe=(0,U.jsx)(`div`,{className:`flex h-full min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden`,children:(0,U.jsx)(Ce,{treeData:Ae,files:S,error:D,selectedFileIndex:j,onFileSelect:he,onRevertFile:ke})}),Ze=(0,U.jsxs)(`div`,{className:`diff-editor-panel flex h-full min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden bg-transparent`,children:[(0,U.jsxs)(ue,{className:d(`bg-transparent`,R&&`h-auto py-3 flex-col items-start gap-3 md:flex-row md:items-center md:h-[71px] md:py-0 md:gap-2 justify-between`),children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[_e?(0,U.jsxs)(E,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground shrink-0`,onClick:ge,children:[(0,U.jsx)(k,{className:`h-4 w-4`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Show file tree`})]}):(0,U.jsxs)(E,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground shrink-0`,onClick:De,children:[R?(0,U.jsx)(k,{className:`h-4 w-4`}):(0,U.jsx)(T,{className:`h-4 w-4`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Toggle file tree`})]}),(0,U.jsx)(`span`,{className:d(n.label,`text-foreground`),children:Q?Q.path:`Review Changes`})]}),(0,U.jsxs)(`div`,{className:d(`flex items-center gap-2`,R&&`ml-0`,!R&&`ml-auto`,`md:ml-auto`),children:[!ze&&(0,U.jsx)(E,{variant:`ghost`,size:`sm`,onClick:()=>L(e=>!e),disabled:!Q,className:d(n.compact,`h-8 gap-1 px-2`),children:I?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(x,{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`]})}),H.length>0&&(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsxs)(p,{children:[(0,U.jsx)(u,{asChild:!0,children:(0,U.jsx)(E,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:Ke,disabled:(G??0)===0,children:(0,U.jsx)(m,{className:`h-3 w-3`})})}),(0,U.jsx)(o,{children:`Previous comment`})]}),(0,U.jsx)(`span`,{className:d(n.caption,`whitespace-nowrap`),children:H.length===1?`1 Comment`:`Comment ${(G??0)+1} of ${H.length}`}),(0,U.jsxs)(p,{children:[(0,U.jsx)(u,{asChild:!0,children:(0,U.jsx)(E,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:qe,disabled:(G??0)===H.length-1,children:(0,U.jsx)(v,{className:`h-3 w-3`})})}),(0,U.jsx)(o,{children:`Next comment`})]})]}),H.length>0&&(0,U.jsxs)(p,{children:[(0,U.jsx)(u,{asChild:!0,children:(0,U.jsxs)(E,{size:`sm`,onClick:Je,className:d(n.compact,`h-8 gap-1 px-3 bg-foreground text-background hover:bg-foreground/90`),children:[(0,U.jsx)(M,{className:`h-3 w-3`}),`Fix all comments`]})}),(0,U.jsx)(o,{children:`Send all comments to Tarsk for resolution`})]})]})]}),(0,U.jsxs)(`div`,{className:`flex-1 bg-transparent relative`,children:[ze&&Q?(0,U.jsx)(je,{threadId:e,file:Q}):(0,U.jsx)(P,{height:`100%`,language:Ie(Q?.path||``),original:Be,modified:Ve,theme:y===`dark`?`vs-dark`:`vs-light`,onMount:He,options:Ye},`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:[re&&(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)(E,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>oe(!1),children:[(0,U.jsx)(h,{className:`h-4 w-4`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Close chat`})]})}),(0,U.jsx)(fe,{})]}),!re&&(0,U.jsxs)(p,{children:[(0,U.jsx)(u,{asChild:!0,children:(0,U.jsxs)(E,{size:`icon`,className:`pointer-events-auto h-12 w-12 rounded-full shadow-lg`,onClick:()=>oe(!0),children:[(0,U.jsx)(M,{className:`h-5 w-5`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Open review chat`})]})}),(0,U.jsx)(o,{children:`Chat about this diff`})]})]})]})]});return(0,U.jsxs)(`div`,{className:`diff-view-root flex h-full min-h-0 w-full flex-col`,children:[(0,U.jsx)(`div`,{className:`diff-body flex min-h-0 w-full flex-1 overflow-hidden`,children:b?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{className:d(`flex min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden`,!se&&`hidden`),children:Xe}),(0,U.jsx)(`div`,{className:d(`flex min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden`,se&&`hidden`),children:Ze})]}):(0,U.jsxs)(de,{direction:`horizontal`,children:[(0,U.jsx)(pe,{ref:B,defaultSize:25,minSize:12,maxSize:40,collapsible:!0,collapsedSize:0,onCollapse:()=>ne(!0),onExpand:()=>ne(!1),className:`border-r border-transparent`,children:Xe}),(0,U.jsx)(Me,{isOpen:!R}),(0,U.jsx)(pe,{className:`overflow-hidden border-l border-border bg-transparent`,children:Ze})]})}),(0,U.jsx)(Ne,{open:K!==null||q!==null,lineNumber:q?.lineNumber??K?.lineNumber??0,lineContent:q?.lineContent??K?.lineContent??``,initialComment:q?.comment,isEditing:q!==null,onSave:Ue,onDelete:We,onClose:()=>{be(null),xe(null)}},`${q?.id??``}-${K?.lineNumber??``}-${K?.side??``}`)]})}function Be(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=>(ne(Le(e.threadId,t)),t+1)),a($)},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=>(ne(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)(ze,{...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)(R,{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 $(e){return e+1}export{Be as DiffView,Be as default};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/explorer-tree-CiPMm5ck.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-_SOdLUMq.js","assets/monaco-CZnIWXyV.js","assets/monaco-Br_kD0ds.css","assets/history-view-BMVTxWTg.js","assets/dialogs-config-BEazgV7k.js","assets/onboarding-Bi5MieW-.js","assets/vosk-speech-CgILeNJR.js","assets/react-vendor-iDwBzcYF.js","assets/utils-CECQ_-6N.js","assets/index-C7FLshNp.css","assets/api-Dhzdgb40.js","assets/context-menu-PIC-g8wy.js","assets/ui-components-kSaUEA_X.js","assets/explorer-view-odyQutTO.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Mi as t,Xi as n,c as r,ls as i,os as a,ss as o}from"./dialogs-config-BEazgV7k.js";import{r as s}from"./monaco-CZnIWXyV.js";import{l as c,u as l}from"./history-view-BMVTxWTg.js";import{A as u,R as d,d as f,l as p,u as m,y as h}from"./index-_SOdLUMq.js";var g=o(),_=e(i(),1),v=a(),y=(0,_.lazy)(()=>s(()=>import(`./explorer-tree-CiPMm5ck.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]))),b=(0,_.lazy)(()=>s(()=>import(`./explorer-view-odyQutTO.js`),__vite__mapDeps([15,1,2,3,4,5,6,7,8,9,10,11,12])));function x(){let e=(0,g.c)(49),i=d(S),a=h(),[o,s]=(0,_.useState)(null),[x,C]=(0,_.useState)(!0),{pendingExplorerPath:w,setPendingExplorerPath:T,explorerClearPath:E,setExplorerClearPath:D}=u(),O;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>{C(!0)},e[0]=O):O=e[0];let k;e[1]===i?k=e[2]:(k=[i],e[1]=i,e[2]=k),(0,_.useEffect)(O,k);let A;e[3]===a?A=e[4]:(A=e=>{s(e),a&&C(!1)},e[3]=a,e[4]=A);let j=A,M;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>{C(!0)},e[5]=M):M=e[5];let N=M,P;e[6]===a?P=e[7]:(P=e=>{s(e),a&&C(!1)},e[6]=a,e[7]=P);let F=P,I,L;e[8]!==a||e[9]!==w||e[10]!==T?(I=()=>{w&&(s({name:w.split(`/`).pop()??w,path:w,type:`file`}),a&&C(!1),T(null))},L=[a,w,T],e[8]=a,e[9]=w,e[10]=T,e[11]=I,e[12]=L):(I=e[11],L=e[12]),(0,_.useEffect)(I,L);let R,z;e[13]!==E||e[14]!==a||e[15]!==o||e[16]!==D?(R=()=>{E&&(o&&(o.path===E||o.path.startsWith(E+`/`))&&(s(null),a&&C(!0)),D(null))},z=[E,a,o,D],e[13]=E,e[14]=a,e[15]=o,e[16]=D,e[17]=R,e[18]=z):(R=e[17],z=e[18]),(0,_.useEffect)(R,z);let B;e[19]!==j||e[20]!==o?.path||e[21]!==i?(B=(0,v.jsx)(r,{className:`h-full`,children:i?(0,v.jsx)(_.Suspense,{fallback:(0,v.jsx)(l,{}),children:(0,v.jsx)(y,{threadId:i,selectedPath:o?.path??null,onNodeSelect:j})}):(0,v.jsx)(`p`,{className:t(n.caption,`px-3 py-4 text-center`),children:`No thread selected.`})}),e[19]=j,e[20]=o?.path,e[21]=i,e[22]=B):B=e[22];let V=B,H;e[23]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,v.jsx)(c,{}),e[23]=H):H=e[23];let U=a&&!x,W;e[24]!==F||e[25]!==o||e[26]!==U?(W=(0,v.jsx)(_.Suspense,{fallback:H,children:(0,v.jsx)(b,{selectedFile:o,showTreeBackButton:U,onShowTree:N,onFileCreated:F})}),e[24]=F,e[25]=o,e[26]=U,e[27]=W):W=e[27];let G=W;if(a){let n=!x&&`hidden`,r;e[28]===n?r=e[29]:(r=t(`flex-1 min-h-0 overflow-hidden`,n),e[28]=n,e[29]=r);let i;e[30]!==V||e[31]!==r?(i=(0,v.jsx)(`div`,{className:r,children:V}),e[30]=V,e[31]=r,e[32]=i):i=e[32];let a=x&&`hidden`,o;e[33]===a?o=e[34]:(o=t(`flex-1 min-h-0 overflow-hidden`,a),e[33]=a,e[34]=o);let s;e[35]!==G||e[36]!==o?(s=(0,v.jsx)(`div`,{className:o,children:G}),e[35]=G,e[36]=o,e[37]=s):s=e[37];let c;return e[38]!==i||e[39]!==s?(c=(0,v.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:[i,s]}),e[38]=i,e[39]=s,e[40]=c):c=e[40],c}let K;e[41]===V?K=e[42]:(K=(0,v.jsx)(m,{defaultSize:25,minSize:15,maxSize:50,className:`overflow-hidden border-r border-border`,children:V}),e[41]=V,e[42]=K);let q;e[43]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,v.jsx)(p,{withHandle:!0}),e[43]=q):q=e[43];let J;e[44]===G?J=e[45]:(J=(0,v.jsx)(m,{className:`overflow-hidden`,children:G}),e[44]=G,e[45]=J);let Y;return e[46]!==K||e[47]!==J?(Y=(0,v.jsx)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:(0,v.jsxs)(f,{direction:`horizontal`,className:`flex-1 overflow-hidden`,children:[K,q,J]})}),e[46]=K,e[47]=J,e[48]=Y):Y=e[48],Y}function S(e){return e.selectedThreadId}export{x as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/explorer-tree-DKrWFiee.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-BMgOr4si.js","assets/monaco-CZnIWXyV.js","assets/monaco-Br_kD0ds.css","assets/history-view-BJ65FVAN.js","assets/dialogs-config-COzptu1b.js","assets/onboarding-pVfMmu_a.js","assets/vosk-speech-BHa2mKnm.js","assets/react-vendor-CEpXTE2b.js","assets/utils-DDUhUTLy.js","assets/index-DzUALYN4.css","assets/api-_tZksLaY.js","assets/context-menu-CeBh_Q21.js","assets/ui-components-BhYSDqpD.js","assets/explorer-view-DYbdTXTm.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$i as t,Ni as n,c as r,fs as i,ls as a,us as o}from"./dialogs-config-COzptu1b.js";import{r as s}from"./monaco-CZnIWXyV.js";import{l as c,u as l}from"./history-view-BJ65FVAN.js";import{A as u,R as d,d as f,l as p,u as m,y as h}from"./index-BMgOr4si.js";var g=o(),_=e(i(),1),v=a(),y=(0,_.lazy)(()=>s(()=>import(`./explorer-tree-DKrWFiee.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]))),b=(0,_.lazy)(()=>s(()=>import(`./explorer-view-DYbdTXTm.js`),__vite__mapDeps([15,1,2,3,4,5,6,7,8,9,10,11,12])));function x(){let e=(0,g.c)(49),i=d(S),a=h(),[o,s]=(0,_.useState)(null),[x,C]=(0,_.useState)(!0),{pendingExplorerPath:w,setPendingExplorerPath:T,explorerClearPath:E,setExplorerClearPath:D}=u(),O;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>{C(!0)},e[0]=O):O=e[0];let k;e[1]===i?k=e[2]:(k=[i],e[1]=i,e[2]=k),(0,_.useEffect)(O,k);let A;e[3]===a?A=e[4]:(A=e=>{s(e),a&&C(!1)},e[3]=a,e[4]=A);let j=A,M;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>{C(!0)},e[5]=M):M=e[5];let N=M,P;e[6]===a?P=e[7]:(P=e=>{s(e),a&&C(!1)},e[6]=a,e[7]=P);let F=P,I,L;e[8]!==a||e[9]!==w||e[10]!==T?(I=()=>{w&&(s({name:w.split(`/`).pop()??w,path:w,type:`file`}),a&&C(!1),T(null))},L=[a,w,T],e[8]=a,e[9]=w,e[10]=T,e[11]=I,e[12]=L):(I=e[11],L=e[12]),(0,_.useEffect)(I,L);let R,z;e[13]!==E||e[14]!==a||e[15]!==o||e[16]!==D?(R=()=>{E&&(o&&(o.path===E||o.path.startsWith(E+`/`))&&(s(null),a&&C(!0)),D(null))},z=[E,a,o,D],e[13]=E,e[14]=a,e[15]=o,e[16]=D,e[17]=R,e[18]=z):(R=e[17],z=e[18]),(0,_.useEffect)(R,z);let B;e[19]!==j||e[20]!==o?.path||e[21]!==i?(B=(0,v.jsx)(r,{className:`h-full`,children:i?(0,v.jsx)(_.Suspense,{fallback:(0,v.jsx)(l,{}),children:(0,v.jsx)(y,{threadId:i,selectedPath:o?.path??null,onNodeSelect:j})}):(0,v.jsx)(`p`,{className:n(t.caption,`px-3 py-4 text-center`),children:`No thread selected.`})}),e[19]=j,e[20]=o?.path,e[21]=i,e[22]=B):B=e[22];let V=B,H;e[23]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,v.jsx)(c,{}),e[23]=H):H=e[23];let U=a&&!x,W;e[24]!==F||e[25]!==o||e[26]!==U?(W=(0,v.jsx)(_.Suspense,{fallback:H,children:(0,v.jsx)(b,{selectedFile:o,showTreeBackButton:U,onShowTree:N,onFileCreated:F})}),e[24]=F,e[25]=o,e[26]=U,e[27]=W):W=e[27];let G=W;if(a){let t=!x&&`hidden`,r;e[28]===t?r=e[29]:(r=n(`flex-1 min-h-0 overflow-hidden`,t),e[28]=t,e[29]=r);let i;e[30]!==V||e[31]!==r?(i=(0,v.jsx)(`div`,{className:r,children:V}),e[30]=V,e[31]=r,e[32]=i):i=e[32];let a=x&&`hidden`,o;e[33]===a?o=e[34]:(o=n(`flex-1 min-h-0 overflow-hidden`,a),e[33]=a,e[34]=o);let s;e[35]!==G||e[36]!==o?(s=(0,v.jsx)(`div`,{className:o,children:G}),e[35]=G,e[36]=o,e[37]=s):s=e[37];let c;return e[38]!==i||e[39]!==s?(c=(0,v.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:[i,s]}),e[38]=i,e[39]=s,e[40]=c):c=e[40],c}let K;e[41]===V?K=e[42]:(K=(0,v.jsx)(m,{defaultSize:25,minSize:15,maxSize:50,className:`overflow-hidden border-r border-border`,children:V}),e[41]=V,e[42]=K);let q;e[43]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,v.jsx)(p,{withHandle:!0}),e[43]=q):q=e[43];let J;e[44]===G?J=e[45]:(J=(0,v.jsx)(m,{className:`overflow-hidden`,children:G}),e[44]=G,e[45]=J);let Y;return e[46]!==K||e[47]!==J?(Y=(0,v.jsx)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:(0,v.jsxs)(f,{direction:`horizontal`,className:`flex-1 overflow-hidden`,children:[K,q,J]})}),e[46]=K,e[47]=J,e[48]=Y):Y=e[48],Y}function S(e){return e.selectedThreadId}export{x as default};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$i as t,$o as n,Ao as r,Do as i,Ha as a,Jr as o,Ni as s,Oo as c,Zo as l,fs as u,ls as d,us as f}from"./dialogs-config-COzptu1b.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-BJ65FVAN.js";import{d as w}from"./onboarding-pVfMmu_a.js";import{A as T,D as ee,O as E,P as D,k as O}from"./index-BMgOr4si.js";import{a as k,i as A,n as j,r as M,t as N}from"./context-menu-CeBh_Q21.js";import{c as P,n as F,o as I,r as L,s as R,t as z}from"./api-_tZksLaY.js";import{t as B}from"./ui-components-BhYSDqpD.js";var V=f(),H=e(u(),1),U=d(),W=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=s(`flex 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,U.jsx)(B,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});W.displayName=B.displayName;var G=H.forwardRef((e,t)=>{let n=(0,V.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 o;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,U.jsx)(a,{className:`mr-2 h-4 w-4 shrink-0 opacity-50`}),n[3]=o):o=n[3];let c;n[4]===r?c=n[5]:(c=s(`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]=c);let l;return n[6]!==i||n[7]!==t||n[8]!==c?(l=(0,U.jsxs)(`div`,{className:`flex items-center border-b px-3`,"cmdk-input-wrapper":``,children:[o,(0,U.jsx)(B.Input,{ref:t,className:c,...i})]}),n[6]=i,n[7]=t,n[8]=c,n[9]=l):l=n[9],l});G.displayName=B.Input.displayName;var K=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=s(`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,U.jsx)(B.List,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});K.displayName=B.List.displayName;var q=H.forwardRef((e,n)=>{let r=(0,V.c)(4),i;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=s(t.bodyMuted,`py-6 text-center`),r[0]=i):i=r[0];let a;return r[1]!==e||r[2]!==n?(a=(0,U.jsx)(B.Empty,{ref:n,className:i,...e}),r[1]=e,r[2]=n,r[3]=a):a=r[3],a});q.displayName=B.Empty.displayName;var J=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=s(`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,U.jsx)(B.Group,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});J.displayName=B.Group.displayName;var Y=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=s(`-mx-1 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,U.jsx)(B.Separator,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Y.displayName=B.Separator.displayName;var te=H.forwardRef((e,n)=>{let r=(0,V.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=s(s(t.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`),i),r[3]=i,r[4]=o);let c;return r[5]!==a||r[6]!==n||r[7]!==o?(c=(0,U.jsx)(B.Item,{ref:n,className:o,...a}),r[5]=a,r[6]=n,r[7]=o,r[8]=c):c=r[8],c});te.displayName=B.Item.displayName;var X=e=>{let n=(0,V.c)(8),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=s(t.compact,`ml-auto tracking-widest text-muted-foreground`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==a?(o=(0,U.jsx)(`span`,{className:a,...i}),n[5]=i,n[6]=a,n[7]=o):o=n[7],o};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,V.c)(38),{items:a,isReady:c,onRequestIndex:l,onOpenChange:u,onSelect:d}=e,f=c===void 0?!1:c,p=(0,H.useRef)(null),m=(0,H.useRef)(!1),h=(0,H.useRef)(!1),[g,_]=(0,H.useState)(!1),[v,y]=(0,H.useState)(``),b=(0,H.useDeferredValue)(v),x;n[0]===l?x=n[1]:(x=function(){h.current||(h.current=!0,l())},n[0]=l,n[1]=x);let S=x,C;n[2]!==b||n[3]!==a?(C=ae(a,re(b),b),n[2]=b,n[3]=a,n[4]=C):C=n[4];let w=C,T,D;n[5]!==u||n[6]!==v?(T=()=>{let e=v.trim().length>0;_(e),m.current!==e&&(m.current=e,u(e))},D=[u,v],n[5]=u,n[6]=v,n[7]=T,n[8]=D):(T=n[7],D=n[8]),(0,H.useEffect)(T,D);let k;n[9]===u?k=n[10]:(k=function(e){e||y(``),_(e),u(e),e&&requestAnimationFrame(()=>p.current?.focus())},n[9]=u,n[10]=k);let A=k,j;n[11]!==u||n[12]!==d?(j=function(e){d(e),_(!1),u(!1),y(``)},n[11]=u,n[12]=d,n[13]=j):j=n[13];let M=j,N;n[14]===S?N=n[15]:(N=e=>{S(),y(e.target.value)},n[14]=S,n[15]=N);let P;n[16]!==v||n[17]!==S||n[18]!==N?(P=(0,U.jsx)(O,{asChild:!0,children:(0,U.jsx)(`div`,{children:(0,U.jsx)(o,{ref:p,value:v,onPointerDown:S,onChange:N,placeholder:`Search files and folders`,className:`pr-[4px]`})})}),n[16]=v,n[17]=S,n[18]=N,n[19]=P):P=n[19];let F;n[20]===Symbol.for(`react.memo_cache_sentinel`)?(F=s(t.compact,`py-4`),n[20]=F):F=n[20];let I=f?`No matches found.`:`Indexing files and folders...`,L;n[21]===I?L=n[22]:(L=(0,U.jsx)(q,{className:F,children:I}),n[21]=I,n[22]=L);let R;if(n[23]!==M||n[24]!==w){let e;n[26]===M?e=n[27]:(e=e=>(0,U.jsxs)(te,{value:e.path,onSelect:()=>M(e),className:e.ignored?`opacity-50`:void 0,children:[e.type===`folder`?(0,U.jsx)(i,{className:`h-4 w-4 text-muted-foreground`}):(0,U.jsx)(r,{className:`h-4 w-4 text-muted-foreground`}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`truncate`,children:e.name}),(0,U.jsx)(`div`,{className:s(t.compact,`truncate text-muted-foreground`),children:e.path})]})]},e.path),n[26]=M,n[27]=e),R=w.map(e),n[23]=M,n[24]=w,n[25]=R}else R=n[25];let z;n[28]===R?z=n[29]:(z=(0,U.jsx)(J,{children:R}),n[28]=R,n[29]=z);let B;n[30]!==L||n[31]!==z?(B=(0,U.jsx)(E,{align:`start`,side:`bottom`,sideOffset:4,onOpenAutoFocus:se,className:`w-[var(--radix-popover-trigger-width)] p-0`,children:(0,U.jsx)(W,{shouldFilter:!1,children:(0,U.jsxs)(K,{children:[L,z]})})}),n[30]=L,n[31]=z,n[32]=B):B=n[32];let G;return n[33]!==A||n[34]!==g||n[35]!==B||n[36]!==P?(G=(0,U.jsxs)(ee,{open:g,onOpenChange:A,children:[P,B]}),n[33]=A,n[34]=g,n[35]=B,n[36]=P,n[37]=G):G=n[37],G}function se(e){return e.preventDefault()}function ce(e,t,n){return`explorer-dir:${e}:${t}:${n}`}function le(e){let t=(0,V.c)(12),{threadId:n,dirPath:r,version:i,children:a}=e,o;t[0]!==r||t[1]!==n||t[2]!==i?(o=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=()=>I(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,U.jsx)(U.Fragment,{children:l}),t[10]=l,t[11]=u),u}function $(e){return e.entries}function ue(e){let t=(0,V.c)(17),{defaultValue:n,onCommit:r,onCancel:i,level:a,basePadding:o,icon:s}=e,c=(0,H.useRef)(null),l,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{c.current?.focus(),c.current?.select()},u=[],t[0]=l,t[1]=u):(l=t[0],u=t[1]),(0,H.useEffect)(l,u);let d;t[2]!==i||t[3]!==r?(d=function(e){if(e.key===`Enter`){let e=c.current?.value.trim()??``;e?r(e):i()}else e.key===`Escape`&&i()},t[2]=i,t[3]=r,t[4]=d):d=t[4];let f=d,p;t[5]!==i||t[6]!==r?(p=function(){let e=c.current?.value.trim()??``;e?r(e):i()},t[5]=i,t[6]=r,t[7]=p):p=t[7];let m=p,h;t[8]!==n||t[9]!==m||t[10]!==f?(h=(0,U.jsx)(`input`,{ref:c,defaultValue:n,onKeyDown:f,onBlur:m,className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`,onClick: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,U.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,H.memo)(function e({node:t,level:a,threadId:o,selectedPath:s,expandedPaths:u,getDirVersion:d,renamingPath:f,newItemIn:p,onToggleFolder:m,onSelectNode:h,onStartRename:g,onCommitRename:_,onCancelRename:y,onDelete:b,onOpen:x,onNewFile:S,onNewFolder:C,onCommitNewItem:T,onCancelNewItem:ee}){let E=u.has(t.path),D=f===t.path,O=p?.dirPath===t.path&&E;return t.type===`folder`?(0,U.jsxs)(N,{children:[(0,U.jsx)(k,{asChild:!0,children:(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(w,{level:a,basePadding:10,selected:s===t.path,className:t.ignored?`opacity-50`:void 0,onClick:e=>{e.stopPropagation(),m(t)},children:[(0,U.jsx)(`span`,{className:`text-muted-foreground w-3 flex-shrink-0`,children:E?(0,U.jsx)(n,{className:`h-3 w-3`}):(0,U.jsx)(l,{className:`h-3 w-3`})}),D?(0,U.jsxs)(U.Fragment,{children:[E?(0,U.jsx)(c,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(i,{className:`h-4 w-4 flex-shrink-0`}),(0,U.jsx)(`input`,{autoFocus:!0,defaultValue:t.name,onKeyDown:e=>{if(e.key===`Enter`){let n=e.target.value.trim();n?_(t,n):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,U.jsxs)(U.Fragment,{children:[E?(0,U.jsx)(c,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(i,{className:`h-4 w-4 flex-shrink-0`}),(0,U.jsx)(`span`,{className:`flex-1 truncate`,children:t.name})]})]}),E&&(0,U.jsx)(`div`,{children:(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(v,{}),children:(0,U.jsx)(le,{threadId:o,dirPath:t.path,version:d(t.path),children:t=>(0,U.jsxs)(U.Fragment,{children:[O&&(0,U.jsx)(ue,{defaultValue:``,level:a+1,basePadding:p.type===`folder`?10:22,icon:p.type===`folder`?(0,U.jsx)(i,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(r,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:T,onCancel:ee}),t.map(t=>(0,U.jsx)(e,{node:t,level:a+1,threadId:o,selectedPath:s,expandedPaths:u,getDirVersion:d,renamingPath:f,newItemIn:p,onToggleFolder:m,onSelectNode:h,onStartRename:g,onCommitRename:_,onCancelRename:y,onDelete:b,onOpen:x,onNewFile:S,onNewFolder:C,onCommitNewItem:T,onCancelNewItem:ee},t.path))]})})})})]})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(M,{onSelect:()=>x(t),children:`Open`}),(0,U.jsx)(A,{}),(0,U.jsx)(M,{onSelect:()=>S(t.path),children:`New File...`}),(0,U.jsx)(M,{onSelect:()=>C(t.path),children:`New Folder...`}),(0,U.jsx)(A,{}),(0,U.jsx)(M,{onSelect:()=>g(t),children:`Rename...`}),(0,U.jsx)(M,{onSelect:()=>b(t),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]}):(0,U.jsxs)(N,{children:[(0,U.jsx)(k,{asChild:!0,children:(0,U.jsxs)(w,{level:a,basePadding:22,selected:s===t.path,className:t.ignored?`opacity-50`:void 0,onClick:()=>h(t),children:[(0,U.jsx)(r,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),D?(0,U.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,U.jsx)(`span`,{className:`flex-1 truncate`,children:t.name})]})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(M,{onSelect:()=>x(t),children:`Open`}),(0,U.jsx)(A,{}),(0,U.jsx)(M,{onSelect:()=>g(t),children:`Rename...`}),(0,U.jsx)(M,{onSelect:()=>b(t),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]})}),me=new Map;function he({threadId:e,selectedPath:t,onNodeSelect:n}){let[a,o]=(0,H.useState)(()=>new Map([[``,0]])),[s,c]=(0,H.useState)(new Set),[l,u]=(0,H.useState)(null),[d,f]=(0,H.useState)(null),[_,v]=(0,H.useState)(null),[w,ee]=(0,H.useState)(!1),[E,O]=(0,H.useState)([]),[A,B]=(0,H.useState)(!1),[V,W]=(0,H.useState)(!1),G=(0,H.useRef)(null),K=(0,H.useRef)(0),q=(0,H.useRef)(null),{explorerRefreshTick:J,pendingExplorerPath:Y,setExplorerClearPath:te}=T(),X=(0,H.useMemo)(()=>`${e}:${J}`,[J,e]),ne=(0,H.useCallback)(e=>{(0,H.startTransition)(()=>{ee(t=>t===e?t:e)})},[]),Z=(0,H.useCallback)(async()=>{if(!e)return;let t=me.get(X);if(t){O(t),B(!0);return}if(G.current!==X){G.current=X,O([]),B(!1);try{let t=fe((await I(e,``,!0)).entries);me.set(X,t),O(t),B(!0)}catch{O([]),B(!1)}finally{G.current===X&&(G.current=null)}}},[X,e]),re=(0,H.useCallback)(()=>{W(!0)},[]),ie=(0,H.useCallback)(()=>{me.delete(X),O([]),B(!1)},[X]),ae=(0,H.useCallback)(()=>{ie(),V&&Z()},[ie,Z,V]),Q=(0,H.useCallback)(e=>a.get(e)??0,[a]),se=(0,H.useCallback)(e=>{o(t=>{let n=new Map(t);return n.set(e,(t.get(e)??0)+1),n})},[]),$=(0,H.useCallback)(t=>{e&&(S(ce(e,t,Q(t))),se(t))},[se,Q,e]),de=(0,H.useCallback)(t=>{if(!e)return;let n=t.path.split(`/`);t.type===`file`&&n.pop();let r=[],i=``;for(let e of n)i=i?`${i}/${e}`:e,r.push(i);c(e=>{let t=new Set(e);for(let e of r)t.add(e);return t})},[e]);(0,H.useEffect)(()=>{if(!e)return;let t=q.current!==null&&q.current!==e;q.current=e,t&&(o(new Map([[``,0]])),c(new Set),u(null),f(null),K.current=J)},[J,e]),(0,H.useEffect)(()=>{!e||J<=K.current||(K.current=J,o(t=>{let n=new Set([``]);for(let e of s)n.add(e);let r=new Map(t);for(let i of n){let n=t.get(i)??0;S(ce(e,i,n)),r.set(i,n+1)}return r}))},[J,s,e]),(0,H.useEffect)(()=>{O([]),B(!1),W(!1),G.current=null},[X]),(0,H.useEffect)(()=>{!V||!e||Z()},[Z,V,e]),(0,H.useEffect)(()=>{if(!Y||!e)return;let t=Y.split(`/`);t.pop();let n=[],r=``;for(let e of t)r=r?`${r}/${e}`:e,n.push(r);if(n.length!==0){c(e=>{let t=new Set(e);for(let e of n)t.add(e);return t});for(let e of n)o(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})}},[Y,e]);function he(e){s.has(e.path)?c(t=>{let n=new Set(t);return n.delete(e.path),n}):(c(t=>new Set(t).add(e.path)),o(t=>{if(t.has(e.path))return t;let n=new Map(t);return n.set(e.path,0),n}))}function ge(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(0,t):``}function _e(e){v(e)}async function ve(t){try{await R(e,t.path)}catch{D({title:`Error`,description:`Failed to open "${t.name}"`,variant:`destructive`})}}async function ye(){if(!_)return;let t=_;v(null);try{await L(e,t.path),te(t.path),$(ge(t.path)),ae(),c(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),o(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n})}catch{D({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 P(e,t.path,n),$(ge(t.path)),ae(),t.type===`folder`&&(c(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),o(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}))}catch{D({title:`Error`,description:`Failed to rename "${t.name}"`,variant:`destructive`})}}function Se(e){u(null),s.has(e)||(c(t=>new Set(t).add(e)),o(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})),f({dirPath:e,type:`file`})}function Ce(e){u(null),s.has(e)||(c(t=>new Set(t).add(e)),o(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})),f({dirPath:e,type:`folder`})}async function we(t){if(!d)return;let{dirPath:n,type:r}=d;f(null);try{r===`file`?await z(e,n,t):await F(e,n,t),$(n),ae()}catch{D({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,U.jsx)(ue,{defaultValue:``,level:0,basePadding:d.type===`folder`?10:22,icon:d.type===`folder`?(0,U.jsx)(i,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(r,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:we,onCancel:Te}):null;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(g,{open:_!==null,onOpenChange:e=>!e&&v(null),children:(0,U.jsxs)(y,{children:[(0,U.jsx)(m,{children:`Move to Trash`}),(0,U.jsxs)(h,{children:[`Move “`,_?.name,`” to trash?`]}),(0,U.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[(0,U.jsx)(p,{children:`Cancel`}),(0,U.jsx)(b,{onClick:()=>void ye(),children:`Move to Trash`})]})]})}),(0,U.jsx)(`div`,{className:`border-b border-border bg-background px-2 py-2`,children:(0,U.jsx)(oe,{items:E,isReady:A,onRequestIndex:re,onOpenChange:ne,onSelect:e=>Ee(e)},X)}),(0,U.jsxs)(N,{children:[(0,U.jsx)(k,{asChild:!0,disabled:w,children:(0,U.jsx)(`div`,{className:`py-2 min-h-full`,children:(0,U.jsx)(x,{fallbackTitle:`Failed to load files`,onRetry:()=>$(``),children:(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(C,{}),children:(0,U.jsx)(le,{threadId:e,dirPath:``,version:Q(``),children:r=>(0,U.jsxs)(U.Fragment,{children:[De,r.map(r=>(0,U.jsx)(pe,{node:r,level:0,threadId:e,selectedPath:t,expandedPaths:s,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,U.jsxs)(j,{children:[(0,U.jsx)(M,{onSelect:()=>Se(``),children:`New File...`}),(0,U.jsx)(M,{onSelect:()=>Ce(``),children:`New Folder...`})]})]})]})}export{he as default};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$i as t,Fo as n,Gi as r,Mo as i,Ni as a,Uo as o,Wi as s,Xa as c,at as l,es as u,fs as d,ji as f,jo as p,ls as m,po as ee,ro as te,us as h}from"./dialogs-config-COzptu1b.js";import{M as g}from"./react-vendor-CEpXTE2b.js";import{I as _,a as v,l as y,n as b,o as x}from"./history-view-BJ65FVAN.js";import{n as ne}from"./utils-DDUhUTLy.js";import{A as S,C,E as w,M as T,P as E,R as re,S as ie,c as ae,x as oe}from"./index-BMgOr4si.js";import{a as D,i as O,l as se,o as k,s as A,t as ce}from"./api-_tZksLaY.js";var j=h(),M=m(),N=e(d(),1),P=_(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=_(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:n=!1,onShowTree:r,onFileCreated:d}){let{resolvedTheme:p}=ne(),m=re(e=>e.selectedThreadId),{triggerExplorerRefresh:h}=S(),_=(0,N.useRef)(null),v=(0,N.useRef)(null),D=(0,N.useRef)(!1),O=(0,N.useRef)(!0),[k,j]=(0,N.useState)(null),[I,W]=(0,N.useState)(!1),[K,q]=(0,N.useState)(`edit`),[ue,de]=(0,N.useState)(0),[J,fe]=(0,N.useState)(null),[Y,X]=(0,N.useState)(!1);(0,N.useEffect)(()=>{m&&l(m).then(fe).catch(()=>{})},[m]);let pe=async()=>{if(!(!J||Y)){X(!0);try{await navigator.clipboard.writeText(J),E({title:`Copied`,description:`Repository folder path copied to clipboard.`})}catch{E({title:`Error`,description:`Failed to copy path to clipboard.`,variant:`destructive`})}finally{X(!1)}}},me=async()=>{if(m)try{await A(m,`.`)}catch{E({title:`Error`,description:`Failed to open repository folder.`,variant:`destructive`})}},he=(0,N.useCallback)(async e=>{if(m)try{let t=await R(m,e);await ce(m,``,t);let n={name:t,path:t,type:`file`};v.current=t,D.current=!0,d?.(n),h(),E({title:`Created`,description:`${t} created successfully.`})}catch{E({title:`Error`,description:`Failed to create file.`,variant:`destructive`})}},[m,d,h]),Z=e?s(e.path,e.name):null,Q=e?.type===`file`&&m&&!Z?e:null,$=k?.content??``,ge=k?.original??``,_e=Q?`${m}:${Q.path}:${ue}`:null;(0,N.useEffect)(()=>()=>{_.current&&=(_.current.getModel()?.dispose(),_.current.dispose(),null)},[]),(0,N.useEffect)(()=>{if(e?.type===`file`?v.current===e.path?(v.current=null,q(`edit`)):q(z(e.path)?`view`:`edit`):q(`edit`),O.current){O.current=!1;return}j(null)},[e?.path,m]);async function ve(){if(!(!m||!e)){W(!0);try{await se(m,e.path,$),j({content:$,original:$}),E({title:`Saved`,description:`${e.name} saved successfully.`})}catch(e){E({title:`Error`,description:e instanceof Error?e.message:`Failed to save file`,variant:`destructive`})}finally{W(!1)}}}function ye(){!m||!Q||(x(V(m,Q.path)),j(null),de(e=>e+1))}return m?(0,M.jsx)(F,{v0:(0,M.jsxs)(ae,{className:`justify-between`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[n&&r?(0,M.jsxs)(f,{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)(te,{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:a(t.label,`truncate text-foreground`),children:e?e.name:`Select a file to edit`}),(0,M.jsx)(`span`,{className:a(t.compact,`truncate text-muted-foreground`),children:e?e.path:`Browse and edit repository files`})]})]}),(0,M.jsxs)(`div`,{className:`flex gap-2`,children:[Q&&k?(0,M.jsxs)(M.Fragment,{children:[z(Q.path)?(0,M.jsxs)(`div`,{className:`flex rounded-full border border-input bg-background p-0.5`,children:[(0,M.jsx)(f,{size:`sm`,variant:K===`view`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>q(`view`),children:`View`}),(0,M.jsx)(f,{size:`sm`,variant:K===`edit`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>q(`edit`),children:`Edit`})]}):null,(0,M.jsxs)(f,{size:`sm`,onClick:()=>void ve(),disabled:I||!$||$===ge,children:[I?(0,M.jsx)(ee,{className:`h-4 w-4 animate-spin`}):null,`Save`]})]}):null,e?null:(0,M.jsxs)(oe,{children:[(0,M.jsx)(w,{asChild:!0,children:(0,M.jsxs)(f,{size:`sm`,className:`gap-1.5`,children:[(0,M.jsx)(c,{className:`h-3.5 w-3.5`}),`New file`]})}),(0,M.jsx)(ie,{align:`end`,children:L.map(({label:e,ext:t,icon:n})=>(0,M.jsxs)(C,{onSelect:()=>void he(t),children:[(0,M.jsx)(n,{className:`h-4 w-4`}),e]},t))})]})]})]}),v1:Q?(0,M.jsxs)(b,{fallbackTitle:`Failed to load file`,onRetry:ye,children:[(0,M.jsx)(N.Suspense,{fallback:(0,M.jsx)(y,{}),children:(0,M.jsx)(H,{threadId:m,path:Q.path,onContentReady:j},_e??void 0)}),k?z(Q.path)&&K===`view`?(0,M.jsx)(`div`,{className:`h-full overflow-auto p-6`,children:(0,M.jsx)(T,{content:$,enableMermaid:!0})}):(0,M.jsx)(g,{height:`100%`,language:B(Q.path),value:$,onChange:e=>j(t=>t&&{...t,content:e??``}),onMount:e=>{_.current=e,D.current&&(D.current=!1,e.focus())},theme:p===`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)(y,{})]}):e?.type===`file`&&Z===`image`?(0,M.jsx)(b,{fallbackTitle:`Failed to load image`,onRetry:()=>{!m||!e||x(U(m,e.path))},children:(0,M.jsx)(N.Suspense,{fallback:(0,M.jsx)(y,{}),children:(0,M.jsx)(G,{threadId:m,path:e.path,alt:e.name})})}):e?.type===`file`&&Z===`video`?(0,M.jsx)(b,{fallbackTitle:`Failed to load video`,onRetry:()=>{!m||!e||x(U(m,e.path))},children:(0,M.jsx)(N.Suspense,{fallback:(0,M.jsx)(y,{}),children:(0,M.jsx)(le,{threadId:m,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:a(t.pageTitle,`text-foreground`),children:`File Explorer`}),(0,M.jsx)(`p`,{className:a(t.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:J?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`button`,{type:`button`,onClick:()=>void me(),className:a(t.compact,`min-w-0 flex-1 truncate text-left font-mono text-muted-foreground hover:text-foreground hover:underline`),title:J,children:J}),(0,M.jsxs)(f,{variant:`ghost`,size:`icon`,className:`h-7 w-7 shrink-0`,onClick:()=>void pe(),disabled:Y,children:[Y?(0,M.jsx)(u,{className:`h-3.5 w-3.5`}):(0,M.jsx)(o,{className:`h-3.5 w-3.5`}),(0,M.jsx)(`span`,{className:`sr-only`,children:`Copy path`})]})]}):(0,M.jsx)(`p`,{className:a(t.compact,`text-muted-foreground/50 italic`),children:`Loading path...`})})}):(0,M.jsx)(P,{v0:(0,M.jsx)(i,{className:`h-8 w-8 text-muted-foreground`}),v1:t.bodyMuted})},L=[{label:`Markdown`,ext:`md`,icon:i},{label:`TypeScript`,ext:`ts`,icon:n},{label:`Text`,ext:`txt`,icon:p}];async function R(e,t){try{let n=await k(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 r(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`}[r(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=()=>D(n,r),t[3]=r,t[4]=n,t[5]=o):o=t[5];let s=v(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=()=>O(e,t),n[3]=t,n[4]=e,n[5]=i):i=n[5];let a=v(r,i),o;n[6]===a?o=n[7]:(o=URL.createObjectURL(a),n[6]=a,n[7]=o);let s=o,c,l;return n[8]===s?(c=n[9],l=n[10]):(c=()=>()=>{URL.revokeObjectURL(s)},l=[s],n[8]=s,n[9]=c,n[10]=l),(0,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{$i as e,$r as t,Ni as n,Qr as r,Yr as i,Zr as a,ei as o,ji as s,ls as c,po as l,ti as u,us as d}from"./dialogs-config-COzptu1b.js";var f=d(),p=c();function m(c){let d=(0,f.c)(28),{open:m,onOpenChange:g,commits:_,displayedCommits:v,isLoadingMore:y,onScroll:b,currentBranch:x}=c,S;d[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,p.jsx)(u,{children:`Commit History`}),d[0]=S):S=d[0];let C;d[1]===x?C=d[2]:(C=(0,p.jsxs)(o,{children:[S,(0,p.jsxs)(r,{children:[`Recent commits on branch `,x]})]}),d[1]=x,d[2]=C);let w;d[3]===v?w=d[4]:(w=v.length>0?v.map(h):(0,p.jsx)(`p`,{className:n(e.bodyMuted,`text-center py-8`),children:`No commits found`}),d[3]=v,d[4]=w);let T;d[5]===y?T=d[6]:(T=y&&(0,p.jsx)(`div`,{className:`p-3 text-center`,children:(0,p.jsx)(l,{className:`h-4 w-4 animate-spin inline`})}),d[5]=y,d[6]=T);let E;d[7]!==_.length||d[8]!==v.length||d[9]!==y?(E=v.length<_.length&&!y&&(0,p.jsx)(`div`,{className:n(e.caption,`p-3 text-center`),children:`Scroll to load more`}),d[7]=_.length,d[8]=v.length,d[9]=y,d[10]=E):E=d[10];let D;d[11]!==w||d[12]!==T||d[13]!==E?(D=(0,p.jsxs)(`div`,{className:`divide-y`,children:[w,T,E]}),d[11]=w,d[12]=T,d[13]=E,d[14]=D):D=d[14];let O;d[15]!==b||d[16]!==D?(O=(0,p.jsx)(`div`,{className:`flex-1 overflow-y-auto border rounded-lg`,onScroll:b,children:D}),d[15]=b,d[16]=D,d[17]=O):O=d[17];let k;d[18]===g?k=d[19]:(k=(0,p.jsx)(t,{children:(0,p.jsx)(s,{onClick:()=>g(!1),children:`Close`})}),d[18]=g,d[19]=k);let A;d[20]!==C||d[21]!==O||d[22]!==k?(A=(0,p.jsxs)(a,{className:`max-w-2xl max-h-[80vh] flex flex-col`,children:[C,O,k]}),d[20]=C,d[21]=O,d[22]=k,d[23]=A):A=d[23];let j;return d[24]!==g||d[25]!==m||d[26]!==A?(j=(0,p.jsx)(i,{open:m,onOpenChange:g,children:A}),d[24]=g,d[25]=m,d[26]=A,d[27]=j):j=d[27],j}function h(t){return(0,p.jsxs)(`div`,{className:`p-3 hover:bg-muted/50 transition-colors`,children:[(0,p.jsx)(`p`,{className:n(e.label,`break-words`),children:t.message}),(0,p.jsxs)(`p`,{className:n(e.bodyMuted,`mt-1`),children:[(0,p.jsx)(`span`,{className:e.mono,children:t.hash.substring(0,7)}),` •`,` `,t.author,` • `,new Date(t.date).toLocaleDateString()]})]},t.hash)}export{m as GitHistoryDialog};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/commit-dialog-BAFsxiuw.js","assets/index-BMgOr4si.js","assets/rolldown-runtime-aKtaBQYM.js","assets/monaco-CZnIWXyV.js","assets/monaco-Br_kD0ds.css","assets/history-view-BJ65FVAN.js","assets/dialogs-config-COzptu1b.js","assets/onboarding-pVfMmu_a.js","assets/vosk-speech-BHa2mKnm.js","assets/react-vendor-CEpXTE2b.js","assets/utils-DDUhUTLy.js","assets/index-DzUALYN4.css","assets/pull-request-dialog-DD9Yxl2t.js","assets/create-repo-dialog-D6cKAxMh.js","assets/git-history-dialog-CTJwMGDA.js","assets/push-before-pr-dialog-09SWB4nh.js","assets/pull-with-changes-dialog-yEIyN-rw.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$i as t,$o as n,C as r,Co as i,Dt as a,Ea as ee,Fr as o,Gt as te,Ir as ne,Ja as re,Jt as s,Kt as ie,Lr as ae,Ni as oe,Pr as se,Qt as ce,Ro as c,So as l,To as u,Un as d,Ut as le,Y as f,Yt as p,an as m,as as ue,ct as de,dt as fe,fs as h,ji as pe,la as me,ls as g,mt as he,nn as ge,po as _,q as v,ss as y,us as b,vo as _e,xa as ve,zo as ye}from"./dialogs-config-COzptu1b.js";import{r as x}from"./monaco-CZnIWXyV.js";import{B as be,C as S,E as xe,L as Se,P as C,R as Ce,S as we,T as Te,g as Ee,h as De,v as Oe,w as ke,x as Ae}from"./index-BMgOr4si.js";var w=e(h(),1),T=g();function E(e){return!e.hasChanges&&e.defaultBranchBehind>0}function D(e){return e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits}function O(e){return e.hasUnpushedCommits&&e.prExists}function je(e,t){return t?`Creating PR...`:e.hasChanges?`Commit`:O(e)?`Update PR`:D(e)?`Open PR`:e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges?`Create PR`:E(e)?`Sync`:`Commit`}function Me(e,t,n=!1){return t||n?(0,T.jsx)(_,{className:`h-3.5 w-3.5 animate-spin`}):e.hasChanges?(0,T.jsx)(u,{className:`h-3.5 w-3.5`}):D(e)?(0,T.jsx)(c,{className:`h-3.5 w-3.5`}):E(e)?(0,T.jsx)(y,{className:`h-3.5 w-3.5`}):(0,T.jsx)(i,{className:`h-3.5 w-3.5`})}function Ne(e){if(e.hasChanges)return e.changedFilesCount>0?`Commit ${e.changedFilesCount} changed file${e.changedFilesCount===1?``:`s`}`:`No changes to commit`;if(O(e))return`Update pull request with unpushed commits`;if(D(e))return`View pull request in GitHub`;if(e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges)return`Create pull request for committed changes`;if(E(e)){let t=e.defaultBranch??`main`,n=`${e.defaultBranchBehind} commit${e.defaultBranchBehind===1?``:`s`} behind origin/${t}`,r=e.defaultBranchAhead>0?`, ${e.defaultBranchAhead} commit${e.defaultBranchAhead===1?``:`s`} ahead`:``;return e.currentBranch===e.defaultBranch?`Your branch is ${n}${r}. Click to pull the latest changes.`:`Your branch "${e.currentBranch}" is ${n}${r}. Click to rebase onto the latest ${t}.`}return`No actions available`}function Pe(e,t,n=!1){return t||n?!0:D(e)||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges||E(e)?!1:!e.hasChanges&&!e.hasUnpushedCommits}function Fe(e){return e.hasChanges||D(e)||O(e)||E(e)||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges}var Ie=b();function Le(e){let r=(0,Ie.c)(103),{branchStatus:a,remoteUrl:te,hasRemoteBranch:s,hasUnpushedCommits:ie,canCreateRepo:ce,repoUrl:u,isRefreshing:d,isBrandState:le,hasChanges:f,defaultBranch:p,defaultBranchAhead:m,defaultBranchBehind:de,gitUser:fe,isDirectCommitMode:h,autoGenerateCommitMessage:me,isLoading:g,isLoadingHistory:he,isQuickCommitting:ge,onFetch:v,onPull:b,onPush:x,onOpenHistory:be,onCreatePR:Se,onCreateRepo:C,onViewInGitHub:Ce,onQuickCommit:Ee,onSyncWithDefault:De,onOpenChange:Oe,layout:w}=e,E=w===void 0?`bar`:w,D=!!p&&!!te&&de>0,O=!f&&!g,je=E===`bar`&&`w-8 rounded-l-none`,Me=E===`menu`&&`w-full justify-start gap-2 rounded-md`,Ne=le&&E===`bar`&&` border-transparent bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground`,Pe;r[0]!==je||r[1]!==Me||r[2]!==Ne?(Pe=oe(`h-8 px-1`,je,Me,Ne),r[0]=je,r[1]=Me,r[2]=Ne,r[3]=Pe):Pe=r[3];let Fe;r[4]===d?Fe=r[5]:(Fe=d?(0,T.jsx)(_,{className:`h-3.5 w-3.5 animate-spin`}):(0,T.jsx)(n,{className:`h-3.5 w-3.5`}),r[4]=d,r[5]=Fe);let Le;r[6]===E?Le=r[7]:(Le=E===`menu`&&(0,T.jsx)(`span`,{children:`More git actions`}),r[6]=E,r[7]=Le);let k;r[8]!==g||r[9]!==Pe||r[10]!==Fe||r[11]!==Le?(k=(0,T.jsx)(xe,{asChild:!0,children:(0,T.jsxs)(pe,{variant:`outline`,size:`sm`,className:Pe,disabled:g,children:[Fe,Le]})}),r[8]=g,r[9]=Pe,r[10]=Fe,r[11]=Le,r[12]=k):k=r[12];let A;r[13]!==a||r[14]!==te?(A=a===`Behind`&&(0,T.jsxs)(`div`,{className:oe(t.compact,`px-2 py-1 text-amber-600`),children:[`Branch is behind `,te?`origin`:`remote`]}),r[13]=a,r[14]=te,r[15]=A):A=r[15];let j;r[16]===fe?j=r[17]:(j=fe&&(0,T.jsxs)(`div`,{className:oe(t.compact,`px-2 py-1 text-muted-foreground`),children:[(0,T.jsx)(`span`,{className:`font-medium`,children:`User:`}),` `,fe]}),r[16]=fe,r[17]=j);let Re;r[18]===Symbol.for(`react.memo_cache_sentinel`)?(Re=(0,T.jsx)(ke,{}),r[18]=Re):Re=r[18];let M;r[19]!==O||r[20]!==p||r[21]!==m||r[22]!==de||r[23]!==f||r[24]!==De||r[25]!==D?(M=D&&(0,T.jsx)(ne,{children:(0,T.jsxs)(se,{children:[(0,T.jsx)(ae,{asChild:!0,children:(0,T.jsxs)(S,{onClick:()=>{O&&De()},className:O?``:`opacity-50 cursor-not-allowed`,children:[(0,T.jsx)(re,{className:`h-3.5 w-3.5 mr-2`}),`Sync with `,p,(0,T.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 pl-3 text-xs tabular-nums text-muted-foreground`,children:[m>0&&(0,T.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,T.jsx)(ue,{className:`h-3 w-3`}),m]}),de>0&&(0,T.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,T.jsx)(y,{className:`h-3 w-3`}),de]})]})]})}),(0,T.jsx)(o,{side:`right`,children:f?`Commit or stash changes before syncing with the default branch`:`Pull latest changes from origin/${p} onto your current branch`})]})}),r[19]=O,r[20]=p,r[21]=m,r[22]=de,r[23]=f,r[24]=De,r[25]=D,r[26]=M):M=r[26];let N;r[27]!==me||r[28]!==f||r[29]!==g||r[30]!==ge||r[31]!==Ee?(N=f&&me&&(0,T.jsx)(ne,{children:(0,T.jsxs)(se,{children:[(0,T.jsx)(ae,{asChild:!0,children:(0,T.jsxs)(S,{onClick:Ee,disabled:g||ge,children:[ge?(0,T.jsx)(_,{className:`h-3.5 w-3.5 mr-2 animate-spin`}):(0,T.jsx)(ve,{className:`h-3.5 w-3.5 mr-2`}),`Quick Commit`,(0,T.jsx)(Te,{children:`⌘⇧C`})]})}),(0,T.jsx)(o,{side:`right`,children:`Generate the commit message and commit`})]})}),r[27]=me,r[28]=f,r[29]=g,r[30]=ge,r[31]=Ee,r[32]=N):N=r[32];let ze;r[33]===Symbol.for(`react.memo_cache_sentinel`)?(ze=(0,T.jsx)(ye,{className:`h-3.5 w-3.5 mr-2`}),r[33]=ze):ze=r[33];let P;r[34]!==g||r[35]!==v?(P=(0,T.jsx)(ae,{asChild:!0,children:(0,T.jsxs)(S,{onClick:v,disabled:g,children:[ze,`Fetch`]})}),r[34]=g,r[35]=v,r[36]=P):P=r[36];let Be;r[37]===Symbol.for(`react.memo_cache_sentinel`)?(Be=(0,T.jsx)(o,{side:`right`,children:`Download latest information from remote without merging changes`}),r[37]=Be):Be=r[37];let F;r[38]===P?F=r[39]:(F=(0,T.jsx)(ne,{children:(0,T.jsxs)(se,{children:[P,Be]})}),r[38]=P,r[39]=F);let I;r[40]!==s||r[41]!==g||r[42]!==b?(I=()=>{s&&!g&&b()},r[40]=s,r[41]=g,r[42]=b,r[43]=I):I=r[43];let Ve=!s||g?`opacity-50 cursor-not-allowed`:``,L;r[44]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,T.jsx)(y,{className:`h-3.5 w-3.5 mr-2`}),r[44]=L):L=r[44];let R;r[45]!==I||r[46]!==Ve?(R=(0,T.jsx)(ae,{asChild:!0,children:(0,T.jsxs)(S,{onClick:I,className:Ve,children:[L,`Pull`]})}),r[45]=I,r[46]=Ve,r[47]=R):R=r[47];let He=s?`Pull latest changes from remote`:`No remote branch to pull from`,z;r[48]===He?z=r[49]:(z=(0,T.jsx)(o,{side:`right`,children:He}),r[48]=He,r[49]=z);let B;r[50]!==R||r[51]!==z?(B=(0,T.jsx)(ne,{children:(0,T.jsxs)(se,{children:[R,z]})}),r[50]=R,r[51]=z,r[52]=B):B=r[52];let V;r[53]!==s||r[54]!==g||r[55]!==x?(V=!s&&(0,T.jsx)(ne,{children:(0,T.jsxs)(se,{children:[(0,T.jsx)(ae,{asChild:!0,children:(0,T.jsxs)(S,{onClick:x,disabled:g,children:[(0,T.jsx)(ee,{className:`h-3.5 w-3.5 mr-2`}),`Push Branch to Remote`]})}),(0,T.jsx)(o,{side:`right`,children:`Create remote branch and push local commits`})]})}),r[53]=s,r[54]=g,r[55]=x,r[56]=V):V=r[56];let H;r[57]!==ie||r[58]!==g||r[59]!==x?(H=()=>{ie&&!g&&x()},r[57]=ie,r[58]=g,r[59]=x,r[60]=H):H=r[60];let Ue=!ie||g?`opacity-50 cursor-not-allowed`:``,We;r[61]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,T.jsx)(ee,{className:`h-3.5 w-3.5 mr-2`}),r[61]=We):We=r[61];let U;r[62]!==H||r[63]!==Ue?(U=(0,T.jsx)(ae,{asChild:!0,children:(0,T.jsxs)(S,{onClick:H,className:Ue,children:[We,`Push Commits`]})}),r[62]=H,r[63]=Ue,r[64]=U):U=r[64];let Ge=ie?g?`Push in progress...`:`Push your uncommitted commits to the remote branch`:`No commits to push - your branch is up to date with remote`,W;r[65]===Ge?W=r[66]:(W=(0,T.jsx)(o,{side:`right`,children:Ge}),r[65]=Ge,r[66]=W);let G;r[67]!==U||r[68]!==W?(G=(0,T.jsx)(ne,{children:(0,T.jsxs)(se,{children:[U,W]})}),r[67]=U,r[68]=W,r[69]=G):G=r[69];let Ke=g||he,qe;r[70]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,T.jsx)(_e,{className:`h-3.5 w-3.5 mr-2`}),r[70]=qe):qe=r[70];let K;r[71]!==be||r[72]!==Ke?(K=(0,T.jsxs)(S,{onClick:be,disabled:Ke,children:[qe,`History`]}),r[71]=be,r[72]=Ke,r[73]=K):K=r[73];let Je;r[74]!==h||r[75]!==g||r[76]!==Se?(Je=!h&&(0,T.jsxs)(S,{onClick:Se,disabled:g,children:[(0,T.jsx)(i,{className:`h-3.5 w-3.5 mr-2`}),`Create Pull Request`,(0,T.jsx)(Te,{children:`⌘⇧P`})]}),r[74]=h,r[75]=g,r[76]=Se,r[77]=Je):Je=r[77];let q;r[78]!==ce||r[79]!==g||r[80]!==C?(q=ce&&(0,T.jsxs)(S,{onClick:C,disabled:g,children:[(0,T.jsx)(l,{className:`h-3.5 w-3.5 mr-2`}),`Create Repo`]}),r[78]=ce,r[79]=g,r[80]=C,r[81]=q):q=r[81];let J;r[82]!==g||r[83]!==Ce||r[84]!==u?(J=u&&(0,T.jsxs)(S,{onClick:Ce,disabled:g,children:[(0,T.jsx)(c,{className:`h-3.5 w-3.5 mr-2`}),`View in GitHub`]}),r[82]=g,r[83]=Ce,r[84]=u,r[85]=J):J=r[85];let Y;r[86]!==j||r[87]!==M||r[88]!==N||r[89]!==F||r[90]!==B||r[91]!==V||r[92]!==G||r[93]!==K||r[94]!==Je||r[95]!==q||r[96]!==J||r[97]!==A?(Y=(0,T.jsxs)(we,{align:`end`,children:[A,j,Re,M,N,F,B,V,G,K,Je,q,J]}),r[86]=j,r[87]=M,r[88]=N,r[89]=F,r[90]=B,r[91]=V,r[92]=G,r[93]=K,r[94]=Je,r[95]=q,r[96]=J,r[97]=A,r[98]=Y):Y=r[98];let Ye;return r[99]!==Oe||r[100]!==Y||r[101]!==k?(Ye=(0,T.jsxs)(Ae,{onOpenChange:Oe,children:[k,Y]}),r[99]=Oe,r[100]=Y,r[101]=k,r[102]=Ye):Ye=r[102],Ye}function k(e){return e?!0:(C({title:`Error`,description:`No thread selected`,variant:`destructive`}),!1)}function A(e){let t=e.split(`/`);return t.length>=2?{provider:t[0],model:t.slice(1).join(`/`)}:{provider:void 0,model:e}}function j(e,t,n){let[r,i]=(0,w.useState)(!1),[a,ee]=(0,w.useState)(!1),o=()=>n?.id?n.provider?{provider:n.provider,model:n.id}:A(n.id):{provider:void 0,model:void 0};return{isGeneratingMessage:r,isGeneratingPRInfo:a,generateCommitMessageWithAI:(0,w.useCallback)(async()=>{if(!e)return null;try{i(!0);let{provider:t,model:n}=o();return await v(e,n,t)}catch(e){return console.error(`Failed to generate commit message:`,e),C({title:`Error`,description:e instanceof Error?e.message:`Failed to generate commit message`,variant:`destructive`}),null}finally{i(!1)}},[e,n]),generatePRInfoWithAI:(0,w.useCallback)(async()=>{if(!e)return null;try{ee(!0);let{provider:t,model:n}=o();return await f(e,n,t)}catch(e){return console.error(`Failed to generate PR info:`,e),C({title:`Error`,description:e instanceof Error?e.message:`Failed to generate PR info`,variant:`destructive`}),null}finally{ee(!1)}},[e,n])}}var Re=(0,w.lazy)(()=>x(()=>import(`./commit-dialog-BAFsxiuw.js`).then(e=>({default:e.CommitDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))),M=(0,w.lazy)(()=>x(()=>import(`./pull-request-dialog-DD9Yxl2t.js`).then(e=>({default:e.PullRequestDialog})),__vite__mapDeps([12,1,2,3,4,5,6,7,8,9,10,11]))),N=(0,w.lazy)(()=>x(()=>import(`./create-repo-dialog-D6cKAxMh.js`).then(e=>({default:e.CreateRepoDialog})),__vite__mapDeps([13,1,2,3,4,5,6,7,8,9,10,11]))),ze=(0,w.lazy)(()=>x(()=>import(`./git-history-dialog-CTJwMGDA.js`).then(e=>({default:e.GitHistoryDialog})),__vite__mapDeps([14,6,2]))),P=(0,w.lazy)(()=>x(()=>import(`./push-before-pr-dialog-09SWB4nh.js`).then(e=>({default:e.PushBeforePRDialog})),__vite__mapDeps([15,6,2]))),Be=(0,w.lazy)(()=>x(()=>import(`./pull-with-changes-dialog-yEIyN-rw.js`).then(e=>({default:e.PullWithChangesDialog})),__vite__mapDeps([16,5,2,6])));function F(){return null}async function I(e,t,n,r){r&&(await d(e,{title:r}),n({type:be.UpdateThreadTitle,projectId:t,threadId:e,title:r}))}function Ve({projectId:e,threadId:t,layout:n=`bar`}){let i=Se(),ee=Ce(e=>e.projectModelSelections[t]),re=Ce(t=>t.projects.find(t=>t.projectId===e)),[c,l]=(0,w.useState)(!1),[u,d]=(0,w.useState)(!1),[f,ue]=(0,w.useState)(!1),[h,g]=(0,w.useState)(!1),[_,v]=(0,w.useState)(``),[y,b]=(0,w.useState)(``),[_e,ve]=(0,w.useState)(``),[ye,x]=(0,w.useState)(!1),[S,xe]=(0,w.useState)(null),we=(0,w.useRef)(!1),Te=(0,w.useRef)(!1),ke=(0,w.useRef)(y),Ae=(0,w.useRef)(_e);ke.current=y,Ae.current=_e;let[E,D]=(0,w.useState)(!1),[O,Ie]=(0,w.useState)([]),[A,Ve]=(0,w.useState)(!1),[L,R]=(0,w.useState)([]),[He,z]=(0,w.useState)(!1),[B,V]=(0,w.useState)(!1),[H,Ue]=(0,w.useState)(``),[We,U]=(0,w.useState)(``),[Ge,W]=(0,w.useState)(``),[G,Ke]=(0,w.useState)(!1),[qe,K]=(0,w.useState)(!1),[Je,q]=(0,w.useState)(!1),J=(0,w.useRef)(!1),Y=Oe(),{fetchUnifiedStatus:Ye}=Y,X=j(t,e,ee),Z=(0,w.useRef)(null),Xe=(0,w.useRef)(()=>{}),Ze=(0,w.useRef)(()=>{});(0,w.useEffect)(()=>()=>{Z.current!==null&&(clearInterval(Z.current),Z.current=null)},[]);async function Q(){ge();let e=await a();i({type:be.SetProjects,projects:e.projects})}let[$,Qe]=(0,w.useState)(()=>De()),$e=re?.commitMethod===me.Direct;(0,w.useEffect)(()=>{B&&re?.name&&!H&&Ue(re.name)},[B,re?.name,H]),(0,w.useEffect)(()=>{Ee($)},[$]);function et(){G||(Ke(!0),fe().then(e=>W(e)).catch(()=>{}))}(0,w.useEffect)(()=>{if(!f){Te.current=!1;return}if(f&&$.autoGenerateCommitMessage&&!_.trim()&&t&&!Te.current){Te.current=!0;async function e(){let e=await X.generateCommitMessageWithAI();e&&v(e)}e()}},[f,$.autoGenerateCommitMessage,t,X.generateCommitMessageWithAI,_]),(0,w.useEffect)(()=>{if(!h){we.current=!1;return}if(h&&$.autoGeneratePRInfo&&!ke.current.trim()&&!Ae.current.trim()&&t&&!we.current){we.current=!0;async function e(){let e=await X.generatePRInfoWithAI();e&&(b(e.title),ve(e.description),C({title:`Success`,description:`PR title and description generated`}))}e()}},[h,$.autoGeneratePRInfo,t,X.generatePRInfoWithAI]),Xe.current=at,Ze.current=()=>g(!0),(0,w.useEffect)(()=>{function e(e){let t=e.key.toLowerCase();if((e.metaKey||e.ctrlKey)&&e.shiftKey&&!e.altKey){if(t===`c`){Y.hasChanges&&$.autoGenerateCommitMessage&&!c&&(e.preventDefault(),Xe.current());return}t===`p`&&Y.commitsAheadOfDefault&&!Y.prExists&&!Y.hasChanges&&!c&&!$e&&(e.preventDefault(),Ze.current())}}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Y.commitsAheadOfDefault,Y.hasChanges,Y.prExists,$.autoGenerateCommitMessage,c,$e]),(0,w.useEffect)(()=>{u&&Y.prExists&&Y.prState===`OPEN`&&d(!1)},[Y.prExists,Y.prState,u]),(0,w.useEffect)(()=>{if(!u)return;let e=setTimeout(()=>{d(!1)},15e3);return()=>clearTimeout(e)},[u]),(0,w.useEffect)(()=>{let e=Y.prExists&&Y.prState===`OPEN`&&!Y.hasChanges&&!Y.hasUnpushedCommits;e&&!J.current&&Q(),J.current=e},[Y.hasChanges,Y.hasUnpushedCommits,Y.prExists,Y.prState]);async function tt(){if(_.trim()&&k(t))try{l(!0),await le(t,_),v(``),ue(!1),await Y.fetchUnifiedStatus(!0),Q(),C({title:`Changes committed successfully`,description:`Your changes have been committed to '${Y.currentBranch}'.`}),Je&&(q(!1),await lt())}catch(e){console.error(`Failed to commit:`,e),C({title:`Commit failed`,description:e instanceof Error?e.message:`Failed to commit changes`,variant:`destructive`})}finally{l(!1)}}async function nt(){if(!k(t))return;let e=Y.prUrl;if(!e)try{e=(await he(t)).url}catch(e){console.error(`Failed to fetch pull request URL:`,e),C({title:`Could not open pull request`,description:e instanceof Error?e.message:`Failed to fetch pull request URL`,variant:`destructive`});return}if(!e){C({title:`Could not open pull request`,description:`Pull request URL is unavailable. Try refreshing git status.`,variant:`destructive`});return}try{await m(e)}catch(e){console.error(`Failed to open pull request:`,e),C({title:`Could not open pull request`,description:e instanceof Error?e.message:`Failed to open URL in browser`,variant:`destructive`})}}async function rt(){if(Y.hasChanges){ue(!0);return}if(Y.hasUnpushedCommits&&Y.prExists){await st();return}if(Y.prExists&&Y.prState===`OPEN`&&!Y.hasChanges&&!Y.hasUnpushedCommits){await nt();return}if(Y.commitsAheadOfDefault&&!Y.prExists&&!Y.hasChanges){g(!0);return}if(Y.defaultBranchBehind>0){await ft();return}}async function it(){let e=await X.generateCommitMessageWithAI();e&&v(e)}async function at(){if(k(t))try{l(!0);let e=await X.generateCommitMessageWithAI();if(!e){C({title:`Quick Commit failed`,description:`Could not generate commit message`,variant:`destructive`});return}await le(t,e),await Y.fetchUnifiedStatus(!0),Q(),C({title:`Changes committed successfully`,description:`Committed: ${e}`})}catch(e){console.error(`Quick commit failed:`,e),C({title:`Quick Commit failed`,description:e instanceof Error?e.message:`Failed to commit changes`,variant:`destructive`})}finally{l(!1)}}async function ot(){if(k(t))try{l(!0),await ie(t),await Y.fetchUnifiedStatus()}catch(e){console.error(`Failed to fetch:`,e)}finally{l(!1)}}async function st(){if(k(t))try{l(!0),await p(t),await Y.fetchUnifiedStatus(!0),Q(),Y.hasRemoteBranch?C({title:`Branch pushed successfully`,description:`Your branch '${Y.currentBranch}' has been pushed to the remote.`}):C({title:`Push completed`,description:`Changes have been pushed successfully.`})}catch(e){console.error(`Failed to push:`,e),C({title:`Push failed`,description:e instanceof Error?e.message:`Failed to push to remote`,variant:`destructive`})}finally{l(!1)}}async function ct(){if(k(t)){if(Y.hasChanges){K(!0);return}await lt()}}async function lt(){try{l(!0),await s(t),await Y.fetchUnifiedStatus(!0),Q(),C({title:`Pull successful`,description:`Latest changes have been pulled from remote.`})}catch(e){console.error(`Failed to pull:`,e),C({title:`Pull failed`,description:e instanceof Error?e.message:`Failed to pull from remote`,variant:`destructive`})}finally{l(!1)}}function ut(){K(!1),q(!0),ue(!0)}async function dt(){K(!1),await lt()}async function ft(){if(k(t))try{l(!0),await ce(t),await Y.fetchUnifiedStatus(!0),Q(),C({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),C({title:`Sync failed`,description:e instanceof Error?e.message:`Failed to sync with default branch`,variant:`destructive`})}finally{l(!1)}}async function pt(){if(k(t))try{l(!0),d(!0);let n=await te(t,y,_e);await I(t,e,i,n.title??y),n.prUrl&&await m(n.prUrl),b(``),ve(``),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),gt({title:y,description:_e})):(d(!1),C({title:`Create PR Failed`,description:t,variant:`destructive`}))}finally{l(!1)}}async function mt(){if(k(t))try{l(!0);let e=await r(t,H,We,$.privateRepositoryDefault);e.repoUrl&&setTimeout(()=>{m(e.repoUrl)},3e3),Ue(``),U(``),V(!1),await Y.fetchUnifiedStatus(),Q()}catch(e){console.error(`Failed to create repo:`,e)}finally{l(!1)}}async function ht(){let e=await X.generatePRInfoWithAI();e&&(b(e.title),ve(e.description),C({title:`Success`,description:`PR title and description generated`}))}async function gt(n){let r=n??S;if(!(!t||!r))try{l(!0),d(!0);try{await p(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`)){C({title:`Syncing branch before push`,description:`Your branch is behind remote. Pulling latest changes first...`});try{await ce(t),await p(t)}catch{throw e}}else throw e}let n=await te(t,r.title,r.description);await I(t,e,i,n.title??r.title),n.prUrl&&await m(n.prUrl),b(``),ve(``),xe(null),x(!1),await Y.fetchUnifiedStatus(!0),Q();let a=0;Z.current!==null&&clearInterval(Z.current),Z.current=setInterval(async()=>{if(a++,a>=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`;d(!1),C({title:`Push & Create PR Failed`,description:t,variant:`destructive`})}finally{l(!1)}}async function _t(){if(k(t))try{Ve(!0);let e=await de(t,100);Ie(e),R(e.slice(0,10)),D(!0)}catch(e){console.error(`Failed to fetch git history:`,e)}finally{Ve(!1)}}function vt(){He||(z(!0),setTimeout(()=>{let e=L.length+10;R(O.slice(0,e)),z(!1)},300))}function yt(e){let t=e.currentTarget;t.scrollHeight-t.scrollTop-t.clientHeight<100&&L.length<O.length&&!He&&vt()}let bt=Fe(Y);function xt(){Y.repoUrl&&m(Y.repoUrl)}function St(){x(!1),xe(null)}return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`div`,{className:oe(`flex items-center gap-0`,n===`menu`&&`w-full flex-col gap-1 [&_button]:w-full [&_button]:justify-start`),children:[(0,T.jsx)(ne,{children:(0,T.jsxs)(se,{children:[(0,T.jsx)(ae,{asChild:!0,children:(0,T.jsxs)(pe,{variant:`outline`,size:`sm`,className:oe(`h-8 gap-1.5`,n===`bar`&&`rounded-r-none border-r-0`,n===`menu`&&`rounded-md border`,bt&&` border-transparent bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground`),disabled:Pe(Y,c,u),onClick:rt,children:[Me(Y,u,c),je(Y,u)]})}),(0,T.jsx)(o,{children:Ne(Y)})]})}),(0,T.jsx)(Le,{branchStatus:Y.status,remoteUrl:Y.remoteUrl,hasRemoteBranch:Y.hasRemoteBranch,hasUnpushedCommits:Y.hasUnpushedCommits,canCreateRepo:Y.canCreateRepo,repoUrl:Y.repoUrl,isRefreshing:Y.isRefreshing,isBrandState:bt,hasChanges:Y.hasChanges,defaultBranch:Y.defaultBranch??null,defaultBranchAhead:Y.defaultBranchAhead,defaultBranchBehind:Y.defaultBranchBehind,gitUser:Ge,isDirectCommitMode:$e,autoGenerateCommitMessage:$.autoGenerateCommitMessage,isLoading:c||u,isLoadingHistory:A,isQuickCommitting:X.isGeneratingMessage&&c,onFetch:()=>void ot(),onPull:()=>void ct(),onPush:()=>void st(),onOpenHistory:()=>void _t(),onCreatePR:()=>g(!0),onCreateRepo:()=>V(!0),onViewInGitHub:xt,onQuickCommit:()=>void at(),onSyncWithDefault:()=>void ft(),onOpenChange:e=>{e&&(et(),Ye(!0))},layout:n})]}),f&&(0,T.jsx)(w.Suspense,{fallback:(0,T.jsx)(F,{}),children:(0,T.jsx)(Re,{open:f,onOpenChange:ue,commitMessage:_,onCommitMessageChange:v,autoGenerateCommitMessage:$.autoGenerateCommitMessage,onAutoGenerateChange:e=>Qe(t=>({...t,autoGenerateCommitMessage:e})),isGeneratingMessage:X.isGeneratingMessage,isLoading:c,onGenerateMessage:it,onCommit:tt,currentBranch:Y.currentBranch})}),h&&(0,T.jsx)(w.Suspense,{fallback:(0,T.jsx)(F,{}),children:(0,T.jsx)(M,{open:h,onOpenChange:g,prTitle:y,onPrTitleChange:b,prDescription:_e,onPrDescriptionChange:ve,isGeneratingPRInfo:X.isGeneratingPRInfo,isLoading:c,onGeneratePRInfo:ht,onCreatePR:pt,currentBranch:Y.currentBranch,autoGeneratePRInfo:$.autoGeneratePRInfo,onAutoGeneratePRInfoChange:e=>Qe(t=>({...t,autoGeneratePRInfo:e}))})}),ye&&(0,T.jsx)(w.Suspense,{fallback:(0,T.jsx)(F,{}),children:(0,T.jsx)(P,{open:ye,onOpenChange:x,isLoading:c,onPushAndCreatePR:gt,onCancel:St})}),B&&(0,T.jsx)(w.Suspense,{fallback:(0,T.jsx)(F,{}),children:(0,T.jsx)(N,{open:B,onOpenChange:V,repoName:H,onRepoNameChange:Ue,repoDescription:We,onRepoDescriptionChange:U,isPrivateRepo:$.privateRepositoryDefault,onPrivateRepoChange:e=>Qe(t=>({...t,privateRepositoryDefault:e})),isLoading:c,onCreateRepo:mt})}),E&&(0,T.jsx)(w.Suspense,{fallback:(0,T.jsx)(F,{}),children:(0,T.jsx)(ze,{open:E,onOpenChange:D,commits:O,displayedCommits:L,isLoadingMore:He,onScroll:yt,currentBranch:Y.currentBranch})}),qe&&(0,T.jsx)(w.Suspense,{fallback:(0,T.jsx)(F,{}),children:(0,T.jsx)(Be,{open:qe,onOpenChange:K,onCommitFirst:ut,onStashAndPull:dt,onCancel:()=>K(!1),isLoading:c})})]})}export{Ve as GitOpsButton};
@@ -0,0 +1,9 @@
1
+ import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{$i as n,$o as r,Ai as i,Br as a,Di as o,Ei as s,Fr as c,Ho as l,Hr as u,Ir as d,Lr as f,Mi as p,Ni as m,Oi as h,Pr as g,Qi as _,Qo as v,Rr as y,Sa as b,Si as x,Ti as S,Ur as C,Vr as w,Wr as T,Xo as E,Zo as ee,_ as D,_i as O,ai as k,c as A,ci as j,di as M,ds as N,es as P,fi as te,fs as ne,gi as F,ii as I,ji as re,ka as L,ki as ie,l as ae,li as oe,ls as se,mi as ce,ni as le,oi as ue,ot as de,pi as fe,po as pe,ri as me,s as he,si as ge,u as _e,ui as ve,us as ye,wi as be,xi as xe,ya as R,yi as Se}from"./dialogs-config-COzptu1b.js";var z=ye(),Ce=Object,we=Map,Te=Set,Ee=Te.prototype.has,De=Te.prototype.add,Oe=we.prototype.has,ke=we.prototype.get,Ae=we.prototype.set,je=1,Me=2,Ne=4,Pe=8,Fe=16,Ie=32,B=`__t`,Le=`__p`,Re=`__e`,ze=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Be=`http://www.w3.org/1999/xlink`,Ve=`http://www.w3.org/2000/xmlns/`,He=120,Ue=new Te([`href`,`list`,`form`,`tabIndex`,`download`]),We=new Te([`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 V=document;V.createElement(`template`);var Ge=V.createElement(`template`),Ke=Ge.content,qe=V.createElementNS(`http://www.w3.org/2000/svg`,`svg`),H=Node.prototype,Je=Element.prototype,Ye=CharacterData.prototype,Xe=Ce.getOwnPropertyDescriptor,Ze=H.insertBefore,Qe=H.cloneNode,$e=H.replaceChild,et=Je.remove,tt=H.addEventListener,nt=Je.removeAttribute,rt=Je.setAttribute,it=Je.setAttributeNS,at=Xe(H,`textContent`).set,ot=Xe(H,`firstChild`).get,st=Xe(H,`nextSibling`).get,ct=Xe(Ye,`data`).set,lt=(e,t)=>{let n=t?qe:Ge;return n.innerHTML=e,(t?qe:Ke).firstChild};V[Re]=new Te;var ut=(e,t,n)=>{let r=t.toLowerCase(),i=!1;r.endsWith(`capture`)&&(r=r.slice(0,-7),i=!0);let a=`$$${r}`;Ee.call(V[Re],r)||(tt.call(V,r,e=>{let t=e.target;for(;t;){let n=t[a];n&&(Ce.defineProperty(e,`currentTarget`,{configurable:!0,get(){return t}}),n(e)),t=t.parentNode}},{capture:i}),De.call(V[Re],r));let o=t=>{t?`key`in t&&t.key===e[a]?.key||(e[a]=t):e[a]=null};return o(n),o},U=(e,t)=>{let n=ot.call(e);if(t)for(let e=0;e<t&&n;++e)n=st.call(n);return n},dt=new WeakSet,ft=e=>{if(dt.has(e))return;e.nodeType===8&&e.parentNode?.removeChild(e);let t=ot.call(e);for(;t;)ft(t),t=t.nextSibling;dt.add(e)},pt=(e,t,n)=>{let r=V.createTextNode(t),i=U(e,n);return Ze.call(e,r,i),r},mt=(e,t)=>{ct.call(e,t)},ht=(e,t,n)=>{typeof n!=`number`||ze.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`},gt=(e,t,n)=>{t=t.replace(/xlink(?:H|:h)/,`h`).replace(/sName$/,`s`),t.startsWith(`xmlns`)?it.call(e,Ve,t,String(n)):t.startsWith(`xlink`)&&it.call(e,Be,`href`,String(n))},_t=(e,t,n)=>{let r=n==null;if(n=r?``:n,t in e&&e[t]!==void 0&&e[t]!==null&&!(e instanceof SVGElement)&&Ee.call(Ue,t))try{e[t]=n}catch{}else !r&&n!==``&&(n!==!1||t.includes(`-`))?rt.call(e,t,String(n)):nt.call(e,t);let i=e instanceof HTMLInputElement,a=e instanceof HTMLSelectElement,o=e instanceof HTMLTextAreaElement;t===`value`&&(i||a||o)&&(rt.call(e,t,String(n)),e.value=n)},vt=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 yt(e){return vt.get(e)||e}var bt=Object.defineProperty,xt=(e,t,n)=>t in e?bt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,W=(e,t,n)=>(xt(e,typeof t==`symbol`?t:t+``,n),n),St=class{constructor(){W(this,`r`),W(this,`e`),W(this,`l`),W(this,`g`),W(this,`_u`),W(this,`_t`),W(this,`d`),W(this,`k`),W(this,`c`)}},Ct=(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:je,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=yt(t);if(i&&(t=i),t===`className`&&(t=`class`),t.startsWith(`on`)){`$`in n?a.e.push({t:Ne,n:t.slice(2),v:null,h:n.$,i:null,l:null,p:null,b:null}):a.i.push({t:Ne,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:Pe,n:t,v:null,h:n.$,i:null,l:null,p:null,b:null}):t.charCodeAt(0)===He?a.e.push({t:Fe,n:t,v:null,h:n.$,i:null,l:null,p:null,b:null}):a.e.push({t:Me,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:Pe,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(Ee.call(We,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:je,n:null,v:null,h:s.$,i:r,l:null,p:null,b:null});continue}if(s instanceof St){a.i.push({t:Ie,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:je,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+=Ct(s,t,l)}return(a.i.length||a.e.length)&&t.push(a),`<${e.type}${r}>${i}</${e.type}>`},wt=Object.defineProperty,Tt=(e,t,n)=>t in e?wt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Et=(e,t,n)=>(Tt(e,typeof t==`symbol`?t:t+``,n),n),Dt=e=>new Ot(e),Ot=class extends St{constructor(e){super(),Et(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 Mt.call(this),a;if(r===0)return At.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){Bt.call(u,d),n[s]=u,u=t[++o],d=n[++s];continue}let i=f.k,h=p.k;if(i===h){Bt.call(f,p),n[l]=f,f=t[--c],p=n[--l];continue}if(e===h){Bt.call(u,p),n[l]=u;let e=n[l+1];Vt.call(u,e,e?.l||null),u=t[++o],p=n[--l];continue}if(i===r){Bt.call(f,d),n[s]=f;let e=t[o];Vt.call(f,e,e?.l||null),f=t[--c],d=n[++s];continue}if(!m){m=new we;for(let e=o;e<=c;e++)Ae.call(m,t[e].k,e)}let g=m.get(r);if(g===void 0)zt.call(d,a,u.l||null);else{let e=t[g];Vt.call(e,u,null),Bt.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)zt.call(n[t],a,e?e.l:null)}else for(let e=o;e<=c;++e)Ht.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];zt.call(r,e,t)}return this._t=e,e}x(){let e=this.t();if(e)at.call(e,``);else for(let e=0,t=this.b.length;e<t;++e)Ht.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}},kt=Ot.prototype,At=kt.m,jt=kt.p,Mt=kt.x,Nt=new Proxy({},{get(e,t){return{$:t}}}),Pt=(e,t,n,r)=>{let i=e(Nt),a=[],o=lt(Ct(t?t(i):i,a),r);return ft(o),(e,t,r)=>new It(o,a,e,t??e?.key??null,r??n??null,null)},Ft=(e,t)=>{if((`b`in e||`b`in t)&&jt.call(e,t),e.l||zt.call(e,void 0,null,null),e.k&&e.k===t.k||e.r===t.r)return Bt.call(e,t);let n=zt.call(t,e.t(),e.l,null);return Ht.call(e),e.k=t.k,n},It=class extends St{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??Qe.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]??Lt(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&je){if(o instanceof St){let e=U(a,i.i);n?o.m(a,e,e):o.m(a,e);continue}if(a[B]||(a[B]=Array(r)),o&&typeof o==`object`&&`foreign`in o){if(n){let e=U(a,i.i);o.reset(e)}let t=o.current;a[B][e]=t,n||Ze.call(a,t,U(a,i.i));continue}if(n){a[B][e]=U(a,i.i);continue}a[B][e]=pt(a,o==null||o===!1?``:String(o),i.i)}else if(i.t&Ne){let e=ut(a,i.n,o);a[Le+i.n]=e}else if(i.t&Me)_t(a,i.n,o);else if(i.t&Pe)if(typeof o==`string`||typeof o==`number`)ht(a,i.n,o);else for(let e in o)ht(a,e,o[e]);else gt(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&je)r.v&&!n&&pt(a,r.v,r.i);else if(r.t&Ne)ut(a,r.n,r.l);else{let e=U(a,r.i);n?r.b.m(a,e,e):r.b.m(a,e)}}}return e&&!n&&Ze.call(e,r,t),this.l=r,r}p(e){let t=this.l;if(!e.d)return t;let n=this.d;if(!Ut.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]??Lt(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&Ne){a[Le+o.n](c);continue}if(o.t&je){if(s instanceof St){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[B][t];if(c.unstable&&s!==c){let n=c.current;a[B][t]=n,$e.call(a,n,e)}else c.current=e;continue}mt(a[B][t],c==null||c===!1?``:String(c))}else if(o.t&Me)_t(a,o.n,c);else if(o.t&Pe)if(typeof c==`string`||typeof c==`number`)ht(a,o.n,c);else for(let e in c)c[e]!==s[e]&&ht(a,e,c[e]);else gt(a,o.n,c)}}}return t}v(e=null,t=null){Ze.call(this.t(),this.l,e?e.l:t)}x(){et.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}},Lt=(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=U(t,r)}return a&&(n[r]=t),t},Rt=It.prototype,zt=Rt.m,Bt=Rt.p,Vt=Rt.v,Ht=Rt.x,Ut=Rt.u,G=e(ne(),1),Wt={noSlot:!1},Gt=e(N(),1),Kt=`slot`,qt=({effect:e,deps:t})=>((0,G.useEffect)(e,t||[]),null),K=new Map,Jt=(0,G.createContext)(!1),Yt=(e,t,n)=>{let r={ref:t},i=0;for(let t in e){let a=e[t];if((0,G.isValidElement)(a)||Array.isArray(a)&&a.length&&(0,G.isValidElement)(a[0])){r[t]=Zt(a,!1,n,i++);continue}r[t]=e[t]}return r},Xt=(e,t)=>(0,G.createElement)(Kt,{suppressHydrationWarning:!0,id:t},e),Zt=(e,t,n,r,i)=>{let a=n?.[r]?.current,o=(0,G.isValidElement)(e)&&typeof e.type==`function`&&`_c`in e.type,s=o&&e.type._c;if(typeof window>`u`)return o?s?e:Xt(Xt(e),i):Xt(e,i);if(s){let t=e.type(e.props);if(K.has(t.type)){let e=K.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,Gt.createPortal)((0,G.createElement)(G.Fragment,{children:e}),c,i),reset:e=>{e.childNodes.forEach(t=>e.removeChild(t))},unstable:t};return n&&(n[r]=l),l},Qt=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 Qt(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=$t(e.props.children).map(e=>Qt(e))),{type:t,props:n}},$t=e=>{if(e==null)return[];if(typeof e==`object`&&`type`in e&&e.type===G.Fragment)return $t(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(...$t(t[e]));return n},en=typeof window>`u`?G.useEffect:G.useLayoutEffect;function tn(e,t,n){if(!e||t(e))return e;let r=n?e.return:e.child;for(;r;){let e=tn(r,t,n);if(e)return e;r=n?null:r.sibling}}function nn(){let e=(0,G.useRef)();return(0,G.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 rn(e){let t=nn(),n=(0,G.useRef)({el:null,depth:0});return en(()=>{n.current.el=tn(t,t=>(n.current.depth++,typeof t.type==`string`&&(e===void 0||t.type===e)),!0)?.stateNode},[t]),n}function an(){let e=nn(),t=(0,G.useRef)({el:null,depth:0});return en(()=>{t.current.el=tn(e,e=>(t.current.depth++,e.stateNode?.containerInfo!=null),!0)?.stateNode.containerInfo},[e]),t}var on=(e,t={})=>{let n=t?.experimental_noSlot??Wt.noSlot,r=t?.block,i=t?.svg?`g`:Kt;e&&(r=Pt(e,Qt,t?.shouldUpdate,t?.svg));let a=(e,a)=>{let o=an(),s=rn(),c=e._hmr,l=(0,G.useRef)(null),u=(0,G.useRef)(null),d=(0,G.useRef)([]);e=Yt(e,a,d.current),u.current?.(e);let f=(0,G.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 \`${Qe.call(l.current).outerHTML}\` element.
3
+ To avoid this error, \`experimental_options.noSlot\` should be false`))),(u.current===null||c)&&(zt.call(i,l.current,null),u.current=e=>{Ft(i,r(e,e.key,t?.shouldUpdate))}),()=>{Ht.call(i)}},[]),p=(0,G.useMemo)(()=>n?null:(0,G.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,G.createElement)(G.Fragment,{},p,(0,G.createElement)(qt,{effect:f,deps:c?[c]:[]}),h)};return Oe.call(K,a)||Ae.call(K,a,on),t?.name&&(e&&(e.displayName=`Million(Render(${t.name}))`),a.displayName=`Million(Block(${t.name}))`),a};(0,G.memo)(({each:e,children:t,memo:n,svg:r,as:i,...a})=>{let o=(0,G.useRef)(null),[s]=(0,G.useState)(()=>({current:Array(e.length)})),c=(0,G.useRef)(null),l=(0,G.useRef)({each:null,children:null,mounted:!1}),[,u]=(0,G.useState)(!1);if(c.current&&(e!==l.current.each||!n)){let r=sn(e,t,l,s,n);jt.call(c.current,Dt(r))}let d=(0,G.createElement)(G.Fragment,null,(0,G.createElement)(i??(r?`g`:`slot`),{...a,ref:o}),...s.current.map(e=>e.portal));return(0,G.useEffect)(()=>{!o.current||c.current||l.current.mounted||(c.current=Dt(sn(e,t,l,s,n)),Oe.call(K,d)||Ae.call(K,d,c.current),At.call(c.current,o.current),l.current.mounted=!0,u(!0))},[o.current]),d});var sn=(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(Oe.call(K,s.type)){o.block||=ke.call(K,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(Oe.call(K,e.type)){let t=ke.call(K,e.type);if(typeof t==`function`){a[n]=t(e.props);continue}}}let c=Pt(e=>e?.scope),l=(e,t,n)=>c({scope:Zt((0,G.createElement)(s.type,e),!1,t.current,n)},s.key?String(s.key):void 0);Ae.call(K,s.type,l),o.block=l,a[n]=l(s.props,r,n)}return o.each=e,o.children=a,a};function cn(e,t){return e===t||e!==e&&t!==t}function ln(e,t){for(let n in e)if(!cn(e[n],t[n]))return!0;return!1}function un(e,{portals:t,...n}){let r=`CompiledBlock(Inner(${n.name}))`,i=on(t=>e(t),{...n,scoped:void 0,name:r,shouldUpdate:ln}),a=t?.length||0,o=t&&a>0?e=>{let n=(0,G.useContext)(Jt),[r]=(0,G.useState)(()=>[]),o={...e,scoped:n};for(let e=0;e<a;e++){let n=t[e];o[n]=Zt(o[n],!1,r,e)}let s=[];for(let e=0,t=r.length;e<t;e++)s[e]=r[e].portal;return(0,G.createElement)(G.Fragment,null,(0,G.createElement)(i,o),s)}:e=>(0,G.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 q=se(),dn=`AlertDialog`,[fn,pn]=ie(dn,[M]),J=M(),mn=e=>{let{__scopeAlertDialog:t,...n}=e,r=J(t);return(0,q.jsx)(ge,{...r,...n,modal:!0})};mn.displayName=dn;var hn=`AlertDialogTrigger`,gn=G.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,q.jsx)(oe,{...i,...r,ref:t})});gn.displayName=hn;var _n=`AlertDialogPortal`,vn=e=>{let{__scopeAlertDialog:t,...n}=e,r=J(t);return(0,q.jsx)(ue,{...r,...n})};vn.displayName=_n;var yn=`AlertDialogOverlay`,bn=G.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,q.jsx)(k,{...i,...r,ref:t})});bn.displayName=yn;var xn=`AlertDialogContent`,[Sn,Cn]=fn(xn),wn=S(`AlertDialogContent`),Tn=G.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...a}=e,o=J(n),s=G.useRef(null),c=R(t,s),l=G.useRef(null);return(0,q.jsx)(ve,{contentName:xn,titleName:En,docsSlug:`alert-dialog`,children:(0,q.jsx)(Sn,{scope:n,cancelRef:l,children:(0,q.jsxs)(me,{role:`alertdialog`,...o,...a,ref:c,onOpenAutoFocus:i(a.onOpenAutoFocus,e=>{e.preventDefault(),l.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,q.jsx)(wn,{children:r}),(0,q.jsx)(Pn,{contentRef:s})]})})})});Tn.displayName=xn;var En=`AlertDialogTitle`,Dn=G.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,q.jsx)(j,{...i,...r,ref:t})});Dn.displayName=En;var On=`AlertDialogDescription`,kn=G.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,q.jsx)(I,{...i,...r,ref:t})});kn.displayName=On;var An=`AlertDialogAction`,jn=G.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,q.jsx)(le,{...i,...r,ref:t})});jn.displayName=An;var Mn=`AlertDialogCancel`,Nn=G.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=Cn(Mn,n),a=J(n),o=R(t,i);return(0,q.jsx)(le,{...a,...r,ref:o})});Nn.displayName=Mn;var Pn=({contentRef:e})=>{let t=`\`${xn}\` requires a description for the component to be accessible for screen reader users.
4
+
5
+ You can add a description to the \`${xn}\` by passing a \`${On}\` 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 \`${xn}\`. 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 G.useEffect(()=>{document.getElementById(e.current?.getAttribute(`aria-describedby`))||console.warn(t)},[t,e]),null},Fn=mn,In=vn,Ln=bn,Rn=Tn,zn=jn,Bn=Nn,Vn=Dn,Hn=kn,Un=Fn,Wn=In,Gn=G.forwardRef((e,t)=>{let n=(0,z.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=m(`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,q.jsx)(Ln,{className:a,...i,ref:t}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Gn.displayName=Ln.displayName;var Kn=G.forwardRef((e,t)=>{let n=(0,z.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,q.jsx)(Gn,{}),n[3]=a):a=n[3];let o;n[4]===r?o=n[5]:(o=m(`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,q.jsxs)(Wn,{children:[a,(0,q.jsx)(Rn,{ref:t,className:o,...i})]}),n[6]=i,n[7]=t,n[8]=o,n[9]=s):s=n[9],s});Kn.displayName=Rn.displayName;var qn=e=>{let t=(0,z.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=m(`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,q.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};qn.displayName=`AlertDialogHeader`;var Jn=e=>{let t=(0,z.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=m(`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,q.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};Jn.displayName=`AlertDialogFooter`;var Yn=G.forwardRef((e,t)=>{let r=(0,z.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=m(n.dialogTitle,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==t||r[7]!==o?(s=(0,q.jsx)(Vn,{ref:t,className:o,...a}),r[5]=a,r[6]=t,r[7]=o,r[8]=s):s=r[8],s});Yn.displayName=Vn.displayName;var Xn=G.forwardRef((e,t)=>{let r=(0,z.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=m(n.dialogDescription,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==t||r[7]!==o?(s=(0,q.jsx)(Hn,{ref:t,className:o,...a}),r[5]=a,r[6]=t,r[7]=o,r[8]=s):s=r[8],s});Xn.displayName=Hn.displayName;var Zn=G.forwardRef((e,t)=>{let n=(0,z.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=m(p(),r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,q.jsx)(zn,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Zn.displayName=zn.displayName;var Qn=G.forwardRef((e,t)=>{let n=(0,z.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=m(p({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,q.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=un(e=>(0,q.jsxs)(`div`,{className:e.v0,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h1`,{className:e.v1,children:e.v2}),e.v3]}),e.v4]}),{name:`PageHeader_1`,portals:[`v2`,`v3`,`v4`]}),er=function(e){let t=(0,z.c)(12),{title:r,description:i,action:a,className:o,titleClassName:s}=e,c;t[0]===o?c=t[1]:(c=m(`flex items-center justify-between mb-6`,o),t[0]=o,t[1]=c);let l;t[2]===s?l=t[3]:(l=m(n.pageTitle,s),t[2]=s,t[3]=l);let u;t[4]===i?u=t[5]:(u=i?(0,q.jsx)(`p`,{className:n.pageSubtitle,children:i}):null,t[4]=i,t[5]=u);let d;return t[6]!==a||t[7]!==c||t[8]!==l||t[9]!==u||t[10]!==r?(d=(0,q.jsx)($n,{v0:c,v1:l,v2:r,v3:u,v4:a}),t[6]=a,t[7]=c,t[8]=l,t[9]=u,t[10]=r,t[11]=d):d=t[11],d};function tr(e){let t=(0,z.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=m(_.settingsPage,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,q.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function nr(e){let t=(0,z.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=m(_.accountPage,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,q.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function rr(e){let t=(0,z.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=m(_.formPage,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,q.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function ir(e){let t=(0,z.c)(5),{title:r,className:i}=e,a;t[0]===i?a=t[1]:(a=m(n.sectionTitle,`mb-3`,i),t[0]=i,t[1]=a);let o;return t[2]!==a||t[3]!==r?(o=(0,q.jsx)(`h2`,{className:a,children:r}),t[2]=a,t[3]=r,t[4]=o):o=t[4],o}function ar(e){let t=(0,z.c)(6),{children:r,variant:i,className:a}=e,o=i===void 0?`info`:i,s;t[0]!==a||t[1]!==o?(s=m(o===`hint`?n.hintBanner:o===`success`?m(n.body,`text-green-700 bg-green-50 dark:text-green-400 dark:bg-green-950/30 rounded-md px-3 py-2 mb-4`):o===`error`?m(n.error,`bg-destructive/10 rounded-md px-3 py-2 mb-4`):n.infoBanner,a),t[0]=a,t[1]=o,t[2]=s):s=t[2];let c;return t[3]!==r||t[4]!==s?(c=(0,q.jsx)(`div`,{className:s,children:r}),t[3]=r,t[4]=s,t[5]=c):c=t[5],c}function or(e){let t=(0,z.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=m(`flex-1 overflow-auto`,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,q.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function sr(e){let t=(0,z.c)(10),{children:r,title:i,action:a}=e,o;t[0]===i?o=t[1]:(o=i?(0,q.jsx)(`h2`,{className:m(n.emptyStateTitle,`mb-2`),children:i}):null,t[0]=i,t[1]=o);let s;t[2]===r?s=t[3]:(s=(0,q.jsx)(`p`,{className:n.bodyMuted,children:r}),t[2]=r,t[3]=s);let c;t[4]===a?c=t[5]:(c=a?(0,q.jsx)(`div`,{className:`mt-4`,children:a}):null,t[4]=a,t[5]=c);let l;return t[6]!==o||t[7]!==s||t[8]!==c?(l=(0,q.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,q.jsxs)(`div`,{className:`text-center`,children:[o,s,c]})}),t[6]=o,t[7]=s,t[8]=c,t[9]=l):l=t[9],l}function cr(e){let t=(0,z.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=m(`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,q.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function lr(e){let t=(0,z.c)(14),{title:r,description:i,action:a,children:o,className:s}=e,c;t[0]===r?c=t[1]:(c=(0,q.jsx)(ir,{title:r,className:`mb-1`}),t[0]=r,t[1]=c);let l;t[2]===i?l=t[3]:(l=i?(0,q.jsx)(`p`,{className:n.bodyMuted,children:i}):null,t[2]=i,t[3]=l);let u;t[4]!==c||t[5]!==l?(u=(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[c,l]}),t[4]=c,t[5]=l,t[6]=u):u=t[6];let d;t[7]!==a||t[8]!==u?(d=(0,q.jsxs)(`div`,{className:`flex items-start justify-between gap-4 mb-3`,children:[u,a]}),t[7]=a,t[8]=u,t[9]=d):d=t[9];let f;return t[10]!==o||t[11]!==s||t[12]!==d?(f=(0,q.jsxs)(`div`,{className:s,children:[d,o]}),t[10]=o,t[11]=s,t[12]=d,t[13]=f):f=t[13],f}function ur(e){let t=G.useRef({value:e,previous:e});return G.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var dr=[` `,`Enter`,`ArrowUp`,`ArrowDown`],fr=[` `,`Enter`],pr=`Select`,[mr,hr,gr]=he(pr),[_r,vr]=ie(pr,[gr,T]),yr=T(),[br,Y]=_r(pr),[xr,Sr]=_r(pr),Cr=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:c,defaultValue:l,onValueChange:u,dir:d,name:f,autoComplete:p,disabled:m,required:h,form:g}=e,_=yr(t),[v,y]=G.useState(null),[b,x]=G.useState(null),[S,w]=G.useState(!1),T=_e(d),[E,ee]=s({prop:r,defaultProp:i??!1,onChange:a,caller:pr}),[D,O]=s({prop:c,defaultProp:l,onChange:u,caller:pr}),k=G.useRef(null),A=v?g||!!v.closest(`form`):!0,[j,M]=G.useState(new Set),N=Array.from(j).map(e=>e.props.value).join(`;`);return(0,q.jsx)(C,{..._,children:(0,q.jsxs)(br,{required:h,scope:t,trigger:v,onTriggerChange:y,valueNode:b,onValueNodeChange:x,valueNodeHasChildren:S,onValueNodeHasChildrenChange:w,contentId:o(),value:D,onValueChange:O,open:E,onOpenChange:ee,dir:T,triggerPointerDownPosRef:k,disabled:m,children:[(0,q.jsx)(mr.Provider,{scope:t,children:(0,q.jsx)(xr,{scope:e.__scopeSelect,onNativeOptionAdd:G.useCallback(e=>{M(t=>new Set(t).add(e))},[]),onNativeOptionRemove:G.useCallback(e=>{M(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),A?(0,q.jsxs)(gi,{"aria-hidden":!0,required:h,tabIndex:-1,name:f,autoComplete:p,value:D,onChange:e=>O(e.target.value),disabled:m,form:g,children:[D===void 0?(0,q.jsx)(`option`,{value:``}):null,Array.from(j)]},N):null]})})};Cr.displayName=pr;var wr=`SelectTrigger`,Tr=G.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...o}=e,s=yr(n),c=Y(wr,n),l=c.disabled||r,u=R(t,c.onTriggerChange),d=hr(n),f=G.useRef(`touch`),[p,m,h]=vi(e=>{let t=d().filter(e=>!e.disabled),n=yi(t,e,t.find(e=>e.value===c.value));n!==void 0&&c.onValueChange(n.value)}),g=e=>{l||(c.onOpenChange(!0),h()),e&&(c.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,q.jsx)(a,{asChild:!0,...s,children:(0,q.jsx)(x.button,{type:`button`,role:`combobox`,"aria-controls":c.contentId,"aria-expanded":c.open,"aria-required":c.required,"aria-autocomplete":`none`,dir:c.dir,"data-state":c.open?`open`:`closed`,disabled:l,"data-disabled":l?``:void 0,"data-placeholder":_i(c.value)?``:void 0,...o,ref:u,onClick:i(o.onClick,e=>{e.currentTarget.focus(),f.current!==`mouse`&&g(e)}),onPointerDown:i(o.onPointerDown,e=>{f.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(g(e),e.preventDefault())}),onKeyDown:i(o.onKeyDown,e=>{let t=p.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&m(e.key),!(t&&e.key===` `)&&dr.includes(e.key)&&(g(),e.preventDefault())})})})});Tr.displayName=wr;var Er=`SelectValue`,Dr=G.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=R(t,c.onValueNodeChange);return h(()=>{l(u)},[l,u]),(0,q.jsx)(x.span,{...s,ref:d,style:{pointerEvents:`none`},children:_i(c.value)?(0,q.jsx)(q.Fragment,{children:o}):a})});Dr.displayName=Er;var Or=`SelectIcon`,kr=G.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,q.jsx)(x.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});kr.displayName=Or;var Ar=`SelectPortal`,jr=e=>(0,q.jsx)(F,{asChild:!0,...e});jr.displayName=Ar;var Mr=`SelectContent`,Nr=G.forwardRef((e,t)=>{let n=Y(Mr,e.__scopeSelect),[r,i]=G.useState();if(h(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?Gt.createPortal((0,q.jsx)(Pr,{scope:e.__scopeSelect,children:(0,q.jsx)(mr.Slot,{scope:e.__scopeSelect,children:(0,q.jsx)(`div`,{children:e.children})})}),t):null}return(0,q.jsx)(Lr,{...e,ref:t})});Nr.displayName=Mr;var X=10,[Pr,Z]=_r(Mr),Fr=`SelectContentImpl`,Ir=be(`SelectContent.RemoveScroll`),Lr=G.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:a,onEscapeKeyDown:o,onPointerDownOutside:s,side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:m,sticky:h,hideWhenDetached:g,avoidCollisions:_,...v}=e,y=Y(Mr,n),[b,x]=G.useState(null),[S,C]=G.useState(null),w=R(t,e=>x(e)),[T,E]=G.useState(null),[ee,D]=G.useState(null),k=hr(n),[A,j]=G.useState(!1),M=G.useRef(!1);G.useEffect(()=>{if(b)return te(b)},[b]),ce();let N=G.useCallback(e=>{let[t,...n]=k().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&S&&(S.scrollTop=0),n===r&&S&&(S.scrollTop=S.scrollHeight),n?.focus(),document.activeElement!==i))return},[k,S]),P=G.useCallback(()=>N([T,b]),[N,T,b]);G.useEffect(()=>{A&&P()},[A,P]);let{onOpenChange:ne,triggerPointerDownPosRef:F}=y;G.useEffect(()=>{if(b){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(F.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(F.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():b.contains(n.target)||ne(!1),document.removeEventListener(`pointermove`,t),F.current=null};return F.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[b,ne,F]),G.useEffect(()=>{let e=()=>ne(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[ne]);let[I,re]=vi(e=>{let t=k().filter(e=>!e.disabled),n=yi(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),L=G.useCallback((e,t,n)=>{let r=!M.current&&!n;(y.value!==void 0&&y.value===t||r)&&(E(e),r&&(M.current=!0))},[y.value]),ie=G.useCallback(()=>b?.focus(),[b]),ae=G.useCallback((e,t,n)=>{let r=!M.current&&!n;(y.value!==void 0&&y.value===t||r)&&D(e)},[y.value]),oe=r===`popper`?Vr:zr,se=oe===Vr?{side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:m,sticky:h,hideWhenDetached:g,avoidCollisions:_}:{};return(0,q.jsx)(Pr,{scope:n,content:b,viewport:S,onViewportChange:C,itemRefCallback:L,selectedItem:T,onItemLeave:ie,itemTextRefCallback:ae,focusSelectedItem:P,selectedItemText:ee,position:r,isPositioned:A,searchRef:I,children:(0,q.jsx)(fe,{as:Ir,allowPinchZoom:!0,children:(0,q.jsx)(O,{asChild:!0,trapped:y.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:i(a,e=>{y.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,q.jsx)(Se,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:(0,q.jsx)(oe,{role:`listbox`,id:y.contentId,"data-state":y.open?`open`:`closed`,dir:y.dir,onContextMenu:e=>e.preventDefault(),...v,...se,onPlaced:()=>j(!0),ref:w,style:{display:`flex`,flexDirection:`column`,outline:`none`,...v.style},onKeyDown:i(v.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&re(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=k().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>N(t)),e.preventDefault()}})})})})})})});Lr.displayName=Fr;var Rr=`SelectItemAlignedPosition`,zr=G.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=Y(Mr,n),o=Z(Mr,n),[s,c]=G.useState(null),[l,u]=G.useState(null),d=R(t,e=>u(e)),f=hr(n),p=G.useRef(!1),m=G.useRef(!0),{viewport:g,selectedItem:_,selectedItemText:v,focusSelectedItem:y}=o,b=G.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&g&&_&&v){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=v.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=ae(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=ae(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=g.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),h=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+h+u+b+y,S=Math.min(_.offsetHeight*5,x),C=window.getComputedStyle(g),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-X,ee=c-E,D=_.offsetHeight/2,O=_.offsetTop+D,k=m+h+O,A=x-k;if(k<=E){let e=o.length>0&&_===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-g.offsetTop-g.offsetHeight,n=k+Math.max(ee,D+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&_===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+g.offsetTop+(e?w:0)+D)+A;s.style.height=t+`px`,g.scrollTop=k-E+g.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,g,_,v,a.dir,r]);h(()=>b(),[b]);let[S,C]=G.useState();return h(()=>{l&&C(window.getComputedStyle(l).zIndex)},[l]),(0,q.jsx)(Hr,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:G.useCallback(e=>{e&&m.current===!0&&(b(),y?.(),m.current=!1)},[b,y]),children:(0,q.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:S},children:(0,q.jsx)(x.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});zr.displayName=Rr;var Br=`SelectPopperPosition`,Vr=G.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=X,...a}=e,o=yr(n);return(0,q.jsx)(u,{...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=G.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...a}=e,o=Z(Wr,n),s=Ur(Wr,n),c=R(t,o.onViewportChange),l=G.useRef(0);return(0,q.jsxs)(q.Fragment,{children:[(0,q.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,q.jsx)(mr.Slot,{scope:n,children:(0,q.jsx)(x.div,{"data-radix-select-viewport":``,role:`presentation`,...a,ref:c,style:{position:`relative`,flex:1,overflow:`hidden auto`,...a.style},onScroll:i(a.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=s;if(r?.current&&n){let e=Math.abs(l.current-t.scrollTop);if(e>0){let r=window.innerHeight-X*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}l.current=t.scrollTop})})})]})});Gr.displayName=Wr;var Kr=`SelectGroup`,[qr,Jr]=_r(Kr),Yr=G.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=o();return(0,q.jsx)(qr,{scope:n,id:i,children:(0,q.jsx)(x.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Yr.displayName=Kr;var Xr=`SelectLabel`,Zr=G.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Jr(Xr,n);return(0,q.jsx)(x.div,{id:i.id,...r,ref:t})});Zr.displayName=Xr;var Qr=`SelectItem`,[$r,ei]=_r(Qr),ti=G.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:a=!1,textValue:s,...c}=e,l=Y(Qr,n),u=Z(Qr,n),d=l.value===r,[f,p]=G.useState(s??``),[m,h]=G.useState(!1),g=R(t,e=>u.itemRefCallback?.(e,r,a)),_=o(),v=G.useRef(`touch`),y=()=>{a||(l.onValueChange(r),l.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,q.jsx)($r,{scope:n,value:r,disabled:a,textId:_,isSelected:d,onItemTextChange:G.useCallback(e=>{p(t=>t||(e?.textContent??``).trim())},[]),children:(0,q.jsx)(mr.ItemSlot,{scope:n,value:r,disabled:a,textValue:f,children:(0,q.jsx)(x.div,{role:`option`,"aria-labelledby":_,"data-highlighted":m?``:void 0,"aria-selected":d&&m,"data-state":d?`checked`:`unchecked`,"aria-disabled":a||void 0,"data-disabled":a?``:void 0,tabIndex:a?void 0:-1,...c,ref:g,onFocus:i(c.onFocus,()=>h(!0)),onBlur:i(c.onBlur,()=>h(!1)),onClick:i(c.onClick,()=>{v.current!==`mouse`&&y()}),onPointerUp:i(c.onPointerUp,()=>{v.current===`mouse`&&y()}),onPointerDown:i(c.onPointerDown,e=>{v.current=e.pointerType}),onPointerMove:i(c.onPointerMove,e=>{v.current=e.pointerType,a?u.onItemLeave?.():v.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:i(c.onPointerLeave,e=>{e.currentTarget===document.activeElement&&u.onItemLeave?.()}),onKeyDown:i(c.onKeyDown,e=>{u.searchRef?.current!==``&&e.key===` `||(fr.includes(e.key)&&y(),e.key===` `&&e.preventDefault())})})})})});ti.displayName=Qr;var ni=`SelectItemText`,ri=G.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]=G.useState(null),f=R(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=G.useMemo(()=>(0,q.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=l;return h(()=>(g(m),()=>_(m)),[g,_,m]),(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(x.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Gt.createPortal(a.children,o.valueNode):null]})});ri.displayName=ni;var ii=`SelectItemIndicator`,ai=G.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return ei(ii,n).isSelected?(0,q.jsx)(x.span,{"aria-hidden":!0,...r,ref:t}):null});ai.displayName=ii;var oi=`SelectScrollUpButton`,si=G.forwardRef((e,t)=>{let n=Z(oi,e.__scopeSelect),r=Ur(oi,e.__scopeSelect),[i,a]=G.useState(!1),o=R(t,r.onScrollButtonChange);return h(()=>{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,q.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=G.forwardRef((e,t)=>{let n=Z(ci,e.__scopeSelect),r=Ur(ci,e.__scopeSelect),[i,a]=G.useState(!1),o=R(t,r.onScrollButtonChange);return h(()=>{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,q.jsx)(ui,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});li.displayName=ci;var ui=G.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...a}=e,o=Z(`SelectScrollButton`,n),s=G.useRef(null),c=hr(n),l=G.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return G.useEffect(()=>()=>l(),[l]),h(()=>{c().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[c]),(0,q.jsx)(x.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:i(a.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:i(a.onPointerMove,()=>{o.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:i(a.onPointerLeave,()=>{l()})})}),di=`SelectSeparator`,fi=G.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,q.jsx)(x.div,{"aria-hidden":!0,...r,ref:t})});fi.displayName=di;var pi=`SelectArrow`,mi=G.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,q.jsx)(w,{...i,...r,ref:t}):null});mi.displayName=pi;var hi=`SelectBubbleInput`,gi=G.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=G.useRef(null),a=R(r,i),o=ur(t);return G.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,q.jsx)(x.select,{...n,style:{...y,...n.style},ref:a,defaultValue:t})});gi.displayName=hi;function _i(e){return e===``||e===void 0}function vi(e){let t=xe(e),n=G.useRef(``),r=G.useRef(0),i=G.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=G.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return G.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=G.forwardRef((e,t)=>{let n=(0,z.c)(12),i,a,o;n[0]===e?(i=n[1],a=n[2],o=n[3]):({className:a,children:i,...o}=e,n[0]=e,n[1]=i,n[2]=a,n[3]=o);let s;n[4]===a?s=n[5]:(s=m(`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`,a),n[4]=a,n[5]=s);let c;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,q.jsx)(wi,{asChild:!0,children:(0,q.jsx)(r,{className:`h-4 w-4 opacity-50`})}),n[6]=c):c=n[6];let l;return n[7]!==i||n[8]!==o||n[9]!==t||n[10]!==s?(l=(0,q.jsxs)(Si,{ref:t,className:s,...o,children:[i,c]}),n[7]=i,n[8]=o,n[9]=t,n[10]=s,n[11]=l):l=n[11],l});Li.displayName=Si.displayName;var Ri=G.forwardRef((e,t)=>{let n=(0,z.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=m(`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,q.jsx)(E,{className:`h-4 w-4`}),n[5]=o):o=n[5];let s;return n[6]!==i||n[7]!==t||n[8]!==a?(s=(0,q.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=G.forwardRef((e,t)=>{let n=(0,z.c)(10),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=m(`flex cursor-default items-center justify-center py-1`,i),n[3]=i,n[4]=o);let s;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,q.jsx)(r,{className:`h-4 w-4`}),n[5]=s):s=n[5];let c;return n[6]!==a||n[7]!==t||n[8]!==o?(c=(0,q.jsx)(Ni,{ref:t,className:o,...a,children:s}),n[6]=a,n[7]=t,n[8]=o,n[9]=c):c=n[9],c});zi.displayName=Ni.displayName;var Bi=G.forwardRef((e,t)=>{let n=(0,z.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=m(`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,q.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=m(`p-1`,d),n[9]=d,n[10]=f);let p;n[11]!==r||n[12]!==f?(p=(0,q.jsx)(Di,{className:f,children:r}),n[11]=r,n[12]=f,n[13]=p):p=n[13];let h;n[14]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,q.jsx)(zi,{}),n[14]=h):h=n[14];let g;return n[15]!==s||n[16]!==a||n[17]!==t||n[18]!==l||n[19]!==p?(g=(0,q.jsx)(Ti,{children:(0,q.jsxs)(Ei,{ref:t,className:l,position:s,...a,children:[u,p,h]})}),n[15]=s,n[16]=a,n[17]=t,n[18]=l,n[19]=p,n[20]=g):g=n[20],g});Bi.displayName=Ei.displayName;var Vi=G.forwardRef((e,t)=>{let n=(0,z.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=m(`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,q.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=G.forwardRef((e,t)=>{let n=(0,z.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=m(`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,q.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,q.jsx)(ji,{children:(0,q.jsx)(P,{className:`h-4 w-4`})})}),n[6]=s):s=n[6];let c;n[7]===r?c=n[8]:(c=(0,q.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,q.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=G.forwardRef((e,t)=>{let n=(0,z.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=m(`-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,q.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,z.c)(14),{className:r,label:i,size:a}=e,o=a===void 0?`md`:a,s=o===`sm`?`h-4 w-4`:o===`lg`?`h-8 w-8`:`h-6 w-6`,c;t[0]===r?c=t[1]:(c=m(`flex h-full items-center justify-center`,r),t[0]=r,t[1]=c);let l;t[2]===s?l=t[3]:(l=m(s,`animate-spin mx-auto text-muted-foreground`),t[2]=s,t[3]=l);let u;t[4]===l?u=t[5]:(u=(0,q.jsx)(pe,{className:l}),t[4]=l,t[5]=u);let d;t[6]===i?d=t[7]:(d=i?(0,q.jsx)(`p`,{className:m(n.bodyMuted,`mt-2`),children:i}):null,t[6]=i,t[7]=d);let f;t[8]!==u||t[9]!==d?(f=(0,q.jsxs)(`div`,{className:`text-center`,children:[u,d]}),t[8]=u,t[9]=d,t[10]=f):f=t[10];let p;return t[11]!==c||t[12]!==f?(p=(0,q.jsx)(`div`,{className:c,children:f}),t[11]=c,t[12]=f,t[13]=p):p=t[13],p}function Gi(){let e=(0,z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,q.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,q.jsx)(`div`,{className:`animate-pulse h-7 bg-muted rounded-full`},e)}function qi(){let e=(0,z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,q.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,G.use)(Yi(e,t))}var $i=G.forwardRef((e,t)=>{let r=(0,z.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=m(`w-full caption-bottom`,n.body,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==t||r[7]!==o?(s=(0,q.jsx)(`div`,{className:`relative w-full overflow-auto`,children:(0,q.jsx)(`table`,{ref:t,className:o,...a})}),r[5]=a,r[6]=t,r[7]=o,r[8]=s):s=r[8],s});$i.displayName=`Table`;var ea=G.forwardRef((e,t)=>{let n=(0,z.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=m(`[&_tr]:border-b`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,q.jsx)(`thead`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ea.displayName=`TableHeader`;var ta=G.forwardRef((e,t)=>{let n=(0,z.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=m(`[&_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,q.jsx)(`tbody`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ta.displayName=`TableBody`;var na=G.forwardRef((e,t)=>{let n=(0,z.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=m(`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,q.jsx)(`tfoot`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});na.displayName=`TableFooter`;var ra=G.forwardRef((e,t)=>{let n=(0,z.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=m(`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,q.jsx)(`tr`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ra.displayName=`TableRow`;var Q=G.forwardRef((e,t)=>{let n=(0,z.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=m(`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,q.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 $=G.forwardRef((e,t)=>{let n=(0,z.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=m(`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,q.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 ia=G.forwardRef((e,t)=>{let r=(0,z.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=m(n.caption,`mt-4`,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==t||r[7]!==o?(s=(0,q.jsx)(`caption`,{ref:t,className:o,...a}),r[5]=a,r[6]=t,r[7]=o,r[8]=s):s=r[8],s});ia.displayName=`TableCaption`;var aa=G.forwardRef((e,t)=>{let n=(0,z.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=m(`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,q.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});aa.displayName=`Card`;var oa=G.forwardRef((e,t)=>{let n=(0,z.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=m(`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,q.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});oa.displayName=`CardHeader`;var sa=G.forwardRef((e,t)=>{let r=(0,z.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=m(n.sectionTitle,`leading-none tracking-tight`,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==t||r[7]!==o?(s=(0,q.jsx)(`div`,{ref:t,className:o,...a}),r[5]=a,r[6]=t,r[7]=o,r[8]=s):s=r[8],s});sa.displayName=`CardTitle`;var ca=G.forwardRef((e,t)=>{let r=(0,z.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=m(n.bodyMuted,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==t||r[7]!==o?(s=(0,q.jsx)(`div`,{ref:t,className:o,...a}),r[5]=a,r[6]=t,r[7]=o,r[8]=s):s=r[8],s});ca.displayName=`CardDescription`;var la=G.forwardRef((e,t)=>{let n=(0,z.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=m(`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,q.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});la.displayName=`CardContent`;var ua=G.forwardRef((e,t)=>{let n=(0,z.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=m(`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,q.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ua.displayName=`CardFooter`;var da=class extends G.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,q.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,q.jsxs)(aa,{className:`max-w-md`,children:[(0,q.jsx)(oa,{children:(0,q.jsx)(sa,{className:`text-destructive`,children:this.props.fallbackTitle??`Something went wrong`})}),(0,q.jsxs)(la,{className:`space-y-4`,children:[(0,q.jsx)(`p`,{className:n.body,children:e.message}),(0,q.jsx)(re,{variant:`outline`,onClick:this.handleRetry,children:`Retry`})]})]})}):this.props.children}},fa=t({ConversationHistoryView:()=>Sa,default:()=>Sa}),pa=un(e=>(0,q.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,q.jsxs)(`div`,{className:`max-w-md text-center space-y-2`,children:[(0,q.jsx)(`h3`,{className:e.v0,children:`No history`}),(0,q.jsx)(`p`,{className:e.v1,children:`No conversation history found for this thread.`})]})}),{name:`ConversationHistoryContent_1`}),ma=un(e=>(0,q.jsxs)(`slot`,{children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between border-b py-3 px-0`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.v0,e.v1]}),(0,q.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,z.c)(39),{scope:r,projects:i,loadVersion:a,currentPromptIndex:o,onPromptIndexChange:s}=e,u;t[0]!==a||t[1]!==r?(u=ba(r,a),t[0]=a,t[1]=r,t[2]=u):u=t[2];let p;t[3]!==i||t[4]!==r?(p=()=>xa(r,i),t[3]=i,t[4]=r,t[5]=p):p=t[5];let h=Qi(u,p),_;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(_=function(e){return new Date(e).toLocaleString()},t[6]=_):_=t[6];let y=_,b;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(b=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]=b):b=t[7];let x=b,S;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(S=function(e){return{inputTokens:e.inputTokens??0,outputTokens:e.outputTokens??0}},t[8]=S):S=t[8];let C=S,w;t[9]!==o||t[10]!==h.messages||t[11]!==s?(w=function(){h.messages&&o<h.messages.length-1&&s(o+1)},t[9]=o,t[10]=h.messages,t[11]=s,t[12]=w):w=t[12];let T=w,E;t[13]!==o||t[14]!==s?(E=function(){o>0&&s(o-1)},t[13]=o,t[14]=s,t[15]=E):E=t[15];let D=E;if(!h.messages?.length){let e;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,q.jsx)(pa,{v0:n.emptyStateTitle,v1:n.bodyMuted}),t[16]=e):e=t[16],e}let O=o===0,k;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,q.jsx)(v,{className:`h-4 w-4 mr-1`}),t[17]=k):k=t[17];let j;t[18]!==D||t[19]!==O?(j=(0,q.jsx)(re,{variant:`outline`,size:`sm`,onClick:D,disabled:O,children:k}),t[18]=D,t[19]=O,t[20]=j):j=t[20];let M=o>=h.messages.length-1,N;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,q.jsx)(ee,{className:`h-4 w-4 ml-1`}),t[21]=N):N=t[21];let P;t[22]!==T||t[23]!==M?(P=(0,q.jsx)(re,{variant:`outline`,size:`sm`,onClick:T,disabled:M,children:N}),t[22]=T,t[23]=M,t[24]=P):P=t[24];let te=o+1,ne=h.messages.length,F;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,q.jsx)(ea,{children:(0,q.jsxs)(ra,{children:[(0,q.jsx)(Q,{children:`Prompt`}),(0,q.jsx)(Q,{children:`Answer`}),(0,q.jsx)(Q,{className:`w-24`,children:`Model`}),(0,q.jsx)(Q,{className:`w-24 text-right`,children:`Duration`}),(0,q.jsx)(Q,{className:`w-20 text-right`,children:`Input Tokens`}),(0,q.jsx)(Q,{className:`w-20 text-right`,children:`Output Tokens`}),(0,q.jsx)(Q,{className:`w-32 text-right`,children:`Timestamp`})]})}),t[25]=F):F=t[25];let I;if(t[26]!==o||t[27]!==h.messages){let e;t[29]===o?e=t[30]:(e=(e,t)=>{let{inputTokens:r,outputTokens:i}=C(e);return(0,q.jsxs)(ra,{className:t===o?`bg-muted/50`:``,children:[(0,q.jsx)($,{className:`max-w-md`,children:(0,q.jsx)(`div`,{className:n.body,children:(0,q.jsx)(_a,{text:e.request.message})})}),(0,q.jsx)($,{className:`max-w-md`,children:e.response?(0,q.jsx)(`div`,{className:n.body,children:(0,q.jsx)(_a,{text:e.response.content})}):(0,q.jsx)(`span`,{className:m(n.bodyMuted,`italic`),children:`No response`})}),(0,q.jsx)($,{children:(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(l,{className:`h-3 w-3 text-muted-foreground`}),(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:e.request.model})]})}),(0,q.jsx)($,{className:m(n.caption,`text-right`),children:e.response?(0,q.jsx)(d,{children:(0,q.jsxs)(g,{children:[(0,q.jsx)(f,{asChild:!0,children:(0,q.jsx)(`div`,{className:`cursor-help`,children:x(e.timestamp,e.response.completedAt).display})}),(0,q.jsx)(c,{children:(0,q.jsx)(`p`,{children:x(e.timestamp,e.response.completedAt).tooltip})})]})}):(0,q.jsx)(`span`,{className:`text-muted-foreground italic`,children:`-`})}),(0,q.jsx)($,{className:m(n.bodyMuted,`text-right`),children:r>0?r.toLocaleString():`-`}),(0,q.jsx)($,{className:m(n.bodyMuted,`text-right`),children:i>0?i.toLocaleString():`-`}),(0,q.jsx)($,{className:m(n.bodyMuted,`text-right`),children:y(e.timestamp)})]},e.id)},t[29]=o,t[30]=e),I=h.messages.map(e),t[26]=o,t[27]=h.messages,t[28]=I}else I=t[28];let L;t[31]===I?L=t[32]:(L=(0,q.jsx)(A,{className:`h-full`,children:(0,q.jsx)(`div`,{className:`py-4`,children:(0,q.jsxs)($i,{children:[F,(0,q.jsx)(ta,{children:I})]})})}),t[31]=I,t[32]=L);let ie;return t[33]!==h.messages.length||t[34]!==j||t[35]!==P||t[36]!==te||t[37]!==L?(ie=(0,q.jsx)(ma,{v0:j,v1:P,v2:n.bodyMuted,v3:te,v4:ne,v5:L}),t[33]=h.messages.length,t[34]=j,t[35]=P,t[36]=te,t[37]=L,t[38]=ie):ie=t[38],ie},ga=`__ALL_PROJECTS__`;function _a(e){let t=(0,z.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,q.jsx)(q.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,q.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,q.jsxs)(q.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 de(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 de(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,G.memo)(function({isOpen:e,onClose:t,initialFilter:r,projects:i,inline:a}){let[o,s]=(0,G.useState)(0),[c,l]=(0,G.useState)(``),[u,d]=(0,G.useState)(``),[f,p]=(0,G.useState)(!1),[m,h]=(0,G.useState)(!1),[g,_]=(0,G.useState)(0),[v,y]=(0,G.useState)(null),[x,S]=(0,G.useState)(null),C=(0,G.useMemo)(()=>u?{type:`thread`,threadId:u}:c===ga?{type:`all`}:c?{type:`project`,projectId:c}:null,[c,u]),w=C?ba(C,g):null;(0,G.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),y(null))},[e,r]);let T=e=>{d(e),l(``),s(0),y(null),S(null)},E=e=>{l(e),d(``),s(0),y(null),S(null)},ee=(0,G.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,G.useCallback)(async()=>{let e=ee();h(!0),S(null);try{await D(e.options),w&&Xi(w),y(w),s(0),p(!1)}catch(e){S(e instanceof Error?e.message:`Failed to clear conversation history`)}finally{h(!1)}},[ee,w]);function k(){C&&Xi(ba(C,g)),_(e=>e+1),y(null),S(null)}let A=ee();if(!e)return null;let j=(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(Fi,{value:c,onValueChange:E,children:[(0,q.jsx)(Li,{className:`w-48`,children:(0,q.jsx)(Ii,{placeholder:`Select project`})}),(0,q.jsxs)(Bi,{children:[(0,q.jsx)(Hi,{value:ga,children:`All Projects`}),i.map(e=>(0,q.jsx)(Hi,{value:e.projectId,children:e.name??e.projectId},e.projectId))]})]}),(0,q.jsxs)(Fi,{value:u,onValueChange:T,children:[(0,q.jsx)(Li,{className:`w-48`,children:(0,q.jsx)(Ii,{placeholder:`Select thread`})}),(0,q.jsx)(Bi,{children:i.flatMap(e=>e.threads.map(t=>(0,q.jsx)(Hi,{value:t.threadId,children:va(t,e.name??e.projectId)},t.threadId)))})]}),(0,q.jsxs)(re,{variant:`outline`,size:`sm`,onClick:()=>p(!0),disabled:m,children:[(0,q.jsx)(L,{className:`h-4 w-4 mr-2`}),`Clear`]})]}),M=(0,q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,q.jsx)(`div`,{className:a?void 0:`border-b px-6 py-4`,children:(0,q.jsx)(er,{title:`History`,description:a?`View and browse conversation history across projects and threads.`:void 0,action:(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[j,a?null:(0,q.jsx)(re,{variant:`action`,size:`icon-sm`,onClick:t,children:(0,q.jsx)(b,{})})]})})}),(0,q.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:x?(0,q.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,q.jsxs)(aa,{className:`max-w-md`,children:[(0,q.jsx)(oa,{children:(0,q.jsx)(sa,{className:`text-destructive`,children:`Error`})}),(0,q.jsxs)(la,{className:`space-y-4`,children:[(0,q.jsx)(`p`,{children:x}),(0,q.jsx)(re,{onClick:()=>S(null),children:`Dismiss`})]})]})}):v&&v===w?(0,q.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,q.jsxs)(`div`,{className:`max-w-md text-center space-y-2`,children:[(0,q.jsx)(`h3`,{className:n.emptyStateTitle,children:`No history`}),(0,q.jsx)(`p`,{className:n.bodyMuted,children:`No conversation history found for this thread.`})]})}):C?(0,q.jsx)(da,{fallbackTitle:`Failed to load conversation history`,onRetry:k,children:(0,q.jsx)(G.Suspense,{fallback:(0,q.jsx)(Wi,{label:`Loading conversation history...`,size:`lg`}),children:(0,q.jsx)(ha,{scope:C,projects:i,loadVersion:g,currentPromptIndex:o,onPromptIndexChange:s},w??void 0)})}):(0,q.jsx)(Wi,{label:`Loading conversation history...`,size:`lg`})})]});return(0,q.jsxs)(q.Fragment,{children:[a?(0,q.jsx)(or,{children:(0,q.jsx)(tr,{className:`max-w-none w-full h-full flex flex-col min-h-0`,children:M})}):(0,q.jsx)(`div`,{className:`fixed inset-0 z-50 bg-background`,children:M}),(0,q.jsx)(Un,{open:f,onOpenChange:p,children:(0,q.jsxs)(Kn,{children:[(0,q.jsxs)(qn,{children:[(0,q.jsx)(Yn,{children:A.title}),(0,q.jsx)(Xn,{children:A.description})]}),(0,q.jsxs)(Jn,{children:[(0,q.jsx)(Qn,{disabled:m,children:`Cancel`}),(0,q.jsx)(Zn,{onClick:e=>{e.preventDefault(),O()},disabled:m,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:m?`Clearing...`:`Clear`})]})]})})]})});export{Qn as A,ir as C,or as D,tr as E,Yn as F,un as I,Xn as M,Jn as N,Un as O,qn as P,er as S,sr as T,ur as _,Qi as a,lr as b,qi as c,Fi as d,Bi as f,Ii as g,Li as h,la as i,Kn as j,Zn as k,Wi as l,Ui as m,da as n,Xi as o,Hi as p,aa as r,Zi as s,fa as t,Gi as u,nr as v,cr as w,ar as x,rr as y};