@mrpatronz/nexusflow 2.19.0 → 2.20.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.
- package/dist/analyzers/detect-existing.d.ts.map +1 -1
- package/dist/analyzers/detect-existing.js +2 -0
- package/dist/analyzers/detect-existing.js.map +1 -1
- package/dist/core/doctor.js +5 -5
- package/dist/core/doctor.js.map +1 -1
- package/dist/generators/claude.d.ts +12 -5
- package/dist/generators/claude.d.ts.map +1 -1
- package/dist/generators/claude.js +12 -10
- package/dist/generators/claude.js.map +1 -1
- package/dist/generators/index.d.ts +6 -0
- package/dist/generators/index.d.ts.map +1 -1
- package/dist/generators/index.js +2 -2
- package/dist/generators/index.js.map +1 -1
- package/dist/gui/assets/AgentsPage-BKwrbZTW.js +3 -0
- package/dist/gui/assets/DashboardPage-B5DuTyhZ.js +1 -0
- package/dist/gui/assets/{DocumentPreview-B1-9LSiH.js → DocumentPreview-Os281E1X.js} +1 -1
- package/dist/gui/assets/{GettingStartedPage-KkTgBu7C.js → GettingStartedPage-bcbneczR.js} +1 -1
- package/dist/gui/assets/MonacoDiffAdapter-D1wWcPlt.js +1 -0
- package/dist/gui/assets/ProjectsPage-CIEM54GU.js +1 -0
- package/dist/gui/assets/ScaffoldRepoInline-DoqywP_g.js +1 -0
- package/dist/gui/assets/SettingsPage-sCzTlpxr.js +1 -0
- package/dist/gui/assets/SkillsPage-CoMf5sLE.js +7 -0
- package/dist/gui/assets/StartWorkPage-CVnUwx7O.js +1 -0
- package/dist/gui/assets/StrategiesPage-UIiETHGq.js +3 -0
- package/dist/gui/assets/WorkroomsPage-BTcKu4E8.js +4 -0
- package/dist/gui/assets/WorkspacesPage-2tYcZu28.js +17 -0
- package/dist/gui/assets/alert-dialog-CdWem4Th.js +1 -0
- package/dist/gui/assets/badge-DQIZRRDZ.js +1 -0
- package/dist/gui/assets/bot-D5yM1Tw6.js +1 -0
- package/dist/gui/assets/{brand-hHByyyzq.js → brand-Bj6g9sFF.js} +1 -1
- package/dist/gui/assets/{client-B5szthbF.js → client-CQ3EdyuW.js} +1 -1
- package/dist/gui/assets/cpu-Y6k3dlHb.js +1 -0
- package/dist/gui/assets/empty-DK2eW2rF.js +1 -0
- package/dist/gui/assets/index-qvc4aLwP.js +75 -0
- package/dist/gui/assets/index-zHrkxd7h.css +2 -0
- package/dist/gui/assets/input-LtE7Sz4D.js +1 -0
- package/dist/gui/assets/isElementDisabled-Cpw8EvLX.js +1 -0
- package/dist/gui/assets/{queries-DYi6drfC.js → queries-CtxmqmGJ.js} +1 -1
- package/dist/gui/assets/tabs-7VC4aq4J.js +1 -0
- package/dist/gui/assets/textarea-0lXkxsuX.js +1 -0
- package/dist/gui/assets/{useAriaLabelledBy-DAWGcnTk.js → useAriaLabelledBy-BAD_HQgN.js} +1 -1
- package/dist/gui/assets/useValueChanged-DcnEcpiS.js +1 -0
- package/dist/gui/index.html +8 -8
- package/dist/terminal/manager.d.ts +1 -0
- package/dist/terminal/manager.d.ts.map +1 -1
- package/dist/terminal/manager.js +4 -3
- package/dist/terminal/manager.js.map +1 -1
- package/dist/utils/session-finder.d.ts.map +1 -1
- package/dist/utils/session-finder.js +49 -1
- package/dist/utils/session-finder.js.map +1 -1
- package/package.json +1 -1
- package/dist/gui/assets/AgentsPage-DsJ8dxJG.js +0 -3
- package/dist/gui/assets/DashboardPage-CtJnqdvu.js +0 -1
- package/dist/gui/assets/MonacoDiffAdapter-CsyKXuq8.js +0 -1
- package/dist/gui/assets/ProjectsPage-Dsl46Cx5.js +0 -1
- package/dist/gui/assets/ScaffoldRepoInline-BZBzfuYr.js +0 -1
- package/dist/gui/assets/SettingsPage-BYuNRM43.js +0 -1
- package/dist/gui/assets/SkillsPage-BmsLo_kt.js +0 -7
- package/dist/gui/assets/StartWorkPage-CY9s8_zb.js +0 -1
- package/dist/gui/assets/StrategiesPage-Bd9vJ5ml.js +0 -3
- package/dist/gui/assets/WorkroomsPage-Yoy1dJFI.js +0 -4
- package/dist/gui/assets/WorkspacesPage-CpZsBgiV.js +0 -13
- package/dist/gui/assets/alert-dialog-D24plC11.js +0 -1
- package/dist/gui/assets/badge-BObbahyU.js +0 -1
- package/dist/gui/assets/index-B5-rK_Uq.css +0 -2
- package/dist/gui/assets/index-CxyTuBKc.js +0 -80
- package/dist/gui/assets/isElementDisabled-BONWqXlb.js +0 -1
- package/dist/gui/assets/tabs--FCq-tVR.js +0 -1
- package/dist/gui/assets/useValueChanged-DfJmRF2P.js +0 -1
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-DE3RlOCf.js";import{A as r,C as i,F as a,Gn as o,Gt as s,H as c,Ht as l,I as u,J as d,Kn as f,L as p,M as m,Mn as h,N as g,O as _,P as v,R as y,Vn as b,Wt as x,X as S,Xt as C,Y as w,Yn as T,Yt as E,Z as D,_ as O,_n as k,at as A,bn as j,cn as M,g as N,in as P,j as F,k as ee,n as I,nn as te,nt as ne,q as L,qn as R,qt as re,sn as z,t as B,tt as ie,v as V,yt as H,z as U}from"./badge-BObbahyU.js";import{$ as ae,A as oe,D as W,E as se,F as ce,G as le,H as ue,I as de,M as fe,R as pe,U as me,_ as he,a as ge,et as _e,i as ve,j as ye,k as be,m as xe,n as Se,r as Ce,t as we,u as Te,v as Ee,x as De,z as Oe}from"./queries-DYi6drfC.js";import{c as ke,h as G,i as Ae,l as je,m as K,p as q,t as J}from"./button-BrcP8Wxx.js";import{t as Me}from"./chevron-down-Dy03VL1q.js";import{_ as Ne,a as Pe,d as Fe,f as Ie,g as Le,l as Re,n as ze,o as Be,s as Ve,u as He,x as Ue}from"./isElementDisabled-BONWqXlb.js";import{a as We,i as Ge,n as Ke,o as qe,r as Je,s as Ye,t as Xe}from"./square-check-big-DpHMT26q.js";import{a as Ze,g as Qe,i as $e,m as et,n as tt,r as nt,s as rt}from"./status-CKOvrZ16.js";import{t as it}from"./shield-check-FLrrAOFP.js";import{n as at,r as ot,t as st}from"./vsc-EOWFTqft.js";import{t as ct}from"./trash-2-BrrLX4tD.js";import{a as lt,i as ut,n as dt,r as ft,t as pt}from"./tabs--FCq-tVR.js";import{d as mt,o as ht,t as gt}from"./brand-hHByyyzq.js";import{n as Y}from"./client-B5szthbF.js";import{$t as _t,A as vt,Bt as yt,C as bt,Ct as xt,D as St,Dt as Ct,E as wt,Et as Tt,F as Et,Ft as Dt,G as Ot,Gt as kt,Ht as At,I as jt,Jt as Mt,K as Nt,L as Pt,Lt as Ft,M as It,Mt as Lt,N as Rt,Nt as zt,O as Bt,Ot as Vt,P as Ht,Pt as Ut,Qt as Wt,Rt as Gt,S as Kt,St as qt,T as Jt,Tt as X,U as Yt,Ut as Xt,Vt as Zt,W as Qt,Wt as $t,Xt as en,Yt as tn,_ as nn,_t as rn,a as an,an as on,at as sn,c as cn,ct as ln,d as un,en as dn,gt as fn,h as pn,ht as mn,i as hn,in as gn,it as _n,j as vn,k as Z,kt as yn,l as bn,m as xn,mt as Sn,n as Cn,nn as wn,o as Tn,ot as En,p as Dn,pt as On,qt as kn,r as An,rn as jn,s as Mn,t as Nn,tn as Pn,u as Fn,ut as In,vt as Ln,w as Rn,xt as zn,yt as Bn,zt as Vn}from"./index-CxyTuBKc.js";import{t as Hn}from"./DocumentPreview-B1-9LSiH.js";import{t as Un}from"./card-BMggHY3n.js";import{t as Wn}from"./label-C610MHwq.js";var Gn=G(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),Kn=G(`building-2`,[[`path`,{d:`M10 12h4`,key:`a56b0p`}],[`path`,{d:`M10 8h4`,key:`1sr2af`}],[`path`,{d:`M14 21v-3a2 2 0 0 0-4 0v3`,key:`1rgiei`}],[`path`,{d:`M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2`,key:`secmi2`}],[`path`,{d:`M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16`,key:`16ra0t`}]]),qn=G(`calendar`,[[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M3 9h18`,key:`1pudct`}]]),Jn=G(`chevrons-down-up`,[[`path`,{d:`m7 20 5-5 5 5`,key:`13a0gw`}],[`path`,{d:`m7 4 5 5 5-5`,key:`1kwcof`}]]),Yn=G(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),Xn=G(`circle-arrow-up`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 12-4-4-4 4`,key:`177agl`}],[`path`,{d:`M12 16V8`,key:`1sbj14`}]]),Zn=G(`circle-play`,[[`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`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Qn=G(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),$n=G(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),er=G(`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`}]]),tr=G(`git-compare`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`path`,{d:`M11 18H8a2 2 0 0 1-2-2V9`,key:`19pyzm`}]]),nr=G(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),rr=G(`navigation`,[[`polygon`,{points:`3 11 22 2 13 21 11 13 3 11`,key:`1ltx0t`}]]),ir=G(`pen-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`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`}]]),ar=G(`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`}]]),or=G(`radio`,[[`path`,{d:`M16.247 7.761a6 6 0 0 1 0 8.478`,key:`1fwjs5`}],[`path`,{d:`M19.075 4.933a10 10 0 0 1 0 14.134`,key:`ehdyv1`}],[`path`,{d:`M4.925 19.067a10 10 0 0 1 0-14.134`,key:`1q22gi`}],[`path`,{d:`M7.753 16.239a6 6 0 0 1 0-8.478`,key:`r2q7qm`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]),sr=G(`rotate-ccw`,[[`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`}]]),cr=G(`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`}]]),lr=G(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),ur=G(`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`}]]),dr=G(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),Q=e(t(),1);function fr(e){let{popupElement:t,positionerElement:n,content:r,mounted:i,onMeasureLayout:a,onMeasureLayoutComplete:o,side:c,direction:l}=e,u=s(t,!0),d=re(),f=Q.useRef(null),p=Q.useRef(!0),m=Q.useRef(je),h=M(a),g=M(o),_=Q.useMemo(()=>pr(c,l),[c,l]);z(()=>{if(!i){m.current=je,p.current=!0,f.current=null;return}if(!t||!n)return;m.current=hr(t,_),gr(t,`auto`);let e=mr(t,`position`,`static`),r=mr(t,`transform`,`none`),a=mr(t,`scale`,`1`),o=hr(n,{"--available-width":`max-content`,"--available-height":`max-content`});function s(){e(),r(),o()}function c(){s(),a()}if(h?.(),p.current||f.current===null){_r(n,`max-content`);let e=lt(t);return f.current=e,_r(n,e),c(),g?.(null,e),p.current=!1,()=>{m.current(),m.current=je}}_r(n,`max-content`);let l=f.current,v=lt(t);f.current=v,gr(t,l),c(),g?.(l,v),_r(n,v);let y=new AbortController;return d.request(()=>{gr(t,v),u(()=>{t.style.setProperty(`--popup-width`,`auto`),t.style.setProperty(`--popup-height`,`auto`)},y.signal)}),()=>{y.abort(),d.cancel(),m.current(),m.current=je}},[r,t,n,u,d,i,h,g,_])}function pr(e,t){let n=e===`top`,r=e===`left`||e===(t===`rtl`?`inline-end`:`inline-start`);return!n&&!r?ke:{position:`absolute`,[n?`bottom`:`top`]:`0`,[r?`right`:`left`]:`0`}}function mr(e,t,n){let r=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{e.style.setProperty(t,r)}}function hr(e,t){let n=[];for(let[r,i]of Object.entries(t))n.push(mr(e,r,i));return n.length?()=>{n.forEach(e=>e())}:je}function gr(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 _r(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 vr={name:`adaptiveOrigin`,async fn(e){let{x:t,y:n,rects:{floating:r},elements:{floating:i},platform:a,strategy:o,placement:s}=e,c=k(i),l=c.getComputedStyle(i);if(l.transitionDuration===`0s`||l.transitionDuration===``)return{x:t,y:n,data:He};let u=await a.getOffsetParent?.(i),d={width:0,height:0};if(o===`fixed`&&c?.visualViewport)d={width:c.visualViewport.width,height:c.visualViewport.height};else if(u===c){let e=P(i);d={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await a.isElement?.(u)&&(d=await a.getDimensions(u));let f=Ne(s),p=t,m=n;f===`left`&&(p=d.width-(t+r.width)),f===`top`&&(m=d.height-(n+r.height));let h=f===`left`?`right`:He.sideX,g=f===`top`?`bottom`:He.sideY;return{x:p,y:m,data:{sideX:h,sideY:g}}}},yr=e(T(),1),$=n(),br={activationDirection:e=>e?{"data-activation-direction":e}:null};function xr(e){let{store:t,side:n,children:r}=e,i=O(),a=t.useState(`activeTriggerElement`),o=t.useState(`activeTriggerId`),c=t.useState(`open`),l=t.useState(`payload`),u=t.useState(`mounted`),d=t.useState(`popupElement`),f=t.useState(`positionerElement`),p=ze(c?a:null),m=Tr(o,l),h=Q.useRef(null),[g,_]=Q.useState(null),[v,y]=Q.useState(null),b=Q.useRef(null),x=Q.useRef(null),S=s(b,!0),C=re(),w=Q.useRef(null),[T,E]=Q.useState(null),[D,k]=Q.useState(!1);z(()=>(t.set(`adaptiveOrigin`,vr),()=>{t.set(`adaptiveOrigin`,void 0)}),[t]);let A=M(()=>{b.current?.style.setProperty(`animation`,`none`),b.current?.style.setProperty(`transition`,`none`),x.current?.style.setProperty(`display`,`none`)}),j=M(e=>{b.current?.style.removeProperty(`animation`),b.current?.style.removeProperty(`transition`),x.current?.style.removeProperty(`display`),e&&E(e)}),N=M(()=>{w.current?.abort();let e=new AbortController;w.current=e,S(()=>{_(null),E(null),h.current=null},e.signal)}),F=Q.useRef(null);z(()=>{(!c||!u)&&(F.current=null)},[c,u]),z(()=>{if(a&&p&&a!==p&&F.current!==a&&h.current){_(h.current),k(!0);let e=wr(p,a);y(e),F.current=a}},[a,p]),z(()=>{g!=null&&(w.current?.abort(),k(!0),C.request(()=>{yr.flushSync(()=>{k(!1)}),N()}))},[m,g,N,C]),z(()=>{let e=b.current;if(!e)return;let t=P(e).createElement(`div`);for(let n of Array.from(e.childNodes))t.appendChild(n.cloneNode(!0));h.current=t});let ee=g!=null,I;I=ee?(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(`div`,{"data-previous":!0,inert:V(!0),ref:x,style:{...T?{"--popup-width":`${T.width}px`,"--popup-height":`${T.height}px`}:null,position:`absolute`},"data-ending-style":D?void 0:``},`previous`),(0,$.jsx)(`div`,{"data-current":!0,ref:b,"data-starting-style":D?``:void 0,children:r},m)]}):(0,$.jsx)(`div`,{"data-current":!0,ref:b,children:r},m),z(()=>{let e=x.current;!e||!g||e.replaceChildren(...Array.from(g.childNodes))},[g]),fr({popupElement:d,positionerElement:f,mounted:u,content:l,onMeasureLayout:A,onMeasureLayoutComplete:j,side:n,direction:i});let te={activationDirection:Sr(v),transitioning:ee};return{children:I,state:te}}function Sr(e){if(e)return`${Cr(e.horizontal,5,`right`,`left`)} ${Cr(e.vertical,5,`down`,`up`)}`}function Cr(e,t,n,r){return e>t?n:e<-t?r:``}function wr(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 Tr(e,t){let[n,r]=Q.useState(0),i=Q.useRef(e),a=Q.useRef(t),o=Q.useRef(!1);return z(()=>{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}`}function Er({ws:e}){let t=e.branchName,n=pe(t),r=be(t),i=Ee(t),a=n.data,o=(0,Q.useMemo)(()=>a?.services??[],[a]),s=(0,Q.useMemo)(()=>a?.runningState??[],[a]),c=a?.orchestrationTools??[],l=(0,Q.useMemo)(()=>a?.runningOrchestrators??[],[a]),u=(0,Q.useMemo)(()=>l.filter(e=>e.mode===`pm2`&&e.logName),[l]),[d,f]=(0,Q.useState)(`classic`),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{let e=[...o.map(e=>e.name),...u.map(e=>e.logName)];e.length===0?h!==null&&g(null):(!h||!e.includes(h))&&g(e[0])},[o,u]);let{logs:_,connected:v,clear:y}=Yt(t,h,!0),b=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{b.current?.scrollIntoView({behavior:`smooth`})},[_]);let x=(0,Q.useMemo)(()=>new Set(s.filter(e=>e.pid>0).map(e=>e.name)),[s]),S=(0,Q.useMemo)(()=>new Set(l.map(e=>e.id)),[l]),C=x.size>0,w=d===`matrix`?`term-matrix`:d===`dracula`?`term-dracula`:`term-classic`,T=r.isPending||i.isPending;return(0,$.jsxs)(`div`,{className:`animate-fade-in`,children:[n.isLoading&&(0,$.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-[10px] text-primary`,children:[(0,$.jsx)(Z,{className:`size-3`}),(0,$.jsx)(`span`,{className:`font-semibold tracking-wider uppercase`,children:`Scanning service configurations...`})]}),n.isError&&(0,$.jsxs)(`div`,{className:`mb-4 flex items-center justify-between rounded-md border border-destructive/30 bg-destructive/10 p-3 text-xs text-destructive`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(X,{size:14}),(0,$.jsxs)(`span`,{children:[`Failed to load services: `,n.error?.message||`Unknown error`]})]}),(0,$.jsx)(J,{size:`xs`,variant:`outline`,onClick:()=>n.refetch(),children:`Retry`})]}),(r.isError||i.isError)&&(0,$.jsxs)(`div`,{className:`mb-4 flex items-center justify-between rounded-md border border-destructive/30 bg-destructive/10 p-3 text-xs text-destructive`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(X,{size:14}),(0,$.jsxs)(`span`,{children:[`Action failed: `,r.error?.message||i.error?.message||`Operation failed`]})]}),(0,$.jsx)(J,{size:`xs`,variant:`ghost`,onClick:()=>{r.reset(),i.reset()},children:`Dismiss`})]}),!n.isLoading&&!n.isError&&o.length===0&&c.length===0&&(0,$.jsxs)(`div`,{className:`rounded-md border border-border/80 bg-card p-6 text-center surface-card`,children:[(0,$.jsx)(Tt,{size:24,className:`mx-auto mb-2 text-muted-foreground/60`}),(0,$.jsx)(`h4`,{className:`text-xs font-bold text-foreground`,children:`No Services Detected`}),(0,$.jsxs)(`p`,{className:`mt-1 text-[11px] text-muted-foreground`,children:[`ContextSpace scans for runnable background services in `,(0,$.jsx)(`code`,{className:`font-mono text-[10px]`,children:`package.json`}),` scripts (such as `,(0,$.jsx)(`code`,{className:`font-mono text-[10px]`,children:`start`}),`, `,(0,$.jsx)(`code`,{className:`font-mono text-[10px]`,children:`dev`}),`), `,(0,$.jsx)(`code`,{className:`font-mono text-[10px]`,children:`docker-compose.yml`}),`, or `,(0,$.jsx)(`code`,{className:`font-mono text-[10px]`,children:`Procfile`}),`.`]})]}),c.length>0&&(0,$.jsxs)(`div`,{className:`mb-4 rounded-md border border-border/80 bg-card p-4 surface-card`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-[10px] font-bold uppercase tracking-wider text-muted-foreground`,children:[(0,$.jsx)(X,{size:12,className:`text-info`}),` Orchestration tools`]}),(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:c.map(e=>{let t=S.has(e.id);return(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-border/60 bg-muted/20 p-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`h-2 w-2 rounded-full ${t?`bg-success`:`bg-muted-foreground/40`}`}),(0,$.jsx)(`span`,{className:`text-xs font-bold text-foreground`,children:e.tool}),(0,$.jsx)(Bt,{tone:`idle`,dot:!1,children:e.mode})]}),(0,$.jsx)(`code`,{className:`mt-1 block truncate font-mono text-[9px] text-muted-foreground`,children:e.configPath})]}),(0,$.jsx)(`div`,{className:`shrink-0`,children:t?(0,$.jsxs)(J,{size:`xs`,variant:`destructive`,"aria-label":`Stop ${e.tool}`,disabled:T,onClick:()=>i.mutate({action:`stop`,id:e.id}),children:[(0,$.jsx)(Vt,{size:12}),` Stop`]}):(0,$.jsxs)(J,{size:`xs`,"aria-label":`Start ${e.tool}`,disabled:T,onClick:()=>i.mutate({action:`start`,id:e.id}),children:[(0,$.jsx)(Dt,{size:12}),` Start`]})})]},e.id)})})]}),(0,$.jsxs)(`div`,{className:`mb-4 rounded-md border border-border/80 bg-card p-4 surface-card`,children:[(0,$.jsxs)(`div`,{className:`mb-2 flex items-center justify-between text-xs font-semibold text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:`Workspace Status`}),(0,$.jsx)(Bt,{tone:C?`running`:`idle`,children:C?`Active`:`Standby`})]}),(0,$.jsx)(`div`,{className:`mb-3 text-xs font-semibold text-foreground`,children:C?`${x.size} process${x.size===1?``:`es`} active`:`All processes offline`}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsxs)(J,{size:`sm`,disabled:C||T,onClick:()=>r.mutate({action:`start`}),children:[(0,$.jsx)(Dt,{size:13}),` Start All Services`]}),(0,$.jsxs)(J,{size:`sm`,variant:`destructive`,disabled:!C||T,onClick:()=>r.mutate({action:`stop`}),children:[(0,$.jsx)(Vt,{size:13}),` Stop All`]})]})]}),(o.length>0||u.length>0)&&(0,$.jsxs)(`div`,{className:`grid grid-cols-1 overflow-hidden rounded-md border border-border/80 bg-card shadow-xs lg:grid-cols-12 surface-card`,children:[(0,$.jsxs)(`div`,{className:`border-b border-border/80 bg-muted/20 p-4 lg:col-span-4 lg:border-b-0 lg:border-r`,children:[(0,$.jsxs)(`h4`,{className:`mb-4 flex items-center gap-1.5 border-b border-border pb-2 text-[10px] font-bold uppercase tracking-wider text-muted-foreground`,children:[(0,$.jsx)(Tt,{size:12,className:`text-primary`}),` Background Services`]}),(0,$.jsxs)(`div`,{className:`flex max-h-[400px] flex-col gap-2 overflow-y-auto pr-1`,children:[o.map(e=>{let t=h===e.name,n=x.has(e.name);return(0,$.jsxs)(`div`,{className:K(`flex cursor-pointer flex-col rounded-xl border p-3 transition-colors`,t?`border-primary/40 bg-primary/10 text-foreground`:`border-border bg-card text-muted-foreground hover:border-foreground/15 hover:bg-accent/50 hover:text-foreground`),onClick:()=>g(e.name),children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full ${n?`bg-success`:`bg-destructive`}`}),(0,$.jsx)(`span`,{className:`truncate text-xs font-bold`,children:e.name})]}),(0,$.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,onClick:e=>e.stopPropagation(),children:n?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{size:`icon-xs`,variant:`ghost`,"aria-label":`Restart ${e.name}`,disabled:T,onClick:()=>r.mutate({action:`restart`,service:e.name}),children:(0,$.jsx)(cr,{})}),(0,$.jsx)(J,{size:`icon-xs`,variant:`ghost`,"aria-label":`Stop ${e.name}`,disabled:T,onClick:()=>r.mutate({action:`stop`,service:e.name}),children:(0,$.jsx)(Vt,{})})]}):(0,$.jsx)(J,{size:`icon-xs`,variant:`ghost`,"aria-label":`Start ${e.name}`,disabled:T,onClick:()=>r.mutate({action:`start`,service:e.name}),children:(0,$.jsx)(Dt,{})})})]}),e.port?(0,$.jsxs)(`span`,{className:`mt-2 w-fit rounded border border-border bg-background px-2 py-0.5 font-mono text-[9px] text-muted-foreground`,children:[`Port: `,e.port]}):null,(0,$.jsxs)(`code`,{className:`mt-2 block truncate rounded border border-border bg-muted/40 p-1.5 font-mono text-[9px] text-muted-foreground`,children:[e.command,` `,e.args.join(` `)]})]},e.name)}),u.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`mt-2 border-t border-border pt-3 text-[9px] font-bold uppercase tracking-wider text-muted-foreground`,children:`Orchestrators`}),u.map(e=>{let t=e.logName;return(0,$.jsxs)(`div`,{className:K(`flex cursor-pointer items-center gap-2 rounded-xl border p-3 transition-colors`,h===t?`border-primary/40 bg-primary/10 text-foreground`:`border-border bg-card text-muted-foreground hover:border-foreground/15 hover:bg-accent/50 hover:text-foreground`),onClick:()=>g(t),children:[(0,$.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full bg-success`}),(0,$.jsx)(`span`,{className:`truncate text-xs font-bold`,children:e.tool}),(0,$.jsx)(Bt,{tone:`idle`,dot:!1,children:e.mode})]},e.id)})]})]})]}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col bg-background lg:col-span-8`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-border bg-muted/40 px-5 py-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`font-mono text-xs font-bold text-primary`,children:h||`no-service`}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`|`}),(0,$.jsx)(Bt,{tone:v?`running`:`idle`,children:v?`streaming`:`idle`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3 self-end sm:self-auto`,children:[(0,$.jsx)(`div`,{className:`flex rounded-lg border border-border bg-card p-0.5 text-[9px] font-semibold text-muted-foreground`,children:[`classic`,`matrix`,`dracula`].map(e=>(0,$.jsx)(`button`,{className:K(`cursor-pointer rounded-md px-2 py-1 capitalize transition-colors`,d===e?`bg-primary/10 font-bold text-primary`:`hover:text-foreground`),onClick:()=>f(e),children:e},e))}),(0,$.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,$.jsx)(`button`,{onClick:y,className:`cursor-pointer rounded-lg border border-border bg-card p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:`Clear Console`,children:(0,$.jsx)(ct,{size:13})}),(0,$.jsx)(`button`,{onClick:()=>m(!p),className:`cursor-pointer rounded-lg border border-border bg-card p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:p?`Minimize Console`:`Expand Console`,children:p?(0,$.jsx)(Ft,{size:13}):(0,$.jsx)(yt,{size:13})})]})]})]}),(0,$.jsxs)(`div`,{className:K(`relative overflow-y-auto whitespace-pre-wrap p-5 font-mono text-[10.5px] leading-relaxed selection:bg-primary/20`,w,p?`h-[520px]`:`h-80`),children:[_.trim()?_:(0,$.jsx)(`span`,{className:`font-mono italic text-muted-foreground`,children:`(no log content yet)`}),(0,$.jsx)(`div`,{ref:b})]})]})]})]})}var Dr=({workspaceTitle:e,workspaceDescription:t,activeWorktree:n,iterations:r,activeIterationId:i,onSelectIteration:a,activeStage:o,onSelectStage:s,diffViewMode:c,onToggleDiffMode:l,isZenMode:u,onToggleZenMode:d,gateStatus:f={overallStatus:`idle`,summaryText:`No verification gate run yet`},onNewIteration:p,showToast:m})=>{let[h,g]=(0,Q.useState)(!1),_=(0,Q.useCallback)(async(e,t)=>{t.stopPropagation(),await St(e)&&(g(!0),m?.(`Copied branch "${e}" to clipboard`,`success`),setTimeout(()=>g(!1),1500))},[m]),v=n?.commitInfo?.shortSha||n?.commitSha?.slice(0,7)||`unknown`;return(0,$.jsxs)(`header`,{className:`w-full shrink-0 border-b border-border/80 bg-card/85 backdrop-blur-md z-20 select-none`,children:[(0,$.jsxs)(`div`,{className:`h-8 px-3 flex items-center justify-between border-b border-border/60 text-xs`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`font-semibold text-foreground tracking-tight truncate max-w-[240px] cursor-default`,title:t||e,children:e}),(0,$.jsx)(dn,{size:11,className:`text-muted-foreground/40 shrink-0`}),n?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,$.jsxs)(`span`,{className:`font-medium text-foreground truncate max-w-[280px] flex items-center gap-1 text-xs`,title:n.intent||n.title,children:[(0,$.jsx)(Ct,{size:12,className:`text-primary shrink-0`}),n.title]}),(0,$.jsxs)(`button`,{type:`button`,onClick:e=>_(n.branchName,e),title:`Click to copy branch`,className:`inline-flex items-center gap-1 font-mono text-[10px] text-muted-foreground bg-muted/60 hover:bg-muted/90 px-1.5 py-0.5 rounded border border-border/50 hover:border-primary/40 transition-colors cursor-pointer`,children:[(0,$.jsx)($t,{size:10,className:`text-primary/70 shrink-0`}),(0,$.jsx)(`span`,{className:`truncate max-w-[150px]`,children:n.branchName}),h?(0,$.jsx)(Pn,{size:10,className:`text-emerald-400 shrink-0`}):(0,$.jsx)(Mt,{size:9,className:`opacity-50 shrink-0`})]}),(0,$.jsxs)(`span`,{className:`font-mono text-[10px] text-muted-foreground/70 hidden sm:inline`,title:`Head commit: ${n.commitInfo?.commitMessage||n.commitSha}`,children:[`@`,v]}),n.dirtyFilesCount===null?(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`Status unavailable`}):n.dirtyFilesCount>0?(0,$.jsxs)(`button`,{type:`button`,onClick:()=>s(`diff`),className:`font-mono text-[10px] font-bold text-amber-400 bg-amber-500/15 border border-amber-500/30 px-1.5 py-0.5 rounded flex items-center gap-1 cursor-pointer hover:bg-amber-500/25 transition-colors`,title:`View uncommitted modified files`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-400 animate-pulse`}),(0,$.jsxs)(`span`,{children:[`±`,n.dirtyFilesCount,` dirty`]})]}):(0,$.jsxs)(`span`,{className:`font-mono text-[10px] font-medium text-emerald-400 bg-emerald-500/10 border border-emerald-500/25 px-1.5 py-0.5 rounded flex items-center gap-1`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-emerald-400`}),(0,$.jsx)(`span`,{children:`clean`})]}),n.isPinned&&(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 font-mono text-[10px] text-primary/80 bg-primary/10 px-1 py-0.5 rounded`,title:`Worktree locked against pruning`,children:[(0,$.jsx)(Zt,{size:10}),(0,$.jsx)(`span`,{children:`pinned`})]})]}):(0,$.jsx)(`span`,{className:`text-muted-foreground text-xs italic`,children:`No active worktree`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[f&&(0,$.jsxs)(`div`,{className:K(`inline-flex items-center gap-1 font-mono text-[10px] font-semibold px-2 py-0.5 rounded border`,f.overallStatus===`pass`?`border-emerald-500/25 bg-emerald-500/10 text-emerald-400`:f.overallStatus===`fail`?`border-rose-500/30 bg-rose-500/15 text-rose-400 animate-pulse`:f.overallStatus===`running`?`border-sky-500/25 bg-sky-500/10 text-sky-400`:`border-border/60 bg-muted/20 text-muted-foreground`),title:f.summaryText||`Automated verification gate proof`,children:[f.overallStatus===`pass`?(0,$.jsx)(Wt,{size:11,className:`text-emerald-400`}):f.overallStatus===`fail`?(0,$.jsx)(_t,{size:11,className:`text-rose-400`}):f.overallStatus===`running`?(0,$.jsx)(Qn,{size:11,className:`text-sky-400 animate-spin`}):(0,$.jsx)(Qn,{size:11,className:`text-muted-foreground/60`}),(0,$.jsxs)(`span`,{children:[`Gate:`,` `,f.overallStatus===`pass`?`PASS (${f.durationMs??120}ms)`:f.overallStatus===`fail`?`FAILED ✗`:f.overallStatus===`running`?`RUNNING…`:`IDLE ○`]})]}),(0,$.jsxs)(`button`,{type:`button`,onClick:l,className:`inline-flex items-center gap-1 font-mono text-[10px] font-medium px-2 py-0.5 rounded border border-border bg-card/60 hover:bg-accent text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,title:`Toggle Diff Mode (Split / Unified)`,children:[(0,$.jsx)(tn,{size:11}),(0,$.jsx)(`span`,{children:c===`side-by-side`?`Split`:`Unified`})]}),(0,$.jsxs)(`button`,{type:`button`,onClick:d,className:K(`inline-flex items-center gap-1 font-mono text-[10px] px-1.5 py-0.5 rounded border transition-colors cursor-pointer`,u?`border-primary/40 bg-primary/10 text-primary font-bold`:`border-border bg-card/60 text-muted-foreground hover:text-foreground hover:bg-accent`),title:`Toggle Zen Review Mode (Shortcut: z)`,children:[u?(0,$.jsx)(Ft,{size:11}):(0,$.jsx)(yt,{size:11}),(0,$.jsx)(`span`,{children:`Zen (z)`})]})]})]}),!u&&(0,$.jsxs)(`div`,{className:`h-7 px-3 flex items-center justify-between border-b border-border/40 bg-muted/20 text-xs`,children:[r.length>0&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2 overflow-x-auto custom-scrollbar min-w-0 flex-1 pr-3`,children:[(0,$.jsx)(`span`,{className:`font-mono text-[10px] font-bold uppercase tracking-wider text-muted-foreground/60 shrink-0`,children:`Iterations:`}),r.length===0?(0,$.jsx)(`span`,{className:`text-muted-foreground/70 italic text-[11px] px-1`,children:`No iterations defined`}):r.map(e=>{let t=e.id===i;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>a(e.id),className:K(`inline-flex items-center gap-1.5 h-5 px-2 rounded text-xs font-medium whitespace-nowrap transition-all cursor-pointer shrink-0`,t?`bg-primary/15 text-foreground font-semibold border border-primary/40 shadow-2xs`:`bg-card/50 hover:bg-accent/80 text-muted-foreground hover:text-foreground border border-border/60`),title:e.goal||e.title,children:[(0,$.jsx)(Ct,{size:11,className:K(t?`text-primary`:`text-muted-foreground/70`)}),(0,$.jsx)(`span`,{children:e.title}),e.status===`review_ready`?(0,$.jsxs)(`span`,{className:`font-mono text-[9px] px-1 py-0.2 rounded bg-amber-500/20 text-amber-400 font-bold border border-amber-500/30`,children:[`Review Ready `,e.changesCount?`(±${e.changesCount})`:``]}):e.status===`agent_running`?(0,$.jsxs)(`span`,{className:`font-mono text-[9px] px-1 py-0.2 rounded bg-sky-500/20 text-sky-400 font-bold border border-sky-500/30 flex items-center gap-0.5`,children:[(0,$.jsx)(zn,{size:9,className:`text-sky-400`}),`Active ⚡`]}):e.status===`done`?(0,$.jsx)(`span`,{className:`font-mono text-[9px] px-1 py-0.2 rounded bg-emerald-500/20 text-emerald-400 font-bold border border-emerald-500/30`,children:`Done ✓`}):(0,$.jsx)(`span`,{className:`font-mono text-[9px] px-1 py-0.2 rounded bg-muted/80 text-muted-foreground border border-border/40`,children:`Planned ○`})]},e.id)}),p&&(0,$.jsxs)(`button`,{type:`button`,onClick:p,className:`inline-flex items-center gap-1 h-5 px-2 rounded text-[11px] font-medium text-muted-foreground hover:text-primary hover:bg-primary/10 border border-dashed border-border/80 hover:border-primary/30 transition-colors cursor-pointer shrink-0`,children:[(0,$.jsx)(Ut,{size:10}),(0,$.jsx)(`span`,{children:`New Iteration`})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0 font-mono text-[10px]`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>s(`diff`),className:K(`px-2 py-0.5 rounded transition-colors cursor-pointer`,o===`diff`?`bg-primary/15 text-primary font-bold border border-primary/30`:`text-muted-foreground hover:text-foreground hover:bg-accent/60`),children:`Diff Review`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>s(`plan`),className:K(`px-2 py-0.5 rounded transition-colors cursor-pointer`,o===`plan`?`bg-primary/15 text-primary font-bold border border-primary/30`:`text-muted-foreground hover:text-foreground hover:bg-accent/60`),children:`Process DAG`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>s(`knowledge`),className:K(`px-2 py-0.5 rounded transition-colors cursor-pointer`,o===`knowledge`?`bg-primary/15 text-primary font-bold border border-primary/30`:`text-muted-foreground hover:text-foreground hover:bg-accent/60`),children:`Knowledge`})]})]})]})},Or=Q.createContext(void 0);function kr(e){let t=Q.useContext(Or);if(t===void 0&&!e)throw Error(q(47));return t}var Ar={...Bn,disabled:e=>e.disabled,instantType:e=>e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,modal:e=>e.modal,focusManagerModal:e=>e.focusManagerModal,stickIfOpen:e=>e.stickIfOpen,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},jr=class extends c{constructor(e,t,n){let r=new _;super(Mr(e,r,t,n),Nr(r),Ar)}setOpen=(e,t)=>{let n=t.reason===b,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};g(n,e,t.trigger,a()),this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),yr.flushSync(s)):s();let c;r?c=`click`:i?c=`dismiss`:t.reason===`focus-out`&&(c=`focus`),this.set(`instantType`,c)}};function Mr(e,t,n,r=!1){let i={...rn(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return i.open&&e?.mounted===void 0&&(i.mounted=!0),i.floatingRootContext=Ln(t,n,r),i}function Nr(e){return{popupRef:Q.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:Q.createRef(),beforeContentFocusGuardRef:Q.createRef(),stickIfOpenTimeout:new l,triggerElements:e}}function Pr({props:e}){let{children:t,open:n,defaultOpen:i=!1,onOpenChange:o,onOpenChangeComplete:s,modal:c=!1,handle:l,triggerId:u,defaultTriggerId:d=null}=e,f=Ir(l,{modal:c,open:i,openProp:n,activeTriggerId:d,triggerIdProp:u});f.useControlledProp(`openProp`,n),f.useControlledProp(`triggerIdProp`,u);let p=f.useState(`open`),m=f.useState(`mounted`),g=f.useState(`payload`);f.useContextCallback(`onOpenChange`,o),f.useContextCallback(`onOpenChangeComplete`,s),y(f,p),v(f);let{forceUnmount:_}=a(p,f,()=>{f.update({stickIfOpen:!0,openChangeReason:null})});f.useSyncedValues({modal:c}),Q.useEffect(()=>{p||f.context.stickIfOpenTimeout.clear()},[f,p]),Q.useImperativeHandle(e.actionsRef,()=>({unmount:_,close:()=>f.setOpen(!1,E(h))}),[_,f]);let b=p||m;return(0,$.jsxs)(Or.Provider,{value:f,children:[l&&(0,$.jsx)(r,{handle:l,store:f}),b&&(0,$.jsx)(Lr,{store:f,modal:c}),typeof t==`function`?t({payload:g}):t]})}function Fr(e){return kr(!0)?(0,$.jsx)(Pr,{props:e}):(0,$.jsx)(S,{children:(0,$.jsx)(Pr,{props:e})})}function Ir(e,t){let n=p((e,n)=>new jr(t,e,n));return Q.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function Lr({store:e,modal:t}){let n=e.useState(`floatingRootContext`),r=L(n,{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),i=r.reference,a=r.floating;return u(e,{activeTriggerProps:i,inactiveTriggerProps:i,popupProps:a}),null}var Rr=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,handle:s,payload:c,openOnHover:l=!1,delay:u=300,closeDelay:d=0,id:p,...m}=e,h=kr(!0),g=fn(s)??h;if(!g)throw Error(q(74));let _=C(p),v=g.useState(`isTriggerActive`,_),y=g.useState(`floatingRootContext`),b=g.useState(`isOpenedByTrigger`,_),x=g.useState(`triggerPopupId`,_),S=Q.useRef(null),{registerTrigger:w,isMountedByThisTrigger:T}=U(_,S,g,{payload:c,disabled:a,openOnHover:l,closeDelay:d}),E=g.useState(`openChangeReason`),D=g.useState(`stickIfOpen`),O=g.useState(`openMethod`),k=g.useState(`focusManagerModal`),A=Sn(y,{enabled:!a&&l&&(O!==`touch`||E!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:On(),restMs:u,delay:{close:d},triggerElementRef:S,isActiveTrigger:v,isClosing:()=>g.select(`transitionStatus`)===`ending`}),j=Le(y,{stickIfOpen:D}),M=Pe(()=>g.select(`open`),e=>{g.set(`openMethod`,e)}),N=g.useState(`triggerProps`,T),{getButtonProps:P,buttonRef:F}=te({disabled:a,native:o}),ee={open(e){return e&&E===`trigger-press`?f.open(e):R.open(e)}},{preFocusGuardRef:I,handlePreFocusGuardFocus:L,handleFocusTargetFocus:re}=In(g,S),z=Ae(`button`,e,{state:{disabled:a,open:b},ref:[F,t,w,S],props:[j.reference,A,N,M,{[ne]:``,id:_,"aria-haspopup":`dialog`,"aria-expanded":b,"aria-controls":x},m,P],stateAttributesMapping:ee}),B=(0,$.jsx)(Q.Fragment,{children:z},_);return T&&!k?(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(H,{ref:I,onFocus:L}),B,(0,$.jsx)(H,{ref:g.context.triggerFocusTargetRef,onFocus:re})]}):B}),zr=Q.createContext(void 0);function Br(){let e=Q.useContext(zr);if(e===void 0)throw Error(q(45));return e}var Vr=Q.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return kr().useState(`mounted`)||n?(0,$.jsx)(zr.Provider,{value:n,children:(0,$.jsx)(ie,{ref:t,...r})}):null}),Hr=Q.createContext(void 0);function Ur(){let e=Q.useContext(Hr);if(!e)throw Error(q(46));return e}var Wr=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,anchor:a,positionMethod:o,side:c,align:l,sideOffset:u,alignOffset:d,collisionBoundary:f=`clipping-ancestors`,collisionPadding:p,arrowPadding:m,sticky:h,disableAnchorTracking:g=!1,collisionAvoidance:_=A,...v}=e,y=kr(),b=Br(),x=D(),S=y.useState(`floatingRootContext`),C=y.useState(`mounted`),T=y.useState(`open`),E=y.useState(`openChangeReason`),O=y.useState(`activeTriggerElement`),k=y.useState(`modal`),j=y.useState(`openMethod`),M=y.useState(`positionerElement`),P=y.useState(`instantType`),F=y.useState(`transitionStatus`),ee=y.useState(`adaptiveOrigin`),I=Q.useRef(null),te=s(M),ne=Re({anchor:a,floatingRootContext:S,positionMethod:o,mounted:C,side:c,sideOffset:u,align:l,alignOffset:d,arrowPadding:m,collisionBoundary:f,collisionPadding:p,sticky:h,disableAnchorTracking:g,keepMounted:b,nodeId:x,collisionAvoidance:_,adaptiveOrigin:ee}),L=S.useState(`domReferenceElement`);z(()=>{let e=L,t=I.current;if(e&&(I.current=e),t&&e&&e!==t){y.set(`instantType`,void 0);let e=new AbortController;return te(()=>{y.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[L,te,y]);let R=k===!0&&E!==`trigger-hover`;Be(T&&R,j===`touch`,M,O);let re=y.useStateSetter(`positionerElement`),B={open:T,side:ne.side,align:ne.align,anchorHidden:ne.anchorHidden,instant:P},ie=Ve(e,B,{styles:ne.positionerStyles,transitionStatus:F,props:v,refs:[t,re],hidden:!C,inert:!T});return(0,$.jsxs)(Hr.Provider,{value:ne,children:[C&&R&&(0,$.jsx)(N,{inert:V(!T),cutout:O}),(0,$.jsx)(w,{id:x,children:ie})]})}),Gr=Q.createContext(void 0);function Kr(){let[e,t]=Q.useState(0),n=M(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:Q.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}var qr=Q.forwardRef(function(e,t){let{render:n,className:r,style:a,initialFocus:s,finalFocus:c,...l}=e,u=kr(),f=Ur(),p=Ie(!0)!=null,{context:h,hasClosePart:g}=Kr(),_=u.useState(`open`),v=u.useState(`openMethod`),y=u.useState(`instantType`),b=u.useState(`transitionStatus`),S=u.useState(`popupProps`),C=u.useState(`titleElementId`),w=u.useState(`descriptionElementId`),T=u.useState(`modal`),E=u.useState(`mounted`),D=u.useState(`openChangeReason`),O=u.useState(`activeTriggerElement`),k=u.useState(`floatingRootContext`),A=k.useState(`floatingId`),M=u.useState(`disabled`),N=u.useState(`openOnHover`),P=u.useState(`closeDelay`);x({open:_,ref:u.context.popupRef,onComplete(){_&&u.context.onOpenChangeComplete?.(!0)}}),mn(k,{enabled:N&&!M,closeDelay:P});let F=s===void 0?m(u.context.popupRef):s,I=T!==!1&&g;u.useSyncedValue(`focusManagerModal`,I);let te=u.useStateSetter(`popupElement`),ne={open:_,side:f.side,align:f.align,instant:y,transitionStatus:b},L=Ae(`div`,e,{state:ne,ref:[t,u.context.popupRef,te],props:[S,{id:A,role:`dialog`,...ee,"aria-labelledby":C,"aria-describedby":w,onKeyDown(e){p&&i.has(e.key)&&e.stopPropagation()}},Fe(b),l],stateAttributesMapping:o});return(0,$.jsx)(d,{context:k,openInteractionType:v,modal:I,disabled:!E||D===`trigger-hover`,initialFocus:F,returnFocus:c,restoreFocus:`popup`,previousFocusableElement:j(O)?O:void 0,nextFocusableElement:u.context.triggerFocusTargetRef,beforeContentFocusGuardRef:u.context.beforeContentFocusGuardRef,children:(0,$.jsx)(Gr.Provider,{value:h,children:L})})}),Jr=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,s=kr(),{side:c}=Ur(),l=s.useState(`instantType`),{children:u,state:d}=xr({store:s,side:c,children:a}),f={activationDirection:d.activationDirection,transitioning:d.transitioning,instant:l};return Ae(`div`,e,{state:f,ref:t,props:[o,{children:u}],stateAttributesMapping:br})}),Yr=Fr;function Xr({className:e,children:t,...n}){return(0,$.jsx)(Rr,{className:e,"data-slot":`popover-trigger`,...n,children:t})}function Zr({children:e,className:t,viewportClassName:n,side:r=`bottom`,align:i=`center`,sideOffset:a=4,alignOffset:o=0,tooltipStyle:s=!1,anchor:c,...l}){return(0,$.jsx)(Vr,{children:(0,$.jsx)(Wr,{align:i,alignOffset:o,anchor:c,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:K(`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`,...l,children:(0,$.jsx)(Jr,{className:K(`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 Qr({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)(Yr,{open:r,onOpenChange:e=>{e&&o(``),i(e)},children:[(0,$.jsx)(Xr,{render:(0,$.jsxs)(J,{variant:`outline`,size:`sm`,disabled:t,className:`h-8 text-xs text-muted-foreground`,children:[(0,$.jsx)(Ut,{size:14}),` Add repository`]})}),(0,$.jsxs)(Zr,{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)(ae,{className:`absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground`}),(0,$.jsx)(I,{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 $r=(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}`;case`cursor`:return`cursor-agent --resume ${t}`;default:return`agy --conversation ${t}`}},ei=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)($e,{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)(Ze,{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)(et,{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)(rt,{className:`size-2.5`})});default:return null}},ti=({ws:e,sessions:t,sessionsLoading:n,setActiveSession:r,setTranscript:i,fetchSessionTranscript:a,handleOpenDesktopSession:o,showToast:s})=>{let[c,l]=(0,Q.useState)(!1),u=(0,Q.useMemo)(()=>t.filter(e=>c||e.threadKind!==`subagent`),[t,c]),d=t.filter(e=>e.threadKind===`subagent`).length,f=ce(),p=he(),m=Se(),h=m.data?.find(e=>e.name===`antigravity`)?.detected??!0,g=!!m.data?.find(e=>e.name===`claude`)?.detected,_=!!m.data?.find(e=>e.name===`codex`)?.detected,v=!!m.data?.find(e=>e.name===`copilot`)?.command,y=!!f.data?.some(e=>e.id===`antigravity`&&e.available),b=!!f.data?.some(e=>e.id===`codex-desktop`&&e.available),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(null),[T,E]=(0,Q.useState)(null),[D,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(`updated-desc`),[j,M]=(0,Q.useState)(`harness`),[N,P]=(0,Q.useState)(``),[F,ee]=(0,Q.useState)(`all`),[I,te]=(0,Q.useState)({antigravity:!1,claude:!1,codex:!1,copilot:!1}),ne=e=>{te(t=>({...t,[e]:!t[e]}))},L=(0,Q.useRef)(!1),R=(0,Q.useRef)(null),re=async t=>{try{await Y(`/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`)}},z=async t=>{if(!T){E(t);try{await p.mutateAsync({workspaceId:e.branchName,assistant:t}),O({assistant:t,cmd:t===`antigravity`?`agy`:t===`claude`?`claude`:t===`codex`?`codex`:`copilot`,timestamp:new Date}),s?.(`Opened ${t} inside ContextSpace`,`success`)}catch(e){let t=e instanceof Error?e.message:`Failed to launch terminal`;s?.(t,`error`)}finally{E(null)}}},B=async(t,n,r)=>{if(!L.current){L.current=!0,w(t);try{await p.mutateAsync({workspaceId:e.branchName,sessionId:t,assistant:n,cwd:r});let i=$r(n,t);O({assistant:n,cmd:i,timestamp:new Date}),s?.(`Opened ${n} resume inside ContextSpace`,`success`)}catch{let e=$r(n,t);await St(e),s?.(`Copied resume command to clipboard: ${e}`,`info`)}finally{w(null),L.current=!1}}},ie=async t=>{if(!(!b||R.current)){R.current=t,S(t);try{await o(e,t,`codex`)}finally{R.current=null,S(null)}}},V=(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=Date.parse(e.updatedAt)||0;return(Date.parse(n.updatedAt)||0)-t}case`messages-desc`:return(n.messageCount||0)-(e.messageCount||0);case`title-asc`:return(e.title||``).localeCompare(n.title||``);default:return 0}}),H=(0,Q.useMemo)(()=>{let e=u;if(F!==`all`&&(e=e.filter(e=>e.assistant===F)),N.trim()){let t=N.toLowerCase();e=e.filter(e=>`${e.title} ${e.id} ${e.assistant}`.toLowerCase().includes(t))}return V(e,k)},[u,F,N,k]),U=(0,Q.useMemo)(()=>V(u.filter(e=>e.assistant===`antigravity`),k),[u,k]),oe=(0,Q.useMemo)(()=>V(u.filter(e=>e.assistant===`claude`),k),[u,k]),W=(0,Q.useMemo)(()=>V(u.filter(e=>e.assistant===`codex`),k),[u,k]),se=(0,Q.useMemo)(()=>V(u.filter(e=>e.assistant===`copilot`),k),[u,k]),le=(0,Q.useCallback)(t=>e.assistants?.includes(t)??!1,[e.assistants]),ue=(0,Q.useMemo)(()=>[{id:`antigravity`,name:`Google Antigravity`,cliCommand:`agy`,isDetected:h,isConfigured:le(`antigravity`),hasApp:y,appName:`IDE`,appTargetId:`antigravity`,sessions:U,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)($e,{className:`size-4`})})},{id:`claude`,name:`Claude Code`,cliCommand:`claude`,isDetected:g,isConfigured:le(`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)(Ze,{className:`size-3`})})},{id:`codex`,name:`OpenAI Codex`,cliCommand:`codex`,isDetected:_,isConfigured:le(`codex`),hasApp:b,appName:`Desktop`,appTargetId:`codex-desktop`,sessions:W,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)(et,{className:`size-3`})})},{id:`copilot`,name:`GitHub Copilot`,cliCommand:`copilot`,isDetected:v,isConfigured:le(`copilot`),hasApp:!1,appName:`App`,appTargetId:`copilot`,sessions:se,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)(rt,{className:`size-3`})})}],[h,g,_,v,y,b,le,U,oe,W,se]),de=(0,Q.useMemo)(()=>ue.filter(e=>e.isDetected||e.sessions.length>0),[ue]);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)(ae,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 size-3 text-muted-foreground`}),(0,$.jsx)(`input`,{type:`text`,value:N,onChange:e=>P(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`}),N&&(0,$.jsx)(`button`,{type:`button`,onClick:()=>P(``),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:()=>ee(`all`),className:K(`px-2 py-0.5 text-[11px] rounded font-medium transition-colors cursor-pointer`,F===`all`?`bg-primary text-primary-foreground font-semibold shadow-2xs`:`bg-muted/60 text-muted-foreground hover:text-foreground hover:bg-muted`),children:[`All (`,u.length,`)`]}),de.map(e=>{let t=e.sessions.length;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>ee(F===e.id?`all`:e.id),className:K(`px-2 py-0.5 text-[11px] rounded font-medium capitalize transition-colors cursor-pointer`,F===e.id?`bg-primary text-primary-foreground font-semibold shadow-2xs`:`bg-muted/60 text-muted-foreground hover:text-foreground hover:bg-muted`),children:[e.name.replace(`Google `,``).replace(`OpenAI `,``).replace(`GitHub `,``),` (`,t,`)`]},e.id)})]}),n&&(0,$.jsx)(`span`,{className:`flex items-center gap-1 text-xs text-muted-foreground shrink-0 pl-1`,children:(0,$.jsx)(Z,{className:`size-3`})})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,$.jsxs)(_n,{children:[(0,$.jsxs)(ln,{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)(on,{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`}[k]}),(0,$.jsx)(Me,{size:10,className:`text-muted-foreground opacity-70`})]}),(0,$.jsxs)(En,{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)(sn,{onClick:()=>A(`created-desc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Newest created`}),k===`created-desc`&&(0,$.jsx)(Pn,{size:12,className:`text-primary`})]}),(0,$.jsxs)(sn,{onClick:()=>A(`created-asc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Oldest created`}),k===`created-asc`&&(0,$.jsx)(Pn,{size:12,className:`text-primary`})]}),(0,$.jsxs)(sn,{onClick:()=>A(`updated-desc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Recently active`}),k===`updated-desc`&&(0,$.jsx)(Pn,{size:12,className:`text-primary`})]}),(0,$.jsxs)(sn,{onClick:()=>A(`messages-desc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Most turns`}),k===`messages-desc`&&(0,$.jsx)(Pn,{size:12,className:`text-primary`})]}),(0,$.jsxs)(sn,{onClick:()=>A(`title-asc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Title (A–Z)`}),k===`title-asc`&&(0,$.jsx)(Pn,{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:()=>M(`harness`),title:`Group chats by AI Harness`,className:K(`px-2 py-0.5 text-xs rounded font-medium transition-colors cursor-pointer`,j===`harness`?`bg-primary text-primary-foreground font-semibold shadow-2xs`:`text-muted-foreground hover:text-foreground`),children:`Grouped`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>M(`timeline`),title:`Unified Chronological Timeline`,className:K(`px-2 py-0.5 text-xs rounded font-medium transition-colors cursor-pointer`,j===`timeline`?`bg-primary text-primary-foreground font-semibold shadow-2xs`:`text-muted-foreground hover:text-foreground`),children:`Timeline`})]})]})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(`p`,{children:`Main threads are your conversations. Subagents are delegated tasks that report back to them.`}),(0,$.jsxs)(`label`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:c,onChange:e=>l(e.target.checked)}),`Include subagent sessions`,d?` (${d})`:``]})]}),D&&(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:`Opened in ContextSpace:`}),` `,(0,$.jsx)(`code`,{className:`font-mono bg-background/80 px-1.5 py-0.5 rounded text-emerald-400`,children:D.cmd})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:async()=>{await St(D.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)(Mt,{size:11}),` Copy`]}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>O(null),className:`text-muted-foreground hover:text-foreground cursor-pointer text-xs px-1`,title:`Dismiss banner`,children:`✕`})]})]}),j===`timeline`?(0,$.jsx)(Un,{className:`divide-y divide-border overflow-hidden surface-card`,children:H.length===0?(0,$.jsx)(`div`,{className:`py-8 text-center text-xs text-muted-foreground`,children:N?`No chat sessions match your search filter.`:`No chat sessions recorded yet.`}):H.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:[ei(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)(bn,{session:e}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsx)(un,{session:e}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsxs)(`span`,{className:`font-mono`,children:[e.messageCount,` `,e.messageCount===1?`turn`:`turns`]}),e.usage&&((e.usage.totalTokens??0)>0||(e.usage.inputTokens??0)+(e.usage.outputTokens??0)>0)&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`•`}),(0,$.jsxs)(`span`,{className:`font-mono text-muted-foreground/90`,title:`Input: ${(e.usage.inputTokens??0).toLocaleString()} (${(e.usage.cachedInputTokens??0).toLocaleString()} cached) · Output: ${(e.usage.outputTokens??0).toLocaleString()}`,children:[Nn(e.usage.totalTokens??(e.usage.inputTokens??0)+(e.usage.outputTokens??0)),` tokens`]})]}),e.quota&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`•`}),(0,$.jsx)(`span`,{className:`inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-mono bg-muted/60 text-muted-foreground border border-border/40`,children:Cn(e.quota)})]})]}),(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)(J,{size:`xs`,variant:`default`,disabled:C===e.id||!Fn(e,t),onClick:()=>{let n=Fn(e,t);n&&B(n.id,n.assistant,n.workspacePath)},title:e.threadKind===`subagent`?`Resume the main conversation instead of the delegated task`:`Resume session in terminal (${e.id})`,children:[C===e.id?(0,$.jsx)(Z,{className:`size-3`}):(0,$.jsx)(Tt,{size:12}),(0,$.jsx)(`span`,{children:e.threadKind===`subagent`?`Main thread`:`Resume`})]}),(0,$.jsxs)(J,{size:`xs`,variant:`outline`,onClick:()=>{r(e),i([]),a(e.assistant,e.id)},title:`Inspect transcript log`,children:[(0,$.jsx)(Vn,{size:12}),(0,$.jsx)(`span`,{children:`Logs`})]}),e.assistant===`codex`&&b&&(0,$.jsxs)(J,{size:`xs`,variant:`outline`,disabled:x===e.id,onClick:()=>void ie(e.id),title:`Open in Codex Desktop`,children:[x===e.id?(0,$.jsx)(Z,{className:`size-3`}):(0,$.jsx)(Qe,{size:12}),(0,$.jsx)(`span`,{children:`Desktop`})]}),(0,$.jsx)(J,{size:`icon-xs`,variant:`ghost`,onClick:async()=>{let t=$r(e.assistant,e.id);await St(t),s?.(`Copied: ${t}`,`success`)},title:`Copy CLI resume command`,children:(0,$.jsx)(Mt,{size:12})})]})]},e.id))}):(0,$.jsx)(`div`,{className:`space-y-2.5`,children:de.map(e=>{let n=I[e.id]??!1,o=e.sessions.filter(e=>{if(!N.trim())return!0;let t=N.toLowerCase();return`${e.title} ${e.id}`.toLowerCase().includes(t)});return(0,$.jsxs)(Un,{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:()=>ne(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:n?(0,$.jsx)(Me,{size:14}):(0,$.jsx)(dn,{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)(Bt,{tone:e.isDetected?`success`:`neutral`,dot:e.isDetected,children:[`CLI: `,e.cliCommand]}),e.hasApp&&(0,$.jsx)(Bt,{tone:`running`,children:e.appName}),(0,$.jsxs)(`span`,{className:`text-[11px] text-muted-foreground font-mono`,children:[`(`,o.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)(J,{size:`xs`,variant:`default`,disabled:T===e.id,onClick:()=>void z(e.id),title:`Launch new ${e.cliCommand} session in terminal`,children:[T===e.id?(0,$.jsx)(Z,{className:`size-3`}):(0,$.jsx)(Ut,{size:12}),(0,$.jsx)(`span`,{children:`New Session`})]}),e.hasApp&&(0,$.jsxs)(J,{size:`xs`,variant:`outline`,onClick:()=>void re(e.appTargetId),title:`Open in ${e.appName}`,children:[(0,$.jsx)(Qe,{size:12}),(0,$.jsx)(`span`,{children:e.appName})]})]})]}),n&&(0,$.jsx)(`div`,{className:`divide-y divide-border/60 border-t border-border`,children:o.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:N?`No sessions match your search query.`:`No previous sessions recorded for ${e.name}.`}),!N&&(0,$.jsxs)(`button`,{type:`button`,onClick:()=>void z(e.id),className:`text-primary font-semibold hover:underline cursor-pointer inline-flex items-center gap-1 text-xs`,children:[(0,$.jsx)(Ut,{size:11}),` Start session`]})]}):o.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)(bn,{session:e}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsx)(un,{session:e}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsxs)(`span`,{children:[e.messageCount,` `,e.messageCount===1?`turn`:`turns`]}),e.usage&&((e.usage.totalTokens??0)>0||(e.usage.inputTokens??0)+(e.usage.outputTokens??0)>0)&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`•`}),(0,$.jsxs)(`span`,{className:`text-muted-foreground/90`,title:`Input: ${(e.usage.inputTokens??0).toLocaleString()} (${(e.usage.cachedInputTokens??0).toLocaleString()} cached) · Output: ${(e.usage.outputTokens??0).toLocaleString()}`,children:[Nn(e.usage.totalTokens??(e.usage.inputTokens??0)+(e.usage.outputTokens??0)),` tokens`]})]}),e.quota&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`•`}),(0,$.jsx)(`span`,{className:`inline-flex items-center px-1.5 py-0.5 rounded text-[10px] bg-muted/60 text-muted-foreground border border-border/40`,children:Cn(e.quota)})]})]}),(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)(J,{size:`xs`,variant:`default`,disabled:C===e.id||!Fn(e,t),onClick:()=>{let n=Fn(e,t);n&&B(n.id,n.assistant,n.workspacePath)},title:e.threadKind===`subagent`?`Resume the main conversation instead of the delegated task`:`Resume session in terminal (${e.id})`,children:[C===e.id?(0,$.jsx)(Z,{className:`size-3`}):(0,$.jsx)(Tt,{size:12}),(0,$.jsx)(`span`,{children:e.threadKind===`subagent`?`Main thread`:`Resume`})]}),(0,$.jsxs)(J,{size:`xs`,variant:`outline`,onClick:()=>{r(e),i([]),a(e.assistant,e.id)},title:`Inspect transcript log`,children:[(0,$.jsx)(Vn,{size:12}),(0,$.jsx)(`span`,{children:`Logs`})]}),e.assistant===`codex`&&b&&(0,$.jsxs)(J,{size:`xs`,variant:`outline`,disabled:x===e.id,onClick:()=>void ie(e.id),title:`Open in Codex Desktop`,children:[x===e.id?(0,$.jsx)(Z,{className:`size-3`}):(0,$.jsx)(Qe,{size:12}),(0,$.jsx)(`span`,{children:`Desktop`})]}),(0,$.jsx)(J,{size:`icon-xs`,variant:`ghost`,onClick:async()=>{let t=$r(e.assistant,e.id);await St(t),s?.(`Copied: ${t}`,`success`)},title:`Copy CLI resume command`,children:(0,$.jsx)(Mt,{size:12})})]})]},e.id))})]},e.id)})})]})},ni=({ws:e,gitChanges:t,gitChangesLoading:n,syncLoading:r,syncResults:i,commitMessage:a,showCommitModal:o,commitLoading:s,commitResults:c,setSyncResults:l,setCommitResults:u,setCommitMessage:d,setShowCommitModal:f,fetchGitChanges:p,handleSyncAll:m,handleCommitAll:h,showToast:g})=>{let[_,v]=(0,Q.useState)({}),[y,b]=(0,Q.useState)({}),[x,S]=(0,Q.useState)({}),[C,w]=(0,Q.useState)({}),[T,E]=(0,Q.useState)({}),[D,O]=(0,Q.useState)({}),[k,A]=(0,Q.useState)({}),[j,M]=(0,Q.useState)({}),[N,P]=(0,Q.useState)(0),[F,ee]=(0,Q.useState)(``),[te,ne]=(0,Q.useState)(0),[L,R]=(0,Q.useState)({}),[re,z]=(0,Q.useState)(!1),B=ve().data?.config,ie=Nt(),V=B?.defaultEditor,H=Kt(V),U=nn(),ae=t.filter(e=>e.files&&e.files.length>0),oe=ae.reduce((e,t)=>e+t.files.length,0);(0,Q.useEffect)(()=>{S({}),w({}),E({}),O({}),b({}),M({}),R({}),pn.clear()},[e.branchName]),(0,Q.useEffect)(()=>{if(!t||t.length===0){pn.clear();return}let n=!1,r=new Set;for(let e of t)for(let t of e.files||[])r.add(`${e.repoName}/${t.file}`);for(let e of pn.getAllSymbols())r.has(`${e.repoName}/${e.filePath}`)||pn.removeFile(e.repoName,e.filePath);return(async()=>{try{let t=encodeURIComponent(e.branchName),r=await fetch(`/api/workspace/${t}/changes/symbols`);if(r.ok&&!n){let e=await r.json();if(e.symbols&&Array.isArray(e.symbols)){let t={};for(let n of e.symbols){let e=`${n.repoName}/${n.filePath}`;t[e]||(t[e]={repoName:n.repoName,filePath:n.filePath,repoPath:n.repoPath,symbols:[]}),t[e].symbols.push(n)}for(let e of Object.values(t)){if(n)break;O(t=>({...t,[`${e.repoName}/${e.filePath}`]:e.symbols})),pn.indexFile(e.repoName,e.filePath,``,[],e.repoPath,e.symbols)}}}}catch{}})(),()=>{n=!0}},[t,e.branchName]);let W=(0,Q.useMemo)(()=>{let e=[];for(let t of ae)for(let n of t.files||[])e.push({repoName:t.repoName,repoPath:t.repoPath,file:n.file,type:n.type,additions:n.additions||0,deletions:n.deletions||0});return e},[ae]),se=e=>_[e]??!0,ce=e=>{v(t=>({...t,[e]:!se(e)}))},le=()=>{let e={};t.forEach(t=>{e[t.repoName]=!1}),v(e)},de=()=>{let e={};t.forEach(t=>{e[t.repoName]=!0}),v(e),b({})},fe=(0,Q.useCallback)(async(n,r)=>{let i=`${n}/${r}`,a=!y[i];if(b(e=>({...e,[i]:a})),a&&!x[i]){A(e=>({...e,[i]:!0})),M(e=>({...e,[i]:``}));try{let a=encodeURIComponent(e.branchName),o=await fetch(`/api/workspace/${a}/changes/diff?repo=${encodeURIComponent(n)}&file=${encodeURIComponent(r)}`);if(!o.ok)throw Error(`Failed to load diff: ${o.statusText}`);let s=await o.json();if(S(e=>({...e,[i]:s.diff||``})),s.fileContent&&w(e=>({...e,[i]:s.fileContent})),s.originalContent&&E(e=>({...e,[i]:s.originalContent})),s.symbols&&O(e=>({...e,[i]:s.symbols})),s.diff){let e=Rn(s.diff),i=s.fileContent||e.modifiedContent,a=t.find(e=>e.repoName===n);pn.indexFile(n,r,i,e.hunks,a?.repoPath,s.symbols)}}catch(e){M(t=>({...t,[i]:e.message||`Unknown error`}))}finally{A(e=>({...e,[i]:!1}))}}},[y,x,e.branchName,t]),pe=(0,Q.useCallback)(async(e,t)=>{if(e<0||e>=W.length)return;P(e);let n=W[e];ee(`${n.repoName}/${n.file}`),ne(e=>e+1);let r=`${n.repoName}/${n.file}`;v(e=>({...e,[n.repoName]:!1})),t!==void 0&&R(e=>({...e,[r]:t})),y[r]||await fe(n.repoName,n.file);let i=`file-diff-${n.repoName}-${n.file.replace(/[^a-zA-Z0-9_-]/g,`_`)}`;setTimeout(()=>{let e=document.getElementById(i);e&&e.scrollIntoView({behavior:`smooth`,block:`start`})},50)},[W,y,fe]),me=(n,r,i)=>{let a=r.replace(/\\/g,`/`).replace(/^\//,``),o=W.findIndex(e=>{let t=e.file.replace(/\\/g,`/`).replace(/^\//,``);return(e.repoName===n||n===`workspace`||!n)&&(t===a||t.endsWith(a)||a.endsWith(t))});if(o!==-1)pe(o,i),g?.(`Navigated to ${r}${i?`:${i}`:``}`,`info`);else{g?.(`Opening ${r}${i?`:${i}`:``} in ${H}`,`info`);let a=t.find(e=>e.repoName===n)?.repoPath||e.repos&&e.repos.find(e=>e.endsWith(n))||n;bt(a,r,i||1,1,V)}};(0,Q.useEffect)(()=>{let e=e=>{let t=e.target;if(!(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable)){if(e.altKey&&(e.key===`ArrowDown`||e.key===`Down`)){if(e.preventDefault(),W.length>0){let e=(N+1)%W.length;pe(e)}}else if(e.altKey&&(e.key===`ArrowUp`||e.key===`Up`)&&(e.preventDefault(),W.length>0)){let e=(N-1+W.length)%W.length;pe(e)}}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[N,W,pe]);let he=W[N]||null;return(0,$.jsxs)(`div`,{className:`animate-fade-in`,children:[(0,$.jsxs)(`header`,{className:`flex justify-between items-center mb-4 flex-wrap gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,$.jsxs)(`h4`,{className:`flex items-center gap-2 text-sm font-bold text-foreground`,children:[(0,$.jsx)(_e,{size:16,className:`text-primary`}),` Active Workspace Git Diffs`]}),ae.length>0&&(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 pl-2 border-l border-border/80`,children:[(0,$.jsxs)(J,{variant:`ghost`,size:`xs`,onClick:de,title:`Collapse all repositories and file diffs`,className:`text-xs text-muted-foreground hover:text-foreground h-7 px-2 gap-1 font-semibold`,children:[(0,$.jsx)(Jn,{size:12}),(0,$.jsx)(`span`,{children:`Collapse All`})]}),(0,$.jsxs)(J,{variant:`ghost`,size:`xs`,onClick:le,title:`Expand all repositories`,className:`text-xs text-muted-foreground hover:text-foreground h-7 px-2 gap-1 font-semibold`,children:[(0,$.jsx)(Yn,{size:12}),(0,$.jsx)(`span`,{children:`Expand All`})]})]})]}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsxs)(J,{variant:`outline`,size:`sm`,onClick:()=>p(e.branchName),disabled:n,children:[(0,$.jsx)(zt,{size:11,className:n?`animate-spin text-primary`:``}),` Refresh Changes`]}),e.mode!==`in-place`&&(0,$.jsxs)(J,{variant:`outline`,size:`sm`,onClick:()=>m(e.branchName),disabled:r,children:[r?(0,$.jsx)(Z,{className:`size-3`}):(0,$.jsx)(zt,{size:11}),` Sync All`]}),(0,$.jsx)(J,{size:`sm`,onClick:()=>f(!0),disabled:oe===0||s,children:`Commit & Push All`})]})]}),W.length>0&&(0,$.jsxs)(`div`,{className:`mb-5 flex flex-wrap items-center justify-between gap-2.5 rounded-xl border border-border/90 bg-card/75 p-2.5 px-3.5 backdrop-blur-md shadow-xs select-none`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,$.jsx)(`span`,{className:`grid size-6 place-items-center rounded-md bg-primary/10 text-primary shrink-0`,children:(0,$.jsx)(rr,{size:12})}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 font-mono text-xs font-semibold text-foreground`,children:[(0,$.jsx)(`span`,{children:`File`}),(0,$.jsx)(`span`,{className:`rounded bg-primary/15 border border-primary/25 px-1.5 py-0.2 text-primary`,children:N+1}),(0,$.jsxs)(`span`,{className:`text-muted-foreground`,children:[`of `,W.length]})]}),(0,$.jsx)(`select`,{value:N,onChange:e=>void pe(Number(e.target.value)),className:`ml-2 max-w-[240px] sm:max-w-[360px] rounded-lg border border-border bg-background/80 px-2 py-1 font-mono text-[11px] text-foreground focus:outline-hidden focus:ring-1 focus:ring-primary truncate`,children:W.map((e,t)=>(0,$.jsxs)(`option`,{value:t,children:[`[`,e.type.slice(0,3),`] `,e.repoName,`: `,e.file,` (+`,e.additions,` -`,e.deletions,`)`]},`${e.repoName}/${e.file}`))})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>{let e=(N-1+W.length)%W.length;pe(e)},className:`inline-flex items-center gap-1 px-2 py-1 rounded border border-border bg-card hover:bg-accent font-mono text-[10px] text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,title:`Jump to previous modified file (Shortcut: Alt+Up)`,children:[(0,$.jsx)(Ue,{size:12}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:`Prev (Alt+↑)`})]}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>{let e=(N+1)%W.length;pe(e)},className:`inline-flex items-center gap-1 px-2 py-1 rounded border border-border bg-card hover:bg-accent font-mono text-[10px] text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,title:`Jump to next modified file (Shortcut: Alt+Down)`,children:[(0,$.jsx)(Me,{size:12}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:`Next (Alt+↓)`})]}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>z(e=>!e),className:K(`inline-flex items-center gap-1 px-2 py-1 rounded border font-mono text-[10px] transition-colors cursor-pointer`,re?`border-primary/50 bg-primary/15 text-primary font-bold`:`border-border bg-card hover:bg-accent text-muted-foreground hover:text-foreground`),title:`Toggle Global Changeset Symbol Explorer`,children:[(0,$.jsx)(At,{size:12}),(0,$.jsxs)(`span`,{children:[`Symbols (`,U.length,`)`]})]}),he&&(0,$.jsxs)(`button`,{type:`button`,onClick:()=>{bt(he.repoPath,he.file,1,1,V),g?.(`Opened ${he.file} in ${H}`,`success`)},className:`inline-flex items-center gap-1 px-2 py-1 rounded border border-border bg-card hover:bg-accent font-mono text-[10px] text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,title:`Open selected file in desktop ${H}`,children:[(0,$.jsx)(Qe,{size:11}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:H})]})]})]}),re&&(0,$.jsx)(`div`,{className:`mb-5`,children:(0,$.jsx)(xn,{symbols:U,activeFilePath:he?.file,editorLabel:H,onSelectSymbol:e=>{me(e.repoName,e.filePath,e.lineNumber)},onOpenInVsCode:e=>{let n=W.find(t=>t.repoName===e.repoName&&t.file===e.filePath)||W.find(t=>t.file===e.filePath),r=e.repoPath||n?.repoPath||t.find(t=>t.repoName===e.repoName)?.repoPath||e.repoName;bt(r,e.filePath,e.lineNumber,e.column,V),g?.(`Opened ${e.filePath}:${e.lineNumber} in ${H}`,`success`)},onClose:()=>z(!1)})}),i&&e.mode!==`in-place`&&(0,$.jsxs)(`div`,{className:`relative mb-5 rounded-xl border border-info/25 bg-info/10 p-5 text-info-foreground shadow-sm`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between border-b border-info/20 pb-2`,children:[(0,$.jsx)(`h5`,{className:`font-mono text-xs font-bold text-foreground`,children:`Rebase / Sync Action Logs`}),(0,$.jsx)(`button`,{className:`cursor-pointer text-[10px] font-bold text-info-foreground hover:text-foreground`,onClick:()=>l(null),children:`Dismiss`})]}),(0,$.jsx)(`div`,{className:`space-y-2`,children:i.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-border bg-card p-2 font-mono text-[10px]`,children:[(0,$.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.repoName}),(0,$.jsx)(`span`,{className:e.success?`font-bold text-success-foreground`:`font-bold text-destructive-foreground`,children:e.success?`✓ Synced (${e.message})`:`✗ Conflict: ${e.message}`})]},e.repoName))})]}),c&&(0,$.jsxs)(`div`,{className:`relative mb-5 rounded-xl border border-success/25 bg-success/10 p-5 text-success-foreground shadow-sm`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between border-b border-success/20 pb-2`,children:[(0,$.jsx)(`h5`,{className:`font-mono text-xs font-bold text-foreground`,children:`Commit & Push Results`}),(0,$.jsx)(`button`,{className:`cursor-pointer text-[10px] font-bold text-success-foreground hover:text-foreground`,onClick:()=>u(null),children:`Dismiss`})]}),(0,$.jsx)(`div`,{className:`space-y-2`,children:c.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-border bg-card p-2 font-mono text-[10px]`,children:[(0,$.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.repoName}),(0,$.jsx)(`span`,{className:e.success?`font-bold text-success-foreground`:`font-bold text-destructive-foreground`,children:e.success?`✓ Committed ${e.filesChanged} file(s) (${e.commitHash?e.commitHash.slice(0,7):`no hash`})`:`✗ Error: ${e.message}`})]},e.repoName))})]}),o&&(0,$.jsxs)(`div`,{className:`relative mb-6 rounded-xl border border-border bg-card p-6 shadow-sm animate-rise`,children:[(0,$.jsxs)(`h5`,{className:`mb-3 flex items-center gap-1.5 text-xs font-bold text-foreground`,children:[(0,$.jsx)(Lt,{size:13,className:`text-primary`}),` Enter Commit Message`]}),(0,$.jsx)(I,{type:`text`,className:`mb-4 font-mono text-xs`,placeholder:`feat: implement multi-repo logic...`,value:a,onChange:e=>d(e.target.value),onKeyDown:t=>{t.key===`Enter`&&a.trim()&&h(e.branchName)}}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2.5`,children:[(0,$.jsx)(J,{variant:`outline`,size:`sm`,onClick:()=>{f(!1),d(``)},disabled:s,children:`Cancel`}),(0,$.jsxs)(J,{size:`sm`,onClick:()=>h(e.branchName),disabled:s||!a.trim(),children:[s?(0,$.jsx)(Z,{className:`size-3`}):null,s?`Committing...`:`Commit & Push All`]})]})]}),n?(0,$.jsx)(`div`,{className:`flex justify-center py-20`,children:(0,$.jsx)(Z,{className:`size-6 text-primary`})}):(0,$.jsx)(`div`,{className:`space-y-4`,children:ae.length===0?(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center rounded-xl border border-border bg-card py-16 text-center shadow-xs`,children:[(0,$.jsx)(`div`,{className:`mb-3 flex h-10 w-10 items-center justify-center rounded-full border border-success/25 bg-success/10 text-success-foreground shadow-sm`,children:(0,$.jsx)(Pn,{size:20})}),(0,$.jsx)(`h5`,{className:`text-sm font-bold text-foreground`,children:`No Uncommitted Changes`}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Workspace repositories are completely in sync with Git feature branches.`})]}):ae.map(t=>{let n=t.files.length,r=t.files.reduce((e,t)=>e+(t.additions||0),0),i=t.files.reduce((e,t)=>e+(t.deletions||0),0),a=se(t.repoName);return(0,$.jsxs)(`div`,{className:`relative rounded-xl border border-border/80 bg-card/80 backdrop-blur-md transition-all shadow-xs overflow-hidden`,children:[(0,$.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:()=>ce(t.repoName),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),ce(t.repoName))},className:K(`flex justify-between items-center px-5 py-4 cursor-pointer select-none transition-colors`,a?`hover:bg-accent/40`:`bg-muted/20 border-b border-border/60 hover:bg-muted/30`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap min-w-0`,children:[(0,$.jsx)(`span`,{className:`grid size-6 place-items-center rounded-md bg-primary/10 text-primary border border-primary/20 shrink-0`,children:a?(0,$.jsx)(dn,{size:14,className:`shrink-0 text-muted-foreground`}):(0,$.jsx)(Me,{size:14,className:`shrink-0 text-primary`})}),(0,$.jsx)(`h5`,{className:`font-mono text-sm font-bold text-foreground truncate`,children:t.repoName}),(0,$.jsxs)(Bt,{tone:`warning`,dot:!1,children:[n,` file`,n===1?``:`s`,` changed`]}),(r>0||i>0)&&(0,$.jsxs)(`span`,{className:`rounded-md border border-border bg-muted/60 px-2 py-0.5 font-mono text-[10px] font-bold`,children:[(0,$.jsxs)(`span`,{className:`font-bold text-success-foreground`,children:[`+`,r]}),` `,(0,$.jsxs)(`span`,{className:`font-bold text-destructive-foreground`,children:[`-`,i]})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3 shrink-0`,children:[(0,$.jsx)(`span`,{className:`max-w-[280px] truncate font-mono text-[10px] text-muted-foreground hidden md:inline`,title:t.repoPath,children:t.repoPath}),(0,$.jsx)(`span`,{className:`text-[11px] font-bold text-primary hover:underline`,children:a?`Expand Files`:`Collapse`})]})]}),!a&&(0,$.jsx)(`div`,{className:`p-5 flex flex-col gap-3 bg-card/40`,children:(0,$.jsx)(wt,{label:`${t.repoName} changed files`,files:t.files,revealPath:F.startsWith(`${t.repoName}/`)?F.slice(t.repoName.length+1):void 0,revealKey:te,renderFile:n=>{let r=`${t.repoName}/${n.file}`,i=!!y[r],a=!!k[r],o=x[r]||``,s=j[r]||``,c=`file-diff-${t.repoName}-${n.file.replace(/[^a-zA-Z0-9_-]/g,`_`)}`;return(0,$.jsxs)(`div`,{id:c,className:`overflow-hidden rounded transition-colors`,children:[(0,$.jsxs)(`div`,{className:`flex cursor-pointer select-none items-center justify-between px-2 py-1.5 transition-colors hover:bg-accent/50`,role:`button`,tabIndex:0,"aria-expanded":i,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),fe(t.repoName,n.file))},onClick:()=>fe(t.repoName,n.file),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[i?(0,$.jsx)(Me,{size:14,className:`shrink-0 text-primary`}):(0,$.jsx)(dn,{size:14,className:`shrink-0 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`max-w-[240px] truncate font-mono text-[11px] text-foreground sm:max-w-[480px] font-semibold`,title:n.file,children:n.file.split(`/`).at(-1)}),(n.additions>0||n.deletions>0)&&(0,$.jsxs)(`span`,{className:`ml-1 shrink-0 font-mono text-[9px] font-bold text-muted-foreground`,children:[(0,$.jsxs)(`span`,{className:`text-success-foreground`,children:[`+`,n.additions]}),` /`,` `,(0,$.jsxs)(`span`,{className:`text-destructive-foreground`,children:[`-`,n.deletions]})]})]}),(0,$.jsx)(`div`,{className:`flex items-center gap-2.5 shrink-0`,children:(0,$.jsx)(`span`,{className:`rounded border px-2 py-0.5 text-[8px] font-bold uppercase tracking-wider ${n.type===`added`?`border-success/25 bg-success/10 text-success-foreground`:n.type===`deleted`?`border-destructive/25 bg-destructive/10 text-destructive-foreground`:`border-warning/25 bg-warning/10 text-warning-foreground`}`,children:n.type})})]}),i&&(0,$.jsx)(`div`,{className:`border-t border-border bg-background p-3`,children:a?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 p-2 font-mono text-[10px] text-primary`,children:[(0,$.jsx)(Z,{className:`size-3`}),` Loading diff...`]}):s?(0,$.jsxs)(`div`,{className:`p-2 font-mono text-[10px] text-destructive-foreground`,children:[`Error: `,s]}):(0,$.jsx)(Jt,{filePath:n.file,fallbackContent:o,children:(0,$.jsx)(Dn,{filePath:n.file,repoName:t.repoName,repoPath:t.repoPath,patchText:o,fullFileContent:C[r],fullOriginalContent:T[r],preExtractedSymbols:D[r],defaultEditor:V,viewMode:ie.diffViewMode,onToggleViewMode:ie.toggleDiffMode,onRequestRefine:(r,i)=>{ue.openDraft(e.branchName,[`Refine ${t.repoName}/${n.file} at line ${r.startLineModified}.`,i,`Selected diff hunk:`,r.patchHeader,...r.lines].join(`
|
|
2
|
-
`))},initialTargetLine:L[r],onOpenFile:me,onSelectSymbol:e=>{me(e.repoName,e.filePath,e.lineNumber)},showToast:g})})})]},n.file)}})})]},t.repoName)})})]})},ri=({ws:e,knowledgeContent:t,knowledgeLoading:n,knowledgeError:r,isEditingKnowledge:i,editedKnowledge:a,saveKnowledgeLoading:o,saveKnowledgeError:s,setEditedKnowledge:c,setIsEditingKnowledge:l,handleSaveKnowledge:u,handleRetryKnowledge:d})=>{let[f,p]=(0,Q.useState)(`preview`);return(0,$.jsxs)(`div`,{className:`rounded-xl border border-border/80 bg-card/70 backdrop-blur-md p-5 shadow-xs`,children:[(0,$.jsxs)(`header`,{className:`flex justify-between items-center mb-4`,children:[(0,$.jsxs)(`h4`,{className:`flex items-center gap-2 text-sm font-bold text-foreground`,children:[(0,$.jsx)(gn,{size:16,className:`text-primary`}),` Persistent Knowledge Memory (contextspace-knowledge.md)`]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!i&&t&&(0,$.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted/50 p-0.5 rounded-md border border-border/60`,children:[(0,$.jsxs)(J,{size:`xs`,variant:f===`preview`?`secondary`:`ghost`,onClick:()=>p(`preview`),className:`text-[11px] gap-1 px-2`,children:[(0,$.jsx)(kt,{size:11}),` Preview`]}),(0,$.jsxs)(J,{size:`xs`,variant:f===`raw`?`secondary`:`ghost`,onClick:()=>p(`raw`),className:`text-[11px] gap-1 px-2`,children:[(0,$.jsx)($n,{size:11}),` Raw`]})]}),i?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{variant:`outline`,size:`xs`,onClick:()=>{c(t),l(!1)},disabled:o,children:`Cancel`}),(0,$.jsxs)(J,{size:`xs`,onClick:()=>u(e.branchName),disabled:o,children:[o?(0,$.jsx)(Z,{className:`size-3`}):(0,$.jsx)(Lt,{size:10}),` `,s?`Retry save`:`Save`]})]}):(0,$.jsxs)(J,{variant:`outline`,size:`xs`,onClick:()=>l(!0),disabled:n,children:[(0,$.jsx)(ur,{size:10}),` Edit Knowledge`]})]})]}),r&&(0,$.jsxs)(`div`,{role:`alert`,className:`mb-4 flex flex-wrap items-center justify-between gap-3 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive-foreground`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(X,{size:14,className:`shrink-0`}),(0,$.jsx)(`span`,{children:r})]}),(0,$.jsxs)(J,{variant:`outline`,size:`xs`,onClick:()=>void d(e.branchName),disabled:n,children:[(0,$.jsx)(zt,{size:11,className:n?`animate-spin`:``}),` Retry load`]})]}),s&&(0,$.jsxs)(`div`,{role:`alert`,className:`mb-4 flex items-center gap-2 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive-foreground`,children:[(0,$.jsx)(X,{size:14,className:`shrink-0`}),(0,$.jsx)(`span`,{children:s})]}),i?(0,$.jsx)(cn,{"aria-label":`Knowledge editor`,className:`[&_[data-slot=textarea]]:h-96 [&_[data-slot=textarea]]:resize-y [&_[data-slot=textarea]]:font-mono [&_[data-slot=textarea]]:text-xs`,value:a,onChange:e=>c(e.target.value)}):n&&!t?(0,$.jsx)(`div`,{className:`flex justify-center py-10`,children:(0,$.jsx)(zt,{className:`animate-spin text-primary`,size:20})}):t?f===`preview`?(0,$.jsx)(`div`,{className:`max-h-[550px] overflow-auto rounded-xl border border-border/70 bg-card/40 backdrop-blur-xs p-4`,children:(0,$.jsx)(Pt,{content:t})}):(0,$.jsx)(`div`,{className:`max-h-[550px] overflow-auto whitespace-pre-wrap rounded-xl border border-border/70 bg-card/40 backdrop-blur-xs p-4 font-mono text-xs leading-relaxed text-muted-foreground`,children:t}):(0,$.jsx)(`div`,{className:`rounded-md border border-dashed border-border/80 bg-muted/20 p-6 text-center text-xs text-muted-foreground`,children:`No knowledge file generated yet.`})]})},ii=({planContent:e,planLoading:t,planError:n,handleRetryPlan:r,workspaceId:i,defaultViewMode:a=`flow`})=>{let[o,s]=(0,Q.useState)(a),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{a&&s(a)},[a]);let w=(0,Q.useCallback)(async()=>{if(i){p(!0);try{let e=await Y(`/api/workspace/${encodeURIComponent(i)}/lifecycle`);d(e.lifecycle),e.plan!==void 0&&l(e.plan),e.report!==void 0&&y(e.report)}catch(e){console.warn(`Could not load workspace lifecycle:`,e)}finally{p(!1)}}},[i]);(0,Q.useEffect)(()=>{l(null),y(null),_(null),w()},[w]);let T=async()=>{if(i){h(!0),_(null);try{let e=(await Y(`/api/workspace/${encodeURIComponent(i)}/verify`,{method:`POST`,body:JSON.stringify({})})).report;y(e);let t={pass:`Tests passed (${(e.durationMs/1e3).toFixed(1)}s, ${e.repos.length} repositories).${u?.steps.some(e=>e.id===u.currentStepId&&e.requiresVerification)?` Use Verify & Complete on the active gate to advance.`:``}`,pass_dirty:e.canProgress?`Tests passed with uncommitted changes. Review the changes before continuing.`:`Tests passed with uncommitted changes. Commit them and rerun verification before advancing.`,"no-tests":`No test command was found. Configure a verification command for this workspace and run it again.`,timeout:`Verification timed out. Check the command and output below, then retry.`,fail:`Verification failed. Review the repository details below, fix the problem, and retry.`,skipped:`Verification was skipped. Run verification before relying on a test result.`};_({status:e.overallStatus,text:t[e.overallStatus]}),await w()}catch(e){_({status:`fail`,text:`Verification failed: ${e.message}`})}finally{h(!1)}}},E=async(e,t)=>{if(i){x(e),_(null);try{let n=await Y(`/api/workspace/${encodeURIComponent(i)}/lifecycle/step`,{method:`POST`,body:JSON.stringify({stepId:e,action:t})});d(n.lifecycle),await w()}catch(e){_({status:`fail`,text:e instanceof Error?e.message:`Unable to advance lifecycle.`}),await w()}finally{x(null)}}},D=/<!-- CONTEXTSPACE:MILESTONES:START -->[\s\S]*?<!-- CONTEXTSPACE:MILESTONES:END -->/,O=c===null?e:D.test(e)?e.replace(D,()=>c):`${c}\n\n${e}`,k=!!u?.steps.length,A=o===`flow`&&!k?`preview`:o;return(0,$.jsxs)(`div`,{className:`rounded-xl border border-border/80 bg-card/70 backdrop-blur-md p-5 shadow-xs`,children:[(0,$.jsxs)(`header`,{className:`flex flex-wrap justify-between items-center gap-3 mb-5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(xt,{size:18,className:`text-primary`}),(0,$.jsx)(`h4`,{className:`text-sm font-bold text-foreground`,children:k?`Lifecycle Flow & Implementation Plan`:`Plan & verification`}),k&&u&&(0,$.jsxs)(`span`,{className:`px-2 py-0.5 text-[11px] font-semibold rounded-full bg-primary/10 text-primary border border-primary/20 uppercase tracking-wider`,children:[u.flowType,` flow`]})]}),(0,$.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted/50 p-0.5 rounded-md border border-border/60`,children:[k&&(0,$.jsxs)(J,{size:`xs`,variant:A===`flow`?`secondary`:`ghost`,onClick:()=>s(`flow`),className:`text-[11px] gap-1 px-2.5 font-medium`,children:[(0,$.jsx)(xt,{size:12}),` Visual Flow`]}),(0,$.jsxs)(J,{size:`xs`,variant:A===`preview`?`secondary`:`ghost`,onClick:()=>s(`preview`),className:`text-[11px] gap-1 px-2.5`,children:[(0,$.jsx)(kt,{size:12}),` Markdown Plan`]}),(0,$.jsxs)(J,{size:`xs`,variant:A===`raw`?`secondary`:`ghost`,onClick:()=>s(`raw`),className:`text-[11px] gap-1 px-2`,children:[(0,$.jsx)($n,{size:12}),` Raw`]})]})})]}),g&&(0,$.jsxs)(`div`,{role:`status`,className:`mb-4 flex items-center justify-between p-3 rounded-lg text-xs font-medium border ${g.status===`pass`?`bg-emerald-500/10 text-emerald-400 border-emerald-500/30`:[`pass_dirty`,`no-tests`,`skipped`].includes(g.status)?`bg-amber-500/10 text-amber-400 border-amber-500/30`:`bg-rose-500/10 text-rose-400 border-rose-500/30`}`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[g.status===`pass`?(0,$.jsx)(Wt,{size:15}):([`pass_dirty`,`no-tests`,`skipped`].includes(g.status),(0,$.jsx)(X,{size:15})),(0,$.jsx)(`span`,{children:g.text})]}),(0,$.jsx)(J,{size:`xs`,variant:`ghost`,onClick:()=>_(null),className:`text-[10px] h-6 px-1.5`,children:`Dismiss`})]}),v&&(0,$.jsxs)(`details`,{className:`mb-4 rounded-lg border border-border p-3 text-xs`,open:v.overallStatus!==`pass`,children:[(0,$.jsxs)(`summary`,{className:`cursor-pointer font-medium`,children:[`Verification details (`,v.overallStatus.replaceAll(`_`,` `),`)`]}),v.repos.map((e,t)=>(0,$.jsxs)(`div`,{className:`mt-3 space-y-2 border-t border-border pt-3`,children:[(0,$.jsxs)(`p`,{className:`font-semibold`,children:[e.repoName,`: `,e.status.replaceAll(`_`,` `)]}),(0,$.jsxs)(`p`,{className:`font-mono break-all`,children:[e.command,e.exitCode===null?``:` — exit code ${e.exitCode}`]}),e.status===`no-tests`&&(0,$.jsx)(`p`,{children:`No test command found. Configure a workspace verification command.`}),e.status===`timeout`&&(0,$.jsx)(`p`,{children:`The command exceeded its time limit. Check for a stalled test or split the suite, then retry.`}),e.error&&(0,$.jsx)(`p`,{className:`text-destructive`,children:e.error}),(e.stdout||e.stderr)&&(0,$.jsx)(`pre`,{className:`max-h-64 overflow-auto whitespace-pre-wrap break-words rounded bg-muted p-3`,children:[e.stdout,e.stderr].filter(Boolean).join(`
|
|
3
|
-
`)})]},`${e.repoName}-${t}`))]}),n&&(0,$.jsxs)(`div`,{role:`alert`,className:`mb-4 flex flex-wrap items-center justify-between gap-3 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive-foreground`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(X,{size:14,className:`shrink-0`}),(0,$.jsx)(`span`,{children:n})]}),i&&(0,$.jsxs)(J,{variant:`outline`,size:`xs`,onClick:()=>void r(i),disabled:t,children:[(0,$.jsx)(zt,{size:11,className:t?`animate-spin`:``}),` Retry load`]})]}),(0,$.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-between gap-3`,children:[k&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(`span`,{className:`font-semibold text-foreground`,children:`Active Step:`}),(0,$.jsx)(`span`,{children:u?.currentStepId??`none`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[k&&(0,$.jsxs)(J,{size:`xs`,variant:`outline`,onClick:()=>void w(),disabled:f,children:[(0,$.jsx)(zt,{size:12,className:f?`animate-spin`:``}),` Refresh Radar`]}),(0,$.jsxs)(J,{size:`xs`,onClick:()=>void T(),disabled:!i||m||b!==null,children:[(0,$.jsx)(it,{size:14,className:m?`animate-spin`:``}),m?`Running Tests...`:`Run verification`]})]})]}),A===`flow`?(0,$.jsxs)(`div`,{className:`space-y-6`,children:[(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(`div`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider`,children:`Vertical Slices & Milestones`}),(0,$.jsx)(`div`,{className:`grid gap-3`,children:u?.steps.map((e,t)=>{let n=e.id===u.currentStepId,r=e.requiresVerification||e.verificationCommand||e.lastVerificationStatus||[`verify_and_ship`,`step_verification`,`epic_slice_4`].includes(e.id);return(0,$.jsx)(`div`,{className:`relative p-4 rounded-xl border transition-all ${e.status===`completed`?`border-emerald-500/30 bg-emerald-500/5`:e.status===`verified`?`border-cyan-500/40 bg-cyan-500/5`:n||e.status===`in_progress`?`border-primary/50 bg-primary/5 ring-1 ring-primary/20 shadow-xs`:e.status===`blocked`?`border-border/40 bg-muted/10 opacity-75`:`border-border/70 bg-card/40`}`,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsx)(`div`,{className:`mt-0.5 shrink-0`,children:e.status===`completed`?(0,$.jsx)(Wt,{size:18,className:`text-emerald-400`}):e.status===`verified`?(0,$.jsx)(it,{size:18,className:`text-cyan-400`}):e.status===`in_progress`?(0,$.jsx)(Zn,{size:18,className:`text-primary animate-pulse`}):e.status===`blocked`?(0,$.jsx)(Zt,{size:18,className:`text-muted-foreground/60`}):(0,$.jsx)(Qn,{size:18,className:`text-amber-400/80`})}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`span`,{className:`text-xs font-bold text-muted-foreground`,children:[`Slice `,t+1,`:`]}),(0,$.jsx)(`h5`,{className:`text-sm font-semibold text-foreground`,children:e.title}),e.status===`blocked`&&(0,$.jsxs)(`p`,{className:`w-full text-xs text-amber-500`,children:[`Blocked: `,e.unblockCondition||(e.dependsOn?.length?`Complete ${e.dependsOn.map(e=>u.steps.find(t=>t.id===e)?.title??e).join(`, `)}.`:`Set an unblock condition in Edit milestones.`)]}),e.owner&&(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded text-[10px] font-medium bg-muted text-muted-foreground`,children:[(0,$.jsx)(dr,{size:10}),` `,e.owner]}),e.repo&&(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Repo: `,e.repo]}),e.workItem&&(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground break-all`,children:[`Work item / PR: `,e.workItem]}),e.branch&&(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded text-[10px] font-mono text-cyan-400 bg-cyan-500/10 border border-cyan-500/20`,children:[(0,$.jsx)($t,{size:10}),` `,e.branch]})]}),e.description&&(0,$.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground leading-relaxed`,children:e.description}),e.dependsOn&&e.dependsOn.length>0&&(0,$.jsxs)(`div`,{className:`mt-2 flex items-center gap-1.5 text-[11px] text-muted-foreground/80`,children:[(0,$.jsx)(`span`,{className:`font-semibold`,children:`Depends on:`}),e.dependsOn.map(e=>(0,$.jsx)(`span`,{className:`px-1.5 py-0.2 bg-muted/60 rounded text-[10px] font-mono`,children:e},e))]}),e.lastVerificationStatus&&(0,$.jsxs)(`div`,{className:`mt-2 inline-flex items-center gap-1.5 text-[11px] font-medium px-2 py-0.5 rounded border ${e.lastVerificationStatus===`pass`?`text-emerald-400 bg-emerald-500/10 border-emerald-500/20`:`text-amber-400 bg-amber-500/10 border-amber-500/20`}`,children:[(0,$.jsx)(it,{size:12}),(0,$.jsxs)(`span`,{children:[`Gate: `,e.lastVerificationStatus.toUpperCase()]}),e.lastVerificationSha&&(0,$.jsxs)(`span`,{className:`font-mono text-[10px] opacity-80`,children:[`@`,e.lastVerificationSha.slice(0,7)]})]})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(e.status===`in_progress`||e.status===`verified`)&&(0,$.jsxs)(J,{size:`xs`,variant:`outline`,onClick:()=>void E(e.id,`complete`),disabled:m||b!==null,className:`text-[11px] gap-1 border-emerald-500/40 text-emerald-400 hover:bg-emerald-500/10`,children:[(0,$.jsx)(Pn,{size:12}),` `,b===e.id?`Working...`:r?`Verify & Complete`:`Mark Complete`]}),e.status===`pending`&&(0,$.jsxs)(J,{size:`xs`,variant:`ghost`,onClick:()=>void E(e.id,`start`),disabled:m||b!==null,className:`text-[11px] gap-1 text-primary hover:bg-primary/10`,children:[(0,$.jsx)(Dt,{size:12}),` Start`]}),(0,$.jsx)(`span`,{className:`text-[10px] uppercase font-bold px-2 py-0.5 rounded ${e.status===`completed`?`bg-emerald-500/20 text-emerald-400`:e.status===`verified`?`bg-cyan-500/20 text-cyan-400`:e.status===`in_progress`?`bg-primary/20 text-primary`:e.status===`blocked`?`bg-muted/40 text-muted-foreground`:`bg-amber-500/20 text-amber-400`}`,children:e.status.replace(`_`,` `)})]})]})},e.id)})})]}),u?.fleet&&u.fleet.length>0&&(0,$.jsxs)(`div`,{className:`space-y-3 pt-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>C(e=>!e),className:`flex items-center gap-1.5 text-xs font-semibold text-muted-foreground hover:text-foreground transition-colors uppercase tracking-wider cursor-pointer`,"aria-expanded":S,"aria-controls":`sister-branch-fleet-list`,children:[(0,$.jsx)(or,{size:14,className:`text-cyan-400`}),(0,$.jsx)(`span`,{children:`Sister Branch Fleet & Collaborator Radar`})]}),(0,$.jsxs)(B,{variant:`outline`,className:`text-[10px] font-mono px-1.5 py-0 h-4.5`,children:[u.fleet.length,` `,u.fleet.length===1?`branch`:`branches`]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`span`,{className:`hidden sm:inline text-[11px] text-muted-foreground`,children:`Tracking origin remote references`}),(0,$.jsx)(J,{size:`xs`,variant:`ghost`,onClick:()=>C(e=>!e),className:`h-6 px-2 text-[11px] gap-1 text-muted-foreground hover:text-foreground`,title:S?`Collapse fleet`:`Expand fleet`,"aria-expanded":S,"aria-controls":`sister-branch-fleet-list`,children:S?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Me,{size:13}),(0,$.jsx)(`span`,{children:`Collapse`})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(dn,{size:13}),(0,$.jsx)(`span`,{children:`Expand`})]})})]})]}),S&&(0,$.jsx)(`div`,{id:`sister-branch-fleet-list`,className:`grid gap-2`,children:u.fleet.map(e=>(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between p-3 rounded-lg border text-xs ${e.isCurrent?`border-primary/40 bg-primary/5`:`border-border/60 bg-card/30`}`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,$.jsx)(`span`,{className:`size-2 rounded-full shrink-0 ${e.isCurrent?`bg-emerald-400 ring-4 ring-emerald-400/20`:`bg-cyan-400`}`}),(0,$.jsx)(`span`,{className:`font-mono font-semibold text-foreground`,children:e.branch}),e.repoName&&new Set(u?.fleet?.map(e=>e.repoName)).size>1&&(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground font-mono bg-muted/60 px-1.5 py-0.2 rounded border border-border/40`,children:e.repoName}),e.isCurrent&&(0,$.jsx)(`span`,{className:`text-[10px] font-medium px-1.5 py-0.2 rounded bg-primary/20 text-primary`,children:`active worktree`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-4 text-muted-foreground`,children:[(0,$.jsxs)(`span`,{className:`font-mono text-[11px]`,children:[`+`,e.ahead,` / -`,e.behind]}),e.lastCommitAuthor&&(0,$.jsxs)(`span`,{className:`text-[11px] text-foreground/80`,children:[e.lastCommitAuthor,e.lastCommitDate&&(0,$.jsxs)(`span`,{className:`text-muted-foreground ml-1`,children:[`(`,Number.isNaN(Date.parse(e.lastCommitDate))?`Date unavailable — reload flow`:new Date(e.lastCommitDate).toLocaleString(),`)`]})]}),e.lastCommitMessage&&(0,$.jsxs)(`span`,{className:`truncate max-w-[240px] text-muted-foreground italic text-[11px]`,children:[`"`,e.lastCommitMessage,`"`]})]})]},`${e.repoName}:${e.branch}`))})]})]}):(0,$.jsx)(`div`,{children:t&&!O?(0,$.jsx)(`div`,{className:`flex justify-center py-10`,children:(0,$.jsx)(zt,{className:`animate-spin text-primary`,size:20})}):O?A===`preview`?(0,$.jsx)(`div`,{className:`max-h-[550px] overflow-auto rounded-xl border border-border/70 bg-card/40 backdrop-blur-xs p-4`,children:(0,$.jsx)(Pt,{content:O})}):(0,$.jsx)(`div`,{className:`max-h-[550px] overflow-auto whitespace-pre-wrap rounded-xl border border-border/70 bg-card/40 backdrop-blur-xs p-4 font-mono text-xs leading-relaxed text-muted-foreground`,children:O}):(0,$.jsx)(`div`,{className:`rounded-md border border-dashed border-border/80 bg-muted/20 p-6 text-center text-xs text-muted-foreground`,children:`No implementation plan generated yet.`})})]})};function ai({workspaceId:e}){let[t,n]=(0,Q.useState)([]),[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(``),[l,u]=(0,Q.useState)(0),[d,f]=(0,Q.useState)(!0),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(!1),x=`/api/workspace/${encodeURIComponent(e)}/documents`;(0,Q.useEffect)(()=>{let e=new AbortController;return f(!0),g(``),Y(x,{signal:e.signal}).then(e=>{n(e.documents),i(t=>e.documents.some(e=>e.name===t)?t:null)}).catch(t=>{e.signal.aborted||g(t instanceof Error?t.message:`Unable to load documents.`)}).finally(()=>{e.signal.aborted||f(!1)}),()=>e.abort()},[x,l]),(0,Q.useEffect)(()=>{let e=new AbortController;return o(null),v(``),b(!1),r?(m(!0),Y(`${x}/preview?name=${encodeURIComponent(r)}`,{signal:e.signal}).then(o).catch(t=>{e.signal.aborted||v(t instanceof Error?t.message:`Unable to open document.`)}).finally(()=>{e.signal.aborted||m(!1)}),()=>e.abort()):(m(!1),()=>e.abort())},[x,r,l]);let S=r?`${x}/file?name=${encodeURIComponent(r)}`:``,C=t.filter(e=>e.name.toLowerCase().includes(s.toLowerCase()));return(0,$.jsxs)(`section`,{"aria-label":`Workspace documents`,className:`space-y-4`,children:[(0,$.jsxs)(`header`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Documents`}),(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Files in the workspace root, including documents created by your agents.`})]}),(0,$.jsxs)(J,{variant:`outline`,disabled:d||p,onClick:()=>u(e=>e+1),children:[(0,$.jsx)(zt,{size:14}),`Refresh documents`]})]}),h&&(0,$.jsxs)(`div`,{role:`alert`,className:`text-sm text-destructive`,children:[h,` `,(0,$.jsx)(J,{variant:`outline`,onClick:()=>u(e=>e+1),children:`Retry documents`})]}),(0,$.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[minmax(200px,280px)_minmax(0,1fr)]`,children:[(0,$.jsxs)(`aside`,{className:`rounded-xl border border-border bg-card p-3 space-y-3`,children:[(0,$.jsx)(I,{"aria-label":`Filter documents`,placeholder:`Filter documents…`,value:s,onChange:e=>c(e.target.value)}),d?(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Loading documents…`}):!h&&!t.length?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No documents in the workspace root yet. Refresh after a file is created.`}):!C.length&&(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No matching documents.`}),(0,$.jsx)(`ul`,{className:`max-h-[65vh] overflow-y-auto space-y-1`,children:C.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":r===e.name,className:`w-full rounded-lg p-2 text-left text-sm hover:bg-accent ${r===e.name?`bg-accent text-accent-foreground`:``}`,onClick:()=>i(e.name),children:[(0,$.jsxs)(`span`,{className:`flex gap-2 items-start`,children:[(0,$.jsx)(kt,{size:15,className:`mt-0.5 shrink-0`}),(0,$.jsx)(`span`,{className:`break-all`,children:e.name})]}),(0,$.jsxs)(`span`,{className:`block pl-6 text-xs text-muted-foreground`,children:[Math.max(1,Math.ceil(e.size/1024)),` KB · `,new Date(e.modifiedAt).toLocaleDateString()]})]})},e.name))})]}),(0,$.jsx)(`article`,{"aria-label":`Document preview`,className:`min-w-0 rounded-xl border border-border bg-card p-4 space-y-4`,children:r?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsx)(`h3`,{className:`font-semibold break-all`,children:r}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3 text-sm`,children:[(a?.kind===`markdown`||a?.kind===`html`)&&(0,$.jsx)(J,{size:`sm`,variant:`outline`,onClick:()=>b(e=>!e),children:y?`Rendered view`:`Raw text`}),(0,$.jsx)(`a`,{href:`${S}&download=1`,download:r,className:`text-primary underline`,children:`Download`}),(0,$.jsx)(J,{size:`sm`,variant:`ghost`,onClick:()=>i(null),children:`Close document`})]})]}),p&&(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Opening document…`}),_&&(0,$.jsxs)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:[_,` `,(0,$.jsx)(J,{size:`sm`,variant:`outline`,onClick:()=>u(e=>e+1),children:`Retry preview`})]}),a&&(0,$.jsx)(`div`,{className:`max-h-[70vh] overflow-auto`,children:(0,$.jsx)(Hn,{preview:a,fileUrl:`${S}&revision=${l}`,raw:y})})]}):(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Select a document to open it here.`})})]})]})}function oi({workspaceId:e}){let[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(``),[a,o]=(0,Q.useState)(``),[s,c]=(0,Q.useState)(``),[l,u]=(0,Q.useState)(!1),d=`/api/workspace/${encodeURIComponent(e)}/planning-notes`,f=async e=>{u(!0),o(``),c(``);try{let t=await Y(d,{signal:e});if(e?.aborted)return;n(t),i(t.content)}catch(t){e?.aborted||o(t instanceof Error?t.message:`Could not load planning notes.`)}finally{e?.aborted||u(!1)}};(0,Q.useEffect)(()=>{let e=new AbortController;return f(e.signal),()=>e.abort()},[d]);let p=async()=>{if(t){u(!0),o(``),c(``);try{let e=await Y(d,{method:`PUT`,body:JSON.stringify({revision:t.revision,content:r})});n(e),c(e.contextRefreshed===!1?`Delivery notes saved, but generated context refresh failed: ${e.contextRefreshError??`run refresh and retry.`}`:e.contextRefreshed===!0?`Delivery notes saved. Generated context refreshed.`:`Delivery notes saved. Refresh will preserve them.`)}catch(e){o(`${e instanceof Error?e.message:`Could not save.`} Your draft is kept.`)}finally{u(!1)}}};return(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Authored delivery order, open questions, existing work, and flag-only decisions. Edit the tables as Markdown; this document survives refresh. Use Edit milestones for gates and progress.`}),a&&(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a}),s&&(0,$.jsx)(`p`,{role:`status`,className:`text-sm`,children:s}),(0,$.jsxs)(`label`,{className:`block text-sm`,children:[`Delivery notes`,(0,$.jsx)(cn,{"aria-label":`Delivery notes`,rows:20,style:{fieldSizing:`fixed`,height:`24rem`,resize:`vertical`},className:`mt-2 font-mono text-xs`,value:r,disabled:l||!t,onChange:e=>i(e.target.value)})]}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(J,{disabled:l||!t||r===t.content,onClick:()=>void p(),children:`Save delivery notes`}),(0,$.jsx)(J,{variant:`outline`,disabled:l,onClick:()=>void f(),children:`Reload delivery notes`})]}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Stored in contextspace-milestones.md. Reload replaces your draft with the saved document.`})]})}var si=()=>({title:``,role:`requirements`,status:`draft`,scope:{},summary:``}),ci=`mt-1 w-full rounded-md border border-border bg-background p-2 text-sm`,li=[`investigate`,`design`,`implement`,`verify`,`review`,`release`];function ui({workspaceId:e,onPlanChanged:t}){let[n,r]=(0,Q.useState)(null),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)([]),[c,l]=(0,Q.useState)(`assignment`),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(si),[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(`text`),[w,T]=(0,Q.useState)(``),[E,D]=(0,Q.useState)(``),[O,k]=(0,Q.useState)(null),A=`/api/workspace/${encodeURIComponent(e)}`,j=(0,Q.useCallback)(async()=>{_(``);try{let e=await Y(`${A}/work`);r(e),a(e.guidance),s(e.lifecycle?.steps??[])}catch(e){_(e instanceof Error?e.message:`Unable to load work brief.`)}},[A]);(0,Q.useEffect)(()=>{j()},[j]);let M=async e=>{p(!0),_(``),h(``);try{await e()}catch(e){_(e instanceof Error?e.message:`The operation failed.`)}finally{p(!1)}},N=(e,t)=>t.contextRefreshed===!1?`${e} Generated context refresh failed: ${t.contextRefreshError??`run refresh and retry.`}`:t.contextRefreshed===!0?`${e} Generated context refreshed.`:e,P=(0,$.jsx)($.Fragment,{children:n?.lifecycle?.steps.map(e=>(0,$.jsx)(`option`,{value:e.id,children:e.title},e.id))}),F=e=>a(t=>t&&{...t,assignment:{...t.assignment,...e}}),ee=()=>M(async()=>{if(!n||!i)return;let e=await Y(`${A}/work`,{method:`PUT`,body:JSON.stringify({revision:n.guidance.revision,workType:i.workType,size:i.size,assignment:i.assignment})});r(e),a(e.guidance),h(N(`AI assignment saved.`,e))}),te=()=>M(async()=>{if(!n)return;let e=await Y(`${A}/work/documents${b?`/${b}`:``}`,{method:b?`PATCH`:`POST`,body:JSON.stringify({...v,revision:n.guidance.revision,...b?{}:S===`link`?{url:E}:{content:w}})});r(e),y(si()),x(null),T(``),D(``),h(N(`Document saved. Its role, status, and scope now appear in AI context.`,e))}),ne=()=>M(async()=>{if(!n?.lifecycle)return;let e=await Y(`${A}/lifecycle/plan`,{method:`PUT`,body:JSON.stringify({revision:n.lifecycle.revision??0,steps:o})});r({...n,lifecycle:e.lifecycle}),s(e.lifecycle.steps),t(),h(N(`Milestones saved. Visual Flow and the Markdown plan use these same steps.`,e))}),L=e=>{let t=o.find(t=>t.id===e);if(!t)return;let r=o.filter(t=>t.id!==e&&t.dependsOn?.includes(e));if(r.length){_(`Cannot remove “${t.title}” because ${r.map(e=>`“${e.title}”`).join(`, `)} depend on it. Remove the dependency first.`),h(`The milestone draft was kept.`);return}let a=n?.guidance.documents.filter(t=>t.scope.milestoneId===e)??[];if(i?.assignment.milestoneId===e||a.length){_(`Move the assignment${a.length?` and source document`:``} scope away from “${t.title}” before removing it.`),h(`The milestone draft was kept.`);return}_(``),s(o.filter(t=>t.id!==e))},R=i&&n&&(i.workType!==n.guidance.workType||i.size!==n.guidance.size||JSON.stringify(i.assignment)!==JSON.stringify(n.guidance.assignment));return(0,$.jsxs)(`section`,{className:`mb-5 rounded-xl border border-border bg-card p-5 space-y-4`,"aria-label":`Work brief and sources`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,$.jsx)(`h3`,{className:`font-semibold`,children:`Work brief & sources`}),(0,$.jsx)(J,{size:`sm`,variant:`outline`,disabled:f,onClick:()=>void j(),children:`Reload brief`})]}),(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Keep source documents here and set the AI’s current assignment. Add milestones only when this feature needs them.`}),g&&(0,$.jsxs)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:[g,` Your draft is kept. Reload to review the latest saved version.`]}),m&&(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:m}),!n||!i?(0,$.jsx)(`p`,{className:`text-sm`,children:g?`Work brief unavailable.`:`Loading work brief…`}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,"aria-label":`Brief sections`,children:[`assignment`,`documents`,`milestones`,`notes`].map(e=>(0,$.jsx)(J,{size:`sm`,variant:c===e?`secondary`:`ghost`,"aria-pressed":c===e,onClick:()=>{l(e),e===`notes`&&d(!0)},children:e===`assignment`?`AI assignment`:e===`documents`?`Source documents`:e===`milestones`?n.lifecycle?.steps.length?`Edit milestones`:`Add milestones`:`Delivery notes & questions`},e))}),u&&(0,$.jsx)(`div`,{hidden:c!==`notes`,children:(0,$.jsx)(oi,{workspaceId:e},e)}),c===`assignment`&&(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,$.jsxs)(`label`,{className:`text-sm`,children:[`Work type`,(0,$.jsx)(`select`,{"aria-label":`Work type`,className:ci,value:i.workType,onChange:e=>a({...i,workType:e.target.value}),children:[`bug`,`feature`,`performance`,`refactor`,`rewrite`].map(e=>(0,$.jsx)(`option`,{value:e,children:e===`bug`?`Bug fix`:e[0].toUpperCase()+e.slice(1)},e))})]}),(0,$.jsxs)(`label`,{className:`text-sm`,children:[`Size`,(0,$.jsxs)(`select`,{"aria-label":`Size`,className:ci,value:i.size,onChange:e=>a({...i,size:e.target.value}),children:[(0,$.jsx)(`option`,{value:`small`,children:`Small task`}),(0,$.jsx)(`option`,{value:`standard`,children:`Standard change`}),(0,$.jsx)(`option`,{value:`epic`,children:`Epic / multiple deliverables`})]})]}),(0,$.jsxs)(`label`,{className:`text-sm`,children:[`Current stage`,(0,$.jsx)(`select`,{"aria-label":`Current stage`,className:ci,value:i.assignment.stage,onChange:e=>F({stage:e.target.value}),children:li.map(e=>(0,$.jsx)(`option`,{value:e,children:e[0].toUpperCase()+e.slice(1)},e))})]})]}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Work type and size describe the task; they do not reset progress. Edit milestones to adapt the plan.`}),!!n.lifecycle?.steps.length&&(0,$.jsxs)(`label`,{className:`block text-sm`,children:[`Assignment scope`,(0,$.jsxs)(`select`,{"aria-label":`Assignment scope`,className:ci,value:i.assignment.milestoneId??``,onChange:e=>F({milestoneId:e.target.value||void 0}),children:[(0,$.jsx)(`option`,{value:``,children:`Whole workspace`}),P]})]}),(0,$.jsxs)(`label`,{className:`block text-sm`,children:[`Current objective`,(0,$.jsx)(cn,{className:`mt-1`,value:i.assignment.objective,onChange:e=>F({objective:e.target.value}),placeholder:`Investigate why invoice totals differ from line items.`})]}),(0,$.jsxs)(`label`,{className:`block text-sm`,children:[`Expected output`,(0,$.jsx)(cn,{className:`mt-1`,value:i.assignment.expectedOutput,onChange:e=>F({expectedOutput:e.target.value}),placeholder:`A reproduction, likely cause, and proposed test plan.`})]}),(0,$.jsxs)(`label`,{className:`block text-sm`,children:[`Stop when`,(0,$.jsx)(cn,{className:`mt-1`,value:i.assignment.stopCondition,onChange:e=>F({stopCondition:e.target.value}),placeholder:`The proposal is ready for review. Stop before implementation.`})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(J,{disabled:f,onClick:()=>void ee(),children:`Save AI assignment`}),(0,$.jsx)(J,{variant:`outline`,disabled:f||!!R,onClick:()=>void M(async()=>{if(!await St(n.assignment))throw Error(`Could not copy the AI assignment. Check browser clipboard permissions.`);h(`AI assignment copied.`)}),children:`Copy AI assignment`})]}),R&&(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Save your changes before copying the assignment.`}),!o.length&&(0,$.jsxs)(`div`,{className:`rounded-lg border border-border bg-muted/20 p-3 space-y-2`,children:[(0,$.jsx)(`h4`,{className:`text-sm font-semibold`,children:`No milestones saved yet`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Turn the current assignment into a first reviewable outcome. The draft stays on this page until you save it; saving creates a pending milestone and does not start work.`}),(0,$.jsx)(J,{size:`sm`,variant:`outline`,disabled:f||!n.lifecycle||!!R,onClick:()=>{if(!n?.lifecycle||o.length||R)return;let e=n.guidance.assignment.objective.replace(/\s+/g,` `).trim();s([{id:`milestone-${crypto.randomUUID()}`,title:e.slice(0,100)||`Define the first reviewable outcome`,description:n.guidance.assignment.expectedOutput.trim(),status:`pending`,dependsOn:[]}]),l(`milestones`),h(`First milestone drafted locally. Review its title and outcome, then save it when ready.`)},children:`Draft first milestone`}),R&&(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Save the AI assignment before drafting from it.`})]})]}),c===`documents`&&(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Attach Markdown/text or link to a document. Approved requirements define intended behavior; drafts remain proposals. Superseded documents stay available as history.`}),n.projectId&&(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Project sources are stored in the workspace where you add them. Keep that workspace while sources are active; supersede or copy them elsewhere before deleting it.`}),(0,$.jsx)(`ul`,{className:`space-y-2`,children:n.guidance.documents.map(e=>(0,$.jsx)(`li`,{className:`rounded-lg border border-border p-3`,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`font-medium text-sm`,children:e.title}),(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.role,` · `,e.status,` · `,e.scope.project?`Entire project`:e.scope.milestoneId?n.lifecycle?.steps.find(t=>t.id===e.scope.milestoneId)?.title??e.scope.milestoneId:`Whole workspace`]})]}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsxs)(J,{variant:`outline`,size:`sm`,disabled:f,onClick:()=>void M(async()=>{let t=await Y(`${A}/work/documents/${e.id}`);k({title:t.document.title,content:t.content,location:t.location})}),children:[`Read `,e.title]}),(0,$.jsxs)(J,{variant:`ghost`,size:`sm`,onClick:()=>{y(e),x(e.id)},children:[`Edit `,e.title]})]})]})},e.id))}),!!n.sharedDocuments?.length&&(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`h4`,{className:`font-semibold text-sm`,children:`Shared project sources`}),n.sharedDocuments.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg border border-border p-3`,children:[(0,$.jsxs)(`p`,{className:`text-sm`,children:[e.title,(0,$.jsxs)(`span`,{className:`block text-xs text-muted-foreground`,children:[e.role,` · `,e.status,` · managed in `,e.workspaceId]})]}),(0,$.jsxs)(J,{variant:`outline`,size:`sm`,disabled:f,onClick:()=>void M(async()=>{let t=await Y(`${A}/work/documents/${e.id}`);k({title:t.document.title,content:t.content,location:t.location})}),children:[`Read `,e.title]})]},e.id))]}),!n.guidance.documents.length&&(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No documents yet. Add only the sources this work needs.`}),O&&(0,$.jsxs)(`div`,{className:`rounded-lg border border-border p-3 space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex justify-between gap-2`,children:[(0,$.jsx)(`h4`,{className:`text-sm font-semibold`,children:O.title}),(0,$.jsx)(J,{size:`sm`,variant:`ghost`,onClick:()=>k(null),children:`Close document`})]}),O.content===void 0?(0,$.jsx)(`a`,{className:`text-sm text-primary underline`,href:O.location,target:`_blank`,rel:`noopener noreferrer`,children:`Open source document`}):(0,$.jsx)(`pre`,{className:`max-h-64 overflow-auto whitespace-pre-wrap break-words text-xs`,children:O.content})]}),(0,$.jsxs)(`div`,{className:`border-t border-border pt-4 space-y-3`,children:[(0,$.jsx)(`h4`,{className:`font-medium text-sm`,children:b?`Edit document labels`:`Add source document`}),(0,$.jsxs)(`label`,{className:`block text-sm`,children:[`Document title`,(0,$.jsx)(I,{value:v.title,onChange:e=>y({...v,title:e.target.value})})]}),(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`text-sm`,children:[`Document role`,(0,$.jsx)(`select`,{"aria-label":`Document role`,className:ci,value:v.role,onChange:e=>y({...v,role:e.target.value}),children:[`requirements`,`design`,`evidence`,`reference`].map(e=>(0,$.jsx)(`option`,{value:e,children:e[0].toUpperCase()+e.slice(1)},e))})]}),(0,$.jsxs)(`label`,{className:`text-sm`,children:[`Document status`,(0,$.jsxs)(`select`,{"aria-label":`Document status`,className:ci,value:v.status,onChange:e=>y({...v,status:e.target.value}),children:[(0,$.jsx)(`option`,{value:`draft`,children:`Draft`}),(0,$.jsx)(`option`,{value:`approved`,children:`Approved`}),(0,$.jsx)(`option`,{value:`superseded`,children:`Superseded`})]})]})]}),(0,$.jsxs)(`label`,{className:`block text-sm`,children:[`Document scope`,(0,$.jsxs)(`select`,{"aria-label":`Document scope`,className:ci,value:v.scope.project?`project`:v.scope.milestoneId?`milestone:${v.scope.milestoneId}`:``,onChange:e=>y({...v,scope:e.target.value===`project`?{project:!0}:{milestoneId:e.target.value.replace(/^milestone:/,``)||void 0}}),children:[(0,$.jsx)(`option`,{value:``,children:`Whole workspace`}),n.projectId&&(0,$.jsx)(`option`,{value:`project`,children:`Entire project (shared)`}),n.lifecycle?.steps.map(e=>(0,$.jsx)(`option`,{value:`milestone:${e.id}`,children:e.title},e.id))]})]}),!b&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`label`,{className:`block text-sm`,children:[`Document source`,(0,$.jsxs)(`select`,{"aria-label":`Document source`,className:ci,value:S,onChange:e=>C(e.target.value),children:[(0,$.jsx)(`option`,{value:`text`,children:`Upload or paste Markdown/text`}),(0,$.jsx)(`option`,{value:`link`,children:`Link to a document`})]})]}),S===`link`?(0,$.jsxs)(`label`,{className:`block text-sm`,children:[`Document URL`,(0,$.jsx)(I,{type:`url`,value:E,onChange:e=>D(e.target.value),placeholder:`https://…`})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`label`,{className:`block text-sm`,children:[`Upload text document`,(0,$.jsx)(`input`,{type:`file`,className:`mt-1 block w-full text-sm`,accept:`.md,.markdown,.txt,text/plain,text/markdown`,onChange:e=>{let t=e.target.files?.[0];t&&M(async()=>{if(t.size>5e5||!/\.(md|markdown|txt)$/i.test(t.name))throw Error(`Choose a Markdown or text file up to 500 KB. Link to other document formats.`);T(await t.text()),y(e=>({...e,title:e.title||t.name}))})}})]}),(0,$.jsxs)(`label`,{className:`block text-sm`,children:[`Source text`,(0,$.jsx)(cn,{value:w,onChange:e=>T(e.target.value),rows:5})]})]})]}),(0,$.jsxs)(`label`,{className:`block text-sm`,children:[`Owner summary (optional)`,(0,$.jsx)(cn,{value:v.summary,onChange:e=>y({...v,summary:e.target.value}),placeholder:`Highlight what matters for this task. The original remains available.`})]}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(J,{disabled:f||!v.title.trim()||!b&&!(S===`link`?E.trim():w.trim()),onClick:()=>void te(),children:b?`Save document labels`:`Add document`}),b&&(0,$.jsx)(J,{variant:`ghost`,onClick:()=>{x(null),y(si())},children:`Cancel document edit`})]})]})]}),c===`milestones`&&(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Milestones are optional and unique to this feature. Name the outcomes you need, or remove all milestones to hide the flow.`}),!n.lifecycle?.steps.length&&o.length>0&&(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This milestone is an unsaved draft. Review its title and outcome; Save milestones creates it as pending and does not start work.`}),o.map((e,t)=>(0,$.jsxs)(`fieldset`,{className:`rounded-lg border border-border p-3 space-y-3`,children:[(0,$.jsxs)(`legend`,{className:`px-1 text-xs text-muted-foreground`,children:[`Milestone `,t+1,` · `,e.status.replaceAll(`_`,` `)]}),(0,$.jsxs)(J,{size:`sm`,variant:`ghost`,disabled:f,onClick:()=>L(e.id),children:[`Remove milestone `,t+1]}),(0,$.jsxs)(`label`,{className:`block text-sm`,children:[`Milestone `,t+1,` title`,(0,$.jsx)(I,{value:e.title,onChange:t=>s(o.map(n=>n.id===e.id?{...n,title:t.target.value}:n))})]}),(0,$.jsxs)(`label`,{className:`block text-sm`,children:[`Milestone `,t+1,` outcome`,(0,$.jsx)(cn,{value:e.description??``,onChange:t=>s(o.map(n=>n.id===e.id?{...n,description:t.target.value}:n))})]}),(0,$.jsxs)(`label`,{className:`block text-sm`,children:[`Milestone `,t+1,` branch (optional)`,(0,$.jsx)(I,{value:e.branch??``,placeholder:`feature/invoice-calculation`,onChange:t=>s(o.map(n=>n.id===e.id?{...n,branch:t.target.value}:n))})]}),(0,$.jsxs)(`label`,{className:`block text-sm`,children:[`Milestone `,t+1,` repository (optional)`,(0,$.jsx)(I,{value:e.repo??``,placeholder:`billing-api`,onChange:t=>s(o.map(n=>n.id===e.id?{...n,repo:t.target.value}:n))})]}),(0,$.jsxs)(`label`,{className:`block text-sm`,children:[`Milestone `,t+1,` work item / PR (optional)`,(0,$.jsx)(I,{value:e.workItem??``,placeholder:`PBI ID or URL`,onChange:t=>s(o.map(n=>n.id===e.id?{...n,workItem:t.target.value}:n))})]}),(0,$.jsxs)(`label`,{className:`block text-sm`,children:[`Milestone `,t+1,` unblock condition (optional)`,(0,$.jsx)(I,{value:e.unblockCondition??``,placeholder:`Dependency or decision needed before starting`,onChange:t=>s(o.map(n=>n.id===e.id?{...n,unblockCondition:t.target.value}:n))})]}),(0,$.jsxs)(`fieldset`,{className:`space-y-2`,children:[(0,$.jsxs)(`legend`,{className:`mb-2 text-sm`,children:[`Milestone `,t+1,` dependencies`]}),o.filter(t=>t.id!==e.id).map(t=>(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:!!e.dependsOn?.includes(t.id),onChange:n=>s(o.map(r=>r.id===e.id?{...r,dependsOn:n.target.checked?[...r.dependsOn??[],t.id]:(r.dependsOn??[]).filter(e=>e!==t.id)}:r))}),t.title||`Untitled milestone`]},t.id))]}),(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:!!(e.requiresVerification||e.verificationCommand),disabled:e.status===`completed`,onChange:t=>s(o.map(n=>n.id===e.id?{...n,requiresVerification:t.target.checked,...t.target.checked?{}:{verificationCommand:``}}:n))}),`Verify before completing milestone `,t+1]}),(e.requiresVerification||e.verificationCommand)&&(0,$.jsxs)(`label`,{className:`block text-sm`,children:[`Milestone `,t+1,` verification command (optional)`,(0,$.jsx)(I,{value:e.verificationCommand??``,disabled:e.status===`completed`,placeholder:`Uses the workspace test command unless overridden`,onChange:t=>s(o.map(n=>n.id===e.id?{...n,verificationCommand:t.target.value}:n))})]})]},e.id)),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(J,{variant:`outline`,disabled:f||o.length>=100,onClick:()=>s([...o,{id:`milestone-${crypto.randomUUID()}`,title:``,status:`pending`,dependsOn:[]}]),children:`Add milestone`}),(0,$.jsx)(J,{disabled:f||o.some(e=>!e.title.trim()),onClick:()=>void ne(),children:`Save milestones`})]})]})]})]})}var di={"git-pull-request":Ge,"flask-conical":We,package:Je,database:Ye,"shield-check":it,terminal:Tt,zap:zn,cpu:kn,layers:Xt,boxes:wn};function fi({ws:e,showToast:t}){let{data:n=[]}=ye(e.branchName),[r,i]=(0,Q.useState)(``),[a,o]=(0,Q.useState)({}),[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(`workspace`),[x,S]=(0,Q.useState)(!1),{data:C=[],isLoading:w}=oe(),{data:T=[],isLoading:E}=fe(e.branchName),{data:D=[],isLoading:O}=we(),{data:k,isLoading:A,isError:j}=Oe(e.branchName),M=Ce(),N=De(),P=W(),F=(0,Q.useMemo)(()=>new Set(s??k?.enabledSkills??[]),[s,k?.enabledSkills]),ee=(0,Q.useMemo)(()=>new Set(l??k?.enabledAgents??[]),[l,k?.enabledAgents]);(0,Q.useEffect)(()=>{k&&(c([...k.enabledSkills??[]]),u([...k.enabledAgents??[]]))},[k]);let te=(0,Q.useMemo)(()=>{if(!k||s===null||l===null)return!1;let e=new Set(k.enabledSkills??[]),t=new Set(k.enabledAgents??[]);return!!(s.length!==e.size||s.some(t=>!e.has(t))||l.length!==t.size||l.some(e=>!t.has(e)))},[k,s,l]),ne=e=>{o(t=>({...t,[e]:!t[e]}))},L=e=>{if(s===null)return;let t=new Set(s);t.has(e)?t.delete(e):t.add(e),c(Array.from(t))},R=e=>{if(l===null)return;let t=new Set(l);t.has(e)?t.delete(e):t.add(e),u(Array.from(t))},re=(e,t,n)=>{if(s===null)return;let r=new Set(s);for(let e of n)t?r.add(e.id):r.delete(e.id);c(Array.from(r))},z=async()=>{if(!(!k||s===null||l===null)){f(!0);try{await M.mutateAsync({workspaceId:e.branchName,expectedRevision:k.revision??0,enabledSkills:s,enabledAgents:l,enabledCategories:C.map(e=>e.id)}),await N.mutateAsync({workspaceId:e.branchName}),t?.(`Skills & agents deployed successfully to workspace context!`,`success`)}catch(e){t?.(e instanceof Error?e.message:`Failed to deploy skills`,`error`)}finally{f(!1)}}},ie=(0,Q.useMemo)(()=>{if(!r.trim())return T;let e=r.toLowerCase();return T.filter(t=>t.title?.toLowerCase().includes(e)||t.name.toLowerCase().includes(e)||t.description.toLowerCase().includes(e)||t.tags?.some(t=>t.toLowerCase().includes(e)))},[T,r]),V=(0,Q.useMemo)(()=>{if(!r.trim())return D;let e=r.toLowerCase();return D.filter(t=>t.name.toLowerCase().includes(e)||t.description.toLowerCase().includes(e)||t.category.toLowerCase().includes(e))},[D,r]),{displayCategories:H,uncategorizedSkills:U}=(0,Q.useMemo)(()=>{let e=new Set(C.map(e=>e.id)),t=C.filter(e=>e.id!==`general`),n=new Map;for(let t of ie)if(t.category&&t.category!==`general`&&!e.has(t.category)&&!n.has(t.category)){let e=t.category.split(/[-_]/).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `);n.set(t.category,{id:t.category,name:e,description:`Skills categorized under ${e}`,color:`#3b82f6`,icon:`boxes`})}t.push(...Array.from(n.values()));let r=new Set(t.map(e=>e.id));return{displayCategories:t,uncategorizedSkills:ie.filter(e=>!e.category||!r.has(e.category))}},[C,ie]),se=(0,Q.useMemo)(()=>{let e={};for(let t of H)e[t.id]=ie.filter(e=>e.category===t.id);return e},[H,ie]),ce=(e,t)=>{t.stopPropagation(),m(e)},ue=(e,t)=>{t.stopPropagation(),v({...e}),b(e.scope===`workspace`?`workspace`:`global`),S(!0),g(!0)},de=()=>{v({name:``,title:``,category:H[0]?.id||`general`,description:``,tags:[],content:`# Skill Title
|
|
4
|
-
|
|
5
|
-
Procedural playbook instructions for AI assistants...`,allowedTools:[]}),b(`workspace`),S(!1),g(!0)},pe=e=>{let t={..._||{},title:e};!_?.id&&!x&&(t.name=e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)),v(t)},me=async()=>{if(!_||!_.name?.trim()||!_.description?.trim()||!_.content?.trim()){t?.(`Skill name, trigger description, and playbook markdown are required`,`error`);return}try{await P.mutateAsync({id:_.id,name:_.name.trim(),title:_.title||_.name,category:_.category||`general`,description:_.description||``,tags:_.tags||[],allowedTools:_.allowedTools||[],content:_.content,scope:y,workspaceId:y===`workspace`?e.branchName:void 0}),s!==null&&!s.includes(_.name.trim())&&c([...s,_.name.trim()]),t?.(y===`workspace`?`Workspace skill '${_.name}' saved to .agents/skills/`:`Global skill '${_.name}' saved to catalog`,`success`),g(!1),v(null)}catch(e){t?.(e instanceof Error?e.message:`Failed to save skill`,`error`)}};if(w||E||O||A)return(0,$.jsxs)(`div`,{className:`flex items-center justify-center p-12 gap-3 text-muted-foreground`,children:[(0,$.jsx)(Z,{}),(0,$.jsx)(`span`,{className:`text-sm`,children:`Loading workspace skills...`})]});if(j)return(0,$.jsx)(An,{className:`py-12 border border-dashed rounded-xl`,children:(0,$.jsxs)(an,{children:[(0,$.jsx)(Mn,{children:`Could not load workspace skills config`}),(0,$.jsx)(hn,{children:`Unable to read .contextspace/skills.json for this workspace.`})]})});let he=e=>{let t=F.has(e.id);return(0,$.jsx)(`div`,{role:`button`,tabIndex:0,onClick:()=>L(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),L(e.id))},className:K(`p-3 rounded-lg border text-left cursor-pointer transition-all flex flex-col justify-between select-none shadow-2xs group`,t?`border-primary/60 bg-primary/5 text-foreground`:`border-border bg-card/70 text-muted-foreground hover:border-foreground/20 hover:text-foreground`),children:(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2 mb-1.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,$.jsx)(`span`,{className:K(`grid size-4 shrink-0 place-items-center rounded border transition-colors`,t?`border-primary bg-primary text-primary-foreground`:`border-muted-foreground/40 bg-transparent`),children:t&&(0,$.jsx)(Pn,{className:`size-3 stroke-[3]`})}),(0,$.jsx)(`span`,{className:`font-mono text-xs font-semibold truncate`,children:e.title||e.name})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,onClick:e=>e.stopPropagation(),children:[(0,$.jsx)(B,{variant:e.scope===`workspace`?`default`:`outline`,className:`text-[9px] px-1 py-0 font-mono`,title:e.scope===`workspace`?`Local to this workspace (.agents/skills/)`:`From global catalog (~/.contextspace/skills/)`,children:e.scope===`workspace`?`Workspace`:`Global`}),(0,$.jsx)(J,{variant:`ghost`,size:`xs`,onClick:t=>ce(e,t),title:`Inspect Playbook Instructions`,className:`h-6 w-6 p-0 text-muted-foreground hover:text-foreground cursor-pointer`,children:(0,$.jsx)(qe,{className:`size-3.5`})}),(0,$.jsx)(J,{variant:`ghost`,size:`xs`,onClick:t=>ue(e,t),title:`Edit Skill Playbook`,className:`h-6 w-6 p-0 text-muted-foreground hover:text-foreground cursor-pointer`,children:(0,$.jsx)(Ke,{className:`size-3`})})]})]}),(0,$.jsx)(`p`,{className:`text-[11px] text-muted-foreground line-clamp-2 leading-relaxed pl-6`,children:e.description||`No description provided.`}),e.tags&&e.tags.length>0&&(0,$.jsx)(`div`,{className:`mt-2 pl-6 flex items-center gap-1 flex-wrap`,children:e.tags.slice(0,4).map(e=>(0,$.jsxs)(`span`,{className:`text-[9px] font-mono text-muted-foreground bg-muted/60 px-1 py-0.2 rounded`,children:[`#`,e]},e))})]})},e.id)};return(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[n.length>0&&(0,$.jsxs)(`div`,{role:`status`,className:`rounded-lg border border-amber-500/40 p-4 text-sm`,children:[(0,$.jsx)(`h4`,{className:`font-semibold`,children:`Skill discovery notices`}),(0,$.jsx)(`ul`,{className:`mt-2 space-y-2`,children:n.map((e,t)=>(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`strong`,{children:e.id}),` (`,e.scope,`): `,e.message]},`${e.id}-${t}`))})]}),(0,$.jsxs)(Un,{className:`p-5 rounded-xl border border-border/80 bg-card/70 backdrop-blur-md shadow-xs flex flex-col sm:flex-row sm:items-center justify-between gap-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`div`,{className:`p-2 rounded-lg bg-primary/10 text-primary`,children:(0,$.jsx)(wn,{className:`h-5 w-5`})}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-bold text-foreground`,children:`Workspace Skills & Agents`}),(0,$.jsxs)(B,{variant:`secondary`,className:`text-[10px] font-mono`,children:[F.size,` Skills Active`]}),ee.size>0&&(0,$.jsxs)(B,{variant:`secondary`,className:`text-[10px] font-mono`,children:[ee.size,` Agents Active`]})]}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:`Select skills to deploy to this workspace. Authored .agents/skills files remain discoverable by assistants even when deselected.`})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap sm:flex-nowrap`,children:[(0,$.jsxs)(J,{size:`sm`,variant:`outline`,onClick:de,className:`flex items-center gap-1.5 shadow-xs text-xs`,children:[(0,$.jsx)(Ut,{className:`size-3.5`}),(0,$.jsx)(`span`,{children:`New Skill`})]}),(0,$.jsxs)(J,{size:`sm`,onClick:z,disabled:d||!te&&F.size===0&&ee.size===0,className:`flex items-center gap-1.5 shadow-sm text-xs`,children:[d?(0,$.jsx)(Z,{className:`size-3.5`}):(0,$.jsx)(yn,{className:`size-3.5`}),(0,$.jsx)(`span`,{children:d?`Deploying…`:te?`Save & Deploy Changes`:`Re-Deploy to Workspace`})]}),(0,$.jsxs)(J,{render:(0,$.jsx)(le,{to:`/skills`}),variant:`ghost`,size:`sm`,className:`flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground`,title:`Open Global Enterprise Catalog`,children:[(0,$.jsx)(Qe,{className:`size-3.5`}),(0,$.jsx)(`span`,{children:`Global Library`})]})]})]}),(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(ae,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground`}),(0,$.jsx)(I,{value:r,onChange:e=>i(e.target.value),placeholder:`Filter skills & agents by keyword or tag...`,className:`pl-9 pr-8 h-8 text-xs bg-card`}),r&&(0,$.jsx)(`button`,{onClick:()=>i(``),className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,children:(0,$.jsx)(qt,{className:`h-3.5 w-3.5`})})]}),(0,$.jsxs)(`div`,{className:`space-y-3`,children:[H.map(e=>{let t=di[e.icon||`boxes`]||wn,n=se[e.id]||[];if(n.length===0)return null;let r=!!a[e.id],i=n.length>0&&n.every(e=>F.has(e.id));return(0,$.jsxs)(`div`,{className:`border border-border rounded-xl overflow-hidden bg-card/60 transition-colors`,children:[(0,$.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":!r,onClick:()=>ne(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),ne(e.id))},className:`p-3 flex items-center justify-between cursor-pointer hover:bg-muted/40 transition-colors select-none`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,$.jsx)(`div`,{className:`p-1.5 rounded-md text-white shadow-xs flex items-center justify-center`,style:{backgroundColor:e.color||`#3b82f6`},children:(0,$.jsx)(t,{className:`h-3.5 w-3.5`})}),(0,$.jsx)(`div`,{children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`h4`,{className:`font-semibold text-xs text-foreground`,children:e.name}),(0,$.jsxs)(B,{variant:`outline`,className:`text-[9px] px-1 py-0 font-mono`,children:[n.filter(e=>F.has(e.id)).length,`/`,n.length,` active`]})]})})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,onClick:e=>e.stopPropagation(),children:[n.length>0&&(0,$.jsxs)(J,{variant:`ghost`,size:`xs`,onClick:()=>re(e.id,!i,n),className:`h-6 text-[11px] px-2 text-muted-foreground hover:text-foreground`,children:[i?(0,$.jsx)(Xe,{className:`h-3 w-3 mr-1 text-primary`}):(0,$.jsx)(Vt,{className:`h-3 w-3 mr-1`}),(0,$.jsx)(`span`,{children:i?`Deselect All`:`Select All`})]}),(0,$.jsx)(`div`,{className:`p-0.5 text-muted-foreground`,children:r?(0,$.jsx)(dn,{className:`h-4 w-4`}):(0,$.jsx)(Me,{className:`h-4 w-4`})})]})]}),!r&&(0,$.jsx)(`div`,{className:`p-3 border-t border-border/40 bg-background/50`,children:(0,$.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-2.5`,children:n.map(e=>he(e))})})]},e.id)}),U.length>0&&(0,$.jsxs)(`div`,{className:`border border-border rounded-xl overflow-hidden bg-card/60 transition-colors`,children:[(0,$.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":!a.__uncategorized,onClick:()=>ne(`__uncategorized`),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),ne(`__uncategorized`))},className:`p-3 flex items-center justify-between cursor-pointer hover:bg-muted/40 transition-colors select-none`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,$.jsx)(`div`,{className:`p-1.5 rounded-md bg-muted text-muted-foreground shadow-xs flex items-center justify-center`,children:(0,$.jsx)(wn,{className:`h-3.5 w-3.5`})}),(0,$.jsx)(`div`,{children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`h4`,{className:`font-semibold text-xs text-foreground`,children:`Uncategorized Skills`}),(0,$.jsxs)(B,{variant:`outline`,className:`text-[9px] px-1 py-0 font-mono`,children:[U.filter(e=>F.has(e.id)).length,`/`,U.length,` active`]})]})})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,onClick:e=>e.stopPropagation(),children:[(0,$.jsxs)(J,{variant:`ghost`,size:`xs`,onClick:()=>re(`__uncategorized`,!U.every(e=>F.has(e.id)),U),className:`h-6 text-[11px] px-2 text-muted-foreground hover:text-foreground`,children:[U.every(e=>F.has(e.id))?(0,$.jsx)(Xe,{className:`h-3 w-3 mr-1 text-primary`}):(0,$.jsx)(Vt,{className:`h-3 w-3 mr-1`}),(0,$.jsx)(`span`,{children:U.every(e=>F.has(e.id))?`Deselect All`:`Select All`})]}),(0,$.jsx)(`div`,{className:`p-0.5 text-muted-foreground`,children:a.__uncategorized?(0,$.jsx)(dn,{className:`h-4 w-4`}):(0,$.jsx)(Me,{className:`h-4 w-4`})})]})]}),!a.__uncategorized&&(0,$.jsx)(`div`,{className:`p-3 border-t border-border/40 bg-background/50`,children:(0,$.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-2.5`,children:U.map(e=>he(e))})})]}),V.length>0&&(0,$.jsxs)(`div`,{className:`border border-border rounded-xl overflow-hidden bg-card/60 transition-colors`,children:[(0,$.jsx)(`div`,{className:`p-3 flex items-center justify-between border-b border-border/40 select-none`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,$.jsx)(`div`,{className:`p-1.5 rounded-md bg-purple-600 text-white shadow-xs flex items-center justify-center`,children:(0,$.jsx)(jn,{className:`h-3.5 w-3.5`})}),(0,$.jsx)(`div`,{children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`h4`,{className:`font-semibold text-xs text-foreground`,children:`Codex Native Agents`}),(0,$.jsxs)(B,{variant:`outline`,className:`text-[9px] px-1 py-0`,children:[V.filter(e=>ee.has(e.id)).length,`/`,V.length,` active`]})]})})]})}),(0,$.jsx)(`div`,{className:`p-3 bg-background/50`,children:(0,$.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-2.5`,children:V.map(e=>{let t=ee.has(e.id);return(0,$.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:()=>R(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),R(e.id))},className:K(`p-3 rounded-lg border text-left cursor-pointer transition-all flex flex-col justify-between select-none shadow-2xs`,t?`border-purple-500/60 bg-purple-500/5 text-foreground`:`border-border bg-card/70 text-muted-foreground hover:border-foreground/20 hover:text-foreground`),children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2 mb-1.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,$.jsx)(`span`,{className:K(`grid size-4 shrink-0 place-items-center rounded border transition-colors`,t?`border-purple-600 bg-purple-600 text-white`:`border-muted-foreground/40 bg-transparent`),children:t&&(0,$.jsx)(Pn,{className:`size-3 stroke-[3]`})}),(0,$.jsx)(`span`,{className:`font-mono text-xs font-semibold truncate`,children:e.name})]}),(0,$.jsx)(B,{variant:`secondary`,className:`text-[9px] px-1 py-0 shrink-0`,children:`.codex/agents`})]}),(0,$.jsx)(`p`,{className:`text-[11px] text-muted-foreground line-clamp-2 leading-relaxed pl-6`,children:e.description||`No description provided.`})]},e.id)})})})]}),H.every(e=>(se[e.id]||[]).length===0)&&U.length===0&&V.length===0&&(0,$.jsx)(An,{className:`py-12 border border-dashed rounded-xl`,children:(0,$.jsxs)(an,{children:[(0,$.jsx)(Mn,{children:`No skills found`}),(0,$.jsx)(hn,{children:r?`No skills match the filter "${r}".`:`No skills configured in this workspace yet. Click "+ New Skill" to create a playbook or attach one from the catalog.`})]})})]}),(0,$.jsxs)(`p`,{className:`text-[11px] text-muted-foreground`,children:[`Saving & deploying will write to `,(0,$.jsxs)(`code`,{className:`font-mono text-xs text-foreground`,children:[ht,`/skills.json`]}),` and materialize files into `,(0,$.jsx)(`code`,{className:`font-mono text-xs text-foreground`,children:`.agents/skills/`}),`, `,(0,$.jsx)(`code`,{className:`font-mono text-xs text-foreground`,children:`.claude/skills/`}),`, and `,(0,$.jsx)(`code`,{className:`font-mono text-xs text-foreground`,children:`.codex/agents/`}),`.`]}),(0,$.jsx)(vt,{open:!!p,onOpenChange:e=>!e&&m(null),children:(0,$.jsxs)(Et,{className:`max-w-2xl max-h-[85vh] flex flex-col p-6`,children:[(0,$.jsxs)(Rt,{className:`pb-3 border-b border-border/70 shrink-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between pr-6`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(gn,{className:`h-4 w-4 text-primary`}),(0,$.jsx)(jt,{className:`text-base font-bold`,children:p?.title||p?.name})]}),(0,$.jsx)(B,{variant:`outline`,className:`font-mono text-[10px]`,children:p?.scope===`workspace`?`Workspace (.agents/skills/)`:`Global Catalog`})]}),(0,$.jsx)(vn,{className:`text-xs text-muted-foreground mt-1`,children:p?.description||`No description provided.`})]}),(0,$.jsxs)(`div`,{className:`flex-1 overflow-y-auto py-4 space-y-4`,children:[p?.tags&&p.tags.length>0&&(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 items-center`,children:[(0,$.jsx)(`span`,{className:`text-[11px] font-semibold text-muted-foreground mr-1`,children:`Tags:`}),p.tags.map(e=>(0,$.jsxs)(B,{variant:`secondary`,className:`text-[10px] font-mono`,children:[`#`,e]},e))]}),p?.allowedTools&&p.allowedTools.length>0&&(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 items-center`,children:[(0,$.jsx)(`span`,{className:`text-[11px] font-semibold text-muted-foreground mr-1`,children:`Allowed Tools:`}),p.allowedTools.map(e=>(0,$.jsx)(`code`,{className:`text-[10px] font-mono bg-muted/60 px-1.5 py-0.5 rounded text-foreground`,children:e},e))]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between text-xs font-semibold text-foreground`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(en,{className:`h-3.5 w-3.5 text-primary`}),(0,$.jsx)(`span`,{children:`SKILL.md Playbook Instructions`})]}),(0,$.jsxs)(`span`,{className:`text-[10px] font-mono text-muted-foreground`,children:[(p?.content||``).split(`
|
|
6
|
-
`).length,` lines`]})]}),(0,$.jsx)(`div`,{className:`p-4 rounded-lg border border-border bg-card/60 overflow-x-auto`,children:(0,$.jsx)(`pre`,{className:`text-xs whitespace-pre-wrap font-sans leading-relaxed text-foreground/90`,children:p?.content||`*(Empty playbook)*`})})]})]}),(0,$.jsxs)(It,{className:`border-t border-border/70 pt-3 flex items-center justify-between sm:justify-between w-full`,children:[(0,$.jsx)(J,{variant:`outline`,size:`sm`,onClick:()=>{p&&L(p.id)},className:`text-xs`,children:p&&F.has(p.id)?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(qt,{className:`size-3.5 mr-1 text-destructive`}),`Deactivate for Workspace`]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Pn,{className:`size-3.5 mr-1 text-primary`}),`Activate for Workspace`]})}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(J,{variant:`outline`,size:`sm`,onClick:e=>{if(p){let t=p;m(null),ue(t,e)}},className:`text-xs gap-1.5`,children:[(0,$.jsx)(Ke,{className:`size-3`}),(0,$.jsx)(`span`,{children:`Edit Playbook`})]}),(0,$.jsx)(J,{size:`sm`,onClick:()=>m(null),children:`Close`})]})]})]})}),(0,$.jsx)(vt,{open:h,onOpenChange:g,children:(0,$.jsxs)(Et,{className:`max-w-3xl max-h-[90vh] flex flex-col p-6`,children:[(0,$.jsxs)(Rt,{className:`pb-3 border-b border-border/70 shrink-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between pr-6`,children:[(0,$.jsxs)(jt,{className:`text-base font-bold flex items-center gap-2`,children:[(0,$.jsx)(yn,{className:`h-4 w-4 text-primary`}),(0,$.jsx)(`span`,{children:_?.id?`Edit Skill Playbook`:`Create New Skill`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Scope:`}),(0,$.jsx)(`span`,{className:`font-mono text-xs px-2 py-0.5 rounded bg-primary/10 text-primary border border-primary/20`,children:y===`workspace`?`Workspace (${e.branchName})`:`Global Catalog`})]})]}),(0,$.jsx)(vn,{className:`text-xs text-muted-foreground mt-0.5`,children:`Configure SKILL.md metadata triggers and markdown instructions.`})]}),(0,$.jsxs)(`div`,{className:`flex-1 overflow-y-auto py-3 space-y-4`,children:[(0,$.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Wn,{htmlFor:`ws-skill-title`,className:`text-xs font-medium`,children:`Display Title`}),(0,$.jsx)(I,{id:`ws-skill-title`,value:_?.title||``,onChange:e=>pe(e.target.value),placeholder:`e.g. NexusFlow Dev Playbook`,className:`mt-1 text-xs`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Wn,{htmlFor:`ws-skill-name`,className:`text-xs font-medium`,children:`Identifier (Slug)`}),(0,$.jsx)(I,{id:`ws-skill-name`,value:_?.name||``,disabled:!!_?.id,onChange:e=>{S(!0),v(t=>t?{...t,name:e.target.value}:null)},placeholder:`e.g. nexusflow-dev`,className:`mt-1 text-xs font-mono`})]})]}),(0,$.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Wn,{htmlFor:`ws-skill-category`,className:`text-xs font-medium`,children:`Category`}),(0,$.jsx)(I,{id:`ws-skill-category`,value:_?.category||``,onChange:e=>v(t=>t?{...t,category:e.target.value}:null),placeholder:`e.g. dev-standards or workflows`,className:`mt-1 text-xs`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Wn,{htmlFor:`ws-skill-tags`,className:`text-xs font-medium`,children:`Tags (comma separated)`}),(0,$.jsx)(I,{id:`ws-skill-tags`,value:_?.tags?.join(`, `)||``,onChange:e=>v(t=>t?{...t,tags:e.target.value.split(`,`).map(e=>e.trim()).filter(Boolean)}:null),placeholder:`e.g. nexusflow, testing, cli`,className:`mt-1 text-xs font-mono`})]})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Wn,{htmlFor:`ws-skill-desc`,className:`text-xs font-medium`,children:`Trigger Description (When should the assistant use this skill?)`}),(0,$.jsx)(cn,{id:`ws-skill-desc`,rows:2,value:_?.description||``,onChange:e=>v(t=>t?{...t,description:e.target.value}:null),placeholder:`e.g. Use when developing, debugging, refactoring, or maintaining NexusFlow code...`,className:`mt-1 text-xs leading-relaxed resize-none`})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsxs)(Wn,{htmlFor:`ws-skill-content`,className:`text-xs font-semibold flex items-center gap-1.5`,children:[(0,$.jsx)(en,{className:`h-3.5 w-3.5 text-primary`}),(0,$.jsx)(`span`,{children:`Playbook Instructions (Markdown)`})]}),(0,$.jsxs)(`span`,{className:`text-[10px] text-muted-foreground font-mono`,children:[(_?.content||``).split(`
|
|
7
|
-
`).length,` lines`]})]}),(0,$.jsxs)(`p`,{className:`text-[11px] text-muted-foreground`,children:[`Frontmatter (`,(0,$.jsx)(`code`,{className:`font-mono text-[10px] bg-muted/60 px-1 py-0.2 rounded text-foreground`,children:`name`}),`, `,(0,$.jsx)(`code`,{className:`font-mono text-[10px] bg-muted/60 px-1 py-0.2 rounded text-foreground`,children:`description`}),`, `,(0,$.jsx)(`code`,{className:`font-mono text-[10px] bg-muted/60 px-1 py-0.2 rounded text-foreground`,children:`tags`}),`) is auto-injected into `,(0,$.jsx)(`code`,{className:`font-mono text-[10px] bg-muted/60 px-1 py-0.2 rounded text-foreground`,children:`SKILL.md`}),` on save.`]}),(0,$.jsx)(cn,{id:`ws-skill-content`,rows:12,value:_?.content||``,onChange:e=>v(t=>t?{...t,content:e.target.value}:null),placeholder:`# Playbook Title
|
|
8
|
-
|
|
9
|
-
Detailed instructions for the AI assistant...`,className:`font-mono text-xs leading-relaxed resize-none focus:ring-1 focus:ring-primary`})]})]}),(0,$.jsxs)(It,{className:`pt-3 border-t flex items-center justify-between sm:justify-between w-full`,children:[(0,$.jsx)(J,{variant:`outline`,size:`sm`,onClick:()=>g(!1),children:`Cancel`}),(0,$.jsxs)(J,{size:`sm`,onClick:me,className:`gap-1.5`,children:[(0,$.jsx)(yn,{className:`size-3.5`}),(0,$.jsx)(`span`,{children:`Save Skill`})]})]})]})})]})}var pi=(e,t)=>{let n=`${e} ${t}`.toLowerCase();return n.includes(`insiders`)?(0,$.jsx)(at,{size:15,className:`text-[#24C05A] shrink-0`}):n.includes(`code`)||n.includes(`vscode`)?(0,$.jsx)(st,{size:15,className:`text-[#007ACC] shrink-0`}):n.includes(`antigravity`)?(0,$.jsx)($e,{className:`size-3.5 shrink-0`}):n.includes(`cursor`)?(0,$.jsx)(yn,{size:14,className:`text-purple-400 shrink-0`}):n.includes(`powershell`)||n.includes(`pwsh`)?(0,$.jsx)(Tt,{size:14,className:`text-sky-400 shrink-0`}):n.includes(`cmd`)||n.includes(`command prompt`)?(0,$.jsx)(Tt,{size:14,className:`text-amber-400 shrink-0`}):(0,$.jsx)(en,{size:14,className:`shrink-0`})},mi=[{value:`overview`,label:`Command Center`,ariaLabel:`Overview`,icon:nr},{value:`plan`,label:`Plan`,ariaLabel:`Plan`,icon:qn},{value:`documents`,label:`Documents`,ariaLabel:`Documents`,icon:kt},{value:`changes`,label:`Git Diff`,ariaLabel:`Changes`,icon:tr},{value:`services`,label:`Services`,ariaLabel:`Services`,icon:zn},{value:`sessions`,label:`AI & Chat`,ariaLabel:`AI & Sessions`,icon:Gt},{value:`knowledge`,label:`Knowledge`,ariaLabel:`Knowledge`,icon:Gn},{value:`skills`,label:`Skills`,ariaLabel:`Skills`,icon:ar}];function hi(e){let{workspaces:t,workspaceStatuses:n,selectedId:r,subTab:i,onSelectTab:a,handleCopyPrompt:o,handleDeleteWorkspace:s,deleteWsLoading:c,repos:l,addRepoLoading:u,handleAddRepo:d,showToast:f,sessionProps:p,changesProps:m,knowledgeProps:h,planProps:g}=e,[_,v]=(0,Q.useState)(0),y=t.find(e=>e.branchName===r)??null,b=y?.mode??`worktree`,{open:x}=me(),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(!1),E=Nt(),{data:D}=de(y?.branchName??null);(0,Q.useEffect)(()=>{if(!y)return;let e=n[y.branchName],t=Ot(y,D?.lifecycle??null,e,g?.planContent,D?.report??null);Qt.setWorkspaceData({workspaceId:y.branchName,workspaceTitle:t.workspaceTitle,workspaceIntent:t.workspaceIntent,iterations:t.iterations,worktrees:t.worktrees,gateStatus:t.gateStatus})},[y,n,D,g?.planContent]),(0,Q.useEffect)(()=>{if(!y?.branchName){C(!1);return}let e=!0;return fetch(`/api/workspace/${encodeURIComponent(y.branchName)}/migration-status`).then(e=>e.ok?e.json():{isLegacy:!1}).then(t=>{e&&C(!!t?.isLegacy)}).catch(()=>{e&&C(!1)}),()=>{e=!1}},[y?.branchName]);let O=async()=>{if(!(!y?.branchName||w)){T(!0);try{if(!(await fetch(`/api/workspace/${encodeURIComponent(y.branchName)}/migrate`,{method:`POST`})).ok)throw Error(`Migration failed`);f?.(`Workspace successfully upgraded to native ${gt}!`,`success`),C(!1),e.fetchWorkspaces?.()}catch(e){f?.(e.message||`Failed to migrate workspace`,`error`)}finally{T(!1)}}},k=Oe(y?.branchName??null).data,{data:A=[]}=fe(y?.branchName),j=A.filter(e=>k?.enabledSkills?.includes(e.id)),[M,N]=(0,Q.useState)(null),{data:P=[]}=xe(),F=ge(),ee=se(),te=Te(),[ne,L]=(0,Q.useState)(!1),[R,re]=(0,Q.useState)(``),[z,B]=(0,Q.useState)(!1),[ie,V]=(0,Q.useState)(!1),[H,U]=(0,Q.useState)(``),[ae,oe]=(0,Q.useState)(``),[W,le]=(0,Q.useState)(``),[ue,pe]=(0,Q.useState)(`vertical`),[he,ye]=(0,Q.useState)(``),[be,Se]=(0,Q.useState)(``),[Ce,we]=(0,Q.useState)(``),[Ee,De]=(0,Q.useState)(``),[ke,G]=(0,Q.useState)(`edit`),[Ae,je]=(0,Q.useState)(!1),[q,Ne]=(0,Q.useState)(null),[Pe,Fe]=(0,Q.useState)(``),[Ie,Le]=(0,Q.useState)(``),[Re,ze]=(0,Q.useState)(`vertical`),[Be,Ve]=(0,Q.useState)(``),[He,Ue]=(0,Q.useState)(``),[We,Ge]=(0,Q.useState)(``),[Ke,qe]=(0,Q.useState)([]),[Je,Ye]=(0,Q.useState)(``),[Xe,Ze]=(0,Q.useState)(`edit`),[Qe,$e]=(0,Q.useState)([]),[et,rt]=(0,Q.useState)(``),[at,st]=(0,Q.useState)(``),[lt,ht]=(0,Q.useState)(!1),[_t,yt]=(0,Q.useState)(!1),bt=(0,Q.useCallback)(async e=>{try{let t=await Y(`/api/workspace/${encodeURIComponent(e)}/domain-packs`);t&&N(t)}catch{N(null)}},[]);(0,Q.useEffect)(()=>{if(!y){N(null);return}re(y.description||``),L(!1),bt(y.branchName)},[y,bt]);let Ct=async t=>{if(!y)return;let n=new Set(M?.assignedDomainPackIds||y.domainPacks||[]);n.has(t)?n.delete(t):n.add(t);let r=Array.from(n);try{await Y(`/api/workspace/${encodeURIComponent(y.branchName)}/domain-packs`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({domainPacks:r})}),await bt(y.branchName),e.fetchWorkspaces&&await e.fetchWorkspaces(),f?.(`Updated domain packs (${r.length} active)`,`success`)}catch{f?.(`Failed to update domain packs`,`error`)}},wt=async()=>{if(!(!y||!R.trim())){B(!0);try{let t=await Y(`/api/workspace/${encodeURIComponent(y.branchName)}/update-spec`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({description:R.trim(),autoMatchDomains:!0})});L(!1),await bt(y.branchName),e.fetchWorkspaces&&await e.fetchWorkspaces(),t?.newlyMatched?.length>0?f?.(`Specification saved! Auto-attached domain packs: ${t.newlyMatched.join(`, `)}`,`success`):f?.(`Specification updated and context refreshed`,`success`)}catch{f?.(`Failed to update specification`,`error`)}finally{B(!1)}}},Tt=async()=>{if(!(!ae.trim()||!H.trim())){je(!0);try{let e=Ce.split(`
|
|
10
|
-
`).map(e=>e.trim()).filter(Boolean),t=Ee.trim()?[{name:Ee.trim(),target:ke}]:void 0;await F.mutateAsync({id:ae.trim().toLowerCase(),name:H.trim(),description:W.trim(),categoryType:ue,parent:ue===`vertical`&&he.trim()?he.trim():void 0,verifyCommand:be.trim()||void 0,rules:e.length>0?e:void 0,microservices:t,tags:[ae.trim().toLowerCase(),...H.trim().toLowerCase().split(/\s+/).filter(Boolean)]}),y&&await Ct(ae.trim().toLowerCase()),V(!1),oe(``),U(``),le(``),ye(``),Se(``),we(``),De(``),f?.(`Created category "${H}" and attached to workspace!`,`success`)}catch(e){f?.(e.message||`Failed to create category tag`,`error`)}finally{je(!1)}}},Dt=e=>{Ne(e),Fe(e.name||``),Le(e.description||``),ze(e.categoryType||`vertical`),Ve(e.parent||``),Ue(e.verifyCommand||``),Ge(e.rules?e.rules.join(`
|
|
11
|
-
`):``);let t=e.microservices?e.microservices.map(e=>({name:e.name,target:e.target||`edit`})):e.defaultRepos?e.defaultRepos.map(e=>({name:e,target:`edit`})):[];qe(t),Ye(``),Ze(`edit`),$e(e.skills?[...e.skills]:[]),rt(``),st(e.tags?e.tags.join(`, `):``)},kt=async()=>{if(!(!q||!Pe.trim())){ht(!0);try{let t=We.split(`
|
|
12
|
-
`).map(e=>e.trim()).filter(Boolean),n=at.split(`,`).map(e=>e.trim().toLowerCase()).filter(Boolean),r={id:q.id,name:Pe.trim(),description:Ie.trim(),categoryType:Re,parent:Re===`vertical`?Be.trim():``,verifyCommand:He.trim(),rules:t,microservices:Ke,skills:Qe,tags:n.length>0?n:[q.id]};await ee.mutateAsync(r),y&&(await bt(y.branchName),e.fetchWorkspaces&&await e.fetchWorkspaces()),f?.(`Tag "${Pe.trim()}" updated successfully`,`success`),Ne(null)}catch(e){f?.(e.message||`Failed to update tag`,`error`)}finally{ht(!1)}}},At=async()=>{if(!q)return;let t=!!(q.builtin&&!q.isTemplate),n=t?`reset to built-in template`:`delete`;if(window.confirm(`Are you sure you want to ${n} the tag "${q.name}"?`)){yt(!0);try{if(await te.mutateAsync(q.id),y){let n=M?.assignedDomainPackIds||y.domainPacks||[];if(!t&&n.includes(q.id)){let e=n.filter(e=>e!==q.id);await Y(`/api/workspace/${encodeURIComponent(y.branchName)}/domain-packs`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({domainPacks:e})})}await bt(y.branchName),e.fetchWorkspaces&&await e.fetchWorkspaces()}f?.(t?`Reset "${q.name}" to built-in defaults`:`Deleted tag "${q.name}"`,`success`),Ne(null)}catch(e){f?.(e.message||`Failed to delete/reset tag`,`error`)}finally{yt(!1)}}},Ft=y?y.repos.map(e=>{let t=tt(e),n=m.gitChanges?.find(e=>e.repoName===t);return{name:t,path:e,changedCount:n?n.files?.length??0:null}}):[],Lt=y?l.filter(e=>!y.repos.includes(e.path)):[],zt=ce(),Bt=ve().data?.config,[Vt,Wt]=(0,Q.useState)(null),Kt=zt.data?.filter(e=>e.kind===`editor`&&e.available)??[],Jt=Bt?.defaultEditor?{code:`vscode`,vscode:`vscode`,"code-insiders":`vscode-insiders`,"vscode-insiders":`vscode-insiders`,cursor:`cursor`,antigravity:`antigravity`,idea:`intellij`,intellij:`intellij`,webstorm:`webstorm`,charm:`pycharm`,pycharm:`pycharm`,subl:`sublime`,sublime:`sublime`,zed:`zed`,windsurf:`windsurf`}[Bt.defaultEditor]||Bt.defaultEditor:void 0,X=(Jt?Kt.find(e=>e.id===Jt):void 0)||Kt.find(e=>e.id===`vscode-insiders`)||Kt.find(e=>e.id===`vscode`)||Kt[0],Yt=async e=>{if(!(Vt||!y)){Wt(e);try{await Y(`/api/workspace/${encodeURIComponent(y.branchName)}/launch`,{method:`POST`,body:JSON.stringify({targetId:e})}),f?.(`Opened workspace in ${e}.`,`success`)}catch(t){f?.(`Failed to open ${e}: ${t instanceof Error?t.message:String(t)}`,`error`)}finally{Wt(null)}}};return(0,$.jsxs)(`div`,{className:`flex flex-col h-full animate-fade-in w-full min-w-0 bg-transparent`,children:[y?(0,$.jsx)(`div`,{className:`flex-1 min-w-0 h-full overflow-y-auto flex flex-col`,children:(0,$.jsx)(`div`,{className:`flex w-full flex-1 min-w-0 flex-col`,children:(()=>{if(!y)return null;let e=n[y.branchName],t=b===`in-place`?null:e?nt(e.syncStatus):null,r=e?.changedFiles??0,l=E.activeWorktreeId&&E.worktrees[E.activeWorktreeId]?E.worktrees[E.activeWorktreeId]:Object.values(E.worktrees)[0]||null;return(0,$.jsxs)(`div`,{className:`flex flex-col min-w-0 pb-12 w-full`,children:[(0,$.jsx)(Dr,{workspaceTitle:E.workspaceTitle||y.description||y.branchName,workspaceDescription:E.workspaceIntent||y.description,activeWorktree:l,iterations:E.iterations,activeIterationId:E.activeIterationId,onSelectIteration:e=>E.selectIteration(e),activeStage:i===`changes`?`diff`:i===`plan`?`plan`:i===`knowledge`?`knowledge`:`overview`,onSelectStage:e=>{e===`diff`?a(y.branchName,`changes`):e===`plan`?a(y.branchName,`plan`):e===`knowledge`?a(y.branchName,`knowledge`):a(y.branchName,`overview`),E.setActiveStage(e)},diffViewMode:E.diffViewMode,onToggleDiffMode:()=>E.toggleDiffMode(),isZenMode:E.isZenMode,onToggleZenMode:()=>E.toggleZenMode(),gateStatus:E.gateStatus,onNewIteration:()=>a(y.branchName,`plan`),showToast:f}),!E.isZenMode&&(0,$.jsxs)(`div`,{className:`border-b border-border bg-card/80 px-4 py-2 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between text-xs`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 min-w-0`,children:[(0,$.jsx)(`h1`,{className:`font-mono font-bold text-foreground truncate`,title:y.branchName,children:y.branchName}),(0,$.jsx)(`button`,{type:`button`,onClick:async()=>{await St(y.branchName)&&f?.(`Copied branch name to clipboard.`,`success`)},className:`text-muted-foreground hover:text-primary transition-colors p-0.5 rounded hover:bg-secondary cursor-pointer`,title:`Copy branch name`,children:(0,$.jsx)(Mt,{size:11})}),(0,$.jsx)(`span`,{className:`inline-flex items-center rounded border border-border bg-secondary/60 px-1.5 py-0.2 font-mono text-[10px] font-medium text-muted-foreground uppercase`,children:b===`in-place`?`in-place`:`worktree`}),(0,$.jsx)(`span`,{className:`text-muted-foreground/50`,children:`•`}),(0,$.jsxs)(`span`,{className:`font-mono text-[11px] text-muted-foreground`,children:[y.repos.length,` `,y.repos.length===1?`repo`:`repos`]}),r>0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`text-muted-foreground/50`,children:`•`}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>a(y.branchName,`changes`),className:`inline-flex items-center gap-1 text-amber-400 font-semibold font-mono text-[11px] hover:underline cursor-pointer`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-400 animate-pulse`}),r,` diffs`]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`text-muted-foreground/50`,children:`•`}),(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-emerald-400 font-mono text-[11px]`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-emerald-400`}),`clean`]})]}),t&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`text-muted-foreground/50`,children:`•`}),(0,$.jsx)(`span`,{className:`font-mono text-[10px] text-primary`,children:t.label})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[X&&(Kt.length>1?(0,$.jsxs)(`div`,{className:`inline-flex h-7 items-center rounded-md border border-border bg-secondary/80 text-xs`,children:[(0,$.jsxs)(`button`,{type:`button`,disabled:!!Vt,onClick:()=>void Yt(X.id),title:`Open in ${X.name}`,className:`inline-flex h-full items-center gap-1.5 px-2.5 font-medium text-foreground hover:bg-secondary transition-colors cursor-pointer rounded-l-md`,children:[Vt===X.id?(0,$.jsx)(Z,{className:`size-3`}):pi(X.id,X.name),(0,$.jsx)(`span`,{children:X.name})]}),(0,$.jsxs)(_n,{children:[(0,$.jsx)(ln,{"aria-label":`Choose editor`,className:`inline-flex h-full w-6 items-center justify-center text-muted-foreground hover:text-foreground border-l border-border transition-colors cursor-pointer rounded-r-md`,children:(0,$.jsx)(Me,{size:11})}),(0,$.jsxs)(En,{align:`end`,className:`w-52`,children:[(0,$.jsx)(`div`,{className:`px-2 py-1 text-[10px] font-mono font-bold text-muted-foreground uppercase tracking-wider`,children:`Open in Editor`}),Kt.map(e=>(0,$.jsxs)(sn,{onClick:()=>void Yt(e.id),className:K(`flex items-center justify-between text-xs py-1.5`,e.id===X.id&&`font-bold text-primary bg-primary/5`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[pi(e.id,e.name),(0,$.jsx)(`span`,{className:`truncate`,children:e.name})]}),e.id===X.id&&(0,$.jsx)(`span`,{className:`text-[10px] text-primary font-mono`,children:`(default)`})]},e.id))]})]})]}):(0,$.jsxs)(J,{variant:`outline`,size:`xs`,disabled:!!Vt,onClick:()=>void Yt(X.id),className:`h-7 text-xs gap-1.5 border-border cursor-pointer`,children:[Vt===X.id?(0,$.jsx)(Z,{className:`size-3`}):pi(X.id,X.name),(0,$.jsx)(`span`,{children:X.name})]})),(0,$.jsxs)(J,{variant:`outline`,size:`xs`,onClick:()=>o(y),title:`Copy Context prompt for external LLM`,className:`h-7 gap-1 text-xs border-border text-muted-foreground hover:text-foreground cursor-pointer`,children:[(0,$.jsx)(Mt,{size:11}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:`Copy Context`})]}),(0,$.jsxs)(_n,{children:[(0,$.jsx)(ln,{"aria-label":`Workspace actions`,className:`grid size-7 place-items-center rounded-md border border-border bg-secondary/80 text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,children:(0,$.jsx)(er,{size:13})}),(0,$.jsxs)(En,{align:`end`,className:`w-48`,children:[(0,$.jsxs)(sn,{onClick:()=>o(y),className:`flex items-center gap-2 text-xs py-1.5`,children:[(0,$.jsx)(Mt,{size:12}),` `,(0,$.jsx)(`span`,{children:`Copy AI Context`})]}),(0,$.jsxs)(sn,{onClick:()=>void s(y.branchName),disabled:c===y.branchName,className:`flex items-center gap-2 text-xs py-1.5 text-destructive hover:bg-destructive/10`,children:[(0,$.jsx)(ct,{size:12}),(0,$.jsx)(`span`,{children:c===y.branchName?`Deleting…`:`Delete Worktree`})]})]})]})]})]}),(0,$.jsxs)(`div`,{className:`px-6 pt-5`,children:[S&&(0,$.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-between gap-3 rounded-xl border border-amber-500/30 bg-gradient-to-r from-amber-500/15 via-orange-500/10 to-transparent p-3 backdrop-blur-md shadow-xs`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5 text-xs text-amber-200`,children:[(0,$.jsx)(yn,{size:16,className:`text-amber-400 shrink-0 animate-pulse`}),(0,$.jsxs)(`span`,{children:[(0,$.jsxs)(`strong`,{className:`font-semibold text-amber-300`,children:[`Legacy `,mt,` Workspace:`]}),` Upgrade to native `,gt,` manifest and synchronized artifacts.`]})]}),(0,$.jsxs)(`button`,{type:`button`,onClick:O,disabled:w,className:`inline-flex items-center gap-1.5 rounded-lg bg-gradient-to-r from-amber-500 to-orange-500 hover:from-amber-400 hover:to-orange-400 px-3 py-1.5 text-xs font-bold text-white shadow-sm transition-all active:scale-95 disabled:opacity-50 cursor-pointer`,children:[(0,$.jsx)(Xn,{size:14,className:w?`animate-spin`:``}),w?`Upgrading...`:`Migrate to ${gt}`]})]}),(0,$.jsxs)(pt,{value:i,onValueChange:e=>typeof e==`string`&&a(y.branchName,e),className:`mb-6`,children:[(0,$.jsx)(dt,{className:`w-full flex-nowrap overflow-x-auto justify-start gap-1 p-1 rounded-lg border border-border bg-card shadow-xs`,children:mi.map(e=>{let t=e.icon,n=i===e.value,a=null;return e.value===`changes`&&r>0?a=(0,$.jsx)(`span`,{className:`ml-1 inline-flex items-center justify-center rounded-full bg-amber-500/20 px-1.5 py-0.2 text-[10px] font-mono font-bold text-amber-400`,children:r}):e.value===`skills`&&j.length>0&&(a=(0,$.jsx)(`span`,{className:`ml-1 inline-flex items-center justify-center rounded-full bg-primary/20 px-1.5 py-0.2 text-[10px] font-mono font-bold text-primary`,children:j.length})),(0,$.jsxs)(ut,{value:e.value,"aria-label":e.ariaLabel||e.label,className:K(`flex shrink-0 items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md transition-colors cursor-pointer`,n?`bg-secondary text-foreground shadow-xs border border-border font-bold`:`text-muted-foreground hover:text-foreground hover:bg-secondary/50`),children:[(0,$.jsx)(t,{size:13,className:K(`shrink-0`,n?`text-primary`:`text-muted-foreground`)}),(0,$.jsx)(`span`,{children:e.label}),a]},e.value)})}),(0,$.jsxs)(ft,{value:i,className:`animate-fade-in pt-4`,children:[i===`overview`&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,$.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-3`,children:[(0,$.jsxs)(`div`,{onClick:()=>a(y.branchName,`changes`),className:`px-4 py-3 rounded-xl border border-border/80 bg-card/70 hover:bg-card hover:border-primary/40 transition-all cursor-pointer shadow-xs flex items-center justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[(0,$.jsx)(`span`,{className:`grid size-8 place-items-center rounded-lg bg-primary/10 text-primary shrink-0 border border-primary/20`,children:(0,$.jsx)(tr,{size:14})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`text-[10px] font-bold text-muted-foreground uppercase tracking-wider`,children:`Git Status`}),(0,$.jsx)(`div`,{className:`text-sm font-extrabold font-mono text-foreground truncate`,children:r>0?(0,$.jsxs)(`span`,{className:`text-amber-400`,children:[r,` Modified`]}):(0,$.jsx)(`span`,{className:`text-emerald-400`,children:`Clean Tree`})})]})]}),(0,$.jsxs)(`span`,{className:`text-[10px] font-mono text-muted-foreground`,children:[y.repos.length,` `,y.repos.length===1?`repo`:`repos`]})]}),(0,$.jsxs)(`div`,{className:`px-4 py-3 rounded-xl border border-border/80 bg-card/70 shadow-xs flex items-center justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[(0,$.jsx)(`span`,{className:`grid size-8 place-items-center rounded-lg bg-primary/10 text-primary shrink-0 border border-primary/20`,children:(0,$.jsx)(xt,{size:14})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`text-[10px] font-bold text-muted-foreground uppercase tracking-wider`,children:`Flow Mode`}),(0,$.jsxs)(`div`,{className:`text-sm font-extrabold text-foreground capitalize flex items-center gap-1.5 truncate`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-emerald-400 animate-pulse shrink-0`}),y.flowType?y.flowType.replace(`-`,` `):`Feature Flow`]})]})]}),(0,$.jsx)(`span`,{className:`text-[10px] font-mono text-muted-foreground capitalize`,children:b})]}),(0,$.jsxs)(`div`,{onClick:()=>a(y.branchName,`sessions`),className:`px-4 py-3 rounded-xl border border-border/80 bg-card/70 hover:bg-card hover:border-primary/40 transition-all cursor-pointer shadow-xs flex items-center justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[(0,$.jsx)(`span`,{className:`grid size-8 place-items-center rounded-lg bg-primary/10 text-primary shrink-0 border border-primary/20`,children:(0,$.jsx)(Gt,{size:14})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`text-[10px] font-bold text-muted-foreground uppercase tracking-wider`,children:`AI Assistant`}),(0,$.jsx)(`div`,{className:`text-sm font-extrabold text-foreground capitalize truncate`,children:y.assistants[0]||`Antigravity`})]})]}),(0,$.jsx)(`span`,{className:`text-[10px] font-mono text-muted-foreground`,children:`Ready`})]}),(0,$.jsxs)(`div`,{onClick:()=>a(y.branchName,`skills`),className:`px-4 py-3 rounded-xl border border-border/80 bg-card/70 hover:bg-card hover:border-primary/40 transition-all cursor-pointer shadow-xs flex items-center justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[(0,$.jsx)(`span`,{className:`grid size-8 place-items-center rounded-lg bg-primary/10 text-primary shrink-0 border border-primary/20`,children:(0,$.jsx)(ar,{size:14})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`text-[10px] font-bold text-muted-foreground uppercase tracking-wider`,children:`Skills Active`}),(0,$.jsxs)(`div`,{className:`text-sm font-extrabold font-mono text-foreground truncate`,children:[j.length,` `,(0,$.jsx)(`span`,{className:`text-xs font-semibold text-muted-foreground`,children:`toolkits`})]})]})]}),(0,$.jsx)(`span`,{className:`text-[10px] font-mono text-muted-foreground`,children:`Manage`})]})]}),(0,$.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-12 gap-6 items-start`,children:[(0,$.jsx)(`div`,{className:`lg:col-span-7 space-y-6`,children:(0,$.jsxs)(`div`,{className:`rounded-xl border border-border bg-card p-5 space-y-3`,children:[(0,$.jsx)(`h3`,{className:`font-semibold`,children:`Plan, assignment & source documents`}),(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Set the current AI stage, attach requirements, and manage milestone progress in one place.`}),(0,$.jsx)(J,{onClick:()=>a(y.branchName,`plan`),children:`Open plan & sources`})]})}),(0,$.jsxs)(`div`,{className:`lg:col-span-5 space-y-6`,children:[(0,$.jsxs)(Un,{className:`border-border/80 bg-card/70 backdrop-blur-md rounded-xl overflow-hidden shadow-xs`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-border/60 bg-muted/20`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,$.jsx)(_e,{size:16,className:`text-primary`}),(0,$.jsxs)(`h3`,{className:`text-xs font-extrabold uppercase tracking-wider text-foreground`,children:[`Mapped Repositories (`,y.repos.length,`)`]})]}),Lt.length>0&&(0,$.jsx)(Qr,{repos:Lt,disabled:u,onAdd:e=>{window.confirm(`Add repository "${tt(e)}" to this workspace?\nThis creates a new git worktree and re-runs analysis.`)&&d(y.branchName,e)}})]}),(0,$.jsx)(`div`,{className:`divide-y divide-border/60`,children:Ft.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between p-3.5 hover:bg-accent/40 transition-colors text-xs`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,$.jsx)(`span`,{className:K(`size-2.5 rounded-full shrink-0 shadow-xs`,e.changedCount===null?`bg-muted-foreground`:e.changedCount>0?`bg-amber-400 animate-pulse`:`bg-emerald-400`),title:e.changedCount===null?`Status unknown`:e.changedCount>0?`${e.changedCount} uncommitted changes`:`Clean`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`font-mono font-bold text-foreground text-xs sm:text-sm truncate`,children:e.name}),(0,$.jsx)(`div`,{className:`font-mono text-[10px] text-muted-foreground/80 truncate max-w-xs`,children:e.path})]})]}),(0,$.jsx)(`div`,{className:`flex items-center gap-2 shrink-0`,children:(0,$.jsx)(`span`,{className:K(`font-mono text-[10px] font-semibold px-2 py-0.5 rounded-md border`,e.changedCount===null?`border-border bg-muted/60 text-muted-foreground`:e.changedCount>0?`border-amber-500/30 bg-amber-500/10 text-amber-400`:`border-emerald-500/30 bg-emerald-500/10 text-emerald-400`),children:e.changedCount===null?`—`:e.changedCount>0?`${e.changedCount} mod`:`Clean`})})]},e.name))})]}),(0,$.jsxs)(Un,{className:`p-4 border-border/80 bg-card/70 backdrop-blur-md rounded-xl shadow-xs space-y-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(zn,{size:14,className:`text-primary`}),(0,$.jsx)(`h4`,{className:`text-xs font-extrabold uppercase tracking-wider text-foreground`,children:`Task brief & category rules`})]}),ne?(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(J,{size:`xs`,variant:`ghost`,onClick:()=>L(!1),className:`h-6 px-2 text-[11px] text-muted-foreground`,disabled:z,children:`Cancel`}),(0,$.jsxs)(J,{size:`xs`,variant:`default`,onClick:()=>void wt(),className:`h-6 px-2.5 text-[11px] gap-1 bg-primary hover:bg-primary/90 text-primary-foreground font-semibold`,disabled:z,children:[z?(0,$.jsx)(Z,{size:`sm`}):(0,$.jsx)(Pn,{size:11}),(0,$.jsx)(`span`,{children:`Save & Match`})]})]}):(0,$.jsxs)(J,{size:`xs`,variant:`ghost`,onClick:()=>{re(y.description||``),L(!0)},className:`h-6 px-2 text-[11px] gap-1 text-muted-foreground hover:text-foreground`,children:[(0,$.jsx)(ir,{size:11}),(0,$.jsx)(`span`,{children:`Edit brief`})]})]}),(0,$.jsxs)(`div`,{className:`space-y-2 pt-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[M?.organization&&(0,$.jsxs)(`div`,{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-lg text-xs font-semibold border border-purple-500/30 bg-purple-500/10 text-purple-300 shadow-xs`,title:`Universal Root Conventions: ${M.organization.name}. Commit pattern: ${M.organization.commitMessagePattern}`,children:[(0,$.jsx)(Kn,{size:11,className:`text-purple-400 shrink-0`}),(0,$.jsxs)(`span`,{children:[M.organization.name,` Root`]}),(0,$.jsx)(`span`,{className:`text-[9px] px-1 py-0.2 rounded bg-purple-500/20 text-purple-200 font-mono`,children:`Conventions`})]}),P.length===0&&!M?.organization&&(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground italic py-1`,children:`No category or trait tags defined yet.`}),P.filter(e=>e.categoryType!==`trait`&&(!e.parent||!P.some(t=>t.id===e.parent))).map(e=>{let t=(M?.assignedDomainPackIds||y.domainPacks||[]).includes(e.id),n=P.filter(t=>t.parent===e.id);return(0,$.jsxs)(`div`,{className:`inline-flex items-center rounded-lg border border-border/60 bg-muted/20 p-0.5 gap-1`,children:[(0,$.jsxs)(`div`,{className:`inline-flex items-center`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>void Ct(e.id),className:K(`inline-flex items-center gap-1 px-2 py-0.5 rounded-l-md text-xs font-medium transition-all cursor-pointer`,t?`bg-emerald-500/20 text-emerald-300 font-semibold shadow-xs`:`text-muted-foreground hover:bg-muted/50 hover:text-foreground`),title:`${e.name}: ${e.description} (Click to toggle)`,children:[(0,$.jsx)(ot,{size:10,className:t?`text-emerald-400`:`text-muted-foreground`}),(0,$.jsx)(`span`,{children:e.name}),!e.isTemplate&&(0,$.jsx)(`span`,{className:`text-[8px] px-1 py-0.2 rounded bg-amber-500/20 text-amber-300 font-mono`,children:`custom`}),t?(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-emerald-400`}):(0,$.jsx)(Ut,{size:10,className:`opacity-50`})]}),(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),Dt(e)},className:K(`px-1 py-1 rounded-r-md text-muted-foreground/70 hover:text-foreground hover:bg-muted/60 transition-colors cursor-pointer`,t?`bg-emerald-500/20 text-emerald-300/80 hover:text-emerald-200`:``),title:`Inspect & edit ${e.name} details`,"aria-label":`Inspect & edit ${e.name} details`,children:(0,$.jsx)(lr,{size:10})})]}),n.map(t=>{let n=(M?.assignedDomainPackIds||y.domainPacks||[]).includes(t.id);return(0,$.jsxs)(`div`,{className:`inline-flex items-center`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>void Ct(t.id),className:K(`inline-flex items-center gap-1 px-1.5 py-0.5 rounded-l-md text-[11px] font-medium transition-all cursor-pointer border-y border-l`,n?`border-emerald-500/40 bg-emerald-500/25 text-emerald-200 font-semibold shadow-xs`:`border-transparent text-muted-foreground/80 hover:bg-muted/50 hover:text-foreground`),title:`${t.name} (Inherits ${e.name}): ${t.description} (Click to toggle)`,children:[(0,$.jsx)(`span`,{className:`text-muted-foreground text-[10px]`,children:`↳`}),(0,$.jsx)(`span`,{children:t.name.replace(/^.*\s*›\s*/,``)}),!t.isTemplate&&(0,$.jsx)(`span`,{className:`text-[8px] px-1 py-0.2 rounded bg-amber-500/20 text-amber-300 font-mono`,children:`custom`}),n?(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-emerald-400`}):(0,$.jsx)(Ut,{size:9,className:`opacity-50`})]}),(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),Dt(t)},className:K(`px-1 py-1 rounded-r-md text-muted-foreground/70 hover:text-foreground hover:bg-muted/60 transition-colors cursor-pointer border-y border-r`,n?`border-emerald-500/40 bg-emerald-500/25 text-emerald-200/80 hover:text-emerald-100`:`border-transparent`),title:`Inspect & edit ${t.name} details`,"aria-label":`Inspect & edit ${t.name} details`,children:(0,$.jsx)(lr,{size:9})})]},t.id)})]},e.id)}),P.filter(e=>e.categoryType===`trait`).map(e=>{let t=(M?.assignedDomainPackIds||y.domainPacks||[]).includes(e.id);return(0,$.jsxs)(`div`,{className:K(`inline-flex items-center rounded-lg border transition-all p-0.5 gap-0.5`,t?`border-indigo-500/40 bg-indigo-500/15 text-indigo-300 shadow-xs`:`border-border/60 bg-muted/30 text-muted-foreground hover:bg-muted/60 hover:text-foreground`),children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>void Ct(e.id),className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-l-md text-xs font-medium cursor-pointer`,title:`Cross-cutting Trait: ${e.name} - ${e.description} (Click to toggle)`,children:[(0,$.jsx)(it,{size:11,className:t?`text-indigo-400`:`text-muted-foreground`}),(0,$.jsx)(`span`,{children:e.name}),(0,$.jsx)(`span`,{className:`text-[9px] px-1 py-0.2 rounded bg-indigo-500/20 text-indigo-200 font-mono`,children:`Trait`}),!e.isTemplate&&(0,$.jsx)(`span`,{className:`text-[8px] px-1 py-0.2 rounded bg-amber-500/20 text-amber-300 font-mono`,children:`custom`}),t?(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-indigo-400`}):(0,$.jsx)(Ut,{size:10,className:`opacity-50`})]}),(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),Dt(e)},className:`p-1 rounded-r-md text-muted-foreground/70 hover:text-foreground hover:bg-muted/60 transition-colors cursor-pointer`,title:`Inspect & edit ${e.name} details`,"aria-label":`Inspect & edit ${e.name} details`,children:(0,$.jsx)(lr,{size:10})})]},e.id)})]}),(0,$.jsxs)(J,{size:`xs`,variant:`ghost`,onClick:()=>V(!0),className:`h-6 px-2 text-[11px] gap-1 text-muted-foreground hover:text-foreground border border-dashed border-border/80`,children:[(0,$.jsx)(Ut,{size:11}),(0,$.jsx)(`span`,{children:`New Category / Trait`})]})]}),(M?.editRepos&&M.editRepos.length>0||M?.referenceRepos&&M.referenceRepos.length>0)&&(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 p-2 rounded-lg bg-muted/40 border border-border/60 text-xs`,children:[(0,$.jsxs)(`span`,{className:`font-semibold text-muted-foreground flex items-center gap-1 text-[11px]`,children:[(0,$.jsx)(_e,{size:12,className:`text-primary`}),(0,$.jsx)(`span`,{children:`Scoped Microservices:`})]}),M.editRepos?.map(e=>(0,$.jsxs)(`span`,{className:`px-2 py-0.5 rounded bg-primary/10 text-primary border border-primary/20 font-mono text-[11px] flex items-center gap-1 shadow-xs`,title:`Active Worktree (Edit Mode)`,children:[(0,$.jsx)(ir,{size:10}),(0,$.jsx)(`span`,{children:e}),(0,$.jsx)(`span`,{className:`text-[9px] opacity-75 font-sans font-semibold`,children:`(edit)`})]},e)),M.referenceRepos?.map(e=>(0,$.jsxs)(`span`,{className:`px-2 py-0.5 rounded bg-muted text-muted-foreground border border-border/80 font-mono text-[11px] flex items-center gap-1`,title:`Reference Mode (Read-only context)`,children:[(0,$.jsx)(`span`,{children:e}),(0,$.jsx)(`span`,{className:`text-[9px] opacity-75 font-sans`,children:`(ref)`})]},e))]})]}),ne?(0,$.jsxs)(`div`,{className:`space-y-2 pt-1`,children:[(0,$.jsx)(`textarea`,{value:R,onChange:e=>re(e.target.value),rows:5,placeholder:`Describe the intended outcome and acceptance criteria. Attach detailed source documents in Plan.`,className:`w-full text-xs font-mono p-3 rounded-lg border border-border/80 bg-background/80 text-foreground focus:outline-none focus:ring-1 focus:ring-primary leading-relaxed resize-y`}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] text-muted-foreground`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(yn,{size:11,className:`text-amber-400`}),(0,$.jsx)(`span`,{children:`Auto-detects subsystem domain tags upon saving`})]}),(0,$.jsxs)(`span`,{children:[R.length,` chars`]})]})]}):(0,$.jsx)(`div`,{className:`text-xs leading-relaxed text-foreground/90 max-h-44 overflow-y-auto pr-1`,children:y.description?(0,$.jsx)(Pt,{content:y.description}):(0,$.jsx)(`div`,{className:`text-muted-foreground italic py-2`,children:`No task brief yet. Add a short outcome here and attach detailed sources in Plan.`})}),M?.allRules&&M.allRules.length>0&&(0,$.jsxs)(`div`,{className:`mt-2 pt-2 border-t border-border/50 space-y-1.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] font-bold uppercase tracking-wider text-muted-foreground`,children:[(0,$.jsx)(it,{size:12,className:`text-emerald-400`}),(0,$.jsxs)(`span`,{children:[`Active Rules & Verification (`,M.allRules.length,`)`]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1 text-[9px] text-muted-foreground`,children:[(0,$.jsx)(`span`,{className:`px-1 py-0.2 rounded bg-purple-500/10 text-purple-300`,children:`Org Root`}),(0,$.jsx)(`span`,{children:`›`}),(0,$.jsx)(`span`,{className:`px-1 py-0.2 rounded bg-emerald-500/10 text-emerald-300`,children:`Verticals`}),(0,$.jsx)(`span`,{children:`›`}),(0,$.jsx)(`span`,{className:`px-1 py-0.2 rounded bg-indigo-500/10 text-indigo-300`,children:`Traits`})]})]}),(0,$.jsxs)(`div`,{className:`space-y-1 max-h-28 overflow-y-auto pr-1`,children:[M.allRules.slice(0,4).map((e,t)=>(0,$.jsxs)(`div`,{className:`text-[11px] text-muted-foreground/90 flex items-start gap-1.5 leading-snug`,children:[(0,$.jsx)(`span`,{className:`text-primary font-bold`,children:`›`}),(0,$.jsx)(`span`,{className:`truncate`,children:e})]},t)),M.allRules.length>4&&(0,$.jsxs)(`div`,{className:`text-[10px] text-muted-foreground italic pl-3`,children:[`+`,M.allRules.length-4,` more domain rules active in AGENTS.md`]})]})]})]}),(0,$.jsxs)(Un,{className:`border-border/80 bg-card/70 backdrop-blur-md rounded-xl p-4 shadow-xs`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(ar,{size:15,className:`text-primary`}),(0,$.jsxs)(`h3`,{className:`text-xs font-extrabold uppercase tracking-wider text-foreground`,children:[`Skills & Capabilities (`,j.length,`)`]})]}),(0,$.jsxs)(J,{size:`xs`,variant:`outline`,onClick:()=>a(y.branchName,`skills`),className:`text-[11px] font-semibold gap-1 h-7`,children:[(0,$.jsx)(ar,{size:11}),(0,$.jsx)(`span`,{children:`Configure`})]})]}),j.length===0?(0,$.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`No custom skills attached to this workspace.`}):(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:j.map(e=>(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-lg text-xs font-mono font-medium border border-border/70 bg-card/60`,title:e.description,children:[(0,$.jsx)(ar,{size:10,className:`text-primary`}),e.title||e.name]},e.id))})]})]})]})]}),i===`sessions`&&(0,$.jsxs)(`section`,{"aria-labelledby":`session-history-heading`,className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-3 p-4 rounded-xl border border-border bg-card shadow-xs`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{id:`session-history-heading`,className:`text-sm font-semibold text-foreground`,children:`AI Sessions & History`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:`Inspect recorded session logs, turns, and token usage, or open active conversations in the floating chat.`})]}),(0,$.jsxs)(J,{variant:`default`,size:`sm`,onClick:()=>x(y.branchName),className:`text-xs h-8 gap-1.5 shrink-0 cursor-pointer self-start sm:self-auto`,title:`Open floating multi-workspace chat`,children:[(0,$.jsx)(Gt,{className:`size-3.5`}),(0,$.jsx)(`span`,{children:`Open Floating Chat`})]})]}),(0,$.jsx)(ti,{ws:y,showToast:f,...p})]}),i===`documents`&&(0,$.jsx)(ai,{workspaceId:y.branchName},y.branchName),i===`changes`&&(0,$.jsx)(ni,{ws:y,...m}),i===`knowledge`&&(0,$.jsx)(ri,{ws:y,...h}),i===`skills`&&(0,$.jsx)(fi,{ws:y,showToast:f}),i===`plan`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ui,{workspaceId:y.branchName,onPlanChanged:()=>{v(e=>e+1),g.handleRetryPlan(y.branchName)}},y.branchName),(0,$.jsx)(ii,{workspaceId:y.branchName,defaultViewMode:`flow`,...g},`${y.branchName}-${_}`)]}),i===`services`&&(0,$.jsx)(Er,{ws:y})]})]})]})]})})()})}):(0,$.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-8`,children:(0,$.jsx)(`div`,{className:`max-w-md w-full`,children:(0,$.jsx)(An,{children:(0,$.jsxs)(an,{children:[(0,$.jsx)(Tn,{variant:`icon`,children:(0,$.jsx)(_e,{})}),(0,$.jsx)(Mn,{children:`No workspace selected`}),(0,$.jsx)(hn,{children:`Select a workspace from the sidebar to inspect git changes, context, or launch AI assistants.`})]})})})}),(0,$.jsx)(vt,{open:ie,onOpenChange:V,children:(0,$.jsxs)(Et,{className:`max-w-lg`,children:[(0,$.jsxs)(Rt,{children:[(0,$.jsxs)(jt,{className:`flex items-center gap-2`,children:[(0,$.jsx)(ot,{size:16,className:`text-primary`}),(0,$.jsx)(`span`,{children:`Create Enterprise Category or Trait`})]}),(0,$.jsx)(vn,{children:`Define a vertical business subsystem or horizontal cross-cutting trait with architectural invariants, microservice bindings, and verification commands.`})]}),(0,$.jsxs)(Ht,{className:`space-y-3.5 py-2`,children:[(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`text-xs font-semibold text-foreground`,children:`Name`}),(0,$.jsx)(I,{value:H,onChange:e=>U(e.target.value),placeholder:`e.g. Order Processing`,size:`sm`})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`text-xs font-semibold text-foreground`,children:`Tag ID / Slug`}),(0,$.jsx)(I,{value:ae,onChange:e=>oe(e.target.value),placeholder:`e.g. orders`,size:`sm`})]})]}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`text-xs font-semibold text-foreground`,children:`Type`}),(0,$.jsxs)(`select`,{value:ue,onChange:e=>pe(e.target.value),className:`w-full h-7.5 px-2 text-xs rounded-md border border-border bg-background text-foreground`,children:[(0,$.jsx)(`option`,{value:`vertical`,children:`Vertical Subsystem`}),(0,$.jsx)(`option`,{value:`trait`,children:`Horizontal Trait`})]})]}),ue===`vertical`&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`text-xs font-semibold text-foreground`,children:`Parent Category (optional)`}),(0,$.jsxs)(`select`,{value:he,onChange:e=>ye(e.target.value),className:`w-full h-7.5 px-2 text-xs rounded-md border border-border bg-background text-foreground`,children:[(0,$.jsx)(`option`,{value:``,children:`None (Top-level vertical)`}),P.filter(e=>e.categoryType!==`trait`&&!e.parent).map(e=>(0,$.jsxs)(`option`,{value:e.id,children:[e.name,` (#`,e.id,`)`]},e.id))]})]})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`text-xs font-semibold text-foreground`,children:`Description`}),(0,$.jsx)(I,{value:W,onChange:e=>le(e.target.value),placeholder:`Brief description of scope & responsibility`,size:`sm`})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`text-xs font-semibold text-foreground`,children:`Verification Command`}),(0,$.jsx)(I,{value:be,onChange:e=>Se(e.target.value),placeholder:`e.g. npm test -- orders`,size:`sm`})]}),(0,$.jsxs)(`div`,{className:`grid grid-cols-3 gap-2`,children:[(0,$.jsxs)(`div`,{className:`col-span-2 space-y-1`,children:[(0,$.jsx)(`label`,{className:`text-xs font-semibold text-foreground`,children:`Microservice Binding (optional)`}),(0,$.jsx)(I,{value:Ee,onChange:e=>De(e.target.value),placeholder:`e.g. orders-service`,size:`sm`})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`text-xs font-semibold text-foreground`,children:`Target Mode`}),(0,$.jsxs)(`select`,{value:ke,onChange:e=>G(e.target.value),className:`w-full h-7.5 px-2 text-xs rounded-md border border-border bg-background text-foreground`,children:[(0,$.jsx)(`option`,{value:`edit`,children:`Edit (Worktree)`}),(0,$.jsx)(`option`,{value:`reference`,children:`Reference Only`})]})]})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`text-xs font-semibold text-foreground`,children:`Architectural Invariants & Rules (one per line)`}),(0,$.jsx)(`textarea`,{rows:3,value:Ce,onChange:e=>we(e.target.value),placeholder:`e.g. Order amounts must always include currency code and tax breakdown.`,className:`w-full text-xs font-mono p-2 rounded-md border border-border bg-background text-foreground resize-y`})]})]}),(0,$.jsxs)(It,{children:[(0,$.jsx)(J,{variant:`outline`,size:`sm`,onClick:()=>V(!1),children:`Cancel`}),(0,$.jsxs)(J,{variant:`default`,size:`sm`,disabled:!ae.trim()||!H.trim()||Ae,onClick:()=>void Tt(),children:[Ae?(0,$.jsx)(Z,{size:`sm`}):(0,$.jsx)(Pn,{size:12}),(0,$.jsx)(`span`,{children:`Create Category`})]})]})]})}),(0,$.jsx)(vt,{open:!!q,onOpenChange:e=>!e&&Ne(null),children:(0,$.jsxs)(Et,{className:`max-w-xl max-h-[90vh] flex flex-col`,children:[(0,$.jsxs)(Rt,{children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between pr-6`,children:[(0,$.jsxs)(jt,{className:`flex items-center gap-2`,children:[Re===`trait`?(0,$.jsx)(it,{size:18,className:`text-indigo-400`}):(0,$.jsx)(ot,{size:18,className:`text-primary`}),(0,$.jsxs)(`span`,{children:[`Inspect & Edit `,Re===`trait`?`Trait`:`Category`]})]}),q&&(0,$.jsx)(`span`,{className:K(`text-[10px] px-2 py-0.5 rounded-full font-mono font-semibold border`,q.isTemplate?`border-blue-500/30 bg-blue-500/10 text-blue-300`:`border-amber-500/30 bg-amber-500/10 text-amber-300`),children:q.isTemplate?`Built-in Template`:`Custom / Overridden`})]}),(0,$.jsx)(vn,{children:`View and configure full details: architectural invariants, verification command, scoped microservices, and attached agent skills.`})]}),(0,$.jsxs)(Ht,{className:`space-y-4 py-2 overflow-y-auto flex-1 pr-1`,children:[(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`text-xs font-semibold text-foreground`,children:`Name`}),(0,$.jsx)(I,{value:Pe,onChange:e=>Fe(e.target.value),placeholder:`e.g. Order Processing`,size:`sm`})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`text-xs font-semibold text-foreground`,children:`Tag ID / Slug`}),(0,$.jsx)(I,{value:q?.id||``,disabled:!0,size:`sm`,className:`bg-muted/50 font-mono text-xs cursor-not-allowed`})]})]}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`text-xs font-semibold text-foreground`,children:`Category Type`}),(0,$.jsxs)(`select`,{value:Re,onChange:e=>ze(e.target.value),className:`w-full h-7.5 px-2 text-xs rounded-md border border-border bg-background text-foreground`,children:[(0,$.jsx)(`option`,{value:`vertical`,children:`Vertical Subsystem`}),(0,$.jsx)(`option`,{value:`trait`,children:`Horizontal Trait`})]})]}),Re===`vertical`&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`text-xs font-semibold text-foreground`,children:`Parent Category`}),(0,$.jsxs)(`select`,{value:Be,onChange:e=>Ve(e.target.value),className:`w-full h-7.5 px-2 text-xs rounded-md border border-border bg-background text-foreground`,children:[(0,$.jsx)(`option`,{value:``,children:`None (Top-level vertical)`}),P.filter(e=>e.categoryType!==`trait`&&!e.parent&&e.id!==q?.id).map(e=>(0,$.jsxs)(`option`,{value:e.id,children:[e.name,` (#`,e.id,`)`]},e.id))]})]})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`text-xs font-semibold text-foreground`,children:`Description`}),(0,$.jsx)(I,{value:Ie,onChange:e=>Le(e.target.value),placeholder:`Brief description of scope & responsibility`,size:`sm`})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`label`,{className:`text-xs font-semibold text-foreground`,children:`Architectural Invariants & Rules`}),(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`Injected into workspace AGENTS.md`})]}),(0,$.jsx)(`textarea`,{rows:4,value:We,onChange:e=>Ge(e.target.value),placeholder:`e.g. Orders must be signed before publishing to event bus.
|
|
13
|
-
Amounts must include ISO-4217 currency code.`,className:`w-full text-xs font-mono p-2 rounded-md border border-border bg-background text-foreground resize-y leading-relaxed`})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`label`,{className:`text-xs font-semibold text-foreground`,children:`Mechanical Verification Command`}),(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`Runs during verification gates`})]}),(0,$.jsx)(I,{value:He,onChange:e=>Ue(e.target.value),placeholder:`e.g. npm test -- orders`,size:`sm`,className:`font-mono text-xs`})]}),(0,$.jsxs)(`div`,{className:`space-y-2 p-3 rounded-lg bg-muted/20 border border-border/60`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsxs)(`label`,{className:`text-xs font-semibold text-foreground flex items-center gap-1.5`,children:[(0,$.jsx)(_e,{size:13,className:`text-primary`}),(0,$.jsxs)(`span`,{children:[`Scoped Microservices (`,Ke.length,`)`]})]}),(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`Worktrees created when tag attached`})]}),Ke.length>0&&(0,$.jsx)(`div`,{className:`space-y-1.5 max-h-32 overflow-y-auto pr-1`,children:Ke.map((e,t)=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-2 py-1 rounded bg-card border border-border/60 text-xs`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`font-mono text-xs font-medium text-foreground`,children:e.name}),(0,$.jsx)(`span`,{className:K(`text-[9px] px-1.5 py-0.2 rounded font-semibold`,e.target===`edit`?`bg-primary/15 text-primary border border-primary/20`:`bg-muted text-muted-foreground`),children:e.target===`edit`?`Edit (Worktree)`:`Reference`})]}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>qe(e=>e.filter((e,n)=>n!==t)),className:`p-1 text-muted-foreground hover:text-destructive transition-colors cursor-pointer`,title:`Remove microservice binding`,children:(0,$.jsx)(qt,{size:12})})]},t))}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,$.jsx)(I,{value:Je,onChange:e=>Ye(e.target.value),placeholder:`Microservice repo name (e.g. orders-service)`,size:`sm`,className:`flex-1 text-xs font-mono`}),(0,$.jsxs)(`select`,{value:Xe,onChange:e=>Ze(e.target.value),className:`h-7.5 px-2 text-xs rounded-md border border-border bg-background text-foreground`,children:[(0,$.jsx)(`option`,{value:`edit`,children:`Edit (Worktree)`}),(0,$.jsx)(`option`,{value:`reference`,children:`Reference Only`})]}),(0,$.jsxs)(J,{type:`button`,variant:`outline`,size:`xs`,disabled:!Je.trim(),onClick:()=>{Je.trim()&&(qe(e=>[...e,{name:Je.trim(),target:Xe}]),Ye(``))},className:`h-7.5 text-xs shrink-0`,children:[(0,$.jsx)(Ut,{size:11,className:`mr-1`}),`Add`]})]})]}),(0,$.jsxs)(`div`,{className:`space-y-2 p-3 rounded-lg bg-muted/20 border border-border/60`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsxs)(`label`,{className:`text-xs font-semibold text-foreground flex items-center gap-1.5`,children:[(0,$.jsx)(yn,{size:13,className:`text-primary`}),(0,$.jsxs)(`span`,{children:[`Attached Skills (`,Qe.length,`)`]})]}),(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`Auto-activated when tag is selected`})]}),(0,$.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5 min-h-7`,children:Qe.length===0?(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground italic`,children:`No attached skills.`}):Qe.map(e=>{let t=A.find(t=>t.id===e);return(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-md text-[11px] bg-primary/10 text-primary border border-primary/20 font-medium`,children:[(0,$.jsx)(`span`,{children:t?.title||t?.name||e}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>$e(t=>t.filter(t=>t!==e)),className:`hover:text-destructive cursor-pointer ml-0.5`,children:(0,$.jsx)(qt,{size:11})})]},e)})}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,$.jsxs)(`select`,{value:et,onChange:e=>rt(e.target.value),className:`flex-1 h-7.5 px-2 text-xs rounded-md border border-border bg-background text-foreground`,children:[(0,$.jsx)(`option`,{value:``,children:`Select a skill to attach...`}),A.filter(e=>!Qe.includes(e.id)).map(e=>(0,$.jsxs)(`option`,{value:e.id,children:[e.title||e.name,` (`,e.id,`)`]},e.id))]}),(0,$.jsxs)(J,{type:`button`,variant:`outline`,size:`xs`,disabled:!et,onClick:()=>{et&&($e(e=>[...e,et]),rt(``))},className:`h-7.5 text-xs shrink-0`,children:[(0,$.jsx)(Ut,{size:11,className:`mr-1`}),`Attach Skill`]})]})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`text-xs font-semibold text-foreground`,children:`Discovery Tags (comma-separated)`}),(0,$.jsx)(I,{value:at,onChange:e=>st(e.target.value),placeholder:`e.g. economy, finance, invoicing`,size:`sm`,className:`font-mono text-xs`})]})]}),(0,$.jsxs)(It,{className:`flex items-center justify-between sm:justify-between w-full pt-3 border-t`,children:[(0,$.jsx)(`div`,{children:!!(q&&(!q.builtin||!q.isTemplate))&&(0,$.jsxs)(J,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void At(),disabled:_t||lt,className:`text-destructive hover:bg-destructive/10 border-destructive/30 text-xs gap-1.5`,children:[_t?(0,$.jsx)(Z,{size:`sm`}):(0,$.jsx)(sr,{size:12}),(0,$.jsx)(`span`,{children:q?.builtin?`Reset to Defaults`:`Delete Tag`})]})}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(J,{variant:`outline`,size:`sm`,onClick:()=>Ne(null),children:`Cancel`}),(0,$.jsxs)(J,{variant:`default`,size:`sm`,disabled:!Pe.trim()||lt,onClick:()=>void kt(),className:`gap-1.5`,children:[lt?(0,$.jsx)(Z,{size:`sm`}):(0,$.jsx)(Pn,{size:12}),(0,$.jsx)(`span`,{children:`Save Changes`})]})]})]})]})})]})}export{hi as WorkspacesPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-DE3RlOCf.js";import{m as t}from"./button-BrcP8Wxx.js";import{$ as n,Q as r,X as i,Z as a,et as o,nt as s,rt as c,tt as l}from"./index-CxyTuBKc.js";function u(e){return r(`alert-dialog`,e)}var d=e(),f=u,p=n;function m({className:e,...n}){return(0,d.jsx)(c,{forceRender:!0,className:t(`fixed inset-0 z-50 bg-background/60 backdrop-blur-xs transition-all duration-200 data-ending-style:opacity-0 data-starting-style:opacity-0`,e),"data-slot":`alert-dialog-backdrop`,...n})}function h({className:e,...n}){return(0,d.jsx)(a,{className:t(`fixed inset-0 z-50 grid grid-rows-[1fr_auto_1fr] justify-items-center p-4`,e),"data-slot":`alert-dialog-viewport`,...n})}function g({className:e,bottomStickOnMobile:n=!0,...r}){return(0,d.jsxs)(p,{children:[(0,d.jsx)(m,{}),(0,d.jsx)(h,{className:t(n&&`max-sm:grid-rows-[1fr_auto] max-sm:p-0 max-sm:pt-12`),children:(0,d.jsx)(o,{className:t(`-translate-y-[calc(1.25rem*var(--nested-dialogs))] relative row-start-2 flex max-h-full min-h-0 w-full min-w-0 max-w-lg scale-[calc(1-0.1*var(--nested-dialogs))] flex-col rounded-2xl border bg-popover not-dark:bg-clip-padding text-popover-foreground opacity-[calc(1-0.1*var(--nested-dialogs))] shadow-lg/5 transition-[scale,opacity,translate] duration-200 ease-in-out will-change-transform before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-2xl)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] data-nested:data-ending-style:translate-y-8 data-nested:data-starting-style:translate-y-8 data-nested-dialog-open:origin-top data-ending-style:scale-98 data-starting-style:scale-98 data-ending-style:opacity-0 data-starting-style:opacity-0 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]`,n&&`max-sm:max-w-none max-sm:rounded-none max-sm:border-x-0 max-sm:border-t max-sm:border-b-0 max-sm:opacity-[calc(1-min(var(--nested-dialogs),1))] max-sm:data-ending-style:translate-y-4 max-sm:data-starting-style:translate-y-4 max-sm:before:hidden max-sm:before:rounded-none`,e),"data-slot":`alert-dialog-popup`,...r})})]})}function _({className:e,...n}){return(0,d.jsx)(`div`,{className:t(`flex flex-col gap-2 p-6 text-center max-sm:pb-4 sm:text-left`,e),"data-slot":`alert-dialog-header`,...n})}function v({className:e,variant:n=`default`,...r}){return(0,d.jsx)(`div`,{className:t(`flex flex-col-reverse gap-2 px-6 sm:flex-row sm:justify-end sm:rounded-b-[calc(var(--radius-2xl)-1px)]`,n==="default"&&`border-t bg-muted/72 py-4`,n===`bare`&&`pb-6`,e),"data-slot":`alert-dialog-footer`,...r})}function y({className:e,...n}){return(0,d.jsx)(i,{className:t(`font-heading font-semibold text-xl leading-none`,e),"data-slot":`alert-dialog-title`,...n})}function b({className:e,...n}){return(0,d.jsx)(l,{className:t(`text-muted-foreground text-sm`,e),"data-slot":`alert-dialog-description`,...n})}function x(e){return(0,d.jsx)(s,{"data-slot":`alert-dialog-close`,...e})}export{_ as a,v as i,x as n,g as o,b as r,y as s,f as t};
|