@mrpatronz/nexusflow 2.8.0 → 2.8.1

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 (167) hide show
  1. package/README.md +15 -12
  2. package/dist/agent/orchestrator.d.ts.map +1 -1
  3. package/dist/agent/orchestrator.js +8 -0
  4. package/dist/agent/orchestrator.js.map +1 -1
  5. package/dist/commands/commands.test.js +3 -0
  6. package/dist/commands/commands.test.js.map +1 -1
  7. package/dist/commands/doctor.d.ts.map +1 -1
  8. package/dist/commands/doctor.js +2 -0
  9. package/dist/commands/doctor.js.map +1 -1
  10. package/dist/commands/init.d.ts +3 -1
  11. package/dist/commands/init.d.ts.map +1 -1
  12. package/dist/commands/init.js +9 -1
  13. package/dist/commands/init.js.map +1 -1
  14. package/dist/commands/knowledge.d.ts +9 -0
  15. package/dist/commands/knowledge.d.ts.map +1 -1
  16. package/dist/commands/knowledge.js +59 -2
  17. package/dist/commands/knowledge.js.map +1 -1
  18. package/dist/commands/knowledge.test.js +14 -1
  19. package/dist/commands/knowledge.test.js.map +1 -1
  20. package/dist/commands/progress.d.ts +4 -0
  21. package/dist/commands/progress.d.ts.map +1 -0
  22. package/dist/commands/progress.js +33 -0
  23. package/dist/commands/progress.js.map +1 -0
  24. package/dist/commands/refresh.d.ts +1 -0
  25. package/dist/commands/refresh.d.ts.map +1 -1
  26. package/dist/commands/refresh.js +17 -2
  27. package/dist/commands/refresh.js.map +1 -1
  28. package/dist/commands/remote.d.ts +4 -0
  29. package/dist/commands/remote.d.ts.map +1 -0
  30. package/dist/commands/remote.js +28 -0
  31. package/dist/commands/remote.js.map +1 -0
  32. package/dist/commands/status.d.ts.map +1 -1
  33. package/dist/commands/status.js +14 -1
  34. package/dist/commands/status.js.map +1 -1
  35. package/dist/commands/status.test.d.ts +2 -0
  36. package/dist/commands/status.test.d.ts.map +1 -0
  37. package/dist/commands/status.test.js +31 -0
  38. package/dist/commands/status.test.js.map +1 -0
  39. package/dist/core/analysis-cache.d.ts +13 -3
  40. package/dist/core/analysis-cache.d.ts.map +1 -1
  41. package/dist/core/analysis-cache.js +41 -31
  42. package/dist/core/analysis-cache.js.map +1 -1
  43. package/dist/core/analysis-cache.test.js +50 -8
  44. package/dist/core/analysis-cache.test.js.map +1 -1
  45. package/dist/core/doctor.d.ts.map +1 -1
  46. package/dist/core/doctor.js +61 -0
  47. package/dist/core/doctor.js.map +1 -1
  48. package/dist/core/generation-lock.d.ts +58 -0
  49. package/dist/core/generation-lock.d.ts.map +1 -0
  50. package/dist/core/generation-lock.js +233 -0
  51. package/dist/core/generation-lock.js.map +1 -0
  52. package/dist/core/generation-lock.test.d.ts +2 -0
  53. package/dist/core/generation-lock.test.d.ts.map +1 -0
  54. package/dist/core/generation-lock.test.js +134 -0
  55. package/dist/core/generation-lock.test.js.map +1 -0
  56. package/dist/core/isolate.test.js +30 -0
  57. package/dist/core/isolate.test.js.map +1 -1
  58. package/dist/core/knowledge.d.ts +20 -0
  59. package/dist/core/knowledge.d.ts.map +1 -1
  60. package/dist/core/knowledge.js +184 -36
  61. package/dist/core/knowledge.js.map +1 -1
  62. package/dist/core/knowledge.test.js +93 -15
  63. package/dist/core/knowledge.test.js.map +1 -1
  64. package/dist/core/progress.d.ts +21 -0
  65. package/dist/core/progress.d.ts.map +1 -0
  66. package/dist/core/progress.js +40 -0
  67. package/dist/core/progress.js.map +1 -0
  68. package/dist/core/progress.test.d.ts +2 -0
  69. package/dist/core/progress.test.d.ts.map +1 -0
  70. package/dist/core/progress.test.js +52 -0
  71. package/dist/core/progress.test.js.map +1 -0
  72. package/dist/core/refresh.d.ts +5 -0
  73. package/dist/core/refresh.d.ts.map +1 -1
  74. package/dist/core/refresh.js +25 -0
  75. package/dist/core/refresh.js.map +1 -1
  76. package/dist/core/refresh.test.js +20 -0
  77. package/dist/core/refresh.test.js.map +1 -1
  78. package/dist/core/status.d.ts +2 -0
  79. package/dist/core/status.d.ts.map +1 -1
  80. package/dist/core/status.js +6 -1
  81. package/dist/core/status.js.map +1 -1
  82. package/dist/core/sync.d.ts.map +1 -1
  83. package/dist/core/sync.js +22 -1
  84. package/dist/core/sync.js.map +1 -1
  85. package/dist/core/sync.test.js +27 -0
  86. package/dist/core/sync.test.js.map +1 -1
  87. package/dist/core/workspace-git.d.ts +15 -0
  88. package/dist/core/workspace-git.d.ts.map +1 -0
  89. package/dist/core/workspace-git.js +131 -0
  90. package/dist/core/workspace-git.js.map +1 -0
  91. package/dist/core/workspace-git.test.d.ts +2 -0
  92. package/dist/core/workspace-git.test.d.ts.map +1 -0
  93. package/dist/core/workspace-git.test.js +52 -0
  94. package/dist/core/workspace-git.test.js.map +1 -0
  95. package/dist/core/workspace-skills-workflow.integration.test.js +15 -0
  96. package/dist/core/workspace-skills-workflow.integration.test.js.map +1 -1
  97. package/dist/core/workspace.create.test.js +5 -2
  98. package/dist/core/workspace.create.test.js.map +1 -1
  99. package/dist/core/workspace.d.ts.map +1 -1
  100. package/dist/core/workspace.js +11 -6
  101. package/dist/core/workspace.js.map +1 -1
  102. package/dist/generators/antigravity.d.ts.map +1 -1
  103. package/dist/generators/antigravity.js +2 -1
  104. package/dist/generators/antigravity.js.map +1 -1
  105. package/dist/generators/base.d.ts.map +1 -1
  106. package/dist/generators/base.js +5 -3
  107. package/dist/generators/base.js.map +1 -1
  108. package/dist/generators/claude.d.ts.map +1 -1
  109. package/dist/generators/claude.js +4 -1
  110. package/dist/generators/claude.js.map +1 -1
  111. package/dist/generators/codex.d.ts.map +1 -1
  112. package/dist/generators/codex.js +2 -1
  113. package/dist/generators/codex.js.map +1 -1
  114. package/dist/generators/copilot.d.ts.map +1 -1
  115. package/dist/generators/copilot.js +4 -3
  116. package/dist/generators/copilot.js.map +1 -1
  117. package/dist/generators/cursor.d.ts.map +1 -1
  118. package/dist/generators/cursor.js +6 -3
  119. package/dist/generators/cursor.js.map +1 -1
  120. package/dist/generators/index.d.ts +2 -0
  121. package/dist/generators/index.d.ts.map +1 -1
  122. package/dist/generators/index.js +79 -45
  123. package/dist/generators/index.js.map +1 -1
  124. package/dist/generators/knowledge-migration.test.d.ts +2 -0
  125. package/dist/generators/knowledge-migration.test.d.ts.map +1 -0
  126. package/dist/generators/knowledge-migration.test.js +22 -0
  127. package/dist/generators/knowledge-migration.test.js.map +1 -0
  128. package/dist/generators/plan-generator.d.ts.map +1 -1
  129. package/dist/generators/plan-generator.js +18 -9
  130. package/dist/generators/plan-generator.js.map +1 -1
  131. package/dist/generators/plan-generator.test.js +4 -1
  132. package/dist/generators/plan-generator.test.js.map +1 -1
  133. package/dist/gui/assets/{AgentsPage-Bfyu13gc.js → AgentsPage-B4fx43rd.js} +1 -1
  134. package/dist/gui/assets/{DashboardPage-O5wj99kn.js → DashboardPage-DH52G8IG.js} +1 -1
  135. package/dist/gui/assets/{GettingStartedPage-DDWBueC7.js → GettingStartedPage-BlTrQhvi.js} +1 -1
  136. package/dist/gui/assets/{ProjectsPage-NHkXrDM2.js → ProjectsPage-BPVSLPXv.js} +1 -1
  137. package/dist/gui/assets/{ScaffoldRepoInline-Cmqg_s94.js → ScaffoldRepoInline-ywcpq9PX.js} +1 -1
  138. package/dist/gui/assets/{SettingsPage-Cc77HBp7.js → SettingsPage-RQr8SalV.js} +1 -1
  139. package/dist/gui/assets/{SkillsPage-D4CVxwrI.js → SkillsPage-CYoSRrwx.js} +1 -1
  140. package/dist/gui/assets/StartWorkPage-DBKK4lFi.js +1 -0
  141. package/dist/gui/assets/{StrategiesPage-Dn66xfZN.js → StrategiesPage-C36TZgDX.js} +1 -1
  142. package/dist/gui/assets/{WorkspacesPage-BgdoM5Hs.js → WorkspacesPage-DxEONvSq.js} +1 -1
  143. package/dist/gui/assets/{alert-dialog-BYZ7cgWA.js → alert-dialog-CQAX2yRx.js} +1 -1
  144. package/dist/gui/assets/index-BF6pre6G.css +2 -0
  145. package/dist/gui/assets/{index-CoNaATPd.js → index-C_rwnBzF.js} +2 -2
  146. package/dist/gui/assets/{vsc-BTST_4ex.js → vsc-DFh0-53h.js} +1 -1
  147. package/dist/gui/index.html +2 -2
  148. package/dist/index.js +48 -4
  149. package/dist/index.js.map +1 -1
  150. package/dist/mcp/tools.d.ts.map +1 -1
  151. package/dist/mcp/tools.js +19 -8
  152. package/dist/mcp/tools.js.map +1 -1
  153. package/dist/mcp/tools.test.js +15 -0
  154. package/dist/mcp/tools.test.js.map +1 -1
  155. package/dist/resources/materializer.d.ts.map +1 -1
  156. package/dist/resources/materializer.js +11 -3
  157. package/dist/resources/materializer.js.map +1 -1
  158. package/dist/server.d.ts.map +1 -1
  159. package/dist/server.js +22 -3
  160. package/dist/server.js.map +1 -1
  161. package/dist/server.test.js +25 -0
  162. package/dist/server.test.js.map +1 -1
  163. package/dist/types.d.ts +17 -0
  164. package/dist/types.d.ts.map +1 -1
  165. package/package.json +1 -1
  166. package/dist/gui/assets/StartWorkPage-RPZTN3Ui.js +0 -1
  167. package/dist/gui/assets/index-BmH7a-Qy.css +0 -2
@@ -1 +1 @@
1
- import{_ as e,b as t,c as n,d as r,g as i,i as a,m as o,n as s,o as c,p as l,t as u}from"./button-BDDZnIHx.js";import{Cn as d,Dt as f,Mn as p,Ot as m,Un as ee,c as te,d as ne,f as re,in as ie,l as ae,o as h,p as g,pn as oe,rn as se,u as ce,un as le}from"./CSPContext-DBUu9tE0.js";import{t as ue}from"./useValueChanged-DeYvGnKs.js";import{t as de}from"./useAriaLabelledBy-ClesgjMe.js";import{D as _,E as v,O as y,Rt as b,T as x,Ut as S,Xt as C,a as w,k as T}from"./index-CoNaATPd.js";import{t as E}from"./badge-CAohJGj6.js";import{t as D}from"./card-BKXzd_5L.js";import{t as O}from"./label-CG5exjag.js";var k=t(e(),1),A=k.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:o,...s}=e;return a(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},s]})}),j=i(),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 k.Children.forEach(n,e=>{if(!(0,k.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)(A,{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=k.createContext(void 0);function B(){let e=k.useContext(z);if(e===void 0)throw Error(l(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={...g,checked(e){return e?{[V.checked]:``}:{[V.unchecked]:``}}},U=k.forwardRef(function(e,t){let{checked:i,className:o,defaultChecked:s,"aria-labelledby":l,form:u,id:h,inputRef:g,name:_,nativeButton:v=!1,onCheckedChange:y,readOnly:b=!1,required:x=!1,disabled:S=!1,render:C,uncheckedValue:w,value:T,style:E,...D}=e,{clearErrors:O}=ne(),{state:A,setTouched:M,setDirty:N,validityData:P,setFilled:F,setFocused:I,validationMode:L,disabled:R,name:B,validation:V}=re(),{labelId:U}=ce(),W=R||S,G=B??_,K=k.useRef(null),fe=r(K,g,V.inputRef),q=k.useRef(null),J=ie(),Y=ae({id:h,implicit:!1,controlRef:q}),X=v?void 0:Y,[Z,pe]=p({controlled:i,default:!!s,name:`Switch`,state:`checked`});te(q,J,Z,void 0,!W,_),oe(()=>{K.current&&F(K.current.checked)},[K,F]),ue(Z,()=>{O(G),N(Z!==P.initialValue),F(Z),V.change(Z)});let{getButtonProps:me,buttonRef:Q}=le({disabled:W,native:v}),he=de(l,U,K,!v,X),ge={id:v?Y:J,role:`switch`,"aria-checked":Z,"aria-readonly":b||void 0,"aria-required":x||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(b||W)return;e.preventDefault();let t=K.current;t&&t.dispatchEvent(new(d(t)).PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey}))}},_e=c({checked:Z,disabled:W,form:u,id:X,name:G,required:x,style:G?m:f,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:fe,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(b){e.preventDefault();return}let t=e.currentTarget.checked,n=se(ee,e.nativeEvent);y?.(t,n),!n.isCanceled&&pe(t)},onFocus(){q.current?.focus()}},e=>V.getValidationProps(W,e),T===void 0?n:{value:T}),$=k.useMemo(()=>({...A,checked:Z,disabled:W,readOnly:b,required:x}),[A,Z,W,b,x]),ve=a(`span`,e,{state:$,ref:[t,q,Q],props:[ge,D,me,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=k.forwardRef(function(e,t){let{render:n,className:r,style:i,...o}=e;return a(`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)(C,{size:18}),` Settings successfully saved and updated!`]}),n===`error`&&(0,j.jsxs)(P,{variant:`error`,className:`mb-6`,children:[(0,j.jsx)(b,{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)(O,{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)(O,{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)(O,{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)(O,{className:`text-sm`,children:`Default Assistant`}),(0,j.jsxs)(x,{value:e.defaultAssistant||``,onValueChange:n=>typeof n==`string`&&t({...e,defaultAssistant:n||null}),children:[(0,j.jsx)(y,{"aria-label":`Default Assistant`,children:(0,j.jsx)(T,{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)(_,{alignItemWithTrigger:!1,children:[(0,j.jsx)(v,{value:``,children:`None (Prompt me)`}),(0,j.jsx)(v,{value:`claude`,children:`Claude Code`}),(0,j.jsx)(v,{value:`antigravity`,children:`Antigravity`}),(0,j.jsx)(v,{value:`codex`,children:`Codex`}),(0,j.jsx)(v,{value:`copilot`,children:`GitHub Copilot`}),(0,j.jsx)(v,{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)(O,{className:`text-sm`,children:`Preferred Editor`}),(0,j.jsxs)(x,{value:e.defaultEditor||``,onValueChange:n=>typeof n==`string`&&t({...e,defaultEditor:n||null}),children:[(0,j.jsx)(y,{"aria-label":`Preferred Editor`,children:(0,j.jsx)(T,{children:p?`${p.name} ${p.detected?`(Detected)`:`(Not found)`}`:`No preference`})}),(0,j.jsxs)(_,{alignItemWithTrigger:!1,children:[(0,j.jsx)(v,{value:``,children:`No preference`}),r.map(e=>(0,j.jsxs)(v,{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)(O,{htmlFor:`storageProvider`,className:`text-sm`,children:`Storage Provider`}),(0,j.jsxs)(x,{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)(y,{id:`storageProvider`,"aria-label":`Storage Provider`,children:(0,j.jsx)(T,{children:m?.displayName??`Local Workspace (Folders)`})}),(0,j.jsx)(_,{alignItemWithTrigger:!1,children:i.length>0?i.map(e=>(0,j.jsx)(v,{value:e.name,children:e.displayName},e.name)):(0,j.jsx)(v,{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)(O,{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)(O,{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)(w,{className:`size-3`}):(0,j.jsx)(S,{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)(w,{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)(E,{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)(w,{className:`size-3`}),` Updating...`]}):`Update Tool`}):e.installed?(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsxs)(E,{variant:`success`,className:`gap-1.5`,children:[(0,j.jsx)(C,{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)(w,{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)(w,{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)(C,{size:16}),` Save Configuration`]})})]})}export{K as SettingsPage};
1
+ import{_ as e,b as t,c as n,d as r,g as i,i as a,m as o,n as s,o as c,p as l,t as u}from"./button-BDDZnIHx.js";import{Cn as d,Dt as f,Mn as p,Ot as m,Un as ee,c as te,d as ne,f as re,in as ie,l as ae,o as h,p as g,pn as oe,rn as se,u as ce,un as le}from"./CSPContext-DBUu9tE0.js";import{t as ue}from"./useValueChanged-DeYvGnKs.js";import{t as de}from"./useAriaLabelledBy-ClesgjMe.js";import{D as _,E as v,O as y,Rt as b,T as x,Ut as S,Xt as C,a as w,k as T}from"./index-C_rwnBzF.js";import{t as E}from"./badge-CAohJGj6.js";import{t as D}from"./card-BKXzd_5L.js";import{t as O}from"./label-CG5exjag.js";var k=t(e(),1),A=k.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:o,...s}=e;return a(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},s]})}),j=i(),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 k.Children.forEach(n,e=>{if(!(0,k.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)(A,{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=k.createContext(void 0);function B(){let e=k.useContext(z);if(e===void 0)throw Error(l(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={...g,checked(e){return e?{[V.checked]:``}:{[V.unchecked]:``}}},U=k.forwardRef(function(e,t){let{checked:i,className:o,defaultChecked:s,"aria-labelledby":l,form:u,id:h,inputRef:g,name:_,nativeButton:v=!1,onCheckedChange:y,readOnly:b=!1,required:x=!1,disabled:S=!1,render:C,uncheckedValue:w,value:T,style:E,...D}=e,{clearErrors:O}=ne(),{state:A,setTouched:M,setDirty:N,validityData:P,setFilled:F,setFocused:I,validationMode:L,disabled:R,name:B,validation:V}=re(),{labelId:U}=ce(),W=R||S,G=B??_,K=k.useRef(null),fe=r(K,g,V.inputRef),q=k.useRef(null),J=ie(),Y=ae({id:h,implicit:!1,controlRef:q}),X=v?void 0:Y,[Z,pe]=p({controlled:i,default:!!s,name:`Switch`,state:`checked`});te(q,J,Z,void 0,!W,_),oe(()=>{K.current&&F(K.current.checked)},[K,F]),ue(Z,()=>{O(G),N(Z!==P.initialValue),F(Z),V.change(Z)});let{getButtonProps:me,buttonRef:Q}=le({disabled:W,native:v}),he=de(l,U,K,!v,X),ge={id:v?Y:J,role:`switch`,"aria-checked":Z,"aria-readonly":b||void 0,"aria-required":x||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(b||W)return;e.preventDefault();let t=K.current;t&&t.dispatchEvent(new(d(t)).PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey}))}},_e=c({checked:Z,disabled:W,form:u,id:X,name:G,required:x,style:G?m:f,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:fe,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(b){e.preventDefault();return}let t=e.currentTarget.checked,n=se(ee,e.nativeEvent);y?.(t,n),!n.isCanceled&&pe(t)},onFocus(){q.current?.focus()}},e=>V.getValidationProps(W,e),T===void 0?n:{value:T}),$=k.useMemo(()=>({...A,checked:Z,disabled:W,readOnly:b,required:x}),[A,Z,W,b,x]),ve=a(`span`,e,{state:$,ref:[t,q,Q],props:[ge,D,me,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=k.forwardRef(function(e,t){let{render:n,className:r,style:i,...o}=e;return a(`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)(C,{size:18}),` Settings successfully saved and updated!`]}),n===`error`&&(0,j.jsxs)(P,{variant:`error`,className:`mb-6`,children:[(0,j.jsx)(b,{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)(O,{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)(O,{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)(O,{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)(O,{className:`text-sm`,children:`Default Assistant`}),(0,j.jsxs)(x,{value:e.defaultAssistant||``,onValueChange:n=>typeof n==`string`&&t({...e,defaultAssistant:n||null}),children:[(0,j.jsx)(y,{"aria-label":`Default Assistant`,children:(0,j.jsx)(T,{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)(_,{alignItemWithTrigger:!1,children:[(0,j.jsx)(v,{value:``,children:`None (Prompt me)`}),(0,j.jsx)(v,{value:`claude`,children:`Claude Code`}),(0,j.jsx)(v,{value:`antigravity`,children:`Antigravity`}),(0,j.jsx)(v,{value:`codex`,children:`Codex`}),(0,j.jsx)(v,{value:`copilot`,children:`GitHub Copilot`}),(0,j.jsx)(v,{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)(O,{className:`text-sm`,children:`Preferred Editor`}),(0,j.jsxs)(x,{value:e.defaultEditor||``,onValueChange:n=>typeof n==`string`&&t({...e,defaultEditor:n||null}),children:[(0,j.jsx)(y,{"aria-label":`Preferred Editor`,children:(0,j.jsx)(T,{children:p?`${p.name} ${p.detected?`(Detected)`:`(Not found)`}`:`No preference`})}),(0,j.jsxs)(_,{alignItemWithTrigger:!1,children:[(0,j.jsx)(v,{value:``,children:`No preference`}),r.map(e=>(0,j.jsxs)(v,{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)(O,{htmlFor:`storageProvider`,className:`text-sm`,children:`Storage Provider`}),(0,j.jsxs)(x,{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)(y,{id:`storageProvider`,"aria-label":`Storage Provider`,children:(0,j.jsx)(T,{children:m?.displayName??`Local Workspace (Folders)`})}),(0,j.jsx)(_,{alignItemWithTrigger:!1,children:i.length>0?i.map(e=>(0,j.jsx)(v,{value:e.name,children:e.displayName},e.name)):(0,j.jsx)(v,{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)(O,{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)(O,{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)(w,{className:`size-3`}):(0,j.jsx)(S,{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)(w,{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)(E,{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)(w,{className:`size-3`}),` Updating...`]}):`Update Tool`}):e.installed?(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsxs)(E,{variant:`success`,className:`gap-1.5`,children:[(0,j.jsx)(C,{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)(w,{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)(w,{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)(C,{size:16}),` Save Configuration`]})})]})}export{K as SettingsPage};
@@ -1,4 +1,4 @@
1
- import{_ as e,b as t,g as n,h as r,m as i,t as a}from"./button-BDDZnIHx.js";import{o}from"./CSPContext-DBUu9tE0.js";import{t as ee}from"./chevron-down-qTL8HPug.js";import{a as s,c as te,i as ne,l as c,n as re,o as ie,r as l,s as u,t as ae,u as oe}from"./square-DlIYnlSq.js";import{t as d}from"./code-xml-jFAa3-TT.js";import{t as se}from"./cpu-Cdwd84Jz.js";import{t as f}from"./trash-2-CtR35_eF.js";import{t as p}from"./zap-CWG_Lvki.js";import{$ as ce,B as le,Bt as ue,Ht as de,Kt as fe,Lt as pe,N as me,Nt as he,V as ge,Wt as m,X as _e,Xt as ve,Z as ye,Zt as h,a as be,c as g,d as _,et as xe,f as v,l as y,o as b,ot as Se,p as x,s as S,st as Ce,zt as C}from"./index-CoNaATPd.js";import{t as w}from"./badge-CAohJGj6.js";import{t as we}from"./card-BKXzd_5L.js";import{a as Te,i as Ee,n as De,r as Oe,t as ke}from"./empty-BdlgbifD.js";import{t as T}from"./label-CG5exjag.js";import{t as Ae}from"./textarea-ByfoCb54.js";var je=r(`arrow-right-left`,[[`path`,{d:`m16 3 4 4-4 4`,key:`1x1c3m`}],[`path`,{d:`M20 7H4`,key:`zbl0bi`}],[`path`,{d:`m8 21-4-4 4-4`,key:`h9nckh`}],[`path`,{d:`M4 17h16`,key:`g4d7ey`}]]),Me=r(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Ne=r(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),Pe=r(`pen`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),Fe=r(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),E=t(e(),1),D=n(),O={"git-pull-request":ie,"flask-conical":u,package:ne,database:c,"shield-check":l,terminal:C,zap:p,cpu:se,layers:s,boxes:h,code:d},Ie=[{label:`Blue`,value:`#3b82f6`},{label:`Green`,value:`#10b981`},{label:`Purple`,value:`#8b5cf6`},{label:`Amber`,value:`#f59e0b`},{label:`Red`,value:`#ef4444`},{label:`Cyan`,value:`#06b6d4`},{label:`Pink`,value:`#ec4899`},{label:`Emerald`,value:`#059669`}];function k({showToast:e}){let[t,n]=(0,E.useState)(`global`),[r,s]=(0,E.useState)(``),[ne,c]=(0,E.useState)({}),[ie,l]=(0,E.useState)(!1),[u,d]=(0,E.useState)(null),[se,p]=(0,E.useState)(!1),[C,k]=(0,E.useState)(null),[Le,A]=(0,E.useState)(!1),[j,M]=(0,E.useState)(`edit`),[Re,N]=(0,E.useState)(!1),[P,F]=(0,E.useState)(null),[ze,I]=(0,E.useState)(!1),[L,R]=(0,E.useState)(null),[z,Be]=(0,E.useState)(null),[Ve,B]=(0,E.useState)(null),{data:V=[],isLoading:He}=ce(),{data:H=[],isLoading:Ue}=xe(t===`global`?void 0:t),{data:We=[]}=Ce(),{data:U,isLoading:Ge,isError:Ke}=Se(t===`global`?``:t),[W,G]=(0,E.useState)(null),qe=ye(),Je=ge(),K=_e(),Ye=le(),q=me(),J=t!==`global`,Y=new Set(W??U?.enabledSkills??[]),X=!J||!Ge&&!Ke&&!!U;(0,E.useEffect)(()=>{if(!J){G(null);return}U&&G([...U.enabledSkills])},[J,t,U]);let Xe=e=>{c(t=>({...t,[e]:!t[e]}))},Z=H.filter(e=>{if(!r.trim())return!0;let t=r.toLowerCase();return e.title?.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)||e.description.toLowerCase().includes(t)||e.tags?.some(e=>e.toLowerCase().includes(t))}),Ze=V.reduce((e,t)=>(e[t.id]=Z.filter(e=>e.category===t.id),e),{}),Q=Z.filter(e=>!e.category||!V.some(t=>t.id===e.category)),Qe=e=>{d(e||{name:``,description:``,icon:`boxes`,color:`#3b82f6`,custom:!0}),l(!0)},$e=async()=>{if(!(!u||!u.name?.trim()))try{await qe.mutateAsync({id:u.id,name:u.name.trim(),description:u.description,icon:u.icon,color:u.color}),e?.(`Category saved successfully`,`success`),l(!1),d(null)}catch(t){e?.(`Failed to save category`,`error`),console.error(t)}},et=(e,t)=>{t.stopPropagation(),R({type:`category`,id:e.id,title:e.name}),I(!0)},$=(e,t)=>{k(e||{name:``,title:``,category:t||(V[0]?.id??`pull-requests`),description:``,tags:[],allowedTools:[],content:`# Skill Title
1
+ import{_ as e,b as t,g as n,h as r,m as i,t as a}from"./button-BDDZnIHx.js";import{o}from"./CSPContext-DBUu9tE0.js";import{t as ee}from"./chevron-down-qTL8HPug.js";import{a as s,c as te,i as ne,l as c,n as re,o as ie,r as l,s as u,t as ae,u as oe}from"./square-DlIYnlSq.js";import{t as d}from"./code-xml-jFAa3-TT.js";import{t as se}from"./cpu-Cdwd84Jz.js";import{t as f}from"./trash-2-CtR35_eF.js";import{t as p}from"./zap-CWG_Lvki.js";import{$ as ce,B as le,Bt as ue,Ht as de,Kt as fe,Lt as pe,N as me,Nt as he,V as ge,Wt as m,X as _e,Xt as ve,Z as ye,Zt as h,a as be,c as g,d as _,et as xe,f as v,l as y,o as b,ot as Se,p as x,s as S,st as Ce,zt as C}from"./index-C_rwnBzF.js";import{t as w}from"./badge-CAohJGj6.js";import{t as we}from"./card-BKXzd_5L.js";import{a as Te,i as Ee,n as De,r as Oe,t as ke}from"./empty-BdlgbifD.js";import{t as T}from"./label-CG5exjag.js";import{t as Ae}from"./textarea-ByfoCb54.js";var je=r(`arrow-right-left`,[[`path`,{d:`m16 3 4 4-4 4`,key:`1x1c3m`}],[`path`,{d:`M20 7H4`,key:`zbl0bi`}],[`path`,{d:`m8 21-4-4 4-4`,key:`h9nckh`}],[`path`,{d:`M4 17h16`,key:`g4d7ey`}]]),Me=r(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Ne=r(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),Pe=r(`pen`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),Fe=r(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),E=t(e(),1),D=n(),O={"git-pull-request":ie,"flask-conical":u,package:ne,database:c,"shield-check":l,terminal:C,zap:p,cpu:se,layers:s,boxes:h,code:d},Ie=[{label:`Blue`,value:`#3b82f6`},{label:`Green`,value:`#10b981`},{label:`Purple`,value:`#8b5cf6`},{label:`Amber`,value:`#f59e0b`},{label:`Red`,value:`#ef4444`},{label:`Cyan`,value:`#06b6d4`},{label:`Pink`,value:`#ec4899`},{label:`Emerald`,value:`#059669`}];function k({showToast:e}){let[t,n]=(0,E.useState)(`global`),[r,s]=(0,E.useState)(``),[ne,c]=(0,E.useState)({}),[ie,l]=(0,E.useState)(!1),[u,d]=(0,E.useState)(null),[se,p]=(0,E.useState)(!1),[C,k]=(0,E.useState)(null),[Le,A]=(0,E.useState)(!1),[j,M]=(0,E.useState)(`edit`),[Re,N]=(0,E.useState)(!1),[P,F]=(0,E.useState)(null),[ze,I]=(0,E.useState)(!1),[L,R]=(0,E.useState)(null),[z,Be]=(0,E.useState)(null),[Ve,B]=(0,E.useState)(null),{data:V=[],isLoading:He}=ce(),{data:H=[],isLoading:Ue}=xe(t===`global`?void 0:t),{data:We=[]}=Ce(),{data:U,isLoading:Ge,isError:Ke}=Se(t===`global`?``:t),[W,G]=(0,E.useState)(null),qe=ye(),Je=ge(),K=_e(),Ye=le(),q=me(),J=t!==`global`,Y=new Set(W??U?.enabledSkills??[]),X=!J||!Ge&&!Ke&&!!U;(0,E.useEffect)(()=>{if(!J){G(null);return}U&&G([...U.enabledSkills])},[J,t,U]);let Xe=e=>{c(t=>({...t,[e]:!t[e]}))},Z=H.filter(e=>{if(!r.trim())return!0;let t=r.toLowerCase();return e.title?.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)||e.description.toLowerCase().includes(t)||e.tags?.some(e=>e.toLowerCase().includes(t))}),Ze=V.reduce((e,t)=>(e[t.id]=Z.filter(e=>e.category===t.id),e),{}),Q=Z.filter(e=>!e.category||!V.some(t=>t.id===e.category)),Qe=e=>{d(e||{name:``,description:``,icon:`boxes`,color:`#3b82f6`,custom:!0}),l(!0)},$e=async()=>{if(!(!u||!u.name?.trim()))try{await qe.mutateAsync({id:u.id,name:u.name.trim(),description:u.description,icon:u.icon,color:u.color}),e?.(`Category saved successfully`,`success`),l(!1),d(null)}catch(t){e?.(`Failed to save category`,`error`),console.error(t)}},et=(e,t)=>{t.stopPropagation(),R({type:`category`,id:e.id,title:e.name}),I(!0)},$=(e,t)=>{k(e||{name:``,title:``,category:t||(V[0]?.id??`pull-requests`),description:``,tags:[],allowedTools:[],content:`# Skill Title
2
2
 
3
3
  Instructions and playbook for the AI assistant.
4
4
  `,custom:!0}),A(!!e),M(`edit`),p(!0)},tt=e=>{if(!C)return;let t={...C,title:e};!Le&&!C.id&&(t.name=e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)),k(t)},nt=async()=>{if(!C||!C.name?.trim()||!C.description?.trim()||!C.content?.trim()){e?.(`Skill name, trigger description, and content are required`,`error`);return}try{await K.mutateAsync({id:C.id,name:C.name.trim(),title:C.title||C.name,category:C.category||`general`,description:C.description||``,tags:C.tags||[],allowedTools:C.allowedTools||[],content:C.content}),e?.(`Skill package saved successfully`,`success`),p(!1),k(null)}catch(t){e?.(`Failed to save skill`,`error`),console.error(t)}},rt=(e,t)=>{t.stopPropagation(),R({type:`skill`,id:e.id,title:e.title||e.name}),I(!0)},it=async()=>{if(L)try{L.type===`category`?(await Je.mutateAsync(L.id),e?.(`Category deleted`,`info`)):(await Ye.mutateAsync(L.id),e?.(`Skill package deleted`,`info`)),I(!1),R(null)}catch(t){e?.(`Failed to delete item`,`error`),console.error(t)}},at=e=>{if(!J||!X||W===null)return;let t=new Set(W);t.has(e)?t.delete(e):t.add(e),G(Array.from(t))},ot=()=>{if(!C||C.custom!==!1)return;let e=`${C.name}-copy`;k({...C,id:void 0,name:e,title:`${C.title||C.name} Copy`,allowedTools:[],custom:!0,sourcePath:void 0,references:void 0,scripts:void 0}),A(!0)},st=(e,t)=>{if(!J||!X||W===null)return;let n=Ze[e]||[],r=new Set(W);for(let e of n)t?r.add(e.id):r.delete(e.id);G(Array.from(r))},ct=async()=>{if(!(!U||W===null||!J))try{await q.mutateAsync({workspaceId:t,expectedRevision:U.revision??0,enabledSkills:W,enabledAgents:U.enabledAgents??[],enabledCategories:V.map(e=>e.id)}),e?.(`Skill selection saved. Refresh the workspace to apply it.`,`success`)}catch(t){e?.(t instanceof Error?t.message:`Failed to save skill selection`,`error`)}},lt=(e,t)=>{e.dataTransfer.setData(`text/plain`,t),e.dataTransfer.effectAllowed=`move`,Be(t)},ut=(e,t)=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`,Ve!==t&&B(t)},dt=()=>{B(null)},ft=async(t,n)=>{t.preventDefault(),B(null);let r=t.dataTransfer.getData(`text/plain`)||z;if(Be(null),!r)return;let i=H.find(e=>e.id===r);!i||!i.custom||J||i.category===n||(await K.mutateAsync({id:i.id,name:i.name,title:i.title,description:i.description,tags:i.tags,allowedTools:i.allowedTools,content:i.content,category:n}),e?.(`Skill re-categorized`,`success`))},pt=(e,t)=>{t.stopPropagation(),F(e),N(!0)},mt=async t=>{if(!P||P.category===t){N(!1),F(null);return}await K.mutateAsync({id:P.id,name:P.name,title:P.title,description:P.description,tags:P.tags,allowedTools:P.allowedTools,content:P.content,category:t}),e?.(`Skill moved to category`,`success`),N(!1),F(null)};return(0,D.jsxs)(`div`,{className:`flex-1 flex flex-col h-full overflow-hidden bg-background text-foreground`,children:[(0,D.jsxs)(`div`,{className:`p-6 border-b border-border flex flex-col sm:flex-row sm:items-center justify-between gap-4 bg-card/40 backdrop-blur-sm`,children:[(0,D.jsx)(`div`,{children:(0,D.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,D.jsx)(`div`,{className:`p-2 rounded-xl bg-primary/10 text-primary`,children:(0,D.jsx)(h,{className:`h-6 w-6`})}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h1`,{className:`text-xl font-bold tracking-tight`,children:`Skill Library`}),(0,D.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Create, organize, and assign reusable Agent Skill packages.`})]})]})}),(0,D.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,D.jsx)(a,{render:(0,D.jsx)(he,{to:`/agents`}),variant:`outline`,size:`sm`,children:`Codex Agents`}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2 bg-muted/50 rounded-lg px-3 py-1.5 border border-border`,children:[(0,D.jsx)(fe,{className:`h-4 w-4 text-muted-foreground`}),(0,D.jsx)(T,{htmlFor:`skill-scope`,className:`text-xs font-medium text-muted-foreground`,children:`Scope:`}),(0,D.jsxs)(`select`,{id:`skill-scope`,value:t,onChange:e=>n(e.target.value),className:`bg-transparent text-xs font-semibold focus:outline-none cursor-pointer text-foreground`,children:[(0,D.jsx)(`option`,{value:`global`,className:`bg-popover text-popover-foreground`,children:`🌐 Global Skills Catalog`}),We.map(e=>(0,D.jsxs)(`option`,{value:e.id,className:`bg-popover text-popover-foreground`,children:[`📁 `,e.id,` (`,e.branchName,`)`]},e.id))]})]}),J&&(0,D.jsx)(a,{size:`sm`,onClick:ct,disabled:!X||q.isPending||W===null,children:q.isPending?`Saving…`:`Save selection`}),!J&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(a,{variant:`outline`,size:`sm`,onClick:()=>Qe(),className:`flex items-center gap-1.5`,children:[(0,D.jsx)(m,{className:`h-3.5 w-3.5`}),(0,D.jsx)(`span`,{children:`New Category`})]}),(0,D.jsxs)(a,{variant:`default`,size:`sm`,onClick:()=>$(),className:`flex items-center gap-1.5`,children:[(0,D.jsx)(ue,{className:`h-3.5 w-3.5`}),(0,D.jsx)(`span`,{children:`New Skill`})]})]})]})]}),(0,D.jsxs)(`div`,{className:`px-6 py-3 border-b border-border/60 bg-muted/20 flex items-center justify-between gap-4`,children:[(0,D.jsxs)(`div`,{className:`relative flex-1 max-w-md`,children:[(0,D.jsx)(de,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,D.jsx)(o,{value:r,onChange:e=>s(e.target.value),placeholder:`Search skills by keyword, tag, or tool...`,className:`pl-9 pr-8 h-9 text-xs`}),r&&(0,D.jsx)(`button`,{onClick:()=>s(``),className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,children:(0,D.jsx)(pe,{className:`h-3.5 w-3.5`})})]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,D.jsxs)(`span`,{children:[`Showing `,(0,D.jsx)(`strong`,{className:`text-foreground`,children:Z.length}),` of`,` `,(0,D.jsx)(`strong`,{className:`text-foreground`,children:H.length}),` skills`]}),J&&(0,D.jsxs)(w,{variant:`secondary`,className:`text-[10px] uppercase font-mono`,children:[`Workspace Mode (`,Y.size,` active)`]})]})]}),(0,D.jsx)(x,{className:`flex-1 p-6`,children:He||Ue||J&&Ge?(0,D.jsxs)(`div`,{className:`flex items-center justify-center p-12 gap-3 text-muted-foreground`,children:[(0,D.jsx)(be,{}),(0,D.jsx)(`span`,{className:`text-sm`,children:`Loading skills catalog...`})]}):J&&Ke?(0,D.jsx)(ke,{className:`py-12 border border-dashed rounded-xl`,children:(0,D.jsxs)(Oe,{children:[(0,D.jsx)(Te,{children:`Workspace resources could not be loaded`}),(0,D.jsx)(De,{children:`Assignment controls are disabled so an existing selection cannot be overwritten.`})]})}):Z.length===0&&r?(0,D.jsxs)(ke,{className:`py-12 border border-dashed rounded-xl`,children:[(0,D.jsx)(Ee,{children:(0,D.jsx)(de,{className:`h-8 w-8 text-muted-foreground/60`})}),(0,D.jsxs)(Oe,{children:[(0,D.jsx)(Te,{children:`No matching skills found`}),(0,D.jsxs)(De,{children:[`No skills matched your search query "`,r,`".`]})]}),(0,D.jsx)(a,{variant:`outline`,size:`sm`,onClick:()=>s(``),children:`Clear Search`})]}):(0,D.jsxs)(`div`,{className:`space-y-6 max-w-7xl mx-auto pb-12`,children:[V.map(e=>{let t=O[e.icon||`boxes`]||h,n=Ze[e.id]||[],r=!!ne[e.id],o=Ve===e.id,s=n.length>0&&n.every(e=>Y.has(e.id));return(0,D.jsxs)(`div`,{onDragOver:t=>ut(t,e.id),onDragLeave:dt,onDrop:t=>ft(t,e.id),className:i(`border rounded-xl transition-all duration-150 overflow-hidden bg-card/60`,o?`border-primary ring-2 ring-primary/20 bg-primary/5`:`border-border`),children:[(0,D.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":!r,onClick:()=>Xe(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),Xe(e.id))},className:`p-4 flex items-center justify-between cursor-pointer hover:bg-muted/40 transition-colors border-b border-border/40 select-none`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,D.jsx)(`div`,{className:`p-2 rounded-lg text-white shadow-sm flex items-center justify-center`,style:{backgroundColor:e.color||`#3b82f6`},children:(0,D.jsx)(t,{className:`h-4 w-4`})}),(0,D.jsxs)(`div`,{children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`h2`,{className:`font-semibold text-sm tracking-tight`,children:e.name}),(0,D.jsxs)(w,{variant:`outline`,className:`text-[10px] px-1.5 py-0`,children:[n.length,` `,n.length===1?`skill`:`skills`]}),e.isTemplate&&!e.custom&&(0,D.jsx)(w,{variant:`secondary`,className:`text-[9px] px-1 py-0 uppercase`,children:`Template`})]}),e.description&&(0,D.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:e.description})]})]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-1`,onClick:e=>e.stopPropagation(),children:[J&&n.length>0&&(0,D.jsxs)(a,{variant:`ghost`,size:`xs`,onClick:()=>st(e.id,!s),className:`h-7 text-xs mr-2 text-muted-foreground hover:text-foreground`,title:s?`Deselect all in category`:`Select all in category`,children:[s?(0,D.jsx)(re,{className:`h-3.5 w-3.5 mr-1 text-primary`}):(0,D.jsx)(ae,{className:`h-3.5 w-3.5 mr-1`}),(0,D.jsx)(`span`,{children:s?`Deselect All`:`Select All`})]}),!J&&(0,D.jsx)(a,{variant:`ghost`,size:`icon-xs`,onClick:()=>$(void 0,e.id),title:`Add skill to this category`,children:(0,D.jsx)(m,{className:`h-3.5 w-3.5`})}),!J&&(0,D.jsx)(a,{variant:`ghost`,size:`icon-xs`,onClick:()=>Qe(e),title:`Edit category`,children:(0,D.jsx)(Pe,{className:`h-3 w-3`})}),!J&&e.custom&&(0,D.jsx)(a,{variant:`ghost`,size:`icon-xs`,onClick:t=>et(e,t),title:`Delete category`,className:`text-destructive hover:text-destructive`,children:(0,D.jsx)(f,{className:`h-3 w-3`})}),(0,D.jsx)(`div`,{className:`p-1 text-muted-foreground`,children:r?(0,D.jsx)(oe,{className:`h-4 w-4`}):(0,D.jsx)(ee,{className:`h-4 w-4`})})]})]}),!r&&(0,D.jsx)(`div`,{className:`p-4 bg-background/50`,children:n.length===0?(0,D.jsxs)(`div`,{className:`border border-dashed border-border/80 rounded-lg p-6 text-center text-xs text-muted-foreground`,children:[`No skills in this category.`,!J&&(0,D.jsxs)(D.Fragment,{children:[` `,`Drag a custom skill here, or click`,` `,(0,D.jsx)(`button`,{onClick:()=>$(void 0,e.id),className:`text-primary underline font-medium`,children:`+ Add Skill`})]})]}):(0,D.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3.5`,children:n.map(e=>{let t=Y.has(e.id);return(0,D.jsxs)(we,{draggable:!J&&!!e.custom,onDragStart:t=>{!J&&e.custom&&lt(t,e.id)},onClick:()=>$(e),role:`button`,tabIndex:0,onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),$(e))},className:i(`group relative cursor-pointer hover:border-primary/60 transition-all p-3.5 flex flex-col justify-between select-none shadow-sm`,J&&!t&&`opacity-60 bg-muted/20`,z===e.id&&`opacity-40 border-dashed`),children:[(0,D.jsxs)(`div`,{children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mb-2`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground group-hover:text-foreground cursor-grab active:cursor-grabbing`,title:`Drag to reorder or re-categorize`,"aria-label":`Drag handle`,children:[(0,D.jsx)(Ne,{className:`h-3.5 w-3.5`}),(0,D.jsx)(`span`,{className:`font-mono text-xs font-bold text-foreground`,children:e.title||e.name})]}),J?(0,D.jsxs)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),at(e.id)},disabled:!X||q.isPending,className:i(`h-5 px-2 rounded-md flex items-center gap-1 text-[10px] font-semibold transition-colors`,t?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground hover:bg-muted/80`),children:[(0,D.jsx)(ve,{className:i(`h-3 w-3`,!t&&`opacity-0`)}),(0,D.jsx)(`span`,{children:t?`Enabled`:`Disabled`})]}):(0,D.jsx)(w,{variant:`outline`,className:`text-[10px] font-mono`,children:e.custom?`Custom`:`Template`})]}),(0,D.jsx)(`p`,{className:`text-xs text-muted-foreground line-clamp-2 mb-3 leading-relaxed`,children:e.description||`No description provided.`})]}),(0,D.jsxs)(`div`,{className:`pt-2 border-t border-border/40 flex items-center justify-between gap-2`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap overflow-hidden`,children:[e.tags?.slice(0,2).map(e=>(0,D.jsxs)(`span`,{className:`text-[10px] font-mono bg-muted px-1.5 py-0.5 rounded text-muted-foreground`,children:[`#`,e]},e)),e.allowedTools&&e.allowedTools.length>0&&(0,D.jsxs)(`span`,{className:`text-[10px] text-muted-foreground flex items-center gap-0.5 font-mono`,children:[(0,D.jsx)(Fe,{className:`h-2.5 w-2.5`}),e.allowedTools.length]})]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-1`,onClick:e=>e.stopPropagation(),children:[!J&&e.custom&&(0,D.jsx)(a,{variant:`ghost`,size:`icon-xs`,onClick:t=>pt(e,t),title:`Move to another category`,className:`h-6 w-6 text-muted-foreground hover:text-foreground`,children:(0,D.jsx)(je,{className:`h-3 w-3`})}),!J&&e.custom&&(0,D.jsx)(a,{variant:`ghost`,size:`icon-xs`,onClick:t=>rt(e,t),title:`Delete skill`,className:`h-6 w-6 text-destructive hover:text-destructive`,children:(0,D.jsx)(f,{className:`h-3 w-3`})})]})]})]},e.id)})})})]},e.id)}),Q.length>0&&(0,D.jsxs)(`div`,{className:`border border-border/80 rounded-xl overflow-hidden bg-card/60`,children:[(0,D.jsx)(`div`,{className:`p-4 bg-muted/30 border-b border-border/40 flex items-center justify-between`,children:(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(h,{className:`h-4 w-4 text-muted-foreground`}),(0,D.jsx)(`h2`,{className:`font-semibold text-sm`,children:`Uncategorized Skills`}),(0,D.jsx)(w,{variant:`outline`,className:`text-[10px]`,children:Q.length})]})}),(0,D.jsx)(`div`,{className:`p-4 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3.5`,children:Q.map(e=>(0,D.jsxs)(we,{onClick:()=>$(e),role:`button`,tabIndex:0,onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),$(e))},className:`p-3.5 cursor-pointer hover:border-primary/60`,children:[(0,D.jsxs)(`div`,{className:`mb-1 flex items-center justify-between gap-2`,children:[(0,D.jsx)(`div`,{className:`font-mono text-xs font-bold`,children:e.title||e.name}),J&&(0,D.jsx)(a,{size:`xs`,variant:Y.has(e.id)?`default`:`outline`,disabled:!X||q.isPending,onClick:t=>{t.stopPropagation(),at(e.id)},children:Y.has(e.id)?`Enabled`:`Disabled`})]}),(0,D.jsx)(`p`,{className:`text-xs text-muted-foreground line-clamp-2`,children:e.description})]},e.id))})]})]})}),(0,D.jsx)(b,{open:ie,onOpenChange:l,children:(0,D.jsxs)(_,{className:`sm:max-w-lg`,children:[(0,D.jsxs)(y,{children:[(0,D.jsx)(v,{children:u?.id?`Edit Skill Category`:`Create Skill Category`}),(0,D.jsx)(S,{children:`Categories group related procedural skills and agent tools into clean visual boxes.`})]}),(0,D.jsxs)(`div`,{className:`space-y-4 py-2`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(T,{htmlFor:`cat-name`,className:`text-xs font-medium`,children:`Category Name`}),(0,D.jsx)(o,{id:`cat-name`,value:u?.name||``,onChange:e=>d(t=>t?{...t,name:e.target.value}:null),placeholder:`e.g. Pull Requests & Review`,className:`mt-1 text-xs`})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(T,{htmlFor:`cat-desc`,className:`text-xs font-medium`,children:`Description`}),(0,D.jsx)(o,{id:`cat-desc`,value:u?.description||``,onChange:e=>d(t=>t?{...t,description:e.target.value}:null),placeholder:`Brief summary of what skills belong in this box...`,className:`mt-1 text-xs`})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(T,{className:`text-xs font-medium`,children:`Icon`}),(0,D.jsx)(`div`,{className:`grid grid-cols-6 gap-2 mt-1.5`,children:Object.keys(O).map(e=>{let t=O[e];return(0,D.jsx)(`button`,{type:`button`,onClick:()=>d(t=>t?{...t,icon:e}:null),className:i(`p-2.5 rounded-lg border flex items-center justify-center transition-colors`,(u?.icon||`boxes`)===e?`border-primary bg-primary/10 text-primary`:`border-border hover:bg-muted text-muted-foreground`),children:(0,D.jsx)(t,{className:`h-4 w-4`})},e)})})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(T,{className:`text-xs font-medium`,children:`Color Accent`}),(0,D.jsx)(`div`,{className:`flex items-center gap-2 mt-1.5 flex-wrap`,children:Ie.map(e=>{let t=u?.color===e.value;return(0,D.jsx)(`button`,{type:`button`,"aria-label":`Select color ${e.label}`,onClick:()=>d(t=>t?{...t,color:e.value}:null),className:i(`w-7 h-7 rounded-full transition-transform flex items-center justify-center shadow-sm`,t?`scale-110 ring-2 ring-primary ring-offset-2`:`hover:scale-105`),style:{backgroundColor:e.value},children:t&&(0,D.jsx)(ve,{className:`h-3.5 w-3.5 text-white`})},e.value)})})]})]}),(0,D.jsxs)(g,{children:[(0,D.jsx)(a,{variant:`outline`,size:`sm`,onClick:()=>l(!1),children:`Cancel`}),(0,D.jsx)(a,{variant:`default`,size:`sm`,onClick:$e,disabled:!u?.name?.trim(),children:`Save Category`})]})]})}),(0,D.jsx)(b,{open:se,onOpenChange:p,children:(0,D.jsxs)(_,{className:`sm:max-w-3xl max-h-[90vh] flex flex-col`,children:[(0,D.jsx)(y,{children:(0,D.jsxs)(`div`,{className:`flex items-center justify-between pr-6`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(v,{children:C?.id?`Edit Skill Package`:`Create New Skill`}),(0,D.jsx)(S,{children:`Configure SKILL.md metadata triggers and markdown playbook instructions.`})]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted/60 p-1 rounded-lg border border-border text-xs`,children:[(0,D.jsxs)(`button`,{type:`button`,onClick:()=>M(`edit`),className:i(`px-2.5 py-1 rounded-md flex items-center gap-1 font-medium transition-colors`,j===`edit`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:[(0,D.jsx)(te,{className:`h-3.5 w-3.5`}),(0,D.jsx)(`span`,{children:`Edit`})]}),(0,D.jsxs)(`button`,{type:`button`,onClick:()=>M(`preview`),className:i(`px-2.5 py-1 rounded-md flex items-center gap-1 font-medium transition-colors`,j===`preview`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:[(0,D.jsx)(Me,{className:`h-3.5 w-3.5`}),(0,D.jsx)(`span`,{children:`Preview`})]})]})]})}),(0,D.jsx)(x,{className:`flex-1 pr-4 py-2`,children:j===`edit`?(0,D.jsxs)(`div`,{className:`space-y-4`,children:[(0,D.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-4`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(T,{htmlFor:`skill-title`,className:`text-xs font-medium`,children:`Display Title`}),(0,D.jsx)(o,{id:`skill-title`,value:C?.title||``,onChange:e=>tt(e.target.value),placeholder:`e.g. Pull Request Reviewer`,className:`mt-1 text-xs`})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(T,{htmlFor:`skill-name`,className:`text-xs font-medium`,children:`Identifier (Slug)`}),(0,D.jsx)(o,{id:`skill-name`,value:C?.name||``,disabled:!!C?.id,onChange:e=>{A(!0),k(t=>t?{...t,name:e.target.value}:null)},placeholder:`e.g. pr-review-toolkit`,className:`mt-1 text-xs font-mono`})]})]}),(0,D.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-4`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(T,{htmlFor:`skill-cat`,className:`text-xs font-medium`,children:`Category Box`}),(0,D.jsx)(`select`,{id:`skill-cat`,value:C?.category||``,onChange:e=>k(t=>t?{...t,category:e.target.value}:null),className:`mt-1 w-full bg-background border border-border rounded-md px-3 py-2 text-xs focus:outline-none focus:ring-1 focus:ring-primary`,children:V.map(e=>(0,D.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(T,{htmlFor:`skill-tags`,className:`text-xs font-medium`,children:`Tags (comma separated)`}),(0,D.jsx)(o,{id:`skill-tags`,value:C?.tags?.join(`, `)||``,onChange:e=>k(t=>t?{...t,tags:e.target.value.split(`,`).map(e=>e.trim()).filter(Boolean)}:null),placeholder:`e.g. git, pr, quality`,className:`mt-1 text-xs font-mono`})]})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(T,{htmlFor:`skill-desc`,className:`text-xs font-medium`,children:`Trigger Description (for AI Autonomous Discovery)`}),(0,D.jsx)(o,{id:`skill-desc`,value:C?.description||``,onChange:e=>k(t=>t?{...t,description:e.target.value}:null),placeholder:`e.g. Use when reviewing PR diffs or when user asks for a PR audit...`,className:`mt-1 text-xs`})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(T,{htmlFor:`skill-content`,className:`text-xs font-medium`,children:`Playbook Instructions (Markdown)`}),(0,D.jsx)(Ae,{id:`skill-content`,value:C?.content||``,onChange:e=>k(t=>t?{...t,content:e.target.value}:null),rows:12,placeholder:`# Playbook Title
@@ -0,0 +1 @@
1
+ import{_ as e,b as t,g as n,h as r,m as i,t as a}from"./button-BDDZnIHx.js";import{o}from"./CSPContext-DBUu9tE0.js";import{t as s}from"./bot-C2HWrAft.js";import{t as c}from"./chevron-down-qTL8HPug.js";import{t as l}from"./code-xml-jFAa3-TT.js";import{n as u,r as d,t as f}from"./ScaffoldRepoInline-ywcpq9PX.js";import{t as p}from"./git-branch-Cfj9D8yW.js";import{t as m}from"./zap-CWG_Lvki.js";import{At as h,Bt as ee,Ct as g,D as _,Dt as v,E as y,Et as b,Ft as x,G as te,It as S,J as ne,Jt as C,Kt as re,L as w,M as ie,Nt as ae,O as oe,Ot as T,P as E,St as D,T as se,Tt as ce,Ut as O,Xt as k,Yt as A,Zt as le,a as j,ct as M,d as ue,et as de,f as N,it as fe,j as pe,jt as P,k as me,kt as he,l as F,n as ge,nt as _e,o as I,q as L,qt as ve,rt as R,s as z,t as B,tn as ye,u as V,zt as H}from"./index-C_rwnBzF.js";import{t as be}from"./badge-CAohJGj6.js";import{a as xe,i as Se,n as Ce,r as U,t as we}from"./empty-BdlgbifD.js";import{t as Te}from"./textarea-ByfoCb54.js";import{n as Ee,t as De}from"./vsc-DFh0-53h.js";var Oe=r(`app-window`,[[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}],[`path`,{d:`M10 4v4`,key:`pp8u80`}],[`path`,{d:`M2 8h20`,key:`d11cs7`}],[`path`,{d:`M6 4v4`,key:`1svtjw`}]]),W=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`}]]),ke=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`}]]),G=t(e(),1),Ae={status:`idle`,steps:[]};function je(){let[e,t]=(0,G.useState)(Ae),n=(0,G.useRef)(null),r=(0,G.useRef)(null),i=ye(),a=(0,G.useCallback)(()=>{n.current?.close(),n.current=null,r.current=null},[]);return(0,G.useEffect)(()=>a,[a]),{progress:e,start:(0,G.useCallback)(e=>{if(n.current&&r.current===e)return;a(),r.current=e,t({status:`running`,steps:[]});let o=new EventSource(`/api/workspace/create-stream/${encodeURIComponent(e)}`);n.current=o;let s=0;o.addEventListener(`progress`,r=>{if(n.current===o){s=0;try{let n=JSON.parse(r.data);t({status:n.status===`completed`||n.status===`failed`?n.status:`running`,steps:n.steps??[],error:n.error,workspacePath:n.workspacePath,workspaceId:n.feature?.id??e}),(n.status===`completed`||n.status===`failed`)&&(a(),i.invalidateQueries({queryKey:[`workspaces`]}),i.invalidateQueries({queryKey:[`workspaces-status`]}))}catch{}}}),o.onerror=()=>{n.current===o&&(s+=1,!(o.readyState!==EventSource.CLOSED&&s<5)&&(t(e=>e.status===`running`?{...e,status:`unavailable`,error:e.error??`Unable to reconnect to the creation stream. The workspace may still have been created.`}:e),a(),i.invalidateQueries({queryKey:[`workspaces`]}),i.invalidateQueries({queryKey:[`workspaces-status`]})))}},[a,i]),reset:(0,G.useCallback)(()=>{a(),t(Ae)},[a])}}var K=n(),Me=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,q={codex:P,claude:D,vscode:De,"vscode-insiders":Ee,cursor:g,antigravity:W,powershell:H,cmd:H,terminal:H,intellij:ce,webstorm:T,pycharm:b,sublime:v,zed:h,windsurf:he},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`,powershell:`bg-sky-700 text-white`,cmd:`bg-zinc-800 text-amber-400`,terminal:`bg-zinc-800 text-emerald-400`,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]??l;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 Ne({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":`Open workspace in ${e.name}`,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`,`cursor-pointer border-border bg-card hover:border-primary/40 hover:bg-accent/60`),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)(j,{className:`size-4`}):r?(0,K.jsx)(be,{size:`sm`,variant:`secondary`,children:`Preferred`}):null]}),(0,K.jsx)(`span`,{className:`mt-0.5 block text-xs leading-relaxed text-muted-foreground`,children:e.description})]})]})}function Pe({session:e,busy:t,launching:n,onResume:r}){let a=e.desktopHandoff.method===`direct`,o=a?`Codex Desktop`:`Claude Desktop`;return(0,K.jsxs)(`button`,{type:`button`,disabled:t,onClick:()=>r(e),"aria-label":a?`Resume ${e.title} in Codex Desktop`:`Move ${e.title} to Claude Desktop`,className:i(`flex min-h-20 w-full cursor-pointer items-center gap-3 rounded-xl border border-primary/25 bg-primary/5 p-3 text-left outline-none transition-colors`,`hover:border-primary/45 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:a?`codex`:`claude`}),(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:`truncate font-medium text-foreground`,title:e.title,children:e.title}),n?(0,K.jsx)(j,{className:`size-4 shrink-0`}):a?(0,K.jsx)(ve,{className:`size-4 shrink-0 text-muted-foreground`}):(0,K.jsx)(C,{className:`size-4 shrink-0 text-muted-foreground`})]}),(0,K.jsxs)(`span`,{className:`mt-0.5 block text-xs leading-relaxed text-muted-foreground`,children:[a?`Open this existing task in ${o}`:`Resume in Claude Code, then type /desktop`,` · `,new Date(e.updatedAt).toLocaleString()]})]})]})}function Fe({workspaceId:e,workspacePath:t,isVsCode:n=!1,className:r}){let[i,o]=(0,G.useState)(!1),[s,c]=(0,G.useState)(null),[l,u]=(0,G.useState)(null),[d,f]=(0,G.useState)(null),p=(0,G.useRef)(!1),m=R(),h=fe(e,i),ee=E().data?.config,g=m.data?.filter(e=>e.available)??[],_=g.filter(e=>e.kind===`ai-app`),v=ee?.defaultEditor?{code:`vscode`,"code-insiders":`vscode-insiders`,cursor:`cursor`,antigravity:`antigravity`,idea:`intellij`,webstorm:`webstorm`,charm:`pycharm`,subl:`sublime`,zed:`zed`,windsurf:`windsurf`}[ee.defaultEditor]:void 0,y=g.filter(e=>e.kind===`editor`).toSorted((e,t)=>Number(t.id===v)-Number(e.id===v)),b=new Set(g.map(e=>e.id)),x=(h.data??[]).filter(e=>e.desktopHandoff&&b.has(e.desktopHandoff.targetId)),te=n||g.length>0,S=async t=>{if(!p.current){p.current=!0,u(null),f(null),c(t.id);try{await M(`/api/workspace/${encodeURIComponent(e)}/launch`,{method:`POST`,body:JSON.stringify({targetId:t.id})}),o(!1)}catch(e){u(e instanceof Error?e.message:String(e)),await m.refetch()}finally{c(null),p.current=!1}}},ne=async t=>{if(!(p.current||!t.desktopHandoff||!Me.test(t.id))){p.current=!0,u(null),f(null),c(`session:${t.id}`);try{if(t.desktopHandoff.method===`guided`){await B(`claude --resume ${t.id}`),f(`Claude resume command copied. With a Claude subscription login, run it in this workspace, then type /desktop in Claude to move the session into Claude Desktop.`);return}await M(`/api/workspace/${encodeURIComponent(e)}/launch`,{method:`POST`,body:JSON.stringify({targetId:t.desktopHandoff.targetId,action:`resume`,sessionId:t.id})}),o(!1)}catch(e){u(e instanceof Error?e.message:String(e)),await Promise.all([m.refetch(),h.refetch()])}finally{c(null),p.current=!1}}},C=()=>{window.parent.postMessage({type:`openWorkspaceFolder`,workspacePath:t},`*`),o(!1)},re=()=>Promise.all([m.refetch(),h.refetch()]),w=m.isFetching||h.isFetching;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(a,{variant:`outline`,className:r,onClick:()=>o(!0),children:[(0,K.jsx)(ke,{}),`Open with…`]}),(0,K.jsx)(I,{open:i,onOpenChange:e=>{o(e),e||(u(null),f(null))},children:(0,K.jsxs)(ue,{className:`max-w-2xl`,"aria-busy":s!==null,children:[(0,K.jsxs)(F,{children:[(0,K.jsx)(N,{children:`Open workspace with…`}),(0,K.jsx)(z,{children:`Continue recent AI work or start in an installed coding app or editor. AI apps may use their own online services.`})]}),(0,K.jsxs)(V,{className:`space-y-5`,children:[l&&(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:l}),d&&(0,K.jsx)(`div`,{role:`status`,className:`rounded-lg border border-primary/25 bg-primary/5 px-3 py-2 text-sm text-foreground`,children:d}),h.isLoading?(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"aria-live":`polite`,children:[(0,K.jsx)(j,{className:`size-4`}),` Checking recent sessions…`]}):x.length>0?(0,K.jsxs)(`section`,{"aria-labelledby":`recent-sessions-heading`,children:[(0,K.jsx)(`h3`,{id:`recent-sessions-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Continue recent work`}),(0,K.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:x.map(e=>(0,K.jsx)(Pe,{session:e,busy:s!==null,launching:s===`session:${e.id}`,onResume:ne},`${e.assistant}:${e.id}`))})]}):h.isError?(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Recent sessions could not be checked. Starting new work is still available.`}):null,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:s!==null,onClick:C,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.`})]})]})]}),m.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)(j,{}),` Checking apps on this computer…`]}):m.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:m.error instanceof Error?m.error.message:`Could not check available apps.`}):(0,K.jsxs)(K.Fragment,{children:[_.length>0&&(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:_.map(e=>(0,K.jsx)(Ne,{target:e,busy:s!==null,launching:s===e.id,onLaunch:S},e.id))})]}),y.length>0&&(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:y.map(e=>(0,K.jsx)(Ne,{target:e,busy:s!==null,launching:s===e.id,preferred:e.id===v,onLaunch:S},e.id))})]}),!te&&(0,K.jsx)(we,{className:`rounded-xl border border-dashed py-8 md:p-8`,children:(0,K.jsxs)(U,{children:[(0,K.jsx)(Se,{variant:`icon`,children:(0,K.jsx)(Oe,{})}),(0,K.jsx)(xe,{className:`text-base`,children:`No compatible apps detected`}),(0,K.jsx)(Ce,{children:`Install a supported coding app or add its command to PATH, then recheck.`})]})})]}),(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-t border-border pt-3`,children:[(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,"aria-live":`polite`,children:w?`Checking recent sessions and apps…`:`Can’t find your app or session? Recheck detection.`}),(0,K.jsxs)(a,{size:`sm`,variant:`ghost`,onClick:()=>void re(),disabled:w||s!==null,children:[(0,K.jsx)(O,{className:w?`animate-spin`:``}),`Recheck`]})]})]})]})})]})}var Ie=`__ad-hoc__`,Le=new URLSearchParams(window.location.search).get(`env`)===`vscode`,Re=[{value:`in-place`,icon:m,title:`In-place`,body:`Work directly in the source repos. No branches or worktrees — fastest start.`},{value:`worktree`,icon:p,title:`Isolated worktrees`,body:`A feature branch and worktree per repo. Your source checkouts stay untouched.`}];function ze({repo:e,value:t,onChange:n,enabled:r}){let i=L(e.path,r),a=(0,G.useMemo)(()=>[...new Set([...i.data?.local??[],...i.data?.remote??[]])],[i.data]),s=`branches-${e.path.replace(/[^a-zA-Z0-9]/g,`-`)}`;return(0,K.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`w-40 shrink-0 truncate text-xs`,children:e.name}),(0,K.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,K.jsx)(`datalist`,{id:s,children:a.map(e=>(0,K.jsx)(`option`,{value:e},e))})]})}function Be({step:e}){return(0,K.jsxs)(`li`,{className:`flex items-center gap-3 py-2`,children:[(0,K.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,K.jsx)(k,{className:`size-3`}):e.status===`running`?(0,K.jsx)(j,{className:`size-3`}):e.status===`failed`?(0,K.jsx)(A,{className:`size-3`}):null}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`p`,{className:`text-sm font-medium`,children:e.name}),(0,K.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e.message})]})]})}function Ve(){let e=x(),[t,n]=S(),r=te(),l=ne(),p=ie(),m=_e(),h=de(),g=pe(),v=w(),{progress:b,start:C,reset:T}=je(),E=t.get(`job`),[D,ce]=(0,G.useState)(t.get(`project`)??Ie),[O,k]=(0,G.useState)(`in-place`),[A,ue]=(0,G.useState)(``),[N,fe]=(0,G.useState)(``),[P,he]=(0,G.useState)(``),[F,I]=(0,G.useState)([]),[L,ve]=(0,G.useState)(!1),[R,z]=(0,G.useState)([]),[B,ye]=(0,G.useState)([]),[V,H]=(0,G.useState)([]),[xe,Se]=(0,G.useState)(``),[Ce,U]=(0,G.useState)(``),[we,Ee]=(0,G.useState)(!1),[De,Oe]=(0,G.useState)(null),[W,ke]=(0,G.useState)({}),[Ae,Me]=(0,G.useState)(!1),[q,J]=(0,G.useState)(null);(0,G.useEffect)(()=>{E?C(E):T()},[E,T,C]);let Y=()=>{T(),n(e=>{let t=new URLSearchParams(e);return t.delete(`job`),t},{replace:!0})},Ne=()=>{let e=new URL(window.location.href);e.hash=`#/new`,window.location.replace(e.toString())},Pe=()=>{E&&C(E)},Ve=(0,G.useRef)(!1);(0,G.useEffect)(()=>{!Ve.current&&p.data&&(Ve.current=!0,z(p.data.filter(e=>e.detected).map(e=>e.name)))},[p.data]);let X=(0,G.useMemo)(()=>(r.data??[]).find(e=>e.id===D)??null,[r.data,D]),Z=(0,G.useMemo)(()=>X?X.repos.map(e=>({name:ge(e.path),path:e.path,defaultBranch:e.defaultBranch})):(l.data??[]).filter(e=>F.includes(e.path)),[X,l.data,F]),Q=O===`in-place`,He=(Q?N.trim().length>0:A.trim().length>0)&&Z.length>0&&P.trim().length>0,Ue=e=>{Se(e),Oe(null);let t=(m.data??[]).find(t=>t.id===e);U(t?.content??``)},We=async()=>{if(!P.trim()){J(`Describe what you are building first — the suggestion is based on it.`);return}J(null),Ee(!0);try{let e=await M(`/api/workspace/suggest-workflow`,{method:`POST`,body:JSON.stringify({description:P,repos:Z})});Se(e.suggestedWorkflowId),U(e.customInstructions),Oe(e.difficulty)}catch(e){J(e instanceof Error?e.message:String(e))}finally{Ee(!1)}},Ge=(0,G.useRef)(!1),Ke=async()=>{if(Ge.current||v.isPending||!He)return;Ge.current=!0,J(null);let e={mode:O,projectId:X?.id,...Q?{name:N.trim()}:{branchName:A.trim()},description:P.trim(),repos:Z.map(e=>({...e,existingBranch:!Q&&W[e.path]?.trim()?W[e.path].trim():void 0})),assistants:R,enabledSkills:B.length>0?B:void 0,enabledAgents:V.length>0?V:void 0,teamworkInstructions:Ce.trim()||void 0};try{let{jobId:t}=await v.mutateAsync(e);C(t),n(e=>{let n=new URLSearchParams(e);return n.set(`job`,t),n},{replace:!0})}catch(e){J(e instanceof Error?e.message:String(e))}finally{Ge.current=!1}},$=b.status===`idle`&&E?{status:`running`,steps:[]}:b;if($.status!==`idle`){let t=$.steps.find(e=>e.status===`failed`);return(0,K.jsxs)(`div`,{className:`mx-auto max-w-xl animate-fade-in`,children:[(0,K.jsx)(`h1`,{className:`text-xl font-semibold`,children:$.status===`running`?`Setting up your workspace…`:$.status===`completed`?`Workspace ready`:$.status===`failed`?`Workspace creation failed`:`Unable to reconnect to workspace setup`}),(0,K.jsx)(`ul`,{"aria-live":`polite`,"aria-relevant":`additions text`,className:`mt-6 divide-y divide-border rounded-xl border border-border bg-card px-4`,children:$.steps.length>0?$.steps.map(e=>(0,K.jsx)(Be,{step:e},e.id)):(0,K.jsxs)(`li`,{className:`flex items-center gap-3 py-3.5`,children:[(0,K.jsx)(`span`,{className:`flex size-6 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary`,children:(0,K.jsx)(j,{className:`size-3`})}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`p`,{className:`text-sm font-medium`,children:`Connecting to workspace setup…`}),(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Waiting for creation progress…`})]})]})}),($.status===`failed`||$.status===`unavailable`)&&(0,K.jsx)(`p`,{className:`mt-4 text-sm text-destructive-foreground`,children:t?.message??$.error??`Something went wrong.`}),$.status===`completed`&&$.workspacePath&&(0,K.jsx)(`p`,{className:`mt-4 truncate font-mono text-xs text-muted-foreground`,children:$.workspacePath}),q&&(0,K.jsx)(`p`,{className:`mt-2 text-sm text-destructive-foreground`,children:q}),(0,K.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:[$.status===`completed`&&$.workspaceId&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(a,{className:`w-full min-w-0 whitespace-normal sm:w-auto`,onClick:()=>e(`/workspaces/${encodeURIComponent($.workspaceId)}`),children:`Open workspace`}),$.workspacePath&&(0,K.jsx)(Fe,{workspaceId:$.workspaceId,workspacePath:$.workspacePath,isVsCode:Le,className:`w-full min-w-0 whitespace-normal sm:w-auto`})]}),$.status===`failed`&&(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(a,{variant:`default`,onClick:Y,children:`Back to form (edit & retry)`}),(0,K.jsx)(a,{variant:`outline`,onClick:Ne,children:`Start over (clear form)`})]}),$.status===`unavailable`&&(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(a,{variant:`default`,onClick:Pe,children:`Try reconnecting`}),(0,K.jsx)(a,{variant:`outline`,onClick:Y,children:`Back to form`})]}),$.status===`running`&&(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This can take a moment for large repositories.`}),(0,K.jsx)(a,{variant:`outline`,size:`sm`,onClick:Y,children:`Return to form`})]})]})]})}return(0,K.jsxs)(`div`,{className:`mx-auto max-w-xl animate-fade-in`,children:[(0,K.jsxs)(`header`,{className:`mb-6`,children:[(0,K.jsx)(`h1`,{className:`text-xl font-semibold`,children:`Start work`}),(0,K.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Pick where the work happens and how isolated it should be.`})]}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,K.jsxs)(`section`,{children:[(0,K.jsx)(`span`,{className:`mb-1.5 block text-sm font-medium`,children:`Project`}),(0,K.jsxs)(se,{value:D,onValueChange:e=>typeof e==`string`&&ce(e),children:[(0,K.jsx)(oe,{className:`w-full`,"aria-label":`Project`,children:(0,K.jsx)(me,{children:X?X.name:`Ad-hoc — pick repositories manually`})}),(0,K.jsxs)(_,{alignItemWithTrigger:!1,children:[(r.data??[]).map(e=>(0,K.jsx)(y,{value:e.id,children:e.name},e.id)),(0,K.jsx)(y,{value:Ie,children:`Ad-hoc — pick repositories manually`})]})]}),X?(0,K.jsx)(`ul`,{className:`mt-2 flex flex-col gap-0.5`,children:X.repos.map(e=>(0,K.jsx)(`li`,{className:`truncate font-mono text-xs text-muted-foreground`,children:e.path},e.path))}):(0,K.jsxs)(`div`,{className:`mt-2`,children:[(0,K.jsx)(u,{repos:l.data??[],selectedPaths:F,onToggle:e=>I(t=>t.includes(e.path)?t.filter(t=>t!==e.path):[...t,e.path]),loading:l.isLoading}),(0,K.jsx)(f,{onCreated:e=>I(t=>[...t,e.path])})]}),(r.data??[]).length===0&&!r.isLoading&&(0,K.jsxs)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:[`Tip: `,(0,K.jsx)(ae,{to:`/projects`,className:`text-primary hover:underline`,children:`register a project`}),` to skip repo picking next time.`]})]}),(0,K.jsxs)(`section`,{children:[(0,K.jsx)(`span`,{className:`mb-1.5 block text-sm font-medium`,children:`How do you want to work?`}),(0,K.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=O===`in-place`?`worktree`:`in-place`;k(t),document.getElementById(`mode-${t}`)?.focus()}},children:Re.map(e=>(0,K.jsxs)(`button`,{id:`mode-${e.value}`,type:`button`,role:`radio`,"aria-checked":O===e.value,tabIndex:O===e.value?0:-1,onClick:()=>k(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`,O===e.value?`border-primary bg-primary/5 ring-1 ring-primary`:`border-border bg-card hover:border-foreground/20`),children:[(0,K.jsx)(e.icon,{className:i(`size-4`,O===e.value?`text-primary`:`text-muted-foreground`)}),(0,K.jsx)(`p`,{className:`mt-2 text-sm font-semibold`,children:e.title}),(0,K.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e.body})]},e.value))})]}),(0,K.jsx)(`section`,{children:Q?(0,K.jsxs)(`label`,{className:`block`,children:[(0,K.jsx)(`span`,{className:`mb-1 block text-sm font-medium`,children:`Workspace name`}),(0,K.jsx)(o,{value:N,onChange:e=>fe(e.target.value),placeholder:`e.g. Fix invoice rounding`})]}):(0,K.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,K.jsxs)(`label`,{className:`block`,children:[(0,K.jsx)(`span`,{className:`mb-1 block text-sm font-medium`,children:`Feature branch`}),(0,K.jsx)(o,{value:A,onChange:e=>ue(e.target.value),placeholder:`e.g. feature/invoice-rounding`,className:`font-mono`})]}),Z.length>0&&(0,K.jsxs)(`details`,{className:`rounded-lg border border-border px-3 py-2`,onToggle:e=>Me(e.target.open),children:[(0,K.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-muted-foreground`,children:`Use an existing branch for specific repos (optional)`}),(0,K.jsx)(`div`,{className:`mt-2 flex flex-col gap-2`,children:Z.map(e=>(0,K.jsx)(ze,{repo:e,enabled:Ae,value:W[e.path]??``,onChange:t=>ke(n=>({...n,[e.path]:t}))},e.path))})]})]})}),(0,K.jsx)(`section`,{children:(0,K.jsxs)(`label`,{className:`block`,children:[(0,K.jsx)(`span`,{className:`mb-1 block text-sm font-medium`,children:`What are you building?`}),(0,K.jsx)(Te,{value:P,onChange:e=>he(e.target.value),placeholder:`A short description — your AI assistant reads this to plan the work.`,rows:3})]})}),(0,K.jsxs)(`section`,{className:`rounded-xl border border-border`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>ve(e=>!e),className:`flex w-full items-center justify-between px-4 py-3 text-sm font-medium hover:bg-accent`,"aria-expanded":L,children:[`Advanced`,(0,K.jsx)(c,{className:i(`size-4 text-muted-foreground transition-transform`,L&&`rotate-180`)})]}),L&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-4 border-t border-border p-4`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`mb-1.5 block text-sm font-medium`,children:`AI assistants`}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:(p.data??[]).map(e=>(0,K.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,K.jsx)(d,{checked:R.includes(e.name),onCheckedChange:()=>z(t=>t.includes(e.name)?t.filter(t=>t!==e.name):[...t,e.name])}),e.displayName]},e.name))})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between`,children:[(0,K.jsx)(`span`,{className:`text-sm font-medium`,children:`Teamwork strategy`}),(0,K.jsxs)(a,{size:`xs`,variant:`outline`,onClick:We,disabled:we,children:[we?(0,K.jsx)(j,{}):(0,K.jsx)(ee,{}),`Suggest with AI`]})]}),(0,K.jsxs)(se,{value:xe,onValueChange:e=>typeof e==`string`&&Ue(e),children:[(0,K.jsx)(oe,{className:`w-full`,"aria-label":`Teamwork strategy`,children:(0,K.jsx)(me,{children:(m.data??[]).find(e=>e.id===xe)?.name??`None`})}),(0,K.jsxs)(_,{alignItemWithTrigger:!1,children:[(0,K.jsx)(y,{value:``,children:`None`}),(m.data??[]).map(e=>(0,K.jsx)(y,{value:e.id,children:e.name},e.id))]})]}),De&&(0,K.jsxs)(`p`,{className:`mt-1.5 text-xs text-muted-foreground`,children:[`AI classified this task as `,(0,K.jsx)(`span`,{className:`font-medium`,children:De}),` difficulty.`]}),(0,K.jsx)(Te,{value:Ce,onChange:e=>U(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`})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between`,children:[(0,K.jsxs)(`span`,{className:`text-sm font-medium flex items-center gap-1.5`,children:[(0,K.jsx)(le,{className:`size-4 text-primary`}),`Agent Skills (`,B.length,` selected)`]}),(h.data??[]).length>0&&(0,K.jsx)(a,{type:`button`,size:`xs`,variant:`ghost`,onClick:()=>{let e=(h.data??[]).map(e=>e.id);ye(B.length===e.length?[]:e)},className:`text-xs text-muted-foreground hover:text-foreground h-6 px-2`,children:B.length===(h.data??[]).length&&(h.data??[]).length>0?`Deselect All`:`Select All`})]}),(0,K.jsx)(`div`,{className:`max-h-48 overflow-y-auto rounded-lg border border-border bg-card/50 p-2 space-y-1.5`,children:h.isLoading?(0,K.jsxs)(`div`,{className:`flex items-center justify-center p-4 gap-2 text-xs text-muted-foreground`,children:[(0,K.jsx)(j,{className:`size-3`}),`Loading skills...`]}):(h.data??[]).length===0?(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground p-2 text-center`,children:`No skills available in catalog.`}):(h.data??[]).map(e=>{let t=B.includes(e.id);return(0,K.jsxs)(`label`,{className:i(`flex items-center justify-between gap-2 rounded-md p-2 text-xs cursor-pointer border transition-colors`,t?`border-primary/50 bg-primary/5 text-foreground`:`border-transparent hover:bg-muted/50 text-muted-foreground`),children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,K.jsx)(d,{checked:t,onCheckedChange:()=>ye(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])}),(0,K.jsx)(`span`,{className:`font-mono font-medium truncate`,children:e.title||e.name})]}),(0,K.jsx)(be,{variant:`outline`,className:`text-[9px] px-1 py-0 shrink-0`,children:e.category})]},e.id)})})]}),(g.data??[]).length>0&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`mb-1.5 flex items-center justify-between`,children:(0,K.jsxs)(`span`,{className:`text-sm font-medium flex items-center gap-1.5`,children:[(0,K.jsx)(s,{className:`size-4 text-purple-400`}),`Codex Native Agents (`,V.length,` selected)`]})}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(g.data??[]).map(e=>{let t=V.includes(e.id);return(0,K.jsxs)(`label`,{className:i(`flex cursor-pointer items-center gap-2 rounded-lg border border-border px-3 py-1.5 text-xs`,t?`border-purple-500/60 bg-purple-500/5 text-foreground`:`text-muted-foreground hover:bg-muted/50`),children:[(0,K.jsx)(d,{checked:t,onCheckedChange:()=>H(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])}),(0,K.jsx)(`span`,{className:`font-mono`,children:e.name})]},e.id)})})]})]})]}),q&&(0,K.jsx)(`p`,{className:`text-sm text-destructive-foreground`,children:q}),(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-4 border-t border-border pt-4`,children:[(0,K.jsxs)(`p`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,K.jsx)(re,{className:`size-3.5`}),Z.length,` repositor`,Z.length===1?`y`:`ies`,` selected`]}),(0,K.jsxs)(a,{onClick:Ke,disabled:!He||v.isPending,children:[v.isPending?(0,K.jsx)(j,{}):null,Q?`Start working`:`Create workspace`]})]})]})]})}export{Ve as StartWorkPage};
@@ -1,3 +1,3 @@
1
- import{_ as e,g as t,h as n,m as r,t as i}from"./button-BDDZnIHx.js";import{o as a}from"./CSPContext-DBUu9tE0.js";import{t as o}from"./circle-plus-lmU1yNJd.js";import{t as s}from"./cpu-Cdwd84Jz.js";import{t as c}from"./trash-2-CtR35_eF.js";import{D as l,E as u,O as d,T as f,a as p,k as m,p as h}from"./index-CoNaATPd.js";import{t as g}from"./badge-CAohJGj6.js";import{t as _}from"./card-BKXzd_5L.js";import{a as v,i as y,n as b,r as x,t as S}from"./empty-BdlgbifD.js";import{t as C}from"./label-CG5exjag.js";import{t as w}from"./textarea-ByfoCb54.js";var T=n(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),E=n(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]);e();var D=t();function O(e){let{workflowTemplates:t,isEditingTemplate:n,setIsEditingTemplate:O,mgtTemplateName:k,setMgtTemplateName:A,mgtTemplateContent:j,setMgtTemplateContent:M,selectedMgtTemplateId:N,setSelectedMgtTemplateId:P,analysisResult:F,setAnalysisResult:I,showToast:L,handleAnalyzeTemplate:R,handleSaveTemplate:z,handleDeleteTemplate:B,aiAssistants:V,analyzingTemplate:H,mgtAnalysisComment:U,setMgtAnalysisComment:W,suggestedImprovement:G,setSuggestedImprovement:K,savingTemplate:q,deletingTemplate:J,selectedInspectAssistant:Y,setSelectedInspectAssistant:X}=e,Z=t.find(e=>e.id===N),Q=V.filter(e=>e.detected&&e.command),$=Q.find(e=>e.name===Y)?.displayName??`No Harness Found`;return(0,D.jsxs)(`div`,{className:`mx-auto max-w-6xl animate-fade-in`,children:[(0,D.jsxs)(`header`,{className:`mb-6`,children:[(0,D.jsx)(`h1`,{className:`text-xl font-semibold text-foreground`,children:`Team Collaboration Strategies`}),(0,D.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Predefine and review custom teamwork guidelines injected into workspaces' AGENTS.md files.`})]}),(0,D.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 text-left lg:grid-cols-12`,children:[(0,D.jsx)(`div`,{className:`flex flex-col gap-4 lg:col-span-4`,children:(0,D.jsxs)(_,{className:`rounded-xl p-5 shadow-sm`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,D.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Strategies`}),(0,D.jsxs)(i,{size:`sm`,onClick:()=>{O(!0),A(`New Strategy`),M(`# New Strategy
1
+ import{_ as e,g as t,h as n,m as r,t as i}from"./button-BDDZnIHx.js";import{o as a}from"./CSPContext-DBUu9tE0.js";import{t as o}from"./circle-plus-lmU1yNJd.js";import{t as s}from"./cpu-Cdwd84Jz.js";import{t as c}from"./trash-2-CtR35_eF.js";import{D as l,E as u,O as d,T as f,a as p,k as m,p as h}from"./index-C_rwnBzF.js";import{t as g}from"./badge-CAohJGj6.js";import{t as _}from"./card-BKXzd_5L.js";import{a as v,i as y,n as b,r as x,t as S}from"./empty-BdlgbifD.js";import{t as C}from"./label-CG5exjag.js";import{t as w}from"./textarea-ByfoCb54.js";var T=n(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),E=n(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]);e();var D=t();function O(e){let{workflowTemplates:t,isEditingTemplate:n,setIsEditingTemplate:O,mgtTemplateName:k,setMgtTemplateName:A,mgtTemplateContent:j,setMgtTemplateContent:M,selectedMgtTemplateId:N,setSelectedMgtTemplateId:P,analysisResult:F,setAnalysisResult:I,showToast:L,handleAnalyzeTemplate:R,handleSaveTemplate:z,handleDeleteTemplate:B,aiAssistants:V,analyzingTemplate:H,mgtAnalysisComment:U,setMgtAnalysisComment:W,suggestedImprovement:G,setSuggestedImprovement:K,savingTemplate:q,deletingTemplate:J,selectedInspectAssistant:Y,setSelectedInspectAssistant:X}=e,Z=t.find(e=>e.id===N),Q=V.filter(e=>e.detected&&e.command),$=Q.find(e=>e.name===Y)?.displayName??`No Harness Found`;return(0,D.jsxs)(`div`,{className:`mx-auto max-w-6xl animate-fade-in`,children:[(0,D.jsxs)(`header`,{className:`mb-6`,children:[(0,D.jsx)(`h1`,{className:`text-xl font-semibold text-foreground`,children:`Team Collaboration Strategies`}),(0,D.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Predefine and review custom teamwork guidelines injected into workspaces' AGENTS.md files.`})]}),(0,D.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 text-left lg:grid-cols-12`,children:[(0,D.jsx)(`div`,{className:`flex flex-col gap-4 lg:col-span-4`,children:(0,D.jsxs)(_,{className:`rounded-xl p-5 shadow-sm`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,D.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Strategies`}),(0,D.jsxs)(i,{size:`sm`,onClick:()=>{O(!0),A(`New Strategy`),M(`# New Strategy
2
2
 
3
3
  Write custom teamwork rules here for subagent orchestration...`),P(null),I(null)},children:[(0,D.jsx)(o,{size:12}),` Add New`]})]}),(0,D.jsx)(h,{className:`mt-4 max-h-[480px]`,children:(0,D.jsx)(`div`,{className:`flex flex-col gap-2 pr-1`,children:t.map(e=>{let t=N===e.id;return(0,D.jsxs)(`div`,{className:r(`flex cursor-pointer flex-col gap-1.5 rounded-lg border p-3 text-left transition-colors`,t?`border-primary bg-primary/5 ring-1 ring-primary/40`:`border-border bg-card hover:border-foreground/15 hover:bg-muted/40`),onClick:()=>{P(e.id),O(!1),A(e.name),M(e.content),I(null)},children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,D.jsx)(`span`,{className:r(`text-xs font-semibold`,t?`text-primary`:`text-foreground`),children:e.name}),(0,D.jsx)(g,{variant:e.custom?`info`:`secondary`,size:`sm`,className:`font-mono uppercase`,children:e.custom?`Custom`:`Built-in`})]}),(0,D.jsx)(`p`,{className:`line-clamp-2 text-xs leading-relaxed text-muted-foreground`,children:e.description})]},e.id)})})})]})}),(0,D.jsx)(`div`,{className:`flex flex-col gap-6 lg:col-span-8`,children:N||n?(0,D.jsxs)(_,{className:`flex flex-col gap-5 rounded-xl p-6 shadow-sm`,children:[(0,D.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,D.jsx)(`div`,{className:`flex-1`,children:n?(0,D.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,D.jsx)(C,{className:`text-sm`,children:`Strategy Name`}),(0,D.jsx)(a,{type:`text`,value:k,onChange:e=>A(e.target.value),placeholder:`e.g. Test-Driven Development`})]}):(0,D.jsxs)(`div`,{children:[(0,D.jsxs)(`h2`,{className:`flex items-center gap-2 text-lg font-semibold text-foreground`,children:[k,Z?.custom&&(0,D.jsx)(g,{variant:`info`,className:`font-mono uppercase`,children:`Custom Template`})]}),(0,D.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:Z?.description||`Custom strategy template.`})]})}),(0,D.jsx)(`div`,{className:`flex gap-2`,children:n?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(i,{variant:`outline`,size:`sm`,onClick:()=>{if(N){let e=t.find(e=>e.id===N);e&&(A(e.name),M(e.content)),O(!1)}else if(O(!1),t.length>0){let e=t[0];P(e.id),A(e.name),M(e.content)}},children:`Cancel`}),(0,D.jsx)(i,{size:`sm`,onClick:z,disabled:q,children:q?`Saving...`:`Save Strategy`})]}):(0,D.jsxs)(D.Fragment,{children:[Z?.custom&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(i,{variant:`outline`,size:`sm`,onClick:()=>O(!0),children:`Edit`}),(0,D.jsxs)(i,{variant:`destructive`,size:`sm`,onClick:()=>B(N),disabled:J,children:[(0,D.jsx)(c,{size:12}),` Delete`]})]}),!Z?.custom&&(0,D.jsx)(i,{variant:`outline`,size:`sm`,onClick:()=>{O(!0),A(`${k} Copy`),M(j),P(null),I(null)},children:`Duplicate & Customize`})]})})]}),(0,D.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,D.jsx)(C,{className:`text-sm`,children:`Guidelines Markdown`}),(0,D.jsx)(w,{className:`min-h-[250px] font-mono text-xs leading-relaxed`,value:j,onChange:e=>M(e.target.value),disabled:!n,placeholder:`Write cooperation guidelines in Markdown...`})]}),!n&&N&&(0,D.jsxs)(`div`,{className:`flex flex-col gap-4 border-t border-border pt-5`,children:[(0,D.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,D.jsxs)(`div`,{className:`flex flex-col items-start justify-between gap-4 sm:flex-row sm:items-center`,children:[(0,D.jsxs)(`div`,{className:`flex flex-col`,children:[(0,D.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold text-foreground`,children:[(0,D.jsx)(s,{size:14,className:`text-muted-foreground`}),` AI Strategy Analysis`]}),(0,D.jsx)(`span`,{className:`mt-0.5 text-xs text-muted-foreground`,children:`Select an AI assistant harness installed on your system to inspect these guidelines.`})]}),(0,D.jsxs)(`div`,{className:`flex w-full items-center justify-end gap-3 sm:w-auto`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Harness:`}),(0,D.jsxs)(f,{value:Y,disabled:Q.length===0,onValueChange:e=>typeof e==`string`&&X(e),children:[(0,D.jsx)(d,{size:`sm`,className:`w-44`,"aria-label":`Harness`,children:(0,D.jsx)(m,{children:$})}),(0,D.jsx)(l,{alignItemWithTrigger:!1,children:Q.length>0?Q.map(e=>(0,D.jsx)(u,{value:e.name,children:e.displayName},e.name)):(0,D.jsx)(u,{value:``,children:`No Harness Found`})})]})]}),(0,D.jsx)(i,{size:`sm`,onClick:()=>R(N,j,Y),disabled:H||Q.length===0,children:H?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(p,{className:`size-3`}),` Inspecting...`]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(s,{size:12}),` Inspect Strategy`]})})]})]}),(0,D.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,D.jsx)(C,{className:`text-left text-xs uppercase tracking-wider text-muted-foreground`,children:`Evaluation Focus / Instructions (Optional)`}),(0,D.jsx)(w,{className:`min-h-[60px] text-xs leading-relaxed`,value:U,onChange:e=>W(e.target.value),placeholder:`e.g. Focus on checking if timeouts are handled well, check subagent roles coordination...`,disabled:H})]})]}),F&&(0,D.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,D.jsx)(h,{className:`max-h-[300px] rounded-xl border border-border bg-muted/40 p-5`,children:(0,D.jsx)(`div`,{className:`select-text whitespace-pre-wrap text-left text-xs leading-relaxed text-foreground`,children:F})}),G&&(0,D.jsx)(`div`,{className:`flex justify-end`,children:(0,D.jsxs)(i,{size:`sm`,onClick:()=>{M(G),O(!0),K(null),I(null),L(`Suggested improvements applied! Click Save to persist changes.`,`success`)},children:[(0,D.jsx)(T,{size:14}),` Apply Suggested Improvements`]})})]})]})]}):(0,D.jsx)(`div`,{className:`flex min-h-[400px] flex-col items-center justify-center`,children:(0,D.jsx)(S,{className:`w-full max-w-md border border-dashed border-border`,children:(0,D.jsxs)(x,{children:[(0,D.jsx)(y,{variant:`icon`,children:(0,D.jsx)(E,{})}),(0,D.jsx)(v,{children:`No strategy template selected`}),(0,D.jsx)(b,{children:`Select a template from the list to view, edit, or analyze it, or add a new custom teamwork workflow template.`})]})})})})]})]})}export{O as StrategiesPage};
@@ -1,4 +1,4 @@
1
- import{_ as e,b as t,c 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,v as p}from"./button-BDDZnIHx.js";import{$n as m,$t as h,A as g,B as _,Bt as v,C as y,D as b,E as x,En as S,Et as C,F as w,Fn as T,H as E,Hn as D,I as O,K as k,L as A,M as j,Mn as M,N,O as P,P as F,Q as I,Qn as ee,Qt as L,R as te,Rn as ne,S as R,St as re,T as z,Tt as ie,U as ae,Un as B,V as oe,Vt as se,Xt as ce,Z as V,Zn as H,_ as le,at as ue,b as de,bt as fe,ct as pe,dn as me,en as U,er as he,et as ge,ft as _e,g as ve,h as W,hn as ye,in as be,it as G,j as xe,k as Se,kt as Ce,lt as K,mn as q,nr as we,nt as Te,o as Ee,pn as J,qn as De,rn as Oe,rt as ke,t as Ae,tn as je,tr as Me,tt as Ne,un as Pe,v as Fe,wt as Ie,x as Le,xt as Re,y as ze,z as Be,zn as Ve,zt as He}from"./CSPContext-DBUu9tE0.js";import{t as Ue}from"./bot-C2HWrAft.js";import{t as We}from"./chevron-down-qTL8HPug.js";import{a as Ge,c as Ke,i as qe,l as Je,n as Ye,o as Xe,r as Ze,s as Qe,t as $e,u as et}from"./square-DlIYnlSq.js";import{t as tt}from"./code-xml-jFAa3-TT.js";import{t as nt}from"./cpu-Cdwd84Jz.js";import{t as rt}from"./trash-2-CtR35_eF.js";import{t as it}from"./zap-CWG_Lvki.js";import{_ as at,a as ot,c as st,d as ct,f as lt,l as ut,n as dt,o as ft,s as pt,t as mt,u as ht,x as gt,y as _t}from"./isElementDisabled-uy_EOitH.js";import{$ as vt,$t as yt,A as bt,Bt as xt,Ft as St,Gt as Ct,Ht as wt,Jt as Tt,K as Et,Kt as Dt,Lt as Ot,M as kt,N as At,Nt as jt,Pt as Mt,Q as Nt,Qt as Pt,Rt as Ft,St as It,U as Lt,Ut as Rt,W as zt,Wt as Bt,Xt as Y,Zt as Vt,_t as Ht,a as X,at as Ut,bt as Wt,ct as Gt,d as Kt,dt as qt,et as Jt,f as Yt,ft as Xt,gt as Zt,ht as Qt,i as $t,j as en,jt as tn,l as nn,lt as rn,mt as an,n as on,o as sn,ot as cn,pt as ln,qt as un,r as dn,rt as fn,t as pn,u as mn,ut as Z,vt as hn,w as gn,wt as _n,xt as vn,yt as yn,zt as bn}from"./index-CoNaATPd.js";import{t as xn}from"./badge-CAohJGj6.js";import{t as Sn}from"./card-BKXzd_5L.js";import{a as Cn,i as wn,n as Tn,r as En,t as Dn}from"./empty-BdlgbifD.js";import{t as On}from"./textarea-ByfoCb54.js";import{n as kn,t as An}from"./vsc-BTST_4ex.js";var jn=a(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),Mn=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`}]]),Nn=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`}]]),Pn=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`}]]),Fn=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`}]]),In=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`}]]),Ln=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`}]]),Rn=a(`puzzle`,[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]),zn=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`}]]),Bn=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`}]]),Vn=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`}]]),Hn=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`}]]),Un=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`}]]),Q=t(e(),1);function Wn(){let[,e]=Q.useState({});return Q.useCallback(()=>{e({})},[])}function Gn(e){let t=ye(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=S(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r;return(_t(n)!==a||_t(r)!==o)&&(n=a,r=o),{width:n,height:r}}function Kn(e){let{popupElement:t,positionerElement:r,content:i,mounted:a,onMeasureLayout:o,onMeasureLayoutComplete:c,side:l,direction:u}=e,d=h(t,!0,!1),f=je(),p=Q.useRef(null),m=Q.useRef(!0),g=Q.useRef(s),_=q(o),v=q(c),y=Q.useMemo(()=>{let e=l===`top`,t=l===`left`;return u===`rtl`?(e||=l===`inline-end`,t||=l===`inline-end`):(e||=l===`inline-start`,t||=l===`inline-start`),e?{position:`absolute`,[l===`top`?`bottom`:`top`]:`0`,[t?`right`:`left`]:`0`}:n},[l,u]);J(()=>{if(!a){g.current=s,m.current=!0,p.current=null;return}if(!t||!r)return;g.current=Jn(t,y),Yn(t,`auto`);let e=qn(t,`position`,`static`),n=qn(t,`transform`,`none`),i=qn(t,`scale`,`1`),o=Jn(r,{"--available-width":`max-content`,"--available-height":`max-content`});function c(){e(),n(),o()}function l(){c(),i()}if(_?.(),m.current||p.current===null){Xn(r,`max-content`);let e=Gn(t);return p.current=e,Xn(r,e),l(),v?.(null,e),m.current=!1,()=>{g.current(),g.current=s}}Xn(r,`max-content`);let u=p.current,h=Gn(t);p.current=h,Yn(t,u),l(),v?.(u,h),Xn(r,h);let b=new AbortController;return f.request(()=>{Yn(t,h),d(()=>{t.style.setProperty(`--popup-width`,`auto`),t.style.setProperty(`--popup-height`,`auto`)},b.signal)}),()=>{b.abort(),f.cancel(),g.current(),g.current=s}},[i,t,r,d,f,a,_,v,y])}function qn(e,t,n){let r=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{e.style.setProperty(t,r)}}function Jn(e,t){let n=[];for(let[r,i]of Object.entries(t))n.push(qn(e,r,i));return n.length?()=>{n.forEach(e=>e())}:s}function Yn(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 Xn(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)}var Zn=t(we(),1),$=i();function Qn(e){let{store:t,side:n,cssVars:r,children:i}=e,a=ve(),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=dt(c?o:null),m=nr(s,l),g=Q.useRef(null),[_,v]=Q.useState(null),[y,b]=Q.useState(null),x=Q.useRef(null),S=Q.useRef(null),C=h(x,!0,!1),w=je(),[T,E]=Q.useState(null),[D,O]=Q.useState(!1);J(()=>(t.set(`hasViewport`,!0),()=>{t.set(`hasViewport`,!1)}),[t]);let k=q(()=>{x.current?.style.setProperty(`animation`,`none`),x.current?.style.setProperty(`transition`,`none`),S.current?.style.setProperty(`display`,`none`)}),A=q(e=>{x.current?.style.removeProperty(`animation`),x.current?.style.removeProperty(`transition`),S.current?.style.removeProperty(`display`),e&&E(e)}),j=Q.useRef(null);J(()=>{(!c||!u)&&(j.current=null)},[c,u]),J(()=>{if(o&&p&&o!==p&&j.current!==o&&g.current){v(g.current),O(!0);let e=tr(p,o);b(e),w.request(()=>{Zn.flushSync(()=>{O(!1)}),C(()=>{v(null),E(null),g.current=null})}),j.current=o}},[o,p,_,C,w]),J(()=>{let e=x.current;if(!e)return;let t=Ce(e).createElement(`div`);for(let n of Array.from(e.childNodes))t.appendChild(n.cloneNode(!0));g.current=t});let M=_!=null,N;N=M?(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(`div`,{"data-previous":!0,inert:le(!0),ref:S,style:{...T?{[r.popupWidth]:`${T.width}px`,[r.popupHeight]:`${T.height}px`}:null,position:`absolute`},"data-ending-style":D?void 0:``},`previous`),(0,$.jsx)(`div`,{"data-current":!0,ref:x,"data-starting-style":D?``:void 0,children:i},m)]}):(0,$.jsx)(`div`,{"data-current":!0,ref:x,children:i},m),J(()=>{let e=S.current;!e||!_||e.replaceChildren(...Array.from(_.childNodes))},[_]),Kn({popupElement:d,positionerElement:f,mounted:u,content:l,onMeasureLayout:k,onMeasureLayoutComplete:A,side:n,direction:a});let P={activationDirection:$n(y),transitioning:M};return{children:N,state:P}}function $n(e){if(e)return`${er(e.horizontal,5,`right`,`left`)} ${er(e.vertical,5,`down`,`up`)}`}function er(e,t,n,r){return e>t?n:e<-t?r:``}function tr(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 nr(e,t){let[n,r]=Q.useState(0),i=Q.useRef(e),a=Q.useRef(t),o=Q.useRef(!1);return J(()=>{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 rr=Q.createContext(void 0);function ir(){let e=Q.useContext(rr);if(e===void 0)throw Error(u(64));return e}var ar=function(e){return e.activationDirection=`data-activation-direction`,e.orientation=`data-orientation`,e}({}),or={tabActivationDirection:e=>({[ar.activationDirection]:e})},sr=Q.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=Q.useRef([]),[p,m]=Q.useState(()=>new Map),[h,g]=M({controlled:c,default:r,name:`Tabs`,state:`value`}),_=c!==void 0,[v,y]=Q.useState(()=>new Map),b=Q.useRef(void 0),x=Q.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,C]=Q.useState(()=>({previousValue:h,tabActivationDirection:`none`})),{previousValue:w,tabActivationDirection:E}=S,O=E,k=!1;w!==h&&(O=cr(w,h,a,v),k=w!=null&&h!=null&&x(h)==null);let A=k?w:h,j=w!==A||E!==O;J(()=>{j&&C({previousValue:A,tabActivationDirection:O})},[A,j,O]);let N=q((e,t)=>{t.activationDirection=cr(h,e,a,v),i?.(e,t),!t.isCanceled&&g(e)}),P=q((e,t)=>{i?.(e,Oe(t,void 0,void 0,{activationDirection:`none`}))}),F=q((e,t)=>{m(n=>{if(n.get(e)===t)return n;let r=new Map(n);return r.set(e,t),r})}),I=q((e,t)=>{m(n=>{if(!n.has(e)||n.get(e)!==t)return n;let r=new Map(n);return r.delete(e),r})}),ee=Q.useCallback(e=>p.get(e),[p]),L=Q.useCallback(e=>{for(let t of v.values())if(e===t?.value)return t?.id},[v]),te=Q.useMemo(()=>({getTabElementBySelectedValue:x,getTabIdByPanelValue:L,getTabPanelIdByValue:ee,onValueChange:N,orientation:a,registerMountedTabPanel:F,setTabMap:y,unregisterMountedTabPanel:I,tabActivationDirection:O,value:h}),[x,L,ee,N,a,F,y,I,O,h]),ne=Q.useMemo(()=>{for(let e of v.values())if(e!=null&&e.value===h)return e},[v,h]),R=Q.useMemo(()=>{for(let e of v.values())if(e!=null&&!e.disabled)return e.value},[v]),re=Q.useRef(!d),z=Q.useRef(r),ie=Q.useRef(d),ae=Q.useRef(!1);J(()=>{if(_)return;function e(e,t){g(e),C(t=>t.previousValue===e&&t.tabActivationDirection===`none`?t:{previousValue:e,tabActivationDirection:`none`}),P(e,t),re.current=!1}if(v.size===0){ae.current&&h!==null&&!b.current?.isConnected&&e(null,D);return}ae.current=!0,b.current=v.keys().next().value;let t=ne?.disabled,n=ne==null&&h!==null;if(!t&&h===z.current&&(ie.current=!1),ie.current&&t&&h===z.current)return;let r=re.current;if(t||n){let n=R??null;if(h===n){re.current=!1;return}let i=D;r?i=Ve:t&&(i=T),e(n,i);return}r&&ne!=null&&(P(h,Ve),re.current=!1)},[R,_,P,ne,g,v,h]);let B=o(`div`,e,{state:{orientation:a,tabActivationDirection:O},ref:t,props:u,stateAttributesMapping:or});return(0,$.jsx)(rr.Provider,{value:te,children:(0,$.jsx)(st,{elementsRef:f,children:B})})});function cr(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 lr=`data-composite-item-active`,ur=Q.createContext(void 0);function dr(){let e=Q.useContext(ur);if(e===void 0)throw Error(u(65));return e}var fr=Q.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}=ir(),{activateOnFocus:h,highlightedTabIndex:g,onTabActivation:_,registerTabResizeObserverElement:y,setHighlightedTabIndex:b,tabsListElement:x}=dr(),S=be(s),{compositeProps:C,compositeRef:w,index:T}=an({metadata:Q.useMemo(()=>({disabled:r,id:S,value:a}),[r,S,a])}),E=a===d,D=Q.useRef(!1),O=Q.useRef(null);J(()=>{let e=O.current;if(e)return y(e)},[y]),J(()=>{if(D.current){D.current=!1;return}if(!(E&&T>-1&&g!==T))return;let e=x;if(e!=null){let t=He(Ce(e));if(t&&v(e,t))return}r||b(T)},[E,T,g,b,r,x]);let{getButtonProps:k,buttonRef:A}=Pe({disabled:r,native:c,focusableWhenDisabled:!0}),j=f(a),M=Q.useRef(!1),N=Q.useRef(!1);function P(e){E||r||_(a,Oe(B,e.nativeEvent,void 0,{activationDirection:`none`}))}function F(e){E||(T>-1&&!r&&b(T),!r&&h&&(!M.current||M.current&&N.current)&&_(a,Oe(B,e.nativeEvent,void 0,{activationDirection:`none`})))}function I(e){if(E||r)return;M.current=!0;function t(){M.current=!1,N.current=!1}(!e.button||e.button===0)&&(N.current=!0,Ce(e.currentTarget).addEventListener(`pointerup`,t,{once:!0}))}return o(`button`,e,{state:{disabled:r,active:E,orientation:p,tabActivationDirection:m},ref:[t,A,w,O],props:[C,{role:`tab`,"aria-controls":j,"aria-selected":E,id:S,onClick:P,onFocus:F,onPointerDown:I,[lr]:E?``:void 0,onKeyDownCapture(){D.current=!0}},u,k],stateAttributesMapping:or})}),pr=V();function mr(){return s}function hr(){return!1}function gr(){return!0}function _r(){return(0,pr.useSyncExternalStore)(mr,hr,gr)}var vr=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}({}),yr={...or,activeTabPosition:()=>null,activeTabSize:()=>null},br=Q.forwardRef(function(e,t){let{className:n,render:r,renderBeforeHydration:i=!1,style:a,...s}=e,{nonce:c}=Ae(),{getTabElementBySelectedValue:l,orientation:u,tabActivationDirection:d,value:f}=ir(),{tabsListElement:p,registerIndicatorUpdateListener:m}=dr(),h=_r(),g=Wn();Q.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}=Gn(e),{width:r,height:i}=Gn(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?{[vr.activeTabLeft]:`${_}px`,[vr.activeTabRight]:`${v}px`,[vr.activeTabTop]:`${y}px`,[vr.activeTabBottom]:`${b}px`,[vr.activeTabWidth]:`${x}px`,[vr.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:yr});return f==null?null:(0,$.jsxs)(Q.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})]})}),xr=function(e){return e.index=`data-index`,e.activationDirection=`data-activation-direction`,e.orientation=`data-orientation`,e.hidden=`data-hidden`,e[e.startingStyle=he.startingStyle]=`startingStyle`,e[e.endingStyle=he.endingStyle]=`endingStyle`,e}({}),Sr={...or,...Me},Cr=Q.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}=ir(),h=be(),{ref:g,index:_}=gt({metadata:Q.useMemo(()=>({id:h,value:r}),[h,r])}),v=r===l,{mounted:y,transitionStatus:b,setMounted:x}=U(v),S=!y,C=u(r),w={hidden:S,orientation:d,tabActivationDirection:f,transitionStatus:b},T=Q.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:le(!v),[xr.index]:_},c],stateAttributesMapping:Sr});return L({open:v,ref:T,onComplete(){v||x(!1)}}),J(()=>{if(!(S&&!a)&&h!=null)return p(r,h),()=>{m(r,h)}},[S,a,r,h,p,m]),a||y?E:null}),wr=[];function Tr(e){let{loopFocus:t=!0,orientation:n=`both`,grid:i,onLoop:a,direction:o,highlightedIndex:s,onHighlightedIndexChange:c,rootRef:l,enableHomeAndEndKeys:u=!1,stopEventPropagation:d=!1,disabledIndices:f,modifierKeys:p=wr}=e,[m,h]=Q.useState(0),_=i!=null,v=Q.useRef(null),b=r(v,l),S=Q.useRef([]),C=Q.useRef(!1),w=s??m,T=q((e,t=!1)=>{if((c??h)(e),t){let t=S.current[e];xe(v.current,t,o,n)}}),E=q(e=>{if(e.size===0||C.current)return;C.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)T(i);else if(ie(t,w,f)){let e=fe(t,{disabledIndices:f});Ie(t,e)||T(e)}xe(v.current,r,o,n)});J(()=>{if(f==null||s!=null||!C.current)return;let e=S.current;if(ie(e,w,f)){let t=fe(e,{disabledIndices:f});Ie(e,t)||T(t)}},[f,s,w,S,T]);let D=q((e,t,n)=>a?a(e,t,n,S):n),O=q(e=>{let r=u?y:ze;if(!r.has(e.key)||Er(e,p)||!v.current)return;let s=o===`rtl`,c=s?de:Le,l={horizontal:c,vertical:Fe,both:c}[n],m=s?Le:de,h={horizontal:m,vertical:R,both:m}[n],b=se(e.nativeEvent);if(b!=null&&g(b)&&!mt(b)){let t=b.selectionStart,n=b.selectionEnd,r=b.value??``;if(t==null||e.shiftKey||t!==n||e.key!==h&&t<r.length||e.key!==l&&t>0)return}let C=w,E=re(S,f),O=Re(S,f);i!=null&&(C=i({disabledIndices:f,elementsRef:S,event:e,highlightedIndex:w,loopFocus:t,maxIndex:O,minIndex:E,onLoop:D,orientation:n,rtl:s}));let k={horizontal:[c],vertical:[Fe],both:[c,Fe]}[n],A={horizontal:[m],vertical:[R],both:[m,R]}[n],j=_?r:{horizontal:u?x:z,vertical:u?Se:P,both:r}[n];u&&(e.key===`Home`?C=E:e.key===`End`&&(C=O)),C===w&&(k.includes(e.key)||A.includes(e.key))&&(t&&C===O&&k.includes(e.key)?(C=E,a&&(C=a(e,w,C,S))):t&&C===E&&A.includes(e.key)?(C=O,a&&(C=a(e,w,C,S))):C=fe(S.current,{startingIndex:C,decrement:A.includes(e.key),disabledIndices:f})),C!==w&&!Ie(S.current,C)&&(d&&e.stopPropagation(),j.has(e.key)&&e.preventDefault(),T(C,!0),queueMicrotask(()=>{S.current[C]?.focus()}))});return{props:{ref:b,onFocus(e){let t=v.current,n=se(e.nativeEvent);!t||n==null||!g(n)||n.setSelectionRange(0,n.value.length??0)},onKeyDown:O},highlightedIndex:w,onHighlightedIndexChange:T,elementsRef:S,disabledIndices:f,onMapChange:E,relayKeyboardEvent:O}}function Er(e,t){for(let n of b.values())if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function Dr(e){let{render:t,className:r,style:i,refs:a=d,props:s=d,state:c=n,stateAttributesMapping:l,highlightedIndex:u,onHighlightedIndexChange:f,orientation:p,grid:m,loopFocus:h,onLoop:g,enableHomeAndEndKeys:_,onMapChange:v,stopEventPropagation:y=!0,rootRef:b,disabledIndices:x,modifierKeys:S,highlightItemOnHover:C=!1,tag:w=`div`,...T}=e,{props:E,highlightedIndex:D,onHighlightedIndexChange:O,elementsRef:k,onMapChange:A,relayKeyboardEvent:j}=Tr({grid:m,loopFocus:h,onLoop:g,orientation:p,highlightedIndex:u,onHighlightedIndexChange:f,rootRef:b,stopEventPropagation:y,enableHomeAndEndKeys:_,direction:ve(),disabledIndices:x,modifierKeys:S}),M=o(w,e,{state:c,ref:a,props:[E,...s,T],stateAttributesMapping:l}),N=Q.useMemo(()=>({highlightedIndex:D,onHighlightedIndexChange:O,highlightItemOnHover:C,relayKeyboardEvent:j}),[D,O,C,j]);return(0,$.jsx)(me.Provider,{value:N,children:(0,$.jsx)(st,{elementsRef:k,onMapChange:e=>{v?.(e),A(e)},children:M})})}var Or=Q.forwardRef(function(e,t){let{activateOnFocus:n=!1,className:r,loopFocus:i=!0,render:a,style:o,...s}=e,{onValueChange:c,orientation:l,value:u,setTabMap:f,tabActivationDirection:p}=ir(),[m,h]=Q.useState(0),[g,_]=Q.useState(null),v=Q.useRef(new Set),y=Q.useRef(new Set),b=Q.useRef(null);J(()=>{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=q(e=>(v.current.add(e),()=>{v.current.delete(e)})),S=q(e=>(y.current.add(e),b.current?.observe(e),()=>{y.current.delete(e),b.current?.unobserve(e)})),C=q((e,t)=>{e!==u&&c(e,t)}),w={orientation:l,tabActivationDirection:p},T={"aria-orientation":l===`vertical`?`vertical`:void 0,role:`tablist`},E=Q.useMemo(()=>({activateOnFocus:n,highlightedTabIndex:m,registerIndicatorUpdateListener:x,registerTabResizeObserverElement:S,onTabActivation:C,setHighlightedTabIndex:h,tabsListElement:g}),[n,m,x,S,C,h,g]);return(0,$.jsx)(ur.Provider,{value:E,children:(0,$.jsx)(Dr,{render:a,className:r,style:o,state:w,refs:[t,_],props:[T,s],stateAttributesMapping:or,highlightedIndex:m,enableHomeAndEndKeys:!0,loopFocus:i,orientation:l,onHighlightedIndexChange:h,onMapChange:f,disabledIndices:d})})});function kr({className:e,...t}){return(0,$.jsx)(sr,{className:c(`flex flex-col gap-4`,e),"data-slot":`tabs`,...t})}function Ar({className:e,...t}){return(0,$.jsxs)(Or,{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)(br,{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 jr({className:e,...t}){return(0,$.jsx)(fr,{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 Mr({className:e,...t}){return(0,$.jsx)(Cr,{className:c(`flex-1 outline-none`,e),"data-slot":`tabs-panel`,...t})}var Nr=Q.createContext(void 0);function Pr(e){let t=Q.useContext(Nr);if(t===void 0&&!e)throw Error(u(47));return t}function Fr(){return{...hn(),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 Ir={...Wt,disabled:I(e=>e.disabled),instantType:I(e=>e.instantType),openMethod:I(e=>e.openMethod),openChangeReason:I(e=>e.openChangeReason),modal:I(e=>e.modal),focusManagerModal:I(e=>e.focusManagerModal),stickIfOpen:I(e=>e.stickIfOpen),titleElementId:I(e=>e.titleElementId),descriptionElementId:I(e=>e.descriptionElementId),openOnHover:I(e=>e.openOnHover),closeDelay:I(e=>e.closeDelay),hasViewport:I(e=>e.hasViewport)},Lr=class e extends k{constructor(e,t,n=!1){let r={...Fr(),...e},i=new j;r.open&&e?.mounted===void 0&&(r.mounted=!0),r.floatingRootContext=yn(i,t,n),super(r,{popupRef:Q.createRef(),backdropRef:Q.createRef(),internalBackdropRef:Q.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:Q.createRef(),beforeContentFocusGuardRef:Q.createRef(),stickIfOpenTimeout:new ce,triggerElements:i},Ir)}setOpen=(e,t)=>{let n=t.reason===De,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=F(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};O(n,e,t.trigger,a()),this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),Zn.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}=E(t,(t,r)=>new e(n,t,r));return Q.useEffect(()=>i?.disposeEffect(),[i]),r}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()};function Rr({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=Lr.useStore(s?.store,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});te(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=ue()!=null;u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a),oe(u,d),A(u);let{forceUnmount:h}=Be(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null})});u.useSyncedValues({modal:o,nested:m}),Q.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]);let g=Q.useCallback(()=>{u.setOpen(!1,Oe(ne))},[u]);Q.useImperativeHandle(e.actionsRef,()=>({unmount:h,close:g}),[h,g]);let _=d||f,v=Q.useMemo(()=>({store:u}),[u]);return(0,$.jsxs)(Nr.Provider,{value:v,children:[_&&(0,$.jsx)(Br,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})}function zr(e){return Pr(!0)?(0,$.jsx)(Rr,{props:e}):(0,$.jsx)(ke,{children:(0,$.jsx)(Rr,{props:e})})}function Br({store:e,modal:t}){let r=ge(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}});return _(e,{activeTriggerProps:r.reference??n,inactiveTriggerProps:r.trigger??n,popupProps:Q.useMemo(()=>l(N,r.floating),[r.floating])}),null}var Vr=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:s=!0,handle:c,payload:l,openOnHover:d=!1,delay:f=300,closeDelay:p=0,id:h,...g}=e,_=Pr(!0),v=c?.store??_?.store;if(!v)throw Error(u(74));let y=be(h),b=v.useState(`isTriggerActive`,y),x=v.useState(`floatingRootContext`),S=v.useState(`isOpenedByTrigger`,y),w=v.useState(`triggerPopupId`,y),T=Q.useRef(null),{registerTrigger:E,isMountedByThisTrigger:D}=ae(y,T,v,{payload:l,disabled:a,openOnHover:d,closeDelay:p}),O=v.useState(`openChangeReason`),k=v.useState(`stickIfOpen`),A=v.useState(`openMethod`),j=v.useState(`focusManagerModal`),M=Zt(x,{enabled:!a&&x!=null&&d&&(A!==`touch`||O!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:Qt(),restMs:f,delay:{close:p},triggerElementRef:T,isActiveTrigger:b,isClosing:()=>v.select(`transitionStatus`)===`ending`}),N=at(x,{enabled:x!=null,stickIfOpen:k}),P=ot(()=>v.select(`open`),e=>{v.set(`openMethod`,e)}),F=v.useState(`triggerProps`,D),{getButtonProps:I,buttonRef:L}=Pe({disabled:a,native:s}),te={open(e){return e&&O===`trigger-press`?ee.open(e):m.open(e)}},{preFocusGuardRef:ne,handlePreFocusGuardFocus:R,handleFocusTargetFocus:re}=ln(v,T),z=o(`button`,e,{state:{disabled:a,open:S},ref:[L,t,E,T],props:[N.reference,M,F,P,{[K]:``,id:y,"aria-haspopup":`dialog`,"aria-expanded":S,"aria-controls":w},g,I],stateAttributesMapping:te});return D&&!j?(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(C,{ref:ne,onFocus:R}),(0,$.jsx)(Q.Fragment,{children:z},y),(0,$.jsx)(C,{ref:v.context.triggerFocusTargetRef,onFocus:re})]}):(0,$.jsx)(Q.Fragment,{children:z},y)}),Hr=Q.createContext(void 0);function Ur(){let e=Q.useContext(Hr);if(e===void 0)throw Error(u(45));return e}var Wr=Q.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Pr();return i.useState(`mounted`)||n?(0,$.jsx)(Hr.Provider,{value:n,children:(0,$.jsx)(pe,{ref:t,...r})}):null}),Gr=Q.createContext(void 0);function Kr(){let e=Q.useContext(Gr);if(!e)throw Error(u(46));return e}var qr=Q.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:g=!1,collisionAvoidance:_=_e,...v}=e,{store:y}=Pr(),b=Ur(),x=G(),S=y.useState(`floatingRootContext`),C=y.useState(`mounted`),w=y.useState(`open`),T=y.useState(`openChangeReason`),E=y.useState(`activeTriggerElement`),D=y.useState(`modal`),O=y.useState(`openMethod`),k=y.useState(`positionerElement`),A=y.useState(`instantType`),j=y.useState(`transitionStatus`),M=y.useState(`hasViewport`),N=Q.useRef(null),P=h(k,!1,!1),F=ut({anchor:a,floatingRootContext:S,positionMethod:o,mounted:C,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:g,keepMounted:b,nodeId:x,collisionAvoidance:_,adaptiveOrigin:M?ht:void 0}),I=S.useState(`domReferenceElement`);J(()=>{let e=I,t=N.current;if(e&&(N.current=e),t&&e&&e!==t){y.set(`instantType`,void 0);let e=new AbortController;return P(()=>{y.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[I,P,y]),ft(w&&D===!0&&T!==`trigger-hover`,O===`touch`,k,E);let ee=Q.useCallback(e=>{y.set(`positionerElement`,e)},[y]),L=pt(e,{open:w,side:F.side,align:F.align,anchorHidden:F.anchorHidden,instant:A},{styles:F.positionerStyles,transitionStatus:j,props:v,refs:[t,ee],hidden:!C,inert:!w});return(0,$.jsxs)(Gr.Provider,{value:F,children:[C&&D===!0&&T!==`trigger-hover`&&(0,$.jsx)(W,{ref:y.context.internalBackdropRef,inert:le(!w),cutout:E}),(0,$.jsx)(Te,{id:x,children:L})]})}),Jr=Q.createContext(void 0);function Yr(){let[e,t]=Q.useState(0),n=q(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:Q.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}function Xr(e){let{value:t,children:n}=e;return(0,$.jsx)(Jr.Provider,{value:t,children:n})}var Zr={...H,...Me},Qr=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:s,...c}=e,{store:l}=Pr(),u=Kr(),d=lt(!0)!=null,{context:f,hasClosePart:p}=Yr(),m=l.useState(`open`),h=l.useState(`openMethod`),g=l.useState(`instantType`),_=l.useState(`transitionStatus`),v=l.useState(`popupProps`),b=l.useState(`titleElementId`),x=l.useState(`descriptionElementId`),C=l.useState(`modal`),T=l.useState(`mounted`),E=l.useState(`openChangeReason`),D=l.useState(`activeTriggerElement`),O=l.useState(`floatingRootContext`),k=O.useState(`floatingId`),A=l.useState(`disabled`),j=l.useState(`openOnHover`),M=l.useState(`closeDelay`),P=c.id??k;L({open:m,ref:l.context.popupRef,onComplete(){m&&l.context.onOpenChangeComplete?.(!0)}}),Ht(O,{enabled:j&&!A,closeDelay:M});let F=a===void 0?w(l.context.popupRef):a,I=C!==!1&&p;l.useSyncedValue(`focusManagerModal`,I);let ee=Q.useCallback(e=>{l.set(`popupElement`,e)},[l]),te=o(`div`,e,{state:{open:m,side:u.side,align:u.align,instant:g,transitionStatus:_},ref:[t,l.context.popupRef,ee],props:[v,{id:P,role:`dialog`,...N,"aria-labelledby":b,"aria-describedby":x,onKeyDown(e){d&&y.has(e.key)&&e.stopPropagation()}},ct(_),c],stateAttributesMapping:Zr});return(0,$.jsx)(Ne,{context:O,openInteractionType:h,modal:I,disabled:!T||E===`trigger-hover`,initialFocus:F,returnFocus:s,restoreFocus:`popup`,previousFocusableElement:S(D)?D:void 0,nextFocusableElement:l.context.triggerFocusTargetRef,beforeContentFocusGuardRef:l.context.beforeContentFocusGuardRef,children:(0,$.jsx)(Xr,{value:f,children:te})})}),$r=function(e){return e.popupWidth=`--popup-width`,e.popupHeight=`--popup-height`,e}({}),ei={activationDirection:e=>e?{"data-activation-direction":e}:null},ti=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...s}=e,{store:c}=Pr(),{side:l}=Kr(),u=c.useState(`instantType`),{children:d,state:f}=Qn({store:c,side:l,cssVars:$r,children:a});return o(`div`,e,{state:{activationDirection:f.activationDirection,transitioning:f.transitioning,instant:u},ref:t,props:[s,{children:d}],stateAttributesMapping:ei})}),ni=zr;function ri({className:e,children:t,...n}){return(0,$.jsx)(Vr,{className:e,"data-slot":`popover-trigger`,...n,children:t})}function ii({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)(Wr,{children:(0,$.jsx)(qr,{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)(Qr,{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)(ti,{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 ai({repos:e,disabled:t,onAdd:n}){let[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(``),s=(0,Q.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)(ni,{open:r,onOpenChange:e=>{e&&o(``),i(e)},children:[(0,$.jsx)(ri,{render:(0,$.jsxs)(f,{variant:`outline`,size:`sm`,disabled:t,className:`h-8 text-xs text-muted-foreground`,children:[(0,$.jsx)(Bt,{size:14}),` Add repository`]})}),(0,$.jsxs)(ii,{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)(Ee,{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 oi=(e,t)=>{switch(e){case`antigravity`:return`agy --conversation ${t}`;case`claude`:return`claude --resume ${t}`;case`codex`:return`codex resume ${t}`;case`copilot`:return`copilot --resume ${t}`;default:return`agy --conversation ${t}`}},si=e=>{switch(e){case`antigravity`:return(0,$.jsx)(`span`,{className:`grid size-5.5 place-items-center rounded-md bg-card border border-border/80 shadow-2xs p-0.5 shrink-0`,title:`Google Antigravity`,children:(0,$.jsx)(vn,{className:`size-3.5`})});case`claude`:return(0,$.jsx)(`span`,{className:`grid size-5.5 place-items-center rounded-md bg-[#D97757] text-white font-bold text-[9px] shadow-2xs shrink-0`,title:`Claude Code`,children:(0,$.jsx)(It,{className:`size-2.5`})});case`codex`:return(0,$.jsx)(`span`,{className:`grid size-5.5 place-items-center rounded-md bg-foreground text-background font-bold text-[9px] shadow-2xs shrink-0`,title:`OpenAI Codex`,children:(0,$.jsx)(tn,{className:`size-2.5`})});case`copilot`:return(0,$.jsx)(`span`,{className:`grid size-5.5 place-items-center rounded-md bg-gradient-to-tr from-purple-600 via-indigo-500 to-blue-600 text-white font-bold text-[9px] shadow-2xs shrink-0`,title:`GitHub Copilot`,children:(0,$.jsx)(_n,{className:`size-2.5`})});default:return null}},ci=e=>{if(!e)return``;let t=new Date(e);return isNaN(t.getTime())?``:new Date().toDateString()===t.toDateString()?`Today ${t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}`:`${t.toLocaleDateString(void 0,{month:`short`,day:`numeric`})} ${t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}`},li=({ws:e,sessions:t,sessionsLoading:n,setActiveSession:r,setTranscript:i,fetchSessionTranscript:a,handleOpenDesktopSession:o,showToast:s})=>{let l=fn(),u=Lt(),d=kt(),p=d.data?.find(e=>e.name===`antigravity`)?.detected??!0,m=d.data?.find(e=>e.name===`claude`)?.detected??!1,h=d.data?.find(e=>e.name===`codex`)?.detected??!1,g=d.data?.find(e=>e.name===`copilot`)?.detected??!1,_=!!l.data?.some(e=>e.id===`antigravity`&&e.available),v=!!l.data?.some(e=>e.id===`codex-desktop`&&e.available),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(null),[T,E]=(0,Q.useState)(null),[D,O]=(0,Q.useState)(`created-desc`),[k,A]=(0,Q.useState)(`harness`),[j,M]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(`all`),[F,I]=(0,Q.useState)({antigravity:!1,claude:!1,codex:!1,copilot:!1}),ee=e=>{I(t=>({...t,[e]:!t[e]}))},L=(0,Q.useRef)(!1),te=(0,Q.useRef)(null),ne=async t=>{try{await Gt(`/api/workspace/${encodeURIComponent(e.branchName)}/launch`,{method:`POST`,body:JSON.stringify({targetId:t})}),s?.(`Launched ${t===`claude-desktop`?`Claude Desktop`:t===`codex-desktop`?`Codex Desktop`:t} for workspace ${e.branchName}`,`success`)}catch(e){let t=e instanceof Error?e.message:`Failed to launch desktop application`;s?.(t,`error`)}},R=async t=>{if(!C){w(t);try{await u.mutateAsync({workspaceId:e.branchName,assistant:t}),E({assistant:t,cmd:t===`antigravity`?`agy`:t===`claude`?`claude`:t===`codex`?`codex`:`copilot`,timestamp:new Date}),s?.(`Started new ${t} session in terminal`,`success`)}catch(e){let t=e instanceof Error?e.message:`Failed to launch terminal`;s?.(t,`error`)}finally{w(null)}}},re=async(t,n)=>{if(!L.current){L.current=!0,S(t);try{await u.mutateAsync({workspaceId:e.branchName,sessionId:t,assistant:n});let r=oi(n,t);E({assistant:n,cmd:r,timestamp:new Date}),s?.(`Resumed ${n} session in terminal`,`success`)}catch{let e=oi(n,t);await pn(e),s?.(`Copied resume command to clipboard: ${e}`,`info`)}finally{S(null),L.current=!1}}},z=async t=>{if(!(!v||te.current)){te.current=t,b(t);try{await o(e,t,`codex`)}finally{te.current=null,b(null)}}},ie=(e,t)=>[...e].sort((e,n)=>{switch(t){case`created-desc`:{let t=new Date(e.createdAt||e.updatedAt||0).getTime();return new Date(n.createdAt||n.updatedAt||0).getTime()-t}case`created-asc`:return new Date(e.createdAt||e.updatedAt||0).getTime()-new Date(n.createdAt||n.updatedAt||0).getTime();case`updated-desc`:{let t=new Date(e.updatedAt||e.createdAt||0).getTime();return new Date(n.updatedAt||n.createdAt||0).getTime()-t}case`messages-desc`:return(n.messageCount||0)-(e.messageCount||0);case`title-asc`:return(e.title||``).localeCompare(n.title||``);default:return 0}}),ae=(0,Q.useMemo)(()=>{let e=t;if(N!==`all`&&(e=e.filter(e=>e.assistant===N)),j.trim()){let t=j.toLowerCase();e=e.filter(e=>`${e.title} ${e.id} ${e.assistant}`.toLowerCase().includes(t))}return ie(e,D)},[t,N,j,D]),B=(0,Q.useMemo)(()=>ie(t.filter(e=>e.assistant===`antigravity`),D),[t,D]),oe=(0,Q.useMemo)(()=>ie(t.filter(e=>e.assistant===`claude`),D),[t,D]),se=(0,Q.useMemo)(()=>ie(t.filter(e=>e.assistant===`codex`),D),[t,D]),ce=(0,Q.useMemo)(()=>ie(t.filter(e=>e.assistant===`copilot`),D),[t,D]),V=t=>e.assistants?.includes(t)??!1,H=[{id:`antigravity`,name:`Google Antigravity`,cliCommand:`agy`,isDetected:p,isConfigured:V(`antigravity`),hasApp:_,appName:`IDE`,appTargetId:`antigravity`,sessions:B,icon:(0,$.jsx)(`span`,{className:`grid size-6 place-items-center rounded-md bg-card border border-border/80 shadow-2xs p-0.5`,children:(0,$.jsx)(vn,{className:`size-4`})})},{id:`claude`,name:`Claude Code`,cliCommand:`claude`,isDetected:m,isConfigured:V(`claude`),hasApp:!1,appName:`App`,appTargetId:`claude`,sessions:oe,icon:(0,$.jsx)(`span`,{className:`grid size-6 place-items-center rounded-md bg-[#D97757] text-white font-bold text-[10px] shadow-2xs`,children:(0,$.jsx)(It,{className:`size-3`})})},{id:`codex`,name:`OpenAI Codex`,cliCommand:`codex`,isDetected:h,isConfigured:V(`codex`),hasApp:v,appName:`Desktop`,appTargetId:`codex-desktop`,sessions:se,icon:(0,$.jsx)(`span`,{className:`grid size-6 place-items-center rounded-md bg-foreground text-background font-bold text-[10px] shadow-2xs`,children:(0,$.jsx)(tn,{className:`size-3`})})},{id:`copilot`,name:`GitHub Copilot`,cliCommand:`copilot`,isDetected:g,isConfigured:V(`copilot`),hasApp:!1,appName:`App`,appTargetId:`copilot`,sessions:ce,icon:(0,$.jsx)(`span`,{className:`grid size-6 place-items-center rounded-md bg-gradient-to-tr from-purple-600 via-indigo-500 to-blue-600 text-white font-bold text-[10px] shadow-2xs`,children:(0,$.jsx)(_n,{className:`size-3`})})}];return(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between bg-card/60 p-2 rounded-md border border-border/80`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`relative flex-1 min-w-0 max-w-xs`,children:[(0,$.jsx)(wt,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 size-3 text-muted-foreground`}),(0,$.jsx)(`input`,{type:`text`,value:j,onChange:e=>M(e.target.value),placeholder:`Search chat sessions...`,className:`w-full pl-7 pr-6 py-1 text-xs rounded border border-border bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:border-primary`}),j&&(0,$.jsx)(`button`,{type:`button`,onClick:()=>M(``),className:`absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground text-[10px] cursor-pointer`,children:`✕`})]}),(0,$.jsxs)(`div`,{className:`hidden md:flex items-center gap-1`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>P(`all`),className:c(`px-2 py-0.5 text-[11px] rounded font-medium transition-colors cursor-pointer`,N===`all`?`bg-primary text-primary-foreground font-semibold shadow-2xs`:`bg-muted/60 text-muted-foreground hover:text-foreground hover:bg-muted`),children:[`All (`,t.length,`)`]}),[`antigravity`,`claude`,`codex`,`copilot`].map(e=>{let n=t.filter(t=>t.assistant===e).length;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>P(N===e?`all`:e),className:c(`px-2 py-0.5 text-[11px] rounded font-medium capitalize transition-colors cursor-pointer`,N===e?`bg-primary text-primary-foreground font-semibold shadow-2xs`:`bg-muted/60 text-muted-foreground hover:text-foreground hover:bg-muted`),children:[e,` (`,n,`)`]},e)})]}),n&&(0,$.jsx)(`span`,{className:`flex items-center gap-1 text-xs text-muted-foreground shrink-0 pl-1`,children:(0,$.jsx)(X,{className:`size-3`})})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,$.jsxs)(rn,{children:[(0,$.jsxs)(Xt,{className:`flex items-center gap-1.5 px-2 py-1 text-xs font-medium rounded border border-border bg-card text-foreground hover:bg-accent cursor-pointer shadow-2xs transition-colors`,children:[(0,$.jsx)(yt,{size:11,className:`text-muted-foreground`}),(0,$.jsx)(`span`,{children:{"created-desc":`Newest`,"created-asc":`Oldest`,"updated-desc":`Recently active`,"messages-desc":`Most turns`,"title-asc":`A–Z`}[D]}),(0,$.jsx)(We,{size:10,className:`text-muted-foreground opacity-70`})]}),(0,$.jsxs)(qt,{align:`end`,className:`w-48`,children:[(0,$.jsx)(`div`,{className:`px-2 py-1 text-[10px] font-semibold text-muted-foreground uppercase tracking-wider`,children:`Order Chats By`}),(0,$.jsxs)(Z,{onClick:()=>O(`created-desc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Newest created`}),D===`created-desc`&&(0,$.jsx)(Y,{size:12,className:`text-primary`})]}),(0,$.jsxs)(Z,{onClick:()=>O(`created-asc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Oldest created`}),D===`created-asc`&&(0,$.jsx)(Y,{size:12,className:`text-primary`})]}),(0,$.jsxs)(Z,{onClick:()=>O(`updated-desc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Recently active`}),D===`updated-desc`&&(0,$.jsx)(Y,{size:12,className:`text-primary`})]}),(0,$.jsxs)(Z,{onClick:()=>O(`messages-desc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Most turns`}),D===`messages-desc`&&(0,$.jsx)(Y,{size:12,className:`text-primary`})]}),(0,$.jsxs)(Z,{onClick:()=>O(`title-asc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Title (A–Z)`}),D===`title-asc`&&(0,$.jsx)(Y,{size:12,className:`text-primary`})]})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center rounded border border-border bg-card p-0.5 shadow-2xs`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>A(`harness`),title:`Group chats by AI Harness`,className:c(`px-2 py-0.5 text-xs rounded font-medium transition-colors cursor-pointer`,k===`harness`?`bg-primary text-primary-foreground font-semibold shadow-2xs`:`text-muted-foreground hover:text-foreground`),children:`Grouped`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>A(`timeline`),title:`Unified Chronological Timeline`,className:c(`px-2 py-0.5 text-xs rounded font-medium transition-colors cursor-pointer`,k===`timeline`?`bg-primary text-primary-foreground font-semibold shadow-2xs`:`text-muted-foreground hover:text-foreground`),children:`Timeline`})]})]})]}),T&&(0,$.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 p-2.5 rounded-md bg-emerald-500/10 border border-emerald-500/30 text-xs animate-fade-in`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-foreground min-w-0`,children:[(0,$.jsx)(`span`,{className:`size-2 rounded-full bg-emerald-500 animate-pulse shrink-0`}),(0,$.jsxs)(`span`,{className:`truncate`,children:[(0,$.jsx)(`strong`,{children:`Active in terminal:`}),` `,(0,$.jsx)(`code`,{className:`font-mono bg-background/80 px-1.5 py-0.5 rounded text-emerald-400`,children:T.cmd})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:async()=>{await pn(T.cmd),s?.(`Command copied to clipboard!`,`success`)},className:`inline-flex items-center gap-1 px-2.5 py-1 text-xs font-medium rounded border border-emerald-500/40 bg-emerald-500/15 text-emerald-400 hover:bg-emerald-500/25 transition-colors cursor-pointer`,children:[(0,$.jsx)(Tt,{size:11}),` Copy`]}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>E(null),className:`text-muted-foreground hover:text-foreground cursor-pointer text-xs px-1`,title:`Dismiss banner`,children:`✕`})]})]}),k===`timeline`?(0,$.jsx)(Sn,{className:`divide-y divide-border overflow-hidden surface-card`,children:ae.length===0?(0,$.jsx)(`div`,{className:`py-8 text-center text-xs text-muted-foreground`,children:j?`No chat sessions match your search filter.`:`No chat sessions recorded yet.`}):ae.map(e=>(0,$.jsxs)(`div`,{className:`group flex flex-col gap-2 p-3 hover:bg-accent/40 transition-colors sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 flex-1`,children:[si(e.assistant),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-muted-foreground mb-0.5`,children:[(0,$.jsx)(`span`,{className:`font-semibold capitalize text-foreground`,children:e.assistant===`antigravity`?`Antigravity`:e.assistant===`claude`?`Claude`:e.assistant===`codex`?`Codex`:`Copilot`}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsx)(`span`,{className:`font-mono text-muted-foreground/80`,children:e.id.slice(0,8)}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsx)(`span`,{children:ci(e.createdAt||e.updatedAt)}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsxs)(`span`,{className:`font-mono`,children:[e.messageCount,` `,e.messageCount===1?`turn`:`turns`]})]}),(0,$.jsx)(`p`,{className:`text-xs font-semibold text-foreground truncate`,title:e.title,children:e.title})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0 pl-8 sm:pl-0`,children:[(0,$.jsxs)(f,{size:`xs`,variant:`default`,disabled:x===e.id,onClick:()=>void re(e.id,e.assistant),title:`Resume session in terminal (${e.id})`,children:[x===e.id?(0,$.jsx)(X,{className:`size-3`}):(0,$.jsx)(bn,{size:12}),(0,$.jsx)(`span`,{children:`Resume`})]}),(0,$.jsxs)(f,{size:`xs`,variant:`outline`,onClick:()=>{r(e),i([]),a(e.assistant,e.id)},title:`Inspect transcript log`,children:[(0,$.jsx)(In,{size:12}),(0,$.jsx)(`span`,{children:`Logs`})]}),e.assistant===`codex`&&v&&(0,$.jsxs)(f,{size:`xs`,variant:`outline`,disabled:y===e.id,onClick:()=>void z(e.id),title:`Open in Codex Desktop`,children:[y===e.id?(0,$.jsx)(X,{className:`size-3`}):(0,$.jsx)(un,{size:12}),(0,$.jsx)(`span`,{children:`Desktop`})]}),(0,$.jsx)(f,{size:`icon-xs`,variant:`ghost`,onClick:async()=>{let t=oi(e.assistant,e.id);await pn(t),s?.(`Copied: ${t}`,`success`)},title:`Copy CLI resume command`,children:(0,$.jsx)(Tt,{size:12})})]})]},e.id))}):(0,$.jsx)(`div`,{className:`space-y-2.5`,children:H.map(e=>{let t=F[e.id]??!1,n=e.sessions.filter(e=>{if(!j.trim())return!0;let t=j.toLowerCase();return`${e.title} ${e.id}`.toLowerCase().includes(t)});return(0,$.jsxs)(Sn,{className:`overflow-hidden surface-card`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 p-3 sm:flex-row sm:items-center sm:justify-between bg-muted/20 hover:bg-muted/35 transition-colors cursor-pointer select-none`,onClick:()=>ee(e.id),children:[(0,$.jsxs)(`div`,{className:`flex flex-1 items-center gap-2.5 min-w-0`,children:[(0,$.jsx)(`span`,{className:`text-muted-foreground transition-transform`,children:t?(0,$.jsx)(We,{size:14}):(0,$.jsx)(et,{size:14})}),e.icon,(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 min-w-0`,children:[(0,$.jsx)(`span`,{className:`font-bold text-xs text-foreground`,children:e.name}),(0,$.jsxs)($t,{tone:e.isDetected?`success`:`neutral`,dot:e.isDetected,children:[`CLI: `,e.cliCommand]}),e.hasApp&&(0,$.jsx)($t,{tone:`running`,children:e.appName}),(0,$.jsxs)(`span`,{className:`text-[11px] text-muted-foreground font-mono`,children:[`(`,n.length,`)`]})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0 pl-6 sm:pl-0`,onClick:e=>e.stopPropagation(),children:[(0,$.jsxs)(f,{size:`xs`,variant:`default`,disabled:C===e.id,onClick:()=>void R(e.id),title:`Launch new ${e.cliCommand} session in terminal`,children:[C===e.id?(0,$.jsx)(X,{className:`size-3`}):(0,$.jsx)(Bt,{size:12}),(0,$.jsx)(`span`,{children:`New Session`})]}),e.hasApp&&(0,$.jsxs)(f,{size:`xs`,variant:`outline`,onClick:()=>void ne(e.appTargetId),title:`Open in ${e.appName}`,children:[(0,$.jsx)(un,{size:12}),(0,$.jsx)(`span`,{children:e.appName})]})]})]}),t&&(0,$.jsx)(`div`,{className:`divide-y divide-border/60 border-t border-border`,children:n.length===0?(0,$.jsxs)(`div`,{className:`p-4 text-center text-xs text-muted-foreground flex items-center justify-center gap-2`,children:[(0,$.jsx)(`span`,{children:j?`No sessions match your search query.`:`No previous sessions recorded for ${e.name}.`}),!j&&(0,$.jsxs)(`button`,{type:`button`,onClick:()=>void R(e.id),className:`text-primary font-semibold hover:underline cursor-pointer inline-flex items-center gap-1 text-xs`,children:[(0,$.jsx)(Bt,{size:11}),` Start session`]})]}):n.map(e=>(0,$.jsxs)(`div`,{className:`group flex flex-col gap-1.5 px-3.5 py-2.5 hover:bg-accent/40 transition-colors sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 mb-0.5 text-[11px] text-muted-foreground font-mono`,children:[(0,$.jsx)(`span`,{children:e.id.slice(0,8)}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsx)(`span`,{children:ci(e.createdAt||e.updatedAt)}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsxs)(`span`,{children:[e.messageCount,` `,e.messageCount===1?`turn`:`turns`]})]}),(0,$.jsx)(`p`,{className:`text-xs font-semibold text-foreground truncate`,title:e.title,children:e.title})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,$.jsxs)(f,{size:`xs`,variant:`default`,disabled:x===e.id,onClick:()=>void re(e.id,e.assistant),title:`Resume session in terminal (${e.id})`,children:[x===e.id?(0,$.jsx)(X,{className:`size-3`}):(0,$.jsx)(bn,{size:12}),(0,$.jsx)(`span`,{children:`Resume`})]}),(0,$.jsxs)(f,{size:`xs`,variant:`outline`,onClick:()=>{r(e),i([]),a(e.assistant,e.id)},title:`Inspect transcript log`,children:[(0,$.jsx)(In,{size:12}),(0,$.jsx)(`span`,{children:`Logs`})]}),e.assistant===`codex`&&v&&(0,$.jsxs)(f,{size:`xs`,variant:`outline`,disabled:y===e.id,onClick:()=>void z(e.id),title:`Open in Codex Desktop`,children:[y===e.id?(0,$.jsx)(X,{className:`size-3`}):(0,$.jsx)(un,{size:12}),(0,$.jsx)(`span`,{children:`Desktop`})]}),(0,$.jsx)(f,{size:`icon-xs`,variant:`ghost`,onClick:async()=>{let t=oi(e.assistant,e.id);await pn(t),s?.(`Copied: ${t}`,`success`)},title:`Copy CLI resume command`,children:(0,$.jsx)(Tt,{size:12})})]})]},e.id))})]},e.id)})})]})};function ui(e){return e===`review`||e===`workspace-write`}var di=e=>`nexusflow_chat_${e}`,fi=()=>({v:4,sessions:{},providerId:null,profilesByProvider:{"claude-cli":`review`,"codex-cli":`review`},modelsByProvider:{},messages:[]});function pi(e){try{let t=localStorage.getItem(di(e));if(!t)return fi();let n=JSON.parse(t);if(Array.isArray(n))return{...fi(),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=>ui(e[1]))),t=typeof n.modelsByProvider==`object`&&n.modelsByProvider!==null?Object.fromEntries(Object.entries(n.modelsByProvider).filter(e=>typeof e[0]==`string`&&typeof e[1]==`string`)):{};return{...fi(),sessions:n.sessions,providerId:typeof n.providerId==`string`?n.providerId:null,profilesByProvider:{...fi().profilesByProvider,...e},modelsByProvider:t,messages:n.messages}}if(n&&n.v===3&&n.sessions&&Array.isArray(n.messages))return{...fi(),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:fi().profilesByProvider,messages:n.messages}}return fi()}catch{return fi()}}var mi=500;function hi(e,t){try{let n=t.messages.length>mi?{...t,messages:t.messages.slice(-500)}:t;localStorage.setItem(di(e),JSON.stringify(n))}catch(e){console.error(`Failed to save chat to localStorage`,e)}}function gi(e){try{localStorage.removeItem(di(e))}catch{}}var _i=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,vi=new Set([`claude-cli`,`codex-cli`,`antigravity-cli`,`copilot-cli`]);function yi(e){return e===`claude`?`claude-cli`:e===`codex`?`codex-cli`:e===`antigravity`?`antigravity-cli`:e===`copilot`?`copilot-cli`:null}function bi(e){if(!e||typeof e!=`object`)return null;let t=e.chatLaunch;if(!t||typeof t!=`object`)return null;let n=t;return!_i.test(n.nonce??``)||!n.providerId||!vi.has(n.providerId)||!ui(n.executionProfile)||n.kickoff!==void 0&&(typeof n.kickoff!=`string`||n.kickoff.length>2e3)||n.model!==void 0&&(typeof n.model!=`string`||n.model.length>100)||n.assistant!==void 0&&yi(n.assistant)!==n.providerId||n.sessionId!==void 0&&(!_i.test(n.sessionId)||!n.assistant)?null:n}function xi({className:e,...t}){return(0,$.jsx)(`div`,{className:c(`animate-skeleton rounded-sm [--skeleton-highlight:--alpha(var(--color-white)/64%)] [background:linear-gradient(120deg,transparent_40%,var(--skeleton-highlight),transparent_60%)_var(--color-muted)_0_0/200%_100%_fixed] dark:[--skeleton-highlight:--alpha(var(--color-white)/4%)]`,e),"data-slot":`skeleton`,...t})}function Si({open:e,onClose:t,ws:n,onPick:r,error:i,pending:a=!1}){let[o,s]=(0,Q.useState)([]),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null);(0,Q.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`||e.assistant===`antigravity`||e.assistant===`copilot`);s(t)}).catch(()=>d(`Failed to load sessions.`)).finally(()=>l(!1)))},[e,n.branchName]);let f=e=>{switch(e){case`codex`:return`Codex`;case`antigravity`:return`Antigravity`;case`copilot`:return`Copilot`;default:return`Claude`}};return(0,$.jsx)(sn,{open:e,onOpenChange:e=>!e&&t(),children:(0,$.jsxs)(Kt,{className:`max-w-lg`,children:[(0,$.jsx)(nn,{children:(0,$.jsx)(Yt,{children:`Resume a past session`})}),(0,$.jsxs)(mn,{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)(xi,{className:`h-14`}),(0,$.jsx)(xi,{className:`h-14`}),(0,$.jsx)(xi,{className:`h-14`})]}):o.length===0?(0,$.jsx)(Dn,{children:(0,$.jsxs)(En,{children:[(0,$.jsx)(wn,{variant:`icon`,children:(0,$.jsx)(Nn,{})}),(0,$.jsx)(Cn,{children:`No resumable sessions found`}),(0,$.jsx)(Tn,{children:`Past 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:f(e.assistant)}),(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)(In,{size:11}),(0,$.jsxs)(`span`,{children:[e.messageCount,` messages`]})]})]},e.id))]})]})})}var Ci=p(((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)}}})),wi=p(((e,t)=>{function n(e){if(!e)return``;if(!/\r/.test(e))return e;for(e=e.replace(/\r+\n/gm,`
1
+ import{_ as e,b as t,c 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,v as p}from"./button-BDDZnIHx.js";import{$n as m,$t as h,A as g,B as _,Bt as v,C as y,D as b,E as x,En as S,Et as C,F as w,Fn as T,H as E,Hn as D,I as O,K as k,L as A,M as j,Mn as M,N,O as P,P as F,Q as I,Qn as ee,Qt as L,R as te,Rn as ne,S as R,St as re,T as z,Tt as ie,U as ae,Un as B,V as oe,Vt as se,Xt as ce,Z as V,Zn as H,_ as le,at as ue,b as de,bt as fe,ct as pe,dn as me,en as U,er as he,et as ge,ft as _e,g as ve,h as W,hn as ye,in as be,it as G,j as xe,k as Se,kt as Ce,lt as K,mn as q,nr as we,nt as Te,o as Ee,pn as J,qn as De,rn as Oe,rt as ke,t as Ae,tn as je,tr as Me,tt as Ne,un as Pe,v as Fe,wt as Ie,x as Le,xt as Re,y as ze,z as Be,zn as Ve,zt as He}from"./CSPContext-DBUu9tE0.js";import{t as Ue}from"./bot-C2HWrAft.js";import{t as We}from"./chevron-down-qTL8HPug.js";import{a as Ge,c as Ke,i as qe,l as Je,n as Ye,o as Xe,r as Ze,s as Qe,t as $e,u as et}from"./square-DlIYnlSq.js";import{t as tt}from"./code-xml-jFAa3-TT.js";import{t as nt}from"./cpu-Cdwd84Jz.js";import{t as rt}from"./trash-2-CtR35_eF.js";import{t as it}from"./zap-CWG_Lvki.js";import{_ as at,a as ot,c as st,d as ct,f as lt,l as ut,n as dt,o as ft,s as pt,t as mt,u as ht,x as gt,y as _t}from"./isElementDisabled-uy_EOitH.js";import{$ as vt,$t as yt,A as bt,Bt as xt,Ft as St,Gt as Ct,Ht as wt,Jt as Tt,K as Et,Kt as Dt,Lt as Ot,M as kt,N as At,Nt as jt,Pt as Mt,Q as Nt,Qt as Pt,Rt as Ft,St as It,U as Lt,Ut as Rt,W as zt,Wt as Bt,Xt as Y,Zt as Vt,_t as Ht,a as X,at as Ut,bt as Wt,ct as Gt,d as Kt,dt as qt,et as Jt,f as Yt,ft as Xt,gt as Zt,ht as Qt,i as $t,j as en,jt as tn,l as nn,lt as rn,mt as an,n as on,o as sn,ot as cn,pt as ln,qt as un,r as dn,rt as fn,t as pn,u as mn,ut as Z,vt as hn,w as gn,wt as _n,xt as vn,yt as yn,zt as bn}from"./index-C_rwnBzF.js";import{t as xn}from"./badge-CAohJGj6.js";import{t as Sn}from"./card-BKXzd_5L.js";import{a as Cn,i as wn,n as Tn,r as En,t as Dn}from"./empty-BdlgbifD.js";import{t as On}from"./textarea-ByfoCb54.js";import{n as kn,t as An}from"./vsc-DFh0-53h.js";var jn=a(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),Mn=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`}]]),Nn=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`}]]),Pn=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`}]]),Fn=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`}]]),In=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`}]]),Ln=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`}]]),Rn=a(`puzzle`,[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]),zn=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`}]]),Bn=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`}]]),Vn=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`}]]),Hn=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`}]]),Un=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`}]]),Q=t(e(),1);function Wn(){let[,e]=Q.useState({});return Q.useCallback(()=>{e({})},[])}function Gn(e){let t=ye(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=S(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r;return(_t(n)!==a||_t(r)!==o)&&(n=a,r=o),{width:n,height:r}}function Kn(e){let{popupElement:t,positionerElement:r,content:i,mounted:a,onMeasureLayout:o,onMeasureLayoutComplete:c,side:l,direction:u}=e,d=h(t,!0,!1),f=je(),p=Q.useRef(null),m=Q.useRef(!0),g=Q.useRef(s),_=q(o),v=q(c),y=Q.useMemo(()=>{let e=l===`top`,t=l===`left`;return u===`rtl`?(e||=l===`inline-end`,t||=l===`inline-end`):(e||=l===`inline-start`,t||=l===`inline-start`),e?{position:`absolute`,[l===`top`?`bottom`:`top`]:`0`,[t?`right`:`left`]:`0`}:n},[l,u]);J(()=>{if(!a){g.current=s,m.current=!0,p.current=null;return}if(!t||!r)return;g.current=Jn(t,y),Yn(t,`auto`);let e=qn(t,`position`,`static`),n=qn(t,`transform`,`none`),i=qn(t,`scale`,`1`),o=Jn(r,{"--available-width":`max-content`,"--available-height":`max-content`});function c(){e(),n(),o()}function l(){c(),i()}if(_?.(),m.current||p.current===null){Xn(r,`max-content`);let e=Gn(t);return p.current=e,Xn(r,e),l(),v?.(null,e),m.current=!1,()=>{g.current(),g.current=s}}Xn(r,`max-content`);let u=p.current,h=Gn(t);p.current=h,Yn(t,u),l(),v?.(u,h),Xn(r,h);let b=new AbortController;return f.request(()=>{Yn(t,h),d(()=>{t.style.setProperty(`--popup-width`,`auto`),t.style.setProperty(`--popup-height`,`auto`)},b.signal)}),()=>{b.abort(),f.cancel(),g.current(),g.current=s}},[i,t,r,d,f,a,_,v,y])}function qn(e,t,n){let r=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{e.style.setProperty(t,r)}}function Jn(e,t){let n=[];for(let[r,i]of Object.entries(t))n.push(qn(e,r,i));return n.length?()=>{n.forEach(e=>e())}:s}function Yn(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 Xn(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)}var Zn=t(we(),1),$=i();function Qn(e){let{store:t,side:n,cssVars:r,children:i}=e,a=ve(),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=dt(c?o:null),m=nr(s,l),g=Q.useRef(null),[_,v]=Q.useState(null),[y,b]=Q.useState(null),x=Q.useRef(null),S=Q.useRef(null),C=h(x,!0,!1),w=je(),[T,E]=Q.useState(null),[D,O]=Q.useState(!1);J(()=>(t.set(`hasViewport`,!0),()=>{t.set(`hasViewport`,!1)}),[t]);let k=q(()=>{x.current?.style.setProperty(`animation`,`none`),x.current?.style.setProperty(`transition`,`none`),S.current?.style.setProperty(`display`,`none`)}),A=q(e=>{x.current?.style.removeProperty(`animation`),x.current?.style.removeProperty(`transition`),S.current?.style.removeProperty(`display`),e&&E(e)}),j=Q.useRef(null);J(()=>{(!c||!u)&&(j.current=null)},[c,u]),J(()=>{if(o&&p&&o!==p&&j.current!==o&&g.current){v(g.current),O(!0);let e=tr(p,o);b(e),w.request(()=>{Zn.flushSync(()=>{O(!1)}),C(()=>{v(null),E(null),g.current=null})}),j.current=o}},[o,p,_,C,w]),J(()=>{let e=x.current;if(!e)return;let t=Ce(e).createElement(`div`);for(let n of Array.from(e.childNodes))t.appendChild(n.cloneNode(!0));g.current=t});let M=_!=null,N;N=M?(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(`div`,{"data-previous":!0,inert:le(!0),ref:S,style:{...T?{[r.popupWidth]:`${T.width}px`,[r.popupHeight]:`${T.height}px`}:null,position:`absolute`},"data-ending-style":D?void 0:``},`previous`),(0,$.jsx)(`div`,{"data-current":!0,ref:x,"data-starting-style":D?``:void 0,children:i},m)]}):(0,$.jsx)(`div`,{"data-current":!0,ref:x,children:i},m),J(()=>{let e=S.current;!e||!_||e.replaceChildren(...Array.from(_.childNodes))},[_]),Kn({popupElement:d,positionerElement:f,mounted:u,content:l,onMeasureLayout:k,onMeasureLayoutComplete:A,side:n,direction:a});let P={activationDirection:$n(y),transitioning:M};return{children:N,state:P}}function $n(e){if(e)return`${er(e.horizontal,5,`right`,`left`)} ${er(e.vertical,5,`down`,`up`)}`}function er(e,t,n,r){return e>t?n:e<-t?r:``}function tr(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 nr(e,t){let[n,r]=Q.useState(0),i=Q.useRef(e),a=Q.useRef(t),o=Q.useRef(!1);return J(()=>{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 rr=Q.createContext(void 0);function ir(){let e=Q.useContext(rr);if(e===void 0)throw Error(u(64));return e}var ar=function(e){return e.activationDirection=`data-activation-direction`,e.orientation=`data-orientation`,e}({}),or={tabActivationDirection:e=>({[ar.activationDirection]:e})},sr=Q.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=Q.useRef([]),[p,m]=Q.useState(()=>new Map),[h,g]=M({controlled:c,default:r,name:`Tabs`,state:`value`}),_=c!==void 0,[v,y]=Q.useState(()=>new Map),b=Q.useRef(void 0),x=Q.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,C]=Q.useState(()=>({previousValue:h,tabActivationDirection:`none`})),{previousValue:w,tabActivationDirection:E}=S,O=E,k=!1;w!==h&&(O=cr(w,h,a,v),k=w!=null&&h!=null&&x(h)==null);let A=k?w:h,j=w!==A||E!==O;J(()=>{j&&C({previousValue:A,tabActivationDirection:O})},[A,j,O]);let N=q((e,t)=>{t.activationDirection=cr(h,e,a,v),i?.(e,t),!t.isCanceled&&g(e)}),P=q((e,t)=>{i?.(e,Oe(t,void 0,void 0,{activationDirection:`none`}))}),F=q((e,t)=>{m(n=>{if(n.get(e)===t)return n;let r=new Map(n);return r.set(e,t),r})}),I=q((e,t)=>{m(n=>{if(!n.has(e)||n.get(e)!==t)return n;let r=new Map(n);return r.delete(e),r})}),ee=Q.useCallback(e=>p.get(e),[p]),L=Q.useCallback(e=>{for(let t of v.values())if(e===t?.value)return t?.id},[v]),te=Q.useMemo(()=>({getTabElementBySelectedValue:x,getTabIdByPanelValue:L,getTabPanelIdByValue:ee,onValueChange:N,orientation:a,registerMountedTabPanel:F,setTabMap:y,unregisterMountedTabPanel:I,tabActivationDirection:O,value:h}),[x,L,ee,N,a,F,y,I,O,h]),ne=Q.useMemo(()=>{for(let e of v.values())if(e!=null&&e.value===h)return e},[v,h]),R=Q.useMemo(()=>{for(let e of v.values())if(e!=null&&!e.disabled)return e.value},[v]),re=Q.useRef(!d),z=Q.useRef(r),ie=Q.useRef(d),ae=Q.useRef(!1);J(()=>{if(_)return;function e(e,t){g(e),C(t=>t.previousValue===e&&t.tabActivationDirection===`none`?t:{previousValue:e,tabActivationDirection:`none`}),P(e,t),re.current=!1}if(v.size===0){ae.current&&h!==null&&!b.current?.isConnected&&e(null,D);return}ae.current=!0,b.current=v.keys().next().value;let t=ne?.disabled,n=ne==null&&h!==null;if(!t&&h===z.current&&(ie.current=!1),ie.current&&t&&h===z.current)return;let r=re.current;if(t||n){let n=R??null;if(h===n){re.current=!1;return}let i=D;r?i=Ve:t&&(i=T),e(n,i);return}r&&ne!=null&&(P(h,Ve),re.current=!1)},[R,_,P,ne,g,v,h]);let B=o(`div`,e,{state:{orientation:a,tabActivationDirection:O},ref:t,props:u,stateAttributesMapping:or});return(0,$.jsx)(rr.Provider,{value:te,children:(0,$.jsx)(st,{elementsRef:f,children:B})})});function cr(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 lr=`data-composite-item-active`,ur=Q.createContext(void 0);function dr(){let e=Q.useContext(ur);if(e===void 0)throw Error(u(65));return e}var fr=Q.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}=ir(),{activateOnFocus:h,highlightedTabIndex:g,onTabActivation:_,registerTabResizeObserverElement:y,setHighlightedTabIndex:b,tabsListElement:x}=dr(),S=be(s),{compositeProps:C,compositeRef:w,index:T}=an({metadata:Q.useMemo(()=>({disabled:r,id:S,value:a}),[r,S,a])}),E=a===d,D=Q.useRef(!1),O=Q.useRef(null);J(()=>{let e=O.current;if(e)return y(e)},[y]),J(()=>{if(D.current){D.current=!1;return}if(!(E&&T>-1&&g!==T))return;let e=x;if(e!=null){let t=He(Ce(e));if(t&&v(e,t))return}r||b(T)},[E,T,g,b,r,x]);let{getButtonProps:k,buttonRef:A}=Pe({disabled:r,native:c,focusableWhenDisabled:!0}),j=f(a),M=Q.useRef(!1),N=Q.useRef(!1);function P(e){E||r||_(a,Oe(B,e.nativeEvent,void 0,{activationDirection:`none`}))}function F(e){E||(T>-1&&!r&&b(T),!r&&h&&(!M.current||M.current&&N.current)&&_(a,Oe(B,e.nativeEvent,void 0,{activationDirection:`none`})))}function I(e){if(E||r)return;M.current=!0;function t(){M.current=!1,N.current=!1}(!e.button||e.button===0)&&(N.current=!0,Ce(e.currentTarget).addEventListener(`pointerup`,t,{once:!0}))}return o(`button`,e,{state:{disabled:r,active:E,orientation:p,tabActivationDirection:m},ref:[t,A,w,O],props:[C,{role:`tab`,"aria-controls":j,"aria-selected":E,id:S,onClick:P,onFocus:F,onPointerDown:I,[lr]:E?``:void 0,onKeyDownCapture(){D.current=!0}},u,k],stateAttributesMapping:or})}),pr=V();function mr(){return s}function hr(){return!1}function gr(){return!0}function _r(){return(0,pr.useSyncExternalStore)(mr,hr,gr)}var vr=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}({}),yr={...or,activeTabPosition:()=>null,activeTabSize:()=>null},br=Q.forwardRef(function(e,t){let{className:n,render:r,renderBeforeHydration:i=!1,style:a,...s}=e,{nonce:c}=Ae(),{getTabElementBySelectedValue:l,orientation:u,tabActivationDirection:d,value:f}=ir(),{tabsListElement:p,registerIndicatorUpdateListener:m}=dr(),h=_r(),g=Wn();Q.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}=Gn(e),{width:r,height:i}=Gn(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?{[vr.activeTabLeft]:`${_}px`,[vr.activeTabRight]:`${v}px`,[vr.activeTabTop]:`${y}px`,[vr.activeTabBottom]:`${b}px`,[vr.activeTabWidth]:`${x}px`,[vr.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:yr});return f==null?null:(0,$.jsxs)(Q.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})]})}),xr=function(e){return e.index=`data-index`,e.activationDirection=`data-activation-direction`,e.orientation=`data-orientation`,e.hidden=`data-hidden`,e[e.startingStyle=he.startingStyle]=`startingStyle`,e[e.endingStyle=he.endingStyle]=`endingStyle`,e}({}),Sr={...or,...Me},Cr=Q.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}=ir(),h=be(),{ref:g,index:_}=gt({metadata:Q.useMemo(()=>({id:h,value:r}),[h,r])}),v=r===l,{mounted:y,transitionStatus:b,setMounted:x}=U(v),S=!y,C=u(r),w={hidden:S,orientation:d,tabActivationDirection:f,transitionStatus:b},T=Q.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:le(!v),[xr.index]:_},c],stateAttributesMapping:Sr});return L({open:v,ref:T,onComplete(){v||x(!1)}}),J(()=>{if(!(S&&!a)&&h!=null)return p(r,h),()=>{m(r,h)}},[S,a,r,h,p,m]),a||y?E:null}),wr=[];function Tr(e){let{loopFocus:t=!0,orientation:n=`both`,grid:i,onLoop:a,direction:o,highlightedIndex:s,onHighlightedIndexChange:c,rootRef:l,enableHomeAndEndKeys:u=!1,stopEventPropagation:d=!1,disabledIndices:f,modifierKeys:p=wr}=e,[m,h]=Q.useState(0),_=i!=null,v=Q.useRef(null),b=r(v,l),S=Q.useRef([]),C=Q.useRef(!1),w=s??m,T=q((e,t=!1)=>{if((c??h)(e),t){let t=S.current[e];xe(v.current,t,o,n)}}),E=q(e=>{if(e.size===0||C.current)return;C.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)T(i);else if(ie(t,w,f)){let e=fe(t,{disabledIndices:f});Ie(t,e)||T(e)}xe(v.current,r,o,n)});J(()=>{if(f==null||s!=null||!C.current)return;let e=S.current;if(ie(e,w,f)){let t=fe(e,{disabledIndices:f});Ie(e,t)||T(t)}},[f,s,w,S,T]);let D=q((e,t,n)=>a?a(e,t,n,S):n),O=q(e=>{let r=u?y:ze;if(!r.has(e.key)||Er(e,p)||!v.current)return;let s=o===`rtl`,c=s?de:Le,l={horizontal:c,vertical:Fe,both:c}[n],m=s?Le:de,h={horizontal:m,vertical:R,both:m}[n],b=se(e.nativeEvent);if(b!=null&&g(b)&&!mt(b)){let t=b.selectionStart,n=b.selectionEnd,r=b.value??``;if(t==null||e.shiftKey||t!==n||e.key!==h&&t<r.length||e.key!==l&&t>0)return}let C=w,E=re(S,f),O=Re(S,f);i!=null&&(C=i({disabledIndices:f,elementsRef:S,event:e,highlightedIndex:w,loopFocus:t,maxIndex:O,minIndex:E,onLoop:D,orientation:n,rtl:s}));let k={horizontal:[c],vertical:[Fe],both:[c,Fe]}[n],A={horizontal:[m],vertical:[R],both:[m,R]}[n],j=_?r:{horizontal:u?x:z,vertical:u?Se:P,both:r}[n];u&&(e.key===`Home`?C=E:e.key===`End`&&(C=O)),C===w&&(k.includes(e.key)||A.includes(e.key))&&(t&&C===O&&k.includes(e.key)?(C=E,a&&(C=a(e,w,C,S))):t&&C===E&&A.includes(e.key)?(C=O,a&&(C=a(e,w,C,S))):C=fe(S.current,{startingIndex:C,decrement:A.includes(e.key),disabledIndices:f})),C!==w&&!Ie(S.current,C)&&(d&&e.stopPropagation(),j.has(e.key)&&e.preventDefault(),T(C,!0),queueMicrotask(()=>{S.current[C]?.focus()}))});return{props:{ref:b,onFocus(e){let t=v.current,n=se(e.nativeEvent);!t||n==null||!g(n)||n.setSelectionRange(0,n.value.length??0)},onKeyDown:O},highlightedIndex:w,onHighlightedIndexChange:T,elementsRef:S,disabledIndices:f,onMapChange:E,relayKeyboardEvent:O}}function Er(e,t){for(let n of b.values())if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function Dr(e){let{render:t,className:r,style:i,refs:a=d,props:s=d,state:c=n,stateAttributesMapping:l,highlightedIndex:u,onHighlightedIndexChange:f,orientation:p,grid:m,loopFocus:h,onLoop:g,enableHomeAndEndKeys:_,onMapChange:v,stopEventPropagation:y=!0,rootRef:b,disabledIndices:x,modifierKeys:S,highlightItemOnHover:C=!1,tag:w=`div`,...T}=e,{props:E,highlightedIndex:D,onHighlightedIndexChange:O,elementsRef:k,onMapChange:A,relayKeyboardEvent:j}=Tr({grid:m,loopFocus:h,onLoop:g,orientation:p,highlightedIndex:u,onHighlightedIndexChange:f,rootRef:b,stopEventPropagation:y,enableHomeAndEndKeys:_,direction:ve(),disabledIndices:x,modifierKeys:S}),M=o(w,e,{state:c,ref:a,props:[E,...s,T],stateAttributesMapping:l}),N=Q.useMemo(()=>({highlightedIndex:D,onHighlightedIndexChange:O,highlightItemOnHover:C,relayKeyboardEvent:j}),[D,O,C,j]);return(0,$.jsx)(me.Provider,{value:N,children:(0,$.jsx)(st,{elementsRef:k,onMapChange:e=>{v?.(e),A(e)},children:M})})}var Or=Q.forwardRef(function(e,t){let{activateOnFocus:n=!1,className:r,loopFocus:i=!0,render:a,style:o,...s}=e,{onValueChange:c,orientation:l,value:u,setTabMap:f,tabActivationDirection:p}=ir(),[m,h]=Q.useState(0),[g,_]=Q.useState(null),v=Q.useRef(new Set),y=Q.useRef(new Set),b=Q.useRef(null);J(()=>{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=q(e=>(v.current.add(e),()=>{v.current.delete(e)})),S=q(e=>(y.current.add(e),b.current?.observe(e),()=>{y.current.delete(e),b.current?.unobserve(e)})),C=q((e,t)=>{e!==u&&c(e,t)}),w={orientation:l,tabActivationDirection:p},T={"aria-orientation":l===`vertical`?`vertical`:void 0,role:`tablist`},E=Q.useMemo(()=>({activateOnFocus:n,highlightedTabIndex:m,registerIndicatorUpdateListener:x,registerTabResizeObserverElement:S,onTabActivation:C,setHighlightedTabIndex:h,tabsListElement:g}),[n,m,x,S,C,h,g]);return(0,$.jsx)(ur.Provider,{value:E,children:(0,$.jsx)(Dr,{render:a,className:r,style:o,state:w,refs:[t,_],props:[T,s],stateAttributesMapping:or,highlightedIndex:m,enableHomeAndEndKeys:!0,loopFocus:i,orientation:l,onHighlightedIndexChange:h,onMapChange:f,disabledIndices:d})})});function kr({className:e,...t}){return(0,$.jsx)(sr,{className:c(`flex flex-col gap-4`,e),"data-slot":`tabs`,...t})}function Ar({className:e,...t}){return(0,$.jsxs)(Or,{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)(br,{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 jr({className:e,...t}){return(0,$.jsx)(fr,{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 Mr({className:e,...t}){return(0,$.jsx)(Cr,{className:c(`flex-1 outline-none`,e),"data-slot":`tabs-panel`,...t})}var Nr=Q.createContext(void 0);function Pr(e){let t=Q.useContext(Nr);if(t===void 0&&!e)throw Error(u(47));return t}function Fr(){return{...hn(),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 Ir={...Wt,disabled:I(e=>e.disabled),instantType:I(e=>e.instantType),openMethod:I(e=>e.openMethod),openChangeReason:I(e=>e.openChangeReason),modal:I(e=>e.modal),focusManagerModal:I(e=>e.focusManagerModal),stickIfOpen:I(e=>e.stickIfOpen),titleElementId:I(e=>e.titleElementId),descriptionElementId:I(e=>e.descriptionElementId),openOnHover:I(e=>e.openOnHover),closeDelay:I(e=>e.closeDelay),hasViewport:I(e=>e.hasViewport)},Lr=class e extends k{constructor(e,t,n=!1){let r={...Fr(),...e},i=new j;r.open&&e?.mounted===void 0&&(r.mounted=!0),r.floatingRootContext=yn(i,t,n),super(r,{popupRef:Q.createRef(),backdropRef:Q.createRef(),internalBackdropRef:Q.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:Q.createRef(),beforeContentFocusGuardRef:Q.createRef(),stickIfOpenTimeout:new ce,triggerElements:i},Ir)}setOpen=(e,t)=>{let n=t.reason===De,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=F(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};O(n,e,t.trigger,a()),this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),Zn.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}=E(t,(t,r)=>new e(n,t,r));return Q.useEffect(()=>i?.disposeEffect(),[i]),r}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()};function Rr({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=Lr.useStore(s?.store,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});te(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=ue()!=null;u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a),oe(u,d),A(u);let{forceUnmount:h}=Be(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null})});u.useSyncedValues({modal:o,nested:m}),Q.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]);let g=Q.useCallback(()=>{u.setOpen(!1,Oe(ne))},[u]);Q.useImperativeHandle(e.actionsRef,()=>({unmount:h,close:g}),[h,g]);let _=d||f,v=Q.useMemo(()=>({store:u}),[u]);return(0,$.jsxs)(Nr.Provider,{value:v,children:[_&&(0,$.jsx)(Br,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})}function zr(e){return Pr(!0)?(0,$.jsx)(Rr,{props:e}):(0,$.jsx)(ke,{children:(0,$.jsx)(Rr,{props:e})})}function Br({store:e,modal:t}){let r=ge(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}});return _(e,{activeTriggerProps:r.reference??n,inactiveTriggerProps:r.trigger??n,popupProps:Q.useMemo(()=>l(N,r.floating),[r.floating])}),null}var Vr=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:s=!0,handle:c,payload:l,openOnHover:d=!1,delay:f=300,closeDelay:p=0,id:h,...g}=e,_=Pr(!0),v=c?.store??_?.store;if(!v)throw Error(u(74));let y=be(h),b=v.useState(`isTriggerActive`,y),x=v.useState(`floatingRootContext`),S=v.useState(`isOpenedByTrigger`,y),w=v.useState(`triggerPopupId`,y),T=Q.useRef(null),{registerTrigger:E,isMountedByThisTrigger:D}=ae(y,T,v,{payload:l,disabled:a,openOnHover:d,closeDelay:p}),O=v.useState(`openChangeReason`),k=v.useState(`stickIfOpen`),A=v.useState(`openMethod`),j=v.useState(`focusManagerModal`),M=Zt(x,{enabled:!a&&x!=null&&d&&(A!==`touch`||O!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:Qt(),restMs:f,delay:{close:p},triggerElementRef:T,isActiveTrigger:b,isClosing:()=>v.select(`transitionStatus`)===`ending`}),N=at(x,{enabled:x!=null,stickIfOpen:k}),P=ot(()=>v.select(`open`),e=>{v.set(`openMethod`,e)}),F=v.useState(`triggerProps`,D),{getButtonProps:I,buttonRef:L}=Pe({disabled:a,native:s}),te={open(e){return e&&O===`trigger-press`?ee.open(e):m.open(e)}},{preFocusGuardRef:ne,handlePreFocusGuardFocus:R,handleFocusTargetFocus:re}=ln(v,T),z=o(`button`,e,{state:{disabled:a,open:S},ref:[L,t,E,T],props:[N.reference,M,F,P,{[K]:``,id:y,"aria-haspopup":`dialog`,"aria-expanded":S,"aria-controls":w},g,I],stateAttributesMapping:te});return D&&!j?(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(C,{ref:ne,onFocus:R}),(0,$.jsx)(Q.Fragment,{children:z},y),(0,$.jsx)(C,{ref:v.context.triggerFocusTargetRef,onFocus:re})]}):(0,$.jsx)(Q.Fragment,{children:z},y)}),Hr=Q.createContext(void 0);function Ur(){let e=Q.useContext(Hr);if(e===void 0)throw Error(u(45));return e}var Wr=Q.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Pr();return i.useState(`mounted`)||n?(0,$.jsx)(Hr.Provider,{value:n,children:(0,$.jsx)(pe,{ref:t,...r})}):null}),Gr=Q.createContext(void 0);function Kr(){let e=Q.useContext(Gr);if(!e)throw Error(u(46));return e}var qr=Q.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:g=!1,collisionAvoidance:_=_e,...v}=e,{store:y}=Pr(),b=Ur(),x=G(),S=y.useState(`floatingRootContext`),C=y.useState(`mounted`),w=y.useState(`open`),T=y.useState(`openChangeReason`),E=y.useState(`activeTriggerElement`),D=y.useState(`modal`),O=y.useState(`openMethod`),k=y.useState(`positionerElement`),A=y.useState(`instantType`),j=y.useState(`transitionStatus`),M=y.useState(`hasViewport`),N=Q.useRef(null),P=h(k,!1,!1),F=ut({anchor:a,floatingRootContext:S,positionMethod:o,mounted:C,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:g,keepMounted:b,nodeId:x,collisionAvoidance:_,adaptiveOrigin:M?ht:void 0}),I=S.useState(`domReferenceElement`);J(()=>{let e=I,t=N.current;if(e&&(N.current=e),t&&e&&e!==t){y.set(`instantType`,void 0);let e=new AbortController;return P(()=>{y.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[I,P,y]),ft(w&&D===!0&&T!==`trigger-hover`,O===`touch`,k,E);let ee=Q.useCallback(e=>{y.set(`positionerElement`,e)},[y]),L=pt(e,{open:w,side:F.side,align:F.align,anchorHidden:F.anchorHidden,instant:A},{styles:F.positionerStyles,transitionStatus:j,props:v,refs:[t,ee],hidden:!C,inert:!w});return(0,$.jsxs)(Gr.Provider,{value:F,children:[C&&D===!0&&T!==`trigger-hover`&&(0,$.jsx)(W,{ref:y.context.internalBackdropRef,inert:le(!w),cutout:E}),(0,$.jsx)(Te,{id:x,children:L})]})}),Jr=Q.createContext(void 0);function Yr(){let[e,t]=Q.useState(0),n=q(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:Q.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}function Xr(e){let{value:t,children:n}=e;return(0,$.jsx)(Jr.Provider,{value:t,children:n})}var Zr={...H,...Me},Qr=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:s,...c}=e,{store:l}=Pr(),u=Kr(),d=lt(!0)!=null,{context:f,hasClosePart:p}=Yr(),m=l.useState(`open`),h=l.useState(`openMethod`),g=l.useState(`instantType`),_=l.useState(`transitionStatus`),v=l.useState(`popupProps`),b=l.useState(`titleElementId`),x=l.useState(`descriptionElementId`),C=l.useState(`modal`),T=l.useState(`mounted`),E=l.useState(`openChangeReason`),D=l.useState(`activeTriggerElement`),O=l.useState(`floatingRootContext`),k=O.useState(`floatingId`),A=l.useState(`disabled`),j=l.useState(`openOnHover`),M=l.useState(`closeDelay`),P=c.id??k;L({open:m,ref:l.context.popupRef,onComplete(){m&&l.context.onOpenChangeComplete?.(!0)}}),Ht(O,{enabled:j&&!A,closeDelay:M});let F=a===void 0?w(l.context.popupRef):a,I=C!==!1&&p;l.useSyncedValue(`focusManagerModal`,I);let ee=Q.useCallback(e=>{l.set(`popupElement`,e)},[l]),te=o(`div`,e,{state:{open:m,side:u.side,align:u.align,instant:g,transitionStatus:_},ref:[t,l.context.popupRef,ee],props:[v,{id:P,role:`dialog`,...N,"aria-labelledby":b,"aria-describedby":x,onKeyDown(e){d&&y.has(e.key)&&e.stopPropagation()}},ct(_),c],stateAttributesMapping:Zr});return(0,$.jsx)(Ne,{context:O,openInteractionType:h,modal:I,disabled:!T||E===`trigger-hover`,initialFocus:F,returnFocus:s,restoreFocus:`popup`,previousFocusableElement:S(D)?D:void 0,nextFocusableElement:l.context.triggerFocusTargetRef,beforeContentFocusGuardRef:l.context.beforeContentFocusGuardRef,children:(0,$.jsx)(Xr,{value:f,children:te})})}),$r=function(e){return e.popupWidth=`--popup-width`,e.popupHeight=`--popup-height`,e}({}),ei={activationDirection:e=>e?{"data-activation-direction":e}:null},ti=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...s}=e,{store:c}=Pr(),{side:l}=Kr(),u=c.useState(`instantType`),{children:d,state:f}=Qn({store:c,side:l,cssVars:$r,children:a});return o(`div`,e,{state:{activationDirection:f.activationDirection,transitioning:f.transitioning,instant:u},ref:t,props:[s,{children:d}],stateAttributesMapping:ei})}),ni=zr;function ri({className:e,children:t,...n}){return(0,$.jsx)(Vr,{className:e,"data-slot":`popover-trigger`,...n,children:t})}function ii({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)(Wr,{children:(0,$.jsx)(qr,{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)(Qr,{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)(ti,{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 ai({repos:e,disabled:t,onAdd:n}){let[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(``),s=(0,Q.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)(ni,{open:r,onOpenChange:e=>{e&&o(``),i(e)},children:[(0,$.jsx)(ri,{render:(0,$.jsxs)(f,{variant:`outline`,size:`sm`,disabled:t,className:`h-8 text-xs text-muted-foreground`,children:[(0,$.jsx)(Bt,{size:14}),` Add repository`]})}),(0,$.jsxs)(ii,{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)(Ee,{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 oi=(e,t)=>{switch(e){case`antigravity`:return`agy --conversation ${t}`;case`claude`:return`claude --resume ${t}`;case`codex`:return`codex resume ${t}`;case`copilot`:return`copilot --resume ${t}`;default:return`agy --conversation ${t}`}},si=e=>{switch(e){case`antigravity`:return(0,$.jsx)(`span`,{className:`grid size-5.5 place-items-center rounded-md bg-card border border-border/80 shadow-2xs p-0.5 shrink-0`,title:`Google Antigravity`,children:(0,$.jsx)(vn,{className:`size-3.5`})});case`claude`:return(0,$.jsx)(`span`,{className:`grid size-5.5 place-items-center rounded-md bg-[#D97757] text-white font-bold text-[9px] shadow-2xs shrink-0`,title:`Claude Code`,children:(0,$.jsx)(It,{className:`size-2.5`})});case`codex`:return(0,$.jsx)(`span`,{className:`grid size-5.5 place-items-center rounded-md bg-foreground text-background font-bold text-[9px] shadow-2xs shrink-0`,title:`OpenAI Codex`,children:(0,$.jsx)(tn,{className:`size-2.5`})});case`copilot`:return(0,$.jsx)(`span`,{className:`grid size-5.5 place-items-center rounded-md bg-gradient-to-tr from-purple-600 via-indigo-500 to-blue-600 text-white font-bold text-[9px] shadow-2xs shrink-0`,title:`GitHub Copilot`,children:(0,$.jsx)(_n,{className:`size-2.5`})});default:return null}},ci=e=>{if(!e)return``;let t=new Date(e);return isNaN(t.getTime())?``:new Date().toDateString()===t.toDateString()?`Today ${t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}`:`${t.toLocaleDateString(void 0,{month:`short`,day:`numeric`})} ${t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}`},li=({ws:e,sessions:t,sessionsLoading:n,setActiveSession:r,setTranscript:i,fetchSessionTranscript:a,handleOpenDesktopSession:o,showToast:s})=>{let l=fn(),u=Lt(),d=kt(),p=d.data?.find(e=>e.name===`antigravity`)?.detected??!0,m=d.data?.find(e=>e.name===`claude`)?.detected??!1,h=d.data?.find(e=>e.name===`codex`)?.detected??!1,g=d.data?.find(e=>e.name===`copilot`)?.detected??!1,_=!!l.data?.some(e=>e.id===`antigravity`&&e.available),v=!!l.data?.some(e=>e.id===`codex-desktop`&&e.available),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(null),[T,E]=(0,Q.useState)(null),[D,O]=(0,Q.useState)(`created-desc`),[k,A]=(0,Q.useState)(`harness`),[j,M]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(`all`),[F,I]=(0,Q.useState)({antigravity:!1,claude:!1,codex:!1,copilot:!1}),ee=e=>{I(t=>({...t,[e]:!t[e]}))},L=(0,Q.useRef)(!1),te=(0,Q.useRef)(null),ne=async t=>{try{await Gt(`/api/workspace/${encodeURIComponent(e.branchName)}/launch`,{method:`POST`,body:JSON.stringify({targetId:t})}),s?.(`Launched ${t===`claude-desktop`?`Claude Desktop`:t===`codex-desktop`?`Codex Desktop`:t} for workspace ${e.branchName}`,`success`)}catch(e){let t=e instanceof Error?e.message:`Failed to launch desktop application`;s?.(t,`error`)}},R=async t=>{if(!C){w(t);try{await u.mutateAsync({workspaceId:e.branchName,assistant:t}),E({assistant:t,cmd:t===`antigravity`?`agy`:t===`claude`?`claude`:t===`codex`?`codex`:`copilot`,timestamp:new Date}),s?.(`Started new ${t} session in terminal`,`success`)}catch(e){let t=e instanceof Error?e.message:`Failed to launch terminal`;s?.(t,`error`)}finally{w(null)}}},re=async(t,n)=>{if(!L.current){L.current=!0,S(t);try{await u.mutateAsync({workspaceId:e.branchName,sessionId:t,assistant:n});let r=oi(n,t);E({assistant:n,cmd:r,timestamp:new Date}),s?.(`Resumed ${n} session in terminal`,`success`)}catch{let e=oi(n,t);await pn(e),s?.(`Copied resume command to clipboard: ${e}`,`info`)}finally{S(null),L.current=!1}}},z=async t=>{if(!(!v||te.current)){te.current=t,b(t);try{await o(e,t,`codex`)}finally{te.current=null,b(null)}}},ie=(e,t)=>[...e].sort((e,n)=>{switch(t){case`created-desc`:{let t=new Date(e.createdAt||e.updatedAt||0).getTime();return new Date(n.createdAt||n.updatedAt||0).getTime()-t}case`created-asc`:return new Date(e.createdAt||e.updatedAt||0).getTime()-new Date(n.createdAt||n.updatedAt||0).getTime();case`updated-desc`:{let t=new Date(e.updatedAt||e.createdAt||0).getTime();return new Date(n.updatedAt||n.createdAt||0).getTime()-t}case`messages-desc`:return(n.messageCount||0)-(e.messageCount||0);case`title-asc`:return(e.title||``).localeCompare(n.title||``);default:return 0}}),ae=(0,Q.useMemo)(()=>{let e=t;if(N!==`all`&&(e=e.filter(e=>e.assistant===N)),j.trim()){let t=j.toLowerCase();e=e.filter(e=>`${e.title} ${e.id} ${e.assistant}`.toLowerCase().includes(t))}return ie(e,D)},[t,N,j,D]),B=(0,Q.useMemo)(()=>ie(t.filter(e=>e.assistant===`antigravity`),D),[t,D]),oe=(0,Q.useMemo)(()=>ie(t.filter(e=>e.assistant===`claude`),D),[t,D]),se=(0,Q.useMemo)(()=>ie(t.filter(e=>e.assistant===`codex`),D),[t,D]),ce=(0,Q.useMemo)(()=>ie(t.filter(e=>e.assistant===`copilot`),D),[t,D]),V=t=>e.assistants?.includes(t)??!1,H=[{id:`antigravity`,name:`Google Antigravity`,cliCommand:`agy`,isDetected:p,isConfigured:V(`antigravity`),hasApp:_,appName:`IDE`,appTargetId:`antigravity`,sessions:B,icon:(0,$.jsx)(`span`,{className:`grid size-6 place-items-center rounded-md bg-card border border-border/80 shadow-2xs p-0.5`,children:(0,$.jsx)(vn,{className:`size-4`})})},{id:`claude`,name:`Claude Code`,cliCommand:`claude`,isDetected:m,isConfigured:V(`claude`),hasApp:!1,appName:`App`,appTargetId:`claude`,sessions:oe,icon:(0,$.jsx)(`span`,{className:`grid size-6 place-items-center rounded-md bg-[#D97757] text-white font-bold text-[10px] shadow-2xs`,children:(0,$.jsx)(It,{className:`size-3`})})},{id:`codex`,name:`OpenAI Codex`,cliCommand:`codex`,isDetected:h,isConfigured:V(`codex`),hasApp:v,appName:`Desktop`,appTargetId:`codex-desktop`,sessions:se,icon:(0,$.jsx)(`span`,{className:`grid size-6 place-items-center rounded-md bg-foreground text-background font-bold text-[10px] shadow-2xs`,children:(0,$.jsx)(tn,{className:`size-3`})})},{id:`copilot`,name:`GitHub Copilot`,cliCommand:`copilot`,isDetected:g,isConfigured:V(`copilot`),hasApp:!1,appName:`App`,appTargetId:`copilot`,sessions:ce,icon:(0,$.jsx)(`span`,{className:`grid size-6 place-items-center rounded-md bg-gradient-to-tr from-purple-600 via-indigo-500 to-blue-600 text-white font-bold text-[10px] shadow-2xs`,children:(0,$.jsx)(_n,{className:`size-3`})})}];return(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between bg-card/60 p-2 rounded-md border border-border/80`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`relative flex-1 min-w-0 max-w-xs`,children:[(0,$.jsx)(wt,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 size-3 text-muted-foreground`}),(0,$.jsx)(`input`,{type:`text`,value:j,onChange:e=>M(e.target.value),placeholder:`Search chat sessions...`,className:`w-full pl-7 pr-6 py-1 text-xs rounded border border-border bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:border-primary`}),j&&(0,$.jsx)(`button`,{type:`button`,onClick:()=>M(``),className:`absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground text-[10px] cursor-pointer`,children:`✕`})]}),(0,$.jsxs)(`div`,{className:`hidden md:flex items-center gap-1`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>P(`all`),className:c(`px-2 py-0.5 text-[11px] rounded font-medium transition-colors cursor-pointer`,N===`all`?`bg-primary text-primary-foreground font-semibold shadow-2xs`:`bg-muted/60 text-muted-foreground hover:text-foreground hover:bg-muted`),children:[`All (`,t.length,`)`]}),[`antigravity`,`claude`,`codex`,`copilot`].map(e=>{let n=t.filter(t=>t.assistant===e).length;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>P(N===e?`all`:e),className:c(`px-2 py-0.5 text-[11px] rounded font-medium capitalize transition-colors cursor-pointer`,N===e?`bg-primary text-primary-foreground font-semibold shadow-2xs`:`bg-muted/60 text-muted-foreground hover:text-foreground hover:bg-muted`),children:[e,` (`,n,`)`]},e)})]}),n&&(0,$.jsx)(`span`,{className:`flex items-center gap-1 text-xs text-muted-foreground shrink-0 pl-1`,children:(0,$.jsx)(X,{className:`size-3`})})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,$.jsxs)(rn,{children:[(0,$.jsxs)(Xt,{className:`flex items-center gap-1.5 px-2 py-1 text-xs font-medium rounded border border-border bg-card text-foreground hover:bg-accent cursor-pointer shadow-2xs transition-colors`,children:[(0,$.jsx)(yt,{size:11,className:`text-muted-foreground`}),(0,$.jsx)(`span`,{children:{"created-desc":`Newest`,"created-asc":`Oldest`,"updated-desc":`Recently active`,"messages-desc":`Most turns`,"title-asc":`A–Z`}[D]}),(0,$.jsx)(We,{size:10,className:`text-muted-foreground opacity-70`})]}),(0,$.jsxs)(qt,{align:`end`,className:`w-48`,children:[(0,$.jsx)(`div`,{className:`px-2 py-1 text-[10px] font-semibold text-muted-foreground uppercase tracking-wider`,children:`Order Chats By`}),(0,$.jsxs)(Z,{onClick:()=>O(`created-desc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Newest created`}),D===`created-desc`&&(0,$.jsx)(Y,{size:12,className:`text-primary`})]}),(0,$.jsxs)(Z,{onClick:()=>O(`created-asc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Oldest created`}),D===`created-asc`&&(0,$.jsx)(Y,{size:12,className:`text-primary`})]}),(0,$.jsxs)(Z,{onClick:()=>O(`updated-desc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Recently active`}),D===`updated-desc`&&(0,$.jsx)(Y,{size:12,className:`text-primary`})]}),(0,$.jsxs)(Z,{onClick:()=>O(`messages-desc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Most turns`}),D===`messages-desc`&&(0,$.jsx)(Y,{size:12,className:`text-primary`})]}),(0,$.jsxs)(Z,{onClick:()=>O(`title-asc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Title (A–Z)`}),D===`title-asc`&&(0,$.jsx)(Y,{size:12,className:`text-primary`})]})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center rounded border border-border bg-card p-0.5 shadow-2xs`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>A(`harness`),title:`Group chats by AI Harness`,className:c(`px-2 py-0.5 text-xs rounded font-medium transition-colors cursor-pointer`,k===`harness`?`bg-primary text-primary-foreground font-semibold shadow-2xs`:`text-muted-foreground hover:text-foreground`),children:`Grouped`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>A(`timeline`),title:`Unified Chronological Timeline`,className:c(`px-2 py-0.5 text-xs rounded font-medium transition-colors cursor-pointer`,k===`timeline`?`bg-primary text-primary-foreground font-semibold shadow-2xs`:`text-muted-foreground hover:text-foreground`),children:`Timeline`})]})]})]}),T&&(0,$.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 p-2.5 rounded-md bg-emerald-500/10 border border-emerald-500/30 text-xs animate-fade-in`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-foreground min-w-0`,children:[(0,$.jsx)(`span`,{className:`size-2 rounded-full bg-emerald-500 animate-pulse shrink-0`}),(0,$.jsxs)(`span`,{className:`truncate`,children:[(0,$.jsx)(`strong`,{children:`Active in terminal:`}),` `,(0,$.jsx)(`code`,{className:`font-mono bg-background/80 px-1.5 py-0.5 rounded text-emerald-400`,children:T.cmd})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:async()=>{await pn(T.cmd),s?.(`Command copied to clipboard!`,`success`)},className:`inline-flex items-center gap-1 px-2.5 py-1 text-xs font-medium rounded border border-emerald-500/40 bg-emerald-500/15 text-emerald-400 hover:bg-emerald-500/25 transition-colors cursor-pointer`,children:[(0,$.jsx)(Tt,{size:11}),` Copy`]}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>E(null),className:`text-muted-foreground hover:text-foreground cursor-pointer text-xs px-1`,title:`Dismiss banner`,children:`✕`})]})]}),k===`timeline`?(0,$.jsx)(Sn,{className:`divide-y divide-border overflow-hidden surface-card`,children:ae.length===0?(0,$.jsx)(`div`,{className:`py-8 text-center text-xs text-muted-foreground`,children:j?`No chat sessions match your search filter.`:`No chat sessions recorded yet.`}):ae.map(e=>(0,$.jsxs)(`div`,{className:`group flex flex-col gap-2 p-3 hover:bg-accent/40 transition-colors sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 flex-1`,children:[si(e.assistant),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-muted-foreground mb-0.5`,children:[(0,$.jsx)(`span`,{className:`font-semibold capitalize text-foreground`,children:e.assistant===`antigravity`?`Antigravity`:e.assistant===`claude`?`Claude`:e.assistant===`codex`?`Codex`:`Copilot`}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsx)(`span`,{className:`font-mono text-muted-foreground/80`,children:e.id.slice(0,8)}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsx)(`span`,{children:ci(e.createdAt||e.updatedAt)}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsxs)(`span`,{className:`font-mono`,children:[e.messageCount,` `,e.messageCount===1?`turn`:`turns`]})]}),(0,$.jsx)(`p`,{className:`text-xs font-semibold text-foreground truncate`,title:e.title,children:e.title})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0 pl-8 sm:pl-0`,children:[(0,$.jsxs)(f,{size:`xs`,variant:`default`,disabled:x===e.id,onClick:()=>void re(e.id,e.assistant),title:`Resume session in terminal (${e.id})`,children:[x===e.id?(0,$.jsx)(X,{className:`size-3`}):(0,$.jsx)(bn,{size:12}),(0,$.jsx)(`span`,{children:`Resume`})]}),(0,$.jsxs)(f,{size:`xs`,variant:`outline`,onClick:()=>{r(e),i([]),a(e.assistant,e.id)},title:`Inspect transcript log`,children:[(0,$.jsx)(In,{size:12}),(0,$.jsx)(`span`,{children:`Logs`})]}),e.assistant===`codex`&&v&&(0,$.jsxs)(f,{size:`xs`,variant:`outline`,disabled:y===e.id,onClick:()=>void z(e.id),title:`Open in Codex Desktop`,children:[y===e.id?(0,$.jsx)(X,{className:`size-3`}):(0,$.jsx)(un,{size:12}),(0,$.jsx)(`span`,{children:`Desktop`})]}),(0,$.jsx)(f,{size:`icon-xs`,variant:`ghost`,onClick:async()=>{let t=oi(e.assistant,e.id);await pn(t),s?.(`Copied: ${t}`,`success`)},title:`Copy CLI resume command`,children:(0,$.jsx)(Tt,{size:12})})]})]},e.id))}):(0,$.jsx)(`div`,{className:`space-y-2.5`,children:H.map(e=>{let t=F[e.id]??!1,n=e.sessions.filter(e=>{if(!j.trim())return!0;let t=j.toLowerCase();return`${e.title} ${e.id}`.toLowerCase().includes(t)});return(0,$.jsxs)(Sn,{className:`overflow-hidden surface-card`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 p-3 sm:flex-row sm:items-center sm:justify-between bg-muted/20 hover:bg-muted/35 transition-colors cursor-pointer select-none`,onClick:()=>ee(e.id),children:[(0,$.jsxs)(`div`,{className:`flex flex-1 items-center gap-2.5 min-w-0`,children:[(0,$.jsx)(`span`,{className:`text-muted-foreground transition-transform`,children:t?(0,$.jsx)(We,{size:14}):(0,$.jsx)(et,{size:14})}),e.icon,(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 min-w-0`,children:[(0,$.jsx)(`span`,{className:`font-bold text-xs text-foreground`,children:e.name}),(0,$.jsxs)($t,{tone:e.isDetected?`success`:`neutral`,dot:e.isDetected,children:[`CLI: `,e.cliCommand]}),e.hasApp&&(0,$.jsx)($t,{tone:`running`,children:e.appName}),(0,$.jsxs)(`span`,{className:`text-[11px] text-muted-foreground font-mono`,children:[`(`,n.length,`)`]})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0 pl-6 sm:pl-0`,onClick:e=>e.stopPropagation(),children:[(0,$.jsxs)(f,{size:`xs`,variant:`default`,disabled:C===e.id,onClick:()=>void R(e.id),title:`Launch new ${e.cliCommand} session in terminal`,children:[C===e.id?(0,$.jsx)(X,{className:`size-3`}):(0,$.jsx)(Bt,{size:12}),(0,$.jsx)(`span`,{children:`New Session`})]}),e.hasApp&&(0,$.jsxs)(f,{size:`xs`,variant:`outline`,onClick:()=>void ne(e.appTargetId),title:`Open in ${e.appName}`,children:[(0,$.jsx)(un,{size:12}),(0,$.jsx)(`span`,{children:e.appName})]})]})]}),t&&(0,$.jsx)(`div`,{className:`divide-y divide-border/60 border-t border-border`,children:n.length===0?(0,$.jsxs)(`div`,{className:`p-4 text-center text-xs text-muted-foreground flex items-center justify-center gap-2`,children:[(0,$.jsx)(`span`,{children:j?`No sessions match your search query.`:`No previous sessions recorded for ${e.name}.`}),!j&&(0,$.jsxs)(`button`,{type:`button`,onClick:()=>void R(e.id),className:`text-primary font-semibold hover:underline cursor-pointer inline-flex items-center gap-1 text-xs`,children:[(0,$.jsx)(Bt,{size:11}),` Start session`]})]}):n.map(e=>(0,$.jsxs)(`div`,{className:`group flex flex-col gap-1.5 px-3.5 py-2.5 hover:bg-accent/40 transition-colors sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 mb-0.5 text-[11px] text-muted-foreground font-mono`,children:[(0,$.jsx)(`span`,{children:e.id.slice(0,8)}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsx)(`span`,{children:ci(e.createdAt||e.updatedAt)}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsxs)(`span`,{children:[e.messageCount,` `,e.messageCount===1?`turn`:`turns`]})]}),(0,$.jsx)(`p`,{className:`text-xs font-semibold text-foreground truncate`,title:e.title,children:e.title})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,$.jsxs)(f,{size:`xs`,variant:`default`,disabled:x===e.id,onClick:()=>void re(e.id,e.assistant),title:`Resume session in terminal (${e.id})`,children:[x===e.id?(0,$.jsx)(X,{className:`size-3`}):(0,$.jsx)(bn,{size:12}),(0,$.jsx)(`span`,{children:`Resume`})]}),(0,$.jsxs)(f,{size:`xs`,variant:`outline`,onClick:()=>{r(e),i([]),a(e.assistant,e.id)},title:`Inspect transcript log`,children:[(0,$.jsx)(In,{size:12}),(0,$.jsx)(`span`,{children:`Logs`})]}),e.assistant===`codex`&&v&&(0,$.jsxs)(f,{size:`xs`,variant:`outline`,disabled:y===e.id,onClick:()=>void z(e.id),title:`Open in Codex Desktop`,children:[y===e.id?(0,$.jsx)(X,{className:`size-3`}):(0,$.jsx)(un,{size:12}),(0,$.jsx)(`span`,{children:`Desktop`})]}),(0,$.jsx)(f,{size:`icon-xs`,variant:`ghost`,onClick:async()=>{let t=oi(e.assistant,e.id);await pn(t),s?.(`Copied: ${t}`,`success`)},title:`Copy CLI resume command`,children:(0,$.jsx)(Tt,{size:12})})]})]},e.id))})]},e.id)})})]})};function ui(e){return e===`review`||e===`workspace-write`}var di=e=>`nexusflow_chat_${e}`,fi=()=>({v:4,sessions:{},providerId:null,profilesByProvider:{"claude-cli":`review`,"codex-cli":`review`},modelsByProvider:{},messages:[]});function pi(e){try{let t=localStorage.getItem(di(e));if(!t)return fi();let n=JSON.parse(t);if(Array.isArray(n))return{...fi(),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=>ui(e[1]))),t=typeof n.modelsByProvider==`object`&&n.modelsByProvider!==null?Object.fromEntries(Object.entries(n.modelsByProvider).filter(e=>typeof e[0]==`string`&&typeof e[1]==`string`)):{};return{...fi(),sessions:n.sessions,providerId:typeof n.providerId==`string`?n.providerId:null,profilesByProvider:{...fi().profilesByProvider,...e},modelsByProvider:t,messages:n.messages}}if(n&&n.v===3&&n.sessions&&Array.isArray(n.messages))return{...fi(),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:fi().profilesByProvider,messages:n.messages}}return fi()}catch{return fi()}}var mi=500;function hi(e,t){try{let n=t.messages.length>mi?{...t,messages:t.messages.slice(-500)}:t;localStorage.setItem(di(e),JSON.stringify(n))}catch(e){console.error(`Failed to save chat to localStorage`,e)}}function gi(e){try{localStorage.removeItem(di(e))}catch{}}var _i=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,vi=new Set([`claude-cli`,`codex-cli`,`antigravity-cli`,`copilot-cli`]);function yi(e){return e===`claude`?`claude-cli`:e===`codex`?`codex-cli`:e===`antigravity`?`antigravity-cli`:e===`copilot`?`copilot-cli`:null}function bi(e){if(!e||typeof e!=`object`)return null;let t=e.chatLaunch;if(!t||typeof t!=`object`)return null;let n=t;return!_i.test(n.nonce??``)||!n.providerId||!vi.has(n.providerId)||!ui(n.executionProfile)||n.kickoff!==void 0&&(typeof n.kickoff!=`string`||n.kickoff.length>2e3)||n.model!==void 0&&(typeof n.model!=`string`||n.model.length>100)||n.assistant!==void 0&&yi(n.assistant)!==n.providerId||n.sessionId!==void 0&&(!_i.test(n.sessionId)||!n.assistant)?null:n}function xi({className:e,...t}){return(0,$.jsx)(`div`,{className:c(`animate-skeleton rounded-sm [--skeleton-highlight:--alpha(var(--color-white)/64%)] [background:linear-gradient(120deg,transparent_40%,var(--skeleton-highlight),transparent_60%)_var(--color-muted)_0_0/200%_100%_fixed] dark:[--skeleton-highlight:--alpha(var(--color-white)/4%)]`,e),"data-slot":`skeleton`,...t})}function Si({open:e,onClose:t,ws:n,onPick:r,error:i,pending:a=!1}){let[o,s]=(0,Q.useState)([]),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null);(0,Q.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`||e.assistant===`antigravity`||e.assistant===`copilot`);s(t)}).catch(()=>d(`Failed to load sessions.`)).finally(()=>l(!1)))},[e,n.branchName]);let f=e=>{switch(e){case`codex`:return`Codex`;case`antigravity`:return`Antigravity`;case`copilot`:return`Copilot`;default:return`Claude`}};return(0,$.jsx)(sn,{open:e,onOpenChange:e=>!e&&t(),children:(0,$.jsxs)(Kt,{className:`max-w-lg`,children:[(0,$.jsx)(nn,{children:(0,$.jsx)(Yt,{children:`Resume a past session`})}),(0,$.jsxs)(mn,{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)(xi,{className:`h-14`}),(0,$.jsx)(xi,{className:`h-14`}),(0,$.jsx)(xi,{className:`h-14`})]}):o.length===0?(0,$.jsx)(Dn,{children:(0,$.jsxs)(En,{children:[(0,$.jsx)(wn,{variant:`icon`,children:(0,$.jsx)(Nn,{})}),(0,$.jsx)(Cn,{children:`No resumable sessions found`}),(0,$.jsx)(Tn,{children:`Past 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:f(e.assistant)}),(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)(In,{size:11}),(0,$.jsxs)(`span`,{children:[e.messageCount,` messages`]})]})]},e.id))]})]})})}var Ci=p(((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)}}})),wi=p(((e,t)=>{function n(e){if(!e)return``;if(!/\r/.test(e))return e;for(e=e.replace(/\r+\n/gm,`
2
2
  `);/\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,`
3
3
  `);var t=e.lastIndexOf(`
4
4
  `);return n(e.slice(0,t))+`