meshy-node 0.6.10 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DashboardPage-BFq2FfuI.js","assets/DashboardShared-Cp1PtqR4.js","assets/play-BupOIahu.js","assets/DashboardPage-i714dDoR.css","assets/SharedConversationPage-CR-ifEMz.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DashboardPage-wM8CMREX.js","assets/DashboardShared-CwzjyKjD.js","assets/play-B0JrmxjD.js","assets/DashboardPage-i714dDoR.css","assets/SharedConversationPage-DqPIB4y2.js"])))=>i.map(i=>d[i]);
2
2
  function r2(n,l){for(var o=0;o<l.length;o++){const i=l[o];if(typeof i!="string"&&!Array.isArray(i)){for(const u in i)if(u!=="default"&&!(u in n)){const d=Object.getOwnPropertyDescriptor(i,u);d&&Object.defineProperty(n,u,d.get?d:{enumerable:!0,get:()=>i[u]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))i(u);new MutationObserver(u=>{for(const d of u)if(d.type==="childList")for(const m of d.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&i(m)}).observe(document,{childList:!0,subtree:!0});function o(u){const d={};return u.integrity&&(d.integrity=u.integrity),u.referrerPolicy&&(d.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?d.credentials="include":u.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function i(u){if(u.ep)return;u.ep=!0;const d=o(u);fetch(u.href,d)}})();function Zv(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var xd={exports:{}},Oo={};/**
3
3
  * @license React
4
4
  * react-jsx-runtime.production.js
@@ -56,9 +56,9 @@ Error generating stack: `+r.message+`
56
56
  * LICENSE.md file in the root directory of this source tree.
57
57
  *
58
58
  * @license MIT
59
- */var ev="popstate";function tv(n){return typeof n=="object"&&n!=null&&"pathname"in n&&"search"in n&&"hash"in n&&"state"in n&&"key"in n}function v2(n={}){function l(i,u){var p;let d=(p=u.state)==null?void 0:p.masked,{pathname:m,search:h,hash:g}=d||i.location;return Gd("",{pathname:m,search:h,hash:g},u.state&&u.state.usr||null,u.state&&u.state.key||"default",d?{pathname:i.location.pathname,search:i.location.search,hash:i.location.hash}:void 0)}function o(i,u){return typeof u=="string"?u:Yo(u)}return b2(l,o,null,n)}function tt(n,l){if(n===!1||n===null||typeof n>"u")throw new Error(l)}function wn(n,l){if(!n){typeof console<"u"&&console.warn(l);try{throw new Error(l)}catch{}}}function y2(){return Math.random().toString(36).substring(2,10)}function nv(n,l){return{usr:n.state,key:n.key,idx:l,masked:n.unstable_mask?{pathname:n.pathname,search:n.search,hash:n.hash}:void 0}}function Gd(n,l,o=null,i,u){return{pathname:typeof n=="string"?n:n.pathname,search:"",hash:"",...typeof l=="string"?Mr(l):l,state:o,key:l&&l.key||i||y2(),unstable_mask:u}}function Yo({pathname:n="/",search:l="",hash:o=""}){return l&&l!=="?"&&(n+=l.charAt(0)==="?"?l:"?"+l),o&&o!=="#"&&(n+=o.charAt(0)==="#"?o:"#"+o),n}function Mr(n){let l={};if(n){let o=n.indexOf("#");o>=0&&(l.hash=n.substring(o),n=n.substring(0,o));let i=n.indexOf("?");i>=0&&(l.search=n.substring(i),n=n.substring(0,i)),n&&(l.pathname=n)}return l}function b2(n,l,o,i={}){let{window:u=document.defaultView,v5Compat:d=!1}=i,m=u.history,h="POP",g=null,p=x();p==null&&(p=0,m.replaceState({...m.state,idx:p},""));function x(){return(m.state||{idx:null}).idx}function v(){h="POP";let T=x(),R=T==null?null:T-p;p=T,g&&g({action:h,location:N.location,delta:R})}function w(T,R){h="PUSH";let j=tv(T)?T:Gd(N.location,T,R);p=x()+1;let O=nv(j,p),z=N.createHref(j.unstable_mask||j);try{m.pushState(O,"",z)}catch(X){if(X instanceof DOMException&&X.name==="DataCloneError")throw X;u.location.assign(z)}d&&g&&g({action:h,location:N.location,delta:1})}function E(T,R){h="REPLACE";let j=tv(T)?T:Gd(N.location,T,R);p=x();let O=nv(j,p),z=N.createHref(j.unstable_mask||j);m.replaceState(O,"",z),d&&g&&g({action:h,location:N.location,delta:0})}function C(T){return x2(T)}let N={get action(){return h},get location(){return n(u,m)},listen(T){if(g)throw new Error("A history only accepts one active listener");return u.addEventListener(ev,v),g=T,()=>{u.removeEventListener(ev,v),g=null}},createHref(T){return l(u,T)},createURL:C,encodeLocation(T){let R=C(T);return{pathname:R.pathname,search:R.search,hash:R.hash}},push:w,replace:E,go(T){return m.go(T)}};return N}function x2(n,l=!1){let o="http://localhost";typeof window<"u"&&(o=window.location.origin!=="null"?window.location.origin:window.location.href),tt(o,"No window.location.(origin|href) available to create URL");let i=typeof n=="string"?n:Yo(n);return i=i.replace(/ $/,"%20"),!l&&i.startsWith("//")&&(i=o+i),new URL(i,o)}function Jv(n,l,o="/"){return S2(n,l,o,!1)}function S2(n,l,o,i){let u=typeof l=="string"?Mr(l):l,d=ua(u.pathname||"/",o);if(d==null)return null;let m=Wv(n);w2(m);let h=null;for(let g=0;h==null&&g<m.length;++g){let p=D2(d);h=M2(m[g],p,i)}return h}function Wv(n,l=[],o=[],i="",u=!1){let d=(m,h,g=u,p)=>{let x={relativePath:p===void 0?m.path||"":p,caseSensitive:m.caseSensitive===!0,childrenIndex:h,route:m};if(x.relativePath.startsWith("/")){if(!x.relativePath.startsWith(i)&&g)return;tt(x.relativePath.startsWith(i),`Absolute route path "${x.relativePath}" nested under path "${i}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),x.relativePath=x.relativePath.slice(i.length)}let v=Vn([i,x.relativePath]),w=o.concat(x);m.children&&m.children.length>0&&(tt(m.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${v}".`),Wv(m.children,l,w,v,g)),!(m.path==null&&!m.index)&&l.push({path:v,score:_2(v,m.index),routesMeta:w})};return n.forEach((m,h)=>{var g;if(m.path===""||!((g=m.path)!=null&&g.includes("?")))d(m,h);else for(let p of e0(m.path))d(m,h,!0,p)}),l}function e0(n){let l=n.split("/");if(l.length===0)return[];let[o,...i]=l,u=o.endsWith("?"),d=o.replace(/\?$/,"");if(i.length===0)return u?[d,""]:[d];let m=e0(i.join("/")),h=[];return h.push(...m.map(g=>g===""?d:[d,g].join("/"))),u&&h.push(...m),h.map(g=>n.startsWith("/")&&g===""?"/":g)}function w2(n){n.sort((l,o)=>l.score!==o.score?o.score-l.score:j2(l.routesMeta.map(i=>i.childrenIndex),o.routesMeta.map(i=>i.childrenIndex)))}var E2=/^:[\w-]+$/,N2=3,C2=2,T2=1,R2=10,A2=-2,av=n=>n==="*";function _2(n,l){let o=n.split("/"),i=o.length;return o.some(av)&&(i+=A2),l&&(i+=C2),o.filter(u=>!av(u)).reduce((u,d)=>u+(E2.test(d)?N2:d===""?T2:R2),i)}function j2(n,l){return n.length===l.length&&n.slice(0,-1).every((i,u)=>i===l[u])?n[n.length-1]-l[l.length-1]:0}function M2(n,l,o=!1){let{routesMeta:i}=n,u={},d="/",m=[];for(let h=0;h<i.length;++h){let g=i[h],p=h===i.length-1,x=d==="/"?l:l.slice(d.length)||"/",v=Rs({path:g.relativePath,caseSensitive:g.caseSensitive,end:p},x),w=g.route;if(!v&&p&&o&&!i[i.length-1].route.index&&(v=Rs({path:g.relativePath,caseSensitive:g.caseSensitive,end:!1},x)),!v)return null;Object.assign(u,v.params),m.push({params:u,pathname:Vn([d,v.pathname]),pathnameBase:U2(Vn([d,v.pathnameBase])),route:w}),v.pathnameBase!=="/"&&(d=Vn([d,v.pathnameBase]))}return m}function Rs(n,l){typeof n=="string"&&(n={path:n,caseSensitive:!1,end:!0});let[o,i]=O2(n.path,n.caseSensitive,n.end),u=l.match(o);if(!u)return null;let d=u[0],m=d.replace(/(.)\/+$/,"$1"),h=u.slice(1);return{params:i.reduce((p,{paramName:x,isOptional:v},w)=>{if(x==="*"){let C=h[w]||"";m=d.slice(0,d.length-C.length).replace(/(.)\/+$/,"$1")}const E=h[w];return v&&!E?p[x]=void 0:p[x]=(E||"").replace(/%2F/g,"/"),p},{}),pathname:d,pathnameBase:m,pattern:n}}function O2(n,l=!1,o=!0){wn(n==="*"||!n.endsWith("*")||n.endsWith("/*"),`Route path "${n}" will be treated as if it were "${n.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${n.replace(/\*$/,"/*")}".`);let i=[],u="^"+n.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(m,h,g,p,x)=>{if(i.push({paramName:h,isOptional:g!=null}),g){let v=x.charAt(p+m.length);return v&&v!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return n.endsWith("*")?(i.push({paramName:"*"}),u+=n==="*"||n==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):o?u+="\\/*$":n!==""&&n!=="/"&&(u+="(?:(?=\\/|$))"),[new RegExp(u,l?void 0:"i"),i]}function D2(n){try{return n.split("/").map(l=>decodeURIComponent(l).replace(/\//g,"%2F")).join("/")}catch(l){return wn(!1,`The URL path "${n}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${l}).`),n}}function ua(n,l){if(l==="/")return n;if(!n.toLowerCase().startsWith(l.toLowerCase()))return null;let o=l.endsWith("/")?l.length-1:l.length,i=n.charAt(o);return i&&i!=="/"?null:n.slice(o)||"/"}var k2=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function z2(n,l="/"){let{pathname:o,search:i="",hash:u=""}=typeof n=="string"?Mr(n):n,d;return o?(o=o.replace(/\/\/+/g,"/"),o.startsWith("/")?d=lv(o.substring(1),"/"):d=lv(o,l)):d=l,{pathname:d,search:B2(i),hash:H2(u)}}function lv(n,l){let o=l.replace(/\/+$/,"").split("/");return n.split("/").forEach(u=>{u===".."?o.length>1&&o.pop():u!=="."&&o.push(u)}),o.length>1?o.join("/"):"/"}function Td(n,l,o,i){return`Cannot include a '${n}' character in a manually specified \`to.${l}\` field [${JSON.stringify(i)}]. Please separate it out to the \`to.${o}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function L2(n){return n.filter((l,o)=>o===0||l.route.path&&l.route.path.length>0)}function mf(n){let l=L2(n);return l.map((o,i)=>i===l.length-1?o.pathname:o.pathnameBase)}function Ps(n,l,o,i=!1){let u;typeof n=="string"?u=Mr(n):(u={...n},tt(!u.pathname||!u.pathname.includes("?"),Td("?","pathname","search",u)),tt(!u.pathname||!u.pathname.includes("#"),Td("#","pathname","hash",u)),tt(!u.search||!u.search.includes("#"),Td("#","search","hash",u)));let d=n===""||u.pathname==="",m=d?"/":u.pathname,h;if(m==null)h=o;else{let v=l.length-1;if(!i&&m.startsWith("..")){let w=m.split("/");for(;w[0]==="..";)w.shift(),v-=1;u.pathname=w.join("/")}h=v>=0?l[v]:"/"}let g=z2(u,h),p=m&&m!=="/"&&m.endsWith("/"),x=(d||m===".")&&o.endsWith("/");return!g.pathname.endsWith("/")&&(p||x)&&(g.pathname+="/"),g}var Vn=n=>n.join("/").replace(/\/\/+/g,"/"),U2=n=>n.replace(/\/+$/,"").replace(/^\/*/,"/"),B2=n=>!n||n==="?"?"":n.startsWith("?")?n:"?"+n,H2=n=>!n||n==="#"?"":n.startsWith("#")?n:"#"+n,V2=class{constructor(n,l,o,i=!1){this.status=n,this.statusText=l||"",this.internal=i,o instanceof Error?(this.data=o.toString(),this.error=o):this.data=o}};function $2(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.internal=="boolean"&&"data"in n}function Y2(n){return n.map(l=>l.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var t0=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function n0(n,l){let o=n;if(typeof o!="string"||!k2.test(o))return{absoluteURL:void 0,isExternal:!1,to:o};let i=o,u=!1;if(t0)try{let d=new URL(window.location.href),m=o.startsWith("//")?new URL(d.protocol+o):new URL(o),h=ua(m.pathname,l);m.origin===d.origin&&h!=null?o=h+m.search+m.hash:u=!0}catch{wn(!1,`<Link to="${o}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:i,isExternal:u,to:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var a0=["POST","PUT","PATCH","DELETE"];new Set(a0);var q2=["GET",...a0];new Set(q2);var Or=y.createContext(null);Or.displayName="DataRouter";var Qs=y.createContext(null);Qs.displayName="DataRouterState";var G2=y.createContext(!1),l0=y.createContext({isTransitioning:!1});l0.displayName="ViewTransition";var X2=y.createContext(new Map);X2.displayName="Fetchers";var P2=y.createContext(null);P2.displayName="Await";var nn=y.createContext(null);nn.displayName="Navigation";var Xo=y.createContext(null);Xo.displayName="Location";var hn=y.createContext({outlet:null,matches:[],isDataRoute:!1});hn.displayName="Route";var hf=y.createContext(null);hf.displayName="RouteError";var r0="REACT_ROUTER_ERROR",Q2="REDIRECT",K2="ROUTE_ERROR_RESPONSE";function Z2(n){if(n.startsWith(`${r0}:${Q2}:{`))try{let l=JSON.parse(n.slice(28));if(typeof l=="object"&&l&&typeof l.status=="number"&&typeof l.statusText=="string"&&typeof l.location=="string"&&typeof l.reloadDocument=="boolean"&&typeof l.replace=="boolean")return l}catch{}}function I2(n){if(n.startsWith(`${r0}:${K2}:{`))try{let l=JSON.parse(n.slice(40));if(typeof l=="object"&&l&&typeof l.status=="number"&&typeof l.statusText=="string")return new V2(l.status,l.statusText,l.data)}catch{}}function F2(n,{relative:l}={}){tt(Dr(),"useHref() may be used only in the context of a <Router> component.");let{basename:o,navigator:i}=y.useContext(nn),{hash:u,pathname:d,search:m}=Po(n,{relative:l}),h=d;return o!=="/"&&(h=d==="/"?o:Vn([o,d])),i.createHref({pathname:h,search:m,hash:u})}function Dr(){return y.useContext(Xo)!=null}function Yn(){return tt(Dr(),"useLocation() may be used only in the context of a <Router> component."),y.useContext(Xo).location}var o0="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function i0(n){y.useContext(nn).static||y.useLayoutEffect(n)}function s0(){let{isDataRoute:n}=y.useContext(hn);return n?dw():J2()}function J2(){tt(Dr(),"useNavigate() may be used only in the context of a <Router> component.");let n=y.useContext(Or),{basename:l,navigator:o}=y.useContext(nn),{matches:i}=y.useContext(hn),{pathname:u}=Yn(),d=JSON.stringify(mf(i)),m=y.useRef(!1);return i0(()=>{m.current=!0}),y.useCallback((g,p={})=>{if(wn(m.current,o0),!m.current)return;if(typeof g=="number"){o.go(g);return}let x=Ps(g,JSON.parse(d),u,p.relative==="path");n==null&&l!=="/"&&(x.pathname=x.pathname==="/"?l:Vn([l,x.pathname])),(p.replace?o.replace:o.push)(x,p.state,p)},[l,o,d,u,n])}var c0=y.createContext(null);function H3(){return y.useContext(c0)}function W2(n){let l=y.useContext(hn).outlet;return y.useMemo(()=>l&&y.createElement(c0.Provider,{value:n},l),[l,n])}function V3(){let{matches:n}=y.useContext(hn),l=n[n.length-1];return l?l.params:{}}function Po(n,{relative:l}={}){let{matches:o}=y.useContext(hn),{pathname:i}=Yn(),u=JSON.stringify(mf(o));return y.useMemo(()=>Ps(n,JSON.parse(u),i,l==="path"),[n,u,i,l])}function ew(n,l){return u0(n,l)}function u0(n,l,o){var T;tt(Dr(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:i}=y.useContext(nn),{matches:u}=y.useContext(hn),d=u[u.length-1],m=d?d.params:{},h=d?d.pathname:"/",g=d?d.pathnameBase:"/",p=d&&d.route;{let R=p&&p.path||"";f0(h,!p||R.endsWith("*")||R.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${h}" (under <Route path="${R}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
59
+ */var ev="popstate";function tv(n){return typeof n=="object"&&n!=null&&"pathname"in n&&"search"in n&&"hash"in n&&"state"in n&&"key"in n}function v2(n={}){function l(i,u){var p;let d=(p=u.state)==null?void 0:p.masked,{pathname:m,search:h,hash:g}=d||i.location;return Gd("",{pathname:m,search:h,hash:g},u.state&&u.state.usr||null,u.state&&u.state.key||"default",d?{pathname:i.location.pathname,search:i.location.search,hash:i.location.hash}:void 0)}function o(i,u){return typeof u=="string"?u:Yo(u)}return b2(l,o,null,n)}function tt(n,l){if(n===!1||n===null||typeof n>"u")throw new Error(l)}function wn(n,l){if(!n){typeof console<"u"&&console.warn(l);try{throw new Error(l)}catch{}}}function y2(){return Math.random().toString(36).substring(2,10)}function nv(n,l){return{usr:n.state,key:n.key,idx:l,masked:n.unstable_mask?{pathname:n.pathname,search:n.search,hash:n.hash}:void 0}}function Gd(n,l,o=null,i,u){return{pathname:typeof n=="string"?n:n.pathname,search:"",hash:"",...typeof l=="string"?Mr(l):l,state:o,key:l&&l.key||i||y2(),unstable_mask:u}}function Yo({pathname:n="/",search:l="",hash:o=""}){return l&&l!=="?"&&(n+=l.charAt(0)==="?"?l:"?"+l),o&&o!=="#"&&(n+=o.charAt(0)==="#"?o:"#"+o),n}function Mr(n){let l={};if(n){let o=n.indexOf("#");o>=0&&(l.hash=n.substring(o),n=n.substring(0,o));let i=n.indexOf("?");i>=0&&(l.search=n.substring(i),n=n.substring(0,i)),n&&(l.pathname=n)}return l}function b2(n,l,o,i={}){let{window:u=document.defaultView,v5Compat:d=!1}=i,m=u.history,h="POP",g=null,p=x();p==null&&(p=0,m.replaceState({...m.state,idx:p},""));function x(){return(m.state||{idx:null}).idx}function v(){h="POP";let T=x(),R=T==null?null:T-p;p=T,g&&g({action:h,location:N.location,delta:R})}function w(T,R){h="PUSH";let j=tv(T)?T:Gd(N.location,T,R);p=x()+1;let O=nv(j,p),z=N.createHref(j.unstable_mask||j);try{m.pushState(O,"",z)}catch(X){if(X instanceof DOMException&&X.name==="DataCloneError")throw X;u.location.assign(z)}d&&g&&g({action:h,location:N.location,delta:1})}function E(T,R){h="REPLACE";let j=tv(T)?T:Gd(N.location,T,R);p=x();let O=nv(j,p),z=N.createHref(j.unstable_mask||j);m.replaceState(O,"",z),d&&g&&g({action:h,location:N.location,delta:0})}function C(T){return x2(T)}let N={get action(){return h},get location(){return n(u,m)},listen(T){if(g)throw new Error("A history only accepts one active listener");return u.addEventListener(ev,v),g=T,()=>{u.removeEventListener(ev,v),g=null}},createHref(T){return l(u,T)},createURL:C,encodeLocation(T){let R=C(T);return{pathname:R.pathname,search:R.search,hash:R.hash}},push:w,replace:E,go(T){return m.go(T)}};return N}function x2(n,l=!1){let o="http://localhost";typeof window<"u"&&(o=window.location.origin!=="null"?window.location.origin:window.location.href),tt(o,"No window.location.(origin|href) available to create URL");let i=typeof n=="string"?n:Yo(n);return i=i.replace(/ $/,"%20"),!l&&i.startsWith("//")&&(i=o+i),new URL(i,o)}function Jv(n,l,o="/"){return S2(n,l,o,!1)}function S2(n,l,o,i){let u=typeof l=="string"?Mr(l):l,d=ua(u.pathname||"/",o);if(d==null)return null;let m=Wv(n);w2(m);let h=null;for(let g=0;h==null&&g<m.length;++g){let p=D2(d);h=M2(m[g],p,i)}return h}function Wv(n,l=[],o=[],i="",u=!1){let d=(m,h,g=u,p)=>{let x={relativePath:p===void 0?m.path||"":p,caseSensitive:m.caseSensitive===!0,childrenIndex:h,route:m};if(x.relativePath.startsWith("/")){if(!x.relativePath.startsWith(i)&&g)return;tt(x.relativePath.startsWith(i),`Absolute route path "${x.relativePath}" nested under path "${i}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),x.relativePath=x.relativePath.slice(i.length)}let v=Vn([i,x.relativePath]),w=o.concat(x);m.children&&m.children.length>0&&(tt(m.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${v}".`),Wv(m.children,l,w,v,g)),!(m.path==null&&!m.index)&&l.push({path:v,score:_2(v,m.index),routesMeta:w})};return n.forEach((m,h)=>{var g;if(m.path===""||!((g=m.path)!=null&&g.includes("?")))d(m,h);else for(let p of e0(m.path))d(m,h,!0,p)}),l}function e0(n){let l=n.split("/");if(l.length===0)return[];let[o,...i]=l,u=o.endsWith("?"),d=o.replace(/\?$/,"");if(i.length===0)return u?[d,""]:[d];let m=e0(i.join("/")),h=[];return h.push(...m.map(g=>g===""?d:[d,g].join("/"))),u&&h.push(...m),h.map(g=>n.startsWith("/")&&g===""?"/":g)}function w2(n){n.sort((l,o)=>l.score!==o.score?o.score-l.score:j2(l.routesMeta.map(i=>i.childrenIndex),o.routesMeta.map(i=>i.childrenIndex)))}var E2=/^:[\w-]+$/,N2=3,C2=2,T2=1,R2=10,A2=-2,av=n=>n==="*";function _2(n,l){let o=n.split("/"),i=o.length;return o.some(av)&&(i+=A2),l&&(i+=C2),o.filter(u=>!av(u)).reduce((u,d)=>u+(E2.test(d)?N2:d===""?T2:R2),i)}function j2(n,l){return n.length===l.length&&n.slice(0,-1).every((i,u)=>i===l[u])?n[n.length-1]-l[l.length-1]:0}function M2(n,l,o=!1){let{routesMeta:i}=n,u={},d="/",m=[];for(let h=0;h<i.length;++h){let g=i[h],p=h===i.length-1,x=d==="/"?l:l.slice(d.length)||"/",v=Rs({path:g.relativePath,caseSensitive:g.caseSensitive,end:p},x),w=g.route;if(!v&&p&&o&&!i[i.length-1].route.index&&(v=Rs({path:g.relativePath,caseSensitive:g.caseSensitive,end:!1},x)),!v)return null;Object.assign(u,v.params),m.push({params:u,pathname:Vn([d,v.pathname]),pathnameBase:U2(Vn([d,v.pathnameBase])),route:w}),v.pathnameBase!=="/"&&(d=Vn([d,v.pathnameBase]))}return m}function Rs(n,l){typeof n=="string"&&(n={path:n,caseSensitive:!1,end:!0});let[o,i]=O2(n.path,n.caseSensitive,n.end),u=l.match(o);if(!u)return null;let d=u[0],m=d.replace(/(.)\/+$/,"$1"),h=u.slice(1);return{params:i.reduce((p,{paramName:x,isOptional:v},w)=>{if(x==="*"){let C=h[w]||"";m=d.slice(0,d.length-C.length).replace(/(.)\/+$/,"$1")}const E=h[w];return v&&!E?p[x]=void 0:p[x]=(E||"").replace(/%2F/g,"/"),p},{}),pathname:d,pathnameBase:m,pattern:n}}function O2(n,l=!1,o=!0){wn(n==="*"||!n.endsWith("*")||n.endsWith("/*"),`Route path "${n}" will be treated as if it were "${n.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${n.replace(/\*$/,"/*")}".`);let i=[],u="^"+n.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(m,h,g,p,x)=>{if(i.push({paramName:h,isOptional:g!=null}),g){let v=x.charAt(p+m.length);return v&&v!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return n.endsWith("*")?(i.push({paramName:"*"}),u+=n==="*"||n==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):o?u+="\\/*$":n!==""&&n!=="/"&&(u+="(?:(?=\\/|$))"),[new RegExp(u,l?void 0:"i"),i]}function D2(n){try{return n.split("/").map(l=>decodeURIComponent(l).replace(/\//g,"%2F")).join("/")}catch(l){return wn(!1,`The URL path "${n}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${l}).`),n}}function ua(n,l){if(l==="/")return n;if(!n.toLowerCase().startsWith(l.toLowerCase()))return null;let o=l.endsWith("/")?l.length-1:l.length,i=n.charAt(o);return i&&i!=="/"?null:n.slice(o)||"/"}var k2=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function z2(n,l="/"){let{pathname:o,search:i="",hash:u=""}=typeof n=="string"?Mr(n):n,d;return o?(o=o.replace(/\/\/+/g,"/"),o.startsWith("/")?d=lv(o.substring(1),"/"):d=lv(o,l)):d=l,{pathname:d,search:B2(i),hash:H2(u)}}function lv(n,l){let o=l.replace(/\/+$/,"").split("/");return n.split("/").forEach(u=>{u===".."?o.length>1&&o.pop():u!=="."&&o.push(u)}),o.length>1?o.join("/"):"/"}function Td(n,l,o,i){return`Cannot include a '${n}' character in a manually specified \`to.${l}\` field [${JSON.stringify(i)}]. Please separate it out to the \`to.${o}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function L2(n){return n.filter((l,o)=>o===0||l.route.path&&l.route.path.length>0)}function mf(n){let l=L2(n);return l.map((o,i)=>i===l.length-1?o.pathname:o.pathnameBase)}function Ps(n,l,o,i=!1){let u;typeof n=="string"?u=Mr(n):(u={...n},tt(!u.pathname||!u.pathname.includes("?"),Td("?","pathname","search",u)),tt(!u.pathname||!u.pathname.includes("#"),Td("#","pathname","hash",u)),tt(!u.search||!u.search.includes("#"),Td("#","search","hash",u)));let d=n===""||u.pathname==="",m=d?"/":u.pathname,h;if(m==null)h=o;else{let v=l.length-1;if(!i&&m.startsWith("..")){let w=m.split("/");for(;w[0]==="..";)w.shift(),v-=1;u.pathname=w.join("/")}h=v>=0?l[v]:"/"}let g=z2(u,h),p=m&&m!=="/"&&m.endsWith("/"),x=(d||m===".")&&o.endsWith("/");return!g.pathname.endsWith("/")&&(p||x)&&(g.pathname+="/"),g}var Vn=n=>n.join("/").replace(/\/\/+/g,"/"),U2=n=>n.replace(/\/+$/,"").replace(/^\/*/,"/"),B2=n=>!n||n==="?"?"":n.startsWith("?")?n:"?"+n,H2=n=>!n||n==="#"?"":n.startsWith("#")?n:"#"+n,V2=class{constructor(n,l,o,i=!1){this.status=n,this.statusText=l||"",this.internal=i,o instanceof Error?(this.data=o.toString(),this.error=o):this.data=o}};function $2(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.internal=="boolean"&&"data"in n}function Y2(n){return n.map(l=>l.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var t0=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function n0(n,l){let o=n;if(typeof o!="string"||!k2.test(o))return{absoluteURL:void 0,isExternal:!1,to:o};let i=o,u=!1;if(t0)try{let d=new URL(window.location.href),m=o.startsWith("//")?new URL(d.protocol+o):new URL(o),h=ua(m.pathname,l);m.origin===d.origin&&h!=null?o=h+m.search+m.hash:u=!0}catch{wn(!1,`<Link to="${o}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:i,isExternal:u,to:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var a0=["POST","PUT","PATCH","DELETE"];new Set(a0);var q2=["GET",...a0];new Set(q2);var Or=y.createContext(null);Or.displayName="DataRouter";var Qs=y.createContext(null);Qs.displayName="DataRouterState";var G2=y.createContext(!1),l0=y.createContext({isTransitioning:!1});l0.displayName="ViewTransition";var X2=y.createContext(new Map);X2.displayName="Fetchers";var P2=y.createContext(null);P2.displayName="Await";var nn=y.createContext(null);nn.displayName="Navigation";var Xo=y.createContext(null);Xo.displayName="Location";var hn=y.createContext({outlet:null,matches:[],isDataRoute:!1});hn.displayName="Route";var hf=y.createContext(null);hf.displayName="RouteError";var r0="REACT_ROUTER_ERROR",Q2="REDIRECT",K2="ROUTE_ERROR_RESPONSE";function Z2(n){if(n.startsWith(`${r0}:${Q2}:{`))try{let l=JSON.parse(n.slice(28));if(typeof l=="object"&&l&&typeof l.status=="number"&&typeof l.statusText=="string"&&typeof l.location=="string"&&typeof l.reloadDocument=="boolean"&&typeof l.replace=="boolean")return l}catch{}}function I2(n){if(n.startsWith(`${r0}:${K2}:{`))try{let l=JSON.parse(n.slice(40));if(typeof l=="object"&&l&&typeof l.status=="number"&&typeof l.statusText=="string")return new V2(l.status,l.statusText,l.data)}catch{}}function F2(n,{relative:l}={}){tt(Dr(),"useHref() may be used only in the context of a <Router> component.");let{basename:o,navigator:i}=y.useContext(nn),{hash:u,pathname:d,search:m}=Po(n,{relative:l}),h=d;return o!=="/"&&(h=d==="/"?o:Vn([o,d])),i.createHref({pathname:h,search:m,hash:u})}function Dr(){return y.useContext(Xo)!=null}function Yn(){return tt(Dr(),"useLocation() may be used only in the context of a <Router> component."),y.useContext(Xo).location}var o0="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function i0(n){y.useContext(nn).static||y.useLayoutEffect(n)}function s0(){let{isDataRoute:n}=y.useContext(hn);return n?dw():J2()}function J2(){tt(Dr(),"useNavigate() may be used only in the context of a <Router> component.");let n=y.useContext(Or),{basename:l,navigator:o}=y.useContext(nn),{matches:i}=y.useContext(hn),{pathname:u}=Yn(),d=JSON.stringify(mf(i)),m=y.useRef(!1);return i0(()=>{m.current=!0}),y.useCallback((g,p={})=>{if(wn(m.current,o0),!m.current)return;if(typeof g=="number"){o.go(g);return}let x=Ps(g,JSON.parse(d),u,p.relative==="path");n==null&&l!=="/"&&(x.pathname=x.pathname==="/"?l:Vn([l,x.pathname])),(p.replace?o.replace:o.push)(x,p.state,p)},[l,o,d,u,n])}var c0=y.createContext(null);function V3(){return y.useContext(c0)}function W2(n){let l=y.useContext(hn).outlet;return y.useMemo(()=>l&&y.createElement(c0.Provider,{value:n},l),[l,n])}function $3(){let{matches:n}=y.useContext(hn),l=n[n.length-1];return l?l.params:{}}function Po(n,{relative:l}={}){let{matches:o}=y.useContext(hn),{pathname:i}=Yn(),u=JSON.stringify(mf(o));return y.useMemo(()=>Ps(n,JSON.parse(u),i,l==="path"),[n,u,i,l])}function ew(n,l){return u0(n,l)}function u0(n,l,o){var T;tt(Dr(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:i}=y.useContext(nn),{matches:u}=y.useContext(hn),d=u[u.length-1],m=d?d.params:{},h=d?d.pathname:"/",g=d?d.pathnameBase:"/",p=d&&d.route;{let R=p&&p.path||"";f0(h,!p||R.endsWith("*")||R.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${h}" (under <Route path="${R}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
60
60
 
61
- Please change the parent <Route path="${R}"> to <Route path="${R==="/"?"*":`${R}/*`}">.`)}let x=Yn(),v;if(l){let R=typeof l=="string"?Mr(l):l;tt(g==="/"||((T=R.pathname)==null?void 0:T.startsWith(g)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${g}" but pathname "${R.pathname}" was given in the \`location\` prop.`),v=R}else v=x;let w=v.pathname||"/",E=w;if(g!=="/"){let R=g.replace(/^\//,"").split("/");E="/"+w.replace(/^\//,"").split("/").slice(R.length).join("/")}let C=Jv(n,{pathname:E});wn(p||C!=null,`No routes matched location "${v.pathname}${v.search}${v.hash}" `),wn(C==null||C[C.length-1].route.element!==void 0||C[C.length-1].route.Component!==void 0||C[C.length-1].route.lazy!==void 0,`Matched leaf route at location "${v.pathname}${v.search}${v.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let N=rw(C&&C.map(R=>Object.assign({},R,{params:Object.assign({},m,R.params),pathname:Vn([g,i.encodeLocation?i.encodeLocation(R.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:R.pathname]),pathnameBase:R.pathnameBase==="/"?g:Vn([g,i.encodeLocation?i.encodeLocation(R.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:R.pathnameBase])})),u,o);return l&&N?y.createElement(Xo.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...v},navigationType:"POP"}},N):N}function tw(){let n=uw(),l=$2(n)?`${n.status} ${n.statusText}`:n instanceof Error?n.message:JSON.stringify(n),o=n instanceof Error?n.stack:null,i="rgba(200,200,200, 0.5)",u={padding:"0.5rem",backgroundColor:i},d={padding:"2px 4px",backgroundColor:i},m=null;return console.error("Error handled by React Router default ErrorBoundary:",n),m=y.createElement(y.Fragment,null,y.createElement("p",null,"💿 Hey developer 👋"),y.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",y.createElement("code",{style:d},"ErrorBoundary")," or"," ",y.createElement("code",{style:d},"errorElement")," prop on your route.")),y.createElement(y.Fragment,null,y.createElement("h2",null,"Unexpected Application Error!"),y.createElement("h3",{style:{fontStyle:"italic"}},l),o?y.createElement("pre",{style:u},o):null,m)}var nw=y.createElement(tw,null),d0=class extends y.Component{constructor(n){super(n),this.state={location:n.location,revalidation:n.revalidation,error:n.error}}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,l){return l.location!==n.location||l.revalidation!=="idle"&&n.revalidation==="idle"?{error:n.error,location:n.location,revalidation:n.revalidation}:{error:n.error!==void 0?n.error:l.error,location:l.location,revalidation:n.revalidation||l.revalidation}}componentDidCatch(n,l){this.props.onError?this.props.onError(n,l):console.error("React Router caught the following error during render",n)}render(){let n=this.state.error;if(this.context&&typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){const o=I2(n.digest);o&&(n=o)}let l=n!==void 0?y.createElement(hn.Provider,{value:this.props.routeContext},y.createElement(hf.Provider,{value:n,children:this.props.component})):this.props.children;return this.context?y.createElement(aw,{error:n},l):l}};d0.contextType=G2;var Rd=new WeakMap;function aw({children:n,error:l}){let{basename:o}=y.useContext(nn);if(typeof l=="object"&&l&&"digest"in l&&typeof l.digest=="string"){let i=Z2(l.digest);if(i){let u=Rd.get(l);if(u)throw u;let d=n0(i.location,o);if(t0&&!Rd.get(l))if(d.isExternal||i.reloadDocument)window.location.href=d.absoluteURL||d.to;else{const m=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(d.to,{replace:i.replace}));throw Rd.set(l,m),m}return y.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d.absoluteURL||d.to}`})}}return n}function lw({routeContext:n,match:l,children:o}){let i=y.useContext(Or);return i&&i.static&&i.staticContext&&(l.route.errorElement||l.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=l.route.id),y.createElement(hn.Provider,{value:n},o)}function rw(n,l=[],o){let i=o==null?void 0:o.state;if(n==null){if(!i)return null;if(i.errors)n=i.matches;else if(l.length===0&&!i.initialized&&i.matches.length>0)n=i.matches;else return null}let u=n,d=i==null?void 0:i.errors;if(d!=null){let x=u.findIndex(v=>v.route.id&&(d==null?void 0:d[v.route.id])!==void 0);tt(x>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(d).join(",")}`),u=u.slice(0,Math.min(u.length,x+1))}let m=!1,h=-1;if(o&&i){m=i.renderFallback;for(let x=0;x<u.length;x++){let v=u[x];if((v.route.HydrateFallback||v.route.hydrateFallbackElement)&&(h=x),v.route.id){let{loaderData:w,errors:E}=i,C=v.route.loader&&!w.hasOwnProperty(v.route.id)&&(!E||E[v.route.id]===void 0);if(v.route.lazy||C){o.isStatic&&(m=!0),h>=0?u=u.slice(0,h+1):u=[u[0]];break}}}}let g=o==null?void 0:o.onError,p=i&&g?(x,v)=>{var w,E;g(x,{location:i.location,params:((E=(w=i.matches)==null?void 0:w[0])==null?void 0:E.params)??{},unstable_pattern:Y2(i.matches),errorInfo:v})}:void 0;return u.reduceRight((x,v,w)=>{let E,C=!1,N=null,T=null;i&&(E=d&&v.route.id?d[v.route.id]:void 0,N=v.route.errorElement||nw,m&&(h<0&&w===0?(f0("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),C=!0,T=null):h===w&&(C=!0,T=v.route.hydrateFallbackElement||null)));let R=l.concat(u.slice(0,w+1)),j=()=>{let O;return E?O=N:C?O=T:v.route.Component?O=y.createElement(v.route.Component,null):v.route.element?O=v.route.element:O=x,y.createElement(lw,{match:v,routeContext:{outlet:x,matches:R,isDataRoute:i!=null},children:O})};return i&&(v.route.ErrorBoundary||v.route.errorElement||w===0)?y.createElement(d0,{location:i.location,revalidation:i.revalidation,component:N,error:E,children:j(),routeContext:{outlet:null,matches:R,isDataRoute:!0},onError:p}):j()},null)}function pf(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ow(n){let l=y.useContext(Or);return tt(l,pf(n)),l}function iw(n){let l=y.useContext(Qs);return tt(l,pf(n)),l}function sw(n){let l=y.useContext(hn);return tt(l,pf(n)),l}function gf(n){let l=sw(n),o=l.matches[l.matches.length-1];return tt(o.route.id,`${n} can only be used on routes that contain a unique "id"`),o.route.id}function cw(){return gf("useRouteId")}function uw(){var i;let n=y.useContext(hf),l=iw("useRouteError"),o=gf("useRouteError");return n!==void 0?n:(i=l.errors)==null?void 0:i[o]}function dw(){let{router:n}=ow("useNavigate"),l=gf("useNavigate"),o=y.useRef(!1);return i0(()=>{o.current=!0}),y.useCallback(async(u,d={})=>{wn(o.current,o0),o.current&&(typeof u=="number"?await n.navigate(u):await n.navigate(u,{fromRouteId:l,...d}))},[n,l])}var rv={};function f0(n,l,o){!l&&!rv[n]&&(rv[n]=!0,wn(!1,o))}y.memo(fw);function fw({routes:n,future:l,state:o,isStatic:i,onError:u}){return u0(n,void 0,{state:o,isStatic:i,onError:u})}function ov({to:n,replace:l,state:o,relative:i}){tt(Dr(),"<Navigate> may be used only in the context of a <Router> component.");let{static:u}=y.useContext(nn);wn(!u,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:d}=y.useContext(hn),{pathname:m}=Yn(),h=s0(),g=Ps(n,mf(d),m,i==="path"),p=JSON.stringify(g);return y.useEffect(()=>{h(JSON.parse(p),{replace:l,state:o,relative:i})},[h,p,i,l,o]),null}function mw(n){return W2(n.context)}function Cl(n){tt(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function hw({basename:n="/",children:l=null,location:o,navigationType:i="POP",navigator:u,static:d=!1,unstable_useTransitions:m}){tt(!Dr(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let h=n.replace(/^\/*/,"/"),g=y.useMemo(()=>({basename:h,navigator:u,static:d,unstable_useTransitions:m,future:{}}),[h,u,d,m]);typeof o=="string"&&(o=Mr(o));let{pathname:p="/",search:x="",hash:v="",state:w=null,key:E="default",unstable_mask:C}=o,N=y.useMemo(()=>{let T=ua(p,h);return T==null?null:{location:{pathname:T,search:x,hash:v,state:w,key:E,unstable_mask:C},navigationType:i}},[h,p,x,v,w,E,i,C]);return wn(N!=null,`<Router basename="${h}"> is not able to match the URL "${p}${x}${v}" because it does not start with the basename, so the <Router> won't render anything.`),N==null?null:y.createElement(nn.Provider,{value:g},y.createElement(Xo.Provider,{children:l,value:N}))}function pw({children:n,location:l}){return ew(Xd(n),l)}function Xd(n,l=[]){let o=[];return y.Children.forEach(n,(i,u)=>{if(!y.isValidElement(i))return;let d=[...l,u];if(i.type===y.Fragment){o.push.apply(o,Xd(i.props.children,d));return}tt(i.type===Cl,`[${typeof i.type=="string"?i.type:i.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),tt(!i.props.index||!i.props.children,"An index route cannot have child routes.");let m={id:i.props.id||d.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,middleware:i.props.middleware,loader:i.props.loader,action:i.props.action,hydrateFallbackElement:i.props.hydrateFallbackElement,HydrateFallback:i.props.HydrateFallback,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.hasErrorBoundary===!0||i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(m.children=Xd(i.props.children,d)),o.push(m)}),o}var Ss="get",ws="application/x-www-form-urlencoded";function Ks(n){return typeof HTMLElement<"u"&&n instanceof HTMLElement}function gw(n){return Ks(n)&&n.tagName.toLowerCase()==="button"}function vw(n){return Ks(n)&&n.tagName.toLowerCase()==="form"}function yw(n){return Ks(n)&&n.tagName.toLowerCase()==="input"}function bw(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}function xw(n,l){return n.button===0&&(!l||l==="_self")&&!bw(n)}var us=null;function Sw(){if(us===null)try{new FormData(document.createElement("form"),0),us=!1}catch{us=!0}return us}var ww=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Ad(n){return n!=null&&!ww.has(n)?(wn(!1,`"${n}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${ws}"`),null):n}function Ew(n,l){let o,i,u,d,m;if(vw(n)){let h=n.getAttribute("action");i=h?ua(h,l):null,o=n.getAttribute("method")||Ss,u=Ad(n.getAttribute("enctype"))||ws,d=new FormData(n)}else if(gw(n)||yw(n)&&(n.type==="submit"||n.type==="image")){let h=n.form;if(h==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let g=n.getAttribute("formaction")||h.getAttribute("action");if(i=g?ua(g,l):null,o=n.getAttribute("formmethod")||h.getAttribute("method")||Ss,u=Ad(n.getAttribute("formenctype"))||Ad(h.getAttribute("enctype"))||ws,d=new FormData(h,n),!Sw()){let{name:p,type:x,value:v}=n;if(x==="image"){let w=p?`${p}.`:"";d.append(`${w}x`,"0"),d.append(`${w}y`,"0")}else p&&d.append(p,v)}}else{if(Ks(n))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');o=Ss,i=null,u=ws,m=n}return d&&u==="text/plain"&&(m=d,d=void 0),{action:i,method:o.toLowerCase(),encType:u,formData:d,body:m}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function vf(n,l){if(n===!1||n===null||typeof n>"u")throw new Error(l)}function Nw(n,l,o,i){let u=typeof n=="string"?new URL(n,typeof window>"u"?"server://singlefetch/":window.location.origin):n;return o?u.pathname.endsWith("/")?u.pathname=`${u.pathname}_.${i}`:u.pathname=`${u.pathname}.${i}`:u.pathname==="/"?u.pathname=`_root.${i}`:l&&ua(u.pathname,l)==="/"?u.pathname=`${l.replace(/\/$/,"")}/_root.${i}`:u.pathname=`${u.pathname.replace(/\/$/,"")}.${i}`,u}async function Cw(n,l){if(n.id in l)return l[n.id];try{let o=await import(n.module);return l[n.id]=o,o}catch(o){return console.error(`Error loading route module \`${n.module}\`, reloading page...`),console.error(o),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Tw(n){return n==null?!1:n.href==null?n.rel==="preload"&&typeof n.imageSrcSet=="string"&&typeof n.imageSizes=="string":typeof n.rel=="string"&&typeof n.href=="string"}async function Rw(n,l,o){let i=await Promise.all(n.map(async u=>{let d=l.routes[u.route.id];if(d){let m=await Cw(d,o);return m.links?m.links():[]}return[]}));return Mw(i.flat(1).filter(Tw).filter(u=>u.rel==="stylesheet"||u.rel==="preload").map(u=>u.rel==="stylesheet"?{...u,rel:"prefetch",as:"style"}:{...u,rel:"prefetch"}))}function iv(n,l,o,i,u,d){let m=(g,p)=>o[p]?g.route.id!==o[p].route.id:!0,h=(g,p)=>{var x;return o[p].pathname!==g.pathname||((x=o[p].route.path)==null?void 0:x.endsWith("*"))&&o[p].params["*"]!==g.params["*"]};return d==="assets"?l.filter((g,p)=>m(g,p)||h(g,p)):d==="data"?l.filter((g,p)=>{var v;let x=i.routes[g.route.id];if(!x||!x.hasLoader)return!1;if(m(g,p)||h(g,p))return!0;if(g.route.shouldRevalidate){let w=g.route.shouldRevalidate({currentUrl:new URL(u.pathname+u.search+u.hash,window.origin),currentParams:((v=o[0])==null?void 0:v.params)||{},nextUrl:new URL(n,window.origin),nextParams:g.params,defaultShouldRevalidate:!0});if(typeof w=="boolean")return w}return!0}):[]}function Aw(n,l,{includeHydrateFallback:o}={}){return _w(n.map(i=>{let u=l.routes[i.route.id];if(!u)return[];let d=[u.module];return u.clientActionModule&&(d=d.concat(u.clientActionModule)),u.clientLoaderModule&&(d=d.concat(u.clientLoaderModule)),o&&u.hydrateFallbackModule&&(d=d.concat(u.hydrateFallbackModule)),u.imports&&(d=d.concat(u.imports)),d}).flat(1))}function _w(n){return[...new Set(n)]}function jw(n){let l={},o=Object.keys(n).sort();for(let i of o)l[i]=n[i];return l}function Mw(n,l){let o=new Set;return new Set(l),n.reduce((i,u)=>{let d=JSON.stringify(jw(u));return o.has(d)||(o.add(d),i.push({key:d,link:u})),i},[])}function m0(){let n=y.useContext(Or);return vf(n,"You must render this element inside a <DataRouterContext.Provider> element"),n}function Ow(){let n=y.useContext(Qs);return vf(n,"You must render this element inside a <DataRouterStateContext.Provider> element"),n}var yf=y.createContext(void 0);yf.displayName="FrameworkContext";function h0(){let n=y.useContext(yf);return vf(n,"You must render this element inside a <HydratedRouter> element"),n}function Dw(n,l){let o=y.useContext(yf),[i,u]=y.useState(!1),[d,m]=y.useState(!1),{onFocus:h,onBlur:g,onMouseEnter:p,onMouseLeave:x,onTouchStart:v}=l,w=y.useRef(null);y.useEffect(()=>{if(n==="render"&&m(!0),n==="viewport"){let N=R=>{R.forEach(j=>{m(j.isIntersecting)})},T=new IntersectionObserver(N,{threshold:.5});return w.current&&T.observe(w.current),()=>{T.disconnect()}}},[n]),y.useEffect(()=>{if(i){let N=setTimeout(()=>{m(!0)},100);return()=>{clearTimeout(N)}}},[i]);let E=()=>{u(!0)},C=()=>{u(!1),m(!1)};return o?n!=="intent"?[d,w,{}]:[d,w,{onFocus:ko(h,E),onBlur:ko(g,C),onMouseEnter:ko(p,E),onMouseLeave:ko(x,C),onTouchStart:ko(v,E)}]:[!1,w,{}]}function ko(n,l){return o=>{n&&n(o),o.defaultPrevented||l(o)}}function kw({page:n,...l}){let{router:o}=m0(),i=y.useMemo(()=>Jv(o.routes,n,o.basename),[o.routes,n,o.basename]);return i?y.createElement(Lw,{page:n,matches:i,...l}):null}function zw(n){let{manifest:l,routeModules:o}=h0(),[i,u]=y.useState([]);return y.useEffect(()=>{let d=!1;return Rw(n,l,o).then(m=>{d||u(m)}),()=>{d=!0}},[n,l,o]),i}function Lw({page:n,matches:l,...o}){let i=Yn(),{future:u,manifest:d,routeModules:m}=h0(),{basename:h}=m0(),{loaderData:g,matches:p}=Ow(),x=y.useMemo(()=>iv(n,l,p,d,i,"data"),[n,l,p,d,i]),v=y.useMemo(()=>iv(n,l,p,d,i,"assets"),[n,l,p,d,i]),w=y.useMemo(()=>{if(n===i.pathname+i.search+i.hash)return[];let N=new Set,T=!1;if(l.forEach(j=>{var z;let O=d.routes[j.route.id];!O||!O.hasLoader||(!x.some(X=>X.route.id===j.route.id)&&j.route.id in g&&((z=m[j.route.id])!=null&&z.shouldRevalidate)||O.hasClientLoader?T=!0:N.add(j.route.id))}),N.size===0)return[];let R=Nw(n,h,u.unstable_trailingSlashAwareDataRequests,"data");return T&&N.size>0&&R.searchParams.set("_routes",l.filter(j=>N.has(j.route.id)).map(j=>j.route.id).join(",")),[R.pathname+R.search]},[h,u.unstable_trailingSlashAwareDataRequests,g,i,d,x,l,n,m]),E=y.useMemo(()=>Aw(v,d),[v,d]),C=zw(v);return y.createElement(y.Fragment,null,w.map(N=>y.createElement("link",{key:N,rel:"prefetch",as:"fetch",href:N,...o})),E.map(N=>y.createElement("link",{key:N,rel:"modulepreload",href:N,...o})),C.map(({key:N,link:T})=>y.createElement("link",{key:N,nonce:o.nonce,...T,crossOrigin:T.crossOrigin??o.crossOrigin})))}function Uw(...n){return l=>{n.forEach(o=>{typeof o=="function"?o(l):o!=null&&(o.current=l)})}}var Bw=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Bw&&(window.__reactRouterVersion="7.13.2")}catch{}function Hw({basename:n,children:l,unstable_useTransitions:o,window:i}){let u=y.useRef();u.current==null&&(u.current=v2({window:i,v5Compat:!0}));let d=u.current,[m,h]=y.useState({action:d.action,location:d.location}),g=y.useCallback(p=>{o===!1?h(p):y.startTransition(()=>h(p))},[o]);return y.useLayoutEffect(()=>d.listen(g),[d,g]),y.createElement(hw,{basename:n,children:l,location:m.location,navigationType:m.action,navigator:d,unstable_useTransitions:o})}var p0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,g0=y.forwardRef(function({onClick:l,discover:o="render",prefetch:i="none",relative:u,reloadDocument:d,replace:m,unstable_mask:h,state:g,target:p,to:x,preventScrollReset:v,viewTransition:w,unstable_defaultShouldRevalidate:E,...C},N){let{basename:T,navigator:R,unstable_useTransitions:j}=y.useContext(nn),O=typeof x=="string"&&p0.test(x),z=n0(x,T);x=z.to;let X=F2(x,{relative:u}),K=Yn(),V=null;if(h){let re=Ps(h,[],K.unstable_mask?K.unstable_mask.pathname:"/",!0);T!=="/"&&(re.pathname=re.pathname==="/"?T:Vn([T,re.pathname])),V=R.createHref(re)}let[H,le,ie]=Dw(i,C),me=Yw(x,{replace:m,unstable_mask:h,state:g,target:p,preventScrollReset:v,relative:u,viewTransition:w,unstable_defaultShouldRevalidate:E,unstable_useTransitions:j});function fe(re){l&&l(re),re.defaultPrevented||me(re)}let ce=!(z.isExternal||d),de=y.createElement("a",{...C,...ie,href:(ce?V:void 0)||z.absoluteURL||X,onClick:ce?fe:l,ref:Uw(N,le),target:p,"data-discover":!O&&o==="render"?"true":void 0});return H&&!O?y.createElement(y.Fragment,null,de,y.createElement(kw,{page:X})):de});g0.displayName="Link";var Pd=y.forwardRef(function({"aria-current":l="page",caseSensitive:o=!1,className:i="",end:u=!1,style:d,to:m,viewTransition:h,children:g,...p},x){let v=Po(m,{relative:p.relative}),w=Yn(),E=y.useContext(Qs),{navigator:C,basename:N}=y.useContext(nn),T=E!=null&&Qw(v)&&h===!0,R=C.encodeLocation?C.encodeLocation(v).pathname:v.pathname,j=w.pathname,O=E&&E.navigation&&E.navigation.location?E.navigation.location.pathname:null;o||(j=j.toLowerCase(),O=O?O.toLowerCase():null,R=R.toLowerCase()),O&&N&&(O=ua(O,N)||O);const z=R!=="/"&&R.endsWith("/")?R.length-1:R.length;let X=j===R||!u&&j.startsWith(R)&&j.charAt(z)==="/",K=O!=null&&(O===R||!u&&O.startsWith(R)&&O.charAt(R.length)==="/"),V={isActive:X,isPending:K,isTransitioning:T},H=X?l:void 0,le;typeof i=="function"?le=i(V):le=[i,X?"active":null,K?"pending":null,T?"transitioning":null].filter(Boolean).join(" ");let ie=typeof d=="function"?d(V):d;return y.createElement(g0,{...p,"aria-current":H,className:le,ref:x,style:ie,to:m,viewTransition:h},typeof g=="function"?g(V):g)});Pd.displayName="NavLink";var Vw=y.forwardRef(({discover:n="render",fetcherKey:l,navigate:o,reloadDocument:i,replace:u,state:d,method:m=Ss,action:h,onSubmit:g,relative:p,preventScrollReset:x,viewTransition:v,unstable_defaultShouldRevalidate:w,...E},C)=>{let{unstable_useTransitions:N}=y.useContext(nn),T=Xw(),R=Pw(h,{relative:p}),j=m.toLowerCase()==="get"?"get":"post",O=typeof h=="string"&&p0.test(h),z=X=>{if(g&&g(X),X.defaultPrevented)return;X.preventDefault();let K=X.nativeEvent.submitter,V=(K==null?void 0:K.getAttribute("formmethod"))||m,H=()=>T(K||X.currentTarget,{fetcherKey:l,method:V,navigate:o,replace:u,state:d,relative:p,preventScrollReset:x,viewTransition:v,unstable_defaultShouldRevalidate:w});N&&o!==!1?y.startTransition(()=>H()):H()};return y.createElement("form",{ref:C,method:j,action:R,onSubmit:i?g:z,...E,"data-discover":!O&&n==="render"?"true":void 0})});Vw.displayName="Form";function $w(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function v0(n){let l=y.useContext(Or);return tt(l,$w(n)),l}function Yw(n,{target:l,replace:o,unstable_mask:i,state:u,preventScrollReset:d,relative:m,viewTransition:h,unstable_defaultShouldRevalidate:g,unstable_useTransitions:p}={}){let x=s0(),v=Yn(),w=Po(n,{relative:m});return y.useCallback(E=>{if(xw(E,l)){E.preventDefault();let C=o!==void 0?o:Yo(v)===Yo(w),N=()=>x(n,{replace:C,unstable_mask:i,state:u,preventScrollReset:d,relative:m,viewTransition:h,unstable_defaultShouldRevalidate:g});p?y.startTransition(()=>N()):N()}},[v,x,w,o,i,u,l,n,d,m,h,g,p])}var qw=0,Gw=()=>`__${String(++qw)}__`;function Xw(){let{router:n}=v0("useSubmit"),{basename:l}=y.useContext(nn),o=cw(),i=n.fetch,u=n.navigate;return y.useCallback(async(d,m={})=>{let{action:h,method:g,encType:p,formData:x,body:v}=Ew(d,l);if(m.navigate===!1){let w=m.fetcherKey||Gw();await i(w,o,m.action||h,{unstable_defaultShouldRevalidate:m.unstable_defaultShouldRevalidate,preventScrollReset:m.preventScrollReset,formData:x,body:v,formMethod:m.method||g,formEncType:m.encType||p,flushSync:m.flushSync})}else await u(m.action||h,{unstable_defaultShouldRevalidate:m.unstable_defaultShouldRevalidate,preventScrollReset:m.preventScrollReset,formData:x,body:v,formMethod:m.method||g,formEncType:m.encType||p,replace:m.replace,state:m.state,fromRouteId:o,flushSync:m.flushSync,viewTransition:m.viewTransition})},[i,u,l,o])}function Pw(n,{relative:l}={}){let{basename:o}=y.useContext(nn),i=y.useContext(hn);tt(i,"useFormAction must be used inside a RouteContext");let[u]=i.matches.slice(-1),d={...Po(n||".",{relative:l})},m=Yn();if(n==null){d.search=m.search;let h=new URLSearchParams(d.search),g=h.getAll("index");if(g.some(x=>x==="")){h.delete("index"),g.filter(v=>v).forEach(v=>h.append("index",v));let x=h.toString();d.search=x?`?${x}`:""}}return(!n||n===".")&&u.route.index&&(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),o!=="/"&&(d.pathname=d.pathname==="/"?o:Vn([o,d.pathname])),Yo(d)}function Qw(n,{relative:l}={}){let o=y.useContext(l0);tt(o!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=v0("useViewTransitionState"),u=Po(n,{relative:l});if(!o.isTransitioning)return!1;let d=ua(o.currentLocation.pathname,i)||o.currentLocation.pathname,m=ua(o.nextLocation.pathname,i)||o.nextLocation.pathname;return Rs(u.pathname,m)!=null||Rs(u.pathname,d)!=null}var Qo=Iv();const y0=Zv(Qo),Kw="/api";function Zw(n,l){if(typeof n=="string"&&n)return n;if(n&&typeof n=="object"){const o=n,i=typeof o.error=="object"&&o.error!==null?o.error:void 0;if(typeof o.error=="string"&&o.error)return o.error;if(typeof(i==null?void 0:i.message)=="string"&&i.message)return i.message;if(typeof o.message=="string"&&o.message)return o.message}return l}async function Ee(n,l){const o=await fetch(`${Kw}${n}`,{...l,headers:{"Content-Type":"application/json",...l==null?void 0:l.headers}});if(!o.ok){const i=await o.json().catch(()=>o.statusText);throw new Error(Zw(i,`HTTP ${o.status}`))}return o.json()}function Iw(){return Ee("/system/info")}function $3(n){return Ee("/system/transport",{method:"POST",body:JSON.stringify({type:n})})}function b0(n){return Ee("/system/runtime/restart",{method:"POST",body:JSON.stringify(n)})}function Fw(){return Ee("/system/runtime/stop",{method:"POST"})}function Jw(){return Ee("/cluster/state")}function Y3(){return Ee("/cluster/promote",{method:"POST"})}function q3(n){return Ee("/cluster/connect",{method:"POST",body:JSON.stringify(n)})}function G3(){return Ee("/cluster/disconnect",{method:"POST"})}function Ww(n){return Ee(`/node-operations/${n}`)}async function eE(n={}){const l=new URLSearchParams;n.nodeId&&l.set("nodeId",n.nodeId),n.status&&l.set("status",n.status),n.kind&&l.set("kind",n.kind);const o=l.toString();return(await Ee(`/node-operations${o?`?${o}`:""}`)).operations}function tE(n,l){return Ee(`/nodes/${n}/agents/${l}/upgrade`,{method:"POST"})}function nE(n,l){return Ee(`/nodes/${n}/runtime/restart`,{method:"POST",body:JSON.stringify(l)})}async function X3(){return(await Ee("/devboxes")).devboxes}function P3(n,l){return Ee(`/nodes/${n}/devbox/configure`,{method:"POST",body:JSON.stringify({devbox:l})})}function Q3(n){return Ee(`/nodes/${n}/devbox/status`)}function K3(n){return Ee(`/nodes/${n}/devbox/start`,{method:"POST"})}function Z3(n,l){return Ee(`/nodes/${n}/devtunnel`,{method:"POST",body:JSON.stringify({enabled:l})})}function I3(n,l={}){const o=new URLSearchParams;l.path&&o.set("path",l.path),l.limit!==void 0&&o.set("limit",String(Math.min(Math.max(1,l.limit),100))),l.offset!==void 0&&o.set("offset",String(Math.max(0,l.offset))),l.directoriesOnly!==void 0&&o.set("directoriesOnly",String(l.directoriesOnly)),l.allowAbsolute!==void 0&&o.set("allowAbsolute",String(l.allowAbsolute));const i=o.toString();return Ee(`/nodes/${n}/workdir/tree${i?`?${i}`:""}`)}function F3(n,l={}){const o=new URLSearchParams;l.path&&o.set("path",l.path),l.limit!==void 0&&o.set("limit",String(Math.min(Math.max(1,l.limit),20))),l.offset!==void 0&&o.set("offset",String(Math.max(0,l.offset))),l.allowAbsolute!==void 0&&o.set("allowAbsolute",String(l.allowAbsolute));const i=o.toString();return Ee(`/nodes/${n}/workdir/branch${i?`?${i}`:""}`)}function J3(n,l){const o=new URLSearchParams;return o.set("agent",l.agent),o.set("limit",String(Math.min(Math.max(1,l.limit),100))),Ee(`/nodes/${n}/native-sessions?${o.toString()}`)}function W3(n,l){return Ee(`/nodes/${n}/workdir/branch`,{method:"POST",body:JSON.stringify({path:l.path,branchName:l.branchName,startPoint:l.startPoint,limit:l.limit,offset:l.offset,allowAbsolute:l.allowAbsolute})})}function ej(n,l){return Ee(`/nodes/${n}/terminal/sessions`,{method:"POST",body:JSON.stringify(l)})}function tj(n){return Ee(`/nodes/${n}/terminal/sessions`)}function nj(n,l){return Ee(`/nodes/${n}/terminal/sessions/${l}`)}function aj(n,l){return Ee(`/nodes/${n}/terminal/sessions/${l}/stop`,{method:"POST"})}async function lj(n){const l=new URLSearchParams;if(n!=null&&n.status&&l.set("status",n.status),n!=null&&n.assignedTo&&l.set("assignedTo",n.assignedTo),n!=null&&n.priority&&l.set("priority",n.priority),n!=null&&n.limit){const u=Math.min(Math.max(1,n.limit),100);l.set("limit",String(u))}n!=null&&n.offset&&l.set("offset",String(n.offset));const o=l.toString();return(await Ee(`/tasks${o?`?${o}`:""}`)).tasks}function rj(n){return Ee(`/tasks/${n}`)}function oj(n){return Ee("/tasks",{method:"POST",body:JSON.stringify(n)})}function ij(n){return Ee("/tasks/import-session",{method:"POST",body:JSON.stringify(n)})}function sj(n){return Ee("/tasks/batch/delete",{method:"POST",body:JSON.stringify({ids:n})})}function cj(n){return Ee("/tasks/batch/archive",{method:"POST",body:JSON.stringify({ids:n})})}function uj(n){return Ee(`/tasks/${n}/cancel`,{method:"POST"})}function dj(n){return Ee(`/tasks/${n}/retry`,{method:"POST"})}function fj(n,l){return Ee(`/tasks/${n}/logs`)}function mj(n,l){return Ee(`/tasks/${n}/message`,{method:"POST",body:JSON.stringify({content:l})})}function hj(n,l){return Ee(`/tasks/${n}/queued-messages/${encodeURIComponent(l)}`,{method:"DELETE"})}function pj(n,l){return Ee(`/tasks/${n}/share`,{method:"POST",body:JSON.stringify(l)})}function gj(n){return Ee(`/tasks/${n}/share`,{method:"DELETE"})}function vj(n){return Ee(`/shared/conversations/${encodeURIComponent(n)}`)}function yj(n,l){return Ee(`/shared/conversations/${encodeURIComponent(n)}/logs`)}function bj(n){return Ee(`/shared/conversations/${encodeURIComponent(n)}/output`)}function xj(n,l="."){return Ee(`/shared/conversations/${encodeURIComponent(n)}/output/tree?path=${encodeURIComponent(l)}`)}function Sj(n,l){return Ee(`/shared/conversations/${encodeURIComponent(n)}/output/content?path=${encodeURIComponent(l)}`)}function wj(n,l){return Ee(`/shared/conversations/${encodeURIComponent(n)}/output/preview-sessions`,{method:"POST",body:JSON.stringify(l?{path:l}:{})})}function aE(n){return n?typeof n=="string"?{path:n}:{...n.path?{path:n.path}:{},...n.port!==void 0?{port:n.port}:{}}:{}}function Ej(n){return Ee(`/tasks/${n}/output`)}function Nj(n,l="."){return Ee(`/tasks/${n}/output/tree?path=${encodeURIComponent(l)}`)}function Cj(n,l){return Ee(`/tasks/${n}/output/content?path=${encodeURIComponent(l)}`)}function Tj(n,l){return Ee(`/tasks/${n}/output/preview-sessions`,{method:"POST",body:JSON.stringify(aE(l))})}function Rj(n){return Ee(`/tasks/${n}/output/diff`)}function lE({hasStarted:n,enabled:l}){return l&&!n}function rE(n,l,o=!0){const i=y.useRef(n),u=y.useRef(!1);y.useEffect(()=>{i.current=n},[n]),y.useEffect(()=>{if(!o)return;const d=()=>i.current();lE({hasStarted:u.current,enabled:o})&&(u.current=!0,d());const m=setInterval(d,l);return()=>clearInterval(m)},[l,o])}let oE=0;function iE(n=50){const[l,o]=y.useState([]),[i,u]=y.useState(!1),d=y.useRef(null),m=y.useRef(0),h=y.useRef(new Map);y.useEffect(()=>{const x=new EventSource("/api/events");d.current=x,x.onopen=()=>u(!0),x.onerror=()=>u(!1);const v=["node.joined","node.left","node.status","node.operation.created","node.operation.updated","task.created","task.assigned","task.status","task.updated","task.deleted","task.output","election.started","election.complete","cluster.state","transport.changed"];for(const w of v)x.addEventListener(w,E=>{const C={id:String(++oE),type:w,data:JSON.parse(E.data),timestamp:Date.now()};o(N=>[C,...N].slice(0,n));for(const[,{pattern:N,callback:T}]of h.current)w.startsWith(N)&&T(C)});return()=>{x.close(),d.current=null,u(!1)}},[n]);const g=y.useCallback((x,v)=>{const w=++m.current;return h.current.set(w,{pattern:x,callback:v}),()=>{h.current.delete(w)}},[]),p=y.useCallback(()=>o([]),[]);return{events:l,connected:i,subscribe:g,clearEvents:p}}const sE=1e4,cE=6e4,uE=sE,dE=250,fE=new Set(["task.created","task.assigned","task.deleted"]),mE=new Set(["task.created","task.assigned","task.status","task.deleted"]);function hE(n){return n?cE:uE}function Aj(n){return fE.has(n)}function pE(n){return mE.has(n)}function gE(n,l){if(!l)return!0;const o=n.leaderId,i=n.term,u=n.nodeCount;return typeof o!="string"&&o!==null||typeof i!="number"||typeof u!="number"?!0:l.leaderId!==o||l.term!==i||l.nodeCount!==u}function vE(n,l,o){if(n==="node.joined"||n==="node.left"||n!=="node.status")return!0;const i=l.nodeId,u=l.status;return typeof i!="string"||typeof u!="string"?!0:o.get(i)!==u}function _j(n,l){const o=l.taskId,i=l.status;if(typeof o!="string"||typeof i!="string")return n;let u=!1;const d=n.map(m=>{if(m.id!==o)return m;u=!0;const h="result"in l?l.result:i==="completed"?null:m.result,g="error"in l?l.error:i==="completed"?null:m.error;return{...m,status:i,result:h,error:g}});return u?d:n}const x0=y.createContext(null);function yE({children:n}){const[l,o]=y.useState(null),[i,u]=y.useState(null),[d,m]=y.useState(!0),[h,g]=y.useState(null),p=y.useRef(null),x=y.useRef(null),v=y.useRef(new Map),{events:w,connected:E,subscribe:C}=iE(),N=y.useCallback(async()=>{var R;try{const[j,O]=await Promise.all([Jw(),Iw()]),z=j,X=O.nodeId??O.id,K=z.nodes??[],V=K.find(ie=>ie.id===X)??{id:X,name:O.name,endpoint:O.endpoint,role:O.role,status:O.status,capabilities:O.capabilities,joinedAt:O.joinedAt,lastHeartbeat:O.lastHeartbeat},H=z.leaderId?K.find(ie=>ie.id===z.leaderId)??null:null,le={leader:H?{id:H.id,name:H.name,endpoint:H.endpoint,...H.dashboardOrigin?{dashboardOrigin:H.dashboardOrigin}:{}}:null,term:z.term??0,nodes:K,self:V,taskSummary:z.taskSummary??{total:0,pending:0,running:0,completed:0,failed:0}};x.current={leaderId:((R=le.leader)==null?void 0:R.id)??null,term:le.term,nodeCount:le.nodes.length},v.current=new Map(le.nodes.map(ie=>[ie.id,ie.status])),v.current.set(le.self.id,le.self.status),o(le),u(O),g(null)}catch(j){g(j instanceof Error?j.message:"Failed to fetch cluster state")}finally{m(!1)}},[]),T=y.useCallback(()=>{p.current===null&&(p.current=window.setTimeout(()=>{p.current=null,N()},dE))},[N]);return rE(N,hE(E)),y.useEffect(()=>()=>{p.current!==null&&(window.clearTimeout(p.current),p.current=null)},[]),y.useEffect(()=>{const R=[C("cluster",j=>{gE(j.data,x.current)&&T()}),C("election",T),C("node",j=>{vE(j.type,j.data,v.current)&&T()}),C("transport",T),C("task",j=>{pE(j.type)&&T()})];return()=>R.forEach(j=>j())},[C,T]),f.jsx(x0.Provider,{value:{cluster:l,systemInfo:i,events:w,sseConnected:E,subscribe:C,refresh:N,loading:d,error:h},children:n})}function S0(){const n=y.useContext(x0);if(!n)throw new Error("useCluster must be used within ClusterProvider");return n}/**
61
+ Please change the parent <Route path="${R}"> to <Route path="${R==="/"?"*":`${R}/*`}">.`)}let x=Yn(),v;if(l){let R=typeof l=="string"?Mr(l):l;tt(g==="/"||((T=R.pathname)==null?void 0:T.startsWith(g)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${g}" but pathname "${R.pathname}" was given in the \`location\` prop.`),v=R}else v=x;let w=v.pathname||"/",E=w;if(g!=="/"){let R=g.replace(/^\//,"").split("/");E="/"+w.replace(/^\//,"").split("/").slice(R.length).join("/")}let C=Jv(n,{pathname:E});wn(p||C!=null,`No routes matched location "${v.pathname}${v.search}${v.hash}" `),wn(C==null||C[C.length-1].route.element!==void 0||C[C.length-1].route.Component!==void 0||C[C.length-1].route.lazy!==void 0,`Matched leaf route at location "${v.pathname}${v.search}${v.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let N=rw(C&&C.map(R=>Object.assign({},R,{params:Object.assign({},m,R.params),pathname:Vn([g,i.encodeLocation?i.encodeLocation(R.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:R.pathname]),pathnameBase:R.pathnameBase==="/"?g:Vn([g,i.encodeLocation?i.encodeLocation(R.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:R.pathnameBase])})),u,o);return l&&N?y.createElement(Xo.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...v},navigationType:"POP"}},N):N}function tw(){let n=uw(),l=$2(n)?`${n.status} ${n.statusText}`:n instanceof Error?n.message:JSON.stringify(n),o=n instanceof Error?n.stack:null,i="rgba(200,200,200, 0.5)",u={padding:"0.5rem",backgroundColor:i},d={padding:"2px 4px",backgroundColor:i},m=null;return console.error("Error handled by React Router default ErrorBoundary:",n),m=y.createElement(y.Fragment,null,y.createElement("p",null,"💿 Hey developer 👋"),y.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",y.createElement("code",{style:d},"ErrorBoundary")," or"," ",y.createElement("code",{style:d},"errorElement")," prop on your route.")),y.createElement(y.Fragment,null,y.createElement("h2",null,"Unexpected Application Error!"),y.createElement("h3",{style:{fontStyle:"italic"}},l),o?y.createElement("pre",{style:u},o):null,m)}var nw=y.createElement(tw,null),d0=class extends y.Component{constructor(n){super(n),this.state={location:n.location,revalidation:n.revalidation,error:n.error}}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,l){return l.location!==n.location||l.revalidation!=="idle"&&n.revalidation==="idle"?{error:n.error,location:n.location,revalidation:n.revalidation}:{error:n.error!==void 0?n.error:l.error,location:l.location,revalidation:n.revalidation||l.revalidation}}componentDidCatch(n,l){this.props.onError?this.props.onError(n,l):console.error("React Router caught the following error during render",n)}render(){let n=this.state.error;if(this.context&&typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){const o=I2(n.digest);o&&(n=o)}let l=n!==void 0?y.createElement(hn.Provider,{value:this.props.routeContext},y.createElement(hf.Provider,{value:n,children:this.props.component})):this.props.children;return this.context?y.createElement(aw,{error:n},l):l}};d0.contextType=G2;var Rd=new WeakMap;function aw({children:n,error:l}){let{basename:o}=y.useContext(nn);if(typeof l=="object"&&l&&"digest"in l&&typeof l.digest=="string"){let i=Z2(l.digest);if(i){let u=Rd.get(l);if(u)throw u;let d=n0(i.location,o);if(t0&&!Rd.get(l))if(d.isExternal||i.reloadDocument)window.location.href=d.absoluteURL||d.to;else{const m=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(d.to,{replace:i.replace}));throw Rd.set(l,m),m}return y.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d.absoluteURL||d.to}`})}}return n}function lw({routeContext:n,match:l,children:o}){let i=y.useContext(Or);return i&&i.static&&i.staticContext&&(l.route.errorElement||l.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=l.route.id),y.createElement(hn.Provider,{value:n},o)}function rw(n,l=[],o){let i=o==null?void 0:o.state;if(n==null){if(!i)return null;if(i.errors)n=i.matches;else if(l.length===0&&!i.initialized&&i.matches.length>0)n=i.matches;else return null}let u=n,d=i==null?void 0:i.errors;if(d!=null){let x=u.findIndex(v=>v.route.id&&(d==null?void 0:d[v.route.id])!==void 0);tt(x>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(d).join(",")}`),u=u.slice(0,Math.min(u.length,x+1))}let m=!1,h=-1;if(o&&i){m=i.renderFallback;for(let x=0;x<u.length;x++){let v=u[x];if((v.route.HydrateFallback||v.route.hydrateFallbackElement)&&(h=x),v.route.id){let{loaderData:w,errors:E}=i,C=v.route.loader&&!w.hasOwnProperty(v.route.id)&&(!E||E[v.route.id]===void 0);if(v.route.lazy||C){o.isStatic&&(m=!0),h>=0?u=u.slice(0,h+1):u=[u[0]];break}}}}let g=o==null?void 0:o.onError,p=i&&g?(x,v)=>{var w,E;g(x,{location:i.location,params:((E=(w=i.matches)==null?void 0:w[0])==null?void 0:E.params)??{},unstable_pattern:Y2(i.matches),errorInfo:v})}:void 0;return u.reduceRight((x,v,w)=>{let E,C=!1,N=null,T=null;i&&(E=d&&v.route.id?d[v.route.id]:void 0,N=v.route.errorElement||nw,m&&(h<0&&w===0?(f0("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),C=!0,T=null):h===w&&(C=!0,T=v.route.hydrateFallbackElement||null)));let R=l.concat(u.slice(0,w+1)),j=()=>{let O;return E?O=N:C?O=T:v.route.Component?O=y.createElement(v.route.Component,null):v.route.element?O=v.route.element:O=x,y.createElement(lw,{match:v,routeContext:{outlet:x,matches:R,isDataRoute:i!=null},children:O})};return i&&(v.route.ErrorBoundary||v.route.errorElement||w===0)?y.createElement(d0,{location:i.location,revalidation:i.revalidation,component:N,error:E,children:j(),routeContext:{outlet:null,matches:R,isDataRoute:!0},onError:p}):j()},null)}function pf(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ow(n){let l=y.useContext(Or);return tt(l,pf(n)),l}function iw(n){let l=y.useContext(Qs);return tt(l,pf(n)),l}function sw(n){let l=y.useContext(hn);return tt(l,pf(n)),l}function gf(n){let l=sw(n),o=l.matches[l.matches.length-1];return tt(o.route.id,`${n} can only be used on routes that contain a unique "id"`),o.route.id}function cw(){return gf("useRouteId")}function uw(){var i;let n=y.useContext(hf),l=iw("useRouteError"),o=gf("useRouteError");return n!==void 0?n:(i=l.errors)==null?void 0:i[o]}function dw(){let{router:n}=ow("useNavigate"),l=gf("useNavigate"),o=y.useRef(!1);return i0(()=>{o.current=!0}),y.useCallback(async(u,d={})=>{wn(o.current,o0),o.current&&(typeof u=="number"?await n.navigate(u):await n.navigate(u,{fromRouteId:l,...d}))},[n,l])}var rv={};function f0(n,l,o){!l&&!rv[n]&&(rv[n]=!0,wn(!1,o))}y.memo(fw);function fw({routes:n,future:l,state:o,isStatic:i,onError:u}){return u0(n,void 0,{state:o,isStatic:i,onError:u})}function ov({to:n,replace:l,state:o,relative:i}){tt(Dr(),"<Navigate> may be used only in the context of a <Router> component.");let{static:u}=y.useContext(nn);wn(!u,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:d}=y.useContext(hn),{pathname:m}=Yn(),h=s0(),g=Ps(n,mf(d),m,i==="path"),p=JSON.stringify(g);return y.useEffect(()=>{h(JSON.parse(p),{replace:l,state:o,relative:i})},[h,p,i,l,o]),null}function mw(n){return W2(n.context)}function Cl(n){tt(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function hw({basename:n="/",children:l=null,location:o,navigationType:i="POP",navigator:u,static:d=!1,unstable_useTransitions:m}){tt(!Dr(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let h=n.replace(/^\/*/,"/"),g=y.useMemo(()=>({basename:h,navigator:u,static:d,unstable_useTransitions:m,future:{}}),[h,u,d,m]);typeof o=="string"&&(o=Mr(o));let{pathname:p="/",search:x="",hash:v="",state:w=null,key:E="default",unstable_mask:C}=o,N=y.useMemo(()=>{let T=ua(p,h);return T==null?null:{location:{pathname:T,search:x,hash:v,state:w,key:E,unstable_mask:C},navigationType:i}},[h,p,x,v,w,E,i,C]);return wn(N!=null,`<Router basename="${h}"> is not able to match the URL "${p}${x}${v}" because it does not start with the basename, so the <Router> won't render anything.`),N==null?null:y.createElement(nn.Provider,{value:g},y.createElement(Xo.Provider,{children:l,value:N}))}function pw({children:n,location:l}){return ew(Xd(n),l)}function Xd(n,l=[]){let o=[];return y.Children.forEach(n,(i,u)=>{if(!y.isValidElement(i))return;let d=[...l,u];if(i.type===y.Fragment){o.push.apply(o,Xd(i.props.children,d));return}tt(i.type===Cl,`[${typeof i.type=="string"?i.type:i.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),tt(!i.props.index||!i.props.children,"An index route cannot have child routes.");let m={id:i.props.id||d.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,middleware:i.props.middleware,loader:i.props.loader,action:i.props.action,hydrateFallbackElement:i.props.hydrateFallbackElement,HydrateFallback:i.props.HydrateFallback,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.hasErrorBoundary===!0||i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(m.children=Xd(i.props.children,d)),o.push(m)}),o}var Ss="get",ws="application/x-www-form-urlencoded";function Ks(n){return typeof HTMLElement<"u"&&n instanceof HTMLElement}function gw(n){return Ks(n)&&n.tagName.toLowerCase()==="button"}function vw(n){return Ks(n)&&n.tagName.toLowerCase()==="form"}function yw(n){return Ks(n)&&n.tagName.toLowerCase()==="input"}function bw(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}function xw(n,l){return n.button===0&&(!l||l==="_self")&&!bw(n)}var us=null;function Sw(){if(us===null)try{new FormData(document.createElement("form"),0),us=!1}catch{us=!0}return us}var ww=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Ad(n){return n!=null&&!ww.has(n)?(wn(!1,`"${n}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${ws}"`),null):n}function Ew(n,l){let o,i,u,d,m;if(vw(n)){let h=n.getAttribute("action");i=h?ua(h,l):null,o=n.getAttribute("method")||Ss,u=Ad(n.getAttribute("enctype"))||ws,d=new FormData(n)}else if(gw(n)||yw(n)&&(n.type==="submit"||n.type==="image")){let h=n.form;if(h==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let g=n.getAttribute("formaction")||h.getAttribute("action");if(i=g?ua(g,l):null,o=n.getAttribute("formmethod")||h.getAttribute("method")||Ss,u=Ad(n.getAttribute("formenctype"))||Ad(h.getAttribute("enctype"))||ws,d=new FormData(h,n),!Sw()){let{name:p,type:x,value:v}=n;if(x==="image"){let w=p?`${p}.`:"";d.append(`${w}x`,"0"),d.append(`${w}y`,"0")}else p&&d.append(p,v)}}else{if(Ks(n))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');o=Ss,i=null,u=ws,m=n}return d&&u==="text/plain"&&(m=d,d=void 0),{action:i,method:o.toLowerCase(),encType:u,formData:d,body:m}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function vf(n,l){if(n===!1||n===null||typeof n>"u")throw new Error(l)}function Nw(n,l,o,i){let u=typeof n=="string"?new URL(n,typeof window>"u"?"server://singlefetch/":window.location.origin):n;return o?u.pathname.endsWith("/")?u.pathname=`${u.pathname}_.${i}`:u.pathname=`${u.pathname}.${i}`:u.pathname==="/"?u.pathname=`_root.${i}`:l&&ua(u.pathname,l)==="/"?u.pathname=`${l.replace(/\/$/,"")}/_root.${i}`:u.pathname=`${u.pathname.replace(/\/$/,"")}.${i}`,u}async function Cw(n,l){if(n.id in l)return l[n.id];try{let o=await import(n.module);return l[n.id]=o,o}catch(o){return console.error(`Error loading route module \`${n.module}\`, reloading page...`),console.error(o),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Tw(n){return n==null?!1:n.href==null?n.rel==="preload"&&typeof n.imageSrcSet=="string"&&typeof n.imageSizes=="string":typeof n.rel=="string"&&typeof n.href=="string"}async function Rw(n,l,o){let i=await Promise.all(n.map(async u=>{let d=l.routes[u.route.id];if(d){let m=await Cw(d,o);return m.links?m.links():[]}return[]}));return Mw(i.flat(1).filter(Tw).filter(u=>u.rel==="stylesheet"||u.rel==="preload").map(u=>u.rel==="stylesheet"?{...u,rel:"prefetch",as:"style"}:{...u,rel:"prefetch"}))}function iv(n,l,o,i,u,d){let m=(g,p)=>o[p]?g.route.id!==o[p].route.id:!0,h=(g,p)=>{var x;return o[p].pathname!==g.pathname||((x=o[p].route.path)==null?void 0:x.endsWith("*"))&&o[p].params["*"]!==g.params["*"]};return d==="assets"?l.filter((g,p)=>m(g,p)||h(g,p)):d==="data"?l.filter((g,p)=>{var v;let x=i.routes[g.route.id];if(!x||!x.hasLoader)return!1;if(m(g,p)||h(g,p))return!0;if(g.route.shouldRevalidate){let w=g.route.shouldRevalidate({currentUrl:new URL(u.pathname+u.search+u.hash,window.origin),currentParams:((v=o[0])==null?void 0:v.params)||{},nextUrl:new URL(n,window.origin),nextParams:g.params,defaultShouldRevalidate:!0});if(typeof w=="boolean")return w}return!0}):[]}function Aw(n,l,{includeHydrateFallback:o}={}){return _w(n.map(i=>{let u=l.routes[i.route.id];if(!u)return[];let d=[u.module];return u.clientActionModule&&(d=d.concat(u.clientActionModule)),u.clientLoaderModule&&(d=d.concat(u.clientLoaderModule)),o&&u.hydrateFallbackModule&&(d=d.concat(u.hydrateFallbackModule)),u.imports&&(d=d.concat(u.imports)),d}).flat(1))}function _w(n){return[...new Set(n)]}function jw(n){let l={},o=Object.keys(n).sort();for(let i of o)l[i]=n[i];return l}function Mw(n,l){let o=new Set;return new Set(l),n.reduce((i,u)=>{let d=JSON.stringify(jw(u));return o.has(d)||(o.add(d),i.push({key:d,link:u})),i},[])}function m0(){let n=y.useContext(Or);return vf(n,"You must render this element inside a <DataRouterContext.Provider> element"),n}function Ow(){let n=y.useContext(Qs);return vf(n,"You must render this element inside a <DataRouterStateContext.Provider> element"),n}var yf=y.createContext(void 0);yf.displayName="FrameworkContext";function h0(){let n=y.useContext(yf);return vf(n,"You must render this element inside a <HydratedRouter> element"),n}function Dw(n,l){let o=y.useContext(yf),[i,u]=y.useState(!1),[d,m]=y.useState(!1),{onFocus:h,onBlur:g,onMouseEnter:p,onMouseLeave:x,onTouchStart:v}=l,w=y.useRef(null);y.useEffect(()=>{if(n==="render"&&m(!0),n==="viewport"){let N=R=>{R.forEach(j=>{m(j.isIntersecting)})},T=new IntersectionObserver(N,{threshold:.5});return w.current&&T.observe(w.current),()=>{T.disconnect()}}},[n]),y.useEffect(()=>{if(i){let N=setTimeout(()=>{m(!0)},100);return()=>{clearTimeout(N)}}},[i]);let E=()=>{u(!0)},C=()=>{u(!1),m(!1)};return o?n!=="intent"?[d,w,{}]:[d,w,{onFocus:ko(h,E),onBlur:ko(g,C),onMouseEnter:ko(p,E),onMouseLeave:ko(x,C),onTouchStart:ko(v,E)}]:[!1,w,{}]}function ko(n,l){return o=>{n&&n(o),o.defaultPrevented||l(o)}}function kw({page:n,...l}){let{router:o}=m0(),i=y.useMemo(()=>Jv(o.routes,n,o.basename),[o.routes,n,o.basename]);return i?y.createElement(Lw,{page:n,matches:i,...l}):null}function zw(n){let{manifest:l,routeModules:o}=h0(),[i,u]=y.useState([]);return y.useEffect(()=>{let d=!1;return Rw(n,l,o).then(m=>{d||u(m)}),()=>{d=!0}},[n,l,o]),i}function Lw({page:n,matches:l,...o}){let i=Yn(),{future:u,manifest:d,routeModules:m}=h0(),{basename:h}=m0(),{loaderData:g,matches:p}=Ow(),x=y.useMemo(()=>iv(n,l,p,d,i,"data"),[n,l,p,d,i]),v=y.useMemo(()=>iv(n,l,p,d,i,"assets"),[n,l,p,d,i]),w=y.useMemo(()=>{if(n===i.pathname+i.search+i.hash)return[];let N=new Set,T=!1;if(l.forEach(j=>{var z;let O=d.routes[j.route.id];!O||!O.hasLoader||(!x.some(X=>X.route.id===j.route.id)&&j.route.id in g&&((z=m[j.route.id])!=null&&z.shouldRevalidate)||O.hasClientLoader?T=!0:N.add(j.route.id))}),N.size===0)return[];let R=Nw(n,h,u.unstable_trailingSlashAwareDataRequests,"data");return T&&N.size>0&&R.searchParams.set("_routes",l.filter(j=>N.has(j.route.id)).map(j=>j.route.id).join(",")),[R.pathname+R.search]},[h,u.unstable_trailingSlashAwareDataRequests,g,i,d,x,l,n,m]),E=y.useMemo(()=>Aw(v,d),[v,d]),C=zw(v);return y.createElement(y.Fragment,null,w.map(N=>y.createElement("link",{key:N,rel:"prefetch",as:"fetch",href:N,...o})),E.map(N=>y.createElement("link",{key:N,rel:"modulepreload",href:N,...o})),C.map(({key:N,link:T})=>y.createElement("link",{key:N,nonce:o.nonce,...T,crossOrigin:T.crossOrigin??o.crossOrigin})))}function Uw(...n){return l=>{n.forEach(o=>{typeof o=="function"?o(l):o!=null&&(o.current=l)})}}var Bw=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Bw&&(window.__reactRouterVersion="7.13.2")}catch{}function Hw({basename:n,children:l,unstable_useTransitions:o,window:i}){let u=y.useRef();u.current==null&&(u.current=v2({window:i,v5Compat:!0}));let d=u.current,[m,h]=y.useState({action:d.action,location:d.location}),g=y.useCallback(p=>{o===!1?h(p):y.startTransition(()=>h(p))},[o]);return y.useLayoutEffect(()=>d.listen(g),[d,g]),y.createElement(hw,{basename:n,children:l,location:m.location,navigationType:m.action,navigator:d,unstable_useTransitions:o})}var p0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,g0=y.forwardRef(function({onClick:l,discover:o="render",prefetch:i="none",relative:u,reloadDocument:d,replace:m,unstable_mask:h,state:g,target:p,to:x,preventScrollReset:v,viewTransition:w,unstable_defaultShouldRevalidate:E,...C},N){let{basename:T,navigator:R,unstable_useTransitions:j}=y.useContext(nn),O=typeof x=="string"&&p0.test(x),z=n0(x,T);x=z.to;let X=F2(x,{relative:u}),K=Yn(),V=null;if(h){let re=Ps(h,[],K.unstable_mask?K.unstable_mask.pathname:"/",!0);T!=="/"&&(re.pathname=re.pathname==="/"?T:Vn([T,re.pathname])),V=R.createHref(re)}let[H,le,ie]=Dw(i,C),me=Yw(x,{replace:m,unstable_mask:h,state:g,target:p,preventScrollReset:v,relative:u,viewTransition:w,unstable_defaultShouldRevalidate:E,unstable_useTransitions:j});function fe(re){l&&l(re),re.defaultPrevented||me(re)}let ce=!(z.isExternal||d),de=y.createElement("a",{...C,...ie,href:(ce?V:void 0)||z.absoluteURL||X,onClick:ce?fe:l,ref:Uw(N,le),target:p,"data-discover":!O&&o==="render"?"true":void 0});return H&&!O?y.createElement(y.Fragment,null,de,y.createElement(kw,{page:X})):de});g0.displayName="Link";var Pd=y.forwardRef(function({"aria-current":l="page",caseSensitive:o=!1,className:i="",end:u=!1,style:d,to:m,viewTransition:h,children:g,...p},x){let v=Po(m,{relative:p.relative}),w=Yn(),E=y.useContext(Qs),{navigator:C,basename:N}=y.useContext(nn),T=E!=null&&Qw(v)&&h===!0,R=C.encodeLocation?C.encodeLocation(v).pathname:v.pathname,j=w.pathname,O=E&&E.navigation&&E.navigation.location?E.navigation.location.pathname:null;o||(j=j.toLowerCase(),O=O?O.toLowerCase():null,R=R.toLowerCase()),O&&N&&(O=ua(O,N)||O);const z=R!=="/"&&R.endsWith("/")?R.length-1:R.length;let X=j===R||!u&&j.startsWith(R)&&j.charAt(z)==="/",K=O!=null&&(O===R||!u&&O.startsWith(R)&&O.charAt(R.length)==="/"),V={isActive:X,isPending:K,isTransitioning:T},H=X?l:void 0,le;typeof i=="function"?le=i(V):le=[i,X?"active":null,K?"pending":null,T?"transitioning":null].filter(Boolean).join(" ");let ie=typeof d=="function"?d(V):d;return y.createElement(g0,{...p,"aria-current":H,className:le,ref:x,style:ie,to:m,viewTransition:h},typeof g=="function"?g(V):g)});Pd.displayName="NavLink";var Vw=y.forwardRef(({discover:n="render",fetcherKey:l,navigate:o,reloadDocument:i,replace:u,state:d,method:m=Ss,action:h,onSubmit:g,relative:p,preventScrollReset:x,viewTransition:v,unstable_defaultShouldRevalidate:w,...E},C)=>{let{unstable_useTransitions:N}=y.useContext(nn),T=Xw(),R=Pw(h,{relative:p}),j=m.toLowerCase()==="get"?"get":"post",O=typeof h=="string"&&p0.test(h),z=X=>{if(g&&g(X),X.defaultPrevented)return;X.preventDefault();let K=X.nativeEvent.submitter,V=(K==null?void 0:K.getAttribute("formmethod"))||m,H=()=>T(K||X.currentTarget,{fetcherKey:l,method:V,navigate:o,replace:u,state:d,relative:p,preventScrollReset:x,viewTransition:v,unstable_defaultShouldRevalidate:w});N&&o!==!1?y.startTransition(()=>H()):H()};return y.createElement("form",{ref:C,method:j,action:R,onSubmit:i?g:z,...E,"data-discover":!O&&n==="render"?"true":void 0})});Vw.displayName="Form";function $w(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function v0(n){let l=y.useContext(Or);return tt(l,$w(n)),l}function Yw(n,{target:l,replace:o,unstable_mask:i,state:u,preventScrollReset:d,relative:m,viewTransition:h,unstable_defaultShouldRevalidate:g,unstable_useTransitions:p}={}){let x=s0(),v=Yn(),w=Po(n,{relative:m});return y.useCallback(E=>{if(xw(E,l)){E.preventDefault();let C=o!==void 0?o:Yo(v)===Yo(w),N=()=>x(n,{replace:C,unstable_mask:i,state:u,preventScrollReset:d,relative:m,viewTransition:h,unstable_defaultShouldRevalidate:g});p?y.startTransition(()=>N()):N()}},[v,x,w,o,i,u,l,n,d,m,h,g,p])}var qw=0,Gw=()=>`__${String(++qw)}__`;function Xw(){let{router:n}=v0("useSubmit"),{basename:l}=y.useContext(nn),o=cw(),i=n.fetch,u=n.navigate;return y.useCallback(async(d,m={})=>{let{action:h,method:g,encType:p,formData:x,body:v}=Ew(d,l);if(m.navigate===!1){let w=m.fetcherKey||Gw();await i(w,o,m.action||h,{unstable_defaultShouldRevalidate:m.unstable_defaultShouldRevalidate,preventScrollReset:m.preventScrollReset,formData:x,body:v,formMethod:m.method||g,formEncType:m.encType||p,flushSync:m.flushSync})}else await u(m.action||h,{unstable_defaultShouldRevalidate:m.unstable_defaultShouldRevalidate,preventScrollReset:m.preventScrollReset,formData:x,body:v,formMethod:m.method||g,formEncType:m.encType||p,replace:m.replace,state:m.state,fromRouteId:o,flushSync:m.flushSync,viewTransition:m.viewTransition})},[i,u,l,o])}function Pw(n,{relative:l}={}){let{basename:o}=y.useContext(nn),i=y.useContext(hn);tt(i,"useFormAction must be used inside a RouteContext");let[u]=i.matches.slice(-1),d={...Po(n||".",{relative:l})},m=Yn();if(n==null){d.search=m.search;let h=new URLSearchParams(d.search),g=h.getAll("index");if(g.some(x=>x==="")){h.delete("index"),g.filter(v=>v).forEach(v=>h.append("index",v));let x=h.toString();d.search=x?`?${x}`:""}}return(!n||n===".")&&u.route.index&&(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),o!=="/"&&(d.pathname=d.pathname==="/"?o:Vn([o,d.pathname])),Yo(d)}function Qw(n,{relative:l}={}){let o=y.useContext(l0);tt(o!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=v0("useViewTransitionState"),u=Po(n,{relative:l});if(!o.isTransitioning)return!1;let d=ua(o.currentLocation.pathname,i)||o.currentLocation.pathname,m=ua(o.nextLocation.pathname,i)||o.nextLocation.pathname;return Rs(u.pathname,m)!=null||Rs(u.pathname,d)!=null}var Qo=Iv();const y0=Zv(Qo),Kw="/api";function Zw(n,l){if(typeof n=="string"&&n)return n;if(n&&typeof n=="object"){const o=n,i=typeof o.error=="object"&&o.error!==null?o.error:void 0;if(typeof o.error=="string"&&o.error)return o.error;if(typeof(i==null?void 0:i.message)=="string"&&i.message)return i.message;if(typeof o.message=="string"&&o.message)return o.message}return l}async function Ee(n,l){const o=await fetch(`${Kw}${n}`,{...l,headers:{"Content-Type":"application/json",...l==null?void 0:l.headers}});if(!o.ok){const i=await o.json().catch(()=>o.statusText);throw new Error(Zw(i,`HTTP ${o.status}`))}return o.json()}function Iw(){return Ee("/system/info")}function Y3(n){return Ee("/system/transport",{method:"POST",body:JSON.stringify({type:n})})}function b0(n){return Ee("/system/runtime/restart",{method:"POST",body:JSON.stringify(n)})}function Fw(){return Ee("/system/runtime/stop",{method:"POST"})}function Jw(){return Ee("/cluster/state")}function q3(){return Ee("/cluster/promote",{method:"POST"})}function G3(n){return Ee("/cluster/connect",{method:"POST",body:JSON.stringify(n)})}function X3(){return Ee("/cluster/disconnect",{method:"POST"})}function Ww(n){return Ee(`/node-operations/${n}`)}async function eE(n={}){const l=new URLSearchParams;n.nodeId&&l.set("nodeId",n.nodeId),n.status&&l.set("status",n.status),n.kind&&l.set("kind",n.kind);const o=l.toString();return(await Ee(`/node-operations${o?`?${o}`:""}`)).operations}function tE(n,l){return Ee(`/nodes/${n}/agents/${l}/upgrade`,{method:"POST"})}function nE(n,l){return Ee(`/nodes/${n}/runtime/restart`,{method:"POST",body:JSON.stringify(l)})}async function P3(){return(await Ee("/devboxes")).devboxes}function Q3(n,l){return Ee(`/nodes/${n}/devbox/configure`,{method:"POST",body:JSON.stringify({devbox:l})})}function K3(n){return Ee(`/nodes/${n}/devbox/status`)}function Z3(n){return Ee(`/nodes/${n}/devbox/start`,{method:"POST"})}function I3(n,l){return Ee(`/nodes/${n}/devtunnel`,{method:"POST",body:JSON.stringify({enabled:l})})}function F3(n,l={}){const o=new URLSearchParams;l.path&&o.set("path",l.path),l.limit!==void 0&&o.set("limit",String(Math.min(Math.max(1,l.limit),100))),l.offset!==void 0&&o.set("offset",String(Math.max(0,l.offset))),l.directoriesOnly!==void 0&&o.set("directoriesOnly",String(l.directoriesOnly)),l.allowAbsolute!==void 0&&o.set("allowAbsolute",String(l.allowAbsolute));const i=o.toString();return Ee(`/nodes/${n}/workdir/tree${i?`?${i}`:""}`)}function J3(n,l={}){const o=new URLSearchParams;l.path&&o.set("path",l.path),l.limit!==void 0&&o.set("limit",String(Math.min(Math.max(1,l.limit),20))),l.offset!==void 0&&o.set("offset",String(Math.max(0,l.offset))),l.allowAbsolute!==void 0&&o.set("allowAbsolute",String(l.allowAbsolute));const i=o.toString();return Ee(`/nodes/${n}/workdir/branch${i?`?${i}`:""}`)}function W3(n,l){const o=new URLSearchParams;return o.set("agent",l.agent),o.set("limit",String(Math.min(Math.max(1,l.limit),100))),Ee(`/nodes/${n}/native-sessions?${o.toString()}`)}function ej(n,l){return Ee(`/nodes/${n}/workdir/branch`,{method:"POST",body:JSON.stringify({path:l.path,branchName:l.branchName,startPoint:l.startPoint,limit:l.limit,offset:l.offset,allowAbsolute:l.allowAbsolute})})}function tj(n,l){return Ee(`/nodes/${n}/terminal/sessions`,{method:"POST",body:JSON.stringify(l)})}function nj(n){return Ee(`/nodes/${n}/terminal/sessions`)}function aj(n,l){return Ee(`/nodes/${n}/terminal/sessions/${l}`)}function lj(n,l){return Ee(`/nodes/${n}/terminal/sessions/${l}/stop`,{method:"POST"})}async function rj(n){const l=new URLSearchParams;if(n!=null&&n.status&&l.set("status",n.status),n!=null&&n.assignedTo&&l.set("assignedTo",n.assignedTo),n!=null&&n.priority&&l.set("priority",n.priority),n!=null&&n.limit){const u=Math.min(Math.max(1,n.limit),100);l.set("limit",String(u))}n!=null&&n.offset&&l.set("offset",String(n.offset));const o=l.toString();return(await Ee(`/tasks${o?`?${o}`:""}`)).tasks}function oj(n){return Ee(`/tasks/${n}`)}function ij(n){return Ee("/tasks",{method:"POST",body:JSON.stringify(n)})}function sj(n){return Ee("/tasks/import-session",{method:"POST",body:JSON.stringify(n)})}function cj(n){return Ee("/tasks/batch/delete",{method:"POST",body:JSON.stringify({ids:n})})}function uj(n){return Ee("/tasks/batch/archive",{method:"POST",body:JSON.stringify({ids:n})})}function dj(n){return Ee(`/tasks/${n}/cancel`,{method:"POST"})}function fj(n){return Ee(`/tasks/${n}/retry`,{method:"POST"})}function mj(n,l){return Ee(`/tasks/${n}/logs`)}function hj(n,l){return Ee(`/tasks/${n}/message`,{method:"POST",body:JSON.stringify({content:l})})}function pj(n,l){return Ee(`/tasks/${n}/queued-messages/${encodeURIComponent(l)}`,{method:"DELETE"})}function gj(n,l){return Ee(`/tasks/${n}/share`,{method:"POST",body:JSON.stringify(l)})}function vj(n){return Ee(`/tasks/${n}/share`,{method:"DELETE"})}function yj(n){return Ee(`/shared/conversations/${encodeURIComponent(n)}`)}function bj(n,l){return Ee(`/shared/conversations/${encodeURIComponent(n)}/logs`)}function xj(n){return Ee(`/shared/conversations/${encodeURIComponent(n)}/output`)}function Sj(n,l="."){return Ee(`/shared/conversations/${encodeURIComponent(n)}/output/tree?path=${encodeURIComponent(l)}`)}function wj(n,l){return Ee(`/shared/conversations/${encodeURIComponent(n)}/output/content?path=${encodeURIComponent(l)}`)}function Ej(n,l){return Ee(`/shared/conversations/${encodeURIComponent(n)}/output/preview-sessions`,{method:"POST",body:JSON.stringify(l?{path:l}:{})})}function aE(n){return n?typeof n=="string"?{path:n}:{...n.path?{path:n.path}:{},...n.port!==void 0?{port:n.port}:{}}:{}}function Nj(n){return Ee(`/tasks/${n}/output`)}function Cj(n,l="."){return Ee(`/tasks/${n}/output/tree?path=${encodeURIComponent(l)}`)}function Tj(n,l){return Ee(`/tasks/${n}/output/content?path=${encodeURIComponent(l)}`)}function Rj(n,l){return Ee(`/tasks/${n}/output/preview-sessions`,{method:"POST",body:JSON.stringify(aE(l))})}function Aj(n){return Ee(`/tasks/${n}/output/diff`)}function lE({hasStarted:n,enabled:l}){return l&&!n}function rE(n,l,o=!0){const i=y.useRef(n),u=y.useRef(!1);y.useEffect(()=>{i.current=n},[n]),y.useEffect(()=>{if(!o)return;const d=()=>i.current();lE({hasStarted:u.current,enabled:o})&&(u.current=!0,d());const m=setInterval(d,l);return()=>clearInterval(m)},[l,o])}let oE=0;function iE(n=50){const[l,o]=y.useState([]),[i,u]=y.useState(!1),d=y.useRef(null),m=y.useRef(0),h=y.useRef(new Map);y.useEffect(()=>{const x=new EventSource("/api/events");d.current=x,x.onopen=()=>u(!0),x.onerror=()=>u(!1);const v=["node.joined","node.left","node.status","node.operation.created","node.operation.updated","task.created","task.assigned","task.status","task.updated","task.deleted","task.output","election.started","election.complete","cluster.state","transport.changed"];for(const w of v)x.addEventListener(w,E=>{const C={id:String(++oE),type:w,data:JSON.parse(E.data),timestamp:Date.now()};o(N=>[C,...N].slice(0,n));for(const[,{pattern:N,callback:T}]of h.current)w.startsWith(N)&&T(C)});return()=>{x.close(),d.current=null,u(!1)}},[n]);const g=y.useCallback((x,v)=>{const w=++m.current;return h.current.set(w,{pattern:x,callback:v}),()=>{h.current.delete(w)}},[]),p=y.useCallback(()=>o([]),[]);return{events:l,connected:i,subscribe:g,clearEvents:p}}const sE=1e4,cE=6e4,uE=sE,dE=250,fE=new Set(["task.created","task.assigned","task.deleted"]),mE=new Set(["task.created","task.assigned","task.status","task.deleted"]);function hE(n){return n?cE:uE}function _j(n){return fE.has(n)}function pE(n){return mE.has(n)}function gE(n,l){if(!l)return!0;const o=n.leaderId,i=n.term,u=n.nodeCount;return typeof o!="string"&&o!==null||typeof i!="number"||typeof u!="number"?!0:l.leaderId!==o||l.term!==i||l.nodeCount!==u}function vE(n,l,o){if(n==="node.joined"||n==="node.left"||n!=="node.status")return!0;const i=l.nodeId,u=l.status;return typeof i!="string"||typeof u!="string"?!0:o.get(i)!==u}function jj(n,l){const o=l.taskId,i=l.status;if(typeof o!="string"||typeof i!="string")return n;let u=!1;const d=n.map(m=>{if(m.id!==o)return m;u=!0;const h="result"in l?l.result:i==="completed"?null:m.result,g="error"in l?l.error:i==="completed"?null:m.error;return{...m,status:i,result:h,error:g}});return u?d:n}const x0=y.createContext(null);function yE({children:n}){const[l,o]=y.useState(null),[i,u]=y.useState(null),[d,m]=y.useState(!0),[h,g]=y.useState(null),p=y.useRef(null),x=y.useRef(null),v=y.useRef(new Map),{events:w,connected:E,subscribe:C}=iE(),N=y.useCallback(async()=>{var R;try{const[j,O]=await Promise.all([Jw(),Iw()]),z=j,X=O.nodeId??O.id,K=z.nodes??[],V=K.find(ie=>ie.id===X)??{id:X,name:O.name,endpoint:O.endpoint,role:O.role,status:O.status,capabilities:O.capabilities,joinedAt:O.joinedAt,lastHeartbeat:O.lastHeartbeat},H=z.leaderId?K.find(ie=>ie.id===z.leaderId)??null:null,le={leader:H?{id:H.id,name:H.name,endpoint:H.endpoint,...H.dashboardOrigin?{dashboardOrigin:H.dashboardOrigin}:{}}:null,term:z.term??0,nodes:K,self:V,taskSummary:z.taskSummary??{total:0,pending:0,running:0,completed:0,failed:0}};x.current={leaderId:((R=le.leader)==null?void 0:R.id)??null,term:le.term,nodeCount:le.nodes.length},v.current=new Map(le.nodes.map(ie=>[ie.id,ie.status])),v.current.set(le.self.id,le.self.status),o(le),u(O),g(null)}catch(j){g(j instanceof Error?j.message:"Failed to fetch cluster state")}finally{m(!1)}},[]),T=y.useCallback(()=>{p.current===null&&(p.current=window.setTimeout(()=>{p.current=null,N()},dE))},[N]);return rE(N,hE(E)),y.useEffect(()=>()=>{p.current!==null&&(window.clearTimeout(p.current),p.current=null)},[]),y.useEffect(()=>{const R=[C("cluster",j=>{gE(j.data,x.current)&&T()}),C("election",T),C("node",j=>{vE(j.type,j.data,v.current)&&T()}),C("transport",T),C("task",j=>{pE(j.type)&&T()})];return()=>R.forEach(j=>j())},[C,T]),f.jsx(x0.Provider,{value:{cluster:l,systemInfo:i,events:w,sseConnected:E,subscribe:C,refresh:N,loading:d,error:h},children:n})}function S0(){const n=y.useContext(x0);if(!n)throw new Error("useCluster must be used within ClusterProvider");return n}/**
62
62
  * @license lucide-react v1.7.0 - ISC
63
63
  *
64
64
  * This source code is licensed under the ISC license.
@@ -312,10 +312,10 @@ Please change the parent <Route path="${R}"> to <Route path="${R==="/"?"*":`${R}
312
312
 
313
313
  If you want to hide the \`${l.titleName}\`, you can wrap it with our VisuallyHidden component.
314
314
 
315
- For more information, see https://radix-ui.com/primitives/docs/components/${l.docsSlug}`;return y.useEffect(()=>{n&&(document.getElementById(n)||console.error(o))},[o,n]),null},T5="DialogDescriptionWarning",R5=({contentRef:n,descriptionId:l})=>{const i=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Ny(T5).contentName}}.`;return y.useEffect(()=>{var d;const u=(d=n.current)==null?void 0:d.getAttribute("aria-describedby");l&&u&&(document.getElementById(l)||console.warn(i))},[i,n,l]),null},Cy=uy,Ty=fy,Ry=hy,jf=py,Mf=gy,Of=yy,Df=xy,Js=wy;const A5=Cy,_5=Ty,j5=Ry,jj=Js,Ay=y.forwardRef(({className:n,...l},o)=>f.jsx(jf,{ref:o,className:se("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}));Ay.displayName=jf.displayName;const _y=y.forwardRef(({className:n,children:l,...o},i)=>f.jsxs(j5,{children:[f.jsx(Ay,{}),f.jsxs(Mf,{ref:i,className:se("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),...o,children:[l,f.jsxs(Js,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[f.jsx(_0,{className:"h-4 w-4"}),f.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));_y.displayName=Mf.displayName;const jy=({className:n,...l})=>f.jsx("div",{className:se("flex flex-col space-y-1.5 text-center sm:text-left",n),...l});jy.displayName="DialogHeader";const M5=({className:n,...l})=>f.jsx("div",{className:se("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...l});M5.displayName="DialogFooter";const My=y.forwardRef(({className:n,...l},o)=>f.jsx(Of,{ref:o,className:se("text-lg font-semibold leading-none tracking-tight",n),...l}));My.displayName=Of.displayName;const Oy=y.forwardRef(({className:n,...l},o)=>f.jsx(Df,{ref:o,className:se("text-sm text-muted-foreground",n),...l}));Oy.displayName=Df.displayName;function O5({children:n,open:l,onOpenChange:o,showTrigger:i=!0}){const[u,d]=y.useState(!1),m=l??u,h=y.useCallback(g=>{l===void 0&&d(g),o==null||o(g)},[l,o]);return f.jsxs(A5,{open:m,onOpenChange:h,children:[i&&f.jsx(_5,{asChild:!0,children:f.jsx(Sn,{variant:"ghost",size:"icon","aria-label":"Settings",title:"Settings",className:"h-8 w-8 rounded-sm text-muted-foreground hover:bg-muted/50 hover:text-foreground",children:f.jsx(vN,{className:"h-4 w-4"})})}),f.jsxs(_y,{className:"settings-dialog-content grid h-[min(78vh,38rem)] max-h-[78vh] max-w-[min(86vw,50rem)] grid-rows-[auto_minmax(0,1fr)] gap-0 overflow-hidden rounded-xl border-border/70 bg-background/96 p-0 shadow-[0_40px_120px_-56px_rgba(15,23,42,0.75)] backdrop-blur-xl",children:[f.jsxs(jy,{className:"shrink-0 border-b border-border/60 px-3 py-1.5 sm:px-3.5",children:[f.jsxs(My,{className:"flex items-center gap-1.5 text-[11px]",children:[f.jsx(eN,{className:"h-3.5 w-3.5 text-primary"}),"Settings"]}),f.jsx(Oy,{className:"text-[10px]",children:"Session diagnostics, access configuration, and build metadata for the current Meshy node."})]}),f.jsx("div",{className:"min-h-0 overflow-y-auto px-2.5 pb-2 pt-0 sm:px-3 sm:pb-2.5",children:n})]})]})}function Dv(n,[l,o]){return Math.min(o,Math.max(l,n))}function Dy(n){const l=n+"CollectionProvider",[o,i]=Fa(l),[u,d]=o(l,{collectionRef:{current:null},itemMap:new Map}),m=N=>{const{scope:T,children:R}=N,j=ae.useRef(null),O=ae.useRef(new Map).current;return f.jsx(u,{scope:T,itemMap:O,collectionRef:j,children:R})};m.displayName=l;const h=n+"CollectionSlot",g=qo(h),p=ae.forwardRef((N,T)=>{const{scope:R,children:j}=N,O=d(h,R),z=Ie(T,O.collectionRef);return f.jsx(g,{ref:z,children:j})});p.displayName=h;const x=n+"CollectionItemSlot",v="data-radix-collection-item",w=qo(x),E=ae.forwardRef((N,T)=>{const{scope:R,children:j,...O}=N,z=ae.useRef(null),X=Ie(T,z),K=d(x,R);return ae.useEffect(()=>(K.itemMap.set(z,{ref:z,...O}),()=>void K.itemMap.delete(z))),f.jsx(w,{[v]:"",ref:X,children:j})});E.displayName=x;function C(N){const T=d(n+"CollectionConsumer",N);return ae.useCallback(()=>{const j=T.collectionRef.current;if(!j)return[];const O=Array.from(j.querySelectorAll(`[${v}]`));return Array.from(T.itemMap.values()).sort((K,V)=>O.indexOf(K.ref.current)-O.indexOf(V.ref.current))},[T.collectionRef,T.itemMap])}return[{Provider:m,Slot:p,ItemSlot:E},C,i]}var D5=y.createContext(void 0);function kf(n){const l=y.useContext(D5);return n||l||"ltr"}const k5=["top","right","bottom","left"],Ka=Math.min,en=Math.max,Ds=Math.round,xs=Math.floor,$n=n=>({x:n,y:n}),z5={left:"right",right:"left",bottom:"top",top:"bottom"};function Jd(n,l,o){return en(n,Ka(l,o))}function da(n,l){return typeof n=="function"?n(l):n}function fa(n){return n.split("-")[0]}function zr(n){return n.split("-")[1]}function zf(n){return n==="x"?"y":"x"}function Lf(n){return n==="y"?"height":"width"}function Hn(n){const l=n[0];return l==="t"||l==="b"?"y":"x"}function Uf(n){return zf(Hn(n))}function L5(n,l,o){o===void 0&&(o=!1);const i=zr(n),u=Uf(n),d=Lf(u);let m=u==="x"?i===(o?"end":"start")?"right":"left":i==="start"?"bottom":"top";return l.reference[d]>l.floating[d]&&(m=ks(m)),[m,ks(m)]}function U5(n){const l=ks(n);return[Wd(n),l,Wd(l)]}function Wd(n){return n.includes("start")?n.replace("start","end"):n.replace("end","start")}const kv=["left","right"],zv=["right","left"],B5=["top","bottom"],H5=["bottom","top"];function V5(n,l,o){switch(n){case"top":case"bottom":return o?l?zv:kv:l?kv:zv;case"left":case"right":return l?B5:H5;default:return[]}}function $5(n,l,o,i){const u=zr(n);let d=V5(fa(n),o==="start",i);return u&&(d=d.map(m=>m+"-"+u),l&&(d=d.concat(d.map(Wd)))),d}function ks(n){const l=fa(n);return z5[l]+n.slice(l.length)}function Y5(n){return{top:0,right:0,bottom:0,left:0,...n}}function ky(n){return typeof n!="number"?Y5(n):{top:n,right:n,bottom:n,left:n}}function zs(n){const{x:l,y:o,width:i,height:u}=n;return{width:i,height:u,top:o,left:l,right:l+i,bottom:o+u,x:l,y:o}}function Lv(n,l,o){let{reference:i,floating:u}=n;const d=Hn(l),m=Uf(l),h=Lf(m),g=fa(l),p=d==="y",x=i.x+i.width/2-u.width/2,v=i.y+i.height/2-u.height/2,w=i[h]/2-u[h]/2;let E;switch(g){case"top":E={x,y:i.y-u.height};break;case"bottom":E={x,y:i.y+i.height};break;case"right":E={x:i.x+i.width,y:v};break;case"left":E={x:i.x-u.width,y:v};break;default:E={x:i.x,y:i.y}}switch(zr(l)){case"start":E[m]-=w*(o&&p?-1:1);break;case"end":E[m]+=w*(o&&p?-1:1);break}return E}async function q5(n,l){var o;l===void 0&&(l={});const{x:i,y:u,platform:d,rects:m,elements:h,strategy:g}=n,{boundary:p="clippingAncestors",rootBoundary:x="viewport",elementContext:v="floating",altBoundary:w=!1,padding:E=0}=da(l,n),C=ky(E),T=h[w?v==="floating"?"reference":"floating":v],R=zs(await d.getClippingRect({element:(o=await(d.isElement==null?void 0:d.isElement(T)))==null||o?T:T.contextElement||await(d.getDocumentElement==null?void 0:d.getDocumentElement(h.floating)),boundary:p,rootBoundary:x,strategy:g})),j=v==="floating"?{x:i,y:u,width:m.floating.width,height:m.floating.height}:m.reference,O=await(d.getOffsetParent==null?void 0:d.getOffsetParent(h.floating)),z=await(d.isElement==null?void 0:d.isElement(O))?await(d.getScale==null?void 0:d.getScale(O))||{x:1,y:1}:{x:1,y:1},X=zs(d.convertOffsetParentRelativeRectToViewportRelativeRect?await d.convertOffsetParentRelativeRectToViewportRelativeRect({elements:h,rect:j,offsetParent:O,strategy:g}):j);return{top:(R.top-X.top+C.top)/z.y,bottom:(X.bottom-R.bottom+C.bottom)/z.y,left:(R.left-X.left+C.left)/z.x,right:(X.right-R.right+C.right)/z.x}}const G5=50,X5=async(n,l,o)=>{const{placement:i="bottom",strategy:u="absolute",middleware:d=[],platform:m}=o,h=m.detectOverflow?m:{...m,detectOverflow:q5},g=await(m.isRTL==null?void 0:m.isRTL(l));let p=await m.getElementRects({reference:n,floating:l,strategy:u}),{x,y:v}=Lv(p,i,g),w=i,E=0;const C={};for(let N=0;N<d.length;N++){const T=d[N];if(!T)continue;const{name:R,fn:j}=T,{x:O,y:z,data:X,reset:K}=await j({x,y:v,initialPlacement:i,placement:w,strategy:u,middlewareData:C,rects:p,platform:h,elements:{reference:n,floating:l}});x=O??x,v=z??v,C[R]={...C[R],...X},K&&E<G5&&(E++,typeof K=="object"&&(K.placement&&(w=K.placement),K.rects&&(p=K.rects===!0?await m.getElementRects({reference:n,floating:l,strategy:u}):K.rects),{x,y:v}=Lv(p,w,g)),N=-1)}return{x,y:v,placement:w,strategy:u,middlewareData:C}},P5=n=>({name:"arrow",options:n,async fn(l){const{x:o,y:i,placement:u,rects:d,platform:m,elements:h,middlewareData:g}=l,{element:p,padding:x=0}=da(n,l)||{};if(p==null)return{};const v=ky(x),w={x:o,y:i},E=Uf(u),C=Lf(E),N=await m.getDimensions(p),T=E==="y",R=T?"top":"left",j=T?"bottom":"right",O=T?"clientHeight":"clientWidth",z=d.reference[C]+d.reference[E]-w[E]-d.floating[C],X=w[E]-d.reference[E],K=await(m.getOffsetParent==null?void 0:m.getOffsetParent(p));let V=K?K[O]:0;(!V||!await(m.isElement==null?void 0:m.isElement(K)))&&(V=h.floating[O]||d.floating[C]);const H=z/2-X/2,le=V/2-N[C]/2-1,ie=Ka(v[R],le),me=Ka(v[j],le),fe=ie,ce=V-N[C]-me,de=V/2-N[C]/2+H,re=Jd(fe,de,ce),M=!g.arrow&&zr(u)!=null&&de!==re&&d.reference[C]/2-(de<fe?ie:me)-N[C]/2<0,$=M?de<fe?de-fe:de-ce:0;return{[E]:w[E]+$,data:{[E]:re,centerOffset:de-re-$,...M&&{alignmentOffset:$}},reset:M}}}),Q5=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(l){var o,i;const{placement:u,middlewareData:d,rects:m,initialPlacement:h,platform:g,elements:p}=l,{mainAxis:x=!0,crossAxis:v=!0,fallbackPlacements:w,fallbackStrategy:E="bestFit",fallbackAxisSideDirection:C="none",flipAlignment:N=!0,...T}=da(n,l);if((o=d.arrow)!=null&&o.alignmentOffset)return{};const R=fa(u),j=Hn(h),O=fa(h)===h,z=await(g.isRTL==null?void 0:g.isRTL(p.floating)),X=w||(O||!N?[ks(h)]:U5(h)),K=C!=="none";!w&&K&&X.push(...$5(h,N,C,z));const V=[h,...X],H=await g.detectOverflow(l,T),le=[];let ie=((i=d.flip)==null?void 0:i.overflows)||[];if(x&&le.push(H[R]),v){const de=L5(u,m,z);le.push(H[de[0]],H[de[1]])}if(ie=[...ie,{placement:u,overflows:le}],!le.every(de=>de<=0)){var me,fe;const de=(((me=d.flip)==null?void 0:me.index)||0)+1,re=V[de];if(re&&(!(v==="alignment"?j!==Hn(re):!1)||ie.every(F=>Hn(F.placement)===j?F.overflows[0]>0:!0)))return{data:{index:de,overflows:ie},reset:{placement:re}};let M=(fe=ie.filter($=>$.overflows[0]<=0).sort(($,F)=>$.overflows[1]-F.overflows[1])[0])==null?void 0:fe.placement;if(!M)switch(E){case"bestFit":{var ce;const $=(ce=ie.filter(F=>{if(K){const J=Hn(F.placement);return J===j||J==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(J=>J>0).reduce((J,G)=>J+G,0)]).sort((F,J)=>F[1]-J[1])[0])==null?void 0:ce[0];$&&(M=$);break}case"initialPlacement":M=h;break}if(u!==M)return{reset:{placement:M}}}return{}}}};function Uv(n,l){return{top:n.top-l.height,right:n.right-l.width,bottom:n.bottom-l.height,left:n.left-l.width}}function Bv(n){return k5.some(l=>n[l]>=0)}const K5=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(l){const{rects:o,platform:i}=l,{strategy:u="referenceHidden",...d}=da(n,l);switch(u){case"referenceHidden":{const m=await i.detectOverflow(l,{...d,elementContext:"reference"}),h=Uv(m,o.reference);return{data:{referenceHiddenOffsets:h,referenceHidden:Bv(h)}}}case"escaped":{const m=await i.detectOverflow(l,{...d,altBoundary:!0}),h=Uv(m,o.floating);return{data:{escapedOffsets:h,escaped:Bv(h)}}}default:return{}}}}},zy=new Set(["left","top"]);async function Z5(n,l){const{placement:o,platform:i,elements:u}=n,d=await(i.isRTL==null?void 0:i.isRTL(u.floating)),m=fa(o),h=zr(o),g=Hn(o)==="y",p=zy.has(m)?-1:1,x=d&&g?-1:1,v=da(l,n);let{mainAxis:w,crossAxis:E,alignmentAxis:C}=typeof v=="number"?{mainAxis:v,crossAxis:0,alignmentAxis:null}:{mainAxis:v.mainAxis||0,crossAxis:v.crossAxis||0,alignmentAxis:v.alignmentAxis};return h&&typeof C=="number"&&(E=h==="end"?C*-1:C),g?{x:E*x,y:w*p}:{x:w*p,y:E*x}}const I5=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(l){var o,i;const{x:u,y:d,placement:m,middlewareData:h}=l,g=await Z5(l,n);return m===((o=h.offset)==null?void 0:o.placement)&&(i=h.arrow)!=null&&i.alignmentOffset?{}:{x:u+g.x,y:d+g.y,data:{...g,placement:m}}}}},F5=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(l){const{x:o,y:i,placement:u,platform:d}=l,{mainAxis:m=!0,crossAxis:h=!1,limiter:g={fn:R=>{let{x:j,y:O}=R;return{x:j,y:O}}},...p}=da(n,l),x={x:o,y:i},v=await d.detectOverflow(l,p),w=Hn(fa(u)),E=zf(w);let C=x[E],N=x[w];if(m){const R=E==="y"?"top":"left",j=E==="y"?"bottom":"right",O=C+v[R],z=C-v[j];C=Jd(O,C,z)}if(h){const R=w==="y"?"top":"left",j=w==="y"?"bottom":"right",O=N+v[R],z=N-v[j];N=Jd(O,N,z)}const T=g.fn({...l,[E]:C,[w]:N});return{...T,data:{x:T.x-o,y:T.y-i,enabled:{[E]:m,[w]:h}}}}}},J5=function(n){return n===void 0&&(n={}),{options:n,fn(l){const{x:o,y:i,placement:u,rects:d,middlewareData:m}=l,{offset:h=0,mainAxis:g=!0,crossAxis:p=!0}=da(n,l),x={x:o,y:i},v=Hn(u),w=zf(v);let E=x[w],C=x[v];const N=da(h,l),T=typeof N=="number"?{mainAxis:N,crossAxis:0}:{mainAxis:0,crossAxis:0,...N};if(g){const O=w==="y"?"height":"width",z=d.reference[w]-d.floating[O]+T.mainAxis,X=d.reference[w]+d.reference[O]-T.mainAxis;E<z?E=z:E>X&&(E=X)}if(p){var R,j;const O=w==="y"?"width":"height",z=zy.has(fa(u)),X=d.reference[v]-d.floating[O]+(z&&((R=m.offset)==null?void 0:R[v])||0)+(z?0:T.crossAxis),K=d.reference[v]+d.reference[O]+(z?0:((j=m.offset)==null?void 0:j[v])||0)-(z?T.crossAxis:0);C<X?C=X:C>K&&(C=K)}return{[w]:E,[v]:C}}}},W5=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(l){var o,i;const{placement:u,rects:d,platform:m,elements:h}=l,{apply:g=()=>{},...p}=da(n,l),x=await m.detectOverflow(l,p),v=fa(u),w=zr(u),E=Hn(u)==="y",{width:C,height:N}=d.floating;let T,R;v==="top"||v==="bottom"?(T=v,R=w===(await(m.isRTL==null?void 0:m.isRTL(h.floating))?"start":"end")?"left":"right"):(R=v,T=w==="end"?"top":"bottom");const j=N-x.top-x.bottom,O=C-x.left-x.right,z=Ka(N-x[T],j),X=Ka(C-x[R],O),K=!l.middlewareData.shift;let V=z,H=X;if((o=l.middlewareData.shift)!=null&&o.enabled.x&&(H=O),(i=l.middlewareData.shift)!=null&&i.enabled.y&&(V=j),K&&!w){const ie=en(x.left,0),me=en(x.right,0),fe=en(x.top,0),ce=en(x.bottom,0);E?H=C-2*(ie!==0||me!==0?ie+me:en(x.left,x.right)):V=N-2*(fe!==0||ce!==0?fe+ce:en(x.top,x.bottom))}await g({...l,availableWidth:H,availableHeight:V});const le=await m.getDimensions(h.floating);return C!==le.width||N!==le.height?{reset:{rects:!0}}:{}}}};function Ws(){return typeof window<"u"}function Lr(n){return Ly(n)?(n.nodeName||"").toLowerCase():"#document"}function tn(n){var l;return(n==null||(l=n.ownerDocument)==null?void 0:l.defaultView)||window}function qn(n){var l;return(l=(Ly(n)?n.ownerDocument:n.document)||window.document)==null?void 0:l.documentElement}function Ly(n){return Ws()?n instanceof Node||n instanceof tn(n).Node:!1}function En(n){return Ws()?n instanceof Element||n instanceof tn(n).Element:!1}function ma(n){return Ws()?n instanceof HTMLElement||n instanceof tn(n).HTMLElement:!1}function Hv(n){return!Ws()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof tn(n).ShadowRoot}function Ko(n){const{overflow:l,overflowX:o,overflowY:i,display:u}=Nn(n);return/auto|scroll|overlay|hidden|clip/.test(l+i+o)&&u!=="inline"&&u!=="contents"}function eR(n){return/^(table|td|th)$/.test(Lr(n))}function ec(n){try{if(n.matches(":popover-open"))return!0}catch{}try{return n.matches(":modal")}catch{return!1}}const tR=/transform|translate|scale|rotate|perspective|filter/,nR=/paint|layout|strict|content/,El=n=>!!n&&n!=="none";let Bd;function Bf(n){const l=En(n)?Nn(n):n;return El(l.transform)||El(l.translate)||El(l.scale)||El(l.rotate)||El(l.perspective)||!Hf()&&(El(l.backdropFilter)||El(l.filter))||tR.test(l.willChange||"")||nR.test(l.contain||"")}function aR(n){let l=Za(n);for(;ma(l)&&!_r(l);){if(Bf(l))return l;if(ec(l))return null;l=Za(l)}return null}function Hf(){return Bd==null&&(Bd=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Bd}function _r(n){return/^(html|body|#document)$/.test(Lr(n))}function Nn(n){return tn(n).getComputedStyle(n)}function tc(n){return En(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function Za(n){if(Lr(n)==="html")return n;const l=n.assignedSlot||n.parentNode||Hv(n)&&n.host||qn(n);return Hv(l)?l.host:l}function Uy(n){const l=Za(n);return _r(l)?n.ownerDocument?n.ownerDocument.body:n.body:ma(l)&&Ko(l)?l:Uy(l)}function Go(n,l,o){var i;l===void 0&&(l=[]),o===void 0&&(o=!0);const u=Uy(n),d=u===((i=n.ownerDocument)==null?void 0:i.body),m=tn(u);if(d){const h=ef(m);return l.concat(m,m.visualViewport||[],Ko(u)?u:[],h&&o?Go(h):[])}else return l.concat(u,Go(u,[],o))}function ef(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function By(n){const l=Nn(n);let o=parseFloat(l.width)||0,i=parseFloat(l.height)||0;const u=ma(n),d=u?n.offsetWidth:o,m=u?n.offsetHeight:i,h=Ds(o)!==d||Ds(i)!==m;return h&&(o=d,i=m),{width:o,height:i,$:h}}function Vf(n){return En(n)?n:n.contextElement}function Tr(n){const l=Vf(n);if(!ma(l))return $n(1);const o=l.getBoundingClientRect(),{width:i,height:u,$:d}=By(l);let m=(d?Ds(o.width):o.width)/i,h=(d?Ds(o.height):o.height)/u;return(!m||!Number.isFinite(m))&&(m=1),(!h||!Number.isFinite(h))&&(h=1),{x:m,y:h}}const lR=$n(0);function Hy(n){const l=tn(n);return!Hf()||!l.visualViewport?lR:{x:l.visualViewport.offsetLeft,y:l.visualViewport.offsetTop}}function rR(n,l,o){return l===void 0&&(l=!1),!o||l&&o!==tn(n)?!1:l}function Rl(n,l,o,i){l===void 0&&(l=!1),o===void 0&&(o=!1);const u=n.getBoundingClientRect(),d=Vf(n);let m=$n(1);l&&(i?En(i)&&(m=Tr(i)):m=Tr(n));const h=rR(d,o,i)?Hy(d):$n(0);let g=(u.left+h.x)/m.x,p=(u.top+h.y)/m.y,x=u.width/m.x,v=u.height/m.y;if(d){const w=tn(d),E=i&&En(i)?tn(i):i;let C=w,N=ef(C);for(;N&&i&&E!==C;){const T=Tr(N),R=N.getBoundingClientRect(),j=Nn(N),O=R.left+(N.clientLeft+parseFloat(j.paddingLeft))*T.x,z=R.top+(N.clientTop+parseFloat(j.paddingTop))*T.y;g*=T.x,p*=T.y,x*=T.x,v*=T.y,g+=O,p+=z,C=tn(N),N=ef(C)}}return zs({width:x,height:v,x:g,y:p})}function nc(n,l){const o=tc(n).scrollLeft;return l?l.left+o:Rl(qn(n)).left+o}function Vy(n,l){const o=n.getBoundingClientRect(),i=o.left+l.scrollLeft-nc(n,o),u=o.top+l.scrollTop;return{x:i,y:u}}function oR(n){let{elements:l,rect:o,offsetParent:i,strategy:u}=n;const d=u==="fixed",m=qn(i),h=l?ec(l.floating):!1;if(i===m||h&&d)return o;let g={scrollLeft:0,scrollTop:0},p=$n(1);const x=$n(0),v=ma(i);if((v||!v&&!d)&&((Lr(i)!=="body"||Ko(m))&&(g=tc(i)),v)){const E=Rl(i);p=Tr(i),x.x=E.x+i.clientLeft,x.y=E.y+i.clientTop}const w=m&&!v&&!d?Vy(m,g):$n(0);return{width:o.width*p.x,height:o.height*p.y,x:o.x*p.x-g.scrollLeft*p.x+x.x+w.x,y:o.y*p.y-g.scrollTop*p.y+x.y+w.y}}function iR(n){return Array.from(n.getClientRects())}function sR(n){const l=qn(n),o=tc(n),i=n.ownerDocument.body,u=en(l.scrollWidth,l.clientWidth,i.scrollWidth,i.clientWidth),d=en(l.scrollHeight,l.clientHeight,i.scrollHeight,i.clientHeight);let m=-o.scrollLeft+nc(n);const h=-o.scrollTop;return Nn(i).direction==="rtl"&&(m+=en(l.clientWidth,i.clientWidth)-u),{width:u,height:d,x:m,y:h}}const Vv=25;function cR(n,l){const o=tn(n),i=qn(n),u=o.visualViewport;let d=i.clientWidth,m=i.clientHeight,h=0,g=0;if(u){d=u.width,m=u.height;const x=Hf();(!x||x&&l==="fixed")&&(h=u.offsetLeft,g=u.offsetTop)}const p=nc(i);if(p<=0){const x=i.ownerDocument,v=x.body,w=getComputedStyle(v),E=x.compatMode==="CSS1Compat"&&parseFloat(w.marginLeft)+parseFloat(w.marginRight)||0,C=Math.abs(i.clientWidth-v.clientWidth-E);C<=Vv&&(d-=C)}else p<=Vv&&(d+=p);return{width:d,height:m,x:h,y:g}}function uR(n,l){const o=Rl(n,!0,l==="fixed"),i=o.top+n.clientTop,u=o.left+n.clientLeft,d=ma(n)?Tr(n):$n(1),m=n.clientWidth*d.x,h=n.clientHeight*d.y,g=u*d.x,p=i*d.y;return{width:m,height:h,x:g,y:p}}function $v(n,l,o){let i;if(l==="viewport")i=cR(n,o);else if(l==="document")i=sR(qn(n));else if(En(l))i=uR(l,o);else{const u=Hy(n);i={x:l.x-u.x,y:l.y-u.y,width:l.width,height:l.height}}return zs(i)}function $y(n,l){const o=Za(n);return o===l||!En(o)||_r(o)?!1:Nn(o).position==="fixed"||$y(o,l)}function dR(n,l){const o=l.get(n);if(o)return o;let i=Go(n,[],!1).filter(h=>En(h)&&Lr(h)!=="body"),u=null;const d=Nn(n).position==="fixed";let m=d?Za(n):n;for(;En(m)&&!_r(m);){const h=Nn(m),g=Bf(m);!g&&h.position==="fixed"&&(u=null),(d?!g&&!u:!g&&h.position==="static"&&!!u&&(u.position==="absolute"||u.position==="fixed")||Ko(m)&&!g&&$y(n,m))?i=i.filter(x=>x!==m):u=h,m=Za(m)}return l.set(n,i),i}function fR(n){let{element:l,boundary:o,rootBoundary:i,strategy:u}=n;const m=[...o==="clippingAncestors"?ec(l)?[]:dR(l,this._c):[].concat(o),i],h=$v(l,m[0],u);let g=h.top,p=h.right,x=h.bottom,v=h.left;for(let w=1;w<m.length;w++){const E=$v(l,m[w],u);g=en(E.top,g),p=Ka(E.right,p),x=Ka(E.bottom,x),v=en(E.left,v)}return{width:p-v,height:x-g,x:v,y:g}}function mR(n){const{width:l,height:o}=By(n);return{width:l,height:o}}function hR(n,l,o){const i=ma(l),u=qn(l),d=o==="fixed",m=Rl(n,!0,d,l);let h={scrollLeft:0,scrollTop:0};const g=$n(0);function p(){g.x=nc(u)}if(i||!i&&!d)if((Lr(l)!=="body"||Ko(u))&&(h=tc(l)),i){const E=Rl(l,!0,d,l);g.x=E.x+l.clientLeft,g.y=E.y+l.clientTop}else u&&p();d&&!i&&u&&p();const x=u&&!i&&!d?Vy(u,h):$n(0),v=m.left+h.scrollLeft-g.x-x.x,w=m.top+h.scrollTop-g.y-x.y;return{x:v,y:w,width:m.width,height:m.height}}function Hd(n){return Nn(n).position==="static"}function Yv(n,l){if(!ma(n)||Nn(n).position==="fixed")return null;if(l)return l(n);let o=n.offsetParent;return qn(n)===o&&(o=o.ownerDocument.body),o}function Yy(n,l){const o=tn(n);if(ec(n))return o;if(!ma(n)){let u=Za(n);for(;u&&!_r(u);){if(En(u)&&!Hd(u))return u;u=Za(u)}return o}let i=Yv(n,l);for(;i&&eR(i)&&Hd(i);)i=Yv(i,l);return i&&_r(i)&&Hd(i)&&!Bf(i)?o:i||aR(n)||o}const pR=async function(n){const l=this.getOffsetParent||Yy,o=this.getDimensions,i=await o(n.floating);return{reference:hR(n.reference,await l(n.floating),n.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function gR(n){return Nn(n).direction==="rtl"}const vR={convertOffsetParentRelativeRectToViewportRelativeRect:oR,getDocumentElement:qn,getClippingRect:fR,getOffsetParent:Yy,getElementRects:pR,getClientRects:iR,getDimensions:mR,getScale:Tr,isElement:En,isRTL:gR};function qy(n,l){return n.x===l.x&&n.y===l.y&&n.width===l.width&&n.height===l.height}function yR(n,l){let o=null,i;const u=qn(n);function d(){var h;clearTimeout(i),(h=o)==null||h.disconnect(),o=null}function m(h,g){h===void 0&&(h=!1),g===void 0&&(g=1),d();const p=n.getBoundingClientRect(),{left:x,top:v,width:w,height:E}=p;if(h||l(),!w||!E)return;const C=xs(v),N=xs(u.clientWidth-(x+w)),T=xs(u.clientHeight-(v+E)),R=xs(x),O={rootMargin:-C+"px "+-N+"px "+-T+"px "+-R+"px",threshold:en(0,Ka(1,g))||1};let z=!0;function X(K){const V=K[0].intersectionRatio;if(V!==g){if(!z)return m();V?m(!1,V):i=setTimeout(()=>{m(!1,1e-7)},1e3)}V===1&&!qy(p,n.getBoundingClientRect())&&m(),z=!1}try{o=new IntersectionObserver(X,{...O,root:u.ownerDocument})}catch{o=new IntersectionObserver(X,O)}o.observe(n)}return m(!0),d}function bR(n,l,o,i){i===void 0&&(i={});const{ancestorScroll:u=!0,ancestorResize:d=!0,elementResize:m=typeof ResizeObserver=="function",layoutShift:h=typeof IntersectionObserver=="function",animationFrame:g=!1}=i,p=Vf(n),x=u||d?[...p?Go(p):[],...l?Go(l):[]]:[];x.forEach(R=>{u&&R.addEventListener("scroll",o,{passive:!0}),d&&R.addEventListener("resize",o)});const v=p&&h?yR(p,o):null;let w=-1,E=null;m&&(E=new ResizeObserver(R=>{let[j]=R;j&&j.target===p&&E&&l&&(E.unobserve(l),cancelAnimationFrame(w),w=requestAnimationFrame(()=>{var O;(O=E)==null||O.observe(l)})),o()}),p&&!g&&E.observe(p),l&&E.observe(l));let C,N=g?Rl(n):null;g&&T();function T(){const R=Rl(n);N&&!qy(N,R)&&o(),N=R,C=requestAnimationFrame(T)}return o(),()=>{var R;x.forEach(j=>{u&&j.removeEventListener("scroll",o),d&&j.removeEventListener("resize",o)}),v==null||v(),(R=E)==null||R.disconnect(),E=null,g&&cancelAnimationFrame(C)}}const xR=I5,SR=F5,wR=Q5,ER=W5,NR=K5,qv=P5,CR=J5,TR=(n,l,o)=>{const i=new Map,u={platform:vR,...o},d={...u.platform,_c:i};return X5(n,l,{...u,platform:d})};var RR=typeof document<"u",AR=function(){},Cs=RR?y.useLayoutEffect:AR;function Ls(n,l){if(n===l)return!0;if(typeof n!=typeof l)return!1;if(typeof n=="function"&&n.toString()===l.toString())return!0;let o,i,u;if(n&&l&&typeof n=="object"){if(Array.isArray(n)){if(o=n.length,o!==l.length)return!1;for(i=o;i--!==0;)if(!Ls(n[i],l[i]))return!1;return!0}if(u=Object.keys(n),o=u.length,o!==Object.keys(l).length)return!1;for(i=o;i--!==0;)if(!{}.hasOwnProperty.call(l,u[i]))return!1;for(i=o;i--!==0;){const d=u[i];if(!(d==="_owner"&&n.$$typeof)&&!Ls(n[d],l[d]))return!1}return!0}return n!==n&&l!==l}function Gy(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function Gv(n,l){const o=Gy(n);return Math.round(l*o)/o}function Vd(n){const l=y.useRef(n);return Cs(()=>{l.current=n}),l}function _R(n){n===void 0&&(n={});const{placement:l="bottom",strategy:o="absolute",middleware:i=[],platform:u,elements:{reference:d,floating:m}={},transform:h=!0,whileElementsMounted:g,open:p}=n,[x,v]=y.useState({x:0,y:0,strategy:o,placement:l,middlewareData:{},isPositioned:!1}),[w,E]=y.useState(i);Ls(w,i)||E(i);const[C,N]=y.useState(null),[T,R]=y.useState(null),j=y.useCallback(F=>{F!==K.current&&(K.current=F,N(F))},[]),O=y.useCallback(F=>{F!==V.current&&(V.current=F,R(F))},[]),z=d||C,X=m||T,K=y.useRef(null),V=y.useRef(null),H=y.useRef(x),le=g!=null,ie=Vd(g),me=Vd(u),fe=Vd(p),ce=y.useCallback(()=>{if(!K.current||!V.current)return;const F={placement:l,strategy:o,middleware:w};me.current&&(F.platform=me.current),TR(K.current,V.current,F).then(J=>{const G={...J,isPositioned:fe.current!==!1};de.current&&!Ls(H.current,G)&&(H.current=G,Qo.flushSync(()=>{v(G)}))})},[w,l,o,me,fe]);Cs(()=>{p===!1&&H.current.isPositioned&&(H.current.isPositioned=!1,v(F=>({...F,isPositioned:!1})))},[p]);const de=y.useRef(!1);Cs(()=>(de.current=!0,()=>{de.current=!1}),[]),Cs(()=>{if(z&&(K.current=z),X&&(V.current=X),z&&X){if(ie.current)return ie.current(z,X,ce);ce()}},[z,X,ce,ie,le]);const re=y.useMemo(()=>({reference:K,floating:V,setReference:j,setFloating:O}),[j,O]),M=y.useMemo(()=>({reference:z,floating:X}),[z,X]),$=y.useMemo(()=>{const F={position:o,left:0,top:0};if(!M.floating)return F;const J=Gv(M.floating,x.x),G=Gv(M.floating,x.y);return h?{...F,transform:"translate("+J+"px, "+G+"px)",...Gy(M.floating)>=1.5&&{willChange:"transform"}}:{position:o,left:J,top:G}},[o,h,M.floating,x.x,x.y]);return y.useMemo(()=>({...x,update:ce,refs:re,elements:M,floatingStyles:$}),[x,ce,re,M,$])}const jR=n=>{function l(o){return{}.hasOwnProperty.call(o,"current")}return{name:"arrow",options:n,fn(o){const{element:i,padding:u}=typeof n=="function"?n(o):n;return i&&l(i)?i.current!=null?qv({element:i.current,padding:u}).fn(o):{}:i?qv({element:i,padding:u}).fn(o):{}}}},MR=(n,l)=>{const o=xR(n);return{name:o.name,fn:o.fn,options:[n,l]}},OR=(n,l)=>{const o=SR(n);return{name:o.name,fn:o.fn,options:[n,l]}},DR=(n,l)=>({fn:CR(n).fn,options:[n,l]}),kR=(n,l)=>{const o=wR(n);return{name:o.name,fn:o.fn,options:[n,l]}},zR=(n,l)=>{const o=ER(n);return{name:o.name,fn:o.fn,options:[n,l]}},LR=(n,l)=>{const o=NR(n);return{name:o.name,fn:o.fn,options:[n,l]}},UR=(n,l)=>{const o=jR(n);return{name:o.name,fn:o.fn,options:[n,l]}};var BR="Arrow",Xy=y.forwardRef((n,l)=>{const{children:o,width:i=10,height:u=5,...d}=n;return f.jsx(Le.svg,{...d,ref:l,width:i,height:u,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:n.asChild?o:f.jsx("polygon",{points:"0,0 30,0 15,10"})})});Xy.displayName=BR;var HR=Xy;function Py(n){const[l,o]=y.useState(void 0);return _t(()=>{if(n){o({width:n.offsetWidth,height:n.offsetHeight});const i=new ResizeObserver(u=>{if(!Array.isArray(u)||!u.length)return;const d=u[0];let m,h;if("borderBoxSize"in d){const g=d.borderBoxSize,p=Array.isArray(g)?g[0]:g;m=p.inlineSize,h=p.blockSize}else m=n.offsetWidth,h=n.offsetHeight;o({width:m,height:h})});return i.observe(n,{box:"border-box"}),()=>i.unobserve(n)}else o(void 0)},[n]),l}var $f="Popper",[Qy,Ky]=Fa($f),[VR,Zy]=Qy($f),Iy=n=>{const{__scopePopper:l,children:o}=n,[i,u]=y.useState(null);return f.jsx(VR,{scope:l,anchor:i,onAnchorChange:u,children:o})};Iy.displayName=$f;var Fy="PopperAnchor",Jy=y.forwardRef((n,l)=>{const{__scopePopper:o,virtualRef:i,...u}=n,d=Zy(Fy,o),m=y.useRef(null),h=Ie(l,m),g=y.useRef(null);return y.useEffect(()=>{const p=g.current;g.current=(i==null?void 0:i.current)||m.current,p!==g.current&&d.onAnchorChange(g.current)}),i?null:f.jsx(Le.div,{...u,ref:h})});Jy.displayName=Fy;var Yf="PopperContent",[$R,YR]=Qy(Yf),Wy=y.forwardRef((n,l)=>{var ne,ue,ee,xe,ye,Se;const{__scopePopper:o,side:i="bottom",sideOffset:u=0,align:d="center",alignOffset:m=0,arrowPadding:h=0,avoidCollisions:g=!0,collisionBoundary:p=[],collisionPadding:x=0,sticky:v="partial",hideWhenDetached:w=!1,updatePositionStrategy:E="optimized",onPlaced:C,...N}=n,T=Zy(Yf,o),[R,j]=y.useState(null),O=Ie(l,$e=>j($e)),[z,X]=y.useState(null),K=Py(z),V=(K==null?void 0:K.width)??0,H=(K==null?void 0:K.height)??0,le=i+(d!=="center"?"-"+d:""),ie=typeof x=="number"?x:{top:0,right:0,bottom:0,left:0,...x},me=Array.isArray(p)?p:[p],fe=me.length>0,ce={padding:ie,boundary:me.filter(GR),altBoundary:fe},{refs:de,floatingStyles:re,placement:M,isPositioned:$,middlewareData:F}=_R({strategy:"fixed",placement:le,whileElementsMounted:(...$e)=>bR(...$e,{animationFrame:E==="always"}),elements:{reference:T.anchor},middleware:[MR({mainAxis:u+H,alignmentAxis:m}),g&&OR({mainAxis:!0,crossAxis:!1,limiter:v==="partial"?DR():void 0,...ce}),g&&kR({...ce}),zR({...ce,apply:({elements:$e,rects:Ue,availableWidth:Ye,availableHeight:gt})=>{const{width:ot,height:Pt}=Ue.reference,vt=$e.floating.style;vt.setProperty("--radix-popper-available-width",`${Ye}px`),vt.setProperty("--radix-popper-available-height",`${gt}px`),vt.setProperty("--radix-popper-anchor-width",`${ot}px`),vt.setProperty("--radix-popper-anchor-height",`${Pt}px`)}}),z&&UR({element:z,padding:h}),XR({arrowWidth:V,arrowHeight:H}),w&&LR({strategy:"referenceHidden",...ce})]}),[J,G]=nb(M),A=Qa(C);_t(()=>{$&&(A==null||A())},[$,A]);const Y=(ne=F.arrow)==null?void 0:ne.x,Q=(ue=F.arrow)==null?void 0:ue.y,W=((ee=F.arrow)==null?void 0:ee.centerOffset)!==0,[te,oe]=y.useState();return _t(()=>{R&&oe(window.getComputedStyle(R).zIndex)},[R]),f.jsx("div",{ref:de.setFloating,"data-radix-popper-content-wrapper":"",style:{...re,transform:$?re.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:te,"--radix-popper-transform-origin":[(xe=F.transformOrigin)==null?void 0:xe.x,(ye=F.transformOrigin)==null?void 0:ye.y].join(" "),...((Se=F.hide)==null?void 0:Se.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:n.dir,children:f.jsx($R,{scope:o,placedSide:J,onArrowChange:X,arrowX:Y,arrowY:Q,shouldHideArrow:W,children:f.jsx(Le.div,{"data-side":J,"data-align":G,...N,ref:O,style:{...N.style,animation:$?void 0:"none"}})})})});Wy.displayName=Yf;var eb="PopperArrow",qR={top:"bottom",right:"left",bottom:"top",left:"right"},tb=y.forwardRef(function(l,o){const{__scopePopper:i,...u}=l,d=YR(eb,i),m=qR[d.placedSide];return f.jsx("span",{ref:d.onArrowChange,style:{position:"absolute",left:d.arrowX,top:d.arrowY,[m]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[d.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[d.placedSide],visibility:d.shouldHideArrow?"hidden":void 0},children:f.jsx(HR,{...u,ref:o,style:{...u.style,display:"block"}})})});tb.displayName=eb;function GR(n){return n!==null}var XR=n=>({name:"transformOrigin",options:n,fn(l){var T,R,j;const{placement:o,rects:i,middlewareData:u}=l,m=((T=u.arrow)==null?void 0:T.centerOffset)!==0,h=m?0:n.arrowWidth,g=m?0:n.arrowHeight,[p,x]=nb(o),v={start:"0%",center:"50%",end:"100%"}[x],w=(((R=u.arrow)==null?void 0:R.x)??0)+h/2,E=(((j=u.arrow)==null?void 0:j.y)??0)+g/2;let C="",N="";return p==="bottom"?(C=m?v:`${w}px`,N=`${-g}px`):p==="top"?(C=m?v:`${w}px`,N=`${i.floating.height+g}px`):p==="right"?(C=`${-g}px`,N=m?v:`${E}px`):p==="left"&&(C=`${i.floating.width+g}px`,N=m?v:`${E}px`),{data:{x:C,y:N}}}});function nb(n){const[l,o="center"]=n.split("-");return[l,o]}var PR=Iy,QR=Jy,KR=Wy,ZR=tb;function ab(n){const l=y.useRef({value:n,previous:n});return y.useMemo(()=>(l.current.value!==n&&(l.current.previous=l.current.value,l.current.value=n),l.current.previous),[n])}var lb=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),IR="VisuallyHidden",FR=y.forwardRef((n,l)=>f.jsx(Le.span,{...n,ref:l,style:{...lb,...n.style}}));FR.displayName=IR;var JR=[" ","Enter","ArrowUp","ArrowDown"],WR=[" ","Enter"],Al="Select",[ac,lc,eA]=Dy(Al),[Ur]=Fa(Al,[eA,Ky]),rc=Ky(),[tA,Ja]=Ur(Al),[nA,aA]=Ur(Al),rb=n=>{const{__scopeSelect:l,children:o,open:i,defaultOpen:u,onOpenChange:d,value:m,defaultValue:h,onValueChange:g,dir:p,name:x,autoComplete:v,disabled:w,required:E,form:C}=n,N=rc(l),[T,R]=y.useState(null),[j,O]=y.useState(null),[z,X]=y.useState(!1),K=kf(p),[V,H]=Ar({prop:i,defaultProp:u??!1,onChange:d,caller:Al}),[le,ie]=Ar({prop:m,defaultProp:h,onChange:g,caller:Al}),me=y.useRef(null),fe=T?C||!!T.closest("form"):!0,[ce,de]=y.useState(new Set),re=Array.from(ce).map(M=>M.props.value).join(";");return f.jsx(PR,{...N,children:f.jsxs(tA,{required:E,scope:l,trigger:T,onTriggerChange:R,valueNode:j,onValueNodeChange:O,valueNodeHasChildren:z,onValueNodeHasChildrenChange:X,contentId:Xa(),value:le,onValueChange:ie,open:V,onOpenChange:H,dir:K,triggerPointerDownPosRef:me,disabled:w,children:[f.jsx(ac.Provider,{scope:l,children:f.jsx(nA,{scope:n.__scopeSelect,onNativeOptionAdd:y.useCallback(M=>{de($=>new Set($).add(M))},[]),onNativeOptionRemove:y.useCallback(M=>{de($=>{const F=new Set($);return F.delete(M),F})},[]),children:o})}),fe?f.jsxs(_b,{"aria-hidden":!0,required:E,tabIndex:-1,name:x,autoComplete:v,value:le,onChange:M=>ie(M.target.value),disabled:w,form:C,children:[le===void 0?f.jsx("option",{value:""}):null,Array.from(ce)]},re):null]})})};rb.displayName=Al;var ob="SelectTrigger",ib=y.forwardRef((n,l)=>{const{__scopeSelect:o,disabled:i=!1,...u}=n,d=rc(o),m=Ja(ob,o),h=m.disabled||i,g=Ie(l,m.onTriggerChange),p=lc(o),x=y.useRef("touch"),[v,w,E]=Mb(N=>{const T=p().filter(O=>!O.disabled),R=T.find(O=>O.value===m.value),j=Ob(T,N,R);j!==void 0&&m.onValueChange(j.value)}),C=N=>{h||(m.onOpenChange(!0),E()),N&&(m.triggerPointerDownPosRef.current={x:Math.round(N.pageX),y:Math.round(N.pageY)})};return f.jsx(QR,{asChild:!0,...d,children:f.jsx(Le.button,{type:"button",role:"combobox","aria-controls":m.contentId,"aria-expanded":m.open,"aria-required":m.required,"aria-autocomplete":"none",dir:m.dir,"data-state":m.open?"open":"closed",disabled:h,"data-disabled":h?"":void 0,"data-placeholder":jb(m.value)?"":void 0,...u,ref:g,onClick:Me(u.onClick,N=>{N.currentTarget.focus(),x.current!=="mouse"&&C(N)}),onPointerDown:Me(u.onPointerDown,N=>{x.current=N.pointerType;const T=N.target;T.hasPointerCapture(N.pointerId)&&T.releasePointerCapture(N.pointerId),N.button===0&&N.ctrlKey===!1&&N.pointerType==="mouse"&&(C(N),N.preventDefault())}),onKeyDown:Me(u.onKeyDown,N=>{const T=v.current!=="";!(N.ctrlKey||N.altKey||N.metaKey)&&N.key.length===1&&w(N.key),!(T&&N.key===" ")&&JR.includes(N.key)&&(C(),N.preventDefault())})})})});ib.displayName=ob;var sb="SelectValue",cb=y.forwardRef((n,l)=>{const{__scopeSelect:o,className:i,style:u,children:d,placeholder:m="",...h}=n,g=Ja(sb,o),{onValueNodeHasChildrenChange:p}=g,x=d!==void 0,v=Ie(l,g.onValueNodeChange);return _t(()=>{p(x)},[p,x]),f.jsx(Le.span,{...h,ref:v,style:{pointerEvents:"none"},children:jb(g.value)?f.jsx(f.Fragment,{children:m}):d})});cb.displayName=sb;var lA="SelectIcon",ub=y.forwardRef((n,l)=>{const{__scopeSelect:o,children:i,...u}=n;return f.jsx(Le.span,{"aria-hidden":!0,...u,ref:l,children:i||"▼"})});ub.displayName=lA;var rA="SelectPortal",db=n=>f.jsx(Cf,{asChild:!0,...n});db.displayName=rA;var _l="SelectContent",fb=y.forwardRef((n,l)=>{const o=Ja(_l,n.__scopeSelect),[i,u]=y.useState();if(_t(()=>{u(new DocumentFragment)},[]),!o.open){const d=i;return d?Qo.createPortal(f.jsx(mb,{scope:n.__scopeSelect,children:f.jsx(ac.Slot,{scope:n.__scopeSelect,children:f.jsx("div",{children:n.children})})}),d):null}return f.jsx(hb,{...n,ref:l})});fb.displayName=_l;var xn=10,[mb,Wa]=Ur(_l),oA="SelectContentImpl",iA=qo("SelectContent.RemoveScroll"),hb=y.forwardRef((n,l)=>{const{__scopeSelect:o,position:i="item-aligned",onCloseAutoFocus:u,onEscapeKeyDown:d,onPointerDownOutside:m,side:h,sideOffset:g,align:p,alignOffset:x,arrowPadding:v,collisionBoundary:w,collisionPadding:E,sticky:C,hideWhenDetached:N,avoidCollisions:T,...R}=n,j=Ja(_l,o),[O,z]=y.useState(null),[X,K]=y.useState(null),V=Ie(l,ne=>z(ne)),[H,le]=y.useState(null),[ie,me]=y.useState(null),fe=lc(o),[ce,de]=y.useState(!1),re=y.useRef(!1);y.useEffect(()=>{if(O)return iy(O)},[O]),J0();const M=y.useCallback(ne=>{const[ue,...ee]=fe().map(Se=>Se.ref.current),[xe]=ee.slice(-1),ye=document.activeElement;for(const Se of ne)if(Se===ye||(Se==null||Se.scrollIntoView({block:"nearest"}),Se===ue&&X&&(X.scrollTop=0),Se===xe&&X&&(X.scrollTop=X.scrollHeight),Se==null||Se.focus(),document.activeElement!==ye))return},[fe,X]),$=y.useCallback(()=>M([H,O]),[M,H,O]);y.useEffect(()=>{ce&&$()},[ce,$]);const{onOpenChange:F,triggerPointerDownPosRef:J}=j;y.useEffect(()=>{if(O){let ne={x:0,y:0};const ue=xe=>{var ye,Se;ne={x:Math.abs(Math.round(xe.pageX)-(((ye=J.current)==null?void 0:ye.x)??0)),y:Math.abs(Math.round(xe.pageY)-(((Se=J.current)==null?void 0:Se.y)??0))}},ee=xe=>{ne.x<=10&&ne.y<=10?xe.preventDefault():O.contains(xe.target)||F(!1),document.removeEventListener("pointermove",ue),J.current=null};return J.current!==null&&(document.addEventListener("pointermove",ue),document.addEventListener("pointerup",ee,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ue),document.removeEventListener("pointerup",ee,{capture:!0})}}},[O,F,J]),y.useEffect(()=>{const ne=()=>F(!1);return window.addEventListener("blur",ne),window.addEventListener("resize",ne),()=>{window.removeEventListener("blur",ne),window.removeEventListener("resize",ne)}},[F]);const[G,A]=Mb(ne=>{const ue=fe().filter(ye=>!ye.disabled),ee=ue.find(ye=>ye.ref.current===document.activeElement),xe=Ob(ue,ne,ee);xe&&setTimeout(()=>xe.ref.current.focus())}),Y=y.useCallback((ne,ue,ee)=>{const xe=!re.current&&!ee;(j.value!==void 0&&j.value===ue||xe)&&(le(ne),xe&&(re.current=!0))},[j.value]),Q=y.useCallback(()=>O==null?void 0:O.focus(),[O]),W=y.useCallback((ne,ue,ee)=>{const xe=!re.current&&!ee;(j.value!==void 0&&j.value===ue||xe)&&me(ne)},[j.value]),te=i==="popper"?tf:pb,oe=te===tf?{side:h,sideOffset:g,align:p,alignOffset:x,arrowPadding:v,collisionBoundary:w,collisionPadding:E,sticky:C,hideWhenDetached:N,avoidCollisions:T}:{};return f.jsx(mb,{scope:o,content:O,viewport:X,onViewportChange:K,itemRefCallback:Y,selectedItem:H,onItemLeave:Q,itemTextRefCallback:W,focusSelectedItem:$,selectedItemText:ie,position:i,isPositioned:ce,searchRef:G,children:f.jsx(Tf,{as:iA,allowPinchZoom:!0,children:f.jsx(Nf,{asChild:!0,trapped:j.open,onMountAutoFocus:ne=>{ne.preventDefault()},onUnmountAutoFocus:Me(u,ne=>{var ue;(ue=j.trigger)==null||ue.focus({preventScroll:!0}),ne.preventDefault()}),children:f.jsx(Ef,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:d,onPointerDownOutside:m,onFocusOutside:ne=>ne.preventDefault(),onDismiss:()=>j.onOpenChange(!1),children:f.jsx(te,{role:"listbox",id:j.contentId,"data-state":j.open?"open":"closed",dir:j.dir,onContextMenu:ne=>ne.preventDefault(),...R,...oe,onPlaced:()=>de(!0),ref:V,style:{display:"flex",flexDirection:"column",outline:"none",...R.style},onKeyDown:Me(R.onKeyDown,ne=>{const ue=ne.ctrlKey||ne.altKey||ne.metaKey;if(ne.key==="Tab"&&ne.preventDefault(),!ue&&ne.key.length===1&&A(ne.key),["ArrowUp","ArrowDown","Home","End"].includes(ne.key)){let xe=fe().filter(ye=>!ye.disabled).map(ye=>ye.ref.current);if(["ArrowUp","End"].includes(ne.key)&&(xe=xe.slice().reverse()),["ArrowUp","ArrowDown"].includes(ne.key)){const ye=ne.target,Se=xe.indexOf(ye);xe=xe.slice(Se+1)}setTimeout(()=>M(xe)),ne.preventDefault()}})})})})})})});hb.displayName=oA;var sA="SelectItemAlignedPosition",pb=y.forwardRef((n,l)=>{const{__scopeSelect:o,onPlaced:i,...u}=n,d=Ja(_l,o),m=Wa(_l,o),[h,g]=y.useState(null),[p,x]=y.useState(null),v=Ie(l,V=>x(V)),w=lc(o),E=y.useRef(!1),C=y.useRef(!0),{viewport:N,selectedItem:T,selectedItemText:R,focusSelectedItem:j}=m,O=y.useCallback(()=>{if(d.trigger&&d.valueNode&&h&&p&&N&&T&&R){const V=d.trigger.getBoundingClientRect(),H=p.getBoundingClientRect(),le=d.valueNode.getBoundingClientRect(),ie=R.getBoundingClientRect();if(d.dir!=="rtl"){const ye=ie.left-H.left,Se=le.left-ye,$e=V.left-Se,Ue=V.width+$e,Ye=Math.max(Ue,H.width),gt=window.innerWidth-xn,ot=Dv(Se,[xn,Math.max(xn,gt-Ye)]);h.style.minWidth=Ue+"px",h.style.left=ot+"px"}else{const ye=H.right-ie.right,Se=window.innerWidth-le.right-ye,$e=window.innerWidth-V.right-Se,Ue=V.width+$e,Ye=Math.max(Ue,H.width),gt=window.innerWidth-xn,ot=Dv(Se,[xn,Math.max(xn,gt-Ye)]);h.style.minWidth=Ue+"px",h.style.right=ot+"px"}const me=w(),fe=window.innerHeight-xn*2,ce=N.scrollHeight,de=window.getComputedStyle(p),re=parseInt(de.borderTopWidth,10),M=parseInt(de.paddingTop,10),$=parseInt(de.borderBottomWidth,10),F=parseInt(de.paddingBottom,10),J=re+M+ce+F+$,G=Math.min(T.offsetHeight*5,J),A=window.getComputedStyle(N),Y=parseInt(A.paddingTop,10),Q=parseInt(A.paddingBottom,10),W=V.top+V.height/2-xn,te=fe-W,oe=T.offsetHeight/2,ne=T.offsetTop+oe,ue=re+M+ne,ee=J-ue;if(ue<=W){const ye=me.length>0&&T===me[me.length-1].ref.current;h.style.bottom="0px";const Se=p.clientHeight-N.offsetTop-N.offsetHeight,$e=Math.max(te,oe+(ye?Q:0)+Se+$),Ue=ue+$e;h.style.height=Ue+"px"}else{const ye=me.length>0&&T===me[0].ref.current;h.style.top="0px";const $e=Math.max(W,re+N.offsetTop+(ye?Y:0)+oe)+ee;h.style.height=$e+"px",N.scrollTop=ue-W+N.offsetTop}h.style.margin=`${xn}px 0`,h.style.minHeight=G+"px",h.style.maxHeight=fe+"px",i==null||i(),requestAnimationFrame(()=>E.current=!0)}},[w,d.trigger,d.valueNode,h,p,N,T,R,d.dir,i]);_t(()=>O(),[O]);const[z,X]=y.useState();_t(()=>{p&&X(window.getComputedStyle(p).zIndex)},[p]);const K=y.useCallback(V=>{V&&C.current===!0&&(O(),j==null||j(),C.current=!1)},[O,j]);return f.jsx(uA,{scope:o,contentWrapper:h,shouldExpandOnScrollRef:E,onScrollButtonChange:K,children:f.jsx("div",{ref:g,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:z},children:f.jsx(Le.div,{...u,ref:v,style:{boxSizing:"border-box",maxHeight:"100%",...u.style}})})})});pb.displayName=sA;var cA="SelectPopperPosition",tf=y.forwardRef((n,l)=>{const{__scopeSelect:o,align:i="start",collisionPadding:u=xn,...d}=n,m=rc(o);return f.jsx(KR,{...m,...d,ref:l,align:i,collisionPadding:u,style:{boxSizing:"border-box",...d.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});tf.displayName=cA;var[uA,qf]=Ur(_l,{}),nf="SelectViewport",gb=y.forwardRef((n,l)=>{const{__scopeSelect:o,nonce:i,...u}=n,d=Wa(nf,o),m=qf(nf,o),h=Ie(l,d.onViewportChange),g=y.useRef(0);return f.jsxs(f.Fragment,{children:[f.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),f.jsx(ac.Slot,{scope:o,children:f.jsx(Le.div,{"data-radix-select-viewport":"",role:"presentation",...u,ref:h,style:{position:"relative",flex:1,overflow:"hidden auto",...u.style},onScroll:Me(u.onScroll,p=>{const x=p.currentTarget,{contentWrapper:v,shouldExpandOnScrollRef:w}=m;if(w!=null&&w.current&&v){const E=Math.abs(g.current-x.scrollTop);if(E>0){const C=window.innerHeight-xn*2,N=parseFloat(v.style.minHeight),T=parseFloat(v.style.height),R=Math.max(N,T);if(R<C){const j=R+E,O=Math.min(C,j),z=j-O;v.style.height=O+"px",v.style.bottom==="0px"&&(x.scrollTop=z>0?z:0,v.style.justifyContent="flex-end")}}}g.current=x.scrollTop})})})]})});gb.displayName=nf;var vb="SelectGroup",[dA,fA]=Ur(vb),mA=y.forwardRef((n,l)=>{const{__scopeSelect:o,...i}=n,u=Xa();return f.jsx(dA,{scope:o,id:u,children:f.jsx(Le.div,{role:"group","aria-labelledby":u,...i,ref:l})})});mA.displayName=vb;var yb="SelectLabel",bb=y.forwardRef((n,l)=>{const{__scopeSelect:o,...i}=n,u=fA(yb,o);return f.jsx(Le.div,{id:u.id,...i,ref:l})});bb.displayName=yb;var Us="SelectItem",[hA,xb]=Ur(Us),Sb=y.forwardRef((n,l)=>{const{__scopeSelect:o,value:i,disabled:u=!1,textValue:d,...m}=n,h=Ja(Us,o),g=Wa(Us,o),p=h.value===i,[x,v]=y.useState(d??""),[w,E]=y.useState(!1),C=Ie(l,j=>{var O;return(O=g.itemRefCallback)==null?void 0:O.call(g,j,i,u)}),N=Xa(),T=y.useRef("touch"),R=()=>{u||(h.onValueChange(i),h.onOpenChange(!1))};if(i==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return f.jsx(hA,{scope:o,value:i,disabled:u,textId:N,isSelected:p,onItemTextChange:y.useCallback(j=>{v(O=>O||((j==null?void 0:j.textContent)??"").trim())},[]),children:f.jsx(ac.ItemSlot,{scope:o,value:i,disabled:u,textValue:x,children:f.jsx(Le.div,{role:"option","aria-labelledby":N,"data-highlighted":w?"":void 0,"aria-selected":p&&w,"data-state":p?"checked":"unchecked","aria-disabled":u||void 0,"data-disabled":u?"":void 0,tabIndex:u?void 0:-1,...m,ref:C,onFocus:Me(m.onFocus,()=>E(!0)),onBlur:Me(m.onBlur,()=>E(!1)),onClick:Me(m.onClick,()=>{T.current!=="mouse"&&R()}),onPointerUp:Me(m.onPointerUp,()=>{T.current==="mouse"&&R()}),onPointerDown:Me(m.onPointerDown,j=>{T.current=j.pointerType}),onPointerMove:Me(m.onPointerMove,j=>{var O;T.current=j.pointerType,u?(O=g.onItemLeave)==null||O.call(g):T.current==="mouse"&&j.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Me(m.onPointerLeave,j=>{var O;j.currentTarget===document.activeElement&&((O=g.onItemLeave)==null||O.call(g))}),onKeyDown:Me(m.onKeyDown,j=>{var z;((z=g.searchRef)==null?void 0:z.current)!==""&&j.key===" "||(WR.includes(j.key)&&R(),j.key===" "&&j.preventDefault())})})})})});Sb.displayName=Us;var Vo="SelectItemText",wb=y.forwardRef((n,l)=>{const{__scopeSelect:o,className:i,style:u,...d}=n,m=Ja(Vo,o),h=Wa(Vo,o),g=xb(Vo,o),p=aA(Vo,o),[x,v]=y.useState(null),w=Ie(l,R=>v(R),g.onItemTextChange,R=>{var j;return(j=h.itemTextRefCallback)==null?void 0:j.call(h,R,g.value,g.disabled)}),E=x==null?void 0:x.textContent,C=y.useMemo(()=>f.jsx("option",{value:g.value,disabled:g.disabled,children:E},g.value),[g.disabled,g.value,E]),{onNativeOptionAdd:N,onNativeOptionRemove:T}=p;return _t(()=>(N(C),()=>T(C)),[N,T,C]),f.jsxs(f.Fragment,{children:[f.jsx(Le.span,{id:g.textId,...d,ref:w}),g.isSelected&&m.valueNode&&!m.valueNodeHasChildren?Qo.createPortal(d.children,m.valueNode):null]})});wb.displayName=Vo;var Eb="SelectItemIndicator",Nb=y.forwardRef((n,l)=>{const{__scopeSelect:o,...i}=n;return xb(Eb,o).isSelected?f.jsx(Le.span,{"aria-hidden":!0,...i,ref:l}):null});Nb.displayName=Eb;var af="SelectScrollUpButton",Cb=y.forwardRef((n,l)=>{const o=Wa(af,n.__scopeSelect),i=qf(af,n.__scopeSelect),[u,d]=y.useState(!1),m=Ie(l,i.onScrollButtonChange);return _t(()=>{if(o.viewport&&o.isPositioned){let h=function(){const p=g.scrollTop>0;d(p)};const g=o.viewport;return h(),g.addEventListener("scroll",h),()=>g.removeEventListener("scroll",h)}},[o.viewport,o.isPositioned]),u?f.jsx(Rb,{...n,ref:m,onAutoScroll:()=>{const{viewport:h,selectedItem:g}=o;h&&g&&(h.scrollTop=h.scrollTop-g.offsetHeight)}}):null});Cb.displayName=af;var lf="SelectScrollDownButton",Tb=y.forwardRef((n,l)=>{const o=Wa(lf,n.__scopeSelect),i=qf(lf,n.__scopeSelect),[u,d]=y.useState(!1),m=Ie(l,i.onScrollButtonChange);return _t(()=>{if(o.viewport&&o.isPositioned){let h=function(){const p=g.scrollHeight-g.clientHeight,x=Math.ceil(g.scrollTop)<p;d(x)};const g=o.viewport;return h(),g.addEventListener("scroll",h),()=>g.removeEventListener("scroll",h)}},[o.viewport,o.isPositioned]),u?f.jsx(Rb,{...n,ref:m,onAutoScroll:()=>{const{viewport:h,selectedItem:g}=o;h&&g&&(h.scrollTop=h.scrollTop+g.offsetHeight)}}):null});Tb.displayName=lf;var Rb=y.forwardRef((n,l)=>{const{__scopeSelect:o,onAutoScroll:i,...u}=n,d=Wa("SelectScrollButton",o),m=y.useRef(null),h=lc(o),g=y.useCallback(()=>{m.current!==null&&(window.clearInterval(m.current),m.current=null)},[]);return y.useEffect(()=>()=>g(),[g]),_t(()=>{var x;const p=h().find(v=>v.ref.current===document.activeElement);(x=p==null?void 0:p.ref.current)==null||x.scrollIntoView({block:"nearest"})},[h]),f.jsx(Le.div,{"aria-hidden":!0,...u,ref:l,style:{flexShrink:0,...u.style},onPointerDown:Me(u.onPointerDown,()=>{m.current===null&&(m.current=window.setInterval(i,50))}),onPointerMove:Me(u.onPointerMove,()=>{var p;(p=d.onItemLeave)==null||p.call(d),m.current===null&&(m.current=window.setInterval(i,50))}),onPointerLeave:Me(u.onPointerLeave,()=>{g()})})}),pA="SelectSeparator",Ab=y.forwardRef((n,l)=>{const{__scopeSelect:o,...i}=n;return f.jsx(Le.div,{"aria-hidden":!0,...i,ref:l})});Ab.displayName=pA;var rf="SelectArrow",gA=y.forwardRef((n,l)=>{const{__scopeSelect:o,...i}=n,u=rc(o),d=Ja(rf,o),m=Wa(rf,o);return d.open&&m.position==="popper"?f.jsx(ZR,{...u,...i,ref:l}):null});gA.displayName=rf;var vA="SelectBubbleInput",_b=y.forwardRef(({__scopeSelect:n,value:l,...o},i)=>{const u=y.useRef(null),d=Ie(i,u),m=ab(l);return y.useEffect(()=>{const h=u.current;if(!h)return;const g=window.HTMLSelectElement.prototype,x=Object.getOwnPropertyDescriptor(g,"value").set;if(m!==l&&x){const v=new Event("change",{bubbles:!0});x.call(h,l),h.dispatchEvent(v)}},[m,l]),f.jsx(Le.select,{...o,style:{...lb,...o.style},ref:d,defaultValue:l})});_b.displayName=vA;function jb(n){return n===""||n===void 0}function Mb(n){const l=Qa(n),o=y.useRef(""),i=y.useRef(0),u=y.useCallback(m=>{const h=o.current+m;l(h),(function g(p){o.current=p,window.clearTimeout(i.current),p!==""&&(i.current=window.setTimeout(()=>g(""),1e3))})(h)},[l]),d=y.useCallback(()=>{o.current="",window.clearTimeout(i.current)},[]);return y.useEffect(()=>()=>window.clearTimeout(i.current),[]),[o,u,d]}function Ob(n,l,o){const u=l.length>1&&Array.from(l).every(p=>p===l[0])?l[0]:l,d=o?n.indexOf(o):-1;let m=yA(n,Math.max(d,0));u.length===1&&(m=m.filter(p=>p!==o));const g=m.find(p=>p.textValue.toLowerCase().startsWith(u.toLowerCase()));return g!==o?g:void 0}function yA(n,l){return n.map((o,i)=>n[(l+i)%n.length])}var bA=rb,Db=ib,xA=cb,SA=ub,wA=db,kb=fb,EA=gb,zb=bb,Lb=Sb,NA=wb,CA=Nb,Ub=Cb,Bb=Tb,Hb=Ab;const Vb=bA,$b=xA,Gf=y.forwardRef(({className:n,children:l,...o},i)=>f.jsxs(Db,{ref:i,className:se("flex h-10 w-full items-center justify-between rounded-sm border border-input/85 bg-background/72 px-3 py-2 text-sm shadow-sm ring-offset-background transition-all duration-200 placeholder:text-muted-foreground focus:border-primary/45 focus:bg-background/90 focus:outline-none focus:ring-2 focus:ring-ring/45 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",n),...o,children:[l,f.jsx(SA,{asChild:!0,children:f.jsx(Zs,{className:"h-4 w-4 opacity-50"})})]}));Gf.displayName=Db.displayName;const Yb=y.forwardRef(({className:n,...l},o)=>f.jsx(Ub,{ref:o,className:se("flex cursor-default items-center justify-center py-1",n),...l,children:f.jsx(zE,{className:"h-4 w-4"})}));Yb.displayName=Ub.displayName;const qb=y.forwardRef(({className:n,...l},o)=>f.jsx(Bb,{ref:o,className:se("flex cursor-default items-center justify-center py-1",n),...l,children:f.jsx(Zs,{className:"h-4 w-4"})}));qb.displayName=Bb.displayName;const Xf=y.forwardRef(({className:n,children:l,position:o="popper",...i},u)=>f.jsx(wA,{children:f.jsxs(kb,{ref:u,className:se("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-lg border border-border/70 bg-popover/96 text-popover-foreground shadow-[0_20px_70px_-36px_rgba(0,0,0,0.45)] backdrop-blur-xl 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",o==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",n),position:o,...i,children:[f.jsx(Yb,{}),f.jsx(EA,{className:se("p-1",o==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:l}),f.jsx(qb,{})]})}));Xf.displayName=kb.displayName;const TA=y.forwardRef(({className:n,...l},o)=>f.jsx(zb,{ref:o,className:se("py-1.5 pl-8 pr-2 text-sm font-semibold",n),...l}));TA.displayName=zb.displayName;const Nr=y.forwardRef(({className:n,children:l,...o},i)=>f.jsxs(Lb,{ref:i,className:se("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent/80 focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n),...o,children:[f.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(CA,{children:f.jsx(_s,{className:"h-4 w-4"})})}),f.jsx(NA,{children:l})]}));Nr.displayName=Lb.displayName;const RA=y.forwardRef(({className:n,...l},o)=>f.jsx(Hb,{ref:o,className:se("-mx-1 my-1 h-px bg-muted",n),...l}));RA.displayName=Hb.displayName;var $d="rovingFocusGroup.onEntryFocus",AA={bubbles:!1,cancelable:!0},Zo="RovingFocusGroup",[of,Gb,_A]=Dy(Zo),[jA,Xb]=Fa(Zo,[_A]),[MA,OA]=jA(Zo),Pb=y.forwardRef((n,l)=>f.jsx(of.Provider,{scope:n.__scopeRovingFocusGroup,children:f.jsx(of.Slot,{scope:n.__scopeRovingFocusGroup,children:f.jsx(DA,{...n,ref:l})})}));Pb.displayName=Zo;var DA=y.forwardRef((n,l)=>{const{__scopeRovingFocusGroup:o,orientation:i,loop:u=!1,dir:d,currentTabStopId:m,defaultCurrentTabStopId:h,onCurrentTabStopIdChange:g,onEntryFocus:p,preventScrollOnEntryFocus:x=!1,...v}=n,w=y.useRef(null),E=Ie(l,w),C=kf(d),[N,T]=Ar({prop:m,defaultProp:h??null,onChange:g,caller:Zo}),[R,j]=y.useState(!1),O=Qa(p),z=Gb(o),X=y.useRef(!1),[K,V]=y.useState(0);return y.useEffect(()=>{const H=w.current;if(H)return H.addEventListener($d,O),()=>H.removeEventListener($d,O)},[O]),f.jsx(MA,{scope:o,orientation:i,dir:C,loop:u,currentTabStopId:N,onItemFocus:y.useCallback(H=>T(H),[T]),onItemShiftTab:y.useCallback(()=>j(!0),[]),onFocusableItemAdd:y.useCallback(()=>V(H=>H+1),[]),onFocusableItemRemove:y.useCallback(()=>V(H=>H-1),[]),children:f.jsx(Le.div,{tabIndex:R||K===0?-1:0,"data-orientation":i,...v,ref:E,style:{outline:"none",...n.style},onMouseDown:Me(n.onMouseDown,()=>{X.current=!0}),onFocus:Me(n.onFocus,H=>{const le=!X.current;if(H.target===H.currentTarget&&le&&!R){const ie=new CustomEvent($d,AA);if(H.currentTarget.dispatchEvent(ie),!ie.defaultPrevented){const me=z().filter(M=>M.focusable),fe=me.find(M=>M.active),ce=me.find(M=>M.id===N),re=[fe,ce,...me].filter(Boolean).map(M=>M.ref.current);Zb(re,x)}}X.current=!1}),onBlur:Me(n.onBlur,()=>j(!1))})})}),Qb="RovingFocusGroupItem",Kb=y.forwardRef((n,l)=>{const{__scopeRovingFocusGroup:o,focusable:i=!0,active:u=!1,tabStopId:d,children:m,...h}=n,g=Xa(),p=d||g,x=OA(Qb,o),v=x.currentTabStopId===p,w=Gb(o),{onFocusableItemAdd:E,onFocusableItemRemove:C,currentTabStopId:N}=x;return y.useEffect(()=>{if(i)return E(),()=>C()},[i,E,C]),f.jsx(of.ItemSlot,{scope:o,id:p,focusable:i,active:u,children:f.jsx(Le.span,{tabIndex:v?0:-1,"data-orientation":x.orientation,...h,ref:l,onMouseDown:Me(n.onMouseDown,T=>{i?x.onItemFocus(p):T.preventDefault()}),onFocus:Me(n.onFocus,()=>x.onItemFocus(p)),onKeyDown:Me(n.onKeyDown,T=>{if(T.key==="Tab"&&T.shiftKey){x.onItemShiftTab();return}if(T.target!==T.currentTarget)return;const R=LA(T,x.orientation,x.dir);if(R!==void 0){if(T.metaKey||T.ctrlKey||T.altKey||T.shiftKey)return;T.preventDefault();let O=w().filter(z=>z.focusable).map(z=>z.ref.current);if(R==="last")O.reverse();else if(R==="prev"||R==="next"){R==="prev"&&O.reverse();const z=O.indexOf(T.currentTarget);O=x.loop?UA(O,z+1):O.slice(z+1)}setTimeout(()=>Zb(O))}}),children:typeof m=="function"?m({isCurrentTabStop:v,hasTabStop:N!=null}):m})})});Kb.displayName=Qb;var kA={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function zA(n,l){return l!=="rtl"?n:n==="ArrowLeft"?"ArrowRight":n==="ArrowRight"?"ArrowLeft":n}function LA(n,l,o){const i=zA(n.key,o);if(!(l==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(l==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return kA[i]}function Zb(n,l=!1){const o=document.activeElement;for(const i of n)if(i===o||(i.focus({preventScroll:l}),document.activeElement!==o))return}function UA(n,l){return n.map((o,i)=>n[(l+i)%n.length])}var BA=Pb,HA=Kb,oc="Tabs",[VA]=Fa(oc,[Xb]),Ib=Xb(),[$A,Pf]=VA(oc),Fb=y.forwardRef((n,l)=>{const{__scopeTabs:o,value:i,onValueChange:u,defaultValue:d,orientation:m="horizontal",dir:h,activationMode:g="automatic",...p}=n,x=kf(h),[v,w]=Ar({prop:i,onChange:u,defaultProp:d??"",caller:oc});return f.jsx($A,{scope:o,baseId:Xa(),value:v,onValueChange:w,orientation:m,dir:x,activationMode:g,children:f.jsx(Le.div,{dir:x,"data-orientation":m,...p,ref:l})})});Fb.displayName=oc;var Jb="TabsList",Wb=y.forwardRef((n,l)=>{const{__scopeTabs:o,loop:i=!0,...u}=n,d=Pf(Jb,o),m=Ib(o);return f.jsx(BA,{asChild:!0,...m,orientation:d.orientation,dir:d.dir,loop:i,children:f.jsx(Le.div,{role:"tablist","aria-orientation":d.orientation,...u,ref:l})})});Wb.displayName=Jb;var ex="TabsTrigger",tx=y.forwardRef((n,l)=>{const{__scopeTabs:o,value:i,disabled:u=!1,...d}=n,m=Pf(ex,o),h=Ib(o),g=lx(m.baseId,i),p=rx(m.baseId,i),x=i===m.value;return f.jsx(HA,{asChild:!0,...h,focusable:!u,active:x,children:f.jsx(Le.button,{type:"button",role:"tab","aria-selected":x,"aria-controls":p,"data-state":x?"active":"inactive","data-disabled":u?"":void 0,disabled:u,id:g,...d,ref:l,onMouseDown:Me(n.onMouseDown,v=>{!u&&v.button===0&&v.ctrlKey===!1?m.onValueChange(i):v.preventDefault()}),onKeyDown:Me(n.onKeyDown,v=>{[" ","Enter"].includes(v.key)&&m.onValueChange(i)}),onFocus:Me(n.onFocus,()=>{const v=m.activationMode!=="manual";!x&&!u&&v&&m.onValueChange(i)})})})});tx.displayName=ex;var nx="TabsContent",ax=y.forwardRef((n,l)=>{const{__scopeTabs:o,value:i,forceMount:u,children:d,...m}=n,h=Pf(nx,o),g=lx(h.baseId,i),p=rx(h.baseId,i),x=i===h.value,v=y.useRef(x);return y.useEffect(()=>{const w=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(w)},[]),f.jsx(kr,{present:u||x,children:({present:w})=>f.jsx(Le.div,{"data-state":x?"active":"inactive","data-orientation":h.orientation,role:"tabpanel","aria-labelledby":g,hidden:!w,id:p,tabIndex:0,...m,ref:l,style:{...n.style,animationDuration:v.current?"0s":void 0},children:w&&d})})});ax.displayName=nx;function lx(n,l){return`${n}-trigger-${l}`}function rx(n,l){return`${n}-content-${l}`}var YA=Fb,ox=Wb,ix=tx,sx=ax;const qA=YA,cx=y.forwardRef(({className:n,...l},o)=>f.jsx(ox,{ref:o,className:se("inline-flex h-10 items-center justify-center rounded-lg bg-muted/72 p-1 text-muted-foreground shadow-inner shadow-background/40",n),...l}));cx.displayName=ox.displayName;const Ts=y.forwardRef(({className:n,...l},o)=>f.jsx(ix,{ref:o,className:se("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-semibold ring-offset-background transition-all duration-200 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-primary/12 data-[state=active]:text-primary data-[state=active]:shadow-[0_10px_28px_-18px_hsl(var(--primary)/0.85)] data-[state=active]:ring-1 data-[state=active]:ring-primary/22",n),...l}));Ts.displayName=ix.displayName;const Bs=y.forwardRef(({className:n,...l},o)=>f.jsx(sx,{ref:o,className:se("mt-2 ring-offset-background data-[state=inactive]:hidden focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",n),...l}));Bs.displayName=sx.displayName;var ux="AlertDialog",[GA]=Fa(ux,[cy]),ha=cy(),dx=n=>{const{__scopeAlertDialog:l,...o}=n,i=ha(l);return f.jsx(Cy,{...i,...o,modal:!0})};dx.displayName=ux;var XA="AlertDialogTrigger",fx=y.forwardRef((n,l)=>{const{__scopeAlertDialog:o,...i}=n,u=ha(o);return f.jsx(Ty,{...u,...i,ref:l})});fx.displayName=XA;var PA="AlertDialogPortal",mx=n=>{const{__scopeAlertDialog:l,...o}=n,i=ha(l);return f.jsx(Ry,{...i,...o})};mx.displayName=PA;var QA="AlertDialogOverlay",hx=y.forwardRef((n,l)=>{const{__scopeAlertDialog:o,...i}=n,u=ha(o);return f.jsx(jf,{...u,...i,ref:l})});hx.displayName=QA;var Rr="AlertDialogContent",[KA,ZA]=GA(Rr),IA=sT("AlertDialogContent"),px=y.forwardRef((n,l)=>{const{__scopeAlertDialog:o,children:i,...u}=n,d=ha(o),m=y.useRef(null),h=Ie(l,m),g=y.useRef(null);return f.jsx(N5,{contentName:Rr,titleName:gx,docsSlug:"alert-dialog",children:f.jsx(KA,{scope:o,cancelRef:g,children:f.jsxs(Mf,{role:"alertdialog",...d,...u,ref:h,onOpenAutoFocus:Me(u.onOpenAutoFocus,p=>{var x;p.preventDefault(),(x=g.current)==null||x.focus({preventScroll:!0})}),onPointerDownOutside:p=>p.preventDefault(),onInteractOutside:p=>p.preventDefault(),children:[f.jsx(IA,{children:i}),f.jsx(JA,{contentRef:m})]})})})});px.displayName=Rr;var gx="AlertDialogTitle",vx=y.forwardRef((n,l)=>{const{__scopeAlertDialog:o,...i}=n,u=ha(o);return f.jsx(Of,{...u,...i,ref:l})});vx.displayName=gx;var yx="AlertDialogDescription",bx=y.forwardRef((n,l)=>{const{__scopeAlertDialog:o,...i}=n,u=ha(o);return f.jsx(Df,{...u,...i,ref:l})});bx.displayName=yx;var FA="AlertDialogAction",xx=y.forwardRef((n,l)=>{const{__scopeAlertDialog:o,...i}=n,u=ha(o);return f.jsx(Js,{...u,...i,ref:l})});xx.displayName=FA;var Sx="AlertDialogCancel",wx=y.forwardRef((n,l)=>{const{__scopeAlertDialog:o,...i}=n,{cancelRef:u}=ZA(Sx,o),d=ha(o),m=Ie(l,u);return f.jsx(Js,{...d,...i,ref:m})});wx.displayName=Sx;var JA=({contentRef:n})=>{const l=`\`${Rr}\` requires a description for the component to be accessible for screen reader users.
315
+ For more information, see https://radix-ui.com/primitives/docs/components/${l.docsSlug}`;return y.useEffect(()=>{n&&(document.getElementById(n)||console.error(o))},[o,n]),null},T5="DialogDescriptionWarning",R5=({contentRef:n,descriptionId:l})=>{const i=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Ny(T5).contentName}}.`;return y.useEffect(()=>{var d;const u=(d=n.current)==null?void 0:d.getAttribute("aria-describedby");l&&u&&(document.getElementById(l)||console.warn(i))},[i,n,l]),null},Cy=uy,Ty=fy,Ry=hy,jf=py,Mf=gy,Of=yy,Df=xy,Js=wy;const A5=Cy,_5=Ty,j5=Ry,Mj=Js,Ay=y.forwardRef(({className:n,...l},o)=>f.jsx(jf,{ref:o,className:se("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}));Ay.displayName=jf.displayName;const _y=y.forwardRef(({className:n,children:l,...o},i)=>f.jsxs(j5,{children:[f.jsx(Ay,{}),f.jsxs(Mf,{ref:i,className:se("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),...o,children:[l,f.jsxs(Js,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[f.jsx(_0,{className:"h-4 w-4"}),f.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));_y.displayName=Mf.displayName;const jy=({className:n,...l})=>f.jsx("div",{className:se("flex flex-col space-y-1.5 text-center sm:text-left",n),...l});jy.displayName="DialogHeader";const M5=({className:n,...l})=>f.jsx("div",{className:se("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...l});M5.displayName="DialogFooter";const My=y.forwardRef(({className:n,...l},o)=>f.jsx(Of,{ref:o,className:se("text-lg font-semibold leading-none tracking-tight",n),...l}));My.displayName=Of.displayName;const Oy=y.forwardRef(({className:n,...l},o)=>f.jsx(Df,{ref:o,className:se("text-sm text-muted-foreground",n),...l}));Oy.displayName=Df.displayName;function O5({children:n,open:l,onOpenChange:o,showTrigger:i=!0}){const[u,d]=y.useState(!1),m=l??u,h=y.useCallback(g=>{l===void 0&&d(g),o==null||o(g)},[l,o]);return f.jsxs(A5,{open:m,onOpenChange:h,children:[i&&f.jsx(_5,{asChild:!0,children:f.jsx(Sn,{variant:"ghost",size:"icon","aria-label":"Settings",title:"Settings",className:"h-8 w-8 rounded-sm text-muted-foreground hover:bg-muted/50 hover:text-foreground",children:f.jsx(vN,{className:"h-4 w-4"})})}),f.jsxs(_y,{className:"settings-dialog-content grid h-[min(78vh,38rem)] max-h-[78vh] max-w-[min(86vw,50rem)] grid-rows-[auto_minmax(0,1fr)] gap-0 overflow-hidden rounded-xl border-border/70 bg-background/96 p-0 shadow-[0_40px_120px_-56px_rgba(15,23,42,0.75)] backdrop-blur-xl",children:[f.jsxs(jy,{className:"shrink-0 border-b border-border/60 px-3 py-1.5 sm:px-3.5",children:[f.jsxs(My,{className:"flex items-center gap-1.5 text-[11px]",children:[f.jsx(eN,{className:"h-3.5 w-3.5 text-primary"}),"Settings"]}),f.jsx(Oy,{className:"text-[10px]",children:"Session diagnostics, access configuration, and build metadata for the current Meshy node."})]}),f.jsx("div",{className:"min-h-0 overflow-y-auto px-2.5 pb-2 pt-0 sm:px-3 sm:pb-2.5",children:n})]})]})}function Dv(n,[l,o]){return Math.min(o,Math.max(l,n))}function Dy(n){const l=n+"CollectionProvider",[o,i]=Fa(l),[u,d]=o(l,{collectionRef:{current:null},itemMap:new Map}),m=N=>{const{scope:T,children:R}=N,j=ae.useRef(null),O=ae.useRef(new Map).current;return f.jsx(u,{scope:T,itemMap:O,collectionRef:j,children:R})};m.displayName=l;const h=n+"CollectionSlot",g=qo(h),p=ae.forwardRef((N,T)=>{const{scope:R,children:j}=N,O=d(h,R),z=Ie(T,O.collectionRef);return f.jsx(g,{ref:z,children:j})});p.displayName=h;const x=n+"CollectionItemSlot",v="data-radix-collection-item",w=qo(x),E=ae.forwardRef((N,T)=>{const{scope:R,children:j,...O}=N,z=ae.useRef(null),X=Ie(T,z),K=d(x,R);return ae.useEffect(()=>(K.itemMap.set(z,{ref:z,...O}),()=>void K.itemMap.delete(z))),f.jsx(w,{[v]:"",ref:X,children:j})});E.displayName=x;function C(N){const T=d(n+"CollectionConsumer",N);return ae.useCallback(()=>{const j=T.collectionRef.current;if(!j)return[];const O=Array.from(j.querySelectorAll(`[${v}]`));return Array.from(T.itemMap.values()).sort((K,V)=>O.indexOf(K.ref.current)-O.indexOf(V.ref.current))},[T.collectionRef,T.itemMap])}return[{Provider:m,Slot:p,ItemSlot:E},C,i]}var D5=y.createContext(void 0);function kf(n){const l=y.useContext(D5);return n||l||"ltr"}const k5=["top","right","bottom","left"],Ka=Math.min,en=Math.max,Ds=Math.round,xs=Math.floor,$n=n=>({x:n,y:n}),z5={left:"right",right:"left",bottom:"top",top:"bottom"};function Jd(n,l,o){return en(n,Ka(l,o))}function da(n,l){return typeof n=="function"?n(l):n}function fa(n){return n.split("-")[0]}function zr(n){return n.split("-")[1]}function zf(n){return n==="x"?"y":"x"}function Lf(n){return n==="y"?"height":"width"}function Hn(n){const l=n[0];return l==="t"||l==="b"?"y":"x"}function Uf(n){return zf(Hn(n))}function L5(n,l,o){o===void 0&&(o=!1);const i=zr(n),u=Uf(n),d=Lf(u);let m=u==="x"?i===(o?"end":"start")?"right":"left":i==="start"?"bottom":"top";return l.reference[d]>l.floating[d]&&(m=ks(m)),[m,ks(m)]}function U5(n){const l=ks(n);return[Wd(n),l,Wd(l)]}function Wd(n){return n.includes("start")?n.replace("start","end"):n.replace("end","start")}const kv=["left","right"],zv=["right","left"],B5=["top","bottom"],H5=["bottom","top"];function V5(n,l,o){switch(n){case"top":case"bottom":return o?l?zv:kv:l?kv:zv;case"left":case"right":return l?B5:H5;default:return[]}}function $5(n,l,o,i){const u=zr(n);let d=V5(fa(n),o==="start",i);return u&&(d=d.map(m=>m+"-"+u),l&&(d=d.concat(d.map(Wd)))),d}function ks(n){const l=fa(n);return z5[l]+n.slice(l.length)}function Y5(n){return{top:0,right:0,bottom:0,left:0,...n}}function ky(n){return typeof n!="number"?Y5(n):{top:n,right:n,bottom:n,left:n}}function zs(n){const{x:l,y:o,width:i,height:u}=n;return{width:i,height:u,top:o,left:l,right:l+i,bottom:o+u,x:l,y:o}}function Lv(n,l,o){let{reference:i,floating:u}=n;const d=Hn(l),m=Uf(l),h=Lf(m),g=fa(l),p=d==="y",x=i.x+i.width/2-u.width/2,v=i.y+i.height/2-u.height/2,w=i[h]/2-u[h]/2;let E;switch(g){case"top":E={x,y:i.y-u.height};break;case"bottom":E={x,y:i.y+i.height};break;case"right":E={x:i.x+i.width,y:v};break;case"left":E={x:i.x-u.width,y:v};break;default:E={x:i.x,y:i.y}}switch(zr(l)){case"start":E[m]-=w*(o&&p?-1:1);break;case"end":E[m]+=w*(o&&p?-1:1);break}return E}async function q5(n,l){var o;l===void 0&&(l={});const{x:i,y:u,platform:d,rects:m,elements:h,strategy:g}=n,{boundary:p="clippingAncestors",rootBoundary:x="viewport",elementContext:v="floating",altBoundary:w=!1,padding:E=0}=da(l,n),C=ky(E),T=h[w?v==="floating"?"reference":"floating":v],R=zs(await d.getClippingRect({element:(o=await(d.isElement==null?void 0:d.isElement(T)))==null||o?T:T.contextElement||await(d.getDocumentElement==null?void 0:d.getDocumentElement(h.floating)),boundary:p,rootBoundary:x,strategy:g})),j=v==="floating"?{x:i,y:u,width:m.floating.width,height:m.floating.height}:m.reference,O=await(d.getOffsetParent==null?void 0:d.getOffsetParent(h.floating)),z=await(d.isElement==null?void 0:d.isElement(O))?await(d.getScale==null?void 0:d.getScale(O))||{x:1,y:1}:{x:1,y:1},X=zs(d.convertOffsetParentRelativeRectToViewportRelativeRect?await d.convertOffsetParentRelativeRectToViewportRelativeRect({elements:h,rect:j,offsetParent:O,strategy:g}):j);return{top:(R.top-X.top+C.top)/z.y,bottom:(X.bottom-R.bottom+C.bottom)/z.y,left:(R.left-X.left+C.left)/z.x,right:(X.right-R.right+C.right)/z.x}}const G5=50,X5=async(n,l,o)=>{const{placement:i="bottom",strategy:u="absolute",middleware:d=[],platform:m}=o,h=m.detectOverflow?m:{...m,detectOverflow:q5},g=await(m.isRTL==null?void 0:m.isRTL(l));let p=await m.getElementRects({reference:n,floating:l,strategy:u}),{x,y:v}=Lv(p,i,g),w=i,E=0;const C={};for(let N=0;N<d.length;N++){const T=d[N];if(!T)continue;const{name:R,fn:j}=T,{x:O,y:z,data:X,reset:K}=await j({x,y:v,initialPlacement:i,placement:w,strategy:u,middlewareData:C,rects:p,platform:h,elements:{reference:n,floating:l}});x=O??x,v=z??v,C[R]={...C[R],...X},K&&E<G5&&(E++,typeof K=="object"&&(K.placement&&(w=K.placement),K.rects&&(p=K.rects===!0?await m.getElementRects({reference:n,floating:l,strategy:u}):K.rects),{x,y:v}=Lv(p,w,g)),N=-1)}return{x,y:v,placement:w,strategy:u,middlewareData:C}},P5=n=>({name:"arrow",options:n,async fn(l){const{x:o,y:i,placement:u,rects:d,platform:m,elements:h,middlewareData:g}=l,{element:p,padding:x=0}=da(n,l)||{};if(p==null)return{};const v=ky(x),w={x:o,y:i},E=Uf(u),C=Lf(E),N=await m.getDimensions(p),T=E==="y",R=T?"top":"left",j=T?"bottom":"right",O=T?"clientHeight":"clientWidth",z=d.reference[C]+d.reference[E]-w[E]-d.floating[C],X=w[E]-d.reference[E],K=await(m.getOffsetParent==null?void 0:m.getOffsetParent(p));let V=K?K[O]:0;(!V||!await(m.isElement==null?void 0:m.isElement(K)))&&(V=h.floating[O]||d.floating[C]);const H=z/2-X/2,le=V/2-N[C]/2-1,ie=Ka(v[R],le),me=Ka(v[j],le),fe=ie,ce=V-N[C]-me,de=V/2-N[C]/2+H,re=Jd(fe,de,ce),M=!g.arrow&&zr(u)!=null&&de!==re&&d.reference[C]/2-(de<fe?ie:me)-N[C]/2<0,$=M?de<fe?de-fe:de-ce:0;return{[E]:w[E]+$,data:{[E]:re,centerOffset:de-re-$,...M&&{alignmentOffset:$}},reset:M}}}),Q5=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(l){var o,i;const{placement:u,middlewareData:d,rects:m,initialPlacement:h,platform:g,elements:p}=l,{mainAxis:x=!0,crossAxis:v=!0,fallbackPlacements:w,fallbackStrategy:E="bestFit",fallbackAxisSideDirection:C="none",flipAlignment:N=!0,...T}=da(n,l);if((o=d.arrow)!=null&&o.alignmentOffset)return{};const R=fa(u),j=Hn(h),O=fa(h)===h,z=await(g.isRTL==null?void 0:g.isRTL(p.floating)),X=w||(O||!N?[ks(h)]:U5(h)),K=C!=="none";!w&&K&&X.push(...$5(h,N,C,z));const V=[h,...X],H=await g.detectOverflow(l,T),le=[];let ie=((i=d.flip)==null?void 0:i.overflows)||[];if(x&&le.push(H[R]),v){const de=L5(u,m,z);le.push(H[de[0]],H[de[1]])}if(ie=[...ie,{placement:u,overflows:le}],!le.every(de=>de<=0)){var me,fe;const de=(((me=d.flip)==null?void 0:me.index)||0)+1,re=V[de];if(re&&(!(v==="alignment"?j!==Hn(re):!1)||ie.every(F=>Hn(F.placement)===j?F.overflows[0]>0:!0)))return{data:{index:de,overflows:ie},reset:{placement:re}};let M=(fe=ie.filter($=>$.overflows[0]<=0).sort(($,F)=>$.overflows[1]-F.overflows[1])[0])==null?void 0:fe.placement;if(!M)switch(E){case"bestFit":{var ce;const $=(ce=ie.filter(F=>{if(K){const J=Hn(F.placement);return J===j||J==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(J=>J>0).reduce((J,G)=>J+G,0)]).sort((F,J)=>F[1]-J[1])[0])==null?void 0:ce[0];$&&(M=$);break}case"initialPlacement":M=h;break}if(u!==M)return{reset:{placement:M}}}return{}}}};function Uv(n,l){return{top:n.top-l.height,right:n.right-l.width,bottom:n.bottom-l.height,left:n.left-l.width}}function Bv(n){return k5.some(l=>n[l]>=0)}const K5=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(l){const{rects:o,platform:i}=l,{strategy:u="referenceHidden",...d}=da(n,l);switch(u){case"referenceHidden":{const m=await i.detectOverflow(l,{...d,elementContext:"reference"}),h=Uv(m,o.reference);return{data:{referenceHiddenOffsets:h,referenceHidden:Bv(h)}}}case"escaped":{const m=await i.detectOverflow(l,{...d,altBoundary:!0}),h=Uv(m,o.floating);return{data:{escapedOffsets:h,escaped:Bv(h)}}}default:return{}}}}},zy=new Set(["left","top"]);async function Z5(n,l){const{placement:o,platform:i,elements:u}=n,d=await(i.isRTL==null?void 0:i.isRTL(u.floating)),m=fa(o),h=zr(o),g=Hn(o)==="y",p=zy.has(m)?-1:1,x=d&&g?-1:1,v=da(l,n);let{mainAxis:w,crossAxis:E,alignmentAxis:C}=typeof v=="number"?{mainAxis:v,crossAxis:0,alignmentAxis:null}:{mainAxis:v.mainAxis||0,crossAxis:v.crossAxis||0,alignmentAxis:v.alignmentAxis};return h&&typeof C=="number"&&(E=h==="end"?C*-1:C),g?{x:E*x,y:w*p}:{x:w*p,y:E*x}}const I5=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(l){var o,i;const{x:u,y:d,placement:m,middlewareData:h}=l,g=await Z5(l,n);return m===((o=h.offset)==null?void 0:o.placement)&&(i=h.arrow)!=null&&i.alignmentOffset?{}:{x:u+g.x,y:d+g.y,data:{...g,placement:m}}}}},F5=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(l){const{x:o,y:i,placement:u,platform:d}=l,{mainAxis:m=!0,crossAxis:h=!1,limiter:g={fn:R=>{let{x:j,y:O}=R;return{x:j,y:O}}},...p}=da(n,l),x={x:o,y:i},v=await d.detectOverflow(l,p),w=Hn(fa(u)),E=zf(w);let C=x[E],N=x[w];if(m){const R=E==="y"?"top":"left",j=E==="y"?"bottom":"right",O=C+v[R],z=C-v[j];C=Jd(O,C,z)}if(h){const R=w==="y"?"top":"left",j=w==="y"?"bottom":"right",O=N+v[R],z=N-v[j];N=Jd(O,N,z)}const T=g.fn({...l,[E]:C,[w]:N});return{...T,data:{x:T.x-o,y:T.y-i,enabled:{[E]:m,[w]:h}}}}}},J5=function(n){return n===void 0&&(n={}),{options:n,fn(l){const{x:o,y:i,placement:u,rects:d,middlewareData:m}=l,{offset:h=0,mainAxis:g=!0,crossAxis:p=!0}=da(n,l),x={x:o,y:i},v=Hn(u),w=zf(v);let E=x[w],C=x[v];const N=da(h,l),T=typeof N=="number"?{mainAxis:N,crossAxis:0}:{mainAxis:0,crossAxis:0,...N};if(g){const O=w==="y"?"height":"width",z=d.reference[w]-d.floating[O]+T.mainAxis,X=d.reference[w]+d.reference[O]-T.mainAxis;E<z?E=z:E>X&&(E=X)}if(p){var R,j;const O=w==="y"?"width":"height",z=zy.has(fa(u)),X=d.reference[v]-d.floating[O]+(z&&((R=m.offset)==null?void 0:R[v])||0)+(z?0:T.crossAxis),K=d.reference[v]+d.reference[O]+(z?0:((j=m.offset)==null?void 0:j[v])||0)-(z?T.crossAxis:0);C<X?C=X:C>K&&(C=K)}return{[w]:E,[v]:C}}}},W5=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(l){var o,i;const{placement:u,rects:d,platform:m,elements:h}=l,{apply:g=()=>{},...p}=da(n,l),x=await m.detectOverflow(l,p),v=fa(u),w=zr(u),E=Hn(u)==="y",{width:C,height:N}=d.floating;let T,R;v==="top"||v==="bottom"?(T=v,R=w===(await(m.isRTL==null?void 0:m.isRTL(h.floating))?"start":"end")?"left":"right"):(R=v,T=w==="end"?"top":"bottom");const j=N-x.top-x.bottom,O=C-x.left-x.right,z=Ka(N-x[T],j),X=Ka(C-x[R],O),K=!l.middlewareData.shift;let V=z,H=X;if((o=l.middlewareData.shift)!=null&&o.enabled.x&&(H=O),(i=l.middlewareData.shift)!=null&&i.enabled.y&&(V=j),K&&!w){const ie=en(x.left,0),me=en(x.right,0),fe=en(x.top,0),ce=en(x.bottom,0);E?H=C-2*(ie!==0||me!==0?ie+me:en(x.left,x.right)):V=N-2*(fe!==0||ce!==0?fe+ce:en(x.top,x.bottom))}await g({...l,availableWidth:H,availableHeight:V});const le=await m.getDimensions(h.floating);return C!==le.width||N!==le.height?{reset:{rects:!0}}:{}}}};function Ws(){return typeof window<"u"}function Lr(n){return Ly(n)?(n.nodeName||"").toLowerCase():"#document"}function tn(n){var l;return(n==null||(l=n.ownerDocument)==null?void 0:l.defaultView)||window}function qn(n){var l;return(l=(Ly(n)?n.ownerDocument:n.document)||window.document)==null?void 0:l.documentElement}function Ly(n){return Ws()?n instanceof Node||n instanceof tn(n).Node:!1}function En(n){return Ws()?n instanceof Element||n instanceof tn(n).Element:!1}function ma(n){return Ws()?n instanceof HTMLElement||n instanceof tn(n).HTMLElement:!1}function Hv(n){return!Ws()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof tn(n).ShadowRoot}function Ko(n){const{overflow:l,overflowX:o,overflowY:i,display:u}=Nn(n);return/auto|scroll|overlay|hidden|clip/.test(l+i+o)&&u!=="inline"&&u!=="contents"}function eR(n){return/^(table|td|th)$/.test(Lr(n))}function ec(n){try{if(n.matches(":popover-open"))return!0}catch{}try{return n.matches(":modal")}catch{return!1}}const tR=/transform|translate|scale|rotate|perspective|filter/,nR=/paint|layout|strict|content/,El=n=>!!n&&n!=="none";let Bd;function Bf(n){const l=En(n)?Nn(n):n;return El(l.transform)||El(l.translate)||El(l.scale)||El(l.rotate)||El(l.perspective)||!Hf()&&(El(l.backdropFilter)||El(l.filter))||tR.test(l.willChange||"")||nR.test(l.contain||"")}function aR(n){let l=Za(n);for(;ma(l)&&!_r(l);){if(Bf(l))return l;if(ec(l))return null;l=Za(l)}return null}function Hf(){return Bd==null&&(Bd=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Bd}function _r(n){return/^(html|body|#document)$/.test(Lr(n))}function Nn(n){return tn(n).getComputedStyle(n)}function tc(n){return En(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function Za(n){if(Lr(n)==="html")return n;const l=n.assignedSlot||n.parentNode||Hv(n)&&n.host||qn(n);return Hv(l)?l.host:l}function Uy(n){const l=Za(n);return _r(l)?n.ownerDocument?n.ownerDocument.body:n.body:ma(l)&&Ko(l)?l:Uy(l)}function Go(n,l,o){var i;l===void 0&&(l=[]),o===void 0&&(o=!0);const u=Uy(n),d=u===((i=n.ownerDocument)==null?void 0:i.body),m=tn(u);if(d){const h=ef(m);return l.concat(m,m.visualViewport||[],Ko(u)?u:[],h&&o?Go(h):[])}else return l.concat(u,Go(u,[],o))}function ef(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function By(n){const l=Nn(n);let o=parseFloat(l.width)||0,i=parseFloat(l.height)||0;const u=ma(n),d=u?n.offsetWidth:o,m=u?n.offsetHeight:i,h=Ds(o)!==d||Ds(i)!==m;return h&&(o=d,i=m),{width:o,height:i,$:h}}function Vf(n){return En(n)?n:n.contextElement}function Tr(n){const l=Vf(n);if(!ma(l))return $n(1);const o=l.getBoundingClientRect(),{width:i,height:u,$:d}=By(l);let m=(d?Ds(o.width):o.width)/i,h=(d?Ds(o.height):o.height)/u;return(!m||!Number.isFinite(m))&&(m=1),(!h||!Number.isFinite(h))&&(h=1),{x:m,y:h}}const lR=$n(0);function Hy(n){const l=tn(n);return!Hf()||!l.visualViewport?lR:{x:l.visualViewport.offsetLeft,y:l.visualViewport.offsetTop}}function rR(n,l,o){return l===void 0&&(l=!1),!o||l&&o!==tn(n)?!1:l}function Rl(n,l,o,i){l===void 0&&(l=!1),o===void 0&&(o=!1);const u=n.getBoundingClientRect(),d=Vf(n);let m=$n(1);l&&(i?En(i)&&(m=Tr(i)):m=Tr(n));const h=rR(d,o,i)?Hy(d):$n(0);let g=(u.left+h.x)/m.x,p=(u.top+h.y)/m.y,x=u.width/m.x,v=u.height/m.y;if(d){const w=tn(d),E=i&&En(i)?tn(i):i;let C=w,N=ef(C);for(;N&&i&&E!==C;){const T=Tr(N),R=N.getBoundingClientRect(),j=Nn(N),O=R.left+(N.clientLeft+parseFloat(j.paddingLeft))*T.x,z=R.top+(N.clientTop+parseFloat(j.paddingTop))*T.y;g*=T.x,p*=T.y,x*=T.x,v*=T.y,g+=O,p+=z,C=tn(N),N=ef(C)}}return zs({width:x,height:v,x:g,y:p})}function nc(n,l){const o=tc(n).scrollLeft;return l?l.left+o:Rl(qn(n)).left+o}function Vy(n,l){const o=n.getBoundingClientRect(),i=o.left+l.scrollLeft-nc(n,o),u=o.top+l.scrollTop;return{x:i,y:u}}function oR(n){let{elements:l,rect:o,offsetParent:i,strategy:u}=n;const d=u==="fixed",m=qn(i),h=l?ec(l.floating):!1;if(i===m||h&&d)return o;let g={scrollLeft:0,scrollTop:0},p=$n(1);const x=$n(0),v=ma(i);if((v||!v&&!d)&&((Lr(i)!=="body"||Ko(m))&&(g=tc(i)),v)){const E=Rl(i);p=Tr(i),x.x=E.x+i.clientLeft,x.y=E.y+i.clientTop}const w=m&&!v&&!d?Vy(m,g):$n(0);return{width:o.width*p.x,height:o.height*p.y,x:o.x*p.x-g.scrollLeft*p.x+x.x+w.x,y:o.y*p.y-g.scrollTop*p.y+x.y+w.y}}function iR(n){return Array.from(n.getClientRects())}function sR(n){const l=qn(n),o=tc(n),i=n.ownerDocument.body,u=en(l.scrollWidth,l.clientWidth,i.scrollWidth,i.clientWidth),d=en(l.scrollHeight,l.clientHeight,i.scrollHeight,i.clientHeight);let m=-o.scrollLeft+nc(n);const h=-o.scrollTop;return Nn(i).direction==="rtl"&&(m+=en(l.clientWidth,i.clientWidth)-u),{width:u,height:d,x:m,y:h}}const Vv=25;function cR(n,l){const o=tn(n),i=qn(n),u=o.visualViewport;let d=i.clientWidth,m=i.clientHeight,h=0,g=0;if(u){d=u.width,m=u.height;const x=Hf();(!x||x&&l==="fixed")&&(h=u.offsetLeft,g=u.offsetTop)}const p=nc(i);if(p<=0){const x=i.ownerDocument,v=x.body,w=getComputedStyle(v),E=x.compatMode==="CSS1Compat"&&parseFloat(w.marginLeft)+parseFloat(w.marginRight)||0,C=Math.abs(i.clientWidth-v.clientWidth-E);C<=Vv&&(d-=C)}else p<=Vv&&(d+=p);return{width:d,height:m,x:h,y:g}}function uR(n,l){const o=Rl(n,!0,l==="fixed"),i=o.top+n.clientTop,u=o.left+n.clientLeft,d=ma(n)?Tr(n):$n(1),m=n.clientWidth*d.x,h=n.clientHeight*d.y,g=u*d.x,p=i*d.y;return{width:m,height:h,x:g,y:p}}function $v(n,l,o){let i;if(l==="viewport")i=cR(n,o);else if(l==="document")i=sR(qn(n));else if(En(l))i=uR(l,o);else{const u=Hy(n);i={x:l.x-u.x,y:l.y-u.y,width:l.width,height:l.height}}return zs(i)}function $y(n,l){const o=Za(n);return o===l||!En(o)||_r(o)?!1:Nn(o).position==="fixed"||$y(o,l)}function dR(n,l){const o=l.get(n);if(o)return o;let i=Go(n,[],!1).filter(h=>En(h)&&Lr(h)!=="body"),u=null;const d=Nn(n).position==="fixed";let m=d?Za(n):n;for(;En(m)&&!_r(m);){const h=Nn(m),g=Bf(m);!g&&h.position==="fixed"&&(u=null),(d?!g&&!u:!g&&h.position==="static"&&!!u&&(u.position==="absolute"||u.position==="fixed")||Ko(m)&&!g&&$y(n,m))?i=i.filter(x=>x!==m):u=h,m=Za(m)}return l.set(n,i),i}function fR(n){let{element:l,boundary:o,rootBoundary:i,strategy:u}=n;const m=[...o==="clippingAncestors"?ec(l)?[]:dR(l,this._c):[].concat(o),i],h=$v(l,m[0],u);let g=h.top,p=h.right,x=h.bottom,v=h.left;for(let w=1;w<m.length;w++){const E=$v(l,m[w],u);g=en(E.top,g),p=Ka(E.right,p),x=Ka(E.bottom,x),v=en(E.left,v)}return{width:p-v,height:x-g,x:v,y:g}}function mR(n){const{width:l,height:o}=By(n);return{width:l,height:o}}function hR(n,l,o){const i=ma(l),u=qn(l),d=o==="fixed",m=Rl(n,!0,d,l);let h={scrollLeft:0,scrollTop:0};const g=$n(0);function p(){g.x=nc(u)}if(i||!i&&!d)if((Lr(l)!=="body"||Ko(u))&&(h=tc(l)),i){const E=Rl(l,!0,d,l);g.x=E.x+l.clientLeft,g.y=E.y+l.clientTop}else u&&p();d&&!i&&u&&p();const x=u&&!i&&!d?Vy(u,h):$n(0),v=m.left+h.scrollLeft-g.x-x.x,w=m.top+h.scrollTop-g.y-x.y;return{x:v,y:w,width:m.width,height:m.height}}function Hd(n){return Nn(n).position==="static"}function Yv(n,l){if(!ma(n)||Nn(n).position==="fixed")return null;if(l)return l(n);let o=n.offsetParent;return qn(n)===o&&(o=o.ownerDocument.body),o}function Yy(n,l){const o=tn(n);if(ec(n))return o;if(!ma(n)){let u=Za(n);for(;u&&!_r(u);){if(En(u)&&!Hd(u))return u;u=Za(u)}return o}let i=Yv(n,l);for(;i&&eR(i)&&Hd(i);)i=Yv(i,l);return i&&_r(i)&&Hd(i)&&!Bf(i)?o:i||aR(n)||o}const pR=async function(n){const l=this.getOffsetParent||Yy,o=this.getDimensions,i=await o(n.floating);return{reference:hR(n.reference,await l(n.floating),n.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function gR(n){return Nn(n).direction==="rtl"}const vR={convertOffsetParentRelativeRectToViewportRelativeRect:oR,getDocumentElement:qn,getClippingRect:fR,getOffsetParent:Yy,getElementRects:pR,getClientRects:iR,getDimensions:mR,getScale:Tr,isElement:En,isRTL:gR};function qy(n,l){return n.x===l.x&&n.y===l.y&&n.width===l.width&&n.height===l.height}function yR(n,l){let o=null,i;const u=qn(n);function d(){var h;clearTimeout(i),(h=o)==null||h.disconnect(),o=null}function m(h,g){h===void 0&&(h=!1),g===void 0&&(g=1),d();const p=n.getBoundingClientRect(),{left:x,top:v,width:w,height:E}=p;if(h||l(),!w||!E)return;const C=xs(v),N=xs(u.clientWidth-(x+w)),T=xs(u.clientHeight-(v+E)),R=xs(x),O={rootMargin:-C+"px "+-N+"px "+-T+"px "+-R+"px",threshold:en(0,Ka(1,g))||1};let z=!0;function X(K){const V=K[0].intersectionRatio;if(V!==g){if(!z)return m();V?m(!1,V):i=setTimeout(()=>{m(!1,1e-7)},1e3)}V===1&&!qy(p,n.getBoundingClientRect())&&m(),z=!1}try{o=new IntersectionObserver(X,{...O,root:u.ownerDocument})}catch{o=new IntersectionObserver(X,O)}o.observe(n)}return m(!0),d}function bR(n,l,o,i){i===void 0&&(i={});const{ancestorScroll:u=!0,ancestorResize:d=!0,elementResize:m=typeof ResizeObserver=="function",layoutShift:h=typeof IntersectionObserver=="function",animationFrame:g=!1}=i,p=Vf(n),x=u||d?[...p?Go(p):[],...l?Go(l):[]]:[];x.forEach(R=>{u&&R.addEventListener("scroll",o,{passive:!0}),d&&R.addEventListener("resize",o)});const v=p&&h?yR(p,o):null;let w=-1,E=null;m&&(E=new ResizeObserver(R=>{let[j]=R;j&&j.target===p&&E&&l&&(E.unobserve(l),cancelAnimationFrame(w),w=requestAnimationFrame(()=>{var O;(O=E)==null||O.observe(l)})),o()}),p&&!g&&E.observe(p),l&&E.observe(l));let C,N=g?Rl(n):null;g&&T();function T(){const R=Rl(n);N&&!qy(N,R)&&o(),N=R,C=requestAnimationFrame(T)}return o(),()=>{var R;x.forEach(j=>{u&&j.removeEventListener("scroll",o),d&&j.removeEventListener("resize",o)}),v==null||v(),(R=E)==null||R.disconnect(),E=null,g&&cancelAnimationFrame(C)}}const xR=I5,SR=F5,wR=Q5,ER=W5,NR=K5,qv=P5,CR=J5,TR=(n,l,o)=>{const i=new Map,u={platform:vR,...o},d={...u.platform,_c:i};return X5(n,l,{...u,platform:d})};var RR=typeof document<"u",AR=function(){},Cs=RR?y.useLayoutEffect:AR;function Ls(n,l){if(n===l)return!0;if(typeof n!=typeof l)return!1;if(typeof n=="function"&&n.toString()===l.toString())return!0;let o,i,u;if(n&&l&&typeof n=="object"){if(Array.isArray(n)){if(o=n.length,o!==l.length)return!1;for(i=o;i--!==0;)if(!Ls(n[i],l[i]))return!1;return!0}if(u=Object.keys(n),o=u.length,o!==Object.keys(l).length)return!1;for(i=o;i--!==0;)if(!{}.hasOwnProperty.call(l,u[i]))return!1;for(i=o;i--!==0;){const d=u[i];if(!(d==="_owner"&&n.$$typeof)&&!Ls(n[d],l[d]))return!1}return!0}return n!==n&&l!==l}function Gy(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function Gv(n,l){const o=Gy(n);return Math.round(l*o)/o}function Vd(n){const l=y.useRef(n);return Cs(()=>{l.current=n}),l}function _R(n){n===void 0&&(n={});const{placement:l="bottom",strategy:o="absolute",middleware:i=[],platform:u,elements:{reference:d,floating:m}={},transform:h=!0,whileElementsMounted:g,open:p}=n,[x,v]=y.useState({x:0,y:0,strategy:o,placement:l,middlewareData:{},isPositioned:!1}),[w,E]=y.useState(i);Ls(w,i)||E(i);const[C,N]=y.useState(null),[T,R]=y.useState(null),j=y.useCallback(F=>{F!==K.current&&(K.current=F,N(F))},[]),O=y.useCallback(F=>{F!==V.current&&(V.current=F,R(F))},[]),z=d||C,X=m||T,K=y.useRef(null),V=y.useRef(null),H=y.useRef(x),le=g!=null,ie=Vd(g),me=Vd(u),fe=Vd(p),ce=y.useCallback(()=>{if(!K.current||!V.current)return;const F={placement:l,strategy:o,middleware:w};me.current&&(F.platform=me.current),TR(K.current,V.current,F).then(J=>{const G={...J,isPositioned:fe.current!==!1};de.current&&!Ls(H.current,G)&&(H.current=G,Qo.flushSync(()=>{v(G)}))})},[w,l,o,me,fe]);Cs(()=>{p===!1&&H.current.isPositioned&&(H.current.isPositioned=!1,v(F=>({...F,isPositioned:!1})))},[p]);const de=y.useRef(!1);Cs(()=>(de.current=!0,()=>{de.current=!1}),[]),Cs(()=>{if(z&&(K.current=z),X&&(V.current=X),z&&X){if(ie.current)return ie.current(z,X,ce);ce()}},[z,X,ce,ie,le]);const re=y.useMemo(()=>({reference:K,floating:V,setReference:j,setFloating:O}),[j,O]),M=y.useMemo(()=>({reference:z,floating:X}),[z,X]),$=y.useMemo(()=>{const F={position:o,left:0,top:0};if(!M.floating)return F;const J=Gv(M.floating,x.x),G=Gv(M.floating,x.y);return h?{...F,transform:"translate("+J+"px, "+G+"px)",...Gy(M.floating)>=1.5&&{willChange:"transform"}}:{position:o,left:J,top:G}},[o,h,M.floating,x.x,x.y]);return y.useMemo(()=>({...x,update:ce,refs:re,elements:M,floatingStyles:$}),[x,ce,re,M,$])}const jR=n=>{function l(o){return{}.hasOwnProperty.call(o,"current")}return{name:"arrow",options:n,fn(o){const{element:i,padding:u}=typeof n=="function"?n(o):n;return i&&l(i)?i.current!=null?qv({element:i.current,padding:u}).fn(o):{}:i?qv({element:i,padding:u}).fn(o):{}}}},MR=(n,l)=>{const o=xR(n);return{name:o.name,fn:o.fn,options:[n,l]}},OR=(n,l)=>{const o=SR(n);return{name:o.name,fn:o.fn,options:[n,l]}},DR=(n,l)=>({fn:CR(n).fn,options:[n,l]}),kR=(n,l)=>{const o=wR(n);return{name:o.name,fn:o.fn,options:[n,l]}},zR=(n,l)=>{const o=ER(n);return{name:o.name,fn:o.fn,options:[n,l]}},LR=(n,l)=>{const o=NR(n);return{name:o.name,fn:o.fn,options:[n,l]}},UR=(n,l)=>{const o=jR(n);return{name:o.name,fn:o.fn,options:[n,l]}};var BR="Arrow",Xy=y.forwardRef((n,l)=>{const{children:o,width:i=10,height:u=5,...d}=n;return f.jsx(Le.svg,{...d,ref:l,width:i,height:u,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:n.asChild?o:f.jsx("polygon",{points:"0,0 30,0 15,10"})})});Xy.displayName=BR;var HR=Xy;function Py(n){const[l,o]=y.useState(void 0);return _t(()=>{if(n){o({width:n.offsetWidth,height:n.offsetHeight});const i=new ResizeObserver(u=>{if(!Array.isArray(u)||!u.length)return;const d=u[0];let m,h;if("borderBoxSize"in d){const g=d.borderBoxSize,p=Array.isArray(g)?g[0]:g;m=p.inlineSize,h=p.blockSize}else m=n.offsetWidth,h=n.offsetHeight;o({width:m,height:h})});return i.observe(n,{box:"border-box"}),()=>i.unobserve(n)}else o(void 0)},[n]),l}var $f="Popper",[Qy,Ky]=Fa($f),[VR,Zy]=Qy($f),Iy=n=>{const{__scopePopper:l,children:o}=n,[i,u]=y.useState(null);return f.jsx(VR,{scope:l,anchor:i,onAnchorChange:u,children:o})};Iy.displayName=$f;var Fy="PopperAnchor",Jy=y.forwardRef((n,l)=>{const{__scopePopper:o,virtualRef:i,...u}=n,d=Zy(Fy,o),m=y.useRef(null),h=Ie(l,m),g=y.useRef(null);return y.useEffect(()=>{const p=g.current;g.current=(i==null?void 0:i.current)||m.current,p!==g.current&&d.onAnchorChange(g.current)}),i?null:f.jsx(Le.div,{...u,ref:h})});Jy.displayName=Fy;var Yf="PopperContent",[$R,YR]=Qy(Yf),Wy=y.forwardRef((n,l)=>{var ne,ue,ee,xe,ye,Se;const{__scopePopper:o,side:i="bottom",sideOffset:u=0,align:d="center",alignOffset:m=0,arrowPadding:h=0,avoidCollisions:g=!0,collisionBoundary:p=[],collisionPadding:x=0,sticky:v="partial",hideWhenDetached:w=!1,updatePositionStrategy:E="optimized",onPlaced:C,...N}=n,T=Zy(Yf,o),[R,j]=y.useState(null),O=Ie(l,$e=>j($e)),[z,X]=y.useState(null),K=Py(z),V=(K==null?void 0:K.width)??0,H=(K==null?void 0:K.height)??0,le=i+(d!=="center"?"-"+d:""),ie=typeof x=="number"?x:{top:0,right:0,bottom:0,left:0,...x},me=Array.isArray(p)?p:[p],fe=me.length>0,ce={padding:ie,boundary:me.filter(GR),altBoundary:fe},{refs:de,floatingStyles:re,placement:M,isPositioned:$,middlewareData:F}=_R({strategy:"fixed",placement:le,whileElementsMounted:(...$e)=>bR(...$e,{animationFrame:E==="always"}),elements:{reference:T.anchor},middleware:[MR({mainAxis:u+H,alignmentAxis:m}),g&&OR({mainAxis:!0,crossAxis:!1,limiter:v==="partial"?DR():void 0,...ce}),g&&kR({...ce}),zR({...ce,apply:({elements:$e,rects:Ue,availableWidth:Ye,availableHeight:gt})=>{const{width:ot,height:Pt}=Ue.reference,vt=$e.floating.style;vt.setProperty("--radix-popper-available-width",`${Ye}px`),vt.setProperty("--radix-popper-available-height",`${gt}px`),vt.setProperty("--radix-popper-anchor-width",`${ot}px`),vt.setProperty("--radix-popper-anchor-height",`${Pt}px`)}}),z&&UR({element:z,padding:h}),XR({arrowWidth:V,arrowHeight:H}),w&&LR({strategy:"referenceHidden",...ce})]}),[J,G]=nb(M),A=Qa(C);_t(()=>{$&&(A==null||A())},[$,A]);const Y=(ne=F.arrow)==null?void 0:ne.x,Q=(ue=F.arrow)==null?void 0:ue.y,W=((ee=F.arrow)==null?void 0:ee.centerOffset)!==0,[te,oe]=y.useState();return _t(()=>{R&&oe(window.getComputedStyle(R).zIndex)},[R]),f.jsx("div",{ref:de.setFloating,"data-radix-popper-content-wrapper":"",style:{...re,transform:$?re.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:te,"--radix-popper-transform-origin":[(xe=F.transformOrigin)==null?void 0:xe.x,(ye=F.transformOrigin)==null?void 0:ye.y].join(" "),...((Se=F.hide)==null?void 0:Se.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:n.dir,children:f.jsx($R,{scope:o,placedSide:J,onArrowChange:X,arrowX:Y,arrowY:Q,shouldHideArrow:W,children:f.jsx(Le.div,{"data-side":J,"data-align":G,...N,ref:O,style:{...N.style,animation:$?void 0:"none"}})})})});Wy.displayName=Yf;var eb="PopperArrow",qR={top:"bottom",right:"left",bottom:"top",left:"right"},tb=y.forwardRef(function(l,o){const{__scopePopper:i,...u}=l,d=YR(eb,i),m=qR[d.placedSide];return f.jsx("span",{ref:d.onArrowChange,style:{position:"absolute",left:d.arrowX,top:d.arrowY,[m]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[d.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[d.placedSide],visibility:d.shouldHideArrow?"hidden":void 0},children:f.jsx(HR,{...u,ref:o,style:{...u.style,display:"block"}})})});tb.displayName=eb;function GR(n){return n!==null}var XR=n=>({name:"transformOrigin",options:n,fn(l){var T,R,j;const{placement:o,rects:i,middlewareData:u}=l,m=((T=u.arrow)==null?void 0:T.centerOffset)!==0,h=m?0:n.arrowWidth,g=m?0:n.arrowHeight,[p,x]=nb(o),v={start:"0%",center:"50%",end:"100%"}[x],w=(((R=u.arrow)==null?void 0:R.x)??0)+h/2,E=(((j=u.arrow)==null?void 0:j.y)??0)+g/2;let C="",N="";return p==="bottom"?(C=m?v:`${w}px`,N=`${-g}px`):p==="top"?(C=m?v:`${w}px`,N=`${i.floating.height+g}px`):p==="right"?(C=`${-g}px`,N=m?v:`${E}px`):p==="left"&&(C=`${i.floating.width+g}px`,N=m?v:`${E}px`),{data:{x:C,y:N}}}});function nb(n){const[l,o="center"]=n.split("-");return[l,o]}var PR=Iy,QR=Jy,KR=Wy,ZR=tb;function ab(n){const l=y.useRef({value:n,previous:n});return y.useMemo(()=>(l.current.value!==n&&(l.current.previous=l.current.value,l.current.value=n),l.current.previous),[n])}var lb=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),IR="VisuallyHidden",FR=y.forwardRef((n,l)=>f.jsx(Le.span,{...n,ref:l,style:{...lb,...n.style}}));FR.displayName=IR;var JR=[" ","Enter","ArrowUp","ArrowDown"],WR=[" ","Enter"],Al="Select",[ac,lc,eA]=Dy(Al),[Ur]=Fa(Al,[eA,Ky]),rc=Ky(),[tA,Ja]=Ur(Al),[nA,aA]=Ur(Al),rb=n=>{const{__scopeSelect:l,children:o,open:i,defaultOpen:u,onOpenChange:d,value:m,defaultValue:h,onValueChange:g,dir:p,name:x,autoComplete:v,disabled:w,required:E,form:C}=n,N=rc(l),[T,R]=y.useState(null),[j,O]=y.useState(null),[z,X]=y.useState(!1),K=kf(p),[V,H]=Ar({prop:i,defaultProp:u??!1,onChange:d,caller:Al}),[le,ie]=Ar({prop:m,defaultProp:h,onChange:g,caller:Al}),me=y.useRef(null),fe=T?C||!!T.closest("form"):!0,[ce,de]=y.useState(new Set),re=Array.from(ce).map(M=>M.props.value).join(";");return f.jsx(PR,{...N,children:f.jsxs(tA,{required:E,scope:l,trigger:T,onTriggerChange:R,valueNode:j,onValueNodeChange:O,valueNodeHasChildren:z,onValueNodeHasChildrenChange:X,contentId:Xa(),value:le,onValueChange:ie,open:V,onOpenChange:H,dir:K,triggerPointerDownPosRef:me,disabled:w,children:[f.jsx(ac.Provider,{scope:l,children:f.jsx(nA,{scope:n.__scopeSelect,onNativeOptionAdd:y.useCallback(M=>{de($=>new Set($).add(M))},[]),onNativeOptionRemove:y.useCallback(M=>{de($=>{const F=new Set($);return F.delete(M),F})},[]),children:o})}),fe?f.jsxs(_b,{"aria-hidden":!0,required:E,tabIndex:-1,name:x,autoComplete:v,value:le,onChange:M=>ie(M.target.value),disabled:w,form:C,children:[le===void 0?f.jsx("option",{value:""}):null,Array.from(ce)]},re):null]})})};rb.displayName=Al;var ob="SelectTrigger",ib=y.forwardRef((n,l)=>{const{__scopeSelect:o,disabled:i=!1,...u}=n,d=rc(o),m=Ja(ob,o),h=m.disabled||i,g=Ie(l,m.onTriggerChange),p=lc(o),x=y.useRef("touch"),[v,w,E]=Mb(N=>{const T=p().filter(O=>!O.disabled),R=T.find(O=>O.value===m.value),j=Ob(T,N,R);j!==void 0&&m.onValueChange(j.value)}),C=N=>{h||(m.onOpenChange(!0),E()),N&&(m.triggerPointerDownPosRef.current={x:Math.round(N.pageX),y:Math.round(N.pageY)})};return f.jsx(QR,{asChild:!0,...d,children:f.jsx(Le.button,{type:"button",role:"combobox","aria-controls":m.contentId,"aria-expanded":m.open,"aria-required":m.required,"aria-autocomplete":"none",dir:m.dir,"data-state":m.open?"open":"closed",disabled:h,"data-disabled":h?"":void 0,"data-placeholder":jb(m.value)?"":void 0,...u,ref:g,onClick:Me(u.onClick,N=>{N.currentTarget.focus(),x.current!=="mouse"&&C(N)}),onPointerDown:Me(u.onPointerDown,N=>{x.current=N.pointerType;const T=N.target;T.hasPointerCapture(N.pointerId)&&T.releasePointerCapture(N.pointerId),N.button===0&&N.ctrlKey===!1&&N.pointerType==="mouse"&&(C(N),N.preventDefault())}),onKeyDown:Me(u.onKeyDown,N=>{const T=v.current!=="";!(N.ctrlKey||N.altKey||N.metaKey)&&N.key.length===1&&w(N.key),!(T&&N.key===" ")&&JR.includes(N.key)&&(C(),N.preventDefault())})})})});ib.displayName=ob;var sb="SelectValue",cb=y.forwardRef((n,l)=>{const{__scopeSelect:o,className:i,style:u,children:d,placeholder:m="",...h}=n,g=Ja(sb,o),{onValueNodeHasChildrenChange:p}=g,x=d!==void 0,v=Ie(l,g.onValueNodeChange);return _t(()=>{p(x)},[p,x]),f.jsx(Le.span,{...h,ref:v,style:{pointerEvents:"none"},children:jb(g.value)?f.jsx(f.Fragment,{children:m}):d})});cb.displayName=sb;var lA="SelectIcon",ub=y.forwardRef((n,l)=>{const{__scopeSelect:o,children:i,...u}=n;return f.jsx(Le.span,{"aria-hidden":!0,...u,ref:l,children:i||"▼"})});ub.displayName=lA;var rA="SelectPortal",db=n=>f.jsx(Cf,{asChild:!0,...n});db.displayName=rA;var _l="SelectContent",fb=y.forwardRef((n,l)=>{const o=Ja(_l,n.__scopeSelect),[i,u]=y.useState();if(_t(()=>{u(new DocumentFragment)},[]),!o.open){const d=i;return d?Qo.createPortal(f.jsx(mb,{scope:n.__scopeSelect,children:f.jsx(ac.Slot,{scope:n.__scopeSelect,children:f.jsx("div",{children:n.children})})}),d):null}return f.jsx(hb,{...n,ref:l})});fb.displayName=_l;var xn=10,[mb,Wa]=Ur(_l),oA="SelectContentImpl",iA=qo("SelectContent.RemoveScroll"),hb=y.forwardRef((n,l)=>{const{__scopeSelect:o,position:i="item-aligned",onCloseAutoFocus:u,onEscapeKeyDown:d,onPointerDownOutside:m,side:h,sideOffset:g,align:p,alignOffset:x,arrowPadding:v,collisionBoundary:w,collisionPadding:E,sticky:C,hideWhenDetached:N,avoidCollisions:T,...R}=n,j=Ja(_l,o),[O,z]=y.useState(null),[X,K]=y.useState(null),V=Ie(l,ne=>z(ne)),[H,le]=y.useState(null),[ie,me]=y.useState(null),fe=lc(o),[ce,de]=y.useState(!1),re=y.useRef(!1);y.useEffect(()=>{if(O)return iy(O)},[O]),J0();const M=y.useCallback(ne=>{const[ue,...ee]=fe().map(Se=>Se.ref.current),[xe]=ee.slice(-1),ye=document.activeElement;for(const Se of ne)if(Se===ye||(Se==null||Se.scrollIntoView({block:"nearest"}),Se===ue&&X&&(X.scrollTop=0),Se===xe&&X&&(X.scrollTop=X.scrollHeight),Se==null||Se.focus(),document.activeElement!==ye))return},[fe,X]),$=y.useCallback(()=>M([H,O]),[M,H,O]);y.useEffect(()=>{ce&&$()},[ce,$]);const{onOpenChange:F,triggerPointerDownPosRef:J}=j;y.useEffect(()=>{if(O){let ne={x:0,y:0};const ue=xe=>{var ye,Se;ne={x:Math.abs(Math.round(xe.pageX)-(((ye=J.current)==null?void 0:ye.x)??0)),y:Math.abs(Math.round(xe.pageY)-(((Se=J.current)==null?void 0:Se.y)??0))}},ee=xe=>{ne.x<=10&&ne.y<=10?xe.preventDefault():O.contains(xe.target)||F(!1),document.removeEventListener("pointermove",ue),J.current=null};return J.current!==null&&(document.addEventListener("pointermove",ue),document.addEventListener("pointerup",ee,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ue),document.removeEventListener("pointerup",ee,{capture:!0})}}},[O,F,J]),y.useEffect(()=>{const ne=()=>F(!1);return window.addEventListener("blur",ne),window.addEventListener("resize",ne),()=>{window.removeEventListener("blur",ne),window.removeEventListener("resize",ne)}},[F]);const[G,A]=Mb(ne=>{const ue=fe().filter(ye=>!ye.disabled),ee=ue.find(ye=>ye.ref.current===document.activeElement),xe=Ob(ue,ne,ee);xe&&setTimeout(()=>xe.ref.current.focus())}),Y=y.useCallback((ne,ue,ee)=>{const xe=!re.current&&!ee;(j.value!==void 0&&j.value===ue||xe)&&(le(ne),xe&&(re.current=!0))},[j.value]),Q=y.useCallback(()=>O==null?void 0:O.focus(),[O]),W=y.useCallback((ne,ue,ee)=>{const xe=!re.current&&!ee;(j.value!==void 0&&j.value===ue||xe)&&me(ne)},[j.value]),te=i==="popper"?tf:pb,oe=te===tf?{side:h,sideOffset:g,align:p,alignOffset:x,arrowPadding:v,collisionBoundary:w,collisionPadding:E,sticky:C,hideWhenDetached:N,avoidCollisions:T}:{};return f.jsx(mb,{scope:o,content:O,viewport:X,onViewportChange:K,itemRefCallback:Y,selectedItem:H,onItemLeave:Q,itemTextRefCallback:W,focusSelectedItem:$,selectedItemText:ie,position:i,isPositioned:ce,searchRef:G,children:f.jsx(Tf,{as:iA,allowPinchZoom:!0,children:f.jsx(Nf,{asChild:!0,trapped:j.open,onMountAutoFocus:ne=>{ne.preventDefault()},onUnmountAutoFocus:Me(u,ne=>{var ue;(ue=j.trigger)==null||ue.focus({preventScroll:!0}),ne.preventDefault()}),children:f.jsx(Ef,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:d,onPointerDownOutside:m,onFocusOutside:ne=>ne.preventDefault(),onDismiss:()=>j.onOpenChange(!1),children:f.jsx(te,{role:"listbox",id:j.contentId,"data-state":j.open?"open":"closed",dir:j.dir,onContextMenu:ne=>ne.preventDefault(),...R,...oe,onPlaced:()=>de(!0),ref:V,style:{display:"flex",flexDirection:"column",outline:"none",...R.style},onKeyDown:Me(R.onKeyDown,ne=>{const ue=ne.ctrlKey||ne.altKey||ne.metaKey;if(ne.key==="Tab"&&ne.preventDefault(),!ue&&ne.key.length===1&&A(ne.key),["ArrowUp","ArrowDown","Home","End"].includes(ne.key)){let xe=fe().filter(ye=>!ye.disabled).map(ye=>ye.ref.current);if(["ArrowUp","End"].includes(ne.key)&&(xe=xe.slice().reverse()),["ArrowUp","ArrowDown"].includes(ne.key)){const ye=ne.target,Se=xe.indexOf(ye);xe=xe.slice(Se+1)}setTimeout(()=>M(xe)),ne.preventDefault()}})})})})})})});hb.displayName=oA;var sA="SelectItemAlignedPosition",pb=y.forwardRef((n,l)=>{const{__scopeSelect:o,onPlaced:i,...u}=n,d=Ja(_l,o),m=Wa(_l,o),[h,g]=y.useState(null),[p,x]=y.useState(null),v=Ie(l,V=>x(V)),w=lc(o),E=y.useRef(!1),C=y.useRef(!0),{viewport:N,selectedItem:T,selectedItemText:R,focusSelectedItem:j}=m,O=y.useCallback(()=>{if(d.trigger&&d.valueNode&&h&&p&&N&&T&&R){const V=d.trigger.getBoundingClientRect(),H=p.getBoundingClientRect(),le=d.valueNode.getBoundingClientRect(),ie=R.getBoundingClientRect();if(d.dir!=="rtl"){const ye=ie.left-H.left,Se=le.left-ye,$e=V.left-Se,Ue=V.width+$e,Ye=Math.max(Ue,H.width),gt=window.innerWidth-xn,ot=Dv(Se,[xn,Math.max(xn,gt-Ye)]);h.style.minWidth=Ue+"px",h.style.left=ot+"px"}else{const ye=H.right-ie.right,Se=window.innerWidth-le.right-ye,$e=window.innerWidth-V.right-Se,Ue=V.width+$e,Ye=Math.max(Ue,H.width),gt=window.innerWidth-xn,ot=Dv(Se,[xn,Math.max(xn,gt-Ye)]);h.style.minWidth=Ue+"px",h.style.right=ot+"px"}const me=w(),fe=window.innerHeight-xn*2,ce=N.scrollHeight,de=window.getComputedStyle(p),re=parseInt(de.borderTopWidth,10),M=parseInt(de.paddingTop,10),$=parseInt(de.borderBottomWidth,10),F=parseInt(de.paddingBottom,10),J=re+M+ce+F+$,G=Math.min(T.offsetHeight*5,J),A=window.getComputedStyle(N),Y=parseInt(A.paddingTop,10),Q=parseInt(A.paddingBottom,10),W=V.top+V.height/2-xn,te=fe-W,oe=T.offsetHeight/2,ne=T.offsetTop+oe,ue=re+M+ne,ee=J-ue;if(ue<=W){const ye=me.length>0&&T===me[me.length-1].ref.current;h.style.bottom="0px";const Se=p.clientHeight-N.offsetTop-N.offsetHeight,$e=Math.max(te,oe+(ye?Q:0)+Se+$),Ue=ue+$e;h.style.height=Ue+"px"}else{const ye=me.length>0&&T===me[0].ref.current;h.style.top="0px";const $e=Math.max(W,re+N.offsetTop+(ye?Y:0)+oe)+ee;h.style.height=$e+"px",N.scrollTop=ue-W+N.offsetTop}h.style.margin=`${xn}px 0`,h.style.minHeight=G+"px",h.style.maxHeight=fe+"px",i==null||i(),requestAnimationFrame(()=>E.current=!0)}},[w,d.trigger,d.valueNode,h,p,N,T,R,d.dir,i]);_t(()=>O(),[O]);const[z,X]=y.useState();_t(()=>{p&&X(window.getComputedStyle(p).zIndex)},[p]);const K=y.useCallback(V=>{V&&C.current===!0&&(O(),j==null||j(),C.current=!1)},[O,j]);return f.jsx(uA,{scope:o,contentWrapper:h,shouldExpandOnScrollRef:E,onScrollButtonChange:K,children:f.jsx("div",{ref:g,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:z},children:f.jsx(Le.div,{...u,ref:v,style:{boxSizing:"border-box",maxHeight:"100%",...u.style}})})})});pb.displayName=sA;var cA="SelectPopperPosition",tf=y.forwardRef((n,l)=>{const{__scopeSelect:o,align:i="start",collisionPadding:u=xn,...d}=n,m=rc(o);return f.jsx(KR,{...m,...d,ref:l,align:i,collisionPadding:u,style:{boxSizing:"border-box",...d.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});tf.displayName=cA;var[uA,qf]=Ur(_l,{}),nf="SelectViewport",gb=y.forwardRef((n,l)=>{const{__scopeSelect:o,nonce:i,...u}=n,d=Wa(nf,o),m=qf(nf,o),h=Ie(l,d.onViewportChange),g=y.useRef(0);return f.jsxs(f.Fragment,{children:[f.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),f.jsx(ac.Slot,{scope:o,children:f.jsx(Le.div,{"data-radix-select-viewport":"",role:"presentation",...u,ref:h,style:{position:"relative",flex:1,overflow:"hidden auto",...u.style},onScroll:Me(u.onScroll,p=>{const x=p.currentTarget,{contentWrapper:v,shouldExpandOnScrollRef:w}=m;if(w!=null&&w.current&&v){const E=Math.abs(g.current-x.scrollTop);if(E>0){const C=window.innerHeight-xn*2,N=parseFloat(v.style.minHeight),T=parseFloat(v.style.height),R=Math.max(N,T);if(R<C){const j=R+E,O=Math.min(C,j),z=j-O;v.style.height=O+"px",v.style.bottom==="0px"&&(x.scrollTop=z>0?z:0,v.style.justifyContent="flex-end")}}}g.current=x.scrollTop})})})]})});gb.displayName=nf;var vb="SelectGroup",[dA,fA]=Ur(vb),mA=y.forwardRef((n,l)=>{const{__scopeSelect:o,...i}=n,u=Xa();return f.jsx(dA,{scope:o,id:u,children:f.jsx(Le.div,{role:"group","aria-labelledby":u,...i,ref:l})})});mA.displayName=vb;var yb="SelectLabel",bb=y.forwardRef((n,l)=>{const{__scopeSelect:o,...i}=n,u=fA(yb,o);return f.jsx(Le.div,{id:u.id,...i,ref:l})});bb.displayName=yb;var Us="SelectItem",[hA,xb]=Ur(Us),Sb=y.forwardRef((n,l)=>{const{__scopeSelect:o,value:i,disabled:u=!1,textValue:d,...m}=n,h=Ja(Us,o),g=Wa(Us,o),p=h.value===i,[x,v]=y.useState(d??""),[w,E]=y.useState(!1),C=Ie(l,j=>{var O;return(O=g.itemRefCallback)==null?void 0:O.call(g,j,i,u)}),N=Xa(),T=y.useRef("touch"),R=()=>{u||(h.onValueChange(i),h.onOpenChange(!1))};if(i==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return f.jsx(hA,{scope:o,value:i,disabled:u,textId:N,isSelected:p,onItemTextChange:y.useCallback(j=>{v(O=>O||((j==null?void 0:j.textContent)??"").trim())},[]),children:f.jsx(ac.ItemSlot,{scope:o,value:i,disabled:u,textValue:x,children:f.jsx(Le.div,{role:"option","aria-labelledby":N,"data-highlighted":w?"":void 0,"aria-selected":p&&w,"data-state":p?"checked":"unchecked","aria-disabled":u||void 0,"data-disabled":u?"":void 0,tabIndex:u?void 0:-1,...m,ref:C,onFocus:Me(m.onFocus,()=>E(!0)),onBlur:Me(m.onBlur,()=>E(!1)),onClick:Me(m.onClick,()=>{T.current!=="mouse"&&R()}),onPointerUp:Me(m.onPointerUp,()=>{T.current==="mouse"&&R()}),onPointerDown:Me(m.onPointerDown,j=>{T.current=j.pointerType}),onPointerMove:Me(m.onPointerMove,j=>{var O;T.current=j.pointerType,u?(O=g.onItemLeave)==null||O.call(g):T.current==="mouse"&&j.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Me(m.onPointerLeave,j=>{var O;j.currentTarget===document.activeElement&&((O=g.onItemLeave)==null||O.call(g))}),onKeyDown:Me(m.onKeyDown,j=>{var z;((z=g.searchRef)==null?void 0:z.current)!==""&&j.key===" "||(WR.includes(j.key)&&R(),j.key===" "&&j.preventDefault())})})})})});Sb.displayName=Us;var Vo="SelectItemText",wb=y.forwardRef((n,l)=>{const{__scopeSelect:o,className:i,style:u,...d}=n,m=Ja(Vo,o),h=Wa(Vo,o),g=xb(Vo,o),p=aA(Vo,o),[x,v]=y.useState(null),w=Ie(l,R=>v(R),g.onItemTextChange,R=>{var j;return(j=h.itemTextRefCallback)==null?void 0:j.call(h,R,g.value,g.disabled)}),E=x==null?void 0:x.textContent,C=y.useMemo(()=>f.jsx("option",{value:g.value,disabled:g.disabled,children:E},g.value),[g.disabled,g.value,E]),{onNativeOptionAdd:N,onNativeOptionRemove:T}=p;return _t(()=>(N(C),()=>T(C)),[N,T,C]),f.jsxs(f.Fragment,{children:[f.jsx(Le.span,{id:g.textId,...d,ref:w}),g.isSelected&&m.valueNode&&!m.valueNodeHasChildren?Qo.createPortal(d.children,m.valueNode):null]})});wb.displayName=Vo;var Eb="SelectItemIndicator",Nb=y.forwardRef((n,l)=>{const{__scopeSelect:o,...i}=n;return xb(Eb,o).isSelected?f.jsx(Le.span,{"aria-hidden":!0,...i,ref:l}):null});Nb.displayName=Eb;var af="SelectScrollUpButton",Cb=y.forwardRef((n,l)=>{const o=Wa(af,n.__scopeSelect),i=qf(af,n.__scopeSelect),[u,d]=y.useState(!1),m=Ie(l,i.onScrollButtonChange);return _t(()=>{if(o.viewport&&o.isPositioned){let h=function(){const p=g.scrollTop>0;d(p)};const g=o.viewport;return h(),g.addEventListener("scroll",h),()=>g.removeEventListener("scroll",h)}},[o.viewport,o.isPositioned]),u?f.jsx(Rb,{...n,ref:m,onAutoScroll:()=>{const{viewport:h,selectedItem:g}=o;h&&g&&(h.scrollTop=h.scrollTop-g.offsetHeight)}}):null});Cb.displayName=af;var lf="SelectScrollDownButton",Tb=y.forwardRef((n,l)=>{const o=Wa(lf,n.__scopeSelect),i=qf(lf,n.__scopeSelect),[u,d]=y.useState(!1),m=Ie(l,i.onScrollButtonChange);return _t(()=>{if(o.viewport&&o.isPositioned){let h=function(){const p=g.scrollHeight-g.clientHeight,x=Math.ceil(g.scrollTop)<p;d(x)};const g=o.viewport;return h(),g.addEventListener("scroll",h),()=>g.removeEventListener("scroll",h)}},[o.viewport,o.isPositioned]),u?f.jsx(Rb,{...n,ref:m,onAutoScroll:()=>{const{viewport:h,selectedItem:g}=o;h&&g&&(h.scrollTop=h.scrollTop+g.offsetHeight)}}):null});Tb.displayName=lf;var Rb=y.forwardRef((n,l)=>{const{__scopeSelect:o,onAutoScroll:i,...u}=n,d=Wa("SelectScrollButton",o),m=y.useRef(null),h=lc(o),g=y.useCallback(()=>{m.current!==null&&(window.clearInterval(m.current),m.current=null)},[]);return y.useEffect(()=>()=>g(),[g]),_t(()=>{var x;const p=h().find(v=>v.ref.current===document.activeElement);(x=p==null?void 0:p.ref.current)==null||x.scrollIntoView({block:"nearest"})},[h]),f.jsx(Le.div,{"aria-hidden":!0,...u,ref:l,style:{flexShrink:0,...u.style},onPointerDown:Me(u.onPointerDown,()=>{m.current===null&&(m.current=window.setInterval(i,50))}),onPointerMove:Me(u.onPointerMove,()=>{var p;(p=d.onItemLeave)==null||p.call(d),m.current===null&&(m.current=window.setInterval(i,50))}),onPointerLeave:Me(u.onPointerLeave,()=>{g()})})}),pA="SelectSeparator",Ab=y.forwardRef((n,l)=>{const{__scopeSelect:o,...i}=n;return f.jsx(Le.div,{"aria-hidden":!0,...i,ref:l})});Ab.displayName=pA;var rf="SelectArrow",gA=y.forwardRef((n,l)=>{const{__scopeSelect:o,...i}=n,u=rc(o),d=Ja(rf,o),m=Wa(rf,o);return d.open&&m.position==="popper"?f.jsx(ZR,{...u,...i,ref:l}):null});gA.displayName=rf;var vA="SelectBubbleInput",_b=y.forwardRef(({__scopeSelect:n,value:l,...o},i)=>{const u=y.useRef(null),d=Ie(i,u),m=ab(l);return y.useEffect(()=>{const h=u.current;if(!h)return;const g=window.HTMLSelectElement.prototype,x=Object.getOwnPropertyDescriptor(g,"value").set;if(m!==l&&x){const v=new Event("change",{bubbles:!0});x.call(h,l),h.dispatchEvent(v)}},[m,l]),f.jsx(Le.select,{...o,style:{...lb,...o.style},ref:d,defaultValue:l})});_b.displayName=vA;function jb(n){return n===""||n===void 0}function Mb(n){const l=Qa(n),o=y.useRef(""),i=y.useRef(0),u=y.useCallback(m=>{const h=o.current+m;l(h),(function g(p){o.current=p,window.clearTimeout(i.current),p!==""&&(i.current=window.setTimeout(()=>g(""),1e3))})(h)},[l]),d=y.useCallback(()=>{o.current="",window.clearTimeout(i.current)},[]);return y.useEffect(()=>()=>window.clearTimeout(i.current),[]),[o,u,d]}function Ob(n,l,o){const u=l.length>1&&Array.from(l).every(p=>p===l[0])?l[0]:l,d=o?n.indexOf(o):-1;let m=yA(n,Math.max(d,0));u.length===1&&(m=m.filter(p=>p!==o));const g=m.find(p=>p.textValue.toLowerCase().startsWith(u.toLowerCase()));return g!==o?g:void 0}function yA(n,l){return n.map((o,i)=>n[(l+i)%n.length])}var bA=rb,Db=ib,xA=cb,SA=ub,wA=db,kb=fb,EA=gb,zb=bb,Lb=Sb,NA=wb,CA=Nb,Ub=Cb,Bb=Tb,Hb=Ab;const Vb=bA,$b=xA,Gf=y.forwardRef(({className:n,children:l,...o},i)=>f.jsxs(Db,{ref:i,className:se("flex h-10 w-full items-center justify-between rounded-sm border border-input/85 bg-background/72 px-3 py-2 text-sm shadow-sm ring-offset-background transition-all duration-200 placeholder:text-muted-foreground focus:border-primary/45 focus:bg-background/90 focus:outline-none focus:ring-2 focus:ring-ring/45 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",n),...o,children:[l,f.jsx(SA,{asChild:!0,children:f.jsx(Zs,{className:"h-4 w-4 opacity-50"})})]}));Gf.displayName=Db.displayName;const Yb=y.forwardRef(({className:n,...l},o)=>f.jsx(Ub,{ref:o,className:se("flex cursor-default items-center justify-center py-1",n),...l,children:f.jsx(zE,{className:"h-4 w-4"})}));Yb.displayName=Ub.displayName;const qb=y.forwardRef(({className:n,...l},o)=>f.jsx(Bb,{ref:o,className:se("flex cursor-default items-center justify-center py-1",n),...l,children:f.jsx(Zs,{className:"h-4 w-4"})}));qb.displayName=Bb.displayName;const Xf=y.forwardRef(({className:n,children:l,position:o="popper",...i},u)=>f.jsx(wA,{children:f.jsxs(kb,{ref:u,className:se("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-lg border border-border/70 bg-popover/96 text-popover-foreground shadow-[0_20px_70px_-36px_rgba(0,0,0,0.45)] backdrop-blur-xl 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",o==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",n),position:o,...i,children:[f.jsx(Yb,{}),f.jsx(EA,{className:se("p-1",o==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:l}),f.jsx(qb,{})]})}));Xf.displayName=kb.displayName;const TA=y.forwardRef(({className:n,...l},o)=>f.jsx(zb,{ref:o,className:se("py-1.5 pl-8 pr-2 text-sm font-semibold",n),...l}));TA.displayName=zb.displayName;const Nr=y.forwardRef(({className:n,children:l,...o},i)=>f.jsxs(Lb,{ref:i,className:se("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent/80 focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n),...o,children:[f.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(CA,{children:f.jsx(_s,{className:"h-4 w-4"})})}),f.jsx(NA,{children:l})]}));Nr.displayName=Lb.displayName;const RA=y.forwardRef(({className:n,...l},o)=>f.jsx(Hb,{ref:o,className:se("-mx-1 my-1 h-px bg-muted",n),...l}));RA.displayName=Hb.displayName;var $d="rovingFocusGroup.onEntryFocus",AA={bubbles:!1,cancelable:!0},Zo="RovingFocusGroup",[of,Gb,_A]=Dy(Zo),[jA,Xb]=Fa(Zo,[_A]),[MA,OA]=jA(Zo),Pb=y.forwardRef((n,l)=>f.jsx(of.Provider,{scope:n.__scopeRovingFocusGroup,children:f.jsx(of.Slot,{scope:n.__scopeRovingFocusGroup,children:f.jsx(DA,{...n,ref:l})})}));Pb.displayName=Zo;var DA=y.forwardRef((n,l)=>{const{__scopeRovingFocusGroup:o,orientation:i,loop:u=!1,dir:d,currentTabStopId:m,defaultCurrentTabStopId:h,onCurrentTabStopIdChange:g,onEntryFocus:p,preventScrollOnEntryFocus:x=!1,...v}=n,w=y.useRef(null),E=Ie(l,w),C=kf(d),[N,T]=Ar({prop:m,defaultProp:h??null,onChange:g,caller:Zo}),[R,j]=y.useState(!1),O=Qa(p),z=Gb(o),X=y.useRef(!1),[K,V]=y.useState(0);return y.useEffect(()=>{const H=w.current;if(H)return H.addEventListener($d,O),()=>H.removeEventListener($d,O)},[O]),f.jsx(MA,{scope:o,orientation:i,dir:C,loop:u,currentTabStopId:N,onItemFocus:y.useCallback(H=>T(H),[T]),onItemShiftTab:y.useCallback(()=>j(!0),[]),onFocusableItemAdd:y.useCallback(()=>V(H=>H+1),[]),onFocusableItemRemove:y.useCallback(()=>V(H=>H-1),[]),children:f.jsx(Le.div,{tabIndex:R||K===0?-1:0,"data-orientation":i,...v,ref:E,style:{outline:"none",...n.style},onMouseDown:Me(n.onMouseDown,()=>{X.current=!0}),onFocus:Me(n.onFocus,H=>{const le=!X.current;if(H.target===H.currentTarget&&le&&!R){const ie=new CustomEvent($d,AA);if(H.currentTarget.dispatchEvent(ie),!ie.defaultPrevented){const me=z().filter(M=>M.focusable),fe=me.find(M=>M.active),ce=me.find(M=>M.id===N),re=[fe,ce,...me].filter(Boolean).map(M=>M.ref.current);Zb(re,x)}}X.current=!1}),onBlur:Me(n.onBlur,()=>j(!1))})})}),Qb="RovingFocusGroupItem",Kb=y.forwardRef((n,l)=>{const{__scopeRovingFocusGroup:o,focusable:i=!0,active:u=!1,tabStopId:d,children:m,...h}=n,g=Xa(),p=d||g,x=OA(Qb,o),v=x.currentTabStopId===p,w=Gb(o),{onFocusableItemAdd:E,onFocusableItemRemove:C,currentTabStopId:N}=x;return y.useEffect(()=>{if(i)return E(),()=>C()},[i,E,C]),f.jsx(of.ItemSlot,{scope:o,id:p,focusable:i,active:u,children:f.jsx(Le.span,{tabIndex:v?0:-1,"data-orientation":x.orientation,...h,ref:l,onMouseDown:Me(n.onMouseDown,T=>{i?x.onItemFocus(p):T.preventDefault()}),onFocus:Me(n.onFocus,()=>x.onItemFocus(p)),onKeyDown:Me(n.onKeyDown,T=>{if(T.key==="Tab"&&T.shiftKey){x.onItemShiftTab();return}if(T.target!==T.currentTarget)return;const R=LA(T,x.orientation,x.dir);if(R!==void 0){if(T.metaKey||T.ctrlKey||T.altKey||T.shiftKey)return;T.preventDefault();let O=w().filter(z=>z.focusable).map(z=>z.ref.current);if(R==="last")O.reverse();else if(R==="prev"||R==="next"){R==="prev"&&O.reverse();const z=O.indexOf(T.currentTarget);O=x.loop?UA(O,z+1):O.slice(z+1)}setTimeout(()=>Zb(O))}}),children:typeof m=="function"?m({isCurrentTabStop:v,hasTabStop:N!=null}):m})})});Kb.displayName=Qb;var kA={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function zA(n,l){return l!=="rtl"?n:n==="ArrowLeft"?"ArrowRight":n==="ArrowRight"?"ArrowLeft":n}function LA(n,l,o){const i=zA(n.key,o);if(!(l==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(l==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return kA[i]}function Zb(n,l=!1){const o=document.activeElement;for(const i of n)if(i===o||(i.focus({preventScroll:l}),document.activeElement!==o))return}function UA(n,l){return n.map((o,i)=>n[(l+i)%n.length])}var BA=Pb,HA=Kb,oc="Tabs",[VA]=Fa(oc,[Xb]),Ib=Xb(),[$A,Pf]=VA(oc),Fb=y.forwardRef((n,l)=>{const{__scopeTabs:o,value:i,onValueChange:u,defaultValue:d,orientation:m="horizontal",dir:h,activationMode:g="automatic",...p}=n,x=kf(h),[v,w]=Ar({prop:i,onChange:u,defaultProp:d??"",caller:oc});return f.jsx($A,{scope:o,baseId:Xa(),value:v,onValueChange:w,orientation:m,dir:x,activationMode:g,children:f.jsx(Le.div,{dir:x,"data-orientation":m,...p,ref:l})})});Fb.displayName=oc;var Jb="TabsList",Wb=y.forwardRef((n,l)=>{const{__scopeTabs:o,loop:i=!0,...u}=n,d=Pf(Jb,o),m=Ib(o);return f.jsx(BA,{asChild:!0,...m,orientation:d.orientation,dir:d.dir,loop:i,children:f.jsx(Le.div,{role:"tablist","aria-orientation":d.orientation,...u,ref:l})})});Wb.displayName=Jb;var ex="TabsTrigger",tx=y.forwardRef((n,l)=>{const{__scopeTabs:o,value:i,disabled:u=!1,...d}=n,m=Pf(ex,o),h=Ib(o),g=lx(m.baseId,i),p=rx(m.baseId,i),x=i===m.value;return f.jsx(HA,{asChild:!0,...h,focusable:!u,active:x,children:f.jsx(Le.button,{type:"button",role:"tab","aria-selected":x,"aria-controls":p,"data-state":x?"active":"inactive","data-disabled":u?"":void 0,disabled:u,id:g,...d,ref:l,onMouseDown:Me(n.onMouseDown,v=>{!u&&v.button===0&&v.ctrlKey===!1?m.onValueChange(i):v.preventDefault()}),onKeyDown:Me(n.onKeyDown,v=>{[" ","Enter"].includes(v.key)&&m.onValueChange(i)}),onFocus:Me(n.onFocus,()=>{const v=m.activationMode!=="manual";!x&&!u&&v&&m.onValueChange(i)})})})});tx.displayName=ex;var nx="TabsContent",ax=y.forwardRef((n,l)=>{const{__scopeTabs:o,value:i,forceMount:u,children:d,...m}=n,h=Pf(nx,o),g=lx(h.baseId,i),p=rx(h.baseId,i),x=i===h.value,v=y.useRef(x);return y.useEffect(()=>{const w=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(w)},[]),f.jsx(kr,{present:u||x,children:({present:w})=>f.jsx(Le.div,{"data-state":x?"active":"inactive","data-orientation":h.orientation,role:"tabpanel","aria-labelledby":g,hidden:!w,id:p,tabIndex:0,...m,ref:l,style:{...n.style,animationDuration:v.current?"0s":void 0},children:w&&d})})});ax.displayName=nx;function lx(n,l){return`${n}-trigger-${l}`}function rx(n,l){return`${n}-content-${l}`}var YA=Fb,ox=Wb,ix=tx,sx=ax;const qA=YA,cx=y.forwardRef(({className:n,...l},o)=>f.jsx(ox,{ref:o,className:se("inline-flex h-10 items-center justify-center rounded-lg bg-muted/72 p-1 text-muted-foreground shadow-inner shadow-background/40",n),...l}));cx.displayName=ox.displayName;const Ts=y.forwardRef(({className:n,...l},o)=>f.jsx(ix,{ref:o,className:se("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-semibold ring-offset-background transition-all duration-200 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-primary/12 data-[state=active]:text-primary data-[state=active]:shadow-[0_10px_28px_-18px_hsl(var(--primary)/0.85)] data-[state=active]:ring-1 data-[state=active]:ring-primary/22",n),...l}));Ts.displayName=ix.displayName;const Bs=y.forwardRef(({className:n,...l},o)=>f.jsx(sx,{ref:o,className:se("mt-2 ring-offset-background data-[state=inactive]:hidden focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",n),...l}));Bs.displayName=sx.displayName;var ux="AlertDialog",[GA]=Fa(ux,[cy]),ha=cy(),dx=n=>{const{__scopeAlertDialog:l,...o}=n,i=ha(l);return f.jsx(Cy,{...i,...o,modal:!0})};dx.displayName=ux;var XA="AlertDialogTrigger",fx=y.forwardRef((n,l)=>{const{__scopeAlertDialog:o,...i}=n,u=ha(o);return f.jsx(Ty,{...u,...i,ref:l})});fx.displayName=XA;var PA="AlertDialogPortal",mx=n=>{const{__scopeAlertDialog:l,...o}=n,i=ha(l);return f.jsx(Ry,{...i,...o})};mx.displayName=PA;var QA="AlertDialogOverlay",hx=y.forwardRef((n,l)=>{const{__scopeAlertDialog:o,...i}=n,u=ha(o);return f.jsx(jf,{...u,...i,ref:l})});hx.displayName=QA;var Rr="AlertDialogContent",[KA,ZA]=GA(Rr),IA=sT("AlertDialogContent"),px=y.forwardRef((n,l)=>{const{__scopeAlertDialog:o,children:i,...u}=n,d=ha(o),m=y.useRef(null),h=Ie(l,m),g=y.useRef(null);return f.jsx(N5,{contentName:Rr,titleName:gx,docsSlug:"alert-dialog",children:f.jsx(KA,{scope:o,cancelRef:g,children:f.jsxs(Mf,{role:"alertdialog",...d,...u,ref:h,onOpenAutoFocus:Me(u.onOpenAutoFocus,p=>{var x;p.preventDefault(),(x=g.current)==null||x.focus({preventScroll:!0})}),onPointerDownOutside:p=>p.preventDefault(),onInteractOutside:p=>p.preventDefault(),children:[f.jsx(IA,{children:i}),f.jsx(JA,{contentRef:m})]})})})});px.displayName=Rr;var gx="AlertDialogTitle",vx=y.forwardRef((n,l)=>{const{__scopeAlertDialog:o,...i}=n,u=ha(o);return f.jsx(Of,{...u,...i,ref:l})});vx.displayName=gx;var yx="AlertDialogDescription",bx=y.forwardRef((n,l)=>{const{__scopeAlertDialog:o,...i}=n,u=ha(o);return f.jsx(Df,{...u,...i,ref:l})});bx.displayName=yx;var FA="AlertDialogAction",xx=y.forwardRef((n,l)=>{const{__scopeAlertDialog:o,...i}=n,u=ha(o);return f.jsx(Js,{...u,...i,ref:l})});xx.displayName=FA;var Sx="AlertDialogCancel",wx=y.forwardRef((n,l)=>{const{__scopeAlertDialog:o,...i}=n,{cancelRef:u}=ZA(Sx,o),d=ha(o),m=Ie(l,u);return f.jsx(Js,{...d,...i,ref:m})});wx.displayName=Sx;var JA=({contentRef:n})=>{const l=`\`${Rr}\` requires a description for the component to be accessible for screen reader users.
316
316
 
317
317
  You can add a description to the \`${Rr}\` by passing a \`${yx}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
318
318
 
319
319
  Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Rr}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
320
320
 
321
- For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return y.useEffect(()=>{var i;document.getElementById((i=n.current)==null?void 0:i.getAttribute("aria-describedby"))||console.warn(l)},[l,n]),null},WA=dx,e_=fx,t_=mx,Ex=hx,Nx=px,Cx=xx,Tx=wx,Rx=vx,Ax=bx;const sf=WA,cf=e_,n_=t_,_x=y.forwardRef(({className:n,...l},o)=>f.jsx(Ex,{className:se("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}));_x.displayName=Ex.displayName;const Hs=y.forwardRef(({className:n,...l},o)=>f.jsxs(n_,{children:[f.jsx(_x,{}),f.jsx(Nx,{ref:o,className:se("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})]}));Hs.displayName=Nx.displayName;const Vs=({className:n,...l})=>f.jsx("div",{className:se("flex flex-col space-y-2 text-center sm:text-left",n),...l});Vs.displayName="AlertDialogHeader";const $s=({className:n,...l})=>f.jsx("div",{className:se("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...l});$s.displayName="AlertDialogFooter";const Ys=y.forwardRef(({className:n,...l},o)=>f.jsx(Rx,{ref:o,className:se("text-lg font-semibold",n),...l}));Ys.displayName=Rx.displayName;const qs=y.forwardRef(({className:n,...l},o)=>f.jsx(Ax,{ref:o,className:se("text-sm text-muted-foreground",n),...l}));qs.displayName=Ax.displayName;const Gs=y.forwardRef(({className:n,...l},o)=>f.jsx(Cx,{ref:o,className:se(wf(),n),...l}));Gs.displayName=Cx.displayName;const Xs=y.forwardRef(({className:n,...l},o)=>f.jsx(Tx,{ref:o,className:se(wf({variant:"outline"}),"mt-2 sm:mt-0",n),...l}));Xs.displayName=Tx.displayName;const a_={online:"bg-green-500",busy:"bg-yellow-500",offline:"bg-red-500"};function l_({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:se("relative inline-flex h-2.5 w-2.5 rounded-full",a_[n])})]})}function r_({role:n,size:l="default"}){return f.jsx(pt,{variant:n==="leader"?"default":"secondary",className:se(l==="compact"?"px-1.5 py-0 text-[9px] leading-4":"text-[11px]"),children:n})}const o_={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 Mj({status:n,size:l="default"}){const o=o_[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(pt,{variant:o.variant,className:se("rounded-sm font-medium shadow-none",i,o.className),children:[f.jsx("span",{className:se("rounded-full",o.dotClass)}),n]})}const i_={critical:{variant:"destructive",label:"Critical"},high:{variant:"outline",label:"High"},normal:{variant:"secondary",label:"Normal"},low:{variant:"secondary",label:"Low"}};function Oj({priority:n}){const l=i_[n];return f.jsx(pt,{variant:l.variant,className:"rounded-sm px-1.5 py-0 text-[10px] leading-4 shadow-none",children:l.label})}function s_(n){return[{key:"workspace",label:"Workspace",value:n==null?void 0:n.workspace},{key:"node",label:"Node app",value:n==null?void 0:n.node},{key:"core",label:"Core",value:n==null?void 0:n.core},{key:"dashboard",label:"Dashboard",value:n==null?void 0:n.dashboard},{key:"api",label:"API",value:n==null?void 0:n.api}].filter(o=>o.value)}function Sr({label:n,value:l,mono:o=!1}){return 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 c_({formatDateTime:n,viewInfo:l}){var i,u,d,m,h,g,p,x;const o=s_(l.packages);return f.jsxs(Bs,{value:"about","data-about-layout":"compact",className:"mt-0 space-y-2",children:[f.jsxs(Dn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(kn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(zn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(RE,{className:"h-3.5 w-3.5 text-primary"}),"Repository & runtime"]}),f.jsx(Ln,{className:"text-[10px]",children:"Build source and runtime identity for this node."})]}),f.jsxs(Un,{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(PE,{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(Sr,{label:"Branch",value:((u=l.repository)==null?void 0:u.branch)??"Unavailable",mono:!!((d=l.repository)!=null&&d.branch)}),f.jsx(Sr,{label:"Commit",value:((m=l.repository)==null?void 0:m.commit)??"Unavailable",mono:!!((h=l.repository)!=null&&h.commit)}),f.jsx(Sr,{label:"Runtime",value:`${l.packageName??"meshy"} ${l.version}`,mono:!0}),f.jsx(Sr,{label:"Node.js",value:((g=l.runtime)==null?void 0:g.nodeVersion)??"Unavailable",mono:!!((p=l.runtime)!=null&&p.nodeVersion)}),f.jsx(Sr,{label:"PID",value:l.runtime?String(l.runtime.pid):"Unavailable",mono:!!l.runtime}),f.jsx(Sr,{label:"Started",value:n((x=l.runtime)==null?void 0:x.startedAt)})]})]})]}),f.jsxs(Dn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(kn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(zn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(JE,{className:"h-3.5 w-3.5 text-primary"}),"Package versions"]}),f.jsx(Ln,{className:"text-[10px]",children:"Version snapshot for the packages most relevant to this dashboard session."})]}),f.jsx(Un,{"data-package-layout":"list",className:"space-y-1.5 px-3 pb-2.5",children:o.map(v=>{var w,E;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:v.label}),f.jsx("div",{className:"min-w-0 truncate text-[10px] text-muted-foreground",children:(w=v.value)==null?void 0:w.name}),f.jsx(pt,{variant:"outline",className:"w-fit rounded-sm border-border/70 bg-background/60 font-mono text-[10px]",children:(E=v.value)==null?void 0:E.version})]},v.key)})})]})]})}var ic="Checkbox",[u_]=Fa(ic),[d_,Qf]=u_(ic);function f_(n){const{__scopeCheckbox:l,checked:o,children:i,defaultChecked:u,disabled:d,form:m,name:h,onCheckedChange:g,required:p,value:x="on",internal_do_not_use_render:v}=n,[w,E]=Ar({prop:o,defaultProp:u??!1,onChange:g,caller:ic}),[C,N]=y.useState(null),[T,R]=y.useState(null),j=y.useRef(!1),O=C?!!m||!!C.closest("form"):!0,z={checked:w,disabled:d,setChecked:E,control:C,setControl:N,name:h,form:m,value:x,hasConsumerStoppedPropagationRef:j,required:p,defaultChecked:Pa(u)?!1:u,isFormControl:O,bubbleInput:T,setBubbleInput:R};return f.jsx(d_,{scope:l,...z,children:m_(v)?v(z):i})}var jx="CheckboxTrigger",Mx=y.forwardRef(({__scopeCheckbox:n,onKeyDown:l,onClick:o,...i},u)=>{const{control:d,value:m,disabled:h,checked:g,required:p,setControl:x,setChecked:v,hasConsumerStoppedPropagationRef:w,isFormControl:E,bubbleInput:C}=Qf(jx,n),N=Ie(u,x),T=y.useRef(g);return y.useEffect(()=>{const R=d==null?void 0:d.form;if(R){const j=()=>v(T.current);return R.addEventListener("reset",j),()=>R.removeEventListener("reset",j)}},[d,v]),f.jsx(Le.button,{type:"button",role:"checkbox","aria-checked":Pa(g)?"mixed":g,"aria-required":p,"data-state":Lx(g),"data-disabled":h?"":void 0,disabled:h,value:m,...i,ref:N,onKeyDown:Me(l,R=>{R.key==="Enter"&&R.preventDefault()}),onClick:Me(o,R=>{v(j=>Pa(j)?!0:!j),C&&E&&(w.current=R.isPropagationStopped(),w.current||R.stopPropagation())})})});Mx.displayName=jx;var Kf=y.forwardRef((n,l)=>{const{__scopeCheckbox:o,name:i,checked:u,defaultChecked:d,required:m,disabled:h,value:g,onCheckedChange:p,form:x,...v}=n;return f.jsx(f_,{__scopeCheckbox:o,checked:u,defaultChecked:d,disabled:h,required:m,onCheckedChange:p,name:i,form:x,value:g,internal_do_not_use_render:({isFormControl:w})=>f.jsxs(f.Fragment,{children:[f.jsx(Mx,{...v,ref:l,__scopeCheckbox:o}),w&&f.jsx(zx,{__scopeCheckbox:o})]})})});Kf.displayName=ic;var Ox="CheckboxIndicator",Dx=y.forwardRef((n,l)=>{const{__scopeCheckbox:o,forceMount:i,...u}=n,d=Qf(Ox,o);return f.jsx(kr,{present:i||Pa(d.checked)||d.checked===!0,children:f.jsx(Le.span,{"data-state":Lx(d.checked),"data-disabled":d.disabled?"":void 0,...u,ref:l,style:{pointerEvents:"none",...n.style}})})});Dx.displayName=Ox;var kx="CheckboxBubbleInput",zx=y.forwardRef(({__scopeCheckbox:n,...l},o)=>{const{control:i,hasConsumerStoppedPropagationRef:u,checked:d,defaultChecked:m,required:h,disabled:g,name:p,value:x,form:v,bubbleInput:w,setBubbleInput:E}=Qf(kx,n),C=Ie(o,E),N=ab(d),T=Py(i);y.useEffect(()=>{const j=w;if(!j)return;const O=window.HTMLInputElement.prototype,X=Object.getOwnPropertyDescriptor(O,"checked").set,K=!u.current;if(N!==d&&X){const V=new Event("click",{bubbles:K});j.indeterminate=Pa(d),X.call(j,Pa(d)?!1:d),j.dispatchEvent(V)}},[w,N,d,u]);const R=y.useRef(Pa(d)?!1:d);return f.jsx(Le.input,{type:"checkbox","aria-hidden":!0,defaultChecked:m??R.current,required:h,disabled:g,name:p,value:x,form:v,...l,tabIndex:-1,ref:C,style:{...l.style,...T,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});zx.displayName=kx;function m_(n){return typeof n=="function"}function Pa(n){return n==="indeterminate"}function Lx(n){return Pa(n)?"indeterminate":n?"checked":"unchecked"}const Ux=y.forwardRef(({className:n,...l},o)=>f.jsx(Kf,{ref:o,className:se("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(Dx,{className:se("flex items-center justify-center text-current"),children:f.jsx(_s,{className:"h-3.5 w-3.5"})})}));Ux.displayName=Kf.displayName;const Zf=y.forwardRef(({className:n,type:l,...o},i)=>f.jsx("input",{type:l,className:se("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}));Zf.displayName="Input";const Xv=["queued","running"];function h_(n){return n.map(l=>`${l.id}:${l.name}`).join("\0")}function p_(n){return n==="claude"||n==="codex"||n==="copilot"}function Bx(n){var o;if(n.kind!=="agent.upgrade")return null;const l=(o=n.payload)==null?void 0:o.agent;return p_(l)?`${n.nodeId}:${l}`:null}function g_(n){return n.status==="succeeded"||n.status==="failed"}async function Hx(n,l={}){const o=l.getOperation??Ww,i=l.pollIntervalMs??2e3,u=l.timeoutMs??24e4,d=Date.now()+u;let m=n;for(;!g_(m)&&Date.now()<d;)await y_(i),m=await o(n.id);return m}async function v_(n,l=eE){const o=new Set(n),i=await Promise.all(Xv.map(d=>l({kind:"agent.upgrade",status:d}))),u=new Map;for(const d of i.flat()){if(!Xv.includes(d.status)||o.size>0&&!o.has(d.nodeId))continue;const m=Bx(d);if(!m)continue;const h=u.get(m);(!h||d.updatedAt>h.updatedAt)&&u.set(m,d)}return u}function y_(n){return new Promise(l=>setTimeout(l,n))}const b_=1500,x_=1e3,S_=9e4;async function Vx(n={}){const l=n.fetchHealth??w_,o=n.initialDelayMs??b_,i=n.pollIntervalMs??x_,u=n.previousPid,d=n.reload??(()=>window.location.reload()),m=n.sleep??N_,h=n.timeoutMs??S_,g=Date.now()+h;let p=!1;for(o>0&&await m(o);Date.now()<=g;){const x=E_(await l());if(!x.ok){p=!0,await m(i);continue}if(u===void 0||x.pid!==void 0&&x.pid!==u||p)return d(),!0;await m(i)}return!1}async function w_(){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 E_(n){return typeof n=="boolean"?{ok:n}:n}function N_(n){return new Promise(l=>window.setTimeout(l,n))}function C_(n,l=!0){return l?(n==null?void 0:n.restartMode)==="development"?"Restart dev runtime":n!=null&&n.updateAvailable?"Restart to update":"Restart runtime":n!=null&&n.updateAvailable?"Restart follower to update":"Restart follower"}function T_({checkedLabel:n,disableAuthDefault:l,endpoint:o,isLiveLocalNode:i,nodeId:u,nodeName:d,onRefresh:m,pid:h,transportType:g,update:p,workDir:x}){const v=C_(p,i),[w,E]=y.useState(null),[C,N]=y.useState(()=>Pv({disableAuthDefault:l,endpoint:o,nodeName:d,transportType:g,workDir:x})),[T,R]=y.useState(!1),[j,O]=y.useState(!1),[z,X]=y.useState(!1);y.useEffect(()=>{N(Pv({disableAuthDefault:l,endpoint:o,nodeName:d,transportType:g,workDir:x}))},[l,o,d,g,x]);async function K(){if(!u||T||j)return;const ie=p.updateAvailable?"update":"restart",me=__(C);if(C.port.trim()&&(me==null?void 0:me.port)===void 0){at.error("Runtime restart port must be a positive integer");return}const fe=me?{reason:ie,startArgs:me}:{reason:ie};R(!0);try{if(i){const M=await b0(fe);E({...M,pid:M.pid??h,status:"accepted"}),at.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.`),Vx({previousPid:M.pid??h}).then($=>{$||(R(!1),at.error("Runtime restart was accepted, but the dashboard did not reconnect before the timeout. Refresh the page after the node finishes starting."))}).catch($=>{R(!1),at.error($ instanceof Error?$.message:"Runtime restart recovery failed")});return}const ce=await nE(u,fe);E({operationId:ce.id,pid:h,status:ce.status}),at.info(`Restart requested on ${d}. Operation ${Yd(ce.id)} will hand off to a detached process, so the new runtime will not stay attached to the original terminal window.`);const de=await Hx(ce,{timeoutMs:6e4}),re=A_(de);E({command:re==null?void 0:re.command,logPath:re==null?void 0:re.logPath,mode:re==null?void 0:re.mode,operationId:de.id,pid:(re==null?void 0:re.pid)??h,status:de.status}),de.status==="succeeded"?(await(m==null?void 0:m()),at.success(`Restart handoff accepted on ${d}. Follow ${(re==null?void 0:re.logPath)??"the node restart log"} for launch output.`)):de.status==="failed"?at.error(de.error??`Restart failed on ${d}`):at.info(`Restart operation ${Yd(de.id)} is still ${de.status}. More details will update after the node reports back.`),R(!1)}catch(ce){R(!1),at.error(ce instanceof Error?ce.message:"Runtime restart failed")}}async function V(){if(!(!i||T||j)){O(!0);try{const ie=await Fw();at.info(`Stopping Meshy process ${ie.pid}`)}catch(ie){O(!1),at.error(ie instanceof Error?ie.message:"Runtime stop failed")}}}const H=T?"restarting":j?"stopping":(w==null?void 0:w.status)??"idle",le=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(As,{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:le?"Development launcher":`Latest ${p.latestVersion??"—"}`})]})]}),f.jsx("div",{className:"flex items-center gap-1.5",children:f.jsx(pt,{variant:p.updateAvailable?"default":"outline",className:"rounded-full border-border/70 bg-background/60 font-mono text-[10px] px-2 py-0.5",children:le?"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:H})]})]}),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(sf,{children:[f.jsx(cf,{asChild:!0,children:f.jsxs(Sn,{type:"button",size:"sm",variant:"ghost",disabled:T||j,className:"h-7 rounded-lg px-2 text-[11px] text-muted-foreground hover:text-destructive hover:bg-destructive/10",children:[f.jsx(oN,{className:se("mr-1 h-3.5 w-3.5",j&&"animate-pulse")}),j?"Stopping":"Stop"]})}),f.jsxs(Hs,{className:"max-w-[22rem] rounded-xl gap-2 p-4",children:[f.jsxs(Vs,{className:"space-y-1",children:[f.jsx(Ys,{className:"text-sm",children:"Stop runtime?"}),f.jsx(qs,{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($s,{className:"gap-1 pt-0 sm:space-x-1",children:[f.jsx(Xs,{className:"h-7 rounded-lg px-2 text-[11px]",children:"Cancel"}),f.jsx(Gs,{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(sf,{children:[f.jsx(cf,{asChild:!0,children:f.jsxs(Sn,{type:"button",size:"sm",variant:p.updateAvailable?"default":"outline",disabled:!u||T||j,className:"h-7 rounded-lg px-2 text-[11px]",children:[f.jsx(uN,{className:se("mr-1 h-3.5 w-3.5",T&&"animate-spin")}),T?"Restarting…":v]})}),f.jsxs(Hs,{className:"max-w-[28rem] gap-3 rounded-xl p-4",children:[f.jsxs(Vs,{className:"space-y-1",children:[f.jsxs(Ys,{className:"text-sm",children:[v,"?"]}),f.jsxs(qs,{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(R_,{value:C,onChange:N}),f.jsxs($s,{className:"gap-1 pt-0 sm:space-x-1",children:[f.jsx(Xs,{className:"h-7 rounded-lg px-2 text-[11px]",children:"Cancel"}),f.jsx(Gs,{className:"h-7 rounded-lg px-2 text-[11px]",onClick:()=>void K(),children:v})]})]})]})]})]}),f.jsxs("div",{className:"border-t border-border/50",children:[f.jsxs("button",{type:"button",onClick:()=>X(ie=>!ie),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(A0,{className:"h-3 w-3"}),"Restart details"]}),f.jsx(Zs,{className:se("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(Nl,{label:"Current PID",value:h===void 0?"—":String(h),mono:h!==void 0}),f.jsx(Nl,{label:"Restart PID",value:(w==null?void 0:w.pid)===void 0?"Pending":String(w.pid),mono:(w==null?void 0:w.pid)!==void 0}),f.jsx(Nl,{label:"Operation",value:w!=null&&w.operationId?Yd(w.operationId):"Local direct request",mono:!!(w!=null&&w.operationId)}),f.jsx(Nl,{label:"Status",value:(w==null?void 0:w.status)??(T?"requested":"idle")}),f.jsx(Nl,{label:"Launcher",value:(w==null?void 0:w.command)??"Available after restart",mono:!!(w!=null&&w.command)}),f.jsx(Nl,{label:"Log",value:(w==null?void 0:w.logPath)??"Available after restart",mono:!!(w!=null&&w.logPath)}),f.jsx(Nl,{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 R_({onChange:n,value:l}){const o=(i,u)=>{n({...l,[i]:u})};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(Lo,{label:"HTTP port",value:l.port,onChange:i=>o("port",i),inputMode:"numeric"}),f.jsx(Lo,{label:"Node name",value:l.name,onChange:i=>o("name",i)}),f.jsx(Lo,{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(Vb,{value:l.transport,onValueChange:i=>o("transport",$x(i)),children:[f.jsx(Gf,{className:"h-7 rounded-md border-border/70 bg-background/70 px-2 text-[10px]",children:f.jsx($b,{placeholder:"Transport"})}),f.jsxs(Xf,{children:[f.jsx(Nr,{className:"py-1 text-[11px]",value:"inherit",children:"current / default"}),f.jsx(Nr,{className:"py-1 text-[11px]",value:"direct",children:"direct"}),f.jsx(Nr,{className:"py-1 text-[11px]",value:"devtunnel",children:"devtunnel"}),f.jsx(Nr,{className:"py-1 text-[11px]",value:"tailscale",children:"tailscale"})]})]})]}),f.jsx(Lo,{label:"Working directory",value:l.workDir,onChange:i=>o("workDir",i)}),f.jsx(Lo,{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(Ux,{className:"h-3.5 w-3.5",checked:l.disableAuth,onCheckedChange:i=>n({...l,disableAuth:i===!0,disableAuthKnown:!0})}),"Disable auth"]})]})]})}function Lo({className:n,inputMode:l,label:o,onChange:i,value:u}){return f.jsxs("label",{className:se("space-y-1",n),children:[f.jsx("span",{className:"text-[9px] uppercase tracking-[0.14em] text-muted-foreground",children:o}),f.jsx(Zf,{className:"h-7 rounded-md px-2 text-[10px]",inputMode:l,value:u,onChange:d=>i(d.target.value)})]})}function Nl({label:n,value:l,mono:o=!1}){return 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:se("break-all text-right text-foreground",o&&"font-mono"),children:l})]})}function A_(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 Pv(n){return{port:j_(n.endpoint),name:n.nodeName,join:"",transport:$x(n.transportType),workDir:n.workDir??"",config:"",disableAuth:n.disableAuthDefault===!0,disableAuthKnown:n.disableAuthDefault!==void 0}}function __(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 $x(n){return n==="direct"||n==="devtunnel"||n==="tailscale"?n:"inherit"}function j_(n){if(!n)return"";try{return new URL(n).port||""}catch{return""}}function Yd(n){return n.length<=8?n:n.slice(0,8)}function Uo({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(pt,{variant:o.authenticated?"default":"outline",className:"rounded-full text-[10px] uppercase tracking-[0.14em]",children:o.authenticated?"auth ok":"auth required"}),f.jsx(pt,{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 Gt(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 M_(n){const l=Math.max(0,Math.floor(n)),o=Math.floor(l/86400),i=Math.floor(l%86400/3600),u=Math.floor(l%3600/60);return o>0?`${o}d ${i}h`:i>0?`${i}h ${u}m`:`${u}m`}function Qv(n){if(n==null||Number.isNaN(n))return"Unavailable";const l=["B","KB","MB","GB","TB"];let o=n,i=0;for(;o>=1024&&i<l.length-1;)o/=1024,i+=1;return`${o.toFixed(o>=10||i===0?0:1)} ${l[i]}`}function Er(n){return n==="ok"?"default":n==="missing"||n==="install-failed"||n==="login-failed"?"destructive":n==="not-authenticated"||n==="unsupported-platform"?"outline":"secondary"}function O_(n){return n.available?f.jsxs(pt,{className:"gap-1 rounded-full px-2 py-0.5 text-[10px]",children:[f.jsx(Ho,{className:"h-3 w-3"}),"Available"]}):f.jsxs(pt,{variant:"destructive",className:"gap-1 rounded-full px-2 py-0.5 text-[10px]",children:[f.jsx(VE,{className:"h-3 w-3"}),"Unavailable"]})}function D_(n){return n.update?n.update.updateAvailable?f.jsxs(pt,{variant:"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:["Update ",n.update.latestVersion]}):f.jsx(pt,{variant:"secondary",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:"Up to date"}):null}function k_(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 z_(n){if(n.error)return n.error;const l=n.result;return(l==null?void 0:l.detail)??null}function Ze({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:se("break-all text-right text-[11px] text-foreground",o&&"font-mono text-[11px]"),children:l})]})}function Bo({label:n,value:l,mono:o=!1,className:i}){return f.jsxs("div",{className:se("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:se("truncate text-[11px] text-foreground",o&&"font-mono",n==="Path"&&"break-all whitespace-normal"),children:l})]})}function L_({agent:n,nodeName:l,activeOperation:o,onUpgrade:i}){var h,g;const u=((h=n.update)==null?void 0:h.updateAvailable)===!0,d=D_(n),m=!!o;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(E0,{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:[O_(n),n.metadataStatus&&f.jsx(pt,{variant:Er(n.metadataStatus),className:"rounded-full px-2 py-0 text-[10px] uppercase tracking-[0.14em]",children:n.metadataStatus})]})]}),f.jsxs("div",{className:"grid min-w-0 gap-x-4 gap-y-1.5 sm:grid-cols-2",children:[f.jsx(Bo,{label:"Version",value:n.version??"Unavailable",mono:!!n.version}),n.update&&f.jsx(Bo,{label:"Latest",value:n.update.latestVersion??"Unavailable",mono:!!n.update.latestVersion}),f.jsx(Bo,{label:"Checked",value:Gt(n.checkedAt)}),n.update&&f.jsx(Bo,{label:"Update check",value:Gt(n.update.checkedAt)}),f.jsx(Bo,{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(pt,{variant:"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:["Upgrade ",o.status]}):u?f.jsxs(sf,{children:[f.jsx(cf,{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(Hs,{children:[f.jsxs(Vs,{children:[f.jsxs(Ys,{children:["Upgrade ",n.label,"?"]}),f.jsxs(qs,{children:["This runs ",k_(n)," on ",l,". Remote nodes execute the command on the remote machine."]})]}),f.jsxs($s,{children:[f.jsx(Xs,{children:"Cancel"}),f.jsx(Gs,{onClick:()=>i(n),children:"Upgrade"})]})]})]}):d})]}),((g=n.update)==null?void 0:g.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 U_(n,l){var o;return(o=n==null?void 0:n.nodes)!=null&&o.length?n.nodes:l?[l]:[]}function B_(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 H_(n,l){return n.id===l?`${n.name} (this node)`:`${n.name} (${n.role})`}function V_(n){return n==="claude"?"Claude Code":n==="copilot"?"Copilot CLI":"Codex"}function $_(n){var o;const l=(o=n.payload)==null?void 0:o.agent;return l==="claude"||l==="codex"||l==="copilot"?l:null}function Y_({cluster:n,systemInfo:l,sseConnected:o,initialSelectedNodeId:i,onRefresh:u}){var le,ie,me,fe,ce,de,re,M,$,F,J,G,A,Y,Q,W,te,oe,ne,ue;const d=y.useMemo(()=>U_(n,l),[n,l]),[m,h]=y.useState(()=>{var ee;return i??(l==null?void 0:l.nodeId)??((ee=n==null?void 0:n.self)==null?void 0:ee.id)??""}),[g,p]=y.useState(()=>new Map),x=y.useRef(new Set),v=y.useRef(new Set),w=(n==null?void 0:n.self)??l??d[0]??null,E=d.find(ee=>ee.id===m)??w,C=E?B_(E,l):null,N=!!(l&&E&&E.id===l.nodeId),T=N||!!(E!=null&&E.settingsSnapshot),R=C==null?void 0:C.runtimeUpdate,j=((le=C==null?void 0:C.startupRequirements)==null?void 0:le.components)??(C==null?void 0:C.components)??{},O=y.useMemo(()=>d.map(ee=>ee.id),[d]),z=O.join("\0"),X=h_(d),K=y.useMemo(()=>new Map(d.map(ee=>[ee.id,ee.name])),[X]);y.useEffect(()=>{i&&O.includes(i)&&h(i)},[i,z]);const V=y.useCallback(async(ee,xe)=>{const ye=Bx(ee);if(!ye||x.current.has(ee.id))return;const Se=$_(ee),$e=(xe==null?void 0:xe.agentLabel)??(Se?V_(Se):"Agent"),Ue=(xe==null?void 0:xe.nodeName)??K.get(ee.nodeId)??ee.nodeId;x.current.add(ee.id),p(Ye=>new Map(Ye).set(ye,ee));try{const Ye=await Hx(ee);if(Ye.status==="succeeded")await(u==null?void 0:u()),v.current.has(Ye.id)||(at.success(`${$e} upgrade finished on ${Ue}`),v.current.add(Ye.id));else if(Ye.status==="failed")v.current.has(Ye.id)||(at.error(z_(Ye)??`${$e} upgrade failed`),v.current.add(Ye.id));else{p(gt=>new Map(gt).set(ye,Ye)),at.info(`${$e} upgrade is still ${Ye.status} on ${Ue}`);return}p(gt=>{const ot=new Map(gt),Pt=ot.get(ye);return(!Pt||Pt.id===Ye.id)&&ot.delete(ye),ot})}catch(Ye){p(gt=>{const ot=new Map(gt),Pt=ot.get(ye);return(!Pt||Pt.id===ee.id)&&ot.delete(ye),ot}),at.error(Ye instanceof Error?Ye.message:`${$e} upgrade failed`)}finally{x.current.delete(ee.id)}},[u,K]);y.useEffect(()=>{if(O.length===0)return;let ee=!1;async function xe(){let ye;try{ye=await v_(O)}catch{return}if(!ee){p(Se=>{const $e=new Map(Se);for(const[Ue,Ye]of ye)$e.set(Ue,Ye);return $e});for(const Se of ye.values())V(Se)}}return xe(),()=>{ee=!0}},[V,z]);async function H(ee){if(E)try{const xe=await tE(E.id,ee.id);at.info(`${ee.label} upgrade started on ${E.name}`),await V(xe,{agentLabel:ee.label,nodeName:E.name})}catch(xe){at.error(xe instanceof Error?xe.message:`${ee.label} upgrade failed`)}}return!E||!C?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:[!N&&f.jsxs(pt,{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 ",Gt((ie=E.settingsSnapshot)==null?void 0:ie.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(l_,{status:E.status}),f.jsx("span",{className:"font-medium text-foreground",children:E.name})]}),f.jsx(r_,{role:E.role}),f.jsx(pt,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:E.transportType??C.transportType??"direct"}),f.jsx(pt,{variant:N?"default":"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:N?"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(Vb,{value:E.id,onValueChange:h,children:[f.jsx(Gf,{className:"h-7 rounded-lg border-border/70 bg-background/70 text-[11px]",children:f.jsx($b,{placeholder:"Choose a node"})}),f.jsx(Xf,{className:"settings-node-select-content rounded-lg text-[10px] leading-4",children:d.map(ee=>f.jsx(Nr,{value:ee.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:H_(ee,l==null?void 0:l.nodeId)},ee.id))})]})]})]}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsxs(pt,{variant:o?"default":"outline",className:"gap-1 rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:[f.jsx(sN,{className:"h-3 w-3"}),o?"Live link":"Reconnecting"]}),f.jsxs(pt,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:["Uptime ",M_(C.uptime)]})]})]})]}),!T&&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(qA,{defaultValue:"session",className:"space-y-2",children:[f.jsxs(cx,{className:"h-auto flex-wrap rounded-xl border border-border/60 bg-muted/40 p-0.5",children:[f.jsx(Ts,{value:"session",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"Session"}),f.jsx(Ts,{value:"access",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"Access"}),f.jsx(Ts,{value:"about",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"About"})]}),f.jsxs(Bs,{value:"session",className:"mt-0 grid gap-2 xl:grid-cols-[1.15fr_0.85fr]",children:[f.jsxs(Dn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(kn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(zn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(T0,{className:"h-3.5 w-3.5 text-primary"}),"Selected node"]}),f.jsx(Ln,{className:"text-[10px]",children:"Cluster role, identity, and node-scoped runtime state."})]}),f.jsxs(Un,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(Ze,{label:"Node ID",value:C.nodeId,mono:!0}),f.jsx(Ze,{label:"Status",value:E.status}),f.jsx(Ze,{label:"Role",value:E.role}),f.jsx(Ze,{label:"Endpoint",value:E.endpoint,mono:!0}),f.jsx(Ze,{label:"Joined",value:Gt(E.joinedAt)}),f.jsx(Ze,{label:"Heartbeat",value:Gt(E.lastHeartbeat)}),f.jsx(Ze,{label:"Capabilities",value:E.capabilities.length>0?E.capabilities.join(", "):"None"})]})]}),f.jsxs(Dn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(kn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(zn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(GE,{className:"h-3.5 w-3.5 text-primary"}),"OS info"]}),f.jsx(Ln,{className:"text-[10px]",children:"Host and resource details reported by the current process."})]}),f.jsxs(Un,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(Ze,{label:"Host",value:((me=C.os)==null?void 0:me.hostname)??"Unavailable"}),f.jsx(Ze,{label:"Platform",value:C.os?`${C.os.platform} ${C.os.release}`:"Unavailable"}),f.jsx(Ze,{label:"Arch",value:((fe=C.os)==null?void 0:fe.arch)??"Unavailable"}),f.jsx(Ze,{label:"CPU",value:((ce=C.os)==null?void 0:ce.cpuModel)??"Unavailable"}),f.jsx(Ze,{label:"Cores",value:String(((de=C.os)==null?void 0:de.cpuCount)??"Unavailable")}),f.jsx(Ze,{label:"Memory",value:C.os?`${Qv(C.os.freeMemoryBytes)} free / ${Qv(C.os.totalMemoryBytes)} total`:"Unavailable"})]})]}),R&&f.jsx("div",{className:"xl:col-span-2",children:f.jsx(T_,{checkedLabel:Gt(R.checkedAt),disableAuthDefault:((re=C.auth)==null?void 0:re.enabled)===void 0?void 0:C.auth.enabled===!1,endpoint:E.endpoint,isLiveLocalNode:N,nodeId:E.id,nodeName:E.name,onRefresh:u,pid:(M=C.runtime)==null?void 0:M.pid,transportType:E.transportType,update:R,workDir:(($=C.runtime)==null?void 0:$.workDir)??E.workDir})}),f.jsxs(Dn,{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(kn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(zn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(E0,{className:"h-3.5 w-3.5 text-primary"}),"Available agents"]}),f.jsx(Ln,{className:"text-[10px]",children:N?"Live command availability for runtime agents on this node.":"Most recent agent availability snapshot synced from this node."})]}),f.jsx(Un,{"data-agent-layout":"list",className:"space-y-1.5 px-3 pb-2.5",children:(C.agents??[]).map(ee=>f.jsx(L_,{agent:ee,nodeName:E.name,activeOperation:g.get(`${E.id}:${ee.id}`),onUpgrade:H},ee.id))})]})]}),f.jsxs(Bs,{value:"access",className:"mt-0 grid gap-2 xl:grid-cols-2",children:[f.jsxs(Dn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(kn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(zn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(jE,{className:"h-3.5 w-3.5 text-primary"}),"Access surface"]}),f.jsx(Ln,{className:"text-[10px]",children:"How this node is exposed to the dashboard and other peers."})]}),f.jsxs(Un,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(Ze,{label:"Transport",value:E.transportType??C.transportType??"direct"}),f.jsx(Ze,{label:"Node URL",value:E.endpoint,mono:!0}),f.jsx(Ze,{label:"Node tunnel",value:E.devtunnelEndpoint??"Disabled",mono:!!E.devtunnelEndpoint}),f.jsx(Ze,{label:"Dashboard URL",value:E.dashboardOrigin??C.localDashboardOrigin??"Unavailable",mono:!!(E.dashboardOrigin||C.localDashboardOrigin)}),f.jsx(Ze,{label:"Local dashboard",value:C.localDashboardOrigin??"Unavailable",mono:!!C.localDashboardOrigin})]})]}),f.jsxs(Dn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(kn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(zn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(bN,{className:"h-3.5 w-3.5 text-primary"}),"Auth"]}),f.jsx(Ln,{className:"text-[10px]",children:"Current bearer-auth and trusted access posture."})]}),f.jsxs(Un,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(Ze,{label:"Enabled",value:(F=C.auth)!=null&&F.enabled?"Yes":"No"}),f.jsx(Ze,{label:"Same tenant",value:(J=C.auth)!=null&&J.allowSameTenant?"Allowed":"Off"}),f.jsx(Ze,{label:"Allowed users",value:(G=C.auth)!=null&&G.allowedUsers.length?C.auth.allowedUsers.join(", "):"None"})]})]}),f.jsxs(Dn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(kn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(zn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(KE,{className:"h-3.5 w-3.5 text-primary"}),"Paths"]}),f.jsx(Ln,{className:"text-[10px]",children:"Workspace and runtime paths currently used by this node."})]}),f.jsxs(Un,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(Ze,{label:"Work dir",value:((A=C.runtime)==null?void 0:A.workDir)??C.workDir??"Unavailable",mono:!!(((Y=C.runtime)==null?void 0:Y.workDir)??C.workDir)}),f.jsx(Ze,{label:"Storage",value:((Q=C.runtime)==null?void 0:Q.storagePath)??"Unavailable",mono:!!((W=C.runtime)!=null&&W.storagePath)}),f.jsx(Ze,{label:"Process cwd",value:((te=C.runtime)==null?void 0:te.cwd)??"Unavailable",mono:!!((oe=C.runtime)!=null&&oe.cwd)}),f.jsx(Ze,{label:"Started",value:Gt((ne=C.runtime)==null?void 0:ne.startedAt)}),f.jsx(Ze,{label:"PID",value:C.runtime?String(C.runtime.pid):"Unavailable",mono:!!C.runtime})]})]}),f.jsxs(Dn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(kn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(zn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(As,{className:"h-3.5 w-3.5 text-primary"}),"Startup checks"]}),f.jsx(Ln,{className:"text-[10px]",children:"Dependency preflight snapshot persisted during node startup."})]}),f.jsxs(Un,{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:Gt((ue=C.startupRequirements)==null?void 0:ue.lastCheckedAt)})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(Uo,{formatDateTime:Gt,name:"Azure CLI",status:j.az,statusVariant:Er}),f.jsx(Uo,{formatDateTime:Gt,name:"DevTunnel",status:j.devtunnel,statusVariant:Er}),f.jsx(Uo,{formatDateTime:Gt,name:"Claude Code",status:j.claude,statusVariant:Er}),f.jsx(Uo,{formatDateTime:Gt,name:"Codex",status:j.codex,statusVariant:Er}),f.jsx(Uo,{formatDateTime:Gt,name:"Copilot CLI",status:j.copilot,statusVariant:Er})]})]})]})]}),f.jsx(c_,{formatDateTime:Gt,viewInfo:C})]})]})}function q_({initialSelectedNodeId:n,open:l,onOpenChange:o,showTrigger:i=!0}={}){const{cluster:u,systemInfo:d,sseConnected:m,refresh:h}=S0();return f.jsx(O5,{open:l,onOpenChange:o,showTrigger:i,children:f.jsx(Y_,{cluster:u,systemInfo:d,sseConnected:m,initialSelectedNodeId:n,onRefresh:h})})}const Dj="bypass",G_=[{value:"claudecode",label:"Claude Code",supportsFollowUp:!0},{value:"codex",label:"Codex",supportsFollowUp:!0},{value:"copilot",label:"Copilot",supportsFollowUp:!0},{value:"mars",label:"mars",disabled:!0,description:"coming soon"},{value:"eureka",label:"eureka",disabled:!0,description:"coming soon"}],kj=[{value:"bypass",label:"Bypass"},{value:"plan",label:"Plan"},{value:"edit",label:"Edit"},{value:"dangerous",label:"Dangerous"}],zj=new Set(G_.filter(n=>n.supportsFollowUp).map(n=>n.value)),Lj=[{value:"active",label:"Active"},{value:"running",label:"Running"},{value:"waiting",label:"Waiting"},{value:"closed",label:"Closed"},{value:"shared",label:"Shared"},{value:"archived",label:"Archived"}],Uj=[{value:"all",label:"All task types"},{value:"native",label:"Native sessions"},{value:"meshy",label:"Meshy chats"}],X_=new Set(["pending","assigned"]),P_=new Set(["running"]),Q_=new Set(["completed","failed","cancelled"]);function Bj(n,l){switch(l){case"running":return P_.has(n.status);case"waiting":return X_.has(n.status);case"closed":return Q_.has(n.status);case"shared":return!!n.activeShare;case"archived":return n.status==="archived";case"active":default:return n.status!=="archived"}}function Hj(n,l){if(l==="all")return!0;const o=n.conversationKind==="nativeSession";return l==="native"?o:!o}function Vj(n,l){const o=l.trim().toLowerCase();return o?[n.title,n.description,n.id,n.agent,n.assignedTo??"",n.assignedNodeName??"",n.project??"",n.effectiveProjectPath??"",n.conversationKind==="nativeSession"?"native session":"meshy chat",n.activeShare?"shared conversation":""].some(i=>i.toLowerCase().includes(o)):!0}function K_(n,l,o){if(!n)return"unassigned";const i=l==null?void 0:l.find(u=>u.id===n);return(i==null?void 0:i.name)??o??n.slice(0,8)}function $j(n,l,o){return K_(n,l,o).toLowerCase()}function Yj(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 qj(n,l){return[...n].sort((o,i)=>o.id===l?-1:i.id===l?1:o.name.localeCompare(i.name))}function Gj(n){if(!n||typeof n!="object")return null;const l=n,o=l.createMode,i=o==="chat"||o==="native"?o:void 0;return{draftNewTask:l.draftNewTask===!0,returnRoute:typeof l.returnRoute=="string"?l.returnRoute:void 0,returnTaskId:typeof l.returnTaskId=="string"||l.returnTaskId===null?l.returnTaskId:void 0,createMode:i}}function Xj(n){switch(n){case"running":return"bg-amber-500";case"completed":return"bg-emerald-500";case"failed":return"bg-destructive";case"cancelled":case"archived":return"bg-slate-400";case"assigned":return"bg-teal-500";case"pending":default:return"bg-muted-foreground"}}function Pj(n){return n==="default workspace"?n:n.replace(/\\/g,"/").split("/").filter(Boolean).at(-1)??n}function Qj(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 Kj(n){return new Date(n).toLocaleString()}function Zj(n){const l=Math.floor(n/1e3),o=Math.floor(l/3600),i=Math.floor(l%3600/60),u=l%60;return`${String(o).padStart(2,"0")}:${String(i).padStart(2,"0")}:${String(u).padStart(2,"0")}`}async function Z_(n,l="Copied to clipboard"){var o,i,u;try{if((i=(o=globalThis.navigator)==null?void 0:o.clipboard)!=null&&i.writeText)return await globalThis.navigator.clipboard.writeText(n),at.success(l),!0;const d=globalThis.document,m=(u=d==null?void 0:d.execCommand)==null?void 0:u.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"),g=d.activeElement,p=g&&typeof g.focus=="function"?g: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 at.success(l),!0}catch(d){return at.error(d instanceof Error?d.message:"Failed to copy"),!1}}function Ij(n,l,o){const i=new Map;for(const d of n){const m=d.assignedTo??null,h=m??"__unassigned__",g=m?l.get(m)??d.assignedNodeName??m.slice(0,8):"Unassigned",p=d.effectiveProjectPath??d.project??"default workspace";i.has(h)||i.set(h,{nodeId:m,nodeName:g,dirMap:new Map});const x=i.get(h);x.dirMap.has(p)||x.dirMap.set(p,[]),x.dirMap.get(p).push(d)}const u=Array.from(i.values()).map(({nodeId:d,nodeName:m,dirMap:h})=>{const g=Array.from(h.entries()).map(([p,x])=>({path:p,tasks:x})).sort((p,x)=>x.tasks.length-p.tasks.length||p.path.localeCompare(x.path));return{nodeId:d,nodeName:m,dirs:g}});return u.sort((d,m)=>{if(o){if(d.nodeId===o)return-1;if(m.nodeId===o)return 1}return d.nodeId===null?1:m.nodeId===null?-1:d.nodeName.localeCompare(m.nodeName)}),u}const I_={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"},F_={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 J_(n){return n.split(".")[0]??"unknown"}function W_(n){return new Date(n).toLocaleTimeString("en-US",{hour12:!1})}function wr(n,l){return(l==null?void 0:l.get(n))??n}function Yx(n,l){const o=n.data,i=o.operation;switch(n.type){case"node.joined":return`${o.name} joined the cluster`;case"node.left":return`${wr(o.nodeId,l)} left (${o.reason})`;case"node.status":return`${wr(o.nodeId,l)} is now ${o.status}`;case"node.operation.created":return`${i==null?void 0:i.kind} ${i==null?void 0:i.status} on ${wr(i==null?void 0:i.nodeId,l)}`;case"node.operation.updated":return`${i==null?void 0:i.kind} ${i==null?void 0:i.status} on ${wr(i==null?void 0:i.nodeId,l)}`;case"transport.changed":return`${wr(o.nodeId,l)} transport switched to ${o.transportType}`;case"task.created":return`"${o.title}" created`;case"task.assigned":return`task assigned to ${wr(o.nodeId,l)}`;case"task.status":return`task ${o.taskId.slice(0,8)} -> ${o.status}`;case"election.started":return`candidate ${o.candidateId.slice(0,8)} term ${o.term}`;case"election.complete":return`leader elected, term ${o.term}`;case"cluster.state":return`${o.nodeCount} nodes, term ${o.term}`;default:return JSON.stringify(o)}}function e3(n){return JSON.stringify(n,null,2)}function t3({events:n,maxHeight:l="400px",nodeNameById:o,onDismiss:i,density:u="default"}){if(n.length===0)return null;const d=u==="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=J_(m.type);return f.jsx("div",{className:se("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:se("font-mono text-muted-foreground",d?"text-[8px]":"text-[9px]"),children:W_(m.timestamp)}),d?f.jsx("span",{className:se("max-w-[8.5rem] truncate text-[7px] font-medium uppercase tracking-[0.08em] text-muted-foreground/70",F_[h]),children:m.type}):f.jsx(pt,{variant:"outline",className:se("w-fit text-[9px] font-medium uppercase tracking-[0.14em] px-1.5 py-0",I_[h]),children:m.type})]}),f.jsxs("div",{className:se("flex shrink-0 items-center",d?"gap-px":"gap-0.5"),children:[f.jsx(Sn,{type:"button",variant:"ghost",size:"icon",className:se("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 Z_(e3(m),"Event copied"),"aria-label":`Copy ${m.type} event`,title:"Copy event",children:f.jsx(YE,{className:d?"h-2.5 w-2.5":"h-3 w-3"})}),i&&f.jsx(Sn,{type:"button",variant:"ghost",size:"icon",className:se("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(_0,{className:d?"h-2.5 w-2.5":"h-3 w-3"})})]})]}),f.jsx("div",{className:"text-[9px] leading-snug text-foreground/85",children:Yx(m,o)})]})},m.id)})})})}const n3=["node.","election.","transport."],a3="cluster.state";function l3(n){return n.type==="node.status"?!1:n3.some(l=>n.type.startsWith(l))}function r3(n){return new Date(n).toLocaleTimeString("en-US",{hour12:!1})}function o3(n,l){return n?{time:r3(n.timestamp),text:Yx(n,l)}:null}function i3(n){return n.transportType==="devtunnel"||!!n.devtunnelEndpoint}function s3(n){if(n.length===0)return"No node tunnel";const l=n.filter(u=>u.status==="offline").length;if(l>0)return`${l} offline`;const o=n.filter(u=>{var d;return((d=u.devtunnelHealth)==null?void 0:d.status)==="failed"}).length;if(o>0)return`${o} failed`;const i=n.filter(u=>{var d;return u.status!=="offline"&&((d=u.devtunnelHealth)==null?void 0:d.status)!=="healthy"}).length;return i>0?`${i} checking`:"Healthy"}function c3(n,l){var u;const o=(l==null?void 0:l.get(n.id))??n.name??n.id;if(n.status==="offline")return{label:o,status:"offline"};const i=((u=n.devtunnelHealth)==null?void 0:u.status)??"checking";return{label:o,status:i}}function u3(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 d3(n,l){return{label:(l==null?void 0:l.get(n.id))??n.name??n.id,status:n.status}}function f3({connected:n,events:l,nodes:o=[],currentNode:i=null,nodeNameById:u,defaultOpen:d=!1,onRestart:m}){const[h,g]=y.useState(d),[p,x]=y.useState(!0),[v,w]=y.useState(new Set),[E,C]=y.useState(!1),N=y.useRef(null),T=y.useRef(null),R=y.useMemo(()=>l.filter(J=>l3(J)&&!v.has(J.id)),[l,v]),j=y.useMemo(()=>l.find(J=>J.type===a3)??R[0],[l,R]),O=y.useMemo(()=>o3(j,u),[j,u]),z=y.useMemo(()=>{const J=new Map(o.map(G=>[G.id,G]));return i&&J.set(i.id,i),Array.from(J.values())},[i,o]),X=y.useMemo(()=>z.filter(i3),[z]),K=X.some(J=>{var G;return J.status==="offline"||((G=J.devtunnelHealth)==null?void 0:G.status)==="failed"}),V=z.some(J=>J.status==="offline"),H=z.some(J=>J.status==="busy"),le=z.length>0,ie=(i==null?void 0:i.name)??"offline",me=(i==null?void 0:i.role)==="leader"?"Leader":(i==null?void 0:i.role)==="follower"?"Follower":"Node",fe=E?"Relaunching runtime...":"Relaunch to apply update";function ce(){T.current&&(clearTimeout(T.current),T.current=null)}function de(){ce(),g(!0)}function re(){ce(),T.current=setTimeout(()=>{g(!1),T.current=null},180)}function M(){ce()}function $(){ce(),g(!1)}async function F(){if(!(!m||E)){C(!0);try{await m()}finally{C(!1)}}}return y.useEffect(()=>()=>{ce()},[]),y.useEffect(()=>{w(J=>{if(J.size===0)return J;const G=new Set(l.map(Y=>Y.id)),A=new Set(Array.from(J).filter(Y=>G.has(Y)));return A.size===J.size?J:A})},[l]),y.useEffect(()=>{if(!h)return;const J=A=>{var Y;(Y=N.current)!=null&&Y.contains(A.target)||(ce(),g(!1))},G=A=>{A.key==="Escape"&&(ce(),g(!1))};return document.addEventListener("pointerdown",J),document.addEventListener("keydown",G),()=>{document.removeEventListener("pointerdown",J),document.removeEventListener("keydown",G)}},[h]),f.jsxs("div",{ref:N,className:"relative",children:[f.jsxs("button",{type:"button","aria-label":n?"Cluster link connected":"Cluster link reconnecting","aria-expanded":h,"aria-haspopup":"dialog",onClick:()=>g(J=>!J),onMouseEnter:de,onMouseLeave:re,className:se("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",h&&(n?"bg-muted/60 text-foreground":"bg-destructive/12")),title:n?"Cluster link connected":"Cluster link reconnecting",children:[f.jsxs("span",{className:se("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:se("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:ie}),f.jsx("span",{className:se("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:me})]})]}),h&&f.jsxs("div",{role:"dialog","aria-label":"Live link connection events",onMouseEnter:M,onMouseLeave:$,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(As,{className:"h-3 w-3 text-emerald-500"}):f.jsx(CN,{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:se("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:R.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"}),O?f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"mt-0.5 truncate text-[9px] leading-snug text-foreground/80",children:O.text}),f.jsx("div",{className:"font-mono text-[8px] text-muted-foreground/60",children:O.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:[V?f.jsx(ds,{className:"h-3 w-3 shrink-0 text-destructive"}):H?f.jsx(As,{className:"h-3 w-3 shrink-0 text-amber-500"}):f.jsx(Ho,{className:se("h-3 w-3 shrink-0",le?"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:se("shrink-0 rounded-sm border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.1em]",V?"border-destructive/30 bg-destructive/10 text-destructive":H?"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300":le?"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:u3(z)})]}),z.length>0&&f.jsx("div",{className:"mt-1.5 flex flex-col gap-0.5",children:z.map(J=>{const{label:G,status:A}=d3(J,u),Y=A==="offline",Q=A==="busy";return f.jsxs("div",{"aria-label":`${G} ${A}`,className:se("flex items-center justify-between gap-2 rounded-sm px-2 py-0.5",Y?"bg-destructive/6":Q?"bg-amber-500/6":"bg-emerald-500/5"),title:`${G} ${A}`,children:[f.jsx("span",{className:"truncate text-[9px] text-foreground/70",children:G}),Y?f.jsx(ds,{className:"h-3 w-3 shrink-0 text-destructive"}):Q?f.jsx(cv,{className:"h-3 w-3 shrink-0 text-amber-500"}):f.jsx(Ho,{className:"h-3 w-3 shrink-0 text-emerald-500"})]},J.id)})})]}),X.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:[K?f.jsx(ds,{className:"h-3 w-3 shrink-0 text-destructive"}):f.jsx(Ho,{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:se("shrink-0 rounded-sm border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.1em]",K?"border-destructive/30 bg-destructive/10 text-destructive":"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300"),children:s3(X)})]}),f.jsx("div",{className:"mt-1.5 flex flex-col gap-0.5",children:X.map(J=>{var te;const{label:G,status:A}=c3(J,u),Y=A==="failed"||A==="offline",Q=A!=="healthy"&&A!=="failed"&&A!=="offline",W=(te=J.devtunnelHealth)!=null&&te.reason?`${G} ${A}: ${J.devtunnelHealth.reason}`:`${G} ${A}`;return f.jsxs("div",{"aria-label":`${G} ${A}`,className:se("flex items-center justify-between gap-2 rounded-sm px-2 py-0.5",Y?"bg-destructive/6":Q?"bg-muted/30":"bg-emerald-500/5"),title:W,children:[f.jsx("span",{className:"truncate text-[9px] text-foreground/70",children:G}),Y?f.jsx(ds,{className:"h-3 w-3 shrink-0 text-destructive"}):Q?f.jsx(cv,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):f.jsx(Ho,{className:"h-3 w-3 shrink-0 text-emerald-500"})]},J.id)})})]}),f.jsxs("div",{children:[f.jsxs("button",{type:"button",onClick:()=>x(J=>!J),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 ",R.length>0&&`(${R.length})`]}),p?f.jsx(Zs,{className:"h-3 w-3 text-muted-foreground"}):f.jsx(Qd,{className:"h-3 w-3 text-muted-foreground"})]}),p&&f.jsx("div",{className:"px-2 pb-2",children:f.jsx(t3,{events:R,maxHeight:"12rem",density:"compact",emptyTitle:"No connection events yet",emptyDescription:"Node, election, and system events will appear here.",nodeNameById:u,onDismiss:J=>w(G=>new Set(G).add(J))})})]}),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:m&&f.jsxs("div",{className:"group/restart relative flex items-center",children:[f.jsxs(Sn,{type:"button",variant:"ghost",size:"sm",className:"h-5 rounded-sm border border-border/50 bg-background/45 px-1.5 text-[9px] font-medium text-muted-foreground hover:border-emerald-500/25 hover:bg-emerald-500/10 hover:text-foreground [&_svg]:size-2.5",onClick:()=>void F(),disabled:E,"aria-label":E?"Relaunching runtime":"Relaunch runtime","aria-describedby":"live-link-restart-hint",title:fe,children:[f.jsx(fN,{className:se("h-2.5 w-2.5",E&&"animate-pulse")}),f.jsx("span",{children:"Relaunch"})]}),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:fe})]})}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx(Sn,{type:"button",variant:"ghost",size:"sm",className:"h-5 rounded-sm px-1.5 text-[9px]",onClick:()=>w(new Set(l.map(J=>J.id))),disabled:R.length===0,title:"Dismiss all notifications",children:"Dismiss all"}),f.jsx(Sn,{type:"button",variant:"ghost",size:"sm",className:"h-5 rounded-sm px-1.5 text-[9px]",onClick:()=>g(!1),children:"Close"})]})]})]})]})}const jr="airy",m3="clean",qd="meshy-layout-default-migrated-to-compact",uf="true",h3="compact",p3=new Set(["airy","clean","fluent"]);function g3(n){return n!==null&&p3.has(n)}function If(n){return n===h3?"fluent":g3(n)?n:null}function v3(n,l){const o=If(n);return o===m3&&l!==uf?jr:o??jr}const $o="finsight",qx="default",y3=new Set(["light","dark","system"]),b3=new Set(["porcelain","warm","finsight","edge"]),Gx=y.createContext(null);function x3(n){const l=new URLSearchParams(n).get("theme");return Xx(l)?l:null}function S3(n){const l=new URLSearchParams(n).get("palette");return Ff(l)}function w3(n){const l=new URLSearchParams(n).get("layout");return If(l)}function E3(){if(typeof document>"u")return null;const n=document.documentElement;return{theme:n.classList.contains("dark")?"dark":"light",palette:Ff(n.getAttribute("data-palette"))??$o,layout:If(n.getAttribute("data-layout"))??jr}}function Fj(n,l=E3()){if(!l)return n;try{const o=/^[a-z][a-z\d+\-.]*:/i.test(n),i=typeof window<"u"?window.location.href:"http://localhost",u=new URL(n,i);return u.searchParams.set("theme",l.theme),u.searchParams.set("palette",l.palette),u.searchParams.set("layout",l.layout),o?u.toString():`${u.pathname}${u.search}${u.hash}`}catch{return n}}function N3({children:n}){const[l,o]=y.useState(()=>typeof window<"u"?x3(window.location.search)??R3(localStorage.getItem("meshy-theme"))??"system":"system"),[i,u]=y.useState(()=>typeof window<"u"?S3(window.location.search)??A3(localStorage.getItem("meshy-palette"))??$o:$o),[d,m]=y.useState(()=>{if(typeof window<"u"){const h=w3(window.location.search);if(h)return localStorage.setItem(qd,uf),h;const g=v3(localStorage.getItem("meshy-layout"),localStorage.getItem(qd));return localStorage.setItem(qd,uf),g}return jr});return y.useEffect(()=>{const h=document.documentElement,g=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(g(l),localStorage.setItem("meshy-theme",l),l==="system"){const p=window.matchMedia("(prefers-color-scheme: dark)"),x=()=>g("system");return p.addEventListener("change",x),()=>p.removeEventListener("change",x)}},[l]),y.useEffect(()=>{const h=document.documentElement;i===$o?h.removeAttribute("data-palette"):h.setAttribute("data-palette",i),localStorage.setItem("meshy-palette",i)},[i]),y.useEffect(()=>{const h=document.documentElement;d===jr?h.removeAttribute("data-layout"):h.setAttribute("data-layout",d),localStorage.setItem("meshy-layout",d)},[d]),f.jsx(Gx.Provider,{value:{theme:l,setTheme:o,palette:i,setPalette:u,layout:d,setLayout:m},children:n})}function C3(){const n=y.useContext(Gx);if(!n)throw new Error("useTheme must be used within ThemeProvider");return n}function Xx(n){return n!==null&&y3.has(n)}function T3(n){return n!==null&&b3.has(n)}function R3(n){return Xx(n)?n:null}function Ff(n){return n===qx?"porcelain":T3(n)?n:null}function A3(n){return n===qx?null:Ff(n)}const _3=[{value:"light",label:"Light",icon:R0},{value:"dark",label:"Dark",icon:C0},{value:"system",label:"System",icon:N0}],Px=[{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"}],Qx=[{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 j3(){const{theme:n,setTheme:l,palette:o,setPalette:i,layout:u,setLayout:d}=C3(),[m,h]=y.useState(!1),g=y.useRef(null),p=y.useRef(null),x=n==="dark"?C0:n==="light"?R0:N0,v=()=>{g.current&&(clearTimeout(g.current),g.current=null)},w=()=>{v(),g.current=setTimeout(()=>h(!1),180)};return y.useEffect(()=>{if(!m)return;const E=C=>{p.current&&!p.current.contains(C.target)&&h(!1)};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[m]),y.useEffect(()=>()=>v(),[]),f.jsxs("div",{ref:p,className:"relative",onMouseEnter:()=>{v(),h(!0)},onMouseLeave:w,children:[f.jsx(Sn,{variant:"ghost",size:"icon",onClick:()=>h(E=>!E),className:se("h-8 w-8 rounded-sm",o!==$o||u!==jr?"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-lg border border-border/70 bg-popover/95 p-2.5 text-popover-foreground shadow-[0_28px_90px_-34px_rgba(0,0,0,0.45)] backdrop-blur-xl sm:absolute sm:left-auto sm:right-0 sm:top-[calc(100%+6px)] sm:w-[28rem] sm:max-w-[28rem]",children:[f.jsxs("div",{className:"mb-2.5 flex items-end justify-between gap-3",children:[f.jsxs("div",{children:[f.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-[0.2em] text-muted-foreground",children:"Appearance"}),f.jsxs("div",{className:"text-[11px] font-medium text-foreground",children:[M3(u)," / ",O3(o)]})]}),f.jsx("div",{className:"rounded-sm border border-border/60 bg-background/70 px-2 py-0.5 text-[9px] 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.5 grid grid-cols-3 gap-1 rounded-sm bg-muted/35 p-1",children:_3.map(({value:E,label:C,icon:N})=>{const T=n===E;return f.jsxs("button",{type:"button",onClick:()=>l(E),role:"menuitemradio","aria-checked":T,className:se("flex min-h-[2.5rem] flex-col items-center justify-center gap-0.5 rounded-sm border px-2 py-1.5 text-[10px] font-medium transition-colors",T?"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(N,{className:"h-3.5 w-3.5"}),C]},E)})}),f.jsxs("div",{className:"grid gap-3 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:Qx.map(({value:E,label:C,hint:N})=>{const T=u===E;return f.jsxs("button",{type:"button",onClick:()=>d(E),role:"menuitemradio","aria-checked":T,className:se("flex min-h-[2.75rem] w-full items-center gap-2 rounded-sm border px-2 py-1.5 text-left transition-colors",T?"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:se("text-[11px] font-medium leading-tight",T?"text-primary":"text-foreground"),children:C}),f.jsx("div",{className:"mt-0.5 text-[9px] leading-tight text-muted-foreground",children:N})]}),T&&f.jsx(_s,{className:"h-3 w-3 text-primary"})]},E)})})]}),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(SN,{className:"h-2.5 w-2.5"}),"Palette"]}),f.jsx("div",{className:"space-y-1",children:Px.map(({value:E,label:C,hint:N})=>{const T=o===E;return f.jsxs("button",{type:"button",onClick:()=>i(E),role:"menuitemradio","aria-checked":T,className:se("flex min-h-[2.75rem] w-full items-center gap-2 rounded-sm border px-2 py-1.5 text-left transition-colors",T?"border-primary/55 bg-primary/10":"border-border/45 bg-background/45 hover:border-border hover:bg-muted/55"),children:[f.jsx(D3,{value:E}),f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("div",{className:se("text-[11px] font-medium leading-tight",T?"text-primary":"text-foreground"),children:C}),f.jsx("div",{className:"mt-0.5 text-[9px] leading-tight text-muted-foreground",children:N})]}),T&&f.jsx(_s,{className:"h-3 w-3 text-primary"})]},E)})})]})]})]})]})}function M3(n){var l;return((l=Qx.find(o=>o.value===n))==null?void 0:l.label)??n}function O3(n){var l;return((l=Px.find(o=>o.value===n))==null?void 0:l.label)??n}function D3({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%)"]},[o,i,u]=l[n];return f.jsxs("div",{className:se("flex h-6 w-6 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:u}})]})}function k3(){const{cluster:n,events:l,sseConnected:o}=S0(),i=Yn(),[u,d]=y.useState(!1),[m,h]=y.useState(""),[g,p]=y.useState(null),x=i.pathname==="/"||/^\/tasks\/[^/]+$/.test(i.pathname),v=y.useMemo(()=>{const E=new Map;for(const C of(n==null?void 0:n.nodes)??[])E.set(C.id,C.name);return n!=null&&n.self&&E.set(n.self.id,n.self.name),E},[n==null?void 0:n.nodes,n==null?void 0:n.self]);async function w(){try{const E=await b0({reason:"restart"});at.info(`Restarting runtime. Follow ${E.logPath} for launch output.`),await Vx({previousPid:E.pid})||at.error("Runtime restart was accepted, but the dashboard did not reconnect before the timeout.")}catch(E){at.error(E instanceof Error?E.message:"Runtime 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:"relative z-50 shrink-0 px-2 py-2",children:f.jsxs("div",{className:"dashboard-panel dashboard-panel-muted animate-panel-settle mx-auto flex max-w-[1760px] items-center gap-0 rounded-lg px-3 py-2",children:[f.jsx("div",{className:"flex shrink-0 items-center gap-3 pr-3",children:f.jsxs(Pd,{to:"/","aria-label":"Meshy home",className:"flex items-center gap-2",children:[f.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-sm border border-primary/20 bg-primary/10 text-primary shadow-sm",children:f.jsx(lN,{className:"h-3.5 w-3.5"})}),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"}),x&&f.jsxs("div",{className:"hidden min-w-0 flex-1 items-center px-3 md:flex",children:[g&&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:()=>h(g.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 ${g.nodeName}`,children:[f.jsx(T0,{className:"h-3 w-3 shrink-0 text-primary/70"}),f.jsx("span",{className:"max-w-[9rem] truncate",children:g.nodeName})]}),f.jsx(Qd,{className:"h-3 w-3 shrink-0 text-border/80"}),f.jsxs("button",{type:"button",onClick:()=>h(g.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:g.projectPath,children:[f.jsx(IE,{className:"h-3 w-3 shrink-0 text-muted-foreground/70"}),f.jsx("span",{className:"max-w-[9rem] truncate",children:g.projectLabel})]}),f.jsx(Qd,{className:"h-3 w-3 shrink-0 text-border/80"}),f.jsx(Pd,{to:`/tasks/${g.taskId}`,className:"min-w-0 truncate px-1 font-medium text-foreground/85 hover:text-foreground",title:g.taskTitle,children:g.taskTitle})]}),f.jsxs("div",{className:"relative ml-auto w-[18rem] max-w-[28rem]",children:[f.jsx(hN,{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(Zf,{"aria-label":"Search tasks",value:m,onChange:E=>h(E.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:[x&&f.jsx(Sn,{variant:"ghost",size:"icon",onClick:()=>d(E=>!E),"aria-label":u?"Close terminal":"Open terminal",title:u?"Close terminal":"Open terminal",className:se("h-8 w-8 rounded-sm text-muted-foreground hover:bg-muted/50 hover:text-foreground",u&&"bg-primary/8 text-primary"),children:f.jsx(A0,{className:"h-4 w-4"})}),f.jsx(q_,{}),f.jsx(j3,{}),f.jsx("div",{className:"mx-0 h-4 w-px shrink-0 bg-border/50"}),f.jsx(f3,{connected:o,events:l,nodes:(n==null?void 0:n.nodes)??[],currentNode:(n==null?void 0:n.self)??null,nodeNameById:v,onRestart:w})]})]})}),f.jsx("main",{className:se("min-h-0 flex-1 px-2 pb-2",x?"overflow-hidden":"overflow-y-auto"),children:f.jsx("div",{className:"mx-auto h-full min-h-0 max-w-[1760px]",children:f.jsx(mw,{context:{terminalOpen:u,setTerminalOpen:d,headerSearchQuery:m,setHeaderSearchQuery:h,setHeaderTaskContext:p}})})})]})]})}const Kv=y.lazy(async()=>({default:(await Fv(()=>import("./DashboardPage-BFq2FfuI.js").then(l=>l.D),__vite__mapDeps([0,1,2,3]))).DashboardPage})),z3=y.lazy(async()=>({default:(await Fv(()=>import("./SharedConversationPage-CR-ifEMz.js"),__vite__mapDeps([4,1]))).SharedConversationPage}));function L3(){return f.jsx(Hw,{children:f.jsx(y.Suspense,{fallback:f.jsx(U3,{}),children:f.jsxs(pw,{children:[f.jsx(Cl,{path:"/shared/tasks/:shareId",element:f.jsx(z3,{})}),f.jsxs(Cl,{element:f.jsx(yE,{children:f.jsx(k3,{})}),children:[f.jsx(Cl,{path:"/",element:f.jsx(Kv,{})}),f.jsx(Cl,{path:"/nodes",element:f.jsx(ov,{to:"/",replace:!0})}),f.jsx(Cl,{path:"/tasks",element:f.jsx(ov,{to:"/",replace:!0})}),f.jsx(Cl,{path:"/tasks/:id",element:f.jsx(Kv,{})})]})]})})})}function U3(){return f.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background text-sm text-muted-foreground",children:"Loading workspace..."})}function B3(n){return f.jsx(YC,{className:"toaster group",style:{"--normal-bg":"hsl(var(--popover))","--normal-text":"hsl(var(--popover-foreground))","--normal-border":"hsl(var(--border))"},...n})}h2.createRoot(document.getElementById("root")).render(f.jsx(y.StrictMode,{children:f.jsxs(N3,{children:[f.jsx(L3,{}),f.jsx(B3,{})]})}));export{$s as $,My as A,Sn as B,_s as C,Dj as D,Fj as E,KE as F,YE as G,Z_ as H,Zf as I,K_ as J,E0 as K,qA as L,pt as M,Mj as N,cx as O,Oj as P,Ts as Q,Kj as R,T0 as S,kj as T,Bs as U,sf as V,Hs as W,_0 as X,Vs as Y,Ys as Z,qs as _,QC as a,uj as a$,Xs as a0,Gs as a1,Fv as a2,q3 as a3,jy as a4,M5 as a5,nj as a6,A0 as a7,Ho as a8,VE as a9,_j as aA,Aj as aB,hE as aC,fj as aD,Q3 as aE,X3 as aF,Oy as aG,P3 as aH,K3 as aI,eE as aJ,q_ as aK,mj as aL,hj as aM,V3 as aN,Yn as aO,s0 as aP,H3 as aQ,S0 as aR,Gj as aS,Yj as aT,Bj as aU,Hj as aV,$j as aW,Vj as aX,rj as aY,zj as aZ,P_ as a_,tj as aa,aj as ab,ej as ac,vN as ad,eN as ae,qj as af,sN as ag,t3 as ah,l_ as ai,PE as aj,r_ as ak,Zj as al,X_ as am,Ij as an,Lj as ao,Uj as ap,Ux as aq,Pj as ar,Xj as as,Qj as at,cf as au,pj as av,gj as aw,lj as ax,dE as ay,rE as az,se as b,dj as b0,cj as b1,sj as b2,Y3 as b3,G3 as b4,$3 as b5,Z3 as b6,Sj as b7,xj as b8,bj as b9,vj as ba,yj as bb,wj as bc,G_ as bd,Zv as be,zE as bf,Cj as bg,Nj as bh,Ej as bi,uN as bj,Tj as bk,jj as bl,Rj as bm,ze as c,P0 as d,W3 as e,Ww as f,F3 as g,I3 as h,IE as i,f as j,Qd as k,Nr as l,J3 as m,ij as n,Vb as o,Gf as p,$b as q,y as r,Xf as s,at as t,hN as u,Zs as v,SN as w,oj as x,A5 as y,_y as z};
321
+ For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return y.useEffect(()=>{var i;document.getElementById((i=n.current)==null?void 0:i.getAttribute("aria-describedby"))||console.warn(l)},[l,n]),null},WA=dx,e_=fx,t_=mx,Ex=hx,Nx=px,Cx=xx,Tx=wx,Rx=vx,Ax=bx;const sf=WA,cf=e_,n_=t_,_x=y.forwardRef(({className:n,...l},o)=>f.jsx(Ex,{className:se("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}));_x.displayName=Ex.displayName;const Hs=y.forwardRef(({className:n,...l},o)=>f.jsxs(n_,{children:[f.jsx(_x,{}),f.jsx(Nx,{ref:o,className:se("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})]}));Hs.displayName=Nx.displayName;const Vs=({className:n,...l})=>f.jsx("div",{className:se("flex flex-col space-y-2 text-center sm:text-left",n),...l});Vs.displayName="AlertDialogHeader";const $s=({className:n,...l})=>f.jsx("div",{className:se("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...l});$s.displayName="AlertDialogFooter";const Ys=y.forwardRef(({className:n,...l},o)=>f.jsx(Rx,{ref:o,className:se("text-lg font-semibold",n),...l}));Ys.displayName=Rx.displayName;const qs=y.forwardRef(({className:n,...l},o)=>f.jsx(Ax,{ref:o,className:se("text-sm text-muted-foreground",n),...l}));qs.displayName=Ax.displayName;const Gs=y.forwardRef(({className:n,...l},o)=>f.jsx(Cx,{ref:o,className:se(wf(),n),...l}));Gs.displayName=Cx.displayName;const Xs=y.forwardRef(({className:n,...l},o)=>f.jsx(Tx,{ref:o,className:se(wf({variant:"outline"}),"mt-2 sm:mt-0",n),...l}));Xs.displayName=Tx.displayName;const a_={online:"bg-green-500",busy:"bg-yellow-500",offline:"bg-red-500"};function l_({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:se("relative inline-flex h-2.5 w-2.5 rounded-full",a_[n])})]})}function r_({role:n,size:l="default"}){return f.jsx(pt,{variant:n==="leader"?"default":"secondary",className:se(l==="compact"?"px-1.5 py-0 text-[9px] leading-4":"text-[11px]"),children:n})}const o_={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 Oj({status:n,size:l="default"}){const o=o_[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(pt,{variant:o.variant,className:se("rounded-sm font-medium shadow-none",i,o.className),children:[f.jsx("span",{className:se("rounded-full",o.dotClass)}),n]})}const i_={critical:{variant:"destructive",label:"Critical"},high:{variant:"outline",label:"High"},normal:{variant:"secondary",label:"Normal"},low:{variant:"secondary",label:"Low"}};function Dj({priority:n}){const l=i_[n];return f.jsx(pt,{variant:l.variant,className:"rounded-sm px-1.5 py-0 text-[10px] leading-4 shadow-none",children:l.label})}function s_(n){return[{key:"workspace",label:"Workspace",value:n==null?void 0:n.workspace},{key:"node",label:"Node app",value:n==null?void 0:n.node},{key:"core",label:"Core",value:n==null?void 0:n.core},{key:"dashboard",label:"Dashboard",value:n==null?void 0:n.dashboard},{key:"api",label:"API",value:n==null?void 0:n.api}].filter(o=>o.value)}function Sr({label:n,value:l,mono:o=!1}){return 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 c_({formatDateTime:n,viewInfo:l}){var i,u,d,m,h,g,p,x;const o=s_(l.packages);return f.jsxs(Bs,{value:"about","data-about-layout":"compact",className:"mt-0 space-y-2",children:[f.jsxs(Dn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(kn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(zn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(RE,{className:"h-3.5 w-3.5 text-primary"}),"Repository & runtime"]}),f.jsx(Ln,{className:"text-[10px]",children:"Build source and runtime identity for this node."})]}),f.jsxs(Un,{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(PE,{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(Sr,{label:"Branch",value:((u=l.repository)==null?void 0:u.branch)??"Unavailable",mono:!!((d=l.repository)!=null&&d.branch)}),f.jsx(Sr,{label:"Commit",value:((m=l.repository)==null?void 0:m.commit)??"Unavailable",mono:!!((h=l.repository)!=null&&h.commit)}),f.jsx(Sr,{label:"Runtime",value:`${l.packageName??"meshy"} ${l.version}`,mono:!0}),f.jsx(Sr,{label:"Node.js",value:((g=l.runtime)==null?void 0:g.nodeVersion)??"Unavailable",mono:!!((p=l.runtime)!=null&&p.nodeVersion)}),f.jsx(Sr,{label:"PID",value:l.runtime?String(l.runtime.pid):"Unavailable",mono:!!l.runtime}),f.jsx(Sr,{label:"Started",value:n((x=l.runtime)==null?void 0:x.startedAt)})]})]})]}),f.jsxs(Dn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(kn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(zn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(JE,{className:"h-3.5 w-3.5 text-primary"}),"Package versions"]}),f.jsx(Ln,{className:"text-[10px]",children:"Version snapshot for the packages most relevant to this dashboard session."})]}),f.jsx(Un,{"data-package-layout":"list",className:"space-y-1.5 px-3 pb-2.5",children:o.map(v=>{var w,E;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:v.label}),f.jsx("div",{className:"min-w-0 truncate text-[10px] text-muted-foreground",children:(w=v.value)==null?void 0:w.name}),f.jsx(pt,{variant:"outline",className:"w-fit rounded-sm border-border/70 bg-background/60 font-mono text-[10px]",children:(E=v.value)==null?void 0:E.version})]},v.key)})})]})]})}var ic="Checkbox",[u_]=Fa(ic),[d_,Qf]=u_(ic);function f_(n){const{__scopeCheckbox:l,checked:o,children:i,defaultChecked:u,disabled:d,form:m,name:h,onCheckedChange:g,required:p,value:x="on",internal_do_not_use_render:v}=n,[w,E]=Ar({prop:o,defaultProp:u??!1,onChange:g,caller:ic}),[C,N]=y.useState(null),[T,R]=y.useState(null),j=y.useRef(!1),O=C?!!m||!!C.closest("form"):!0,z={checked:w,disabled:d,setChecked:E,control:C,setControl:N,name:h,form:m,value:x,hasConsumerStoppedPropagationRef:j,required:p,defaultChecked:Pa(u)?!1:u,isFormControl:O,bubbleInput:T,setBubbleInput:R};return f.jsx(d_,{scope:l,...z,children:m_(v)?v(z):i})}var jx="CheckboxTrigger",Mx=y.forwardRef(({__scopeCheckbox:n,onKeyDown:l,onClick:o,...i},u)=>{const{control:d,value:m,disabled:h,checked:g,required:p,setControl:x,setChecked:v,hasConsumerStoppedPropagationRef:w,isFormControl:E,bubbleInput:C}=Qf(jx,n),N=Ie(u,x),T=y.useRef(g);return y.useEffect(()=>{const R=d==null?void 0:d.form;if(R){const j=()=>v(T.current);return R.addEventListener("reset",j),()=>R.removeEventListener("reset",j)}},[d,v]),f.jsx(Le.button,{type:"button",role:"checkbox","aria-checked":Pa(g)?"mixed":g,"aria-required":p,"data-state":Lx(g),"data-disabled":h?"":void 0,disabled:h,value:m,...i,ref:N,onKeyDown:Me(l,R=>{R.key==="Enter"&&R.preventDefault()}),onClick:Me(o,R=>{v(j=>Pa(j)?!0:!j),C&&E&&(w.current=R.isPropagationStopped(),w.current||R.stopPropagation())})})});Mx.displayName=jx;var Kf=y.forwardRef((n,l)=>{const{__scopeCheckbox:o,name:i,checked:u,defaultChecked:d,required:m,disabled:h,value:g,onCheckedChange:p,form:x,...v}=n;return f.jsx(f_,{__scopeCheckbox:o,checked:u,defaultChecked:d,disabled:h,required:m,onCheckedChange:p,name:i,form:x,value:g,internal_do_not_use_render:({isFormControl:w})=>f.jsxs(f.Fragment,{children:[f.jsx(Mx,{...v,ref:l,__scopeCheckbox:o}),w&&f.jsx(zx,{__scopeCheckbox:o})]})})});Kf.displayName=ic;var Ox="CheckboxIndicator",Dx=y.forwardRef((n,l)=>{const{__scopeCheckbox:o,forceMount:i,...u}=n,d=Qf(Ox,o);return f.jsx(kr,{present:i||Pa(d.checked)||d.checked===!0,children:f.jsx(Le.span,{"data-state":Lx(d.checked),"data-disabled":d.disabled?"":void 0,...u,ref:l,style:{pointerEvents:"none",...n.style}})})});Dx.displayName=Ox;var kx="CheckboxBubbleInput",zx=y.forwardRef(({__scopeCheckbox:n,...l},o)=>{const{control:i,hasConsumerStoppedPropagationRef:u,checked:d,defaultChecked:m,required:h,disabled:g,name:p,value:x,form:v,bubbleInput:w,setBubbleInput:E}=Qf(kx,n),C=Ie(o,E),N=ab(d),T=Py(i);y.useEffect(()=>{const j=w;if(!j)return;const O=window.HTMLInputElement.prototype,X=Object.getOwnPropertyDescriptor(O,"checked").set,K=!u.current;if(N!==d&&X){const V=new Event("click",{bubbles:K});j.indeterminate=Pa(d),X.call(j,Pa(d)?!1:d),j.dispatchEvent(V)}},[w,N,d,u]);const R=y.useRef(Pa(d)?!1:d);return f.jsx(Le.input,{type:"checkbox","aria-hidden":!0,defaultChecked:m??R.current,required:h,disabled:g,name:p,value:x,form:v,...l,tabIndex:-1,ref:C,style:{...l.style,...T,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});zx.displayName=kx;function m_(n){return typeof n=="function"}function Pa(n){return n==="indeterminate"}function Lx(n){return Pa(n)?"indeterminate":n?"checked":"unchecked"}const Ux=y.forwardRef(({className:n,...l},o)=>f.jsx(Kf,{ref:o,className:se("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(Dx,{className:se("flex items-center justify-center text-current"),children:f.jsx(_s,{className:"h-3.5 w-3.5"})})}));Ux.displayName=Kf.displayName;const Zf=y.forwardRef(({className:n,type:l,...o},i)=>f.jsx("input",{type:l,className:se("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}));Zf.displayName="Input";const Xv=["queued","running"];function h_(n){return n.map(l=>`${l.id}:${l.name}`).join("\0")}function p_(n){return n==="claude"||n==="codex"||n==="copilot"}function Bx(n){var o;if(n.kind!=="agent.upgrade")return null;const l=(o=n.payload)==null?void 0:o.agent;return p_(l)?`${n.nodeId}:${l}`:null}function g_(n){return n.status==="succeeded"||n.status==="failed"}async function Hx(n,l={}){const o=l.getOperation??Ww,i=l.pollIntervalMs??2e3,u=l.timeoutMs??24e4,d=Date.now()+u;let m=n;for(;!g_(m)&&Date.now()<d;)await y_(i),m=await o(n.id);return m}async function v_(n,l=eE){const o=new Set(n),i=await Promise.all(Xv.map(d=>l({kind:"agent.upgrade",status:d}))),u=new Map;for(const d of i.flat()){if(!Xv.includes(d.status)||o.size>0&&!o.has(d.nodeId))continue;const m=Bx(d);if(!m)continue;const h=u.get(m);(!h||d.updatedAt>h.updatedAt)&&u.set(m,d)}return u}function y_(n){return new Promise(l=>setTimeout(l,n))}const b_=1500,x_=1e3,S_=9e4;async function Vx(n={}){const l=n.fetchHealth??w_,o=n.initialDelayMs??b_,i=n.pollIntervalMs??x_,u=n.previousPid,d=n.reload??(()=>window.location.reload()),m=n.sleep??N_,h=n.timeoutMs??S_,g=Date.now()+h;let p=!1;for(o>0&&await m(o);Date.now()<=g;){const x=E_(await l());if(!x.ok){p=!0,await m(i);continue}if(u===void 0||x.pid!==void 0&&x.pid!==u||p)return d(),!0;await m(i)}return!1}async function w_(){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 E_(n){return typeof n=="boolean"?{ok:n}:n}function N_(n){return new Promise(l=>window.setTimeout(l,n))}function C_(n,l=!0){return l?(n==null?void 0:n.restartMode)==="development"?"Restart dev runtime":n!=null&&n.updateAvailable?"Restart to update":"Restart runtime":n!=null&&n.updateAvailable?"Restart follower to update":"Restart follower"}function T_({checkedLabel:n,disableAuthDefault:l,endpoint:o,isLiveLocalNode:i,nodeId:u,nodeName:d,onRefresh:m,pid:h,transportType:g,update:p,workDir:x}){const v=C_(p,i),[w,E]=y.useState(null),[C,N]=y.useState(()=>Pv({disableAuthDefault:l,endpoint:o,nodeName:d,transportType:g,workDir:x})),[T,R]=y.useState(!1),[j,O]=y.useState(!1),[z,X]=y.useState(!1);y.useEffect(()=>{N(Pv({disableAuthDefault:l,endpoint:o,nodeName:d,transportType:g,workDir:x}))},[l,o,d,g,x]);async function K(){if(!u||T||j)return;const ie=p.updateAvailable?"update":"restart",me=__(C);if(C.port.trim()&&(me==null?void 0:me.port)===void 0){at.error("Runtime restart port must be a positive integer");return}const fe=me?{reason:ie,startArgs:me}:{reason:ie};R(!0);try{if(i){const M=await b0(fe);E({...M,pid:M.pid??h,status:"accepted"}),at.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.`),Vx({previousPid:M.pid??h}).then($=>{$||(R(!1),at.error("Runtime restart was accepted, but the dashboard did not reconnect before the timeout. Refresh the page after the node finishes starting."))}).catch($=>{R(!1),at.error($ instanceof Error?$.message:"Runtime restart recovery failed")});return}const ce=await nE(u,fe);E({operationId:ce.id,pid:h,status:ce.status}),at.info(`Restart requested on ${d}. Operation ${Yd(ce.id)} will hand off to a detached process, so the new runtime will not stay attached to the original terminal window.`);const de=await Hx(ce,{timeoutMs:6e4}),re=A_(de);E({command:re==null?void 0:re.command,logPath:re==null?void 0:re.logPath,mode:re==null?void 0:re.mode,operationId:de.id,pid:(re==null?void 0:re.pid)??h,status:de.status}),de.status==="succeeded"?(await(m==null?void 0:m()),at.success(`Restart handoff accepted on ${d}. Follow ${(re==null?void 0:re.logPath)??"the node restart log"} for launch output.`)):de.status==="failed"?at.error(de.error??`Restart failed on ${d}`):at.info(`Restart operation ${Yd(de.id)} is still ${de.status}. More details will update after the node reports back.`),R(!1)}catch(ce){R(!1),at.error(ce instanceof Error?ce.message:"Runtime restart failed")}}async function V(){if(!(!i||T||j)){O(!0);try{const ie=await Fw();at.info(`Stopping Meshy process ${ie.pid}`)}catch(ie){O(!1),at.error(ie instanceof Error?ie.message:"Runtime stop failed")}}}const H=T?"restarting":j?"stopping":(w==null?void 0:w.status)??"idle",le=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(As,{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:le?"Development launcher":`Latest ${p.latestVersion??"—"}`})]})]}),f.jsx("div",{className:"flex items-center gap-1.5",children:f.jsx(pt,{variant:p.updateAvailable?"default":"outline",className:"rounded-full border-border/70 bg-background/60 font-mono text-[10px] px-2 py-0.5",children:le?"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:H})]})]}),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(sf,{children:[f.jsx(cf,{asChild:!0,children:f.jsxs(Sn,{type:"button",size:"sm",variant:"ghost",disabled:T||j,className:"h-7 rounded-lg px-2 text-[11px] text-muted-foreground hover:text-destructive hover:bg-destructive/10",children:[f.jsx(oN,{className:se("mr-1 h-3.5 w-3.5",j&&"animate-pulse")}),j?"Stopping":"Stop"]})}),f.jsxs(Hs,{className:"max-w-[22rem] rounded-xl gap-2 p-4",children:[f.jsxs(Vs,{className:"space-y-1",children:[f.jsx(Ys,{className:"text-sm",children:"Stop runtime?"}),f.jsx(qs,{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($s,{className:"gap-1 pt-0 sm:space-x-1",children:[f.jsx(Xs,{className:"h-7 rounded-lg px-2 text-[11px]",children:"Cancel"}),f.jsx(Gs,{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(sf,{children:[f.jsx(cf,{asChild:!0,children:f.jsxs(Sn,{type:"button",size:"sm",variant:p.updateAvailable?"default":"outline",disabled:!u||T||j,className:"h-7 rounded-lg px-2 text-[11px]",children:[f.jsx(uN,{className:se("mr-1 h-3.5 w-3.5",T&&"animate-spin")}),T?"Restarting…":v]})}),f.jsxs(Hs,{className:"max-w-[28rem] gap-3 rounded-xl p-4",children:[f.jsxs(Vs,{className:"space-y-1",children:[f.jsxs(Ys,{className:"text-sm",children:[v,"?"]}),f.jsxs(qs,{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(R_,{value:C,onChange:N}),f.jsxs($s,{className:"gap-1 pt-0 sm:space-x-1",children:[f.jsx(Xs,{className:"h-7 rounded-lg px-2 text-[11px]",children:"Cancel"}),f.jsx(Gs,{className:"h-7 rounded-lg px-2 text-[11px]",onClick:()=>void K(),children:v})]})]})]})]})]}),f.jsxs("div",{className:"border-t border-border/50",children:[f.jsxs("button",{type:"button",onClick:()=>X(ie=>!ie),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(A0,{className:"h-3 w-3"}),"Restart details"]}),f.jsx(Zs,{className:se("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(Nl,{label:"Current PID",value:h===void 0?"—":String(h),mono:h!==void 0}),f.jsx(Nl,{label:"Restart PID",value:(w==null?void 0:w.pid)===void 0?"Pending":String(w.pid),mono:(w==null?void 0:w.pid)!==void 0}),f.jsx(Nl,{label:"Operation",value:w!=null&&w.operationId?Yd(w.operationId):"Local direct request",mono:!!(w!=null&&w.operationId)}),f.jsx(Nl,{label:"Status",value:(w==null?void 0:w.status)??(T?"requested":"idle")}),f.jsx(Nl,{label:"Launcher",value:(w==null?void 0:w.command)??"Available after restart",mono:!!(w!=null&&w.command)}),f.jsx(Nl,{label:"Log",value:(w==null?void 0:w.logPath)??"Available after restart",mono:!!(w!=null&&w.logPath)}),f.jsx(Nl,{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 R_({onChange:n,value:l}){const o=(i,u)=>{n({...l,[i]:u})};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(Lo,{label:"HTTP port",value:l.port,onChange:i=>o("port",i),inputMode:"numeric"}),f.jsx(Lo,{label:"Node name",value:l.name,onChange:i=>o("name",i)}),f.jsx(Lo,{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(Vb,{value:l.transport,onValueChange:i=>o("transport",$x(i)),children:[f.jsx(Gf,{className:"h-7 rounded-md border-border/70 bg-background/70 px-2 text-[10px]",children:f.jsx($b,{placeholder:"Transport"})}),f.jsxs(Xf,{children:[f.jsx(Nr,{className:"py-1 text-[11px]",value:"inherit",children:"current / default"}),f.jsx(Nr,{className:"py-1 text-[11px]",value:"direct",children:"direct"}),f.jsx(Nr,{className:"py-1 text-[11px]",value:"devtunnel",children:"devtunnel"}),f.jsx(Nr,{className:"py-1 text-[11px]",value:"tailscale",children:"tailscale"})]})]})]}),f.jsx(Lo,{label:"Working directory",value:l.workDir,onChange:i=>o("workDir",i)}),f.jsx(Lo,{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(Ux,{className:"h-3.5 w-3.5",checked:l.disableAuth,onCheckedChange:i=>n({...l,disableAuth:i===!0,disableAuthKnown:!0})}),"Disable auth"]})]})]})}function Lo({className:n,inputMode:l,label:o,onChange:i,value:u}){return f.jsxs("label",{className:se("space-y-1",n),children:[f.jsx("span",{className:"text-[9px] uppercase tracking-[0.14em] text-muted-foreground",children:o}),f.jsx(Zf,{className:"h-7 rounded-md px-2 text-[10px]",inputMode:l,value:u,onChange:d=>i(d.target.value)})]})}function Nl({label:n,value:l,mono:o=!1}){return 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:se("break-all text-right text-foreground",o&&"font-mono"),children:l})]})}function A_(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 Pv(n){return{port:j_(n.endpoint),name:n.nodeName,join:"",transport:$x(n.transportType),workDir:n.workDir??"",config:"",disableAuth:n.disableAuthDefault===!0,disableAuthKnown:n.disableAuthDefault!==void 0}}function __(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 $x(n){return n==="direct"||n==="devtunnel"||n==="tailscale"?n:"inherit"}function j_(n){if(!n)return"";try{return new URL(n).port||""}catch{return""}}function Yd(n){return n.length<=8?n:n.slice(0,8)}function Uo({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(pt,{variant:o.authenticated?"default":"outline",className:"rounded-full text-[10px] uppercase tracking-[0.14em]",children:o.authenticated?"auth ok":"auth required"}),f.jsx(pt,{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 Gt(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 M_(n){const l=Math.max(0,Math.floor(n)),o=Math.floor(l/86400),i=Math.floor(l%86400/3600),u=Math.floor(l%3600/60);return o>0?`${o}d ${i}h`:i>0?`${i}h ${u}m`:`${u}m`}function Qv(n){if(n==null||Number.isNaN(n))return"Unavailable";const l=["B","KB","MB","GB","TB"];let o=n,i=0;for(;o>=1024&&i<l.length-1;)o/=1024,i+=1;return`${o.toFixed(o>=10||i===0?0:1)} ${l[i]}`}function Er(n){return n==="ok"?"default":n==="missing"||n==="install-failed"||n==="login-failed"?"destructive":n==="not-authenticated"||n==="unsupported-platform"?"outline":"secondary"}function O_(n){return n.available?f.jsxs(pt,{className:"gap-1 rounded-full px-2 py-0.5 text-[10px]",children:[f.jsx(Ho,{className:"h-3 w-3"}),"Available"]}):f.jsxs(pt,{variant:"destructive",className:"gap-1 rounded-full px-2 py-0.5 text-[10px]",children:[f.jsx(VE,{className:"h-3 w-3"}),"Unavailable"]})}function D_(n){return n.update?n.update.updateAvailable?f.jsxs(pt,{variant:"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:["Update ",n.update.latestVersion]}):f.jsx(pt,{variant:"secondary",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:"Up to date"}):null}function k_(n){return n.available?null:n.metadataStatus??null}function z_(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 L_(n){if(n.error)return n.error;const l=n.result;return(l==null?void 0:l.detail)??null}function Ze({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:se("break-all text-right text-[11px] text-foreground",o&&"font-mono text-[11px]"),children:l})]})}function Bo({label:n,value:l,mono:o=!1,className:i}){return f.jsxs("div",{className:se("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:se("truncate text-[11px] text-foreground",o&&"font-mono",n==="Path"&&"break-all whitespace-normal"),children:l})]})}function U_({agent:n,nodeName:l,activeOperation:o,onUpgrade:i}){var g,p;const u=((g=n.update)==null?void 0:g.updateAvailable)===!0,d=D_(n),m=!!o,h=k_(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(E0,{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:[O_(n),h&&f.jsx(pt,{variant:Er(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(Bo,{label:"Version",value:n.version??"Unavailable",mono:!!n.version}),n.update&&f.jsx(Bo,{label:"Latest",value:n.update.latestVersion??"Unavailable",mono:!!n.update.latestVersion}),f.jsx(Bo,{label:"Checked",value:Gt(n.checkedAt)}),n.update&&f.jsx(Bo,{label:"Update check",value:Gt(n.update.checkedAt)}),f.jsx(Bo,{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(pt,{variant:"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.14em]",children:["Upgrade ",o.status]}):u?f.jsxs(sf,{children:[f.jsx(cf,{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(Hs,{children:[f.jsxs(Vs,{children:[f.jsxs(Ys,{children:["Upgrade ",n.label,"?"]}),f.jsxs(qs,{children:["This runs ",z_(n)," on ",l,". Remote nodes execute the command on the remote machine."]})]}),f.jsxs($s,{children:[f.jsx(Xs,{children:"Cancel"}),f.jsx(Gs,{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 B_(n,l){var o;return(o=n==null?void 0:n.nodes)!=null&&o.length?n.nodes:l?[l]:[]}function H_(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 V_(n,l){return n.id===l?`${n.name} (this node)`:`${n.name} (${n.role})`}function $_(n){return n==="claude"?"Claude Code":n==="copilot"?"Copilot CLI":"Codex"}function Y_(n){var o;const l=(o=n.payload)==null?void 0:o.agent;return l==="claude"||l==="codex"||l==="copilot"?l:null}function q_({cluster:n,systemInfo:l,sseConnected:o,initialSelectedNodeId:i,onRefresh:u}){var le,ie,me,fe,ce,de,re,M,$,F,J,G,A,Y,Q,W,te,oe,ne,ue;const d=y.useMemo(()=>B_(n,l),[n,l]),[m,h]=y.useState(()=>{var ee;return i??(l==null?void 0:l.nodeId)??((ee=n==null?void 0:n.self)==null?void 0:ee.id)??""}),[g,p]=y.useState(()=>new Map),x=y.useRef(new Set),v=y.useRef(new Set),w=(n==null?void 0:n.self)??l??d[0]??null,E=d.find(ee=>ee.id===m)??w,C=E?H_(E,l):null,N=!!(l&&E&&E.id===l.nodeId),T=N||!!(E!=null&&E.settingsSnapshot),R=C==null?void 0:C.runtimeUpdate,j=((le=C==null?void 0:C.startupRequirements)==null?void 0:le.components)??(C==null?void 0:C.components)??{},O=y.useMemo(()=>d.map(ee=>ee.id),[d]),z=O.join("\0"),X=h_(d),K=y.useMemo(()=>new Map(d.map(ee=>[ee.id,ee.name])),[X]);y.useEffect(()=>{i&&O.includes(i)&&h(i)},[i,z]);const V=y.useCallback(async(ee,xe)=>{const ye=Bx(ee);if(!ye||x.current.has(ee.id))return;const Se=Y_(ee),$e=(xe==null?void 0:xe.agentLabel)??(Se?$_(Se):"Agent"),Ue=(xe==null?void 0:xe.nodeName)??K.get(ee.nodeId)??ee.nodeId;x.current.add(ee.id),p(Ye=>new Map(Ye).set(ye,ee));try{const Ye=await Hx(ee);if(Ye.status==="succeeded")await(u==null?void 0:u()),v.current.has(Ye.id)||(at.success(`${$e} upgrade finished on ${Ue}`),v.current.add(Ye.id));else if(Ye.status==="failed")v.current.has(Ye.id)||(at.error(L_(Ye)??`${$e} upgrade failed`),v.current.add(Ye.id));else{p(gt=>new Map(gt).set(ye,Ye)),at.info(`${$e} upgrade is still ${Ye.status} on ${Ue}`);return}p(gt=>{const ot=new Map(gt),Pt=ot.get(ye);return(!Pt||Pt.id===Ye.id)&&ot.delete(ye),ot})}catch(Ye){p(gt=>{const ot=new Map(gt),Pt=ot.get(ye);return(!Pt||Pt.id===ee.id)&&ot.delete(ye),ot}),at.error(Ye instanceof Error?Ye.message:`${$e} upgrade failed`)}finally{x.current.delete(ee.id)}},[u,K]);y.useEffect(()=>{if(O.length===0)return;let ee=!1;async function xe(){let ye;try{ye=await v_(O)}catch{return}if(!ee){p(Se=>{const $e=new Map(Se);for(const[Ue,Ye]of ye)$e.set(Ue,Ye);return $e});for(const Se of ye.values())V(Se)}}return xe(),()=>{ee=!0}},[V,z]);async function H(ee){if(E)try{const xe=await tE(E.id,ee.id);at.info(`${ee.label} upgrade started on ${E.name}`),await V(xe,{agentLabel:ee.label,nodeName:E.name})}catch(xe){at.error(xe instanceof Error?xe.message:`${ee.label} upgrade failed`)}}return!E||!C?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:[!N&&f.jsxs(pt,{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 ",Gt((ie=E.settingsSnapshot)==null?void 0:ie.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(l_,{status:E.status}),f.jsx("span",{className:"font-medium text-foreground",children:E.name})]}),f.jsx(r_,{role:E.role}),f.jsx(pt,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:E.transportType??C.transportType??"direct"}),f.jsx(pt,{variant:N?"default":"outline",className:"rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:N?"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(Vb,{value:E.id,onValueChange:h,children:[f.jsx(Gf,{className:"h-7 rounded-lg border-border/70 bg-background/70 text-[11px]",children:f.jsx($b,{placeholder:"Choose a node"})}),f.jsx(Xf,{className:"settings-node-select-content rounded-lg text-[10px] leading-4",children:d.map(ee=>f.jsx(Nr,{value:ee.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:V_(ee,l==null?void 0:l.nodeId)},ee.id))})]})]})]}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsxs(pt,{variant:o?"default":"outline",className:"gap-1 rounded-full px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:[f.jsx(sN,{className:"h-3 w-3"}),o?"Live link":"Reconnecting"]}),f.jsxs(pt,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:["Uptime ",M_(C.uptime)]})]})]})]}),!T&&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(qA,{defaultValue:"session",className:"space-y-2",children:[f.jsxs(cx,{className:"h-auto flex-wrap rounded-xl border border-border/60 bg-muted/40 p-0.5",children:[f.jsx(Ts,{value:"session",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"Session"}),f.jsx(Ts,{value:"access",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"Access"}),f.jsx(Ts,{value:"about",className:"rounded-md px-2.5 py-0.5 text-[11px]",children:"About"})]}),f.jsxs(Bs,{value:"session",className:"mt-0 grid gap-2 xl:grid-cols-[1.15fr_0.85fr]",children:[f.jsxs(Dn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(kn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(zn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(T0,{className:"h-3.5 w-3.5 text-primary"}),"Selected node"]}),f.jsx(Ln,{className:"text-[10px]",children:"Cluster role, identity, and node-scoped runtime state."})]}),f.jsxs(Un,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(Ze,{label:"Node ID",value:C.nodeId,mono:!0}),f.jsx(Ze,{label:"Status",value:E.status}),f.jsx(Ze,{label:"Role",value:E.role}),f.jsx(Ze,{label:"Endpoint",value:E.endpoint,mono:!0}),f.jsx(Ze,{label:"Joined",value:Gt(E.joinedAt)}),f.jsx(Ze,{label:"Heartbeat",value:Gt(E.lastHeartbeat)}),f.jsx(Ze,{label:"Capabilities",value:E.capabilities.length>0?E.capabilities.join(", "):"None"})]})]}),f.jsxs(Dn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(kn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(zn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(GE,{className:"h-3.5 w-3.5 text-primary"}),"OS info"]}),f.jsx(Ln,{className:"text-[10px]",children:"Host and resource details reported by the current process."})]}),f.jsxs(Un,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(Ze,{label:"Host",value:((me=C.os)==null?void 0:me.hostname)??"Unavailable"}),f.jsx(Ze,{label:"Platform",value:C.os?`${C.os.platform} ${C.os.release}`:"Unavailable"}),f.jsx(Ze,{label:"Arch",value:((fe=C.os)==null?void 0:fe.arch)??"Unavailable"}),f.jsx(Ze,{label:"CPU",value:((ce=C.os)==null?void 0:ce.cpuModel)??"Unavailable"}),f.jsx(Ze,{label:"Cores",value:String(((de=C.os)==null?void 0:de.cpuCount)??"Unavailable")}),f.jsx(Ze,{label:"Memory",value:C.os?`${Qv(C.os.freeMemoryBytes)} free / ${Qv(C.os.totalMemoryBytes)} total`:"Unavailable"})]})]}),R&&f.jsx("div",{className:"xl:col-span-2",children:f.jsx(T_,{checkedLabel:Gt(R.checkedAt),disableAuthDefault:((re=C.auth)==null?void 0:re.enabled)===void 0?void 0:C.auth.enabled===!1,endpoint:E.endpoint,isLiveLocalNode:N,nodeId:E.id,nodeName:E.name,onRefresh:u,pid:(M=C.runtime)==null?void 0:M.pid,transportType:E.transportType,update:R,workDir:(($=C.runtime)==null?void 0:$.workDir)??E.workDir})}),f.jsxs(Dn,{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(kn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(zn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(E0,{className:"h-3.5 w-3.5 text-primary"}),"Available agents"]}),f.jsx(Ln,{className:"text-[10px]",children:N?"Live command availability for runtime agents on this node.":"Most recent agent availability snapshot synced from this node."})]}),f.jsx(Un,{"data-agent-layout":"list",className:"space-y-1.5 px-3 pb-2.5",children:(C.agents??[]).map(ee=>f.jsx(U_,{agent:ee,nodeName:E.name,activeOperation:g.get(`${E.id}:${ee.id}`),onUpgrade:H},ee.id))})]})]}),f.jsxs(Bs,{value:"access",className:"mt-0 grid gap-2 xl:grid-cols-2",children:[f.jsxs(Dn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(kn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(zn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(jE,{className:"h-3.5 w-3.5 text-primary"}),"Access surface"]}),f.jsx(Ln,{className:"text-[10px]",children:"How this node is exposed to the dashboard and other peers."})]}),f.jsxs(Un,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(Ze,{label:"Transport",value:E.transportType??C.transportType??"direct"}),f.jsx(Ze,{label:"Node URL",value:E.endpoint,mono:!0}),f.jsx(Ze,{label:"Node tunnel",value:E.devtunnelEndpoint??"Disabled",mono:!!E.devtunnelEndpoint}),f.jsx(Ze,{label:"Dashboard URL",value:E.dashboardOrigin??C.localDashboardOrigin??"Unavailable",mono:!!(E.dashboardOrigin||C.localDashboardOrigin)}),f.jsx(Ze,{label:"Local dashboard",value:C.localDashboardOrigin??"Unavailable",mono:!!C.localDashboardOrigin})]})]}),f.jsxs(Dn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(kn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(zn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(bN,{className:"h-3.5 w-3.5 text-primary"}),"Auth"]}),f.jsx(Ln,{className:"text-[10px]",children:"Current bearer-auth and trusted access posture."})]}),f.jsxs(Un,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(Ze,{label:"Enabled",value:(F=C.auth)!=null&&F.enabled?"Yes":"No"}),f.jsx(Ze,{label:"Same tenant",value:(J=C.auth)!=null&&J.allowSameTenant?"Allowed":"Off"}),f.jsx(Ze,{label:"Allowed users",value:(G=C.auth)!=null&&G.allowedUsers.length?C.auth.allowedUsers.join(", "):"None"})]})]}),f.jsxs(Dn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(kn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(zn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(KE,{className:"h-3.5 w-3.5 text-primary"}),"Paths"]}),f.jsx(Ln,{className:"text-[10px]",children:"Workspace and runtime paths currently used by this node."})]}),f.jsxs(Un,{className:"space-y-0 px-3 pb-2.5",children:[f.jsx(Ze,{label:"Work dir",value:((A=C.runtime)==null?void 0:A.workDir)??C.workDir??"Unavailable",mono:!!(((Y=C.runtime)==null?void 0:Y.workDir)??C.workDir)}),f.jsx(Ze,{label:"Storage",value:((Q=C.runtime)==null?void 0:Q.storagePath)??"Unavailable",mono:!!((W=C.runtime)!=null&&W.storagePath)}),f.jsx(Ze,{label:"Process cwd",value:((te=C.runtime)==null?void 0:te.cwd)??"Unavailable",mono:!!((oe=C.runtime)!=null&&oe.cwd)}),f.jsx(Ze,{label:"Started",value:Gt((ne=C.runtime)==null?void 0:ne.startedAt)}),f.jsx(Ze,{label:"PID",value:C.runtime?String(C.runtime.pid):"Unavailable",mono:!!C.runtime})]})]}),f.jsxs(Dn,{className:"rounded-xl border-border/70 bg-background/75 shadow-[0_24px_80px_-58px_rgba(15,23,42,0.45)]",children:[f.jsxs(kn,{className:"pb-1.5 pt-2.5 px-3",children:[f.jsxs(zn,{className:"flex items-center gap-1.5 text-[12px]",children:[f.jsx(As,{className:"h-3.5 w-3.5 text-primary"}),"Startup checks"]}),f.jsx(Ln,{className:"text-[10px]",children:"Dependency preflight snapshot persisted during node startup."})]}),f.jsxs(Un,{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:Gt((ue=C.startupRequirements)==null?void 0:ue.lastCheckedAt)})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(Uo,{formatDateTime:Gt,name:"Azure CLI",status:j.az,statusVariant:Er}),f.jsx(Uo,{formatDateTime:Gt,name:"DevTunnel",status:j.devtunnel,statusVariant:Er}),f.jsx(Uo,{formatDateTime:Gt,name:"Claude Code",status:j.claude,statusVariant:Er}),f.jsx(Uo,{formatDateTime:Gt,name:"Codex",status:j.codex,statusVariant:Er}),f.jsx(Uo,{formatDateTime:Gt,name:"Copilot CLI",status:j.copilot,statusVariant:Er})]})]})]})]}),f.jsx(c_,{formatDateTime:Gt,viewInfo:C})]})]})}function G_({initialSelectedNodeId:n,open:l,onOpenChange:o,showTrigger:i=!0}={}){const{cluster:u,systemInfo:d,sseConnected:m,refresh:h}=S0();return f.jsx(O5,{open:l,onOpenChange:o,showTrigger:i,children:f.jsx(q_,{cluster:u,systemInfo:d,sseConnected:m,initialSelectedNodeId:n,onRefresh:h})})}const kj="bypass",X_=[{value:"claudecode",label:"Claude Code",supportsFollowUp:!0},{value:"codex",label:"Codex",supportsFollowUp:!0},{value:"copilot",label:"Copilot",supportsFollowUp:!0},{value:"mars",label:"mars",disabled:!0,description:"coming soon"},{value:"eureka",label:"eureka",disabled:!0,description:"coming soon"}],zj=[{value:"bypass",label:"Bypass"},{value:"plan",label:"Plan"},{value:"edit",label:"Edit"},{value:"dangerous",label:"Dangerous"}],Lj=new Set(X_.filter(n=>n.supportsFollowUp).map(n=>n.value)),Uj=[{value:"active",label:"Active"},{value:"running",label:"Running"},{value:"waiting",label:"Waiting"},{value:"closed",label:"Closed"},{value:"shared",label:"Shared"},{value:"archived",label:"Archived"}],Bj=[{value:"all",label:"All task types"},{value:"native",label:"Native sessions"},{value:"meshy",label:"Meshy chats"}],P_=new Set(["pending","assigned"]),Q_=new Set(["running"]),K_=new Set(["completed","failed","cancelled"]);function Hj(n,l){switch(l){case"running":return Q_.has(n.status);case"waiting":return P_.has(n.status);case"closed":return K_.has(n.status);case"shared":return!!n.activeShare;case"archived":return n.status==="archived";case"active":default:return n.status!=="archived"}}function Vj(n,l){if(l==="all")return!0;const o=n.conversationKind==="nativeSession";return l==="native"?o:!o}function $j(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 Z_(n,l,o){if(!n)return"unassigned";const i=l==null?void 0:l.find(u=>u.id===n);return(i==null?void 0:i.name)??o??n.slice(0,8)}function Yj(n,l,o){return Z_(n,l,o).toLowerCase()}function qj(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 Gj(n,l){return[...n].sort((o,i)=>o.id===l?-1:i.id===l?1:o.name.localeCompare(i.name))}function Xj(n){if(!n||typeof n!="object")return null;const l=n,o=l.createMode,i=o==="chat"||o==="native"?o:void 0;return{draftNewTask:l.draftNewTask===!0,returnRoute:typeof l.returnRoute=="string"?l.returnRoute:void 0,returnTaskId:typeof l.returnTaskId=="string"||l.returnTaskId===null?l.returnTaskId:void 0,createMode:i}}function Pj(n){switch(n){case"running":return"bg-amber-500";case"completed":return"bg-emerald-500";case"failed":return"bg-destructive";case"cancelled":case"archived":return"bg-slate-400";case"assigned":return"bg-teal-500";case"pending":default:return"bg-muted-foreground"}}function Qj(n){return n==="default workspace"?n:n.replace(/\\/g,"/").split("/").filter(Boolean).at(-1)??n}function Kj(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 Zj(n){return new Date(n).toLocaleString()}function Ij(n){const l=Math.floor(n/1e3),o=Math.floor(l/3600),i=Math.floor(l%3600/60),u=l%60;return`${String(o).padStart(2,"0")}:${String(i).padStart(2,"0")}:${String(u).padStart(2,"0")}`}async function I_(n,l="Copied to clipboard"){var o,i,u;try{if((i=(o=globalThis.navigator)==null?void 0:o.clipboard)!=null&&i.writeText)return await globalThis.navigator.clipboard.writeText(n),at.success(l),!0;const d=globalThis.document,m=(u=d==null?void 0:d.execCommand)==null?void 0:u.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"),g=d.activeElement,p=g&&typeof g.focus=="function"?g: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 at.success(l),!0}catch(d){return at.error(d instanceof Error?d.message:"Failed to copy"),!1}}function Fj(n,l,o){const i=new Map;for(const d of n){const m=d.assignedTo??null,h=m??"__unassigned__",g=m?l.get(m)??d.assignedNodeName??m.slice(0,8):"Unassigned",p=d.effectiveProjectPath??d.project??"default workspace";i.has(h)||i.set(h,{nodeId:m,nodeName:g,dirMap:new Map});const x=i.get(h);x.dirMap.has(p)||x.dirMap.set(p,[]),x.dirMap.get(p).push(d)}const u=Array.from(i.values()).map(({nodeId:d,nodeName:m,dirMap:h})=>{const g=Array.from(h.entries()).map(([p,x])=>({path:p,tasks:x})).sort((p,x)=>x.tasks.length-p.tasks.length||p.path.localeCompare(x.path));return{nodeId:d,nodeName:m,dirs:g}});return u.sort((d,m)=>{if(o){if(d.nodeId===o)return-1;if(m.nodeId===o)return 1}return d.nodeId===null?1:m.nodeId===null?-1:d.nodeName.localeCompare(m.nodeName)}),u}const F_={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"},J_={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 W_(n){return n.split(".")[0]??"unknown"}function e3(n){return new Date(n).toLocaleTimeString("en-US",{hour12:!1})}function wr(n,l){return(l==null?void 0:l.get(n))??n}function Yx(n,l){const o=n.data,i=o.operation;switch(n.type){case"node.joined":return`${o.name} joined the cluster`;case"node.left":return`${wr(o.nodeId,l)} left (${o.reason})`;case"node.status":return`${wr(o.nodeId,l)} is now ${o.status}`;case"node.operation.created":return`${i==null?void 0:i.kind} ${i==null?void 0:i.status} on ${wr(i==null?void 0:i.nodeId,l)}`;case"node.operation.updated":return`${i==null?void 0:i.kind} ${i==null?void 0:i.status} on ${wr(i==null?void 0:i.nodeId,l)}`;case"transport.changed":return`${wr(o.nodeId,l)} transport switched to ${o.transportType}`;case"task.created":return`"${o.title}" created`;case"task.assigned":return`task assigned to ${wr(o.nodeId,l)}`;case"task.status":return`task ${o.taskId.slice(0,8)} -> ${o.status}`;case"election.started":return`candidate ${o.candidateId.slice(0,8)} term ${o.term}`;case"election.complete":return`leader elected, term ${o.term}`;case"cluster.state":return`${o.nodeCount} nodes, term ${o.term}`;default:return JSON.stringify(o)}}function t3(n){return JSON.stringify(n,null,2)}function n3({events:n,maxHeight:l="400px",nodeNameById:o,onDismiss:i,density:u="default"}){if(n.length===0)return null;const d=u==="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=W_(m.type);return f.jsx("div",{className:se("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:se("font-mono text-muted-foreground",d?"text-[8px]":"text-[9px]"),children:e3(m.timestamp)}),d?f.jsx("span",{className:se("max-w-[8.5rem] truncate text-[7px] font-medium uppercase tracking-[0.08em] text-muted-foreground/70",J_[h]),children:m.type}):f.jsx(pt,{variant:"outline",className:se("w-fit text-[9px] font-medium uppercase tracking-[0.14em] px-1.5 py-0",F_[h]),children:m.type})]}),f.jsxs("div",{className:se("flex shrink-0 items-center",d?"gap-px":"gap-0.5"),children:[f.jsx(Sn,{type:"button",variant:"ghost",size:"icon",className:se("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 I_(t3(m),"Event copied"),"aria-label":`Copy ${m.type} event`,title:"Copy event",children:f.jsx(YE,{className:d?"h-2.5 w-2.5":"h-3 w-3"})}),i&&f.jsx(Sn,{type:"button",variant:"ghost",size:"icon",className:se("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(_0,{className:d?"h-2.5 w-2.5":"h-3 w-3"})})]})]}),f.jsx("div",{className:"text-[9px] leading-snug text-foreground/85",children:Yx(m,o)})]})},m.id)})})})}const a3=["node.","election.","transport."],l3="cluster.state";function r3(n){return n.type==="node.status"?!1:a3.some(l=>n.type.startsWith(l))}function o3(n){return new Date(n).toLocaleTimeString("en-US",{hour12:!1})}function i3(n,l){return n?{time:o3(n.timestamp),text:Yx(n,l)}:null}function s3(n){return n.transportType==="devtunnel"||!!n.devtunnelEndpoint}function c3(n){if(n.length===0)return"No node tunnel";const l=n.filter(u=>u.status==="offline").length;if(l>0)return`${l} offline`;const o=n.filter(u=>{var d;return((d=u.devtunnelHealth)==null?void 0:d.status)==="failed"}).length;if(o>0)return`${o} failed`;const i=n.filter(u=>{var d;return u.status!=="offline"&&((d=u.devtunnelHealth)==null?void 0:d.status)!=="healthy"}).length;return i>0?`${i} checking`:"Healthy"}function u3(n,l){var u;const o=(l==null?void 0:l.get(n.id))??n.name??n.id;if(n.status==="offline")return{label:o,status:"offline"};const i=((u=n.devtunnelHealth)==null?void 0:u.status)??"checking";return{label:o,status:i}}function d3(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 f3(n,l){return{label:(l==null?void 0:l.get(n.id))??n.name??n.id,status:n.status}}function m3({connected:n,events:l,nodes:o=[],currentNode:i=null,nodeNameById:u,defaultOpen:d=!1,onRestart:m}){const[h,g]=y.useState(d),[p,x]=y.useState(!0),[v,w]=y.useState(new Set),[E,C]=y.useState(!1),N=y.useRef(null),T=y.useRef(null),R=y.useMemo(()=>l.filter(J=>r3(J)&&!v.has(J.id)),[l,v]),j=y.useMemo(()=>l.find(J=>J.type===l3)??R[0],[l,R]),O=y.useMemo(()=>i3(j,u),[j,u]),z=y.useMemo(()=>{const J=new Map(o.map(G=>[G.id,G]));return i&&J.set(i.id,i),Array.from(J.values())},[i,o]),X=y.useMemo(()=>z.filter(s3),[z]),K=X.some(J=>{var G;return J.status==="offline"||((G=J.devtunnelHealth)==null?void 0:G.status)==="failed"}),V=z.some(J=>J.status==="offline"),H=z.some(J=>J.status==="busy"),le=z.length>0,ie=(i==null?void 0:i.name)??"offline",me=(i==null?void 0:i.role)==="leader"?"Leader":(i==null?void 0:i.role)==="follower"?"Follower":"Node",fe=E?"Relaunching runtime...":"Relaunch to apply update";function ce(){T.current&&(clearTimeout(T.current),T.current=null)}function de(){ce(),g(!0)}function re(){ce(),T.current=setTimeout(()=>{g(!1),T.current=null},180)}function M(){ce()}function $(){ce(),g(!1)}async function F(){if(!(!m||E)){C(!0);try{await m()}finally{C(!1)}}}return y.useEffect(()=>()=>{ce()},[]),y.useEffect(()=>{w(J=>{if(J.size===0)return J;const G=new Set(l.map(Y=>Y.id)),A=new Set(Array.from(J).filter(Y=>G.has(Y)));return A.size===J.size?J:A})},[l]),y.useEffect(()=>{if(!h)return;const J=A=>{var Y;(Y=N.current)!=null&&Y.contains(A.target)||(ce(),g(!1))},G=A=>{A.key==="Escape"&&(ce(),g(!1))};return document.addEventListener("pointerdown",J),document.addEventListener("keydown",G),()=>{document.removeEventListener("pointerdown",J),document.removeEventListener("keydown",G)}},[h]),f.jsxs("div",{ref:N,className:"relative",children:[f.jsxs("button",{type:"button","aria-label":n?"Cluster link connected":"Cluster link reconnecting","aria-expanded":h,"aria-haspopup":"dialog",onClick:()=>g(J=>!J),onMouseEnter:de,onMouseLeave:re,className:se("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",h&&(n?"bg-muted/60 text-foreground":"bg-destructive/12")),title:n?"Cluster link connected":"Cluster link reconnecting",children:[f.jsxs("span",{className:se("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:se("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:ie}),f.jsx("span",{className:se("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:me})]})]}),h&&f.jsxs("div",{role:"dialog","aria-label":"Live link connection events",onMouseEnter:M,onMouseLeave:$,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(As,{className:"h-3 w-3 text-emerald-500"}):f.jsx(CN,{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:se("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:R.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"}),O?f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"mt-0.5 truncate text-[9px] leading-snug text-foreground/80",children:O.text}),f.jsx("div",{className:"font-mono text-[8px] text-muted-foreground/60",children:O.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:[V?f.jsx(ds,{className:"h-3 w-3 shrink-0 text-destructive"}):H?f.jsx(As,{className:"h-3 w-3 shrink-0 text-amber-500"}):f.jsx(Ho,{className:se("h-3 w-3 shrink-0",le?"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:se("shrink-0 rounded-sm border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.1em]",V?"border-destructive/30 bg-destructive/10 text-destructive":H?"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300":le?"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:d3(z)})]}),z.length>0&&f.jsx("div",{className:"mt-1.5 flex flex-col gap-0.5",children:z.map(J=>{const{label:G,status:A}=f3(J,u),Y=A==="offline",Q=A==="busy";return f.jsxs("div",{"aria-label":`${G} ${A}`,className:se("flex items-center justify-between gap-2 rounded-sm px-2 py-0.5",Y?"bg-destructive/6":Q?"bg-amber-500/6":"bg-emerald-500/5"),title:`${G} ${A}`,children:[f.jsx("span",{className:"truncate text-[9px] text-foreground/70",children:G}),Y?f.jsx(ds,{className:"h-3 w-3 shrink-0 text-destructive"}):Q?f.jsx(cv,{className:"h-3 w-3 shrink-0 text-amber-500"}):f.jsx(Ho,{className:"h-3 w-3 shrink-0 text-emerald-500"})]},J.id)})})]}),X.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:[K?f.jsx(ds,{className:"h-3 w-3 shrink-0 text-destructive"}):f.jsx(Ho,{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:se("shrink-0 rounded-sm border px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.1em]",K?"border-destructive/30 bg-destructive/10 text-destructive":"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300"),children:c3(X)})]}),f.jsx("div",{className:"mt-1.5 flex flex-col gap-0.5",children:X.map(J=>{var te;const{label:G,status:A}=u3(J,u),Y=A==="failed"||A==="offline",Q=A!=="healthy"&&A!=="failed"&&A!=="offline",W=(te=J.devtunnelHealth)!=null&&te.reason?`${G} ${A}: ${J.devtunnelHealth.reason}`:`${G} ${A}`;return f.jsxs("div",{"aria-label":`${G} ${A}`,className:se("flex items-center justify-between gap-2 rounded-sm px-2 py-0.5",Y?"bg-destructive/6":Q?"bg-muted/30":"bg-emerald-500/5"),title:W,children:[f.jsx("span",{className:"truncate text-[9px] text-foreground/70",children:G}),Y?f.jsx(ds,{className:"h-3 w-3 shrink-0 text-destructive"}):Q?f.jsx(cv,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):f.jsx(Ho,{className:"h-3 w-3 shrink-0 text-emerald-500"})]},J.id)})})]}),f.jsxs("div",{children:[f.jsxs("button",{type:"button",onClick:()=>x(J=>!J),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 ",R.length>0&&`(${R.length})`]}),p?f.jsx(Zs,{className:"h-3 w-3 text-muted-foreground"}):f.jsx(Qd,{className:"h-3 w-3 text-muted-foreground"})]}),p&&f.jsx("div",{className:"px-2 pb-2",children:f.jsx(n3,{events:R,maxHeight:"12rem",density:"compact",emptyTitle:"No connection events yet",emptyDescription:"Node, election, and system events will appear here.",nodeNameById:u,onDismiss:J=>w(G=>new Set(G).add(J))})})]}),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:m&&f.jsxs("div",{className:"group/restart relative flex items-center",children:[f.jsxs(Sn,{type:"button",variant:"ghost",size:"sm",className:"h-5 rounded-sm border border-border/50 bg-background/45 px-1.5 text-[9px] font-medium text-muted-foreground hover:border-emerald-500/25 hover:bg-emerald-500/10 hover:text-foreground [&_svg]:size-2.5",onClick:()=>void F(),disabled:E,"aria-label":E?"Relaunching runtime":"Relaunch runtime","aria-describedby":"live-link-restart-hint",title:fe,children:[f.jsx(fN,{className:se("h-2.5 w-2.5",E&&"animate-pulse")}),f.jsx("span",{children:"Relaunch"})]}),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:fe})]})}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx(Sn,{type:"button",variant:"ghost",size:"sm",className:"h-5 rounded-sm px-1.5 text-[9px]",onClick:()=>w(new Set(l.map(J=>J.id))),disabled:R.length===0,title:"Dismiss all notifications",children:"Dismiss all"}),f.jsx(Sn,{type:"button",variant:"ghost",size:"sm",className:"h-5 rounded-sm px-1.5 text-[9px]",onClick:()=>g(!1),children:"Close"})]})]})]})]})}const jr="fluent",h3="clean",qd="meshy-layout-default-migrated-to-compact",uf="true",p3="compact",g3=new Set(["airy","clean","fluent"]);function v3(n){return n!==null&&g3.has(n)}function If(n){return n===p3?"fluent":v3(n)?n:null}function y3(n,l){const o=If(n);return o===h3&&l!==uf?jr:o??jr}const $o="finsight",qx="default",b3=new Set(["light","dark","system"]),x3=new Set(["porcelain","warm","finsight","edge"]),Gx=y.createContext(null);function S3(n){const l=new URLSearchParams(n).get("theme");return Xx(l)?l:null}function w3(n){const l=new URLSearchParams(n).get("palette");return Ff(l)}function E3(n){const l=new URLSearchParams(n).get("layout");return If(l)}function N3(){if(typeof document>"u")return null;const n=document.documentElement;return{theme:n.classList.contains("dark")?"dark":"light",palette:Ff(n.getAttribute("data-palette"))??$o,layout:If(n.getAttribute("data-layout"))??jr}}function Jj(n,l=N3()){if(!l)return n;try{const o=/^[a-z][a-z\d+\-.]*:/i.test(n),i=typeof window<"u"?window.location.href:"http://localhost",u=new URL(n,i);return u.searchParams.set("theme",l.theme),u.searchParams.set("palette",l.palette),u.searchParams.set("layout",l.layout),o?u.toString():`${u.pathname}${u.search}${u.hash}`}catch{return n}}function C3({children:n}){const[l,o]=y.useState(()=>typeof window<"u"?S3(window.location.search)??A3(localStorage.getItem("meshy-theme"))??"system":"system"),[i,u]=y.useState(()=>typeof window<"u"?w3(window.location.search)??_3(localStorage.getItem("meshy-palette"))??$o:$o),[d,m]=y.useState(()=>{if(typeof window<"u"){const h=E3(window.location.search);if(h)return localStorage.setItem(qd,uf),h;const g=y3(localStorage.getItem("meshy-layout"),localStorage.getItem(qd));return localStorage.setItem(qd,uf),g}return jr});return y.useEffect(()=>{const h=document.documentElement,g=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(g(l),localStorage.setItem("meshy-theme",l),l==="system"){const p=window.matchMedia("(prefers-color-scheme: dark)"),x=()=>g("system");return p.addEventListener("change",x),()=>p.removeEventListener("change",x)}},[l]),y.useEffect(()=>{const h=document.documentElement;i===$o?h.removeAttribute("data-palette"):h.setAttribute("data-palette",i),localStorage.setItem("meshy-palette",i)},[i]),y.useEffect(()=>{const h=document.documentElement;d===jr?h.removeAttribute("data-layout"):h.setAttribute("data-layout",d),localStorage.setItem("meshy-layout",d)},[d]),f.jsx(Gx.Provider,{value:{theme:l,setTheme:o,palette:i,setPalette:u,layout:d,setLayout:m},children:n})}function T3(){const n=y.useContext(Gx);if(!n)throw new Error("useTheme must be used within ThemeProvider");return n}function Xx(n){return n!==null&&b3.has(n)}function R3(n){return n!==null&&x3.has(n)}function A3(n){return Xx(n)?n:null}function Ff(n){return n===qx?"porcelain":R3(n)?n:null}function _3(n){return n===qx?null:Ff(n)}const j3=[{value:"light",label:"Light",icon:R0},{value:"dark",label:"Dark",icon:C0},{value:"system",label:"System",icon:N0}],Px=[{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"}],Qx=[{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 M3(){const{theme:n,setTheme:l,palette:o,setPalette:i,layout:u,setLayout:d}=T3(),[m,h]=y.useState(!1),g=y.useRef(null),p=y.useRef(null),x=n==="dark"?C0:n==="light"?R0:N0,v=()=>{g.current&&(clearTimeout(g.current),g.current=null)},w=()=>{v(),g.current=setTimeout(()=>h(!1),180)};return y.useEffect(()=>{if(!m)return;const E=C=>{p.current&&!p.current.contains(C.target)&&h(!1)};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[m]),y.useEffect(()=>()=>v(),[]),f.jsxs("div",{ref:p,className:"relative",onMouseEnter:()=>{v(),h(!0)},onMouseLeave:w,children:[f.jsx(Sn,{variant:"ghost",size:"icon",onClick:()=>h(E=>!E),className:se("h-8 w-8 rounded-sm",o!==$o||u!==jr?"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-lg border border-border/70 bg-popover/95 p-2.5 text-popover-foreground shadow-[0_28px_90px_-34px_rgba(0,0,0,0.45)] backdrop-blur-xl sm:absolute sm:left-auto sm:right-0 sm:top-[calc(100%+6px)] sm:w-[28rem] sm:max-w-[28rem]",children:[f.jsxs("div",{className:"mb-2.5 flex items-end justify-between gap-3",children:[f.jsxs("div",{children:[f.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-[0.2em] text-muted-foreground",children:"Appearance"}),f.jsxs("div",{className:"text-[11px] font-medium text-foreground",children:[O3(u)," / ",D3(o)]})]}),f.jsx("div",{className:"rounded-sm border border-border/60 bg-background/70 px-2 py-0.5 text-[9px] 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.5 grid grid-cols-3 gap-1 rounded-sm bg-muted/35 p-1",children:j3.map(({value:E,label:C,icon:N})=>{const T=n===E;return f.jsxs("button",{type:"button",onClick:()=>l(E),role:"menuitemradio","aria-checked":T,className:se("flex min-h-[2.5rem] flex-col items-center justify-center gap-0.5 rounded-sm border px-2 py-1.5 text-[10px] font-medium transition-colors",T?"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(N,{className:"h-3.5 w-3.5"}),C]},E)})}),f.jsxs("div",{className:"grid gap-3 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:Qx.map(({value:E,label:C,hint:N})=>{const T=u===E;return f.jsxs("button",{type:"button",onClick:()=>d(E),role:"menuitemradio","aria-checked":T,className:se("flex min-h-[2.75rem] w-full items-center gap-2 rounded-sm border px-2 py-1.5 text-left transition-colors",T?"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:se("text-[11px] font-medium leading-tight",T?"text-primary":"text-foreground"),children:C}),f.jsx("div",{className:"mt-0.5 text-[9px] leading-tight text-muted-foreground",children:N})]}),T&&f.jsx(_s,{className:"h-3 w-3 text-primary"})]},E)})})]}),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(SN,{className:"h-2.5 w-2.5"}),"Palette"]}),f.jsx("div",{className:"space-y-1",children:Px.map(({value:E,label:C,hint:N})=>{const T=o===E;return f.jsxs("button",{type:"button",onClick:()=>i(E),role:"menuitemradio","aria-checked":T,className:se("flex min-h-[2.75rem] w-full items-center gap-2 rounded-sm border px-2 py-1.5 text-left transition-colors",T?"border-primary/55 bg-primary/10":"border-border/45 bg-background/45 hover:border-border hover:bg-muted/55"),children:[f.jsx(k3,{value:E}),f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("div",{className:se("text-[11px] font-medium leading-tight",T?"text-primary":"text-foreground"),children:C}),f.jsx("div",{className:"mt-0.5 text-[9px] leading-tight text-muted-foreground",children:N})]}),T&&f.jsx(_s,{className:"h-3 w-3 text-primary"})]},E)})})]})]})]})]})}function O3(n){var l;return((l=Qx.find(o=>o.value===n))==null?void 0:l.label)??n}function D3(n){var l;return((l=Px.find(o=>o.value===n))==null?void 0:l.label)??n}function k3({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%)"]},[o,i,u]=l[n];return f.jsxs("div",{className:se("flex h-6 w-6 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:u}})]})}function z3(){const{cluster:n,events:l,sseConnected:o}=S0(),i=Yn(),[u,d]=y.useState(!1),[m,h]=y.useState(""),[g,p]=y.useState(null),x=i.pathname==="/"||/^\/tasks\/[^/]+$/.test(i.pathname),v=y.useMemo(()=>{const E=new Map;for(const C of(n==null?void 0:n.nodes)??[])E.set(C.id,C.name);return n!=null&&n.self&&E.set(n.self.id,n.self.name),E},[n==null?void 0:n.nodes,n==null?void 0:n.self]);async function w(){try{const E=await b0({reason:"restart"});at.info(`Restarting runtime. Follow ${E.logPath} for launch output.`),await Vx({previousPid:E.pid})||at.error("Runtime restart was accepted, but the dashboard did not reconnect before the timeout.")}catch(E){at.error(E instanceof Error?E.message:"Runtime 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:"relative z-50 shrink-0 px-2 py-2",children:f.jsxs("div",{className:"dashboard-panel dashboard-panel-muted animate-panel-settle mx-auto flex max-w-[1760px] items-center gap-0 rounded-lg px-3 py-2",children:[f.jsx("div",{className:"flex shrink-0 items-center gap-3 pr-3",children:f.jsxs(Pd,{to:"/","aria-label":"Meshy home",className:"flex items-center gap-2",children:[f.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-sm border border-primary/20 bg-primary/10 text-primary shadow-sm",children:f.jsx(lN,{className:"h-3.5 w-3.5"})}),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"}),x&&f.jsxs("div",{className:"hidden min-w-0 flex-1 items-center px-3 md:flex",children:[g&&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:()=>h(g.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 ${g.nodeName}`,children:[f.jsx(T0,{className:"h-3 w-3 shrink-0 text-primary/70"}),f.jsx("span",{className:"max-w-[9rem] truncate",children:g.nodeName})]}),f.jsx(Qd,{className:"h-3 w-3 shrink-0 text-border/80"}),f.jsxs("button",{type:"button",onClick:()=>h(g.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:g.projectPath,children:[f.jsx(IE,{className:"h-3 w-3 shrink-0 text-muted-foreground/70"}),f.jsx("span",{className:"max-w-[9rem] truncate",children:g.projectLabel})]}),f.jsx(Qd,{className:"h-3 w-3 shrink-0 text-border/80"}),f.jsx(Pd,{to:`/tasks/${g.taskId}`,className:"min-w-0 truncate px-1 font-medium text-foreground/85 hover:text-foreground",title:g.taskTitle,children:g.taskTitle})]}),f.jsxs("div",{className:"relative ml-auto w-[18rem] max-w-[28rem]",children:[f.jsx(hN,{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(Zf,{"aria-label":"Search tasks",value:m,onChange:E=>h(E.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:[x&&f.jsx(Sn,{variant:"ghost",size:"icon",onClick:()=>d(E=>!E),"aria-label":u?"Close terminal":"Open terminal",title:u?"Close terminal":"Open terminal",className:se("h-8 w-8 rounded-sm text-muted-foreground hover:bg-muted/50 hover:text-foreground",u&&"bg-primary/8 text-primary"),children:f.jsx(A0,{className:"h-4 w-4"})}),f.jsx(G_,{}),f.jsx(M3,{}),f.jsx("div",{className:"mx-0 h-4 w-px shrink-0 bg-border/50"}),f.jsx(m3,{connected:o,events:l,nodes:(n==null?void 0:n.nodes)??[],currentNode:(n==null?void 0:n.self)??null,nodeNameById:v,onRestart:w})]})]})}),f.jsx("main",{className:se("min-h-0 flex-1 px-2 pb-2",x?"overflow-hidden":"overflow-y-auto"),children:f.jsx("div",{className:"mx-auto h-full min-h-0 max-w-[1760px]",children:f.jsx(mw,{context:{terminalOpen:u,setTerminalOpen:d,headerSearchQuery:m,setHeaderSearchQuery:h,setHeaderTaskContext:p}})})})]})]})}const Kv=y.lazy(async()=>({default:(await Fv(()=>import("./DashboardPage-wM8CMREX.js").then(l=>l.D),__vite__mapDeps([0,1,2,3]))).DashboardPage})),L3=y.lazy(async()=>({default:(await Fv(()=>import("./SharedConversationPage-DqPIB4y2.js"),__vite__mapDeps([4,1]))).SharedConversationPage}));function U3(){return f.jsx(Hw,{children:f.jsx(y.Suspense,{fallback:f.jsx(B3,{}),children:f.jsxs(pw,{children:[f.jsx(Cl,{path:"/shared/tasks/:shareId",element:f.jsx(L3,{})}),f.jsxs(Cl,{element:f.jsx(yE,{children:f.jsx(z3,{})}),children:[f.jsx(Cl,{path:"/",element:f.jsx(Kv,{})}),f.jsx(Cl,{path:"/nodes",element:f.jsx(ov,{to:"/",replace:!0})}),f.jsx(Cl,{path:"/tasks",element:f.jsx(ov,{to:"/",replace:!0})}),f.jsx(Cl,{path:"/tasks/:id",element:f.jsx(Kv,{})})]})]})})})}function B3(){return f.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background text-sm text-muted-foreground",children:"Loading workspace..."})}function H3(n){return f.jsx(YC,{className:"toaster group",style:{"--normal-bg":"hsl(var(--popover))","--normal-text":"hsl(var(--popover-foreground))","--normal-border":"hsl(var(--border))"},...n})}h2.createRoot(document.getElementById("root")).render(f.jsx(y.StrictMode,{children:f.jsxs(C3,{children:[f.jsx(U3,{}),f.jsx(H3,{})]})}));export{$s as $,My as A,Sn as B,_s as C,kj as D,Jj as E,KE as F,YE as G,I_ as H,Zf as I,Z_ as J,E0 as K,qA as L,pt as M,Oj as N,cx as O,Dj as P,Ts as Q,Zj as R,T0 as S,zj as T,Bs as U,sf as V,Hs as W,_0 as X,Vs as Y,Ys as Z,qs as _,QC as a,dj as a$,Xs as a0,Gs as a1,Fv as a2,G3 as a3,jy as a4,M5 as a5,aj as a6,A0 as a7,Ho as a8,VE as a9,jj as aA,_j as aB,hE as aC,mj as aD,K3 as aE,P3 as aF,Oy as aG,Q3 as aH,Z3 as aI,eE as aJ,G_ as aK,hj as aL,pj as aM,$3 as aN,Yn as aO,s0 as aP,V3 as aQ,S0 as aR,Xj as aS,qj as aT,Hj as aU,Vj as aV,Yj as aW,$j as aX,oj as aY,Lj as aZ,Q_ as a_,nj as aa,lj as ab,tj as ac,vN as ad,eN as ae,Gj as af,sN as ag,n3 as ah,l_ as ai,PE as aj,r_ as ak,Ij as al,P_ as am,Fj as an,Uj as ao,Bj as ap,Ux as aq,Qj as ar,Pj as as,Kj as at,cf as au,gj as av,vj as aw,rj as ax,dE as ay,rE as az,se as b,fj as b0,uj as b1,cj as b2,q3 as b3,X3 as b4,Y3 as b5,I3 as b6,wj as b7,Sj as b8,xj as b9,yj as ba,bj as bb,Ej as bc,X_ as bd,Zv as be,zE as bf,Tj as bg,Cj as bh,Nj as bi,uN as bj,Rj as bk,Mj as bl,Aj as bm,ze as c,P0 as d,ej as e,Ww as f,J3 as g,F3 as h,IE as i,f as j,Qd as k,Nr as l,W3 as m,sj as n,Vb as o,Gf as p,$b as q,y as r,Xf as s,at as t,hN as u,Zs as v,SN as w,ij as x,A5 as y,_y as z};