@hivemagnus/magnus-ui 1.1.4 → 1.1.7

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.
Files changed (144) hide show
  1. package/dist/app/apps/dashboard/.next/BUILD_ID +1 -1
  2. package/dist/app/apps/dashboard/.next/build-manifest.json +3 -3
  3. package/dist/app/apps/dashboard/.next/prerender-manifest.json +3 -3
  4. package/dist/app/apps/dashboard/.next/required-server-files.json +2 -2
  5. package/dist/app/apps/dashboard/.next/server/app/_global-error.html +1 -1
  6. package/dist/app/apps/dashboard/.next/server/app/_global-error.rsc +1 -1
  7. package/dist/app/apps/dashboard/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  8. package/dist/app/apps/dashboard/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  9. package/dist/app/apps/dashboard/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  10. package/dist/app/apps/dashboard/.next/server/app/_not-found/page.js.nft.json +1 -1
  11. package/dist/app/apps/dashboard/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  12. package/dist/app/apps/dashboard/.next/server/app/anomalies/[anomalyId]/page.js.nft.json +1 -1
  13. package/dist/app/apps/dashboard/.next/server/app/anomalies/[anomalyId]/page_client-reference-manifest.js +1 -1
  14. package/dist/app/apps/dashboard/.next/server/app/anomalies/page.js.nft.json +1 -1
  15. package/dist/app/apps/dashboard/.next/server/app/anomalies/page_client-reference-manifest.js +1 -1
  16. package/dist/app/apps/dashboard/.next/server/app/anomalies/remediation/page.js.nft.json +1 -1
  17. package/dist/app/apps/dashboard/.next/server/app/anomalies/remediation/page_client-reference-manifest.js +1 -1
  18. package/dist/app/apps/dashboard/.next/server/app/api-docs/page.js.nft.json +1 -1
  19. package/dist/app/apps/dashboard/.next/server/app/api-docs/page_client-reference-manifest.js +1 -1
  20. package/dist/app/apps/dashboard/.next/server/app/application-operations/page.js.nft.json +1 -1
  21. package/dist/app/apps/dashboard/.next/server/app/application-operations/page_client-reference-manifest.js +1 -1
  22. package/dist/app/apps/dashboard/.next/server/app/ardent/installations/page.js.nft.json +1 -1
  23. package/dist/app/apps/dashboard/.next/server/app/ardent/installations/page_client-reference-manifest.js +1 -1
  24. package/dist/app/apps/dashboard/.next/server/app/ardent/page.js.nft.json +1 -1
  25. package/dist/app/apps/dashboard/.next/server/app/ardent/page_client-reference-manifest.js +1 -1
  26. package/dist/app/apps/dashboard/.next/server/app/ardent/profiles/[id]/page.js.nft.json +1 -1
  27. package/dist/app/apps/dashboard/.next/server/app/ardent/profiles/[id]/page_client-reference-manifest.js +1 -1
  28. package/dist/app/apps/dashboard/.next/server/app/ardent/profiles/page.js.nft.json +1 -1
  29. package/dist/app/apps/dashboard/.next/server/app/ardent/profiles/page_client-reference-manifest.js +1 -1
  30. package/dist/app/apps/dashboard/.next/server/app/audit/page.js.nft.json +1 -1
  31. package/dist/app/apps/dashboard/.next/server/app/audit/page_client-reference-manifest.js +1 -1
  32. package/dist/app/apps/dashboard/.next/server/app/codex/installations/page.js.nft.json +1 -1
  33. package/dist/app/apps/dashboard/.next/server/app/codex/installations/page_client-reference-manifest.js +1 -1
  34. package/dist/app/apps/dashboard/.next/server/app/codex/page.js.nft.json +1 -1
  35. package/dist/app/apps/dashboard/.next/server/app/codex/page_client-reference-manifest.js +1 -1
  36. package/dist/app/apps/dashboard/.next/server/app/commands/page.js.nft.json +1 -1
  37. package/dist/app/apps/dashboard/.next/server/app/commands/page_client-reference-manifest.js +1 -1
  38. package/dist/app/apps/dashboard/.next/server/app/cron/page/server-reference-manifest.json +1 -1
  39. package/dist/app/apps/dashboard/.next/server/app/cron/page.js.nft.json +1 -1
  40. package/dist/app/apps/dashboard/.next/server/app/cron/page_client-reference-manifest.js +1 -1
  41. package/dist/app/apps/dashboard/.next/server/app/files/page.js.nft.json +1 -1
  42. package/dist/app/apps/dashboard/.next/server/app/files/page_client-reference-manifest.js +1 -1
  43. package/dist/app/apps/dashboard/.next/server/app/fleet-map/page.js.nft.json +1 -1
  44. package/dist/app/apps/dashboard/.next/server/app/fleet-map/page_client-reference-manifest.js +1 -1
  45. package/dist/app/apps/dashboard/.next/server/app/fleet-readiness/page.js.nft.json +1 -1
  46. package/dist/app/apps/dashboard/.next/server/app/fleet-readiness/page_client-reference-manifest.js +1 -1
  47. package/dist/app/apps/dashboard/.next/server/app/fleet-timeline/page.js.nft.json +1 -1
  48. package/dist/app/apps/dashboard/.next/server/app/fleet-timeline/page_client-reference-manifest.js +1 -1
  49. package/dist/app/apps/dashboard/.next/server/app/governor/operations/page.js.nft.json +1 -1
  50. package/dist/app/apps/dashboard/.next/server/app/governor/operations/page_client-reference-manifest.js +1 -1
  51. package/dist/app/apps/dashboard/.next/server/app/governor/share/[token]/page.js.nft.json +1 -1
  52. package/dist/app/apps/dashboard/.next/server/app/governor/share/[token]/page_client-reference-manifest.js +1 -1
  53. package/dist/app/apps/dashboard/.next/server/app/hermes-drift/page.js.nft.json +1 -1
  54. package/dist/app/apps/dashboard/.next/server/app/hermes-drift/page_client-reference-manifest.js +1 -1
  55. package/dist/app/apps/dashboard/.next/server/app/hermes-security/page.js.nft.json +1 -1
  56. package/dist/app/apps/dashboard/.next/server/app/hermes-security/page_client-reference-manifest.js +1 -1
  57. package/dist/app/apps/dashboard/.next/server/app/incidents/page.js.nft.json +1 -1
  58. package/dist/app/apps/dashboard/.next/server/app/incidents/page_client-reference-manifest.js +1 -1
  59. package/dist/app/apps/dashboard/.next/server/app/library/page.js.nft.json +1 -1
  60. package/dist/app/apps/dashboard/.next/server/app/library/page_client-reference-manifest.js +1 -1
  61. package/dist/app/apps/dashboard/.next/server/app/login/page.js.nft.json +1 -1
  62. package/dist/app/apps/dashboard/.next/server/app/login/page_client-reference-manifest.js +1 -1
  63. package/dist/app/apps/dashboard/.next/server/app/logs/page.js.nft.json +1 -1
  64. package/dist/app/apps/dashboard/.next/server/app/logs/page_client-reference-manifest.js +1 -1
  65. package/dist/app/apps/dashboard/.next/server/app/mission-control/page.js +1 -1
  66. package/dist/app/apps/dashboard/.next/server/app/mission-control/page.js.nft.json +1 -1
  67. package/dist/app/apps/dashboard/.next/server/app/mission-control/page_client-reference-manifest.js +1 -1
  68. package/dist/app/apps/dashboard/.next/server/app/nodes/[nodeId]/page.js.nft.json +1 -1
  69. package/dist/app/apps/dashboard/.next/server/app/nodes/[nodeId]/page_client-reference-manifest.js +1 -1
  70. package/dist/app/apps/dashboard/.next/server/app/nodes/page.js.nft.json +1 -1
  71. package/dist/app/apps/dashboard/.next/server/app/nodes/page_client-reference-manifest.js +1 -1
  72. package/dist/app/apps/dashboard/.next/server/app/notifications/page.js.nft.json +1 -1
  73. package/dist/app/apps/dashboard/.next/server/app/notifications/page_client-reference-manifest.js +1 -1
  74. package/dist/app/apps/dashboard/.next/server/app/orchestra/installations/page.js.nft.json +1 -1
  75. package/dist/app/apps/dashboard/.next/server/app/orchestra/installations/page_client-reference-manifest.js +1 -1
  76. package/dist/app/apps/dashboard/.next/server/app/orchestra/page.js.nft.json +1 -1
  77. package/dist/app/apps/dashboard/.next/server/app/orchestra/page_client-reference-manifest.js +1 -1
  78. package/dist/app/apps/dashboard/.next/server/app/orchestra/profiles/page.js.nft.json +1 -1
  79. package/dist/app/apps/dashboard/.next/server/app/orchestra/profiles/page_client-reference-manifest.js +1 -1
  80. package/dist/app/apps/dashboard/.next/server/app/orchestra/web-gateway/page.js.nft.json +1 -1
  81. package/dist/app/apps/dashboard/.next/server/app/orchestra/web-gateway/page_client-reference-manifest.js +1 -1
  82. package/dist/app/apps/dashboard/.next/server/app/page.js.nft.json +1 -1
  83. package/dist/app/apps/dashboard/.next/server/app/page_client-reference-manifest.js +1 -1
  84. package/dist/app/apps/dashboard/.next/server/app/retention/page.js.nft.json +1 -1
  85. package/dist/app/apps/dashboard/.next/server/app/retention/page_client-reference-manifest.js +1 -1
  86. package/dist/app/apps/dashboard/.next/server/app/roles/page.js.nft.json +1 -1
  87. package/dist/app/apps/dashboard/.next/server/app/roles/page_client-reference-manifest.js +1 -1
  88. package/dist/app/apps/dashboard/.next/server/app/rollouts/page.js.nft.json +1 -1
  89. package/dist/app/apps/dashboard/.next/server/app/rollouts/page_client-reference-manifest.js +1 -1
  90. package/dist/app/apps/dashboard/.next/server/app/security-fusion/cases/[caseId]/page.js.nft.json +1 -1
  91. package/dist/app/apps/dashboard/.next/server/app/security-fusion/cases/[caseId]/page_client-reference-manifest.js +1 -1
  92. package/dist/app/apps/dashboard/.next/server/app/security-fusion/cases/page.js.nft.json +1 -1
  93. package/dist/app/apps/dashboard/.next/server/app/security-fusion/cases/page_client-reference-manifest.js +1 -1
  94. package/dist/app/apps/dashboard/.next/server/app/security-fusion/entities/page.js.nft.json +1 -1
  95. package/dist/app/apps/dashboard/.next/server/app/security-fusion/entities/page_client-reference-manifest.js +1 -1
  96. package/dist/app/apps/dashboard/.next/server/app/security-fusion/events/page.js.nft.json +1 -1
  97. package/dist/app/apps/dashboard/.next/server/app/security-fusion/events/page_client-reference-manifest.js +1 -1
  98. package/dist/app/apps/dashboard/.next/server/app/security-fusion/evidence/page.js.nft.json +1 -1
  99. package/dist/app/apps/dashboard/.next/server/app/security-fusion/evidence/page_client-reference-manifest.js +1 -1
  100. package/dist/app/apps/dashboard/.next/server/app/security-fusion/page.js.nft.json +1 -1
  101. package/dist/app/apps/dashboard/.next/server/app/security-fusion/page_client-reference-manifest.js +1 -1
  102. package/dist/app/apps/dashboard/.next/server/app/security-fusion/policies/page.js.nft.json +1 -1
  103. package/dist/app/apps/dashboard/.next/server/app/security-fusion/policies/page_client-reference-manifest.js +1 -1
  104. package/dist/app/apps/dashboard/.next/server/app/security-fusion/sources/page.js.nft.json +1 -1
  105. package/dist/app/apps/dashboard/.next/server/app/security-fusion/sources/page_client-reference-manifest.js +1 -1
  106. package/dist/app/apps/dashboard/.next/server/app/skills/page/server-reference-manifest.json +1 -1
  107. package/dist/app/apps/dashboard/.next/server/app/skills/page.js.nft.json +1 -1
  108. package/dist/app/apps/dashboard/.next/server/app/skills/page_client-reference-manifest.js +1 -1
  109. package/dist/app/apps/dashboard/.next/server/app/webhooks/[id]/page.js.nft.json +1 -1
  110. package/dist/app/apps/dashboard/.next/server/app/webhooks/[id]/page_client-reference-manifest.js +1 -1
  111. package/dist/app/apps/dashboard/.next/server/app/webhooks/new/page.js.nft.json +1 -1
  112. package/dist/app/apps/dashboard/.next/server/app/webhooks/new/page_client-reference-manifest.js +1 -1
  113. package/dist/app/apps/dashboard/.next/server/app/webhooks/page.js.nft.json +1 -1
  114. package/dist/app/apps/dashboard/.next/server/app/webhooks/page_client-reference-manifest.js +1 -1
  115. package/dist/app/apps/dashboard/.next/server/chunks/[root-of-the-server]__13sz5u4ns29is._.js +1 -1
  116. package/dist/app/apps/dashboard/.next/server/chunks/ssr/[root-of-the-server]__08sgyyf_y8ab8._.js +1 -1
  117. package/dist/app/apps/dashboard/.next/server/chunks/ssr/{[root-of-the-server]__0rdhprzu2tmon._.js → [root-of-the-server]__0xet7wknh2e3e._.js} +1 -1
  118. package/dist/app/apps/dashboard/.next/server/chunks/ssr/[root-of-the-server]__11pe-l2-ko65_._.js +1 -1
  119. package/dist/app/apps/dashboard/.next/server/chunks/ssr/[root-of-the-server]__1xjrbdi2jn6ud._.js +1 -1
  120. package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_0gs_s688kgg1i._.js +1 -1
  121. package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_app_cron_page_tsx_1i3duyygc0_tg._.js +1 -1
  122. package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_app_mission-control_page_tsx_0crgxncex_u3w._.js +1 -1
  123. package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_app_skills_page_tsx_0n5zp4xad38in._.js +1 -1
  124. package/dist/app/apps/dashboard/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_icons_refresh-ccw-dot_mjs_0v31ayeyeyyf8._.js +1 -1
  125. package/dist/app/apps/dashboard/.next/server/middleware-build-manifest.js +3 -3
  126. package/dist/app/apps/dashboard/.next/server/pages/500.html +1 -1
  127. package/dist/app/apps/dashboard/.next/server/preview-props.json +3 -3
  128. package/dist/app/apps/dashboard/.next/server/server-reference-manifest.js +1 -1
  129. package/dist/app/apps/dashboard/.next/server/server-reference-manifest.json +3 -3
  130. package/dist/app/apps/dashboard/.next/static/chunks/{39c6t_gt5j746.js → 0-fbsib18f6km.js} +1 -1
  131. package/dist/app/apps/dashboard/.next/static/chunks/{16_8wa1m1ffmd.js → 0wo6trc5_gttd.js} +1 -1
  132. package/dist/app/apps/dashboard/.next/static/chunks/{05cz-n3dflda8.js → 1_dc7qj6cn34y.js} +1 -1
  133. package/dist/app/apps/dashboard/.next/static/chunks/{17p8kp_-gsxp0.js → 24_bnj8-fuljn.js} +1 -1
  134. package/dist/app/apps/dashboard/.next/static/chunks/27f2f2ypobqqa.js +1 -0
  135. package/dist/app/apps/dashboard/.next/static/chunks/{422r_9lx6bvwu.js → 2ksz5ltjd7lss.js} +1 -1
  136. package/dist/app/apps/dashboard/.next/static/chunks/{2b5d1hl5rnwmi.js → 2s1i7240_wcjd.js} +1 -1
  137. package/dist/app/apps/dashboard/.next/static/chunks/{43f5keprbd6za.js → 2sfdhjtoymdjj.js} +1 -1
  138. package/dist/app/apps/dashboard/package.json +2 -2
  139. package/dist/app/apps/dashboard/server.js +1 -1
  140. package/package.json +2 -2
  141. package/dist/app/apps/dashboard/.next/static/chunks/3glqu0wgtdqyv.js +0 -1
  142. /package/dist/app/apps/dashboard/.next/static/{yoKjJcLs0SBAslui78EBu → -r8zG5WnRLHqMUdek8Ln2}/_buildManifest.js +0 -0
  143. /package/dist/app/apps/dashboard/.next/static/{yoKjJcLs0SBAslui78EBu → -r8zG5WnRLHqMUdek8Ln2}/_clientMiddlewareManifest.js +0 -0
  144. /package/dist/app/apps/dashboard/.next/static/{yoKjJcLs0SBAslui78EBu → -r8zG5WnRLHqMUdek8Ln2}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- (()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,57108,e=>{var r=e.i(43476),t=e.i(46670);e.s(["f",0,function({configuration:e}){if(e?.memoryProvider!=="hivemem")return null;let a=e.hiveMemToken,n=a?.status??"unknown";return(0,r.jsxs)("span",{className:"flex flex-wrap items-center gap-1.5",children:[(0,r.jsxs)(t.t,{variant:"valid"===n?"success":"expiring"===n||"unreachable"===n||"unknown"===n?"warning":"danger",children:["Token ",n]}),a?.expiresAt&&(0,r.jsxs)("time",{dateTime:a.expiresAt,title:"HiveMem token expiration",children:["expires ",new Date(a.expiresAt).toLocaleString()]}),a?.checkedAt&&(0,r.jsxs)("time",{dateTime:a.checkedAt,className:"text-text-muted/70",title:"Last HiveMem authentication check",children:["checked ",new Date(a.checkedAt).toLocaleString()]})]})}])},46670,e=>{var r=e.i(43476),t=e.i(78571);let a={default:"border-border text-text-muted",success:"border-success/40 text-success bg-success/5 shadow-[0_0_6px_rgba(0,255,65,0.15)]",warning:"border-warning/40 text-warning bg-warning/5 shadow-[0_0_6px_rgba(255,179,0,0.15)]",danger:"border-danger/40 text-danger bg-danger/5 shadow-[0_0_6px_rgba(255,23,68,0.15)]",info:"border-info/40 text-info bg-info/5 shadow-[0_0_6px_rgba(0,176,255,0.15)]"},n={default:"bg-text-muted",success:"bg-success",warning:"bg-warning",danger:"bg-danger",info:"bg-info"};e.s(["t",0,function({children:e,variant:s="default",className:l,dot:i=!1,pulse:o=!1}){return(0,r.jsxs)("span",{className:(0,t.f)("inline-flex items-center gap-1.5 rounded-chip border px-2 py-0.5 text-[10px] font-bold uppercase tracking-wider",a[s],l),children:[i&&(0,r.jsxs)("span",{"aria-hidden":"true",className:"relative inline-flex h-1.5 w-1.5",children:[o&&(0,r.jsx)("span",{className:(0,t.f)("absolute inset-0 rounded-full animate-halo",n[s])}),(0,r.jsx)("span",{className:(0,t.f)("relative inline-flex h-1.5 w-1.5 rounded-full",n[s])})]}),e]})},"k",0,function(e){switch(e.toUpperCase()){case"ONLINE":case"COMPLETED":case"ACTIVE":case"RUNNING":case"INSTALLED":case"HEALTHY":return"success";case"DEGRADED":case"PAUSED":case"QUEUED":case"PENDING":case"INSTALLING":return"warning";case"OFFLINE":case"FAILED":case"ERROR":case"TIMEOUT":case"CANCELLED":case"DECOMMISSIONED":case"CRITICAL":return"danger";case"PROVISIONING":case"UPDATING":return"info";default:return"default"}}])},93999,51196,55427,e=>{var r=e.i(43476),t=e.i(56420);let a={name:"arrow-down-right",size:24,node:[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]]};a.node;let n=(0,t.f)(a);var s=e.i(75775),l=e.i(78571),i=e.i(3062),o=e.i(35084);let c={warning:"shadow-[0_0_6px_var(--color-warning)]",danger:"shadow-[0_0_8px_var(--color-danger)]",accent:"shadow-[0_0_6px_var(--color-accent)]",primary:"shadow-[0_0_6px_var(--color-primary)]"},d={xs:"h-1",sm:"h-1.5",md:"h-2"};function u({value:e,max:t=100,tone:a,thresholds:n=o.q,label:s,size:i="xs",showValue:x=!1,valueLabel:h,glow:m,className:f,testId:p}){let g="number"==typeof e&&Number.isFinite(e),v=g?Math.max(0,Math.min(100,e/(t||1)*100)):0,b=a??(g?(0,o.Z)(v,n):"muted"),j=m||!a&&g&&v>=n.warn,y=h??(g?`${v.toFixed(+(v<10&&v>0))}%`:"—");return(0,r.jsxs)("div",{className:(0,l.f)("flex min-w-0 items-center gap-2",f),"data-testid":p,children:[(0,r.jsx)("div",{role:"meter","aria-label":s,"aria-valuemin":0,"aria-valuemax":t,"aria-valuenow":g?e:void 0,"aria-valuetext":y,className:(0,l.f)("relative flex-1 overflow-hidden rounded-full bg-border/70",d[i]),children:(0,r.jsx)("div",{style:{"--meter":`${v}%`},className:(0,l.f)("h-full w-(--meter) rounded-full transition-[width] duration-700 ease-out-expo starting:w-0",o.H[b],j&&c[b])})}),x&&(0,r.jsx)("span",{className:(0,l.f)("num w-11 shrink-0 text-right text-[11px]",g?o.T[b]:"text-text-muted"),children:y})]})}e.s(["f",0,u],51196);var x=e.i(71645);function h({values:e,tone:t="primary",width:a=160,height:n=32,area:s=!0,max:i,percent:c=!1,threshold:d,live:u=!0,emptyLabel:m="not enough data",className:f,testId:p,label:g,stretch:v=!1}){let b=`spark${(0,x.useId)().replace(/:/g,"")}`;if(e.length<2)return(0,r.jsx)("div",{className:(0,l.f)("flex h-8 items-center text-xs italic text-text-muted",f),"data-testid":p,children:m});let j=o.v[t],y=i??(c?Math.max(100,...e):Math.max(...e,d??0)||1),N=n-4,w=a/(e.length-1),k=e=>2+N-Math.max(0,e)/y*N,_=e.map((e,r)=>[r*w,k(e)]),M=_.map(([e,r])=>`${e.toFixed(1)},${r.toFixed(1)}`).join(" "),S=_[_.length-1];return(0,r.jsxs)("svg",{width:v?"100%":a,height:n,viewBox:`0 0 ${a} ${n}`,preserveAspectRatio:v?"none":void 0,className:(0,l.f)("block overflow-visible",f),"data-testid":p,role:g?"img":void 0,"aria-label":g,"aria-hidden":!g||void 0,children:[s&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("defs",{children:(0,r.jsxs)("linearGradient",{id:b,x1:"0",x2:"0",y1:"0",y2:"1",children:[(0,r.jsx)("stop",{offset:"0%",stopColor:j,stopOpacity:.35}),(0,r.jsx)("stop",{offset:"100%",stopColor:j,stopOpacity:0})]})}),(0,r.jsx)("polygon",{points:`0,${n} ${M} ${a},${n}`,fill:`url(#${b})`})]}),void 0!==d&&(0,r.jsx)("line",{x1:0,x2:a,y1:k(d),y2:k(d),stroke:"var(--color-warning)",strokeOpacity:.5,strokeDasharray:"3 3",strokeWidth:1}),(0,r.jsx)("polyline",{fill:"none",stroke:j,strokeWidth:1.5,vectorEffect:"non-scaling-stroke",strokeLinejoin:"round",strokeLinecap:"round",points:M}),u&&!v&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("circle",{cx:S[0],cy:S[1],r:2.5,fill:j,className:"origin-center animate-halo [transform-box:fill-box]"}),(0,r.jsx)("circle",{cx:S[0],cy:S[1],r:2,fill:j})]})]})}e.s(["f",0,h],55427),e.s(["N",0,function({title:e,description:t,children:a,className:n,action:s,tone:l,corners:o=!1,...c}){return(0,r.jsx)(i.f,{...c,tone:l,corners:o,title:e,description:t,action:s,className:n,children:a})},"n",0,function({label:e,value:t,icon:a,trend:c,spark:d,meter:x,delta:m,tone:f="primary",className:p,testId:g}){let v=!m||m.value>=0===(m.positiveIsGood??!0);return(0,r.jsxs)(i.f,{tone:f,className:(0,l.f)("overflow-hidden",p),testId:g,children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("span",{className:"text-[10px] font-medium uppercase tracking-[0.15em] text-text-muted",children:e}),a&&(0,r.jsx)("span",{className:"text-primary/60",children:a})]}),(0,r.jsxs)("div",{className:"mt-2 flex items-end justify-between gap-2",children:[(0,r.jsx)("div",{className:(0,l.f)("num text-2xl font-bold","primary"===f?"text-primary neon-text":o.T[f]),children:t}),m&&0!==m.value&&(0,r.jsxs)("span",{className:(0,l.f)("num mb-1 inline-flex items-center gap-0.5 text-[11px]",v?"text-success":"text-danger"),children:[m.value>0?(0,r.jsx)(s.f,{className:"h-3 w-3"}):(0,r.jsx)(n,{className:"h-3 w-3"}),Math.abs(m.value).toFixed(+!Number.isInteger(m.value)),m.unit]})]}),c&&(0,r.jsx)("div",{className:(0,l.f)("mt-1 text-[11px]",c.positive?"text-success":"text-danger"),children:c.value}),void 0!==x&&(0,r.jsx)(u,{value:x,className:"mt-3",label:e}),d&&d.length>1&&(0,r.jsx)("div",{className:"-mx-5 -mb-5 mt-3 opacity-80",children:(0,r.jsx)(h,{values:d,tone:f,width:240,height:28,stretch:!0,live:!1})})]})}],93999)},54149,21176,e=>{var r=e.i(43476),t=e.i(71645),a=e.i(78571),n=e.i(35084);e.s(["f",0,function({value:e,max:s=100,label:l,sublabel:i,tone:o,thresholds:c=n.q,higherIsBetter:d=!1,size:u=140,display:x,ticks:h=!0,hideLabel:m=!1,className:f,testId:p}){let g=(0,t.useId)().replace(/:/g,""),v="number"==typeof e&&Number.isFinite(e),b=v?Math.max(0,Math.min(100,e/(s||1)*100)):0,j=o??(v?d?(0,n.Z)(100-b,c):(0,n.Z)(b,c):"muted"),y=Math.max(4,Math.round(u/16)),N=50-y/2-4,w=2*Math.PI*N,k=.75*w,_=k*b/100,M=u>=140,S=x??(v?`${Math.round(b)}%`:"—"),C=h?Array.from({length:11},(e,t)=>{let a=(135+270*t/10)*Math.PI/180,n=50-(t%5==0?4:2.5);return(0,r.jsx)("line",{x1:50+48.5*Math.cos(a),y1:50+48.5*Math.sin(a),x2:50+n*Math.cos(a),y2:50+n*Math.sin(a),stroke:"var(--color-border-strong)",strokeWidth:.8},t)}):null;return(0,r.jsxs)("div",{role:"img","aria-label":`${l}: ${S}`,"data-testid":p,className:(0,a.f)("relative inline-flex flex-col items-center",f),style:{width:u},children:[(0,r.jsxs)("svg",{viewBox:"0 0 100 100",width:u,height:u,"aria-hidden":"true",className:"overflow-visible",children:[M&&(0,r.jsx)("defs",{children:(0,r.jsxs)("filter",{id:`g${g}`,x:"-30%",y:"-30%",width:"160%",height:"160%",children:[(0,r.jsx)("feGaussianBlur",{stdDeviation:"2.2",result:"blur"}),(0,r.jsxs)("feMerge",{children:[(0,r.jsx)("feMergeNode",{in:"blur"}),(0,r.jsx)("feMergeNode",{in:"SourceGraphic"})]})]})}),C,(0,r.jsx)("circle",{cx:50,cy:50,r:N,fill:"none",stroke:"var(--color-border)",strokeWidth:y,strokeLinecap:"round",strokeDasharray:`${k} ${w}`,transform:"rotate(135 50 50)"}),(0,r.jsx)("circle",{cx:50,cy:50,r:N,fill:"none",stroke:n.v[j],strokeWidth:y,strokeLinecap:"round",transform:"rotate(135 50 50)",filter:M?`url(#g${g})`:void 0,style:{"--dash":`${_} ${w}`},className:"[stroke-dasharray:var(--dash)] transition-[stroke-dasharray] duration-1000 ease-out-expo starting:[stroke-dasharray:0_1000]"})]}),(0,r.jsxs)("div",{className:"pointer-events-none absolute inset-0 flex flex-col items-center justify-center",style:{height:u},children:[(0,r.jsx)("span",{className:(0,a.f)("num font-bold leading-none",n.T[j],M&&n.z[j]),style:{fontSize:Math.max(12,.2*u)},children:S}),i&&(0,r.jsx)("span",{className:"num mt-1 text-text-muted",style:{fontSize:Math.max(9,.075*u)},children:i})]}),!m&&(0,r.jsx)("span",{className:"-mt-[10%] text-center text-[10px] font-medium uppercase tracking-[0.15em] text-text-muted",children:l})]})}],54149);var s=e.i(70703),l=e.i(65369);let i=(0,s.default)(()=>e.A(1321),{loadableGenerated:{modules:[69944]},ssr:!1,loading:()=>(0,r.jsx)(l.l,{className:"h-[180px] w-full"})});e.s(["f",0,i],21176)},3062,e=>{var r=e.i(43476),t=e.i(78571),a=e.i(35084);let n={primary:"[--panel-corner-color:color-mix(in_srgb,var(--color-primary)_60%,transparent)]",accent:"[--panel-corner-color:color-mix(in_srgb,var(--color-accent)_70%,transparent)]",success:"[--panel-corner-color:color-mix(in_srgb,var(--color-success)_60%,transparent)]",warning:"[--panel-corner-color:color-mix(in_srgb,var(--color-warning)_70%,transparent)]",danger:"[--panel-corner-color:color-mix(in_srgb,var(--color-danger)_70%,transparent)]",info:"[--panel-corner-color:color-mix(in_srgb,var(--color-info)_60%,transparent)]",muted:"[--panel-corner-color:var(--color-border-strong)]"},s={primary:"[--glow-hover-color:var(--color-glow)]",accent:"[--glow-hover-color:var(--color-glow-accent)]",success:"[--glow-hover-color:var(--color-glow-success)]",warning:"[--glow-hover-color:var(--color-glow-warning)]",danger:"[--glow-hover-color:var(--color-glow-danger)]",info:"[--glow-hover-color:var(--color-glow)]",muted:"[--glow-hover-color:var(--color-glow)]"},l={primary:"hover:border-primary/30",accent:"hover:border-accent/40",success:"hover:border-success/30",warning:"hover:border-warning/40",danger:"hover:border-danger/40",info:"hover:border-info/30",muted:"hover:border-border-strong"},i={none:"",sm:"p-3",md:"p-5",lg:"p-6"};e.s(["f",0,function({tone:e="primary",corners:o=!0,interactive:c=!0,hero:d=!1,title:u,description:x,icon:h,action:m,as:f="div",padding:p="md",testId:g,className:v,children:b,...j}){return(0,r.jsxs)(f,{...j,"data-testid":g??j["data-testid"],className:(0,t.f)("relative rounded-panel border border-border bg-surface transition-colors duration-300",i[p],o&&"panel-corners",o&&n[e],c&&"glow-hover",c&&s[e],c&&l[e],d&&"grid-bg overflow-hidden bg-surface/80",v),children:[(u||m||h)&&(0,r.jsxs)("div",{className:"mb-4 flex items-start justify-between gap-3",children:[(0,r.jsxs)("div",{className:"flex min-w-0 items-start gap-2",children:[h&&(0,r.jsx)("span",{className:(0,t.f)("mt-0.5 shrink-0",a.T[e]),children:h}),(0,r.jsxs)("div",{className:"min-w-0",children:[u&&(0,r.jsx)("h3",{className:"text-xs font-bold uppercase tracking-wider",children:u}),x&&(0,r.jsx)("p",{className:"mt-0.5 text-[11px] text-text-muted",children:x})]})]}),m]}),b]})}])},65369,e=>{var r=e.i(43476),t=e.i(78571);function a({className:e}){return(0,r.jsx)("div",{"aria-hidden":"true",className:(0,t.f)("skeleton h-3 w-full",e)})}e.s(["l",0,a,"g",0,function({count:e=4,className:n}){return(0,r.jsx)("div",{role:"status","aria-label":"Loading",className:(0,t.f)("grid gap-4 sm:grid-cols-2 lg:grid-cols-4",n),children:Array.from({length:e},(e,t)=>(0,r.jsxs)("div",{className:"panel-corners rounded-panel border border-border bg-surface p-5",children:[(0,r.jsx)(a,{className:"h-2 w-1/2"}),(0,r.jsx)(a,{className:"mt-4 h-7 w-2/3"}),(0,r.jsx)(a,{className:"mt-3 h-1 w-full opacity-60"})]},t))})},"F",0,function({rows:e=5,cols:n=4,className:s}){return(0,r.jsxs)("div",{role:"status","aria-label":"Loading",className:(0,t.f)("overflow-hidden rounded-panel border border-border",s),children:[(0,r.jsx)("div",{className:"flex gap-4 border-b border-border bg-surface px-4 py-3",children:Array.from({length:n},(e,t)=>(0,r.jsx)(a,{className:"h-2 flex-1 opacity-60"},t))}),Array.from({length:e},(e,s)=>(0,r.jsx)("div",{className:"flex gap-4 border-b border-border/50 px-4 py-3 last:border-0",children:Array.from({length:n},(e,n)=>(0,r.jsx)(a,{className:(0,t.f)("h-3 flex-1",(s+n)%3==0&&"max-w-[60%]")},n))},s))]})},"Q",0,function({lines:e=3,className:n}){let s=["w-full","w-11/12","w-4/5","w-2/3","w-3/4"];return(0,r.jsx)("div",{role:"status","aria-label":"Loading",className:(0,t.f)("space-y-2",n),children:Array.from({length:e},(e,t)=>(0,r.jsx)(a,{className:s[t%s.length]},t))})}])},75723,e=>{var r=e.i(43476),t=e.i(78571),a=e.i(46670);let n={success:"bg-success shadow-[0_0_6px_var(--color-success)]",warning:"bg-warning shadow-[0_0_6px_var(--color-warning)]",danger:"bg-danger shadow-[0_0_6px_var(--color-danger)]",info:"bg-info shadow-[0_0_6px_var(--color-info)]",default:"bg-text-muted"},s={success:"bg-success",warning:"bg-warning",danger:"bg-danger",info:"bg-info",default:"bg-text-muted"},l=new Set(["ONLINE","RUNNING","ACTIVE","HEALTHY","CRITICAL","UPDATING","PROVISIONING"]);e.s(["f",0,function({status:e,pulse:i,size:o="sm",className:c,label:d}){let u=(0,a.k)(e),x=i??l.has(e.toUpperCase()),h="xs"===o?"h-1.5 w-1.5":"h-2 w-2";return(0,r.jsxs)("span",{className:(0,t.f)("relative inline-flex shrink-0",h,c),role:d?"img":void 0,"aria-label":d,"aria-hidden":!d||void 0,children:[x&&(0,r.jsx)("span",{className:(0,t.f)("absolute inset-0 rounded-full animate-halo",s[u])}),(0,r.jsx)("span",{className:(0,t.f)("relative inline-flex rounded-full",h,n[u])})]})}])},71417,e=>{e.s(["L",0,function(e){if(0===e)return"0 B";let r=Math.floor(Math.log(e)/Math.log(1024));return`${parseFloat((e/Math.pow(1024,r)).toFixed(1))} ${["B","KB","MB","GB","TB"][r]}`},"C",0,function(e){return e?("string"==typeof e?new Date(e):e).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"—"}])},79432,e=>{var r=e.i(56420);let t={name:"activity",size:24,node:[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]};t.node;let a=(0,r.f)(t);e.s(["f",0,a],79432)},9347,e=>{var r=e.i(56420);let t={name:"arrow-left",size:24,node:[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]};t.node;let a=(0,r.f)(t);e.s(["f",0,a],9347)},75775,e=>{var r=e.i(56420);let t={name:"arrow-up-right",size:24,node:[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]};t.node;let a=(0,r.f)(t);e.s(["f",0,a],75775)},82022,e=>{var r=e.i(56420);let t={name:"external-link",size:24,node:[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]};t.node;let a=(0,r.f)(t);e.s(["f",0,a],82022)},57665,e=>{var r=e.i(56420);let t={name:"power",size:24,node:[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]};t.node;let a=(0,r.f)(t);e.s(["f",0,a],57665)},86207,14098,e=>{var r=e.i(56420);let t={name:"refresh-ccw-dot",size:24,node:[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]};t.node;let a=(0,r.f)(t);e.s(["f",0,a],86207);var n=e.i(43476),s=e.i(71645),l=e.i(68759),i=e.i(32568),o=e.i(82983),c=e.i(41220),d=e.i(32781);e.s(["E",0,function({open:e,node:r,onClose:t,onSaved:a}){let[u,x]=(0,s.useState)([]),[h,m]=(0,s.useState)(""),[f,p]=(0,s.useState)(!0),[g,v]=(0,s.useState)(!1),[b,j]=(0,s.useState)(""),[y,N]=(0,s.useState)(!1);(0,s.useEffect)(()=>{e&&(j(""),m(r?.role?.id??""),p(!0),N(!0),(async()=>{try{let e=await o.f.roles.list();x(e.data??[])}catch{j("Failed to load roles")}finally{N(!1)}})())},[e,r?.role?.id]);let w=async()=>{if(r){v(!0),j("");try{let e=r.role?.id;e&&e!==h&&await o.f.roles.unassign(e,{nodeIds:[r.id]}),h&&await o.f.roles.assign(h,{nodeIds:[r.id],defer:!f});let n=h?u.find(e=>e.id===h)??null:null;a(n),t()}catch(e){j(e instanceof Error?e.message:"Failed to assign role")}finally{v(!1)}}},k=async()=>{if(r?.role){v(!0),j("");try{await o.f.roles.unassign(r.role.id,{nodeIds:[r.id]}),a(null),t()}catch(e){j(e instanceof Error?e.message:"Failed to unassign role")}finally{v(!1)}}},_=()=>{j(""),v(!1),t()};return(0,n.jsx)(i.n,{open:e,onClose:_,title:r?.role?"Change Role":"Assign Role",description:r?`Node: ${r.name}`:"",icon:(0,n.jsx)(c.f,{className:"h-5 w-5 text-primary"}),children:(0,n.jsxs)("div",{className:"space-y-4",children:[y?(0,n.jsxs)("div",{className:"flex items-center gap-2 py-4 text-xs text-text-muted",children:[(0,n.jsx)(d.f,{className:"h-4 w-4 animate-spin"}),"Loading roles…"]}):0===u.length?(0,n.jsx)("p",{className:"text-xs text-text-muted py-4",children:"No roles found. Create a role first on the Roles page."}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(i.G,{label:"Role",children:(0,n.jsxs)("select",{value:h,onChange:e=>m(e.target.value),className:i.N,children:[(0,n.jsx)("option",{value:"",children:"— No role —"}),u.map(e=>(0,n.jsx)("option",{value:e.id,children:e.name},e.id))]})}),h&&(0,n.jsxs)("label",{className:"flex items-center gap-2 text-xs cursor-pointer",children:[(0,n.jsx)("input",{type:"checkbox",checked:f,onChange:e=>p(e.target.checked),className:"rounded border-border"}),"Apply role immediately"]})]}),b&&(0,n.jsx)("div",{className:"rounded border border-danger/30 bg-danger/10 px-3 py-2 text-xs text-danger",children:b}),(0,n.jsxs)("div",{className:"flex justify-between pt-2",children:[(0,n.jsx)("div",{children:r?.role&&(0,n.jsx)(l.K,{variant:"secondary",size:"sm",onClick:()=>void k(),disabled:g,children:"Unassign Role"})}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(l.K,{variant:"secondary",size:"sm",onClick:_,children:"Cancel"}),(0,n.jsx)(l.K,{size:"sm",onClick:()=>void w(),disabled:g||!h||0===u.length,icon:g?(0,n.jsx)(d.f,{className:"h-3.5 w-3.5 animate-spin"}):void 0,children:g?"Saving…":r?.role?"Change Role":"Assign Role"})]})]})]})})},"F",0,function({open:e,node:r,onClose:t,onSaved:a}){let[u,x]=(0,s.useState)(""),[h,m]=(0,s.useState)(""),[f,p]=(0,s.useState)(""),[g,v]=(0,s.useState)(!1),[b,j]=(0,s.useState)("");(0,s.useEffect)(()=>{if(r){x(r.name);try{let e=JSON.parse(r.tags);m(e.join(", "))}catch{m("")}p(r.status),j("")}},[r]);let y=async()=>{if(r&&u.trim()){v(!0),j("");try{let e=h.split(",").map(e=>e.trim()).filter(Boolean);await o.f.nodes.update(r.id,{name:u.trim(),tags:e,status:f.toUpperCase()}),a(),t()}catch(e){j(e instanceof Error?e.message:"Failed to update node")}finally{v(!1)}}},N=()=>{j(""),v(!1),t()};return(0,n.jsx)(i.n,{open:e,onClose:N,title:"Edit Node",description:r?`${r.hostname}`:"",icon:(0,n.jsx)(c.f,{className:"h-5 w-5 text-primary"}),children:(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)(i.G,{label:"Name",required:!0,children:(0,n.jsx)("input",{type:"text",value:u,onChange:e=>x(e.target.value),className:i.W})}),(0,n.jsx)(i.G,{label:"Status",children:(0,n.jsxs)("select",{value:f,onChange:e=>p(e.target.value),className:i.N,children:[(0,n.jsx)("option",{value:"ONLINE",children:"ONLINE"}),(0,n.jsx)("option",{value:"OFFLINE",children:"OFFLINE"}),(0,n.jsx)("option",{value:"DEGRADED",children:"DEGRADED"}),(0,n.jsx)("option",{value:"PROVISIONING",children:"PROVISIONING"}),(0,n.jsx)("option",{value:"MAINTENANCE",children:"MAINTENANCE"})]})}),(0,n.jsxs)(i.G,{label:"Tags",children:[(0,n.jsx)("input",{type:"text",value:h,onChange:e=>m(e.target.value),placeholder:"web, production, us-east",className:i.W}),(0,n.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"Comma-separated list of tags"})]}),b&&(0,n.jsx)("div",{className:"rounded border border-danger/30 bg-danger/10 px-3 py-2 text-xs text-danger",children:b}),(0,n.jsxs)("div",{className:"flex justify-end gap-2 pt-2",children:[(0,n.jsx)(l.K,{variant:"secondary",size:"sm",onClick:N,children:"Cancel"}),(0,n.jsx)(l.K,{size:"sm",onClick:()=>void y(),disabled:g||!u.trim(),icon:g?(0,n.jsx)(d.f,{className:"h-3.5 w-3.5 animate-spin"}):void 0,children:g?"Saving…":"Save Changes"})]})]})})},"M",0,function({open:e,onClose:r,onRegistered:t}){let[a,u]=(0,s.useState)(""),[x,h]=(0,s.useState)(""),[m,f]=(0,s.useState)("4100"),[p,g]=(0,s.useState)("linux"),[v,b]=(0,s.useState)("x86_64"),[j,y]=(0,s.useState)(""),[N,w]=(0,s.useState)(!1),[k,_]=(0,s.useState)(""),M=async()=>{if(a.trim()&&x.trim()){w(!0),_("");try{let e=j.split(",").map(e=>e.trim()).filter(Boolean);await o.f.nodes.register({name:a.trim(),hostname:x.trim(),ipAddress:x.trim(),port:Number(m)||4100,os:p,arch:v,tags:e,agentVersion:"1.1.4"}),t(),S()}catch(e){_(e instanceof Error?e.message:"Failed to register node")}finally{w(!1)}}},S=()=>{u(""),h(""),f("4100"),g("linux"),b("x86_64"),y(""),_(""),w(!1),r()};return(0,n.jsx)(i.n,{open:e,onClose:S,title:"Register Node",description:"Manually register a node already running the agent",icon:(0,n.jsx)(c.f,{className:"h-5 w-5 text-primary"}),children:(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)(i.G,{label:"Node Name",required:!0,children:(0,n.jsx)("input",{type:"text",value:a,onChange:e=>u(e.target.value),placeholder:"web-server-01",className:i.W,autoFocus:!0})}),(0,n.jsx)(i.G,{label:"FQDN / Hostname",required:!0,children:(0,n.jsx)("input",{type:"text",value:x,onChange:e=>h(e.target.value),placeholder:"node-1.example.com",className:i.W})}),(0,n.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,n.jsx)(i.G,{label:"Port",children:(0,n.jsx)("input",{type:"number",value:m,onChange:e=>f(e.target.value),className:i.W})}),(0,n.jsx)(i.G,{label:"OS",children:(0,n.jsxs)("select",{value:p,onChange:e=>g(e.target.value),className:i.N,children:[(0,n.jsx)("option",{value:"linux",children:"Linux"}),(0,n.jsx)("option",{value:"darwin",children:"macOS"}),(0,n.jsx)("option",{value:"windows",children:"Windows"})]})}),(0,n.jsx)(i.G,{label:"Architecture",children:(0,n.jsxs)("select",{value:v,onChange:e=>b(e.target.value),className:i.N,children:[(0,n.jsx)("option",{value:"x86_64",children:"x86_64"}),(0,n.jsx)("option",{value:"aarch64",children:"aarch64"}),(0,n.jsx)("option",{value:"arm",children:"arm"})]})})]}),(0,n.jsxs)(i.G,{label:"Tags",children:[(0,n.jsx)("input",{type:"text",value:j,onChange:e=>y(e.target.value),placeholder:"web, production, us-east",className:i.W}),(0,n.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"Comma-separated"})]}),k&&(0,n.jsx)("div",{className:"rounded border border-danger/30 bg-danger/10 px-3 py-2 text-xs text-danger",children:k}),(0,n.jsxs)("div",{className:"flex justify-end gap-2 pt-2",children:[(0,n.jsx)(l.K,{variant:"secondary",size:"sm",onClick:S,children:"Cancel"}),(0,n.jsx)(l.K,{size:"sm",onClick:()=>void M(),disabled:N||!a.trim()||!x.trim(),icon:N?(0,n.jsx)(d.f,{className:"h-3.5 w-3.5 animate-spin"}):void 0,children:N?"Registering…":"Register Node"})]})]})})}],14098)},25398,e=>{var r=e.i(56420);let t={name:"rotate-cw",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]};t.node;let a=(0,r.f)(t);e.s(["f",0,a],25398)},90317,(e,r,t)=>{Object.defineProperty(t,"__esModule",{value:!0});var a={bindSnapshot:function(){return d},createAsyncLocalStorage:function(){return o},createSnapshot:function(){return u},getOrCreateGlobalAsyncLocalStorage:function(){return c}};for(var n in a)Object.defineProperty(t,n,{enumerable:!0,get:a[n]});let s=Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available");class l{disable(){throw s}getStore(){}run(){throw s}exit(){throw s}enterWith(){throw s}static bind(e){return e}}let i="u">typeof globalThis&&globalThis.AsyncLocalStorage;function o(){return i?new i:new l}function c(e){let r=Symbol.for(`@next/${e}@16.4.3`),t=globalThis;return t[r]??=o()}function d(e){return i?i.bind(e):l.bind(e)}function u(){return i?i.snapshot():function(e,...r){return e(...r)}}},42344,(e,r,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"workAsyncStorageInstance",{enumerable:!0,get:function(){return a}});let a=(0,e.r(90317).getOrCreateGlobalAsyncLocalStorage)("work-async-storage")},63599,(e,r,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"workAsyncStorage",{enumerable:!0,get:function(){return a.workAsyncStorageInstance}});let a=e.r(42344)},70703,(e,r,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return n}});let a=e.r(55682)._(e.r(69093));function n(e,r){let t={};"function"==typeof e&&(t.loader=e);let n={...t,...r};return(0,a.default)({...n,modules:n.loadableGenerated?.modules})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),r.exports=t.default)},9885,(e,r,t)=>{function a(e){return e.split("/").map(e=>encodeURIComponent(e)).join("/")}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"encodeURIPath",{enumerable:!0,get:function(){return a}})},67585,(e,r,t)=>{e.i(47167),Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BailoutToCSRForNextDynamic",{enumerable:!0,get:function(){return l}});let a=e.r(71645),n=e.r(74080);e.r(32061);let s=e.r(49354).createReactBrowserBailoutReason.bind(null,"next/dynamic");function l({children:e}){return(0,a.use)((0,n.browser)(s)),e}},69093,(e,r,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return c}});let a=e.r(43476),n=e.r(71645),s=e.r(67585),l=e.r(52157);function i(e){return{default:e&&"default"in e?e.default:e}}let o={loader:()=>Promise.resolve(i(()=>null)),loading:null,ssr:!0},c=function(e){let r={...o,...e},t=(0,n.lazy)(()=>r.loader().then(i)),c=r.loading;function d(e){let i=c?(0,a.jsx)(c,{isLoading:!0,pastDelay:!0,error:null}):null,o=!r.ssr||!!r.loading,d=o?n.Suspense:n.Fragment,u=r.ssr?(0,a.jsxs)(a.Fragment,{children:["u"<typeof window?(0,a.jsx)(l.PreloadChunks,{moduleIds:r.modules}):null,(0,a.jsx)(t,{...e})]}):(0,a.jsx)(s.BailoutToCSRForNextDynamic,{children:(0,a.jsx)(t,{...e})});return(0,a.jsx)(d,{...o?{fallback:i}:{},children:u})}return d.displayName="LoadableComponent",d}},52157,(e,r,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"PreloadChunks",{enumerable:!0,get:function(){return o}});let a=e.r(43476),n=e.r(74080),s=e.r(63599),l=e.r(9885),i=e.r(43369);function o({moduleIds:e}){if("u">typeof window)return null;let r=s.workAsyncStorage.getStore();if(void 0===r)return null;let t=[];if(r.reactLoadableManifest&&e){let a=r.reactLoadableManifest;for(let r of e){if(!a[r])continue;let e=a[r].files;t.push(...e)}}if(0===t.length)return null;let c=(0,i.getAssetTokenQuery)();return(0,a.jsx)(a.Fragment,{children:t.map(e=>{let t=`${r.assetPrefix}/_next/${(0,l.encodeURIPath)(e)}${c}`;return e.endsWith(".css")?(0,a.jsx)("link",{precedence:"dynamic",href:t,rel:"stylesheet",as:"style",nonce:r.nonce},e):((0,n.preload)(t,{as:"script",fetchPriority:"low",nonce:r.nonce}),null)})})}},49354,(e,r,t)=>{Object.defineProperty(t,"__esModule",{value:!0});var a={createReactBrowserBailoutReason:function(){return l},getReactBrowserBailoutReason:function(){return i},isNextBrowserBailoutError:function(){return o}};for(var n in a)Object.defineProperty(t,n,{enumerable:!0,get:a[n]});let s=Symbol.for("next.browser-bailout-reason");function l(e){return{$$typeof:s,reason:e}}function i(e){let r=e?.cause;return r?.$$typeof===s?r.reason:void 0}function o(e){return void 0!==i(e)}}])})();
1
+ (()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,57108,e=>{var r=e.i(43476),t=e.i(46670);e.s(["f",0,function({configuration:e}){if(e?.memoryProvider!=="hivemem")return null;let a=e.hiveMemToken,n=a?.status??"unknown";return(0,r.jsxs)("span",{className:"flex flex-wrap items-center gap-1.5",children:[(0,r.jsxs)(t.t,{variant:"valid"===n?"success":"expiring"===n||"unreachable"===n||"unknown"===n?"warning":"danger",children:["Token ",n]}),a?.expiresAt&&(0,r.jsxs)("time",{dateTime:a.expiresAt,title:"HiveMem token expiration",children:["expires ",new Date(a.expiresAt).toLocaleString()]}),a?.checkedAt&&(0,r.jsxs)("time",{dateTime:a.checkedAt,className:"text-text-muted/70",title:"Last HiveMem authentication check",children:["checked ",new Date(a.checkedAt).toLocaleString()]})]})}])},46670,e=>{var r=e.i(43476),t=e.i(78571);let a={default:"border-border text-text-muted",success:"border-success/40 text-success bg-success/5 shadow-[0_0_6px_rgba(0,255,65,0.15)]",warning:"border-warning/40 text-warning bg-warning/5 shadow-[0_0_6px_rgba(255,179,0,0.15)]",danger:"border-danger/40 text-danger bg-danger/5 shadow-[0_0_6px_rgba(255,23,68,0.15)]",info:"border-info/40 text-info bg-info/5 shadow-[0_0_6px_rgba(0,176,255,0.15)]"},n={default:"bg-text-muted",success:"bg-success",warning:"bg-warning",danger:"bg-danger",info:"bg-info"};e.s(["t",0,function({children:e,variant:s="default",className:l,dot:i=!1,pulse:o=!1}){return(0,r.jsxs)("span",{className:(0,t.f)("inline-flex items-center gap-1.5 rounded-chip border px-2 py-0.5 text-[10px] font-bold uppercase tracking-wider",a[s],l),children:[i&&(0,r.jsxs)("span",{"aria-hidden":"true",className:"relative inline-flex h-1.5 w-1.5",children:[o&&(0,r.jsx)("span",{className:(0,t.f)("absolute inset-0 rounded-full animate-halo",n[s])}),(0,r.jsx)("span",{className:(0,t.f)("relative inline-flex h-1.5 w-1.5 rounded-full",n[s])})]}),e]})},"k",0,function(e){switch(e.toUpperCase()){case"ONLINE":case"COMPLETED":case"ACTIVE":case"RUNNING":case"INSTALLED":case"HEALTHY":return"success";case"DEGRADED":case"PAUSED":case"QUEUED":case"PENDING":case"INSTALLING":return"warning";case"OFFLINE":case"FAILED":case"ERROR":case"TIMEOUT":case"CANCELLED":case"DECOMMISSIONED":case"CRITICAL":return"danger";case"PROVISIONING":case"UPDATING":return"info";default:return"default"}}])},93999,51196,55427,e=>{var r=e.i(43476),t=e.i(56420);let a={name:"arrow-down-right",size:24,node:[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]]};a.node;let n=(0,t.f)(a);var s=e.i(75775),l=e.i(78571),i=e.i(3062),o=e.i(35084);let c={warning:"shadow-[0_0_6px_var(--color-warning)]",danger:"shadow-[0_0_8px_var(--color-danger)]",accent:"shadow-[0_0_6px_var(--color-accent)]",primary:"shadow-[0_0_6px_var(--color-primary)]"},d={xs:"h-1",sm:"h-1.5",md:"h-2"};function u({value:e,max:t=100,tone:a,thresholds:n=o.q,label:s,size:i="xs",showValue:x=!1,valueLabel:h,glow:m,className:f,testId:p}){let g="number"==typeof e&&Number.isFinite(e),v=g?Math.max(0,Math.min(100,e/(t||1)*100)):0,b=a??(g?(0,o.Z)(v,n):"muted"),j=m||!a&&g&&v>=n.warn,y=h??(g?`${v.toFixed(+(v<10&&v>0))}%`:"—");return(0,r.jsxs)("div",{className:(0,l.f)("flex min-w-0 items-center gap-2",f),"data-testid":p,children:[(0,r.jsx)("div",{role:"meter","aria-label":s,"aria-valuemin":0,"aria-valuemax":t,"aria-valuenow":g?e:void 0,"aria-valuetext":y,className:(0,l.f)("relative flex-1 overflow-hidden rounded-full bg-border/70",d[i]),children:(0,r.jsx)("div",{style:{"--meter":`${v}%`},className:(0,l.f)("h-full w-(--meter) rounded-full transition-[width] duration-700 ease-out-expo starting:w-0",o.H[b],j&&c[b])})}),x&&(0,r.jsx)("span",{className:(0,l.f)("num w-11 shrink-0 text-right text-[11px]",g?o.T[b]:"text-text-muted"),children:y})]})}e.s(["f",0,u],51196);var x=e.i(71645);function h({values:e,tone:t="primary",width:a=160,height:n=32,area:s=!0,max:i,percent:c=!1,threshold:d,live:u=!0,emptyLabel:m="not enough data",className:f,testId:p,label:g,stretch:v=!1}){let b=`spark${(0,x.useId)().replace(/:/g,"")}`;if(e.length<2)return(0,r.jsx)("div",{className:(0,l.f)("flex h-8 items-center text-xs italic text-text-muted",f),"data-testid":p,children:m});let j=o.v[t],y=i??(c?Math.max(100,...e):Math.max(...e,d??0)||1),N=n-4,w=a/(e.length-1),k=e=>2+N-Math.max(0,e)/y*N,_=e.map((e,r)=>[r*w,k(e)]),M=_.map(([e,r])=>`${e.toFixed(1)},${r.toFixed(1)}`).join(" "),S=_[_.length-1];return(0,r.jsxs)("svg",{width:v?"100%":a,height:n,viewBox:`0 0 ${a} ${n}`,preserveAspectRatio:v?"none":void 0,className:(0,l.f)("block overflow-visible",f),"data-testid":p,role:g?"img":void 0,"aria-label":g,"aria-hidden":!g||void 0,children:[s&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("defs",{children:(0,r.jsxs)("linearGradient",{id:b,x1:"0",x2:"0",y1:"0",y2:"1",children:[(0,r.jsx)("stop",{offset:"0%",stopColor:j,stopOpacity:.35}),(0,r.jsx)("stop",{offset:"100%",stopColor:j,stopOpacity:0})]})}),(0,r.jsx)("polygon",{points:`0,${n} ${M} ${a},${n}`,fill:`url(#${b})`})]}),void 0!==d&&(0,r.jsx)("line",{x1:0,x2:a,y1:k(d),y2:k(d),stroke:"var(--color-warning)",strokeOpacity:.5,strokeDasharray:"3 3",strokeWidth:1}),(0,r.jsx)("polyline",{fill:"none",stroke:j,strokeWidth:1.5,vectorEffect:"non-scaling-stroke",strokeLinejoin:"round",strokeLinecap:"round",points:M}),u&&!v&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("circle",{cx:S[0],cy:S[1],r:2.5,fill:j,className:"origin-center animate-halo [transform-box:fill-box]"}),(0,r.jsx)("circle",{cx:S[0],cy:S[1],r:2,fill:j})]})]})}e.s(["f",0,h],55427),e.s(["N",0,function({title:e,description:t,children:a,className:n,action:s,tone:l,corners:o=!1,...c}){return(0,r.jsx)(i.f,{...c,tone:l,corners:o,title:e,description:t,action:s,className:n,children:a})},"n",0,function({label:e,value:t,icon:a,trend:c,spark:d,meter:x,delta:m,tone:f="primary",className:p,testId:g}){let v=!m||m.value>=0===(m.positiveIsGood??!0);return(0,r.jsxs)(i.f,{tone:f,className:(0,l.f)("overflow-hidden",p),testId:g,children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("span",{className:"text-[10px] font-medium uppercase tracking-[0.15em] text-text-muted",children:e}),a&&(0,r.jsx)("span",{className:"text-primary/60",children:a})]}),(0,r.jsxs)("div",{className:"mt-2 flex items-end justify-between gap-2",children:[(0,r.jsx)("div",{className:(0,l.f)("num text-2xl font-bold","primary"===f?"text-primary neon-text":o.T[f]),children:t}),m&&0!==m.value&&(0,r.jsxs)("span",{className:(0,l.f)("num mb-1 inline-flex items-center gap-0.5 text-[11px]",v?"text-success":"text-danger"),children:[m.value>0?(0,r.jsx)(s.f,{className:"h-3 w-3"}):(0,r.jsx)(n,{className:"h-3 w-3"}),Math.abs(m.value).toFixed(+!Number.isInteger(m.value)),m.unit]})]}),c&&(0,r.jsx)("div",{className:(0,l.f)("mt-1 text-[11px]",c.positive?"text-success":"text-danger"),children:c.value}),void 0!==x&&(0,r.jsx)(u,{value:x,className:"mt-3",label:e}),d&&d.length>1&&(0,r.jsx)("div",{className:"-mx-5 -mb-5 mt-3 opacity-80",children:(0,r.jsx)(h,{values:d,tone:f,width:240,height:28,stretch:!0,live:!1})})]})}],93999)},54149,21176,e=>{var r=e.i(43476),t=e.i(71645),a=e.i(78571),n=e.i(35084);e.s(["f",0,function({value:e,max:s=100,label:l,sublabel:i,tone:o,thresholds:c=n.q,higherIsBetter:d=!1,size:u=140,display:x,ticks:h=!0,hideLabel:m=!1,className:f,testId:p}){let g=(0,t.useId)().replace(/:/g,""),v="number"==typeof e&&Number.isFinite(e),b=v?Math.max(0,Math.min(100,e/(s||1)*100)):0,j=o??(v?d?(0,n.Z)(100-b,c):(0,n.Z)(b,c):"muted"),y=Math.max(4,Math.round(u/16)),N=50-y/2-4,w=2*Math.PI*N,k=.75*w,_=k*b/100,M=u>=140,S=x??(v?`${Math.round(b)}%`:"—"),C=h?Array.from({length:11},(e,t)=>{let a=(135+270*t/10)*Math.PI/180,n=50-(t%5==0?4:2.5);return(0,r.jsx)("line",{x1:50+48.5*Math.cos(a),y1:50+48.5*Math.sin(a),x2:50+n*Math.cos(a),y2:50+n*Math.sin(a),stroke:"var(--color-border-strong)",strokeWidth:.8},t)}):null;return(0,r.jsxs)("div",{role:"img","aria-label":`${l}: ${S}`,"data-testid":p,className:(0,a.f)("relative inline-flex flex-col items-center",f),style:{width:u},children:[(0,r.jsxs)("svg",{viewBox:"0 0 100 100",width:u,height:u,"aria-hidden":"true",className:"overflow-visible",children:[M&&(0,r.jsx)("defs",{children:(0,r.jsxs)("filter",{id:`g${g}`,x:"-30%",y:"-30%",width:"160%",height:"160%",children:[(0,r.jsx)("feGaussianBlur",{stdDeviation:"2.2",result:"blur"}),(0,r.jsxs)("feMerge",{children:[(0,r.jsx)("feMergeNode",{in:"blur"}),(0,r.jsx)("feMergeNode",{in:"SourceGraphic"})]})]})}),C,(0,r.jsx)("circle",{cx:50,cy:50,r:N,fill:"none",stroke:"var(--color-border)",strokeWidth:y,strokeLinecap:"round",strokeDasharray:`${k} ${w}`,transform:"rotate(135 50 50)"}),(0,r.jsx)("circle",{cx:50,cy:50,r:N,fill:"none",stroke:n.v[j],strokeWidth:y,strokeLinecap:"round",transform:"rotate(135 50 50)",filter:M?`url(#g${g})`:void 0,style:{"--dash":`${_} ${w}`},className:"[stroke-dasharray:var(--dash)] transition-[stroke-dasharray] duration-1000 ease-out-expo starting:[stroke-dasharray:0_1000]"})]}),(0,r.jsxs)("div",{className:"pointer-events-none absolute inset-0 flex flex-col items-center justify-center",style:{height:u},children:[(0,r.jsx)("span",{className:(0,a.f)("num font-bold leading-none",n.T[j],M&&n.z[j]),style:{fontSize:Math.max(12,.2*u)},children:S}),i&&(0,r.jsx)("span",{className:"num mt-1 text-text-muted",style:{fontSize:Math.max(9,.075*u)},children:i})]}),!m&&(0,r.jsx)("span",{className:"-mt-[10%] text-center text-[10px] font-medium uppercase tracking-[0.15em] text-text-muted",children:l})]})}],54149);var s=e.i(70703),l=e.i(65369);let i=(0,s.default)(()=>e.A(1321),{loadableGenerated:{modules:[69944]},ssr:!1,loading:()=>(0,r.jsx)(l.l,{className:"h-[180px] w-full"})});e.s(["f",0,i],21176)},3062,e=>{var r=e.i(43476),t=e.i(78571),a=e.i(35084);let n={primary:"[--panel-corner-color:color-mix(in_srgb,var(--color-primary)_60%,transparent)]",accent:"[--panel-corner-color:color-mix(in_srgb,var(--color-accent)_70%,transparent)]",success:"[--panel-corner-color:color-mix(in_srgb,var(--color-success)_60%,transparent)]",warning:"[--panel-corner-color:color-mix(in_srgb,var(--color-warning)_70%,transparent)]",danger:"[--panel-corner-color:color-mix(in_srgb,var(--color-danger)_70%,transparent)]",info:"[--panel-corner-color:color-mix(in_srgb,var(--color-info)_60%,transparent)]",muted:"[--panel-corner-color:var(--color-border-strong)]"},s={primary:"[--glow-hover-color:var(--color-glow)]",accent:"[--glow-hover-color:var(--color-glow-accent)]",success:"[--glow-hover-color:var(--color-glow-success)]",warning:"[--glow-hover-color:var(--color-glow-warning)]",danger:"[--glow-hover-color:var(--color-glow-danger)]",info:"[--glow-hover-color:var(--color-glow)]",muted:"[--glow-hover-color:var(--color-glow)]"},l={primary:"hover:border-primary/30",accent:"hover:border-accent/40",success:"hover:border-success/30",warning:"hover:border-warning/40",danger:"hover:border-danger/40",info:"hover:border-info/30",muted:"hover:border-border-strong"},i={none:"",sm:"p-3",md:"p-5",lg:"p-6"};e.s(["f",0,function({tone:e="primary",corners:o=!0,interactive:c=!0,hero:d=!1,title:u,description:x,icon:h,action:m,as:f="div",padding:p="md",testId:g,className:v,children:b,...j}){return(0,r.jsxs)(f,{...j,"data-testid":g??j["data-testid"],className:(0,t.f)("relative rounded-panel border border-border bg-surface transition-colors duration-300",i[p],o&&"panel-corners",o&&n[e],c&&"glow-hover",c&&s[e],c&&l[e],d&&"grid-bg overflow-hidden bg-surface/80",v),children:[(u||m||h)&&(0,r.jsxs)("div",{className:"mb-4 flex items-start justify-between gap-3",children:[(0,r.jsxs)("div",{className:"flex min-w-0 items-start gap-2",children:[h&&(0,r.jsx)("span",{className:(0,t.f)("mt-0.5 shrink-0",a.T[e]),children:h}),(0,r.jsxs)("div",{className:"min-w-0",children:[u&&(0,r.jsx)("h3",{className:"text-xs font-bold uppercase tracking-wider",children:u}),x&&(0,r.jsx)("p",{className:"mt-0.5 text-[11px] text-text-muted",children:x})]})]}),m]}),b]})}])},65369,e=>{var r=e.i(43476),t=e.i(78571);function a({className:e}){return(0,r.jsx)("div",{"aria-hidden":"true",className:(0,t.f)("skeleton h-3 w-full",e)})}e.s(["l",0,a,"g",0,function({count:e=4,className:n}){return(0,r.jsx)("div",{role:"status","aria-label":"Loading",className:(0,t.f)("grid gap-4 sm:grid-cols-2 lg:grid-cols-4",n),children:Array.from({length:e},(e,t)=>(0,r.jsxs)("div",{className:"panel-corners rounded-panel border border-border bg-surface p-5",children:[(0,r.jsx)(a,{className:"h-2 w-1/2"}),(0,r.jsx)(a,{className:"mt-4 h-7 w-2/3"}),(0,r.jsx)(a,{className:"mt-3 h-1 w-full opacity-60"})]},t))})},"F",0,function({rows:e=5,cols:n=4,className:s}){return(0,r.jsxs)("div",{role:"status","aria-label":"Loading",className:(0,t.f)("overflow-hidden rounded-panel border border-border",s),children:[(0,r.jsx)("div",{className:"flex gap-4 border-b border-border bg-surface px-4 py-3",children:Array.from({length:n},(e,t)=>(0,r.jsx)(a,{className:"h-2 flex-1 opacity-60"},t))}),Array.from({length:e},(e,s)=>(0,r.jsx)("div",{className:"flex gap-4 border-b border-border/50 px-4 py-3 last:border-0",children:Array.from({length:n},(e,n)=>(0,r.jsx)(a,{className:(0,t.f)("h-3 flex-1",(s+n)%3==0&&"max-w-[60%]")},n))},s))]})},"Q",0,function({lines:e=3,className:n}){let s=["w-full","w-11/12","w-4/5","w-2/3","w-3/4"];return(0,r.jsx)("div",{role:"status","aria-label":"Loading",className:(0,t.f)("space-y-2",n),children:Array.from({length:e},(e,t)=>(0,r.jsx)(a,{className:s[t%s.length]},t))})}])},75723,e=>{var r=e.i(43476),t=e.i(78571),a=e.i(46670);let n={success:"bg-success shadow-[0_0_6px_var(--color-success)]",warning:"bg-warning shadow-[0_0_6px_var(--color-warning)]",danger:"bg-danger shadow-[0_0_6px_var(--color-danger)]",info:"bg-info shadow-[0_0_6px_var(--color-info)]",default:"bg-text-muted"},s={success:"bg-success",warning:"bg-warning",danger:"bg-danger",info:"bg-info",default:"bg-text-muted"},l=new Set(["ONLINE","RUNNING","ACTIVE","HEALTHY","CRITICAL","UPDATING","PROVISIONING"]);e.s(["f",0,function({status:e,pulse:i,size:o="sm",className:c,label:d}){let u=(0,a.k)(e),x=i??l.has(e.toUpperCase()),h="xs"===o?"h-1.5 w-1.5":"h-2 w-2";return(0,r.jsxs)("span",{className:(0,t.f)("relative inline-flex shrink-0",h,c),role:d?"img":void 0,"aria-label":d,"aria-hidden":!d||void 0,children:[x&&(0,r.jsx)("span",{className:(0,t.f)("absolute inset-0 rounded-full animate-halo",s[u])}),(0,r.jsx)("span",{className:(0,t.f)("relative inline-flex rounded-full",h,n[u])})]})}])},71417,e=>{e.s(["L",0,function(e){if(0===e)return"0 B";let r=Math.floor(Math.log(e)/Math.log(1024));return`${parseFloat((e/Math.pow(1024,r)).toFixed(1))} ${["B","KB","MB","GB","TB"][r]}`},"C",0,function(e){return e?("string"==typeof e?new Date(e):e).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"—"}])},79432,e=>{var r=e.i(56420);let t={name:"activity",size:24,node:[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]};t.node;let a=(0,r.f)(t);e.s(["f",0,a],79432)},9347,e=>{var r=e.i(56420);let t={name:"arrow-left",size:24,node:[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]};t.node;let a=(0,r.f)(t);e.s(["f",0,a],9347)},75775,e=>{var r=e.i(56420);let t={name:"arrow-up-right",size:24,node:[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]};t.node;let a=(0,r.f)(t);e.s(["f",0,a],75775)},82022,e=>{var r=e.i(56420);let t={name:"external-link",size:24,node:[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]};t.node;let a=(0,r.f)(t);e.s(["f",0,a],82022)},57665,e=>{var r=e.i(56420);let t={name:"power",size:24,node:[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]};t.node;let a=(0,r.f)(t);e.s(["f",0,a],57665)},86207,14098,e=>{var r=e.i(56420);let t={name:"refresh-ccw-dot",size:24,node:[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]};t.node;let a=(0,r.f)(t);e.s(["f",0,a],86207);var n=e.i(43476),s=e.i(71645),l=e.i(68759),i=e.i(32568),o=e.i(82983),c=e.i(41220),d=e.i(32781);e.s(["E",0,function({open:e,node:r,onClose:t,onSaved:a}){let[u,x]=(0,s.useState)([]),[h,m]=(0,s.useState)(""),[f,p]=(0,s.useState)(!0),[g,v]=(0,s.useState)(!1),[b,j]=(0,s.useState)(""),[y,N]=(0,s.useState)(!1);(0,s.useEffect)(()=>{e&&(j(""),m(r?.role?.id??""),p(!0),N(!0),(async()=>{try{let e=await o.f.roles.list();x(e.data??[])}catch{j("Failed to load roles")}finally{N(!1)}})())},[e,r?.role?.id]);let w=async()=>{if(r){v(!0),j("");try{let e=r.role?.id;e&&e!==h&&await o.f.roles.unassign(e,{nodeIds:[r.id]}),h&&await o.f.roles.assign(h,{nodeIds:[r.id],defer:!f});let n=h?u.find(e=>e.id===h)??null:null;a(n),t()}catch(e){j(e instanceof Error?e.message:"Failed to assign role")}finally{v(!1)}}},k=async()=>{if(r?.role){v(!0),j("");try{await o.f.roles.unassign(r.role.id,{nodeIds:[r.id]}),a(null),t()}catch(e){j(e instanceof Error?e.message:"Failed to unassign role")}finally{v(!1)}}},_=()=>{j(""),v(!1),t()};return(0,n.jsx)(i.n,{open:e,onClose:_,title:r?.role?"Change Role":"Assign Role",description:r?`Node: ${r.name}`:"",icon:(0,n.jsx)(c.f,{className:"h-5 w-5 text-primary"}),children:(0,n.jsxs)("div",{className:"space-y-4",children:[y?(0,n.jsxs)("div",{className:"flex items-center gap-2 py-4 text-xs text-text-muted",children:[(0,n.jsx)(d.f,{className:"h-4 w-4 animate-spin"}),"Loading roles…"]}):0===u.length?(0,n.jsx)("p",{className:"text-xs text-text-muted py-4",children:"No roles found. Create a role first on the Roles page."}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(i.G,{label:"Role",children:(0,n.jsxs)("select",{value:h,onChange:e=>m(e.target.value),className:i.N,children:[(0,n.jsx)("option",{value:"",children:"— No role —"}),u.map(e=>(0,n.jsx)("option",{value:e.id,children:e.name},e.id))]})}),h&&(0,n.jsxs)("label",{className:"flex items-center gap-2 text-xs cursor-pointer",children:[(0,n.jsx)("input",{type:"checkbox",checked:f,onChange:e=>p(e.target.checked),className:"rounded border-border"}),"Apply role immediately"]})]}),b&&(0,n.jsx)("div",{className:"rounded border border-danger/30 bg-danger/10 px-3 py-2 text-xs text-danger",children:b}),(0,n.jsxs)("div",{className:"flex justify-between pt-2",children:[(0,n.jsx)("div",{children:r?.role&&(0,n.jsx)(l.K,{variant:"secondary",size:"sm",onClick:()=>void k(),disabled:g,children:"Unassign Role"})}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(l.K,{variant:"secondary",size:"sm",onClick:_,children:"Cancel"}),(0,n.jsx)(l.K,{size:"sm",onClick:()=>void w(),disabled:g||!h||0===u.length,icon:g?(0,n.jsx)(d.f,{className:"h-3.5 w-3.5 animate-spin"}):void 0,children:g?"Saving…":r?.role?"Change Role":"Assign Role"})]})]})]})})},"F",0,function({open:e,node:r,onClose:t,onSaved:a}){let[u,x]=(0,s.useState)(""),[h,m]=(0,s.useState)(""),[f,p]=(0,s.useState)(""),[g,v]=(0,s.useState)(!1),[b,j]=(0,s.useState)("");(0,s.useEffect)(()=>{if(r){x(r.name);try{let e=JSON.parse(r.tags);m(e.join(", "))}catch{m("")}p(r.status),j("")}},[r]);let y=async()=>{if(r&&u.trim()){v(!0),j("");try{let e=h.split(",").map(e=>e.trim()).filter(Boolean);await o.f.nodes.update(r.id,{name:u.trim(),tags:e,status:f.toUpperCase()}),a(),t()}catch(e){j(e instanceof Error?e.message:"Failed to update node")}finally{v(!1)}}},N=()=>{j(""),v(!1),t()};return(0,n.jsx)(i.n,{open:e,onClose:N,title:"Edit Node",description:r?`${r.hostname}`:"",icon:(0,n.jsx)(c.f,{className:"h-5 w-5 text-primary"}),children:(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)(i.G,{label:"Name",required:!0,children:(0,n.jsx)("input",{type:"text",value:u,onChange:e=>x(e.target.value),className:i.W})}),(0,n.jsx)(i.G,{label:"Status",children:(0,n.jsxs)("select",{value:f,onChange:e=>p(e.target.value),className:i.N,children:[(0,n.jsx)("option",{value:"ONLINE",children:"ONLINE"}),(0,n.jsx)("option",{value:"OFFLINE",children:"OFFLINE"}),(0,n.jsx)("option",{value:"DEGRADED",children:"DEGRADED"}),(0,n.jsx)("option",{value:"PROVISIONING",children:"PROVISIONING"}),(0,n.jsx)("option",{value:"MAINTENANCE",children:"MAINTENANCE"})]})}),(0,n.jsxs)(i.G,{label:"Tags",children:[(0,n.jsx)("input",{type:"text",value:h,onChange:e=>m(e.target.value),placeholder:"web, production, us-east",className:i.W}),(0,n.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"Comma-separated list of tags"})]}),b&&(0,n.jsx)("div",{className:"rounded border border-danger/30 bg-danger/10 px-3 py-2 text-xs text-danger",children:b}),(0,n.jsxs)("div",{className:"flex justify-end gap-2 pt-2",children:[(0,n.jsx)(l.K,{variant:"secondary",size:"sm",onClick:N,children:"Cancel"}),(0,n.jsx)(l.K,{size:"sm",onClick:()=>void y(),disabled:g||!u.trim(),icon:g?(0,n.jsx)(d.f,{className:"h-3.5 w-3.5 animate-spin"}):void 0,children:g?"Saving…":"Save Changes"})]})]})})},"M",0,function({open:e,onClose:r,onRegistered:t}){let[a,u]=(0,s.useState)(""),[x,h]=(0,s.useState)(""),[m,f]=(0,s.useState)("4100"),[p,g]=(0,s.useState)("linux"),[v,b]=(0,s.useState)("x86_64"),[j,y]=(0,s.useState)(""),[N,w]=(0,s.useState)(!1),[k,_]=(0,s.useState)(""),M=async()=>{if(a.trim()&&x.trim()){w(!0),_("");try{let e=j.split(",").map(e=>e.trim()).filter(Boolean);await o.f.nodes.register({name:a.trim(),hostname:x.trim(),ipAddress:x.trim(),port:Number(m)||4100,os:p,arch:v,tags:e,agentVersion:"1.1.7"}),t(),S()}catch(e){_(e instanceof Error?e.message:"Failed to register node")}finally{w(!1)}}},S=()=>{u(""),h(""),f("4100"),g("linux"),b("x86_64"),y(""),_(""),w(!1),r()};return(0,n.jsx)(i.n,{open:e,onClose:S,title:"Register Node",description:"Manually register a node already running the agent",icon:(0,n.jsx)(c.f,{className:"h-5 w-5 text-primary"}),children:(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)(i.G,{label:"Node Name",required:!0,children:(0,n.jsx)("input",{type:"text",value:a,onChange:e=>u(e.target.value),placeholder:"web-server-01",className:i.W,autoFocus:!0})}),(0,n.jsx)(i.G,{label:"FQDN / Hostname",required:!0,children:(0,n.jsx)("input",{type:"text",value:x,onChange:e=>h(e.target.value),placeholder:"node-1.example.com",className:i.W})}),(0,n.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,n.jsx)(i.G,{label:"Port",children:(0,n.jsx)("input",{type:"number",value:m,onChange:e=>f(e.target.value),className:i.W})}),(0,n.jsx)(i.G,{label:"OS",children:(0,n.jsxs)("select",{value:p,onChange:e=>g(e.target.value),className:i.N,children:[(0,n.jsx)("option",{value:"linux",children:"Linux"}),(0,n.jsx)("option",{value:"darwin",children:"macOS"}),(0,n.jsx)("option",{value:"windows",children:"Windows"})]})}),(0,n.jsx)(i.G,{label:"Architecture",children:(0,n.jsxs)("select",{value:v,onChange:e=>b(e.target.value),className:i.N,children:[(0,n.jsx)("option",{value:"x86_64",children:"x86_64"}),(0,n.jsx)("option",{value:"aarch64",children:"aarch64"}),(0,n.jsx)("option",{value:"arm",children:"arm"})]})})]}),(0,n.jsxs)(i.G,{label:"Tags",children:[(0,n.jsx)("input",{type:"text",value:j,onChange:e=>y(e.target.value),placeholder:"web, production, us-east",className:i.W}),(0,n.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"Comma-separated"})]}),k&&(0,n.jsx)("div",{className:"rounded border border-danger/30 bg-danger/10 px-3 py-2 text-xs text-danger",children:k}),(0,n.jsxs)("div",{className:"flex justify-end gap-2 pt-2",children:[(0,n.jsx)(l.K,{variant:"secondary",size:"sm",onClick:S,children:"Cancel"}),(0,n.jsx)(l.K,{size:"sm",onClick:()=>void M(),disabled:N||!a.trim()||!x.trim(),icon:N?(0,n.jsx)(d.f,{className:"h-3.5 w-3.5 animate-spin"}):void 0,children:N?"Registering…":"Register Node"})]})]})})}],14098)},25398,e=>{var r=e.i(56420);let t={name:"rotate-cw",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]};t.node;let a=(0,r.f)(t);e.s(["f",0,a],25398)},90317,(e,r,t)=>{Object.defineProperty(t,"__esModule",{value:!0});var a={bindSnapshot:function(){return d},createAsyncLocalStorage:function(){return o},createSnapshot:function(){return u},getOrCreateGlobalAsyncLocalStorage:function(){return c}};for(var n in a)Object.defineProperty(t,n,{enumerable:!0,get:a[n]});let s=Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available");class l{disable(){throw s}getStore(){}run(){throw s}exit(){throw s}enterWith(){throw s}static bind(e){return e}}let i="u">typeof globalThis&&globalThis.AsyncLocalStorage;function o(){return i?new i:new l}function c(e){let r=Symbol.for(`@next/${e}@16.4.3`),t=globalThis;return t[r]??=o()}function d(e){return i?i.bind(e):l.bind(e)}function u(){return i?i.snapshot():function(e,...r){return e(...r)}}},42344,(e,r,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"workAsyncStorageInstance",{enumerable:!0,get:function(){return a}});let a=(0,e.r(90317).getOrCreateGlobalAsyncLocalStorage)("work-async-storage")},63599,(e,r,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"workAsyncStorage",{enumerable:!0,get:function(){return a.workAsyncStorageInstance}});let a=e.r(42344)},70703,(e,r,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return n}});let a=e.r(55682)._(e.r(69093));function n(e,r){let t={};"function"==typeof e&&(t.loader=e);let n={...t,...r};return(0,a.default)({...n,modules:n.loadableGenerated?.modules})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),r.exports=t.default)},9885,(e,r,t)=>{function a(e){return e.split("/").map(e=>encodeURIComponent(e)).join("/")}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"encodeURIPath",{enumerable:!0,get:function(){return a}})},67585,(e,r,t)=>{e.i(47167),Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BailoutToCSRForNextDynamic",{enumerable:!0,get:function(){return l}});let a=e.r(71645),n=e.r(74080);e.r(32061);let s=e.r(49354).createReactBrowserBailoutReason.bind(null,"next/dynamic");function l({children:e}){return(0,a.use)((0,n.browser)(s)),e}},69093,(e,r,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return c}});let a=e.r(43476),n=e.r(71645),s=e.r(67585),l=e.r(52157);function i(e){return{default:e&&"default"in e?e.default:e}}let o={loader:()=>Promise.resolve(i(()=>null)),loading:null,ssr:!0},c=function(e){let r={...o,...e},t=(0,n.lazy)(()=>r.loader().then(i)),c=r.loading;function d(e){let i=c?(0,a.jsx)(c,{isLoading:!0,pastDelay:!0,error:null}):null,o=!r.ssr||!!r.loading,d=o?n.Suspense:n.Fragment,u=r.ssr?(0,a.jsxs)(a.Fragment,{children:["u"<typeof window?(0,a.jsx)(l.PreloadChunks,{moduleIds:r.modules}):null,(0,a.jsx)(t,{...e})]}):(0,a.jsx)(s.BailoutToCSRForNextDynamic,{children:(0,a.jsx)(t,{...e})});return(0,a.jsx)(d,{...o?{fallback:i}:{},children:u})}return d.displayName="LoadableComponent",d}},52157,(e,r,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"PreloadChunks",{enumerable:!0,get:function(){return o}});let a=e.r(43476),n=e.r(74080),s=e.r(63599),l=e.r(9885),i=e.r(43369);function o({moduleIds:e}){if("u">typeof window)return null;let r=s.workAsyncStorage.getStore();if(void 0===r)return null;let t=[];if(r.reactLoadableManifest&&e){let a=r.reactLoadableManifest;for(let r of e){if(!a[r])continue;let e=a[r].files;t.push(...e)}}if(0===t.length)return null;let c=(0,i.getAssetTokenQuery)();return(0,a.jsx)(a.Fragment,{children:t.map(e=>{let t=`${r.assetPrefix}/_next/${(0,l.encodeURIPath)(e)}${c}`;return e.endsWith(".css")?(0,a.jsx)("link",{precedence:"dynamic",href:t,rel:"stylesheet",as:"style",nonce:r.nonce},e):((0,n.preload)(t,{as:"script",fetchPriority:"low",nonce:r.nonce}),null)})})}},49354,(e,r,t)=>{Object.defineProperty(t,"__esModule",{value:!0});var a={createReactBrowserBailoutReason:function(){return l},getReactBrowserBailoutReason:function(){return i},isNextBrowserBailoutError:function(){return o}};for(var n in a)Object.defineProperty(t,n,{enumerable:!0,get:a[n]});let s=Symbol.for("next.browser-bailout-reason");function l(e){return{$$typeof:s,reason:e}}function i(e){let r=e?.cause;return r?.$$typeof===s?r.reason:void 0}function o(e){return void 0!==i(e)}}])})();
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,[35673,e=>{var t=e.i(43476),a=e.i(64971),r=e.i(71645),n=e.i(41220),s=e.i(62368),i=e.i(32568),o=e.i(4050),l=e.i(39430),d=e.i(82983),c=e.i(58814),u=e.i(32781),h=e.i(66627),p=e.i(56420);let f={name:"wifi-off",size:24,node:[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]};f.node;let m=(0,p.f)(f);var y=e.i(68759);function x({formMode:e,name:a,setName:r,apiSecret:n,setApiSecret:s,hasStoredApiSecret:o,hostname:l,setHostname:d,controlApiPort:c,setControlApiPort:p,url:f,setUrl:g,saving:v,testResult:k,onTestConnection:b,onSave:w,onCancel:j}){return(0,t.jsxs)("div",{className:"space-y-4",children:["create"===e?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i.G,{label:"Hostname",required:!0,children:(0,t.jsx)("input",{type:"text",className:i.W,placeholder:"e.g. magnus.example.com",value:l,onChange:e=>d(e.target.value)})}),(0,t.jsx)(i.G,{label:"Name",children:(0,t.jsx)("input",{type:"text",className:i.W,placeholder:l.trim()||"Defaults to hostname",value:a,onChange:e=>r(e.target.value)})}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-3",children:(0,t.jsx)(i.G,{label:"Control Port",children:(0,t.jsx)("input",{type:"text",className:i.W,placeholder:"4000",value:c,onChange:e=>p(e.target.value)})})}),l.trim()&&(0,t.jsxs)("div",{className:"rounded border border-border bg-bg/50 px-3 py-2 text-xs text-text-muted",children:["URL:"," ",(0,t.jsxs)("span",{className:"text-text",children:["https://",l.trim(),":",parseInt(c,10)||4e3]})]}),(0,t.jsx)(i.G,{label:"Control API Credential",children:(0,t.jsx)("input",{type:"password",className:i.W,placeholder:o?"Leave blank to keep stored credential":"Dedicated Control API credential",value:n,onChange:e=>s(e.target.value)})}),(0,t.jsx)("div",{className:"rounded border border-border bg-bg p-3 text-xs text-text-muted",children:"This registers an already deployed Control API. Provision hosts with the reviewed key-only release runbook."})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i.G,{label:"Name",required:!0,children:(0,t.jsx)("input",{type:"text",className:i.W,placeholder:"e.g. Production East",value:a,onChange:e=>r(e.target.value)})}),(0,t.jsx)(i.G,{label:"URL",required:!0,children:(0,t.jsx)("input",{type:"text",className:i.W,placeholder:"e.g. https://magnus.example.com:4000",value:f,onChange:e=>{g(e.target.value)}})}),(0,t.jsx)(i.G,{label:"Control API Credential",children:(0,t.jsx)("input",{type:"password",className:i.W,placeholder:o?"Leave blank to keep stored credential":"Dedicated Control API credential",value:n,onChange:e=>s(e.target.value)})})]}),(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsx)(y.K,{variant:"ghost",size:"sm",onClick:b,disabled:"testing"===k||("create"===e?!l.trim():!f),icon:"testing"===k?(0,t.jsx)(u.f,{className:"h-3.5 w-3.5 animate-spin"}):"ok"===k?(0,t.jsx)(h.f,{className:"h-3.5 w-3.5 text-success"}):"fail"===k?(0,t.jsx)(m,{className:"h-3.5 w-3.5 text-danger"}):(0,t.jsx)(h.f,{className:"h-3.5 w-3.5"}),children:"testing"===k?"Testing…":"ok"===k?"Connected":"fail"===k?"Failed":"Test Connection"})}),(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-2 border-t border-border",children:[(0,t.jsx)(y.K,{variant:"secondary",size:"md",onClick:j,children:"Cancel"}),(0,t.jsx)(y.K,{variant:"primary",size:"md",onClick:w,disabled:v,icon:v?(0,t.jsx)(u.f,{className:"h-4 w-4 animate-spin"}):void 0,children:v?"Saving…":"create"===e?"Add Node":"Save Changes"})]})]})}var g=e.i(41120),v=e.i(95925),k=e.i(69846);function b({updateStatus:e,updateCheck:a,updateLoading:r,updateResult:n,onCheckUpdates:i,onApplyUpdate:o,onRestart:l,onBack:d}){let c=e?.isGitRepo!==!1&&e?.legacyGitSelfUpdate===!0;return(0,t.jsxs)("div",{className:"space-y-4",children:[e&&(0,t.jsxs)("div",{className:"rounded border border-border bg-bg p-3 space-y-2 text-[11px]",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:"text-text-muted",children:"Control API"}),(0,t.jsxs)("span",{className:"text-xs",children:["v",e.controlApiVersion]})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:"text-text-muted",children:"Agent Version"}),(0,t.jsxs)("span",{className:"text-xs",children:["v",e.agentVersion]})]}),e.gitBranch&&(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("span",{className:"text-text-muted flex items-center gap-1.5",children:[(0,t.jsx)(k.f,{className:"h-3.5 w-3.5"})," Branch"]}),(0,t.jsx)("span",{className:"text-xs",children:e.gitBranch})]}),e.gitCommit&&(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:"text-text-muted",children:"Commit"}),(0,t.jsx)("span",{className:"text-xs",children:e.gitCommit})]}),e.lastChecked&&(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:"text-text-muted",children:"Last Checked"}),(0,t.jsx)("span",{className:"text-xs",children:new Date(e.lastChecked).toLocaleString()})]})]}),e&&!c&&(0,t.jsxs)("div",{className:"rounded border border-primary/30 bg-primary/10 px-3 py-2 text-[11px] text-text-muted","data-testid":"npm-upgrade-notice",children:[(0,t.jsx)("span",{className:"font-bold text-primary",children:"Upgrade on the server host"}),(0,t.jsxs)("span",{className:"ml-1",children:["with ",(0,t.jsx)("code",{className:"rounded bg-surface px-1 text-text",children:e.upgradeCommand??"magnus upgrade"}),": it backs up the database, migrates, restarts and switches back automatically if the new version is unhealthy. See UPGRADING.md."]})]}),a&&a.available&&(0,t.jsxs)("div",{className:"rounded border border-warning/30 bg-warning/10 px-3 py-2 text-[11px]",children:[(0,t.jsx)("span",{className:"font-bold text-warning",children:"Update available"}),(0,t.jsxs)("span",{className:"text-text-muted ml-1",children:["— ",a.behindBy," commit",1!==a.behindBy?"s":""," behind (",a.currentCommit," → ",a.remoteCommit,")"]})]}),n&&(0,t.jsx)("div",{className:"rounded border border-success/30 bg-success/10 px-3 py-2 text-[11px] text-success",children:n}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[c&&(0,t.jsx)(y.K,{variant:"secondary",size:"md",onClick:i,disabled:"idle"!==r,icon:"checking"===r?(0,t.jsx)(u.f,{className:"h-4 w-4 animate-spin"}):(0,t.jsx)(g.f,{className:"h-4 w-4"}),children:"checking"===r?"Checking…":"Check for Updates"}),c&&a?.available&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(y.K,{variant:"primary",size:"md",onClick:()=>o(!1),disabled:"idle"!==r,icon:"applying"===r?(0,t.jsx)(u.f,{className:"h-4 w-4 animate-spin"}):(0,t.jsx)(s.f,{className:"h-4 w-4"}),children:"applying"===r?"Updating…":"Pull & Build"}),(0,t.jsx)(y.K,{variant:"primary",size:"md",onClick:()=>o(!0),disabled:"idle"!==r,icon:"applying"===r?(0,t.jsx)(u.f,{className:"h-4 w-4 animate-spin"}):(0,t.jsx)(v.f,{className:"h-4 w-4"}),children:"applying"===r?"Updating…":"Pull, Build & Restart"})]}),c&&(0,t.jsx)(y.K,{variant:"ghost",size:"md",onClick:l,disabled:"idle"!==r,icon:"restarting"===r?(0,t.jsx)(u.f,{className:"h-4 w-4 animate-spin"}):(0,t.jsx)(v.f,{className:"h-4 w-4"}),children:"restarting"===r?"Restarting…":"Restart Only"})]}),(0,t.jsx)("div",{className:"flex justify-start pt-2 border-t border-border",children:(0,t.jsx)(y.K,{variant:"ghost",size:"md",onClick:d,children:"← Back to list"})})]})}e.s(["f",0,function({open:e,onClose:u,editNodeId:h,createMode:p}){let{nodes:f,addNode:m,updateNode:y,removeNode:g,switchNode:v,activeNode:k}=(0,o.l)(),[w,j]=(0,r.useState)("list"),[N,M]=(0,r.useState)("create"),[C,z]=(0,r.useState)(null),[S,_]=(0,r.useState)(""),[A,E]=(0,r.useState)(""),[P,L]=(0,r.useState)(""),[U,R]=(0,r.useState)(""),[T,I]=(0,r.useState)("4000"),[$,O]=(0,r.useState)(!1),[q,F]=(0,r.useState)(null),[H,B]=(0,r.useState)("idle"),V=(0,r.useRef)(f);function D(){_(""),E(""),L(""),R(""),I("4000"),F(null),B("idle")}function K(){L(""),F(null),O(!1),B("idle"),u()}async function W(e){try{await g(e)}catch(e){F(e instanceof Error?e.message:"Failed to delete")}}async function G(){let e=U.trim(),t="create"===N?`https://${e}:${parseInt(T,10)||4e3}`:A;if(!t||"create"===N&&!e)return void F("Hostname/URL is required to test connection");B("testing"),F(null);try{let e=(0,l.L)(t),a=await fetch("/api/proxy/health",{method:"GET",headers:e,signal:AbortSignal.timeout(1e4)});a.ok?B("ok"):(B("fail"),F(`Connection failed: HTTP ${a.status}`))}catch(e){B("fail"),F(e instanceof Error?e.message:"Connection failed")}}async function J(){let e="create"===N?S.trim()||U.trim():S.trim(),t="create"===N?`https://${U.trim()}:${parseInt(T,10)||4e3}`:A.trim();if("create"===N&&!U.trim())return void F("Hostname is required");if("edit"===N&&!S.trim())return void F("Name is required");if("edit"===N&&!A.trim())return void F("URL is required");O(!0),F(null),L("");try{if("create"===N){let a=await m({name:e,url:t,...P?{apiSecret:P}:{}});v(a.id)}else C&&await y(C,{name:S.trim(),url:A.trim(),...P?{apiSecret:P}:{}});O(!1),0===f.length&&"create"===N?K():j("list")}catch(e){F(e instanceof Error?e.message:"Failed to save"),O(!1)}}V.current=f,(0,r.useEffect)(()=>{if(e)if(F(null),B("idle"),p)j("form"),M("create"),z(null),D();else if(h){let e=V.current.find(e=>e.id===h);e&&(j("form"),M("edit"),z(e.id),_(e.name),E(e.url),L(""))}else j("list")},[e,p,h]);let[Z,X]=(0,r.useState)(null),[Q,Y]=(0,r.useState)(null),[ee,et]=(0,r.useState)("idle"),[ea,er]=(0,r.useState)(null);async function en(){et("checking"),F(null),er(null);try{let e=await d.f.selfUpdate.check();e.success&&(Y(e.data??null),e.data.error?F(e.data.error):e.data.available||er("Already up to date."))}catch(t){let e="Failed to check for updates";if(t&&"object"==typeof t&&"response"in t)try{let r=(0,a.R)(await (0,a.O)(t));r&&(e=r)}catch{}else t instanceof Error&&(e=t.message);F(e)}finally{et("idle")}}async function es(e){et("applying"),F(null),er(null);try{let t=await d.f.selfUpdate.apply(e);if(t.success){let e=t.data;if(!e)return;e.updated?er(`Updated from v${e.previousVersion} → v${e.currentVersion}`+(e.restart?.scheduled?`. Restarting via ${e.restart.method}…`:". Restart manually to apply.")):er("Code pulled but no version change detected."),Y(null);let a=await d.f.selfUpdate.status();a.success&&X(a.data??null)}}catch(e){F(e instanceof Error?e.message:"Update failed")}finally{et("idle")}}async function ei(){et("restarting"),F(null);try{let e=await d.f.selfUpdate.restart();e.success&&er(`Restart scheduled via ${e.data.method}. Reconnecting shortly…`)}catch(e){F(e instanceof Error?e.message:"Restart failed")}finally{et("idle")}}if(!e)return null;let eo="list"===w?"Manage remote Control API endpoints":"update"===w?`Update the active Control Node (${k.name})`:"create"===N?"Connect to a remote Control API instance":"Update control node settings",el="update"===w?(0,t.jsx)(s.f,{className:"h-5 w-5 text-primary"}):(0,t.jsx)(n.f,{className:"h-5 w-5 text-primary"});return(0,t.jsxs)(i.n,{open:e,onClose:K,title:"list"===w?"Control Nodes":"update"===w?"Update Control Node":"create"===N?"Add Control Node":"Edit Control Node",description:eo,icon:el,className:"max-w-xl",children:[q&&(0,t.jsx)("div",{className:"mb-4 rounded border border-danger/30 bg-danger/10 px-3 py-2 text-[11px] text-danger",children:q}),"list"===w&&(0,t.jsx)(c.f,{nodes:f,activeNodeId:k.id,onEdit:function(e){j("form"),M("edit"),z(e.id),_(e.name),E(e.url),L(""),F(null),B("idle")},onDelete:e=>void W(e),onAdd:function(){j("form"),M("create"),z(null),D()},onUpdate:function(){j("update"),F(null),Y(null),er(null),et("idle"),(async()=>{try{let e=await d.f.selfUpdate.status();e.success&&X(e.data??null)}catch{}})()}}),"form"===w&&(0,t.jsx)(x,{formMode:N,name:S,setName:_,apiSecret:P,setApiSecret:L,hasStoredApiSecret:!!(C&&f.find(e=>e.id===C)?.hasApiSecret),hostname:U,setHostname:R,controlApiPort:T,setControlApiPort:I,url:A,setUrl:e=>{E(e),B("idle")},saving:$,testResult:H,onTestConnection:()=>void G(),onSave:()=>void J(),onCancel:()=>{f.length>0?(L(""),j("list"),F(null)):K()}}),"update"===w&&(0,t.jsx)(b,{activeNodeName:k.name,updateStatus:Z,updateCheck:Q,updateLoading:ee,updateResult:ea,onCheckUpdates:()=>void en(),onApplyUpdate:e=>void es(e),onRestart:()=>void ei(),onBack:()=>j("list")})]})}],35673)},58814,e=>{var t=e.i(43476),a=e.i(41220),r=e.i(15281),n=e.i(59659),s=e.i(77071),i=e.i(62368),o=e.i(68759);e.s(["f",0,function({nodes:e,activeNodeId:l,onEdit:d,onDelete:c,onAdd:u,onUpdate:h}){return(0,t.jsxs)("div",{className:"space-y-3",children:[0===e.length?(0,t.jsx)("div",{className:"rounded border border-border bg-bg p-6 text-center text-[11px] text-text-muted",children:"No control nodes configured. Add one to connect to a remote Control API."}):(0,t.jsx)("div",{className:"space-y-2 max-h-80 overflow-y-auto",children:e.map(e=>(0,t.jsxs)("div",{className:`flex items-center justify-between rounded border px-3 py-2.5 ${e.id===l?"border-primary/50 bg-primary/5":"border-border bg-bg"}`,children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[(0,t.jsx)(a.f,{className:"h-4 w-4 shrink-0 text-text-muted"}),(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("div",{className:"text-[11px] font-bold truncate",children:e.name}),(0,t.jsx)("div",{className:"text-xs text-text-muted truncate",children:e.url})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1 ml-2 shrink-0",children:[e.id===l&&(0,t.jsx)("span",{className:"mr-1 rounded-full bg-primary/20 px-2 py-0.5 text-[10px] font-bold uppercase tracking-wider text-primary",children:"Active"}),(0,t.jsx)("button",{onClick:()=>d(e),className:"rounded-md p-1.5 text-text-muted hover:bg-surface-hover hover:text-text transition-all",title:"Edit",children:(0,t.jsx)(r.f,{className:"h-3.5 w-3.5"})}),(0,t.jsx)("button",{onClick:()=>c(e.id),className:"rounded-md p-1.5 text-text-muted hover:bg-danger/10 hover:text-danger transition-all",title:"Delete",children:(0,t.jsx)(n.f,{className:"h-3.5 w-3.5"})})]})]},e.id))}),(0,t.jsx)(o.K,{variant:"secondary",size:"md",onClick:u,icon:(0,t.jsx)(s.f,{className:"h-4 w-4"}),className:"w-full",children:"Add Control Node"}),(0,t.jsx)(o.K,{variant:"ghost",size:"md",onClick:h,icon:(0,t.jsx)(i.f,{className:"h-4 w-4"}),className:"w-full",children:"Check for Updates"})]})}])},1092,16141,e=>{var t=e.i(43476),a=e.i(71645),r=e.i(15331),n=e.i(78571);let s={connected:!1,entries:[]},i=1,o=new Set;function l(e){for(let t of(s=e,o))t()}let d={subscribe:e=>(o.add(e),()=>o.delete(e)),getSnapshot:()=>s,getServerSnapshot:()=>c,push(e){let t={...e,id:i++,at:e.at??Date.now()};l({...s,entries:[t,...s.entries].slice(0,50)})},setConnected(e){s.connected!==e&&l({...s,connected:e})}},c={connected:!1,entries:[]};e.s(["f",0,d],16141);var u=e.i(72603),h=e.i(2067);let p={info:"text-primary",success:"text-success",warning:"text-warning",error:"text-danger"},f={info:"bg-primary",success:"bg-success",warning:"bg-warning",error:"bg-danger"};function m(){return(0,a.useSyncExternalStore)(d.subscribe,d.getSnapshot,d.getServerSnapshot)}function y(e){return new Date(e).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}function x({entry:e}){return(0,t.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-2 px-4",children:[(0,t.jsx)("span",{className:(0,n.f)("h-1.5 w-1.5 rounded-full",f[e.severity])}),(0,t.jsx)("span",{className:"num text-text-muted/70",children:y(e.at)}),(0,t.jsx)("span",{className:p[e.severity],children:e.title}),e.message&&(0,t.jsx)("span",{className:"text-text-muted",children:e.message})]})}e.s(["J",0,function({className:e}){let{entries:a}=m(),r=(0,u.p)();if(0===a.length)return null;let s=a.slice(0,8),i=s[0];return(0,t.jsxs)("div",{className:(0,n.f)("relative min-w-0 overflow-hidden text-[10px] uppercase tracking-wider",e),children:[(0,t.jsxs)("span",{className:"sr-only","aria-live":"polite",children:["Latest event: ",i.title]}),(0,t.jsx)("div",{"aria-hidden":"true",className:"[mask-image:linear-gradient(90deg,transparent,black_8%,black_92%,transparent)]",children:r||s.length<2?(0,t.jsx)(x,{entry:i}):(0,t.jsx)("div",{className:"flex w-max animate-ticker hover:[animation-play-state:paused]",children:[...s,...s].map((e,a)=>(0,t.jsx)(x,{entry:e},`${e.id}-${a}`))})})]})},"d",0,function({limit:e=8,className:a}){let{entries:s,connected:i}=m();return 0===s.length?(0,t.jsx)(h.f,{compact:!0,icon:(0,t.jsx)(r.f,{className:"h-4 w-4"}),tone:i?"primary":"muted",title:i?"Listening for fleet events":"Event stream connecting",description:"Deploys, upgrades, command results and alerts appear here as they happen.",className:a}):(0,t.jsx)("ul",{className:(0,n.f)("space-y-1.5",a),"aria-live":"off",children:s.slice(0,e).map(e=>(0,t.jsxs)("li",{className:"scan-sweep flex items-center gap-2.5 rounded-chip border border-border/60 bg-surface-raised/60 px-3 py-2 text-[11px]",children:[(0,t.jsx)("span",{className:(0,n.f)("h-1.5 w-1.5 shrink-0 rounded-full shadow-[0_0_6px_currentColor]",f[e.severity],p[e.severity])}),(0,t.jsxs)("span",{className:(0,n.f)("min-w-0 flex-1 truncate",p[e.severity]),children:[e.title,e.message&&(0,t.jsx)("span",{className:"ml-2 text-text-muted",children:e.message})]}),(0,t.jsx)("span",{className:"num shrink-0 text-[10px] text-text-muted",children:y(e.at)})]},e.id))})}],1092)},68759,e=>{var t=e.i(43476),a=e.i(78571);let r={primary:"border border-primary/60 bg-primary/10 text-primary hover:bg-primary/20 hover:border-primary hover:shadow-[0_0_12px_var(--color-glow)]",secondary:"border border-border bg-surface text-text-muted hover:border-primary/40 hover:text-text hover:shadow-[0_0_8px_var(--color-glow)]",danger:"border border-danger/60 bg-danger/10 text-danger hover:bg-danger/20 hover:border-danger hover:shadow-[0_0_12px_rgba(255,23,68,0.3)]",success:"border border-success/60 bg-success/10 text-success hover:bg-success/20 hover:border-success hover:shadow-[0_0_12px_rgba(0,230,118,0.3)]",ghost:"text-text-muted hover:text-accent hover:drop-shadow-[0_0_6px_var(--color-glow-accent)]"},n={sm:"h-8 px-3 text-[11px]",md:"h-9 px-4 text-xs",lg:"h-10 px-5 text-xs"};function s(e="primary",t="md",i){return(0,a.f)("inline-flex items-center justify-center gap-2 rounded-chip font-medium uppercase tracking-wider transition-all duration-200 disabled:opacity-50 disabled:pointer-events-none",r[e],n[t],i)}e.s(["K",0,function({variant:e="primary",size:a="md",icon:r,children:n,className:i,...o}){return(0,t.jsxs)("button",{className:s(e,a,i),...o,children:[r,n]})},"R",0,s])},2067,e=>{var t=e.i(43476),a=e.i(78571),r=e.i(35084);let n={primary:"border-primary/40 shadow-[0_0_16px_var(--color-glow)]",accent:"border-accent/40 shadow-[0_0_16px_var(--color-glow-accent)]",success:"border-success/40 shadow-[0_0_16px_var(--color-glow-success)]",warning:"border-warning/40 shadow-[0_0_16px_var(--color-glow-warning)]",danger:"border-danger/40 shadow-[0_0_16px_var(--color-glow-danger)]",info:"border-info/40 shadow-[0_0_16px_var(--color-glow)]",muted:"border-border-strong"},s={primary:"border-primary/20",accent:"border-accent/25",success:"border-success/20",warning:"border-warning/25",danger:"border-danger/25",info:"border-info/20",muted:"border-border"};e.s(["f",0,function({title:e,description:i,icon:o,action:l,tone:d="muted",compact:c=!1,className:u,testId:h}){return(0,t.jsxs)("div",{"data-testid":h,role:"danger"===d||"warning"===d?"alert":void 0,className:(0,a.f)("flex flex-col items-center justify-center rounded-panel border border-dashed bg-surface/40 text-center",s[d],c?"gap-2 px-4 py-5":"gap-3 px-6 py-10",u),children:[o&&(0,t.jsx)("span",{className:(0,a.f)("flex items-center justify-center rounded-full border bg-bg",c?"h-8 w-8":"h-12 w-12",n[d],"muted"===d?"text-text-muted":r.T[d]),children:o}),(0,t.jsx)("p",{className:(0,a.f)("font-bold uppercase tracking-wider",c?"text-[11px]":"text-xs","muted"===d?"text-text":r.T[d]),children:e}),i&&(0,t.jsx)("p",{className:"max-w-md text-[11px] leading-relaxed text-text-muted",children:i}),l&&(0,t.jsx)("div",{className:"mt-1",children:l})]})}])},72603,e=>{var t=e.i(71645);let a="(prefers-reduced-motion: reduce)";function r(){return window.matchMedia(a).matches||"low"===document.documentElement.dataset.fx}function n(e){let t=window.matchMedia(a);t.addEventListener("change",e);let r=new MutationObserver(e);return r.observe(document.documentElement,{attributes:!0,attributeFilter:["data-fx"]}),()=>{t.removeEventListener("change",e),r.disconnect()}}let s="magnus:fx";e.s(["P",0,function(){try{let e=window.localStorage.getItem(s);"low"===e?document.documentElement.dataset.fx="low":delete document.documentElement.dataset.fx}catch{}},"d",0,r,"W",0,function(){let e="low"===document.documentElement.dataset.fx?"normal":"low";"low"===e?document.documentElement.dataset.fx="low":delete document.documentElement.dataset.fx;try{window.localStorage.setItem(s,e)}catch{}return e},"p",0,function(){return(0,t.useSyncExternalStore)(n,r,()=>!1)}])},4050,15e3,e=>{var t=e.i(43476),a=e.i(71645);let r={id:"local",name:"Local",url:"",hasApiSecret:!1,apiSecretFingerprint:null,hasToken:!1,tokenFingerprint:null,createdAt:new Date().toISOString()};e.s(["f",0,r],15e3);var n=e.i(82983);let s=(0,a.createContext)(null),i="magnus_active_control_node",o="magnus_active_control_node_cache";function l(e){try{localStorage.setItem(o,JSON.stringify({id:e.id,name:e.name,url:e.url,createdAt:e.createdAt}))}catch{}}e.s(["v",0,function({children:e}){let[d,c]=(0,a.useState)([]),[u,h]=(0,a.useState)(()=>localStorage.getItem(i)??"local"),[p,f]=(0,a.useState)(!0),m=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/control-nodes"),t=await e.json();if(t.success)if(0===t.data.length){let e=await fetch("/api/control-nodes",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:r.name,url:r.url})}),t=await e.json();t.success&&(c([t.data]),h(t.data.id),localStorage.setItem(i,t.data.id))}else c(t.data)}catch{}finally{f(!1)}},[]);(0,a.useEffect)(()=>{localStorage.removeItem("magnus_token"),m()},[m]);let y=(0,a.useMemo)(()=>{let e=d.find(e=>e.id===u);if(e)return e;let t=function(){try{let e,t=localStorage.getItem(o);if(!t)return null;let a=(e=JSON.parse(t),"string"!=typeof e.id||"string"!=typeof e.name||"string"!=typeof e.url||"string"!=typeof e.createdAt?null:{id:e.id,name:e.name,url:e.url,createdAt:e.createdAt});if(!a)return null;return localStorage.setItem(o,JSON.stringify(a)),{...a,hasApiSecret:!1,apiSecretFingerprint:null,hasToken:!1,tokenFingerprint:null}}catch{return null}}();return t&&t.id===u?t:r},[d,u]),x=(0,a.useRef)(null);"local"!==y.id&&x.current!==y.id&&(l(y),x.current=y.id);let g=(0,a.useRef)(null);g.current!==y.id&&(document.cookie=`magnus_active_node_id=${encodeURIComponent(y.id)}; path=/; max-age=31536000; samesite=lax`,g.current=y.id);let v=(0,a.useRef)(null);v.current!==y.id&&(n.f.reconfigure("local"===y.id?"":y.url),v.current=y.id);let k=(0,a.useCallback)(e=>{h(e);{localStorage.setItem(i,e),document.cookie=`magnus_active_node_id=${encodeURIComponent(e)}; path=/; max-age=31536000; samesite=lax`;let t=d.find(t=>t.id===e);t&&l(t)}},[d]),b=(0,a.useCallback)(async e=>{let t=await fetch("/api/control-nodes",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),a=await t.json();if(!a.success)throw Error(a.error??"Failed to add node");return c(e=>[...e,a.data]),a.data},[]),w=(0,a.useCallback)(async(e,t)=>{let a=await fetch(`/api/control-nodes/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),r=await a.json();if(!r.success)throw Error(r.error??"Failed to update node");return c(t=>t.map(t=>t.id===e?r.data:t)),r.data},[]),j=(0,a.useCallback)(async e=>{let t=await fetch(`/api/control-nodes/${e}`,{method:"DELETE"}),a=await t.json();if(!a.success)throw Error(a.error??"Failed to delete node");c(t=>t.filter(t=>t.id!==e)),h(t=>t===e?"local":t)},[]),N=(0,a.useCallback)(async()=>{await m()},[m]),M=(0,a.useMemo)(()=>({nodes:d,activeNode:y,loading:p,switchNode:k,addNode:b,updateNode:w,removeNode:j,refreshNodes:N}),[d,y,p,k,b,w,j,N]);return(0,t.jsx)(s.Provider,{value:M,children:e})},"l",0,function(){let e=(0,a.useContext)(s);if(!e)throw Error("useControlNode must be used within <ControlNodeProvider>");return e}],4050)},64971,e=>{async function t(e){if(!e||"object"!=typeof e)return null;if("data"in e&&void 0!==e.data)return e.data;if("response"in e&&e.response instanceof Response&&!e.response.bodyUsed){let t=await e.response.clone().text().catch(()=>"");if(!t)return null;try{return JSON.parse(t)}catch{return t}}return null}e.s(["R",0,function(e){if(!e||"object"!=typeof e||!("error"in e))return;let t=e.error;if(t&&"object"==typeof t&&"message"in t&&"string"==typeof t.message)return t.message},"O",0,t])},39430,e=>{function t(e){return(e?.trim().replace(/\/+$/,"")??"")||null}e.s(["K",0,t,"L",0,function(e){let a=t(e);return a?{"x-proxy-target":a}:{}}])},35084,e=>{let t={warn:70,crit:90},a={bg:"#000000",surface:"#06060d",border:"#1a1a2e",text:"#e0e0ec",textMuted:"#8a8aab",primary:"#00e5ff",accent:"#ff006e",success:"#00ff41",warning:"#ffb300",danger:"#ff1744",info:"#00b0ff"};e.s(["q",0,t,"H",0,{primary:"bg-primary",accent:"bg-accent",success:"bg-success",warning:"bg-warning",danger:"bg-danger",info:"bg-info",muted:"bg-text-muted"},"z",0,{primary:"glow-text-primary",accent:"glow-text-accent",success:"glow-text-success",warning:"glow-text-warning",danger:"glow-text-danger",info:"glow-text-primary",muted:""},"T",0,{primary:"text-primary",accent:"text-accent",success:"text-success",warning:"text-warning",danger:"text-danger",info:"text-info",muted:"text-text-muted"},"v",0,{primary:"var(--color-primary)",accent:"var(--color-accent)",success:"var(--color-success)",warning:"var(--color-warning)",danger:"var(--color-danger)",info:"var(--color-info)",muted:"var(--color-text-muted)"},"f",0,function(e){return e>=100?"danger":e>=20?"warning":"success"},"s",0,function(){if("u"<typeof document)return a;let e=getComputedStyle(document.documentElement),t=(t,a)=>e.getPropertyValue(t).trim()||a;return{bg:t("--color-bg",a.bg),surface:t("--color-surface",a.surface),border:t("--color-border",a.border),text:t("--color-text",a.text),textMuted:t("--color-text-muted",a.textMuted),primary:t("--color-primary",a.primary),accent:t("--color-accent",a.accent),success:t("--color-success",a.success),warning:t("--color-warning",a.warning),danger:t("--color-danger",a.danger),info:t("--color-info",a.info)}},"Z",0,function(e,a=t){return e>=a.crit?"danger":e>=a.warn?"warning":"success"}])},7670,e=>{e.s(["f",0,function(){for(var e,t,a=0,r="",n=arguments.length;a<n;a++)(e=arguments[a])&&(t=function e(t){var a,r,n="";if("string"==typeof t||"number"==typeof t)n+=t;else if("object"==typeof t)if(Array.isArray(t)){var s=t.length;for(a=0;a<s;a++)t[a]&&(r=e(t[a]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}(e))&&(r&&(r+=" "),r+=t);return r}])},5014,e=>{var t=e.i(71645);let a=(...e)=>e.filter((e,t,a)=>!!e&&""!==e.trim()&&a.indexOf(e)===t).join(" ").trim(),r={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"},n=(0,t.createContext)({}),s=(0,t.forwardRef)(({color:e,size:s,width:i,height:o,strokeWidth:l,absoluteStrokeWidth:d,nonScalingStroke:c,className:u="",children:h,iconNode:p=[],icon:f={node:p,aliases:[],size:24},...m},y)=>{let{size:x=24,strokeWidth:g=2,absoluteStrokeWidth:v=!1,nonScalingStroke:k=!1,color:b="currentColor",className:w=""}=(0,t.useContext)(n)??{},j=!!h||(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;return!1})(m),[N,M,C=[]]=function(e,t={}){return function(e,t={}){let n=t.attributeNames??{},s=e=>n[e]??e,i=e.size??e.width??r.width,o=e.size??e.height??r.height,l=e.aliases?.filter(e=>"string"==typeof e&&""!==e.trim()).map(e=>`lucide-${e}`)??[],d=[...e.name?[`lucide-${e.name}`]:[],...l],c=t.className?.split(" ").filter(Boolean)??[],u=!1===t.includeDefaultClasses?a(...c):a("lucide",...d,...c),h=t.absoluteStrokeWidth?Number(t.strokeWidth??r["stroke-width"])*Number(e.size??e.width??r.width)/Number(t.size??t.width??r.width):t.strokeWidth??r["stroke-width"];return["svg",{...Object.entries(r).reduce((e,[t,a])=>(e[s(t)]=a,e),{}),..."color"in t&&t.color&&{[s("stroke")]:t.color},..."size"in t&&null!=t.size&&{[s("width")]:t.size,[s("height")]:t.size},..."width"in t&&null!=t.width&&{[s("width")]:t.width},..."height"in t&&null!=t.height&&{[s("height")]:t.height},[s("stroke-width")]:h,...u&&{[s("class")]:u},[s("viewBox")]:`0 0 ${i} ${o}`,...!1===t.hasA11yProp?{[s("aria-hidden")]:"true"}:{},..."attributes"in t&&t.attributes},e.node.map(e=>{let[a,r,n]=e,i=t.nonScalingStroke?{[s("vector-effect")]:"non-scaling-stroke",...r}:r;return n?[a,i,n]:[a,i]})]}(e,{...t,attributeNames:{...t.attributeNames,class:"className","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","vector-effect":"vectorEffect"}})}(f,{color:e??b,width:i??s??x,height:o??s??x,strokeWidth:l??g,absoluteStrokeWidth:d??v,nonScalingStroke:c??k,className:a(w,u),hasA11yProp:j,attributes:m});return(0,t.createElement)(N,{ref:y,...M},[...C.map(([e,a])=>(0,t.createElement)(e,a)),...Array.isArray(h)?h:[h]])});e.s(["default",0,s],5014)},56420,e=>{var t=e.i(71645),a=e.i(5014);e.s(["f",0,function(e,r=[],n=[]){let s,i="string"==typeof e?function(e,t,a=[]){if(null==t)throw Error("[lucide]: iconNode is required when icon name is used");return{name:e?.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),size:24,node:t,...a.length>0?{aliases:a}:{}}}(e,r,n):e,o=(0,t.forwardRef)(({className:e,...r},n)=>(0,t.createElement)(a.default,{ref:n,icon:i,className:e,...r}));return i.name&&(o.displayName=(s=(e=>{let t="",a=!1;for(let r of e){if("-"===r||"_"===r||r<=" "){a=t.length>0;continue}0===t.length?t+=r.toLowerCase():t+=a?r.toUpperCase():r,a=!1}return t})(i.name)).charAt(0).toUpperCase()+s.slice(1)),o}],56420)},68877,e=>{var t=e.i(56420);let a={name:"arrow-right",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],68877)},56423,e=>{var t=e.i(56420);let a={name:"book-open",size:24,node:[["path",{d:"M12 5v16",key:"1f6ucr"}],["path",{d:"M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z",key:"1fyvmf"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],56423)},71567,e=>{var t=e.i(56420);let a={name:"bot",size:24,node:[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],71567)},89664,e=>{var t=e.i(56420);let a={name:"check",size:24,node:[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],89664)},16327,e=>{var t=e.i(56420);let a={name:"chevron-down",size:24,node:[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],16327)},67927,e=>{var t=e.i(56420);let a={name:"chevron-right",size:24,node:[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],67927)},24983,e=>{var t=e.i(56420);let a={name:"circle-alert",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],aliases:["alert-circle"]};a.node;let r=(0,t.f)(a);e.s(["f",0,r])},99847,e=>{var t=e.i(24983);e.s(["f",()=>t.f])},69174,e=>{var t=e.i(56420);let a={name:"circle-arrow-up",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]],aliases:["arrow-up-circle"]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],69174)},51757,83967,e=>{var t=e.i(56420);let a={name:"circle-check",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 9-5.5 5.5L8 12",key:"xofnsj"}]],aliases:["check-circle-2"]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],51757);let n={name:"circle-x",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],aliases:["x-circle"]};n.node;let s=(0,t.f)(n);e.s(["f",0,s],83967)},74544,e=>{var t=e.i(56420);let a={name:"clock",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],74544)},52330,e=>{var t=e.i(56420);let a={name:"code-xml",size:24,node:[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],aliases:["code-2"]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],52330)},9584,e=>{var t=e.i(56420);let a={name:"database",size:24,node:[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],9584)},62368,e=>{var t=e.i(56420);let a={name:"download",size:24,node:[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],62368)},90985,e=>{var t=e.i(56420);let a={name:"earth",size:24,node:[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],aliases:["globe-2"]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],90985)},26091,e=>{var t=e.i(56420);let a={name:"file-text",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],26091)},71028,e=>{var t=e.i(56420);let a={name:"gauge",size:24,node:[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],71028)},69846,e=>{var t=e.i(56420);let a={name:"git-branch",size:24,node:[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],69846)},10818,e=>{var t=e.i(56420);let a={name:"info",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],10818)},58925,e=>{var t=e.i(56420);let a={name:"key-round",size:24,node:[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],58925)},70533,e=>{var t=e.i(56420);let a={name:"library",size:24,node:[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],70533)},32781,e=>{var t=e.i(56420);let a={name:"loader-circle",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],aliases:["loader-2"]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],32781)},67784,e=>{var t=e.i(56420);let a={name:"log-out",size:24,node:[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],67784)},15281,e=>{var t=e.i(56420);let a={name:"pencil",size:24,node:[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],15281)},77071,e=>{var t=e.i(56420);let a={name:"plus",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],77071)},20851,e=>{var t=e.i(56420);let a={name:"puzzle",size:24,node:[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],20851)},83892,e=>{var t=e.i(56420);let a={name:"radar",size:24,node:[["path",{d:"M19.07 4.93A10 10 0 0 0 6.99 3.34",key:"z3du51"}],["path",{d:"M4 6h.01",key:"oypzma"}],["path",{d:"M2.29 9.62A10 10 0 1 0 21.31 8.35",key:"qzzz0"}],["path",{d:"M16.24 7.76A6 6 0 1 0 8.23 16.67",key:"1yjesh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M17.99 11.66A6 6 0 0 1 15.77 16.67",key:"1u2y91"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"m13.41 10.59 5.66-5.66",key:"mhq4k0"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],83892)},15331,e=>{var t=e.i(56420);let a={name:"radio",size:24,node:[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],15331)},41120,e=>{var t=e.i(56420);let a={name:"refresh-cw",size:24,node:[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],41120)},94371,e=>{var t=e.i(56420);let a={name:"rocket",size:24,node:[["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}],["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09",key:"u4xsad"}],["path",{d:"M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z",key:"676m9"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05",key:"92ym6u"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],94371)},95925,e=>{var t=e.i(56420);let a={name:"rotate-ccw",size:24,node:[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],95925)},66595,e=>{var t=e.i(56420);let a={name:"search",size:24,node:[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],66595)},41220,e=>{var t=e.i(56420);let a={name:"server",size:24,node:[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],41220)},66794,e=>{var t=e.i(56420);let a={name:"settings",size:24,node:[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],66794)},84026,e=>{var t=e.i(56420);let a={name:"shield-check",size:24,node:[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],84026)},82954,e=>{var t=e.i(56420);let a={name:"shield",size:24,node:[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],82954)},63644,e=>{var t=e.i(56420);let a={name:"siren",size:24,node:[["path",{d:"M7 18v-6a5 5 0 1 1 10 0v6",key:"pcx96s"}],["path",{d:"M5 21a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-1a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2z",key:"1b4s83"}],["path",{d:"M21 12h1",key:"jtio3y"}],["path",{d:"M18.5 4.5 18 5",key:"g5sp9y"}],["path",{d:"M2 12h1",key:"1uaihz"}],["path",{d:"M12 2v1",key:"11qlp1"}],["path",{d:"m4.929 4.929.707.707",key:"1i51kw"}],["path",{d:"M12 12v6",key:"3ahymv"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],63644)},12092,e=>{var t=e.i(56420);let a={name:"sliders-horizontal",size:24,node:[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],12092)},28623,e=>{var t=e.i(56420);let a={name:"sparkles",size:24,node:[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],aliases:["stars"]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],28623)},4139,e=>{var t=e.i(56420);let a={name:"terminal",size:24,node:[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],4139)},59659,e=>{var t=e.i(56420);let a={name:"trash",size:24,node:[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],aliases:["trash-2"]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],59659)},53138,e=>{var t=e.i(56420);let a={name:"triangle-alert",size:24,node:[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aliases:["alert-triangle"]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],53138)},82303,e=>{var t=e.i(56420);let a={name:"users",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],82303)},99835,e=>{var t=e.i(56420);let a={name:"webhook",size:24,node:[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],99835)},66627,e=>{var t=e.i(56420);let a={name:"wifi",size:24,node:[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],66627)},63676,e=>{var t=e.i(56420);let a={name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]};a.node;let r=(0,t.f)(a);e.s(["X",0,r],63676)},64569,e=>{var t=e.i(56420);let a={name:"zap",size:24,node:[["path",{d:"M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z",key:"1v7up4"}]]};a.node;let r=(0,t.f)(a);e.s(["f",0,r],64569)},22016,(e,t,a)=>{e.i(47167),Object.defineProperty(a,"__esModule",{value:!0});var r={default:function(){return x},useLinkStatus:function(){return v}};for(var n in r)Object.defineProperty(a,n,{enumerable:!0,get:r[n]});let s=e.r(90809),i=e.r(43476),o=s._(e.r(71645)),l=e.r(95057),d=e.r(8372),c=e.r(18581),u=e.r(18967),h=e.r(5550),p=e.r(88540),f=e.r(91949),m=e.r(73668),y=e.r(9396);function x(t){var a;let r,n,s,[x,v]=(0,o.useOptimistic)(f.IDLE_LINK_STATUS),k=(0,o.useRef)(null),{href:b,as:w,children:j,prefetch:N=null,passHref:M,replace:C,shallow:z,scroll:S,onClick:_,onMouseEnter:A,onTouchStart:E,legacyBehavior:P=!1,onNavigate:L,transitionTypes:U,ref:R,unstable_dynamicOnHover:T,...I}=t;r=j,P&&("string"==typeof r||"number"==typeof r)&&(r=(0,i.jsx)("a",{children:r}));let $=o.default.useContext(d.AppRouterContext),O=!1!==N,q=!1===N?"none":!0===N?"full":"auto",F="none"!==q?"auto"===q?y.FetchStrategy.PPR:y.FetchStrategy.Full:y.FetchStrategy.PPR,H="string"==typeof(a=w||b)?a:(0,l.formatUrl)(a);if(P){if(r?.$$typeof===Symbol.for("react.lazy"))throw Error("`<Link legacyBehavior>` received a direct child that is either a Server Component, or JSX that was loaded with React.lazy(). This is not supported. Either remove legacyBehavior, or make the direct child a Client Component that renders the Link's `<a>` tag.");n=o.default.Children.only(r)}let B=P?n&&"object"==typeof n&&n.ref:R,V,D=o.default.useCallback(e=>(null!==$&&(k.current=(0,f.mountLinkInstance)(e,H,$,F,O,v,V)),()=>{k.current&&((0,f.unmountLinkForCurrentNavigation)(k.current),k.current=null),(0,f.unmountPrefetchableInstance)(e)}),[O,H,$,F,v,V]),K={ref:(0,c.useMergedRef)(D,B),onClick(t){P||"function"!=typeof _||_(t),P&&n.props&&"function"==typeof n.props.onClick&&n.props.onClick(t),!$||t.defaultPrevented||function(t,a,r,n,s,i,o,l="none"){if("u">typeof window){let d,{nodeName:c}=t.currentTarget;if("A"===c.toUpperCase()&&((d=t.currentTarget.getAttribute("target"))&&"_self"!==d||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.nativeEvent&&2===t.nativeEvent.which)||t.currentTarget.hasAttribute("download"))return;if(!(0,m.isLocalURL)(a)){n&&(t.preventDefault(),location.replace(a));return}if(t.preventDefault(),i){let e=!1;if(i({preventDefault:()=>{e=!0}}),e)return}let{navigate:u}=e.r(32916);u(a,n?"replace":"push",!1===s?p.ScrollBehavior.NoScroll:p.ScrollBehavior.Default,r.current,o,l)}}(t,H,k,C,S,L,U,q)},onMouseEnter(e){P||"function"!=typeof A||A(e),P&&n.props&&"function"==typeof n.props.onMouseEnter&&n.props.onMouseEnter(e),$&&O&&(0,f.onNavigationIntent)(e.currentTarget,!0===T)},onTouchStart:function(e){P||"function"!=typeof E||E(e),P&&n.props&&"function"==typeof n.props.onTouchStart&&n.props.onTouchStart(e),$&&O&&(0,f.onNavigationIntent)(e.currentTarget,!0===T)}};return(0,u.isAbsoluteUrl)(H)?K.href=H:P&&!M&&("a"!==n.type||"href"in n.props)||(K.href=(0,h.addBasePath)(H)),s=P?o.default.cloneElement(n,K):(0,i.jsx)("a",{...I,...K,children:r}),(0,i.jsx)(g.Provider,{value:x,children:s})}let g=(0,o.createContext)(f.IDLE_LINK_STATUS),v=()=>(0,o.useContext)(g);("function"==typeof a.default||"object"==typeof a.default&&null!==a.default)&&void 0===a.default.__esModule&&(Object.defineProperty(a.default,"__esModule",{value:!0}),Object.assign(a.default,a),t.exports=a.default)},18581,(e,t,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),Object.defineProperty(a,"useMergedRef",{enumerable:!0,get:function(){return n}});let r=e.r(71645);function n(e,t){let a=(0,r.useRef)(null),n=(0,r.useRef)(null);return(0,r.useCallback)(r=>{if(null===r){let e=a.current;e&&(a.current=null,e());let t=n.current;t&&(n.current=null,t())}else e&&(a.current=s(e,r)),t&&(n.current=s(t,r))},[e,t])}function s(e,t){if("function"!=typeof e)return e.current=t,()=>{e.current=null};{let a=e(t);return"function"==typeof a?a:()=>e(null)}}("function"==typeof a.default||"object"==typeof a.default&&null!==a.default)&&void 0===a.default.__esModule&&(Object.defineProperty(a.default,"__esModule",{value:!0}),Object.assign(a.default,a),t.exports=a.default)},95057,(e,t,a)=>{e.i(47167),Object.defineProperty(a,"__esModule",{value:!0});var r={formatUrl:function(){return o},formatWithValidation:function(){return d},urlObjectKeys:function(){return l}};for(var n in r)Object.defineProperty(a,n,{enumerable:!0,get:r[n]});let s=e.r(90809)._(e.r(98183)),i=/https?|ftp|gopher|file/;function o(e){let{auth:t,hostname:a}=e,r=e.protocol||"",n=e.pathname||"",o=e.hash||"",l=e.query||"",d=!1;t=t?encodeURIComponent(t).replace(/%3A/i,":")+"@":"",e.host?d=t+e.host:a&&(d=t+(~a.indexOf(":")?`[${a}]`:a),e.port&&(d+=":"+e.port)),l&&"object"==typeof l&&(l=String(s.urlQueryToSearchParams(l)));let c=e.search||l&&`?${l}`||"";return r&&!r.endsWith(":")&&(r+=":"),e.slashes||(!r||i.test(r))&&!1!==d?(d="//"+(d||""),n&&"/"!==n[0]&&(n="/"+n)):d||(d=""),o&&"#"!==o[0]&&(o="#"+o),c&&"?"!==c[0]&&(c="?"+c),n=n.replace(/[?#]/g,encodeURIComponent),c=c.replace("#","%23"),`${r}${d}${n}${c}${o}`}let l=["auth","hash","host","hostname","href","path","pathname","port","protocol","query","search","slashes"];function d(e){return o(e)}},73668,(e,t,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),Object.defineProperty(a,"isLocalURL",{enumerable:!0,get:function(){return s}});let r=e.r(18967),n=e.r(52817);function s(e){if(!(0,r.isAbsoluteUrl)(e))return!0;try{let t=(0,r.getLocationOrigin)(),a=new URL(e,t);return a.origin===t&&(0,n.hasBasePath)(a.pathname)}catch(e){return!1}}},18967,(e,t,a)=>{e.i(47167),Object.defineProperty(a,"__esModule",{value:!0});var r={DecodeError:function(){return x},MiddlewareNotFoundError:function(){return b},MissingStaticPage:function(){return k},NormalizeError:function(){return g},PageNotFoundError:function(){return v},SP:function(){return m},ST:function(){return y},WEB_VITALS:function(){return s},execOnce:function(){return i},getDisplayName:function(){return u},getLocationOrigin:function(){return d},getURL:function(){return c},isAbsoluteUrl:function(){return l},isResSent:function(){return h},loadGetInitialProps:function(){return f},normalizeRepeatedSlashes:function(){return p},stringifyError:function(){return w}};for(var n in r)Object.defineProperty(a,n,{enumerable:!0,get:r[n]});let s=["CLS","FCP","INP","LCP","TTFB"];function i(e){let t,a=!1;return(...r)=>(a||(a=!0,t=e(...r)),t)}let o=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,l=e=>{let t=e.charCodeAt(0);return!!(t>=65&&t<=90||t>=97&&t<=122)&&o.test(e)};function d(){let{protocol:e,hostname:t,port:a}=window.location;return`${e}//${t}${a?":"+a:""}`}function c(){let{href:e}=window.location,t=d();return e.substring(t.length)}function u(e){return"string"==typeof e?e:e.displayName||e.name||"Unknown"}function h(e){return e.finished||e.headersSent}function p(e){let t=e.split("?");return t[0].replace(/\\/g,"/").replace(/\/\/+/g,"/")+(t[1]?`?${t.slice(1).join("?")}`:"")}async function f(e,t){let a=t.res||t.ctx&&t.ctx.res;if(!e.getInitialProps)return t.ctx&&t.Component?{pageProps:await f(t.Component,t.ctx)}:{};let r=await e.getInitialProps(t);if(a&&h(a))return r;if(!r)throw Error(`"${u(e)}.getInitialProps()" should resolve to an object. But found "${r}" instead.`);return r}let m="u">typeof performance,y=m&&["mark","measure","getEntriesByName"].every(e=>"function"==typeof performance[e]);class x extends Error{}class g extends Error{}class v extends Error{constructor(e){super(),this.code="ENOENT",this.name="PageNotFoundError",this.message=`Cannot find module for page: ${e}`}}class k extends Error{constructor(e,t){super(),this.message=`Failed to load static file for page: ${e} ${t}`}}class b extends Error{constructor(){super(),this.code="ENOENT",this.message="Cannot find the middleware module"}}function w(e){return JSON.stringify({message:e.message,stack:e.stack})}}],18566,(e,t,a)=>{t.exports=e.r(76562)}]);
@@ -1 +1 @@
1
- (()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,11513,e=>{var t=e.i(43476),a=e.i(71645),s=e.i(93999),r=e.i(68759),i=e.i(46670),l=e.i(32568),n=e.i(82983),o=e.i(56420);let c={name:"folder-plus",size:24,node:[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]};c.node;let d=(0,o.f)(c),x={name:"file-up",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]]};x.node;let m=(0,o.f)(x);var p=e.i(32781);let h={name:"palette",size:24,node:[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]]};h.node;let u=(0,o.f)(h),g=["#6366f1","#8b5cf6","#ec4899","#ef4444","#f59e0b","#22c55e","#3b82f6","#06b6d4"];function f({open:e,mode:s,category:i,onClose:o,onSaved:c}){let[x,m]=(0,a.useState)(""),[h,y]=(0,a.useState)(""),[v,j]=(0,a.useState)("#6366f1"),[b,N]=(0,a.useState)(!1),[w,k]=(0,a.useState)("");(0,a.useEffect)(()=>{"edit"===s&&i?(m(i.name),y(i.description),j(i.color)):(m(""),y(""),j("#6366f1")),k("")},[s,i,e]);let C=async()=>{if(x.trim()){N(!0),k("");try{"create"===s?await n.f.library.categories.create({name:x.trim(),description:h.trim(),color:v}):i&&await n.f.library.categories.update(i.id,{name:x.trim(),description:h.trim(),color:v}),c(),o()}catch(e){k(e instanceof Error?e.message:"Failed to save category")}finally{N(!1)}}};return(0,t.jsx)(l.n,{open:e,onClose:o,title:"create"===s?"Create Category":"Edit Category",description:"create"===s?"Add a new organizational category":`Editing "${i?.name??""}"`,icon:(0,t.jsx)(d,{className:"h-5 w-5 text-primary"}),children:(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(l.G,{label:"Name",required:!0,children:(0,t.jsx)("input",{type:"text",value:x,onChange:e=>m(e.target.value),placeholder:"e.g. Personality, Templates, Config…",className:l.W,autoFocus:!0})}),(0,t.jsx)(l.G,{label:"Description",children:(0,t.jsx)("textarea",{value:h,onChange:e=>y(e.target.value),placeholder:"What kind of files belong here?",rows:2,className:l.M})}),(0,t.jsx)(l.G,{label:"Color",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[g.map(e=>(0,t.jsx)("button",{onClick:()=>j(e),className:`h-7 w-7 rounded-full border-2 transition-all ${v===e?"border-white scale-110":"border-transparent"}`,style:{backgroundColor:e}},e)),(0,t.jsxs)("div",{className:"ml-2 flex items-center gap-1.5",children:[(0,t.jsx)(u,{className:"h-3.5 w-3.5 text-text-muted"}),(0,t.jsx)("input",{type:"text",value:v,onChange:e=>j(e.target.value),className:`${l.W} !w-24`})]})]})}),w&&(0,t.jsx)("div",{className:"rounded border border-danger/30 bg-danger/10 px-3 py-2 text-xs text-danger",children:w}),(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-2",children:[(0,t.jsx)(r.K,{variant:"secondary",size:"sm",onClick:o,children:"Cancel"}),(0,t.jsx)(r.K,{size:"sm",onClick:()=>void C(),disabled:b||!x.trim(),icon:b?(0,t.jsx)(p.f,{className:"h-3.5 w-3.5 animate-spin"}):void 0,children:b?"Saving…":"create"===s?"Create Category":"Save Changes"})]})]})})}function y({open:e,mode:s,file:i,categories:o,onClose:c,onSaved:d}){let[x,h]=(0,a.useState)(""),[u,g]=(0,a.useState)(""),[f,v]=(0,a.useState)("text/markdown"),[j,b]=(0,a.useState)(""),[N,w]=(0,a.useState)(""),[k,C]=(0,a.useState)(""),[S,z]=(0,a.useState)(!1),[D,T]=(0,a.useState)("");(0,a.useEffect)(()=>{"edit"===s&&i?(h(i.name),g(i.fileName),v(i.mimeType),b(i.content),w(i.categoryId??""),C(i.tags.join(", "))):(h(""),g(""),v("text/markdown"),b(""),w(""),C("")),T("")},[s,i,e]);let M=async()=>{if(x.trim()&&u.trim()){z(!0),T("");try{let e=k.split(",").map(e=>e.trim()).filter(Boolean);"create"===s?await n.f.library.files.create({name:x.trim(),fileName:u.trim(),mimeType:f,content:j,categoryId:N||null,tags:e}):i&&await n.f.library.files.update(i.id,{name:x.trim(),fileName:u.trim(),mimeType:f,content:j,categoryId:N||null,tags:e}),d(),c()}catch(e){T(e instanceof Error?e.message:"Failed to save file")}finally{z(!1)}}};return(0,t.jsx)(l.n,{open:e,onClose:c,title:"create"===s?"Upload File":"Edit File",description:"create"===s?"Add a new file to the library":`Editing "${i?.name??""}"`,icon:(0,t.jsx)(m,{className:"h-5 w-5 text-primary"}),className:"max-w-2xl",children:(0,t.jsxs)("div",{className:"space-y-4",children:["create"===s&&(0,t.jsxs)(l.G,{label:"Upload File",children:[(0,t.jsx)("input",{type:"file",onChange:e=>{let t=e.target.files?.[0];if(!t)return;g(t.name),x||h(t.name.replace(/\.[^/.]+$/,"")),v(t.type||"application/octet-stream");let a=new FileReader;t.type.startsWith("text/")||t.name.endsWith(".md")||t.name.endsWith(".json")||t.name.endsWith(".yaml")||t.name.endsWith(".yml")||t.name.endsWith(".txt")?(a.onload=()=>b(a.result),a.readAsText(t)):(a.onload=()=>{b(a.result.split(",")[1]??"")},a.readAsDataURL(t))},accept:".md,.txt,.json,.yaml,.yml,.pdf,.png,.jpg,.jpeg,.gif,.svg,.webp",className:"block w-full text-xs text-text-muted file:mr-4 file:rounded file:border-0 file:bg-primary/10 file:px-4 file:py-2 file:text-xs file:font-bold file:text-primary hover:file:bg-primary/20 file:cursor-pointer"}),(0,t.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"Or fill in the fields manually below"})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,t.jsx)(l.G,{label:"Display Name",required:!0,children:(0,t.jsx)("input",{type:"text",value:x,onChange:e=>h(e.target.value),placeholder:"SOUL",className:l.W})}),(0,t.jsx)(l.G,{label:"File Name",required:!0,children:(0,t.jsx)("input",{type:"text",value:u,onChange:e=>g(e.target.value),placeholder:"SOUL.md",className:l.W})})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,t.jsx)(l.G,{label:"Category",children:(0,t.jsxs)("select",{value:N,onChange:e=>w(e.target.value),className:l.N,children:[(0,t.jsx)("option",{value:"",children:"Uncategorized"}),o.map(e=>(0,t.jsx)("option",{value:e.id,children:e.name},e.id))]})}),(0,t.jsx)(l.G,{label:"MIME Type",children:(0,t.jsxs)("select",{value:f,onChange:e=>v(e.target.value),className:l.N,children:[(0,t.jsx)("option",{value:"text/markdown",children:"Markdown (.md)"}),(0,t.jsx)("option",{value:"text/plain",children:"Plain Text (.txt)"}),(0,t.jsx)("option",{value:"application/json",children:"JSON (.json)"}),(0,t.jsx)("option",{value:"application/pdf",children:"PDF (.pdf)"}),(0,t.jsx)("option",{value:"image/png",children:"PNG Image"}),(0,t.jsx)("option",{value:"image/jpeg",children:"JPEG Image"}),(0,t.jsx)("option",{value:"image/svg+xml",children:"SVG Image"})]})})]}),(0,t.jsxs)(l.G,{label:"Tags",children:[(0,t.jsx)("input",{type:"text",value:k,onChange:e=>C(e.target.value),placeholder:"personality, config, template",className:l.W}),(0,t.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"Comma-separated"})]}),(f.startsWith("text/")||"application/json"===f)&&(0,t.jsx)(l.G,{label:"Content",children:(0,t.jsx)("textarea",{value:j,onChange:e=>b(e.target.value),placeholder:"File content…",rows:8,className:`${l.M} text-xs`})}),D&&(0,t.jsx)("div",{className:"rounded border border-danger/30 bg-danger/10 px-3 py-2 text-xs text-danger",children:D}),(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-2",children:[(0,t.jsx)(r.K,{variant:"secondary",size:"sm",onClick:c,children:"Cancel"}),(0,t.jsx)(r.K,{size:"sm",onClick:()=>void M(),disabled:S||!x.trim()||!u.trim(),icon:S?(0,t.jsx)(p.f,{className:"h-3.5 w-3.5 animate-spin"}):void 0,children:S?"Saving…":"create"===s?"Upload File":"Save Changes"})]})]})})}function v({open:e,file:a,onClose:s}){if(!a)return null;let r="text/markdown"===a.mimeType||a.fileName.endsWith(".md"),i=a.mimeType.startsWith("text/")||"application/json"===a.mimeType,n=a.mimeType.startsWith("image/"),o="application/pdf"===a.mimeType;return(0,t.jsx)(l.n,{open:e,onClose:s,title:a.name,description:a.fileName,className:"max-w-4xl max-h-[80vh]",children:(0,t.jsxs)("div",{className:"overflow-auto max-h-[60vh]",children:[r&&(0,t.jsx)("div",{className:"prose prose-invert prose-sm max-w-none rounded border border-border bg-bg p-4 text-xs whitespace-pre-wrap leading-relaxed",children:a.content}),i&&!r&&(0,t.jsx)("pre",{className:"rounded border border-border bg-bg p-4 text-xs overflow-auto",children:a.content}),n&&(0,t.jsx)("div",{className:"flex items-center justify-center p-4",children:(0,t.jsx)("img",{src:a.content.startsWith("data:")?a.content:`data:${a.mimeType};base64,${a.content}`,alt:a.name,className:"max-w-full rounded"})}),o&&(0,t.jsx)("div",{className:"flex items-center justify-center p-8 text-text-muted",children:(0,t.jsx)("p",{className:"text-xs",children:"PDF preview not available. Use the download button instead."})}),!i&&!n&&!o&&(0,t.jsx)("div",{className:"flex items-center justify-center p-8 text-text-muted",children:(0,t.jsx)("p",{className:"text-xs",children:"Preview not available for this file type."})})]})})}var j=e.i(94371),b=e.i(51757),N=e.i(83967);function w({open:e,onClose:s,file:i}){let[o,c]=(0,a.useState)([]),[d,x]=(0,a.useState)([]),[m,h]=(0,a.useState)(!1),[u,g]=(0,a.useState)(null),[f,y]=(0,a.useState)(!1),v=(0,a.useCallback)(async()=>{y(!0);try{let e=await n.f.nodes.list({status:"ONLINE"});e.success&&Array.isArray(e.data)&&c(e.data.map(e=>({id:e.id,name:e.name,status:e.status})))}catch{}finally{y(!1)}},[]);(0,a.useEffect)(()=>{e&&(v(),x([]),g(null))},[e,v]);let k=async()=>{if(i&&0!==d.length){h(!0),g(null);try{let e=await n.f.libraryDeploy.deploy({fileId:i.id,nodeIds:d,overwrite:!0});e.success&&Array.isArray(e.data)&&g(e.data)}catch(e){g([{nodeId:"error",nodeName:"Deploy Error",status:"failed",error:e instanceof Error?e.message:"Unknown error"}])}finally{h(!1)}}},C=i?.mimeType==="application/x-magnus-skill"?"Skill":i?.mimeType==="application/x-magnus-cronjob"?"Cron Job":"Item";return(0,t.jsx)(l.n,{open:e,onClose:s,title:`Deploy ${C}`,description:i?.name??"",icon:(0,t.jsx)(j.f,{className:"h-5 w-5 text-primary"}),className:"max-w-lg",children:(0,t.jsxs)("div",{className:"space-y-4",children:[!u&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,t.jsx)("label",{className:"text-[11px] font-bold uppercase tracking-wider text-text-muted",children:"Target Nodes"}),(0,t.jsx)("button",{onClick:()=>{x(o.map(e=>e.id))},className:"text-[10px] text-primary hover:text-primary/80 uppercase tracking-wider transition-all",children:"Select All"})]}),f?(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs text-text-muted py-4 justify-center",children:[(0,t.jsx)(p.f,{className:"h-4 w-4 animate-spin"}),"Loading nodes..."]}):0===o.length?(0,t.jsx)("p",{className:"text-xs text-text-muted py-4 text-center",children:"No online nodes available"}):(0,t.jsx)("div",{className:"space-y-1 max-h-48 overflow-y-auto",children:o.map(e=>(0,t.jsxs)("label",{className:"flex items-center gap-3 rounded border border-border/50 px-3 py-2 hover:border-primary/30 hover:shadow-[0_0_20px_var(--color-glow)] transition-all cursor-pointer",children:[(0,t.jsx)("input",{type:"checkbox",checked:d.includes(e.id),onChange:()=>{var t;return t=e.id,void x(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t])},className:"rounded border-border"}),(0,t.jsx)("span",{className:"text-xs",children:e.name})]},e.id))}),(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-2",children:[(0,t.jsx)(r.K,{variant:"secondary",size:"sm",onClick:s,children:"Cancel"}),(0,t.jsx)(r.K,{size:"sm",onClick:()=>void k(),disabled:m||0===d.length,children:m?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.f,{className:"h-3.5 w-3.5 animate-spin mr-1.5"}),"Deploying..."]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(j.f,{className:"h-3.5 w-3.5 mr-1.5"}),"Deploy to ",d.length," node",1!==d.length?"s":""]})})]})]}),u&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"space-y-2",children:u.map((e,a)=>(0,t.jsxs)("div",{className:"flex items-center gap-3 rounded border border-border/50 px-3 py-2 text-xs",children:["success"===e.status?(0,t.jsx)(b.f,{className:"h-4 w-4 text-success shrink-0"}):(0,t.jsx)(N.f,{className:"h-4 w-4 text-danger shrink-0"}),(0,t.jsx)("span",{className:"font-bold",children:e.nodeName}),e.error&&(0,t.jsx)("span",{className:"text-[10px] text-danger/70 truncate",children:e.error})]},a))}),(0,t.jsx)("div",{className:"flex justify-end pt-2",children:(0,t.jsx)(r.K,{variant:"secondary",size:"sm",onClick:s,children:"Close"})})]})]})})}var k=e.i(4050),C=e.i(71417),S=e.i(78571),z=e.i(63376),D=e.i(70533),T=e.i(66595),M=e.i(41120),_=e.i(15281),E=e.i(59659),A=e.i(72382),I=e.i(62368);let F={name:"copy",size:24,node:[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]};F.node;let P=(0,o.f)(F);var L=e.i(89664);let U={name:"grip-vertical",size:24,node:[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]};U.node;let $=(0,o.f)(U);var W=e.i(26091),O=e.i(15170),G=e.i(5015),R=e.i(29600),B=e.i(69644);let K={name:"funnel",size:24,node:[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],aliases:["filter"]};K.node;let V=(0,o.f)(K),q={name:"layout-grid",size:24,node:[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]};q.node;let H=(0,o.f)(q),J={name:"list",size:24,node:[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]};J.node;let Y=(0,o.f)(J);var Z=e.i(63676),Q=e.i(63230),X=e.i(74544);function ee(e){return"application/x-magnus-skill"===e?(0,t.jsx)(Q.f,{className:"h-4 w-4"}):"application/x-magnus-cronjob"===e?(0,t.jsx)(X.f,{className:"h-4 w-4"}):e.startsWith("image/")?(0,t.jsx)(O.f,{className:"h-4 w-4"}):"application/json"===e?(0,t.jsx)(G.f,{className:"h-4 w-4"}):"text/markdown"===e||"text/plain"===e?(0,t.jsx)(W.f,{className:"h-4 w-4"}):(0,t.jsx)(R.f,{className:"h-4 w-4"})}function et(e){return"application/x-magnus-skill"===e||"application/x-magnus-cronjob"===e}function ea(e){return({"text/markdown":"Markdown","text/plain":"Text","application/json":"JSON","application/pdf":"PDF","image/png":"PNG","image/jpeg":"JPEG","image/svg+xml":"SVG","image/gif":"GIF","image/webp":"WebP","application/x-magnus-skill":"Skill","application/x-magnus-cronjob":"Cron Job"})[e]??e.split("/")[1]?.toUpperCase()??"File"}e.s(["default",0,function({initialCategories:e,initialFiles:l,initialTotalFiles:o}){let{activeNode:c}=(0,k.l)(),[x,p]=(0,a.useState)(e),[h,u]=(0,a.useState)(l),[g,b]=(0,a.useState)(o),[N,F]=(0,a.useState)(!1),[U,W]=(0,a.useState)(l.length>0||e.length>0),[O,G]=(0,a.useState)(""),[R,K]=(0,a.useState)(null),[q,J]=(0,a.useState)(""),[Q,X]=(0,a.useState)("grid"),[es,er]=(0,a.useState)(!1),[ei,el]=(0,a.useState)("create"),[en,eo]=(0,a.useState)(null),[ec,ed]=(0,a.useState)(!1),[ex,em]=(0,a.useState)("create"),[ep,eh]=(0,a.useState)(null),[eu,eg]=(0,a.useState)(null),[ef,ey]=(0,a.useState)(null),[ev,ej]=(0,a.useState)(null),[eb,eN]=(0,a.useState)(null),[ew,ek]=(0,a.useState)(null),eC=(0,a.useCallback)(async()=>{try{let e=await n.f.library.categories.list();p(e.data)}catch{}},[]),eS=(0,a.useCallback)(async()=>{try{let e={};O&&(e.query=O),R&&(e.categoryId=R),q&&(e.mimeType=q),e.pageSize=100;let t=await n.f.library.files.list(e);u(t.data),b(t.pagination?.total??t.data.length)}catch{}},[O,R,q]),ez=(0,a.useCallback)(async()=>{F(!0),await Promise.all([eC(),eS()]),F(!1)},[eC,eS]);(0,a.useEffect)(()=>{U?W(!1):ez()},[ez,c.id]),(0,a.useEffect)(()=>{let e=setTimeout(()=>{eS()},300);return()=>clearTimeout(e)},[O,R,q,eS]);let eD=async e=>{if(confirm(`Delete category "${e.name}"? Files in this category will become uncategorized.`))try{await n.f.library.categories.delete(e.id),R===e.id&&K(null),ez()}catch{}},eT=()=>{em("create"),eh(null),ed(!0)},eM=async e=>{try{let t=(await n.f.library.files.get(e.id)).data;em("edit"),eh(t),ed(!0)}catch{}},e_=async e=>{if(confirm(`Delete "${e.name}" (${e.fileName})?`))try{await n.f.library.files.delete(e.id),ez()}catch{}},eE=async e=>{try{let t=await n.f.library.files.get(e.id);eg(t.data)}catch{}},eA=async e=>{try{let t=(await n.f.library.files.get(e.id)).data;await navigator.clipboard.writeText(t.content??""),ey(e.id),setTimeout(()=>ey(null),2e3)}catch{}},eI=async e=>{try{let t,a=(await n.f.library.files.get(e.id)).data,s=a.content??"";if(a.mimeType.startsWith("text/")||"application/json"===a.mimeType)t=new Blob([s],{type:a.mimeType});else{let e=atob(s),r=new Uint8Array(e.length);for(let t=0;t<e.length;t++)r[t]=e.charCodeAt(t);t=new Blob([r],{type:a.mimeType})}let r=URL.createObjectURL(t),i=document.createElement("a");i.href=r,i.download=a.fileName,i.click(),URL.revokeObjectURL(r)}catch{}},eF=e=>{eN(e)},eP=(e,t)=>{e.preventDefault(),ek(t)},eL=()=>{ek(null)},eU=async(e,t)=>{if(e.preventDefault(),ek(null),eb)try{await n.f.library.files.move({fileIds:[eb],categoryId:t}),ez()}catch{}finally{eN(null)}},[e$,eW]=(0,a.useState)(!1),eO=async e=>{e.preventDefault(),eW(!1);let t=e.dataTransfer.files;if(0!==t.length){for(let e=0;e<t.length;e++){let a=t[e];if(!a)continue;let s=a.name.replace(/\.[^/.]+$/,""),r=a.type||"application/octet-stream",i=await new Promise(e=>{let t=new FileReader;a.type.startsWith("text/")||a.name.endsWith(".md")||a.name.endsWith(".json")||a.name.endsWith(".yaml")||a.name.endsWith(".yml")||a.name.endsWith(".txt")?(t.onload=()=>e(t.result),t.readAsText(a)):(t.onload=()=>{e(t.result.split(",")[1]??"")},t.readAsDataURL(a))});try{await n.f.library.files.create({name:s,fileName:a.name,mimeType:r,content:i,categoryId:"uncategorized"===R?null:R})}catch{}}ez()}};return(0,t.jsxs)(z.U,{className:"space-y-6",children:[(0,t.jsx)(z.z,{children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{className:"text-lg font-bold uppercase tracking-wider",children:"Library"}),(0,t.jsx)("p",{className:"mt-1 text-[11px] text-text-muted uppercase tracking-wider",children:"Browse, manage, and share Markdown, PDF, and image files"})]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(r.K,{variant:"secondary",size:"sm",icon:(0,t.jsx)(M.f,{className:"h-3.5 w-3.5"}),onClick:()=>void ez(),children:"Refresh"}),(0,t.jsx)(r.K,{variant:"secondary",size:"sm",icon:(0,t.jsx)(d,{className:"h-3.5 w-3.5"}),onClick:()=>{el("create"),eo(null),er(!0)},children:"Category"}),(0,t.jsx)(r.K,{size:"sm",icon:(0,t.jsx)(m,{className:"h-3.5 w-3.5"}),onClick:eT,children:"Upload"})]})]})}),(0,t.jsx)(z.z,{children:(0,t.jsxs)("div",{className:"flex gap-6",children:[(0,t.jsxs)("div",{className:"w-56 shrink-0 space-y-2",children:[(0,t.jsx)("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-text-muted mb-3",children:"Categories"}),(0,t.jsxs)("button",{onClick:()=>K(null),onDragOver:e=>eP(e,null),onDragLeave:eL,onDrop:e=>void eU(e,null),className:(0,S.f)("flex w-full items-center gap-2 rounded px-3 py-2 text-xs transition-all",null===R?"bg-primary/10 text-primary border border-primary/50":"border border-transparent text-text-muted hover:bg-surface-hover hover:text-text"),children:[(0,t.jsx)(D.f,{className:"h-4 w-4"}),(0,t.jsx)("span",{className:"flex-1 text-left",children:"All Files"}),(0,t.jsx)("span",{className:"text-xs opacity-70",children:g})]}),(0,t.jsxs)("button",{onClick:()=>K("uncategorized"),onDragOver:e=>eP(e,"uncategorized"),onDragLeave:eL,onDrop:e=>void eU(e,null),className:(0,S.f)("flex w-full items-center gap-2 rounded px-3 py-2 text-xs transition-all","uncategorized"===ew&&"ring-2 ring-primary","uncategorized"===R?"bg-primary/10 text-primary border border-primary/50":"border border-transparent text-text-muted hover:bg-surface-hover hover:text-text"),children:[(0,t.jsx)(B.f,{className:"h-4 w-4"}),(0,t.jsx)("span",{className:"flex-1 text-left",children:"Uncategorized"})]}),x.map(e=>(0,t.jsxs)("div",{onDragOver:t=>eP(t,e.id),onDragLeave:eL,onDrop:t=>void eU(t,e.id),className:(0,S.f)("group flex items-center gap-2 rounded px-3 py-2 text-xs transition-all cursor-pointer",ew===e.id&&"ring-2 ring-primary",R===e.id?"bg-primary/10 text-primary border border-primary/50":"border border-transparent text-text-muted hover:bg-surface-hover hover:text-text"),onClick:()=>K(e.id),children:[(0,t.jsx)("div",{className:"h-3 w-3 rounded-full shrink-0",style:{backgroundColor:e.color}}),(0,t.jsx)("span",{className:"flex-1 text-left truncate",children:e.name}),(0,t.jsx)("span",{className:"text-xs opacity-70",children:e.fileCount??0}),(0,t.jsxs)("div",{className:"hidden group-hover:flex gap-0.5",children:[(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),el("edit"),eo(e),er(!0)},className:"rounded p-0.5 hover:bg-white/10",children:(0,t.jsx)(_.f,{className:"h-3 w-3"})}),(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),eD(e)},className:"rounded p-0.5 hover:bg-white/10",children:(0,t.jsx)(E.f,{className:"h-3 w-3"})})]})]},e.id))]}),(0,t.jsxs)("div",{className:"flex-1 space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsxs)("div",{className:"relative flex-1",children:[(0,t.jsx)(T.f,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-muted"}),(0,t.jsx)("input",{type:"text",value:O,onChange:e=>G(e.target.value),placeholder:"Search files by name…",className:"w-full rounded border border-border bg-bg py-2 pl-10 pr-4 text-xs text-text placeholder:text-text-muted focus:border-primary focus:outline-none focus:shadow-[0_0_8px_var(--color-glow)] transition-all"}),O&&(0,t.jsx)("button",{onClick:()=>G(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-text-muted hover:text-text",children:(0,t.jsx)(Z.X,{className:"h-3.5 w-3.5"})})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)(V,{className:"h-4 w-4 text-text-muted"}),(0,t.jsxs)("select",{value:q,onChange:e=>J(e.target.value),className:"rounded border border-border bg-bg px-3 py-2 text-xs text-text focus:border-primary focus:outline-none focus:shadow-[0_0_8px_var(--color-glow)] transition-all",children:[(0,t.jsx)("option",{value:"",children:"All Types"}),(0,t.jsx)("option",{value:"text/markdown",children:"Markdown"}),(0,t.jsx)("option",{value:"text/plain",children:"Text"}),(0,t.jsx)("option",{value:"application/json",children:"JSON"}),(0,t.jsx)("option",{value:"application/pdf",children:"PDF"}),(0,t.jsx)("option",{value:"image/",children:"Images"})]})]}),(0,t.jsxs)("div",{className:"flex rounded border border-border",children:[(0,t.jsx)("button",{onClick:()=>X("grid"),className:(0,S.f)("rounded-l p-2 transition-all","grid"===Q?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-hover"),children:(0,t.jsx)(H,{className:"h-4 w-4"})}),(0,t.jsx)("button",{onClick:()=>X("list"),className:(0,S.f)("rounded-r p-2 transition-all","list"===Q?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-hover"),children:(0,t.jsx)(Y,{className:"h-4 w-4"})})]})]}),(0,t.jsx)("div",{onDragOver:e=>{e.preventDefault(),e.dataTransfer.types.includes("Files")&&eW(!0)},onDragLeave:e=>{e.preventDefault(),eW(!1)},onDrop:e=>void eO(e),className:(0,S.f)("min-h-[400px] rounded border-2 border-dashed transition-all",e$?"border-primary bg-primary/5":"border-transparent"),children:N?(0,t.jsx)("div",{className:"py-16 text-center text-[11px] text-text-muted",children:"Loading library…"}):0===h.length?(0,t.jsx)(s.N,{children:(0,t.jsxs)("div",{className:"py-16 text-center",children:[(0,t.jsx)(D.f,{className:"mx-auto h-12 w-12 text-text-muted/30 mb-4"}),(0,t.jsx)("p",{className:"text-[11px] text-text-muted mb-2",children:O||q||R?"No files match your filters":"Your library is empty"}),(0,t.jsx)("p",{className:"text-xs text-text-muted mb-4",children:"Upload files or drag & drop them here"}),(0,t.jsx)(r.K,{size:"sm",icon:(0,t.jsx)(m,{className:"h-3.5 w-3.5"}),onClick:eT,children:"Upload File"})]})}):"grid"===Q?(0,t.jsx)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:h.map(e=>(0,t.jsxs)("div",{draggable:!0,onDragStart:()=>eF(e.id),onClick:()=>void eM(e),className:"group rounded border border-border bg-surface p-4 transition-all hover:border-primary/30 hover:shadow-[0_0_20px_var(--color-glow)] cursor-pointer",children:[(0,t.jsx)("div",{className:"flex items-start justify-between mb-2",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)($,{className:"h-4 w-4 text-text-muted/40 opacity-0 group-hover:opacity-100 transition-opacity"}),(0,t.jsx)("div",{className:"flex h-8 w-8 items-center justify-center rounded bg-primary/10 text-primary",children:ee(e.mimeType)}),(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("h4",{className:"text-xs font-bold truncate",children:e.name}),(0,t.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.fileName})]})]})}),(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,t.jsx)(i.t,{children:ea(e.mimeType)}),(0,t.jsx)("span",{className:"text-xs text-text-muted",children:(0,C.L)(e.sizeBytes)}),e.category&&(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs",style:{backgroundColor:`${e.category.color}20`,color:e.category.color},children:[(0,t.jsx)("span",{className:"h-1.5 w-1.5 rounded-full",style:{backgroundColor:e.category.color}}),e.category.name]})]}),e.tags.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1 mb-3",children:e.tags.map(e=>(0,t.jsx)("span",{className:"rounded-full bg-surface-hover px-2 py-0.5 text-xs text-text-muted",children:e},e))}),(0,t.jsxs)("div",{className:"flex items-center justify-between text-xs text-text-muted",children:[(0,t.jsx)("span",{children:(0,C.C)(e.updatedAt)}),(0,t.jsxs)("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),eE(e)},className:"rounded p-1 hover:bg-surface-hover",title:"Preview",children:(0,t.jsx)(A.f,{className:"h-3.5 w-3.5"})}),(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),eA(e)},className:"rounded p-1 hover:bg-surface-hover",title:"Copy to clipboard",children:ef===e.id?(0,t.jsx)(L.f,{className:"h-3.5 w-3.5 text-success"}):(0,t.jsx)(P,{className:"h-3.5 w-3.5"})}),(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),eI(e)},className:"rounded p-1 hover:bg-surface-hover",title:"Download",children:(0,t.jsx)(I.f,{className:"h-3.5 w-3.5"})}),(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),eM(e)},className:"rounded p-1 hover:bg-surface-hover",title:"Edit",children:(0,t.jsx)(_.f,{className:"h-3.5 w-3.5"})}),(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),e_(e)},className:"rounded p-1 hover:bg-surface-hover text-danger",title:"Delete",children:(0,t.jsx)(E.f,{className:"h-3.5 w-3.5"})}),et(e.mimeType)&&(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),ej(e)},className:"rounded p-1 hover:bg-surface-hover text-primary",title:"Deploy to nodes",children:(0,t.jsx)(j.f,{className:"h-3.5 w-3.5"})})]})]})]},e.id))}):(0,t.jsx)("div",{className:"rounded border border-border bg-surface divide-y divide-border",children:h.map(e=>(0,t.jsxs)("div",{draggable:!0,onDragStart:()=>eF(e.id),onClick:()=>void eM(e),className:"group flex items-center gap-4 px-4 py-3 transition-colors hover:bg-surface-hover cursor-pointer",children:[(0,t.jsx)($,{className:"h-4 w-4 text-text-muted/40 opacity-0 group-hover:opacity-100 transition-opacity shrink-0"}),(0,t.jsx)("div",{className:"flex h-8 w-8 items-center justify-center rounded bg-primary/10 text-primary shrink-0",children:ee(e.mimeType)}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-xs font-bold truncate",children:e.name}),(0,t.jsx)("span",{className:"text-xs text-text-muted",children:e.fileName})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[(0,t.jsx)(i.t,{children:ea(e.mimeType)}),(0,t.jsx)("span",{className:"text-xs text-text-muted",children:(0,C.L)(e.sizeBytes)}),e.category&&(0,t.jsx)("span",{className:"inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs",style:{backgroundColor:`${e.category.color}20`,color:e.category.color},children:e.category.name}),e.tags.map(e=>(0,t.jsxs)("span",{className:"text-xs text-text-muted",children:["#",e]},e))]})]}),(0,t.jsx)("span",{className:"text-xs text-text-muted shrink-0",children:(0,C.C)(e.updatedAt)}),(0,t.jsxs)("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:[(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),eE(e)},className:"rounded p-1.5 hover:bg-border",title:"Preview",children:(0,t.jsx)(A.f,{className:"h-3.5 w-3.5 text-text-muted"})}),(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),eA(e)},className:"rounded p-1.5 hover:bg-border",title:"Copy",children:ef===e.id?(0,t.jsx)(L.f,{className:"h-3.5 w-3.5 text-success"}):(0,t.jsx)(P,{className:"h-3.5 w-3.5 text-text-muted"})}),(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),eI(e)},className:"rounded p-1.5 hover:bg-border",title:"Download",children:(0,t.jsx)(I.f,{className:"h-3.5 w-3.5 text-text-muted"})}),(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),eM(e)},className:"rounded p-1.5 hover:bg-border",title:"Edit",children:(0,t.jsx)(_.f,{className:"h-3.5 w-3.5 text-text-muted"})}),(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),e_(e)},className:"rounded p-1.5 hover:bg-border text-danger",title:"Delete",children:(0,t.jsx)(E.f,{className:"h-3.5 w-3.5"})}),et(e.mimeType)&&(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),ej(e)},className:"rounded p-1.5 hover:bg-border text-primary",title:"Deploy to nodes",children:(0,t.jsx)(j.f,{className:"h-3.5 w-3.5"})})]})]},e.id))})})]})]})}),(0,t.jsx)(f,{open:es,mode:ei,category:en,onClose:()=>er(!1),onSaved:()=>void ez()}),(0,t.jsx)(y,{open:ec,mode:ex,file:ep,categories:x,onClose:()=>ed(!1),onSaved:()=>void ez()}),(0,t.jsx)(v,{open:!!eu,file:eu,onClose:()=>eg(null)}),(0,t.jsx)(w,{open:!!ev,onClose:()=>ej(null),file:ev})]})}],11513)},46670,e=>{var t=e.i(43476),a=e.i(78571);let s={default:"border-border text-text-muted",success:"border-success/40 text-success bg-success/5 shadow-[0_0_6px_rgba(0,255,65,0.15)]",warning:"border-warning/40 text-warning bg-warning/5 shadow-[0_0_6px_rgba(255,179,0,0.15)]",danger:"border-danger/40 text-danger bg-danger/5 shadow-[0_0_6px_rgba(255,23,68,0.15)]",info:"border-info/40 text-info bg-info/5 shadow-[0_0_6px_rgba(0,176,255,0.15)]"},r={default:"bg-text-muted",success:"bg-success",warning:"bg-warning",danger:"bg-danger",info:"bg-info"};e.s(["t",0,function({children:e,variant:i="default",className:l,dot:n=!1,pulse:o=!1}){return(0,t.jsxs)("span",{className:(0,a.f)("inline-flex items-center gap-1.5 rounded-chip border px-2 py-0.5 text-[10px] font-bold uppercase tracking-wider",s[i],l),children:[n&&(0,t.jsxs)("span",{"aria-hidden":"true",className:"relative inline-flex h-1.5 w-1.5",children:[o&&(0,t.jsx)("span",{className:(0,a.f)("absolute inset-0 rounded-full animate-halo",r[i])}),(0,t.jsx)("span",{className:(0,a.f)("relative inline-flex h-1.5 w-1.5 rounded-full",r[i])})]}),e]})},"k",0,function(e){switch(e.toUpperCase()){case"ONLINE":case"COMPLETED":case"ACTIVE":case"RUNNING":case"INSTALLED":case"HEALTHY":return"success";case"DEGRADED":case"PAUSED":case"QUEUED":case"PENDING":case"INSTALLING":return"warning";case"OFFLINE":case"FAILED":case"ERROR":case"TIMEOUT":case"CANCELLED":case"DECOMMISSIONED":case"CRITICAL":return"danger";case"PROVISIONING":case"UPDATING":return"info";default:return"default"}}])},93999,51196,55427,e=>{var t=e.i(43476),a=e.i(56420);let s={name:"arrow-down-right",size:24,node:[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]]};s.node;let r=(0,a.f)(s);var i=e.i(75775),l=e.i(78571),n=e.i(3062),o=e.i(35084);let c={warning:"shadow-[0_0_6px_var(--color-warning)]",danger:"shadow-[0_0_8px_var(--color-danger)]",accent:"shadow-[0_0_6px_var(--color-accent)]",primary:"shadow-[0_0_6px_var(--color-primary)]"},d={xs:"h-1",sm:"h-1.5",md:"h-2"};function x({value:e,max:a=100,tone:s,thresholds:r=o.q,label:i,size:n="xs",showValue:m=!1,valueLabel:p,glow:h,className:u,testId:g}){let f="number"==typeof e&&Number.isFinite(e),y=f?Math.max(0,Math.min(100,e/(a||1)*100)):0,v=s??(f?(0,o.Z)(y,r):"muted"),j=h||!s&&f&&y>=r.warn,b=p??(f?`${y.toFixed(+(y<10&&y>0))}%`:"—");return(0,t.jsxs)("div",{className:(0,l.f)("flex min-w-0 items-center gap-2",u),"data-testid":g,children:[(0,t.jsx)("div",{role:"meter","aria-label":i,"aria-valuemin":0,"aria-valuemax":a,"aria-valuenow":f?e:void 0,"aria-valuetext":b,className:(0,l.f)("relative flex-1 overflow-hidden rounded-full bg-border/70",d[n]),children:(0,t.jsx)("div",{style:{"--meter":`${y}%`},className:(0,l.f)("h-full w-(--meter) rounded-full transition-[width] duration-700 ease-out-expo starting:w-0",o.H[v],j&&c[v])})}),m&&(0,t.jsx)("span",{className:(0,l.f)("num w-11 shrink-0 text-right text-[11px]",f?o.T[v]:"text-text-muted"),children:b})]})}e.s(["f",0,x],51196);var m=e.i(71645);function p({values:e,tone:a="primary",width:s=160,height:r=32,area:i=!0,max:n,percent:c=!1,threshold:d,live:x=!0,emptyLabel:h="not enough data",className:u,testId:g,label:f,stretch:y=!1}){let v=`spark${(0,m.useId)().replace(/:/g,"")}`;if(e.length<2)return(0,t.jsx)("div",{className:(0,l.f)("flex h-8 items-center text-xs italic text-text-muted",u),"data-testid":g,children:h});let j=o.v[a],b=n??(c?Math.max(100,...e):Math.max(...e,d??0)||1),N=r-4,w=s/(e.length-1),k=e=>2+N-Math.max(0,e)/b*N,C=e.map((e,t)=>[t*w,k(e)]),S=C.map(([e,t])=>`${e.toFixed(1)},${t.toFixed(1)}`).join(" "),z=C[C.length-1];return(0,t.jsxs)("svg",{width:y?"100%":s,height:r,viewBox:`0 0 ${s} ${r}`,preserveAspectRatio:y?"none":void 0,className:(0,l.f)("block overflow-visible",u),"data-testid":g,role:f?"img":void 0,"aria-label":f,"aria-hidden":!f||void 0,children:[i&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("defs",{children:(0,t.jsxs)("linearGradient",{id:v,x1:"0",x2:"0",y1:"0",y2:"1",children:[(0,t.jsx)("stop",{offset:"0%",stopColor:j,stopOpacity:.35}),(0,t.jsx)("stop",{offset:"100%",stopColor:j,stopOpacity:0})]})}),(0,t.jsx)("polygon",{points:`0,${r} ${S} ${s},${r}`,fill:`url(#${v})`})]}),void 0!==d&&(0,t.jsx)("line",{x1:0,x2:s,y1:k(d),y2:k(d),stroke:"var(--color-warning)",strokeOpacity:.5,strokeDasharray:"3 3",strokeWidth:1}),(0,t.jsx)("polyline",{fill:"none",stroke:j,strokeWidth:1.5,vectorEffect:"non-scaling-stroke",strokeLinejoin:"round",strokeLinecap:"round",points:S}),x&&!y&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("circle",{cx:z[0],cy:z[1],r:2.5,fill:j,className:"origin-center animate-halo [transform-box:fill-box]"}),(0,t.jsx)("circle",{cx:z[0],cy:z[1],r:2,fill:j})]})]})}e.s(["f",0,p],55427),e.s(["N",0,function({title:e,description:a,children:s,className:r,action:i,tone:l,corners:o=!1,...c}){return(0,t.jsx)(n.f,{...c,tone:l,corners:o,title:e,description:a,action:i,className:r,children:s})},"n",0,function({label:e,value:a,icon:s,trend:c,spark:d,meter:m,delta:h,tone:u="primary",className:g,testId:f}){let y=!h||h.value>=0===(h.positiveIsGood??!0);return(0,t.jsxs)(n.f,{tone:u,className:(0,l.f)("overflow-hidden",g),testId:f,children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:"text-[10px] font-medium uppercase tracking-[0.15em] text-text-muted",children:e}),s&&(0,t.jsx)("span",{className:"text-primary/60",children:s})]}),(0,t.jsxs)("div",{className:"mt-2 flex items-end justify-between gap-2",children:[(0,t.jsx)("div",{className:(0,l.f)("num text-2xl font-bold","primary"===u?"text-primary neon-text":o.T[u]),children:a}),h&&0!==h.value&&(0,t.jsxs)("span",{className:(0,l.f)("num mb-1 inline-flex items-center gap-0.5 text-[11px]",y?"text-success":"text-danger"),children:[h.value>0?(0,t.jsx)(i.f,{className:"h-3 w-3"}):(0,t.jsx)(r,{className:"h-3 w-3"}),Math.abs(h.value).toFixed(+!Number.isInteger(h.value)),h.unit]})]}),c&&(0,t.jsx)("div",{className:(0,l.f)("mt-1 text-[11px]",c.positive?"text-success":"text-danger"),children:c.value}),void 0!==m&&(0,t.jsx)(x,{value:m,className:"mt-3",label:e}),d&&d.length>1&&(0,t.jsx)("div",{className:"-mx-5 -mb-5 mt-3 opacity-80",children:(0,t.jsx)(p,{values:d,tone:u,width:240,height:28,stretch:!0,live:!1})})]})}],93999)},3062,e=>{var t=e.i(43476),a=e.i(78571),s=e.i(35084);let r={primary:"[--panel-corner-color:color-mix(in_srgb,var(--color-primary)_60%,transparent)]",accent:"[--panel-corner-color:color-mix(in_srgb,var(--color-accent)_70%,transparent)]",success:"[--panel-corner-color:color-mix(in_srgb,var(--color-success)_60%,transparent)]",warning:"[--panel-corner-color:color-mix(in_srgb,var(--color-warning)_70%,transparent)]",danger:"[--panel-corner-color:color-mix(in_srgb,var(--color-danger)_70%,transparent)]",info:"[--panel-corner-color:color-mix(in_srgb,var(--color-info)_60%,transparent)]",muted:"[--panel-corner-color:var(--color-border-strong)]"},i={primary:"[--glow-hover-color:var(--color-glow)]",accent:"[--glow-hover-color:var(--color-glow-accent)]",success:"[--glow-hover-color:var(--color-glow-success)]",warning:"[--glow-hover-color:var(--color-glow-warning)]",danger:"[--glow-hover-color:var(--color-glow-danger)]",info:"[--glow-hover-color:var(--color-glow)]",muted:"[--glow-hover-color:var(--color-glow)]"},l={primary:"hover:border-primary/30",accent:"hover:border-accent/40",success:"hover:border-success/30",warning:"hover:border-warning/40",danger:"hover:border-danger/40",info:"hover:border-info/30",muted:"hover:border-border-strong"},n={none:"",sm:"p-3",md:"p-5",lg:"p-6"};e.s(["f",0,function({tone:e="primary",corners:o=!0,interactive:c=!0,hero:d=!1,title:x,description:m,icon:p,action:h,as:u="div",padding:g="md",testId:f,className:y,children:v,...j}){return(0,t.jsxs)(u,{...j,"data-testid":f??j["data-testid"],className:(0,a.f)("relative rounded-panel border border-border bg-surface transition-colors duration-300",n[g],o&&"panel-corners",o&&r[e],c&&"glow-hover",c&&i[e],c&&l[e],d&&"grid-bg overflow-hidden bg-surface/80",y),children:[(x||h||p)&&(0,t.jsxs)("div",{className:"mb-4 flex items-start justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex min-w-0 items-start gap-2",children:[p&&(0,t.jsx)("span",{className:(0,a.f)("mt-0.5 shrink-0",s.T[e]),children:p}),(0,t.jsxs)("div",{className:"min-w-0",children:[x&&(0,t.jsx)("h3",{className:"text-xs font-bold uppercase tracking-wider",children:x}),m&&(0,t.jsx)("p",{className:"mt-0.5 text-[11px] text-text-muted",children:m})]})]}),h]}),v]})}])},63376,e=>{var t=e.i(43476);e.s(["z",0,function({children:e,className:a}){return(0,t.jsx)("div",{className:`animate-page-in${a?` ${a}`:""}`,children:e})},"U",0,function({children:e,className:a}){return(0,t.jsx)("div",{className:a,children:e})}])},71417,e=>{e.s(["L",0,function(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024));return`${parseFloat((e/Math.pow(1024,t)).toFixed(1))} ${["B","KB","MB","GB","TB"][t]}`},"C",0,function(e){return e?("string"==typeof e?new Date(e):e).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"—"}])},75775,e=>{var t=e.i(56420);let a={name:"arrow-up-right",size:24,node:[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]};a.node;let s=(0,t.f)(a);e.s(["f",0,s],75775)},72382,e=>{var t=e.i(56420);let a={name:"eye",size:24,node:[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]};a.node;let s=(0,t.f)(a);e.s(["f",0,s],72382)},29600,e=>{var t=e.i(56420);let a={name:"file",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]]};a.node;let s=(0,t.f)(a);e.s(["f",0,s],29600)},69644,e=>{var t=e.i(56420);let a={name:"folder-open",size:24,node:[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]};a.node;let s=(0,t.f)(a);e.s(["f",0,s],69644)},15170,5015,e=>{var t=e.i(56420);let a={name:"image",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]};a.node;let s=(0,t.f)(a);e.s(["f",0,s],15170);let r={name:"file-braces",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]],aliases:["file-json"]};r.node;let i=(0,t.f)(r);e.s(["f",0,i],5015)},63230,e=>{var t=e.i(56420);let a={name:"package",size:24,node:[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]};a.node;let s=(0,t.f)(a);e.s(["f",0,s],63230)}])})();
1
+ (()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,11513,e=>{var t=e.i(43476),a=e.i(71645),s=e.i(93999),r=e.i(68759),i=e.i(46670),l=e.i(32568),n=e.i(82983),o=e.i(56420);let c={name:"folder-plus",size:24,node:[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]};c.node;let d=(0,o.f)(c),x={name:"file-up",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]]};x.node;let m=(0,o.f)(x);var p=e.i(32781);let h={name:"palette",size:24,node:[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]]};h.node;let u=(0,o.f)(h),g=["#6366f1","#8b5cf6","#ec4899","#ef4444","#f59e0b","#22c55e","#3b82f6","#06b6d4"];function f({open:e,mode:s,category:i,onClose:o,onSaved:c}){let[x,m]=(0,a.useState)(""),[h,y]=(0,a.useState)(""),[v,j]=(0,a.useState)("#6366f1"),[b,N]=(0,a.useState)(!1),[w,k]=(0,a.useState)("");(0,a.useEffect)(()=>{"edit"===s&&i?(m(i.name),y(i.description),j(i.color)):(m(""),y(""),j("#6366f1")),k("")},[s,i,e]);let C=async()=>{if(x.trim()){N(!0),k("");try{"create"===s?await n.f.library.categories.create({name:x.trim(),description:h.trim(),color:v}):i&&await n.f.library.categories.update(i.id,{name:x.trim(),description:h.trim(),color:v}),c(),o()}catch(e){k(e instanceof Error?e.message:"Failed to save category")}finally{N(!1)}}};return(0,t.jsx)(l.n,{open:e,onClose:o,title:"create"===s?"Create Category":"Edit Category",description:"create"===s?"Add a new organizational category":`Editing "${i?.name??""}"`,icon:(0,t.jsx)(d,{className:"h-5 w-5 text-primary"}),children:(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(l.G,{label:"Name",required:!0,children:(0,t.jsx)("input",{type:"text",value:x,onChange:e=>m(e.target.value),placeholder:"e.g. Personality, Templates, Config…",className:l.W,autoFocus:!0})}),(0,t.jsx)(l.G,{label:"Description",children:(0,t.jsx)("textarea",{value:h,onChange:e=>y(e.target.value),placeholder:"What kind of files belong here?",rows:2,className:l.M})}),(0,t.jsx)(l.G,{label:"Color",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[g.map(e=>(0,t.jsx)("button",{onClick:()=>j(e),className:`h-7 w-7 rounded-full border-2 transition-all ${v===e?"border-white scale-110":"border-transparent"}`,style:{backgroundColor:e}},e)),(0,t.jsxs)("div",{className:"ml-2 flex items-center gap-1.5",children:[(0,t.jsx)(u,{className:"h-3.5 w-3.5 text-text-muted"}),(0,t.jsx)("input",{type:"text",value:v,onChange:e=>j(e.target.value),className:`${l.W} !w-24`})]})]})}),w&&(0,t.jsx)("div",{className:"rounded border border-danger/30 bg-danger/10 px-3 py-2 text-xs text-danger",children:w}),(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-2",children:[(0,t.jsx)(r.K,{variant:"secondary",size:"sm",onClick:o,children:"Cancel"}),(0,t.jsx)(r.K,{size:"sm",onClick:()=>void C(),disabled:b||!x.trim(),icon:b?(0,t.jsx)(p.f,{className:"h-3.5 w-3.5 animate-spin"}):void 0,children:b?"Saving…":"create"===s?"Create Category":"Save Changes"})]})]})})}function y({open:e,mode:s,file:i,categories:o,onClose:c,onSaved:d}){let[x,h]=(0,a.useState)(""),[u,g]=(0,a.useState)(""),[f,v]=(0,a.useState)("text/markdown"),[j,b]=(0,a.useState)(""),[N,w]=(0,a.useState)(""),[k,C]=(0,a.useState)(""),[S,z]=(0,a.useState)(!1),[D,T]=(0,a.useState)("");(0,a.useEffect)(()=>{"edit"===s&&i?(h(i.name),g(i.fileName),v(i.mimeType),b(i.content),w(i.categoryId??""),C(i.tags.join(", "))):(h(""),g(""),v("text/markdown"),b(""),w(""),C("")),T("")},[s,i,e]);let M=async()=>{if(x.trim()&&u.trim()){z(!0),T("");try{let e=k.split(",").map(e=>e.trim()).filter(Boolean);"create"===s?await n.f.library.files.create({name:x.trim(),fileName:u.trim(),mimeType:f,content:j,categoryId:N||null,tags:e}):i&&await n.f.library.files.update(i.id,{name:x.trim(),fileName:u.trim(),mimeType:f,content:j,categoryId:N||null,tags:e}),d(),c()}catch(e){T(e instanceof Error?e.message:"Failed to save file")}finally{z(!1)}}};return(0,t.jsx)(l.n,{open:e,onClose:c,title:"create"===s?"Upload File":"Edit File",description:"create"===s?"Add a new file to the library":`Editing "${i?.name??""}"`,icon:(0,t.jsx)(m,{className:"h-5 w-5 text-primary"}),className:"max-w-2xl",children:(0,t.jsxs)("div",{className:"space-y-4",children:["create"===s&&(0,t.jsxs)(l.G,{label:"Upload File",children:[(0,t.jsx)("input",{type:"file",onChange:e=>{let t=e.target.files?.[0];if(!t)return;g(t.name),x||h(t.name.replace(/\.[^/.]+$/,"")),v(t.type||"application/octet-stream");let a=new FileReader;t.type.startsWith("text/")||t.name.endsWith(".md")||t.name.endsWith(".json")||t.name.endsWith(".yaml")||t.name.endsWith(".yml")||t.name.endsWith(".txt")?(a.onload=()=>b(a.result),a.readAsText(t)):(a.onload=()=>{b(a.result.split(",")[1]??"")},a.readAsDataURL(t))},accept:".md,.txt,.json,.yaml,.yml,.pdf,.png,.jpg,.jpeg,.gif,.svg,.webp",className:"block w-full text-xs text-text-muted file:mr-4 file:rounded file:border-0 file:bg-primary/10 file:px-4 file:py-2 file:text-xs file:font-bold file:text-primary hover:file:bg-primary/20 file:cursor-pointer"}),(0,t.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"Or fill in the fields manually below"})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,t.jsx)(l.G,{label:"Display Name",required:!0,children:(0,t.jsx)("input",{type:"text",value:x,onChange:e=>h(e.target.value),placeholder:"SOUL",className:l.W})}),(0,t.jsx)(l.G,{label:"File Name",required:!0,children:(0,t.jsx)("input",{type:"text",value:u,onChange:e=>g(e.target.value),placeholder:"SOUL.md",className:l.W})})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,t.jsx)(l.G,{label:"Category",children:(0,t.jsxs)("select",{value:N,onChange:e=>w(e.target.value),className:l.N,children:[(0,t.jsx)("option",{value:"",children:"Uncategorized"}),o.map(e=>(0,t.jsx)("option",{value:e.id,children:e.name},e.id))]})}),(0,t.jsx)(l.G,{label:"MIME Type",children:(0,t.jsxs)("select",{value:f,onChange:e=>v(e.target.value),className:l.N,children:[(0,t.jsx)("option",{value:"text/markdown",children:"Markdown (.md)"}),(0,t.jsx)("option",{value:"text/plain",children:"Plain Text (.txt)"}),(0,t.jsx)("option",{value:"application/json",children:"JSON (.json)"}),(0,t.jsx)("option",{value:"application/pdf",children:"PDF (.pdf)"}),(0,t.jsx)("option",{value:"image/png",children:"PNG Image"}),(0,t.jsx)("option",{value:"image/jpeg",children:"JPEG Image"}),(0,t.jsx)("option",{value:"image/svg+xml",children:"SVG Image"})]})})]}),(0,t.jsxs)(l.G,{label:"Tags",children:[(0,t.jsx)("input",{type:"text",value:k,onChange:e=>C(e.target.value),placeholder:"personality, config, template",className:l.W}),(0,t.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"Comma-separated"})]}),(f.startsWith("text/")||"application/json"===f)&&(0,t.jsx)(l.G,{label:"Content",children:(0,t.jsx)("textarea",{value:j,onChange:e=>b(e.target.value),placeholder:"File content…",rows:8,className:`${l.M} text-xs`})}),D&&(0,t.jsx)("div",{className:"rounded border border-danger/30 bg-danger/10 px-3 py-2 text-xs text-danger",children:D}),(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-2",children:[(0,t.jsx)(r.K,{variant:"secondary",size:"sm",onClick:c,children:"Cancel"}),(0,t.jsx)(r.K,{size:"sm",onClick:()=>void M(),disabled:S||!x.trim()||!u.trim(),icon:S?(0,t.jsx)(p.f,{className:"h-3.5 w-3.5 animate-spin"}):void 0,children:S?"Saving…":"create"===s?"Upload File":"Save Changes"})]})]})})}function v({open:e,file:a,onClose:s}){if(!a)return null;let r="text/markdown"===a.mimeType||a.fileName.endsWith(".md"),i=a.mimeType.startsWith("text/")||"application/json"===a.mimeType,n=a.mimeType.startsWith("image/"),o="application/pdf"===a.mimeType;return(0,t.jsx)(l.n,{open:e,onClose:s,title:a.name,description:a.fileName,className:"max-w-4xl max-h-[80vh]",children:(0,t.jsxs)("div",{className:"overflow-auto max-h-[60vh]",children:[r&&(0,t.jsx)("div",{className:"prose prose-invert prose-sm max-w-none rounded border border-border bg-bg p-4 text-xs whitespace-pre-wrap leading-relaxed",children:a.content}),i&&!r&&(0,t.jsx)("pre",{className:"rounded border border-border bg-bg p-4 text-xs overflow-auto",children:a.content}),n&&(0,t.jsx)("div",{className:"flex items-center justify-center p-4",children:(0,t.jsx)("img",{src:a.content.startsWith("data:")?a.content:`data:${a.mimeType};base64,${a.content}`,alt:a.name,className:"max-w-full rounded"})}),o&&(0,t.jsx)("div",{className:"flex items-center justify-center p-8 text-text-muted",children:(0,t.jsx)("p",{className:"text-xs",children:"PDF preview not available. Use the download button instead."})}),!i&&!n&&!o&&(0,t.jsx)("div",{className:"flex items-center justify-center p-8 text-text-muted",children:(0,t.jsx)("p",{className:"text-xs",children:"Preview not available for this file type."})})]})})}var j=e.i(94371),b=e.i(51757),N=e.i(83967);function w({open:e,onClose:s,file:i}){let[o,c]=(0,a.useState)([]),[d,x]=(0,a.useState)([]),[m,h]=(0,a.useState)(!1),[u,g]=(0,a.useState)(null),[f,y]=(0,a.useState)(!1),v=(0,a.useCallback)(async()=>{y(!0);try{let e=await n.f.nodes.list({status:"ONLINE"});e.success&&Array.isArray(e.data)&&c(e.data.map(e=>({id:e.id,name:e.name,status:e.status})))}catch{}finally{y(!1)}},[]);(0,a.useEffect)(()=>{e&&(v(),x([]),g(null))},[e,v]);let k=async()=>{if(i&&0!==d.length){h(!0),g(null);try{let e=await n.f.libraryDeploy.deploy({fileId:i.id,nodeIds:d,overwrite:!0});e.success&&Array.isArray(e.data)&&g(e.data)}catch(e){g([{nodeId:"error",nodeName:"Deploy Error",status:"failed",error:e instanceof Error?e.message:"Unknown error"}])}finally{h(!1)}}},C=i?.mimeType==="application/x-magnus-skill"?"Skill":i?.mimeType==="application/x-magnus-cronjob"?"Cron Job":"Item";return(0,t.jsx)(l.n,{open:e,onClose:s,title:`Deploy ${C}`,description:i?.name??"",icon:(0,t.jsx)(j.f,{className:"h-5 w-5 text-primary"}),className:"max-w-lg",children:(0,t.jsxs)("div",{className:"space-y-4",children:[!u&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,t.jsx)("label",{className:"text-[11px] font-bold uppercase tracking-wider text-text-muted",children:"Target Nodes"}),(0,t.jsx)("button",{onClick:()=>{x(o.map(e=>e.id))},className:"text-[10px] text-primary hover:text-primary/80 uppercase tracking-wider transition-all",children:"Select All"})]}),f?(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs text-text-muted py-4 justify-center",children:[(0,t.jsx)(p.f,{className:"h-4 w-4 animate-spin"}),"Loading nodes..."]}):0===o.length?(0,t.jsx)("p",{className:"text-xs text-text-muted py-4 text-center",children:"No online nodes available"}):(0,t.jsx)("div",{className:"space-y-1 max-h-48 overflow-y-auto",children:o.map(e=>(0,t.jsxs)("label",{className:"flex items-center gap-3 rounded border border-border/50 px-3 py-2 hover:border-primary/30 hover:shadow-[0_0_20px_var(--color-glow)] transition-all cursor-pointer",children:[(0,t.jsx)("input",{type:"checkbox",checked:d.includes(e.id),onChange:()=>{var t;return t=e.id,void x(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t])},className:"rounded border-border"}),(0,t.jsx)("span",{className:"text-xs",children:e.name})]},e.id))}),(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-2",children:[(0,t.jsx)(r.K,{variant:"secondary",size:"sm",onClick:s,children:"Cancel"}),(0,t.jsx)(r.K,{size:"sm",onClick:()=>void k(),disabled:m||0===d.length,children:m?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.f,{className:"h-3.5 w-3.5 animate-spin mr-1.5"}),"Deploying..."]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(j.f,{className:"h-3.5 w-3.5 mr-1.5"}),"Deploy to ",d.length," node",1!==d.length?"s":""]})})]})]}),u&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"space-y-2",children:u.map((e,a)=>(0,t.jsxs)("div",{className:"flex items-center gap-3 rounded border border-border/50 px-3 py-2 text-xs",children:["success"===e.status?(0,t.jsx)(b.f,{className:"h-4 w-4 text-success shrink-0"}):(0,t.jsx)(N.f,{className:"h-4 w-4 text-danger shrink-0"}),(0,t.jsx)("span",{className:"font-bold",children:e.nodeName}),e.error&&(0,t.jsx)("span",{className:"text-[10px] text-danger/70 truncate",children:e.error})]},a))}),(0,t.jsx)("div",{className:"flex justify-end pt-2",children:(0,t.jsx)(r.K,{variant:"secondary",size:"sm",onClick:s,children:"Close"})})]})]})})}var k=e.i(4050),C=e.i(71417),S=e.i(78571),z=e.i(63376),D=e.i(70533),T=e.i(66595),M=e.i(41120),_=e.i(15281),E=e.i(59659),A=e.i(72382),I=e.i(62368);let F={name:"copy",size:24,node:[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]};F.node;let P=(0,o.f)(F);var L=e.i(89664);let U={name:"grip-vertical",size:24,node:[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]};U.node;let $=(0,o.f)(U);var W=e.i(26091),O=e.i(15170),G=e.i(5015),R=e.i(29600),B=e.i(69644);let K={name:"funnel",size:24,node:[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],aliases:["filter"]};K.node;let V=(0,o.f)(K),q={name:"layout-grid",size:24,node:[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]};q.node;let H=(0,o.f)(q),J={name:"list",size:24,node:[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]};J.node;let Y=(0,o.f)(J);var Z=e.i(63676),Q=e.i(79258),X=e.i(74544);function ee(e){return"application/x-magnus-skill"===e?(0,t.jsx)(Q.f,{className:"h-4 w-4"}):"application/x-magnus-cronjob"===e?(0,t.jsx)(X.f,{className:"h-4 w-4"}):e.startsWith("image/")?(0,t.jsx)(O.f,{className:"h-4 w-4"}):"application/json"===e?(0,t.jsx)(G.f,{className:"h-4 w-4"}):"text/markdown"===e||"text/plain"===e?(0,t.jsx)(W.f,{className:"h-4 w-4"}):(0,t.jsx)(R.f,{className:"h-4 w-4"})}function et(e){return"application/x-magnus-skill"===e||"application/x-magnus-cronjob"===e}function ea(e){return({"text/markdown":"Markdown","text/plain":"Text","application/json":"JSON","application/pdf":"PDF","image/png":"PNG","image/jpeg":"JPEG","image/svg+xml":"SVG","image/gif":"GIF","image/webp":"WebP","application/x-magnus-skill":"Skill","application/x-magnus-cronjob":"Cron Job"})[e]??e.split("/")[1]?.toUpperCase()??"File"}e.s(["default",0,function({initialCategories:e,initialFiles:l,initialTotalFiles:o}){let{activeNode:c}=(0,k.l)(),[x,p]=(0,a.useState)(e),[h,u]=(0,a.useState)(l),[g,b]=(0,a.useState)(o),[N,F]=(0,a.useState)(!1),[U,W]=(0,a.useState)(l.length>0||e.length>0),[O,G]=(0,a.useState)(""),[R,K]=(0,a.useState)(null),[q,J]=(0,a.useState)(""),[Q,X]=(0,a.useState)("grid"),[es,er]=(0,a.useState)(!1),[ei,el]=(0,a.useState)("create"),[en,eo]=(0,a.useState)(null),[ec,ed]=(0,a.useState)(!1),[ex,em]=(0,a.useState)("create"),[ep,eh]=(0,a.useState)(null),[eu,eg]=(0,a.useState)(null),[ef,ey]=(0,a.useState)(null),[ev,ej]=(0,a.useState)(null),[eb,eN]=(0,a.useState)(null),[ew,ek]=(0,a.useState)(null),eC=(0,a.useCallback)(async()=>{try{let e=await n.f.library.categories.list();p(e.data)}catch{}},[]),eS=(0,a.useCallback)(async()=>{try{let e={};O&&(e.query=O),R&&(e.categoryId=R),q&&(e.mimeType=q),e.pageSize=100;let t=await n.f.library.files.list(e);u(t.data),b(t.pagination?.total??t.data.length)}catch{}},[O,R,q]),ez=(0,a.useCallback)(async()=>{F(!0),await Promise.all([eC(),eS()]),F(!1)},[eC,eS]);(0,a.useEffect)(()=>{U?W(!1):ez()},[ez,c.id]),(0,a.useEffect)(()=>{let e=setTimeout(()=>{eS()},300);return()=>clearTimeout(e)},[O,R,q,eS]);let eD=async e=>{if(confirm(`Delete category "${e.name}"? Files in this category will become uncategorized.`))try{await n.f.library.categories.delete(e.id),R===e.id&&K(null),ez()}catch{}},eT=()=>{em("create"),eh(null),ed(!0)},eM=async e=>{try{let t=(await n.f.library.files.get(e.id)).data;em("edit"),eh(t),ed(!0)}catch{}},e_=async e=>{if(confirm(`Delete "${e.name}" (${e.fileName})?`))try{await n.f.library.files.delete(e.id),ez()}catch{}},eE=async e=>{try{let t=await n.f.library.files.get(e.id);eg(t.data)}catch{}},eA=async e=>{try{let t=(await n.f.library.files.get(e.id)).data;await navigator.clipboard.writeText(t.content??""),ey(e.id),setTimeout(()=>ey(null),2e3)}catch{}},eI=async e=>{try{let t,a=(await n.f.library.files.get(e.id)).data,s=a.content??"";if(a.mimeType.startsWith("text/")||"application/json"===a.mimeType)t=new Blob([s],{type:a.mimeType});else{let e=atob(s),r=new Uint8Array(e.length);for(let t=0;t<e.length;t++)r[t]=e.charCodeAt(t);t=new Blob([r],{type:a.mimeType})}let r=URL.createObjectURL(t),i=document.createElement("a");i.href=r,i.download=a.fileName,i.click(),URL.revokeObjectURL(r)}catch{}},eF=e=>{eN(e)},eP=(e,t)=>{e.preventDefault(),ek(t)},eL=()=>{ek(null)},eU=async(e,t)=>{if(e.preventDefault(),ek(null),eb)try{await n.f.library.files.move({fileIds:[eb],categoryId:t}),ez()}catch{}finally{eN(null)}},[e$,eW]=(0,a.useState)(!1),eO=async e=>{e.preventDefault(),eW(!1);let t=e.dataTransfer.files;if(0!==t.length){for(let e=0;e<t.length;e++){let a=t[e];if(!a)continue;let s=a.name.replace(/\.[^/.]+$/,""),r=a.type||"application/octet-stream",i=await new Promise(e=>{let t=new FileReader;a.type.startsWith("text/")||a.name.endsWith(".md")||a.name.endsWith(".json")||a.name.endsWith(".yaml")||a.name.endsWith(".yml")||a.name.endsWith(".txt")?(t.onload=()=>e(t.result),t.readAsText(a)):(t.onload=()=>{e(t.result.split(",")[1]??"")},t.readAsDataURL(a))});try{await n.f.library.files.create({name:s,fileName:a.name,mimeType:r,content:i,categoryId:"uncategorized"===R?null:R})}catch{}}ez()}};return(0,t.jsxs)(z.U,{className:"space-y-6",children:[(0,t.jsx)(z.z,{children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{className:"text-lg font-bold uppercase tracking-wider",children:"Library"}),(0,t.jsx)("p",{className:"mt-1 text-[11px] text-text-muted uppercase tracking-wider",children:"Browse, manage, and share Markdown, PDF, and image files"})]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(r.K,{variant:"secondary",size:"sm",icon:(0,t.jsx)(M.f,{className:"h-3.5 w-3.5"}),onClick:()=>void ez(),children:"Refresh"}),(0,t.jsx)(r.K,{variant:"secondary",size:"sm",icon:(0,t.jsx)(d,{className:"h-3.5 w-3.5"}),onClick:()=>{el("create"),eo(null),er(!0)},children:"Category"}),(0,t.jsx)(r.K,{size:"sm",icon:(0,t.jsx)(m,{className:"h-3.5 w-3.5"}),onClick:eT,children:"Upload"})]})]})}),(0,t.jsx)(z.z,{children:(0,t.jsxs)("div",{className:"flex gap-6",children:[(0,t.jsxs)("div",{className:"w-56 shrink-0 space-y-2",children:[(0,t.jsx)("h3",{className:"text-[11px] font-bold uppercase tracking-wider text-text-muted mb-3",children:"Categories"}),(0,t.jsxs)("button",{onClick:()=>K(null),onDragOver:e=>eP(e,null),onDragLeave:eL,onDrop:e=>void eU(e,null),className:(0,S.f)("flex w-full items-center gap-2 rounded px-3 py-2 text-xs transition-all",null===R?"bg-primary/10 text-primary border border-primary/50":"border border-transparent text-text-muted hover:bg-surface-hover hover:text-text"),children:[(0,t.jsx)(D.f,{className:"h-4 w-4"}),(0,t.jsx)("span",{className:"flex-1 text-left",children:"All Files"}),(0,t.jsx)("span",{className:"text-xs opacity-70",children:g})]}),(0,t.jsxs)("button",{onClick:()=>K("uncategorized"),onDragOver:e=>eP(e,"uncategorized"),onDragLeave:eL,onDrop:e=>void eU(e,null),className:(0,S.f)("flex w-full items-center gap-2 rounded px-3 py-2 text-xs transition-all","uncategorized"===ew&&"ring-2 ring-primary","uncategorized"===R?"bg-primary/10 text-primary border border-primary/50":"border border-transparent text-text-muted hover:bg-surface-hover hover:text-text"),children:[(0,t.jsx)(B.f,{className:"h-4 w-4"}),(0,t.jsx)("span",{className:"flex-1 text-left",children:"Uncategorized"})]}),x.map(e=>(0,t.jsxs)("div",{onDragOver:t=>eP(t,e.id),onDragLeave:eL,onDrop:t=>void eU(t,e.id),className:(0,S.f)("group flex items-center gap-2 rounded px-3 py-2 text-xs transition-all cursor-pointer",ew===e.id&&"ring-2 ring-primary",R===e.id?"bg-primary/10 text-primary border border-primary/50":"border border-transparent text-text-muted hover:bg-surface-hover hover:text-text"),onClick:()=>K(e.id),children:[(0,t.jsx)("div",{className:"h-3 w-3 rounded-full shrink-0",style:{backgroundColor:e.color}}),(0,t.jsx)("span",{className:"flex-1 text-left truncate",children:e.name}),(0,t.jsx)("span",{className:"text-xs opacity-70",children:e.fileCount??0}),(0,t.jsxs)("div",{className:"hidden group-hover:flex gap-0.5",children:[(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),el("edit"),eo(e),er(!0)},className:"rounded p-0.5 hover:bg-white/10",children:(0,t.jsx)(_.f,{className:"h-3 w-3"})}),(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),eD(e)},className:"rounded p-0.5 hover:bg-white/10",children:(0,t.jsx)(E.f,{className:"h-3 w-3"})})]})]},e.id))]}),(0,t.jsxs)("div",{className:"flex-1 space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsxs)("div",{className:"relative flex-1",children:[(0,t.jsx)(T.f,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-muted"}),(0,t.jsx)("input",{type:"text",value:O,onChange:e=>G(e.target.value),placeholder:"Search files by name…",className:"w-full rounded border border-border bg-bg py-2 pl-10 pr-4 text-xs text-text placeholder:text-text-muted focus:border-primary focus:outline-none focus:shadow-[0_0_8px_var(--color-glow)] transition-all"}),O&&(0,t.jsx)("button",{onClick:()=>G(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-text-muted hover:text-text",children:(0,t.jsx)(Z.X,{className:"h-3.5 w-3.5"})})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)(V,{className:"h-4 w-4 text-text-muted"}),(0,t.jsxs)("select",{value:q,onChange:e=>J(e.target.value),className:"rounded border border-border bg-bg px-3 py-2 text-xs text-text focus:border-primary focus:outline-none focus:shadow-[0_0_8px_var(--color-glow)] transition-all",children:[(0,t.jsx)("option",{value:"",children:"All Types"}),(0,t.jsx)("option",{value:"text/markdown",children:"Markdown"}),(0,t.jsx)("option",{value:"text/plain",children:"Text"}),(0,t.jsx)("option",{value:"application/json",children:"JSON"}),(0,t.jsx)("option",{value:"application/pdf",children:"PDF"}),(0,t.jsx)("option",{value:"image/",children:"Images"})]})]}),(0,t.jsxs)("div",{className:"flex rounded border border-border",children:[(0,t.jsx)("button",{onClick:()=>X("grid"),className:(0,S.f)("rounded-l p-2 transition-all","grid"===Q?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-hover"),children:(0,t.jsx)(H,{className:"h-4 w-4"})}),(0,t.jsx)("button",{onClick:()=>X("list"),className:(0,S.f)("rounded-r p-2 transition-all","list"===Q?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-hover"),children:(0,t.jsx)(Y,{className:"h-4 w-4"})})]})]}),(0,t.jsx)("div",{onDragOver:e=>{e.preventDefault(),e.dataTransfer.types.includes("Files")&&eW(!0)},onDragLeave:e=>{e.preventDefault(),eW(!1)},onDrop:e=>void eO(e),className:(0,S.f)("min-h-[400px] rounded border-2 border-dashed transition-all",e$?"border-primary bg-primary/5":"border-transparent"),children:N?(0,t.jsx)("div",{className:"py-16 text-center text-[11px] text-text-muted",children:"Loading library…"}):0===h.length?(0,t.jsx)(s.N,{children:(0,t.jsxs)("div",{className:"py-16 text-center",children:[(0,t.jsx)(D.f,{className:"mx-auto h-12 w-12 text-text-muted/30 mb-4"}),(0,t.jsx)("p",{className:"text-[11px] text-text-muted mb-2",children:O||q||R?"No files match your filters":"Your library is empty"}),(0,t.jsx)("p",{className:"text-xs text-text-muted mb-4",children:"Upload files or drag & drop them here"}),(0,t.jsx)(r.K,{size:"sm",icon:(0,t.jsx)(m,{className:"h-3.5 w-3.5"}),onClick:eT,children:"Upload File"})]})}):"grid"===Q?(0,t.jsx)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:h.map(e=>(0,t.jsxs)("div",{draggable:!0,onDragStart:()=>eF(e.id),onClick:()=>void eM(e),className:"group rounded border border-border bg-surface p-4 transition-all hover:border-primary/30 hover:shadow-[0_0_20px_var(--color-glow)] cursor-pointer",children:[(0,t.jsx)("div",{className:"flex items-start justify-between mb-2",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)($,{className:"h-4 w-4 text-text-muted/40 opacity-0 group-hover:opacity-100 transition-opacity"}),(0,t.jsx)("div",{className:"flex h-8 w-8 items-center justify-center rounded bg-primary/10 text-primary",children:ee(e.mimeType)}),(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("h4",{className:"text-xs font-bold truncate",children:e.name}),(0,t.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.fileName})]})]})}),(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,t.jsx)(i.t,{children:ea(e.mimeType)}),(0,t.jsx)("span",{className:"text-xs text-text-muted",children:(0,C.L)(e.sizeBytes)}),e.category&&(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs",style:{backgroundColor:`${e.category.color}20`,color:e.category.color},children:[(0,t.jsx)("span",{className:"h-1.5 w-1.5 rounded-full",style:{backgroundColor:e.category.color}}),e.category.name]})]}),e.tags.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1 mb-3",children:e.tags.map(e=>(0,t.jsx)("span",{className:"rounded-full bg-surface-hover px-2 py-0.5 text-xs text-text-muted",children:e},e))}),(0,t.jsxs)("div",{className:"flex items-center justify-between text-xs text-text-muted",children:[(0,t.jsx)("span",{children:(0,C.C)(e.updatedAt)}),(0,t.jsxs)("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),eE(e)},className:"rounded p-1 hover:bg-surface-hover",title:"Preview",children:(0,t.jsx)(A.f,{className:"h-3.5 w-3.5"})}),(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),eA(e)},className:"rounded p-1 hover:bg-surface-hover",title:"Copy to clipboard",children:ef===e.id?(0,t.jsx)(L.f,{className:"h-3.5 w-3.5 text-success"}):(0,t.jsx)(P,{className:"h-3.5 w-3.5"})}),(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),eI(e)},className:"rounded p-1 hover:bg-surface-hover",title:"Download",children:(0,t.jsx)(I.f,{className:"h-3.5 w-3.5"})}),(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),eM(e)},className:"rounded p-1 hover:bg-surface-hover",title:"Edit",children:(0,t.jsx)(_.f,{className:"h-3.5 w-3.5"})}),(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),e_(e)},className:"rounded p-1 hover:bg-surface-hover text-danger",title:"Delete",children:(0,t.jsx)(E.f,{className:"h-3.5 w-3.5"})}),et(e.mimeType)&&(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),ej(e)},className:"rounded p-1 hover:bg-surface-hover text-primary",title:"Deploy to nodes",children:(0,t.jsx)(j.f,{className:"h-3.5 w-3.5"})})]})]})]},e.id))}):(0,t.jsx)("div",{className:"rounded border border-border bg-surface divide-y divide-border",children:h.map(e=>(0,t.jsxs)("div",{draggable:!0,onDragStart:()=>eF(e.id),onClick:()=>void eM(e),className:"group flex items-center gap-4 px-4 py-3 transition-colors hover:bg-surface-hover cursor-pointer",children:[(0,t.jsx)($,{className:"h-4 w-4 text-text-muted/40 opacity-0 group-hover:opacity-100 transition-opacity shrink-0"}),(0,t.jsx)("div",{className:"flex h-8 w-8 items-center justify-center rounded bg-primary/10 text-primary shrink-0",children:ee(e.mimeType)}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-xs font-bold truncate",children:e.name}),(0,t.jsx)("span",{className:"text-xs text-text-muted",children:e.fileName})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[(0,t.jsx)(i.t,{children:ea(e.mimeType)}),(0,t.jsx)("span",{className:"text-xs text-text-muted",children:(0,C.L)(e.sizeBytes)}),e.category&&(0,t.jsx)("span",{className:"inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs",style:{backgroundColor:`${e.category.color}20`,color:e.category.color},children:e.category.name}),e.tags.map(e=>(0,t.jsxs)("span",{className:"text-xs text-text-muted",children:["#",e]},e))]})]}),(0,t.jsx)("span",{className:"text-xs text-text-muted shrink-0",children:(0,C.C)(e.updatedAt)}),(0,t.jsxs)("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:[(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),eE(e)},className:"rounded p-1.5 hover:bg-border",title:"Preview",children:(0,t.jsx)(A.f,{className:"h-3.5 w-3.5 text-text-muted"})}),(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),eA(e)},className:"rounded p-1.5 hover:bg-border",title:"Copy",children:ef===e.id?(0,t.jsx)(L.f,{className:"h-3.5 w-3.5 text-success"}):(0,t.jsx)(P,{className:"h-3.5 w-3.5 text-text-muted"})}),(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),eI(e)},className:"rounded p-1.5 hover:bg-border",title:"Download",children:(0,t.jsx)(I.f,{className:"h-3.5 w-3.5 text-text-muted"})}),(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),eM(e)},className:"rounded p-1.5 hover:bg-border",title:"Edit",children:(0,t.jsx)(_.f,{className:"h-3.5 w-3.5 text-text-muted"})}),(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),e_(e)},className:"rounded p-1.5 hover:bg-border text-danger",title:"Delete",children:(0,t.jsx)(E.f,{className:"h-3.5 w-3.5"})}),et(e.mimeType)&&(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),ej(e)},className:"rounded p-1.5 hover:bg-border text-primary",title:"Deploy to nodes",children:(0,t.jsx)(j.f,{className:"h-3.5 w-3.5"})})]})]},e.id))})})]})]})}),(0,t.jsx)(f,{open:es,mode:ei,category:en,onClose:()=>er(!1),onSaved:()=>void ez()}),(0,t.jsx)(y,{open:ec,mode:ex,file:ep,categories:x,onClose:()=>ed(!1),onSaved:()=>void ez()}),(0,t.jsx)(v,{open:!!eu,file:eu,onClose:()=>eg(null)}),(0,t.jsx)(w,{open:!!ev,onClose:()=>ej(null),file:ev})]})}],11513)},46670,e=>{var t=e.i(43476),a=e.i(78571);let s={default:"border-border text-text-muted",success:"border-success/40 text-success bg-success/5 shadow-[0_0_6px_rgba(0,255,65,0.15)]",warning:"border-warning/40 text-warning bg-warning/5 shadow-[0_0_6px_rgba(255,179,0,0.15)]",danger:"border-danger/40 text-danger bg-danger/5 shadow-[0_0_6px_rgba(255,23,68,0.15)]",info:"border-info/40 text-info bg-info/5 shadow-[0_0_6px_rgba(0,176,255,0.15)]"},r={default:"bg-text-muted",success:"bg-success",warning:"bg-warning",danger:"bg-danger",info:"bg-info"};e.s(["t",0,function({children:e,variant:i="default",className:l,dot:n=!1,pulse:o=!1}){return(0,t.jsxs)("span",{className:(0,a.f)("inline-flex items-center gap-1.5 rounded-chip border px-2 py-0.5 text-[10px] font-bold uppercase tracking-wider",s[i],l),children:[n&&(0,t.jsxs)("span",{"aria-hidden":"true",className:"relative inline-flex h-1.5 w-1.5",children:[o&&(0,t.jsx)("span",{className:(0,a.f)("absolute inset-0 rounded-full animate-halo",r[i])}),(0,t.jsx)("span",{className:(0,a.f)("relative inline-flex h-1.5 w-1.5 rounded-full",r[i])})]}),e]})},"k",0,function(e){switch(e.toUpperCase()){case"ONLINE":case"COMPLETED":case"ACTIVE":case"RUNNING":case"INSTALLED":case"HEALTHY":return"success";case"DEGRADED":case"PAUSED":case"QUEUED":case"PENDING":case"INSTALLING":return"warning";case"OFFLINE":case"FAILED":case"ERROR":case"TIMEOUT":case"CANCELLED":case"DECOMMISSIONED":case"CRITICAL":return"danger";case"PROVISIONING":case"UPDATING":return"info";default:return"default"}}])},93999,51196,55427,e=>{var t=e.i(43476),a=e.i(56420);let s={name:"arrow-down-right",size:24,node:[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]]};s.node;let r=(0,a.f)(s);var i=e.i(75775),l=e.i(78571),n=e.i(3062),o=e.i(35084);let c={warning:"shadow-[0_0_6px_var(--color-warning)]",danger:"shadow-[0_0_8px_var(--color-danger)]",accent:"shadow-[0_0_6px_var(--color-accent)]",primary:"shadow-[0_0_6px_var(--color-primary)]"},d={xs:"h-1",sm:"h-1.5",md:"h-2"};function x({value:e,max:a=100,tone:s,thresholds:r=o.q,label:i,size:n="xs",showValue:m=!1,valueLabel:p,glow:h,className:u,testId:g}){let f="number"==typeof e&&Number.isFinite(e),y=f?Math.max(0,Math.min(100,e/(a||1)*100)):0,v=s??(f?(0,o.Z)(y,r):"muted"),j=h||!s&&f&&y>=r.warn,b=p??(f?`${y.toFixed(+(y<10&&y>0))}%`:"—");return(0,t.jsxs)("div",{className:(0,l.f)("flex min-w-0 items-center gap-2",u),"data-testid":g,children:[(0,t.jsx)("div",{role:"meter","aria-label":i,"aria-valuemin":0,"aria-valuemax":a,"aria-valuenow":f?e:void 0,"aria-valuetext":b,className:(0,l.f)("relative flex-1 overflow-hidden rounded-full bg-border/70",d[n]),children:(0,t.jsx)("div",{style:{"--meter":`${y}%`},className:(0,l.f)("h-full w-(--meter) rounded-full transition-[width] duration-700 ease-out-expo starting:w-0",o.H[v],j&&c[v])})}),m&&(0,t.jsx)("span",{className:(0,l.f)("num w-11 shrink-0 text-right text-[11px]",f?o.T[v]:"text-text-muted"),children:b})]})}e.s(["f",0,x],51196);var m=e.i(71645);function p({values:e,tone:a="primary",width:s=160,height:r=32,area:i=!0,max:n,percent:c=!1,threshold:d,live:x=!0,emptyLabel:h="not enough data",className:u,testId:g,label:f,stretch:y=!1}){let v=`spark${(0,m.useId)().replace(/:/g,"")}`;if(e.length<2)return(0,t.jsx)("div",{className:(0,l.f)("flex h-8 items-center text-xs italic text-text-muted",u),"data-testid":g,children:h});let j=o.v[a],b=n??(c?Math.max(100,...e):Math.max(...e,d??0)||1),N=r-4,w=s/(e.length-1),k=e=>2+N-Math.max(0,e)/b*N,C=e.map((e,t)=>[t*w,k(e)]),S=C.map(([e,t])=>`${e.toFixed(1)},${t.toFixed(1)}`).join(" "),z=C[C.length-1];return(0,t.jsxs)("svg",{width:y?"100%":s,height:r,viewBox:`0 0 ${s} ${r}`,preserveAspectRatio:y?"none":void 0,className:(0,l.f)("block overflow-visible",u),"data-testid":g,role:f?"img":void 0,"aria-label":f,"aria-hidden":!f||void 0,children:[i&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("defs",{children:(0,t.jsxs)("linearGradient",{id:v,x1:"0",x2:"0",y1:"0",y2:"1",children:[(0,t.jsx)("stop",{offset:"0%",stopColor:j,stopOpacity:.35}),(0,t.jsx)("stop",{offset:"100%",stopColor:j,stopOpacity:0})]})}),(0,t.jsx)("polygon",{points:`0,${r} ${S} ${s},${r}`,fill:`url(#${v})`})]}),void 0!==d&&(0,t.jsx)("line",{x1:0,x2:s,y1:k(d),y2:k(d),stroke:"var(--color-warning)",strokeOpacity:.5,strokeDasharray:"3 3",strokeWidth:1}),(0,t.jsx)("polyline",{fill:"none",stroke:j,strokeWidth:1.5,vectorEffect:"non-scaling-stroke",strokeLinejoin:"round",strokeLinecap:"round",points:S}),x&&!y&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("circle",{cx:z[0],cy:z[1],r:2.5,fill:j,className:"origin-center animate-halo [transform-box:fill-box]"}),(0,t.jsx)("circle",{cx:z[0],cy:z[1],r:2,fill:j})]})]})}e.s(["f",0,p],55427),e.s(["N",0,function({title:e,description:a,children:s,className:r,action:i,tone:l,corners:o=!1,...c}){return(0,t.jsx)(n.f,{...c,tone:l,corners:o,title:e,description:a,action:i,className:r,children:s})},"n",0,function({label:e,value:a,icon:s,trend:c,spark:d,meter:m,delta:h,tone:u="primary",className:g,testId:f}){let y=!h||h.value>=0===(h.positiveIsGood??!0);return(0,t.jsxs)(n.f,{tone:u,className:(0,l.f)("overflow-hidden",g),testId:f,children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:"text-[10px] font-medium uppercase tracking-[0.15em] text-text-muted",children:e}),s&&(0,t.jsx)("span",{className:"text-primary/60",children:s})]}),(0,t.jsxs)("div",{className:"mt-2 flex items-end justify-between gap-2",children:[(0,t.jsx)("div",{className:(0,l.f)("num text-2xl font-bold","primary"===u?"text-primary neon-text":o.T[u]),children:a}),h&&0!==h.value&&(0,t.jsxs)("span",{className:(0,l.f)("num mb-1 inline-flex items-center gap-0.5 text-[11px]",y?"text-success":"text-danger"),children:[h.value>0?(0,t.jsx)(i.f,{className:"h-3 w-3"}):(0,t.jsx)(r,{className:"h-3 w-3"}),Math.abs(h.value).toFixed(+!Number.isInteger(h.value)),h.unit]})]}),c&&(0,t.jsx)("div",{className:(0,l.f)("mt-1 text-[11px]",c.positive?"text-success":"text-danger"),children:c.value}),void 0!==m&&(0,t.jsx)(x,{value:m,className:"mt-3",label:e}),d&&d.length>1&&(0,t.jsx)("div",{className:"-mx-5 -mb-5 mt-3 opacity-80",children:(0,t.jsx)(p,{values:d,tone:u,width:240,height:28,stretch:!0,live:!1})})]})}],93999)},3062,e=>{var t=e.i(43476),a=e.i(78571),s=e.i(35084);let r={primary:"[--panel-corner-color:color-mix(in_srgb,var(--color-primary)_60%,transparent)]",accent:"[--panel-corner-color:color-mix(in_srgb,var(--color-accent)_70%,transparent)]",success:"[--panel-corner-color:color-mix(in_srgb,var(--color-success)_60%,transparent)]",warning:"[--panel-corner-color:color-mix(in_srgb,var(--color-warning)_70%,transparent)]",danger:"[--panel-corner-color:color-mix(in_srgb,var(--color-danger)_70%,transparent)]",info:"[--panel-corner-color:color-mix(in_srgb,var(--color-info)_60%,transparent)]",muted:"[--panel-corner-color:var(--color-border-strong)]"},i={primary:"[--glow-hover-color:var(--color-glow)]",accent:"[--glow-hover-color:var(--color-glow-accent)]",success:"[--glow-hover-color:var(--color-glow-success)]",warning:"[--glow-hover-color:var(--color-glow-warning)]",danger:"[--glow-hover-color:var(--color-glow-danger)]",info:"[--glow-hover-color:var(--color-glow)]",muted:"[--glow-hover-color:var(--color-glow)]"},l={primary:"hover:border-primary/30",accent:"hover:border-accent/40",success:"hover:border-success/30",warning:"hover:border-warning/40",danger:"hover:border-danger/40",info:"hover:border-info/30",muted:"hover:border-border-strong"},n={none:"",sm:"p-3",md:"p-5",lg:"p-6"};e.s(["f",0,function({tone:e="primary",corners:o=!0,interactive:c=!0,hero:d=!1,title:x,description:m,icon:p,action:h,as:u="div",padding:g="md",testId:f,className:y,children:v,...j}){return(0,t.jsxs)(u,{...j,"data-testid":f??j["data-testid"],className:(0,a.f)("relative rounded-panel border border-border bg-surface transition-colors duration-300",n[g],o&&"panel-corners",o&&r[e],c&&"glow-hover",c&&i[e],c&&l[e],d&&"grid-bg overflow-hidden bg-surface/80",y),children:[(x||h||p)&&(0,t.jsxs)("div",{className:"mb-4 flex items-start justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex min-w-0 items-start gap-2",children:[p&&(0,t.jsx)("span",{className:(0,a.f)("mt-0.5 shrink-0",s.T[e]),children:p}),(0,t.jsxs)("div",{className:"min-w-0",children:[x&&(0,t.jsx)("h3",{className:"text-xs font-bold uppercase tracking-wider",children:x}),m&&(0,t.jsx)("p",{className:"mt-0.5 text-[11px] text-text-muted",children:m})]})]}),h]}),v]})}])},63376,e=>{var t=e.i(43476);e.s(["z",0,function({children:e,className:a}){return(0,t.jsx)("div",{className:`animate-page-in${a?` ${a}`:""}`,children:e})},"U",0,function({children:e,className:a}){return(0,t.jsx)("div",{className:a,children:e})}])},71417,e=>{e.s(["L",0,function(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024));return`${parseFloat((e/Math.pow(1024,t)).toFixed(1))} ${["B","KB","MB","GB","TB"][t]}`},"C",0,function(e){return e?("string"==typeof e?new Date(e):e).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"—"}])},75775,e=>{var t=e.i(56420);let a={name:"arrow-up-right",size:24,node:[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]};a.node;let s=(0,t.f)(a);e.s(["f",0,s],75775)},72382,e=>{var t=e.i(56420);let a={name:"eye",size:24,node:[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]};a.node;let s=(0,t.f)(a);e.s(["f",0,s],72382)},29600,e=>{var t=e.i(56420);let a={name:"file",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]]};a.node;let s=(0,t.f)(a);e.s(["f",0,s],29600)},69644,e=>{var t=e.i(56420);let a={name:"folder-open",size:24,node:[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]};a.node;let s=(0,t.f)(a);e.s(["f",0,s],69644)},15170,5015,e=>{var t=e.i(56420);let a={name:"image",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]};a.node;let s=(0,t.f)(a);e.s(["f",0,s],15170);let r={name:"file-braces",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]],aliases:["file-json"]};r.node;let i=(0,t.f)(r);e.s(["f",0,i],5015)},79258,e=>{var t=e.i(56420);let a={name:"package",size:24,node:[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]};a.node;let s=(0,t.f)(a);e.s(["f",0,s],79258)}])})();