agent-relay-server 0.101.1 → 0.102.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/docs/openapi.json +1 -1
- package/package.json +3 -2
- package/public/assets/{MessageBubble-BEjK1-bi.js → MessageBubble-Dppo7pil.js} +2 -2
- package/public/assets/{MessageBubble-BEjK1-bi.js.map → MessageBubble-Dppo7pil.js.map} +1 -1
- package/public/assets/{PlanGraphPanel-AqFEg7Yg.js → PlanGraphPanel-DO5OY2qa.js} +2 -2
- package/public/assets/{PlanGraphPanel-AqFEg7Yg.js.map → PlanGraphPanel-DO5OY2qa.js.map} +1 -1
- package/public/assets/{activity-D5EZw4bj.js → activity-BhuOs5ha.js} +2 -2
- package/public/assets/{activity-D5EZw4bj.js.map → activity-BhuOs5ha.js.map} +1 -1
- package/public/assets/{agent-profiles-CSISRm_L.js → agent-profiles-CT-vbfzd.js} +2 -2
- package/public/assets/{agent-profiles-CSISRm_L.js.map → agent-profiles-CT-vbfzd.js.map} +1 -1
- package/public/assets/{agents-szyYnkgD.js → agents-CLcgi8AD.js} +2 -2
- package/public/assets/{agents-szyYnkgD.js.map → agents-CLcgi8AD.js.map} +1 -1
- package/public/assets/{analytics-KzLQfGMO.js → analytics-BxGRljQc.js} +2 -2
- package/public/assets/{analytics-KzLQfGMO.js.map → analytics-BxGRljQc.js.map} +1 -1
- package/public/assets/{automation-DVSq4A1b.js → automation-CE1i1zpw.js} +2 -2
- package/public/assets/{automation-DVSq4A1b.js.map → automation-CE1i1zpw.js.map} +1 -1
- package/public/assets/{branch-state-badge-DgwkJ2rN.js → branch-state-badge-olhanssg.js} +2 -2
- package/public/assets/{branch-state-badge-DgwkJ2rN.js.map → branch-state-badge-olhanssg.js.map} +1 -1
- package/public/assets/channels-yHkm1dux.js +2 -0
- package/public/assets/channels-yHkm1dux.js.map +1 -0
- package/public/assets/{chat-patMKjsi.js → chat-DHdFZvAg.js} +2 -2
- package/public/assets/chat-DHdFZvAg.js.map +1 -0
- package/public/assets/{connectors-DVKBHNRV.js → connectors-DpR0V2hy.js} +2 -2
- package/public/assets/{connectors-DVKBHNRV.js.map → connectors-DpR0V2hy.js.map} +1 -1
- package/public/assets/{formatted-body-impl-Csr2DuEk.js → formatted-body-impl-BTeCfK4I.js} +2 -2
- package/public/assets/{formatted-body-impl-Csr2DuEk.js.map → formatted-body-impl-BTeCfK4I.js.map} +1 -1
- package/public/assets/index-CKhh9XRZ.css +2 -0
- package/public/assets/{index-D3woTUwp.js → index-DeDosfVE.js} +6 -6
- package/public/assets/{index-D3woTUwp.js.map → index-DeDosfVE.js.map} +1 -1
- package/public/assets/{insights-D2_Qry06.js → insights-C4aYlgsY.js} +2 -2
- package/public/assets/{insights-D2_Qry06.js.map → insights-C4aYlgsY.js.map} +1 -1
- package/public/assets/integrations-CEmYa5mW.js +2 -0
- package/public/assets/integrations-CEmYa5mW.js.map +1 -0
- package/public/assets/{maintenance-Dm56u8F9.js → maintenance-DVx3SiC_.js} +2 -2
- package/public/assets/{maintenance-Dm56u8F9.js.map → maintenance-DVx3SiC_.js.map} +1 -1
- package/public/assets/{managed-agents-DpX-cHsm.js → managed-agents-DUyOTdz1.js} +2 -2
- package/public/assets/{managed-agents-DpX-cHsm.js.map → managed-agents-DUyOTdz1.js.map} +1 -1
- package/public/assets/{markdown-preview-impl-Df6EWwbg.js → markdown-preview-impl-D3hYfzGD.js} +2 -2
- package/public/assets/{markdown-preview-impl-Df6EWwbg.js.map → markdown-preview-impl-D3hYfzGD.js.map} +1 -1
- package/public/assets/{memory-b2AgvV7H.js → memory-2IfPgcnN.js} +2 -2
- package/public/assets/{memory-b2AgvV7H.js.map → memory-2IfPgcnN.js.map} +1 -1
- package/public/assets/{messages-C5yDD_oq.js → messages-CkOwABhw.js} +2 -2
- package/public/assets/{messages-C5yDD_oq.js.map → messages-CkOwABhw.js.map} +1 -1
- package/public/assets/{orchestrators-D3LecmEw.js → orchestrators-CEKO3eQ1.js} +2 -2
- package/public/assets/{orchestrators-D3LecmEw.js.map → orchestrators-CEKO3eQ1.js.map} +1 -1
- package/public/assets/{overview-CnGkrBNe.js → overview-D9BxevAq.js} +2 -2
- package/public/assets/{overview-CnGkrBNe.js.map → overview-D9BxevAq.js.map} +1 -1
- package/public/assets/{pairs-DXUdZOqn.js → pairs-CqT4D1uL.js} +2 -2
- package/public/assets/{pairs-DXUdZOqn.js.map → pairs-CqT4D1uL.js.map} +1 -1
- package/public/assets/{projects-1h41atqJ.js → projects-C_zwR-Fn.js} +2 -2
- package/public/assets/{projects-1h41atqJ.js.map → projects-C_zwR-Fn.js.map} +1 -1
- package/public/assets/{registry-BeGP37ot.js → registry-BLjwVXCW.js} +2 -2
- package/public/assets/{registry-BeGP37ot.js.map → registry-BLjwVXCW.js.map} +1 -1
- package/public/assets/{security-BMh_y43L.js → security-8a5_4U3S.js} +2 -2
- package/public/assets/{security-BMh_y43L.js.map → security-8a5_4U3S.js.map} +1 -1
- package/public/assets/{select-Cvi5OHz0.js → select-s4BE-T62.js} +2 -2
- package/public/assets/{select-Cvi5OHz0.js.map → select-s4BE-T62.js.map} +1 -1
- package/public/assets/{settings-DKSEwIVG.js → settings-BR30UpbJ.js} +2 -2
- package/public/assets/{settings-DKSEwIVG.js.map → settings-BR30UpbJ.js.map} +1 -1
- package/public/assets/{store-Ch-QzxPq.js → store-DNbkrqbU.js} +2 -2
- package/public/assets/store-DNbkrqbU.js.map +1 -0
- package/public/assets/{tasks-BybIAX-y.js → tasks-Bcr17zR3.js} +2 -2
- package/public/assets/{tasks-BybIAX-y.js.map → tasks-Bcr17zR3.js.map} +1 -1
- package/public/assets/{teams-CMteOToR.js → teams-B_HSkU9T.js} +2 -2
- package/public/assets/{teams-CMteOToR.js.map → teams-B_HSkU9T.js.map} +1 -1
- package/public/assets/{terminal-viewer-impl-DanOi7lh.js → terminal-viewer-impl-Ctp4csJ3.js} +2 -2
- package/public/assets/{terminal-viewer-impl-DanOi7lh.js.map → terminal-viewer-impl-Ctp4csJ3.js.map} +1 -1
- package/public/assets/{user-avatar-DG629icI.js → user-avatar-RliaJcaG.js} +2 -2
- package/public/assets/{user-avatar-DG629icI.js.map → user-avatar-RliaJcaG.js.map} +1 -1
- package/public/assets/{work-queue-DqW80DIy.js → work-queue-C0hpmlv8.js} +2 -2
- package/public/assets/{work-queue-DqW80DIy.js.map → work-queue-C0hpmlv8.js.map} +1 -1
- package/public/assets/{workspaces-CccVI6lA.js → workspaces-QXbQx_AG.js} +2 -2
- package/public/assets/{workspaces-CccVI6lA.js.map → workspaces-QXbQx_AG.js.map} +1 -1
- package/public/index.html +3 -3
- package/runner/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/runner/src/adapter.ts +5 -0
- package/src/db/channels.ts +18 -2
- package/src/mcp/index.ts +5 -3
- package/src/mcp-egress-tools.ts +101 -0
- package/src/routes/integrations.ts +47 -13
- package/public/assets/channels-Dh_r7SnM.js +0 -2
- package/public/assets/channels-Dh_r7SnM.js.map +0 -1
- package/public/assets/chat-patMKjsi.js.map +0 -1
- package/public/assets/index-B95vV-dd.css +0 -2
- package/public/assets/integrations-AW8b4h7T.js +0 -2
- package/public/assets/integrations-AW8b4h7T.js.map +0 -1
- package/public/assets/store-Ch-QzxPq.js.map +0 -1
- package/src/mcp-ntfy-tools.ts +0 -35
- package/src/ntfy.ts +0 -222
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./bundle-web-BLavPdXe.js","./chunk-CilyBKbf.js","./preload-helper-C_JMBXql.js","./lib-DHj_xjQT.js","./markdown-preview-impl-
|
|
2
|
-
import{r as e,t}from"./chunk-CilyBKbf.js";import{$n as n,An as r,At as i,B as a,Bt as o,C as s,Cn as c,E as l,Ft as u,G as d,H as f,I as p,In as m,It as h,J as g,Jt as _,K as v,Kt as y,L as b,Ln as x,M as S,Nn as C,Nt as ee,O as te,On as ne,P as re,Pn as w,Pt as ie,Q as ae,Qn as oe,Qt as se,R as T,Rt as E,Sn as ce,St as le,T as ue,Tn as de,Tt as fe,U as D,V as pe,Vt as me,Wn as he,Xn as O,Xt as ge,Y as _e,Yn as ve,Yt as ye,_n as be,_t as xe,a as k,an as Se,at as Ce,b as we,cn as Te,dr as Ee,dt as De,et as Oe,f as ke,fn as Ae,ft as je,g as Me,h as Ne,ht as Pe,i as Fe,in as Ie,ir as Le,jn as Re,k as ze,kn as Be,l as Ve,m as He,mt as Ue,n as We,o as Ge,on as Ke,ot as qe,pn as Je,pt as Ye,r as Xe,rt as Ze,t as Qe,tn as $e,tt as et,u as tt,un as nt,ut as rt,v as it,vt as at,w as ot,wt as st,xn as ct,yn as lt,yt as ut,z as dt,zn as ft}from"./lucide-react-BYZuAhQs.js";import{t as pt}from"./react-dom-Dbhs84ug.js";import{c as mt,d as ht,f as gt,s as _t,t as A,u as vt}from"./store-Ch-QzxPq.js";import{B as yt,C as bt,D as xt,E as St,G as Ct,J as wt,K as j,O as Tt,Q as Et,S as Dt,T as Ot,W as kt,X as At,Y as jt,a as Mt,c as Nt,ct as Pt,d as M,f as Ft,h as It,i as Lt,j as Rt,k as zt,lt as Bt,m as Vt,n as Ht,o as Ut,ot as Wt,p as Gt,q as Kt,r as qt,t as Jt,u as Yt,w as Xt,x as Zt,y as Qt}from"./display-DRiGi1zj.js";import{a as $t,o as en,s as tn}from"./types-Tv67voFu.js";import{n as nn,t as rn}from"./themes-DjSwmAZN.js";import{a as an,i as on,o as sn,r as cn,t as ln}from"./dist-BnbGIUmi.js";import{n as un,t as N}from"./dist-CQF3Jiqg.js";import{i as dn,n as P,r as fn,t as pn}from"./dist-DAl28ejX.js";import{t as mn}from"./dist-BjOBkHHY.js";import{t as hn}from"./dist-DDUGmmoi.js";import{t as gn}from"./dist-B5VvlkhI.js";import{a as _n,i as vn,n as yn,o as bn,r as xn,s as Sn,t as Cn}from"./es2015-B8Z9p8oQ.js";import{t as wn}from"./dist-BEzpMqLy.js";import{t as Tn}from"./dist-Cgy0FmP-.js";import{t as En}from"./dist-30weaXto.js";import{t as Dn}from"./dist-Bp10H3oR.js";import{a as On,i as kn,n as An,r as jn,t as Mn}from"./dist-DZ97OosY.js";import{t as Nn}from"./dist-BiLuYU6G.js";import{t as F}from"./badge-BLar6FjP.js";import{t as I}from"./button-BrIB69qd.js";import{t as L}from"./input-B_fUHtLD.js";import{t as Pn}from"./copy-button-Cd-LbSbg.js";import{t as R}from"./preload-helper-C_JMBXql.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Fn=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,w());else{var t=n(l);t!==null&&oe(x,t.startTime-e)}}var S=!1,C=-1,ee=5,te=-1;function ne(){return g?!0:!(e.unstable_now()-te<ee)}function re(){if(g=!1,S){var t=e.unstable_now();te=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&ne());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&oe(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?w():S=!1}}}var w;if(typeof y==`function`)w=function(){y(re)};else if(typeof MessageChannel<`u`){var ie=new MessageChannel,ae=ie.port2;ie.port1.onmessage=re,w=function(){ae.postMessage(null)}}else w=function(){_(re,0)};function oe(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):ee=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,oe(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,w()))),r},e.unstable_shouldYield=ne,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),In=t(((e,t)=>{t.exports=Fn()})),Ln=t((e=>{var t=In(),n=Ee(),r=pt();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}var f=Object.assign,p=Symbol.for(`react.element`),m=Symbol.for(`react.transitional.element`),h=Symbol.for(`react.portal`),g=Symbol.for(`react.fragment`),_=Symbol.for(`react.strict_mode`),v=Symbol.for(`react.profiler`),y=Symbol.for(`react.consumer`),b=Symbol.for(`react.context`),x=Symbol.for(`react.forward_ref`),S=Symbol.for(`react.suspense`),C=Symbol.for(`react.suspense_list`),ee=Symbol.for(`react.memo`),te=Symbol.for(`react.lazy`),ne=Symbol.for(`react.activity`),re=Symbol.for(`react.memo_cache_sentinel`),w=Symbol.iterator;function ie(e){return typeof e!=`object`||!e?null:(e=w&&e[w]||e[`@@iterator`],typeof e==`function`?e:null)}var ae=Symbol.for(`react.client.reference`);function oe(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ae?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case g:return`Fragment`;case v:return`Profiler`;case _:return`StrictMode`;case S:return`Suspense`;case C:return`SuspenseList`;case ne:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case h:return`Portal`;case b:return e.displayName||`Context`;case y:return(e._context.displayName||`Context`)+`.Consumer`;case x:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ee:return t=e.displayName||null,t===null?oe(e.type)||`Memo`:t;case te:t=e._payload,e=e._init;try{return oe(e(t))}catch{}}return null}var se=Array.isArray,T=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,E=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ce={pending:!1,data:null,method:null,action:null},le=[],ue=-1;function de(e){return{current:e}}function fe(e){0>ue||(e.current=le[ue],le[ue]=null,ue--)}function D(e,t){ue++,le[ue]=e.current,e.current=t}var pe=de(null),me=de(null),he=de(null),O=de(null);function ge(e,t){switch(D(he,t),D(me,e),D(pe,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}fe(pe),D(pe,e)}function _e(){fe(pe),fe(me),fe(he)}function ve(e){e.memoizedState!==null&&D(O,e);var t=pe.current,n=Hd(t,e.type);t!==n&&(D(me,e),D(pe,n))}function ye(e){me.current===e&&(fe(pe),fe(me)),O.current===e&&(fe(O),Qf._currentValue=ce)}var be,xe;function k(e){if(be===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);be=t&&t[1]||``,xe=-1<e.stack.indexOf(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./bundle-web-BLavPdXe.js","./chunk-CilyBKbf.js","./preload-helper-C_JMBXql.js","./lib-DHj_xjQT.js","./markdown-preview-impl-D3hYfzGD.js","./lib-ng6WZYjE.js","./lucide-react-BYZuAhQs.js","./terminal-viewer-impl-Ctp4csJ3.js","./store-DNbkrqbU.js","./display-DRiGi1zj.js","./types-Tv67voFu.js","./button-BrIB69qd.js","./dist-BnbGIUmi.js","./use-keyboard-viewport-D8_NYDkh.js","./terminal-viewer-impl-BrP-ENHg.css","./formatted-body-impl-BTeCfK4I.js","./overview-D9BxevAq.js","./badge-BLar6FjP.js","./card-lhnFnBoz.js","./chat-DHdFZvAg.js","./react-dom-Dbhs84ug.js","./MessageBubble-Dppo7pil.js","./user-avatar-RliaJcaG.js","./PlanGraphPanel-DO5OY2qa.js","./branch-state-badge-olhanssg.js","./copy-button-Cd-LbSbg.js","./input-B_fUHtLD.js","./agents-CLcgi8AD.js","./dist-DZ97OosY.js","./dist-DAl28ejX.js","./dist-CQF3Jiqg.js","./dist-Cgy0FmP-.js","./dist-Bp10H3oR.js","./es2015-B8Z9p8oQ.js","./dist-B5VvlkhI.js","./dist-DDUGmmoi.js","./managed-agents-DUyOTdz1.js","./teams-B_HSkU9T.js","./select-s4BE-T62.js","./dist-BiLuYU6G.js","./dist-BjOBkHHY.js","./dist-BEzpMqLy.js","./dist-30weaXto.js","./agent-profiles-CT-vbfzd.js","./orchestrators-CEKO3eQ1.js","./workspaces-QXbQx_AG.js","./channels-yHkm1dux.js","./connectors-DpR0V2hy.js","./integrations-CEmYa5mW.js","./security-8a5_4U3S.js","./memory-2IfPgcnN.js","./activity-BhuOs5ha.js","./pairs-CqT4D1uL.js","./messages-CkOwABhw.js","./work-queue-C0hpmlv8.js","./tasks-Bcr17zR3.js","./automation-CE1i1zpw.js","./analytics-BxGRljQc.js","./themes-DjSwmAZN.js","./insights-C4aYlgsY.js","./projects-C_zwR-Fn.js","./registry-BLjwVXCW.js","./maintenance-DVx3SiC_.js","./settings-BR30UpbJ.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e,t}from"./chunk-CilyBKbf.js";import{$n as n,An as r,At as i,B as a,Bt as o,C as s,Cn as c,E as l,Ft as u,G as d,H as f,I as p,In as m,It as h,J as g,Jt as _,K as v,Kt as y,L as b,Ln as x,M as S,Nn as C,Nt as ee,O as te,On as ne,P as re,Pn as w,Pt as ie,Q as ae,Qn as oe,Qt as se,R as T,Rt as E,Sn as ce,St as le,T as ue,Tn as de,Tt as fe,U as D,V as pe,Vt as me,Wn as he,Xn as O,Xt as ge,Y as _e,Yn as ve,Yt as ye,_n as be,_t as xe,a as k,an as Se,at as Ce,b as we,cn as Te,dr as Ee,dt as De,et as Oe,f as ke,fn as Ae,ft as je,g as Me,h as Ne,ht as Pe,i as Fe,in as Ie,ir as Le,jn as Re,k as ze,kn as Be,l as Ve,m as He,mt as Ue,n as We,o as Ge,on as Ke,ot as qe,pn as Je,pt as Ye,r as Xe,rt as Ze,t as Qe,tn as $e,tt as et,u as tt,un as nt,ut as rt,v as it,vt as at,w as ot,wt as st,xn as ct,yn as lt,yt as ut,z as dt,zn as ft}from"./lucide-react-BYZuAhQs.js";import{t as pt}from"./react-dom-Dbhs84ug.js";import{c as mt,d as ht,f as gt,s as _t,t as A,u as vt}from"./store-DNbkrqbU.js";import{B as yt,C as bt,D as xt,E as St,G as Ct,J as wt,K as j,O as Tt,Q as Et,S as Dt,T as Ot,W as kt,X as At,Y as jt,a as Mt,c as Nt,ct as Pt,d as M,f as Ft,h as It,i as Lt,j as Rt,k as zt,lt as Bt,m as Vt,n as Ht,o as Ut,ot as Wt,p as Gt,q as Kt,r as qt,t as Jt,u as Yt,w as Xt,x as Zt,y as Qt}from"./display-DRiGi1zj.js";import{a as $t,o as en,s as tn}from"./types-Tv67voFu.js";import{n as nn,t as rn}from"./themes-DjSwmAZN.js";import{a as an,i as on,o as sn,r as cn,t as ln}from"./dist-BnbGIUmi.js";import{n as un,t as N}from"./dist-CQF3Jiqg.js";import{i as dn,n as P,r as fn,t as pn}from"./dist-DAl28ejX.js";import{t as mn}from"./dist-BjOBkHHY.js";import{t as hn}from"./dist-DDUGmmoi.js";import{t as gn}from"./dist-B5VvlkhI.js";import{a as _n,i as vn,n as yn,o as bn,r as xn,s as Sn,t as Cn}from"./es2015-B8Z9p8oQ.js";import{t as wn}from"./dist-BEzpMqLy.js";import{t as Tn}from"./dist-Cgy0FmP-.js";import{t as En}from"./dist-30weaXto.js";import{t as Dn}from"./dist-Bp10H3oR.js";import{a as On,i as kn,n as An,r as jn,t as Mn}from"./dist-DZ97OosY.js";import{t as Nn}from"./dist-BiLuYU6G.js";import{t as F}from"./badge-BLar6FjP.js";import{t as I}from"./button-BrIB69qd.js";import{t as L}from"./input-B_fUHtLD.js";import{t as Pn}from"./copy-button-Cd-LbSbg.js";import{t as R}from"./preload-helper-C_JMBXql.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Fn=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,w());else{var t=n(l);t!==null&&oe(x,t.startTime-e)}}var S=!1,C=-1,ee=5,te=-1;function ne(){return g?!0:!(e.unstable_now()-te<ee)}function re(){if(g=!1,S){var t=e.unstable_now();te=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&ne());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&oe(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?w():S=!1}}}var w;if(typeof y==`function`)w=function(){y(re)};else if(typeof MessageChannel<`u`){var ie=new MessageChannel,ae=ie.port2;ie.port1.onmessage=re,w=function(){ae.postMessage(null)}}else w=function(){_(re,0)};function oe(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):ee=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,oe(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,w()))),r},e.unstable_shouldYield=ne,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),In=t(((e,t)=>{t.exports=Fn()})),Ln=t((e=>{var t=In(),n=Ee(),r=pt();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}var f=Object.assign,p=Symbol.for(`react.element`),m=Symbol.for(`react.transitional.element`),h=Symbol.for(`react.portal`),g=Symbol.for(`react.fragment`),_=Symbol.for(`react.strict_mode`),v=Symbol.for(`react.profiler`),y=Symbol.for(`react.consumer`),b=Symbol.for(`react.context`),x=Symbol.for(`react.forward_ref`),S=Symbol.for(`react.suspense`),C=Symbol.for(`react.suspense_list`),ee=Symbol.for(`react.memo`),te=Symbol.for(`react.lazy`),ne=Symbol.for(`react.activity`),re=Symbol.for(`react.memo_cache_sentinel`),w=Symbol.iterator;function ie(e){return typeof e!=`object`||!e?null:(e=w&&e[w]||e[`@@iterator`],typeof e==`function`?e:null)}var ae=Symbol.for(`react.client.reference`);function oe(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ae?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case g:return`Fragment`;case v:return`Profiler`;case _:return`StrictMode`;case S:return`Suspense`;case C:return`SuspenseList`;case ne:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case h:return`Portal`;case b:return e.displayName||`Context`;case y:return(e._context.displayName||`Context`)+`.Consumer`;case x:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ee:return t=e.displayName||null,t===null?oe(e.type)||`Memo`:t;case te:t=e._payload,e=e._init;try{return oe(e(t))}catch{}}return null}var se=Array.isArray,T=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,E=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ce={pending:!1,data:null,method:null,action:null},le=[],ue=-1;function de(e){return{current:e}}function fe(e){0>ue||(e.current=le[ue],le[ue]=null,ue--)}function D(e,t){ue++,le[ue]=e.current,e.current=t}var pe=de(null),me=de(null),he=de(null),O=de(null);function ge(e,t){switch(D(he,t),D(me,e),D(pe,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}fe(pe),D(pe,e)}function _e(){fe(pe),fe(me),fe(he)}function ve(e){e.memoizedState!==null&&D(O,e);var t=pe.current,n=Hd(t,e.type);t!==n&&(D(me,e),D(pe,n))}function ye(e){me.current===e&&(fe(pe),fe(me)),O.current===e&&(fe(O),Qf._currentValue=ce)}var be,xe;function k(e){if(be===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);be=t&&t[1]||``,xe=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+be+e+xe}var Se=!1;function Ce(e,t){if(!e||Se)return``;Se=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,`name`,{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
5
5
|
`),l=s.split(`
|
|
@@ -11,13 +11,13 @@ Error generating stack: `+e.message+`
|
|
|
11
11
|
|
|
12
12
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
13
13
|
|
|
14
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return z.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Or=`DialogDescriptionWarning`,kr=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Er(Or).contentName}}.`;return z.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Ar=tr,jr=sr,Mr=lr,Nr=pr,Pr=vr,Fr=br,Ir=Sr,Lr=`rovingFocusGroup.onEntryFocus`,Rr={bubbles:!1,cancelable:!0},zr=`RovingFocusGroup`,[Br,Vr,Hr]=mn(zr),[Ur,Wr]=dn(zr,[Hr]),[Gr,Kr]=Ur(zr),qr=z.forwardRef((e,t)=>(0,B.jsx)(Br.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,B.jsx)(Br.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,B.jsx)(Jr,{...e,ref:t})})}));qr.displayName=zr;var Jr=z.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=z.useRef(null),p=sn(t,f),m=wn(a),[h,g]=hn({prop:o,defaultProp:s??null,onChange:c,caller:zr}),[_,v]=z.useState(!1),y=Tn(l),b=Vr(n),x=z.useRef(!1),[S,C]=z.useState(0);return z.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(Lr,y),()=>e.removeEventListener(Lr,y)},[y]),(0,B.jsx)(Gr,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:z.useCallback(e=>g(e),[g]),onItemShiftTab:z.useCallback(()=>v(!0),[]),onFocusableItemAdd:z.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:z.useCallback(()=>C(e=>e-1),[]),children:(0,B.jsx)(N.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:P(e.onMouseDown,()=>{x.current=!0}),onFocus:P(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(Lr,Rr);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);ei([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:P(e.onBlur,()=>v(!1))})})}),Yr=`RovingFocusGroupItem`,Xr=z.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=Sn(),l=a||c,u=Kr(Yr,n),d=u.currentTabStopId===l,f=Vr(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return z.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,B.jsx)(Br.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,B.jsx)(N.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:P(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:P(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:P(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=$r(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?ti(n,r+1):n.slice(r+1)}setTimeout(()=>ei(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});Xr.displayName=Yr;var Zr={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Qr(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function $r(e,t,n){let r=Qr(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Zr[r]}function ei(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function ti(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var ni=qr,ri=Xr,ii=[`Enter`,` `],ai=[`ArrowDown`,`PageUp`,`Home`],oi=[`ArrowUp`,`PageDown`,`End`],si=[...ai,...oi],ci={ltr:[...ii,`ArrowRight`],rtl:[...ii,`ArrowLeft`]},li={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},ui=`Menu`,[di,fi,pi]=mn(ui),[mi,hi]=dn(ui,[pi,On,Wr]),gi=On(),_i=Wr(),[vi,yi]=mi(ui),[bi,xi]=mi(ui),Si=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=gi(t),[c,l]=z.useState(null),u=z.useRef(!1),d=Tn(a),f=wn(i);return z.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,B.jsx)(kn,{...s,children:(0,B.jsx)(vi,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,B.jsx)(bi,{scope:t,onClose:z.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};Si.displayName=ui;var Ci=`MenuAnchor`,wi=z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=gi(n);return(0,B.jsx)(Mn,{...i,...r,ref:t})});wi.displayName=Ci;var Ti=`MenuPortal`,[Ei,Di]=mi(Ti,{forceMount:void 0}),Oi=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=yi(Ti,t);return(0,B.jsx)(Ei,{scope:t,forceMount:n,children:(0,B.jsx)(gn,{present:n||a.open,children:(0,B.jsx)(vn,{asChild:!0,container:i,children:r})})})};Oi.displayName=Ti;var ki=`MenuContent`,[Ai,ji]=mi(ki),Mi=z.forwardRef((e,t)=>{let n=Di(ki,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=yi(ki,e.__scopeMenu),o=xi(ki,e.__scopeMenu);return(0,B.jsx)(di.Provider,{scope:e.__scopeMenu,children:(0,B.jsx)(gn,{present:r||a.open,children:(0,B.jsx)(di.Slot,{scope:e.__scopeMenu,children:o.modal?(0,B.jsx)(V,{...i,ref:t}):(0,B.jsx)(Ni,{...i,ref:t})})})})}),V=z.forwardRef((e,t)=>{let n=yi(ki,e.__scopeMenu),r=z.useRef(null),i=sn(t,r);return z.useEffect(()=>{let e=r.current;if(e)return Cn(e)},[]),(0,B.jsx)(Fi,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:P(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Ni=z.forwardRef((e,t)=>{let n=yi(ki,e.__scopeMenu);return(0,B.jsx)(Fi,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Pi=cn(`MenuContent.ScrollLock`),Fi=z.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=yi(ki,n),_=xi(ki,n),v=gi(n),y=_i(n),b=fi(n),[x,S]=z.useState(null),C=z.useRef(null),ee=sn(t,C,g.onContentChange),te=z.useRef(0),ne=z.useRef(``),re=z.useRef(0),w=z.useRef(null),ie=z.useRef(`right`),ae=z.useRef(0),oe=m?yn:z.Fragment,se=m?{as:Pi,allowPinchZoom:!0}:void 0,T=e=>{let t=ne.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=ya(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){ne.current=t,window.clearTimeout(te.current),t!==``&&(te.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};z.useEffect(()=>()=>window.clearTimeout(te.current),[]),xn();let E=z.useCallback(e=>ie.current===w.current?.side&&xa(e,w.current?.area),[]);return(0,B.jsx)(Ai,{scope:n,searchRef:ne,onItemEnter:z.useCallback(e=>{E(e)&&e.preventDefault()},[E]),onItemLeave:z.useCallback(e=>{E(e)||(C.current?.focus(),S(null))},[E]),onTriggerLeave:z.useCallback(e=>{E(e)&&e.preventDefault()},[E]),pointerGraceTimerRef:re,onPointerGraceIntentChange:z.useCallback(e=>{w.current=e},[]),children:(0,B.jsx)(oe,{...se,children:(0,B.jsx)(_n,{asChild:!0,trapped:i,onMountAutoFocus:P(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,B.jsx)(bn,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,B.jsx)(ni,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:P(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,B.jsx)(jn,{role:`menu`,"aria-orientation":`vertical`,"data-state":ma(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:ee,style:{outline:`none`,...h.style},onKeyDown:P(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&T(e.key));let i=C.current;if(e.target!==i||!si.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);oi.includes(e.key)&&a.reverse(),_a(a)}),onBlur:P(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(te.current),ne.current=``)}),onPointerMove:P(e.onPointerMove,Sa(e=>{let t=e.target,n=ae.current!==e.clientX;e.currentTarget.contains(t)&&n&&(ie.current=e.clientX>ae.current?`right`:`left`,ae.current=e.clientX)}))})})})})})})});Mi.displayName=ki;var Ii=`MenuGroup`,Li=z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,B.jsx)(N.div,{role:`group`,...r,ref:t})});Li.displayName=Ii;var Ri=`MenuLabel`,zi=z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,B.jsx)(N.div,{...r,ref:t})});zi.displayName=Ri;var Bi=`MenuItem`,Vi=`menu.itemSelect`,Hi=z.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=z.useRef(null),o=xi(Bi,e.__scopeMenu),s=ji(Bi,e.__scopeMenu),c=sn(t,a),l=z.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Vi,{bubbles:!0,cancelable:!0});e.addEventListener(Vi,e=>r?.(e),{once:!0}),un(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,B.jsx)(Ui,{...i,ref:c,disabled:n,onClick:P(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:P(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:P(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||ii.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});Hi.displayName=Bi;var Ui=z.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=ji(Bi,n),s=_i(n),c=z.useRef(null),l=sn(t,c),[u,d]=z.useState(!1),[f,p]=z.useState(``);return z.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,B.jsx)(di.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,B.jsx)(ri,{asChild:!0,...s,focusable:!r,children:(0,B.jsx)(N.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:P(e.onPointerMove,Sa(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:P(e.onPointerLeave,Sa(e=>o.onItemLeave(e))),onFocus:P(e.onFocus,()=>d(!0)),onBlur:P(e.onBlur,()=>d(!1))})})})}),Wi=`MenuCheckboxItem`,Gi=z.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,B.jsx)($i,{scope:e.__scopeMenu,checked:n,children:(0,B.jsx)(Hi,{role:`menuitemcheckbox`,"aria-checked":ha(n)?`mixed`:n,...i,ref:t,"data-state":ga(n),onSelect:P(i.onSelect,()=>r?.(ha(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Gi.displayName=Wi;var Ki=`MenuRadioGroup`,[qi,Ji]=mi(Ki,{value:void 0,onValueChange:()=>{}}),Yi=z.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=Tn(r);return(0,B.jsx)(qi,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,B.jsx)(Li,{...i,ref:t})})});Yi.displayName=Ki;var Xi=`MenuRadioItem`,Zi=z.forwardRef((e,t)=>{let{value:n,...r}=e,i=Ji(Xi,e.__scopeMenu),a=n===i.value;return(0,B.jsx)($i,{scope:e.__scopeMenu,checked:a,children:(0,B.jsx)(Hi,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":ga(a),onSelect:P(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Zi.displayName=Xi;var Qi=`MenuItemIndicator`,[$i,ea]=mi(Qi,{checked:!1}),ta=z.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=ea(Qi,n);return(0,B.jsx)(gn,{present:r||ha(a.checked)||a.checked===!0,children:(0,B.jsx)(N.span,{...i,ref:t,"data-state":ga(a.checked)})})});ta.displayName=Qi;var na=`MenuSeparator`,ra=z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,B.jsx)(N.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});ra.displayName=na;var ia=`MenuArrow`,aa=z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=gi(n);return(0,B.jsx)(An,{...i,...r,ref:t})});aa.displayName=ia;var oa=`MenuSub`,[sa,ca]=mi(oa),la=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=yi(oa,t),o=gi(t),[s,c]=z.useState(null),[l,u]=z.useState(null),d=Tn(i);return z.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,B.jsx)(kn,{...o,children:(0,B.jsx)(vi,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,B.jsx)(sa,{scope:t,contentId:Sn(),triggerId:Sn(),trigger:s,onTriggerChange:c,children:n})})})};la.displayName=oa;var ua=`MenuSubTrigger`,da=z.forwardRef((e,t)=>{let n=yi(ua,e.__scopeMenu),r=xi(ua,e.__scopeMenu),i=ca(ua,e.__scopeMenu),a=ji(ua,e.__scopeMenu),o=z.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=z.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return z.useEffect(()=>u,[u]),z.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,B.jsx)(wi,{asChild:!0,...l,children:(0,B.jsx)(Ui,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":ma(n.open),...e,ref:an(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:P(e.onPointerMove,Sa(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:P(e.onPointerLeave,Sa(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:P(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||ci[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});da.displayName=ua;var fa=`MenuSubContent`,pa=z.forwardRef((e,t)=>{let n=Di(ki,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=yi(ki,e.__scopeMenu),o=xi(ki,e.__scopeMenu),s=ca(fa,e.__scopeMenu),c=z.useRef(null),l=sn(t,c);return(0,B.jsx)(di.Provider,{scope:e.__scopeMenu,children:(0,B.jsx)(gn,{present:r||a.open,children:(0,B.jsx)(di.Slot,{scope:e.__scopeMenu,children:(0,B.jsx)(Fi,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:P(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:P(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:P(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=li[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});pa.displayName=fa;function ma(e){return e?`open`:`closed`}function ha(e){return e===`indeterminate`}function ga(e){return ha(e)?`indeterminate`:e?`checked`:`unchecked`}function _a(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function va(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function ya(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=va(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function ba(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function xa(e,t){return t?ba({x:e.clientX,y:e.clientY},t):!1}function Sa(e){return t=>t.pointerType===`mouse`?e(t):void 0}var Ca=Si,wa=wi,Ta=Oi,Ea=Mi,Da=Li,Oa=zi,ka=Hi,Aa=Gi,ja=Yi,Ma=Zi,Na=ta,Pa=ra,Fa=aa,Ia=da,La=pa,Ra=`DropdownMenu`,[za,Ba]=dn(Ra,[hi]),Va=hi(),[Ha,Ua]=za(Ra),Wa=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=Va(t),l=z.useRef(null),[u,d]=hn({prop:i,defaultProp:a??!1,onChange:o,caller:Ra});return(0,B.jsx)(Ha,{scope:t,triggerId:Sn(),triggerRef:l,contentId:Sn(),open:u,onOpenChange:d,onOpenToggle:z.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,B.jsx)(Ca,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};Wa.displayName=Ra;var Ga=`DropdownMenuTrigger`,Ka=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=Ua(Ga,n),o=Va(n);return(0,B.jsx)(wa,{asChild:!0,...o,children:(0,B.jsx)(N.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:an(t,a.triggerRef),onPointerDown:P(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:P(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Ka.displayName=Ga;var qa=`DropdownMenuPortal`,Ja=e=>{let{__scopeDropdownMenu:t,...n}=e,r=Va(t);return(0,B.jsx)(Ta,{...r,...n})};Ja.displayName=qa;var Ya=`DropdownMenuContent`,Xa=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ua(Ya,n),a=Va(n),o=z.useRef(!1);return(0,B.jsx)(Ea,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:P(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:P(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Xa.displayName=Ya;var Za=`DropdownMenuGroup`,Qa=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Va(n);return(0,B.jsx)(Da,{...i,...r,ref:t})});Qa.displayName=Za;var $a=`DropdownMenuLabel`,eo=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Va(n);return(0,B.jsx)(Oa,{...i,...r,ref:t})});eo.displayName=$a;var to=`DropdownMenuItem`,no=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Va(n);return(0,B.jsx)(ka,{...i,...r,ref:t})});no.displayName=to;var ro=`DropdownMenuCheckboxItem`,io=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Va(n);return(0,B.jsx)(Aa,{...i,...r,ref:t})});io.displayName=ro;var ao=`DropdownMenuRadioGroup`,oo=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Va(n);return(0,B.jsx)(ja,{...i,...r,ref:t})});oo.displayName=ao;var so=`DropdownMenuRadioItem`,co=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Va(n);return(0,B.jsx)(Ma,{...i,...r,ref:t})});co.displayName=so;var lo=`DropdownMenuItemIndicator`,uo=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Va(n);return(0,B.jsx)(Na,{...i,...r,ref:t})});uo.displayName=lo;var H=`DropdownMenuSeparator`,U=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Va(n);return(0,B.jsx)(Pa,{...i,...r,ref:t})});U.displayName=H;var fo=`DropdownMenuArrow`,po=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Va(n);return(0,B.jsx)(Fa,{...i,...r,ref:t})});po.displayName=fo;var mo=`DropdownMenuSubTrigger`,ho=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Va(n);return(0,B.jsx)(Ia,{...i,...r,ref:t})});ho.displayName=mo;var go=`DropdownMenuSubContent`,_o=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Va(n);return(0,B.jsx)(La,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});_o.displayName=go;var vo=Wa,yo=Ka,bo=Ja,xo=Xa,So=eo,Co=no,wo=U,To=`Label`,Eo=z.forwardRef((e,t)=>(0,B.jsx)(N.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));Eo.displayName=To;var Do=Eo;function Oo(e,t){return z.useReducer((e,n)=>t[e][n]??e,e)}var ko=`ScrollArea`,[Ao,jo]=dn(ko),[Mo,No]=Ao(ko),Po=z.forwardRef((e,t)=>{let{__scopeScrollArea:n,type:r=`hover`,dir:i,scrollHideDelay:a=600,...o}=e,[s,c]=z.useState(null),[l,u]=z.useState(null),[d,f]=z.useState(null),[p,m]=z.useState(null),[h,g]=z.useState(null),[_,v]=z.useState(0),[y,b]=z.useState(0),[x,S]=z.useState(!1),[C,ee]=z.useState(!1),te=sn(t,e=>c(e)),ne=wn(i);return(0,B.jsx)(Mo,{scope:n,type:r,dir:ne,scrollHideDelay:a,scrollArea:s,viewport:l,onViewportChange:u,content:d,onContentChange:f,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:x,onScrollbarXEnabledChange:S,scrollbarY:h,onScrollbarYChange:g,scrollbarYEnabled:C,onScrollbarYEnabledChange:ee,onCornerWidthChange:v,onCornerHeightChange:b,children:(0,B.jsx)(N.div,{dir:ne,...o,ref:te,style:{position:`relative`,"--radix-scroll-area-corner-width":_+`px`,"--radix-scroll-area-corner-height":y+`px`,...e.style}})})});Po.displayName=ko;var Fo=`ScrollAreaViewport`,Io=z.forwardRef((e,t)=>{let{__scopeScrollArea:n,children:r,nonce:i,...a}=e,o=No(Fo,n),s=sn(t,z.useRef(null),o.onViewportChange);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}`},nonce:i}),(0,B.jsx)(N.div,{"data-radix-scroll-area-viewport":``,...a,ref:s,style:{overflowX:o.scrollbarXEnabled?`scroll`:`hidden`,overflowY:o.scrollbarYEnabled?`scroll`:`hidden`,...e.style},children:(0,B.jsx)(`div`,{ref:o.onContentChange,style:{minWidth:`100%`,display:`table`},children:r})})]})});Io.displayName=Fo;var Lo=`ScrollAreaScrollbar`,Ro=z.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=No(Lo,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:o}=i,s=e.orientation===`horizontal`;return z.useEffect(()=>(s?a(!0):o(!0),()=>{s?a(!1):o(!1)}),[s,a,o]),i.type===`hover`?(0,B.jsx)(zo,{...r,ref:t,forceMount:n}):i.type===`scroll`?(0,B.jsx)(Bo,{...r,ref:t,forceMount:n}):i.type===`auto`?(0,B.jsx)(Vo,{...r,ref:t,forceMount:n}):i.type===`always`?(0,B.jsx)(Ho,{...r,ref:t}):null});Ro.displayName=Lo;var zo=z.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=No(Lo,e.__scopeScrollArea),[a,o]=z.useState(!1);return z.useEffect(()=>{let e=i.scrollArea,t=0;if(e){let n=()=>{window.clearTimeout(t),o(!0)},r=()=>{t=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return e.addEventListener(`pointerenter`,n),e.addEventListener(`pointerleave`,r),()=>{window.clearTimeout(t),e.removeEventListener(`pointerenter`,n),e.removeEventListener(`pointerleave`,r)}}},[i.scrollArea,i.scrollHideDelay]),(0,B.jsx)(gn,{present:n||a,children:(0,B.jsx)(Vo,{"data-state":a?`visible`:`hidden`,...r,ref:t})})}),Bo=z.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=No(Lo,e.__scopeScrollArea),a=e.orientation===`horizontal`,o=cs(()=>c(`SCROLL_END`),100),[s,c]=Oo(`hidden`,{hidden:{SCROLL:`scrolling`},scrolling:{SCROLL_END:`idle`,POINTER_ENTER:`interacting`},interacting:{SCROLL:`interacting`,POINTER_LEAVE:`idle`},idle:{HIDE:`hidden`,SCROLL:`scrolling`,POINTER_ENTER:`interacting`}});return z.useEffect(()=>{if(s===`idle`){let e=window.setTimeout(()=>c(`HIDE`),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[s,i.scrollHideDelay,c]),z.useEffect(()=>{let e=i.viewport,t=a?`scrollLeft`:`scrollTop`;if(e){let n=e[t],r=()=>{let r=e[t];n!==r&&(c(`SCROLL`),o()),n=r};return e.addEventListener(`scroll`,r),()=>e.removeEventListener(`scroll`,r)}},[i.viewport,a,c,o]),(0,B.jsx)(gn,{present:n||s!==`hidden`,children:(0,B.jsx)(Ho,{"data-state":s===`hidden`?`hidden`:`visible`,...r,ref:t,onPointerEnter:P(e.onPointerEnter,()=>c(`POINTER_ENTER`)),onPointerLeave:P(e.onPointerLeave,()=>c(`POINTER_LEAVE`))})})}),Vo=z.forwardRef((e,t)=>{let n=No(Lo,e.__scopeScrollArea),{forceMount:r,...i}=e,[a,o]=z.useState(!1),s=e.orientation===`horizontal`,c=cs(()=>{if(n.viewport){let e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;o(s?e:t)}},10);return ls(n.viewport,c),ls(n.content,c),(0,B.jsx)(gn,{present:r||a,children:(0,B.jsx)(Ho,{"data-state":a?`visible`:`hidden`,...i,ref:t})})}),Ho=z.forwardRef((e,t)=>{let{orientation:n=`vertical`,...r}=e,i=No(Lo,e.__scopeScrollArea),a=z.useRef(null),o=z.useRef(0),[s,c]=z.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=ts(s.viewport,s.content),u={...r,sizes:s,onSizesChange:c,hasThumb:l>0&&l<1,onThumbChange:e=>a.current=e,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:e=>o.current=e};function d(e,t){return rs(e,o.current,s,t)}return n===`horizontal`?(0,B.jsx)(Uo,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollLeft,t=is(e,s,i.dir);a.current.style.transform=`translate3d(${t}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=d(e,i.dir))}}):n===`vertical`?(0,B.jsx)(Wo,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollTop,t=is(e,s);a.current.style.transform=`translate3d(0, ${t}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=d(e))}}):null}),Uo=z.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=No(Lo,e.__scopeScrollArea),[o,s]=z.useState(),c=z.useRef(null),l=sn(t,c,a.onScrollbarXChange);return z.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,B.jsx)(qo,{"data-orientation":`horizontal`,...i,ref:l,sizes:n,style:{bottom:0,left:a.dir===`rtl`?`var(--radix-scroll-area-corner-width)`:0,right:a.dir===`ltr`?`var(--radix-scroll-area-corner-width)`:0,"--radix-scroll-area-thumb-width":ns(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollLeft+t.deltaX;e.onWheelScroll(r),os(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:es(o.paddingLeft),paddingEnd:es(o.paddingRight)}})}})}),Wo=z.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=No(Lo,e.__scopeScrollArea),[o,s]=z.useState(),c=z.useRef(null),l=sn(t,c,a.onScrollbarYChange);return z.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,B.jsx)(qo,{"data-orientation":`vertical`,...i,ref:l,sizes:n,style:{top:0,right:a.dir===`ltr`?0:void 0,left:a.dir===`rtl`?0:void 0,bottom:`var(--radix-scroll-area-corner-height)`,"--radix-scroll-area-thumb-height":ns(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollTop+t.deltaY;e.onWheelScroll(r),os(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:es(o.paddingTop),paddingEnd:es(o.paddingBottom)}})}})}),[Go,Ko]=Ao(Lo),qo=z.forwardRef((e,t)=>{let{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:a,onThumbPointerUp:o,onThumbPointerDown:s,onThumbPositionChange:c,onDragScroll:l,onWheelScroll:u,onResize:d,...f}=e,p=No(Lo,n),[m,h]=z.useState(null),g=sn(t,e=>h(e)),_=z.useRef(null),v=z.useRef(``),y=p.viewport,b=r.content-r.viewport,x=Tn(u),S=Tn(c),C=cs(d,10);function ee(e){_.current&&l({x:e.clientX-_.current.left,y:e.clientY-_.current.top})}return z.useEffect(()=>{let e=e=>{let t=e.target;m?.contains(t)&&x(e,b)};return document.addEventListener(`wheel`,e,{passive:!1}),()=>document.removeEventListener(`wheel`,e,{passive:!1})},[y,m,b,x]),z.useEffect(S,[r,S]),ls(m,C),ls(p.content,C),(0,B.jsx)(Go,{scope:n,scrollbar:m,hasThumb:i,onThumbChange:Tn(a),onThumbPointerUp:Tn(o),onThumbPositionChange:S,onThumbPointerDown:Tn(s),children:(0,B.jsx)(N.div,{...f,ref:g,style:{position:`absolute`,...f.style},onPointerDown:P(e.onPointerDown,e=>{e.button===0&&(e.target.setPointerCapture(e.pointerId),_.current=m.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect=`none`,p.viewport&&(p.viewport.style.scrollBehavior=`auto`),ee(e))}),onPointerMove:P(e.onPointerMove,ee),onPointerUp:P(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=v.current,p.viewport&&(p.viewport.style.scrollBehavior=``),_.current=null})})})}),Jo=`ScrollAreaThumb`,Yo=z.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=Ko(Jo,e.__scopeScrollArea);return(0,B.jsx)(gn,{present:n||i.hasThumb,children:(0,B.jsx)(Xo,{ref:t,...r})})}),Xo=z.forwardRef((e,t)=>{let{__scopeScrollArea:n,style:r,...i}=e,a=No(Jo,n),o=Ko(Jo,n),{onThumbPositionChange:s}=o,c=sn(t,e=>o.onThumbChange(e)),l=z.useRef(void 0),u=cs(()=>{l.current&&=(l.current(),void 0)},100);return z.useEffect(()=>{let e=a.viewport;if(e){let t=()=>{u(),l.current||(l.current=ss(e,s),s())};return s(),e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)}},[a.viewport,u,s]),(0,B.jsx)(N.div,{"data-state":o.hasThumb?`visible`:`hidden`,...i,ref:c,style:{width:`var(--radix-scroll-area-thumb-width)`,height:`var(--radix-scroll-area-thumb-height)`,...r},onPointerDownCapture:P(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;o.onThumbPointerDown({x:n,y:r})}),onPointerUp:P(e.onPointerUp,o.onThumbPointerUp)})});Yo.displayName=Jo;var Zo=`ScrollAreaCorner`,Qo=z.forwardRef((e,t)=>{let n=No(Zo,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!==`scroll`&&r?(0,B.jsx)($o,{...e,ref:t}):null});Qo.displayName=Zo;var $o=z.forwardRef((e,t)=>{let{__scopeScrollArea:n,...r}=e,i=No(Zo,n),[a,o]=z.useState(0),[s,c]=z.useState(0),l=!!(a&&s);return ls(i.scrollbarX,()=>{let e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),c(e)}),ls(i.scrollbarY,()=>{let e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),o(e)}),l?(0,B.jsx)(N.div,{...r,ref:t,style:{width:a,height:s,position:`absolute`,right:i.dir===`ltr`?0:void 0,left:i.dir===`rtl`?0:void 0,bottom:0,...e.style}}):null});function es(e){return e?parseInt(e,10):0}function ts(e,t){let n=e/t;return isNaN(n)?0:n}function ns(e){let t=ts(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function rs(e,t,n,r=`ltr`){let i=ns(n),a=i/2,o=t||a,s=i-o,c=n.scrollbar.paddingStart+o,l=n.scrollbar.size-n.scrollbar.paddingEnd-s,u=n.content-n.viewport,d=r===`ltr`?[0,u]:[u*-1,0];return as([c,l],d)(e)}function is(e,t,n=`ltr`){let r=ns(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,o=t.content-t.viewport,s=a-r,c=Nn(e,n===`ltr`?[0,o]:[o*-1,0]);return as([0,o],[0,s])(c)}function as(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function os(e,t){return e>0&&e<t}var ss=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function i(){let a={left:e.scrollLeft,top:e.scrollTop},o=n.left!==a.left,s=n.top!==a.top;(o||s)&&t(),n=a,r=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(r)};function cs(e,t){let n=Tn(e),r=z.useRef(0);return z.useEffect(()=>()=>window.clearTimeout(r.current),[]),z.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function ls(e,t){let n=Tn(t);pn(()=>{let t=0;if(e){let r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(n)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}},[e,n])}var us=Po,ds=Io,fs=Qo,ps=`Separator`,ms=`horizontal`,hs=[`horizontal`,`vertical`],gs=z.forwardRef((e,t)=>{let{decorative:n,orientation:r=ms,...i}=e,a=_s(r)?r:ms,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,B.jsx)(N.div,{"data-orientation":a,...o,...i,ref:t})});gs.displayName=ps;function _s(e){return hs.includes(e)}var vs=gs,ys=`Switch`,[bs,xs]=dn(ys),[Ss,Cs]=bs(ys),ws=z.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c=`on`,onCheckedChange:l,form:u,...d}=e,[f,p]=z.useState(null),m=sn(t,e=>p(e)),h=z.useRef(!1),g=f?u||!!f.closest(`form`):!0,[_,v]=hn({prop:i,defaultProp:a??!1,onChange:l,caller:ys});return(0,B.jsxs)(Ss,{scope:n,checked:_,disabled:s,children:[(0,B.jsx)(N.button,{type:`button`,role:`switch`,"aria-checked":_,"aria-required":o,"data-state":ks(_),"data-disabled":s?``:void 0,disabled:s,value:c,...d,ref:m,onClick:P(e.onClick,e=>{v(e=>!e),g&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})}),g&&(0,B.jsx)(Os,{control:f,bubbles:!h.current,name:r,value:c,checked:_,required:o,disabled:s,form:u,style:{transform:`translateX(-100%)`}})]})});ws.displayName=ys;var Ts=`SwitchThumb`,Es=z.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=Cs(Ts,n);return(0,B.jsx)(N.span,{"data-state":ks(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});Es.displayName=Ts;var Ds=`SwitchBubbleInput`,Os=z.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=z.useRef(null),s=sn(o,a),c=En(n),l=Dn(t);return z.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(c!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[c,n,r]),(0,B.jsx)(`input`,{type:`checkbox`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...l,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});Os.displayName=Ds;function ks(e){return e?`checked`:`unchecked`}var As=ws,js=Es,Ms=`Tabs`,[Ns,Ps]=dn(Ms,[Wr]),Fs=Wr(),[Is,Ls]=Ns(Ms),Rs=z.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=wn(s),[d,f]=hn({prop:r,onChange:i,defaultProp:a??``,caller:Ms});return(0,B.jsx)(Is,{scope:n,baseId:Sn(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,B.jsx)(N.div,{dir:u,"data-orientation":o,...l,ref:t})})});Rs.displayName=Ms;var zs=`TabsList`,Bs=z.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=Ls(zs,n),o=Fs(n);return(0,B.jsx)(ni,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,B.jsx)(N.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});Bs.displayName=zs;var Vs=`TabsTrigger`,Hs=z.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=Ls(Vs,n),s=Fs(n),c=Gs(o.baseId,r),l=Ks(o.baseId,r),u=r===o.value;return(0,B.jsx)(ri,{asChild:!0,...s,focusable:!i,active:u,children:(0,B.jsx)(N.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:P(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:P(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:P(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});Hs.displayName=Vs;var Us=`TabsContent`,Ws=z.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=Ls(Us,n),c=Gs(s.baseId,r),l=Ks(s.baseId,r),u=r===s.value,d=z.useRef(u);return z.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,B.jsx)(gn,{present:i||u,children:({present:n})=>(0,B.jsx)(N.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});Ws.displayName=Us;function Gs(e,t){return`${e}-trigger-${t}`}function Ks(e,t){return`${e}-content-${t}`}var qs=Rs,Js=Bs,Ys=Hs,Xs=Ws,[Zs,Qs]=dn(`Tooltip`,[On]),$s=On(),ec=`TooltipProvider`,tc=700,nc=`tooltip.open`,[rc,ic]=Zs(ec),ac=e=>{let{__scopeTooltip:t,delayDuration:n=tc,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=z.useRef(!0),s=z.useRef(!1),c=z.useRef(0);return z.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,B.jsx)(rc,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:z.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:z.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:z.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};ac.displayName=ec;var oc=`Tooltip`,[sc,cc]=Zs(oc),lc=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=ic(oc,e.__scopeTooltip),l=$s(t),[u,d]=z.useState(null),f=Sn(),p=z.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=z.useRef(!1),[_,v]=hn({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(nc))):c.onClose(),a?.(e)},caller:oc}),y=z.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),b=z.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),x=z.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),S=z.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return z.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,B.jsx)(kn,{...l,children:(0,B.jsx)(sc,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:z.useCallback(()=>{c.isOpenDelayedRef.current?S():b()},[c.isOpenDelayedRef,S,b]),onTriggerLeave:z.useCallback(()=>{m?x():(window.clearTimeout(p.current),p.current=0)},[x,m]),onOpen:b,onClose:x,disableHoverableContent:m,children:n})})};lc.displayName=oc;var uc=`TooltipTrigger`,dc=z.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=cc(uc,n),a=ic(uc,n),o=$s(n),s=sn(t,z.useRef(null),i.onTriggerChange),c=z.useRef(!1),l=z.useRef(!1),u=z.useCallback(()=>c.current=!1,[]);return z.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,B.jsx)(Mn,{asChild:!0,...o,children:(0,B.jsx)(N.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:P(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:P(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:P(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:P(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:P(e.onBlur,i.onClose),onClick:P(e.onClick,i.onClose)})})});dc.displayName=uc;var fc=`TooltipPortal`,[pc,mc]=Zs(fc,{forceMount:void 0}),hc=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=cc(fc,t);return(0,B.jsx)(pc,{scope:t,forceMount:n,children:(0,B.jsx)(gn,{present:n||a.open,children:(0,B.jsx)(vn,{asChild:!0,container:i,children:r})})})};hc.displayName=fc;var gc=`TooltipContent`,_c=z.forwardRef((e,t)=>{let n=mc(gc,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=cc(gc,e.__scopeTooltip);return(0,B.jsx)(gn,{present:r||o.open,children:o.disableHoverableContent?(0,B.jsx)(Sc,{side:i,...a,ref:t}):(0,B.jsx)(vc,{side:i,...a,ref:t})})}),vc=z.forwardRef((e,t)=>{let n=cc(gc,e.__scopeTooltip),r=ic(gc,e.__scopeTooltip),i=z.useRef(null),a=sn(t,i),[o,s]=z.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=z.useCallback(()=>{s(null),d(!1)},[d]),p=z.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Ec(r,Tc(r,n.getBoundingClientRect())),a=Dc(t.getBoundingClientRect());s(kc([...i,...a])),d(!0)},[d]);return z.useEffect(()=>()=>f(),[f]),z.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),z.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!Oc(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,B.jsx)(Sc,{...e,ref:a})}),[yc,bc]=Zs(oc,{isInside:!1}),xc=on(`TooltipContent`),Sc=z.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=cc(gc,n),l=$s(n),{onClose:u}=c;return z.useEffect(()=>(document.addEventListener(nc,u),()=>document.removeEventListener(nc,u)),[u]),z.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,B.jsx)(bn,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,B.jsxs)(jn,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,B.jsx)(xc,{children:r}),(0,B.jsx)(yc,{scope:n,isInside:!0,children:(0,B.jsx)(Yn,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});_c.displayName=gc;var Cc=`TooltipArrow`,wc=z.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=$s(n);return bc(Cc,n).isInside?null:(0,B.jsx)(An,{...i,...r,ref:t})});wc.displayName=Cc;function Tc(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function Ec(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Dc(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function Oc(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function kc(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),Ac(t)}function Ac(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var jc=ac,Mc=lc,Nc=dc,Pc=hc,Fc=_c,Ic=wc;function Lc({delayDuration:e=0,...t}){return(0,B.jsx)(jc,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function Rc({...e}){return(0,B.jsx)(Mc,{"data-slot":`tooltip`,...e})}function zc({...e}){return(0,B.jsx)(Nc,{"data-slot":`tooltip-trigger`,...e})}function Bc({className:e,sideOffset:t=0,children:n,...r}){return(0,B.jsx)(Pc,{children:(0,B.jsxs)(Fc,{"data-slot":`tooltip-content`,sideOffset:t,className:O(`z-50 inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[n,(0,B.jsx)(Ic,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground`})]})})}function W(e){return A(e)}function Vc(){let e=W(e=>e.pairs);return(0,z.useMemo)(()=>{let t={};for(let n of e)(n.status===`active`||n.status===`pending`)&&(n.requesterId&&(t[n.requesterId]=n),n.targetId&&(t[n.targetId]=n));return t},[e])}function Hc(e){let t=W(e=>e.messages),n=W(e=>e.tasks),r=W(e=>e.pairs),i=W(e=>e.inboxReadCursors),a=W(e=>e.inboxArchivedThreads);return(0,z.useMemo)(()=>{if(!e)return{unread:0,needsHumanResponse:!1,pendingPairInvite:!1,claimableTasks:0,total:0,score:0};let o=t.filter(t=>Qt(t)===e.id&&!St(t)),s=Number(a[e.id]||0),c=s>=o.filter(e=>Ot(e)&&Dt(e)).reduce((e,t)=>Math.max(e,t.id),0)&&s>0?0:o.filter(t=>Tt(i,e.id,t)).length,l=qt(e),u=r.find(t=>(t.status===`active`||t.status===`pending`)&&(t.requesterId===e.id||t.targetId===e.id))?.status===`pending`,d=n.filter(t=>Xt(t)&&Yt(t.target,e)).length+t.filter(t=>bt(t)&&Yt(t.to,e)).length;return{unread:c,needsHumanResponse:l,pendingPairInvite:u,claimableTasks:d,total:c+ +!!l+ +!!u+d,score:c*10+(l?8:0)+(u?4:0)+d*2}},[e,t,n,r,i,a])}function Uc(){let e=W(e=>e.agents),t=W(e=>e.showBuiltIns),n=W(e=>e.showOffline),r=W(e=>e.agentSort),i=W(e=>e.agentSortDir),a=W(e=>e.agentPresetFilter),o=W(e=>e.agentStatusFilter),s=W(e=>e.agentTagFilter),c=W(e=>e.agentHostFilter),l=W(e=>e.managedPolicies),u=W(e=>e.pairs);return(0,z.useMemo)(()=>{let d=At(e,t,l);if(a){let e=Wc(u);d=Gc(d,a,vt.getState().now,e)}n||(d=d.filter(e=>e.status!==`offline`)),o===`starting`?d=d.filter(e=>e.status!==`offline`&&!e.ready):o&&(d=d.filter(e=>e.status===o)),s&&(d=d.filter(e=>(e.tags||[]).includes(s))),c&&(d=d.filter(e=>(e.machine||``)===c));let f=i===`desc`?-1:1;return[...d].sort((e,t)=>r===`name`?M(e).localeCompare(M(t))*f:r===`lastSeen`?(new Date(t.lastSeen).getTime()-new Date(e.lastSeen).getTime())*f||M(e).localeCompare(M(t)):r===`created`?(new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime())*f||M(e).localeCompare(M(t)):((Bt[e.status]??9)-(Bt[t.status]??9))*f||M(e).localeCompare(M(t)))},[e,t,n,l,r,i,a,o,s,c,u,gt()])}function Wc(e){let t={};for(let n of e)(n.status===`active`||n.status===`pending`)&&(n.requesterId&&(t[n.requesterId]=n),n.targetId&&(t[n.targetId]=n));return t}function Gc(e,t,n,r){switch(t){case`active`:return e.filter(e=>e.status!==`offline`);case`offline_stale`:return e.filter(e=>e.status===`offline`||Zt(n,e));case`claude`:case`codex`:return e.filter(e=>Ut(e)===t);case`paired`:return e.filter(e=>!!r[e.id]);case`unpaired`:return e.filter(e=>!r[e.id]);default:return e}}function Kc(){let e=W(e=>e.messages),t=W(e=>e.inboxReadCursors),n=W(e=>e.inboxArchivedThreads),r=W(e=>e.inboxDrafts),i=W(e=>e.agentsById),a=W(e=>e.coordinatorMutes);return(0,z.useMemo)(()=>{let o=new Map;for(let t of e){if(St(t))continue;let e=Qt(t);e&&(o.has(e)||o.set(e,{id:e,peer:e,messages:[],lastMessage:null,previewMessage:null,attention:{unread:0,needsHumanResponse:!1,score:0},archived:!1,draft:``}),o.get(e).messages.push(t))}for(let e of o.values()){e.messages.sort((e,t)=>e.id-t.id),e.lastMessage=e.messages[e.messages.length-1]||null;let o=null;for(let t=e.messages.length-1;t>=0;t--){let n=e.messages[t];if(n&&!xt(n)){o=n;break}}e.previewMessage=o||e.lastMessage;let s=a.includes(e.peer),c=s?0:e.messages.filter(n=>Tt(t,e.peer,n)).length,l=s?!1:qt(i[e.peer]);e.attention={unread:c,needsHumanResponse:l,score:c*10+(l?8:0)};let u=Number(n[e.peer]||0);e.archived=!!(e.lastMessage?.id&&u>=e.lastMessage.id),e.draft=r[e.peer]||``}return[...o.values()].sort((e,t)=>{let n=(t.attention.score||0)-(e.attention.score||0);return n===0?(t.lastMessage?.id||0)-(e.lastMessage?.id||0):n})},[e,t,n,r,i,a])}function qc(){let e=Kc(),t=W(e=>e.agents),n=W(e=>e.showBuiltIns),r=W(e=>e.showOffline),i=W(e=>e.managedPolicies),a=W(e=>e.pairs),o=W(e=>e.tasks),s=W(e=>e.messages),c=(0,z.useMemo)(()=>new Set(At(t,n,i).filter(e=>r||e.status!==`offline`).map(e=>e.id)),[t,n,r,i]);return(0,z.useMemo)(()=>{let l=e.filter(e=>!e.archived&&c.has(e.peer)).reduce((e,t)=>e+(t.attention.unread||0),0),u=At(t,n,i).filter(e=>(r||e.status!==`offline`)&&qt(e)).length,d=a.filter(e=>e.status===`pending`).length,f=o.filter(Xt).length+s.filter(bt).length;return{unreadInbox:l,needsHumanResponse:u,pendingPairInvites:d,claimableTasks:f,total:l+u+d+f}},[e,c,t,n,r,i,a,o,s])}function Jc(){let e=W(e=>e.agents),t=W(e=>e.showBuiltIns),n=W(e=>e.managedPolicies);return(0,z.useMemo)(()=>At(e,t,n).filter(e=>e.status!==`offline`).length,[e,t,n])}function Yc(){let e=W(e=>e.agents);return(0,z.useMemo)(()=>e.filter(e=>e.status===`busy`).length,[e])}function Xc(){let e=W(e=>e.agents),t=W(e=>e.showBuiltIns),n=W(e=>e.showOffline),r=W(e=>e.managedPolicies);return(0,z.useMemo)(()=>{let i=At(e,t,r);return n?i:i.filter(e=>e.status!==`offline`)},[e,t,n,r])}function Zc(){let e=W(e=>e.agents),t=W(e=>e.showBuiltIns),n=W(e=>e.managedPolicies);return(0,z.useMemo)(()=>[...new Set(At(e,t,n).map(e=>e.machine).filter(Boolean))].sort(),[e,t,n])}function Qc(){let e=W(e=>e.agents),t=W(e=>e.showBuiltIns),n=W(e=>e.managedPolicies);return(0,z.useMemo)(()=>[...new Set(At(e,t,n).flatMap(e=>e.tags||[]))],[e,t,n])}function $c(){let e=W(e=>e.tasks),t=W(e=>e.messages);return(0,z.useMemo)(()=>{let n=e.filter(e=>!Et.has(e.status)).map(e=>({id:`task-`+e.id,sourceType:`task`,title:e.title,body:e.body,severity:e.severity||`info`,status:e.status,owner:e.claimedBy||``,target:e.target,source:e.source,channel:e.channel||``,updatedAt:e.updatedAt||e.createdAt,createdAt:e.createdAt,claimable:Xt(e),task:e})),r=t.filter(bt).map(e=>({id:`message-`+e.id,sourceType:`message`,title:e.subject||`Claimable message #`+e.id,body:zt(e),severity:`warning`,status:e.claimedBy?`claimed`:`open`,owner:e.claimedBy||``,target:e.to,source:`message`,channel:e.channel||``,updatedAt:e.claimedAt||e.createdAt,createdAt:e.createdAt,claimable:bt(e),message:e}));return[...n,...r].sort((e,t)=>{let n=Number(t.claimable)-Number(e.claimable);if(n!==0)return n;let r={critical:0,warning:1,info:2},i=(r[e.severity]??9)-(r[t.severity]??9);return i===0?Kt(e.updatedAt)-Kt(t.updatedAt):i})},[e,t])}function el(){let e=W(e=>e.commandQuery),t=W(e=>e.agents),n=W(e=>e.agentsById),r=W(e=>e.showBuiltIns),i=W(e=>e.showOffline),a=W(e=>e.managedPolicies);return(0,z.useMemo)(()=>{let n=At(t,r,a).filter(e=>i||e.status!==`offline`),o=[...new Set(n.flatMap(e=>e.tags||[]))],s=Le(),c=[G(`open-chat`,`Open chat`,`Human console`,`MessageCircle`,`openView`,{view:`chat`}),G(`open-work`,`Open work queue`,`Claimable messages and tasks`,`ListChecks`,`openView`,{view:`work`}),G(`open-workspaces`,`Open workspaces`,`Agent worktrees and merge state`,`GitBranch`,`openView`,{view:`workspaces`}),G(`show-stale`,`Show stale agents`,`Filter agents to offline or stale`,`Filter`,`agentPreset`,{preset:`offline_stale`}),G(`copy-url`,`Copy relay URL`,s,`Copy`,`copy`,{value:s}),G(`export-md`,`Export timeline as Markdown`,`Activity audit trace`,`FileDown`,`exportActivity`,{format:`markdown`}),G(`export-json`,`Export timeline as JSON`,`Activity audit trace`,`Braces`,`exportActivity`,{format:`json`}),...n.slice(0,12).map(e=>G(`msg-`+e.id,`Message agent: `+M(e),e.id,`Send`,`messageAgent`,{agentId:e.id})),...n.filter(e=>Ut(e)===`codex`).slice(0,8).map(e=>G(`pair-`+e.id,`Pair Codex: `+M(e),e.id,`Link`,`pairAgent`,{agentId:e.id})),...o.map(e=>G(`tag-`+e,`Filter tag: `+e,`#`+e,`Tag`,`filterTag`,{tag:e}))],l=e.trim().toLowerCase();return(l?c.filter(e=>e.search.includes(l)):c).slice(0,24)},[e,t,n,r,i,a])}function G(e,t,n,r,i,a){return{id:e,title:t,subtitle:n,icon:r,action:i,payload:a,search:`${t}\n${n}\n${i}`.toLowerCase()}}function tl({className:e,size:t=`default`,...n}){return(0,B.jsx)(As,{"data-slot":`switch`,"data-size":t,className:O(`peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50`,e),...n,children:(0,B.jsx)(js,{"data-slot":`switch-thumb`,className:`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground`})})}function nl({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return(0,B.jsx)(vs,{"data-slot":`separator`,decorative:n,orientation:t,className:O(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,e),...r})}function rl({...e}){return(0,B.jsx)(vo,{"data-slot":`dropdown-menu`,...e})}function il({...e}){return(0,B.jsx)(yo,{"data-slot":`dropdown-menu-trigger`,...e})}function al({className:e,align:t=`start`,sideOffset:n=4,...r}){return(0,B.jsx)(bo,{children:(0,B.jsx)(xo,{"data-slot":`dropdown-menu-content`,sideOffset:n,align:t,className:O(`z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:overflow-hidden data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r})})}function ol({className:e,inset:t,variant:n=`default`,...r}){return(0,B.jsx)(Co,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:O(`group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function sl({className:e,inset:t,...n}){return(0,B.jsx)(So,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:O(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,e),...n})}function cl({className:e,...t}){return(0,B.jsx)(wo,{"data-slot":`dropdown-menu-separator`,className:O(`-mx-1 my-1 h-px bg-border`,e),...t})}var ll={LayoutDashboard:at,MessageCircle:Ze,Bot:w,Server:l,MessagesSquare:Oe,Plug:dt,PlugZap:pe,Activity:ve,Link:Ue,Mail:qe,ListChecks:Ye,ClipboardList:Te,CalendarClock:ne,AreaChart:de,Settings:ue,Workflow:Ge,BrainCircuit:Re,FolderTree:ie,Shield:s,Wrench:k,UserCog:ke,Lightbulb:xe,Users:Ve,Boxes:C,PackagePlus:_e};function ul(e){return new Date(e.createdAt).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`})}var dl=[[`messages`,`Messages`],[`replies`,`Replies`],[`errors`,`Errors`]];function fl(){let e=A(e=>e.notifications),t=A(e=>e.notificationUnread),n=A(e=>e.notificationSettings),r=A(e=>e.notificationPermission),i=A(e=>e.set),a=A(e=>e.openNotification),o=A(e=>e.markNotificationsRead),s=A(e=>e.clearNotifications),l=A(e=>e.requestBrowserNotifications),u=t>0?x:m;function d(e){i({notificationSettings:{...n,...e}})}return(0,B.jsxs)(rl,{onOpenChange:e=>{e&&o()},children:[(0,B.jsx)(il,{asChild:!0,children:(0,B.jsxs)(`button`,{className:`relative flex items-center gap-2 text-muted-foreground hover:text-foreground transition-colors w-full`,children:[(0,B.jsx)(u,{className:`w-3.5 h-3.5`}),(0,B.jsx)(`span`,{children:`Notifications`}),t>0&&(0,B.jsx)(F,{variant:`destructive`,className:`ml-auto text-[10px] px-1.5 py-0`,children:t})]})}),(0,B.jsxs)(al,{align:`start`,side:`right`,className:`w-80 p-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-1.5 py-1`,children:[(0,B.jsx)(sl,{className:`p-0`,children:`Notifications`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(`button`,{type:`button`,title:`Mark read`,onClick:o,className:`rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground`,children:(0,B.jsx)(c,{className:`h-3.5 w-3.5`})}),(0,B.jsx)(`button`,{type:`button`,title:`Clear`,onClick:s,className:`rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground`,children:(0,B.jsx)(Ne,{className:`h-3.5 w-3.5`})})]})]}),(0,B.jsxs)(`div`,{className:`px-1.5 py-1.5 space-y-2`,children:[(0,B.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-xs`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`In-app notifications`}),(0,B.jsx)(tl,{size:`sm`,checked:n.enabled,onCheckedChange:e=>d({enabled:e})})]}),(0,B.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-xs`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Browser notifications`}),(0,B.jsx)(tl,{size:`sm`,checked:n.browserEnabled&&r===`granted`,disabled:r===`unsupported`,onCheckedChange:e=>{e&&r!==`granted`?l():d({browserEnabled:e})}})]}),(0,B.jsx)(`div`,{className:`grid grid-cols-3 gap-1`,children:dl.map(([e,t])=>(0,B.jsx)(`button`,{type:`button`,onClick:()=>d({[e]:!n[e]}),className:O(`rounded border px-2 py-1 text-[11px] transition-colors`,n[e]?`border-primary/40 bg-primary/10 text-primary`:`border-border text-muted-foreground hover:bg-accent`),children:t},e))})]}),(0,B.jsx)(cl,{}),(0,B.jsx)(`div`,{className:`max-h-80 overflow-y-auto`,children:e.length===0?(0,B.jsx)(`div`,{className:`px-1.5 py-8 text-center text-xs text-muted-foreground`,children:`No notifications`}):e.slice(0,20).map(e=>(0,B.jsxs)(ol,{onSelect:t=>{t.preventDefault(),a(e)},className:`flex flex-col items-start gap-0.5 px-2 py-2`,children:[(0,B.jsxs)(`div`,{className:`flex w-full items-center gap-2`,children:[(0,B.jsx)(`span`,{className:O(`h-1.5 w-1.5 rounded-full`,e.severity===`error`?`bg-red-400`:e.severity===`warning`?`bg-yellow-400`:`bg-blue-400`)}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium`,children:e.title}),(0,B.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:ul(e)})]}),(0,B.jsx)(`span`,{className:`line-clamp-2 text-xs text-muted-foreground`,children:e.body}),e.routing?.reason&&(0,B.jsxs)(`span`,{className:`line-clamp-1 text-[10px] text-muted-foreground/80`,children:[`routed because `,e.routing.reason]})]},e.id))})]})]})}function pl(){let e=A(e=>e.theme),t=A(e=>e.set);return(0,B.jsxs)(rl,{children:[(0,B.jsx)(il,{asChild:!0,children:(0,B.jsxs)(`button`,{className:`flex items-center gap-2 text-muted-foreground hover:text-foreground transition-colors w-full`,children:[(0,B.jsx)(g,{className:`w-3.5 h-3.5`}),(0,B.jsx)(`span`,{children:`Theme`}),(0,B.jsx)(`span`,{className:`ml-auto text-[10px] text-muted-foreground`,children:rn.find(t=>t.id===e)?.label})]})}),(0,B.jsx)(al,{align:`start`,side:`right`,className:`w-40`,children:rn.map(n=>(0,B.jsxs)(ol,{onSelect:()=>t({theme:n.id}),children:[(0,B.jsx)(`span`,{className:`flex-1`,children:n.label}),e===n.id&&(0,B.jsx)(ce,{className:`w-3.5 h-3.5 text-primary`})]},n.id))})]})}function ml(){let e=A(e=>e.view),t=A(e=>e.switchView),n=A(e=>e.connected),r=A(e=>e.showOffline),i=A(e=>e.showBuiltIns),a=A(e=>e.autoRefresh),o=A(e=>e.stats),s=A(e=>e.openCommandPalette),c=A(e=>e.set),l=A(e=>e.startAutoRefresh),u=A(e=>e.stopAutoRefresh),d=qc(),f=Jc();function p(e){return e===`overview`&&d.total>0?(0,B.jsx)(F,{variant:`destructive`,className:`ml-auto text-[10px] px-1.5 py-0`,children:d.total}):e===`chat`&&d.unreadInbox>0?(0,B.jsx)(F,{variant:`destructive`,className:`ml-auto text-[10px] px-1.5 py-0`,children:d.unreadInbox}):e===`agents`?(0,B.jsx)(F,{variant:`secondary`,className:`ml-auto text-[10px] px-1.5 py-0`,children:f}):e===`pairs`&&d.pendingPairInvites>0?(0,B.jsx)(F,{className:`ml-auto text-[10px] px-1.5 py-0 bg-yellow-500/20 text-yellow-400`,children:d.pendingPairInvites}):e===`work`&&d.claimableTasks>0?(0,B.jsx)(F,{className:`ml-auto text-[10px] px-1.5 py-0 bg-yellow-500/20 text-yellow-400`,children:d.claimableTasks}):null}return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`nav`,{className:`flex-1 overflow-y-auto py-2 px-2`,children:Wt.map(n=>{let r=ll[n.icon]||w;return(0,B.jsxs)(`button`,{onClick:()=>t(n.key),className:O(`w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors my-0.5`,e===n.key?`bg-primary text-primary-foreground`:`text-foreground hover:bg-accent`),children:[(0,B.jsx)(r,{className:`w-4 h-4 shrink-0`}),n.label,p(n.key)]},n.key)})}),(0,B.jsxs)(`div`,{className:`mt-auto border-t border-border p-4 space-y-3 text-xs`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:O(`w-2 h-2 rounded-full`,n?`bg-emerald-500`:`bg-red-500 animate-pulse`)}),(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:n?`Live`:`Reconnecting...`})]}),(0,B.jsxs)(`button`,{onClick:s,className:`flex items-center gap-2 text-muted-foreground hover:text-foreground transition-colors w-full`,children:[(0,B.jsx)(Ie,{className:`w-3.5 h-3.5`}),(0,B.jsx)(`span`,{children:`Command palette`}),(0,B.jsx)(`kbd`,{className:`ml-auto text-[10px] bg-muted px-1.5 py-0.5 rounded`,children:`⌘K`})]}),(0,B.jsx)(fl,{}),(0,B.jsx)(pl,{}),(0,B.jsx)(nl,{}),(0,B.jsxs)(`label`,{className:`flex items-center justify-between cursor-pointer`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Show offline`}),(0,B.jsx)(tl,{checked:r,onCheckedChange:e=>c({showOffline:e})})]}),(0,B.jsxs)(`label`,{className:`flex items-center justify-between cursor-pointer`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`System agents`}),(0,B.jsx)(tl,{checked:i,onCheckedChange:e=>c({showBuiltIns:e})})]}),(0,B.jsxs)(`label`,{className:`flex items-center justify-between cursor-pointer`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Auto refresh`}),(0,B.jsx)(tl,{checked:a,onCheckedChange:e=>{c({autoRefresh:e}),e?l():u()}})]}),o.version&&(0,B.jsxs)(`div`,{className:`text-muted-foreground pt-1`,children:[`v`,o.version]})]})]})}function hl(){return(0,B.jsxs)(`aside`,{className:`hidden xl:flex w-[250px] min-w-[250px] h-[calc(100dvh-var(--sat))] sticky top-[var(--sat)] flex-col border-r border-border bg-card`,children:[(0,B.jsxs)(`div`,{className:`px-5 py-4 font-bold text-base border-b border-border flex items-center gap-2`,children:[(0,B.jsx)(b,{className:`w-4 h-4 text-primary`}),`Agent Relay`]}),(0,B.jsx)(ml,{})]})}function gl(){let e=A(e=>e.mobileMenuOpen),t=A(e=>e.set);return(0,z.useEffect)(()=>{if(!e)return;function n(e){e.key===`Escape`&&t({mobileMenuOpen:!1})}return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e]),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{className:O(`xl:hidden fixed inset-0 z-40 bg-black/50 transition-opacity duration-200`,e?`opacity-100`:`opacity-0 pointer-events-none`),onClick:()=>t({mobileMenuOpen:!1})}),(0,B.jsxs)(`aside`,{inert:!e,className:O(`xl:hidden fixed inset-y-0 left-0 z-50 w-[280px] flex flex-col pt-[var(--sat)] bg-card border-r border-border transition-transform duration-200 ease-out`,e?`translate-x-0`:`-translate-x-full`),children:[(0,B.jsxs)(`div`,{className:`px-5 py-4 font-bold text-base border-b border-border flex items-center gap-2`,children:[(0,B.jsx)(b,{className:`w-4 h-4 text-primary`}),`Agent Relay`,(0,B.jsx)(`button`,{onClick:()=>t({mobileMenuOpen:!1}),className:`ml-auto p-1 text-muted-foreground hover:text-foreground transition-colors`,"aria-label":`Close menu`,children:(0,B.jsx)(Fe,{className:`w-4 h-4`})})]}),(0,B.jsx)(ml,{})]})]})}var _l=500*1024,vl={bash:`bash`,c:`c`,conf:`properties`,cpp:`cpp`,cs:`csharp`,css:`css`,csv:`csv`,cts:`typescript`,diff:`diff`,dockerfile:`dockerfile`,env:`dotenv`,gemspec:`ruby`,go:`go`,graphql:`graphql`,h:`c`,hcl:`hcl`,hpp:`cpp`,html:`html`,ini:`ini`,java:`java`,js:`javascript`,json:`json`,jsonc:`jsonc`,jsx:`jsx`,kt:`kotlin`,less:`less`,log:`log`,lua:`lua`,mjs:`javascript`,mts:`typescript`,patch:`diff`,php:`php`,plist:`xml`,podspec:`ruby`,properties:`properties`,py:`python`,rake:`ruby`,rb:`ruby`,rs:`rust`,scss:`scss`,sh:`bash`,sql:`sql`,svelte:`svelte`,swift:`swift`,toml:`toml`,ts:`typescript`,tsx:`tsx`,txt:`text`,vue:`vue`,webmanifest:`json`,xml:`xml`,yaml:`yaml`,yml:`yaml`,zsh:`bash`},yl={".bashrc":`bash`,".env":`dotenv`,".eslintrc":`json`,".gitignore":`gitignore`,".npmrc":`properties`,".prettierrc":`json`,".swiftformat":`properties`,".swiftlint.yml":`yaml`,".watchmanconfig":`json`,"app.config":`json`,"app.webmanifest":`json`,berksfile:`ruby`,brewfile:`ruby`,"bun.lock":`json`,capfile:`ruby`,cartfile:`ruby`,"composer.lock":`json`,dangerfile:`ruby`,"deno.lock":`json`,fastfile:`ruby`,"flake.lock":`json`,gemfile:`ruby`,guardfile:`ruby`,podfile:`ruby`,rakefile:`ruby`,dockerfile:`dockerfile`,makefile:`make`},bl=null;function xl(){return bl??=R(()=>import(`./bundle-web-BLavPdXe.js`),__vite__mapDeps([0,1,2,3]),import.meta.url),bl}function Sl(e){return new TextEncoder().encode(e).length}function Cl(e){return e.split(`/`).filter(Boolean).pop()||e}function wl(e){let t=e?.slice(0,240).split(/\r?\n/,1)[0]?.toLowerCase()||``;return t.startsWith(`#!`)?/\b(bash|dash|ksh|sh|zsh)\b/.test(t)?`bash`:/\bfish\b/.test(t)?`fish`:/\b(ts-node|tsx)\b/.test(t)?`typescript`:/\b(node|bun|deno)\b/.test(t)?`javascript`:/\bpython[0-9.]*\b/.test(t)?`python`:/\bruby\b/.test(t)?`ruby`:/\bswift\b/.test(t)?`swift`:/\bperl\b/.test(t)?`perl`:/\bphp\b/.test(t)?`php`:null:null}function Tl(e,t,n,r){if(n)return n;let i=Cl(e).toLowerCase();if(yl[i])return yl[i];if(i.endsWith(`.d.ts`))return`typescript`;let a=wl(r);if(a)return a;let o=i.includes(`.`)?i.slice(i.lastIndexOf(`.`)+1):``;return o&&vl[o]?vl[o]:t?.includes(`json`)?`json`:t?.includes(`javascript`)?`javascript`:t?.includes(`typescript`)?`typescript`:t?.includes(`xml`)?`xml`:t?.includes(`yaml`)||t?.includes(`yml`)?`yaml`:t?.includes(`shellscript`)?`bash`:null}function El(e,t,n,r){let i=Tl(e,t,n,r);return!!(i&&i!==`text`&&i!==`log`)}var Dl=(0,z.memo)(function({content:e,path:t,mediaType:n,languageHint:r,compact:i=!1}){let a=A(e=>e.theme),o=rn.find(e=>e.id===a)?.dark??!0,s=(0,z.useMemo)(()=>Tl(t,n,r,e)||`text`,[e,r,n,t]),c=Sl(e)>_l,[l,u]=(0,z.useState)(``),[d,f]=(0,z.useState)(!1),[p,m]=(0,z.useState)(!1);function h(){return(0,B.jsx)(Pn,{value:e,label:`Copy code`,copiedLabel:`Copied code`,size:`icon`,variant:`ghost`,className:`absolute right-2 top-2 h-7 w-7 bg-background/80 opacity-0 shadow-sm backdrop-blur transition-opacity hover:bg-muted group-hover/code:opacity-100 focus-visible:opacity-100`})}return(0,z.useEffect)(()=>{if(c||s===`text`||s===`log`){u(``),f(!1),m(!1);return}let t=!1;return f(!0),m(!1),xl().then(({codeToHtml:t})=>t(e,{lang:s,theme:o?`github-dark-default`:`github-light-default`})).then(e=>{t||u(e)}).catch(()=>{t||(u(``),m(!0))}).finally(()=>{t||f(!1)}),()=>{t=!0}},[e,o,s,c]),d?(0,B.jsxs)(`div`,{className:`flex items-center gap-2 p-4 text-sm text-muted-foreground`,children:[(0,B.jsx)(je,{className:`h-4 w-4 animate-spin`}),`Highlighting`]}):c||p||!l?(0,B.jsxs)(`div`,{className:`group/code relative`,children:[h(),(0,B.jsx)(`pre`,{className:`overflow-auto whitespace-pre-wrap break-words font-mono text-xs leading-5 ${i?`p-3`:`p-4`}`,children:e||` `})]}):(0,B.jsxs)(`div`,{className:`group/code relative`,children:[h(),(0,B.jsx)(`div`,{className:`code-preview overflow-auto font-mono text-xs leading-5 ${i?`p-3`:`p-4`}`,dangerouslySetInnerHTML:{__html:l}})]})}),Ol=(0,z.lazy)(()=>R(()=>import(`./markdown-preview-impl-Df6EWwbg.js`).then(e=>({default:e.MarkdownPreview})),__vite__mapDeps([4,5,1,3,6]),import.meta.url));function kl(e){return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:`Loading preview…`}),children:(0,B.jsx)(Ol,{...e})})}var Al=e(pt(),1);function jl({src:e,alt:t,onClose:n}){let[r,i]=(0,z.useState)(!1);return(0,z.useEffect)(()=>{let e=document.body.style.overflow;document.body.style.overflow=`hidden`;function t(e){e.key===`Escape`&&n()}return document.addEventListener(`keydown`,t),()=>{document.body.style.overflow=e,document.removeEventListener(`keydown`,t)}},[n]),(0,B.jsxs)(`div`,{className:`fixed inset-0 z-[100] flex flex-col bg-black/95`,children:[(0,B.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 p-2`,children:[(0,B.jsx)(`button`,{type:`button`,className:`rounded-full bg-white/10 p-2 text-white/70 hover:bg-white/20 hover:text-white`,onClick:()=>i(!r),title:r?`Fit to screen`:`Actual size`,children:r?(0,B.jsx)(We,{className:`h-4 w-4`}):(0,B.jsx)(Xe,{className:`h-4 w-4`})}),(0,B.jsx)(`button`,{type:`button`,className:`rounded-full bg-white/10 p-2 text-white/70 hover:bg-white/20 hover:text-white`,onClick:n,title:`Close`,children:(0,B.jsx)(Fe,{className:`h-4 w-4`})})]}),(0,B.jsx)(`div`,{className:`min-h-0 flex-1 ${r?`overflow-auto`:`flex items-center justify-center overflow-hidden p-4`}`,onClick:r?void 0:n,children:(0,B.jsx)(`img`,{src:e,alt:t,className:r?`max-w-none`:`max-h-full max-w-full cursor-zoom-in object-contain`,onClick:e=>{e.stopPropagation(),i(!r)}})})]})}function Ml({src:e,alt:t=``,className:n,style:r}){let[i,a]=(0,z.useState)(!1);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`img`,{src:e,alt:t,className:`${n||``} cursor-zoom-in`,style:r,onClick:()=>a(!0)}),i&&(0,Al.createPortal)((0,B.jsx)(jl,{src:e,alt:t,onClose:()=>a(!1)}),document.body)]})}var Nl=`agent-relay:file-git-status`;function Pl(){try{return window.localStorage.getItem(Nl)!==`off`}catch{return!0}}function Fl(e){try{window.localStorage.setItem(Nl,e?`on`:`off`)}catch{}}function Il(e){switch(e){case`staged`:return{dot:`bg-green-500`,text:`text-green-400`,label:`Staged`};case`unstaged`:return{dot:`bg-amber-500`,text:`text-amber-400`,label:`Modified (unstaged)`};case`staged-unstaged`:return{dot:`bg-amber-500`,text:`text-green-400`,label:`Staged + unstaged changes`};case`untracked`:return{dot:`bg-sky-500`,text:`text-sky-400`,label:`Untracked`};default:return null}}function Ll(e,t,n){let r=`/orchestrators/${encodeURIComponent(e)}/files/list?path=${encodeURIComponent(t)}`;return n?`${r}&git=1`:r}function Rl({status:e}){let t=Il(e);return t?(0,B.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 rounded-full ${t.dot}`,title:t.label}):null}function K(e){return e===void 0?``:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function zl(e,t){let n=t.replace(/\/+$/,``);return e===n?`/`:e.startsWith(n+`/`)?e.slice(n.length+1):e}function q(e,t){let n=e.toLowerCase();return n.endsWith(`.md`)||n.endsWith(`.mdx`)||n.endsWith(`.markdown`)||t===`text/markdown`}function J(e,t,n){return q(e,t)?`markdown`:El(e,t,void 0,n)?`code`:null}function Y(e){return`agent-relay:file-view-mode:${e}`}function Bl(e){try{let t=window.localStorage.getItem(Y(e));return t===`raw`||t===`rendered`?t:`rendered`}catch{return`rendered`}}function Vl(e,t){try{window.localStorage.setItem(Y(e),t)}catch{}}function Hl(e,t){let n=zl(e,t);if(n===`/`)return[{label:`/`,path:t}];let r=n.split(`/`).filter(Boolean),i=[{label:`/`,path:t}];for(let e=0;e<r.length;e++)i.push({label:r[e],path:`${t.replace(/\/+$/,``)}/${r.slice(0,e+1).join(`/`)}`});return i}function Ul(e,t){let n=A(e=>e.apiCall),[r,i]=(0,z.useState)(null),[a,o]=(0,z.useState)(!1),[s,c]=(0,z.useState)(``);return(0,z.useEffect)(()=>{if(!e||!t){i(null),c(``);return}let r=!1;return o(!0),c(``),n(`GET`,`/orchestrators/${encodeURIComponent(e)}/files/read?path=${encodeURIComponent(t)}`).then(e=>{r||i(e)}).catch(e=>{r||(i(null),c($t(e)))}).finally(()=>{r||o(!1)}),()=>{r=!0}},[n,e,t]),{file:r,loading:a,error:s}}function Wl(e,t,n=!1){let r=A(e=>e.apiCall),[i,a]=(0,z.useState)(null),[o,s]=(0,z.useState)(!1),[c,l]=(0,z.useState)(``);return(0,z.useEffect)(()=>{if(!e||!t){a(null),l(``);return}let i=!1;return s(!0),l(``),r(`GET`,Ll(e,t,n)).then(e=>{i||a(e)}).catch(e=>{i||(a(null),l($t(e)))}).finally(()=>{i||s(!1)}),()=>{i=!0}},[r,e,t,n]),{listing:i,loading:o,error:c}}function Gl({content:e,line:t,lineRef:n}){return(0,B.jsx)(`div`,{className:`w-full py-2 font-mono text-xs leading-5`,children:e.split(`
|
|
15
|
-
`).map((e,r)=>{let i=r+1,a=i===t;return(0,B.jsxs)(`div`,{ref:a?n:void 0,className:`grid grid-cols-[2.5rem_minmax(0,1fr)] px-1 sm:grid-cols-[4rem_minmax(0,1fr)] sm:px-2 ${a?`bg-primary/15`:``}`,children:[(0,B.jsx)(`div`,{className:`select-none pr-2 text-right text-muted-foreground sm:pr-3`,children:i}),(0,B.jsx)(`pre`,{className:`overflow-hidden whitespace-pre-wrap break-words`,children:e||` `})]},i)})})}function Kl({orchestratorId:e,selectedPath:t,onReadError:n,git:r=!1}){let{listing:i,loading:a,error:s}=Wl(e,t,r);return(0,z.useEffect)(()=>{n(s)},[s,n]),t?a?(0,B.jsxs)(`div`,{className:`flex h-full items-center justify-center gap-2 text-sm text-muted-foreground`,children:[(0,B.jsx)(je,{className:`h-4 w-4 animate-spin`}),`Loading directory`]}):s?(0,B.jsx)(`div`,{className:`h-full bg-muted/20`}):i?(0,B.jsxs)(`div`,{className:`h-full overflow-auto bg-muted/20`,children:[(0,B.jsxs)(`div`,{className:`sticky top-0 z-10 flex items-center gap-2 border-b border-border bg-background px-3 py-2 text-xs`,children:[(0,B.jsx)(ee,{className:`h-3.5 w-3.5 text-blue-400`}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:i.path}),(0,B.jsxs)(F,{variant:`outline`,className:`text-[10px]`,children:[i.entries.length,` items`]})]}),(0,B.jsxs)(`div`,{className:`divide-y divide-border/60`,children:[i.entries.map(e=>{let t=e.type===`directory`?ee:o,n=Il(e.gitStatus);return(0,B.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-sm`,children:[(0,B.jsx)(t,{className:`h-4 w-4 shrink-0 ${e.type===`directory`?`text-blue-400`:`text-muted-foreground`}`}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs ${n?.text??``}`,children:e.name}),e.symlink&&(0,B.jsx)(Pe,{className:`h-3 w-3 shrink-0 text-muted-foreground/60`}),(0,B.jsx)(Rl,{status:e.gitStatus}),e.type!==`directory`&&(0,B.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:K(e.size)})]},e.path)}),i.entries.length===0&&(0,B.jsx)(`div`,{className:`px-3 py-8 text-center text-sm text-muted-foreground`,children:`No files`})]})]}):null:(0,B.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Select a directory to preview`})}function ql({orchestratorId:e,selectedPath:t,line:n,onReadError:r}){let{file:i,loading:a,error:s}=Ul(e,t),c=(0,z.useRef)(null),[l,u]=(0,z.useState)(`raw`);(0,z.useEffect)(()=>{r(s)},[s,r]),(0,z.useEffect)(()=>{n>0&&c.current?.scrollIntoView({block:`center`})},[i,n]),(0,z.useEffect)(()=>{if(!i||i.encoding===`binary`)return;if(n>0){u(`raw`);return}let e=J(i.path,i.mediaType,i.content);u(e?Bl(e):`raw`)},[i?.path,i?.encoding,i?.mediaType,i?.content,n]);function d(e,t){u(e),t&&Vl(t,e)}if(!t)return(0,B.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Select a file to preview`});if(a)return(0,B.jsxs)(`div`,{className:`flex h-full items-center justify-center gap-2 text-sm text-muted-foreground`,children:[(0,B.jsx)(je,{className:`h-4 w-4 animate-spin`}),`Loading file`]});if(s)return(0,B.jsx)(`div`,{className:`h-full bg-muted/20`});if(!i)return null;if(i.encoding===`base64`)return(0,B.jsxs)(`div`,{className:`flex h-full flex-col bg-muted/20`,children:[(0,B.jsxs)(`div`,{className:`sticky top-0 z-10 flex items-center gap-2 border-b border-border bg-background px-3 py-2 text-xs`,children:[(0,B.jsx)(o,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:i.path}),(0,B.jsx)(Pn,{value:i.path,label:`Copy path`,copiedLabel:`Copied path`,size:`icon`,variant:`ghost`,className:`h-7 w-7 shrink-0`}),(0,B.jsx)(F,{variant:`outline`,className:`text-[10px]`,children:K(i.size)})]}),(0,B.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:(0,B.jsx)(Ml,{src:`data:${i.mediaType};base64,${i.content??``}`,alt:i.name,className:`max-h-full max-w-full object-contain`,style:{imageRendering:i.mediaType===`image/svg+xml`?`auto`:void 0}})})]});if(i.encoding===`binary`)return(0,B.jsxs)(`div`,{className:`p-4 text-sm`,children:[(0,B.jsx)(`div`,{className:`font-medium`,children:i.name}),(0,B.jsx)(`div`,{className:`mt-1 text-muted-foreground`,children:i.truncated?`File too large to preview.`:`Binary file preview is not available.`}),(0,B.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,B.jsx)(F,{variant:`secondary`,children:i.mediaType}),(0,B.jsx)(F,{variant:`outline`,children:K(i.size)})]})]});let f=i.content??``,p=q(i.path,i.mediaType),m=!p&&El(i.path,i.mediaType,void 0,f),h=p||m,g=p?`markdown`:m?`code`:null;return(0,B.jsxs)(`div`,{className:`h-full overflow-auto bg-muted/20`,children:[(0,B.jsxs)(`div`,{className:`sticky top-0 z-10 flex items-center gap-2 border-b border-border bg-background px-3 py-2 text-xs`,children:[(0,B.jsx)(o,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:i.path}),(0,B.jsx)(Pn,{value:i.path,label:`Copy path`,copiedLabel:`Copied path`,size:`icon`,variant:`ghost`,className:`h-7 w-7 shrink-0`}),i.truncated&&(0,B.jsx)(F,{variant:`secondary`,className:`text-[10px]`,children:`truncated`}),(0,B.jsx)(F,{variant:`outline`,className:`text-[10px]`,children:K(i.size)}),h&&(0,B.jsxs)(`div`,{className:`flex shrink-0 rounded-md border border-border bg-muted/40 p-0.5`,children:[(0,B.jsx)(`button`,{type:`button`,className:`rounded px-2 py-1 text-[10px] font-medium ${l===`raw`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`}`,onClick:()=>d(`raw`,g),children:`Raw`}),(0,B.jsx)(`button`,{type:`button`,className:`rounded px-2 py-1 text-[10px] font-medium ${l===`rendered`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`}`,onClick:()=>d(`rendered`,g),children:p?`Rendered`:`Highlighted`})]})]}),l===`rendered`&&p&&(0,B.jsx)(kl,{content:f,path:i.path}),l===`rendered`&&m&&(0,B.jsx)(Dl,{content:f,path:i.path,mediaType:i.mediaType}),l===`raw`&&(0,B.jsx)(Gl,{content:f,line:n,lineRef:c})]})}function Jl({overlay:e=!1}){let t=A(e=>e.apiCall),n=A(e=>e.orchestrators),r=A(e=>e.fileOrchestratorId),s=A(e=>e.filePath),c=A(e=>e.fileSelectedPath),l=A(e=>e.fileSelectedLine),u=A(e=>e.set),d=A(e=>e.closeFileOverlay),f=A(e=>e.openOrchestratorSpawnAt),[m,h]=(0,z.useState)(null),[g,_]=(0,z.useState)(s),[v,y]=(0,z.useState)(!1),[b,x]=(0,z.useState)(``),[S,C]=(0,z.useState)(``),[te,ne]=(0,z.useState)(Pl),re=(0,z.useMemo)(()=>n.filter(e=>e.status===`online`),[n]),w=n.find(e=>e.id===r)||re[0];(0,z.useEffect)(()=>{if(!w)return;let e={};r||(e.fileOrchestratorId=w.id),s||(e.filePath=w.baseDir),Object.keys(e).length&&u(e)},[r,s,w,u]),(0,z.useEffect)(()=>_(s),[s]);async function ae(e=s){if(!(!w||!e)){y(!0),x(``);try{let n=await t(`GET`,Ll(w.id,e,te));h(n),u({filePath:n.path}),_(n.path),C(``)}catch(e){x($t(e))}finally{y(!1)}}}(0,z.useEffect)(()=>{ae(s)},[w?.id,s,te]);function oe(e){ne(e),Fl(e)}function se(e){u({fileOrchestratorId:e,filePath:n.find(t=>t.id===e)?.baseDir||``,fileSelectedPath:``,fileSelectedLine:0})}function T(e){C(``),e.type===`directory`?u({filePath:e.path,fileSelectedPath:``,fileSelectedLine:0}):u({fileSelectedPath:e.path,fileSelectedLine:0})}function E(){if(!w)return;let t=g.trim()||s||w.baseDir;e&&d(),f({orchestratorId:w.id,cwd:t})}let ce=m?Hl(m.path,m.baseDir):[],le=b||S;return(0,B.jsxs)(`div`,{className:e?`flex h-full flex-col`:`flex h-[calc(100dvh-5rem)] flex-col gap-3 md:gap-4`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 ${c?`hidden md:flex`:``}`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-lg font-semibold`,children:[(0,B.jsx)(ie,{className:`h-5 w-5 text-primary`}),`Files`]}),(0,B.jsxs)(`select`,{value:w?.id||``,onChange:e=>se(e.target.value),className:`h-9 rounded-md border border-input bg-background px-3 text-sm`,children:[re.length===0&&(0,B.jsx)(`option`,{value:``,children:`No online orchestrators`}),re.map(e=>(0,B.jsx)(`option`,{value:e.id,children:e.hostname||e.id},e.id))]}),e&&(0,B.jsx)(I,{size:`icon`,variant:`ghost`,className:`ml-auto h-8 w-8`,onClick:d,title:`Close`,children:(0,B.jsx)(Fe,{className:`h-4 w-4`})})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 ${c?`hidden md:flex`:``}`,children:[(0,B.jsx)(L,{value:g,onChange:e=>_(e.target.value),onKeyDown:e=>{e.key===`Enter`&&u({filePath:g,fileSelectedPath:``,fileSelectedLine:0})},className:`min-w-0 flex-1 basis-full font-mono text-xs sm:basis-auto`,placeholder:w?.baseDir||`Path`}),(0,B.jsxs)(I,{size:`sm`,variant:`outline`,className:`gap-1`,onClick:()=>ae(g),disabled:v||!w,children:[v?(0,B.jsx)(je,{className:`h-3.5 w-3.5 animate-spin`}):(0,B.jsx)(p,{className:`h-3.5 w-3.5`}),`Open`]}),(0,B.jsxs)(I,{size:`sm`,className:`gap-1`,onClick:E,disabled:!w,children:[(0,B.jsx)(a,{className:`h-3.5 w-3.5`}),(0,B.jsx)(`span`,{className:`sm:hidden`,children:`Spawn`}),(0,B.jsx)(`span`,{className:`hidden sm:inline`,children:`Spawn from here`})]}),(0,B.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,title:`Show git status colors`,children:[(0,B.jsx)(i,{className:`h-3.5 w-3.5`}),(0,B.jsx)(`span`,{className:`hidden sm:inline`,children:`Git`}),(0,B.jsx)(tl,{checked:te,onCheckedChange:oe})]})]}),ce.length>0&&(0,B.jsx)(`div`,{className:`flex flex-wrap items-center gap-1 text-xs text-muted-foreground ${c?`hidden md:flex`:``}`,children:ce.map((e,t)=>(0,B.jsxs)(`button`,{type:`button`,className:`rounded px-1.5 py-0.5 font-mono hover:bg-accent hover:text-foreground`,onClick:()=>u({filePath:e.path,fileSelectedPath:``,fileSelectedLine:0}),children:[e.label,t<ce.length-1&&e.label!==`/`?` /`:``]},`${e.path}-${t}`))}),le&&(0,B.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:le}),(0,B.jsxs)(`div`,{className:`grid min-h-0 flex-1 overflow-hidden md:rounded-md md:border md:border-border md:grid-cols-[22rem_minmax(0,1fr)] ${c?``:`rounded-md border border-border`}`,children:[(0,B.jsxs)(`div`,{className:`min-h-0 overflow-auto border-b border-border bg-card md:border-b-0 md:border-r ${c?`hidden md:block`:``}`,children:[m?.parent&&(0,B.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 px-3 py-2 text-left text-sm hover:bg-accent`,onClick:()=>u({filePath:m.parent,fileSelectedPath:``,fileSelectedLine:0}),children:[(0,B.jsx)($e,{className:`h-4 w-4 text-muted-foreground`}),(0,B.jsx)(`span`,{children:`Parent directory`})]}),m?.entries.map(e=>{let t=c===e.path||s===e.path,n=e.type===`directory`?ee:o,r=Il(e.gitStatus);return(0,B.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 px-3 py-2 text-left text-sm hover:bg-accent ${t?`bg-accent`:``}`,onClick:()=>T(e),children:[(0,B.jsx)(n,{className:`h-4 w-4 shrink-0 ${e.type===`directory`?`text-blue-400`:`text-muted-foreground`}`}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs ${r?.text??``}`,children:e.name}),e.symlink&&(0,B.jsx)(Pe,{className:`h-3 w-3 shrink-0 text-muted-foreground/60`}),(0,B.jsx)(Rl,{status:e.gitStatus}),e.type!==`directory`&&(0,B.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:K(e.size)})]},e.path)}),!v&&m&&m.entries.length===0&&(0,B.jsx)(`div`,{className:`px-3 py-8 text-center text-sm text-muted-foreground`,children:`No files`})]}),(0,B.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden ${c?``:`hidden md:flex`}`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1.5 border-b border-border px-3 py-2 text-xs text-muted-foreground hover:text-foreground md:hidden`,onClick:()=>u({fileSelectedPath:``,fileSelectedLine:0}),children:[(0,B.jsx)($e,{className:`h-3.5 w-3.5`}),`Back to files`]}),(0,B.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,B.jsx)(ql,{orchestratorId:w?.id||``,selectedPath:c,line:l,onReadError:C})})]})]})]})}function Yl(){return(0,B.jsx)(Jl,{})}function Xl(){return A(e=>e.fileOverlayOpen)?(0,B.jsx)(`div`,{className:`fixed inset-0 z-50 bg-background/80 backdrop-blur-sm`,children:(0,B.jsx)(`div`,{className:`absolute inset-4 overflow-hidden rounded-md border border-border bg-background p-4 shadow-xl`,children:(0,B.jsx)(Jl,{overlay:!0})})}):null}function Zl(e,t){let n=z.useRef(!1),r=z.useRef(t);r.current=t,z.useEffect(()=>{if(!e||!r.current)return;window.history.pushState({sheetGuard:!0},``),n.current=!0;function t(){n.current&&(n.current=!1,r.current?.(!1))}return window.addEventListener(`popstate`,t),()=>{window.removeEventListener(`popstate`,t),n.current&&(n.current=!1,window.history.back())}},[e])}function Ql({...e}){return Zl(e.open,e.onOpenChange),(0,B.jsx)(Ar,{"data-slot":`sheet`,...e})}function $l({...e}){return(0,B.jsx)(jr,{"data-slot":`sheet-portal`,...e})}function eu({className:e,...t}){return(0,B.jsx)(Mr,{"data-slot":`sheet-overlay`,className:O(`fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function tu({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...i}){return(0,B.jsxs)($l,{children:[(0,B.jsx)(eu,{}),(0,B.jsxs)(Nr,{"data-slot":`sheet-content`,"data-side":n,className:O(`fixed z-50 flex flex-col bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out overflow-hidden max-w-[100dvw] data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-full data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-full data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10`,e),...i,children:[t,r&&(0,B.jsx)(Ir,{"data-slot":`sheet-close`,asChild:!0,children:(0,B.jsxs)(I,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`,children:[(0,B.jsx)(Fe,{}),(0,B.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})]})]})}function nu({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`sheet-header`,className:O(`flex flex-col gap-0.5 p-4`,e),...t})}function ru({className:e,...t}){return(0,B.jsx)(Pr,{"data-slot":`sheet-title`,className:O(`font-heading text-base font-medium text-foreground`,e),...t})}function iu({className:e,orientation:t=`horizontal`,...n}){return(0,B.jsx)(qs,{"data-slot":`tabs`,"data-orientation":t,className:O(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var au=ln(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function ou({className:e,variant:t=`default`,...n}){return(0,B.jsx)(Js,{"data-slot":`tabs-list`,"data-variant":t,className:O(au({variant:t}),e),...n})}function su({className:e,...t}){return(0,B.jsx)(Ys,{"data-slot":`tabs-trigger`,className:O(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function cu({className:e,...t}){return(0,B.jsx)(Xs,{"data-slot":`tabs-content`,className:O(`flex-1 text-sm outline-none`,e),...t})}function lu({agent:e,now:t,className:n}){return(0,B.jsx)(`span`,{className:O(`inline-block w-2.5 h-2.5 rounded-full shrink-0`,Ct(e,t),n)})}function uu({className:e}){return(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,className:e,children:(0,B.jsx)(`path`,{d:`m3.127 10.604 3.135-1.76.053-.153-.053-.085H6.11l-.525-.032-1.791-.048-1.554-.065-1.505-.08-.38-.081L0 7.832l.036-.234.32-.214.455.04 1.009.069 1.513.105 1.097.064 1.626.17h.259l.036-.105-.089-.065-.068-.064-1.566-1.062-1.695-1.121-.887-.646-.48-.327-.243-.306-.104-.67.435-.48.585.04.15.04.593.456 1.267.981 1.654 1.218.242.202.097-.068.012-.049-.109-.181-.9-1.626-.96-1.655-.428-.686-.113-.411a2 2 0 0 1-.068-.484l.496-.674L4.446 0l.662.089.279.242.411.94.666 1.48 1.033 2.014.302.597.162.553.06.17h.105v-.097l.085-1.134.157-1.392.154-1.792.052-.504.25-.605.497-.327.387.186.319.456-.045.294-.19 1.23-.37 1.93-.243 1.29h.142l.161-.16.654-.868 1.097-1.372.484-.545.565-.601.363-.287h.686l.505.751-.226.775-.707.895-.585.759-.839 1.13-.524.904.048.072.125-.012 1.897-.403 1.024-.186 1.223-.21.553.258.06.263-.218.536-1.307.323-1.533.307-2.284.54-.028.02.032.04 1.029.098.44.024h1.077l2.005.15.525.346.315.424-.053.323-.807.411-3.631-.863-.872-.218h-.12v.073l.726.71 1.331 1.202 1.667 1.55.084.383-.214.302-.226-.032-1.464-1.101-.565-.497-1.28-1.077h-.084v.113l.295.432 1.557 2.34.08.718-.112.234-.404.141-.444-.08-.911-1.28-.94-1.44-.759-1.291-.093.053-.448 4.821-.21.246-.484.186-.403-.307-.214-.496.214-.98.258-1.28.21-1.016.19-1.263.112-.42-.008-.028-.092.012-.953 1.307-1.448 1.957-1.146 1.227-.274.109-.477-.247.045-.44.266-.39 1.586-2.018.956-1.25.617-.723-.004-.105h-.036l-4.212 2.736-.75.096-.324-.302.04-.496.154-.162 1.267-.871z`})})}function du({className:e}){return(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,className:e,children:(0,B.jsx)(`path`,{d:`M22.282 9.821a5.985 5.985 0 0 0-.516-4.91 6.046 6.046 0 0 0-6.51-2.9A6.065 6.065 0 0 0 4.981 4.18a5.985 5.985 0 0 0-3.998 2.9 6.046 6.046 0 0 0 .743 7.097 5.98 5.98 0 0 0 .51 4.911 6.051 6.051 0 0 0 6.515 2.9A5.985 5.985 0 0 0 13.26 24a6.056 6.056 0 0 0 5.772-4.206 5.99 5.99 0 0 0 3.997-2.9 6.056 6.056 0 0 0-.747-7.073zM13.26 22.43a4.476 4.476 0 0 1-2.876-1.04l.141-.081 4.779-2.758a.795.795 0 0 0 .392-.681v-6.737l2.02 1.168a.071.071 0 0 1 .038.052v5.583a4.504 4.504 0 0 1-4.494 4.494zM3.6 18.304a4.47 4.47 0 0 1-.535-3.014l.142.085 4.783 2.759a.771.771 0 0 0 .78 0l5.843-3.369v2.332a.08.08 0 0 1-.033.062L9.74 19.95a4.5 4.5 0 0 1-6.14-1.646zM2.34 7.896a4.485 4.485 0 0 1 2.366-1.973V11.6a.766.766 0 0 0 .388.676l5.815 3.355-2.02 1.168a.076.076 0 0 1-.071 0l-4.83-2.786A4.504 4.504 0 0 1 2.34 7.872zm16.597 3.855-5.833-3.387L15.119 7.2a.076.076 0 0 1 .071 0l4.83 2.791a4.494 4.494 0 0 1-.676 8.105v-5.678a.79.79 0 0 0-.407-.667zm2.01-3.023-.141-.085-4.774-2.782a.776.776 0 0 0-.785 0L9.409 9.23V6.897a.066.066 0 0 1 .028-.061l4.83-2.787a4.5 4.5 0 0 1 6.68 4.66zm-12.64 4.135-2.02-1.164a.08.08 0 0 1-.038-.057V6.075a4.5 4.5 0 0 1 7.375-3.453l-.142.08L8.704 5.46a.795.795 0 0 0-.393.681zm1.097-2.365 2.602-1.5 2.607 1.5v2.999l-2.597 1.5-2.607-1.5z`})})}var fu={claude:uu,anthropic:uu,codex:du,openai:du},pu={claude:`text-orange-400`,anthropic:`text-orange-400`};function mu({provider:e,className:t}){let n=e.toLowerCase(),r=fu[n];return r?(0,B.jsx)(`span`,{role:`img`,"aria-label":e,title:e,className:`inline-flex shrink-0`,children:(0,B.jsx)(r,{className:O(pu[n],t)})}):(0,B.jsx)(`span`,{className:`capitalize`,children:e})}var hu={codex:`text-blue-400 bg-blue-500/10 border-blue-500/25`,claude:`text-orange-400 bg-orange-500/10 border-orange-500/25`,user:`text-emerald-400 bg-emerald-500/10 border-emerald-500/25`,system:`text-purple-400 bg-purple-500/10 border-purple-500/25`,channel:`text-blue-400 bg-blue-500/10 border-blue-500/25`,agent:`text-zinc-400 bg-zinc-500/10 border-zinc-500/25`},gu={codex:Me,claude:uu,user:tt,system:l,channel:Oe,agent:w};function _u({agent:e,className:t}){let n=Ut(e),r=gu[n]||w;return(0,B.jsx)(`span`,{className:O(`inline-flex items-center justify-center w-5 h-5 rounded-md border text-sm`,hu[n]||hu.agent,t),children:(0,B.jsx)(r,{className:`w-3.5 h-3.5`})})}function vu({agent:e,compact:t=!1}){let n=Ou(e);return n.length===0?null:(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:n.slice(0,t?4:void 0).map(e=>(0,B.jsx)(F,{variant:`outline`,className:`text-[9px] px-1 py-0 h-4`,children:e},e))})}function yu({agent:e,compact:t=!1,className:n=``}){let r=xu(e);return(0,B.jsx)(`div`,{className:`flex flex-wrap items-center gap-1 ${n}`,children:r.map(e=>{let n=e.Icon;return(0,B.jsxs)(`span`,{title:e.title,className:`inline-flex h-5 min-w-5 items-center justify-center gap-1 rounded-md border px-1.5 text-[10px] leading-none ${e.className}`,children:[(0,B.jsx)(n,{className:`h-3 w-3 shrink-0`}),!t&&(0,B.jsx)(`span`,{children:e.label})]},e.key)})})}function bu({agent:e}){let t=e.context;if(!t)return null;let n=ju(t);if(n===null)return(0,B.jsxs)(`div`,{className:`space-y-1`,title:Mu(t),children:[(0,B.jsxs)(`div`,{className:`flex justify-between text-[10px] text-muted-foreground`,children:[(0,B.jsx)(`span`,{children:`collecting`}),(0,B.jsx)(`span`,{children:`--`})]}),(0,B.jsx)(`div`,{className:`h-1.5 rounded-full bg-muted overflow-hidden`,children:(0,B.jsx)(`div`,{className:`h-full w-0 bg-muted-foreground/30`})})]});let r=Math.round(n*100),i=r>=80?`bg-red-500`:r>=60?`bg-yellow-500`:`bg-emerald-500`;return(0,B.jsxs)(`div`,{className:`space-y-1`,title:Mu(t),children:[(0,B.jsxs)(`div`,{className:`flex justify-between text-[10px] text-muted-foreground`,children:[(0,B.jsx)(`span`,{children:t.lifecycleState}),(0,B.jsxs)(`span`,{children:[r,`%`]})]}),(0,B.jsx)(`div`,{className:`h-1.5 rounded-full bg-muted overflow-hidden`,children:(0,B.jsx)(`div`,{className:`h-full ${i}`,style:{width:`${Math.max(0,Math.min(100,r))}%`}})})]})}function xu(e){let t=Su(e),n=Cu(e),r=wu(e);return[{key:`origin`,label:t?`Relay`:`External`,title:t?`Agent Relay spawned this agent`:`Externally started agent registered with Agent Relay`,Icon:t?re:Be,className:t?`border-sky-500/30 bg-sky-500/10 text-sky-300`:`border-zinc-500/30 bg-zinc-500/10 text-zinc-300`},n,r]}function Su(e){return typeof e.meta?.spawnRequestId==`string`||typeof e.meta?.policyName==`string`||typeof e.meta?.automationRunId==`string`}function Cu(e){let t=String(e.providerCapabilities?.session?.approvalMode||e.meta?.approvalMode||`guarded`).toLowerCase();return t===`open`?{key:`approval`,label:`Open`,title:`Approval mode: open`,Icon:De,className:`border-emerald-500/30 bg-emerald-500/10 text-emerald-300`}:t===`read-only`?{key:`approval`,label:`Read-only`,title:`Approval mode: read-only`,Icon:y,className:`border-blue-500/30 bg-blue-500/10 text-blue-300`}:{key:`approval`,label:`Guarded`,title:`Approval mode: guarded`,Icon:rt,className:`border-amber-500/30 bg-amber-500/10 text-amber-300`}}function wu(e){let t=Tu(e.meta?.workspace),n=tn(t.requestedMode)||tn(e.meta?.workspaceMode),r=tn(t.mode),a=n&&n!==`inherit`?n:r&&n!==`inherit`?r:`default`;return a===`isolated`?{key:`workspace`,label:`Isolated`,title:`Workspace: isolated worktree`,Icon:i,iconColor:`text-violet-300`,className:`border-violet-500/30 bg-violet-500/10 text-violet-300`}:a===`shared`?{key:`workspace`,label:`Shared`,title:`Workspace: shared repo checkout`,Icon:ot,iconColor:`text-cyan-300`,className:`border-cyan-500/30 bg-cyan-500/10 text-cyan-300`}:{key:`workspace`,label:`Default`,title:r?`Workspace: default/inherit, resolved to ${r}`:`Workspace: default/inherit`,Icon:ut,iconColor:`text-zinc-400`,className:`border-zinc-500/30 bg-zinc-500/10 text-zinc-300`}}function Tu(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Eu(e){let t=Tu(e.meta?.workspace),n=tn(t.repoRoot)||tn(t.sourceCwd)||tn(e.meta?.cwd);return n?kt(n,2):``}function Du(e){return!!(e.context||e.providerCapabilities?.context)}function Ou(e){let t=e.providerCapabilities,n=e.context,r=[];t?.lifecycle.managed?r.push(`managed`):t&&r.push(`bridge`),t?.session?.approvalMode===`read-only`?r.push(`read-only`):t?.session?.fileWrite&&r.push(`write`),t?.session?.shell&&r.push(`shell`),(t?.model?.alias||t?.model?.id)&&r.push(String(t.model.alias||t.model.id));let i=Jt(e).length;if(i&&r.push(i===1?`1 subagent`:`${i} subagents`),n){let e=ju(n);r.push(e===null?`ctx collecting`:`${Math.round(e*100)}% ctx`)}return r}function ku({context:e,expected:t=!!e,size:n=26,className:r}){let i=ju(e);if(i===null&&!t)return null;let a=n>=24?3:2.5,o=n/2,s=o-a,c=2*Math.PI*s,l=i===null?c:c*(1-i),u=i===null,d=u?`text-muted-foreground`:i>.8?`text-red-400`:i>.5?`text-yellow-400`:`text-emerald-400`,f=u?null:Math.round(i*100);return(0,B.jsxs)(`div`,{className:`relative shrink-0 ${u?`opacity-70`:``} ${r??``}`,style:{width:n,height:n},title:Mu(e),children:[(0,B.jsxs)(`svg`,{width:n,height:n,viewBox:`0 0 ${n} ${n}`,className:`rotate-[-90deg]`,children:[(0,B.jsx)(`circle`,{cx:o,cy:o,r:s,fill:`none`,strokeWidth:a,className:`stroke-muted-foreground/20`}),(0,B.jsx)(`circle`,{cx:o,cy:o,r:s,fill:`none`,strokeWidth:a,strokeDasharray:c,strokeDashoffset:l,strokeLinecap:`round`,className:`${d} stroke-current transition-all duration-500`})]}),(0,B.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center font-semibold leading-none ${u?`text-muted-foreground`:d}`,style:{fontSize:n>=24?8:7},children:u?`?`:f})]})}function Au(e){let t=e.context;return!t?.tokensUsed&&!t?.tokensMax?null:t.tokensUsed&&t.tokensMax?`${Nu(t.tokensUsed)} / ${Nu(t.tokensMax)}`:t.tokensUsed?Nu(t.tokensUsed):t.tokensMax?Nu(t.tokensMax):null}function ju(e){return!e||typeof e.utilization!=`number`||!Number.isFinite(e.utilization)?null:Math.min(1,Math.max(0,e.utilization))}function Mu(e){if(!e)return`Context: collecting; provider has not reported usage yet`;let t=ju(e),n=`${e.source}/${e.confidence}`,r=Number.isFinite(e.lastUpdatedAt)?new Date(e.lastUpdatedAt).toLocaleString():`unknown`;return t===null?`Context: unknown; ${n}; updated ${r}`:`Context: ${Math.round(t*100)}%; ${n}; updated ${r}`}function Nu(e){return e>=1e6?`${(e/1e6).toFixed(e%1e6==0?0:1)}M`:e>=1e3?`${Math.round(e/1e3)}K`:String(e)}var Pu=(0,z.lazy)(()=>R(()=>import(`./terminal-viewer-impl-DanOi7lh.js`).then(e=>({default:e.TerminalDialog})),__vite__mapDeps([7,1,6,8,9,10,11,12,13,14]),import.meta.url));function Fu(e){return e.open?(0,B.jsx)(z.Suspense,{fallback:null,children:(0,B.jsx)(Pu,{...e})}):null}function Iu({orchestratorId:e,session:t,lines:n=200}){let i=A(e=>e.apiCall),[a,o]=(0,z.useState)([]),[s,c]=(0,z.useState)(``),[l,u]=(0,z.useState)(!1),[d,p]=(0,z.useState)(`provider`),[m,h]=(0,z.useState)(null);async function g(){if(!l)try{o((await i(`GET`,`/orchestrators/${encodeURIComponent(e)}/logs/${encodeURIComponent(t)}?lines=${n}${d===`mirror`?`&stream=mirror`:``}`)).lines||[]),h(null)}catch(e){h($t(e))}}(0,z.useEffect)(()=>{g();let e=setInterval(()=>void g(),1500);return()=>clearInterval(e)},[e,t,l,d]);let _=s?a.filter(e=>e.toLowerCase().includes(s.toLowerCase())):a;return(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsxs)(`div`,{className:`relative min-w-48 flex-1`,children:[(0,B.jsx)(ze,{className:`absolute left-2 top-2.5 h-4 w-4 text-muted-foreground`}),(0,B.jsx)(L,{className:`pl-8`,value:s,onChange:e=>c(e.target.value),placeholder:`Search logs`})]}),(0,B.jsxs)(`div`,{className:`flex rounded-md border border-border overflow-hidden`,children:[(0,B.jsxs)(`button`,{type:`button`,onClick:()=>p(`provider`),title:`Provider output`,className:O(`flex items-center gap-1 px-2 py-1.5 text-xs`,d===`provider`?`bg-accent text-accent-foreground`:`text-muted-foreground hover:bg-accent/50`),children:[(0,B.jsx)(Me,{className:`h-3.5 w-3.5`}),` Output`]}),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>p(`mirror`),title:`Session-mirror diagnostics (clean)`,className:O(`flex items-center gap-1 px-2 py-1.5 text-xs border-l border-border`,d===`mirror`?`bg-accent text-accent-foreground`:`text-muted-foreground hover:bg-accent/50`),children:[(0,B.jsx)(r,{className:`h-3.5 w-3.5`}),` Mirror`]})]}),(0,B.jsx)(I,{type:`button`,variant:`outline`,size:`icon`,onClick:()=>u(e=>!e),title:l?`Resume logs`:`Pause logs`,children:l?(0,B.jsx)(f,{className:`h-4 w-4`}):(0,B.jsx)(v,{className:`h-4 w-4`})}),(0,B.jsx)(I,{type:`button`,variant:`outline`,size:`icon`,onClick:()=>Gt(`${t}.log`,a.join(`
|
|
14
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return z.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Or=`DialogDescriptionWarning`,kr=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Er(Or).contentName}}.`;return z.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Ar=tr,jr=sr,Mr=lr,Nr=pr,Pr=vr,Fr=br,Ir=Sr,Lr=`rovingFocusGroup.onEntryFocus`,Rr={bubbles:!1,cancelable:!0},zr=`RovingFocusGroup`,[Br,Vr,Hr]=mn(zr),[Ur,Wr]=dn(zr,[Hr]),[Gr,Kr]=Ur(zr),qr=z.forwardRef((e,t)=>(0,B.jsx)(Br.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,B.jsx)(Br.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,B.jsx)(Jr,{...e,ref:t})})}));qr.displayName=zr;var Jr=z.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=z.useRef(null),p=sn(t,f),m=wn(a),[h,g]=hn({prop:o,defaultProp:s??null,onChange:c,caller:zr}),[_,v]=z.useState(!1),y=Tn(l),b=Vr(n),x=z.useRef(!1),[S,C]=z.useState(0);return z.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(Lr,y),()=>e.removeEventListener(Lr,y)},[y]),(0,B.jsx)(Gr,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:z.useCallback(e=>g(e),[g]),onItemShiftTab:z.useCallback(()=>v(!0),[]),onFocusableItemAdd:z.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:z.useCallback(()=>C(e=>e-1),[]),children:(0,B.jsx)(N.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:P(e.onMouseDown,()=>{x.current=!0}),onFocus:P(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(Lr,Rr);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);ei([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:P(e.onBlur,()=>v(!1))})})}),Yr=`RovingFocusGroupItem`,Xr=z.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=Sn(),l=a||c,u=Kr(Yr,n),d=u.currentTabStopId===l,f=Vr(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return z.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,B.jsx)(Br.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,B.jsx)(N.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:P(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:P(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:P(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=$r(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?ti(n,r+1):n.slice(r+1)}setTimeout(()=>ei(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});Xr.displayName=Yr;var Zr={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Qr(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function $r(e,t,n){let r=Qr(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Zr[r]}function ei(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function ti(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var ni=qr,ri=Xr,ii=[`Enter`,` `],ai=[`ArrowDown`,`PageUp`,`Home`],oi=[`ArrowUp`,`PageDown`,`End`],si=[...ai,...oi],ci={ltr:[...ii,`ArrowRight`],rtl:[...ii,`ArrowLeft`]},li={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},ui=`Menu`,[di,fi,pi]=mn(ui),[mi,hi]=dn(ui,[pi,On,Wr]),gi=On(),_i=Wr(),[vi,yi]=mi(ui),[bi,xi]=mi(ui),Si=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=gi(t),[c,l]=z.useState(null),u=z.useRef(!1),d=Tn(a),f=wn(i);return z.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,B.jsx)(kn,{...s,children:(0,B.jsx)(vi,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,B.jsx)(bi,{scope:t,onClose:z.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};Si.displayName=ui;var Ci=`MenuAnchor`,wi=z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=gi(n);return(0,B.jsx)(Mn,{...i,...r,ref:t})});wi.displayName=Ci;var Ti=`MenuPortal`,[Ei,Di]=mi(Ti,{forceMount:void 0}),Oi=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=yi(Ti,t);return(0,B.jsx)(Ei,{scope:t,forceMount:n,children:(0,B.jsx)(gn,{present:n||a.open,children:(0,B.jsx)(vn,{asChild:!0,container:i,children:r})})})};Oi.displayName=Ti;var ki=`MenuContent`,[Ai,ji]=mi(ki),Mi=z.forwardRef((e,t)=>{let n=Di(ki,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=yi(ki,e.__scopeMenu),o=xi(ki,e.__scopeMenu);return(0,B.jsx)(di.Provider,{scope:e.__scopeMenu,children:(0,B.jsx)(gn,{present:r||a.open,children:(0,B.jsx)(di.Slot,{scope:e.__scopeMenu,children:o.modal?(0,B.jsx)(V,{...i,ref:t}):(0,B.jsx)(Ni,{...i,ref:t})})})})}),V=z.forwardRef((e,t)=>{let n=yi(ki,e.__scopeMenu),r=z.useRef(null),i=sn(t,r);return z.useEffect(()=>{let e=r.current;if(e)return Cn(e)},[]),(0,B.jsx)(Fi,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:P(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Ni=z.forwardRef((e,t)=>{let n=yi(ki,e.__scopeMenu);return(0,B.jsx)(Fi,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Pi=cn(`MenuContent.ScrollLock`),Fi=z.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=yi(ki,n),_=xi(ki,n),v=gi(n),y=_i(n),b=fi(n),[x,S]=z.useState(null),C=z.useRef(null),ee=sn(t,C,g.onContentChange),te=z.useRef(0),ne=z.useRef(``),re=z.useRef(0),w=z.useRef(null),ie=z.useRef(`right`),ae=z.useRef(0),oe=m?yn:z.Fragment,se=m?{as:Pi,allowPinchZoom:!0}:void 0,T=e=>{let t=ne.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=ya(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){ne.current=t,window.clearTimeout(te.current),t!==``&&(te.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};z.useEffect(()=>()=>window.clearTimeout(te.current),[]),xn();let E=z.useCallback(e=>ie.current===w.current?.side&&xa(e,w.current?.area),[]);return(0,B.jsx)(Ai,{scope:n,searchRef:ne,onItemEnter:z.useCallback(e=>{E(e)&&e.preventDefault()},[E]),onItemLeave:z.useCallback(e=>{E(e)||(C.current?.focus(),S(null))},[E]),onTriggerLeave:z.useCallback(e=>{E(e)&&e.preventDefault()},[E]),pointerGraceTimerRef:re,onPointerGraceIntentChange:z.useCallback(e=>{w.current=e},[]),children:(0,B.jsx)(oe,{...se,children:(0,B.jsx)(_n,{asChild:!0,trapped:i,onMountAutoFocus:P(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,B.jsx)(bn,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,B.jsx)(ni,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:P(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,B.jsx)(jn,{role:`menu`,"aria-orientation":`vertical`,"data-state":ma(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:ee,style:{outline:`none`,...h.style},onKeyDown:P(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&T(e.key));let i=C.current;if(e.target!==i||!si.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);oi.includes(e.key)&&a.reverse(),_a(a)}),onBlur:P(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(te.current),ne.current=``)}),onPointerMove:P(e.onPointerMove,Sa(e=>{let t=e.target,n=ae.current!==e.clientX;e.currentTarget.contains(t)&&n&&(ie.current=e.clientX>ae.current?`right`:`left`,ae.current=e.clientX)}))})})})})})})});Mi.displayName=ki;var Ii=`MenuGroup`,Li=z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,B.jsx)(N.div,{role:`group`,...r,ref:t})});Li.displayName=Ii;var Ri=`MenuLabel`,zi=z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,B.jsx)(N.div,{...r,ref:t})});zi.displayName=Ri;var Bi=`MenuItem`,Vi=`menu.itemSelect`,Hi=z.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=z.useRef(null),o=xi(Bi,e.__scopeMenu),s=ji(Bi,e.__scopeMenu),c=sn(t,a),l=z.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Vi,{bubbles:!0,cancelable:!0});e.addEventListener(Vi,e=>r?.(e),{once:!0}),un(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,B.jsx)(Ui,{...i,ref:c,disabled:n,onClick:P(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:P(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:P(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||ii.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});Hi.displayName=Bi;var Ui=z.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=ji(Bi,n),s=_i(n),c=z.useRef(null),l=sn(t,c),[u,d]=z.useState(!1),[f,p]=z.useState(``);return z.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,B.jsx)(di.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,B.jsx)(ri,{asChild:!0,...s,focusable:!r,children:(0,B.jsx)(N.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:P(e.onPointerMove,Sa(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:P(e.onPointerLeave,Sa(e=>o.onItemLeave(e))),onFocus:P(e.onFocus,()=>d(!0)),onBlur:P(e.onBlur,()=>d(!1))})})})}),Wi=`MenuCheckboxItem`,Gi=z.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,B.jsx)($i,{scope:e.__scopeMenu,checked:n,children:(0,B.jsx)(Hi,{role:`menuitemcheckbox`,"aria-checked":ha(n)?`mixed`:n,...i,ref:t,"data-state":ga(n),onSelect:P(i.onSelect,()=>r?.(ha(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Gi.displayName=Wi;var Ki=`MenuRadioGroup`,[qi,Ji]=mi(Ki,{value:void 0,onValueChange:()=>{}}),Yi=z.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=Tn(r);return(0,B.jsx)(qi,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,B.jsx)(Li,{...i,ref:t})})});Yi.displayName=Ki;var Xi=`MenuRadioItem`,Zi=z.forwardRef((e,t)=>{let{value:n,...r}=e,i=Ji(Xi,e.__scopeMenu),a=n===i.value;return(0,B.jsx)($i,{scope:e.__scopeMenu,checked:a,children:(0,B.jsx)(Hi,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":ga(a),onSelect:P(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Zi.displayName=Xi;var Qi=`MenuItemIndicator`,[$i,ea]=mi(Qi,{checked:!1}),ta=z.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=ea(Qi,n);return(0,B.jsx)(gn,{present:r||ha(a.checked)||a.checked===!0,children:(0,B.jsx)(N.span,{...i,ref:t,"data-state":ga(a.checked)})})});ta.displayName=Qi;var na=`MenuSeparator`,ra=z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,B.jsx)(N.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});ra.displayName=na;var ia=`MenuArrow`,aa=z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=gi(n);return(0,B.jsx)(An,{...i,...r,ref:t})});aa.displayName=ia;var oa=`MenuSub`,[sa,ca]=mi(oa),la=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=yi(oa,t),o=gi(t),[s,c]=z.useState(null),[l,u]=z.useState(null),d=Tn(i);return z.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,B.jsx)(kn,{...o,children:(0,B.jsx)(vi,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,B.jsx)(sa,{scope:t,contentId:Sn(),triggerId:Sn(),trigger:s,onTriggerChange:c,children:n})})})};la.displayName=oa;var ua=`MenuSubTrigger`,da=z.forwardRef((e,t)=>{let n=yi(ua,e.__scopeMenu),r=xi(ua,e.__scopeMenu),i=ca(ua,e.__scopeMenu),a=ji(ua,e.__scopeMenu),o=z.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=z.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return z.useEffect(()=>u,[u]),z.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,B.jsx)(wi,{asChild:!0,...l,children:(0,B.jsx)(Ui,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":ma(n.open),...e,ref:an(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:P(e.onPointerMove,Sa(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:P(e.onPointerLeave,Sa(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:P(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||ci[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});da.displayName=ua;var fa=`MenuSubContent`,pa=z.forwardRef((e,t)=>{let n=Di(ki,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=yi(ki,e.__scopeMenu),o=xi(ki,e.__scopeMenu),s=ca(fa,e.__scopeMenu),c=z.useRef(null),l=sn(t,c);return(0,B.jsx)(di.Provider,{scope:e.__scopeMenu,children:(0,B.jsx)(gn,{present:r||a.open,children:(0,B.jsx)(di.Slot,{scope:e.__scopeMenu,children:(0,B.jsx)(Fi,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:P(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:P(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:P(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=li[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});pa.displayName=fa;function ma(e){return e?`open`:`closed`}function ha(e){return e===`indeterminate`}function ga(e){return ha(e)?`indeterminate`:e?`checked`:`unchecked`}function _a(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function va(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function ya(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=va(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function ba(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function xa(e,t){return t?ba({x:e.clientX,y:e.clientY},t):!1}function Sa(e){return t=>t.pointerType===`mouse`?e(t):void 0}var Ca=Si,wa=wi,Ta=Oi,Ea=Mi,Da=Li,Oa=zi,ka=Hi,Aa=Gi,ja=Yi,Ma=Zi,Na=ta,Pa=ra,Fa=aa,Ia=da,La=pa,Ra=`DropdownMenu`,[za,Ba]=dn(Ra,[hi]),Va=hi(),[Ha,Ua]=za(Ra),Wa=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=Va(t),l=z.useRef(null),[u,d]=hn({prop:i,defaultProp:a??!1,onChange:o,caller:Ra});return(0,B.jsx)(Ha,{scope:t,triggerId:Sn(),triggerRef:l,contentId:Sn(),open:u,onOpenChange:d,onOpenToggle:z.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,B.jsx)(Ca,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};Wa.displayName=Ra;var Ga=`DropdownMenuTrigger`,Ka=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=Ua(Ga,n),o=Va(n);return(0,B.jsx)(wa,{asChild:!0,...o,children:(0,B.jsx)(N.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:an(t,a.triggerRef),onPointerDown:P(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:P(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Ka.displayName=Ga;var qa=`DropdownMenuPortal`,Ja=e=>{let{__scopeDropdownMenu:t,...n}=e,r=Va(t);return(0,B.jsx)(Ta,{...r,...n})};Ja.displayName=qa;var Ya=`DropdownMenuContent`,Xa=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ua(Ya,n),a=Va(n),o=z.useRef(!1);return(0,B.jsx)(Ea,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:P(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:P(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Xa.displayName=Ya;var Za=`DropdownMenuGroup`,Qa=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Va(n);return(0,B.jsx)(Da,{...i,...r,ref:t})});Qa.displayName=Za;var $a=`DropdownMenuLabel`,eo=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Va(n);return(0,B.jsx)(Oa,{...i,...r,ref:t})});eo.displayName=$a;var to=`DropdownMenuItem`,no=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Va(n);return(0,B.jsx)(ka,{...i,...r,ref:t})});no.displayName=to;var ro=`DropdownMenuCheckboxItem`,io=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Va(n);return(0,B.jsx)(Aa,{...i,...r,ref:t})});io.displayName=ro;var ao=`DropdownMenuRadioGroup`,oo=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Va(n);return(0,B.jsx)(ja,{...i,...r,ref:t})});oo.displayName=ao;var so=`DropdownMenuRadioItem`,co=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Va(n);return(0,B.jsx)(Ma,{...i,...r,ref:t})});co.displayName=so;var lo=`DropdownMenuItemIndicator`,uo=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Va(n);return(0,B.jsx)(Na,{...i,...r,ref:t})});uo.displayName=lo;var H=`DropdownMenuSeparator`,U=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Va(n);return(0,B.jsx)(Pa,{...i,...r,ref:t})});U.displayName=H;var fo=`DropdownMenuArrow`,po=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Va(n);return(0,B.jsx)(Fa,{...i,...r,ref:t})});po.displayName=fo;var mo=`DropdownMenuSubTrigger`,ho=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Va(n);return(0,B.jsx)(Ia,{...i,...r,ref:t})});ho.displayName=mo;var go=`DropdownMenuSubContent`,_o=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Va(n);return(0,B.jsx)(La,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});_o.displayName=go;var vo=Wa,yo=Ka,bo=Ja,xo=Xa,So=eo,Co=no,wo=U,To=`Label`,Eo=z.forwardRef((e,t)=>(0,B.jsx)(N.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));Eo.displayName=To;var Do=Eo;function Oo(e,t){return z.useReducer((e,n)=>t[e][n]??e,e)}var ko=`ScrollArea`,[Ao,jo]=dn(ko),[Mo,No]=Ao(ko),Po=z.forwardRef((e,t)=>{let{__scopeScrollArea:n,type:r=`hover`,dir:i,scrollHideDelay:a=600,...o}=e,[s,c]=z.useState(null),[l,u]=z.useState(null),[d,f]=z.useState(null),[p,m]=z.useState(null),[h,g]=z.useState(null),[_,v]=z.useState(0),[y,b]=z.useState(0),[x,S]=z.useState(!1),[C,ee]=z.useState(!1),te=sn(t,e=>c(e)),ne=wn(i);return(0,B.jsx)(Mo,{scope:n,type:r,dir:ne,scrollHideDelay:a,scrollArea:s,viewport:l,onViewportChange:u,content:d,onContentChange:f,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:x,onScrollbarXEnabledChange:S,scrollbarY:h,onScrollbarYChange:g,scrollbarYEnabled:C,onScrollbarYEnabledChange:ee,onCornerWidthChange:v,onCornerHeightChange:b,children:(0,B.jsx)(N.div,{dir:ne,...o,ref:te,style:{position:`relative`,"--radix-scroll-area-corner-width":_+`px`,"--radix-scroll-area-corner-height":y+`px`,...e.style}})})});Po.displayName=ko;var Fo=`ScrollAreaViewport`,Io=z.forwardRef((e,t)=>{let{__scopeScrollArea:n,children:r,nonce:i,...a}=e,o=No(Fo,n),s=sn(t,z.useRef(null),o.onViewportChange);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}`},nonce:i}),(0,B.jsx)(N.div,{"data-radix-scroll-area-viewport":``,...a,ref:s,style:{overflowX:o.scrollbarXEnabled?`scroll`:`hidden`,overflowY:o.scrollbarYEnabled?`scroll`:`hidden`,...e.style},children:(0,B.jsx)(`div`,{ref:o.onContentChange,style:{minWidth:`100%`,display:`table`},children:r})})]})});Io.displayName=Fo;var Lo=`ScrollAreaScrollbar`,Ro=z.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=No(Lo,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:o}=i,s=e.orientation===`horizontal`;return z.useEffect(()=>(s?a(!0):o(!0),()=>{s?a(!1):o(!1)}),[s,a,o]),i.type===`hover`?(0,B.jsx)(zo,{...r,ref:t,forceMount:n}):i.type===`scroll`?(0,B.jsx)(Bo,{...r,ref:t,forceMount:n}):i.type===`auto`?(0,B.jsx)(Vo,{...r,ref:t,forceMount:n}):i.type===`always`?(0,B.jsx)(Ho,{...r,ref:t}):null});Ro.displayName=Lo;var zo=z.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=No(Lo,e.__scopeScrollArea),[a,o]=z.useState(!1);return z.useEffect(()=>{let e=i.scrollArea,t=0;if(e){let n=()=>{window.clearTimeout(t),o(!0)},r=()=>{t=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return e.addEventListener(`pointerenter`,n),e.addEventListener(`pointerleave`,r),()=>{window.clearTimeout(t),e.removeEventListener(`pointerenter`,n),e.removeEventListener(`pointerleave`,r)}}},[i.scrollArea,i.scrollHideDelay]),(0,B.jsx)(gn,{present:n||a,children:(0,B.jsx)(Vo,{"data-state":a?`visible`:`hidden`,...r,ref:t})})}),Bo=z.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=No(Lo,e.__scopeScrollArea),a=e.orientation===`horizontal`,o=cs(()=>c(`SCROLL_END`),100),[s,c]=Oo(`hidden`,{hidden:{SCROLL:`scrolling`},scrolling:{SCROLL_END:`idle`,POINTER_ENTER:`interacting`},interacting:{SCROLL:`interacting`,POINTER_LEAVE:`idle`},idle:{HIDE:`hidden`,SCROLL:`scrolling`,POINTER_ENTER:`interacting`}});return z.useEffect(()=>{if(s===`idle`){let e=window.setTimeout(()=>c(`HIDE`),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[s,i.scrollHideDelay,c]),z.useEffect(()=>{let e=i.viewport,t=a?`scrollLeft`:`scrollTop`;if(e){let n=e[t],r=()=>{let r=e[t];n!==r&&(c(`SCROLL`),o()),n=r};return e.addEventListener(`scroll`,r),()=>e.removeEventListener(`scroll`,r)}},[i.viewport,a,c,o]),(0,B.jsx)(gn,{present:n||s!==`hidden`,children:(0,B.jsx)(Ho,{"data-state":s===`hidden`?`hidden`:`visible`,...r,ref:t,onPointerEnter:P(e.onPointerEnter,()=>c(`POINTER_ENTER`)),onPointerLeave:P(e.onPointerLeave,()=>c(`POINTER_LEAVE`))})})}),Vo=z.forwardRef((e,t)=>{let n=No(Lo,e.__scopeScrollArea),{forceMount:r,...i}=e,[a,o]=z.useState(!1),s=e.orientation===`horizontal`,c=cs(()=>{if(n.viewport){let e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;o(s?e:t)}},10);return ls(n.viewport,c),ls(n.content,c),(0,B.jsx)(gn,{present:r||a,children:(0,B.jsx)(Ho,{"data-state":a?`visible`:`hidden`,...i,ref:t})})}),Ho=z.forwardRef((e,t)=>{let{orientation:n=`vertical`,...r}=e,i=No(Lo,e.__scopeScrollArea),a=z.useRef(null),o=z.useRef(0),[s,c]=z.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=ts(s.viewport,s.content),u={...r,sizes:s,onSizesChange:c,hasThumb:l>0&&l<1,onThumbChange:e=>a.current=e,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:e=>o.current=e};function d(e,t){return rs(e,o.current,s,t)}return n===`horizontal`?(0,B.jsx)(Uo,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollLeft,t=is(e,s,i.dir);a.current.style.transform=`translate3d(${t}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=d(e,i.dir))}}):n===`vertical`?(0,B.jsx)(Wo,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollTop,t=is(e,s);a.current.style.transform=`translate3d(0, ${t}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=d(e))}}):null}),Uo=z.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=No(Lo,e.__scopeScrollArea),[o,s]=z.useState(),c=z.useRef(null),l=sn(t,c,a.onScrollbarXChange);return z.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,B.jsx)(qo,{"data-orientation":`horizontal`,...i,ref:l,sizes:n,style:{bottom:0,left:a.dir===`rtl`?`var(--radix-scroll-area-corner-width)`:0,right:a.dir===`ltr`?`var(--radix-scroll-area-corner-width)`:0,"--radix-scroll-area-thumb-width":ns(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollLeft+t.deltaX;e.onWheelScroll(r),os(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:es(o.paddingLeft),paddingEnd:es(o.paddingRight)}})}})}),Wo=z.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=No(Lo,e.__scopeScrollArea),[o,s]=z.useState(),c=z.useRef(null),l=sn(t,c,a.onScrollbarYChange);return z.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,B.jsx)(qo,{"data-orientation":`vertical`,...i,ref:l,sizes:n,style:{top:0,right:a.dir===`ltr`?0:void 0,left:a.dir===`rtl`?0:void 0,bottom:`var(--radix-scroll-area-corner-height)`,"--radix-scroll-area-thumb-height":ns(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollTop+t.deltaY;e.onWheelScroll(r),os(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:es(o.paddingTop),paddingEnd:es(o.paddingBottom)}})}})}),[Go,Ko]=Ao(Lo),qo=z.forwardRef((e,t)=>{let{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:a,onThumbPointerUp:o,onThumbPointerDown:s,onThumbPositionChange:c,onDragScroll:l,onWheelScroll:u,onResize:d,...f}=e,p=No(Lo,n),[m,h]=z.useState(null),g=sn(t,e=>h(e)),_=z.useRef(null),v=z.useRef(``),y=p.viewport,b=r.content-r.viewport,x=Tn(u),S=Tn(c),C=cs(d,10);function ee(e){_.current&&l({x:e.clientX-_.current.left,y:e.clientY-_.current.top})}return z.useEffect(()=>{let e=e=>{let t=e.target;m?.contains(t)&&x(e,b)};return document.addEventListener(`wheel`,e,{passive:!1}),()=>document.removeEventListener(`wheel`,e,{passive:!1})},[y,m,b,x]),z.useEffect(S,[r,S]),ls(m,C),ls(p.content,C),(0,B.jsx)(Go,{scope:n,scrollbar:m,hasThumb:i,onThumbChange:Tn(a),onThumbPointerUp:Tn(o),onThumbPositionChange:S,onThumbPointerDown:Tn(s),children:(0,B.jsx)(N.div,{...f,ref:g,style:{position:`absolute`,...f.style},onPointerDown:P(e.onPointerDown,e=>{e.button===0&&(e.target.setPointerCapture(e.pointerId),_.current=m.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect=`none`,p.viewport&&(p.viewport.style.scrollBehavior=`auto`),ee(e))}),onPointerMove:P(e.onPointerMove,ee),onPointerUp:P(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=v.current,p.viewport&&(p.viewport.style.scrollBehavior=``),_.current=null})})})}),Jo=`ScrollAreaThumb`,Yo=z.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=Ko(Jo,e.__scopeScrollArea);return(0,B.jsx)(gn,{present:n||i.hasThumb,children:(0,B.jsx)(Xo,{ref:t,...r})})}),Xo=z.forwardRef((e,t)=>{let{__scopeScrollArea:n,style:r,...i}=e,a=No(Jo,n),o=Ko(Jo,n),{onThumbPositionChange:s}=o,c=sn(t,e=>o.onThumbChange(e)),l=z.useRef(void 0),u=cs(()=>{l.current&&=(l.current(),void 0)},100);return z.useEffect(()=>{let e=a.viewport;if(e){let t=()=>{u(),l.current||(l.current=ss(e,s),s())};return s(),e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)}},[a.viewport,u,s]),(0,B.jsx)(N.div,{"data-state":o.hasThumb?`visible`:`hidden`,...i,ref:c,style:{width:`var(--radix-scroll-area-thumb-width)`,height:`var(--radix-scroll-area-thumb-height)`,...r},onPointerDownCapture:P(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;o.onThumbPointerDown({x:n,y:r})}),onPointerUp:P(e.onPointerUp,o.onThumbPointerUp)})});Yo.displayName=Jo;var Zo=`ScrollAreaCorner`,Qo=z.forwardRef((e,t)=>{let n=No(Zo,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!==`scroll`&&r?(0,B.jsx)($o,{...e,ref:t}):null});Qo.displayName=Zo;var $o=z.forwardRef((e,t)=>{let{__scopeScrollArea:n,...r}=e,i=No(Zo,n),[a,o]=z.useState(0),[s,c]=z.useState(0),l=!!(a&&s);return ls(i.scrollbarX,()=>{let e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),c(e)}),ls(i.scrollbarY,()=>{let e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),o(e)}),l?(0,B.jsx)(N.div,{...r,ref:t,style:{width:a,height:s,position:`absolute`,right:i.dir===`ltr`?0:void 0,left:i.dir===`rtl`?0:void 0,bottom:0,...e.style}}):null});function es(e){return e?parseInt(e,10):0}function ts(e,t){let n=e/t;return isNaN(n)?0:n}function ns(e){let t=ts(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function rs(e,t,n,r=`ltr`){let i=ns(n),a=i/2,o=t||a,s=i-o,c=n.scrollbar.paddingStart+o,l=n.scrollbar.size-n.scrollbar.paddingEnd-s,u=n.content-n.viewport,d=r===`ltr`?[0,u]:[u*-1,0];return as([c,l],d)(e)}function is(e,t,n=`ltr`){let r=ns(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,o=t.content-t.viewport,s=a-r,c=Nn(e,n===`ltr`?[0,o]:[o*-1,0]);return as([0,o],[0,s])(c)}function as(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function os(e,t){return e>0&&e<t}var ss=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function i(){let a={left:e.scrollLeft,top:e.scrollTop},o=n.left!==a.left,s=n.top!==a.top;(o||s)&&t(),n=a,r=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(r)};function cs(e,t){let n=Tn(e),r=z.useRef(0);return z.useEffect(()=>()=>window.clearTimeout(r.current),[]),z.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function ls(e,t){let n=Tn(t);pn(()=>{let t=0;if(e){let r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(n)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}},[e,n])}var us=Po,ds=Io,fs=Qo,ps=`Separator`,ms=`horizontal`,hs=[`horizontal`,`vertical`],gs=z.forwardRef((e,t)=>{let{decorative:n,orientation:r=ms,...i}=e,a=_s(r)?r:ms,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,B.jsx)(N.div,{"data-orientation":a,...o,...i,ref:t})});gs.displayName=ps;function _s(e){return hs.includes(e)}var vs=gs,ys=`Switch`,[bs,xs]=dn(ys),[Ss,Cs]=bs(ys),ws=z.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c=`on`,onCheckedChange:l,form:u,...d}=e,[f,p]=z.useState(null),m=sn(t,e=>p(e)),h=z.useRef(!1),g=f?u||!!f.closest(`form`):!0,[_,v]=hn({prop:i,defaultProp:a??!1,onChange:l,caller:ys});return(0,B.jsxs)(Ss,{scope:n,checked:_,disabled:s,children:[(0,B.jsx)(N.button,{type:`button`,role:`switch`,"aria-checked":_,"aria-required":o,"data-state":ks(_),"data-disabled":s?``:void 0,disabled:s,value:c,...d,ref:m,onClick:P(e.onClick,e=>{v(e=>!e),g&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})}),g&&(0,B.jsx)(Os,{control:f,bubbles:!h.current,name:r,value:c,checked:_,required:o,disabled:s,form:u,style:{transform:`translateX(-100%)`}})]})});ws.displayName=ys;var Ts=`SwitchThumb`,Es=z.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=Cs(Ts,n);return(0,B.jsx)(N.span,{"data-state":ks(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});Es.displayName=Ts;var Ds=`SwitchBubbleInput`,Os=z.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=z.useRef(null),s=sn(o,a),c=En(n),l=Dn(t);return z.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(c!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[c,n,r]),(0,B.jsx)(`input`,{type:`checkbox`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...l,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});Os.displayName=Ds;function ks(e){return e?`checked`:`unchecked`}var As=ws,js=Es,Ms=`Tabs`,[Ns,Ps]=dn(Ms,[Wr]),Fs=Wr(),[Is,Ls]=Ns(Ms),Rs=z.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=wn(s),[d,f]=hn({prop:r,onChange:i,defaultProp:a??``,caller:Ms});return(0,B.jsx)(Is,{scope:n,baseId:Sn(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,B.jsx)(N.div,{dir:u,"data-orientation":o,...l,ref:t})})});Rs.displayName=Ms;var zs=`TabsList`,Bs=z.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=Ls(zs,n),o=Fs(n);return(0,B.jsx)(ni,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,B.jsx)(N.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});Bs.displayName=zs;var Vs=`TabsTrigger`,Hs=z.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=Ls(Vs,n),s=Fs(n),c=Gs(o.baseId,r),l=Ks(o.baseId,r),u=r===o.value;return(0,B.jsx)(ri,{asChild:!0,...s,focusable:!i,active:u,children:(0,B.jsx)(N.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:P(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:P(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:P(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});Hs.displayName=Vs;var Us=`TabsContent`,Ws=z.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=Ls(Us,n),c=Gs(s.baseId,r),l=Ks(s.baseId,r),u=r===s.value,d=z.useRef(u);return z.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,B.jsx)(gn,{present:i||u,children:({present:n})=>(0,B.jsx)(N.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});Ws.displayName=Us;function Gs(e,t){return`${e}-trigger-${t}`}function Ks(e,t){return`${e}-content-${t}`}var qs=Rs,Js=Bs,Ys=Hs,Xs=Ws,[Zs,Qs]=dn(`Tooltip`,[On]),$s=On(),ec=`TooltipProvider`,tc=700,nc=`tooltip.open`,[rc,ic]=Zs(ec),ac=e=>{let{__scopeTooltip:t,delayDuration:n=tc,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=z.useRef(!0),s=z.useRef(!1),c=z.useRef(0);return z.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,B.jsx)(rc,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:z.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:z.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:z.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};ac.displayName=ec;var oc=`Tooltip`,[sc,cc]=Zs(oc),lc=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=ic(oc,e.__scopeTooltip),l=$s(t),[u,d]=z.useState(null),f=Sn(),p=z.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=z.useRef(!1),[_,v]=hn({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(nc))):c.onClose(),a?.(e)},caller:oc}),y=z.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),b=z.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),x=z.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),S=z.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return z.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,B.jsx)(kn,{...l,children:(0,B.jsx)(sc,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:z.useCallback(()=>{c.isOpenDelayedRef.current?S():b()},[c.isOpenDelayedRef,S,b]),onTriggerLeave:z.useCallback(()=>{m?x():(window.clearTimeout(p.current),p.current=0)},[x,m]),onOpen:b,onClose:x,disableHoverableContent:m,children:n})})};lc.displayName=oc;var uc=`TooltipTrigger`,dc=z.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=cc(uc,n),a=ic(uc,n),o=$s(n),s=sn(t,z.useRef(null),i.onTriggerChange),c=z.useRef(!1),l=z.useRef(!1),u=z.useCallback(()=>c.current=!1,[]);return z.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,B.jsx)(Mn,{asChild:!0,...o,children:(0,B.jsx)(N.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:P(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:P(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:P(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:P(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:P(e.onBlur,i.onClose),onClick:P(e.onClick,i.onClose)})})});dc.displayName=uc;var fc=`TooltipPortal`,[pc,mc]=Zs(fc,{forceMount:void 0}),hc=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=cc(fc,t);return(0,B.jsx)(pc,{scope:t,forceMount:n,children:(0,B.jsx)(gn,{present:n||a.open,children:(0,B.jsx)(vn,{asChild:!0,container:i,children:r})})})};hc.displayName=fc;var gc=`TooltipContent`,_c=z.forwardRef((e,t)=>{let n=mc(gc,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=cc(gc,e.__scopeTooltip);return(0,B.jsx)(gn,{present:r||o.open,children:o.disableHoverableContent?(0,B.jsx)(Sc,{side:i,...a,ref:t}):(0,B.jsx)(vc,{side:i,...a,ref:t})})}),vc=z.forwardRef((e,t)=>{let n=cc(gc,e.__scopeTooltip),r=ic(gc,e.__scopeTooltip),i=z.useRef(null),a=sn(t,i),[o,s]=z.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=z.useCallback(()=>{s(null),d(!1)},[d]),p=z.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Ec(r,Tc(r,n.getBoundingClientRect())),a=Dc(t.getBoundingClientRect());s(kc([...i,...a])),d(!0)},[d]);return z.useEffect(()=>()=>f(),[f]),z.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),z.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!Oc(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,B.jsx)(Sc,{...e,ref:a})}),[yc,bc]=Zs(oc,{isInside:!1}),xc=on(`TooltipContent`),Sc=z.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=cc(gc,n),l=$s(n),{onClose:u}=c;return z.useEffect(()=>(document.addEventListener(nc,u),()=>document.removeEventListener(nc,u)),[u]),z.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,B.jsx)(bn,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,B.jsxs)(jn,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,B.jsx)(xc,{children:r}),(0,B.jsx)(yc,{scope:n,isInside:!0,children:(0,B.jsx)(Yn,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});_c.displayName=gc;var Cc=`TooltipArrow`,wc=z.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=$s(n);return bc(Cc,n).isInside?null:(0,B.jsx)(An,{...i,...r,ref:t})});wc.displayName=Cc;function Tc(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function Ec(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Dc(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function Oc(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function kc(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),Ac(t)}function Ac(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var jc=ac,Mc=lc,Nc=dc,Pc=hc,Fc=_c,Ic=wc;function Lc({delayDuration:e=0,...t}){return(0,B.jsx)(jc,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function Rc({...e}){return(0,B.jsx)(Mc,{"data-slot":`tooltip`,...e})}function zc({...e}){return(0,B.jsx)(Nc,{"data-slot":`tooltip-trigger`,...e})}function Bc({className:e,sideOffset:t=0,children:n,...r}){return(0,B.jsx)(Pc,{children:(0,B.jsxs)(Fc,{"data-slot":`tooltip-content`,sideOffset:t,className:O(`z-50 inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[n,(0,B.jsx)(Ic,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground`})]})})}function W(e){return A(e)}function Vc(){let e=W(e=>e.pairs);return(0,z.useMemo)(()=>{let t={};for(let n of e)(n.status===`active`||n.status===`pending`)&&(n.requesterId&&(t[n.requesterId]=n),n.targetId&&(t[n.targetId]=n));return t},[e])}function Hc(e){let t=W(e=>e.messages),n=W(e=>e.tasks),r=W(e=>e.pairs),i=W(e=>e.inboxReadCursors),a=W(e=>e.inboxArchivedThreads);return(0,z.useMemo)(()=>{if(!e)return{unread:0,needsHumanResponse:!1,pendingPairInvite:!1,claimableTasks:0,total:0,score:0};let o=t.filter(t=>Qt(t)===e.id&&!St(t)),s=Number(a[e.id]||0),c=s>=o.filter(e=>Ot(e)&&Dt(e)).reduce((e,t)=>Math.max(e,t.id),0)&&s>0?0:o.filter(t=>Tt(i,e.id,t)).length,l=qt(e),u=r.find(t=>(t.status===`active`||t.status===`pending`)&&(t.requesterId===e.id||t.targetId===e.id))?.status===`pending`,d=n.filter(t=>Xt(t)&&Yt(t.target,e)).length+t.filter(t=>bt(t)&&Yt(t.to,e)).length;return{unread:c,needsHumanResponse:l,pendingPairInvite:u,claimableTasks:d,total:c+ +!!l+ +!!u+d,score:c*10+(l?8:0)+(u?4:0)+d*2}},[e,t,n,r,i,a])}function Uc(){let e=W(e=>e.agents),t=W(e=>e.showBuiltIns),n=W(e=>e.showOffline),r=W(e=>e.agentSort),i=W(e=>e.agentSortDir),a=W(e=>e.agentPresetFilter),o=W(e=>e.agentStatusFilter),s=W(e=>e.agentTagFilter),c=W(e=>e.agentHostFilter),l=W(e=>e.managedPolicies),u=W(e=>e.pairs);return(0,z.useMemo)(()=>{let d=At(e,t,l);if(a){let e=Wc(u);d=Gc(d,a,vt.getState().now,e)}n||(d=d.filter(e=>e.status!==`offline`)),o===`starting`?d=d.filter(e=>e.status!==`offline`&&!e.ready):o&&(d=d.filter(e=>e.status===o)),s&&(d=d.filter(e=>(e.tags||[]).includes(s))),c&&(d=d.filter(e=>(e.machine||``)===c));let f=i===`desc`?-1:1;return[...d].sort((e,t)=>r===`name`?M(e).localeCompare(M(t))*f:r===`lastSeen`?(new Date(t.lastSeen).getTime()-new Date(e.lastSeen).getTime())*f||M(e).localeCompare(M(t)):r===`created`?(new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime())*f||M(e).localeCompare(M(t)):((Bt[e.status]??9)-(Bt[t.status]??9))*f||M(e).localeCompare(M(t)))},[e,t,n,l,r,i,a,o,s,c,u,gt()])}function Wc(e){let t={};for(let n of e)(n.status===`active`||n.status===`pending`)&&(n.requesterId&&(t[n.requesterId]=n),n.targetId&&(t[n.targetId]=n));return t}function Gc(e,t,n,r){switch(t){case`active`:return e.filter(e=>e.status!==`offline`);case`offline_stale`:return e.filter(e=>e.status===`offline`||Zt(n,e));case`claude`:case`codex`:return e.filter(e=>Ut(e)===t);case`paired`:return e.filter(e=>!!r[e.id]);case`unpaired`:return e.filter(e=>!r[e.id]);default:return e}}function Kc(){let e=W(e=>e.messages),t=W(e=>e.inboxReadCursors),n=W(e=>e.inboxArchivedThreads),r=W(e=>e.inboxDrafts),i=W(e=>e.agentsById),a=W(e=>e.coordinatorMutes);return(0,z.useMemo)(()=>{let o=new Map;for(let t of e){if(St(t))continue;let e=Qt(t);e&&(o.has(e)||o.set(e,{id:e,peer:e,messages:[],lastMessage:null,previewMessage:null,attention:{unread:0,needsHumanResponse:!1,score:0},archived:!1,draft:``}),o.get(e).messages.push(t))}for(let e of o.values()){e.messages.sort((e,t)=>e.id-t.id),e.lastMessage=e.messages[e.messages.length-1]||null;let o=null;for(let t=e.messages.length-1;t>=0;t--){let n=e.messages[t];if(n&&!xt(n)){o=n;break}}e.previewMessage=o||e.lastMessage;let s=a.includes(e.peer),c=s?0:e.messages.filter(n=>Tt(t,e.peer,n)).length,l=s?!1:qt(i[e.peer]);e.attention={unread:c,needsHumanResponse:l,score:c*10+(l?8:0)};let u=Number(n[e.peer]||0);e.archived=!!(e.lastMessage?.id&&u>=e.lastMessage.id),e.draft=r[e.peer]||``}return[...o.values()].sort((e,t)=>{let n=(t.attention.score||0)-(e.attention.score||0);return n===0?(t.lastMessage?.id||0)-(e.lastMessage?.id||0):n})},[e,t,n,r,i,a])}function qc(){let e=Kc(),t=W(e=>e.agents),n=W(e=>e.showBuiltIns),r=W(e=>e.showOffline),i=W(e=>e.managedPolicies),a=W(e=>e.pairs),o=W(e=>e.tasks),s=W(e=>e.messages),c=(0,z.useMemo)(()=>new Set(At(t,n,i).filter(e=>r||e.status!==`offline`).map(e=>e.id)),[t,n,r,i]);return(0,z.useMemo)(()=>{let l=e.filter(e=>!e.archived&&c.has(e.peer)).reduce((e,t)=>e+(t.attention.unread||0),0),u=At(t,n,i).filter(e=>(r||e.status!==`offline`)&&qt(e)).length,d=a.filter(e=>e.status===`pending`).length,f=o.filter(Xt).length+s.filter(bt).length;return{unreadInbox:l,needsHumanResponse:u,pendingPairInvites:d,claimableTasks:f,total:l+u+d+f}},[e,c,t,n,r,i,a,o,s])}function Jc(){let e=W(e=>e.agents),t=W(e=>e.showBuiltIns),n=W(e=>e.managedPolicies);return(0,z.useMemo)(()=>At(e,t,n).filter(e=>e.status!==`offline`).length,[e,t,n])}function Yc(){let e=W(e=>e.agents);return(0,z.useMemo)(()=>e.filter(e=>e.status===`busy`).length,[e])}function Xc(){let e=W(e=>e.agents),t=W(e=>e.showBuiltIns),n=W(e=>e.showOffline),r=W(e=>e.managedPolicies);return(0,z.useMemo)(()=>{let i=At(e,t,r);return n?i:i.filter(e=>e.status!==`offline`)},[e,t,n,r])}function Zc(){let e=W(e=>e.agents),t=W(e=>e.showBuiltIns),n=W(e=>e.managedPolicies);return(0,z.useMemo)(()=>[...new Set(At(e,t,n).map(e=>e.machine).filter(Boolean))].sort(),[e,t,n])}function Qc(){let e=W(e=>e.agents),t=W(e=>e.showBuiltIns),n=W(e=>e.managedPolicies);return(0,z.useMemo)(()=>[...new Set(At(e,t,n).flatMap(e=>e.tags||[]))],[e,t,n])}function $c(){let e=W(e=>e.tasks),t=W(e=>e.messages);return(0,z.useMemo)(()=>{let n=e.filter(e=>!Et.has(e.status)).map(e=>({id:`task-`+e.id,sourceType:`task`,title:e.title,body:e.body,severity:e.severity||`info`,status:e.status,owner:e.claimedBy||``,target:e.target,source:e.source,channel:e.channel||``,updatedAt:e.updatedAt||e.createdAt,createdAt:e.createdAt,claimable:Xt(e),task:e})),r=t.filter(bt).map(e=>({id:`message-`+e.id,sourceType:`message`,title:e.subject||`Claimable message #`+e.id,body:zt(e),severity:`warning`,status:e.claimedBy?`claimed`:`open`,owner:e.claimedBy||``,target:e.to,source:`message`,channel:e.channel||``,updatedAt:e.claimedAt||e.createdAt,createdAt:e.createdAt,claimable:bt(e),message:e}));return[...n,...r].sort((e,t)=>{let n=Number(t.claimable)-Number(e.claimable);if(n!==0)return n;let r={critical:0,warning:1,info:2},i=(r[e.severity]??9)-(r[t.severity]??9);return i===0?Kt(e.updatedAt)-Kt(t.updatedAt):i})},[e,t])}function el(){let e=W(e=>e.commandQuery),t=W(e=>e.agents),n=W(e=>e.agentsById),r=W(e=>e.showBuiltIns),i=W(e=>e.showOffline),a=W(e=>e.managedPolicies);return(0,z.useMemo)(()=>{let n=At(t,r,a).filter(e=>i||e.status!==`offline`),o=[...new Set(n.flatMap(e=>e.tags||[]))],s=Le(),c=[G(`open-chat`,`Open chat`,`Human console`,`MessageCircle`,`openView`,{view:`chat`}),G(`open-work`,`Open work queue`,`Claimable messages and tasks`,`ListChecks`,`openView`,{view:`work`}),G(`open-workspaces`,`Open workspaces`,`Agent worktrees and merge state`,`GitBranch`,`openView`,{view:`workspaces`}),G(`show-stale`,`Show stale agents`,`Filter agents to offline or stale`,`Filter`,`agentPreset`,{preset:`offline_stale`}),G(`copy-url`,`Copy relay URL`,s,`Copy`,`copy`,{value:s}),G(`export-md`,`Export timeline as Markdown`,`Activity audit trace`,`FileDown`,`exportActivity`,{format:`markdown`}),G(`export-json`,`Export timeline as JSON`,`Activity audit trace`,`Braces`,`exportActivity`,{format:`json`}),...n.slice(0,12).map(e=>G(`msg-`+e.id,`Message agent: `+M(e),e.id,`Send`,`messageAgent`,{agentId:e.id})),...n.filter(e=>Ut(e)===`codex`).slice(0,8).map(e=>G(`pair-`+e.id,`Pair Codex: `+M(e),e.id,`Link`,`pairAgent`,{agentId:e.id})),...o.map(e=>G(`tag-`+e,`Filter tag: `+e,`#`+e,`Tag`,`filterTag`,{tag:e}))],l=e.trim().toLowerCase();return(l?c.filter(e=>e.search.includes(l)):c).slice(0,24)},[e,t,n,r,i,a])}function G(e,t,n,r,i,a){return{id:e,title:t,subtitle:n,icon:r,action:i,payload:a,search:`${t}\n${n}\n${i}`.toLowerCase()}}function tl({className:e,size:t=`default`,...n}){return(0,B.jsx)(As,{"data-slot":`switch`,"data-size":t,className:O(`peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50`,e),...n,children:(0,B.jsx)(js,{"data-slot":`switch-thumb`,className:`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground`})})}function nl({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return(0,B.jsx)(vs,{"data-slot":`separator`,decorative:n,orientation:t,className:O(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,e),...r})}function rl({...e}){return(0,B.jsx)(vo,{"data-slot":`dropdown-menu`,...e})}function il({...e}){return(0,B.jsx)(yo,{"data-slot":`dropdown-menu-trigger`,...e})}function al({className:e,align:t=`start`,sideOffset:n=4,...r}){return(0,B.jsx)(bo,{children:(0,B.jsx)(xo,{"data-slot":`dropdown-menu-content`,sideOffset:n,align:t,className:O(`z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:overflow-hidden data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r})})}function ol({className:e,inset:t,variant:n=`default`,...r}){return(0,B.jsx)(Co,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:O(`group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function sl({className:e,inset:t,...n}){return(0,B.jsx)(So,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:O(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,e),...n})}function cl({className:e,...t}){return(0,B.jsx)(wo,{"data-slot":`dropdown-menu-separator`,className:O(`-mx-1 my-1 h-px bg-border`,e),...t})}var ll={LayoutDashboard:at,MessageCircle:Ze,Bot:w,Server:l,MessagesSquare:Oe,Plug:dt,PlugZap:pe,Activity:ve,Link:Ue,Mail:qe,ListChecks:Ye,ClipboardList:Te,CalendarClock:ne,AreaChart:de,Settings:ue,Workflow:Ge,BrainCircuit:Re,FolderTree:ie,Shield:s,Wrench:k,UserCog:ke,Lightbulb:xe,Users:Ve,Boxes:C,PackagePlus:_e};function ul(e){return new Date(e.createdAt).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`})}var dl=[[`messages`,`Messages`],[`replies`,`Replies`],[`errors`,`Errors`]];function fl(){let e=A(e=>e.notifications),t=A(e=>e.notificationUnread),n=A(e=>e.notificationSettings),r=A(e=>e.notificationPermission),i=A(e=>e.set),a=A(e=>e.openNotification),o=A(e=>e.markNotificationsRead),s=A(e=>e.clearNotifications),l=A(e=>e.requestBrowserNotifications),u=t>0?x:m;function d(e){i({notificationSettings:{...n,...e}})}return(0,B.jsxs)(rl,{onOpenChange:e=>{e&&o()},children:[(0,B.jsx)(il,{asChild:!0,children:(0,B.jsxs)(`button`,{className:`relative flex items-center gap-2 text-muted-foreground hover:text-foreground transition-colors w-full`,children:[(0,B.jsx)(u,{className:`w-3.5 h-3.5`}),(0,B.jsx)(`span`,{children:`Notifications`}),t>0&&(0,B.jsx)(F,{variant:`destructive`,className:`ml-auto text-[10px] px-1.5 py-0`,children:t})]})}),(0,B.jsxs)(al,{align:`start`,side:`right`,className:`w-80 p-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-1.5 py-1`,children:[(0,B.jsx)(sl,{className:`p-0`,children:`Notifications`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(`button`,{type:`button`,title:`Mark read`,onClick:o,className:`rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground`,children:(0,B.jsx)(c,{className:`h-3.5 w-3.5`})}),(0,B.jsx)(`button`,{type:`button`,title:`Clear`,onClick:s,className:`rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground`,children:(0,B.jsx)(Ne,{className:`h-3.5 w-3.5`})})]})]}),(0,B.jsxs)(`div`,{className:`px-1.5 py-1.5 space-y-2`,children:[(0,B.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-xs`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`In-app notifications`}),(0,B.jsx)(tl,{size:`sm`,checked:n.enabled,onCheckedChange:e=>d({enabled:e})})]}),(0,B.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-xs`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Browser notifications`}),(0,B.jsx)(tl,{size:`sm`,checked:n.browserEnabled&&r===`granted`,disabled:r===`unsupported`,onCheckedChange:e=>{e&&r!==`granted`?l():d({browserEnabled:e})}})]}),(0,B.jsx)(`div`,{className:`grid grid-cols-3 gap-1`,children:dl.map(([e,t])=>(0,B.jsx)(`button`,{type:`button`,onClick:()=>d({[e]:!n[e]}),className:O(`rounded border px-2 py-1 text-[11px] transition-colors`,n[e]?`border-primary/40 bg-primary/10 text-primary`:`border-border text-muted-foreground hover:bg-accent`),children:t},e))})]}),(0,B.jsx)(cl,{}),(0,B.jsx)(`div`,{className:`max-h-80 overflow-y-auto`,children:e.length===0?(0,B.jsx)(`div`,{className:`px-1.5 py-8 text-center text-xs text-muted-foreground`,children:`No notifications`}):e.slice(0,20).map(e=>(0,B.jsxs)(ol,{onSelect:t=>{t.preventDefault(),a(e)},className:`flex flex-col items-start gap-0.5 px-2 py-2`,children:[(0,B.jsxs)(`div`,{className:`flex w-full items-center gap-2`,children:[(0,B.jsx)(`span`,{className:O(`h-1.5 w-1.5 rounded-full`,e.severity===`error`?`bg-red-400`:e.severity===`warning`?`bg-yellow-400`:`bg-blue-400`)}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium`,children:e.title}),(0,B.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:ul(e)})]}),(0,B.jsx)(`span`,{className:`line-clamp-2 text-xs text-muted-foreground`,children:e.body}),e.routing?.reason&&(0,B.jsxs)(`span`,{className:`line-clamp-1 text-[10px] text-muted-foreground/80`,children:[`routed because `,e.routing.reason]})]},e.id))})]})]})}function pl(){let e=A(e=>e.theme),t=A(e=>e.set);return(0,B.jsxs)(rl,{children:[(0,B.jsx)(il,{asChild:!0,children:(0,B.jsxs)(`button`,{className:`flex items-center gap-2 text-muted-foreground hover:text-foreground transition-colors w-full`,children:[(0,B.jsx)(g,{className:`w-3.5 h-3.5`}),(0,B.jsx)(`span`,{children:`Theme`}),(0,B.jsx)(`span`,{className:`ml-auto text-[10px] text-muted-foreground`,children:rn.find(t=>t.id===e)?.label})]})}),(0,B.jsx)(al,{align:`start`,side:`right`,className:`w-40`,children:rn.map(n=>(0,B.jsxs)(ol,{onSelect:()=>t({theme:n.id}),children:[(0,B.jsx)(`span`,{className:`flex-1`,children:n.label}),e===n.id&&(0,B.jsx)(ce,{className:`w-3.5 h-3.5 text-primary`})]},n.id))})]})}function ml(){let e=A(e=>e.view),t=A(e=>e.switchView),n=A(e=>e.connected),r=A(e=>e.showOffline),i=A(e=>e.showBuiltIns),a=A(e=>e.autoRefresh),o=A(e=>e.stats),s=A(e=>e.openCommandPalette),c=A(e=>e.set),l=A(e=>e.startAutoRefresh),u=A(e=>e.stopAutoRefresh),d=qc(),f=Jc();function p(e){return e===`overview`&&d.total>0?(0,B.jsx)(F,{variant:`destructive`,className:`ml-auto text-[10px] px-1.5 py-0`,children:d.total}):e===`chat`&&d.unreadInbox>0?(0,B.jsx)(F,{variant:`destructive`,className:`ml-auto text-[10px] px-1.5 py-0`,children:d.unreadInbox}):e===`agents`?(0,B.jsx)(F,{variant:`secondary`,className:`ml-auto text-[10px] px-1.5 py-0`,children:f}):e===`pairs`&&d.pendingPairInvites>0?(0,B.jsx)(F,{className:`ml-auto text-[10px] px-1.5 py-0 bg-yellow-500/20 text-yellow-400`,children:d.pendingPairInvites}):e===`work`&&d.claimableTasks>0?(0,B.jsx)(F,{className:`ml-auto text-[10px] px-1.5 py-0 bg-yellow-500/20 text-yellow-400`,children:d.claimableTasks}):null}return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`nav`,{className:`flex-1 overflow-y-auto py-2 px-2`,children:Wt.map(n=>{let r=ll[n.icon]||w;return(0,B.jsxs)(`button`,{onClick:()=>t(n.key),className:O(`w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors my-0.5`,e===n.key?`bg-primary text-primary-foreground`:`text-foreground hover:bg-accent`),children:[(0,B.jsx)(r,{className:`w-4 h-4 shrink-0`}),n.label,p(n.key)]},n.key)})}),(0,B.jsxs)(`div`,{className:`mt-auto border-t border-border p-4 space-y-3 text-xs`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:O(`w-2 h-2 rounded-full`,n?`bg-emerald-500`:`bg-red-500 animate-pulse`)}),(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:n?`Live`:`Reconnecting...`})]}),(0,B.jsxs)(`button`,{onClick:s,className:`flex items-center gap-2 text-muted-foreground hover:text-foreground transition-colors w-full`,children:[(0,B.jsx)(Ie,{className:`w-3.5 h-3.5`}),(0,B.jsx)(`span`,{children:`Command palette`}),(0,B.jsx)(`kbd`,{className:`ml-auto text-[10px] bg-muted px-1.5 py-0.5 rounded`,children:`⌘K`})]}),(0,B.jsx)(fl,{}),(0,B.jsx)(pl,{}),(0,B.jsx)(nl,{}),(0,B.jsxs)(`label`,{className:`flex items-center justify-between cursor-pointer`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Show offline`}),(0,B.jsx)(tl,{checked:r,onCheckedChange:e=>c({showOffline:e})})]}),(0,B.jsxs)(`label`,{className:`flex items-center justify-between cursor-pointer`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`System agents`}),(0,B.jsx)(tl,{checked:i,onCheckedChange:e=>c({showBuiltIns:e})})]}),(0,B.jsxs)(`label`,{className:`flex items-center justify-between cursor-pointer`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Auto refresh`}),(0,B.jsx)(tl,{checked:a,onCheckedChange:e=>{c({autoRefresh:e}),e?l():u()}})]}),o.version&&(0,B.jsxs)(`div`,{className:`text-muted-foreground pt-1`,children:[`v`,o.version]})]})]})}function hl(){return(0,B.jsxs)(`aside`,{className:`hidden xl:flex w-[250px] min-w-[250px] h-[calc(100dvh-var(--sat))] sticky top-[var(--sat)] flex-col border-r border-border bg-card`,children:[(0,B.jsxs)(`div`,{className:`px-5 py-4 font-bold text-base border-b border-border flex items-center gap-2`,children:[(0,B.jsx)(b,{className:`w-4 h-4 text-primary`}),`Agent Relay`]}),(0,B.jsx)(ml,{})]})}function gl(){let e=A(e=>e.mobileMenuOpen),t=A(e=>e.set);return(0,z.useEffect)(()=>{if(!e)return;function n(e){e.key===`Escape`&&t({mobileMenuOpen:!1})}return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e]),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{className:O(`xl:hidden fixed inset-0 z-40 bg-black/50 transition-opacity duration-200`,e?`opacity-100`:`opacity-0 pointer-events-none`),onClick:()=>t({mobileMenuOpen:!1})}),(0,B.jsxs)(`aside`,{inert:!e,className:O(`xl:hidden fixed inset-y-0 left-0 z-50 w-[280px] flex flex-col pt-[var(--sat)] bg-card border-r border-border transition-transform duration-200 ease-out`,e?`translate-x-0`:`-translate-x-full`),children:[(0,B.jsxs)(`div`,{className:`px-5 py-4 font-bold text-base border-b border-border flex items-center gap-2`,children:[(0,B.jsx)(b,{className:`w-4 h-4 text-primary`}),`Agent Relay`,(0,B.jsx)(`button`,{onClick:()=>t({mobileMenuOpen:!1}),className:`ml-auto p-1 text-muted-foreground hover:text-foreground transition-colors`,"aria-label":`Close menu`,children:(0,B.jsx)(Fe,{className:`w-4 h-4`})})]}),(0,B.jsx)(ml,{})]})]})}var _l=500*1024,vl={bash:`bash`,c:`c`,conf:`properties`,cpp:`cpp`,cs:`csharp`,css:`css`,csv:`csv`,cts:`typescript`,diff:`diff`,dockerfile:`dockerfile`,env:`dotenv`,gemspec:`ruby`,go:`go`,graphql:`graphql`,h:`c`,hcl:`hcl`,hpp:`cpp`,html:`html`,ini:`ini`,java:`java`,js:`javascript`,json:`json`,jsonc:`jsonc`,jsx:`jsx`,kt:`kotlin`,less:`less`,log:`log`,lua:`lua`,mjs:`javascript`,mts:`typescript`,patch:`diff`,php:`php`,plist:`xml`,podspec:`ruby`,properties:`properties`,py:`python`,rake:`ruby`,rb:`ruby`,rs:`rust`,scss:`scss`,sh:`bash`,sql:`sql`,svelte:`svelte`,swift:`swift`,toml:`toml`,ts:`typescript`,tsx:`tsx`,txt:`text`,vue:`vue`,webmanifest:`json`,xml:`xml`,yaml:`yaml`,yml:`yaml`,zsh:`bash`},yl={".bashrc":`bash`,".env":`dotenv`,".eslintrc":`json`,".gitignore":`gitignore`,".npmrc":`properties`,".prettierrc":`json`,".swiftformat":`properties`,".swiftlint.yml":`yaml`,".watchmanconfig":`json`,"app.config":`json`,"app.webmanifest":`json`,berksfile:`ruby`,brewfile:`ruby`,"bun.lock":`json`,capfile:`ruby`,cartfile:`ruby`,"composer.lock":`json`,dangerfile:`ruby`,"deno.lock":`json`,fastfile:`ruby`,"flake.lock":`json`,gemfile:`ruby`,guardfile:`ruby`,podfile:`ruby`,rakefile:`ruby`,dockerfile:`dockerfile`,makefile:`make`},bl=null;function xl(){return bl??=R(()=>import(`./bundle-web-BLavPdXe.js`),__vite__mapDeps([0,1,2,3]),import.meta.url),bl}function Sl(e){return new TextEncoder().encode(e).length}function Cl(e){return e.split(`/`).filter(Boolean).pop()||e}function wl(e){let t=e?.slice(0,240).split(/\r?\n/,1)[0]?.toLowerCase()||``;return t.startsWith(`#!`)?/\b(bash|dash|ksh|sh|zsh)\b/.test(t)?`bash`:/\bfish\b/.test(t)?`fish`:/\b(ts-node|tsx)\b/.test(t)?`typescript`:/\b(node|bun|deno)\b/.test(t)?`javascript`:/\bpython[0-9.]*\b/.test(t)?`python`:/\bruby\b/.test(t)?`ruby`:/\bswift\b/.test(t)?`swift`:/\bperl\b/.test(t)?`perl`:/\bphp\b/.test(t)?`php`:null:null}function Tl(e,t,n,r){if(n)return n;let i=Cl(e).toLowerCase();if(yl[i])return yl[i];if(i.endsWith(`.d.ts`))return`typescript`;let a=wl(r);if(a)return a;let o=i.includes(`.`)?i.slice(i.lastIndexOf(`.`)+1):``;return o&&vl[o]?vl[o]:t?.includes(`json`)?`json`:t?.includes(`javascript`)?`javascript`:t?.includes(`typescript`)?`typescript`:t?.includes(`xml`)?`xml`:t?.includes(`yaml`)||t?.includes(`yml`)?`yaml`:t?.includes(`shellscript`)?`bash`:null}function El(e,t,n,r){let i=Tl(e,t,n,r);return!!(i&&i!==`text`&&i!==`log`)}var Dl=(0,z.memo)(function({content:e,path:t,mediaType:n,languageHint:r,compact:i=!1}){let a=A(e=>e.theme),o=rn.find(e=>e.id===a)?.dark??!0,s=(0,z.useMemo)(()=>Tl(t,n,r,e)||`text`,[e,r,n,t]),c=Sl(e)>_l,[l,u]=(0,z.useState)(``),[d,f]=(0,z.useState)(!1),[p,m]=(0,z.useState)(!1);function h(){return(0,B.jsx)(Pn,{value:e,label:`Copy code`,copiedLabel:`Copied code`,size:`icon`,variant:`ghost`,className:`absolute right-2 top-2 h-7 w-7 bg-background/80 opacity-0 shadow-sm backdrop-blur transition-opacity hover:bg-muted group-hover/code:opacity-100 focus-visible:opacity-100`})}return(0,z.useEffect)(()=>{if(c||s===`text`||s===`log`){u(``),f(!1),m(!1);return}let t=!1;return f(!0),m(!1),xl().then(({codeToHtml:t})=>t(e,{lang:s,theme:o?`github-dark-default`:`github-light-default`})).then(e=>{t||u(e)}).catch(()=>{t||(u(``),m(!0))}).finally(()=>{t||f(!1)}),()=>{t=!0}},[e,o,s,c]),d?(0,B.jsxs)(`div`,{className:`flex items-center gap-2 p-4 text-sm text-muted-foreground`,children:[(0,B.jsx)(je,{className:`h-4 w-4 animate-spin`}),`Highlighting`]}):c||p||!l?(0,B.jsxs)(`div`,{className:`group/code relative`,children:[h(),(0,B.jsx)(`pre`,{className:`overflow-auto whitespace-pre-wrap break-words font-mono text-xs leading-5 ${i?`p-3`:`p-4`}`,children:e||` `})]}):(0,B.jsxs)(`div`,{className:`group/code relative`,children:[h(),(0,B.jsx)(`div`,{className:`code-preview overflow-auto font-mono text-xs leading-5 ${i?`p-3`:`p-4`}`,dangerouslySetInnerHTML:{__html:l}})]})}),Ol=(0,z.lazy)(()=>R(()=>import(`./markdown-preview-impl-D3hYfzGD.js`).then(e=>({default:e.MarkdownPreview})),__vite__mapDeps([4,5,1,3,6]),import.meta.url));function kl(e){return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:`Loading preview…`}),children:(0,B.jsx)(Ol,{...e})})}var Al=e(pt(),1);function jl({src:e,alt:t,onClose:n}){let[r,i]=(0,z.useState)(!1);return(0,z.useEffect)(()=>{let e=document.body.style.overflow;document.body.style.overflow=`hidden`;function t(e){e.key===`Escape`&&n()}return document.addEventListener(`keydown`,t),()=>{document.body.style.overflow=e,document.removeEventListener(`keydown`,t)}},[n]),(0,B.jsxs)(`div`,{className:`fixed inset-0 z-[100] flex flex-col bg-black/95`,children:[(0,B.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 p-2`,children:[(0,B.jsx)(`button`,{type:`button`,className:`rounded-full bg-white/10 p-2 text-white/70 hover:bg-white/20 hover:text-white`,onClick:()=>i(!r),title:r?`Fit to screen`:`Actual size`,children:r?(0,B.jsx)(We,{className:`h-4 w-4`}):(0,B.jsx)(Xe,{className:`h-4 w-4`})}),(0,B.jsx)(`button`,{type:`button`,className:`rounded-full bg-white/10 p-2 text-white/70 hover:bg-white/20 hover:text-white`,onClick:n,title:`Close`,children:(0,B.jsx)(Fe,{className:`h-4 w-4`})})]}),(0,B.jsx)(`div`,{className:`min-h-0 flex-1 ${r?`overflow-auto`:`flex items-center justify-center overflow-hidden p-4`}`,onClick:r?void 0:n,children:(0,B.jsx)(`img`,{src:e,alt:t,className:r?`max-w-none`:`max-h-full max-w-full cursor-zoom-in object-contain`,onClick:e=>{e.stopPropagation(),i(!r)}})})]})}function Ml({src:e,alt:t=``,className:n,style:r}){let[i,a]=(0,z.useState)(!1);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`img`,{src:e,alt:t,className:`${n||``} cursor-zoom-in`,style:r,onClick:()=>a(!0)}),i&&(0,Al.createPortal)((0,B.jsx)(jl,{src:e,alt:t,onClose:()=>a(!1)}),document.body)]})}var Nl=`agent-relay:file-git-status`;function Pl(){try{return window.localStorage.getItem(Nl)!==`off`}catch{return!0}}function Fl(e){try{window.localStorage.setItem(Nl,e?`on`:`off`)}catch{}}function Il(e){switch(e){case`staged`:return{dot:`bg-green-500`,text:`text-green-400`,label:`Staged`};case`unstaged`:return{dot:`bg-amber-500`,text:`text-amber-400`,label:`Modified (unstaged)`};case`staged-unstaged`:return{dot:`bg-amber-500`,text:`text-green-400`,label:`Staged + unstaged changes`};case`untracked`:return{dot:`bg-sky-500`,text:`text-sky-400`,label:`Untracked`};default:return null}}function Ll(e,t,n){let r=`/orchestrators/${encodeURIComponent(e)}/files/list?path=${encodeURIComponent(t)}`;return n?`${r}&git=1`:r}function Rl({status:e}){let t=Il(e);return t?(0,B.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 rounded-full ${t.dot}`,title:t.label}):null}function K(e){return e===void 0?``:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function zl(e,t){let n=t.replace(/\/+$/,``);return e===n?`/`:e.startsWith(n+`/`)?e.slice(n.length+1):e}function q(e,t){let n=e.toLowerCase();return n.endsWith(`.md`)||n.endsWith(`.mdx`)||n.endsWith(`.markdown`)||t===`text/markdown`}function J(e,t,n){return q(e,t)?`markdown`:El(e,t,void 0,n)?`code`:null}function Y(e){return`agent-relay:file-view-mode:${e}`}function Bl(e){try{let t=window.localStorage.getItem(Y(e));return t===`raw`||t===`rendered`?t:`rendered`}catch{return`rendered`}}function Vl(e,t){try{window.localStorage.setItem(Y(e),t)}catch{}}function Hl(e,t){let n=zl(e,t);if(n===`/`)return[{label:`/`,path:t}];let r=n.split(`/`).filter(Boolean),i=[{label:`/`,path:t}];for(let e=0;e<r.length;e++)i.push({label:r[e],path:`${t.replace(/\/+$/,``)}/${r.slice(0,e+1).join(`/`)}`});return i}function Ul(e,t){let n=A(e=>e.apiCall),[r,i]=(0,z.useState)(null),[a,o]=(0,z.useState)(!1),[s,c]=(0,z.useState)(``);return(0,z.useEffect)(()=>{if(!e||!t){i(null),c(``);return}let r=!1;return o(!0),c(``),n(`GET`,`/orchestrators/${encodeURIComponent(e)}/files/read?path=${encodeURIComponent(t)}`).then(e=>{r||i(e)}).catch(e=>{r||(i(null),c($t(e)))}).finally(()=>{r||o(!1)}),()=>{r=!0}},[n,e,t]),{file:r,loading:a,error:s}}function Wl(e,t,n=!1){let r=A(e=>e.apiCall),[i,a]=(0,z.useState)(null),[o,s]=(0,z.useState)(!1),[c,l]=(0,z.useState)(``);return(0,z.useEffect)(()=>{if(!e||!t){a(null),l(``);return}let i=!1;return s(!0),l(``),r(`GET`,Ll(e,t,n)).then(e=>{i||a(e)}).catch(e=>{i||(a(null),l($t(e)))}).finally(()=>{i||s(!1)}),()=>{i=!0}},[r,e,t,n]),{listing:i,loading:o,error:c}}function Gl({content:e,line:t,lineRef:n}){return(0,B.jsx)(`div`,{className:`w-full py-2 font-mono text-xs leading-5`,children:e.split(`
|
|
15
|
+
`).map((e,r)=>{let i=r+1,a=i===t;return(0,B.jsxs)(`div`,{ref:a?n:void 0,className:`grid grid-cols-[2.5rem_minmax(0,1fr)] px-1 sm:grid-cols-[4rem_minmax(0,1fr)] sm:px-2 ${a?`bg-primary/15`:``}`,children:[(0,B.jsx)(`div`,{className:`select-none pr-2 text-right text-muted-foreground sm:pr-3`,children:i}),(0,B.jsx)(`pre`,{className:`overflow-hidden whitespace-pre-wrap break-words`,children:e||` `})]},i)})})}function Kl({orchestratorId:e,selectedPath:t,onReadError:n,git:r=!1}){let{listing:i,loading:a,error:s}=Wl(e,t,r);return(0,z.useEffect)(()=>{n(s)},[s,n]),t?a?(0,B.jsxs)(`div`,{className:`flex h-full items-center justify-center gap-2 text-sm text-muted-foreground`,children:[(0,B.jsx)(je,{className:`h-4 w-4 animate-spin`}),`Loading directory`]}):s?(0,B.jsx)(`div`,{className:`h-full bg-muted/20`}):i?(0,B.jsxs)(`div`,{className:`h-full overflow-auto bg-muted/20`,children:[(0,B.jsxs)(`div`,{className:`sticky top-0 z-10 flex items-center gap-2 border-b border-border bg-background px-3 py-2 text-xs`,children:[(0,B.jsx)(ee,{className:`h-3.5 w-3.5 text-blue-400`}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:i.path}),(0,B.jsxs)(F,{variant:`outline`,className:`text-[10px]`,children:[i.entries.length,` items`]})]}),(0,B.jsxs)(`div`,{className:`divide-y divide-border/60`,children:[i.entries.map(e=>{let t=e.type===`directory`?ee:o,n=Il(e.gitStatus);return(0,B.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-sm`,children:[(0,B.jsx)(t,{className:`h-4 w-4 shrink-0 ${e.type===`directory`?`text-blue-400`:`text-muted-foreground`}`}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs ${n?.text??``}`,children:e.name}),e.symlink&&(0,B.jsx)(Pe,{className:`h-3 w-3 shrink-0 text-muted-foreground/60`}),(0,B.jsx)(Rl,{status:e.gitStatus}),e.type!==`directory`&&(0,B.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:K(e.size)})]},e.path)}),i.entries.length===0&&(0,B.jsx)(`div`,{className:`px-3 py-8 text-center text-sm text-muted-foreground`,children:`No files`})]})]}):null:(0,B.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Select a directory to preview`})}function ql({orchestratorId:e,selectedPath:t,line:n,onReadError:r}){let{file:i,loading:a,error:s}=Ul(e,t),c=(0,z.useRef)(null),[l,u]=(0,z.useState)(`raw`);(0,z.useEffect)(()=>{r(s)},[s,r]),(0,z.useEffect)(()=>{n>0&&c.current?.scrollIntoView({block:`center`})},[i,n]),(0,z.useEffect)(()=>{if(!i||i.encoding===`binary`)return;if(n>0){u(`raw`);return}let e=J(i.path,i.mediaType,i.content);u(e?Bl(e):`raw`)},[i?.path,i?.encoding,i?.mediaType,i?.content,n]);function d(e,t){u(e),t&&Vl(t,e)}if(!t)return(0,B.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Select a file to preview`});if(a)return(0,B.jsxs)(`div`,{className:`flex h-full items-center justify-center gap-2 text-sm text-muted-foreground`,children:[(0,B.jsx)(je,{className:`h-4 w-4 animate-spin`}),`Loading file`]});if(s)return(0,B.jsx)(`div`,{className:`h-full bg-muted/20`});if(!i)return null;if(i.encoding===`base64`)return(0,B.jsxs)(`div`,{className:`flex h-full flex-col bg-muted/20`,children:[(0,B.jsxs)(`div`,{className:`sticky top-0 z-10 flex items-center gap-2 border-b border-border bg-background px-3 py-2 text-xs`,children:[(0,B.jsx)(o,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:i.path}),(0,B.jsx)(Pn,{value:i.path,label:`Copy path`,copiedLabel:`Copied path`,size:`icon`,variant:`ghost`,className:`h-7 w-7 shrink-0`}),(0,B.jsx)(F,{variant:`outline`,className:`text-[10px]`,children:K(i.size)})]}),(0,B.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:(0,B.jsx)(Ml,{src:`data:${i.mediaType};base64,${i.content??``}`,alt:i.name,className:`max-h-full max-w-full object-contain`,style:{imageRendering:i.mediaType===`image/svg+xml`?`auto`:void 0}})})]});if(i.encoding===`binary`)return(0,B.jsxs)(`div`,{className:`p-4 text-sm`,children:[(0,B.jsx)(`div`,{className:`font-medium`,children:i.name}),(0,B.jsx)(`div`,{className:`mt-1 text-muted-foreground`,children:i.truncated?`File too large to preview.`:`Binary file preview is not available.`}),(0,B.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,B.jsx)(F,{variant:`secondary`,children:i.mediaType}),(0,B.jsx)(F,{variant:`outline`,children:K(i.size)})]})]});let f=i.content??``,p=q(i.path,i.mediaType),m=!p&&El(i.path,i.mediaType,void 0,f),h=p||m,g=p?`markdown`:m?`code`:null;return(0,B.jsxs)(`div`,{className:`h-full overflow-auto bg-muted/20`,children:[(0,B.jsxs)(`div`,{className:`sticky top-0 z-10 flex items-center gap-2 border-b border-border bg-background px-3 py-2 text-xs`,children:[(0,B.jsx)(o,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:i.path}),(0,B.jsx)(Pn,{value:i.path,label:`Copy path`,copiedLabel:`Copied path`,size:`icon`,variant:`ghost`,className:`h-7 w-7 shrink-0`}),i.truncated&&(0,B.jsx)(F,{variant:`secondary`,className:`text-[10px]`,children:`truncated`}),(0,B.jsx)(F,{variant:`outline`,className:`text-[10px]`,children:K(i.size)}),h&&(0,B.jsxs)(`div`,{className:`flex shrink-0 rounded-md border border-border bg-muted/40 p-0.5`,children:[(0,B.jsx)(`button`,{type:`button`,className:`rounded px-2 py-1 text-[10px] font-medium ${l===`raw`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`}`,onClick:()=>d(`raw`,g),children:`Raw`}),(0,B.jsx)(`button`,{type:`button`,className:`rounded px-2 py-1 text-[10px] font-medium ${l===`rendered`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`}`,onClick:()=>d(`rendered`,g),children:p?`Rendered`:`Highlighted`})]})]}),l===`rendered`&&p&&(0,B.jsx)(kl,{content:f,path:i.path}),l===`rendered`&&m&&(0,B.jsx)(Dl,{content:f,path:i.path,mediaType:i.mediaType}),l===`raw`&&(0,B.jsx)(Gl,{content:f,line:n,lineRef:c})]})}function Jl({overlay:e=!1}){let t=A(e=>e.apiCall),n=A(e=>e.orchestrators),r=A(e=>e.fileOrchestratorId),s=A(e=>e.filePath),c=A(e=>e.fileSelectedPath),l=A(e=>e.fileSelectedLine),u=A(e=>e.set),d=A(e=>e.closeFileOverlay),f=A(e=>e.openOrchestratorSpawnAt),[m,h]=(0,z.useState)(null),[g,_]=(0,z.useState)(s),[v,y]=(0,z.useState)(!1),[b,x]=(0,z.useState)(``),[S,C]=(0,z.useState)(``),[te,ne]=(0,z.useState)(Pl),re=(0,z.useMemo)(()=>n.filter(e=>e.status===`online`),[n]),w=n.find(e=>e.id===r)||re[0];(0,z.useEffect)(()=>{if(!w)return;let e={};r||(e.fileOrchestratorId=w.id),s||(e.filePath=w.baseDir),Object.keys(e).length&&u(e)},[r,s,w,u]),(0,z.useEffect)(()=>_(s),[s]);async function ae(e=s){if(!(!w||!e)){y(!0),x(``);try{let n=await t(`GET`,Ll(w.id,e,te));h(n),u({filePath:n.path}),_(n.path),C(``)}catch(e){x($t(e))}finally{y(!1)}}}(0,z.useEffect)(()=>{ae(s)},[w?.id,s,te]);function oe(e){ne(e),Fl(e)}function se(e){u({fileOrchestratorId:e,filePath:n.find(t=>t.id===e)?.baseDir||``,fileSelectedPath:``,fileSelectedLine:0})}function T(e){C(``),e.type===`directory`?u({filePath:e.path,fileSelectedPath:``,fileSelectedLine:0}):u({fileSelectedPath:e.path,fileSelectedLine:0})}function E(){if(!w)return;let t=g.trim()||s||w.baseDir;e&&d(),f({orchestratorId:w.id,cwd:t})}let ce=m?Hl(m.path,m.baseDir):[],le=b||S;return(0,B.jsxs)(`div`,{className:e?`flex h-full flex-col`:`flex h-[calc(100dvh-5rem)] flex-col gap-3 md:gap-4`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 ${c?`hidden md:flex`:``}`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-lg font-semibold`,children:[(0,B.jsx)(ie,{className:`h-5 w-5 text-primary`}),`Files`]}),(0,B.jsxs)(`select`,{value:w?.id||``,onChange:e=>se(e.target.value),className:`h-9 rounded-md border border-input bg-background px-3 text-sm`,children:[re.length===0&&(0,B.jsx)(`option`,{value:``,children:`No online orchestrators`}),re.map(e=>(0,B.jsx)(`option`,{value:e.id,children:e.hostname||e.id},e.id))]}),e&&(0,B.jsx)(I,{size:`icon`,variant:`ghost`,className:`ml-auto h-8 w-8`,onClick:d,title:`Close`,children:(0,B.jsx)(Fe,{className:`h-4 w-4`})})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 ${c?`hidden md:flex`:``}`,children:[(0,B.jsx)(L,{value:g,onChange:e=>_(e.target.value),onKeyDown:e=>{e.key===`Enter`&&u({filePath:g,fileSelectedPath:``,fileSelectedLine:0})},className:`min-w-0 flex-1 basis-full font-mono text-xs sm:basis-auto`,placeholder:w?.baseDir||`Path`}),(0,B.jsxs)(I,{size:`sm`,variant:`outline`,className:`gap-1`,onClick:()=>ae(g),disabled:v||!w,children:[v?(0,B.jsx)(je,{className:`h-3.5 w-3.5 animate-spin`}):(0,B.jsx)(p,{className:`h-3.5 w-3.5`}),`Open`]}),(0,B.jsxs)(I,{size:`sm`,className:`gap-1`,onClick:E,disabled:!w,children:[(0,B.jsx)(a,{className:`h-3.5 w-3.5`}),(0,B.jsx)(`span`,{className:`sm:hidden`,children:`Spawn`}),(0,B.jsx)(`span`,{className:`hidden sm:inline`,children:`Spawn from here`})]}),(0,B.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,title:`Show git status colors`,children:[(0,B.jsx)(i,{className:`h-3.5 w-3.5`}),(0,B.jsx)(`span`,{className:`hidden sm:inline`,children:`Git`}),(0,B.jsx)(tl,{checked:te,onCheckedChange:oe})]})]}),ce.length>0&&(0,B.jsx)(`div`,{className:`flex flex-wrap items-center gap-1 text-xs text-muted-foreground ${c?`hidden md:flex`:``}`,children:ce.map((e,t)=>(0,B.jsxs)(`button`,{type:`button`,className:`rounded px-1.5 py-0.5 font-mono hover:bg-accent hover:text-foreground`,onClick:()=>u({filePath:e.path,fileSelectedPath:``,fileSelectedLine:0}),children:[e.label,t<ce.length-1&&e.label!==`/`?` /`:``]},`${e.path}-${t}`))}),le&&(0,B.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:le}),(0,B.jsxs)(`div`,{className:`grid min-h-0 flex-1 overflow-hidden md:rounded-md md:border md:border-border md:grid-cols-[22rem_minmax(0,1fr)] ${c?``:`rounded-md border border-border`}`,children:[(0,B.jsxs)(`div`,{className:`min-h-0 overflow-auto border-b border-border bg-card md:border-b-0 md:border-r ${c?`hidden md:block`:``}`,children:[m?.parent&&(0,B.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 px-3 py-2 text-left text-sm hover:bg-accent`,onClick:()=>u({filePath:m.parent,fileSelectedPath:``,fileSelectedLine:0}),children:[(0,B.jsx)($e,{className:`h-4 w-4 text-muted-foreground`}),(0,B.jsx)(`span`,{children:`Parent directory`})]}),m?.entries.map(e=>{let t=c===e.path||s===e.path,n=e.type===`directory`?ee:o,r=Il(e.gitStatus);return(0,B.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 px-3 py-2 text-left text-sm hover:bg-accent ${t?`bg-accent`:``}`,onClick:()=>T(e),children:[(0,B.jsx)(n,{className:`h-4 w-4 shrink-0 ${e.type===`directory`?`text-blue-400`:`text-muted-foreground`}`}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs ${r?.text??``}`,children:e.name}),e.symlink&&(0,B.jsx)(Pe,{className:`h-3 w-3 shrink-0 text-muted-foreground/60`}),(0,B.jsx)(Rl,{status:e.gitStatus}),e.type!==`directory`&&(0,B.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:K(e.size)})]},e.path)}),!v&&m&&m.entries.length===0&&(0,B.jsx)(`div`,{className:`px-3 py-8 text-center text-sm text-muted-foreground`,children:`No files`})]}),(0,B.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden ${c?``:`hidden md:flex`}`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1.5 border-b border-border px-3 py-2 text-xs text-muted-foreground hover:text-foreground md:hidden`,onClick:()=>u({fileSelectedPath:``,fileSelectedLine:0}),children:[(0,B.jsx)($e,{className:`h-3.5 w-3.5`}),`Back to files`]}),(0,B.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,B.jsx)(ql,{orchestratorId:w?.id||``,selectedPath:c,line:l,onReadError:C})})]})]})]})}function Yl(){return(0,B.jsx)(Jl,{})}function Xl(){return A(e=>e.fileOverlayOpen)?(0,B.jsx)(`div`,{className:`fixed inset-0 z-50 bg-background/80 backdrop-blur-sm`,children:(0,B.jsx)(`div`,{className:`absolute inset-4 overflow-hidden rounded-md border border-border bg-background p-4 shadow-xl`,children:(0,B.jsx)(Jl,{overlay:!0})})}):null}function Zl(e,t){let n=z.useRef(!1),r=z.useRef(t);r.current=t,z.useEffect(()=>{if(!e||!r.current)return;window.history.pushState({sheetGuard:!0},``),n.current=!0;function t(){n.current&&(n.current=!1,r.current?.(!1))}return window.addEventListener(`popstate`,t),()=>{window.removeEventListener(`popstate`,t),n.current&&(n.current=!1,window.history.back())}},[e])}function Ql({...e}){return Zl(e.open,e.onOpenChange),(0,B.jsx)(Ar,{"data-slot":`sheet`,...e})}function $l({...e}){return(0,B.jsx)(jr,{"data-slot":`sheet-portal`,...e})}function eu({className:e,...t}){return(0,B.jsx)(Mr,{"data-slot":`sheet-overlay`,className:O(`fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function tu({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...i}){return(0,B.jsxs)($l,{children:[(0,B.jsx)(eu,{}),(0,B.jsxs)(Nr,{"data-slot":`sheet-content`,"data-side":n,className:O(`fixed z-50 flex flex-col bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out overflow-hidden max-w-[100dvw] data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-full data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-full data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10`,e),...i,children:[t,r&&(0,B.jsx)(Ir,{"data-slot":`sheet-close`,asChild:!0,children:(0,B.jsxs)(I,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`,children:[(0,B.jsx)(Fe,{}),(0,B.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})]})]})}function nu({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`sheet-header`,className:O(`flex flex-col gap-0.5 p-4`,e),...t})}function ru({className:e,...t}){return(0,B.jsx)(Pr,{"data-slot":`sheet-title`,className:O(`font-heading text-base font-medium text-foreground`,e),...t})}function iu({className:e,orientation:t=`horizontal`,...n}){return(0,B.jsx)(qs,{"data-slot":`tabs`,"data-orientation":t,className:O(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var au=ln(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function ou({className:e,variant:t=`default`,...n}){return(0,B.jsx)(Js,{"data-slot":`tabs-list`,"data-variant":t,className:O(au({variant:t}),e),...n})}function su({className:e,...t}){return(0,B.jsx)(Ys,{"data-slot":`tabs-trigger`,className:O(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function cu({className:e,...t}){return(0,B.jsx)(Xs,{"data-slot":`tabs-content`,className:O(`flex-1 text-sm outline-none`,e),...t})}function lu({agent:e,now:t,className:n}){return(0,B.jsx)(`span`,{className:O(`inline-block w-2.5 h-2.5 rounded-full shrink-0`,Ct(e,t),n)})}function uu({className:e}){return(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,className:e,children:(0,B.jsx)(`path`,{d:`m3.127 10.604 3.135-1.76.053-.153-.053-.085H6.11l-.525-.032-1.791-.048-1.554-.065-1.505-.08-.38-.081L0 7.832l.036-.234.32-.214.455.04 1.009.069 1.513.105 1.097.064 1.626.17h.259l.036-.105-.089-.065-.068-.064-1.566-1.062-1.695-1.121-.887-.646-.48-.327-.243-.306-.104-.67.435-.48.585.04.15.04.593.456 1.267.981 1.654 1.218.242.202.097-.068.012-.049-.109-.181-.9-1.626-.96-1.655-.428-.686-.113-.411a2 2 0 0 1-.068-.484l.496-.674L4.446 0l.662.089.279.242.411.94.666 1.48 1.033 2.014.302.597.162.553.06.17h.105v-.097l.085-1.134.157-1.392.154-1.792.052-.504.25-.605.497-.327.387.186.319.456-.045.294-.19 1.23-.37 1.93-.243 1.29h.142l.161-.16.654-.868 1.097-1.372.484-.545.565-.601.363-.287h.686l.505.751-.226.775-.707.895-.585.759-.839 1.13-.524.904.048.072.125-.012 1.897-.403 1.024-.186 1.223-.21.553.258.06.263-.218.536-1.307.323-1.533.307-2.284.54-.028.02.032.04 1.029.098.44.024h1.077l2.005.15.525.346.315.424-.053.323-.807.411-3.631-.863-.872-.218h-.12v.073l.726.71 1.331 1.202 1.667 1.55.084.383-.214.302-.226-.032-1.464-1.101-.565-.497-1.28-1.077h-.084v.113l.295.432 1.557 2.34.08.718-.112.234-.404.141-.444-.08-.911-1.28-.94-1.44-.759-1.291-.093.053-.448 4.821-.21.246-.484.186-.403-.307-.214-.496.214-.98.258-1.28.21-1.016.19-1.263.112-.42-.008-.028-.092.012-.953 1.307-1.448 1.957-1.146 1.227-.274.109-.477-.247.045-.44.266-.39 1.586-2.018.956-1.25.617-.723-.004-.105h-.036l-4.212 2.736-.75.096-.324-.302.04-.496.154-.162 1.267-.871z`})})}function du({className:e}){return(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,className:e,children:(0,B.jsx)(`path`,{d:`M22.282 9.821a5.985 5.985 0 0 0-.516-4.91 6.046 6.046 0 0 0-6.51-2.9A6.065 6.065 0 0 0 4.981 4.18a5.985 5.985 0 0 0-3.998 2.9 6.046 6.046 0 0 0 .743 7.097 5.98 5.98 0 0 0 .51 4.911 6.051 6.051 0 0 0 6.515 2.9A5.985 5.985 0 0 0 13.26 24a6.056 6.056 0 0 0 5.772-4.206 5.99 5.99 0 0 0 3.997-2.9 6.056 6.056 0 0 0-.747-7.073zM13.26 22.43a4.476 4.476 0 0 1-2.876-1.04l.141-.081 4.779-2.758a.795.795 0 0 0 .392-.681v-6.737l2.02 1.168a.071.071 0 0 1 .038.052v5.583a4.504 4.504 0 0 1-4.494 4.494zM3.6 18.304a4.47 4.47 0 0 1-.535-3.014l.142.085 4.783 2.759a.771.771 0 0 0 .78 0l5.843-3.369v2.332a.08.08 0 0 1-.033.062L9.74 19.95a4.5 4.5 0 0 1-6.14-1.646zM2.34 7.896a4.485 4.485 0 0 1 2.366-1.973V11.6a.766.766 0 0 0 .388.676l5.815 3.355-2.02 1.168a.076.076 0 0 1-.071 0l-4.83-2.786A4.504 4.504 0 0 1 2.34 7.872zm16.597 3.855-5.833-3.387L15.119 7.2a.076.076 0 0 1 .071 0l4.83 2.791a4.494 4.494 0 0 1-.676 8.105v-5.678a.79.79 0 0 0-.407-.667zm2.01-3.023-.141-.085-4.774-2.782a.776.776 0 0 0-.785 0L9.409 9.23V6.897a.066.066 0 0 1 .028-.061l4.83-2.787a4.5 4.5 0 0 1 6.68 4.66zm-12.64 4.135-2.02-1.164a.08.08 0 0 1-.038-.057V6.075a4.5 4.5 0 0 1 7.375-3.453l-.142.08L8.704 5.46a.795.795 0 0 0-.393.681zm1.097-2.365 2.602-1.5 2.607 1.5v2.999l-2.597 1.5-2.607-1.5z`})})}var fu={claude:uu,anthropic:uu,codex:du,openai:du},pu={claude:`text-orange-400`,anthropic:`text-orange-400`};function mu({provider:e,className:t}){let n=e.toLowerCase(),r=fu[n];return r?(0,B.jsx)(`span`,{role:`img`,"aria-label":e,title:e,className:`inline-flex shrink-0`,children:(0,B.jsx)(r,{className:O(pu[n],t)})}):(0,B.jsx)(`span`,{className:`capitalize`,children:e})}var hu={codex:`text-blue-400 bg-blue-500/10 border-blue-500/25`,claude:`text-orange-400 bg-orange-500/10 border-orange-500/25`,user:`text-emerald-400 bg-emerald-500/10 border-emerald-500/25`,system:`text-purple-400 bg-purple-500/10 border-purple-500/25`,channel:`text-blue-400 bg-blue-500/10 border-blue-500/25`,agent:`text-zinc-400 bg-zinc-500/10 border-zinc-500/25`},gu={codex:Me,claude:uu,user:tt,system:l,channel:Oe,agent:w};function _u({agent:e,className:t}){let n=Ut(e),r=gu[n]||w;return(0,B.jsx)(`span`,{className:O(`inline-flex items-center justify-center w-5 h-5 rounded-md border text-sm`,hu[n]||hu.agent,t),children:(0,B.jsx)(r,{className:`w-3.5 h-3.5`})})}function vu({agent:e,compact:t=!1}){let n=Ou(e);return n.length===0?null:(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:n.slice(0,t?4:void 0).map(e=>(0,B.jsx)(F,{variant:`outline`,className:`text-[9px] px-1 py-0 h-4`,children:e},e))})}function yu({agent:e,compact:t=!1,className:n=``}){let r=xu(e);return(0,B.jsx)(`div`,{className:`flex flex-wrap items-center gap-1 ${n}`,children:r.map(e=>{let n=e.Icon;return(0,B.jsxs)(`span`,{title:e.title,className:`inline-flex h-5 min-w-5 items-center justify-center gap-1 rounded-md border px-1.5 text-[10px] leading-none ${e.className}`,children:[(0,B.jsx)(n,{className:`h-3 w-3 shrink-0`}),!t&&(0,B.jsx)(`span`,{children:e.label})]},e.key)})})}function bu({agent:e}){let t=e.context;if(!t)return null;let n=ju(t);if(n===null)return(0,B.jsxs)(`div`,{className:`space-y-1`,title:Mu(t),children:[(0,B.jsxs)(`div`,{className:`flex justify-between text-[10px] text-muted-foreground`,children:[(0,B.jsx)(`span`,{children:`collecting`}),(0,B.jsx)(`span`,{children:`--`})]}),(0,B.jsx)(`div`,{className:`h-1.5 rounded-full bg-muted overflow-hidden`,children:(0,B.jsx)(`div`,{className:`h-full w-0 bg-muted-foreground/30`})})]});let r=Math.round(n*100),i=r>=80?`bg-red-500`:r>=60?`bg-yellow-500`:`bg-emerald-500`;return(0,B.jsxs)(`div`,{className:`space-y-1`,title:Mu(t),children:[(0,B.jsxs)(`div`,{className:`flex justify-between text-[10px] text-muted-foreground`,children:[(0,B.jsx)(`span`,{children:t.lifecycleState}),(0,B.jsxs)(`span`,{children:[r,`%`]})]}),(0,B.jsx)(`div`,{className:`h-1.5 rounded-full bg-muted overflow-hidden`,children:(0,B.jsx)(`div`,{className:`h-full ${i}`,style:{width:`${Math.max(0,Math.min(100,r))}%`}})})]})}function xu(e){let t=Su(e),n=Cu(e),r=wu(e);return[{key:`origin`,label:t?`Relay`:`External`,title:t?`Agent Relay spawned this agent`:`Externally started agent registered with Agent Relay`,Icon:t?re:Be,className:t?`border-sky-500/30 bg-sky-500/10 text-sky-300`:`border-zinc-500/30 bg-zinc-500/10 text-zinc-300`},n,r]}function Su(e){return typeof e.meta?.spawnRequestId==`string`||typeof e.meta?.policyName==`string`||typeof e.meta?.automationRunId==`string`}function Cu(e){let t=String(e.providerCapabilities?.session?.approvalMode||e.meta?.approvalMode||`guarded`).toLowerCase();return t===`open`?{key:`approval`,label:`Open`,title:`Approval mode: open`,Icon:De,className:`border-emerald-500/30 bg-emerald-500/10 text-emerald-300`}:t===`read-only`?{key:`approval`,label:`Read-only`,title:`Approval mode: read-only`,Icon:y,className:`border-blue-500/30 bg-blue-500/10 text-blue-300`}:{key:`approval`,label:`Guarded`,title:`Approval mode: guarded`,Icon:rt,className:`border-amber-500/30 bg-amber-500/10 text-amber-300`}}function wu(e){let t=Tu(e.meta?.workspace),n=tn(t.requestedMode)||tn(e.meta?.workspaceMode),r=tn(t.mode),a=n&&n!==`inherit`?n:r&&n!==`inherit`?r:`default`;return a===`isolated`?{key:`workspace`,label:`Isolated`,title:`Workspace: isolated worktree`,Icon:i,iconColor:`text-violet-300`,className:`border-violet-500/30 bg-violet-500/10 text-violet-300`}:a===`shared`?{key:`workspace`,label:`Shared`,title:`Workspace: shared repo checkout`,Icon:ot,iconColor:`text-cyan-300`,className:`border-cyan-500/30 bg-cyan-500/10 text-cyan-300`}:{key:`workspace`,label:`Default`,title:r?`Workspace: default/inherit, resolved to ${r}`:`Workspace: default/inherit`,Icon:ut,iconColor:`text-zinc-400`,className:`border-zinc-500/30 bg-zinc-500/10 text-zinc-300`}}function Tu(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Eu(e){let t=Tu(e.meta?.workspace),n=tn(t.repoRoot)||tn(t.sourceCwd)||tn(e.meta?.cwd);return n?kt(n,2):``}function Du(e){return!!(e.context||e.providerCapabilities?.context)}function Ou(e){let t=e.providerCapabilities,n=e.context,r=[];t?.lifecycle.managed?r.push(`managed`):t&&r.push(`bridge`),t?.session?.approvalMode===`read-only`?r.push(`read-only`):t?.session?.fileWrite&&r.push(`write`),t?.session?.shell&&r.push(`shell`),(t?.model?.alias||t?.model?.id)&&r.push(String(t.model.alias||t.model.id));let i=Jt(e).length;if(i&&r.push(i===1?`1 subagent`:`${i} subagents`),n){let e=ju(n);r.push(e===null?`ctx collecting`:`${Math.round(e*100)}% ctx`)}return r}function ku({context:e,expected:t=!!e,size:n=26,className:r}){let i=ju(e);if(i===null&&!t)return null;let a=n>=24?3:2.5,o=n/2,s=o-a,c=2*Math.PI*s,l=i===null?c:c*(1-i),u=i===null,d=u?`text-muted-foreground`:i>.8?`text-red-400`:i>.5?`text-yellow-400`:`text-emerald-400`,f=u?null:Math.round(i*100);return(0,B.jsxs)(`div`,{className:`relative shrink-0 ${u?`opacity-70`:``} ${r??``}`,style:{width:n,height:n},title:Mu(e),children:[(0,B.jsxs)(`svg`,{width:n,height:n,viewBox:`0 0 ${n} ${n}`,className:`rotate-[-90deg]`,children:[(0,B.jsx)(`circle`,{cx:o,cy:o,r:s,fill:`none`,strokeWidth:a,className:`stroke-muted-foreground/20`}),(0,B.jsx)(`circle`,{cx:o,cy:o,r:s,fill:`none`,strokeWidth:a,strokeDasharray:c,strokeDashoffset:l,strokeLinecap:`round`,className:`${d} stroke-current transition-all duration-500`})]}),(0,B.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center font-semibold leading-none ${u?`text-muted-foreground`:d}`,style:{fontSize:n>=24?8:7},children:u?`?`:f})]})}function Au(e){let t=e.context;return!t?.tokensUsed&&!t?.tokensMax?null:t.tokensUsed&&t.tokensMax?`${Nu(t.tokensUsed)} / ${Nu(t.tokensMax)}`:t.tokensUsed?Nu(t.tokensUsed):t.tokensMax?Nu(t.tokensMax):null}function ju(e){return!e||typeof e.utilization!=`number`||!Number.isFinite(e.utilization)?null:Math.min(1,Math.max(0,e.utilization))}function Mu(e){if(!e)return`Context: collecting; provider has not reported usage yet`;let t=ju(e),n=`${e.source}/${e.confidence}`,r=Number.isFinite(e.lastUpdatedAt)?new Date(e.lastUpdatedAt).toLocaleString():`unknown`;return t===null?`Context: unknown; ${n}; updated ${r}`:`Context: ${Math.round(t*100)}%; ${n}; updated ${r}`}function Nu(e){return e>=1e6?`${(e/1e6).toFixed(e%1e6==0?0:1)}M`:e>=1e3?`${Math.round(e/1e3)}K`:String(e)}var Pu=(0,z.lazy)(()=>R(()=>import(`./terminal-viewer-impl-Ctp4csJ3.js`).then(e=>({default:e.TerminalDialog})),__vite__mapDeps([7,1,6,8,9,10,11,12,13,14]),import.meta.url));function Fu(e){return e.open?(0,B.jsx)(z.Suspense,{fallback:null,children:(0,B.jsx)(Pu,{...e})}):null}function Iu({orchestratorId:e,session:t,lines:n=200}){let i=A(e=>e.apiCall),[a,o]=(0,z.useState)([]),[s,c]=(0,z.useState)(``),[l,u]=(0,z.useState)(!1),[d,p]=(0,z.useState)(`provider`),[m,h]=(0,z.useState)(null);async function g(){if(!l)try{o((await i(`GET`,`/orchestrators/${encodeURIComponent(e)}/logs/${encodeURIComponent(t)}?lines=${n}${d===`mirror`?`&stream=mirror`:``}`)).lines||[]),h(null)}catch(e){h($t(e))}}(0,z.useEffect)(()=>{g();let e=setInterval(()=>void g(),1500);return()=>clearInterval(e)},[e,t,l,d]);let _=s?a.filter(e=>e.toLowerCase().includes(s.toLowerCase())):a;return(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsxs)(`div`,{className:`relative min-w-48 flex-1`,children:[(0,B.jsx)(ze,{className:`absolute left-2 top-2.5 h-4 w-4 text-muted-foreground`}),(0,B.jsx)(L,{className:`pl-8`,value:s,onChange:e=>c(e.target.value),placeholder:`Search logs`})]}),(0,B.jsxs)(`div`,{className:`flex rounded-md border border-border overflow-hidden`,children:[(0,B.jsxs)(`button`,{type:`button`,onClick:()=>p(`provider`),title:`Provider output`,className:O(`flex items-center gap-1 px-2 py-1.5 text-xs`,d===`provider`?`bg-accent text-accent-foreground`:`text-muted-foreground hover:bg-accent/50`),children:[(0,B.jsx)(Me,{className:`h-3.5 w-3.5`}),` Output`]}),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>p(`mirror`),title:`Session-mirror diagnostics (clean)`,className:O(`flex items-center gap-1 px-2 py-1.5 text-xs border-l border-border`,d===`mirror`?`bg-accent text-accent-foreground`:`text-muted-foreground hover:bg-accent/50`),children:[(0,B.jsx)(r,{className:`h-3.5 w-3.5`}),` Mirror`]})]}),(0,B.jsx)(I,{type:`button`,variant:`outline`,size:`icon`,onClick:()=>u(e=>!e),title:l?`Resume logs`:`Pause logs`,children:l?(0,B.jsx)(f,{className:`h-4 w-4`}):(0,B.jsx)(v,{className:`h-4 w-4`})}),(0,B.jsx)(I,{type:`button`,variant:`outline`,size:`icon`,onClick:()=>Gt(`${t}.log`,a.join(`
|
|
16
16
|
`),`text/plain`),title:`Download logs`,children:(0,B.jsx)(se,{className:`h-4 w-4`})})]}),m&&(0,B.jsx)(`div`,{className:`text-sm text-destructive`,children:m}),(0,B.jsx)(`pre`,{className:`max-h-96 overflow-auto rounded-md border border-border bg-zinc-950 p-3 text-xs leading-5 text-zinc-100`,children:_.join(`
|
|
17
17
|
`)||`No log output`})]})}function Lu(e,t){let n=t?.meta?.busyHealth;if(!t||t.status!==`busy`||!en(n)||n.status!==`stuck-busy`)return null;let r=typeof n.activeWorkStartedAt==`number`?n.activeWorkStartedAt:0;if(!r)return null;let i=typeof n.lastProgressAt==`number`?n.lastProgressAt:r;return{kind:typeof n.kind==`string`?n.kind:`provider-turn`,thresholdMs:typeof n.thresholdMs==`number`&&n.thresholdMs>0?n.thresholdMs:0,activeWorkId:typeof n.activeWorkId==`string`?n.activeWorkId:void 0,activeWorkLabel:typeof n.activeWorkLabel==`string`?n.activeWorkLabel:void 0,activeWorkStartedAt:r,activeWorkAgeMs:Math.max(0,e-r),lastProgressAt:i,staleForMs:Math.max(0,e-i)}}var Ru={running:`bg-emerald-500/20 text-emerald-400`,starting:`bg-blue-500/20 text-blue-400`,stopping:`bg-yellow-500/20 text-yellow-400`,stopped:`bg-zinc-500/20 text-zinc-400`,backoff:`bg-red-500/20 text-red-400`};function zu({agent:e,orchestrators:t}){let r=ht(),[i,a]=(0,z.useState)(null),[o,s]=(0,z.useState)([]),[c,l]=(0,z.useState)({spawn:!0,workspace:!0,runtime:!0,profile:!0,lifecycle:!0,activity:!1}),u=typeof e.meta?.policyName==`string`?e.meta.policyName:null,d=typeof e.meta?.profile==`string`?e.meta.profile:null,f=en(e.meta?.agentProfile)?e.meta.agentProfile:null,p=Vu(f?.projection)?f.projection:null,m=t.find(t=>t.managedAgents.some(t=>t.agentId===e.id)),h=m?.managedAgents.find(t=>t.agentId===e.id);(0,z.useEffect)(()=>{if(!u)return;let e=!1;return n(`GET`,`/spawn-policies/`+encodeURIComponent(u)+`/status`).then(t=>{e||a(t)}).catch(()=>{e||a(null)}),()=>{e=!0}},[u,e.lastSeen]),(0,z.useEffect)(()=>{let t=!1;return n(`GET`,`/activity?agentId=`+encodeURIComponent(e.id)+`&limit=20`).then(e=>{t||s(e)}).catch(()=>{t||s([])}),()=>{t=!0}},[e.id,e.lastSeen]);function g(e){l(t=>({...t,[e]:!t[e]}))}function _(){let t=i?.policy,n=i?.state,r=[`# Agent Diagnostics`,`Agent: ${e.id}`,`Status: ${e.status}`,`Provider: ${e.meta?.provider||`unknown`}`,`Machine: ${e.machine||`unknown`}`];if(u&&r.push(`Policy: ${u}`),d&&r.push(`Agent Profile: ${d}`),t&&(r.push(``,`## Spawn Config`),r.push(`Provider: ${t.provider}`),t.model&&r.push(`Model: ${t.model}`),t.effort&&r.push(`Effort: ${t.effort}`),r.push(`CWD: ${t.cwd}`),r.push(`Permission: ${t.permissionMode}`),r.push(`Mode: ${t.mode}`),t.rig&&r.push(`Rig: ${t.rig}`),t.tags.length&&r.push(`Tags: ${t.tags.join(`, `)}`),t.capabilities.length&&r.push(`Caps: ${t.capabilities.join(`, `)}`)),p){r.push(``,`## Agent Profile Projection`),r.push(`Profile: ${p.profileName}`),r.push(`Provider: ${p.provider}`),r.push(`Base: ${p.base}`),p.warnings.length&&r.push(`Warnings: ${p.warnings.length}`);for(let e of p.entries)r.push(`- ${e.capability}: requested=${e.requested} result=${e.result} detail=${e.detail}`)}if(h&&(r.push(``,`## Runtime`),h.pid&&r.push(`PID: ${h.pid}`),h.sessionName&&r.push(`Session: ${h.sessionName}`),h.supervisor&&r.push(`Supervisor: ${h.supervisor}`),h.systemdUnit&&r.push(`Systemd: ${h.systemdUnit}`),h.terminalSession&&r.push(`Terminal: ${h.terminalSession} (${h.terminalAvailable?`available`:`unavailable`})`),h.tmuxSession&&h.tmuxSession!==h.sessionName&&r.push(`Legacy tmux: ${h.tmuxSession}`),h.spawnRequestId&&r.push(`Spawn Request: ${h.spawnRequestId}`),h.startedAt&&r.push(`Started: ${new Date(h.startedAt).toISOString()}`),m&&r.push(`Orchestrator: ${m.hostname} (${m.id.slice(-8)})`)),h?.workspace&&(r.push(``,`## Workspace`),r.push(`Mode: ${h.workspace.mode}`),h.workspace.status&&r.push(`Status: ${h.workspace.status}`),h.workspace.worktreePath&&r.push(`Worktree: ${h.workspace.worktreePath}`),h.workspace.repoRoot&&r.push(`Repo: ${h.workspace.repoRoot}`),h.workspace.branch&&r.push(`Branch: ${h.workspace.branch}`),h.workspace.baseRef&&r.push(`Base: ${h.workspace.baseRef}`),h.workspace.baseSha&&r.push(`Base SHA: ${h.workspace.baseSha}`),h.workspace.stewardAgentId&&r.push(`Steward: ${h.workspace.stewardAgentId}`)),n&&(r.push(``,`## Lifecycle`),r.push(`Status: ${n.status}`),r.push(`Restarts: ${n.restartCount}`),r.push(`Consecutive failures: ${n.consecutiveFailures}`),n.lastSpawnAt&&r.push(`Last spawn: ${new Date(n.lastSpawnAt).toISOString()}`),n.lastStopAt&&r.push(`Last stop: ${new Date(n.lastStopAt).toISOString()}`),n.healthySince&&r.push(`Healthy since: ${new Date(n.healthySince).toISOString()}`),n.backoffUntil&&r.push(`Backoff until: ${new Date(n.backoffUntil).toISOString()}`),n.lastError&&r.push(`Last error: ${n.lastError}`)),o.length>0){r.push(``,`## Recent Activity`);for(let e of o.slice(0,10))r.push(`- [${new Date(typeof e.createdAt==`number`?e.createdAt:Date.parse(String(e.createdAt))).toISOString()}] ${e.title}${e.body?`: `+e.body.slice(0,100):``}`)}let a=e.meta?.package;a?.name&&a?.version&&(r.push(``,`## Versions`),r.push(`Runner: ${a.name}@${a.version}`));let s=e.meta?.contracts;if(s)for(let[e,t]of Object.entries(s))r.push(`Contract ${e}: ${t}`);return r.join(`
|
|
18
18
|
`)}let v=i?.policy,y=i?.state;return(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,B.jsxs)(`h3`,{className:`text-sm font-medium flex items-center gap-1.5`,children:[(0,B.jsx)(it,{className:`w-3.5 h-3.5 text-muted-foreground`}),`Diagnostics`]}),(0,B.jsx)(Pn,{value:_,label:`Copy Bundle`,showText:!0,size:`sm`,variant:`outline`,className:`h-7 text-xs gap-1`,iconClassName:`w-3 h-3`})]}),v&&(0,B.jsx)(Bu,{title:`Spawn Config`,expanded:!!c.spawn,onToggle:()=>g(`spawn`),children:(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-3 gap-y-1 text-xs`,children:[(0,B.jsx)(X,{label:`Provider`,value:v.provider}),v.model&&(0,B.jsx)(X,{label:`Model`,value:v.model}),v.effort&&(0,B.jsx)(X,{label:`Effort`,value:v.effort}),(0,B.jsx)(X,{label:`Permission`,value:v.permissionMode}),(0,B.jsx)(X,{label:`Mode`,value:v.mode}),v.rig&&(0,B.jsx)(X,{label:`Rig`,value:v.rig}),(0,B.jsx)(X,{label:`CWD`,value:v.cwd,className:`col-span-2`,mono:!0}),v.tags.length>0&&(0,B.jsxs)(`div`,{className:`col-span-2`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Tags`}),(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-0.5`,children:v.tags.map(e=>(0,B.jsx)(F,{variant:`outline`,className:`text-[10px]`,children:e},e))})]}),v.capabilities.length>0&&(0,B.jsxs)(`div`,{className:`col-span-2`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Capabilities`}),(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-0.5`,children:v.capabilities.map(e=>(0,B.jsx)(F,{variant:`secondary`,className:`text-[10px]`,children:e},e))})]}),v.providerArgs.length>0&&(0,B.jsx)(X,{label:`Provider Args`,value:v.providerArgs.join(` `),className:`col-span-2`,mono:!0}),v.binding&&(0,B.jsx)(X,{label:`Channel`,value:`${v.binding.type}:${v.binding.channelId}`,className:`col-span-2`})]})}),(d||p)&&(0,B.jsx)(Bu,{title:`Agent Profile`,expanded:!!c.profile,onToggle:()=>g(`profile`),children:(0,B.jsxs)(`div`,{className:`space-y-2 text-xs`,children:[(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-3 gap-y-1`,children:[d&&(0,B.jsx)(X,{label:`Profile`,value:d}),p?.base&&(0,B.jsx)(X,{label:`Base`,value:p.base}),p?.provider&&(0,B.jsx)(X,{label:`Provider`,value:p.provider}),p&&(0,B.jsx)(X,{label:`Unsupported`,value:String(p.unsupported.length)})]}),p?.warnings.length?(0,B.jsxs)(`div`,{className:`rounded border border-yellow-500/20 bg-yellow-500/5 px-2 py-1.5`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Projection warnings`}),(0,B.jsx)(`div`,{className:`mt-1 space-y-1`,children:p.warnings.slice(0,4).map(e=>(0,B.jsx)(`div`,{className:`break-words text-yellow-200/80`,children:e},e))})]}):null,p&&(0,B.jsx)(`div`,{className:`space-y-1`,children:p.entries.map(e=>(0,B.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto] gap-2 rounded border border-border/60 px-2 py-1`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`div`,{className:`font-mono text-[11px]`,children:e.capability}),(0,B.jsx)(`div`,{className:`break-words text-muted-foreground`,children:e.detail})]}),(0,B.jsx)(F,{variant:e.result===`unsupported`?`destructive`:e.result===`partial`?`outline`:`secondary`,className:`h-5 text-[10px]`,children:e.result})]},e.capability))})]})}),h?.workspace&&(0,B.jsx)(Bu,{title:`Workspace`,expanded:!!c.workspace,onToggle:()=>g(`workspace`),children:(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-3 gap-y-1 text-xs`,children:[(0,B.jsx)(X,{label:`Mode`,value:h.workspace.mode}),h.workspace.status&&(0,B.jsx)(X,{label:`Status`,value:h.workspace.status}),h.workspace.worktreePath&&(0,B.jsx)(X,{label:`Worktree`,value:h.workspace.worktreePath,className:`col-span-2`,mono:!0}),h.workspace.repoRoot&&(0,B.jsx)(X,{label:`Repo`,value:h.workspace.repoRoot,className:`col-span-2`,mono:!0}),h.workspace.branch&&(0,B.jsx)(X,{label:`Branch`,value:h.workspace.branch,className:`col-span-2`,mono:!0}),h.workspace.baseRef&&(0,B.jsx)(X,{label:`Base`,value:h.workspace.baseRef}),h.workspace.baseSha&&(0,B.jsx)(X,{label:`Base SHA`,value:h.workspace.baseSha.slice(0,12),mono:!0}),h.workspace.stewardAgentId&&(0,B.jsx)(X,{label:`Steward`,value:h.workspace.stewardAgentId,className:`col-span-2`,mono:!0})]})}),h&&(0,B.jsx)(Bu,{title:`Runtime`,expanded:!!c.runtime,onToggle:()=>g(`runtime`),children:(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-3 gap-y-1 text-xs`,children:[h.pid&&(0,B.jsx)(X,{label:`PID`,value:String(h.pid),mono:!0}),h.sessionName&&(0,B.jsx)(X,{label:`Session`,value:h.sessionName,mono:!0}),h.supervisor&&(0,B.jsx)(X,{label:`Supervisor`,value:h.supervisor}),h.systemdUnit&&(0,B.jsx)(X,{label:`Systemd`,value:h.systemdUnit,mono:!0}),h.terminalSession&&(0,B.jsx)(X,{label:`Terminal`,value:`${h.terminalSession} (${h.terminalAvailable?`available`:`unavailable`})`,mono:!0}),h.tmuxSession&&h.tmuxSession!==h.sessionName&&(0,B.jsx)(X,{label:`Legacy tmux`,value:h.tmuxSession,mono:!0}),h.spawnRequestId&&(0,B.jsx)(X,{label:`Spawn ID`,value:h.spawnRequestId.slice(0,12),mono:!0}),h.startedAt&&(0,B.jsx)(X,{label:`Started`,value:It(h.startedAt)}),m&&(0,B.jsx)(X,{label:`Orchestrator`,value:`${m.hostname} (${m.id.slice(-8)})`}),m&&(0,B.jsx)(X,{label:`Orch Status`,value:m.status})]})}),y&&(0,B.jsx)(Bu,{title:`Lifecycle`,expanded:!!c.lifecycle,onToggle:()=>g(`lifecycle`),children:(0,B.jsxs)(`div`,{className:`space-y-2 text-xs`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Status`}),(0,B.jsx)(F,{className:Ru[y.status]||`bg-zinc-500/20 text-zinc-400`,children:y.status})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-3 gap-y-1`,children:[(0,B.jsx)(X,{label:`Restarts`,value:String(y.restartCount)}),(0,B.jsx)(X,{label:`Failures`,value:String(y.consecutiveFailures)}),y.lastSpawnAt&&(0,B.jsx)(X,{label:`Last spawn`,value:j(r,y.lastSpawnAt)}),y.lastStopAt&&(0,B.jsx)(X,{label:`Last stop`,value:j(r,y.lastStopAt)}),y.healthySince&&(0,B.jsx)(X,{label:`Healthy since`,value:j(r,y.healthySince)}),y.backoffUntil&&(0,B.jsx)(X,{label:`Backoff until`,value:y.backoffUntil>r?j(r,y.backoffUntil):`expired`})]}),y.lastError&&(0,B.jsxs)(`div`,{className:`rounded border border-red-500/20 bg-red-500/5 px-2 py-1.5`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Last error`}),(0,B.jsx)(`div`,{className:`mt-0.5 break-words text-red-300/80`,children:y.lastError})]})]})}),(0,B.jsx)(Bu,{title:`Activity (${o.length})`,expanded:!!c.activity,onToggle:()=>g(`activity`),children:o.length===0?(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`No recent events`}):(0,B.jsx)(`div`,{className:`space-y-1`,children:o.slice(0,15).map(e=>(0,B.jsxs)(`div`,{className:`flex items-start gap-2 text-xs`,children:[(0,B.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground tabular-nums w-14`,children:j(r,typeof e.createdAt==`number`?e.createdAt:Date.parse(String(e.createdAt)))}),(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`span`,{className:`font-medium`,children:e.title}),e.body&&(0,B.jsx)(`span`,{className:`text-muted-foreground ml-1 break-words`,children:e.body.length>80?e.body.slice(0,80)+`...`:e.body})]})]},e.id))})}),!v&&!h&&!y&&o.length===0&&(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`No managed-agent diagnostics available for this agent.`})]})}function Bu({title:e,expanded:t,onToggle:n,children:r}){return(0,B.jsxs)(`div`,{className:`rounded-md border border-border`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium hover:bg-muted/50`,onClick:n,children:[t?(0,B.jsx)(ct,{className:`w-3 h-3`}):(0,B.jsx)(lt,{className:`w-3 h-3`}),e]}),t&&(0,B.jsx)(`div`,{className:`px-2.5 pb-2.5`,children:r})]})}function Vu(e){return en(e)&&typeof e.profileName==`string`&&typeof e.provider==`string`&&typeof e.base==`string`&&Array.isArray(e.entries)&&Array.isArray(e.warnings)&&Array.isArray(e.unsupported)}function X({label:e,value:t,className:n=``,mono:r=!1}){return(0,B.jsxs)(`div`,{className:`min-w-0 ${n}`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:e}),(0,B.jsx)(`div`,{className:`truncate ${r?`font-mono`:``}`,title:t,children:t})]})}function Hu({agent:e,className:t=``,onNavigate:n}){let r=typeof e.meta?.cwd==`string`?e.meta.cwd:``,i=A(e=>r?e.projectByCwd[r]:null),a=A(e=>e.fetchProjectForCwd),o=A(e=>e.openProjectFocus);return(0,z.useEffect)(()=>{r&&a(r)},[r,a]),i?(0,B.jsxs)(`button`,{type:`button`,title:`Project: ${i.title||i.slug} — open in Projects`,onClick:e=>{e.stopPropagation(),n?.(),o(i.id)},className:`inline-flex h-5 max-w-full items-center gap-1 rounded-full border border-indigo-500/30 bg-indigo-500/10 px-1.5 text-[10px] font-medium text-indigo-300 transition-colors hover:bg-indigo-500/20 ${t}`,children:[(0,B.jsx)(C,{className:`h-3 w-3 shrink-0`}),(0,B.jsx)(`span`,{className:`truncate`,children:i.title||i.slug})]}):null}function Uu({className:e}){return(0,B.jsx)(`svg`,{viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,className:e,children:(0,B.jsx)(`path`,{d:`M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82a7.65 7.65 0 0 1 2-.27c.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8Z`})})}var Wu={github:Uu},Gu=Je;function Ku({provider:e,className:t}){return(0,B.jsx)(Wu[e]??Gu,{className:O(`shrink-0`,t)})}var qu={open:`border-emerald-500/25 bg-emerald-500/10 text-emerald-300`,closed:`border-zinc-500/25 bg-zinc-500/10 text-zinc-300`,unknown:`border-amber-500/25 bg-amber-500/10 text-amber-300`},Ju=1440*60*1e3;function Yu(e){return`${e.repo}#${e.externalKey}`}function Xu(e,t){return e.statusSyncedAt?`Status synced ${j(t,e.statusSyncedAt)} (${It(e.statusSyncedAt)})`:`Status not yet synced`}function Zu({issueRef:e,now:t=Date.now(),compact:n=!1,showSync:r=!1,className:i}){let a=Yu(e),o=!e.statusSyncedAt||t-e.statusSyncedAt>Ju,s=[e.title?`${a}: ${e.title}`:a,`Status: ${e.status}`,Xu(e,t)].join(`
|
|
19
19
|
`);return(0,B.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,title:s,"aria-label":`Open ${a}`,onClick:e=>e.stopPropagation(),className:O(`inline-flex h-5 max-w-full items-center gap-1.5 rounded-full border pl-1.5 pr-2 text-[10px] font-medium leading-none transition-colors hover:brightness-125 focus:outline-none focus-visible:ring-1 focus-visible:ring-current`,qu[e.status],i),children:[(0,B.jsx)(Ku,{provider:e.provider,className:`h-3 w-3 opacity-90`}),(0,B.jsx)(`span`,{className:`truncate font-mono tracking-tight`,children:a}),!n&&(0,B.jsx)(`span`,{className:`shrink-0 opacity-70`,children:e.status}),r&&!n&&(0,B.jsxs)(`span`,{className:O(`shrink-0 tabular-nums`,o?`opacity-45`:`opacity-65`),children:[(0,B.jsx)(`span`,{"aria-hidden":!0,className:`mr-1 opacity-60`,children:`·`}),e.statusSyncedAt?j(t,e.statusSyncedAt):`unsynced`]}),(0,B.jsx)(_,{className:`ml-0.5 h-2.5 w-2.5 shrink-0 opacity-60`})]})}var Qu={read:`read`,edit:`edited`,done:`completed`},$u={done:`border-emerald-500/30 bg-emerald-500/10 text-emerald-300`},ed=[];function td(e){let t=new Map;for(let n of e){let e=t.get(n.issueRef.id),r={action:n.action,count:n.count,firstAt:n.firstAt,lastAt:n.lastAt};e?(e.actions.push(r),e.lastAt=Math.max(e.lastAt,n.lastAt)):t.set(n.issueRef.id,{issueRef:n.issueRef,actions:[r],lastAt:n.lastAt})}return[...t.values()].sort((e,t)=>t.lastAt-e.lastAt||e.issueRef.id.localeCompare(t.issueRef.id))}function nd({agentId:e,now:t}){let n=A(e=>e.fetchAgentIssueActivity),r=A(t=>t.issueActivityByAgent[e]??ed),i=A(e=>e.issueRefsById),a=A(t=>!!t.issueLoading[`agent:${e}`]),o=A(t=>t.issueErrors[`agent:${e}`]??null),s=(0,z.useMemo)(()=>td(r.map(e=>({...e,issueRef:i[e.issueRef.id]??e.issueRef}))),[r,i]);return(0,z.useEffect)(()=>{n(e)},[e,n]),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(nl,{}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium`,children:`Issues`}),a?(0,B.jsx)(F,{variant:`secondary`,className:`text-[10px]`,children:`loading`}):(0,B.jsx)(F,{variant:`secondary`,className:`text-[10px]`,children:s.length})]}),o?(0,B.jsx)(`div`,{className:`text-xs text-destructive`,children:o}):s.length===0?(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`No issue activity recorded for this agent.`}):(0,B.jsx)(`div`,{className:`space-y-2`,children:s.map(e=>(0,B.jsxs)(`div`,{className:`rounded-md border border-border px-2.5 py-2 text-xs`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-2`,children:[(0,B.jsx)(Zu,{issueRef:e.issueRef,now:t}),(0,B.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground`,title:It(e.lastAt),children:j(t,e.lastAt)})]}),(0,B.jsx)(`div`,{className:`mt-1.5 flex flex-wrap gap-1`,children:e.actions.map(e=>(0,B.jsxs)(F,{variant:`outline`,className:O(`text-[10px]`,$u[e.action]),title:`${e.count} event${e.count===1?``:`s`} since ${It(e.firstAt)}`,children:[Qu[e.action],e.count>1?` ${e.count}`:``]},e.action))})]},e.issueRef.id))})]})]})}function rd(e){let t=e?.meta?.tmuxSession;return typeof t==`string`&&t.trim()?t:null}function id(e,t,n){return e?n.find(n=>n.managedAgents.some(n=>n.agentId===e.id||n.tmuxSession===t))??null:null}function ad({agent:e,health:t,showLogs:n,setTab:r,openConfirm:i,doAgentAction:a}){let o=Mt(e,`interrupt`),s=Mt(e,`restart`),c=Mt(e,`shutdown`),l=t.activeWorkLabel||t.kind;return(0,B.jsxs)(`div`,{className:`shrink-0 mx-4 mt-3 rounded-md border border-red-500/35 bg-red-500/10 px-3 py-2 text-xs text-red-100`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,B.jsx)(He,{className:`w-3.5 h-3.5`}),`Stuck busy`]}),(0,B.jsxs)(`div`,{className:`mt-1 text-red-50/85`,children:[`No provider progress for `,Math.max(1,Math.floor(t.staleForMs/6e4)),` min while `,l,` is active.`]}),(0,B.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[o&&(0,B.jsxs)(I,{size:`sm`,variant:`outline`,className:`h-7 text-xs`,onClick:()=>a(e,`interrupt`,`agent-detail-drawer`),children:[(0,B.jsx)(nt,{className:`w-3 h-3 mr-1`}),`Interrupt`]}),s&&(0,B.jsxs)(I,{size:`sm`,variant:`outline`,className:`h-7 text-xs`,onClick:()=>i(`Restart Agent`,`Restart ${M(e)}?`,()=>a(e,`restart`,`agent-detail-drawer`)),children:[(0,B.jsx)(S,{className:`w-3 h-3 mr-1`}),`Restart`]}),c&&(0,B.jsxs)(I,{size:`sm`,variant:`outline`,className:`h-7 text-xs`,onClick:()=>i(`Shutdown Agent`,`Shutdown ${M(e)}?`,()=>a(e,`shutdown`,`agent-detail-drawer`)),children:[(0,B.jsx)(T,{className:`w-3 h-3 mr-1`}),`Shutdown`]}),(0,B.jsxs)(I,{size:`sm`,variant:`outline`,className:`h-7 text-xs`,onClick:()=>r(n?`logs`:`timeline`),children:[(0,B.jsx)(me,{className:`w-3 h-3 mr-1`}),`Diagnostics`]})]})]})}var od=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function sd(e){return!e||e.status!==`offline`&&e.status!==`stale`?!1:(typeof e.meta?.provider==`string`?e.meta.provider:e.providerCapabilities?.model?.provider)===`claude`}function cd(e){for(let t of e){let e=t.metadata,n=typeof e?.provider==`string`?e.provider:``,r=typeof e?.claudeResumeId==`string`?e.claudeResumeId:``;if(n===`claude`&&od.test(r))return{resumeId:r,timestamp:t.ts}}return null}function ld(e,t){return!!e.spawnedBy&&e.status!==`offline`&&!Zt(t,e)}function ud(e,t){let n=new Map;for(let r of e){if(!r.spawnedBy||!ld(r,t))continue;let e=n.get(r.spawnedBy);e?e.push(r):n.set(r.spawnedBy,[r])}return n}function dd(e,t,n){let r=new Set(e.map(e=>e.id)),i=ud(e,n),a=[],o=new Set;for(let s of e){if(o.has(s.id)||s.spawnedBy&&!ld(s,n))continue;let e=!!(s.spawnedBy&&r.has(s.spawnedBy));if(ld(s,n)&&e)continue;let c=i.get(s.id)??[];a.push({agent:s,depth:0,parent:s.spawnedBy?t[s.spawnedBy]??null:null,children:c}),o.add(s.id);for(let e of c)o.has(e.id)||(a.push({agent:e,depth:1,parent:s,children:[]}),o.add(e.id))}return a}function fd(e,t){let n=new Set(e.map(e=>e.id));return e.filter(e=>e.spawnedBy&&!ld(e,t)?!1:!ld(e,t)||!e.spawnedBy||!n.has(e.spawnedBy))}function pd(e){return[...e].sort((e,t)=>M(e).localeCompare(M(t)))}function md(){let e=A(e=>e.agentDetailOpen),t=A(e=>e.agentDetailId),r=A(e=>e.agentsById),i=A(e=>e.messages),a=A(e=>e.orchestrators),o=A(e=>e.fetchOrchestrators),s=ht(),c=A(e=>e.set),l=A(e=>e.closeAgentDetail),u=A(e=>e.openAgentDetail),f=A(e=>e.openComposeToAgent),m=A(e=>e.openInboxThread),h=A(e=>e.openRename),g=A(e=>e.openPairInvite),_=A(e=>e.switchView),v=A(e=>e.openConfirm),y=A(e=>e.showError),b=A(e=>e.showNotification),x=A(e=>e.doAgentAction),C=A(e=>e.doDeleteAgent),ee=A(e=>e.openFilesForAgent),[ne,re]=(0,z.useState)([]),[w,ie]=(0,z.useState)(null),[oe,se]=(0,z.useState)(null),[E,ce]=(0,z.useState)(`overview`),[le,ue]=(0,z.useState)(!1),[de,D]=(0,z.useState)(null),[pe,he]=(0,z.useState)(!1),[O,_e]=(0,z.useState)(null),ve=A(e=>e.livenessMismatches),xe=A(e=>e.commandStalls),k=r[t]||null,Se=Vc(),Ce=k?Se[k.id]??null:null,we=(0,z.useMemo)(()=>Object.values(r),[r]),Te=(0,z.useMemo)(()=>t?i.filter(e=>e.from===t||e.to===t).sort((e,t)=>t.id-e.id).slice(0,8):[],[i,t]);(0,z.useEffect)(()=>{if(!e||!k?.context){re([]);return}let t=!1;return n(`GET`,`/agents/`+encodeURIComponent(k.id)+`/context-snapshots?limit=24`).then(e=>{t||re(e)}).catch(()=>{t||re([])}),()=>{t=!0}},[e,k?.id,k?.context?.lastUpdatedAt]),(0,z.useEffect)(()=>{if(_e(null),!e||!k||!sd(k))return;let t=!1;return n(`GET`,`/agents/`+encodeURIComponent(k.id)+`/timeline?limit=50`).then(e=>{t||_e(cd(e))}).catch(()=>{t||_e(null)}),()=>{t=!0}},[e,k?.id,k?.status,k?.meta?.provider]),(0,z.useEffect)(()=>{if(!e||!k){ie(null);return}let t=!1;return n(`GET`,`/agents/`+encodeURIComponent(k.id)+`/active-memories`).then(e=>{t||ie(e)}).catch(()=>{t||ie(null)}),()=>{t=!0}},[e,k?.id]),(0,z.useEffect)(()=>{if(!e||!k){se(null);return}let t=!1;return n(`GET`,`/agents/`+encodeURIComponent(k.id)+`/crash-report`).then(e=>{t||se(e.report)}).catch(()=>{t||se(null)}),()=>{t=!0}},[e,k?.id]),(0,z.useEffect)(()=>{ce(`overview`),ue(!1),D(null)},[t]),(0,z.useEffect)(()=>{e&&k?.meta?.tmuxSession&&a.length===0&&o()},[e,k?.id,k?.meta?.tmuxSession,a.length]);async function Ee(){if(k)try{if(!(await n(`DELETE`,`/agents/`+encodeURIComponent(k.id)+`/active-memories`)).supported){y(`Memory Clear Unavailable`,`The active memory broker does not support clearing active memories.`);return}ie({agentId:k.id,supported:!0,memories:[],total:0}),b(`Active memories cleared`)}catch(e){y(`Memory Clear Failed`,e.message)}}async function De(){if(!(!k||pe)){he(!0);try{D(await n(`POST`,`/agents/`+encodeURIComponent(k.id)+`/terminal-session`)),ue(!0)}catch(e){y(`Terminal Failed`,e.message)}finally{he(!1)}}}async function Oe(e){if(e){ue(!0);return}ue(!1);let t=de;if(D(null),k&&t?.mode===`guest`)try{await n(`DELETE`,`/agents/`+encodeURIComponent(k.id)+`/terminal-session/`+encodeURIComponent(t.session))}catch{}}if(!k)return(0,B.jsx)(Ql,{open:e,onOpenChange:e=>!e&&l(),children:(0,B.jsx)(tu,{className:`w-full max-w-[100dvw] sm:max-w-md lg:max-w-lg`,children:(0,B.jsx)(nu,{children:(0,B.jsx)(ru,{children:`Agent`})})})});let ke=Lt(s,k,Vt(),Ce),je=Mt(k,`restart`),Pe=Mt(k,`shutdown`),Fe=Mt(k,`reconnect`),Ie=Mt(k,`compact`),Le=Mt(k,`clearContext`),ze=!!(O&&sd(k)),Be=Ht(k),We=Sd(k.meta?.package),Ge=Cd(k.meta?.contracts),Ke=k.providerCapabilities,qe=yt(k),Je=Au(k),Ye=Jt(k),Xe=rd(k),Ze=Xe?id(k,Xe,a):null,Qe=!!(Xe&&Ze?.status===`online`&&k.providerCapabilities?.terminal?.live?.read),$e=k.providerCapabilities?.model?.provider??(typeof k.meta?.provider==`string`?k.meta.provider:void 0),tt=!!(Qe&&(k.providerCapabilities?.terminal?.live?.write||$e===`claude`)),nt=k.providerCapabilities?.terminal?.attach?.create===!0,rt=Qe||nt,it=Ed(k.meta?.lastExit),at=typeof k.meta?.lastError==`string`?k.meta.lastError:it?.lastError,ot=k.spawnedBy?r[k.spawnedBy]??null:null,st=pd(ud(we,s).get(k.id)??[]),ct=ve[k.id]??null,lt=(ke.tone===`offline`||ke.tone===`stale`)&&Qe,ut=!!ct||lt,dt=xe[k.id]??null,ft=Lu(s,k);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Ql,{open:e,onOpenChange:e=>!e&&l(),children:(0,B.jsxs)(tu,{className:`w-full max-w-[100dvw] sm:max-w-md lg:max-w-lg p-0`,children:[(0,B.jsxs)(nu,{className:`shrink-0 p-4 border-b border-border`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,B.jsx)(lu,{agent:k,now:s}),(0,B.jsx)(_u,{agent:k}),(0,B.jsx)(ru,{className:`text-base truncate`,children:M(k)}),Du(k)&&(0,B.jsx)(ku,{context:k.context,expected:!0})]}),(0,B.jsx)(yu,{agent:k,className:`mt-2`})]}),(0,B.jsxs)(`div`,{className:`shrink-0 flex flex-wrap items-center gap-2 p-4 border-b border-border`,children:[(0,B.jsxs)(I,{size:`sm`,variant:`outline`,onClick:()=>{f(k),l()},children:[(0,B.jsx)(te,{className:`w-3 h-3 mr-1`}),`Message`]}),(0,B.jsxs)(I,{size:`sm`,variant:`outline`,onClick:()=>{m(k.id),_(`chat`),l()},children:[(0,B.jsx)(et,{className:`w-3 h-3 mr-1`}),`Chat`]}),(0,B.jsxs)(I,{size:`sm`,variant:`outline`,onClick:()=>{g(k.id),l()},children:[(0,B.jsx)(Ue,{className:`w-3 h-3 mr-1`}),`Pair`]}),rt&&(0,B.jsx)(I,{size:`sm`,variant:`outline`,className:`hidden sm:inline-flex px-2`,disabled:pe,title:nt?`Open guest terminal`:`Open live terminal`,onClick:()=>void De(),children:(0,B.jsx)(Me,{className:`w-3.5 h-3.5`})}),ze&&(0,B.jsx)(I,{size:`sm`,variant:`outline`,className:`hidden sm:inline-flex px-2`,title:`Resume Claude session`,onClick:()=>v(`Resume Claude Session`,`Resume ${M(k)} from Claude session ${O?.resumeId}? This can reload a large prior context and consume tokens.`,()=>x(k,`resume`,`agent-detail-drawer`)),children:(0,B.jsx)(Ae,{className:`w-3.5 h-3.5`})}),Ie&&(0,B.jsx)(I,{size:`sm`,variant:`outline`,className:`hidden sm:inline-flex px-2`,title:`Compact context`,onClick:()=>v(`Compact Agent`,`Compact context for ${M(k)}?`,()=>x(k,`compact`,`agent-detail-drawer`)),children:(0,B.jsx)(ae,{className:`w-3.5 h-3.5`})}),je&&(0,B.jsx)(I,{size:`sm`,variant:`outline`,className:`hidden sm:inline-flex px-2`,title:`Restart`,onClick:()=>v(`Restart Agent`,`Restart ${M(k)}?`,()=>x(k,`restart`,`agent-detail-drawer`)),children:(0,B.jsx)(S,{className:`w-3.5 h-3.5`})}),Pe&&(0,B.jsx)(I,{size:`sm`,variant:`outline`,className:`hidden sm:inline-flex px-2`,title:`Shutdown`,onClick:()=>v(`Shutdown Agent`,`Shutdown ${M(k)}?`,()=>x(k,`shutdown`,`agent-detail-drawer`)),children:(0,B.jsx)(T,{className:`w-3.5 h-3.5`})}),(0,B.jsxs)(rl,{children:[(0,B.jsx)(il,{asChild:!0,children:(0,B.jsx)(I,{size:`sm`,variant:`outline`,className:`px-2`,children:(0,B.jsx)(ge,{className:`w-3.5 h-3.5`})})}),(0,B.jsxs)(al,{align:`end`,children:[rt&&(0,B.jsxs)(ol,{className:`sm:hidden`,disabled:pe,onClick:()=>void De(),children:[(0,B.jsx)(Me,{className:`w-3.5 h-3.5`}),`Terminal`]}),ze&&(0,B.jsxs)(ol,{className:`sm:hidden`,onClick:()=>v(`Resume Claude Session`,`Resume ${M(k)} from Claude session ${O?.resumeId}? This can reload a large prior context and consume tokens.`,()=>x(k,`resume`,`agent-detail-drawer`)),children:[(0,B.jsx)(Ae,{className:`w-3.5 h-3.5`}),`Resume`]}),Ie&&(0,B.jsxs)(ol,{className:`sm:hidden`,onClick:()=>v(`Compact Agent`,`Compact context for ${M(k)}?`,()=>x(k,`compact`,`agent-detail-drawer`)),children:[(0,B.jsx)(ae,{className:`w-3.5 h-3.5`}),`Compact`]}),je&&(0,B.jsxs)(ol,{className:`sm:hidden`,onClick:()=>v(`Restart Agent`,`Restart ${M(k)}?`,()=>x(k,`restart`,`agent-detail-drawer`)),children:[(0,B.jsx)(S,{className:`w-3.5 h-3.5`}),`Restart`]}),Pe&&(0,B.jsxs)(ol,{className:`sm:hidden`,onClick:()=>v(`Shutdown Agent`,`Shutdown ${M(k)}?`,()=>x(k,`shutdown`,`agent-detail-drawer`)),children:[(0,B.jsx)(T,{className:`w-3.5 h-3.5`}),`Shutdown`]}),(rt||ze||Ie||je||Pe)&&(0,B.jsx)(cl,{className:`sm:hidden`}),(0,B.jsxs)(ol,{onClick:()=>h(k),children:[(0,B.jsx)(d,{className:`w-3.5 h-3.5`}),`Rename`]}),Fe&&(0,B.jsxs)(ol,{onClick:()=>v(`Reconnect Agent`,`Reconnect ${M(k)}?`,()=>x(k,`reconnect`,`agent-detail-drawer`)),children:[(0,B.jsx)(p,{className:`w-3.5 h-3.5`}),`Reconnect`]}),Le&&(0,B.jsxs)(ol,{onClick:()=>v(`Clear Context`,`Clear context for ${M(k)}?`,()=>x(k,`clearContext`,`agent-detail-drawer`)),children:[(0,B.jsx)(ye,{className:`w-3.5 h-3.5`}),`Clear Context`]}),Be&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(cl,{}),(0,B.jsxs)(ol,{variant:`destructive`,onClick:()=>v(`Forget Agent`,`Forget ${M(k)}?`,()=>C(k.id)),children:[(0,B.jsx)(Ne,{className:`w-3.5 h-3.5`}),`Forget`]})]})]})]})]}),ut&&(0,B.jsxs)(`div`,{className:`shrink-0 mx-4 mt-3 rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-100`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,B.jsx)(He,{className:`w-3.5 h-3.5`}),`Liveness mismatch`]}),(0,B.jsx)(`div`,{className:`mt-1 text-amber-50/85`,children:ct?.detail??`Relay marks this agent offline, but a live terminal session is still reachable — the process may still be running.`}),rt&&(0,B.jsxs)(I,{size:`sm`,variant:`outline`,className:`mt-2 h-7 text-xs`,disabled:pe,onClick:()=>void De(),children:[(0,B.jsx)(Me,{className:`w-3 h-3 mr-1`}),`Open terminal`]})]}),dt&&(0,B.jsxs)(`div`,{className:`shrink-0 mx-4 mt-3 rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-100`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,B.jsx)(He,{className:`w-3.5 h-3.5`}),dt.kind===`clear`?`Context clear stalled`:`Compaction stalled`]}),(0,B.jsx)(`div`,{className:`mt-1 text-amber-50/85`,children:dt.detail}),rt&&(0,B.jsxs)(I,{size:`sm`,variant:`outline`,className:`mt-2 h-7 text-xs`,disabled:pe,onClick:()=>void De(),children:[(0,B.jsx)(Me,{className:`w-3 h-3 mr-1`}),`Open terminal`]})]}),ft&&(0,B.jsx)(ad,{agent:k,health:ft,showLogs:!!Xe,setTab:ce,openConfirm:v,doAgentAction:x}),(0,B.jsxs)(iu,{value:E,onValueChange:e=>ce(e),className:`flex-1 min-h-0 gap-0`,children:[(0,B.jsxs)(ou,{variant:`line`,className:`w-full shrink-0 px-4 pt-2`,children:[(0,B.jsx)(su,{value:`overview`,children:`Overview`}),(0,B.jsxs)(su,{value:`timeline`,children:[(0,B.jsx)(fe,{className:`w-3.5 h-3.5`}),`Timeline`]}),(0,B.jsxs)(su,{value:`logs`,children:[(0,B.jsx)(me,{className:`w-3.5 h-3.5`}),`Logs`]})]}),(0,B.jsx)(cu,{value:`overview`,className:`min-h-0 overflow-y-auto overflow-x-hidden`,children:(0,B.jsxs)(`div`,{className:`p-4 space-y-4 min-w-0`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium mb-2`,children:`Status`}),(0,B.jsxs)(`div`,{className:`space-y-1 text-sm min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex justify-between gap-2 min-w-0`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground shrink-0`,children:`State`}),(0,B.jsx)(F,{className:wt(ke.tone),children:ke.label})]}),qe?.recommendedAction&&(0,B.jsxs)(`div`,{className:`rounded-md border border-red-500/20 bg-red-500/10 px-2.5 py-2 text-xs text-red-200`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,B.jsx)(be,{className:`w-3.5 h-3.5`}),`Recommended action`]}),(0,B.jsx)(`div`,{className:`mt-1 text-red-100/80`,children:qe.recommendedAction})]}),at&&(0,B.jsxs)(`div`,{className:`rounded-md border border-amber-500/25 bg-amber-500/10 px-2.5 py-2 text-xs text-amber-100`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,B.jsx)(be,{className:`w-3.5 h-3.5`}),`Last launch error`]}),(0,B.jsx)(`div`,{className:`mt-1 break-words text-amber-50/85`,children:at}),it&&(0,B.jsxs)(`div`,{className:`mt-2 grid grid-cols-2 gap-x-3 gap-y-1 text-amber-50/70`,children:[it.detectedAt&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-amber-100/55`,children:`Detected`}),(0,B.jsx)(`div`,{children:j(s,it.detectedAt)})]}),typeof it.runtimeMs==`number`&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-amber-100/55`,children:`Runtime`}),(0,B.jsxs)(`div`,{children:[Math.max(0,Math.round(it.runtimeMs/1e3)),`s`]})]}),it.systemd?.unit&&(0,B.jsxs)(`div`,{className:`col-span-2 min-w-0`,children:[(0,B.jsx)(`span`,{className:`text-amber-100/55`,children:`Unit`}),(0,B.jsx)(`div`,{className:`truncate font-mono`,children:it.systemd.unit})]}),it.systemd&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-amber-100/55`,children:`Systemd`}),(0,B.jsx)(`div`,{children:[it.systemd.activeState,it.systemd.subState].filter(Boolean).join(`/`)||`unknown`})]}),it.systemd?.result&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-amber-100/55`,children:`Result`}),(0,B.jsx)(`div`,{children:it.systemd.result})]}),it.logFile&&(0,B.jsxs)(`div`,{className:`col-span-2 min-w-0`,children:[(0,B.jsx)(`span`,{className:`text-amber-100/55`,children:`Log`}),(0,B.jsxs)(`div`,{className:`truncate font-mono`,children:[it.logFile,` (`,it.logBytes??`unknown`,` bytes`,it.logEmpty?`, empty`:``,`)`]})]})]}),it?.logTail?.length?(0,B.jsx)(`pre`,{className:`mt-2 max-h-28 overflow-auto whitespace-pre-wrap break-words rounded border border-amber-500/15 bg-black/20 p-2 text-[11px] text-amber-50/75`,children:it.logTail.slice(-5).join(`
|
|
20
20
|
`)}):null,it?.unavailable?.length?(0,B.jsx)(`div`,{className:`mt-1 text-amber-50/55`,children:it.unavailable.join(`; `)}):null]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-3 gap-y-1 pt-0.5 text-xs`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Last seen`}),(0,B.jsx)(`div`,{children:j(s,k.lastSeen)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Created`}),(0,B.jsx)(`div`,{title:It(k.createdAt),children:j(s,k.createdAt)})]})]})]})]}),oe&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(nl,{}),(0,B.jsx)(Td,{report:oe,now:s})]}),k.context&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(nl,{}),(0,B.jsx)(vd,{context:k.context,tokens:Je,history:ne,now:s})]}),(0,B.jsx)(nd,{agentId:k.id,now:s}),(k.spawnedBy||st.length>0||Ce)&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(nl,{}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium mb-2`,children:`Relationships`}),(0,B.jsxs)(`div`,{className:`space-y-2`,children:[k.spawnedBy&&(0,B.jsxs)(`div`,{className:`rounded-md border border-border p-2 text-xs`,children:[(0,B.jsx)(`div`,{className:`mb-1 text-muted-foreground`,children:`Spawned by`}),(0,B.jsx)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded px-1 py-1 text-left hover:bg-muted/50 disabled:pointer-events-none disabled:opacity-60`,disabled:!ot,onClick:()=>ot&&u(ot),children:ot?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(lu,{agent:ot,now:s}),(0,B.jsx)(_u,{agent:ot}),(0,B.jsx)(`span`,{className:`truncate font-medium`,children:M(ot)})]}):(0,B.jsx)(`span`,{className:`truncate font-mono`,children:k.spawnedBy})})]}),st.length>0&&(0,B.jsxs)(`div`,{className:`rounded-md border border-border p-2 text-xs`,children:[(0,B.jsxs)(`div`,{className:`mb-1 flex items-center justify-between gap-2`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Children`}),(0,B.jsx)(F,{variant:`secondary`,className:`h-4 px-1.5 text-[9px]`,children:st.length})]}),(0,B.jsx)(`div`,{className:`space-y-1`,children:st.map(e=>(0,B.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded px-1 py-1 text-left hover:bg-muted/50`,onClick:()=>u(e),children:[(0,B.jsx)(lu,{agent:e,now:s}),(0,B.jsx)(_u,{agent:e}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:M(e)}),(0,B.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.status})]},e.id))})]}),k.spawnedBy&&st.length===0&&(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-muted-foreground`,children:[(0,B.jsx)(Ve,{className:`h-3.5 w-3.5`}),`No live child agents`]}),Ce&&(0,B.jsxs)(`div`,{className:`rounded-md border border-border p-2 text-xs`,children:[(0,B.jsxs)(`div`,{className:`mb-1 flex items-center justify-between gap-2`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Pair`}),(0,B.jsx)(F,{className:Ce.status===`active`?`bg-emerald-500/20 text-emerald-400`:`bg-yellow-500/20 text-yellow-400`,children:Ce.status})]}),Ce.objective&&(0,B.jsx)(`p`,{className:`text-muted-foreground`,children:Ce.objective})]})]})]})]}),(Ke||Ye.length>0)&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(nl,{}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium mb-2`,children:`Runtime`}),(0,B.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[qe&&(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-3 gap-y-1`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Provider state`}),(0,B.jsx)(`div`,{children:qe.state})]}),qe.reason&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Reason`}),(0,B.jsx)(`div`,{children:qe.reason})]}),qe.source&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Source`}),(0,B.jsx)(`div`,{children:qe.source})]}),qe.updatedAt&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Updated`}),(0,B.jsx)(`div`,{children:j(s,qe.updatedAt)})]})]}),Ke?.model&&(0,B.jsxs)(`div`,{className:`space-y-1`,children:[Ke.model.provider&&(0,B.jsxs)(`div`,{className:`flex justify-between gap-2 min-w-0`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground shrink-0`,children:`Provider`}),(0,B.jsx)(`span`,{className:`truncate`,children:Ke.model.provider})]}),(Ke.model.alias||Ke.model.id)&&(0,B.jsxs)(`div`,{className:`flex justify-between gap-2 min-w-0`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground shrink-0`,children:`Model`}),(0,B.jsx)(`span`,{className:`truncate`,children:Ke.model.alias||Ke.model.id})]}),Ke.model.effort&&(0,B.jsxs)(`div`,{className:`flex justify-between gap-2 min-w-0`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground shrink-0`,children:`Effort`}),(0,B.jsx)(`span`,{className:`truncate`,children:Ke.model.effort})]})]}),Ke?.session&&(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-3 gap-y-1`,children:[Ke.session.approvalMode&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Mode`}),(0,B.jsx)(`div`,{children:Ke.session.approvalMode})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Files`}),(0,B.jsx)(`div`,{children:Ke.session.fileWrite?`read/write`:Ke.session.fileRead?`read-only`:`none`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Shell`}),(0,B.jsx)(`div`,{children:Ke.session.shell?`yes`:`no`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Confidence`}),(0,B.jsx)(`div`,{children:Ke.confidence})]})]}),Ke?.lifecycle&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Lifecycle`}),(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-1 mt-1`,children:[(0,B.jsx)(F,{variant:Ke.lifecycle.managed?`secondary`:`outline`,className:`text-[10px]`,children:Ke.lifecycle.managed?`managed`:`bridge`}),Ke.lifecycle.shutdownHard&&(0,B.jsx)(F,{variant:`outline`,className:`text-[10px]`,children:`shutdown`}),Ke.lifecycle.restartHard&&(0,B.jsx)(F,{variant:`outline`,className:`text-[10px]`,children:`restart`}),Ke.lifecycle.reconnect&&(0,B.jsx)(F,{variant:`outline`,className:`text-[10px]`,children:`reconnect`})]})]}),Ye.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Subagents`}),(0,B.jsx)(`div`,{className:`space-y-1 mt-1`,children:Ye.map(e=>(0,B.jsxs)(`div`,{className:`flex justify-between gap-2 text-xs rounded border border-border px-2 py-1`,children:[(0,B.jsx)(`span`,{className:`truncate`,children:e.label}),e.role&&(0,B.jsx)(`span`,{className:`text-muted-foreground shrink-0`,children:e.role})]},e.id))})]})]})]})]}),w&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(nl,{}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mb-2`,children:[(0,B.jsxs)(`h3`,{className:`text-sm font-medium flex items-center gap-1.5`,children:[(0,B.jsx)(Re,{className:`w-3.5 h-3.5 text-muted-foreground`}),`Memory`]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[w.supported&&(0,B.jsx)(F,{variant:`secondary`,className:`text-[10px]`,children:w.memories.length}),w.supported&&w.memories.length>0&&(0,B.jsxs)(I,{size:`sm`,variant:`outline`,className:`h-7 text-xs gap-1`,onClick:()=>v(`Clear Active Memories`,`Clear active memories for ${M(k)}?`,Ee),children:[(0,B.jsx)(ye,{className:`w-3 h-3`}),`Clear`]})]})]}),w.supported?w.memories.length===0?(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`No active memories`}):(0,B.jsx)(`div`,{className:`space-y-2`,children:w.memories.map(e=>(0,B.jsx)(hd,{memory:e,now:s,onOpen:()=>{c({selectedMemoryId:e.id}),_(`memory`),l()}},e.id))}):(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Active memory list unavailable`})]})]}),k.meta?.runnerManaged===!0&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(nl,{}),(0,B.jsx)(zu,{agent:k,orchestrators:a})]}),(0,B.jsx)(nl,{}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium mb-2`,children:`Identity`}),(0,B.jsxs)(`div`,{className:`space-y-2.5 text-sm min-w-0`,children:[(0,B.jsx)(_d,{label:`Agent ID`,value:k.id,copyLabel:`Copy agent ID`}),typeof k.meta?.cwd==`string`&&k.meta.cwd&&(0,B.jsx)(_d,{label:`Working dir`,value:k.meta.cwd,copyLabel:`Copy working dir`,title:`Open ${k.meta.cwd} in Files`,onClick:()=>{l(),ee(k)}}),(0,B.jsx)(Hu,{agent:k,onNavigate:l}),(k.machine||k.rig||We)&&(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-3 gap-y-1.5 text-xs`,children:[k.machine&&(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Machine`}),(0,B.jsx)(`div`,{className:`truncate`,title:k.machine,children:k.machine})]}),k.rig&&(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Rig`}),(0,B.jsx)(`div`,{className:`truncate`,title:k.rig,children:k.rig})]}),We&&(0,B.jsxs)(`div`,{className:`col-span-2 min-w-0`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Package`}),(0,B.jsxs)(`div`,{className:`break-all font-mono`,children:[We.name,` v`,We.version]})]})]}),Ge.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`Contracts`}),(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-1`,children:Ge.map(([e,t])=>(0,B.jsxs)(F,{variant:`secondary`,className:`text-[10px]`,children:[e,`=`,t]},e))})]}),k.tags.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`Tags`}),(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-1`,children:k.tags.map(e=>(0,B.jsx)(F,{variant:`outline`,className:`text-[10px]`,children:e},e))})]}),jt(k.capabilities).length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`Capabilities`}),(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-1`,children:jt(k.capabilities).map(e=>(0,B.jsx)(F,{variant:`secondary`,className:`text-[10px]`,children:e},e))})]})]})]}),Te.length>0&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(nl,{}),(0,B.jsxs)(`details`,{className:`group`,children:[(0,B.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-2 text-sm font-medium`,children:[(0,B.jsx)(`span`,{children:`Recent messages`}),(0,B.jsxs)(`span`,{className:`text-[11px] font-normal text-muted-foreground`,children:[Te.length,` `,(0,B.jsx)(`span`,{className:`group-open:hidden`,children:`· show`}),(0,B.jsx)(`span`,{className:`hidden group-open:inline`,children:`· hide`})]})]}),(0,B.jsx)(`div`,{className:`mt-2 space-y-2`,children:Te.map(e=>(0,B.jsxs)(`div`,{className:`rounded border border-border p-2 text-xs space-y-0.5 min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1 text-muted-foreground min-w-0`,children:[(0,B.jsx)(`span`,{className:`font-medium text-foreground truncate shrink-0 max-w-[40%]`,children:Ft(e.from,r)}),(0,B.jsx)(`span`,{className:`shrink-0`,children:`→`}),(0,B.jsx)(`span`,{className:`truncate max-w-[40%]`,children:Ft(e.to,r)}),(0,B.jsxs)(`span`,{className:`ml-auto shrink-0 text-[10px]`,children:[(0,B.jsxs)(`span`,{className:`opacity-40 mr-1`,children:[`#`,e.id]}),j(s,e.createdAt)]})]}),(0,B.jsx)(`div`,{className:`text-foreground whitespace-pre-wrap break-words line-clamp-3`,children:zt(e)})]},e.id))})]})]})]})}),(0,B.jsx)(cu,{value:`timeline`,className:`min-h-0 overflow-y-auto overflow-x-hidden`,children:(0,B.jsx)(bd,{agentId:k.id,open:e&&E===`timeline`,now:s})}),(0,B.jsx)(cu,{value:`logs`,className:`min-h-0 overflow-y-auto overflow-x-hidden`,children:Xe&&Ze?(0,B.jsx)(`div`,{className:`p-4`,children:(0,B.jsx)(Iu,{orchestratorId:Ze.id,session:Xe})}):(0,B.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:`No session logs available for this agent.`})})]})]})}),de&&(0,B.jsx)(Fu,{open:le,onOpenChange:e=>void Oe(e),orchestratorId:de.orchestratorId,session:de.session,interactive:de.interactive||tt})]})}function hd({memory:e,now:t,onOpen:n}){let r=e.sensitivity===`secret`?`bg-red-500/10 text-red-400 border-red-500/30`:e.sensitivity===`sensitive`?`bg-yellow-500/10 text-yellow-400 border-yellow-500/30`:`bg-zinc-500/10 text-zinc-400 border-zinc-500/30`;return(0,B.jsx)(`button`,{onClick:n,className:`w-full rounded-md border border-border p-2 text-left text-xs hover:border-zinc-600 transition-colors`,children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-1 mb-1`,children:[(0,B.jsx)(F,{variant:`secondary`,className:`text-[10px]`,children:e.type}),(0,B.jsx)(F,{variant:`outline`,className:`text-[10px] font-mono`,children:e.scope}),(0,B.jsx)(F,{className:`text-[10px] ${r}`,children:e.sensitivity})]}),(0,B.jsx)(`div`,{className:`font-medium truncate`,children:e.title}),(0,B.jsx)(`div`,{className:`text-muted-foreground line-clamp-2 mt-0.5`,children:e.content})]}),(0,B.jsx)(`div`,{className:`shrink-0 text-right text-[10px] text-muted-foreground`,title:It(e.lastAccessedAt??e.updatedAt),children:j(t,e.lastAccessedAt??e.updatedAt)})]})})}function gd(e){return e>=.8?`text-red-400`:e>=.6?`text-yellow-400`:`text-emerald-400`}function _d({label:e,value:t,onClick:n,title:r,copyLabel:i}){let a=`block w-full break-all text-left font-mono text-xs leading-snug ${n?`text-muted-foreground transition-colors hover:text-foreground`:`text-foreground`}`;return(0,B.jsxs)(`div`,{className:`min-w-0 space-y-0.5`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,B.jsx)(`span`,{className:`text-[11px] uppercase tracking-wide text-muted-foreground`,children:e}),(0,B.jsx)(Pn,{value:t,label:i??`Copy ${e.toLowerCase()}`,size:`icon-xs`,className:`-my-1 shrink-0 text-muted-foreground`})]}),n?(0,B.jsx)(`button`,{type:`button`,className:a,title:r,onClick:n,children:t}):(0,B.jsx)(`div`,{className:a,title:r,children:t})]})}function vd({context:e,tokens:t,history:n,now:r}){let i=Number.isFinite(e.utilization)?Math.max(0,Math.min(1,e.utilization)):null,a=i===null?null:Math.round(i*100),o=i===null?`text-muted-foreground`:gd(i);return(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2 min-w-0`,children:[(0,B.jsx)(`h3`,{className:`shrink-0 text-sm font-medium`,children:`Context`}),(0,B.jsxs)(`span`,{className:`truncate text-[11px] text-muted-foreground`,title:`source ${e.source}, confidence ${e.confidence}`,children:[e.lifecycleState,` · `,e.source,`/`,e.confidence]})]}),(0,B.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,B.jsx)(`span`,{className:`text-2xl font-semibold leading-none ${o}`,children:a===null?`—`:`${a}%`}),t&&(0,B.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[t,` tokens`]})]}),n.length>1&&(0,B.jsx)(yd,{snapshots:n,now:r}),e.warmTopics.length>0&&(0,B.jsxs)(`div`,{className:`mt-2`,children:[(0,B.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`Warm topics`}),(0,B.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1`,children:e.warmTopics.map(e=>(0,B.jsx)(F,{variant:`outline`,className:`text-[10px]`,children:e},e))})]})]})}function yd({snapshots:e,now:t}){let n=e.slice(-24),[r,i]=(0,z.useState)(null);if(n.length<2)return null;let a=n.length,o=e=>Math.max(0,Math.min(1,e)),s=e=>({x:e/(a-1)*100,y:40-o(n[e].utilization)*40}),c=n.map((e,t)=>{let n=s(t);return`${n.x.toFixed(2)},${n.y.toFixed(2)}`}).join(` `),l=gd(o(n[a-1].utilization)),u=r==null?n[a-1]:n[r],d=s(r??a-1);return(0,B.jsxs)(`div`,{className:`mt-2`,children:[(0,B.jsxs)(`div`,{className:`relative`,children:[(0,B.jsxs)(`svg`,{viewBox:`0 0 100 40`,preserveAspectRatio:`none`,className:`h-12 w-full`,"aria-label":`Context utilization history`,children:[(0,B.jsx)(`line`,{x1:`0`,y1:`20`,x2:`100`,y2:`20`,className:`stroke-muted-foreground/15`,strokeWidth:`0.5`,strokeDasharray:`2 2`}),(0,B.jsx)(`polygon`,{points:`0,40 ${c} 100,40`,className:`fill-current text-primary/10`}),(0,B.jsx)(`polyline`,{points:c,fill:`none`,className:`stroke-current ${l}`,strokeWidth:`1.25`,strokeLinejoin:`round`,strokeLinecap:`round`,vectorEffect:`non-scaling-stroke`}),(0,B.jsx)(`circle`,{cx:d.x,cy:d.y,r:`1.6`,className:`fill-current ${l}`,vectorEffect:`non-scaling-stroke`})]}),(0,B.jsx)(`div`,{className:`absolute inset-0 flex`,children:n.map((e,t)=>(0,B.jsx)(`button`,{type:`button`,"aria-label":`${Math.round(o(e.utilization)*100)}% utilization`,className:`h-full flex-1`,onClick:()=>i(t===r?null:t)},e.id))})]}),(0,B.jsxs)(`div`,{className:`mt-1 flex items-center justify-between text-[10px] text-muted-foreground`,children:[(0,B.jsx)(`span`,{children:r==null?(0,B.jsxs)(B.Fragment,{children:[a,` samples · since `,j(t,n[0].capturedAt)]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`span`,{className:l,children:[Math.round(o(u.utilization)*100),`%`]}),` · `,new Date(u.capturedAt).toLocaleTimeString()]})}),(0,B.jsx)(`span`,{children:`0–100%`})]})]})}function bd({agentId:e,open:t,now:r}){let[i,a]=(0,z.useState)([]),[o,s]=(0,z.useState)(!1),[c,l]=(0,z.useState)(null),[u,d]=(0,z.useState)(50),f=(0,z.useCallback)(t=>{s(!0),l(null);let r=!1;return n(`GET`,`/agents/`+encodeURIComponent(e)+`/timeline?limit=`+t).then(e=>{r||(a(e),d(t))}).catch(e=>{r||l(e.message)}).finally(()=>{r||s(!1)}),()=>{r=!0}},[e]);return(0,z.useEffect)(()=>{if(t)return f(50)},[t,e,f]),(0,B.jsxs)(`div`,{className:`p-4 space-y-3 min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium`,children:`Timeline`}),(0,B.jsxs)(I,{size:`sm`,variant:`outline`,className:`h-7 text-xs`,disabled:o,onClick:()=>f(u),children:[(0,B.jsx)(p,{className:`w-3 h-3 mr-1`}),`Refresh`]})]}),c&&(0,B.jsx)(`div`,{className:`text-xs text-red-300`,children:c}),!c&&i.length===0&&!o&&(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`No timeline activity recorded for this agent.`}),(0,B.jsx)(`div`,{className:`space-y-1.5`,children:i.map((e,t)=>(0,B.jsx)(xd,{entry:e,now:r},`${e.ts}:${e.source}:${t}`))}),i.length>=u&&u<200&&(0,B.jsx)(I,{size:`sm`,variant:`outline`,className:`w-full h-7 text-xs`,disabled:o,onClick:()=>f(200),children:`Load full timeline`})]})}function Z(e){return e.metadata?.mismatch===!0||e.metadata?.stalled===!0?(0,B.jsx)(He,{className:`w-3.5 h-3.5 text-amber-400`}):e.source===`command`?(0,B.jsx)(Me,{className:`w-3.5 h-3.5 text-sky-400`}):e.source===`delivery`?(0,B.jsx)(te,{className:`w-3.5 h-3.5 text-violet-400`}):e.kind===`state`?(0,B.jsx)(he,{className:`w-3.5 h-3.5 text-emerald-400`}):(0,B.jsx)(ve,{className:`w-3.5 h-3.5 text-muted-foreground`})}function xd({entry:e,now:t}){let n=typeof e.metadata?.status==`string`?e.metadata.status:``,r=/fail|error|poison|dead/i.test(n),i=e.metadata?.fromState,a=e.metadata?.toState,o=typeof i==`string`&&typeof a==`string`?`${i} → ${a}`:null;return(0,B.jsxs)(`div`,{className:`flex gap-2 rounded border border-border px-2 py-1.5 text-xs min-w-0`,children:[(0,B.jsx)(`div`,{className:`shrink-0 mt-0.5`,children:Z(e)}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,B.jsx)(`span`,{className:`font-medium truncate ${r?`text-red-300`:`text-foreground`}`,children:e.title}),(0,B.jsx)(`span`,{className:`ml-auto shrink-0 text-[10px] text-muted-foreground`,title:It(e.ts),children:j(t,e.ts)})]}),o&&(0,B.jsx)(`div`,{className:`text-muted-foreground font-mono text-[11px]`,children:o}),e.detail&&(0,B.jsx)(`div`,{className:`text-muted-foreground whitespace-pre-wrap break-words line-clamp-3`,children:e.detail})]})]})}function Sd(e){return en(e)&&typeof e.name==`string`&&typeof e.version==`string`?{name:e.name,version:e.version}:null}function Cd(e){return en(e)?Object.entries(e).filter(e=>typeof e[1]==`number`):[]}var wd={oom:`bg-red-500/20 text-red-400`,killed:`bg-red-500/20 text-red-400`,"provider-crash":`bg-orange-500/20 text-orange-400`,"token-401":`bg-amber-500/20 text-amber-400`,"onboarding-gate":`bg-amber-500/20 text-amber-400`,"transport-loss":`bg-sky-500/20 text-sky-400`,"clean-exit":`bg-emerald-500/20 text-emerald-400`,unknown:`bg-zinc-500/20 text-zinc-400`};function Td({report:e,now:t}){let n=e.diagnosis,r=wd[n.cause]??`bg-zinc-500/20 text-zinc-400`;return(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`h3`,{className:`text-sm font-medium mb-2 flex items-center gap-1.5`,children:[(0,B.jsx)(be,{className:`w-3.5 h-3.5 text-muted-foreground`}),`Why it died`]}),(0,B.jsxs)(`div`,{className:`rounded-md border border-border bg-muted/30 px-3 py-2.5 text-xs space-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,B.jsx)(F,{className:r,children:n.cause}),(0,B.jsxs)(`span`,{className:`text-muted-foreground`,children:[n.confidence,` confidence`]}),(0,B.jsx)(`span`,{className:`ml-auto text-[10px] text-muted-foreground`,title:It(n.detectedAt),children:j(t,n.detectedAt)})]}),(0,B.jsx)(`div`,{className:`font-medium text-foreground`,children:n.summary}),n.evidence.length>0&&(0,B.jsx)(`ul`,{className:`space-y-0.5 text-muted-foreground`,children:n.evidence.map((e,t)=>(0,B.jsxs)(`li`,{className:`flex gap-1.5`,children:[(0,B.jsx)(`span`,{className:`shrink-0 text-muted-foreground/50`,children:`·`}),(0,B.jsx)(`span`,{children:e})]},t))}),(n.signal!=null||n.exitCode!=null||n.oom===!0||n.heartbeatGapMs!=null||(n.activeWork?.length??0)>0)&&(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-3 gap-y-1 text-[11px] pt-0.5`,children:[n.signal!=null&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Signal`}),(0,B.jsx)(`div`,{className:`font-mono`,children:n.signal})]}),n.exitCode!=null&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Exit code`}),(0,B.jsx)(`div`,{className:`font-mono`,children:n.exitCode})]}),n.oom===!0&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`OOM`}),(0,B.jsx)(`div`,{children:`yes`})]}),n.heartbeatGapMs!=null&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Heartbeat gap`}),(0,B.jsxs)(`div`,{children:[Math.round(n.heartbeatGapMs/1e3),`s`]})]}),(n.activeWork?.length??0)>0&&(0,B.jsxs)(`div`,{className:`col-span-2 min-w-0`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`Active work`}),(0,B.jsx)(`div`,{className:`truncate`,children:n.activeWork.join(`, `)})]})]}),n.logTail&&n.logTail.length>0&&(0,B.jsx)(`pre`,{className:`mt-1 max-h-28 overflow-auto whitespace-pre-wrap break-words rounded border border-border bg-black/20 p-2 text-[11px] text-muted-foreground`,children:n.logTail.slice(-5).join(`
|
|
21
|
-
`)})]})]})}function Ed(e){if(!en(e)||typeof e.lastError!=`string`)return null;let t=en(e.systemd)?{unit:typeof e.systemd.unit==`string`?e.systemd.unit:void 0,activeState:typeof e.systemd.activeState==`string`?e.systemd.activeState:void 0,subState:typeof e.systemd.subState==`string`?e.systemd.subState:void 0,result:typeof e.systemd.result==`string`?e.systemd.result:void 0,execMainCode:typeof e.systemd.execMainCode==`string`?e.systemd.execMainCode:void 0,execMainStatus:typeof e.systemd.execMainStatus==`string`?e.systemd.execMainStatus:void 0}:void 0;return{lastError:e.lastError,detectedAt:typeof e.detectedAt==`number`?e.detectedAt:void 0,runtimeMs:typeof e.runtimeMs==`number`?e.runtimeMs:void 0,logFile:typeof e.logFile==`string`?e.logFile:void 0,logBytes:typeof e.logBytes==`number`?e.logBytes:void 0,logEmpty:typeof e.logEmpty==`boolean`?e.logEmpty:void 0,logTail:Array.isArray(e.logTail)?e.logTail.filter(e=>typeof e==`string`):void 0,systemd:t,unavailable:Array.isArray(e.unavailable)?e.unavailable.filter(e=>typeof e==`string`):void 0}}function Dd({className:e,children:t,...n}){return(0,B.jsxs)(us,{"data-slot":`scroll-area`,className:O(`relative`,e),...n,children:[(0,B.jsx)(ds,{"data-slot":`scroll-area-viewport`,className:`size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1`,children:t}),(0,B.jsx)(Od,{}),(0,B.jsx)(fs,{})]})}function Od({className:e,orientation:t=`vertical`,...n}){return(0,B.jsx)(Ro,{"data-slot":`scroll-area-scrollbar`,"data-orientation":t,orientation:t,className:O(`flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent`,e),...n,children:(0,B.jsx)(Yo,{"data-slot":`scroll-area-thumb`,className:`relative flex-1 rounded-full bg-border`})})}function kd(){let e=A(e=>e.channelDetailOpen),t=A(e=>e.channelDetailId),n=A(e=>e.channels),r=A(e=>e.messages),i=A(e=>e.agentsById),a=ht(),o=A(e=>e.closeChannelDetail),s=n.find(e=>e.id===t)||null,c=Nt(s),l=(0,z.useMemo)(()=>s?r.filter(e=>Rt(e,s)).sort((e,t)=>t.id-e.id).slice(0,8):[],[r,s]);return(0,B.jsx)(Ql,{open:e,onOpenChange:e=>!e&&o(),children:(0,B.jsxs)(tu,{className:`w-full max-w-[100dvw] sm:max-w-md lg:max-w-lg p-0`,children:[(0,B.jsx)(nu,{className:`shrink-0 p-4 border-b border-border`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,B.jsx)(F,{className:wt(c.tone),children:c.label}),(0,B.jsx)(ru,{className:`text-base truncate`,children:s?.name||`Channel`})]})}),(0,B.jsx)(Dd,{className:`flex-1 min-h-0`,children:(0,B.jsxs)(`div`,{className:`p-4 space-y-4`,children:[s&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium mb-2`,children:`Route`}),(0,B.jsxs)(`div`,{className:`space-y-1 text-sm`,children:[(0,B.jsxs)(`div`,{className:`flex justify-between gap-2`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground shrink-0`,children:`Type`}),(0,B.jsx)(`span`,{className:`truncate`,children:s.type})]}),(0,B.jsxs)(`div`,{className:`flex justify-between gap-2`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground shrink-0`,children:`Direction`}),(0,B.jsx)(`span`,{className:`truncate`,children:s.direction})]}),s.target&&(0,B.jsxs)(`div`,{className:`flex justify-between gap-2`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground shrink-0`,children:`Target`}),(0,B.jsx)(`span`,{className:`truncate`,children:s.target})]}),(0,B.jsxs)(`div`,{className:`flex justify-between gap-2`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground shrink-0`,children:`Agent`}),(0,B.jsx)(`span`,{className:`truncate`,children:s.agentId})]}),(0,B.jsxs)(`div`,{className:`flex justify-between gap-2`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground shrink-0`,children:`Transport`}),(0,B.jsx)(`span`,{className:`truncate`,children:s.transport})]}),(0,B.jsxs)(`div`,{className:`flex justify-between gap-2`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground shrink-0`,children:`Last seen`}),(0,B.jsx)(`span`,{className:`shrink-0`,children:j(a,s.lastSeen)})]})]})]}),jt(s.capabilities).length>0&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(nl,{}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium mb-2`,children:`Capabilities`}),(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:jt(s.capabilities).map(e=>(0,B.jsx)(F,{variant:`secondary`,className:`text-[10px]`,children:e},e))})]})]}),s.meta&&Object.keys(s.meta).length>0&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(nl,{}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium mb-2`,children:`Metadata`}),(0,B.jsx)(`div`,{className:`space-y-1 text-sm`,children:Object.entries(s.meta).map(([e,t])=>(0,B.jsxs)(`div`,{className:`flex justify-between gap-2 min-w-0`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground shrink-0`,children:e}),(0,B.jsx)(`span`,{className:`truncate`,children:String(t)})]},e))})]})]})]}),l.length>0&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(nl,{}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium mb-2`,children:`Recent Messages`}),(0,B.jsx)(`div`,{className:`space-y-2`,children:l.map(e=>(0,B.jsxs)(`div`,{className:`rounded border border-border p-2 text-xs space-y-0.5 min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1 text-muted-foreground min-w-0`,children:[(0,B.jsx)(`span`,{className:`font-medium text-foreground truncate shrink-0 max-w-[40%]`,children:Ft(e.from,i)}),(0,B.jsx)(`span`,{className:`shrink-0`,children:`→`}),(0,B.jsx)(`span`,{className:`truncate max-w-[40%]`,children:Ft(e.to,i)}),(0,B.jsxs)(`span`,{className:`ml-auto shrink-0 text-[10px]`,children:[(0,B.jsxs)(`span`,{className:`opacity-40 mr-1`,children:[`#`,e.id]}),j(a,e.createdAt)]})]}),(0,B.jsx)(`div`,{className:`text-foreground whitespace-pre-wrap break-words line-clamp-3`,children:zt(e)})]},e.id))})]})]})]})})]})})}var Ad=!1;function jd(e,t){let n=z.useRef(!1),r=z.useRef(t);r.current=t,z.useEffect(()=>{if(!e||!r.current)return;Ad=!1,window.history.pushState({dialogGuard:!0},``),n.current=!0;function t(){if(Ad){Ad=!1;return}n.current&&(n.current=!1,r.current?.(!1))}return window.addEventListener(`popstate`,t),()=>{window.removeEventListener(`popstate`,t),n.current&&(n.current=!1,Ad=!0,window.history.back())}},[e])}function Md({...e}){return jd(e.open,e.onOpenChange),(0,B.jsx)(Ar,{"data-slot":`dialog`,...e})}function Nd({...e}){return(0,B.jsx)(jr,{"data-slot":`dialog-portal`,...e})}function Pd({className:e,blur:t=!0,...n}){return(0,B.jsx)(Mr,{"data-slot":`dialog-overlay`,className:O(`fixed inset-0 isolate z-50 bg-black/10 duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,t&&`supports-backdrop-filter:backdrop-blur-xs`,e),...n})}function Fd({className:e,children:t,showCloseButton:n=!0,blurOverlay:r=!0,...i}){return(0,B.jsxs)(Nd,{children:[(0,B.jsx)(Pd,{blur:r}),(0,B.jsxs)(Nr,{"data-slot":`dialog-content`,className:O(`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...i,children:[t,n&&(0,B.jsx)(Ir,{"data-slot":`dialog-close`,asChild:!0,children:(0,B.jsxs)(I,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`,children:[(0,B.jsx)(Fe,{}),(0,B.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})]})]})}function Q({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`dialog-header`,className:O(`flex flex-col gap-2`,e),...t})}function Id({className:e,showCloseButton:t=!1,children:n,...r}){return(0,B.jsxs)(`div`,{"data-slot":`dialog-footer`,className:O(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,B.jsx)(Ir,{asChild:!0,children:(0,B.jsx)(I,{variant:`outline`,children:`Close`})})]})}function Ld({className:e,...t}){return(0,B.jsx)(Pr,{"data-slot":`dialog-title`,className:O(`font-heading text-base leading-none font-medium`,e),...t})}function Rd({className:e,...t}){return(0,B.jsx)(Fr,{"data-slot":`dialog-description`,className:O(`text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function zd({className:e,...t}){return(0,B.jsx)(`textarea`,{"data-slot":`textarea`,className:O(`flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...t})}function $({className:e,...t}){return(0,B.jsx)(Do,{"data-slot":`label`,className:O(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function Bd(){let e=A(e=>e.composeOpen),t=A(e=>e.compose),n=A(e=>e.replyTo),r=A(e=>e.set),i=A(e=>e.doSend),a=A(e=>e.cancelReply),o=Xc();function s(){r({composeOpen:!1}),a()}function c(e){r({compose:{...t,...e}})}return(0,B.jsx)(Md,{open:e,onOpenChange:e=>!e&&s(),children:(0,B.jsxs)(Fd,{className:`max-w-lg`,children:[(0,B.jsx)(Q,{children:(0,B.jsx)(Ld,{children:n?`Reply to #${n.id}`:`Compose Message`})}),(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`From`}),(0,B.jsxs)(`select`,{className:`w-full mt-1 rounded-md border border-input bg-background px-3 py-2 text-sm`,value:t.from,onChange:e=>c({from:e.target.value}),children:[(0,B.jsx)(`option`,{value:``,children:`Select agent...`}),o.map(e=>(0,B.jsx)(`option`,{value:e.id,children:M(e)},e.id))]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`To`}),(0,B.jsx)(L,{value:t.to,onChange:e=>c({to:e.target.value}),placeholder:`agent-id, tag:name, cap:name, or broadcast`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Subject`}),(0,B.jsx)(L,{value:t.subject,onChange:e=>c({subject:e.target.value}),placeholder:`Optional subject...`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Channel`}),(0,B.jsx)(L,{value:t.channel,onChange:e=>c({channel:e.target.value}),placeholder:`Optional channel...`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Message`}),(0,B.jsx)(zd,{value:t.body,onChange:e=>c({body:e.target.value}),rows:4,placeholder:`Message body...`,autoFocus:!0})]}),(0,B.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(tl,{checked:t.claimable,onCheckedChange:e=>c({claimable:e})}),(0,B.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Claimable task`})]})]}),(0,B.jsxs)(Id,{children:[(0,B.jsx)(I,{variant:`outline`,onClick:s,children:`Cancel`}),(0,B.jsx)(I,{onClick:i,children:`Send`})]})]})})}function Vd(){let e=A(e=>e.confirmModal),t=A(e=>e.set);function n(){t({confirmModal:{show:!1,title:``,message:``,action:null}})}return(0,B.jsx)(Md,{open:e.show,onOpenChange:e=>!e&&n(),children:(0,B.jsxs)(Fd,{className:`sm:max-w-sm`,children:[(0,B.jsxs)(Q,{children:[(0,B.jsx)(Ld,{children:e.title}),(0,B.jsx)(Rd,{children:e.message})]}),(0,B.jsxs)(Id,{children:[(0,B.jsx)(I,{variant:`outline`,onClick:n,children:`Cancel`}),(0,B.jsx)(I,{variant:`destructive`,onClick:()=>{e.action?.(),n()},children:`Confirm`})]})]})})}function Hd(){let e=A(e=>e.errorModal),t=A(e=>e.set);function n(){t({errorModal:{show:!1,title:``,message:``}})}return(0,B.jsx)(Md,{open:e.show,onOpenChange:e=>!e&&n(),children:(0,B.jsxs)(Fd,{className:`sm:max-w-sm`,children:[(0,B.jsxs)(Q,{children:[(0,B.jsx)(Ld,{children:e.title}),(0,B.jsx)(Rd,{children:e.message})]}),(0,B.jsx)(Id,{children:(0,B.jsx)(I,{onClick:n,children:`OK`})})]})})}function Ud(){let e=A(e=>e.renameModal),t=A(e=>e.set),n=A(e=>e.doRename);function r(){t({renameModal:{show:!1,agentId:``,label:``}})}return(0,B.jsx)(Md,{open:e.show,onOpenChange:e=>!e&&r(),children:(0,B.jsxs)(Fd,{className:`sm:max-w-sm`,children:[(0,B.jsx)(Q,{children:(0,B.jsx)(Ld,{children:`Rename Agent`})}),(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)($,{children:`Label`}),(0,B.jsx)(L,{value:e.label,onChange:n=>t({renameModal:{...e,label:n.target.value}}),onKeyDown:e=>e.key===`Enter`&&n(),placeholder:`Human-friendly name...`,autoFocus:!0}),(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Leave empty to clear the label.`})]}),(0,B.jsxs)(Id,{children:[(0,B.jsx)(I,{variant:`outline`,onClick:r,children:`Cancel`}),(0,B.jsx)(I,{onClick:n,children:`Save`})]})]})})}function Wd(){let e=A(e=>e.pairInviteOpen),t=A(e=>e.pairInvite),n=A(e=>e.set),r=A(e=>e.closePairInvite),i=A(e=>e.doCreatePair),a=Xc();function o(e){n({pairInvite:{...t,...e}})}return(0,B.jsx)(Md,{open:e,onOpenChange:e=>!e&&r(),children:(0,B.jsxs)(Fd,{className:`sm:max-w-sm`,children:[(0,B.jsx)(Q,{children:(0,B.jsx)(Ld,{children:`Pair Agents`})}),(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Requester`}),(0,B.jsxs)(`select`,{className:`w-full mt-1 rounded-md border border-input bg-background px-3 py-2 text-sm`,value:t.requesterId,onChange:e=>o({requesterId:e.target.value}),children:[(0,B.jsx)(`option`,{value:``,children:`Select agent...`}),a.map(e=>(0,B.jsx)(`option`,{value:e.id,children:M(e)},e.id))]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Target`}),(0,B.jsxs)(`select`,{className:`w-full mt-1 rounded-md border border-input bg-background px-3 py-2 text-sm`,value:t.targetId,onChange:e=>o({targetId:e.target.value}),children:[(0,B.jsx)(`option`,{value:``,children:`Select agent...`}),a.map(e=>(0,B.jsx)(`option`,{value:e.id,children:M(e)},e.id))]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Objective`}),(0,B.jsx)(L,{value:t.objective,onChange:e=>o({objective:e.target.value}),placeholder:`What should they work on?`})]})]}),(0,B.jsxs)(Id,{children:[(0,B.jsx)(I,{variant:`outline`,onClick:r,children:`Cancel`}),(0,B.jsx)(I,{onClick:i,children:`Create Pair`})]})]})})}function Gd(){let e=A(e=>e.pairMessageOpen),t=A(e=>e.pairMessage),n=A(e=>e.set),r=A(e=>e.closePairMessage),i=A(e=>e.doSendPairMessage);function a(e){n({pairMessage:{...t,...e}})}return(0,B.jsx)(Md,{open:e,onOpenChange:e=>!e&&r(),children:(0,B.jsxs)(Fd,{className:`sm:max-w-sm`,children:[(0,B.jsx)(Q,{children:(0,B.jsx)(Ld,{children:`Pair Message`})}),(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Subject`}),(0,B.jsx)(L,{value:t.subject,onChange:e=>a({subject:e.target.value}),placeholder:`Optional subject...`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Message`}),(0,B.jsx)(zd,{value:t.body,onChange:e=>a({body:e.target.value}),rows:4,placeholder:`Message body...`,autoFocus:!0})]})]}),(0,B.jsxs)(Id,{children:[(0,B.jsx)(I,{variant:`outline`,onClick:r,children:`Cancel`}),(0,B.jsx)(I,{onClick:i,children:`Send`})]})]})})}var Kd=(0,z.lazy)(()=>R(()=>import(`./formatted-body-impl-Csr2DuEk.js`).then(e=>({default:e.FormattedBody})),__vite__mapDeps([15,1,5,3,6,8,9,10]),import.meta.url));function qd(e){return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(`span`,{className:e.className,children:e.text}),children:(0,B.jsx)(Kd,{...e})})}function Jd(){let e=A(e=>e.threadOpen),t=A(e=>e.threadMessages),n=A(e=>e.agentsById),r=ht(),i=A(e=>e.set);return(0,B.jsx)(Md,{open:e,onOpenChange:e=>!e&&i({threadOpen:!1}),children:(0,B.jsxs)(Fd,{className:`max-w-2xl max-h-[80vh]`,children:[(0,B.jsx)(Q,{children:(0,B.jsxs)(Ld,{children:[`Thread (`,t.length,` messages)`]})}),(0,B.jsx)(Dd,{className:`max-h-[60vh]`,children:(0,B.jsx)(`div`,{className:`space-y-3 pr-4`,children:t.map(e=>(0,B.jsxs)(`div`,{className:`rounded-lg border border-border p-3 space-y-1`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,B.jsx)(`span`,{className:`font-medium`,children:Ft(e.from,n)}),(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`→`}),(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:Ft(e.to,n)}),(0,B.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:j(r,e.createdAt)})]}),e.subject&&(0,B.jsx)(`div`,{className:`text-sm font-medium`,children:e.subject}),(0,B.jsx)(qd,{text:zt(e),rawBody:e.body,issueRepo:n[e.from===`user`?e.to:e.from]?.issueRepo,className:`text-sm text-muted-foreground`}),(0,B.jsxs)(`div`,{className:`flex gap-1.5 flex-wrap`,children:[e.channel&&(0,B.jsx)(F,{variant:`secondary`,className:`text-[10px]`,children:e.channel}),e.claimedBy&&(0,B.jsxs)(F,{variant:`secondary`,className:`text-[10px]`,children:[`claimed by `,Ft(e.claimedBy,n)]})]})]},e.id))})})]})})}function Yd(){let e=A(e=>e.taskEventsOpen),t=A(e=>e.taskEvents),n=A(e=>e.set),r=A(e=>e.switchView);function i(e){n({selectedMemoryId:e,taskEventsOpen:!1}),r(`memory`)}return(0,B.jsx)(Md,{open:e,onOpenChange:e=>!e&&n({taskEventsOpen:!1}),children:(0,B.jsxs)(Fd,{className:`max-w-2xl max-h-[80vh]`,children:[(0,B.jsx)(Q,{children:(0,B.jsxs)(Ld,{children:[`Task Events (`,t.length,`)`]})}),(0,B.jsx)(Dd,{className:`max-h-[60vh]`,children:(0,B.jsxs)(`div`,{className:`space-y-2 pr-4`,children:[t.map(e=>(0,B.jsxs)(`div`,{className:`flex items-start gap-3 rounded-lg border border-border p-3`,children:[(0,B.jsx)(F,{className:Pt[e.severity]||Pt.info,children:e.severity}),(0,B.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`text-sm font-medium`,children:e.title}),(0,B.jsx)(F,{variant:`outline`,className:`text-[10px]`,children:e.type})]}),e.body&&(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1 whitespace-pre-wrap`,children:e.body}),(0,B.jsx)(Xd,{event:e,onOpen:i}),(0,B.jsxs)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[It(e.createdAt),` · `,e.source]})]})]},e.id)),t.length===0&&(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground text-center py-8`,children:`No events recorded.`})]})})]})})}function Xd({event:e,onOpen:t}){if(e.type!==`memory.captured`)return null;let n=typeof e.metadata?.memoryId==`string`?e.metadata.memoryId:``,r=e.metadata?.memory&&typeof e.metadata.memory==`object`&&!Array.isArray(e.metadata.memory)?e.metadata.memory:{},i=typeof r.title==`string`?r.title:e.body||n,a=typeof r.scope==`string`?r.scope:``,o=typeof r.type==`string`?r.type:`memory`,s=typeof r.sensitivity==`string`?r.sensitivity:``;return(0,B.jsx)(`div`,{className:`mt-2 rounded-md border border-border bg-muted/20 p-2 text-xs`,children:(0,B.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,B.jsx)(Re,{className:`w-3.5 h-3.5 mt-0.5 text-muted-foreground shrink-0`}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-1 mb-1`,children:[(0,B.jsx)(F,{variant:`secondary`,className:`text-[10px]`,children:o}),a&&(0,B.jsx)(F,{variant:`outline`,className:`text-[10px] font-mono`,children:a}),s&&(0,B.jsx)(F,{variant:`outline`,className:`text-[10px]`,children:s})]}),(0,B.jsx)(`div`,{className:`font-medium truncate`,children:i}),n&&(0,B.jsx)(`div`,{className:`font-mono text-[10px] text-muted-foreground truncate`,children:n})]}),n&&(0,B.jsx)(I,{size:`sm`,variant:`outline`,className:`h-7 text-xs shrink-0`,onClick:()=>t(n),children:`Open`})]})})}function Zd({open:e,onOpenChange:t,onSelect:n,orchestratorId:r,initialPath:i,title:a=`Select Directory`}){let o=A(e=>e.apiCall),[s,c]=(0,z.useState)(!1),[l,d]=(0,z.useState)(null),[f,p]=(0,z.useState)(null),[m,g]=(0,z.useState)(!1),[_,v]=(0,z.useState)(``),[y,b]=(0,z.useState)(null),x=l?.path||i||``,S=(0,z.useMemo)(()=>x.split(`/`).filter(Boolean),[x]),C=(0,z.useCallback)(async e=>{if(r){c(!0),p(null),g(!1);try{let t=e?`?path=${encodeURIComponent(e)}`:``;d(await o(`GET`,`/orchestrators/${encodeURIComponent(r)}/directories${t}`))}catch(e){p($t(e))}finally{c(!1)}}},[r,o]);(0,z.useEffect)(()=>{e&&r&&(d(null),p(null),g(!1),C(i||void 0))},[e,r]);async function te(){if(!(!_.trim()||!l)){b(null);try{d(await o(`POST`,`/orchestrators/${encodeURIComponent(r)}/directories`,{path:l.path,name:_.trim()})),g(!1),v(``)}catch(e){b($t(e))}}}function ne(){x&&(n(x),t(!1))}function re(e){C(`/`+S.slice(0,e+1).join(`/`))}return(0,B.jsx)(Md,{open:e,onOpenChange:t,children:(0,B.jsxs)(Fd,{className:`max-w-lg max-h-[85dvh] flex flex-col`,children:[(0,B.jsx)(Q,{children:(0,B.jsxs)(Ld,{className:`flex items-center gap-2`,children:[(0,B.jsx)(h,{className:`h-4 w-4`}),a]})}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-border bg-muted/50 px-2 py-1.5 text-xs overflow-x-auto`,children:[(0,B.jsx)(`button`,{type:`button`,className:`font-mono text-muted-foreground hover:text-foreground shrink-0`,onClick:()=>l?.baseDir&&C(l.baseDir),children:`/`}),S.map((e,t)=>(0,B.jsxs)(`span`,{className:`shrink-0`,children:[(0,B.jsx)(`button`,{type:`button`,className:`font-mono text-muted-foreground hover:text-foreground`,onClick:()=>re(t),children:e}),t<S.length-1&&(0,B.jsx)(`span`,{className:`text-muted-foreground/50 mx-0.5`,children:`/`})]},`${e}-${t}`))]}),(0,B.jsxs)(`div`,{className:`flex-1 min-h-0 rounded-md border border-border bg-background overflow-y-auto`,style:{maxHeight:`40dvh`},children:[s&&(0,B.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,B.jsx)(je,{className:`h-5 w-5 animate-spin text-muted-foreground`})}),!s&&f&&(0,B.jsx)(`div`,{className:`px-3 py-4 text-sm text-destructive`,children:f}),!s&&l&&(0,B.jsxs)(`div`,{className:`p-1`,children:[l.parent&&(0,B.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm hover:bg-muted`,onClick:()=>C(l.parent),children:[(0,B.jsx)($e,{className:`h-4 w-4 text-muted-foreground`}),(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`..`})]}),l.entries.map(e=>(0,B.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm hover:bg-muted`,onClick:()=>C(e.path),children:[(0,B.jsx)(ee,{className:`h-4 w-4 text-muted-foreground`}),(0,B.jsx)(`span`,{className:`truncate`,children:e.name})]},e.path)),l.entries.length===0&&!l.parent&&(0,B.jsx)(`div`,{className:`px-2 py-4 text-sm text-muted-foreground text-center`,children:`Empty directory`}),l.entries.length===0&&l.parent&&(0,B.jsx)(`div`,{className:`px-2 py-4 text-sm text-muted-foreground text-center`,children:`No subdirectories`})]})]}),m?(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsx)(L,{autoFocus:!0,value:_,onChange:e=>{v(e.target.value),b(null)},onKeyDown:e=>{e.key===`Enter`&&te(),e.key===`Escape`&&(g(!1),v(``))},placeholder:`New directory name...`,className:`flex-1 font-mono text-sm`}),(0,B.jsx)(I,{type:`button`,size:`icon`,variant:`outline`,onClick:te,disabled:!_.trim(),children:(0,B.jsx)(ce,{className:`h-4 w-4`})}),(0,B.jsx)(I,{type:`button`,size:`icon`,variant:`ghost`,onClick:()=>{g(!1),v(``),b(null)},children:(0,B.jsx)(Fe,{className:`h-4 w-4`})})]}):(0,B.jsxs)(I,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>g(!0),disabled:!l||s,children:[(0,B.jsx)(u,{className:`h-4 w-4 mr-1.5`}),`New Directory`]}),y&&(0,B.jsx)(`p`,{className:`text-xs text-destructive`,children:y}),(0,B.jsxs)(Id,{children:[(0,B.jsx)(I,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,B.jsx)(I,{onClick:ne,disabled:!x,children:`Select`})]})]})})}function Qd({value:e,onChange:t,orchestratorId:n,placeholder:r,disabled:i}){let[a,o]=(0,z.useState)(!1);return(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsx)(L,{value:e,onChange:e=>t(e.target.value),placeholder:r,disabled:i,className:`flex-1 font-mono text-sm`}),(0,B.jsx)(I,{type:`button`,variant:`outline`,size:`icon`,onClick:()=>o(!0),disabled:i||!n,title:`Browse directories`,children:(0,B.jsx)(h,{className:`h-4 w-4`})}),n&&(0,B.jsx)(Zd,{open:a,onOpenChange:o,onSelect:t,orchestratorId:n,initialPath:e||void 0})]})}function $d({model:e}){if(!e)return null;let t=ef(e);return t.length===0?null:(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.map(e=>(0,B.jsxs)(F,{variant:`outline`,className:`gap-1 text-[10px]`,children:[(0,B.jsx)(e.Icon,{className:`h-3 w-3`}),e.label]},e.label))})}function ef(e){let t=[],n=e.limits?.contextWindowTokens?.value;return n&&t.push({label:tf(n),Icon:y}),e.capabilities?.modalities.input.image&&t.push({label:`Image input`,Icon:st}),(e.capabilities?.modalities.output.image||e.capabilities?.tools?.imageGeneration)&&t.push({label:`Image output`,Icon:st}),e.capabilities?.tools?.code&&t.push({label:`Code`,Icon:Se}),t}function tf(e){return e>=1e6?`${e/1e6}M ctx`:e>=1e3?`${Math.round(e/1e3)}K ctx`:`${e} ctx`}function nf(){let e=A(e=>e.orchestratorSpawnOpen),t=A(e=>e.orchestrators),n=A(e=>e.spawnOrchId),r=A(e=>e.spawnProvider),i=A(e=>e.spawnModel),a=A(e=>e.spawnEffort),o=A(e=>e.spawnProfile),s=A(e=>e.spawnCwd),c=A(e=>e.spawnLabel),l=A(e=>e.spawnApproval),u=A(e=>e.spawnWorkspaceMode),d=A(e=>e.spawnPrompt),f=A(e=>e.spawnSystemPromptAppend),p=A(e=>e.spawnCount),m=A(e=>e.spawnCwdHistory),h=A(e=>e.isSpawning),g=A(e=>!!e.pendingForkImport),_=A(e=>e.set),v=A(e=>e.submitOrchestratorSpawn),y=A(e=>e.selectSpawnHistory),b=A(e=>e.agentProfiles),x=A(e=>e.providerCatalog),S=t.find(e=>e.id===n),C=S?.providers||[],ee=_t(r,x),te=ee.find(e=>e.alias===i),ne=te?.efforts||[],re=!!(S&&C.length>0&&s.trim())&&!h,w=t.filter(e=>e.status===`online`),ie=w.length>1,ae=m.filter(e=>w.some(t=>t.id===e.orchId)).slice(0,5);function oe(e){let n=t.find(t=>t.id===e),r=n?.providers[0]||``;_({spawnOrchId:e,spawnProvider:r,spawnModel:r?mt(r,x):``,spawnEffort:``,spawnCwd:n?.baseDir||``})}function se(e){_({spawnProvider:e,spawnModel:mt(e,x),spawnEffort:``})}function T(e){_({spawnModel:e,spawnEffort:``})}return(0,B.jsx)(Md,{open:e,onOpenChange:e=>!e&&_({orchestratorSpawnOpen:!1}),children:(0,B.jsxs)(Fd,{className:`max-w-lg max-h-[90dvh] flex flex-col`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,B.jsx)(Q,{children:(0,B.jsx)(Ld,{children:`Spawn Agent`})}),(0,B.jsxs)(`div`,{className:`space-y-3 overflow-y-auto flex-1 min-h-0 -mx-4 px-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Orchestrator`}),(0,B.jsx)(`select`,{className:`w-full mt-1 rounded-md border border-input bg-background px-3 py-2 text-sm`,value:n,onChange:e=>oe(e.target.value),children:t.filter(e=>e.status===`online`).map(e=>(0,B.jsxs)(`option`,{value:e.id,children:[e.hostname,` (`,e.id.slice(-8),`)`]},e.id))})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Provider`}),(0,B.jsxs)(`select`,{className:`w-full mt-1 rounded-md border border-input bg-background px-3 py-2 text-sm`,value:r,onChange:e=>se(e.target.value),disabled:!C.length,children:[!C.length&&(0,B.jsx)(`option`,{value:r,children:`No providers available`}),C.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Model`}),(0,B.jsx)(`select`,{className:`w-full mt-1 rounded-md border border-input bg-background px-3 py-2 text-sm`,value:i,onChange:e=>T(e.target.value),disabled:!ee.length,children:ee.map(e=>(0,B.jsx)(`option`,{value:e.alias,children:e.label},e.alias))})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Effort`}),(0,B.jsxs)(`select`,{className:`w-full mt-1 rounded-md border border-input bg-background px-3 py-2 text-sm`,value:a,onChange:e=>_({spawnEffort:e.target.value}),disabled:!ne.length,children:[(0,B.jsx)(`option`,{value:``,children:`Default`}),ne.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]})]})]}),(0,B.jsx)($d,{model:te}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Agent Profile`}),(0,B.jsxs)(`select`,{className:`w-full mt-1 rounded-md border border-input bg-background px-3 py-2 text-sm`,value:o||`default-relay`,onChange:e=>_({spawnProfile:e.target.value}),children:[!b.length&&(0,B.jsx)(`option`,{value:`default-relay`,children:`default-relay`}),b.map(e=>(0,B.jsx)(`option`,{value:e.name,children:e.name},e.name))]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Approval Mode`}),(0,B.jsxs)(`select`,{className:`w-full mt-1 rounded-md border border-input bg-background px-3 py-2 text-sm`,value:l,onChange:e=>_({spawnApproval:e.target.value}),children:[(0,B.jsx)(`option`,{value:`open`,children:`Open`}),(0,B.jsx)(`option`,{value:`guarded`,children:`Guarded`}),(0,B.jsx)(`option`,{value:`read-only`,children:`Read-only`})]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Workspace`}),(0,B.jsxs)(`select`,{className:`w-full mt-1 rounded-md border border-input bg-background px-3 py-2 text-sm`,value:u,onChange:e=>_({spawnWorkspaceMode:e.target.value}),children:[(0,B.jsx)(`option`,{value:`inherit`,children:`Default`}),(0,B.jsx)(`option`,{value:`isolated`,children:`Isolated worktree`}),(0,B.jsx)(`option`,{value:`shared`,children:`Shared cwd`})]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Working Directory`}),(0,B.jsx)(`div`,{className:`mt-1`,children:(0,B.jsx)(Qd,{value:s,onChange:e=>_({spawnCwd:e}),orchestratorId:n,placeholder:`Select a project directory`})}),ae.length>0&&(0,B.jsxs)(`div`,{className:`mt-2`,children:[(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground mb-1`,children:`Recent`}),(0,B.jsx)(`div`,{className:`flex gap-1.5 overflow-x-auto pb-1 sm:flex-wrap sm:overflow-x-visible sm:pb-0`,children:ae.map(e=>{let t=e.cwd.replace(/\/+$/,``).split(`/`).pop()||e.cwd,r=w.find(t=>t.id===e.orchId)?.hostname,i=e.orchId===n&&e.cwd===s;return(0,B.jsx)(`button`,{type:`button`,title:ie&&r?`${r}: ${e.cwd}`:e.cwd,onClick:()=>y(e.orchId,e.cwd),className:`shrink-0 rounded-full border px-2.5 py-1 text-xs font-mono transition-colors ${i?`border-primary bg-primary/10 text-foreground`:`border-input bg-background text-muted-foreground hover:bg-accent hover:text-foreground`}`,children:ie&&r?`${r}: ${t}`:t},`${e.orchId}:${e.cwd}`)})})]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Label`}),(0,B.jsx)(L,{value:c,onChange:e=>_({spawnLabel:e.target.value}),placeholder:`Optional label...`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Initial Prompt`}),(0,B.jsx)(zd,{value:d,onChange:e=>_({spawnPrompt:e.target.value}),rows:3,placeholder:`Optional initial task...`}),(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:`Codex starts this as the first App Server turn; Claude receives it as a launch prompt.`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`System Prompt Append`}),(0,B.jsx)(zd,{value:f,onChange:e=>_({spawnSystemPromptAppend:e.target.value}),rows:5,placeholder:`Optional launch context...`}),(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:`Use for fork history or launch context. It informs the session but does not start work by itself.`})]}),!g&&(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsx)($,{children:`Number of Agents`}),(0,B.jsx)(`span`,{className:`text-sm font-mono tabular-nums text-muted-foreground`,children:p})]}),(0,B.jsx)(`input`,{type:`range`,min:1,max:10,step:1,value:p,onChange:e=>_({spawnCount:Number(e.target.value)}),className:`w-full mt-2 accent-primary`,"aria-label":`Number of agents to spawn`}),p>1&&(0,B.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:[`Spawns `,p,` identical agents`,c.trim()?`, labelled "${c.trim()} 1"…"${c.trim()} ${p}"`:``,`.`]})]})]}),(0,B.jsxs)(Id,{children:[(0,B.jsx)(I,{variant:`outline`,onClick:()=>_({orchestratorSpawnOpen:!1}),disabled:h,children:`Cancel`}),(0,B.jsx)(I,{onClick:v,disabled:!re,children:h?`Spawning…`:C.length?p>1?`Spawn ${p}`:`Spawn`:`No providers`})]})]})})}function rf(){return`host-${Math.random().toString(36).slice(2,8)}`}function af(e,t){return e.includes(t)?e.filter(e=>e!==t):[...e,t]}function of(){let e=A(e=>e.orchestratorInstallOpen),t=A(e=>e.set),r=A(e=>e.showError),i=A(e=>e.showNotification),a=(0,z.useMemo)(()=>new URL(Le()).origin,[]),[o,s]=(0,z.useState)(rf),[c,u]=(0,z.useState)(`$HOME/projects`),[d,f]=(0,z.useState)([`claude`,`codex`]),[p,m]=(0,z.useState)(`4860`),[h,g]=(0,z.useState)(``),[_,v]=(0,z.useState)(``),[y,b]=(0,z.useState)(),[x,S]=(0,z.useState)(!1);async function C(){if(!o.trim()){r(`Validation`,`Orchestrator id is required`);return}if(!c.trim()){r(`Validation`,`Base directory is required`);return}if(!d.length){r(`Validation`,`Select at least one provider`);return}S(!0);try{let e=await n(`POST`,`/orchestrators/bootstrap`,{id:o.trim(),relayUrl:a,baseDir:c.trim(),providers:d,apiPort:Number(p)||4860,pathPrefix:h.split(`:`).map(e=>e.trim()).filter(Boolean)});v(e.command),b(e.expiresAt)}catch(e){r(`Install Command Failed`,e.message)}finally{S(!1)}}return(0,B.jsx)(Md,{open:e,onOpenChange:e=>!e&&t({orchestratorInstallOpen:!1}),children:(0,B.jsxs)(Fd,{className:`max-w-2xl overflow-hidden`,children:[(0,B.jsx)(Q,{children:(0,B.jsxs)(Ld,{className:`flex items-center gap-2`,children:[(0,B.jsx)(l,{className:`w-4 h-4`}),`Add Orchestrator`]})}),(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Orchestrator ID`}),(0,B.jsx)(L,{value:o,onChange:e=>s(e.target.value)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Relay URL`}),(0,B.jsx)(L,{value:a,readOnly:!0})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Base Directory`}),(0,B.jsx)(L,{value:c,onChange:e=>u(e.target.value)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`API Port`}),(0,B.jsx)(L,{value:p,onChange:e=>m(e.target.value),inputMode:`numeric`})]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Providers`}),(0,B.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-2`,children:[`claude`,`codex`].map(e=>(0,B.jsx)(I,{type:`button`,size:`sm`,variant:d.includes(e)?`default`:`outline`,onClick:()=>f(af(d,e)),children:e},e))})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Extra PATH Prefix`}),(0,B.jsx)(L,{value:h,onChange:e=>g(e.target.value),placeholder:`/opt/homebrew/bin:/custom/bin`})]}),_&&(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mb-1`,children:[(0,B.jsx)($,{children:`Install Command`}),y&&(0,B.jsxs)(`span`,{className:`text-[11px] text-muted-foreground`,children:[`Install token expires `,new Date(y*1e3).toLocaleString()]})]}),(0,B.jsx)(`pre`,{className:`max-h-40 w-full overflow-y-auto whitespace-pre-wrap break-all rounded-md border border-input bg-muted/40 p-3 font-mono text-xs leading-relaxed`,children:_})]})]}),(0,B.jsxs)(Id,{children:[(0,B.jsx)(I,{variant:`outline`,onClick:()=>t({orchestratorInstallOpen:!1}),children:`Close`}),_&&(0,B.jsx)(Pn,{value:_,label:`Copy`,showText:!0,size:`default`,variant:`outline`,className:`gap-1`,onCopied:()=>i(`Install command copied`)}),(0,B.jsxs)(I,{className:`gap-1`,onClick:C,disabled:x,children:[(0,B.jsx)(Me,{className:`w-3.5 h-3.5`}),x?`Generating...`:`Generate Command`]})]})]})})}function sf(){let e=A(e=>e.policyModal),t=A(e=>e.orchestrators),n=A(e=>e.agentProfiles),r=A(e=>e.set),i=A(e=>e.submitPolicy),a=A(e=>e.providerCatalog),o=t.find(t=>t.id===e.orchestratorId),s=o?.providers||[],c=_t(e.provider,a),l=c.find(t=>t.alias===e.model),u=l?.efforts||[],d=!!e.editing,f=e.provider===`claude`&&o?.providerStatus?.find(e=>e.name===`claude`)?.features?.rig===!0;function p(t){r({policyModal:{...e,...t}})}function m(n){let r=t.find(e=>e.id===n)?.providers[0]||e.provider;p({orchestratorId:n,provider:r,model:mt(r,a),effort:``})}function h(e){p({provider:e,rig:``,model:mt(e,a),effort:``})}return(0,B.jsx)(Md,{open:e.open,onOpenChange:e=>!e&&p({open:!1}),children:(0,B.jsxs)(Fd,{className:`max-w-lg max-h-[90vh] overflow-y-auto`,children:[(0,B.jsx)(Q,{children:(0,B.jsx)(Ld,{children:d?`Edit Policy`:`Create Managed Agent`})}),(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Policy Name`}),(0,B.jsx)(L,{value:e.name,onChange:e=>p({name:e.target.value}),placeholder:`my-agent`,disabled:d})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Label`}),(0,B.jsx)(L,{value:e.label,onChange:e=>p({label:e.target.value}),placeholder:`Human-friendly name...`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Description`}),(0,B.jsx)(L,{value:e.description,onChange:e=>p({description:e.target.value}),placeholder:`What does this agent do?`})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Orchestrator`}),(0,B.jsx)(`select`,{className:`w-full mt-1 rounded-md border border-input bg-background px-3 py-2 text-sm`,value:e.orchestratorId,onChange:e=>m(e.target.value),children:t.filter(e=>e.status===`online`).map(e=>(0,B.jsxs)(`option`,{value:e.id,children:[e.hostname,` (`,e.id.slice(-8),`)`]},e.id))})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Provider`}),(0,B.jsxs)(`select`,{className:`w-full mt-1 rounded-md border border-input bg-background px-3 py-2 text-sm`,value:e.provider,onChange:e=>h(e.target.value),disabled:!s.length,children:[!s.length&&(0,B.jsx)(`option`,{value:e.provider,children:`No providers available`}),s.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]})]})]}),f&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Rig`}),(0,B.jsx)(L,{value:e.rig,onChange:e=>p({rig:e.target.value}),placeholder:`Leave empty to auto-detect from .claude-rig`}),(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:`claude-rig profile name. Auto-detects from project's .claude-rig file if empty.`})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Model`}),(0,B.jsx)(`select`,{className:`w-full mt-1 rounded-md border border-input bg-background px-3 py-2 text-sm`,value:e.model,onChange:e=>p({model:e.target.value,effort:``}),children:c.map(e=>(0,B.jsx)(`option`,{value:e.alias,children:e.label},e.alias))})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Effort`}),(0,B.jsxs)(`select`,{className:`w-full mt-1 rounded-md border border-input bg-background px-3 py-2 text-sm`,value:e.effort,onChange:e=>p({effort:e.target.value}),disabled:!u.length,children:[(0,B.jsx)(`option`,{value:``,children:`Default`}),u.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]})]})]}),(0,B.jsx)($d,{model:l}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Agent Profile`}),(0,B.jsxs)(`select`,{className:`w-full mt-1 rounded-md border border-input bg-background px-3 py-2 text-sm`,value:e.profile||`default-relay`,onChange:e=>p({profile:e.target.value}),children:[!n.length&&(0,B.jsx)(`option`,{value:`default-relay`,children:`default-relay`}),n.map(e=>(0,B.jsx)(`option`,{value:e.name,children:e.name},e.name))]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Working Directory`}),(0,B.jsx)(`div`,{className:`mt-1`,children:(0,B.jsx)(Qd,{value:e.cwd,onChange:e=>p({cwd:e}),orchestratorId:e.orchestratorId,placeholder:o?.baseDir||`/path/to/project`})})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Mode`}),(0,B.jsxs)(`select`,{className:`w-full mt-1 rounded-md border border-input bg-background px-3 py-2 text-sm`,value:e.mode,onChange:e=>p({mode:e.target.value}),children:[(0,B.jsx)(`option`,{value:`always-on`,children:`Always On`}),(0,B.jsx)(`option`,{value:`on-demand`,children:`On Demand`})]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Permission Mode`}),(0,B.jsxs)(`select`,{className:`w-full mt-1 rounded-md border border-input bg-background px-3 py-2 text-sm`,value:e.permissionMode,onChange:e=>p({permissionMode:e.target.value}),children:[(0,B.jsx)(`option`,{value:`open`,children:`Open`}),(0,B.jsx)(`option`,{value:`guarded`,children:`Guarded`}),(0,B.jsx)(`option`,{value:`read-only`,children:`Read-only`})]})]})]}),e.mode===`on-demand`&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Keepalive (seconds)`}),(0,B.jsx)(L,{type:`number`,value:e.keepaliveSeconds,onChange:e=>p({keepaliveSeconds:e.target.value}),placeholder:`300`}),(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:`Seconds to keep agent alive after last activity.`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Initial Prompt`}),(0,B.jsx)(zd,{value:e.prompt,onChange:e=>p({prompt:e.target.value}),rows:3,placeholder:`Optional initial task or instructions...`}),(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:`Codex starts this as the first App Server turn; Claude receives it as a launch prompt.`})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Tags`}),(0,B.jsx)(L,{value:e.tags,onChange:e=>p({tags:e.target.value}),placeholder:`tag1, tag2`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Capabilities`}),(0,B.jsx)(L,{value:e.capabilities,onChange:e=>p({capabilities:e.target.value}),placeholder:`chat, review`})]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Provider Args`}),(0,B.jsx)(L,{value:e.providerArgs,onChange:e=>p({providerArgs:e.target.value}),placeholder:`--flag value`}),(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:`Space-separated args passed to the provider CLI.`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Channel Binding`}),(0,B.jsx)(L,{value:e.channelId,onChange:e=>p({channelId:e.target.value}),placeholder:`Channel ID (optional)`})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Backoff Schedule (seconds)`}),(0,B.jsx)(L,{value:e.backoffSchedule,onChange:e=>p({backoffSchedule:e.target.value}),placeholder:`5, 15, 60, 300`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Backoff Reset After (s)`}),(0,B.jsx)(L,{type:`number`,value:e.backoffResetAfterSeconds,onChange:e=>p({backoffResetAfterSeconds:e.target.value}),placeholder:`600`})]})]}),(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsx)($,{htmlFor:`restartOnUpdate`,children:`Restart on policy update`}),(0,B.jsx)(tl,{id:`restartOnUpdate`,checked:e.restartOnUpdate,onCheckedChange:e=>p({restartOnUpdate:e})})]}),(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsx)($,{htmlFor:`dailyRestart`,children:`Scheduled daily restart`}),(0,B.jsx)(tl,{id:`dailyRestart`,checked:e.scheduledDailyRestart,onCheckedChange:e=>p({scheduledDailyRestart:e})})]})]}),(0,B.jsxs)(Id,{children:[(0,B.jsx)(I,{variant:`outline`,onClick:()=>p({open:!1}),children:`Cancel`}),(0,B.jsx)(I,{onClick:i,children:d?`Save`:`Create`})]})]})})}function cf({children:e}){return(0,B.jsxs)(Rc,{children:[(0,B.jsx)(zc,{asChild:!0,children:(0,B.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-label":`More info`,className:`inline-flex shrink-0 text-muted-foreground transition-colors hover:text-foreground`,children:(0,B.jsx)(le,{className:`h-3 w-3`})})}),(0,B.jsx)(Bc,{className:`max-w-xs leading-relaxed`,children:e})]})}function lf({children:e,tip:t,className:n}){return(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)($,{className:n,children:e}),(0,B.jsx)(cf,{children:t})]})}var uf=[`core`,`workspace`,`memory`,`artifacts`,`blackboard`,`subscriptions`,`spawn-lifecycle`,`plans`,`teams`,`project`,`issues`],df=[{value:``,label:`Off`},{value:`all`,label:`All`}],ff=[{value:``,label:`Off`},{value:`all`,label:`All safe settings`}],pf=[{value:``,label:`Instance default`},{value:`direct`,label:`Direct`},{value:`pr`,label:`Pull request`}],mf=[{value:`any`,label:`Any provider`},{value:`claude`,label:`Claude`},{value:`codex`,label:`Codex`}],hf={relay:`bg-blue-500/10 text-blue-400 border-blue-500/30`,repo:`bg-emerald-500/10 text-emerald-400 border-emerald-500/30`,inline:`bg-amber-500/10 text-amber-400 border-amber-500/30`,provider:`bg-fuchsia-500/10 text-fuchsia-400 border-fuchsia-500/30`,profile:`bg-slate-500/10 text-slate-400 border-slate-500/30`};function gf(e){return e?e.policy??`all`:``}function _f(e){if(e)return e===`all`?{policy:`all`}:{}}function vf({value:e,onChange:t,options:n,disabled:r}){return(0,B.jsx)(`select`,{className:`w-full rounded-md border border-input bg-background px-3 py-2 text-sm`,value:e,onChange:e=>t(e.target.value),disabled:r,children:n.map(e=>(0,B.jsx)(`option`,{value:e.value,children:e.label},e.value))})}function yf(e,t){return`${e.source}:${e.provider??`any`}:${e.ref}:${t}`}function bf({source:e}){return(0,B.jsx)(F,{variant:`outline`,className:`text-[10px] ${hf[e]}`,children:e})}function xf({skills:e,plugins:t,mcp:r,onChangeSkills:i,onChangePlugins:a,onChangeMcp:o,projectMcp:s,projectSkills:c,projectSettings:l,sharedMcp:u,readOnly:d}){let[f,p]=(0,z.useState)([]),[m,h]=(0,z.useState)(!1),[g,_]=(0,z.useState)(!1),[v,y]=(0,z.useState)(null),[b,x]=(0,z.useState)(null),[S,C]=(0,z.useState)(`repo`),[ee,te]=(0,z.useState)(``),[ne,re]=(0,z.useState)(`any`);async function w(e){if(x(e),!m){_(!0),y(null);try{p((await n(`GET`,`/provisioning/capabilities`)).capabilities),h(!0)}catch(e){y($t(e))}finally{_(!1)}}}function ie(n){let r=ee.trim();if(!r)return;let o={source:S,ref:r,enabled:!0,...ne===`any`?{}:{provider:ne}};n===`skill`?i([...e,o]):a([...t,o]),te(``),x(null)}function ae(n,r){let o=n===`skill`?e:t;if(o.some(e=>e.source===`relay`&&e.ref===r))return;let s=[...o,{source:`relay`,ref:r,enabled:!0}];n===`skill`?i(s):a(s),x(null)}function oe(e){let t=e.variants.find(e=>e.enabled);if(!t)return;let n=t.definition;o({...r,servers:{...r.servers??{},[e.capability.slug]:n?.server??{}}}),x(null)}function se(t,n){i(e.map((e,r)=>r===t?{...e,...n}:e))}function T(e,n){a(t.map((t,r)=>r===e?{...t,...n}:t))}function E(e){let t={...r.servers??{}};delete t[e],o({...r,servers:t})}let ce=f.filter(e=>e.capability.kind===`skill`),le=f.filter(e=>e.capability.kind===`plugin`),ue=f.filter(e=>e.capability.kind===`mcp`);return(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(Sf,{projectMcp:s,projectSkills:c,projectSettings:l,sharedMcp:u}),(0,B.jsx)(wf,{title:`Skills from registry`,kind:`skill`,refs:e,readOnly:d,adding:b===`skill`,caps:ce,loading:g,fetchError:v,empty:`No skills assigned`,manualRef:ee,manualSource:S,manualProvider:ne,onAddClick:()=>void w(`skill`),onCancel:()=>x(null),onManualRef:te,onManualSource:C,onManualProvider:re,onAddManual:()=>ie(`skill`),onAddRelay:e=>ae(`skill`,e),onUpdate:se,onRemove:t=>i(e.filter((e,n)=>n!==t))}),(0,B.jsx)(wf,{title:`Plugins from registry`,kind:`plugin`,refs:t,readOnly:d,adding:b===`plugin`,caps:le,loading:g,fetchError:v,empty:`No plugins assigned`,manualRef:ee,manualSource:S,manualProvider:ne,onAddClick:()=>void w(`plugin`),onCancel:()=>x(null),onManualRef:te,onManualSource:C,onManualProvider:re,onAddManual:()=>ie(`plugin`),onAddRelay:e=>ae(`plugin`,e),onUpdate:T,onRemove:e=>a(t.filter((t,n)=>n!==e))}),(0,B.jsx)(Df,{mcpKeys:Object.keys(r.servers??{}),caps:ue,adding:b===`mcp`,loading:g,fetchError:v,readOnly:d,onAddClick:()=>void w(`mcp`),onAddMcp:oe,onCancel:()=>x(null),onRemove:E})]})}function Sf(e){return(0,B.jsxs)(`div`,{className:`rounded border border-border bg-muted/20 p-2`,children:[(0,B.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-xs font-medium text-muted-foreground`,children:[`Project and shared injection`,(0,B.jsxs)(cf,{children:[`Read-only mirror of the Provisioning Policies above — what this profile injects from the project's `,(0,B.jsx)(`code`,{children:`.mcp.json`}),`/`,(0,B.jsx)(`code`,{children:`.claude`}),` and how its MCP is routed.`]})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,B.jsxs)(F,{variant:e.projectMcp?`default`:`outline`,className:`text-[10px]`,children:[`project MCP: `,gf(e.projectMcp)||`off`]}),(0,B.jsxs)(F,{variant:e.projectSkills?`default`:`outline`,className:`text-[10px]`,children:[`project skills: `,gf(e.projectSkills)||`off`]}),(0,B.jsxs)(F,{variant:e.projectSettings?`default`:`outline`,className:`text-[10px]`,children:[`project settings: `,gf(e.projectSettings)||`off`]}),(0,B.jsxs)(F,{variant:e.sharedMcp?`default`:`outline`,className:`text-[10px]`,children:[`shared MCP: `,gf(e.sharedMcp)||`off`]})]})]})}function Cf(e){return[...new Set(e.variants.map(e=>e.sourceType||`relay`))].join(`, `)}function wf(e){return(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:e.title}),!e.readOnly&&(0,B.jsxs)(I,{type:`button`,variant:`outline`,size:`sm`,className:`h-6 gap-1 text-xs`,onClick:e.onAddClick,children:[(0,B.jsx)(a,{className:`h-3 w-3`}),`Add `,e.kind]})]}),e.refs.length===0&&!e.adding&&(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.empty}),e.refs.map((t,n)=>(0,B.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 rounded border border-border bg-card/60 px-2 py-1`,children:[(0,B.jsx)(F,{variant:`outline`,className:`text-[10px] ${e.kind===`skill`?`bg-blue-500/10 text-blue-400 border-blue-500/30`:`bg-violet-500/10 text-violet-400 border-violet-500/30`}`,children:e.kind}),(0,B.jsx)(bf,{source:t.source}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs`,children:t.ref}),t.provider&&t.provider!==`any`&&(0,B.jsx)(F,{variant:`secondary`,className:`text-[10px]`,children:t.provider}),(0,B.jsx)(tl,{checked:t.enabled,onCheckedChange:t=>e.onUpdate(n,{enabled:t}),disabled:e.readOnly,size:`sm`}),!e.readOnly&&(0,B.jsx)(I,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`h-5 w-5`,onClick:()=>e.onRemove(n),children:(0,B.jsx)(Ne,{className:`h-3 w-3`})})]},yf(t,n))),e.adding&&(0,B.jsxs)(`div`,{className:`mt-1.5 space-y-2 rounded border border-border bg-card/60 p-2`,children:[e.loading&&(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Loading...`}),e.fetchError&&(0,B.jsx)(`div`,{className:`text-xs text-destructive`,children:e.fetchError}),!e.loading&&e.caps.length===0&&!e.fetchError&&(0,B.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`No `,e.kind,` capabilities in registry`]}),e.caps.length>0&&(0,B.jsx)(`div`,{className:`max-h-44 space-y-0.5 overflow-y-auto rounded border border-border/60 bg-background/40 p-1`,children:e.caps.map(t=>(0,B.jsxs)(`button`,{type:`button`,onClick:()=>e.onAddRelay(t.capability.slug),className:`w-full rounded px-2 py-1 text-left font-mono text-xs hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,children:[t.capability.slug,t.capability.title?` - ${t.capability.title}`:``,t.variants.length>0&&(0,B.jsxs)(`span`,{className:`ml-2 text-muted-foreground`,children:[`(`,Cf(t),`)`]})]},t.capability.id))}),(0,B.jsx)(Tf,{}),(0,B.jsx)(Ef,{...e}),(0,B.jsx)(I,{type:`button`,variant:`ghost`,size:`sm`,className:`mt-1 h-6 text-xs`,onClick:e.onCancel,children:`Cancel`})]})]})}function Tf(){return(0,B.jsxs)(`div`,{className:`flex items-center gap-2 pt-0.5`,children:[(0,B.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,B.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide text-muted-foreground`,children:`or add manually`}),(0,B.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}function Ef(e){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`grid grid-cols-[1fr_1fr] gap-1.5`,children:[(0,B.jsx)(vf,{value:e.manualSource,onChange:t=>e.onManualSource(t),options:[{value:`repo`,label:`Repo ref`},{value:`inline`,label:`Inline ref`},{value:`provider`,label:`Provider ref`},{value:`relay`,label:`Relay ref`}]}),(0,B.jsx)(vf,{value:e.manualProvider,onChange:t=>e.onManualProvider(t),options:mf})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(L,{value:e.manualRef,onChange:t=>e.onManualRef(t.target.value),placeholder:e.kind===`skill`?`.claude/skills/name or registry slug`:`.relay/plugins/name or registry slug`,className:`font-mono text-xs`}),(0,B.jsx)(I,{type:`button`,variant:`outline`,size:`sm`,className:`h-8 text-xs`,onClick:e.onAddManual,children:`Add ref`})]})]})}function Df(e){return(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:`MCP from registry`}),!e.readOnly&&(0,B.jsxs)(I,{type:`button`,variant:`outline`,size:`sm`,className:`h-6 gap-1 text-xs`,onClick:e.onAddClick,children:[(0,B.jsx)(a,{className:`h-3 w-3`}),`Add MCP`]})]}),e.mcpKeys.length===0&&!e.adding&&(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`No MCP servers from registry`}),e.mcpKeys.map(t=>(0,B.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 rounded border border-border bg-card/60 px-2 py-1`,children:[(0,B.jsx)(F,{variant:`outline`,className:`border-emerald-500/30 bg-emerald-500/10 text-[10px] text-emerald-400`,children:`mcp`}),(0,B.jsx)(bf,{source:`profile`}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs`,children:t}),!e.readOnly&&(0,B.jsx)(I,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`h-5 w-5`,onClick:()=>e.onRemove(t),children:(0,B.jsx)(Ne,{className:`h-3 w-3`})})]},t)),e.adding&&(0,B.jsxs)(`div`,{className:`mt-1.5 space-y-2 rounded border border-border bg-card/60 p-2`,children:[e.loading&&(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Loading...`}),e.fetchError&&(0,B.jsx)(`div`,{className:`text-xs text-destructive`,children:e.fetchError}),!e.loading&&e.caps.length===0&&!e.fetchError&&(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`No MCP capabilities in registry`}),e.caps.length>0&&(0,B.jsx)(`div`,{className:`max-h-44 space-y-0.5 overflow-y-auto rounded border border-border/60 bg-background/40 p-1`,children:e.caps.map(t=>(0,B.jsxs)(`button`,{type:`button`,onClick:()=>e.onAddMcp(t),className:`w-full rounded px-2 py-1 text-left font-mono text-xs hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,children:[t.capability.slug,t.capability.title?` - ${t.capability.title}`:``,t.variants.length>0&&(0,B.jsxs)(`span`,{className:`ml-2 text-muted-foreground`,children:[`(`,Cf(t),`)`]})]},t.capability.id))}),(0,B.jsx)(I,{type:`button`,variant:`ghost`,size:`sm`,className:`mt-1 h-6 text-xs`,onClick:e.onCancel,children:`Cancel`})]})]})}function Of({profile:e}){let[t,r]=(0,z.useState)(e.provider===`claude`||e.provider===`codex`?e.provider:`codex`),[i,a]=(0,z.useState)(null),[o,s]=(0,z.useState)(!1),[c,l]=(0,z.useState)(null);async function u(i=t){if(e.name.trim()){s(!0),l(null);try{let t=await n(`GET`,`/agent-profiles/${encodeURIComponent(e.name)}/resolved?provider=${encodeURIComponent(i)}`);r(t.provider),a(t.profile.provisioning??{skills:[],plugins:[],mcpServers:{}})}catch(e){l($t(e)),a(null)}finally{s(!1)}}}let d=e.relay.tools?.groups??[],f=d.length?d.join(`, `):`all groups`,p=Object.keys(i?.mcpServers??{});return(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)($,{children:`Provider`}),(0,B.jsx)(vf,{value:t,onChange:e=>{let t=e;r(t),u(t)},options:[{value:`codex`,label:`Codex`},{value:`claude`,label:`Claude`}]})]}),(0,B.jsx)(I,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void u(),disabled:o||!e.name.trim(),children:o?`Resolving...`:`Resolve`})]}),c&&(0,B.jsx)(`div`,{className:`rounded border border-destructive/40 bg-destructive/10 px-2 py-1 text-xs text-destructive`,children:c}),(0,B.jsxs)(`div`,{className:`rounded border border-border bg-muted/20 p-2`,children:[(0,B.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:`Relay tool surface`}),(0,B.jsx)(`div`,{className:`mt-1 font-mono text-xs`,children:f})]}),!i&&!c&&(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Resolve this profile to inspect materialized provisioning.`}),i&&(0,B.jsxs)(`div`,{className:`grid gap-2`,children:[(0,B.jsx)(kf,{title:`Skills`,values:i.skills.map(e=>e.name),empty:`No resolved skills`}),(0,B.jsx)(kf,{title:`Plugins`,values:i.plugins.map(e=>e.name),empty:`No resolved plugins`}),(0,B.jsx)(kf,{title:`MCP Servers`,values:p,empty:`No resolved MCP servers`}),(i.skipped?.length??0)>0&&(0,B.jsxs)(`div`,{className:`rounded border border-amber-500/30 bg-amber-500/10 p-2`,children:[(0,B.jsx)(`div`,{className:`text-xs font-medium text-amber-300`,children:`Skipped`}),(0,B.jsx)(`div`,{className:`mt-1 space-y-1`,children:i.skipped.map(e=>(0,B.jsxs)(`div`,{className:`text-xs`,children:[(0,B.jsxs)(`span`,{className:`font-mono`,children:[e.kind,`:`,e.ref]}),(0,B.jsxs)(`span`,{className:`text-muted-foreground`,children:[` - `,e.detail]})]},`${e.kind}:${e.ref}:${e.reason}`))})]})]})]})}function kf({title:e,values:t,empty:n}){return(0,B.jsxs)(`div`,{className:`rounded border border-border bg-card/60 p-2`,children:[(0,B.jsx)(`div`,{className:`mb-1 text-xs font-medium text-muted-foreground`,children:e}),t.length===0?(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:n}):(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:t.map((e,t)=>(0,B.jsx)(F,{variant:`outline`,className:`font-mono text-[10px]`,children:e},`${e}:${t}`))})]})}function Af({title:e,children:t,defaultOpen:n=!0}){let[r,i]=(0,z.useState)(n);return(0,B.jsxs)(`div`,{className:`border border-border rounded-md`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 px-3 py-2 text-sm font-medium hover:bg-accent`,onClick:()=>i(!r),children:[r?(0,B.jsx)(ct,{className:`h-3.5 w-3.5`}):(0,B.jsx)(lt,{className:`h-3.5 w-3.5`}),e]}),r&&(0,B.jsx)(`div`,{className:`space-y-3 border-t border-border px-3 py-3`,children:t})]})}function jf({value:e,onChange:t,options:n,disabled:r}){return(0,B.jsx)(`select`,{className:`w-full rounded-md border border-input bg-background px-3 py-2 text-sm`,value:e,onChange:e=>t(e.target.value),disabled:r,children:n.map(e=>(0,B.jsx)(`option`,{value:e.value,children:e.label},e.value))})}function Mf({env:e,onChange:t,disabled:n}){let r=Object.entries(e),[i,o]=(0,z.useState)(``),[s,c]=(0,z.useState)(``);function l(){i.trim()&&(t({...e,[i.trim()]:s}),o(``),c(``))}function u(n){let r={...e};delete r[n],t(r)}return(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[r.map(([e,t])=>(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsxs)(`code`,{className:`min-w-0 flex-1 truncate rounded bg-muted px-2 py-1 text-xs`,children:[e,`=`,t]}),!n&&(0,B.jsx)(I,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`h-6 w-6 shrink-0`,onClick:()=>u(e),children:(0,B.jsx)(Ne,{className:`h-3 w-3`})})]},e)),!n&&(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(L,{value:i,onChange:e=>o(e.target.value),placeholder:`KEY`,className:`flex-1 text-xs font-mono`}),(0,B.jsx)(L,{value:s,onChange:e=>c(e.target.value),placeholder:`value`,className:`flex-1 text-xs font-mono`,onKeyDown:e=>e.key===`Enter`&&l()}),(0,B.jsx)(I,{type:`button`,variant:`outline`,size:`icon-sm`,className:`h-8 w-8 shrink-0`,onClick:l,children:(0,B.jsx)(a,{className:`h-3 w-3`})})]}),r.length===0&&n&&(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`No environment variables`})]})}var Nf=[{value:`host`,label:`Host — full access, relay-aware`},{value:`minimal`,label:`Minimal — relay disabled, repo-scoped`},{value:`isolated`,label:`Isolated — strict isolation`},{value:`vanilla`,label:`Vanilla — zero host bleed (plugins/skills/hooks/MCP/CLAUDE.md off)`}],Pf=[{value:`any`,label:`Any provider`},{value:`claude`,label:`Claude`},{value:`codex`,label:`Codex`}],Ff=[{value:`host`,label:`Host — use host config`},{value:`profile`,label:`Profile — use profile config`},{value:`repo`,label:`Repo — use repo config only`},{value:`none`,label:`None — disabled`}],If=[{value:`host`,label:`Host — full filesystem`},{value:`workspace`,label:`Workspace — working directory tree`},{value:`repo`,label:`Repo — repository root only`}],Lf=[{value:`allow`,label:`Allow`},{value:`ignore`,label:`Ignore`}],Rf=[{value:``,label:`Default`},{value:`open`,label:`Open — allow all`},{value:`guarded`,label:`Guarded — prompt for risky`},{value:`read-only`,label:`Read-only`}],zf={context:`Injects relay's context preamble each turn (memory + situational awareness).`,skills:`Makes the bundled Agent Relay skills available to the agent.`,plugins:`Loads the bundled Agent Relay Claude plugin (session registration, approval hooks).`,statusLine:`Enables the relay status-line probe (quota + context-window reporting).`,mcp:`Master switch for relay's own MCP tools (relay_* — messaging, memory, spawn, etc.). One of three independent MCP sources, alongside Project MCP (the project's .mcp.json) and MCP Mode (the host's ambient MCP).`},Bf={context:`Context`,skills:`Skills`,plugins:`Plugins`,statusLine:`Status Line`,mcp:`MCP Tools`};function Vf({values:e,onChange:t,disabled:n,placeholder:r}){let[i,o]=(0,z.useState)(``);function s(){let n=i.trim();n&&(t([...e,n]),o(``))}function c(n,r){t(e.map((e,t)=>t===n?r:e))}function l(n){t(e.filter((e,t)=>t!==n))}return(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[e.map((e,t)=>(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(L,{value:e,onChange:e=>c(t,e.target.value),disabled:n,className:`flex-1 text-xs`}),!n&&(0,B.jsx)(I,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`h-6 w-6 shrink-0`,onClick:()=>l(t),children:(0,B.jsx)(Ne,{className:`h-3 w-3`})})]},`${e}-${t}`)),!n&&(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(L,{value:i,onChange:e=>o(e.target.value),placeholder:r,className:`flex-1 text-xs`,onKeyDown:e=>e.key===`Enter`&&s()}),(0,B.jsx)(I,{type:`button`,variant:`outline`,size:`icon-sm`,className:`h-8 w-8 shrink-0`,onClick:s,children:(0,B.jsx)(a,{className:`h-3 w-3`})})]}),e.length===0&&n&&(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`None`})]})}function Hf(){let{open:e,mode:t,profile:n}=A(e=>e.profileModal),r=A(e=>e.closeProfileModal),i=A(e=>e.updateProfileModal),a=A(e=>e.saveProfile),o=t===`view`,s=t===`create`||t===`duplicate`,c=t===`view`?`Profile: ${n.name}`:t===`edit`?`Edit: ${n.name}`:t===`duplicate`?`Duplicate Profile`:`Create Profile`;function l(e){i({instructions:{...n.instructions,...e}})}function u(e){i({relay:{...n.relay,...e}})}function d(e,t){let r=n.relay.tools?.groups??[],i=t?[...new Set([...r,e])]:r.filter(t=>t!==e);u({tools:i.length?{groups:i}:void 0})}function f(e){i({projectMcp:_f(e)})}function p(e){i({projectSkills:_f(e)})}function m(e){i({projectSettings:_f(e)})}function h(e){i({sharedMcp:_f(e)})}function g(e){i({permissions:{...n.permissions,...e}})}function _(e){let t=n.providerOptions||{},r={...t.codex&&typeof t.codex==`object`&&!Array.isArray(t.codex)?t.codex:{}};if(!e.trim())delete r.toolOutputTokenLimit;else{let t=Number(e);if(!Number.isSafeInteger(t))return;r.toolOutputTokenLimit=t}i({providerOptions:{...t,codex:r}})}function v(e){if(!e.trim()){i({maxSpawnedAgents:void 0});return}let t=Number(e);!Number.isInteger(t)||t<0||i({maxSpawnedAgents:Math.min(t,100)})}function y(e){let t=e===`host`;i({base:e,relay:{context:t,skills:t,plugins:t,statusLine:t,mcp:t},mcp:{...n.mcp,mode:t?`host`:`none`},hooks:{mode:t?`host`:`none`},permissions:{...n.permissions,filesystem:t?`host`:`repo`},instructions:{...n.instructions,globalInstructions:t?`allow`:`ignore`}})}let b=n.providerOptions?.codex&&typeof n.providerOptions.codex==`object`&&!Array.isArray(n.providerOptions.codex)?n.providerOptions.codex:{},x=Number.isSafeInteger(b.toolOutputTokenLimit)?String(b.toolOutputTokenLimit):``;return(0,B.jsx)(Md,{open:e,onOpenChange:e=>!e&&r(),children:(0,B.jsxs)(Fd,{className:`max-w-2xl max-h-[90vh] overflow-y-auto`,children:[(0,B.jsx)(Q,{children:(0,B.jsxs)(Ld,{className:`flex items-center gap-2`,children:[c,n.builtIn&&(0,B.jsx)(F,{variant:`secondary`,className:`text-[10px]`,children:`Built-in`})]})}),(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsxs)(Af,{title:`General`,defaultOpen:!0,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Name`}),(0,B.jsx)(L,{value:n.name,onChange:e=>i({name:e.target.value}),placeholder:`my-profile`,disabled:o||t===`edit`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Description`}),(0,B.jsx)(L,{value:n.description||``,onChange:e=>i({description:e.target.value}),placeholder:`What this profile configures`,disabled:o})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(lf,{tip:`Emoji shown across the dashboard wherever an agent on this profile appears (conversation rows, agent cards, chat header). A single emoji; leave blank for a neutral marker.`,children:`Icon`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(L,{value:n.icon||``,onChange:e=>i({icon:e.target.value}),placeholder:`🤖`,maxLength:8,disabled:o,className:`w-24 text-center text-base`}),(0,B.jsx)(`span`,{className:`text-2xl leading-none`,"aria-hidden":!0,children:n.icon?.trim()||`•`})]})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Base`}),(0,B.jsx)(jf,{value:n.base,onChange:e=>y(e),options:Nf,disabled:o})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Provider`}),(0,B.jsx)(jf,{value:n.provider||`any`,onChange:e=>i({provider:e}),options:Pf,disabled:o})]})]})]}),(0,B.jsxs)(Af,{title:`Instructions`,defaultOpen:!1,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`System Prompt`}),(0,B.jsx)(zd,{value:n.instructions.system||``,onChange:e=>l({system:e.target.value}),placeholder:`Custom system prompt...`,rows:3,disabled:o,className:`font-mono text-xs`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Append Instructions`}),(0,B.jsx)(Vf,{values:n.instructions.append??[],onChange:e=>l({append:e}),disabled:o,placeholder:`Append instruction fragment`})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Repo Instructions`}),(0,B.jsx)(jf,{value:n.instructions.repoInstructions,onChange:e=>l({repoInstructions:e}),options:Lf,disabled:o})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Global Instructions`}),(0,B.jsx)(jf,{value:n.instructions.globalInstructions,onChange:e=>l({globalInstructions:e}),options:Lf,disabled:o})]})]})]}),(0,B.jsxs)(Af,{title:`Relay Integration`,defaultOpen:!1,children:[(0,B.jsxs)(`p`,{className:`rounded border border-border bg-muted/20 px-2 py-1.5 text-xs text-muted-foreground`,children:[`MCP comes from three independent sources — relay (`,(0,B.jsx)(`span`,{className:`font-medium text-foreground`,children:`MCP Tools`}),` below), the project (`,(0,B.jsx)(`span`,{className:`font-medium text-foreground`,children:`Project MCP`}),` in Provisioning Policies), and the host (`,(0,B.jsx)(`span`,{className:`font-medium text-foreground`,children:`MCP Mode`}),` in MCP & Hooks). Toggle each separately and mix freely.`]}),(0,B.jsx)(`div`,{className:`grid grid-cols-2 gap-3`,children:[`context`,`skills`,`plugins`,`statusLine`,`mcp`].map(e=>(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,B.jsx)(lf,{tip:zf[e],children:Bf[e]}),(0,B.jsx)(tl,{checked:n.relay[e]??!0,onCheckedChange:t=>u({[e]:t}),disabled:o})]},e))}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(lf,{tip:`Pick which subsets of relay's MCP tools the agent gets. No groups selected = the full relay tool surface.`,children:`Relay Tool Groups`}),(0,B.jsx)(`div`,{className:`mt-1 grid grid-cols-2 gap-1.5`,children:uf.map(e=>(0,B.jsxs)(`label`,{className:`flex items-center gap-2 rounded border border-border px-2 py-1 text-xs`,children:[(0,B.jsx)(`input`,{type:`checkbox`,className:`rounded`,checked:(n.relay.tools?.groups??[]).includes(e),onChange:t=>d(e,t.target.checked),disabled:o}),(0,B.jsx)(`span`,{className:`font-mono`,children:e})]},e))}),(0,B.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`No groups selected means full relay MCP tool surface.`})]})]}),(0,B.jsx)(Af,{title:`MCP & Hooks`,defaultOpen:!1,children:(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(lf,{tip:`The host's ambient MCP servers (your rig's configured MCP). Host = inherit them; None = no host MCP (clean, no bleed). Separate from relay's own MCP and the project's MCP.`,children:`MCP Mode`}),(0,B.jsx)(jf,{value:n.mcp.mode,onChange:e=>i({mcp:{...n.mcp,mode:e}}),options:Ff,disabled:o})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(lf,{tip:`The host's hook configuration. Host = inherit it; None = no host hooks.`,children:`Hooks Mode`}),(0,B.jsx)(jf,{value:n.hooks.mode,onChange:e=>i({hooks:{mode:e}}),options:Ff,disabled:o})]})]})}),(0,B.jsx)(Af,{title:`Provisioning Policies`,defaultOpen:!1,children:(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(lf,{tip:`Injects the MCP servers declared in the spawn directory's project .mcp.json, via relay's controlled config path (survives --strict-mcp-config, no trust modal). All = every declared server. This is the project's MCP source — distinct from relay's MCP Tools and the host's MCP Mode.`,children:`Project MCP`}),(0,B.jsx)(jf,{value:gf(n.projectMcp),onChange:f,options:df,disabled:o})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(lf,{tip:`Injects skills committed under the project's .claude/skills.`,children:`Project Skills`}),(0,B.jsx)(jf,{value:gf(n.projectSkills),onChange:p,options:df,disabled:o})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(lf,{tip:`Injects the project's .claude/settings.json (permission/security keys stripped).`,children:`Project Settings`}),(0,B.jsx)(jf,{value:gf(n.projectSettings),onChange:m,options:ff,disabled:o})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(lf,{tip:`Routes the agent's non-identity MCP through one shared orchestrator listener so the MCP session survives restarts and keeps correct worktree-cwd routing. A transport choice, not a source selector.`,children:`Shared MCP`}),(0,B.jsx)(jf,{value:gf(n.sharedMcp),onChange:h,options:df,disabled:o})]}),(0,B.jsxs)(`div`,{className:`col-span-2`,children:[(0,B.jsx)(lf,{tip:`How the agent's isolated branch lands: Direct (rebase/FF), Pull request, or the instance default.`,children:`Landing Strategy`}),(0,B.jsx)(jf,{value:n.landingStrategy??``,onChange:e=>i({landingStrategy:e||void 0}),options:pf,disabled:o})]})]})}),(0,B.jsx)(Af,{title:`Permissions`,defaultOpen:!1,children:(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Approval Mode`}),(0,B.jsx)(jf,{value:n.permissions.mode||``,onChange:e=>g({mode:e||void 0}),options:Rf,disabled:o})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Filesystem Scope`}),(0,B.jsx)(jf,{value:n.permissions.filesystem,onChange:e=>g({filesystem:e}),options:If,disabled:o})]})]})}),(0,B.jsx)(Af,{title:`Spawning`,defaultOpen:!1,children:(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Spawn Quota`}),(0,B.jsx)(L,{type:`number`,min:0,max:100,step:1,value:n.maxSpawnedAgents===void 0?``:String(n.maxSpawnedAgents),onChange:e=>v(e.target.value),placeholder:`0`,disabled:o}),(0,B.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Max concurrent live child agents this profile may spawn. Empty or 0 = cannot spawn (default). Children never inherit it (no grandchildren).`})]})}),(0,B.jsx)(Af,{title:`Environment Variables`,defaultOpen:!1,children:(0,B.jsx)(Mf,{env:n.env||{},onChange:e=>i({env:e}),disabled:o})}),(0,B.jsx)(Af,{title:`Registry Capabilities`,defaultOpen:!1,children:(0,B.jsx)(xf,{skills:n.skills??[],plugins:n.plugins??[],mcp:n.mcp,onChangeSkills:e=>i({skills:e}),onChangePlugins:e=>i({plugins:e}),onChangeMcp:e=>i({mcp:e}),projectMcp:n.projectMcp,projectSkills:n.projectSkills,projectSettings:n.projectSettings,sharedMcp:n.sharedMcp,readOnly:o})}),(0,B.jsx)(Af,{title:`Resolved Provisioning`,defaultOpen:t===`view`,children:(0,B.jsx)(Of,{profile:n})}),(0,B.jsxs)(Af,{title:`Provider Options`,defaultOpen:!1,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Codex Tool Output Limit`}),(0,B.jsx)(L,{type:`number`,min:1e3,max:2e5,value:x,onChange:e=>_(e.target.value),placeholder:`12000`,disabled:o})]}),(0,B.jsx)(zd,{value:JSON.stringify(n.providerOptions||{},null,2),onChange:e=>{try{i({providerOptions:JSON.parse(e.target.value)})}catch{}},rows:3,disabled:o,className:`font-mono text-xs`,placeholder:`{}`})]})]}),!o&&(0,B.jsxs)(Id,{children:[(0,B.jsx)(I,{variant:`outline`,onClick:r,children:`Cancel`}),(0,B.jsx)(I,{onClick:a,children:s?`Create`:`Save`})]})]})})}function Uf(){let e=A(e=>e.commandPaletteOpen),t=A(e=>e.commandQuery),n=A(e=>e.set),r=A(e=>e.closeCommandPalette),i=A(e=>e.runCommand),a=el(),o=(0,z.useRef)(null);return(0,z.useEffect)(()=>{e&&setTimeout(()=>o.current?.focus(),50)},[e]),e?(0,B.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-start justify-center pt-[15vh]`,onClick:e=>{e.target===e.currentTarget&&r()},children:[(0,B.jsx)(`div`,{className:`fixed inset-0 bg-black/60`}),(0,B.jsxs)(`div`,{className:`relative w-full max-w-lg bg-card border border-border rounded-xl shadow-2xl overflow-hidden`,children:[(0,B.jsx)(`div`,{className:`p-3 border-b border-border`,children:(0,B.jsx)(L,{ref:o,value:t,onChange:e=>n({commandQuery:e.target.value}),placeholder:`Type a command...`,className:`border-0 bg-transparent focus-visible:ring-0 text-base`})}),(0,B.jsxs)(`div`,{className:`max-h-80 overflow-y-auto p-2`,children:[a.map(e=>(0,B.jsxs)(`button`,{onClick:()=>i(e),className:`w-full flex items-center gap-3 px-3 py-2.5 rounded-lg hover:bg-accent text-left transition-colors`,children:[(0,B.jsx)(Qe[e.icon]||lt,{className:`w-4 h-4 text-muted-foreground shrink-0`}),(0,B.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,B.jsx)(`div`,{className:`text-sm`,children:e.title}),e.subtitle&&(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground truncate`,children:e.subtitle})]})]},e.id)),a.length===0&&(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground text-center py-4`,children:`No matching commands.`})]})]})]}):null}function Wf(){let e=A(e=>e.set),t=A(e=>e.connected);return(0,B.jsxs)(`div`,{className:`xl:hidden shrink-0 sticky top-0 z-30 bg-card border-b border-border px-4 h-[var(--header-h)] flex items-center gap-3`,children:[(0,B.jsx)(`button`,{onClick:()=>e({mobileMenuOpen:!0}),className:`p-1 -ml-1 text-muted-foreground hover:text-foreground transition-colors`,"aria-label":`Open menu`,children:(0,B.jsx)(Ce,{className:`w-5 h-5`})}),(0,B.jsx)(b,{className:`w-4 h-4 text-primary`}),(0,B.jsx)(`span`,{className:`font-bold text-sm`,children:`Agent Relay`}),(0,B.jsx)(`span`,{className:`ml-auto w-2 h-2 rounded-full ${t?`bg-emerald-500`:`bg-red-500 animate-pulse`}`})]})}function Gf(e){return e===`five_hour`?`5h burst`:e===`seven_day`?`7-day`:e===`seven_day_sonnet`?`7-day Sonnet`:e===`seven_day_opus`?`7-day Opus`:e===`primary`?`Primary`:e===`secondary`?`Secondary`:e}function Kf(e,t){if(!t)return``;let n=Math.max(0,(t-e)/1e3);if(n<60)return`${Math.floor(n)}s`;if(n<3600)return`${Math.floor(n/60)}m`;if(n<86400){let e=Math.floor(n/3600),t=Math.round(n%3600/60);return t===60?`${e+1}h`:t>0?`${e}h ${t}m`:`${e}h`}return`${Math.floor(n/86400)}d`}var qf=`agent-relay:quota-widget`,Jf=300*1e3;function Yf(e){return!e.quota&&e.lastError?.type===`unavailable`}function Xf(e,t){let n=t===`5h`?[`five_hour`,`primary`]:[`seven_day`,`secondary`];return e.quota?.windows.find(e=>n.includes(e.name))}function Zf(e,t){if(!t)return``;let n=Math.max(0,(t-e)/1e3);return n<3600?`${Math.floor(n/60)}m`:n<86400?`${Math.round(n/3600)}h`:`${(n/86400).toFixed(1).replace(/\.0$/,``)}d`}function Qf({record:e,now:t,advisory:n}){let r=(0,B.jsx)(mu,{provider:e.provider,className:`w-3.5 h-3.5`});if(Yf(e))return(0,B.jsxs)(`span`,{className:`flex items-center gap-1 shrink-0 text-muted-foreground`,children:[r,(0,B.jsx)(`span`,{className:`italic`,children:`unavailable`})]});if(!e.quota){let n=e.lastAttemptAt?j(t,e.lastAttemptAt):``,i=e.lastError?.retryAfterMs,a=i==null?null:Math.ceil(Math.max(0,(e.lastAttemptAt+i-t)/1e3));return(0,B.jsxs)(`span`,{className:`flex items-center gap-1 shrink-0 text-muted-foreground`,children:[r,n&&(0,B.jsx)(`span`,{children:n}),a!=null&&a>0&&(0,B.jsxs)(`span`,{className:`text-amber-400/70`,children:[`~`,a,`s`]})]})}let i=Xf(e,`5h`),a=Xf(e,`7d`);function o(e){if(!e)return null;let n=Math.round(e.utilization*100),r=Zf(t,e.resetsAt);return(0,B.jsxs)(`span`,{className:`tabular-nums`,children:[n,`%`,r?`/${r}`:``]})}let s=(e.stale||e.lastError)&&e.lastAttemptAt?j(t,e.lastAttemptAt):``;return(0,B.jsxs)(`span`,{className:`flex items-center gap-1.5 shrink-0 text-foreground/70`,children:[r,(0,B.jsx)(ip,{advisory:n}),o(i),o(a),s&&(0,B.jsx)(`span`,{className:`text-muted-foreground/70`,children:s})]})}function $f(){try{let e=localStorage.getItem(qf);return{open:!0,pinned:!1,...e?JSON.parse(e):{}}}catch{return{open:!0,pinned:!1}}}function ep(e){try{localStorage.setItem(qf,JSON.stringify(e))}catch{}}function tp(){let[{open:e,pinned:t},r]=(0,z.useState)($f),[i,a]=(0,z.useState)(null),[o,s]=(0,z.useState)(null),[c,l]=(0,z.useState)(null),[u,d]=(0,z.useState)(`loading`),f=ht(),p=A(e=>e.connected);(0,z.useEffect)(()=>{if(!p)return;let e=!1;async function t(){try{let[t,r,i]=await Promise.all([n(`GET`,`/provider-quotas`),n(`GET`,`/providers/quota-config`).catch(()=>null),n(`GET`,`/provider-quotas/advisory`).catch(()=>null)]);e||(a(t),s(r),l(i),d(`ok`))}catch{e||d(`error`)}}t();let r=setInterval(()=>void t(),Jf);return()=>{e=!0,clearInterval(r)}},[p,A(e=>e.quotaSeq)]);let m=e||t,h=(i?.quotas??[]).filter(e=>o?.[e.provider]?.showInWidget!==!1),g=h.some(e=>e.stale&&!Yf(e)),_=h.some(e=>e.lastError&&!Yf(e));function v(){if(t)return;let n={open:!e,pinned:t};r(n),ep(n)}function y(){let n=t?{open:e,pinned:!1}:{open:!0,pinned:!0};r(n),ep(n)}return(0,B.jsxs)(`div`,{className:`shrink-0 border-b border-border`,children:[(0,B.jsxs)(`div`,{className:`w-full flex items-center gap-2 px-4 py-2 text-xs hover:bg-muted/30 transition-colors`,children:[(0,B.jsxs)(`button`,{type:`button`,onClick:v,"aria-expanded":m,className:`min-w-0 flex flex-1 items-center gap-2 text-left`,children:[(0,B.jsx)(lt,{className:`w-3.5 h-3.5 shrink-0 text-muted-foreground transition-transform ${m?`rotate-90`:``}`}),(0,B.jsx)(`span`,{className:`font-semibold text-foreground/80 shrink-0 ${m?``:`hidden sm:inline`}`,children:`Provider Quotas`}),u===`loading`&&(0,B.jsx)(je,{className:`w-3 h-3 text-muted-foreground animate-spin`}),u===`error`&&(0,B.jsx)(`span`,{className:`text-amber-400 text-[10px]`,children:`● unavailable`}),!m&&u===`ok`&&h.length>0&&(0,B.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-0.5 text-[10px]`,children:h.map(e=>(0,B.jsx)(Qf,{record:e,now:f,advisory:c?.advisories[e.provider]},`${e.provider}:${e.accountKey}`))}),m&&g&&(0,B.jsx)(`span`,{className:`text-amber-400 text-[10px]`,children:`● stale`}),m&&_&&(0,B.jsx)(`span`,{className:`text-red-400 text-[10px]`,children:`● error`})]}),(0,B.jsx)(`button`,{type:`button`,onClick:y,"aria-pressed":t,title:t?`Unpin`:`Pin always-on`,className:`p-0.5 rounded hover:bg-muted transition-colors ${t?`text-primary`:`text-muted-foreground/50 hover:text-muted-foreground`}`,children:(0,B.jsx)(D,{className:`w-3 h-3`})})]}),m&&(0,B.jsxs)(`div`,{className:`px-4 py-3`,children:[u===`loading`&&(0,B.jsxs)(`p`,{className:`text-xs text-muted-foreground flex items-center gap-1.5`,children:[(0,B.jsx)(je,{className:`w-3 h-3 animate-spin`}),`Loading quota data…`]}),u===`error`&&(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Quota data unavailable — check that you are authenticated and the server is reachable.`}),u===`ok`&&i!==null&&h.length===0&&(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No quota data yet — waiting for runner to report.`}),u===`ok`&&i!==null&&h.length>0&&(0,B.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3`,children:h.map(e=>(0,B.jsx)(sp,{record:e,now:f,advisory:c?.advisories[e.provider]},`${e.provider}:${e.accountKey}`))})]})]})}var np={prefer:{icon:we,badge:`text-emerald-400 bg-emerald-500/10 border-emerald-500/20`,dot:`bg-emerald-400`},caution:{icon:E,badge:`text-amber-400 bg-amber-500/10 border-amber-500/20`,dot:`bg-amber-400`},"avoid-large":{icon:E,badge:`text-orange-400 bg-orange-500/10 border-orange-500/20`,dot:`bg-orange-400`},"hard-avoid":{icon:He,badge:`text-red-400 bg-red-500/10 border-red-500/20`,dot:`bg-red-400`}};function rp({advisory:e}){if(!e)return null;if(e.blockedNow)return(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-[9px] font-medium text-red-400 bg-red-500/10 border border-red-500/20 rounded px-1 py-0.5 shrink-0`,children:[(0,B.jsx)(ft,{className:`w-2.5 h-2.5`}),`blocked`]});let t=e.quotaPenaltyBand;if(t===`normal`)return null;let n=np[t],r=n.icon;return(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-[9px] font-medium ${n.badge} border rounded px-1 py-0.5 shrink-0`,children:[(0,B.jsx)(r,{className:`w-2.5 h-2.5`}),t]})}function ip({advisory:e}){if(!e)return null;if(e.blockedNow)return(0,B.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full bg-red-500 shrink-0`,title:`quota blocked`});let t=e.quotaPenaltyBand;return t===`normal`?null:(0,B.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full ${np[t].dot} shrink-0`,title:t})}function ap(e,t){if(!e||e.confidence===`low`||e.burnRatio===null)return null;let n=e.burnRatio.toFixed(1);return!e.earlyWallMs||e.earlyWallMs<=0?`${n}× rate`:`${n}× · ~${Kf(t,t+e.earlyWallMs)} before reset`}function op({burnWindow:e,now:t}){if(!e)return null;if(e.confidence===`low`||e.burnRatio===null)return(0,B.jsxs)(`div`,{className:`flex items-center gap-1 text-[9px] text-muted-foreground/50`,children:[(0,B.jsx)(Ke,{className:`w-2.5 h-2.5 shrink-0`}),(0,B.jsx)(`span`,{className:`italic`,children:`building burn history…`})]});let n=ap(e,t);return n?(0,B.jsxs)(`div`,{className:`flex items-center gap-1 text-[9px] text-muted-foreground/70 tabular-nums`,children:[(0,B.jsx)(E,{className:`w-2.5 h-2.5 shrink-0`}),(0,B.jsx)(`span`,{children:n})]}):null}function sp({record:e,now:t,advisory:n}){let{provider:r,accountKey:i,quota:a,stale:o,lastError:s,lastUpdatedAt:c,lastAttemptAt:l}=e;if(Yf(e))return(0,B.jsxs)(`div`,{className:`rounded border border-border bg-muted/20 p-3 space-y-1.5 opacity-70`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 min-w-0`,children:[(0,B.jsx)(mu,{provider:r,className:`w-3.5 h-3.5 text-muted-foreground`}),(0,B.jsx)(`span`,{className:`text-[9px] font-medium text-muted-foreground bg-muted border border-border rounded px-1 py-0.5 shrink-0`,children:`unavailable`})]}),(0,B.jsxs)(`p`,{className:`text-[10px] text-muted-foreground`,children:[`Quota unavailable — `,s?.message??`no readable credentials`]})]});let u=s?.retryAfterMs,d=u==null?null:Math.max(0,l+u-t),f=d==null?null:Math.ceil(d/1e3),p=(o||!!s)&&l>0;return(0,B.jsxs)(`div`,{className:`rounded border ${s?`border-red-500/30`:o?`border-amber-500/30`:`border-border`} bg-card p-3 space-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 min-w-0`,children:[(0,B.jsx)(mu,{provider:r,className:`w-3.5 h-3.5`}),(0,B.jsx)(`span`,{className:`text-[10px] text-muted-foreground font-mono truncate`,children:i})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,B.jsx)(rp,{advisory:n}),o&&(0,B.jsx)(`span`,{className:`text-[9px] font-medium text-amber-400 bg-amber-500/10 border border-amber-500/20 rounded px-1 py-0.5`,children:`stale`}),s&&(0,B.jsx)(`span`,{className:`text-[9px] font-medium text-red-400 bg-red-500/10 border border-red-500/20 rounded px-1 py-0.5`,title:s.message,children:s.type===`rate_limited`?`429`:`err`})]})]}),a?(0,B.jsx)(`div`,{className:`space-y-1.5`,children:a.windows.map(n=>{let r=Math.round(n.utilization*100),i=r>=90?`bg-red-500`:r>=70?`bg-amber-500`:`bg-emerald-500`,a=n.resetsAt?Kf(t,n.resetsAt):``,o=e.burn?.windows.find(e=>e.name===n.name);return(0,B.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,B.jsxs)(`div`,{className:`flex justify-between text-[10px] text-muted-foreground`,children:[(0,B.jsx)(`span`,{children:Gf(n.name)}),(0,B.jsxs)(`span`,{children:[r,`%`,a?` · resets in ${a}`:``]})]}),(0,B.jsx)(`div`,{className:`h-1.5 rounded-full bg-muted overflow-hidden`,children:(0,B.jsx)(`div`,{className:`h-full ${i} transition-all duration-500`,style:{width:`${Math.max(0,Math.min(100,r))}%`}})}),(0,B.jsx)(op,{burnWindow:o,now:t})]},n.name)})}):(0,B.jsx)(`p`,{className:`text-[10px] text-muted-foreground italic`,children:s?s.message:`No quota data`}),(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-2 text-[10px] text-muted-foreground/60`,children:[(0,B.jsxs)(`div`,{className:`space-y-0.5 min-w-0`,children:[p&&(0,B.jsxs)(`div`,{children:[`Attempted `,j(t,l)]}),(0,B.jsx)(`div`,{children:c?`Updated ${j(t,c)}`:`Never updated`})]}),f!=null&&(0,B.jsx)(`span`,{className:`text-amber-400/70 shrink-0 mt-0.5`,children:f>0?`retry in ~${f>60?`${Math.ceil(f/60)}m`:`${f}s`}`:`retrying…`})]})]})}function cp(e){return(0,z.lazy)(()=>Gn(e))}var lp=cp(()=>R(()=>import(`./overview-CnGkrBNe.js`).then(e=>({default:e.OverviewView})),__vite__mapDeps([16,1,6,8,9,10,17,12,18]),import.meta.url)),up=cp(()=>R(()=>import(`./chat-patMKjsi.js`).then(e=>({default:e.ChatView})),__vite__mapDeps([19,1,6,20,8,9,10,21,22,23,24,25,11,12,17,26,13]),import.meta.url)),dp=cp(()=>R(()=>import(`./agents-szyYnkgD.js`).then(e=>({default:e.AgentsView})),__vite__mapDeps([27,1,28,29,6,12,30,20,31,32,33,34,35,8,9,10,24,25,11,17,18]),import.meta.url)),fp=cp(()=>R(()=>import(`./managed-agents-DpX-cHsm.js`).then(e=>({default:e.ManagedAgentsView})),__vite__mapDeps([36,1,6,8,9,10,25,11,12,17]),import.meta.url)),pp=cp(()=>R(()=>import(`./teams-CMteOToR.js`).then(e=>({default:e.TeamsView})),__vite__mapDeps([37,1,38,28,29,6,12,30,20,31,32,39,40,41,33,35,42,8,9,10,23,17,11,18,26]),import.meta.url)),mp=cp(()=>R(()=>import(`./agent-profiles-CSISRm_L.js`).then(e=>({default:e.AgentProfilesView})),__vite__mapDeps([43,1,6,8,9,10,17,12,11]),import.meta.url)),hp=cp(()=>R(()=>import(`./orchestrators-D3LecmEw.js`).then(e=>({default:e.OrchestratorsView})),__vite__mapDeps([44,6,1,8,9,10,17,12,11,18]),import.meta.url)),gp=cp(()=>R(()=>import(`./workspaces-CccVI6lA.js`).then(e=>({default:e.WorkspacesView})),__vite__mapDeps([45,1,6,8,9,10,25,11,12,17,18]),import.meta.url)),_p=cp(()=>R(()=>import(`./channels-Dh_r7SnM.js`).then(e=>({default:e.ChannelsView})),__vite__mapDeps([46,6,1,8,9,10,17,12,11,18]),import.meta.url)),vp=cp(()=>R(()=>import(`./connectors-DVKBHNRV.js`).then(e=>({default:e.ConnectorsView})),__vite__mapDeps([47,6,1,8,9,10,17,12,11,18]),import.meta.url)),yp=cp(()=>R(()=>import(`./integrations-AW8b4h7T.js`).then(e=>({default:e.IntegrationsView})),__vite__mapDeps([48,6,1,8,9,10,17,12,11,18]),import.meta.url)),bp=cp(()=>R(()=>import(`./security-BMh_y43L.js`).then(e=>({default:e.SecurityView})),__vite__mapDeps([49,1,6,25,11,12,17,18,26]),import.meta.url)),xp=cp(()=>R(()=>import(`./memory-b2AgvV7H.js`).then(e=>({default:e.MemoryView})),__vite__mapDeps([50,1,6,8,9,10,17,12,11,18,26]),import.meta.url)),Sp=cp(()=>R(()=>import(`./activity-D5EZw4bj.js`).then(e=>({default:e.ActivityView})),__vite__mapDeps([51,1,6,8,9,10,21,22,17,12,11,18]),import.meta.url)),Cp=cp(()=>R(()=>import(`./pairs-DXUdZOqn.js`).then(e=>({default:e.PairsView})),__vite__mapDeps([52,6,1,8,9,10,17,12,11,18]),import.meta.url)),wp=cp(()=>R(()=>import(`./messages-C5yDD_oq.js`).then(e=>({default:e.MessagesView})),__vite__mapDeps([53,1,6,8,9,10,17,12,11,18]),import.meta.url)),Tp=cp(()=>R(()=>import(`./work-queue-DqW80DIy.js`).then(e=>({default:e.WorkQueueView})),__vite__mapDeps([54,6,1,8,9,10,17,12,11,18]),import.meta.url)),Ep=cp(()=>R(()=>import(`./tasks-BybIAX-y.js`).then(e=>({default:e.TasksView})),__vite__mapDeps([55,1,6,8,9,10,17,12,11,18]),import.meta.url)),Dp=cp(()=>R(()=>import(`./automation-DVSq4A1b.js`).then(e=>({default:e.AutomationView})),__vite__mapDeps([56,1,6,8,9,10,17,12,11,18,26]),import.meta.url)),Op=cp(()=>R(()=>import(`./analytics-KzLQfGMO.js`).then(e=>({default:e.AnalyticsView})),__vite__mapDeps([57,1,6,8,9,10,18,58]),import.meta.url)),kp=cp(()=>R(()=>import(`./insights-D2_Qry06.js`).then(e=>({default:e.InsightsView})),__vite__mapDeps([59,1,6,17,12,11,18,26,9,10]),import.meta.url)),Ap=cp(()=>R(()=>import(`./projects-1h41atqJ.js`).then(e=>({default:e.ProjectsView})),__vite__mapDeps([60,1,6,8,9,10,25,11,12,17,18]),import.meta.url)),jp=cp(()=>R(()=>import(`./registry-BeGP37ot.js`).then(e=>({default:e.RegistryView})),__vite__mapDeps([61,1,6,17,12,11,18,26,10]),import.meta.url)),Mp=cp(()=>R(()=>import(`./maintenance-Dm56u8F9.js`).then(e=>({default:e.MaintenanceView})),__vite__mapDeps([62,1,6,8,9,10,17,12,11]),import.meta.url)),Np=cp(()=>R(()=>import(`./settings-DKSEwIVG.js`).then(e=>({default:e.SettingsView})),__vite__mapDeps([63,1,38,28,29,6,12,30,20,31,32,39,40,41,33,35,42,8,9,10,22,17,11,18,26,58]),import.meta.url)),Pp=class extends z.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`[ErrorBoundary]`,e.message,`
|
|
21
|
+
`)})]})]})}function Ed(e){if(!en(e)||typeof e.lastError!=`string`)return null;let t=en(e.systemd)?{unit:typeof e.systemd.unit==`string`?e.systemd.unit:void 0,activeState:typeof e.systemd.activeState==`string`?e.systemd.activeState:void 0,subState:typeof e.systemd.subState==`string`?e.systemd.subState:void 0,result:typeof e.systemd.result==`string`?e.systemd.result:void 0,execMainCode:typeof e.systemd.execMainCode==`string`?e.systemd.execMainCode:void 0,execMainStatus:typeof e.systemd.execMainStatus==`string`?e.systemd.execMainStatus:void 0}:void 0;return{lastError:e.lastError,detectedAt:typeof e.detectedAt==`number`?e.detectedAt:void 0,runtimeMs:typeof e.runtimeMs==`number`?e.runtimeMs:void 0,logFile:typeof e.logFile==`string`?e.logFile:void 0,logBytes:typeof e.logBytes==`number`?e.logBytes:void 0,logEmpty:typeof e.logEmpty==`boolean`?e.logEmpty:void 0,logTail:Array.isArray(e.logTail)?e.logTail.filter(e=>typeof e==`string`):void 0,systemd:t,unavailable:Array.isArray(e.unavailable)?e.unavailable.filter(e=>typeof e==`string`):void 0}}function Dd({className:e,children:t,...n}){return(0,B.jsxs)(us,{"data-slot":`scroll-area`,className:O(`relative`,e),...n,children:[(0,B.jsx)(ds,{"data-slot":`scroll-area-viewport`,className:`size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1`,children:t}),(0,B.jsx)(Od,{}),(0,B.jsx)(fs,{})]})}function Od({className:e,orientation:t=`vertical`,...n}){return(0,B.jsx)(Ro,{"data-slot":`scroll-area-scrollbar`,"data-orientation":t,orientation:t,className:O(`flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent`,e),...n,children:(0,B.jsx)(Yo,{"data-slot":`scroll-area-thumb`,className:`relative flex-1 rounded-full bg-border`})})}function kd(){let e=A(e=>e.channelDetailOpen),t=A(e=>e.channelDetailId),n=A(e=>e.channels),r=A(e=>e.messages),i=A(e=>e.agentsById),a=ht(),o=A(e=>e.closeChannelDetail),s=n.find(e=>e.id===t)||null,c=Nt(s),l=(0,z.useMemo)(()=>s?r.filter(e=>Rt(e,s)).sort((e,t)=>t.id-e.id).slice(0,8):[],[r,s]);return(0,B.jsx)(Ql,{open:e,onOpenChange:e=>!e&&o(),children:(0,B.jsxs)(tu,{className:`w-full max-w-[100dvw] sm:max-w-md lg:max-w-lg p-0`,children:[(0,B.jsx)(nu,{className:`shrink-0 p-4 border-b border-border`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,B.jsx)(F,{className:wt(c.tone),children:c.label}),(0,B.jsx)(ru,{className:`text-base truncate`,children:s?.name||`Channel`})]})}),(0,B.jsx)(Dd,{className:`flex-1 min-h-0`,children:(0,B.jsxs)(`div`,{className:`p-4 space-y-4`,children:[s&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium mb-2`,children:`Route`}),(0,B.jsxs)(`div`,{className:`space-y-1 text-sm`,children:[(0,B.jsxs)(`div`,{className:`flex justify-between gap-2`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground shrink-0`,children:`Type`}),(0,B.jsx)(`span`,{className:`truncate`,children:s.type})]}),(0,B.jsxs)(`div`,{className:`flex justify-between gap-2`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground shrink-0`,children:`Direction`}),(0,B.jsx)(`span`,{className:`truncate`,children:s.direction})]}),s.target&&(0,B.jsxs)(`div`,{className:`flex justify-between gap-2`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground shrink-0`,children:`Target`}),(0,B.jsx)(`span`,{className:`truncate`,children:s.target})]}),(0,B.jsxs)(`div`,{className:`flex justify-between gap-2`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground shrink-0`,children:`Agent`}),(0,B.jsx)(`span`,{className:`truncate`,children:s.agentId})]}),(0,B.jsxs)(`div`,{className:`flex justify-between gap-2`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground shrink-0`,children:`Transport`}),(0,B.jsx)(`span`,{className:`truncate`,children:s.transport})]}),(0,B.jsxs)(`div`,{className:`flex justify-between gap-2`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground shrink-0`,children:`Last seen`}),(0,B.jsx)(`span`,{className:`shrink-0`,children:j(a,s.lastSeen)})]})]})]}),jt(s.capabilities).length>0&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(nl,{}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium mb-2`,children:`Capabilities`}),(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:jt(s.capabilities).map(e=>(0,B.jsx)(F,{variant:`secondary`,className:`text-[10px]`,children:e},e))})]})]}),s.meta&&Object.keys(s.meta).length>0&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(nl,{}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium mb-2`,children:`Metadata`}),(0,B.jsx)(`div`,{className:`space-y-1 text-sm`,children:Object.entries(s.meta).map(([e,t])=>(0,B.jsxs)(`div`,{className:`flex justify-between gap-2 min-w-0`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground shrink-0`,children:e}),(0,B.jsx)(`span`,{className:`truncate`,children:String(t)})]},e))})]})]})]}),l.length>0&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(nl,{}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium mb-2`,children:`Recent Messages`}),(0,B.jsx)(`div`,{className:`space-y-2`,children:l.map(e=>(0,B.jsxs)(`div`,{className:`rounded border border-border p-2 text-xs space-y-0.5 min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1 text-muted-foreground min-w-0`,children:[(0,B.jsx)(`span`,{className:`font-medium text-foreground truncate shrink-0 max-w-[40%]`,children:Ft(e.from,i)}),(0,B.jsx)(`span`,{className:`shrink-0`,children:`→`}),(0,B.jsx)(`span`,{className:`truncate max-w-[40%]`,children:Ft(e.to,i)}),(0,B.jsxs)(`span`,{className:`ml-auto shrink-0 text-[10px]`,children:[(0,B.jsxs)(`span`,{className:`opacity-40 mr-1`,children:[`#`,e.id]}),j(a,e.createdAt)]})]}),(0,B.jsx)(`div`,{className:`text-foreground whitespace-pre-wrap break-words line-clamp-3`,children:zt(e)})]},e.id))})]})]})]})})]})})}var Ad=!1;function jd(e,t){let n=z.useRef(!1),r=z.useRef(t);r.current=t,z.useEffect(()=>{if(!e||!r.current)return;Ad=!1,window.history.pushState({dialogGuard:!0},``),n.current=!0;function t(){if(Ad){Ad=!1;return}n.current&&(n.current=!1,r.current?.(!1))}return window.addEventListener(`popstate`,t),()=>{window.removeEventListener(`popstate`,t),n.current&&(n.current=!1,Ad=!0,window.history.back())}},[e])}function Md({...e}){return jd(e.open,e.onOpenChange),(0,B.jsx)(Ar,{"data-slot":`dialog`,...e})}function Nd({...e}){return(0,B.jsx)(jr,{"data-slot":`dialog-portal`,...e})}function Pd({className:e,blur:t=!0,...n}){return(0,B.jsx)(Mr,{"data-slot":`dialog-overlay`,className:O(`fixed inset-0 isolate z-50 bg-black/10 duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,t&&`supports-backdrop-filter:backdrop-blur-xs`,e),...n})}function Fd({className:e,children:t,showCloseButton:n=!0,blurOverlay:r=!0,...i}){return(0,B.jsxs)(Nd,{children:[(0,B.jsx)(Pd,{blur:r}),(0,B.jsxs)(Nr,{"data-slot":`dialog-content`,className:O(`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...i,children:[t,n&&(0,B.jsx)(Ir,{"data-slot":`dialog-close`,asChild:!0,children:(0,B.jsxs)(I,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`,children:[(0,B.jsx)(Fe,{}),(0,B.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})]})]})}function Q({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`dialog-header`,className:O(`flex flex-col gap-2`,e),...t})}function Id({className:e,showCloseButton:t=!1,children:n,...r}){return(0,B.jsxs)(`div`,{"data-slot":`dialog-footer`,className:O(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,B.jsx)(Ir,{asChild:!0,children:(0,B.jsx)(I,{variant:`outline`,children:`Close`})})]})}function Ld({className:e,...t}){return(0,B.jsx)(Pr,{"data-slot":`dialog-title`,className:O(`font-heading text-base leading-none font-medium`,e),...t})}function Rd({className:e,...t}){return(0,B.jsx)(Fr,{"data-slot":`dialog-description`,className:O(`text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function zd({className:e,...t}){return(0,B.jsx)(`textarea`,{"data-slot":`textarea`,className:O(`flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...t})}function $({className:e,...t}){return(0,B.jsx)(Do,{"data-slot":`label`,className:O(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function Bd(){let e=A(e=>e.composeOpen),t=A(e=>e.compose),n=A(e=>e.replyTo),r=A(e=>e.set),i=A(e=>e.doSend),a=A(e=>e.cancelReply),o=Xc();function s(){r({composeOpen:!1}),a()}function c(e){r({compose:{...t,...e}})}return(0,B.jsx)(Md,{open:e,onOpenChange:e=>!e&&s(),children:(0,B.jsxs)(Fd,{className:`max-w-lg`,children:[(0,B.jsx)(Q,{children:(0,B.jsx)(Ld,{children:n?`Reply to #${n.id}`:`Compose Message`})}),(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`From`}),(0,B.jsxs)(`select`,{className:`w-full mt-1 rounded-md border border-input bg-background px-3 py-2 text-sm`,value:t.from,onChange:e=>c({from:e.target.value}),children:[(0,B.jsx)(`option`,{value:``,children:`Select agent...`}),o.map(e=>(0,B.jsx)(`option`,{value:e.id,children:M(e)},e.id))]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`To`}),(0,B.jsx)(L,{value:t.to,onChange:e=>c({to:e.target.value}),placeholder:`agent-id, tag:name, cap:name, or broadcast`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Subject`}),(0,B.jsx)(L,{value:t.subject,onChange:e=>c({subject:e.target.value}),placeholder:`Optional subject...`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Channel`}),(0,B.jsx)(L,{value:t.channel,onChange:e=>c({channel:e.target.value}),placeholder:`Optional channel...`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Message`}),(0,B.jsx)(zd,{value:t.body,onChange:e=>c({body:e.target.value}),rows:4,placeholder:`Message body...`,autoFocus:!0})]}),(0,B.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(tl,{checked:t.claimable,onCheckedChange:e=>c({claimable:e})}),(0,B.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Claimable task`})]})]}),(0,B.jsxs)(Id,{children:[(0,B.jsx)(I,{variant:`outline`,onClick:s,children:`Cancel`}),(0,B.jsx)(I,{onClick:i,children:`Send`})]})]})})}function Vd(){let e=A(e=>e.confirmModal),t=A(e=>e.set);function n(){t({confirmModal:{show:!1,title:``,message:``,action:null}})}return(0,B.jsx)(Md,{open:e.show,onOpenChange:e=>!e&&n(),children:(0,B.jsxs)(Fd,{className:`sm:max-w-sm`,children:[(0,B.jsxs)(Q,{children:[(0,B.jsx)(Ld,{children:e.title}),(0,B.jsx)(Rd,{children:e.message})]}),(0,B.jsxs)(Id,{children:[(0,B.jsx)(I,{variant:`outline`,onClick:n,children:`Cancel`}),(0,B.jsx)(I,{variant:`destructive`,onClick:()=>{e.action?.(),n()},children:`Confirm`})]})]})})}function Hd(){let e=A(e=>e.errorModal),t=A(e=>e.set);function n(){t({errorModal:{show:!1,title:``,message:``}})}return(0,B.jsx)(Md,{open:e.show,onOpenChange:e=>!e&&n(),children:(0,B.jsxs)(Fd,{className:`sm:max-w-sm`,children:[(0,B.jsxs)(Q,{children:[(0,B.jsx)(Ld,{children:e.title}),(0,B.jsx)(Rd,{children:e.message})]}),(0,B.jsx)(Id,{children:(0,B.jsx)(I,{onClick:n,children:`OK`})})]})})}function Ud(){let e=A(e=>e.renameModal),t=A(e=>e.set),n=A(e=>e.doRename);function r(){t({renameModal:{show:!1,agentId:``,label:``}})}return(0,B.jsx)(Md,{open:e.show,onOpenChange:e=>!e&&r(),children:(0,B.jsxs)(Fd,{className:`sm:max-w-sm`,children:[(0,B.jsx)(Q,{children:(0,B.jsx)(Ld,{children:`Rename Agent`})}),(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)($,{children:`Label`}),(0,B.jsx)(L,{value:e.label,onChange:n=>t({renameModal:{...e,label:n.target.value}}),onKeyDown:e=>e.key===`Enter`&&n(),placeholder:`Human-friendly name...`,autoFocus:!0}),(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Leave empty to clear the label.`})]}),(0,B.jsxs)(Id,{children:[(0,B.jsx)(I,{variant:`outline`,onClick:r,children:`Cancel`}),(0,B.jsx)(I,{onClick:n,children:`Save`})]})]})})}function Wd(){let e=A(e=>e.pairInviteOpen),t=A(e=>e.pairInvite),n=A(e=>e.set),r=A(e=>e.closePairInvite),i=A(e=>e.doCreatePair),a=Xc();function o(e){n({pairInvite:{...t,...e}})}return(0,B.jsx)(Md,{open:e,onOpenChange:e=>!e&&r(),children:(0,B.jsxs)(Fd,{className:`sm:max-w-sm`,children:[(0,B.jsx)(Q,{children:(0,B.jsx)(Ld,{children:`Pair Agents`})}),(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Requester`}),(0,B.jsxs)(`select`,{className:`w-full mt-1 rounded-md border border-input bg-background px-3 py-2 text-sm`,value:t.requesterId,onChange:e=>o({requesterId:e.target.value}),children:[(0,B.jsx)(`option`,{value:``,children:`Select agent...`}),a.map(e=>(0,B.jsx)(`option`,{value:e.id,children:M(e)},e.id))]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Target`}),(0,B.jsxs)(`select`,{className:`w-full mt-1 rounded-md border border-input bg-background px-3 py-2 text-sm`,value:t.targetId,onChange:e=>o({targetId:e.target.value}),children:[(0,B.jsx)(`option`,{value:``,children:`Select agent...`}),a.map(e=>(0,B.jsx)(`option`,{value:e.id,children:M(e)},e.id))]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Objective`}),(0,B.jsx)(L,{value:t.objective,onChange:e=>o({objective:e.target.value}),placeholder:`What should they work on?`})]})]}),(0,B.jsxs)(Id,{children:[(0,B.jsx)(I,{variant:`outline`,onClick:r,children:`Cancel`}),(0,B.jsx)(I,{onClick:i,children:`Create Pair`})]})]})})}function Gd(){let e=A(e=>e.pairMessageOpen),t=A(e=>e.pairMessage),n=A(e=>e.set),r=A(e=>e.closePairMessage),i=A(e=>e.doSendPairMessage);function a(e){n({pairMessage:{...t,...e}})}return(0,B.jsx)(Md,{open:e,onOpenChange:e=>!e&&r(),children:(0,B.jsxs)(Fd,{className:`sm:max-w-sm`,children:[(0,B.jsx)(Q,{children:(0,B.jsx)(Ld,{children:`Pair Message`})}),(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Subject`}),(0,B.jsx)(L,{value:t.subject,onChange:e=>a({subject:e.target.value}),placeholder:`Optional subject...`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Message`}),(0,B.jsx)(zd,{value:t.body,onChange:e=>a({body:e.target.value}),rows:4,placeholder:`Message body...`,autoFocus:!0})]})]}),(0,B.jsxs)(Id,{children:[(0,B.jsx)(I,{variant:`outline`,onClick:r,children:`Cancel`}),(0,B.jsx)(I,{onClick:i,children:`Send`})]})]})})}var Kd=(0,z.lazy)(()=>R(()=>import(`./formatted-body-impl-BTeCfK4I.js`).then(e=>({default:e.FormattedBody})),__vite__mapDeps([15,1,5,3,6,8,9,10]),import.meta.url));function qd(e){return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(`span`,{className:e.className,children:e.text}),children:(0,B.jsx)(Kd,{...e})})}function Jd(){let e=A(e=>e.threadOpen),t=A(e=>e.threadMessages),n=A(e=>e.agentsById),r=ht(),i=A(e=>e.set);return(0,B.jsx)(Md,{open:e,onOpenChange:e=>!e&&i({threadOpen:!1}),children:(0,B.jsxs)(Fd,{className:`max-w-2xl max-h-[80vh]`,children:[(0,B.jsx)(Q,{children:(0,B.jsxs)(Ld,{children:[`Thread (`,t.length,` messages)`]})}),(0,B.jsx)(Dd,{className:`max-h-[60vh]`,children:(0,B.jsx)(`div`,{className:`space-y-3 pr-4`,children:t.map(e=>(0,B.jsxs)(`div`,{className:`rounded-lg border border-border p-3 space-y-1`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,B.jsx)(`span`,{className:`font-medium`,children:Ft(e.from,n)}),(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`→`}),(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:Ft(e.to,n)}),(0,B.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:j(r,e.createdAt)})]}),e.subject&&(0,B.jsx)(`div`,{className:`text-sm font-medium`,children:e.subject}),(0,B.jsx)(qd,{text:zt(e),rawBody:e.body,issueRepo:n[e.from===`user`?e.to:e.from]?.issueRepo,className:`text-sm text-muted-foreground`}),(0,B.jsxs)(`div`,{className:`flex gap-1.5 flex-wrap`,children:[e.channel&&(0,B.jsx)(F,{variant:`secondary`,className:`text-[10px]`,children:e.channel}),e.claimedBy&&(0,B.jsxs)(F,{variant:`secondary`,className:`text-[10px]`,children:[`claimed by `,Ft(e.claimedBy,n)]})]})]},e.id))})})]})})}function Yd(){let e=A(e=>e.taskEventsOpen),t=A(e=>e.taskEvents),n=A(e=>e.set),r=A(e=>e.switchView);function i(e){n({selectedMemoryId:e,taskEventsOpen:!1}),r(`memory`)}return(0,B.jsx)(Md,{open:e,onOpenChange:e=>!e&&n({taskEventsOpen:!1}),children:(0,B.jsxs)(Fd,{className:`max-w-2xl max-h-[80vh]`,children:[(0,B.jsx)(Q,{children:(0,B.jsxs)(Ld,{children:[`Task Events (`,t.length,`)`]})}),(0,B.jsx)(Dd,{className:`max-h-[60vh]`,children:(0,B.jsxs)(`div`,{className:`space-y-2 pr-4`,children:[t.map(e=>(0,B.jsxs)(`div`,{className:`flex items-start gap-3 rounded-lg border border-border p-3`,children:[(0,B.jsx)(F,{className:Pt[e.severity]||Pt.info,children:e.severity}),(0,B.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`text-sm font-medium`,children:e.title}),(0,B.jsx)(F,{variant:`outline`,className:`text-[10px]`,children:e.type})]}),e.body&&(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1 whitespace-pre-wrap`,children:e.body}),(0,B.jsx)(Xd,{event:e,onOpen:i}),(0,B.jsxs)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[It(e.createdAt),` · `,e.source]})]})]},e.id)),t.length===0&&(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground text-center py-8`,children:`No events recorded.`})]})})]})})}function Xd({event:e,onOpen:t}){if(e.type!==`memory.captured`)return null;let n=typeof e.metadata?.memoryId==`string`?e.metadata.memoryId:``,r=e.metadata?.memory&&typeof e.metadata.memory==`object`&&!Array.isArray(e.metadata.memory)?e.metadata.memory:{},i=typeof r.title==`string`?r.title:e.body||n,a=typeof r.scope==`string`?r.scope:``,o=typeof r.type==`string`?r.type:`memory`,s=typeof r.sensitivity==`string`?r.sensitivity:``;return(0,B.jsx)(`div`,{className:`mt-2 rounded-md border border-border bg-muted/20 p-2 text-xs`,children:(0,B.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,B.jsx)(Re,{className:`w-3.5 h-3.5 mt-0.5 text-muted-foreground shrink-0`}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-1 mb-1`,children:[(0,B.jsx)(F,{variant:`secondary`,className:`text-[10px]`,children:o}),a&&(0,B.jsx)(F,{variant:`outline`,className:`text-[10px] font-mono`,children:a}),s&&(0,B.jsx)(F,{variant:`outline`,className:`text-[10px]`,children:s})]}),(0,B.jsx)(`div`,{className:`font-medium truncate`,children:i}),n&&(0,B.jsx)(`div`,{className:`font-mono text-[10px] text-muted-foreground truncate`,children:n})]}),n&&(0,B.jsx)(I,{size:`sm`,variant:`outline`,className:`h-7 text-xs shrink-0`,onClick:()=>t(n),children:`Open`})]})})}function Zd({open:e,onOpenChange:t,onSelect:n,orchestratorId:r,initialPath:i,title:a=`Select Directory`}){let o=A(e=>e.apiCall),[s,c]=(0,z.useState)(!1),[l,d]=(0,z.useState)(null),[f,p]=(0,z.useState)(null),[m,g]=(0,z.useState)(!1),[_,v]=(0,z.useState)(``),[y,b]=(0,z.useState)(null),x=l?.path||i||``,S=(0,z.useMemo)(()=>x.split(`/`).filter(Boolean),[x]),C=(0,z.useCallback)(async e=>{if(r){c(!0),p(null),g(!1);try{let t=e?`?path=${encodeURIComponent(e)}`:``;d(await o(`GET`,`/orchestrators/${encodeURIComponent(r)}/directories${t}`))}catch(e){p($t(e))}finally{c(!1)}}},[r,o]);(0,z.useEffect)(()=>{e&&r&&(d(null),p(null),g(!1),C(i||void 0))},[e,r]);async function te(){if(!(!_.trim()||!l)){b(null);try{d(await o(`POST`,`/orchestrators/${encodeURIComponent(r)}/directories`,{path:l.path,name:_.trim()})),g(!1),v(``)}catch(e){b($t(e))}}}function ne(){x&&(n(x),t(!1))}function re(e){C(`/`+S.slice(0,e+1).join(`/`))}return(0,B.jsx)(Md,{open:e,onOpenChange:t,children:(0,B.jsxs)(Fd,{className:`max-w-lg max-h-[85dvh] flex flex-col`,children:[(0,B.jsx)(Q,{children:(0,B.jsxs)(Ld,{className:`flex items-center gap-2`,children:[(0,B.jsx)(h,{className:`h-4 w-4`}),a]})}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-border bg-muted/50 px-2 py-1.5 text-xs overflow-x-auto`,children:[(0,B.jsx)(`button`,{type:`button`,className:`font-mono text-muted-foreground hover:text-foreground shrink-0`,onClick:()=>l?.baseDir&&C(l.baseDir),children:`/`}),S.map((e,t)=>(0,B.jsxs)(`span`,{className:`shrink-0`,children:[(0,B.jsx)(`button`,{type:`button`,className:`font-mono text-muted-foreground hover:text-foreground`,onClick:()=>re(t),children:e}),t<S.length-1&&(0,B.jsx)(`span`,{className:`text-muted-foreground/50 mx-0.5`,children:`/`})]},`${e}-${t}`))]}),(0,B.jsxs)(`div`,{className:`flex-1 min-h-0 rounded-md border border-border bg-background overflow-y-auto`,style:{maxHeight:`40dvh`},children:[s&&(0,B.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,B.jsx)(je,{className:`h-5 w-5 animate-spin text-muted-foreground`})}),!s&&f&&(0,B.jsx)(`div`,{className:`px-3 py-4 text-sm text-destructive`,children:f}),!s&&l&&(0,B.jsxs)(`div`,{className:`p-1`,children:[l.parent&&(0,B.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm hover:bg-muted`,onClick:()=>C(l.parent),children:[(0,B.jsx)($e,{className:`h-4 w-4 text-muted-foreground`}),(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`..`})]}),l.entries.map(e=>(0,B.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm hover:bg-muted`,onClick:()=>C(e.path),children:[(0,B.jsx)(ee,{className:`h-4 w-4 text-muted-foreground`}),(0,B.jsx)(`span`,{className:`truncate`,children:e.name})]},e.path)),l.entries.length===0&&!l.parent&&(0,B.jsx)(`div`,{className:`px-2 py-4 text-sm text-muted-foreground text-center`,children:`Empty directory`}),l.entries.length===0&&l.parent&&(0,B.jsx)(`div`,{className:`px-2 py-4 text-sm text-muted-foreground text-center`,children:`No subdirectories`})]})]}),m?(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsx)(L,{autoFocus:!0,value:_,onChange:e=>{v(e.target.value),b(null)},onKeyDown:e=>{e.key===`Enter`&&te(),e.key===`Escape`&&(g(!1),v(``))},placeholder:`New directory name...`,className:`flex-1 font-mono text-sm`}),(0,B.jsx)(I,{type:`button`,size:`icon`,variant:`outline`,onClick:te,disabled:!_.trim(),children:(0,B.jsx)(ce,{className:`h-4 w-4`})}),(0,B.jsx)(I,{type:`button`,size:`icon`,variant:`ghost`,onClick:()=>{g(!1),v(``),b(null)},children:(0,B.jsx)(Fe,{className:`h-4 w-4`})})]}):(0,B.jsxs)(I,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>g(!0),disabled:!l||s,children:[(0,B.jsx)(u,{className:`h-4 w-4 mr-1.5`}),`New Directory`]}),y&&(0,B.jsx)(`p`,{className:`text-xs text-destructive`,children:y}),(0,B.jsxs)(Id,{children:[(0,B.jsx)(I,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,B.jsx)(I,{onClick:ne,disabled:!x,children:`Select`})]})]})})}function Qd({value:e,onChange:t,orchestratorId:n,placeholder:r,disabled:i}){let[a,o]=(0,z.useState)(!1);return(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsx)(L,{value:e,onChange:e=>t(e.target.value),placeholder:r,disabled:i,className:`flex-1 font-mono text-sm`}),(0,B.jsx)(I,{type:`button`,variant:`outline`,size:`icon`,onClick:()=>o(!0),disabled:i||!n,title:`Browse directories`,children:(0,B.jsx)(h,{className:`h-4 w-4`})}),n&&(0,B.jsx)(Zd,{open:a,onOpenChange:o,onSelect:t,orchestratorId:n,initialPath:e||void 0})]})}function $d({model:e}){if(!e)return null;let t=ef(e);return t.length===0?null:(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.map(e=>(0,B.jsxs)(F,{variant:`outline`,className:`gap-1 text-[10px]`,children:[(0,B.jsx)(e.Icon,{className:`h-3 w-3`}),e.label]},e.label))})}function ef(e){let t=[],n=e.limits?.contextWindowTokens?.value;return n&&t.push({label:tf(n),Icon:y}),e.capabilities?.modalities.input.image&&t.push({label:`Image input`,Icon:st}),(e.capabilities?.modalities.output.image||e.capabilities?.tools?.imageGeneration)&&t.push({label:`Image output`,Icon:st}),e.capabilities?.tools?.code&&t.push({label:`Code`,Icon:Se}),t}function tf(e){return e>=1e6?`${e/1e6}M ctx`:e>=1e3?`${Math.round(e/1e3)}K ctx`:`${e} ctx`}function nf(){let e=A(e=>e.orchestratorSpawnOpen),t=A(e=>e.orchestrators),n=A(e=>e.spawnOrchId),r=A(e=>e.spawnProvider),i=A(e=>e.spawnModel),a=A(e=>e.spawnEffort),o=A(e=>e.spawnProfile),s=A(e=>e.spawnCwd),c=A(e=>e.spawnLabel),l=A(e=>e.spawnApproval),u=A(e=>e.spawnWorkspaceMode),d=A(e=>e.spawnPrompt),f=A(e=>e.spawnSystemPromptAppend),p=A(e=>e.spawnCount),m=A(e=>e.spawnCwdHistory),h=A(e=>e.isSpawning),g=A(e=>!!e.pendingForkImport),_=A(e=>e.set),v=A(e=>e.submitOrchestratorSpawn),y=A(e=>e.selectSpawnHistory),b=A(e=>e.agentProfiles),x=A(e=>e.providerCatalog),S=t.find(e=>e.id===n),C=S?.providers||[],ee=_t(r,x),te=ee.find(e=>e.alias===i),ne=te?.efforts||[],re=!!(S&&C.length>0&&s.trim())&&!h,w=t.filter(e=>e.status===`online`),ie=w.length>1,ae=m.filter(e=>w.some(t=>t.id===e.orchId)).slice(0,5);function oe(e){let n=t.find(t=>t.id===e),r=n?.providers[0]||``;_({spawnOrchId:e,spawnProvider:r,spawnModel:r?mt(r,x):``,spawnEffort:``,spawnCwd:n?.baseDir||``})}function se(e){_({spawnProvider:e,spawnModel:mt(e,x),spawnEffort:``})}function T(e){_({spawnModel:e,spawnEffort:``})}return(0,B.jsx)(Md,{open:e,onOpenChange:e=>!e&&_({orchestratorSpawnOpen:!1}),children:(0,B.jsxs)(Fd,{className:`max-w-lg max-h-[90dvh] flex flex-col`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,B.jsx)(Q,{children:(0,B.jsx)(Ld,{children:`Spawn Agent`})}),(0,B.jsxs)(`div`,{className:`space-y-3 overflow-y-auto flex-1 min-h-0 -mx-4 px-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Orchestrator`}),(0,B.jsx)(`select`,{className:`w-full mt-1 rounded-md border border-input bg-background px-3 py-2 text-sm`,value:n,onChange:e=>oe(e.target.value),children:t.filter(e=>e.status===`online`).map(e=>(0,B.jsxs)(`option`,{value:e.id,children:[e.hostname,` (`,e.id.slice(-8),`)`]},e.id))})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Provider`}),(0,B.jsxs)(`select`,{className:`w-full mt-1 rounded-md border border-input bg-background px-3 py-2 text-sm`,value:r,onChange:e=>se(e.target.value),disabled:!C.length,children:[!C.length&&(0,B.jsx)(`option`,{value:r,children:`No providers available`}),C.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Model`}),(0,B.jsx)(`select`,{className:`w-full mt-1 rounded-md border border-input bg-background px-3 py-2 text-sm`,value:i,onChange:e=>T(e.target.value),disabled:!ee.length,children:ee.map(e=>(0,B.jsx)(`option`,{value:e.alias,children:e.label},e.alias))})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Effort`}),(0,B.jsxs)(`select`,{className:`w-full mt-1 rounded-md border border-input bg-background px-3 py-2 text-sm`,value:a,onChange:e=>_({spawnEffort:e.target.value}),disabled:!ne.length,children:[(0,B.jsx)(`option`,{value:``,children:`Default`}),ne.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]})]})]}),(0,B.jsx)($d,{model:te}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Agent Profile`}),(0,B.jsxs)(`select`,{className:`w-full mt-1 rounded-md border border-input bg-background px-3 py-2 text-sm`,value:o||`default-relay`,onChange:e=>_({spawnProfile:e.target.value}),children:[!b.length&&(0,B.jsx)(`option`,{value:`default-relay`,children:`default-relay`}),b.map(e=>(0,B.jsx)(`option`,{value:e.name,children:e.name},e.name))]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Approval Mode`}),(0,B.jsxs)(`select`,{className:`w-full mt-1 rounded-md border border-input bg-background px-3 py-2 text-sm`,value:l,onChange:e=>_({spawnApproval:e.target.value}),children:[(0,B.jsx)(`option`,{value:`open`,children:`Open`}),(0,B.jsx)(`option`,{value:`guarded`,children:`Guarded`}),(0,B.jsx)(`option`,{value:`read-only`,children:`Read-only`})]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Workspace`}),(0,B.jsxs)(`select`,{className:`w-full mt-1 rounded-md border border-input bg-background px-3 py-2 text-sm`,value:u,onChange:e=>_({spawnWorkspaceMode:e.target.value}),children:[(0,B.jsx)(`option`,{value:`inherit`,children:`Default`}),(0,B.jsx)(`option`,{value:`isolated`,children:`Isolated worktree`}),(0,B.jsx)(`option`,{value:`shared`,children:`Shared cwd`})]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Working Directory`}),(0,B.jsx)(`div`,{className:`mt-1`,children:(0,B.jsx)(Qd,{value:s,onChange:e=>_({spawnCwd:e}),orchestratorId:n,placeholder:`Select a project directory`})}),ae.length>0&&(0,B.jsxs)(`div`,{className:`mt-2`,children:[(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground mb-1`,children:`Recent`}),(0,B.jsx)(`div`,{className:`flex gap-1.5 overflow-x-auto pb-1 sm:flex-wrap sm:overflow-x-visible sm:pb-0`,children:ae.map(e=>{let t=e.cwd.replace(/\/+$/,``).split(`/`).pop()||e.cwd,r=w.find(t=>t.id===e.orchId)?.hostname,i=e.orchId===n&&e.cwd===s;return(0,B.jsx)(`button`,{type:`button`,title:ie&&r?`${r}: ${e.cwd}`:e.cwd,onClick:()=>y(e.orchId,e.cwd),className:`shrink-0 rounded-full border px-2.5 py-1 text-xs font-mono transition-colors ${i?`border-primary bg-primary/10 text-foreground`:`border-input bg-background text-muted-foreground hover:bg-accent hover:text-foreground`}`,children:ie&&r?`${r}: ${t}`:t},`${e.orchId}:${e.cwd}`)})})]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Label`}),(0,B.jsx)(L,{value:c,onChange:e=>_({spawnLabel:e.target.value}),placeholder:`Optional label...`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Initial Prompt`}),(0,B.jsx)(zd,{value:d,onChange:e=>_({spawnPrompt:e.target.value}),rows:3,placeholder:`Optional initial task...`}),(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:`Codex starts this as the first App Server turn; Claude receives it as a launch prompt.`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`System Prompt Append`}),(0,B.jsx)(zd,{value:f,onChange:e=>_({spawnSystemPromptAppend:e.target.value}),rows:5,placeholder:`Optional launch context...`}),(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:`Use for fork history or launch context. It informs the session but does not start work by itself.`})]}),!g&&(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsx)($,{children:`Number of Agents`}),(0,B.jsx)(`span`,{className:`text-sm font-mono tabular-nums text-muted-foreground`,children:p})]}),(0,B.jsx)(`input`,{type:`range`,min:1,max:10,step:1,value:p,onChange:e=>_({spawnCount:Number(e.target.value)}),className:`w-full mt-2 accent-primary`,"aria-label":`Number of agents to spawn`}),p>1&&(0,B.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:[`Spawns `,p,` identical agents`,c.trim()?`, labelled "${c.trim()} 1"…"${c.trim()} ${p}"`:``,`.`]})]})]}),(0,B.jsxs)(Id,{children:[(0,B.jsx)(I,{variant:`outline`,onClick:()=>_({orchestratorSpawnOpen:!1}),disabled:h,children:`Cancel`}),(0,B.jsx)(I,{onClick:v,disabled:!re,children:h?`Spawning…`:C.length?p>1?`Spawn ${p}`:`Spawn`:`No providers`})]})]})})}function rf(){return`host-${Math.random().toString(36).slice(2,8)}`}function af(e,t){return e.includes(t)?e.filter(e=>e!==t):[...e,t]}function of(){let e=A(e=>e.orchestratorInstallOpen),t=A(e=>e.set),r=A(e=>e.showError),i=A(e=>e.showNotification),a=(0,z.useMemo)(()=>new URL(Le()).origin,[]),[o,s]=(0,z.useState)(rf),[c,u]=(0,z.useState)(`$HOME/projects`),[d,f]=(0,z.useState)([`claude`,`codex`]),[p,m]=(0,z.useState)(`4860`),[h,g]=(0,z.useState)(``),[_,v]=(0,z.useState)(``),[y,b]=(0,z.useState)(),[x,S]=(0,z.useState)(!1);async function C(){if(!o.trim()){r(`Validation`,`Orchestrator id is required`);return}if(!c.trim()){r(`Validation`,`Base directory is required`);return}if(!d.length){r(`Validation`,`Select at least one provider`);return}S(!0);try{let e=await n(`POST`,`/orchestrators/bootstrap`,{id:o.trim(),relayUrl:a,baseDir:c.trim(),providers:d,apiPort:Number(p)||4860,pathPrefix:h.split(`:`).map(e=>e.trim()).filter(Boolean)});v(e.command),b(e.expiresAt)}catch(e){r(`Install Command Failed`,e.message)}finally{S(!1)}}return(0,B.jsx)(Md,{open:e,onOpenChange:e=>!e&&t({orchestratorInstallOpen:!1}),children:(0,B.jsxs)(Fd,{className:`max-w-2xl overflow-hidden`,children:[(0,B.jsx)(Q,{children:(0,B.jsxs)(Ld,{className:`flex items-center gap-2`,children:[(0,B.jsx)(l,{className:`w-4 h-4`}),`Add Orchestrator`]})}),(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Orchestrator ID`}),(0,B.jsx)(L,{value:o,onChange:e=>s(e.target.value)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Relay URL`}),(0,B.jsx)(L,{value:a,readOnly:!0})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Base Directory`}),(0,B.jsx)(L,{value:c,onChange:e=>u(e.target.value)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`API Port`}),(0,B.jsx)(L,{value:p,onChange:e=>m(e.target.value),inputMode:`numeric`})]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Providers`}),(0,B.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-2`,children:[`claude`,`codex`].map(e=>(0,B.jsx)(I,{type:`button`,size:`sm`,variant:d.includes(e)?`default`:`outline`,onClick:()=>f(af(d,e)),children:e},e))})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Extra PATH Prefix`}),(0,B.jsx)(L,{value:h,onChange:e=>g(e.target.value),placeholder:`/opt/homebrew/bin:/custom/bin`})]}),_&&(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mb-1`,children:[(0,B.jsx)($,{children:`Install Command`}),y&&(0,B.jsxs)(`span`,{className:`text-[11px] text-muted-foreground`,children:[`Install token expires `,new Date(y*1e3).toLocaleString()]})]}),(0,B.jsx)(`pre`,{className:`max-h-40 w-full overflow-y-auto whitespace-pre-wrap break-all rounded-md border border-input bg-muted/40 p-3 font-mono text-xs leading-relaxed`,children:_})]})]}),(0,B.jsxs)(Id,{children:[(0,B.jsx)(I,{variant:`outline`,onClick:()=>t({orchestratorInstallOpen:!1}),children:`Close`}),_&&(0,B.jsx)(Pn,{value:_,label:`Copy`,showText:!0,size:`default`,variant:`outline`,className:`gap-1`,onCopied:()=>i(`Install command copied`)}),(0,B.jsxs)(I,{className:`gap-1`,onClick:C,disabled:x,children:[(0,B.jsx)(Me,{className:`w-3.5 h-3.5`}),x?`Generating...`:`Generate Command`]})]})]})})}function sf(){let e=A(e=>e.policyModal),t=A(e=>e.orchestrators),n=A(e=>e.agentProfiles),r=A(e=>e.set),i=A(e=>e.submitPolicy),a=A(e=>e.providerCatalog),o=t.find(t=>t.id===e.orchestratorId),s=o?.providers||[],c=_t(e.provider,a),l=c.find(t=>t.alias===e.model),u=l?.efforts||[],d=!!e.editing,f=e.provider===`claude`&&o?.providerStatus?.find(e=>e.name===`claude`)?.features?.rig===!0;function p(t){r({policyModal:{...e,...t}})}function m(n){let r=t.find(e=>e.id===n)?.providers[0]||e.provider;p({orchestratorId:n,provider:r,model:mt(r,a),effort:``})}function h(e){p({provider:e,rig:``,model:mt(e,a),effort:``})}return(0,B.jsx)(Md,{open:e.open,onOpenChange:e=>!e&&p({open:!1}),children:(0,B.jsxs)(Fd,{className:`max-w-lg max-h-[90vh] overflow-y-auto`,children:[(0,B.jsx)(Q,{children:(0,B.jsx)(Ld,{children:d?`Edit Policy`:`Create Managed Agent`})}),(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Policy Name`}),(0,B.jsx)(L,{value:e.name,onChange:e=>p({name:e.target.value}),placeholder:`my-agent`,disabled:d})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Label`}),(0,B.jsx)(L,{value:e.label,onChange:e=>p({label:e.target.value}),placeholder:`Human-friendly name...`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Description`}),(0,B.jsx)(L,{value:e.description,onChange:e=>p({description:e.target.value}),placeholder:`What does this agent do?`})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Orchestrator`}),(0,B.jsx)(`select`,{className:`w-full mt-1 rounded-md border border-input bg-background px-3 py-2 text-sm`,value:e.orchestratorId,onChange:e=>m(e.target.value),children:t.filter(e=>e.status===`online`).map(e=>(0,B.jsxs)(`option`,{value:e.id,children:[e.hostname,` (`,e.id.slice(-8),`)`]},e.id))})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Provider`}),(0,B.jsxs)(`select`,{className:`w-full mt-1 rounded-md border border-input bg-background px-3 py-2 text-sm`,value:e.provider,onChange:e=>h(e.target.value),disabled:!s.length,children:[!s.length&&(0,B.jsx)(`option`,{value:e.provider,children:`No providers available`}),s.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]})]})]}),f&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Rig`}),(0,B.jsx)(L,{value:e.rig,onChange:e=>p({rig:e.target.value}),placeholder:`Leave empty to auto-detect from .claude-rig`}),(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:`claude-rig profile name. Auto-detects from project's .claude-rig file if empty.`})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Model`}),(0,B.jsx)(`select`,{className:`w-full mt-1 rounded-md border border-input bg-background px-3 py-2 text-sm`,value:e.model,onChange:e=>p({model:e.target.value,effort:``}),children:c.map(e=>(0,B.jsx)(`option`,{value:e.alias,children:e.label},e.alias))})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Effort`}),(0,B.jsxs)(`select`,{className:`w-full mt-1 rounded-md border border-input bg-background px-3 py-2 text-sm`,value:e.effort,onChange:e=>p({effort:e.target.value}),disabled:!u.length,children:[(0,B.jsx)(`option`,{value:``,children:`Default`}),u.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]})]})]}),(0,B.jsx)($d,{model:l}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Agent Profile`}),(0,B.jsxs)(`select`,{className:`w-full mt-1 rounded-md border border-input bg-background px-3 py-2 text-sm`,value:e.profile||`default-relay`,onChange:e=>p({profile:e.target.value}),children:[!n.length&&(0,B.jsx)(`option`,{value:`default-relay`,children:`default-relay`}),n.map(e=>(0,B.jsx)(`option`,{value:e.name,children:e.name},e.name))]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Working Directory`}),(0,B.jsx)(`div`,{className:`mt-1`,children:(0,B.jsx)(Qd,{value:e.cwd,onChange:e=>p({cwd:e}),orchestratorId:e.orchestratorId,placeholder:o?.baseDir||`/path/to/project`})})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Mode`}),(0,B.jsxs)(`select`,{className:`w-full mt-1 rounded-md border border-input bg-background px-3 py-2 text-sm`,value:e.mode,onChange:e=>p({mode:e.target.value}),children:[(0,B.jsx)(`option`,{value:`always-on`,children:`Always On`}),(0,B.jsx)(`option`,{value:`on-demand`,children:`On Demand`})]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Permission Mode`}),(0,B.jsxs)(`select`,{className:`w-full mt-1 rounded-md border border-input bg-background px-3 py-2 text-sm`,value:e.permissionMode,onChange:e=>p({permissionMode:e.target.value}),children:[(0,B.jsx)(`option`,{value:`open`,children:`Open`}),(0,B.jsx)(`option`,{value:`guarded`,children:`Guarded`}),(0,B.jsx)(`option`,{value:`read-only`,children:`Read-only`})]})]})]}),e.mode===`on-demand`&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Keepalive (seconds)`}),(0,B.jsx)(L,{type:`number`,value:e.keepaliveSeconds,onChange:e=>p({keepaliveSeconds:e.target.value}),placeholder:`300`}),(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:`Seconds to keep agent alive after last activity.`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Initial Prompt`}),(0,B.jsx)(zd,{value:e.prompt,onChange:e=>p({prompt:e.target.value}),rows:3,placeholder:`Optional initial task or instructions...`}),(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:`Codex starts this as the first App Server turn; Claude receives it as a launch prompt.`})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Tags`}),(0,B.jsx)(L,{value:e.tags,onChange:e=>p({tags:e.target.value}),placeholder:`tag1, tag2`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Capabilities`}),(0,B.jsx)(L,{value:e.capabilities,onChange:e=>p({capabilities:e.target.value}),placeholder:`chat, review`})]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Provider Args`}),(0,B.jsx)(L,{value:e.providerArgs,onChange:e=>p({providerArgs:e.target.value}),placeholder:`--flag value`}),(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:`Space-separated args passed to the provider CLI.`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Channel Binding`}),(0,B.jsx)(L,{value:e.channelId,onChange:e=>p({channelId:e.target.value}),placeholder:`Channel ID (optional)`})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Backoff Schedule (seconds)`}),(0,B.jsx)(L,{value:e.backoffSchedule,onChange:e=>p({backoffSchedule:e.target.value}),placeholder:`5, 15, 60, 300`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Backoff Reset After (s)`}),(0,B.jsx)(L,{type:`number`,value:e.backoffResetAfterSeconds,onChange:e=>p({backoffResetAfterSeconds:e.target.value}),placeholder:`600`})]})]}),(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsx)($,{htmlFor:`restartOnUpdate`,children:`Restart on policy update`}),(0,B.jsx)(tl,{id:`restartOnUpdate`,checked:e.restartOnUpdate,onCheckedChange:e=>p({restartOnUpdate:e})})]}),(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsx)($,{htmlFor:`dailyRestart`,children:`Scheduled daily restart`}),(0,B.jsx)(tl,{id:`dailyRestart`,checked:e.scheduledDailyRestart,onCheckedChange:e=>p({scheduledDailyRestart:e})})]})]}),(0,B.jsxs)(Id,{children:[(0,B.jsx)(I,{variant:`outline`,onClick:()=>p({open:!1}),children:`Cancel`}),(0,B.jsx)(I,{onClick:i,children:d?`Save`:`Create`})]})]})})}function cf({children:e}){return(0,B.jsxs)(Rc,{children:[(0,B.jsx)(zc,{asChild:!0,children:(0,B.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-label":`More info`,className:`inline-flex shrink-0 text-muted-foreground transition-colors hover:text-foreground`,children:(0,B.jsx)(le,{className:`h-3 w-3`})})}),(0,B.jsx)(Bc,{className:`max-w-xs leading-relaxed`,children:e})]})}function lf({children:e,tip:t,className:n}){return(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)($,{className:n,children:e}),(0,B.jsx)(cf,{children:t})]})}var uf=[`core`,`workspace`,`memory`,`artifacts`,`blackboard`,`subscriptions`,`spawn-lifecycle`,`plans`,`teams`,`project`,`issues`],df=[{value:``,label:`Off`},{value:`all`,label:`All`}],ff=[{value:``,label:`Off`},{value:`all`,label:`All safe settings`}],pf=[{value:``,label:`Instance default`},{value:`direct`,label:`Direct`},{value:`pr`,label:`Pull request`}],mf=[{value:`any`,label:`Any provider`},{value:`claude`,label:`Claude`},{value:`codex`,label:`Codex`}],hf={relay:`bg-blue-500/10 text-blue-400 border-blue-500/30`,repo:`bg-emerald-500/10 text-emerald-400 border-emerald-500/30`,inline:`bg-amber-500/10 text-amber-400 border-amber-500/30`,provider:`bg-fuchsia-500/10 text-fuchsia-400 border-fuchsia-500/30`,profile:`bg-slate-500/10 text-slate-400 border-slate-500/30`};function gf(e){return e?e.policy??`all`:``}function _f(e){if(e)return e===`all`?{policy:`all`}:{}}function vf({value:e,onChange:t,options:n,disabled:r}){return(0,B.jsx)(`select`,{className:`w-full rounded-md border border-input bg-background px-3 py-2 text-sm`,value:e,onChange:e=>t(e.target.value),disabled:r,children:n.map(e=>(0,B.jsx)(`option`,{value:e.value,children:e.label},e.value))})}function yf(e,t){return`${e.source}:${e.provider??`any`}:${e.ref}:${t}`}function bf({source:e}){return(0,B.jsx)(F,{variant:`outline`,className:`text-[10px] ${hf[e]}`,children:e})}function xf({skills:e,plugins:t,mcp:r,onChangeSkills:i,onChangePlugins:a,onChangeMcp:o,projectMcp:s,projectSkills:c,projectSettings:l,sharedMcp:u,readOnly:d}){let[f,p]=(0,z.useState)([]),[m,h]=(0,z.useState)(!1),[g,_]=(0,z.useState)(!1),[v,y]=(0,z.useState)(null),[b,x]=(0,z.useState)(null),[S,C]=(0,z.useState)(`repo`),[ee,te]=(0,z.useState)(``),[ne,re]=(0,z.useState)(`any`);async function w(e){if(x(e),!m){_(!0),y(null);try{p((await n(`GET`,`/provisioning/capabilities`)).capabilities),h(!0)}catch(e){y($t(e))}finally{_(!1)}}}function ie(n){let r=ee.trim();if(!r)return;let o={source:S,ref:r,enabled:!0,...ne===`any`?{}:{provider:ne}};n===`skill`?i([...e,o]):a([...t,o]),te(``),x(null)}function ae(n,r){let o=n===`skill`?e:t;if(o.some(e=>e.source===`relay`&&e.ref===r))return;let s=[...o,{source:`relay`,ref:r,enabled:!0}];n===`skill`?i(s):a(s),x(null)}function oe(e){let t=e.variants.find(e=>e.enabled);if(!t)return;let n=t.definition;o({...r,servers:{...r.servers??{},[e.capability.slug]:n?.server??{}}}),x(null)}function se(t,n){i(e.map((e,r)=>r===t?{...e,...n}:e))}function T(e,n){a(t.map((t,r)=>r===e?{...t,...n}:t))}function E(e){let t={...r.servers??{}};delete t[e],o({...r,servers:t})}let ce=f.filter(e=>e.capability.kind===`skill`),le=f.filter(e=>e.capability.kind===`plugin`),ue=f.filter(e=>e.capability.kind===`mcp`);return(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(Sf,{projectMcp:s,projectSkills:c,projectSettings:l,sharedMcp:u}),(0,B.jsx)(wf,{title:`Skills from registry`,kind:`skill`,refs:e,readOnly:d,adding:b===`skill`,caps:ce,loading:g,fetchError:v,empty:`No skills assigned`,manualRef:ee,manualSource:S,manualProvider:ne,onAddClick:()=>void w(`skill`),onCancel:()=>x(null),onManualRef:te,onManualSource:C,onManualProvider:re,onAddManual:()=>ie(`skill`),onAddRelay:e=>ae(`skill`,e),onUpdate:se,onRemove:t=>i(e.filter((e,n)=>n!==t))}),(0,B.jsx)(wf,{title:`Plugins from registry`,kind:`plugin`,refs:t,readOnly:d,adding:b===`plugin`,caps:le,loading:g,fetchError:v,empty:`No plugins assigned`,manualRef:ee,manualSource:S,manualProvider:ne,onAddClick:()=>void w(`plugin`),onCancel:()=>x(null),onManualRef:te,onManualSource:C,onManualProvider:re,onAddManual:()=>ie(`plugin`),onAddRelay:e=>ae(`plugin`,e),onUpdate:T,onRemove:e=>a(t.filter((t,n)=>n!==e))}),(0,B.jsx)(Df,{mcpKeys:Object.keys(r.servers??{}),caps:ue,adding:b===`mcp`,loading:g,fetchError:v,readOnly:d,onAddClick:()=>void w(`mcp`),onAddMcp:oe,onCancel:()=>x(null),onRemove:E})]})}function Sf(e){return(0,B.jsxs)(`div`,{className:`rounded border border-border bg-muted/20 p-2`,children:[(0,B.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-xs font-medium text-muted-foreground`,children:[`Project and shared injection`,(0,B.jsxs)(cf,{children:[`Read-only mirror of the Provisioning Policies above — what this profile injects from the project's `,(0,B.jsx)(`code`,{children:`.mcp.json`}),`/`,(0,B.jsx)(`code`,{children:`.claude`}),` and how its MCP is routed.`]})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,B.jsxs)(F,{variant:e.projectMcp?`default`:`outline`,className:`text-[10px]`,children:[`project MCP: `,gf(e.projectMcp)||`off`]}),(0,B.jsxs)(F,{variant:e.projectSkills?`default`:`outline`,className:`text-[10px]`,children:[`project skills: `,gf(e.projectSkills)||`off`]}),(0,B.jsxs)(F,{variant:e.projectSettings?`default`:`outline`,className:`text-[10px]`,children:[`project settings: `,gf(e.projectSettings)||`off`]}),(0,B.jsxs)(F,{variant:e.sharedMcp?`default`:`outline`,className:`text-[10px]`,children:[`shared MCP: `,gf(e.sharedMcp)||`off`]})]})]})}function Cf(e){return[...new Set(e.variants.map(e=>e.sourceType||`relay`))].join(`, `)}function wf(e){return(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:e.title}),!e.readOnly&&(0,B.jsxs)(I,{type:`button`,variant:`outline`,size:`sm`,className:`h-6 gap-1 text-xs`,onClick:e.onAddClick,children:[(0,B.jsx)(a,{className:`h-3 w-3`}),`Add `,e.kind]})]}),e.refs.length===0&&!e.adding&&(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.empty}),e.refs.map((t,n)=>(0,B.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 rounded border border-border bg-card/60 px-2 py-1`,children:[(0,B.jsx)(F,{variant:`outline`,className:`text-[10px] ${e.kind===`skill`?`bg-blue-500/10 text-blue-400 border-blue-500/30`:`bg-violet-500/10 text-violet-400 border-violet-500/30`}`,children:e.kind}),(0,B.jsx)(bf,{source:t.source}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs`,children:t.ref}),t.provider&&t.provider!==`any`&&(0,B.jsx)(F,{variant:`secondary`,className:`text-[10px]`,children:t.provider}),(0,B.jsx)(tl,{checked:t.enabled,onCheckedChange:t=>e.onUpdate(n,{enabled:t}),disabled:e.readOnly,size:`sm`}),!e.readOnly&&(0,B.jsx)(I,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`h-5 w-5`,onClick:()=>e.onRemove(n),children:(0,B.jsx)(Ne,{className:`h-3 w-3`})})]},yf(t,n))),e.adding&&(0,B.jsxs)(`div`,{className:`mt-1.5 space-y-2 rounded border border-border bg-card/60 p-2`,children:[e.loading&&(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Loading...`}),e.fetchError&&(0,B.jsx)(`div`,{className:`text-xs text-destructive`,children:e.fetchError}),!e.loading&&e.caps.length===0&&!e.fetchError&&(0,B.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`No `,e.kind,` capabilities in registry`]}),e.caps.length>0&&(0,B.jsx)(`div`,{className:`max-h-44 space-y-0.5 overflow-y-auto rounded border border-border/60 bg-background/40 p-1`,children:e.caps.map(t=>(0,B.jsxs)(`button`,{type:`button`,onClick:()=>e.onAddRelay(t.capability.slug),className:`w-full rounded px-2 py-1 text-left font-mono text-xs hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,children:[t.capability.slug,t.capability.title?` - ${t.capability.title}`:``,t.variants.length>0&&(0,B.jsxs)(`span`,{className:`ml-2 text-muted-foreground`,children:[`(`,Cf(t),`)`]})]},t.capability.id))}),(0,B.jsx)(Tf,{}),(0,B.jsx)(Ef,{...e}),(0,B.jsx)(I,{type:`button`,variant:`ghost`,size:`sm`,className:`mt-1 h-6 text-xs`,onClick:e.onCancel,children:`Cancel`})]})]})}function Tf(){return(0,B.jsxs)(`div`,{className:`flex items-center gap-2 pt-0.5`,children:[(0,B.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,B.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide text-muted-foreground`,children:`or add manually`}),(0,B.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}function Ef(e){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`grid grid-cols-[1fr_1fr] gap-1.5`,children:[(0,B.jsx)(vf,{value:e.manualSource,onChange:t=>e.onManualSource(t),options:[{value:`repo`,label:`Repo ref`},{value:`inline`,label:`Inline ref`},{value:`provider`,label:`Provider ref`},{value:`relay`,label:`Relay ref`}]}),(0,B.jsx)(vf,{value:e.manualProvider,onChange:t=>e.onManualProvider(t),options:mf})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(L,{value:e.manualRef,onChange:t=>e.onManualRef(t.target.value),placeholder:e.kind===`skill`?`.claude/skills/name or registry slug`:`.relay/plugins/name or registry slug`,className:`font-mono text-xs`}),(0,B.jsx)(I,{type:`button`,variant:`outline`,size:`sm`,className:`h-8 text-xs`,onClick:e.onAddManual,children:`Add ref`})]})]})}function Df(e){return(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:`MCP from registry`}),!e.readOnly&&(0,B.jsxs)(I,{type:`button`,variant:`outline`,size:`sm`,className:`h-6 gap-1 text-xs`,onClick:e.onAddClick,children:[(0,B.jsx)(a,{className:`h-3 w-3`}),`Add MCP`]})]}),e.mcpKeys.length===0&&!e.adding&&(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`No MCP servers from registry`}),e.mcpKeys.map(t=>(0,B.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 rounded border border-border bg-card/60 px-2 py-1`,children:[(0,B.jsx)(F,{variant:`outline`,className:`border-emerald-500/30 bg-emerald-500/10 text-[10px] text-emerald-400`,children:`mcp`}),(0,B.jsx)(bf,{source:`profile`}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs`,children:t}),!e.readOnly&&(0,B.jsx)(I,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`h-5 w-5`,onClick:()=>e.onRemove(t),children:(0,B.jsx)(Ne,{className:`h-3 w-3`})})]},t)),e.adding&&(0,B.jsxs)(`div`,{className:`mt-1.5 space-y-2 rounded border border-border bg-card/60 p-2`,children:[e.loading&&(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Loading...`}),e.fetchError&&(0,B.jsx)(`div`,{className:`text-xs text-destructive`,children:e.fetchError}),!e.loading&&e.caps.length===0&&!e.fetchError&&(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`No MCP capabilities in registry`}),e.caps.length>0&&(0,B.jsx)(`div`,{className:`max-h-44 space-y-0.5 overflow-y-auto rounded border border-border/60 bg-background/40 p-1`,children:e.caps.map(t=>(0,B.jsxs)(`button`,{type:`button`,onClick:()=>e.onAddMcp(t),className:`w-full rounded px-2 py-1 text-left font-mono text-xs hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,children:[t.capability.slug,t.capability.title?` - ${t.capability.title}`:``,t.variants.length>0&&(0,B.jsxs)(`span`,{className:`ml-2 text-muted-foreground`,children:[`(`,Cf(t),`)`]})]},t.capability.id))}),(0,B.jsx)(I,{type:`button`,variant:`ghost`,size:`sm`,className:`mt-1 h-6 text-xs`,onClick:e.onCancel,children:`Cancel`})]})]})}function Of({profile:e}){let[t,r]=(0,z.useState)(e.provider===`claude`||e.provider===`codex`?e.provider:`codex`),[i,a]=(0,z.useState)(null),[o,s]=(0,z.useState)(!1),[c,l]=(0,z.useState)(null);async function u(i=t){if(e.name.trim()){s(!0),l(null);try{let t=await n(`GET`,`/agent-profiles/${encodeURIComponent(e.name)}/resolved?provider=${encodeURIComponent(i)}`);r(t.provider),a(t.profile.provisioning??{skills:[],plugins:[],mcpServers:{}})}catch(e){l($t(e)),a(null)}finally{s(!1)}}}let d=e.relay.tools?.groups??[],f=d.length?d.join(`, `):`all groups`,p=Object.keys(i?.mcpServers??{});return(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)($,{children:`Provider`}),(0,B.jsx)(vf,{value:t,onChange:e=>{let t=e;r(t),u(t)},options:[{value:`codex`,label:`Codex`},{value:`claude`,label:`Claude`}]})]}),(0,B.jsx)(I,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void u(),disabled:o||!e.name.trim(),children:o?`Resolving...`:`Resolve`})]}),c&&(0,B.jsx)(`div`,{className:`rounded border border-destructive/40 bg-destructive/10 px-2 py-1 text-xs text-destructive`,children:c}),(0,B.jsxs)(`div`,{className:`rounded border border-border bg-muted/20 p-2`,children:[(0,B.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:`Relay tool surface`}),(0,B.jsx)(`div`,{className:`mt-1 font-mono text-xs`,children:f})]}),!i&&!c&&(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Resolve this profile to inspect materialized provisioning.`}),i&&(0,B.jsxs)(`div`,{className:`grid gap-2`,children:[(0,B.jsx)(kf,{title:`Skills`,values:i.skills.map(e=>e.name),empty:`No resolved skills`}),(0,B.jsx)(kf,{title:`Plugins`,values:i.plugins.map(e=>e.name),empty:`No resolved plugins`}),(0,B.jsx)(kf,{title:`MCP Servers`,values:p,empty:`No resolved MCP servers`}),(i.skipped?.length??0)>0&&(0,B.jsxs)(`div`,{className:`rounded border border-amber-500/30 bg-amber-500/10 p-2`,children:[(0,B.jsx)(`div`,{className:`text-xs font-medium text-amber-300`,children:`Skipped`}),(0,B.jsx)(`div`,{className:`mt-1 space-y-1`,children:i.skipped.map(e=>(0,B.jsxs)(`div`,{className:`text-xs`,children:[(0,B.jsxs)(`span`,{className:`font-mono`,children:[e.kind,`:`,e.ref]}),(0,B.jsxs)(`span`,{className:`text-muted-foreground`,children:[` - `,e.detail]})]},`${e.kind}:${e.ref}:${e.reason}`))})]})]})]})}function kf({title:e,values:t,empty:n}){return(0,B.jsxs)(`div`,{className:`rounded border border-border bg-card/60 p-2`,children:[(0,B.jsx)(`div`,{className:`mb-1 text-xs font-medium text-muted-foreground`,children:e}),t.length===0?(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:n}):(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:t.map((e,t)=>(0,B.jsx)(F,{variant:`outline`,className:`font-mono text-[10px]`,children:e},`${e}:${t}`))})]})}function Af({title:e,children:t,defaultOpen:n=!0}){let[r,i]=(0,z.useState)(n);return(0,B.jsxs)(`div`,{className:`border border-border rounded-md`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 px-3 py-2 text-sm font-medium hover:bg-accent`,onClick:()=>i(!r),children:[r?(0,B.jsx)(ct,{className:`h-3.5 w-3.5`}):(0,B.jsx)(lt,{className:`h-3.5 w-3.5`}),e]}),r&&(0,B.jsx)(`div`,{className:`space-y-3 border-t border-border px-3 py-3`,children:t})]})}function jf({value:e,onChange:t,options:n,disabled:r}){return(0,B.jsx)(`select`,{className:`w-full rounded-md border border-input bg-background px-3 py-2 text-sm`,value:e,onChange:e=>t(e.target.value),disabled:r,children:n.map(e=>(0,B.jsx)(`option`,{value:e.value,children:e.label},e.value))})}function Mf({env:e,onChange:t,disabled:n}){let r=Object.entries(e),[i,o]=(0,z.useState)(``),[s,c]=(0,z.useState)(``);function l(){i.trim()&&(t({...e,[i.trim()]:s}),o(``),c(``))}function u(n){let r={...e};delete r[n],t(r)}return(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[r.map(([e,t])=>(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsxs)(`code`,{className:`min-w-0 flex-1 truncate rounded bg-muted px-2 py-1 text-xs`,children:[e,`=`,t]}),!n&&(0,B.jsx)(I,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`h-6 w-6 shrink-0`,onClick:()=>u(e),children:(0,B.jsx)(Ne,{className:`h-3 w-3`})})]},e)),!n&&(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(L,{value:i,onChange:e=>o(e.target.value),placeholder:`KEY`,className:`flex-1 text-xs font-mono`}),(0,B.jsx)(L,{value:s,onChange:e=>c(e.target.value),placeholder:`value`,className:`flex-1 text-xs font-mono`,onKeyDown:e=>e.key===`Enter`&&l()}),(0,B.jsx)(I,{type:`button`,variant:`outline`,size:`icon-sm`,className:`h-8 w-8 shrink-0`,onClick:l,children:(0,B.jsx)(a,{className:`h-3 w-3`})})]}),r.length===0&&n&&(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`No environment variables`})]})}var Nf=[{value:`host`,label:`Host — full access, relay-aware`},{value:`minimal`,label:`Minimal — relay disabled, repo-scoped`},{value:`isolated`,label:`Isolated — strict isolation`},{value:`vanilla`,label:`Vanilla — zero host bleed (plugins/skills/hooks/MCP/CLAUDE.md off)`}],Pf=[{value:`any`,label:`Any provider`},{value:`claude`,label:`Claude`},{value:`codex`,label:`Codex`}],Ff=[{value:`host`,label:`Host — use host config`},{value:`profile`,label:`Profile — use profile config`},{value:`repo`,label:`Repo — use repo config only`},{value:`none`,label:`None — disabled`}],If=[{value:`host`,label:`Host — full filesystem`},{value:`workspace`,label:`Workspace — working directory tree`},{value:`repo`,label:`Repo — repository root only`}],Lf=[{value:`allow`,label:`Allow`},{value:`ignore`,label:`Ignore`}],Rf=[{value:``,label:`Default`},{value:`open`,label:`Open — allow all`},{value:`guarded`,label:`Guarded — prompt for risky`},{value:`read-only`,label:`Read-only`}],zf={context:`Injects relay's context preamble each turn (memory + situational awareness).`,skills:`Makes the bundled Agent Relay skills available to the agent.`,plugins:`Loads the bundled Agent Relay Claude plugin (session registration, approval hooks).`,statusLine:`Enables the relay status-line probe (quota + context-window reporting).`,mcp:`Master switch for relay's own MCP tools (relay_* — messaging, memory, spawn, etc.). One of three independent MCP sources, alongside Project MCP (the project's .mcp.json) and MCP Mode (the host's ambient MCP).`},Bf={context:`Context`,skills:`Skills`,plugins:`Plugins`,statusLine:`Status Line`,mcp:`MCP Tools`};function Vf({values:e,onChange:t,disabled:n,placeholder:r}){let[i,o]=(0,z.useState)(``);function s(){let n=i.trim();n&&(t([...e,n]),o(``))}function c(n,r){t(e.map((e,t)=>t===n?r:e))}function l(n){t(e.filter((e,t)=>t!==n))}return(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[e.map((e,t)=>(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(L,{value:e,onChange:e=>c(t,e.target.value),disabled:n,className:`flex-1 text-xs`}),!n&&(0,B.jsx)(I,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`h-6 w-6 shrink-0`,onClick:()=>l(t),children:(0,B.jsx)(Ne,{className:`h-3 w-3`})})]},`${e}-${t}`)),!n&&(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(L,{value:i,onChange:e=>o(e.target.value),placeholder:r,className:`flex-1 text-xs`,onKeyDown:e=>e.key===`Enter`&&s()}),(0,B.jsx)(I,{type:`button`,variant:`outline`,size:`icon-sm`,className:`h-8 w-8 shrink-0`,onClick:s,children:(0,B.jsx)(a,{className:`h-3 w-3`})})]}),e.length===0&&n&&(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`None`})]})}function Hf(){let{open:e,mode:t,profile:n}=A(e=>e.profileModal),r=A(e=>e.closeProfileModal),i=A(e=>e.updateProfileModal),a=A(e=>e.saveProfile),o=t===`view`,s=t===`create`||t===`duplicate`,c=t===`view`?`Profile: ${n.name}`:t===`edit`?`Edit: ${n.name}`:t===`duplicate`?`Duplicate Profile`:`Create Profile`;function l(e){i({instructions:{...n.instructions,...e}})}function u(e){i({relay:{...n.relay,...e}})}function d(e,t){let r=n.relay.tools?.groups??[],i=t?[...new Set([...r,e])]:r.filter(t=>t!==e);u({tools:i.length?{groups:i}:void 0})}function f(e){i({projectMcp:_f(e)})}function p(e){i({projectSkills:_f(e)})}function m(e){i({projectSettings:_f(e)})}function h(e){i({sharedMcp:_f(e)})}function g(e){i({permissions:{...n.permissions,...e}})}function _(e){let t=n.providerOptions||{},r={...t.codex&&typeof t.codex==`object`&&!Array.isArray(t.codex)?t.codex:{}};if(!e.trim())delete r.toolOutputTokenLimit;else{let t=Number(e);if(!Number.isSafeInteger(t))return;r.toolOutputTokenLimit=t}i({providerOptions:{...t,codex:r}})}function v(e){if(!e.trim()){i({maxSpawnedAgents:void 0});return}let t=Number(e);!Number.isInteger(t)||t<0||i({maxSpawnedAgents:Math.min(t,100)})}function y(e){let t=e===`host`;i({base:e,relay:{context:t,skills:t,plugins:t,statusLine:t,mcp:t},mcp:{...n.mcp,mode:t?`host`:`none`},hooks:{mode:t?`host`:`none`},permissions:{...n.permissions,filesystem:t?`host`:`repo`},instructions:{...n.instructions,globalInstructions:t?`allow`:`ignore`}})}let b=n.providerOptions?.codex&&typeof n.providerOptions.codex==`object`&&!Array.isArray(n.providerOptions.codex)?n.providerOptions.codex:{},x=Number.isSafeInteger(b.toolOutputTokenLimit)?String(b.toolOutputTokenLimit):``;return(0,B.jsx)(Md,{open:e,onOpenChange:e=>!e&&r(),children:(0,B.jsxs)(Fd,{className:`max-w-2xl max-h-[90vh] overflow-y-auto`,children:[(0,B.jsx)(Q,{children:(0,B.jsxs)(Ld,{className:`flex items-center gap-2`,children:[c,n.builtIn&&(0,B.jsx)(F,{variant:`secondary`,className:`text-[10px]`,children:`Built-in`})]})}),(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsxs)(Af,{title:`General`,defaultOpen:!0,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Name`}),(0,B.jsx)(L,{value:n.name,onChange:e=>i({name:e.target.value}),placeholder:`my-profile`,disabled:o||t===`edit`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Description`}),(0,B.jsx)(L,{value:n.description||``,onChange:e=>i({description:e.target.value}),placeholder:`What this profile configures`,disabled:o})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(lf,{tip:`Emoji shown across the dashboard wherever an agent on this profile appears (conversation rows, agent cards, chat header). A single emoji; leave blank for a neutral marker.`,children:`Icon`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(L,{value:n.icon||``,onChange:e=>i({icon:e.target.value}),placeholder:`🤖`,maxLength:8,disabled:o,className:`w-24 text-center text-base`}),(0,B.jsx)(`span`,{className:`text-2xl leading-none`,"aria-hidden":!0,children:n.icon?.trim()||`•`})]})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Base`}),(0,B.jsx)(jf,{value:n.base,onChange:e=>y(e),options:Nf,disabled:o})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Provider`}),(0,B.jsx)(jf,{value:n.provider||`any`,onChange:e=>i({provider:e}),options:Pf,disabled:o})]})]})]}),(0,B.jsxs)(Af,{title:`Instructions`,defaultOpen:!1,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`System Prompt`}),(0,B.jsx)(zd,{value:n.instructions.system||``,onChange:e=>l({system:e.target.value}),placeholder:`Custom system prompt...`,rows:3,disabled:o,className:`font-mono text-xs`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Append Instructions`}),(0,B.jsx)(Vf,{values:n.instructions.append??[],onChange:e=>l({append:e}),disabled:o,placeholder:`Append instruction fragment`})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Repo Instructions`}),(0,B.jsx)(jf,{value:n.instructions.repoInstructions,onChange:e=>l({repoInstructions:e}),options:Lf,disabled:o})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Global Instructions`}),(0,B.jsx)(jf,{value:n.instructions.globalInstructions,onChange:e=>l({globalInstructions:e}),options:Lf,disabled:o})]})]})]}),(0,B.jsxs)(Af,{title:`Relay Integration`,defaultOpen:!1,children:[(0,B.jsxs)(`p`,{className:`rounded border border-border bg-muted/20 px-2 py-1.5 text-xs text-muted-foreground`,children:[`MCP comes from three independent sources — relay (`,(0,B.jsx)(`span`,{className:`font-medium text-foreground`,children:`MCP Tools`}),` below), the project (`,(0,B.jsx)(`span`,{className:`font-medium text-foreground`,children:`Project MCP`}),` in Provisioning Policies), and the host (`,(0,B.jsx)(`span`,{className:`font-medium text-foreground`,children:`MCP Mode`}),` in MCP & Hooks). Toggle each separately and mix freely.`]}),(0,B.jsx)(`div`,{className:`grid grid-cols-2 gap-3`,children:[`context`,`skills`,`plugins`,`statusLine`,`mcp`].map(e=>(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,B.jsx)(lf,{tip:zf[e],children:Bf[e]}),(0,B.jsx)(tl,{checked:n.relay[e]??!0,onCheckedChange:t=>u({[e]:t}),disabled:o})]},e))}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(lf,{tip:`Pick which subsets of relay's MCP tools the agent gets. No groups selected = the full relay tool surface.`,children:`Relay Tool Groups`}),(0,B.jsx)(`div`,{className:`mt-1 grid grid-cols-2 gap-1.5`,children:uf.map(e=>(0,B.jsxs)(`label`,{className:`flex items-center gap-2 rounded border border-border px-2 py-1 text-xs`,children:[(0,B.jsx)(`input`,{type:`checkbox`,className:`rounded`,checked:(n.relay.tools?.groups??[]).includes(e),onChange:t=>d(e,t.target.checked),disabled:o}),(0,B.jsx)(`span`,{className:`font-mono`,children:e})]},e))}),(0,B.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`No groups selected means full relay MCP tool surface.`})]})]}),(0,B.jsx)(Af,{title:`MCP & Hooks`,defaultOpen:!1,children:(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(lf,{tip:`The host's ambient MCP servers (your rig's configured MCP). Host = inherit them; None = no host MCP (clean, no bleed). Separate from relay's own MCP and the project's MCP.`,children:`MCP Mode`}),(0,B.jsx)(jf,{value:n.mcp.mode,onChange:e=>i({mcp:{...n.mcp,mode:e}}),options:Ff,disabled:o})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(lf,{tip:`The host's hook configuration. Host = inherit it; None = no host hooks.`,children:`Hooks Mode`}),(0,B.jsx)(jf,{value:n.hooks.mode,onChange:e=>i({hooks:{mode:e}}),options:Ff,disabled:o})]})]})}),(0,B.jsx)(Af,{title:`Provisioning Policies`,defaultOpen:!1,children:(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(lf,{tip:`Injects the MCP servers declared in the spawn directory's project .mcp.json, via relay's controlled config path (survives --strict-mcp-config, no trust modal). All = every declared server. This is the project's MCP source — distinct from relay's MCP Tools and the host's MCP Mode.`,children:`Project MCP`}),(0,B.jsx)(jf,{value:gf(n.projectMcp),onChange:f,options:df,disabled:o})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(lf,{tip:`Injects skills committed under the project's .claude/skills.`,children:`Project Skills`}),(0,B.jsx)(jf,{value:gf(n.projectSkills),onChange:p,options:df,disabled:o})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(lf,{tip:`Injects the project's .claude/settings.json (permission/security keys stripped).`,children:`Project Settings`}),(0,B.jsx)(jf,{value:gf(n.projectSettings),onChange:m,options:ff,disabled:o})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(lf,{tip:`Routes the agent's non-identity MCP through one shared orchestrator listener so the MCP session survives restarts and keeps correct worktree-cwd routing. A transport choice, not a source selector.`,children:`Shared MCP`}),(0,B.jsx)(jf,{value:gf(n.sharedMcp),onChange:h,options:df,disabled:o})]}),(0,B.jsxs)(`div`,{className:`col-span-2`,children:[(0,B.jsx)(lf,{tip:`How the agent's isolated branch lands: Direct (rebase/FF), Pull request, or the instance default.`,children:`Landing Strategy`}),(0,B.jsx)(jf,{value:n.landingStrategy??``,onChange:e=>i({landingStrategy:e||void 0}),options:pf,disabled:o})]})]})}),(0,B.jsx)(Af,{title:`Permissions`,defaultOpen:!1,children:(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Approval Mode`}),(0,B.jsx)(jf,{value:n.permissions.mode||``,onChange:e=>g({mode:e||void 0}),options:Rf,disabled:o})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Filesystem Scope`}),(0,B.jsx)(jf,{value:n.permissions.filesystem,onChange:e=>g({filesystem:e}),options:If,disabled:o})]})]})}),(0,B.jsx)(Af,{title:`Spawning`,defaultOpen:!1,children:(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Spawn Quota`}),(0,B.jsx)(L,{type:`number`,min:0,max:100,step:1,value:n.maxSpawnedAgents===void 0?``:String(n.maxSpawnedAgents),onChange:e=>v(e.target.value),placeholder:`0`,disabled:o}),(0,B.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Max concurrent live child agents this profile may spawn. Empty or 0 = cannot spawn (default). Children never inherit it (no grandchildren).`})]})}),(0,B.jsx)(Af,{title:`Environment Variables`,defaultOpen:!1,children:(0,B.jsx)(Mf,{env:n.env||{},onChange:e=>i({env:e}),disabled:o})}),(0,B.jsx)(Af,{title:`Registry Capabilities`,defaultOpen:!1,children:(0,B.jsx)(xf,{skills:n.skills??[],plugins:n.plugins??[],mcp:n.mcp,onChangeSkills:e=>i({skills:e}),onChangePlugins:e=>i({plugins:e}),onChangeMcp:e=>i({mcp:e}),projectMcp:n.projectMcp,projectSkills:n.projectSkills,projectSettings:n.projectSettings,sharedMcp:n.sharedMcp,readOnly:o})}),(0,B.jsx)(Af,{title:`Resolved Provisioning`,defaultOpen:t===`view`,children:(0,B.jsx)(Of,{profile:n})}),(0,B.jsxs)(Af,{title:`Provider Options`,defaultOpen:!1,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)($,{children:`Codex Tool Output Limit`}),(0,B.jsx)(L,{type:`number`,min:1e3,max:2e5,value:x,onChange:e=>_(e.target.value),placeholder:`12000`,disabled:o})]}),(0,B.jsx)(zd,{value:JSON.stringify(n.providerOptions||{},null,2),onChange:e=>{try{i({providerOptions:JSON.parse(e.target.value)})}catch{}},rows:3,disabled:o,className:`font-mono text-xs`,placeholder:`{}`})]})]}),!o&&(0,B.jsxs)(Id,{children:[(0,B.jsx)(I,{variant:`outline`,onClick:r,children:`Cancel`}),(0,B.jsx)(I,{onClick:a,children:s?`Create`:`Save`})]})]})})}function Uf(){let e=A(e=>e.commandPaletteOpen),t=A(e=>e.commandQuery),n=A(e=>e.set),r=A(e=>e.closeCommandPalette),i=A(e=>e.runCommand),a=el(),o=(0,z.useRef)(null);return(0,z.useEffect)(()=>{e&&setTimeout(()=>o.current?.focus(),50)},[e]),e?(0,B.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-start justify-center pt-[15vh]`,onClick:e=>{e.target===e.currentTarget&&r()},children:[(0,B.jsx)(`div`,{className:`fixed inset-0 bg-black/60`}),(0,B.jsxs)(`div`,{className:`relative w-full max-w-lg bg-card border border-border rounded-xl shadow-2xl overflow-hidden`,children:[(0,B.jsx)(`div`,{className:`p-3 border-b border-border`,children:(0,B.jsx)(L,{ref:o,value:t,onChange:e=>n({commandQuery:e.target.value}),placeholder:`Type a command...`,className:`border-0 bg-transparent focus-visible:ring-0 text-base`})}),(0,B.jsxs)(`div`,{className:`max-h-80 overflow-y-auto p-2`,children:[a.map(e=>(0,B.jsxs)(`button`,{onClick:()=>i(e),className:`w-full flex items-center gap-3 px-3 py-2.5 rounded-lg hover:bg-accent text-left transition-colors`,children:[(0,B.jsx)(Qe[e.icon]||lt,{className:`w-4 h-4 text-muted-foreground shrink-0`}),(0,B.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,B.jsx)(`div`,{className:`text-sm`,children:e.title}),e.subtitle&&(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground truncate`,children:e.subtitle})]})]},e.id)),a.length===0&&(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground text-center py-4`,children:`No matching commands.`})]})]})]}):null}function Wf(){let e=A(e=>e.set),t=A(e=>e.connected);return(0,B.jsxs)(`div`,{className:`xl:hidden shrink-0 sticky top-0 z-30 bg-card border-b border-border px-4 h-[var(--header-h)] flex items-center gap-3`,children:[(0,B.jsx)(`button`,{onClick:()=>e({mobileMenuOpen:!0}),className:`p-1 -ml-1 text-muted-foreground hover:text-foreground transition-colors`,"aria-label":`Open menu`,children:(0,B.jsx)(Ce,{className:`w-5 h-5`})}),(0,B.jsx)(b,{className:`w-4 h-4 text-primary`}),(0,B.jsx)(`span`,{className:`font-bold text-sm`,children:`Agent Relay`}),(0,B.jsx)(`span`,{className:`ml-auto w-2 h-2 rounded-full ${t?`bg-emerald-500`:`bg-red-500 animate-pulse`}`})]})}function Gf(e){return e===`five_hour`?`5h burst`:e===`seven_day`?`7-day`:e===`seven_day_sonnet`?`7-day Sonnet`:e===`seven_day_opus`?`7-day Opus`:e===`primary`?`Primary`:e===`secondary`?`Secondary`:e}function Kf(e,t){if(!t)return``;let n=Math.max(0,(t-e)/1e3);if(n<60)return`${Math.floor(n)}s`;if(n<3600)return`${Math.floor(n/60)}m`;if(n<86400){let e=Math.floor(n/3600),t=Math.round(n%3600/60);return t===60?`${e+1}h`:t>0?`${e}h ${t}m`:`${e}h`}return`${Math.floor(n/86400)}d`}var qf=`agent-relay:quota-widget`,Jf=300*1e3;function Yf(e){return!e.quota&&e.lastError?.type===`unavailable`}function Xf(e,t){let n=t===`5h`?[`five_hour`,`primary`]:[`seven_day`,`secondary`];return e.quota?.windows.find(e=>n.includes(e.name))}function Zf(e,t){if(!t)return``;let n=Math.max(0,(t-e)/1e3);return n<3600?`${Math.floor(n/60)}m`:n<86400?`${Math.round(n/3600)}h`:`${(n/86400).toFixed(1).replace(/\.0$/,``)}d`}function Qf({record:e,now:t,advisory:n}){let r=(0,B.jsx)(mu,{provider:e.provider,className:`w-3.5 h-3.5`});if(Yf(e))return(0,B.jsxs)(`span`,{className:`flex items-center gap-1 shrink-0 text-muted-foreground`,children:[r,(0,B.jsx)(`span`,{className:`italic`,children:`unavailable`})]});if(!e.quota){let n=e.lastAttemptAt?j(t,e.lastAttemptAt):``,i=e.lastError?.retryAfterMs,a=i==null?null:Math.ceil(Math.max(0,(e.lastAttemptAt+i-t)/1e3));return(0,B.jsxs)(`span`,{className:`flex items-center gap-1 shrink-0 text-muted-foreground`,children:[r,n&&(0,B.jsx)(`span`,{children:n}),a!=null&&a>0&&(0,B.jsxs)(`span`,{className:`text-amber-400/70`,children:[`~`,a,`s`]})]})}let i=Xf(e,`5h`),a=Xf(e,`7d`);function o(e){if(!e)return null;let n=Math.round(e.utilization*100),r=Zf(t,e.resetsAt);return(0,B.jsxs)(`span`,{className:`tabular-nums`,children:[n,`%`,r?`/${r}`:``]})}let s=(e.stale||e.lastError)&&e.lastAttemptAt?j(t,e.lastAttemptAt):``;return(0,B.jsxs)(`span`,{className:`flex items-center gap-1.5 shrink-0 text-foreground/70`,children:[r,(0,B.jsx)(ip,{advisory:n}),o(i),o(a),s&&(0,B.jsx)(`span`,{className:`text-muted-foreground/70`,children:s})]})}function $f(){try{let e=localStorage.getItem(qf);return{open:!0,pinned:!1,...e?JSON.parse(e):{}}}catch{return{open:!0,pinned:!1}}}function ep(e){try{localStorage.setItem(qf,JSON.stringify(e))}catch{}}function tp(){let[{open:e,pinned:t},r]=(0,z.useState)($f),[i,a]=(0,z.useState)(null),[o,s]=(0,z.useState)(null),[c,l]=(0,z.useState)(null),[u,d]=(0,z.useState)(`loading`),f=ht(),p=A(e=>e.connected);(0,z.useEffect)(()=>{if(!p)return;let e=!1;async function t(){try{let[t,r,i]=await Promise.all([n(`GET`,`/provider-quotas`),n(`GET`,`/providers/quota-config`).catch(()=>null),n(`GET`,`/provider-quotas/advisory`).catch(()=>null)]);e||(a(t),s(r),l(i),d(`ok`))}catch{e||d(`error`)}}t();let r=setInterval(()=>void t(),Jf);return()=>{e=!0,clearInterval(r)}},[p,A(e=>e.quotaSeq)]);let m=e||t,h=(i?.quotas??[]).filter(e=>o?.[e.provider]?.showInWidget!==!1),g=h.some(e=>e.stale&&!Yf(e)),_=h.some(e=>e.lastError&&!Yf(e));function v(){if(t)return;let n={open:!e,pinned:t};r(n),ep(n)}function y(){let n=t?{open:e,pinned:!1}:{open:!0,pinned:!0};r(n),ep(n)}return(0,B.jsxs)(`div`,{className:`shrink-0 border-b border-border`,children:[(0,B.jsxs)(`div`,{className:`w-full flex items-center gap-2 px-4 py-2 text-xs hover:bg-muted/30 transition-colors`,children:[(0,B.jsxs)(`button`,{type:`button`,onClick:v,"aria-expanded":m,className:`min-w-0 flex flex-1 items-center gap-2 text-left`,children:[(0,B.jsx)(lt,{className:`w-3.5 h-3.5 shrink-0 text-muted-foreground transition-transform ${m?`rotate-90`:``}`}),(0,B.jsx)(`span`,{className:`font-semibold text-foreground/80 shrink-0 ${m?``:`hidden sm:inline`}`,children:`Provider Quotas`}),u===`loading`&&(0,B.jsx)(je,{className:`w-3 h-3 text-muted-foreground animate-spin`}),u===`error`&&(0,B.jsx)(`span`,{className:`text-amber-400 text-[10px]`,children:`● unavailable`}),!m&&u===`ok`&&h.length>0&&(0,B.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-0.5 text-[10px]`,children:h.map(e=>(0,B.jsx)(Qf,{record:e,now:f,advisory:c?.advisories[e.provider]},`${e.provider}:${e.accountKey}`))}),m&&g&&(0,B.jsx)(`span`,{className:`text-amber-400 text-[10px]`,children:`● stale`}),m&&_&&(0,B.jsx)(`span`,{className:`text-red-400 text-[10px]`,children:`● error`})]}),(0,B.jsx)(`button`,{type:`button`,onClick:y,"aria-pressed":t,title:t?`Unpin`:`Pin always-on`,className:`p-0.5 rounded hover:bg-muted transition-colors ${t?`text-primary`:`text-muted-foreground/50 hover:text-muted-foreground`}`,children:(0,B.jsx)(D,{className:`w-3 h-3`})})]}),m&&(0,B.jsxs)(`div`,{className:`px-4 py-3`,children:[u===`loading`&&(0,B.jsxs)(`p`,{className:`text-xs text-muted-foreground flex items-center gap-1.5`,children:[(0,B.jsx)(je,{className:`w-3 h-3 animate-spin`}),`Loading quota data…`]}),u===`error`&&(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Quota data unavailable — check that you are authenticated and the server is reachable.`}),u===`ok`&&i!==null&&h.length===0&&(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No quota data yet — waiting for runner to report.`}),u===`ok`&&i!==null&&h.length>0&&(0,B.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3`,children:h.map(e=>(0,B.jsx)(sp,{record:e,now:f,advisory:c?.advisories[e.provider]},`${e.provider}:${e.accountKey}`))})]})]})}var np={prefer:{icon:we,badge:`text-emerald-400 bg-emerald-500/10 border-emerald-500/20`,dot:`bg-emerald-400`},caution:{icon:E,badge:`text-amber-400 bg-amber-500/10 border-amber-500/20`,dot:`bg-amber-400`},"avoid-large":{icon:E,badge:`text-orange-400 bg-orange-500/10 border-orange-500/20`,dot:`bg-orange-400`},"hard-avoid":{icon:He,badge:`text-red-400 bg-red-500/10 border-red-500/20`,dot:`bg-red-400`}};function rp({advisory:e}){if(!e)return null;if(e.blockedNow)return(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-[9px] font-medium text-red-400 bg-red-500/10 border border-red-500/20 rounded px-1 py-0.5 shrink-0`,children:[(0,B.jsx)(ft,{className:`w-2.5 h-2.5`}),`blocked`]});let t=e.quotaPenaltyBand;if(t===`normal`)return null;let n=np[t],r=n.icon;return(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-[9px] font-medium ${n.badge} border rounded px-1 py-0.5 shrink-0`,children:[(0,B.jsx)(r,{className:`w-2.5 h-2.5`}),t]})}function ip({advisory:e}){if(!e)return null;if(e.blockedNow)return(0,B.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full bg-red-500 shrink-0`,title:`quota blocked`});let t=e.quotaPenaltyBand;return t===`normal`?null:(0,B.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full ${np[t].dot} shrink-0`,title:t})}function ap(e,t){if(!e||e.confidence===`low`||e.burnRatio===null)return null;let n=e.burnRatio.toFixed(1);return!e.earlyWallMs||e.earlyWallMs<=0?`${n}× rate`:`${n}× · ~${Kf(t,t+e.earlyWallMs)} before reset`}function op({burnWindow:e,now:t}){if(!e)return null;if(e.confidence===`low`||e.burnRatio===null)return(0,B.jsxs)(`div`,{className:`flex items-center gap-1 text-[9px] text-muted-foreground/50`,children:[(0,B.jsx)(Ke,{className:`w-2.5 h-2.5 shrink-0`}),(0,B.jsx)(`span`,{className:`italic`,children:`building burn history…`})]});let n=ap(e,t);return n?(0,B.jsxs)(`div`,{className:`flex items-center gap-1 text-[9px] text-muted-foreground/70 tabular-nums`,children:[(0,B.jsx)(E,{className:`w-2.5 h-2.5 shrink-0`}),(0,B.jsx)(`span`,{children:n})]}):null}function sp({record:e,now:t,advisory:n}){let{provider:r,accountKey:i,quota:a,stale:o,lastError:s,lastUpdatedAt:c,lastAttemptAt:l}=e;if(Yf(e))return(0,B.jsxs)(`div`,{className:`rounded border border-border bg-muted/20 p-3 space-y-1.5 opacity-70`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 min-w-0`,children:[(0,B.jsx)(mu,{provider:r,className:`w-3.5 h-3.5 text-muted-foreground`}),(0,B.jsx)(`span`,{className:`text-[9px] font-medium text-muted-foreground bg-muted border border-border rounded px-1 py-0.5 shrink-0`,children:`unavailable`})]}),(0,B.jsxs)(`p`,{className:`text-[10px] text-muted-foreground`,children:[`Quota unavailable — `,s?.message??`no readable credentials`]})]});let u=s?.retryAfterMs,d=u==null?null:Math.max(0,l+u-t),f=d==null?null:Math.ceil(d/1e3),p=(o||!!s)&&l>0;return(0,B.jsxs)(`div`,{className:`rounded border ${s?`border-red-500/30`:o?`border-amber-500/30`:`border-border`} bg-card p-3 space-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 min-w-0`,children:[(0,B.jsx)(mu,{provider:r,className:`w-3.5 h-3.5`}),(0,B.jsx)(`span`,{className:`text-[10px] text-muted-foreground font-mono truncate`,children:i})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,B.jsx)(rp,{advisory:n}),o&&(0,B.jsx)(`span`,{className:`text-[9px] font-medium text-amber-400 bg-amber-500/10 border border-amber-500/20 rounded px-1 py-0.5`,children:`stale`}),s&&(0,B.jsx)(`span`,{className:`text-[9px] font-medium text-red-400 bg-red-500/10 border border-red-500/20 rounded px-1 py-0.5`,title:s.message,children:s.type===`rate_limited`?`429`:`err`})]})]}),a?(0,B.jsx)(`div`,{className:`space-y-1.5`,children:a.windows.map(n=>{let r=Math.round(n.utilization*100),i=r>=90?`bg-red-500`:r>=70?`bg-amber-500`:`bg-emerald-500`,a=n.resetsAt?Kf(t,n.resetsAt):``,o=e.burn?.windows.find(e=>e.name===n.name);return(0,B.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,B.jsxs)(`div`,{className:`flex justify-between text-[10px] text-muted-foreground`,children:[(0,B.jsx)(`span`,{children:Gf(n.name)}),(0,B.jsxs)(`span`,{children:[r,`%`,a?` · resets in ${a}`:``]})]}),(0,B.jsx)(`div`,{className:`h-1.5 rounded-full bg-muted overflow-hidden`,children:(0,B.jsx)(`div`,{className:`h-full ${i} transition-all duration-500`,style:{width:`${Math.max(0,Math.min(100,r))}%`}})}),(0,B.jsx)(op,{burnWindow:o,now:t})]},n.name)})}):(0,B.jsx)(`p`,{className:`text-[10px] text-muted-foreground italic`,children:s?s.message:`No quota data`}),(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-2 text-[10px] text-muted-foreground/60`,children:[(0,B.jsxs)(`div`,{className:`space-y-0.5 min-w-0`,children:[p&&(0,B.jsxs)(`div`,{children:[`Attempted `,j(t,l)]}),(0,B.jsx)(`div`,{children:c?`Updated ${j(t,c)}`:`Never updated`})]}),f!=null&&(0,B.jsx)(`span`,{className:`text-amber-400/70 shrink-0 mt-0.5`,children:f>0?`retry in ~${f>60?`${Math.ceil(f/60)}m`:`${f}s`}`:`retrying…`})]})]})}function cp(e){return(0,z.lazy)(()=>Gn(e))}var lp=cp(()=>R(()=>import(`./overview-D9BxevAq.js`).then(e=>({default:e.OverviewView})),__vite__mapDeps([16,1,6,8,9,10,17,12,18]),import.meta.url)),up=cp(()=>R(()=>import(`./chat-DHdFZvAg.js`).then(e=>({default:e.ChatView})),__vite__mapDeps([19,1,6,20,8,9,10,21,22,23,24,25,11,12,17,26,13]),import.meta.url)),dp=cp(()=>R(()=>import(`./agents-CLcgi8AD.js`).then(e=>({default:e.AgentsView})),__vite__mapDeps([27,1,28,29,6,12,30,20,31,32,33,34,35,8,9,10,24,25,11,17,18]),import.meta.url)),fp=cp(()=>R(()=>import(`./managed-agents-DUyOTdz1.js`).then(e=>({default:e.ManagedAgentsView})),__vite__mapDeps([36,1,6,8,9,10,25,11,12,17]),import.meta.url)),pp=cp(()=>R(()=>import(`./teams-B_HSkU9T.js`).then(e=>({default:e.TeamsView})),__vite__mapDeps([37,1,38,28,29,6,12,30,20,31,32,39,40,41,33,35,42,8,9,10,23,17,11,18,26]),import.meta.url)),mp=cp(()=>R(()=>import(`./agent-profiles-CT-vbfzd.js`).then(e=>({default:e.AgentProfilesView})),__vite__mapDeps([43,1,6,8,9,10,17,12,11]),import.meta.url)),hp=cp(()=>R(()=>import(`./orchestrators-CEKO3eQ1.js`).then(e=>({default:e.OrchestratorsView})),__vite__mapDeps([44,6,1,8,9,10,17,12,11,18]),import.meta.url)),gp=cp(()=>R(()=>import(`./workspaces-QXbQx_AG.js`).then(e=>({default:e.WorkspacesView})),__vite__mapDeps([45,1,6,8,9,10,25,11,12,17,18]),import.meta.url)),_p=cp(()=>R(()=>import(`./channels-yHkm1dux.js`).then(e=>({default:e.ChannelsView})),__vite__mapDeps([46,6,1,8,9,10,17,12,11,18]),import.meta.url)),vp=cp(()=>R(()=>import(`./connectors-DpR0V2hy.js`).then(e=>({default:e.ConnectorsView})),__vite__mapDeps([47,6,1,8,9,10,17,12,11,18]),import.meta.url)),yp=cp(()=>R(()=>import(`./integrations-CEmYa5mW.js`).then(e=>({default:e.IntegrationsView})),__vite__mapDeps([48,6,1,8,9,10,17,12,11,18]),import.meta.url)),bp=cp(()=>R(()=>import(`./security-8a5_4U3S.js`).then(e=>({default:e.SecurityView})),__vite__mapDeps([49,1,6,25,11,12,17,18,26]),import.meta.url)),xp=cp(()=>R(()=>import(`./memory-2IfPgcnN.js`).then(e=>({default:e.MemoryView})),__vite__mapDeps([50,1,6,8,9,10,17,12,11,18,26]),import.meta.url)),Sp=cp(()=>R(()=>import(`./activity-BhuOs5ha.js`).then(e=>({default:e.ActivityView})),__vite__mapDeps([51,1,6,8,9,10,21,22,17,12,11,18]),import.meta.url)),Cp=cp(()=>R(()=>import(`./pairs-CqT4D1uL.js`).then(e=>({default:e.PairsView})),__vite__mapDeps([52,6,1,8,9,10,17,12,11,18]),import.meta.url)),wp=cp(()=>R(()=>import(`./messages-CkOwABhw.js`).then(e=>({default:e.MessagesView})),__vite__mapDeps([53,1,6,8,9,10,17,12,11,18]),import.meta.url)),Tp=cp(()=>R(()=>import(`./work-queue-C0hpmlv8.js`).then(e=>({default:e.WorkQueueView})),__vite__mapDeps([54,6,1,8,9,10,17,12,11,18]),import.meta.url)),Ep=cp(()=>R(()=>import(`./tasks-Bcr17zR3.js`).then(e=>({default:e.TasksView})),__vite__mapDeps([55,1,6,8,9,10,17,12,11,18]),import.meta.url)),Dp=cp(()=>R(()=>import(`./automation-CE1i1zpw.js`).then(e=>({default:e.AutomationView})),__vite__mapDeps([56,1,6,8,9,10,17,12,11,18,26]),import.meta.url)),Op=cp(()=>R(()=>import(`./analytics-BxGRljQc.js`).then(e=>({default:e.AnalyticsView})),__vite__mapDeps([57,1,6,8,9,10,18,58]),import.meta.url)),kp=cp(()=>R(()=>import(`./insights-C4aYlgsY.js`).then(e=>({default:e.InsightsView})),__vite__mapDeps([59,1,6,17,12,11,18,26,9,10]),import.meta.url)),Ap=cp(()=>R(()=>import(`./projects-C_zwR-Fn.js`).then(e=>({default:e.ProjectsView})),__vite__mapDeps([60,1,6,8,9,10,25,11,12,17,18]),import.meta.url)),jp=cp(()=>R(()=>import(`./registry-BLjwVXCW.js`).then(e=>({default:e.RegistryView})),__vite__mapDeps([61,1,6,17,12,11,18,26,10]),import.meta.url)),Mp=cp(()=>R(()=>import(`./maintenance-DVx3SiC_.js`).then(e=>({default:e.MaintenanceView})),__vite__mapDeps([62,1,6,8,9,10,17,12,11]),import.meta.url)),Np=cp(()=>R(()=>import(`./settings-BR30UpbJ.js`).then(e=>({default:e.SettingsView})),__vite__mapDeps([63,1,38,28,29,6,12,30,20,31,32,39,40,41,33,35,42,8,9,10,22,17,11,18,26,58]),import.meta.url)),Pp=class extends z.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`[ErrorBoundary]`,e.message,`
|
|
22
22
|
`,t.componentStack)}render(){return this.state.error?Hn(this.state.error)?(0,B.jsxs)(`div`,{className:`p-6 text-sm`,children:[(0,B.jsx)(`h2`,{className:`text-foreground text-lg mb-2`,children:`A new version was deployed`}),(0,B.jsx)(`p`,{className:`text-muted-foreground mb-4`,children:`Reload to pick up the latest dashboard.`}),(0,B.jsx)(`button`,{className:`px-3 py-1 bg-primary text-primary-foreground rounded text-sm`,onClick:()=>window.location.reload(),children:`Reload`})]}):(0,B.jsxs)(`div`,{className:`p-6 text-sm font-mono whitespace-pre-wrap`,children:[(0,B.jsx)(`h2`,{className:`text-red-400 text-lg mb-2`,children:`Dashboard Error`}),(0,B.jsx)(`p`,{className:`text-foreground mb-4`,children:this.state.error.message}),(0,B.jsx)(`pre`,{className:`text-muted-foreground text-xs overflow-auto`,children:this.state.error.stack}),(0,B.jsx)(`button`,{className:`mt-4 px-3 py-1 bg-zinc-700 rounded text-sm`,onClick:()=>this.setState({error:null}),children:`Retry`})]}):this.props.children}},Fp={overview:lp,chat:up,agents:dp,managed:fp,teams:pp,profiles:mp,orchestrators:hp,workspaces:gp,files:Yl,channels:_p,connectors:vp,integrations:yp,security:bp,memory:xp,activity:Sp,pairs:Cp,messages:wp,work:Tp,tasks:Ep,automation:Dp,analytics:Op,insights:kp,projects:Ap,registry:jp,maintenance:Mp,settings:Np},Ip=`fixed z-50 top-[calc(var(--header-h,3rem)+0.5rem)] inset-x-3 xl:inset-x-auto xl:top-auto xl:bottom-4 xl:right-4 xl:max-w-sm animate-in fade-in slide-in-from-top-2 xl:slide-in-from-bottom-2 duration-200`;function Lp(){return(0,B.jsxs)(`div`,{className:`flex items-center justify-center py-16 text-muted-foreground text-sm`,children:[(0,B.jsx)(`span`,{className:`inline-block w-3 h-3 mr-2 rounded-full bg-muted-foreground/60 animate-pulse`}),`Loading…`]})}function Rp(){let e=A(e=>e.notification),t=A(e=>e.toastNotification),n=A(e=>e.openNotification),r=A(e=>e.dismissToast);if(t){let e=t;return(0,B.jsxs)(`div`,{className:`${Ip} flex items-start gap-2 px-4 py-3 bg-zinc-800 text-zinc-100 text-sm rounded-md shadow-lg border border-zinc-700`,children:[(0,B.jsxs)(`button`,{type:`button`,onClick:()=>{n(e),r()},className:`flex-1 min-w-0 text-left cursor-pointer`,children:[(0,B.jsx)(`div`,{className:`font-medium truncate`,children:e.title}),(0,B.jsx)(`div`,{className:`text-xs text-zinc-300 line-clamp-2 mt-0.5`,children:e.body}),(0,B.jsx)(`div`,{className:`text-[10px] uppercase tracking-wide text-zinc-400 mt-1`,children:`Tap to open`})]}),(0,B.jsx)(`button`,{type:`button`,onClick:r,"aria-label":`Dismiss`,className:`shrink-0 -mr-1 -mt-1 px-1 text-lg leading-none text-zinc-400 hover:text-zinc-100`,children:`×`})]})}return e?(0,B.jsx)(`div`,{className:`${Ip} px-4 py-2 bg-zinc-800 text-zinc-100 text-sm rounded-md shadow-lg border border-zinc-700`,children:e}):null}function zp(){let e=A(e=>e.init),t=A(e=>e.destroy),n=A(e=>e.theme),r=A(e=>e.view),i=A(e=>e.authNeeded),a=A(e=>e.connectionError),o=A(e=>e.authToken),s=A(e=>e.set),c=A(e=>e.saveTokenAndRefresh),l=A(e=>e.openCommandPalette),u=A(e=>e.commandPaletteOpen),d=A(e=>e.closeCommandPalette);(0,z.useEffect)(()=>{nn(n)},[n]),(0,z.useEffect)(()=>(e(),()=>t()),[]),(0,z.useEffect)(()=>{function e(e){(e.metaKey||e.ctrlKey)&&e.key?.toLowerCase()===`k`?(e.preventDefault(),l()):e.key===`Escape`&&u&&(e.preventDefault(),d())}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[u]);let f=Fp[r]||lp;return(0,B.jsx)(Pp,{children:(0,B.jsx)(Lc,{children:(0,B.jsxs)(`div`,{className:`flex min-h-[calc(100dvh-var(--sat))] mt-[var(--sat)]`,children:[(0,B.jsx)(hl,{}),(0,B.jsx)(gl,{}),(0,B.jsxs)(`main`,{className:`flex-1 min-w-0 h-[calc(100dvh-var(--sat))] flex flex-col overflow-y-auto`,children:[(0,B.jsx)(Wf,{}),!i&&a&&(0,B.jsxs)(`div`,{className:`shrink-0 flex items-center gap-2 p-3 bg-amber-950/40 border-b border-amber-800/60 text-amber-200 text-sm`,children:[(0,B.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full bg-amber-400 animate-pulse`}),`Relay unreachable — showing last known data. Reconnecting…`]}),i&&(0,B.jsxs)(`div`,{className:`shrink-0 flex items-center gap-2 p-3 bg-card border-b border-border`,children:[(0,B.jsx)(rt,{className:`w-4 h-4 text-muted-foreground`}),(0,B.jsx)(L,{type:`password`,placeholder:`Relay token...`,value:o,onChange:e=>s({authToken:e.target.value}),onKeyDown:e=>e.key===`Enter`&&c(),className:`max-w-xs h-8`}),(0,B.jsx)(I,{size:`sm`,onClick:c,children:`Connect`})]}),(0,B.jsx)(tp,{}),(0,B.jsx)(`div`,{className:r===`chat`?`flex min-h-0 flex-1 flex-col`:`p-4 md:p-6`,children:(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(Lp,{}),children:(0,B.jsx)(f,{})})})]}),(0,B.jsx)(md,{}),(0,B.jsx)(kd,{}),(0,B.jsx)(Bd,{}),(0,B.jsx)(Vd,{}),(0,B.jsx)(Hd,{}),(0,B.jsx)(Ud,{}),(0,B.jsx)(Wd,{}),(0,B.jsx)(Gd,{}),(0,B.jsx)(Jd,{}),(0,B.jsx)(Yd,{}),(0,B.jsx)(nf,{}),(0,B.jsx)(of,{}),(0,B.jsx)(sf,{}),(0,B.jsx)(Hf,{}),(0,B.jsx)(Xl,{}),(0,B.jsx)(Uf,{}),(0,B.jsx)(Rp,{})]})})})}if((0,zn.createRoot)(document.getElementById(`root`)).render((0,B.jsx)(z.StrictMode,{children:(0,B.jsx)(zp,{})})),`serviceWorker`in navigator){let e=new URL(`sw.js`,window.location.href),t=new URL(`.`,e),n=new URL(`/`,window.location.origin),r=new URL(`sw.js`,n);t.href!==n.href&&navigator.serviceWorker.getRegistration(n.pathname).then(e=>{e?.scope===n.href&&e.active?.scriptURL===r.href&&e.unregister()}).catch(()=>{}),navigator.serviceWorker.register(e.toString(),{scope:t.pathname}).catch(()=>{})}export{ql as A,Hc as B,ku as C,_u as D,wu as E,ol as F,Jc as G,qc as H,cl as I,Zc as J,Vc as K,il as L,Dl as M,rl as N,lu as O,al as P,nl as R,bu as S,Eu as T,Yc as U,Kc as V,Xc as W,$c as X,Qc as Y,Kn as Z,Lu as _,Fd as a,vu as b,Q as c,dd as d,ud as f,Hu as g,Zu as h,Md as i,Ml as j,Kl as k,Ld as l,fd as m,$ as n,Rd as o,pd as p,Uc as q,zd as r,Id as s,qd as t,Dd as u,Iu as v,Du as w,yu as x,Fu as y,tl as z};
|
|
23
|
-
//# sourceMappingURL=index-
|
|
23
|
+
//# sourceMappingURL=index-DeDosfVE.js.map
|