meshy-node 0.9.1 → 0.9.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-CKkLv8I1.js","assets/DashboardShared-BvjPqceV.js","assets/play-nM4_YhiZ.js","assets/MarkdownPreviewFrame-B58EGPZX.js","assets/DashboardPage-i714dDoR.css","assets/SharedConversationPage-aj_wfoD8.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DashboardPage-ByCAcWfg.js","assets/DashboardShared-CnGiDH5q.js","assets/MarkdownPreviewFrame-BL9nhIqs.js","assets/play-NO6WkFJO.js","assets/DashboardPage-i714dDoR.css","assets/SharedConversationPage-CZL95LnN.js"])))=>i.map(i=>d[i]);
2
2
  function M2(n,l){for(var o=0;o<l.length;o++){const i=l[o];if(typeof i!="string"&&!Array.isArray(i)){for(const c in i)if(c!=="default"&&!(c in n)){const d=Object.getOwnPropertyDescriptor(i,c);d&&Object.defineProperty(n,c,d.get?d:{enumerable:!0,get:()=>i[c]})}}}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 c of document.querySelectorAll('link[rel="modulepreload"]'))i(c);new MutationObserver(c=>{for(const d of c)if(d.type==="childList")for(const m of d.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&i(m)}).observe(document,{childList:!0,subtree:!0});function o(c){const d={};return c.integrity&&(d.integrity=c.integrity),c.referrerPolicy&&(d.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?d.credentials="include":c.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function i(c){if(c.ep)return;c.ep=!0;const d=o(c);fetch(c.href,d)}})();function y0(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Rd={exports:{}},Uo={};/**
3
3
  * @license React
4
4
  * react-jsx-runtime.production.js
@@ -313,4 +313,4 @@ You can add a description to the \`${zr}\` by passing a \`${Vx}\` component as a
313
313
 
314
314
  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 \`${zr}\`. 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.
315
315
 
316
- 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},S_=kx,w_=zx,E_=Lx,Xx=Ux,Kx=Bx,Qx=qx,Zx=Px,Ix=$x,Fx=Yx;const wf=S_,Ef=w_,N_=E_,Jx=v.forwardRef(({className:n,...l},o)=>f.jsx(Xx,{className:re("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}));Jx.displayName=Xx.displayName;const Xs=v.forwardRef(({className:n,...l},o)=>f.jsxs(N_,{children:[f.jsx(Jx,{}),f.jsx(Kx,{ref:o,className:re("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 rounded-xl 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})]}));Xs.displayName=Kx.displayName;const Ks=({className:n,...l})=>f.jsx("div",{className:re("flex flex-col space-y-2 text-center sm:text-left",n),...l});Ks.displayName="AlertDialogHeader";const Qs=({className:n,...l})=>f.jsx("div",{className:re("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...l});Qs.displayName="AlertDialogFooter";const Zs=v.forwardRef(({className:n,...l},o)=>f.jsx(Ix,{ref:o,className:re("text-lg font-semibold",n),...l}));Zs.displayName=Ix.displayName;const Is=v.forwardRef(({className:n,...l},o)=>f.jsx(Fx,{ref:o,className:re("text-sm text-muted-foreground",n),...l}));Is.displayName=Fx.displayName;const Fs=v.forwardRef(({className:n,...l},o)=>f.jsx(Qx,{ref:o,className:re(Uf(),n),...l}));Fs.displayName=Qx.displayName;const Js=v.forwardRef(({className:n,...l},o)=>f.jsx(Zx,{ref:o,className:re(Uf({variant:"outline"}),"mt-2 sm:mt-0",n),...l}));Js.displayName=Zx.displayName;const T_={online:"bg-green-500",busy:"bg-yellow-500",offline:"bg-red-500"};function C_({status:n}){return f.jsxs("span",{className:"relative inline-flex h-2.5 w-2.5",children:[n==="online"&&f.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-500 opacity-30"}),f.jsx("span",{className:re("relative inline-flex h-2.5 w-2.5 rounded-full",T_[n])})]})}function A_({role:n,size:l="default"}){return f.jsx(St,{variant:n==="leader"?"default":"secondary",className:re(l==="compact"?"px-1.5 py-0 text-[9px] leading-4":"text-[11px]"),children:n})}const Wx={pending:{variant:"secondary",dotClass:"bg-muted-foreground",className:"border-transparent bg-muted/55 text-muted-foreground"},assigned:{variant:"outline",dotClass:"bg-teal-500",className:"border-teal-500/20 bg-teal-500/8 text-teal-700 dark:text-teal-300"},running:{variant:"outline",dotClass:"bg-amber-500",className:"border-amber-500/22 bg-amber-500/9 text-amber-700 dark:text-amber-300"},completed:{variant:"outline",dotClass:"bg-emerald-500",className:"border-emerald-500/18 bg-emerald-500/8 text-emerald-700 dark:text-emerald-300"},failed:{variant:"destructive",dotClass:"bg-red-200",className:"border-destructive/20 bg-destructive/90 text-destructive-foreground"},cancelled:{variant:"secondary",dotClass:"bg-muted-foreground",className:"border-transparent bg-muted/55 text-muted-foreground"},archived:{variant:"secondary",dotClass:"bg-slate-400",className:"border-transparent bg-muted/50 text-muted-foreground"}};function yM({status:n,size:l="default"}){const o=Wx[n],i=l==="compact"?"gap-0.5 px-1 py-0 text-[8px] leading-3 [&>span]:h-[3px] [&>span]:w-[3px]":"gap-1 px-1.5 py-0 text-[10px] leading-4 [&>span]:h-[5px] [&>span]:w-[5px]";return f.jsxs(St,{variant:o.variant,className:re("rounded-sm font-medium shadow-none",i,o.className),children:[f.jsx("span",{className:re("rounded-full",o.dotClass)}),n]})}function bM({status:n,isNative:l=!1,size:o="default",className:i}){const c=Wx[n],d=[n,l?"native":null].filter(Boolean).join(", "),m=o==="compact"?"h-1.5 w-1.5":"h-2 w-2";return f.jsxs("span",{className:re("inline-flex shrink-0 items-center gap-1",i),title:d,"aria-label":d,children:[f.jsx("span",{className:re("rounded-full",m,c.dotClass),title:n}),l&&f.jsx("span",{className:re("rounded-full bg-sky-500",m),title:"native"})]})}const R_={critical:{variant:"destructive",label:"Critical"},high:{variant:"outline",label:"High"},normal:{variant:"secondary",label:"Normal"},low:{variant:"secondary",label:"Low"}};function xM({priority:n}){const l=R_[n];return f.jsx(St,{variant:l.variant,className:"rounded-sm px-1.5 py-0 text-[10px] leading-4 shadow-none",children:l.label})}function __(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 Rr({label:n,value:l,mono:o=!1}){return f.jsxs("div",{className:"min-w-0 rounded-lg border border-border/60 bg-background/65 px-2.5 py-1.5",children:[f.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:n}),f.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 j_({formatDateTime:n,viewInfo:l}){var i,c,d,m,h,y,p,x;const o=__(l.packages);return f.jsxs(Ps,{value:"about","data-about-layout":"compact",className:"mt-0 space-y-2",children:[f.jsxs(Yn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(qn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Gn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(WE,{className:"h-3.5 w-3.5 text-primary"}),"Repository & runtime"]}),f.jsx(Pn,{className:"text-[10px]",children:"Build source and runtime identity for this node."})]}),f.jsxs(Xn,{className:"space-y-2 px-3 pb-2.5",children:[(i=l.repository)!=null&&i.url?f.jsxs("a",{href:l.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:[f.jsx("span",{className:"truncate font-mono text-[10px]",children:l.repository.url}),f.jsx(yN,{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"})]}):f.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."}),f.jsxs("div",{className:"grid gap-1.5 sm:grid-cols-2 lg:grid-cols-3",children:[f.jsx(Rr,{label:"Branch",value:((c=l.repository)==null?void 0:c.branch)??"Unavailable",mono:!!((d=l.repository)!=null&&d.branch)}),f.jsx(Rr,{label:"Commit",value:((m=l.repository)==null?void 0:m.commit)??"Unavailable",mono:!!((h=l.repository)!=null&&h.commit)}),f.jsx(Rr,{label:"Runtime",value:`${l.packageName??"meshy"} ${l.version}`,mono:!0}),f.jsx(Rr,{label:"Node.js",value:((y=l.runtime)==null?void 0:y.nodeVersion)??"Unavailable",mono:!!((p=l.runtime)!=null&&p.nodeVersion)}),f.jsx(Rr,{label:"PID",value:l.runtime?String(l.runtime.pid):"Unavailable",mono:!!l.runtime}),f.jsx(Rr,{label:"Started",value:n((x=l.runtime)==null?void 0:x.startedAt)})]})]})]}),f.jsxs(Yn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(qn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Gn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(NN,{className:"h-3.5 w-3.5 text-primary"}),"Package versions"]}),f.jsx(Pn,{className:"text-[10px]",children:"Version snapshot for the packages most relevant to this dashboard session."})]}),f.jsx(Xn,{"data-package-layout":"list",className:"space-y-1.5 px-3 pb-2.5",children:o.map(g=>{var w,N;return f.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:[f.jsx("div",{className:"text-[11px] font-medium text-foreground",children:g.label}),f.jsx("div",{className:"min-w-0 truncate text-[10px] text-muted-foreground",children:(w=g.value)==null?void 0:w.name}),f.jsx(St,{variant:"outline",className:"w-fit rounded-sm border-border/70 bg-background/60 font-mono text-[10px]",children:(N=g.value)==null?void 0:N.version})]},g.key)})})]})]})}var pc="Checkbox",[M_]=al(pc),[O_,sm]=M_(pc);function D_(n){const{__scopeCheckbox:l,checked:o,children:i,defaultChecked:c,disabled:d,form:m,name:h,onCheckedChange:y,required:p,value:x="on",internal_do_not_use_render:g}=n,[w,N]=Lr({prop:o,defaultProp:c??!1,onChange:y,caller:pc}),[T,E]=v.useState(null),[C,A]=v.useState(null),j=v.useRef(!1),O=T?!!m||!!T.closest("form"):!0,z={checked:w,disabled:d,setChecked:N,control:T,setControl:E,name:h,form:m,value:x,hasConsumerStoppedPropagationRef:j,required:p,defaultChecked:Ja(c)?!1:c,isFormControl:O,bubbleInput:C,setBubbleInput:A};return f.jsx(O_,{scope:l,...z,children:k_(g)?g(z):i})}var e1="CheckboxTrigger",t1=v.forwardRef(({__scopeCheckbox:n,onKeyDown:l,onClick:o,...i},c)=>{const{control:d,value:m,disabled:h,checked:y,required:p,setControl:x,setChecked:g,hasConsumerStoppedPropagationRef:w,isFormControl:N,bubbleInput:T}=sm(e1,n),E=tt(c,x),C=v.useRef(y);return v.useEffect(()=>{const A=d==null?void 0:d.form;if(A){const j=()=>g(C.current);return A.addEventListener("reset",j),()=>A.removeEventListener("reset",j)}},[d,g]),f.jsx(Ue.button,{type:"button",role:"checkbox","aria-checked":Ja(y)?"mixed":y,"aria-required":p,"data-state":o1(y),"data-disabled":h?"":void 0,disabled:h,value:m,...i,ref:E,onKeyDown:De(l,A=>{A.key==="Enter"&&A.preventDefault()}),onClick:De(o,A=>{g(j=>Ja(j)?!0:!j),T&&N&&(w.current=A.isPropagationStopped(),w.current||A.stopPropagation())})})});t1.displayName=e1;var cm=v.forwardRef((n,l)=>{const{__scopeCheckbox:o,name:i,checked:c,defaultChecked:d,required:m,disabled:h,value:y,onCheckedChange:p,form:x,...g}=n;return f.jsx(D_,{__scopeCheckbox:o,checked:c,defaultChecked:d,disabled:h,required:m,onCheckedChange:p,name:i,form:x,value:y,internal_do_not_use_render:({isFormControl:w})=>f.jsxs(f.Fragment,{children:[f.jsx(t1,{...g,ref:l,__scopeCheckbox:o}),w&&f.jsx(r1,{__scopeCheckbox:o})]})})});cm.displayName=pc;var n1="CheckboxIndicator",a1=v.forwardRef((n,l)=>{const{__scopeCheckbox:o,forceMount:i,...c}=n,d=sm(n1,o);return f.jsx(Yr,{present:i||Ja(d.checked)||d.checked===!0,children:f.jsx(Ue.span,{"data-state":o1(d.checked),"data-disabled":d.disabled?"":void 0,...c,ref:l,style:{pointerEvents:"none",...n.style}})})});a1.displayName=n1;var l1="CheckboxBubbleInput",r1=v.forwardRef(({__scopeCheckbox:n,...l},o)=>{const{control:i,hasConsumerStoppedPropagationRef:c,checked:d,defaultChecked:m,required:h,disabled:y,name:p,value:x,form:g,bubbleInput:w,setBubbleInput:N}=sm(l1,n),T=tt(o,N),E=Cb(d),C=pb(i);v.useEffect(()=>{const j=w;if(!j)return;const O=window.HTMLInputElement.prototype,B=Object.getOwnPropertyDescriptor(O,"checked").set,G=!c.current;if(E!==d&&B){const V=new Event("click",{bubbles:G});j.indeterminate=Ja(d),B.call(j,Ja(d)?!1:d),j.dispatchEvent(V)}},[w,E,d,c]);const A=v.useRef(Ja(d)?!1:d);return f.jsx(Ue.input,{type:"checkbox","aria-hidden":!0,defaultChecked:m??A.current,required:h,disabled:y,name:p,value:x,form:g,...l,tabIndex:-1,ref:T,style:{...l.style,...C,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});r1.displayName=l1;function k_(n){return typeof n=="function"}function Ja(n){return n==="indeterminate"}function o1(n){return Ja(n)?"indeterminate":n?"checked":"unchecked"}const i1=v.forwardRef(({className:n,...l},o)=>f.jsx(cm,{ref:o,className:re("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:f.jsx(a1,{className:re("flex items-center justify-center text-current"),children:f.jsx(Ls,{className:"h-3.5 w-3.5"})})}));i1.displayName=cm.displayName;const um=v.forwardRef(({className:n,type:l,...o},i)=>f.jsx("input",{type:l,className:re("flex h-10 w-full rounded-sm 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}));um.displayName="Input";const o0=["queued","running"];function z_(n){return n.map(l=>`${l.id}:${l.name}`).join("\0")}function L_(n){return n==="claude"||n==="codex"||n==="copilot"}function s1(n){var o;if(n.kind!=="agent.upgrade")return null;const l=(o=n.payload)==null?void 0:o.agent;return L_(l)?`${n.nodeId}:${l}`:null}function U_(n){return n.status==="succeeded"||n.status==="failed"}async function c1(n,l={}){const o=l.getOperation??TE,i=l.pollIntervalMs??2e3,c=l.timeoutMs??24e4,d=Date.now()+c;let m=n;for(;!U_(m)&&Date.now()<d;)await H_(i),m=await o(n.id);return m}async function B_(n,l=CE){const o=new Set(n),i=await Promise.all(o0.map(d=>l({kind:"agent.upgrade",status:d}))),c=new Map;for(const d of i.flat()){if(!o0.includes(d.status)||o.size>0&&!o.has(d.nodeId))continue;const m=s1(d);if(!m)continue;const h=c.get(m);(!h||d.updatedAt>h.updatedAt)&&c.set(m,d)}return c}function H_(n){return new Promise(l=>setTimeout(l,n))}const $_=1500,V_=1e3,Y_=9e4;async function u1(n={}){const l=n.fetchHealth??q_,o=n.initialDelayMs??$_,i=n.pollIntervalMs??V_,c=n.previousPid,d=n.reload??(()=>window.location.reload()),m=n.sleep??P_,h=n.timeoutMs??Y_,y=Date.now()+h;let p=!1;for(o>0&&await m(o);Date.now()<=y;){const x=G_(await l());if(!x.ok){p=!0,await m(i);continue}if(c===void 0||x.pid!==void 0&&x.pid!==c||p)return d(),!0;await m(i)}return!1}async function q_(){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 G_(n){return typeof n=="boolean"?{ok:n}:n}function P_(n){return new Promise(l=>window.setTimeout(l,n))}function X_(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 K_({checkedLabel:n,disableAuthDefault:l,endpoint:o,isLiveLocalNode:i,nodeId:c,nodeName:d,onRefresh:m,pid:h,transportType:y,update:p,workDir:x}){const g=X_(p,i),[w,N]=v.useState(null),[T,E]=v.useState(()=>i0({disableAuthDefault:l,endpoint:o,nodeName:d,transportType:y,workDir:x})),[C,A]=v.useState(!1),[j,O]=v.useState(!1),[z,B]=v.useState(!1);v.useEffect(()=>{E(i0({disableAuthDefault:l,endpoint:o,nodeName:d,transportType:y,workDir:x}))},[l,o,d,y,x]);async function G(){if(!c||C||j)return;const le=p.updateAvailable?"update":"restart",fe=I_(T);if(T.port.trim()&&(fe==null?void 0:fe.port)===void 0){Ge.error("Runtime restart port must be a positive integer");return}const me=fe?{reason:le,startArgs:fe}:{reason:le};A(!0);try{if(i){const M=await Y0(me);N({...M,pid:M.pid??h,status:"accepted"}),Ge.info(`Restarting ${d} from a detached helper. PID ${M.pid??h??"unknown"} will not stay attached to the original terminal window; follow ${M.logPath} for launch output.`),u1({previousPid:M.pid??h}).then(Y=>{Y||(A(!1),Ge.error("Runtime restart was accepted, but the dashboard did not reconnect before the timeout. Refresh the page after the node finishes starting."))}).catch(Y=>{A(!1),Ge.error(Y instanceof Error?Y.message:"Runtime restart recovery failed")});return}const ie=await RE(c,me);N({operationId:ie.id,pid:h,status:ie.status}),Ge.info(`Restart requested on ${d}. Operation ${Id(ie.id)} will hand off to a detached process, so the new runtime will not stay attached to the original terminal window.`);const ue=await c1(ie,{timeoutMs:6e4}),oe=Z_(ue);N({command:oe==null?void 0:oe.command,logPath:oe==null?void 0:oe.logPath,mode:oe==null?void 0:oe.mode,operationId:ue.id,pid:(oe==null?void 0:oe.pid)??h,status:ue.status}),ue.status==="succeeded"?(await(m==null?void 0:m()),Ge.success(`Restart handoff accepted on ${d}. Follow ${(oe==null?void 0:oe.logPath)??"the node restart log"} for launch output.`)):ue.status==="failed"?Ge.error(ue.error??`Restart failed on ${d}`):Ge.info(`Restart operation ${Id(ue.id)} is still ${ue.status}. More details will update after the node reports back.`),A(!1)}catch(ie){A(!1),Ge.error(ie instanceof Error?ie.message:"Runtime restart failed")}}async function V(){if(!(!i||C||j)){O(!0);try{const le=await EE();Ge.info(`Stopping Meshy process ${le.pid}`)}catch(le){O(!1),Ge.error(le instanceof Error?le.message:"Runtime stop failed")}}}const $=C?"restarting":j?"stopping":(w==null?void 0:w.status)??"idle",ne=p.restartMode==="development";return f.jsxs("div",{className:"rounded-xl border border-border/70 bg-background/70 overflow-hidden",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b border-border/50",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(zs,{className:"h-3.5 w-3.5 text-primary shrink-0"}),f.jsxs("div",{children:[f.jsx("div",{className:"text-[11px] font-semibold text-foreground leading-tight",children:"Runtime"}),f.jsx("div",{className:"text-[10px] text-muted-foreground leading-tight",children:ne?"Development launcher":`Latest ${p.latestVersion??"—"}`})]})]}),f.jsx("div",{className:"flex items-center gap-1.5",children:f.jsx(St,{variant:p.updateAvailable?"default":"outline",className:"rounded-full border-border/70 bg-background/60 font-mono text-[10px] px-2 py-0.5",children:ne?"dev":p.updateAvailable?`→ ${p.latestVersion}`:"current"})})]}),f.jsxs("div",{className:"grid grid-cols-2 divide-x divide-border/50 border-b border-border/50",children:[f.jsxs("div",{className:"px-3 py-1.5",children:[f.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:"PID"}),f.jsx("div",{className:"mt-0.5 font-mono text-[11px] text-foreground",children:h??"—"})]}),f.jsxs("div",{className:"px-3 py-1.5",children:[f.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:"Status"}),f.jsx("div",{className:"mt-0.5 text-[11px] text-foreground capitalize",children:$})]})]}),f.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2",children:[f.jsxs("div",{className:"text-[10px] text-muted-foreground",children:["Checked ",n]}),f.jsxs("div",{className:"flex items-center gap-1.5",children:[i&&f.jsxs(wf,{children:[f.jsx(Ef,{asChild:!0,children:f.jsxs(yn,{type:"button",size:"sm",variant:"ghost",disabled:C||j,className:"h-7 rounded-lg px-2 text-[11px] text-muted-foreground hover:text-destructive hover:bg-destructive/10",children:[f.jsx(jN,{className:re("mr-1 h-3.5 w-3.5",j&&"animate-pulse")}),j?"Stopping":"Stop"]})}),f.jsxs(Xs,{className:"max-w-[22rem] rounded-xl gap-2 p-4",children:[f.jsxs(Ks,{className:"space-y-1",children:[f.jsx(Zs,{className:"text-sm",children:"Stop runtime?"}),f.jsx(Is,{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."})]}),f.jsxs(Qs,{className:"gap-1 pt-0 sm:space-x-1",children:[f.jsx(Js,{className:"h-7 rounded-lg px-2 text-[11px]",children:"Cancel"}),f.jsx(Fs,{className:"h-7 rounded-lg px-2 text-[11px] bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>void V(),children:"Stop runtime"})]})]})]}),f.jsxs(wf,{children:[f.jsx(Ef,{asChild:!0,children:f.jsxs(yn,{type:"button",size:"sm",variant:p.updateAvailable?"default":"outline",disabled:!c||C||j,className:"h-7 rounded-lg px-2 text-[11px]",children:[f.jsx(sf,{className:re("mr-1 h-3.5 w-3.5",C&&"animate-spin")}),C?"Restarting…":g]})}),f.jsxs(Xs,{className:"max-w-[28rem] gap-3 rounded-xl p-4",children:[f.jsxs(Ks,{className:"space-y-1",children:[f.jsxs(Zs,{className:"text-sm",children:[g,"?"]}),f.jsxs(Is,{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."]})]}),f.jsx(Q_,{value:T,onChange:E}),f.jsxs(Qs,{className:"gap-1 pt-0 sm:space-x-1",children:[f.jsx(Js,{className:"h-7 rounded-lg px-2 text-[11px]",children:"Cancel"}),f.jsx(Fs,{className:"h-7 rounded-lg px-2 text-[11px]",onClick:()=>void G(),children:g})]})]})]})]})]}),f.jsxs("div",{className:"border-t border-border/50",children:[f.jsxs("button",{type:"button",onClick:()=>B(le=>!le),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:[f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx(F0,{className:"h-3 w-3"}),"Restart details"]}),f.jsx(Zo,{className:re("h-3 w-3 transition-transform duration-150",z&&"rotate-180")})]}),z&&f.jsxs("div",{className:"border-t border-border/50 bg-muted/20 px-3 py-2 space-y-1",children:[f.jsx(_l,{label:"Current PID",value:h===void 0?"—":String(h),mono:h!==void 0}),f.jsx(_l,{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}),f.jsx(_l,{label:"Operation",value:w!=null&&w.operationId?Id(w.operationId):"Local direct request",mono:!!(w!=null&&w.operationId)}),f.jsx(_l,{label:"Status",value:(w==null?void 0:w.status)??(C?"requested":"idle")}),f.jsx(_l,{label:"Launcher",value:(w==null?void 0:w.command)??"Available after restart",mono:!!(w!=null&&w.command)}),f.jsx(_l,{label:"Log",value:(w==null?void 0:w.logPath)??"Available after restart",mono:!!(w!=null&&w.logPath)}),f.jsx(_l,{label:"Terminal",value:"New process is detached from original terminal"})]})]}),p.detail&&f.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 Q_({onChange:n,value:l}){const o=(i,c)=>{n({...l,[i]:c})};return f.jsxs("div",{className:"rounded-lg border border-border/70 bg-muted/30 p-3 space-y-3",children:[f.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-muted-foreground",children:"Startup arguments"}),f.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[f.jsx(Vo,{label:"HTTP port",value:l.port,onChange:i=>o("port",i),inputMode:"numeric"}),f.jsx(Vo,{label:"Node name",value:l.name,onChange:i=>o("name",i)}),f.jsx(Vo,{label:"Join endpoint",value:l.join,onChange:i=>o("join",i),className:"sm:col-span-2"}),f.jsxs("div",{className:"space-y-1",children:[f.jsx("label",{className:"text-[9px] uppercase tracking-[0.14em] text-muted-foreground",children:"Transport"}),f.jsxs(cx,{value:l.transport,onValueChange:i=>o("transport",d1(i)),children:[f.jsx(rm,{className:"h-7 rounded-md border-border/70 bg-background/70 px-2 text-[10px]",children:f.jsx(ux,{placeholder:"Transport"})}),f.jsxs(om,{children:[f.jsx(Or,{className:"py-1 text-[11px]",value:"inherit",children:"current / default"}),f.jsx(Or,{className:"py-1 text-[11px]",value:"direct",children:"direct"}),f.jsx(Or,{className:"py-1 text-[11px]",value:"devtunnel",children:"devtunnel"}),f.jsx(Or,{className:"py-1 text-[11px]",value:"tailscale",children:"tailscale"})]})]})]}),f.jsx(Vo,{label:"Working directory",value:l.workDir,onChange:i=>o("workDir",i)}),f.jsx(Vo,{label:"Config path",value:l.config,onChange:i=>o("config",i),className:"sm:col-span-2"}),f.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:[f.jsx(i1,{className:"h-3.5 w-3.5",checked:l.disableAuth,onCheckedChange:i=>n({...l,disableAuth:i===!0,disableAuthKnown:!0})}),"Disable auth"]})]})]})}function Vo({className:n,inputMode:l,label:o,onChange:i,value:c}){return f.jsxs("label",{className:re("space-y-1",n),children:[f.jsx("span",{className:"text-[9px] uppercase tracking-[0.14em] text-muted-foreground",children:o}),f.jsx(um,{className:"h-7 rounded-md px-2 text-[10px]",inputMode:l,value:c,onChange:d=>i(d.target.value)})]})}function _l({label:n,value:l,mono:o=!1}){return f.jsxs("div",{className:"flex items-start justify-between gap-3 text-[10px]",children:[f.jsx("span",{className:"shrink-0 uppercase tracking-[0.14em] text-muted-foreground",children:n}),f.jsx("span",{className:re("break-all text-right text-foreground",o&&"font-mono"),children:l})]})}function Z_(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 i0(n){return{port:F_(n.endpoint),name:n.nodeName,join:"",transport:d1(n.transportType),workDir:n.workDir??"",config:"",disableAuth:n.disableAuthDefault===!0,disableAuthKnown:n.disableAuthDefault!==void 0}}function I_(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 d1(n){return n==="direct"||n==="devtunnel"||n==="tailscale"?n:"inherit"}function F_(n){if(!n)return"";try{return new URL(n).port||""}catch{return""}}function Id(n){return n.length<=8?n:n.slice(0,8)}function Yo({formatDateTime:n,name:l,status:o,statusVariant:i}){return f.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:[f.jsxs("div",{children:[f.jsx("div",{className:"text-[11px] font-medium text-foreground",children:l}),f.jsx("div",{className:"text-[10px] text-muted-foreground",children:n(o==null?void 0:o.checkedAt)})]}),f.jsxs("div",{className:"flex items-center gap-1.5",children:[typeof(o==null?void 0:o.authenticated)=="boolean"&&f.jsx(St,{variant:o.authenticated?"default":"outline",className:"rounded-full text-[10px] uppercase tracking-[0.14em]",children:o.authenticated?"auth ok":"auth required"}),f.jsx(St,{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 Zt(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 J_(n){const l=Math.max(0,Math.floor(n)),o=Math.floor(l/86400),i=Math.floor(l%86400/3600),c=Math.floor(l%3600/60);return o>0?`${o}d ${i}h`:i>0?`${i}h ${c}m`:`${c}m`}function s0(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 Mr(n){return n==="ok"?"default":n==="missing"||n==="install-failed"||n==="login-failed"?"destructive":n==="not-authenticated"||n==="unsupported-platform"?"outline":"secondary"}function W_(n){return n.available?f.jsxs(St,{className:"gap-1 rounded-full px-2 py-0.5 text-[10px]",children:[f.jsx(Go,{className:"h-3 w-3"}),"Available"]}):f.jsxs(St,{variant:"destructive",className:"gap-1 rounded-full px-2 py-0.5 text-[10px]",children:[f.jsx(fN,{className:"h-3 w-3"}),"Unavailable"]})}function e3(n){return n.update?n.update.updateAvailable?f.jsxs(St,{variant:"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:["Update ",n.update.latestVersion]}):f.jsx(St,{variant:"secondary",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:"Up to date"}):null}function t3(n){return n.available?null:n.metadataStatus??null}function n3(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 a3(n){if(n.error)return n.error;const l=n.result;return(l==null?void 0:l.detail)??null}function et({label:n,value:l,mono:o=!1}){return f.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:[f.jsx("span",{className:"shrink-0 text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:n}),f.jsx("span",{className:re("break-all text-right text-[11px] text-foreground",o&&"font-mono text-[11px]"),children:l})]})}function qo({label:n,value:l,mono:o=!1,className:i}){return f.jsxs("div",{className:re("min-w-0 space-y-0.5",i),children:[f.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:n}),f.jsx("div",{className:re("truncate text-[11px] text-foreground",o&&"font-mono",n==="Path"&&"break-all whitespace-normal"),children:l})]})}function l3({agent:n,nodeName:l,activeOperation:o,onUpgrade:i}){var y,p;const c=((y=n.update)==null?void 0:y.updateAvailable)===!0,d=e3(n),m=!!o,h=t3(n);return f.jsxs("div",{className:"rounded-lg border border-border/60 bg-background/65 px-3 py-2.5 transition-colors hover:bg-background/85",children:[f.jsxs("div",{className:"grid gap-3 lg:grid-cols-[12rem_minmax(0,1fr)_auto] lg:items-start",children:[f.jsxs("div",{className:"min-w-0 space-y-1.5",children:[f.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] font-semibold text-foreground",children:[f.jsx(X0,{className:"h-3.5 w-3.5 shrink-0 text-primary"}),f.jsx("span",{className:"truncate",children:n.label})]}),f.jsxs("div",{className:"truncate text-[10px] text-muted-foreground",children:["Command: ",f.jsx("span",{className:"font-mono text-[10px]",children:n.command})]}),f.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[W_(n),h&&f.jsx(St,{variant:Mr(h),className:"rounded-full px-2 py-0 text-[10px] uppercase tracking-[0.14em]",children:h})]})]}),f.jsxs("div",{className:"grid min-w-0 gap-x-4 gap-y-1.5 sm:grid-cols-2",children:[f.jsx(qo,{label:"Version",value:n.version??"Unavailable",mono:!!n.version}),n.update&&f.jsx(qo,{label:"Latest",value:n.update.latestVersion??"Unavailable",mono:!!n.update.latestVersion}),f.jsx(qo,{label:"Checked",value:Zt(n.checkedAt)}),n.update&&f.jsx(qo,{label:"Update check",value:Zt(n.update.checkedAt)}),f.jsx(qo,{label:"Path",value:n.path??"Not on PATH",mono:!!n.path,className:"sm:col-span-2"})]}),f.jsx("div",{className:"flex items-start justify-start lg:justify-end",children:o?f.jsxs(St,{variant:"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:["Upgrade ",o.status]}):c?f.jsxs(wf,{children:[f.jsx(Ef,{asChild:!0,children:f.jsx("button",{type:"button",disabled:m,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})}),f.jsxs(Xs,{children:[f.jsxs(Ks,{children:[f.jsxs(Zs,{children:["Upgrade ",n.label,"?"]}),f.jsxs(Is,{children:["This runs ",n3(n)," on ",l,". Remote nodes execute the command on the remote machine."]})]}),f.jsxs(Qs,{children:[f.jsx(Js,{children:"Cancel"}),f.jsx(Fs,{onClick:()=>i(n),children:"Upgrade"})]})]})]}):d})]}),((p=n.update)==null?void 0:p.detail)&&f.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&&f.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 r3(n,l){var o;return(o=n==null?void 0:n.nodes)!=null&&o.length?n.nodes:l?[l]:[]}function o3(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 i3(n,l){return n.id===l?`${n.name} (this node)`:`${n.name} (${n.role})`}function s3(n){return n==="claude"?"Claude Code":n==="copilot"?"Copilot CLI":"Codex"}function c3(n){var o;const l=(o=n.payload)==null?void 0:o.agent;return l==="claude"||l==="codex"||l==="copilot"?l:null}function u3({cluster:n,systemInfo:l,sseConnected:o,initialSelectedNodeId:i,onRefresh:c}){var ne,le,fe,me,ie,ue,oe,M,Y,I,de,F,R,P,K,W,te,se,ee,ce;const d=v.useMemo(()=>r3(n,l),[n,l]),[m,h]=v.useState(()=>{var J;return i??(l==null?void 0:l.nodeId)??((J=n==null?void 0:n.self)==null?void 0:J.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,N=d.find(J=>J.id===m)??w,T=N?o3(N,l):null,E=!!(l&&N&&N.id===l.nodeId),C=E||!!(N!=null&&N.settingsSnapshot),A=T==null?void 0:T.runtimeUpdate,j=((ne=T==null?void 0:T.startupRequirements)==null?void 0:ne.components)??(T==null?void 0:T.components)??{},O=v.useMemo(()=>d.map(J=>J.id),[d]),z=O.join("\0"),B=z_(d),G=v.useMemo(()=>new Map(d.map(J=>[J.id,J.name])),[B]);v.useEffect(()=>{i&&O.includes(i)&&h(i)},[i,z]);const V=v.useCallback(async(J,ve)=>{const be=s1(J);if(!be||x.current.has(J.id))return;const Se=c3(J),He=(ve==null?void 0:ve.agentLabel)??(Se?s3(Se):"Agent"),je=(ve==null?void 0:ve.nodeName)??G.get(J.nodeId)??J.nodeId;x.current.add(J.id),p($e=>new Map($e).set(be,J));try{const $e=await c1(J);if($e.status==="succeeded")await(c==null?void 0:c()),g.current.has($e.id)||(Ge.success(`${He} upgrade finished on ${je}`),g.current.add($e.id));else if($e.status==="failed")g.current.has($e.id)||(Ge.error(a3($e)??`${He} upgrade failed`),g.current.add($e.id));else{p(dt=>new Map(dt).set(be,$e)),Ge.info(`${He} upgrade is still ${$e.status} on ${je}`);return}p(dt=>{const Pe=new Map(dt),Lt=Pe.get(be);return(!Lt||Lt.id===$e.id)&&Pe.delete(be),Pe})}catch($e){p(dt=>{const Pe=new Map(dt),Lt=Pe.get(be);return(!Lt||Lt.id===J.id)&&Pe.delete(be),Pe}),Ge.error($e instanceof Error?$e.message:`${He} upgrade failed`)}finally{x.current.delete(J.id)}},[c,G]);v.useEffect(()=>{if(O.length===0)return;let J=!1;async function ve(){let be;try{be=await B_(O)}catch{return}if(!J){p(Se=>{const He=new Map(Se);for(const[je,$e]of be)He.set(je,$e);return He});for(const Se of be.values())V(Se)}}return ve(),()=>{J=!0}},[V,z]);async function $(J){if(N)try{const ve=await AE(N.id,J.id);Ge.info(`${J.label} upgrade started on ${N.name}`),await V(ve,{agentLabel:J.label,nodeName:N.name})}catch(ve){Ge.error(ve instanceof Error?ve.message:`${J.label} upgrade failed`)}}return!N||!T?f.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..."}):f.jsxs("div",{className:"space-y-3",children:[f.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&&f.jsxs(St,{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 ",Zt((le=N.settingsSnapshot)==null?void 0:le.collectedAt)]}),f.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-end md:justify-between",children:[f.jsxs("div",{className:"space-y-2",children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[f.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:[f.jsx(C_,{status:N.status}),f.jsx("span",{className:"font-medium text-foreground",children:N.name})]}),f.jsx(A_,{role:N.role}),f.jsx(St,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:N.transportType??T.transportType??"direct"}),f.jsx(St,{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"})]}),f.jsxs("div",{children:[f.jsx("div",{className:"text-[10px] uppercase tracking-[0.34em] text-muted-foreground",children:"Session"}),f.jsx("h3",{className:"mt-0.5 text-sm font-semibold tracking-tight text-foreground",children:"Node runtime"}),f.jsx("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:"Runtime environment, connectivity, and build metadata."})]}),d.length>1&&f.jsxs("div",{className:"w-48 space-y-1.5",children:[f.jsx("div",{className:"text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:"Inspect node"}),f.jsxs(cx,{value:N.id,onValueChange:h,children:[f.jsx(rm,{className:"h-7 rounded-lg border-border/70 bg-background/70 text-[11px]",children:f.jsx(ux,{placeholder:"Choose a node"})}),f.jsx(om,{className:"settings-node-select-content rounded-lg text-[10px] leading-4",children:d.map(J=>f.jsx(Or,{value:J.id,className:"settings-node-select-item py-1 pl-6 pr-2 text-[10px] leading-4 [&>span]:left-1.5 [&_svg]:h-3 [&_svg]:w-3",children:i3(J,l==null?void 0:l.nodeId)},J.id))})]})]})]}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsxs(St,{variant:o?"default":"outline",className:"gap-1 rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:[f.jsx(ON,{className:"h-3 w-3"}),o?"Live link":"Reconnecting"]}),f.jsxs(St,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:["Uptime ",J_(T.uptime)]})]})]})]}),!C&&f.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."}),f.jsxs(d_,{defaultValue:"session",className:"space-y-2",children:[f.jsxs(Ox,{className:"h-auto flex-wrap rounded-xl border border-border/60 bg-muted/40 p-0.5",children:[f.jsx(Os,{value:"session",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"Session"}),f.jsx(Os,{value:"access",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"Access"}),f.jsx(Os,{value:"about",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"About"})]}),f.jsxs(Ps,{value:"session",className:"mt-0 grid gap-2 xl:grid-cols-[1.15fr_0.85fr]",children:[f.jsxs(Yn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(qn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Gn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(Z0,{className:"h-3.5 w-3.5 text-primary"}),"Selected node"]}),f.jsx(Pn,{className:"text-[10px]",children:"Cluster role, identity, and node-scoped runtime state."})]}),f.jsxs(Xn,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(et,{label:"Node ID",value:T.nodeId,mono:!0}),f.jsx(et,{label:"Status",value:N.status}),f.jsx(et,{label:"Role",value:N.role}),f.jsx(et,{label:"Endpoint",value:N.endpoint,mono:!0}),f.jsx(et,{label:"Joined",value:Zt(N.joinedAt)}),f.jsx(et,{label:"Heartbeat",value:Zt(N.lastHeartbeat)}),f.jsx(et,{label:"Capabilities",value:N.capabilities.length>0?N.capabilities.join(", "):"None"})]})]}),f.jsxs(Yn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(qn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Gn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(gN,{className:"h-3.5 w-3.5 text-primary"}),"OS info"]}),f.jsx(Pn,{className:"text-[10px]",children:"Host and resource details reported by the current process."})]}),f.jsxs(Xn,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(et,{label:"Host",value:((fe=T.os)==null?void 0:fe.hostname)??"Unavailable"}),f.jsx(et,{label:"Platform",value:T.os?`${T.os.platform} ${T.os.release}`:"Unavailable"}),f.jsx(et,{label:"Arch",value:((me=T.os)==null?void 0:me.arch)??"Unavailable"}),f.jsx(et,{label:"CPU",value:((ie=T.os)==null?void 0:ie.cpuModel)??"Unavailable"}),f.jsx(et,{label:"Cores",value:String(((ue=T.os)==null?void 0:ue.cpuCount)??"Unavailable")}),f.jsx(et,{label:"Memory",value:T.os?`${s0(T.os.freeMemoryBytes)} free / ${s0(T.os.totalMemoryBytes)} total`:"Unavailable"})]})]}),A&&f.jsx("div",{className:"xl:col-span-2",children:f.jsx(K_,{checkedLabel:Zt(A.checkedAt),disableAuthDefault:((oe=T.auth)==null?void 0:oe.enabled)===void 0?void 0:T.auth.enabled===!1,endpoint:N.endpoint,isLiveLocalNode:E,nodeId:N.id,nodeName:N.name,onRefresh:c,pid:(M=T.runtime)==null?void 0:M.pid,transportType:N.transportType,update:A,workDir:((Y=T.runtime)==null?void 0:Y.workDir)??N.workDir})}),f.jsxs(Yn,{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:[f.jsxs(qn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Gn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(X0,{className:"h-3.5 w-3.5 text-primary"}),"Available agents"]}),f.jsx(Pn,{className:"text-[10px]",children:E?"Live command availability for runtime agents on this node.":"Most recent agent availability snapshot synced from this node."})]}),f.jsx(Xn,{"data-agent-layout":"list",className:"space-y-1.5 px-3 pb-2.5",children:(T.agents??[]).map(J=>f.jsx(l3,{agent:J,nodeName:N.name,activeOperation:y.get(`${N.id}:${J.id}`),onUpgrade:$},J.id))})]})]}),f.jsxs(Ps,{value:"access",className:"mt-0 grid gap-2 xl:grid-cols-2",children:[f.jsxs(Yn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(qn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Gn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(nN,{className:"h-3.5 w-3.5 text-primary"}),"Access surface"]}),f.jsx(Pn,{className:"text-[10px]",children:"How this node is exposed to the dashboard and other peers."})]}),f.jsxs(Xn,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(et,{label:"Transport",value:N.transportType??T.transportType??"direct"}),f.jsx(et,{label:"Node URL",value:N.endpoint,mono:!0}),f.jsx(et,{label:"Node tunnel",value:N.devtunnelEndpoint??"Disabled",mono:!!N.devtunnelEndpoint}),f.jsx(et,{label:"Dashboard URL",value:N.dashboardOrigin??T.localDashboardOrigin??"Unavailable",mono:!!(N.dashboardOrigin||T.localDashboardOrigin)}),f.jsx(et,{label:"Local dashboard",value:T.localDashboardOrigin??"Unavailable",mono:!!T.localDashboardOrigin})]})]}),f.jsxs(Yn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(qn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Gn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(VN,{className:"h-3.5 w-3.5 text-primary"}),"Auth"]}),f.jsx(Pn,{className:"text-[10px]",children:"Current bearer-auth and trusted access posture."})]}),f.jsxs(Xn,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(et,{label:"Enabled",value:(I=T.auth)!=null&&I.enabled?"Yes":"No"}),f.jsx(et,{label:"Same tenant",value:(de=T.auth)!=null&&de.allowSameTenant?"Allowed":"Off"}),f.jsx(et,{label:"Allowed users",value:(F=T.auth)!=null&&F.allowedUsers.length?T.auth.allowedUsers.join(", "):"None"})]})]}),f.jsxs(Yn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(qn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Gn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(xN,{className:"h-3.5 w-3.5 text-primary"}),"Paths"]}),f.jsx(Pn,{className:"text-[10px]",children:"Workspace and runtime paths currently used by this node."})]}),f.jsxs(Xn,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(et,{label:"Work dir",value:((R=T.runtime)==null?void 0:R.workDir)??T.workDir??"Unavailable",mono:!!(((P=T.runtime)==null?void 0:P.workDir)??T.workDir)}),f.jsx(et,{label:"Storage",value:((K=T.runtime)==null?void 0:K.storagePath)??"Unavailable",mono:!!((W=T.runtime)!=null&&W.storagePath)}),f.jsx(et,{label:"Process cwd",value:((te=T.runtime)==null?void 0:te.cwd)??"Unavailable",mono:!!((se=T.runtime)!=null&&se.cwd)}),f.jsx(et,{label:"Started",value:Zt((ee=T.runtime)==null?void 0:ee.startedAt)}),f.jsx(et,{label:"PID",value:T.runtime?String(T.runtime.pid):"Unavailable",mono:!!T.runtime})]})]}),f.jsxs(Yn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(qn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Gn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(zs,{className:"h-3.5 w-3.5 text-primary"}),"Startup checks"]}),f.jsx(Pn,{className:"text-[10px]",children:"Dependency preflight snapshot persisted during node startup."})]}),f.jsxs(Xn,{className:"space-y-3 px-3 pb-2.5",children:[f.jsxs("div",{className:"rounded-xl border border-border/60 bg-background/70 px-3 py-2",children:[f.jsx("div",{className:"text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:"Last checked"}),f.jsx("div",{className:"mt-0.5 text-[11px] text-foreground",children:Zt((ce=T.startupRequirements)==null?void 0:ce.lastCheckedAt)})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(Yo,{formatDateTime:Zt,name:"Azure CLI",status:j.az,statusVariant:Mr}),f.jsx(Yo,{formatDateTime:Zt,name:"DevTunnel",status:j.devtunnel,statusVariant:Mr}),f.jsx(Yo,{formatDateTime:Zt,name:"Claude Code",status:j.claude,statusVariant:Mr}),f.jsx(Yo,{formatDateTime:Zt,name:"Codex",status:j.codex,statusVariant:Mr}),f.jsx(Yo,{formatDateTime:Zt,name:"Copilot CLI",status:j.copilot,statusVariant:Mr})]})]})]})]}),f.jsx(j_,{formatDateTime:Zt,viewInfo:T})]})]})}function d3({initialSelectedNodeId:n,open:l,onOpenChange:o,showTrigger:i=!0}={}){const{cluster:c,systemInfo:d,sseConnected:m,refresh:h}=G0();return f.jsx(eA,{open:l,onOpenChange:o,showTrigger:i,children:f.jsx(u3,{cluster:c,systemInfo:d,sseConnected:m,initialSelectedNodeId:n,onRefresh:h})})}const SM="codex",wM="bypass",f3=[{value:"codex",label:"Codex",supportsFollowUp:!0},{value:"claudecode",label:"Claude Code",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"}],EM=[{value:"bypass",label:"Bypass"},{value:"plan",label:"Plan"},{value:"edit",label:"Edit"},{value:"dangerous",label:"Dangerous"}],NM=new Set(f3.filter(n=>n.supportsFollowUp).map(n=>n.value)),TM=[{value:"active",label:"Active"},{value:"running",label:"Running"},{value:"waiting",label:"Waiting"},{value:"closed",label:"Closed"},{value:"shared",label:"Shared"},{value:"archived",label:"Archived"}],CM=[{value:"all",label:"All task types"},{value:"native",label:"Native sessions"},{value:"meshy",label:"Meshy chats"}],m3=new Set(["pending","assigned"]),h3=new Set(["running"]),p3=new Set(["completed","failed","cancelled"]),AM=10;function RM(n,l){switch(l){case"running":return h3.has(n.status);case"waiting":return m3.has(n.status);case"closed":return p3.has(n.status);case"shared":return!!n.activeShare;case"archived":return n.status==="archived";case"active":default:return n.status!=="archived"}}function _M(n,l){if(l==="all")return!0;const o=n.conversationKind==="nativeSession";return l==="native"?o:!o}function jM(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 g3(n,l,o){if(!n)return"unassigned";const i=l==null?void 0:l.find(c=>c.id===n);return(i==null?void 0:i.name)??o??n.slice(0,8)}function MM(n,l,o){return g3(n,l,o).toLowerCase()}function OM(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 DM(n,l){return[...n].sort((o,i)=>o.id===l?-1:i.id===l?1:o.name.localeCompare(i.name))}function kM(n){if(!n||typeof n!="object")return null;const l=n,o=l.createMode,i=o==="chat"||o==="native"?o:void 0,c=l.createDefaults,d=c&&typeof c=="object"&&!Array.isArray(c)?c:null,m=d?{assignTo:typeof d.assignTo=="string"||d.assignTo===null?d.assignTo:void 0,project:typeof d.project=="string"||d.project===null?d.project:void 0}: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,createDefaults:m}}function zM(n){return n==="default workspace"?n:n.replace(/\\/g,"/").split("/").filter(Boolean).at(-1)??n}function LM(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 UM(n){return new Date(n).toLocaleString()}function BM(n){const l=Math.floor(n/1e3),o=Math.floor(l/3600),i=Math.floor(l%3600/60),c=l%60;return`${String(o).padStart(2,"0")}:${String(i).padStart(2,"0")}:${String(c).padStart(2,"0")}`}async function v3(n,l="Copied to clipboard"){var o,i,c;try{if((i=(o=globalThis.navigator)==null?void 0:o.clipboard)!=null&&i.writeText)return await globalThis.navigator.clipboard.writeText(n),Ge.success(l),!0;const d=globalThis.document,m=(c=d==null?void 0:d.execCommand)==null?void 0:c.bind(d);if(!(d!=null&&d.body)||typeof d.createElement!="function"||typeof m!="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=m("copy");if(d.body.removeChild(h),p==null||p.focus(),!x)throw new Error("Clipboard access is unavailable");return Ge.success(l),!0}catch(d){return Ge.error(d instanceof Error?d.message:"Failed to copy"),!1}}const y3="default workspace";function Ds(n){const l=n.replace(/\\/g,"/");return l==="/"||/^[A-Za-z]:\/$/.test(l)?l:l.replace(/\/+$/g,"")||l}function b3(n){const l=n.replace(/\\/g,"/");return l.startsWith("/")||l.startsWith("//")||/^[A-Za-z]:\//.test(l)}function x3(n,l){const o=Ds(n),i=l.replace(/\\/g,"/").replace(/^\/+|\/+$/g,"");return!i||i==="."?o:o==="/"||/^[A-Za-z]:\/$/.test(o)?`${o}${i}`:`${o}/${i}`}function S3(n,l){var d,m,h;const o=(d=n.effectiveProjectPath)==null?void 0:d.trim();if(o)return Ds(o);const i=(m=n.project)==null?void 0:m.trim();if(!i)return y3;if(b3(i)||!n.assignedTo)return Ds(i);const c=(h=l==null?void 0:l.get(n.assignedTo))==null?void 0:h.trim();return c?x3(c,i):Ds(i)}function HM(n,l,o,i){const c=new Map;for(const m of n){const h=m.assignedTo??null,y=h??"__unassigned__",p=h?l.get(h)??m.assignedNodeName??h.slice(0,8):"Unassigned",x=S3(m,i);c.has(y)||c.set(y,{nodeId:h,nodeName:p,dirMap:new Map});const g=c.get(y);g.dirMap.has(x)||g.dirMap.set(x,[]),g.dirMap.get(x).push(m)}const d=Array.from(c.values()).map(({nodeId:m,nodeName:h,dirMap:y})=>{const p=Array.from(y.entries()).map(([x,g])=>({path:x,tasks:g})).sort((x,g)=>g.tasks.length-x.tasks.length||x.path.localeCompare(g.path));return{nodeId:m,nodeName:h,dirs:p}});return d.sort((m,h)=>{if(o){if(m.nodeId===o)return-1;if(h.nodeId===o)return 1}return m.nodeId===null?1:h.nodeId===null?-1:m.nodeName.localeCompare(h.nodeName)}),d}const w3={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"},E3={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 N3(n){return n.split(".")[0]??"unknown"}function T3(n){return new Date(n).toLocaleTimeString("en-US",{hour12:!1})}function _r(n,l){return(l==null?void 0:l.get(n))??n}function f1(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`${_r(o.nodeId,l)} left (${o.reason})`;case"node.status":return`${_r(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 ${_r(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 ${_r(i==null?void 0:i.nodeId,l)}`;case"transport.changed":return`${_r(o.nodeId,l)} transport switched to ${o.transportType}`;case"task.created":return`"${o.title}" created`;case"task.assigned":return`task assigned to ${_r(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 C3(n){return JSON.stringify(n,null,2)}function A3({events:n,maxHeight:l="400px",nodeNameById:o,onDismiss:i,density:c="default"}){if(n.length===0)return null;const d=c==="compact";return f.jsx("div",{className:"overflow-y-auto pr-1",style:{maxHeight:l},children:f.jsx("div",{className:"space-y-1.5",children:n.map(m=>{const h=N3(m.type);return f.jsx("div",{className:re("transition-colors hover:bg-muted/30",d?"rounded-sm px-1 py-0.5":"rounded-lg px-1.5 py-1"),children:f.jsxs("div",{className:"space-y-1",children:[f.jsxs("div",{className:"flex items-start justify-between gap-1.5",children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[f.jsx("div",{className:re("font-mono text-muted-foreground",d?"text-[8px]":"text-[9px]"),children:T3(m.timestamp)}),d?f.jsx("span",{className:re("max-w-[8.5rem] truncate text-[7px] font-medium uppercase tracking-[0.08em] text-muted-foreground/70",E3[h]),children:m.type}):f.jsx(St,{variant:"outline",className:re("w-fit text-[9px] font-medium uppercase tracking-[0.14em] px-1.5 py-0",w3[h]),children:m.type})]}),f.jsxs("div",{className:re("flex shrink-0 items-center",d?"gap-px":"gap-0.5"),children:[f.jsx(yn,{type:"button",variant:"ghost",size:"icon",className:re("rounded-sm text-muted-foreground hover:text-foreground",d?"h-3.5 w-3.5 p-0 opacity-65 hover:bg-muted/40 hover:opacity-100 [&_svg]:size-2.5":"h-5 w-5"),onClick:()=>void v3(C3(m),"Event copied"),"aria-label":`Copy ${m.type} event`,title:"Copy event",children:f.jsx(hN,{className:d?"h-2.5 w-2.5":"h-3 w-3"})}),i&&f.jsx(yn,{type:"button",variant:"ghost",size:"icon",className:re("rounded-sm text-muted-foreground hover:text-foreground",d?"h-3.5 w-3.5 p-0 opacity-65 hover:bg-muted/40 hover:opacity-100 [&_svg]:size-2.5":"h-5 w-5"),onClick:()=>i(m.id),"aria-label":`Dismiss ${m.type} event`,title:"Dismiss event",children:f.jsx(J0,{className:d?"h-2.5 w-2.5":"h-3 w-3"})})]})]}),f.jsx("div",{className:"text-[9px] leading-snug text-foreground/85",children:f1(m,o)})]})},m.id)})})})}const R3=["node.","election.","transport."],_3="cluster.state";function j3(n){return n.type==="node.status"?!1:R3.some(l=>n.type.startsWith(l))}function M3(n){return new Date(n).toLocaleTimeString("en-US",{hour12:!1})}function O3(n,l){return n?{time:M3(n.timestamp),text:f1(n,l)}:null}function D3(n){return n.transportType==="devtunnel"||!!n.devtunnelEndpoint}function k3(n){if(n.length===0)return"No node tunnel";const l=n.filter(c=>c.status==="offline").length;if(l>0)return`${l} offline`;const o=n.filter(c=>{var d;return((d=c.devtunnelHealth)==null?void 0:d.status)==="failed"}).length;if(o>0)return`${o} failed`;const i=n.filter(c=>{var d;return c.status!=="offline"&&((d=c.devtunnelHealth)==null?void 0:d.status)!=="healthy"}).length;return i>0?`${i} checking`:"Healthy"}function z3(n,l){var c;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=((c=n.devtunnelHealth)==null?void 0:c.status)??"checking";return{label:o,status:i}}function L3(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 U3(n,l){return{label:(l==null?void 0:l.get(n.id))??n.name??n.id,status:n.status}}function B3({connected:n,events:l,nodes:o=[],currentNode:i=null,nodeNameById:c,desktopUpdate:d=null,defaultOpen:m=!1,defaultActionMenuOpen:h=!1,onDesktopUpdate:y,onDesktopRestart:p,onReload:x,onRestart:g}){const[w,N]=v.useState(m),[T,E]=v.useState(h),[C,A]=v.useState(!0),[j,O]=v.useState(new Set),[z,B]=v.useState(!1),[G,V]=v.useState(!1),$=v.useRef(null),ne=v.useRef(null),le=v.useMemo(()=>l.filter(Ne=>j3(Ne)&&!j.has(Ne.id)),[l,j]),fe=v.useMemo(()=>l.find(Ne=>Ne.type===_3)??le[0],[l,le]),me=v.useMemo(()=>O3(fe,c),[fe,c]),ie=v.useMemo(()=>{const Ne=new Map(o.map(Xe=>[Xe.id,Xe]));return i&&Ne.set(i.id,i),Array.from(Ne.values())},[i,o]),ue=v.useMemo(()=>ie.filter(D3),[ie]),oe=ue.some(Ne=>{var Xe;return Ne.status==="offline"||((Xe=Ne.devtunnelHealth)==null?void 0:Xe.status)==="failed"}),M=ie.some(Ne=>Ne.status==="offline"),Y=ie.some(Ne=>Ne.status==="busy"),I=ie.length>0,de=(i==null?void 0:i.name)??"offline",F=(i==null?void 0:i.role)==="leader"?"Leader":(i==null?void 0:i.role)==="follower"?"Follower":"Node",R=d!==null,P=!!(R&&(d!=null&&d.updateAvailable)&&d.latestVersion),K=(d==null?void 0:d.latestVersion)??null,W=!!(R&&!P&&!K&&(d!=null&&d.detail)),te=z?"Relaunching runtime...":"Relaunch to apply update",se=G?"Downloading and installing desktop update...":P&&K?`Available version ${K}`:W?(d==null?void 0:d.detail)??"Desktop update unavailable":"Desktop is current",ee=!!x,ce=!!(R&&p),J=ee||ce,ve=R||!!g,be=R||!!g||ee,Se=ve?R?"Update":"Relaunch":"Reload",He=ve?R?se:te:"Reload dashboard page",je=ve?R?G:z:!1,$e=ve?R?je||!P||!y:je:!1,dt=R?P&&K?`Install desktop update ${K}`:W?"Desktop update unavailable":"Desktop is current":ve?z?"Relaunching runtime":"Relaunch runtime":"Reload dashboard page";function Pe(){ne.current&&(clearTimeout(ne.current),ne.current=null)}function Lt(){Pe(),N(!0)}function ht(){Pe(),ne.current=setTimeout(()=>{N(!1),ne.current=null},180)}function ol(){Pe()}function il(){Pe(),E(!1),N(!1)}async function Tt(){if(!(!g||z)){B(!0);try{await g()}finally{B(!1)}}}async function jn(){if(!(!P||!y||G)){V(!0);try{await y()}finally{V(!1)}}}async function Ct(){if(!(!p||z)){E(!1),B(!0);try{await p()}finally{B(!1)}}}async function Ul(){if(!ve){await Mn();return}if(R){await jn();return}await Tt()}async function Mn(){x&&(E(!1),await x())}return v.useEffect(()=>()=>{Pe()},[]),v.useEffect(()=>{O(Ne=>{if(Ne.size===0)return Ne;const Xe=new Set(l.map(st=>st.id)),We=new Set(Array.from(Ne).filter(st=>Xe.has(st)));return We.size===Ne.size?Ne:We})},[l]),v.useEffect(()=>{w||E(!1)},[w]),v.useEffect(()=>{if(!w)return;const Ne=We=>{var st;(st=$.current)!=null&&st.contains(We.target)||(Pe(),E(!1),N(!1))},Xe=We=>{We.key==="Escape"&&(Pe(),E(!1),N(!1))};return document.addEventListener("pointerdown",Ne),document.addEventListener("keydown",Xe),()=>{document.removeEventListener("pointerdown",Ne),document.removeEventListener("keydown",Xe)}},[w]),f.jsxs("div",{ref:$,className:"relative",children:[f.jsxs("button",{type:"button","aria-label":n?"Cluster link connected":"Cluster link reconnecting","aria-expanded":w,"aria-haspopup":"dialog",onClick:()=>N(Ne=>!Ne),onMouseEnter:Lt,onMouseLeave:ht,className:re("flex h-8 max-w-[18rem] items-center gap-1.5 rounded-sm px-2 text-[10px] transition-all sm:gap-2 sm:px-2.5 sm:text-[11px]",n?"bg-muted/40 text-muted-foreground hover:bg-muted/60 hover:text-foreground":"bg-destructive/8 text-destructive hover:bg-destructive/12",w&&(n?"bg-muted/60 text-foreground":"bg-destructive/12")),title:n?"Cluster link connected":"Cluster link reconnecting",children:[f.jsxs("span",{className:re("relative flex h-2 w-2 shrink-0"),children:[n&&f.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-60"}),f.jsx("span",{className:re("relative inline-flex h-2 w-2 rounded-full",n?"bg-emerald-500":"bg-destructive")})]}),f.jsxs("span",{className:"hidden min-w-0 items-center gap-2 sm:flex",children:[f.jsx("span",{className:"truncate font-medium text-foreground",children:de}),f.jsx("span",{className:re("shrink-0 rounded border px-1 py-px text-[8px] font-semibold uppercase tracking-[0.1em]",n?"border-emerald-500/25 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300":"border-destructive/30 bg-destructive/10 text-destructive"),children:F})]})]}),w&&f.jsxs("div",{role:"dialog","aria-label":"Live link connection events",onMouseEnter:ol,onMouseLeave:il,className:"absolute right-0 top-[calc(100%+0.4rem)] z-50 w-[18rem] max-w-[calc(100vw-1.5rem)] overflow-hidden rounded-lg 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:[f.jsx("div",{className:"border-b border-border/60 bg-muted/25 px-2.5 py-1.5",children:f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsxs("div",{className:"flex items-center gap-1.5",children:[n?f.jsx(zs,{className:"h-3 w-3 text-emerald-500"}):f.jsx(KN,{className:"h-3 w-3 text-destructive"}),f.jsx("span",{className:"text-[10px] font-semibold text-foreground",children:"Live link"}),f.jsx("span",{className:"text-[9px] text-muted-foreground",children:n?"· SSE connected":"· reconnecting"})]}),f.jsx("div",{className:re("rounded-sm 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"})]})}),f.jsxs("div",{className:"grid grid-cols-2 border-b border-border/60",children:[f.jsxs("div",{className:"border-r border-border/60 px-2.5 py-1.5",children:[f.jsx("div",{className:"text-[8px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"Events"}),f.jsx("div",{className:"mt-0.5 text-base font-semibold tracking-tight text-foreground",children:le.length})]}),f.jsxs("div",{className:"min-w-0 px-2.5 py-1.5",children:[f.jsx("div",{className:"text-[8px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"Latest"}),me?f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"mt-0.5 truncate text-[9px] leading-snug text-foreground/80",children:me.text}),f.jsx("div",{className:"font-mono text-[8px] text-muted-foreground/60",children:me.time})]}):f.jsx("div",{className:"mt-0.5 text-[8px] text-muted-foreground/50",children:"—"})]})]}),f.jsxs("div",{className:"border-b border-border/60 px-2.5 py-1.5",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[M?f.jsx(gs,{className:"h-3 w-3 shrink-0 text-destructive"}):Y?f.jsx(zs,{className:"h-3 w-3 shrink-0 text-amber-500"}):f.jsx(Go,{className:re("h-3 w-3 shrink-0",I?"text-emerald-500":"text-muted-foreground")}),f.jsx("span",{className:"text-[9px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"Node health"})]}),f.jsx("span",{className:re("shrink-0 rounded-sm border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.1em]",M?"border-destructive/30 bg-destructive/10 text-destructive":Y?"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300":I?"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:L3(ie)})]}),ie.length>0&&f.jsx("div",{className:"mt-1.5 flex flex-col gap-0.5",children:ie.map(Ne=>{const{label:Xe,status:We}=U3(Ne,c),st=We==="offline",On=We==="busy";return f.jsxs("div",{"aria-label":`${Xe} ${We}`,className:re("flex items-center justify-between gap-2 rounded-sm px-2 py-0.5",st?"bg-destructive/6":On?"bg-amber-500/6":"bg-emerald-500/5"),title:`${Xe} ${We}`,children:[f.jsx("span",{className:"truncate text-[9px] text-foreground/70",children:Xe}),st?f.jsx(gs,{className:"h-3 w-3 shrink-0 text-destructive"}):On?f.jsx(Ev,{className:"h-3 w-3 shrink-0 text-amber-500"}):f.jsx(Go,{className:"h-3 w-3 shrink-0 text-emerald-500"})]},Ne.id)})})]}),ue.length>0&&f.jsxs("div",{className:"border-b border-border/60 px-2.5 py-1.5",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[oe?f.jsx(gs,{className:"h-3 w-3 shrink-0 text-destructive"}):f.jsx(Go,{className:"h-3 w-3 shrink-0 text-emerald-500"}),f.jsx("span",{className:"text-[9px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"DevTunnel"})]}),f.jsx("span",{className:re("shrink-0 rounded-sm border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.1em]",oe?"border-destructive/30 bg-destructive/10 text-destructive":"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300"),children:k3(ue)})]}),f.jsx("div",{className:"mt-1.5 flex flex-col gap-0.5",children:ue.map(Ne=>{var kn;const{label:Xe,status:We}=z3(Ne,c),st=We==="failed"||We==="offline",On=We!=="healthy"&&We!=="failed"&&We!=="offline",Dn=(kn=Ne.devtunnelHealth)!=null&&kn.reason?`${Xe} ${We}: ${Ne.devtunnelHealth.reason}`:`${Xe} ${We}`;return f.jsxs("div",{"aria-label":`${Xe} ${We}`,className:re("flex items-center justify-between gap-2 rounded-sm px-2 py-0.5",st?"bg-destructive/6":On?"bg-muted/30":"bg-emerald-500/5"),title:Dn,children:[f.jsx("span",{className:"truncate text-[9px] text-foreground/70",children:Xe}),st?f.jsx(gs,{className:"h-3 w-3 shrink-0 text-destructive"}):On?f.jsx(Ev,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):f.jsx(Go,{className:"h-3 w-3 shrink-0 text-emerald-500"})]},Ne.id)})})]}),f.jsxs("div",{children:[f.jsxs("button",{type:"button",onClick:()=>A(Ne=>!Ne),className:"flex w-full items-center justify-between px-2.5 py-1.5 text-left hover:bg-muted/30",children:[f.jsxs("span",{className:"text-[8px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:["Notifications ",le.length>0&&`(${le.length})`]}),C?f.jsx(Zo,{className:"h-3 w-3 text-muted-foreground"}):f.jsx(of,{className:"h-3 w-3 text-muted-foreground"})]}),C&&f.jsx("div",{className:"px-2 pb-2",children:f.jsx(A3,{events:le,maxHeight:"12rem",density:"compact",emptyTitle:"No connection events yet",emptyDescription:"Node, election, and system events will appear here.",nodeNameById:c,onDismiss:Ne=>O(Xe=>new Set(Xe).add(Ne))})})]}),R&&(d==null?void 0:d.detail)&&f.jsxs("div",{className:"flex items-center gap-1.5 border-t border-border/60 px-2.5 py-1 text-[8px] text-muted-foreground",children:[f.jsx("span",{className:"shrink-0 font-medium uppercase tracking-[0.12em]",children:"Desktop update"}),f.jsx("span",{className:"truncate",title:d.detail,children:d.detail})]}),f.jsxs("div",{className:"flex items-center justify-between gap-1 border-t border-border/60 px-2.5 py-1",children:[f.jsx("div",{children:be&&f.jsxs("div",{className:"group/restart relative flex items-center",children:[f.jsxs("div",{className:"flex items-center overflow-hidden rounded-sm border border-border/50",children:[f.jsxs(yn,{type:"button",variant:"ghost",size:"sm",className:re("h-5 rounded-none border-0 px-1.5 text-[9px] font-medium hover:text-foreground [&_svg]:size-2.5",P?"bg-primary/12 text-primary hover:bg-primary/18":"bg-background/45 text-muted-foreground hover:bg-emerald-500/10"),onClick:()=>void Ul(),disabled:$e,"aria-label":dt,"aria-describedby":"live-link-restart-hint",title:He,children:[f.jsx(Nv,{className:re("h-2.5 w-2.5",je&&"animate-pulse")}),f.jsx("span",{children:Se})]}),J&&f.jsx(yn,{type:"button",variant:"ghost",size:"sm",className:re("h-5 rounded-none border-l border-border/50 px-1 text-[9px] hover:text-foreground [&_svg]:size-2.5",P?"bg-primary/12 text-primary hover:bg-primary/18":"bg-background/45 text-muted-foreground hover:bg-emerald-500/10"),onClick:()=>E(Ne=>!Ne),"aria-label":"Open live link actions","aria-expanded":T,title:"Live link actions",children:f.jsx(Zo,{className:"h-2.5 w-2.5"})})]}),J&&T&&f.jsxs("div",{className:"absolute bottom-[calc(100%+0.25rem)] left-0 z-20 min-w-28 overflow-hidden rounded-md border border-border/70 bg-background text-[9px] shadow-lg",children:[f.jsxs("button",{type:"button",className:"flex w-full items-center gap-1.5 px-2 py-1 text-left text-muted-foreground hover:bg-muted/55 hover:text-foreground disabled:opacity-45 disabled:hover:bg-transparent disabled:hover:text-muted-foreground",onClick:()=>void Ul(),disabled:$e,"aria-label":dt,children:[f.jsx(Nv,{className:re("h-2.5 w-2.5",je&&"animate-pulse")}),f.jsx("span",{children:Se})]}),ce&&f.jsxs("button",{type:"button",className:"flex w-full items-center gap-1.5 border-t border-border/50 px-2 py-1 text-left text-muted-foreground hover:bg-muted/55 hover:text-foreground disabled:opacity-45 disabled:hover:bg-transparent disabled:hover:text-muted-foreground",onClick:()=>void Ct(),disabled:z,"aria-label":"Restart Meshy Desktop",children:[f.jsx(sf,{className:re("h-2.5 w-2.5",z&&"animate-spin")}),f.jsx("span",{children:"Restart"})]}),ee&&f.jsxs("button",{type:"button",className:"flex w-full items-center gap-1.5 border-t border-border/50 px-2 py-1 text-left text-muted-foreground hover:bg-muted/55 hover:text-foreground",onClick:()=>void Mn(),"aria-label":"Reload dashboard page",children:[f.jsx(sf,{className:"h-2.5 w-2.5"}),f.jsx("span",{children:"Reload"})]})]}),f.jsx("span",{id:"live-link-restart-hint",role:"tooltip",className:"pointer-events-none absolute left-6 top-1/2 z-10 -translate-y-1/2 whitespace-nowrap rounded-sm border border-border/70 bg-background px-1.5 py-0.5 text-[8px] text-muted-foreground opacity-0 shadow-sm transition-opacity group-hover/restart:opacity-100 group-focus-within/restart:opacity-100",children:He})]})}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx(yn,{type:"button",variant:"ghost",size:"sm",className:"h-5 rounded-sm px-1.5 text-[9px]",onClick:()=>O(new Set(l.map(Ne=>Ne.id))),disabled:le.length===0,title:"Dismiss all notifications",children:"Dismiss all"}),f.jsx(yn,{type:"button",variant:"ghost",size:"sm",className:"h-5 rounded-sm px-1.5 text-[9px]",onClick:()=>N(!1),children:"Close"})]})]})]})]})}const c0="dark",zl="fluent",H3="clean",Fd="meshy-layout-default-migrated-to-compact",Nf="true",$3="compact",V3=new Set(["airy","clean","fluent"]);function Y3(n){return n!==null&&V3.has(n)}function gc(n){return n===$3?"fluent":Y3(n)?n:null}function q3(n,l){const o=gc(n);return o===H3&&l!==Nf?zl:o??zl}const Ws="symphony",m1="default",G3=new Set(["light","dark","system"]),P3=new Set(["porcelain","warm","finsight","edge","symphony","launcher"]),h1=v.createContext(null);function X3(n){const l=new URLSearchParams(n).get("theme");return p1(l)?l:null}function K3(n){const l=new URLSearchParams(n).get("palette");return dm(l)}function Q3(n){const l=new URLSearchParams(n).get("layout");return gc(l)}function Z3(){if(typeof document>"u")return null;const n=document.documentElement;return{theme:n.classList.contains("dark")?"dark":"light",palette:dm(n.getAttribute("data-palette"))??Ws,layout:gc(n.getAttribute("data-layout"))??zl}}function $M(n,l=Z3()){if(!l)return n;try{const o=/^[a-z][a-z\d+\-.]*:/i.test(n),i=typeof window<"u"?window.location.href:"http://localhost",c=new URL(n,i);return c.searchParams.set("theme",l.theme),c.searchParams.set("palette",l.palette),c.searchParams.set("layout",l.layout),o?c.toString():`${c.pathname}${c.search}${c.hash}`}catch{return n}}const Jd=.9;function u0(n){const l=n.trim().match(/^(-?\d+(?:\.\d+)?)\s+(-?\d+(?:\.\d+)?)%\s+(-?\d+(?:\.\d+)?)%$/);if(!l)return null;const o=(Number(l[1])%360+360)%360/60,i=ec(Number(l[2])/100,0,1),c=ec(Number(l[3])/100,0,1),d=(1-Math.abs(2*c-1))*i,m=d*(1-Math.abs(o%2-1)),h=c-d/2,[y,p,x]=o<1?[d,m,0]:o<2?[m,d,0]:o<3?[0,d,m]:o<4?[0,m,d]:o<5?[m,0,d]:[d,0,m];return[Math.round((y+h)*255),Math.round((p+h)*255),Math.round((x+h)*255),255]}function I3(n){const l=n.trim();if(!l||l==="transparent")return null;const o=l.match(/^rgba?\(\s*([+-]?\d+(?:\.\d+)?)\s*,\s*([+-]?\d+(?:\.\d+)?)\s*,\s*([+-]?\d+(?:\.\d+)?)(?:\s*,\s*([+-]?\d+(?:\.\d+)?))?\s*\)$/i);if(o)return[jr(Number(o[1])),jr(Number(o[2])),jr(Number(o[3])),m0(o[4])];const i=l.match(/^rgba?\(\s*([+-]?\d+(?:\.\d+)?)\s+([+-]?\d+(?:\.\d+)?)\s+([+-]?\d+(?:\.\d+)?)(?:\s*\/\s*([+-]?\d+(?:\.\d+)?%?))?\s*\)$/i);return i?[jr(Number(i[1])),jr(Number(i[2])),jr(Number(i[3])),m0(i[4])]:null}function F3(n,l,o){const i=u0(n);if(!i)return null;if(o==="clean"||o==="fluent")return i;const c=u0(l);return c?[Wd(i[0],c[0],Jd),Wd(i[1],c[1],Jd),Wd(i[2],c[2],Jd),255]:null}function J3(){const n=document.querySelector(".dashboard-shell-header-panel");if(!n)return null;const l=I3(getComputedStyle(n).backgroundColor);return!l||l[3]===0?null:l}function d0(){var m,h;if(typeof window>"u"||typeof document>"u")return;const n=((h=(m=window.__TAURI__)==null?void 0:m.core)==null?void 0:h.invoke)??null;if(!n)return;const l=document.documentElement,o=l.classList.contains("dark")?"dark":"light",i=getComputedStyle(l),c=gc(l.getAttribute("data-layout"))??zl,d=J3()??F3(i.getPropertyValue("--card"),i.getPropertyValue("--background"),c);n("sync_desktop_theme",{theme:o,backgroundColor:d}).catch(()=>{})}function f0(){if(typeof window>"u")return()=>{};if(d0(),typeof window.requestAnimationFrame!="function")return()=>{};const n=window.requestAnimationFrame(()=>d0());return()=>window.cancelAnimationFrame(n)}function Wd(n,l,o){return Math.round(n*o+l*(1-o))}function ec(n,l,o){return Math.min(Math.max(n,l),o)}function jr(n){return Math.round(ec(n,0,255))}function m0(n){if(n==null||n==="")return 255;const l=n.endsWith("%")?Number(n.slice(0,-1))/100:Number(n);return Math.round(ec(l,0,1)*255)}function W3({children:n}){const[l,o]=v.useState(()=>typeof window<"u"?X3(window.location.search)??nj(localStorage.getItem("meshy-theme"))??c0:c0),[i,c]=v.useState(()=>typeof window<"u"?K3(window.location.search)??aj(localStorage.getItem("meshy-palette"))??Ws:Ws),[d,m]=v.useState(()=>{if(typeof window<"u"){const h=Q3(window.location.search);if(h)return localStorage.setItem(Fd,Nf),h;const y=q3(localStorage.getItem("meshy-layout"),localStorage.getItem(Fd));return localStorage.setItem(Fd,Nf),y}return zl});return v.useEffect(()=>{const h=document.documentElement,y=p=>{if(p==="system"){const x=window.matchMedia("(prefers-color-scheme: dark)").matches;h.classList.toggle("dark",x)}else h.classList.toggle("dark",p==="dark")};if(y(l),localStorage.setItem("meshy-theme",l),l==="system"){const p=window.matchMedia("(prefers-color-scheme: dark)"),x=()=>{y("system"),f0()};return p.addEventListener("change",x),()=>p.removeEventListener("change",x)}},[l]),v.useEffect(()=>{document.documentElement.setAttribute("data-palette",i),localStorage.setItem("meshy-palette",i)},[i]),v.useEffect(()=>{const h=document.documentElement;d===zl?h.removeAttribute("data-layout"):h.setAttribute("data-layout",d),localStorage.setItem("meshy-layout",d)},[d]),v.useEffect(()=>f0(),[l,i,d]),f.jsx(h1.Provider,{value:{theme:l,setTheme:o,palette:i,setPalette:c,layout:d,setLayout:m},children:n})}function ej(){const n=v.useContext(h1);if(!n)throw new Error("useTheme must be used within ThemeProvider");return n}function p1(n){return n!==null&&G3.has(n)}function tj(n){return n!==null&&P3.has(n)}function nj(n){return p1(n)?n:null}function dm(n){return n===m1?"porcelain":tj(n)?n:null}function aj(n){return n===m1?null:dm(n)}const lj=[{value:"light",label:"Light",icon:I0},{value:"dark",label:"Dark",icon:Q0},{value:"system",label:"System",icon:K0}],g1=[{value:"finsight",label:"FinSight",hint:"Cool sage green"},{value:"porcelain",label:"Porcelain",hint:"Blue workspace"},{value:"warm",label:"Warm",hint:"Cream + amber"},{value:"edge",label:"Edge",hint:"Rounded violet panels"},{value:"symphony",label:"Symphony",hint:"Near-black rose accent"},{value:"launcher",label:"Launcher",hint:"Desktop startup blue"}],v1=[{value:"airy",label:"Airy",hint:"Gradients, blur, spacious"},{value:"clean",label:"Clean",hint:"Flat, borders, high density"},{value:"fluent",label:"Fluent",hint:"Compact neutral"}];function rj(){const{theme:n,setTheme:l,palette:o,setPalette:i,layout:c,setLayout:d}=ej(),[m,h]=v.useState(!1),y=v.useRef(null),p=v.useRef(null),x=n==="dark"?Q0:n==="light"?I0:K0,g=()=>{y.current&&(clearTimeout(y.current),y.current=null)},w=()=>{g(),y.current=setTimeout(()=>h(!1),180)};return v.useEffect(()=>{if(!m)return;const N=T=>{p.current&&!p.current.contains(T.target)&&h(!1)};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[m]),v.useEffect(()=>()=>g(),[]),f.jsxs("div",{ref:p,className:"relative",onMouseEnter:()=>{g(),h(!0)},onMouseLeave:w,children:[f.jsx(yn,{variant:"ghost",size:"icon",onClick:()=>h(N=>!N),className:re("h-8 w-8 rounded-sm",o!==Ws||c!==zl?"text-primary":"text-muted-foreground hover:bg-muted/50 hover:text-foreground"),title:"Appearance","aria-haspopup":"menu","aria-expanded":m,children:f.jsx(x,{className:"h-4 w-4"})}),m&&f.jsxs("div",{role:"menu",className:"fixed left-2 right-2 top-[4.25rem] z-50 w-auto max-w-none rounded-md border border-border/70 bg-popover/95 p-2 text-popover-foreground shadow-[0_24px_70px_-32px_rgba(0,0,0,0.45)] backdrop-blur-xl sm:absolute sm:left-auto sm:right-0 sm:top-[calc(100%+6px)] sm:w-[23rem] sm:max-w-[23rem]",children:[f.jsxs("div",{className:"mb-2 flex items-end justify-between gap-2",children:[f.jsxs("div",{children:[f.jsx("div",{className:"text-[8px] font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:"Appearance"}),f.jsxs("div",{className:"text-[10px] font-medium text-foreground",children:[oj(c)," / ",ij(o)]})]}),f.jsx("div",{className:"rounded-sm border border-border/60 bg-background/70 px-1.5 py-0.5 text-[8px] font-medium capitalize text-muted-foreground",children:n})]}),f.jsx("div",{className:"px-0.5 pb-1 text-[8px] font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:"Theme"}),f.jsx("div",{className:"mb-2 grid grid-cols-3 gap-1 rounded-sm bg-muted/35 p-0.5",children:lj.map(({value:N,label:T,icon:E})=>{const C=n===N;return f.jsxs("button",{type:"button",onClick:()=>l(N),role:"menuitemradio","aria-checked":C,className:re("flex min-h-[2.1rem] flex-col items-center justify-center gap-0.5 rounded-sm border px-1.5 py-1 text-[9px] font-medium transition-colors",C?"border-primary/55 bg-background text-primary shadow-sm":"border-transparent text-muted-foreground hover:border-border/70 hover:bg-background/80 hover:text-foreground"),children:[f.jsx(E,{className:"h-3 w-3"}),T]},N)})}),f.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[f.jsxs("div",{children:[f.jsx("div",{className:"px-0.5 pb-1 text-[8px] font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:"Layout"}),f.jsx("div",{className:"space-y-1",children:v1.map(({value:N,label:T,hint:E})=>{const C=c===N;return f.jsxs("button",{type:"button",onClick:()=>d(N),role:"menuitemradio","aria-checked":C,className:re("flex min-h-[2.25rem] w-full items-center gap-1.5 rounded-sm border px-1.5 py-1 text-left transition-colors",C?"border-primary/55 bg-primary/10":"border-border/45 bg-background/45 hover:border-border hover:bg-muted/55"),children:[f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("div",{className:re("text-[10px] font-medium leading-tight",C?"text-primary":"text-foreground"),children:T}),f.jsx("div",{className:"mt-0.5 text-[8px] leading-tight text-muted-foreground",children:E})]}),C&&f.jsx(Ls,{className:"h-3 w-3 text-primary"})]},N)})})]}),f.jsxs("div",{children:[f.jsxs("div",{className:"flex items-center gap-1.5 px-0.5 pb-1 text-[8px] font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:[f.jsx(qN,{className:"h-2.5 w-2.5"}),"Palette"]}),f.jsx("div",{className:"space-y-1",children:g1.map(({value:N,label:T,hint:E})=>{const C=o===N;return f.jsxs("button",{type:"button",onClick:()=>i(N),role:"menuitemradio","aria-checked":C,className:re("flex min-h-[2.25rem] w-full items-center gap-1.5 rounded-sm border px-1.5 py-1 text-left transition-colors",C?"border-primary/55 bg-primary/10":"border-border/45 bg-background/45 hover:border-border hover:bg-muted/55"),children:[f.jsx(sj,{value:N}),f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("div",{className:re("text-[10px] font-medium leading-tight",C?"text-primary":"text-foreground"),children:T}),f.jsx("div",{className:"mt-0.5 text-[8px] leading-tight text-muted-foreground",children:E})]}),C&&f.jsx(Ls,{className:"h-3 w-3 text-primary"})]},N)})})]})]})]})]})}function oj(n){var l;return((l=v1.find(o=>o.value===n))==null?void 0:l.label)??n}function ij(n){var l;return((l=g1.find(o=>o.value===n))==null?void 0:l.label)??n}function sj({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%)"],edge:["hsl(265 75% 55%)","hsl(260 12% 98%)","hsl(285 70% 65%)"],symphony:["hsl(348 100% 71%)","hsl(0 0% 6%)","hsl(240 2% 9%)"],launcher:["hsl(213 77% 49%)","hsl(60 10% 96%)","hsl(0 0% 100%)"]},[o,i,c]=l[n];return f.jsxs("div",{className:re("flex h-5 w-5 shrink-0 overflow-hidden border border-border/60 shadow-sm","rounded-sm"),children:[f.jsx("div",{className:"h-full w-1/3",style:{background:o}}),f.jsx("div",{className:"h-full w-1/3",style:{background:i}}),f.jsx("div",{className:"h-full w-1/3",style:{background:c}})]})}const Xo={tasks:{defaultSize:20,min:16,max:36,wheelStep:1},operations:{defaultSize:20,min:18,max:38,wheelStep:1},terminal:{defaultSize:18,min:10,max:30,wheelStep:1}},y1="meshy-dashboard-panel-state-v2",b1="meshy-dashboard-terminal-open-v1";function VM({operationsOpen:n}){return{layout:{desktopTasksOpen:!0,operationsOpen:n},sizes:{tasks:Xo.tasks.defaultSize,operations:Xo.operations.defaultSize,terminal:Xo.terminal.defaultSize}}}function ef(n){return typeof n=="object"&&n!==null}function h0(n,l){return typeof n=="boolean"?n:l}function tf(n,l,o){return typeof l=="number"&&Number.isFinite(l)?Ko(n,l):o}function Ko(n,l){const o=Xo[n];return Math.min(o.max,Math.max(o.min,l))}function YM(n,l){if(!n)return l;try{const o=n.getItem(y1);if(!o)return l;const i=JSON.parse(o);if(!ef(i))return l;const c=ef(i.layout)?i.layout:{},d=ef(i.sizes)?i.sizes:{};return{layout:{desktopTasksOpen:h0(c.desktopTasksOpen,l.layout.desktopTasksOpen),operationsOpen:h0(c.operationsOpen,l.layout.operationsOpen)},sizes:{tasks:tf("tasks",d.tasks,l.sizes.tasks),operations:tf("operations",d.operations,l.sizes.operations),terminal:tf("terminal",d.terminal,l.sizes.terminal)}}}catch{return l}}function qM(n,l){if(n)try{n.setItem(y1,JSON.stringify(l))}catch{}}function cj(n,l){if(!n)return l;try{const o=n.getItem(b1);return o==="true"?!0:o==="false"?!1:l}catch{return l}}function uj(n,l){if(n)try{n.setItem(b1,String(l))}catch{}}function p0(){var n;try{return((n=globalThis.window)==null?void 0:n.localStorage)??globalThis.localStorage??null}catch{return null}}function GM(n){return`${Number(n.toFixed(2))}rem`}function PM(n,l,o,i,c,d,m){const h=Number.isFinite(m)&&m>0?m:16;return n==="tasks"?Ko(n,l+(c-o)/h):n==="operations"?Ko(n,l+(o-c)/h):Ko(n,l+(i-d)/h)}function XM(n,l,o){const i=o===0?0:o>0?-1:1;return Ko(n,l+i*Xo[n].wheelStep)}const dj=7200*1e3;function fj(){return f.jsxs("svg",{"data-meshy-app-icon":"header",viewBox:"0 0 1024 1024",className:"h-8 w-8","aria-hidden":"true",children:[f.jsxs("defs",{children:[f.jsxs("linearGradient",{id:"meshy-header-icon-bg",x1:"160",y1:"128",x2:"864",y2:"896",gradientUnits:"userSpaceOnUse",children:[f.jsx("stop",{offset:"0",stopColor:"#182033"}),f.jsx("stop",{offset:"1",stopColor:"#0a0f1f"})]}),f.jsxs("linearGradient",{id:"meshy-header-icon-edge",x1:"260",y1:"244",x2:"768",y2:"780",gradientUnits:"userSpaceOnUse",children:[f.jsx("stop",{offset:"0",stopColor:"#66e3ff"}),f.jsx("stop",{offset:"0.52",stopColor:"#8fd56b"}),f.jsx("stop",{offset:"1",stopColor:"#ffcb5b"})]})]}),f.jsx("rect",{width:"1024",height:"1024",rx:"224",fill:"url(#meshy-header-icon-bg)"}),f.jsx("path",{d:"M308 652V372l204 174 204-174v280",fill:"none",stroke:"url(#meshy-header-icon-edge)",strokeWidth:"86",strokeLinecap:"round",strokeLinejoin:"round"}),f.jsx("circle",{cx:"308",cy:"372",r:"58",fill:"#66e3ff"}),f.jsx("circle",{cx:"512",cy:"546",r:"58",fill:"#8fd56b"}),f.jsx("circle",{cx:"716",cy:"372",r:"58",fill:"#ffcb5b"}),f.jsx("circle",{cx:"308",cy:"652",r:"58",fill:"#66e3ff"}),f.jsx("circle",{cx:"716",cy:"652",r:"58",fill:"#ffcb5b"})]})}function Cs(){var n,l;return typeof window>"u"?null:((l=(n=window.__TAURI__)==null?void 0:n.core)==null?void 0:l.invoke)??null}function g0(n){return{currentVersion:null,latestVersion:null,updateAvailable:!1,checkedAt:new Date().toISOString(),releaseUrl:null,assetName:null,installable:!1,detail:n}}function nf(n,l){if(n instanceof Error&&n.message.trim())return n.message;if(typeof n=="string"&&n.trim())return n;if(n&&typeof n=="object"&&"message"in n){const o=n.message;if(typeof o=="string"&&o.trim())return o}return l}function mj(n){return n.openedRelease?"Opened the latest Meshy release page.":n.installMethod==="tauri-updater"?"Installing desktop update. Meshy will relaunch to finish updating.":(n.assetName??"desktop update").toLowerCase().endsWith(".dmg")?"Downloaded desktop update. Open the DMG and drag Meshy to Applications to finish updating.":"Downloaded desktop update. Follow the installer to finish updating."}function hj(){const{cluster:n,events:l,sseConnected:o,systemInfo:i}=G0(),c=Fn(),[d,m]=v.useState(()=>cj(p0(),!1)),[h,y]=v.useState(""),[p,x]=v.useState(null),[g,w]=v.useState(null),N=!!Cs(),T=N?"max-w-none":"max-w-[1760px]",E=c.pathname==="/"||/^\/tasks\/[^/]+$/.test(c.pathname),C=v.useMemo(()=>{const B=new Map;for(const G of(n==null?void 0:n.nodes)??[])B.set(G.id,G.name);return n!=null&&n.self&&B.set(n.self.id,n.self.name),B},[n==null?void 0:n.nodes,n==null?void 0:n.self]),A=v.useCallback(B=>{m(G=>typeof B=="function"?B(G):B)},[]);v.useEffect(()=>{uj(p0(),d)},[d]),v.useEffect(()=>{const B=Cs();if(!B){w(null);return}let G=!1,V=!1;const $=le=>{V||(V=!0,le&&w(g0("Checking desktop update...")),B("check_desktop_update").then(fe=>{G||w(fe)}).catch(fe=>{if(!G){const me=nf(fe,"Desktop update check failed");w(ie=>ie!=null&&ie.updateAvailable?ie:g0(me))}}).finally(()=>{V=!1}))};$(!0);const ne=window.setInterval(()=>$(!1),dj);return()=>{G=!0,window.clearInterval(ne)}},[i==null?void 0:i.version]);async function j(){try{const B=await Y0({reason:"restart"});Ge.info(`Restarting runtime. Follow ${B.logPath} for launch output.`),await u1({previousPid:B.pid})||Ge.error("Runtime restart was accepted, but the dashboard did not reconnect before the timeout.")}catch(B){Ge.error(B instanceof Error?B.message:"Runtime restart failed")}}async function O(){const B=Cs();if(!B){Ge.error("Desktop updater is not available in this window");return}try{Ge.info("Downloading desktop update...");const G=await B("install_desktop_update");Ge.info(mj(G))}catch(G){Ge.error(nf(G,"Desktop update failed"))}}async function z(){const B=Cs();if(!B){Ge.error("Desktop restart is not available in this window");return}try{Ge.info("Restarting Meshy Desktop..."),await B("restart_desktop_app")}catch(G){Ge.error(nf(G,"Desktop restart failed"))}}return f.jsxs("div",{className:"relative h-full overflow-hidden bg-background text-foreground",children:[f.jsx("div",{className:"mesh-grid pointer-events-none absolute inset-0"}),f.jsxs("div",{className:"relative z-10 flex h-full min-h-0 flex-col",children:[f.jsx("header",{className:"dashboard-shell-header relative z-50 shrink-0 px-2 py-2",children:f.jsxs("div",{className:re("dashboard-shell-header-panel dashboard-panel dashboard-panel-muted animate-panel-settle mx-auto flex items-center gap-0 rounded-lg px-3 py-2",T),children:[f.jsx("div",{className:"flex shrink-0 items-center gap-3 pr-3",children:f.jsxs(rf,{to:"/","aria-label":"Meshy home",className:"flex items-center gap-2",children:[f.jsx(fj,{}),f.jsxs("div",{className:"hidden min-w-0 items-baseline gap-1.5 sm:flex",children:[f.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.24em] text-muted-foreground",children:"MESHY"}),f.jsx("span",{className:"truncate text-[13px] font-semibold tracking-tight text-foreground",children:"Workspace"})]})]})}),f.jsx("div",{className:"mx-0 hidden h-4 w-px shrink-0 bg-border/50 md:block"}),E&&f.jsxs("div",{className:"hidden min-w-0 flex-1 items-center px-3 md:flex",children:[p&&f.jsxs("nav",{"aria-label":"Current task location",className:"flex min-w-0 max-w-[38rem] items-center gap-1 rounded-sm bg-background/55 px-2 py-1 text-[10px] text-muted-foreground",children:[f.jsxs("button",{type:"button",onClick:()=>y(p.nodeName),className:"flex min-w-0 items-center gap-1 rounded-sm px-1 py-0.5 hover:bg-muted/60 hover:text-foreground",title:`Filter by ${p.nodeName}`,children:[f.jsx(Z0,{className:"h-3 w-3 shrink-0 text-primary/70"}),f.jsx("span",{className:"max-w-[9rem] truncate",children:p.nodeName})]}),f.jsx(of,{className:"h-3 w-3 shrink-0 text-border/80"}),f.jsxs("button",{type:"button",onClick:()=>y(p.projectLabel),className:"flex min-w-0 items-center gap-1 rounded-sm px-1 py-0.5 hover:bg-muted/60 hover:text-foreground",title:p.projectPath,children:[f.jsx(wN,{className:"h-3 w-3 shrink-0 text-muted-foreground/70"}),f.jsx("span",{className:"max-w-[9rem] truncate",children:p.projectLabel})]}),f.jsx(of,{className:"h-3 w-3 shrink-0 text-border/80"}),f.jsx(rf,{to:`/tasks/${p.taskId}`,className:"min-w-0 truncate px-1 font-medium text-foreground/85 hover:text-foreground",title:p.taskTitle,children:p.taskTitle})]}),f.jsxs("div",{className:"relative ml-auto w-[18rem] max-w-[28rem]",children:[f.jsx(LN,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/60"}),f.jsx(um,{"aria-label":"Search tasks",value:h,onChange:B=>y(B.target.value),placeholder:"Search tasks, nodes, workspaces",className:"h-8 rounded-sm border-0 bg-background/62 pl-8 pr-2 text-[11px] shadow-none focus-visible:ring-0 focus-visible:ring-offset-0"})]})]}),f.jsx("div",{className:"mx-0 hidden h-4 w-px shrink-0 bg-border/50 md:block"}),f.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1.5 pl-3 sm:gap-2 md:ml-0",children:[E&&f.jsx(yn,{variant:"ghost",size:"icon",onClick:()=>A(B=>!B),"aria-label":d?"Close terminal":"Open terminal",title:d?"Close terminal":"Open terminal",className:re("h-8 w-8 rounded-sm text-muted-foreground hover:bg-muted/50 hover:text-foreground",d&&"bg-primary/8 text-primary"),children:f.jsx(F0,{className:"h-4 w-4"})}),f.jsx(d3,{}),f.jsx(rj,{}),f.jsx("div",{className:"mx-0 h-4 w-px shrink-0 bg-border/50"}),f.jsx(B3,{connected:o,events:l,nodes:(n==null?void 0:n.nodes)??[],currentNode:(n==null?void 0:n.self)??null,nodeNameById:C,desktopUpdate:g,onDesktopUpdate:g!=null&&g.updateAvailable?O:void 0,onDesktopRestart:N?z:void 0,onReload:N?()=>window.location.reload():void 0,onRestart:j})]})]})}),f.jsx("main",{className:re("dashboard-shell-main min-h-0 flex-1 px-2 pb-2",E?"overflow-hidden":"overflow-y-auto"),children:f.jsx("div",{className:re("dashboard-shell-content mx-auto h-full min-h-0",T),children:f.jsx(Hw,{context:{terminalOpen:d,setTerminalOpen:A,headerSearchQuery:h,setHeaderSearchQuery:y,setHeaderTaskContext:x}})})})]})]})}const v0=v.lazy(async()=>({default:(await x0(()=>import("./DashboardPage-CKkLv8I1.js").then(l=>l.D),__vite__mapDeps([0,1,2,3,4]))).DashboardPage})),pj=v.lazy(async()=>({default:(await x0(()=>import("./SharedConversationPage-aj_wfoD8.js"),__vite__mapDeps([5,1]))).SharedConversationPage}));function gj(){return f.jsx(dE,{children:f.jsx(v.Suspense,{fallback:f.jsx(vj,{}),children:f.jsxs(Vw,{children:[f.jsx(jl,{path:"/shared/tasks/:shareId",element:f.jsx(pj,{})}),f.jsxs(jl,{element:f.jsx(GE,{children:f.jsx(hj,{})}),children:[f.jsx(jl,{path:"/",element:f.jsx(v0,{})}),f.jsx(jl,{path:"/nodes",element:f.jsx(xv,{to:"/",replace:!0})}),f.jsx(jl,{path:"/tasks",element:f.jsx(xv,{to:"/",replace:!0})}),f.jsx(jl,{path:"/tasks/:id",element:f.jsx(v0,{})})]})]})})})}function vj(){return f.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background text-sm text-muted-foreground",children:"Loading workspace..."})}function yj(n){const l=n??(typeof window>"u"?void 0:window);l!=null&&l.__TAURI__&&l.addEventListener("contextmenu",o=>{o.preventDefault()})}function bj(n){return f.jsx(uC,{className:"toaster group",style:{"--normal-bg":"hsl(var(--popover))","--normal-text":"hsl(var(--popover-foreground))","--normal-border":"hsl(var(--border))"},...n})}yj();$2.createRoot(document.getElementById("root")).render(f.jsx(v.StrictMode,{children:f.jsxs(W3,{children:[f.jsx(gj,{}),f.jsx(bj,{})]})}));export{Is as $,Jy as A,yn as B,Ls as C,wM as D,eb as E,xN as F,$M as G,hN as H,um as I,v3 as J,g3 as K,X0 as L,d_ as M,bM as N,Ox as O,xM as P,Os as Q,St as R,Z0 as S,EM as T,UM as U,Ps as V,wf as W,J0 as X,Xs as Y,Ks as Z,Zs as _,pC as a,$j as a$,Qs as a0,Js as a1,Fs as a2,x0 as a3,Nj as a4,Wy as a5,W5 as a6,Uj as a7,F0 as a8,Go as a9,nM as aA,YM as aB,VM as aC,p0 as aD,qM as aE,XM as aF,GM as aG,PM as aH,Gj as aI,UE as aJ,ME as aK,pM as aL,hM as aM,gM as aN,$E as aO,Jj as aP,Rj as aQ,Cj as aR,tb as aS,Aj as aT,_j as aU,CE as aV,d3 as aW,Wj as aX,eM as aY,Yj as aZ,Hj as a_,fN as aa,Lj as ab,Bj as ac,zj as ad,KN as ae,HN as af,WE as ag,CN as ah,ei as ai,DM as aj,ON as ak,A3 as al,C_ as am,yN as an,A_ as ao,BM as ap,m3 as aq,AM as ar,HM as as,TM as at,CM as au,zM as av,i1 as aw,LM as ax,Ef as ay,tM as az,re as b,Vj as b0,qj as b1,Sj as b2,Fn as b3,M0 as b4,xj as b5,G0 as b6,kM as b7,OM as b8,RM as b9,cM as bA,sf as bB,fM as bC,vM as bD,mM as bE,_M as ba,MM as bb,jM as bc,Pj as bd,NM as be,h3 as bf,Ij as bg,Fj as bh,Zj as bi,Qj as bj,Ej as bk,Tj as bl,wj as bm,jj as bn,yM as bo,iM as bp,oM as bq,rM as br,aM as bs,lM as bt,sM as bu,f3 as bv,y0 as bw,iN as bx,dM as by,uM as bz,Be as c,py as d,kj as e,TE as f,Oj as g,Mj as h,wN as i,f as j,of as k,Or as l,Dj as m,Kj as n,cx as o,rm as p,ux as q,v as r,om as s,Ge as t,LN as u,Zo as v,qN as w,SM as x,Xj as y,I5 as z};
316
+ 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},S_=kx,w_=zx,E_=Lx,Xx=Ux,Kx=Bx,Qx=qx,Zx=Px,Ix=$x,Fx=Yx;const wf=S_,Ef=w_,N_=E_,Jx=v.forwardRef(({className:n,...l},o)=>f.jsx(Xx,{className:re("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}));Jx.displayName=Xx.displayName;const Xs=v.forwardRef(({className:n,...l},o)=>f.jsxs(N_,{children:[f.jsx(Jx,{}),f.jsx(Kx,{ref:o,className:re("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 rounded-xl 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})]}));Xs.displayName=Kx.displayName;const Ks=({className:n,...l})=>f.jsx("div",{className:re("flex flex-col space-y-2 text-center sm:text-left",n),...l});Ks.displayName="AlertDialogHeader";const Qs=({className:n,...l})=>f.jsx("div",{className:re("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...l});Qs.displayName="AlertDialogFooter";const Zs=v.forwardRef(({className:n,...l},o)=>f.jsx(Ix,{ref:o,className:re("text-lg font-semibold",n),...l}));Zs.displayName=Ix.displayName;const Is=v.forwardRef(({className:n,...l},o)=>f.jsx(Fx,{ref:o,className:re("text-sm text-muted-foreground",n),...l}));Is.displayName=Fx.displayName;const Fs=v.forwardRef(({className:n,...l},o)=>f.jsx(Qx,{ref:o,className:re(Uf(),n),...l}));Fs.displayName=Qx.displayName;const Js=v.forwardRef(({className:n,...l},o)=>f.jsx(Zx,{ref:o,className:re(Uf({variant:"outline"}),"mt-2 sm:mt-0",n),...l}));Js.displayName=Zx.displayName;const T_={online:"bg-green-500",busy:"bg-yellow-500",offline:"bg-red-500"};function C_({status:n}){return f.jsxs("span",{className:"relative inline-flex h-2.5 w-2.5",children:[n==="online"&&f.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-500 opacity-30"}),f.jsx("span",{className:re("relative inline-flex h-2.5 w-2.5 rounded-full",T_[n])})]})}function A_({role:n,size:l="default"}){return f.jsx(St,{variant:n==="leader"?"default":"secondary",className:re(l==="compact"?"px-1.5 py-0 text-[9px] leading-4":"text-[11px]"),children:n})}const Wx={pending:{variant:"secondary",dotClass:"bg-muted-foreground",className:"border-transparent bg-muted/55 text-muted-foreground"},assigned:{variant:"outline",dotClass:"bg-teal-500",className:"border-teal-500/20 bg-teal-500/8 text-teal-700 dark:text-teal-300"},running:{variant:"outline",dotClass:"bg-amber-500",className:"border-amber-500/22 bg-amber-500/9 text-amber-700 dark:text-amber-300"},completed:{variant:"outline",dotClass:"bg-emerald-500",className:"border-emerald-500/18 bg-emerald-500/8 text-emerald-700 dark:text-emerald-300"},failed:{variant:"destructive",dotClass:"bg-red-200",className:"border-destructive/20 bg-destructive/90 text-destructive-foreground"},cancelled:{variant:"secondary",dotClass:"bg-muted-foreground",className:"border-transparent bg-muted/55 text-muted-foreground"},archived:{variant:"secondary",dotClass:"bg-slate-400",className:"border-transparent bg-muted/50 text-muted-foreground"}};function yM({status:n,size:l="default"}){const o=Wx[n],i=l==="compact"?"gap-0.5 px-1 py-0 text-[8px] leading-3 [&>span]:h-[3px] [&>span]:w-[3px]":"gap-1 px-1.5 py-0 text-[10px] leading-4 [&>span]:h-[5px] [&>span]:w-[5px]";return f.jsxs(St,{variant:o.variant,className:re("rounded-sm font-medium shadow-none",i,o.className),children:[f.jsx("span",{className:re("rounded-full",o.dotClass)}),n]})}function bM({status:n,isNative:l=!1,size:o="default",className:i}){const c=Wx[n],d=[n,l?"native":null].filter(Boolean).join(", "),m=o==="compact"?"h-1.5 w-1.5":"h-2 w-2";return f.jsxs("span",{className:re("inline-flex shrink-0 items-center gap-1",i),title:d,"aria-label":d,children:[f.jsx("span",{className:re("rounded-full",m,c.dotClass),title:n}),l&&f.jsx("span",{className:re("rounded-full bg-sky-500",m),title:"native"})]})}const R_={critical:{variant:"destructive",label:"Critical"},high:{variant:"outline",label:"High"},normal:{variant:"secondary",label:"Normal"},low:{variant:"secondary",label:"Low"}};function xM({priority:n}){const l=R_[n];return f.jsx(St,{variant:l.variant,className:"rounded-sm px-1.5 py-0 text-[10px] leading-4 shadow-none",children:l.label})}function __(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 Rr({label:n,value:l,mono:o=!1}){return f.jsxs("div",{className:"min-w-0 rounded-lg border border-border/60 bg-background/65 px-2.5 py-1.5",children:[f.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:n}),f.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 j_({formatDateTime:n,viewInfo:l}){var i,c,d,m,h,y,p,x;const o=__(l.packages);return f.jsxs(Ps,{value:"about","data-about-layout":"compact",className:"mt-0 space-y-2",children:[f.jsxs(Yn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(qn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Gn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(WE,{className:"h-3.5 w-3.5 text-primary"}),"Repository & runtime"]}),f.jsx(Pn,{className:"text-[10px]",children:"Build source and runtime identity for this node."})]}),f.jsxs(Xn,{className:"space-y-2 px-3 pb-2.5",children:[(i=l.repository)!=null&&i.url?f.jsxs("a",{href:l.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:[f.jsx("span",{className:"truncate font-mono text-[10px]",children:l.repository.url}),f.jsx(yN,{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"})]}):f.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."}),f.jsxs("div",{className:"grid gap-1.5 sm:grid-cols-2 lg:grid-cols-3",children:[f.jsx(Rr,{label:"Branch",value:((c=l.repository)==null?void 0:c.branch)??"Unavailable",mono:!!((d=l.repository)!=null&&d.branch)}),f.jsx(Rr,{label:"Commit",value:((m=l.repository)==null?void 0:m.commit)??"Unavailable",mono:!!((h=l.repository)!=null&&h.commit)}),f.jsx(Rr,{label:"Runtime",value:`${l.packageName??"meshy"} ${l.version}`,mono:!0}),f.jsx(Rr,{label:"Node.js",value:((y=l.runtime)==null?void 0:y.nodeVersion)??"Unavailable",mono:!!((p=l.runtime)!=null&&p.nodeVersion)}),f.jsx(Rr,{label:"PID",value:l.runtime?String(l.runtime.pid):"Unavailable",mono:!!l.runtime}),f.jsx(Rr,{label:"Started",value:n((x=l.runtime)==null?void 0:x.startedAt)})]})]})]}),f.jsxs(Yn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(qn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Gn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(NN,{className:"h-3.5 w-3.5 text-primary"}),"Package versions"]}),f.jsx(Pn,{className:"text-[10px]",children:"Version snapshot for the packages most relevant to this dashboard session."})]}),f.jsx(Xn,{"data-package-layout":"list",className:"space-y-1.5 px-3 pb-2.5",children:o.map(g=>{var w,N;return f.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:[f.jsx("div",{className:"text-[11px] font-medium text-foreground",children:g.label}),f.jsx("div",{className:"min-w-0 truncate text-[10px] text-muted-foreground",children:(w=g.value)==null?void 0:w.name}),f.jsx(St,{variant:"outline",className:"w-fit rounded-sm border-border/70 bg-background/60 font-mono text-[10px]",children:(N=g.value)==null?void 0:N.version})]},g.key)})})]})]})}var pc="Checkbox",[M_]=al(pc),[O_,sm]=M_(pc);function D_(n){const{__scopeCheckbox:l,checked:o,children:i,defaultChecked:c,disabled:d,form:m,name:h,onCheckedChange:y,required:p,value:x="on",internal_do_not_use_render:g}=n,[w,N]=Lr({prop:o,defaultProp:c??!1,onChange:y,caller:pc}),[T,E]=v.useState(null),[C,A]=v.useState(null),j=v.useRef(!1),O=T?!!m||!!T.closest("form"):!0,z={checked:w,disabled:d,setChecked:N,control:T,setControl:E,name:h,form:m,value:x,hasConsumerStoppedPropagationRef:j,required:p,defaultChecked:Ja(c)?!1:c,isFormControl:O,bubbleInput:C,setBubbleInput:A};return f.jsx(O_,{scope:l,...z,children:k_(g)?g(z):i})}var e1="CheckboxTrigger",t1=v.forwardRef(({__scopeCheckbox:n,onKeyDown:l,onClick:o,...i},c)=>{const{control:d,value:m,disabled:h,checked:y,required:p,setControl:x,setChecked:g,hasConsumerStoppedPropagationRef:w,isFormControl:N,bubbleInput:T}=sm(e1,n),E=tt(c,x),C=v.useRef(y);return v.useEffect(()=>{const A=d==null?void 0:d.form;if(A){const j=()=>g(C.current);return A.addEventListener("reset",j),()=>A.removeEventListener("reset",j)}},[d,g]),f.jsx(Ue.button,{type:"button",role:"checkbox","aria-checked":Ja(y)?"mixed":y,"aria-required":p,"data-state":o1(y),"data-disabled":h?"":void 0,disabled:h,value:m,...i,ref:E,onKeyDown:De(l,A=>{A.key==="Enter"&&A.preventDefault()}),onClick:De(o,A=>{g(j=>Ja(j)?!0:!j),T&&N&&(w.current=A.isPropagationStopped(),w.current||A.stopPropagation())})})});t1.displayName=e1;var cm=v.forwardRef((n,l)=>{const{__scopeCheckbox:o,name:i,checked:c,defaultChecked:d,required:m,disabled:h,value:y,onCheckedChange:p,form:x,...g}=n;return f.jsx(D_,{__scopeCheckbox:o,checked:c,defaultChecked:d,disabled:h,required:m,onCheckedChange:p,name:i,form:x,value:y,internal_do_not_use_render:({isFormControl:w})=>f.jsxs(f.Fragment,{children:[f.jsx(t1,{...g,ref:l,__scopeCheckbox:o}),w&&f.jsx(r1,{__scopeCheckbox:o})]})})});cm.displayName=pc;var n1="CheckboxIndicator",a1=v.forwardRef((n,l)=>{const{__scopeCheckbox:o,forceMount:i,...c}=n,d=sm(n1,o);return f.jsx(Yr,{present:i||Ja(d.checked)||d.checked===!0,children:f.jsx(Ue.span,{"data-state":o1(d.checked),"data-disabled":d.disabled?"":void 0,...c,ref:l,style:{pointerEvents:"none",...n.style}})})});a1.displayName=n1;var l1="CheckboxBubbleInput",r1=v.forwardRef(({__scopeCheckbox:n,...l},o)=>{const{control:i,hasConsumerStoppedPropagationRef:c,checked:d,defaultChecked:m,required:h,disabled:y,name:p,value:x,form:g,bubbleInput:w,setBubbleInput:N}=sm(l1,n),T=tt(o,N),E=Cb(d),C=pb(i);v.useEffect(()=>{const j=w;if(!j)return;const O=window.HTMLInputElement.prototype,B=Object.getOwnPropertyDescriptor(O,"checked").set,G=!c.current;if(E!==d&&B){const V=new Event("click",{bubbles:G});j.indeterminate=Ja(d),B.call(j,Ja(d)?!1:d),j.dispatchEvent(V)}},[w,E,d,c]);const A=v.useRef(Ja(d)?!1:d);return f.jsx(Ue.input,{type:"checkbox","aria-hidden":!0,defaultChecked:m??A.current,required:h,disabled:y,name:p,value:x,form:g,...l,tabIndex:-1,ref:T,style:{...l.style,...C,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});r1.displayName=l1;function k_(n){return typeof n=="function"}function Ja(n){return n==="indeterminate"}function o1(n){return Ja(n)?"indeterminate":n?"checked":"unchecked"}const i1=v.forwardRef(({className:n,...l},o)=>f.jsx(cm,{ref:o,className:re("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:f.jsx(a1,{className:re("flex items-center justify-center text-current"),children:f.jsx(Ls,{className:"h-3.5 w-3.5"})})}));i1.displayName=cm.displayName;const um=v.forwardRef(({className:n,type:l,...o},i)=>f.jsx("input",{type:l,className:re("flex h-10 w-full rounded-sm 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}));um.displayName="Input";const o0=["queued","running"];function z_(n){return n.map(l=>`${l.id}:${l.name}`).join("\0")}function L_(n){return n==="claude"||n==="codex"||n==="copilot"}function s1(n){var o;if(n.kind!=="agent.upgrade")return null;const l=(o=n.payload)==null?void 0:o.agent;return L_(l)?`${n.nodeId}:${l}`:null}function U_(n){return n.status==="succeeded"||n.status==="failed"}async function c1(n,l={}){const o=l.getOperation??TE,i=l.pollIntervalMs??2e3,c=l.timeoutMs??24e4,d=Date.now()+c;let m=n;for(;!U_(m)&&Date.now()<d;)await H_(i),m=await o(n.id);return m}async function B_(n,l=CE){const o=new Set(n),i=await Promise.all(o0.map(d=>l({kind:"agent.upgrade",status:d}))),c=new Map;for(const d of i.flat()){if(!o0.includes(d.status)||o.size>0&&!o.has(d.nodeId))continue;const m=s1(d);if(!m)continue;const h=c.get(m);(!h||d.updatedAt>h.updatedAt)&&c.set(m,d)}return c}function H_(n){return new Promise(l=>setTimeout(l,n))}const $_=1500,V_=1e3,Y_=9e4;async function u1(n={}){const l=n.fetchHealth??q_,o=n.initialDelayMs??$_,i=n.pollIntervalMs??V_,c=n.previousPid,d=n.reload??(()=>window.location.reload()),m=n.sleep??P_,h=n.timeoutMs??Y_,y=Date.now()+h;let p=!1;for(o>0&&await m(o);Date.now()<=y;){const x=G_(await l());if(!x.ok){p=!0,await m(i);continue}if(c===void 0||x.pid!==void 0&&x.pid!==c||p)return d(),!0;await m(i)}return!1}async function q_(){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 G_(n){return typeof n=="boolean"?{ok:n}:n}function P_(n){return new Promise(l=>window.setTimeout(l,n))}function X_(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 K_({checkedLabel:n,disableAuthDefault:l,endpoint:o,isLiveLocalNode:i,nodeId:c,nodeName:d,onRefresh:m,pid:h,transportType:y,update:p,workDir:x}){const g=X_(p,i),[w,N]=v.useState(null),[T,E]=v.useState(()=>i0({disableAuthDefault:l,endpoint:o,nodeName:d,transportType:y,workDir:x})),[C,A]=v.useState(!1),[j,O]=v.useState(!1),[z,B]=v.useState(!1);v.useEffect(()=>{E(i0({disableAuthDefault:l,endpoint:o,nodeName:d,transportType:y,workDir:x}))},[l,o,d,y,x]);async function G(){if(!c||C||j)return;const le=p.updateAvailable?"update":"restart",fe=I_(T);if(T.port.trim()&&(fe==null?void 0:fe.port)===void 0){Ge.error("Runtime restart port must be a positive integer");return}const me=fe?{reason:le,startArgs:fe}:{reason:le};A(!0);try{if(i){const M=await Y0(me);N({...M,pid:M.pid??h,status:"accepted"}),Ge.info(`Restarting ${d} from a detached helper. PID ${M.pid??h??"unknown"} will not stay attached to the original terminal window; follow ${M.logPath} for launch output.`),u1({previousPid:M.pid??h}).then(Y=>{Y||(A(!1),Ge.error("Runtime restart was accepted, but the dashboard did not reconnect before the timeout. Refresh the page after the node finishes starting."))}).catch(Y=>{A(!1),Ge.error(Y instanceof Error?Y.message:"Runtime restart recovery failed")});return}const ie=await RE(c,me);N({operationId:ie.id,pid:h,status:ie.status}),Ge.info(`Restart requested on ${d}. Operation ${Id(ie.id)} will hand off to a detached process, so the new runtime will not stay attached to the original terminal window.`);const ue=await c1(ie,{timeoutMs:6e4}),oe=Z_(ue);N({command:oe==null?void 0:oe.command,logPath:oe==null?void 0:oe.logPath,mode:oe==null?void 0:oe.mode,operationId:ue.id,pid:(oe==null?void 0:oe.pid)??h,status:ue.status}),ue.status==="succeeded"?(await(m==null?void 0:m()),Ge.success(`Restart handoff accepted on ${d}. Follow ${(oe==null?void 0:oe.logPath)??"the node restart log"} for launch output.`)):ue.status==="failed"?Ge.error(ue.error??`Restart failed on ${d}`):Ge.info(`Restart operation ${Id(ue.id)} is still ${ue.status}. More details will update after the node reports back.`),A(!1)}catch(ie){A(!1),Ge.error(ie instanceof Error?ie.message:"Runtime restart failed")}}async function V(){if(!(!i||C||j)){O(!0);try{const le=await EE();Ge.info(`Stopping Meshy process ${le.pid}`)}catch(le){O(!1),Ge.error(le instanceof Error?le.message:"Runtime stop failed")}}}const $=C?"restarting":j?"stopping":(w==null?void 0:w.status)??"idle",ne=p.restartMode==="development";return f.jsxs("div",{className:"rounded-xl border border-border/70 bg-background/70 overflow-hidden",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b border-border/50",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(zs,{className:"h-3.5 w-3.5 text-primary shrink-0"}),f.jsxs("div",{children:[f.jsx("div",{className:"text-[11px] font-semibold text-foreground leading-tight",children:"Runtime"}),f.jsx("div",{className:"text-[10px] text-muted-foreground leading-tight",children:ne?"Development launcher":`Latest ${p.latestVersion??"—"}`})]})]}),f.jsx("div",{className:"flex items-center gap-1.5",children:f.jsx(St,{variant:p.updateAvailable?"default":"outline",className:"rounded-full border-border/70 bg-background/60 font-mono text-[10px] px-2 py-0.5",children:ne?"dev":p.updateAvailable?`→ ${p.latestVersion}`:"current"})})]}),f.jsxs("div",{className:"grid grid-cols-2 divide-x divide-border/50 border-b border-border/50",children:[f.jsxs("div",{className:"px-3 py-1.5",children:[f.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:"PID"}),f.jsx("div",{className:"mt-0.5 font-mono text-[11px] text-foreground",children:h??"—"})]}),f.jsxs("div",{className:"px-3 py-1.5",children:[f.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:"Status"}),f.jsx("div",{className:"mt-0.5 text-[11px] text-foreground capitalize",children:$})]})]}),f.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2",children:[f.jsxs("div",{className:"text-[10px] text-muted-foreground",children:["Checked ",n]}),f.jsxs("div",{className:"flex items-center gap-1.5",children:[i&&f.jsxs(wf,{children:[f.jsx(Ef,{asChild:!0,children:f.jsxs(yn,{type:"button",size:"sm",variant:"ghost",disabled:C||j,className:"h-7 rounded-lg px-2 text-[11px] text-muted-foreground hover:text-destructive hover:bg-destructive/10",children:[f.jsx(jN,{className:re("mr-1 h-3.5 w-3.5",j&&"animate-pulse")}),j?"Stopping":"Stop"]})}),f.jsxs(Xs,{className:"max-w-[22rem] rounded-xl gap-2 p-4",children:[f.jsxs(Ks,{className:"space-y-1",children:[f.jsx(Zs,{className:"text-sm",children:"Stop runtime?"}),f.jsx(Is,{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."})]}),f.jsxs(Qs,{className:"gap-1 pt-0 sm:space-x-1",children:[f.jsx(Js,{className:"h-7 rounded-lg px-2 text-[11px]",children:"Cancel"}),f.jsx(Fs,{className:"h-7 rounded-lg px-2 text-[11px] bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>void V(),children:"Stop runtime"})]})]})]}),f.jsxs(wf,{children:[f.jsx(Ef,{asChild:!0,children:f.jsxs(yn,{type:"button",size:"sm",variant:p.updateAvailable?"default":"outline",disabled:!c||C||j,className:"h-7 rounded-lg px-2 text-[11px]",children:[f.jsx(sf,{className:re("mr-1 h-3.5 w-3.5",C&&"animate-spin")}),C?"Restarting…":g]})}),f.jsxs(Xs,{className:"max-w-[28rem] gap-3 rounded-xl p-4",children:[f.jsxs(Ks,{className:"space-y-1",children:[f.jsxs(Zs,{className:"text-sm",children:[g,"?"]}),f.jsxs(Is,{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."]})]}),f.jsx(Q_,{value:T,onChange:E}),f.jsxs(Qs,{className:"gap-1 pt-0 sm:space-x-1",children:[f.jsx(Js,{className:"h-7 rounded-lg px-2 text-[11px]",children:"Cancel"}),f.jsx(Fs,{className:"h-7 rounded-lg px-2 text-[11px]",onClick:()=>void G(),children:g})]})]})]})]})]}),f.jsxs("div",{className:"border-t border-border/50",children:[f.jsxs("button",{type:"button",onClick:()=>B(le=>!le),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:[f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx(F0,{className:"h-3 w-3"}),"Restart details"]}),f.jsx(Zo,{className:re("h-3 w-3 transition-transform duration-150",z&&"rotate-180")})]}),z&&f.jsxs("div",{className:"border-t border-border/50 bg-muted/20 px-3 py-2 space-y-1",children:[f.jsx(_l,{label:"Current PID",value:h===void 0?"—":String(h),mono:h!==void 0}),f.jsx(_l,{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}),f.jsx(_l,{label:"Operation",value:w!=null&&w.operationId?Id(w.operationId):"Local direct request",mono:!!(w!=null&&w.operationId)}),f.jsx(_l,{label:"Status",value:(w==null?void 0:w.status)??(C?"requested":"idle")}),f.jsx(_l,{label:"Launcher",value:(w==null?void 0:w.command)??"Available after restart",mono:!!(w!=null&&w.command)}),f.jsx(_l,{label:"Log",value:(w==null?void 0:w.logPath)??"Available after restart",mono:!!(w!=null&&w.logPath)}),f.jsx(_l,{label:"Terminal",value:"New process is detached from original terminal"})]})]}),p.detail&&f.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 Q_({onChange:n,value:l}){const o=(i,c)=>{n({...l,[i]:c})};return f.jsxs("div",{className:"rounded-lg border border-border/70 bg-muted/30 p-3 space-y-3",children:[f.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-muted-foreground",children:"Startup arguments"}),f.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[f.jsx(Vo,{label:"HTTP port",value:l.port,onChange:i=>o("port",i),inputMode:"numeric"}),f.jsx(Vo,{label:"Node name",value:l.name,onChange:i=>o("name",i)}),f.jsx(Vo,{label:"Join endpoint",value:l.join,onChange:i=>o("join",i),className:"sm:col-span-2"}),f.jsxs("div",{className:"space-y-1",children:[f.jsx("label",{className:"text-[9px] uppercase tracking-[0.14em] text-muted-foreground",children:"Transport"}),f.jsxs(cx,{value:l.transport,onValueChange:i=>o("transport",d1(i)),children:[f.jsx(rm,{className:"h-7 rounded-md border-border/70 bg-background/70 px-2 text-[10px]",children:f.jsx(ux,{placeholder:"Transport"})}),f.jsxs(om,{children:[f.jsx(Or,{className:"py-1 text-[11px]",value:"inherit",children:"current / default"}),f.jsx(Or,{className:"py-1 text-[11px]",value:"direct",children:"direct"}),f.jsx(Or,{className:"py-1 text-[11px]",value:"devtunnel",children:"devtunnel"}),f.jsx(Or,{className:"py-1 text-[11px]",value:"tailscale",children:"tailscale"})]})]})]}),f.jsx(Vo,{label:"Working directory",value:l.workDir,onChange:i=>o("workDir",i)}),f.jsx(Vo,{label:"Config path",value:l.config,onChange:i=>o("config",i),className:"sm:col-span-2"}),f.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:[f.jsx(i1,{className:"h-3.5 w-3.5",checked:l.disableAuth,onCheckedChange:i=>n({...l,disableAuth:i===!0,disableAuthKnown:!0})}),"Disable auth"]})]})]})}function Vo({className:n,inputMode:l,label:o,onChange:i,value:c}){return f.jsxs("label",{className:re("space-y-1",n),children:[f.jsx("span",{className:"text-[9px] uppercase tracking-[0.14em] text-muted-foreground",children:o}),f.jsx(um,{className:"h-7 rounded-md px-2 text-[10px]",inputMode:l,value:c,onChange:d=>i(d.target.value)})]})}function _l({label:n,value:l,mono:o=!1}){return f.jsxs("div",{className:"flex items-start justify-between gap-3 text-[10px]",children:[f.jsx("span",{className:"shrink-0 uppercase tracking-[0.14em] text-muted-foreground",children:n}),f.jsx("span",{className:re("break-all text-right text-foreground",o&&"font-mono"),children:l})]})}function Z_(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 i0(n){return{port:F_(n.endpoint),name:n.nodeName,join:"",transport:d1(n.transportType),workDir:n.workDir??"",config:"",disableAuth:n.disableAuthDefault===!0,disableAuthKnown:n.disableAuthDefault!==void 0}}function I_(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 d1(n){return n==="direct"||n==="devtunnel"||n==="tailscale"?n:"inherit"}function F_(n){if(!n)return"";try{return new URL(n).port||""}catch{return""}}function Id(n){return n.length<=8?n:n.slice(0,8)}function Yo({formatDateTime:n,name:l,status:o,statusVariant:i}){return f.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:[f.jsxs("div",{children:[f.jsx("div",{className:"text-[11px] font-medium text-foreground",children:l}),f.jsx("div",{className:"text-[10px] text-muted-foreground",children:n(o==null?void 0:o.checkedAt)})]}),f.jsxs("div",{className:"flex items-center gap-1.5",children:[typeof(o==null?void 0:o.authenticated)=="boolean"&&f.jsx(St,{variant:o.authenticated?"default":"outline",className:"rounded-full text-[10px] uppercase tracking-[0.14em]",children:o.authenticated?"auth ok":"auth required"}),f.jsx(St,{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 Zt(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 J_(n){const l=Math.max(0,Math.floor(n)),o=Math.floor(l/86400),i=Math.floor(l%86400/3600),c=Math.floor(l%3600/60);return o>0?`${o}d ${i}h`:i>0?`${i}h ${c}m`:`${c}m`}function s0(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 Mr(n){return n==="ok"?"default":n==="missing"||n==="install-failed"||n==="login-failed"?"destructive":n==="not-authenticated"||n==="unsupported-platform"?"outline":"secondary"}function W_(n){return n.available?f.jsxs(St,{className:"gap-1 rounded-full px-2 py-0.5 text-[10px]",children:[f.jsx(Go,{className:"h-3 w-3"}),"Available"]}):f.jsxs(St,{variant:"destructive",className:"gap-1 rounded-full px-2 py-0.5 text-[10px]",children:[f.jsx(fN,{className:"h-3 w-3"}),"Unavailable"]})}function e3(n){return n.update?n.update.updateAvailable?f.jsxs(St,{variant:"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:["Update ",n.update.latestVersion]}):f.jsx(St,{variant:"secondary",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:"Up to date"}):null}function t3(n){return n.available?null:n.metadataStatus??null}function n3(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 a3(n){if(n.error)return n.error;const l=n.result;return(l==null?void 0:l.detail)??null}function et({label:n,value:l,mono:o=!1}){return f.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:[f.jsx("span",{className:"shrink-0 text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:n}),f.jsx("span",{className:re("break-all text-right text-[11px] text-foreground",o&&"font-mono text-[11px]"),children:l})]})}function qo({label:n,value:l,mono:o=!1,className:i}){return f.jsxs("div",{className:re("min-w-0 space-y-0.5",i),children:[f.jsx("div",{className:"text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:n}),f.jsx("div",{className:re("truncate text-[11px] text-foreground",o&&"font-mono",n==="Path"&&"break-all whitespace-normal"),children:l})]})}function l3({agent:n,nodeName:l,activeOperation:o,onUpgrade:i}){var y,p;const c=((y=n.update)==null?void 0:y.updateAvailable)===!0,d=e3(n),m=!!o,h=t3(n);return f.jsxs("div",{className:"rounded-lg border border-border/60 bg-background/65 px-3 py-2.5 transition-colors hover:bg-background/85",children:[f.jsxs("div",{className:"grid gap-3 lg:grid-cols-[12rem_minmax(0,1fr)_auto] lg:items-start",children:[f.jsxs("div",{className:"min-w-0 space-y-1.5",children:[f.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] font-semibold text-foreground",children:[f.jsx(X0,{className:"h-3.5 w-3.5 shrink-0 text-primary"}),f.jsx("span",{className:"truncate",children:n.label})]}),f.jsxs("div",{className:"truncate text-[10px] text-muted-foreground",children:["Command: ",f.jsx("span",{className:"font-mono text-[10px]",children:n.command})]}),f.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[W_(n),h&&f.jsx(St,{variant:Mr(h),className:"rounded-full px-2 py-0 text-[10px] uppercase tracking-[0.14em]",children:h})]})]}),f.jsxs("div",{className:"grid min-w-0 gap-x-4 gap-y-1.5 sm:grid-cols-2",children:[f.jsx(qo,{label:"Version",value:n.version??"Unavailable",mono:!!n.version}),n.update&&f.jsx(qo,{label:"Latest",value:n.update.latestVersion??"Unavailable",mono:!!n.update.latestVersion}),f.jsx(qo,{label:"Checked",value:Zt(n.checkedAt)}),n.update&&f.jsx(qo,{label:"Update check",value:Zt(n.update.checkedAt)}),f.jsx(qo,{label:"Path",value:n.path??"Not on PATH",mono:!!n.path,className:"sm:col-span-2"})]}),f.jsx("div",{className:"flex items-start justify-start lg:justify-end",children:o?f.jsxs(St,{variant:"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:["Upgrade ",o.status]}):c?f.jsxs(wf,{children:[f.jsx(Ef,{asChild:!0,children:f.jsx("button",{type:"button",disabled:m,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})}),f.jsxs(Xs,{children:[f.jsxs(Ks,{children:[f.jsxs(Zs,{children:["Upgrade ",n.label,"?"]}),f.jsxs(Is,{children:["This runs ",n3(n)," on ",l,". Remote nodes execute the command on the remote machine."]})]}),f.jsxs(Qs,{children:[f.jsx(Js,{children:"Cancel"}),f.jsx(Fs,{onClick:()=>i(n),children:"Upgrade"})]})]})]}):d})]}),((p=n.update)==null?void 0:p.detail)&&f.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&&f.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 r3(n,l){var o;return(o=n==null?void 0:n.nodes)!=null&&o.length?n.nodes:l?[l]:[]}function o3(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 i3(n,l){return n.id===l?`${n.name} (this node)`:`${n.name} (${n.role})`}function s3(n){return n==="claude"?"Claude Code":n==="copilot"?"Copilot CLI":"Codex"}function c3(n){var o;const l=(o=n.payload)==null?void 0:o.agent;return l==="claude"||l==="codex"||l==="copilot"?l:null}function u3({cluster:n,systemInfo:l,sseConnected:o,initialSelectedNodeId:i,onRefresh:c}){var ne,le,fe,me,ie,ue,oe,M,Y,I,de,F,R,P,K,W,te,se,ee,ce;const d=v.useMemo(()=>r3(n,l),[n,l]),[m,h]=v.useState(()=>{var J;return i??(l==null?void 0:l.nodeId)??((J=n==null?void 0:n.self)==null?void 0:J.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,N=d.find(J=>J.id===m)??w,T=N?o3(N,l):null,E=!!(l&&N&&N.id===l.nodeId),C=E||!!(N!=null&&N.settingsSnapshot),A=T==null?void 0:T.runtimeUpdate,j=((ne=T==null?void 0:T.startupRequirements)==null?void 0:ne.components)??(T==null?void 0:T.components)??{},O=v.useMemo(()=>d.map(J=>J.id),[d]),z=O.join("\0"),B=z_(d),G=v.useMemo(()=>new Map(d.map(J=>[J.id,J.name])),[B]);v.useEffect(()=>{i&&O.includes(i)&&h(i)},[i,z]);const V=v.useCallback(async(J,ve)=>{const be=s1(J);if(!be||x.current.has(J.id))return;const Se=c3(J),He=(ve==null?void 0:ve.agentLabel)??(Se?s3(Se):"Agent"),je=(ve==null?void 0:ve.nodeName)??G.get(J.nodeId)??J.nodeId;x.current.add(J.id),p($e=>new Map($e).set(be,J));try{const $e=await c1(J);if($e.status==="succeeded")await(c==null?void 0:c()),g.current.has($e.id)||(Ge.success(`${He} upgrade finished on ${je}`),g.current.add($e.id));else if($e.status==="failed")g.current.has($e.id)||(Ge.error(a3($e)??`${He} upgrade failed`),g.current.add($e.id));else{p(dt=>new Map(dt).set(be,$e)),Ge.info(`${He} upgrade is still ${$e.status} on ${je}`);return}p(dt=>{const Pe=new Map(dt),Lt=Pe.get(be);return(!Lt||Lt.id===$e.id)&&Pe.delete(be),Pe})}catch($e){p(dt=>{const Pe=new Map(dt),Lt=Pe.get(be);return(!Lt||Lt.id===J.id)&&Pe.delete(be),Pe}),Ge.error($e instanceof Error?$e.message:`${He} upgrade failed`)}finally{x.current.delete(J.id)}},[c,G]);v.useEffect(()=>{if(O.length===0)return;let J=!1;async function ve(){let be;try{be=await B_(O)}catch{return}if(!J){p(Se=>{const He=new Map(Se);for(const[je,$e]of be)He.set(je,$e);return He});for(const Se of be.values())V(Se)}}return ve(),()=>{J=!0}},[V,z]);async function $(J){if(N)try{const ve=await AE(N.id,J.id);Ge.info(`${J.label} upgrade started on ${N.name}`),await V(ve,{agentLabel:J.label,nodeName:N.name})}catch(ve){Ge.error(ve instanceof Error?ve.message:`${J.label} upgrade failed`)}}return!N||!T?f.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..."}):f.jsxs("div",{className:"space-y-3",children:[f.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&&f.jsxs(St,{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 ",Zt((le=N.settingsSnapshot)==null?void 0:le.collectedAt)]}),f.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-end md:justify-between",children:[f.jsxs("div",{className:"space-y-2",children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[f.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:[f.jsx(C_,{status:N.status}),f.jsx("span",{className:"font-medium text-foreground",children:N.name})]}),f.jsx(A_,{role:N.role}),f.jsx(St,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:N.transportType??T.transportType??"direct"}),f.jsx(St,{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"})]}),f.jsxs("div",{children:[f.jsx("div",{className:"text-[10px] uppercase tracking-[0.34em] text-muted-foreground",children:"Session"}),f.jsx("h3",{className:"mt-0.5 text-sm font-semibold tracking-tight text-foreground",children:"Node runtime"}),f.jsx("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:"Runtime environment, connectivity, and build metadata."})]}),d.length>1&&f.jsxs("div",{className:"w-48 space-y-1.5",children:[f.jsx("div",{className:"text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:"Inspect node"}),f.jsxs(cx,{value:N.id,onValueChange:h,children:[f.jsx(rm,{className:"h-7 rounded-lg border-border/70 bg-background/70 text-[11px]",children:f.jsx(ux,{placeholder:"Choose a node"})}),f.jsx(om,{className:"settings-node-select-content rounded-lg text-[10px] leading-4",children:d.map(J=>f.jsx(Or,{value:J.id,className:"settings-node-select-item py-1 pl-6 pr-2 text-[10px] leading-4 [&>span]:left-1.5 [&_svg]:h-3 [&_svg]:w-3",children:i3(J,l==null?void 0:l.nodeId)},J.id))})]})]})]}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsxs(St,{variant:o?"default":"outline",className:"gap-1 rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:[f.jsx(ON,{className:"h-3 w-3"}),o?"Live link":"Reconnecting"]}),f.jsxs(St,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:["Uptime ",J_(T.uptime)]})]})]})]}),!C&&f.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."}),f.jsxs(d_,{defaultValue:"session",className:"space-y-2",children:[f.jsxs(Ox,{className:"h-auto flex-wrap rounded-xl border border-border/60 bg-muted/40 p-0.5",children:[f.jsx(Os,{value:"session",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"Session"}),f.jsx(Os,{value:"access",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"Access"}),f.jsx(Os,{value:"about",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"About"})]}),f.jsxs(Ps,{value:"session",className:"mt-0 grid gap-2 xl:grid-cols-[1.15fr_0.85fr]",children:[f.jsxs(Yn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(qn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Gn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(Z0,{className:"h-3.5 w-3.5 text-primary"}),"Selected node"]}),f.jsx(Pn,{className:"text-[10px]",children:"Cluster role, identity, and node-scoped runtime state."})]}),f.jsxs(Xn,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(et,{label:"Node ID",value:T.nodeId,mono:!0}),f.jsx(et,{label:"Status",value:N.status}),f.jsx(et,{label:"Role",value:N.role}),f.jsx(et,{label:"Endpoint",value:N.endpoint,mono:!0}),f.jsx(et,{label:"Joined",value:Zt(N.joinedAt)}),f.jsx(et,{label:"Heartbeat",value:Zt(N.lastHeartbeat)}),f.jsx(et,{label:"Capabilities",value:N.capabilities.length>0?N.capabilities.join(", "):"None"})]})]}),f.jsxs(Yn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(qn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Gn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(gN,{className:"h-3.5 w-3.5 text-primary"}),"OS info"]}),f.jsx(Pn,{className:"text-[10px]",children:"Host and resource details reported by the current process."})]}),f.jsxs(Xn,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(et,{label:"Host",value:((fe=T.os)==null?void 0:fe.hostname)??"Unavailable"}),f.jsx(et,{label:"Platform",value:T.os?`${T.os.platform} ${T.os.release}`:"Unavailable"}),f.jsx(et,{label:"Arch",value:((me=T.os)==null?void 0:me.arch)??"Unavailable"}),f.jsx(et,{label:"CPU",value:((ie=T.os)==null?void 0:ie.cpuModel)??"Unavailable"}),f.jsx(et,{label:"Cores",value:String(((ue=T.os)==null?void 0:ue.cpuCount)??"Unavailable")}),f.jsx(et,{label:"Memory",value:T.os?`${s0(T.os.freeMemoryBytes)} free / ${s0(T.os.totalMemoryBytes)} total`:"Unavailable"})]})]}),A&&f.jsx("div",{className:"xl:col-span-2",children:f.jsx(K_,{checkedLabel:Zt(A.checkedAt),disableAuthDefault:((oe=T.auth)==null?void 0:oe.enabled)===void 0?void 0:T.auth.enabled===!1,endpoint:N.endpoint,isLiveLocalNode:E,nodeId:N.id,nodeName:N.name,onRefresh:c,pid:(M=T.runtime)==null?void 0:M.pid,transportType:N.transportType,update:A,workDir:((Y=T.runtime)==null?void 0:Y.workDir)??N.workDir})}),f.jsxs(Yn,{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:[f.jsxs(qn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Gn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(X0,{className:"h-3.5 w-3.5 text-primary"}),"Available agents"]}),f.jsx(Pn,{className:"text-[10px]",children:E?"Live command availability for runtime agents on this node.":"Most recent agent availability snapshot synced from this node."})]}),f.jsx(Xn,{"data-agent-layout":"list",className:"space-y-1.5 px-3 pb-2.5",children:(T.agents??[]).map(J=>f.jsx(l3,{agent:J,nodeName:N.name,activeOperation:y.get(`${N.id}:${J.id}`),onUpgrade:$},J.id))})]})]}),f.jsxs(Ps,{value:"access",className:"mt-0 grid gap-2 xl:grid-cols-2",children:[f.jsxs(Yn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(qn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Gn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(nN,{className:"h-3.5 w-3.5 text-primary"}),"Access surface"]}),f.jsx(Pn,{className:"text-[10px]",children:"How this node is exposed to the dashboard and other peers."})]}),f.jsxs(Xn,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(et,{label:"Transport",value:N.transportType??T.transportType??"direct"}),f.jsx(et,{label:"Node URL",value:N.endpoint,mono:!0}),f.jsx(et,{label:"Node tunnel",value:N.devtunnelEndpoint??"Disabled",mono:!!N.devtunnelEndpoint}),f.jsx(et,{label:"Dashboard URL",value:N.dashboardOrigin??T.localDashboardOrigin??"Unavailable",mono:!!(N.dashboardOrigin||T.localDashboardOrigin)}),f.jsx(et,{label:"Local dashboard",value:T.localDashboardOrigin??"Unavailable",mono:!!T.localDashboardOrigin})]})]}),f.jsxs(Yn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(qn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Gn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(VN,{className:"h-3.5 w-3.5 text-primary"}),"Auth"]}),f.jsx(Pn,{className:"text-[10px]",children:"Current bearer-auth and trusted access posture."})]}),f.jsxs(Xn,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(et,{label:"Enabled",value:(I=T.auth)!=null&&I.enabled?"Yes":"No"}),f.jsx(et,{label:"Same tenant",value:(de=T.auth)!=null&&de.allowSameTenant?"Allowed":"Off"}),f.jsx(et,{label:"Allowed users",value:(F=T.auth)!=null&&F.allowedUsers.length?T.auth.allowedUsers.join(", "):"None"})]})]}),f.jsxs(Yn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(qn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Gn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(xN,{className:"h-3.5 w-3.5 text-primary"}),"Paths"]}),f.jsx(Pn,{className:"text-[10px]",children:"Workspace and runtime paths currently used by this node."})]}),f.jsxs(Xn,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(et,{label:"Work dir",value:((R=T.runtime)==null?void 0:R.workDir)??T.workDir??"Unavailable",mono:!!(((P=T.runtime)==null?void 0:P.workDir)??T.workDir)}),f.jsx(et,{label:"Storage",value:((K=T.runtime)==null?void 0:K.storagePath)??"Unavailable",mono:!!((W=T.runtime)!=null&&W.storagePath)}),f.jsx(et,{label:"Process cwd",value:((te=T.runtime)==null?void 0:te.cwd)??"Unavailable",mono:!!((se=T.runtime)!=null&&se.cwd)}),f.jsx(et,{label:"Started",value:Zt((ee=T.runtime)==null?void 0:ee.startedAt)}),f.jsx(et,{label:"PID",value:T.runtime?String(T.runtime.pid):"Unavailable",mono:!!T.runtime})]})]}),f.jsxs(Yn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(qn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(Gn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(zs,{className:"h-3.5 w-3.5 text-primary"}),"Startup checks"]}),f.jsx(Pn,{className:"text-[10px]",children:"Dependency preflight snapshot persisted during node startup."})]}),f.jsxs(Xn,{className:"space-y-3 px-3 pb-2.5",children:[f.jsxs("div",{className:"rounded-xl border border-border/60 bg-background/70 px-3 py-2",children:[f.jsx("div",{className:"text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:"Last checked"}),f.jsx("div",{className:"mt-0.5 text-[11px] text-foreground",children:Zt((ce=T.startupRequirements)==null?void 0:ce.lastCheckedAt)})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(Yo,{formatDateTime:Zt,name:"Azure CLI",status:j.az,statusVariant:Mr}),f.jsx(Yo,{formatDateTime:Zt,name:"DevTunnel",status:j.devtunnel,statusVariant:Mr}),f.jsx(Yo,{formatDateTime:Zt,name:"Claude Code",status:j.claude,statusVariant:Mr}),f.jsx(Yo,{formatDateTime:Zt,name:"Codex",status:j.codex,statusVariant:Mr}),f.jsx(Yo,{formatDateTime:Zt,name:"Copilot CLI",status:j.copilot,statusVariant:Mr})]})]})]})]}),f.jsx(j_,{formatDateTime:Zt,viewInfo:T})]})]})}function d3({initialSelectedNodeId:n,open:l,onOpenChange:o,showTrigger:i=!0}={}){const{cluster:c,systemInfo:d,sseConnected:m,refresh:h}=G0();return f.jsx(eA,{open:l,onOpenChange:o,showTrigger:i,children:f.jsx(u3,{cluster:c,systemInfo:d,sseConnected:m,initialSelectedNodeId:n,onRefresh:h})})}const SM="codex",wM="bypass",f3=[{value:"codex",label:"Codex",supportsFollowUp:!0},{value:"claudecode",label:"Claude Code",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"}],EM=[{value:"bypass",label:"Bypass"},{value:"plan",label:"Plan"},{value:"edit",label:"Edit"},{value:"dangerous",label:"Dangerous"}],NM=new Set(f3.filter(n=>n.supportsFollowUp).map(n=>n.value)),TM=[{value:"active",label:"Active"},{value:"running",label:"Running"},{value:"waiting",label:"Waiting"},{value:"closed",label:"Closed"},{value:"shared",label:"Shared"},{value:"archived",label:"Archived"}],CM=[{value:"all",label:"All task types"},{value:"native",label:"Native sessions"},{value:"meshy",label:"Meshy chats"}],m3=new Set(["pending","assigned"]),h3=new Set(["running"]),p3=new Set(["completed","failed","cancelled"]),AM=10;function RM(n,l){switch(l){case"running":return h3.has(n.status);case"waiting":return m3.has(n.status);case"closed":return p3.has(n.status);case"shared":return!!n.activeShare;case"archived":return n.status==="archived";case"active":default:return n.status!=="archived"}}function _M(n,l){if(l==="all")return!0;const o=n.conversationKind==="nativeSession";return l==="native"?o:!o}function jM(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 g3(n,l,o){if(!n)return"unassigned";const i=l==null?void 0:l.find(c=>c.id===n);return(i==null?void 0:i.name)??o??n.slice(0,8)}function MM(n,l,o){return g3(n,l,o).toLowerCase()}function OM(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 DM(n,l){return[...n].sort((o,i)=>o.id===l?-1:i.id===l?1:o.name.localeCompare(i.name))}function kM(n){if(!n||typeof n!="object")return null;const l=n,o=l.createMode,i=o==="chat"||o==="native"?o:void 0,c=l.createDefaults,d=c&&typeof c=="object"&&!Array.isArray(c)?c:null,m=d?{assignTo:typeof d.assignTo=="string"||d.assignTo===null?d.assignTo:void 0,project:typeof d.project=="string"||d.project===null?d.project:void 0}: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,createDefaults:m}}function zM(n){return n==="default workspace"?n:n.replace(/\\/g,"/").split("/").filter(Boolean).at(-1)??n}function LM(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 UM(n){return new Date(n).toLocaleString()}function BM(n){const l=Math.floor(n/1e3),o=Math.floor(l/3600),i=Math.floor(l%3600/60),c=l%60;return`${String(o).padStart(2,"0")}:${String(i).padStart(2,"0")}:${String(c).padStart(2,"0")}`}async function v3(n,l="Copied to clipboard"){var o,i,c;try{if((i=(o=globalThis.navigator)==null?void 0:o.clipboard)!=null&&i.writeText)return await globalThis.navigator.clipboard.writeText(n),Ge.success(l),!0;const d=globalThis.document,m=(c=d==null?void 0:d.execCommand)==null?void 0:c.bind(d);if(!(d!=null&&d.body)||typeof d.createElement!="function"||typeof m!="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=m("copy");if(d.body.removeChild(h),p==null||p.focus(),!x)throw new Error("Clipboard access is unavailable");return Ge.success(l),!0}catch(d){return Ge.error(d instanceof Error?d.message:"Failed to copy"),!1}}const y3="default workspace";function Ds(n){const l=n.replace(/\\/g,"/");return l==="/"||/^[A-Za-z]:\/$/.test(l)?l:l.replace(/\/+$/g,"")||l}function b3(n){const l=n.replace(/\\/g,"/");return l.startsWith("/")||l.startsWith("//")||/^[A-Za-z]:\//.test(l)}function x3(n,l){const o=Ds(n),i=l.replace(/\\/g,"/").replace(/^\/+|\/+$/g,"");return!i||i==="."?o:o==="/"||/^[A-Za-z]:\/$/.test(o)?`${o}${i}`:`${o}/${i}`}function S3(n,l){var d,m,h;const o=(d=n.effectiveProjectPath)==null?void 0:d.trim();if(o)return Ds(o);const i=(m=n.project)==null?void 0:m.trim();if(!i)return y3;if(b3(i)||!n.assignedTo)return Ds(i);const c=(h=l==null?void 0:l.get(n.assignedTo))==null?void 0:h.trim();return c?x3(c,i):Ds(i)}function HM(n,l,o,i){const c=new Map;for(const m of n){const h=m.assignedTo??null,y=h??"__unassigned__",p=h?l.get(h)??m.assignedNodeName??h.slice(0,8):"Unassigned",x=S3(m,i);c.has(y)||c.set(y,{nodeId:h,nodeName:p,dirMap:new Map});const g=c.get(y);g.dirMap.has(x)||g.dirMap.set(x,[]),g.dirMap.get(x).push(m)}const d=Array.from(c.values()).map(({nodeId:m,nodeName:h,dirMap:y})=>{const p=Array.from(y.entries()).map(([x,g])=>({path:x,tasks:g})).sort((x,g)=>g.tasks.length-x.tasks.length||x.path.localeCompare(g.path));return{nodeId:m,nodeName:h,dirs:p}});return d.sort((m,h)=>{if(o){if(m.nodeId===o)return-1;if(h.nodeId===o)return 1}return m.nodeId===null?1:h.nodeId===null?-1:m.nodeName.localeCompare(h.nodeName)}),d}const w3={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"},E3={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 N3(n){return n.split(".")[0]??"unknown"}function T3(n){return new Date(n).toLocaleTimeString("en-US",{hour12:!1})}function _r(n,l){return(l==null?void 0:l.get(n))??n}function f1(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`${_r(o.nodeId,l)} left (${o.reason})`;case"node.status":return`${_r(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 ${_r(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 ${_r(i==null?void 0:i.nodeId,l)}`;case"transport.changed":return`${_r(o.nodeId,l)} transport switched to ${o.transportType}`;case"task.created":return`"${o.title}" created`;case"task.assigned":return`task assigned to ${_r(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 C3(n){return JSON.stringify(n,null,2)}function A3({events:n,maxHeight:l="400px",nodeNameById:o,onDismiss:i,density:c="default"}){if(n.length===0)return null;const d=c==="compact";return f.jsx("div",{className:"overflow-y-auto pr-1",style:{maxHeight:l},children:f.jsx("div",{className:"space-y-1.5",children:n.map(m=>{const h=N3(m.type);return f.jsx("div",{className:re("transition-colors hover:bg-muted/30",d?"rounded-sm px-1 py-0.5":"rounded-lg px-1.5 py-1"),children:f.jsxs("div",{className:"space-y-1",children:[f.jsxs("div",{className:"flex items-start justify-between gap-1.5",children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[f.jsx("div",{className:re("font-mono text-muted-foreground",d?"text-[8px]":"text-[9px]"),children:T3(m.timestamp)}),d?f.jsx("span",{className:re("max-w-[8.5rem] truncate text-[7px] font-medium uppercase tracking-[0.08em] text-muted-foreground/70",E3[h]),children:m.type}):f.jsx(St,{variant:"outline",className:re("w-fit text-[9px] font-medium uppercase tracking-[0.14em] px-1.5 py-0",w3[h]),children:m.type})]}),f.jsxs("div",{className:re("flex shrink-0 items-center",d?"gap-px":"gap-0.5"),children:[f.jsx(yn,{type:"button",variant:"ghost",size:"icon",className:re("rounded-sm text-muted-foreground hover:text-foreground",d?"h-3.5 w-3.5 p-0 opacity-65 hover:bg-muted/40 hover:opacity-100 [&_svg]:size-2.5":"h-5 w-5"),onClick:()=>void v3(C3(m),"Event copied"),"aria-label":`Copy ${m.type} event`,title:"Copy event",children:f.jsx(hN,{className:d?"h-2.5 w-2.5":"h-3 w-3"})}),i&&f.jsx(yn,{type:"button",variant:"ghost",size:"icon",className:re("rounded-sm text-muted-foreground hover:text-foreground",d?"h-3.5 w-3.5 p-0 opacity-65 hover:bg-muted/40 hover:opacity-100 [&_svg]:size-2.5":"h-5 w-5"),onClick:()=>i(m.id),"aria-label":`Dismiss ${m.type} event`,title:"Dismiss event",children:f.jsx(J0,{className:d?"h-2.5 w-2.5":"h-3 w-3"})})]})]}),f.jsx("div",{className:"text-[9px] leading-snug text-foreground/85",children:f1(m,o)})]})},m.id)})})})}const R3=["node.","election.","transport."],_3="cluster.state";function j3(n){return n.type==="node.status"?!1:R3.some(l=>n.type.startsWith(l))}function M3(n){return new Date(n).toLocaleTimeString("en-US",{hour12:!1})}function O3(n,l){return n?{time:M3(n.timestamp),text:f1(n,l)}:null}function D3(n){return n.transportType==="devtunnel"||!!n.devtunnelEndpoint}function k3(n){if(n.length===0)return"No node tunnel";const l=n.filter(c=>c.status==="offline").length;if(l>0)return`${l} offline`;const o=n.filter(c=>{var d;return((d=c.devtunnelHealth)==null?void 0:d.status)==="failed"}).length;if(o>0)return`${o} failed`;const i=n.filter(c=>{var d;return c.status!=="offline"&&((d=c.devtunnelHealth)==null?void 0:d.status)!=="healthy"}).length;return i>0?`${i} checking`:"Healthy"}function z3(n,l){var c;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=((c=n.devtunnelHealth)==null?void 0:c.status)??"checking";return{label:o,status:i}}function L3(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 U3(n,l){return{label:(l==null?void 0:l.get(n.id))??n.name??n.id,status:n.status}}function B3({connected:n,events:l,nodes:o=[],currentNode:i=null,nodeNameById:c,desktopUpdate:d=null,defaultOpen:m=!1,defaultActionMenuOpen:h=!1,onDesktopUpdate:y,onDesktopRestart:p,onReload:x,onRestart:g}){const[w,N]=v.useState(m),[T,E]=v.useState(h),[C,A]=v.useState(!0),[j,O]=v.useState(new Set),[z,B]=v.useState(!1),[G,V]=v.useState(!1),$=v.useRef(null),ne=v.useRef(null),le=v.useMemo(()=>l.filter(Ne=>j3(Ne)&&!j.has(Ne.id)),[l,j]),fe=v.useMemo(()=>l.find(Ne=>Ne.type===_3)??le[0],[l,le]),me=v.useMemo(()=>O3(fe,c),[fe,c]),ie=v.useMemo(()=>{const Ne=new Map(o.map(Xe=>[Xe.id,Xe]));return i&&Ne.set(i.id,i),Array.from(Ne.values())},[i,o]),ue=v.useMemo(()=>ie.filter(D3),[ie]),oe=ue.some(Ne=>{var Xe;return Ne.status==="offline"||((Xe=Ne.devtunnelHealth)==null?void 0:Xe.status)==="failed"}),M=ie.some(Ne=>Ne.status==="offline"),Y=ie.some(Ne=>Ne.status==="busy"),I=ie.length>0,de=(i==null?void 0:i.name)??"offline",F=(i==null?void 0:i.role)==="leader"?"Leader":(i==null?void 0:i.role)==="follower"?"Follower":"Node",R=d!==null,P=!!(R&&(d!=null&&d.updateAvailable)&&d.latestVersion),K=(d==null?void 0:d.latestVersion)??null,W=!!(R&&!P&&!K&&(d!=null&&d.detail)),te=z?"Relaunching runtime...":"Relaunch to apply update",se=G?"Downloading and installing desktop update...":P&&K?`Available version ${K}`:W?(d==null?void 0:d.detail)??"Desktop update unavailable":"Desktop is current",ee=!!x,ce=!!(R&&p),J=ee||ce,ve=R||!!g,be=R||!!g||ee,Se=ve?R?"Update":"Relaunch":"Reload",He=ve?R?se:te:"Reload dashboard page",je=ve?R?G:z:!1,$e=ve?R?je||!P||!y:je:!1,dt=R?P&&K?`Install desktop update ${K}`:W?"Desktop update unavailable":"Desktop is current":ve?z?"Relaunching runtime":"Relaunch runtime":"Reload dashboard page";function Pe(){ne.current&&(clearTimeout(ne.current),ne.current=null)}function Lt(){Pe(),N(!0)}function ht(){Pe(),ne.current=setTimeout(()=>{N(!1),ne.current=null},180)}function ol(){Pe()}function il(){Pe(),E(!1),N(!1)}async function Tt(){if(!(!g||z)){B(!0);try{await g()}finally{B(!1)}}}async function jn(){if(!(!P||!y||G)){V(!0);try{await y()}finally{V(!1)}}}async function Ct(){if(!(!p||z)){E(!1),B(!0);try{await p()}finally{B(!1)}}}async function Ul(){if(!ve){await Mn();return}if(R){await jn();return}await Tt()}async function Mn(){x&&(E(!1),await x())}return v.useEffect(()=>()=>{Pe()},[]),v.useEffect(()=>{O(Ne=>{if(Ne.size===0)return Ne;const Xe=new Set(l.map(st=>st.id)),We=new Set(Array.from(Ne).filter(st=>Xe.has(st)));return We.size===Ne.size?Ne:We})},[l]),v.useEffect(()=>{w||E(!1)},[w]),v.useEffect(()=>{if(!w)return;const Ne=We=>{var st;(st=$.current)!=null&&st.contains(We.target)||(Pe(),E(!1),N(!1))},Xe=We=>{We.key==="Escape"&&(Pe(),E(!1),N(!1))};return document.addEventListener("pointerdown",Ne),document.addEventListener("keydown",Xe),()=>{document.removeEventListener("pointerdown",Ne),document.removeEventListener("keydown",Xe)}},[w]),f.jsxs("div",{ref:$,className:"relative",children:[f.jsxs("button",{type:"button","aria-label":n?"Cluster link connected":"Cluster link reconnecting","aria-expanded":w,"aria-haspopup":"dialog",onClick:()=>N(Ne=>!Ne),onMouseEnter:Lt,onMouseLeave:ht,className:re("flex h-8 max-w-[18rem] items-center gap-1.5 rounded-sm px-2 text-[10px] transition-all sm:gap-2 sm:px-2.5 sm:text-[11px]",n?"bg-muted/40 text-muted-foreground hover:bg-muted/60 hover:text-foreground":"bg-destructive/8 text-destructive hover:bg-destructive/12",w&&(n?"bg-muted/60 text-foreground":"bg-destructive/12")),title:n?"Cluster link connected":"Cluster link reconnecting",children:[f.jsxs("span",{className:re("relative flex h-2 w-2 shrink-0"),children:[n&&f.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-60"}),f.jsx("span",{className:re("relative inline-flex h-2 w-2 rounded-full",n?"bg-emerald-500":"bg-destructive")})]}),f.jsxs("span",{className:"hidden min-w-0 items-center gap-2 sm:flex",children:[f.jsx("span",{className:"truncate font-medium text-foreground",children:de}),f.jsx("span",{className:re("shrink-0 rounded border px-1 py-px text-[8px] font-semibold uppercase tracking-[0.1em]",n?"border-emerald-500/25 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300":"border-destructive/30 bg-destructive/10 text-destructive"),children:F})]})]}),w&&f.jsxs("div",{role:"dialog","aria-label":"Live link connection events",onMouseEnter:ol,onMouseLeave:il,className:"absolute right-0 top-[calc(100%+0.4rem)] z-50 w-[18rem] max-w-[calc(100vw-1.5rem)] overflow-hidden rounded-lg 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:[f.jsx("div",{className:"border-b border-border/60 bg-muted/25 px-2.5 py-1.5",children:f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsxs("div",{className:"flex items-center gap-1.5",children:[n?f.jsx(zs,{className:"h-3 w-3 text-emerald-500"}):f.jsx(KN,{className:"h-3 w-3 text-destructive"}),f.jsx("span",{className:"text-[10px] font-semibold text-foreground",children:"Live link"}),f.jsx("span",{className:"text-[9px] text-muted-foreground",children:n?"· SSE connected":"· reconnecting"})]}),f.jsx("div",{className:re("rounded-sm 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"})]})}),f.jsxs("div",{className:"grid grid-cols-2 border-b border-border/60",children:[f.jsxs("div",{className:"border-r border-border/60 px-2.5 py-1.5",children:[f.jsx("div",{className:"text-[8px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"Events"}),f.jsx("div",{className:"mt-0.5 text-base font-semibold tracking-tight text-foreground",children:le.length})]}),f.jsxs("div",{className:"min-w-0 px-2.5 py-1.5",children:[f.jsx("div",{className:"text-[8px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"Latest"}),me?f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"mt-0.5 truncate text-[9px] leading-snug text-foreground/80",children:me.text}),f.jsx("div",{className:"font-mono text-[8px] text-muted-foreground/60",children:me.time})]}):f.jsx("div",{className:"mt-0.5 text-[8px] text-muted-foreground/50",children:"—"})]})]}),f.jsxs("div",{className:"border-b border-border/60 px-2.5 py-1.5",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[M?f.jsx(gs,{className:"h-3 w-3 shrink-0 text-destructive"}):Y?f.jsx(zs,{className:"h-3 w-3 shrink-0 text-amber-500"}):f.jsx(Go,{className:re("h-3 w-3 shrink-0",I?"text-emerald-500":"text-muted-foreground")}),f.jsx("span",{className:"text-[9px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"Node health"})]}),f.jsx("span",{className:re("shrink-0 rounded-sm border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.1em]",M?"border-destructive/30 bg-destructive/10 text-destructive":Y?"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300":I?"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:L3(ie)})]}),ie.length>0&&f.jsx("div",{className:"mt-1.5 flex flex-col gap-0.5",children:ie.map(Ne=>{const{label:Xe,status:We}=U3(Ne,c),st=We==="offline",On=We==="busy";return f.jsxs("div",{"aria-label":`${Xe} ${We}`,className:re("flex items-center justify-between gap-2 rounded-sm px-2 py-0.5",st?"bg-destructive/6":On?"bg-amber-500/6":"bg-emerald-500/5"),title:`${Xe} ${We}`,children:[f.jsx("span",{className:"truncate text-[9px] text-foreground/70",children:Xe}),st?f.jsx(gs,{className:"h-3 w-3 shrink-0 text-destructive"}):On?f.jsx(Ev,{className:"h-3 w-3 shrink-0 text-amber-500"}):f.jsx(Go,{className:"h-3 w-3 shrink-0 text-emerald-500"})]},Ne.id)})})]}),ue.length>0&&f.jsxs("div",{className:"border-b border-border/60 px-2.5 py-1.5",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[oe?f.jsx(gs,{className:"h-3 w-3 shrink-0 text-destructive"}):f.jsx(Go,{className:"h-3 w-3 shrink-0 text-emerald-500"}),f.jsx("span",{className:"text-[9px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:"DevTunnel"})]}),f.jsx("span",{className:re("shrink-0 rounded-sm border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.1em]",oe?"border-destructive/30 bg-destructive/10 text-destructive":"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300"),children:k3(ue)})]}),f.jsx("div",{className:"mt-1.5 flex flex-col gap-0.5",children:ue.map(Ne=>{var kn;const{label:Xe,status:We}=z3(Ne,c),st=We==="failed"||We==="offline",On=We!=="healthy"&&We!=="failed"&&We!=="offline",Dn=(kn=Ne.devtunnelHealth)!=null&&kn.reason?`${Xe} ${We}: ${Ne.devtunnelHealth.reason}`:`${Xe} ${We}`;return f.jsxs("div",{"aria-label":`${Xe} ${We}`,className:re("flex items-center justify-between gap-2 rounded-sm px-2 py-0.5",st?"bg-destructive/6":On?"bg-muted/30":"bg-emerald-500/5"),title:Dn,children:[f.jsx("span",{className:"truncate text-[9px] text-foreground/70",children:Xe}),st?f.jsx(gs,{className:"h-3 w-3 shrink-0 text-destructive"}):On?f.jsx(Ev,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):f.jsx(Go,{className:"h-3 w-3 shrink-0 text-emerald-500"})]},Ne.id)})})]}),f.jsxs("div",{children:[f.jsxs("button",{type:"button",onClick:()=>A(Ne=>!Ne),className:"flex w-full items-center justify-between px-2.5 py-1.5 text-left hover:bg-muted/30",children:[f.jsxs("span",{className:"text-[8px] font-medium uppercase tracking-[0.14em] text-muted-foreground",children:["Notifications ",le.length>0&&`(${le.length})`]}),C?f.jsx(Zo,{className:"h-3 w-3 text-muted-foreground"}):f.jsx(of,{className:"h-3 w-3 text-muted-foreground"})]}),C&&f.jsx("div",{className:"px-2 pb-2",children:f.jsx(A3,{events:le,maxHeight:"12rem",density:"compact",emptyTitle:"No connection events yet",emptyDescription:"Node, election, and system events will appear here.",nodeNameById:c,onDismiss:Ne=>O(Xe=>new Set(Xe).add(Ne))})})]}),R&&(d==null?void 0:d.detail)&&f.jsxs("div",{className:"flex items-center gap-1.5 border-t border-border/60 px-2.5 py-1 text-[8px] text-muted-foreground",children:[f.jsx("span",{className:"shrink-0 font-medium uppercase tracking-[0.12em]",children:"Desktop update"}),f.jsx("span",{className:"truncate",title:d.detail,children:d.detail})]}),f.jsxs("div",{className:"flex items-center justify-between gap-1 border-t border-border/60 px-2.5 py-1",children:[f.jsx("div",{children:be&&f.jsxs("div",{className:"group/restart relative flex items-center",children:[f.jsxs("div",{className:"flex items-center overflow-hidden rounded-sm border border-border/50",children:[f.jsxs(yn,{type:"button",variant:"ghost",size:"sm",className:re("h-5 rounded-none border-0 px-1.5 text-[9px] font-medium hover:text-foreground [&_svg]:size-2.5",P?"bg-primary/12 text-primary hover:bg-primary/18":"bg-background/45 text-muted-foreground hover:bg-emerald-500/10"),onClick:()=>void Ul(),disabled:$e,"aria-label":dt,"aria-describedby":"live-link-restart-hint",title:He,children:[f.jsx(Nv,{className:re("h-2.5 w-2.5",je&&"animate-pulse")}),f.jsx("span",{children:Se})]}),J&&f.jsx(yn,{type:"button",variant:"ghost",size:"sm",className:re("h-5 rounded-none border-l border-border/50 px-1 text-[9px] hover:text-foreground [&_svg]:size-2.5",P?"bg-primary/12 text-primary hover:bg-primary/18":"bg-background/45 text-muted-foreground hover:bg-emerald-500/10"),onClick:()=>E(Ne=>!Ne),"aria-label":"Open live link actions","aria-expanded":T,title:"Live link actions",children:f.jsx(Zo,{className:"h-2.5 w-2.5"})})]}),J&&T&&f.jsxs("div",{className:"absolute bottom-[calc(100%+0.25rem)] left-0 z-20 min-w-28 overflow-hidden rounded-md border border-border/70 bg-background text-[9px] shadow-lg",children:[f.jsxs("button",{type:"button",className:"flex w-full items-center gap-1.5 px-2 py-1 text-left text-muted-foreground hover:bg-muted/55 hover:text-foreground disabled:opacity-45 disabled:hover:bg-transparent disabled:hover:text-muted-foreground",onClick:()=>void Ul(),disabled:$e,"aria-label":dt,children:[f.jsx(Nv,{className:re("h-2.5 w-2.5",je&&"animate-pulse")}),f.jsx("span",{children:Se})]}),ce&&f.jsxs("button",{type:"button",className:"flex w-full items-center gap-1.5 border-t border-border/50 px-2 py-1 text-left text-muted-foreground hover:bg-muted/55 hover:text-foreground disabled:opacity-45 disabled:hover:bg-transparent disabled:hover:text-muted-foreground",onClick:()=>void Ct(),disabled:z,"aria-label":"Restart Meshy Desktop",children:[f.jsx(sf,{className:re("h-2.5 w-2.5",z&&"animate-spin")}),f.jsx("span",{children:"Restart"})]}),ee&&f.jsxs("button",{type:"button",className:"flex w-full items-center gap-1.5 border-t border-border/50 px-2 py-1 text-left text-muted-foreground hover:bg-muted/55 hover:text-foreground",onClick:()=>void Mn(),"aria-label":"Reload dashboard page",children:[f.jsx(sf,{className:"h-2.5 w-2.5"}),f.jsx("span",{children:"Reload"})]})]}),f.jsx("span",{id:"live-link-restart-hint",role:"tooltip",className:"pointer-events-none absolute left-6 top-1/2 z-10 -translate-y-1/2 whitespace-nowrap rounded-sm border border-border/70 bg-background px-1.5 py-0.5 text-[8px] text-muted-foreground opacity-0 shadow-sm transition-opacity group-hover/restart:opacity-100 group-focus-within/restart:opacity-100",children:He})]})}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx(yn,{type:"button",variant:"ghost",size:"sm",className:"h-5 rounded-sm px-1.5 text-[9px]",onClick:()=>O(new Set(l.map(Ne=>Ne.id))),disabled:le.length===0,title:"Dismiss all notifications",children:"Dismiss all"}),f.jsx(yn,{type:"button",variant:"ghost",size:"sm",className:"h-5 rounded-sm px-1.5 text-[9px]",onClick:()=>N(!1),children:"Close"})]})]})]})]})}const c0="dark",zl="fluent",H3="clean",Fd="meshy-layout-default-migrated-to-compact",Nf="true",$3="compact",V3=new Set(["airy","clean","fluent"]);function Y3(n){return n!==null&&V3.has(n)}function gc(n){return n===$3?"fluent":Y3(n)?n:null}function q3(n,l){const o=gc(n);return o===H3&&l!==Nf?zl:o??zl}const Ws="symphony",m1="default",G3=new Set(["light","dark","system"]),P3=new Set(["porcelain","warm","finsight","edge","symphony","launcher"]),h1=v.createContext(null);function X3(n){const l=new URLSearchParams(n).get("theme");return p1(l)?l:null}function K3(n){const l=new URLSearchParams(n).get("palette");return dm(l)}function Q3(n){const l=new URLSearchParams(n).get("layout");return gc(l)}function Z3(){if(typeof document>"u")return null;const n=document.documentElement;return{theme:n.classList.contains("dark")?"dark":"light",palette:dm(n.getAttribute("data-palette"))??Ws,layout:gc(n.getAttribute("data-layout"))??zl}}function $M(n,l=Z3()){if(!l)return n;try{const o=/^[a-z][a-z\d+\-.]*:/i.test(n),i=typeof window<"u"?window.location.href:"http://localhost",c=new URL(n,i);return c.searchParams.set("theme",l.theme),c.searchParams.set("palette",l.palette),c.searchParams.set("layout",l.layout),o?c.toString():`${c.pathname}${c.search}${c.hash}`}catch{return n}}const Jd=.9;function u0(n){const l=n.trim().match(/^(-?\d+(?:\.\d+)?)\s+(-?\d+(?:\.\d+)?)%\s+(-?\d+(?:\.\d+)?)%$/);if(!l)return null;const o=(Number(l[1])%360+360)%360/60,i=ec(Number(l[2])/100,0,1),c=ec(Number(l[3])/100,0,1),d=(1-Math.abs(2*c-1))*i,m=d*(1-Math.abs(o%2-1)),h=c-d/2,[y,p,x]=o<1?[d,m,0]:o<2?[m,d,0]:o<3?[0,d,m]:o<4?[0,m,d]:o<5?[m,0,d]:[d,0,m];return[Math.round((y+h)*255),Math.round((p+h)*255),Math.round((x+h)*255),255]}function I3(n){const l=n.trim();if(!l||l==="transparent")return null;const o=l.match(/^rgba?\(\s*([+-]?\d+(?:\.\d+)?)\s*,\s*([+-]?\d+(?:\.\d+)?)\s*,\s*([+-]?\d+(?:\.\d+)?)(?:\s*,\s*([+-]?\d+(?:\.\d+)?))?\s*\)$/i);if(o)return[jr(Number(o[1])),jr(Number(o[2])),jr(Number(o[3])),m0(o[4])];const i=l.match(/^rgba?\(\s*([+-]?\d+(?:\.\d+)?)\s+([+-]?\d+(?:\.\d+)?)\s+([+-]?\d+(?:\.\d+)?)(?:\s*\/\s*([+-]?\d+(?:\.\d+)?%?))?\s*\)$/i);return i?[jr(Number(i[1])),jr(Number(i[2])),jr(Number(i[3])),m0(i[4])]:null}function F3(n,l,o){const i=u0(n);if(!i)return null;if(o==="clean"||o==="fluent")return i;const c=u0(l);return c?[Wd(i[0],c[0],Jd),Wd(i[1],c[1],Jd),Wd(i[2],c[2],Jd),255]:null}function J3(){const n=document.querySelector(".dashboard-shell-header-panel");if(!n)return null;const l=I3(getComputedStyle(n).backgroundColor);return!l||l[3]===0?null:l}function d0(){var m,h;if(typeof window>"u"||typeof document>"u")return;const n=((h=(m=window.__TAURI__)==null?void 0:m.core)==null?void 0:h.invoke)??null;if(!n)return;const l=document.documentElement,o=l.classList.contains("dark")?"dark":"light",i=getComputedStyle(l),c=gc(l.getAttribute("data-layout"))??zl,d=J3()??F3(i.getPropertyValue("--card"),i.getPropertyValue("--background"),c);n("sync_desktop_theme",{theme:o,backgroundColor:d}).catch(()=>{})}function f0(){if(typeof window>"u")return()=>{};if(d0(),typeof window.requestAnimationFrame!="function")return()=>{};const n=window.requestAnimationFrame(()=>d0());return()=>window.cancelAnimationFrame(n)}function Wd(n,l,o){return Math.round(n*o+l*(1-o))}function ec(n,l,o){return Math.min(Math.max(n,l),o)}function jr(n){return Math.round(ec(n,0,255))}function m0(n){if(n==null||n==="")return 255;const l=n.endsWith("%")?Number(n.slice(0,-1))/100:Number(n);return Math.round(ec(l,0,1)*255)}function W3({children:n}){const[l,o]=v.useState(()=>typeof window<"u"?X3(window.location.search)??nj(localStorage.getItem("meshy-theme"))??c0:c0),[i,c]=v.useState(()=>typeof window<"u"?K3(window.location.search)??aj(localStorage.getItem("meshy-palette"))??Ws:Ws),[d,m]=v.useState(()=>{if(typeof window<"u"){const h=Q3(window.location.search);if(h)return localStorage.setItem(Fd,Nf),h;const y=q3(localStorage.getItem("meshy-layout"),localStorage.getItem(Fd));return localStorage.setItem(Fd,Nf),y}return zl});return v.useEffect(()=>{const h=document.documentElement,y=p=>{if(p==="system"){const x=window.matchMedia("(prefers-color-scheme: dark)").matches;h.classList.toggle("dark",x)}else h.classList.toggle("dark",p==="dark")};if(y(l),localStorage.setItem("meshy-theme",l),l==="system"){const p=window.matchMedia("(prefers-color-scheme: dark)"),x=()=>{y("system"),f0()};return p.addEventListener("change",x),()=>p.removeEventListener("change",x)}},[l]),v.useEffect(()=>{document.documentElement.setAttribute("data-palette",i),localStorage.setItem("meshy-palette",i)},[i]),v.useEffect(()=>{const h=document.documentElement;d===zl?h.removeAttribute("data-layout"):h.setAttribute("data-layout",d),localStorage.setItem("meshy-layout",d)},[d]),v.useEffect(()=>f0(),[l,i,d]),f.jsx(h1.Provider,{value:{theme:l,setTheme:o,palette:i,setPalette:c,layout:d,setLayout:m},children:n})}function ej(){const n=v.useContext(h1);if(!n)throw new Error("useTheme must be used within ThemeProvider");return n}function p1(n){return n!==null&&G3.has(n)}function tj(n){return n!==null&&P3.has(n)}function nj(n){return p1(n)?n:null}function dm(n){return n===m1?"porcelain":tj(n)?n:null}function aj(n){return n===m1?null:dm(n)}const lj=[{value:"light",label:"Light",icon:I0},{value:"dark",label:"Dark",icon:Q0},{value:"system",label:"System",icon:K0}],g1=[{value:"finsight",label:"FinSight",hint:"Cool sage green"},{value:"porcelain",label:"Porcelain",hint:"Blue workspace"},{value:"warm",label:"Warm",hint:"Cream + amber"},{value:"edge",label:"Edge",hint:"Rounded violet panels"},{value:"symphony",label:"Symphony",hint:"Near-black rose accent"},{value:"launcher",label:"Launcher",hint:"Desktop startup blue"}],v1=[{value:"airy",label:"Airy",hint:"Gradients, blur, spacious"},{value:"clean",label:"Clean",hint:"Flat, borders, high density"},{value:"fluent",label:"Fluent",hint:"Compact neutral"}];function rj(){const{theme:n,setTheme:l,palette:o,setPalette:i,layout:c,setLayout:d}=ej(),[m,h]=v.useState(!1),y=v.useRef(null),p=v.useRef(null),x=n==="dark"?Q0:n==="light"?I0:K0,g=()=>{y.current&&(clearTimeout(y.current),y.current=null)},w=()=>{g(),y.current=setTimeout(()=>h(!1),180)};return v.useEffect(()=>{if(!m)return;const N=T=>{p.current&&!p.current.contains(T.target)&&h(!1)};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[m]),v.useEffect(()=>()=>g(),[]),f.jsxs("div",{ref:p,className:"relative",onMouseEnter:()=>{g(),h(!0)},onMouseLeave:w,children:[f.jsx(yn,{variant:"ghost",size:"icon",onClick:()=>h(N=>!N),className:re("h-8 w-8 rounded-sm",o!==Ws||c!==zl?"text-primary":"text-muted-foreground hover:bg-muted/50 hover:text-foreground"),title:"Appearance","aria-haspopup":"menu","aria-expanded":m,children:f.jsx(x,{className:"h-4 w-4"})}),m&&f.jsxs("div",{role:"menu",className:"fixed left-2 right-2 top-[4.25rem] z-50 w-auto max-w-none rounded-md border border-border/70 bg-popover/95 p-2 text-popover-foreground shadow-[0_24px_70px_-32px_rgba(0,0,0,0.45)] backdrop-blur-xl sm:absolute sm:left-auto sm:right-0 sm:top-[calc(100%+6px)] sm:w-[23rem] sm:max-w-[23rem]",children:[f.jsxs("div",{className:"mb-2 flex items-end justify-between gap-2",children:[f.jsxs("div",{children:[f.jsx("div",{className:"text-[8px] font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:"Appearance"}),f.jsxs("div",{className:"text-[10px] font-medium text-foreground",children:[oj(c)," / ",ij(o)]})]}),f.jsx("div",{className:"rounded-sm border border-border/60 bg-background/70 px-1.5 py-0.5 text-[8px] font-medium capitalize text-muted-foreground",children:n})]}),f.jsx("div",{className:"px-0.5 pb-1 text-[8px] font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:"Theme"}),f.jsx("div",{className:"mb-2 grid grid-cols-3 gap-1 rounded-sm bg-muted/35 p-0.5",children:lj.map(({value:N,label:T,icon:E})=>{const C=n===N;return f.jsxs("button",{type:"button",onClick:()=>l(N),role:"menuitemradio","aria-checked":C,className:re("flex min-h-[2.1rem] flex-col items-center justify-center gap-0.5 rounded-sm border px-1.5 py-1 text-[9px] font-medium transition-colors",C?"border-primary/55 bg-background text-primary shadow-sm":"border-transparent text-muted-foreground hover:border-border/70 hover:bg-background/80 hover:text-foreground"),children:[f.jsx(E,{className:"h-3 w-3"}),T]},N)})}),f.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[f.jsxs("div",{children:[f.jsx("div",{className:"px-0.5 pb-1 text-[8px] font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:"Layout"}),f.jsx("div",{className:"space-y-1",children:v1.map(({value:N,label:T,hint:E})=>{const C=c===N;return f.jsxs("button",{type:"button",onClick:()=>d(N),role:"menuitemradio","aria-checked":C,className:re("flex min-h-[2.25rem] w-full items-center gap-1.5 rounded-sm border px-1.5 py-1 text-left transition-colors",C?"border-primary/55 bg-primary/10":"border-border/45 bg-background/45 hover:border-border hover:bg-muted/55"),children:[f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("div",{className:re("text-[10px] font-medium leading-tight",C?"text-primary":"text-foreground"),children:T}),f.jsx("div",{className:"mt-0.5 text-[8px] leading-tight text-muted-foreground",children:E})]}),C&&f.jsx(Ls,{className:"h-3 w-3 text-primary"})]},N)})})]}),f.jsxs("div",{children:[f.jsxs("div",{className:"flex items-center gap-1.5 px-0.5 pb-1 text-[8px] font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:[f.jsx(qN,{className:"h-2.5 w-2.5"}),"Palette"]}),f.jsx("div",{className:"space-y-1",children:g1.map(({value:N,label:T,hint:E})=>{const C=o===N;return f.jsxs("button",{type:"button",onClick:()=>i(N),role:"menuitemradio","aria-checked":C,className:re("flex min-h-[2.25rem] w-full items-center gap-1.5 rounded-sm border px-1.5 py-1 text-left transition-colors",C?"border-primary/55 bg-primary/10":"border-border/45 bg-background/45 hover:border-border hover:bg-muted/55"),children:[f.jsx(sj,{value:N}),f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("div",{className:re("text-[10px] font-medium leading-tight",C?"text-primary":"text-foreground"),children:T}),f.jsx("div",{className:"mt-0.5 text-[8px] leading-tight text-muted-foreground",children:E})]}),C&&f.jsx(Ls,{className:"h-3 w-3 text-primary"})]},N)})})]})]})]})]})}function oj(n){var l;return((l=v1.find(o=>o.value===n))==null?void 0:l.label)??n}function ij(n){var l;return((l=g1.find(o=>o.value===n))==null?void 0:l.label)??n}function sj({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%)"],edge:["hsl(265 75% 55%)","hsl(260 12% 98%)","hsl(285 70% 65%)"],symphony:["hsl(348 100% 71%)","hsl(0 0% 6%)","hsl(240 2% 9%)"],launcher:["hsl(213 77% 49%)","hsl(60 10% 96%)","hsl(0 0% 100%)"]},[o,i,c]=l[n];return f.jsxs("div",{className:re("flex h-5 w-5 shrink-0 overflow-hidden border border-border/60 shadow-sm","rounded-sm"),children:[f.jsx("div",{className:"h-full w-1/3",style:{background:o}}),f.jsx("div",{className:"h-full w-1/3",style:{background:i}}),f.jsx("div",{className:"h-full w-1/3",style:{background:c}})]})}const Xo={tasks:{defaultSize:20,min:16,max:36,wheelStep:1},operations:{defaultSize:20,min:18,max:38,wheelStep:1},terminal:{defaultSize:18,min:10,max:30,wheelStep:1}},y1="meshy-dashboard-panel-state-v2",b1="meshy-dashboard-terminal-open-v1";function VM({operationsOpen:n}){return{layout:{desktopTasksOpen:!0,operationsOpen:n},sizes:{tasks:Xo.tasks.defaultSize,operations:Xo.operations.defaultSize,terminal:Xo.terminal.defaultSize}}}function ef(n){return typeof n=="object"&&n!==null}function h0(n,l){return typeof n=="boolean"?n:l}function tf(n,l,o){return typeof l=="number"&&Number.isFinite(l)?Ko(n,l):o}function Ko(n,l){const o=Xo[n];return Math.min(o.max,Math.max(o.min,l))}function YM(n,l){if(!n)return l;try{const o=n.getItem(y1);if(!o)return l;const i=JSON.parse(o);if(!ef(i))return l;const c=ef(i.layout)?i.layout:{},d=ef(i.sizes)?i.sizes:{};return{layout:{desktopTasksOpen:h0(c.desktopTasksOpen,l.layout.desktopTasksOpen),operationsOpen:h0(c.operationsOpen,l.layout.operationsOpen)},sizes:{tasks:tf("tasks",d.tasks,l.sizes.tasks),operations:tf("operations",d.operations,l.sizes.operations),terminal:tf("terminal",d.terminal,l.sizes.terminal)}}}catch{return l}}function qM(n,l){if(n)try{n.setItem(y1,JSON.stringify(l))}catch{}}function cj(n,l){if(!n)return l;try{const o=n.getItem(b1);return o==="true"?!0:o==="false"?!1:l}catch{return l}}function uj(n,l){if(n)try{n.setItem(b1,String(l))}catch{}}function p0(){var n;try{return((n=globalThis.window)==null?void 0:n.localStorage)??globalThis.localStorage??null}catch{return null}}function GM(n){return`${Number(n.toFixed(2))}rem`}function PM(n,l,o,i,c,d,m){const h=Number.isFinite(m)&&m>0?m:16;return n==="tasks"?Ko(n,l+(c-o)/h):n==="operations"?Ko(n,l+(o-c)/h):Ko(n,l+(i-d)/h)}function XM(n,l,o){const i=o===0?0:o>0?-1:1;return Ko(n,l+i*Xo[n].wheelStep)}const dj=7200*1e3;function fj(){return f.jsxs("svg",{"data-meshy-app-icon":"header",viewBox:"0 0 1024 1024",className:"h-8 w-8","aria-hidden":"true",children:[f.jsxs("defs",{children:[f.jsxs("linearGradient",{id:"meshy-header-icon-bg",x1:"160",y1:"128",x2:"864",y2:"896",gradientUnits:"userSpaceOnUse",children:[f.jsx("stop",{offset:"0",stopColor:"#182033"}),f.jsx("stop",{offset:"1",stopColor:"#0a0f1f"})]}),f.jsxs("linearGradient",{id:"meshy-header-icon-edge",x1:"260",y1:"244",x2:"768",y2:"780",gradientUnits:"userSpaceOnUse",children:[f.jsx("stop",{offset:"0",stopColor:"#66e3ff"}),f.jsx("stop",{offset:"0.52",stopColor:"#8fd56b"}),f.jsx("stop",{offset:"1",stopColor:"#ffcb5b"})]})]}),f.jsx("rect",{width:"1024",height:"1024",rx:"224",fill:"url(#meshy-header-icon-bg)"}),f.jsx("path",{d:"M308 652V372l204 174 204-174v280",fill:"none",stroke:"url(#meshy-header-icon-edge)",strokeWidth:"86",strokeLinecap:"round",strokeLinejoin:"round"}),f.jsx("circle",{cx:"308",cy:"372",r:"58",fill:"#66e3ff"}),f.jsx("circle",{cx:"512",cy:"546",r:"58",fill:"#8fd56b"}),f.jsx("circle",{cx:"716",cy:"372",r:"58",fill:"#ffcb5b"}),f.jsx("circle",{cx:"308",cy:"652",r:"58",fill:"#66e3ff"}),f.jsx("circle",{cx:"716",cy:"652",r:"58",fill:"#ffcb5b"})]})}function Cs(){var n,l;return typeof window>"u"?null:((l=(n=window.__TAURI__)==null?void 0:n.core)==null?void 0:l.invoke)??null}function g0(n){return{currentVersion:null,latestVersion:null,updateAvailable:!1,checkedAt:new Date().toISOString(),releaseUrl:null,assetName:null,installable:!1,detail:n}}function nf(n,l){if(n instanceof Error&&n.message.trim())return n.message;if(typeof n=="string"&&n.trim())return n;if(n&&typeof n=="object"&&"message"in n){const o=n.message;if(typeof o=="string"&&o.trim())return o}return l}function mj(n){return n.openedRelease?"Opened the latest Meshy release page.":n.installMethod==="tauri-updater"?"Installing desktop update. Meshy will relaunch to finish updating.":(n.assetName??"desktop update").toLowerCase().endsWith(".dmg")?"Downloaded desktop update. Open the DMG and drag Meshy to Applications to finish updating.":"Downloaded desktop update. Follow the installer to finish updating."}function hj(){const{cluster:n,events:l,sseConnected:o,systemInfo:i}=G0(),c=Fn(),[d,m]=v.useState(()=>cj(p0(),!1)),[h,y]=v.useState(""),[p,x]=v.useState(null),[g,w]=v.useState(null),N=!!Cs(),T=N?"max-w-none":"max-w-[1760px]",E=c.pathname==="/"||/^\/tasks\/[^/]+$/.test(c.pathname),C=v.useMemo(()=>{const B=new Map;for(const G of(n==null?void 0:n.nodes)??[])B.set(G.id,G.name);return n!=null&&n.self&&B.set(n.self.id,n.self.name),B},[n==null?void 0:n.nodes,n==null?void 0:n.self]),A=v.useCallback(B=>{m(G=>typeof B=="function"?B(G):B)},[]);v.useEffect(()=>{uj(p0(),d)},[d]),v.useEffect(()=>{const B=Cs();if(!B){w(null);return}let G=!1,V=!1;const $=le=>{V||(V=!0,le&&w(g0("Checking desktop update...")),B("check_desktop_update").then(fe=>{G||w(fe)}).catch(fe=>{if(!G){const me=nf(fe,"Desktop update check failed");w(ie=>ie!=null&&ie.updateAvailable?ie:g0(me))}}).finally(()=>{V=!1}))};$(!0);const ne=window.setInterval(()=>$(!1),dj);return()=>{G=!0,window.clearInterval(ne)}},[i==null?void 0:i.version]);async function j(){try{const B=await Y0({reason:"restart"});Ge.info(`Restarting runtime. Follow ${B.logPath} for launch output.`),await u1({previousPid:B.pid})||Ge.error("Runtime restart was accepted, but the dashboard did not reconnect before the timeout.")}catch(B){Ge.error(B instanceof Error?B.message:"Runtime restart failed")}}async function O(){const B=Cs();if(!B){Ge.error("Desktop updater is not available in this window");return}try{Ge.info("Downloading desktop update...");const G=await B("install_desktop_update");Ge.info(mj(G))}catch(G){Ge.error(nf(G,"Desktop update failed"))}}async function z(){const B=Cs();if(!B){Ge.error("Desktop restart is not available in this window");return}try{Ge.info("Restarting Meshy Desktop..."),await B("restart_desktop_app")}catch(G){Ge.error(nf(G,"Desktop restart failed"))}}return f.jsxs("div",{className:"relative h-full overflow-hidden bg-background text-foreground",children:[f.jsx("div",{className:"mesh-grid pointer-events-none absolute inset-0"}),f.jsxs("div",{className:"relative z-10 flex h-full min-h-0 flex-col",children:[f.jsx("header",{className:"dashboard-shell-header relative z-50 shrink-0 px-2 py-2",children:f.jsxs("div",{className:re("dashboard-shell-header-panel dashboard-panel dashboard-panel-muted animate-panel-settle mx-auto flex items-center gap-0 rounded-lg px-3 py-2",T),children:[f.jsx("div",{className:"flex shrink-0 items-center gap-3 pr-3",children:f.jsxs(rf,{to:"/","aria-label":"Meshy home",className:"flex items-center gap-2",children:[f.jsx(fj,{}),f.jsxs("div",{className:"hidden min-w-0 items-baseline gap-1.5 sm:flex",children:[f.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.24em] text-muted-foreground",children:"MESHY"}),f.jsx("span",{className:"truncate text-[13px] font-semibold tracking-tight text-foreground",children:"Workspace"})]})]})}),f.jsx("div",{className:"mx-0 hidden h-4 w-px shrink-0 bg-border/50 md:block"}),E&&f.jsxs("div",{className:"hidden min-w-0 flex-1 items-center px-3 md:flex",children:[p&&f.jsxs("nav",{"aria-label":"Current task location",className:"flex min-w-0 max-w-[38rem] items-center gap-1 rounded-sm bg-background/55 px-2 py-1 text-[10px] text-muted-foreground",children:[f.jsxs("button",{type:"button",onClick:()=>y(p.nodeName),className:"flex min-w-0 items-center gap-1 rounded-sm px-1 py-0.5 hover:bg-muted/60 hover:text-foreground",title:`Filter by ${p.nodeName}`,children:[f.jsx(Z0,{className:"h-3 w-3 shrink-0 text-primary/70"}),f.jsx("span",{className:"max-w-[9rem] truncate",children:p.nodeName})]}),f.jsx(of,{className:"h-3 w-3 shrink-0 text-border/80"}),f.jsxs("button",{type:"button",onClick:()=>y(p.projectLabel),className:"flex min-w-0 items-center gap-1 rounded-sm px-1 py-0.5 hover:bg-muted/60 hover:text-foreground",title:p.projectPath,children:[f.jsx(wN,{className:"h-3 w-3 shrink-0 text-muted-foreground/70"}),f.jsx("span",{className:"max-w-[9rem] truncate",children:p.projectLabel})]}),f.jsx(of,{className:"h-3 w-3 shrink-0 text-border/80"}),f.jsx(rf,{to:`/tasks/${p.taskId}`,className:"min-w-0 truncate px-1 font-medium text-foreground/85 hover:text-foreground",title:p.taskTitle,children:p.taskTitle})]}),f.jsxs("div",{className:"relative ml-auto w-[18rem] max-w-[28rem]",children:[f.jsx(LN,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/60"}),f.jsx(um,{"aria-label":"Search tasks",value:h,onChange:B=>y(B.target.value),placeholder:"Search tasks, nodes, workspaces",className:"h-8 rounded-sm border-0 bg-background/62 pl-8 pr-2 text-[11px] shadow-none focus-visible:ring-0 focus-visible:ring-offset-0"})]})]}),f.jsx("div",{className:"mx-0 hidden h-4 w-px shrink-0 bg-border/50 md:block"}),f.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1.5 pl-3 sm:gap-2 md:ml-0",children:[E&&f.jsx(yn,{variant:"ghost",size:"icon",onClick:()=>A(B=>!B),"aria-label":d?"Close terminal":"Open terminal",title:d?"Close terminal":"Open terminal",className:re("h-8 w-8 rounded-sm text-muted-foreground hover:bg-muted/50 hover:text-foreground",d&&"bg-primary/8 text-primary"),children:f.jsx(F0,{className:"h-4 w-4"})}),f.jsx(d3,{}),f.jsx(rj,{}),f.jsx("div",{className:"mx-0 h-4 w-px shrink-0 bg-border/50"}),f.jsx(B3,{connected:o,events:l,nodes:(n==null?void 0:n.nodes)??[],currentNode:(n==null?void 0:n.self)??null,nodeNameById:C,desktopUpdate:g,onDesktopUpdate:g!=null&&g.updateAvailable?O:void 0,onDesktopRestart:N?z:void 0,onReload:N?()=>window.location.reload():void 0,onRestart:j})]})]})}),f.jsx("main",{className:re("dashboard-shell-main min-h-0 flex-1 px-2 pb-2",E?"overflow-hidden":"overflow-y-auto"),children:f.jsx("div",{className:re("dashboard-shell-content mx-auto h-full min-h-0",T),children:f.jsx(Hw,{context:{terminalOpen:d,setTerminalOpen:A,headerSearchQuery:h,setHeaderSearchQuery:y,setHeaderTaskContext:x}})})})]})]})}const v0=v.lazy(async()=>({default:(await x0(()=>import("./DashboardPage-ByCAcWfg.js").then(l=>l.D),__vite__mapDeps([0,1,2,3,4]))).DashboardPage})),pj=v.lazy(async()=>({default:(await x0(()=>import("./SharedConversationPage-CZL95LnN.js"),__vite__mapDeps([5,1]))).SharedConversationPage}));function gj(){return f.jsx(dE,{children:f.jsx(v.Suspense,{fallback:f.jsx(vj,{}),children:f.jsxs(Vw,{children:[f.jsx(jl,{path:"/shared/tasks/:shareId",element:f.jsx(pj,{})}),f.jsxs(jl,{element:f.jsx(GE,{children:f.jsx(hj,{})}),children:[f.jsx(jl,{path:"/",element:f.jsx(v0,{})}),f.jsx(jl,{path:"/nodes",element:f.jsx(xv,{to:"/",replace:!0})}),f.jsx(jl,{path:"/tasks",element:f.jsx(xv,{to:"/",replace:!0})}),f.jsx(jl,{path:"/tasks/:id",element:f.jsx(v0,{})})]})]})})})}function vj(){return f.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background text-sm text-muted-foreground",children:"Loading workspace..."})}function yj(n){const l=n??(typeof window>"u"?void 0:window);l!=null&&l.__TAURI__&&l.addEventListener("contextmenu",o=>{o.preventDefault()})}function bj(n){return f.jsx(uC,{className:"toaster group",style:{"--normal-bg":"hsl(var(--popover))","--normal-text":"hsl(var(--popover-foreground))","--normal-border":"hsl(var(--border))"},...n})}yj();$2.createRoot(document.getElementById("root")).render(f.jsx(v.StrictMode,{children:f.jsxs(W3,{children:[f.jsx(gj,{}),f.jsx(bj,{})]})}));export{Is as $,Jy as A,yn as B,Ls as C,wM as D,eb as E,xN as F,$M as G,hN as H,um as I,v3 as J,Ox as K,Os as L,g3 as M,X0 as N,d_ as O,bM as P,xM as Q,St as R,Z0 as S,EM as T,UM as U,Ps as V,wf as W,J0 as X,Xs as Y,Ks as Z,Zs as _,pC as a,$j as a$,Qs as a0,Js as a1,Fs as a2,x0 as a3,Nj as a4,Wy as a5,W5 as a6,Uj as a7,F0 as a8,Go as a9,nM as aA,YM as aB,VM as aC,p0 as aD,qM as aE,XM as aF,GM as aG,PM as aH,Gj as aI,UE as aJ,ME as aK,pM as aL,hM as aM,gM as aN,$E as aO,Jj as aP,Rj as aQ,Cj as aR,tb as aS,Aj as aT,_j as aU,CE as aV,d3 as aW,Wj as aX,eM as aY,Yj as aZ,Hj as a_,fN as aa,Lj as ab,Bj as ac,zj as ad,KN as ae,HN as af,WE as ag,CN as ah,ei as ai,DM as aj,ON as ak,A3 as al,C_ as am,yN as an,A_ as ao,BM as ap,m3 as aq,AM as ar,HM as as,TM as at,CM as au,zM as av,i1 as aw,LM as ax,Ef as ay,tM as az,re as b,Vj as b0,qj as b1,Sj as b2,Fn as b3,M0 as b4,xj as b5,G0 as b6,kM as b7,OM as b8,RM as b9,cM as bA,sf as bB,fM as bC,vM as bD,mM as bE,_M as ba,MM as bb,jM as bc,Pj as bd,NM as be,h3 as bf,Ij as bg,Fj as bh,Zj as bi,Qj as bj,Ej as bk,Tj as bl,wj as bm,jj as bn,yM as bo,iM as bp,oM as bq,rM as br,aM as bs,lM as bt,sM as bu,f3 as bv,y0 as bw,iN as bx,dM as by,uM as bz,Be as c,py as d,kj as e,TE as f,Oj as g,Mj as h,wN as i,f as j,of as k,Or as l,Dj as m,Kj as n,cx as o,rm as p,ux as q,v as r,om as s,Ge as t,LN as u,Zo as v,qN as w,SM as x,Xj as y,I5 as z};
@@ -1,4 +1,4 @@
1
- import{c as a}from"./index-AgRF0fhH.js";/**
1
+ import{c as a}from"./index-X_Md_59M.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-AgRF0fhH.js"></script>
9
- <link rel="stylesheet" crossorigin href="/assets/index-BYWN4SLt.css">
8
+ <script type="module" crossorigin src="/assets/index-X_Md_59M.js"></script>
9
+ <link rel="stylesheet" crossorigin href="/assets/index-D2cM8ClO.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.9.1",
3
+ "version": "0.9.2",
4
4
  "private": false,
5
5
  "description": "Standalone Meshy node package with bundled runtime and dashboard assets.",
6
6
  "type": "commonjs",