meshy-node 0.5.10 → 0.6.2

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.
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DashboardPage-D99zb0K5.js","assets/DashboardShared-BxFVLWCW.js","assets/folder-Dz5kKBPA.js","assets/play-DwWmtMUk.js","assets/SharedConversationPage-C5DPKR6h.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DashboardPage-CLJHILHo.js","assets/DashboardShared-h22ibsrQ.js","assets/folder-BmMN0Ktd.js","assets/play-CsdLI-WG.js","assets/SharedConversationPage-BrlYNCnU.js"])))=>i.map(i=>d[i]);
2
2
  function FS(n,l){for(var o=0;o<l.length;o++){const i=l[o];if(typeof i!="string"&&!Array.isArray(i)){for(const u in i)if(u!=="default"&&!(u in n)){const d=Object.getOwnPropertyDescriptor(i,u);d&&Object.defineProperty(n,u,d.get?d:{enumerable:!0,get:()=>i[u]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))i(u);new MutationObserver(u=>{for(const d of u)if(d.type==="childList")for(const f of d.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&i(f)}).observe(document,{childList:!0,subtree:!0});function o(u){const d={};return u.integrity&&(d.integrity=u.integrity),u.referrerPolicy&&(d.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?d.credentials="include":u.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function i(u){if(u.ep)return;u.ep=!0;const d=o(u);fetch(u.href,d)}})();function qv(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var yd={exports:{}},Mo={};/**
3
3
  * @license React
4
4
  * react-jsx-runtime.production.js
@@ -298,4 +298,4 @@ You can add a description to the \`${Rr}\` by passing a \`${fx}\` component as a
298
298
 
299
299
  Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Rr}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
300
300
 
301
- For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return v.useEffect(()=>{var i;document.getElementById((i=n.current)==null?void 0:i.getAttribute("aria-describedby"))||console.warn(l)},[l,n]),null},YA=rx,GA=ox,XA=ix,vx=sx,yx=cx,bx=hx,xx=gx,Sx=dx,wx=mx;const nf=YA,af=GA,PA=XA,Ex=v.forwardRef(({className:n,...l},o)=>m.jsx(vx,{className:ce("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n),...l,ref:o}));Ex.displayName=vx.displayName;const Us=v.forwardRef(({className:n,...l},o)=>m.jsxs(PA,{children:[m.jsx(Ex,{}),m.jsx(yx,{ref:o,className:ce("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 rounded-[22px] border bg-background p-6 shadow-[0_34px_110px_-54px_rgba(0,0,0,0.55)] duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",n),...l})]}));Us.displayName=yx.displayName;const Bs=({className:n,...l})=>m.jsx("div",{className:ce("flex flex-col space-y-2 text-center sm:text-left",n),...l});Bs.displayName="AlertDialogHeader";const Hs=({className:n,...l})=>m.jsx("div",{className:ce("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...l});Hs.displayName="AlertDialogFooter";const Vs=v.forwardRef(({className:n,...l},o)=>m.jsx(Sx,{ref:o,className:ce("text-lg font-semibold",n),...l}));Vs.displayName=Sx.displayName;const $s=v.forwardRef(({className:n,...l},o)=>m.jsx(wx,{ref:o,className:ce("text-sm text-muted-foreground",n),...l}));$s.displayName=wx.displayName;const qs=v.forwardRef(({className:n,...l},o)=>m.jsx(bx,{ref:o,className:ce(vf(),n),...l}));qs.displayName=bx.displayName;const Ys=v.forwardRef(({className:n,...l},o)=>m.jsx(xx,{ref:o,className:ce(vf({variant:"outline"}),"mt-2 sm:mt-0",n),...l}));Ys.displayName=xx.displayName;var rc="Checkbox",[QA]=Ia(rc),[KA,qf]=QA(rc);function ZA(n){const{__scopeCheckbox:l,checked:o,children:i,defaultChecked:u,disabled:d,form:f,name:h,onCheckedChange:y,required:p,value:x="on",internal_do_not_use_render:g}=n,[w,C]=Ar({prop:o,defaultProp:u??!1,onChange:y,caller:rc}),[N,E]=v.useState(null),[T,R]=v.useState(null),A=v.useRef(!1),M=N?!!f||!!N.closest("form"):!0,k={checked:w,disabled:d,setChecked:C,control:N,setControl:E,name:h,form:f,value:x,hasConsumerStoppedPropagationRef:A,required:p,defaultChecked:Xa(u)?!1:u,isFormControl:M,bubbleInput:T,setBubbleInput:R};return m.jsx(KA,{scope:l,...k,children:IA(g)?g(k):i})}var Nx="CheckboxTrigger",Cx=v.forwardRef(({__scopeCheckbox:n,onKeyDown:l,onClick:o,...i},u)=>{const{control:d,value:f,disabled:h,checked:y,required:p,setControl:x,setChecked:g,hasConsumerStoppedPropagationRef:w,isFormControl:C,bubbleInput:N}=qf(Nx,n),E=Ze(u,x),T=v.useRef(y);return v.useEffect(()=>{const R=d==null?void 0:d.form;if(R){const A=()=>g(T.current);return R.addEventListener("reset",A),()=>R.removeEventListener("reset",A)}},[d,g]),m.jsx(Le.button,{type:"button",role:"checkbox","aria-checked":Xa(y)?"mixed":y,"aria-required":p,"data-state":jx(y),"data-disabled":h?"":void 0,disabled:h,value:f,...i,ref:E,onKeyDown:Me(l,R=>{R.key==="Enter"&&R.preventDefault()}),onClick:Me(o,R=>{g(A=>Xa(A)?!0:!A),N&&C&&(w.current=R.isPropagationStopped(),w.current||R.stopPropagation())})})});Cx.displayName=Nx;var Yf=v.forwardRef((n,l)=>{const{__scopeCheckbox:o,name:i,checked:u,defaultChecked:d,required:f,disabled:h,value:y,onCheckedChange:p,form:x,...g}=n;return m.jsx(ZA,{__scopeCheckbox:o,checked:u,defaultChecked:d,disabled:h,required:f,onCheckedChange:p,name:i,form:x,value:y,internal_do_not_use_render:({isFormControl:w})=>m.jsxs(m.Fragment,{children:[m.jsx(Cx,{...g,ref:l,__scopeCheckbox:o}),w&&m.jsx(_x,{__scopeCheckbox:o})]})})});Yf.displayName=rc;var Tx="CheckboxIndicator",Rx=v.forwardRef((n,l)=>{const{__scopeCheckbox:o,forceMount:i,...u}=n,d=qf(Tx,o);return m.jsx(Dr,{present:i||Xa(d.checked)||d.checked===!0,children:m.jsx(Le.span,{"data-state":jx(d.checked),"data-disabled":d.disabled?"":void 0,...u,ref:l,style:{pointerEvents:"none",...n.style}})})});Rx.displayName=Tx;var Ax="CheckboxBubbleInput",_x=v.forwardRef(({__scopeCheckbox:n,...l},o)=>{const{control:i,hasConsumerStoppedPropagationRef:u,checked:d,defaultChecked:f,required:h,disabled:y,name:p,value:x,form:g,bubbleInput:w,setBubbleInput:C}=qf(Ax,n),N=Ze(o,C),E=Fy(d),T=Vy(i);v.useEffect(()=>{const A=w;if(!A)return;const M=window.HTMLInputElement.prototype,$=Object.getOwnPropertyDescriptor(M,"checked").set,G=!u.current;if(E!==d&&$){const B=new Event("click",{bubbles:G});A.indeterminate=Xa(d),$.call(A,Xa(d)?!1:d),A.dispatchEvent(B)}},[w,E,d,u]);const R=v.useRef(Xa(d)?!1:d);return m.jsx(Le.input,{type:"checkbox","aria-hidden":!0,defaultChecked:f??R.current,required:h,disabled:y,name:p,value:x,form:g,...l,tabIndex:-1,ref:N,style:{...l.style,...T,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});_x.displayName=Ax;function IA(n){return typeof n=="function"}function Xa(n){return n==="indeterminate"}function jx(n){return Xa(n)?"indeterminate":n?"checked":"unchecked"}const Mx=v.forwardRef(({className:n,...l},o)=>m.jsx(Yf,{ref:o,className:ce("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",n),...l,children:m.jsx(Rx,{className:ce("flex items-center justify-center text-current"),children:m.jsx(mf,{className:"h-3.5 w-3.5"})})}));Mx.displayName=Yf.displayName;const Ox=v.forwardRef(({className:n,type:l,...o},i)=>m.jsx("input",{type:l,className:ce("flex h-10 w-full rounded-[16px] border border-input/85 bg-background/72 px-3 py-2 text-sm shadow-sm ring-offset-background transition-all duration-200 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground/75 focus-visible:border-primary/45 focus-visible:bg-background/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/45 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",n),ref:i,...o}));Ox.displayName="Input";const Bv=["queued","running"];function FA(n){return n.map(l=>`${l.id}:${l.name}`).join("\0")}function JA(n){return n==="claude"||n==="codex"||n==="copilot"}function Dx(n){var o;if(n.kind!=="agent.upgrade")return null;const l=(o=n.payload)==null?void 0:o.agent;return JA(l)?`${n.nodeId}:${l}`:null}function WA(n){return n.status==="succeeded"||n.status==="failed"}async function kx(n,l={}){const o=l.getOperation??Pw,i=l.pollIntervalMs??2e3,u=l.timeoutMs??24e4,d=Date.now()+u;let f=n;for(;!WA(f)&&Date.now()<d;)await t_(i),f=await o(n.id);return f}async function e_(n,l=Qw){const o=new Set(n),i=await Promise.all(Bv.map(d=>l({kind:"agent.upgrade",status:d}))),u=new Map;for(const d of i.flat()){if(!Bv.includes(d.status)||o.size>0&&!o.has(d.nodeId))continue;const f=Dx(d);if(!f)continue;const h=u.get(f);(!h||d.updatedAt>h.updatedAt)&&u.set(f,d)}return u}function t_(n){return new Promise(l=>setTimeout(l,n))}const n_=1500,a_=1e3,l_=9e4;async function r_(n={}){const l=n.fetchHealth??o_,o=n.initialDelayMs??n_,i=n.pollIntervalMs??a_,u=n.previousPid,d=n.reload??(()=>window.location.reload()),f=n.sleep??s_,h=n.timeoutMs??l_,y=Date.now()+h;let p=!1;for(o>0&&await f(o);Date.now()<=y;){const x=i_(await l());if(!x.ok){p=!0,await f(i);continue}if(u===void 0||x.pid!==void 0&&x.pid!==u||p)return d(),!0;await f(i)}return!1}async function o_(){try{const n=await fetch("/api/system/health",{cache:"no-store"}),l=await n.json().catch(()=>null),o=l&&typeof l=="object"&&typeof l.pid=="number"?l.pid:void 0;return{ok:n.ok,pid:o}}catch{return!1}}function i_(n){return typeof n=="boolean"?{ok:n}:n}function s_(n){return new Promise(l=>window.setTimeout(l,n))}function c_(n,l=!0){return l?(n==null?void 0:n.restartMode)==="development"?"Restart dev runtime":n!=null&&n.updateAvailable?"Restart to update":"Restart runtime":n!=null&&n.updateAvailable?"Restart follower to update":"Restart follower"}function u_({checkedLabel:n,disableAuthDefault:l,endpoint:o,isLiveLocalNode:i,nodeId:u,nodeName:d,onRefresh:f,pid:h,transportType:y,update:p,workDir:x}){const g=c_(p,i),[w,C]=v.useState(null),[N,E]=v.useState(()=>Hv({disableAuthDefault:l,endpoint:o,nodeName:d,transportType:y,workDir:x})),[T,R]=v.useState(!1),[A,M]=v.useState(!1),[k,$]=v.useState(!1);v.useEffect(()=>{E(Hv({disableAuthDefault:l,endpoint:o,nodeName:d,transportType:y,workDir:x}))},[l,o,d,y,x]);async function G(){if(!u||T||A)return;const oe=p.updateAvailable?"update":"restart",pe=m_(N);if(N.port.trim()&&(pe==null?void 0:pe.port)===void 0){ut.error("Runtime restart port must be a positive integer");return}const me=pe?{reason:oe,startArgs:pe}:{reason:oe};R(!0);try{if(i){const O=await Yw(me);C({...O,pid:O.pid??h,status:"accepted"}),ut.info(`Restarting ${d} from a detached helper. PID ${O.pid??h??"unknown"} will not stay attached to the original terminal window; follow ${O.logPath} for launch output.`),r_({previousPid:O.pid??h}).then(Y=>{Y||(R(!1),ut.error("Runtime restart was accepted, but the dashboard did not reconnect before the timeout. Refresh the page after the node finishes starting."))}).catch(Y=>{R(!1),ut.error(Y instanceof Error?Y.message:"Runtime restart recovery failed")});return}const ue=await Zw(u,me);C({operationId:ue.id,pid:h,status:ue.status}),ut.info(`Restart requested on ${d}. Operation ${Vd(ue.id)} will hand off to a detached process, so the new runtime will not stay attached to the original terminal window.`);const de=await kx(ue,{timeoutMs:6e4}),re=f_(de);C({command:re==null?void 0:re.command,logPath:re==null?void 0:re.logPath,mode:re==null?void 0:re.mode,operationId:de.id,pid:(re==null?void 0:re.pid)??h,status:de.status}),de.status==="succeeded"?(await(f==null?void 0:f()),ut.success(`Restart handoff accepted on ${d}. Follow ${(re==null?void 0:re.logPath)??"the node restart log"} for launch output.`)):de.status==="failed"?ut.error(de.error??`Restart failed on ${d}`):ut.info(`Restart operation ${Vd(de.id)} is still ${de.status}. More details will update after the node reports back.`),R(!1)}catch(ue){R(!1),ut.error(ue instanceof Error?ue.message:"Runtime restart failed")}}async function B(){if(!(!i||T||A)){M(!0);try{const oe=await Gw();ut.info(`Stopping Meshy process ${oe.pid}`)}catch(oe){M(!1),ut.error(oe instanceof Error?oe.message:"Runtime stop failed")}}}const V=T?"restarting":A?"stopping":(w==null?void 0:w.status)??"idle",ae=p.restartMode==="development";return m.jsxs("div",{className:"rounded-xl border border-border/70 bg-background/70 overflow-hidden",children:[m.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b border-border/50",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(Rs,{className:"h-3.5 w-3.5 text-primary shrink-0"}),m.jsxs("div",{children:[m.jsx("div",{className:"text-[11px] font-semibold text-foreground leading-tight",children:"Runtime"}),m.jsx("div",{className:"text-[10px] text-muted-foreground leading-tight",children:ae?"Development launcher":`Latest ${p.latestVersion??"—"}`})]})]}),m.jsx("div",{className:"flex items-center gap-1.5",children:m.jsx(mt,{variant:p.updateAvailable?"default":"outline",className:"rounded-full border-border/70 bg-background/60 font-mono text-[10px] px-2 py-0.5",children:ae?"dev":p.updateAvailable?`→ ${p.latestVersion}`:"current"})})]}),m.jsxs("div",{className:"grid grid-cols-2 divide-x divide-border/50 border-b border-border/50",children:[m.jsxs("div",{className:"px-3 py-1.5",children:[m.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:"PID"}),m.jsx("div",{className:"mt-0.5 font-mono text-[11px] text-foreground",children:h??"—"})]}),m.jsxs("div",{className:"px-3 py-1.5",children:[m.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:"Status"}),m.jsx("div",{className:"mt-0.5 text-[11px] text-foreground capitalize",children:V})]})]}),m.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2",children:[m.jsxs("div",{className:"text-[10px] text-muted-foreground",children:["Checked ",n]}),m.jsxs("div",{className:"flex items-center gap-1.5",children:[i&&m.jsxs(nf,{children:[m.jsx(af,{asChild:!0,children:m.jsxs(Vn,{type:"button",size:"sm",variant:"ghost",disabled:T||A,className:"h-7 rounded-lg px-2 text-[11px] text-muted-foreground hover:text-destructive hover:bg-destructive/10",children:[m.jsx(IE,{className:ce("mr-1 h-3.5 w-3.5",A&&"animate-pulse")}),A?"Stopping":"Stop"]})}),m.jsxs(Us,{className:"max-w-[22rem] rounded-xl gap-2 p-4",children:[m.jsxs(Bs,{className:"space-y-1",children:[m.jsx(Vs,{className:"text-sm",children:"Stop runtime?"}),m.jsx($s,{className:"text-[11px] leading-4",children:"Gracefully stops the current Meshy process without launching a replacement. The dashboard will disconnect until the node is started again."})]}),m.jsxs(Hs,{className:"gap-1 pt-0 sm:space-x-1",children:[m.jsx(Ys,{className:"h-7 rounded-lg px-2 text-[11px]",children:"Cancel"}),m.jsx(qs,{className:"h-7 rounded-lg px-2 text-[11px] bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>void B(),children:"Stop runtime"})]})]})]}),m.jsxs(nf,{children:[m.jsx(af,{asChild:!0,children:m.jsxs(Vn,{type:"button",size:"sm",variant:p.updateAvailable?"default":"outline",disabled:!u||T||A,className:"h-7 rounded-lg px-2 text-[11px]",children:[m.jsx(WE,{className:ce("mr-1 h-3.5 w-3.5",T&&"animate-spin")}),T?"Restarting…":g]})}),m.jsxs(Us,{className:"max-w-[28rem] gap-3 rounded-xl p-4",children:[m.jsxs(Bs,{className:"space-y-1",children:[m.jsxs(Vs,{className:"text-sm",children:[g,"?"]}),m.jsxs($s,{className:"text-[11px] leading-4",children:["Starts a detached restart helper, shuts down ",i?"the current node":d,", and brings it back with the configured launcher. The new process will not stay attached to the original terminal window."]})]}),m.jsx(d_,{value:N,onChange:E}),m.jsxs(Hs,{className:"gap-1 pt-0 sm:space-x-1",children:[m.jsx(Ys,{className:"h-7 rounded-lg px-2 text-[11px]",children:"Cancel"}),m.jsx(qs,{className:"h-7 rounded-lg px-2 text-[11px]",onClick:()=>void G(),children:g})]})]})]})]})]}),m.jsxs("div",{className:"border-t border-border/50",children:[m.jsxs("button",{type:"button",onClick:()=>$(oe=>!oe),className:"flex w-full items-center justify-between px-3 py-1.5 text-[10px] text-muted-foreground hover:text-foreground hover:bg-muted/30 transition-colors",children:[m.jsxs("span",{className:"flex items-center gap-1.5",children:[m.jsx(S0,{className:"h-3 w-3"}),"Restart details"]}),m.jsx(Qs,{className:ce("h-3 w-3 transition-transform duration-150",k&&"rotate-180")})]}),k&&m.jsxs("div",{className:"border-t border-border/50 bg-muted/20 px-3 py-2 space-y-1",children:[m.jsx(Nl,{label:"Current PID",value:h===void 0?"—":String(h),mono:h!==void 0}),m.jsx(Nl,{label:"Restart PID",value:(w==null?void 0:w.pid)===void 0?"Pending":String(w.pid),mono:(w==null?void 0:w.pid)!==void 0}),m.jsx(Nl,{label:"Operation",value:w!=null&&w.operationId?Vd(w.operationId):"Local direct request",mono:!!(w!=null&&w.operationId)}),m.jsx(Nl,{label:"Status",value:(w==null?void 0:w.status)??(T?"requested":"idle")}),m.jsx(Nl,{label:"Launcher",value:(w==null?void 0:w.command)??"Available after restart",mono:!!(w!=null&&w.command)}),m.jsx(Nl,{label:"Log",value:(w==null?void 0:w.logPath)??"Available after restart",mono:!!(w!=null&&w.logPath)}),m.jsx(Nl,{label:"Terminal",value:"New process is detached from original terminal"})]})]}),p.detail&&m.jsx("div",{className:"border-t border-border/50 px-3 py-1.5 text-[10px] text-muted-foreground bg-muted/20",children:p.detail})]})}function d_({onChange:n,value:l}){const o=(i,u)=>{n({...l,[i]:u})};return m.jsxs("div",{className:"rounded-lg border border-border/70 bg-muted/30 p-3 space-y-3",children:[m.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-muted-foreground",children:"Startup arguments"}),m.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[m.jsx(zo,{label:"HTTP port",value:l.port,onChange:i=>o("port",i),inputMode:"numeric"}),m.jsx(zo,{label:"Node name",value:l.name,onChange:i=>o("name",i)}),m.jsx(zo,{label:"Join endpoint",value:l.join,onChange:i=>o("join",i),className:"sm:col-span-2"}),m.jsxs("div",{className:"space-y-1",children:[m.jsx("label",{className:"text-[9px] uppercase tracking-[0.14em] text-muted-foreground",children:"Transport"}),m.jsxs(kb,{value:l.transport,onValueChange:i=>o("transport",zx(i)),children:[m.jsx(Hf,{className:"h-7 rounded-md border-border/70 bg-background/70 px-2 text-[10px]",children:m.jsx(zb,{placeholder:"Transport"})}),m.jsxs(Vf,{children:[m.jsx(Nr,{className:"py-1 text-[11px]",value:"inherit",children:"current / default"}),m.jsx(Nr,{className:"py-1 text-[11px]",value:"direct",children:"direct"}),m.jsx(Nr,{className:"py-1 text-[11px]",value:"devtunnel",children:"devtunnel"}),m.jsx(Nr,{className:"py-1 text-[11px]",value:"tailscale",children:"tailscale"})]})]})]}),m.jsx(zo,{label:"Working directory",value:l.workDir,onChange:i=>o("workDir",i)}),m.jsx(zo,{label:"Config path",value:l.config,onChange:i=>o("config",i),className:"sm:col-span-2"}),m.jsxs("label",{className:"flex items-center gap-2 rounded-md border border-border/60 bg-background/60 px-2 py-1.5 text-[10px] text-foreground sm:col-span-2 cursor-pointer hover:bg-muted/40 transition-colors",children:[m.jsx(Mx,{className:"h-3.5 w-3.5",checked:l.disableAuth,onCheckedChange:i=>n({...l,disableAuth:i===!0,disableAuthKnown:!0})}),"Disable auth"]})]})]})}function zo({className:n,inputMode:l,label:o,onChange:i,value:u}){return m.jsxs("label",{className:ce("space-y-1",n),children:[m.jsx("span",{className:"text-[9px] uppercase tracking-[0.14em] text-muted-foreground",children:o}),m.jsx(Ox,{className:"h-7 rounded-md px-2 text-[10px]",inputMode:l,value:u,onChange:d=>i(d.target.value)})]})}function Nl({label:n,value:l,mono:o=!1}){return m.jsxs("div",{className:"flex items-start justify-between gap-3 text-[10px]",children:[m.jsx("span",{className:"shrink-0 uppercase tracking-[0.14em] text-muted-foreground",children:n}),m.jsx("span",{className:ce("break-all text-right text-foreground",o&&"font-mono"),children:l})]})}function f_(n){const l=n.result;if(!l||typeof l!="object")return null;const o=l;return o.ok!==!0||typeof o.command!="string"||typeof o.logPath!="string"?null:{ok:!0,mode:o.mode==="package"?"package":"development",command:o.command,logPath:o.logPath,pid:typeof o.pid=="number"?o.pid:void 0}}function Hv(n){return{port:h_(n.endpoint),name:n.nodeName,join:"",transport:zx(n.transportType),workDir:n.workDir??"",config:"",disableAuth:n.disableAuthDefault===!0,disableAuthKnown:n.disableAuthDefault!==void 0}}function m_(n){const l={},o=Number(n.port.trim());return n.port.trim()&&Number.isInteger(o)&&o>0&&(l.port=o),n.name.trim()&&(l.name=n.name.trim()),n.join.trim()&&(l.join=n.join.trim()),n.transport!=="inherit"&&(l.transport=n.transport),n.workDir.trim()&&(l.workDir=n.workDir.trim()),n.config.trim()&&(l.config=n.config.trim()),n.disableAuthKnown&&(l.disableAuth=n.disableAuth),Object.keys(l).length>0?l:void 0}function zx(n){return n==="direct"||n==="devtunnel"||n==="tailscale"?n:"inherit"}function h_(n){if(!n)return"";try{return new URL(n).port||""}catch{return""}}function Vd(n){return n.length<=8?n:n.slice(0,8)}function p_(n){return[{key:"workspace",label:"Workspace",value:n==null?void 0:n.workspace},{key:"node",label:"Node app",value:n==null?void 0:n.node},{key:"core",label:"Core",value:n==null?void 0:n.core},{key:"dashboard",label:"Dashboard",value:n==null?void 0:n.dashboard},{key:"api",label:"API",value:n==null?void 0:n.api}].filter(o=>o.value)}function Sr({label:n,value:l,mono:o=!1}){return m.jsxs("div",{className:"min-w-0 rounded-lg border border-border/60 bg-background/65 px-2.5 py-1.5",children:[m.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:n}),m.jsx("div",{className:o?"mt-0.5 break-all font-mono text-[11px] text-foreground":"mt-0.5 break-all text-[11px] text-foreground",children:l})]})}function g_({formatDateTime:n,isLiveLocalNode:l,onRefresh:o,runtimeUpdate:i,selectedNode:u,viewInfo:d}){var h,y,p,x,g,w,C,N,E,T,R;const f=p_(d.packages);return m.jsxs(Ls,{value:"about","data-about-layout":"compact",className:"mt-0 space-y-2",children:[m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(On,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(Dn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(xE,{className:"h-3.5 w-3.5 text-primary"}),"Repository & runtime"]}),m.jsx(kn,{className:"text-[10px]",children:"Build source and runtime identity for this node."})]}),m.jsxs(zn,{className:"space-y-2 px-3 pb-2.5",children:[(h=d.repository)!=null&&h.url?m.jsxs("a",{href:d.repository.url,target:"_blank",rel:"noreferrer",className:"group flex min-w-0 items-center justify-between gap-2 rounded-lg border border-border/70 bg-background/70 px-2.5 py-1.5 text-[11px] text-foreground transition-colors hover:border-primary/40 hover:bg-primary/5",children:[m.jsx("span",{className:"truncate font-mono text-[10px]",children:d.repository.url}),m.jsx(VE,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform group-hover:-translate-y-0.5 group-hover:translate-x-0.5"})]}):m.jsx("div",{className:"rounded-lg border border-dashed border-border/70 bg-muted/20 px-2.5 py-1.5 text-[11px] text-muted-foreground",children:"Repository URL is unavailable in this runtime."}),m.jsxs("div",{className:"grid gap-1.5 sm:grid-cols-2 lg:grid-cols-3",children:[m.jsx(Sr,{label:"Branch",value:((y=d.repository)==null?void 0:y.branch)??"Unavailable",mono:!!((p=d.repository)!=null&&p.branch)}),m.jsx(Sr,{label:"Commit",value:((x=d.repository)==null?void 0:x.commit)??"Unavailable",mono:!!((g=d.repository)!=null&&g.commit)}),m.jsx(Sr,{label:"Runtime",value:`${d.packageName??"meshy"} ${d.version}`,mono:!0}),m.jsx(Sr,{label:"Node.js",value:((w=d.runtime)==null?void 0:w.nodeVersion)??"Unavailable",mono:!!((C=d.runtime)!=null&&C.nodeVersion)}),m.jsx(Sr,{label:"PID",value:d.runtime?String(d.runtime.pid):"Unavailable",mono:!!d.runtime}),m.jsx(Sr,{label:"Started",value:n((N=d.runtime)==null?void 0:N.startedAt)})]})]})]}),i&&m.jsx(u_,{checkedLabel:n(i.checkedAt),disableAuthDefault:((E=d.auth)==null?void 0:E.enabled)===void 0?void 0:d.auth.enabled===!1,endpoint:u.endpoint,isLiveLocalNode:l,nodeId:u.id,nodeName:u.name,onRefresh:o,pid:(T=d.runtime)==null?void 0:T.pid,transportType:u.transportType,update:i,workDir:((R=d.runtime)==null?void 0:R.workDir)??u.workDir}),m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(On,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(Dn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(GE,{className:"h-3.5 w-3.5 text-primary"}),"Package versions"]}),m.jsx(kn,{className:"text-[10px]",children:"Version snapshot for the packages most relevant to this dashboard session."})]}),m.jsx(zn,{"data-package-layout":"list",className:"space-y-1.5 px-3 pb-2.5",children:f.map(A=>{var M,k;return m.jsxs("div",{className:"grid gap-1.5 rounded-lg border border-border/60 bg-background/65 px-2.5 py-1.5 sm:grid-cols-[9rem_minmax(0,1fr)_auto] sm:items-center",children:[m.jsx("div",{className:"text-[11px] font-medium text-foreground",children:A.label}),m.jsx("div",{className:"min-w-0 truncate text-[10px] text-muted-foreground",children:(M=A.value)==null?void 0:M.name}),m.jsx(mt,{variant:"outline",className:"w-fit rounded-[11px] border-border/70 bg-background/60 font-mono text-[10px]",children:(k=A.value)==null?void 0:k.version})]},A.key)})})]})]})}function Lo({formatDateTime:n,name:l,status:o,statusVariant:i}){return m.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-border/60 bg-background/70 px-2.5 py-1.5",children:[m.jsxs("div",{children:[m.jsx("div",{className:"text-[11px] font-medium text-foreground",children:l}),m.jsx("div",{className:"text-[10px] text-muted-foreground",children:n(o==null?void 0:o.checkedAt)})]}),m.jsxs("div",{className:"flex items-center gap-1.5",children:[typeof(o==null?void 0:o.authenticated)=="boolean"&&m.jsx(mt,{variant:o.authenticated?"default":"outline",className:"rounded-full text-[10px] uppercase tracking-[0.14em]",children:o.authenticated?"auth ok":"auth required"}),m.jsx(mt,{variant:i(o==null?void 0:o.status),className:"rounded-full text-[10px] uppercase tracking-[0.14em]",children:(o==null?void 0:o.status)??"unknown"})]})]})}function Ft(n){if(n==null||n==="")return"Unavailable";const l=new Date(n);return Number.isNaN(l.getTime())?"Unavailable":new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(l)}function v_(n){const l=Math.max(0,Math.floor(n)),o=Math.floor(l/86400),i=Math.floor(l%86400/3600),u=Math.floor(l%3600/60);return o>0?`${o}d ${i}h`:i>0?`${i}h ${u}m`:`${u}m`}function Vv(n){if(n==null||Number.isNaN(n))return"Unavailable";const l=["B","KB","MB","GB","TB"];let o=n,i=0;for(;o>=1024&&i<l.length-1;)o/=1024,i+=1;return`${o.toFixed(o>=10||i===0?0:1)} ${l[i]}`}function Er(n){return n==="ok"?"default":n==="missing"||n==="install-failed"||n==="login-failed"?"destructive":n==="not-authenticated"||n==="unsupported-platform"?"outline":"secondary"}function y_(n){return n.available?m.jsxs(mt,{className:"gap-1 rounded-full px-2 py-0.5 text-[10px]",children:[m.jsx(Bo,{className:"h-3 w-3"}),"Available"]}):m.jsxs(mt,{variant:"destructive",className:"gap-1 rounded-full px-2 py-0.5 text-[10px]",children:[m.jsx(kE,{className:"h-3 w-3"}),"Unavailable"]})}function b_(n){return n.update?n.update.updateAvailable?m.jsxs(mt,{variant:"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:["Update ",n.update.latestVersion]}):m.jsx(mt,{variant:"secondary",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:"Up to date"}):null}function x_(n){var o;const l=`npm install -g ${(o=n.update)==null?void 0:o.packageName}@latest`;return n.id==="claude"?`${l} --include=optional --ignore-scripts=false`:l}function S_(n){if(n.error)return n.error;const l=n.result;return(l==null?void 0:l.detail)??null}function Ke({label:n,value:l,mono:o=!1}){return m.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-border/50 py-1 last:border-b-0 last:pb-0 first:pt-0",children:[m.jsx("span",{className:"shrink-0 text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:n}),m.jsx("span",{className:ce("break-all text-right text-[11px] text-foreground",o&&"font-mono text-[11px]"),children:l})]})}function Uo({label:n,value:l,mono:o=!1,className:i}){return m.jsxs("div",{className:ce("min-w-0 space-y-0.5",i),children:[m.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:n}),m.jsx("div",{className:ce("truncate text-[11px] text-foreground",o&&"font-mono",n==="Path"&&"break-all whitespace-normal"),children:l})]})}function w_({agent:n,nodeName:l,activeOperation:o,onUpgrade:i}){var h,y;const u=((h=n.update)==null?void 0:h.updateAvailable)===!0,d=b_(n),f=!!o;return m.jsxs("div",{className:"rounded-lg border border-border/60 bg-background/65 px-3 py-2.5 transition-colors hover:bg-background/85",children:[m.jsxs("div",{className:"grid gap-3 lg:grid-cols-[12rem_minmax(0,1fr)_auto] lg:items-start",children:[m.jsxs("div",{className:"min-w-0 space-y-1.5",children:[m.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] font-semibold text-foreground",children:[m.jsx(g0,{className:"h-3.5 w-3.5 shrink-0 text-primary"}),m.jsx("span",{className:"truncate",children:n.label})]}),m.jsxs("div",{className:"truncate text-[10px] text-muted-foreground",children:["Command: ",m.jsx("span",{className:"font-mono text-[10px]",children:n.command})]}),m.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[y_(n),n.metadataStatus&&m.jsx(mt,{variant:Er(n.metadataStatus),className:"rounded-full px-2 py-0 text-[10px] uppercase tracking-[0.14em]",children:n.metadataStatus})]})]}),m.jsxs("div",{className:"grid min-w-0 gap-x-4 gap-y-1.5 sm:grid-cols-2",children:[m.jsx(Uo,{label:"Version",value:n.version??"Unavailable",mono:!!n.version}),n.update&&m.jsx(Uo,{label:"Latest",value:n.update.latestVersion??"Unavailable",mono:!!n.update.latestVersion}),m.jsx(Uo,{label:"Checked",value:Ft(n.checkedAt)}),n.update&&m.jsx(Uo,{label:"Update check",value:Ft(n.update.checkedAt)}),m.jsx(Uo,{label:"Path",value:n.path??"Not on PATH",mono:!!n.path,className:"sm:col-span-2"})]}),m.jsx("div",{className:"flex items-start justify-start lg:justify-end",children:o?m.jsxs(mt,{variant:"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:["Upgrade ",o.status]}):u?m.jsxs(nf,{children:[m.jsx(af,{asChild:!0,children:m.jsx("button",{type:"button",disabled:f,className:"rounded-full transition duration-150 hover:-translate-y-0.5 hover:scale-[1.03] hover:shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45 focus-visible:ring-offset-2 active:translate-y-0 active:scale-95 disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:translate-y-0 disabled:hover:scale-100 disabled:hover:shadow-none",children:d})}),m.jsxs(Us,{children:[m.jsxs(Bs,{children:[m.jsxs(Vs,{children:["Upgrade ",n.label,"?"]}),m.jsxs($s,{children:["This runs ",x_(n)," on ",l,". Remote nodes execute the command on the remote machine."]})]}),m.jsxs(Hs,{children:[m.jsx(Ys,{children:"Cancel"}),m.jsx(qs,{onClick:()=>i(n),children:"Upgrade"})]})]})]}):d})]}),((y=n.update)==null?void 0:y.detail)&&m.jsx("div",{className:"mt-2 rounded-md border border-border/60 bg-muted/40 px-2 py-1 text-[10px] text-muted-foreground",children:n.update.detail}),n.detail&&m.jsx("div",{className:"mt-2 rounded-md border border-border/60 bg-muted/40 px-2 py-1 text-[10px] text-muted-foreground",children:n.detail})]})}function E_(n,l){var o;return(o=n==null?void 0:n.nodes)!=null&&o.length?n.nodes:l?[l]:[]}function N_(n,l){var i;if(l&&n.id===l.nodeId)return l;const o=n.settingsSnapshot;return{...n,nodeId:n.id,version:(o==null?void 0:o.version)??"Unavailable",packageName:o==null?void 0:o.packageName,uptime:(o==null?void 0:o.uptime)??0,localDashboardOrigin:((i=o==null?void 0:o.runtime)==null?void 0:i.localDashboardOrigin)??void 0,auth:o==null?void 0:o.auth,os:o==null?void 0:o.os,runtime:o==null?void 0:o.runtime,runtimeUpdate:o==null?void 0:o.runtimeUpdate,agents:o==null?void 0:o.agents,startupRequirements:o==null?void 0:o.startupRequirements,components:o==null?void 0:o.components,repository:o==null?void 0:o.repository,packages:o==null?void 0:o.packages}}function C_(n,l){return n.id===l?`${n.name} (this node)`:`${n.name} (${n.role})`}function T_(n){return n==="claude"?"Claude Code":n==="copilot"?"Copilot CLI":"Codex"}function R_(n){var o;const l=(o=n.payload)==null?void 0:o.agent;return l==="claude"||l==="codex"||l==="copilot"?l:null}function A_({cluster:n,systemInfo:l,sseConnected:o,initialSelectedNodeId:i,onRefresh:u}){var ae,oe,pe,me,ue,de,re,O,Y,F,se,J,j,X,Q,ee,te;const d=v.useMemo(()=>E_(n,l),[n,l]),[f,h]=v.useState(()=>{var I;return i??(l==null?void 0:l.nodeId)??((I=n==null?void 0:n.self)==null?void 0:I.id)??""}),[y,p]=v.useState(()=>new Map),x=v.useRef(new Set),g=v.useRef(new Set),w=(n==null?void 0:n.self)??l??d[0]??null,C=d.find(I=>I.id===f)??w,N=C?N_(C,l):null,E=!!(l&&C&&C.id===l.nodeId),T=E||!!(C!=null&&C.settingsSnapshot),R=N==null?void 0:N.runtimeUpdate,A=((ae=N==null?void 0:N.startupRequirements)==null?void 0:ae.components)??(N==null?void 0:N.components)??{},M=v.useMemo(()=>d.map(I=>I.id),[d]),k=M.join("\0"),$=FA(d),G=v.useMemo(()=>new Map(d.map(I=>[I.id,I.name])),[$]);v.useEffect(()=>{i&&M.includes(i)&&h(i)},[i,k]);const B=v.useCallback(async(I,W)=>{const le=Dx(I);if(!le||x.current.has(I.id))return;const ie=R_(I),we=(W==null?void 0:W.agentLabel)??(ie?T_(ie):"Agent"),Ee=(W==null?void 0:W.nodeName)??G.get(I.nodeId)??I.nodeId;x.current.add(I.id),p(ve=>new Map(ve).set(le,I));try{const ve=await kx(I);if(ve.status==="succeeded")await(u==null?void 0:u()),g.current.has(ve.id)||(ut.success(`${we} upgrade finished on ${Ee}`),g.current.add(ve.id));else if(ve.status==="failed")g.current.has(ve.id)||(ut.error(S_(ve)??`${we} upgrade failed`),g.current.add(ve.id));else{p(Ye=>new Map(Ye).set(le,ve)),ut.info(`${we} upgrade is still ${ve.status} on ${Ee}`);return}p(Ye=>{const ke=new Map(Ye),yt=ke.get(le);return(!yt||yt.id===ve.id)&&ke.delete(le),ke})}catch(ve){p(Ye=>{const ke=new Map(Ye),yt=ke.get(le);return(!yt||yt.id===I.id)&&ke.delete(le),ke}),ut.error(ve instanceof Error?ve.message:`${we} upgrade failed`)}finally{x.current.delete(I.id)}},[u,G]);v.useEffect(()=>{if(M.length===0)return;let I=!1;async function W(){let le;try{le=await e_(M)}catch{return}if(!I){p(ie=>{const we=new Map(ie);for(const[Ee,ve]of le)we.set(Ee,ve);return we});for(const ie of le.values())B(ie)}}return W(),()=>{I=!0}},[B,k]);async function V(I){if(C)try{const W=await Kw(C.id,I.id);ut.info(`${I.label} upgrade started on ${C.name}`),await B(W,{agentLabel:I.label,nodeName:C.name})}catch(W){ut.error(W instanceof Error?W.message:`${I.label} upgrade failed`)}}return!C||!N?m.jsx("div",{className:"rounded-2xl border border-dashed border-border/70 bg-muted/20 px-4 py-8 text-center text-[12px] text-muted-foreground",children:"Loading session metadata..."}):m.jsxs("div",{className:"space-y-3",children:[m.jsxs("section",{className:"relative mt-2 rounded-2xl border border-border/70 bg-[radial-gradient(circle_at_top_left,rgba(59,130,246,0.18),transparent_42%),radial-gradient(circle_at_bottom_right,rgba(16,185,129,0.12),transparent_32%),rgba(255,255,255,0.72)] p-3 shadow-[0_24px_90px_-54px_rgba(15,23,42,0.55)] dark:bg-[radial-gradient(circle_at_top_left,rgba(59,130,246,0.18),transparent_42%),radial-gradient(circle_at_bottom_right,rgba(16,185,129,0.12),transparent_32%),rgba(10,15,23,0.78)]",children:[!E&&m.jsxs(mt,{variant:"outline",className:"absolute right-3 top-2.5 rounded-full border-border/70 bg-background/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em] whitespace-nowrap",children:["Updated ",Ft((oe=C.settingsSnapshot)==null?void 0:oe.collectedAt)]}),m.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-end md:justify-between",children:[m.jsxs("div",{className:"space-y-2",children:[m.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[m.jsxs("span",{className:"flex items-center gap-1.5 rounded-full border border-border/70 bg-background/75 px-2 py-0.5 text-[10px] text-muted-foreground backdrop-blur",children:[m.jsx(V0,{status:C.status}),m.jsx("span",{className:"font-medium text-foreground",children:C.name})]}),m.jsx(lC,{role:C.role}),m.jsx(mt,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:C.transportType??N.transportType??"direct"}),m.jsx(mt,{variant:E?"default":"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:E?"Live local session":"Leader-synced snapshot"})]}),m.jsxs("div",{children:[m.jsx("div",{className:"text-[10px] uppercase tracking-[0.34em] text-muted-foreground",children:"Session"}),m.jsx("h3",{className:"mt-0.5 text-sm font-semibold tracking-tight text-foreground",children:"Node runtime"}),m.jsx("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:"Runtime environment, connectivity, and build metadata."})]}),d.length>1&&m.jsxs("div",{className:"w-48 space-y-1.5",children:[m.jsx("div",{className:"text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:"Inspect node"}),m.jsxs(kb,{value:C.id,onValueChange:h,children:[m.jsx(Hf,{className:"h-7 rounded-lg border-border/70 bg-background/70 text-[11px]",children:m.jsx(zb,{placeholder:"Choose a node"})}),m.jsx(Vf,{children:d.map(I=>m.jsx(Nr,{value:I.id,children:C_(I,l==null?void 0:l.nodeId)},I.id))})]})]})]}),m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsxs(mt,{variant:o?"default":"outline",className:"gap-1 rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:[m.jsx(b0,{className:"h-3 w-3"}),o?"Live link":"Reconnecting"]}),m.jsxs(mt,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:["Uptime ",v_(N.uptime)]})]})]})]}),!T&&m.jsx("div",{className:"rounded-xl border border-dashed border-border/70 bg-muted/20 px-3 py-2 text-[11px] text-muted-foreground",children:"This node has not synced its settings snapshot to the leader yet. Wait for the next keepalive and reopen the dialog if needed."}),m.jsxs(DA,{defaultValue:"session",className:"space-y-2",children:[m.jsxs(ax,{className:"h-auto flex-wrap rounded-xl border border-border/60 bg-muted/40 p-0.5",children:[m.jsx(Cs,{value:"session",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"Session"}),m.jsx(Cs,{value:"access",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"Access"}),m.jsx(Cs,{value:"about",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"About"})]}),m.jsxs(Ls,{value:"session",className:"mt-0 grid gap-2 xl:grid-cols-[1.15fr_0.85fr]",children:[m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(On,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(Dn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(tN,{className:"h-3.5 w-3.5 text-primary"}),"Selected node"]}),m.jsx(kn,{className:"text-[10px]",children:"Cluster role, identity, and node-scoped runtime state."})]}),m.jsxs(zn,{className:"space-y-0 px-3 pb-2.5",children:[m.jsx(Ke,{label:"Node ID",value:N.nodeId,mono:!0}),m.jsx(Ke,{label:"Status",value:C.status}),m.jsx(Ke,{label:"Role",value:C.role}),m.jsx(Ke,{label:"Endpoint",value:C.endpoint,mono:!0}),m.jsx(Ke,{label:"Joined",value:Ft(C.joinedAt)}),m.jsx(Ke,{label:"Heartbeat",value:Ft(C.lastHeartbeat)}),m.jsx(Ke,{label:"Capabilities",value:C.capabilities.length>0?C.capabilities.join(", "):"None"})]})]}),m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(On,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(Dn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(BE,{className:"h-3.5 w-3.5 text-primary"}),"OS info"]}),m.jsx(kn,{className:"text-[10px]",children:"Host and resource details reported by the current process."})]}),m.jsxs(zn,{className:"space-y-0 px-3 pb-2.5",children:[m.jsx(Ke,{label:"Host",value:((pe=N.os)==null?void 0:pe.hostname)??"Unavailable"}),m.jsx(Ke,{label:"Platform",value:N.os?`${N.os.platform} ${N.os.release}`:"Unavailable"}),m.jsx(Ke,{label:"Arch",value:((me=N.os)==null?void 0:me.arch)??"Unavailable"}),m.jsx(Ke,{label:"CPU",value:((ue=N.os)==null?void 0:ue.cpuModel)??"Unavailable"}),m.jsx(Ke,{label:"Cores",value:String(((de=N.os)==null?void 0:de.cpuCount)??"Unavailable")}),m.jsx(Ke,{label:"Memory",value:N.os?`${Vv(N.os.freeMemoryBytes)} free / ${Vv(N.os.totalMemoryBytes)} total`:"Unavailable"})]})]}),m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)] xl:col-span-2",children:[m.jsxs(On,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(Dn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(g0,{className:"h-3.5 w-3.5 text-primary"}),"Available agents"]}),m.jsx(kn,{className:"text-[10px]",children:E?"Live command availability for runtime agents on this node.":"Most recent agent availability snapshot synced from this node."})]}),m.jsx(zn,{"data-agent-layout":"list",className:"space-y-1.5 px-3 pb-2.5",children:(N.agents??[]).map(I=>m.jsx(w_,{agent:I,nodeName:C.name,activeOperation:y.get(`${C.id}:${I.id}`),onUpgrade:V},I.id))})]})]}),m.jsxs(Ls,{value:"access",className:"mt-0 grid gap-2 xl:grid-cols-2",children:[m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(On,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(Dn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(EE,{className:"h-3.5 w-3.5 text-primary"}),"Access surface"]}),m.jsx(kn,{className:"text-[10px]",children:"How this node is exposed to the dashboard and other peers."})]}),m.jsxs(zn,{className:"space-y-0 px-3 pb-2.5",children:[m.jsx(Ke,{label:"Transport",value:C.transportType??N.transportType??"direct"}),m.jsx(Ke,{label:"Node URL",value:C.endpoint,mono:!0}),m.jsx(Ke,{label:"Node tunnel",value:C.devtunnelEndpoint??"Disabled",mono:!!C.devtunnelEndpoint}),m.jsx(Ke,{label:"Dashboard URL",value:C.dashboardOrigin??N.localDashboardOrigin??"Unavailable",mono:!!(C.dashboardOrigin||N.localDashboardOrigin)}),m.jsx(Ke,{label:"Local dashboard",value:N.localDashboardOrigin??"Unavailable",mono:!!N.localDashboardOrigin})]})]}),m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(On,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(Dn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(rN,{className:"h-3.5 w-3.5 text-primary"}),"Auth"]}),m.jsx(kn,{className:"text-[10px]",children:"Current bearer-auth and trusted access posture."})]}),m.jsxs(zn,{className:"space-y-0 px-3 pb-2.5",children:[m.jsx(Ke,{label:"Enabled",value:(re=N.auth)!=null&&re.enabled?"Yes":"No"}),m.jsx(Ke,{label:"Same tenant",value:(O=N.auth)!=null&&O.allowSameTenant?"Allowed":"Off"}),m.jsx(Ke,{label:"Allowed users",value:(Y=N.auth)!=null&&Y.allowedUsers.length?N.auth.allowedUsers.join(", "):"None"})]})]}),m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(On,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(Dn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(qE,{className:"h-3.5 w-3.5 text-primary"}),"Paths"]}),m.jsx(kn,{className:"text-[10px]",children:"Workspace and runtime paths currently used by this node."})]}),m.jsxs(zn,{className:"space-y-0 px-3 pb-2.5",children:[m.jsx(Ke,{label:"Work dir",value:((F=N.runtime)==null?void 0:F.workDir)??N.workDir??"Unavailable",mono:!!(((se=N.runtime)==null?void 0:se.workDir)??N.workDir)}),m.jsx(Ke,{label:"Storage",value:((J=N.runtime)==null?void 0:J.storagePath)??"Unavailable",mono:!!((j=N.runtime)!=null&&j.storagePath)}),m.jsx(Ke,{label:"Process cwd",value:((X=N.runtime)==null?void 0:X.cwd)??"Unavailable",mono:!!((Q=N.runtime)!=null&&Q.cwd)}),m.jsx(Ke,{label:"Started",value:Ft((ee=N.runtime)==null?void 0:ee.startedAt)}),m.jsx(Ke,{label:"PID",value:N.runtime?String(N.runtime.pid):"Unavailable",mono:!!N.runtime})]})]}),m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(On,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(Dn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(Rs,{className:"h-3.5 w-3.5 text-primary"}),"Startup checks"]}),m.jsx(kn,{className:"text-[10px]",children:"Dependency preflight snapshot persisted during node startup."})]}),m.jsxs(zn,{className:"space-y-3 px-3 pb-2.5",children:[m.jsxs("div",{className:"rounded-xl border border-border/60 bg-background/70 px-3 py-2",children:[m.jsx("div",{className:"text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:"Last checked"}),m.jsx("div",{className:"mt-0.5 text-[11px] text-foreground",children:Ft((te=N.startupRequirements)==null?void 0:te.lastCheckedAt)})]}),m.jsxs("div",{className:"space-y-2",children:[m.jsx(Lo,{formatDateTime:Ft,name:"Azure CLI",status:A.az,statusVariant:Er}),m.jsx(Lo,{formatDateTime:Ft,name:"DevTunnel",status:A.devtunnel,statusVariant:Er}),m.jsx(Lo,{formatDateTime:Ft,name:"Claude Code",status:A.claude,statusVariant:Er}),m.jsx(Lo,{formatDateTime:Ft,name:"Codex",status:A.codex,statusVariant:Er}),m.jsx(Lo,{formatDateTime:Ft,name:"Copilot CLI",status:A.copilot,statusVariant:Er})]})]})]})]}),m.jsx(g_,{formatDateTime:Ft,isLiveLocalNode:E,onRefresh:u,runtimeUpdate:R,selectedNode:C,viewInfo:N})]})]})}function __({initialSelectedNodeId:n,open:l,onOpenChange:o,showTrigger:i=!0}={}){const{cluster:u,systemInfo:d,sseConnected:f,refresh:h}=h0();return m.jsx(w5,{open:l,onOpenChange:o,showTrigger:i,children:m.jsx(A_,{cluster:u,systemInfo:d,sseConnected:f,initialSelectedNodeId:n,onRefresh:h})})}const fj="bypass",j_=[{value:"claudecode",label:"claudecode",supportsFollowUp:!0},{value:"codex",label:"codex",supportsFollowUp:!0},{value:"copilot",label:"copilot",supportsFollowUp:!0},{value:"mars",label:"mars",disabled:!0,description:"coming soon"},{value:"eureka",label:"eureka",disabled:!0,description:"coming soon"}],mj=[{value:"bypass",label:"Bypass"},{value:"plan",label:"Plan"},{value:"edit",label:"Edit"},{value:"dangerous",label:"Dangerous"}],hj=new Set(j_.filter(n=>n.supportsFollowUp).map(n=>n.value)),pj=[{value:"active",label:"Active"},{value:"running",label:"Running"},{value:"waiting",label:"Waiting"},{value:"closed",label:"Closed"},{value:"shared",label:"Shared"},{value:"archived",label:"Archived"}],gj=[{value:"all",label:"All task types"},{value:"native",label:"Native sessions"},{value:"meshy",label:"Meshy chats"}],M_=new Set(["pending","assigned"]),O_=new Set(["running"]),D_=new Set(["completed","failed","cancelled"]);function vj(n,l){switch(l){case"running":return O_.has(n.status);case"waiting":return M_.has(n.status);case"closed":return D_.has(n.status);case"shared":return!!n.activeShare;case"archived":return n.status==="archived";case"active":default:return n.status!=="archived"}}function yj(n,l){if(l==="all")return!0;const o=n.conversationKind==="nativeSession";return l==="native"?o:!o}function bj(n,l){const o=l.trim().toLowerCase();return o?[n.title,n.description,n.id,n.agent,n.assignedTo??"",n.assignedNodeName??"",n.project??"",n.effectiveProjectPath??"",n.conversationKind==="nativeSession"?"native session":"meshy chat",n.activeShare?"shared conversation":""].some(i=>i.toLowerCase().includes(o)):!0}function k_(n,l,o){if(!n)return"unassigned";const i=l==null?void 0:l.find(u=>u.id===n);return(i==null?void 0:i.name)??o??n.slice(0,8)}function xj(n,l,o){return k_(n,l,o).toLowerCase()}function Sj(n,l,o){return!n.assignedTo||(o==null?void 0:o.id)===n.assignedTo?!0:(l==null?void 0:l.some(i=>i.id===n.assignedTo))??!1}function wj(n,l){return[...n].sort((o,i)=>o.id===l?-1:i.id===l?1:o.name.localeCompare(i.name))}function Ej(n){if(!n||typeof n!="object")return null;const l=n,o=l.createMode,i=o==="chat"||o==="native"?o:void 0;return{draftNewTask:l.draftNewTask===!0,returnRoute:typeof l.returnRoute=="string"?l.returnRoute:void 0,returnTaskId:typeof l.returnTaskId=="string"||l.returnTaskId===null?l.returnTaskId:void 0,createMode:i}}function Nj(n){switch(n){case"running":return"bg-amber-500";case"completed":return"bg-emerald-500";case"failed":return"bg-destructive";case"cancelled":case"archived":return"bg-slate-400";case"assigned":return"bg-teal-500";case"pending":default:return"bg-muted-foreground"}}function Cj(n){return n==="default workspace"?n:n.replace(/\\/g,"/").split("/").filter(Boolean).at(-1)??n}function Tj(n){const l=Date.now()-n;return l<6e4?"just now":l<36e5?`${Math.floor(l/6e4)}m`:l<864e5?`${Math.floor(l/36e5)}h`:`${Math.floor(l/864e5)}d`}function Rj(n){return new Date(n).toLocaleString()}function Aj(n){const l=Math.floor(n/1e3),o=Math.floor(l/3600),i=Math.floor(l%3600/60),u=l%60;return`${String(o).padStart(2,"0")}:${String(i).padStart(2,"0")}:${String(u).padStart(2,"0")}`}async function z_(n,l="Copied to clipboard"){var o,i,u;try{if((i=(o=globalThis.navigator)==null?void 0:o.clipboard)!=null&&i.writeText)return await globalThis.navigator.clipboard.writeText(n),ut.success(l),!0;const d=globalThis.document,f=(u=d==null?void 0:d.execCommand)==null?void 0:u.bind(d);if(!(d!=null&&d.body)||typeof d.createElement!="function"||typeof f!="function")throw new Error("Clipboard access is unavailable");const h=d.createElement("textarea"),y=d.activeElement,p=y&&typeof y.focus=="function"?y:null;h.value=n,h.setAttribute("readonly","true"),h.style.position="fixed",h.style.opacity="0",h.style.pointerEvents="none",d.body.appendChild(h),h.select(),h.setSelectionRange(0,h.value.length);const x=f("copy");if(d.body.removeChild(h),p==null||p.focus(),!x)throw new Error("Clipboard access is unavailable");return ut.success(l),!0}catch(d){return ut.error(d instanceof Error?d.message:"Failed to copy"),!1}}function _j(n,l,o){const i=new Map;for(const d of n){const f=d.assignedTo??null,h=f??"__unassigned__",y=f?l.get(f)??d.assignedNodeName??f.slice(0,8):"Unassigned",p=d.effectiveProjectPath??d.project??"default workspace";i.has(h)||i.set(h,{nodeId:f,nodeName:y,dirMap:new Map});const x=i.get(h);x.dirMap.has(p)||x.dirMap.set(p,[]),x.dirMap.get(p).push(d)}const u=Array.from(i.values()).map(({nodeId:d,nodeName:f,dirMap:h})=>{const y=Array.from(h.entries()).map(([p,x])=>({path:p,tasks:x})).sort((p,x)=>x.tasks.length-p.tasks.length||p.path.localeCompare(x.path));return{nodeId:d,nodeName:f,dirs:y}});return u.sort((d,f)=>{if(o){if(d.nodeId===o)return-1;if(f.nodeId===o)return 1}return d.nodeId===null?1:f.nodeId===null?-1:d.nodeName.localeCompare(f.nodeName)}),u}const L_={node:"border-teal-500/30 bg-teal-500/10 text-teal-700 dark:text-teal-300",task:"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300",election:"border-indigo-500/30 bg-indigo-500/10 text-indigo-700 dark:text-indigo-300",cluster:"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",transport:"border-sky-500/30 bg-sky-500/10 text-sky-700 dark:text-sky-300"},U_={node:"text-teal-700/70 dark:text-teal-300/70",task:"text-amber-700/70 dark:text-amber-300/70",election:"text-indigo-700/70 dark:text-indigo-300/70",cluster:"text-emerald-700/70 dark:text-emerald-300/70",transport:"text-sky-700/70 dark:text-sky-300/70"};function B_(n){return n.split(".")[0]??"unknown"}function H_(n){return new Date(n).toLocaleTimeString("en-US",{hour12:!1})}function wr(n,l){return(l==null?void 0:l.get(n))??n}function Lx(n,l){const o=n.data,i=o.operation;switch(n.type){case"node.joined":return`${o.name} joined the cluster`;case"node.left":return`${wr(o.nodeId,l)} left (${o.reason})`;case"node.status":return`${wr(o.nodeId,l)} is now ${o.status}`;case"node.operation.created":return`${i==null?void 0:i.kind} ${i==null?void 0:i.status} on ${wr(i==null?void 0:i.nodeId,l)}`;case"node.operation.updated":return`${i==null?void 0:i.kind} ${i==null?void 0:i.status} on ${wr(i==null?void 0:i.nodeId,l)}`;case"transport.changed":return`${wr(o.nodeId,l)} transport switched to ${o.transportType}`;case"task.created":return`"${o.title}" created`;case"task.assigned":return`task assigned to ${wr(o.nodeId,l)}`;case"task.status":return`task ${o.taskId.slice(0,8)} -> ${o.status}`;case"election.started":return`candidate ${o.candidateId.slice(0,8)} term ${o.term}`;case"election.complete":return`leader elected, term ${o.term}`;case"cluster.state":return`${o.nodeCount} nodes, term ${o.term}`;default:return JSON.stringify(o)}}function V_(n){return JSON.stringify(n,null,2)}function $_({events:n,maxHeight:l="400px",nodeNameById:o,onDismiss:i,density:u="default"}){if(n.length===0)return null;const d=u==="compact";return m.jsx("div",{className:"overflow-y-auto pr-1",style:{maxHeight:l},children:m.jsx("div",{className:"space-y-1.5",children:n.map(f=>{const h=B_(f.type);return m.jsx("div",{className:ce("transition-colors hover:bg-muted/30",d?"rounded-[7px] px-1 py-0.5":"rounded-lg px-1.5 py-1"),children:m.jsxs("div",{className:"space-y-1",children:[m.jsxs("div",{className:"flex items-start justify-between gap-1.5",children:[m.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[m.jsx("div",{className:ce("font-mono text-muted-foreground",d?"text-[8px]":"text-[9px]"),children:H_(f.timestamp)}),d?m.jsx("span",{className:ce("max-w-[8.5rem] truncate text-[7px] font-medium uppercase tracking-[0.08em] text-muted-foreground/70",U_[h]),children:f.type}):m.jsx(mt,{variant:"outline",className:ce("w-fit text-[9px] font-medium uppercase tracking-[0.14em] px-1.5 py-0",L_[h]),children:f.type})]}),m.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[m.jsx(Vn,{type:"button",variant:"ghost",size:"icon",className:ce("rounded-[8px] text-muted-foreground",d?"h-4 w-4":"h-5 w-5"),onClick:()=>void z_(V_(f),"Event copied"),"aria-label":`Copy ${f.type} event`,title:"Copy event",children:m.jsx(LE,{className:d?"h-2.5 w-2.5":"h-3 w-3"})}),i&&m.jsx(Vn,{type:"button",variant:"ghost",size:"icon",className:ce("rounded-[8px] text-muted-foreground hover:text-foreground",d?"h-4 w-4":"h-5 w-5"),onClick:()=>i(f.id),"aria-label":`Dismiss ${f.type} event`,title:"Dismiss event",children:m.jsx(w0,{className:d?"h-2.5 w-2.5":"h-3 w-3"})})]})]}),m.jsx("div",{className:"text-[9px] leading-snug text-foreground/85",children:Lx(f,o)})]})},f.id)})})})}const q_=["node.","election.","transport."],Y_="cluster.state";function G_(n){return n.type==="node.status"?!1:q_.some(l=>n.type.startsWith(l))}function X_(n){return new Date(n).toLocaleTimeString("en-US",{hour12:!1})}function P_(n,l){return n?{time:X_(n.timestamp),text:Lx(n,l)}:null}function Q_(n){return n.transportType==="devtunnel"||!!n.devtunnelEndpoint}function K_(n){if(n.length===0)return"No node tunnel";const l=n.filter(u=>u.status==="offline").length;if(l>0)return`${l} offline`;const o=n.filter(u=>{var d;return((d=u.devtunnelHealth)==null?void 0:d.status)==="failed"}).length;if(o>0)return`${o} failed`;const i=n.filter(u=>{var d;return u.status!=="offline"&&((d=u.devtunnelHealth)==null?void 0:d.status)!=="healthy"}).length;return i>0?`${i} checking`:"Healthy"}function Z_(n,l){var u;const o=(l==null?void 0:l.get(n.id))??n.name??n.id;if(n.status==="offline")return{label:o,status:"offline"};const i=((u=n.devtunnelHealth)==null?void 0:u.status)??"checking";return{label:o,status:i}}function I_(n){if(n.length===0)return"No nodes";const l=n.filter(i=>i.status==="offline").length;if(l>0)return`${l} offline`;const o=n.filter(i=>i.status==="busy").length;return o>0?`${o} busy`:"Healthy"}function F_(n,l){return{label:(l==null?void 0:l.get(n.id))??n.name??n.id,status:n.status}}function J_({connected:n,events:l,nodes:o=[],nodeNameById:i,defaultOpen:u=!1}){const[d,f]=v.useState(u),[h,y]=v.useState(!0),[p,x]=v.useState(new Set),g=v.useRef(null),w=v.useMemo(()=>l.filter(k=>G_(k)&&!p.has(k.id)),[l,p]),C=v.useMemo(()=>l.find(k=>k.type===Y_)??w[0],[l,w]),N=v.useMemo(()=>P_(C,i),[C,i]),E=v.useMemo(()=>o.filter(Q_),[o]),T=E.some(k=>{var $;return k.status==="offline"||(($=k.devtunnelHealth)==null?void 0:$.status)==="failed"}),R=o.some(k=>k.status==="offline"),A=o.some(k=>k.status==="busy"),M=o.length>0;return v.useEffect(()=>{x(k=>{if(k.size===0)return k;const $=new Set(l.map(B=>B.id)),G=new Set(Array.from(k).filter(B=>$.has(B)));return G.size===k.size?k:G})},[l]),v.useEffect(()=>{if(!d)return;const k=G=>{var B;(B=g.current)!=null&&B.contains(G.target)||f(!1)},$=G=>{G.key==="Escape"&&f(!1)};return document.addEventListener("pointerdown",k),document.addEventListener("keydown",$),()=>{document.removeEventListener("pointerdown",k),document.removeEventListener("keydown",$)}},[d]),m.jsxs("div",{ref:g,className:"relative",children:[m.jsxs("button",{type:"button","aria-expanded":d,"aria-haspopup":"dialog",onClick:()=>f(k=>!k),className:ce("flex items-center gap-1.5 rounded-[16px] border px-2 py-1.5 text-[11px] shadow-sm transition-all sm:gap-2 sm:px-3 sm:py-2 sm:text-xs",n?"border-emerald-500/25 bg-emerald-500/8 text-muted-foreground hover:border-emerald-500/40 hover:bg-emerald-500/12":"border-destructive/25 bg-destructive/8 text-muted-foreground hover:border-destructive/40 hover:bg-destructive/12",d&&"shadow-[0_14px_40px_-26px_rgba(16,185,129,0.95)]"),title:n?"Live link connected":"Live link reconnecting",children:[m.jsx(b0,{className:ce("h-3.5 w-3.5",n?"text-emerald-500":"text-destructive")}),n?"Live link":"Reconnecting"]}),d&&m.jsxs("div",{role:"dialog","aria-label":"Live link connection events",className:"absolute right-0 top-[calc(100%+0.4rem)] z-50 w-[18rem] max-w-[calc(100vw-1.5rem)] overflow-hidden rounded-[18px] border border-border/70 bg-background/96 shadow-[0_28px_90px_-42px_rgba(0,0,0,var(--panel-shadow-alpha))] backdrop-blur-xl max-sm:fixed max-sm:right-3 max-sm:top-[3.75rem] max-sm:w-[calc(100vw-1.5rem)]",children:[m.jsx("div",{className:"border-b border-border/60 bg-muted/25 px-2.5 py-1.5",children:m.jsxs("div",{className:"flex items-center justify-between gap-2",children:[m.jsxs("div",{className:"flex items-center gap-1.5",children:[n?m.jsx(Rs,{className:"h-3 w-3 text-emerald-500"}):m.jsx(dN,{className:"h-3 w-3 text-destructive"}),m.jsx("span",{className:"text-[10px] font-semibold text-foreground",children:"Live link"}),m.jsx("span",{className:"text-[9px] text-muted-foreground",children:n?"· SSE connected":"· reconnecting"})]}),m.jsx("div",{className:ce("rounded-[9px] border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.12em]",n?"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300":"border-destructive/30 bg-destructive/10 text-destructive"),children:n?"Connected":"Retrying"})]})}),m.jsxs("div",{className:"grid grid-cols-2 border-b border-border/60",children:[m.jsxs("div",{className:"border-r border-border/60 px-2.5 py-1.5",children:[m.jsx("div",{className:"text-[8px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"Events"}),m.jsx("div",{className:"mt-0.5 text-base font-semibold tracking-tight text-foreground",children:w.length})]}),m.jsxs("div",{className:"min-w-0 px-2.5 py-1.5",children:[m.jsx("div",{className:"text-[8px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"Latest"}),N?m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"mt-0.5 truncate text-[9px] leading-snug text-foreground/80",children:N.text}),m.jsx("div",{className:"font-mono text-[8px] text-muted-foreground/60",children:N.time})]}):m.jsx("div",{className:"mt-0.5 text-[8px] text-muted-foreground/50",children:"—"})]})]}),m.jsxs("div",{className:"border-b border-border/60 px-2.5 py-1.5",children:[m.jsxs("div",{className:"flex items-center justify-between gap-2",children:[m.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[R?m.jsx(us,{className:"h-3 w-3 shrink-0 text-destructive"}):A?m.jsx(Rs,{className:"h-3 w-3 shrink-0 text-amber-500"}):m.jsx(Bo,{className:ce("h-3 w-3 shrink-0",M?"text-emerald-500":"text-muted-foreground")}),m.jsx("span",{className:"text-[9px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"Node health"})]}),m.jsx("span",{className:ce("shrink-0 rounded-[8px] border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.1em]",R?"border-destructive/30 bg-destructive/10 text-destructive":A?"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300":M?"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300":"border-border/70 bg-background/60 text-muted-foreground"),children:I_(o)})]}),o.length>0&&m.jsx("div",{className:"mt-1.5 flex flex-col gap-0.5",children:o.map(k=>{const{label:$,status:G}=F_(k,i),B=G==="offline",V=G==="busy";return m.jsxs("div",{"aria-label":`${$} ${G}`,className:ce("flex items-center justify-between gap-2 rounded-[7px] px-2 py-0.5",B?"bg-destructive/6":V?"bg-amber-500/6":"bg-emerald-500/5"),title:`${$} ${G}`,children:[m.jsx("span",{className:"truncate text-[9px] text-foreground/70",children:$}),B?m.jsx(us,{className:"h-3 w-3 shrink-0 text-destructive"}):V?m.jsx(nv,{className:"h-3 w-3 shrink-0 text-amber-500"}):m.jsx(Bo,{className:"h-3 w-3 shrink-0 text-emerald-500"})]},k.id)})})]}),E.length>0&&m.jsxs("div",{className:"border-b border-border/60 px-2.5 py-1.5",children:[m.jsxs("div",{className:"flex items-center justify-between gap-2",children:[m.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[T?m.jsx(us,{className:"h-3 w-3 shrink-0 text-destructive"}):m.jsx(Bo,{className:"h-3 w-3 shrink-0 text-emerald-500"}),m.jsx("span",{className:"text-[9px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"DevTunnel"})]}),m.jsx("span",{className:ce("shrink-0 rounded-[8px] border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.1em]",T?"border-destructive/30 bg-destructive/10 text-destructive":"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300"),children:K_(E)})]}),m.jsx("div",{className:"mt-1.5 flex flex-col gap-0.5",children:E.map(k=>{var oe;const{label:$,status:G}=Z_(k,i),B=G==="failed"||G==="offline",V=G!=="healthy"&&G!=="failed"&&G!=="offline",ae=(oe=k.devtunnelHealth)!=null&&oe.reason?`${$} ${G}: ${k.devtunnelHealth.reason}`:`${$} ${G}`;return m.jsxs("div",{"aria-label":`${$} ${G}`,className:ce("flex items-center justify-between gap-2 rounded-[7px] px-2 py-0.5",B?"bg-destructive/6":V?"bg-muted/30":"bg-emerald-500/5"),title:ae,children:[m.jsx("span",{className:"truncate text-[9px] text-foreground/70",children:$}),B?m.jsx(us,{className:"h-3 w-3 shrink-0 text-destructive"}):V?m.jsx(nv,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):m.jsx(Bo,{className:"h-3 w-3 shrink-0 text-emerald-500"})]},k.id)})})]}),m.jsxs("div",{children:[m.jsxs("button",{type:"button",onClick:()=>y(k=>!k),className:"flex w-full items-center justify-between px-2.5 py-1.5 text-left hover:bg-muted/30",children:[m.jsxs("span",{className:"text-[8px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:["Notifications ",w.length>0&&`(${w.length})`]}),h?m.jsx(Qs,{className:"h-3 w-3 text-muted-foreground"}):m.jsx(RE,{className:"h-3 w-3 text-muted-foreground"})]}),h&&m.jsx("div",{className:"px-2 pb-2",children:m.jsx($_,{events:w,maxHeight:"12rem",density:"compact",emptyTitle:"No connection events yet",emptyDescription:"Node, election, and system events will appear here.",nodeNameById:i,onDismiss:k=>x($=>new Set($).add(k))})})]}),m.jsxs("div",{className:"flex items-center justify-end gap-1 border-t border-border/60 px-2.5 py-1",children:[m.jsx(Vn,{type:"button",variant:"ghost",size:"sm",className:"h-5 rounded-[9px] px-1.5 text-[9px]",onClick:()=>x(new Set(l.map(k=>k.id))),disabled:w.length===0,title:"Dismiss all notifications",children:"Dismiss all"}),m.jsx(Vn,{type:"button",variant:"ghost",size:"sm",className:"h-5 rounded-[9px] px-1.5 text-[9px]",onClick:()=>f(!1),children:"Close"})]})]})]})}const Vo="finsight",Ux="default",W_=new Set(["light","dark","system"]),e3=new Set(["porcelain","warm","finsight","inshield","edge"]),Bx=v.createContext(null);function t3(n){const l=new URLSearchParams(n).get("theme");return Hx(l)?l:null}function n3(n){const l=new URLSearchParams(n).get("palette");return Gf(l)}function a3(){if(typeof document>"u")return null;const n=document.documentElement;return{theme:n.classList.contains("dark")?"dark":"light",palette:Gf(n.getAttribute("data-palette"))??Vo}}function jj(n,l=a3()){if(!l)return n;try{const o=/^[a-z][a-z\d+\-.]*:/i.test(n),i=typeof window<"u"?window.location.href:"http://localhost",u=new URL(n,i);return u.searchParams.set("theme",l.theme),u.searchParams.set("palette",l.palette),o?u.toString():`${u.pathname}${u.search}${u.hash}`}catch{return n}}function l3({children:n}){const[l,o]=v.useState(()=>typeof window<"u"?t3(window.location.search)??i3(localStorage.getItem("meshy-theme"))??"system":"system"),[i,u]=v.useState(()=>typeof window<"u"?n3(window.location.search)??s3(localStorage.getItem("meshy-palette"))??Vo:Vo);return v.useEffect(()=>{const d=document.documentElement,f=h=>{if(h==="system"){const y=window.matchMedia("(prefers-color-scheme: dark)").matches;d.classList.toggle("dark",y)}else d.classList.toggle("dark",h==="dark")};if(f(l),localStorage.setItem("meshy-theme",l),l==="system"){const h=window.matchMedia("(prefers-color-scheme: dark)"),y=()=>f("system");return h.addEventListener("change",y),()=>h.removeEventListener("change",y)}},[l]),v.useEffect(()=>{const d=document.documentElement;i===Vo?d.removeAttribute("data-palette"):d.setAttribute("data-palette",i),localStorage.setItem("meshy-palette",i)},[i]),m.jsx(Bx.Provider,{value:{theme:l,setTheme:o,palette:i,setPalette:u},children:n})}function r3(){const n=v.useContext(Bx);if(!n)throw new Error("useTheme must be used within ThemeProvider");return n}function Hx(n){return n!==null&&W_.has(n)}function o3(n){return n!==null&&e3.has(n)}function i3(n){return Hx(n)?n:null}function Gf(n){return n===Ux?"porcelain":o3(n)?n:null}function s3(n){return n===Ux?null:Gf(n)}const c3=[{value:"light",label:"Light",icon:x0},{value:"dark",label:"Dark",icon:y0},{value:"system",label:"System",icon:v0}],u3=[{value:"finsight",label:"FinSight",hint:"Cool sage green"},{value:"porcelain",label:"Porcelain",hint:"Blue workspace"},{value:"warm",label:"Warm",hint:"Cream + amber"},{value:"inshield",label:"inShield",hint:"Pure white + navy"},{value:"edge",label:"Edge",hint:"Rounded violet panels"}];function d3(){const{theme:n,setTheme:l,palette:o,setPalette:i}=r3(),[u,d]=v.useState(!1),f=v.useRef(null),h=v.useRef(null),y=n==="dark"?y0:n==="light"?x0:v0,p=()=>{f.current&&(clearTimeout(f.current),f.current=null)},x=()=>{p(),f.current=setTimeout(()=>d(!1),180)};return v.useEffect(()=>{if(!u)return;const g=w=>{h.current&&!h.current.contains(w.target)&&d(!1)};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[u]),v.useEffect(()=>()=>p(),[]),m.jsxs("div",{ref:h,className:"relative",onMouseEnter:()=>{p(),d(!0)},onMouseLeave:x,children:[m.jsx(Vn,{variant:"ghost",size:"icon",onClick:()=>d(g=>!g),className:ce("rounded-[16px] border bg-background/70",o===Vo?"border-border/60":"border-primary/60 text-primary"),title:"Appearance","aria-haspopup":"menu","aria-expanded":u,children:m.jsx(y,{className:"h-4 w-4"})}),u&&m.jsxs("div",{role:"menu",className:"absolute right-0 top-[calc(100%+8px)] z-50 w-64 rounded-[20px] border border-border/70 bg-popover/95 p-3 text-popover-foreground shadow-[0_24px_80px_-32px_rgba(0,0,0,0.35)] backdrop-blur-xl",children:[m.jsx("div",{className:"px-1 pb-1 text-[10px] font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:"Theme"}),m.jsx("div",{className:"mb-2 grid grid-cols-3 gap-1",children:c3.map(({value:g,label:w,icon:C})=>{const N=n===g;return m.jsxs("button",{type:"button",onClick:()=>l(g),className:ce("flex flex-col items-center gap-1 rounded-[14px] border px-2 py-2 text-[11px] font-medium transition-colors",N?"border-primary/50 bg-primary/10 text-primary":"border-border/60 text-muted-foreground hover:border-border hover:bg-muted/60 hover:text-foreground"),children:[m.jsx(C,{className:"h-4 w-4"}),w]},g)})}),m.jsxs("div",{className:"mt-2 flex items-center gap-1.5 px-1 pb-1 text-[10px] font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:[m.jsx(iN,{className:"h-3 w-3"}),"Palette"]}),m.jsx("div",{className:"space-y-1",children:u3.map(({value:g,label:w,hint:C})=>{const N=o===g;return m.jsxs("button",{type:"button",onClick:()=>i(g),className:ce("flex w-full items-center gap-2 rounded-[14px] border px-2.5 py-1.5 text-left transition-colors",N?"border-primary/50 bg-primary/10":"border-transparent hover:bg-muted/60"),children:[m.jsx(f3,{value:g}),m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx("div",{className:ce("text-[12px] font-medium",N?"text-primary":"text-foreground"),children:w}),m.jsx("div",{className:"text-[10px] text-muted-foreground",children:C})]}),N&&m.jsx(mf,{className:"h-3.5 w-3.5 text-primary"})]},g)})})]})]})}function f3({value:n}){const l={porcelain:["hsl(212 76% 44%)","hsl(210 22% 98%)","hsl(174 42% 61%)"],warm:["hsl(35 88% 56%)","hsl(42 22% 97%)","hsl(160 60% 45%)"],finsight:["hsl(152 38% 32%)","hsl(150 14% 97%)","hsl(142 55% 58%)"],inshield:["hsl(220 25% 12%)","hsl(0 0% 100%)","hsl(195 80% 55%)"],edge:["hsl(265 75% 55%)","hsl(260 12% 98%)","hsl(285 70% 65%)"]},[o,i,u]=l[n];return m.jsxs("div",{className:ce("flex h-6 w-6 shrink-0 overflow-hidden border border-border/60",n==="edge"?"rounded-[10px]":"rounded-[12px]"),children:[m.jsx("div",{className:"h-full w-1/3",style:{background:o}}),m.jsx("div",{className:"h-full w-1/3",style:{background:i}}),m.jsx("div",{className:"h-full w-1/3",style:{background:u}})]})}function m3(){var y,p;const{cluster:n,events:l,sseConnected:o}=h0(),i=$n(),[u,d]=v.useState(!1),f=i.pathname==="/"||/^\/tasks\/[^/]+$/.test(i.pathname),h=v.useMemo(()=>{const x=new Map;for(const g of(n==null?void 0:n.nodes)??[])x.set(g.id,g.name);return x},[n==null?void 0:n.nodes]);return m.jsxs("div",{className:"relative h-full overflow-hidden bg-background text-foreground",children:[m.jsx("div",{className:"mesh-grid pointer-events-none absolute inset-0"}),m.jsxs("div",{className:"relative z-10 flex h-full min-h-0 flex-col",children:[m.jsx("header",{className:"relative z-50 shrink-0 px-2 pb-2 pt-3 sm:px-5 sm:pb-3 sm:pt-4 lg:px-6",children:m.jsxs("div",{className:"dashboard-panel dashboard-panel-muted animate-panel-settle mx-auto flex max-w-[1760px] flex-wrap items-center justify-between gap-2 rounded-[22px] px-3 py-2 sm:gap-3 sm:rounded-[24px] sm:px-4 sm:py-3",children:[m.jsx("div",{className:"flex min-w-0 items-center gap-4",children:m.jsxs(u0,{to:"/",className:"flex items-center gap-3",children:[m.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-[15px] border border-border/70 bg-foreground text-xs font-semibold tracking-[0.24em] text-background shadow-sm sm:h-11 sm:w-11 sm:rounded-[17px] sm:text-sm",children:"M"}),m.jsxs("div",{className:"hidden min-w-0 sm:block",children:[m.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.34em] text-muted-foreground",children:"MESHY"}),m.jsx("div",{className:"truncate text-base font-semibold tracking-tight text-foreground",children:"Workspace"})]})]})}),m.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[m.jsxs("div",{className:"hidden items-center gap-2 rounded-[16px] border border-border/70 bg-background/70 px-3 py-2 text-xs text-muted-foreground shadow-sm sm:flex",children:[m.jsxs("span",{className:"flex items-center gap-2",children:[(n==null?void 0:n.self)&&m.jsx(V0,{status:n.self.status}),m.jsx("span",{className:"font-medium text-foreground",children:((y=n==null?void 0:n.self)==null?void 0:y.name)??"offline"})]}),m.jsx("span",{className:"text-border",children:"/"}),m.jsx("span",{className:"capitalize",children:((p=n==null?void 0:n.self)==null?void 0:p.role)??"node"})]}),m.jsx(J_,{connected:o,events:l,nodes:(n==null?void 0:n.nodes)??[],nodeNameById:h}),f&&m.jsx(Vn,{variant:"ghost",size:"icon",onClick:()=>d(x=>!x),"aria-label":u?"Close terminal":"Open terminal",title:u?"Close terminal":"Open terminal",className:ce("rounded-[16px] border bg-background/70 shadow-sm",u?"border-primary/50 bg-primary/10 text-primary":"border-border/70"),children:m.jsx(S0,{className:"h-4 w-4"})}),m.jsx(__,{}),m.jsx(d3,{})]})]})}),m.jsx("main",{className:ce("min-h-0 flex-1 px-3 pb-3 sm:px-5 lg:px-6",f?"overflow-hidden":"overflow-y-auto"),children:m.jsx("div",{className:"mx-auto h-full min-h-0 max-w-[1760px]",children:m.jsx(rw,{context:{terminalOpen:u,setTerminalOpen:d}})})})]})]})}const $v=v.lazy(async()=>({default:(await Gv(()=>import("./DashboardPage-D99zb0K5.js").then(l=>l.D),__vite__mapDeps([0,1,2,3]))).DashboardPage})),h3=v.lazy(async()=>({default:(await Gv(()=>import("./SharedConversationPage-C5DPKR6h.js"),__vite__mapDeps([4,1]))).SharedConversationPage}));function p3(){return m.jsx(Mw,{children:m.jsx(v.Suspense,{fallback:m.jsx(g3,{}),children:m.jsxs(iw,{children:[m.jsx(Cl,{path:"/shared/tasks/:shareId",element:m.jsx(h3,{})}),m.jsxs(Cl,{element:m.jsx(dE,{children:m.jsx(m3,{})}),children:[m.jsx(Cl,{path:"/",element:m.jsx($v,{})}),m.jsx(Cl,{path:"/nodes",element:m.jsx(Wg,{to:"/",replace:!0})}),m.jsx(Cl,{path:"/tasks",element:m.jsx(Wg,{to:"/",replace:!0})}),m.jsx(Cl,{path:"/tasks/:id",element:m.jsx($v,{})})]})]})})})}function g3(){return m.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background text-sm text-muted-foreground",children:"Loading workspace..."})}function v3(n){return m.jsx(DC,{className:"toaster group",style:{"--normal-bg":"hsl(var(--popover))","--normal-text":"hsl(var(--popover-foreground))","--normal-border":"hsl(var(--border))"},...n})}o2.createRoot(document.getElementById("root")).render(m.jsx(v.StrictMode,{children:m.jsxs(l3,{children:[m.jsx(p3,{}),m.jsx(v3,{})]})}));export{qs as $,jj as A,Vn as B,mf as C,fj as D,LE as E,qE as F,z_ as G,k_ as H,Ox as I,DA as J,mt as K,cj as L,ax as M,Cs as N,Rj as O,uj as P,Ls as Q,nf as R,Nr as S,j_ as T,Us as U,Bs as V,Vs as W,w0 as X,$s as Y,Hs as Z,Ys as _,UC as a,q3 as a$,Gv as a0,w3 as a1,Ny as a2,S5 as a3,z3 as a4,S0 as a5,Bo as a6,kE as a7,k3 as a8,L3 as a9,iE as aA,X3 as aB,T3 as aC,N3 as aD,Ty as aE,C3 as aF,R3 as aG,Qw as aH,__ as aI,P3 as aJ,Q3 as aK,b3 as aL,$n as aM,t0 as aN,y3 as aO,h0 as aP,Ej as aQ,Sj as aR,vj as aS,yj as aT,xj as aU,bj as aV,B3 as aW,hj as aX,O_ as aY,Y3 as aZ,G3 as a_,D3 as aa,aN as ab,PE as ac,wj as ad,b0 as ae,$_ as af,V0 as ag,VE as ah,lC as ai,Aj as aj,M_ as ak,_j as al,pj as am,gj as an,Mx as ao,Cj as ap,Nj as aq,Tj as ar,af as as,K3 as at,Z3 as au,U3 as av,lE as aw,Jw as ax,sj as ay,ij as az,ce as b,$3 as b0,S3 as b1,E3 as b2,x3 as b3,A3 as b4,ej as b5,W3 as b6,J3 as b7,I3 as b8,F3 as b9,tj as ba,_E as bb,qv as bc,lj as bd,aj as be,nj as bf,WE as bg,rj as bh,dj as bi,oj as bj,Ve as c,H0 as d,O3 as e,Pw as f,j3 as g,_3 as h,RE as i,m as j,mj as k,g0 as l,M3 as m,V3 as n,kb as o,Hf as p,zb as q,v as r,Vf as s,ut as t,Qs as u,iN as v,H3 as w,y5 as x,Ey as y,Cy as z};
301
+ For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return v.useEffect(()=>{var i;document.getElementById((i=n.current)==null?void 0:i.getAttribute("aria-describedby"))||console.warn(l)},[l,n]),null},YA=rx,GA=ox,XA=ix,vx=sx,yx=cx,bx=hx,xx=gx,Sx=dx,wx=mx;const nf=YA,af=GA,PA=XA,Ex=v.forwardRef(({className:n,...l},o)=>m.jsx(vx,{className:ce("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n),...l,ref:o}));Ex.displayName=vx.displayName;const Us=v.forwardRef(({className:n,...l},o)=>m.jsxs(PA,{children:[m.jsx(Ex,{}),m.jsx(yx,{ref:o,className:ce("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 rounded-[22px] border bg-background p-6 shadow-[0_34px_110px_-54px_rgba(0,0,0,0.55)] duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",n),...l})]}));Us.displayName=yx.displayName;const Bs=({className:n,...l})=>m.jsx("div",{className:ce("flex flex-col space-y-2 text-center sm:text-left",n),...l});Bs.displayName="AlertDialogHeader";const Hs=({className:n,...l})=>m.jsx("div",{className:ce("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...l});Hs.displayName="AlertDialogFooter";const Vs=v.forwardRef(({className:n,...l},o)=>m.jsx(Sx,{ref:o,className:ce("text-lg font-semibold",n),...l}));Vs.displayName=Sx.displayName;const $s=v.forwardRef(({className:n,...l},o)=>m.jsx(wx,{ref:o,className:ce("text-sm text-muted-foreground",n),...l}));$s.displayName=wx.displayName;const qs=v.forwardRef(({className:n,...l},o)=>m.jsx(bx,{ref:o,className:ce(vf(),n),...l}));qs.displayName=bx.displayName;const Ys=v.forwardRef(({className:n,...l},o)=>m.jsx(xx,{ref:o,className:ce(vf({variant:"outline"}),"mt-2 sm:mt-0",n),...l}));Ys.displayName=xx.displayName;var rc="Checkbox",[QA]=Ia(rc),[KA,qf]=QA(rc);function ZA(n){const{__scopeCheckbox:l,checked:o,children:i,defaultChecked:u,disabled:d,form:f,name:h,onCheckedChange:y,required:p,value:x="on",internal_do_not_use_render:g}=n,[w,C]=Ar({prop:o,defaultProp:u??!1,onChange:y,caller:rc}),[N,E]=v.useState(null),[T,R]=v.useState(null),A=v.useRef(!1),M=N?!!f||!!N.closest("form"):!0,k={checked:w,disabled:d,setChecked:C,control:N,setControl:E,name:h,form:f,value:x,hasConsumerStoppedPropagationRef:A,required:p,defaultChecked:Xa(u)?!1:u,isFormControl:M,bubbleInput:T,setBubbleInput:R};return m.jsx(KA,{scope:l,...k,children:IA(g)?g(k):i})}var Nx="CheckboxTrigger",Cx=v.forwardRef(({__scopeCheckbox:n,onKeyDown:l,onClick:o,...i},u)=>{const{control:d,value:f,disabled:h,checked:y,required:p,setControl:x,setChecked:g,hasConsumerStoppedPropagationRef:w,isFormControl:C,bubbleInput:N}=qf(Nx,n),E=Ze(u,x),T=v.useRef(y);return v.useEffect(()=>{const R=d==null?void 0:d.form;if(R){const A=()=>g(T.current);return R.addEventListener("reset",A),()=>R.removeEventListener("reset",A)}},[d,g]),m.jsx(Le.button,{type:"button",role:"checkbox","aria-checked":Xa(y)?"mixed":y,"aria-required":p,"data-state":jx(y),"data-disabled":h?"":void 0,disabled:h,value:f,...i,ref:E,onKeyDown:Me(l,R=>{R.key==="Enter"&&R.preventDefault()}),onClick:Me(o,R=>{g(A=>Xa(A)?!0:!A),N&&C&&(w.current=R.isPropagationStopped(),w.current||R.stopPropagation())})})});Cx.displayName=Nx;var Yf=v.forwardRef((n,l)=>{const{__scopeCheckbox:o,name:i,checked:u,defaultChecked:d,required:f,disabled:h,value:y,onCheckedChange:p,form:x,...g}=n;return m.jsx(ZA,{__scopeCheckbox:o,checked:u,defaultChecked:d,disabled:h,required:f,onCheckedChange:p,name:i,form:x,value:y,internal_do_not_use_render:({isFormControl:w})=>m.jsxs(m.Fragment,{children:[m.jsx(Cx,{...g,ref:l,__scopeCheckbox:o}),w&&m.jsx(_x,{__scopeCheckbox:o})]})})});Yf.displayName=rc;var Tx="CheckboxIndicator",Rx=v.forwardRef((n,l)=>{const{__scopeCheckbox:o,forceMount:i,...u}=n,d=qf(Tx,o);return m.jsx(Dr,{present:i||Xa(d.checked)||d.checked===!0,children:m.jsx(Le.span,{"data-state":jx(d.checked),"data-disabled":d.disabled?"":void 0,...u,ref:l,style:{pointerEvents:"none",...n.style}})})});Rx.displayName=Tx;var Ax="CheckboxBubbleInput",_x=v.forwardRef(({__scopeCheckbox:n,...l},o)=>{const{control:i,hasConsumerStoppedPropagationRef:u,checked:d,defaultChecked:f,required:h,disabled:y,name:p,value:x,form:g,bubbleInput:w,setBubbleInput:C}=qf(Ax,n),N=Ze(o,C),E=Fy(d),T=Vy(i);v.useEffect(()=>{const A=w;if(!A)return;const M=window.HTMLInputElement.prototype,$=Object.getOwnPropertyDescriptor(M,"checked").set,G=!u.current;if(E!==d&&$){const B=new Event("click",{bubbles:G});A.indeterminate=Xa(d),$.call(A,Xa(d)?!1:d),A.dispatchEvent(B)}},[w,E,d,u]);const R=v.useRef(Xa(d)?!1:d);return m.jsx(Le.input,{type:"checkbox","aria-hidden":!0,defaultChecked:f??R.current,required:h,disabled:y,name:p,value:x,form:g,...l,tabIndex:-1,ref:N,style:{...l.style,...T,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});_x.displayName=Ax;function IA(n){return typeof n=="function"}function Xa(n){return n==="indeterminate"}function jx(n){return Xa(n)?"indeterminate":n?"checked":"unchecked"}const Mx=v.forwardRef(({className:n,...l},o)=>m.jsx(Yf,{ref:o,className:ce("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",n),...l,children:m.jsx(Rx,{className:ce("flex items-center justify-center text-current"),children:m.jsx(mf,{className:"h-3.5 w-3.5"})})}));Mx.displayName=Yf.displayName;const Ox=v.forwardRef(({className:n,type:l,...o},i)=>m.jsx("input",{type:l,className:ce("flex h-10 w-full rounded-[16px] border border-input/85 bg-background/72 px-3 py-2 text-sm shadow-sm ring-offset-background transition-all duration-200 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground/75 focus-visible:border-primary/45 focus-visible:bg-background/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/45 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",n),ref:i,...o}));Ox.displayName="Input";const Bv=["queued","running"];function FA(n){return n.map(l=>`${l.id}:${l.name}`).join("\0")}function JA(n){return n==="claude"||n==="codex"||n==="copilot"}function Dx(n){var o;if(n.kind!=="agent.upgrade")return null;const l=(o=n.payload)==null?void 0:o.agent;return JA(l)?`${n.nodeId}:${l}`:null}function WA(n){return n.status==="succeeded"||n.status==="failed"}async function kx(n,l={}){const o=l.getOperation??Pw,i=l.pollIntervalMs??2e3,u=l.timeoutMs??24e4,d=Date.now()+u;let f=n;for(;!WA(f)&&Date.now()<d;)await t_(i),f=await o(n.id);return f}async function e_(n,l=Qw){const o=new Set(n),i=await Promise.all(Bv.map(d=>l({kind:"agent.upgrade",status:d}))),u=new Map;for(const d of i.flat()){if(!Bv.includes(d.status)||o.size>0&&!o.has(d.nodeId))continue;const f=Dx(d);if(!f)continue;const h=u.get(f);(!h||d.updatedAt>h.updatedAt)&&u.set(f,d)}return u}function t_(n){return new Promise(l=>setTimeout(l,n))}const n_=1500,a_=1e3,l_=9e4;async function r_(n={}){const l=n.fetchHealth??o_,o=n.initialDelayMs??n_,i=n.pollIntervalMs??a_,u=n.previousPid,d=n.reload??(()=>window.location.reload()),f=n.sleep??s_,h=n.timeoutMs??l_,y=Date.now()+h;let p=!1;for(o>0&&await f(o);Date.now()<=y;){const x=i_(await l());if(!x.ok){p=!0,await f(i);continue}if(u===void 0||x.pid!==void 0&&x.pid!==u||p)return d(),!0;await f(i)}return!1}async function o_(){try{const n=await fetch("/api/system/health",{cache:"no-store"}),l=await n.json().catch(()=>null),o=l&&typeof l=="object"&&typeof l.pid=="number"?l.pid:void 0;return{ok:n.ok,pid:o}}catch{return!1}}function i_(n){return typeof n=="boolean"?{ok:n}:n}function s_(n){return new Promise(l=>window.setTimeout(l,n))}function c_(n,l=!0){return l?(n==null?void 0:n.restartMode)==="development"?"Restart dev runtime":n!=null&&n.updateAvailable?"Restart to update":"Restart runtime":n!=null&&n.updateAvailable?"Restart follower to update":"Restart follower"}function u_({checkedLabel:n,disableAuthDefault:l,endpoint:o,isLiveLocalNode:i,nodeId:u,nodeName:d,onRefresh:f,pid:h,transportType:y,update:p,workDir:x}){const g=c_(p,i),[w,C]=v.useState(null),[N,E]=v.useState(()=>Hv({disableAuthDefault:l,endpoint:o,nodeName:d,transportType:y,workDir:x})),[T,R]=v.useState(!1),[A,M]=v.useState(!1),[k,$]=v.useState(!1);v.useEffect(()=>{E(Hv({disableAuthDefault:l,endpoint:o,nodeName:d,transportType:y,workDir:x}))},[l,o,d,y,x]);async function G(){if(!u||T||A)return;const oe=p.updateAvailable?"update":"restart",pe=m_(N);if(N.port.trim()&&(pe==null?void 0:pe.port)===void 0){ut.error("Runtime restart port must be a positive integer");return}const me=pe?{reason:oe,startArgs:pe}:{reason:oe};R(!0);try{if(i){const O=await Yw(me);C({...O,pid:O.pid??h,status:"accepted"}),ut.info(`Restarting ${d} from a detached helper. PID ${O.pid??h??"unknown"} will not stay attached to the original terminal window; follow ${O.logPath} for launch output.`),r_({previousPid:O.pid??h}).then(Y=>{Y||(R(!1),ut.error("Runtime restart was accepted, but the dashboard did not reconnect before the timeout. Refresh the page after the node finishes starting."))}).catch(Y=>{R(!1),ut.error(Y instanceof Error?Y.message:"Runtime restart recovery failed")});return}const ue=await Zw(u,me);C({operationId:ue.id,pid:h,status:ue.status}),ut.info(`Restart requested on ${d}. Operation ${Vd(ue.id)} will hand off to a detached process, so the new runtime will not stay attached to the original terminal window.`);const de=await kx(ue,{timeoutMs:6e4}),re=f_(de);C({command:re==null?void 0:re.command,logPath:re==null?void 0:re.logPath,mode:re==null?void 0:re.mode,operationId:de.id,pid:(re==null?void 0:re.pid)??h,status:de.status}),de.status==="succeeded"?(await(f==null?void 0:f()),ut.success(`Restart handoff accepted on ${d}. Follow ${(re==null?void 0:re.logPath)??"the node restart log"} for launch output.`)):de.status==="failed"?ut.error(de.error??`Restart failed on ${d}`):ut.info(`Restart operation ${Vd(de.id)} is still ${de.status}. More details will update after the node reports back.`),R(!1)}catch(ue){R(!1),ut.error(ue instanceof Error?ue.message:"Runtime restart failed")}}async function B(){if(!(!i||T||A)){M(!0);try{const oe=await Gw();ut.info(`Stopping Meshy process ${oe.pid}`)}catch(oe){M(!1),ut.error(oe instanceof Error?oe.message:"Runtime stop failed")}}}const V=T?"restarting":A?"stopping":(w==null?void 0:w.status)??"idle",ae=p.restartMode==="development";return m.jsxs("div",{className:"rounded-xl border border-border/70 bg-background/70 overflow-hidden",children:[m.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b border-border/50",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(Rs,{className:"h-3.5 w-3.5 text-primary shrink-0"}),m.jsxs("div",{children:[m.jsx("div",{className:"text-[11px] font-semibold text-foreground leading-tight",children:"Runtime"}),m.jsx("div",{className:"text-[10px] text-muted-foreground leading-tight",children:ae?"Development launcher":`Latest ${p.latestVersion??"—"}`})]})]}),m.jsx("div",{className:"flex items-center gap-1.5",children:m.jsx(mt,{variant:p.updateAvailable?"default":"outline",className:"rounded-full border-border/70 bg-background/60 font-mono text-[10px] px-2 py-0.5",children:ae?"dev":p.updateAvailable?`→ ${p.latestVersion}`:"current"})})]}),m.jsxs("div",{className:"grid grid-cols-2 divide-x divide-border/50 border-b border-border/50",children:[m.jsxs("div",{className:"px-3 py-1.5",children:[m.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:"PID"}),m.jsx("div",{className:"mt-0.5 font-mono text-[11px] text-foreground",children:h??"—"})]}),m.jsxs("div",{className:"px-3 py-1.5",children:[m.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:"Status"}),m.jsx("div",{className:"mt-0.5 text-[11px] text-foreground capitalize",children:V})]})]}),m.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2",children:[m.jsxs("div",{className:"text-[10px] text-muted-foreground",children:["Checked ",n]}),m.jsxs("div",{className:"flex items-center gap-1.5",children:[i&&m.jsxs(nf,{children:[m.jsx(af,{asChild:!0,children:m.jsxs(Vn,{type:"button",size:"sm",variant:"ghost",disabled:T||A,className:"h-7 rounded-lg px-2 text-[11px] text-muted-foreground hover:text-destructive hover:bg-destructive/10",children:[m.jsx(IE,{className:ce("mr-1 h-3.5 w-3.5",A&&"animate-pulse")}),A?"Stopping":"Stop"]})}),m.jsxs(Us,{className:"max-w-[22rem] rounded-xl gap-2 p-4",children:[m.jsxs(Bs,{className:"space-y-1",children:[m.jsx(Vs,{className:"text-sm",children:"Stop runtime?"}),m.jsx($s,{className:"text-[11px] leading-4",children:"Gracefully stops the current Meshy process without launching a replacement. The dashboard will disconnect until the node is started again."})]}),m.jsxs(Hs,{className:"gap-1 pt-0 sm:space-x-1",children:[m.jsx(Ys,{className:"h-7 rounded-lg px-2 text-[11px]",children:"Cancel"}),m.jsx(qs,{className:"h-7 rounded-lg px-2 text-[11px] bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>void B(),children:"Stop runtime"})]})]})]}),m.jsxs(nf,{children:[m.jsx(af,{asChild:!0,children:m.jsxs(Vn,{type:"button",size:"sm",variant:p.updateAvailable?"default":"outline",disabled:!u||T||A,className:"h-7 rounded-lg px-2 text-[11px]",children:[m.jsx(WE,{className:ce("mr-1 h-3.5 w-3.5",T&&"animate-spin")}),T?"Restarting…":g]})}),m.jsxs(Us,{className:"max-w-[28rem] gap-3 rounded-xl p-4",children:[m.jsxs(Bs,{className:"space-y-1",children:[m.jsxs(Vs,{className:"text-sm",children:[g,"?"]}),m.jsxs($s,{className:"text-[11px] leading-4",children:["Starts a detached restart helper, shuts down ",i?"the current node":d,", and brings it back with the configured launcher. The new process will not stay attached to the original terminal window."]})]}),m.jsx(d_,{value:N,onChange:E}),m.jsxs(Hs,{className:"gap-1 pt-0 sm:space-x-1",children:[m.jsx(Ys,{className:"h-7 rounded-lg px-2 text-[11px]",children:"Cancel"}),m.jsx(qs,{className:"h-7 rounded-lg px-2 text-[11px]",onClick:()=>void G(),children:g})]})]})]})]})]}),m.jsxs("div",{className:"border-t border-border/50",children:[m.jsxs("button",{type:"button",onClick:()=>$(oe=>!oe),className:"flex w-full items-center justify-between px-3 py-1.5 text-[10px] text-muted-foreground hover:text-foreground hover:bg-muted/30 transition-colors",children:[m.jsxs("span",{className:"flex items-center gap-1.5",children:[m.jsx(S0,{className:"h-3 w-3"}),"Restart details"]}),m.jsx(Qs,{className:ce("h-3 w-3 transition-transform duration-150",k&&"rotate-180")})]}),k&&m.jsxs("div",{className:"border-t border-border/50 bg-muted/20 px-3 py-2 space-y-1",children:[m.jsx(Nl,{label:"Current PID",value:h===void 0?"—":String(h),mono:h!==void 0}),m.jsx(Nl,{label:"Restart PID",value:(w==null?void 0:w.pid)===void 0?"Pending":String(w.pid),mono:(w==null?void 0:w.pid)!==void 0}),m.jsx(Nl,{label:"Operation",value:w!=null&&w.operationId?Vd(w.operationId):"Local direct request",mono:!!(w!=null&&w.operationId)}),m.jsx(Nl,{label:"Status",value:(w==null?void 0:w.status)??(T?"requested":"idle")}),m.jsx(Nl,{label:"Launcher",value:(w==null?void 0:w.command)??"Available after restart",mono:!!(w!=null&&w.command)}),m.jsx(Nl,{label:"Log",value:(w==null?void 0:w.logPath)??"Available after restart",mono:!!(w!=null&&w.logPath)}),m.jsx(Nl,{label:"Terminal",value:"New process is detached from original terminal"})]})]}),p.detail&&m.jsx("div",{className:"border-t border-border/50 px-3 py-1.5 text-[10px] text-muted-foreground bg-muted/20",children:p.detail})]})}function d_({onChange:n,value:l}){const o=(i,u)=>{n({...l,[i]:u})};return m.jsxs("div",{className:"rounded-lg border border-border/70 bg-muted/30 p-3 space-y-3",children:[m.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-muted-foreground",children:"Startup arguments"}),m.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[m.jsx(zo,{label:"HTTP port",value:l.port,onChange:i=>o("port",i),inputMode:"numeric"}),m.jsx(zo,{label:"Node name",value:l.name,onChange:i=>o("name",i)}),m.jsx(zo,{label:"Join endpoint",value:l.join,onChange:i=>o("join",i),className:"sm:col-span-2"}),m.jsxs("div",{className:"space-y-1",children:[m.jsx("label",{className:"text-[9px] uppercase tracking-[0.14em] text-muted-foreground",children:"Transport"}),m.jsxs(kb,{value:l.transport,onValueChange:i=>o("transport",zx(i)),children:[m.jsx(Hf,{className:"h-7 rounded-md border-border/70 bg-background/70 px-2 text-[10px]",children:m.jsx(zb,{placeholder:"Transport"})}),m.jsxs(Vf,{children:[m.jsx(Nr,{className:"py-1 text-[11px]",value:"inherit",children:"current / default"}),m.jsx(Nr,{className:"py-1 text-[11px]",value:"direct",children:"direct"}),m.jsx(Nr,{className:"py-1 text-[11px]",value:"devtunnel",children:"devtunnel"}),m.jsx(Nr,{className:"py-1 text-[11px]",value:"tailscale",children:"tailscale"})]})]})]}),m.jsx(zo,{label:"Working directory",value:l.workDir,onChange:i=>o("workDir",i)}),m.jsx(zo,{label:"Config path",value:l.config,onChange:i=>o("config",i),className:"sm:col-span-2"}),m.jsxs("label",{className:"flex items-center gap-2 rounded-md border border-border/60 bg-background/60 px-2 py-1.5 text-[10px] text-foreground sm:col-span-2 cursor-pointer hover:bg-muted/40 transition-colors",children:[m.jsx(Mx,{className:"h-3.5 w-3.5",checked:l.disableAuth,onCheckedChange:i=>n({...l,disableAuth:i===!0,disableAuthKnown:!0})}),"Disable auth"]})]})]})}function zo({className:n,inputMode:l,label:o,onChange:i,value:u}){return m.jsxs("label",{className:ce("space-y-1",n),children:[m.jsx("span",{className:"text-[9px] uppercase tracking-[0.14em] text-muted-foreground",children:o}),m.jsx(Ox,{className:"h-7 rounded-md px-2 text-[10px]",inputMode:l,value:u,onChange:d=>i(d.target.value)})]})}function Nl({label:n,value:l,mono:o=!1}){return m.jsxs("div",{className:"flex items-start justify-between gap-3 text-[10px]",children:[m.jsx("span",{className:"shrink-0 uppercase tracking-[0.14em] text-muted-foreground",children:n}),m.jsx("span",{className:ce("break-all text-right text-foreground",o&&"font-mono"),children:l})]})}function f_(n){const l=n.result;if(!l||typeof l!="object")return null;const o=l;return o.ok!==!0||typeof o.command!="string"||typeof o.logPath!="string"?null:{ok:!0,mode:o.mode==="package"?"package":"development",command:o.command,logPath:o.logPath,pid:typeof o.pid=="number"?o.pid:void 0}}function Hv(n){return{port:h_(n.endpoint),name:n.nodeName,join:"",transport:zx(n.transportType),workDir:n.workDir??"",config:"",disableAuth:n.disableAuthDefault===!0,disableAuthKnown:n.disableAuthDefault!==void 0}}function m_(n){const l={},o=Number(n.port.trim());return n.port.trim()&&Number.isInteger(o)&&o>0&&(l.port=o),n.name.trim()&&(l.name=n.name.trim()),n.join.trim()&&(l.join=n.join.trim()),n.transport!=="inherit"&&(l.transport=n.transport),n.workDir.trim()&&(l.workDir=n.workDir.trim()),n.config.trim()&&(l.config=n.config.trim()),n.disableAuthKnown&&(l.disableAuth=n.disableAuth),Object.keys(l).length>0?l:void 0}function zx(n){return n==="direct"||n==="devtunnel"||n==="tailscale"?n:"inherit"}function h_(n){if(!n)return"";try{return new URL(n).port||""}catch{return""}}function Vd(n){return n.length<=8?n:n.slice(0,8)}function p_(n){return[{key:"workspace",label:"Workspace",value:n==null?void 0:n.workspace},{key:"node",label:"Node app",value:n==null?void 0:n.node},{key:"core",label:"Core",value:n==null?void 0:n.core},{key:"dashboard",label:"Dashboard",value:n==null?void 0:n.dashboard},{key:"api",label:"API",value:n==null?void 0:n.api}].filter(o=>o.value)}function Sr({label:n,value:l,mono:o=!1}){return m.jsxs("div",{className:"min-w-0 rounded-lg border border-border/60 bg-background/65 px-2.5 py-1.5",children:[m.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:n}),m.jsx("div",{className:o?"mt-0.5 break-all font-mono text-[11px] text-foreground":"mt-0.5 break-all text-[11px] text-foreground",children:l})]})}function g_({formatDateTime:n,isLiveLocalNode:l,onRefresh:o,runtimeUpdate:i,selectedNode:u,viewInfo:d}){var h,y,p,x,g,w,C,N,E,T,R;const f=p_(d.packages);return m.jsxs(Ls,{value:"about","data-about-layout":"compact",className:"mt-0 space-y-2",children:[m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(On,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(Dn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(xE,{className:"h-3.5 w-3.5 text-primary"}),"Repository & runtime"]}),m.jsx(kn,{className:"text-[10px]",children:"Build source and runtime identity for this node."})]}),m.jsxs(zn,{className:"space-y-2 px-3 pb-2.5",children:[(h=d.repository)!=null&&h.url?m.jsxs("a",{href:d.repository.url,target:"_blank",rel:"noreferrer",className:"group flex min-w-0 items-center justify-between gap-2 rounded-lg border border-border/70 bg-background/70 px-2.5 py-1.5 text-[11px] text-foreground transition-colors hover:border-primary/40 hover:bg-primary/5",children:[m.jsx("span",{className:"truncate font-mono text-[10px]",children:d.repository.url}),m.jsx(VE,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform group-hover:-translate-y-0.5 group-hover:translate-x-0.5"})]}):m.jsx("div",{className:"rounded-lg border border-dashed border-border/70 bg-muted/20 px-2.5 py-1.5 text-[11px] text-muted-foreground",children:"Repository URL is unavailable in this runtime."}),m.jsxs("div",{className:"grid gap-1.5 sm:grid-cols-2 lg:grid-cols-3",children:[m.jsx(Sr,{label:"Branch",value:((y=d.repository)==null?void 0:y.branch)??"Unavailable",mono:!!((p=d.repository)!=null&&p.branch)}),m.jsx(Sr,{label:"Commit",value:((x=d.repository)==null?void 0:x.commit)??"Unavailable",mono:!!((g=d.repository)!=null&&g.commit)}),m.jsx(Sr,{label:"Runtime",value:`${d.packageName??"meshy"} ${d.version}`,mono:!0}),m.jsx(Sr,{label:"Node.js",value:((w=d.runtime)==null?void 0:w.nodeVersion)??"Unavailable",mono:!!((C=d.runtime)!=null&&C.nodeVersion)}),m.jsx(Sr,{label:"PID",value:d.runtime?String(d.runtime.pid):"Unavailable",mono:!!d.runtime}),m.jsx(Sr,{label:"Started",value:n((N=d.runtime)==null?void 0:N.startedAt)})]})]})]}),i&&m.jsx(u_,{checkedLabel:n(i.checkedAt),disableAuthDefault:((E=d.auth)==null?void 0:E.enabled)===void 0?void 0:d.auth.enabled===!1,endpoint:u.endpoint,isLiveLocalNode:l,nodeId:u.id,nodeName:u.name,onRefresh:o,pid:(T=d.runtime)==null?void 0:T.pid,transportType:u.transportType,update:i,workDir:((R=d.runtime)==null?void 0:R.workDir)??u.workDir}),m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(On,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(Dn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(GE,{className:"h-3.5 w-3.5 text-primary"}),"Package versions"]}),m.jsx(kn,{className:"text-[10px]",children:"Version snapshot for the packages most relevant to this dashboard session."})]}),m.jsx(zn,{"data-package-layout":"list",className:"space-y-1.5 px-3 pb-2.5",children:f.map(A=>{var M,k;return m.jsxs("div",{className:"grid gap-1.5 rounded-lg border border-border/60 bg-background/65 px-2.5 py-1.5 sm:grid-cols-[9rem_minmax(0,1fr)_auto] sm:items-center",children:[m.jsx("div",{className:"text-[11px] font-medium text-foreground",children:A.label}),m.jsx("div",{className:"min-w-0 truncate text-[10px] text-muted-foreground",children:(M=A.value)==null?void 0:M.name}),m.jsx(mt,{variant:"outline",className:"w-fit rounded-[11px] border-border/70 bg-background/60 font-mono text-[10px]",children:(k=A.value)==null?void 0:k.version})]},A.key)})})]})]})}function Lo({formatDateTime:n,name:l,status:o,statusVariant:i}){return m.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-border/60 bg-background/70 px-2.5 py-1.5",children:[m.jsxs("div",{children:[m.jsx("div",{className:"text-[11px] font-medium text-foreground",children:l}),m.jsx("div",{className:"text-[10px] text-muted-foreground",children:n(o==null?void 0:o.checkedAt)})]}),m.jsxs("div",{className:"flex items-center gap-1.5",children:[typeof(o==null?void 0:o.authenticated)=="boolean"&&m.jsx(mt,{variant:o.authenticated?"default":"outline",className:"rounded-full text-[10px] uppercase tracking-[0.14em]",children:o.authenticated?"auth ok":"auth required"}),m.jsx(mt,{variant:i(o==null?void 0:o.status),className:"rounded-full text-[10px] uppercase tracking-[0.14em]",children:(o==null?void 0:o.status)??"unknown"})]})]})}function Ft(n){if(n==null||n==="")return"Unavailable";const l=new Date(n);return Number.isNaN(l.getTime())?"Unavailable":new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(l)}function v_(n){const l=Math.max(0,Math.floor(n)),o=Math.floor(l/86400),i=Math.floor(l%86400/3600),u=Math.floor(l%3600/60);return o>0?`${o}d ${i}h`:i>0?`${i}h ${u}m`:`${u}m`}function Vv(n){if(n==null||Number.isNaN(n))return"Unavailable";const l=["B","KB","MB","GB","TB"];let o=n,i=0;for(;o>=1024&&i<l.length-1;)o/=1024,i+=1;return`${o.toFixed(o>=10||i===0?0:1)} ${l[i]}`}function Er(n){return n==="ok"?"default":n==="missing"||n==="install-failed"||n==="login-failed"?"destructive":n==="not-authenticated"||n==="unsupported-platform"?"outline":"secondary"}function y_(n){return n.available?m.jsxs(mt,{className:"gap-1 rounded-full px-2 py-0.5 text-[10px]",children:[m.jsx(Bo,{className:"h-3 w-3"}),"Available"]}):m.jsxs(mt,{variant:"destructive",className:"gap-1 rounded-full px-2 py-0.5 text-[10px]",children:[m.jsx(kE,{className:"h-3 w-3"}),"Unavailable"]})}function b_(n){return n.update?n.update.updateAvailable?m.jsxs(mt,{variant:"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:["Update ",n.update.latestVersion]}):m.jsx(mt,{variant:"secondary",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:"Up to date"}):null}function x_(n){var o;const l=`npm install -g ${(o=n.update)==null?void 0:o.packageName}@latest`;return n.id==="claude"?`${l} --include=optional --ignore-scripts=false`:l}function S_(n){if(n.error)return n.error;const l=n.result;return(l==null?void 0:l.detail)??null}function Ke({label:n,value:l,mono:o=!1}){return m.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-border/50 py-1 last:border-b-0 last:pb-0 first:pt-0",children:[m.jsx("span",{className:"shrink-0 text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:n}),m.jsx("span",{className:ce("break-all text-right text-[11px] text-foreground",o&&"font-mono text-[11px]"),children:l})]})}function Uo({label:n,value:l,mono:o=!1,className:i}){return m.jsxs("div",{className:ce("min-w-0 space-y-0.5",i),children:[m.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:n}),m.jsx("div",{className:ce("truncate text-[11px] text-foreground",o&&"font-mono",n==="Path"&&"break-all whitespace-normal"),children:l})]})}function w_({agent:n,nodeName:l,activeOperation:o,onUpgrade:i}){var h,y;const u=((h=n.update)==null?void 0:h.updateAvailable)===!0,d=b_(n),f=!!o;return m.jsxs("div",{className:"rounded-lg border border-border/60 bg-background/65 px-3 py-2.5 transition-colors hover:bg-background/85",children:[m.jsxs("div",{className:"grid gap-3 lg:grid-cols-[12rem_minmax(0,1fr)_auto] lg:items-start",children:[m.jsxs("div",{className:"min-w-0 space-y-1.5",children:[m.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] font-semibold text-foreground",children:[m.jsx(g0,{className:"h-3.5 w-3.5 shrink-0 text-primary"}),m.jsx("span",{className:"truncate",children:n.label})]}),m.jsxs("div",{className:"truncate text-[10px] text-muted-foreground",children:["Command: ",m.jsx("span",{className:"font-mono text-[10px]",children:n.command})]}),m.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[y_(n),n.metadataStatus&&m.jsx(mt,{variant:Er(n.metadataStatus),className:"rounded-full px-2 py-0 text-[10px] uppercase tracking-[0.14em]",children:n.metadataStatus})]})]}),m.jsxs("div",{className:"grid min-w-0 gap-x-4 gap-y-1.5 sm:grid-cols-2",children:[m.jsx(Uo,{label:"Version",value:n.version??"Unavailable",mono:!!n.version}),n.update&&m.jsx(Uo,{label:"Latest",value:n.update.latestVersion??"Unavailable",mono:!!n.update.latestVersion}),m.jsx(Uo,{label:"Checked",value:Ft(n.checkedAt)}),n.update&&m.jsx(Uo,{label:"Update check",value:Ft(n.update.checkedAt)}),m.jsx(Uo,{label:"Path",value:n.path??"Not on PATH",mono:!!n.path,className:"sm:col-span-2"})]}),m.jsx("div",{className:"flex items-start justify-start lg:justify-end",children:o?m.jsxs(mt,{variant:"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:["Upgrade ",o.status]}):u?m.jsxs(nf,{children:[m.jsx(af,{asChild:!0,children:m.jsx("button",{type:"button",disabled:f,className:"rounded-full transition duration-150 hover:-translate-y-0.5 hover:scale-[1.03] hover:shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/45 focus-visible:ring-offset-2 active:translate-y-0 active:scale-95 disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:translate-y-0 disabled:hover:scale-100 disabled:hover:shadow-none",children:d})}),m.jsxs(Us,{children:[m.jsxs(Bs,{children:[m.jsxs(Vs,{children:["Upgrade ",n.label,"?"]}),m.jsxs($s,{children:["This runs ",x_(n)," on ",l,". Remote nodes execute the command on the remote machine."]})]}),m.jsxs(Hs,{children:[m.jsx(Ys,{children:"Cancel"}),m.jsx(qs,{onClick:()=>i(n),children:"Upgrade"})]})]})]}):d})]}),((y=n.update)==null?void 0:y.detail)&&m.jsx("div",{className:"mt-2 rounded-md border border-border/60 bg-muted/40 px-2 py-1 text-[10px] text-muted-foreground",children:n.update.detail}),n.detail&&m.jsx("div",{className:"mt-2 rounded-md border border-border/60 bg-muted/40 px-2 py-1 text-[10px] text-muted-foreground",children:n.detail})]})}function E_(n,l){var o;return(o=n==null?void 0:n.nodes)!=null&&o.length?n.nodes:l?[l]:[]}function N_(n,l){var i;if(l&&n.id===l.nodeId)return l;const o=n.settingsSnapshot;return{...n,nodeId:n.id,version:(o==null?void 0:o.version)??"Unavailable",packageName:o==null?void 0:o.packageName,uptime:(o==null?void 0:o.uptime)??0,localDashboardOrigin:((i=o==null?void 0:o.runtime)==null?void 0:i.localDashboardOrigin)??void 0,auth:o==null?void 0:o.auth,os:o==null?void 0:o.os,runtime:o==null?void 0:o.runtime,runtimeUpdate:o==null?void 0:o.runtimeUpdate,agents:o==null?void 0:o.agents,startupRequirements:o==null?void 0:o.startupRequirements,components:o==null?void 0:o.components,repository:o==null?void 0:o.repository,packages:o==null?void 0:o.packages}}function C_(n,l){return n.id===l?`${n.name} (this node)`:`${n.name} (${n.role})`}function T_(n){return n==="claude"?"Claude Code":n==="copilot"?"Copilot CLI":"Codex"}function R_(n){var o;const l=(o=n.payload)==null?void 0:o.agent;return l==="claude"||l==="codex"||l==="copilot"?l:null}function A_({cluster:n,systemInfo:l,sseConnected:o,initialSelectedNodeId:i,onRefresh:u}){var ae,oe,pe,me,ue,de,re,O,Y,F,se,J,j,X,Q,ee,te;const d=v.useMemo(()=>E_(n,l),[n,l]),[f,h]=v.useState(()=>{var I;return i??(l==null?void 0:l.nodeId)??((I=n==null?void 0:n.self)==null?void 0:I.id)??""}),[y,p]=v.useState(()=>new Map),x=v.useRef(new Set),g=v.useRef(new Set),w=(n==null?void 0:n.self)??l??d[0]??null,C=d.find(I=>I.id===f)??w,N=C?N_(C,l):null,E=!!(l&&C&&C.id===l.nodeId),T=E||!!(C!=null&&C.settingsSnapshot),R=N==null?void 0:N.runtimeUpdate,A=((ae=N==null?void 0:N.startupRequirements)==null?void 0:ae.components)??(N==null?void 0:N.components)??{},M=v.useMemo(()=>d.map(I=>I.id),[d]),k=M.join("\0"),$=FA(d),G=v.useMemo(()=>new Map(d.map(I=>[I.id,I.name])),[$]);v.useEffect(()=>{i&&M.includes(i)&&h(i)},[i,k]);const B=v.useCallback(async(I,W)=>{const le=Dx(I);if(!le||x.current.has(I.id))return;const ie=R_(I),we=(W==null?void 0:W.agentLabel)??(ie?T_(ie):"Agent"),Ee=(W==null?void 0:W.nodeName)??G.get(I.nodeId)??I.nodeId;x.current.add(I.id),p(ve=>new Map(ve).set(le,I));try{const ve=await kx(I);if(ve.status==="succeeded")await(u==null?void 0:u()),g.current.has(ve.id)||(ut.success(`${we} upgrade finished on ${Ee}`),g.current.add(ve.id));else if(ve.status==="failed")g.current.has(ve.id)||(ut.error(S_(ve)??`${we} upgrade failed`),g.current.add(ve.id));else{p(Ye=>new Map(Ye).set(le,ve)),ut.info(`${we} upgrade is still ${ve.status} on ${Ee}`);return}p(Ye=>{const ke=new Map(Ye),yt=ke.get(le);return(!yt||yt.id===ve.id)&&ke.delete(le),ke})}catch(ve){p(Ye=>{const ke=new Map(Ye),yt=ke.get(le);return(!yt||yt.id===I.id)&&ke.delete(le),ke}),ut.error(ve instanceof Error?ve.message:`${we} upgrade failed`)}finally{x.current.delete(I.id)}},[u,G]);v.useEffect(()=>{if(M.length===0)return;let I=!1;async function W(){let le;try{le=await e_(M)}catch{return}if(!I){p(ie=>{const we=new Map(ie);for(const[Ee,ve]of le)we.set(Ee,ve);return we});for(const ie of le.values())B(ie)}}return W(),()=>{I=!0}},[B,k]);async function V(I){if(C)try{const W=await Kw(C.id,I.id);ut.info(`${I.label} upgrade started on ${C.name}`),await B(W,{agentLabel:I.label,nodeName:C.name})}catch(W){ut.error(W instanceof Error?W.message:`${I.label} upgrade failed`)}}return!C||!N?m.jsx("div",{className:"rounded-2xl border border-dashed border-border/70 bg-muted/20 px-4 py-8 text-center text-[12px] text-muted-foreground",children:"Loading session metadata..."}):m.jsxs("div",{className:"space-y-3",children:[m.jsxs("section",{className:"relative mt-2 rounded-2xl border border-border/70 bg-[radial-gradient(circle_at_top_left,rgba(59,130,246,0.18),transparent_42%),radial-gradient(circle_at_bottom_right,rgba(16,185,129,0.12),transparent_32%),rgba(255,255,255,0.72)] p-3 shadow-[0_24px_90px_-54px_rgba(15,23,42,0.55)] dark:bg-[radial-gradient(circle_at_top_left,rgba(59,130,246,0.18),transparent_42%),radial-gradient(circle_at_bottom_right,rgba(16,185,129,0.12),transparent_32%),rgba(10,15,23,0.78)]",children:[!E&&m.jsxs(mt,{variant:"outline",className:"absolute right-3 top-2.5 rounded-full border-border/70 bg-background/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em] whitespace-nowrap",children:["Updated ",Ft((oe=C.settingsSnapshot)==null?void 0:oe.collectedAt)]}),m.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-end md:justify-between",children:[m.jsxs("div",{className:"space-y-2",children:[m.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[m.jsxs("span",{className:"flex items-center gap-1.5 rounded-full border border-border/70 bg-background/75 px-2 py-0.5 text-[10px] text-muted-foreground backdrop-blur",children:[m.jsx(V0,{status:C.status}),m.jsx("span",{className:"font-medium text-foreground",children:C.name})]}),m.jsx(lC,{role:C.role}),m.jsx(mt,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:C.transportType??N.transportType??"direct"}),m.jsx(mt,{variant:E?"default":"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:E?"Live local session":"Leader-synced snapshot"})]}),m.jsxs("div",{children:[m.jsx("div",{className:"text-[10px] uppercase tracking-[0.34em] text-muted-foreground",children:"Session"}),m.jsx("h3",{className:"mt-0.5 text-sm font-semibold tracking-tight text-foreground",children:"Node runtime"}),m.jsx("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:"Runtime environment, connectivity, and build metadata."})]}),d.length>1&&m.jsxs("div",{className:"w-48 space-y-1.5",children:[m.jsx("div",{className:"text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:"Inspect node"}),m.jsxs(kb,{value:C.id,onValueChange:h,children:[m.jsx(Hf,{className:"h-7 rounded-lg border-border/70 bg-background/70 text-[11px]",children:m.jsx(zb,{placeholder:"Choose a node"})}),m.jsx(Vf,{children:d.map(I=>m.jsx(Nr,{value:I.id,children:C_(I,l==null?void 0:l.nodeId)},I.id))})]})]})]}),m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsxs(mt,{variant:o?"default":"outline",className:"gap-1 rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:[m.jsx(b0,{className:"h-3 w-3"}),o?"Live link":"Reconnecting"]}),m.jsxs(mt,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:["Uptime ",v_(N.uptime)]})]})]})]}),!T&&m.jsx("div",{className:"rounded-xl border border-dashed border-border/70 bg-muted/20 px-3 py-2 text-[11px] text-muted-foreground",children:"This node has not synced its settings snapshot to the leader yet. Wait for the next keepalive and reopen the dialog if needed."}),m.jsxs(DA,{defaultValue:"session",className:"space-y-2",children:[m.jsxs(ax,{className:"h-auto flex-wrap rounded-xl border border-border/60 bg-muted/40 p-0.5",children:[m.jsx(Cs,{value:"session",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"Session"}),m.jsx(Cs,{value:"access",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"Access"}),m.jsx(Cs,{value:"about",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"About"})]}),m.jsxs(Ls,{value:"session",className:"mt-0 grid gap-2 xl:grid-cols-[1.15fr_0.85fr]",children:[m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(On,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(Dn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(tN,{className:"h-3.5 w-3.5 text-primary"}),"Selected node"]}),m.jsx(kn,{className:"text-[10px]",children:"Cluster role, identity, and node-scoped runtime state."})]}),m.jsxs(zn,{className:"space-y-0 px-3 pb-2.5",children:[m.jsx(Ke,{label:"Node ID",value:N.nodeId,mono:!0}),m.jsx(Ke,{label:"Status",value:C.status}),m.jsx(Ke,{label:"Role",value:C.role}),m.jsx(Ke,{label:"Endpoint",value:C.endpoint,mono:!0}),m.jsx(Ke,{label:"Joined",value:Ft(C.joinedAt)}),m.jsx(Ke,{label:"Heartbeat",value:Ft(C.lastHeartbeat)}),m.jsx(Ke,{label:"Capabilities",value:C.capabilities.length>0?C.capabilities.join(", "):"None"})]})]}),m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(On,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(Dn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(BE,{className:"h-3.5 w-3.5 text-primary"}),"OS info"]}),m.jsx(kn,{className:"text-[10px]",children:"Host and resource details reported by the current process."})]}),m.jsxs(zn,{className:"space-y-0 px-3 pb-2.5",children:[m.jsx(Ke,{label:"Host",value:((pe=N.os)==null?void 0:pe.hostname)??"Unavailable"}),m.jsx(Ke,{label:"Platform",value:N.os?`${N.os.platform} ${N.os.release}`:"Unavailable"}),m.jsx(Ke,{label:"Arch",value:((me=N.os)==null?void 0:me.arch)??"Unavailable"}),m.jsx(Ke,{label:"CPU",value:((ue=N.os)==null?void 0:ue.cpuModel)??"Unavailable"}),m.jsx(Ke,{label:"Cores",value:String(((de=N.os)==null?void 0:de.cpuCount)??"Unavailable")}),m.jsx(Ke,{label:"Memory",value:N.os?`${Vv(N.os.freeMemoryBytes)} free / ${Vv(N.os.totalMemoryBytes)} total`:"Unavailable"})]})]}),m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)] xl:col-span-2",children:[m.jsxs(On,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(Dn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(g0,{className:"h-3.5 w-3.5 text-primary"}),"Available agents"]}),m.jsx(kn,{className:"text-[10px]",children:E?"Live command availability for runtime agents on this node.":"Most recent agent availability snapshot synced from this node."})]}),m.jsx(zn,{"data-agent-layout":"list",className:"space-y-1.5 px-3 pb-2.5",children:(N.agents??[]).map(I=>m.jsx(w_,{agent:I,nodeName:C.name,activeOperation:y.get(`${C.id}:${I.id}`),onUpgrade:V},I.id))})]})]}),m.jsxs(Ls,{value:"access",className:"mt-0 grid gap-2 xl:grid-cols-2",children:[m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(On,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(Dn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(EE,{className:"h-3.5 w-3.5 text-primary"}),"Access surface"]}),m.jsx(kn,{className:"text-[10px]",children:"How this node is exposed to the dashboard and other peers."})]}),m.jsxs(zn,{className:"space-y-0 px-3 pb-2.5",children:[m.jsx(Ke,{label:"Transport",value:C.transportType??N.transportType??"direct"}),m.jsx(Ke,{label:"Node URL",value:C.endpoint,mono:!0}),m.jsx(Ke,{label:"Node tunnel",value:C.devtunnelEndpoint??"Disabled",mono:!!C.devtunnelEndpoint}),m.jsx(Ke,{label:"Dashboard URL",value:C.dashboardOrigin??N.localDashboardOrigin??"Unavailable",mono:!!(C.dashboardOrigin||N.localDashboardOrigin)}),m.jsx(Ke,{label:"Local dashboard",value:N.localDashboardOrigin??"Unavailable",mono:!!N.localDashboardOrigin})]})]}),m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(On,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(Dn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(rN,{className:"h-3.5 w-3.5 text-primary"}),"Auth"]}),m.jsx(kn,{className:"text-[10px]",children:"Current bearer-auth and trusted access posture."})]}),m.jsxs(zn,{className:"space-y-0 px-3 pb-2.5",children:[m.jsx(Ke,{label:"Enabled",value:(re=N.auth)!=null&&re.enabled?"Yes":"No"}),m.jsx(Ke,{label:"Same tenant",value:(O=N.auth)!=null&&O.allowSameTenant?"Allowed":"Off"}),m.jsx(Ke,{label:"Allowed users",value:(Y=N.auth)!=null&&Y.allowedUsers.length?N.auth.allowedUsers.join(", "):"None"})]})]}),m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(On,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(Dn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(qE,{className:"h-3.5 w-3.5 text-primary"}),"Paths"]}),m.jsx(kn,{className:"text-[10px]",children:"Workspace and runtime paths currently used by this node."})]}),m.jsxs(zn,{className:"space-y-0 px-3 pb-2.5",children:[m.jsx(Ke,{label:"Work dir",value:((F=N.runtime)==null?void 0:F.workDir)??N.workDir??"Unavailable",mono:!!(((se=N.runtime)==null?void 0:se.workDir)??N.workDir)}),m.jsx(Ke,{label:"Storage",value:((J=N.runtime)==null?void 0:J.storagePath)??"Unavailable",mono:!!((j=N.runtime)!=null&&j.storagePath)}),m.jsx(Ke,{label:"Process cwd",value:((X=N.runtime)==null?void 0:X.cwd)??"Unavailable",mono:!!((Q=N.runtime)!=null&&Q.cwd)}),m.jsx(Ke,{label:"Started",value:Ft((ee=N.runtime)==null?void 0:ee.startedAt)}),m.jsx(Ke,{label:"PID",value:N.runtime?String(N.runtime.pid):"Unavailable",mono:!!N.runtime})]})]}),m.jsxs(Mn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[m.jsxs(On,{className:"pb-1.5 pt-2.5 px-3",children:[m.jsxs(Dn,{className:"flex items-center gap-1.5 text-[12px]",children:[m.jsx(Rs,{className:"h-3.5 w-3.5 text-primary"}),"Startup checks"]}),m.jsx(kn,{className:"text-[10px]",children:"Dependency preflight snapshot persisted during node startup."})]}),m.jsxs(zn,{className:"space-y-3 px-3 pb-2.5",children:[m.jsxs("div",{className:"rounded-xl border border-border/60 bg-background/70 px-3 py-2",children:[m.jsx("div",{className:"text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:"Last checked"}),m.jsx("div",{className:"mt-0.5 text-[11px] text-foreground",children:Ft((te=N.startupRequirements)==null?void 0:te.lastCheckedAt)})]}),m.jsxs("div",{className:"space-y-2",children:[m.jsx(Lo,{formatDateTime:Ft,name:"Azure CLI",status:A.az,statusVariant:Er}),m.jsx(Lo,{formatDateTime:Ft,name:"DevTunnel",status:A.devtunnel,statusVariant:Er}),m.jsx(Lo,{formatDateTime:Ft,name:"Claude Code",status:A.claude,statusVariant:Er}),m.jsx(Lo,{formatDateTime:Ft,name:"Codex",status:A.codex,statusVariant:Er}),m.jsx(Lo,{formatDateTime:Ft,name:"Copilot CLI",status:A.copilot,statusVariant:Er})]})]})]})]}),m.jsx(g_,{formatDateTime:Ft,isLiveLocalNode:E,onRefresh:u,runtimeUpdate:R,selectedNode:C,viewInfo:N})]})]})}function __({initialSelectedNodeId:n,open:l,onOpenChange:o,showTrigger:i=!0}={}){const{cluster:u,systemInfo:d,sseConnected:f,refresh:h}=h0();return m.jsx(w5,{open:l,onOpenChange:o,showTrigger:i,children:m.jsx(A_,{cluster:u,systemInfo:d,sseConnected:f,initialSelectedNodeId:n,onRefresh:h})})}const fj="bypass",j_=[{value:"claudecode",label:"claudecode",supportsFollowUp:!0},{value:"codex",label:"codex",supportsFollowUp:!0},{value:"copilot",label:"copilot",supportsFollowUp:!0},{value:"mars",label:"mars",disabled:!0,description:"coming soon"},{value:"eureka",label:"eureka",disabled:!0,description:"coming soon"}],mj=[{value:"bypass",label:"Bypass"},{value:"plan",label:"Plan"},{value:"edit",label:"Edit"},{value:"dangerous",label:"Dangerous"}],hj=new Set(j_.filter(n=>n.supportsFollowUp).map(n=>n.value)),pj=[{value:"active",label:"Active"},{value:"running",label:"Running"},{value:"waiting",label:"Waiting"},{value:"closed",label:"Closed"},{value:"shared",label:"Shared"},{value:"archived",label:"Archived"}],gj=[{value:"all",label:"All task types"},{value:"native",label:"Native sessions"},{value:"meshy",label:"Meshy chats"}],M_=new Set(["pending","assigned"]),O_=new Set(["running"]),D_=new Set(["completed","failed","cancelled"]);function vj(n,l){switch(l){case"running":return O_.has(n.status);case"waiting":return M_.has(n.status);case"closed":return D_.has(n.status);case"shared":return!!n.activeShare;case"archived":return n.status==="archived";case"active":default:return n.status!=="archived"}}function yj(n,l){if(l==="all")return!0;const o=n.conversationKind==="nativeSession";return l==="native"?o:!o}function bj(n,l){const o=l.trim().toLowerCase();return o?[n.title,n.description,n.id,n.agent,n.assignedTo??"",n.assignedNodeName??"",n.project??"",n.effectiveProjectPath??"",n.conversationKind==="nativeSession"?"native session":"meshy chat",n.activeShare?"shared conversation":""].some(i=>i.toLowerCase().includes(o)):!0}function k_(n,l,o){if(!n)return"unassigned";const i=l==null?void 0:l.find(u=>u.id===n);return(i==null?void 0:i.name)??o??n.slice(0,8)}function xj(n,l,o){return k_(n,l,o).toLowerCase()}function Sj(n,l,o){return!n.assignedTo||(o==null?void 0:o.id)===n.assignedTo?!0:(l==null?void 0:l.some(i=>i.id===n.assignedTo))??!1}function wj(n,l){return[...n].sort((o,i)=>o.id===l?-1:i.id===l?1:o.name.localeCompare(i.name))}function Ej(n){if(!n||typeof n!="object")return null;const l=n,o=l.createMode,i=o==="chat"||o==="native"?o:void 0;return{draftNewTask:l.draftNewTask===!0,returnRoute:typeof l.returnRoute=="string"?l.returnRoute:void 0,returnTaskId:typeof l.returnTaskId=="string"||l.returnTaskId===null?l.returnTaskId:void 0,createMode:i}}function Nj(n){switch(n){case"running":return"bg-amber-500";case"completed":return"bg-emerald-500";case"failed":return"bg-destructive";case"cancelled":case"archived":return"bg-slate-400";case"assigned":return"bg-teal-500";case"pending":default:return"bg-muted-foreground"}}function Cj(n){return n==="default workspace"?n:n.replace(/\\/g,"/").split("/").filter(Boolean).at(-1)??n}function Tj(n){const l=Date.now()-n;return l<6e4?"just now":l<36e5?`${Math.floor(l/6e4)}m`:l<864e5?`${Math.floor(l/36e5)}h`:`${Math.floor(l/864e5)}d`}function Rj(n){return new Date(n).toLocaleString()}function Aj(n){const l=Math.floor(n/1e3),o=Math.floor(l/3600),i=Math.floor(l%3600/60),u=l%60;return`${String(o).padStart(2,"0")}:${String(i).padStart(2,"0")}:${String(u).padStart(2,"0")}`}async function z_(n,l="Copied to clipboard"){var o,i,u;try{if((i=(o=globalThis.navigator)==null?void 0:o.clipboard)!=null&&i.writeText)return await globalThis.navigator.clipboard.writeText(n),ut.success(l),!0;const d=globalThis.document,f=(u=d==null?void 0:d.execCommand)==null?void 0:u.bind(d);if(!(d!=null&&d.body)||typeof d.createElement!="function"||typeof f!="function")throw new Error("Clipboard access is unavailable");const h=d.createElement("textarea"),y=d.activeElement,p=y&&typeof y.focus=="function"?y:null;h.value=n,h.setAttribute("readonly","true"),h.style.position="fixed",h.style.opacity="0",h.style.pointerEvents="none",d.body.appendChild(h),h.select(),h.setSelectionRange(0,h.value.length);const x=f("copy");if(d.body.removeChild(h),p==null||p.focus(),!x)throw new Error("Clipboard access is unavailable");return ut.success(l),!0}catch(d){return ut.error(d instanceof Error?d.message:"Failed to copy"),!1}}function _j(n,l,o){const i=new Map;for(const d of n){const f=d.assignedTo??null,h=f??"__unassigned__",y=f?l.get(f)??d.assignedNodeName??f.slice(0,8):"Unassigned",p=d.effectiveProjectPath??d.project??"default workspace";i.has(h)||i.set(h,{nodeId:f,nodeName:y,dirMap:new Map});const x=i.get(h);x.dirMap.has(p)||x.dirMap.set(p,[]),x.dirMap.get(p).push(d)}const u=Array.from(i.values()).map(({nodeId:d,nodeName:f,dirMap:h})=>{const y=Array.from(h.entries()).map(([p,x])=>({path:p,tasks:x})).sort((p,x)=>x.tasks.length-p.tasks.length||p.path.localeCompare(x.path));return{nodeId:d,nodeName:f,dirs:y}});return u.sort((d,f)=>{if(o){if(d.nodeId===o)return-1;if(f.nodeId===o)return 1}return d.nodeId===null?1:f.nodeId===null?-1:d.nodeName.localeCompare(f.nodeName)}),u}const L_={node:"border-teal-500/30 bg-teal-500/10 text-teal-700 dark:text-teal-300",task:"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300",election:"border-indigo-500/30 bg-indigo-500/10 text-indigo-700 dark:text-indigo-300",cluster:"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",transport:"border-sky-500/30 bg-sky-500/10 text-sky-700 dark:text-sky-300"},U_={node:"text-teal-700/70 dark:text-teal-300/70",task:"text-amber-700/70 dark:text-amber-300/70",election:"text-indigo-700/70 dark:text-indigo-300/70",cluster:"text-emerald-700/70 dark:text-emerald-300/70",transport:"text-sky-700/70 dark:text-sky-300/70"};function B_(n){return n.split(".")[0]??"unknown"}function H_(n){return new Date(n).toLocaleTimeString("en-US",{hour12:!1})}function wr(n,l){return(l==null?void 0:l.get(n))??n}function Lx(n,l){const o=n.data,i=o.operation;switch(n.type){case"node.joined":return`${o.name} joined the cluster`;case"node.left":return`${wr(o.nodeId,l)} left (${o.reason})`;case"node.status":return`${wr(o.nodeId,l)} is now ${o.status}`;case"node.operation.created":return`${i==null?void 0:i.kind} ${i==null?void 0:i.status} on ${wr(i==null?void 0:i.nodeId,l)}`;case"node.operation.updated":return`${i==null?void 0:i.kind} ${i==null?void 0:i.status} on ${wr(i==null?void 0:i.nodeId,l)}`;case"transport.changed":return`${wr(o.nodeId,l)} transport switched to ${o.transportType}`;case"task.created":return`"${o.title}" created`;case"task.assigned":return`task assigned to ${wr(o.nodeId,l)}`;case"task.status":return`task ${o.taskId.slice(0,8)} -> ${o.status}`;case"election.started":return`candidate ${o.candidateId.slice(0,8)} term ${o.term}`;case"election.complete":return`leader elected, term ${o.term}`;case"cluster.state":return`${o.nodeCount} nodes, term ${o.term}`;default:return JSON.stringify(o)}}function V_(n){return JSON.stringify(n,null,2)}function $_({events:n,maxHeight:l="400px",nodeNameById:o,onDismiss:i,density:u="default"}){if(n.length===0)return null;const d=u==="compact";return m.jsx("div",{className:"overflow-y-auto pr-1",style:{maxHeight:l},children:m.jsx("div",{className:"space-y-1.5",children:n.map(f=>{const h=B_(f.type);return m.jsx("div",{className:ce("transition-colors hover:bg-muted/30",d?"rounded-[7px] px-1 py-0.5":"rounded-lg px-1.5 py-1"),children:m.jsxs("div",{className:"space-y-1",children:[m.jsxs("div",{className:"flex items-start justify-between gap-1.5",children:[m.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[m.jsx("div",{className:ce("font-mono text-muted-foreground",d?"text-[8px]":"text-[9px]"),children:H_(f.timestamp)}),d?m.jsx("span",{className:ce("max-w-[8.5rem] truncate text-[7px] font-medium uppercase tracking-[0.08em] text-muted-foreground/70",U_[h]),children:f.type}):m.jsx(mt,{variant:"outline",className:ce("w-fit text-[9px] font-medium uppercase tracking-[0.14em] px-1.5 py-0",L_[h]),children:f.type})]}),m.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[m.jsx(Vn,{type:"button",variant:"ghost",size:"icon",className:ce("rounded-[8px] text-muted-foreground",d?"h-4 w-4":"h-5 w-5"),onClick:()=>void z_(V_(f),"Event copied"),"aria-label":`Copy ${f.type} event`,title:"Copy event",children:m.jsx(LE,{className:d?"h-2.5 w-2.5":"h-3 w-3"})}),i&&m.jsx(Vn,{type:"button",variant:"ghost",size:"icon",className:ce("rounded-[8px] text-muted-foreground hover:text-foreground",d?"h-4 w-4":"h-5 w-5"),onClick:()=>i(f.id),"aria-label":`Dismiss ${f.type} event`,title:"Dismiss event",children:m.jsx(w0,{className:d?"h-2.5 w-2.5":"h-3 w-3"})})]})]}),m.jsx("div",{className:"text-[9px] leading-snug text-foreground/85",children:Lx(f,o)})]})},f.id)})})})}const q_=["node.","election.","transport."],Y_="cluster.state";function G_(n){return n.type==="node.status"?!1:q_.some(l=>n.type.startsWith(l))}function X_(n){return new Date(n).toLocaleTimeString("en-US",{hour12:!1})}function P_(n,l){return n?{time:X_(n.timestamp),text:Lx(n,l)}:null}function Q_(n){return n.transportType==="devtunnel"||!!n.devtunnelEndpoint}function K_(n){if(n.length===0)return"No node tunnel";const l=n.filter(u=>u.status==="offline").length;if(l>0)return`${l} offline`;const o=n.filter(u=>{var d;return((d=u.devtunnelHealth)==null?void 0:d.status)==="failed"}).length;if(o>0)return`${o} failed`;const i=n.filter(u=>{var d;return u.status!=="offline"&&((d=u.devtunnelHealth)==null?void 0:d.status)!=="healthy"}).length;return i>0?`${i} checking`:"Healthy"}function Z_(n,l){var u;const o=(l==null?void 0:l.get(n.id))??n.name??n.id;if(n.status==="offline")return{label:o,status:"offline"};const i=((u=n.devtunnelHealth)==null?void 0:u.status)??"checking";return{label:o,status:i}}function I_(n){if(n.length===0)return"No nodes";const l=n.filter(i=>i.status==="offline").length;if(l>0)return`${l} offline`;const o=n.filter(i=>i.status==="busy").length;return o>0?`${o} busy`:"Healthy"}function F_(n,l){return{label:(l==null?void 0:l.get(n.id))??n.name??n.id,status:n.status}}function J_({connected:n,events:l,nodes:o=[],nodeNameById:i,defaultOpen:u=!1}){const[d,f]=v.useState(u),[h,y]=v.useState(!0),[p,x]=v.useState(new Set),g=v.useRef(null),w=v.useMemo(()=>l.filter(k=>G_(k)&&!p.has(k.id)),[l,p]),C=v.useMemo(()=>l.find(k=>k.type===Y_)??w[0],[l,w]),N=v.useMemo(()=>P_(C,i),[C,i]),E=v.useMemo(()=>o.filter(Q_),[o]),T=E.some(k=>{var $;return k.status==="offline"||(($=k.devtunnelHealth)==null?void 0:$.status)==="failed"}),R=o.some(k=>k.status==="offline"),A=o.some(k=>k.status==="busy"),M=o.length>0;return v.useEffect(()=>{x(k=>{if(k.size===0)return k;const $=new Set(l.map(B=>B.id)),G=new Set(Array.from(k).filter(B=>$.has(B)));return G.size===k.size?k:G})},[l]),v.useEffect(()=>{if(!d)return;const k=G=>{var B;(B=g.current)!=null&&B.contains(G.target)||f(!1)},$=G=>{G.key==="Escape"&&f(!1)};return document.addEventListener("pointerdown",k),document.addEventListener("keydown",$),()=>{document.removeEventListener("pointerdown",k),document.removeEventListener("keydown",$)}},[d]),m.jsxs("div",{ref:g,className:"relative",children:[m.jsxs("button",{type:"button","aria-expanded":d,"aria-haspopup":"dialog",onClick:()=>f(k=>!k),className:ce("flex items-center gap-1.5 rounded-[16px] border px-2 py-1.5 text-[11px] shadow-sm transition-all sm:gap-2 sm:px-3 sm:py-2 sm:text-xs",n?"border-emerald-500/25 bg-emerald-500/8 text-muted-foreground hover:border-emerald-500/40 hover:bg-emerald-500/12":"border-destructive/25 bg-destructive/8 text-muted-foreground hover:border-destructive/40 hover:bg-destructive/12",d&&"shadow-[0_14px_40px_-26px_rgba(16,185,129,0.95)]"),title:n?"Live link connected":"Live link reconnecting",children:[m.jsx(b0,{className:ce("h-3.5 w-3.5",n?"text-emerald-500":"text-destructive")}),n?"Live link":"Reconnecting"]}),d&&m.jsxs("div",{role:"dialog","aria-label":"Live link connection events",className:"absolute right-0 top-[calc(100%+0.4rem)] z-50 w-[18rem] max-w-[calc(100vw-1.5rem)] overflow-hidden rounded-[18px] border border-border/70 bg-background/96 shadow-[0_28px_90px_-42px_rgba(0,0,0,var(--panel-shadow-alpha))] backdrop-blur-xl max-sm:fixed max-sm:right-3 max-sm:top-[3.75rem] max-sm:w-[calc(100vw-1.5rem)]",children:[m.jsx("div",{className:"border-b border-border/60 bg-muted/25 px-2.5 py-1.5",children:m.jsxs("div",{className:"flex items-center justify-between gap-2",children:[m.jsxs("div",{className:"flex items-center gap-1.5",children:[n?m.jsx(Rs,{className:"h-3 w-3 text-emerald-500"}):m.jsx(dN,{className:"h-3 w-3 text-destructive"}),m.jsx("span",{className:"text-[10px] font-semibold text-foreground",children:"Live link"}),m.jsx("span",{className:"text-[9px] text-muted-foreground",children:n?"· SSE connected":"· reconnecting"})]}),m.jsx("div",{className:ce("rounded-[9px] border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.12em]",n?"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300":"border-destructive/30 bg-destructive/10 text-destructive"),children:n?"Connected":"Retrying"})]})}),m.jsxs("div",{className:"grid grid-cols-2 border-b border-border/60",children:[m.jsxs("div",{className:"border-r border-border/60 px-2.5 py-1.5",children:[m.jsx("div",{className:"text-[8px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"Events"}),m.jsx("div",{className:"mt-0.5 text-base font-semibold tracking-tight text-foreground",children:w.length})]}),m.jsxs("div",{className:"min-w-0 px-2.5 py-1.5",children:[m.jsx("div",{className:"text-[8px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"Latest"}),N?m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"mt-0.5 truncate text-[9px] leading-snug text-foreground/80",children:N.text}),m.jsx("div",{className:"font-mono text-[8px] text-muted-foreground/60",children:N.time})]}):m.jsx("div",{className:"mt-0.5 text-[8px] text-muted-foreground/50",children:"—"})]})]}),m.jsxs("div",{className:"border-b border-border/60 px-2.5 py-1.5",children:[m.jsxs("div",{className:"flex items-center justify-between gap-2",children:[m.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[R?m.jsx(us,{className:"h-3 w-3 shrink-0 text-destructive"}):A?m.jsx(Rs,{className:"h-3 w-3 shrink-0 text-amber-500"}):m.jsx(Bo,{className:ce("h-3 w-3 shrink-0",M?"text-emerald-500":"text-muted-foreground")}),m.jsx("span",{className:"text-[9px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"Node health"})]}),m.jsx("span",{className:ce("shrink-0 rounded-[8px] border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.1em]",R?"border-destructive/30 bg-destructive/10 text-destructive":A?"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300":M?"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300":"border-border/70 bg-background/60 text-muted-foreground"),children:I_(o)})]}),o.length>0&&m.jsx("div",{className:"mt-1.5 flex flex-col gap-0.5",children:o.map(k=>{const{label:$,status:G}=F_(k,i),B=G==="offline",V=G==="busy";return m.jsxs("div",{"aria-label":`${$} ${G}`,className:ce("flex items-center justify-between gap-2 rounded-[7px] px-2 py-0.5",B?"bg-destructive/6":V?"bg-amber-500/6":"bg-emerald-500/5"),title:`${$} ${G}`,children:[m.jsx("span",{className:"truncate text-[9px] text-foreground/70",children:$}),B?m.jsx(us,{className:"h-3 w-3 shrink-0 text-destructive"}):V?m.jsx(nv,{className:"h-3 w-3 shrink-0 text-amber-500"}):m.jsx(Bo,{className:"h-3 w-3 shrink-0 text-emerald-500"})]},k.id)})})]}),E.length>0&&m.jsxs("div",{className:"border-b border-border/60 px-2.5 py-1.5",children:[m.jsxs("div",{className:"flex items-center justify-between gap-2",children:[m.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[T?m.jsx(us,{className:"h-3 w-3 shrink-0 text-destructive"}):m.jsx(Bo,{className:"h-3 w-3 shrink-0 text-emerald-500"}),m.jsx("span",{className:"text-[9px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"DevTunnel"})]}),m.jsx("span",{className:ce("shrink-0 rounded-[8px] border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.1em]",T?"border-destructive/30 bg-destructive/10 text-destructive":"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300"),children:K_(E)})]}),m.jsx("div",{className:"mt-1.5 flex flex-col gap-0.5",children:E.map(k=>{var oe;const{label:$,status:G}=Z_(k,i),B=G==="failed"||G==="offline",V=G!=="healthy"&&G!=="failed"&&G!=="offline",ae=(oe=k.devtunnelHealth)!=null&&oe.reason?`${$} ${G}: ${k.devtunnelHealth.reason}`:`${$} ${G}`;return m.jsxs("div",{"aria-label":`${$} ${G}`,className:ce("flex items-center justify-between gap-2 rounded-[7px] px-2 py-0.5",B?"bg-destructive/6":V?"bg-muted/30":"bg-emerald-500/5"),title:ae,children:[m.jsx("span",{className:"truncate text-[9px] text-foreground/70",children:$}),B?m.jsx(us,{className:"h-3 w-3 shrink-0 text-destructive"}):V?m.jsx(nv,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):m.jsx(Bo,{className:"h-3 w-3 shrink-0 text-emerald-500"})]},k.id)})})]}),m.jsxs("div",{children:[m.jsxs("button",{type:"button",onClick:()=>y(k=>!k),className:"flex w-full items-center justify-between px-2.5 py-1.5 text-left hover:bg-muted/30",children:[m.jsxs("span",{className:"text-[8px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:["Notifications ",w.length>0&&`(${w.length})`]}),h?m.jsx(Qs,{className:"h-3 w-3 text-muted-foreground"}):m.jsx(RE,{className:"h-3 w-3 text-muted-foreground"})]}),h&&m.jsx("div",{className:"px-2 pb-2",children:m.jsx($_,{events:w,maxHeight:"12rem",density:"compact",emptyTitle:"No connection events yet",emptyDescription:"Node, election, and system events will appear here.",nodeNameById:i,onDismiss:k=>x($=>new Set($).add(k))})})]}),m.jsxs("div",{className:"flex items-center justify-end gap-1 border-t border-border/60 px-2.5 py-1",children:[m.jsx(Vn,{type:"button",variant:"ghost",size:"sm",className:"h-5 rounded-[9px] px-1.5 text-[9px]",onClick:()=>x(new Set(l.map(k=>k.id))),disabled:w.length===0,title:"Dismiss all notifications",children:"Dismiss all"}),m.jsx(Vn,{type:"button",variant:"ghost",size:"sm",className:"h-5 rounded-[9px] px-1.5 text-[9px]",onClick:()=>f(!1),children:"Close"})]})]})]})}const Vo="finsight",Ux="default",W_=new Set(["light","dark","system"]),e3=new Set(["porcelain","warm","finsight","inshield","edge"]),Bx=v.createContext(null);function t3(n){const l=new URLSearchParams(n).get("theme");return Hx(l)?l:null}function n3(n){const l=new URLSearchParams(n).get("palette");return Gf(l)}function a3(){if(typeof document>"u")return null;const n=document.documentElement;return{theme:n.classList.contains("dark")?"dark":"light",palette:Gf(n.getAttribute("data-palette"))??Vo}}function jj(n,l=a3()){if(!l)return n;try{const o=/^[a-z][a-z\d+\-.]*:/i.test(n),i=typeof window<"u"?window.location.href:"http://localhost",u=new URL(n,i);return u.searchParams.set("theme",l.theme),u.searchParams.set("palette",l.palette),o?u.toString():`${u.pathname}${u.search}${u.hash}`}catch{return n}}function l3({children:n}){const[l,o]=v.useState(()=>typeof window<"u"?t3(window.location.search)??i3(localStorage.getItem("meshy-theme"))??"system":"system"),[i,u]=v.useState(()=>typeof window<"u"?n3(window.location.search)??s3(localStorage.getItem("meshy-palette"))??Vo:Vo);return v.useEffect(()=>{const d=document.documentElement,f=h=>{if(h==="system"){const y=window.matchMedia("(prefers-color-scheme: dark)").matches;d.classList.toggle("dark",y)}else d.classList.toggle("dark",h==="dark")};if(f(l),localStorage.setItem("meshy-theme",l),l==="system"){const h=window.matchMedia("(prefers-color-scheme: dark)"),y=()=>f("system");return h.addEventListener("change",y),()=>h.removeEventListener("change",y)}},[l]),v.useEffect(()=>{const d=document.documentElement;i===Vo?d.removeAttribute("data-palette"):d.setAttribute("data-palette",i),localStorage.setItem("meshy-palette",i)},[i]),m.jsx(Bx.Provider,{value:{theme:l,setTheme:o,palette:i,setPalette:u},children:n})}function r3(){const n=v.useContext(Bx);if(!n)throw new Error("useTheme must be used within ThemeProvider");return n}function Hx(n){return n!==null&&W_.has(n)}function o3(n){return n!==null&&e3.has(n)}function i3(n){return Hx(n)?n:null}function Gf(n){return n===Ux?"porcelain":o3(n)?n:null}function s3(n){return n===Ux?null:Gf(n)}const c3=[{value:"light",label:"Light",icon:x0},{value:"dark",label:"Dark",icon:y0},{value:"system",label:"System",icon:v0}],u3=[{value:"finsight",label:"FinSight",hint:"Cool sage green"},{value:"porcelain",label:"Porcelain",hint:"Blue workspace"},{value:"warm",label:"Warm",hint:"Cream + amber"},{value:"inshield",label:"inShield",hint:"Pure white + navy"},{value:"edge",label:"Edge",hint:"Rounded violet panels"}];function d3(){const{theme:n,setTheme:l,palette:o,setPalette:i}=r3(),[u,d]=v.useState(!1),f=v.useRef(null),h=v.useRef(null),y=n==="dark"?y0:n==="light"?x0:v0,p=()=>{f.current&&(clearTimeout(f.current),f.current=null)},x=()=>{p(),f.current=setTimeout(()=>d(!1),180)};return v.useEffect(()=>{if(!u)return;const g=w=>{h.current&&!h.current.contains(w.target)&&d(!1)};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[u]),v.useEffect(()=>()=>p(),[]),m.jsxs("div",{ref:h,className:"relative",onMouseEnter:()=>{p(),d(!0)},onMouseLeave:x,children:[m.jsx(Vn,{variant:"ghost",size:"icon",onClick:()=>d(g=>!g),className:ce("rounded-[16px] border bg-background/70",o===Vo?"border-border/60":"border-primary/60 text-primary"),title:"Appearance","aria-haspopup":"menu","aria-expanded":u,children:m.jsx(y,{className:"h-4 w-4"})}),u&&m.jsxs("div",{role:"menu",className:"absolute right-0 top-[calc(100%+8px)] z-50 w-64 rounded-[20px] border border-border/70 bg-popover/95 p-3 text-popover-foreground shadow-[0_24px_80px_-32px_rgba(0,0,0,0.35)] backdrop-blur-xl",children:[m.jsx("div",{className:"px-1 pb-1 text-[10px] font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:"Theme"}),m.jsx("div",{className:"mb-2 grid grid-cols-3 gap-1",children:c3.map(({value:g,label:w,icon:C})=>{const N=n===g;return m.jsxs("button",{type:"button",onClick:()=>l(g),className:ce("flex flex-col items-center gap-1 rounded-[14px] border px-2 py-2 text-[11px] font-medium transition-colors",N?"border-primary/50 bg-primary/10 text-primary":"border-border/60 text-muted-foreground hover:border-border hover:bg-muted/60 hover:text-foreground"),children:[m.jsx(C,{className:"h-4 w-4"}),w]},g)})}),m.jsxs("div",{className:"mt-2 flex items-center gap-1.5 px-1 pb-1 text-[10px] font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:[m.jsx(iN,{className:"h-3 w-3"}),"Palette"]}),m.jsx("div",{className:"space-y-1",children:u3.map(({value:g,label:w,hint:C})=>{const N=o===g;return m.jsxs("button",{type:"button",onClick:()=>i(g),className:ce("flex w-full items-center gap-2 rounded-[14px] border px-2.5 py-1.5 text-left transition-colors",N?"border-primary/50 bg-primary/10":"border-transparent hover:bg-muted/60"),children:[m.jsx(f3,{value:g}),m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx("div",{className:ce("text-[12px] font-medium",N?"text-primary":"text-foreground"),children:w}),m.jsx("div",{className:"text-[10px] text-muted-foreground",children:C})]}),N&&m.jsx(mf,{className:"h-3.5 w-3.5 text-primary"})]},g)})})]})]})}function f3({value:n}){const l={porcelain:["hsl(212 76% 44%)","hsl(210 22% 98%)","hsl(174 42% 61%)"],warm:["hsl(35 88% 56%)","hsl(42 22% 97%)","hsl(160 60% 45%)"],finsight:["hsl(152 38% 32%)","hsl(150 14% 97%)","hsl(142 55% 58%)"],inshield:["hsl(220 25% 12%)","hsl(0 0% 100%)","hsl(195 80% 55%)"],edge:["hsl(265 75% 55%)","hsl(260 12% 98%)","hsl(285 70% 65%)"]},[o,i,u]=l[n];return m.jsxs("div",{className:ce("flex h-6 w-6 shrink-0 overflow-hidden border border-border/60",n==="edge"?"rounded-[10px]":"rounded-[12px]"),children:[m.jsx("div",{className:"h-full w-1/3",style:{background:o}}),m.jsx("div",{className:"h-full w-1/3",style:{background:i}}),m.jsx("div",{className:"h-full w-1/3",style:{background:u}})]})}function m3(){var y,p;const{cluster:n,events:l,sseConnected:o}=h0(),i=$n(),[u,d]=v.useState(!1),f=i.pathname==="/"||/^\/tasks\/[^/]+$/.test(i.pathname),h=v.useMemo(()=>{const x=new Map;for(const g of(n==null?void 0:n.nodes)??[])x.set(g.id,g.name);return x},[n==null?void 0:n.nodes]);return m.jsxs("div",{className:"relative h-full overflow-hidden bg-background text-foreground",children:[m.jsx("div",{className:"mesh-grid pointer-events-none absolute inset-0"}),m.jsxs("div",{className:"relative z-10 flex h-full min-h-0 flex-col",children:[m.jsx("header",{className:"relative z-50 shrink-0 px-2 pb-2 pt-3 sm:px-5 sm:pb-3 sm:pt-4 lg:px-6",children:m.jsxs("div",{className:"dashboard-panel dashboard-panel-muted animate-panel-settle mx-auto flex max-w-[1760px] flex-wrap items-center justify-between gap-2 rounded-[22px] px-3 py-2 sm:gap-3 sm:rounded-[24px] sm:px-4 sm:py-3",children:[m.jsx("div",{className:"flex min-w-0 items-center gap-4",children:m.jsxs(u0,{to:"/",className:"flex items-center gap-3",children:[m.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-[15px] border border-border/70 bg-foreground text-xs font-semibold tracking-[0.24em] text-background shadow-sm sm:h-11 sm:w-11 sm:rounded-[17px] sm:text-sm",children:"M"}),m.jsxs("div",{className:"hidden min-w-0 sm:block",children:[m.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.34em] text-muted-foreground",children:"MESHY"}),m.jsx("div",{className:"truncate text-base font-semibold tracking-tight text-foreground",children:"Workspace"})]})]})}),m.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[m.jsxs("div",{className:"hidden items-center gap-2 rounded-[16px] border border-border/70 bg-background/70 px-3 py-2 text-xs text-muted-foreground shadow-sm sm:flex",children:[m.jsxs("span",{className:"flex items-center gap-2",children:[(n==null?void 0:n.self)&&m.jsx(V0,{status:n.self.status}),m.jsx("span",{className:"font-medium text-foreground",children:((y=n==null?void 0:n.self)==null?void 0:y.name)??"offline"})]}),m.jsx("span",{className:"text-border",children:"/"}),m.jsx("span",{className:"capitalize",children:((p=n==null?void 0:n.self)==null?void 0:p.role)??"node"})]}),m.jsx(J_,{connected:o,events:l,nodes:(n==null?void 0:n.nodes)??[],nodeNameById:h}),f&&m.jsx(Vn,{variant:"ghost",size:"icon",onClick:()=>d(x=>!x),"aria-label":u?"Close terminal":"Open terminal",title:u?"Close terminal":"Open terminal",className:ce("rounded-[16px] border bg-background/70 shadow-sm",u?"border-primary/50 bg-primary/10 text-primary":"border-border/70"),children:m.jsx(S0,{className:"h-4 w-4"})}),m.jsx(__,{}),m.jsx(d3,{})]})]})}),m.jsx("main",{className:ce("min-h-0 flex-1 px-3 pb-3 sm:px-5 lg:px-6",f?"overflow-hidden":"overflow-y-auto"),children:m.jsx("div",{className:"mx-auto h-full min-h-0 max-w-[1760px]",children:m.jsx(rw,{context:{terminalOpen:u,setTerminalOpen:d}})})})]})]})}const $v=v.lazy(async()=>({default:(await Gv(()=>import("./DashboardPage-CLJHILHo.js").then(l=>l.D),__vite__mapDeps([0,1,2,3]))).DashboardPage})),h3=v.lazy(async()=>({default:(await Gv(()=>import("./SharedConversationPage-BrlYNCnU.js"),__vite__mapDeps([4,1]))).SharedConversationPage}));function p3(){return m.jsx(Mw,{children:m.jsx(v.Suspense,{fallback:m.jsx(g3,{}),children:m.jsxs(iw,{children:[m.jsx(Cl,{path:"/shared/tasks/:shareId",element:m.jsx(h3,{})}),m.jsxs(Cl,{element:m.jsx(dE,{children:m.jsx(m3,{})}),children:[m.jsx(Cl,{path:"/",element:m.jsx($v,{})}),m.jsx(Cl,{path:"/nodes",element:m.jsx(Wg,{to:"/",replace:!0})}),m.jsx(Cl,{path:"/tasks",element:m.jsx(Wg,{to:"/",replace:!0})}),m.jsx(Cl,{path:"/tasks/:id",element:m.jsx($v,{})})]})]})})})}function g3(){return m.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background text-sm text-muted-foreground",children:"Loading workspace..."})}function v3(n){return m.jsx(DC,{className:"toaster group",style:{"--normal-bg":"hsl(var(--popover))","--normal-text":"hsl(var(--popover-foreground))","--normal-border":"hsl(var(--border))"},...n})}o2.createRoot(document.getElementById("root")).render(m.jsx(v.StrictMode,{children:m.jsxs(l3,{children:[m.jsx(p3,{}),m.jsx(v3,{})]})}));export{qs as $,jj as A,Vn as B,mf as C,fj as D,LE as E,qE as F,z_ as G,k_ as H,Ox as I,DA as J,mt as K,cj as L,ax as M,Cs as N,Rj as O,uj as P,Ls as Q,nf as R,Nr as S,j_ as T,Us as U,Bs as V,Vs as W,w0 as X,$s as Y,Hs as Z,Ys as _,UC as a,q3 as a$,Gv as a0,w3 as a1,Ny as a2,S5 as a3,z3 as a4,S0 as a5,Bo as a6,kE as a7,k3 as a8,L3 as a9,iE as aA,X3 as aB,T3 as aC,N3 as aD,Ty as aE,C3 as aF,R3 as aG,Qw as aH,__ as aI,P3 as aJ,Q3 as aK,b3 as aL,$n as aM,t0 as aN,y3 as aO,h0 as aP,Ej as aQ,Sj as aR,vj as aS,yj as aT,xj as aU,bj as aV,B3 as aW,hj as aX,O_ as aY,Y3 as aZ,G3 as a_,D3 as aa,aN as ab,PE as ac,wj as ad,b0 as ae,$_ as af,V0 as ag,VE as ah,lC as ai,Aj as aj,M_ as ak,_j as al,pj as am,gj as an,Mx as ao,Cj as ap,Nj as aq,Tj as ar,af as as,K3 as at,Z3 as au,U3 as av,lE as aw,Jw as ax,sj as ay,ij as az,ce as b,$3 as b0,S3 as b1,E3 as b2,x3 as b3,A3 as b4,ej as b5,W3 as b6,J3 as b7,I3 as b8,F3 as b9,tj as ba,qv as bb,_E as bc,lj as bd,aj as be,nj as bf,WE as bg,rj as bh,dj as bi,oj as bj,Ve as c,H0 as d,O3 as e,Pw as f,j3 as g,_3 as h,RE as i,m as j,mj as k,g0 as l,M3 as m,V3 as n,kb as o,Hf as p,zb as q,v as r,Vf as s,ut as t,Qs as u,iN as v,H3 as w,y5 as x,Ey as y,Cy as z};
@@ -1,4 +1,4 @@
1
- import{c as a}from"./index-zL1SJg1p.js";/**
1
+ import{c as a}from"./index-cc0FQMdy.js";/**
2
2
  * @license lucide-react v1.7.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -5,8 +5,8 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Meshy Dashboard</title>
7
7
  <link rel="icon" type="image/svg+xml" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>&#x1F578;</text></svg>" />
8
- <script type="module" crossorigin src="/assets/index-zL1SJg1p.js"></script>
9
- <link rel="stylesheet" crossorigin href="/assets/index-8cqzkk9G.css">
8
+ <script type="module" crossorigin src="/assets/index-cc0FQMdy.js"></script>
9
+ <link rel="stylesheet" crossorigin href="/assets/index-DU7NIRxO.css">
10
10
  </head>
11
11
  <body>
12
12
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meshy-node",
3
- "version": "0.5.10",
3
+ "version": "0.6.2",
4
4
  "private": false,
5
5
  "description": "Standalone Meshy node package with bundled runtime and dashboard assets.",
6
6
  "type": "commonjs",
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "packageName": "meshy-node",
3
- "packageVersion": "0.5.10",
3
+ "packageVersion": "0.6.2",
4
4
  "packages": {
5
5
  "workspace": {
6
6
  "name": "meshy",
7
- "version": "0.5.10"
7
+ "version": "0.6.2"
8
8
  },
9
9
  "node": {
10
10
  "name": "meshy-node",
11
- "version": "0.5.10"
11
+ "version": "0.6.2"
12
12
  },
13
13
  "core": {
14
14
  "name": "@meshy/core",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "repository": {
27
27
  "url": "https://github.com/ai-microsoft/meshy",
28
- "branch": "SupportCopilotCli",
29
- "commit": "e317326"
28
+ "branch": "release05_22",
29
+ "commit": "91674f6"
30
30
  }
31
31
  }