@mrpatronz/nexusflow 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/AntigravityCliAdapter.d.ts +14 -1
- package/dist/agent/AntigravityCliAdapter.d.ts.map +1 -1
- package/dist/agent/AntigravityCliAdapter.js +84 -4
- package/dist/agent/AntigravityCliAdapter.js.map +1 -1
- package/dist/agent/AntigravityCliAdapter.test.d.ts +2 -0
- package/dist/agent/AntigravityCliAdapter.test.d.ts.map +1 -0
- package/dist/agent/AntigravityCliAdapter.test.js +222 -0
- package/dist/agent/AntigravityCliAdapter.test.js.map +1 -0
- package/dist/agent/adapters.d.ts.map +1 -1
- package/dist/agent/adapters.js +19 -1
- package/dist/agent/adapters.js.map +1 -1
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +15 -1
- package/dist/commands/create.js.map +1 -1
- package/dist/gui/assets/AgentsPage-B_3Vqn2y.js +3 -0
- package/dist/gui/assets/DashboardPage-W7KE2gn1.js +1 -0
- package/dist/gui/assets/{GettingStartedPage-YwJXpsc6.js → GettingStartedPage-DQ5kCj0q.js} +1 -1
- package/dist/gui/assets/ProjectsPage-CrZhKj85.js +1 -0
- package/dist/gui/assets/{ScaffoldRepoInline-ij7JLzmx.js → ScaffoldRepoInline-BSpQbVe7.js} +1 -1
- package/dist/gui/assets/{SettingsPage-BQhAP4go.js → SettingsPage-Zvq-P6Hj.js} +1 -1
- package/dist/gui/assets/SkillsPage-DR-Y5ZM1.js +6 -0
- package/dist/gui/assets/StartWorkPage-DO6t_zFb.js +1 -0
- package/dist/gui/assets/{StrategiesPage-CLOjDRbX.js → StrategiesPage-CkpJI4Q3.js} +1 -1
- package/dist/gui/assets/{WorkspaceLauncher-CjNI4vqn.js → WorkspaceLauncher-CDtnv1IK.js} +1 -1
- package/dist/gui/assets/WorkspacesPage-B9QOLnq_.js +6 -0
- package/dist/gui/assets/{alert-dialog-DjwFcE6b.js → alert-dialog-Cjwogh-W.js} +1 -1
- package/dist/gui/assets/{index-CfQEnn52.js → index-ofoYKpCG.js} +20 -20
- package/dist/gui/assets/index-w-iQhEQv.css +2 -0
- package/dist/gui/assets/terminal-D1awFRPr.js +1 -0
- package/dist/gui/assets/zap-DhYfYRlq.js +1 -0
- package/dist/gui/index.html +2 -2
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +7 -0
- package/dist/server.js.map +1 -1
- package/dist/server.test.js +31 -0
- package/dist/server.test.js.map +1 -1
- package/dist/utils/prompts.d.ts +5 -1
- package/dist/utils/prompts.d.ts.map +1 -1
- package/dist/utils/prompts.js +16 -0
- package/dist/utils/prompts.js.map +1 -1
- package/package.json +1 -1
- package/dist/gui/assets/AgentsPage-BtrTgIyU.js +0 -3
- package/dist/gui/assets/DashboardPage-CeUkMdxc.js +0 -1
- package/dist/gui/assets/ProjectsPage-D8kEHb-m.js +0 -1
- package/dist/gui/assets/SkillsPage-DJ-dXfcC.js +0 -6
- package/dist/gui/assets/StartWorkPage-DGWZzF4H.js +0 -1
- package/dist/gui/assets/WorkspacesPage-MDzm2JUh.js +0 -6
- package/dist/gui/assets/code-xml-Chu1p81J.js +0 -1
- package/dist/gui/assets/index-k7inKaui.css +0 -2
- package/dist/gui/assets/terminal-gK6BMl3E.js +0 -1
- package/dist/gui/assets/zap-FQrDnrgb.js +0 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{_ as e,a as t,b as n,d as r,g as i,h as a,i as o,l as s,m as c,o as l,p as u,s as d,t as f,u as p,v as m}from"./button-cPldH5S4.js";import{$ as h,$t as g,An as _,At as v,B as y,Bn as b,C as x,Ct as S,D as C,Dn as w,E as T,Et as E,F as D,Gt as O,H as k,Hn as A,Ht as j,I as M,It as N,J as P,Jt as F,K as ee,Kt as I,L as te,Lt as ne,M as re,Mn as L,N as ie,Nt as ae,O as R,Ot as oe,P as se,Pt as ce,Q as z,Qt as B,R as le,Rt as V,S as ue,U as de,Un as fe,Ut as pe,V as H,W as me,Wn as he,Wt as ge,X as _e,Xn as U,Xt as ve,Y as ye,Yt as W,Z as be,Zn as xe,Zt as Se,_n as G,_t as K,a as Ce,b as we,bn as q,c as Te,cn as Ee,ct as De,d as Oe,en as ke,et as Ae,f as je,fn as Me,g as Ne,gt as J,h as Pe,hn as Fe,ht as Ie,i as Le,in as Re,it as ze,jt as Be,kn as Ve,kt as He,lt as Ue,m as We,mn as Ge,mt as Ke,n as qe,nn as Je,nr as Y,o as Ye,on as Xe,ot as Ze,p as Qe,pt as $e,q as et,qt as tt,r as nt,rn as rt,rr as it,rt as at,s as ot,sn as st,st as ct,t as lt,tn as ut,tr as X,tt as dt,u as ft,ut as pt,vn as mt,w as ht,wt as gt,x as _t,xn as vt,xt as yt,y as bt,yn as xt,z as St,zn as Ct}from"./spinner-BCEaGbib.js";import{t as wt}from"./WorkspaceLauncher-CDtnv1IK.js";import{t as Tt}from"./bot-wH0FKlic.js";import{t as Et}from"./chevron-down-DDmhvRLr.js";import{a as Dt,c as Ot,i as kt,l as At,n as jt,o as Mt,r as Nt,s as Pt,t as Ft,u as It}from"./terminal-D1awFRPr.js";import{t as Lt}from"./zap-DhYfYRlq.js";import{t as Rt}from"./cpu-CPUNnHRM.js";import{t as zt}from"./search-ChVovkOL.js";import{t as Bt}from"./trash-2-Da8F2gKd.js";import{_ as Vt,a as Ht,c as Ut,d as Wt,f as Gt,i as Kt,l as qt,m as Jt,n as Yt,o as Xt,p as Zt,r as Qt,s as $t,u as en,v as tn,x as nn,y as rn}from"./useCompositeListItem-CZnlZ-eF.js";import{t as an}from"./Separator-Chx6O62Y.js";import{B as on,Ct as sn,Dt as cn,Et as ln,F as un,I as dn,L as fn,Mt as pn,Nt as mn,O as hn,Ot as gn,P as _n,Q as vn,R as yn,Tt as bn,X as xn,_t as Sn,a as Cn,at as wn,bt as Tn,c as En,dt as Dn,ft as On,g as kn,gt as An,h as jn,ht as Mn,i as Nn,it as Pn,jt as Fn,kt as In,l as Ln,lt as Rn,m as zn,o as Bn,ot as Vn,p as Hn,s as Un,u as Wn,wt as Gn,xt as Kn,yt as qn}from"./index-ofoYKpCG.js";import{t as Jn}from"./badge-BnkhqVEF.js";import{t as Yn}from"./card-82INhRRE.js";import{a as Xn,i as Zn,n as Qn,r as $n,t as er}from"./empty-DWyDwDYB.js";import{t as tr}from"./textarea-D3-elOAa.js";import{t as nr}from"./skeleton-CCPbfn1L.js";var rr=a(`columns-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M12 3v18`,key:`108xh3`}]]),ir=a(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),ar=a(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),or=a(`layout-template`,[[`rect`,{width:`18`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`f1a2em`}],[`rect`,{width:`9`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`jqznyg`}],[`rect`,{width:`5`,height:`7`,x:`16`,y:`14`,rx:`1`,key:`q5h2i8`}]]),sr=a(`list-ordered`,[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]),cr=a(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),lr=a(`message-square-code`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`m10 8-3 3 3 3`,key:`fp6dz7`}],[`path`,{d:`m14 14 3-3-3-3`,key:`1yrceu`}]]),ur=a(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),dr=a(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]),fr=a(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),pr=a(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),mr=a(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),hr=a(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),gr=a(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),_r=a(`square-play`,[[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z`,key:`kmsa83`}]]),Z=n(e(),1);function vr(){let[,e]=Z.useState({});return Z.useCallback(()=>{e({})},[])}function yr(e,t){return t!=null&&!Ee(t)?0:typeof e==`function`?e():e}function br(e,t,n){let r=yr(e,n);return typeof r==`number`?r:r?.[t]}function xr(e){return typeof e==`function`?e():e}function Sr(e,t){return t||e===`click`||e===`mousedown`}function Cr(e){return e?.includes(`mouse`)&&e!==`mousedown`}var wr=Ve&&w;function Tr(e,t={}){let{enabled:n=!0,delay:r}=t,i=`rootStore`in e?e.rootStore:e,{events:a,dataRef:o}=i.context,s=Z.useRef(!1),c=Z.useRef(null),l=Z.useRef(!0),u=ve();Z.useEffect(()=>{let e=i.select(`domReferenceElement`);if(!n)return;let t=b(e);function r(){let e=i.select(`domReferenceElement`);!i.select(`open`)&&fe(e)&&e===xt(_(e))&&(s.current=!0)}function a(){l.current=!0}function o(){l.current=!1}return Ue(De(t,`blur`,r),wr&&De(t,`keydown`,a,!0),wr&&De(t,`pointerdown`,o,!0))},[i,n]),Z.useEffect(()=>{if(!n)return;function e(e){if(e.reason===`trigger-press`||e.reason===`escape-key`){let e=i.select(`domReferenceElement`);A(e)&&(c.current=e,s.current=!0)}}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[a,n,i]);let d=Z.useMemo(()=>{function e(){s.current=!1,c.current=null}return{onMouseLeave(){e()},onFocus(t){let n=t.currentTarget;if(s.current){if(c.current===n)return;e()}let a=vt(t.nativeEvent);if(A(a)){if(wr&&!t.relatedTarget){if(!l.current&&!G(a))return}else if(!mt(a))return}let o=Fe(t.relatedTarget,i.context.triggerElements),{nativeEvent:d,currentTarget:f}=t,p=typeof r==`function`?r():r;if(i.select(`open`)&&o||p===0||p===void 0){i.setOpen(!0,S(ne,d,f));return}u.start(p,()=>{s.current||i.setOpen(!0,S(ne,d,f))})},onBlur(t){e();let n=t.relatedTarget,r=t.nativeEvent,a=A(n)&&n.hasAttribute(Ze(`focus-guard`))&&n.getAttribute(`data-type`)===`outside`;u.start(0,()=>{let e=i.select(`domReferenceElement`),t=xt(_(e));!n&&t===e||q(o.current.floatingContext?.refs.floating.current,t)||q(e,t)||a||Fe(n??t,i.context.triggerElements)||i.setOpen(!1,S(ne,r))})}}},[o,r,i,u]);return Z.useMemo(()=>n?{reference:d,trigger:d}:{},[n,d])}var Er=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new W,this.restTimeout=new W,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},Dr=new WeakMap;function Or(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&Dr.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),Dr.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function kr(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=Dr.get(n);a&&a!==e&&Or(a),Or(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,Dr.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function Ar(e){let t=e.context.dataRef.current,n=p(()=>t.hoverInteractionState??Er.create()).current;return t.hoverInteractionState||=n,Se(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function jr(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=`rootStore`in e?e.rootStore:e,o=a.useState(`open`),s=a.useState(`floatingElement`),c=a.useState(`domReferenceElement`),{dataRef:l}=a.context,u=z(),d=be(),f=Ar(a),p=ve(),m=X(()=>Sr(l.current.openEvent?.type,f.interactedInside)),h=X(()=>Cr(l.current.openEvent?.type)),g=X(()=>{Or(f)});Y(()=>{o||(f.pointerType=void 0,f.restTimeoutPending=!1,f.interactedInside=!1,g())},[o,f,g]),Z.useEffect(()=>g,[g]),Y(()=>{if(n&&o&&f.handleCloseOptions?.blockPointerEvents&&h()&&A(c)&&s){let e=c,t=s,n=_(s),r=u?.nodesRef.current.find(e=>e.id===d)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=f.pointerEventsScopeElement===t?null:f.pointerEventsScopeElement,a=r===t?null:r,o=f.handleCloseOptions?.getScope?.()??i??a??e.closest(`[data-rootownerid]`)??n.body;return kr(f,{scopeElement:o,referenceElement:e,floatingElement:t}),()=>{g()}}},[n,o,c,s,f,h,u,d,g]),Z.useEffect(()=>{if(!n)return;function e(){return!!(u&&d&&Me(u.nodesRef.current,d).length>0)}function t(e){let t=br(r,`close`,f.pointerType),n=()=>{a.setOpen(!1,S(V,e)),u?.events.emit(`floating.closed`,e)};t?f.openChangeTimeout.start(t,n):(f.openChangeTimeout.clear(),n())}function o(e){let t=vt(e);if(!Ge(t)){f.interactedInside=!1;return}f.interactedInside=t?.closest(`[aria-haspopup]`)!=null}function c(){f.openChangeTimeout.clear(),p.clear(),u?.events.off(`floating.closed`,v),g()}function _(n){if(e()&&u){u.events.on(`floating.closed`,v);return}if(Fe(n.relatedTarget,a.context.triggerElements))return;let r=l.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(u&&r&&A(o)&&Me(u.nodesRef.current,r,!1).some(e=>q(e.context?.elements.floating,o)))){if(f.handler){f.handler(n);return}g(),h()&&!m()&&t(n)}}function v(t){!u||!d||e()||p.start(0,()=>{u.events.off(`floating.closed`,v),a.setOpen(!1,S(V,t)),u.events.emit(`floating.closed`,t)})}let y=s;return Ue(y&&De(y,`mouseenter`,c),y&&De(y,`mouseleave`,_),y&&De(y,`pointerdown`,o,!0),()=>{u?.events.off(`floating.closed`,v)})},[n,s,a,l,r,i,h,m,g,f,u,d,p])}var Mr=n(it(),1),Nr={current:null};function Pr(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=Nr,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p}=t,m=`rootStore`in e?e.rootStore:e,{dataRef:h,events:g}=m.context,v=z(l),y=Ar(m),b=Z.useRef(!1),x=K(i),C=K(r),w=K(o),T=K(n),E=K(p),D=K(f),O=X(()=>Sr(h.current.openEvent?.type,y.interactedInside)),k=X(()=>E.current?.()!==!1),j=X((e,t,n)=>{let r=m.context.triggerElements;if(r.hasElement(t))return!e||!q(e,t);if(!A(n))return!1;let i=n;return r.hasMatchingElement(e=>q(e,i))&&(!e||!q(e,i))}),M=X(()=>{y.handler&&=(_(m.select(`domReferenceElement`)).removeEventListener(`mousemove`,y.handler),void 0)}),N=X(()=>{Or(y)});return u&&(y.handleCloseOptions=x.current?.__options),Z.useEffect(()=>M,[M]),Z.useEffect(()=>{if(!n)return;function e(e){e.open?b.current=!1:(b.current=e.reason===V,M(),y.openChangeTimeout.clear(),y.restTimeout.clear(),y.blockMouseMove=!0,y.restTimeoutPending=!1)}return g.on(`openchange`,e),()=>{g.off(`openchange`,e)}},[n,g,y,M]),Z.useEffect(()=>{if(!n)return;function e(e,t=!0){let n=br(C.current,`close`,y.pointerType);n?y.openChangeTimeout.start(n,()=>{m.setOpen(!1,S(V,e)),v?.events.emit(`floating.closed`,e)}):t&&(y.openChangeTimeout.clear(),m.setOpen(!1,S(V,e)),v?.events.emit(`floating.closed`,e))}let t=c.current??(u?m.select(`domReferenceElement`):null);if(!A(t))return;function r(e){if(y.openChangeTimeout.clear(),y.blockMouseMove=!1,a&&!Ee(y.pointerType))return;let t=xr(w.current),n=br(C.current,`open`,y.pointerType),r=vt(e),i=e.currentTarget??null,o=m.select(`domReferenceElement`),s=i;if(A(r)&&!m.context.triggerElements.hasElement(r)){for(let e of m.context.triggerElements.elements())if(q(e,r)){s=e;break}}A(i)&&A(o)&&!m.context.triggerElements.hasElement(i)&&q(i,o)&&(s=o);let c=s!=null&&j(o,s,r),l=m.select(`open`),u=D.current?.()??m.select(`transitionStatus`)===`ending`,d=!l&&u&&b.current,f=!c&&A(s)&&A(o)&&q(o,s)&&d,p=t>0&&!n,h=c&&(l||d)||f,g=!l||c;if(h){k()&&m.setOpen(!0,S(V,e,s));return}p||(n?y.openChangeTimeout.start(n,()=>{g&&k()&&m.setOpen(!0,S(V,e,s))}):g&&k()&&m.setOpen(!0,S(V,e,s)))}function i(t){if(O()){N();return}M();let n=_(m.select(`domReferenceElement`));y.restTimeout.clear(),y.restTimeoutPending=!1;let r=h.current.floatingContext??d?.();if(!Fe(t.relatedTarget,m.context.triggerElements)){if(x.current&&r){m.select(`open`)||y.openChangeTimeout.clear();let i=c.current;y.handler=x.current({...r,tree:v,x:t.clientX,y:t.clientY,onClose(){N(),M(),T.current&&!O()&&i===m.select(`domReferenceElement`)&&e(t,!0)}}),n.addEventListener(`mousemove`,y.handler),y.handler(t);return}(y.pointerType!==`touch`||!q(m.select(`floatingElement`),t.relatedTarget))&&e(t)}}return s?Ue(De(t,`mousemove`,r,{once:!0}),De(t,`mouseenter`,r),De(t,`mouseleave`,i)):Ue(De(t,`mouseenter`,r),De(t,`mouseleave`,i))},[M,N,h,C,m,n,x,y,u,j,O,a,s,w,c,v,T,d,D,k]),Z.useMemo(()=>{if(!n)return;function e(e){y.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,n=e.currentTarget,r=m.select(`domReferenceElement`),i=m.select(`open`),o=j(r,n,e.target);if(a&&!Ee(y.pointerType))return;if(i&&o&&y.handleCloseOptions?.blockPointerEvents){let e=m.select(`floatingElement`);if(e){let t=y.handleCloseOptions?.getScope?.()??n.ownerDocument.body;kr(y,{scopeElement:t,referenceElement:n,floatingElement:e})}}let s=xr(w.current);if(i&&!o||s===0||!o&&y.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;y.restTimeout.clear();function c(){if(y.restTimeoutPending=!1,O())return;let e=m.select(`open`);!y.blockMouseMove&&(!e||o)&&k()&&m.setOpen(!0,S(V,t,n))}y.pointerType===`touch`?Mr.flushSync(()=>{c()}):o&&i?c():(y.restTimeoutPending=!0,y.restTimeout.start(s,c))}}},[n,y,O,j,a,m,w,k])}var Fr=.1,Ir=Fr*Fr,Q=.5;function Lr(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function Rr(e,t,n,r,i,a,o,s,c,l){let u=!1;return Lr(e,t,n,r,i,a)&&(u=!u),Lr(e,t,i,a,o,s)&&(u=!u),Lr(e,t,o,s,c,l)&&(u=!u),Lr(e,t,c,l,n,r)&&(u=!u),u}function zr(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function Br(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function Vr(e={}){let{blockPointerEvents:t=!1}=e,n=new W,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*Ir;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=vt(r),g=r.type===`mouseleave`,_=q(u,h),v=q(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&A(r.relatedTarget)&&q(u,r.relatedTarget))return;function y(){return!!(s&&Me(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,j=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let M=!1;switch(c){case`top`:M=Br(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:M=Br(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:M=Br(d,f,S.right-1,j,x.left+1,k);break;case`right`:M=Br(d,f,x.right-1,j,S.left+1,k);break;default:}if(M)return;if(l&&!zr(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let N=!1;switch(c){case`top`:{let n=T?Q/2:Q*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+Q+1,o=C||T?S.bottom-Q:S.top,s=C?T?S.bottom-Q:S.top:S.bottom-Q;N=Rr(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?Q/2:Q*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-Q,o=C||T?S.top+Q:S.bottom,s=C?T?S.top+Q:S.bottom:S.top+Q;N=Rr(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?Q/2:Q*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+Q+1,o=w||E?S.right-Q:S.left,s=w?E?S.right-Q:S.left:S.right-Q;N=Rr(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?Q/2:Q*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-Q,o=w||E?S.left+Q:S.right,s=w?E?S.left+Q:S.right:S.left+Q;N=Rr(d,f,a,r,a,i,o,S.top,s,S.bottom);break}default:}N?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}var Hr=Z.createContext(void 0);function Ur(e){let t=Z.useContext(Hr);if(t===void 0&&!e)throw Error(r(33));return t}var Wr=Z.createContext(void 0);function Gr(e){let t=Z.useContext(Wr);if(t===void 0&&!e)throw Error(r(36));return t}var Kr=Z.createContext(void 0);function qr(e=!0){let t=Z.useContext(Kr);if(t===void 0&&!e)throw Error(r(25));return t}function Jr(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,{events:l}=a.useState(`floatingTreeRoot`),u=a.useState(`open`),d=qr(!0),f=d!==void 0;return Z.useMemo(()=>({id:r,role:`menuitem`,tabIndex:u&&n?0:-1,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&l.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&l.emit(`close`,{domEvent:e,reason:Be})},onMouseUp(e){if(d){let t=d.initialCursorPointRef.current;if(d.initialCursorPointRef.current=null,f&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||f&&!Ve&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!f||e.button===2)&&(!c||c.type===`regular-item`)&&s.current.click()}}),[t,n,r,l,i,u,a,o,s,d,f,c])}var Yr={type:`regular-item`};function Xr(e){let{closeOnClick:t,disabled:n=!1,highlighted:r,id:i,store:a,typingRef:o=a.context.typingRef,nativeButton:c,itemMetadata:l,nodeId:d}=e,f=a.useState(`disabled`),p=n||f,m=Z.useRef(null),{getButtonProps:h,buttonRef:g}=ue({disabled:p,focusableWhenDisabled:!0,native:c,composite:!0}),_=Jr({closeOnClick:t,highlighted:r,id:i,nodeId:d,store:a,typingRef:o,itemRef:m,itemMetadata:l}),v=Z.useCallback(e=>u(_,{onMouseEnter(){l.type===`submenu-trigger`&&l.setActive()}},e,h),[_,h,l]),y=s(m,g);return Z.useMemo(()=>({getItemProps:v,itemRef:y}),[v,y])}var Zr=Z.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:s=!1,disabled:c=!1,closeOnClick:l=!0,style:u,...d}=e,f=Yt({label:a}),p=Ur(!0),m=U(i),{store:h}=Gr(),g=h.useState(`isActive`,f.index),_=h.useState(`itemProps`),{getItemProps:v,itemRef:y}=Xr({closeOnClick:l,disabled:c,highlighted:g,id:m,store:h,nativeButton:s,nodeId:p?.context.nodeId,itemMetadata:Yr});return o(`div`,e,{state:{disabled:c,highlighted:g},props:[_,d,v],ref:[y,t,f.ref]})}),$=i(),Qr={...T,...tt},$r=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...s}=e,{store:c}=Gr(),{side:l,align:u}=Ur(),d=Qt(!0)!=null,f=c.useState(`open`),p=c.useState(`transitionStatus`),m=c.useState(`popupProps`),h=c.useState(`mounted`),g=c.useState(`instantType`),_=c.useState(`activeTriggerElement`),v=c.useState(`parent`),y=c.useState(`lastOpenChangeReason`),b=c.useState(`rootId`),x=c.useState(`floatingRootContext`),C=c.useState(`floatingTreeRoot`),w=c.useState(`closeDelay`),T=c.useState(`activeTriggerElement`),E=c.useState(`hoverEnabled`),D=c.useState(`disabled`),O=c.useState(`openMethod`),k=v.type===`context-menu`;ge({open:f,ref:c.context.popupRef,onComplete(){f&&c.context.onOpenChangeComplete?.(!0)}}),Z.useEffect(()=>{function e(e){c.setOpen(!1,S(e.reason,e.domEvent))}return C.events.on(`close`,e),()=>{C.events.off(`close`,e)}},[C.events,c]),jr(x,{enabled:E&&!D&&!k&&v.type!==`menubar`,closeDelay:w});let A=Z.useCallback(e=>{c.set(`popupElement`,e)},[c]),j=o(`div`,e,{state:{transitionStatus:p,side:l,align:u,open:f,nested:v.type===`menu`,instant:g},ref:[t,c.context.popupRef,A],stateAttributesMapping:Qr,props:[m,{onKeyDown(e){d&&Te.has(e.key)&&e.stopPropagation()}},Xt(p),s,{"data-rootownerid":b}]}),M=v.type===void 0||k;return(_||v.type===`menubar`&&y!==`outside-press`)&&(M=!0),(0,$.jsx)(et,{context:x,openInteractionType:O,modal:k,disabled:!h,returnFocus:a===void 0?M:a,initialFocus:v.type!==`menu`,restoreFocus:!0,externalTree:v.type===`menubar`?void 0:C,previousFocusableElement:T,nextFocusableElement:v.type===void 0?c.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:v.type===void 0?c.context.beforeContentFocusGuardRef:void 0,children:j})}),ei=Z.createContext(void 0);function ti(){let e=Z.useContext(ei);if(e===void 0)throw Error(r(32));return e}var ni=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Gr();return i.useState(`mounted`)||n?(0,$.jsx)(ei.Provider,{value:n,children:(0,$.jsx)(Ae,{ref:t,...r})}):null}),ri=Z.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=at,style:g,..._}=e,{store:v}=Gr(),y=ti(),b=qr(!0),x=v.useState(`parent`),C=v.useState(`floatingRootContext`),w=v.useState(`floatingTreeRoot`),T=v.useState(`mounted`),E=v.useState(`open`),D=v.useState(`modal`),k=v.useState(`openMethod`),A=v.useState(`activeTriggerElement`),j=v.useState(`transitionStatus`),M=v.useState(`positionerElement`),F=v.useState(`instantType`),ee=v.useState(`hasViewport`),I=v.useState(`lastOpenChangeReason`),te=v.useState(`floatingNodeId`),ne=v.useState(`floatingParentNodeId`),re=C.useState(`domReferenceElement`),L=Z.useRef(null),ie=O(M,!1,!1),ae=n,R=c,oe=l,se=s,ce=h;x.type===`context-menu`&&(ae=n??x.context?.anchor,se??=`start`,!o&&se!==`center`&&(oe=e.alignOffset??2,R=e.sideOffset??-5));let z=o,B=se;x.type===`menu`?(z??=`inline-end`,B??=`start`,ce=e.collisionAvoidance??ze):x.type===`menubar`&&(z??=x.context.orientation===`vertical`?`inline-end`:`bottom`,B??=`start`);let le=x.type===`context-menu`,V=$t({anchor:ae,floatingRootContext:C,positionMethod:b?`fixed`:r,mounted:T,side:z,sideOffset:R,align:B,alignOffset:oe,arrowPadding:le?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:te,keepMounted:y,disableAnchorTracking:m,collisionAvoidance:ce,shiftCrossAxis:le&&!(`side`in ce&&ce.side===`flip`),externalTree:w,adaptiveOrigin:ee?Ut:void 0});Z.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===te&&v.set(`hoverEnabled`,!1),e.nodeId!==te&&e.parentNodeId===v.select(`floatingParentNodeId`)&&v.setOpen(!1,S(N)))}return w.events.on(`menuopenchange`,e),()=>{w.events.off(`menuopenchange`,e)}},[v,w.events,te]),Z.useEffect(()=>{if(v.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==v.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;v.setOpen(!1,S(t))}return w.events.on(`menuopenchange`,e),()=>{w.events.off(`menuopenchange`,e)}},[w.events,v]);let ue=ve();Z.useEffect(()=>{E||ue.clear()},[E,ue]),Z.useEffect(()=>{function e(e){if(!(!E||e.nodeId!==v.select(`floatingParentNodeId`)))if(e.target&&A&&A!==e.target){let e=v.select(`closeDelay`);e>0?ue.isStarted()||ue.start(e,()=>{v.setOpen(!1,S(N))}):v.setOpen(!1,S(N))}else ue.clear()}return w.events.on(`itemhover`,e),()=>{w.events.off(`itemhover`,e)}},[w.events,E,A,v,ue]),Z.useEffect(()=>{let e={open:E,nodeId:te,parentNodeId:ne,reason:v.select(`lastOpenChangeReason`)};w.events.emit(`menuopenchange`,e)},[w.events,E,v,te,ne]),Y(()=>{let e=re,t=L.current;if(e&&(L.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return ie(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[re,ie,v]);let de={open:E,side:V.side,align:V.align,anchorHidden:V.anchorHidden,nested:x.type===`menu`,instant:F},fe=x.type===`menubar`&&x.context.modal;Kt(E&&(fe||D&&I!==`trigger-hover`),k===`touch`,M,A);let pe=Ht(e,de,{styles:V.positionerStyles,transitionStatus:j,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!T,inert:!E}),H=T&&x.type!==`menu`&&(x.type!==`menubar`&&D&&I!==`trigger-hover`||x.type===`menubar`&&x.context.modal),me=null;return x.type===`menubar`?me=x.context.contentElement:x.type===void 0&&(me=A),(0,$.jsxs)(Hr.Provider,{value:V,children:[H&&(0,$.jsx)(bt,{ref:x.type===`context-menu`||x.type===`nested-context-menu`?x.context.internalBackdropRef:null,inert:_t(!E),cutout:me}),(0,$.jsx)(P,{id:te,children:(0,$.jsx)(qt,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:pe})})]})}),ii=Z.createContext(null);function ai(e){let t=Z.useContext(ii);if(t===null&&!e)throw Error(r(5));return t}var oi={...dn,disabled:J(e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled),modal:J(e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0)),openMethod:J(e=>e.openMethod),allowMouseEnter:J(e=>e.allowMouseEnter),highlightItemOnHover:J(e=>e.highlightItemOnHover),stickIfOpen:J(e=>e.stickIfOpen),parent:J(e=>e.parent),rootId:J(e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId),activeIndex:J(e=>e.activeIndex),isActive:J((e,t)=>e.activeIndex===t),hoverEnabled:J(e=>e.hoverEnabled),instantType:J(e=>e.instantType),lastOpenChangeReason:J(e=>e.openChangeReason),floatingTreeRoot:J(e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot),floatingNodeId:J(e=>e.floatingNodeId),floatingParentNodeId:J(e=>e.floatingParentNodeId),itemProps:J(e=>e.itemProps),closeDelay:J(e=>e.closeDelay),hasViewport:J(e=>e.hasViewport),keyboardEventRelay:J(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)})},si=class e extends pt{constructor(e){super({...ci(),...e},{positionerRef:Z.createRef(),popupRef:Z.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:Z.createRef(),beforeContentFocusGuardRef:Z.createRef(),onOpenChangeComplete:void 0,triggerElements:new re},oi),this.unsubscribeParentListener=this.observe(`parent`,e=>{if(this.unsubscribeParentListener?.(),e.type===`menu`){let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);this.unsubscribeParentListener=e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);t===i&&n===a&&r===o||(t=i,n=a,r=o,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef;return}e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}static useStore(t,n){let r=p(()=>new e(n)).current;return t??r}unsubscribeParentListener=null};function ci(){return{..._n(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new h,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:l,keyboardEventRelay:void 0,closeDelay:0,hasViewport:!1}}var li=Z.createContext(void 0);function ui(){return Z.useContext(li)}var di=$e(function(e){let{children:n,open:r,onOpenChange:i,onOpenChangeComplete:a,defaultOpen:o=!1,disabled:s=!1,modal:c,loopFocus:d=!0,orientation:f=`vertical`,actionsRef:p,closeParentOnEsc:m=!1,handle:h,triggerId:g,defaultTriggerId:_=null,highlightItemOnHover:v=!0}=e,b=qr(!0),x=Gr(!0),C=ai(!0),w=ui(),T=Z.useMemo(()=>w&&x?{type:`menu`,store:x.store}:C?{type:`menubar`,context:C}:b&&!x?{type:`context-menu`,context:b}:{type:void 0},[b,x,C,w]),E=si.useStore(h?.store,{open:o,openProp:r,activeTriggerId:_,triggerIdProp:g,parent:T});le(E,r,o,_),E.useControlledProp(`openProp`,r),E.useControlledProp(`triggerIdProp`,g),E.useContextCallback(`onOpenChangeComplete`,a);let D=xe(),O=xe(),k=E.useState(`floatingTreeRoot`),A=_e(k),j=be(),N=E.useState(`open`),P=E.useState(`activeTriggerElement`),F=E.useState(`positionerElement`),I=E.useState(`hoverEnabled`),ne=E.useState(`disabled`),re=E.useState(`lastOpenChangeReason`),L=E.useState(`parent`),ae=E.useState(`activeIndex`),R=E.useState(`payload`),oe=E.useState(`floatingParentNodeId`),ce=Z.useRef(null),z=Z.useRef(L.type!==`context-menu`),B=ve(),V=Z.useRef(!0),ue=ve(),de=oe!=null,{openMethod:fe,triggerProps:pe}=Wt(N);E.useSyncedValues({disabled:s,highlightItemOnHover:v,modal:L.type===void 0?c:void 0,openMethod:fe,rootId:D}),te(E);let{forceUnmount:H}=St(N,E,()=>{E.update({allowMouseEnter:!1,stickIfOpen:!0})});Y(()=>{b&&!x?E.update({parent:{type:`context-menu`,context:b},floatingNodeId:A,floatingParentNodeId:j}):x&&E.update({floatingNodeId:A,floatingParentNodeId:j})},[b,x,A,j,E]),Z.useEffect(()=>{if(N||(ce.current=null),L.type===`context-menu`){if(!N){B.clear(),z.current=!1;return}B.start(500,()=>{z.current=!0})}},[B,N,L.type]),Y(()=>{!N&&!I&&E.set(`hoverEnabled`,!0)},[N,I,E]);let he=X((e,t)=>{let n=t.reason;if(N===e&&t.trigger===P&&re===n)return;let r=se(t);if(!e&&t.trigger==null&&(t.trigger=P??void 0),i?.(e,t),t.isCanceled)return;E.state.floatingRootContext.dispatchOpenChange(e,t);let a=t.event;if(e===!1&&a?.type===`click`&&a.pointerType===`touch`&&!V.current)return;e&&n===`trigger-focus`?(V.current=!1,ue.start(300,()=>{V.current=!0})):(V.current=!0,ue.clear());let o=(n===`trigger-press`||n===`item-press`)&&a.detail===0&&a?.isTrusted,s=!e&&(n===`escape-key`||n==null),c={open:e,openChangeReason:n};ce.current=t.event??null,M(c,e,t.trigger,r()),E.update(c),L.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?E.set(`instantType`,`group`):o||s?E.set(`instantType`,o?`click`:`dismiss`):E.set(`instantType`,void 0)}),ge=me({popupStore:E,floatingId:O,nested:j!=null,onOpenChange:he}),U=ge.context.events;Z.useEffect(()=>{let e=({open:e,eventDetails:t})=>he(e,t);return U.on(`setOpen`,e),()=>{U?.off(`setOpen`,e)}},[U,he]);let W=Z.useCallback(()=>{E.setOpen(!1,S(He))},[E]);Z.useImperativeHandle(p,()=>({unmount:H,close:W}),[H,W]);let Se;L.type===`context-menu`&&(Se=L.context),Z.useImperativeHandle(Se?.positionerRef,()=>F,[F]),Z.useImperativeHandle(Se?.actionsRef,()=>({setOpen:he}),[he]);let G=ee(ge,{enabled:!ne,bubbles:{escapeKey:m&&L.type===`menu`},outsidePress(){return L.type!==`context-menu`||ce.current?.type===`contextmenu`||z.current},externalTree:de?k:void 0}),K=we(),Ce=Z.useCallback(e=>{E.select(`activeIndex`)!==e&&E.set(`activeIndex`,e)},[E]),q=Jt(ge,{enabled:!ne,listRef:E.context.itemDomElements,activeIndex:ae,nested:L.type!==void 0,loopFocus:d,orientation:f,parentOrientation:L.type===`menubar`?L.context.orientation:void 0,rtl:K===`rtl`,disabledIndices:t,onNavigate:Ce,openOnArrowKeyDown:L.type!==`context-menu`,externalTree:de?k:void 0,focusItemOnHover:v}),Te=Z.useCallback(e=>{E.context.typingRef.current=e},[E]),Ee=Zt(ge,{enabled:!ne,listRef:E.context.itemLabels,elementsRef:E.context.itemDomElements,activeIndex:ae,resetMs:500,onMatch:e=>{N&&e!==ae&&E.set(`activeIndex`,e)},onTyping:Te});y(E,{floatingRootContext:ge,activeTriggerProps:Z.useMemo(()=>{let e=u(Ee.reference,q.reference,G.reference,{onMouseMove(){E.set(`allowMouseEnter`,!0)}},pe);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=N,e},[E,Ee.reference,q.reference,G.reference,pe,N]),inactiveTriggerProps:Z.useMemo(()=>{let e=u(q.trigger,G.trigger,pe);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[q.trigger,G.trigger,pe]),popupProps:Z.useMemo(()=>u(ie,{id:O,role:`menu`,"aria-labelledby":P?.id,onMouseMove(){E.set(`allowMouseEnter`,!0),L.type===`menu`&&E.set(`hoverEnabled`,!1)},onClick(){E.select(`hoverEnabled`)&&E.set(`hoverEnabled`,!1)},onKeyDown(e){let t=E.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},Ee.floating,q.floating,G.floating),[P,O,L.type,E,Ee.floating,q.floating,G.floating]),itemProps:q.item??l});let De=Z.useMemo(()=>({store:E,parent:T}),[E,T]),Oe=(0,$.jsx)(Wr.Provider,{value:De,children:typeof n==`function`?n({payload:R}):n});return L.type===void 0||L.type===`context-menu`?(0,$.jsx)(ye,{externalTree:k,children:Oe}):Oe});function fi(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=ht(),{ref:i,index:a}=Yt(e),o=n===a,c=Z.useRef(null),l=s(i,c);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=c.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:l,index:a}}function pi(e){let{render:n,className:r,style:i,state:a=l,props:s=t,refs:c=t,metadata:u,stateAttributesMapping:d,tag:f=`div`,...p}=e,{compositeProps:m,compositeRef:h}=fi({metadata:u});return o(f,e,{state:a,ref:[...c,h],props:[m,...s,p],stateAttributesMapping:d})}function mi(e){if(fe(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`)??void 0;if(!he(e))return mi(Ct(e))}function hi(e,t){let n=Z.useRef(null);function r(t){Mr.flushSync(()=>{e.setOpen(!1,S(oe,t.nativeEvent,t.currentTarget))}),ke(n.current)?.focus()}function i(n){let r=e.select(`positionerElement`);if(r&&ut(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{Mr.flushSync(()=>{e.setOpen(!1,S(oe,n.nativeEvent,n.currentTarget))});let i=g(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&q(r,i);){let e=i;if(i=B(i),i===e)break}i?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function gi(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=Z.useRef(!1);return Z.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,_(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:l,[t,n,r])}var _i=2,vi=Ke(function(e,t){let{render:n,className:i,style:a,disabled:s=!1,nativeButton:c=!0,id:d,openOnHover:f,delay:p=100,closeDelay:m=0,handle:g,payload:v,...y}=e,b=Gr(!0),x=g?.store??b?.store;if(!x)throw Error(r(85));let S=U(d),w=x.useState(`isTriggerActive`,S),T=x.useState(`floatingRootContext`),E=x.useState(`isOpenedByTrigger`,S),D=x.useState(`triggerPopupId`,S),O=Z.useRef(null),k=bi(),A=ht(!0),j=z(),M=Z.useMemo(()=>j??new h,[j]),{registerTrigger:N,isMountedByThisTrigger:P}=de(S,O,x,{payload:v,closeDelay:m,parent:k,floatingTreeRoot:M,floatingNodeId:_e(M),floatingParentNodeId:be(),keyboardEventRelay:A?.relayKeyboardEvent}),F=k.type===`menubar`,ee=x.useState(`disabled`),I=s||ee||F&&k.context.disabled,{getButtonProps:te,buttonRef:ne}=ue({disabled:I,native:c});Z.useEffect(()=>{!E&&k.type===void 0&&(x.context.allowMouseUpTriggerRef.current=!1)},[x,E,k.type]);let re=Z.useRef(null),L=ve(),ie=X(e=>{if(!re.current)return;L.clear(),x.context.allowMouseUpTriggerRef.current=!1;let t=e.target;if(q(re.current,t)||q(x.select(`positionerElement`),t)||t===re.current||t!=null&&mi(t)===x.select(`rootId`))return;let n=en(re.current);e.clientX>=n.left-_i&&e.clientX<=n.right+_i&&e.clientY>=n.top-_i&&e.clientY<=n.bottom+_i||M.events.emit(`close`,{domEvent:e,reason:gt})});Z.useEffect(()=>{E&&x.select(`lastOpenChangeReason`)===`trigger-hover`&&_(re.current).addEventListener(`mouseup`,ie,{once:!0})},[E,ie,x]);let ae=F&&k.context.hasSubmenuOpen,R=Pr(T,{enabled:(f??ae)&&!I&&k.type!==`context-menu`&&(!F||ae&&!P),handleClose:Vr({blockPointerEvents:!F}),mouseOnly:!0,move:!1,restMs:k.type===void 0?p:void 0,delay:{close:m},triggerElementRef:O,externalTree:M,isActiveTrigger:w,isClosing:()=>x.select(`transitionStatus`)===`ending`}),oe=yi(E,x.select(`lastOpenChangeReason`)),se=Vt(T,{enabled:!I&&k.type!==`context-menu`,event:E&&F?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:k.type===void 0&&oe}),ce=Tr(T,{enabled:!I&&ae}),B=gi({open:E,enabled:F,mouseDownAction:`open`}),le=Z.useMemo(()=>u(ce.reference,se.reference),[ce.reference,se.reference]),V=x.useState(`triggerProps`,P),{preFocusGuardRef:fe,handlePreFocusGuardFocus:pe,handleFocusTargetFocus:H}=hi(x,O),me={disabled:I,open:E},he=[re,t,ne,N,O],ge=[le,R??l,V,{"aria-haspopup":`menu`,"aria-controls":D,id:S,onMouseDown:e=>{x.select(`open`)||(L.start(200,()=>{x.context.allowMouseUpTriggerRef.current=!0}),_(e.currentTarget).addEventListener(`mouseup`,ie,{once:!0}))}},F?{role:`menuitem`}:{},B,y,te],ye=o(`button`,e,{enabled:!F,stateAttributesMapping:C,state:me,ref:he,props:ge});return F?(0,$.jsx)(pi,{tag:`button`,render:n,className:i,style:a,state:me,refs:he,props:ge,stateAttributesMapping:C}):E?(0,$.jsxs)(Z.Fragment,{children:[(0,$.jsx)(ct,{ref:fe,onFocus:pe},`${S}-pre-focus-guard`),(0,$.jsx)(Z.Fragment,{children:ye},S),(0,$.jsx)(ct,{ref:x.context.triggerFocusTargetRef,onFocus:H},`${S}-post-focus-guard`)]}):(0,$.jsx)(Z.Fragment,{children:ye},S)});function yi(e,t){let n=ve(),[r,i]=Z.useState(!1);return Y(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function bi(){let e=qr(!0),t=Gr(!0),n=ai(!0);return Z.useMemo(()=>n?{type:`menubar`,context:n}:e&&!t?{type:`context-menu`,context:e}:{type:void 0},[e,t,n])}function xi(e){let t=L(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=fe(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r;return(nn(n)!==a||nn(r)!==o)&&(n=a,r=o),{width:n,height:r}}function Si(e){let{popupElement:t,positionerElement:n,content:r,mounted:i,onMeasureLayout:a,onMeasureLayoutComplete:o,side:s,direction:c}=e,u=O(t,!0,!1),f=F(),p=Z.useRef(null),m=Z.useRef(!0),h=Z.useRef(d),g=X(a),_=X(o),v=Z.useMemo(()=>{let e=s===`top`,t=s===`left`;return c===`rtl`?(e||=s===`inline-end`,t||=s===`inline-end`):(e||=s===`inline-start`,t||=s===`inline-start`),e?{position:`absolute`,[s===`top`?`bottom`:`top`]:`0`,[t?`right`:`left`]:`0`}:l},[s,c]);Y(()=>{if(!i){h.current=d,m.current=!0,p.current=null;return}if(!t||!n)return;h.current=wi(t,v),Ti(t,`auto`);let e=Ci(t,`position`,`static`),r=Ci(t,`transform`,`none`),a=Ci(t,`scale`,`1`),o=wi(n,{"--available-width":`max-content`,"--available-height":`max-content`});function s(){e(),r(),o()}function c(){s(),a()}if(g?.(),m.current||p.current===null){Ei(n,`max-content`);let e=xi(t);return p.current=e,Ei(n,e),c(),_?.(null,e),m.current=!1,()=>{h.current(),h.current=d}}Ei(n,`max-content`);let l=p.current,y=xi(t);p.current=y,Ti(t,l),c(),_?.(l,y),Ei(n,y);let b=new AbortController;return f.request(()=>{Ti(t,y),u(()=>{t.style.setProperty(`--popup-width`,`auto`),t.style.setProperty(`--popup-height`,`auto`)},b.signal)}),()=>{b.abort(),f.cancel(),h.current(),h.current=d}},[r,t,n,u,f,i,g,_,v])}function Ci(e,t,n){let r=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{e.style.setProperty(t,r)}}function wi(e,t){let n=[];for(let[r,i]of Object.entries(t))n.push(Ci(e,r,i));return n.length?()=>{n.forEach(e=>e())}:d}function Ti(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 Ei(e,t){let n=t===`max-content`?`max-content`:`${t.width}px`,r=t===`max-content`?`max-content`:`${t.height}px`;e.style.setProperty(`--positioner-width`,n),e.style.setProperty(`--positioner-height`,r)}function Di(e){let{store:t,side:n,cssVars:r,children:i}=e,a=we(),o=t.useState(`activeTriggerElement`),s=t.useState(`activeTriggerId`),c=t.useState(`open`),l=t.useState(`payload`),u=t.useState(`mounted`),d=t.useState(`popupElement`),f=t.useState(`positionerElement`),p=rn(c?o:null),m=ji(s,l),h=Z.useRef(null),[g,v]=Z.useState(null),[y,b]=Z.useState(null),x=Z.useRef(null),S=Z.useRef(null),C=O(x,!0,!1),w=F(),[T,E]=Z.useState(null),[D,k]=Z.useState(!1);Y(()=>(t.set(`hasViewport`,!0),()=>{t.set(`hasViewport`,!1)}),[t]);let A=X(()=>{x.current?.style.setProperty(`animation`,`none`),x.current?.style.setProperty(`transition`,`none`),S.current?.style.setProperty(`display`,`none`)}),j=X(e=>{x.current?.style.removeProperty(`animation`),x.current?.style.removeProperty(`transition`),S.current?.style.removeProperty(`display`),e&&E(e)}),M=Z.useRef(null);Y(()=>{(!c||!u)&&(M.current=null)},[c,u]),Y(()=>{if(o&&p&&o!==p&&M.current!==o&&h.current){v(h.current),k(!0);let e=Ai(p,o);b(e),w.request(()=>{Mr.flushSync(()=>{k(!1)}),C(()=>{v(null),E(null),h.current=null})}),M.current=o}},[o,p,g,C,w]),Y(()=>{let e=x.current;if(!e)return;let t=_(e).createElement(`div`);for(let n of Array.from(e.childNodes))t.appendChild(n.cloneNode(!0));h.current=t});let N=g!=null,P;P=N?(0,$.jsxs)(Z.Fragment,{children:[(0,$.jsx)(`div`,{"data-previous":!0,inert:_t(!0),ref:S,style:{...T?{[r.popupWidth]:`${T.width}px`,[r.popupHeight]:`${T.height}px`}:null,position:`absolute`},"data-ending-style":D?void 0:``},`previous`),(0,$.jsx)(`div`,{"data-current":!0,ref:x,"data-starting-style":D?``:void 0,children:i},m)]}):(0,$.jsx)(`div`,{"data-current":!0,ref:x,children:i},m),Y(()=>{let e=S.current;!e||!g||e.replaceChildren(...Array.from(g.childNodes))},[g]),Si({popupElement:d,positionerElement:f,mounted:u,content:l,onMeasureLayout:A,onMeasureLayoutComplete:j,side:n,direction:a});let ee={activationDirection:Oi(y),transitioning:N};return{children:P,state:ee}}function Oi(e){if(e)return`${ki(e.horizontal,5,`right`,`left`)} ${ki(e.vertical,5,`down`,`up`)}`}function ki(e,t,n,r){return e>t?n:e<-t?r:``}function Ai(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 ji(e,t){let[n,r]=Z.useState(0),i=Z.useRef(e),a=Z.useRef(t),o=Z.useRef(!1);return Y(()=>{let n=i.current,s=a.current,c=e!==n,l=t!==s;c?(r(e=>e+1),o.current=!l):o.current&&l&&(r(e=>e+1),o.current=!1),i.current=e,a.current=t},[e,t]),`${e??`current`}-${n}`}var Mi=di;function Ni({className:e,children:t,...n}){return(0,$.jsx)(vi,{className:e,"data-slot":`menu-trigger`,...n,children:t})}function Pi({children:e,className:t,sideOffset:n=4,align:r=`center`,alignOffset:i,side:a=`bottom`,anchor:o,...s}){return(0,$.jsx)(ni,{children:(0,$.jsx)(ri,{align:r,alignOffset:i,anchor:o,className:`z-50`,"data-slot":`menu-positioner`,side:a,sideOffset:n,children:(0,$.jsx)($r,{className:c(`relative flex not-[class*='w-']:min-w-32 origin-(--transform-origin) rounded-lg border bg-popover not-dark:bg-clip-padding shadow-lg/5 outline-none before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] focus:outline-none dark:before:shadow-[0_-1px_--theme(--color-white/6%)]`,t),"data-slot":`menu-popup`,...s,children:(0,$.jsx)(`div`,{className:`max-h-(--available-height) w-full overflow-y-auto p-1`,children:e})})})})}function Fi({className:e,inset:t,variant:n=`default`,...r}){return(0,$.jsx)(Zr,{className:c(`[&>svg]:-mx-0.5 flex min-h-8 cursor-default select-none items-center gap-2 rounded-sm px-2 py-1 text-base text-foreground outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-inset:ps-8 data-[variant=destructive]:text-destructive-foreground data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&>svg:not([class*='opacity-'])]:opacity-80 [&>svg:not([class*='size-'])]:size-4.5 sm:[&>svg:not([class*='size-'])]:size-4 [&>svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:[&>svg:not([class*='text-'])]:text-current [&>svg]:pointer-events-none [&>svg]:shrink-0`,e),"data-inset":t,"data-slot":`menu-item`,"data-variant":n,...r})}function Ii({className:e,...t}){return(0,$.jsx)(an,{className:c(`mx-2 my-1 h-px bg-border`,e),"data-slot":`menu-separator`,...t})}var Li=Z.createContext(void 0);function Ri(){let e=Z.useContext(Li);if(e===void 0)throw Error(r(64));return e}var zi=function(e){return e.activationDirection=`data-activation-direction`,e.orientation=`data-orientation`,e}({}),Bi={tabActivationDirection:e=>({[zi.activationDirection]:e})},Vi=Z.forwardRef(function(e,t){let{className:n,defaultValue:r=0,onValueChange:i,orientation:a=`horizontal`,render:s,value:c,style:l,...u}=e,d=e.defaultValue!==void 0,f=Z.useRef([]),[p,m]=Z.useState(()=>new Map),[h,g]=j({controlled:c,default:r,name:`Tabs`,state:`value`}),_=c!==void 0,[y,b]=Z.useState(()=>new Map),x=Z.useRef(void 0),C=Z.useCallback(e=>{if(e===void 0)return null;for(let[t,n]of y.entries())if(n!=null&&e===(n.value??n.index))return t;return null},[y]),[w,T]=Z.useState(()=>({previousValue:h,tabActivationDirection:`none`})),{previousValue:D,tabActivationDirection:O}=w,k=O,A=!1;D!==h&&(k=Hi(D,h,a,y),A=D!=null&&h!=null&&C(h)==null);let M=A?D:h,N=D!==M||O!==k;Y(()=>{N&&T({previousValue:M,tabActivationDirection:k})},[M,N,k]);let P=X((e,t)=>{t.activationDirection=Hi(h,e,a,y),i?.(e,t),!t.isCanceled&&g(e)}),F=X((e,t)=>{i?.(e,S(t,void 0,void 0,{activationDirection:`none`}))}),ee=X((e,t)=>{m(n=>{if(n.get(e)===t)return n;let r=new Map(n);return r.set(e,t),r})}),I=X((e,t)=>{m(n=>{if(!n.has(e)||n.get(e)!==t)return n;let r=new Map(n);return r.delete(e),r})}),te=Z.useCallback(e=>p.get(e),[p]),ne=Z.useCallback(e=>{for(let t of y.values())if(e===t?.value)return t?.id},[y]),re=Z.useMemo(()=>({getTabElementBySelectedValue:C,getTabIdByPanelValue:ne,getTabPanelIdByValue:te,onValueChange:P,orientation:a,registerMountedTabPanel:ee,setTabMap:b,unregisterMountedTabPanel:I,tabActivationDirection:k,value:h}),[C,ne,te,P,a,ee,b,I,k,h]),L=Z.useMemo(()=>{for(let e of y.values())if(e!=null&&e.value===h)return e},[y,h]),ie=Z.useMemo(()=>{for(let e of y.values())if(e!=null&&!e.disabled)return e.value},[y]),R=Z.useRef(!d),oe=Z.useRef(r),se=Z.useRef(d),ce=Z.useRef(!1);Y(()=>{if(_)return;function e(e,t){g(e),T(t=>t.previousValue===e&&t.tabActivationDirection===`none`?t:{previousValue:e,tabActivationDirection:`none`}),F(e,t),R.current=!1}if(y.size===0){ce.current&&h!==null&&!x.current?.isConnected&&e(null,ae);return}ce.current=!0,x.current=y.keys().next().value;let t=L?.disabled,n=L==null&&h!==null;if(!t&&h===oe.current&&(se.current=!1),se.current&&t&&h===oe.current)return;let r=R.current;if(t||n){let n=ie??null;if(h===n){R.current=!1;return}let i=ae;r?i=v:t&&(i=E),e(n,i);return}r&&L!=null&&(F(h,v),R.current=!1)},[ie,_,F,L,g,y,h]);let z=o(`div`,e,{state:{orientation:a,tabActivationDirection:k},ref:t,props:u,stateAttributesMapping:Bi});return(0,$.jsx)(Li.Provider,{value:re,children:(0,$.jsx)(qt,{elementsRef:f,children:z})})});function Hi(e,t,n,r){if(e==null||t==null)return`none`;let i=null,a=null;for(let[n,o]of r.entries()){if(o==null)continue;let r=o.value??o.index;if(e===r&&(i=n),t===r&&(a=n),i!=null&&a!=null)break}if(i==null||a==null)return i!==a&&(typeof e==`number`||typeof e==`string`)&&typeof e==typeof t?n===`horizontal`?t>e?`right`:`left`:t>e?`down`:`up`:`none`;let o=i.getBoundingClientRect(),s=a.getBoundingClientRect();if(n===`horizontal`){if(s.left<o.left)return`left`;if(s.left>o.left)return`right`}else{if(s.top<o.top)return`up`;if(s.top>o.top)return`down`}return`none`}var Ui=`data-composite-item-active`,Wi=Z.createContext(void 0);function Gi(){let e=Z.useContext(Wi);if(e===void 0)throw Error(r(65));return e}var Ki=Z.forwardRef(function(e,t){let{className:n,disabled:r=!1,render:i,value:a,id:s,nativeButton:c=!0,style:l,...u}=e,{value:d,getTabPanelIdByValue:f,orientation:p,tabActivationDirection:m}=Ri(),{activateOnFocus:h,highlightedTabIndex:g,onTabActivation:v,registerTabResizeObserverElement:y,setHighlightedTabIndex:b,tabsListElement:x}=Gi(),C=U(s),{compositeProps:w,compositeRef:T,index:E}=fi({metadata:Z.useMemo(()=>({disabled:r,id:C,value:a}),[r,C,a])}),D=a===d,O=Z.useRef(!1),k=Z.useRef(null);Y(()=>{let e=k.current;if(e)return y(e)},[y]),Y(()=>{if(O.current){O.current=!1;return}if(!(D&&E>-1&&g!==E))return;let e=x;if(e!=null){let t=xt(_(e));if(t&&q(e,t))return}r||b(E)},[D,E,g,b,r,x]);let{getButtonProps:A,buttonRef:j}=ue({disabled:r,native:c,focusableWhenDisabled:!0}),M=f(a),N=Z.useRef(!1),P=Z.useRef(!1);function F(e){D||r||v(a,S(ce,e.nativeEvent,void 0,{activationDirection:`none`}))}function ee(e){D||(E>-1&&!r&&b(E),!r&&h&&(!N.current||N.current&&P.current)&&v(a,S(ce,e.nativeEvent,void 0,{activationDirection:`none`})))}function I(e){if(D||r)return;N.current=!0;function t(){N.current=!1,P.current=!1}(!e.button||e.button===0)&&(P.current=!0,_(e.currentTarget).addEventListener(`pointerup`,t,{once:!0}))}return o(`button`,e,{state:{disabled:r,active:D,orientation:p,tabActivationDirection:m},ref:[t,j,T,k],props:[w,{role:`tab`,"aria-controls":M,"aria-selected":D,id:C,onClick:F,onFocus:ee,onPointerDown:I,[Ui]:D?``:void 0,onKeyDownCapture(){O.current=!0}},u,A],stateAttributesMapping:Bi})}),qi=Ie();function Ji(){return d}function Yi(){return!1}function Xi(){return!0}function Zi(){return(0,qi.useSyncExternalStore)(Ji,Yi,Xi)}var Qi=function(e){return e.activeTabLeft=`--active-tab-left`,e.activeTabRight=`--active-tab-right`,e.activeTabTop=`--active-tab-top`,e.activeTabBottom=`--active-tab-bottom`,e.activeTabWidth=`--active-tab-width`,e.activeTabHeight=`--active-tab-height`,e}({}),$i={...Bi,activeTabPosition:()=>null,activeTabSize:()=>null},ea=Z.forwardRef(function(e,t){let{className:n,render:r,renderBeforeHydration:i=!1,style:a,...s}=e,{nonce:c}=qe(),{getTabElementBySelectedValue:l,orientation:u,tabActivationDirection:d,value:f}=Ri(),{tabsListElement:p,registerIndicatorUpdateListener:m}=Gi(),h=Zi(),g=vr();Z.useEffect(()=>m(g),[m,g]);let _=0,v=0,y=0,b=0,x=0,S=0,C=!1;if(f!=null&&p!=null){let e=l(f);if(e!=null){C=!0;let{width:t,height:n}=xi(e),{width:r,height:i}=xi(p),a=e.getBoundingClientRect(),o=p.getBoundingClientRect(),s=r>0?o.width/r:1,c=i>0?o.height/i:1;if(Math.abs(s)>2**-52&&Math.abs(c)>2**-52){let e=a.left-o.left,t=a.top-o.top;_=e/s+p.scrollLeft-p.clientLeft,y=t/c+p.scrollTop-p.clientTop}else _=e.offsetLeft,y=e.offsetTop;x=t,S=n,v=p.scrollWidth-_-x,b=p.scrollHeight-y-S}}let w=C?{left:_,right:v,top:y,bottom:b}:null,T=C?{width:x,height:S}:null,E=C?{[Qi.activeTabLeft]:`${_}px`,[Qi.activeTabRight]:`${v}px`,[Qi.activeTabTop]:`${y}px`,[Qi.activeTabBottom]:`${b}px`,[Qi.activeTabWidth]:`${x}px`,[Qi.activeTabHeight]:`${S}px`}:void 0,D=o(`span`,e,{state:{orientation:u,activeTabPosition:w,activeTabSize:T,tabActivationDirection:d},ref:t,props:[{role:`presentation`,style:E,hidden:!(C&&x>0&&S>0)},s,{suppressHydrationWarning:!0}],stateAttributesMapping:$i});return f==null?null:(0,$.jsxs)(Z.Fragment,{children:[D,h&&i&&(0,$.jsx)(`script`,{nonce:c,dangerouslySetInnerHTML:{__html:'!function(){const t=document.currentScript.previousElementSibling;if(!t)return;const e=t.closest(\'[role="tablist"]\');if(!e)return;const i=e.querySelector("[data-active]");if(!i)return;if(0===i.offsetWidth||0===e.offsetWidth)return;let o=0,n=0,h=0,l=0,r=0,f=0;function s(t){const e=getComputedStyle(t);let i=parseFloat(e.width)||0,o=parseFloat(e.height)||0;return(Math.round(i)!==t.offsetWidth||Math.round(o)!==t.offsetHeight)&&(i=t.offsetWidth,o=t.offsetHeight),{width:i,height:o}}if(null!=i&&null!=e){const{width:t,height:c}=s(i),{width:u,height:d}=s(e),a=i.getBoundingClientRect(),g=e.getBoundingClientRect(),p=u>0?g.width/u:1,b=d>0?g.height/d:1;if(Math.abs(p)>Number.EPSILON&&Math.abs(b)>Number.EPSILON){const t=a.left-g.left,i=a.top-g.top;o=t/p+e.scrollLeft-e.clientLeft,h=i/b+e.scrollTop-e.clientTop}else o=i.offsetLeft,h=i.offsetTop;r=t,f=c,n=e.scrollWidth-o-r,l=e.scrollHeight-h-f}function c(e,i){t.style.setProperty(`--active-tab-${e}`,`${i}px`)}c("left",o),c("right",n),c("top",h),c("bottom",l),c("width",r),c("height",f),r>0&&f>0&&t.removeAttribute("hidden")}();'},suppressHydrationWarning:!0})]})}),ta=function(e){return e.index=`data-index`,e.activationDirection=`data-activation-direction`,e.orientation=`data-orientation`,e.hidden=`data-hidden`,e[e.startingStyle=I.startingStyle]=`startingStyle`,e[e.endingStyle=I.endingStyle]=`endingStyle`,e}({}),na={...Bi,...tt},ra=Z.forwardRef(function(e,t){let{className:n,value:r,render:i,keepMounted:a=!1,style:s,...c}=e,{value:l,getTabIdByPanelValue:u,orientation:d,tabActivationDirection:f,registerMountedTabPanel:p,unregisterMountedTabPanel:m}=Ri(),h=U(),{ref:g,index:_}=Yt({metadata:Z.useMemo(()=>({id:h,value:r}),[h,r])}),v=r===l,{mounted:y,transitionStatus:b,setMounted:x}=pe(v),S=!y,C=u(r),w={hidden:S,orientation:d,tabActivationDirection:f,transitionStatus:b},T=Z.useRef(null),E=o(`div`,e,{state:w,ref:[t,g,T],props:[{"aria-labelledby":C,hidden:S,id:h,role:`tabpanel`,tabIndex:v?0:-1,inert:_t(!v),[ta.index]:_},c],stateAttributesMapping:na});return ge({open:v,ref:T,onComplete(){v||x(!1)}}),Y(()=>{if(!(S&&!a)&&h!=null)return p(r,h),()=>{m(r,h)}},[S,a,r,h,p,m]),a||y?E:null}),ia=[];function aa(e){let{loopFocus:t=!0,orientation:n=`both`,grid:r,onLoop:i,direction:a,highlightedIndex:o,onHighlightedIndexChange:c,rootRef:l,enableHomeAndEndKeys:u=!1,stopEventPropagation:d=!1,disabledIndices:f,modifierKeys:p=ia}=e,[m,h]=Z.useState(0),g=r!=null,_=Z.useRef(null),v=s(_,l),y=Z.useRef([]),b=Z.useRef(!1),x=o??m,S=X((e,t=!1)=>{if((c??h)(e),t){let t=y.current[e];Ne(_.current,t,a,n)}}),C=X(e=>{if(e.size===0||b.current)return;b.current=!0;let t=Array.from(e.keys()),r=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,i=r?t.indexOf(r):-1;if(i!==-1)S(i);else if(st(t,x,f)){let e=Je(t,{disabledIndices:f});Xe(t,e)||S(e)}Ne(_.current,r,a,n)});Y(()=>{if(f==null||o!=null||!b.current)return;let e=y.current;if(st(e,x,f)){let t=Je(e,{disabledIndices:f});Xe(e,t)||S(t)}},[f,o,x,y,S]);let w=X((e,t,n)=>i?i(e,t,n,y):n),T=X(e=>{let o=u?Te:Le;if(!o.has(e.key)||oa(e,p)||!_.current)return;let s=a===`rtl`,c=s?Ce:Ye,l={horizontal:c,vertical:nt,both:c}[n],m=s?Ye:Ce,h={horizontal:m,vertical:ot,both:m}[n],v=vt(e.nativeEvent);if(v!=null&&Pe(v)&&!tn(v)){let t=v.selectionStart,n=v.selectionEnd,r=v.value??``;if(t==null||e.shiftKey||t!==n||e.key!==h&&t<r.length||e.key!==l&&t>0)return}let b=x,C=Re(y,f),T=rt(y,f);r!=null&&(b=r({disabledIndices:f,elementsRef:y,event:e,highlightedIndex:x,loopFocus:t,maxIndex:T,minIndex:C,onLoop:w,orientation:n,rtl:s}));let E={horizontal:[c],vertical:[nt],both:[c,nt]}[n],D={horizontal:[m],vertical:[ot],both:[m,ot]}[n],O=g?o:{horizontal:u?Oe:ft,vertical:u?We:Qe,both:o}[n];u&&(e.key===`Home`?b=C:e.key===`End`&&(b=T)),b===x&&(E.includes(e.key)||D.includes(e.key))&&(t&&b===T&&E.includes(e.key)?(b=C,i&&(b=i(e,x,b,y))):t&&b===C&&D.includes(e.key)?(b=T,i&&(b=i(e,x,b,y))):b=Je(y.current,{startingIndex:b,decrement:D.includes(e.key),disabledIndices:f})),b!==x&&!Xe(y.current,b)&&(d&&e.stopPropagation(),O.has(e.key)&&e.preventDefault(),S(b,!0),queueMicrotask(()=>{y.current[b]?.focus()}))});return{props:{ref:v,onFocus(e){let t=_.current,n=vt(e.nativeEvent);!t||n==null||!Pe(n)||n.setSelectionRange(0,n.value.length??0)},onKeyDown:T},highlightedIndex:x,onHighlightedIndexChange:S,elementsRef:y,disabledIndices:f,onMapChange:C,relayKeyboardEvent:T}}function oa(e,t){for(let n of je.values())if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function sa(e){let{render:n,className:r,style:i,refs:a=t,props:s=t,state:c=l,stateAttributesMapping:u,highlightedIndex:d,onHighlightedIndexChange:f,orientation:p,grid:m,loopFocus:h,onLoop:g,enableHomeAndEndKeys:_,onMapChange:v,stopEventPropagation:y=!0,rootRef:b,disabledIndices:S,modifierKeys:C,highlightItemOnHover:w=!1,tag:T=`div`,...E}=e,{props:D,highlightedIndex:O,onHighlightedIndexChange:k,elementsRef:A,onMapChange:j,relayKeyboardEvent:M}=aa({grid:m,loopFocus:h,onLoop:g,orientation:p,highlightedIndex:d,onHighlightedIndexChange:f,rootRef:b,stopEventPropagation:y,enableHomeAndEndKeys:_,direction:we(),disabledIndices:S,modifierKeys:C}),N=o(T,e,{state:c,ref:a,props:[D,...s,E],stateAttributesMapping:u}),P=Z.useMemo(()=>({highlightedIndex:O,onHighlightedIndexChange:k,highlightItemOnHover:w,relayKeyboardEvent:M}),[O,k,w,M]);return(0,$.jsx)(x.Provider,{value:P,children:(0,$.jsx)(qt,{elementsRef:A,onMapChange:e=>{v?.(e),j(e)},children:N})})}var ca=Z.forwardRef(function(e,n){let{activateOnFocus:r=!1,className:i,loopFocus:a=!0,render:o,style:s,...c}=e,{onValueChange:l,orientation:u,value:d,setTabMap:f,tabActivationDirection:p}=Ri(),[m,h]=Z.useState(0),[g,_]=Z.useState(null),v=Z.useRef(new Set),y=Z.useRef(new Set),b=Z.useRef(null);Y(()=>{if(typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>{v.current.forEach(e=>{e()})});return b.current=e,g&&e.observe(g),y.current.forEach(t=>{e.observe(t)}),()=>{e.disconnect(),b.current=null}},[g]);let x=X(e=>(v.current.add(e),()=>{v.current.delete(e)})),S=X(e=>(y.current.add(e),b.current?.observe(e),()=>{y.current.delete(e),b.current?.unobserve(e)})),C=X((e,t)=>{e!==d&&l(e,t)}),w={orientation:u,tabActivationDirection:p},T={"aria-orientation":u===`vertical`?`vertical`:void 0,role:`tablist`},E=Z.useMemo(()=>({activateOnFocus:r,highlightedTabIndex:m,registerIndicatorUpdateListener:x,registerTabResizeObserverElement:S,onTabActivation:C,setHighlightedTabIndex:h,tabsListElement:g}),[r,m,x,S,C,h,g]);return(0,$.jsx)(Wi.Provider,{value:E,children:(0,$.jsx)(sa,{render:o,className:i,style:s,state:w,refs:[n,_],props:[T,c],stateAttributesMapping:Bi,highlightedIndex:m,enableHomeAndEndKeys:!0,loopFocus:a,orientation:u,onHighlightedIndexChange:h,onMapChange:f,disabledIndices:t})})});function la({className:e,...t}){return(0,$.jsx)(Vi,{className:c(`flex flex-col gap-4`,e),"data-slot":`tabs`,...t})}function ua({className:e,...t}){return(0,$.jsxs)(ca,{className:c(`relative z-0 flex w-fit items-center gap-1 rounded-lg bg-muted p-1`,e),"data-slot":`tabs-list`,...t,children:[t.children,(0,$.jsx)(ea,{className:`absolute top-1/2 left-0 z-[-1] h-[calc(100%-0.5rem)] w-(--active-tab-width) -translate-y-1/2 translate-x-(--active-tab-left) rounded-md bg-background shadow-xs transition-all duration-150`,"data-slot":`tabs-indicator`})]})}function da({className:e,...t}){return(0,$.jsx)(Ki,{className:c(`flex h-7 cursor-pointer items-center justify-center whitespace-nowrap rounded-md border border-transparent px-2.5 font-medium text-muted-foreground text-sm outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring data-selected:text-foreground`,e),"data-slot":`tabs-tab`,...t})}function fa({className:e,...t}){return(0,$.jsx)(ra,{className:c(`flex-1 outline-none`,e),"data-slot":`tabs-panel`,...t})}var pa=Z.createContext(void 0);function ma(e){let t=Z.useContext(pa);if(t===void 0&&!e)throw Error(r(47));return t}function ha(){return{..._n(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}var ga={...dn,disabled:J(e=>e.disabled),instantType:J(e=>e.instantType),openMethod:J(e=>e.openMethod),openChangeReason:J(e=>e.openChangeReason),modal:J(e=>e.modal),focusManagerModal:J(e=>e.focusManagerModal),stickIfOpen:J(e=>e.stickIfOpen),titleElementId:J(e=>e.titleElementId),descriptionElementId:J(e=>e.descriptionElementId),openOnHover:J(e=>e.openOnHover),closeDelay:J(e=>e.closeDelay),hasViewport:J(e=>e.hasViewport)},_a=class e extends pt{constructor(e,t,n=!1){let r={...ha(),...e},i=new re;r.open&&e?.mounted===void 0&&(r.mounted=!0),r.floatingRootContext=un(i,t,n),super(r,{popupRef:Z.createRef(),backdropRef:Z.createRef(),internalBackdropRef:Z.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:Z.createRef(),beforeContentFocusGuardRef:Z.createRef(),stickIfOpenTimeout:new W,triggerElements:i},ga)}setOpen=(e,t)=>{let n=t.reason===V,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=se(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};M(n,e,t.trigger,a()),this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),Mr.flushSync(s)):s(),r||i?this.set(`instantType`,r?`click`:`dismiss`):t.reason===`focus-out`?this.set(`instantType`,`focus`):this.set(`instantType`,void 0)};static useStore(t,n){let{store:r,internalStore:i}=k(t,(t,r)=>new e(n,t,r));return Z.useEffect(()=>i?.disposeEffect(),[i]),r}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()};function va({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=_a.useStore(s?.store,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});le(u,n,r,l),u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`mounted`),p=u.useState(`payload`),m=be()!=null;u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a),H(u,d),te(u);let{forceUnmount:h}=St(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null})});u.useSyncedValues({modal:o,nested:m}),Z.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]);let g=Z.useCallback(()=>{u.setOpen(!1,S(He))},[u]);Z.useImperativeHandle(e.actionsRef,()=>({unmount:h,close:g}),[h,g]);let _=d||f,v=Z.useMemo(()=>({store:u}),[u]);return(0,$.jsxs)(pa.Provider,{value:v,children:[_&&(0,$.jsx)(ba,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})}function ya(e){return ma(!0)?(0,$.jsx)(va,{props:e}):(0,$.jsx)(ye,{children:(0,$.jsx)(va,{props:e})})}function ba({store:e,modal:t}){let n=ee(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}});return y(e,{activeTriggerProps:n.reference??l,inactiveTriggerProps:n.trigger??l,popupProps:Z.useMemo(()=>u(ie,n.floating),[n.floating])}),null}var xa=Z.forwardRef(function(e,t){let{render:n,className:i,style:a,disabled:s=!1,nativeButton:c=!0,handle:l,payload:u,openOnHover:d=!1,delay:f=300,closeDelay:p=0,id:m,...h}=e,g=ma(!0),_=l?.store??g?.store;if(!_)throw Error(r(74));let v=U(m),y=_.useState(`isTriggerActive`,v),b=_.useState(`floatingRootContext`),x=_.useState(`isOpenedByTrigger`,v),S=_.useState(`triggerPopupId`,v),w=Z.useRef(null),{registerTrigger:T,isMountedByThisTrigger:E}=de(v,w,_,{payload:u,disabled:s,openOnHover:d,closeDelay:p}),D=_.useState(`openChangeReason`),O=_.useState(`stickIfOpen`),k=_.useState(`openMethod`),A=_.useState(`focusManagerModal`),j=Pr(b,{enabled:!s&&b!=null&&d&&(k!==`touch`||D!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:Vr(),restMs:f,delay:{close:p},triggerElementRef:w,isActiveTrigger:y,isClosing:()=>_.select(`transitionStatus`)===`ending`}),M=Vt(b,{enabled:b!=null,stickIfOpen:O}),N=Gt(()=>_.select(`open`),e=>{_.set(`openMethod`,e)}),P=_.useState(`triggerProps`,E),{getButtonProps:F,buttonRef:ee}=ue({disabled:s,native:c}),I={open(e){return e&&D===`trigger-press`?C.open(e):R.open(e)}},{preFocusGuardRef:te,handlePreFocusGuardFocus:ne,handleFocusTargetFocus:re}=hi(_,w),L=o(`button`,e,{state:{disabled:s,open:x},ref:[ee,t,T,w],props:[M.reference,j,P,N,{[dt]:``,id:v,"aria-haspopup":`dialog`,"aria-expanded":x,"aria-controls":S},h,F],stateAttributesMapping:I});return E&&!A?(0,$.jsxs)(Z.Fragment,{children:[(0,$.jsx)(ct,{ref:te,onFocus:ne}),(0,$.jsx)(Z.Fragment,{children:L},v),(0,$.jsx)(ct,{ref:_.context.triggerFocusTargetRef,onFocus:re})]}):(0,$.jsx)(Z.Fragment,{children:L},v)}),Sa=Z.createContext(void 0);function Ca(){let e=Z.useContext(Sa);if(e===void 0)throw Error(r(45));return e}var wa=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=ma();return i.useState(`mounted`)||n?(0,$.jsx)(Sa.Provider,{value:n,children:(0,$.jsx)(Ae,{ref:t,...r})}):null}),Ta=Z.createContext(void 0);function Ea(){let e=Z.useContext(Ta);if(!e)throw Error(r(46));return e}var Da=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,anchor:a,positionMethod:o=`absolute`,side:s=`bottom`,align:c=`center`,sideOffset:l=0,alignOffset:u=0,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f=5,arrowPadding:p=5,sticky:m=!1,disableAnchorTracking:h=!1,collisionAvoidance:g=ze,..._}=e,{store:v}=ma(),y=Ca(),b=_e(),x=v.useState(`floatingRootContext`),S=v.useState(`mounted`),C=v.useState(`open`),w=v.useState(`openChangeReason`),T=v.useState(`activeTriggerElement`),E=v.useState(`modal`),D=v.useState(`openMethod`),k=v.useState(`positionerElement`),A=v.useState(`instantType`),j=v.useState(`transitionStatus`),M=v.useState(`hasViewport`),N=Z.useRef(null),F=O(k,!1,!1),ee=$t({anchor:a,floatingRootContext:x,positionMethod:o,mounted:S,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:h,keepMounted:y,nodeId:b,collisionAvoidance:g,adaptiveOrigin:M?Ut:void 0}),I=x.useState(`domReferenceElement`);Y(()=>{let e=I,t=N.current;if(e&&(N.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return F(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[I,F,v]),Kt(C&&E===!0&&w!==`trigger-hover`,D===`touch`,k,T);let te=Z.useCallback(e=>{v.set(`positionerElement`,e)},[v]),ne=Ht(e,{open:C,side:ee.side,align:ee.align,anchorHidden:ee.anchorHidden,instant:A},{styles:ee.positionerStyles,transitionStatus:j,props:_,refs:[t,te],hidden:!S,inert:!C});return(0,$.jsxs)(Ta.Provider,{value:ee,children:[S&&E===!0&&w!==`trigger-hover`&&(0,$.jsx)(bt,{ref:v.context.internalBackdropRef,inert:_t(!C),cutout:T}),(0,$.jsx)(P,{id:b,children:ne})]})}),Oa=Z.createContext(void 0);function ka(){let[e,t]=Z.useState(0),n=X(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:Z.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}function Aa(e){let{value:t,children:n}=e;return(0,$.jsx)(Oa.Provider,{value:t,children:n})}var ja={...T,...tt},Ma=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:s,...c}=e,{store:l}=ma(),u=Ea(),d=Qt(!0)!=null,{context:f,hasClosePart:p}=ka(),m=l.useState(`open`),h=l.useState(`openMethod`),g=l.useState(`instantType`),_=l.useState(`transitionStatus`),v=l.useState(`popupProps`),y=l.useState(`titleElementId`),b=l.useState(`descriptionElementId`),x=l.useState(`modal`),S=l.useState(`mounted`),C=l.useState(`openChangeReason`),w=l.useState(`activeTriggerElement`),T=l.useState(`floatingRootContext`),E=T.useState(`floatingId`),O=l.useState(`disabled`),k=l.useState(`openOnHover`),A=l.useState(`closeDelay`),j=c.id??E;ge({open:m,ref:l.context.popupRef,onComplete(){m&&l.context.onOpenChangeComplete?.(!0)}}),jr(T,{enabled:k&&!O,closeDelay:A});let M=a===void 0?D(l.context.popupRef):a,N=x!==!1&&p;l.useSyncedValue(`focusManagerModal`,N);let P=Z.useCallback(e=>{l.set(`popupElement`,e)},[l]),F=o(`div`,e,{state:{open:m,side:u.side,align:u.align,instant:g,transitionStatus:_},ref:[t,l.context.popupRef,P],props:[v,{id:j,role:`dialog`,...ie,"aria-labelledby":y,"aria-describedby":b,onKeyDown(e){d&&Te.has(e.key)&&e.stopPropagation()}},Xt(_),c],stateAttributesMapping:ja});return(0,$.jsx)(et,{context:T,openInteractionType:h,modal:N,disabled:!S||C===`trigger-hover`,initialFocus:M,returnFocus:s,restoreFocus:`popup`,previousFocusableElement:fe(w)?w:void 0,nextFocusableElement:l.context.triggerFocusTargetRef,beforeContentFocusGuardRef:l.context.beforeContentFocusGuardRef,children:(0,$.jsx)(Aa,{value:f,children:F})})}),Na=function(e){return e.popupWidth=`--popup-width`,e.popupHeight=`--popup-height`,e}({}),Pa={activationDirection:e=>e?{"data-activation-direction":e}:null},Fa=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...s}=e,{store:c}=ma(),{side:l}=Ea(),u=c.useState(`instantType`),{children:d,state:f}=Di({store:c,side:l,cssVars:Na,children:a});return o(`div`,e,{state:{activationDirection:f.activationDirection,transitioning:f.transitioning,instant:u},ref:t,props:[s,{children:d}],stateAttributesMapping:Pa})}),Ia=ya;function La({className:e,children:t,...n}){return(0,$.jsx)(xa,{className:e,"data-slot":`popover-trigger`,...n,children:t})}function Ra({children:e,className:t,viewportClassName:n,side:r=`bottom`,align:i=`center`,sideOffset:a=4,alignOffset:o=0,tooltipStyle:s=!1,anchor:l,...u}){return(0,$.jsx)(wa,{children:(0,$.jsx)(Da,{align:i,alignOffset:o,anchor:l,className:`z-50 h-(--positioner-height) w-(--positioner-width) max-w-(--available-width) transition-[top,left,right,bottom,transform] data-instant:transition-none`,"data-slot":`popover-positioner`,side:r,sideOffset:a,children:(0,$.jsx)(Ma,{className:c(`relative flex h-(--popup-height,auto) w-(--popup-width,auto) origin-(--transform-origin) rounded-lg border bg-popover not-dark:bg-clip-padding text-popover-foreground shadow-lg/5 outline-none transition-[width,height,scale,opacity] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] has-data-[slot=calendar]:rounded-xl has-data-[slot=calendar]:before:rounded-[calc(var(--radius-xl)-1px)] data-starting-style:scale-98 data-starting-style:opacity-0 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]`,s&&`w-fit text-balance rounded-md text-xs shadow-md/5 before:rounded-[calc(var(--radius-md)-1px)]`,t),"data-slot":`popover-popup`,...u,children:(0,$.jsx)(Fa,{className:c(`relative size-full max-h-(--available-height) overflow-clip px-(--viewport-inline-padding) py-4 [--viewport-inline-padding:--spacing(4)] has-data-[slot=calendar]:p-2 data-instant:transition-none **:data-current:data-ending-style:opacity-0 **:data-current:data-starting-style:opacity-0 **:data-previous:data-ending-style:opacity-0 **:data-previous:data-starting-style:opacity-0 **:data-current:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-previous:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-current:opacity-100 **:data-previous:opacity-100 **:data-current:transition-opacity **:data-previous:transition-opacity`,s?`py-1 [--viewport-inline-padding:--spacing(2)]`:`not-data-transitioning:overflow-y-auto`,n),"data-slot":`popover-viewport`,children:e})})})})}function za({repos:e,disabled:t,onAdd:n}){let[r,i]=(0,Z.useState)(!1),[a,o]=(0,Z.useState)(``),s=(0,Z.useMemo)(()=>{let t=a.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||e.path.toLowerCase().includes(t)):e},[e,a]);return(0,$.jsxs)(Ia,{open:r,onOpenChange:e=>{e&&o(``),i(e)},children:[(0,$.jsx)(La,{render:(0,$.jsxs)(f,{variant:`outline`,size:`sm`,disabled:t,className:`h-8 text-xs text-muted-foreground`,children:[(0,$.jsx)(Gn,{size:14}),` Add repository`]})}),(0,$.jsxs)(Ra,{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)(zt,{className:`absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground`}),(0,$.jsx)(yt,{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 Ba=e=>e===`antigravity`?`Antigravity`:e===`claude`?`Claude Code`:e===`codex`?`OpenAI Codex`:`GitHub Copilot`,Va=e=>e===`claude`?`warning`:e===`codex`?`success`:e===`antigravity`?`accent`:`info`,Ha=({ws:e,sessions:t,sessionsLoading:n,setActiveSession:r,setTranscript:i,fetchSessionTranscript:a,handleResumeSession:o,handleOpenDesktopSession:s})=>{let c=Rn(),l=c.data?.find(e=>e.id===`codex-desktop`),u=l?.available===!0,d=c.isLoading?`Checking whether Codex Desktop is available…`:c.isError?`Could not check whether Codex Desktop is available.`:l?.unavailableReason??`Codex Desktop is not available on this computer.`,p=(0,Z.useRef)(null),[m,h]=(0,Z.useState)(null),g=async t=>{if(!(!u||p.current)){p.current=t,h(t);try{await s(e,t,`codex`)}finally{p.current=null,h(null)}}};return(0,$.jsx)(`div`,{children:n?(0,$.jsx)(`div`,{className:`flex justify-center py-10`,children:(0,$.jsx)(lt,{className:`size-5 text-primary`})}):t.length===0?(0,$.jsx)(er,{className:`rounded-xl border border-border bg-card`,children:(0,$.jsxs)($n,{children:[(0,$.jsx)(Zn,{variant:`icon`,children:(0,$.jsx)(lr,{})}),(0,$.jsx)(Xn,{children:`No Past AI Sessions Found`}),(0,$.jsxs)(Qn,{children:[`Start a conversation with your AI assistant (e.g. running `,(0,$.jsx)(`code`,{children:`claude`}),`, `,(0,$.jsx)(`code`,{children:`agy`}),`, `,(0,$.jsx)(`code`,{children:`codex`}),`, or `,(0,$.jsx)(`code`,{children:`copilot`}),` inside this directory) to track session history here.`]})]})}):(0,$.jsx)(`div`,{className:`space-y-3 mb-6`,children:t.map(t=>(0,$.jsxs)(`div`,{className:`flex flex-col justify-between gap-4 rounded-xl border border-border bg-card p-4 transition-colors hover:border-foreground/15 md:flex-row md:items-center`,children:[(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5 mb-1.5`,children:[(0,$.jsx)(Ln,{tone:Va(t.assistant),children:Ba(t.assistant)}),(0,$.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[`Updated: `,new Date(t.updatedAt).toLocaleString()]}),(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`•`}),(0,$.jsxs)(`span`,{className:`text-[10px] font-medium text-muted-foreground`,children:[t.messageCount,` messages`]})]}),(0,$.jsx)(`h4`,{className:`truncate pr-4 text-xs font-semibold text-foreground`,title:t.title,children:t.title})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,$.jsxs)(f,{variant:`outline`,size:`sm`,onClick:()=>{r(t),i([]),a(t.assistant,t.id)},children:[(0,$.jsx)(ur,{size:13}),` View Chat Log`]}),Nn(t.assistant)&&(0,$.jsxs)(f,{size:`sm`,onClick:()=>o(e,t.id,t.assistant),children:[(0,$.jsx)(bn,{size:11}),` Resume in NexusFlow`]}),t.assistant===`codex`&&(0,$.jsxs)(f,{variant:`outline`,size:`sm`,disabled:!u||m!==null,title:u?`Open this exact thread in Codex Desktop`:d,"aria-label":u?`Open in Codex Desktop`:`Codex Desktop unavailable: ${d}`,onClick:()=>void g(t.id),children:[m===t.id?(0,$.jsx)(lt,{className:`size-3`}):(0,$.jsx)(gn,{size:12}),m===t.id?`Opening…`:`Open in Codex Desktop`]})]})]},t.id))})})};function Ua({ws:e}){let t=e.branchName,n=Dn(t),r=Pn(t),i=xn(t),a=n.data,o=(0,Z.useMemo)(()=>a?.services??[],[a]),s=(0,Z.useMemo)(()=>a?.runningState??[],[a]),l=a?.orchestrationTools??[],u=(0,Z.useMemo)(()=>a?.runningOrchestrators??[],[a]),d=(0,Z.useMemo)(()=>u.filter(e=>e.mode===`pm2`&&e.logName),[u]),[p,m]=(0,Z.useState)(`classic`),[h,g]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(null);(0,Z.useEffect)(()=>{let e=[...o.map(e=>e.name),...d.map(e=>e.logName)];e.length===0?_!==null&&v(null):(!_||!e.includes(_))&&v(e[0])},[o,d]);let{logs:y,connected:b,clear:x}=fn(t,_,!0),S=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{S.current?.scrollIntoView({behavior:`smooth`})},[y]);let C=(0,Z.useMemo)(()=>new Set(s.filter(e=>e.pid>0).map(e=>e.name)),[s]),w=(0,Z.useMemo)(()=>new Set(u.map(e=>e.id)),[u]),T=C.size>0,E=p===`matrix`?`term-matrix`:p===`dracula`?`term-dracula`:`term-classic`,D=r.isPending||i.isPending;return(0,$.jsxs)(`div`,{className:`animate-fade-in`,children:[n.isLoading&&(0,$.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-[10px] text-primary`,children:[(0,$.jsx)(lt,{className:`size-3`}),(0,$.jsx)(`span`,{className:`font-semibold tracking-wider uppercase`,children:`Scanning service configurations...`})]}),l.length>0&&(0,$.jsxs)(`div`,{className:`mb-5 rounded-xl border border-border bg-card p-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-[10px] font-bold uppercase tracking-wider text-muted-foreground`,children:[(0,$.jsx)(Tn,{size:12,className:`text-info`}),` Orchestration tools`]}),(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:l.map(e=>{let t=w.has(e.id);return(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-border bg-muted/30 p-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`h-2 w-2 rounded-full ${t?`bg-success`:`bg-muted-foreground/40`}`}),(0,$.jsx)(`span`,{className:`text-xs font-bold text-foreground`,children:e.tool}),(0,$.jsx)(Ln,{tone:`idle`,dot:!1,children:e.mode})]}),(0,$.jsx)(`code`,{className:`mt-1 block truncate font-mono text-[9px] text-muted-foreground`,children:e.configPath})]}),(0,$.jsx)(`div`,{className:`shrink-0`,children:t?(0,$.jsxs)(f,{size:`xs`,variant:`destructive`,"aria-label":`Stop ${e.tool}`,disabled:D,onClick:()=>i.mutate({action:`stop`,id:e.id}),children:[(0,$.jsx)(jt,{size:12}),` Stop`]}):(0,$.jsxs)(f,{size:`xs`,"aria-label":`Start ${e.tool}`,disabled:D,onClick:()=>i.mutate({action:`start`,id:e.id}),children:[(0,$.jsx)(bn,{size:12}),` Start`]})})]},e.id)})})]}),(0,$.jsxs)(`div`,{className:`mb-6 rounded-xl border border-border bg-card p-5`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between text-xs font-semibold text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:`Workspace Status`}),(0,$.jsx)(Ln,{tone:T?`running`:`idle`,children:T?`Active`:`Standby`})]}),(0,$.jsx)(`div`,{className:`mb-4 text-xs font-semibold text-foreground`,children:T?`${C.size} process${C.size===1?``:`es`} active`:`All processes offline`}),(0,$.jsxs)(`div`,{className:`flex gap-3`,children:[(0,$.jsxs)(f,{disabled:T||D,onClick:()=>r.mutate({action:`start`}),children:[(0,$.jsx)(bn,{size:14}),` Start All Services`]}),(0,$.jsxs)(f,{variant:`destructive`,disabled:!T||D,onClick:()=>r.mutate({action:`stop`}),children:[(0,$.jsx)(jt,{size:14}),` Stop All`]})]})]}),(o.length>0||d.length>0)&&(0,$.jsxs)(`div`,{className:`grid grid-cols-1 overflow-hidden rounded-xl border border-border bg-card shadow-sm lg:grid-cols-12`,children:[(0,$.jsxs)(`div`,{className:`border-b border-border bg-muted/30 p-5 lg:col-span-4 lg:border-b-0 lg:border-r`,children:[(0,$.jsxs)(`h4`,{className:`mb-4 flex items-center gap-1.5 border-b border-border pb-2 text-[10px] font-bold uppercase tracking-wider text-muted-foreground`,children:[(0,$.jsx)(Ft,{size:12,className:`text-primary`}),` Background Services`]}),(0,$.jsxs)(`div`,{className:`flex max-h-[400px] flex-col gap-2 overflow-y-auto pr-1`,children:[o.map(e=>{let t=_===e.name,n=C.has(e.name);return(0,$.jsxs)(`div`,{className:c(`flex cursor-pointer flex-col rounded-xl border p-3 transition-colors`,t?`border-primary/40 bg-primary/10 text-foreground`:`border-border bg-card text-muted-foreground hover:border-foreground/15 hover:bg-accent/50 hover:text-foreground`),onClick:()=>v(e.name),children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full ${n?`bg-success`:`bg-destructive`}`}),(0,$.jsx)(`span`,{className:`truncate text-xs font-bold`,children:e.name})]}),(0,$.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,onClick:e=>e.stopPropagation(),children:n?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(f,{size:`icon-xs`,variant:`ghost`,"aria-label":`Restart ${e.name}`,disabled:D,onClick:()=>r.mutate({action:`restart`,service:e.name}),children:(0,$.jsx)(pr,{})}),(0,$.jsx)(f,{size:`icon-xs`,variant:`ghost`,"aria-label":`Stop ${e.name}`,disabled:D,onClick:()=>r.mutate({action:`stop`,service:e.name}),children:(0,$.jsx)(jt,{})})]}):(0,$.jsx)(f,{size:`icon-xs`,variant:`ghost`,"aria-label":`Start ${e.name}`,disabled:D,onClick:()=>r.mutate({action:`start`,service:e.name}),children:(0,$.jsx)(bn,{})})})]}),e.port?(0,$.jsxs)(`span`,{className:`mt-2 w-fit rounded border border-border bg-background px-2 py-0.5 font-mono text-[9px] text-muted-foreground`,children:[`Port: `,e.port]}):null,(0,$.jsxs)(`code`,{className:`mt-2 block truncate rounded border border-border bg-muted/40 p-1.5 font-mono text-[9px] text-muted-foreground`,children:[e.command,` `,e.args.join(` `)]})]},e.name)}),d.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`mt-2 border-t border-border pt-3 text-[9px] font-bold uppercase tracking-wider text-muted-foreground`,children:`Orchestrators`}),d.map(e=>{let t=e.logName;return(0,$.jsxs)(`div`,{className:c(`flex cursor-pointer items-center gap-2 rounded-xl border p-3 transition-colors`,_===t?`border-primary/40 bg-primary/10 text-foreground`:`border-border bg-card text-muted-foreground hover:border-foreground/15 hover:bg-accent/50 hover:text-foreground`),onClick:()=>v(t),children:[(0,$.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full bg-success`}),(0,$.jsx)(`span`,{className:`truncate text-xs font-bold`,children:e.tool}),(0,$.jsx)(Ln,{tone:`idle`,dot:!1,children:e.mode})]},e.id)})]})]})]}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col bg-background lg:col-span-8`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-border bg-muted/40 px-5 py-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`font-mono text-xs font-bold text-primary`,children:_||`no-service`}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`|`}),(0,$.jsx)(Ln,{tone:b?`running`:`idle`,children:b?`streaming`:`idle`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3 self-end sm:self-auto`,children:[(0,$.jsx)(`div`,{className:`flex rounded-lg border border-border bg-card p-0.5 text-[9px] font-semibold text-muted-foreground`,children:[`classic`,`matrix`,`dracula`].map(e=>(0,$.jsx)(`button`,{className:c(`cursor-pointer rounded-md px-2 py-1 capitalize transition-colors`,p===e?`bg-primary/10 font-bold text-primary`:`hover:text-foreground`),onClick:()=>m(e),children:e},e))}),(0,$.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,$.jsx)(`button`,{onClick:x,className:`cursor-pointer rounded-lg border border-border bg-card p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:`Clear Console`,children:(0,$.jsx)(Bt,{size:13})}),(0,$.jsx)(`button`,{onClick:()=>g(!h),className:`cursor-pointer rounded-lg border border-border bg-card p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:h?`Minimize Console`:`Expand Console`,children:h?(0,$.jsx)(dr,{size:13}):(0,$.jsx)(cr,{size:13})})]})]})]}),(0,$.jsxs)(`div`,{className:c(`relative overflow-y-auto whitespace-pre-wrap p-5 font-mono text-[10.5px] leading-relaxed selection:bg-primary/20`,E,h?`h-[520px]`:`h-80`),children:[y.trim()?y:(0,$.jsx)(`span`,{className:`font-mono italic text-muted-foreground`,children:`(no log content yet)`}),(0,$.jsx)(`div`,{ref:S})]})]})]})]})}var Wa=({ws:e,gitChanges:t,gitChangesLoading:n,syncLoading:r,syncResults:i,commitMessage:a,showCommitModal:o,commitLoading:s,commitResults:c,setSyncResults:l,setCommitResults:u,setCommitMessage:d,setShowCommitModal:p,fetchGitChanges:m,handleSyncAll:h,handleCommitAll:g})=>{let[_,v]=(0,Z.useState)({}),[y,b]=(0,Z.useState)({}),[x,S]=(0,Z.useState)({}),[C,w]=(0,Z.useState)({}),[T,E]=(0,Z.useState)(``),D=async(t,n)=>{let r=`${t}/${n}`,i=!_[r];if(v(e=>({...e,[r]:i})),i&&!y[r]){S(e=>({...e,[r]:!0})),w(e=>({...e,[r]:``}));try{let i=encodeURIComponent(e.branchName),a=await fetch(`/api/workspace/${i}/changes/diff?repo=${encodeURIComponent(t)}&file=${encodeURIComponent(n)}`);if(!a.ok)throw Error(`Failed to load diff: ${a.statusText}`);let o=await a.json();b(e=>({...e,[r]:o.diff||``}))}catch(e){w(t=>({...t,[r]:e.message||`Unknown error`}))}finally{S(e=>({...e,[r]:!1}))}}},O=e=>!e||!e.trim()?(0,$.jsx)(`div`,{className:`p-3 font-mono text-[11px] italic text-muted-foreground`,children:`No diff details available.`}):(0,$.jsx)(`pre`,{className:`custom-scrollbar max-h-[450px] overflow-x-auto overflow-y-auto rounded-xl border border-border bg-muted/40 p-4 font-mono text-[11px] leading-relaxed text-muted-foreground select-text`,children:e.split(`
|
|
2
|
+
`).map((e,t)=>{let n;return n=e.startsWith(`+`)&&!e.startsWith(`+++`)?`block w-full rounded-sm bg-success/10 px-1 text-success-foreground`:e.startsWith(`-`)&&!e.startsWith(`---`)?`block w-full rounded-sm bg-destructive/10 px-1 text-destructive-foreground`:e.startsWith(`@@`)?`block w-full bg-info/10 px-1 font-semibold italic text-info-foreground`:e.startsWith(`diff`)||e.startsWith(`index`)||e.startsWith(`---`)||e.startsWith(`+++`)?`block w-full font-bold text-muted-foreground`:`block w-full px-1 text-foreground`,(0,$.jsx)(`code`,{className:n,children:e},t)})});return(0,$.jsxs)(`div`,{className:`animate-fade-in`,children:[(0,$.jsxs)(`header`,{className:`flex justify-between items-center mb-6 flex-wrap gap-3`,children:[(0,$.jsxs)(`h4`,{className:`flex items-center gap-2 text-sm font-bold text-foreground`,children:[(0,$.jsx)(cn,{size:16,className:`text-primary`}),` Active Workspace Git Diffs`]}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsxs)(f,{variant:`outline`,size:`sm`,onClick:()=>m(e.branchName),disabled:n,children:[(0,$.jsx)(sn,{size:11,className:n?`animate-spin text-primary`:``}),` Refresh Changes`]}),e.mode!==`in-place`&&(0,$.jsxs)(f,{variant:`outline`,size:`sm`,onClick:()=>h(e.branchName),disabled:r,children:[r?(0,$.jsx)(lt,{className:`size-3`}):(0,$.jsx)(sn,{size:11}),` Sync All`]}),(0,$.jsx)(f,{size:`sm`,onClick:()=>p(!0),disabled:t.every(e=>e.files.length===0)||s,children:`Commit & Push All`})]})]}),i&&e.mode!==`in-place`&&(0,$.jsxs)(`div`,{className:`relative mb-5 rounded-xl border border-info/25 bg-info/10 p-5 text-info-foreground shadow-sm`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between border-b border-info/20 pb-2`,children:[(0,$.jsx)(`h5`,{className:`font-mono text-xs font-bold text-foreground`,children:`Rebase / Sync Action Logs`}),(0,$.jsx)(`button`,{className:`cursor-pointer text-[10px] font-bold text-info-foreground hover:text-foreground`,onClick:()=>l(null),children:`Dismiss`})]}),(0,$.jsx)(`div`,{className:`space-y-2`,children:i.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-border bg-card p-2 font-mono text-[10px]`,children:[(0,$.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.repoName}),(0,$.jsx)(`span`,{className:e.success?`font-bold text-success-foreground`:`font-bold text-destructive-foreground`,children:e.success?`✓ Synced (${e.message})`:`✗ Conflict: ${e.message}`})]},e.repoName))})]}),c&&(0,$.jsxs)(`div`,{className:`relative mb-5 rounded-xl border border-success/25 bg-success/10 p-5 text-success-foreground shadow-sm`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between border-b border-success/20 pb-2`,children:[(0,$.jsx)(`h5`,{className:`font-mono text-xs font-bold text-foreground`,children:`Commit & Push Results`}),(0,$.jsx)(`button`,{className:`cursor-pointer text-[10px] font-bold text-success-foreground hover:text-foreground`,onClick:()=>u(null),children:`Dismiss`})]}),(0,$.jsx)(`div`,{className:`space-y-2`,children:c.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-border bg-card p-2 font-mono text-[10px]`,children:[(0,$.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.repoName}),(0,$.jsx)(`span`,{className:e.success?`font-bold text-success-foreground`:`font-bold text-destructive-foreground`,children:e.success?`✓ Committed ${e.filesChanged} file(s) (${e.commitHash?e.commitHash.slice(0,7):`no hash`})`:`✗ Error: ${e.message}`})]},e.repoName))})]}),o&&(0,$.jsxs)(`div`,{className:`relative mb-6 rounded-xl border border-border bg-card p-6 shadow-sm animate-rise`,children:[(0,$.jsxs)(`h5`,{className:`mb-3 flex items-center gap-1.5 text-xs font-bold text-foreground`,children:[(0,$.jsx)(mr,{size:13,className:`text-primary`}),` Enter Commit Message`]}),(0,$.jsx)(yt,{type:`text`,className:`mb-4 font-mono text-xs`,placeholder:`feat: implement multi-repo logic...`,value:a,onChange:e=>d(e.target.value),onKeyDown:t=>{t.key===`Enter`&&a.trim()&&g(e.branchName)}}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2.5`,children:[(0,$.jsx)(f,{variant:`outline`,size:`sm`,onClick:()=>{p(!1),d(``)},disabled:s,children:`Cancel`}),(0,$.jsxs)(f,{size:`sm`,onClick:()=>g(e.branchName),disabled:s||!a.trim(),children:[s?(0,$.jsx)(lt,{className:`size-3`}):null,s?`Committing...`:`Commit & Push All`]})]})]}),n?(0,$.jsx)(`div`,{className:`flex justify-center py-20`,children:(0,$.jsx)(lt,{className:`size-6 text-primary`})}):(0,$.jsx)(`div`,{className:`space-y-6`,children:t.every(e=>e.files.length===0)?(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center rounded-xl border border-border bg-card py-16 text-center`,children:[(0,$.jsx)(`div`,{className:`mb-3 flex h-10 w-10 items-center justify-center rounded-full border border-success/25 bg-success/10 text-success-foreground shadow-sm`,children:(0,$.jsx)(Fn,{size:20})}),(0,$.jsx)(`h5`,{className:`text-sm font-bold text-foreground`,children:`No Uncommitted Changes`}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Workspace repositories are completely in sync with Git feature branches.`})]}):t.map(e=>{if(e.files.length===0)return null;let t=e.files.length,n=e.files.reduce((e,t)=>e+(t.additions||0),0),r=e.files.reduce((e,t)=>e+(t.deletions||0),0);return(0,$.jsxs)(`div`,{className:`relative rounded-xl border border-border bg-card p-6 transition-colors`,children:[(0,$.jsxs)(`div`,{className:`flex justify-between items-center mb-4 flex-wrap gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,$.jsx)(`h5`,{className:`font-mono text-sm font-bold text-foreground`,children:e.repoName}),(0,$.jsxs)(Ln,{tone:`warning`,dot:!1,children:[t,` file`,t===1?``:`s`,` changed`]}),(n>0||r>0)&&(0,$.jsxs)(`span`,{className:`rounded border border-border bg-muted/40 px-2 py-0.5 font-mono text-[10px] font-bold`,children:[(0,$.jsxs)(`span`,{className:`font-bold text-success-foreground`,children:[`+`,n]}),` `,(0,$.jsxs)(`span`,{className:`font-bold text-destructive-foreground`,children:[`-`,r]})]})]}),(0,$.jsx)(`span`,{className:`max-w-[280px] truncate font-mono text-[10px] text-muted-foreground`,title:e.repoPath,children:e.repoPath})]}),(0,$.jsx)(`div`,{className:`flex flex-col gap-3`,children:e.files.map(t=>{let n=`${e.repoName}/${t.file}`,r=!!_[n],i=!!x[n],a=y[n]||``,o=C[n]||``;return(0,$.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-border bg-muted/20 transition-colors hover:border-foreground/15`,children:[(0,$.jsxs)(`div`,{className:`flex cursor-pointer select-none items-center justify-between px-4 py-3 transition-colors hover:bg-accent/50`,onClick:()=>D(e.repoName,t.file),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[r?(0,$.jsx)(Et,{size:14,className:`shrink-0 text-primary`}):(0,$.jsx)(It,{size:14,className:`shrink-0 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`max-w-[240px] truncate font-mono text-[11px] text-foreground sm:max-w-[480px]`,title:t.file,children:t.file}),(t.additions>0||t.deletions>0)&&(0,$.jsxs)(`span`,{className:`ml-1 shrink-0 font-mono text-[9px] font-bold text-muted-foreground`,children:[(0,$.jsxs)(`span`,{className:`text-success-foreground`,children:[`+`,t.additions]}),` /`,` `,(0,$.jsxs)(`span`,{className:`text-destructive-foreground`,children:[`-`,t.deletions]})]})]}),(0,$.jsx)(`div`,{className:`flex items-center gap-2.5 shrink-0`,children:(0,$.jsx)(`span`,{className:`rounded border px-2 py-0.5 text-[8px] font-bold uppercase tracking-wider ${t.type===`added`?`border-success/25 bg-success/10 text-success-foreground`:t.type===`deleted`?`border-destructive/25 bg-destructive/10 text-destructive-foreground`:`border-warning/25 bg-warning/10 text-warning-foreground`}`,children:t.type})})]}),r&&(0,$.jsx)(`div`,{className:`border-t border-border bg-background p-3`,children:i?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 p-2 font-mono text-[10px] text-primary`,children:[(0,$.jsx)(lt,{className:`size-3`}),` Loading diff...`]}):o?(0,$.jsxs)(`div`,{className:`p-2 font-mono text-[10px] text-destructive-foreground`,children:[`Error: `,o]}):(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,$.jsx)(`button`,{onClick:e=>{e.stopPropagation(),navigator.clipboard.writeText(a),E(n),setTimeout(()=>E(``),2e3)},className:`cursor-pointer rounded-lg border border-border bg-card p-1.5 text-muted-foreground shadow-sm transition-colors hover:bg-accent hover:text-foreground`,title:`Copy Diff`,children:T===n?(0,$.jsx)(Fn,{size:12,className:`text-success-foreground`}):(0,$.jsx)(In,{size:12})})}),O(a)]})})]},t.file)})})]},e.repoName)})})]})},Ga=({ws:e,knowledgeContent:t,knowledgeLoading:n,isEditingKnowledge:r,editedKnowledge:i,saveKnowledgeLoading:a,setEditedKnowledge:o,setIsEditingKnowledge:s,handleSaveKnowledge:c})=>(0,$.jsxs)(`div`,{className:`rounded-xl border border-border bg-card p-4`,children:[(0,$.jsxs)(`header`,{className:`flex justify-between items-center mb-4`,children:[(0,$.jsxs)(`h4`,{className:`flex items-center gap-2 text-sm font-bold text-foreground`,children:[(0,$.jsx)(mn,{size:16,className:`text-info`}),` Persistent Knowledge Memory (nexusflow-knowledge.md)`]}),(0,$.jsx)(`div`,{className:`flex gap-2`,children:r?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(f,{variant:`outline`,size:`xs`,onClick:()=>{o(t),s(!1)},disabled:a,children:`Cancel`}),(0,$.jsxs)(f,{size:`xs`,onClick:()=>c(e.branchName),disabled:a,children:[a?(0,$.jsx)(lt,{className:`size-3`}):(0,$.jsx)(mr,{size:10}),` Save`]})]}):(0,$.jsxs)(f,{variant:`outline`,size:`xs`,onClick:()=>s(!0),disabled:n,children:[(0,$.jsx)(gr,{size:10}),` Edit Knowledge`]})})]}),n?(0,$.jsx)(`div`,{className:`flex justify-center py-10`,children:(0,$.jsx)(sn,{className:`animate-spin text-primary`,size:20})}):r?(0,$.jsx)(tr,{className:`[&_[data-slot=textarea]]:h-96 [&_[data-slot=textarea]]:resize-y [&_[data-slot=textarea]]:font-mono [&_[data-slot=textarea]]:text-xs`,value:i,onChange:e=>o(e.target.value)}):(0,$.jsx)(`div`,{className:`max-h-96 overflow-auto whitespace-pre-wrap rounded-xl border border-border bg-muted/40 p-4 font-mono text-xs leading-relaxed text-muted-foreground`,children:t||`No knowledge file generated yet.`})]}),Ka=({planContent:e,planLoading:t})=>(0,$.jsxs)(`div`,{className:`rounded-xl border border-border bg-card p-4`,children:[(0,$.jsx)(`header`,{className:`flex justify-between items-center mb-4`,children:(0,$.jsxs)(`h4`,{className:`flex items-center gap-2 text-sm font-bold text-foreground`,children:[(0,$.jsx)(sr,{size:16,className:`text-info`}),` Inter-Repo Implementation Plan (nexusflow-plan.md)`]})}),t?(0,$.jsx)(`div`,{className:`flex justify-center py-10`,children:(0,$.jsx)(sn,{className:`animate-spin text-primary`,size:20})}):(0,$.jsx)(`div`,{className:`max-h-96 overflow-auto whitespace-pre-wrap rounded-xl border border-border bg-muted/40 p-4 font-mono text-xs leading-relaxed text-muted-foreground`,children:e||`No implementation plan generated yet.`})]}),qa=e=>`nexusflow_chat_${e}`,Ja=()=>({v:4,sessions:{},providerId:null,profilesByProvider:{"claude-cli":`review`,"codex-cli":`review`},messages:[]});function Ya(e){try{let t=localStorage.getItem(qa(e));if(!t)return Ja();let n=JSON.parse(t);if(Array.isArray(n))return{...Ja(),messages:n.filter(e=>e&&typeof e.content==`string`&&(e.role===`user`||e.role===`assistant`)).map(e=>({role:e.role,content:e.content}))};if(n&&n.v===4&&n.sessions&&Array.isArray(n.messages)){let e=Object.fromEntries(Object.entries(n.profilesByProvider??{}).filter(e=>Bn(e[1])));return{...Ja(),sessions:n.sessions,providerId:typeof n.providerId==`string`?n.providerId:null,profilesByProvider:{...Ja().profilesByProvider,...e},messages:n.messages}}if(n&&n.v===3&&n.sessions&&Array.isArray(n.messages))return{...Ja(),sessions:n.sessions,providerId:typeof n.providerId==`string`?n.providerId:null,messages:n.messages};if(n&&n.v===2&&Array.isArray(n.messages)){let e={};return typeof n.sessionId==`string`&&n.sessionId&&(e[`claude-cli`]={id:n.sessionId,started:!!n.sessionStarted}),{v:4,sessions:e,providerId:typeof n.providerId==`string`?n.providerId:null,profilesByProvider:Ja().profilesByProvider,messages:n.messages}}return Ja()}catch{return Ja()}}var Xa=500;function Za(e,t){try{let n=t.messages.length>Xa?{...t,messages:t.messages.slice(-500)}:t;localStorage.setItem(qa(e),JSON.stringify(n))}catch(e){console.error(`Failed to save chat to localStorage`,e)}}function Qa(e){try{localStorage.removeItem(qa(e))}catch{}}function $a({open:e,onClose:t,ws:n,onPick:r,error:i,pending:a=!1}){let[o,s]=(0,Z.useState)([]),[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(null);(0,Z.useEffect)(()=>{e&&(l(!0),d(null),fetch(`/api/workspace/${encodeURIComponent(n.branchName)}/sessions`).then(e=>e.json()).then(e=>{let t=(e.sessions||[]).filter(e=>e.assistant===`claude`||e.assistant===`codex`||e.assistant===`antigravity`||e.assistant===`copilot`);s(t)}).catch(()=>d(`Failed to load sessions.`)).finally(()=>l(!1)))},[e,n.branchName]);let f=e=>{switch(e){case`codex`:return`Codex`;case`antigravity`:return`Antigravity`;case`copilot`:return`Copilot`;default:return`Claude`}};return(0,$.jsx)(Wn,{open:e,onOpenChange:e=>!e&&t(),children:(0,$.jsxs)(jn,{className:`max-w-lg`,children:[(0,$.jsx)(Hn,{children:(0,$.jsx)(kn,{children:`Resume a past session`})}),(0,$.jsxs)(zn,{className:`flex max-h-[60vh] flex-col gap-2`,children:[(i||u)&&(0,$.jsx)(`div`,{className:`rounded-lg border border-destructive/25 bg-destructive/10 px-3 py-2 text-xs text-destructive-foreground`,children:i||u}),c?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(nr,{className:`h-14`}),(0,$.jsx)(nr,{className:`h-14`}),(0,$.jsx)(nr,{className:`h-14`})]}):o.length===0?(0,$.jsx)(er,{children:(0,$.jsxs)($n,{children:[(0,$.jsx)(Zn,{variant:`icon`,children:(0,$.jsx)(ar,{})}),(0,$.jsx)(Xn,{children:`No resumable sessions found`}),(0,$.jsx)(Qn,{children:`Past conversations for this workspace will show up here.`})]})}):o.map(e=>(0,$.jsxs)(`button`,{onClick:()=>r(e),disabled:a,className:`cursor-pointer rounded-lg border border-border bg-card p-3 text-left transition-colors hover:border-foreground/15 hover:bg-accent/50 disabled:cursor-wait disabled:opacity-60`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase text-muted-foreground`,children:f(e.assistant)}),(0,$.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,title:e.title,children:e.title})]}),(0,$.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-[11px] text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:a?`Loading transcript…`:new Date(e.updatedAt).toLocaleString()}),(0,$.jsx)(`span`,{children:`·`}),(0,$.jsx)(ur,{size:11}),(0,$.jsxs)(`span`,{children:[e.messageCount,` messages`]})]})]},e.id))]})]})})}var eo=m(((e,t)=>{var n=[[{color:`0, 0, 0`,class:`ansi-black`},{color:`187, 0, 0`,class:`ansi-red`},{color:`0, 187, 0`,class:`ansi-green`},{color:`187, 187, 0`,class:`ansi-yellow`},{color:`0, 0, 187`,class:`ansi-blue`},{color:`187, 0, 187`,class:`ansi-magenta`},{color:`0, 187, 187`,class:`ansi-cyan`},{color:`255,255,255`,class:`ansi-white`}],[{color:`85, 85, 85`,class:`ansi-bright-black`},{color:`255, 85, 85`,class:`ansi-bright-red`},{color:`0, 255, 0`,class:`ansi-bright-green`},{color:`255, 255, 85`,class:`ansi-bright-yellow`},{color:`85, 85, 255`,class:`ansi-bright-blue`},{color:`255, 85, 255`,class:`ansi-bright-magenta`},{color:`85, 255, 255`,class:`ansi-bright-cyan`},{color:`255, 255, 255`,class:`ansi-bright-white`}]],r=/(https?:\/\/(?:[A-Za-z0-9#;/?:@=+$',_.!~*()[\]-]|&|%[A-Fa-f0-9]{2})+)/gm;t.exports=class e{static escapeForHtml(t){return new e().escapeForHtml(t)}static linkify(t){return new e().linkify(t)}static ansiToHtml(t,n){return new e().ansiToHtml(t,n)}static ansiToJson(t,n){return new e().ansiToJson(t,n)}static ansiToText(t){return new e().ansiToText(t)}constructor(){this.fg=this.bg=this.fg_truecolor=this.bg_truecolor=null,this.bright=0,this.decorations=[]}setupPalette(){this.PALETTE_COLORS=[];for(let e=0;e<2;++e)for(let t=0;t<8;++t)this.PALETTE_COLORS.push(n[e][t].color);let e=[0,95,135,175,215,255],t=(t,n,r)=>e[t]+`, `+e[n]+`, `+e[r];for(let e=0;e<6;++e)for(let n=0;n<6;++n)for(let r=0;r<6;++r)this.PALETTE_COLORS.push(t(e,n,r));let r=8;for(let e=0;e<24;++e,r+=10)this.PALETTE_COLORS.push(r+`, `+r+`, `+r)}escapeForHtml(e){return e.replace(/[&<>\"]/gm,e=>e==`&`?`&`:e==`"`?`"`:e==`<`?`<`:e==`>`?`>`:``)}linkify(e){return e.replace(r,e=>`<a href="${e}">${e}</a>`)}ansiToHtml(e,t){return this.process(e,t,!0)}ansiToJson(e,t){return t||={},t.json=!0,t.clearLine=!1,this.process(e,t,!0)}ansiToText(e){return this.process(e,{},!1)}process(e,t,n){let r=this,i=e.split(/\033\[/),a=i.shift();t??={},t.clearLine=/\r/.test(e);let o=i.map(e=>this.processChunk(e,t,n));if(t&&t.json){let e=r.processChunkJson(``);return e.content=a,e.clearLine=t.clearLine,o.unshift(e),t.remove_empty&&(o=o.filter(e=>!e.isEmpty())),o}else o.unshift(a);return o.join(``)}processChunkJson(e,t,r){t=t===void 0?{}:t;let i=t.use_classes=t.use_classes!==void 0&&t.use_classes,a=t.key=i?`class`:`color`,o={content:e,fg:null,bg:null,fg_truecolor:null,bg_truecolor:null,isInverted:!1,clearLine:t.clearLine,decoration:null,decorations:[],was_processed:!1,isEmpty:()=>!o.content},s=e.match(/^([!\x3c-\x3f]*)([\d;]*)([\x20-\x2c]*[\x40-\x7e])([\s\S]*)/m);if(!s)return o;o.content=s[4];let c=s[2].split(`;`);if(s[1]!==``||s[3]!==`m`||!r)return o;let l=this;for(;c.length>0;){let e=c.shift(),t=parseInt(e);if(isNaN(t)||t===0)l.fg=l.bg=null,l.decorations=[];else if(t===1)l.decorations.push(`bold`);else if(t===2)l.decorations.push(`dim`);else if(t===3)l.decorations.push(`italic`);else if(t===4)l.decorations.push(`underline`);else if(t===5)l.decorations.push(`blink`);else if(t===7)l.decorations.push(`reverse`);else if(t===8)l.decorations.push(`hidden`);else if(t===9)l.decorations.push(`strikethrough`);else if(t===21)l.removeDecoration(`bold`);else if(t===22)l.removeDecoration(`bold`),l.removeDecoration(`dim`);else if(t===23)l.removeDecoration(`italic`);else if(t===24)l.removeDecoration(`underline`);else if(t===25)l.removeDecoration(`blink`);else if(t===27)l.removeDecoration(`reverse`);else if(t===28)l.removeDecoration(`hidden`);else if(t===29)l.removeDecoration(`strikethrough`);else if(t===39)l.fg=null;else if(t===49)l.bg=null;else if(t>=30&&t<38)l.fg=n[0][t%10][a];else if(t>=90&&t<98)l.fg=n[1][t%10][a];else if(t>=40&&t<48)l.bg=n[0][t%10][a];else if(t>=100&&t<108)l.bg=n[1][t%10][a];else if(t===38||t===48){let e=t===38;if(c.length>=1){let t=c.shift();if(t===`5`&&c.length>=1){let t=parseInt(c.shift());if(t>=0&&t<=255)if(!i)this.PALETTE_COLORS||l.setupPalette(),e?l.fg=this.PALETTE_COLORS[t]:l.bg=this.PALETTE_COLORS[t];else{let r=t>=16?`ansi-palette-`+t:n[+(t>7)][t%8].class;e?l.fg=r:l.bg=r}}else if(t===`2`&&c.length>=3){let t=parseInt(c.shift()),n=parseInt(c.shift()),r=parseInt(c.shift());if(t>=0&&t<=255&&n>=0&&n<=255&&r>=0&&r<=255){let a=t+`, `+n+`, `+r;i?e?(l.fg=`ansi-truecolor`,l.fg_truecolor=a):(l.bg=`ansi-truecolor`,l.bg_truecolor=a):e?l.fg=a:l.bg=a}}}}}return l.fg===null&&l.bg===null&&l.decorations.length===0?o:(o.fg=l.fg,o.bg=l.bg,o.fg_truecolor=l.fg_truecolor,o.bg_truecolor=l.bg_truecolor,o.decorations=l.decorations,o.decoration=l.decorations.slice(-1).pop()||null,o.was_processed=!0,o)}processChunk(e,t,r){t||={};let i=this.processChunkJson(e,t,r),a=t.use_classes;if(i.decorations=i.decorations.filter(e=>{if(e===`reverse`){i.fg||=n[0][7][a?`class`:`color`],i.bg||=n[0][0][a?`class`:`color`];let e=i.fg;i.fg=i.bg,i.bg=e;let t=i.fg_truecolor;return i.fg_truecolor=i.bg_truecolor,i.bg_truecolor=t,i.isInverted=!0,!1}return!0}),t.json)return i;if(i.isEmpty())return``;if(!i.was_processed)return i.content;let o=[],s=[],c=[],l={},u=e=>{let t=[],n;for(n in e)e.hasOwnProperty(n)&&t.push(`data-`+n+`="`+this.escapeForHtml(e[n])+`"`);return t.length>0?` `+t.join(` `):``};return i.isInverted&&(l[`ansi-is-inverted`]=`true`),i.fg&&(a?(o.push(i.fg+`-fg`),i.fg_truecolor!==null&&(l[`ansi-truecolor-fg`]=i.fg_truecolor,i.fg_truecolor=null)):o.push(`color:rgb(`+i.fg+`)`)),i.bg&&(a?(o.push(i.bg+`-bg`),i.bg_truecolor!==null&&(l[`ansi-truecolor-bg`]=i.bg_truecolor,i.bg_truecolor=null)):o.push(`background-color:rgb(`+i.bg+`)`)),i.decorations.forEach(e=>{if(a){s.push(`ansi-`+e);return}e===`bold`?s.push(`font-weight:bold`):e===`dim`?s.push(`opacity:0.5`):e===`italic`?s.push(`font-style:italic`):e===`hidden`?s.push(`visibility:hidden`):e===`strikethrough`?c.push(`line-through`):c.push(e)}),c.length&&s.push(`text-decoration:`+c.join(` `)),a?`<span class="`+o.concat(s).join(` `)+`"`+u(l)+`>`+i.content+`</span>`:`<span style="`+o.concat(s).join(`;`)+`"`+u(l)+`>`+i.content+`</span>`}removeDecoration(e){let t=this.decorations.indexOf(e);t>=0&&this.decorations.splice(t,1)}}})),to=m(((e,t)=>{function n(e){if(!e)return``;if(!/\r/.test(e))return e;for(e=e.replace(/\r+\n/gm,`
|
|
3
|
+
`);/\r./.test(e);)e=e.replace(/^([^\r\n]*)\r+([^\r\n]+)/gm,function(e,t,n){return n+t.slice(n.length)});return e}function r(e){for(var t=0,n=0;n<e.length;n++)e[t].length<=e[n].length&&(t=n);return t}function i(e){if(!/\r/.test(e))return e;for(var t=e.split(`\r`),n=[];t.length>0;){var i=r(t);n.push(t[i]),t=t.slice(i+1)}return n.join(`\r`)}function a(e){if(!e)return``;if(!/\r/.test(e))return e;if(!/\n/.test(e))return i(e);e=e.replace(/\r+\n/gm,`
|
|
4
|
+
`);var t=e.lastIndexOf(`
|
|
5
|
+
`);return n(e.slice(0,t))+`
|
|
6
|
+
`+i(e.slice(t+1))}t.exports=n,t.exports.escapeCarriageReturn=n,t.exports.escapeCarriageReturnSafe=a})),no=m(((e,t)=>{t.exports=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/})),ro=m(((e,t)=>{t.exports=/[\0-\x1F\x7F-\x9F]/})),io=m(((e,t)=>{t.exports=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/})),ao=m(((e,t)=>{t.exports=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4E\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDF55-\uDF59]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD806[\uDC3B\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/})),oo=m(((e,t)=>{t.exports=function(e){var t={};t.src_Any=no().source,t.src_Cc=ro().source,t.src_Z=io().source,t.src_P=ao().source,t.src_ZPCc=[t.src_Z,t.src_P,t.src_Cc].join(`|`),t.src_ZCc=[t.src_Z,t.src_Cc].join(`|`);var n=`[><|]`;return t.src_pseudo_letter=`(?:(?!`+n+`|`+t.src_ZPCc+`)`+t.src_Any+`)`,t.src_ip4=`(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)`,t.src_auth=`(?:(?:(?!`+t.src_ZCc+`|[@/\\[\\]()]).)+@)?`,t.src_port=`(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?`,t.src_host_terminator=`(?=$|`+n+`|`+t.src_ZPCc+`)(?!-|_|:\\d|\\.-|\\.(?!$|`+t.src_ZPCc+`))`,t.src_path=`(?:[/?#](?:(?!`+t.src_ZCc+`|`+n+`|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!`+t.src_ZCc+`|\\]).)*\\]|\\((?:(?!`+t.src_ZCc+`|[)]).)*\\)|\\{(?:(?!`+t.src_ZCc+`|[}]).)*\\}|\\"(?:(?!`+t.src_ZCc+`|["]).)+\\"|\\'(?:(?!`+t.src_ZCc+`|[']).)+\\'|\\'(?=`+t.src_pseudo_letter+`|[-]).|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!`+t.src_ZCc+`|[.]).|`+(e&&e[`---`]?`\\-(?!--(?:[^-]|$))(?:-*)|`:`\\-+|`)+`,(?!`+t.src_ZCc+`).|;(?!`+t.src_ZCc+`).|\\!+(?!`+t.src_ZCc+`|[!]).|\\?(?!`+t.src_ZCc+`|[?]).)+|\\/)?`,t.src_email_name=`[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*`,t.src_xn=`xn--[a-z0-9\\-]{1,59}`,t.src_domain_root=`(?:`+t.src_xn+`|`+t.src_pseudo_letter+`{1,63})`,t.src_domain=`(?:`+t.src_xn+`|(?:`+t.src_pseudo_letter+`)|(?:`+t.src_pseudo_letter+`(?:-|`+t.src_pseudo_letter+`){0,61}`+t.src_pseudo_letter+`))`,t.src_host=`(?:(?:(?:(?:`+t.src_domain+`)\\.)*`+t.src_domain+`))`,t.tpl_host_fuzzy=`(?:`+t.src_ip4+`|(?:(?:(?:`+t.src_domain+`)\\.)+(?:%TLDS%)))`,t.tpl_host_no_ip_fuzzy=`(?:(?:(?:`+t.src_domain+`)\\.)+(?:%TLDS%))`,t.src_host_strict=t.src_host+t.src_host_terminator,t.tpl_host_fuzzy_strict=t.tpl_host_fuzzy+t.src_host_terminator,t.src_host_port_strict=t.src_host+t.src_port+t.src_host_terminator,t.tpl_host_port_fuzzy_strict=t.tpl_host_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_port_no_ip_fuzzy_strict=t.tpl_host_no_ip_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_fuzzy_test=`localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:`+t.src_ZPCc+`|>|$))`,t.tpl_email_fuzzy=`(^|`+n+`|"|\\(|`+t.src_ZCc+`)(`+t.src_email_name+`@`+t.tpl_host_fuzzy_strict+`)`,t.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_fuzzy_strict+t.src_path+`)`,t.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_no_ip_fuzzy_strict+t.src_path+`)`,t}})),so=m(((e,t)=>{function n(e){return Array.prototype.slice.call(arguments,1).forEach(function(t){t&&Object.keys(t).forEach(function(n){e[n]=t[n]})}),e}function r(e){return Object.prototype.toString.call(e)}function i(e){return r(e)===`[object String]`}function a(e){return r(e)===`[object Object]`}function o(e){return r(e)===`[object RegExp]`}function s(e){return r(e)===`[object Function]`}function c(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,`\\$&`)}var l={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function u(e){return Object.keys(e||{}).reduce(function(e,t){return e||l.hasOwnProperty(t)},!1)}var d={"http:":{validate:function(e,t,n){var r=e.slice(t);return n.re.http||(n.re.http=RegExp(`^\\/\\/`+n.re.src_auth+n.re.src_host_port_strict+n.re.src_path,`i`)),n.re.http.test(r)?r.match(n.re.http)[0].length:0}},"https:":`http:`,"ftp:":`http:`,"//":{validate:function(e,t,n){var r=e.slice(t);return n.re.no_http||(n.re.no_http=RegExp(`^`+n.re.src_auth+`(?:localhost|(?:(?:`+n.re.src_domain+`)\\.)+`+n.re.src_domain_root+`)`+n.re.src_port+n.re.src_host_terminator+n.re.src_path,`i`)),n.re.no_http.test(r)?t>=3&&e[t-3]===`:`||t>=3&&e[t-3]===`/`?0:r.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,n){var r=e.slice(t);return n.re.mailto||(n.re.mailto=RegExp(`^`+n.re.src_email_name+`@`+n.re.src_host_strict,`i`)),n.re.mailto.test(r)?r.match(n.re.mailto)[0].length:0}}},f=`a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]`,p=`biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф`.split(`|`);function m(e){e.__index__=-1,e.__text_cache__=``}function h(e){return function(t,n){var r=t.slice(n);return e.test(r)?r.match(e)[0].length:0}}function g(){return function(e,t){t.normalize(e)}}function _(e){var t=e.re=oo()(e.__opts__),n=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||n.push(f),n.push(t.src_xn),t.src_tlds=n.join(`|`);function r(e){return e.replace(`%TLDS%`,t.src_tlds)}t.email_fuzzy=RegExp(r(t.tpl_email_fuzzy),`i`),t.link_fuzzy=RegExp(r(t.tpl_link_fuzzy),`i`),t.link_no_ip_fuzzy=RegExp(r(t.tpl_link_no_ip_fuzzy),`i`),t.host_fuzzy_test=RegExp(r(t.tpl_host_fuzzy_test),`i`);var l=[];e.__compiled__={};function u(e,t){throw Error(`(LinkifyIt) Invalid schema "`+e+`": `+t)}Object.keys(e.__schemas__).forEach(function(t){var n=e.__schemas__[t];if(n!==null){var r={validate:null,link:null};if(e.__compiled__[t]=r,a(n)){o(n.validate)?r.validate=h(n.validate):s(n.validate)?r.validate=n.validate:u(t,n),s(n.normalize)?r.normalize=n.normalize:n.normalize?u(t,n):r.normalize=g();return}if(i(n)){l.push(t);return}u(t,n)}}),l.forEach(function(t){e.__compiled__[e.__schemas__[t]]&&(e.__compiled__[t].validate=e.__compiled__[e.__schemas__[t]].validate,e.__compiled__[t].normalize=e.__compiled__[e.__schemas__[t]].normalize)}),e.__compiled__[``]={validate:null,normalize:g()};var d=Object.keys(e.__compiled__).filter(function(t){return t.length>0&&e.__compiled__[t]}).map(c).join(`|`);e.re.schema_test=RegExp(`(^|(?!_)(?:[><|]|`+t.src_ZPCc+`))(`+d+`)`,`i`),e.re.schema_search=RegExp(`(^|(?!_)(?:[><|]|`+t.src_ZPCc+`))(`+d+`)`,`ig`),e.re.pretest=RegExp(`(`+e.re.schema_test.source+`)|(`+e.re.host_fuzzy_test.source+`)|@`,`i`),m(e)}function v(e,t){var n=e.__index__,r=e.__last_index__,i=e.__text_cache__.slice(n,r);this.schema=e.__schema__.toLowerCase(),this.index=n+t,this.lastIndex=r+t,this.raw=i,this.text=i,this.url=i}function y(e,t){var n=new v(e,t);return e.__compiled__[n.schema].normalize(n,e),n}function b(e,t){if(!(this instanceof b))return new b(e,t);t||u(e)&&(t=e,e={}),this.__opts__=n({},l,t),this.__index__=-1,this.__last_index__=-1,this.__schema__=``,this.__text_cache__=``,this.__schemas__=n({},d,e),this.__compiled__={},this.__tlds__=p,this.__tlds_replaced__=!1,this.re={},_(this)}b.prototype.add=function(e,t){return this.__schemas__[e]=t,_(this),this},b.prototype.set=function(e){return this.__opts__=n(this.__opts__,e),this},b.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;var t,n,r,i,a,o,s,c,l;if(this.re.schema_test.test(e)){for(s=this.re.schema_search,s.lastIndex=0;(t=s.exec(e))!==null;)if(i=this.testSchemaAt(e,t[2],s.lastIndex),i){this.__schema__=t[2],this.__index__=t.index+t[1].length,this.__last_index__=t.index+t[0].length+i;break}}return this.__opts__.fuzzyLink&&this.__compiled__[`http:`]&&(c=e.search(this.re.host_fuzzy_test),c>=0&&(this.__index__<0||c<this.__index__)&&(n=e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))!==null&&(a=n.index+n[1].length,(this.__index__<0||a<this.__index__)&&(this.__schema__=``,this.__index__=a,this.__last_index__=n.index+n[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__[`mailto:`]&&(l=e.indexOf(`@`),l>=0&&(r=e.match(this.re.email_fuzzy))!==null&&(a=r.index+r[1].length,o=r.index+r[0].length,(this.__index__<0||a<this.__index__||a===this.__index__&&o>this.__last_index__)&&(this.__schema__=`mailto:`,this.__index__=a,this.__last_index__=o))),this.__index__>=0},b.prototype.pretest=function(e){return this.re.pretest.test(e)},b.prototype.testSchemaAt=function(e,t,n){return this.__compiled__[t.toLowerCase()]?this.__compiled__[t.toLowerCase()].validate(e,n,this):0},b.prototype.match=function(e){var t=0,n=[];this.__index__>=0&&this.__text_cache__===e&&(n.push(y(this,t)),t=this.__last_index__);for(var r=t?e.slice(t):e;this.test(r);)n.push(y(this,t)),r=r.slice(this.__last_index__),t+=this.__last_index__;return n.length?n:null},b.prototype.tlds=function(e,t){return e=Array.isArray(e)?e:[e],t?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(e,t,n){return e!==n[t-1]}).reverse(),_(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,_(this),this)},b.prototype.normalize=function(e){e.schema||(e.url=`http://`+e.url),e.schema===`mailto:`&&!/^mailto:/i.test(e.url)&&(e.url=`mailto:`+e.url)},b.prototype.onCompile=function(){},t.exports=b})),co=n(m((t=>{var n=t&&t.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),r=t&&t.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),i=t&&t.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},e(t)};return function(t){if(t&&t.__esModule)return t;var i={};if(t!=null)for(var a=e(t),o=0;o<a.length;o++)a[o]!=="default"&&n(i,t,a[o]);return r(i,t),i}})(),a=t&&t.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.default=g;var o=a(eo()),s=to(),c=a(so()),l=i(e());function u(e,t=!1){return e=(0,s.escapeCarriageReturn)(_(e)),o.default.ansiToJson(e,{json:!0,remove_empty:!0,use_classes:t})}function d(e){let t=``;return e.bg&&(t+=`${e.bg}-bg `),e.fg&&(t+=`${e.fg}-fg `),e.decoration&&(t+=`ansi-${e.decoration} `),t===``?null:(t=t.substring(0,t.length-1),t)}function f(e){let t={};switch(e.bg&&(t.backgroundColor=`rgb(${e.bg})`),e.fg&&(t.color=`rgb(${e.fg})`),e.decoration){case`bold`:t.fontWeight=`bold`;break;case`dim`:t.opacity=`0.5`;break;case`italic`:t.fontStyle=`italic`;break;case`hidden`:t.visibility=`hidden`;break;case`strikethrough`:t.textDecoration=`line-through`;break;case`underline`:t.textDecoration=`underline`;break;case`blink`:t.textDecoration=`blink`;break;default:break}return t}function p(e,t,n,r){let i=t?null:f(n),a=t?d(n):null;return e?e===`fuzzy`?h(n,r,i,a):m(n,r,i,a):l.createElement(`span`,{style:i,key:r,className:a},n.content)}function m(e,t,n,r){let i=[],a=/(\s|^)(https?:\/\/(?:www\.|(?!www))[^\s.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/g,o=0,s;for(;(s=a.exec(e.content))!==null;){let[,t,n]=s,r=s.index+t.length;r>o&&i.push(e.content.substring(o,r));let c=n.startsWith(`www.`)?`http://${n}`:n;i.push(l.createElement(`a`,{key:o,href:c,target:`_blank`},`${n}`)),o=a.lastIndex}return o<e.content.length&&i.push(e.content.substring(o)),l.createElement(`span`,{style:n,key:t,className:r},i)}function h(e,t,n,r){let i=(0,c.default)({fuzzyEmail:!1}).tlds([`io`],!0);if(!i.pretest(e.content))return l.createElement(`span`,{style:n,key:t,className:r},e.content);let a=i.match(e.content);if(!a)return l.createElement(`span`,{style:n,key:t,className:r},e.content);let o=[e.content.substring(0,a[0]?.index)];return a.forEach((t,n)=>{o.push(l.createElement(`a`,{href:t.url,target:`_blank`,key:n},e.content.substring(t.index,t.lastIndex))),a[n+1]&&o.push(e.content.substring(a[n].lastIndex,a[n+1]?.index))}),a[a.length-1].lastIndex!==e.content.length&&o.push(e.content.substring(a[a.length-1].lastIndex,e.content.length)),l.createElement(`span`,{style:n,key:t,className:r},o)}function g(e){let{className:t,useClasses:n,children:r,linkify:i}=e;return l.createElement(`code`,{className:t},u(r??``,n??!1).map(p.bind(null,i??!1,n??!1)))}function _(e){let t=e;do e=t,t=e.replace(/[^\n]\x08/gm,``);while(t.length<e.length);return e}}))(),1),lo=co.default.default||co.default,uo={"claude-cli":new Set([`npm install -g @anthropic-ai/claude-code`,`claude auth login`,`claude auth status --json`]),"codex-cli":new Set([`npm install -g @openai/codex`,`codex login`,`codex login status`])},fo=new Set([`native-api`,`cli-print`,`acp`]),po=new Set([`none`,`client-assigned`,`provider-assigned`]),mo=new Set([`read-only`,`workspace-write`,`harness-managed`]),ho=new Set([`uuid`,`opaque`]),go=new Set([`missing-cli`,`signed-out`,`probe-failed`]);function _o(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function vo(e){return e===void 0||typeof e==`string`}function yo(e){return!_o(e)||typeof e.transport!=`string`||!fo.has(e.transport)||typeof e.sessionIdentity!=`string`||!po.has(e.sessionIdentity)||typeof e.workspaceAccess!=`string`||!mo.has(e.workspaceAccess)||e.sessionIdFormat!==void 0&&(typeof e.sessionIdFormat!=`string`||!ho.has(e.sessionIdFormat))?null:{transport:e.transport,sessionIdentity:e.sessionIdentity,workspaceAccess:e.workspaceAccess,...e.sessionIdFormat===void 0?{}:{sessionIdFormat:e.sessionIdFormat}}}function bo(e){if(!_o(e)||typeof e.id!=`string`||typeof e.name!=`string`||typeof e.isConfigured!=`boolean`||!vo(e.icon)||!vo(e.accessLabel)||!vo(e.message)||!vo(e.recoveryCommand)||!vo(e.recoveryLabel)||e.setupIssue!==void 0&&(typeof e.setupIssue!=`string`||!go.has(e.setupIssue)))return null;let t=yo(e.capabilities);if(!t)return null;let n;if(e.executionProfiles!==void 0){if(!Array.isArray(e.executionProfiles)||e.executionProfiles.length===0)return null;n=[];let t=new Set;for(let r of e.executionProfiles){if(!_o(r)||!Bn(r.id)||typeof r.label!=`string`||typeof r.description!=`string`||t.has(r.id))return null;t.add(r.id),n.push({id:r.id,label:r.label,description:r.description})}}if(e.defaultExecutionProfile!==void 0&&(!Bn(e.defaultExecutionProfile)||!n?.some(t=>t.id===e.defaultExecutionProfile))||n&&e.defaultExecutionProfile===void 0||!n&&e.defaultExecutionProfile!==void 0)return null;let r=e.setupIssue!==void 0||e.recoveryCommand!==void 0||e.recoveryLabel!==void 0,i=e.setupIssue!==void 0&&e.recoveryCommand!==void 0&&e.recoveryLabel!==void 0;return r&&!i||e.isConfigured&&r?null:{id:e.id,name:e.name,isConfigured:e.isConfigured,capabilities:t,...e.icon===void 0?{}:{icon:e.icon},...e.accessLabel===void 0?{}:{accessLabel:e.accessLabel},...e.message===void 0?{}:{message:e.message},...e.setupIssue===void 0?{}:{setupIssue:e.setupIssue},...e.recoveryCommand===void 0?{}:{recoveryCommand:e.recoveryCommand},...e.recoveryLabel===void 0?{}:{recoveryLabel:e.recoveryLabel},...n===void 0?{}:{executionProfiles:n},...e.defaultExecutionProfile===void 0?{}:{defaultExecutionProfile:e.defaultExecutionProfile}}}function xo(e){if(!Array.isArray(e))return null;let t=[];for(let n of e){let e=bo(n);if(!e)return null;t.push(e)}return t}function So(e){return!e.recoveryCommand||!uo[e.id]?.has(e.recoveryCommand)?null:{command:e.recoveryCommand,label:e.recoveryLabel??`Copy recovery command`}}var Co=e=>e?new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):null,wo=(0,Z.memo)(function({msg:e,idx:t,copied:n,onCopy:r}){if(e.role===`system`)return(0,$.jsx)(`div`,{className:`flex justify-center`,children:(0,$.jsx)(`span`,{className:c(`rounded-full border px-3 py-1 text-center text-[11px]`,e.kind===`error`?`border-destructive/25 bg-destructive/10 text-destructive-foreground`:`border-border bg-muted text-muted-foreground`),children:e.content})});let i=e.role===`user`,a=!i&&e.content.includes(`\x1B`);return(0,$.jsxs)(`div`,{className:`flex flex-col ${i?`items-end`:`items-start`}`,children:[(0,$.jsx)(`div`,{className:`group relative max-w-[85%] rounded-lg p-3 ${i?`bg-primary text-primary-foreground`:`border border-border bg-card text-foreground`}`,children:i?(0,$.jsx)(`div`,{className:`whitespace-pre-wrap text-sm`,children:e.content}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a?(0,$.jsx)(`div`,{className:`overflow-x-auto whitespace-pre-wrap rounded-md bg-muted/50 p-2 font-mono text-xs text-foreground`,children:(0,$.jsx)(lo,{children:e.content})}):(0,$.jsx)(hn,{content:e.content}),(0,$.jsx)(`button`,{onClick:()=>r(t,e.content),className:`absolute -right-2.5 -top-2.5 hidden h-6 w-6 cursor-pointer place-items-center rounded-md border border-border bg-card text-muted-foreground shadow-sm hover:text-foreground group-hover:grid`,title:`Copy message`,children:n?(0,$.jsx)(Fn,{size:12,className:`text-success-foreground`}):(0,$.jsx)(In,{size:12})})]})}),i&&e.executionProfile&&(0,$.jsx)(`span`,{className:`mt-1 rounded border border-border px-1.5 py-0.5 text-[9px] font-medium uppercase tracking-wide text-muted-foreground`,children:e.executionProfile===`workspace-write`?`Edit`:`Review`}),e.ts&&(0,$.jsx)(`span`,{className:`mt-1 text-[10px] text-muted-foreground`,children:Co(e.ts)})]})});function To({ws:e}){let t=An(),n=Sn(),[r,i]=(0,Z.useState)([]),[a,o]=(0,Z.useState)(!1),[s]=(0,Z.useState)(()=>Ya(e.branchName)),[l,u]=(0,Z.useState)(s.messages),[d,p]=(0,Z.useState)(``),[m,h]=(0,Z.useState)(!1),[g,_]=(0,Z.useState)(!1),[v,y]=(0,Z.useState)(!1),[b,x]=(0,Z.useState)(``),[S,C]=(0,Z.useState)(s.profilesByProvider),[w,T]=(0,Z.useState)(null),[E,D]=(0,Z.useState)(!1),[O,k]=(0,Z.useState)(0),[A,j]=(0,Z.useState)(!1),[M,N]=(0,Z.useState)(null),[P,F]=(0,Z.useState)(!1),[ee,I]=(0,Z.useState)(null),[te,ne]=(0,Z.useState)(!1),[re,L]=(0,Z.useState)(null),[ie,ae]=(0,Z.useState)(null),R=(0,Z.useRef)(null),oe=(0,Z.useRef)(null),se=(0,Z.useRef)(null),ce=(0,Z.useRef)(!0),z=(0,Z.useRef)(s.sessions),B=(0,Z.useRef)([]),le=(0,Z.useRef)(!1),V=(0,Z.useRef)(!1),ue=(0,Z.useRef)({messages:l,agentName:b,profilesByProvider:S}),de=(0,Z.useRef)(S),fe=(0,Z.useRef)(null),pe=(0,Z.useRef)(null),H=(0,Z.useRef)(!0),me=(0,Z.useRef)(0),he=(0,Z.useRef)(null),ge=(0,Z.useRef)(!1),_e=(0,Z.useRef)({id:0,controller:null}),U=(0,Z.useMemo)(()=>Cn(t.state),[t.state]);(0,Z.useEffect)(()=>{ue.current={messages:l,agentName:b,profilesByProvider:S},de.current=S},[l,b,S]);let ve=(0,Z.useCallback)(()=>{fe.current=null,Za(e.branchName,{v:4,sessions:z.current,providerId:ue.current.agentName||s.providerId,profilesByProvider:ue.current.profilesByProvider,messages:ue.current.messages})},[e.branchName,s.providerId]);(0,Z.useEffect)(()=>{let e=l[l.length-1];(ce.current||e?.role===`user`)&&se.current?.scrollIntoView({behavior:e?.role===`user`?`smooth`:`auto`}),fe.current&&clearTimeout(fe.current),fe.current=setTimeout(ve,400)},[l,b,S,O,ve]),(0,Z.useEffect)(()=>{let e=()=>ve();return window.addEventListener(`pagehide`,e),()=>{window.removeEventListener(`pagehide`,e),fe.current&&clearTimeout(fe.current),ve()}},[ve]),(0,Z.useEffect)(()=>{let e=++me.current,t=new AbortController,n=!0;return fetch(`/api/adapters/status`,{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`,signal:t.signal}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(t=>{if(!n||e!==me.current)return;let r=xo(t);if(!r)throw Error(`Invalid provider status response`);i(r),C(e=>{let t=!1,n={...e};for(let i of r)!i.executionProfiles?.length||!i.defaultExecutionProfile||i.executionProfiles.some(t=>t.id===e[i.id])||(n[i.id]=i.defaultExecutionProfile,t=!0);return t?n:e});let a=(s.providerId?r.find(e=>e.id===s.providerId):void 0)||r.find(e=>e.isConfigured)||r[0];a&&x(e=>e||a.id)}).catch(e=>{n&&e?.name!==`AbortError`&&console.error(`Failed to fetch agent data`,e)}).finally(()=>{n&&e===me.current&&o(!0)}),()=>{n=!1,t.abort()}},[s.providerId]),(0,Z.useEffect)(()=>(H.current=!0,()=>{H.current=!1,_e.current.id+=1,_e.current.controller?.abort(),R.current&&R.current.close()}),[e.branchName,e.workspacePath]);let ye=w??b,W=r.find(e=>e.id===ye),be=W?.executionProfiles?.find(e=>e.id===S[W.id])??W?.executionProfiles?.find(e=>e.id===W.defaultExecutionProfile),xe=!!b&&!!W?.isConfigured&&(!W?.executionProfiles||!!be)&&!E&&!A,Se=(0,Z.useCallback)((e,t)=>{let n=t??r.find(t=>t.id===e);if(!n?.executionProfiles?.length)return;let i=de.current[e];return n.executionProfiles.some(e=>e.id===i)?i:n.defaultExecutionProfile},[r]),G=(0,Z.useCallback)(()=>{le.current=!1,y(!1)},[]),K=(0,Z.useCallback)((e,t)=>{u(n=>[...n,{role:`system`,content:e,kind:t,ts:Date.now()}])},[]),Ce=(0,Z.useCallback)((e,t,n)=>{let r=crypto.randomUUID(),i={role:`user`,content:t,ts:Date.now(),...n?{executionProfile:n}:{}};B.current.push({turnId:r,text:t,message:i});try{e.send(JSON.stringify({type:`input`,input:t,turnId:r,...n?{executionProfile:n}:{}}))}catch(e){throw B.current=B.current.filter(e=>e.turnId!==r),e}u(e=>[...e,i]),p(``),_(!0),G()},[G]),we=(0,Z.useCallback)(()=>{V.current||(V.current=!0,K(`Session ended`,`note`))},[K]),q=(0,Z.useCallback)(()=>{let e=R.current;if(e){if(e.readyState===WebSocket.OPEN)try{e.send(JSON.stringify({type:`stop`}))}catch{}R.current=null,he.current=null,T(null),D(!1),e.close(),h(!1),_(!1),G(),we()}},[G,we]),Te=(0,Z.useCallback)((t=b,n={})=>{if(R.current)return n.onFailure?.(),!1;let i=n.provider??r.find(e=>e.id===t);if(x(t),!i?.isConfigured)return K(i?.message??`The ${t} provider is unavailable. Check its local CLI installation and login.`,`error`),n.onFailure?.(),!1;let a=n.executionProfile??Se(t,i),o=a!==void 0&&i.executionProfiles?.some(e=>e.id===a)===!0;if((n.executionProfile!==void 0||i.executionProfiles?.length)&&!o)return K(`Select a supported execution profile before starting this local CLI.`,`error`),n.onFailure?.(),!1;let s=``;s=s.startsWith(`http`)?s.replace(`http`,`ws`):window.location.origin.replace(`http`,`ws`),s+=`/ws`,V.current=!1;let c=!1,l=!1,f,m=()=>{l||c||!H.current||(l=!0,K(`Could not open the local agent connection. Your current chat was preserved; retry explicitly when ready.`,`error`),n.onFailure?.())};try{f=new WebSocket(s)}catch{return m(),!1}return f.onopen=()=>{if(!H.current||R.current!==f){f.close();return}let r={type:`start`,command:t,cwd:e.workspacePath},o={...z.current};if(n.resetSession&&delete o[t],n.session&&(o[t]=n.session),i.capabilities.sessionIdentity===`client-assigned`){let e=o[t]??{id:crypto.randomUUID(),started:!1};o[t]=e,r.sessionId=e.id,r.resume=e.started}else if(i.capabilities.sessionIdentity===`provider-assigned`){let e=o[t];e?.started&&(r.sessionId=e.id,r.resume=!0)}let s=n.firstMessage===null?``:(n.firstMessage??d).trim(),l;try{if(f.send(JSON.stringify(r)),s){let e=crypto.randomUUID();l={turnId:e,text:s,message:{role:`user`,content:s,ts:Date.now(),...a?{executionProfile:a}:{}}},B.current.push(l),f.send(JSON.stringify({type:`input`,input:s,turnId:e,...a?{executionProfile:a}:{}}))}}catch{l&&(B.current=B.current.filter(e=>e.turnId!==l?.turnId)),m(),R.current=null,he.current=null,T(null),D(!1),f.close();return}z.current=o,c=!0,D(!1),h(!0),n.resetMessagesOnDispatch&&u([]),s&&(u(e=>[...n.resetMessagesOnDispatch?[]:e,l?.message??{role:`user`,content:s,ts:Date.now(),...a?{executionProfile:a}:{}}]),p(``),_(!0),G()),n.onDispatched?.()},f.onmessage=e=>{if(R.current===f)try{let n=JSON.parse(e.data);if(n.type===`stream`){let e=le.current;le.current=!0,y(!0),u(t=>{let r=t[t.length-1];if(e&&r?.role===`assistant`){let e=[...t];return e[e.length-1]={...r,content:r.content+n.text},e}return[...t,{role:`assistant`,content:n.text,ts:Date.now()}]})}else if(n.type===`session`&&typeof n.id==`string`){let e=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(n.id),r=z.current[t],a=i.capabilities.sessionIdentity!==`client-assigned`||r?.id.toLowerCase()===n.id.toLowerCase();if(e&&a){let e=i.capabilities.sessionIdentity===`client-assigned`?r.id:n.id;z.current={...z.current,[t]:{id:e,started:!0}},k(e=>e+1)}else K(`The local CLI returned an unexpected session identity. This turn will not be resumed automatically.`,`error`)}else if(n.type===`accepted`&&typeof n.turnId==`string`)B.current=B.current.filter(e=>e.turnId!==n.turnId);else if(n.type===`status`)_(n.state===`busy`),n.state!==`busy`&&G();else if(n.type===`system`)K(n.message,`note`),G();else if(n.type===`rejected`&&n.reason===`busy`){let e=B.current.findIndex(e=>e.turnId===n.turnId),t=e===-1?void 0:B.current.splice(e,1)[0];t&&(u(e=>e.filter(e=>e!==t.message)),p(e=>e?`${t.text}\n\n${e}`:t.text)),K(typeof n.message==`string`?n.message:`The agent is still processing the current turn.`,`error`)}else n.type===`error`?(B.current=[],K(n.message,`error`),_(!1),G()):n.type===`close`&&(B.current=[],h(!1),_(!1),G(),we(),f.close(),R.current=null)}catch(e){console.error(`Failed to parse WS message`,e)}},f.onclose=()=>{R.current===f&&(c||m(),h(!1),D(!1),_(!1),G(),c&&we(),R.current=null,he.current=null,T(null))},f.onerror=()=>{R.current===f&&(m(),c||(R.current=null,he.current=null,T(null),D(!1),h(!1),f.close()))},R.current=f,he.current=t,T(t),D(!0),!0},[b,K,G,d,we,Se,r,e.repos,e.workspacePath]),Ee=(0,Z.useCallback)(()=>{let e=d.trim(),t=he.current;if(!e||!R.current||!t||g||ge.current)return;let n=r.find(e=>e.id===t),i=Se(t,n);n?.executionProfiles?.length&&!i||Ce(R.current,e,i)},[g,d,Se,r,Ce]),De=(0,Z.useCallback)((e,t)=>{navigator.clipboard.writeText(t).then(()=>{ae(e),setTimeout(()=>ae(t=>t===e?null:t),1500)}).catch(()=>{})},[]),Oe=(0,Z.useCallback)(e=>{_e.current.id===e&&(_e.current.controller=null,ge.current=!1,H.current&&j(!1))},[]),ke=(0,Z.useCallback)(async(e,t=!1)=>{let n=_e.current.id+1;_e.current.controller?.abort();let i=new AbortController;_e.current={id:n,controller:i},ge.current=!0,j(!0),L(null);let a=Nn(e.assistant);if(!a)return K(`This session cannot resume in embedded chat.`,`error`),Oe(n),!1;let o=r.find(e=>e.id===a);if(!o?.isConfigured)return K(o?.message??`The ${a} provider is unavailable. Check its local CLI installation and login.`,`error`),Oe(n),!1;let s=()=>H.current&&_e.current.id===n&&!i.signal.aborted;try{let r=await fetch(`/api/session/${encodeURIComponent(e.assistant)}/${encodeURIComponent(e.id)}/transcript`,{signal:i.signal});if(!r.ok)throw Error(`HTTP ${r.status}`);let o=await r.json();if(!s())return!1;let c=(Array.isArray(o.messages)?o.messages:[]).filter(e=>(e.role===`user`||e.role===`assistant`)&&typeof e.content==`string`&&e.content.trim()).map(e=>({role:e.role,content:e.content,ts:e.timestamp&&Date.parse(e.timestamp)||void 0}));if(R.current&&!window.confirm(`Stop the current chat and resume this session?`))return Oe(n),!1;R.current&&q(),x(a);let l=()=>{s()&&(C(e=>({...e,[a]:`review`})),u([...c,{role:`system`,kind:`note`,content:`Loaded session — your next message resumes it.`,ts:Date.now()}]),p(``),ne(!1),Oe(n))};return t?Te(a,{firstMessage:null,session:{id:e.id,started:!0},onDispatched:l,onFailure:()=>{s()&&(L(`Failed to connect to the selected session.`),Oe(n))}}):(z.current={...z.current,[a]:{id:e.id,started:!0}},l(),!0)}catch(e){return!s()||e instanceof DOMException&&e.name===`AbortError`?!1:(L(`Failed to load the session transcript.`),K(`Failed to load the session transcript. Your current chat was preserved.`,`error`),Oe(n),!1)}},[K,Oe,r,Te,q]),Ae=(0,Z.useCallback)(e=>{ke(e)},[ke]),je=(0,Z.useCallback)(async(e,t=!1,n=!1)=>{N(e);let r;if(t){F(!0);try{let t=await fetch(`/api/adapters/status/refresh`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({providerId:e.providerId})});if(!t.ok)throw Error(`HTTP ${t.status}`);let a=xo(await t.json());if(!a)throw Error(`Invalid provider status response`);if(!H.current)return!1;i(a),r=a.find(t=>t.id===e.providerId);let o=n&&(r?.setupIssue===`signed-out`||r?.setupIssue===`probe-failed`);if(!r||!r.isConfigured&&!o)return K(r?.message??`The selected local CLI is still unavailable. Install it and sign in, then retry.`,`error`),!1}catch{return H.current&&K(`Could not refresh the local CLI status. The task handoff was not dispatched.`,`error`),!1}finally{H.current&&F(!1)}}return Te(e.providerId,{firstMessage:e.kickoff,executionProfile:e.executionProfile,provider:r&&n&&(r.setupIssue===`signed-out`||r.setupIssue===`probe-failed`)?{...r,isConfigured:!0}:r,resetSession:!0,resetMessagesOnDispatch:!0,onDispatched:()=>{H.current&&N(null)},onFailure:()=>{H.current&&N(e)}})},[K,Te]);(0,Z.useEffect)(()=>{if(!a||!U)return;let e=pe.current===U.nonce;try{e||=sessionStorage.getItem(`nexusflow.chatLaunch.consumed`)===U.nonce,sessionStorage.setItem(`nexusflow.chatLaunch.consumed`,U.nonce)}catch{}pe.current=U.nonce;let i=t.state&&typeof t.state==`object`?{...t.state}:{};if(delete i.chatLaunch,n(`${t.pathname}${t.search}`,{replace:!0,state:Object.keys(i).length>0?i:null}),e)return;let o=r.find(e=>e.id===U.providerId);if(x(U.providerId),C(e=>({...e,[U.providerId]:U.executionProfile})),!o?.isConfigured){K(o?.message??`The selected local CLI is unavailable. Install it and sign in, then try again.`,`error`),U.kickoff&&N({providerId:U.providerId,kickoff:U.kickoff,executionProfile:U.executionProfile});return}if(U.sessionId&&U.assistant){ke({id:U.sessionId,assistant:U.assistant,title:``,createdAt:``,updatedAt:``,messageCount:0},!0);return}R.current&&!window.confirm(`Stop the current chat and continue with the selected local CLI?`)||(R.current&&q(),U.kickoff?je({providerId:U.providerId,kickoff:U.kickoff,executionProfile:U.executionProfile}):Te(U.providerId,{firstMessage:null}))},[K,je,U,ke,t.pathname,t.search,t.state,n,r,a,Te,q]);let Me=()=>{if(window.confirm(`Are you sure you want to clear this chat history? This also starts a new agent session.`)){R.current&&q();let t={...z.current};delete t[b],z.current=t,V.current=!1,u([]),Qa(e.branchName)}},Ne=g&&!v,J=W?So(W):null;return(0,$.jsxs)(`div`,{className:`flex h-full flex-col bg-card`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-border bg-card px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,$.jsx)(`h3`,{className:`font-semibold text-foreground`,children:`Chat`}),(0,$.jsx)(Ln,{tone:m?`running`:`idle`,dot:!0,children:m?W?.name||`Connected`:`Disconnected`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[l.length>0&&(0,$.jsx)(`button`,{onClick:Me,className:`cursor-pointer text-xs text-muted-foreground transition-colors hover:text-destructive-foreground`,children:`Clear`}),(0,$.jsx)(`button`,{onClick:()=>{L(null),ne(!0)},className:`grid h-7 w-7 cursor-pointer place-items-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:`Resume a past session`,children:(0,$.jsx)(ar,{size:14})}),m&&(0,$.jsxs)(f,{size:`sm`,variant:`outline`,onClick:q,children:[(0,$.jsx)(jt,{size:14,className:`text-destructive-foreground`}),`Stop`]})]})]}),(0,$.jsx)($a,{open:te,onClose:()=>ne(!1),ws:e,onPick:Ae,error:re,pending:A}),(0,$.jsxs)(`div`,{ref:oe,onScroll:()=>{let e=oe.current;e&&(ce.current=e.scrollHeight-e.scrollTop-e.clientHeight<80)},className:`flex-1 space-y-4 overflow-y-auto p-4`,children:[l.length===0&&!Ne&&(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center text-muted-foreground`,children:`No messages yet. Start the agent and say hello.`}),l.map((e,t)=>(0,$.jsx)(wo,{msg:e,idx:t,copied:ie===t,onCopy:De},t)),Ne&&(0,$.jsx)(`div`,{className:`flex justify-start`,children:(0,$.jsx)(`div`,{className:`rounded-lg border border-border bg-card px-4 py-3 text-muted-foreground`,children:(0,$.jsx)(sn,{size:14,className:`animate-spin`})})}),(0,$.jsx)(`div`,{ref:se})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-t border-border bg-card p-3`,children:[W&&!W.isConfigured&&(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-destructive/25 bg-destructive/10 px-3 py-2 text-xs text-destructive-foreground`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(`span`,{className:`shrink-0 font-semibold`,children:[W.name,` provider status:`]}),(0,$.jsx)(`span`,{children:W.message})]}),J&&(0,$.jsx)(`code`,{className:`w-fit rounded bg-background/70 px-2 py-1 font-mono text-[11px] text-foreground`,children:J.command})]}),J&&(0,$.jsxs)(f,{size:`sm`,variant:`outline`,onClick:()=>{if(!W||!J)return;let e=()=>K(`Could not copy the recovery command. Copy the command shown above manually.`,`error`);try{let t=navigator.clipboard?.writeText;if(!t){e();return}t.call(navigator.clipboard,J.command).then(()=>{I(W.id),setTimeout(()=>{H.current&&I(e=>e===W.id?null:e)},1500)}).catch(e)}catch{e()}},className:`shrink-0`,children:[ee===W.id?(0,$.jsx)(Fn,{size:12}):(0,$.jsx)(In,{size:12}),ee===W.id?`Copied`:J.label]})]}),M&&!E&&!m&&(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-warning/25 bg-warning/10 px-3 py-2 text-xs text-foreground`,children:[(0,$.jsxs)(`span`,{children:[`The workspace kickoff was not dispatched (`,M.executionProfile===`workspace-write`?`Edit workspace`:`Review only`,`).`]}),(0,$.jsx)(f,{size:`sm`,variant:`outline`,onClick:()=>void je(M,!0),disabled:A||P,children:P?`Checking CLI…`:`Recheck & retry`}),W?.setupIssue&&W.setupIssue!==`missing-cli`&&(0,$.jsx)(f,{size:`sm`,variant:`outline`,onClick:()=>void je(M,!0,!0),disabled:A||P,children:`Try with existing CLI auth`})]}),(0,$.jsxs)(`div`,{className:`flex w-full flex-col rounded-xl border border-border bg-card shadow-sm`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/50 p-2`,children:[(0,$.jsxs)(Mi,{children:[(0,$.jsxs)(Ni,{"aria-label":`Select Provider`,className:c(`flex cursor-pointer items-center gap-2 rounded-md px-3 py-1.5 text-xs font-medium transition-colors hover:bg-accent`,m?`pointer-events-none opacity-50`:`text-foreground`),children:[W?.icon===`Bot`?(0,$.jsx)(Tt,{size:14,className:`text-primary`}):(0,$.jsx)(Rt,{size:14,className:`text-primary`}),W?.name||`Select Agent`]}),(0,$.jsx)(Pi,{align:`start`,side:`top`,children:r.map(e=>(0,$.jsxs)(Fi,{onClick:()=>{m||x(e.id)},children:[e.icon===`Bot`?(0,$.jsx)(Tt,{size:14}):(0,$.jsx)(Rt,{size:14}),e.name]},e.id))})]}),(0,$.jsx)(`div`,{className:`h-4 w-px bg-border`}),W?.executionProfiles?.length&&be?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(Mi,{children:[(0,$.jsx)(Ni,{"aria-label":`Select execution profile`,disabled:E||g||A||!!M,className:`flex cursor-pointer items-center rounded-md px-2 py-1 text-xs font-medium text-foreground transition-colors hover:bg-accent disabled:pointer-events-none disabled:opacity-50`,children:be.label}),(0,$.jsx)(Pi,{align:`start`,side:`top`,className:`max-w-80`,children:W.executionProfiles.map(e=>(0,$.jsx)(Fi,{onClick:()=>C(t=>({...t,[W.id]:e.id})),children:(0,$.jsxs)(`span`,{className:`flex flex-col`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.description})]})},e.id))})]}),(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs text-muted-foreground`,title:be.description,children:be.description})]}):(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:W?.accessLabel??`Harness-managed access`})]}),(0,$.jsxs)(`div`,{className:`flex items-end gap-2 p-2`,children:[(0,$.jsx)(tr,{value:d,disabled:A,onChange:e=>{p(e.target.value);let t=e.target;t.style.height=`auto`,t.style.height=`${Math.min(t.scrollHeight,200)}px`},onKeyDown:e=>{if(e.key===`Enter`&&!e.shiftKey){if(e.preventDefault(),g||E||ge.current)return;m?Ee():Te();let t=e.currentTarget;t.style.height=`auto`}},placeholder:m?`Message the agent... (Shift+Enter for new line)`:`Start the agent or press Enter...`,unstyled:!0,className:`flex-1 [&_[data-slot=textarea]]:max-h-[200px] [&_[data-slot=textarea]]:min-h-11 [&_[data-slot=textarea]]:resize-none [&_[data-slot=textarea]]:text-sm`,rows:1}),m?(0,$.jsxs)(f,{className:`h-11 shrink-0 rounded-lg`,onClick:Ee,disabled:!d.trim()||g||A,children:[g?(0,$.jsx)(sn,{size:14,className:`animate-spin`}):(0,$.jsx)(hr,{size:14}),`Send`]}):(0,$.jsxs)(f,{className:`h-11 shrink-0 rounded-lg`,onClick:()=>Te(),disabled:!xe,children:[(0,$.jsx)(_r,{size:14}),`Start`]})]})]})]})]})}var Eo={"git-pull-request":Pt,"flask-conical":Ot,package:Dt,database:At,"shield-check":kt,terminal:Ft,zap:Lt,cpu:Rt,layers:Mt,boxes:pn};function Do({ws:e,showToast:t}){let[n,r]=(0,Z.useState)(``),[i,a]=(0,Z.useState)({}),[o,s]=(0,Z.useState)(null),[l,u]=(0,Z.useState)(null),[d,p]=(0,Z.useState)(!1),{data:m=[],isLoading:h}=wn(),{data:g=[],isLoading:_}=Vn(e.branchName),{data:v=[],isLoading:y}=yn(),{data:b,isLoading:x,isError:S}=On(e.branchName),C=on(),w=vn(),T=(0,Z.useMemo)(()=>new Set(o??b?.enabledSkills??[]),[o,b?.enabledSkills]),E=(0,Z.useMemo)(()=>new Set(l??b?.enabledAgents??[]),[l,b?.enabledAgents]);(0,Z.useEffect)(()=>{b&&(s([...b.enabledSkills??[]]),u([...b.enabledAgents??[]]))},[b]);let D=(0,Z.useMemo)(()=>{if(!b||o===null||l===null)return!1;let e=new Set(b.enabledSkills??[]),t=new Set(b.enabledAgents??[]);return!!(o.length!==e.size||o.some(t=>!e.has(t))||l.length!==t.size||l.some(e=>!t.has(e)))},[b,o,l]),O=e=>{a(t=>({...t,[e]:!t[e]}))},k=e=>{if(o===null)return;let t=new Set(o);t.has(e)?t.delete(e):t.add(e),s(Array.from(t))},A=e=>{if(l===null)return;let t=new Set(l);t.has(e)?t.delete(e):t.add(e),u(Array.from(t))},j=(e,t,n)=>{if(o===null)return;let r=new Set(o);for(let e of n)t?r.add(e.id):r.delete(e.id);s(Array.from(r))},M=async()=>{if(!(!b||o===null||l===null)){p(!0);try{await C.mutateAsync({workspaceId:e.branchName,expectedRevision:b.revision??0,enabledSkills:o,enabledAgents:l,enabledCategories:m.map(e=>e.id)}),await w.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{p(!1)}}},N=(0,Z.useMemo)(()=>{if(!n.trim())return g;let e=n.toLowerCase();return g.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)))},[g,n]),P=(0,Z.useMemo)(()=>{if(!n.trim())return v;let e=n.toLowerCase();return v.filter(t=>t.name.toLowerCase().includes(e)||t.description.toLowerCase().includes(e)||t.category.toLowerCase().includes(e))},[v,n]),F=(0,Z.useMemo)(()=>{let e={};for(let t of m)e[t.id]=N.filter(e=>e.category===t.id);return e},[m,N]);return h||_||y||x?(0,$.jsxs)(`div`,{className:`flex items-center justify-center p-12 gap-3 text-muted-foreground`,children:[(0,$.jsx)(lt,{}),(0,$.jsx)(`span`,{className:`text-sm`,children:`Loading workspace skills...`})]}):S?(0,$.jsx)(er,{className:`py-12 border border-dashed rounded-xl`,children:(0,$.jsxs)($n,{children:[(0,$.jsx)(Xn,{children:`Could not load workspace skills config`}),(0,$.jsx)(Qn,{children:`Unable to read .nexusflow/skills.json for this workspace.`})]})}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,$.jsxs)(Yn,{className:`p-4 bg-card/70 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)(pn,{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)(Jn,{variant:`secondary`,className:`text-[10px] font-mono`,children:[T.size,` Skills Active`]}),E.size>0&&(0,$.jsxs)(Jn,{variant:`secondary`,className:`text-[10px] font-mono`,children:[E.size,` Agents Active`]})]}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:`Choose which reusable Agent Skills and Codex Agents to deploy into this workspace.`})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(f,{size:`sm`,onClick:M,disabled:d||!D&&T.size===0&&E.size===0,className:`flex items-center gap-1.5 shadow-sm`,children:[d?(0,$.jsx)(lt,{className:`size-3.5`}):(0,$.jsx)(Kn,{className:`size-3.5`}),(0,$.jsx)(`span`,{children:d?`Deploying…`:D?`Save & Deploy Changes`:`Re-Deploy to Workspace`})]}),(0,$.jsxs)(f,{render:(0,$.jsx)(Mn,{to:`/skills`}),variant:`outline`,size:`sm`,className:`flex items-center gap-1.5`,children:[(0,$.jsx)(gn,{className:`size-3.5`}),(0,$.jsx)(`span`,{children:`Resource Library`})]})]})]}),(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(zt,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground`}),(0,$.jsx)(yt,{value:n,onChange:e=>r(e.target.value),placeholder:`Filter skills & agents by keyword...`,className:`pl-9 pr-8 h-8 text-xs bg-card`}),n&&(0,$.jsx)(`button`,{onClick:()=>r(``),className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,children:(0,$.jsx)(qn,{className:`h-3.5 w-3.5`})})]}),(0,$.jsxs)(`div`,{className:`space-y-3`,children:[m.map(e=>{let t=Eo[e.icon||`boxes`]||pn,r=F[e.id]||[];if(n&&r.length===0)return null;let a=!!i[e.id],o=r.length>0&&r.every(e=>T.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":!a,onClick:()=>O(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),O(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)(Jn,{variant:`outline`,className:`text-[9px] px-1 py-0`,children:[r.filter(e=>T.has(e.id)).length,`/`,r.length,` active`]})]})})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,onClick:e=>e.stopPropagation(),children:[r.length>0&&(0,$.jsxs)(f,{variant:`ghost`,size:`xs`,onClick:()=>j(e.id,!o,r),className:`h-6 text-[11px] px-2 text-muted-foreground hover:text-foreground`,children:[o?(0,$.jsx)(Nt,{className:`h-3 w-3 mr-1 text-primary`}):(0,$.jsx)(jt,{className:`h-3 w-3 mr-1`}),(0,$.jsx)(`span`,{children:o?`Deselect All`:`Select All`})]}),(0,$.jsx)(`div`,{className:`p-0.5 text-muted-foreground`,children:a?(0,$.jsx)(It,{className:`h-4 w-4`}):(0,$.jsx)(Et,{className:`h-4 w-4`})})]})]}),!a&&(0,$.jsx)(`div`,{className:`p-3 border-t border-border/40 bg-background/50`,children:r.length===0?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground py-2 text-center`,children:`No skills in this category.`}):(0,$.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-2.5`,children:r.map(e=>{let t=T.has(e.id);return(0,$.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:()=>k(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),k(e.id))},className:c(`p-3 rounded-lg border text-left cursor-pointer transition-all flex flex-col justify-between select-none shadow-2xs`,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`,{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:c(`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)(Fn,{className:`size-3 stroke-[3]`})}),(0,$.jsx)(`span`,{className:`font-mono text-xs font-semibold truncate`,children:e.title||e.name})]}),(0,$.jsx)(Jn,{variant:`outline`,className:`text-[9px] px-1 py-0 shrink-0`,children:e.custom?`Custom`:`Template`})]}),(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,3).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)})})})]},e.id)}),P.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)(Tt,{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)(Jn,{variant:`outline`,className:`text-[9px] px-1 py-0`,children:[P.filter(e=>E.has(e.id)).length,`/`,P.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:P.map(e=>{let t=E.has(e.id);return(0,$.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:()=>A(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),A(e.id))},className:c(`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:c(`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)(Fn,{className:`size-3 stroke-[3]`})}),(0,$.jsx)(`span`,{className:`font-mono text-xs font-semibold truncate`,children:e.name})]}),(0,$.jsx)(Jn,{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)})})})]})]}),(0,$.jsxs)(`p`,{className:`text-[11px] text-muted-foreground`,children:[`Saving & deploying will write to `,(0,$.jsx)(`code`,{className:`font-mono text-xs text-foreground`,children:`.nexusflow/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/`}),`.`]})]})}var Oo=[{value:`overview`,label:`Overview`},{value:`changes`,label:`Changes`},{value:`services`,label:`Services`},{value:`sessions`,label:`Sessions`},{value:`knowledge`,label:`Knowledge`},{value:`plan`,label:`Plan`},{value:`skills`,label:`Skills`}],ko=[`all`,`changes`,`running`],Ao=new URLSearchParams(window.location.search).get(`env`)===`vscode`;function jo(e){let{workspaces:t,workspaceStatuses:n,workspacesLoading:r,fetchWorkspaces:i,selectedId:a,subTab:o,onSelect:s,onSelectTab:l,resumingWs:u,handleResumeSession:d,handleCopyPrompt:p,handleDeleteWorkspace:m,deleteWsLoading:h,repos:g,addRepoLoading:_,handleAddRepo:v,showToast:y,sessionProps:b,changesProps:x,knowledgeProps:S,planProps:C}=e,[w,T]=(0,Z.useState)(``),[E,D]=(0,Z.useState)(`all`),[O,k]=(0,Z.useState)(()=>{try{let e=localStorage.getItem(`nexusflow:workspaces:layoutMode`);if(e===`cockpit`||e===`split`||e===`chat-only`||e===`inspector-only`)return e}catch{}return`cockpit`}),[A,j]=(0,Z.useState)(()=>{try{return localStorage.getItem(`nexusflow:workspaces:sidebarCollapsed`)===`true`}catch{}return!1});(0,Z.useEffect)(()=>{try{localStorage.setItem(`nexusflow:workspaces:layoutMode`,O)}catch{}},[O]),(0,Z.useEffect)(()=>{try{localStorage.setItem(`nexusflow:workspaces:sidebarCollapsed`,String(A))}catch{}},[A]),(0,Z.useEffect)(()=>{let e=e=>{let t=e.target;if(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement||t instanceof HTMLElement&&t.isContentEditable)return;let n=e.ctrlKey||e.metaKey;n&&e.key===`\\`?(e.preventDefault(),k(e=>e===`cockpit`?`split`:e===`split`?`chat-only`:e===`chat-only`?`inspector-only`:`cockpit`)):n&&(e.key===`j`||e.key===`J`)?(e.preventDefault(),k(e=>e===`chat-only`?`cockpit`:`chat-only`)):n&&(e.key===`b`||e.key===`B`)&&(e.preventDefault(),j(e=>!e))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let M=t.find(e=>e.branchName===a)??null,N=M?.mode??`worktree`,P=Dn(M?.branchName??null).data?.services??[],F=(0,Z.useMemo)(()=>{let e=w.trim().toLowerCase();return t.filter(t=>{let r=n[t.branchName];return!(e&&!`${t.branchName} ${t.description}`.toLowerCase().includes(e)||E===`changes`&&!(r&&r.changedFiles>0)||E===`running`&&!(r&&r.runningServices>0))})},[t,n,w,E]),ee=M?M.repos.map(e=>{let t=Un(e),n=x.gitChanges?.find(e=>e.repoName===t),r=n?n.files?.length??0:null,i=P.filter(e=>(e.cwd??``).split(/[\\/]/).includes(t));return{name:t,changedCount:r,ports:Array.from(new Set(i.map(e=>e.port).filter(e=>typeof e==`number`))),serviceCount:i.length}}):[],I=M?g.filter(e=>!M.repos.includes(e.path)):[];return(0,$.jsxs)(`div`,{className:`flex flex-col h-full animate-fade-in`,children:[(0,$.jsxs)(`header`,{className:`mb-4 flex flex-wrap items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h1`,{className:`text-xl font-semibold text-foreground`,children:`Workspaces`}),(0,$.jsx)(`p`,{className:`mt-0.5 text-sm text-muted-foreground`,children:`Inspect workspace changes, services, context, and collaborate with embedded agents.`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(`div`,{role:`group`,"aria-label":`Workspace layout`,className:`flex items-center gap-1 rounded-lg border border-border bg-muted/60 p-1`,children:[(0,$.jsx)(`button`,{onClick:()=>j(!A),className:c(`rounded-md p-1.5 text-xs font-medium transition-colors cursor-pointer`,A?`text-muted-foreground hover:text-foreground hover:bg-accent`:`bg-background text-foreground shadow-sm`),title:A?`Show workspaces sidebar (Ctrl+B)`:`Hide workspaces sidebar (Ctrl+B)`,"aria-label":`Toggle sidebar`,"aria-expanded":!A,children:(0,$.jsx)(fr,{size:15})}),(0,$.jsx)(`div`,{className:`h-3.5 w-px bg-border my-auto mx-0.5`}),(0,$.jsxs)(`button`,{onClick:()=>k(`cockpit`),"aria-label":`Cockpit layout`,"aria-pressed":O===`cockpit`,className:c(`flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium transition-colors cursor-pointer`,O===`cockpit`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground hover:bg-accent`),title:`Cockpit mode: Spacious chat canvas with contextual inspector (Ctrl+\\)`,children:[(0,$.jsx)(or,{size:13}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:`Cockpit`})]}),(0,$.jsxs)(`button`,{onClick:()=>k(`split`),"aria-label":`Split layout`,"aria-pressed":O===`split`,className:c(`flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium transition-colors cursor-pointer`,O===`split`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground hover:bg-accent`),title:`Dual-Split mode: 50/50 side-by-side chat and inspector (Ctrl+\\)`,children:[(0,$.jsx)(rr,{size:13}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:`Split`})]}),(0,$.jsxs)(`button`,{onClick:()=>k(`chat-only`),"aria-label":`Chat-only layout`,"aria-pressed":O===`chat-only`,className:c(`flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium transition-colors cursor-pointer`,O===`chat-only`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground hover:bg-accent`),title:`Chat focus mode: Full width chat canvas (Ctrl+J)`,children:[(0,$.jsx)(ur,{size:13}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:`Chat`})]}),(0,$.jsxs)(`button`,{onClick:()=>k(`inspector-only`),"aria-label":`Inspector-only layout`,"aria-pressed":O===`inspector-only`,className:c(`flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium transition-colors cursor-pointer`,O===`inspector-only`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground hover:bg-accent`),title:`Inspector focus mode: Full width inspector`,children:[(0,$.jsx)(ln,{size:13}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:`Inspector`})]})]}),(0,$.jsxs)(f,{variant:`outline`,onClick:i,disabled:r,children:[(0,$.jsx)(sn,{size:14,className:r?`animate-spin text-primary`:``}),`Refresh`]})]})]}),(0,$.jsxs)(`div`,{className:`flex gap-4 h-[calc(100vh-125px)] overflow-hidden pb-3`,children:[!A&&(0,$.jsxs)(`div`,{className:`w-60 shrink-0 flex flex-col overflow-y-auto pr-1`,children:[(0,$.jsxs)(`div`,{className:`relative mb-3`,children:[(0,$.jsx)(zt,{size:14,className:`pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground`}),(0,$.jsx)(yt,{value:w,onChange:e=>T(e.target.value),placeholder:`Search workspaces`,className:`[&_[data-slot=input]]:pl-8`})]}),(0,$.jsx)(`div`,{className:`mb-3 flex items-center gap-1 rounded-lg border border-border bg-muted p-1`,children:ko.map(e=>(0,$.jsx)(`button`,{onClick:()=>D(e),"aria-pressed":E===e,className:c(`flex-1 rounded-md px-2.5 py-1 text-xs font-medium capitalize transition-colors cursor-pointer text-center`,E===e?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground hover:bg-accent`),children:e},e))}),r?(0,$.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:[0,1,2,3].map(e=>(0,$.jsx)(nr,{className:`h-14`},e))}):F.length===0?(0,$.jsx)(Yn,{className:`p-6 text-center text-sm text-muted-foreground`,children:`No workspaces match.`}):(0,$.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:F.map(e=>{let t=n[e.branchName],r=e.branchName===a,i=e.mode===`in-place`?null:t?En(t.syncStatus):null;return(0,$.jsxs)(`button`,{onClick:()=>s(e.branchName),className:c(`rounded-lg border p-3 text-left transition-colors cursor-pointer`,r?`border-primary/50 bg-primary/10`:`border-border bg-card hover:border-foreground/15 hover:bg-accent/50`),children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`truncate font-mono text-sm font-semibold text-foreground`,children:e.branchName}),(0,$.jsxs)(`span`,{className:`shrink-0 text-[11px] text-muted-foreground`,children:[e.repos.length,` repos`]})]}),(0,$.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:c(`h-1.5 w-1.5 rounded-full`,t?.changedFiles?`bg-warning`:`bg-success`),title:t?.changedFiles?`${t.changedFiles} uncommitted`:`Clean`}),t?.runningServices?(0,$.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-running`,title:`Running services`}):null,i&&(0,$.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:i.label})]})]},e.id)})})]}),M?(0,$.jsxs)(`div`,{className:c(`flex-1 min-w-0 h-full gap-4`,(O===`cockpit`||O===`split`)&&`flex flex-col overflow-y-auto xl:grid xl:overflow-hidden`,O===`cockpit`&&`xl:grid-cols-[minmax(440px,960px)_minmax(380px,640px)]`,O===`split`&&`xl:grid-cols-2`,O===`chat-only`&&`flex justify-center overflow-hidden`,O===`inspector-only`&&`overflow-y-auto pr-1`),children:[(0,$.jsx)(`div`,{className:c(`min-w-0 flex flex-col overflow-hidden rounded-xl border border-border bg-card shadow-sm`,(O===`cockpit`||O===`split`)&&`w-full min-h-[420px] flex-none xl:h-full xl:min-h-0`,O===`chat-only`&&`w-full max-w-5xl h-full`,O===`inspector-only`&&`hidden`),children:M?(0,$.jsx)(To,{ws:M},M.branchName):(0,$.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-10 text-center text-sm text-muted-foreground`,children:`Select a workspace to start chatting.`})}),(0,$.jsx)(`div`,{className:c(`min-w-0`,(O===`cockpit`||O===`split`)&&`w-full flex-none overflow-visible xl:h-full xl:overflow-y-auto xl:pr-1`,O===`chat-only`&&`hidden`,O===`inspector-only`&&`h-full overflow-y-auto`),children:(0,$.jsx)(`div`,{className:c(O===`inspector-only`&&`mx-auto flex w-full max-w-6xl flex-col`),children:M?(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,$.jsxs)(Yn,{className:`p-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col items-start gap-4`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsx)(`h2`,{className:`truncate text-xl font-bold text-foreground`,title:M.branchName,children:M.branchName}),(0,$.jsx)(Ln,{tone:N,children:N===`in-place`?`In-place`:`Worktree`})]}),(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsxs)(`span`,{children:[`Created `,new Date(M.createdAt).toLocaleDateString()]}),(0,$.jsx)(`span`,{children:`·`}),(0,$.jsxs)(`span`,{children:[M.repos.length,` repos`]})]})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(f,{disabled:u===M.branchName,onClick:()=>d(M),children:[(0,$.jsx)(bn,{size:13,className:u===M.branchName?`animate-spin`:``}),u===M.branchName?`Opening…`:`Continue in Chat`]}),(0,$.jsx)(wt,{workspaceId:M.branchName,workspacePath:M.workspacePath,isVsCode:Ao}),(0,$.jsxs)(Mi,{children:[(0,$.jsx)(Ni,{"aria-label":`More actions`,className:`grid h-9 w-9 shrink-0 place-items-center rounded-md border border-border bg-card text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,children:(0,$.jsx)(ir,{size:16})}),(0,$.jsxs)(Pi,{align:`end`,children:[(0,$.jsxs)(Fi,{onClick:()=>p(M),children:[(0,$.jsx)(In,{size:14}),` Copy AI Context`]}),(0,$.jsx)(Ii,{}),(0,$.jsxs)(Fi,{variant:`destructive`,disabled:h===M.branchName,onClick:()=>void m(M.branchName),children:[(0,$.jsx)(Bt,{size:14}),h===M.branchName?`Deleting…`:`Delete Workspace`]})]})]})]})]}),(0,$.jsx)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:(()=>{let e=n[M.branchName];if(!e)return null;let t=N===`in-place`?null:En(e.syncStatus);return(0,$.jsxs)($.Fragment,{children:[e.changedFiles>0?(0,$.jsxs)(Ln,{tone:`warning`,dot:!0,children:[e.changedFiles,` uncommitted`]}):(0,$.jsx)(Ln,{tone:`idle`,dot:!0,children:`Clean`}),e.runningServices>0?(0,$.jsxs)(Ln,{tone:`running`,dot:!0,children:[e.runningServices,` running`]}):(0,$.jsx)(Ln,{tone:`idle`,dot:!0,children:`No services`}),t&&(0,$.jsxs)(Ln,{tone:t.tone,children:[(0,$.jsx)(sn,{size:11}),` `,t.label]}),e.pendingValidation&&(0,$.jsx)(Ln,{tone:`warning`,children:`Needs validation`})]})})()})]}),(0,$.jsxs)(la,{value:o,onValueChange:e=>typeof e==`string`&&l(M.branchName,e),className:`mb-4`,children:[(0,$.jsx)(ua,{className:`max-w-full overflow-x-auto`,children:Oo.map(e=>(0,$.jsx)(da,{value:e.value,children:e.label},e.value))}),(0,$.jsxs)(fa,{value:o,className:`animate-fade-in pt-3`,children:[o===`overview`&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,$.jsxs)(Yn,{className:`p-5`,children:[(0,$.jsx)(`h3`,{className:`mb-2 text-sm font-semibold text-foreground`,children:`Description`}),M.description?(0,$.jsx)(`p`,{className:`whitespace-pre-line text-sm leading-relaxed text-muted-foreground`,children:M.description}):(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No description provided.`})]}),(0,$.jsxs)(Yn,{className:`p-5`,children:[(0,$.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`h3`,{className:`text-sm font-semibold text-foreground`,children:[`Repositories `,(0,$.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,M.repos.length,`)`]})]}),I.length>0&&(0,$.jsx)(za,{repos:I,disabled:_,onAdd:e=>{window.confirm(`Add repository "${Un(e)}" to this workspace?\nThis creates a new git worktree and re-runs analysis.`)&&v(M.branchName,e)}})]}),(0,$.jsx)(`div`,{className:`divide-y divide-border`,children:ee.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center gap-3 py-2.5 first:pt-0 last:pb-0`,children:[(0,$.jsx)(`span`,{className:c(`h-2 w-2 shrink-0 rounded-full`,e.changedCount===null?`bg-muted-foreground`:e.changedCount>0?`bg-warning`:`bg-success`),title:e.changedCount===null?`Status unknown`:e.changedCount>0?`Uncommitted changes`:`Clean`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-sm text-foreground`,children:e.name}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[e.ports.map(e=>(0,$.jsxs)(`span`,{className:`rounded border border-border bg-background px-1.5 py-0.5 font-mono text-[11px] text-running-foreground`,children:[`:`,e]},e)),(0,$.jsx)(`span`,{className:`w-24 text-right text-xs text-muted-foreground`,children:e.changedCount===null?`—`:e.changedCount>0?`${e.changedCount} changed`:`clean`})]})]},e.name))}),(0,$.jsx)(`p`,{className:`mt-3 text-[11px] text-muted-foreground`,children:`Per-repo git state and detected service ports.`})]})]}),o===`sessions`&&(0,$.jsx)(Ha,{ws:M,...b}),o===`services`&&(0,$.jsx)(Ua,{ws:M}),o===`changes`&&(0,$.jsx)(Wa,{ws:M,...x}),o===`knowledge`&&(0,$.jsx)(Ga,{ws:M,...S}),o===`plan`&&(0,$.jsx)(Ka,{...C}),o===`skills`&&(0,$.jsx)(Do,{ws:M,showToast:y})]})]})]}):null})})]}):(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)(Yn,{className:`border-dashed p-0 shadow-sm`,children:(0,$.jsx)(er,{children:(0,$.jsxs)($n,{children:[(0,$.jsx)(Zn,{variant:`icon`,children:(0,$.jsx)(cn,{})}),(0,$.jsx)(Xn,{children:`No workspace selected`}),(0,$.jsx)(Qn,{children:`Pick a workspace from the list to see its status, repositories, changes, services, sessions and chat.`})]})})})})})]})]})}export{jo as WorkspacesPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as e,h as t,m as n}from"./button-cPldH5S4.js";import{C as r,D as i,E as a,T as o,b as s,w as c,x as l,y as u}from"./index-
|
|
1
|
+
import{g as e,h as t,m as n}from"./button-cPldH5S4.js";import{C as r,D as i,E as a,T as o,b as s,w as c,x as l,y as u}from"./index-ofoYKpCG.js";var d=t(`pencil`,[[`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`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]);function f(e){return l(e,`alert-dialog`)}var p=e(),m=f,h=r;function g({className:e,...t}){return(0,p.jsx)(i,{forceRender:!0,className:n(`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`,...t})}function _({className:e,...t}){return(0,p.jsx)(s,{className:n(`fixed inset-0 z-50 grid grid-rows-[1fr_auto_1fr] justify-items-center p-4`,e),"data-slot":`alert-dialog-viewport`,...t})}function v({className:e,bottomStickOnMobile:t=!0,...r}){return(0,p.jsxs)(h,{children:[(0,p.jsx)(g,{}),(0,p.jsx)(_,{className:n(t&&`max-sm:grid-rows-[1fr_auto] max-sm:p-0 max-sm:pt-12`),children:(0,p.jsx)(c,{className:n(`-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%)]`,t&&`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 y({className:e,...t}){return(0,p.jsx)(`div`,{className:n(`flex flex-col gap-2 p-6 text-center max-sm:pb-4 sm:text-left`,e),"data-slot":`alert-dialog-header`,...t})}function b({className:e,variant:t=`default`,...r}){return(0,p.jsx)(`div`,{className:n(`flex flex-col-reverse gap-2 px-6 sm:flex-row sm:justify-end sm:rounded-b-[calc(var(--radius-2xl)-1px)]`,t==="default"&&`border-t bg-muted/72 py-4`,t===`bare`&&`pb-6`,e),"data-slot":`alert-dialog-footer`,...r})}function x({className:e,...t}){return(0,p.jsx)(u,{className:n(`font-heading font-semibold text-xl leading-none`,e),"data-slot":`alert-dialog-title`,...t})}function S({className:e,...t}){return(0,p.jsx)(o,{className:n(`text-muted-foreground text-sm`,e),"data-slot":`alert-dialog-description`,...t})}function C(e){return(0,p.jsx)(a,{"data-slot":`alert-dialog-close`,...e})}export{y as a,d as c,b as i,C as n,v as o,S as r,x as s,m as t};
|