tarsk 0.5.57 → 0.5.59

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 (127) hide show
  1. package/README.md +1 -1
  2. package/dist/bundled-skills/skill-creator/scripts/generate_report.js +0 -1
  3. package/dist/index.js +40050 -31896
  4. package/dist/public/assets/account-view-Cc6oDwk4.js +1 -0
  5. package/dist/public/assets/api-CtfZCd77.js +1 -0
  6. package/dist/public/assets/async-error-boundary-CaRNnJZe.js +1 -0
  7. package/dist/public/assets/browser-tab-BfAt-Sho.js +8 -0
  8. package/dist/public/assets/card-DFACZp3F.js +1 -0
  9. package/dist/public/assets/commit-dialog-Ck0r2v9S.js +1 -0
  10. package/dist/public/assets/context-menu-CBvTcHUI.js +1 -0
  11. package/dist/public/assets/create-repo-dialog-CBvRaov7.js +1 -0
  12. package/dist/public/assets/dialogs-config-C2KFQf9x.js +51 -0
  13. package/dist/public/assets/diff-view-DDECIdhE.js +4 -0
  14. package/dist/public/assets/explorer-file-drop-DaQtKkIj.js +1 -0
  15. package/dist/public/assets/explorer-tab-context-DCq1BBX_.js +1 -0
  16. package/dist/public/assets/explorer-tab-view-72Krb0Ir.js +2 -0
  17. package/dist/public/assets/explorer-tree-CcFgAYMn.js +1 -0
  18. package/dist/public/assets/explorer-view-DsNxf6nu.js +75 -0
  19. package/dist/public/assets/git-history-dialog--akFTQOd.js +1 -0
  20. package/dist/public/assets/git-ops-button-CKGLh3Zk.js +2 -0
  21. package/dist/public/assets/history-view-IcXfB6BD.js +15 -0
  22. package/dist/public/assets/index-BmpLvHah.js +75 -0
  23. package/dist/public/assets/index-r8I03VVW.css +1 -0
  24. package/dist/public/assets/mcp-server-card-DDmDAlY8.js +1 -0
  25. package/dist/public/assets/merged-pr-dialog-CiwhRqFv.js +1 -0
  26. package/dist/public/assets/model-list-controls-D5IaOffK.js +1 -0
  27. package/dist/public/assets/{monaco-y4UqQVp0.js → monaco-CMkNoWsM.js} +185 -185
  28. package/dist/public/assets/onboarding-CFIVEI92.js +1 -0
  29. package/dist/public/assets/project-settings-view-Klpu7p3U.js +1 -0
  30. package/dist/public/assets/providers-list-view-Df-ONKwe.js +1 -0
  31. package/dist/public/assets/pull-request-dialog-DVYZgMuN.js +1 -0
  32. package/dist/public/assets/pull-with-changes-dialog-CHHJ0gpA.js +1 -0
  33. package/dist/public/assets/push-before-pr-dialog-DoNMB3C8.js +1 -0
  34. package/dist/public/assets/react-vendor-tSKmVA4e.js +14 -0
  35. package/dist/public/assets/settings-general-view-yDDYKQmO.js +1 -0
  36. package/dist/public/assets/settings-instructions-view-y9bUZtKn.js +1 -0
  37. package/dist/public/assets/settings-list-j_NDw-aW.js +1 -0
  38. package/dist/public/assets/settings-logs-view-BzrjJRk6.js +5 -0
  39. package/dist/public/assets/settings-mcp-servers-view-NuKeyQ92.js +5 -0
  40. package/dist/public/assets/settings-models-view-64UG4njI.js +1 -0
  41. package/dist/public/assets/settings-rules-view-DdxIfxki.js +8 -0
  42. package/dist/public/assets/settings-skills-view-DoVxhA-A.js +3 -0
  43. package/dist/public/assets/settings-slash-commands-view-vm0HNVw1.js +1 -0
  44. package/dist/public/assets/settings-statistics-view-CKc3bD1x.js +1 -0
  45. package/dist/public/assets/settings-subagents-view-DuHK-7uc.js +2 -0
  46. package/dist/public/assets/settings-system-prompt-view-1clIREZ5.js +1 -0
  47. package/dist/public/assets/settings-telegram-view-DCPC5GxD.js +1 -0
  48. package/dist/public/assets/settings-view-BweC2YuW.js +2 -0
  49. package/dist/public/assets/skeleton-DBWV1Usf.js +1 -0
  50. package/dist/public/assets/slug-utils-D8SJJo7H.js +1 -0
  51. package/dist/public/assets/tasks-view-Cg9N8GZb.js +2 -0
  52. package/dist/public/assets/{terminal-panel-C8OewkuK.js → terminal-panel-Dlon-VDl.js} +2 -2
  53. package/dist/public/assets/ui-components-Dd2afm0c.js +1 -0
  54. package/dist/public/assets/{use-deferred-search-BDiZsnWG.js → use-deferred-search-Cu-o4nau.js} +1 -1
  55. package/dist/public/assets/use-installed-ai-files-X8NXRdGD.js +1 -0
  56. package/dist/public/assets/use-settings-page-loading-D1JlmLmD.js +1 -0
  57. package/dist/public/assets/{utils-CFYgrqBu.js → utils-Dt07QR3w.js} +1 -1
  58. package/dist/public/assets/{vosk-speech-BZoPqFPM.js → vosk-speech-Fi-g2v8n.js} +2 -2
  59. package/dist/public/assets/{web-CU5taXAB.js → web-CdkfJJZ3.js} +1 -1
  60. package/dist/public/assets/{web-BElJIgS6.js → web-CiaJzwav.js} +1 -1
  61. package/dist/public/assets/web-DeCAC9ap.js +1 -0
  62. package/dist/public/assets/{web-B15zzKQ-.js → web-DsLUxLTR.js} +1 -1
  63. package/dist/public/backgrounds/arctic-tundra.avif +0 -0
  64. package/dist/public/backgrounds/autumn-leaves.avif +0 -0
  65. package/dist/public/backgrounds/coastal-cliff.avif +0 -0
  66. package/dist/public/backgrounds/floating-waterfall.avif +0 -0
  67. package/dist/public/backgrounds/forest-path.avif +0 -0
  68. package/dist/public/backgrounds/garden-path.avif +0 -0
  69. package/dist/public/backgrounds/glow-marsh.avif +0 -0
  70. package/dist/public/backgrounds/golden-wheat.avif +0 -0
  71. package/dist/public/backgrounds/moon-desert.avif +0 -0
  72. package/dist/public/backgrounds/night-pond.avif +0 -0
  73. package/dist/public/backgrounds/prairie-grassland.avif +0 -0
  74. package/dist/public/backgrounds/river-winding.avif +0 -0
  75. package/dist/public/backgrounds/salt-flat.avif +0 -0
  76. package/dist/public/backgrounds/salt-marsh.avif +0 -0
  77. package/dist/public/backgrounds/sandy-beach.avif +0 -0
  78. package/dist/public/backgrounds/snow-river.avif +0 -0
  79. package/dist/public/backgrounds/sunset-pond.avif +0 -0
  80. package/dist/public/index.html +9 -9
  81. package/package.json +5 -4
  82. package/dist/public/assets/account-view-CCbGosVi.js +0 -1
  83. package/dist/public/assets/api-DG0vQ1QZ.js +0 -1
  84. package/dist/public/assets/browser-tab-BpUYCZGi.js +0 -8
  85. package/dist/public/assets/commit-dialog-DpwAQ4Z6.js +0 -1
  86. package/dist/public/assets/context-menu-B5kRTqdn.js +0 -1
  87. package/dist/public/assets/create-repo-dialog-BoCupv2m.js +0 -1
  88. package/dist/public/assets/dialogs-config-BIrrNhlc.js +0 -51
  89. package/dist/public/assets/diff-view-D10roF70.js +0 -3
  90. package/dist/public/assets/explorer-tab-view-CA_AMgZd.js +0 -2
  91. package/dist/public/assets/explorer-tree-xlOwCJvH.js +0 -1
  92. package/dist/public/assets/explorer-view-C6eud9zx.js +0 -75
  93. package/dist/public/assets/git-history-dialog-BN7wBt9F.js +0 -1
  94. package/dist/public/assets/git-ops-button-CrICekvM.js +0 -2
  95. package/dist/public/assets/history-view-DfTUOfnG.js +0 -9
  96. package/dist/public/assets/index-BUA2xxQg.js +0 -79
  97. package/dist/public/assets/index-BgPn08Yc.css +0 -1
  98. package/dist/public/assets/mcp-server-card-CzNUrI8l.js +0 -1
  99. package/dist/public/assets/merged-pr-dialog-CzXN0cEw.js +0 -1
  100. package/dist/public/assets/model-star-rating-t0v8L-DE.js +0 -1
  101. package/dist/public/assets/onboarding-B0Jzwrxy.js +0 -1
  102. package/dist/public/assets/project-settings-view-CsrfJOxB.js +0 -1
  103. package/dist/public/assets/providers-list-view-CMc48hq3.js +0 -1
  104. package/dist/public/assets/pull-request-dialog-X0kSTYFA.js +0 -1
  105. package/dist/public/assets/pull-with-changes-dialog-CSHYq7Pw.js +0 -1
  106. package/dist/public/assets/push-before-pr-dialog-CQEDHNrv.js +0 -1
  107. package/dist/public/assets/radio-group-r6OYvBm-.js +0 -1
  108. package/dist/public/assets/react-vendor-B19oy2bp.js +0 -16
  109. package/dist/public/assets/settings-general-view-D_9c5_qk.js +0 -1
  110. package/dist/public/assets/settings-instructions-view-DA4cK-tR.js +0 -1
  111. package/dist/public/assets/settings-list-DIkoBKWq.js +0 -1
  112. package/dist/public/assets/settings-mcp-servers-view-DdEOTT5a.js +0 -5
  113. package/dist/public/assets/settings-models-skeleton-H4k7on9v.js +0 -1
  114. package/dist/public/assets/settings-models-view-Dr2-jQBx.js +0 -1
  115. package/dist/public/assets/settings-rules-view-BkwWI1jx.js +0 -8
  116. package/dist/public/assets/settings-skills-view-C9CI7z7Q.js +0 -3
  117. package/dist/public/assets/settings-slash-commands-view-TF-A8FFP.js +0 -1
  118. package/dist/public/assets/settings-subagents-view-B73VymuX.js +0 -2
  119. package/dist/public/assets/settings-system-prompt-view-CiX_so-K.js +0 -1
  120. package/dist/public/assets/settings-view-DsEVR17r.js +0 -2
  121. package/dist/public/assets/skeleton-Cnmylb3F.js +0 -1
  122. package/dist/public/assets/slug-utils-DLI9k6Hb.js +0 -1
  123. package/dist/public/assets/tabs-CsOdC2OA.js +0 -1
  124. package/dist/public/assets/tasks-view-CGMAai1T.js +0 -2
  125. package/dist/public/assets/ui-components-CTS7wHdF.js +0 -1
  126. package/dist/public/assets/use-installed-ai-files-BfMG7O3g.js +0 -1
  127. package/dist/public/assets/web-gruOPZvU.js +0 -1
@@ -0,0 +1,4 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$a as t,Bc as n,Bt as r,Ir as i,Lc as a,Oo as o,Pt as s,Qi as c,Rc as l,Rr as u,Va as d,_r as f,a as p,co as m,cs as h,da as g,ea as _,eo as v,f as y,g as b,h as x,jo as S,ko as C,ks as w,ls as T,m as E,oo as D,qr as O,rc as k,u as A,uo as j,yn as M}from"./dialogs-config-C2KFQf9x.js";import{h as N}from"./react-vendor-tSKmVA4e.js";import{Bt as P,Ht as F,Ot as I,Sn as L,Ut as ee,f as te,g as R,jt as z,kt as ne,p as B}from"./history-view-IcXfB6BD.js";import{u as V}from"./onboarding-CFIVEI92.js";import{n as re}from"./utils-Dt07QR3w.js";import{G as ie,S as ae,T as oe,U as se,b as ce,j as H,w as U,x as W,y as G}from"./index-BmpLvHah.js";import{a as K,n as q,r as J,t as Y}from"./context-menu-CBvTcHUI.js";import{t as le}from"./async-error-boundary-CaRNnJZe.js";import{n as X}from"./monaco-CMkNoWsM.js";var Z=e(n(),1),Q=l(),$=a();function ue(e){let t=(0,Q.c)(12),{children:n,title:r,subtitle:i,headerAction:a,footer:o}=e,s;t[0]!==a||t[1]!==i||t[2]!==r?(s=(r||i||a)&&(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-1 border-b border-sidebar-border px-4 py-6`,children:[(r||a)&&(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`div`,{className:`flex items-center gap-2`,children:r&&(0,$.jsx)(`span`,{className:k.sectionTitle,children:r})}),a&&(0,$.jsx)(`div`,{className:`flex items-center gap-2 ml-auto`,children:a})]}),i]}),t[0]=a,t[1]=i,t[2]=r,t[3]=s):s=t[3];let c;t[4]===n?c=t[5]:(c=(0,$.jsx)(p,{className:`min-h-0 flex-1`,children:n}),t[4]=n,t[5]=c);let l;t[6]===o?l=t[7]:(l=o&&(0,$.jsx)(`div`,{className:`border-t border-sidebar-border`,children:o}),t[6]=o,t[7]=l);let u;return t[8]!==s||t[9]!==c||t[10]!==l?(u=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 w-full flex-col`,children:[s,c,l]}),t[8]=s,t[9]=c,t[10]=l,t[11]=u):u=t[11],u}function de(e){let t=(0,Q.c)(30),{node:n,level:r,renderNode:i,defaultOpen:a,indent:o,childContainerClassName:s,openState:c,onToggle:l,forceOpenIds:u}=e,d=!!(n.children&&n.children.length>0),f,p,m;if(t[0]!==a||t[1]!==u||t[2]!==d||t[3]!==r||t[4]!==n||t[5]!==l||t[6]!==c||t[7]!==i){f=u?.has(n.id)||(c[n.id]??a);let e;t[11]!==n.id||t[12]!==l?(e=()=>l(n.id),t[11]=n.id,t[12]=l,t[13]=e):e=t[13];let o=e;p=`min-w-0`,m=i(n,{isOpen:f,level:r,toggle:o,hasChildren:d}),t[0]=a,t[1]=u,t[2]=d,t[3]=r,t[4]=n,t[5]=l,t[6]=c,t[7]=i,t[8]=f,t[9]=p,t[10]=m}else f=t[8],p=t[9],m=t[10];let h;t[14]!==s||t[15]!==a||t[16]!==u||t[17]!==d||t[18]!==o||t[19]!==f||t[20]!==r||t[21]!==n.children||t[22]!==l||t[23]!==c||t[24]!==i?(h=d&&f&&(0,$.jsx)(`div`,{style:{paddingLeft:o},className:s,children:n.children.map(e=>(0,$.jsx)(de,{node:e,level:r+1,renderNode:i,defaultOpen:a,indent:o,childContainerClassName:s,openState:c,onToggle:l,forceOpenIds:u},e.id))}),t[14]=s,t[15]=a,t[16]=u,t[17]=d,t[18]=o,t[19]=f,t[20]=r,t[21]=n.children,t[22]=l,t[23]=c,t[24]=i,t[25]=h):h=t[25];let g;return t[26]!==p||t[27]!==m||t[28]!==h?(g=(0,$.jsxs)(`div`,{className:p,children:[m,h]}),t[26]=p,t[27]=m,t[28]=h,t[29]=g):g=t[29],g}function fe(e){let t=(0,Q.c)(31),{nodes:n,renderNode:r,resetKey:i,defaultOpen:a,forceOpenIds:o,initialOpenIds:s,indent:c,childContainerClassName:l,className:u}=e,d=a===void 0?!1:a,f=c===void 0?16:c,p;t[0]===s?p=t[1]:(p=()=>{let e={};if(s)for(let t of s)e[t]=!0;return e},t[0]=s,t[1]=p);let[m,h]=(0,Z.useState)(p),[g,v]=(0,Z.useState)(i);if(i!==g){v(i);let e={};if(s)for(let t of s)e[t]=!0;h(e)}let y;t[2]===o?y=t[3]:(y=o?new Set(o):void 0,t[2]=o,t[3]=y);let b=y,x,S;t[4]===o?(x=t[5],S=t[6]):(x=()=>{o?.length&&h(e=>{let t={...e},n=!1;for(let e of o)t[e]!==!0&&(t[e]=!0,n=!0);return n?t:e})},S=[o],t[4]=o,t[5]=x,t[6]=S),(0,Z.useEffect)(x,S);let C;t[7]===d?C=t[8]:(C=e=>{h(t=>({...t,[e]:!(t[e]??d)}))},t[7]=d,t[8]=C);let w=C,T;t[9]===u?T=t[10]:(T=_(`min-w-0`,u),t[9]=u,t[10]=T);let E;if(t[11]!==l||t[12]!==d||t[13]!==b||t[14]!==w||t[15]!==f||t[16]!==n||t[17]!==m||t[18]!==r){let e;t[20]!==l||t[21]!==d||t[22]!==b||t[23]!==w||t[24]!==f||t[25]!==m||t[26]!==r?(e=e=>(0,$.jsx)(de,{node:e,level:0,renderNode:r,defaultOpen:d,indent:f,childContainerClassName:l,openState:m,onToggle:w,forceOpenIds:b},e.id),t[20]=l,t[21]=d,t[22]=b,t[23]=w,t[24]=f,t[25]=m,t[26]=r,t[27]=e):e=t[27],E=n.map(e),t[11]=l,t[12]=d,t[13]=b,t[14]=w,t[15]=f,t[16]=n,t[17]=m,t[18]=r,t[19]=E}else E=t[19];let D;return t[28]!==T||t[29]!==E?(D=(0,$.jsx)(`div`,{className:T,children:E}),t[28]=T,t[29]=E,t[30]=D):D=t[30],D}function pe(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 me={added:`text-green-500`,deleted:`text-red-500`,untracked:`text-green-500`,renamed:`text-blue-500`,modified:`text-orange-500`},he={added:`A`,deleted:`D`,untracked:`U`,renamed:`R`,modified:`M`};function ge(e){return _(_(k.compact,`status-badge font-mono font-semibold`),me[e]??`text-orange-500`)}function _e(e){return he[e]??`M`}function ve(e){let t=(0,Q.c)(22),{treeData:n,files:r,error:i,selectedFileIndex:a,onFileSelect:s,onRevertFile:c}=e,{setStats:l}=U(),u;t[0]===r?u=t[1]:(u=r.reduce(Se,0),t[0]=r,t[1]=u);let f=u,p;t[2]===r?p=t[3]:(p=r.reduce(ye,0),t[2]=r,t[3]=p);let m=p,g,v;if(t[4]!==r.length||t[5]!==l||t[6]!==f||t[7]!==m?(g=()=>{l({fileCount:r.length,additions:f,deletions:m})},v=[r.length,f,m,l],t[4]=r.length,t[5]=l,t[6]=f,t[7]=m,t[8]=g,t[9]=v):(g=t[8],v=t[9]),(0,Z.useEffect)(g,v),i){let e;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(e=_(k.compact,`text-destructive text-center`),t[10]=e):e=t[10];let n;return t[11]===i?n=t[12]:(n=(0,$.jsx)(ue,{children:(0,$.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,$.jsx)(`p`,{className:e,children:i})})}),t[11]=i,t[12]=n),n}if(r.length===0){let e;return t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ue,{children:(0,$.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,$.jsx)(`p`,{className:_(k.compact,k.bodyMuted,`text-center`),children:`No changes to review`})})}),t[13]=e):e=t[13],e}let y;t[14]!==r||t[15]!==s||t[16]!==c||t[17]!==a?(y=(e,t)=>{let{isOpen:n,toggle:i}=t,l=!!e.children,u=(0,$.jsxs)(V,{onClick:()=>{l?i():e.fileIndex!==void 0&&s(e.fileIndex)},selected:!l&&e.fileIndex===a,className:`gap-1.5`,children:[l?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(h,{className:_(`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform`,n&&`rotate-90`)}),n?(0,$.jsx)(C,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}):(0,$.jsx)(o,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}):(0,$.jsx)(S,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`truncate flex-1 min-w-0`,children:e.name}),!l&&e.status&&(0,$.jsx)(`span`,{className:ge(e.status),children:_e(e.status)})]});return l?u:(0,$.jsxs)(Y,{children:[(0,$.jsx)(K,{asChild:!0,children:(0,$.jsx)(`div`,{children:u})}),(0,$.jsx)(q,{children:(0,$.jsxs)(J,{onClick:()=>{e.fileIndex!==void 0&&c?.(r[e.fileIndex])},children:[(0,$.jsx)(d,{className:`mr-2 h-3.5 w-3.5`}),`Revert Change`]})})]})},t[14]=r,t[15]=s,t[16]=c,t[17]=a,t[18]=y):y=t[18];let b;return t[19]!==y||t[20]!==n?(b=(0,$.jsx)(ue,{children:(0,$.jsx)(`div`,{className:`px-1 pt-3 pb-2`,children:(0,$.jsx)(fe,{nodes:n,defaultOpen:!0,resetKey:n,indent:16,childContainerClassName:`ml-4 border-l border-sidebar-border pl-2`,renderNode:y})})}),t[19]=y,t[20]=n,t[21]=b):b=t[21],b}function ye(e,t){return e+t.hunks.reduce(be,0)}function be(e,t){return e+t.changes.filter(xe).length}function xe(e){return e.type===`delete`}function Se(e,t){return e+t.hunks.reduce(Ce,0)}function Ce(e,t){return e+t.changes.filter(we).length}function we(e){return e.type===`add`}function Te(e){let t=(0,Q.c)(36),{open:n,lineNumber:r,lineContent:i,initialComment:a,isEditing:o,onSave:s,onDelete:l,onClose:u}=e,[d,f]=(0,Z.useState)((a===void 0?``:a)??``),p;t[0]!==s||t[1]!==d?(p=()=>{d.trim()&&s(d.trim())},t[0]=s,t[1]=d,t[2]=p):p=t[2];let m=p,h;t[3]===m?h=t[4]:(h=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),m())},t[3]=m,t[4]=h);let g=h,v;t[5]===u?v=t[6]:(v=e=>{e||u()},t[5]=u,t[6]=v);let S;t[7]===r?S=t[8]:(S=(0,$.jsx)(x,{children:(0,$.jsxs)(b,{children:[`Comment on line `,r]})}),t[7]=r,t[8]=S);let C;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(C=_(k.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=i||` `,T;t[10]===w?T=t[11]:(T=(0,$.jsx)(`div`,{className:C,children:w}),t[10]=w,t[11]=T);let D;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>f(e.target.value),t[12]=D):D=t[12];let O;t[13]!==g||t[14]!==d?(O=(0,$.jsx)(H,{autoFocus:!0,placeholder:`Add a comment... (Cmd+Enter to save)`,value:d,onChange:D,onKeyDown:g,rows:12,className:`resize-none text-base`}),t[13]=g,t[14]=d,t[15]=O):O=t[15];let j;t[16]!==o||t[17]!==l?(j=o&&l&&(0,$.jsx)(c,{variant:`destructive`,size:`sm`,onClick:l,className:`mr-auto`,children:`Delete`}),t[16]=o,t[17]=l,t[18]=j):j=t[18];let M;t[19]===d?M=t[20]:(M=d.trim(),t[19]=d,t[20]=M);let N=!M,P;t[21]!==m||t[22]!==N?(P=(0,$.jsx)(c,{size:`sm`,onClick:m,disabled:N,children:`Save`}),t[21]=m,t[22]=N,t[23]=P):P=t[23];let F;t[24]!==j||t[25]!==P?(F=(0,$.jsxs)(E,{className:`gap-2 sm:gap-0`,children:[j,P]}),t[24]=j,t[25]=P,t[26]=F):F=t[26];let I;t[27]!==O||t[28]!==F||t[29]!==S||t[30]!==T?(I=(0,$.jsxs)(y,{className:`max-w-2xl`,children:[S,T,O,F]}),t[27]=O,t[28]=F,t[29]=S,t[30]=T,t[31]=I):I=t[31];let L;return t[32]!==n||t[33]!==I||t[34]!==v?(L=(0,$.jsx)(A,{open:n,onOpenChange:v,children:I}),t[32]=n,t[33]=I,t[34]=v,t[35]=L):L=t[35],L}function Ee(e){let t=F(),n=ee(e=>e.diffComments),r=(0,Z.useMemo)(()=>n[e]??[],[n,e]),i=(0,Z.useCallback)(r=>{let i=n[e]??[],a=typeof r==`function`?r(i):r;t({type:L.SetDiffComments,threadId:e,comments:a})},[t,e,n]),a=(0,Z.useRef)(!1);return(0,Z.useEffect)(()=>{if((n[e]??[]).length>0){a.current=!0;return}M(e).then(n=>{n.diffComments&&n.diffComments.length>0&&t({type:L.SetDiffComments,threadId:e,comments:n.diffComments}),a.current=!0}).catch(()=>{a.current=!0})},[e]),(0,Z.useEffect)(()=>{a.current&&f(e,{diffComments:r}).catch(()=>{})},[e,r]),{comments:r,setComments:i}}function De(e,t){return`git-diff:${e}:${t}`}function Oe(){return Error(`Loading review changes timed out. Please try again.`)}async function ke(e,t=15e3){return Promise.race([i(e),new Promise((e,n)=>{window.setTimeout(()=>n(Oe()),t)})])}var Ae=2;function je(e,t){return t<=0?{min:e,max:e}:{min:e,max:e+t-1}}function Me(e,t){return{startLine:Math.max(1,e-Ae),endLine:t+Ae}}function Ne(e){if(e.hunks.length===0)return null;let t=1/0,n=0,r=1/0,i=0;for(let a of e.hunks){let e=je(a.oldStart,a.oldLines),o=je(a.newStart,a.newLines);t=Math.min(t,e.min),n=Math.max(n,e.max),r=Math.min(r,o.min),i=Math.max(i,o.max)}return t===1/0||r===1/0?null:{original:Me(t,n),modified:Me(r,i)}}function Pe(e,t,n){if(e.length===0)return``;let r=e.endsWith(`
2
+ `),i=e.split(`
3
+ `);return r&&i.length>0&&i[i.length-1]===``&&i.pop(),i.slice(Math.max(0,t-1),Math.max(t-1,n)).join(`
4
+ `)}function Fe(e){let t=Ne(e);return t?t.original.startLine<=1||t.modified.startLine<=1:!0}function Ie(e,t){return t?e-t.startLine+1:e}function Le(e,t){return t?t.startLine+e-1:e}function Re(e){return{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`}function ze(e){let t=(0,Q.c)(33),{comments:n,activeCommentIndex:r,isFullView:i,selectedFileIndex:a,files:o,selectedFile:s,onLineGutterClick:c}=e,l=(0,Z.useRef)(null),u=(0,Z.useRef)(n),d=(0,Z.useRef)(r),f;t[0]!==o||t[1]!==i||t[2]!==a?(f={isFullView:i,selectedFileIndex:a,files:o},t[0]=o,t[1]=i,t[2]=a,t[3]=f):f=t[3];let p=(0,Z.useRef)(f),m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m={original:[],modified:[]},t[4]=m):m=t[4];let h=(0,Z.useRef)(m),g=(0,Z.useRef)(!0),_,v;t[5]===n?(_=t[6],v=t[7]):(_=()=>{u.current=n},v=[n],t[5]=n,t[6]=_,t[7]=v),(0,Z.useEffect)(_,v);let y,b;t[8]===r?(y=t[9],b=t[10]):(y=()=>{d.current=r},b=[r],t[8]=r,t[9]=y,t[10]=b),(0,Z.useEffect)(y,b);let x,S;t[11]!==o||t[12]!==i||t[13]!==a?(x=()=>{p.current={isFullView:i,selectedFileIndex:a,files:o}},S=[i,a,o],t[11]=o,t[12]=i,t[13]=a,t[14]=x,t[15]=S):(x=t[14],S=t[15]),(0,Z.useEffect)(x,S);let C;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>{if(!g.current)return;let e=l.current;if(!e)return;let{isFullView:t,selectedFileIndex:n,files:r}=p.current,i=u.current,a=d.current,o=r[n];if(!o)return;let s=(e,r)=>{let s=t?null:Ne(o),c=s?r===`original`?s.original:s.modified:null,l=i.filter(e=>e.fileIndex===n&&e.side===r),u=new Set(l.map(e=>Ie(e.lineNumber,c))),d=e.getModel()?.getLineCount()??0,f=[];for(let e=1;e<=d;e++)u.has(e)||f.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:X.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}});let p=l.map(e=>{let t=Ie(e.lineNumber,c);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:X.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}}}).filter(Ve);f.push(...p);let m=r===`original`?h.current.original:h.current.modified,g=e.deltaDecorations(m,f);r===`original`?h.current.original=g:h.current.modified=g};s(e.getOriginalEditor(),`original`),s(e.getModifiedEditor(),`modified`)},t[16]=C):C=t[16];let w=C,T;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>{w()},t[17]=T):T=t[17];let E;t[18]!==r||t[19]!==n||t[20]!==i||t[21]!==s||t[22]!==a?(E=[w,n,r,a,i,s],t[18]=r,t[19]=n,t[20]=i,t[21]=s,t[22]=a,t[23]=E):E=t[23],(0,Z.useEffect)(T,E);let D;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>()=>{l.current=null,h.current={original:[],modified:[]}},t[24]=D):D=t[24];let O;t[25]===a?O=t[26]:(O=[a],t[25]=a,t[26]=O),(0,Z.useEffect)(D,O);let k,A;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>()=>{g.current=!1,l.current&&=(l.current.getOriginalEditor().getModel()?.dispose(),l.current.getModifiedEditor().getModel()?.dispose(),l.current.dispose(),null),h.current={original:[],modified:[]}},A=[],t[27]=k,t[28]=A):(k=t[27],A=t[28]),(0,Z.useEffect)(k,A);let j;t[29]===c?j=t[30]:(j=e=>{l.current=e;let t=Be,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}=p.current,l=s[o];if(!l)return;let d=a?null:Ne(l),f=Le(i,d?n===`original`?d.original:d.modified:null),m=e.getModel()?.getLineContent(i)??``;c({existing:u.current.find(e=>e.fileIndex===o&&e.lineNumber===f&&e.side===n),lineNumber:f,lineContent:m,side:n})})};n(e.getOriginalEditor(),`original`),n(e.getModifiedEditor(),`modified`),setTimeout(()=>{l.current===e&&w()},150)},t[29]=c,t[30]=j);let M=j,N;return t[31]===M?N=t[32]:(N={diffEditorRef:l,applyAllDecorations:w,handleEditorDidMount:M},t[31]=M,t[32]=N),N}function Be(e){return e===X.MouseTargetType.GUTTER_GLYPH_MARGIN||e===X.MouseTargetType.GUTTER_LINE_NUMBERS||e===X.MouseTargetType.GUTTER_LINE_DECORATIONS||e===X.MouseTargetType.GUTTER_VIEW_ZONE}function Ve(e){return e!==null}var He=P(e=>e.v0,{name:`ReviewLoadingFallback_1`,portals:[`v0`]}),Ue=P(e=>(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,$.jsxs)(`div`,{className:`space-y-4 text-center`,children:[(0,$.jsx)(`p`,{className:e.v0,children:`Loading review changes is taking longer than expected.`}),e.v1]})}),{name:`ReviewLoadingFallback_2`,portals:[`v1`]}),We=function(e){let t=(0,Q.c)(5),{onRetry:n}=e,[r,i]=(0,Z.useState)(!1),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{let e=window.setTimeout(()=>{i(!0)},15e3);return()=>{window.clearTimeout(e)}},o=[],t[0]=a,t[1]=o):(a=t[0],o=t[1]),(0,Z.useEffect)(a,o),!r){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(He,{v0:(0,$.jsx)(R,{label:`Loading review changes...`})}),t[2]=e):e=t[2],e}let s;return t[3]===n?s=t[4]:(s=(0,$.jsx)(Ue,{v0:k.bodyMuted,v1:(0,$.jsx)(c,{variant:`outline`,onClick:n,children:`Retry`})}),t[3]=n,t[4]=s),s},Ge=P(e=>(0,$.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,$.jsx)(`div`,{className:e.v0,children:e.v1}),(0,$.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 overflow-auto bg-background`,children:(0,$.jsx)(`img`,{src:e.v2,alt:e.v3,className:`max-w-full max-h-full object-contain`})})]}),{name:`DiffImageSingle_1`,portals:[`v1`]}),Ke=function(e){let t=(0,Q.c)(5),{threadId:n,filePath:r,version:i,label:a}=e,o=Je(n,r,i),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=_(k.caption,`px-3 py-1.5 border-b text-muted-foreground bg-muted/30`),t[0]=s):s=t[0];let c=`${a} - ${r}`,l;return t[1]!==a||t[2]!==o||t[3]!==c?(l=(0,$.jsx)(Ge,{v0:s,v1:a,v2:o,v3:c}),t[1]=a,t[2]=o,t[3]=c,t[4]=l):l=t[4],l};function qe(e,t,n){return`git-media:${e}:${t}:${n}`}function Je(e,t,n){let r=(0,Q.c)(13),i;r[0]!==t||r[1]!==e||r[2]!==n?(i=qe(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=()=>u(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,d;return r[10]===c?(l=r[11],d=r[12]):(l=()=>()=>{URL.revokeObjectURL(c)},d=[c],r[10]=c,r[11]=l,r[12]=d),(0,Z.useEffect)(l,d),c}function Ye(e){let t=(0,Q.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,$.jsx)(R,{label:`Loading before...`}),t[0]=e):e=t[0];let i=r.status===`renamed`&&r.oldPath?r.oldPath:r.path,a;t[1]!==i||t[2]!==n?(a=(0,$.jsx)(`div`,{className:`flex-1 border-r border-border`,children:(0,$.jsx)(Z.Suspense,{fallback:e,children:(0,$.jsx)(Ke,{threadId:n,filePath:i,version:`old`,label:`Before`})})}),t[1]=i,t[2]=n,t[3]=a):a=t[3];let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(R,{label:`Loading after...`}),t[4]=o):o=t[4];let s;t[5]!==r.path||t[6]!==n?(s=(0,$.jsx)(`div`,{className:`flex-1`,children:(0,$.jsx)(Z.Suspense,{fallback:o,children:(0,$.jsx)(Ke,{threadId:n,filePath:r.path,version:`new`,label:`After`})})}),t[5]=r.path,t[6]=n,t[7]=s):s=t[7];let c;return t[8]!==a||t[9]!==s?(c=(0,$.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,$.jsx)(R,{label:l}),t[13]=l,t[14]=u);let d;t[15]!==r.path||t[16]!==s||t[17]!==n||t[18]!==o?(d=(0,$.jsx)(Ke,{threadId:n,filePath:r.path,version:o,label:s}),t[15]=r.path,t[16]=s,t[17]=n,t[18]=o,t[19]=d):d=t[19];let f;return t[20]!==u||t[21]!==d?(f=(0,$.jsx)(`div`,{className:`flex h-full flex-col`,children:(0,$.jsx)(Z.Suspense,{fallback:u,children:d})}),t[20]=u,t[21]=d,t[22]=f):f=t[22],f}function Xe(e){let n=(0,Q.c)(63),{threadId:r,selectedFile:i,selectedFileIndex:a,isImageFile:o,diffOriginal:s,diffModified:l,resolvedTheme:u,onEditorMount:d,diffEditorOptions:f,isPanelCollapsed:p,showTreeBackButton:y,onShowTree:b,onTogglePanel:x,isFullView:S,onToggleFullView:C,comments:w,activeCommentIndex:E,onPrevComment:O,onNextComment:A,onFixComments:M,isChatOpen:P,onOpenChat:F,onCloseChat:L}=e,ee=p&&`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`,te;n[0]===ee?te=n[1]:(te=_(`bg-transparent`,ee),n[0]=ee,n[1]=te);let R;n[2]!==p||n[3]!==b||n[4]!==x||n[5]!==y?(R=y?(0,$.jsxs)(c,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground shrink-0`,onClick:b,children:[(0,$.jsx)(t,{className:`h-4 w-4`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Show file tree`})]}):(0,$.jsxs)(c,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground shrink-0`,onClick:x,children:[p?(0,$.jsx)(t,{className:`h-4 w-4`}):(0,$.jsx)(v,{className:`h-4 w-4`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Toggle file tree`})]}),n[2]=p,n[3]=b,n[4]=x,n[5]=y,n[6]=R):R=n[6];let B;n[7]===Symbol.for(`react.memo_cache_sentinel`)?(B=_(k.label,`text-foreground`),n[7]=B):B=n[7];let V=i?i.path:`Review Changes`,re;n[8]===V?re=n[9]:(re=(0,$.jsx)(`span`,{className:B,children:V}),n[8]=V,n[9]=re);let ae;n[10]!==R||n[11]!==re?(ae=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[R,re]}),n[10]=R,n[11]=re,n[12]=ae):ae=n[12];let se=p&&`ml-0`,ce=!p&&`ml-auto`,H;n[13]!==se||n[14]!==ce?(H=_(`flex items-center gap-2`,se,ce,`md:ml-auto`),n[13]=se,n[14]=ce,n[15]=H):H=n[15];let U;n[16]!==S||n[17]!==o||n[18]!==C||n[19]!==i?(U=!o&&(0,$.jsx)(c,{variant:`ghost`,size:`sm`,onClick:C,disabled:!i,className:_(k.compact,`h-8 gap-1 px-2`),children:S?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(D,{className:`h-3 w-3`}),` Show changes only`]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(j,{className:`h-3 w-3`}),` Show full file`]})}),n[16]=S,n[17]=o,n[18]=C,n[19]=i,n[20]=U):U=n[20];let W;n[21]!==E||n[22]!==w.length||n[23]!==A||n[24]!==O?(W=w.length>0&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(I,{children:[(0,$.jsx)(z,{asChild:!0,children:(0,$.jsx)(c,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:O,disabled:(E??0)===0,children:(0,$.jsx)(T,{className:`h-3 w-3`})})}),(0,$.jsx)(ne,{children:`Previous comment`})]}),(0,$.jsx)(`span`,{className:_(k.caption,`whitespace-nowrap`),children:w.length===1?`1 Comment`:`Comment ${(E??0)+1} of ${w.length}`}),(0,$.jsxs)(I,{children:[(0,$.jsx)(z,{asChild:!0,children:(0,$.jsx)(c,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:A,disabled:(E??0)===w.length-1,children:(0,$.jsx)(h,{className:`h-3 w-3`})})}),(0,$.jsx)(ne,{children:`Next comment`})]})]}),n[21]=E,n[22]=w.length,n[23]=A,n[24]=O,n[25]=W):W=n[25];let G;n[26]!==w.length||n[27]!==M?(G=w.length>0&&(0,$.jsxs)(I,{children:[(0,$.jsx)(z,{asChild:!0,children:(0,$.jsxs)(c,{size:`sm`,onClick:M,className:_(k.compact,`h-8 gap-1 px-3 bg-foreground text-background hover:bg-foreground/90`),children:[(0,$.jsx)(m,{className:`h-3 w-3`}),`Fix all comments`]})}),(0,$.jsx)(ne,{children:`Send all comments to Tarsk for resolution`})]}),n[26]=w.length,n[27]=M,n[28]=G):G=n[28];let K;n[29]!==H||n[30]!==U||n[31]!==W||n[32]!==G?(K=(0,$.jsxs)(`div`,{className:H,children:[U,W,G]}),n[29]=H,n[30]=U,n[31]=W,n[32]=G,n[33]=K):K=n[33];let q;n[34]!==K||n[35]!==te||n[36]!==ae?(q=(0,$.jsxs)(ie,{className:te,children:[ae,K]}),n[34]=K,n[35]=te,n[36]=ae,n[37]=q):q=n[37];let J;n[38]!==f||n[39]!==l||n[40]!==s||n[41]!==o||n[42]!==d||n[43]!==u||n[44]!==i||n[45]!==a||n[46]!==r?(J=o&&i?(0,$.jsx)(Ye,{threadId:r,file:i}):(0,$.jsx)(N,{height:`100%`,language:Re(i?.path||``),original:s,modified:l,theme:u===`dark`?`vs-dark`:`vs-light`,onMount:d,options:f},`diff-${a}`),n[38]=f,n[39]=l,n[40]=s,n[41]=o,n[42]=d,n[43]=u,n[44]=i,n[45]=a,n[46]=r,n[47]=J):J=n[47];let Y;n[48]!==P||n[49]!==L?(Y=P&&(0,$.jsxs)(`div`,{className:`pointer-events-auto w-[min(100%,48rem)] rounded-2xl bg-background/50 p-4 backdrop-blur-md`,children:[(0,$.jsx)(`div`,{className:`mb-3 flex items-center justify-end`,children:(0,$.jsxs)(c,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:L,children:[(0,$.jsx)(g,{className:`h-4 w-4`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Close chat`})]})}),(0,$.jsx)(oe,{})]}),n[48]=P,n[49]=L,n[50]=Y):Y=n[50];let le;n[51]!==P||n[52]!==F?(le=!P&&(0,$.jsxs)(I,{children:[(0,$.jsx)(z,{asChild:!0,children:(0,$.jsxs)(c,{size:`icon`,className:`pointer-events-auto h-12 w-12 rounded-full shadow-lg`,onClick:F,children:[(0,$.jsx)(m,{className:`h-5 w-5`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Open review chat`})]})}),(0,$.jsx)(ne,{children:`Chat about this diff`})]}),n[51]=P,n[52]=F,n[53]=le):le=n[53];let X;n[54]!==Y||n[55]!==le?(X=(0,$.jsxs)(`div`,{className:`pointer-events-none absolute bottom-4 right-4 z-20 flex flex-col items-end gap-3`,children:[Y,le]}),n[54]=Y,n[55]=le,n[56]=X):X=n[56];let Z;n[57]!==J||n[58]!==X?(Z=(0,$.jsxs)(`div`,{className:`flex-1 bg-transparent relative`,children:[J,X]}),n[57]=J,n[58]=X,n[59]=Z):Z=n[59];let ue;return n[60]!==q||n[61]!==Z?(ue=(0,$.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:[q,Z]}),n[60]=q,n[61]=Z,n[62]=ue):ue=n[62],ue}function Ze(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(G,{withHandle:!0,className:`z-10 shrink-0`}),e[0]=t):t=e[0],t}function Qe(e){let t=(0,Q.c)(8),{isMobile:n,mobileShowTree:r,panelRef:i,onPanelCollapse:a,onPanelExpand:o,fileTreePanel:s,diffEditorPanel:c}=e,l;return t[0]!==c||t[1]!==s||t[2]!==n||t[3]!==r||t[4]!==a||t[5]!==o||t[6]!==i?(l=(0,$.jsx)(`div`,{className:`diff-body flex min-h-0 w-full flex-1 overflow-hidden`,children:n?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:_(`flex min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden`,!r&&`hidden`),children:s}),(0,$.jsx)(`div`,{className:_(`flex min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden`,r&&`hidden`),children:c})]}):(0,$.jsxs)(W,{direction:`horizontal`,children:[(0,$.jsx)(ce,{ref:i,defaultSize:25,minSize:12,maxSize:40,collapsible:!0,collapsedSize:0,onCollapse:a,onExpand:o,className:`overflow-hidden border-r border-transparent`,children:s}),(0,$.jsx)(Ze,{}),(0,$.jsx)(ce,{className:`overflow-hidden border-l border-border bg-transparent`,children:c})]})}),t[0]=c,t[1]=s,t[2]=n,t[3]=r,t[4]=a,t[5]=o,t[6]=i,t[7]=l):l=t[7],l}var $e=w(`app.diff-view.ui`);function et({threadId:e,onExit:t,loadVersion:n,cachedState:a,onCachedStateChange:o}){let c=te(De(e,n),()=>ke(e)),l=F(),u=ee(e=>e.projectModelSelections),{resolvedTheme:d}=re(),f=ae(),{fetchUnifiedStatus:p}=se(),[m,h]=(0,Z.useState)(a?.files??c.files??[]),[g,_]=(0,Z.useState)(null),[v,y]=(0,Z.useState)(a?.selectedFileIndex??0),[b,x]=(0,Z.useState)(!1),[S,C]=(0,Z.useState)(!1),[w,T]=(0,Z.useState)(!1),[E,D]=(0,Z.useState)(!0),k=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{h(c.files??[]),y(e=>{let t=a?.selectedFileIndex??e,n=Math.max((c.files?.length??1)-1,0);return Math.min(t,n)})},[a?.selectedFileIndex,c.files]),(0,Z.useEffect)(()=>{D(!0)},[e]);let A=(0,Z.useCallback)(e=>{y(e),f&&D(!1)},[f]);(0,Z.useEffect)(()=>{o&&o(e=>{let t=m,n=Math.max(t.length-1,0),r=Math.min(v,n);return e?.files===t&&e.selectedFileIndex===r?e:{files:t,selectedFileIndex:r}})},[m,o,v]);let j=(0,Z.useCallback)(()=>{D(!0)},[]),M=f&&!E,{comments:N,setComments:P}=Ee(e),[I,R]=(0,Z.useState)(null),[z,ne]=(0,Z.useState)(null),[B,V]=(0,Z.useState)(null),ie=(0,Z.useCallback)(()=>{k.current&&(S?k.current.expand():k.current.collapse())},[S]),oe=(0,Z.useCallback)(async()=>{if(e){_(null);try{h((await i(e)).files||[]),y(0)}catch(e){_(e instanceof Error?e.message:`Failed to load diff`)}}},[e]),ce=(0,Z.useCallback)(async t=>{try{await O(e,t.path),await Promise.all([oe(),p(!0)])}catch(e){_(e instanceof Error?e.message:`Failed to revert file`)}},[e,oe,p]),H=(0,Z.useMemo)(()=>pe(m),[m]),U=m[v],W=U?.isBinary??!1,G=U?b?U.oldContent:(()=>{let e=Ne(U);return e?Pe(U.oldContent,e.original.startLine,e.original.endLine):U.oldContent})():``,K=U?b?U.newContent:(()=>{let e=Ne(U);return e?Pe(U.newContent,e.modified.startLine,e.modified.endLine):U.newContent})():``,{diffEditorRef:q,applyAllDecorations:J,handleEditorDidMount:Y}=ze({comments:N,activeCommentIndex:I,isFullView:b,selectedFileIndex:v,files:m,selectedFile:U,onLineGutterClick:(0,Z.useCallback)(({existing:e,lineNumber:t,lineContent:n,side:r})=>{e?V(e):ne({lineNumber:t,lineContent:n,side:r})},[])}),le=(0,Z.useCallback)(e=>{if(z&&U){let t={id:`comment-${Date.now()}`,filePath:U.path,fileIndex:v,lineNumber:z.lineNumber,lineContent:z.lineContent,comment:e,side:z.side};P(e=>[...e,t]),ne(null)}else B&&(P(t=>t.map(t=>t.id===B.id?{...t,comment:e}:t)),V(null))},[z,B,U,v,P]),X=(0,Z.useCallback)(()=>{B&&(P(e=>e.filter(e=>e.id!==B.id)),V(null))},[B,P]),Q=(0,Z.useCallback)(e=>{if(N.length===0)return;let t=(e%N.length+N.length)%N.length,n=N[t];R(t),y(n.fileIndex),f&&D(!1),setTimeout(()=>{let e=q.current;if(!e)return;let t=m[n.fileIndex];if(!t)return;let r=b?null:Ne(t),i=r?n.side===`original`?r.original:r.modified:null,a=Ie(n.lineNumber,i);(n.side===`original`?e.getOriginalEditor():e.getModifiedEditor()).revealLineInCenter(Math.max(1,a)),J()},100)},[N,m,b,J,f]),ue=(0,Z.useCallback)(()=>{Q((I??0)-1)},[Q,I]),de=(0,Z.useCallback)(()=>{Q((I??-1)+1)},[Q,I]),fe=(0,Z.useCallback)(async()=>{let n=u[e];if(!n)try{let e=await r(),t=Object.values(e).flat();if(t.length>0)n=t[0];else{$e.error(`No models available to process comments`);return}}catch(e){$e.error(`Failed to load models:`,e);return}let i=n.id,a=n.provider;try{let{prompt:n}=await s(e,N);P([]),l({type:L.SetPendingChatMessage,message:{threadId:e,message:n,model:i,provider:a}}),t()}catch(e){$e.error(`Failed to fix comments:`,e),typeof window<`u`&&window.alert(`Failed to process comments. Please try again.`)}},[N,u,l,e,t,P]),me={readOnly:!0,renderSideBySide:!f,ignoreTrimWhitespace:!1,renderOverviewRuler:!0,scrollBeyondLastLine:!1,minimap:{enabled:!1},folding:!1,glyphMargin:!0,lineNumbers:U&&(b||Fe(U))?`on`:`off`,diffWordWrap:`on`,originalEditable:!1,automaticLayout:!0};return(0,$.jsxs)(`div`,{className:`diff-view-root flex h-full min-h-0 w-full flex-col`,children:[(0,$.jsx)(Qe,{isMobile:f,mobileShowTree:E,panelRef:k,onPanelCollapse:()=>C(!0),onPanelExpand:()=>C(!1),fileTreePanel:(0,$.jsx)(`div`,{className:`flex h-full min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden`,children:(0,$.jsx)(ve,{treeData:H,files:m,error:g,selectedFileIndex:v,onFileSelect:A,onRevertFile:ce})}),diffEditorPanel:(0,$.jsx)(Xe,{threadId:e,selectedFile:U,selectedFileIndex:v,isImageFile:W,diffOriginal:G,diffModified:K,resolvedTheme:d,onEditorMount:Y,diffEditorOptions:me,isPanelCollapsed:S,showTreeBackButton:M,onShowTree:j,onTogglePanel:ie,isFullView:b,onToggleFullView:()=>x(e=>!e),comments:N,activeCommentIndex:I,onPrevComment:ue,onNextComment:de,onFixComments:fe,isChatOpen:w,onOpenChat:()=>T(!0),onCloseChat:()=>T(!1)})}),(0,$.jsx)(Te,{open:z!==null||B!==null,lineNumber:B?.lineNumber??z?.lineNumber??0,lineContent:B?.lineContent??z?.lineContent??``,initialComment:B?.comment,isEditing:B!==null,onSave:le,onDelete:X,onClose:()=>{ne(null),V(null)}},`${B?.id??``}-${z?.lineNumber??``}-${z?.side??``}`)]})}function tt(e){let t=(0,Q.c)(23),[n,r]=(0,Z.useState)(0),[i,a]=(0,Z.useState)(0),o=(0,Z.useRef)(0),s=!!e.cachedState,c;t[0]===e.threadId?c=t[1]:(c=()=>{r(t=>(B(De(e.threadId,t)),t+1)),a(rt)},t[0]=e.threadId,t[1]=c);let l=c,u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>{a(0),r(0),o.current=0},t[2]=u):u=t[2];let d;t[3]===e.threadId?d=t[4]:(d=[e.threadId],t[3]=e.threadId,t[4]=d),(0,Z.useEffect)(u,d);let f,p;t[5]!==e.refreshTrigger||t[6]!==e.threadId?(f=()=>{!e.refreshTrigger||e.refreshTrigger<=o.current||(o.current=e.refreshTrigger,r(t=>(B(De(e.threadId,t)),t+1)),a(nt))},p=[e.refreshTrigger,e.threadId],t[5]=e.refreshTrigger,t[6]=e.threadId,t[7]=f,t[8]=p):(f=t[7],p=t[8]),(0,Z.useEffect)(f,p);let m=`${e.threadId}:${i}`,h;t[9]!==l||t[10]!==s?(h=s?null:(0,$.jsx)(We,{onRetry:l}),t[9]=l,t[10]=s,t[11]=h):h=t[11];let g=`${e.threadId}:${n}`,_;t[12]!==n||t[13]!==e||t[14]!==g?(_=(0,$.jsx)(et,{...e,loadVersion:n},g),t[12]=n,t[13]=e,t[14]=g,t[15]=_):_=t[15];let v;t[16]!==h||t[17]!==_?(v=(0,$.jsx)(Z.Suspense,{fallback:h,children:_}),t[16]=h,t[17]=_,t[18]=v):v=t[18];let y;return t[19]!==l||t[20]!==m||t[21]!==v?(y=(0,$.jsx)(le,{fallbackTitle:`Failed to load review changes`,onRetry:l,children:v},m),t[19]=l,t[20]=m,t[21]=v,t[22]=y):y=t[22],y}function nt(e){return e+1}function rt(e){return e+1}export{tt as DiffView,tt as default};
@@ -0,0 +1 @@
1
+ function e(e){return e?Array.from(e.types).includes(`Files`):!1}function t(e){let t=Array.from(e.items??[]);if(t.length===0)return{files:Array.from(e.files),skippedFolders:0};let n=[],r=0;for(let e of t){if(e.kind!==`file`)continue;if(e.webkitGetAsEntry?.()?.isDirectory){r+=1;continue}let t=e.getAsFile();t&&n.push(t)}return{files:n,skippedFolders:r}}function n(e){return e?`the "${e}/" folder`:`the repository root`}function r(e){let t=e.slice(0,3).map(e=>`"${e.name}"`),n=e.length>3?` and ${e.length-3} more`:``;return`${t.join(`, `)}${n}`}export{e as i,r as n,t as r,n as t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Bc as t,Lc as n,Rc as r}from"./dialogs-config-C2KFQf9x.js";var i=r(),a=e(t(),1),o=n(),s=(0,a.createContext)(null);function c(e){let t=(0,i.c)(8),{children:n}=e,[r,c]=(0,a.useState)(null),[u,d]=(0,a.useState)(0),[f,p]=(0,a.useState)(null),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{d(l)},t[0]=m):m=t[0];let h=m,g;t[1]!==f||t[2]!==u||t[3]!==r?(g={pendingExplorerPath:r,setPendingExplorerPath:c,explorerRefreshTick:u,triggerExplorerRefresh:h,explorerClearPath:f,setExplorerClearPath:p},t[1]=f,t[2]=u,t[3]=r,t[4]=g):g=t[4];let _=g,v;return t[5]!==n||t[6]!==_?(v=(0,o.jsx)(s.Provider,{value:_,children:n}),t[5]=n,t[6]=_,t[7]=v):v=t[7],v}function l(e){return e+1}function u(){let e=(0,a.useContext)(s);if(!e)throw Error(`useExplorerTab must be used within an ExplorerTabProvider`);return e}export{u as n,c as t};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/explorer-tree-CcFgAYMn.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-BmpLvHah.js","assets/history-view-IcXfB6BD.js","assets/dialogs-config-C2KFQf9x.js","assets/onboarding-CFIVEI92.js","assets/explorer-tab-context-DCq1BBX_.js","assets/react-vendor-tSKmVA4e.js","assets/monaco-CMkNoWsM.js","assets/monaco-Br_kD0ds.css","assets/utils-Dt07QR3w.js","assets/index-r8I03VVW.css","assets/api-CtfZCd77.js","assets/explorer-file-drop-DaQtKkIj.js","assets/async-error-boundary-CaRNnJZe.js","assets/card-DFACZp3F.js","assets/context-menu-CBvTcHUI.js","assets/ui-components-Dd2afm0c.js","assets/explorer-view-DsNxf6nu.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Bc as t,Lc as n,a as r,ea as i,fo as a,ha as o,rc as s}from"./dialogs-config-C2KFQf9x.js";import{A as ee,D as c,F as l,O as u,P as d,Ut as f,_ as p,g as m,j as h,k as g,tr as _}from"./history-view-IcXfB6BD.js";import{n as v}from"./explorer-tab-context-DCq1BBX_.js";import{H as te,S as ne,b as y,x as re,y as b}from"./index-BmpLvHah.js";import{t as x}from"./async-error-boundary-CaRNnJZe.js";import{d as S}from"./api-CtfZCd77.js";import{i as C,n as w,r as ie,t as T}from"./explorer-file-drop-DaQtKkIj.js";var E=e(t(),1),D=n(),O=(0,E.lazy)(()=>_(()=>import(`./explorer-tree-CcFgAYMn.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]))),k=(0,E.lazy)(()=>_(()=>import(`./explorer-view-DsNxf6nu.js`),__vite__mapDeps([18,1,2,3,4,5,6,7,8,9,10,11,12,14,15])));function A(){let e=f(e=>e.selectedThreadId),t=ne(),[n,_]=(0,E.useState)(null),[A,j]=(0,E.useState)(!0),[M,N]=(0,E.useState)(null),[P,F]=(0,E.useState)(!1),[I,L]=(0,E.useState)(!1),R=(0,E.useRef)(0),{pendingExplorerPath:z,setPendingExplorerPath:B,explorerClearPath:V,setExplorerClearPath:H,triggerExplorerRefresh:U}=v();(0,E.useEffect)(()=>{function e(e){C(e.dataTransfer)&&e.preventDefault()}return window.addEventListener(`dragover`,e),window.addEventListener(`drop`,e),()=>{window.removeEventListener(`dragover`,e),window.removeEventListener(`drop`,e)}},[]),(0,E.useEffect)(()=>{j(!0)},[e]);let W=(0,E.useCallback)(e=>{_(e),t&&j(!1)},[t]),G=(0,E.useCallback)(()=>{j(!0)},[]),K=(0,E.useCallback)(e=>{_(e),t&&j(!1)},[t]);(0,E.useEffect)(()=>{z&&(_({name:z.split(`/`).pop()??z,path:z,type:`file`}),t&&j(!1),B(null))},[t,z,B]),(0,E.useEffect)(()=>{V&&(n&&(n.path===V||n.path.startsWith(V+`/`))&&(_(null),t&&j(!0)),H(null))},[V,t,n,H]);function q(){R.current=0,L(!1)}function J(e){C(e.dataTransfer)&&(R.current+=1,L(!0))}function ae(e){C(e.dataTransfer)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`)}function oe(e){C(e.dataTransfer)&&(R.current=Math.max(0,R.current-1),R.current===0&&L(!1))}function se(e){if(!C(e.dataTransfer))return;e.preventDefault(),q();let{files:t,skippedFolders:n}=ie(e.dataTransfer);n>0&&l({title:`Folders skipped`,description:`Only files can be copied. Drop individual files instead of folders.`}),t.length!==0&&N({files:t,dirPath:``})}let ce=(0,E.useCallback)((e,t)=>{R.current=0,L(!1),N({files:e,dirPath:t})},[]);async function le(){if(!(!M||!e||P)){F(!0);try{let t=await Promise.allSettled(M.files.map(t=>S(e,M.dirPath,t))),n=t.filter(e=>e.status===`rejected`),r=t.length-n.length;if(r>0&&U(),n.length===0)l({title:r===1?`File copied`:`Files copied`,description:`Copied ${w(M.files)} into ${T(M.dirPath)}.`});else{let e=n[0].reason;l({title:r>0?`Some files were not copied`:`Copy failed`,description:e instanceof Error?e.message:`Failed to copy the dropped file.`,variant:`destructive`})}}finally{F(!1),N(null)}}}let Y={onDragEnter:J,onDragOver:ae,onDragLeave:oe,onDrop:se},X=I?(0,D.jsx)(`div`,{className:`pointer-events-none absolute inset-0 z-50 flex items-center justify-center bg-background/70`,children:(0,D.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border-2 border-dashed border-primary bg-background px-6 py-4`,children:[(0,D.jsx)(o,{className:`h-4 w-4 text-primary`}),(0,D.jsx)(`span`,{className:s.label,children:`Drop files to copy them into the repository`})]})}):null,Z=(0,D.jsx)(r,{className:`h-full`,children:e?(0,D.jsx)(te,{threadId:e,children:(0,D.jsx)(x,{fallbackTitle:`Failed to load files`,children:(0,D.jsx)(E.Suspense,{fallback:(0,D.jsx)(p,{}),children:(0,D.jsx)(O,{threadId:e,selectedPath:n?.path??null,onNodeSelect:W,onFilesDrop:ce})})})}):(0,D.jsx)(`p`,{className:i(s.caption,`px-3 py-4 text-center`),children:`No thread selected.`})}),Q=(0,D.jsx)(E.Suspense,{fallback:(0,D.jsx)(m,{}),children:(0,D.jsx)(k,{selectedFile:n,showTreeBackButton:t&&!A,onShowTree:G,onFileCreated:K})}),$=(0,D.jsx)(c,{open:M!==null,onOpenChange:e=>{!e&&!P&&N(null)},children:(0,D.jsxs)(ee,{children:[(0,D.jsxs)(d,{children:[`Copy `,M&&M.files.length>1?`files`:`file`]}),(0,D.jsx)(h,{children:M?`Copy ${w(M.files)} into ${T(M.dirPath)}?`:null}),(0,D.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[(0,D.jsx)(g,{disabled:P,children:`Cancel`}),(0,D.jsxs)(u,{disabled:P,onClick:e=>{e.preventDefault(),le()},children:[P?(0,D.jsx)(a,{className:`h-4 w-4 animate-spin`}):null,`Copy`]})]})]})});return t?(0,D.jsxs)(`div`,{className:`relative flex h-full flex-col overflow-hidden`,...Y,children:[X,$,(0,D.jsx)(`div`,{className:i(`flex-1 min-h-0 overflow-hidden`,!A&&`hidden`),children:Z}),(0,D.jsx)(`div`,{className:i(`flex-1 min-h-0 overflow-hidden`,A&&`hidden`),children:Q})]}):(0,D.jsxs)(`div`,{className:`relative flex h-full flex-col overflow-hidden`,...Y,children:[X,$,(0,D.jsxs)(re,{direction:`horizontal`,className:`flex-1 overflow-hidden`,children:[(0,D.jsx)(y,{defaultSize:25,minSize:15,maxSize:50,className:`overflow-hidden border-r border-border`,children:Z}),(0,D.jsx)(b,{withHandle:!0}),(0,D.jsx)(y,{className:`overflow-hidden`,children:Q})]})]})}export{A as default};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Bc as t,La as n,Lc as r,Oo as i,Rc as a,c as o,cs as s,ea as c,jo as l,ko as u,rc as d,us as f}from"./dialogs-config-C2KFQf9x.js";import{A as p,D as m,F as h,O as g,P as _,_ as v,f as y,h as b,j as x,k as S,p as C}from"./history-view-IcXfB6BD.js";import{u as w}from"./onboarding-CFIVEI92.js";import{n as T}from"./explorer-tab-context-DCq1BBX_.js";import{I as ee,L as E,R as D,U as O,z as te}from"./index-BmpLvHah.js";import{a as k,i as A,n as j,r as M,t as N}from"./context-menu-CBvTcHUI.js";import{t as P}from"./async-error-boundary-CaRNnJZe.js";import{l as F,n as I,o as L,r as R,s as z,t as B}from"./api-CtfZCd77.js";import{i as V,r as ne}from"./explorer-file-drop-DaQtKkIj.js";import{t as H}from"./ui-components-Dd2afm0c.js";var U=a(),W=e(t(),1),G=r(),re=W.forwardRef((e,t)=>{let n=(0,U.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=c(`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,G.jsx)(H,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});re.displayName=H.displayName;var K=W.forwardRef((e,t)=>{let r=(0,U.c)(10),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]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,G.jsx)(n,{className:`mr-2 h-4 w-4 shrink-0 opacity-50`}),r[3]=o):o=r[3];let s;r[4]===i?s=r[5]:(s=c(`flex h-11 w-full rounded-md bg-transparent py-3 text-base outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),r[4]=i,r[5]=s);let l;return r[6]!==a||r[7]!==t||r[8]!==s?(l=(0,G.jsxs)(`div`,{className:`flex items-center border-b px-3`,"cmdk-input-wrapper":``,children:[o,(0,G.jsx)(H.Input,{ref:t,className:s,...a})]}),r[6]=a,r[7]=t,r[8]=s,r[9]=l):l=r[9],l});K.displayName=H.Input.displayName;var q=W.forwardRef((e,t)=>{let n=(0,U.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=c(`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,G.jsx)(H.List,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});q.displayName=H.List.displayName;var J=W.forwardRef((e,t)=>{let n=(0,U.c)(4),r;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=c(d.bodyMuted,`py-6 text-center`),n[0]=r):r=n[0];let i;return n[1]!==e||n[2]!==t?(i=(0,G.jsx)(H.Empty,{ref:t,className:r,...e}),n[1]=e,n[2]=t,n[3]=i):i=n[3],i});J.displayName=H.Empty.displayName;var Y=W.forwardRef((e,t)=>{let n=(0,U.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=c(`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,G.jsx)(H.Group,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Y.displayName=H.Group.displayName;var ie=W.forwardRef((e,t)=>{let n=(0,U.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=c(`-mx-1 h-px bg-divider`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(H.Separator,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ie.displayName=H.Separator.displayName;var ae=W.forwardRef((e,t)=>{let n=(0,U.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=c(c(d.body,`relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`),r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(H.Item,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ae.displayName=H.Item.displayName;var oe=e=>{let t=(0,U.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=c(d.compact,`ml-auto tracking-widest text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(`span`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};oe.displayName=`CommandShortcut`;var X=100,se=500;function Z(e){return e.trim().toLowerCase().split(/\s+/).filter(Boolean)}function ce(e,t){return t.length===0?!0:t.every(t=>e.haystack.includes(t))}function le(e,t,n){if(t.length===0)return[];let r=[];for(let n of e)if(ce(n,t)&&(r.push(n.node),r.length>=se))break;return r.sort((e,t)=>ue(e,t,n)).slice(0,X)}function ue(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 de(e){let t=(0,U.c)(38),{items:n,isReady:r,onRequestIndex:a,onOpenChange:s,onSelect:l}=e,u=r===void 0?!1:r,f=(0,W.useRef)(null),p=(0,W.useRef)(!1),m=(0,W.useRef)(!1),[h,g]=(0,W.useState)(!1),[_,v]=(0,W.useState)(``),y=(0,W.useDeferredValue)(_),b;t[0]===a?b=t[1]:(b=function(){m.current||(m.current=!0,a())},t[0]=a,t[1]=b);let x=b,S;t[2]!==y||t[3]!==n?(S=le(n,Z(y),y),t[2]=y,t[3]=n,t[4]=S):S=t[4];let C=S,w,T;t[5]!==s||t[6]!==_?(w=()=>{let e=_.trim().length>0;g(e),p.current!==e&&(p.current=e,s(e))},T=[s,_],t[5]=s,t[6]=_,t[7]=w,t[8]=T):(w=t[7],T=t[8]),(0,W.useEffect)(w,T);let O;t[9]===s?O=t[10]:(O=function(e){e||v(``),g(e),s(e),e&&requestAnimationFrame(()=>f.current?.focus())},t[9]=s,t[10]=O);let k=O,A;t[11]!==s||t[12]!==l?(A=function(e){l(e),g(!1),s(!1),v(``)},t[11]=s,t[12]=l,t[13]=A):A=t[13];let j=A,M;t[14]===x?M=t[15]:(M=e=>{x(),v(e.target.value)},t[14]=x,t[15]=M);let N;t[16]!==_||t[17]!==x||t[18]!==M?(N=(0,G.jsx)(te,{asChild:!0,children:(0,G.jsx)(`div`,{className:`bg-transparent`,children:(0,G.jsx)(o,{ref:f,value:_,onPointerDown:x,onChange:M,placeholder:`Search files and folders`,className:`pr-[4px]`})})}),t[16]=_,t[17]=x,t[18]=M,t[19]=N):N=t[19];let P;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(P=c(d.compact,`py-4`),t[20]=P):P=t[20];let F=u?`No matches found.`:`Indexing files and folders...`,I;t[21]===F?I=t[22]:(I=(0,G.jsx)(J,{className:P,children:F}),t[21]=F,t[22]=I);let L;if(t[23]!==j||t[24]!==C){let e;t[26]===j?e=t[27]:(e=e=>(0,G.jsxs)(ae,{value:e.path,onSelect:()=>j(e),className:e.ignored?`opacity-50`:void 0,children:[e.type===`folder`?(0,G.jsx)(i,{className:`h-4 w-4 text-muted-foreground`}):(0,G.jsx)(ee,{filename:e.name}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`truncate`,children:e.name}),(0,G.jsx)(`div`,{className:c(d.compact,`truncate text-muted-foreground`),children:e.path})]})]},e.path),t[26]=j,t[27]=e),L=C.map(e),t[23]=j,t[24]=C,t[25]=L}else L=t[25];let R;t[28]===L?R=t[29]:(R=(0,G.jsx)(Y,{children:L}),t[28]=L,t[29]=R);let z;t[30]!==I||t[31]!==R?(z=(0,G.jsx)(D,{align:`start`,side:`bottom`,sideOffset:4,onOpenAutoFocus:Q,className:`w-[var(--radix-popover-trigger-width)] p-0`,children:(0,G.jsx)(re,{shouldFilter:!1,children:(0,G.jsxs)(q,{children:[I,R]})})}),t[30]=I,t[31]=R,t[32]=z):z=t[32];let B;return t[33]!==k||t[34]!==h||t[35]!==z||t[36]!==N?(B=(0,G.jsxs)(E,{open:h,onOpenChange:k,children:[N,z]}),t[33]=k,t[34]=h,t[35]=z,t[36]=N,t[37]=B):B=t[37],B}function Q(e){return e.preventDefault()}function fe(e,t,n){return`explorer-dir:${e}:${t}:${n}`}function pe(e){let t=(0,U.c)(12),{threadId:n,dirPath:r,version:i,children:a}=e,o;t[0]!==r||t[1]!==n||t[2]!==i?(o=fe(n,r,i),t[0]=r,t[1]=n,t[2]=i,t[3]=o):o=t[3];let s;t[4]!==r||t[5]!==n?(s=()=>L(n,r).then(me),t[4]=r,t[5]=n,t[6]=s):s=t[6];let c=y(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,G.jsx)(G.Fragment,{children:l}),t[10]=l,t[11]=u),u}function me(e){return e.entries}function he(e){let t=(0,U.c)(17),{defaultValue:n,onCommit:r,onCancel:i,level:a,basePadding:o,icon:s}=e,c=(0,W.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,W.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,G.jsx)(`input`,{ref:c,defaultValue:n,onKeyDown:f,onBlur:m,className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`,onClick:$}),t[8]=n,t[9]=m,t[10]=f,t[11]=h):h=t[11];let g;return t[12]!==o||t[13]!==s||t[14]!==a||t[15]!==h?(g=(0,G.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 $(e){return e.stopPropagation()}function ge(e){return e.map(e=>({node:e,haystack:`${e.name} ${e.path}`.toLowerCase()}))}function _e(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(0,t):``}var ve=(0,W.memo)(function e({node:t,level:n,threadId:r,selectedPath:a,expandedPaths:o,getDirVersion:d,renamingPath:p,newItemIn:m,onToggleFolder:g,onSelectNode:_,onStartRename:v,onCommitRename:y,onCancelRename:x,onDelete:S,onOpen:C,onCopyReference:T,onNewFile:E,onNewFolder:D,onCommitNewItem:O,onCancelNewItem:te,dropTargetPath:P,onFolderDropTargetChange:F,onFilesDrop:I}){let L=o.has(t.path),R=p===t.path,z=m?.dirPath===t.path&&L,B=P===t.path;return t.type===`folder`?(0,G.jsxs)(N,{children:[(0,G.jsx)(k,{asChild:!0,children:(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(w,{level:n,basePadding:10,selected:a===t.path,className:c(t.ignored&&`opacity-50`,B&&`bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-primary`),onClick:e=>{e.stopPropagation(),g(t)},onDragOver:e=>{V(e.dataTransfer)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`copy`,B||F(t.path))},onDragLeave:e=>{V(e.dataTransfer)&&(e.currentTarget.contains(e.relatedTarget)||B&&F(null))},onDrop:e=>{if(!V(e.dataTransfer))return;e.preventDefault(),e.stopPropagation(),F(null);let{files:n,skippedFolders:r}=ne(e.dataTransfer);r>0&&h({title:`Folders skipped`,description:`Only files can be copied. Drop individual files instead of folders.`}),n.length>0&&I(n,t.path)},children:[(0,G.jsx)(`span`,{className:`text-muted-foreground w-3 flex-shrink-0`,children:L?(0,G.jsx)(f,{className:`h-3 w-3`}):(0,G.jsx)(s,{className:`h-3 w-3`})}),R?(0,G.jsxs)(G.Fragment,{children:[L?(0,G.jsx)(u,{className:`h-4 w-4 flex-shrink-0`}):(0,G.jsx)(i,{className:`h-4 w-4 flex-shrink-0`}),(0,G.jsx)(`input`,{autoFocus:!0,defaultValue:t.name,onKeyDown:e=>{if(e.key===`Enter`){let n=e.target.value.trim();n?y(t,n):x()}else e.key===`Escape`&&x()},onBlur:e=>{let n=e.target.value.trim();n?y(t,n):x()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`})]}):(0,G.jsxs)(G.Fragment,{children:[L?(0,G.jsx)(u,{className:`h-4 w-4 flex-shrink-0`}):(0,G.jsx)(i,{className:`h-4 w-4 flex-shrink-0`}),(0,G.jsx)(`span`,{className:`flex-1 truncate`,children:t.name})]})]}),L&&(0,G.jsx)(`div`,{children:(0,G.jsx)(W.Suspense,{fallback:(0,G.jsx)(b,{}),children:(0,G.jsx)(pe,{threadId:r,dirPath:t.path,version:d(t.path),children:t=>(0,G.jsxs)(G.Fragment,{children:[z&&(0,G.jsx)(he,{defaultValue:``,level:n+1,basePadding:m.type===`folder`?10:22,icon:m.type===`folder`?(0,G.jsx)(i,{className:`h-4 w-4 flex-shrink-0`}):(0,G.jsx)(l,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:O,onCancel:te}),t.map(t=>(0,G.jsx)(e,{node:t,level:n+1,threadId:r,selectedPath:a,expandedPaths:o,getDirVersion:d,renamingPath:p,newItemIn:m,onToggleFolder:g,onSelectNode:_,onStartRename:v,onCommitRename:y,onCancelRename:x,onDelete:S,onOpen:C,onCopyReference:T,onNewFile:E,onNewFolder:D,onCommitNewItem:O,onCancelNewItem:te,dropTargetPath:P,onFolderDropTargetChange:F,onFilesDrop:I},t.path))]})})})})]})}),(0,G.jsxs)(j,{children:[(0,G.jsx)(M,{onSelect:()=>C(t),children:`Open`}),(0,G.jsx)(A,{}),(0,G.jsx)(M,{onSelect:()=>E(t.path),children:`New File...`}),(0,G.jsx)(M,{onSelect:()=>D(t.path),children:`New Folder...`}),(0,G.jsx)(A,{}),(0,G.jsx)(M,{onSelect:()=>T(t),children:`Copy Reference`}),(0,G.jsx)(M,{onSelect:()=>v(t),children:`Rename...`}),(0,G.jsx)(M,{onSelect:()=>S(t),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]}):(0,G.jsxs)(N,{children:[(0,G.jsx)(k,{asChild:!0,children:(0,G.jsxs)(w,{level:n,basePadding:22,selected:a===t.path,className:t.ignored?`opacity-50`:void 0,onClick:()=>_(t),children:[(0,G.jsx)(ee,{filename:t.name}),R?(0,G.jsx)(`input`,{autoFocus:!0,defaultValue:t.name,onKeyDown:e=>{if(e.key===`Enter`){let n=e.target.value.trim();n?y(t,n):x()}else e.key===`Escape`&&x()},onBlur:e=>{let n=e.target.value.trim();n?y(t,n):x()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`}):(0,G.jsx)(`span`,{className:`flex-1 truncate`,children:t.name})]})}),(0,G.jsxs)(j,{children:[(0,G.jsx)(M,{onSelect:()=>C(t),children:`Open`}),(0,G.jsx)(A,{}),(0,G.jsx)(M,{onSelect:()=>E(_e(t.path)),children:`New File...`}),(0,G.jsx)(M,{onSelect:()=>D(_e(t.path)),children:`New Folder...`}),(0,G.jsx)(A,{}),(0,G.jsx)(M,{onSelect:()=>T(t),children:`Copy Reference`}),(0,G.jsx)(M,{onSelect:()=>v(t),children:`Rename...`}),(0,G.jsx)(M,{onSelect:()=>S(t),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]})}),ye=new Map;function be({threadId:e,selectedPath:t,onNodeSelect:n,onFilesDrop:r}){let[a,o]=(0,W.useState)(()=>new Map([[``,0]])),[s,c]=(0,W.useState)(new Set),[u,d]=(0,W.useState)(null),[f,y]=(0,W.useState)(null),[b,w]=(0,W.useState)(null),[ee,E]=(0,W.useState)(null),[D,te]=(0,W.useState)(!1),[A,V]=(0,W.useState)([]),[ne,H]=(0,W.useState)(!1),[U,re]=(0,W.useState)(!1),K=(0,W.useRef)(null),q=(0,W.useRef)(0),J=(0,W.useRef)(null),{explorerRefreshTick:Y,pendingExplorerPath:ie,setExplorerClearPath:ae}=T(),{fetchUnifiedStatus:oe}=O(),X=(0,W.useMemo)(()=>`${e}:${Y}`,[Y,e]),se=(0,W.useCallback)(e=>{(0,W.startTransition)(()=>{te(t=>t===e?t:e)})},[]),Z=(0,W.useCallback)(async()=>{if(!e)return;let t=ye.get(X);if(t){V(t),H(!0);return}if(K.current!==X){K.current=X,V([]),H(!1);try{let t=ge((await L(e,``,!0)).entries);ye.set(X,t),V(t),H(!0)}catch{V([]),H(!1)}finally{K.current===X&&(K.current=null)}}},[X,e]),ce=(0,W.useCallback)(()=>{re(!0)},[]),le=(0,W.useCallback)(()=>{ye.delete(X),V([]),H(!1)},[X]),ue=(0,W.useCallback)(()=>{le(),U&&Z()},[le,Z,U]),Q=(0,W.useCallback)(e=>a.get(e)??0,[a]),me=(0,W.useCallback)(e=>{o(t=>{let n=new Map(t);return n.set(e,(t.get(e)??0)+1),n})},[]),$=(0,W.useCallback)(t=>{e&&(C(fe(e,t,Q(t))),me(t))},[me,Q,e]),be=(0,W.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,W.useEffect)(()=>{if(!e)return;let t=J.current!==null&&J.current!==e;J.current=e,t&&(o(new Map([[``,0]])),c(new Set),d(null),y(null),q.current=Y)},[Y,e]),(0,W.useEffect)(()=>{!e||Y<=q.current||(q.current=Y,o(t=>{let n=new Set([``]);for(let e of s)n.add(e);let r=new Map(t);for(let i of n){let n=t.get(i)??0;C(fe(e,i,n)),r.set(i,n+1)}return r}))},[Y,s,e]),(0,W.useEffect)(()=>{V([]),H(!1),re(!1),K.current=null},[X]),(0,W.useEffect)(()=>{!U||!e||Z()},[Z,U,e]),(0,W.useEffect)(()=>{if(!ie||!e)return;let t=ie.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})}},[ie,e]);function xe(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 Se(e){w(e)}async function Ce(t){try{await z(e,t.path)}catch{h({title:`Error`,description:`Failed to open "${t.name}"`,variant:`destructive`})}}async function we(e){try{await navigator.clipboard.writeText(e.path);let t=h({title:`Copied`,description:`Reference copied to clipboard.`});window.setTimeout(()=>{t.dismiss()},2e3)}catch{h({title:`Error`,description:`Failed to copy reference for "${e.name}"`,variant:`destructive`})}}async function Te(){if(!b)return;let t=b;w(null);try{await R(e,t.path),ae(t.path),$(_e(t.path)),ue(),oe(!0),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{h({title:`Error`,description:`Failed to move "${t.name}" to trash`,variant:`destructive`})}}function Ee(e){y(null),d(e.path)}async function De(t,n){if(n===t.name){d(null);return}d(null);try{await F(e,t.path,n),$(_e(t.path)),ue(),oe(!0),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{h({title:`Error`,description:`Failed to rename "${t.name}"`,variant:`destructive`})}}function Oe(e){d(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})),y({dirPath:e,type:`file`})}function ke(e){d(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})),y({dirPath:e,type:`folder`})}async function Ae(t){if(!f)return;let{dirPath:n,type:r}=f;y(null);try{r===`file`?await B(e,n,t):await I(e,n,t),$(n),ue(),oe(!0)}catch{h({title:`Error`,description:`Failed to create ${r} "${t}"`,variant:`destructive`})}}function je(){y(null)}let Me=(0,W.useCallback)((e,t)=>{r?.(e,t)},[r]);function Ne(e){be(e),e.type===`file`&&n(e)}let Pe=f?.dirPath===``?(0,G.jsx)(he,{defaultValue:``,level:0,basePadding:f.type===`folder`?10:22,icon:f.type===`folder`?(0,G.jsx)(i,{className:`h-4 w-4 flex-shrink-0`}):(0,G.jsx)(l,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:Ae,onCancel:je}):null;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(m,{open:b!==null,onOpenChange:e=>!e&&w(null),children:(0,G.jsxs)(p,{children:[(0,G.jsx)(_,{children:`Move to Trash`}),(0,G.jsxs)(x,{children:[`Move “`,b?.name,`” to trash?`]}),(0,G.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[(0,G.jsx)(S,{children:`Cancel`}),(0,G.jsx)(g,{onClick:()=>void Te(),children:`Move to Trash`})]})]})}),(0,G.jsx)(`div`,{className:`border-b border-border px-2 py-2`,children:(0,G.jsx)(`div`,{className:`flex items-center gap-1`,children:(0,G.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,G.jsx)(de,{items:A,isReady:ne,onRequestIndex:ce,onOpenChange:se,onSelect:e=>Ne(e)},X)})})}),(0,G.jsxs)(N,{children:[(0,G.jsx)(k,{asChild:!0,disabled:D,children:(0,G.jsx)(`div`,{className:`py-2 min-h-full`,children:(0,G.jsx)(P,{fallbackTitle:`Failed to load files`,onRetry:()=>$(``),children:(0,G.jsx)(W.Suspense,{fallback:(0,G.jsx)(v,{}),children:(0,G.jsx)(pe,{threadId:e,dirPath:``,version:Q(``),children:r=>(0,G.jsxs)(G.Fragment,{children:[Pe,r.map(r=>(0,G.jsx)(ve,{node:r,level:0,threadId:e,selectedPath:t,expandedPaths:s,getDirVersion:Q,renamingPath:u,newItemIn:f,onToggleFolder:xe,onSelectNode:n,onStartRename:Ee,onCommitRename:De,onCancelRename:()=>d(null),onDelete:Se,onOpen:Ce,onCopyReference:we,onNewFile:Oe,onNewFolder:ke,onCommitNewItem:Ae,onCancelNewItem:je,dropTargetPath:ee,onFolderDropTargetChange:E,onFilesDrop:Me},r.path))]})})})})})}),(0,G.jsxs)(j,{children:[(0,G.jsx)(M,{onSelect:()=>Oe(``),children:`New File...`}),(0,G.jsx)(M,{onSelect:()=>ke(``),children:`New Folder...`})]})]})]})}export{be as default};
@@ -0,0 +1,75 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$a as t,Bc as n,Ga as r,Gt as i,Ho as a,Js as o,Lc as s,No as c,Po as l,Qi as u,Rc as d,ds as ee,ea as f,es as te,fo as p,ks as m,li as ne,qa as re,qs as h,rc as g}from"./dialogs-config-C2KFQf9x.js";import{m as _}from"./react-vendor-tSKmVA4e.js";import{B as v,Bt as y,F as b,J as ie,R as ae,Ut as oe,V as se,f as x,g as S,p as C}from"./history-view-IcXfB6BD.js";import{n as w}from"./explorer-tab-context-DCq1BBX_.js";import{n as ce}from"./utils-Dt07QR3w.js";import{G as le,W as ue}from"./index-BmpLvHah.js";import{t as T}from"./async-error-boundary-CaRNnJZe.js";import{a as E,c as de,i as D,o as O,s as fe,t as pe,u as me}from"./api-CtfZCd77.js";var k=d(),A=s(),j=e(n(),1),M=y(e=>(0,A.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center`,children:[e.v0,(0,A.jsx)(`p`,{className:e.v1,children:`Select a thread to browse its files`})]}),{name:`ExplorerView_1`,portals:[`v0`]}),N=y(e=>(0,A.jsxs)(`div`,{className:`explorer-view-root flex flex-col h-full print:block print:h-auto`,children:[e.v0,(0,A.jsx)(`div`,{className:`flex-1 overflow-hidden print:overflow-visible print:flex-none`,children:(0,A.jsx)(`div`,{className:`h-full relative overflow-hidden print:h-auto print:overflow-visible`,children:e.v1})}),e.v2]}),{name:`ExplorerView_2`,portals:[`v0`,`v1`,`v2`]}),P=function({selectedFile:e,showTreeBackButton:n=!1,onShowTree:a,onFileCreated:o}){let{resolvedTheme:s}=ce(),c=oe(e=>e.selectedThreadId),{triggerExplorerRefresh:d}=w(),m=(0,j.useRef)(null),y=(0,j.useRef)(null),x=(0,j.useRef)(!1),[E,D]=(0,j.useState)(null),[O,k]=(0,j.useState)(!1),[P,F]=(0,j.useState)(!1),[U,W]=(0,j.useState)(`edit`),[ve,ye]=(0,j.useState)(0),[G,be]=(0,j.useState)(null),[K,q]=(0,j.useState)(!1),xe=e?.path??null;(0,j.useEffect)(()=>{c&&i(c).then(be).catch(()=>{})},[c]);let Se=async()=>{if(!(!G||K)){q(!0);try{await navigator.clipboard.writeText(G),b({title:`Copied`,description:`Repository folder path copied to clipboard.`})}catch(e){V(`Failed to copy explorer folder path`,{threadId:c,folderPath:G},e),b({title:`Error`,description:`Failed to copy path to clipboard.`,variant:`destructive`})}finally{q(!1)}}},Ce=async()=>{if(c)try{await fe(c,`.`)}catch(e){V(`Failed to open explorer repository folder`,{threadId:c,folderPath:G},e),b({title:`Error`,description:`Failed to open repository folder.`,variant:`destructive`})}},we=(0,j.useCallback)(async e=>{if(c)try{let t=await L(c,e);await pe(c,``,t);let n={name:t,path:t,type:`file`};y.current=t,x.current=!0,o?.(n),d(),b({title:`Created`,description:`${t} created successfully.`})}catch(t){V(`Failed to create explorer file`,{threadId:c,extension:e},t),b({title:`Error`,description:`Failed to create file.`,variant:`destructive`})}},[c,o,d]),J=e?h(e.path,e.name):null,Y=e?.type===`file`&&c&&!J?e:null,X=Y?`${c}:${Y.path}:${ve}`:null,Z=E&&E.key===X?E:null,Q=Z?.content??``,Te=Z?.original??``;(0,j.useEffect)(()=>()=>{m.current&&=(m.current.getModel()?.dispose(),m.current.dispose(),null)},[]),(0,j.useEffect)(()=>{e?.type===`file`?y.current===e.path?(y.current=null,W(`edit`)):W(R(e.path)?`view`:`edit`):W(`edit`)},[xe,c]);async function $(){if(!(!c||!e||!X)){k(!0);try{await me(c,e.path,Q),D({key:X,content:Q,original:Q}),b({title:`Saved`,description:`${e.name} saved successfully.`})}catch(t){V(`Failed to save explorer file`,{threadId:c,path:e.path},t),b({title:`Error`,description:t instanceof Error?t.message:`Failed to save file`,variant:`destructive`})}finally{k(!1)}}}async function Ee(){if(!(!c||!e||P)){F(!0);try{if(!ne()){if(typeof window>`u`)return;let t=document.querySelector(`[data-markdown-print-content]`);if(!(t instanceof HTMLElement)){b({title:`Print unavailable`,description:`Couldn't find the markdown preview to print.`,variant:`destructive`});return}let n=`<!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <title>${e.name??`Markdown document`}</title>
7
+ <style>
8
+ :root {
9
+ color-scheme: light;
10
+ font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
11
+ line-height: 1.5;
12
+ }
13
+ * {
14
+ box-sizing: border-box;
15
+ }
16
+ body {
17
+ margin: 0;
18
+ background: white;
19
+ color: black;
20
+ }
21
+ .markdown-print-shell {
22
+ max-width: 900px;
23
+ margin: 0 auto;
24
+ padding: 32px;
25
+ }
26
+ img, video, svg {
27
+ max-width: 100%;
28
+ height: auto;
29
+ }
30
+ pre {
31
+ white-space: pre-wrap;
32
+ overflow-wrap: anywhere;
33
+ border: 1px solid #d4d4d8;
34
+ border-radius: 8px;
35
+ padding: 12px;
36
+ background: #f4f4f5;
37
+ }
38
+ code {
39
+ white-space: pre-wrap;
40
+ overflow-wrap: anywhere;
41
+ }
42
+ table {
43
+ width: 100%;
44
+ border-collapse: collapse;
45
+ }
46
+ th, td {
47
+ border: 1px solid #d4d4d8;
48
+ padding: 8px;
49
+ text-align: left;
50
+ }
51
+ @page {
52
+ margin: 0.75in;
53
+ }
54
+ @media print {
55
+ body {
56
+ -webkit-print-color-adjust: exact;
57
+ print-color-adjust: exact;
58
+ }
59
+ .markdown-print-shell {
60
+ max-width: none;
61
+ padding: 0;
62
+ }
63
+ }
64
+ </style>
65
+ </head>
66
+ <body>
67
+ <main class="markdown-print-shell">${t.innerHTML}</main>
68
+ <script>
69
+ window.addEventListener("load", () => {
70
+ window.focus();
71
+ window.print();
72
+ }, { once: true });
73
+ <\/script>
74
+ </body>
75
+ </html>`,r=window.open(``,`_blank`,`noopener,noreferrer`);if(!r){b({title:`Print blocked`,description:`Allow pop-ups to print this file.`,variant:`destructive`});return}r.document.open(),r.document.write(n),r.document.close();return}b({title:`PDF created`,description:`Opened ${(await de(c,e.path)).outputPath.split(/[\\/]/).pop()??`the PDF`} in your default app.`})}catch(t){V(`Failed to print markdown file as PDF`,{threadId:c,path:e.path},t),b({title:`PDF export failed`,description:t instanceof Error?t.message:`Failed to convert this markdown file to PDF.`,variant:`destructive`})}finally{F(!1)}}}function De(){!c||!Y||(C(B(c,Y.path)),ye(e=>e+1))}return c?(0,A.jsx)(N,{v0:(0,A.jsxs)(le,{className:`justify-between print:hidden`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[n&&a?(0,A.jsxs)(u,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0 text-muted-foreground electrobun-webkit-app-region-no-drag`,onClick:a,children:[(0,A.jsx)(t,{className:`h-4 w-4`}),(0,A.jsx)(`span`,{className:`sr-only`,children:`Show file tree`})]}):null,(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,A.jsx)(`span`,{className:f(g.label,`truncate text-foreground`),children:e?e.name:`Select a file to edit`}),(0,A.jsx)(`span`,{className:f(g.compact,`truncate text-muted-foreground`),children:e?e.path:`Browse and edit repository files`})]})]}),(0,A.jsxs)(`div`,{className:`flex gap-2`,children:[Y&&Z?(0,A.jsxs)(A.Fragment,{children:[R(Y.path)?(0,A.jsxs)(`div`,{className:`flex rounded-full border border-input bg-background p-0.5`,children:[(0,A.jsx)(u,{size:`sm`,variant:U===`view`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>W(`view`),children:`View`}),(0,A.jsx)(u,{size:`sm`,variant:U===`edit`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>W(`edit`),children:`Edit`})]}):null,R(Y.path)&&U===`view`?(0,A.jsxs)(u,{size:`sm`,variant:`outline`,onClick:()=>void Ee(),disabled:P,children:[P?(0,A.jsx)(p,{className:`h-4 w-4 animate-spin`}):(0,A.jsx)(r,{className:`h-4 w-4`}),P?`Printing…`:`Print`]}):null,(0,A.jsxs)(u,{size:`sm`,onClick:()=>void $(),disabled:O||!Q||Q===Te,children:[O?(0,A.jsx)(p,{className:`h-4 w-4 animate-spin`}):null,`Save`]})]}):null,e?null:(0,A.jsxs)(ae,{children:[(0,A.jsx)(ie,{asChild:!0,children:(0,A.jsxs)(u,{size:`sm`,className:`gap-1.5`,children:[(0,A.jsx)(re,{className:`h-3.5 w-3.5`}),`New file`]})}),(0,A.jsx)(v,{align:`end`,children:I.map(({label:e,ext:t,icon:n})=>(0,A.jsxs)(se,{onSelect:()=>void we(t),children:[(0,A.jsx)(n,{className:`h-4 w-4`}),e]},t))})]})]})]}),v1:Y?(0,A.jsxs)(T,{fallbackTitle:`Failed to load file`,onRetry:De,children:[(0,A.jsx)(j.Suspense,{fallback:(0,A.jsx)(S,{}),children:(0,A.jsx)(he,{threadId:c,path:Y.path,contentKey:X??``,onContentReady:D},X??void 0)}),Z?R(Y.path)&&U===`view`?(0,A.jsx)(`div`,{className:`h-full overflow-auto p-6 print:h-auto print:overflow-visible print:p-0`,children:(0,A.jsx)(`div`,{className:`mx-auto max-w-4xl print:max-w-none`,"data-markdown-print-content":!0,children:(0,A.jsx)(ue,{content:Q,enableMermaid:!0})})}):(0,A.jsx)(_,{height:`100%`,language:z(Y.path),value:Q,onChange:e=>D(t=>t&&{...t,content:e??``}),onMount:e=>{m.current=e,x.current&&(x.current=!1,e.focus())},theme:s===`dark`?`vs-dark`:`vs-light`,options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:`on`,automaticLayout:!0,fontSize:14,lineNumbers:`on`,renderLineHighlight:`line`,scrollbar:{vertical:`auto`,horizontal:`auto`}}}):(0,A.jsx)(S,{})]},X??void 0):e?.type===`file`&&J===`image`?(0,A.jsx)(T,{fallbackTitle:`Failed to load image`,onRetry:()=>{!c||!e||C(H(c,e.path))},children:(0,A.jsx)(j.Suspense,{fallback:(0,A.jsx)(S,{}),children:(0,A.jsx)(ge,{threadId:c,path:e.path,alt:e.name})})},e.path):e?.type===`file`&&J===`video`?(0,A.jsx)(T,{fallbackTitle:`Failed to load video`,onRetry:()=>{!c||!e||C(H(c,e.path))},children:(0,A.jsx)(j.Suspense,{fallback:(0,A.jsx)(S,{}),children:(0,A.jsx)(_e,{threadId:c,path:e.path})})},e.path):(0,A.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center p-8`,children:[(0,A.jsx)(`h2`,{className:f(g.pageTitle,`text-foreground`),children:`File Explorer`}),(0,A.jsx)(`p`,{className:f(g.pageSubtitle),children:`Browse and edit files`})]}),v2:e?null:(0,A.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 px-4 py-2`,children:G?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`button`,{type:`button`,onClick:()=>void Ce(),className:f(g.compact,`min-w-0 flex-1 truncate text-left font-mono text-muted-foreground hover:text-foreground hover:underline`),title:G,children:G}),(0,A.jsxs)(u,{variant:`ghost`,size:`icon`,className:`h-7 w-7 shrink-0`,onClick:()=>void Se(),disabled:K,children:[K?(0,A.jsx)(ee,{className:`h-3.5 w-3.5`}):(0,A.jsx)(te,{className:`h-3.5 w-3.5`}),(0,A.jsx)(`span`,{className:`sr-only`,children:`Copy path`})]})]}):(0,A.jsx)(`p`,{className:f(g.compact,`text-muted-foreground/50 italic`),children:`Loading path...`})})}):(0,A.jsx)(M,{v0:(0,A.jsx)(l,{className:`h-8 w-8 text-muted-foreground`}),v1:g.bodyMuted})},F=m(`explorer.preview`),I=[{label:`Markdown`,ext:`md`,icon:l},{label:`TypeScript`,ext:`ts`,icon:a},{label:`Text`,ext:`txt`,icon:c}];async function L(e,t){try{let n=await O(e,``),r=new Set(n.entries.map(e=>e.name)),i=`untitled`,a=`${i}.${t}`,o=2;for(;r.has(a);)a=`${i}${o}.${t}`,o++;return a}catch{return`untitled.${t}`}}function R(e){return o(e)===`md`}function z(e){return{ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,md:`markdown`,mdc:`markdown`,css:`css`,scss:`scss`,html:`html`,py:`python`,sh:`shell`,yaml:`yaml`,yml:`yaml`,xml:`xml`,sql:`sql`}[o(e)]??`plaintext`}function B(e,t){return`explorer-file:${e}:${t}`}function he(e){let t=(0,k.c)(11),{threadId:n,path:r,contentKey:i,onContentReady:a}=e,o;t[0]!==r||t[1]!==n?(o=B(n,r),t[0]=r,t[1]=n,t[2]=o):o=t[2];let s;t[3]!==r||t[4]!==n?(s=async()=>{try{return await E(n,r)}catch(e){let t=e;throw V(`Failed to load explorer file preview`,{threadId:n,path:r},t),t}},t[3]=r,t[4]=n,t[5]=s):s=t[5];let c=x(o,s),l,u;return t[6]!==i||t[7]!==a||t[8]!==c.content?(l=()=>{a({key:i,content:c.content,original:c.content})},u=[a,c.content,i],t[6]=i,t[7]=a,t[8]=c.content,t[9]=l,t[10]=u):(l=t[9],u=t[10]),(0,j.useLayoutEffect)(l,u),null}function V(e,t,n){F.error(e,{...t,error:n})}function H(e,t){return`explorer-media:${e}:${t}`}function U(e,t){let n=(0,k.c)(11),r;n[0]!==t||n[1]!==e?(r=H(e,t),n[0]=t,n[1]=e,n[2]=r):r=n[2];let i;n[3]!==t||n[4]!==e?(i=async()=>{try{return await D(e,t)}catch(n){let r=n;throw V(`Failed to load explorer media preview`,{threadId:e,path:t},r),r}},n[3]=t,n[4]=e,n[5]=i):i=n[5];let a=x(r,i),o;n[6]===a?o=n[7]:(o=URL.createObjectURL(a),n[6]=a,n[7]=o);let s=o,c,l;return n[8]===s?(c=n[9],l=n[10]):(c=()=>()=>{URL.revokeObjectURL(s)},l=[s],n[8]=s,n[9]=c,n[10]=l),(0,j.useEffect)(c,l),s}function ge(e){let t=(0,k.c)(3),{threadId:n,path:r,alt:i}=e,a=U(n,r),o;return t[0]!==i||t[1]!==a?(o=(0,A.jsx)(`div`,{className:`flex items-center justify-center h-full p-4 overflow-auto`,children:(0,A.jsx)(`img`,{src:a,alt:i,className:`max-w-full max-h-full object-contain`})}),t[0]=i,t[1]=a,t[2]=o):o=t[2],o}function _e(e){let t=(0,k.c)(2),{threadId:n,path:r}=e,i=U(n,r),a;return t[0]===i?a=t[1]:(a=(0,A.jsx)(`div`,{className:`flex items-center justify-center h-full p-4`,children:(0,A.jsx)(`video`,{src:i,controls:!0,className:`max-w-full max-h-full`})}),t[0]=i,t[1]=a),a}export{P as default};
@@ -0,0 +1 @@
1
+ import{Lc as e,Qi as t,Rc as n,ea as r,f as i,fo as a,g as o,h as s,m as c,p as l,rc as u,u as d}from"./dialogs-config-C2KFQf9x.js";var f=n(),p=e();function m(e){let n=(0,f.c)(28),{open:m,onOpenChange:g,commits:_,displayedCommits:v,isLoadingMore:y,onScroll:b,currentBranch:x}=e,S;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,p.jsx)(o,{children:`Commit History`}),n[0]=S):S=n[0];let C;n[1]===x?C=n[2]:(C=(0,p.jsxs)(s,{children:[S,(0,p.jsxs)(l,{children:[`Recent commits on branch `,x]})]}),n[1]=x,n[2]=C);let w;n[3]===v?w=n[4]:(w=v.length>0?v.map(h):(0,p.jsx)(`p`,{className:r(u.bodyMuted,`text-center py-8`),children:`No commits found`}),n[3]=v,n[4]=w);let T;n[5]===y?T=n[6]:(T=y&&(0,p.jsx)(`div`,{className:`p-3 text-center`,children:(0,p.jsx)(a,{className:`h-4 w-4 animate-spin inline`})}),n[5]=y,n[6]=T);let E;n[7]!==_.length||n[8]!==v.length||n[9]!==y?(E=v.length<_.length&&!y&&(0,p.jsx)(`div`,{className:r(u.caption,`p-3 text-center`),children:`Scroll to load more`}),n[7]=_.length,n[8]=v.length,n[9]=y,n[10]=E):E=n[10];let D;n[11]!==w||n[12]!==T||n[13]!==E?(D=(0,p.jsxs)(`div`,{className:`divide-y`,children:[w,T,E]}),n[11]=w,n[12]=T,n[13]=E,n[14]=D):D=n[14];let O;n[15]!==b||n[16]!==D?(O=(0,p.jsx)(`div`,{className:`flex-1 overflow-y-auto border rounded-lg`,onScroll:b,children:D}),n[15]=b,n[16]=D,n[17]=O):O=n[17];let k;n[18]===g?k=n[19]:(k=(0,p.jsx)(c,{children:(0,p.jsx)(t,{onClick:()=>g(!1),children:`Close`})}),n[18]=g,n[19]=k);let A;n[20]!==C||n[21]!==O||n[22]!==k?(A=(0,p.jsxs)(i,{className:`max-w-2xl max-h-[80vh] flex flex-col`,children:[C,O,k]}),n[20]=C,n[21]=O,n[22]=k,n[23]=A):A=n[23];let j;return n[24]!==g||n[25]!==m||n[26]!==A?(j=(0,p.jsx)(d,{open:m,onOpenChange:g,children:A}),n[24]=g,n[25]=m,n[26]=A,n[27]=j):j=n[27],j}function h(e){return(0,p.jsxs)(`div`,{className:`p-3 hover:bg-muted/50 transition-colors`,children:[(0,p.jsx)(`p`,{className:r(u.label,`break-words`),children:e.message}),(0,p.jsxs)(`p`,{className:r(u.bodyMuted,`mt-1`),children:[(0,p.jsx)(`span`,{className:u.mono,children:e.hash.substring(0,7)}),` •`,` `,e.author,` • `,new Date(e.date).toLocaleDateString()]})]},e.hash)}export{m as GitHistoryDialog};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/commit-dialog-Ck0r2v9S.js","assets/index-BmpLvHah.js","assets/rolldown-runtime-aKtaBQYM.js","assets/history-view-IcXfB6BD.js","assets/dialogs-config-C2KFQf9x.js","assets/onboarding-CFIVEI92.js","assets/explorer-tab-context-DCq1BBX_.js","assets/react-vendor-tSKmVA4e.js","assets/monaco-CMkNoWsM.js","assets/monaco-Br_kD0ds.css","assets/utils-Dt07QR3w.js","assets/index-r8I03VVW.css","assets/pull-request-dialog-DVYZgMuN.js","assets/create-repo-dialog-CBvRaov7.js","assets/git-history-dialog--akFTQOd.js","assets/push-before-pr-dialog-DoNMB3C8.js","assets/pull-with-changes-dialog-CHHJ0gpA.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Bc as t,Dn as n,Do as r,Fr as i,Gr as a,Jo as o,Jr as s,Kr as c,Lc as l,Lr as u,Nr as d,Pr as f,Qi as p,Rc as m,To as h,Ua as g,Ur as _,Vr as v,Wr as y,Xo as ee,_c as te,_r as b,bo as ne,cn as re,ea as x,fo as S,gs as C,ha as w,ks as T,qt as E,rc as ie,ss as ae,ua as oe,vs as se,wn as ce,wo as le,zr as D}from"./dialogs-config-C2KFQf9x.js";import{At as ue,B as de,F as O,Ht as fe,J as pe,Ot as me,R as he,Sn as k,U as A,Ut as ge,V as j,W as _e,jt as M,kt as N,tr as P}from"./history-view-IcXfB6BD.js";import{u as ve}from"./onboarding-CFIVEI92.js";import{O as F,U as ye,k as I}from"./index-BmpLvHah.js";var be=m(),L=e(t(),1),R=l();function z(e){return!e.hasChanges&&e.defaultBranchBehind>0}function B(e){return e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits}function V(e){return e.hasUnpushedCommits&&e.prExists}function H(e,t){return t?`Creating PR`:e.hasChanges?`Commit`:V(e)?`Update PR`:B(e)?`Open PR`:e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges?`Create PR`:z(e)?`Sync`:`Commit`}function xe(e,t,n=!1){return t||n||e.hasChanges||V(e)||B(e)||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges||!e.hasChanges&&!e.hasUnpushedCommits&&!z(e)?null:z(e)?(0,R.jsx)(se,{className:`h-3.5 w-3.5`}):(0,R.jsx)(h,{className:`h-3.5 w-3.5`})}function Se(e){if(e.hasChanges)return e.changedFilesCount>0?`Commit ${e.changedFilesCount} changed file${e.changedFilesCount===1?``:`s`}`:`No changes to commit`;if(V(e))return`Update pull request with unpushed commits`;if(B(e))return`View pull request in GitHub`;if(e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges)return`Create pull request for committed changes`;if(z(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 Ce(e,t,n=!1){return t||n?!0:B(e)||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges||z(e)?!1:!e.hasChanges&&!e.hasUnpushedCommits}function we(e){return e.hasChanges||B(e)||V(e)||z(e)||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges}function U(e){let t=(0,be.c)(105),{branchStatus:n,remoteUrl:r,hasRemoteBranch:i,hasUnpushedCommits:a,canCreateRepo:s,repoUrl:c,isRefreshing:l,isCreatingPR:u,isBrandState:d,hasChanges:f,commitsAheadOfDefault:m,prExists:_,defaultBranch:v,defaultBranchAhead:y,defaultBranchBehind:te,gitUser:b,isDirectCommitMode:re,autoGenerateCommitMessage:T,isLoading:E,isLoadingHistory:ce,isQuickCommitting:D,onFetch:O,onPull:fe,onPush:k,onOpenHistory:ge,onCreatePR:P,onCreateRepo:ve,onViewInGitHub:F,onQuickCommit:ye,onSyncWithDefault:I,onOpenChange:L,open:z,layout:B}=e,V=u===void 0?!1:u,H=B===void 0?`bar`:B,xe=!!v&&!!r&&te>0,Se=!f&&!E,Ce;t[0]!==V||t[1]!==l?(Ce=V||l?(0,R.jsx)(S,{className:`h-4 w-4 shrink-0 animate-spin`}):(0,R.jsx)(ae,{className:`h-4 w-4 shrink-0`}),t[0]=V,t[1]=l,t[2]=Ce):Ce=t[2];let we=Ce,U;t[3]!==d||t[4]!==V||t[5]!==E||t[6]!==l||t[7]!==H||t[8]!==we?(U=(0,R.jsx)(pe,{asChild:!0,children:H===`sidebar`?(0,R.jsx)(p,{variant:`ghost`,size:`icon-sm`,className:`shrink-0 text-muted-foreground`,disabled:E||V,"aria-label":`Git Ops`,children:we}):(0,R.jsxs)(p,{variant:`outline`,size:`sm`,className:x(`h-8 px-1`,H===`bar`&&`w-8 rounded-l-none`,H===`menu`&&`w-full justify-start gap-2 rounded-md`,d&&H===`bar`&&` border-transparent bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground`),disabled:E||V,children:[H===`menu`&&(0,R.jsx)(`span`,{children:`Git Ops`}),V||l?(0,R.jsx)(S,{className:`h-3.5 w-3.5 animate-spin`}):(0,R.jsx)(ae,{className:`h-3.5 w-3.5`})]})}),t[3]=d,t[4]=V,t[5]=E,t[6]=l,t[7]=H,t[8]=we,t[9]=U):U=t[9];let W=H===`sidebar`?`start`:`end`,G;t[10]!==n||t[11]!==r?(G=n===`Behind`&&(0,R.jsxs)(`div`,{className:x(ie.compact,`px-2 py-1 text-amber-600`),children:[`Branch is behind `,r?`origin`:`remote`]}),t[10]=n,t[11]=r,t[12]=G):G=t[12];let K;t[13]===b?K=t[14]:(K=b&&(0,R.jsxs)(`div`,{className:x(ie.compact,`px-2 py-1 text-muted-foreground`),children:[(0,R.jsx)(`span`,{className:`font-medium`,children:`User:`}),` `,b]}),t[13]=b,t[14]=K);let q;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,R.jsx)(A,{}),t[15]=q):q=t[15];let J;t[16]!==Se||t[17]!==v||t[18]!==y||t[19]!==te||t[20]!==f||t[21]!==I||t[22]!==xe?(J=xe&&(0,R.jsx)(ue,{children:(0,R.jsxs)(me,{children:[(0,R.jsx)(M,{asChild:!0,children:(0,R.jsxs)(j,{onClick:()=>{Se&&I()},className:Se?``:`opacity-50 cursor-not-allowed`,children:[(0,R.jsx)(g,{className:`h-3.5 w-3.5 mr-2`}),`Sync with `,v,(0,R.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 pl-3 text-xs tabular-nums text-muted-foreground`,children:[y>0&&(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,R.jsx)(C,{className:`h-3 w-3`}),y]}),te>0&&(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,R.jsx)(se,{className:`h-3 w-3`}),te]})]})]})}),(0,R.jsx)(N,{side:`right`,children:f?`Commit or stash changes before syncing with the default branch`:`Pull latest changes from origin/${v} onto your current branch`})]})}),t[16]=Se,t[17]=v,t[18]=y,t[19]=te,t[20]=f,t[21]=I,t[22]=xe,t[23]=J):J=t[23];let Y;t[24]!==T||t[25]!==f||t[26]!==E||t[27]!==D||t[28]!==ye?(Y=f&&T&&(0,R.jsx)(ue,{children:(0,R.jsxs)(me,{children:[(0,R.jsx)(M,{asChild:!0,children:(0,R.jsxs)(j,{onClick:ye,disabled:E||D,children:[D?(0,R.jsx)(S,{className:`h-3.5 w-3.5 mr-2 animate-spin`}):(0,R.jsx)(oe,{className:`h-3.5 w-3.5 mr-2`}),`Quick Commit`,(0,R.jsx)(_e,{children:`⌘⇧C`})]})}),(0,R.jsx)(N,{side:`right`,children:`Generate the commit message and commit`})]})}),t[24]=T,t[25]=f,t[26]=E,t[27]=D,t[28]=ye,t[29]=Y):Y=t[29];let X;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,R.jsx)(ee,{className:`h-3.5 w-3.5 mr-2`}),t[30]=X):X=t[30];let Z;t[31]!==E||t[32]!==O?(Z=(0,R.jsx)(M,{asChild:!0,children:(0,R.jsxs)(j,{onClick:O,disabled:E,children:[X,`Fetch`]})}),t[31]=E,t[32]=O,t[33]=Z):Z=t[33];let Te;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(Te=(0,R.jsx)(N,{side:`right`,children:`Download latest information from remote without merging changes`}),t[34]=Te):Te=t[34];let Ee;t[35]===Z?Ee=t[36]:(Ee=(0,R.jsx)(ue,{children:(0,R.jsxs)(me,{children:[Z,Te]})}),t[35]=Z,t[36]=Ee);let De;t[37]!==i||t[38]!==E||t[39]!==fe?(De=()=>{i&&!E&&fe()},t[37]=i,t[38]=E,t[39]=fe,t[40]=De):De=t[40];let Q=!i||E?`opacity-50 cursor-not-allowed`:``,Oe;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,R.jsx)(se,{className:`h-3.5 w-3.5 mr-2`}),t[41]=Oe):Oe=t[41];let ke;t[42]!==De||t[43]!==Q?(ke=(0,R.jsx)(M,{asChild:!0,children:(0,R.jsxs)(j,{onClick:De,className:Q,children:[Oe,`Pull`]})}),t[42]=De,t[43]=Q,t[44]=ke):ke=t[44];let Ae=i?`Pull latest changes from remote`:`No remote branch to pull from`,je;t[45]===Ae?je=t[46]:(je=(0,R.jsx)(N,{side:`right`,children:Ae}),t[45]=Ae,t[46]=je);let $;t[47]!==ke||t[48]!==je?($=(0,R.jsx)(ue,{children:(0,R.jsxs)(me,{children:[ke,je]})}),t[47]=ke,t[48]=je,t[49]=$):$=t[49];let Me;t[50]!==i||t[51]!==E||t[52]!==k?(Me=!i&&(0,R.jsx)(ue,{children:(0,R.jsxs)(me,{children:[(0,R.jsx)(M,{asChild:!0,children:(0,R.jsxs)(j,{onClick:k,disabled:E,children:[(0,R.jsx)(w,{className:`h-3.5 w-3.5 mr-2`}),`Push Branch to Remote`]})}),(0,R.jsx)(N,{side:`right`,children:`Create remote branch and push local commits`})]})}),t[50]=i,t[51]=E,t[52]=k,t[53]=Me):Me=t[53];let Ne;t[54]!==a||t[55]!==E||t[56]!==k?(Ne=()=>{a&&!E&&k()},t[54]=a,t[55]=E,t[56]=k,t[57]=Ne):Ne=t[57];let Pe=!a||E?`opacity-50 cursor-not-allowed`:``,Fe;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=(0,R.jsx)(w,{className:`h-3.5 w-3.5 mr-2`}),t[58]=Fe):Fe=t[58];let Ie;t[59]!==Ne||t[60]!==Pe?(Ie=(0,R.jsx)(M,{asChild:!0,children:(0,R.jsxs)(j,{onClick:Ne,className:Pe,children:[Fe,`Push Commits`]})}),t[59]=Ne,t[60]=Pe,t[61]=Ie):Ie=t[61];let Le=a?E?`Push in progress...`:`Push your uncommitted commits to the remote branch`:`No commits to push - your branch is up to date with remote`,Re;t[62]===Le?Re=t[63]:(Re=(0,R.jsx)(N,{side:`right`,children:Le}),t[62]=Le,t[63]=Re);let ze;t[64]!==Ie||t[65]!==Re?(ze=(0,R.jsx)(ue,{children:(0,R.jsxs)(me,{children:[Ie,Re]})}),t[64]=Ie,t[65]=Re,t[66]=ze):ze=t[66];let Be=E||ce,Ve;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=(0,R.jsx)(ne,{className:`h-3.5 w-3.5 mr-2`}),t[67]=Ve):Ve=t[67];let He;t[68]!==ge||t[69]!==Be?(He=(0,R.jsxs)(j,{onClick:ge,disabled:Be,children:[Ve,`History`]}),t[68]=ge,t[69]=Be,t[70]=He):He=t[70];let Ue;t[71]!==m||t[72]!==f||t[73]!==re||t[74]!==E||t[75]!==P||t[76]!==_?(Ue=!re&&m&&!_&&!f&&(0,R.jsxs)(j,{onClick:P,disabled:E,children:[(0,R.jsx)(h,{className:`h-3.5 w-3.5 mr-2`}),`Create Pull Request`,(0,R.jsx)(_e,{children:`⌘⇧P`})]}),t[71]=m,t[72]=f,t[73]=re,t[74]=E,t[75]=P,t[76]=_,t[77]=Ue):Ue=t[77];let We;t[78]!==s||t[79]!==E||t[80]!==ve?(We=s&&(0,R.jsxs)(j,{onClick:ve,disabled:E,children:[(0,R.jsx)(le,{className:`h-3.5 w-3.5 mr-2`}),`Create Repo`]}),t[78]=s,t[79]=E,t[80]=ve,t[81]=We):We=t[81];let Ge;t[82]!==E||t[83]!==F||t[84]!==c?(Ge=c&&(0,R.jsxs)(j,{onClick:F,disabled:E,children:[(0,R.jsx)(o,{className:`h-3.5 w-3.5 mr-2`}),`View in GitHub`,(0,R.jsx)(_e,{children:`⌘⇧G`})]}),t[82]=E,t[83]=F,t[84]=c,t[85]=Ge):Ge=t[85];let Ke;t[86]!==Y||t[87]!==Ee||t[88]!==$||t[89]!==Me||t[90]!==ze||t[91]!==He||t[92]!==Ue||t[93]!==We||t[94]!==Ge||t[95]!==W||t[96]!==G||t[97]!==K||t[98]!==J?(Ke=(0,R.jsxs)(de,{align:W,children:[G,K,q,J,Y,Ee,$,Me,ze,He,Ue,We,Ge]}),t[86]=Y,t[87]=Ee,t[88]=$,t[89]=Me,t[90]=ze,t[91]=He,t[92]=Ue,t[93]=We,t[94]=Ge,t[95]=W,t[96]=G,t[97]=K,t[98]=J,t[99]=Ke):Ke=t[99];let qe;return t[100]!==L||t[101]!==z||t[102]!==Ke||t[103]!==U?(qe=(0,R.jsxs)(he,{open:z,onOpenChange:L,children:[U,Ke]}),t[100]=L,t[101]=z,t[102]=Ke,t[103]=U,t[104]=qe):qe=t[104],qe}var W=(0,L.lazy)(()=>P(()=>import(`./commit-dialog-Ck0r2v9S.js`).then(e=>({default:e.CommitDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))),G=(0,L.lazy)(()=>P(()=>import(`./pull-request-dialog-DVYZgMuN.js`).then(e=>({default:e.PullRequestDialog})),__vite__mapDeps([12,1,2,3,4,5,6,7,8,9,10,11]))),K=(0,L.lazy)(()=>P(()=>import(`./create-repo-dialog-CBvRaov7.js`).then(e=>({default:e.CreateRepoDialog})),__vite__mapDeps([13,1,2,3,4,5,6,7,8,9,10,11]))),q=(0,L.lazy)(()=>P(()=>import(`./git-history-dialog--akFTQOd.js`).then(e=>({default:e.GitHistoryDialog})),__vite__mapDeps([14,4,2]))),J=(0,L.lazy)(()=>P(()=>import(`./push-before-pr-dialog-DoNMB3C8.js`).then(e=>({default:e.PushBeforePRDialog})),__vite__mapDeps([15,4,2]))),Y=(0,L.lazy)(()=>P(()=>import(`./pull-with-changes-dialog-CHHJ0gpA.js`).then(e=>({default:e.PullWithChangesDialog})),__vite__mapDeps([16,3,2,4])));function X(){return null}function Z(e){let t=(0,be.c)(65),{isLoading:n,currentBranch:r,commit:i,pullRequest:a,pushBeforePR:o,createRepo:s,history:c,pullWithChanges:l}=e,u;t[0]!==i.autoGenerate||t[1]!==i.isGenerating||t[2]!==i.isOpen||t[3]!==i.message||t[4]!==i.onAutoGenerateChange||t[5]!==i.onCommit||t[6]!==i.onGenerateMessage||t[7]!==i.onMessageChange||t[8]!==i.onOpenChange||t[9]!==r||t[10]!==n?(u=i.isOpen&&(0,R.jsx)(L.Suspense,{fallback:(0,R.jsx)(X,{}),children:(0,R.jsx)(W,{open:i.isOpen,onOpenChange:i.onOpenChange,commitMessage:i.message,onCommitMessageChange:i.onMessageChange,autoGenerateCommitMessage:i.autoGenerate,onAutoGenerateChange:i.onAutoGenerateChange,isGeneratingMessage:i.isGenerating,isLoading:n,onGenerateMessage:i.onGenerateMessage,onCommit:i.onCommit,currentBranch:r})}),t[0]=i.autoGenerate,t[1]=i.isGenerating,t[2]=i.isOpen,t[3]=i.message,t[4]=i.onAutoGenerateChange,t[5]=i.onCommit,t[6]=i.onGenerateMessage,t[7]=i.onMessageChange,t[8]=i.onOpenChange,t[9]=r,t[10]=n,t[11]=u):u=t[11];let d;t[12]!==r||t[13]!==n||t[14]!==a.autoGenerate||t[15]!==a.description||t[16]!==a.isGeneratingInfo||t[17]!==a.isOpen||t[18]!==a.onAutoGenerateChange||t[19]!==a.onCreatePR||t[20]!==a.onDescriptionChange||t[21]!==a.onGenerateInfo||t[22]!==a.onOpenChange||t[23]!==a.onTitleChange||t[24]!==a.title?(d=a.isOpen&&(0,R.jsx)(L.Suspense,{fallback:(0,R.jsx)(X,{}),children:(0,R.jsx)(G,{open:a.isOpen,onOpenChange:a.onOpenChange,prTitle:a.title,onPrTitleChange:a.onTitleChange,prDescription:a.description,onPrDescriptionChange:a.onDescriptionChange,isGeneratingPRInfo:a.isGeneratingInfo,isLoading:n,onGeneratePRInfo:a.onGenerateInfo,onCreatePR:a.onCreatePR,currentBranch:r,autoGeneratePRInfo:a.autoGenerate,onAutoGeneratePRInfoChange:a.onAutoGenerateChange})}),t[12]=r,t[13]=n,t[14]=a.autoGenerate,t[15]=a.description,t[16]=a.isGeneratingInfo,t[17]=a.isOpen,t[18]=a.onAutoGenerateChange,t[19]=a.onCreatePR,t[20]=a.onDescriptionChange,t[21]=a.onGenerateInfo,t[22]=a.onOpenChange,t[23]=a.onTitleChange,t[24]=a.title,t[25]=d):d=t[25];let f;t[26]!==n||t[27]!==o.isOpen||t[28]!==o.onCancel||t[29]!==o.onOpenChange||t[30]!==o.onPushAndCreatePR?(f=o.isOpen&&(0,R.jsx)(L.Suspense,{fallback:(0,R.jsx)(X,{}),children:(0,R.jsx)(J,{open:o.isOpen,onOpenChange:o.onOpenChange,isLoading:n,onPushAndCreatePR:o.onPushAndCreatePR,onCancel:o.onCancel})}),t[26]=n,t[27]=o.isOpen,t[28]=o.onCancel,t[29]=o.onOpenChange,t[30]=o.onPushAndCreatePR,t[31]=f):f=t[31];let p;t[32]!==s.description||t[33]!==s.isOpen||t[34]!==s.isPrivate||t[35]!==s.name||t[36]!==s.onCreateRepo||t[37]!==s.onDescriptionChange||t[38]!==s.onNameChange||t[39]!==s.onOpenChange||t[40]!==s.onPrivateChange||t[41]!==n?(p=s.isOpen&&(0,R.jsx)(L.Suspense,{fallback:(0,R.jsx)(X,{}),children:(0,R.jsx)(K,{open:s.isOpen,onOpenChange:s.onOpenChange,repoName:s.name,onRepoNameChange:s.onNameChange,repoDescription:s.description,onRepoDescriptionChange:s.onDescriptionChange,isPrivateRepo:s.isPrivate,onPrivateRepoChange:s.onPrivateChange,isLoading:n,onCreateRepo:s.onCreateRepo})}),t[32]=s.description,t[33]=s.isOpen,t[34]=s.isPrivate,t[35]=s.name,t[36]=s.onCreateRepo,t[37]=s.onDescriptionChange,t[38]=s.onNameChange,t[39]=s.onOpenChange,t[40]=s.onPrivateChange,t[41]=n,t[42]=p):p=t[42];let m;t[43]!==r||t[44]!==c.commits||t[45]!==c.displayedCommits||t[46]!==c.isLoadingMore||t[47]!==c.isOpen||t[48]!==c.onOpenChange||t[49]!==c.onScroll?(m=c.isOpen&&(0,R.jsx)(L.Suspense,{fallback:(0,R.jsx)(X,{}),children:(0,R.jsx)(q,{open:c.isOpen,onOpenChange:c.onOpenChange,commits:c.commits,displayedCommits:c.displayedCommits,isLoadingMore:c.isLoadingMore,onScroll:c.onScroll,currentBranch:r})}),t[43]=r,t[44]=c.commits,t[45]=c.displayedCommits,t[46]=c.isLoadingMore,t[47]=c.isOpen,t[48]=c.onOpenChange,t[49]=c.onScroll,t[50]=m):m=t[50];let h;t[51]!==n||t[52]!==l.isOpen||t[53]!==l.onCancel||t[54]!==l.onCommitFirst||t[55]!==l.onOpenChange||t[56]!==l.onStashAndPull?(h=l.isOpen&&(0,R.jsx)(L.Suspense,{fallback:(0,R.jsx)(X,{}),children:(0,R.jsx)(Y,{open:l.isOpen,onOpenChange:l.onOpenChange,onCommitFirst:l.onCommitFirst,onStashAndPull:l.onStashAndPull,onCancel:l.onCancel,isLoading:n})}),t[51]=n,t[52]=l.isOpen,t[53]=l.onCancel,t[54]=l.onCommitFirst,t[55]=l.onOpenChange,t[56]=l.onStashAndPull,t[57]=h):h=t[57];let g;return t[58]!==u||t[59]!==d||t[60]!==f||t[61]!==p||t[62]!==m||t[63]!==h?(g=(0,R.jsxs)(R.Fragment,{children:[u,d,f,p,m,h]}),t[58]=u,t[59]=d,t[60]=f,t[61]=p,t[62]=m,t[63]=h,t[64]=g):g=t[64],g}function Te(e){let t=e.split(`/`);return t.length>=2?{provider:t[0],model:t.slice(1).join(`/`)}:{provider:void 0,model:e}}var Ee=T(`app.use-ai-generation.hook`);function De(e,t,n){let[r,a]=(0,L.useState)(!1),[o,s]=(0,L.useState)(!1),c=()=>n?.id?n.provider?{provider:n.provider,model:n.id}:Te(n.id):{provider:void 0,model:void 0};return{isGeneratingMessage:r,isGeneratingPRInfo:o,generateCommitMessageWithAI:(0,L.useCallback)(async()=>{if(!e)return null;try{a(!0);let{provider:t,model:n}=c();return await f(e,n,t)}catch(e){return Ee.error(`Failed to generate commit message:`,e),O({title:`Error`,description:e instanceof Error?e.message:`Failed to generate commit message`,variant:`destructive`}),null}finally{a(!1)}},[e,n]),generatePRInfoWithAI:(0,L.useCallback)(async()=>{if(!e)return null;try{s(!0);let{provider:t,model:n}=c();return await i(e,n,t)}catch(e){return Ee.error(`Failed to generate PR info:`,e),O({title:`Error`,description:e instanceof Error?e.message:`Failed to generate PR info`,variant:`destructive`}),null}finally{s(!1)}},[e,n])}}function Q(e){return e?!0:(O({title:`Error`,description:`No thread selected`,variant:`destructive`}),!1)}async function Oe(e,t,n,r){r&&(await b(e,{title:r}),n({type:k.UpdateThreadTitle,projectId:t,threadId:e,title:r}))}var ke=2e3,Ae=6;function je(e,t){let n=0;e.current!==null&&clearInterval(e.current),e.current=setInterval(async()=>{if(n++,n>=Ae){e.current!==null&&(clearInterval(e.current),e.current=null);return}await t(!0)},ke)}var $=T(`app.git-ops-button.ui`),Me=10;function Ne(e){let{projectId:t,threadId:r,projectName:i,dispatch:o,aiGeneration:l,unifiedGitStatus:f}=e,[p,m]=(0,L.useState)(!1),[h,g]=(0,L.useState)(!1),[ee,te]=(0,L.useState)(!1),[b,ne]=(0,L.useState)(!1),[x,S]=(0,L.useState)(``),[C,w]=(0,L.useState)(``),[T,ie]=(0,L.useState)(``),[ae,oe]=(0,L.useState)(!1),[se,le]=(0,L.useState)(null),ue=(0,L.useRef)(!1),de=(0,L.useRef)(!1),fe=(0,L.useRef)(C),pe=(0,L.useRef)(T);fe.current=C,pe.current=T;let[me,he]=(0,L.useState)(!1),[A,ge]=(0,L.useState)([]),[j,_e]=(0,L.useState)(!1),[M,N]=(0,L.useState)([]),[P,ve]=(0,L.useState)(!1),[ye,be]=(0,L.useState)(!1),[R,z]=(0,L.useState)(``),[B,V]=(0,L.useState)(``),[H,xe]=(0,L.useState)(``),[Se,Ce]=(0,L.useState)(!1),[we,U]=(0,L.useState)(!1),[W,G]=(0,L.useState)(!1),[K,q]=(0,L.useState)(!1),J=(0,L.useRef)(!1),Y=(0,L.useRef)(null);(0,L.useEffect)(()=>()=>{Y.current!==null&&(clearInterval(Y.current),Y.current=null)},[]);async function X(){ce();let e=await re();o({type:k.SetProjects,projects:e.projects})}let[Z,Te]=(0,L.useState)(()=>F());(0,L.useEffect)(()=>{ye&&i&&!R&&z(i)},[ye,i,R]),(0,L.useEffect)(()=>{I(Z)},[Z]);function Ee(){Se||(Ce(!0),E().then(e=>xe(e)).catch(()=>{}))}function De(e){q(e),e&&(Ee(),f.fetchUnifiedStatus(!0))}(0,L.useEffect)(()=>{h&&f.prExists&&f.prState===`OPEN`&&g(!1)},[f.prExists,f.prState,h]),(0,L.useEffect)(()=>{if(!h)return;let e=setTimeout(()=>{g(!1)},15e3);return()=>clearTimeout(e)},[h]),(0,L.useEffect)(()=>{let e=f.prExists&&f.prState===`OPEN`&&!f.hasChanges&&!f.hasUnpushedCommits;e&&!J.current&&X(),J.current=e},[f.hasChanges,f.hasUnpushedCommits,f.prExists,f.prState]);async function ke(){if(x.trim()&&Q(r))try{m(!0),await v(r,x),S(``),te(!1),await f.fetchUnifiedStatus(!0),X(),O({title:`Changes committed successfully`,description:`Your changes have been committed to '${f.currentBranch}'.`}),W&&(G(!1),await ze())}catch(e){$.error(`Failed to commit:`,e),O({title:`Commit failed`,description:e instanceof Error?e.message:`Failed to commit changes`,variant:`destructive`})}finally{m(!1)}}async function Ae(){if(!Q(r))return;let e=f.prUrl;if(!e)try{e=(await D(r)).url}catch(e){$.error(`Failed to fetch pull request URL:`,e),O({title:`Could not open pull request`,description:e instanceof Error?e.message:`Failed to fetch pull request URL`,variant:`destructive`});return}if(!e){O({title:`Could not open pull request`,description:`Pull request URL is unavailable. Try refreshing git status.`,variant:`destructive`});return}try{await n(e)}catch(e){$.error(`Failed to open pull request:`,e),O({title:`Could not open pull request`,description:e instanceof Error?e.message:`Failed to open URL in browser`,variant:`destructive`})}}async function Ne(){if(f.hasChanges){te(!0);return}if(f.hasUnpushedCommits&&f.prExists){await Le();return}if(f.prExists&&f.prState===`OPEN`&&!f.hasChanges&&!f.hasUnpushedCommits){await Ae();return}if(f.commitsAheadOfDefault&&!f.prExists&&!f.hasChanges){ne(!0);return}if(f.defaultBranchBehind>0){await He();return}}async function Pe(){let e=await l.generateCommitMessageWithAI();e&&S(e)}async function Fe(){if(Q(r))try{m(!0);let e=await l.generateCommitMessageWithAI();if(!e){O({title:`Quick Commit failed`,description:`Could not generate commit message`,variant:`destructive`});return}await v(r,e),await f.fetchUnifiedStatus(!0),X(),O({title:`Changes committed successfully`,description:`Committed: ${e}`})}catch(e){$.error(`Quick commit failed:`,e),O({title:`Quick Commit failed`,description:e instanceof Error?e.message:`Failed to commit changes`,variant:`destructive`})}finally{m(!1)}}async function Ie(){if(Q(r))try{m(!0),await y(r),await f.fetchUnifiedStatus()}catch(e){$.error(`Failed to fetch:`,e)}finally{m(!1)}}async function Le(){if(Q(r))try{m(!0),await c(r),await f.fetchUnifiedStatus(!0),X(),f.hasRemoteBranch?O({title:`Branch pushed successfully`,description:`Your branch '${f.currentBranch}' has been pushed to the remote.`}):O({title:`Push completed`,description:`Changes have been pushed successfully.`})}catch(e){$.error(`Failed to push:`,e),O({title:`Push failed`,description:e instanceof Error?e.message:`Failed to push to remote`,variant:`destructive`})}finally{m(!1)}}async function Re(){if(Q(r)){if(f.hasChanges){U(!0);return}await ze()}}async function ze(){try{m(!0),await a(r),await f.fetchUnifiedStatus(!0),X(),O({title:`Pull successful`,description:`Latest changes have been pulled from remote.`})}catch(e){$.error(`Failed to pull:`,e),O({title:`Pull failed`,description:e instanceof Error?e.message:`Failed to pull from remote`,variant:`destructive`})}finally{m(!1)}}function Be(){U(!1),G(!0),te(!0)}async function Ve(){U(!1),await ze()}async function He(){if(Q(r))try{m(!0),await s(r),await f.fetchUnifiedStatus(!0),X(),O({title:`Branch synced successfully`,description:`Your branch '${f.currentBranch}' has been synced with the latest changes`})}catch(e){$.error(`[sync] ✗ Failed to sync branch:`,e),O({title:`Sync failed`,description:e instanceof Error?e.message:`Failed to sync with default branch`,variant:`destructive`})}finally{m(!1)}}async function Ue(){if(Q(r))try{m(!0),g(!0);let e=await _(r,C,T);await Oe(r,t,o,e.title??C),e.prUrl&&await n(e.prUrl),w(``),ie(``),ne(!1),await f.fetchUnifiedStatus(!0),X(),je(Y,f.fetchUnifiedStatus)}catch(e){$.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`)?(ne(!1),Ke({title:C,description:T})):(g(!1),O({title:`Create PR Failed`,description:t,variant:`destructive`}))}finally{m(!1)}}async function We(){if(Q(r))try{m(!0);let e=await d(r,R,B,Z.privateRepositoryDefault);e.repoUrl&&setTimeout(()=>{n(e.repoUrl)},3e3),z(``),V(``),be(!1),await f.fetchUnifiedStatus(),X()}catch(e){$.error(`Failed to create repo:`,e)}finally{m(!1)}}async function Ge(){let e=await l.generatePRInfoWithAI();e&&(w(e.title),ie(e.description),O({title:`Success`,description:`PR title and description generated`}))}async function Ke(e){let i=e??se;if(!(!r||!i))try{m(!0),g(!0);try{await c(r)}catch(e){let t=e?.message??``;if(t.includes(`non-fast-forward`)||t.includes(`Updates were rejected because the tip of your current branch is behind`)){O({title:`Syncing branch before push`,description:`Your branch is behind remote. Pulling latest changes first...`});try{await s(r),await c(r)}catch{throw e}}else throw e}let e=await _(r,i.title,i.description);await Oe(r,t,o,e.title??i.title),e.prUrl&&await n(e.prUrl),w(``),ie(``),le(null),oe(!1),await f.fetchUnifiedStatus(!0),X(),je(Y,f.fetchUnifiedStatus)}catch(e){$.error(`Failed to push and create PR:`,e);let t=e instanceof Error?e.message:`Failed to push and create PR`;g(!1),O({title:`Push & Create PR Failed`,description:t,variant:`destructive`})}finally{m(!1)}}async function qe(){if(Q(r))try{_e(!0);let e=await u(r,100);ge(e),N(e.slice(0,Me)),he(!0)}catch(e){$.error(`Failed to fetch git history:`,e)}finally{_e(!1)}}function Je(){P||(ve(!0),setTimeout(()=>{let e=M.length+Me;N(A.slice(0,e)),ve(!1)},300))}function Ye(e){let t=e.currentTarget;t.scrollHeight-t.scrollTop-t.clientHeight<100&&M.length<A.length&&!P&&Je()}function Xe(){f.repoUrl&&n(f.repoUrl)}function Ze(){oe(!1),le(null)}return{isLoading:p,isCreatingPR:h,isCommitDialogOpen:ee,setIsCommitDialogOpen:te,isPRDialogOpen:b,setIsPRDialogOpen:ne,commitMessage:x,setCommitMessage:S,prTitle:C,setPrTitle:w,prDescription:T,setPrDescription:ie,isPushBeforePRDialogOpen:ae,setIsPushBeforePRDialogOpen:oe,prGenerationRef:ue,commitGenerationRef:de,prTitleRef:fe,prDescriptionRef:pe,isHistoryDialogOpen:me,setIsHistoryDialogOpen:he,commits:A,displayedCommits:M,isLoadingHistory:j,isLoadingMore:P,isRepoDialogOpen:ye,setIsRepoDialogOpen:be,repoName:R,setRepoName:z,repoDescription:B,setRepoDescription:V,gitUser:H,isPullWithChangesDialogOpen:we,setIsPullWithChangesDialogOpen:U,isGitOpsMenuOpen:K,userPrefs:Z,setUserPrefsState:Te,handleGitOpsMenuOpenChange:De,handleCommit:ke,handleOpenPullRequest:Ae,handleMainButtonClick:Ne,handleGenerateCommitMessage:Pe,handleQuickCommit:Fe,handleFetch:Ie,handlePush:Le,handlePull:Re,handleSyncBranch:He,handleCreatePR:Ue,handleCreateRepo:We,handleGeneratePRInfo:Ge,handlePushAndCreatePR:Ke,handleOpenHistory:qe,handleScroll:Ye,handleViewInGitHub:Xe,handleCancelPushBeforePR:Ze,handleCommitFirstAndPull:Be,handleStashAndPull:Ve}}function Pe(e){let t=(0,be.c)(29),{threadId:n,aiGeneration:r,isCommitDialogOpen:i,commitMessage:a,setCommitMessage:o,autoGenerateCommitMessage:s,commitGenerationRef:c,isPRDialogOpen:l,prTitleRef:u,prDescriptionRef:d,setPrTitle:f,setPrDescription:p,autoGeneratePRInfo:m,prGenerationRef:h}=e,g;t[0]!==r||t[1]!==s||t[2]!==c||t[3]!==a||t[4]!==i||t[5]!==o||t[6]!==n?(g=()=>{if(!i){c.current=!1;return}i&&s&&!a.trim()&&n&&!c.current&&(c.current=!0,(async function(){let e=await r.generateCommitMessageWithAI();e&&o(e)})())},t[0]=r,t[1]=s,t[2]=c,t[3]=a,t[4]=i,t[5]=o,t[6]=n,t[7]=g):g=t[7];let _;t[8]!==r.generateCommitMessageWithAI||t[9]!==s||t[10]!==a||t[11]!==i||t[12]!==n?(_=[i,s,n,r.generateCommitMessageWithAI,a],t[8]=r.generateCommitMessageWithAI,t[9]=s,t[10]=a,t[11]=i,t[12]=n,t[13]=_):_=t[13],(0,L.useEffect)(g,_);let v;t[14]!==r||t[15]!==m||t[16]!==l||t[17]!==d||t[18]!==h||t[19]!==u||t[20]!==p||t[21]!==f||t[22]!==n?(v=()=>{if(!l){h.current=!1;return}l&&m&&!u.current.trim()&&!d.current.trim()&&n&&!h.current&&(h.current=!0,(async function(){let e=await r.generatePRInfoWithAI();e&&(f(e.title),p(e.description))})())},t[14]=r,t[15]=m,t[16]=l,t[17]=d,t[18]=h,t[19]=u,t[20]=p,t[21]=f,t[22]=n,t[23]=v):v=t[23];let y;t[24]!==r.generatePRInfoWithAI||t[25]!==m||t[26]!==l||t[27]!==n?(y=[l,m,n,r.generatePRInfoWithAI],t[24]=r.generatePRInfoWithAI,t[25]=m,t[26]=l,t[27]=n,t[28]=y):y=t[28],(0,L.useEffect)(v,y)}function Fe(e){let{unifiedGitStatus:t,autoGenerateCommitMessage:n,isLoading:r,isCreatingPR:i,isDirectCommitMode:a,onQuickCommit:o,onCreatePR:s,onViewInGitHub:c,onOpenGitOpsMenu:l}=e,u=(0,L.useRef)(o),d=(0,L.useRef)(s),f=(0,L.useRef)(c),p=(0,L.useRef)(l);u.current=o,d.current=s,f.current=c,p.current=l,(0,L.useEffect)(()=>{function e(e){let o=e.key.toLowerCase();if((e.metaKey||e.ctrlKey)&&e.shiftKey&&!e.altKey){if(o===`c`){t.hasChanges&&n&&!r&&(e.preventDefault(),u.current());return}if(o===`p`){t.commitsAheadOfDefault&&!t.prExists&&!t.hasChanges&&!r&&!a&&(e.preventDefault(),d.current());return}if(o===`g`){t.repoUrl&&!r&&(e.preventDefault(),f.current());return}o===`b`&&!r&&!i&&(e.preventDefault(),p.current())}}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t.commitsAheadOfDefault,t.hasChanges,t.prExists,t.repoUrl,n,r,i,a])}function Ie(e){let t=(0,be.c)(178),{projectId:n,threadId:i,layout:a}=e,o=a===void 0?`bar`:a,s=fe(),c;t[0]===i?c=t[1]:(c=e=>e.projectModelSelections[i],t[0]=i,t[1]=c);let l=ge(c),u;t[2]===n?u=t[3]:(u=e=>e.projects.find(e=>e.projectId===n),t[2]=n,t[3]=u);let d=ge(u),f=ye(),m=De(i,n,l),h=d?.commitMethod===te.Direct,g=d?.name,_;t[4]!==m||t[5]!==s||t[6]!==n||t[7]!==g||t[8]!==i||t[9]!==f?(_={projectId:n,threadId:i,projectName:g,dispatch:s,aiGeneration:m,unifiedGitStatus:f},t[4]=m,t[5]=s,t[6]=n,t[7]=g,t[8]=i,t[9]=f,t[10]=_):_=t[10];let v=Ne(_),y;t[11]!==v.commitGenerationRef||t[12]!==v.commitMessage||t[13]!==v.isCommitDialogOpen||t[14]!==v.isPRDialogOpen||t[15]!==v.prDescriptionRef||t[16]!==v.prGenerationRef||t[17]!==v.prTitleRef||t[18]!==v.setCommitMessage||t[19]!==v.setPrDescription||t[20]!==v.setPrTitle||t[21]!==v.userPrefs.autoGenerateCommitMessage||t[22]!==v.userPrefs.autoGeneratePRInfo||t[23]!==m||t[24]!==i?(y={threadId:i,aiGeneration:m,isCommitDialogOpen:v.isCommitDialogOpen,commitMessage:v.commitMessage,setCommitMessage:v.setCommitMessage,autoGenerateCommitMessage:v.userPrefs.autoGenerateCommitMessage,commitGenerationRef:v.commitGenerationRef,isPRDialogOpen:v.isPRDialogOpen,prTitleRef:v.prTitleRef,prDescriptionRef:v.prDescriptionRef,setPrTitle:v.setPrTitle,setPrDescription:v.setPrDescription,autoGeneratePRInfo:v.userPrefs.autoGeneratePRInfo,prGenerationRef:v.prGenerationRef},t[11]=v.commitGenerationRef,t[12]=v.commitMessage,t[13]=v.isCommitDialogOpen,t[14]=v.isPRDialogOpen,t[15]=v.prDescriptionRef,t[16]=v.prGenerationRef,t[17]=v.prTitleRef,t[18]=v.setCommitMessage,t[19]=v.setPrDescription,t[20]=v.setPrTitle,t[21]=v.userPrefs.autoGenerateCommitMessage,t[22]=v.userPrefs.autoGeneratePRInfo,t[23]=m,t[24]=i,t[25]=y):y=t[25],Pe(y);let ee;t[26]===v?ee=t[27]:(ee=()=>v.setIsPRDialogOpen(!0),t[26]=v,t[27]=ee);let b;t[28]===v?b=t[29]:(b=()=>{v.isLoading||v.isCreatingPR||v.handleGitOpsMenuOpenChange(!0)},t[28]=v,t[29]=b);let ne;t[30]!==v.handleQuickCommit||t[31]!==v.handleViewInGitHub||t[32]!==v.isCreatingPR||t[33]!==v.isLoading||t[34]!==v.userPrefs.autoGenerateCommitMessage||t[35]!==h||t[36]!==ee||t[37]!==b||t[38]!==f?(ne={unifiedGitStatus:f,autoGenerateCommitMessage:v.userPrefs.autoGenerateCommitMessage,isLoading:v.isLoading,isCreatingPR:v.isCreatingPR,isDirectCommitMode:h,onQuickCommit:v.handleQuickCommit,onCreatePR:ee,onViewInGitHub:v.handleViewInGitHub,onOpenGitOpsMenu:b},t[30]=v.handleQuickCommit,t[31]=v.handleViewInGitHub,t[32]=v.isCreatingPR,t[33]=v.isLoading,t[34]=v.userPrefs.autoGenerateCommitMessage,t[35]=h,t[36]=ee,t[37]=b,t[38]=f,t[39]=ne):ne=t[39],Fe(ne);let re;t[40]===f?re=t[41]:(re=we(f),t[40]=f,t[41]=re);let S=re,C;t[42]!==v.isCreatingPR||t[43]!==v.isLoading||t[44]!==f?(C=Ce(f,v.isLoading,v.isCreatingPR),t[42]=v.isCreatingPR,t[43]=v.isLoading,t[44]=f,t[45]=C):C=t[45];let w=C,T;t[46]!==v.isCreatingPR||t[47]!==f?(T=H(f,v.isCreatingPR),t[46]=v.isCreatingPR,t[47]=f,t[48]=T):T=t[48];let E=T,ae;t[49]!==v.isCreatingPR||t[50]!==v.isLoading||t[51]!==f?(ae=xe(f,v.isCreatingPR,v.isLoading)??(0,R.jsx)(r,{className:`h-4 w-4 shrink-0`}),t[49]=v.isCreatingPR,t[50]=v.isLoading,t[51]=f,t[52]=ae):ae=t[52];let oe=ae,se=f.defaultBranch??null,ce=m.isGeneratingMessage&&v.isLoading,le,D,de,O,pe,he;t[53]===v?(le=t[54],D=t[55],de=t[56],O=t[57],pe=t[58],he=t[59]):(le=()=>void v.handleFetch(),D=()=>void v.handlePull(),de=()=>void v.handlePush(),O=()=>void v.handleOpenHistory(),pe=()=>v.setIsPRDialogOpen(!0),he=()=>v.setIsRepoDialogOpen(!0),t[53]=v,t[54]=le,t[55]=D,t[56]=de,t[57]=O,t[58]=pe,t[59]=he);let k,A;t[60]===v?(k=t[61],A=t[62]):(k=()=>void v.handleQuickCommit(),A=()=>void v.handleSyncBranch(),t[60]=v,t[61]=k,t[62]=A);let j;t[63]!==v.gitUser||t[64]!==v.handleGitOpsMenuOpenChange||t[65]!==v.handleViewInGitHub||t[66]!==v.isCreatingPR||t[67]!==v.isGitOpsMenuOpen||t[68]!==v.isLoading||t[69]!==v.isLoadingHistory||t[70]!==v.userPrefs.autoGenerateCommitMessage||t[71]!==S||t[72]!==h||t[73]!==o||t[74]!==se||t[75]!==ce||t[76]!==le||t[77]!==D||t[78]!==de||t[79]!==O||t[80]!==pe||t[81]!==he||t[82]!==k||t[83]!==A||t[84]!==f.canCreateRepo||t[85]!==f.commitsAheadOfDefault||t[86]!==f.defaultBranchAhead||t[87]!==f.defaultBranchBehind||t[88]!==f.hasChanges||t[89]!==f.hasRemoteBranch||t[90]!==f.hasUnpushedCommits||t[91]!==f.isRefreshing||t[92]!==f.prExists||t[93]!==f.remoteUrl||t[94]!==f.repoUrl||t[95]!==f.status?(j=(0,R.jsx)(U,{branchStatus:f.status,remoteUrl:f.remoteUrl,hasRemoteBranch:f.hasRemoteBranch,hasUnpushedCommits:f.hasUnpushedCommits,canCreateRepo:f.canCreateRepo,repoUrl:f.repoUrl,isRefreshing:f.isRefreshing,isCreatingPR:v.isCreatingPR,isBrandState:S,hasChanges:f.hasChanges,commitsAheadOfDefault:f.commitsAheadOfDefault,prExists:f.prExists,defaultBranch:se,defaultBranchAhead:f.defaultBranchAhead,defaultBranchBehind:f.defaultBranchBehind,gitUser:v.gitUser,isDirectCommitMode:h,autoGenerateCommitMessage:v.userPrefs.autoGenerateCommitMessage,isLoading:v.isLoading,isLoadingHistory:v.isLoadingHistory,isQuickCommitting:ce,onFetch:le,onPull:D,onPush:de,onOpenHistory:O,onCreatePR:pe,onCreateRepo:he,onViewInGitHub:v.handleViewInGitHub,onQuickCommit:k,onSyncWithDefault:A,open:v.isGitOpsMenuOpen,onOpenChange:v.handleGitOpsMenuOpenChange,layout:o}),t[63]=v.gitUser,t[64]=v.handleGitOpsMenuOpenChange,t[65]=v.handleViewInGitHub,t[66]=v.isCreatingPR,t[67]=v.isGitOpsMenuOpen,t[68]=v.isLoading,t[69]=v.isLoadingHistory,t[70]=v.userPrefs.autoGenerateCommitMessage,t[71]=S,t[72]=h,t[73]=o,t[74]=se,t[75]=ce,t[76]=le,t[77]=D,t[78]=de,t[79]=O,t[80]=pe,t[81]=he,t[82]=k,t[83]=A,t[84]=f.canCreateRepo,t[85]=f.commitsAheadOfDefault,t[86]=f.defaultBranchAhead,t[87]=f.defaultBranchBehind,t[88]=f.hasChanges,t[89]=f.hasRemoteBranch,t[90]=f.hasUnpushedCommits,t[91]=f.isRefreshing,t[92]=f.prExists,t[93]=f.remoteUrl,t[94]=f.repoUrl,t[95]=f.status,t[96]=j):j=t[96];let _e=j,P;t[97]!==v.handleMainButtonClick||t[98]!==_e||t[99]!==S||t[100]!==o||t[101]!==w||t[102]!==oe||t[103]!==E||t[104]!==f?(P=o===`sidebar`?(0,R.jsxs)(`div`,{className:`flex w-full min-w-0 items-center`,children:[(0,R.jsx)(ue,{children:(0,R.jsxs)(me,{children:[(0,R.jsx)(M,{asChild:!0,children:(0,R.jsx)(ve,{asChild:!0,className:`min-w-0 flex-1`,children:(0,R.jsx)(`button`,{type:`button`,className:`min-w-0 w-full justify-start`,disabled:w,onClick:v.handleMainButtonClick,children:(0,R.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,R.jsx)(`span`,{className:x(S&&`text-brand`),children:oe}),(0,R.jsx)(`span`,{className:x(ie.body,`truncate`,S&&`font-medium text-brand`),children:E})]})})})}),(0,R.jsx)(N,{side:`right`,children:Se(f)})]})}),_e]}):(0,R.jsxs)(`div`,{className:x(`flex items-center gap-0`,o===`menu`&&`w-full flex-col gap-1 [&_button]:w-full [&_button]:justify-start`),children:[(0,R.jsx)(ue,{children:(0,R.jsxs)(me,{children:[(0,R.jsx)(M,{asChild:!0,children:(0,R.jsxs)(p,{variant:`outline`,size:`sm`,className:x(`h-8 gap-1.5`,o===`bar`&&`rounded-r-none border-r-0`,o===`menu`&&`rounded-md border`,S&&` border-transparent bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground`),disabled:w,onClick:v.handleMainButtonClick,children:[oe,E]})}),(0,R.jsx)(N,{children:Se(f)})]})}),_e]}),t[97]=v.handleMainButtonClick,t[98]=_e,t[99]=S,t[100]=o,t[101]=w,t[102]=oe,t[103]=E,t[104]=f,t[105]=P):P=t[105];let F;t[106]===v?F=t[107]:(F=e=>v.setUserPrefsState(t=>({...t,autoGenerateCommitMessage:e})),t[106]=v,t[107]=F);let I;t[108]!==v.commitMessage||t[109]!==v.handleCommit||t[110]!==v.handleGenerateCommitMessage||t[111]!==v.isCommitDialogOpen||t[112]!==v.setCommitMessage||t[113]!==v.setIsCommitDialogOpen||t[114]!==v.userPrefs.autoGenerateCommitMessage||t[115]!==m.isGeneratingMessage||t[116]!==F?(I={isOpen:v.isCommitDialogOpen,onOpenChange:v.setIsCommitDialogOpen,message:v.commitMessage,onMessageChange:v.setCommitMessage,autoGenerate:v.userPrefs.autoGenerateCommitMessage,onAutoGenerateChange:F,isGenerating:m.isGeneratingMessage,onGenerateMessage:v.handleGenerateCommitMessage,onCommit:v.handleCommit},t[108]=v.commitMessage,t[109]=v.handleCommit,t[110]=v.handleGenerateCommitMessage,t[111]=v.isCommitDialogOpen,t[112]=v.setCommitMessage,t[113]=v.setIsCommitDialogOpen,t[114]=v.userPrefs.autoGenerateCommitMessage,t[115]=m.isGeneratingMessage,t[116]=F,t[117]=I):I=t[117];let L;t[118]===v?L=t[119]:(L=e=>v.setUserPrefsState(t=>({...t,autoGeneratePRInfo:e})),t[118]=v,t[119]=L);let z;t[120]!==v.handleCreatePR||t[121]!==v.handleGeneratePRInfo||t[122]!==v.isPRDialogOpen||t[123]!==v.prDescription||t[124]!==v.prTitle||t[125]!==v.setIsPRDialogOpen||t[126]!==v.setPrDescription||t[127]!==v.setPrTitle||t[128]!==v.userPrefs.autoGeneratePRInfo||t[129]!==m.isGeneratingPRInfo||t[130]!==L?(z={isOpen:v.isPRDialogOpen,onOpenChange:v.setIsPRDialogOpen,title:v.prTitle,onTitleChange:v.setPrTitle,description:v.prDescription,onDescriptionChange:v.setPrDescription,isGeneratingInfo:m.isGeneratingPRInfo,onGenerateInfo:v.handleGeneratePRInfo,onCreatePR:v.handleCreatePR,autoGenerate:v.userPrefs.autoGeneratePRInfo,onAutoGenerateChange:L},t[120]=v.handleCreatePR,t[121]=v.handleGeneratePRInfo,t[122]=v.isPRDialogOpen,t[123]=v.prDescription,t[124]=v.prTitle,t[125]=v.setIsPRDialogOpen,t[126]=v.setPrDescription,t[127]=v.setPrTitle,t[128]=v.userPrefs.autoGeneratePRInfo,t[129]=m.isGeneratingPRInfo,t[130]=L,t[131]=z):z=t[131];let B;t[132]===v?B=t[133]:(B=()=>v.handlePushAndCreatePR(),t[132]=v,t[133]=B);let V;t[134]!==v.handleCancelPushBeforePR||t[135]!==v.isPushBeforePRDialogOpen||t[136]!==v.setIsPushBeforePRDialogOpen||t[137]!==B?(V={isOpen:v.isPushBeforePRDialogOpen,onOpenChange:v.setIsPushBeforePRDialogOpen,onPushAndCreatePR:B,onCancel:v.handleCancelPushBeforePR},t[134]=v.handleCancelPushBeforePR,t[135]=v.isPushBeforePRDialogOpen,t[136]=v.setIsPushBeforePRDialogOpen,t[137]=B,t[138]=V):V=t[138];let W;t[139]===v?W=t[140]:(W=e=>v.setUserPrefsState(t=>({...t,privateRepositoryDefault:e})),t[139]=v,t[140]=W);let G;t[141]!==v.handleCreateRepo||t[142]!==v.isRepoDialogOpen||t[143]!==v.repoDescription||t[144]!==v.repoName||t[145]!==v.setIsRepoDialogOpen||t[146]!==v.setRepoDescription||t[147]!==v.setRepoName||t[148]!==v.userPrefs.privateRepositoryDefault||t[149]!==W?(G={isOpen:v.isRepoDialogOpen,onOpenChange:v.setIsRepoDialogOpen,name:v.repoName,onNameChange:v.setRepoName,description:v.repoDescription,onDescriptionChange:v.setRepoDescription,isPrivate:v.userPrefs.privateRepositoryDefault,onPrivateChange:W,onCreateRepo:v.handleCreateRepo},t[141]=v.handleCreateRepo,t[142]=v.isRepoDialogOpen,t[143]=v.repoDescription,t[144]=v.repoName,t[145]=v.setIsRepoDialogOpen,t[146]=v.setRepoDescription,t[147]=v.setRepoName,t[148]=v.userPrefs.privateRepositoryDefault,t[149]=W,t[150]=G):G=t[150];let K;t[151]!==v.commits||t[152]!==v.displayedCommits||t[153]!==v.handleScroll||t[154]!==v.isHistoryDialogOpen||t[155]!==v.isLoadingMore||t[156]!==v.setIsHistoryDialogOpen?(K={isOpen:v.isHistoryDialogOpen,onOpenChange:v.setIsHistoryDialogOpen,commits:v.commits,displayedCommits:v.displayedCommits,isLoadingMore:v.isLoadingMore,onScroll:v.handleScroll},t[151]=v.commits,t[152]=v.displayedCommits,t[153]=v.handleScroll,t[154]=v.isHistoryDialogOpen,t[155]=v.isLoadingMore,t[156]=v.setIsHistoryDialogOpen,t[157]=K):K=t[157];let q;t[158]===v?q=t[159]:(q=()=>v.setIsPullWithChangesDialogOpen(!1),t[158]=v,t[159]=q);let J;t[160]!==v.handleCommitFirstAndPull||t[161]!==v.handleStashAndPull||t[162]!==v.isPullWithChangesDialogOpen||t[163]!==v.setIsPullWithChangesDialogOpen||t[164]!==q?(J={isOpen:v.isPullWithChangesDialogOpen,onOpenChange:v.setIsPullWithChangesDialogOpen,onCommitFirst:v.handleCommitFirstAndPull,onStashAndPull:v.handleStashAndPull,onCancel:q},t[160]=v.handleCommitFirstAndPull,t[161]=v.handleStashAndPull,t[162]=v.isPullWithChangesDialogOpen,t[163]=v.setIsPullWithChangesDialogOpen,t[164]=q,t[165]=J):J=t[165];let Y;t[166]!==v.isLoading||t[167]!==I||t[168]!==z||t[169]!==V||t[170]!==G||t[171]!==K||t[172]!==J||t[173]!==f.currentBranch?(Y=(0,R.jsx)(Z,{isLoading:v.isLoading,currentBranch:f.currentBranch,commit:I,pullRequest:z,pushBeforePR:V,createRepo:G,history:K,pullWithChanges:J}),t[166]=v.isLoading,t[167]=I,t[168]=z,t[169]=V,t[170]=G,t[171]=K,t[172]=J,t[173]=f.currentBranch,t[174]=Y):Y=t[174];let X;return t[175]!==P||t[176]!==Y?(X=(0,R.jsxs)(R.Fragment,{children:[P,Y]}),t[175]=P,t[176]=Y,t[177]=X):X=t[177],X}export{Ie as GitOpsButton};