@mrpatronz/nexusflow 2.2.0 → 2.3.0

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 (135) hide show
  1. package/README.md +80 -17
  2. package/dist/commands/ui.d.ts +1 -0
  3. package/dist/commands/ui.d.ts.map +1 -1
  4. package/dist/commands/ui.js +24 -13
  5. package/dist/commands/ui.js.map +1 -1
  6. package/dist/commands/ui.test.d.ts +2 -0
  7. package/dist/commands/ui.test.d.ts.map +1 -0
  8. package/dist/commands/ui.test.js +58 -0
  9. package/dist/commands/ui.test.js.map +1 -0
  10. package/dist/core/workspace-skills-workflow.integration.test.d.ts +2 -0
  11. package/dist/core/workspace-skills-workflow.integration.test.d.ts.map +1 -0
  12. package/dist/core/workspace-skills-workflow.integration.test.js +162 -0
  13. package/dist/core/workspace-skills-workflow.integration.test.js.map +1 -0
  14. package/dist/core/worktree.test.js +1 -1
  15. package/dist/core/worktree.test.js.map +1 -1
  16. package/dist/generators/index.d.ts.map +1 -1
  17. package/dist/generators/index.js +4 -8
  18. package/dist/generators/index.js.map +1 -1
  19. package/dist/generators/skills-generator.d.ts +2 -2
  20. package/dist/generators/skills-generator.d.ts.map +1 -1
  21. package/dist/generators/skills-generator.js +84 -89
  22. package/dist/generators/skills-generator.js.map +1 -1
  23. package/dist/generators/skills-generator.test.d.ts +2 -0
  24. package/dist/generators/skills-generator.test.d.ts.map +1 -0
  25. package/dist/generators/skills-generator.test.js +79 -0
  26. package/dist/generators/skills-generator.test.js.map +1 -0
  27. package/dist/gui/assets/AgentsPage-BtrTgIyU.js +3 -0
  28. package/dist/gui/assets/{DashboardPage-CUspfCap.js → DashboardPage-CeUkMdxc.js} +1 -1
  29. package/dist/gui/assets/{GettingStartedPage-BqtgARZW.js → GettingStartedPage-YwJXpsc6.js} +1 -1
  30. package/dist/gui/assets/ProjectsPage-D8kEHb-m.js +1 -0
  31. package/dist/gui/assets/ScaffoldRepoInline-ij7JLzmx.js +1 -0
  32. package/dist/gui/assets/SettingsPage-BQhAP4go.js +1 -0
  33. package/dist/gui/assets/SkillsPage-DJ-dXfcC.js +6 -0
  34. package/dist/gui/assets/StartWorkPage-DGWZzF4H.js +1 -0
  35. package/dist/gui/assets/{StrategiesPage-D0Y6A4Tw.js → StrategiesPage-CLOjDRbX.js} +2 -2
  36. package/dist/gui/assets/WorkspaceLauncher-CjNI4vqn.js +1 -0
  37. package/dist/gui/assets/WorkspacesPage-MDzm2JUh.js +6 -0
  38. package/dist/gui/assets/alert-dialog-DjwFcE6b.js +1 -0
  39. package/dist/gui/assets/bot-wH0FKlic.js +1 -0
  40. package/dist/gui/assets/chevron-down-DDmhvRLr.js +1 -0
  41. package/dist/gui/assets/code-xml-Chu1p81J.js +1 -0
  42. package/dist/gui/assets/index-CfQEnn52.js +52 -0
  43. package/dist/gui/assets/index-k7inKaui.css +2 -0
  44. package/dist/gui/assets/{spinner-DXt6mnJk.js → spinner-BCEaGbib.js} +1 -1
  45. package/dist/gui/assets/terminal-gK6BMl3E.js +1 -0
  46. package/dist/gui/assets/{textarea-BLU5HXmZ.js → textarea-D3-elOAa.js} +1 -1
  47. package/dist/gui/assets/{useAriaLabelledBy-CjNlctb9.js → useAriaLabelledBy-DmwmZIqb.js} +1 -1
  48. package/dist/gui/assets/useCompositeListItem-CZnlZ-eF.js +1 -0
  49. package/dist/gui/assets/useValueChanged-BfI2s7NX.js +1 -0
  50. package/dist/gui/assets/zap-FQrDnrgb.js +1 -0
  51. package/dist/gui/index.html +6 -4
  52. package/dist/resources/agents-catalog.d.ts +7 -0
  53. package/dist/resources/agents-catalog.d.ts.map +1 -0
  54. package/dist/resources/agents-catalog.js +141 -0
  55. package/dist/resources/agents-catalog.js.map +1 -0
  56. package/dist/resources/agents-catalog.test.d.ts +2 -0
  57. package/dist/resources/agents-catalog.test.d.ts.map +1 -0
  58. package/dist/resources/agents-catalog.test.js +50 -0
  59. package/dist/resources/agents-catalog.test.js.map +1 -0
  60. package/dist/resources/codex-agent.d.ts +6 -0
  61. package/dist/resources/codex-agent.d.ts.map +1 -0
  62. package/dist/resources/codex-agent.js +55 -0
  63. package/dist/resources/codex-agent.js.map +1 -0
  64. package/dist/resources/codex-agent.test.d.ts +2 -0
  65. package/dist/resources/codex-agent.test.d.ts.map +1 -0
  66. package/dist/resources/codex-agent.test.js +27 -0
  67. package/dist/resources/codex-agent.test.js.map +1 -0
  68. package/dist/resources/contracts.d.ts +116 -0
  69. package/dist/resources/contracts.d.ts.map +1 -0
  70. package/dist/resources/contracts.js +103 -0
  71. package/dist/resources/contracts.js.map +1 -0
  72. package/dist/resources/fs-safety.d.ts +11 -0
  73. package/dist/resources/fs-safety.d.ts.map +1 -0
  74. package/dist/resources/fs-safety.js +77 -0
  75. package/dist/resources/fs-safety.js.map +1 -0
  76. package/dist/resources/materializer.d.ts +17 -0
  77. package/dist/resources/materializer.d.ts.map +1 -0
  78. package/dist/resources/materializer.js +439 -0
  79. package/dist/resources/materializer.js.map +1 -0
  80. package/dist/resources/materializer.test.d.ts +2 -0
  81. package/dist/resources/materializer.test.d.ts.map +1 -0
  82. package/dist/resources/materializer.test.js +149 -0
  83. package/dist/resources/materializer.test.js.map +1 -0
  84. package/dist/resources/service.d.ts +8 -0
  85. package/dist/resources/service.d.ts.map +1 -0
  86. package/dist/resources/service.js +45 -0
  87. package/dist/resources/service.js.map +1 -0
  88. package/dist/resources/service.test.d.ts +2 -0
  89. package/dist/resources/service.test.d.ts.map +1 -0
  90. package/dist/resources/service.test.js +58 -0
  91. package/dist/resources/service.test.js.map +1 -0
  92. package/dist/server.d.ts +5 -0
  93. package/dist/server.d.ts.map +1 -1
  94. package/dist/server.js +310 -4
  95. package/dist/server.js.map +1 -1
  96. package/dist/server.test.js +365 -5
  97. package/dist/server.test.js.map +1 -1
  98. package/dist/types.d.ts +107 -0
  99. package/dist/types.d.ts.map +1 -1
  100. package/dist/utils/resources.d.ts +2 -1
  101. package/dist/utils/resources.d.ts.map +1 -1
  102. package/dist/utils/resources.js +4 -3
  103. package/dist/utils/resources.js.map +1 -1
  104. package/dist/utils/session-finder.d.ts +6 -0
  105. package/dist/utils/session-finder.d.ts.map +1 -1
  106. package/dist/utils/session-finder.js +56 -0
  107. package/dist/utils/session-finder.js.map +1 -1
  108. package/dist/utils/session-finder.test.js +34 -1
  109. package/dist/utils/session-finder.test.js.map +1 -1
  110. package/dist/utils/skills-catalog.d.ts +77 -0
  111. package/dist/utils/skills-catalog.d.ts.map +1 -0
  112. package/dist/utils/skills-catalog.js +871 -0
  113. package/dist/utils/skills-catalog.js.map +1 -0
  114. package/dist/utils/skills-catalog.test.d.ts +2 -0
  115. package/dist/utils/skills-catalog.test.d.ts.map +1 -0
  116. package/dist/utils/skills-catalog.test.js +281 -0
  117. package/dist/utils/skills-catalog.test.js.map +1 -0
  118. package/dist/utils/workspace-launch.d.ts.map +1 -1
  119. package/dist/utils/workspace-launch.js +22 -1
  120. package/dist/utils/workspace-launch.js.map +1 -1
  121. package/dist/utils/workspace-launch.test.js +36 -2
  122. package/dist/utils/workspace-launch.test.js.map +1 -1
  123. package/package.json +4 -1
  124. package/dist/gui/assets/ProjectsPage-UBoQxI2G.js +0 -1
  125. package/dist/gui/assets/ScaffoldRepoInline-DqoourJe.js +0 -1
  126. package/dist/gui/assets/SettingsPage-BZl24tqD.js +0 -1
  127. package/dist/gui/assets/StartWorkPage-BGNFdBfj.js +0 -1
  128. package/dist/gui/assets/WorkspaceLauncher-Cxv0O_wt.js +0 -1
  129. package/dist/gui/assets/WorkspacesPage-Cvb1rOeh.js +0 -6
  130. package/dist/gui/assets/index-CllPiiFL.js +0 -52
  131. package/dist/gui/assets/index-DGCBhMAn.css +0 -2
  132. package/dist/gui/assets/useCompositeListItem-DWGFLKqA.js +0 -1
  133. /package/dist/{resources → static-resources}/workflows/plan-implement-review.md +0 -0
  134. /package/dist/{resources → static-resources}/workflows/research-verify.md +0 -0
  135. /package/dist/{resources → static-resources}/workflows/solo-developer.md +0 -0
@@ -1 +0,0 @@
1
- import{_ as e,b as t,d as n,g as r,h as i,i as a,l as o,m as s,o as c,p as l,s as u,t as d,u as ee}from"./button-cPldH5S4.js";import{$n as f,Ft as te,Gt as p,Ht as ne,Jt as m,M as re,S as ie,St as h,Ut as ae,Vn as oe,Wt as se,Xn as ce,Zn as g,bt as le,er as ue,rr as _,t as v,tr as y,wt as de,xt as fe}from"./spinner-DXt6mnJk.js";import{t as b}from"./search-ChVovkOL.js";import{t as pe}from"./useAriaLabelledBy-CjNlctb9.js";import{V as x}from"./index-CllPiiFL.js";var me=i(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),S=t(e(),1),C=S.createContext({disabled:!1});function he(){return S.useContext(C)}var w=S.createContext(void 0);function ge(e=!0){let t=S.useContext(w);if(t===void 0&&!e)throw Error(n(3));return t}function _e(e){if(!e)return null;for(let t of e.elements){let e=t.tagName;if(e===`BUTTON`||e===`INPUT`){let e=t;if(e.type===`submit`)return e}}return null}var T=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.indeterminate=`data-indeterminate`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({});function ve(e){return S.useMemo(()=>({checked(t){return e.indeterminate?{}:t?{[T.checked]:``}:{[T.unchecked]:``}},...y}),[e.indeterminate])}var ye=S.createContext(void 0);function E(){let e=S.useContext(ye);if(e===void 0)throw Error(n(14));return e}var D=r(),be=`data-parent`,xe=S.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i=!1,"aria-labelledby":s,disabled:d=!1,form:p,id:m,indeterminate:h=!1,inputRef:se,name:v,onCheckedChange:y,parent:b=!1,readOnly:x=!1,render:me,required:C=!1,uncheckedValue:w,value:T,nativeButton:E=!1,style:xe,...O}=e,{clearErrors:k}=f(),{disabled:A,name:j,setDirty:Se,setFilled:M,setFocused:N,setTouched:Ce,state:P,validationMode:we,validityData:Te,validation:Ee}=ue(),De=he(),{labelId:Oe,controlId:ke,registerControlId:F,getDescriptionProps:Ae}=ce(),I=ge(),L=I?.parent,R=L&&I.allValues,z=A||De.disabled||I?.disabled||d,B=j??v,V=T??B,je=g(),Me=g(),H=ke;R?H=b?Me:`${L.id}-${V}`:m&&(H=m);let U={};R&&(b?U=I.parent.getParentProps():V&&(U=I.parent.getChildProps(V)));let{checked:Ne=n,indeterminate:Pe=h,onCheckedChange:Fe,...Ie}=U,W=I?.value,Le=I?.setValue,Re=I?.defaultValue,G=S.useRef(null),K=ee(()=>Symbol(`checkbox-control`)),q=S.useRef(!1),{getButtonProps:ze,buttonRef:Be}=ie({disabled:z,native:E}),J=I?.validation??Ee,[Y,Ve]=ae({controlled:V&&W&&!b?W.includes(V):Ne,default:V&&Re&&!b?Re.includes(V):i,name:`Checkbox`,state:`checked`}),X=R?!!Ne:Y,Z=R&&Pe||h;_(()=>{F!==u&&(q.current=!0,F(K.current,H))},[H,F,K]),S.useEffect(()=>{let e=K.current;return()=>{!q.current||F===u||(q.current=!1,F(e,void 0))}},[F,K]),ne(G,je,Y,void 0,!I&&!z,v);let Q=S.useRef(null),He=o(se,Q,J.inputRef,J.registerInput),Ue=pe(s,Oe,Q,!E,H??void 0);_(()=>{Q.current&&(Q.current.indeterminate=Z,Y&&M(!0))},[Y,Z,M]),re(Y,()=>{I||(k(B),M(Y),Se(Y!==Te.initialValue),J.change(Y))});let We=l({checked:Y,disabled:z,form:p,name:b?void 0:B,id:E?void 0:H??void 0,required:C,ref:He,style:B?fe:le,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(x){e.preventDefault();return}let t=e.currentTarget.checked,n=de(te,e.nativeEvent);if(y?.(t,n),!n.isCanceled&&(Fe?.(t,n),!n.isCanceled&&(Ve(t),V&&W&&Le&&!b&&!R))){let e=t?[...W,V]:W.filter(e=>e!==V);Le(e,n)}},onFocus(){G.current?.focus()}},T===void 0?c:{value:(I?Y&&T:T)||``},Ae,e=>J.getValidationProps(z,e));S.useEffect(()=>{if(!L||!V)return;let e=L.disabledStatesRef.current;return e.set(V,z),()=>{e.delete(V)}},[L,z,V]);let $=S.useMemo(()=>({...P,checked:X,disabled:z,readOnly:x,required:C,indeterminate:Z}),[P,X,z,x,C,Z]),Ge=ve($),Ke=a(`span`,e,{state:$,ref:[Be,G,t,I?.registerControlRef],props:[{id:E?H??void 0:je,role:`checkbox`,"aria-checked":Z?`mixed`:X,"aria-readonly":x||void 0,"aria-required":C||void 0,"aria-labelledby":Ue,[be]:b?``:void 0,onFocus(){z||N(!0)},onBlur(){let e=Q.current;e&&(Ce(!0),N(!1),we===`onBlur`&&J.commit(I?W:e.checked))},onKeyDown(e){if(e.key!==`Enter`||(e.preventBaseUIHandler(),e.defaultPrevented))return;let t=Q.current?.form??null,n=e.currentTarget,r=e.nativeEvent,i=e.preventDefault,a=r.preventDefault,o=!1;e.preventDefault=()=>{o=!0,i.call(e)},r.preventDefault=()=>{o=!0,a.call(r)},a.call(r),oe(n).queueMicrotask(()=>{e.preventDefault=i,r.preventDefault=a,o||_e(t)?.click()})},onClick(e){if(x||z)return;e.preventDefault();let t=Q.current;t&&t.dispatchEvent(new(oe(t)).PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey}))}},O,Ie,ze,Ae,e=>J.getValidationProps(z,e)],stateAttributesMapping:Ge});return(0,D.jsxs)(ye.Provider,{value:$,children:[Ke,!Y&&!I&&B&&!b&&w!==void 0&&(0,D.jsx)(`input`,{type:`hidden`,form:p,name:B,value:w,disabled:z}),(0,D.jsx)(`input`,{...We,suppressHydrationWarning:!0})]})}),O=S.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:o=!1,...s}=e,c=E(),l=c.checked||c.indeterminate,{mounted:u,transitionStatus:d,setMounted:ee}=se(l),f=S.useRef(null),te={...c,transitionStatus:d};p({open:l,ref:f,onComplete(){l||ee(!1)}});let ne={...ve(c),...m,...y},re=o||u,ie=a(`span`,e,{ref:[t,f],state:te,stateAttributesMapping:ne,props:s});return re?ie:null});function k({className:e,...t}){return(0,D.jsx)(xe,{className:s(`relative inline-flex size-4.5 shrink-0 items-center justify-center rounded-[.25rem] border border-input bg-background not-dark:bg-clip-padding shadow-xs/5 outline-none ring-ring transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[3px] not-data-disabled:not-data-checked:not-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-offset-background aria-invalid:border-destructive/36 focus-visible:aria-invalid:border-destructive/64 focus-visible:aria-invalid:ring-destructive/48 data-disabled:opacity-64 sm:size-4 dark:not-data-checked:bg-input/32 dark:aria-invalid:ring-destructive/24 dark:not-data-disabled:not-data-checked:not-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)] [[data-disabled],[data-checked],[aria-invalid]]:shadow-none`,e),"data-slot":`checkbox`,...t,children:(0,D.jsx)(O,{className:`-inset-px absolute flex items-center justify-center rounded-[.25rem] text-primary-foreground data-unchecked:hidden data-checked:bg-primary data-indeterminate:text-foreground`,"data-slot":`checkbox-indicator`,render:(e,t)=>(0,D.jsx)(`span`,{...e,children:t.indeterminate?(0,D.jsx)(`svg`,{className:`size-3.5 sm:size-3`,fill:`none`,height:`24`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`3`,viewBox:`0 0 24 24`,width:`24`,xmlns:`http://www.w3.org/2000/svg`,children:(0,D.jsx)(`path`,{d:`M5.252 12h13.496`})}):(0,D.jsx)(`svg`,{className:`size-3.5 sm:size-3`,fill:`none`,height:`24`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`3`,viewBox:`0 0 24 24`,width:`24`,xmlns:`http://www.w3.org/2000/svg`,children:(0,D.jsx)(`path`,{d:`M5.252 12.7 10.2 18.63 18.748 5.37`})})})})})}function A({repos:e,selectedPaths:t,onToggle:n,loading:r,emptyHint:i,className:a}){let[o,c]=(0,S.useState)(``),l=(0,S.useMemo)(()=>{let t=o.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||e.path.toLowerCase().includes(t)):e},[e,o]);return(0,D.jsxs)(`div`,{className:s(`flex flex-col gap-2`,a),children:[(0,D.jsxs)(`div`,{className:`relative`,children:[(0,D.jsx)(b,{className:`absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground`}),(0,D.jsx)(h,{value:o,onChange:e=>c(e.target.value),placeholder:`Filter repositories…`,className:`pl-8`,"aria-label":`Filter repositories`})]}),(0,D.jsx)(`div`,{className:`max-h-56 overflow-y-auto rounded-lg border border-border`,children:r?(0,D.jsx)(`p`,{className:`p-3 text-sm text-muted-foreground`,children:`Scanning for repositories…`}):l.length===0?(0,D.jsx)(`p`,{className:`p-3 text-sm text-muted-foreground`,children:i??`No repositories found.`}):(0,D.jsx)(`ul`,{className:`divide-y divide-border`,children:l.map(e=>(0,D.jsx)(`li`,{children:(0,D.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-3 px-3 py-2 hover:bg-accent`,children:[(0,D.jsx)(k,{checked:t.includes(e.path),onCheckedChange:()=>n(e),"aria-label":e.name}),(0,D.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,D.jsx)(`span`,{className:`block truncate text-sm font-medium`,children:e.name}),(0,D.jsx)(`span`,{className:`block truncate font-mono text-xs text-muted-foreground`,children:e.path})]}),(0,D.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:e.defaultBranch})]})},e.path))})})]})}function j({onCreated:e}){let[t,n]=(0,S.useState)(!1),[r,i]=(0,S.useState)(``),[a,o]=(0,S.useState)(null),s=x(),c=async()=>{o(null);try{let{repo:t}=await s.mutateAsync(r.trim());i(``),n(!1),e(t)}catch(e){o(e instanceof Error?e.message:String(e))}};return t?(0,D.jsxs)(`div`,{className:`mt-1.5 flex flex-col gap-1.5`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(h,{value:r,onChange:e=>i(e.target.value),onKeyDown:e=>e.key===`Enter`&&r.trim()&&c(),placeholder:`new-repo-name`,className:`h-7 font-mono text-xs`,"aria-label":`New repository name`,autoFocus:!0}),(0,D.jsxs)(d,{size:`xs`,onClick:c,disabled:!r.trim()||s.isPending,children:[s.isPending?(0,D.jsx)(v,{}):null,`Create`]}),(0,D.jsx)(d,{size:`xs`,variant:`ghost`,onClick:()=>{n(!1),o(null)},children:`Cancel`})]}),a&&(0,D.jsx)(`p`,{className:`text-xs text-destructive-foreground`,children:a})]}):(0,D.jsxs)(`button`,{type:`button`,onClick:()=>n(!0),className:`mt-1.5 inline-flex cursor-pointer items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground`,children:[(0,D.jsx)(me,{className:`size-3.5`}),` Scaffold a brand-new repository`]})}export{A as n,k as r,j as t};
@@ -1 +0,0 @@
1
- import{_ as e,b as t,d as n,g as r,i,l as a,m as o,n as s,o as c,p as l,t as u}from"./button-cPldH5S4.js";import{$n as d,Ft as f,Ht as p,M as m,Mn as ee,S as te,St as h,Ut as ne,Vn as re,Xn as ie,Zn as ae,bt as oe,er as se,rr as g,t as _,tr as v,wt as ce,xt as le}from"./spinner-DXt6mnJk.js";import{t as ue}from"./useAriaLabelledBy-CjNlctb9.js";import{t as y}from"./Separator-Chx6O62Y.js";import{A as b,M as x,N as S,at as C,ct as de,ht as w,j as T,k as E}from"./index-CllPiiFL.js";import{t as D}from"./card-82INhRRE.js";import{t as O}from"./badge-BnkhqVEF.js";import{t as k}from"./label-JFgMNsTn.js";var A=t(e(),1),j=r(),M=s(`relative rounded-xl border px-3.5 py-3 text-card-foreground text-sm`,{defaultVariants:{variant:`default`},variants:{variant:{default:`bg-transparent dark:bg-input/32 [&_svg]:text-muted-foreground`,error:`border-destructive/32 bg-destructive/4 text-destructive-foreground [&_[data-slot=alert-description]]:text-destructive-foreground/80 [&_svg]:text-destructive`,info:`border-info/32 bg-info/4 [&_svg]:text-info`,success:`border-success/32 bg-success/4 [&_svg]:text-success`,warning:`border-warning/32 bg-warning/4 [&_svg]:text-warning`}}});function N(e){let t=e.props[`data-slot`];if(t)return t;let n=e.type;switch(n.displayName??n.name){case`AlertAction`:return`alert-action`;case`AlertTitle`:return`alert-title`;case`AlertDescription`:return`alert-description`;default:return}}function P({className:e,variant:t,children:n,...r}){let i=[],a=[],s=[];return A.Children.forEach(n,e=>{if(!(0,A.isValidElement)(e)){a.push(e);return}let t=N(e);t===`alert-action`?s.push(e):t===`alert-title`||t===`alert-description`?a.push(e):i.push(e)}),(0,j.jsx)(`div`,{className:o(M({variant:t}),e),"data-slot":`alert`,role:`alert`,...r,children:(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i.length>0&&(0,j.jsx)(`div`,{className:`flex size-4 shrink-0 items-center justify-center [&>svg]:size-full`,children:i}),a.length>0&&(0,j.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:a}),s.length>0&&(0,j.jsx)(`div`,{className:`flex shrink-0 items-center self-center`,children:s})]})})}function F({className:e,...t}){return(0,j.jsx)(`div`,{className:o(`font-medium`,e),"data-slot":`alert-title`,...t})}function I({className:e,...t}){return(0,j.jsx)(`div`,{className:o(`flex flex-col gap-2.5 text-muted-foreground`,e),"data-slot":`alert-description`,...t})}function L({className:e,...t}){return(0,j.jsx)(`div`,{className:o(`flex gap-1`,e),"data-slot":`alert-action`,...t})}F.displayName=`AlertTitle`,I.displayName=`AlertDescription`,L.displayName=`AlertAction`;function R({className:e,orientation:t=`horizontal`,...n}){return(0,j.jsx)(y,{className:o(`shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:not-[[class^='h-']]:not-[[class*='_h-']]:self-stretch`,e),"data-slot":`separator`,orientation:t,...n})}var z=A.createContext(void 0);function B(){let e=A.useContext(z);if(e===void 0)throw Error(n(63));return e}var V=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),H={...v,checked(e){return e?{[V.checked]:``}:{[V.unchecked]:``}}},U=A.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:o,"aria-labelledby":s,form:u,id:h,inputRef:_,name:v,nativeButton:y=!1,onCheckedChange:b,readOnly:x=!1,required:S=!1,disabled:C=!1,render:de,uncheckedValue:w,value:T,style:E,...D}=e,{clearErrors:O}=d(),{state:k,setTouched:M,setDirty:N,validityData:P,setFilled:F,setFocused:I,validationMode:L,disabled:R,name:B,validation:V}=se(),{labelId:U}=ie(),W=R||C,G=B??v,K=A.useRef(null),fe=a(K,_,V.inputRef),q=A.useRef(null),J=ae(),Y=ee({id:h,implicit:!1,controlRef:q}),X=y?void 0:Y,[Z,Q]=ne({controlled:n,default:!!o,name:`Switch`,state:`checked`});p(q,J,Z,void 0,!W,v),g(()=>{K.current&&F(K.current.checked)},[K,F]),m(Z,()=>{O(G),N(Z!==P.initialValue),F(Z),V.change(Z)});let{getButtonProps:pe,buttonRef:me}=te({disabled:W,native:y}),he=ue(s,U,K,!y,X),ge={id:y?Y:J,role:`switch`,"aria-checked":Z,"aria-readonly":x||void 0,"aria-required":S||void 0,"aria-labelledby":he,onFocus(){W||I(!0)},onBlur(){let e=K.current;!e||W||(M(!0),I(!1),L===`onBlur`&&V.commit(e.checked))},onClick(e){if(x||W)return;e.preventDefault();let t=K.current;t&&t.dispatchEvent(new(re(t)).PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey}))}},_e=l({checked:Z,disabled:W,form:u,id:X,name:G,required:S,style:G?le:oe,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:fe,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(x){e.preventDefault();return}let t=e.currentTarget.checked,n=ce(f,e.nativeEvent);b?.(t,n),!n.isCanceled&&Q(t)},onFocus(){q.current?.focus()}},e=>V.getValidationProps(W,e),T===void 0?c:{value:T}),$=A.useMemo(()=>({...k,checked:Z,disabled:W,readOnly:x,required:S}),[k,Z,W,x,S]),ve=i(`span`,e,{state:$,ref:[t,q,me],props:[ge,D,pe,e=>V.getValidationProps(W,e)],stateAttributesMapping:H});return(0,j.jsxs)(z.Provider,{value:$,children:[ve,!Z&&G&&w!==void 0&&(0,j.jsx)(`input`,{type:`hidden`,form:u,name:G,value:w,disabled:W}),(0,j.jsx)(`input`,{..._e,suppressHydrationWarning:!0})]})}),W=A.forwardRef(function(e,t){let{render:n,className:r,style:a,...o}=e;return i(`span`,e,{state:B(),ref:t,stateAttributesMapping:H,props:o})});function G({className:e,...t}){return(0,j.jsx)(U,{className:o(`inline-flex h-[calc(var(--thumb-size)+2px)] w-[calc(var(--thumb-size)*2-2px)] shrink-0 cursor-pointer items-center rounded-full p-px outline-none transition-[background-color,box-shadow] duration-200 [--thumb-size:--spacing(5)] focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background data-checked:bg-primary data-unchecked:bg-input data-disabled:cursor-not-allowed data-disabled:opacity-64 sm:[--thumb-size:--spacing(4)]`,e),"data-slot":`switch`,...t,children:(0,j.jsx)(W,{className:o(`pointer-events-none block aspect-square h-full origin-left in-[[role=switch]:active,[data-slot=label]:active,[data-slot=field-label]:active]:not-data-disabled:scale-x-110 in-[[role=switch]:active,[data-slot=label]:active,[data-slot=field-label]:active]:rounded-[var(--thumb-size)/calc(var(--thumb-size)*1.1)] rounded-(--thumb-size) bg-background shadow-sm/5 will-change-transform [transition:translate_.15s,border-radius_.15s,scale_.1s_.1s,transform-origin_.15s] data-checked:origin-[var(--thumb-size)_50%] data-checked:translate-x-[calc(var(--thumb-size)-4px)]`),"data-slot":`switch-thumb`})})}function K({config:e,setConfig:t,saveStatus:n,editors:r,adapters:i,saveAppConfig:a,isSettingsFormValid:o,toolsStatus:s,toolsLoading:c,updatingToolId:l,fetchToolsStatus:d,handleUpdateTool:f}){if(!e)return null;let p=r.find(t=>t.command===e.defaultEditor),m=i.find(t=>t.name===(e.storageProvider||`local`));return(0,j.jsxs)(`div`,{className:`mx-auto max-w-4xl animate-fade-in`,children:[(0,j.jsxs)(`header`,{className:`mb-6`,children:[(0,j.jsx)(`h1`,{className:`text-xl font-semibold text-foreground`,children:`Global Settings`}),(0,j.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Configure your local directories, search parameters, and editor defaults.`})]}),n===`success`&&(0,j.jsxs)(P,{variant:`success`,className:`mb-6`,children:[(0,j.jsx)(w,{size:18}),` Settings successfully saved and updated!`]}),n===`error`&&(0,j.jsxs)(P,{variant:`error`,className:`mb-6`,children:[(0,j.jsx)(C,{size:18}),` Error: Could not save configuration details to disk.`]}),(0,j.jsx)(D,{className:`mb-6 rounded-xl p-6 shadow-sm`,children:(0,j.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 md:grid-cols-2`,children:[(0,j.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,j.jsx)(k,{className:`text-sm`,children:`Development Directory`}),(0,j.jsx)(h,{type:`text`,value:e.devDir,onChange:n=>t({...e,devDir:n.target.value})}),(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Directory where your git projects are scanned.`})]}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,j.jsx)(k,{className:`text-sm`,children:`Workspaces Directory`}),(0,j.jsx)(h,{type:`text`,value:e.workspacesDir,onChange:n=>t({...e,workspacesDir:n.target.value})}),(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Directory where unified worktree environments are spun up.`})]}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,j.jsx)(k,{className:`text-sm`,children:`Repo Search Depth`}),(0,j.jsx)(h,{type:`number`,min:1,max:5,value:e.scanDepth,onChange:n=>t({...e,scanDepth:parseInt(n.target.value,10)})}),(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Max directory levels deep the system will traverse for git repos.`})]}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,j.jsx)(k,{className:`text-sm`,children:`Default Assistant`}),(0,j.jsxs)(E,{value:e.defaultAssistant||``,onValueChange:n=>typeof n==`string`&&t({...e,defaultAssistant:n||null}),children:[(0,j.jsx)(x,{"aria-label":`Default Assistant`,children:(0,j.jsx)(S,{children:e.defaultAssistant===`claude`?`Claude Code`:e.defaultAssistant===`antigravity`?`Antigravity`:e.defaultAssistant===`codex`?`Codex`:e.defaultAssistant===`copilot`?`GitHub Copilot`:e.defaultAssistant===`cursor`?`Cursor`:`None (Prompt me)`})}),(0,j.jsxs)(T,{alignItemWithTrigger:!1,children:[(0,j.jsx)(b,{value:``,children:`None (Prompt me)`}),(0,j.jsx)(b,{value:`claude`,children:`Claude Code`}),(0,j.jsx)(b,{value:`antigravity`,children:`Antigravity`}),(0,j.jsx)(b,{value:`codex`,children:`Codex`}),(0,j.jsx)(b,{value:`copilot`,children:`GitHub Copilot`}),(0,j.jsx)(b,{value:`cursor`,children:`Cursor`})]})]}),(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Your preferred workspace context manager.`})]}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,j.jsx)(k,{className:`text-sm`,children:`Preferred Editor`}),(0,j.jsxs)(E,{value:e.defaultEditor||``,onValueChange:n=>typeof n==`string`&&t({...e,defaultEditor:n||null}),children:[(0,j.jsx)(x,{"aria-label":`Preferred Editor`,children:(0,j.jsx)(S,{children:p?`${p.name} ${p.detected?`(Detected)`:`(Not found)`}`:`No preference`})}),(0,j.jsxs)(T,{alignItemWithTrigger:!1,children:[(0,j.jsx)(b,{value:``,children:`No preference`}),r.map(e=>(0,j.jsxs)(b,{value:e.command,children:[e.name,` `,e.detected?`(Detected)`:`(Not found)`]},e.command))]})]}),(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Shown first in the “Open with…” workspace chooser.`})]}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-4 md:col-span-2`,children:[(0,j.jsx)(R,{className:`mt-1`}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Workspace Storage Settings`}),(0,j.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Choose where maps, plans, and knowledge files are stored.`})]}),(0,j.jsxs)(`div`,{className:`flex max-w-md flex-col gap-1.5`,children:[(0,j.jsx)(k,{htmlFor:`storageProvider`,className:`text-sm`,children:`Storage Provider`}),(0,j.jsxs)(E,{value:e.storageProvider||`local`,onValueChange:n=>{if(typeof n!=`string`)return;let r=n,a={...e,storageProvider:r},o=i.find(e=>e.name===r);o?.configFields?.length&&(a.adapterConfig||={},a.adapterConfig[r]||(a.adapterConfig[r]={}),o.configFields.forEach(e=>{a.adapterConfig[r][e.key]===void 0&&e.default!==void 0&&(a.adapterConfig[r][e.key]=e.default)})),t(a)},children:[(0,j.jsx)(x,{id:`storageProvider`,"aria-label":`Storage Provider`,children:(0,j.jsx)(S,{children:m?.displayName??`Local Workspace (Folders)`})}),(0,j.jsx)(T,{alignItemWithTrigger:!1,children:i.length>0?i.map(e=>(0,j.jsx)(b,{value:e.name,children:e.displayName},e.name)):(0,j.jsx)(b,{value:`local`,children:`Local Workspace (Folders)`})})]}),(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:m?.description||`Choose where to store maps, plans, and knowledge files. Centralized vault keeps repositories 100% clean and allows Obsidian integration.`})]}),(()=>{let n=e.storageProvider||`local`,r=i.find(e=>e.name===n);return r?.configFields?.length?(0,j.jsxs)(`div`,{className:`flex max-w-md flex-col gap-4 rounded-xl border border-border bg-muted/40 p-4`,children:[(0,j.jsxs)(`h4`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:[r.displayName,` Settings`]}),r.configFields.map(r=>{let i=e.adapterConfig?.[n]?.[r.key]??r.default??``,a=i=>{let a={...e.adapterConfig||{},[n]:{...e.adapterConfig?.[n]||{},[r.key]:i}};t({...e,adapterConfig:a})};return r.type===`boolean`?(0,j.jsxs)(k,{className:`flex cursor-pointer items-start gap-3 text-sm`,children:[(0,j.jsx)(G,{checked:!!i,onCheckedChange:e=>a(e)}),(0,j.jsxs)(`span`,{className:`flex flex-col`,children:[(0,j.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:r.label}),r.description&&(0,j.jsx)(`span`,{className:`mt-0.5 text-xs leading-normal text-muted-foreground`,children:r.description})]})]},r.key):(0,j.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,j.jsx)(k,{className:`text-sm`,children:r.label}),(0,j.jsx)(h,{type:r.type===`number`?`number`:`text`,value:i,onChange:e=>{let t=r.type===`number`?Number(e.target.value):e.target.value;a(t)}}),r.description&&(0,j.jsx)(`span`,{className:`text-xs leading-normal text-muted-foreground`,children:r.description})]},r.key)})]}):null})()]})]})}),(0,j.jsxs)(D,{className:`mt-6 rounded-xl p-6 shadow-sm`,children:[(0,j.jsxs)(`div`,{className:`mb-6 flex items-start justify-between gap-4`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h3`,{className:`text-lg font-semibold text-foreground`,children:`AI Toolchain Updates`}),(0,j.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Monitor and update the CLI packages and assistants in your workflow.`})]}),(0,j.jsxs)(u,{variant:`outline`,size:`sm`,onClick:()=>d(!0),disabled:c,children:[c?(0,j.jsx)(_,{className:`size-3`}):(0,j.jsx)(de,{size:13}),c?`Checking...`:`Check Now`]})]}),c&&s.length===0?(0,j.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 py-8 text-muted-foreground`,children:[(0,j.jsx)(_,{className:`size-6`}),(0,j.jsx)(`span`,{className:`text-xs`,children:`Fetching registry version details...`})]}):s.length===0?(0,j.jsx)(`p`,{className:`py-4 text-xs text-muted-foreground`,children:`No toolchain information available.`}):(0,j.jsx)(`div`,{className:`space-y-4`,children:s.map(e=>(0,j.jsxs)(`div`,{className:`flex flex-col gap-4 rounded-xl border border-border bg-muted/30 p-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsxs)(`h4`,{className:`flex items-center gap-2 text-sm font-semibold text-foreground`,children:[e.name,(0,j.jsx)(O,{variant:e.installed?`success`:`secondary`,size:`sm`,children:e.installed?`Installed`:`Not Installed`})]}),(0,j.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:[(0,j.jsxs)(`span`,{children:[`Installed version: `,(0,j.jsx)(`code`,{className:`font-mono text-[10px] text-foreground`,children:e.currentVersion})]}),e.installed&&(0,j.jsxs)(`span`,{children:[`Latest: `,(0,j.jsx)(`code`,{className:`font-mono text-[10px] text-foreground`,children:e.latestVersion})]})]}),(0,j.jsx)(`p`,{className:`mt-1 font-mono text-[10px] text-muted-foreground`,children:e.updateCmd})]}),(0,j.jsx)(`div`,{className:`flex shrink-0 items-center gap-3`,children:e.updateAvailable?(0,j.jsx)(u,{size:`sm`,onClick:()=>f(e.id),disabled:l!==null,children:l===e.id?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(_,{className:`size-3`}),` Updating...`]}):`Update Tool`}):e.installed?(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsxs)(O,{variant:`success`,className:`gap-1.5`,children:[(0,j.jsx)(w,{size:12}),` Up to Date`]}),(0,j.jsx)(u,{variant:`outline`,size:`sm`,onClick:()=>f(e.id),disabled:l!==null,children:l===e.id?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(_,{className:`size-3`}),` Reinstalling...`]}):`Reinstall`})]}):(0,j.jsx)(u,{variant:`outline`,size:`sm`,onClick:()=>f(e.id),disabled:l!==null,children:l===e.id?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(_,{className:`size-3`}),` Installing...`]}):`Install CLI`})})]},e.id))})]}),(0,j.jsx)(`div`,{className:`mb-10 flex justify-end pt-4`,children:(0,j.jsxs)(u,{onClick:()=>a(e),disabled:!o,children:[(0,j.jsx)(w,{size:16}),` Save Configuration`]})})]})}export{K as SettingsPage};
@@ -1 +0,0 @@
1
- import{_ as e,b as t,g as n,h as r,m as i,t as a}from"./button-cPldH5S4.js";import{St as o,t as s}from"./spinner-DXt6mnJk.js";import{S as ee}from"./useCompositeListItem-DWGFLKqA.js";import{t as c}from"./WorkspaceLauncher-Cxv0O_wt.js";import{n as te,r as ne,t as re}from"./ScaffoldRepoInline-DqoourJe.js";import{t as l}from"./git-branch-Dw55pQWa.js";import{A as u,G as ie,H as ae,K as d,M as f,N as p,R as oe,X as m,dt as se,et as ce,ht as h,i as le,it as ue,j as g,k as _,mt as v,n as de,ot as y,q as fe,r as pe,rt as me,s as he,tt as ge,vt as b}from"./index-CllPiiFL.js";import{t as x}from"./textarea-BLU5HXmZ.js";var S=r(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),C=t(e(),1),w={status:`idle`,steps:[]};function _e(){let[e,t]=(0,C.useState)(w),n=(0,C.useRef)(null),r=b(),i=(0,C.useCallback)(()=>{n.current?.close(),n.current=null},[]);return(0,C.useEffect)(()=>i,[i]),{progress:e,start:(0,C.useCallback)(e=>{i(),t({status:`running`,steps:[]});let a=new EventSource(`/api/workspace/create-stream/${encodeURIComponent(e)}`);n.current=a;let o=0;a.addEventListener(`progress`,n=>{o=0;try{let a=JSON.parse(n.data);t({status:a.status===`completed`||a.status===`failed`?a.status:`running`,steps:a.steps??[],error:a.error,workspacePath:a.workspacePath,workspaceId:a.feature?.id??e}),(a.status===`completed`||a.status===`failed`)&&(i(),r.invalidateQueries({queryKey:[`workspaces`]}),r.invalidateQueries({queryKey:[`workspaces-status`]}))}catch{}}),a.onerror=()=>{o+=1,!(a.readyState!==EventSource.CLOSED&&o<5)&&(t(e=>e.status===`running`?{...e,status:`failed`,error:e.error??`Lost connection to the creation stream.`}:e),i())}},[i,r]),reset:(0,C.useCallback)(()=>{i(),t(w)},[i])}}var T=n(),E=`__ad-hoc__`,ve=new URLSearchParams(window.location.search).get(`env`)===`vscode`,ye=[{value:`in-place`,icon:S,title:`In-place`,body:`Work directly in the source repos. No branches or worktrees — fastest start.`},{value:`worktree`,icon:l,title:`Isolated worktrees`,body:`A feature branch and worktree per repo. Your source checkouts stay untouched.`}];function be({repo:e,value:t,onChange:n,enabled:r}){let i=d(e.path,r),a=(0,C.useMemo)(()=>[...new Set([...i.data?.local??[],...i.data?.remote??[]])],[i.data]),s=`branches-${e.path.replace(/[^a-zA-Z0-9]/g,`-`)}`;return(0,T.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`span`,{className:`w-40 shrink-0 truncate text-xs`,children:e.name}),(0,T.jsx)(o,{list:s,value:t,onChange:e=>n(e.target.value),placeholder:`existing branch (must exist)`,className:`h-7 font-mono text-xs`}),(0,T.jsx)(`datalist`,{id:s,children:a.map(e=>(0,T.jsx)(`option`,{value:e},e))})]})}function xe({step:e}){return(0,T.jsxs)(`li`,{className:`flex items-center gap-3 py-2`,children:[(0,T.jsx)(`span`,{className:i(`grid size-5 shrink-0 place-items-center rounded-full border`,e.status===`completed`&&`border-success bg-success/15 text-success-foreground`,e.status===`running`&&`border-primary text-primary`,e.status===`failed`&&`border-destructive bg-destructive/15 text-destructive-foreground`,e.status===`pending`&&`border-border text-muted-foreground`),children:e.status===`completed`?(0,T.jsx)(h,{className:`size-3`}):e.status===`running`?(0,T.jsx)(s,{className:`size-3`}):e.status===`failed`?(0,T.jsx)(v,{className:`size-3`}):null}),(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsx)(`p`,{className:`text-sm font-medium`,children:e.name}),(0,T.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e.message})]})]})}function D(){let e=me(),[t]=ue(),n=ie(),r=fe(),l=oe(),d=m(),h=ae(),{progress:v,start:b}=_e(),[S,w]=(0,C.useState)(t.get(`project`)??E),[D,O]=(0,C.useState)(`in-place`),[k,Se]=(0,C.useState)(``),[A,j]=(0,C.useState)(``),[M,Ce]=(0,C.useState)(``),[N,P]=(0,C.useState)([]),[F,we]=(0,C.useState)(!1),[I,L]=(0,C.useState)([]),[R,z]=(0,C.useState)(``),[B,V]=(0,C.useState)(``),[H,U]=(0,C.useState)(!1),[W,G]=(0,C.useState)(null),[K,Te]=(0,C.useState)({}),[Ee,De]=(0,C.useState)(!1),[q,J]=(0,C.useState)(null),Y=(0,C.useRef)(!1);(0,C.useEffect)(()=>{!Y.current&&l.data&&(Y.current=!0,L(l.data.filter(e=>e.detected).map(e=>e.name)))},[l.data]);let X=(0,C.useMemo)(()=>(n.data??[]).find(e=>e.id===S)??null,[n.data,S]),Z=(0,C.useMemo)(()=>X?X.repos.map(e=>({name:he(e.path),path:e.path,defaultBranch:e.defaultBranch})):(r.data??[]).filter(e=>N.includes(e.path)),[X,r.data,N]),Q=D===`in-place`,Oe=(Q?A.trim().length>0:k.trim().length>0)&&Z.length>0&&M.trim().length>0,ke=e=>{z(e),G(null);let t=(d.data??[]).find(t=>t.id===e);V(t?.content??``)},Ae=async()=>{if(!M.trim()){J(`Describe what you are building first — the suggestion is based on it.`);return}J(null),U(!0);try{let e=await ce(`/api/workspace/suggest-workflow`,{method:`POST`,body:JSON.stringify({description:M,repos:Z})});z(e.suggestedWorkflowId),V(e.customInstructions),G(e.difficulty)}catch(e){J(e instanceof Error?e.message:String(e))}finally{U(!1)}},je=async()=>{J(null);let e={mode:D,projectId:X?.id,...Q?{name:A.trim()}:{branchName:k.trim()},description:M.trim(),repos:Z.map(e=>({...e,existingBranch:!Q&&K[e.path]?.trim()?K[e.path].trim():void 0})),assistants:I,teamworkInstructions:B.trim()||void 0};try{let{jobId:t}=await h.mutateAsync(e);b(t)}catch(e){J(e instanceof Error?e.message:String(e))}},$=I.find(e=>le(e)!==null);if(v.status!==`idle`){let t=v.steps.find(e=>e.status===`failed`);return(0,T.jsxs)(`div`,{className:`mx-auto max-w-xl animate-fade-in`,children:[(0,T.jsx)(`h1`,{className:`text-xl font-semibold`,children:v.status===`running`?`Setting up your workspace…`:v.status===`completed`?`Workspace ready`:`Workspace creation failed`}),(0,T.jsx)(`ul`,{className:`mt-6 divide-y divide-border rounded-xl border border-border bg-card px-4`,children:v.steps.map(e=>(0,T.jsx)(xe,{step:e},e.id))}),v.status===`failed`&&(0,T.jsx)(`p`,{className:`mt-4 text-sm text-destructive-foreground`,children:t?.message??v.error??`Something went wrong.`}),v.status===`completed`&&v.workspacePath&&(0,T.jsx)(`p`,{className:`mt-4 truncate font-mono text-xs text-muted-foreground`,children:v.workspacePath}),v.status===`completed`&&$&&(0,T.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`Embedded start allows edits inside this workspace; you can switch to Review only in chat.`}),q&&(0,T.jsx)(`p`,{className:`mt-2 text-sm text-destructive-foreground`,children:q}),(0,T.jsxs)(`div`,{"data-testid":`workspace-ready-actions`,className:`mt-6 flex min-w-0 flex-col gap-2 sm:flex-row sm:flex-wrap`,children:[v.status===`completed`&&v.workspaceId&&(0,T.jsxs)(T.Fragment,{children:[$&&(0,T.jsxs)(a,{className:`w-full min-w-0 whitespace-normal sm:w-auto`,onClick:()=>e(`/workspaces/${encodeURIComponent(v.workspaceId)}`,{state:{chatLaunch:pe($,{kickoff:`Read the workspace instructions and implementation plan, inspect the repository state, then begin the task described for this workspace. Ask before making a decision that materially changes scope.`,executionProfile:`workspace-write`})}}),children:[(0,T.jsx)(y,{}),`Start editing with `,de($)]}),(0,T.jsx)(a,{className:`w-full min-w-0 whitespace-normal sm:w-auto`,variant:$?`outline`:void 0,onClick:()=>e(`/workspaces/${encodeURIComponent(v.workspaceId)}`),children:`Open workspace`}),v.workspacePath&&(0,T.jsx)(c,{workspaceId:v.workspaceId,workspacePath:v.workspacePath,isVsCode:ve,className:`w-full min-w-0 whitespace-normal sm:w-auto`})]}),v.status===`failed`&&(0,T.jsx)(a,{variant:`outline`,onClick:()=>window.location.reload(),children:`Start over`}),v.status===`running`&&(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This can take a moment for large repositories.`})]})]})}return(0,T.jsxs)(`div`,{className:`mx-auto max-w-xl animate-fade-in`,children:[(0,T.jsxs)(`header`,{className:`mb-6`,children:[(0,T.jsx)(`h1`,{className:`text-xl font-semibold`,children:`Start work`}),(0,T.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Pick where the work happens and how isolated it should be.`})]}),(0,T.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,T.jsxs)(`section`,{children:[(0,T.jsx)(`span`,{className:`mb-1.5 block text-sm font-medium`,children:`Project`}),(0,T.jsxs)(_,{value:S,onValueChange:e=>typeof e==`string`&&w(e),children:[(0,T.jsx)(f,{className:`w-full`,"aria-label":`Project`,children:(0,T.jsx)(p,{children:X?X.name:`Ad-hoc — pick repositories manually`})}),(0,T.jsxs)(g,{alignItemWithTrigger:!1,children:[(n.data??[]).map(e=>(0,T.jsx)(u,{value:e.id,children:e.name},e.id)),(0,T.jsx)(u,{value:E,children:`Ad-hoc — pick repositories manually`})]})]}),X?(0,T.jsx)(`ul`,{className:`mt-2 flex flex-col gap-0.5`,children:X.repos.map(e=>(0,T.jsx)(`li`,{className:`truncate font-mono text-xs text-muted-foreground`,children:e.path},e.path))}):(0,T.jsxs)(`div`,{className:`mt-2`,children:[(0,T.jsx)(te,{repos:r.data??[],selectedPaths:N,onToggle:e=>P(t=>t.includes(e.path)?t.filter(t=>t!==e.path):[...t,e.path]),loading:r.isLoading}),(0,T.jsx)(re,{onCreated:e=>P(t=>[...t,e.path])})]}),(n.data??[]).length===0&&!n.isLoading&&(0,T.jsxs)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:[`Tip: `,(0,T.jsx)(ge,{to:`/projects`,className:`text-primary hover:underline`,children:`register a project`}),` to skip repo picking next time.`]})]}),(0,T.jsxs)(`section`,{children:[(0,T.jsx)(`span`,{className:`mb-1.5 block text-sm font-medium`,children:`How do you want to work?`}),(0,T.jsx)(`div`,{role:`radiogroup`,"aria-label":`Work mode`,className:`grid gap-3 sm:grid-cols-2`,onKeyDown:e=>{if([`ArrowRight`,`ArrowDown`,`ArrowLeft`,`ArrowUp`].includes(e.key)){e.preventDefault();let t=D===`in-place`?`worktree`:`in-place`;O(t),document.getElementById(`mode-${t}`)?.focus()}},children:ye.map(e=>(0,T.jsxs)(`button`,{id:`mode-${e.value}`,type:`button`,role:`radio`,"aria-checked":D===e.value,tabIndex:D===e.value?0:-1,onClick:()=>O(e.value),className:i(`cursor-pointer rounded-xl border p-4 text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring`,D===e.value?`border-primary bg-primary/5 ring-1 ring-primary`:`border-border bg-card hover:border-foreground/20`),children:[(0,T.jsx)(e.icon,{className:i(`size-4`,D===e.value?`text-primary`:`text-muted-foreground`)}),(0,T.jsx)(`p`,{className:`mt-2 text-sm font-semibold`,children:e.title}),(0,T.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e.body})]},e.value))})]}),(0,T.jsx)(`section`,{children:Q?(0,T.jsxs)(`label`,{className:`block`,children:[(0,T.jsx)(`span`,{className:`mb-1 block text-sm font-medium`,children:`Workspace name`}),(0,T.jsx)(o,{value:A,onChange:e=>j(e.target.value),placeholder:`e.g. Fix invoice rounding`})]}):(0,T.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,T.jsxs)(`label`,{className:`block`,children:[(0,T.jsx)(`span`,{className:`mb-1 block text-sm font-medium`,children:`Feature branch`}),(0,T.jsx)(o,{value:k,onChange:e=>Se(e.target.value),placeholder:`e.g. feature/invoice-rounding`,className:`font-mono`})]}),Z.length>0&&(0,T.jsxs)(`details`,{className:`rounded-lg border border-border px-3 py-2`,onToggle:e=>De(e.target.open),children:[(0,T.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-muted-foreground`,children:`Use an existing branch for specific repos (optional)`}),(0,T.jsx)(`div`,{className:`mt-2 flex flex-col gap-2`,children:Z.map(e=>(0,T.jsx)(be,{repo:e,enabled:Ee,value:K[e.path]??``,onChange:t=>Te(n=>({...n,[e.path]:t}))},e.path))})]})]})}),(0,T.jsx)(`section`,{children:(0,T.jsxs)(`label`,{className:`block`,children:[(0,T.jsx)(`span`,{className:`mb-1 block text-sm font-medium`,children:`What are you building?`}),(0,T.jsx)(x,{value:M,onChange:e=>Ce(e.target.value),placeholder:`A short description — your AI assistant reads this to plan the work.`,rows:3})]})}),(0,T.jsxs)(`section`,{className:`rounded-xl border border-border`,children:[(0,T.jsxs)(`button`,{type:`button`,onClick:()=>we(e=>!e),className:`flex w-full items-center justify-between px-4 py-3 text-sm font-medium hover:bg-accent`,"aria-expanded":F,children:[`Advanced`,(0,T.jsx)(ee,{className:i(`size-4 text-muted-foreground transition-transform`,F&&`rotate-180`)})]}),F&&(0,T.jsxs)(`div`,{className:`flex flex-col gap-4 border-t border-border p-4`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`span`,{className:`mb-1.5 block text-sm font-medium`,children:`AI assistants`}),(0,T.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:(l.data??[]).map(e=>(0,T.jsxs)(`label`,{className:i(`flex cursor-pointer items-center gap-2 rounded-lg border border-border px-3 py-1.5 text-sm`,!e.detected&&`opacity-50`),children:[(0,T.jsx)(ne,{checked:I.includes(e.name),onCheckedChange:()=>L(t=>t.includes(e.name)?t.filter(t=>t!==e.name):[...t,e.name])}),e.displayName]},e.name))})]}),(0,T.jsxs)(`div`,{children:[(0,T.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between`,children:[(0,T.jsx)(`span`,{className:`text-sm font-medium`,children:`Teamwork strategy`}),(0,T.jsxs)(a,{size:`xs`,variant:`outline`,onClick:Ae,disabled:H,children:[H?(0,T.jsx)(s,{}):(0,T.jsx)(y,{}),`Suggest with AI`]})]}),(0,T.jsxs)(_,{value:R,onValueChange:e=>typeof e==`string`&&ke(e),children:[(0,T.jsx)(f,{className:`w-full`,"aria-label":`Teamwork strategy`,children:(0,T.jsx)(p,{children:(d.data??[]).find(e=>e.id===R)?.name??`None`})}),(0,T.jsxs)(g,{alignItemWithTrigger:!1,children:[(0,T.jsx)(u,{value:``,children:`None`}),(d.data??[]).map(e=>(0,T.jsx)(u,{value:e.id,children:e.name},e.id))]})]}),W&&(0,T.jsxs)(`p`,{className:`mt-1.5 text-xs text-muted-foreground`,children:[`AI classified this task as `,(0,T.jsx)(`span`,{className:`font-medium`,children:W}),` difficulty.`]}),(0,T.jsx)(x,{value:B,onChange:e=>V(e.target.value),placeholder:`Cooperation instructions for the agent team (editable — prefilled by the strategy pick or AI suggestion).`,rows:4,className:`mt-2 font-mono text-xs`})]})]})]}),q&&(0,T.jsx)(`p`,{className:`text-sm text-destructive-foreground`,children:q}),(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-4 border-t border-border pt-4`,children:[(0,T.jsxs)(`p`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,T.jsx)(se,{className:`size-3.5`}),Z.length,` repositor`,Z.length===1?`y`:`ies`,` selected`]}),(0,T.jsxs)(a,{onClick:je,disabled:!Oe||h.isPending,children:[h.isPending?(0,T.jsx)(s,{}):null,Q?`Start working`:`Create workspace`]})]})]})]})}export{D as StartWorkPage};
@@ -1 +0,0 @@
1
- import{_ as e,b as t,g as n,h as r,m as i,t as a}from"./button-cPldH5S4.js";import{t as o}from"./spinner-DXt6mnJk.js";import{Z as s,ct as c,d as l,et as u,g as d,h as f,m as p,p as m,u as h,z as g}from"./index-CllPiiFL.js";var _=r(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),v=r(`orbit`,[[`path`,{d:`M20.341 6.484A10 10 0 0 1 10.266 21.85`,key:`1enhxb`}],[`path`,{d:`M3.659 17.516A10 10 0 0 1 13.74 2.152`,key:`1crzgf`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`circle`,{cx:`19`,cy:`5`,r:`2`,key:`mhkx31`}],[`circle`,{cx:`5`,cy:`19`,r:`2`,key:`v8kfzx`}]]),y=r(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),b=t(e(),1),x={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},S=b.createContext&&b.createContext(x),C=[`attr`,`size`,`title`];function w(e,t){if(e==null)return{};var n,r,i=T(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function T(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function E(){return E=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},E.apply(null,arguments)}function D(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function O(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?D(Object(n),!0).forEach(function(t){k(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):D(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function k(e,t,n){return(t=A(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function A(e){var t=j(e,`string`);return typeof t==`symbol`?t:t+``}function j(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function M(e){return e&&e.map((e,t)=>b.createElement(e.tag,O({key:t},e.attr),M(e.child)))}function N(e){return t=>b.createElement(P,E({attr:O({},e.attr)},t),M(e.child))}function P(e){var t=t=>{var n=e.attr,r=e.size,i=e.title,a=w(e,C),o=r||t.size||`1em`,s;return t.className&&(s=t.className),e.className&&(s=(s?s+` `:``)+e.className),b.createElement(`svg`,E({stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`},t.attr,n,a,{className:s,style:O(O({color:e.color||t.color},t.style),e.style),height:o,width:o,xmlns:`http://www.w3.org/2000/svg`}),i&&b.createElement(`title`,null,i),e.children)};return S===void 0?t(x):b.createElement(S.Consumer,null,e=>t(e))}function F(e){return N({tag:`svg`,attr:{fill:`currentColor`,viewBox:`0 0 16 16`},child:[{tag:`path`,attr:{d:`M14.949 6.547a3.94 3.94 0 0 0-.348-3.273 4.11 4.11 0 0 0-4.4-1.934A4.1 4.1 0 0 0 8.423.2 4.15 4.15 0 0 0 6.305.086a4.1 4.1 0 0 0-1.891.948 4.04 4.04 0 0 0-1.158 1.753 4.1 4.1 0 0 0-1.563.679A4 4 0 0 0 .554 4.72a3.99 3.99 0 0 0 .502 4.731 3.94 3.94 0 0 0 .346 3.274 4.11 4.11 0 0 0 4.402 1.933c.382.425.852.764 1.377.995.526.231 1.095.35 1.67.346 1.78.002 3.358-1.132 3.901-2.804a4.1 4.1 0 0 0 1.563-.68 4 4 0 0 0 1.14-1.253 3.99 3.99 0 0 0-.506-4.716m-6.097 8.406a3.05 3.05 0 0 1-1.945-.694l.096-.054 3.23-1.838a.53.53 0 0 0 .265-.455v-4.49l1.366.778q.02.011.025.035v3.722c-.003 1.653-1.361 2.992-3.037 2.996m-6.53-2.75a2.95 2.95 0 0 1-.36-2.01l.095.057L5.29 12.09a.53.53 0 0 0 .527 0l3.949-2.246v1.555a.05.05 0 0 1-.022.041L6.473 13.3c-1.454.826-3.311.335-4.15-1.098m-.85-6.94A3.02 3.02 0 0 1 3.07 3.949v3.785a.51.51 0 0 0 .262.451l3.93 2.237-1.366.779a.05.05 0 0 1-.048 0L2.585 9.342a2.98 2.98 0 0 1-1.113-4.094zm11.216 2.571L8.747 5.576l1.362-.776a.05.05 0 0 1 .048 0l3.265 1.86a3 3 0 0 1 1.173 1.207 2.96 2.96 0 0 1-.27 3.2 3.05 3.05 0 0 1-1.36.997V8.279a.52.52 0 0 0-.276-.445m1.36-2.015-.097-.057-3.226-1.855a.53.53 0 0 0-.53 0L6.249 6.153V4.598a.04.04 0 0 1 .019-.04L9.533 2.7a3.07 3.07 0 0 1 3.257.139c.474.325.843.778 1.066 1.303.223.526.289 1.103.191 1.664zM5.503 8.575 4.139 7.8a.05.05 0 0 1-.026-.037V4.049c0-.57.166-1.127.476-1.607s.752-.864 1.275-1.105a3.08 3.08 0 0 1 3.234.41l-.096.054-3.23 1.838a.53.53 0 0 0-.265.455zm.742-1.577 1.758-1 1.762 1v2l-1.755 1-1.762-1z`},child:[]}]})(e)}function I(e){return N({tag:`svg`,attr:{role:`img`,viewBox:`0 0 24 24`},child:[{tag:`path`,attr:{d:`M2.25 1.5a.75.75 0 0 0-.75.75v16.5H0V2.25A2.25 2.25 0 0 1 2.25 0h20.095c1.002 0 1.504 1.212.795 1.92L10.764 14.298h3.486V12.75h1.5v1.922a1.125 1.125 0 0 1-1.125 1.125H9.264l-2.578 2.578h11.689V9h1.5v9.375a1.5 1.5 0 0 1-1.5 1.5H5.185L2.562 22.5H21.75a.75.75 0 0 0 .75-.75V5.25H24v16.5A2.25 2.25 0 0 1 21.75 24H1.655C.653 24 .151 22.788.86 22.08L13.19 9.75H9.75v1.5h-1.5V9.375A1.125 1.125 0 0 1 9.375 8.25h5.314l2.625-2.625H5.625V15h-1.5V5.625a1.5 1.5 0 0 1 1.5-1.5h13.19L21.438 1.5z`},child:[]}]})(e)}function L(e){return N({tag:`svg`,attr:{role:`img`,viewBox:`0 0 24 24`},child:[{tag:`path`,attr:{d:`M23.55 5.067c-1.2038-.002-2.1806.973-2.1806 2.1765v4.8676c0 .972-.8035 1.7594-1.7597 1.7594-.568 0-1.1352-.286-1.4718-.7659l-4.9713-7.1003c-.4125-.5896-1.0837-.941-1.8103-.941-1.1334 0-2.1533.9635-2.1533 2.153v4.8957c0 .972-.7969 1.7594-1.7596 1.7594-.57 0-1.1363-.286-1.4728-.7658L.4076 5.1598C.2822 4.9798 0 5.0688 0 5.2882v4.2452c0 .2147.0656.4228.1884.599l5.4748 7.8183c.3234.462.8006.8052 1.3509.9298 1.3771.313 2.6446-.747 2.6446-2.0977v-4.893c0-.972.7875-1.7593 1.7596-1.7593h.003a1.798 1.798 0 0 1 1.4718.7658l4.9723 7.0994c.4135.5905 1.05.941 1.8093.941 1.1587 0 2.1515-.9645 2.1515-2.153v-4.8948c0-.972.7875-1.7594 1.7596-1.7594h.194a.22.22 0 0 0 .2204-.2202v-4.622a.22.22 0 0 0-.2203-.2203Z`},child:[]}]})(e)}function R(e){return N({tag:`svg`,attr:{role:`img`,viewBox:`0 0 24 24`},child:[{tag:`path`,attr:{d:`M0 0v24h24V0H0zm17.889 2.889c1.444 0 2.667.444 3.667 1.278l-1.111 1.667c-.889-.611-1.722-1-2.556-1s-1.278.389-1.278.889v.056c0 .667.444.889 2.111 1.333 2 .556 3.111 1.278 3.111 3v.056c0 2-1.5 3.111-3.611 3.111-1.5-.056-3-.611-4.167-1.667l1.278-1.556c.889.722 1.833 1.222 2.944 1.222.889 0 1.389-.333 1.389-.944v-.056c0-.556-.333-.833-2-1.278-2-.5-3.222-1.056-3.222-3.056v-.056c0-1.833 1.444-3 3.444-3zm-16.111.222h2.278l1.5 5.778 1.722-5.778h1.667l1.667 5.778 1.5-5.778h2.333l-2.833 9.944H9.723L8.112 7.277l-1.667 5.778H4.612L1.779 3.111zm.5 16.389h9V21h-9v-1.5z`},child:[]}]})(e)}function z(e){return N({tag:`svg`,attr:{role:`img`,viewBox:`0 0 24 24`},child:[{tag:`path`,attr:{d:`M20.953.004a.397.397 0 0 0-.18.017L3.225 5.585c-.175.055-.323.214-.402.398a.42.42 0 0 0-.06.22v5.726a.42.42 0 0 0 .06.22c.079.183.227.341.402.397l7.454 2.364-7.454 2.363c-.255.08-.463.374-.463.655v5.688c0 .282.208.444.463.363l17.55-5.565c.237-.075.426-.336.452-.6.003-.022.013-.04.013-.065V12.06c0-.281-.208-.575-.463-.656L13.4 9.065l7.375-2.339c.255-.08.462-.375.462-.656V.384c0-.211-.117-.355-.283-.38z`},child:[]}]})(e)}function B(e){return N({tag:`svg`,attr:{role:`img`,viewBox:`0 0 24 24`},child:[{tag:`path`,attr:{d:`M7.833 6.666v-.055c0-1-.667-1.5-1.778-1.5H4.389v3.055h1.723c1.111 0 1.721-.666 1.721-1.5zM0 0v24h24V0H0zm2.223 3.167h4c2.389 0 3.833 1.389 3.833 3.445v.055c0 2.278-1.778 3.5-4.001 3.5H4.389v2.945H2.223V3.167zM11.277 21h-9v-1.5h9V21zm4.779-7.777c-2.944.055-5.111-2.223-5.111-5.057C10.944 5.333 13.056 3 16.111 3c1.889 0 3 .611 3.944 1.556l-1.389 1.61c-.778-.722-1.556-1.111-2.556-1.111-1.658 0-2.873 1.375-2.887 3.084.014 1.709 1.174 3.083 2.887 3.083 1.111 0 1.833-.445 2.61-1.167l1.39 1.389c-.999 1.112-2.166 1.779-4.054 1.779z`},child:[]}]})(e)}function V(e){return N({tag:`svg`,attr:{role:`img`,viewBox:`0 0 24 24`},child:[{tag:`path`,attr:{d:`M0 0v24h24V0zm3.723 3.111h5v1.834h-1.39v6.277h1.39v1.834h-5v-1.834h1.444V4.945H3.723zm11.055 0H17v6.5c0 .612-.055 1.111-.222 1.556-.167.444-.39.777-.723 1.11-.277.279-.666.557-1.11.668a3.933 3.933 0 0 1-1.445.278c-.778 0-1.444-.167-1.944-.445a4.81 4.81 0 0 1-1.279-1.056l1.39-1.555c.277.334.555.555.833.722.277.167.611.278.945.278.389 0 .721-.111 1-.389.221-.278.333-.667.333-1.278zM2.222 19.5h9V21h-9z`},child:[]}]})(e)}function H(e){return N({tag:`svg`,attr:{role:`img`,viewBox:`0 0 24 24`},child:[{tag:`path`,attr:{d:`M11.503.131 1.891 5.678a.84.84 0 0 0-.42.726v11.188c0 .3.162.575.42.724l9.609 5.55a1 1 0 0 0 .998 0l9.61-5.55a.84.84 0 0 0 .42-.724V6.404a.84.84 0 0 0-.42-.726L12.497.131a1.01 1.01 0 0 0-.996 0M2.657 6.338h18.55c.263 0 .43.287.297.515L12.23 22.918c-.062.107-.229.064-.229-.06V12.335a.59.59 0 0 0-.295-.51l-9.11-5.257c-.109-.063-.064-.23.061-.23`},child:[]}]})(e)}function U(e){return N({tag:`svg`,attr:{role:`img`,viewBox:`0 0 24 24`},child:[{tag:`path`,attr:{d:`m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z`},child:[]}]})(e)}function W(e){return N({tag:`svg`,attr:{viewBox:`0 0 16 16`,fill:`currentColor`},child:[{tag:`path`,attr:{d:`M15.434 1.72887L12.14 0.144875C12.002 0.078875 11.855 0.046875 11.709 0.046875C11.353 0.046875 11.18 0.211875 11.155 0.228875C11.073 0.270875 11.005 0.337875 11.004 0.338875L4.698 6.08888L1.951 4.00488C1.832 3.91388 1.69 3.86987 1.548 3.86987C1.387 3.86987 1.226 3.92788 1.1 4.04288L0.219 4.84387C0.074 4.97587 0.001 5.15688 0.001 5.33687C0.001 5.51687 0.073 5.69688 0.218 5.82888L2.6 8.00088L0.217 10.1719C0.072 10.3039 0 10.4839 0 10.6639C0 10.8439 0.073 11.0249 0.218 11.1569L1.099 11.9579C1.226 12.0729 1.386 12.1309 1.547 12.1309C1.688 12.1309 1.83 12.0859 1.95 11.9959L4.697 9.91187L11.003 15.6619C11.003 15.6619 11.072 15.7299 11.155 15.7719C11.179 15.7889 11.353 15.9529 11.709 15.9529C11.855 15.9529 12.003 15.9209 12.141 15.8549L15.435 14.2709C15.781 14.1049 16.001 13.7539 16.001 13.3699V2.62888C16.001 2.24487 15.781 1.89488 15.435 1.72787L15.434 1.72887ZM7.217 7.99988L12.002 4.36987V11.6299L7.217 7.99988Z`},child:[]}]})(e)}function G(e){return N({tag:`svg`,attr:{viewBox:`0 0 16 16`,fill:`currentColor`},child:[{tag:`path`,attr:{d:`M8.045 7.37722L5.449 5.40722L10.636 0.676223C10.685 0.631223 10.735 0.617223 10.778 0.617223C10.786 0.617223 10.999 0.627223 10.999 0.837223V5.13222L8.044 7.37622L8.045 7.37722ZM0.217 10.1762C0.072 10.3082 0 10.4882 0 10.6682C0 10.8482 0.073 11.0292 0.218 11.1612L1.099 11.9622C1.226 12.0772 1.386 12.1352 1.547 12.1352C1.688 12.1352 1.83 12.0902 1.95 12.0002L3.887 10.5312L1.858 8.68122L0.218 10.1762H0.217ZM1.95 4.00822C1.83 3.91722 1.689 3.87322 1.547 3.87322C1.386 3.87322 1.225 3.93122 1.099 4.04622L0.218 4.84722C0.073 4.97922 0 5.16022 0 5.34022C0 5.52022 0.072 5.70022 0.217 5.83222L2.202 7.64222L10.634 15.3332C10.684 15.3792 10.735 15.3922 10.779 15.3922C10.888 15.3922 11 15.3142 11 15.1752V10.8762L1.95 4.00822ZM15.434 1.73322L12.14 0.149223C12.002 0.0832227 11.855 0.0532227 11.709 0.0532227H11.704C11.888 0.268223 12.003 0.537223 12.003 0.837223V15.1752C12.004 15.4702 11.894 15.7342 11.716 15.9472H11.734C11.748 15.9472 11.761 15.9472 11.775 15.9472C11.962 15.9472 12.123 15.8682 12.14 15.8602L15.434 14.2762C15.78 14.1102 16 13.7592 16 13.3752V2.63422C16 2.25022 15.78 1.90022 15.434 1.73322Z`},child:[]}]})(e)}var K=n(),q={codex:F,claude:U,vscode:W,"vscode-insiders":G,cursor:H,antigravity:v,intellij:V,webstorm:R,pycharm:B,sublime:z,zed:I,windsurf:L},J={codex:`bg-foreground text-background`,claude:`bg-[#D97757] text-white`,vscode:`bg-[#007ACC] text-white`,"vscode-insiders":`bg-[#24A148] text-white`,cursor:`bg-zinc-950 text-white dark:bg-white dark:text-zinc-950`,antigravity:`bg-violet-600 text-white`,intellij:`bg-fuchsia-600 text-white`,webstorm:`bg-cyan-600 text-white`,pycharm:`bg-lime-600 text-zinc-950`,sublime:`bg-orange-500 text-white`,zed:`bg-red-600 text-white`,windsurf:`bg-teal-600 text-white`};function Y({icon:e}){let t=q[e]??_;return(0,K.jsx)(`span`,{className:i(`grid size-10 shrink-0 place-items-center rounded-xl shadow-sm`,J[e]),"aria-hidden":`true`,children:(0,K.jsx)(t,{className:`size-5`})})}function X({target:e,busy:t,launching:n,preferred:r,onLaunch:a}){return(0,K.jsxs)(`button`,{type:`button`,disabled:!e.available||t,onClick:()=>a(e),"aria-label":e.available?`Open workspace in ${e.name}`:`${e.name} unavailable`,className:i(`flex min-h-20 w-full items-center gap-3 rounded-xl border p-3 text-left outline-none transition-colors`,`focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background`,e.available?`cursor-pointer border-border bg-card hover:border-primary/40 hover:bg-accent/60`:`cursor-not-allowed border-border/70 bg-muted/40 opacity-65`),children:[(0,K.jsx)(Y,{icon:e.icon}),(0,K.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsx)(`span`,{className:`font-medium text-foreground`,children:e.name}),n?(0,K.jsx)(o,{className:`size-4`}):(0,K.jsx)(`span`,{className:i(`text-[11px]`,e.available?`text-success-foreground`:`text-muted-foreground`),children:e.available?r?`Preferred · Available`:`Available`:`Not detected`})]}),(0,K.jsx)(`span`,{className:`mt-0.5 block text-xs leading-relaxed text-muted-foreground`,children:e.available?e.description:e.unavailableReason})]})]})}function Z({workspaceId:e,workspacePath:t,isVsCode:n=!1,className:r}){let[i,_]=(0,b.useState)(!1),[v,x]=(0,b.useState)(null),[S,C]=(0,b.useState)(null),w=s(),T=g().data?.config,E=w.data?.filter(e=>e.kind===`ai-app`)??[],D=T?.defaultEditor?{code:`vscode`,"code-insiders":`vscode-insiders`,cursor:`cursor`,antigravity:`antigravity`,idea:`intellij`,webstorm:`webstorm`,charm:`pycharm`,subl:`sublime`,zed:`zed`,windsurf:`windsurf`}[T.defaultEditor]:void 0,O=(w.data?.filter(e=>e.kind===`editor`)??[]).toSorted((e,t)=>Number(t.id===D)-Number(e.id===D)),k=async t=>{C(null),x(t.id);try{await u(`/api/workspace/${encodeURIComponent(e)}/launch`,{method:`POST`,body:JSON.stringify({targetId:t.id})}),_(!1)}catch(e){C(e instanceof Error?e.message:String(e)),await w.refetch()}finally{x(null)}};return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(a,{variant:`outline`,className:r,onClick:()=>_(!0),children:[(0,K.jsx)(y,{}),`Open with…`]}),(0,K.jsx)(h,{open:i,onOpenChange:e=>{_(e),e||C(null)},children:(0,K.jsxs)(f,{className:`max-w-2xl`,"aria-busy":v!==null,children:[(0,K.jsxs)(m,{children:[(0,K.jsx)(d,{children:`Open workspace with…`}),(0,K.jsx)(l,{children:`Choose a local coding app or editor. AI apps receive the workspace path and an editable task kickoff; they may use their own online services.`})]}),(0,K.jsxs)(p,{className:`space-y-5`,children:[S&&(0,K.jsx)(`div`,{role:`alert`,className:`rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive-foreground`,children:S}),n&&(0,K.jsxs)(`section`,{"aria-labelledby":`current-editor-heading`,children:[(0,K.jsx)(`h3`,{id:`current-editor-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Current window`}),(0,K.jsxs)(`button`,{type:`button`,disabled:v!==null,onClick:()=>{window.parent.postMessage({type:`openWorkspaceFolder`,workspacePath:t},`*`),_(!1)},className:`flex min-h-20 w-full cursor-pointer items-center gap-3 rounded-xl border border-primary/30 bg-primary/5 p-3 text-left outline-none transition-colors hover:bg-primary/10 focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-65`,children:[(0,K.jsx)(Y,{icon:`vscode`}),(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`span`,{className:`block font-medium`,children:`Current VS Code window`}),(0,K.jsx)(`span`,{className:`mt-0.5 block text-xs text-muted-foreground`,children:`Open through the installed NexusFlow extension.`})]})]})]}),w.isLoading?(0,K.jsxs)(`div`,{className:`flex items-center gap-2 py-8 text-sm text-muted-foreground`,"aria-live":`polite`,children:[(0,K.jsx)(o,{}),` Checking apps on this computer…`]}):w.isError?(0,K.jsx)(`div`,{role:`alert`,className:`rounded-lg border border-destructive/30 bg-destructive/10 p-3 text-sm text-destructive-foreground`,children:w.error instanceof Error?w.error.message:`Could not check available apps.`}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`section`,{"aria-labelledby":`ai-apps-heading`,children:[(0,K.jsx)(`h3`,{id:`ai-apps-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`AI coding apps`}),(0,K.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:E.map(e=>(0,K.jsx)(X,{target:e,busy:v!==null,launching:v===e.id,onLaunch:k},e.id))})]}),(0,K.jsxs)(`section`,{"aria-labelledby":`editors-heading`,children:[(0,K.jsx)(`h3`,{id:`editors-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Code editors`}),(0,K.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:O.map(e=>(0,K.jsx)(X,{target:e,busy:v!==null,launching:v===e.id,preferred:e.id===D,onLaunch:k},e.id))})]})]}),(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-t border-border pt-3`,children:[(0,K.jsx)(`p`,{className:`truncate font-mono text-[11px] text-muted-foreground`,title:t,children:t}),(0,K.jsxs)(a,{size:`sm`,variant:`ghost`,onClick:()=>void w.refetch(),disabled:w.isFetching||v!==null,children:[(0,K.jsx)(c,{className:w.isFetching?`animate-spin`:``}),`Recheck`]})]})]})]})})]})}export{Z as t};
@@ -1,6 +0,0 @@
1
- import{_ as e,a as t,b as n,d as r,g as i,h as a,i as o,l as s,m as c,o as l,p as u,s as d,t as f,u as p,v as m}from"./button-cPldH5S4.js";import{$ as h,$t as g,An as _,At as v,B as y,Bn as b,C as x,D as S,Dt as C,E as w,F as T,Ft as E,G as D,Gn as O,Gt as k,H as A,I as j,J as M,Jt as N,Kt as P,L as F,Lt as I,Mt as ee,N as te,Nn as L,O as ne,On as R,P as re,Pt as ie,Q as z,Qn as ae,Qt as oe,R as se,Rt as B,S as V,Sn as H,St as ce,Tt as le,U as ue,Un as U,Ut as de,V as fe,Vn as pe,W as me,Wn as he,Wt as ge,X as W,Xt as _e,Y as ve,Yt as G,Z as ye,Zn as be,Zt as xe,_t as K,a as q,an as Se,at as Ce,b as we,bn as Te,c as Ee,cn as De,ct as Oe,d as ke,dt as Ae,en as je,et as Me,f as Ne,g as Pe,gn as Fe,gt as Ie,h as Le,hn as Re,ht as ze,i as Be,in as Ve,ir as He,it as Ue,jn as We,jt as Ge,kt as Ke,ln as qe,lt as Je,m as Ye,mt as Xe,n as Ze,nn as Qe,nr as J,nt as $e,o as et,p as tt,pn as nt,q as rt,qt as it,r as at,rn as ot,rr as Y,s as st,sn as ct,st as lt,t as ut,tn as dt,tt as ft,u as pt,ut as mt,vn as ht,vt as gt,w as _t,wt as X,x as vt,xn as yt,y as bt,yn as xt,z as St,zt as Ct}from"./spinner-DXt6mnJk.js";import{S as wt,_ as Tt,a as Et,c as Dt,d as Ot,f as kt,i as At,l as jt,m as Mt,n as Nt,o as Pt,p as Ft,r as It,s as Lt,u as Rt,v as zt,x as Bt,y as Vt}from"./useCompositeListItem-DWGFLKqA.js";import{t as Ht}from"./WorkspaceLauncher-Cxv0O_wt.js";import{t as Ut}from"./cpu-CPUNnHRM.js";import{t as Wt}from"./search-ChVovkOL.js";import{t as Gt}from"./trash-2-Da8F2gKd.js";import{t as Kt}from"./Separator-Chx6O62Y.js";import{F as qt,I as Jt,J as Yt,L as Xt,O as Zt,P as Qt,Q as $t,W as en,Z as tn,a as nn,at as rn,c as an,ct as on,dt as sn,ft as cn,g as ln,gt as un,h as dn,ht as fn,i as pn,l as mn,lt as hn,m as gn,nt as _n,o as vn,p as yn,pt as bn,rt as xn,s as Sn,u as Cn,ut as wn}from"./index-CllPiiFL.js";import{t as Tn}from"./card-82INhRRE.js";import{a as En,i as Dn,n as On,r as kn,t as An}from"./empty-DWyDwDYB.js";import{t as jn}from"./skeleton-CCPbfn1L.js";import{t as Mn}from"./textarea-BLU5HXmZ.js";var Nn=a(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),Pn=a(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Fn=a(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),In=a(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),Ln=a(`list-ordered`,[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]),Rn=a(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),zn=a(`message-square-code`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`m10 8-3 3 3 3`,key:`fp6dz7`}],[`path`,{d:`m14 14 3-3-3-3`,key:`1yrceu`}]]),Bn=a(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),Vn=a(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]),Hn=a(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),Un=a(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),Wn=a(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),Gn=a(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),Kn=a(`square-play`,[[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z`,key:`kmsa83`}]]),qn=a(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Jn=a(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Z=n(e(),1);function Yn(){let[,e]=Z.useState({});return Z.useCallback(()=>{e({})},[])}function Xn(e,t){return t!=null&&!qe(t)?0:typeof e==`function`?e():e}function Zn(e,t,n){let r=Xn(e,n);return typeof r==`number`?r:r?.[t]}function Qn(e){return typeof e==`function`?e():e}function $n(e,t){return t||e===`click`||e===`mousedown`}function er(e){return e?.includes(`mouse`)&&e!==`mousedown`}var tr=_&&R;function nr(e,t={}){let{enabled:n=!0,delay:r}=t,i=`rootStore`in e?e.rootStore:e,{events:a,dataRef:o}=i.context,s=Z.useRef(!1),c=Z.useRef(null),l=Z.useRef(!0),u=xe();Z.useEffect(()=>{let e=i.select(`domReferenceElement`);if(!n)return;let t=pe(e);function r(){let e=i.select(`domReferenceElement`);!i.select(`open`)&&he(e)&&e===Te(We(e))&&(s.current=!0)}function a(){l.current=!0}function o(){l.current=!1}return mt(Je(t,`blur`,r),tr&&Je(t,`keydown`,a,!0),tr&&Je(t,`pointerdown`,o,!0))},[i,n]),Z.useEffect(()=>{if(!n)return;function e(e){if(e.reason===`trigger-press`||e.reason===`escape-key`){let e=i.select(`domReferenceElement`);U(e)&&(c.current=e,s.current=!0)}}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[a,n,i]);let d=Z.useMemo(()=>{function e(){s.current=!1,c.current=null}return{onMouseLeave(){e()},onFocus(t){let n=t.currentTarget;if(s.current){if(c.current===n)return;e()}let a=H(t.nativeEvent);if(U(a)){if(tr&&!t.relatedTarget){if(!l.current&&!ht(a))return}else if(!xt(a))return}let o=Fe(t.relatedTarget,i.context.triggerElements),{nativeEvent:d,currentTarget:f}=t,p=typeof r==`function`?r():r;if(i.select(`open`)&&o||p===0||p===void 0){i.setOpen(!0,X(B,d,f));return}u.start(p,()=>{s.current||i.setOpen(!0,X(B,d,f))})},onBlur(t){e();let n=t.relatedTarget,r=t.nativeEvent,a=U(n)&&n.hasAttribute(lt(`focus-guard`))&&n.getAttribute(`data-type`)===`outside`;u.start(0,()=>{let e=i.select(`domReferenceElement`),t=Te(We(e));!n&&t===e||yt(o.current.floatingContext?.refs.floating.current,t)||yt(e,t)||a||Fe(n??t,i.context.triggerElements)||i.setOpen(!1,X(B,r))})}}},[o,r,i,u]);return Z.useMemo(()=>n?{reference:d,trigger:d}:{},[n,d])}var rr=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new _e,this.restTimeout=new _e,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},ir=new WeakMap;function ar(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&ir.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),ir.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function or(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=ir.get(n);a&&a!==e&&ar(a),ar(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,ir.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function sr(e){let t=e.context.dataRef.current,n=p(()=>t.hoverInteractionState??rr.create()).current;return t.hoverInteractionState||=n,oe(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function cr(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=`rootStore`in e?e.rootStore:e,o=a.useState(`open`),s=a.useState(`floatingElement`),c=a.useState(`domReferenceElement`),{dataRef:l}=a.context,u=h(),d=z(),f=sr(a),p=xe(),m=J(()=>$n(l.current.openEvent?.type,f.interactedInside)),g=J(()=>er(l.current.openEvent?.type)),_=J(()=>{ar(f)});Y(()=>{o||(f.pointerType=void 0,f.restTimeoutPending=!1,f.interactedInside=!1,_())},[o,f,_]),Z.useEffect(()=>_,[_]),Y(()=>{if(n&&o&&f.handleCloseOptions?.blockPointerEvents&&g()&&U(c)&&s){let e=c,t=s,n=We(s),r=u?.nodesRef.current.find(e=>e.id===d)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=f.pointerEventsScopeElement===t?null:f.pointerEventsScopeElement,a=r===t?null:r,o=f.handleCloseOptions?.getScope?.()??i??a??e.closest(`[data-rootownerid]`)??n.body;return or(f,{scopeElement:o,referenceElement:e,floatingElement:t}),()=>{_()}}},[n,o,c,s,f,g,u,d,_]),Z.useEffect(()=>{if(!n)return;function e(){return!!(u&&d&&nt(u.nodesRef.current,d).length>0)}function t(e){let t=Zn(r,`close`,f.pointerType),n=()=>{a.setOpen(!1,X(Ct,e)),u?.events.emit(`floating.closed`,e)};t?f.openChangeTimeout.start(t,n):(f.openChangeTimeout.clear(),n())}function o(e){let t=H(e);if(!Re(t)){f.interactedInside=!1;return}f.interactedInside=t?.closest(`[aria-haspopup]`)!=null}function c(){f.openChangeTimeout.clear(),p.clear(),u?.events.off(`floating.closed`,v),_()}function h(n){if(e()&&u){u.events.on(`floating.closed`,v);return}if(Fe(n.relatedTarget,a.context.triggerElements))return;let r=l.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(u&&r&&U(o)&&nt(u.nodesRef.current,r,!1).some(e=>yt(e.context?.elements.floating,o)))){if(f.handler){f.handler(n);return}_(),g()&&!m()&&t(n)}}function v(t){!u||!d||e()||p.start(0,()=>{u.events.off(`floating.closed`,v),a.setOpen(!1,X(Ct,t)),u.events.emit(`floating.closed`,t)})}let y=s;return mt(y&&Je(y,`mouseenter`,c),y&&Je(y,`mouseleave`,h),y&&Je(y,`pointerdown`,o,!0),()=>{u?.events.off(`floating.closed`,v)})},[n,s,a,l,r,i,g,m,_,f,u,d,p])}var lr=n(He(),1),ur={current:null};function dr(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=ur,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p}=t,m=`rootStore`in e?e.rootStore:e,{dataRef:g,events:_}=m.context,v=h(l),y=sr(m),b=Z.useRef(!1),x=gt(i),S=gt(r),C=gt(o),w=gt(n),T=gt(p),E=gt(f),D=J(()=>$n(g.current.openEvent?.type,y.interactedInside)),O=J(()=>T.current?.()!==!1),k=J((e,t,n)=>{let r=m.context.triggerElements;if(r.hasElement(t))return!e||!yt(e,t);if(!U(n))return!1;let i=n;return r.hasMatchingElement(e=>yt(e,i))&&(!e||!yt(e,i))}),A=J(()=>{y.handler&&=(We(m.select(`domReferenceElement`)).removeEventListener(`mousemove`,y.handler),void 0)}),j=J(()=>{ar(y)});return u&&(y.handleCloseOptions=x.current?.__options),Z.useEffect(()=>A,[A]),Z.useEffect(()=>{if(!n)return;function e(e){e.open?b.current=!1:(b.current=e.reason===Ct,A(),y.openChangeTimeout.clear(),y.restTimeout.clear(),y.blockMouseMove=!0,y.restTimeoutPending=!1)}return _.on(`openchange`,e),()=>{_.off(`openchange`,e)}},[n,_,y,A]),Z.useEffect(()=>{if(!n)return;function e(e,t=!0){let n=Zn(S.current,`close`,y.pointerType);n?y.openChangeTimeout.start(n,()=>{m.setOpen(!1,X(Ct,e)),v?.events.emit(`floating.closed`,e)}):t&&(y.openChangeTimeout.clear(),m.setOpen(!1,X(Ct,e)),v?.events.emit(`floating.closed`,e))}let t=c.current??(u?m.select(`domReferenceElement`):null);if(!U(t))return;function r(e){if(y.openChangeTimeout.clear(),y.blockMouseMove=!1,a&&!qe(y.pointerType))return;let t=Qn(C.current),n=Zn(S.current,`open`,y.pointerType),r=H(e),i=e.currentTarget??null,o=m.select(`domReferenceElement`),s=i;if(U(r)&&!m.context.triggerElements.hasElement(r)){for(let e of m.context.triggerElements.elements())if(yt(e,r)){s=e;break}}U(i)&&U(o)&&!m.context.triggerElements.hasElement(i)&&yt(i,o)&&(s=o);let c=s!=null&&k(o,s,r),l=m.select(`open`),u=E.current?.()??m.select(`transitionStatus`)===`ending`,d=!l&&u&&b.current,f=!c&&U(s)&&U(o)&&yt(o,s)&&d,p=t>0&&!n,h=c&&(l||d)||f,g=!l||c;if(h){O()&&m.setOpen(!0,X(Ct,e,s));return}p||(n?y.openChangeTimeout.start(n,()=>{g&&O()&&m.setOpen(!0,X(Ct,e,s))}):g&&O()&&m.setOpen(!0,X(Ct,e,s)))}function i(t){if(D()){j();return}A();let n=We(m.select(`domReferenceElement`));y.restTimeout.clear(),y.restTimeoutPending=!1;let r=g.current.floatingContext??d?.();if(!Fe(t.relatedTarget,m.context.triggerElements)){if(x.current&&r){m.select(`open`)||y.openChangeTimeout.clear();let i=c.current;y.handler=x.current({...r,tree:v,x:t.clientX,y:t.clientY,onClose(){j(),A(),w.current&&!D()&&i===m.select(`domReferenceElement`)&&e(t,!0)}}),n.addEventListener(`mousemove`,y.handler),y.handler(t);return}(y.pointerType!==`touch`||!yt(m.select(`floatingElement`),t.relatedTarget))&&e(t)}}return s?mt(Je(t,`mousemove`,r,{once:!0}),Je(t,`mouseenter`,r),Je(t,`mouseleave`,i)):mt(Je(t,`mouseenter`,r),Je(t,`mouseleave`,i))},[A,j,g,S,m,n,x,y,u,k,D,a,s,C,c,v,w,d,E,O]),Z.useMemo(()=>{if(!n)return;function e(e){y.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,n=e.currentTarget,r=m.select(`domReferenceElement`),i=m.select(`open`),o=k(r,n,e.target);if(a&&!qe(y.pointerType))return;if(i&&o&&y.handleCloseOptions?.blockPointerEvents){let e=m.select(`floatingElement`);if(e){let t=y.handleCloseOptions?.getScope?.()??n.ownerDocument.body;or(y,{scopeElement:t,referenceElement:n,floatingElement:e})}}let s=Qn(C.current);if(i&&!o||s===0||!o&&y.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;y.restTimeout.clear();function c(){if(y.restTimeoutPending=!1,D())return;let e=m.select(`open`);!y.blockMouseMove&&(!e||o)&&O()&&m.setOpen(!0,X(Ct,t,n))}y.pointerType===`touch`?lr.flushSync(()=>{c()}):o&&i?c():(y.restTimeoutPending=!0,y.restTimeout.start(s,c))}}},[n,y,D,k,a,m,C,O])}var fr=.1,pr=fr*fr,Q=.5;function mr(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function hr(e,t,n,r,i,a,o,s,c,l){let u=!1;return mr(e,t,n,r,i,a)&&(u=!u),mr(e,t,i,a,o,s)&&(u=!u),mr(e,t,o,s,c,l)&&(u=!u),mr(e,t,c,l,n,r)&&(u=!u),u}function gr(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function _r(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function vr(e={}){let{blockPointerEvents:t=!1}=e,n=new _e,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*pr;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=H(r),g=r.type===`mouseleave`,_=yt(u,h),v=yt(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&U(r.relatedTarget)&&yt(u,r.relatedTarget))return;function y(){return!!(s&&nt(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=_r(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=_r(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=_r(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=_r(d,f,x.right-1,A,S.left+1,k);break;default:}if(j)return;if(l&&!gr(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?Q/2:Q*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+Q+1,o=C||T?S.bottom-Q:S.top,s=C?T?S.bottom-Q:S.top:S.bottom-Q;M=hr(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?Q/2:Q*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-Q,o=C||T?S.top+Q:S.bottom,s=C?T?S.top+Q:S.bottom:S.top+Q;M=hr(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?Q/2:Q*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+Q+1,o=w||E?S.right-Q:S.left,s=w?E?S.right-Q:S.left:S.right-Q;M=hr(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?Q/2:Q*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-Q,o=w||E?S.left+Q:S.right,s=w?E?S.left+Q:S.right:S.left+Q;M=hr(d,f,a,r,a,i,o,S.top,s,S.bottom);break}default:}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}var yr=Z.createContext(void 0);function br(e){let t=Z.useContext(yr);if(t===void 0&&!e)throw Error(r(33));return t}var xr=Z.createContext(void 0);function Sr(e){let t=Z.useContext(xr);if(t===void 0&&!e)throw Error(r(36));return t}var Cr=Z.createContext(void 0);function wr(e=!0){let t=Z.useContext(Cr);if(t===void 0&&!e)throw Error(r(25));return t}function Tr(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,{events:l}=a.useState(`floatingTreeRoot`),u=a.useState(`open`),d=wr(!0),f=d!==void 0;return Z.useMemo(()=>({id:r,role:`menuitem`,tabIndex:u&&n?0:-1,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&l.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&l.emit(`close`,{domEvent:e,reason:ee})},onMouseUp(e){if(d){let t=d.initialCursorPointRef.current;if(d.initialCursorPointRef.current=null,f&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||f&&!_&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!f||e.button===2)&&(!c||c.type===`regular-item`)&&s.current.click()}}),[t,n,r,l,i,u,a,o,s,d,f,c])}var Er={type:`regular-item`};function Dr(e){let{closeOnClick:t,disabled:n=!1,highlighted:r,id:i,store:a,typingRef:o=a.context.typingRef,nativeButton:c,itemMetadata:l,nodeId:d}=e,f=a.useState(`disabled`),p=n||f,m=Z.useRef(null),{getButtonProps:h,buttonRef:g}=V({disabled:p,focusableWhenDisabled:!0,native:c,composite:!0}),_=Tr({closeOnClick:t,highlighted:r,id:i,nodeId:d,store:a,typingRef:o,itemRef:m,itemMetadata:l}),v=Z.useCallback(e=>u(_,{onMouseEnter(){l.type===`submenu-trigger`&&l.setActive()}},e,h),[_,h,l]),y=s(m,g);return Z.useMemo(()=>({getItemProps:v,itemRef:y}),[v,y])}var Or=Z.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:s=!1,disabled:c=!1,closeOnClick:l=!0,style:u,...d}=e,f=Nt({label:a}),p=br(!0),m=be(i),{store:h}=Sr(),g=h.useState(`isActive`,f.index),_=h.useState(`itemProps`),{getItemProps:v,itemRef:y}=Dr({closeOnClick:l,disabled:c,highlighted:g,id:m,store:h,nativeButton:s,nodeId:p?.context.nodeId,itemMetadata:Er});return o(`div`,e,{state:{disabled:c,highlighted:g},props:[_,d,v],ref:[y,t,f.ref]})}),$=i(),kr={...w,...N},Ar=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...s}=e,{store:c}=Sr(),{side:l,align:u}=br(),d=It(!0)!=null,f=c.useState(`open`),p=c.useState(`transitionStatus`),m=c.useState(`popupProps`),h=c.useState(`mounted`),g=c.useState(`instantType`),_=c.useState(`activeTriggerElement`),v=c.useState(`parent`),y=c.useState(`lastOpenChangeReason`),b=c.useState(`rootId`),x=c.useState(`floatingRootContext`),S=c.useState(`floatingTreeRoot`),C=c.useState(`closeDelay`),w=c.useState(`activeTriggerElement`),T=c.useState(`hoverEnabled`),E=c.useState(`disabled`),D=c.useState(`openMethod`),O=v.type===`context-menu`;k({open:f,ref:c.context.popupRef,onComplete(){f&&c.context.onOpenChangeComplete?.(!0)}}),Z.useEffect(()=>{function e(e){c.setOpen(!1,X(e.reason,e.domEvent))}return S.events.on(`close`,e),()=>{S.events.off(`close`,e)}},[S.events,c]),cr(x,{enabled:T&&!E&&!O&&v.type!==`menubar`,closeDelay:C});let A=Z.useCallback(e=>{c.set(`popupElement`,e)},[c]),j=o(`div`,e,{state:{transitionStatus:p,side:l,align:u,open:f,nested:v.type===`menu`,instant:g},ref:[t,c.context.popupRef,A],stateAttributesMapping:kr,props:[m,{onKeyDown(e){d&&Ee.has(e.key)&&e.stopPropagation()}},Pt(p),s,{"data-rootownerid":b}]}),N=v.type===void 0||O;return(_||v.type===`menubar`&&y!==`outside-press`)&&(N=!0),(0,$.jsx)(M,{context:x,openInteractionType:D,modal:O,disabled:!h,returnFocus:a===void 0?N:a,initialFocus:v.type!==`menu`,restoreFocus:!0,externalTree:v.type===`menubar`?void 0:S,previousFocusableElement:w,nextFocusableElement:v.type===void 0?c.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:v.type===void 0?c.context.beforeContentFocusGuardRef:void 0,children:j})}),jr=Z.createContext(void 0);function Mr(){let e=Z.useContext(jr);if(e===void 0)throw Error(r(32));return e}var Nr=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Sr();return i.useState(`mounted`)||n?(0,$.jsx)(jr.Provider,{value:n,children:(0,$.jsx)(ft,{ref:t,...r})}):null}),Pr=Z.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=Ue,style:g,..._}=e,{store:v}=Sr(),y=Mr(),b=wr(!0),x=v.useState(`parent`),S=v.useState(`floatingRootContext`),C=v.useState(`floatingTreeRoot`),w=v.useState(`mounted`),T=v.useState(`open`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`activeTriggerElement`),k=v.useState(`transitionStatus`),A=v.useState(`positionerElement`),j=v.useState(`instantType`),M=v.useState(`hasViewport`),N=v.useState(`lastOpenChangeReason`),F=v.useState(`floatingNodeId`),ee=v.useState(`floatingParentNodeId`),te=S.useState(`domReferenceElement`),L=Z.useRef(null),ne=P(A,!1,!1),R=n,re=c,ie=l,z=s,ae=h;x.type===`context-menu`&&(R=n??x.context?.anchor,z??=`start`,!o&&z!==`center`&&(ie=e.alignOffset??2,re=e.sideOffset??-5));let oe=o,se=z;x.type===`menu`?(oe??=`inline-end`,se??=`start`,ae=e.collisionAvoidance??Ce):x.type===`menubar`&&(oe??=x.context.orientation===`vertical`?`inline-end`:`bottom`,se??=`start`);let B=x.type===`context-menu`,V=Lt({anchor:R,floatingRootContext:S,positionMethod:b?`fixed`:r,mounted:w,side:oe,sideOffset:re,align:se,alignOffset:ie,arrowPadding:B?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:F,keepMounted:y,disableAnchorTracking:m,collisionAvoidance:ae,shiftCrossAxis:B&&!(`side`in ae&&ae.side===`flip`),externalTree:C,adaptiveOrigin:M?Dt:void 0});Z.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===F&&v.set(`hoverEnabled`,!1),e.nodeId!==F&&e.parentNodeId===v.select(`floatingParentNodeId`)&&v.setOpen(!1,X(I)))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[v,C.events,F]),Z.useEffect(()=>{if(v.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==v.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;v.setOpen(!1,X(t))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[C.events,v]);let H=xe();Z.useEffect(()=>{T||H.clear()},[T,H]),Z.useEffect(()=>{function e(e){if(!(!T||e.nodeId!==v.select(`floatingParentNodeId`)))if(e.target&&O&&O!==e.target){let e=v.select(`closeDelay`);e>0?H.isStarted()||H.start(e,()=>{v.setOpen(!1,X(I))}):v.setOpen(!1,X(I))}else H.clear()}return C.events.on(`itemhover`,e),()=>{C.events.off(`itemhover`,e)}},[C.events,T,O,v,H]),Z.useEffect(()=>{let e={open:T,nodeId:F,parentNodeId:ee,reason:v.select(`lastOpenChangeReason`)};C.events.emit(`menuopenchange`,e)},[C.events,T,v,F,ee]),Y(()=>{let e=te,t=L.current;if(e&&(L.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return ne(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[te,ne,v]);let ce={open:T,side:V.side,align:V.align,anchorHidden:V.anchorHidden,nested:x.type===`menu`,instant:j},le=x.type===`menubar`&&x.context.modal;At(T&&(le||E&&N!==`trigger-hover`),D===`touch`,A,O);let ue=Et(e,ce,{styles:V.positionerStyles,transitionStatus:k,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!w,inert:!T}),U=w&&x.type!==`menu`&&(x.type!==`menubar`&&E&&N!==`trigger-hover`||x.type===`menubar`&&x.context.modal),de=null;return x.type===`menubar`?de=x.context.contentElement:x.type===void 0&&(de=O),(0,$.jsxs)(yr.Provider,{value:V,children:[U&&(0,$.jsx)(bt,{ref:x.type===`context-menu`||x.type===`nested-context-menu`?x.context.internalBackdropRef:null,inert:vt(!T),cutout:de}),(0,$.jsx)(ve,{id:F,children:(0,$.jsx)(jt,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:ue})})]})}),Fr=Z.createContext(null);function Ir(e){let t=Z.useContext(Fr);if(t===null&&!e)throw Error(r(5));return t}var Lr={...Jt,disabled:K(e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled),modal:K(e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0)),openMethod:K(e=>e.openMethod),allowMouseEnter:K(e=>e.allowMouseEnter),highlightItemOnHover:K(e=>e.highlightItemOnHover),stickIfOpen:K(e=>e.stickIfOpen),parent:K(e=>e.parent),rootId:K(e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId),activeIndex:K(e=>e.activeIndex),isActive:K((e,t)=>e.activeIndex===t),hoverEnabled:K(e=>e.hoverEnabled),instantType:K(e=>e.instantType),lastOpenChangeReason:K(e=>e.openChangeReason),floatingTreeRoot:K(e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot),floatingNodeId:K(e=>e.floatingNodeId),floatingParentNodeId:K(e=>e.floatingParentNodeId),itemProps:K(e=>e.itemProps),closeDelay:K(e=>e.closeDelay),hasViewport:K(e=>e.hasViewport),keyboardEventRelay:K(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)})},Rr=class e extends Ae{constructor(e){super({...zr(),...e},{positionerRef:Z.createRef(),popupRef:Z.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:Z.createRef(),beforeContentFocusGuardRef:Z.createRef(),onOpenChangeComplete:void 0,triggerElements:new te},Lr),this.unsubscribeParentListener=this.observe(`parent`,e=>{if(this.unsubscribeParentListener?.(),e.type===`menu`){let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);this.unsubscribeParentListener=e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);t===i&&n===a&&r===o||(t=i,n=a,r=o,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef;return}e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}static useStore(t,n){let r=p(()=>new e(n)).current;return t??r}unsubscribeParentListener=null};function zr(){return{...Qt(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new Me,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:l,keyboardEventRelay:void 0,closeDelay:0,hasViewport:!1}}var Br=Z.createContext(void 0);function Vr(){return Z.useContext(Br)}var Hr=Xe(function(e){let{children:n,open:r,onOpenChange:i,onOpenChangeComplete:a,defaultOpen:o=!1,disabled:s=!1,modal:c,loopFocus:d=!0,orientation:f=`vertical`,actionsRef:p,closeParentOnEsc:m=!1,handle:h,triggerId:g,defaultTriggerId:_=null,highlightItemOnHover:b=!0}=e,x=wr(!0),S=Sr(!0),C=Ir(!0),w=Vr(),E=Z.useMemo(()=>w&&S?{type:`menu`,store:S.store}:C?{type:`menubar`,context:C}:x&&!S?{type:`context-menu`,context:x}:{type:void 0},[x,S,C,w]),O=Rr.useStore(h?.store,{open:o,openProp:r,activeTriggerId:_,triggerIdProp:g,parent:E});St(O,r,o,_),O.useControlledProp(`openProp`,r),O.useControlledProp(`triggerIdProp`,g),O.useContextCallback(`onOpenChangeComplete`,a);let k=ae(),A=ae(),j=O.useState(`floatingTreeRoot`),M=ye(j),N=z(),P=O.useState(`open`),I=O.useState(`activeTriggerElement`),ee=O.useState(`positionerElement`),te=O.useState(`hoverEnabled`),L=O.useState(`disabled`),ne=O.useState(`lastOpenChangeReason`),R=O.useState(`parent`),ie=O.useState(`activeIndex`),oe=O.useState(`payload`),B=O.useState(`floatingParentNodeId`),V=Z.useRef(null),H=Z.useRef(R.type!==`context-menu`),ce=xe(),le=Z.useRef(!0),ue=xe(),U=B!=null,{openMethod:de,triggerProps:pe}=Ot(P);O.useSyncedValues({disabled:s,highlightItemOnHover:b,modal:R.type===void 0?c:void 0,openMethod:de,rootId:k}),se(O);let{forceUnmount:me}=y(P,O,()=>{O.update({allowMouseEnter:!1,stickIfOpen:!0})});Y(()=>{x&&!S?O.update({parent:{type:`context-menu`,context:x},floatingNodeId:M,floatingParentNodeId:N}):S&&O.update({floatingNodeId:M,floatingParentNodeId:N})},[x,S,M,N,O]),Z.useEffect(()=>{if(P||(V.current=null),R.type===`context-menu`){if(!P){ce.clear(),H.current=!1;return}ce.start(500,()=>{H.current=!0})}},[ce,P,R.type]),Y(()=>{!P&&!te&&O.set(`hoverEnabled`,!0)},[P,te,O]);let he=J((e,t)=>{let n=t.reason;if(P===e&&t.trigger===I&&ne===n)return;let r=T(t);if(!e&&t.trigger==null&&(t.trigger=I??void 0),i?.(e,t),t.isCanceled)return;O.state.floatingRootContext.dispatchOpenChange(e,t);let a=t.event;if(e===!1&&a?.type===`click`&&a.pointerType===`touch`&&!le.current)return;e&&n===`trigger-focus`?(le.current=!1,ue.start(300,()=>{le.current=!0})):(le.current=!0,ue.clear());let o=(n===`trigger-press`||n===`item-press`)&&a.detail===0&&a?.isTrusted,s=!e&&(n===`escape-key`||n==null),c={open:e,openChangeReason:n};V.current=t.event??null,F(c,e,t.trigger,r()),O.update(c),R.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?O.set(`instantType`,`group`):o||s?O.set(`instantType`,o?`click`:`dismiss`):O.set(`instantType`,void 0)}),ge=D({popupStore:O,floatingId:A,nested:N!=null,onOpenChange:he}),_e=ge.context.events;Z.useEffect(()=>{let e=({open:e,eventDetails:t})=>he(e,t);return _e.on(`setOpen`,e),()=>{_e?.off(`setOpen`,e)}},[_e,he]);let ve=Z.useCallback(()=>{O.setOpen(!1,X(v))},[O]);Z.useImperativeHandle(p,()=>({unmount:me,close:ve}),[me,ve]);let G;R.type===`context-menu`&&(G=R.context),Z.useImperativeHandle(G?.positionerRef,()=>ee,[ee]),Z.useImperativeHandle(G?.actionsRef,()=>({setOpen:he}),[he]);let be=rt(ge,{enabled:!L,bubbles:{escapeKey:m&&R.type===`menu`},outsidePress(){return R.type!==`context-menu`||V.current?.type===`contextmenu`||H.current},externalTree:U?j:void 0}),K=we(),q=Z.useCallback(e=>{O.select(`activeIndex`)!==e&&O.set(`activeIndex`,e)},[O]),Se=Mt(ge,{enabled:!L,listRef:O.context.itemDomElements,activeIndex:ie,nested:R.type!==void 0,loopFocus:d,orientation:f,parentOrientation:R.type===`menubar`?R.context.orientation:void 0,rtl:K===`rtl`,disabledIndices:t,onNavigate:q,openOnArrowKeyDown:R.type!==`context-menu`,externalTree:U?j:void 0,focusItemOnHover:b}),Ce=Z.useCallback(e=>{O.context.typingRef.current=e},[O]),Te=Ft(ge,{enabled:!L,listRef:O.context.itemLabels,elementsRef:O.context.itemDomElements,activeIndex:ie,resetMs:500,onMatch:e=>{P&&e!==ie&&O.set(`activeIndex`,e)},onTyping:Ce});fe(O,{floatingRootContext:ge,activeTriggerProps:Z.useMemo(()=>{let e=u(Te.reference,Se.reference,be.reference,{onMouseMove(){O.set(`allowMouseEnter`,!0)}},pe);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=P,e},[O,Te.reference,Se.reference,be.reference,pe,P]),inactiveTriggerProps:Z.useMemo(()=>{let e=u(Se.trigger,be.trigger,pe);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[Se.trigger,be.trigger,pe]),popupProps:Z.useMemo(()=>u(re,{id:A,role:`menu`,"aria-labelledby":I?.id,onMouseMove(){O.set(`allowMouseEnter`,!0),R.type===`menu`&&O.set(`hoverEnabled`,!1)},onClick(){O.select(`hoverEnabled`)&&O.set(`hoverEnabled`,!1)},onKeyDown(e){let t=O.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},Te.floating,Se.floating,be.floating),[I,A,R.type,O,Te.floating,Se.floating,be.floating]),itemProps:Se.item??l});let Ee=Z.useMemo(()=>({store:O,parent:E}),[O,E]),De=(0,$.jsx)(xr.Provider,{value:Ee,children:typeof n==`function`?n({payload:oe}):n});return R.type===void 0||R.type===`context-menu`?(0,$.jsx)(W,{externalTree:j,children:De}):De});function Ur(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=_t(),{ref:i,index:a}=Nt(e),o=n===a,c=Z.useRef(null),l=s(i,c);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=c.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:l,index:a}}function Wr(e){let{render:n,className:r,style:i,state:a=l,props:s=t,refs:c=t,metadata:u,stateAttributesMapping:d,tag:f=`div`,...p}=e,{compositeProps:m,compositeRef:h}=Ur({metadata:u});return o(f,e,{state:a,ref:[...c,h],props:[m,...s,p],stateAttributesMapping:d})}function Gr(e){if(he(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`)??void 0;if(!O(e))return Gr(b(e))}function Kr(e,t){let n=Z.useRef(null);function r(t){lr.flushSync(()=>{e.setOpen(!1,X(Ke,t.nativeEvent,t.currentTarget))}),dt(n.current)?.focus()}function i(n){let r=e.select(`positionerElement`);if(r&&Qe(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{lr.flushSync(()=>{e.setOpen(!1,X(Ke,n.nativeEvent,n.currentTarget))});let i=je(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&yt(r,i);){let e=i;if(i=g(i),i===e)break}i?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function qr(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=Z.useRef(!1);return Z.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,We(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:l,[t,n,r])}var Jr=2,Yr=ze(function(e,t){let{render:n,className:i,style:a,disabled:s=!1,nativeButton:c=!0,id:d,openOnHover:f,delay:p=100,closeDelay:m=0,handle:g,payload:_,...v}=e,y=Sr(!0),b=g?.store??y?.store;if(!b)throw Error(r(85));let x=be(d),C=b.useState(`isTriggerActive`,x),w=b.useState(`floatingRootContext`),T=b.useState(`isOpenedByTrigger`,x),E=b.useState(`triggerPopupId`,x),D=Z.useRef(null),O=Zr(),k=_t(!0),A=h(),j=Z.useMemo(()=>A??new Me,[A]),{registerTrigger:M,isMountedByThisTrigger:N}=me(x,D,b,{payload:_,closeDelay:m,parent:O,floatingTreeRoot:j,floatingNodeId:ye(j),floatingParentNodeId:z(),keyboardEventRelay:k?.relayKeyboardEvent}),P=O.type===`menubar`,F=b.useState(`disabled`),I=s||F||P&&O.context.disabled,{getButtonProps:ee,buttonRef:te}=V({disabled:I,native:c});Z.useEffect(()=>{!T&&O.type===void 0&&(b.context.allowMouseUpTriggerRef.current=!1)},[b,T,O.type]);let L=Z.useRef(null),ne=xe(),R=J(e=>{if(!L.current)return;ne.clear(),b.context.allowMouseUpTriggerRef.current=!1;let t=e.target;if(yt(L.current,t)||yt(b.select(`positionerElement`),t)||t===L.current||t!=null&&Gr(t)===b.select(`rootId`))return;let n=Rt(L.current);e.clientX>=n.left-Jr&&e.clientX<=n.right+Jr&&e.clientY>=n.top-Jr&&e.clientY<=n.bottom+Jr||j.events.emit(`close`,{domEvent:e,reason:le})});Z.useEffect(()=>{T&&b.select(`lastOpenChangeReason`)===`trigger-hover`&&We(L.current).addEventListener(`mouseup`,R,{once:!0})},[T,R,b]);let re=P&&O.context.hasSubmenuOpen,ie=dr(w,{enabled:(f??re)&&!I&&O.type!==`context-menu`&&(!P||re&&!N),handleClose:vr({blockPointerEvents:!P}),mouseOnly:!0,move:!1,restMs:O.type===void 0?p:void 0,delay:{close:m},triggerElementRef:D,externalTree:j,isActiveTrigger:C,isClosing:()=>b.select(`transitionStatus`)===`ending`}),ae=Xr(T,b.select(`lastOpenChangeReason`)),oe=Tt(w,{enabled:!I&&O.type!==`context-menu`,event:T&&P?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:O.type===void 0&&ae}),se=nr(w,{enabled:!I&&re}),B=qr({open:T,enabled:P,mouseDownAction:`open`}),H=Z.useMemo(()=>u(se.reference,oe.reference),[se.reference,oe.reference]),ce=b.useState(`triggerProps`,N),{preFocusGuardRef:ue,handlePreFocusGuardFocus:U,handleFocusTargetFocus:de}=Kr(b,D),fe={disabled:I,open:T},pe=[L,t,te,M,D],he=[H,ie??l,ce,{"aria-haspopup":`menu`,"aria-controls":E,id:x,onMouseDown:e=>{b.select(`open`)||(ne.start(200,()=>{b.context.allowMouseUpTriggerRef.current=!0}),We(e.currentTarget).addEventListener(`mouseup`,R,{once:!0}))}},P?{role:`menuitem`}:{},B,v,ee],ge=o(`button`,e,{enabled:!P,stateAttributesMapping:S,state:fe,ref:pe,props:he});return P?(0,$.jsx)(Wr,{tag:`button`,render:n,className:i,style:a,state:fe,refs:pe,props:he,stateAttributesMapping:S}):T?(0,$.jsxs)(Z.Fragment,{children:[(0,$.jsx)(Oe,{ref:ue,onFocus:U},`${x}-pre-focus-guard`),(0,$.jsx)(Z.Fragment,{children:ge},x),(0,$.jsx)(Oe,{ref:b.context.triggerFocusTargetRef,onFocus:de},`${x}-post-focus-guard`)]}):(0,$.jsx)(Z.Fragment,{children:ge},x)});function Xr(e,t){let n=xe(),[r,i]=Z.useState(!1);return Y(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function Zr(){let e=wr(!0),t=Sr(!0),n=Ir(!0);return Z.useMemo(()=>n?{type:`menubar`,context:n}:e&&!t?{type:`context-menu`,context:e}:{type:void 0},[e,t,n])}function Qr(e){let t=L(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=he(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r;return(Bt(n)!==a||Bt(r)!==o)&&(n=a,r=o),{width:n,height:r}}function $r(e){let{popupElement:t,positionerElement:n,content:r,mounted:i,onMeasureLayout:a,onMeasureLayoutComplete:o,side:s,direction:c}=e,u=P(t,!0,!1),f=G(),p=Z.useRef(null),m=Z.useRef(!0),h=Z.useRef(d),g=J(a),_=J(o),v=Z.useMemo(()=>{let e=s===`top`,t=s===`left`;return c===`rtl`?(e||=s===`inline-end`,t||=s===`inline-end`):(e||=s===`inline-start`,t||=s===`inline-start`),e?{position:`absolute`,[s===`top`?`bottom`:`top`]:`0`,[t?`right`:`left`]:`0`}:l},[s,c]);Y(()=>{if(!i){h.current=d,m.current=!0,p.current=null;return}if(!t||!n)return;h.current=ti(t,v),ni(t,`auto`);let e=ei(t,`position`,`static`),r=ei(t,`transform`,`none`),a=ei(t,`scale`,`1`),o=ti(n,{"--available-width":`max-content`,"--available-height":`max-content`});function s(){e(),r(),o()}function c(){s(),a()}if(g?.(),m.current||p.current===null){ri(n,`max-content`);let e=Qr(t);return p.current=e,ri(n,e),c(),_?.(null,e),m.current=!1,()=>{h.current(),h.current=d}}ri(n,`max-content`);let l=p.current,y=Qr(t);p.current=y,ni(t,l),c(),_?.(l,y),ri(n,y);let b=new AbortController;return f.request(()=>{ni(t,y),u(()=>{t.style.setProperty(`--popup-width`,`auto`),t.style.setProperty(`--popup-height`,`auto`)},b.signal)}),()=>{b.abort(),f.cancel(),h.current(),h.current=d}},[r,t,n,u,f,i,g,_,v])}function ei(e,t,n){let r=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{e.style.setProperty(t,r)}}function ti(e,t){let n=[];for(let[r,i]of Object.entries(t))n.push(ei(e,r,i));return n.length?()=>{n.forEach(e=>e())}:d}function ni(e,t){let n=t===`auto`?`auto`:`${t.width}px`,r=t===`auto`?`auto`:`${t.height}px`;e.style.setProperty(`--popup-width`,n),e.style.setProperty(`--popup-height`,r)}function ri(e,t){let n=t===`max-content`?`max-content`:`${t.width}px`,r=t===`max-content`?`max-content`:`${t.height}px`;e.style.setProperty(`--positioner-width`,n),e.style.setProperty(`--positioner-height`,r)}function ii(e){let{store:t,side:n,cssVars:r,children:i}=e,a=we(),o=t.useState(`activeTriggerElement`),s=t.useState(`activeTriggerId`),c=t.useState(`open`),l=t.useState(`payload`),u=t.useState(`mounted`),d=t.useState(`popupElement`),f=t.useState(`positionerElement`),p=Vt(c?o:null),m=ci(s,l),h=Z.useRef(null),[g,_]=Z.useState(null),[v,y]=Z.useState(null),b=Z.useRef(null),x=Z.useRef(null),S=P(b,!0,!1),C=G(),[w,T]=Z.useState(null),[E,D]=Z.useState(!1);Y(()=>(t.set(`hasViewport`,!0),()=>{t.set(`hasViewport`,!1)}),[t]);let O=J(()=>{b.current?.style.setProperty(`animation`,`none`),b.current?.style.setProperty(`transition`,`none`),x.current?.style.setProperty(`display`,`none`)}),k=J(e=>{b.current?.style.removeProperty(`animation`),b.current?.style.removeProperty(`transition`),x.current?.style.removeProperty(`display`),e&&T(e)}),A=Z.useRef(null);Y(()=>{(!c||!u)&&(A.current=null)},[c,u]),Y(()=>{if(o&&p&&o!==p&&A.current!==o&&h.current){_(h.current),D(!0);let e=si(p,o);y(e),C.request(()=>{lr.flushSync(()=>{D(!1)}),S(()=>{_(null),T(null),h.current=null})}),A.current=o}},[o,p,g,S,C]),Y(()=>{let e=b.current;if(!e)return;let t=We(e).createElement(`div`);for(let n of Array.from(e.childNodes))t.appendChild(n.cloneNode(!0));h.current=t});let j=g!=null,M;M=j?(0,$.jsxs)(Z.Fragment,{children:[(0,$.jsx)(`div`,{"data-previous":!0,inert:vt(!0),ref:x,style:{...w?{[r.popupWidth]:`${w.width}px`,[r.popupHeight]:`${w.height}px`}:null,position:`absolute`},"data-ending-style":E?void 0:``},`previous`),(0,$.jsx)(`div`,{"data-current":!0,ref:b,"data-starting-style":E?``:void 0,children:i},m)]}):(0,$.jsx)(`div`,{"data-current":!0,ref:b,children:i},m),Y(()=>{let e=x.current;!e||!g||e.replaceChildren(...Array.from(g.childNodes))},[g]),$r({popupElement:d,positionerElement:f,mounted:u,content:l,onMeasureLayout:O,onMeasureLayoutComplete:k,side:n,direction:a});let N={activationDirection:ai(v),transitioning:j};return{children:M,state:N}}function ai(e){if(e)return`${oi(e.horizontal,5,`right`,`left`)} ${oi(e.vertical,5,`down`,`up`)}`}function oi(e,t,n,r){return e>t?n:e<-t?r:``}function si(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i={x:n.left+n.width/2,y:n.top+n.height/2},a={x:r.left+r.width/2,y:r.top+r.height/2};return{horizontal:a.x-i.x,vertical:a.y-i.y}}function ci(e,t){let[n,r]=Z.useState(0),i=Z.useRef(e),a=Z.useRef(t),o=Z.useRef(!1);return Y(()=>{let n=i.current,s=a.current,c=e!==n,l=t!==s;c?(r(e=>e+1),o.current=!l):o.current&&l&&(r(e=>e+1),o.current=!1),i.current=e,a.current=t},[e,t]),`${e??`current`}-${n}`}var li=Hr;function ui({className:e,children:t,...n}){return(0,$.jsx)(Yr,{className:e,"data-slot":`menu-trigger`,...n,children:t})}function di({children:e,className:t,sideOffset:n=4,align:r=`center`,alignOffset:i,side:a=`bottom`,anchor:o,...s}){return(0,$.jsx)(Nr,{children:(0,$.jsx)(Pr,{align:r,alignOffset:i,anchor:o,className:`z-50`,"data-slot":`menu-positioner`,side:a,sideOffset:n,children:(0,$.jsx)(Ar,{className:c(`relative flex not-[class*='w-']:min-w-32 origin-(--transform-origin) rounded-lg border bg-popover not-dark:bg-clip-padding shadow-lg/5 outline-none before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] focus:outline-none dark:before:shadow-[0_-1px_--theme(--color-white/6%)]`,t),"data-slot":`menu-popup`,...s,children:(0,$.jsx)(`div`,{className:`max-h-(--available-height) w-full overflow-y-auto p-1`,children:e})})})})}function fi({className:e,inset:t,variant:n=`default`,...r}){return(0,$.jsx)(Or,{className:c(`[&>svg]:-mx-0.5 flex min-h-8 cursor-default select-none items-center gap-2 rounded-sm px-2 py-1 text-base text-foreground outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-inset:ps-8 data-[variant=destructive]:text-destructive-foreground data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&>svg:not([class*='opacity-'])]:opacity-80 [&>svg:not([class*='size-'])]:size-4.5 sm:[&>svg:not([class*='size-'])]:size-4 [&>svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:[&>svg:not([class*='text-'])]:text-current [&>svg]:pointer-events-none [&>svg]:shrink-0`,e),"data-inset":t,"data-slot":`menu-item`,"data-variant":n,...r})}function pi({className:e,...t}){return(0,$.jsx)(Kt,{className:c(`mx-2 my-1 h-px bg-border`,e),"data-slot":`menu-separator`,...t})}var mi=Z.createContext(void 0);function hi(){let e=Z.useContext(mi);if(e===void 0)throw Error(r(64));return e}var gi=function(e){return e.activationDirection=`data-activation-direction`,e.orientation=`data-orientation`,e}({}),_i={tabActivationDirection:e=>({[gi.activationDirection]:e})},vi=Z.forwardRef(function(e,t){let{className:n,defaultValue:r=0,onValueChange:i,orientation:a=`horizontal`,render:s,value:c,style:l,...u}=e,d=e.defaultValue!==void 0,f=Z.useRef([]),[p,m]=Z.useState(()=>new Map),[h,g]=de({controlled:c,default:r,name:`Tabs`,state:`value`}),_=c!==void 0,[v,y]=Z.useState(()=>new Map),b=Z.useRef(void 0),x=Z.useCallback(e=>{if(e===void 0)return null;for(let[t,n]of v.entries())if(n!=null&&e===(n.value??n.index))return t;return null},[v]),[S,w]=Z.useState(()=>({previousValue:h,tabActivationDirection:`none`})),{previousValue:T,tabActivationDirection:E}=S,D=E,O=!1;T!==h&&(D=yi(T,h,a,v),O=T!=null&&h!=null&&x(h)==null);let k=O?T:h,A=T!==k||E!==D;Y(()=>{A&&w({previousValue:k,tabActivationDirection:D})},[k,A,D]);let j=J((e,t)=>{t.activationDirection=yi(h,e,a,v),i?.(e,t),!t.isCanceled&&g(e)}),M=J((e,t)=>{i?.(e,X(t,void 0,void 0,{activationDirection:`none`}))}),N=J((e,t)=>{m(n=>{if(n.get(e)===t)return n;let r=new Map(n);return r.set(e,t),r})}),P=J((e,t)=>{m(n=>{if(!n.has(e)||n.get(e)!==t)return n;let r=new Map(n);return r.delete(e),r})}),F=Z.useCallback(e=>p.get(e),[p]),I=Z.useCallback(e=>{for(let t of v.values())if(e===t?.value)return t?.id},[v]),ee=Z.useMemo(()=>({getTabElementBySelectedValue:x,getTabIdByPanelValue:I,getTabPanelIdByValue:F,onValueChange:j,orientation:a,registerMountedTabPanel:N,setTabMap:y,unregisterMountedTabPanel:P,tabActivationDirection:D,value:h}),[x,I,F,j,a,N,y,P,D,h]),te=Z.useMemo(()=>{for(let e of v.values())if(e!=null&&e.value===h)return e},[v,h]),L=Z.useMemo(()=>{for(let e of v.values())if(e!=null&&!e.disabled)return e.value},[v]),ne=Z.useRef(!d),R=Z.useRef(r),re=Z.useRef(d),z=Z.useRef(!1);Y(()=>{if(_)return;function e(e,t){g(e),w(t=>t.previousValue===e&&t.tabActivationDirection===`none`?t:{previousValue:e,tabActivationDirection:`none`}),M(e,t),ne.current=!1}if(v.size===0){z.current&&h!==null&&!b.current?.isConnected&&e(null,ie);return}z.current=!0,b.current=v.keys().next().value;let t=te?.disabled,n=te==null&&h!==null;if(!t&&h===R.current&&(re.current=!1),re.current&&t&&h===R.current)return;let r=ne.current;if(t||n){let n=L??null;if(h===n){ne.current=!1;return}let i=ie;r?i=Ge:t&&(i=C),e(n,i);return}r&&te!=null&&(M(h,Ge),ne.current=!1)},[L,_,M,te,g,v,h]);let ae=o(`div`,e,{state:{orientation:a,tabActivationDirection:D},ref:t,props:u,stateAttributesMapping:_i});return(0,$.jsx)(mi.Provider,{value:ee,children:(0,$.jsx)(jt,{elementsRef:f,children:ae})})});function yi(e,t,n,r){if(e==null||t==null)return`none`;let i=null,a=null;for(let[n,o]of r.entries()){if(o==null)continue;let r=o.value??o.index;if(e===r&&(i=n),t===r&&(a=n),i!=null&&a!=null)break}if(i==null||a==null)return i!==a&&(typeof e==`number`||typeof e==`string`)&&typeof e==typeof t?n===`horizontal`?t>e?`right`:`left`:t>e?`down`:`up`:`none`;let o=i.getBoundingClientRect(),s=a.getBoundingClientRect();if(n===`horizontal`){if(s.left<o.left)return`left`;if(s.left>o.left)return`right`}else{if(s.top<o.top)return`up`;if(s.top>o.top)return`down`}return`none`}var bi=`data-composite-item-active`,xi=Z.createContext(void 0);function Si(){let e=Z.useContext(xi);if(e===void 0)throw Error(r(65));return e}var Ci=Z.forwardRef(function(e,t){let{className:n,disabled:r=!1,render:i,value:a,id:s,nativeButton:c=!0,style:l,...u}=e,{value:d,getTabPanelIdByValue:f,orientation:p,tabActivationDirection:m}=hi(),{activateOnFocus:h,highlightedTabIndex:g,onTabActivation:_,registerTabResizeObserverElement:v,setHighlightedTabIndex:y,tabsListElement:b}=Si(),x=be(s),{compositeProps:S,compositeRef:C,index:w}=Ur({metadata:Z.useMemo(()=>({disabled:r,id:x,value:a}),[r,x,a])}),T=a===d,D=Z.useRef(!1),O=Z.useRef(null);Y(()=>{let e=O.current;if(e)return v(e)},[v]),Y(()=>{if(D.current){D.current=!1;return}if(!(T&&w>-1&&g!==w))return;let e=b;if(e!=null){let t=Te(We(e));if(t&&yt(e,t))return}r||y(w)},[T,w,g,y,r,b]);let{getButtonProps:k,buttonRef:A}=V({disabled:r,native:c,focusableWhenDisabled:!0}),j=f(a),M=Z.useRef(!1),N=Z.useRef(!1);function P(e){T||r||_(a,X(E,e.nativeEvent,void 0,{activationDirection:`none`}))}function F(e){T||(w>-1&&!r&&y(w),!r&&h&&(!M.current||M.current&&N.current)&&_(a,X(E,e.nativeEvent,void 0,{activationDirection:`none`})))}function I(e){if(T||r)return;M.current=!0;function t(){M.current=!1,N.current=!1}(!e.button||e.button===0)&&(N.current=!0,We(e.currentTarget).addEventListener(`pointerup`,t,{once:!0}))}return o(`button`,e,{state:{disabled:r,active:T,orientation:p,tabActivationDirection:m},ref:[t,A,C,O],props:[S,{role:`tab`,"aria-controls":j,"aria-selected":T,id:x,onClick:P,onFocus:F,onPointerDown:I,[bi]:T?``:void 0,onKeyDownCapture(){D.current=!0}},u,k],stateAttributesMapping:_i})}),wi=Ie();function Ti(){return d}function Ei(){return!1}function Di(){return!0}function Oi(){return(0,wi.useSyncExternalStore)(Ti,Ei,Di)}var ki=function(e){return e.activeTabLeft=`--active-tab-left`,e.activeTabRight=`--active-tab-right`,e.activeTabTop=`--active-tab-top`,e.activeTabBottom=`--active-tab-bottom`,e.activeTabWidth=`--active-tab-width`,e.activeTabHeight=`--active-tab-height`,e}({}),Ai={..._i,activeTabPosition:()=>null,activeTabSize:()=>null},ji=Z.forwardRef(function(e,t){let{className:n,render:r,renderBeforeHydration:i=!1,style:a,...s}=e,{nonce:c}=Ze(),{getTabElementBySelectedValue:l,orientation:u,tabActivationDirection:d,value:f}=hi(),{tabsListElement:p,registerIndicatorUpdateListener:m}=Si(),h=Oi(),g=Yn();Z.useEffect(()=>m(g),[m,g]);let _=0,v=0,y=0,b=0,x=0,S=0,C=!1;if(f!=null&&p!=null){let e=l(f);if(e!=null){C=!0;let{width:t,height:n}=Qr(e),{width:r,height:i}=Qr(p),a=e.getBoundingClientRect(),o=p.getBoundingClientRect(),s=r>0?o.width/r:1,c=i>0?o.height/i:1;if(Math.abs(s)>2**-52&&Math.abs(c)>2**-52){let e=a.left-o.left,t=a.top-o.top;_=e/s+p.scrollLeft-p.clientLeft,y=t/c+p.scrollTop-p.clientTop}else _=e.offsetLeft,y=e.offsetTop;x=t,S=n,v=p.scrollWidth-_-x,b=p.scrollHeight-y-S}}let w=C?{left:_,right:v,top:y,bottom:b}:null,T=C?{width:x,height:S}:null,E=C?{[ki.activeTabLeft]:`${_}px`,[ki.activeTabRight]:`${v}px`,[ki.activeTabTop]:`${y}px`,[ki.activeTabBottom]:`${b}px`,[ki.activeTabWidth]:`${x}px`,[ki.activeTabHeight]:`${S}px`}:void 0,D=o(`span`,e,{state:{orientation:u,activeTabPosition:w,activeTabSize:T,tabActivationDirection:d},ref:t,props:[{role:`presentation`,style:E,hidden:!(C&&x>0&&S>0)},s,{suppressHydrationWarning:!0}],stateAttributesMapping:Ai});return f==null?null:(0,$.jsxs)(Z.Fragment,{children:[D,h&&i&&(0,$.jsx)(`script`,{nonce:c,dangerouslySetInnerHTML:{__html:'!function(){const t=document.currentScript.previousElementSibling;if(!t)return;const e=t.closest(\'[role="tablist"]\');if(!e)return;const i=e.querySelector("[data-active]");if(!i)return;if(0===i.offsetWidth||0===e.offsetWidth)return;let o=0,n=0,h=0,l=0,r=0,f=0;function s(t){const e=getComputedStyle(t);let i=parseFloat(e.width)||0,o=parseFloat(e.height)||0;return(Math.round(i)!==t.offsetWidth||Math.round(o)!==t.offsetHeight)&&(i=t.offsetWidth,o=t.offsetHeight),{width:i,height:o}}if(null!=i&&null!=e){const{width:t,height:c}=s(i),{width:u,height:d}=s(e),a=i.getBoundingClientRect(),g=e.getBoundingClientRect(),p=u>0?g.width/u:1,b=d>0?g.height/d:1;if(Math.abs(p)>Number.EPSILON&&Math.abs(b)>Number.EPSILON){const t=a.left-g.left,i=a.top-g.top;o=t/p+e.scrollLeft-e.clientLeft,h=i/b+e.scrollTop-e.clientTop}else o=i.offsetLeft,h=i.offsetTop;r=t,f=c,n=e.scrollWidth-o-r,l=e.scrollHeight-h-f}function c(e,i){t.style.setProperty(`--active-tab-${e}`,`${i}px`)}c("left",o),c("right",n),c("top",h),c("bottom",l),c("width",r),c("height",f),r>0&&f>0&&t.removeAttribute("hidden")}();'},suppressHydrationWarning:!0})]})}),Mi=function(e){return e.index=`data-index`,e.activationDirection=`data-activation-direction`,e.orientation=`data-orientation`,e.hidden=`data-hidden`,e[e.startingStyle=it.startingStyle]=`startingStyle`,e[e.endingStyle=it.endingStyle]=`endingStyle`,e}({}),Ni={..._i,...N},Pi=Z.forwardRef(function(e,t){let{className:n,value:r,render:i,keepMounted:a=!1,style:s,...c}=e,{value:l,getTabIdByPanelValue:u,orientation:d,tabActivationDirection:f,registerMountedTabPanel:p,unregisterMountedTabPanel:m}=hi(),h=be(),{ref:g,index:_}=Nt({metadata:Z.useMemo(()=>({id:h,value:r}),[h,r])}),v=r===l,{mounted:y,transitionStatus:b,setMounted:x}=ge(v),S=!y,C=u(r),w={hidden:S,orientation:d,tabActivationDirection:f,transitionStatus:b},T=Z.useRef(null),E=o(`div`,e,{state:w,ref:[t,g,T],props:[{"aria-labelledby":C,hidden:S,id:h,role:`tabpanel`,tabIndex:v?0:-1,inert:vt(!v),[Mi.index]:_},c],stateAttributesMapping:Ni});return k({open:v,ref:T,onComplete(){v||x(!1)}}),Y(()=>{if(!(S&&!a)&&h!=null)return p(r,h),()=>{m(r,h)}},[S,a,r,h,p,m]),a||y?E:null}),Fi=[];function Ii(e){let{loopFocus:t=!0,orientation:n=`both`,grid:r,onLoop:i,direction:a,highlightedIndex:o,onHighlightedIndexChange:c,rootRef:l,enableHomeAndEndKeys:u=!1,stopEventPropagation:d=!1,disabledIndices:f,modifierKeys:p=Fi}=e,[m,h]=Z.useState(0),g=r!=null,_=Z.useRef(null),v=s(_,l),y=Z.useRef([]),b=Z.useRef(!1),x=o??m,S=J((e,t=!1)=>{if((c??h)(e),t){let t=y.current[e];Pe(_.current,t,a,n)}}),C=J(e=>{if(e.size===0||b.current)return;b.current=!0;let t=Array.from(e.keys()),r=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,i=r?t.indexOf(r):-1;if(i!==-1)S(i);else if(De(t,x,f)){let e=ot(t,{disabledIndices:f});ct(t,e)||S(e)}Pe(_.current,r,a,n)});Y(()=>{if(f==null||o!=null||!b.current)return;let e=y.current;if(De(e,x,f)){let t=ot(e,{disabledIndices:f});ct(e,t)||S(t)}},[f,o,x,y,S]);let w=J((e,t,n)=>i?i(e,t,n,y):n),T=J(e=>{let o=u?Ee:Be;if(!o.has(e.key)||Li(e,p)||!_.current)return;let s=a===`rtl`,c=s?q:et,l={horizontal:c,vertical:at,both:c}[n],m=s?et:q,h={horizontal:m,vertical:st,both:m}[n],v=H(e.nativeEvent);if(v!=null&&Le(v)&&!zt(v)){let t=v.selectionStart,n=v.selectionEnd,r=v.value??``;if(t==null||e.shiftKey||t!==n||e.key!==h&&t<r.length||e.key!==l&&t>0)return}let b=x,C=Se(y,f),T=Ve(y,f);r!=null&&(b=r({disabledIndices:f,elementsRef:y,event:e,highlightedIndex:x,loopFocus:t,maxIndex:T,minIndex:C,onLoop:w,orientation:n,rtl:s}));let E={horizontal:[c],vertical:[at],both:[c,at]}[n],D={horizontal:[m],vertical:[st],both:[m,st]}[n],O=g?o:{horizontal:u?ke:pt,vertical:u?Ye:tt,both:o}[n];u&&(e.key===`Home`?b=C:e.key===`End`&&(b=T)),b===x&&(E.includes(e.key)||D.includes(e.key))&&(t&&b===T&&E.includes(e.key)?(b=C,i&&(b=i(e,x,b,y))):t&&b===C&&D.includes(e.key)?(b=T,i&&(b=i(e,x,b,y))):b=ot(y.current,{startingIndex:b,decrement:D.includes(e.key),disabledIndices:f})),b!==x&&!ct(y.current,b)&&(d&&e.stopPropagation(),O.has(e.key)&&e.preventDefault(),S(b,!0),queueMicrotask(()=>{y.current[b]?.focus()}))});return{props:{ref:v,onFocus(e){let t=_.current,n=H(e.nativeEvent);!t||n==null||!Le(n)||n.setSelectionRange(0,n.value.length??0)},onKeyDown:T},highlightedIndex:x,onHighlightedIndexChange:S,elementsRef:y,disabledIndices:f,onMapChange:C,relayKeyboardEvent:T}}function Li(e,t){for(let n of Ne.values())if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function Ri(e){let{render:n,className:r,style:i,refs:a=t,props:s=t,state:c=l,stateAttributesMapping:u,highlightedIndex:d,onHighlightedIndexChange:f,orientation:p,grid:m,loopFocus:h,onLoop:g,enableHomeAndEndKeys:_,onMapChange:v,stopEventPropagation:y=!0,rootRef:b,disabledIndices:S,modifierKeys:C,highlightItemOnHover:w=!1,tag:T=`div`,...E}=e,{props:D,highlightedIndex:O,onHighlightedIndexChange:k,elementsRef:A,onMapChange:j,relayKeyboardEvent:M}=Ii({grid:m,loopFocus:h,onLoop:g,orientation:p,highlightedIndex:d,onHighlightedIndexChange:f,rootRef:b,stopEventPropagation:y,enableHomeAndEndKeys:_,direction:we(),disabledIndices:S,modifierKeys:C}),N=o(T,e,{state:c,ref:a,props:[D,...s,E],stateAttributesMapping:u}),P=Z.useMemo(()=>({highlightedIndex:O,onHighlightedIndexChange:k,highlightItemOnHover:w,relayKeyboardEvent:M}),[O,k,w,M]);return(0,$.jsx)(x.Provider,{value:P,children:(0,$.jsx)(jt,{elementsRef:A,onMapChange:e=>{v?.(e),j(e)},children:N})})}var zi=Z.forwardRef(function(e,n){let{activateOnFocus:r=!1,className:i,loopFocus:a=!0,render:o,style:s,...c}=e,{onValueChange:l,orientation:u,value:d,setTabMap:f,tabActivationDirection:p}=hi(),[m,h]=Z.useState(0),[g,_]=Z.useState(null),v=Z.useRef(new Set),y=Z.useRef(new Set),b=Z.useRef(null);Y(()=>{if(typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>{v.current.forEach(e=>{e()})});return b.current=e,g&&e.observe(g),y.current.forEach(t=>{e.observe(t)}),()=>{e.disconnect(),b.current=null}},[g]);let x=J(e=>(v.current.add(e),()=>{v.current.delete(e)})),S=J(e=>(y.current.add(e),b.current?.observe(e),()=>{y.current.delete(e),b.current?.unobserve(e)})),C=J((e,t)=>{e!==d&&l(e,t)}),w={orientation:u,tabActivationDirection:p},T={"aria-orientation":u===`vertical`?`vertical`:void 0,role:`tablist`},E=Z.useMemo(()=>({activateOnFocus:r,highlightedTabIndex:m,registerIndicatorUpdateListener:x,registerTabResizeObserverElement:S,onTabActivation:C,setHighlightedTabIndex:h,tabsListElement:g}),[r,m,x,S,C,h,g]);return(0,$.jsx)(xi.Provider,{value:E,children:(0,$.jsx)(Ri,{render:o,className:i,style:s,state:w,refs:[n,_],props:[T,c],stateAttributesMapping:_i,highlightedIndex:m,enableHomeAndEndKeys:!0,loopFocus:a,orientation:u,onHighlightedIndexChange:h,onMapChange:f,disabledIndices:t})})});function Bi({className:e,...t}){return(0,$.jsx)(vi,{className:c(`flex flex-col gap-4`,e),"data-slot":`tabs`,...t})}function Vi({className:e,...t}){return(0,$.jsxs)(zi,{className:c(`relative z-0 flex w-fit items-center gap-1 rounded-lg bg-muted p-1`,e),"data-slot":`tabs-list`,...t,children:[t.children,(0,$.jsx)(ji,{className:`absolute top-1/2 left-0 z-[-1] h-[calc(100%-0.5rem)] w-(--active-tab-width) -translate-y-1/2 translate-x-(--active-tab-left) rounded-md bg-background shadow-xs transition-all duration-150`,"data-slot":`tabs-indicator`})]})}function Hi({className:e,...t}){return(0,$.jsx)(Ci,{className:c(`flex h-7 cursor-pointer items-center justify-center whitespace-nowrap rounded-md border border-transparent px-2.5 font-medium text-muted-foreground text-sm outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring data-selected:text-foreground`,e),"data-slot":`tabs-tab`,...t})}function Ui({className:e,...t}){return(0,$.jsx)(Pi,{className:c(`flex-1 outline-none`,e),"data-slot":`tabs-panel`,...t})}var Wi=Z.createContext(void 0);function Gi(e){let t=Z.useContext(Wi);if(t===void 0&&!e)throw Error(r(47));return t}function Ki(){return{...Qt(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}var qi={...Jt,disabled:K(e=>e.disabled),instantType:K(e=>e.instantType),openMethod:K(e=>e.openMethod),openChangeReason:K(e=>e.openChangeReason),modal:K(e=>e.modal),focusManagerModal:K(e=>e.focusManagerModal),stickIfOpen:K(e=>e.stickIfOpen),titleElementId:K(e=>e.titleElementId),descriptionElementId:K(e=>e.descriptionElementId),openOnHover:K(e=>e.openOnHover),closeDelay:K(e=>e.closeDelay),hasViewport:K(e=>e.hasViewport)},Ji=class e extends Ae{constructor(e,t,n=!1){let r={...Ki(),...e},i=new te;r.open&&e?.mounted===void 0&&(r.mounted=!0),r.floatingRootContext=qt(i,t,n),super(r,{popupRef:Z.createRef(),backdropRef:Z.createRef(),internalBackdropRef:Z.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:Z.createRef(),beforeContentFocusGuardRef:Z.createRef(),stickIfOpenTimeout:new _e,triggerElements:i},qi)}setOpen=(e,t)=>{let n=t.reason===Ct,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=T(t),o=this.select(`activeTriggerId`);if(!e&&t.reason===`close-press`&&t.trigger==null&&o!=null&&(t.trigger=this.context.triggerElements.getById(o)??this.select(`activeTriggerElement`)??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let s=()=>{let n={open:e,openChangeReason:t.reason};F(n,e,t.trigger,a()),this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),lr.flushSync(s)):s(),r||i?this.set(`instantType`,r?`click`:`dismiss`):t.reason===`focus-out`?this.set(`instantType`,`focus`):this.set(`instantType`,void 0)};static useStore(t,n){let{store:r,internalStore:i}=ue(t,(t,r)=>new e(n,t,r));return Z.useEffect(()=>i?.disposeEffect(),[i]),r}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()};function Yi({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=Ji.useStore(s?.store,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});St(u,n,r,l),u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`mounted`),p=u.useState(`payload`),m=z()!=null;u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a),A(u,d),se(u);let{forceUnmount:h}=y(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null})});u.useSyncedValues({modal:o,nested:m}),Z.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]);let g=Z.useCallback(()=>{u.setOpen(!1,X(v))},[u]);Z.useImperativeHandle(e.actionsRef,()=>({unmount:h,close:g}),[h,g]);let _=d||f,b=Z.useMemo(()=>({store:u}),[u]);return(0,$.jsxs)(Wi.Provider,{value:b,children:[_&&(0,$.jsx)(Zi,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})}function Xi(e){return Gi(!0)?(0,$.jsx)(Yi,{props:e}):(0,$.jsx)(W,{children:(0,$.jsx)(Yi,{props:e})})}function Zi({store:e,modal:t}){let n=rt(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}});return fe(e,{activeTriggerProps:n.reference??l,inactiveTriggerProps:n.trigger??l,popupProps:Z.useMemo(()=>u(re,n.floating),[n.floating])}),null}var Qi=Z.forwardRef(function(e,t){let{render:n,className:i,style:a,disabled:s=!1,nativeButton:c=!0,handle:l,payload:u,openOnHover:d=!1,delay:f=300,closeDelay:p=0,id:m,...h}=e,g=Gi(!0),_=l?.store??g?.store;if(!_)throw Error(r(74));let v=be(m),y=_.useState(`isTriggerActive`,v),b=_.useState(`floatingRootContext`),x=_.useState(`isOpenedByTrigger`,v),C=_.useState(`triggerPopupId`,v),w=Z.useRef(null),{registerTrigger:T,isMountedByThisTrigger:E}=me(v,w,_,{payload:u,disabled:s,openOnHover:d,closeDelay:p}),D=_.useState(`openChangeReason`),O=_.useState(`stickIfOpen`),k=_.useState(`openMethod`),A=_.useState(`focusManagerModal`),j=dr(b,{enabled:!s&&b!=null&&d&&(k!==`touch`||D!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:vr(),restMs:f,delay:{close:p},triggerElementRef:w,isActiveTrigger:y,isClosing:()=>_.select(`transitionStatus`)===`ending`}),M=Tt(b,{enabled:b!=null,stickIfOpen:O}),N=kt(()=>_.select(`open`),e=>{_.set(`openMethod`,e)}),P=_.useState(`triggerProps`,E),{getButtonProps:F,buttonRef:I}=V({disabled:s,native:c}),ee={open(e){return e&&D===`trigger-press`?S.open(e):ne.open(e)}},{preFocusGuardRef:te,handlePreFocusGuardFocus:L,handleFocusTargetFocus:R}=Kr(_,w),re=o(`button`,e,{state:{disabled:s,open:x},ref:[I,t,T,w],props:[M.reference,j,P,N,{[$e]:``,id:v,"aria-haspopup":`dialog`,"aria-expanded":x,"aria-controls":C},h,F],stateAttributesMapping:ee});return E&&!A?(0,$.jsxs)(Z.Fragment,{children:[(0,$.jsx)(Oe,{ref:te,onFocus:L}),(0,$.jsx)(Z.Fragment,{children:re},v),(0,$.jsx)(Oe,{ref:_.context.triggerFocusTargetRef,onFocus:R})]}):(0,$.jsx)(Z.Fragment,{children:re},v)}),$i=Z.createContext(void 0);function ea(){let e=Z.useContext($i);if(e===void 0)throw Error(r(45));return e}var ta=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Gi();return i.useState(`mounted`)||n?(0,$.jsx)($i.Provider,{value:n,children:(0,$.jsx)(ft,{ref:t,...r})}):null}),na=Z.createContext(void 0);function ra(){let e=Z.useContext(na);if(!e)throw Error(r(46));return e}var ia=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,anchor:a,positionMethod:o=`absolute`,side:s=`bottom`,align:c=`center`,sideOffset:l=0,alignOffset:u=0,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f=5,arrowPadding:p=5,sticky:m=!1,disableAnchorTracking:h=!1,collisionAvoidance:g=Ce,..._}=e,{store:v}=Gi(),y=ea(),b=ye(),x=v.useState(`floatingRootContext`),S=v.useState(`mounted`),C=v.useState(`open`),w=v.useState(`openChangeReason`),T=v.useState(`activeTriggerElement`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`positionerElement`),k=v.useState(`instantType`),A=v.useState(`transitionStatus`),j=v.useState(`hasViewport`),M=Z.useRef(null),N=P(O,!1,!1),F=Lt({anchor:a,floatingRootContext:x,positionMethod:o,mounted:S,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:h,keepMounted:y,nodeId:b,collisionAvoidance:g,adaptiveOrigin:j?Dt:void 0}),I=x.useState(`domReferenceElement`);Y(()=>{let e=I,t=M.current;if(e&&(M.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return N(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[I,N,v]),At(C&&E===!0&&w!==`trigger-hover`,D===`touch`,O,T);let ee=Z.useCallback(e=>{v.set(`positionerElement`,e)},[v]),te=Et(e,{open:C,side:F.side,align:F.align,anchorHidden:F.anchorHidden,instant:k},{styles:F.positionerStyles,transitionStatus:A,props:_,refs:[t,ee],hidden:!S,inert:!C});return(0,$.jsxs)(na.Provider,{value:F,children:[S&&E===!0&&w!==`trigger-hover`&&(0,$.jsx)(bt,{ref:v.context.internalBackdropRef,inert:vt(!C),cutout:T}),(0,$.jsx)(ve,{id:b,children:te})]})}),aa=Z.createContext(void 0);function oa(){let[e,t]=Z.useState(0),n=J(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:Z.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}function sa(e){let{value:t,children:n}=e;return(0,$.jsx)(aa.Provider,{value:t,children:n})}var ca={...w,...N},la=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:s,...c}=e,{store:l}=Gi(),u=ra(),d=It(!0)!=null,{context:f,hasClosePart:p}=oa(),m=l.useState(`open`),h=l.useState(`openMethod`),g=l.useState(`instantType`),_=l.useState(`transitionStatus`),v=l.useState(`popupProps`),y=l.useState(`titleElementId`),b=l.useState(`descriptionElementId`),x=l.useState(`modal`),S=l.useState(`mounted`),C=l.useState(`openChangeReason`),w=l.useState(`activeTriggerElement`),T=l.useState(`floatingRootContext`),E=T.useState(`floatingId`),D=l.useState(`disabled`),O=l.useState(`openOnHover`),A=l.useState(`closeDelay`),N=c.id??E;k({open:m,ref:l.context.popupRef,onComplete(){m&&l.context.onOpenChangeComplete?.(!0)}}),cr(T,{enabled:O&&!D,closeDelay:A});let P=a===void 0?j(l.context.popupRef):a,F=x!==!1&&p;l.useSyncedValue(`focusManagerModal`,F);let I=Z.useCallback(e=>{l.set(`popupElement`,e)},[l]),ee=o(`div`,e,{state:{open:m,side:u.side,align:u.align,instant:g,transitionStatus:_},ref:[t,l.context.popupRef,I],props:[v,{id:N,role:`dialog`,...re,"aria-labelledby":y,"aria-describedby":b,onKeyDown(e){d&&Ee.has(e.key)&&e.stopPropagation()}},Pt(_),c],stateAttributesMapping:ca});return(0,$.jsx)(M,{context:T,openInteractionType:h,modal:F,disabled:!S||C===`trigger-hover`,initialFocus:P,returnFocus:s,restoreFocus:`popup`,previousFocusableElement:he(w)?w:void 0,nextFocusableElement:l.context.triggerFocusTargetRef,beforeContentFocusGuardRef:l.context.beforeContentFocusGuardRef,children:(0,$.jsx)(sa,{value:f,children:ee})})}),ua=function(e){return e.popupWidth=`--popup-width`,e.popupHeight=`--popup-height`,e}({}),da={activationDirection:e=>e?{"data-activation-direction":e}:null},fa=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...s}=e,{store:c}=Gi(),{side:l}=ra(),u=c.useState(`instantType`),{children:d,state:f}=ii({store:c,side:l,cssVars:ua,children:a});return o(`div`,e,{state:{activationDirection:f.activationDirection,transitioning:f.transitioning,instant:u},ref:t,props:[s,{children:d}],stateAttributesMapping:da})}),pa=Xi;function ma({className:e,children:t,...n}){return(0,$.jsx)(Qi,{className:e,"data-slot":`popover-trigger`,...n,children:t})}function ha({children:e,className:t,viewportClassName:n,side:r=`bottom`,align:i=`center`,sideOffset:a=4,alignOffset:o=0,tooltipStyle:s=!1,anchor:l,...u}){return(0,$.jsx)(ta,{children:(0,$.jsx)(ia,{align:i,alignOffset:o,anchor:l,className:`z-50 h-(--positioner-height) w-(--positioner-width) max-w-(--available-width) transition-[top,left,right,bottom,transform] data-instant:transition-none`,"data-slot":`popover-positioner`,side:r,sideOffset:a,children:(0,$.jsx)(la,{className:c(`relative flex h-(--popup-height,auto) w-(--popup-width,auto) origin-(--transform-origin) rounded-lg border bg-popover not-dark:bg-clip-padding text-popover-foreground shadow-lg/5 outline-none transition-[width,height,scale,opacity] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] has-data-[slot=calendar]:rounded-xl has-data-[slot=calendar]:before:rounded-[calc(var(--radius-xl)-1px)] data-starting-style:scale-98 data-starting-style:opacity-0 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]`,s&&`w-fit text-balance rounded-md text-xs shadow-md/5 before:rounded-[calc(var(--radius-md)-1px)]`,t),"data-slot":`popover-popup`,...u,children:(0,$.jsx)(fa,{className:c(`relative size-full max-h-(--available-height) overflow-clip px-(--viewport-inline-padding) py-4 [--viewport-inline-padding:--spacing(4)] has-data-[slot=calendar]:p-2 data-instant:transition-none **:data-current:data-ending-style:opacity-0 **:data-current:data-starting-style:opacity-0 **:data-previous:data-ending-style:opacity-0 **:data-previous:data-starting-style:opacity-0 **:data-current:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-previous:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-current:opacity-100 **:data-previous:opacity-100 **:data-current:transition-opacity **:data-previous:transition-opacity`,s?`py-1 [--viewport-inline-padding:--spacing(2)]`:`not-data-transitioning:overflow-y-auto`,n),"data-slot":`popover-viewport`,children:e})})})})}function ga({repos:e,disabled:t,onAdd:n}){let[r,i]=(0,Z.useState)(!1),[a,o]=(0,Z.useState)(``),s=(0,Z.useMemo)(()=>{let t=a.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||e.path.toLowerCase().includes(t)):e},[e,a]);return(0,$.jsxs)(pa,{open:r,onOpenChange:e=>{e&&o(``),i(e)},children:[(0,$.jsx)(ma,{render:(0,$.jsxs)(f,{variant:`outline`,size:`sm`,disabled:t,className:`h-8 text-xs text-muted-foreground`,children:[(0,$.jsx)(hn,{size:14}),` Add repository`]})}),(0,$.jsxs)(ha,{align:`end`,className:`w-[320px]`,viewportClassName:`p-0`,children:[(0,$.jsx)(`div`,{className:`border-b border-border p-2`,children:(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(Wt,{className:`absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground`}),(0,$.jsx)(ce,{autoFocus:!0,value:a,onChange:e=>o(e.target.value),placeholder:`Search repositories`,className:`pl-8`,"aria-label":`Search repositories`})]})}),(0,$.jsx)(`div`,{role:`listbox`,className:`max-h-64 overflow-y-auto py-1`,children:s.length===0?(0,$.jsx)(`div`,{className:`px-3 py-4 text-center text-sm text-muted-foreground`,children:`No repositories found.`}):s.map(e=>(0,$.jsxs)(`button`,{role:`option`,"aria-selected":!1,onClick:()=>{i(!1),n(e.path)},className:`flex w-full cursor-pointer items-center gap-3 px-3 py-2 text-left transition-colors hover:bg-accent`,children:[(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium`,children:e.name}),(0,$.jsx)(`span`,{className:`block truncate font-mono text-xs text-muted-foreground`,children:e.path})]}),(0,$.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:e.defaultBranch})]},e.path))})]})]})}var _a=e=>e===`antigravity`?`Antigravity`:e===`claude`?`Claude Code`:e===`codex`?`OpenAI Codex`:`GitHub Copilot`,va=e=>e===`claude`?`warning`:e===`codex`?`success`:e===`antigravity`?`accent`:`info`,ya=({ws:e,sessions:t,sessionsLoading:n,setActiveSession:r,setTranscript:i,fetchSessionTranscript:a,handleResumeSession:o,handleOpenDesktopSession:s})=>{let c=tn(),l=c.data?.find(e=>e.id===`codex-desktop`),u=l?.available===!0,d=c.isLoading?`Checking whether Codex Desktop is available…`:c.isError?`Could not check whether Codex Desktop is available.`:l?.unavailableReason??`Codex Desktop is not available on this computer.`,p=(0,Z.useRef)(null),[m,h]=(0,Z.useState)(null),g=async t=>{if(!(!u||p.current)){p.current=t,h(t);try{await s(e,t,`codex`)}finally{p.current=null,h(null)}}};return(0,$.jsx)(`div`,{children:n?(0,$.jsx)(`div`,{className:`flex justify-center py-10`,children:(0,$.jsx)(ut,{className:`size-5 text-primary`})}):t.length===0?(0,$.jsx)(An,{className:`rounded-xl border border-border bg-card`,children:(0,$.jsxs)(kn,{children:[(0,$.jsx)(Dn,{variant:`icon`,children:(0,$.jsx)(zn,{})}),(0,$.jsx)(En,{children:`No Past AI Sessions Found`}),(0,$.jsxs)(On,{children:[`Start a conversation with your AI assistant (e.g. running `,(0,$.jsx)(`code`,{children:`claude`}),`, `,(0,$.jsx)(`code`,{children:`agy`}),`, `,(0,$.jsx)(`code`,{children:`codex`}),`, or `,(0,$.jsx)(`code`,{children:`copilot`}),` inside this directory) to track session history here.`]})]})}):(0,$.jsx)(`div`,{className:`space-y-3 mb-6`,children:t.map(t=>(0,$.jsxs)(`div`,{className:`flex flex-col justify-between gap-4 rounded-xl border border-border bg-card p-4 transition-colors hover:border-foreground/15 md:flex-row md:items-center`,children:[(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5 mb-1.5`,children:[(0,$.jsx)(mn,{tone:va(t.assistant),children:_a(t.assistant)}),(0,$.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[`Updated: `,new Date(t.updatedAt).toLocaleString()]}),(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`•`}),(0,$.jsxs)(`span`,{className:`text-[10px] font-medium text-muted-foreground`,children:[t.messageCount,` messages`]})]}),(0,$.jsx)(`h4`,{className:`truncate pr-4 text-xs font-semibold text-foreground`,title:t.title,children:t.title})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,$.jsxs)(f,{variant:`outline`,size:`sm`,onClick:()=>{r(t),i([]),a(t.assistant,t.id)},children:[(0,$.jsx)(Bn,{size:13}),` View Chat Log`]}),(t.assistant===`claude`||t.assistant===`codex`)&&(0,$.jsxs)(f,{size:`sm`,onClick:()=>o(e,t.id,t.assistant),children:[(0,$.jsx)(wn,{size:11}),` Resume in NexusFlow`]}),t.assistant===`codex`&&(0,$.jsxs)(f,{variant:`outline`,size:`sm`,disabled:!u||m!==null,title:u?`Open this exact thread in Codex Desktop`:d,"aria-label":u?`Open in Codex Desktop`:`Codex Desktop unavailable: ${d}`,onClick:()=>void g(t.id),children:[m===t.id?(0,$.jsx)(ut,{className:`size-3`}):(0,$.jsx)(cn,{size:12}),m===t.id?`Opening…`:`Open in Codex Desktop`]})]})]},t.id))})})};function ba({ws:e}){let t=e.branchName,n=$t(t),r=Yt(t),i=en(t),a=n.data,o=(0,Z.useMemo)(()=>a?.services??[],[a]),s=(0,Z.useMemo)(()=>a?.runningState??[],[a]),l=a?.orchestrationTools??[],u=(0,Z.useMemo)(()=>a?.runningOrchestrators??[],[a]),d=(0,Z.useMemo)(()=>u.filter(e=>e.mode===`pm2`&&e.logName),[u]),[p,m]=(0,Z.useState)(`classic`),[h,g]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(null);(0,Z.useEffect)(()=>{let e=[...o.map(e=>e.name),...d.map(e=>e.logName)];e.length===0?_!==null&&v(null):(!_||!e.includes(_))&&v(e[0])},[o,d]);let{logs:y,connected:b,clear:x}=Xt(t,_,!0),S=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{S.current?.scrollIntoView({behavior:`smooth`})},[y]);let C=(0,Z.useMemo)(()=>new Set(s.filter(e=>e.pid>0).map(e=>e.name)),[s]),w=(0,Z.useMemo)(()=>new Set(u.map(e=>e.id)),[u]),T=C.size>0,E=p===`matrix`?`term-matrix`:p===`dracula`?`term-dracula`:`term-classic`,D=r.isPending||i.isPending;return(0,$.jsxs)(`div`,{className:`animate-fade-in`,children:[n.isLoading&&(0,$.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-[10px] text-primary`,children:[(0,$.jsx)(ut,{className:`size-3`}),(0,$.jsx)(`span`,{className:`font-semibold tracking-wider uppercase`,children:`Scanning service configurations...`})]}),l.length>0&&(0,$.jsxs)(`div`,{className:`mb-5 rounded-xl border border-border bg-card p-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-[10px] font-bold uppercase tracking-wider text-muted-foreground`,children:[(0,$.jsx)(rn,{size:12,className:`text-info`}),` Orchestration tools`]}),(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:l.map(e=>{let t=w.has(e.id);return(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-border bg-muted/30 p-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`h-2 w-2 rounded-full ${t?`bg-success`:`bg-muted-foreground/40`}`}),(0,$.jsx)(`span`,{className:`text-xs font-bold text-foreground`,children:e.tool}),(0,$.jsx)(mn,{tone:`idle`,dot:!1,children:e.mode})]}),(0,$.jsx)(`code`,{className:`mt-1 block truncate font-mono text-[9px] text-muted-foreground`,children:e.configPath})]}),(0,$.jsx)(`div`,{className:`shrink-0`,children:t?(0,$.jsxs)(f,{size:`xs`,variant:`destructive`,"aria-label":`Stop ${e.tool}`,disabled:D,onClick:()=>i.mutate({action:`stop`,id:e.id}),children:[(0,$.jsx)(qn,{size:12}),` Stop`]}):(0,$.jsxs)(f,{size:`xs`,"aria-label":`Start ${e.tool}`,disabled:D,onClick:()=>i.mutate({action:`start`,id:e.id}),children:[(0,$.jsx)(wn,{size:12}),` Start`]})})]},e.id)})})]}),(0,$.jsxs)(`div`,{className:`mb-6 rounded-xl border border-border bg-card p-5`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between text-xs font-semibold text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:`Workspace Status`}),(0,$.jsx)(mn,{tone:T?`running`:`idle`,children:T?`Active`:`Standby`})]}),(0,$.jsx)(`div`,{className:`mb-4 text-xs font-semibold text-foreground`,children:T?`${C.size} process${C.size===1?``:`es`} active`:`All processes offline`}),(0,$.jsxs)(`div`,{className:`flex gap-3`,children:[(0,$.jsxs)(f,{disabled:T||D,onClick:()=>r.mutate({action:`start`}),children:[(0,$.jsx)(wn,{size:14}),` Start All Services`]}),(0,$.jsxs)(f,{variant:`destructive`,disabled:!T||D,onClick:()=>r.mutate({action:`stop`}),children:[(0,$.jsx)(qn,{size:14}),` Stop All`]})]})]}),(o.length>0||d.length>0)&&(0,$.jsxs)(`div`,{className:`grid grid-cols-1 overflow-hidden rounded-xl border border-border bg-card shadow-sm lg:grid-cols-12`,children:[(0,$.jsxs)(`div`,{className:`border-b border-border bg-muted/30 p-5 lg:col-span-4 lg:border-b-0 lg:border-r`,children:[(0,$.jsxs)(`h4`,{className:`mb-4 flex items-center gap-1.5 border-b border-border pb-2 text-[10px] font-bold uppercase tracking-wider text-muted-foreground`,children:[(0,$.jsx)(Jn,{size:12,className:`text-primary`}),` Background Services`]}),(0,$.jsxs)(`div`,{className:`flex max-h-[400px] flex-col gap-2 overflow-y-auto pr-1`,children:[o.map(e=>{let t=_===e.name,n=C.has(e.name);return(0,$.jsxs)(`div`,{className:c(`flex cursor-pointer flex-col rounded-xl border p-3 transition-colors`,t?`border-primary/40 bg-primary/10 text-foreground`:`border-border bg-card text-muted-foreground hover:border-foreground/15 hover:bg-accent/50 hover:text-foreground`),onClick:()=>v(e.name),children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full ${n?`bg-success`:`bg-destructive`}`}),(0,$.jsx)(`span`,{className:`truncate text-xs font-bold`,children:e.name})]}),(0,$.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,onClick:e=>e.stopPropagation(),children:n?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(f,{size:`icon-xs`,variant:`ghost`,"aria-label":`Restart ${e.name}`,disabled:D,onClick:()=>r.mutate({action:`restart`,service:e.name}),children:(0,$.jsx)(Hn,{})}),(0,$.jsx)(f,{size:`icon-xs`,variant:`ghost`,"aria-label":`Stop ${e.name}`,disabled:D,onClick:()=>r.mutate({action:`stop`,service:e.name}),children:(0,$.jsx)(qn,{})})]}):(0,$.jsx)(f,{size:`icon-xs`,variant:`ghost`,"aria-label":`Start ${e.name}`,disabled:D,onClick:()=>r.mutate({action:`start`,service:e.name}),children:(0,$.jsx)(wn,{})})})]}),e.port?(0,$.jsxs)(`span`,{className:`mt-2 w-fit rounded border border-border bg-background px-2 py-0.5 font-mono text-[9px] text-muted-foreground`,children:[`Port: `,e.port]}):null,(0,$.jsxs)(`code`,{className:`mt-2 block truncate rounded border border-border bg-muted/40 p-1.5 font-mono text-[9px] text-muted-foreground`,children:[e.command,` `,e.args.join(` `)]})]},e.name)}),d.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`mt-2 border-t border-border pt-3 text-[9px] font-bold uppercase tracking-wider text-muted-foreground`,children:`Orchestrators`}),d.map(e=>{let t=e.logName;return(0,$.jsxs)(`div`,{className:c(`flex cursor-pointer items-center gap-2 rounded-xl border p-3 transition-colors`,_===t?`border-primary/40 bg-primary/10 text-foreground`:`border-border bg-card text-muted-foreground hover:border-foreground/15 hover:bg-accent/50 hover:text-foreground`),onClick:()=>v(t),children:[(0,$.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full bg-success`}),(0,$.jsx)(`span`,{className:`truncate text-xs font-bold`,children:e.tool}),(0,$.jsx)(mn,{tone:`idle`,dot:!1,children:e.mode})]},e.id)})]})]})]}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col bg-background lg:col-span-8`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-border bg-muted/40 px-5 py-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`font-mono text-xs font-bold text-primary`,children:_||`no-service`}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`|`}),(0,$.jsx)(mn,{tone:b?`running`:`idle`,children:b?`streaming`:`idle`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3 self-end sm:self-auto`,children:[(0,$.jsx)(`div`,{className:`flex rounded-lg border border-border bg-card p-0.5 text-[9px] font-semibold text-muted-foreground`,children:[`classic`,`matrix`,`dracula`].map(e=>(0,$.jsx)(`button`,{className:c(`cursor-pointer rounded-md px-2 py-1 capitalize transition-colors`,p===e?`bg-primary/10 font-bold text-primary`:`hover:text-foreground`),onClick:()=>m(e),children:e},e))}),(0,$.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,$.jsx)(`button`,{onClick:x,className:`cursor-pointer rounded-lg border border-border bg-card p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:`Clear Console`,children:(0,$.jsx)(Gt,{size:13})}),(0,$.jsx)(`button`,{onClick:()=>g(!h),className:`cursor-pointer rounded-lg border border-border bg-card p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:h?`Minimize Console`:`Expand Console`,children:h?(0,$.jsx)(Vn,{size:13}):(0,$.jsx)(Rn,{size:13})})]})]})]}),(0,$.jsxs)(`div`,{className:c(`relative overflow-y-auto whitespace-pre-wrap p-5 font-mono text-[10.5px] leading-relaxed selection:bg-primary/20`,E,h?`h-[520px]`:`h-80`),children:[y.trim()?y:(0,$.jsx)(`span`,{className:`font-mono italic text-muted-foreground`,children:`(no log content yet)`}),(0,$.jsx)(`div`,{ref:S})]})]})]})]})}var xa=({ws:e,gitChanges:t,gitChangesLoading:n,syncLoading:r,syncResults:i,commitMessage:a,showCommitModal:o,commitLoading:s,commitResults:c,setSyncResults:l,setCommitResults:u,setCommitMessage:d,setShowCommitModal:p,fetchGitChanges:m,handleSyncAll:h,handleCommitAll:g})=>{let[_,v]=(0,Z.useState)({}),[y,b]=(0,Z.useState)({}),[x,S]=(0,Z.useState)({}),[C,w]=(0,Z.useState)({}),[T,E]=(0,Z.useState)(``),D=async(t,n)=>{let r=`${t}/${n}`,i=!_[r];if(v(e=>({...e,[r]:i})),i&&!y[r]){S(e=>({...e,[r]:!0})),w(e=>({...e,[r]:``}));try{let i=encodeURIComponent(e.branchName),a=await fetch(`/api/workspace/${i}/changes/diff?repo=${encodeURIComponent(t)}&file=${encodeURIComponent(n)}`);if(!a.ok)throw Error(`Failed to load diff: ${a.statusText}`);let o=await a.json();b(e=>({...e,[r]:o.diff||``}))}catch(e){w(t=>({...t,[r]:e.message||`Unknown error`}))}finally{S(e=>({...e,[r]:!1}))}}},O=e=>!e||!e.trim()?(0,$.jsx)(`div`,{className:`p-3 font-mono text-[11px] italic text-muted-foreground`,children:`No diff details available.`}):(0,$.jsx)(`pre`,{className:`custom-scrollbar max-h-[450px] overflow-x-auto overflow-y-auto rounded-xl border border-border bg-muted/40 p-4 font-mono text-[11px] leading-relaxed text-muted-foreground select-text`,children:e.split(`
2
- `).map((e,t)=>{let n;return n=e.startsWith(`+`)&&!e.startsWith(`+++`)?`block w-full rounded-sm bg-success/10 px-1 text-success-foreground`:e.startsWith(`-`)&&!e.startsWith(`---`)?`block w-full rounded-sm bg-destructive/10 px-1 text-destructive-foreground`:e.startsWith(`@@`)?`block w-full bg-info/10 px-1 font-semibold italic text-info-foreground`:e.startsWith(`diff`)||e.startsWith(`index`)||e.startsWith(`---`)||e.startsWith(`+++`)?`block w-full font-bold text-muted-foreground`:`block w-full px-1 text-foreground`,(0,$.jsx)(`code`,{className:n,children:e},t)})});return(0,$.jsxs)(`div`,{className:`animate-fade-in`,children:[(0,$.jsxs)(`header`,{className:`flex justify-between items-center mb-6 flex-wrap gap-3`,children:[(0,$.jsxs)(`h4`,{className:`flex items-center gap-2 text-sm font-bold text-foreground`,children:[(0,$.jsx)(sn,{size:16,className:`text-primary`}),` Active Workspace Git Diffs`]}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsxs)(f,{variant:`outline`,size:`sm`,onClick:()=>m(e.branchName),disabled:n,children:[(0,$.jsx)(on,{size:11,className:n?`animate-spin text-primary`:``}),` Refresh Changes`]}),e.mode!==`in-place`&&(0,$.jsxs)(f,{variant:`outline`,size:`sm`,onClick:()=>h(e.branchName),disabled:r,children:[r?(0,$.jsx)(ut,{className:`size-3`}):(0,$.jsx)(on,{size:11}),` Sync All`]}),(0,$.jsx)(f,{size:`sm`,onClick:()=>p(!0),disabled:t.every(e=>e.files.length===0)||s,children:`Commit & Push All`})]})]}),i&&e.mode!==`in-place`&&(0,$.jsxs)(`div`,{className:`relative mb-5 rounded-xl border border-info/25 bg-info/10 p-5 text-info-foreground shadow-sm`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between border-b border-info/20 pb-2`,children:[(0,$.jsx)(`h5`,{className:`font-mono text-xs font-bold text-foreground`,children:`Rebase / Sync Action Logs`}),(0,$.jsx)(`button`,{className:`cursor-pointer text-[10px] font-bold text-info-foreground hover:text-foreground`,onClick:()=>l(null),children:`Dismiss`})]}),(0,$.jsx)(`div`,{className:`space-y-2`,children:i.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-border bg-card p-2 font-mono text-[10px]`,children:[(0,$.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.repoName}),(0,$.jsx)(`span`,{className:e.success?`font-bold text-success-foreground`:`font-bold text-destructive-foreground`,children:e.success?`✓ Synced (${e.message})`:`✗ Conflict: ${e.message}`})]},e.repoName))})]}),c&&(0,$.jsxs)(`div`,{className:`relative mb-5 rounded-xl border border-success/25 bg-success/10 p-5 text-success-foreground shadow-sm`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between border-b border-success/20 pb-2`,children:[(0,$.jsx)(`h5`,{className:`font-mono text-xs font-bold text-foreground`,children:`Commit & Push Results`}),(0,$.jsx)(`button`,{className:`cursor-pointer text-[10px] font-bold text-success-foreground hover:text-foreground`,onClick:()=>u(null),children:`Dismiss`})]}),(0,$.jsx)(`div`,{className:`space-y-2`,children:c.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-border bg-card p-2 font-mono text-[10px]`,children:[(0,$.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.repoName}),(0,$.jsx)(`span`,{className:e.success?`font-bold text-success-foreground`:`font-bold text-destructive-foreground`,children:e.success?`✓ Committed ${e.filesChanged} file(s) (${e.commitHash?e.commitHash.slice(0,7):`no hash`})`:`✗ Error: ${e.message}`})]},e.repoName))})]}),o&&(0,$.jsxs)(`div`,{className:`relative mb-6 rounded-xl border border-border bg-card p-6 shadow-sm animate-rise`,children:[(0,$.jsxs)(`h5`,{className:`mb-3 flex items-center gap-1.5 text-xs font-bold text-foreground`,children:[(0,$.jsx)(Un,{size:13,className:`text-primary`}),` Enter Commit Message`]}),(0,$.jsx)(ce,{type:`text`,className:`mb-4 font-mono text-xs`,placeholder:`feat: implement multi-repo logic...`,value:a,onChange:e=>d(e.target.value),onKeyDown:t=>{t.key===`Enter`&&a.trim()&&g(e.branchName)}}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2.5`,children:[(0,$.jsx)(f,{variant:`outline`,size:`sm`,onClick:()=>{p(!1),d(``)},disabled:s,children:`Cancel`}),(0,$.jsxs)(f,{size:`sm`,onClick:()=>g(e.branchName),disabled:s||!a.trim(),children:[s?(0,$.jsx)(ut,{className:`size-3`}):null,s?`Committing...`:`Commit & Push All`]})]})]}),n?(0,$.jsx)(`div`,{className:`flex justify-center py-20`,children:(0,$.jsx)(ut,{className:`size-6 text-primary`})}):(0,$.jsx)(`div`,{className:`space-y-6`,children:t.every(e=>e.files.length===0)?(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center rounded-xl border border-border bg-card py-16 text-center`,children:[(0,$.jsx)(`div`,{className:`mb-3 flex h-10 w-10 items-center justify-center rounded-full border border-success/25 bg-success/10 text-success-foreground shadow-sm`,children:(0,$.jsx)(fn,{size:20})}),(0,$.jsx)(`h5`,{className:`text-sm font-bold text-foreground`,children:`No Uncommitted Changes`}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Workspace repositories are completely in sync with Git feature branches.`})]}):t.map(e=>{if(e.files.length===0)return null;let t=e.files.length,n=e.files.reduce((e,t)=>e+(t.additions||0),0),r=e.files.reduce((e,t)=>e+(t.deletions||0),0);return(0,$.jsxs)(`div`,{className:`relative rounded-xl border border-border bg-card p-6 transition-colors`,children:[(0,$.jsxs)(`div`,{className:`flex justify-between items-center mb-4 flex-wrap gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,$.jsx)(`h5`,{className:`font-mono text-sm font-bold text-foreground`,children:e.repoName}),(0,$.jsxs)(mn,{tone:`warning`,dot:!1,children:[t,` file`,t===1?``:`s`,` changed`]}),(n>0||r>0)&&(0,$.jsxs)(`span`,{className:`rounded border border-border bg-muted/40 px-2 py-0.5 font-mono text-[10px] font-bold`,children:[(0,$.jsxs)(`span`,{className:`font-bold text-success-foreground`,children:[`+`,n]}),` `,(0,$.jsxs)(`span`,{className:`font-bold text-destructive-foreground`,children:[`-`,r]})]})]}),(0,$.jsx)(`span`,{className:`max-w-[280px] truncate font-mono text-[10px] text-muted-foreground`,title:e.repoPath,children:e.repoPath})]}),(0,$.jsx)(`div`,{className:`flex flex-col gap-3`,children:e.files.map(t=>{let n=`${e.repoName}/${t.file}`,r=!!_[n],i=!!x[n],a=y[n]||``,o=C[n]||``;return(0,$.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-border bg-muted/20 transition-colors hover:border-foreground/15`,children:[(0,$.jsxs)(`div`,{className:`flex cursor-pointer select-none items-center justify-between px-4 py-3 transition-colors hover:bg-accent/50`,onClick:()=>D(e.repoName,t.file),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[r?(0,$.jsx)(wt,{size:14,className:`shrink-0 text-primary`}):(0,$.jsx)(Pn,{size:14,className:`shrink-0 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`max-w-[240px] truncate font-mono text-[11px] text-foreground sm:max-w-[480px]`,title:t.file,children:t.file}),(t.additions>0||t.deletions>0)&&(0,$.jsxs)(`span`,{className:`ml-1 shrink-0 font-mono text-[9px] font-bold text-muted-foreground`,children:[(0,$.jsxs)(`span`,{className:`text-success-foreground`,children:[`+`,t.additions]}),` /`,` `,(0,$.jsxs)(`span`,{className:`text-destructive-foreground`,children:[`-`,t.deletions]})]})]}),(0,$.jsx)(`div`,{className:`flex items-center gap-2.5 shrink-0`,children:(0,$.jsx)(`span`,{className:`rounded border px-2 py-0.5 text-[8px] font-bold uppercase tracking-wider ${t.type===`added`?`border-success/25 bg-success/10 text-success-foreground`:t.type===`deleted`?`border-destructive/25 bg-destructive/10 text-destructive-foreground`:`border-warning/25 bg-warning/10 text-warning-foreground`}`,children:t.type})})]}),r&&(0,$.jsx)(`div`,{className:`border-t border-border bg-background p-3`,children:i?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 p-2 font-mono text-[10px] text-primary`,children:[(0,$.jsx)(ut,{className:`size-3`}),` Loading diff...`]}):o?(0,$.jsxs)(`div`,{className:`p-2 font-mono text-[10px] text-destructive-foreground`,children:[`Error: `,o]}):(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,$.jsx)(`button`,{onClick:e=>{e.stopPropagation(),navigator.clipboard.writeText(a),E(n),setTimeout(()=>E(``),2e3)},className:`cursor-pointer rounded-lg border border-border bg-card p-1.5 text-muted-foreground shadow-sm transition-colors hover:bg-accent hover:text-foreground`,title:`Copy Diff`,children:T===n?(0,$.jsx)(fn,{size:12,className:`text-success-foreground`}):(0,$.jsx)(bn,{size:12})})}),O(a)]})})]},t.file)})})]},e.repoName)})})]})},Sa=({ws:e,knowledgeContent:t,knowledgeLoading:n,isEditingKnowledge:r,editedKnowledge:i,saveKnowledgeLoading:a,setEditedKnowledge:o,setIsEditingKnowledge:s,handleSaveKnowledge:c})=>(0,$.jsxs)(`div`,{className:`rounded-xl border border-border bg-card p-4`,children:[(0,$.jsxs)(`header`,{className:`flex justify-between items-center mb-4`,children:[(0,$.jsxs)(`h4`,{className:`flex items-center gap-2 text-sm font-bold text-foreground`,children:[(0,$.jsx)(un,{size:16,className:`text-info`}),` Persistent Knowledge Memory (nexusflow-knowledge.md)`]}),(0,$.jsx)(`div`,{className:`flex gap-2`,children:r?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(f,{variant:`outline`,size:`xs`,onClick:()=>{o(t),s(!1)},disabled:a,children:`Cancel`}),(0,$.jsxs)(f,{size:`xs`,onClick:()=>c(e.branchName),disabled:a,children:[a?(0,$.jsx)(ut,{className:`size-3`}):(0,$.jsx)(Un,{size:10}),` Save`]})]}):(0,$.jsxs)(f,{variant:`outline`,size:`xs`,onClick:()=>s(!0),disabled:n,children:[(0,$.jsx)(Gn,{size:10}),` Edit Knowledge`]})})]}),n?(0,$.jsx)(`div`,{className:`flex justify-center py-10`,children:(0,$.jsx)(on,{className:`animate-spin text-primary`,size:20})}):r?(0,$.jsx)(Mn,{className:`[&_[data-slot=textarea]]:h-96 [&_[data-slot=textarea]]:resize-y [&_[data-slot=textarea]]:font-mono [&_[data-slot=textarea]]:text-xs`,value:i,onChange:e=>o(e.target.value)}):(0,$.jsx)(`div`,{className:`max-h-96 overflow-auto whitespace-pre-wrap rounded-xl border border-border bg-muted/40 p-4 font-mono text-xs leading-relaxed text-muted-foreground`,children:t||`No knowledge file generated yet.`})]}),Ca=({planContent:e,planLoading:t})=>(0,$.jsxs)(`div`,{className:`rounded-xl border border-border bg-card p-4`,children:[(0,$.jsx)(`header`,{className:`flex justify-between items-center mb-4`,children:(0,$.jsxs)(`h4`,{className:`flex items-center gap-2 text-sm font-bold text-foreground`,children:[(0,$.jsx)(Ln,{size:16,className:`text-info`}),` Inter-Repo Implementation Plan (nexusflow-plan.md)`]})}),t?(0,$.jsx)(`div`,{className:`flex justify-center py-10`,children:(0,$.jsx)(on,{className:`animate-spin text-primary`,size:20})}):(0,$.jsx)(`div`,{className:`max-h-96 overflow-auto whitespace-pre-wrap rounded-xl border border-border bg-muted/40 p-4 font-mono text-xs leading-relaxed text-muted-foreground`,children:e||`No implementation plan generated yet.`})]}),wa=e=>`nexusflow_chat_${e}`,Ta=()=>({v:4,sessions:{},providerId:null,profilesByProvider:{"claude-cli":`review`,"codex-cli":`review`},messages:[]});function Ea(e){try{let t=localStorage.getItem(wa(e));if(!t)return Ta();let n=JSON.parse(t);if(Array.isArray(n))return{...Ta(),messages:n.filter(e=>e&&typeof e.content==`string`&&(e.role===`user`||e.role===`assistant`)).map(e=>({role:e.role,content:e.content}))};if(n&&n.v===4&&n.sessions&&Array.isArray(n.messages)){let e=Object.fromEntries(Object.entries(n.profilesByProvider??{}).filter(e=>vn(e[1])));return{...Ta(),sessions:n.sessions,providerId:typeof n.providerId==`string`?n.providerId:null,profilesByProvider:{...Ta().profilesByProvider,...e},messages:n.messages}}if(n&&n.v===3&&n.sessions&&Array.isArray(n.messages))return{...Ta(),sessions:n.sessions,providerId:typeof n.providerId==`string`?n.providerId:null,messages:n.messages};if(n&&n.v===2&&Array.isArray(n.messages)){let e={};return typeof n.sessionId==`string`&&n.sessionId&&(e[`claude-cli`]={id:n.sessionId,started:!!n.sessionStarted}),{v:4,sessions:e,providerId:typeof n.providerId==`string`?n.providerId:null,profilesByProvider:Ta().profilesByProvider,messages:n.messages}}return Ta()}catch{return Ta()}}var Da=500;function Oa(e,t){try{let n=t.messages.length>Da?{...t,messages:t.messages.slice(-500)}:t;localStorage.setItem(wa(e),JSON.stringify(n))}catch(e){console.error(`Failed to save chat to localStorage`,e)}}function ka(e){try{localStorage.removeItem(wa(e))}catch{}}function Aa({open:e,onClose:t,ws:n,onPick:r,error:i,pending:a=!1}){let[o,s]=(0,Z.useState)([]),[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(null);return(0,Z.useEffect)(()=>{e&&(l(!0),d(null),fetch(`/api/workspace/${encodeURIComponent(n.branchName)}/sessions`).then(e=>e.json()).then(e=>{let t=(e.sessions||[]).filter(e=>e.assistant===`claude`||e.assistant===`codex`);s(t)}).catch(()=>d(`Failed to load sessions.`)).finally(()=>l(!1)))},[e,n.branchName]),(0,$.jsx)(Cn,{open:e,onOpenChange:e=>!e&&t(),children:(0,$.jsxs)(dn,{className:`max-w-lg`,children:[(0,$.jsx)(yn,{children:(0,$.jsx)(ln,{children:`Resume a past session`})}),(0,$.jsxs)(gn,{className:`flex max-h-[60vh] flex-col gap-2`,children:[(i||u)&&(0,$.jsx)(`div`,{className:`rounded-lg border border-destructive/25 bg-destructive/10 px-3 py-2 text-xs text-destructive-foreground`,children:i||u}),c?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(jn,{className:`h-14`}),(0,$.jsx)(jn,{className:`h-14`}),(0,$.jsx)(jn,{className:`h-14`})]}):o.length===0?(0,$.jsx)(An,{children:(0,$.jsxs)(kn,{children:[(0,$.jsx)(Dn,{variant:`icon`,children:(0,$.jsx)(In,{})}),(0,$.jsx)(En,{children:`No resumable sessions found`}),(0,$.jsx)(On,{children:`Past Claude Code and Codex conversations for this workspace will show up here.`})]})}):o.map(e=>(0,$.jsxs)(`button`,{onClick:()=>r(e),disabled:a,className:`cursor-pointer rounded-lg border border-border bg-card p-3 text-left transition-colors hover:border-foreground/15 hover:bg-accent/50 disabled:cursor-wait disabled:opacity-60`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase text-muted-foreground`,children:e.assistant===`codex`?`Codex`:`Claude`}),(0,$.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,title:e.title,children:e.title})]}),(0,$.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-[11px] text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:a?`Loading transcript…`:new Date(e.updatedAt).toLocaleString()}),(0,$.jsx)(`span`,{children:`·`}),(0,$.jsx)(Bn,{size:11}),(0,$.jsxs)(`span`,{children:[e.messageCount,` messages`]})]})]},e.id))]})]})})}var ja=m(((e,t)=>{var n=[[{color:`0, 0, 0`,class:`ansi-black`},{color:`187, 0, 0`,class:`ansi-red`},{color:`0, 187, 0`,class:`ansi-green`},{color:`187, 187, 0`,class:`ansi-yellow`},{color:`0, 0, 187`,class:`ansi-blue`},{color:`187, 0, 187`,class:`ansi-magenta`},{color:`0, 187, 187`,class:`ansi-cyan`},{color:`255,255,255`,class:`ansi-white`}],[{color:`85, 85, 85`,class:`ansi-bright-black`},{color:`255, 85, 85`,class:`ansi-bright-red`},{color:`0, 255, 0`,class:`ansi-bright-green`},{color:`255, 255, 85`,class:`ansi-bright-yellow`},{color:`85, 85, 255`,class:`ansi-bright-blue`},{color:`255, 85, 255`,class:`ansi-bright-magenta`},{color:`85, 255, 255`,class:`ansi-bright-cyan`},{color:`255, 255, 255`,class:`ansi-bright-white`}]],r=/(https?:\/\/(?:[A-Za-z0-9#;/?:@=+$',_.!~*()[\]-]|&amp;|%[A-Fa-f0-9]{2})+)/gm;t.exports=class e{static escapeForHtml(t){return new e().escapeForHtml(t)}static linkify(t){return new e().linkify(t)}static ansiToHtml(t,n){return new e().ansiToHtml(t,n)}static ansiToJson(t,n){return new e().ansiToJson(t,n)}static ansiToText(t){return new e().ansiToText(t)}constructor(){this.fg=this.bg=this.fg_truecolor=this.bg_truecolor=null,this.bright=0,this.decorations=[]}setupPalette(){this.PALETTE_COLORS=[];for(let e=0;e<2;++e)for(let t=0;t<8;++t)this.PALETTE_COLORS.push(n[e][t].color);let e=[0,95,135,175,215,255],t=(t,n,r)=>e[t]+`, `+e[n]+`, `+e[r];for(let e=0;e<6;++e)for(let n=0;n<6;++n)for(let r=0;r<6;++r)this.PALETTE_COLORS.push(t(e,n,r));let r=8;for(let e=0;e<24;++e,r+=10)this.PALETTE_COLORS.push(r+`, `+r+`, `+r)}escapeForHtml(e){return e.replace(/[&<>\"]/gm,e=>e==`&`?`&amp;`:e==`"`?`&quot;`:e==`<`?`&lt;`:e==`>`?`&gt;`:``)}linkify(e){return e.replace(r,e=>`<a href="${e}">${e}</a>`)}ansiToHtml(e,t){return this.process(e,t,!0)}ansiToJson(e,t){return t||={},t.json=!0,t.clearLine=!1,this.process(e,t,!0)}ansiToText(e){return this.process(e,{},!1)}process(e,t,n){let r=this,i=e.split(/\033\[/),a=i.shift();t??={},t.clearLine=/\r/.test(e);let o=i.map(e=>this.processChunk(e,t,n));if(t&&t.json){let e=r.processChunkJson(``);return e.content=a,e.clearLine=t.clearLine,o.unshift(e),t.remove_empty&&(o=o.filter(e=>!e.isEmpty())),o}else o.unshift(a);return o.join(``)}processChunkJson(e,t,r){t=t===void 0?{}:t;let i=t.use_classes=t.use_classes!==void 0&&t.use_classes,a=t.key=i?`class`:`color`,o={content:e,fg:null,bg:null,fg_truecolor:null,bg_truecolor:null,isInverted:!1,clearLine:t.clearLine,decoration:null,decorations:[],was_processed:!1,isEmpty:()=>!o.content},s=e.match(/^([!\x3c-\x3f]*)([\d;]*)([\x20-\x2c]*[\x40-\x7e])([\s\S]*)/m);if(!s)return o;o.content=s[4];let c=s[2].split(`;`);if(s[1]!==``||s[3]!==`m`||!r)return o;let l=this;for(;c.length>0;){let e=c.shift(),t=parseInt(e);if(isNaN(t)||t===0)l.fg=l.bg=null,l.decorations=[];else if(t===1)l.decorations.push(`bold`);else if(t===2)l.decorations.push(`dim`);else if(t===3)l.decorations.push(`italic`);else if(t===4)l.decorations.push(`underline`);else if(t===5)l.decorations.push(`blink`);else if(t===7)l.decorations.push(`reverse`);else if(t===8)l.decorations.push(`hidden`);else if(t===9)l.decorations.push(`strikethrough`);else if(t===21)l.removeDecoration(`bold`);else if(t===22)l.removeDecoration(`bold`),l.removeDecoration(`dim`);else if(t===23)l.removeDecoration(`italic`);else if(t===24)l.removeDecoration(`underline`);else if(t===25)l.removeDecoration(`blink`);else if(t===27)l.removeDecoration(`reverse`);else if(t===28)l.removeDecoration(`hidden`);else if(t===29)l.removeDecoration(`strikethrough`);else if(t===39)l.fg=null;else if(t===49)l.bg=null;else if(t>=30&&t<38)l.fg=n[0][t%10][a];else if(t>=90&&t<98)l.fg=n[1][t%10][a];else if(t>=40&&t<48)l.bg=n[0][t%10][a];else if(t>=100&&t<108)l.bg=n[1][t%10][a];else if(t===38||t===48){let e=t===38;if(c.length>=1){let t=c.shift();if(t===`5`&&c.length>=1){let t=parseInt(c.shift());if(t>=0&&t<=255)if(!i)this.PALETTE_COLORS||l.setupPalette(),e?l.fg=this.PALETTE_COLORS[t]:l.bg=this.PALETTE_COLORS[t];else{let r=t>=16?`ansi-palette-`+t:n[+(t>7)][t%8].class;e?l.fg=r:l.bg=r}}else if(t===`2`&&c.length>=3){let t=parseInt(c.shift()),n=parseInt(c.shift()),r=parseInt(c.shift());if(t>=0&&t<=255&&n>=0&&n<=255&&r>=0&&r<=255){let a=t+`, `+n+`, `+r;i?e?(l.fg=`ansi-truecolor`,l.fg_truecolor=a):(l.bg=`ansi-truecolor`,l.bg_truecolor=a):e?l.fg=a:l.bg=a}}}}}return l.fg===null&&l.bg===null&&l.decorations.length===0?o:(o.fg=l.fg,o.bg=l.bg,o.fg_truecolor=l.fg_truecolor,o.bg_truecolor=l.bg_truecolor,o.decorations=l.decorations,o.decoration=l.decorations.slice(-1).pop()||null,o.was_processed=!0,o)}processChunk(e,t,r){t||={};let i=this.processChunkJson(e,t,r),a=t.use_classes;if(i.decorations=i.decorations.filter(e=>{if(e===`reverse`){i.fg||=n[0][7][a?`class`:`color`],i.bg||=n[0][0][a?`class`:`color`];let e=i.fg;i.fg=i.bg,i.bg=e;let t=i.fg_truecolor;return i.fg_truecolor=i.bg_truecolor,i.bg_truecolor=t,i.isInverted=!0,!1}return!0}),t.json)return i;if(i.isEmpty())return``;if(!i.was_processed)return i.content;let o=[],s=[],c=[],l={},u=e=>{let t=[],n;for(n in e)e.hasOwnProperty(n)&&t.push(`data-`+n+`="`+this.escapeForHtml(e[n])+`"`);return t.length>0?` `+t.join(` `):``};return i.isInverted&&(l[`ansi-is-inverted`]=`true`),i.fg&&(a?(o.push(i.fg+`-fg`),i.fg_truecolor!==null&&(l[`ansi-truecolor-fg`]=i.fg_truecolor,i.fg_truecolor=null)):o.push(`color:rgb(`+i.fg+`)`)),i.bg&&(a?(o.push(i.bg+`-bg`),i.bg_truecolor!==null&&(l[`ansi-truecolor-bg`]=i.bg_truecolor,i.bg_truecolor=null)):o.push(`background-color:rgb(`+i.bg+`)`)),i.decorations.forEach(e=>{if(a){s.push(`ansi-`+e);return}e===`bold`?s.push(`font-weight:bold`):e===`dim`?s.push(`opacity:0.5`):e===`italic`?s.push(`font-style:italic`):e===`hidden`?s.push(`visibility:hidden`):e===`strikethrough`?c.push(`line-through`):c.push(e)}),c.length&&s.push(`text-decoration:`+c.join(` `)),a?`<span class="`+o.concat(s).join(` `)+`"`+u(l)+`>`+i.content+`</span>`:`<span style="`+o.concat(s).join(`;`)+`"`+u(l)+`>`+i.content+`</span>`}removeDecoration(e){let t=this.decorations.indexOf(e);t>=0&&this.decorations.splice(t,1)}}})),Ma=m(((e,t)=>{function n(e){if(!e)return``;if(!/\r/.test(e))return e;for(e=e.replace(/\r+\n/gm,`
3
- `);/\r./.test(e);)e=e.replace(/^([^\r\n]*)\r+([^\r\n]+)/gm,function(e,t,n){return n+t.slice(n.length)});return e}function r(e){for(var t=0,n=0;n<e.length;n++)e[t].length<=e[n].length&&(t=n);return t}function i(e){if(!/\r/.test(e))return e;for(var t=e.split(`\r`),n=[];t.length>0;){var i=r(t);n.push(t[i]),t=t.slice(i+1)}return n.join(`\r`)}function a(e){if(!e)return``;if(!/\r/.test(e))return e;if(!/\n/.test(e))return i(e);e=e.replace(/\r+\n/gm,`
4
- `);var t=e.lastIndexOf(`
5
- `);return n(e.slice(0,t))+`
6
- `+i(e.slice(t+1))}t.exports=n,t.exports.escapeCarriageReturn=n,t.exports.escapeCarriageReturnSafe=a})),Na=m(((e,t)=>{t.exports=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/})),Pa=m(((e,t)=>{t.exports=/[\0-\x1F\x7F-\x9F]/})),Fa=m(((e,t)=>{t.exports=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/})),Ia=m(((e,t)=>{t.exports=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4E\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDF55-\uDF59]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD806[\uDC3B\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/})),La=m(((e,t)=>{t.exports=function(e){var t={};t.src_Any=Na().source,t.src_Cc=Pa().source,t.src_Z=Fa().source,t.src_P=Ia().source,t.src_ZPCc=[t.src_Z,t.src_P,t.src_Cc].join(`|`),t.src_ZCc=[t.src_Z,t.src_Cc].join(`|`);var n=`[><|]`;return t.src_pseudo_letter=`(?:(?!`+n+`|`+t.src_ZPCc+`)`+t.src_Any+`)`,t.src_ip4=`(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)`,t.src_auth=`(?:(?:(?!`+t.src_ZCc+`|[@/\\[\\]()]).)+@)?`,t.src_port=`(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?`,t.src_host_terminator=`(?=$|`+n+`|`+t.src_ZPCc+`)(?!-|_|:\\d|\\.-|\\.(?!$|`+t.src_ZPCc+`))`,t.src_path=`(?:[/?#](?:(?!`+t.src_ZCc+`|`+n+`|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!`+t.src_ZCc+`|\\]).)*\\]|\\((?:(?!`+t.src_ZCc+`|[)]).)*\\)|\\{(?:(?!`+t.src_ZCc+`|[}]).)*\\}|\\"(?:(?!`+t.src_ZCc+`|["]).)+\\"|\\'(?:(?!`+t.src_ZCc+`|[']).)+\\'|\\'(?=`+t.src_pseudo_letter+`|[-]).|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!`+t.src_ZCc+`|[.]).|`+(e&&e[`---`]?`\\-(?!--(?:[^-]|$))(?:-*)|`:`\\-+|`)+`,(?!`+t.src_ZCc+`).|;(?!`+t.src_ZCc+`).|\\!+(?!`+t.src_ZCc+`|[!]).|\\?(?!`+t.src_ZCc+`|[?]).)+|\\/)?`,t.src_email_name=`[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*`,t.src_xn=`xn--[a-z0-9\\-]{1,59}`,t.src_domain_root=`(?:`+t.src_xn+`|`+t.src_pseudo_letter+`{1,63})`,t.src_domain=`(?:`+t.src_xn+`|(?:`+t.src_pseudo_letter+`)|(?:`+t.src_pseudo_letter+`(?:-|`+t.src_pseudo_letter+`){0,61}`+t.src_pseudo_letter+`))`,t.src_host=`(?:(?:(?:(?:`+t.src_domain+`)\\.)*`+t.src_domain+`))`,t.tpl_host_fuzzy=`(?:`+t.src_ip4+`|(?:(?:(?:`+t.src_domain+`)\\.)+(?:%TLDS%)))`,t.tpl_host_no_ip_fuzzy=`(?:(?:(?:`+t.src_domain+`)\\.)+(?:%TLDS%))`,t.src_host_strict=t.src_host+t.src_host_terminator,t.tpl_host_fuzzy_strict=t.tpl_host_fuzzy+t.src_host_terminator,t.src_host_port_strict=t.src_host+t.src_port+t.src_host_terminator,t.tpl_host_port_fuzzy_strict=t.tpl_host_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_port_no_ip_fuzzy_strict=t.tpl_host_no_ip_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_fuzzy_test=`localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:`+t.src_ZPCc+`|>|$))`,t.tpl_email_fuzzy=`(^|`+n+`|"|\\(|`+t.src_ZCc+`)(`+t.src_email_name+`@`+t.tpl_host_fuzzy_strict+`)`,t.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_fuzzy_strict+t.src_path+`)`,t.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_no_ip_fuzzy_strict+t.src_path+`)`,t}})),Ra=m(((e,t)=>{function n(e){return Array.prototype.slice.call(arguments,1).forEach(function(t){t&&Object.keys(t).forEach(function(n){e[n]=t[n]})}),e}function r(e){return Object.prototype.toString.call(e)}function i(e){return r(e)===`[object String]`}function a(e){return r(e)===`[object Object]`}function o(e){return r(e)===`[object RegExp]`}function s(e){return r(e)===`[object Function]`}function c(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,`\\$&`)}var l={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function u(e){return Object.keys(e||{}).reduce(function(e,t){return e||l.hasOwnProperty(t)},!1)}var d={"http:":{validate:function(e,t,n){var r=e.slice(t);return n.re.http||(n.re.http=RegExp(`^\\/\\/`+n.re.src_auth+n.re.src_host_port_strict+n.re.src_path,`i`)),n.re.http.test(r)?r.match(n.re.http)[0].length:0}},"https:":`http:`,"ftp:":`http:`,"//":{validate:function(e,t,n){var r=e.slice(t);return n.re.no_http||(n.re.no_http=RegExp(`^`+n.re.src_auth+`(?:localhost|(?:(?:`+n.re.src_domain+`)\\.)+`+n.re.src_domain_root+`)`+n.re.src_port+n.re.src_host_terminator+n.re.src_path,`i`)),n.re.no_http.test(r)?t>=3&&e[t-3]===`:`||t>=3&&e[t-3]===`/`?0:r.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,n){var r=e.slice(t);return n.re.mailto||(n.re.mailto=RegExp(`^`+n.re.src_email_name+`@`+n.re.src_host_strict,`i`)),n.re.mailto.test(r)?r.match(n.re.mailto)[0].length:0}}},f=`a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]`,p=`biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф`.split(`|`);function m(e){e.__index__=-1,e.__text_cache__=``}function h(e){return function(t,n){var r=t.slice(n);return e.test(r)?r.match(e)[0].length:0}}function g(){return function(e,t){t.normalize(e)}}function _(e){var t=e.re=La()(e.__opts__),n=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||n.push(f),n.push(t.src_xn),t.src_tlds=n.join(`|`);function r(e){return e.replace(`%TLDS%`,t.src_tlds)}t.email_fuzzy=RegExp(r(t.tpl_email_fuzzy),`i`),t.link_fuzzy=RegExp(r(t.tpl_link_fuzzy),`i`),t.link_no_ip_fuzzy=RegExp(r(t.tpl_link_no_ip_fuzzy),`i`),t.host_fuzzy_test=RegExp(r(t.tpl_host_fuzzy_test),`i`);var l=[];e.__compiled__={};function u(e,t){throw Error(`(LinkifyIt) Invalid schema "`+e+`": `+t)}Object.keys(e.__schemas__).forEach(function(t){var n=e.__schemas__[t];if(n!==null){var r={validate:null,link:null};if(e.__compiled__[t]=r,a(n)){o(n.validate)?r.validate=h(n.validate):s(n.validate)?r.validate=n.validate:u(t,n),s(n.normalize)?r.normalize=n.normalize:n.normalize?u(t,n):r.normalize=g();return}if(i(n)){l.push(t);return}u(t,n)}}),l.forEach(function(t){e.__compiled__[e.__schemas__[t]]&&(e.__compiled__[t].validate=e.__compiled__[e.__schemas__[t]].validate,e.__compiled__[t].normalize=e.__compiled__[e.__schemas__[t]].normalize)}),e.__compiled__[``]={validate:null,normalize:g()};var d=Object.keys(e.__compiled__).filter(function(t){return t.length>0&&e.__compiled__[t]}).map(c).join(`|`);e.re.schema_test=RegExp(`(^|(?!_)(?:[><|]|`+t.src_ZPCc+`))(`+d+`)`,`i`),e.re.schema_search=RegExp(`(^|(?!_)(?:[><|]|`+t.src_ZPCc+`))(`+d+`)`,`ig`),e.re.pretest=RegExp(`(`+e.re.schema_test.source+`)|(`+e.re.host_fuzzy_test.source+`)|@`,`i`),m(e)}function v(e,t){var n=e.__index__,r=e.__last_index__,i=e.__text_cache__.slice(n,r);this.schema=e.__schema__.toLowerCase(),this.index=n+t,this.lastIndex=r+t,this.raw=i,this.text=i,this.url=i}function y(e,t){var n=new v(e,t);return e.__compiled__[n.schema].normalize(n,e),n}function b(e,t){if(!(this instanceof b))return new b(e,t);t||u(e)&&(t=e,e={}),this.__opts__=n({},l,t),this.__index__=-1,this.__last_index__=-1,this.__schema__=``,this.__text_cache__=``,this.__schemas__=n({},d,e),this.__compiled__={},this.__tlds__=p,this.__tlds_replaced__=!1,this.re={},_(this)}b.prototype.add=function(e,t){return this.__schemas__[e]=t,_(this),this},b.prototype.set=function(e){return this.__opts__=n(this.__opts__,e),this},b.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;var t,n,r,i,a,o,s,c,l;if(this.re.schema_test.test(e)){for(s=this.re.schema_search,s.lastIndex=0;(t=s.exec(e))!==null;)if(i=this.testSchemaAt(e,t[2],s.lastIndex),i){this.__schema__=t[2],this.__index__=t.index+t[1].length,this.__last_index__=t.index+t[0].length+i;break}}return this.__opts__.fuzzyLink&&this.__compiled__[`http:`]&&(c=e.search(this.re.host_fuzzy_test),c>=0&&(this.__index__<0||c<this.__index__)&&(n=e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))!==null&&(a=n.index+n[1].length,(this.__index__<0||a<this.__index__)&&(this.__schema__=``,this.__index__=a,this.__last_index__=n.index+n[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__[`mailto:`]&&(l=e.indexOf(`@`),l>=0&&(r=e.match(this.re.email_fuzzy))!==null&&(a=r.index+r[1].length,o=r.index+r[0].length,(this.__index__<0||a<this.__index__||a===this.__index__&&o>this.__last_index__)&&(this.__schema__=`mailto:`,this.__index__=a,this.__last_index__=o))),this.__index__>=0},b.prototype.pretest=function(e){return this.re.pretest.test(e)},b.prototype.testSchemaAt=function(e,t,n){return this.__compiled__[t.toLowerCase()]?this.__compiled__[t.toLowerCase()].validate(e,n,this):0},b.prototype.match=function(e){var t=0,n=[];this.__index__>=0&&this.__text_cache__===e&&(n.push(y(this,t)),t=this.__last_index__);for(var r=t?e.slice(t):e;this.test(r);)n.push(y(this,t)),r=r.slice(this.__last_index__),t+=this.__last_index__;return n.length?n:null},b.prototype.tlds=function(e,t){return e=Array.isArray(e)?e:[e],t?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(e,t,n){return e!==n[t-1]}).reverse(),_(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,_(this),this)},b.prototype.normalize=function(e){e.schema||(e.url=`http://`+e.url),e.schema===`mailto:`&&!/^mailto:/i.test(e.url)&&(e.url=`mailto:`+e.url)},b.prototype.onCompile=function(){},t.exports=b})),za=n(m((t=>{var n=t&&t.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),r=t&&t.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),i=t&&t.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},e(t)};return function(t){if(t&&t.__esModule)return t;var i={};if(t!=null)for(var a=e(t),o=0;o<a.length;o++)a[o]!=="default"&&n(i,t,a[o]);return r(i,t),i}})(),a=t&&t.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.default=g;var o=a(ja()),s=Ma(),c=a(Ra()),l=i(e());function u(e,t=!1){return e=(0,s.escapeCarriageReturn)(_(e)),o.default.ansiToJson(e,{json:!0,remove_empty:!0,use_classes:t})}function d(e){let t=``;return e.bg&&(t+=`${e.bg}-bg `),e.fg&&(t+=`${e.fg}-fg `),e.decoration&&(t+=`ansi-${e.decoration} `),t===``?null:(t=t.substring(0,t.length-1),t)}function f(e){let t={};switch(e.bg&&(t.backgroundColor=`rgb(${e.bg})`),e.fg&&(t.color=`rgb(${e.fg})`),e.decoration){case`bold`:t.fontWeight=`bold`;break;case`dim`:t.opacity=`0.5`;break;case`italic`:t.fontStyle=`italic`;break;case`hidden`:t.visibility=`hidden`;break;case`strikethrough`:t.textDecoration=`line-through`;break;case`underline`:t.textDecoration=`underline`;break;case`blink`:t.textDecoration=`blink`;break;default:break}return t}function p(e,t,n,r){let i=t?null:f(n),a=t?d(n):null;return e?e===`fuzzy`?h(n,r,i,a):m(n,r,i,a):l.createElement(`span`,{style:i,key:r,className:a},n.content)}function m(e,t,n,r){let i=[],a=/(\s|^)(https?:\/\/(?:www\.|(?!www))[^\s.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/g,o=0,s;for(;(s=a.exec(e.content))!==null;){let[,t,n]=s,r=s.index+t.length;r>o&&i.push(e.content.substring(o,r));let c=n.startsWith(`www.`)?`http://${n}`:n;i.push(l.createElement(`a`,{key:o,href:c,target:`_blank`},`${n}`)),o=a.lastIndex}return o<e.content.length&&i.push(e.content.substring(o)),l.createElement(`span`,{style:n,key:t,className:r},i)}function h(e,t,n,r){let i=(0,c.default)({fuzzyEmail:!1}).tlds([`io`],!0);if(!i.pretest(e.content))return l.createElement(`span`,{style:n,key:t,className:r},e.content);let a=i.match(e.content);if(!a)return l.createElement(`span`,{style:n,key:t,className:r},e.content);let o=[e.content.substring(0,a[0]?.index)];return a.forEach((t,n)=>{o.push(l.createElement(`a`,{href:t.url,target:`_blank`,key:n},e.content.substring(t.index,t.lastIndex))),a[n+1]&&o.push(e.content.substring(a[n].lastIndex,a[n+1]?.index))}),a[a.length-1].lastIndex!==e.content.length&&o.push(e.content.substring(a[a.length-1].lastIndex,e.content.length)),l.createElement(`span`,{style:n,key:t,className:r},o)}function g(e){let{className:t,useClasses:n,children:r,linkify:i}=e;return l.createElement(`code`,{className:t},u(r??``,n??!1).map(p.bind(null,i??!1,n??!1)))}function _(e){let t=e;do e=t,t=e.replace(/[^\n]\x08/gm,``);while(t.length<e.length);return e}}))(),1),Ba=za.default.default||za.default,Va={"claude-cli":new Set([`npm install -g @anthropic-ai/claude-code`,`claude auth login`,`claude auth status --json`]),"codex-cli":new Set([`npm install -g @openai/codex`,`codex login`,`codex login status`])},Ha=new Set([`native-api`,`cli-print`,`acp`]),Ua=new Set([`none`,`client-assigned`,`provider-assigned`]),Wa=new Set([`read-only`,`workspace-write`,`harness-managed`]),Ga=new Set([`uuid`,`opaque`]),Ka=new Set([`missing-cli`,`signed-out`,`probe-failed`]);function qa(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function Ja(e){return e===void 0||typeof e==`string`}function Ya(e){return!qa(e)||typeof e.transport!=`string`||!Ha.has(e.transport)||typeof e.sessionIdentity!=`string`||!Ua.has(e.sessionIdentity)||typeof e.workspaceAccess!=`string`||!Wa.has(e.workspaceAccess)||e.sessionIdFormat!==void 0&&(typeof e.sessionIdFormat!=`string`||!Ga.has(e.sessionIdFormat))?null:{transport:e.transport,sessionIdentity:e.sessionIdentity,workspaceAccess:e.workspaceAccess,...e.sessionIdFormat===void 0?{}:{sessionIdFormat:e.sessionIdFormat}}}function Xa(e){if(!qa(e)||typeof e.id!=`string`||typeof e.name!=`string`||typeof e.isConfigured!=`boolean`||!Ja(e.icon)||!Ja(e.accessLabel)||!Ja(e.message)||!Ja(e.recoveryCommand)||!Ja(e.recoveryLabel)||e.setupIssue!==void 0&&(typeof e.setupIssue!=`string`||!Ka.has(e.setupIssue)))return null;let t=Ya(e.capabilities);if(!t)return null;let n;if(e.executionProfiles!==void 0){if(!Array.isArray(e.executionProfiles)||e.executionProfiles.length===0)return null;n=[];let t=new Set;for(let r of e.executionProfiles){if(!qa(r)||!vn(r.id)||typeof r.label!=`string`||typeof r.description!=`string`||t.has(r.id))return null;t.add(r.id),n.push({id:r.id,label:r.label,description:r.description})}}if(e.defaultExecutionProfile!==void 0&&(!vn(e.defaultExecutionProfile)||!n?.some(t=>t.id===e.defaultExecutionProfile))||n&&e.defaultExecutionProfile===void 0||!n&&e.defaultExecutionProfile!==void 0)return null;let r=e.setupIssue!==void 0||e.recoveryCommand!==void 0||e.recoveryLabel!==void 0,i=e.setupIssue!==void 0&&e.recoveryCommand!==void 0&&e.recoveryLabel!==void 0;return r&&!i||e.isConfigured&&r?null:{id:e.id,name:e.name,isConfigured:e.isConfigured,capabilities:t,...e.icon===void 0?{}:{icon:e.icon},...e.accessLabel===void 0?{}:{accessLabel:e.accessLabel},...e.message===void 0?{}:{message:e.message},...e.setupIssue===void 0?{}:{setupIssue:e.setupIssue},...e.recoveryCommand===void 0?{}:{recoveryCommand:e.recoveryCommand},...e.recoveryLabel===void 0?{}:{recoveryLabel:e.recoveryLabel},...n===void 0?{}:{executionProfiles:n},...e.defaultExecutionProfile===void 0?{}:{defaultExecutionProfile:e.defaultExecutionProfile}}}function Za(e){if(!Array.isArray(e))return null;let t=[];for(let n of e){let e=Xa(n);if(!e)return null;t.push(e)}return t}function Qa(e){return!e.recoveryCommand||!Va[e.id]?.has(e.recoveryCommand)?null:{command:e.recoveryCommand,label:e.recoveryLabel??`Copy recovery command`}}var $a=e=>e?new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):null,eo=(0,Z.memo)(function({msg:e,idx:t,copied:n,onCopy:r}){if(e.role===`system`)return(0,$.jsx)(`div`,{className:`flex justify-center`,children:(0,$.jsx)(`span`,{className:c(`rounded-full border px-3 py-1 text-center text-[11px]`,e.kind===`error`?`border-destructive/25 bg-destructive/10 text-destructive-foreground`:`border-border bg-muted text-muted-foreground`),children:e.content})});let i=e.role===`user`,a=!i&&e.content.includes(`\x1B`);return(0,$.jsxs)(`div`,{className:`flex flex-col ${i?`items-end`:`items-start`}`,children:[(0,$.jsx)(`div`,{className:`group relative max-w-[85%] rounded-lg p-3 ${i?`bg-primary text-primary-foreground`:`border border-border bg-card text-foreground`}`,children:i?(0,$.jsx)(`div`,{className:`whitespace-pre-wrap text-sm`,children:e.content}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a?(0,$.jsx)(`div`,{className:`overflow-x-auto whitespace-pre-wrap rounded-md bg-muted/50 p-2 font-mono text-xs text-foreground`,children:(0,$.jsx)(Ba,{children:e.content})}):(0,$.jsx)(Zt,{content:e.content}),(0,$.jsx)(`button`,{onClick:()=>r(t,e.content),className:`absolute -right-2.5 -top-2.5 hidden h-6 w-6 cursor-pointer place-items-center rounded-md border border-border bg-card text-muted-foreground shadow-sm hover:text-foreground group-hover:grid`,title:`Copy message`,children:n?(0,$.jsx)(fn,{size:12,className:`text-success-foreground`}):(0,$.jsx)(bn,{size:12})})]})}),i&&e.executionProfile&&(0,$.jsx)(`span`,{className:`mt-1 rounded border border-border px-1.5 py-0.5 text-[9px] font-medium uppercase tracking-wide text-muted-foreground`,children:e.executionProfile===`workspace-write`?`Edit`:`Review`}),e.ts&&(0,$.jsx)(`span`,{className:`mt-1 text-[10px] text-muted-foreground`,children:$a(e.ts)})]})});function to({ws:e}){let t=_n(),n=xn(),[r,i]=(0,Z.useState)([]),[a,o]=(0,Z.useState)(!1),[s]=(0,Z.useState)(()=>Ea(e.branchName)),[l,u]=(0,Z.useState)(s.messages),[d,p]=(0,Z.useState)(``),[m,h]=(0,Z.useState)(!1),[g,_]=(0,Z.useState)(!1),[v,y]=(0,Z.useState)(!1),[b,x]=(0,Z.useState)(``),[S,C]=(0,Z.useState)(s.profilesByProvider),[w,T]=(0,Z.useState)(null),[E,D]=(0,Z.useState)(!1),[O,k]=(0,Z.useState)(0),[A,j]=(0,Z.useState)(!1),[M,N]=(0,Z.useState)(null),[P,F]=(0,Z.useState)(!1),[I,ee]=(0,Z.useState)(null),[te,L]=(0,Z.useState)(!1),[ne,R]=(0,Z.useState)(null),[re,ie]=(0,Z.useState)(null),z=(0,Z.useRef)(null),ae=(0,Z.useRef)(null),oe=(0,Z.useRef)(null),se=(0,Z.useRef)(!0),B=(0,Z.useRef)(s.sessions),V=(0,Z.useRef)([]),H=(0,Z.useRef)(!1),ce=(0,Z.useRef)(!1),le=(0,Z.useRef)({messages:l,agentName:b,profilesByProvider:S}),ue=(0,Z.useRef)(S),U=(0,Z.useRef)(null),de=(0,Z.useRef)(null),fe=(0,Z.useRef)(!0),pe=(0,Z.useRef)(0),me=(0,Z.useRef)(null),he=(0,Z.useRef)(!1),ge=(0,Z.useRef)({id:0,controller:null}),W=(0,Z.useMemo)(()=>nn(t.state),[t.state]);(0,Z.useEffect)(()=>{le.current={messages:l,agentName:b,profilesByProvider:S},ue.current=S},[l,b,S]);let _e=(0,Z.useCallback)(()=>{U.current=null,Oa(e.branchName,{v:4,sessions:B.current,providerId:le.current.agentName||s.providerId,profilesByProvider:le.current.profilesByProvider,messages:le.current.messages})},[e.branchName,s.providerId]);(0,Z.useEffect)(()=>{let e=l[l.length-1];(se.current||e?.role===`user`)&&oe.current?.scrollIntoView({behavior:e?.role===`user`?`smooth`:`auto`}),U.current&&clearTimeout(U.current),U.current=setTimeout(_e,400)},[l,b,S,O,_e]),(0,Z.useEffect)(()=>{let e=()=>_e();return window.addEventListener(`pagehide`,e),()=>{window.removeEventListener(`pagehide`,e),U.current&&clearTimeout(U.current),_e()}},[_e]),(0,Z.useEffect)(()=>{let e=++pe.current,t=new AbortController,n=!0;return fetch(`/api/adapters/status`,{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`,signal:t.signal}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(t=>{if(!n||e!==pe.current)return;let r=Za(t);if(!r)throw Error(`Invalid provider status response`);i(r),C(e=>{let t=!1,n={...e};for(let i of r)!i.executionProfiles?.length||!i.defaultExecutionProfile||i.executionProfiles.some(t=>t.id===e[i.id])||(n[i.id]=i.defaultExecutionProfile,t=!0);return t?n:e});let a=(s.providerId?r.find(e=>e.id===s.providerId):void 0)||r.find(e=>e.isConfigured)||r[0];a&&x(e=>e||a.id)}).catch(e=>{n&&e?.name!==`AbortError`&&console.error(`Failed to fetch agent data`,e)}).finally(()=>{n&&e===pe.current&&o(!0)}),()=>{n=!1,t.abort()}},[s.providerId]),(0,Z.useEffect)(()=>(fe.current=!0,()=>{fe.current=!1,ge.current.id+=1,ge.current.controller?.abort(),z.current&&z.current.close()}),[e.branchName,e.workspacePath]);let ve=w??b,G=r.find(e=>e.id===ve),ye=G?.executionProfiles?.find(e=>e.id===S[G.id])??G?.executionProfiles?.find(e=>e.id===G.defaultExecutionProfile),be=!!b&&!!G?.isConfigured&&(!G?.executionProfiles||!!ye)&&!E&&!A,xe=(0,Z.useCallback)((e,t)=>{let n=t??r.find(t=>t.id===e);if(!n?.executionProfiles?.length)return;let i=ue.current[e];return n.executionProfiles.some(e=>e.id===i)?i:n.defaultExecutionProfile},[r]),K=(0,Z.useCallback)(()=>{H.current=!1,y(!1)},[]),q=(0,Z.useCallback)((e,t)=>{u(n=>[...n,{role:`system`,content:e,kind:t,ts:Date.now()}])},[]),Se=(0,Z.useCallback)((e,t,n)=>{let r=crypto.randomUUID(),i={role:`user`,content:t,ts:Date.now(),...n?{executionProfile:n}:{}};V.current.push({turnId:r,text:t,message:i});try{e.send(JSON.stringify({type:`input`,input:t,turnId:r,...n?{executionProfile:n}:{}}))}catch(e){throw V.current=V.current.filter(e=>e.turnId!==r),e}u(e=>[...e,i]),p(``),_(!0),K()},[K]),Ce=(0,Z.useCallback)(()=>{ce.current||(ce.current=!0,q(`Session ended`,`note`))},[q]),we=(0,Z.useCallback)(()=>{let e=z.current;if(e){if(e.readyState===WebSocket.OPEN)try{e.send(JSON.stringify({type:`stop`}))}catch{}z.current=null,me.current=null,T(null),D(!1),e.close(),h(!1),_(!1),K(),Ce()}},[K,Ce]),Te=(0,Z.useCallback)((t=b,n={})=>{if(z.current)return n.onFailure?.(),!1;let i=n.provider??r.find(e=>e.id===t);if(x(t),!i?.isConfigured)return q(i?.message??`The ${t} provider is unavailable. Check its local CLI installation and login.`,`error`),n.onFailure?.(),!1;let a=n.executionProfile??xe(t,i),o=a!==void 0&&i.executionProfiles?.some(e=>e.id===a)===!0;if((n.executionProfile!==void 0||i.executionProfiles?.length)&&!o)return q(`Select a supported execution profile before starting this local CLI.`,`error`),n.onFailure?.(),!1;let s=``;s=s.startsWith(`http`)?s.replace(`http`,`ws`):window.location.origin.replace(`http`,`ws`),s+=`/ws`,ce.current=!1;let c=!1,l=!1,f,m=()=>{l||c||!fe.current||(l=!0,q(`Could not open the local agent connection. Your current chat was preserved; retry explicitly when ready.`,`error`),n.onFailure?.())};try{f=new WebSocket(s)}catch{return m(),!1}return f.onopen=()=>{if(!fe.current||z.current!==f){f.close();return}let r={type:`start`,command:t,cwd:e.workspacePath},o={...B.current};if(n.resetSession&&delete o[t],n.session&&(o[t]=n.session),i.capabilities.sessionIdentity===`client-assigned`){let e=o[t]??{id:crypto.randomUUID(),started:!1};o[t]=e,r.sessionId=e.id,r.resume=e.started}else if(i.capabilities.sessionIdentity===`provider-assigned`){let e=o[t];e?.started&&(r.sessionId=e.id,r.resume=!0)}let s=n.firstMessage===null?``:(n.firstMessage??d).trim(),l;try{if(f.send(JSON.stringify(r)),s){let e=crypto.randomUUID();l={turnId:e,text:s,message:{role:`user`,content:s,ts:Date.now(),...a?{executionProfile:a}:{}}},V.current.push(l),f.send(JSON.stringify({type:`input`,input:s,turnId:e,...a?{executionProfile:a}:{}}))}}catch{l&&(V.current=V.current.filter(e=>e.turnId!==l?.turnId)),m(),z.current=null,me.current=null,T(null),D(!1),f.close();return}B.current=o,c=!0,D(!1),h(!0),n.resetMessagesOnDispatch&&u([]),s&&(u(e=>[...n.resetMessagesOnDispatch?[]:e,l?.message??{role:`user`,content:s,ts:Date.now(),...a?{executionProfile:a}:{}}]),p(``),_(!0),K()),n.onDispatched?.()},f.onmessage=e=>{if(z.current===f)try{let n=JSON.parse(e.data);if(n.type===`stream`){let e=H.current;H.current=!0,y(!0),u(t=>{let r=t[t.length-1];if(e&&r?.role===`assistant`){let e=[...t];return e[e.length-1]={...r,content:r.content+n.text},e}return[...t,{role:`assistant`,content:n.text,ts:Date.now()}]})}else if(n.type===`session`&&typeof n.id==`string`){let e=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(n.id),r=B.current[t],a=i.capabilities.sessionIdentity!==`client-assigned`||r?.id.toLowerCase()===n.id.toLowerCase();if(e&&a){let e=i.capabilities.sessionIdentity===`client-assigned`?r.id:n.id;B.current={...B.current,[t]:{id:e,started:!0}},k(e=>e+1)}else q(`The local CLI returned an unexpected session identity. This turn will not be resumed automatically.`,`error`)}else if(n.type===`accepted`&&typeof n.turnId==`string`)V.current=V.current.filter(e=>e.turnId!==n.turnId);else if(n.type===`status`)_(n.state===`busy`),n.state!==`busy`&&K();else if(n.type===`system`)q(n.message,`note`),K();else if(n.type===`rejected`&&n.reason===`busy`){let e=V.current.findIndex(e=>e.turnId===n.turnId),t=e===-1?void 0:V.current.splice(e,1)[0];t&&(u(e=>e.filter(e=>e!==t.message)),p(e=>e?`${t.text}\n\n${e}`:t.text)),q(typeof n.message==`string`?n.message:`The agent is still processing the current turn.`,`error`)}else n.type===`error`?(V.current=[],q(n.message,`error`),_(!1),K()):n.type===`close`&&(V.current=[],h(!1),_(!1),K(),Ce(),f.close(),z.current=null)}catch(e){console.error(`Failed to parse WS message`,e)}},f.onclose=()=>{z.current===f&&(c||m(),h(!1),D(!1),_(!1),K(),c&&Ce(),z.current=null,me.current=null,T(null))},f.onerror=()=>{z.current===f&&(m(),c||(z.current=null,me.current=null,T(null),D(!1),h(!1),f.close()))},z.current=f,me.current=t,T(t),D(!0),!0},[b,q,K,d,Ce,xe,r,e.workspacePath]),Ee=(0,Z.useCallback)(()=>{let e=d.trim(),t=me.current;if(!e||!z.current||!t||g||he.current)return;let n=r.find(e=>e.id===t),i=xe(t,n);n?.executionProfiles?.length&&!i||Se(z.current,e,i)},[g,d,xe,r,Se]),De=(0,Z.useCallback)((e,t)=>{navigator.clipboard.writeText(t).then(()=>{ie(e),setTimeout(()=>ie(t=>t===e?null:t),1500)}).catch(()=>{})},[]),Oe=(0,Z.useCallback)(e=>{ge.current.id===e&&(ge.current.controller=null,he.current=!1,fe.current&&j(!1))},[]),ke=(0,Z.useCallback)(async(e,t=!1)=>{let n=ge.current.id+1;ge.current.controller?.abort();let i=new AbortController;ge.current={id:n,controller:i},he.current=!0,j(!0),R(null);let a=pn(e.assistant);if(!a)return q(`Only Claude Code and Codex sessions can resume in embedded chat.`,`error`),Oe(n),!1;let o=r.find(e=>e.id===a);if(!o?.isConfigured)return q(o?.message??`The ${a} provider is unavailable. Check its local CLI installation and login.`,`error`),Oe(n),!1;let s=()=>fe.current&&ge.current.id===n&&!i.signal.aborted;try{let r=await fetch(`/api/session/${encodeURIComponent(e.assistant)}/${encodeURIComponent(e.id)}/transcript`,{signal:i.signal});if(!r.ok)throw Error(`HTTP ${r.status}`);let o=await r.json();if(!s())return!1;let c=(Array.isArray(o.messages)?o.messages:[]).filter(e=>(e.role===`user`||e.role===`assistant`)&&typeof e.content==`string`&&e.content.trim()).map(e=>({role:e.role,content:e.content,ts:e.timestamp&&Date.parse(e.timestamp)||void 0}));if(z.current&&!window.confirm(`Stop the current chat and resume this session?`))return Oe(n),!1;z.current&&we(),x(a);let l=()=>{s()&&(C(e=>({...e,[a]:`review`})),u([...c,{role:`system`,kind:`note`,content:`Loaded session — your next message resumes it.`,ts:Date.now()}]),p(``),L(!1),Oe(n))};return t?Te(a,{firstMessage:null,session:{id:e.id,started:!0},onDispatched:l,onFailure:()=>{s()&&(R(`Failed to connect to the selected session.`),Oe(n))}}):(B.current={...B.current,[a]:{id:e.id,started:!0}},l(),!0)}catch(e){return!s()||e instanceof DOMException&&e.name===`AbortError`?!1:(R(`Failed to load the session transcript.`),q(`Failed to load the session transcript. Your current chat was preserved.`,`error`),Oe(n),!1)}},[q,Oe,r,Te,we]),Ae=(0,Z.useCallback)(e=>{ke(e)},[ke]),je=(0,Z.useCallback)(async(e,t=!1,n=!1)=>{N(e);let r;if(t){F(!0);try{let t=await fetch(`/api/adapters/status/refresh`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({providerId:e.providerId})});if(!t.ok)throw Error(`HTTP ${t.status}`);let a=Za(await t.json());if(!a)throw Error(`Invalid provider status response`);if(!fe.current)return!1;i(a),r=a.find(t=>t.id===e.providerId);let o=n&&(r?.setupIssue===`signed-out`||r?.setupIssue===`probe-failed`);if(!r||!r.isConfigured&&!o)return q(r?.message??`The selected local CLI is still unavailable. Install it and sign in, then retry.`,`error`),!1}catch{return fe.current&&q(`Could not refresh the local CLI status. The task handoff was not dispatched.`,`error`),!1}finally{fe.current&&F(!1)}}return Te(e.providerId,{firstMessage:e.kickoff,executionProfile:e.executionProfile,provider:r&&n&&(r.setupIssue===`signed-out`||r.setupIssue===`probe-failed`)?{...r,isConfigured:!0}:r,resetSession:!0,resetMessagesOnDispatch:!0,onDispatched:()=>{fe.current&&N(null)},onFailure:()=>{fe.current&&N(e)}})},[q,Te]);(0,Z.useEffect)(()=>{if(!a||!W)return;let e=de.current===W.nonce;try{e||=sessionStorage.getItem(`nexusflow.chatLaunch.consumed`)===W.nonce,sessionStorage.setItem(`nexusflow.chatLaunch.consumed`,W.nonce)}catch{}de.current=W.nonce;let i=t.state&&typeof t.state==`object`?{...t.state}:{};if(delete i.chatLaunch,n(`${t.pathname}${t.search}`,{replace:!0,state:Object.keys(i).length>0?i:null}),e)return;let o=r.find(e=>e.id===W.providerId);if(x(W.providerId),C(e=>({...e,[W.providerId]:W.executionProfile})),!o?.isConfigured){q(o?.message??`The selected local CLI is unavailable. Install it and sign in, then try again.`,`error`),W.kickoff&&N({providerId:W.providerId,kickoff:W.kickoff,executionProfile:W.executionProfile});return}if(W.sessionId&&W.assistant){ke({id:W.sessionId,assistant:W.assistant,title:``,createdAt:``,updatedAt:``,messageCount:0},!0);return}z.current&&!window.confirm(`Stop the current chat and continue with the selected local CLI?`)||(z.current&&we(),W.kickoff?je({providerId:W.providerId,kickoff:W.kickoff,executionProfile:W.executionProfile}):Te(W.providerId,{firstMessage:null}))},[q,je,W,ke,t.pathname,t.search,t.state,n,r,a,Te,we]);let Me=()=>{if(window.confirm(`Are you sure you want to clear this chat history? This also starts a new agent session.`)){z.current&&we();let t={...B.current};delete t[b],B.current=t,ce.current=!1,u([]),ka(e.branchName)}},Ne=g&&!v,Pe=G?Qa(G):null;return(0,$.jsxs)(`div`,{className:`flex h-full flex-col bg-card`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-border bg-card px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,$.jsx)(`h3`,{className:`font-semibold text-foreground`,children:`Chat`}),(0,$.jsx)(mn,{tone:m?`running`:`idle`,dot:!0,children:m?G?.name||`Connected`:`Disconnected`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[l.length>0&&(0,$.jsx)(`button`,{onClick:Me,className:`cursor-pointer text-xs text-muted-foreground transition-colors hover:text-destructive-foreground`,children:`Clear`}),(0,$.jsx)(`button`,{onClick:()=>{R(null),L(!0)},className:`grid h-7 w-7 cursor-pointer place-items-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:`Resume a past session`,children:(0,$.jsx)(In,{size:14})}),m&&(0,$.jsxs)(f,{size:`sm`,variant:`outline`,onClick:we,children:[(0,$.jsx)(qn,{size:14,className:`text-destructive-foreground`}),`Stop`]})]})]}),(0,$.jsx)(Aa,{open:te,onClose:()=>L(!1),ws:e,onPick:Ae,error:ne,pending:A}),(0,$.jsxs)(`div`,{ref:ae,onScroll:()=>{let e=ae.current;e&&(se.current=e.scrollHeight-e.scrollTop-e.clientHeight<80)},className:`flex-1 space-y-4 overflow-y-auto p-4`,children:[l.length===0&&!Ne&&(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center text-muted-foreground`,children:`No messages yet. Start the agent and say hello.`}),l.map((e,t)=>(0,$.jsx)(eo,{msg:e,idx:t,copied:re===t,onCopy:De},t)),Ne&&(0,$.jsx)(`div`,{className:`flex justify-start`,children:(0,$.jsx)(`div`,{className:`rounded-lg border border-border bg-card px-4 py-3 text-muted-foreground`,children:(0,$.jsx)(on,{size:14,className:`animate-spin`})})}),(0,$.jsx)(`div`,{ref:oe})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-t border-border bg-card p-3`,children:[G&&!G.isConfigured&&(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-destructive/25 bg-destructive/10 px-3 py-2 text-xs text-destructive-foreground`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(`span`,{className:`shrink-0 font-semibold`,children:[G.name,` provider status:`]}),(0,$.jsx)(`span`,{children:G.message})]}),Pe&&(0,$.jsx)(`code`,{className:`w-fit rounded bg-background/70 px-2 py-1 font-mono text-[11px] text-foreground`,children:Pe.command})]}),Pe&&(0,$.jsxs)(f,{size:`sm`,variant:`outline`,onClick:()=>{if(!G||!Pe)return;let e=()=>q(`Could not copy the recovery command. Copy the command shown above manually.`,`error`);try{let t=navigator.clipboard?.writeText;if(!t){e();return}t.call(navigator.clipboard,Pe.command).then(()=>{ee(G.id),setTimeout(()=>{fe.current&&ee(e=>e===G.id?null:e)},1500)}).catch(e)}catch{e()}},className:`shrink-0`,children:[I===G.id?(0,$.jsx)(fn,{size:12}):(0,$.jsx)(bn,{size:12}),I===G.id?`Copied`:Pe.label]})]}),M&&!E&&!m&&(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-warning/25 bg-warning/10 px-3 py-2 text-xs text-foreground`,children:[(0,$.jsxs)(`span`,{children:[`The workspace kickoff was not dispatched (`,M.executionProfile===`workspace-write`?`Edit workspace`:`Review only`,`).`]}),(0,$.jsx)(f,{size:`sm`,variant:`outline`,onClick:()=>void je(M,!0),disabled:A||P,children:P?`Checking CLI…`:`Recheck & retry`}),G?.setupIssue&&G.setupIssue!==`missing-cli`&&(0,$.jsx)(f,{size:`sm`,variant:`outline`,onClick:()=>void je(M,!0,!0),disabled:A||P,children:`Try with existing CLI auth`})]}),(0,$.jsxs)(`div`,{className:`flex w-full flex-col rounded-xl border border-border bg-card shadow-sm`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/50 p-2`,children:[(0,$.jsxs)(li,{children:[(0,$.jsxs)(ui,{"aria-label":`Select Provider`,className:c(`flex cursor-pointer items-center gap-2 rounded-md px-3 py-1.5 text-xs font-medium transition-colors hover:bg-accent`,m?`pointer-events-none opacity-50`:`text-foreground`),children:[G?.icon===`Bot`?(0,$.jsx)(Nn,{size:14,className:`text-primary`}):(0,$.jsx)(Ut,{size:14,className:`text-primary`}),G?.name||`Select Agent`]}),(0,$.jsx)(di,{align:`start`,side:`top`,children:r.map(e=>(0,$.jsxs)(fi,{onClick:()=>{m||x(e.id)},children:[e.icon===`Bot`?(0,$.jsx)(Nn,{size:14}):(0,$.jsx)(Ut,{size:14}),e.name]},e.id))})]}),(0,$.jsx)(`div`,{className:`h-4 w-px bg-border`}),G?.executionProfiles?.length&&ye?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(li,{children:[(0,$.jsx)(ui,{"aria-label":`Select execution profile`,disabled:E||g||A||!!M,className:`flex cursor-pointer items-center rounded-md px-2 py-1 text-xs font-medium text-foreground transition-colors hover:bg-accent disabled:pointer-events-none disabled:opacity-50`,children:ye.label}),(0,$.jsx)(di,{align:`start`,side:`top`,className:`max-w-80`,children:G.executionProfiles.map(e=>(0,$.jsx)(fi,{onClick:()=>C(t=>({...t,[G.id]:e.id})),children:(0,$.jsxs)(`span`,{className:`flex flex-col`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.description})]})},e.id))})]}),(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs text-muted-foreground`,title:ye.description,children:ye.description})]}):(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:G?.accessLabel??`Harness-managed access`})]}),(0,$.jsxs)(`div`,{className:`flex items-end gap-2 p-2`,children:[(0,$.jsx)(Mn,{value:d,disabled:A,onChange:e=>{p(e.target.value);let t=e.target;t.style.height=`auto`,t.style.height=`${Math.min(t.scrollHeight,200)}px`},onKeyDown:e=>{if(e.key===`Enter`&&!e.shiftKey){if(e.preventDefault(),g||E||he.current)return;m?Ee():Te();let t=e.currentTarget;t.style.height=`auto`}},placeholder:m?`Message the agent... (Shift+Enter for new line)`:`Start the agent or press Enter...`,unstyled:!0,className:`flex-1 [&_[data-slot=textarea]]:max-h-[200px] [&_[data-slot=textarea]]:min-h-11 [&_[data-slot=textarea]]:resize-none [&_[data-slot=textarea]]:text-sm`,rows:1}),m?(0,$.jsxs)(f,{className:`h-11 shrink-0 rounded-lg`,onClick:Ee,disabled:!d.trim()||g||A,children:[g?(0,$.jsx)(on,{size:14,className:`animate-spin`}):(0,$.jsx)(Wn,{size:14}),`Send`]}):(0,$.jsxs)(f,{className:`h-11 shrink-0 rounded-lg`,onClick:()=>Te(),disabled:!be,children:[(0,$.jsx)(Kn,{size:14}),`Start`]})]})]})]})]})}var no=[{value:`overview`,label:`Overview`},{value:`changes`,label:`Changes`},{value:`services`,label:`Services`},{value:`sessions`,label:`Sessions`},{value:`knowledge`,label:`Knowledge`},{value:`plan`,label:`Plan`}],ro=[`all`,`changes`,`running`],io=new URLSearchParams(window.location.search).get(`env`)===`vscode`;function ao(e){let{workspaces:t,workspaceStatuses:n,workspacesLoading:r,fetchWorkspaces:i,selectedId:a,subTab:o,onSelect:s,onSelectTab:l,resumingWs:u,handleResumeSession:d,handleCopyPrompt:p,handleDeleteWorkspace:m,deleteWsLoading:h,repos:g,addRepoLoading:_,handleAddRepo:v,sessionProps:y,changesProps:b,knowledgeProps:x,planProps:S}=e,[C,w]=(0,Z.useState)(``),[T,E]=(0,Z.useState)(`all`),D=t.find(e=>e.branchName===a)??null,O=D?.mode??`worktree`,k=$t(D?.branchName??null).data?.services??[],A=(0,Z.useMemo)(()=>{let e=C.trim().toLowerCase();return t.filter(t=>{let r=n[t.branchName];return!(e&&!`${t.branchName} ${t.description}`.toLowerCase().includes(e)||T===`changes`&&!(r&&r.changedFiles>0)||T===`running`&&!(r&&r.runningServices>0))})},[t,n,C,T]),j=D?D.repos.map(e=>{let t=Sn(e),n=b.gitChanges?.find(e=>e.repoName===t),r=n?n.files?.length??0:null,i=k.filter(e=>(e.cwd??``).split(/[\\/]/).includes(t));return{name:t,changedCount:r,ports:Array.from(new Set(i.map(e=>e.port).filter(e=>typeof e==`number`))),serviceCount:i.length}}):[],M=D?g.filter(e=>!D.repos.includes(e.path)):[];return(0,$.jsxs)(`div`,{className:`flex flex-col h-full animate-fade-in`,children:[(0,$.jsxs)(`header`,{className:`mb-6 flex items-start justify-between gap-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h1`,{className:`text-xl font-semibold text-foreground`,children:`Workspaces`}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Select a workspace to inspect its changes, services, sessions and context.`})]}),(0,$.jsxs)(f,{variant:`outline`,onClick:i,disabled:r,children:[(0,$.jsx)(on,{size:14,className:r?`animate-spin text-primary`:``}),`Refresh`]})]}),(0,$.jsxs)(`div`,{className:`flex gap-4 h-[calc(100vh-120px)] overflow-x-auto overflow-y-hidden pb-4`,children:[(0,$.jsxs)(`div`,{className:`w-60 shrink-0 flex flex-col overflow-y-auto pr-1`,children:[(0,$.jsxs)(`div`,{className:`relative mb-3`,children:[(0,$.jsx)(Wt,{size:14,className:`pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground`}),(0,$.jsx)(ce,{value:C,onChange:e=>w(e.target.value),placeholder:`Search workspaces`,className:`[&_[data-slot=input]]:pl-8`})]}),(0,$.jsx)(`div`,{className:`mb-3 flex items-center gap-1 rounded-lg border border-border bg-muted p-1`,children:ro.map(e=>(0,$.jsx)(`button`,{onClick:()=>E(e),className:c(`flex-1 rounded-md px-2.5 py-1 text-xs font-medium capitalize transition-colors cursor-pointer text-center`,T===e?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground hover:bg-accent`),children:e},e))}),r?(0,$.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:[0,1,2,3].map(e=>(0,$.jsx)(jn,{className:`h-14`},e))}):A.length===0?(0,$.jsx)(Tn,{className:`p-6 text-center text-sm text-muted-foreground`,children:`No workspaces match.`}):(0,$.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:A.map(e=>{let t=n[e.branchName],r=e.branchName===a,i=e.mode===`in-place`?null:t?an(t.syncStatus):null;return(0,$.jsxs)(`button`,{onClick:()=>s(e.branchName),className:c(`rounded-lg border p-3 text-left transition-colors cursor-pointer`,r?`border-primary/50 bg-primary/10`:`border-border bg-card hover:border-foreground/15 hover:bg-accent/50`),children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`truncate font-mono text-sm font-semibold text-foreground`,children:e.branchName}),(0,$.jsxs)(`span`,{className:`shrink-0 text-[11px] text-muted-foreground`,children:[e.repos.length,` repos`]})]}),(0,$.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:c(`h-1.5 w-1.5 rounded-full`,t?.changedFiles?`bg-warning`:`bg-success`),title:t?.changedFiles?`${t.changedFiles} uncommitted`:`Clean`}),t?.runningServices?(0,$.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-running`,title:`Running services`}):null,i&&(0,$.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:i.label})]})]},e.id)})})]}),(0,$.jsx)(`div`,{className:`flex-1 min-w-[360px] flex flex-col overflow-y-auto pr-4 pl-1`,children:D?(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(Tn,{className:`mb-4 p-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col items-start gap-4`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsx)(`h2`,{className:`truncate text-xl font-bold text-foreground`,title:D.branchName,children:D.branchName}),(0,$.jsx)(mn,{tone:O,children:O===`in-place`?`In-place`:`Worktree`})]}),(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsxs)(`span`,{children:[`Created `,new Date(D.createdAt).toLocaleDateString()]}),(0,$.jsx)(`span`,{children:`·`}),(0,$.jsxs)(`span`,{children:[D.repos.length,` repos`]})]})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(f,{disabled:u===D.branchName,onClick:()=>d(D),children:[(0,$.jsx)(wn,{size:13,className:u===D.branchName?`animate-spin`:``}),u===D.branchName?`Opening…`:`Continue in Chat`]}),(0,$.jsx)(Ht,{workspaceId:D.branchName,workspacePath:D.workspacePath,isVsCode:io}),(0,$.jsxs)(li,{children:[(0,$.jsx)(ui,{"aria-label":`More actions`,className:`grid h-9 w-9 shrink-0 place-items-center rounded-md border border-border bg-card text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,children:(0,$.jsx)(Fn,{size:16})}),(0,$.jsxs)(di,{align:`end`,children:[(0,$.jsxs)(fi,{onClick:()=>p(D),children:[(0,$.jsx)(bn,{size:14}),` Copy AI Context`]}),(0,$.jsx)(pi,{}),(0,$.jsxs)(fi,{variant:`destructive`,disabled:h===D.branchName,onClick:()=>void m(D.branchName),children:[(0,$.jsx)(Gt,{size:14}),h===D.branchName?`Deleting…`:`Delete Workspace`]})]})]})]})]}),(0,$.jsx)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:(()=>{let e=n[D.branchName];if(!e)return null;let t=O===`in-place`?null:an(e.syncStatus);return(0,$.jsxs)($.Fragment,{children:[e.changedFiles>0?(0,$.jsxs)(mn,{tone:`warning`,dot:!0,children:[e.changedFiles,` uncommitted`]}):(0,$.jsx)(mn,{tone:`idle`,dot:!0,children:`Clean`}),e.runningServices>0?(0,$.jsxs)(mn,{tone:`running`,dot:!0,children:[e.runningServices,` running`]}):(0,$.jsx)(mn,{tone:`idle`,dot:!0,children:`No services`}),t&&(0,$.jsxs)(mn,{tone:t.tone,children:[(0,$.jsx)(on,{size:11}),` `,t.label]}),e.pendingValidation&&(0,$.jsx)(mn,{tone:`warning`,children:`Needs validation`})]})})()})]}),(0,$.jsxs)(Bi,{value:o,onValueChange:e=>typeof e==`string`&&l(D.branchName,e),className:`mb-4`,children:[(0,$.jsx)(Vi,{className:`max-w-full overflow-x-auto`,children:no.map(e=>(0,$.jsx)(Hi,{value:e.value,children:e.label},e.value))}),(0,$.jsxs)(Ui,{value:o,className:`animate-fade-in`,children:[o===`overview`&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,$.jsxs)(Tn,{className:`p-5`,children:[(0,$.jsx)(`h3`,{className:`mb-2 text-sm font-semibold text-foreground`,children:`Description`}),D.description?(0,$.jsx)(`p`,{className:`whitespace-pre-line text-sm leading-relaxed text-muted-foreground`,children:D.description}):(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No description provided.`})]}),(0,$.jsxs)(Tn,{className:`p-5`,children:[(0,$.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`h3`,{className:`text-sm font-semibold text-foreground`,children:[`Repositories `,(0,$.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,D.repos.length,`)`]})]}),M.length>0&&(0,$.jsx)(ga,{repos:M,disabled:_,onAdd:e=>{window.confirm(`Add repository "${Sn(e)}" to this workspace?\nThis creates a new git worktree and re-runs analysis.`)&&v(D.branchName,e)}})]}),(0,$.jsx)(`div`,{className:`divide-y divide-border`,children:j.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center gap-3 py-2.5 first:pt-0 last:pb-0`,children:[(0,$.jsx)(`span`,{className:c(`h-2 w-2 shrink-0 rounded-full`,e.changedCount===null?`bg-muted-foreground`:e.changedCount>0?`bg-warning`:`bg-success`),title:e.changedCount===null?`Status unknown`:e.changedCount>0?`Uncommitted changes`:`Clean`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-sm text-foreground`,children:e.name}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[e.ports.map(e=>(0,$.jsxs)(`span`,{className:`rounded border border-border bg-background px-1.5 py-0.5 font-mono text-[11px] text-running-foreground`,children:[`:`,e]},e)),(0,$.jsx)(`span`,{className:`w-24 text-right text-xs text-muted-foreground`,children:e.changedCount===null?`—`:e.changedCount>0?`${e.changedCount} changed`:`clean`})]})]},e.name))}),(0,$.jsx)(`p`,{className:`mt-3 text-[11px] text-muted-foreground`,children:`Per-repo git state and detected service ports.`})]})]}),o===`sessions`&&(0,$.jsx)(ya,{ws:D,...y}),o===`services`&&(0,$.jsx)(ba,{ws:D}),o===`changes`&&(0,$.jsx)(xa,{ws:D,...b}),o===`knowledge`&&(0,$.jsx)(Sa,{ws:D,...x}),o===`plan`&&(0,$.jsx)(Ca,{...S})]})]})]}):(0,$.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-8`,children:(0,$.jsx)(`div`,{className:`max-w-md w-full`,children:(0,$.jsx)(Tn,{className:`border-dashed p-0 shadow-sm`,children:(0,$.jsx)(An,{children:(0,$.jsxs)(kn,{children:[(0,$.jsx)(Dn,{variant:`icon`,children:(0,$.jsx)(sn,{})}),(0,$.jsx)(En,{children:`No workspace selected`}),(0,$.jsx)(On,{children:`Pick a workspace from the list to see its status, repositories, changes, services and sessions.`})]})})})})})}),(0,$.jsx)(`div`,{className:`w-[340px] 2xl:w-[400px] shrink-0 flex flex-col overflow-hidden rounded-xl border border-border bg-card shadow-sm`,children:D?(0,$.jsx)(to,{ws:D},D.branchName):(0,$.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-10 text-center text-sm text-muted-foreground`,children:`Select a workspace to start chatting.`})})]})]})}export{ao as WorkspacesPage};