rigscope 0.1.5 → 0.1.6

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 (108) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +3 -3
  3. package/.next/build-manifest.json +2 -2
  4. package/.next/prerender-manifest.json +6 -6
  5. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  6. package/.next/server/app/_global-error.html +1 -1
  7. package/.next/server/app/_global-error.rsc +1 -1
  8. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  9. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  11. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  12. package/.next/server/app/_not-found.html +1 -1
  13. package/.next/server/app/_not-found.rsc +2 -2
  14. package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  15. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  16. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  17. package/.next/server/app/administration/page.js +1 -1
  18. package/.next/server/app/administration/page.js.nft.json +1 -1
  19. package/.next/server/app/administration/page_client-reference-manifest.js +1 -1
  20. package/.next/server/app/administration.html +1 -1
  21. package/.next/server/app/administration.rsc +6 -6
  22. package/.next/server/app/administration.segments/_full.segment.rsc +6 -6
  23. package/.next/server/app/administration.segments/_tree.segment.rsc +2 -2
  24. package/.next/server/app/administration.segments/administration/__PAGE__.segment.rsc +6 -6
  25. package/.next/server/app/alerts/page.js +1 -1
  26. package/.next/server/app/alerts/page.js.nft.json +1 -1
  27. package/.next/server/app/alerts/page_client-reference-manifest.js +1 -1
  28. package/.next/server/app/alerts.html +1 -1
  29. package/.next/server/app/alerts.rsc +6 -6
  30. package/.next/server/app/alerts.segments/_full.segment.rsc +6 -6
  31. package/.next/server/app/alerts.segments/_tree.segment.rsc +2 -2
  32. package/.next/server/app/alerts.segments/alerts/__PAGE__.segment.rsc +6 -6
  33. package/.next/server/app/connections/page.js +1 -1
  34. package/.next/server/app/connections/page.js.nft.json +1 -1
  35. package/.next/server/app/connections/page_client-reference-manifest.js +1 -1
  36. package/.next/server/app/connections.html +1 -1
  37. package/.next/server/app/connections.rsc +6 -6
  38. package/.next/server/app/connections.segments/_full.segment.rsc +6 -6
  39. package/.next/server/app/connections.segments/_tree.segment.rsc +2 -2
  40. package/.next/server/app/connections.segments/connections/__PAGE__.segment.rsc +6 -6
  41. package/.next/server/app/history/page.js +2 -2
  42. package/.next/server/app/history/page.js.nft.json +1 -1
  43. package/.next/server/app/history/page_client-reference-manifest.js +1 -1
  44. package/.next/server/app/history.html +1 -1
  45. package/.next/server/app/history.rsc +26 -22
  46. package/.next/server/app/history.segments/_full.segment.rsc +26 -22
  47. package/.next/server/app/history.segments/_tree.segment.rsc +2 -2
  48. package/.next/server/app/history.segments/history/__PAGE__.segment.rsc +23 -20
  49. package/.next/server/app/index.html +1 -1
  50. package/.next/server/app/index.rsc +6 -6
  51. package/.next/server/app/index.segments/__PAGE__.segment.rsc +6 -6
  52. package/.next/server/app/index.segments/_full.segment.rsc +6 -6
  53. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  54. package/.next/server/app/login/page_client-reference-manifest.js +1 -1
  55. package/.next/server/app/login.html +1 -1
  56. package/.next/server/app/login.rsc +2 -2
  57. package/.next/server/app/login.segments/_full.segment.rsc +2 -2
  58. package/.next/server/app/login.segments/_tree.segment.rsc +2 -2
  59. package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
  60. package/.next/server/app/machines/[machineId]/page.js +1 -1
  61. package/.next/server/app/machines/[machineId]/page.js.nft.json +1 -1
  62. package/.next/server/app/machines/[machineId]/page_client-reference-manifest.js +1 -1
  63. package/.next/server/app/page.js +1 -1
  64. package/.next/server/app/page.js.nft.json +1 -1
  65. package/.next/server/app/page_client-reference-manifest.js +1 -1
  66. package/.next/server/app/processes/page.js +2 -2
  67. package/.next/server/app/processes/page.js.nft.json +1 -1
  68. package/.next/server/app/processes/page_client-reference-manifest.js +1 -1
  69. package/.next/server/app/processes.html +1 -1
  70. package/.next/server/app/processes.rsc +21 -19
  71. package/.next/server/app/processes.segments/_full.segment.rsc +21 -19
  72. package/.next/server/app/processes.segments/_tree.segment.rsc +2 -2
  73. package/.next/server/app/processes.segments/processes/__PAGE__.segment.rsc +21 -19
  74. package/.next/server/app-paths-manifest.json +3 -3
  75. package/.next/server/chunks/168.js +1 -1
  76. package/.next/server/chunks/350.js +1 -0
  77. package/.next/server/chunks/751.js +1 -1
  78. package/.next/server/chunks/894.js +2 -2
  79. package/.next/server/middleware-build-manifest.js +1 -1
  80. package/.next/server/pages/404.html +1 -1
  81. package/.next/server/pages/500.html +1 -1
  82. package/.next/static/chunks/103-976549d31902404e.js +1 -0
  83. package/.next/static/chunks/408-9fdba9e4e956ef08.js +1 -0
  84. package/.next/static/chunks/944-a7fe1d96f1d20531.js +1 -0
  85. package/.next/static/chunks/app/administration/page-b62f6610cda5381f.js +1 -0
  86. package/.next/static/chunks/app/alerts/{page-2548b2ab0c057953.js → page-3445bc100ee03d4e.js} +1 -1
  87. package/.next/static/chunks/app/connections/{page-07113bf16cb352e7.js → page-75abd16fc495fcbd.js} +1 -1
  88. package/.next/static/chunks/app/history/page-a25ba8fab7bd7cb9.js +3 -0
  89. package/.next/static/chunks/app/machines/[machineId]/{page-0b89e4393a137c4d.js → page-89143e71c34b542b.js} +1 -1
  90. package/.next/static/chunks/app/{page-c68554c93016dd13.js → page-9c9c89166eee4c92.js} +1 -1
  91. package/.next/static/chunks/app/processes/page-3fdebd2f98b52044.js +3 -0
  92. package/.next/static/css/f5d3162842dcac31.css +1 -0
  93. package/CHANGELOG.md +12 -0
  94. package/dist/collector.cjs +1 -1
  95. package/dist/hub.cjs +1 -1
  96. package/docs/installation.md +3 -3
  97. package/docs/releasing.md +12 -12
  98. package/package.json +1 -1
  99. package/.next/server/chunks/721.js +0 -1
  100. package/.next/static/chunks/103-13ec30dcc059b9d3.js +0 -1
  101. package/.next/static/chunks/157-0d36ebf66af048ac.js +0 -1
  102. package/.next/static/chunks/408-29f55984738967db.js +0 -1
  103. package/.next/static/chunks/app/administration/page-4b16b19bb6a39c36.js +0 -1
  104. package/.next/static/chunks/app/history/page-69ea64476ee5db85.js +0 -3
  105. package/.next/static/chunks/app/processes/page-b6d97d119f10e2a1.js +0 -3
  106. package/.next/static/css/fb3ad9534f4681e6.css +0 -1
  107. /package/.next/static/{oxwySrJXqXq8O6_7AzZGe → KBskG-P4uSZx1zfnYp1nL}/_buildManifest.js +0 -0
  108. /package/.next/static/{oxwySrJXqXq8O6_7AzZGe → KBskG-P4uSZx1zfnYp1nL}/_ssgManifest.js +0 -0
package/docs/releasing.md CHANGED
@@ -5,7 +5,7 @@ The first public version, `0.1.0`, is published on
5
5
  [GitHub](https://github.com/Triet1402/rigscope). The package includes MIT licensing,
6
6
  dependency notices, the security policy and [release notes](../CHANGELOG.md).
7
7
 
8
- The commands below use `0.1.5` as an example. For a new release, substitute its
8
+ The commands below use `0.1.6` as an example. For a new release, substitute its
9
9
  new version everywhere; do not attempt to republish an already published version.
10
10
  Documentation edits can be committed and pushed to GitHub independently. The published archive and
11
11
  its bundled documentation stay unchanged; ship updated package documentation
@@ -21,7 +21,7 @@ with the next version. Keep each release tag on the revision used to build it.
21
21
  4. Run the publish dry run, check the npm account, and publish the verified archive.
22
22
  5. Verify the registry version and install it into a disposable test installation.
23
23
  Check sign-in, fresh telemetry and the installed command.
24
- 6. Tag the exact source revision as `v0.1.5`, push the tag, and create a GitHub
24
+ 6. Tag the exact source revision as `v0.1.6`, push the tag, and create a GitHub
25
25
  Release with the release notes, verified archive and checksum. Announce it
26
26
  after the registry installation works.
27
27
 
@@ -45,14 +45,14 @@ npm pack --pack-destination out/release
45
45
  `npm pack` runs `prepack`, which regenerates dependency notices, builds fresh
46
46
  runtime/UI artifacts and verifies them. If notice generation changes a tracked
47
47
  file, include that change in the release commit before producing the final
48
- archive. Reuse the archive for every check below. Replace `0.1.5` in these
48
+ archive. Reuse the archive for every check below. Replace `0.1.6` in these
49
49
  commands when releasing another version.
50
50
 
51
51
  ## Verify the exact archive
52
52
 
53
53
  ```sh
54
- node scripts/verify-package.cjs ./out/release/rigscope-0.1.5.tgz
55
- npm run verify:installed -- --archive ./out/release/rigscope-0.1.5.tgz
54
+ node scripts/verify-package.cjs ./out/release/rigscope-0.1.6.tgz
55
+ npm run verify:installed -- --archive ./out/release/rigscope-0.1.6.tgz
56
56
  npm test
57
57
  node scripts/test-runtime.cjs
58
58
  node scripts/test.cjs --suite development
@@ -69,9 +69,9 @@ create disposable installations with separate state, launchers, ports and unit
69
69
  names, then remove their services. They do not select an existing installation.
70
70
 
71
71
  ```sh
72
- RIGSCOPE_TEST_ARCHIVE="$PWD/out/release/rigscope-0.1.5.tgz" \
72
+ RIGSCOPE_TEST_ARCHIVE="$PWD/out/release/rigscope-0.1.6.tgz" \
73
73
  node --import tsx --test tests/cli-install.integration.ts tests/cli-reset.integration.ts
74
- node scripts/verify-operations.cjs ./out/release/rigscope-0.1.5.tgz
74
+ node scripts/verify-operations.cjs ./out/release/rigscope-0.1.6.tgz
75
75
  ```
76
76
 
77
77
  These cover installation, pairing, independent component controls, bootstrap
@@ -93,7 +93,7 @@ Record the final checksum after verification:
93
93
 
94
94
  ```sh
95
95
  cd out/release
96
- sha256sum rigscope-0.1.5.tgz > SHA256SUMS
96
+ sha256sum rigscope-0.1.6.tgz > SHA256SUMS
97
97
  sha256sum --check SHA256SUMS
98
98
  ```
99
99
 
@@ -110,7 +110,7 @@ then verify the account and preview the exact archive:
110
110
  ```sh
111
111
  npm login --registry=https://registry.npmjs.org
112
112
  npm whoami --registry=https://registry.npmjs.org
113
- npm publish ./out/release/rigscope-0.1.5.tgz --access public --tag latest \
113
+ npm publish ./out/release/rigscope-0.1.6.tgz --access public --tag latest \
114
114
  --registry=https://registry.npmjs.org --dry-run
115
115
  ```
116
116
 
@@ -120,12 +120,12 @@ to publish or complete two-factor authentication.
120
120
  When releasing, this command actually publishes the verified archive publicly:
121
121
 
122
122
  ```sh
123
- npm publish ./out/release/rigscope-0.1.5.tgz --access public --tag latest \
123
+ npm publish ./out/release/rigscope-0.1.6.tgz --access public --tag latest \
124
124
  --registry=https://registry.npmjs.org
125
- npm view rigscope@0.1.5 version dist.integrity --registry=https://registry.npmjs.org
125
+ npm view rigscope@0.1.6 version dist.integrity --registry=https://registry.npmjs.org
126
126
  ```
127
127
 
128
- Then use `npx --yes rigscope@0.1.5 install` with a disposable `--state-dir`, an
128
+ Then use `npx --yes rigscope@0.1.6 install` with a disposable `--state-dir`, an
129
129
  unused `--port` and an isolated `XDG_BIN_HOME` for the registry installation
130
130
  check. Uninstall that test installation afterward. Use the same isolation
131
131
  settings for all test commands so the check does not select a real installation.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rigscope",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "private": false,
5
5
  "engines": {
6
6
  "node": ">=26.0.0"
@@ -1 +0,0 @@
1
- "use strict";exports.id=721,exports.ids=[721],exports.modules={2116:(a,b,c)=>{Object.defineProperty(b,"__esModule",{value:!0});var d={default:function(){return p},useLinkStatus:function(){return r}};for(var e in d)Object.defineProperty(b,e,{enumerable:!0,get:d[e]});let f=c(24814),g=c(48249),h=f._(c(67484)),i=c(79925),j=c(30836),k=c(57272),l=c(30167),m=c(75729);c(52204);let n=c(78756);c(52836);let o=c(10881);function p(a){var b;let c,d,e,[f,p]=(0,h.useOptimistic)(n.IDLE_LINK_STATUS),r=(0,h.useRef)(null),{href:s,as:t,children:u,prefetch:v=null,passHref:w,replace:x,shallow:y,scroll:z,onClick:A,onMouseEnter:B,onTouchStart:C,legacyBehavior:D=!1,onNavigate:E,transitionTypes:F,ref:G,unstable_dynamicOnHover:H,...I}=a;c=u,D&&("string"==typeof c||"number"==typeof c)&&(c=(0,g.jsx)("a",{children:c}));let J=h.default.useContext(j.AppRouterContext),K=!1!==v,L=!1===v?"none":!0===v?"full":"auto",M="none"!==L?"auto"===L?o.FetchStrategy.PPR:o.FetchStrategy.Full:o.FetchStrategy.PPR,N="string"==typeof(b=t||s)?b:(0,i.formatUrl)(b);if(D){if(c?.$$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.");d=h.default.Children.only(c)}let O=D?d&&"object"==typeof d&&d.ref:G,P,Q=h.default.useCallback(a=>(null!==J&&(r.current=(0,n.mountLinkInstance)(a,N,J,M,K,p,P)),()=>{r.current&&((0,n.unmountLinkForCurrentNavigation)(r.current),r.current=null),(0,n.unmountPrefetchableInstance)(a)}),[K,N,J,M,p,P]),R={ref:(0,k.useMergedRef)(Q,O),onClick(a){D||"function"!=typeof A||A(a),D&&d.props&&"function"==typeof d.props.onClick&&d.props.onClick(a),!J||a.defaultPrevented||function(a="none"){}(L)},onMouseEnter(a){D||"function"!=typeof B||B(a),D&&d.props&&"function"==typeof d.props.onMouseEnter&&d.props.onMouseEnter(a),J&&K&&(0,n.onNavigationIntent)(a.currentTarget,!0===H)},onTouchStart:function(a){D||"function"!=typeof C||C(a),D&&d.props&&"function"==typeof d.props.onTouchStart&&d.props.onTouchStart(a),J&&K&&(0,n.onNavigationIntent)(a.currentTarget,!0===H)}};return(0,l.isAbsoluteUrl)(N)?R.href=N:D&&!w&&("a"!==d.type||"href"in d.props)||(R.href=(0,m.addBasePath)(N)),e=D?h.default.cloneElement(d,R):(0,g.jsx)("a",{...I,...R,children:c}),(0,g.jsx)(q.Provider,{value:f,children:e})}let q=(0,h.createContext)(n.IDLE_LINK_STATUS),r=()=>(0,h.useContext)(q);("function"==typeof b.default||"object"==typeof b.default&&null!==b.default)&&void 0===b.default.__esModule&&(Object.defineProperty(b.default,"__esModule",{value:!0}),Object.assign(b.default,b),a.exports=b.default)},8696:(a,b,c)=>{c.d(b,{D:()=>j,N:()=>k});var d=c(67484),e=(a,b,c,d,e,f,g,h)=>{let i=document.documentElement,j=["light","dark"];function k(b){var c;(Array.isArray(a)?a:[a]).forEach(a=>{let c="class"===a,d=c&&f?e.map(a=>f[a]||a):e;c?(i.classList.remove(...d),i.classList.add(f&&f[b]?f[b]:b)):i.setAttribute(a,b)}),c=b,h&&j.includes(c)&&(i.style.colorScheme=c)}if(d)k(d);else try{let a=localStorage.getItem(b)||c,d=g&&"system"===a?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":a;k(d)}catch(a){}},f=["light","dark"],g="(prefers-color-scheme: dark)",h=d.createContext(void 0),i={setTheme:a=>{},themes:[]},j=()=>{var a;return null!=(a=d.useContext(h))?a:i},k=a=>d.useContext(h)?d.createElement(d.Fragment,null,a.children):d.createElement(m,{...a}),l=["light","dark"],m=({forcedTheme:a,disableTransitionOnChange:b=!1,enableSystem:c=!0,enableColorScheme:e=!0,storageKey:i="theme",themes:j=l,defaultTheme:k=c?"system":"light",attribute:m="data-theme",value:r,children:s,nonce:t,scriptProps:u})=>{let[v,w]=d.useState(()=>o(i,k)),[x,y]=d.useState(()=>"system"===v?q():v),z=r?Object.values(r):j,A=d.useCallback(a=>{let d=a;if(!d)return;"system"===a&&c&&(d=q());let g=r?r[d]:d,h=b?p(t):null,i=document.documentElement,j=a=>{"class"===a?(i.classList.remove(...z),g&&i.classList.add(g)):a.startsWith("data-")&&(g?i.setAttribute(a,g):i.removeAttribute(a))};if(Array.isArray(m)?m.forEach(j):j(m),e){let a=f.includes(k)?k:null,b=f.includes(d)?d:a;i.style.colorScheme=b}null==h||h()},[t]),B=d.useCallback(a=>{let b="function"==typeof a?a(v):a;w(b);try{localStorage.setItem(i,b)}catch(a){}},[v]),C=d.useCallback(b=>{y(q(b)),"system"===v&&c&&!a&&A("system")},[v,a]);d.useEffect(()=>{let a=window.matchMedia(g);return a.addListener(C),C(a),()=>a.removeListener(C)},[C]),d.useEffect(()=>{let a=a=>{a.key===i&&(a.newValue?w(a.newValue):B(k))};return window.addEventListener("storage",a),()=>window.removeEventListener("storage",a)},[B]),d.useEffect(()=>{A(null!=a?a:v)},[a,v]);let D=d.useMemo(()=>({theme:v,setTheme:B,forcedTheme:a,resolvedTheme:"system"===v?x:v,themes:c?[...j,"system"]:j,systemTheme:c?x:void 0}),[v,B,a,x,c,j]);return d.createElement(h.Provider,{value:D},d.createElement(n,{forcedTheme:a,storageKey:i,attribute:m,enableSystem:c,enableColorScheme:e,defaultTheme:k,value:r,themes:j,nonce:t,scriptProps:u}),s)},n=d.memo(({forcedTheme:a,storageKey:b,attribute:c,enableSystem:f,enableColorScheme:g,defaultTheme:h,value:i,themes:j,nonce:k,scriptProps:l})=>{let m=JSON.stringify([c,b,h,a,j,i,f,g]).slice(1,-1);return d.createElement("script",{...l,suppressHydrationWarning:!0,nonce:k,dangerouslySetInnerHTML:{__html:`(${e.toString()})(${m})`}})}),o=(a,b)=>{},p=a=>{let b=document.createElement("style");return a&&b.setAttribute("nonce",a),b.appendChild(document.createTextNode("*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(b),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(b)},1)}},q=a=>(a||(a=window.matchMedia(g)),a.matches?"dark":"light")},12421:(a,b,c)=>{c.d(b,{A:()=>d});let d=(0,c(65366).A)("TriangleAlert",[["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"}]])},19099:(a,b,c)=>{var d=c(54839);c.o(d,"usePathname")&&c.d(b,{usePathname:function(){return d.usePathname}}),c.o(d,"useRouter")&&c.d(b,{useRouter:function(){return d.useRouter}}),c.o(d,"useSearchParams")&&c.d(b,{useSearchParams:function(){return d.useSearchParams}})},27346:(a,b,c)=>{c.d(b,{A:()=>d});let d=(0,c(65366).A)("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]])},31742:(a,b,c)=>{c.d(b,{A:()=>d});let d=(0,c(65366).A)("RefreshCw",[["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"}]])},44999:(a,b,c)=>{c.d(b,{A:()=>d});let d=(0,c(65366).A)("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]])},49187:(a,b,c)=>{c.d(b,{A:()=>d});let d=(0,c(65366).A)("WifiOff",[["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"}]])},50132:(a,b,c)=>{c.d(b,{A:()=>d});let d=(0,c(65366).A)("UserRound",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]])},51589:(a,b,c)=>{c.d(b,{A:()=>d});let d=(0,c(65366).A)("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]])},51872:(a,b,c)=>{c.d(b,{A:()=>d});let d=(0,c(65366).A)("History",[["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"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]])},52836:(a,b,c)=>{Object.defineProperty(b,"__esModule",{value:!0}),Object.defineProperty(b,"isLocalURL",{enumerable:!0,get:function(){return f}});let d=c(30167),e=c(71742);function f(a){if(!(0,d.isAbsoluteUrl)(a))return!0;try{let b=(0,d.getLocationOrigin)(),c=new URL(a,b);return c.origin===b&&(0,e.hasBasePath)(c.pathname)}catch(a){return!1}}},55091:(a,b,c)=>{Object.defineProperty(b,"__esModule",{value:!0}),Object.defineProperty(b,"default",{enumerable:!0,get:function(){return f}});let d=c(5735),e=c(22675);function f(){return(0,d.jsx)(e.HTTPAccessErrorFallback,{status:404,message:"This page could not be found."})}("function"==typeof b.default||"object"==typeof b.default&&null!==b.default)&&void 0===b.default.__esModule&&(Object.defineProperty(b.default,"__esModule",{value:!0}),Object.assign(b.default,b),a.exports=b.default)},57272:(a,b,c)=>{Object.defineProperty(b,"__esModule",{value:!0}),Object.defineProperty(b,"useMergedRef",{enumerable:!0,get:function(){return e}});let d=c(67484);function e(a,b){let c=(0,d.useRef)(null),e=(0,d.useRef)(null);return(0,d.useCallback)(d=>{if(null===d){let a=c.current;a&&(c.current=null,a());let b=e.current;b&&(e.current=null,b())}else a&&(c.current=f(a,d)),b&&(e.current=f(b,d))},[a,b])}function f(a,b){if("function"!=typeof a)return a.current=b,()=>{a.current=null};{let c=a(b);return"function"==typeof c?c:()=>a(null)}}("function"==typeof b.default||"object"==typeof b.default&&null!==b.default)&&void 0===b.default.__esModule&&(Object.defineProperty(b.default,"__esModule",{value:!0}),Object.assign(b.default,b),a.exports=b.default)},65366:(a,b,c)=>{c.d(b,{A:()=>h});var d=c(67484);let e=(...a)=>a.filter((a,b,c)=>!!a&&""!==a.trim()&&c.indexOf(a)===b).join(" ").trim();var f={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let g=(0,d.forwardRef)(({color:a="currentColor",size:b=24,strokeWidth:c=2,absoluteStrokeWidth:g,className:h="",children:i,iconNode:j,...k},l)=>(0,d.createElement)("svg",{ref:l,...f,width:b,height:b,stroke:a,strokeWidth:g?24*Number(c)/Number(b):c,className:e("lucide",h),...k},[...j.map(([a,b])=>(0,d.createElement)(a,b)),...Array.isArray(i)?i:[i]])),h=(a,b)=>{let c=(0,d.forwardRef)(({className:c,...f},h)=>(0,d.createElement)(g,{ref:h,iconNode:b,className:e(`lucide-${a.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,c),...f}));return c.displayName=`${a}`,c}},71e3:(a,b,c)=>{Object.defineProperty(b,"__esModule",{value:!0}),Object.defineProperty(b,"addPathPrefix",{enumerable:!0,get:function(){return e}});let d=c(10571);function e(a,b){if(!a.startsWith("/")||!b)return a;let{pathname:c,query:e,hash:f}=(0,d.parsePath)(a);return`${b}${c}${e}${f}`}},71327:(a,b,c)=>{c.d(b,{A:()=>d});let d=(0,c(65366).A)("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},75729:(a,b,c)=>{Object.defineProperty(b,"__esModule",{value:!0}),Object.defineProperty(b,"addBasePath",{enumerable:!0,get:function(){return f}});let d=c(71e3),e=c(34956);function f(a,b){return(0,e.normalizePathTrailingSlash)((0,d.addPathPrefix)(a,""))}("function"==typeof b.default||"object"==typeof b.default&&null!==b.default)&&void 0===b.default.__esModule&&(Object.defineProperty(b.default,"__esModule",{value:!0}),Object.assign(b.default,b),a.exports=b.default)},78607:(a,b,c)=>{c.d(b,{A:()=>d});let d=(0,c(65366).A)("Bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]])},79925:(a,b,c)=>{Object.defineProperty(b,"__esModule",{value:!0});var d={formatUrl:function(){return h},formatWithValidation:function(){return j},urlObjectKeys:function(){return i}};for(var e in d)Object.defineProperty(b,e,{enumerable:!0,get:d[e]});let f=c(24814)._(c(90485)),g=/https?|ftp|gopher|file/;function h(a){let{auth:b,hostname:c}=a,d=a.protocol||"",e=a.pathname||"",h=a.hash||"",i=a.query||"",j=!1;b=b?encodeURIComponent(b).replace(/%3A/i,":")+"@":"",a.host?j=b+a.host:c&&(j=b+(~c.indexOf(":")?`[${c}]`:c),a.port&&(j+=":"+a.port)),i&&"object"==typeof i&&(i=String(f.urlQueryToSearchParams(i)));let k=a.search||i&&`?${i}`||"";return d&&!d.endsWith(":")&&(d+=":"),a.slashes||(!d||g.test(d))&&!1!==j?(j="//"+(j||""),e&&"/"!==e[0]&&(e="/"+e)):j||(j=""),h&&"#"!==h[0]&&(h="#"+h),k&&"?"!==k[0]&&(k="?"+k),e=e.replace(/[?#]/g,encodeURIComponent),k=k.replace("#","%23"),`${d}${j}${e}${k}${h}`}let i=["auth","hash","host","hostname","href","path","pathname","port","protocol","query","search","slashes"];function j(a){return h(a)}},82437:(a,b,c)=>{c.d(b,{A:()=>d});let d=(0,c(65366).A)("Cable",[["path",{d:"M17 21v-2a1 1 0 0 1-1-1v-1a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1",key:"10bnsj"}],["path",{d:"M19 15V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V9",key:"1eqmu1"}],["path",{d:"M21 21v-2h-4",key:"14zm7j"}],["path",{d:"M3 5h4V3",key:"z442eg"}],["path",{d:"M7 5a1 1 0 0 1 1 1v1a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1V3",key:"ebdjd7"}]])},89313:(a,b,c)=>{c.d(b,{A:()=>d});let d=(0,c(65366).A)("Server",[["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"}]])},90162:(a,b,c)=>{c.d(b,{A:()=>d});let d=(0,c(65366).A)("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]])},93484:(a,b,c)=>{c.d(b,{A:()=>d});let d=(0,c(65366).A)("ShieldAlert",[["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:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]])}};
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[103],{802:(e,n,t)=>{t.d(n,{B:()=>l});var r=t(5155),a=t(8500),i=t.n(a),s=t(9939);function l(){let{session:e,phase:n,signOut:t}=(0,s.M)();return"signed-in"===e.kind?(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"hidden max-w-[12rem] truncate text-xs text-muted-foreground sm:inline",children:e.user.username}),(0,r.jsx)("button",{type:"button",onClick:()=>void t(),className:"rounded-md px-2.5 py-1.5 text-xs text-muted-foreground transition-colors hover:bg-card-strong hover:text-foreground",children:"Sign out"})]}):"restoring"===e.kind||"auth-unavailable"===e.kind?null:(0,r.jsx)("div",{className:"flex items-center gap-1",children:(0,r.jsx)(i(),{href:"/login",className:"rounded-md border border-border px-2.5 py-1.5 text-xs text-foreground transition-colors hover:bg-card-strong",children:"Sign in"})})}},940:(e,n,t)=>{t.d(n,{$E:()=>d,TK:()=>o});var r=t(5155),a=t(9939);let i={ok:"bg-ok",warn:"bg-warn",crit:"bg-crit",muted:"bg-muted-foreground/50"};function s(e,n){switch(e.kind){case"restoring":return{label:"Checking session…",tone:"muted"};case"restore-failed":return{label:"Hub unreachable",tone:"crit"};case"signed-out":return{label:"Signed out",tone:"muted"};case"auth-unavailable":return{label:"Sign-in unavailable",tone:"warn"}}switch(n){case"idle":return{label:"Not connected",tone:"muted"};case"connecting":return{label:"Connecting…",tone:"warn"};case"live":return{label:"Live",tone:"ok"};case"reconnecting":return{label:"Reconnecting…",tone:"warn"};case"disconnected":return{label:"Disconnected",tone:"crit"};case"expired":return{label:"Session ended",tone:"crit"};case"no-permission":return{label:"No permission",tone:"warn"}}}function l({tone:e}){return(0,r.jsx)("span",{className:`inline-block h-2 w-2 shrink-0 rounded-full ${i[e]}`,"aria-hidden":!0})}function d(){let{session:e,phase:n,lastEventKind:t,notice:i,dismissNotice:d}=(0,a.M)(),o=s(e,n),c="reset"===t&&"live"===n?"Stream resynchronized with a fresh snapshot.":null;return(0,r.jsxs)("div",{role:"status","aria-label":`Live feed status: ${o.label}`,className:"flex min-w-0 items-center gap-2",children:[(0,r.jsx)(l,{tone:o.tone}),(0,r.jsx)("span",{className:"tnum truncate text-xs text-muted-foreground",children:o.label}),c?(0,r.jsxs)("span",{className:"tnum hidden truncate text-xs text-muted-foreground lg:inline",title:c,children:["\xb7 ",c]}):null,i?(0,r.jsxs)("button",{type:"button",onClick:d,className:"max-w-[16rem] truncate rounded-md border border-border px-2 py-0.5 text-xs text-foreground transition-colors hover:bg-card-strong",title:`${i} Click to dismiss.`,children:[i,(0,r.jsx)("span",{"aria-hidden":!0,children:" ✕"})]}):null]})}function o(){let{session:e,phase:n}=(0,a.M)(),t=s(e,n);return(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 text-xs",children:[(0,r.jsx)(l,{tone:t.tone}),(0,r.jsx)("span",{className:"truncate",role:"status","aria-label":`Live feed status: ${t.label}`,children:t.label})]})}},1721:(e,n,t)=>{t.d(n,{MachineBreadcrumb:()=>d});var r=t(5155),a=t(8500),i=t.n(a),s=t(9939),l=t(8664);function d({machineId:e,title:n,view:t}){let{machines:a}=(0,s.M)(),o=(0,l.FM)(),c=a.find(n=>n.machineId===e),m=c?.displayName||c?.hostname||"Machine";return(0,r.jsxs)("nav",{"aria-label":"Breadcrumb",className:"flex min-w-0 items-center gap-2 text-sm",children:[(0,r.jsx)(i(),{href:"/",className:"hidden text-muted-foreground hover:text-foreground sm:inline",children:"Fleet"}),(0,r.jsx)("span",{"aria-hidden":!0,className:"hidden text-muted-foreground sm:inline",children:"/"}),(0,r.jsx)(i(),{href:(0,l.Y2)(e,"overview"),className:"hidden max-w-48 truncate text-muted-foreground hover:text-foreground md:inline",children:m}),(0,r.jsx)("select",{"aria-label":"Machine",value:e,onChange:e=>o(e.target.value,t),className:"h-8 min-w-0 max-w-32 rounded-md border border-border bg-card px-1.5 text-sm md:hidden",children:a.map(e=>(0,r.jsx)("option",{value:e.machineId,children:e.displayName||e.hostname||e.machineId},e.machineId))}),(0,r.jsx)("span",{"aria-hidden":!0,className:"text-muted-foreground",children:"/"}),(0,r.jsx)("h1",{className:"truncate text-lg font-semibold tracking-tight",children:n})]})}},2394:(e,n,t)=>{t.d(n,{ThemeToggle:()=>l});var r=t(5155),a=t(1134),i=t(9145),s=t(460);function l(){let{resolvedTheme:e,setTheme:n}=(0,s.D)();return(0,r.jsxs)("button",{type:"button",onClick:()=>n("dark"===e?"light":"dark"),"aria-label":"Toggle theme",className:"flex h-9 w-9 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-selected hover:text-foreground",children:[(0,r.jsx)(a.A,{className:"h-4.5 w-4.5 dark:hidden"}),(0,r.jsx)(i.A,{className:"hidden h-4.5 w-4.5 dark:block"})]})}},2701:(e,n,t)=>{t.d(n,{Sidebar:()=>k});var r=t(5155),a=t(8500),i=t.n(a),s=t(3321),l=t(257),d=t(7233),o=t(2955),c=t(3896),m=t(9764),u=t(4201),h=t(8731),x=t(8664),f=t(8773),b=t(940),g=t(9939),p=t(7586),v=t(7348);let w=[{href:"/alerts",label:"Alerts",icon:l.A},{href:"/connections",label:"Connections",icon:d.A}],j=[{view:"overview",label:"Overview",icon:o.A},{view:"history",label:"History",icon:c.A},{view:"processes",label:"Processes",icon:m.A}],N=e=>["flex min-h-9 min-w-0 items-center gap-3 rounded-md border px-2 text-sm transition-colors md:px-3",e?"border-accent/60 bg-selected font-medium text-foreground":"border-transparent text-muted-foreground hover:bg-card-strong hover:text-foreground"].join(" ");function k({machineId:e,machineView:n}){let t=(0,s.usePathname)(),{session:a,machines:l,phase:d}=(0,g.M)(),o=(0,v.c)(),{machine:c,view:m,selectMachine:y}=(0,x.PY)(e,n),I="signed-in"===a.kind&&!0===a.user.admin?[...w,{href:"/administration",label:"Administration",icon:u.A}]:w;return(0,r.jsxs)("aside",{className:"flex w-14 shrink-0 flex-col border-r border-border bg-background md:w-56",children:[(0,r.jsxs)(i(),{href:"/","aria-label":"Rigscope",className:"flex h-14 shrink-0 items-center gap-2.5 border-b border-border px-3 md:px-5",children:[(0,r.jsx)(f.R,{className:"h-5 w-5 shrink-0 text-accent","aria-hidden":!0}),(0,r.jsx)("span",{className:"hidden text-sm font-semibold tracking-tight text-foreground md:inline",children:"Rigscope"})]}),(0,r.jsxs)("nav",{"aria-label":"Primary",className:"flex min-h-0 flex-1 flex-col overflow-y-auto p-2 md:p-3",children:[(0,r.jsxs)(i(),{href:"/","aria-current":"/"===t?"page":void 0,title:"Fleet","aria-label":"Fleet",className:N("/"===t),children:[(0,r.jsx)(h.A,{className:"h-4 w-4 shrink-0","aria-hidden":!0}),(0,r.jsx)("span",{className:"hidden md:inline",children:"Fleet"})]}),l.length>0?(0,r.jsx)("div",{role:"group","aria-label":"Select a machine",className:"my-3 flex max-h-[min(30dvh,20rem)] shrink-0 flex-col gap-1 overflow-y-auto",children:l.map(e=>{let n=e.displayName||e.hostname||e.machineId,t=e.tags?.join(", "),a=c?.machineId===e.machineId,i=(0,p.vj)(e,o),s=e.connected?"live"!==d?"Feed unavailable":"stale"===i?"Stale":"unknown"===i?"No sample yet":"Live":"Disconnected",l="Live"===s?"bg-ok":"Disconnected"===s?"bg-crit":"No sample yet"===s?"bg-muted-foreground":"bg-warn",m=e.inventory?.cpu.model||t;return(0,r.jsxs)("button",{type:"button","aria-pressed":a,"aria-label":`${n}: ${s}${m?`, ${m}`:""}`,title:[n,s,m,t].filter(Boolean).join(" \xb7 "),onClick:()=>y(e.machineId),className:`${N(a)} w-full shrink-0 py-2 text-left focus-visible:outline-offset-[-2px] max-md:justify-center max-md:px-0`,children:[(0,r.jsxs)("span",{"aria-hidden":!0,className:"relative flex h-5 w-6 shrink-0 items-center justify-center md:w-4",children:[(0,r.jsx)("span",{className:"text-xs font-medium md:hidden",children:n.slice(0,2).toUpperCase()}),(0,r.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full max-md:absolute max-md:-right-1 max-md:-bottom-0.5 ${l}`})]}),(0,r.jsxs)("span",{className:"hidden min-w-0 flex-1 md:block",children:[(0,r.jsx)("span",{className:"block break-words font-medium leading-5",children:n}),m?(0,r.jsx)("span",{className:`mt-0.5 block break-words text-xs leading-4 ${a?"text-foreground/80":"text-muted-foreground"}`,children:m}):null]})]},e.machineId)})}):null,c?(0,r.jsx)("div",{role:"group","aria-label":"Selected machine views",className:"mb-3 flex shrink-0 flex-col gap-1 border-t border-border pt-3",children:j.map(({view:e,label:n,icon:t})=>(0,r.jsxs)(i(),{href:(0,x.Y2)(c.machineId,e),"aria-current":m===e?"page":void 0,"aria-label":`${c.displayName||c.hostname||c.machineId}: ${n}`,title:`${c.displayName||c.hostname||c.machineId}: ${n}`,className:N(m===e),children:[(0,r.jsx)(t,{className:"h-4 w-4 shrink-0","aria-hidden":!0}),(0,r.jsx)("span",{className:"hidden md:inline",children:n})]},e))}):null,(0,r.jsx)("div",{className:"flex shrink-0 flex-col gap-1 border-t border-border pt-3",children:I.map(({href:e,label:n,icon:a})=>(0,r.jsxs)(i(),{href:e,"aria-current":t===e?"page":void 0,title:n,"aria-label":n,className:N(t===e),children:[(0,r.jsx)(a,{className:"h-4 w-4 shrink-0","aria-hidden":!0}),(0,r.jsx)("span",{className:"hidden md:inline",children:n})]},e))})]}),(0,r.jsx)("footer",{className:"hidden shrink-0 border-t border-border p-3 md:block",children:(0,r.jsx)(b.TK,{})})]})}},3440:(e,n,t)=>{t.d(n,{Z:()=>a,p:()=>i});var r=t(5155);function a({title:e,action:n,className:t,children:i}){return(0,r.jsxs)("section",{className:["flex min-w-0 flex-col rounded-xl border border-border bg-card p-5",t].filter(Boolean).join(" "),children:[(0,r.jsxs)("div",{className:"flex shrink-0 items-center justify-between gap-4",children:[(0,r.jsx)("h2",{className:"text-sm font-medium tracking-tight",children:e}),n?(0,r.jsx)("div",{className:"text-xs tabular-nums",children:n}):null]}),(0,r.jsx)("div",{className:"mt-4 flex min-h-0 flex-1 flex-col",children:i})]})}function i({icon:e,note:n,className:t}){return(0,r.jsxs)("div",{className:["flex flex-1 flex-col items-center justify-center gap-2.5 rounded-lg border border-dashed border-border px-6 py-10 text-center",t].filter(Boolean).join(" "),children:[(0,r.jsx)(e,{className:"h-5 w-5 text-muted-foreground","aria-hidden":!0}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:n})]})}},4173:(e,n,t)=>{t.d(n,{G:()=>l});var r=t(5155),a=t(1721),i=t(2701),s=t(2394);function l({title:e,headerRight:n,children:t,workspace:d=!1,machineId:o,machineView:c}){return(0,r.jsxs)("div",{className:"relative flex h-dvh overflow-hidden bg-background text-foreground",children:[(0,r.jsx)("a",{href:"#main-content",className:"sr-only z-50 rounded-md bg-card px-4 py-2 text-foreground focus:not-sr-only focus:absolute focus:start-2 focus:top-2 focus:outline-2 focus:outline-accent",children:"Skip to content"}),(0,r.jsx)(i.Sidebar,{machineId:o,machineView:c}),(0,r.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,r.jsxs)("header",{className:"flex min-h-14 shrink-0 flex-wrap items-center justify-between gap-2 border-b border-border px-4 py-2 md:px-6",children:[o&&c?(0,r.jsx)(a.MachineBreadcrumb,{machineId:o,title:e,view:c}):(0,r.jsx)("h1",{className:"truncate text-lg font-semibold tracking-tight",children:e}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[n?(0,r.jsx)("div",{className:"flex min-w-0 items-center gap-3",children:n}):null,(0,r.jsx)(s.ThemeToggle,{})]})]}),(0,r.jsx)("main",{id:"main-content",tabIndex:-1,className:`relative min-h-0 min-w-0 flex-1 overflow-x-hidden overscroll-contain p-4 outline-offset-[-2px] md:p-6 ${d?"flex flex-col overflow-y-hidden":"overflow-y-auto"}`,children:(0,r.jsx)("div",{className:d?"mx-auto flex h-full w-full min-h-0 min-w-0 max-w-[1500px] flex-1 flex-col":"mx-auto flex w-full min-w-0 max-w-[1500px] flex-col",children:t})})]})]})}},6114:(e,n,t)=>{t.d(n,{u:()=>u});var r=t(2115);let a="rigscope:",i=new Map,s=new Map,l=new Map,d=!1;function o(e){try{return"local"===e?window.localStorage:window.sessionStorage}catch{return null}}function c(e,n){return`${e}:${n}`}function m(e,n,t,r){let s=c(e,n);if(i.has(s))return i.get(s);let l=t,d=o(e);if(null!==d)try{let e=d.getItem(a+n);if(null!==e){let n=r(JSON.parse(e));null!==n&&(l=n)}}catch{}return i.set(s,l),l}function u(e,n,t,h="local"){let x=c(h,e);return[(0,r.useSyncExternalStore)((0,r.useCallback)(e=>{let n;return void 0===(n=s.get(x))&&(n=new Set,s.set(x,n)),n.add(e),()=>{n.delete(e)}},[x]),()=>m(h,e,n,t),()=>n),(0,r.useCallback)(r=>{let u=m(h,e,n,t),f="function"==typeof r?r(u):r;if(!Object.is(f,u)){i.set(x,f);let n=c(h,e),t=l.get(n);void 0!==t&&clearTimeout(t.timer);let r=()=>{let t=l.get(n);t&&clearTimeout(t.timer),l.delete(n);let r=o(h);if(null!==r)try{r.setItem(a+e,JSON.stringify(i.get(n)))}catch{}};if(l.set(n,{timer:setTimeout(r,250),flush:r}),!d){d=!0;let e=()=>l.forEach(e=>e.flush());window.addEventListener("pagehide",e),document.addEventListener("visibilitychange",()=>{document.hidden&&e()})}s.get(x)?.forEach(e=>e())}},[n,x,e,h,t])]}},7348:(e,n,t)=>{t.d(n,{c:()=>a});var r=t(2115);function a(e=1e3){let[n,t]=(0,r.useState)(()=>Date.now());return(0,r.useEffect)(()=>{t(Date.now());let n=setInterval(()=>t(Date.now()),e);return()=>clearInterval(n)},[e]),n}},8664:(e,n,t)=>{t.d(n,{FM:()=>f,JG:()=>x,PY:()=>b,Y2:()=>l});var r=t(2115),a=t(3321),i=t(6114),s=t(9939);function l(e,n){let t=encodeURIComponent(e);return"overview"===n?`/machines/${t}`:`/${n}?machineId=${t}`}function d(e){let n=e.inventory?.capabilities?.processes;return void 0===n||"supported"===n.status}let o={overview:e=>e[0],history:e=>e[0],processes:e=>e.find(d)??e[0]};function c({view:e,requestedMachineId:n,rememberedMachineId:t,machines:r}){if(0===r.length)return{kind:"fleet-empty"};if(n){let e=r.find(e=>e.machineId===n);return e?{kind:"resolved",machine:e,via:"requested"}:{kind:"missing",requestedMachineId:n}}if(t){let e=r.find(e=>e.machineId===t);if(e)return{kind:"resolved",machine:e,via:"remembered"}}let a=o[e](r);return a?{kind:"resolved",machine:a,via:"fallback"}:{kind:"fleet-empty"}}let m=e=>"string"==typeof e?e:null;function u(){return(0,i.u)("machine.selected","",m,"session")}let h=new Set(["history"]);function x(e,n){let{session:t,machines:i}=(0,s.M)(),l=(0,a.useRouter)(),d=(0,a.usePathname)()||`/${e}`,o=(0,a.useSearchParams)(),[m,x]=u(),f="overview"===e?n??"":o.get("machineId")||null,b=(0,r.useMemo)(()=>c({view:e,requestedMachineId:f,rememberedMachineId:m,machines:i}),[e,f,m,i]),g="resolved"===b.kind?b.machine:void 0,p=g?.machineId??"",v="overview"===e?f??"":"processes"===e?g?.machineId??f??"":p;(0,r.useEffect)(()=>{p&&x(p)},[p,x]);let w=h.has(e);return(0,r.useEffect)(()=>{if(!w||"signed-in"!==t.kind||0===i.length||null!==f||""===p)return;let e=function(e,n,t){if(n.get("machineId"))return null;let r=new URLSearchParams(n.toString());return r.set("machineId",t),`${e}?${r.toString()}`}(d,o,p);e&&l.replace(e,{scroll:!1})},[w,t.kind,i,f,p,o,l,d]),{resolution:b,machine:g,machineId:p,navMachineId:v,requestedMachineId:f}}function f(){let e=(0,a.useRouter)(),[,n]=u();return(0,r.useCallback)((t,r)=>{n(t),e.push(l(t,r))},[n,e])}function b(e,n){let t=(0,a.usePathname)()||"/",{machines:r}=(0,s.M)(),[i]=u(),l=f(),d=n??(t.startsWith("/machines/")?"overview":"/history"===t?"history":"/processes"===t?"processes":null),o=c({view:d??"overview",requestedMachineId:r.some(n=>n.machineId===e)?e:null,rememberedMachineId:i,machines:r});return{view:d,machine:"resolved"===o.kind?o.machine:void 0,selectMachine:e=>l(e,d??"overview")}}},8773:(e,n,t)=>{t.d(n,{R:()=>a});var r=t(5155);function a(e){return(0,r.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",...e,children:[(0,r.jsx)("path",{d:"M8 3H4v18h4M16 3h4v18h-4"}),(0,r.jsx)("path",{d:"m8 15 4-6 4 3M8 8h.01M16 17h.01"})]})}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[157],{91:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n={formatUrl:function(){return u},formatWithValidation:function(){return s},urlObjectKeys:function(){return i}};for(var a in n)Object.defineProperty(t,a,{enumerable:!0,get:n[a]});let o=r(6388)._(r(1393)),l=/https?|ftp|gopher|file/;function u(e){let{auth:t,hostname:r}=e,n=e.protocol||"",a=e.pathname||"",u=e.hash||"",i=e.query||"",s=!1;t=t?encodeURIComponent(t).replace(/%3A/i,":")+"@":"",e.host?s=t+e.host:r&&(s=t+(~r.indexOf(":")?`[${r}]`:r),e.port&&(s+=":"+e.port)),i&&"object"==typeof i&&(i=String(o.urlQueryToSearchParams(i)));let c=e.search||i&&`?${i}`||"";return n&&!n.endsWith(":")&&(n+=":"),e.slashes||(!n||l.test(n))&&!1!==s?(s="//"+(s||""),a&&"/"!==a[0]&&(a="/"+a)):s||(s=""),u&&"#"!==u[0]&&(u="#"+u),c&&"?"!==c[0]&&(c="?"+c),a=a.replace(/[?#]/g,encodeURIComponent),c=c.replace("#","%23"),`${n}${s}${a}${c}${u}`}let i=["auth","hash","host","hostname","href","path","pathname","port","protocol","query","search","slashes"];function s(e){return u(e)}},257:(e,t,r)=>{r.d(t,{A:()=>n});let n=(0,r(8698).A)("Bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]])},460:(e,t,r)=>{r.d(t,{D:()=>s,N:()=>c});var n=r(2115),a=(e,t,r,n,a,o,l,u)=>{let i=document.documentElement,s=["light","dark"];function c(t){var r;(Array.isArray(e)?e:[e]).forEach(e=>{let r="class"===e,n=r&&o?a.map(e=>o[e]||e):a;r?(i.classList.remove(...n),i.classList.add(o&&o[t]?o[t]:t)):i.setAttribute(e,t)}),r=t,u&&s.includes(r)&&(i.style.colorScheme=r)}if(n)c(n);else try{let e=localStorage.getItem(t)||r,n=l&&"system"===e?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e;c(n)}catch(e){}},o=["light","dark"],l="(prefers-color-scheme: dark)",u=n.createContext(void 0),i={setTheme:e=>{},themes:[]},s=()=>{var e;return null!=(e=n.useContext(u))?e:i},c=e=>n.useContext(u)?n.createElement(n.Fragment,null,e.children):n.createElement(h,{...e}),d=["light","dark"],h=({forcedTheme:e,disableTransitionOnChange:t=!1,enableSystem:r=!0,enableColorScheme:a=!0,storageKey:i="theme",themes:s=d,defaultTheme:c=r?"system":"light",attribute:h="data-theme",value:g,children:k,nonce:v,scriptProps:b})=>{let[M,A]=n.useState(()=>p(i,c)),[w,S]=n.useState(()=>"system"===M?m():M),x=g?Object.values(g):s,C=n.useCallback(e=>{let n=e;if(!n)return;"system"===e&&r&&(n=m());let l=g?g[n]:n,u=t?y(v):null,i=document.documentElement,s=e=>{"class"===e?(i.classList.remove(...x),l&&i.classList.add(l)):e.startsWith("data-")&&(l?i.setAttribute(e,l):i.removeAttribute(e))};if(Array.isArray(h)?h.forEach(s):s(h),a){let e=o.includes(c)?c:null,t=o.includes(n)?n:e;i.style.colorScheme=t}null==u||u()},[v]),E=n.useCallback(e=>{let t="function"==typeof e?e(M):e;A(t);try{localStorage.setItem(i,t)}catch(e){}},[M]),P=n.useCallback(t=>{S(m(t)),"system"===M&&r&&!e&&C("system")},[M,e]);n.useEffect(()=>{let e=window.matchMedia(l);return e.addListener(P),P(e),()=>e.removeListener(P)},[P]),n.useEffect(()=>{let e=e=>{e.key===i&&(e.newValue?A(e.newValue):E(c))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[E]),n.useEffect(()=>{C(null!=e?e:M)},[e,M]);let j=n.useMemo(()=>({theme:M,setTheme:E,forcedTheme:e,resolvedTheme:"system"===M?w:M,themes:r?[...s,"system"]:s,systemTheme:r?w:void 0}),[M,E,e,w,r,s]);return n.createElement(u.Provider,{value:j},n.createElement(f,{forcedTheme:e,storageKey:i,attribute:h,enableSystem:r,enableColorScheme:a,defaultTheme:c,value:g,themes:s,nonce:v,scriptProps:b}),k)},f=n.memo(({forcedTheme:e,storageKey:t,attribute:r,enableSystem:o,enableColorScheme:l,defaultTheme:u,value:i,themes:s,nonce:c,scriptProps:d})=>{let h=JSON.stringify([r,t,u,e,s,i,o,l]).slice(1,-1);return n.createElement("script",{...d,suppressHydrationWarning:!0,nonce:"",dangerouslySetInnerHTML:{__html:`(${a.toString()})(${h})`}})}),p=(e,t)=>{let r;try{r=localStorage.getItem(e)||void 0}catch(e){}return r||t},y=e=>{let t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.appendChild(document.createTextNode("*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(t),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(t)},1)}},m=e=>(e||(e=window.matchMedia(l)),e.matches?"dark":"light")},828:(e,t,r)=>{r.d(t,{A:()=>n});let n=(0,r(8698).A)("RefreshCw",[["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"}]])},857:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});var r={DecodeError:function(){return m},MiddlewareNotFoundError:function(){return b},MissingStaticPage:function(){return v},NormalizeError:function(){return g},PageNotFoundError:function(){return k},SP:function(){return p},ST:function(){return y},WEB_VITALS:function(){return a},execOnce:function(){return o},getDisplayName:function(){return c},getLocationOrigin:function(){return i},getURL:function(){return s},isAbsoluteUrl:function(){return u},isResSent:function(){return d},loadGetInitialProps:function(){return f},normalizeRepeatedSlashes:function(){return h},stringifyError:function(){return M}};for(var n in r)Object.defineProperty(t,n,{enumerable:!0,get:r[n]});let a=["CLS","FCP","INP","LCP","TTFB"];function o(e){let t,r=!1;return(...n)=>(r||(r=!0,t=e(...n)),t)}let l=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,u=e=>{let t=e.charCodeAt(0);return!!(t>=65&&t<=90||t>=97&&t<=122)&&l.test(e)};function i(){let{protocol:e,hostname:t,port:r}=window.location;return`${e}//${t}${r?":"+r:""}`}function s(){let{href:e}=window.location,t=i();return e.substring(t.length)}function c(e){return"string"==typeof e?e:e.displayName||e.name||"Unknown"}function d(e){return e.finished||e.headersSent}function h(e){let t=e.split("?");return t[0].replace(/\\/g,"/").replace(/\/\/+/g,"/")+(t[1]?`?${t.slice(1).join("?")}`:"")}async function f(e,t){let r=t.res||t.ctx&&t.ctx.res;if(!e.getInitialProps)return t.ctx&&t.Component?{pageProps:await f(t.Component,t.ctx)}:{};let n=await e.getInitialProps(t);if(r&&d(r))return n;if(!n)throw Error(`"${c(e)}.getInitialProps()" should resolve to an object. But found "${n}" instead.`);return n}let p="u">typeof performance,y=p&&["mark","measure","getEntriesByName"].every(e=>"function"==typeof performance[e]);class m extends Error{}class g extends Error{}class k extends Error{constructor(e){super(),this.code="ENOENT",this.name="PageNotFoundError",this.message=`Cannot find module for page: ${e}`}}class v 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 M(e){return JSON.stringify({message:e.message,stack:e.stack})}},1134:(e,t,r)=>{r.d(t,{A:()=>n});let n=(0,r(8698).A)("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]])},1172:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"useMergedRef",{enumerable:!0,get:function(){return a}});let n=r(2115);function a(e,t){let r=(0,n.useRef)(null),a=(0,n.useRef)(null);return(0,n.useCallback)(n=>{if(null===n){let e=r.current;e&&(r.current=null,e());let t=a.current;t&&(a.current=null,t())}else e&&(r.current=o(e,n)),t&&(a.current=o(t,n))},[e,t])}function o(e,t){if("function"!=typeof e)return e.current=t,()=>{e.current=null};{let r=e(t);return"function"==typeof r?r:()=>e(null)}}("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),e.exports=t.default)},1735:(e,t,r)=>{r.d(t,{A:()=>n});let n=(0,r(8698).A)("TriangleAlert",[["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"}]])},2955:(e,t,r)=>{r.d(t,{A:()=>n});let n=(0,r(8698).A)("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]])},3321:(e,t,r)=>{var n=r(4645);r.o(n,"usePathname")&&r.d(t,{usePathname:function(){return n.usePathname}}),r.o(n,"useRouter")&&r.d(t,{useRouter:function(){return n.useRouter}}),r.o(n,"useSearchParams")&&r.d(t,{useSearchParams:function(){return n.useSearchParams}})},3896:(e,t,r)=>{r.d(t,{A:()=>n});let n=(0,r(8698).A)("History",[["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"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]])},4201:(e,t,r)=>{r.d(t,{A:()=>n});let n=(0,r(8698).A)("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},6914:(e,t,r)=>{r.d(t,{A:()=>n});let n=(0,r(8698).A)("UserRound",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]])},7029:(e,t,r)=>{r.d(t,{A:()=>n});let n=(0,r(8698).A)("WifiOff",[["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"}]])},7233:(e,t,r)=>{r.d(t,{A:()=>n});let n=(0,r(8698).A)("Cable",[["path",{d:"M17 21v-2a1 1 0 0 1-1-1v-1a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1",key:"10bnsj"}],["path",{d:"M19 15V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V9",key:"1eqmu1"}],["path",{d:"M21 21v-2h-4",key:"14zm7j"}],["path",{d:"M3 5h4V3",key:"z442eg"}],["path",{d:"M7 5a1 1 0 0 1 1 1v1a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1V3",key:"ebdjd7"}]])},7422:(e,t,r)=>{r.d(t,{A:()=>n});let n=(0,r(8698).A)("ShieldAlert",[["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:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]])},8500:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n={default:function(){return g},useLinkStatus:function(){return v}};for(var a in n)Object.defineProperty(t,a,{enumerable:!0,get:n[a]});let o=r(6388),l=r(5155),u=o._(r(2115)),i=r(91),s=r(2909),c=r(1172),d=r(857),h=r(127),f=r(4616),p=r(4972),y=r(9470),m=r(7565);function g(e){var t;let n,a,o,[g,v]=(0,u.useOptimistic)(p.IDLE_LINK_STATUS),b=(0,u.useRef)(null),{href:M,as:A,children:w,prefetch:S=null,passHref:x,replace:C,shallow:E,scroll:P,onClick:j,onMouseEnter:L,onTouchStart:T,legacyBehavior:_=!1,onNavigate:N,transitionTypes:O,ref:z,unstable_dynamicOnHover:R,...$}=e;n=w,_&&("string"==typeof n||"number"==typeof n)&&(n=(0,l.jsx)("a",{children:n}));let I=u.default.useContext(s.AppRouterContext),U=!1!==S,B=!1===S?"none":!0===S?"full":"auto",F="none"!==B?"auto"===B?m.FetchStrategy.PPR:m.FetchStrategy.Full:m.FetchStrategy.PPR,V="string"==typeof(t=A||M)?t:(0,i.formatUrl)(t);if(_){if(n?.$$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.");a=u.default.Children.only(n)}let q=_?a&&"object"==typeof a&&a.ref:z,D,K=u.default.useCallback(e=>(null!==I&&(b.current=(0,p.mountLinkInstance)(e,V,I,F,U,v,D)),()=>{b.current&&((0,p.unmountLinkForCurrentNavigation)(b.current),b.current=null),(0,p.unmountPrefetchableInstance)(e)}),[U,V,I,F,v,D]),W={ref:(0,c.useMergedRef)(K,q),onClick(e){_||"function"!=typeof j||j(e),_&&a.props&&"function"==typeof a.props.onClick&&a.props.onClick(e),!I||e.defaultPrevented||function(e,t,n,a,o,l,u,i="none"){{let s,{nodeName:c}=e.currentTarget;if("A"===c.toUpperCase()&&((s=e.currentTarget.getAttribute("target"))&&"_self"!==s||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.nativeEvent&&2===e.nativeEvent.which)||e.currentTarget.hasAttribute("download"))return;if(!(0,y.isLocalURL)(t)){a&&(e.preventDefault(),location.replace(t));return}if(e.preventDefault(),l){let e=!1;if(l({preventDefault:()=>{e=!0}}),e)return}let{navigate:d}=r(5287);d(t,a?"replace":"push",!1===o?f.ScrollBehavior.NoScroll:f.ScrollBehavior.Default,n.current,u,i)}}(e,V,b,C,P,N,O,B)},onMouseEnter(e){_||"function"!=typeof L||L(e),_&&a.props&&"function"==typeof a.props.onMouseEnter&&a.props.onMouseEnter(e),I&&U&&(0,p.onNavigationIntent)(e.currentTarget,!0===R)},onTouchStart:function(e){_||"function"!=typeof T||T(e),_&&a.props&&"function"==typeof a.props.onTouchStart&&a.props.onTouchStart(e),I&&U&&(0,p.onNavigationIntent)(e.currentTarget,!0===R)}};return(0,d.isAbsoluteUrl)(V)?W.href=V:_&&!x&&("a"!==a.type||"href"in a.props)||(W.href=(0,h.addBasePath)(V)),o=_?u.default.cloneElement(a,W):(0,l.jsx)("a",{...$,...W,children:n}),(0,l.jsx)(k.Provider,{value:g,children:o})}let k=(0,u.createContext)(p.IDLE_LINK_STATUS),v=()=>(0,u.useContext)(k);("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),e.exports=t.default)},8698:(e,t,r)=>{r.d(t,{A:()=>u});var n=r(2115);let a=(...e)=>e.filter((e,t,r)=>!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim();var o={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let l=(0,n.forwardRef)(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:l,className:u="",children:i,iconNode:s,...c},d)=>(0,n.createElement)("svg",{ref:d,...o,width:t,height:t,stroke:e,strokeWidth:l?24*Number(r)/Number(t):r,className:a("lucide",u),...c},[...s.map(([e,t])=>(0,n.createElement)(e,t)),...Array.isArray(i)?i:[i]])),u=(e,t)=>{let r=(0,n.forwardRef)(({className:r,...o},u)=>(0,n.createElement)(l,{ref:u,iconNode:t,className:a(`lucide-${e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,r),...o}));return r.displayName=`${e}`,r}},8731:(e,t,r)=>{r.d(t,{A:()=>n});let n=(0,r(8698).A)("Server",[["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"}]])},9145:(e,t,r)=>{r.d(t,{A:()=>n});let n=(0,r(8698).A)("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]])},9470:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"isLocalURL",{enumerable:!0,get:function(){return o}});let n=r(857),a=r(8512);function o(e){if(!(0,n.isAbsoluteUrl)(e))return!0;try{let t=(0,n.getLocationOrigin)(),r=new URL(e,t);return r.origin===t&&(0,a.hasBasePath)(r.pathname)}catch(e){return!1}}},9764:(e,t,r)=>{r.d(t,{A:()=>n});let n=(0,r(8698).A)("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]])}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[408],{4150:(e,t,r)=>{r.d(t,{Au:()=>u,_C:()=>a,eg:()=>c});var s=r(5155),n=r(2115),i=r(6304),l=r(5078);let o=(0,n.createContext)(null);function a({children:e}){let[t,r]=(0,n.useState)(null),i=(0,n.useCallback)(e=>r(t=>t?.timeMs===e?.timeMs&&t?.source===e?.source?t:e),[]),l=(0,n.useMemo)(()=>({cursor:t,setCursor:i}),[t,i]);return(0,s.jsx)(o.Provider,{value:l,children:e})}function u({series:e,fromMs:t,toMs:r,stepMs:s,gaps:l}){let a=(0,n.useId)(),[c,d]=(0,n.useState)(null),m=(0,n.useContext)(o),f=m?m.cursor:c,p=m?m.setCursor:d,h=(0,n.useRef)(null),g=(0,n.useRef)(null),y=(0,n.useCallback)(()=>{null!==h.current&&cancelAnimationFrame(h.current),h.current=null,g.current=null},[]);(0,n.useEffect)(()=>y,[y]);let x=(0,n.useMemo)(()=>(0,i.X)(e).filter(e=>e.t<=r&&e.t+s/2>=t),[e,t,r,s]),b=f&&f.timeMs>=t-s/2&&f.timeMs<=r?f.timeMs:null,v=null!==b&&f?.source===a;(0,n.useEffect)(()=>{if(!v)return;let e=e=>{"Escape"===e.key&&(y(),p(null))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[v,p,y]);let M=()=>{y(),f?.source===a&&p(null)};return{id:a,timeMs:b,active:v,inspect:e=>{let n=Math.max(t,Math.min(r,e)),o=(0,i.bO)(x,n,s,l);g.current={timeMs:o?.t??n,source:a},null===h.current&&(h.current=requestAnimationFrame(()=>{h.current=null,p(g.current),g.current=null}))},clear:M,onKeyDown:e=>{if(y(),"Escape"===e.key)e.preventDefault(),M();else if(["ArrowLeft","ArrowRight","Home","End"].includes(e.key)){e.preventDefault();let t=(0,i.o7)(x,b,e.key);null!==t&&p({timeMs:t,source:a})}},onFocus:()=>{y(),p({timeMs:x.at(-1)?.t??r,source:a})}}}function c({id:e,timeMs:t,fraction:r,unit:i,readings:o}){let[a]=(0,n.useState)(()=>r>.5?"left":"right");return(0,s.jsxs)("div",{id:e,role:"tooltip",className:`absolute top-2 z-10 max-h-56 w-56 max-w-[calc(100%-1rem)] overflow-y-auto rounded-md border border-border bg-card p-3 text-xs text-foreground ${"left"===a?"left-2":"right-2"}`,children:[(0,s.jsx)("p",{className:"tnum font-medium",children:(0,l.r6)(t)}),(0,s.jsx)("p",{className:"mb-2 text-muted-foreground",children:"Recorded bucket average"}),(0,s.jsx)("dl",{className:"grid grid-cols-[minmax(0,1fr)_auto] items-baseline gap-x-4 gap-y-1.5",children:o.map(({key:e,label:r,color:n,point:o})=>(0,s.jsxs)("div",{className:"contents",children:[(0,s.jsxs)("dt",{className:"flex min-w-0 items-center gap-1.5",children:[(0,s.jsx)("span",{"aria-hidden":!0,className:"h-2 w-2 shrink-0 rounded-full",style:{backgroundColor:n}}),(0,s.jsx)("span",{className:"break-words",children:r})]}),(0,s.jsxs)("dd",{className:"tnum text-right",children:[o?.avg==null?"No reading":(0,l.dd)(o.avg,i),o&&o.t!==t?(0,s.jsx)("span",{className:"block text-muted-foreground",children:(0,l.ei)(o.t)}):null]})]},e))})]})}},4567:(e,t,r)=>{r.d(t,{Cv:()=>n,H9:()=>s,Lf:()=>u,P$:()=>i,RL:()=>g,bP:()=>h,er:()=>m,oB:()=>a,ue:()=>p,yv:()=>d});let s=[{metric:"cpu.usage",label:"CPU usage",shortLabel:"CPU",unit:"percent",family:"cpu",colorSlot:0,description:"Total processor utilization"},{metric:"cpu.core",label:"Per-core CPU",shortLabel:"Per-core",unit:"percent",family:"cpu",colorSlot:0,description:"Logical-core utilization; heatmap for large selections"},{metric:"cpu.temperature",label:"CPU temperature",shortLabel:"Temperature",unit:"celsius",family:"cpu",colorSlot:3,description:"Identifiable CPU hwmon sensor temperature"},{metric:"cpu.power",label:"CPU package power",shortLabel:"Power",unit:"watts",family:"cpu",colorSlot:4,description:"Top-level RAPL package power draw"},{metric:"cpu.iowait",label:"CPU I/O wait",shortLabel:"I/O wait",unit:"percent",family:"cpu",colorSlot:2,description:"Processor time waiting on I/O"},{metric:"cpu.pressure",label:"CPU pressure",shortLabel:"Pressure",unit:"percent",family:"cpu",colorSlot:4,description:"Linux PSI CPU stall pressure (avg10)"},{metric:"memory.used",label:"Memory used",shortLabel:"Memory",unit:"bytes",family:"memory",colorSlot:1,description:"Physical memory in use"},{metric:"memory.usage",label:"Memory usage",shortLabel:"Memory %",unit:"percent",family:"memory",colorSlot:1,description:"Physical memory used as a share of total"},{metric:"memory.pressure.some",label:"Memory pressure (some)",shortLabel:"Pressure some",unit:"percent",family:"memory",colorSlot:2,description:"Linux PSI memory stall pressure, some tasks (avg10)"},{metric:"memory.pressure.full",label:"Memory pressure (full)",shortLabel:"Pressure full",unit:"percent",family:"memory",colorSlot:4,description:"Linux PSI memory stall pressure, all tasks (avg10)"},{metric:"swap.used",label:"Swap used",shortLabel:"Swap",unit:"bytes",family:"swap",colorSlot:2,description:"Swap space in use"},{metric:"gpu.utilization",label:"GPU utilization",shortLabel:"Utilization",unit:"percent",family:"gpus",colorSlot:0,description:"Per-card graphics processor utilization"},{metric:"gpu.memory.used",label:"GPU memory used",shortLabel:"VRAM",unit:"bytes",family:"gpus",colorSlot:1,description:"Per-card video memory in use"},{metric:"gpu.temperature",label:"GPU temperature",shortLabel:"Temperature",unit:"celsius",family:"gpus",colorSlot:3,description:"Per-card temperature"},{metric:"gpu.power",label:"GPU power",shortLabel:"Power",unit:"watts",family:"gpus",colorSlot:4,description:"Per-card power draw"},{metric:"fs.used",label:"Filesystem used",shortLabel:"Filesystem",unit:"bytes",family:"disks",colorSlot:1,description:"Used space per mounted filesystem"},{metric:"fs.usage",label:"Filesystem usage",shortLabel:"Filesystem %",unit:"percent",family:"disks",colorSlot:1,description:"Used capacity per mounted filesystem, derived from a positive total"},{metric:"fs.inodes.usage",label:"Inode usage",shortLabel:"Inodes %",unit:"percent",family:"disks",colorSlot:2,description:"Used inodes per filesystem where the collector can read them"},{metric:"disk.read",label:"Disk read",shortLabel:"Read",unit:"bytes_per_second",family:"disks",colorSlot:0,description:"Device read throughput"},{metric:"disk.write",label:"Disk write",shortLabel:"Write",unit:"bytes_per_second",family:"disks",colorSlot:2,description:"Device write throughput"},{metric:"disk.read.latency",label:"Disk read latency",shortLabel:"Read latency",unit:"milliseconds",family:"disks",colorSlot:0,description:"Average device read latency"},{metric:"disk.write.latency",label:"Disk write latency",shortLabel:"Write latency",unit:"milliseconds",family:"disks",colorSlot:2,description:"Average device write latency"},{metric:"disk.utilization",label:"Disk utilization",shortLabel:"Utilization",unit:"percent",family:"disks",colorSlot:3,description:"Share of time the device had I/O in flight"},{metric:"io.pressure.some",label:"I/O pressure (some)",shortLabel:"I/O some",unit:"percent",family:"disks",colorSlot:3,description:"Linux PSI I/O stall pressure, some tasks (avg10)"},{metric:"io.pressure.full",label:"I/O pressure (full)",shortLabel:"I/O full",unit:"percent",family:"disks",colorSlot:4,description:"Linux PSI I/O stall pressure, all tasks (avg10)"},{metric:"net.rx",label:"Network received",shortLabel:"Received",unit:"bytes_per_second",family:"network",colorSlot:0,description:"Interface receive rate"},{metric:"net.tx",label:"Network sent",shortLabel:"Sent",unit:"bytes_per_second",family:"network",colorSlot:2,description:"Interface transmit rate"}];function n(e,t){return e.filter(r=>{for(let[s,n,i]of[["memory","memory.used","memory.usage"],["filesystem","fs.used","fs.usage"]])if(e.includes(n)&&e.includes(i)&&(r===n||r===i))return r===("percent"===t[s]?i:n);return!0})}let i=[{id:"cpu",label:"CPU",metrics:["cpu.usage","cpu.core","cpu.iowait","cpu.pressure","cpu.temperature","cpu.power"]},{id:"memory",label:"Memory",metrics:["memory.used","memory.usage","swap.used","memory.pressure.some","memory.pressure.full"]},{id:"gpu",label:"GPU",metrics:["gpu.utilization","gpu.memory.used","gpu.temperature","gpu.power"]},{id:"disk",label:"Storage",metrics:["fs.used","fs.usage","fs.inodes.usage","disk.read","disk.write","disk.read.latency","disk.write.latency","disk.utilization","io.pressure.some","io.pressure.full"]},{id:"network",label:"Network",metrics:["net.rx","net.tx"]}],l=["var(--cpu)","var(--mem)","color-mix(in oklab, var(--swap) 75%, var(--foreground))","var(--warn)","var(--crit)","var(--accent)"],o=[void 0,"7 4","2 3","10 3 2 3","4 4","1 3"];function a(e){return s.find(t=>t.metric===e)??null}function u(e,t){let r=Math.max(0,t),s=e.colorSlot+r,n=(r+Math.floor(s/l.length))%o.length;return{color:l[s%l.length],dash:o[n]}}let c={cpu:"CPU",memory:"Memory",swap:"Swap",gpus:"GPU metrics",disks:"Disk metrics",network:"Network metrics"};function d(e,t){let r=a(t);if(null===r||void 0===e)return{available:!0,reason:null};let s=e.inventory?.capabilities?.[r.family];if(!s||"supported"===s.status)return{available:!0,reason:null};let n=s.reason?.trim();return{available:!1,reason:n?`${c[r.family]}: ${s.status} — ${n}`:`${c[r.family]} are ${s.status} on this machine.`}}function m(e){if(void 0===e)return[];let t=[],r=r=>{!(t.length>=16)&&d(e,r).available&&t.push(r)};r("cpu.usage"),r("memory.used");let s=function(e){let t=e.inventory?.memory.swapTotalBytes;if("number"==typeof t)return t;let r=e.metrics?.payload.swap;return r?.status==="ok"?r.totalBytes:null}(e);return null!==s&&s>0&&r("swap.used"),p(e,[]).length>0&&(r("gpu.utilization"),r("gpu.memory.used")),t}function f(e){let t=e.includes(":")?e.slice(e.indexOf(":")+1):e;return t.length<=18?t:`${t.slice(0,10)}…${t.slice(-4)}`}function p(e,t){let r=new Set(t.filter(e=>e.metric.startsWith("gpu.")&&""!==e.resourceId&&e.points.some(e=>null!==e.avg||null!==e.min||null!==e.max)).map(e=>e.resourceId)),s=[],n=new Set;(e?.inventory?.gpus??[]).forEach(e=>{let t="supported"===e.telemetry;(t||r.has(e.id))&&(n.add(e.id),s.push({id:e.id,label:e.name.trim()||f(e.id),index:s.length,totalBytes:e.memoryTotalBytes,supported:t,hasHistory:r.has(e.id)}))});let i=e?.metrics?.payload.gpus;if(i?.status==="ok")for(let e of i.devices)n.has(e.id)||"ok"!==e.status||(n.add(e.id),s.push({id:e.id,label:f(e.id),index:s.length,totalBytes:e.memoryTotalBytes,supported:!0,hasHistory:r.has(e.id)}));for(let e of[...r].sort())n.has(e)||s.push({id:e,label:e.startsWith("pci:")?`Previously detected GPU (${f(e)})`:f(e),index:s.length,totalBytes:null,supported:!0,hasHistory:!0});return s}function h(e,t,r){if(""===r)return a(t)?.shortLabel??"Total";let s=a(t);if(null===s)return f(r);switch(s.family){case"gpus":{let t=e?.inventory?.gpus.find(e=>e.id===r);return t?.name.trim()||f(r)}case"disks":{if(t.startsWith("fs.")){let t=e?.inventory?.filesystems.find(e=>e.id===r);return t?.mountPoint||f(r)}let s=e?.inventory?.disks.find(e=>e.id===r);return s?.name||f(r)}case"network":{let t=e?.inventory?.network.find(e=>e.id===r);return t?.name||f(r)}case"cpu":{let e=/^core:(\d+)$/.exec(r);return e?`Core ${e[1]}`:f(r)}default:return f(r)}}function g(e){switch(e){case"percent":return"%";case"bytes":return"bytes";case"bytes_per_second":return"bytes/s";case"celsius":return"\xb0C";case"watts":return"W";case"milliseconds":return"ms";default:return e}}},5078:(e,t,r)=>{r.d(t,{Ah:()=>d,I_:()=>h,O5:()=>p,Vw:()=>M,bf:()=>v,dd:()=>c,ei:()=>m,fH:()=>g,ly:()=>n,pI:()=>s,r6:()=>f,zp:()=>i});let s=[{id:"10m",shortLabel:"10m",label:"Last 10 minutes",ms:6e5,refreshMs:1e3},{id:"1h",shortLabel:"1h",label:"Last hour",ms:36e5,refreshMs:1e3},{id:"6h",shortLabel:"6h",label:"Last 6 hours",ms:216e5,refreshMs:1e3},{id:"24h",shortLabel:"24h",label:"Last 24 hours",ms:864e5,refreshMs:1e3},{id:"7d",shortLabel:"7d",label:"Last 7 days",ms:6048e5,refreshMs:1e3}];function n(e){return s.find(t=>t.id===e)??s[0]}function i(e){return n(e).refreshMs}let l=["B","KiB","MiB","GiB","TiB","PiB"];function o(e){let t=Math.abs(e),r=0;for(;t>=1024&&r<l.length-1;)t/=1024,r+=1;return{value:e<0?-t:t,unit:l[r]}}function a(e,t){return String(Number(e.toFixed(t)))}function u(e,t=""){let{value:r,unit:s}=o(e),n=Math.abs(r)>=100?0:1;return`${a(r,n)} ${s}${t}`}function c(e,t){if(null==e||!Number.isFinite(e))return"—";switch(t){case"percent":return`${a(e,1)}%`;case"bytes":return u(e);case"bytes_per_second":return u(e,"/s");case"celsius":return`${a(e,1)}\xb0C`;case"watts":return`${a(e,1)} W`;case"milliseconds":return`${a(e,10>Math.abs(e)?2:1)} ms`;default:return a(e,2)}}function d(e,t){if(!Number.isFinite(e))return"—";switch(t){case"percent":return`${a(e,0)}%`;case"bytes":case"bytes_per_second":{let{value:r,unit:s}=o(e),n=Math.abs(r)>=10||0===r?0:1;return`${a(r,n)} ${s}${"bytes_per_second"===t?"/s":""}`}case"celsius":return`${a(e,0)}\xb0C`;case"watts":return`${a(e,0)} W`;case"milliseconds":return`${a(e,+(10>Math.abs(e)))} ms`;default:return a(e,1)}}function m(e){return new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function f(e){return new Date(e).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"medium"})}function p(e,t){let r=new Date(e);return t>=1728e5?r.toLocaleDateString(void 0,{month:"short",day:"numeric"}):t>=864e5?r.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}):r.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1})}function h(e){let t=Math.max(0,e);return t>=36e5?`${a(t/36e5,1)} h`:t>=6e4?`${a(t/6e4,1)} min`:`${a(t/1e3,1)} s`}function g(e,t,r){let s=e.filter(e=>e.toMs>=t&&e.fromMs<=r);if(0===s.length)return"No recorded gaps in this range.";let n=s.filter(e=>"dropped"===e.kind).length,i=s.length-n,l=[];i>0&&l.push(`${i} missed interval${1===i?"":"s"}`),n>0&&l.push(`${n} dropped report${1===n?"":"s"}`);let o=[...new Set(s.map(e=>e.reason).filter(e=>"string"==typeof e&&e.length>0))],a=o.length>0?` (${o.slice(0,3).join("; ")})`:"";return`${l.join(" and ")}${a}.`}function y(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function x(e){return"number"==typeof e&&Number.isFinite(e)}function b(e){return null===e||x(e)}function v(e){if(!y(e)||"string"!=typeof e.machineId||0===e.machineId.length||!x(e.fromMs)||!x(e.toMs)||e.toMs<=e.fromMs||!x(e.stepMs)||e.stepMs<=0||"raw"!==e.tier&&"1m"!==e.tier&&"1h"!==e.tier||"boolean"!=typeof e.truncated||!x(e.elapsedMs)||!Array.isArray(e.series)||!Array.isArray(e.gaps))return null;let t=[];for(let r of e.series){if(!y(r)||"string"!=typeof r.metric||"string"!=typeof r.resourceId||"string"!=typeof r.unit||!Array.isArray(r.points))return null;let e=[];for(let t of r.points){if(!y(t)||!x(t.t)||!b(t.min)||!b(t.max)||!b(t.avg))return null;e.push({t:t.t,min:t.min,max:t.max,avg:t.avg})}t.push({metric:r.metric,resourceId:r.resourceId,unit:r.unit,points:e})}let r=[];for(let t of e.gaps){if(!y(t)||!x(t.fromMs)||!x(t.toMs)||"missing"!==t.kind&&"dropped"!==t.kind)return null;let e={fromMs:t.fromMs,toMs:t.toMs,kind:t.kind};"string"==typeof t.reason&&(e.reason=t.reason),x(t.droppedRecords)&&(e.droppedRecords=t.droppedRecords),r.push(e)}return{machineId:e.machineId,fromMs:e.fromMs,toMs:e.toMs,stepMs:e.stepMs,tier:e.tier,series:t,gaps:r,truncated:e.truncated,elapsedMs:e.elapsedMs}}function M(e,t,r,s,i=600,l){let{fromMs:o,toMs:a}={fromMs:s-n(r).ms,toMs:s},u=new URLSearchParams({machineId:e,metrics:t.join(","),from:String(Math.floor(o)),to:String(Math.floor(a)),maxPoints:String(i)});return void 0!==l&&u.set("coreIds",l.join(",")),`/api/history?${u.toString()}`}},6304:(e,t,r)=>{function s(e,t,r,s){if(s.some(e=>t>e.fromMs&&t<e.toMs))return null;let n=0,i=e.length;for(;n<i;){let r=n+i>>>1;e[r].t<t?n=r+1:i=r}let l=e[n-1],o=e[n],a=l&&(!o||t-l.t<=o.t-t)?l:o;return!a||Math.abs(a.t-t)>r/2||s.some(e=>e.toMs>Math.min(t,a.t)&&e.fromMs<Math.max(t,a.t))?null:a}function n(e){return[...new Set(e.flatMap(e=>e.points.map(e=>e.t)))].sort((e,t)=>e-t).map(e=>({t:e,min:null,max:null,avg:null}))}function i(e,t,r,s,n,l=0){return Math.round(s+Math.max(0,Math.min(1,((r>0?(e-t)/r:0)-l)/(1-2*l)))*(n-s))}function l(e,t,r){return 0===e.length?null:"Home"===r?e[0].t:"End"===r||null===t?e.at(-1).t:"ArrowLeft"===r?[...e].reverse().find(e=>e.t<t)?.t??e[0].t:"ArrowRight"===r?e.find(e=>e.t>t)?.t??e.at(-1).t:t}r.d(t,{X:()=>n,bO:()=>s,o7:()=>l,yk:()=>i})},7284:(e,t,r)=>{r.d(t,{t:()=>c});var s=r(5155),n=r(2115),i=r(7726),l=r(5078),o=r(4567),a=r(6304),u=r(4150);function c(e){let{title:t,unit:r,series:c,fromMs:d,toMs:m,stepMs:f,gaps:p,hiddenKeys:h,onToggleSeries:g,emptyMessage:y,note:x}=e,b=(0,n.useMemo)(()=>c.filter(e=>!h.has(e.key)),[c,h]),v=(0,u.Au)({series:b,fromMs:d,toMs:m,stepMs:f,gaps:p}),M=(0,n.useRef)(null),k=(0,n.useMemo)(()=>b.flatMap(e=>e.points),[b]),w=k.some(e=>null!==e.avg||null!==e.min||null!==e.max),$=Math.max(1,m-d),j=(0,n.useMemo)(()=>(0,i.$z)(p,d,m,k),[p,d,m,k]),S=(0,n.useMemo)(()=>(0,i.kk)(r,k.flatMap(e=>[e.min,e.max,e.avg]).filter(e=>null!==e)),[r,k]),L=Math.max(1e-9,S.max-S.min),N=(0,n.useCallback)(e=>6+(Math.min(m,Math.max(d,e))-d)/$*788,[d,m,$]),P=(0,n.useCallback)(e=>6+(1-(e-S.min)/L)*148,[S.min,L]),I=(0,n.useMemo)(()=>b.map(t=>{let r=(0,i.o)(t.points,{stepMs:f,gaps:j,fromMs:d,toMs:m}).map(t=>(0,i.SG)(t,e.maxDrawPoints??601,f));return{...t,segments:r,envelope:r.filter(e=>e.length>1).map(e=>{let t=e.map(e=>`${N(e.t).toFixed(2)},${P(e.max??e.avg).toFixed(2)}`),r=[...e].reverse().map(e=>`${N(e.t).toFixed(2)},${P(e.min??e.avg).toFixed(2)}`);return`M${t.join("L")}L${r.join("L")}Z`}).join(" "),path:r.filter(e=>e.length>1).map(e=>e.map((e,t)=>`${0===t?"M":"L"}${N(e.t).toFixed(2)},${P(e.avg).toFixed(2)}`).join(" ")).join(" ")}}),[b,e.maxDrawPoints,f,j,d,m,N,P]),C=(0,n.useMemo)(()=>(function(e,t,r,s,n,o){if(0===r.length)return`${e} chart: no series selected.`;let a=r.map(e=>{let r=(0,i.T6)(e.points);return`${e.label}: ${function(e,t){let r=[];if(null!==e.latest){let s=null!==e.latestT?(0,l.ei)(e.latestT):null;r.push(`latest ${(0,l.dd)(e.latest,t)}${s?` at ${s}`:""}`)}return r.push(`average ${(0,l.dd)(e.avg,t)}`),null!==e.min&&null!==e.max&&r.push(`recorded range ${(0,l.dd)(e.min,t)} to ${(0,l.dd)(e.max,t)}`),r.join(", ")}(r,t)}`}),u=o>0?`${o} shaded interval${1===o?"":"s"} without stored data.`:"";return`${e} time-series chart. ${a.join(". ")}. ${u} Time range ${(0,l.ei)(s)} to ${(0,l.ei)(n)}.`})(t,r,b,d,m,j.length),[t,r,b,d,m,j.length]),A=(0,n.useMemo)(()=>new Map(c.map(e=>[e.key,(0,i.T6)(e.points)])),[c]),F=null===v.timeMs?[]:b.map(e=>({...e,point:(0,a.bO)(e.points,v.timeMs,f,p)})),D=null===v.timeMs?null:N(v.timeMs),R=`${v.id}-tooltip`,U=`${v.id}-instructions`,E=(0,n.useMemo)(()=>(0,s.jsxs)(s.Fragment,{children:[S.ticks.map(e=>(0,s.jsx)("line",{x1:6,x2:794,y1:P(e),y2:P(e),stroke:"var(--border)",strokeWidth:"1",vectorEffect:"non-scaling-stroke"},`grid-${e}`)),j.map(e=>(0,s.jsx)("rect",{x:N(e.fromMs),y:6,width:Math.max(1,N(e.toMs)-N(e.fromMs)),height:148,fill:"var(--muted-foreground)",opacity:"0.09"},`gap-${e.fromMs}-${e.toMs}-${e.kind}`)),I.map(e=>{let t=e.envelope;return""===t?null:(0,s.jsx)("path",{d:t,fill:e.color,opacity:"0.14",stroke:"none"},`band-${e.key}`)}),I.map(e=>{let t=e.path;return""===t?null:(0,s.jsx)("path",{d:t,fill:"none",stroke:e.color,strokeWidth:"2",strokeDasharray:e.dash,strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"},`line-${e.key}`)}),I.flatMap(e=>e.segments.filter(e=>1===e.length).map(t=>{let r=t[0],n=N(r.t),i=P(r.avg);return(0,s.jsx)("line",{x1:n-2.5,x2:n+2.5,y1:i,y2:i,stroke:e.color,strokeWidth:"2.5",strokeLinecap:"round",vectorEffect:"non-scaling-stroke"},`dot-${e.key}-${r.t}`)}))]}),[S,N,P,j,I]);return(0,s.jsxs)("figure",{className:`flex min-w-0 flex-col gap-2 ${e.className??""}`,children:[(0,s.jsxs)("div",{className:"flex min-h-8 flex-wrap items-center justify-between gap-2",children:[(0,s.jsx)("h3",{className:"text-xs font-medium tracking-tight text-foreground",children:t}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("span",{className:"tnum shrink-0 text-xs text-muted-foreground",children:x??(0,o.RL)(r)}),e.action]})]}),w?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex min-w-0 gap-2",children:[(0,s.jsx)("div",{"aria-hidden":!0,className:"flex h-40 w-14 shrink-0 flex-col justify-between py-0.5 text-right text-xs leading-none tnum text-muted-foreground",children:[...S.ticks].reverse().map(e=>(0,s.jsx)("span",{children:(0,l.Ah)(e,r)},e))}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("div",{className:"relative",onPointerLeave:v.clear,onPointerMove:e=>{let t=M.current?.getBoundingClientRect();t&&v.inspect((0,a.yk)(e.clientX,t.left,t.width,d,m,.0075))},children:[(0,s.jsx)("p",{id:U,className:"sr-only",children:"Use Left and Right arrows to inspect recorded readings, Home or End to jump, and Escape to dismiss."}),(0,s.jsxs)("svg",{ref:M,viewBox:"0 0 800 160",preserveAspectRatio:"none",role:"img","aria-label":C,tabIndex:0,"aria-describedby":`${U}${v.active?` ${R}`:""}`,onFocus:v.onFocus,onBlur:v.clear,onKeyDown:v.onKeyDown,className:"block h-40 w-full cursor-crosshair rounded-sm focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent",children:[(0,s.jsx)("title",{children:t}),E,null!==D?(0,s.jsxs)("g",{"aria-hidden":!0,pointerEvents:"none",children:[(0,s.jsx)("line",{x1:D,x2:D,y1:6,y2:154,stroke:"var(--muted-foreground)",strokeWidth:"1",strokeDasharray:"3 3",vectorEffect:"non-scaling-stroke"}),F.map(({key:e,color:t,point:r})=>r?.avg==null?null:(0,s.jsx)("circle",{cx:N(r.t),cy:P(r.avg),r:"3.5",fill:t,stroke:"var(--card)",strokeWidth:"1.5",vectorEffect:"non-scaling-stroke"},e))]}):null]}),v.active&&null!==v.timeMs&&null!==D?(0,s.jsx)(u.eg,{id:R,timeMs:v.timeMs,fraction:D/800,unit:r,readings:F}):null]}),(0,s.jsx)("div",{"aria-hidden":!0,className:"mt-1 flex justify-between gap-2 text-xs leading-tight tnum text-muted-foreground",children:(0,i.Cf)(d,m).map((e,t,r)=>(0,s.jsx)("span",{className:`${0===t?"text-left":t===r.length-1?"text-right":"hidden text-center sm:inline"}`,children:(0,l.O5)(e,$)},e))})]})]}),(0,s.jsx)("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1.5 text-xs",children:c.map(e=>{let t=!h.has(e.key),n=A.get(e.key);return(0,s.jsxs)("label",{className:"inline-flex min-h-7 cursor-pointer items-center gap-1.5",title:t?`Hide ${e.label}`:`Show ${e.label}`,children:[(0,s.jsx)("input",{type:"checkbox",checked:t,onChange:()=>g(e.key),className:"peer sr-only"}),(0,s.jsx)("span",{"aria-hidden":!0,className:"flex h-4 w-5 shrink-0 items-center justify-center rounded-sm peer-focus-visible:outline peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2 peer-focus-visible:[outline-color:var(--focus)]",children:(0,s.jsx)("svg",{viewBox:"0 0 20 8",className:"h-2 w-5","aria-hidden":!0,children:(0,s.jsx)("line",{x1:"1",y1:"4",x2:"19",y2:"4",stroke:e.color,strokeWidth:"2.5",strokeDasharray:e.dash,strokeLinecap:"round"})})}),(0,s.jsx)("span",{className:t?"text-foreground":"text-muted-foreground line-through",children:e.label}),(0,s.jsx)("span",{className:"tnum text-muted-foreground",children:(0,l.dd)(n.latest,r)})]},`legend-${e.key}`)})})]}):(0,s.jsx)("div",{className:"flex min-h-32 items-center justify-center rounded-lg border border-dashed border-border px-4 py-6 text-center text-xs text-muted-foreground",children:0===c.length?y:0===b.length?"All series are hidden. Re-enable one in the legend below.":y}),!w&&c.length>0?(0,s.jsx)("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1.5 text-xs",children:c.map(e=>{let t=!h.has(e.key);return(0,s.jsxs)("label",{className:"inline-flex min-h-7 cursor-pointer items-center gap-1.5",children:[(0,s.jsx)("input",{type:"checkbox",checked:t,onChange:()=>g(e.key),className:"peer sr-only"}),(0,s.jsx)("span",{"aria-hidden":!0,className:"flex h-4 w-5 shrink-0 items-center justify-center peer-focus-visible:outline peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2 peer-focus-visible:[outline-color:var(--focus)]",children:(0,s.jsx)("svg",{viewBox:"0 0 20 8",className:"h-2 w-5","aria-hidden":!0,children:(0,s.jsx)("line",{x1:"1",y1:"4",x2:"19",y2:"4",stroke:e.color,strokeWidth:"2.5",strokeDasharray:e.dash,strokeLinecap:"round"})})}),(0,s.jsx)("span",{className:t?"text-foreground":"text-muted-foreground line-through",children:e.label})]},`legend-empty-${e.key}`)})}):null]})}},7726:(e,t,r)=>{function s(e){return null!==e.avg&&Number.isFinite(e.avg)}function n(e){return null!==e&&Number.isFinite(e)?e:null}function i(e){let t=[];for(let r of e){let e=t.at(-1);if(void 0!==e&&r.fromMs<=e.toMs){e.toMs=Math.max(e.toMs,r.toMs),"missing"===e.kind&&"dropped"===r.kind&&(e.kind="dropped"),void 0===e.reason&&void 0!==r.reason&&(e.reason=r.reason),void 0===e.droppedRecords&&void 0!==r.droppedRecords&&(e.droppedRecords=r.droppedRecords);continue}t.push({...r})}return t}function l(e,t,r,n){let l=i(e.map(e=>({...e,fromMs:Math.max(t,e.fromMs),toMs:Math.min(r,e.toMs)})).filter(e=>e.toMs>e.fromMs).sort((e,t)=>e.fromMs-t.fromMs||e.toMs-t.toMs));return void 0===n?l:function(e,t,r,n){if(0===e.length)return[];let l=[...new Set(t.filter(s).map(e=>e.t).filter(e=>Number.isFinite(e)))].sort((e,t)=>e-t),o=[];for(let t of e){let e=Math.max(r,Math.min(n,t.fromMs)),s=Math.max(r,Math.min(n,t.toMs));if(s<=e)continue;let i=Math.max(r,function(e,t){let r=0,s=e.length;for(;r<s;){let n=r+s>>>1;e[n]<=t?r=n+1:s=n}return r>0?e[r-1]:null}(l,e)??e),a=Math.min(n,function(e,t){let r=0,s=e.length;for(;r<s;){let n=r+s>>>1;e[n]<t?r=n+1:s=n}return r<e.length?e[r]:null}(l,s)??s);a<=i||o.push({...t,fromMs:i,toMs:a})}return o.sort((e,t)=>e.fromMs-t.fromMs||e.toMs-t.toMs),i(o)}(l,n,t,r)}function o(e,t,r){return Math.max(e,"1h"===t?36e5:"1m"===t?6e4:100,r??0)}function a(e,t){let r=[...e].sort((e,t)=>e.t-t.t),n=l(t.gaps,t.fromMs,t.toMs),i=Math.max(1,t.stepMs),o=[],a=[],u=()=>{a.length>0&&o.push(a),a=[]};for(let e of r){if(!s(e)){u();continue}let t=a.at(-1);if(void 0!==t){let r=!e.merged&&!t.merged&&(e.t<t.t||e.t-t.t>1.5*i),s=!0===e.gapBefore||function(e,t,r){return r.some(r=>r.toMs>e&&r.fromMs<t)}(t.t,e.t,n);(r||s)&&u()}a.push(e)}return u(),o}function u(e,t,r){if(t<=0)return[];let i=[...e].sort((e,t)=>e.t-t.t);if(i.length<=t)return i.map(e=>({...e}));let l=Math.max(2,Math.ceil(i.length/t)),o=Math.max(1,r),a=[],u=[],c=!1,d=null,m=()=>{if(0===u.length)return;let e=null,t=null,r=0,s=0;for(let i of u){let l=n(i.min),o=n(i.max);null!==l&&(null===e||l<e)&&(e=l),null!==o&&(null===t||o>t)&&(t=o);let a=n(i.avg);null!==a&&(r+=a,s+=1)}a.push({t:u[0].t,min:e,max:t,avg:s>0?r/s:null,...u.length>1?{merged:!0}:{},...c?{gapBefore:!0}:{}}),u=[],c=!1};for(let e of i){if(!s(e)){m(),a.push({...e}),d=null;continue}let t=null!==d&&e.t>=d.t&&e.t-d.t<=1.5*o;u.length>0&&(!t||u.length>=l)&&m(),0===u.length&&(c=null!==d&&!t),u.push(e),d=e}return m(),a}function c(e){let t=null,r=null,s=0,i=0,l=null,o=null,a=null,u=null;for(let c of e){if(null===c.avg)continue;(null===a||c.t<a)&&(a=c.t),(null===u||c.t>u)&&(u=c.t);let e=n(c.min),d=n(c.max);null!==e&&(null===t||e<t)&&(t=e),null!==d&&(null===r||d>r)&&(r=d),null!==c.avg&&Number.isFinite(c.avg)&&(s+=c.avg,i+=1,l=c.avg,o=c.t)}return{count:i,min:t,max:r,avg:i>0?s/i:null,latest:l,latestT:o,firstT:a,lastT:u}}function d(e){if(!Number.isFinite(e)||e<=0)return 1;let t=Math.pow(10,Math.floor(Math.log10(e))),r=e/t;return(r<=1?1:r<=2?2:r<=5?5:10)*t}function m(e,t){if("percent"===e)return{min:0,max:100,ticks:[0,25,50,75,100]};let r=t.filter(e=>null!==e&&Number.isFinite(e));if(0===r.length)return{min:0,max:1,ticks:[0,1]};let s=Math.min(...r),n=Math.max(...r);if("celsius"===e){let e=Math.max(1,(n-s)*.1);s=5*Math.floor((s-e)/5),n=5*Math.ceil((n+e)/5)}else s=0,n=n>0?n:1;n<=s&&(n=s+1);let i=d((n-s)/4),l=Math.floor(s/i)*i,o=Math.ceil(n/i)*i,a=function(e,t,r=4){if(!Number.isFinite(e)||!Number.isFinite(t))return[0,1];if(t<=e)return[e];let s=d((t-e)/Math.max(1,r)),n=Math.ceil(e/s)*s,i=[];for(let e=n;e<=t+.001*s&&i.length<20;e+=s)i.push(Number(e.toPrecision(12)));return i.length>0?i:[e,t]}(l,o,4);return{min:l,max:o,ticks:a}}function f(e,t,r=4){let s=Math.max(2,Math.floor(r)),n=Math.max(0,t-e);return Array.from({length:s},(t,r)=>e+n*r/(s-1))}r.d(t,{$z:()=>l,Cf:()=>f,SG:()=>u,T6:()=>c,jl:()=>o,kk:()=>m,o:()=>a})},9429:(e,t,r)=>{r.d(t,{n:()=>l});var s=r(2115),n=r(5078);async function i(e){let t=null;try{let r=await e.json();if(null!==r&&"object"==typeof r&&"error"in r){let e=r.error;"string"==typeof e&&(t=e)}}catch{}switch(e.status){case 401:return{kind:"unauthorized",message:"Your session is no longer accepted."};case 403:return{kind:"denied",message:t??"You do not have access to this machine's history."};case 404:return{kind:"missing",message:t??"This machine is not available to the hub."};case 429:return{kind:"rate-limited",message:t??"The hub is limiting history requests."};case 503:return{kind:"unavailable",message:t??"History is temporarily unavailable."};default:return{kind:"invalid",message:t??`The hub could not answer this history query (${e.status}).`}}}function l({machineId:e,metricsKey:t,coreIdsKey:r,range:o,enabled:a=!0,autoRefresh:u=!0,refreshNonce:c=0}){let[d,m]=(0,s.useState)({machineId:e,metricsKey:t,coreIdsKey:r,range:o}),f=d.machineId===e&&d.range===o;(0,s.useEffect)(()=>{if(!f)return void m({machineId:e,metricsKey:t,coreIdsKey:r,range:o});let s=window.setTimeout(()=>m({machineId:e,metricsKey:t,coreIdsKey:r,range:o}),300);return()=>window.clearTimeout(s)},[e,t,r,o,f]);let p=f?d:{machineId:e,metricsKey:t,coreIdsKey:r,range:o},h=p.metricsKey,g=p.coreIdsKey,y=`${e}|${h}|${o}|${g??"all"}`,[x,b]=(0,s.useState)(null),[v,M]=(0,s.useState)(null),[k,w]=(0,s.useState)(null),$=(0,s.useRef)(c);return(0,s.useEffect)(()=>{let t=$.current!==c;if($.current=c,!a||!e||!h)return;let r=!0,s=!1,l=!1,d=-1/0,m=new AbortController,f=(0,n.zp)(o),p=async(t=!1)=>{if(r&&!s&&!l){s=!0,d=Date.now(),w({key:y,manual:t});try{let t=await fetch((0,n.Vw)(e,h.split(","),o,Date.now(),600,void 0===g?void 0:g.split(",").filter(Boolean)),{signal:"function"!=typeof AbortSignal.any||"function"!=typeof AbortSignal.timeout?m.signal:AbortSignal.any([m.signal,AbortSignal.timeout(2e4)]),cache:"no-store",headers:{Accept:"application/json"}});if(!t.ok)throw await i(t);let s=(0,n.bf)(await t.json());if(null===s||s.machineId!==e)throw{kind:"invalid",message:"Unexpected history response."};if(!r)return;b({key:y,range:o,result:s,loadedAt:Date.now()}),M(null)}catch(t){if(!r||m.signal.aborted)return;let e=null!==t&&"object"==typeof t&&"kind"in t&&"message"in t&&"string"==typeof t.message?t:{kind:"network",message:"Could not reach the hub. Try again."};l="rate-limited"===e.kind,["unauthorized","denied","missing"].includes(e.kind)&&b(null),M({key:y,error:e})}finally{s=!1,r&&w(null)}}},x=()=>{"visible"!==document.visibilityState||Date.now()-d<f||p()};p(t);let v=u?window.setInterval(x,f):null;return u&&document.addEventListener("visibilitychange",x),()=>{r=!1,m.abort(),null!==v&&window.clearInterval(v),document.removeEventListener("visibilitychange",x)}},[a,e,h,g,o,y,u,c]),{data:a&&x?.result.machineId===e&&x.range===o?x:null,error:a&&v?.key===y?v.error:null,loading:a&&k?.key===y,manualRefreshing:a&&k?.key===y&&k.manual}}}}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[693],{3092:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(8698).A)("ShieldCheck",[["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"}]])},3612:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(8698).A)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},4268:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(8698).A)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},4891:(e,t,a)=>{Promise.resolve().then(a.bind(a,7044))},5798:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(8698).A)("Pencil",[["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"}]])},7044:(e,t,a)=>{"use strict";a.d(t,{AdministrationView:()=>ee});var s=a(5155),n=a(8500),r=a.n(n),l=a(2115),i=a(6914),d=a(7029),c=a(828),o=a(7422),u=a(3092);class m extends Error{status;constructor(e,t){super(t),this.name="AdminApiError",this.status=e}}function h(){return new m(502,"The hub returned an unexpected response.")}var x=a(4173),p=a(3440),f=a(940),g=a(802),b=a(9939);let j="w-full min-w-0 rounded-md border border-border bg-background px-3 py-2 text-base text-foreground placeholder:text-muted-foreground aria-[invalid=true]:border-crit sm:text-sm",y="inline-flex min-h-9 items-center justify-center gap-1.5 rounded-md bg-accent px-3 py-1.5 text-xs font-medium text-accent-foreground transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50",v="inline-flex min-h-9 items-center justify-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-xs font-medium text-foreground transition-colors hover:bg-card-strong disabled:cursor-not-allowed disabled:opacity-50",w="inline-flex min-h-8 items-center justify-center gap-1.5 rounded-md px-2 py-1 text-xs text-muted-foreground transition-colors hover:bg-card-strong hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",N="inline-flex min-h-9 items-center justify-center gap-1.5 rounded-md border border-crit px-3 py-1.5 text-xs font-medium text-crit transition-colors hover:bg-crit-soft disabled:cursor-not-allowed disabled:opacity-50";function k({id:e,label:t,error:a,children:n}){return(0,s.jsxs)("div",{className:"flex min-w-0 flex-col gap-1.5",children:[(0,s.jsx)("label",{htmlFor:e,className:"text-xs font-medium text-foreground",children:t}),n,a?(0,s.jsx)("p",{id:`${e}-error`,className:"text-xs text-crit",children:a}):null]})}function C(e,t){if(t)return`${e}-error`}function A({children:e,tone:t="neutral"}){return(0,s.jsx)("span",{className:`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium ${{neutral:"border border-border text-muted-foreground",accent:"bg-selected text-foreground",ok:"bg-ok-soft text-foreground",warn:"bg-warn-soft text-foreground",crit:"bg-crit-soft text-foreground"}[t]}`,children:e})}function S({children:e,tone:t="info",role:a="status"}){return(0,s.jsx)("p",{role:a,className:`rounded-md px-3 py-2 text-xs ${{info:"text-muted-foreground",error:"bg-crit-soft text-foreground",success:"bg-ok-soft text-foreground",warn:"bg-warn-soft text-foreground"}[t]}`,children:e})}function I(e,t){return e instanceof m?e.message:t}function T(e){return e instanceof m&&401===e.status}function $(e){return e instanceof m&&403===e.status}function E(e){return"object"==typeof e&&null!==e&&"AbortError"===e.name}var R=a(8698);let M=(0,R.A)("ScrollText",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]),D=/^[\x21-\x7e]{1,128}$/,U=/[\u0000-\u001f\u007f]/;function L(e){let t=new Date(e);return Number.isFinite(t.getTime())?t.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"}):"Unknown time"}function G(e){let t=e.displayName?.trim();if(t)return t;let a=e.hostname?.trim();return a||e.machineId}function P(e){let{api:t,revision:a,onSessionLost:n}=e,[r,i]=(0,l.useState)([]),[d,o]=(0,l.useState)(!0),[u,m]=(0,l.useState)(null),h=(0,l.useRef)(null),x=(0,l.useCallback)(async()=>{h.current?.abort();let e=new AbortController;h.current=e,o(!0),m(null);try{let a=await t.listAudit(50,e.signal);e.signal.aborted||i(a)}catch(t){if(e.signal.aborted||E(t))return;if(T(t))return void n();m($(t)?"Administrator access is required to read the audit log.":I(t,"Could not load the audit log."))}finally{e.signal.aborted||o(!1)}},[t,n]);return(0,l.useEffect)(()=>(x(),()=>h.current?.abort()),[x,a]),(0,s.jsxs)(p.Z,{title:"Audit log",className:"min-w-0",action:(0,s.jsxs)("button",{type:"button",className:w,onClick:()=>void x(),disabled:d,children:[(0,s.jsx)(c.A,{className:`h-3.5 w-3.5 ${d?"animate-spin":""}`,"aria-hidden":!0}),"Refresh"]}),children:[(0,s.jsx)("div",{className:"flex flex-wrap items-baseline justify-between gap-2",children:(0,s.jsxs)("span",{className:"tnum text-xs text-muted-foreground",children:[r.length," event",1===r.length?"":"s"]})}),u?(0,s.jsxs)("div",{className:"mt-3 flex flex-wrap items-center justify-between gap-2",children:[(0,s.jsx)(S,{tone:"error",role:"alert",children:u}),(0,s.jsx)("button",{type:"button",className:w,onClick:()=>void x(),children:"Try again"})]}):null,d&&0===r.length&&!u?(0,s.jsx)("p",{role:"status",className:"py-6 text-sm text-muted-foreground",children:"Loading audit events…"}):null,d||u||0!==r.length?null:(0,s.jsx)(p.p,{icon:M,note:"No administrative changes recorded yet."}),r.length>0?(0,s.jsx)("ol",{className:"mt-2 max-h-96 divide-y divide-border overflow-y-auto border-t border-border",children:r.map((e,t)=>(0,s.jsxs)("li",{className:"flex min-w-0 flex-wrap items-baseline gap-x-3 gap-y-1 py-2.5 text-xs",children:[(0,s.jsx)("time",{dateTime:e.at,className:"tnum shrink-0 text-muted-foreground",children:L(e.at)}),(0,s.jsx)("span",{className:"font-medium text-foreground",children:function(e){switch(e){case"user.create":return"Created user";case"user.update":return"Updated access";case"user.update-password":return"Changed password";case"user.delete":return"Deleted user";default:return e.replace(/[-_.]+/g," ")}}(e.action)}),(0,s.jsxs)("span",{className:"min-w-0 break-all text-muted-foreground",children:[e.target," ",(0,s.jsx)("span",{"aria-hidden":!0,children:"\xb7"})," by ",e.actor]})]},`${e.at}-${e.actor}-${e.action}-${e.target}-${t}`))}):null]})}let q=(0,R.A)("ShieldOff",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]]),F=(0,R.A)("KeyRound",[["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"}]]);var O=a(4268),Y=a(1735);let Z=(0,R.A)("ClipboardCopy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]),V=[{value:3e5,label:"5 minutes"},{value:6e5,label:"10 minutes"},{value:9e5,label:"15 minutes"}];function B(e){let{api:t,csrfToken:a,sessionKey:n,machines:r,onAuditChange:i,onSessionLost:d}=e,o=(0,l.useId)(),u=e=>`${o}-${e}`,[m,h]=(0,l.useState)([]),[x,f]=(0,l.useState)(!0),[g,b]=(0,l.useState)(null),[C,R]=(0,l.useState)(""),[M,D]=(0,l.useState)(""),[U,P]=(0,l.useState)(9e5),[B,H]=(0,l.useState)(null),[z,_]=(0,l.useState)(null),[K,J]=(0,l.useState)(!1),[W,X]=(0,l.useState)(""),[Q,ee]=(0,l.useState)(null),[et,ea]=(0,l.useState)(!1),[es,en]=(0,l.useState)(null),er=(0,l.useRef)(null),el=(0,l.useRef)(!0),ei=(0,l.useRef)(null),ed=(0,l.useRef)(null);(0,l.useEffect)(()=>(el.current=!0,()=>{el.current=!1,er.current?.abort()}),[]),(0,l.useEffect)(()=>{H(null),X("")},[n]),(0,l.useEffect)(()=>{B&&(ei.current?.focus(),ei.current?.select())},[B]);let ec=(0,l.useCallback)(async()=>{er.current?.abort();let e=new AbortController;er.current=e,f(!0),b(null);try{let a=await t.listCollectors(e.signal);e.signal.aborted||h(a)}catch(t){if(e.signal.aborted||E(t))return;if(T(t))return void d();b($(t)?"Administrator access is required to inspect collector mappings.":I(t,"Could not load the collector registry."))}finally{e.signal.aborted||f(!1)}},[t,d]);(0,l.useEffect)(()=>{ec()},[ec]),(0,l.useEffect)(()=>{""!==M&&(m.some(e=>e.machineId===M&&!e.revoked)||D(""))},[m,M]);let eo=m.filter(e=>!e.revoked),eu=""!==M,em=B?function(e,t="https://your-hub"){let a=new URL(t);if(!["https:","http:"].includes(a.protocol)||a.username||a.password||a.search||a.hash)throw Error("Invalid hub origin");let s=a.origin.replace(/'/g,"%27");return{command:`rigscope connect '${s}'${"replacement"===e?" --replace":""}`,note:"replacement"===e?"Paste the grant at the prompt. The old credential stays active until replacement succeeds.":"Paste the grant at the prompt, then run rigscope start."}}(B.mode,window.location.origin):null,eh=async()=>{if(!K){_(null),J(!0);try{let e=await t.createGrant({ttlMs:U,...eu?{replaceMachineId:M}:{}},a);if(!el.current)return;H({...e,mode:eu?"replacement":"new"}),X(""),R("Grant created. Copy before leaving."),i()}catch(e){if(!el.current)return;if(T(e))return void d();if($(e))return void _(eu?"You do not have access to that machine, so a replacement grant cannot be created.":"A new installation needs a hub administrator with all-machine scope. Choose an existing mapping for a replacement grant, or ask the hub owner to widen your scope.");_(I(e,"Could not create an enrollment grant."))}finally{el.current&&J(!1)}}},ex=async()=>{if(B)try{if(!navigator.clipboard?.writeText)throw Error("clipboard unavailable");await navigator.clipboard.writeText(B.token),X("Grant copied to the clipboard.")}catch{X("Copy failed. Select the grant field and copy it manually.")}},ep=async()=>{if(em)try{if(!navigator.clipboard?.writeText)throw Error("clipboard unavailable");await navigator.clipboard.writeText(em.command),X("Command copied.")}catch{X("Copy failed. Select the command and copy it manually.")}},ef=async()=>{if(Q&&!et){ea(!0),en(null);try{if(await t.revokeCollector(Q.collectorId,a),!el.current)return;let e=`${Q.collectorId} on ${Q.machineId}`;ee(null),R(`Revoked ${e}. Its live stream was disconnected.`),i(),await ec()}catch(e){if(!el.current)return;if(T(e))return void d();en($(e)?"Your account does not have access to that collector's machine.":I(e,"Could not revoke that collector."))}finally{el.current&&ea(!1)}}},eg=e=>{let t=r.find(t=>t.machineId===e);return t?G(t):e};return(0,s.jsxs)(p.Z,{title:"Collectors",className:"min-w-0",action:(0,s.jsxs)("button",{type:"button",className:w,onClick:()=>void ec(),disabled:x,children:[(0,s.jsx)(c.A,{className:`h-3.5 w-3.5 ${x?"animate-spin":""}`,"aria-hidden":!0}),"Refresh"]}),children:[(0,s.jsx)("p",{role:"status",className:C?"mb-3 rounded-md bg-ok-soft px-3 py-2 text-xs text-foreground":"sr-only",children:C}),g?(0,s.jsxs)("div",{className:"mb-3 flex flex-wrap items-center justify-between gap-2",children:[(0,s.jsx)(S,{tone:"error",role:"alert",children:g}),(0,s.jsx)("button",{type:"button",className:v,onClick:()=>void ec(),children:"Try again"})]}):null,(0,s.jsxs)("div",{className:"grid min-w-0 gap-6 lg:grid-cols-2",children:[(0,s.jsxs)("section",{"aria-labelledby":u("registry-heading"),className:"min-w-0",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-baseline justify-between gap-2",children:[(0,s.jsx)("h3",{id:u("registry-heading"),className:"text-sm font-medium tracking-tight",children:"Registry"}),(0,s.jsxs)("span",{className:"tnum text-xs text-muted-foreground",children:[eo.length," active / ",m.length," total"]})]}),x&&0===m.length?(0,s.jsx)("p",{role:"status",className:"py-6 text-sm text-muted-foreground",children:"Loading collector mappings…"}):null,x||g||0!==m.length?null:(0,s.jsx)(p.p,{icon:q,note:"No collector mappings are visible."}),m.length>0?(0,s.jsx)("ul",{className:"mt-2 divide-y divide-border border-t border-border",children:m.map(e=>{let t=Q?.collectorId===e.collectorId;return(0,s.jsxs)("li",{className:"min-w-0 py-3",children:[(0,s.jsxs)("div",{className:"flex min-w-0 flex-wrap items-start justify-between gap-x-4 gap-y-2",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,s.jsx)("span",{className:"break-words text-sm font-medium",children:eg(e.machineId)}),e.revoked?(0,s.jsx)(A,{tone:"crit",children:"Revoked"}):(0,s.jsx)(A,{tone:"ok",children:"Active"})]}),(0,s.jsxs)("dl",{className:"mt-1 flex flex-col gap-0.5 text-xs text-muted-foreground",children:[(0,s.jsxs)("div",{className:"flex min-w-0 gap-1.5",children:[(0,s.jsx)("dt",{className:"shrink-0",children:"Machine"}),(0,s.jsx)("dd",{className:"tnum break-all",children:e.machineId})]}),(0,s.jsxs)("div",{className:"flex min-w-0 gap-1.5",children:[(0,s.jsx)("dt",{className:"shrink-0",children:"Collector"}),(0,s.jsx)("dd",{className:"tnum break-all",children:e.collectorId})]}),(0,s.jsxs)("div",{className:"flex min-w-0 gap-1.5",children:[(0,s.jsx)("dt",{className:"shrink-0",children:"Updated"}),(0,s.jsx)("dd",{children:L(e.updatedAt)})]})]})]}),e.revoked?null:(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-1",children:[(0,s.jsxs)("button",{type:"button",className:w,onClick:()=>{D(e.machineId),_(null),requestAnimationFrame(()=>ed.current?.focus())},children:[(0,s.jsx)(F,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Replacement grant"]}),(0,s.jsxs)("button",{type:"button",className:w,"aria-expanded":t,onClick:()=>{en(null),ee(t?null:e)},children:[(0,s.jsx)(q,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Revoke"]})]})]}),t?(0,s.jsxs)("div",{role:"alert",className:"mt-2 flex flex-wrap items-center gap-x-3 gap-y-2 rounded-md bg-crit-soft px-3 py-2",children:[(0,s.jsxs)("p",{className:"min-w-0 flex-1 text-xs text-foreground",children:["Revoke ",(0,s.jsx)("strong",{className:"font-medium",children:e.collectorId})," ","on ",(0,s.jsx)("strong",{className:"font-medium",children:eg(e.machineId)}),"? This disconnects the collector and invalidates its credential."]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[(0,s.jsx)("button",{type:"button",className:N,onClick:()=>void ef(),disabled:et,children:et?"Revoking…":"Revoke collector"}),(0,s.jsx)("button",{type:"button",className:v,onClick:()=>ee(null),disabled:et,children:"Cancel"})]})]}):null,t&&es?(0,s.jsx)("p",{role:"alert",className:"mt-2 text-xs text-crit",children:es}):null]},e.collectorId)})}):null]}),(0,s.jsxs)("section",{"aria-labelledby":u("grant-heading"),className:"flex min-w-0 flex-col gap-3 border-t border-border pt-5 lg:border-l lg:border-t-0 lg:pl-6 lg:pt-0",children:[(0,s.jsx)("div",{children:(0,s.jsx)("h3",{id:u("grant-heading"),className:"text-sm font-medium tracking-tight",children:"Add machine"})}),(0,s.jsx)(k,{id:u("target"),label:"Enrollment target",children:(0,s.jsxs)("select",{id:u("target"),value:M,onChange:e=>{D(e.target.value),_(null)},className:j,children:[(0,s.jsx)("option",{value:"",children:"New machine"}),eo.map(e=>(0,s.jsxs)("option",{value:e.machineId,children:["Replacement \xb7 ",eg(e.machineId)," \xb7 ",e.collectorId]},e.collectorId))]})}),(0,s.jsx)(k,{id:u("ttl"),label:"Grant lifetime",children:(0,s.jsx)("select",{id:u("ttl"),value:U,onChange:e=>P(Number(e.target.value)),className:j,children:V.map(e=>(0,s.jsx)("option",{value:e.value,children:e.label},e.value))})}),z?(0,s.jsx)(S,{tone:"error",role:"alert",children:z}):null,(0,s.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:(0,s.jsxs)("button",{ref:ed,type:"button",className:y,onClick:()=>void eh(),disabled:K,"aria-busy":K,children:[(0,s.jsx)(F,{className:"h-3.5 w-3.5","aria-hidden":!0}),K?"Creating…":eu?"Create replacement grant":"Create connection grant"]})}),B&&em?(0,s.jsxs)("section",{"aria-labelledby":u("grant-reveal-heading"),className:"flex min-w-0 flex-col gap-3 border-t border-border pt-3",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[(0,s.jsx)("h4",{id:u("grant-reveal-heading"),className:"text-sm font-medium",children:"Copy this grant now"}),(0,s.jsxs)("button",{type:"button",className:w,onClick:()=>{H(null),X(""),_(null),R("Grant dismissed."),requestAnimationFrame(()=>ed.current?.focus())},"aria-label":"Dismiss enrollment grant",children:[(0,s.jsx)(O.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Dismiss"]})]}),(0,s.jsx)(S,{tone:"warn",role:"alert",children:(0,s.jsxs)("span",{className:"flex items-start gap-2",children:[(0,s.jsx)(Y.A,{className:"mt-0.5 h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,s.jsxs)("span",{children:["Single-use grant \xb7 expires"," ",(0,s.jsx)("time",{dateTime:B.expiresAt,children:L(B.expiresAt)}),". Copy before leaving."]})]})}),(0,s.jsxs)("div",{className:"flex min-w-0 flex-col gap-1.5",children:[(0,s.jsx)("label",{htmlFor:u("grant-token"),className:"text-xs font-medium",children:"One-time grant"}),(0,s.jsxs)("div",{className:"flex min-w-0 flex-wrap gap-1.5",children:[(0,s.jsx)("input",{ref:ei,id:u("grant-token"),readOnly:!0,autoComplete:"off",spellCheck:!1,value:B.token,onFocus:e=>e.currentTarget.select(),className:`${j} tnum min-w-0 flex-1 break-all`}),(0,s.jsxs)("button",{type:"button",className:v,onClick:()=>void ex(),children:[(0,s.jsx)(Z,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Copy grant"]})]}),(0,s.jsx)("p",{className:"sr-only",role:"status",children:W}),W?(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:W}):null]}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"text-xs font-medium",children:"Run on the new machine"}),(0,s.jsx)("pre",{className:"mt-1.5 overflow-x-auto whitespace-pre-wrap break-all rounded-md bg-card-strong p-3 text-xs text-foreground",children:(0,s.jsx)("code",{children:em.command})}),(0,s.jsx)("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:(0,s.jsxs)("button",{type:"button",className:v,onClick:()=>void ep(),children:[(0,s.jsx)(Z,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Copy command"]})}),(0,s.jsx)("p",{className:"mt-2 text-xs text-muted-foreground",children:em.note})]})]}):null]})]})]})}var H=a(8731);let z=(0,R.A)("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);function _(e){let{api:t,csrfToken:a,machines:n,machinesPending:r,onSessionLost:i}=e,d=(0,l.useId)(),o=e=>`${d}-${e}`,[u,m]=(0,l.useState)(""),[h,x]=(0,l.useState)(""),[f,g]=(0,l.useState)(""),[b,v]=(0,l.useState)(!1),[w,N]=(0,l.useState)({}),[A,E]=(0,l.useState)(null),[R,M]=(0,l.useState)(!1),[D,L]=(0,l.useState)(""),P=(0,l.useRef)(null);(0,l.useEffect)(()=>{if(0===n.length){""!==u&&m("");return}if(n.some(e=>e.machineId===u))return;let e=n[0];m(e.machineId),x(e.displayName??""),g((e.tags??[]).join(", ")),v(!1)},[n,u]),(0,l.useEffect)(()=>{A&&P.current?.focus()},[A]);let q=n.find(e=>e.machineId===u),F=async e=>{let s,n,r;if(e.preventDefault(),!q||R)return;E(null);let l=(s=h.trim(),n={},s.length>128?n.displayName="Display name must be at most 128 characters.":U.test(s)&&(n.displayName="Display name cannot contain control characters."),null!==(r=function(e){let t=e.split(",").map(e=>e.trim()).filter(e=>e.length>0),a=[],s=new Set;for(let e of t){if(e.length>64)return{tags:a,error:"Each tag must be at most 64 characters."};if(U.test(e))return{tags:a,error:"Tags cannot contain control characters."};s.has(e)||(s.add(e),a.push(e))}return a.length>32?{tags:a,error:"Use at most 32 tags."}:{tags:a,error:null}}(f)).error&&(n.tags=r.error),{displayName:0===s.length?null:s,tags:r.tags,errors:n});if(N(l.errors),l.errors.displayName)return void document.getElementById(o("name"))?.focus();if(l.errors.tags)return void document.getElementById(o("tags"))?.focus();M(!0);try{await t.saveMachineMeta(q.machineId,{displayName:l.displayName,tags:l.tags},a),x(l.displayName??""),g(l.tags.join(", ")),v(!1),L(`Saved metadata for ${G(q)}. Fleet and machine views update from the live stream.`)}catch(e){if(T(e))return void i();E($(e)?"You do not have access to this machine, so its metadata cannot be changed.":I(e,"Could not save machine metadata."))}finally{M(!1)}};return(0,s.jsxs)(p.Z,{title:"Machine metadata",className:"min-w-0",children:[(0,s.jsx)("p",{role:"status",className:D?"mb-3 rounded-md bg-ok-soft px-3 py-2 text-xs text-foreground":"sr-only",children:D}),0===n.length?(0,s.jsx)(p.p,{icon:H.A,note:r?"Waiting for the live machine list…":"No machines are visible to your account."}):(0,s.jsxs)("form",{"aria-busy":R,className:"flex min-w-0 flex-col gap-4",onSubmit:e=>void F(e),children:[(0,s.jsx)(k,{id:o("machine"),label:"Machine",children:(0,s.jsx)("select",{id:o("machine"),value:u,onChange:e=>{var t;let a;return t=e.target.value,a=n.find(e=>e.machineId===t),void(m(t),x(a?.displayName??""),g((a?.tags??[]).join(", ")),v(!1),N({}),E(null),L(""))},className:j,children:n.map(e=>(0,s.jsx)("option",{value:e.machineId,children:G(e)},e.machineId))})}),(0,s.jsx)(k,{id:o("name"),label:"Display name",error:w.displayName,children:(0,s.jsx)("input",{id:o("name"),placeholder:q?.hostname||"Hostname",maxLength:128,value:h,onChange:e=>{x(e.target.value),v(!0)},"aria-invalid":!!w.displayName||void 0,"aria-describedby":C(o("name"),w.displayName),className:j})}),(0,s.jsx)(k,{id:o("tags"),label:"Tags (comma-separated)",error:w.tags,children:(0,s.jsx)("input",{id:o("tags"),value:f,onChange:e=>{g(e.target.value),v(!0)},"aria-invalid":!!w.tags||void 0,"aria-describedby":C(o("tags"),w.tags),className:j})}),A?(0,s.jsx)("div",{ref:P,tabIndex:-1,"aria-live":"assertive",children:(0,s.jsx)(S,{tone:"error",role:"alert",children:A})}):null,(0,s.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:(0,s.jsx)("button",{type:"submit",className:y,disabled:R||!b,children:R?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(c.A,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}),"Saving…"]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(z,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Save metadata"]})})})]})]})}var K=a(3612),J=a(5798),W=a(7241);function X(e){let{api:t,username:a,csrfToken:n,machines:r,machinesPending:d,onAuditChange:o,onSessionLost:m}=e,[h,x]=(0,l.useState)([]),[f,g]=(0,l.useState)(!0),[b,j]=(0,l.useState)(null),[k,C]=(0,l.useState)(""),[R,M]=(0,l.useState)(null),[D,U]=(0,l.useState)(null),[L,G]=(0,l.useState)(!1),[P,q]=(0,l.useState)(null),F=(0,l.useRef)(null),O=(0,l.useRef)(!0);(0,l.useEffect)(()=>(O.current=!0,()=>{O.current=!1,F.current?.abort()}),[]);let Y=(0,l.useCallback)(async()=>{F.current?.abort();let e=new AbortController;F.current=e,g(!0),j(null);try{let a=await t.listUsers(e.signal);e.signal.aborted||x(a)}catch(t){if(e.signal.aborted||E(t))return;if(T(t))return void m();j($(t)?"Administrator access is required. If your access just changed, sign in again.":I(t,"Could not load the browser user directory."))}finally{e.signal.aborted||g(!1)}},[t,m]);(0,l.useEffect)(()=>{Y()},[Y]);let Z=async()=>{if(D&&!L){G(!0),q(null);try{if(await t.deleteUser(D.username,n),!O.current)return;let e=D.username;U(null),C(`Deleted user ${e}. Any active sessions were ended.`),o(),await Y()}catch(e){if(!O.current)return;if(T(e))return void m();q($(e)?"Your account no longer has administrative access.":I(e,"Could not delete that user."))}finally{O.current&&G(!1)}}};return(0,s.jsxs)(p.Z,{title:"Browser users",className:"min-w-0",action:(0,s.jsxs)("button",{type:"button",className:y,"aria-expanded":R?.mode==="create",onClick:()=>{U(null),q(null),M(e=>e?.mode==="create"?null:{mode:"create"})},children:[(0,s.jsx)(K.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Add user"]}),children:[(0,s.jsx)("p",{role:"status",className:k?"rounded-md bg-ok-soft px-3 py-2 text-xs text-foreground":"sr-only",children:k}),(0,s.jsx)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,s.jsxs)("span",{className:"tnum text-xs text-muted-foreground",children:[h.length,"/",50]}),(0,s.jsxs)("button",{type:"button",className:w,onClick:()=>void Y(),disabled:f,children:[(0,s.jsx)(c.A,{className:`h-3.5 w-3.5 ${f?"animate-spin":""}`,"aria-hidden":!0}),"Refresh"]})]})}),R?(0,s.jsx)(Q,{api:t,csrfToken:n,existing:"edit"===R.mode?R.user:void 0,currentUsername:a,machines:r,machinesPending:d,onCancel:()=>M(null),onSaved:e=>{M(null),C(e),o(),Y()},onSessionLost:m},"edit"===R.mode?`edit-${R.user.username}`:"create"):null,(0,s.jsxs)("div",{className:"mt-4 flex min-w-0 flex-col gap-3",children:[b?(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,s.jsx)(S,{tone:"error",role:"alert",children:b}),(0,s.jsx)("button",{type:"button",className:v,onClick:()=>void Y(),children:"Try again"})]}):null,f&&0===h.length?(0,s.jsx)("p",{role:"status",className:"py-6 text-sm text-muted-foreground",children:"Loading browser users…"}):null,f||b||0!==h.length?null:(0,s.jsx)(p.p,{icon:i.A,note:"No browser users are stored yet."}),h.length>0?(0,s.jsx)("ul",{className:"divide-y divide-border border-t border-border",children:h.map(e=>{var t;let n=e.username===a,r=D?.username===e.username;return(0,s.jsxs)("li",{className:"min-w-0 py-3",children:[(0,s.jsxs)("div",{className:"flex min-w-0 flex-wrap items-start justify-between gap-x-4 gap-y-2",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,s.jsx)("span",{className:"break-words text-sm font-medium",children:e.username}),n?(0,s.jsx)(A,{tone:"accent",children:"You"}):null,e.admin?(0,s.jsxs)(A,{tone:"ok",children:[(0,s.jsx)(u.A,{className:"h-3 w-3","aria-hidden":!0}),"Administrator"]}):(0,s.jsx)(A,{children:"Viewer"}),e.disabled?(0,s.jsx)(A,{tone:"warn",children:"Disabled"}):null]}),(0,s.jsx)("p",{className:"mt-1 break-words text-xs text-muted-foreground",title:"*"===e.machineIds?"All machines":e.machineIds.join(", "),children:"*"===(t=e.machineIds)?"All machines":0===t.length?"No machines":1===t.length?t[0]:`${t.length} machines`})]}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-1",children:[(0,s.jsxs)("button",{type:"button",className:w,"aria-expanded":R?.mode==="edit"&&R.user.username===e.username,onClick:()=>{q(null),U(null),M(R?.mode==="edit"&&R.user.username===e.username?null:{mode:"edit",user:e})},children:[(0,s.jsx)(J.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),R?.mode==="edit"&&R.user.username===e.username?"Close editor":"Edit"]}),(0,s.jsxs)("button",{type:"button",className:w,"aria-expanded":r,onClick:()=>{M(null),q(null),U(r?null:e)},children:[(0,s.jsx)(W.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Delete"]})]})]}),r?(0,s.jsxs)("div",{role:"alert",className:"mt-2 flex flex-wrap items-center gap-x-3 gap-y-2 rounded-md bg-crit-soft px-3 py-2",children:[(0,s.jsxs)("p",{className:"min-w-0 flex-1 text-xs text-foreground",children:["Delete ",(0,s.jsx)("strong",{className:"font-medium",children:e.username}),"? Their active sessions end immediately, and this cannot be undone."]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[(0,s.jsx)("button",{type:"button",className:N,onClick:()=>void Z(),disabled:L,children:L?"Deleting…":"Delete user"}),(0,s.jsx)("button",{type:"button",className:v,onClick:()=>U(null),disabled:L,children:"Cancel"})]})]}):null,r&&P?(0,s.jsx)("p",{role:"alert",className:"mt-2 text-xs text-crit",children:P}):null]},e.username)})}):null]})]})}function Q(e){let{api:t,csrfToken:a,existing:n,currentUsername:r,machines:i,machinesPending:d,onCancel:c,onSaved:o,onSessionLost:u}=e,m=(0,l.useId)(),h=e=>`${m}-${e}`,x=h("heading"),[p,f]=(0,l.useState)(n?.username??""),[g,b]=(0,l.useState)(""),[N,A]=(0,l.useState)(!!n&&"*"===n.machineIds),[E,R]=(0,l.useState)(n&&"*"!==n.machineIds?[...n.machineIds]:[]),[M,U]=(0,l.useState)(n?.admin??!1),[L,P]=(0,l.useState)(n?.disabled??!1),[q,F]=(0,l.useState)({}),[Z,V]=(0,l.useState)(null),[B,H]=(0,l.useState)(!1),z=(0,l.useRef)(null),_=(0,l.useRef)(!1);(0,l.useEffect)(()=>{_.current||(_.current=!0,document.getElementById(x)?.focus())},[x]),(0,l.useEffect)(()=>{Z&&z.current?.focus()},[Z]);let K=[...i].sort((e,t)=>{let a=G(e).toLocaleLowerCase(),s=G(t).toLocaleLowerCase();return a.localeCompare(s)||e.machineId.localeCompare(t.machineId)}),J=function(e,t){if("*"===e)return[];let a=new Set(t);return e.filter(e=>!a.has(e))}(E,K.map(e=>e.machineId)),W=N?"*":E,X=n?.username===r,Q=async e=>{if(e.preventDefault(),B)return;V(null);let s={username:n?.username??p,password:g,machineIds:W,admin:M,disabled:L},r=function(e,t){let a={};if(D.test(e.username)||(a.username="Use 1–128 printable characters without spaces."),t.existing||0!==e.password.length?e.password.length>1024&&(a.password="Password must be at most 1024 characters."):a.password="Choose a password for the new user.","*"===e.machineIds);else if(Array.isArray(e.machineIds)){let t=new Set,s=2;for(let n of e.machineIds){if(!D.test(n)){a.scope="Every machine ID must be a valid identifier.";break}if((s+=n.length+3)>8192){a.scope="Keep the explicit machine list under 8192 bytes.";break}if(t.has(n)){a.scope="Machine scope contains a duplicate ID.";break}t.add(n)}}else a.scope="Choose all machines or an explicit list of machine IDs.";let s=a.username?"username":a.password?"password":a.scope?"scope":null;return{errors:a,firstInvalid:s}}(s,{existing:void 0!==n});if(F(r.errors),null!==r.firstInvalid){let e="username"===r.firstInvalid?h("username"):"password"===r.firstInvalid?h("password"):h("scope-all");document.getElementById(e)?.focus();return}H(!0);try{await t.saveUser({username:s.username,machineIds:s.machineIds,admin:M,disabled:L,...g.length>0?{password:g}:{}},a),b(""),o(n?`Updated ${n.username}.`:`Created ${s.username}. They can sign in with the password you set.`)}catch(e){if(T(e))return void u();V($(e)?"Your account no longer has administrative access.":I(e,"Could not save that user."))}finally{H(!1)}};return(0,s.jsxs)("form",{"aria-labelledby":x,"aria-busy":B,className:"flex min-w-0 flex-col gap-4 border-t border-border py-4",onSubmit:e=>void Q(e),children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[(0,s.jsx)("div",{children:(0,s.jsx)("h3",{id:x,tabIndex:-1,className:"text-sm font-medium tracking-tight",children:n?`Edit ${n.username}`:"Add a browser user"})}),(0,s.jsx)("button",{type:"button",className:w,onClick:c,disabled:B,children:"Close"})]}),X?(0,s.jsx)(S,{tone:"warn",role:"status",children:(0,s.jsxs)("span",{className:"flex items-start gap-2",children:[(0,s.jsx)(Y.A,{className:"mt-0.5 h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,s.jsx)("span",{children:"Account changes may sign you out."})]})}):null,Z?(0,s.jsx)("div",{ref:z,tabIndex:-1,"aria-live":"assertive",children:(0,s.jsx)(S,{tone:"error",role:"alert",children:Z})}):null,(0,s.jsxs)("div",{className:"grid min-w-0 gap-4 sm:grid-cols-2",children:[n?(0,s.jsxs)("div",{className:"flex min-w-0 flex-col gap-1.5",children:[(0,s.jsx)("span",{className:"text-xs font-medium text-foreground",children:"Username"}),(0,s.jsx)("p",{className:"tnum break-words rounded-md border border-border bg-card-strong px-3 py-2 text-sm",children:n.username})]}):(0,s.jsx)(k,{id:h("username"),label:"Username",error:q.username,children:(0,s.jsx)("input",{id:h("username"),name:"username",autoComplete:"username",value:p,onChange:e=>f(e.target.value),"aria-invalid":!!q.username||void 0,"aria-describedby":C(h("username"),q.username),className:j})}),(0,s.jsx)(k,{id:h("password"),label:n?"New password (optional)":"Password",error:q.password,children:(0,s.jsx)("input",{id:h("password"),name:"new-password",type:"password",autoComplete:"new-password",value:g,onChange:e=>b(e.target.value),"aria-invalid":!!q.password||void 0,"aria-describedby":C(h("password"),q.password),className:j})})]}),(0,s.jsxs)("fieldset",{className:"flex min-w-0 flex-col gap-2","aria-invalid":!!q.scope||void 0,"aria-describedby":q.scope?h("scope-error"):void 0,children:[(0,s.jsx)("legend",{className:"text-xs font-medium text-foreground",children:"Machine access"}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-x-5 gap-y-2",children:[(0,s.jsxs)("label",{className:"flex items-center gap-2 text-xs text-foreground",children:[(0,s.jsx)("input",{id:h("scope-all"),type:"radio",name:h("scope"),checked:N,onChange:()=>A(!0)}),"All machines"]}),(0,s.jsxs)("label",{className:"flex items-center gap-2 text-xs text-foreground",children:[(0,s.jsx)("input",{id:h("scope-selected"),type:"radio",name:h("scope"),checked:!N,onChange:()=>A(!1)}),"Selected machines"]})]}),N?null:(0,s.jsxs)("div",{className:"flex min-w-0 flex-col gap-2 border-t border-border pt-2",children:[0===K.length?(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:d?"Waiting for machines…":"No machines available."}):(0,s.jsx)("div",{className:"max-h-56 overflow-y-auto pr-1",children:(0,s.jsx)("ul",{className:"flex flex-col gap-1.5",children:K.map(e=>(0,s.jsxs)("li",{className:"flex items-start gap-2",children:[(0,s.jsx)("input",{id:h(`machine-${e.machineId}`),type:"checkbox",className:"mt-0.5",checked:E.includes(e.machineId),onChange:()=>R(t=>{var a;return a=e.machineId,t.includes(a)?t.filter(e=>e!==a):[...t,a]})}),(0,s.jsxs)("label",{htmlFor:h(`machine-${e.machineId}`),className:"min-w-0 text-xs text-foreground",children:[(0,s.jsx)("span",{className:"block break-words",children:G(e)}),(0,s.jsx)("span",{className:"tnum block break-all text-muted-foreground",children:e.machineId})]})]},e.machineId))})}),J.length>0?(0,s.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Other saved machines"}),(0,s.jsx)("ul",{className:"flex flex-wrap gap-1.5",children:J.map(e=>(0,s.jsxs)("li",{className:"flex items-center gap-1.5 rounded-full border border-border px-2 py-0.5 text-xs",children:[(0,s.jsx)("span",{className:"tnum break-all",children:e}),(0,s.jsx)("button",{type:"button",className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-muted-foreground hover:bg-card-strong hover:text-foreground",onClick:()=>R(t=>t.filter(t=>t!==e)),"aria-label":`Remove ${e} from the machine scope`,children:(0,s.jsx)(O.A,{className:"h-3 w-3","aria-hidden":!0})})]},e))})]}):null]}),q.scope?(0,s.jsx)("p",{id:h("scope-error"),className:"text-xs text-crit",children:q.scope}):null]}),(0,s.jsxs)("div",{className:"flex flex-col gap-2 border-t border-border pt-3",children:[(0,s.jsxs)("label",{className:"flex items-start gap-2 text-xs text-foreground",children:[(0,s.jsx)("input",{type:"checkbox",className:"mt-0.5",checked:M,onChange:e=>U(e.target.checked)}),(0,s.jsxs)("span",{children:["Administrator",(0,s.jsx)("span",{className:"block text-muted-foreground",children:"Explicit administrative access. A wildcard machine scope alone never grants it."})]})]}),(0,s.jsxs)("label",{className:"flex items-start gap-2 text-xs text-foreground",children:[(0,s.jsx)("input",{type:"checkbox",className:"mt-0.5",checked:L,onChange:e=>P(e.target.checked)}),(0,s.jsxs)("span",{children:["Disabled",(0,s.jsx)("span",{className:"block text-muted-foreground",children:"Blocks sign-in and ends active sessions. The account is kept for a later re-enable."})]})]})]}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsx)("button",{type:"submit",className:y,disabled:B,children:B?"Saving…":n?"Save changes":"Create user"}),(0,s.jsx)("button",{type:"button",className:v,onClick:c,disabled:B,children:"Cancel"})]})]})}function ee(){let{session:e,machines:t,phase:a,retryConnection:n}=(0,b.M)(),j=(0,l.useMemo)(()=>(function(e={}){let t=e.fetchImpl??fetch;async function a(e,s={}){let n={Accept:"application/json"};void 0!==s.body&&(n["Content-Type"]="application/json"),void 0!==s.csrfToken&&(n["X-CSRF-Token"]=s.csrfToken);let r=await t(e,{method:s.method??"GET",headers:n,body:void 0===s.body?void 0:JSON.stringify(s.body),signal:s.signal,cache:"no-store",credentials:"same-origin",redirect:"error"}),l=await r.text(),i=null;if(l.length>0)try{i=JSON.parse(l)}catch{i=null}if(!r.ok)throw new m(r.status,function(e,t){if(null!==t&&"object"==typeof t){let e=t.error;if("string"==typeof e&&e.length>0&&e.length<=256)return e}return 400===e?"The request was not valid.":401===e?"Your session ended. Sign in again.":403===e?"Administrative access is required.":404===e?"That record no longer exists.":409===e?"That change conflicts with the current directory.":413===e?"The request was too large.":503===e?"Administration is temporarily unavailable.":"The hub could not complete that request."}(r.status,i));return i}return{async listUsers(e){let t=await a("/api/admin/users",{signal:e});if(!Array.isArray(t?.users))throw h();return t.users},async saveUser(e,t,s){await a("/api/admin/users",{method:"POST",body:e,csrfToken:t,signal:s})},async deleteUser(e,t,s){await a(`/api/admin/users?username=${encodeURIComponent(e)}`,{method:"DELETE",csrfToken:t,signal:s})},async listAudit(e=50,t){let s=Number.isSafeInteger(e)?Math.min(Math.max(e,1),1e3):50,n=await a(`/api/admin/audit?limit=${s}`,{signal:t});if(!Array.isArray(n?.events))throw h();return n.events},async listCollectors(e){let t=await a("/api/admin/collectors",{signal:e});if(!Array.isArray(t?.collectors))throw h();return t.collectors},async revokeCollector(e,t,s){await a("/api/admin/collectors",{method:"POST",body:{action:"revoke",collectorId:e},csrfToken:t,signal:s})},async createGrant(e,t,s){let n=await a("/api/admin/collector-grants",{method:"POST",body:e,csrfToken:t,signal:s});if("string"!=typeof n?.token||"string"!=typeof n.expiresAt)throw h();return{token:n.token,expiresAt:n.expiresAt}},async saveMachineMeta(e,t,s,n){await a(`/api/machines/meta?machineId=${encodeURIComponent(e)}`,{method:"POST",body:t,csrfToken:s,signal:n})}}})(),[]),[w,N]=(0,l.useState)(!1),[k,C]=(0,l.useState)(0),A="signed-in"===e.kind?`${e.user.username}:${e.user.csrfToken}`:e.kind;(0,l.useEffect)(()=>{N(!1)},[A]);let S=(0,l.useCallback)(()=>N(!0),[]),I=(0,l.useCallback)(()=>C(e=>e+1),[]),T=(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(f.$E,{}),(0,s.jsx)(g.B,{})]});if("restoring"===e.kind)return(0,s.jsx)(x.G,{title:"Administration",headerRight:T,children:(0,s.jsx)(p.Z,{title:"Checking session",className:"mx-auto my-12 max-w-md",children:(0,s.jsx)(p.p,{icon:i.A,note:"Checking your session…"})})});if("restore-failed"===e.kind)return(0,s.jsx)(x.G,{title:"Administration",headerRight:T,children:(0,s.jsxs)(p.Z,{title:"Hub unreachable",className:"mx-auto my-12 max-w-md",children:[(0,s.jsx)(p.p,{icon:d.A,note:"The hub is unreachable right now."}),(0,s.jsx)("div",{className:"flex justify-center",children:(0,s.jsxs)("button",{type:"button",className:v,onClick:n,children:[(0,s.jsx)(c.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Try again"]})})]})});if("signed-out"===e.kind)return(0,s.jsx)(x.G,{title:"Administration",headerRight:T,children:(0,s.jsxs)(p.Z,{title:"expired"===a?"Session ended":"Sign in required",className:"mx-auto my-12 max-w-md",children:[(0,s.jsx)(p.p,{icon:i.A,note:"expired"===a?"Your session ended.":"Sign in required."}),(0,s.jsx)("div",{className:"flex justify-center",children:(0,s.jsx)(r(),{href:"/login",className:y,children:"Sign in"})})]})});if("auth-unavailable"===e.kind)return(0,s.jsx)(x.G,{title:"Administration",headerRight:T,children:(0,s.jsx)(p.Z,{title:"Sign-in unavailable",className:"mx-auto my-12 max-w-md",children:(0,s.jsx)(p.p,{icon:o.A,note:"Browser sign-in is not configured on this hub."})})});if("expired"===a)return(0,s.jsx)(x.G,{title:"Administration",headerRight:T,children:(0,s.jsxs)(p.Z,{title:"Session ended",className:"mx-auto my-12 max-w-md",children:[(0,s.jsx)(p.p,{icon:o.A,note:"Your session ended."}),(0,s.jsx)("div",{className:"flex justify-center",children:(0,s.jsx)(r(),{href:"/login",className:y,children:"Sign in"})})]})});if(!0!==e.user.admin)return(0,s.jsx)(x.G,{title:"Administration",headerRight:T,children:(0,s.jsxs)(p.Z,{title:"Administrator access required",className:"mx-auto my-12 max-w-lg",children:[(0,s.jsx)(p.p,{icon:o.A,note:`You are signed in as ${e.user.username}, but this account is not an administrator.`}),(0,s.jsx)("div",{className:"flex justify-center",children:(0,s.jsx)(r(),{href:"/",className:v,children:"Back to fleet"})})]})});if(w)return(0,s.jsx)(x.G,{title:"Administration",headerRight:T,children:(0,s.jsxs)(p.Z,{title:"Session ended",className:"mx-auto my-12 max-w-lg",children:[(0,s.jsx)(p.p,{icon:o.A,note:"Your administrative session is no longer valid."}),(0,s.jsx)("div",{className:"flex justify-center",children:(0,s.jsx)(r(),{href:"/login",className:y,children:"Sign in again"})})]})});let $=t.map(e=>({machineId:e.machineId,hostname:e.hostname,displayName:e.displayName,tags:e.tags})),E="connecting"===a||"idle"===a;return(0,s.jsx)(x.G,{title:"Administration",headerRight:T,children:(0,s.jsxs)("div",{className:"flex min-w-0 flex-col gap-5",children:[(0,s.jsx)("div",{className:"flex flex-wrap items-start justify-between gap-x-6 gap-y-3",children:(0,s.jsxs)("span",{className:"inline-flex min-w-0 max-w-full flex-wrap items-center gap-1.5 rounded-full bg-selected px-3 py-1 text-xs font-medium text-foreground",children:[(0,s.jsx)(u.A,{className:"h-3.5 w-3.5 shrink-0 text-accent","aria-hidden":!0}),(0,s.jsxs)("span",{className:"min-w-0 break-all",children:["Administrator \xb7 ",e.user.username]})]})}),(0,s.jsxs)("div",{className:"grid min-w-0 gap-5 xl:grid-cols-12",children:[(0,s.jsx)("div",{className:"min-w-0 xl:col-span-7",children:(0,s.jsx)(X,{api:j,username:e.user.username,csrfToken:e.user.csrfToken,machines:$,machinesPending:E,onAuditChange:I,onSessionLost:S})}),(0,s.jsx)("div",{className:"min-w-0 xl:col-span-5",children:(0,s.jsx)(_,{api:j,csrfToken:e.user.csrfToken,machines:$,machinesPending:E,onSessionLost:S})}),(0,s.jsx)("div",{id:"collectors",className:"min-w-0 scroll-mt-6 xl:col-span-12",children:(0,s.jsx)(B,{api:j,csrfToken:e.user.csrfToken,sessionKey:A,machines:$,onAuditChange:I,onSessionLost:S})}),(0,s.jsx)("div",{className:"min-w-0 xl:col-span-12",children:(0,s.jsx)(P,{api:j,revision:k,onSessionLost:S})})]})]})})}},7241:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(8698).A)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])}},e=>{e.O(0,[157,939,103,441,794,358],()=>e(e.s=4891)),_N_E=e.O()}]);
@@ -1,3 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[429],{1:(e,t,s)=>{"use strict";s.d(t,{PE:()=>o,UR:()=>d,kg:()=>l,uW:()=>c});let r=/^[\u0009\u000a\u000d ]*[=+\-@]/,n=/^[\u0009\u000a\u000d]/;function i(e){if(null==e)return"";if("number"==typeof e)return Number.isFinite(e)?String(e):"";if("boolean"==typeof e)return e?"true":"false";let t=0===e.length?e:r.test(e)||n.test(e)?`'${e}`:e;return/[",\t\r\n]/.test(t)?`"${t.replace(/"/g,'""')}"`:t}function a(e){return e.map(i).join(",")}function l(e){return`${e.map(a).join("\r\n")}\r
2
- `}function o(e,t,s){if("u"<typeof document)return;let r=new Blob([t],{type:s}),n=URL.createObjectURL(r),i=document.createElement("a");i.href=n,i.download=e,i.rel="noopener",i.style.display="none",document.body.append(i),i.click(),i.remove(),globalThis.setTimeout(()=>URL.revokeObjectURL(n),0)}let d="text/csv;charset=utf-8",c="application/json;charset=utf-8"},438:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(8698).A)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])},2910:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(8698).A)("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]])},2939:(e,t,s)=>{"use strict";s.d(t,{HistoryView:()=>eI});var r=s(5155),n=s(8500),i=s.n(n),a=s(2115),l=s(7422),o=s(3896),d=s(1735),c=s(7029),u=s(828),m=s(4173),h=s(3440),p=s(940),x=s(802),g=s(6582),f=s(9939),b=s(8664),y=s(4567),j=s(592);let v=j.U8,N=/^core:(\d+)$/;function w(e){let t=N.exec(e);if(null===t)return null;let s=Number(t[1]);return!Number.isSafeInteger(s)||s<0||s>=j.U8?null:s}function k(e){return[...new Set(e)].sort((e,t)=>(w(e)??0)-(w(t)??0))}function M(e,t=[]){var s;let r=e?.metrics?.payload.cpu,n=new Set(!Number.isFinite(s=Math.max(e?.inventory?.cpu.logicalCores??0,r?.status==="ok"?r.perCore.length:0))?[]:Array.from({length:Math.min(j.U8,Math.max(0,Math.floor(s)))},(e,t)=>`core:${t}`));for(let e of t)"cpu.core"===e.metric&&null!==w(e.resourceId)&&n.add(e.resourceId);return k([...n])}function $(e,t){let s=new Set(t);if(null===e)return k(t).slice(0,v);let r=[];for(let t of e)if(s.has(t)&&null!==w(t)&&(r.push(t),r.length>=v))break;return k(r)}function A(e){let t=w(e);return null===t?e:`Core ${t}`}var I=s(7726);function C(e){if("string"!=typeof e||0===e.length)return null;let t=Date.parse(e);return Number.isFinite(t)?t:null}var S=s(5078),R=s(2910),P=s(9942),U=s(8698);let L=(0,U.A)("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),_=(0,U.A)("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);var B=s(6114);let T=Object.freeze([]),z=new Set(y.H9.map(e=>e.metric)),E=e=>"boolean"==typeof e?e:null,D=e=>Array.isArray(e)&&e.every(e=>"string"==typeof e)?e.slice(0,1e3):null,F=e=>S.pI.some(t=>t.id===e)?e:null,O=e=>"string"==typeof e&&(""===e||e.split(",").every(e=>z.has(e)))?e:null,H=/^core:\d+$/,Z=e=>Array.isArray(e)&&e.every(e=>"string"==typeof e&&H.test(e))?[...new Set(e)].slice(0,j.U8):null;function G(e,t){return(0,B.u)(`history.hidden.${t}.${e}`,T,D)}function q(e){return(0,B.u)(`history.cores.${e}`,null,Z)}let V=e=>"bytes"===e||"percent"===e?e:null;function W(e,t){return(0,B.u)(`history.units.${t}.${e}`,"bytes",V)}let K="peer-focus-visible:outline peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2 peer-focus-visible:[outline-color:var(--focus)]";function Y({label:e,action:t}){return(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-2.5",children:[(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:e}),(0,r.jsx)("span",{"aria-hidden":!0,className:"h-px min-w-0 flex-1 bg-border"}),t]})}let J="inline-flex min-h-8 items-center gap-1.5 rounded-md border border-transparent px-2.5 text-xs transition-colors",Q=`${J} ${K} bg-selected text-foreground`,X=`${J} ${K} bg-card-strong text-muted-foreground hover:text-foreground`;function ee(e){let{machine:t,range:s,selectedMetrics:n,catalog:i,catalogError:a,gpuCards:l,hiddenCards:o,autoRefresh:d,loading:c,manualRefreshing:m,statusText:h,onRangeChange:p,onToggleMetric:x,onSetMetrics:g,onToggleCard:f,onToggleAutoRefresh:b,onRefresh:j}=e,[v,N]=(0,B.u)("history.controlsOpen",!1,E,"session"),w=new Set(n),k=y.H9.filter(({metric:e})=>(0,y.yv)(t,e).available&&(null===i||void 0!==i[e])).map(({metric:e})=>e),I=new Set(k),C=(e,t)=>{let s=new Set(n);for(let r of e)t&&I.has(r)?s.add(r):t||s.delete(r);g([...s])},U=n.some(e=>e.startsWith("gpu.")),T=w.has("cpu.core"),[z,D]=q(t?.machineId??""),F=T?M(t):[],O=$(z,F),H=new Set(O);return(0,r.jsxs)("section",{"aria-labelledby":"history-query-heading","aria-busy":c,className:"mb-5 min-w-0 rounded-xl border border-border bg-card",children:[(0,r.jsx)("h2",{id:"history-query-heading",className:"sr-only",children:"History query"}),(0,r.jsxs)("div",{className:"flex flex-wrap items-end gap-x-5 gap-y-4 p-4 md:p-5",children:[(0,r.jsxs)("fieldset",{className:"flex min-w-0 flex-col gap-1.5",children:[(0,r.jsx)("legend",{className:"mb-1.5 text-xs text-muted-foreground",children:"Time range"}),(0,r.jsx)("div",{className:"inline-flex flex-wrap rounded-lg border border-border bg-background p-0.5",children:S.pI.map(e=>{let t=s===e.id;return(0,r.jsxs)("label",{className:"cursor-pointer",children:[(0,r.jsx)("input",{type:"radio",name:"history-range",value:e.id,checked:t,onChange:()=>p(e.id),className:"peer sr-only"}),(0,r.jsxs)("span",{className:`inline-flex min-h-8 items-center rounded-md px-2.5 text-xs transition-colors ${K} ${t?"bg-selected font-medium text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[e.shortLabel,(0,r.jsxs)("span",{className:"sr-only",children:[" — ",e.label]})]})]},e.id)})})]}),(0,r.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2 sm:ml-auto",children:[(0,r.jsx)("p",{className:"order-first w-full text-xs text-muted-foreground sm:order-none sm:w-auto",children:h}),(0,r.jsxs)("button",{type:"button",onClick:j,disabled:m,className:"inline-flex min-h-8 items-center gap-1.5 rounded-md border border-border bg-background px-2.5 text-xs text-foreground transition-colors hover:bg-card-strong disabled:opacity-60",children:[(0,r.jsx)(u.A,{className:`h-3.5 w-3.5 ${m?"animate-spin":""}`,"aria-hidden":!0}),"Refresh"]}),(0,r.jsxs)("button",{type:"button",onClick:b,"aria-pressed":d,className:`inline-flex min-h-8 items-center gap-1.5 rounded-md border px-2.5 text-xs transition-colors ${d?"border-accent/40 bg-selected text-foreground":"border-border bg-background text-muted-foreground hover:bg-card-strong hover:text-foreground"}`,children:[d?(0,r.jsx)(R.A,{className:"h-3.5 w-3.5","aria-hidden":!0}):(0,r.jsx)(P.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),d?"Pause":"Resume"]})]})]}),(0,r.jsxs)("div",{className:"border-t border-border px-4 py-4 md:px-5",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,r.jsxs)("button",{type:"button","aria-expanded":v,"aria-controls":"history-metric-options",onClick:()=>N(!v),className:"inline-flex min-h-8 items-center gap-1.5 rounded-md text-sm font-medium",children:["Metrics ",(0,r.jsxs)("span",{className:"tnum text-xs font-normal text-muted-foreground",children:[w.size," selected"]}),(0,r.jsx)(L,{"aria-hidden":!0,className:`h-3.5 w-3.5 text-muted-foreground transition-transform ${v?"rotate-180":""}`})]}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,r.jsx)("button",{type:"button",onClick:()=>C(k,!0),disabled:k.every(e=>w.has(e)),className:"inline-flex min-h-8 items-center rounded-md border border-border bg-background px-2.5 text-xs text-foreground transition-colors hover:bg-card-strong disabled:opacity-50",children:"Select all"}),(0,r.jsx)("button",{type:"button",onClick:()=>g([]),disabled:0===w.size,className:"inline-flex min-h-8 items-center rounded-md border border-border bg-background px-2.5 text-xs text-foreground transition-colors hover:bg-card-strong disabled:opacity-50",children:"Unselect all"})]})]}),(0,r.jsx)("div",{id:"history-metric-options",hidden:!v,children:(0,r.jsxs)("div",{className:"mt-4 min-w-0 md:col-span-2",children:[(0,r.jsx)("div",{className:"min-w-0",children:(0,r.jsx)("div",{className:"grid gap-x-6 gap-y-5 md:grid-cols-2 xl:grid-cols-3",children:y.P$.map(e=>(0,r.jsxs)("fieldset",{className:`min-w-0 ${"disk"===e.id?"xl:col-span-2":""}`,children:[(0,r.jsx)("legend",{className:"sr-only",children:e.label}),(0,r.jsx)(Y,{label:e.label,action:(0,r.jsxs)("div",{className:"flex shrink-0 gap-2",children:[(0,r.jsx)("button",{type:"button","aria-label":`Select all ${e.label} metrics`,onClick:()=>C(e.metrics,!0),disabled:e.metrics.filter(e=>I.has(e)).every(e=>w.has(e)),className:"min-h-6 rounded-sm text-xs text-muted-foreground hover:text-foreground hover:underline disabled:opacity-50",children:"All"}),(0,r.jsx)("button",{type:"button","aria-label":`Unselect all ${e.label} metrics`,onClick:()=>C(e.metrics,!1),disabled:!e.metrics.some(e=>w.has(e)),className:"min-h-6 rounded-sm text-xs text-muted-foreground hover:text-foreground hover:underline disabled:opacity-50",children:"None"})]})}),(0,r.jsx)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:e.metrics.map(e=>{var s;let n=(0,y.oB)(e);if(null===n)return null;let a=(0,y.yv)(t,e),l=null===i||void 0!==i[e],o=a.available&&l,d=w.has(e),c=(0,y.Lf)(n,0);return(0,r.jsxs)("label",{className:o?"cursor-pointer":"cursor-not-allowed",title:a.available?l?n.description:"This hub does not record this metric.":a.reason??void 0,children:[(0,r.jsx)("input",{type:"checkbox",checked:d,onChange:()=>x(e),disabled:!o&&!d,className:"peer sr-only","aria-label":n.label}),(0,r.jsxs)("span",{className:`${!o?d?`${J} ${K} bg-card-strong text-muted-foreground line-through`:`${J} text-muted-foreground opacity-50`:d?Q:X}`,children:[(0,r.jsx)("span",{"aria-hidden":!0,className:"flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded-sm border border-current",style:{color:c.color},children:d?(0,r.jsx)(_,{className:"h-3 w-3",strokeWidth:3}):null}),(s=n.label,({"cpu.usage":"Usage","cpu.core":"Per-core","cpu.iowait":"I/O wait","cpu.pressure":"Pressure","cpu.temperature":"Temperature","cpu.power":"Package power","memory.used":"Used bytes","memory.usage":"Usage %","swap.used":"Swap","memory.pressure.some":"Pressure (some)","memory.pressure.full":"Pressure (full)","gpu.utilization":"Utilization","gpu.memory.used":"VRAM","gpu.temperature":"Temperature","gpu.power":"Power","fs.used":"Space used","fs.usage":"Capacity %","fs.inodes.usage":"Inodes %","net.rx":"Received","net.tx":"Sent"})[e]??s)]})]},e)})}),"gpu"===e.id&&U&&l.length>0?(0,r.jsxs)("fieldset",{className:"mt-4 border-t border-border pt-3",children:[(0,r.jsx)("legend",{className:"sr-only",children:"GPU cards"}),(0,r.jsx)(Y,{label:"GPU cards"}),(0,r.jsx)("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:l.map((e,t)=>{let s=e.id,n=!o.has(s);return(0,r.jsxs)("label",{className:"cursor-pointer",children:[(0,r.jsx)("input",{type:"checkbox",checked:n,onChange:()=>f(s),className:"peer sr-only"}),(0,r.jsxs)("span",{className:n?Q:X,children:[(0,r.jsx)("span",{className:"tnum text-xs text-muted-foreground",children:t+1}),e.label]})]},e.id)})})]}):null,"cpu"===e.id&&T?(0,r.jsxs)("fieldset",{className:"mt-4 border-t border-border pt-3",children:[(0,r.jsx)("legend",{className:"sr-only",children:"CPU cores"}),(0,r.jsx)(Y,{label:`CPU cores \xb7 ${O.length} / ${F.length}`,action:(0,r.jsxs)("div",{className:"flex shrink-0 gap-2",children:[(0,r.jsx)("button",{type:"button",onClick:()=>D(null),disabled:O.length===F.length,className:"min-h-6 rounded-sm text-xs text-muted-foreground hover:text-foreground disabled:opacity-50",children:"All cores"}),(0,r.jsx)("button",{type:"button",onClick:()=>D([]),disabled:0===O.length,"aria-label":"Unselect all CPU cores",className:"min-h-6 rounded-sm text-xs text-muted-foreground hover:text-foreground disabled:opacity-50",children:"None"})]})}),0===F.length?(0,r.jsx)("p",{className:"mt-2 text-xs text-muted-foreground",children:"Core count unavailable."}):(0,r.jsxs)("details",{className:"mt-2",children:[(0,r.jsxs)("summary",{className:"inline-flex min-h-8 cursor-pointer items-center gap-1 rounded-md text-xs text-muted-foreground hover:text-foreground",children:["Choose cores ",(0,r.jsx)(L,{className:"h-3.5 w-3.5","aria-hidden":!0})]}),(0,r.jsx)("div",{className:"mt-2 grid max-h-48 grid-cols-3 gap-1.5 overflow-y-auto p-1",children:F.map(e=>{let t=H.has(e);return(0,r.jsxs)("label",{className:"min-w-0 cursor-pointer",children:[(0,r.jsx)("input",{type:"checkbox",checked:t,onChange:()=>{var s;return s=!t,void D(t=>{let r=$(t,F);return s?r.includes(e)?t:[...r,e]:r.filter(t=>t!==e)})},className:"peer sr-only"}),(0,r.jsxs)("span",{className:`${t?Q:X} w-full px-1.5`,children:[(0,r.jsx)("span",{"aria-hidden":!0,className:"flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded-sm border border-current",children:t?(0,r.jsx)(_,{className:"h-3 w-3"}):null}),A(e)]})]},e)})})]})]}):null]},e.id))})}),a?(0,r.jsx)("p",{className:"mt-2 text-xs text-muted-foreground",children:a}):null]})})]})]})}var et=s(9429),es=s(7284),er=s(6304),en=s(4150);let ei="grid grid-cols-[3rem_minmax(0,1fr)_4.5rem] items-center gap-2 sm:grid-cols-[3.5rem_minmax(0,1fr)_4.5rem_3rem]";function ea({title:e,series:t,fromMs:s,toMs:n,stepMs:i,gaps:l,hiddenKeys:o,onToggleSeries:d}){let[c,u]=(0,a.useState)(!1),m=(0,a.useMemo)(()=>t.filter(e=>!o.has(e.key)),[t,o]),h=(0,en.Au)({series:m,fromMs:s,toMs:n,stepMs:i,gaps:l}),p=(0,a.useMemo)(()=>{let e=t.map(e=>{let t=Array(10).fill("");return(function(e,t,s,r=120){let n=Array(r).fill(null),i=Math.max(1,s-t);for(let a of e){if(a.t<t||a.t>s)continue;let e=a.max??a.avg;if(null===e||!Number.isFinite(e))continue;let l=Math.min(r-1,Math.floor((a.t-t)/i*r));n[l]=Math.max(n[l]??0,Math.min(100,Math.max(0,e)))}return n})(e.points,s,n,120).forEach((e,s)=>{if(null===e)return;let r=Math.min(9,Math.floor(e/10));t[r]+=`M${s},1h1v16h-1z`}),{...e,stats:(0,I.T6)(e.points),paths:t}});return c&&e.sort((e,t)=>(t.stats.max??-1)-(e.stats.max??-1)),e},[t,s,n,c]),x=p.filter(e=>!o.has(e.key)).reduce((e,t)=>null!==t.stats.max&&(e?.stats.max===null||null===e||t.stats.max>e.stats.max)?t:e,null),g=null===h.timeMs?null:(0,S.r6)(h.timeMs),f=Math.max(1,n-s),b=(0,I.$z)(l,s,n);return(0,r.jsxs)("figure",{className:"min-w-0 lg:col-span-full",onPointerLeave:h.clear,children:[(0,r.jsxs)("div",{className:"mb-3 flex flex-wrap items-center justify-between gap-2",children:[(0,r.jsx)("h3",{className:"text-xs font-medium text-foreground",children:e}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-3 text-xs",children:[x?(0,r.jsxs)("span",{className:"tnum text-muted-foreground",children:["Peak \xb7 ",x.label," ",(0,r.jsx)("span",{className:"text-foreground",children:(0,S.dd)(x.stats.max,"percent")})]}):null,(0,r.jsx)("button",{type:"button","aria-pressed":c,onClick:()=>u(!c),className:`min-h-8 rounded-md border border-border px-2 ${c?"bg-selected text-foreground":"bg-background text-muted-foreground hover:text-foreground"}`,children:"Busiest first"})]})]}),(0,r.jsxs)("div",{className:`${ei} mb-1 min-h-4 whitespace-nowrap text-xs leading-4 text-muted-foreground`,"aria-hidden":!0,children:[(0,r.jsx)("span",{children:"Core"}),(0,r.jsx)("span",{className:"truncate",children:null!==g?(0,r.jsx)("span",{className:"tnum",children:g}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"sm:hidden",children:"History"}),(0,r.jsx)("span",{className:"hidden sm:inline",children:"Peak usage over time"})]})}),(0,r.jsx)("span",{className:"hidden text-right sm:block",children:null!==g?"At cursor":"Last"}),(0,r.jsxs)("span",{className:"text-right",children:[(0,r.jsx)("span",{className:"hidden sm:inline",children:"Peak"}),(0,r.jsx)("span",{className:"sm:hidden",children:null!==g?"At cursor":"Peak"})]})]}),(0,r.jsx)("p",{id:`${h.id}-instructions`,className:"sr-only",children:"Focus a core chart and use Left and Right arrows to inspect recorded bucket peaks, Home or End to jump, and Escape to dismiss."}),(0,r.jsx)("div",{role:"region","aria-label":"Per-core history rows",tabIndex:0,className:"max-h-96 overflow-y-auto rounded-md",children:0===p.length?(0,r.jsx)("p",{className:"py-8 text-center text-xs text-muted-foreground",children:"No stored per-core readings."}):p.map(e=>{let t=!o.has(e.key),a=null===h.timeMs?null:(0,er.bO)(e.points,h.timeMs,i,l),c=a?.max??a?.avg??null;return(0,r.jsxs)("div",{className:`${ei} min-h-7 border-b border-border/40 text-xs`,children:[(0,r.jsxs)("label",{className:"inline-flex min-h-7 cursor-pointer items-center rounded-sm",children:[(0,r.jsx)("input",{type:"checkbox",checked:t,onChange:()=>d(e.key),className:"peer sr-only"}),(0,r.jsx)("span",{className:`${t?"text-foreground":"text-muted-foreground line-through"} rounded-sm peer-focus-visible:outline-2 peer-focus-visible:outline-accent`,children:e.label})]}),(0,r.jsxs)("svg",{viewBox:"0 0 120 18",preserveAspectRatio:"none",role:"img","aria-label":`${e.label}: ${null!==g?`${(0,S.dd)(c,"percent")} at ${g}`:`latest ${(0,S.dd)(e.stats.latest,"percent")}`}, peak ${(0,S.dd)(e.stats.max,"percent")}${t?"":", hidden"}`,"aria-describedby":`${h.id}-instructions`,tabIndex:t?0:void 0,onPointerMove:t?e=>{let t=e.currentTarget.getBoundingClientRect();h.inspect((0,er.yk)(e.clientX,t.left,t.width,s,n))}:void 0,onFocus:h.onFocus,onBlur:h.clear,onKeyDown:h.onKeyDown,className:`h-5 w-full cursor-crosshair rounded-sm focus-visible:outline-2 focus-visible:outline-accent ${t?"":"opacity-20"}`,children:[(0,r.jsx)("title",{children:`${e.label} \xb7 Last ${(0,S.dd)(e.stats.latest,"percent")} \xb7 Peak ${(0,S.dd)(e.stats.max,"percent")}`}),t?e.paths.map((e,t)=>e?(0,r.jsx)("path",{d:e,fill:t<5?"var(--cpu)":t<8?"var(--warn)":"var(--crit)",opacity:t<5?.15+.17*t:.65+t%5*.07},t):null):null,b.map(e=>(0,r.jsx)("rect",{x:(e.fromMs-s)/f*120,width:(e.toMs-e.fromMs)/f*120,y:0,height:18,fill:"var(--card)"},`${e.fromMs}-${e.toMs}`)),null!==h.timeMs?(0,r.jsx)("line",{"aria-hidden":!0,x1:(h.timeMs-s)/f*120,x2:(h.timeMs-s)/f*120,y1:0,y2:18,stroke:"var(--foreground)",strokeWidth:"1",vectorEffect:"non-scaling-stroke",pointerEvents:"none"}):null]}),(0,r.jsx)("span",{className:"tnum hidden text-right text-muted-foreground sm:block",children:t?(0,S.dd)(null!==h.timeMs?c:e.stats.latest,"percent"):"—"}),(0,r.jsxs)("span",{className:`tnum text-right ${t&&(e.stats.max??0)>=80?"text-crit":"text-muted-foreground"}`,children:[(0,r.jsx)("span",{className:"hidden sm:inline",children:t?(0,S.dd)(e.stats.max,"percent"):"—"}),(0,r.jsx)("span",{className:"sm:hidden",children:t?(0,S.dd)(null!==h.timeMs?c:e.stats.max,"percent"):"—"})]})]},e.key)})}),(0,r.jsxs)("div",{className:`${ei} mt-2 text-xs text-muted-foreground`,"aria-hidden":!0,children:[(0,r.jsx)("span",{}),(0,r.jsx)("div",{className:"flex justify-between gap-2 tnum",children:(0,I.Cf)(s,n,3).map((e,t)=>(0,r.jsx)("span",{className:1===t?"hidden sm:inline":"",children:(0,S.O5)(e,f)},e))}),(0,r.jsx)("span",{className:"hidden sm:block"}),(0,r.jsx)("span",{})]}),(0,r.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[[{label:"0–49%",color:"var(--cpu)"},{label:"50–79%",color:"var(--warn)"},{label:"80–100%",color:"var(--crit)"}].map(e=>(0,r.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,r.jsx)("span",{"aria-hidden":!0,className:"h-2 w-4 rounded-sm",style:{backgroundColor:e.color}}),e.label]},e.label)),(0,r.jsx)("span",{children:"No fill \xb7 no reading"})]})]})}function el(e,t){return`${e}\0${t}`}function eo(e,t,s,r,n){let i=(0,y.oB)(s);return null===i?[]:e.series.filter(e=>e.metric===s&&(void 0===r||e.resourceId===r)).map((e,r)=>{let a=(0,y.Lf)(i,r),l=n?.(e,i,r)??(0,y.bP)(t,s,e.resourceId);return{key:el(e.metric,e.resourceId),label:l,metric:e.metric,resourceId:e.resourceId,color:a.color,dash:a.dash,points:e.points}})}function ed(e){let{machine:t,result:s,selectedMetrics:n,hiddenCards:i,hiddenSeries:a,onToggleSeries:l}=e,[o]=q(t.machineId),d=$(o,M(t,s.series)),c=function(e){let{machine:t,result:s,selectedMetrics:r,hiddenCards:n,coreIds:i}=e,a=new Set(r),l=[];if(["cpu.usage","cpu.core","cpu.temperature","cpu.power","cpu.iowait","cpu.pressure"].filter(e=>a.has(e)).length>0){let e=[],r=["cpu.usage","cpu.iowait","cpu.pressure"].filter(e=>a.has(e));if(r.length>0&&e.push({key:"cpu.usage",title:r.length>1?"Usage & stalls":(0,y.oB)(r[0]).label,unit:"percent",series:r.flatMap(e=>eo(s,t,e,void 0,(t,s)=>"cpu.pressure"===e?"Pressure (some)":s.shortLabel)),emptyMessage:"No stored CPU readings in this range."}),a.has("cpu.core")){let r=(0,y.oB)("cpu.core"),n=M(t,s.series),a=i??$(null,n),l=function(e,t){let s=(0,y.oB)("cpu.core");if(null===s)return[];let r=new Map(e.series.filter(e=>"cpu.core"===e.metric).map(e=>[e.resourceId,e]));return t.flatMap((e,t)=>{let n=r.get(e),i=(0,y.Lf)(s,t);return[{key:el("cpu.core",e),label:A(e),metric:"cpu.core",resourceId:e,color:i.color,dash:i.dash,points:n?.points??[]}]})}(s,a),o=n.length>a.length;e.push({key:"cpu.core",title:o?`Per-core usage \xb7 ${a.length} of ${n.length}`:"Per-core usage",unit:r.unit,series:l,emptyMessage:0===n.length?"No stored per-core readings in this range.":0===a.length?"No CPU cores are selected. Choose cores under Metrics.":"No stored per-core readings for the selected cores in this range."})}if(a.has("cpu.temperature")){let r=(0,y.oB)("cpu.temperature");e.push({key:"cpu.temperature",title:"Temperature",unit:r.unit,series:eo(s,t,"cpu.temperature"),emptyMessage:"No stored CPU temperature readings in this range."})}if(a.has("cpu.power")){let r=(0,y.oB)("cpu.power");e.push({key:"cpu.power",title:"Package power",unit:r.unit,series:eo(s,t,"cpu.power"),emptyMessage:"No stored CPU package power readings in this range."})}l.push({key:"cpu",title:"CPU",charts:e})}if(["memory.used","memory.usage","memory.pressure.some","memory.pressure.full","swap.used"].filter(e=>a.has(e)).length>0){let e=[],r=["memory.used","memory.usage"].filter(e=>a.has(e));if(r.length>0){let n=r.map(e=>({unit:(0,y.oB)(e).unit,series:eo(s,t,e,void 0,()=>"RAM")}));e.push({key:"memory.capacity",title:"RAM",...n[0],unitGroup:"memory",views:n,emptyMessage:"No stored memory readings in this range."})}a.has("swap.used")&&e.push({key:"swap.used",title:"Swap",unit:"bytes",series:eo(s,t,"swap.used"),emptyMessage:"No stored swap readings in this range."});let n=["memory.pressure.some","memory.pressure.full"].filter(e=>a.has(e));if(n.length>0){let r=(0,y.oB)(n[0]),i=n.flatMap(e=>eo(s,t,e,void 0,(t,s)=>"memory.pressure.some"===e?"Some":"memory.pressure.full"===e?"Full":s.shortLabel));e.push({key:"memory.pressure",title:"Memory pressure",unit:r.unit,series:i,emptyMessage:"No stored memory pressure in this range."})}l.push({key:"memory",title:"Memory",charts:e})}let o=["gpu.utilization","gpu.memory.used","gpu.temperature","gpu.power"].filter(e=>a.has(e));if(o.length>0){let e=(0,y.ue)(t,s.series),r=e.filter(e=>!n.has(e.id));for(let n of(0===r.length&&l.push({key:"gpu-empty",title:"GPU",charts:[{key:"gpu-empty",title:"Per-card history",unit:"percent",series:[],emptyMessage:e.length>0?"All GPU cards are hidden. Re-enable a card under Metrics to see its panels.":"No supported GPU cards or stored GPU history in this range."}]}),r)){let e=o.map(e=>{let r=(0,y.oB)(e),i=function(e,t,s,r){return eo(e,t,s,r,(e,t)=>"gpu.utilization"===s?"Utilization":"gpu.memory.used"===s?"VRAM used":t.shortLabel).map(e=>({...e}))}(s,t,e,n.id),a="gpu.memory.used"===e&&null!==n.totalBytes?`of ${(0,S.dd)(n.totalBytes,"bytes")}`:void 0;return{key:`${n.id}-${e}`,title:r.shortLabel,unit:r.unit,series:i,emptyMessage:`No stored ${r.shortLabel.toLowerCase()} readings for this card in this range.`,note:a}});l.push({key:`gpu-${n.id}`,title:`GPU ${n.index+1}${n.label?` \xb7 ${n.label}`:""}`,charts:e})}}if(["fs.used","fs.usage","fs.inodes.usage"].filter(e=>a.has(e)).length>0){let e=[],r=["fs.used","fs.usage"].filter(e=>a.has(e));if(r.length>0){let n=r.map(e=>({unit:(0,y.oB)(e).unit,series:eo(s,t,e)}));e.push({key:"fs.capacity",title:"Capacity used",...n[0],unitGroup:"filesystem",views:n,emptyMessage:"No stored filesystem usage in this range."})}if(a.has("fs.inodes.usage")){let r=(0,y.oB)("fs.inodes.usage");e.push({key:"fs.inodes.usage",title:"Inodes used",unit:r.unit,series:eo(s,t,"fs.inodes.usage"),emptyMessage:"No stored inode usage in this range."})}l.push({key:"filesystems",title:"Filesystems",charts:e})}let d=["disk.read","disk.write"].filter(e=>a.has(e));if(d.length>0){let e=d.flatMap(e=>{let r=(0,y.oB)(e);return eo(s,t,e,void 0,s=>`${(0,y.bP)(t,e,s.resourceId)} ${r.shortLabel.toLowerCase()}`)});l.push({key:"disk",title:"Disk throughput",charts:[{key:"disk",title:"Read and write",unit:"bytes_per_second",series:e,emptyMessage:"No stored disk throughput in this range."}]})}let c=["disk.read.latency","disk.write.latency"].filter(e=>a.has(e)),u=["io.pressure.some","io.pressure.full"].filter(e=>a.has(e));if(c.length>0||u.length>0||a.has("disk.utilization")){let e=[];if(c.length>0){let r=c.flatMap(e=>{let r=(0,y.oB)(e);return eo(s,t,e,void 0,s=>`${(0,y.bP)(t,e,s.resourceId)} ${r.shortLabel.toLowerCase()}`)}),n=(0,y.oB)(c[0]);e.push({key:"disk.latency",title:"Latency",unit:n.unit,series:r,emptyMessage:"No stored disk latency in this range."})}if(a.has("disk.utilization")){let r=(0,y.oB)("disk.utilization");e.push({key:"disk.utilization",title:"Utilization",unit:r.unit,series:eo(s,t,"disk.utilization"),emptyMessage:"No stored disk utilization in this range."})}if(u.length>0){let r=(0,y.oB)(u[0]),n=u.flatMap(e=>eo(s,t,e,void 0,(t,s)=>"io.pressure.some"===e?"Some":"io.pressure.full"===e?"Full":s.shortLabel));e.push({key:"io.pressure",title:"I/O pressure",unit:r.unit,series:n,emptyMessage:"No stored I/O pressure in this range."})}l.push({key:"disk-health",title:"Disk health",charts:e})}let m=["net.rx","net.tx"].filter(e=>a.has(e));if(m.length>0){let e=m.flatMap(e=>{let r=(0,y.oB)(e);return eo(s,t,e,void 0,s=>`${(0,y.bP)(t,e,s.resourceId)} ${r.shortLabel.toLowerCase()}`)});l.push({key:"network",title:"Network throughput",charts:[{key:"network",title:"Received and sent",unit:"bytes_per_second",series:e,emptyMessage:"No stored network throughput in this range."}]})}return l}({machine:t,result:s,selectedMetrics:n,hiddenCards:i,coreIds:d});return(0,r.jsx)(en._C,{children:(0,r.jsx)("div",{className:"grid grid-cols-1 gap-5",children:c.map(n=>{let i=n.charts.find(e=>"cpu.core"===e.key&&e.series.length>4),o=i?[...n.charts.filter(e=>e!==i),i]:n.charts,d=i&&4===o.length?"grid gap-6 lg:grid-cols-2 xl:grid-cols-3":o.length>1&&!(i&&2===o.length)?"grid gap-6 lg:grid-cols-2":"flex flex-col gap-6";return(0,r.jsx)(h.Z,{title:n.title,children:(0,r.jsx)("div",{className:d,children:o.map((n,d)=>{let c=n.unitGroup,u=c?e.capacityUnits[c]:void 0,m=n.views?.find(e=>e.unit===u)??n.views?.[0]??n,h=n===i||!i&&o.length%2==1&&d===o.length-1;return"cpu.core"===n.key&&n.series.length>8?(0,r.jsx)(ea,{title:n.title,series:n.series,fromMs:s.fromMs,toMs:s.toMs,gaps:s.gaps,stepMs:(0,I.jl)(s.stepMs,s.tier,t.expectedIntervalMs),hiddenKeys:a,onToggleSeries:l},n.key):(0,r.jsx)(es.t,{title:n.title,unit:m.unit,series:m.series,fromMs:s.fromMs,toMs:s.toMs,stepMs:(0,I.jl)(s.stepMs,s.tier,t.expectedIntervalMs),gaps:s.gaps,hiddenKeys:a,onToggleSeries:l,emptyMessage:n.emptyMessage,note:n.note,action:c&&n.views&&n.views.length>1?(0,r.jsx)("div",{role:"group","aria-label":`${n.title} units`,className:"inline-flex rounded-md border border-border bg-background p-0.5",children:n.views.map(t=>(0,r.jsx)("button",{type:"button","aria-pressed":t.unit===m.unit,onClick:()=>e.onCapacityUnitChange(c,t.unit),className:`min-h-7 rounded px-2 text-xs transition-colors ${t.unit===m.unit?"bg-selected text-foreground":"text-muted-foreground hover:text-foreground"}`,children:"bytes"===t.unit?"Bytes":"%"},t.unit))}):void 0,maxDrawPoints:"cpu.core"===n.key?150:void 0,className:h?"lg:col-span-full":void 0},n.key)})})},n.key)})})},`${t.machineId}|${s.toMs-s.fromMs}`)}var ec=s(1),eu=s(7499);let em={raw:"raw samples","1m":"1-minute rollups","1h":"1-hour rollups"};function eh(e){return e.displayName?.trim()||e.hostname.trim()||e.machineId}function ep(e,t){return`${e}\0${t}`}function ex(e){let t=new Set(e.selectedMetrics),s=new Set((0,y.ue)(e.machine,e.result.series).filter(t=>!e.hiddenCards.has(t.id)).map(e=>e.id));return e.result.series.filter(r=>!(!t.has(r.metric)||e.hiddenSeries.has(ep(r.metric,r.resourceId))||"cpu.core"===r.metric&&void 0!==e.coreIds&&!e.coreIds.includes(r.resourceId)||r.metric.startsWith("gpu.")&&""!==r.resourceId&&!s.has(r.resourceId)))}function eg(e){return new Date(e).toISOString()}function ef(e){return(0,y.oB)(e)?.label??e}function eb(e){return ex(e).map(t=>({metric:t.metric,label:ef(t.metric),resourceId:t.resourceId,resourceLabel:(0,y.bP)(e.machine,t.metric,t.resourceId),unit:t.unit,unitLabel:(0,y.RL)(t.unit),stats:(0,I.T6)(t.points),points:t.points.map(t=>{let s=Math.min(e.result.toMs,t.t+e.result.stepMs),r=null!==t.min||null!==t.max||null!==t.avg;return{t:t.t,tIso:eg(t.t),bucketStartMs:t.t,bucketStartIso:eg(t.t),bucketEndMs:s,bucketEndIso:eg(s),min:t.min,max:t.max,avg:t.avg,state:r?"recorded":"unavailable"}})}))}function ey(e){return(0,I.$z)(e.result.gaps,e.result.fromMs,e.result.toMs).map(e=>({...e,fromIso:eg(e.fromMs),toIso:eg(e.toMs)}))}function ej(e){let t=new Set(e.result.series.map(e=>e.metric));return e.selectedMetrics.filter(e=>!t.has(e))}function ev(e){let t=new Set(e.selectedMetrics),s=new Set(ex(e).map(e=>ep(e.metric,e.resourceId)));return e.result.series.filter(e=>t.has(e.metric)&&!s.has(ep(e.metric,e.resourceId))).length}function eN(e,t){let s=e.result,r=["Only the visible series from the loaded History result are included; this export does not query more data."];"raw"!==s.tier&&r.push(`Values are ${em[s.tier]}, not individual raw samples.`),s.truncated&&r.push("The loaded result is partial: the hub limited or shortened this history query.");let n=ey(e);n.length>0&&r.push(`${n.length} recorded data gap${1===n.length?"":"s"} included.`),t.length>0&&r.push(`Selected metrics without stored data: ${t.join(", ")}.`);let i=ev(e);return i>0&&r.push(`${i} selected series hidden in this view were not exported.`),r}let ew=["record_type","metric","metric_label","resource_id","resource_label","unit","bucket_start_ms","bucket_start_iso","bucket_end_ms","bucket_end_iso","min","max","avg","value_state","gap_kind","gap_reason","gap_dropped_records"],ek="inline-flex min-h-7 items-center rounded-md border border-border bg-background px-2 text-xs text-foreground transition-colors hover:bg-card-strong disabled:cursor-not-allowed disabled:opacity-50";function eM(e){let[t,s]=(0,a.useState)(null),n=ex(e).length,i=t=>{let r=Date.now(),n={...e,exportedAt:r};try{let e,i,a,l,o,d,c,u,m=function(e,t,s=Date.now()){return(0,eu.Y8)("history",eh(e.machine),s,t)}(n,t,r),h="csv"===t?function(e){let t,s,r,n,i,a,l=e.exportedAt??Date.now(),o=(t=(0,S.ly)(e.range),s=e.result,r=ex(e),n=ej(e),i=ey(e),a=e.selectedMetrics.map(ef).join("; "),[["Rigscope History export"],["Scope","Visible series from the loaded History result"],["Machine",eh(e.machine)],["Machine ID",e.machine.machineId],["Query",a],["Range",`${t.label} (${eg(s.fromMs)} – ${eg(s.toMs)})`],["Resolution",`${em[s.tier]} \xb7 ${s.stepMs} ms buckets`],["Loaded at",eg(e.loadedAt)],["Exported at",eg(l)],["Partial",s.truncated?"true":"false"],["Gaps",String(i.length)],["Visible series",String(r.length)],["Selected without stored data",n.length>0?n.join(", "):"none"],["Note",eN(e,n).join(" ")],[]]);for(let t of(o.push([...ew]),eb(e)))for(let e of t.points)o.push(["bucket",t.metric,t.label,t.resourceId,t.resourceLabel,t.unit,e.bucketStartMs,e.bucketStartIso,e.bucketEndMs,e.bucketEndIso,e.min,e.max,e.avg,e.state,"","",""]);for(let t of ey(e))o.push(["gap","","","","","",t.fromMs,t.fromIso,t.toMs,t.toIso,"","","","gap",t.kind,t.reason??"",t.droppedRecords??""]);return(0,ec.kg)(o)}(n):(e=n.exportedAt??Date.now(),i=(0,S.ly)(n.range),a=n.result,l=eb(n),o=ej(n),d=ey(n),c=ev(n),u={app:"Rigscope",kind:"history",exportedAt:eg(e),scope:{description:"Visible series from the loaded History result",machine:{id:n.machine.machineId,name:eh(n.machine),hostname:n.machine.hostname,connected:n.machine.connected,lastReceivedAt:n.machine.lastReceivedAt},query:{range:{id:i.id,label:i.label,fromMs:a.fromMs,fromIso:eg(a.fromMs),toMs:a.toMs,toIso:eg(a.toMs)},selectedMetrics:[...n.selectedMetrics],visibleSeries:l.length,hiddenSeriesCount:c}},resolution:{tier:a.tier,label:em[a.tier],stepMs:a.stepMs,expectedIntervalMs:n.machine.expectedIntervalMs??null},loadedAt:eg(n.loadedAt),partial:a.truncated,gaps:d,series:l.map(e=>({metric:e.metric,label:e.label,resourceId:e.resourceId,resourceLabel:e.resourceLabel,unit:e.unit,unitLabel:e.unitLabel,summary:{points:e.stats.count,min:e.stats.min,max:e.stats.max,averageOfBucketAverages:e.stats.avg,latest:e.stats.latest,latestAt:null===e.stats.latestT?null:eg(e.stats.latestT),firstAt:null===e.stats.firstT?null:eg(e.stats.firstT),lastAt:null===e.stats.lastT?null:eg(e.stats.lastT)},points:e.points})),missingData:o.map(e=>({metric:e,label:ef(e),reason:"No stored series in the loaded result."})),notes:eN(n,o)},`${JSON.stringify(u,null,2)}
3
- `);(0,ec.PE)(m,h,"csv"===t?ec.UR:ec.uW),s(null)}catch{s("The history export could not be created.")}};return(0,r.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",children:["Export visible",(0,r.jsx)("span",{className:"sr-only",children:` (${n} series from the loaded result)`})]}),(0,r.jsx)("button",{type:"button",onClick:()=>i("csv"),"aria-label":"Download visible history as CSV",title:"Download the visible series from this loaded result as CSV",className:ek,children:"CSV"}),(0,r.jsx)("button",{type:"button",onClick:()=>i("json"),"aria-label":"Download visible history as JSON",title:"Download the visible series from this loaded result as JSON",className:ek,children:"JSON"}),null!==t?(0,r.jsxs)("span",{role:"status",className:"inline-flex items-center gap-1 text-xs text-warn",children:[(0,r.jsx)(d.A,{className:"h-3 w-3","aria-hidden":!0}),t]}):null]})}function e$(e){return e.displayName?.trim()||e.hostname.trim()||e.machineId}function eA(){return(0,r.jsxs)("div",{className:"grid grid-cols-1 gap-5 xl:grid-cols-2","aria-busy":"true",children:[(0,r.jsx)(h.Z,{title:"Loading stored history",children:(0,r.jsx)("div",{className:"h-40 animate-pulse rounded-lg bg-card-strong","aria-hidden":!0})}),(0,r.jsx)(h.Z,{title:"Preparing charts",children:(0,r.jsx)("div",{className:"h-40 animate-pulse rounded-lg bg-card-strong","aria-hidden":!0})})]})}function eI(){let e,t,s,n,{session:j,phase:v,machines:N,retryConnection:w}=(0,f.M)(),k=(0,g.x)(),{machine:A,machineId:R,requestedMachineId:P}=(0,b.JG)("history"),[U,L]=W(R,"memory"),[_,T]=W(R,"filesystem"),z={memory:U,filesystem:_},[D,H]=(0,B.u)("history.range","10m",F),[Z,V]=(0,B.u)(`history.metrics.${R}`,null,O),[K]=q(R),Y=M(A),J=$(K,Y),[Q,X]=G(R,"cards"),[es,er]=G(R,"series"),en=(0,a.useMemo)(()=>new Set(Q),[Q]),ei=(0,a.useMemo)(()=>new Set(es),[es]),[ea,el]=(0,B.u)("history.autoRefresh",!0,E,"session"),[eo,ec]=(0,a.useState)(null),[eu,em]=(0,a.useState)(null),[eh,ep]=(0,a.useState)(0),ex=(0,a.useRef)(null),[eg,ef]=(0,a.useState)(null),[eb,ey]=(0,a.useState)(Date.now);(0,a.useEffect)(()=>{if(void 0===A){ex.current=null,ef(null);return}let e=ex.current,t={connected:A.connected,lastReceivedAt:A.lastReceivedAt},s=e?.machineId===A.machineId?e.point:null;ef(e=>{let r=function(e,t,s,r){let n=e.findIndex(e=>null===e.toMs);if(!s.connected){if(n>=0)return e;let i=[...e,{fromMs:C(s.lastReceivedAt)??C(t?.lastReceivedAt??null)??r,toMs:null}];return i.length>64?i.slice(i.length-64):i}if(n<0||null===t||t.connected)return e;let i=e[n],a=C(s.lastReceivedAt),l=null!==a&&a>i.fromMs?a:Math.max(i.fromMs,r);return e.map((e,t)=>t===n?{fromMs:e.fromMs,toMs:l}:e)}(e?.machineId===A.machineId?e.outages:[],s,t,Date.now());return e?.machineId===A.machineId&&e.outages===r?e:{machineId:A.machineId,outages:r}}),t.connected&&s?.connected!==!1||ey(Date.now()),ex.current={machineId:A.machineId,point:t}},[A?.machineId,A?.connected,A?.lastReceivedAt]),(0,a.useEffect)(()=>{if(A?.connected!==!1||!ea)return;let e=window.setInterval(()=>{"visible"===document.visibilityState&&ey(Date.now())},1e3);return()=>window.clearInterval(e)},[A?.machineId,A?.connected,ea]);let ej=(0,a.useMemo)(()=>void 0===A?"":(0,y.er)(A).join(","),[A?.machineId,A?.inventory,A?.metrics?.payload.gpus]),ev=Z??ej,eN=""===ev?[]:ev.split(","),ew="signed-in"===j.kind&&void 0!==A&&""!==R&&""!==ev;(0,a.useEffect)(()=>{if(""===R){ec(null),em(null);return}let e=new AbortController;return ec(null),em(null),fetch(`/api/history/metrics?machineId=${encodeURIComponent(R)}`,{signal:e.signal,cache:"no-store",headers:{Accept:"application/json"}}).then(async t=>{if(!t.ok){if(401===t.status||403===t.status||404===t.status)return;throw Error(`catalog ${t.status}`)}let s=await t.json();if(null===s||"object"!=typeof s||!("metrics"in s))throw Error("catalog shape");let r=s.metrics;if(null===r||"object"!=typeof r)throw Error("catalog shape");let n=Object.create(null);for(let[e,t]of Object.entries(r))null!==t&&"object"==typeof t&&"string"==typeof t.unit&&(n[e]={unit:t.unit});e.signal.aborted||ec(n)}).catch(()=>{e.signal.aborted||em("The hub's metric catalog could not be loaded; standard metric names are shown.")}),()=>e.abort()},[R]);let{data:ek,error:eI,loading:eC,manualRefreshing:eS}=(0,et.n)({machineId:R,metricsKey:ev,coreIdsKey:eN.includes("cpu.core")&&J.length!==Y.length?J.join(","):void 0,range:D,enabled:ew,autoRefresh:ea,refreshNonce:eh});(0,a.useEffect)(()=>{eI?.kind==="rate-limited"&&el(!1)},[eI?.kind,el]);let eR=(0,a.useMemo)(()=>{if(!ek||eg?.machineId!==R||0===eg.outages.length)return ek;let e=ek.result,t=Math.max(e.toMs,...eg.outages.map(e=>e.toMs??eb)),s=e.fromMs+t-e.toMs;return{...ek,result:{...e,fromMs:s,toMs:t,gaps:(0,I.$z)([...e.gaps,...function(e,t,s){if(!Number.isFinite(t)||!Number.isFinite(s)||s<=t)return[];let r=[];for(let n of e){let e=Math.max(t,n.fromMs),i=Math.min(s,n.toMs??s);Number.isFinite(e)&&Number.isFinite(i)&&!(i<=e)&&r.push({fromMs:e,toMs:i,kind:"missing",reason:null===n.toMs?"collector disconnected":"collector outage"})}var n=r;let i=n.filter(e=>Number.isFinite(e.fromMs)&&Number.isFinite(e.toMs)&&e.toMs>e.fromMs).map(e=>({...e})).sort((e,t)=>e.fromMs-t.fromMs||e.toMs-t.toMs),a=[];for(let e of i){let t=a.at(-1);if(void 0!==t&&e.fromMs<=t.toMs){t.toMs=Math.max(t.toMs,e.toMs),"dropped"===e.kind&&(t.kind="dropped"),void 0===t.reason&&void 0!==e.reason&&(t.reason=e.reason),void 0===t.droppedRecords&&void 0!==e.droppedRecords&&(t.droppedRecords=e.droppedRecords);continue}a.push(e)}return a}(eg.outages,s,t)],s,t)}}},[ek,R,eg,eb]),eP=eR?.result??null,eU=void 0===A?[]:(0,y.ue)(A,eP?.series??[]),eL=(0,S.ly)(D),e_=null!==eI?null!==eR?`${"rate-limited"===eI.kind?"Refresh paused":"Refresh failed"} \xb7 ${(0,S.ei)(eR.loadedAt)}`:"History unavailable":null!==eR?`Updated ${(0,S.ei)(eR.loadedAt)}`:eC?"Loading…":"",eB=ew&&null===eR&&null===eI,eT=N.length,ez="disconnected"===v;return(0,r.jsx)(m.G,{title:"History",machineId:R,machineView:"history",headerRight:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(p.$E,{}),(0,r.jsx)(x.B,{})]}),children:k||(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{role:"status","aria-live":"polite",className:"sr-only",children:eI?.message??""}),(0,r.jsx)(ee,{machine:A,range:D,selectedMetrics:eN,catalog:eo,catalogError:eu,gpuCards:eU,hiddenCards:en,autoRefresh:ea,loading:eC,manualRefreshing:eS,statusText:e_,onRangeChange:H,onToggleMetric:e=>{let t=new Set(eN);t.has(e)?t.delete(e):t.add(e),V([...t].sort().join(","))},onSetMetrics:e=>V([...new Set(e)].sort().join(",")),onToggleCard:e=>{X(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),[...s]})},onToggleAutoRefresh:()=>el(e=>!e),onRefresh:()=>ep(e=>e+1)}),"reconnecting"===v||"disconnected"===v?(0,r.jsxs)("div",{role:"status",className:"mb-4 flex items-start gap-2 rounded-lg border border-border bg-card px-4 py-2.5 text-xs text-muted-foreground",children:[(0,r.jsx)(d.A,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-warn","aria-hidden":!0}),(0,r.jsxs)("span",{children:["Live feed ","disconnected"===v?"disconnected":"reconnecting"," \xb7 stored history available"]}),"disconnected"===v?(0,r.jsxs)("button",{type:"button",onClick:w,className:"ml-auto inline-flex min-h-8 shrink-0 items-center gap-1.5 rounded-md border border-border px-2.5 text-xs text-foreground transition-colors hover:bg-card-strong",children:[(0,r.jsx)(u.A,{className:"h-3 w-3","aria-hidden":!0}),"Retry now"]}):null]}):null,void 0===A?ez?(0,r.jsxs)(h.Z,{title:"Hub disconnected",className:"mx-auto mt-3 max-w-xl",children:[(0,r.jsx)(h.p,{icon:c.A,note:"The hub is unreachable, so the authorized machine list is unavailable."}),(0,r.jsx)("div",{className:"mt-2 flex justify-center",children:(0,r.jsxs)("button",{type:"button",onClick:w,className:"inline-flex min-h-8 items-center gap-1.5 rounded-md border border-border px-3 text-xs text-foreground transition-colors hover:bg-card-strong",children:[(0,r.jsx)(u.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Check again"]})})]}):0!==eT||ez||"idle"!==v&&"connecting"!==v&&"reconnecting"!==v?0===eT?(0,r.jsx)(h.Z,{title:"No machines",className:"mx-auto mt-3 max-w-xl",children:(0,r.jsx)(h.p,{icon:o.A,note:"No machines are available in your authorized fleet."})}):(0,r.jsxs)(h.Z,{title:"Machine not found",className:"mx-auto mt-3 max-w-xl",children:[(0,r.jsx)(h.p,{icon:o.A,note:"This machine is unavailable or outside your access."}),P?(0,r.jsxs)("p",{className:"tnum mt-2 text-center text-xs text-muted-foreground",children:["Requested identifier: ",P]}):null,(0,r.jsx)("div",{className:"mt-2 flex justify-center",children:(0,r.jsx)(i(),{href:"/",className:"inline-flex items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-xs text-foreground transition-colors hover:bg-card-strong",children:"Back to fleet"})})]}):(0,r.jsx)(h.Z,{title:"Waiting for machines",className:"mx-auto mt-3 max-w-xl",children:(0,r.jsx)(h.p,{icon:o.A,note:"Waiting for the hub to report your authorized machines…"})}):0===eN.length?(0,r.jsx)(h.Z,{title:"No metrics selected",className:"mx-auto mt-3 max-w-xl",children:(0,r.jsx)(h.p,{icon:o.A,note:""===ej?"No metric families are shared with this hub.":"Choose at least one metric above to draw history."})}):null!==eI&&null===eR?(t=(e=function(e){switch(e.kind){case"unauthorized":return{title:"Session ended",note:"Your session is no longer accepted, so stored history is hidden.",icon:l.A};case"denied":return{title:"History access denied",note:e.message,icon:l.A};case"missing":return{title:"Machine unavailable",note:e.message,icon:o.A};case"rate-limited":return{title:"History requests limited",note:e.message,icon:d.A};case"unavailable":return{title:"History unavailable",note:e.message,icon:c.A};case"network":return{title:"Hub unreachable",note:"The hub could not be reached for stored history.",icon:c.A};case"invalid":return{title:"Unexpected history response",note:e.message,icon:d.A}}}(eI)).icon,(0,r.jsxs)(h.Z,{title:e.title,className:"mx-auto mt-3 max-w-xl",children:[(0,r.jsx)(h.p,{icon:t,note:e.note}),(0,r.jsxs)("div",{className:"mt-2 flex flex-wrap justify-center gap-2",children:[(0,r.jsxs)("button",{type:"button",onClick:()=>ep(e=>e+1),className:"inline-flex items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-xs text-foreground transition-colors hover:bg-card-strong",children:[(0,r.jsx)(u.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Try again"]}),"unauthorized"===eI.kind?(0,r.jsx)(i(),{href:"/login",className:"inline-flex items-center rounded-md bg-accent px-3 py-1.5 text-xs font-medium text-accent-foreground transition-colors hover:bg-accent/90",children:"Sign in"}):null]})]})):(eC||eB)&&null===eR?(0,r.jsx)(eA,{}):null===eR?(0,r.jsx)(h.Z,{title:"History",className:"mx-auto mt-3 max-w-xl",children:(0,r.jsx)(h.p,{icon:o.A,note:"No stored history has arrived yet."})}):(n="raw"===(s=eR.result).tier?"raw samples":"1m"===s.tier?"1-minute rollups":"1-hour rollups",(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"mb-3 flex flex-wrap items-baseline gap-x-4 gap-y-1 text-xs text-muted-foreground",children:[(0,r.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-foreground",children:[(0,r.jsx)("span",{"aria-hidden":!0,className:`inline-block h-2 w-2 shrink-0 rounded-full ${A.connected?"bg-ok":"bg-crit"}`}),e$(A)]}),(0,r.jsxs)("span",{children:[(0,S.r6)(s.fromMs)," – ",(0,S.r6)(s.toMs)]}),(0,r.jsxs)("span",{className:"tnum",title:n,children:[(0,S.I_)(s.stepMs)," buckets"]}),(0,r.jsx)("div",{className:"ml-auto self-center",children:(0,r.jsx)(eM,{machine:A,result:s,range:D,selectedMetrics:(0,y.Cv)(eN,z),hiddenCards:en,hiddenSeries:ei,coreIds:J,loadedAt:eR.loadedAt})})]}),s.truncated?(0,r.jsxs)("div",{role:"status",className:"mb-4 flex items-start gap-2 rounded-lg bg-warn-soft px-4 py-2.5 text-xs text-foreground",children:[(0,r.jsx)(d.A,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-warn","aria-hidden":!0}),(0,r.jsx)("span",{children:"Partial history \xb7 narrow the range for more detail."})]}):null,s.gaps.length>0?(0,r.jsxs)("details",{className:"mb-4 max-w-3xl text-xs text-muted-foreground",children:[(0,r.jsxs)("summary",{className:"inline-flex min-h-8 cursor-pointer items-center gap-2 rounded-md text-warn",children:[(0,r.jsx)(d.A,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-warn","aria-hidden":!0}),(0,r.jsxs)("span",{children:[(0,r.jsx)("strong",{className:"font-medium",children:"Data gaps:"})," ",(0,S.fH)(s.gaps,s.fromMs,s.toMs)]})]}),(0,r.jsxs)("ul",{className:"mt-1.5 flex flex-col gap-1",children:[s.gaps.slice(0,20).map(e=>(0,r.jsxs)("li",{className:"tnum text-xs",children:[(0,S.r6)(e.fromMs)," – ",(0,S.r6)(e.toMs)," (",(0,S.I_)(e.toMs-e.fromMs),"):"," ","dropped"===e.kind?"dropped":"missed",e.reason?` \xb7 ${e.reason}`:"",void 0!==e.droppedRecords?` \xb7 ${e.droppedRecords} record${1===e.droppedRecords?"":"s"}`:""]},`${e.fromMs}-${e.toMs}-${e.kind}`)),s.gaps.length>20?(0,r.jsxs)("li",{className:"text-xs text-muted-foreground",children:["…and ",s.gaps.length-20," more."]}):null]})]}):null,0===s.series.length?(0,r.jsx)(h.Z,{title:"No stored points",className:"mx-auto max-w-xl",children:(0,r.jsx)(h.p,{icon:o.A,note:`No stored readings for ${void 0===A?"this machine":e$(A)} in ${eL.label.toLowerCase()}.`})}):(0,r.jsx)(ed,{machine:A,result:s,selectedMetrics:eN,hiddenCards:en,hiddenSeries:ei,onToggleSeries:e=>{er(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),[...s]})},capacityUnits:z,onCapacityUnitChange:(e,t)=>("memory"===e?L:T)(t)})]}))]})})}},6582:(e,t,s)=>{"use strict";s.d(t,{E:()=>f,x:()=>g});var r=s(5155),n=s(8500),i=s.n(n),a=s(828),l=s(6914),o=s(7029),d=s(438),c=s(7422),u=s(1735),m=s(3440),h=s(9939);function p(e){return(0,r.jsxs)("button",{type:"button",onClick:e.onClick,className:"inline-flex items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-xs text-foreground transition-colors hover:bg-card-strong",children:[(0,r.jsx)(a.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),e.children]})}function x(e){return(0,r.jsx)(i(),{href:e.href,className:e.primary?"inline-flex items-center gap-1.5 rounded-md bg-accent px-3 py-1.5 text-xs font-medium text-accent-foreground transition-colors hover:bg-accent/90":"inline-flex items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-xs text-foreground transition-colors hover:bg-card-strong",children:e.children})}function g(){let{session:e,phase:t,retryConnection:s}=(0,h.M)();switch(e.kind){case"restoring":return(0,r.jsx)(m.Z,{title:"Checking session",className:"mx-auto my-12 max-w-md",children:(0,r.jsx)(m.p,{icon:l.A,note:"Checking your session…"})});case"restore-failed":return(0,r.jsxs)(m.Z,{title:"Hub unreachable",className:"mx-auto my-12 max-w-md",children:[(0,r.jsx)(m.p,{icon:o.A,note:"The hub is unreachable right now."}),(0,r.jsx)("div",{className:"flex justify-center",children:(0,r.jsx)(p,{onClick:s,children:"Check again"})})]});case"signed-out":if("expired"===t)return(0,r.jsxs)(m.Z,{title:"Session ended",className:"mx-auto my-12 max-w-md",children:[(0,r.jsx)(m.p,{icon:d.A,note:"Your session ended."}),(0,r.jsx)("div",{className:"flex justify-center",children:(0,r.jsx)(x,{href:"/login",primary:!0,children:"Sign in"})})]});return(0,r.jsxs)(m.Z,{title:"Sign in required",className:"mx-auto my-12 max-w-md",children:[(0,r.jsx)(m.p,{icon:l.A,note:"Sign in required."}),(0,r.jsx)("div",{className:"flex justify-center",children:(0,r.jsx)(x,{href:"/login",primary:!0,children:"Sign in"})})]});case"auth-unavailable":return(0,r.jsx)(m.Z,{title:"Sign-in unavailable",className:"mx-auto my-12 max-w-md",children:(0,r.jsx)(m.p,{icon:c.A,note:"Browser sign-in is not configured on this hub."})})}return"expired"===t?(0,r.jsxs)(m.Z,{title:"Session ended",className:"mx-auto my-12 max-w-md",children:[(0,r.jsx)(m.p,{icon:d.A,note:"Your session ended."}),(0,r.jsx)("div",{className:"flex justify-center",children:(0,r.jsx)(x,{href:"/login",primary:!0,children:"Sign in"})})]}):"no-permission"===t?(0,r.jsxs)(m.Z,{title:"No permission",className:"mx-auto my-12 max-w-md",children:[(0,r.jsx)(m.p,{icon:c.A,note:`You are signed in as ${e.user.username}, but this hub grants no machine view to this account.`}),(0,r.jsx)("div",{className:"flex justify-center",children:(0,r.jsx)(p,{onClick:s,children:"Check again"})})]}):null}function f(){let{phase:e,retryConnection:t}=(0,h.M)();return"reconnecting"!==e&&"disconnected"!==e&&"connecting"!==e?null:"connecting"===e?(0,r.jsxs)("div",{role:"status",className:"mb-5 flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-2.5 text-xs text-muted-foreground",children:[(0,r.jsx)(a.A,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),"Connecting to the live feed — waiting for the first snapshot."]}):(0,r.jsxs)("div",{role:"status",className:"mb-5 flex flex-wrap items-center gap-x-3 gap-y-2 rounded-lg border border-border bg-card px-4 py-2.5 text-xs text-muted-foreground",children:[(0,r.jsx)(u.A,{className:"h-3.5 w-3.5 shrink-0 text-warn","aria-hidden":!0}),(0,r.jsxs)("span",{children:["Connection lost — values below are ",(0,r.jsx)("strong",{className:"font-medium text-foreground",children:"last known"}),", not live measurements","reconnecting"===e?" — retrying with backoff…":" — retries stopped."]}),"disconnected"===e?(0,r.jsx)(p,{onClick:t,children:"Retry now"}):null]})}},7148:(e,t,s)=>{Promise.resolve().then(s.bind(s,2939)),Promise.resolve().then(s.bind(s,1721)),Promise.resolve().then(s.bind(s,2701)),Promise.resolve().then(s.bind(s,2394))},7499:(e,t,s)=>{"use strict";function r(e,t,s,r){return`rigscope-${e}-${function(e,t="machine"){let s=e.normalize("NFKD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48).replace(/-+$/g,"");return s.length>0?s:t}(t)}-${!Number.isFinite(s)?"unknown-time":new Date(s).toISOString().replace(/[-:]/g,"").replace(/\.\d{3}Z$/,"Z")}.${r}`}s.d(t,{Y8:()=>r})},9942:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(8698).A)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])}},e=>{e.O(0,[157,939,103,408,441,794,358],()=>e(e.s=7148)),_N_E=e.O()}]);