@omnitron-dev/omnitron 0.3.5 → 0.4.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 (267) hide show
  1. package/README.md +296 -6
  2. package/bin/{pnpmfile-sdk.mjs → pnpmfile-sdk.js} +13 -0
  3. package/bin/sdk.d.ts +19 -0
  4. package/bin/sdk.js +932 -0
  5. package/dist/BUILD.json +2 -2
  6. package/dist/cli/omnitron.js +14 -6
  7. package/dist/cli/omnitron.js.map +1 -1
  8. package/dist/commands/stack.d.ts +2 -5
  9. package/dist/commands/stack.d.ts.map +1 -1
  10. package/dist/commands/stack.js +32 -0
  11. package/dist/commands/stack.js.map +1 -1
  12. package/dist/commands/status.d.ts.map +1 -1
  13. package/dist/commands/status.js +1 -0
  14. package/dist/commands/status.js.map +1 -1
  15. package/dist/daemon/daemon-client.d.ts +3 -15
  16. package/dist/daemon/daemon-client.d.ts.map +1 -1
  17. package/dist/daemon/daemon-client.js +4 -0
  18. package/dist/daemon/daemon-client.js.map +1 -1
  19. package/dist/daemon/daemon.d.ts +5 -11
  20. package/dist/daemon/daemon.d.ts.map +1 -1
  21. package/dist/daemon/daemon.js +28 -42
  22. package/dist/daemon/daemon.js.map +1 -1
  23. package/dist/daemon/daemon.rpc-service.d.ts +3 -15
  24. package/dist/daemon/daemon.rpc-service.d.ts.map +1 -1
  25. package/dist/daemon/daemon.rpc-service.js +27 -3
  26. package/dist/daemon/daemon.rpc-service.js.map +1 -1
  27. package/dist/daemon/darwin-owner-evidence.js +1 -1
  28. package/dist/daemon/darwin-owner-evidence.js.map +1 -1
  29. package/dist/daemon/execution-capabilities.d.ts +1 -1
  30. package/dist/daemon/execution-capabilities.d.ts.map +1 -1
  31. package/dist/daemon/execution-capabilities.js +3 -3
  32. package/dist/daemon/execution-capabilities.js.map +1 -1
  33. package/dist/daemon/execution-client.d.ts +4 -0
  34. package/dist/daemon/execution-client.d.ts.map +1 -1
  35. package/dist/daemon/execution-client.js +28 -6
  36. package/dist/daemon/execution-client.js.map +1 -1
  37. package/dist/daemon/execution-host.d.ts +4 -11
  38. package/dist/daemon/execution-host.d.ts.map +1 -1
  39. package/dist/daemon/execution-host.js +3 -9
  40. package/dist/daemon/execution-host.js.map +1 -1
  41. package/dist/daemon/execution-owner.d.ts.map +1 -1
  42. package/dist/daemon/execution-owner.js +2 -16
  43. package/dist/daemon/execution-owner.js.map +1 -1
  44. package/dist/daemon/execution-shutdown.d.ts +1 -1
  45. package/dist/daemon/execution-shutdown.d.ts.map +1 -1
  46. package/dist/daemon/managed-owner-build.d.ts +4 -0
  47. package/dist/daemon/managed-owner-build.d.ts.map +1 -1
  48. package/dist/daemon/managed-owner-build.js +14 -2
  49. package/dist/daemon/managed-owner-build.js.map +1 -1
  50. package/dist/daemon/managed-runtime.js +1 -1
  51. package/dist/daemon/managed-runtime.js.map +1 -1
  52. package/dist/daemon/owner-reconciliation.d.ts.map +1 -1
  53. package/dist/daemon/owner-reconciliation.js +1 -2
  54. package/dist/daemon/owner-reconciliation.js.map +1 -1
  55. package/dist/daemon/system-guardian-cgroup.js +1 -1
  56. package/dist/daemon/system-guardian-cgroup.js.map +1 -1
  57. package/dist/infrastructure/existing-containers.d.ts +25 -0
  58. package/dist/infrastructure/existing-containers.d.ts.map +1 -0
  59. package/dist/infrastructure/existing-containers.js +183 -0
  60. package/dist/infrastructure/existing-containers.js.map +1 -0
  61. package/dist/infrastructure/infrastructure.service.d.ts +14 -1
  62. package/dist/infrastructure/infrastructure.service.d.ts.map +1 -1
  63. package/dist/infrastructure/infrastructure.service.js +118 -9
  64. package/dist/infrastructure/infrastructure.service.js.map +1 -1
  65. package/dist/infrastructure/stack-infra-manager.d.ts +8 -2
  66. package/dist/infrastructure/stack-infra-manager.d.ts.map +1 -1
  67. package/dist/infrastructure/stack-infra-manager.js +46 -9
  68. package/dist/infrastructure/stack-infra-manager.js.map +1 -1
  69. package/dist/monitoring/log-journal.d.ts.map +1 -1
  70. package/dist/monitoring/log-journal.js +1 -2
  71. package/dist/monitoring/log-journal.js.map +1 -1
  72. package/dist/operations.d.ts +1 -0
  73. package/dist/operations.d.ts.map +1 -1
  74. package/dist/operations.js +1 -0
  75. package/dist/operations.js.map +1 -1
  76. package/dist/orchestrator/bootstrap-loader.d.ts +2 -0
  77. package/dist/orchestrator/bootstrap-loader.d.ts.map +1 -1
  78. package/dist/orchestrator/bootstrap-loader.js +2 -1
  79. package/dist/orchestrator/bootstrap-loader.js.map +1 -1
  80. package/dist/orchestrator/classic-launcher.d.ts.map +1 -1
  81. package/dist/orchestrator/classic-launcher.js +2 -1
  82. package/dist/orchestrator/classic-launcher.js.map +1 -1
  83. package/dist/orchestrator/execution-contract.d.ts +2 -3
  84. package/dist/orchestrator/execution-contract.d.ts.map +1 -1
  85. package/dist/orchestrator/file-watcher.d.ts +11 -23
  86. package/dist/orchestrator/file-watcher.d.ts.map +1 -1
  87. package/dist/orchestrator/file-watcher.js +57 -42
  88. package/dist/orchestrator/file-watcher.js.map +1 -1
  89. package/dist/orchestrator/orchestrator.service.d.ts +10 -5
  90. package/dist/orchestrator/orchestrator.service.d.ts.map +1 -1
  91. package/dist/orchestrator/orchestrator.service.js +117 -20
  92. package/dist/orchestrator/orchestrator.service.js.map +1 -1
  93. package/dist/project/bootstrap-metadata.d.ts +1 -1
  94. package/dist/project/bootstrap-metadata.d.ts.map +1 -1
  95. package/dist/project/bootstrap-metadata.js +3 -2
  96. package/dist/project/bootstrap-metadata.js.map +1 -1
  97. package/dist/project/node-stack-stop.d.ts +2 -1
  98. package/dist/project/node-stack-stop.d.ts.map +1 -1
  99. package/dist/project/node-stack-stop.js +5 -1
  100. package/dist/project/node-stack-stop.js.map +1 -1
  101. package/dist/release/closure-library-path.d.ts +8 -2
  102. package/dist/release/closure-library-path.d.ts.map +1 -1
  103. package/dist/release/closure-library-path.js +72 -28
  104. package/dist/release/closure-library-path.js.map +1 -1
  105. package/dist/release/local-installation.d.ts +2 -0
  106. package/dist/release/local-installation.d.ts.map +1 -1
  107. package/dist/release/local-installation.js +1 -1
  108. package/dist/release/local-installation.js.map +1 -1
  109. package/dist/release/portable-archive.d.ts +3 -0
  110. package/dist/release/portable-archive.d.ts.map +1 -1
  111. package/dist/release/portable-archive.js +13 -7
  112. package/dist/release/portable-archive.js.map +1 -1
  113. package/dist/release/registry-framework.d.ts +25 -0
  114. package/dist/release/registry-framework.d.ts.map +1 -1
  115. package/dist/release/registry-framework.js +51 -3
  116. package/dist/release/registry-framework.js.map +1 -1
  117. package/dist/release/target-runtime.d.ts +4 -0
  118. package/dist/release/target-runtime.d.ts.map +1 -1
  119. package/dist/release/target-runtime.js +9 -0
  120. package/dist/release/target-runtime.js.map +1 -1
  121. package/dist/services/host-upgrade.d.ts +2 -0
  122. package/dist/services/host-upgrade.d.ts.map +1 -1
  123. package/dist/services/host-upgrade.js +6 -2
  124. package/dist/services/host-upgrade.js.map +1 -1
  125. package/dist/services/infrastructure.rpc-service.d.ts +8 -0
  126. package/dist/services/infrastructure.rpc-service.d.ts.map +1 -1
  127. package/dist/services/infrastructure.rpc-service.js +90 -10
  128. package/dist/services/infrastructure.rpc-service.js.map +1 -1
  129. package/dist/services/kernel-rollout.service.d.ts.map +1 -1
  130. package/dist/services/kernel-rollout.service.js +1 -2
  131. package/dist/services/kernel-rollout.service.js.map +1 -1
  132. package/dist/services/migration-process.d.ts +1 -0
  133. package/dist/services/migration-process.d.ts.map +1 -1
  134. package/dist/services/migration-process.js +4 -2
  135. package/dist/services/migration-process.js.map +1 -1
  136. package/dist/services/pipeline-definition.d.ts.map +1 -1
  137. package/dist/services/pipeline-definition.js +32 -6
  138. package/dist/services/pipeline-definition.js.map +1 -1
  139. package/dist/services/pipeline.service.d.ts +7 -1
  140. package/dist/services/pipeline.service.d.ts.map +1 -1
  141. package/dist/services/pipeline.service.js +106 -13
  142. package/dist/services/pipeline.service.js.map +1 -1
  143. package/dist/services/project.rpc-service.d.ts +6 -5
  144. package/dist/services/project.rpc-service.d.ts.map +1 -1
  145. package/dist/services/project.rpc-service.js +13 -0
  146. package/dist/services/project.rpc-service.js.map +1 -1
  147. package/dist/services/project.service.d.ts +24 -6
  148. package/dist/services/project.service.d.ts.map +1 -1
  149. package/dist/services/project.service.js +327 -59
  150. package/dist/services/project.service.js.map +1 -1
  151. package/dist/services/remote-deployer.service.d.ts.map +1 -1
  152. package/dist/services/remote-deployer.service.js +3 -0
  153. package/dist/services/remote-deployer.service.js.map +1 -1
  154. package/dist/shared/dto/backend.d.ts +3 -0
  155. package/dist/shared/dto/backend.d.ts.map +1 -1
  156. package/dist/shared/dto/backend.js.map +1 -1
  157. package/dist/shared/dto/pipelines.d.ts +54 -5
  158. package/dist/shared/dto/pipelines.d.ts.map +1 -1
  159. package/dist/shared/dto/pipelines.js +0 -7
  160. package/dist/shared/dto/pipelines.js.map +1 -1
  161. package/dist/shared/dto/project.d.ts +60 -0
  162. package/dist/shared/dto/project.d.ts.map +1 -1
  163. package/dist/shared/dto/services.d.ts +26 -17
  164. package/dist/shared/dto/services.d.ts.map +1 -1
  165. package/dist/shared/dto/services.js.map +1 -1
  166. package/dist/workers/system-worker-manager.d.ts +1 -2
  167. package/dist/workers/system-worker-manager.d.ts.map +1 -1
  168. package/dist/workers/system-worker-manager.js +5 -3
  169. package/dist/workers/system-worker-manager.js.map +1 -1
  170. package/package.json +17 -16
  171. package/webapp/dist/BUILD.json +2 -2
  172. package/webapp/dist/assets/{access-DUjabwNX.js → access-B2gXuoMG.js} +1 -1
  173. package/webapp/dist/assets/{access-BvKK9dEv.js → access-I0f72P9m.js} +1 -1
  174. package/webapp/dist/assets/{admin-data-table-BKSDI8sU.js → admin-data-table-CAEL2f-m.js} +1 -1
  175. package/webapp/dist/assets/{alert-uBG6r9NW.js → alert-BdJ2uaY0.js} +1 -1
  176. package/webapp/dist/assets/{alerts-CzN6OqX5.js → alerts-DeVkMXWo.js} +1 -1
  177. package/webapp/dist/assets/{apps-G_Lm6m4F.js → apps-9SuDvyGQ.js} +1 -1
  178. package/webapp/dist/assets/{audit-CLMpdBzG.js → audit-DT8cY7Ys.js} +1 -1
  179. package/webapp/dist/assets/backend-status.store-BbBE9cn8.js +4 -0
  180. package/webapp/dist/assets/{card-DkH32gMY.js → card-DaUEmUI5.js} +1 -1
  181. package/webapp/dist/assets/{chart-BpGXlCJc.js → chart-BKXP2ter.js} +1 -1
  182. package/webapp/dist/assets/{client-DFnuv2z3.js → client-CgyTwq9g.js} +1 -1
  183. package/webapp/dist/assets/{code-editor-DK6Tmmxv.js → code-editor-JVuQ4m-z.js} +1 -1
  184. package/webapp/dist/assets/{comparison-bars-BtC0dHjF.js → comparison-bars-Ds5Dt1oj.js} +1 -1
  185. package/webapp/dist/assets/{confirm-dialog-BbGsAz7_.js → confirm-dialog-BayExVbF.js} +1 -1
  186. package/webapp/dist/assets/{console-keyboard-D3YCA0yU.js → console-keyboard-uSLt92dB.js} +1 -1
  187. package/webapp/dist/assets/{containers-BsFwprq4.js → containers-DkXTgcrY.js} +1 -1
  188. package/webapp/dist/assets/{controls-C5W8gHU4.js → controls-CqeGPnaF.js} +1 -1
  189. package/webapp/dist/assets/{dashboard-BN7rKE5n.js → dashboard-By5yPuOf.js} +1 -1
  190. package/webapp/dist/assets/{dashboard-builder-BXFxWjXP.js → dashboard-builder-C0hvBwkd.js} +1 -1
  191. package/webapp/dist/assets/{deploy-progress-CUUwlYtQ.js → deploy-progress-B39cvvCE.js} +1 -1
  192. package/webapp/dist/assets/{deploy-release-dialog-58lGZDNk.js → deploy-release-dialog-CnzaO_xL.js} +1 -1
  193. package/webapp/dist/assets/{deployments-DEzjHerg.js → deployments-BXP943hA.js} +1 -1
  194. package/webapp/dist/assets/{detail-pXPk4O0E.js → detail-B84RgiOb.js} +1 -1
  195. package/webapp/dist/assets/{detail-Dj3gxaH0.js → detail-CVXDks9-.js} +1 -1
  196. package/webapp/dist/assets/{detail-CBn9pjJU.js → detail-D9DixtaK.js} +1 -1
  197. package/webapp/dist/assets/{empty-content-7jOFhG4C.js → empty-content-eyDOuOVp.js} +1 -1
  198. package/webapp/dist/assets/{error-boundary-CLLI8PWw.js → error-boundary-CQmDr_HS.js} +1 -1
  199. package/webapp/dist/assets/{event-fields-CiyqrRO8.js → event-fields-C7p2a2HY.js} +1 -1
  200. package/webapp/dist/assets/{files-DigwXndm.js → files-BsfGT3t6.js} +2 -2
  201. package/webapp/dist/assets/{icons-OboZgWSt.js → icons-B9Ct8PJ9.js} +1 -1
  202. package/webapp/dist/assets/index-BEfv96EF.js +1 -0
  203. package/webapp/dist/assets/{label-B1SF0RTL.js → label-avMhe08g.js} +1 -1
  204. package/webapp/dist/assets/{log-level-filter-Bcn31D1F.js → log-level-filter-oaUGdbpk.js} +1 -1
  205. package/webapp/dist/assets/{logs-DrsBbLfb.js → logs-iC1OEDv3.js} +1 -1
  206. package/webapp/dist/assets/{metric-chart-M-kI-XOt.js → metric-chart-CSa_qv4F.js} +1 -1
  207. package/webapp/dist/assets/{metrics-D5cDZTEo.js → metrics-CKCmcGKw.js} +1 -1
  208. package/webapp/dist/assets/{mui-Cd711nOk.js → mui-B3fJdIMc.js} +1 -1
  209. package/webapp/dist/assets/{mui-CdB_p2lt.js → mui-Bdr6Ks5j.js} +1 -1
  210. package/webapp/dist/assets/{mui-Db5J-QUd.js → mui-CADnFGCx.js} +1 -1
  211. package/webapp/dist/assets/{mui-AnEgAVjz.js → mui-CMWGTMXv.js} +1 -1
  212. package/webapp/dist/assets/{mui-DyT2n1lx.js → mui-CN3dT7bb.js} +1 -1
  213. package/webapp/dist/assets/{mui-BwsIrivo.js → mui-CPEkFAPo.js} +1 -1
  214. package/webapp/dist/assets/{mui-dLCwWoMw.js → mui-D3qAWvfZ.js} +1 -1
  215. package/webapp/dist/assets/{mui-D5m7fDCh.js → mui-D7tBU80e.js} +1 -1
  216. package/webapp/dist/assets/{mui-59N0OVRa.js → mui-DaJavAoc.js} +1 -1
  217. package/webapp/dist/assets/{mui-BXSXx9c9.js → mui-SNRRJ_vi.js} +1 -1
  218. package/webapp/dist/assets/{nodes-CwwZZuu4.js → nodes-DtLyXH0V.js} +1 -1
  219. package/webapp/dist/assets/{operation-status-Bm1x1wTz.js → operation-status-DHyYOT7G.js} +1 -1
  220. package/webapp/dist/assets/{page-breadcrumbs-fR7Jmpp4.js → page-breadcrumbs-3R8RZ3nA.js} +1 -1
  221. package/webapp/dist/assets/pipelines-Do2NAAqK.js +3 -0
  222. package/webapp/dist/assets/{project.store-DuCgv6Eq.js → project.store-D5IR3fo9.js} +1 -1
  223. package/webapp/dist/assets/{projects-TBAdpCeX.js → projects-BqlGbzeG.js} +1 -1
  224. package/webapp/dist/assets/{realtime.store-hfxZD2DU.js → realtime.store-C8D235-B.js} +1 -1
  225. package/webapp/dist/assets/{release-bits-BJ6i23y0.js → release-bits-IehuBssK.js} +1 -1
  226. package/webapp/dist/assets/{release-build-panel-BNXkwNE1.js → release-build-panel-C48hP_9w.js} +1 -1
  227. package/webapp/dist/assets/{release-deployment-state-gN8ZT3aq.js → release-deployment-state-BfmxZP4Y.js} +1 -1
  228. package/webapp/dist/assets/{releases-CXXKUh-v.js → releases-Cm0RV5Xu.js} +1 -1
  229. package/webapp/dist/assets/{search-input-C0MHI8vO.js → search-input-SWD1dXxD.js} +1 -1
  230. package/webapp/dist/assets/settings-DwuEPQGg.js +1 -0
  231. package/webapp/dist/assets/sign-in-CQ-WeS5A.js +1 -0
  232. package/webapp/dist/assets/{skeleton-BmWDJWF9.js → skeleton-BnVxAoeX.js} +1 -1
  233. package/webapp/dist/assets/{snackbar-DSPmjMyi.js → snackbar-CRX6eqRT.js} +1 -1
  234. package/webapp/dist/assets/{stack-health-status-BIv2C10x.js → stack-health-status-DfErRNb1.js} +1 -1
  235. package/webapp/dist/assets/{stack-start-notice-D-AH_bzn.js → stack-start-notice-NkYDjR-f.js} +1 -1
  236. package/webapp/dist/assets/{stacks-WY_ynkON.js → stacks-BOGCfW90.js} +1 -1
  237. package/webapp/dist/assets/{store-bqUBn2A4.js → store-DtTtbc9H.js} +1 -1
  238. package/webapp/dist/assets/{system-info-DXMwo6gl.js → system-info-Cw-xywgI.js} +1 -1
  239. package/webapp/dist/assets/{table-BOWT6Y9d.js → table-D-so_B1p.js} +1 -1
  240. package/webapp/dist/assets/{table-viewport-Bp4pq-c_.js → table-viewport-DdZ1yAKm.js} +1 -1
  241. package/webapp/dist/assets/{tabs-k5NPGLnJ.js → tabs-DGqBkXh_.js} +1 -1
  242. package/webapp/dist/assets/{terminal-QWBau-Us.js → terminal-Bbl0XNeB.js} +1 -1
  243. package/webapp/dist/assets/{topology-C_Qp1RqW.js → topology-DmrRy7nN.js} +1 -1
  244. package/webapp/dist/assets/{topology-metadata-dialog-BivuU2y6.js → topology-metadata-dialog-Dpfp4YF1.js} +1 -1
  245. package/webapp/dist/assets/{traces-By0rdfDC.js → traces-CKHsOabJ.js} +1 -1
  246. package/webapp/dist/assets/{use-stack-context-8yaHaN8L.js → use-stack-context-BuraYaeY.js} +1 -1
  247. package/webapp/dist/assets/webapp-D8h_eabt.js +35 -0
  248. package/webapp/dist/console-version.json +1 -1
  249. package/webapp/dist/index.html +34 -34
  250. package/webapp/dist/logo.svg +1 -80
  251. package/bin/sdk.d.mts +0 -8
  252. package/bin/sdk.mjs +0 -580
  253. package/dist/monitoring/process-lifetime.d.ts +0 -11
  254. package/dist/monitoring/process-lifetime.d.ts.map +0 -1
  255. package/dist/monitoring/process-lifetime.js +0 -45
  256. package/dist/monitoring/process-lifetime.js.map +0 -1
  257. package/dist/shared/host-boot-identity.d.ts +0 -12
  258. package/dist/shared/host-boot-identity.d.ts.map +0 -1
  259. package/dist/shared/host-boot-identity.js +0 -89
  260. package/dist/shared/host-boot-identity.js.map +0 -1
  261. package/webapp/dist/assets/index-Bo9An3pJ.js +0 -1
  262. package/webapp/dist/assets/omnitron-logo-koMCbsCv.js +0 -1
  263. package/webapp/dist/assets/pipelines-BrfTjf6Y.js +0 -3
  264. package/webapp/dist/assets/settings-B3egRvbI.js +0 -1
  265. package/webapp/dist/assets/sign-in-9q-Nfy83.js +0 -1
  266. package/webapp/dist/assets/webapp-BO_WoB_z.js +0 -35
  267. package/webapp/dist/favicon.png +0 -0
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{h as r,t as i}from"./client-DFnuv2z3.js";import{n as a}from"./services-BddvcFi8.js";import{F as o,H as s,I as c,M as ee,Q as l,V as u,Z as te,_t as ne,at as d,c as re,d as f,f as p,g as m,gt as h,h as g,ht as ie,i as _,j as v,lt as ae,m as y,ot as b,p as x,r as S,s as C,ut as w,vt as T}from"./mui-BXSXx9c9.js";import{A as E,B as D,C as O,D as oe,F as k,I as A,O as j,a as M,b as N,d as P,f as F,k as se,o as I,w as L,y as R,z}from"./mui-Cd711nOk.js";import{d as B,f as V,g as H,h as U,it as W,l as G,m as ce,p as le,rt as ue,u as K}from"./mui-AnEgAVjz.js";import{_ as q,v as de}from"./mui-BwsIrivo.js";import{t as fe}from"./auth-CcgjP7hR.js";import{c as pe,s as me}from"./access-BvKK9dEv.js";import{n as he,t as ge}from"./use-polled-resource-B22hhr5L.js";import{G as _e,T as ve,o as ye}from"./icons-OboZgWSt.js";import{n as be,t as J}from"./operation-status-Bm1x1wTz.js";import{n as xe,t as Se}from"./table-viewport-Bp4pq-c_.js";import{n as Ce,t as we}from"./search-input-C0MHI8vO.js";import{n as Te,t as Ee}from"./page-breadcrumbs-fR7Jmpp4.js";import{i as De,n as Oe}from"./terminal-input-b7f2VoE_.js";function ke({label:e,actions:t}){let n=(0,Y.useId)(),[r,i]=(0,Y.useState)(null),a=t.filter(e=>e.color!==`error`),o=t.filter(e=>e.color===`error`),s=e=>(0,X.jsxs)(G,{disabled:e.disabled,sx:e.color?{color:`${e.color}.main`}:void 0,onClick:()=>{i(null),e.onClick()},children:[e.icon&&(0,X.jsx)(U,{sx:{color:`inherit`},children:e.icon}),(0,X.jsx)(le,{children:e.label})]},e.id);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(k,{title:e,children:(0,X.jsx)(ue,{size:`small`,id:`${n}-trigger`,"aria-label":e,"aria-haspopup":`menu`,"aria-expanded":!!r,"aria-controls":r?n:void 0,onClick:e=>{e.stopPropagation(),i(e.currentTarget)},children:(0,X.jsx)(ve,{})})}),(0,X.jsxs)(B,{id:n,anchorEl:r,open:!!r,onClose:()=>i(null),onClick:e=>e.stopPropagation(),slotProps:{list:{"aria-labelledby":`${n}-trigger`}},children:[a.map(s),a.length>0&&o.length>0&&(0,X.jsx)(S,{}),o.map(s)]})]})}var Y,X;function Ae(){return(Ae=e((()=>{Y=t(),_(),W(),H(),ce(),V(),K(),A(),_e(),X=n()})))()}function je(){let{snapshot:e,can:t}=pe(),[n,r]=(0,Z.useState)(),{data:a,error:s,refresh:c,loading:ee}=he(()=>i.listUsers(n?{after:n}:{}),{intervalMs:15e3,enabled:t(`OmnitronAccess.listUsers`),resourceKey:JSON.stringify([t(`OmnitronAccess.listUsers`),n])}),[l,re]=(0,Z.useState)(``),[p,m]=(0,Z.useState)(``),[h,_]=(0,Z.useState)(null),y=h!==null,b=(0,Z.useRef)(!1),[S,w]=(0,Z.useState)(!1),[T,E]=(0,Z.useState)(``),[D,k]=(0,Z.useState)(``),[A,j]=(0,Z.useState)(``),[N,F]=(0,Z.useState)(`viewer`),[I,L]=(0,Z.useState)(null),[B,V]=(0,Z.useState)(null),H=De(window.location),U=async(e,t)=>{if(!b.current){b.current=!0,_(e),m(``);try{await t(),await c()}catch(e){m(e instanceof Error?e.message:String(e))}finally{b.current=!1,_(null)}}},W=()=>{w(!1),j(``),E(``),k(``),F(`viewer`)},G=e?.capabilities.filter(e=>`${e.service}.${e.method}`.toLowerCase().includes(l.toLowerCase()))??[];return(0,Q.jsxs)(u,{children:[(0,Q.jsx)(Ee,{heading:`Access`,links:[{name:`System`},{name:`Access`}],sx:{mb:2}}),(0,Q.jsxs)(z,{color:`text.secondary`,sx:{mb:2},children:[`Your role: `,(0,Q.jsx)(`strong`,{children:e?.role}),`. Permissions below come from this daemon’s active RPC policy.`]}),(0,Q.jsx)(J,{active:y&&!S&&!I&&!B,label:h??``}),(p||s)&&(0,Q.jsx)(d,{severity:`error`,onClose:()=>m(``),sx:{mb:2},children:p||s}),(0,Q.jsx)(u,{sx:{mb:3},children:(0,Q.jsxs)(ne,{children:[(0,Q.jsx)(ae,{expandIcon:(0,Q.jsx)(ye,{sx:{transform:`rotate(90deg)`}}),children:(0,Q.jsx)(z,{variant:`subtitle2`,children:`Role definitions`})}),(0,Q.jsx)(ie,{children:(0,Q.jsx)(u,{sx:{display:`grid`,gridTemplateColumns:{xs:`1fr`,md:`repeat(3, 1fr)`},gap:2},children:e?.roles.map(e=>(0,Q.jsxs)(u,{children:[(0,Q.jsx)(z,{variant:`subtitle1`,children:e.label}),(0,Q.jsx)(z,{variant:`body2`,color:`text.secondary`,children:e.description})]},e.role))})})]})}),t(`OmnitronAccess.listUsers`)&&(0,Q.jsxs)(v,{sx:{p:2,mb:3},children:[(0,Q.jsxs)(q,{direction:`row`,spacing:1,sx:{alignItems:`center`,flexWrap:`wrap`,mb:1},children:[(0,Q.jsx)(z,{variant:`subtitle1`,sx:{flex:`1 1 180px`},children:`Console accounts`}),(0,Q.jsx)(o,{loading:ee||y,onClick:()=>void U(`Refreshing accounts`,c),children:`Refresh`}),(0,Q.jsx)(o,{variant:`contained`,disabled:!H||!t(`OmnitronAccess.createUser`),onClick:()=>w(!0),children:`Create account`})]}),!H&&(0,Q.jsx)(d,{severity:`warning`,children:`Use HTTPS to create accounts. Local loopback development is allowed.`}),(0,Q.jsx)(Se,{label:`Console accounts`,children:(0,Q.jsxs)(se,{size:`small`,sx:{minWidth:520},children:[(0,Q.jsx)(R,{children:(0,Q.jsxs)(P,{children:[(0,Q.jsx)(O,{children:`Account`}),(0,Q.jsx)(O,{children:`Role`}),(0,Q.jsx)(O,{children:`Last sign-in`}),(0,Q.jsx)(O,{align:`right`,children:`Actions`})]})}),(0,Q.jsx)(oe,{children:a?.users.map(n=>(0,Q.jsxs)(P,{children:[(0,Q.jsxs)(O,{children:[n.displayName||n.username,(n.displayName||n.id===e?.userId)&&(0,Q.jsxs)(z,{variant:`caption`,color:`text.secondary`,sx:{display:`block`},children:[n.displayName?n.username:``,n.id===e?.userId?n.displayName?` · you`:`you`:``]})]}),(0,Q.jsx)(O,{children:(0,Q.jsx)(te,{size:`small`,label:n.role})}),(0,Q.jsx)(O,{children:n.lastLoginAt?new Date(n.lastLoginAt).toLocaleString():`Never`}),(0,Q.jsx)(O,{align:`right`,children:(0,Q.jsx)(ke,{label:`Actions for ${n.username}`,actions:[{id:`role`,label:`Change role`,disabled:y||n.id===e?.userId||!t(`OmnitronAccess.setRole`),onClick:()=>{F(n.role===`admin`||n.role===`operator`?n.role:`viewer`),L(n)}},{id:`revoke`,label:`Revoke sessions`,color:`warning`,disabled:y||!t(`OmnitronAccess.revokeSessions`),onClick:()=>V(n)}]})})]},n.id))})]})}),(0,Q.jsxs)(q,{direction:`row`,spacing:1,sx:{mt:1,flexWrap:`wrap`},children:[(0,Q.jsx)(o,{disabled:!n,onClick:()=>r(void 0),children:`First page`}),(0,Q.jsx)(o,{disabled:!a?.next,onClick:()=>r(a?.next??void 0),children:`Next page`})]}),(0,Q.jsx)(z,{variant:`caption`,color:`text.secondary`,children:`Role changes revoke that account’s sessions. The last administrator is protected. Local CLI access follows the owner-only Unix socket policy.`})]}),(0,Q.jsxs)(v,{sx:{p:2},children:[(0,Q.jsxs)(q,{direction:`row`,spacing:2,sx:{alignItems:`center`,flexWrap:`wrap`,mb:2},children:[(0,Q.jsx)(z,{variant:`subtitle1`,sx:{flex:`1 1 180px`},children:`Effective permissions`}),(0,Q.jsx)(we,{"aria-label":`Filter service or method`,placeholder:`Service or method…`,value:l,onChange:re,sx:{flex:`1 1 240px`,minWidth:0}})]}),G.length===0?(0,Q.jsx)(z,{variant:`body2`,color:`text.secondary`,sx:{py:3},children:`No permissions match this filter.`}):(0,Q.jsx)(Se,{label:`Effective permissions`,maxHeight:560,children:(0,Q.jsxs)(se,{stickyHeader:!0,size:`small`,sx:{minWidth:620},children:[(0,Q.jsx)(R,{children:(0,Q.jsxs)(P,{children:[(0,Q.jsx)(O,{children:`Service / method`}),(0,Q.jsx)(O,{children:`Declared roles`}),(0,Q.jsx)(O,{children:`Your access`})]})}),(0,Q.jsx)(oe,{children:G.map(e=>(0,Q.jsxs)(P,{children:[(0,Q.jsxs)(O,{sx:{fontFamily:`monospace`,fontSize:12},children:[e.service,`.`,e.method]}),(0,Q.jsx)(O,{children:e.roles.join(`, `)||(e.anonymous?`Anonymous`:`Authenticated`)}),(0,Q.jsx)(O,{children:(0,Q.jsx)(te,{size:`small`,color:e.allowed?`success`:`default`,label:e.conditional?`Conditional`:e.allowed?`Allowed`:`Denied`})})]},`${e.service}.${e.method}`))})]})}),(0,Q.jsx)(z,{variant:`caption`,color:`text.secondary`,children:`Resource ownership, session validity and other contextual checks still apply when an action runs. Application roles are managed by the application.`})]}),(0,Q.jsxs)(g,{open:S&&t(`OmnitronAccess.createUser`),onClose:()=>!y&&W(),fullWidth:!0,maxWidth:`sm`,children:[(0,Q.jsx)(C,{children:`Create console account`}),(0,Q.jsxs)(f,{children:[(0,Q.jsx)(J,{active:y,label:h??``}),p&&(0,Q.jsx)(d,{severity:`error`,children:p}),(0,Q.jsxs)(q,{spacing:2,sx:{pt:1},children:[(0,Q.jsx)(M,{label:`Username`,value:T,onChange:e=>E(e.target.value),autoComplete:`off`}),(0,Q.jsx)(M,{label:`Display name`,value:D,onChange:e=>k(e.target.value)}),(0,Q.jsx)(M,{label:`Initial password`,type:`password`,autoComplete:`new-password`,value:A,onChange:e=>j(e.target.value),helperText:`At least 15 characters; share through a secure channel. The user can change it in Settings.`}),(0,Q.jsx)(Me,{value:N,onChange:F})]})]}),(0,Q.jsxs)(x,{children:[(0,Q.jsx)(o,{disabled:y,onClick:W,children:`Cancel`}),(0,Q.jsx)(o,{loading:y,disabled:y||!H||!T||!!fe(A),onClick:()=>void U(`Creating account`,async()=>{await i.createUser({username:T,displayName:D,password:A,role:N}),W()}),children:`Create account`})]})]}),(0,Q.jsxs)(g,{open:I!==null&&t(`OmnitronAccess.setRole`),onClose:()=>!y&&L(null),fullWidth:!0,maxWidth:`sm`,children:[(0,Q.jsxs)(C,{children:[`Change role for `,I?.username]}),(0,Q.jsxs)(f,{children:[(0,Q.jsx)(J,{active:y,label:h??``}),p&&(0,Q.jsx)(d,{severity:`error`,children:p}),(0,Q.jsx)(d,{severity:`warning`,sx:{mb:2},children:`All sessions for this account will be revoked, including SSH terminals. The account must sign in again.`}),(0,Q.jsx)(Me,{value:N,onChange:F})]}),(0,Q.jsxs)(x,{children:[(0,Q.jsx)(o,{disabled:y,onClick:()=>L(null),children:`Cancel`}),(0,Q.jsx)(o,{loading:y,disabled:y||!I||N===I.role,onClick:()=>void U(`Updating role`,async()=>{I&&await i.setRole({id:I.id,role:N,previous:I.role}),L(null)}),children:`Apply role`})]})]}),(0,Q.jsxs)(g,{open:B!==null&&t(`OmnitronAccess.revokeSessions`),onClose:()=>!y&&V(null),children:[(0,Q.jsxs)(C,{children:[`Revoke sessions for `,B?.username,`?`]}),(0,Q.jsxs)(f,{children:[(0,Q.jsx)(J,{active:y,label:h??``}),p&&(0,Q.jsx)(d,{severity:`error`,children:p}),`Existing sessions and SSH terminals will close. The account may sign in again with its password.`]}),(0,Q.jsxs)(x,{children:[(0,Q.jsx)(o,{disabled:y,onClick:()=>V(null),children:`Cancel`}),(0,Q.jsx)(o,{color:`warning`,loading:y,disabled:y,onClick:()=>void U(`Revoking sessions`,async()=>{B&&await i.revokeSessions({id:B.id}),V(null)}),children:`Revoke sessions`})]})]})]})}function Me({value:e,onChange:t}){let{snapshot:n}=pe();return(0,Q.jsx)(M,{select:!0,fullWidth:!0,label:`Role`,value:e,onChange:e=>t(e.target.value),children:n?.roles.map(e=>(0,Q.jsx)(G,{value:e.role,children:e.label},e.role))})}var Z,Q;function $(){return($=e((()=>{be(),Z=t(),b(),T(),w(),h(),s(),c(),ee(),l(),m(),y(),p(),re(),K(),de(),E(),j(),L(),N(),F(),I(),D(),xe(),Ce(),_e(),Ae(),Te(),a(),r(),me(),ge(),Oe(),Q=n()})))()}$();export{je as default};
1
+ import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{h as r,t as i}from"./client-CgyTwq9g.js";import{n as a}from"./services-BddvcFi8.js";import{F as o,H as s,I as c,M as ee,Q as l,V as u,Z as te,_t as ne,at as d,c as re,d as f,f as p,g as m,gt as h,h as g,ht as ie,i as _,j as v,lt as ae,m as y,ot as b,p as x,r as S,s as C,ut as w,vt as T}from"./mui-SNRRJ_vi.js";import{A as E,B as D,C as O,D as oe,F as k,I as A,O as j,a as M,b as N,d as P,f as F,k as se,o as I,w as L,y as R,z}from"./mui-B3fJdIMc.js";import{d as B,f as V,g as H,h as U,it as W,l as G,m as ce,p as le,rt as ue,u as K}from"./mui-CMWGTMXv.js";import{_ as q,v as de}from"./mui-CPEkFAPo.js";import{t as fe}from"./auth-CcgjP7hR.js";import{c as pe,s as me}from"./access-I0f72P9m.js";import{n as he,t as ge}from"./use-polled-resource-B22hhr5L.js";import{G as _e,T as ve,o as ye}from"./icons-B9Ct8PJ9.js";import{n as be,t as J}from"./operation-status-DHyYOT7G.js";import{n as xe,t as Se}from"./table-viewport-DdZ1yAKm.js";import{n as Ce,t as we}from"./search-input-SWD1dXxD.js";import{n as Te,t as Ee}from"./page-breadcrumbs-3R8RZ3nA.js";import{i as De,n as Oe}from"./terminal-input-b7f2VoE_.js";function ke({label:e,actions:t}){let n=(0,Y.useId)(),[r,i]=(0,Y.useState)(null),a=t.filter(e=>e.color!==`error`),o=t.filter(e=>e.color===`error`),s=e=>(0,X.jsxs)(G,{disabled:e.disabled,sx:e.color?{color:`${e.color}.main`}:void 0,onClick:()=>{i(null),e.onClick()},children:[e.icon&&(0,X.jsx)(U,{sx:{color:`inherit`},children:e.icon}),(0,X.jsx)(le,{children:e.label})]},e.id);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(k,{title:e,children:(0,X.jsx)(ue,{size:`small`,id:`${n}-trigger`,"aria-label":e,"aria-haspopup":`menu`,"aria-expanded":!!r,"aria-controls":r?n:void 0,onClick:e=>{e.stopPropagation(),i(e.currentTarget)},children:(0,X.jsx)(ve,{})})}),(0,X.jsxs)(B,{id:n,anchorEl:r,open:!!r,onClose:()=>i(null),onClick:e=>e.stopPropagation(),slotProps:{list:{"aria-labelledby":`${n}-trigger`}},children:[a.map(s),a.length>0&&o.length>0&&(0,X.jsx)(S,{}),o.map(s)]})]})}var Y,X;function Ae(){return(Ae=e((()=>{Y=t(),_(),W(),H(),ce(),V(),K(),A(),_e(),X=n()})))()}function je(){let{snapshot:e,can:t}=pe(),[n,r]=(0,Z.useState)(),{data:a,error:s,refresh:c,loading:ee}=he(()=>i.listUsers(n?{after:n}:{}),{intervalMs:15e3,enabled:t(`OmnitronAccess.listUsers`),resourceKey:JSON.stringify([t(`OmnitronAccess.listUsers`),n])}),[l,re]=(0,Z.useState)(``),[p,m]=(0,Z.useState)(``),[h,_]=(0,Z.useState)(null),y=h!==null,b=(0,Z.useRef)(!1),[S,w]=(0,Z.useState)(!1),[T,E]=(0,Z.useState)(``),[D,k]=(0,Z.useState)(``),[A,j]=(0,Z.useState)(``),[N,F]=(0,Z.useState)(`viewer`),[I,L]=(0,Z.useState)(null),[B,V]=(0,Z.useState)(null),H=De(window.location),U=async(e,t)=>{if(!b.current){b.current=!0,_(e),m(``);try{await t(),await c()}catch(e){m(e instanceof Error?e.message:String(e))}finally{b.current=!1,_(null)}}},W=()=>{w(!1),j(``),E(``),k(``),F(`viewer`)},G=e?.capabilities.filter(e=>`${e.service}.${e.method}`.toLowerCase().includes(l.toLowerCase()))??[];return(0,Q.jsxs)(u,{children:[(0,Q.jsx)(Ee,{heading:`Access`,links:[{name:`System`},{name:`Access`}],sx:{mb:2}}),(0,Q.jsxs)(z,{color:`text.secondary`,sx:{mb:2},children:[`Your role: `,(0,Q.jsx)(`strong`,{children:e?.role}),`. Permissions below come from this daemon’s active RPC policy.`]}),(0,Q.jsx)(J,{active:y&&!S&&!I&&!B,label:h??``}),(p||s)&&(0,Q.jsx)(d,{severity:`error`,onClose:()=>m(``),sx:{mb:2},children:p||s}),(0,Q.jsx)(u,{sx:{mb:3},children:(0,Q.jsxs)(ne,{children:[(0,Q.jsx)(ae,{expandIcon:(0,Q.jsx)(ye,{sx:{transform:`rotate(90deg)`}}),children:(0,Q.jsx)(z,{variant:`subtitle2`,children:`Role definitions`})}),(0,Q.jsx)(ie,{children:(0,Q.jsx)(u,{sx:{display:`grid`,gridTemplateColumns:{xs:`1fr`,md:`repeat(3, 1fr)`},gap:2},children:e?.roles.map(e=>(0,Q.jsxs)(u,{children:[(0,Q.jsx)(z,{variant:`subtitle1`,children:e.label}),(0,Q.jsx)(z,{variant:`body2`,color:`text.secondary`,children:e.description})]},e.role))})})]})}),t(`OmnitronAccess.listUsers`)&&(0,Q.jsxs)(v,{sx:{p:2,mb:3},children:[(0,Q.jsxs)(q,{direction:`row`,spacing:1,sx:{alignItems:`center`,flexWrap:`wrap`,mb:1},children:[(0,Q.jsx)(z,{variant:`subtitle1`,sx:{flex:`1 1 180px`},children:`Console accounts`}),(0,Q.jsx)(o,{loading:ee||y,onClick:()=>void U(`Refreshing accounts`,c),children:`Refresh`}),(0,Q.jsx)(o,{variant:`contained`,disabled:!H||!t(`OmnitronAccess.createUser`),onClick:()=>w(!0),children:`Create account`})]}),!H&&(0,Q.jsx)(d,{severity:`warning`,children:`Use HTTPS to create accounts. Local loopback development is allowed.`}),(0,Q.jsx)(Se,{label:`Console accounts`,children:(0,Q.jsxs)(se,{size:`small`,sx:{minWidth:520},children:[(0,Q.jsx)(R,{children:(0,Q.jsxs)(P,{children:[(0,Q.jsx)(O,{children:`Account`}),(0,Q.jsx)(O,{children:`Role`}),(0,Q.jsx)(O,{children:`Last sign-in`}),(0,Q.jsx)(O,{align:`right`,children:`Actions`})]})}),(0,Q.jsx)(oe,{children:a?.users.map(n=>(0,Q.jsxs)(P,{children:[(0,Q.jsxs)(O,{children:[n.displayName||n.username,(n.displayName||n.id===e?.userId)&&(0,Q.jsxs)(z,{variant:`caption`,color:`text.secondary`,sx:{display:`block`},children:[n.displayName?n.username:``,n.id===e?.userId?n.displayName?` · you`:`you`:``]})]}),(0,Q.jsx)(O,{children:(0,Q.jsx)(te,{size:`small`,label:n.role})}),(0,Q.jsx)(O,{children:n.lastLoginAt?new Date(n.lastLoginAt).toLocaleString():`Never`}),(0,Q.jsx)(O,{align:`right`,children:(0,Q.jsx)(ke,{label:`Actions for ${n.username}`,actions:[{id:`role`,label:`Change role`,disabled:y||n.id===e?.userId||!t(`OmnitronAccess.setRole`),onClick:()=>{F(n.role===`admin`||n.role===`operator`?n.role:`viewer`),L(n)}},{id:`revoke`,label:`Revoke sessions`,color:`warning`,disabled:y||!t(`OmnitronAccess.revokeSessions`),onClick:()=>V(n)}]})})]},n.id))})]})}),(0,Q.jsxs)(q,{direction:`row`,spacing:1,sx:{mt:1,flexWrap:`wrap`},children:[(0,Q.jsx)(o,{disabled:!n,onClick:()=>r(void 0),children:`First page`}),(0,Q.jsx)(o,{disabled:!a?.next,onClick:()=>r(a?.next??void 0),children:`Next page`})]}),(0,Q.jsx)(z,{variant:`caption`,color:`text.secondary`,children:`Role changes revoke that account’s sessions. The last administrator is protected. Local CLI access follows the owner-only Unix socket policy.`})]}),(0,Q.jsxs)(v,{sx:{p:2},children:[(0,Q.jsxs)(q,{direction:`row`,spacing:2,sx:{alignItems:`center`,flexWrap:`wrap`,mb:2},children:[(0,Q.jsx)(z,{variant:`subtitle1`,sx:{flex:`1 1 180px`},children:`Effective permissions`}),(0,Q.jsx)(we,{"aria-label":`Filter service or method`,placeholder:`Service or method…`,value:l,onChange:re,sx:{flex:`1 1 240px`,minWidth:0}})]}),G.length===0?(0,Q.jsx)(z,{variant:`body2`,color:`text.secondary`,sx:{py:3},children:`No permissions match this filter.`}):(0,Q.jsx)(Se,{label:`Effective permissions`,maxHeight:560,children:(0,Q.jsxs)(se,{stickyHeader:!0,size:`small`,sx:{minWidth:620},children:[(0,Q.jsx)(R,{children:(0,Q.jsxs)(P,{children:[(0,Q.jsx)(O,{children:`Service / method`}),(0,Q.jsx)(O,{children:`Declared roles`}),(0,Q.jsx)(O,{children:`Your access`})]})}),(0,Q.jsx)(oe,{children:G.map(e=>(0,Q.jsxs)(P,{children:[(0,Q.jsxs)(O,{sx:{fontFamily:`monospace`,fontSize:12},children:[e.service,`.`,e.method]}),(0,Q.jsx)(O,{children:e.roles.join(`, `)||(e.anonymous?`Anonymous`:`Authenticated`)}),(0,Q.jsx)(O,{children:(0,Q.jsx)(te,{size:`small`,color:e.allowed?`success`:`default`,label:e.conditional?`Conditional`:e.allowed?`Allowed`:`Denied`})})]},`${e.service}.${e.method}`))})]})}),(0,Q.jsx)(z,{variant:`caption`,color:`text.secondary`,children:`Resource ownership, session validity and other contextual checks still apply when an action runs. Application roles are managed by the application.`})]}),(0,Q.jsxs)(g,{open:S&&t(`OmnitronAccess.createUser`),onClose:()=>!y&&W(),fullWidth:!0,maxWidth:`sm`,children:[(0,Q.jsx)(C,{children:`Create console account`}),(0,Q.jsxs)(f,{children:[(0,Q.jsx)(J,{active:y,label:h??``}),p&&(0,Q.jsx)(d,{severity:`error`,children:p}),(0,Q.jsxs)(q,{spacing:2,sx:{pt:1},children:[(0,Q.jsx)(M,{label:`Username`,value:T,onChange:e=>E(e.target.value),autoComplete:`off`}),(0,Q.jsx)(M,{label:`Display name`,value:D,onChange:e=>k(e.target.value)}),(0,Q.jsx)(M,{label:`Initial password`,type:`password`,autoComplete:`new-password`,value:A,onChange:e=>j(e.target.value),helperText:`At least 15 characters; share through a secure channel. The user can change it in Settings.`}),(0,Q.jsx)(Me,{value:N,onChange:F})]})]}),(0,Q.jsxs)(x,{children:[(0,Q.jsx)(o,{disabled:y,onClick:W,children:`Cancel`}),(0,Q.jsx)(o,{loading:y,disabled:y||!H||!T||!!fe(A),onClick:()=>void U(`Creating account`,async()=>{await i.createUser({username:T,displayName:D,password:A,role:N}),W()}),children:`Create account`})]})]}),(0,Q.jsxs)(g,{open:I!==null&&t(`OmnitronAccess.setRole`),onClose:()=>!y&&L(null),fullWidth:!0,maxWidth:`sm`,children:[(0,Q.jsxs)(C,{children:[`Change role for `,I?.username]}),(0,Q.jsxs)(f,{children:[(0,Q.jsx)(J,{active:y,label:h??``}),p&&(0,Q.jsx)(d,{severity:`error`,children:p}),(0,Q.jsx)(d,{severity:`warning`,sx:{mb:2},children:`All sessions for this account will be revoked, including SSH terminals. The account must sign in again.`}),(0,Q.jsx)(Me,{value:N,onChange:F})]}),(0,Q.jsxs)(x,{children:[(0,Q.jsx)(o,{disabled:y,onClick:()=>L(null),children:`Cancel`}),(0,Q.jsx)(o,{loading:y,disabled:y||!I||N===I.role,onClick:()=>void U(`Updating role`,async()=>{I&&await i.setRole({id:I.id,role:N,previous:I.role}),L(null)}),children:`Apply role`})]})]}),(0,Q.jsxs)(g,{open:B!==null&&t(`OmnitronAccess.revokeSessions`),onClose:()=>!y&&V(null),children:[(0,Q.jsxs)(C,{children:[`Revoke sessions for `,B?.username,`?`]}),(0,Q.jsxs)(f,{children:[(0,Q.jsx)(J,{active:y,label:h??``}),p&&(0,Q.jsx)(d,{severity:`error`,children:p}),`Existing sessions and SSH terminals will close. The account may sign in again with its password.`]}),(0,Q.jsxs)(x,{children:[(0,Q.jsx)(o,{disabled:y,onClick:()=>V(null),children:`Cancel`}),(0,Q.jsx)(o,{color:`warning`,loading:y,disabled:y,onClick:()=>void U(`Revoking sessions`,async()=>{B&&await i.revokeSessions({id:B.id}),V(null)}),children:`Revoke sessions`})]})]})]})}function Me({value:e,onChange:t}){let{snapshot:n}=pe();return(0,Q.jsx)(M,{select:!0,fullWidth:!0,label:`Role`,value:e,onChange:e=>t(e.target.value),children:n?.roles.map(e=>(0,Q.jsx)(G,{value:e.role,children:e.label},e.role))})}var Z,Q;function $(){return($=e((()=>{be(),Z=t(),b(),T(),w(),h(),s(),c(),ee(),l(),m(),y(),p(),re(),K(),de(),E(),j(),L(),N(),F(),I(),D(),xe(),Ce(),_e(),Ae(),Te(),a(),r(),me(),ge(),Oe(),Q=n()})))()}$();export{je as default};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{B as r,h as i,t as a,z as o}from"./client-DFnuv2z3.js";import{dn as s,un as c}from"./mui-CdB_p2lt.js";import{F as l,I as u,at as d,ot as f}from"./mui-BXSXx9c9.js";import{E as p,T as m,nt as h,tt as g}from"./mui-AnEgAVjz.js";import{n as _,t as v}from"./store-bqUBn2A4.js";import{n as y,t as b}from"./use-polled-resource-B22hhr5L.js";import{i as x,t as S}from"./project.store-DuCgv6Eq.js";function C({portal:e,slots:t,slotProps:n,sx:r,...i}){return(0,T.jsx)(e?g:w.Fragment,{children:(0,T.jsx)(E,{sx:r,...i,children:t?.progress??(0,T.jsx)(m,{color:`inherit`,sx:[{width:1,maxWidth:360},...Array.isArray(n?.progress?.sx)?n.progress.sx:[n?.progress?.sx]],...n?.progress})})})}var w,T,E;function D(){return(D=e((()=>{w=t(),h(),c(),p(),T=n(),E=s(`div`)(({theme:e})=>({flexGrow:1,width:`100%`,display:`flex`,minHeight:`100%`,alignItems:`center`,justifyContent:`center`,paddingLeft:e.spacing(5),paddingRight:e.spacing(5)}))})))()}function O({children:e,useAuth:t,roles:n=[],permissions:r=[],permissionStrategy:i=`all`,requireEmailVerified:a=!1,roleMatchStrategy:o=`any`,loadingComponent:s=null,onAccessDenied:c,accessDeniedComponent:l=null}){let{isAuthenticated:u,isLoading:d,user:f}=t(),p=null;return!u||!f?p=`not_authenticated`:a&&!f.emailVerified?p=`email_not_verified`:n.length>0&&!k(f,n,o)?p=`missing_role`:r.length>0&&!A(f,r,i)&&(p=`missing_permission`),(0,j.useEffect)(()=>{!d&&p&&c?.(p)},[d,p,c]),d?s:p?l:e}function k(e,t,n=`any`){if(!e?.roles?.length)return!1;let r=Array.isArray(t)?t:[t];return r.length===0?!1:n===`all`?r.every(t=>e.roles.includes(t)):r.some(t=>e.roles.includes(t))}function A(e,t,n=`all`){if(!e?.permissions?.length)return!1;let r=Array.isArray(t)?t:[t];return r.length===0?!1:n===`all`?r.every(t=>e.permissions.includes(t)):r.some(t=>e.permissions.includes(t))}var j;function M(){return(M=e((()=>{j=t()})))()}function N({children:e}){let t=_(e=>e.user),{data:n,error:r,refresh:i}=y(()=>a.describe(),{intervalMs:15e3,enabled:!!t,resourceKey:t?.id??null}),o=!r&&n?.userId===t?.id?n??null:null;(0,z.useEffect)(()=>{o&&t&&o.role!==t.role&&_.getState().setUser({...t,role:o.role})},[o,t]);let s=(0,z.useMemo)(()=>{let e=o?{id:o.userId,roles:[o.role],permissions:o.capabilities.filter(e=>e.allowed).map(e=>`${e.service}.${e.method}`)}:null;return{snapshot:o,authorization:{isAuthenticated:!!t,isLoading:!o&&!r,user:e},can:t=>A(e,t),refresh:i,error:r??null}},[o,t,r,i]),c=s.can(`OmnitronProject.listStacks`)?o?.userId??null:null,l=s.can(`OmnitronProject.listProjects`)?o?.userId??null:null;return(0,z.useLayoutEffect)(()=>{x.getState().setInventoryReaders(l,c)},[l,c]),(0,z.useLayoutEffect)(()=>()=>x.getState().setInventoryReaders(null,null),[]),(0,B.jsx)(V.Provider,{value:s,children:e})}function P(){return H().authorization}function F({permission:e,children:t}){let{can:n}=H();return n(e)?t:null}function I(e,t){return!t||(Array.isArray(t)?t.some(e):e(t))}function L({permission:e,children:t}){let{error:n,refresh:r}=H();return n?(0,B.jsxs)(d,{severity:`error`,action:(0,B.jsx)(l,{onClick:()=>void r(),children:`Retry`}),children:[`Could not verify your access. `,n]}):(0,B.jsx)(O,{useAuth:P,permissions:Array.isArray(e)?e:[e],permissionStrategy:`any`,loadingComponent:(0,B.jsx)(C,{}),accessDeniedComponent:(0,B.jsx)(d,{severity:`info`,children:`Your account does not have access to this area. See Access for your current permissions.`}),children:t})}function R({children:e}){let{pathname:t}=r(),n=U[t.split(`/`)[1]||`dashboard`];return n?(0,B.jsx)(L,{permission:n,children:e}):e}var z,B,V,H,U;function W(){return(W=e((()=>{z=t(),f(),u(),D(),M(),o(),i(),b(),v(),S(),B=n(),V=(0,z.createContext)({snapshot:null,authorization:{isAuthenticated:!1,isLoading:!0},can:()=>!1,refresh:async()=>{},error:null}),H=()=>(0,z.useContext)(V),U={dashboard:`OmnitronDaemon.status`,"dashboard-builder":[`OmnitronDaemon.status`,`OmnitronProject.getProjectApps`,`OmnitronMetrics.querySeries`,`OmnitronAlerts.getSummary`],apps:`OmnitronDaemon.list`,nodes:`OmnitronNodes.listNodes`,terminal:`OmnitronTerminal.open`,files:`OmnitronFiles.roots`,projects:`OmnitronProject.listProjects`,system:`OmnitronSystemInfo.getSnapshot`,logs:`OmnitronLogs.queryLogs`,audit:`OmnitronAudit.list`,access:`OmnitronAccess.describe`,releases:`OmnitronRelease.list`,stacks:`OmnitronProject.listStacks`,metrics:`OmnitronMetrics.getSnapshot`,topology:`OmnitronNodes.listNodes`,containers:`OmnitronInfra.getState`,deployments:[`OmnitronProject.getDeployProgress`,`OmnitronRelease.deployments`,`OmnitronDeploy.getHistory`],alerts:`OmnitronAlerts.getRules`,pipelines:`OmnitronPipelines.listPipelines`,traces:`OmnitronTraces.queryTraces`}})))()}export{R as a,H as c,U as i,C as l,F as n,I as o,N as r,W as s,L as t,D as u};
1
+ import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{B as r,h as i,t as a,z as o}from"./client-CgyTwq9g.js";import{dn as s,un as c}from"./mui-Bdr6Ks5j.js";import{F as l,I as u,at as d,ot as f}from"./mui-SNRRJ_vi.js";import{E as p,T as m,nt as h,tt as g}from"./mui-CMWGTMXv.js";import{n as _,t as v}from"./store-DtTtbc9H.js";import{n as y,t as b}from"./use-polled-resource-B22hhr5L.js";import{i as x,t as S}from"./project.store-D5IR3fo9.js";function C({portal:e,slots:t,slotProps:n,sx:r,...i}){return(0,T.jsx)(e?g:w.Fragment,{children:(0,T.jsx)(E,{sx:r,...i,children:t?.progress??(0,T.jsx)(m,{color:`inherit`,sx:[{width:1,maxWidth:360},...Array.isArray(n?.progress?.sx)?n.progress.sx:[n?.progress?.sx]],...n?.progress})})})}var w,T,E;function D(){return(D=e((()=>{w=t(),h(),c(),p(),T=n(),E=s(`div`)(({theme:e})=>({flexGrow:1,width:`100%`,display:`flex`,minHeight:`100%`,alignItems:`center`,justifyContent:`center`,paddingLeft:e.spacing(5),paddingRight:e.spacing(5)}))})))()}function O({children:e,useAuth:t,roles:n=[],permissions:r=[],permissionStrategy:i=`all`,requireEmailVerified:a=!1,roleMatchStrategy:o=`any`,loadingComponent:s=null,onAccessDenied:c,accessDeniedComponent:l=null}){let{isAuthenticated:u,isLoading:d,user:f}=t(),p=null;return!u||!f?p=`not_authenticated`:a&&!f.emailVerified?p=`email_not_verified`:n.length>0&&!k(f,n,o)?p=`missing_role`:r.length>0&&!A(f,r,i)&&(p=`missing_permission`),(0,j.useEffect)(()=>{!d&&p&&c?.(p)},[d,p,c]),d?s:p?l:e}function k(e,t,n=`any`){if(!e?.roles?.length)return!1;let r=Array.isArray(t)?t:[t];return r.length===0?!1:n===`all`?r.every(t=>e.roles.includes(t)):r.some(t=>e.roles.includes(t))}function A(e,t,n=`all`){if(!e?.permissions?.length)return!1;let r=Array.isArray(t)?t:[t];return r.length===0?!1:n===`all`?r.every(t=>e.permissions.includes(t)):r.some(t=>e.permissions.includes(t))}var j;function M(){return(M=e((()=>{j=t()})))()}function N({children:e}){let t=_(e=>e.user),{data:n,error:r,refresh:i}=y(()=>a.describe(),{intervalMs:15e3,enabled:!!t,resourceKey:t?.id??null}),o=!r&&n?.userId===t?.id?n??null:null;(0,z.useEffect)(()=>{o&&t&&o.role!==t.role&&_.getState().setUser({...t,role:o.role})},[o,t]);let s=(0,z.useMemo)(()=>{let e=o?{id:o.userId,roles:[o.role],permissions:o.capabilities.filter(e=>e.allowed).map(e=>`${e.service}.${e.method}`)}:null;return{snapshot:o,authorization:{isAuthenticated:!!t,isLoading:!o&&!r,user:e},can:t=>A(e,t),refresh:i,error:r??null}},[o,t,r,i]),c=s.can(`OmnitronProject.listStacks`)?o?.userId??null:null,l=s.can(`OmnitronProject.listProjects`)?o?.userId??null:null;return(0,z.useLayoutEffect)(()=>{x.getState().setInventoryReaders(l,c)},[l,c]),(0,z.useLayoutEffect)(()=>()=>x.getState().setInventoryReaders(null,null),[]),(0,B.jsx)(V.Provider,{value:s,children:e})}function P(){return H().authorization}function F({permission:e,children:t}){let{can:n}=H();return n(e)?t:null}function I(e,t){return!t||(Array.isArray(t)?t.some(e):e(t))}function L({permission:e,children:t}){let{error:n,refresh:r}=H();return n?(0,B.jsxs)(d,{severity:`error`,action:(0,B.jsx)(l,{onClick:()=>void r(),children:`Retry`}),children:[`Could not verify your access. `,n]}):(0,B.jsx)(O,{useAuth:P,permissions:Array.isArray(e)?e:[e],permissionStrategy:`any`,loadingComponent:(0,B.jsx)(C,{}),accessDeniedComponent:(0,B.jsx)(d,{severity:`info`,children:`Your account does not have access to this area. See Access for your current permissions.`}),children:t})}function R({children:e}){let{pathname:t}=r(),n=U[t.split(`/`)[1]||`dashboard`];return n?(0,B.jsx)(L,{permission:n,children:e}):e}var z,B,V,H,U;function W(){return(W=e((()=>{z=t(),f(),u(),D(),M(),o(),i(),b(),v(),S(),B=n(),V=(0,z.createContext)({snapshot:null,authorization:{isAuthenticated:!1,isLoading:!0},can:()=>!1,refresh:async()=>{},error:null}),H=()=>(0,z.useContext)(V),U={dashboard:`OmnitronDaemon.status`,"dashboard-builder":[`OmnitronDaemon.status`,`OmnitronProject.getProjectApps`,`OmnitronMetrics.querySeries`,`OmnitronAlerts.getSummary`],apps:`OmnitronDaemon.list`,nodes:`OmnitronNodes.listNodes`,terminal:`OmnitronTerminal.open`,files:`OmnitronFiles.roots`,projects:`OmnitronProject.listProjects`,system:`OmnitronSystemInfo.getSnapshot`,logs:`OmnitronLogs.queryLogs`,audit:`OmnitronAudit.list`,access:`OmnitronAccess.describe`,releases:`OmnitronRelease.list`,stacks:`OmnitronProject.listStacks`,metrics:`OmnitronMetrics.getSnapshot`,topology:`OmnitronNodes.listNodes`,containers:`OmnitronInfra.getState`,deployments:[`OmnitronProject.getDeployProgress`,`OmnitronRelease.deployments`,`OmnitronDeploy.getHistory`],alerts:`OmnitronAlerts.getRules`,pipelines:`OmnitronPipelines.listPipelines`,traces:`OmnitronTraces.queryTraces`}})))()}export{R as a,H as c,U as i,C as l,F as n,I as o,N as r,W as s,L as t,D as u};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{Vt as r,Yt as i}from"./mui-BTN91yBK.js";import{dn as a,un as o}from"./mui-CdB_p2lt.js";import{C as s,H as c,V as l,w as u}from"./mui-BXSXx9c9.js";import{A as d,B as f,C as p,D as m,O as h,b as g,d as _,f as v,g as y,h as b,k as x,l as ee,u as S,w as C,y as w,z as T}from"./mui-Cd711nOk.js";import{ct as E,st as D}from"./mui-AnEgAVjz.js";import{S as O,_ as k,v as A,x as j}from"./mui-BwsIrivo.js";import{j as M,p as te}from"./controls-C5W8gHU4.js";import{n as N,r as ne,t as P}from"./table-viewport-Bp4pq-c_.js";function F({columns:e,data:t,total:n,loading:i=!1,loadingRows:a=5,page:o,pageSize:c,onPageChange:u,onPageSizeChange:d,sortBy:f,sortOrder:h=`asc`,onSort:g,emptyMessage:v=`No data found`,loadError:y=null,loadErrorLabels:S,rowKey:C,onRowClick:w,rowSx:E,renderExpanded:D,pageSizeOptions:O=[10,25,50,100],stickyHeader:A=!1,dense:M=!1,maxHeight:N,minWidth:F,scrollLabel:H,paginationLabels:U,sx:W,selectable:G=!1,selectedKeys:K,onSelectionChange:q,bulkActions:J}){let Y=(0,I.useCallback)((e,t)=>{if(C)return C(e);let n=e;return n.id===void 0?String(t):String(n.id)},[C,G]),X=K??V,Z=(0,I.useMemo)(()=>G?t.map((e,t)=>Y(e,t)):[],[G,t,Y]),Q=Z.length>0&&Z.every(e=>X.has(e)),re=!Q&&Z.some(e=>X.has(e)),ie=(0,I.useCallback)(()=>{if(!q)return;let e=new Set(X);Q?Z.forEach(t=>e.delete(t)):Z.forEach(t=>e.add(t)),q(e)},[q,X,Q,Z]),ae=(0,I.useCallback)(e=>{if(!q)return;let t=new Set(X);t.has(e)?t.delete(e):t.add(e),q(t)},[q,X]),oe=(0,I.useCallback)(e=>{g?.(e)},[g]),se=(0,I.useCallback)((e,t)=>{u(t)},[u]),ce=(0,I.useCallback)(e=>{d?.(parseInt(e.target.value,10)),u(0)},[d,u]),$=Math.max(1,Math.min(c,a)),le=(0,I.useMemo)(()=>Array.from({length:$},(t,n)=>(0,L.jsxs)(_,{children:[G&&(0,L.jsx)(p,{padding:`checkbox`,children:(0,L.jsx)(j,{variant:`rectangular`,width:18,height:18,sx:{borderRadius:.5}})}),e.map(e=>(0,L.jsx)(p,{align:e.align??`left`,children:(0,L.jsx)(j,{variant:`text`,width:e.align===`right`?`60%`:`80%`,sx:{ml:e.align===`right`?`auto`:0,borderRadius:.5}})},e.key))]},`skeleton-${n}`)),[$,e,G]),ue=G&&X.size>0&&!!J;return!i&&t.length===0?(0,L.jsxs)(R,{sx:W,children:[(0,L.jsx)(P,{label:H,children:(0,L.jsx)(x,{sx:{minWidth:F},size:M?`small`:`medium`,stickyHeader:A,children:(0,L.jsx)(z,{children:(0,L.jsxs)(_,{children:[G&&(0,L.jsx)(p,{padding:`checkbox`}),e.map(e=>(0,L.jsx)(p,{align:e.align??`left`,style:{width:e.width,minWidth:e.minWidth},children:e.header},e.key))]})})})}),(0,L.jsxs)(l,{sx:{py:6,px:2,textAlign:`center`,overflowWrap:`anywhere`,display:`flex`,flexDirection:`column`,alignItems:`center`,gap:1.5},children:[(0,L.jsx)(te,{}),(0,L.jsx)(T,{variant:`body2`,sx:{color:y?`text.secondary`:`text.disabled`},children:y?S?.empty??`Could not load this data`:v}),y&&(0,L.jsx)(T,{variant:`caption`,sx:{color:`text.disabled`,maxWidth:420,textAlign:`center`},children:y})]})]}):(0,L.jsxs)(R,{sx:W,children:[y&&(0,L.jsxs)(l,{role:`status`,sx:{display:`flex`,alignItems:`center`,gap:1,px:2,py:1,borderBottom:1,borderColor:`divider`,bgcolor:e=>r(e.palette.warning.main,.12)},children:[(0,L.jsx)(T,{variant:`body2`,sx:{color:`warning.dark`,fontWeight:600},children:S?.partial??`Some of this data could not be loaded`}),(0,L.jsx)(T,{variant:`caption`,sx:{color:`text.secondary`},children:y})]}),ue&&(0,L.jsxs)(k,{direction:`row`,spacing:2,sx:{alignItems:`center`,px:2,py:1,borderBottom:e=>`1px solid ${e.palette.divider}`,bgcolor:e=>r(e.palette.primary.main,.06)},children:[(0,L.jsxs)(T,{variant:`body2`,sx:{fontWeight:600},children:[X.size,` selected`]}),(0,L.jsx)(l,{sx:{flex:1}}),J(X)]}),(0,L.jsx)(P,{label:H,maxHeight:N,children:(0,L.jsxs)(x,{sx:{minWidth:F},size:M?`small`:`medium`,stickyHeader:A,children:[(0,L.jsx)(z,{children:(0,L.jsxs)(_,{children:[G&&(0,L.jsx)(p,{padding:`checkbox`,children:(0,L.jsx)(s,{size:`small`,indeterminate:re,checked:Q,disabled:i||Z.length===0,onChange:ie,slotProps:{input:{"aria-label":`select all rows on page`}}})}),e.map(e=>(0,L.jsx)(p,{align:e.align??`left`,style:{width:e.width,minWidth:e.minWidth},sortDirection:f===e.key&&h,children:e.sortable&&g?(0,L.jsx)(ee,{active:f===e.key,direction:f===e.key?h:`asc`,onClick:()=>oe(e.key),children:e.header}):e.header},e.key))]})}),(0,L.jsx)(m,{children:i?le:t.map((t,n)=>{let r=Y(t,n),i=G&&X.has(r),a=(0,L.jsxs)(B,{hover:!0,selected:i,tabIndex:w||G?-1:void 0,"data-row-action":w?!0:void 0,onClick:w?e=>{ne(e.target)&&w(t)}:void 0,sx:{cursor:w?`pointer`:`default`,"&:focus-visible":{outline:`2px solid`,outlineColor:`primary.main`,outlineOffset:-2},...E?.(t,n)},children:[G&&(0,L.jsx)(p,{padding:`checkbox`,onClick:e=>e.stopPropagation(),children:(0,L.jsx)(s,{size:`small`,checked:i,onChange:()=>ae(r),slotProps:{input:{"aria-label":`select row`}}})}),e.map(e=>(0,L.jsx)(p,{align:e.align??`left`,children:e.render(t,n)},e.key))]},r),o=D?.(t,n);return o==null?a:(0,L.jsxs)(I.Fragment,{children:[a,(0,L.jsx)(_,{children:(0,L.jsx)(p,{colSpan:e.length+ +!!G,sx:{py:0,borderBottom:0},children:o})})]},`${r}-group`)})})]})}),(0,L.jsx)(b,{component:`div`,count:n,page:o,rowsPerPage:c,rowsPerPageOptions:O,onPageChange:se,onRowsPerPageChange:ce,...U?.rowsPerPage!=null&&{labelRowsPerPage:U.rowsPerPage},...U?.displayedRows!=null&&{labelDisplayedRows:U.displayedRows},sx:{borderTop:e=>`1px solid ${e.palette.divider}`,"& .MuiTablePagination-displayedRows":{fontSize:`0.8rem`},"& .MuiTablePagination-selectLabel":{fontSize:`0.8rem`}}})]})}var I,L,R,z,B,V;function H(){return(H=e((()=>{M(),I=t(),d(),h(),C(),N(),g(),v(),S(),y(),E(),c(),A(),u(),f(),O(),o(),i(),L=n(),R=a(D)(({theme:e})=>({borderRadius:e.shape.borderRadius,border:`1px solid ${e.palette.divider}`,overflow:`hidden`,minWidth:0,maxWidth:`100%`})),z=a(w)(({theme:e})=>({backgroundColor:r(e.palette.grey[500],.08),"& .MuiTableCell-head":{fontWeight:600,fontSize:e.typography.pxToRem(13),color:e.palette.text.secondary,backgroundColor:e.vars?.palette.background.paper??e.palette.background.paper,whiteSpace:`nowrap`,borderBottom:`1px solid ${e.palette.divider}`}})),B=a(_)(({theme:e})=>({transition:e.transitions.create(`background-color`,{duration:e.transitions.duration.shortest}),"&:nth-child(even)":{backgroundColor:r(e.palette.grey[500],.02)},"&:hover":{backgroundColor:r(e.palette.primary.main,.04)},"& .MuiTableCell-body":{borderBottom:`1px solid ${r(e.palette.divider,.6)}`}})),V=new Set})))()}export{H as n,F as t};
1
+ import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{Vt as r,Yt as i}from"./mui-BTN91yBK.js";import{dn as a,un as o}from"./mui-Bdr6Ks5j.js";import{C as s,H as c,V as l,w as u}from"./mui-SNRRJ_vi.js";import{A as d,B as f,C as p,D as m,O as h,b as g,d as _,f as v,g as y,h as b,k as x,l as ee,u as S,w as C,y as w,z as T}from"./mui-B3fJdIMc.js";import{ct as E,st as D}from"./mui-CMWGTMXv.js";import{S as O,_ as k,v as A,x as j}from"./mui-CPEkFAPo.js";import{j as M,p as te}from"./controls-CqeGPnaF.js";import{n as N,r as ne,t as P}from"./table-viewport-DdZ1yAKm.js";function F({columns:e,data:t,total:n,loading:i=!1,loadingRows:a=5,page:o,pageSize:c,onPageChange:u,onPageSizeChange:d,sortBy:f,sortOrder:h=`asc`,onSort:g,emptyMessage:v=`No data found`,loadError:y=null,loadErrorLabels:S,rowKey:C,onRowClick:w,rowSx:E,renderExpanded:D,pageSizeOptions:O=[10,25,50,100],stickyHeader:A=!1,dense:M=!1,maxHeight:N,minWidth:F,scrollLabel:H,paginationLabels:U,sx:W,selectable:G=!1,selectedKeys:K,onSelectionChange:q,bulkActions:J}){let Y=(0,I.useCallback)((e,t)=>{if(C)return C(e);let n=e;return n.id===void 0?String(t):String(n.id)},[C,G]),X=K??V,Z=(0,I.useMemo)(()=>G?t.map((e,t)=>Y(e,t)):[],[G,t,Y]),Q=Z.length>0&&Z.every(e=>X.has(e)),re=!Q&&Z.some(e=>X.has(e)),ie=(0,I.useCallback)(()=>{if(!q)return;let e=new Set(X);Q?Z.forEach(t=>e.delete(t)):Z.forEach(t=>e.add(t)),q(e)},[q,X,Q,Z]),ae=(0,I.useCallback)(e=>{if(!q)return;let t=new Set(X);t.has(e)?t.delete(e):t.add(e),q(t)},[q,X]),oe=(0,I.useCallback)(e=>{g?.(e)},[g]),se=(0,I.useCallback)((e,t)=>{u(t)},[u]),ce=(0,I.useCallback)(e=>{d?.(parseInt(e.target.value,10)),u(0)},[d,u]),$=Math.max(1,Math.min(c,a)),le=(0,I.useMemo)(()=>Array.from({length:$},(t,n)=>(0,L.jsxs)(_,{children:[G&&(0,L.jsx)(p,{padding:`checkbox`,children:(0,L.jsx)(j,{variant:`rectangular`,width:18,height:18,sx:{borderRadius:.5}})}),e.map(e=>(0,L.jsx)(p,{align:e.align??`left`,children:(0,L.jsx)(j,{variant:`text`,width:e.align===`right`?`60%`:`80%`,sx:{ml:e.align===`right`?`auto`:0,borderRadius:.5}})},e.key))]},`skeleton-${n}`)),[$,e,G]),ue=G&&X.size>0&&!!J;return!i&&t.length===0?(0,L.jsxs)(R,{sx:W,children:[(0,L.jsx)(P,{label:H,children:(0,L.jsx)(x,{sx:{minWidth:F},size:M?`small`:`medium`,stickyHeader:A,children:(0,L.jsx)(z,{children:(0,L.jsxs)(_,{children:[G&&(0,L.jsx)(p,{padding:`checkbox`}),e.map(e=>(0,L.jsx)(p,{align:e.align??`left`,style:{width:e.width,minWidth:e.minWidth},children:e.header},e.key))]})})})}),(0,L.jsxs)(l,{sx:{py:6,px:2,textAlign:`center`,overflowWrap:`anywhere`,display:`flex`,flexDirection:`column`,alignItems:`center`,gap:1.5},children:[(0,L.jsx)(te,{}),(0,L.jsx)(T,{variant:`body2`,sx:{color:y?`text.secondary`:`text.disabled`},children:y?S?.empty??`Could not load this data`:v}),y&&(0,L.jsx)(T,{variant:`caption`,sx:{color:`text.disabled`,maxWidth:420,textAlign:`center`},children:y})]})]}):(0,L.jsxs)(R,{sx:W,children:[y&&(0,L.jsxs)(l,{role:`status`,sx:{display:`flex`,alignItems:`center`,gap:1,px:2,py:1,borderBottom:1,borderColor:`divider`,bgcolor:e=>r(e.palette.warning.main,.12)},children:[(0,L.jsx)(T,{variant:`body2`,sx:{color:`warning.dark`,fontWeight:600},children:S?.partial??`Some of this data could not be loaded`}),(0,L.jsx)(T,{variant:`caption`,sx:{color:`text.secondary`},children:y})]}),ue&&(0,L.jsxs)(k,{direction:`row`,spacing:2,sx:{alignItems:`center`,px:2,py:1,borderBottom:e=>`1px solid ${e.palette.divider}`,bgcolor:e=>r(e.palette.primary.main,.06)},children:[(0,L.jsxs)(T,{variant:`body2`,sx:{fontWeight:600},children:[X.size,` selected`]}),(0,L.jsx)(l,{sx:{flex:1}}),J(X)]}),(0,L.jsx)(P,{label:H,maxHeight:N,children:(0,L.jsxs)(x,{sx:{minWidth:F},size:M?`small`:`medium`,stickyHeader:A,children:[(0,L.jsx)(z,{children:(0,L.jsxs)(_,{children:[G&&(0,L.jsx)(p,{padding:`checkbox`,children:(0,L.jsx)(s,{size:`small`,indeterminate:re,checked:Q,disabled:i||Z.length===0,onChange:ie,slotProps:{input:{"aria-label":`select all rows on page`}}})}),e.map(e=>(0,L.jsx)(p,{align:e.align??`left`,style:{width:e.width,minWidth:e.minWidth},sortDirection:f===e.key&&h,children:e.sortable&&g?(0,L.jsx)(ee,{active:f===e.key,direction:f===e.key?h:`asc`,onClick:()=>oe(e.key),children:e.header}):e.header},e.key))]})}),(0,L.jsx)(m,{children:i?le:t.map((t,n)=>{let r=Y(t,n),i=G&&X.has(r),a=(0,L.jsxs)(B,{hover:!0,selected:i,tabIndex:w||G?-1:void 0,"data-row-action":w?!0:void 0,onClick:w?e=>{ne(e.target)&&w(t)}:void 0,sx:{cursor:w?`pointer`:`default`,"&:focus-visible":{outline:`2px solid`,outlineColor:`primary.main`,outlineOffset:-2},...E?.(t,n)},children:[G&&(0,L.jsx)(p,{padding:`checkbox`,onClick:e=>e.stopPropagation(),children:(0,L.jsx)(s,{size:`small`,checked:i,onChange:()=>ae(r),slotProps:{input:{"aria-label":`select row`}}})}),e.map(e=>(0,L.jsx)(p,{align:e.align??`left`,children:e.render(t,n)},e.key))]},r),o=D?.(t,n);return o==null?a:(0,L.jsxs)(I.Fragment,{children:[a,(0,L.jsx)(_,{children:(0,L.jsx)(p,{colSpan:e.length+ +!!G,sx:{py:0,borderBottom:0},children:o})})]},`${r}-group`)})})]})}),(0,L.jsx)(b,{component:`div`,count:n,page:o,rowsPerPage:c,rowsPerPageOptions:O,onPageChange:se,onRowsPerPageChange:ce,...U?.rowsPerPage!=null&&{labelRowsPerPage:U.rowsPerPage},...U?.displayedRows!=null&&{labelDisplayedRows:U.displayedRows},sx:{borderTop:e=>`1px solid ${e.palette.divider}`,"& .MuiTablePagination-displayedRows":{fontSize:`0.8rem`},"& .MuiTablePagination-selectLabel":{fontSize:`0.8rem`}}})]})}var I,L,R,z,B,V;function H(){return(H=e((()=>{M(),I=t(),d(),h(),C(),N(),g(),v(),S(),y(),E(),c(),A(),u(),f(),O(),o(),i(),L=n(),R=a(D)(({theme:e})=>({borderRadius:e.shape.borderRadius,border:`1px solid ${e.palette.divider}`,overflow:`hidden`,minWidth:0,maxWidth:`100%`})),z=a(w)(({theme:e})=>({backgroundColor:r(e.palette.grey[500],.08),"& .MuiTableCell-head":{fontWeight:600,fontSize:e.typography.pxToRem(13),color:e.palette.text.secondary,backgroundColor:e.vars?.palette.background.paper??e.palette.background.paper,whiteSpace:`nowrap`,borderBottom:`1px solid ${e.palette.divider}`}})),B=a(_)(({theme:e})=>({transition:e.transitions.create(`background-color`,{duration:e.transitions.duration.shortest}),"&:nth-child(even)":{backgroundColor:r(e.palette.grey[500],.02)},"&:hover":{backgroundColor:r(e.palette.primary.main,.04)},"& .MuiTableCell-body":{borderBottom:`1px solid ${r(e.palette.divider,.6)}`}})),V=new Set})))()}export{H as n,F as t};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{Gt as r,Ht as i,Jt as a,Yt as o,qt as s}from"./mui-BTN91yBK.js";import{nn as c,rn as l}from"./mui-CdB_p2lt.js";import{at as u,it as d,ot as f,rt as p}from"./mui-BXSXx9c9.js";function m(e){let t=e.startsWith(`hsl`)?a(e):e,{type:n,values:i}=r(t);if(![`rgb`,`rgba`].includes(n)||!i.every(Number.isFinite)||(i[3]??1)!==1)throw Error(`Semantic contrast requires an opaque sRGB surface`);return t}function h(e,t,n,r,a=`paper`){let o=e.vars?.palette??e.palette,c=e.colorSchemes?.[n]?.palette??e.palette,l=a===`white`?o.grey[800]:o.text.primary;try{let e=c[t],n=a===`white`?m(c.common.white):i(m(c.background.paper),m(c[t].main),r);for(let r of[[`dark`,`light`],[`darker`,`lighter`]]){let i=r.filter(t=>e[t]).sort((t,r)=>s(e[r],n)-s(e[t],n))[0];if(i&&s(e[i],n)>=4.5)return o[t][i]??l}}catch{}return l}function g(e,t,n=.16,r=n){let i=e.vars?.palette??e.palette;return{backgroundColor:e.alpha(i[t].main,n),color:h(e,t,`light`,n),...e.applyStyles(`dark`,{color:h(e,t,`dark`,r),...r!==n&&{backgroundColor:e.alpha(i[t].main,r)}})}}function _(){return(_=e((()=>{o()})))()}function v(e,t){return[e,...Array.isArray(t)?t:t?[t]:[]]}function y({severity:e=`info`,variant:t=`standard`,title:n,children:r,onClose:i,closable:a=!1,icon:o,action:s,sx:c,ref:l,...d}){let f=t===`soft`?`standard`:t;return(0,S.jsxs)(u,{ref:l,...d,severity:e,variant:f,onClose:a?i:void 0,icon:o,action:s,sx:v(t===`soft`?t=>({...g(t,d.color??e,.12,.16),"& .MuiAlert-icon":{color:`inherit`}}):{},c),children:[n&&(0,S.jsx)(p,{children:n}),r]})}function b({severity:e=`error`,title:t,children:n,onClose:r,autoScroll:i=!0,sx:a,ref:o,...s}){let c=(0,x.useRef)(null),d=l(c,o);return(0,x.useEffect)(()=>{if(!i)return;let e=requestAnimationFrame(()=>{c.current?.scrollIntoView({block:`nearest`,behavior:`smooth`})});return()=>cancelAnimationFrame(e)},[i]),(0,S.jsxs)(u,{ref:d,...s,severity:e,onClose:r,role:`alert`,"aria-live":`assertive`,"aria-atomic":`true`,sx:v({alignItems:`flex-start`,mb:2},a),children:[t&&(0,S.jsx)(p,{sx:{mb:.5},children:t}),n]})}var x,S;function C(){return(C=e((()=>{x=t(),f(),d(),c(),_(),S=n()})))()}export{g as a,_ as i,b as n,h as o,C as r,y as t};
1
+ import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{Gt as r,Ht as i,Jt as a,Yt as o,qt as s}from"./mui-BTN91yBK.js";import{nn as c,rn as l}from"./mui-Bdr6Ks5j.js";import{at as u,it as d,ot as f,rt as p}from"./mui-SNRRJ_vi.js";function m(e){let t=e.startsWith(`hsl`)?a(e):e,{type:n,values:i}=r(t);if(![`rgb`,`rgba`].includes(n)||!i.every(Number.isFinite)||(i[3]??1)!==1)throw Error(`Semantic contrast requires an opaque sRGB surface`);return t}function h(e,t,n,r,a=`paper`){let o=e.vars?.palette??e.palette,c=e.colorSchemes?.[n]?.palette??e.palette,l=a===`white`?o.grey[800]:o.text.primary;try{let e=c[t],n=a===`white`?m(c.common.white):i(m(c.background.paper),m(c[t].main),r);for(let r of[[`dark`,`light`],[`darker`,`lighter`]]){let i=r.filter(t=>e[t]).sort((t,r)=>s(e[r],n)-s(e[t],n))[0];if(i&&s(e[i],n)>=4.5)return o[t][i]??l}}catch{}return l}function g(e,t,n=.16,r=n){let i=e.vars?.palette??e.palette;return{backgroundColor:e.alpha(i[t].main,n),color:h(e,t,`light`,n),...e.applyStyles(`dark`,{color:h(e,t,`dark`,r),...r!==n&&{backgroundColor:e.alpha(i[t].main,r)}})}}function _(){return(_=e((()=>{o()})))()}function v(e,t){return[e,...Array.isArray(t)?t:t?[t]:[]]}function y({severity:e=`info`,variant:t=`standard`,title:n,children:r,onClose:i,closable:a=!1,icon:o,action:s,sx:c,ref:l,...d}){let f=t===`soft`?`standard`:t;return(0,S.jsxs)(u,{ref:l,...d,severity:e,variant:f,onClose:a?i:void 0,icon:o,action:s,sx:v(t===`soft`?t=>({...g(t,d.color??e,.12,.16),"& .MuiAlert-icon":{color:`inherit`}}):{},c),children:[n&&(0,S.jsx)(p,{children:n}),r]})}function b({severity:e=`error`,title:t,children:n,onClose:r,autoScroll:i=!0,sx:a,ref:o,...s}){let c=(0,x.useRef)(null),d=l(c,o);return(0,x.useEffect)(()=>{if(!i)return;let e=requestAnimationFrame(()=>{c.current?.scrollIntoView({block:`nearest`,behavior:`smooth`})});return()=>cancelAnimationFrame(e)},[i]),(0,S.jsxs)(u,{ref:d,...s,severity:e,onClose:r,role:`alert`,"aria-live":`assertive`,"aria-atomic":`true`,sx:v({alignItems:`flex-start`,mb:2},a),children:[t&&(0,S.jsx)(p,{sx:{mb:.5},children:t}),n]})}var x,S;function C(){return(C=e((()=>{x=t(),f(),d(),c(),_(),S=n()})))()}export{g as a,_ as i,b as n,h as o,C as r,y as t};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{B as r,h as i,n as a,z as o}from"./client-DFnuv2z3.js";import{Vt as s,Yt as c}from"./mui-BTN91yBK.js";import{D as l,E as u,F as d,H as f,I as p,M as m,O as h,Q as g,T as _,U as v,V as y,W as b,Z as x,c as S,ct as C,d as w,f as T,g as E,h as D,j as O,m as k,p as A,s as j,st as M}from"./mui-BXSXx9c9.js";import{B as N,F as P,I as F,a as I,o as L,z as R}from"./mui-Cd711nOk.js";import{B as z,U as B,W as ee,it as te,l as ne,rt as V,u as re,z as H}from"./mui-AnEgAVjz.js";import{_ as U,n as ie,t as W,v as ae}from"./mui-BwsIrivo.js";import{r as oe,t as G}from"./alert-uBG6r9NW.js";import{c as se,n as K,s as ce}from"./access-BvKK9dEv.js";import{n as le,t as ue}from"./use-polled-resource-B22hhr5L.js";import{A as de,G as fe,M as pe,a as me,h as he,p as ge,t as q}from"./icons-OboZgWSt.js";import{i as _e,n as ve,r as ye,t as be}from"./alert-expression-CSblScoa.js";import{n as xe,t as Se}from"./page-breadcrumbs-fR7Jmpp4.js";import{n as Ce,t as we}from"./admin-data-table-BKSDI8sU.js";import{n as Te,t as Ee}from"./confirm-dialog-BbGsAz7_.js";import{n as De,t as Oe}from"./skeleton-BmWDJWF9.js";import{l as ke}from"./formatters-RnRy4bXm.js";import{n as Ae,t as je}from"./settled-pair-B-wgSZl6.js";function Me({open:e,rule:t,onClose:n,onSaved:r}){let[i,o]=(0,Y.useState)(``),[s,c]=(0,Y.useState)(``),[l,u]=(0,Y.useState)(`warning`),[f,p]=(0,Y.useState)(``),[m,h]=(0,Y.useState)(``),[g,_]=(0,Y.useState)(!0),[v,y]=(0,Y.useState)(!1),[b,x]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{e&&(o(t?.name??``),c(t?.expression??``),u(t?.severity??`warning`),p(t?.forDuration?String(t.forDuration):``),h(t?.summary??``),_(t?.enabled??!0),x(null))},[e,t]);let S=async()=>{let{fields:e,problems:o}=_e({name:i,expression:s,severity:l,forDuration:f.trim()===``?null:Number(f),summary:m,enabled:g},!1);if(o.length>0)x(o.join(`; `));else{y(!0),x(null);try{let i=e;t?await a.updateRule({id:t.id,...i}):await a.createRule(i),r(),n()}catch(e){x(e?.message??`Failed to save the rule`)}finally{y(!1)}}};return(0,X.jsxs)(D,{open:e,onClose:n,maxWidth:`sm`,fullWidth:!0,children:[(0,X.jsx)(j,{children:t?`Edit Alert Rule`:`New Alert Rule`}),(0,X.jsx)(w,{children:(0,X.jsxs)(U,{spacing:2,sx:{mt:1},children:[b&&(0,X.jsx)(G,{severity:`error`,children:b}),(0,X.jsx)(I,{label:`Name`,value:i,onChange:e=>o(e.target.value),fullWidth:!0,required:!0,size:`small`}),(0,X.jsx)(I,{label:`Expression`,value:s,onChange:e=>c(e.target.value),fullWidth:!0,required:!0,size:`small`,placeholder:`e.g. app.main.cpu > 90`,helperText:`Supported forms: ${be}`}),(0,X.jsx)(I,{label:`Severity`,value:l,onChange:e=>u(e.target.value),select:!0,fullWidth:!0,size:`small`,children:[...ve].reverse().map(e=>(0,X.jsx)(ne,{value:e,sx:{textTransform:`capitalize`},children:e},e))}),(0,X.jsx)(I,{label:`Fire after (seconds)`,value:f,onChange:e=>p(e.target.value),fullWidth:!0,size:`small`,inputMode:`numeric`,helperText:`How long the condition must hold before the alert fires. Empty fires at once.`}),(0,X.jsx)(I,{label:`Summary`,value:m,onChange:e=>h(e.target.value),fullWidth:!0,size:`small`,helperText:`The sentence the alert is listed and notified with. Empty lists the expression and its value.`}),(0,X.jsx)(B,{control:(0,X.jsx)(W,{checked:g,onChange:e=>_(e.target.checked)}),label:`Enabled`})]})}),(0,X.jsxs)(A,{children:[(0,X.jsx)(d,{onClick:n,disabled:v,children:`Cancel`}),(0,X.jsx)(d,{variant:`contained`,onClick:S,disabled:v,startIcon:v?(0,X.jsx)(M,{size:14}):void 0,children:v?`Saving…`:t?`Save Rule`:`Create Rule`})]})]})}function J({title:e,value:t,icon:n,color:r,loading:i}){return(0,X.jsx)(O,{variant:`outlined`,children:(0,X.jsx)(l,{children:(0,X.jsxs)(U,{direction:`row`,spacing:2,sx:{alignItems:`center`,justifyContent:`space-between`},children:[(0,X.jsxs)(U,{spacing:.5,children:[(0,X.jsx)(R,{variant:`body2`,sx:{color:`text.secondary`},children:e}),i?(0,X.jsx)(Oe,{width:60,height:40}):(0,X.jsx)(R,{variant:`h4`,children:t})]}),(0,X.jsx)(y,{sx:{p:1.5,borderRadius:2,bgcolor:e=>s(e.palette[r].main,.12),color:`${r}.main`,display:`flex`},children:n})]})})})}function Ne(){let{can:e}=se(),{hash:t,key:n}=r(),i=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{t===`#firing`&&i.current?.focus()},[t,n]);let[o,c]=(0,Y.useState)(void 0),{data:u,loading:f,error:p,refresh:m}=le(async()=>{let{first:e,second:t,partialFailure:n}=await Ae([a.getRules(),a.getActiveAlerts({limit:Z})],[[],null]);return{rules:e,activeAlerts:t,partialFailure:n}},{intervalMs:15e3}),[h,g]=(0,Y.useState)(null),[y,b]=(0,Y.useState)(null),[S,C]=(0,Y.useState)(0),[w,T]=(0,Y.useState)(25),E=u?.rules??[],D=u?.activeAlerts??[],k=u?.partialFailure??null,A=D.length,j=A===Z,M=u?.activeAlerts!=null,N=D.filter(e=>e.acknowledged).length,F=`No alerts are currently firing.`;M?j?F=`Showing the latest ${Z} firing alerts across all workspaces`:A&&(F=`${A} currently firing across all workspaces`):F=f?`Loading firing alerts…`:`Firing alerts unavailable.`;let I=async(e,t)=>{try{await a.updateRule({id:e,enabled:t}),await m()}catch(e){g(e?.message??`Failed to update rule`)}},L=async()=>{let e=y;if(e)try{await a.deleteRule({id:e}),b(null),await m()}catch(e){g(e?.message??`Failed to delete rule`)}},z=async e=>{try{await a.acknowledgeAlert({alertId:e}),await m()}catch(e){g(e?.message??`Failed to acknowledge alert`)}},B=E.slice(S*w,S*w+w);return(0,X.jsxs)(U,{spacing:3,children:[(0,X.jsx)(Se,{links:[{name:`Alerts`}],action:(0,X.jsxs)(U,{direction:`row`,spacing:1,sx:{alignItems:`center`},children:[A>0&&(0,X.jsx)(v,{badgeContent:A,color:`error`,children:(0,X.jsx)(x,{label:`Firing`,size:`small`,color:`error`,variant:`outlined`})}),(0,X.jsx)(V,{"data-console-command":`refresh`,size:`small`,onClick:m,title:`Refresh`,children:(0,X.jsx)(pe,{})}),(0,X.jsx)(K,{permission:`OmnitronAlerts.createRule`,children:(0,X.jsx)(d,{variant:`contained`,size:`small`,startIcon:(0,X.jsx)(de,{}),onClick:()=>c(null),children:`New Rule`})})]})}),(p||h||k)&&(0,X.jsx)(G,{closable:!0,severity:`warning`,variant:`outlined`,onClose:()=>g(null),children:h??p??`Some data is unavailable: ${k}`}),(0,X.jsxs)(H,{container:!0,spacing:3,children:[(0,X.jsx)(H,{size:{xs:12,sm:4},children:(0,X.jsx)(J,{title:`Firing`,value:M?`${A}${j?`+`:``}`:`—`,icon:(0,X.jsx)(q,{}),color:A>0?`error`:`success`,loading:f})}),(0,X.jsx)(H,{size:{xs:12,sm:4},children:(0,X.jsx)(J,{title:`Acknowledged`,value:M?`${N}${j?`+`:``}`:`—`,icon:(0,X.jsx)(me,{}),color:N<A?`warning`:`success`,loading:f})}),(0,X.jsx)(H,{size:{xs:12,sm:4},children:(0,X.jsx)(J,{title:`Total Rules`,value:E.length,icon:(0,X.jsx)(q,{}),color:`primary`,loading:f})})]}),(t===`#firing`||A>0)&&(0,X.jsxs)(O,{component:`section`,id:`firing`,"aria-label":`Active alerts across all workspaces`,ref:i,tabIndex:-1,variant:`outlined`,sx:{"&:focus-visible":{outline:`2px solid`,outlineColor:`primary.main`,outlineOffset:-2}},children:[(0,X.jsx)(_,{slotProps:{subheader:{variant:`caption`},title:{variant:`subtitle1`,fontWeight:600}},title:`Active Alerts`,subheader:F}),(0,X.jsx)(l,{sx:{pt:0},children:(0,X.jsx)(U,{spacing:1,children:D.map(e=>(0,X.jsxs)(U,{direction:`row`,spacing:2,sx:{alignItems:`center`,flexWrap:`wrap`,p:1.5,borderRadius:1,bgcolor:t=>s(t.palette[Q[e.severity]??`info`].main,.08),border:1,borderColor:t=>s(t.palette[Q[e.severity]??`info`].main,.2)},children:[(0,X.jsx)(x,{label:e.severity,size:`small`,color:Q[e.severity]??`info`,variant:`filled`,sx:{fontWeight:600,textTransform:`uppercase`,fontSize:10,minWidth:64}}),(0,X.jsxs)(U,{sx:{flex:`1 1 160px`,minWidth:0},children:[(0,X.jsx)(R,{variant:`body2`,sx:{fontWeight:600},children:e.ruleName}),(0,X.jsx)(R,{variant:`caption`,sx:{color:`text.secondary`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.message})]}),(0,X.jsx)(R,{variant:`caption`,sx:{color:`text.disabled`,flexShrink:0},children:ke(e.firedAt)}),!e.acknowledged&&(0,X.jsx)(K,{permission:`OmnitronAlerts.acknowledgeAlert`,children:(0,X.jsx)(d,{size:`small`,variant:`outlined`,onClick:()=>z(e.id),sx:{minWidth:0,px:1.5,fontSize:11},children:`Ack`})}),e.acknowledged&&(0,X.jsx)(x,{label:`Acked`,size:`small`,variant:`outlined`,color:`default`,sx:{fontSize:10}})]},e.id))})})]}),(0,X.jsxs)(O,{variant:`outlined`,children:[(0,X.jsx)(_,{slotProps:{title:{variant:`subtitle1`,fontWeight:600}},title:`Alert Rules`}),(0,X.jsx)(we,{minWidth:640,scrollLabel:`Alert rules`,columns:[{key:`name`,header:`Name`,render:e=>(0,X.jsx)(R,{variant:`body2`,sx:{fontWeight:600},children:e.name})},{key:`expression`,header:`Expression`,render:e=>(0,X.jsx)(R,{variant:`caption`,sx:{fontFamily:`monospace`,fontSize:12},children:e.expression})},{key:`type`,header:`Type`,render:e=>(0,X.jsx)(x,{label:e.type,size:`small`,variant:`outlined`,sx:{textTransform:`capitalize`,fontSize:11}})},{key:`severity`,header:`Severity`,render:e=>(0,X.jsx)(x,{label:e.severity,size:`small`,color:Q[e.severity]??`default`,variant:`filled`,sx:{textTransform:`capitalize`,fontWeight:600,fontSize:11}})},{key:`forDuration`,header:`Fires after`,render:e=>(0,X.jsx)(R,{variant:`caption`,children:e.forDuration?`${e.forDuration}s held`:`at once`})},{key:`enabled`,header:`Enabled`,align:`center`,render:t=>(0,X.jsx)(W,{size:`small`,checked:t.enabled,disabled:!e(`OmnitronAlerts.updateRule`),onChange:(e,n)=>I(t.id,n)})},{key:`actions`,header:`Actions`,align:`right`,render:e=>(0,X.jsxs)(U,{direction:`row`,spacing:.5,sx:{justifyContent:`flex-end`},children:[(0,X.jsx)(K,{permission:`OmnitronAlerts.deleteRule`,children:(0,X.jsx)(P,{title:`Delete rule`,children:(0,X.jsx)(V,{size:`small`,color:`error`,"aria-label":`Delete rule ${e.name}`,onClick:()=>b(e.id),sx:{marginInlineEnd:1},children:(0,X.jsx)(ge,{sx:{fontSize:18}})})})}),(0,X.jsx)(K,{permission:`OmnitronAlerts.updateRule`,children:(0,X.jsx)(P,{title:`Edit rule`,children:(0,X.jsx)(V,{size:`small`,"aria-label":`Edit rule ${e.name}`,onClick:()=>c(e),children:(0,X.jsx)(he,{sx:{fontSize:18}})})})})]})}],data:B,total:E.length,loading:f,loadError:p??k??null,emptyMessage:`No alert rules configured. Create a rule to get started.`,rowKey:e=>e.id,rowSx:e=>({opacity:e.enabled?1:.5}),page:S,pageSize:w,onPageChange:C,onPageSizeChange:e=>{T(e),C(0)},dense:!0})]}),(0,X.jsx)(K,{permission:`OmnitronAlerts.deleteRule`,children:(0,X.jsx)(Ee,{open:y!==null,onClose:()=>b(null),onConfirm:L,title:`Delete alert rule?`,content:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`b`,{children:E.find(e=>e.id===y)?.name??y}),` will stop firing. Alerts it has already raised are kept.`]}),confirmLabel:`Delete`,confirmColor:`error`})}),(0,X.jsx)(K,{permission:o?`OmnitronAlerts.updateRule`:`OmnitronAlerts.createRule`,children:(0,X.jsx)(Me,{open:o!==void 0,rule:o??null,onClose:()=>c(void 0),onSaved:()=>void m()})})]})}var Y,X,Z,Q;function $(){return($=e((()=>{ce(),Y=t(),o(),f(),z(),m(),h(),u(),N(),ae(),g(),p(),te(),ie(),F(),b(),E(),S(),T(),k(),L(),re(),ee(),C(),c(),fe(),Ce(),oe(),xe(),Te(),De(),i(),ue(),je(),ye(),X=n(),Z=100,Q={critical:`error`,warning:`warning`,info:`info`}})))()}$();export{Ne as default};
1
+ import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{B as r,h as i,n as a,z as o}from"./client-CgyTwq9g.js";import{Vt as s,Yt as c}from"./mui-BTN91yBK.js";import{D as l,E as u,F as d,H as f,I as p,M as m,O as h,Q as g,T as _,U as v,V as y,W as b,Z as x,c as S,ct as C,d as w,f as T,g as E,h as D,j as O,m as k,p as A,s as j,st as M}from"./mui-SNRRJ_vi.js";import{B as N,F as P,I as F,a as I,o as L,z as R}from"./mui-B3fJdIMc.js";import{B as z,U as B,W as ee,it as te,l as ne,rt as V,u as re,z as H}from"./mui-CMWGTMXv.js";import{_ as U,n as ie,t as W,v as ae}from"./mui-CPEkFAPo.js";import{r as oe,t as G}from"./alert-BdJ2uaY0.js";import{c as se,n as K,s as ce}from"./access-I0f72P9m.js";import{n as le,t as ue}from"./use-polled-resource-B22hhr5L.js";import{A as de,G as fe,M as pe,a as me,h as he,p as ge,t as q}from"./icons-B9Ct8PJ9.js";import{i as _e,n as ve,r as ye,t as be}from"./alert-expression-CSblScoa.js";import{n as xe,t as Se}from"./page-breadcrumbs-3R8RZ3nA.js";import{n as Ce,t as we}from"./admin-data-table-CAEL2f-m.js";import{n as Te,t as Ee}from"./confirm-dialog-BayExVbF.js";import{n as De,t as Oe}from"./skeleton-BnVxAoeX.js";import{l as ke}from"./formatters-RnRy4bXm.js";import{n as Ae,t as je}from"./settled-pair-B-wgSZl6.js";function Me({open:e,rule:t,onClose:n,onSaved:r}){let[i,o]=(0,Y.useState)(``),[s,c]=(0,Y.useState)(``),[l,u]=(0,Y.useState)(`warning`),[f,p]=(0,Y.useState)(``),[m,h]=(0,Y.useState)(``),[g,_]=(0,Y.useState)(!0),[v,y]=(0,Y.useState)(!1),[b,x]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{e&&(o(t?.name??``),c(t?.expression??``),u(t?.severity??`warning`),p(t?.forDuration?String(t.forDuration):``),h(t?.summary??``),_(t?.enabled??!0),x(null))},[e,t]);let S=async()=>{let{fields:e,problems:o}=_e({name:i,expression:s,severity:l,forDuration:f.trim()===``?null:Number(f),summary:m,enabled:g},!1);if(o.length>0)x(o.join(`; `));else{y(!0),x(null);try{let i=e;t?await a.updateRule({id:t.id,...i}):await a.createRule(i),r(),n()}catch(e){x(e?.message??`Failed to save the rule`)}finally{y(!1)}}};return(0,X.jsxs)(D,{open:e,onClose:n,maxWidth:`sm`,fullWidth:!0,children:[(0,X.jsx)(j,{children:t?`Edit Alert Rule`:`New Alert Rule`}),(0,X.jsx)(w,{children:(0,X.jsxs)(U,{spacing:2,sx:{mt:1},children:[b&&(0,X.jsx)(G,{severity:`error`,children:b}),(0,X.jsx)(I,{label:`Name`,value:i,onChange:e=>o(e.target.value),fullWidth:!0,required:!0,size:`small`}),(0,X.jsx)(I,{label:`Expression`,value:s,onChange:e=>c(e.target.value),fullWidth:!0,required:!0,size:`small`,placeholder:`e.g. app.main.cpu > 90`,helperText:`Supported forms: ${be}`}),(0,X.jsx)(I,{label:`Severity`,value:l,onChange:e=>u(e.target.value),select:!0,fullWidth:!0,size:`small`,children:[...ve].reverse().map(e=>(0,X.jsx)(ne,{value:e,sx:{textTransform:`capitalize`},children:e},e))}),(0,X.jsx)(I,{label:`Fire after (seconds)`,value:f,onChange:e=>p(e.target.value),fullWidth:!0,size:`small`,inputMode:`numeric`,helperText:`How long the condition must hold before the alert fires. Empty fires at once.`}),(0,X.jsx)(I,{label:`Summary`,value:m,onChange:e=>h(e.target.value),fullWidth:!0,size:`small`,helperText:`The sentence the alert is listed and notified with. Empty lists the expression and its value.`}),(0,X.jsx)(B,{control:(0,X.jsx)(W,{checked:g,onChange:e=>_(e.target.checked)}),label:`Enabled`})]})}),(0,X.jsxs)(A,{children:[(0,X.jsx)(d,{onClick:n,disabled:v,children:`Cancel`}),(0,X.jsx)(d,{variant:`contained`,onClick:S,disabled:v,startIcon:v?(0,X.jsx)(M,{size:14}):void 0,children:v?`Saving…`:t?`Save Rule`:`Create Rule`})]})]})}function J({title:e,value:t,icon:n,color:r,loading:i}){return(0,X.jsx)(O,{variant:`outlined`,children:(0,X.jsx)(l,{children:(0,X.jsxs)(U,{direction:`row`,spacing:2,sx:{alignItems:`center`,justifyContent:`space-between`},children:[(0,X.jsxs)(U,{spacing:.5,children:[(0,X.jsx)(R,{variant:`body2`,sx:{color:`text.secondary`},children:e}),i?(0,X.jsx)(Oe,{width:60,height:40}):(0,X.jsx)(R,{variant:`h4`,children:t})]}),(0,X.jsx)(y,{sx:{p:1.5,borderRadius:2,bgcolor:e=>s(e.palette[r].main,.12),color:`${r}.main`,display:`flex`},children:n})]})})})}function Ne(){let{can:e}=se(),{hash:t,key:n}=r(),i=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{t===`#firing`&&i.current?.focus()},[t,n]);let[o,c]=(0,Y.useState)(void 0),{data:u,loading:f,error:p,refresh:m}=le(async()=>{let{first:e,second:t,partialFailure:n}=await Ae([a.getRules(),a.getActiveAlerts({limit:Z})],[[],null]);return{rules:e,activeAlerts:t,partialFailure:n}},{intervalMs:15e3}),[h,g]=(0,Y.useState)(null),[y,b]=(0,Y.useState)(null),[S,C]=(0,Y.useState)(0),[w,T]=(0,Y.useState)(25),E=u?.rules??[],D=u?.activeAlerts??[],k=u?.partialFailure??null,A=D.length,j=A===Z,M=u?.activeAlerts!=null,N=D.filter(e=>e.acknowledged).length,F=`No alerts are currently firing.`;M?j?F=`Showing the latest ${Z} firing alerts across all workspaces`:A&&(F=`${A} currently firing across all workspaces`):F=f?`Loading firing alerts…`:`Firing alerts unavailable.`;let I=async(e,t)=>{try{await a.updateRule({id:e,enabled:t}),await m()}catch(e){g(e?.message??`Failed to update rule`)}},L=async()=>{let e=y;if(e)try{await a.deleteRule({id:e}),b(null),await m()}catch(e){g(e?.message??`Failed to delete rule`)}},z=async e=>{try{await a.acknowledgeAlert({alertId:e}),await m()}catch(e){g(e?.message??`Failed to acknowledge alert`)}},B=E.slice(S*w,S*w+w);return(0,X.jsxs)(U,{spacing:3,children:[(0,X.jsx)(Se,{links:[{name:`Alerts`}],action:(0,X.jsxs)(U,{direction:`row`,spacing:1,sx:{alignItems:`center`},children:[A>0&&(0,X.jsx)(v,{badgeContent:A,color:`error`,children:(0,X.jsx)(x,{label:`Firing`,size:`small`,color:`error`,variant:`outlined`})}),(0,X.jsx)(V,{"data-console-command":`refresh`,size:`small`,onClick:m,title:`Refresh`,children:(0,X.jsx)(pe,{})}),(0,X.jsx)(K,{permission:`OmnitronAlerts.createRule`,children:(0,X.jsx)(d,{variant:`contained`,size:`small`,startIcon:(0,X.jsx)(de,{}),onClick:()=>c(null),children:`New Rule`})})]})}),(p||h||k)&&(0,X.jsx)(G,{closable:!0,severity:`warning`,variant:`outlined`,onClose:()=>g(null),children:h??p??`Some data is unavailable: ${k}`}),(0,X.jsxs)(H,{container:!0,spacing:3,children:[(0,X.jsx)(H,{size:{xs:12,sm:4},children:(0,X.jsx)(J,{title:`Firing`,value:M?`${A}${j?`+`:``}`:`—`,icon:(0,X.jsx)(q,{}),color:A>0?`error`:`success`,loading:f})}),(0,X.jsx)(H,{size:{xs:12,sm:4},children:(0,X.jsx)(J,{title:`Acknowledged`,value:M?`${N}${j?`+`:``}`:`—`,icon:(0,X.jsx)(me,{}),color:N<A?`warning`:`success`,loading:f})}),(0,X.jsx)(H,{size:{xs:12,sm:4},children:(0,X.jsx)(J,{title:`Total Rules`,value:E.length,icon:(0,X.jsx)(q,{}),color:`primary`,loading:f})})]}),(t===`#firing`||A>0)&&(0,X.jsxs)(O,{component:`section`,id:`firing`,"aria-label":`Active alerts across all workspaces`,ref:i,tabIndex:-1,variant:`outlined`,sx:{"&:focus-visible":{outline:`2px solid`,outlineColor:`primary.main`,outlineOffset:-2}},children:[(0,X.jsx)(_,{slotProps:{subheader:{variant:`caption`},title:{variant:`subtitle1`,fontWeight:600}},title:`Active Alerts`,subheader:F}),(0,X.jsx)(l,{sx:{pt:0},children:(0,X.jsx)(U,{spacing:1,children:D.map(e=>(0,X.jsxs)(U,{direction:`row`,spacing:2,sx:{alignItems:`center`,flexWrap:`wrap`,p:1.5,borderRadius:1,bgcolor:t=>s(t.palette[Q[e.severity]??`info`].main,.08),border:1,borderColor:t=>s(t.palette[Q[e.severity]??`info`].main,.2)},children:[(0,X.jsx)(x,{label:e.severity,size:`small`,color:Q[e.severity]??`info`,variant:`filled`,sx:{fontWeight:600,textTransform:`uppercase`,fontSize:10,minWidth:64}}),(0,X.jsxs)(U,{sx:{flex:`1 1 160px`,minWidth:0},children:[(0,X.jsx)(R,{variant:`body2`,sx:{fontWeight:600},children:e.ruleName}),(0,X.jsx)(R,{variant:`caption`,sx:{color:`text.secondary`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.message})]}),(0,X.jsx)(R,{variant:`caption`,sx:{color:`text.disabled`,flexShrink:0},children:ke(e.firedAt)}),!e.acknowledged&&(0,X.jsx)(K,{permission:`OmnitronAlerts.acknowledgeAlert`,children:(0,X.jsx)(d,{size:`small`,variant:`outlined`,onClick:()=>z(e.id),sx:{minWidth:0,px:1.5,fontSize:11},children:`Ack`})}),e.acknowledged&&(0,X.jsx)(x,{label:`Acked`,size:`small`,variant:`outlined`,color:`default`,sx:{fontSize:10}})]},e.id))})})]}),(0,X.jsxs)(O,{variant:`outlined`,children:[(0,X.jsx)(_,{slotProps:{title:{variant:`subtitle1`,fontWeight:600}},title:`Alert Rules`}),(0,X.jsx)(we,{minWidth:640,scrollLabel:`Alert rules`,columns:[{key:`name`,header:`Name`,render:e=>(0,X.jsx)(R,{variant:`body2`,sx:{fontWeight:600},children:e.name})},{key:`expression`,header:`Expression`,render:e=>(0,X.jsx)(R,{variant:`caption`,sx:{fontFamily:`monospace`,fontSize:12},children:e.expression})},{key:`type`,header:`Type`,render:e=>(0,X.jsx)(x,{label:e.type,size:`small`,variant:`outlined`,sx:{textTransform:`capitalize`,fontSize:11}})},{key:`severity`,header:`Severity`,render:e=>(0,X.jsx)(x,{label:e.severity,size:`small`,color:Q[e.severity]??`default`,variant:`filled`,sx:{textTransform:`capitalize`,fontWeight:600,fontSize:11}})},{key:`forDuration`,header:`Fires after`,render:e=>(0,X.jsx)(R,{variant:`caption`,children:e.forDuration?`${e.forDuration}s held`:`at once`})},{key:`enabled`,header:`Enabled`,align:`center`,render:t=>(0,X.jsx)(W,{size:`small`,checked:t.enabled,disabled:!e(`OmnitronAlerts.updateRule`),onChange:(e,n)=>I(t.id,n)})},{key:`actions`,header:`Actions`,align:`right`,render:e=>(0,X.jsxs)(U,{direction:`row`,spacing:.5,sx:{justifyContent:`flex-end`},children:[(0,X.jsx)(K,{permission:`OmnitronAlerts.deleteRule`,children:(0,X.jsx)(P,{title:`Delete rule`,children:(0,X.jsx)(V,{size:`small`,color:`error`,"aria-label":`Delete rule ${e.name}`,onClick:()=>b(e.id),sx:{marginInlineEnd:1},children:(0,X.jsx)(ge,{sx:{fontSize:18}})})})}),(0,X.jsx)(K,{permission:`OmnitronAlerts.updateRule`,children:(0,X.jsx)(P,{title:`Edit rule`,children:(0,X.jsx)(V,{size:`small`,"aria-label":`Edit rule ${e.name}`,onClick:()=>c(e),children:(0,X.jsx)(he,{sx:{fontSize:18}})})})})]})}],data:B,total:E.length,loading:f,loadError:p??k??null,emptyMessage:`No alert rules configured. Create a rule to get started.`,rowKey:e=>e.id,rowSx:e=>({opacity:e.enabled?1:.5}),page:S,pageSize:w,onPageChange:C,onPageSizeChange:e=>{T(e),C(0)},dense:!0})]}),(0,X.jsx)(K,{permission:`OmnitronAlerts.deleteRule`,children:(0,X.jsx)(Ee,{open:y!==null,onClose:()=>b(null),onConfirm:L,title:`Delete alert rule?`,content:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`b`,{children:E.find(e=>e.id===y)?.name??y}),` will stop firing. Alerts it has already raised are kept.`]}),confirmLabel:`Delete`,confirmColor:`error`})}),(0,X.jsx)(K,{permission:o?`OmnitronAlerts.updateRule`:`OmnitronAlerts.createRule`,children:(0,X.jsx)(Me,{open:o!==void 0,rule:o??null,onClose:()=>c(void 0),onSaved:()=>void m()})})]})}var Y,X,Z,Q;function $(){return($=e((()=>{ce(),Y=t(),o(),f(),z(),m(),h(),u(),N(),ae(),g(),p(),te(),ie(),F(),b(),E(),S(),T(),k(),L(),re(),ee(),C(),c(),fe(),Ce(),oe(),xe(),Te(),De(),i(),ue(),je(),ye(),X=n(),Z=100,Q={critical:`error`,warning:`warning`,info:`info`}})))()}$();export{Ne as default};
@@ -1 +1 @@
1
- import{i as e,n as t,r as n}from"./rolldown-runtime-CNOWq4Kh.js";import{i as r,r as i,t as a}from"./react-BN8qLIAi.js";import{M as o,P as s,V as c,c as l,h as u,j as d,x as f,z as p}from"./client-DFnuv2z3.js";import{Vt as m,Yt as h}from"./mui-BTN91yBK.js";import{a as g,o as _}from"./mui-CdB_p2lt.js";import{F as v,H as y,I as b,Q as x,U as S,V as C,W as w,Z as T,c as ee,d as te,f as ne,g as E,h as re,m as ie,p as ae,s as oe}from"./mui-BXSXx9c9.js";import{B as se,F as D,I as ce,a as O,o as le,z as k}from"./mui-Cd711nOk.js";import{A as ue,C as de,H as fe,V as pe,it as me,k as he,l as ge,rt as A,u as _e,w as ve}from"./mui-AnEgAVjz.js";import{_ as j,v as ye}from"./mui-BwsIrivo.js";import{t as be}from"./dayjs.min-DHwAvH5f.js";import{a as xe,i as Se,n as Ce,o as we,r as Te,t as Ee}from"./mui-dLCwWoMw.js";import{h as De,j as Oe}from"./controls-C5W8gHU4.js";import{r as ke,t as Ae}from"./alert-uBG6r9NW.js";import{n as je,s as Me}from"./access-BvKK9dEv.js";import{r as Ne,t as Pe}from"./use-polled-resource-B22hhr5L.js";import{n as Fe,t as Ie}from"./realtime.store-hfxZD2DU.js";import{a as Le,i as Re,o as ze,r as Be}from"./app-address-BCXfN59F.js";import{G as Ve,M as He,P as Ue,k as We,z as Ge}from"./icons-OboZgWSt.js";import{n as Ke,r as qe}from"./constants-CyhngVXh.js";import{n as Je,t as Ye}from"./table-BOWT6Y9d.js";import{n as Xe,t as Ze}from"./search-input-C0MHI8vO.js";import{n as Qe,t as $e}from"./page-breadcrumbs-fR7Jmpp4.js";import{a as et,s as tt}from"./formatters-RnRy4bXm.js";import{n as nt,t as rt}from"./use-stack-context-8yaHaN8L.js";import{r as it,t as at}from"./stack-health-status-BIv2C10x.js";function M(){return M=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},M.apply(null,arguments)}function ot(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function st(e,t){return st=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},st(e,t)}function ct(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,st(e,t)}function N(){return(N=t((()=>{})))()}function lt(e,t){return e.classList?!!t&&e.classList.contains(t):(` `+(e.className.baseVal||e.className)+` `).indexOf(` `+t+` `)!==-1}function ut(e,t){e.classList?e.classList.add(t):lt(e,t)||(typeof e.className==`string`?e.className=e.className+` `+t:e.setAttribute(`class`,(e.className&&e.className.baseVal||``)+` `+t))}function dt(){return(dt=t((()=>{})))()}function ft(e,t){return e.replace(RegExp(`(^|\\s)`+t+`(?:\\s|$)`,`g`),`$1`).replace(/\s+/g,` `).replace(/^\s*|\s*$/g,``)}function pt(e,t){e.classList?e.classList.remove(t):typeof e.className==`string`?e.className=ft(e.className,t):e.setAttribute(`class`,ft(e.className&&e.className.baseVal||``,t))}function mt(){return(mt=t((()=>{})))()}var ht;function gt(){return(gt=t((()=>{ht={disabled:!1}})))()}var _t;function vt(){return(vt=t((()=>{_t=function(e){return e.scrollTop}})))()}function P(){}var F,I,yt,L,R,z,B,V;function bt(){return(bt=t((()=>{N(),F=e(r()),I=e(i()),gt(),o(),vt(),yt=`unmounted`,L=`exited`,R=`entering`,z=`entered`,B=`exiting`,V=function(e){ct(t,e);function t(t,n){var r=e.call(this,t,n)||this,i=n,a=i&&!i.isMounting?t.enter:t.appear,o;return r.appearStatus=null,t.in?a?(o=L,r.appearStatus=R):o=z:o=t.unmountOnExit||t.mountOnEnter?yt:L,r.state={status:o},r.nextCallback=null,r}t.getDerivedStateFromProps=function(e,t){return e.in&&t.status===`unmounted`?{status:L}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(e){var t=null;if(e!==this.props){var n=this.state.status;this.props.in?n!==`entering`&&n!==`entered`&&(t=R):(n===`entering`||n===`entered`)&&(t=B)}this.updateStatus(!1,t)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var e=this.props.timeout,t=n=r=e,n,r;return e!=null&&typeof e!=`number`&&(t=e.exit,n=e.enter,r=e.appear===void 0?n:e.appear),{exit:t,enter:n,appear:r}},n.updateStatus=function(e,t){if(e===void 0&&(e=!1),t!==null){if(this.cancelNextCallback(),t===`entering`){if(this.props.unmountOnExit||this.props.mountOnEnter){var n=this.props.nodeRef?this.props.nodeRef.current:I.default.findDOMNode(this);n&&_t(n)}this.performEnter(e)}else this.performExit()}else this.props.unmountOnExit&&this.state.status===`exited`&&this.setState({status:yt})},n.performEnter=function(e){var t=this,n=this.props.enter,r=this.context?this.context.isMounting:e,i=this.props.nodeRef?[r]:[I.default.findDOMNode(this),r],a=i[0],o=i[1],s=this.getTimeouts(),c=r?s.appear:s.enter;!e&&!n||ht.disabled?this.safeSetState({status:z},function(){t.props.onEntered(a)}):(this.props.onEnter(a,o),this.safeSetState({status:R},function(){t.props.onEntering(a,o),t.onTransitionEnd(c,function(){t.safeSetState({status:z},function(){t.props.onEntered(a,o)})})}))},n.performExit=function(){var e=this,t=this.props.exit,n=this.getTimeouts(),r=this.props.nodeRef?void 0:I.default.findDOMNode(this);!t||ht.disabled?this.safeSetState({status:L},function(){e.props.onExited(r)}):(this.props.onExit(r),this.safeSetState({status:B},function(){e.props.onExiting(r),e.onTransitionEnd(n.exit,function(){e.safeSetState({status:L},function(){e.props.onExited(r)})})}))},n.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},n.setNextCallback=function(e){var t=this,n=!0;return this.nextCallback=function(r){n&&(n=!1,t.nextCallback=null,e(r))},this.nextCallback.cancel=function(){n=!1},this.nextCallback},n.onTransitionEnd=function(e,t){this.setNextCallback(t);var n=this.props.nodeRef?this.props.nodeRef.current:I.default.findDOMNode(this),r=e==null&&!this.props.addEndListener;if(!n||r)setTimeout(this.nextCallback,0);else{if(this.props.addEndListener){var i=this.props.nodeRef?[this.nextCallback]:[n,this.nextCallback],a=i[0],o=i[1];this.props.addEndListener(a,o)}e!=null&&setTimeout(this.nextCallback,e)}},n.render=function(){var e=this.state.status;if(e===`unmounted`)return null;var t=this.props,n=t.children;t.in,t.mountOnEnter,t.unmountOnExit,t.appear,t.enter,t.exit,t.timeout,t.addEndListener,t.onEnter,t.onEntering,t.onEntered,t.onExit,t.onExiting,t.onExited,t.nodeRef;var r=ot(t,[`children`,`in`,`mountOnEnter`,`unmountOnExit`,`appear`,`enter`,`exit`,`timeout`,`addEndListener`,`onEnter`,`onEntering`,`onEntered`,`onExit`,`onExiting`,`onExited`,`nodeRef`]);return F.createElement(d.Provider,{value:null},typeof n==`function`?n(e,r):F.cloneElement(F.Children.only(n),r))},t}(F.Component),V.contextType=d,V.propTypes={},V.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:P,onEntering:P,onEntered:P,onExit:P,onExiting:P,onExited:P},V.UNMOUNTED=yt,V.EXITED=L,V.ENTERING=R,V.ENTERED=z,V.EXITING=B})))()}var xt,St,H,Ct;function wt(){return(wt=t((()=>{N(),dt(),mt(),xt=e(r()),bt(),vt(),St=function(e,t){return e&&t&&t.split(` `).forEach(function(t){return ut(e,t)})},H=function(e,t){return e&&t&&t.split(` `).forEach(function(t){return pt(e,t)})},Ct=function(e){ct(t,e);function t(){var t,n=[...arguments];return t=e.call.apply(e,[this].concat(n))||this,t.appliedClasses={appear:{},enter:{},exit:{}},t.onEnter=function(e,n){var r=t.resolveArguments(e,n),i=r[0],a=r[1];t.removeClasses(i,`exit`),t.addClass(i,a?`appear`:`enter`,`base`),t.props.onEnter&&t.props.onEnter(e,n)},t.onEntering=function(e,n){var r=t.resolveArguments(e,n),i=r[0],a=r[1]?`appear`:`enter`;t.addClass(i,a,`active`),t.props.onEntering&&t.props.onEntering(e,n)},t.onEntered=function(e,n){var r=t.resolveArguments(e,n),i=r[0],a=r[1]?`appear`:`enter`;t.removeClasses(i,a),t.addClass(i,a,`done`),t.props.onEntered&&t.props.onEntered(e,n)},t.onExit=function(e){var n=t.resolveArguments(e)[0];t.removeClasses(n,`appear`),t.removeClasses(n,`enter`),t.addClass(n,`exit`,`base`),t.props.onExit&&t.props.onExit(e)},t.onExiting=function(e){var n=t.resolveArguments(e)[0];t.addClass(n,`exit`,`active`),t.props.onExiting&&t.props.onExiting(e)},t.onExited=function(e){var n=t.resolveArguments(e)[0];t.removeClasses(n,`exit`),t.addClass(n,`exit`,`done`),t.props.onExited&&t.props.onExited(e)},t.resolveArguments=function(e,n){return t.props.nodeRef?[t.props.nodeRef.current,e]:[e,n]},t.getClassNames=function(e){var n=t.props.classNames,r=typeof n==`string`,i=r&&n?n+`-`:``,a=r?``+i+e:n[e];return{baseClassName:a,activeClassName:r?a+`-active`:n[e+`Active`],doneClassName:r?a+`-done`:n[e+`Done`]}},t}var n=t.prototype;return n.addClass=function(e,t,n){var r=this.getClassNames(t)[n+`ClassName`],i=this.getClassNames(`enter`).doneClassName;t===`appear`&&n===`done`&&i&&(r+=` `+i),n===`active`&&e&&_t(e),r&&(this.appliedClasses[t][n]=r,St(e,r))},n.removeClasses=function(e,t){var n=this.appliedClasses[t],r=n.base,i=n.active,a=n.done;this.appliedClasses[t]={},r&&H(e,r),i&&H(e,i),a&&H(e,a)},n.render=function(){var e=this.props;e.classNames;var t=ot(e,[`classNames`]);return xt.createElement(V,M({},t,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},t}(xt.Component),Ct.defaultProps={classNames:``},Ct.propTypes={}})))()}function Tt(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function Et(e,t){var n=function(e){return t&&(0,W.isValidElement)(e)?t(e):e},r=Object.create(null);return e&&W.Children.map(e,function(e){return e}).forEach(function(e){r[e.key]=n(e)}),r}function Dt(e,t){e||={},t||={};function n(n){return n in t?t[n]:e[n]}var r=Object.create(null),i=[];for(var a in e)a in t?i.length&&(r[a]=i,i=[]):i.push(a);var o,s={};for(var c in t){if(r[c])for(o=0;o<r[c].length;o++){var l=r[c][o];s[r[c][o]]=n(l)}s[c]=n(c)}for(o=0;o<i.length;o++)s[i[o]]=n(i[o]);return s}function U(e,t,n){return n[t]==null?e.props[t]:n[t]}function Ot(e,t){return Et(e.children,function(n){return(0,W.cloneElement)(n,{onExited:t.bind(null,n),in:!0,appear:U(n,`appear`,e),enter:U(n,`enter`,e),exit:U(n,`exit`,e)})})}function kt(e,t,n){var r=Et(e.children),i=Dt(t,r);return Object.keys(i).forEach(function(a){var o=i[a];if((0,W.isValidElement)(o)){var s=a in t,c=a in r,l=t[a],u=(0,W.isValidElement)(l)&&!l.props.in;c&&(!s||u)?i[a]=(0,W.cloneElement)(o,{onExited:n.bind(null,o),in:!0,exit:U(o,`exit`,e),enter:U(o,`enter`,e)}):!c&&s&&!u?i[a]=(0,W.cloneElement)(o,{in:!1}):c&&s&&(0,W.isValidElement)(l)&&(i[a]=(0,W.cloneElement)(o,{onExited:n.bind(null,o),in:l.props.in,exit:U(o,`exit`,e),enter:U(o,`enter`,e)}))}}),i}var W;function At(){return(At=t((()=>{W=r()})))()}var G,jt,Mt,Nt;function Pt(){return(Pt=t((()=>{N(),G=e(r()),o(),At(),jt=Object.values||function(e){return Object.keys(e).map(function(t){return e[t]})},Mt={component:`div`,childFactory:function(e){return e}},Nt=function(e){ct(t,e);function t(t,n){var r=e.call(this,t,n)||this;return r.state={contextValue:{isMounting:!0},handleExited:r.handleExited.bind(Tt(r)),firstRender:!0},r}var n=t.prototype;return n.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},n.componentWillUnmount=function(){this.mounted=!1},t.getDerivedStateFromProps=function(e,t){var n=t.children,r=t.handleExited;return{children:t.firstRender?Ot(e,r):kt(e,n,r),firstRender:!1}},n.handleExited=function(e,t){var n=Et(this.props.children);e.key in n||(e.props.onExited&&e.props.onExited(t),this.mounted&&this.setState(function(t){var n=M({},t.children);return delete n[e.key],{children:n}}))},n.render=function(){var e=this.props,t=e.component,n=e.childFactory,r=ot(e,[`component`,`childFactory`]),i=this.state.contextValue,a=jt(this.state.children).map(n);return delete r.appear,delete r.enter,delete r.exit,t===null?G.createElement(d.Provider,{value:i},a):G.createElement(d.Provider,{value:i},G.createElement(t,r,a))},t}(G.Component),Nt.propTypes={},Nt.defaultProps=Mt})))()}function Ft({open:e,error:t,onClose:n,onSubmit:r,startDate:i,endDate:a,onChangeStartDate:o,onChangeEndDate:s,slotProps:c,variant:l=`input`,title:u,translations:d,selected:f,label:p,shortLabel:m,onOpen:h,onReset:g,setStartDate:y,setEndDate:b,...x}){let S=d?.title??u??`Select date range`,C=d?.startDate??`Start date`,w=d?.endDate??`End date`,T=d?.errorRange??`End date cannot be earlier than start date`,ee=d?.cancel??`Cancel`,ne=d?.apply??`Apply`,E=_(e=>e.breakpoints.up(`md`))&&l===`calendar`,ie=(0,It.useCallback)(()=>{n({},`backdropClick`),r?.()},[n,r]),se=(0,It.useCallback)(()=>{n({},`backdropClick`)},[n]),D=c?.paper?.sx;return(0,K.jsxs)(re,{fullWidth:!0,open:e,onClose:n,maxWidth:!E&&`xs`,slotProps:{...c,paper:{...c?.paper,sx:[{...E&&{maxWidth:720}},...Array.isArray(D)?D:D?[D]:[]]}},...x,children:[(0,K.jsx)(oe,{children:S}),(0,K.jsxs)(te,{sx:[e=>({gap:3,display:`flex`,overflow:`unset`,flexDirection:E?`row`:`column`,[`& .${xe.root}`]:{borderRadius:2,border:`dashed 1px ${e.palette.divider}`}})],children:[E?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Te,{value:i,onChange:o}),(0,K.jsx)(Te,{value:a,onChange:s})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Ee,{label:C,value:i,onChange:o}),(0,K.jsx)(Ee,{label:w,value:a,onChange:s})]}),t&&(0,K.jsx)(pe,{error:!0,sx:{px:2},children:T})]}),(0,K.jsxs)(ae,{children:[(0,K.jsx)(v,{variant:`outlined`,color:`inherit`,onClick:se,children:ee}),(0,K.jsx)(v,{disabled:t,variant:`contained`,onClick:ie,children:ne})]})]})}var It,K;function Lt(){return(Lt=t((()=>{It=r(),b(),E(),ee(),ie(),ne(),g(),fe(),Ce(),Se(),we(),K=a()})))()}function Rt(){return(0,Y.jsxs)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,Y.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`18`,rx:`2`,ry:`2`}),(0,Y.jsx)(`line`,{x1:`16`,y1:`2`,x2:`16`,y2:`6`}),(0,Y.jsx)(`line`,{x1:`8`,y1:`2`,x2:`8`,y2:`6`}),(0,Y.jsx)(`line`,{x1:`3`,y1:`10`,x2:`21`,y2:`10`})]})}function zt(){return(0,Y.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,Y.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,Y.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})}function q(e){if(!e)return null;let t=(0,Ut.default)(e);return t.isValid()?t:null}function Bt(e){return!e||!e.isValid()?``:e.format(`YYYY-MM-DD`)}function Vt(e,t,n,r){if(!e&&!t)return``;let i=q(e),a=q(t);return i&&a?i.isSame(a,`day`)?a.format(`DD MMM YYYY`):i.isSame(a,`month`)?`${i.format(`DD`)} – ${a.format(`DD MMM YYYY`)}`:i.isSame(a,`year`)?`${i.format(`DD MMM`)} – ${a.format(`DD MMM YYYY`)}`:`${i.format(`DD MMM YYYY`)} – ${a.format(`DD MMM YYYY`)}`:i?`${n} ${i.format(`DD MMM YYYY`)}`:a?`${r} ${a.format(`DD MMM YYYY`)}`:``}function Ht({label:e=`Date range`,startDate:t,endDate:n,onChange:r,width:i=220,variant:a=`input`,size:o=`small`,translations:s,pickerTranslations:c}){let[l,u]=(0,J.useState)(!1),[d,f]=(0,J.useState)(q(t)),[p,m]=(0,J.useState)(q(n)),h=s?.placeholder??`Select dates...`,g=s?.from??`From`,_=s?.to??`To`,v=s?.clear??`Clear date range`,y=(0,J.useMemo)(()=>Vt(t,n,g,_),[t,n,g,_]),b=!!t||!!n,x=(0,J.useCallback)(()=>{f(q(t)),m(q(n)),u(!0)},[t,n]),S=(0,J.useCallback)(()=>{u(!1)},[]),C=(0,J.useCallback)(()=>{r(Bt(d),Bt(p)),u(!1)},[d,p,r]),w=(0,J.useCallback)(e=>{e.stopPropagation(),r(``,``)},[r]),T=!!(d&&p&&d.isAfter(p));return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(O,{size:o,label:e,value:y,placeholder:h,onClick:x,slotProps:{input:{readOnly:!0,sx:{cursor:`pointer`},startAdornment:(0,Y.jsx)(he,{position:`start`,sx:{color:`text.disabled`},children:(0,Y.jsx)(Rt,{})}),...b&&{endAdornment:(0,Y.jsx)(he,{position:`end`,children:(0,Y.jsx)(A,{size:`small`,onClick:w,"aria-label":v,sx:{p:.25},children:(0,Y.jsx)(zt,{})})})}},inputLabel:{shrink:!0}},sx:{minWidth:i,"& .MuiOutlinedInput-root":{borderRadius:1},"& .MuiInputBase-input":{cursor:`pointer`}}}),(0,Y.jsx)(Ft,{open:l,error:T,onClose:S,onSubmit:C,startDate:d,endDate:p,onChangeStartDate:f,onChangeEndDate:m,variant:a,translations:c,selected:!!(d&&p),label:``,shortLabel:``,onOpen:x,onReset:()=>{f(null),m(null)},setStartDate:f,setEndDate:m})]})}var J,Ut,Y;function Wt(){return(Wt=t((()=>{J=r(),Ut=e(be(),1),le(),ue(),me(),Lt(),Y=a()})))()}function Gt(e,t){let[n,r]=(0,X.useState)(e);return(0,X.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function Kt(e,t){if(e.type===`date-range`)return!!(t[`${e.key}From`]||t[`${e.key}To`]);if(e.type===`number-range`)return[`Min`,`Max`].some(n=>{let r=t[`${e.key}${n}`];return r!=null&&r!==``});let n=t[e.key];return!(n==null||n===``||Array.isArray(n)&&n.length===0||e.type===`boolean`&&n===!1||e.type===`select`&&n===``)}function qt({filters:e,values:t,onChange:n,onReset:r,total:i,searchDebounce:a=300,compact:o=!1,sx:s,resetLabel:c=`Reset`,resultsLabel:l}){let[,u]=(0,X.useTransition)(),d=e.find(e=>e.type===`search`),[f,p]=(0,X.useState)(t[d?.key??`search`]??``),h=Gt(f,a),g=(0,X.useRef)(h);(0,X.useEffect)(()=>{if(h!==g.current){g.current=h;let e=d?.key??`search`;u(()=>{n({...t,[e]:h})})}},[h,d?.key,n,t]);let _=t[d?.key??`search`]??``;(0,X.useEffect)(()=>{_!==g.current&&(g.current=_,p(_))},[_]);let y=(0,X.useMemo)(()=>e.filter(e=>e.type!==`search`&&Kt(e,t)).length,[e,t]),b=(0,X.useMemo)(()=>e.some(e=>Kt(e,e.type===`search`?{[e.key]:f}:t)),[e,t,f]),x=(0,X.useCallback)((e,r)=>{u(()=>{n({...t,[e]:r})})},[n,t]),w=(0,X.useCallback)(()=>{if(p(``),r)r();else{let t={};for(let n of e)n.type===`search`?t[n.key]=``:n.type===`multi-select`?t[n.key]=[]:n.type===`boolean`?t[n.key]=!1:n.type===`date-range`?(t[`${n.key}From`]=``,t[`${n.key}To`]=``):n.type===`number-range`?(t[`${n.key}Min`]=``,t[`${n.key}Max`]=``):t[n.key]=``;n(t)}},[r,n,e]),ee=(0,X.useCallback)(e=>{let{key:r,type:i,label:a,placeholder:o,options:s}=e;switch(i){case`search`:return(0,Z.jsx)(Ze,{value:f,onChange:p,placeholder:o??`Search...`,"aria-label":a,fullWidth:!0},r);case`select`:return(0,Z.jsxs)(O,{select:!0,size:`small`,value:t[r]??``,onChange:e=>x(r,e.target.value),slotProps:{select:{displayEmpty:!0,"aria-label":a}},sx:{minWidth:0,width:`100%`,"& .MuiOutlinedInput-root":{borderRadius:1}},children:[(0,Z.jsx)(ge,{value:``,children:(0,Z.jsx)(k,{variant:`body2`,sx:{color:`text.secondary`},children:a})}),s?.map(e=>(0,Z.jsx)(ge,{value:e.value,children:e.label},e.value))]},r);case`multi-select`:{let e=t[r]??[];return(0,Z.jsx)(O,{select:!0,size:`small`,value:e,onChange:e=>x(r,e.target.value),slotProps:{select:{multiple:!0,displayEmpty:!0,"aria-label":a,renderValue:e=>{let t=e;return t.length===0?(0,Z.jsx)(k,{variant:`body2`,sx:{color:`text.secondary`},children:a}):(0,Z.jsx)(j,{direction:`row`,spacing:.5,sx:{overflow:`hidden`},children:t.map(e=>{let t=s?.find(t=>t.value===e);return(0,Z.jsx)(T,{label:t?.label??e,size:`small`,sx:{height:20,fontSize:`0.75rem`}},e)})})}}},sx:{minWidth:0,width:`100%`,"& .MuiOutlinedInput-root":{borderRadius:1}},children:s?.map(e=>(0,Z.jsx)(ge,{value:e.value,children:e.label},e.value))},r)}case`date-range`:return(0,Z.jsx)(Ht,{label:a,startDate:t[`${r}From`]??``,endDate:t[`${r}To`]??``,onChange:(e,i)=>{u(()=>n({...t,[`${r}From`]:e,[`${r}To`]:i}))},width:`100%`,size:`small`},r);case`boolean`:return(0,Z.jsx)(T,{label:a,variant:t[r]?`filled`:`outlined`,color:t[r]?`primary`:`default`,onClick:()=>x(r,!t[r]),size:`small`,sx:{borderRadius:1,fontWeight:500,height:32,cursor:`pointer`,transition:e=>e.transitions.create([`background-color`,`color`,`border-color`],{duration:e.transitions.duration.shorter})}},r);case`number-range`:return(0,Z.jsxs)(j,{direction:`row`,spacing:1,sx:{alignItems:`center`},children:[(0,Z.jsx)(O,{type:`number`,size:`small`,label:`${a} min`,value:t[`${r}Min`]??``,onChange:e=>x(`${r}Min`,e.target.value),sx:{flex:1,minWidth:0}}),(0,Z.jsx)(k,{variant:`body2`,sx:{color:`text.disabled`,px:.5},children:`—`}),(0,Z.jsx)(O,{type:`number`,size:`small`,label:`${a} max`,value:t[`${r}Max`]??``,onChange:e=>x(`${r}Max`,e.target.value),sx:{flex:1,minWidth:0}})]},r);default:return null}},[f,t,x,n]);return(0,Z.jsxs)(j,{spacing:o?0:1.5,sx:{p:1.5,minWidth:0,borderRadius:1,border:e=>`1px solid ${e.palette.divider}`,bgcolor:e=>m(e.palette.background.default,.5),...s},children:[(0,Z.jsxs)(j,{direction:`row`,sx:{alignItems:`center`,flexWrap:`wrap`,gap:1.5},children:[e.map(e=>(0,Z.jsx)(C,{sx:{flex:e.type===`search`?`1 1 220px`:`0 1 auto`,width:e.width??(e.type===`number-range`?260:e.type===`boolean`?`auto`:180),minWidth:0,maxWidth:`100%`,"& > .MuiFormControl-root":{width:`100%`,minWidth:0}},children:ee(e)},e.key)),(0,Z.jsxs)(j,{direction:`row`,spacing:1,sx:{alignItems:`center`,ml:`auto`},children:[y>0&&(0,Z.jsx)(S,{badgeContent:y,color:`primary`,sx:{"& .MuiBadge-badge":{fontSize:`0.65rem`}},children:(0,Z.jsx)(C,{sx:{color:`text.secondary`,display:`flex`,alignItems:`center`},children:(0,Z.jsx)(De,{})})}),b&&(0,Z.jsx)(v,{size:`small`,onClick:w,sx:{minWidth:0,px:1.5,fontSize:`0.75rem`,fontWeight:500,color:`text.secondary`,"&:hover":{color:`text.primary`}},children:c})]})]}),i!==void 0&&!o&&(0,Z.jsx)(k,{variant:`caption`,sx:{color:`text.disabled`,mt:.5},children:l?l(i):`${i.toLocaleString()} result${i===1?``:`s`}`})]})}var X,Z;function Jt(){return(Jt=t((()=>{Oe(),X=r(),ye(),le(),x(),_e(),y(),b(),se(),w(),h(),Wt(),Xe(),Z=a()})))()}var Yt=n({default:()=>Xt});function Xt(){let e=c(),[t,n]=(0,Q.useState)([]),[r,i]=(0,Q.useState)(!0),[a,o]=(0,Q.useState)(null),[u,d]=(0,Q.useState)({search:``,status:``}),[p,m]=(0,Q.useState)(null),{activeProject:h,activeStack:g}=nt(),_=(0,Q.useCallback)(async()=>{if(h)try{n(await f.getProjectApps({project:h})),o(null)}catch(e){o(e?.message??`Failed to fetch applications`)}finally{i(!1)}},[h]),v=Be(t,g),y=v.filter(e=>`${e.name} ${e.stack}`.toLowerCase().includes(String(u.search??``).toLowerCase())&&(!u.status||e.status===u.status)),b=Fe(e=>e.connected),x=Fe(e=>e.lastEvent),S=Fe(e=>e.initialize);(0,Q.useEffect)(()=>S(),[S]),Ne(()=>void _(),{intervalMs:b?15e3:5e3}),(0,Q.useEffect)(()=>{x&&_()},[x,_]);let C=async e=>{m(e);try{await l.restartApp({name:e}),await _()}catch(t){o(`Failed to restart ${e}: ${t?.message??`Unknown error`}`)}finally{m(null)}},w=async e=>{m(e);try{let t=await l.stopApp({name:e});if(!t.success){o(`Failed to stop ${e}: ${t.error??`the daemon reported failure`}`);return}await _()}catch(t){o(`Failed to stop ${e}: ${t?.message??`Unknown error`}`)}finally{m(null)}},ee=async e=>{m(e);try{await l.startApp({name:e}),await _()}catch(t){o(`Failed to start ${e}: ${t?.message??`Unknown error`}`)}finally{m(null)}},te=[{id:`name`,label:`Name`,render:e=>ze(e)?(0,$.jsx)(de,{component:s,to:Re(e),variant:`body2`,underline:`hover`,sx:{fontWeight:600,color:`text.primary`},onClick:e=>e.stopPropagation(),children:e.name}):(0,$.jsx)(k,{variant:`body2`,sx:{fontWeight:600},children:e.name})},...g?[]:[{id:`stack`,label:`Stack`,render:e=>(0,$.jsx)(de,{component:s,to:`/stacks/${encodeURIComponent(e.stack)}`,variant:`body2`,underline:`hover`,onClick:e=>e.stopPropagation(),children:ze(e)?e.stack:`${e.stack} · ${e.stackType}`})}],{id:`status`,label:`Process`,render:e=>(0,$.jsx)(T,{label:e.status,size:`small`,color:Ke[e.status]||`default`,variant:`outlined`})},{id:`health`,label:`Health`,render:e=>(0,$.jsx)(at,{status:e.health})},{id:`instances`,label:`Instances`,align:`right`},{id:`pid`,label:`PID`,align:`right`,render:e=>(0,$.jsx)(k,{variant:`body2`,sx:{fontFamily:`monospace`},children:e.pid??`--`})},{id:`uptime`,label:`Uptime`,render:e=>tt(e.uptime)},{id:`cpu`,label:`CPU %`,align:`right`,render:e=>e.cpu>0?e.cpu.toFixed(1):`--`},{id:`memory`,label:`Memory MB`,align:`right`,render:e=>et(e.memory)},{id:`actions`,label:`Actions`,align:`center`,render:e=>ze(e)?(0,$.jsx)(j,{direction:`row`,spacing:.5,sx:{justifyContent:`center`},onClick:e=>e.stopPropagation(),children:e.status===`stopped`||e.status===`crashed`||e.status===`errored`?(0,$.jsx)(je,{permission:`OmnitronDaemon.startApp`,children:(0,$.jsx)(D,{title:`Start`,children:(0,$.jsx)(A,{size:`small`,color:`success`,disabled:p===e.handleKey,onClick:()=>ee(e.handleKey),children:(0,$.jsx)(We,{sx:{fontSize:18}})})})}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(je,{permission:`OmnitronDaemon.restartApp`,children:(0,$.jsx)(D,{title:`Restart`,children:(0,$.jsx)(A,{size:`small`,color:`warning`,disabled:p===e.handleKey,onClick:()=>C(e.handleKey),children:(0,$.jsx)(Ue,{sx:{fontSize:18}})})})}),(0,$.jsx)(je,{permission:`OmnitronDaemon.stopApp`,children:(0,$.jsx)(D,{title:`Stop`,children:(0,$.jsx)(A,{size:`small`,color:`error`,disabled:p===e.handleKey,onClick:()=>w(e.handleKey),children:(0,$.jsx)(Ge,{sx:{fontSize:18}})})})})]})}):(0,$.jsx)(D,{title:`Runs on a node — started and stopped with its stack`,children:(0,$.jsx)(k,{variant:`caption`,sx:{color:`text.disabled`},children:`on node`})})}];return(0,$.jsxs)(j,{spacing:3,children:[(0,$.jsx)($e,{linkComponent:s,links:[{name:`Applications`}],action:(0,$.jsx)(A,{"data-console-command":`refresh`,onClick:_,title:`Refresh`,children:(0,$.jsx)(He,{})})}),a&&(0,$.jsx)(Ae,{closable:!0,severity:`error`,variant:`outlined`,sx:{mb:2},onClose:()=>o(null),children:a}),(0,$.jsx)(qt,{filters:[{key:`search`,type:`search`,label:`Search applications`,placeholder:`Application or stack…`},{key:`status`,type:`select`,label:`All statuses`,options:[...new Set(v.map(e=>e.status))].map(e=>({value:e,label:e}))}],values:u,onChange:d,total:y.length}),(0,$.jsx)(Ye,{scrollLabel:`Applications`,sx:{minWidth:800},columns:te,data:y,rowKey:e=>`${e.stack}/${e.name}`,loading:r,loadingRows:3,onRowClick:t=>e(ze(t)?Re(t):`/stacks/${encodeURIComponent(t.stack)}`),emptyContent:(0,$.jsxs)(j,{spacing:1,sx:{alignItems:`center`},children:[(0,$.jsx)(k,{variant:`body2`,sx:{color:`text.secondary`},children:v.length?`No applications match these filters.`:`No applications deployed yet.`}),(0,$.jsx)(k,{variant:`caption`,sx:{color:`text.disabled`},children:v.length?`Change or reset the filters to see more applications.`:(0,$.jsxs)($.Fragment,{children:[`Use `,(0,$.jsx)(`code`,{children:`omnitron deploy`}),` to get started.`]})})]})})]})}var Q,$;function Zt(){return(Zt=t((()=>{it(),Me(),Q=r(),p(),se(),ye(),ke(),Qe(),Jt(),Je(),x(),me(),ce(),ve(),Ve(),u(),qe(),rt(),Ie(),Pe(),Le(),$=a()})))()}export{Ct as a,Pt as i,Zt as n,wt as o,Nt as r,Yt as t};
1
+ import{i as e,n as t,r as n}from"./rolldown-runtime-CNOWq4Kh.js";import{i as r,r as i,t as a}from"./react-BN8qLIAi.js";import{M as o,P as s,V as c,c as l,h as u,j as d,x as f,z as p}from"./client-CgyTwq9g.js";import{Vt as m,Yt as h}from"./mui-BTN91yBK.js";import{a as g,o as _}from"./mui-Bdr6Ks5j.js";import{F as v,H as y,I as b,Q as x,U as S,V as C,W as w,Z as T,c as ee,d as te,f as ne,g as E,h as re,m as ie,p as ae,s as oe}from"./mui-SNRRJ_vi.js";import{B as se,F as D,I as ce,a as O,o as le,z as k}from"./mui-B3fJdIMc.js";import{A as ue,C as de,H as fe,V as pe,it as me,k as he,l as ge,rt as A,u as _e,w as ve}from"./mui-CMWGTMXv.js";import{_ as j,v as ye}from"./mui-CPEkFAPo.js";import{t as be}from"./dayjs.min-DHwAvH5f.js";import{a as xe,i as Se,n as Ce,o as we,r as Te,t as Ee}from"./mui-D3qAWvfZ.js";import{h as De,j as Oe}from"./controls-CqeGPnaF.js";import{r as ke,t as Ae}from"./alert-BdJ2uaY0.js";import{n as je,s as Me}from"./access-I0f72P9m.js";import{r as Ne,t as Pe}from"./use-polled-resource-B22hhr5L.js";import{n as Fe,t as Ie}from"./realtime.store-C8D235-B.js";import{a as Le,i as Re,o as ze,r as Be}from"./app-address-BCXfN59F.js";import{G as Ve,M as He,P as Ue,k as We,z as Ge}from"./icons-B9Ct8PJ9.js";import{n as Ke,r as qe}from"./constants-CyhngVXh.js";import{n as Je,t as Ye}from"./table-D-so_B1p.js";import{n as Xe,t as Ze}from"./search-input-SWD1dXxD.js";import{n as Qe,t as $e}from"./page-breadcrumbs-3R8RZ3nA.js";import{a as et,s as tt}from"./formatters-RnRy4bXm.js";import{n as nt,t as rt}from"./use-stack-context-BuraYaeY.js";import{r as it,t as at}from"./stack-health-status-DfErRNb1.js";function M(){return M=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},M.apply(null,arguments)}function ot(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function st(e,t){return st=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},st(e,t)}function ct(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,st(e,t)}function N(){return(N=t((()=>{})))()}function lt(e,t){return e.classList?!!t&&e.classList.contains(t):(` `+(e.className.baseVal||e.className)+` `).indexOf(` `+t+` `)!==-1}function ut(e,t){e.classList?e.classList.add(t):lt(e,t)||(typeof e.className==`string`?e.className=e.className+` `+t:e.setAttribute(`class`,(e.className&&e.className.baseVal||``)+` `+t))}function dt(){return(dt=t((()=>{})))()}function ft(e,t){return e.replace(RegExp(`(^|\\s)`+t+`(?:\\s|$)`,`g`),`$1`).replace(/\s+/g,` `).replace(/^\s*|\s*$/g,``)}function pt(e,t){e.classList?e.classList.remove(t):typeof e.className==`string`?e.className=ft(e.className,t):e.setAttribute(`class`,ft(e.className&&e.className.baseVal||``,t))}function mt(){return(mt=t((()=>{})))()}var ht;function gt(){return(gt=t((()=>{ht={disabled:!1}})))()}var _t;function vt(){return(vt=t((()=>{_t=function(e){return e.scrollTop}})))()}function P(){}var F,I,yt,L,R,z,B,V;function bt(){return(bt=t((()=>{N(),F=e(r()),I=e(i()),gt(),o(),vt(),yt=`unmounted`,L=`exited`,R=`entering`,z=`entered`,B=`exiting`,V=function(e){ct(t,e);function t(t,n){var r=e.call(this,t,n)||this,i=n,a=i&&!i.isMounting?t.enter:t.appear,o;return r.appearStatus=null,t.in?a?(o=L,r.appearStatus=R):o=z:o=t.unmountOnExit||t.mountOnEnter?yt:L,r.state={status:o},r.nextCallback=null,r}t.getDerivedStateFromProps=function(e,t){return e.in&&t.status===`unmounted`?{status:L}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(e){var t=null;if(e!==this.props){var n=this.state.status;this.props.in?n!==`entering`&&n!==`entered`&&(t=R):(n===`entering`||n===`entered`)&&(t=B)}this.updateStatus(!1,t)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var e=this.props.timeout,t=n=r=e,n,r;return e!=null&&typeof e!=`number`&&(t=e.exit,n=e.enter,r=e.appear===void 0?n:e.appear),{exit:t,enter:n,appear:r}},n.updateStatus=function(e,t){if(e===void 0&&(e=!1),t!==null){if(this.cancelNextCallback(),t===`entering`){if(this.props.unmountOnExit||this.props.mountOnEnter){var n=this.props.nodeRef?this.props.nodeRef.current:I.default.findDOMNode(this);n&&_t(n)}this.performEnter(e)}else this.performExit()}else this.props.unmountOnExit&&this.state.status===`exited`&&this.setState({status:yt})},n.performEnter=function(e){var t=this,n=this.props.enter,r=this.context?this.context.isMounting:e,i=this.props.nodeRef?[r]:[I.default.findDOMNode(this),r],a=i[0],o=i[1],s=this.getTimeouts(),c=r?s.appear:s.enter;!e&&!n||ht.disabled?this.safeSetState({status:z},function(){t.props.onEntered(a)}):(this.props.onEnter(a,o),this.safeSetState({status:R},function(){t.props.onEntering(a,o),t.onTransitionEnd(c,function(){t.safeSetState({status:z},function(){t.props.onEntered(a,o)})})}))},n.performExit=function(){var e=this,t=this.props.exit,n=this.getTimeouts(),r=this.props.nodeRef?void 0:I.default.findDOMNode(this);!t||ht.disabled?this.safeSetState({status:L},function(){e.props.onExited(r)}):(this.props.onExit(r),this.safeSetState({status:B},function(){e.props.onExiting(r),e.onTransitionEnd(n.exit,function(){e.safeSetState({status:L},function(){e.props.onExited(r)})})}))},n.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},n.setNextCallback=function(e){var t=this,n=!0;return this.nextCallback=function(r){n&&(n=!1,t.nextCallback=null,e(r))},this.nextCallback.cancel=function(){n=!1},this.nextCallback},n.onTransitionEnd=function(e,t){this.setNextCallback(t);var n=this.props.nodeRef?this.props.nodeRef.current:I.default.findDOMNode(this),r=e==null&&!this.props.addEndListener;if(!n||r)setTimeout(this.nextCallback,0);else{if(this.props.addEndListener){var i=this.props.nodeRef?[this.nextCallback]:[n,this.nextCallback],a=i[0],o=i[1];this.props.addEndListener(a,o)}e!=null&&setTimeout(this.nextCallback,e)}},n.render=function(){var e=this.state.status;if(e===`unmounted`)return null;var t=this.props,n=t.children;t.in,t.mountOnEnter,t.unmountOnExit,t.appear,t.enter,t.exit,t.timeout,t.addEndListener,t.onEnter,t.onEntering,t.onEntered,t.onExit,t.onExiting,t.onExited,t.nodeRef;var r=ot(t,[`children`,`in`,`mountOnEnter`,`unmountOnExit`,`appear`,`enter`,`exit`,`timeout`,`addEndListener`,`onEnter`,`onEntering`,`onEntered`,`onExit`,`onExiting`,`onExited`,`nodeRef`]);return F.createElement(d.Provider,{value:null},typeof n==`function`?n(e,r):F.cloneElement(F.Children.only(n),r))},t}(F.Component),V.contextType=d,V.propTypes={},V.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:P,onEntering:P,onEntered:P,onExit:P,onExiting:P,onExited:P},V.UNMOUNTED=yt,V.EXITED=L,V.ENTERING=R,V.ENTERED=z,V.EXITING=B})))()}var xt,St,H,Ct;function wt(){return(wt=t((()=>{N(),dt(),mt(),xt=e(r()),bt(),vt(),St=function(e,t){return e&&t&&t.split(` `).forEach(function(t){return ut(e,t)})},H=function(e,t){return e&&t&&t.split(` `).forEach(function(t){return pt(e,t)})},Ct=function(e){ct(t,e);function t(){var t,n=[...arguments];return t=e.call.apply(e,[this].concat(n))||this,t.appliedClasses={appear:{},enter:{},exit:{}},t.onEnter=function(e,n){var r=t.resolveArguments(e,n),i=r[0],a=r[1];t.removeClasses(i,`exit`),t.addClass(i,a?`appear`:`enter`,`base`),t.props.onEnter&&t.props.onEnter(e,n)},t.onEntering=function(e,n){var r=t.resolveArguments(e,n),i=r[0],a=r[1]?`appear`:`enter`;t.addClass(i,a,`active`),t.props.onEntering&&t.props.onEntering(e,n)},t.onEntered=function(e,n){var r=t.resolveArguments(e,n),i=r[0],a=r[1]?`appear`:`enter`;t.removeClasses(i,a),t.addClass(i,a,`done`),t.props.onEntered&&t.props.onEntered(e,n)},t.onExit=function(e){var n=t.resolveArguments(e)[0];t.removeClasses(n,`appear`),t.removeClasses(n,`enter`),t.addClass(n,`exit`,`base`),t.props.onExit&&t.props.onExit(e)},t.onExiting=function(e){var n=t.resolveArguments(e)[0];t.addClass(n,`exit`,`active`),t.props.onExiting&&t.props.onExiting(e)},t.onExited=function(e){var n=t.resolveArguments(e)[0];t.removeClasses(n,`exit`),t.addClass(n,`exit`,`done`),t.props.onExited&&t.props.onExited(e)},t.resolveArguments=function(e,n){return t.props.nodeRef?[t.props.nodeRef.current,e]:[e,n]},t.getClassNames=function(e){var n=t.props.classNames,r=typeof n==`string`,i=r&&n?n+`-`:``,a=r?``+i+e:n[e];return{baseClassName:a,activeClassName:r?a+`-active`:n[e+`Active`],doneClassName:r?a+`-done`:n[e+`Done`]}},t}var n=t.prototype;return n.addClass=function(e,t,n){var r=this.getClassNames(t)[n+`ClassName`],i=this.getClassNames(`enter`).doneClassName;t===`appear`&&n===`done`&&i&&(r+=` `+i),n===`active`&&e&&_t(e),r&&(this.appliedClasses[t][n]=r,St(e,r))},n.removeClasses=function(e,t){var n=this.appliedClasses[t],r=n.base,i=n.active,a=n.done;this.appliedClasses[t]={},r&&H(e,r),i&&H(e,i),a&&H(e,a)},n.render=function(){var e=this.props;e.classNames;var t=ot(e,[`classNames`]);return xt.createElement(V,M({},t,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},t}(xt.Component),Ct.defaultProps={classNames:``},Ct.propTypes={}})))()}function Tt(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function Et(e,t){var n=function(e){return t&&(0,W.isValidElement)(e)?t(e):e},r=Object.create(null);return e&&W.Children.map(e,function(e){return e}).forEach(function(e){r[e.key]=n(e)}),r}function Dt(e,t){e||={},t||={};function n(n){return n in t?t[n]:e[n]}var r=Object.create(null),i=[];for(var a in e)a in t?i.length&&(r[a]=i,i=[]):i.push(a);var o,s={};for(var c in t){if(r[c])for(o=0;o<r[c].length;o++){var l=r[c][o];s[r[c][o]]=n(l)}s[c]=n(c)}for(o=0;o<i.length;o++)s[i[o]]=n(i[o]);return s}function U(e,t,n){return n[t]==null?e.props[t]:n[t]}function Ot(e,t){return Et(e.children,function(n){return(0,W.cloneElement)(n,{onExited:t.bind(null,n),in:!0,appear:U(n,`appear`,e),enter:U(n,`enter`,e),exit:U(n,`exit`,e)})})}function kt(e,t,n){var r=Et(e.children),i=Dt(t,r);return Object.keys(i).forEach(function(a){var o=i[a];if((0,W.isValidElement)(o)){var s=a in t,c=a in r,l=t[a],u=(0,W.isValidElement)(l)&&!l.props.in;c&&(!s||u)?i[a]=(0,W.cloneElement)(o,{onExited:n.bind(null,o),in:!0,exit:U(o,`exit`,e),enter:U(o,`enter`,e)}):!c&&s&&!u?i[a]=(0,W.cloneElement)(o,{in:!1}):c&&s&&(0,W.isValidElement)(l)&&(i[a]=(0,W.cloneElement)(o,{onExited:n.bind(null,o),in:l.props.in,exit:U(o,`exit`,e),enter:U(o,`enter`,e)}))}}),i}var W;function At(){return(At=t((()=>{W=r()})))()}var G,jt,Mt,Nt;function Pt(){return(Pt=t((()=>{N(),G=e(r()),o(),At(),jt=Object.values||function(e){return Object.keys(e).map(function(t){return e[t]})},Mt={component:`div`,childFactory:function(e){return e}},Nt=function(e){ct(t,e);function t(t,n){var r=e.call(this,t,n)||this;return r.state={contextValue:{isMounting:!0},handleExited:r.handleExited.bind(Tt(r)),firstRender:!0},r}var n=t.prototype;return n.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},n.componentWillUnmount=function(){this.mounted=!1},t.getDerivedStateFromProps=function(e,t){var n=t.children,r=t.handleExited;return{children:t.firstRender?Ot(e,r):kt(e,n,r),firstRender:!1}},n.handleExited=function(e,t){var n=Et(this.props.children);e.key in n||(e.props.onExited&&e.props.onExited(t),this.mounted&&this.setState(function(t){var n=M({},t.children);return delete n[e.key],{children:n}}))},n.render=function(){var e=this.props,t=e.component,n=e.childFactory,r=ot(e,[`component`,`childFactory`]),i=this.state.contextValue,a=jt(this.state.children).map(n);return delete r.appear,delete r.enter,delete r.exit,t===null?G.createElement(d.Provider,{value:i},a):G.createElement(d.Provider,{value:i},G.createElement(t,r,a))},t}(G.Component),Nt.propTypes={},Nt.defaultProps=Mt})))()}function Ft({open:e,error:t,onClose:n,onSubmit:r,startDate:i,endDate:a,onChangeStartDate:o,onChangeEndDate:s,slotProps:c,variant:l=`input`,title:u,translations:d,selected:f,label:p,shortLabel:m,onOpen:h,onReset:g,setStartDate:y,setEndDate:b,...x}){let S=d?.title??u??`Select date range`,C=d?.startDate??`Start date`,w=d?.endDate??`End date`,T=d?.errorRange??`End date cannot be earlier than start date`,ee=d?.cancel??`Cancel`,ne=d?.apply??`Apply`,E=_(e=>e.breakpoints.up(`md`))&&l===`calendar`,ie=(0,It.useCallback)(()=>{n({},`backdropClick`),r?.()},[n,r]),se=(0,It.useCallback)(()=>{n({},`backdropClick`)},[n]),D=c?.paper?.sx;return(0,K.jsxs)(re,{fullWidth:!0,open:e,onClose:n,maxWidth:!E&&`xs`,slotProps:{...c,paper:{...c?.paper,sx:[{...E&&{maxWidth:720}},...Array.isArray(D)?D:D?[D]:[]]}},...x,children:[(0,K.jsx)(oe,{children:S}),(0,K.jsxs)(te,{sx:[e=>({gap:3,display:`flex`,overflow:`unset`,flexDirection:E?`row`:`column`,[`& .${xe.root}`]:{borderRadius:2,border:`dashed 1px ${e.palette.divider}`}})],children:[E?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Te,{value:i,onChange:o}),(0,K.jsx)(Te,{value:a,onChange:s})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Ee,{label:C,value:i,onChange:o}),(0,K.jsx)(Ee,{label:w,value:a,onChange:s})]}),t&&(0,K.jsx)(pe,{error:!0,sx:{px:2},children:T})]}),(0,K.jsxs)(ae,{children:[(0,K.jsx)(v,{variant:`outlined`,color:`inherit`,onClick:se,children:ee}),(0,K.jsx)(v,{disabled:t,variant:`contained`,onClick:ie,children:ne})]})]})}var It,K;function Lt(){return(Lt=t((()=>{It=r(),b(),E(),ee(),ie(),ne(),g(),fe(),Ce(),Se(),we(),K=a()})))()}function Rt(){return(0,Y.jsxs)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,Y.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`18`,rx:`2`,ry:`2`}),(0,Y.jsx)(`line`,{x1:`16`,y1:`2`,x2:`16`,y2:`6`}),(0,Y.jsx)(`line`,{x1:`8`,y1:`2`,x2:`8`,y2:`6`}),(0,Y.jsx)(`line`,{x1:`3`,y1:`10`,x2:`21`,y2:`10`})]})}function zt(){return(0,Y.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,Y.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,Y.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})}function q(e){if(!e)return null;let t=(0,Ut.default)(e);return t.isValid()?t:null}function Bt(e){return!e||!e.isValid()?``:e.format(`YYYY-MM-DD`)}function Vt(e,t,n,r){if(!e&&!t)return``;let i=q(e),a=q(t);return i&&a?i.isSame(a,`day`)?a.format(`DD MMM YYYY`):i.isSame(a,`month`)?`${i.format(`DD`)} – ${a.format(`DD MMM YYYY`)}`:i.isSame(a,`year`)?`${i.format(`DD MMM`)} – ${a.format(`DD MMM YYYY`)}`:`${i.format(`DD MMM YYYY`)} – ${a.format(`DD MMM YYYY`)}`:i?`${n} ${i.format(`DD MMM YYYY`)}`:a?`${r} ${a.format(`DD MMM YYYY`)}`:``}function Ht({label:e=`Date range`,startDate:t,endDate:n,onChange:r,width:i=220,variant:a=`input`,size:o=`small`,translations:s,pickerTranslations:c}){let[l,u]=(0,J.useState)(!1),[d,f]=(0,J.useState)(q(t)),[p,m]=(0,J.useState)(q(n)),h=s?.placeholder??`Select dates...`,g=s?.from??`From`,_=s?.to??`To`,v=s?.clear??`Clear date range`,y=(0,J.useMemo)(()=>Vt(t,n,g,_),[t,n,g,_]),b=!!t||!!n,x=(0,J.useCallback)(()=>{f(q(t)),m(q(n)),u(!0)},[t,n]),S=(0,J.useCallback)(()=>{u(!1)},[]),C=(0,J.useCallback)(()=>{r(Bt(d),Bt(p)),u(!1)},[d,p,r]),w=(0,J.useCallback)(e=>{e.stopPropagation(),r(``,``)},[r]),T=!!(d&&p&&d.isAfter(p));return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(O,{size:o,label:e,value:y,placeholder:h,onClick:x,slotProps:{input:{readOnly:!0,sx:{cursor:`pointer`},startAdornment:(0,Y.jsx)(he,{position:`start`,sx:{color:`text.disabled`},children:(0,Y.jsx)(Rt,{})}),...b&&{endAdornment:(0,Y.jsx)(he,{position:`end`,children:(0,Y.jsx)(A,{size:`small`,onClick:w,"aria-label":v,sx:{p:.25},children:(0,Y.jsx)(zt,{})})})}},inputLabel:{shrink:!0}},sx:{minWidth:i,"& .MuiOutlinedInput-root":{borderRadius:1},"& .MuiInputBase-input":{cursor:`pointer`}}}),(0,Y.jsx)(Ft,{open:l,error:T,onClose:S,onSubmit:C,startDate:d,endDate:p,onChangeStartDate:f,onChangeEndDate:m,variant:a,translations:c,selected:!!(d&&p),label:``,shortLabel:``,onOpen:x,onReset:()=>{f(null),m(null)},setStartDate:f,setEndDate:m})]})}var J,Ut,Y;function Wt(){return(Wt=t((()=>{J=r(),Ut=e(be(),1),le(),ue(),me(),Lt(),Y=a()})))()}function Gt(e,t){let[n,r]=(0,X.useState)(e);return(0,X.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function Kt(e,t){if(e.type===`date-range`)return!!(t[`${e.key}From`]||t[`${e.key}To`]);if(e.type===`number-range`)return[`Min`,`Max`].some(n=>{let r=t[`${e.key}${n}`];return r!=null&&r!==``});let n=t[e.key];return!(n==null||n===``||Array.isArray(n)&&n.length===0||e.type===`boolean`&&n===!1||e.type===`select`&&n===``)}function qt({filters:e,values:t,onChange:n,onReset:r,total:i,searchDebounce:a=300,compact:o=!1,sx:s,resetLabel:c=`Reset`,resultsLabel:l}){let[,u]=(0,X.useTransition)(),d=e.find(e=>e.type===`search`),[f,p]=(0,X.useState)(t[d?.key??`search`]??``),h=Gt(f,a),g=(0,X.useRef)(h);(0,X.useEffect)(()=>{if(h!==g.current){g.current=h;let e=d?.key??`search`;u(()=>{n({...t,[e]:h})})}},[h,d?.key,n,t]);let _=t[d?.key??`search`]??``;(0,X.useEffect)(()=>{_!==g.current&&(g.current=_,p(_))},[_]);let y=(0,X.useMemo)(()=>e.filter(e=>e.type!==`search`&&Kt(e,t)).length,[e,t]),b=(0,X.useMemo)(()=>e.some(e=>Kt(e,e.type===`search`?{[e.key]:f}:t)),[e,t,f]),x=(0,X.useCallback)((e,r)=>{u(()=>{n({...t,[e]:r})})},[n,t]),w=(0,X.useCallback)(()=>{if(p(``),r)r();else{let t={};for(let n of e)n.type===`search`?t[n.key]=``:n.type===`multi-select`?t[n.key]=[]:n.type===`boolean`?t[n.key]=!1:n.type===`date-range`?(t[`${n.key}From`]=``,t[`${n.key}To`]=``):n.type===`number-range`?(t[`${n.key}Min`]=``,t[`${n.key}Max`]=``):t[n.key]=``;n(t)}},[r,n,e]),ee=(0,X.useCallback)(e=>{let{key:r,type:i,label:a,placeholder:o,options:s}=e;switch(i){case`search`:return(0,Z.jsx)(Ze,{value:f,onChange:p,placeholder:o??`Search...`,"aria-label":a,fullWidth:!0},r);case`select`:return(0,Z.jsxs)(O,{select:!0,size:`small`,value:t[r]??``,onChange:e=>x(r,e.target.value),slotProps:{select:{displayEmpty:!0,"aria-label":a}},sx:{minWidth:0,width:`100%`,"& .MuiOutlinedInput-root":{borderRadius:1}},children:[(0,Z.jsx)(ge,{value:``,children:(0,Z.jsx)(k,{variant:`body2`,sx:{color:`text.secondary`},children:a})}),s?.map(e=>(0,Z.jsx)(ge,{value:e.value,children:e.label},e.value))]},r);case`multi-select`:{let e=t[r]??[];return(0,Z.jsx)(O,{select:!0,size:`small`,value:e,onChange:e=>x(r,e.target.value),slotProps:{select:{multiple:!0,displayEmpty:!0,"aria-label":a,renderValue:e=>{let t=e;return t.length===0?(0,Z.jsx)(k,{variant:`body2`,sx:{color:`text.secondary`},children:a}):(0,Z.jsx)(j,{direction:`row`,spacing:.5,sx:{overflow:`hidden`},children:t.map(e=>{let t=s?.find(t=>t.value===e);return(0,Z.jsx)(T,{label:t?.label??e,size:`small`,sx:{height:20,fontSize:`0.75rem`}},e)})})}}},sx:{minWidth:0,width:`100%`,"& .MuiOutlinedInput-root":{borderRadius:1}},children:s?.map(e=>(0,Z.jsx)(ge,{value:e.value,children:e.label},e.value))},r)}case`date-range`:return(0,Z.jsx)(Ht,{label:a,startDate:t[`${r}From`]??``,endDate:t[`${r}To`]??``,onChange:(e,i)=>{u(()=>n({...t,[`${r}From`]:e,[`${r}To`]:i}))},width:`100%`,size:`small`},r);case`boolean`:return(0,Z.jsx)(T,{label:a,variant:t[r]?`filled`:`outlined`,color:t[r]?`primary`:`default`,onClick:()=>x(r,!t[r]),size:`small`,sx:{borderRadius:1,fontWeight:500,height:32,cursor:`pointer`,transition:e=>e.transitions.create([`background-color`,`color`,`border-color`],{duration:e.transitions.duration.shorter})}},r);case`number-range`:return(0,Z.jsxs)(j,{direction:`row`,spacing:1,sx:{alignItems:`center`},children:[(0,Z.jsx)(O,{type:`number`,size:`small`,label:`${a} min`,value:t[`${r}Min`]??``,onChange:e=>x(`${r}Min`,e.target.value),sx:{flex:1,minWidth:0}}),(0,Z.jsx)(k,{variant:`body2`,sx:{color:`text.disabled`,px:.5},children:`—`}),(0,Z.jsx)(O,{type:`number`,size:`small`,label:`${a} max`,value:t[`${r}Max`]??``,onChange:e=>x(`${r}Max`,e.target.value),sx:{flex:1,minWidth:0}})]},r);default:return null}},[f,t,x,n]);return(0,Z.jsxs)(j,{spacing:o?0:1.5,sx:{p:1.5,minWidth:0,borderRadius:1,border:e=>`1px solid ${e.palette.divider}`,bgcolor:e=>m(e.palette.background.default,.5),...s},children:[(0,Z.jsxs)(j,{direction:`row`,sx:{alignItems:`center`,flexWrap:`wrap`,gap:1.5},children:[e.map(e=>(0,Z.jsx)(C,{sx:{flex:e.type===`search`?`1 1 220px`:`0 1 auto`,width:e.width??(e.type===`number-range`?260:e.type===`boolean`?`auto`:180),minWidth:0,maxWidth:`100%`,"& > .MuiFormControl-root":{width:`100%`,minWidth:0}},children:ee(e)},e.key)),(0,Z.jsxs)(j,{direction:`row`,spacing:1,sx:{alignItems:`center`,ml:`auto`},children:[y>0&&(0,Z.jsx)(S,{badgeContent:y,color:`primary`,sx:{"& .MuiBadge-badge":{fontSize:`0.65rem`}},children:(0,Z.jsx)(C,{sx:{color:`text.secondary`,display:`flex`,alignItems:`center`},children:(0,Z.jsx)(De,{})})}),b&&(0,Z.jsx)(v,{size:`small`,onClick:w,sx:{minWidth:0,px:1.5,fontSize:`0.75rem`,fontWeight:500,color:`text.secondary`,"&:hover":{color:`text.primary`}},children:c})]})]}),i!==void 0&&!o&&(0,Z.jsx)(k,{variant:`caption`,sx:{color:`text.disabled`,mt:.5},children:l?l(i):`${i.toLocaleString()} result${i===1?``:`s`}`})]})}var X,Z;function Jt(){return(Jt=t((()=>{Oe(),X=r(),ye(),le(),x(),_e(),y(),b(),se(),w(),h(),Wt(),Xe(),Z=a()})))()}var Yt=n({default:()=>Xt});function Xt(){let e=c(),[t,n]=(0,Q.useState)([]),[r,i]=(0,Q.useState)(!0),[a,o]=(0,Q.useState)(null),[u,d]=(0,Q.useState)({search:``,status:``}),[p,m]=(0,Q.useState)(null),{activeProject:h,activeStack:g}=nt(),_=(0,Q.useCallback)(async()=>{if(h)try{n(await f.getProjectApps({project:h})),o(null)}catch(e){o(e?.message??`Failed to fetch applications`)}finally{i(!1)}},[h]),v=Be(t,g),y=v.filter(e=>`${e.name} ${e.stack}`.toLowerCase().includes(String(u.search??``).toLowerCase())&&(!u.status||e.status===u.status)),b=Fe(e=>e.connected),x=Fe(e=>e.lastEvent),S=Fe(e=>e.initialize);(0,Q.useEffect)(()=>S(),[S]),Ne(()=>void _(),{intervalMs:b?15e3:5e3}),(0,Q.useEffect)(()=>{x&&_()},[x,_]);let C=async e=>{m(e);try{await l.restartApp({name:e}),await _()}catch(t){o(`Failed to restart ${e}: ${t?.message??`Unknown error`}`)}finally{m(null)}},w=async e=>{m(e);try{let t=await l.stopApp({name:e});if(!t.success){o(`Failed to stop ${e}: ${t.error??`the daemon reported failure`}`);return}await _()}catch(t){o(`Failed to stop ${e}: ${t?.message??`Unknown error`}`)}finally{m(null)}},ee=async e=>{m(e);try{await l.startApp({name:e}),await _()}catch(t){o(`Failed to start ${e}: ${t?.message??`Unknown error`}`)}finally{m(null)}},te=[{id:`name`,label:`Name`,render:e=>ze(e)?(0,$.jsx)(de,{component:s,to:Re(e),variant:`body2`,underline:`hover`,sx:{fontWeight:600,color:`text.primary`},onClick:e=>e.stopPropagation(),children:e.name}):(0,$.jsx)(k,{variant:`body2`,sx:{fontWeight:600},children:e.name})},...g?[]:[{id:`stack`,label:`Stack`,render:e=>(0,$.jsx)(de,{component:s,to:`/stacks/${encodeURIComponent(e.stack)}`,variant:`body2`,underline:`hover`,onClick:e=>e.stopPropagation(),children:ze(e)?e.stack:`${e.stack} · ${e.stackType}`})}],{id:`status`,label:`Process`,render:e=>(0,$.jsx)(T,{label:e.status,size:`small`,color:Ke[e.status]||`default`,variant:`outlined`})},{id:`health`,label:`Health`,render:e=>(0,$.jsx)(at,{status:e.health})},{id:`instances`,label:`Instances`,align:`right`},{id:`pid`,label:`PID`,align:`right`,render:e=>(0,$.jsx)(k,{variant:`body2`,sx:{fontFamily:`monospace`},children:e.pid??`--`})},{id:`uptime`,label:`Uptime`,render:e=>tt(e.uptime)},{id:`cpu`,label:`CPU %`,align:`right`,render:e=>e.cpu>0?e.cpu.toFixed(1):`--`},{id:`memory`,label:`Memory MB`,align:`right`,render:e=>et(e.memory)},{id:`actions`,label:`Actions`,align:`center`,render:e=>ze(e)?(0,$.jsx)(j,{direction:`row`,spacing:.5,sx:{justifyContent:`center`},onClick:e=>e.stopPropagation(),children:e.status===`stopped`||e.status===`crashed`||e.status===`errored`?(0,$.jsx)(je,{permission:`OmnitronDaemon.startApp`,children:(0,$.jsx)(D,{title:`Start`,children:(0,$.jsx)(A,{size:`small`,color:`success`,disabled:p===e.handleKey,onClick:()=>ee(e.handleKey),children:(0,$.jsx)(We,{sx:{fontSize:18}})})})}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(je,{permission:`OmnitronDaemon.restartApp`,children:(0,$.jsx)(D,{title:`Restart`,children:(0,$.jsx)(A,{size:`small`,color:`warning`,disabled:p===e.handleKey,onClick:()=>C(e.handleKey),children:(0,$.jsx)(Ue,{sx:{fontSize:18}})})})}),(0,$.jsx)(je,{permission:`OmnitronDaemon.stopApp`,children:(0,$.jsx)(D,{title:`Stop`,children:(0,$.jsx)(A,{size:`small`,color:`error`,disabled:p===e.handleKey,onClick:()=>w(e.handleKey),children:(0,$.jsx)(Ge,{sx:{fontSize:18}})})})})]})}):(0,$.jsx)(D,{title:`Runs on a node — started and stopped with its stack`,children:(0,$.jsx)(k,{variant:`caption`,sx:{color:`text.disabled`},children:`on node`})})}];return(0,$.jsxs)(j,{spacing:3,children:[(0,$.jsx)($e,{linkComponent:s,links:[{name:`Applications`}],action:(0,$.jsx)(A,{"data-console-command":`refresh`,onClick:_,title:`Refresh`,children:(0,$.jsx)(He,{})})}),a&&(0,$.jsx)(Ae,{closable:!0,severity:`error`,variant:`outlined`,sx:{mb:2},onClose:()=>o(null),children:a}),(0,$.jsx)(qt,{filters:[{key:`search`,type:`search`,label:`Search applications`,placeholder:`Application or stack…`},{key:`status`,type:`select`,label:`All statuses`,options:[...new Set(v.map(e=>e.status))].map(e=>({value:e,label:e}))}],values:u,onChange:d,total:y.length}),(0,$.jsx)(Ye,{scrollLabel:`Applications`,sx:{minWidth:800},columns:te,data:y,rowKey:e=>`${e.stack}/${e.name}`,loading:r,loadingRows:3,onRowClick:t=>e(ze(t)?Re(t):`/stacks/${encodeURIComponent(t.stack)}`),emptyContent:(0,$.jsxs)(j,{spacing:1,sx:{alignItems:`center`},children:[(0,$.jsx)(k,{variant:`body2`,sx:{color:`text.secondary`},children:v.length?`No applications match these filters.`:`No applications deployed yet.`}),(0,$.jsx)(k,{variant:`caption`,sx:{color:`text.disabled`},children:v.length?`Change or reset the filters to see more applications.`:(0,$.jsxs)($.Fragment,{children:[`Use `,(0,$.jsx)(`code`,{children:`omnitron deploy`}),` to get started.`]})})]})})]})}var Q,$;function Zt(){return(Zt=t((()=>{it(),Me(),Q=r(),p(),se(),ye(),ke(),Qe(),Jt(),Je(),x(),me(),ce(),ve(),Ve(),u(),qe(),rt(),Ie(),Pe(),Le(),$=a()})))()}export{Ct as a,Pt as i,Zt as n,wt as o,Nt as r,Yt as t};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{h as r,r as i}from"./client-DFnuv2z3.js";import{Vt as a,Yt as o}from"./mui-BTN91yBK.js";import{F as s,H as c,I as l,Q as u,St as d,V as f,Z as p,xt as m}from"./mui-BXSXx9c9.js";import{A as h,B as g,C as _,D as ee,F as v,I as y,O as b,a as x,b as S,d as C,f as w,k as te,o as T,w as E,y as ne,z as D}from"./mui-Cd711nOk.js";import{it as O,l as k,rt as A,u as j}from"./mui-AnEgAVjz.js";import{_ as M,v as N}from"./mui-BwsIrivo.js";import{d as P,j as F,l as I,o as L}from"./controls-C5W8gHU4.js";import{r as R,t as z}from"./alert-uBG6r9NW.js";import{n as B,t as re}from"./use-copy-to-clipboard-BWYpToS3.js";import{c as ie,s as V}from"./access-BvKK9dEv.js";import{n as ae,t as H}from"./store-bqUBn2A4.js";import{n as oe,t as U}from"./use-polled-resource-B22hhr5L.js";import{D as se,G as ce,M as le,k as ue}from"./icons-OboZgWSt.js";import{n as de,t as fe}from"./table-viewport-Bp4pq-c_.js";import{n as pe,t as me}from"./page-breadcrumbs-fR7Jmpp4.js";import{n as he,t as ge}from"./skeleton-BmWDJWF9.js";import{n as _e,t as W}from"./event-fields-CiyqrRO8.js";import{n as ve,t as ye}from"./empty-content-7jOFhG4C.js";function be(e,t=500){let[n,r]=(0,G.useState)(e);return(0,G.useEffect)(()=>{let n=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(n)}},[e,t]),n}var G;function xe(){return(xe=e((()=>{G=t()})))()}function Se(e){let t=e.details?.outcome;return t===`ok`||t===`partial`||t===`failed`?t:e.action.endsWith(`.failed`)?`failed`:null}function Ce(e){let t=(t,n=e=>e)=>{let r=e.details?.[t];return typeof r==`string`&&r!==``?{key:t,text:n(r)}:null};switch(Se(e)){case`partial`:return t(`notUp`,e=>`not up: ${e}`);case`failed`:return t(`error`)??t(`message`);default:return null}}function we(e,t){if(e===`omnitron-local`&&t===`user`)return{text:`Local client`,title:`omnitron-local: CLI or a local tool through the daemon's owner-only Unix socket; this record does not identify a person or a specific tool`,kind:`local`};if(e){let n=Ee.test(e)?`${e.slice(0,8)}…`:e;return{text:`${t===`user`?`User`:t===`service`?`Service`:t}: ${n}`,title:`${t}: ${e}`,kind:t===`user`||t===`service`||t===`system`?t:`unknown`}}return t===`service`?{text:`Service`,title:`Service identity recorded by the control plane; no account identifier was recorded`,kind:`service`}:t===`system`?{text:`System`,title:`Daemon system identity; no calling account was recorded. Historical records do not identify a specific initiator.`,kind:`system`}:{text:t||`Unknown`,title:t||`No actor kind recorded`,kind:`unknown`}}var Te,Ee;function K(){return(K=e((()=>{Te=`omnitron-local`,Ee=/^[0-9a-f]{8}-[0-9a-f]{4}-/i})))()}function De(e){let t=new Date(e);if(!Number.isFinite(t.getTime()))return{date:`Invalid time`,time:``,exact:e};let n=(e,t=2)=>String(e).padStart(t,`0`);return{date:`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`,time:`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}.${n(t.getMilliseconds(),3)}`,exact:t.toISOString()}}function Oe({row:e}){let t=ae(e=>e.user),n=we(e.actorId,e.actorType),r=n.kind===`user`&&e.actorId===t?.id?`${t.username} (you)`:n.text;return(0,J.jsx)(v,{title:n.title,arrow:!0,children:(0,J.jsx)(p,{size:`small`,variant:`outlined`,label:r,"data-actor-kind":n.kind,sx:{height:24,maxWidth:`100%`,fontSize:11,"& .MuiChip-label":{overflow:`hidden`,textOverflow:`ellipsis`}}})})}function ke({row:e}){let[t,n]=(0,q.useState)(!1),[r,i]=(0,q.useState)(!1),o=(0,q.useRef)(null),c=(0,q.useId)(),l=B(),u=De(e.createdAt),d=Se(e),h=Ce(e),g=we(e.actorId,e.actorType),ee=()=>{n(!1),o.current?.focus()};return(0,J.jsxs)(q.Fragment,{children:[(0,J.jsxs)(C,{hover:!0,sx:{verticalAlign:`top`,bgcolor:e=>t?a(e.palette.primary.main,.045):void 0},children:[(0,J.jsx)(_,{sx:{px:.5,width:40},children:(0,J.jsx)(A,{ref:o,size:`small`,"aria-label":`Details for ${e.action} at ${u.exact}`,"aria-expanded":t,"aria-controls":t?c:void 0,onClick:()=>n(e=>!e),children:(0,J.jsx)(I,{sx:{fontSize:18,transform:t?`rotate(90deg)`:void 0}})})}),(0,J.jsx)(_,{sx:{display:{xs:`none`,sm:`table-cell`},whiteSpace:`nowrap`,fontFamily:Y,fontSize:11},children:(0,J.jsx)(v,{title:u.exact,children:(0,J.jsxs)(f,{component:`time`,dateTime:e.createdAt,children:[(0,J.jsx)(f,{children:u.date}),(0,J.jsx)(f,{sx:{color:`text.secondary`},children:u.time})]})})}),(0,J.jsxs)(_,{sx:{minWidth:0,overflowWrap:`anywhere`},children:[(0,J.jsxs)(M,{direction:`row`,sx:{gap:.75,alignItems:`center`,flexWrap:`wrap`},children:[(0,J.jsx)(D,{variant:`body2`,sx:{fontFamily:Y,fontWeight:600,overflowWrap:`anywhere`},children:e.action}),d&&(0,J.jsx)(p,{size:`small`,variant:`outlined`,color:X[d],label:d,sx:{height:20,fontSize:10}}),!d&&e.action.endsWith(`.requested`)&&(0,J.jsx)(p,{size:`small`,variant:`outlined`,label:`Requested`,sx:{height:20,fontSize:10}})]}),(0,J.jsxs)(D,{variant:`caption`,color:`text.secondary`,sx:{display:`block`,fontFamily:Y,overflowWrap:`anywhere`},children:[e.resourceType,e.resourceId?` · ${e.resourceId}`:``]}),h&&(0,J.jsx)(D,{variant:`caption`,sx:{display:`block`,color:d?`${X[d]}.main`:`text.secondary`,overflowWrap:`anywhere`},children:h.text}),(0,J.jsxs)(M,{direction:`row`,sx:{display:{xs:`flex`,md:`none`},gap:.75,flexWrap:`wrap`,alignItems:`center`,mt:.5},children:[(0,J.jsxs)(D,{component:`time`,dateTime:e.createdAt,variant:`caption`,title:u.exact,sx:{display:{xs:`inline`,sm:`none`},fontFamily:Y,color:`text.secondary`},children:[u.date,` `,u.time]}),(0,J.jsx)(Oe,{row:e})]})]}),(0,J.jsx)(_,{sx:{display:{xs:`none`,md:`table-cell`},minWidth:0},children:(0,J.jsx)(Oe,{row:e})})]}),t&&(0,J.jsx)(C,{children:(0,J.jsx)(_,{colSpan:4,sx:{p:0},children:(0,J.jsx)(m,{in:!0,timeout:0,children:(0,J.jsxs)(f,{id:c,role:`region`,"aria-label":`Audit details: ${e.action}`,onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),ee())},sx:{px:{xs:1.5,sm:5},py:1.5,bgcolor:e=>a(e.palette.primary.main,.045),minWidth:0},children:[(0,J.jsx)(W,{values:[[`Recorded at (UTC)`,u.exact],[`Event ID`,e.id],[`Action`,e.action],[`Resource type`,e.resourceType],[`Resource ID`,e.resourceId??`Not recorded`],[`Actor type`,e.actorType],[`Actor ID`,e.actorId??`Not recorded`],[`Actor context`,g.title],[`Source IP`,e.ipAddress??`Not recorded`],[`Outcome`,d??(e.action.endsWith(`.requested`)?`Requested; completion is not recorded by this event`:`Not recorded`)]]}),Object.keys(e.details??{}).length>0&&(0,J.jsx)(f,{sx:{mt:1.25,pt:1.25,borderTop:`1px solid`,borderColor:`divider`},children:(0,J.jsx)(W,{values:Object.entries(e.details??{}).filter(([e,t])=>e!==`outcome`||t!==d)})}),(0,J.jsxs)(M,{direction:`row`,sx:{gap:1,mt:1,flexWrap:`wrap`},children:[(0,J.jsx)(s,{size:`small`,color:`inherit`,onClick:()=>i(e=>!e),"aria-expanded":r,"aria-controls":r?`${c}-raw`:void 0,startIcon:(0,J.jsx)(I,{sx:{transform:r?`rotate(90deg)`:void 0}}),children:`Raw event`}),(0,J.jsx)(s,{size:`small`,onClick:()=>void l.copy(JSON.stringify(e,null,2)),startIcon:l.state===`success`?(0,J.jsx)(L,{}):(0,J.jsx)(P,{}),children:l.state===`success`?`Copied`:l.state===`error`?`Retry copy JSON`:`Copy JSON`})]}),l.state===`error`&&(0,J.jsx)(D,{role:`status`,variant:`caption`,color:`error`,children:`Clipboard unavailable. Open Raw event to select the text.`}),r&&(0,J.jsx)(f,{component:`pre`,id:`${c}-raw`,tabIndex:0,"aria-label":`Raw audit event`,sx:{m:0,mt:1,pt:1,borderTop:`1px solid`,borderColor:`divider`,minWidth:0,fontFamily:Y,fontSize:11,whiteSpace:`pre-wrap`,overflowWrap:`anywhere`,"&:focus-visible":{outline:`2px solid`,outlineColor:`primary.main`}},children:JSON.stringify(e,null,2)})]})})})})]})}var q,J,Y,X;function Ae(){return(Ae=e((()=>{q=t(),c(),l(),u(),d(),O(),N(),E(),w(),y(),g(),o(),re(),F(),_e(),H(),K(),J=n(),Y=`'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'SF Mono', monospace`,X={ok:`success`,partial:`warning`,failed:`error`}})))()}function je(){let[e,t]=(0,Z.useState)(100),[n,r]=(0,Z.useState)(``),[a,o]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(``),u=be(c.trim(),300),[d,m]=(0,Z.useState)(!1),h=ae(e=>e.user),{can:g}=ie(),y=g(`OmnitronAudit.list`)&&g(`OmnitronAudit.available`),b=(0,Z.useMemo)(()=>({limit:e,...n&&{resourceType:n},...u&&{action:u},...a===`local`?{actorType:`user`,actorId:Te}:a?{actorType:a}:{}}),[e,n,a,u]),S=JSON.stringify([h?.id,y,b]),w=(0,Z.useRef)(S);w.current=S;let T=(0,Z.useRef)(null),[E,O]=(0,Z.useState)(null);(0,Z.useEffect)(()=>(O(null),()=>{T.current=null}),[S]);let j=E?.scope===S?E:null,N=(0,Z.useCallback)(async()=>(await i.available()).available?{available:!0,rows:await i.list(b)}:{available:!1,rows:[]},[b]),{data:P,error:F,loading:I,refresh:L}=oe(N,{intervalMs:15e3,paused:d,enabled:y,resourceKey:S,describeError:e=>`Could not read the audit trail: ${e instanceof Error?e.message:String(e)}`}),R=j?.rows??P?.rows??[],B=()=>{T.current=null,O(null),L()},re=()=>{d&&(T.current=null,O(null),L()),m(e=>!e)},V=async()=>{if(!y||T.current||j?.pending||!R.length)return;let t=Symbol(`audit-history`);T.current=t;let n=R;m(!0),O({scope:S,rows:n,pending:!0,exhausted:!1,error:null});try{let r=await i.list({...b,beforeId:n[n.length-1].id});if(T.current!==t||w.current!==S)return;let a=new Set(n.map(e=>e.id)),o=r.filter(e=>!a.has(e.id));if(r.length&&!o.length)throw Error(`History cursor did not advance. Refresh the latest events.`);O({scope:S,rows:[...n,...o],pending:!1,exhausted:r.length<e,error:null})}catch(e){if(T.current!==t||w.current!==S)return;O({scope:S,rows:n,pending:!1,exhausted:!1,error:`Could not read older events: ${e instanceof Error?e.message:String(e)}`})}finally{T.current===t&&(T.current=null)}},H=[...new Set([...Me,n,...R.map(e=>e.resourceType)])].filter(Boolean).sort(),U=!!(n||a||c);return(0,Q.jsxs)(f,{sx:{minWidth:0},children:[(0,Q.jsx)(me,{heading:`Audit`,links:[{name:`Console`,href:`/`},{name:`Audit`}],sx:{mb:2}}),(0,Q.jsxs)(M,{direction:`row`,sx:{gap:1,alignItems:`center`,flexWrap:`wrap`,mb:1.5},children:[(0,Q.jsx)(D,{variant:`body2`,color:`text.secondary`,sx:{flex:`1 1 180px`},children:`Control-plane audit · all projects`}),y&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(D,{variant:`caption`,role:`status`,color:`text.secondary`,children:j?.pending?`Reading history…`:I&&!j?`Reading…`:P?.available?`${R.length} matching events${j?` · history`:` · latest`}`:`No reading`}),(0,Q.jsx)(v,{title:d?`Resume audit updates`:`Pause audit updates`,children:(0,Q.jsx)(A,{size:`small`,"aria-label":d?`Resume audit updates`:`Pause audit updates`,onClick:re,children:d?(0,Q.jsx)(ue,{}):(0,Q.jsx)(se,{})})}),(0,Q.jsx)(p,{size:`small`,variant:`outlined`,label:d?`Paused`:`Live`,sx:{height:22}}),(0,Q.jsx)(v,{title:`Refresh audit`,children:(0,Q.jsx)(`span`,{children:(0,Q.jsx)(A,{size:`small`,"aria-label":`Refresh audit`,disabled:I,loading:I,onClick:B,children:(0,Q.jsx)(le,{})})})})]})]}),y?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(f,{component:`section`,"aria-label":`Audit filters`,sx:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(min(100%, 128px), 1fr))`,gap:1.5,mb:2},children:[(0,Q.jsxs)(x,{fullWidth:!0,select:!0,size:`small`,label:`Resource`,value:n,onChange:e=>r(e.target.value),slotProps:{inputLabel:{shrink:!0},select:{displayEmpty:!0}},sx:{minWidth:0},children:[(0,Q.jsx)(k,{value:``,children:`All resources`}),H.map(e=>(0,Q.jsx)(k,{value:e,children:e},e))]}),(0,Q.jsxs)(x,{fullWidth:!0,select:!0,size:`small`,label:`Actor`,value:a,onChange:e=>o(e.target.value),slotProps:{inputLabel:{shrink:!0},select:{displayEmpty:!0}},sx:{minWidth:0},children:[(0,Q.jsx)(k,{value:``,children:`All actors`}),(0,Q.jsx)(k,{value:`local`,children:`Local client`}),(0,Q.jsx)(k,{value:`user`,children:`User identities`}),(0,Q.jsx)(k,{value:`service`,children:`Service`}),(0,Q.jsx)(k,{value:`system`,children:`System`})]}),(0,Q.jsx)(x,{fullWidth:!0,size:`small`,label:`Action (exact)`,placeholder:`stack.start`,value:c,onChange:e=>l(e.target.value),sx:{minWidth:0}}),(0,Q.jsx)(x,{fullWidth:!0,select:!0,size:`small`,label:`Latest entries`,value:e,onChange:e=>t(Number(e.target.value)),sx:{minWidth:0},children:Ne.map(e=>(0,Q.jsx)(k,{value:e,children:e},e))})]}),U&&(0,Q.jsx)(s,{size:`small`,sx:{mb:1},onClick:()=>{r(``),o(``),l(``)},children:`Reset filters`}),F&&(0,Q.jsxs)(z,{severity:`error`,sx:{mb:2},action:(0,Q.jsx)(s,{color:`inherit`,size:`small`,onClick:()=>void L(),children:`Retry`}),children:[F,P&&` The last reading is retained.`]}),I&&!P&&(0,Q.jsx)(ge,{variant:`rectangular`,height:280}),P&&!P.available&&(0,Q.jsx)(z,{severity:`info`,children:`This daemon has no audit storage. No event history is available.`}),P?.available&&R.length===0&&(0,Q.jsx)(ye,{title:U?`No matching events`:`Nothing recorded yet`,description:U?`Change the filters to read another part of the trail.`:`Recorded control-plane actions will appear here.`}),P?.available&&R.length>0&&(0,Q.jsx)(f,{sx:{border:`1px solid`,borderColor:`divider`,borderRadius:1,overflow:`hidden`},children:(0,Q.jsx)(fe,{label:`Audit events`,children:(0,Q.jsxs)(te,{size:`small`,"aria-label":`Audit events`,sx:{tableLayout:`fixed`},children:[(0,Q.jsx)(ne,{children:(0,Q.jsxs)(C,{children:[(0,Q.jsx)(_,{sx:{width:40,px:.5},children:(0,Q.jsx)(f,{component:`span`,sx:{position:`absolute`,width:1,height:1,overflow:`hidden`,clipPath:`inset(50%)`},children:`Details`})}),(0,Q.jsx)(_,{sx:{width:132,display:{xs:`none`,sm:`table-cell`}},children:(0,Q.jsx)(v,{title:`Local time; exact UTC is available in the event details`,children:(0,Q.jsx)(`span`,{children:`Recorded`})})}),(0,Q.jsx)(_,{children:`Event / resource`}),(0,Q.jsx)(_,{sx:{width:192,display:{xs:`none`,md:`table-cell`}},children:`Actor`})]})}),(0,Q.jsx)(ee,{children:R.map(e=>(0,Q.jsx)(ke,{row:e},e.id))})]})})}),j?.error&&(0,Q.jsx)(z,{severity:`error`,sx:{mt:1},children:j.error}),P?.available&&R.length>0&&(0,Q.jsxs)(M,{direction:`row`,sx:{mt:1,gap:1,alignItems:`center`,flexWrap:`wrap`},children:[(0,Q.jsx)(D,{variant:`caption`,color:`text.secondary`,sx:{flex:`1 1 180px`},children:j?`Updates paused while reading history. Resume to return to the latest events.`:`Newest first. This count is the current reading, not the entire trail.`}),(j?!j.exhausted:R.length===e)&&(0,Q.jsx)(s,{size:`small`,disabled:j?.pending,loading:j?.pending,onClick:()=>void V(),children:j?.error?`Retry older events`:`Load older`}),j?.exhausted&&(0,Q.jsx)(D,{variant:`caption`,color:`text.secondary`,children:`Start of matching history`})]})]}):(0,Q.jsx)(z,{severity:`info`,children:`Your role cannot read the control-plane audit trail.`})]})}var Z,Q,Me,Ne;function $(){return($=e((()=>{Z=t(),c(),l(),u(),O(),j(),N(),h(),b(),E(),S(),w(),T(),y(),g(),de(),R(),ve(),he(),xe(),pe(),Ae(),ce(),r(),U(),H(),V(),K(),Q=n(),Me=[`stack`,`release`,`project`,`node`,`kernel-rollout`,`pipeline`,`secret`,`terminal`,`account`,`app`,`file`],Ne=[50,100,250,500]})))()}$();export{je as default};
1
+ import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{h as r,r as i}from"./client-CgyTwq9g.js";import{Vt as a,Yt as o}from"./mui-BTN91yBK.js";import{F as s,H as c,I as l,Q as u,St as d,V as f,Z as p,xt as m}from"./mui-SNRRJ_vi.js";import{A as h,B as g,C as _,D as ee,F as v,I as y,O as b,a as x,b as S,d as C,f as w,k as te,o as T,w as E,y as ne,z as D}from"./mui-B3fJdIMc.js";import{it as O,l as k,rt as A,u as j}from"./mui-CMWGTMXv.js";import{_ as M,v as N}from"./mui-CPEkFAPo.js";import{d as P,j as F,l as I,o as L}from"./controls-CqeGPnaF.js";import{r as R,t as z}from"./alert-BdJ2uaY0.js";import{n as B,t as re}from"./use-copy-to-clipboard-BWYpToS3.js";import{c as ie,s as V}from"./access-I0f72P9m.js";import{n as ae,t as H}from"./store-DtTtbc9H.js";import{n as oe,t as U}from"./use-polled-resource-B22hhr5L.js";import{D as se,G as ce,M as le,k as ue}from"./icons-B9Ct8PJ9.js";import{n as de,t as fe}from"./table-viewport-DdZ1yAKm.js";import{n as pe,t as me}from"./page-breadcrumbs-3R8RZ3nA.js";import{n as he,t as ge}from"./skeleton-BnVxAoeX.js";import{n as _e,t as W}from"./event-fields-C7p2a2HY.js";import{n as ve,t as ye}from"./empty-content-eyDOuOVp.js";function be(e,t=500){let[n,r]=(0,G.useState)(e);return(0,G.useEffect)(()=>{let n=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(n)}},[e,t]),n}var G;function xe(){return(xe=e((()=>{G=t()})))()}function Se(e){let t=e.details?.outcome;return t===`ok`||t===`partial`||t===`failed`?t:e.action.endsWith(`.failed`)?`failed`:null}function Ce(e){let t=(t,n=e=>e)=>{let r=e.details?.[t];return typeof r==`string`&&r!==``?{key:t,text:n(r)}:null};switch(Se(e)){case`partial`:return t(`notUp`,e=>`not up: ${e}`);case`failed`:return t(`error`)??t(`message`);default:return null}}function we(e,t){if(e===`omnitron-local`&&t===`user`)return{text:`Local client`,title:`omnitron-local: CLI or a local tool through the daemon's owner-only Unix socket; this record does not identify a person or a specific tool`,kind:`local`};if(e){let n=Ee.test(e)?`${e.slice(0,8)}…`:e;return{text:`${t===`user`?`User`:t===`service`?`Service`:t}: ${n}`,title:`${t}: ${e}`,kind:t===`user`||t===`service`||t===`system`?t:`unknown`}}return t===`service`?{text:`Service`,title:`Service identity recorded by the control plane; no account identifier was recorded`,kind:`service`}:t===`system`?{text:`System`,title:`Daemon system identity; no calling account was recorded. Historical records do not identify a specific initiator.`,kind:`system`}:{text:t||`Unknown`,title:t||`No actor kind recorded`,kind:`unknown`}}var Te,Ee;function K(){return(K=e((()=>{Te=`omnitron-local`,Ee=/^[0-9a-f]{8}-[0-9a-f]{4}-/i})))()}function De(e){let t=new Date(e);if(!Number.isFinite(t.getTime()))return{date:`Invalid time`,time:``,exact:e};let n=(e,t=2)=>String(e).padStart(t,`0`);return{date:`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`,time:`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}.${n(t.getMilliseconds(),3)}`,exact:t.toISOString()}}function Oe({row:e}){let t=ae(e=>e.user),n=we(e.actorId,e.actorType),r=n.kind===`user`&&e.actorId===t?.id?`${t.username} (you)`:n.text;return(0,J.jsx)(v,{title:n.title,arrow:!0,children:(0,J.jsx)(p,{size:`small`,variant:`outlined`,label:r,"data-actor-kind":n.kind,sx:{height:24,maxWidth:`100%`,fontSize:11,"& .MuiChip-label":{overflow:`hidden`,textOverflow:`ellipsis`}}})})}function ke({row:e}){let[t,n]=(0,q.useState)(!1),[r,i]=(0,q.useState)(!1),o=(0,q.useRef)(null),c=(0,q.useId)(),l=B(),u=De(e.createdAt),d=Se(e),h=Ce(e),g=we(e.actorId,e.actorType),ee=()=>{n(!1),o.current?.focus()};return(0,J.jsxs)(q.Fragment,{children:[(0,J.jsxs)(C,{hover:!0,sx:{verticalAlign:`top`,bgcolor:e=>t?a(e.palette.primary.main,.045):void 0},children:[(0,J.jsx)(_,{sx:{px:.5,width:40},children:(0,J.jsx)(A,{ref:o,size:`small`,"aria-label":`Details for ${e.action} at ${u.exact}`,"aria-expanded":t,"aria-controls":t?c:void 0,onClick:()=>n(e=>!e),children:(0,J.jsx)(I,{sx:{fontSize:18,transform:t?`rotate(90deg)`:void 0}})})}),(0,J.jsx)(_,{sx:{display:{xs:`none`,sm:`table-cell`},whiteSpace:`nowrap`,fontFamily:Y,fontSize:11},children:(0,J.jsx)(v,{title:u.exact,children:(0,J.jsxs)(f,{component:`time`,dateTime:e.createdAt,children:[(0,J.jsx)(f,{children:u.date}),(0,J.jsx)(f,{sx:{color:`text.secondary`},children:u.time})]})})}),(0,J.jsxs)(_,{sx:{minWidth:0,overflowWrap:`anywhere`},children:[(0,J.jsxs)(M,{direction:`row`,sx:{gap:.75,alignItems:`center`,flexWrap:`wrap`},children:[(0,J.jsx)(D,{variant:`body2`,sx:{fontFamily:Y,fontWeight:600,overflowWrap:`anywhere`},children:e.action}),d&&(0,J.jsx)(p,{size:`small`,variant:`outlined`,color:X[d],label:d,sx:{height:20,fontSize:10}}),!d&&e.action.endsWith(`.requested`)&&(0,J.jsx)(p,{size:`small`,variant:`outlined`,label:`Requested`,sx:{height:20,fontSize:10}})]}),(0,J.jsxs)(D,{variant:`caption`,color:`text.secondary`,sx:{display:`block`,fontFamily:Y,overflowWrap:`anywhere`},children:[e.resourceType,e.resourceId?` · ${e.resourceId}`:``]}),h&&(0,J.jsx)(D,{variant:`caption`,sx:{display:`block`,color:d?`${X[d]}.main`:`text.secondary`,overflowWrap:`anywhere`},children:h.text}),(0,J.jsxs)(M,{direction:`row`,sx:{display:{xs:`flex`,md:`none`},gap:.75,flexWrap:`wrap`,alignItems:`center`,mt:.5},children:[(0,J.jsxs)(D,{component:`time`,dateTime:e.createdAt,variant:`caption`,title:u.exact,sx:{display:{xs:`inline`,sm:`none`},fontFamily:Y,color:`text.secondary`},children:[u.date,` `,u.time]}),(0,J.jsx)(Oe,{row:e})]})]}),(0,J.jsx)(_,{sx:{display:{xs:`none`,md:`table-cell`},minWidth:0},children:(0,J.jsx)(Oe,{row:e})})]}),t&&(0,J.jsx)(C,{children:(0,J.jsx)(_,{colSpan:4,sx:{p:0},children:(0,J.jsx)(m,{in:!0,timeout:0,children:(0,J.jsxs)(f,{id:c,role:`region`,"aria-label":`Audit details: ${e.action}`,onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),ee())},sx:{px:{xs:1.5,sm:5},py:1.5,bgcolor:e=>a(e.palette.primary.main,.045),minWidth:0},children:[(0,J.jsx)(W,{values:[[`Recorded at (UTC)`,u.exact],[`Event ID`,e.id],[`Action`,e.action],[`Resource type`,e.resourceType],[`Resource ID`,e.resourceId??`Not recorded`],[`Actor type`,e.actorType],[`Actor ID`,e.actorId??`Not recorded`],[`Actor context`,g.title],[`Source IP`,e.ipAddress??`Not recorded`],[`Outcome`,d??(e.action.endsWith(`.requested`)?`Requested; completion is not recorded by this event`:`Not recorded`)]]}),Object.keys(e.details??{}).length>0&&(0,J.jsx)(f,{sx:{mt:1.25,pt:1.25,borderTop:`1px solid`,borderColor:`divider`},children:(0,J.jsx)(W,{values:Object.entries(e.details??{}).filter(([e,t])=>e!==`outcome`||t!==d)})}),(0,J.jsxs)(M,{direction:`row`,sx:{gap:1,mt:1,flexWrap:`wrap`},children:[(0,J.jsx)(s,{size:`small`,color:`inherit`,onClick:()=>i(e=>!e),"aria-expanded":r,"aria-controls":r?`${c}-raw`:void 0,startIcon:(0,J.jsx)(I,{sx:{transform:r?`rotate(90deg)`:void 0}}),children:`Raw event`}),(0,J.jsx)(s,{size:`small`,onClick:()=>void l.copy(JSON.stringify(e,null,2)),startIcon:l.state===`success`?(0,J.jsx)(L,{}):(0,J.jsx)(P,{}),children:l.state===`success`?`Copied`:l.state===`error`?`Retry copy JSON`:`Copy JSON`})]}),l.state===`error`&&(0,J.jsx)(D,{role:`status`,variant:`caption`,color:`error`,children:`Clipboard unavailable. Open Raw event to select the text.`}),r&&(0,J.jsx)(f,{component:`pre`,id:`${c}-raw`,tabIndex:0,"aria-label":`Raw audit event`,sx:{m:0,mt:1,pt:1,borderTop:`1px solid`,borderColor:`divider`,minWidth:0,fontFamily:Y,fontSize:11,whiteSpace:`pre-wrap`,overflowWrap:`anywhere`,"&:focus-visible":{outline:`2px solid`,outlineColor:`primary.main`}},children:JSON.stringify(e,null,2)})]})})})})]})}var q,J,Y,X;function Ae(){return(Ae=e((()=>{q=t(),c(),l(),u(),d(),O(),N(),E(),w(),y(),g(),o(),re(),F(),_e(),H(),K(),J=n(),Y=`'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'SF Mono', monospace`,X={ok:`success`,partial:`warning`,failed:`error`}})))()}function je(){let[e,t]=(0,Z.useState)(100),[n,r]=(0,Z.useState)(``),[a,o]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(``),u=be(c.trim(),300),[d,m]=(0,Z.useState)(!1),h=ae(e=>e.user),{can:g}=ie(),y=g(`OmnitronAudit.list`)&&g(`OmnitronAudit.available`),b=(0,Z.useMemo)(()=>({limit:e,...n&&{resourceType:n},...u&&{action:u},...a===`local`?{actorType:`user`,actorId:Te}:a?{actorType:a}:{}}),[e,n,a,u]),S=JSON.stringify([h?.id,y,b]),w=(0,Z.useRef)(S);w.current=S;let T=(0,Z.useRef)(null),[E,O]=(0,Z.useState)(null);(0,Z.useEffect)(()=>(O(null),()=>{T.current=null}),[S]);let j=E?.scope===S?E:null,N=(0,Z.useCallback)(async()=>(await i.available()).available?{available:!0,rows:await i.list(b)}:{available:!1,rows:[]},[b]),{data:P,error:F,loading:I,refresh:L}=oe(N,{intervalMs:15e3,paused:d,enabled:y,resourceKey:S,describeError:e=>`Could not read the audit trail: ${e instanceof Error?e.message:String(e)}`}),R=j?.rows??P?.rows??[],B=()=>{T.current=null,O(null),L()},re=()=>{d&&(T.current=null,O(null),L()),m(e=>!e)},V=async()=>{if(!y||T.current||j?.pending||!R.length)return;let t=Symbol(`audit-history`);T.current=t;let n=R;m(!0),O({scope:S,rows:n,pending:!0,exhausted:!1,error:null});try{let r=await i.list({...b,beforeId:n[n.length-1].id});if(T.current!==t||w.current!==S)return;let a=new Set(n.map(e=>e.id)),o=r.filter(e=>!a.has(e.id));if(r.length&&!o.length)throw Error(`History cursor did not advance. Refresh the latest events.`);O({scope:S,rows:[...n,...o],pending:!1,exhausted:r.length<e,error:null})}catch(e){if(T.current!==t||w.current!==S)return;O({scope:S,rows:n,pending:!1,exhausted:!1,error:`Could not read older events: ${e instanceof Error?e.message:String(e)}`})}finally{T.current===t&&(T.current=null)}},H=[...new Set([...Me,n,...R.map(e=>e.resourceType)])].filter(Boolean).sort(),U=!!(n||a||c);return(0,Q.jsxs)(f,{sx:{minWidth:0},children:[(0,Q.jsx)(me,{heading:`Audit`,links:[{name:`Console`,href:`/`},{name:`Audit`}],sx:{mb:2}}),(0,Q.jsxs)(M,{direction:`row`,sx:{gap:1,alignItems:`center`,flexWrap:`wrap`,mb:1.5},children:[(0,Q.jsx)(D,{variant:`body2`,color:`text.secondary`,sx:{flex:`1 1 180px`},children:`Control-plane audit · all projects`}),y&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(D,{variant:`caption`,role:`status`,color:`text.secondary`,children:j?.pending?`Reading history…`:I&&!j?`Reading…`:P?.available?`${R.length} matching events${j?` · history`:` · latest`}`:`No reading`}),(0,Q.jsx)(v,{title:d?`Resume audit updates`:`Pause audit updates`,children:(0,Q.jsx)(A,{size:`small`,"aria-label":d?`Resume audit updates`:`Pause audit updates`,onClick:re,children:d?(0,Q.jsx)(ue,{}):(0,Q.jsx)(se,{})})}),(0,Q.jsx)(p,{size:`small`,variant:`outlined`,label:d?`Paused`:`Live`,sx:{height:22}}),(0,Q.jsx)(v,{title:`Refresh audit`,children:(0,Q.jsx)(`span`,{children:(0,Q.jsx)(A,{size:`small`,"aria-label":`Refresh audit`,disabled:I,loading:I,onClick:B,children:(0,Q.jsx)(le,{})})})})]})]}),y?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(f,{component:`section`,"aria-label":`Audit filters`,sx:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(min(100%, 128px), 1fr))`,gap:1.5,mb:2},children:[(0,Q.jsxs)(x,{fullWidth:!0,select:!0,size:`small`,label:`Resource`,value:n,onChange:e=>r(e.target.value),slotProps:{inputLabel:{shrink:!0},select:{displayEmpty:!0}},sx:{minWidth:0},children:[(0,Q.jsx)(k,{value:``,children:`All resources`}),H.map(e=>(0,Q.jsx)(k,{value:e,children:e},e))]}),(0,Q.jsxs)(x,{fullWidth:!0,select:!0,size:`small`,label:`Actor`,value:a,onChange:e=>o(e.target.value),slotProps:{inputLabel:{shrink:!0},select:{displayEmpty:!0}},sx:{minWidth:0},children:[(0,Q.jsx)(k,{value:``,children:`All actors`}),(0,Q.jsx)(k,{value:`local`,children:`Local client`}),(0,Q.jsx)(k,{value:`user`,children:`User identities`}),(0,Q.jsx)(k,{value:`service`,children:`Service`}),(0,Q.jsx)(k,{value:`system`,children:`System`})]}),(0,Q.jsx)(x,{fullWidth:!0,size:`small`,label:`Action (exact)`,placeholder:`stack.start`,value:c,onChange:e=>l(e.target.value),sx:{minWidth:0}}),(0,Q.jsx)(x,{fullWidth:!0,select:!0,size:`small`,label:`Latest entries`,value:e,onChange:e=>t(Number(e.target.value)),sx:{minWidth:0},children:Ne.map(e=>(0,Q.jsx)(k,{value:e,children:e},e))})]}),U&&(0,Q.jsx)(s,{size:`small`,sx:{mb:1},onClick:()=>{r(``),o(``),l(``)},children:`Reset filters`}),F&&(0,Q.jsxs)(z,{severity:`error`,sx:{mb:2},action:(0,Q.jsx)(s,{color:`inherit`,size:`small`,onClick:()=>void L(),children:`Retry`}),children:[F,P&&` The last reading is retained.`]}),I&&!P&&(0,Q.jsx)(ge,{variant:`rectangular`,height:280}),P&&!P.available&&(0,Q.jsx)(z,{severity:`info`,children:`This daemon has no audit storage. No event history is available.`}),P?.available&&R.length===0&&(0,Q.jsx)(ye,{title:U?`No matching events`:`Nothing recorded yet`,description:U?`Change the filters to read another part of the trail.`:`Recorded control-plane actions will appear here.`}),P?.available&&R.length>0&&(0,Q.jsx)(f,{sx:{border:`1px solid`,borderColor:`divider`,borderRadius:1,overflow:`hidden`},children:(0,Q.jsx)(fe,{label:`Audit events`,children:(0,Q.jsxs)(te,{size:`small`,"aria-label":`Audit events`,sx:{tableLayout:`fixed`},children:[(0,Q.jsx)(ne,{children:(0,Q.jsxs)(C,{children:[(0,Q.jsx)(_,{sx:{width:40,px:.5},children:(0,Q.jsx)(f,{component:`span`,sx:{position:`absolute`,width:1,height:1,overflow:`hidden`,clipPath:`inset(50%)`},children:`Details`})}),(0,Q.jsx)(_,{sx:{width:132,display:{xs:`none`,sm:`table-cell`}},children:(0,Q.jsx)(v,{title:`Local time; exact UTC is available in the event details`,children:(0,Q.jsx)(`span`,{children:`Recorded`})})}),(0,Q.jsx)(_,{children:`Event / resource`}),(0,Q.jsx)(_,{sx:{width:192,display:{xs:`none`,md:`table-cell`}},children:`Actor`})]})}),(0,Q.jsx)(ee,{children:R.map(e=>(0,Q.jsx)(ke,{row:e},e.id))})]})})}),j?.error&&(0,Q.jsx)(z,{severity:`error`,sx:{mt:1},children:j.error}),P?.available&&R.length>0&&(0,Q.jsxs)(M,{direction:`row`,sx:{mt:1,gap:1,alignItems:`center`,flexWrap:`wrap`},children:[(0,Q.jsx)(D,{variant:`caption`,color:`text.secondary`,sx:{flex:`1 1 180px`},children:j?`Updates paused while reading history. Resume to return to the latest events.`:`Newest first. This count is the current reading, not the entire trail.`}),(j?!j.exhausted:R.length===e)&&(0,Q.jsx)(s,{size:`small`,disabled:j?.pending,loading:j?.pending,onClick:()=>void V(),children:j?.error?`Retry older events`:`Load older`}),j?.exhausted&&(0,Q.jsx)(D,{variant:`caption`,color:`text.secondary`,children:`Start of matching history`})]})]}):(0,Q.jsx)(z,{severity:`info`,children:`Your role cannot read the control-plane audit trail.`})]})}var Z,Q,Me,Ne;function $(){return($=e((()=>{Z=t(),c(),l(),u(),O(),j(),N(),h(),b(),E(),S(),w(),T(),y(),g(),de(),R(),ve(),he(),xe(),pe(),Ae(),ce(),r(),U(),H(),V(),K(),Q=n(),Me=[`stack`,`release`,`project`,`node`,`kernel-rollout`,`pipeline`,`secret`,`terminal`,`account`,`app`,`file`],Ne=[50,100,250,500]})))()}$();export{je as default};
@@ -0,0 +1,4 @@
1
+ import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{a as r,o as i}from"./mui-agG5dued.js";import{H as a,V as o}from"./mui-SNRRJ_vi.js";import{B as s,z as c}from"./mui-B3fJdIMc.js";import{n as l,t as u}from"./react-CEuifcaQ.js";function d(e){let t=f.color[e];return{"--omni-bg":t.background,"--omni-surface":t.surface,"--omni-surface-raised":t.raised,"--omni-text":t.text,"--omni-text-muted":t.muted,"--omni-border":t.border,"--omni-control-border":t.controlBorder,"--omni-accent":t.accent,"--omni-on-accent":t.onAccent,"--omni-success":t.success,"--omni-warning":t.warning,"--omni-error":t.error,"--omni-info":t.info,"--omni-font-sans":f.font.sans,"--omni-font-mono":f.font.mono,"--omni-radius":`${f.radius}px`,"--omni-focus-ring":`2px solid ${t.accent}`}}var f;function p(){return(p=e((()=>{f={font:{sans:`Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`,mono:`ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace`},radius:6,color:{light:{background:`#F3F6F7`,surface:`#FFFFFF`,raised:`#E9EFF1`,text:`#162026`,muted:`#53646D`,disabled:`#6C7D86`,border:`#D2DCE1`,controlBorder:`#71818A`,accent:`#006D75`,onAccent:`#FFFFFF`,success:`#226742`,warning:`#8A5700`,error:`#B43A44`,info:`#2C609A`},dark:{background:`#0B0F12`,surface:`#13191D`,raised:`#1B2328`,text:`#E6EDF0`,muted:`#A5B5BD`,disabled:`#83959F`,border:`#2D3B43`,controlBorder:`#61757F`,accent:`#71DDE3`,onAccent:`#0B2528`,success:`#7BCB9B`,warning:`#E8C36A`,error:`#F2969A`,info:`#8FBDF4`}}}})))()}var m;function h(){return(h=e((()=>{p(),m={viewBox:`0 0 64 64`,core:`M23.545 43.786L43.837 37.929L28.618 23.285Z`,facets:[{path:`M22.023 44.226L8.496 48.131L30.478 10.056Z`,x:-2.94,y:.849},{path:`M28.999 21.747L32.38 8.079L54.363 46.154Z`,x:.735,y:-2.97},{path:`M44.978 39.027L55.124 48.79L11.159 48.79Z`,x:2.205,y:2.122}]},`${m.viewBox}${f.color.light.accent}${f.color.dark.accent}${m.core}${m.facets.map(({path:e})=>`<path d="${e}"/>`).join(``)}`})))()}function g({size:e=32,state:t=`idle`,label:n=`Omnitron`,sx:r}){let i=(0,v.useId)(),a=(0,v.useRef)(null),[s,c]=(0,v.useState)(!0),l=t===`loading`;return(0,v.useEffect)(()=>{if(!l)return;let e=!0,t=()=>c(e&&!document.hidden),n=typeof IntersectionObserver>`u`?void 0:new IntersectionObserver(([n])=>{e=n?.isIntersecting??!1,t()});return a.current&&n?.observe(a.current),document.addEventListener(`visibilitychange`,t),t(),()=>{n?.disconnect(),document.removeEventListener(`visibilitychange`,t)}},[l]),(0,y.jsxs)(o,{ref:a,component:`svg`,xmlns:`http://www.w3.org/2000/svg`,viewBox:m.viewBox,role:n?`img`:void 0,"aria-labelledby":n?i:void 0,"aria-hidden":!n||void 0,focusable:`false`,"data-omnitron-mark":t,sx:[{display:`block`,width:e,height:e,flexShrink:0,color:t===`error`?`error.main`:t===`success`?`success.main`:`primary.main`,fill:`currentColor`,"& [data-facet]":l?{animation:`${b} 2.4s ease-in-out infinite`,animationPlayState:s?`running`:`paused`,"@media (prefers-reduced-motion: reduce)":{animation:`none`,transform:`none`}}:{}},...Array.isArray(r)?r:[r]],children:[n&&(0,y.jsx)(`title`,{id:i,children:n}),m.facets.map(({path:e,x:t,y:n},r)=>(0,y.jsx)(`path`,{"data-facet":r,d:e,style:{"--omni-shift-x":`${t}px`,"--omni-shift-y":`${n}px`,animationDelay:`${r*160}ms`}},e)),t===`success`?(0,y.jsx)(`path`,{d:`m28 35 3 2.5 5.5-4.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`}):t===`error`?(0,y.jsx)(`path`,{d:`m29 32 7 6m0-6-7 6`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`}):(0,y.jsx)(`path`,{d:m.core})]})}function _({size:e=32,sx:t}){return(0,y.jsxs)(o,{sx:[{display:`inline-flex`,alignItems:`center`,gap:1.25,minWidth:0},...Array.isArray(t)?t:[t]],children:[(0,y.jsx)(g,{size:e,label:null}),(0,y.jsx)(c,{component:`span`,sx:{fontFamily:f.font.sans,color:`text.primary`,fontWeight:600,fontSize:`0.875rem`,letterSpacing:`0.12em`,lineHeight:1,whiteSpace:`nowrap`},children:`OMNITRON`})]})}var v,y,b;function x(){return(x=e((()=>{v=t(),a(),s(),r(),h(),p(),y=n(),b=i`
2
+ 0%, 60%, 100% { transform: translate(0, 0); }
3
+ 20%, 38% { transform: translate(var(--omni-shift-x), var(--omni-shift-y)); }
4
+ `})))()}function S(e,t,n){return e===502||e===503?`down`:(t??``).includes(`text/html`)||e<200||e>=300||n===null?`unreachable`:n.status===`online`?`up`:`down`}function C(e,t){return e===`up`?{status:`online`,consecutiveUnreachable:0}:e===`down`?{status:`offline`,consecutiveUnreachable:0}:{status:`degraded`,consecutiveUnreachable:t+1}}async function w(){try{let e=new AbortController,t=setTimeout(()=>e.abort(),D),n=await fetch(`/api/health`,{signal:e.signal,cache:`no-store`});clearTimeout(t);let r=n.headers.get(`content-type`),i=n.ok?await n.json().catch(()=>null):null;return S(n.status,r,i)}catch{return`unreachable`}}async function T(e,t){let n=C(await w(),t().consecutiveUnreachable);e({status:n.status,consecutiveUnreachable:n.consecutiveUnreachable,lastChecked:Date.now()})}var E,D,O,k,A;function j(){return(j=e((()=>{l(),E=3e4,D=15e3,O=u((e,t)=>({status:`unknown`,lastChecked:null,consecutiveUnreachable:0,probe:async()=>{await T(e,t)},startPolling:()=>{T(e,t);let n=setInterval(()=>void T(e,t),E);return()=>clearInterval(n)}})),k=()=>O(e=>e.status!==`offline`),A=()=>O(e=>e.status)})))()}export{_ as a,p as c,O as i,d as l,k as n,g as o,A as r,x as s,j as t,f as u};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{t}from"./react-BN8qLIAi.js";import{Vt as n,Yt as r}from"./mui-BTN91yBK.js";import{dn as i,un as a}from"./mui-CdB_p2lt.js";import{A as o,D as s,E as c,H as l,M as u,O as d,T as f,V as p,j as m,k as h}from"./mui-BXSXx9c9.js";import{B as g,z as _}from"./mui-Cd711nOk.js";import{S as v,x as y}from"./mui-BwsIrivo.js";function b({variant:e=`elevation`,title:t,subheader:n,headerAction:r,headerSx:i,contentSx:a,actions:o,actionsSx:c,disablePadding:l,children:u,sx:d,ref:p,...m}){let g={variant:e},_=t||n||r;return(0,S.jsxs)(C,{ref:p,ownerState:g,variant:e===`outlined`?`outlined`:`elevation`,sx:d,...m,children:[_&&(0,S.jsx)(f,{title:t,subheader:n,action:r,sx:i}),u&&(0,S.jsx)(s,{sx:{...l&&{p:0,"&:last-child":{pb:0}},...a},children:u}),o&&(0,S.jsx)(h,{sx:c,children:o})]})}function x({label:e,value:t,change:n,icon:r,color:i=`primary`,loading:a,subtitle:o,variant:s=`outlined`,sx:c,...l}){let u=n&&n>0,d=n&&n<0;return(0,S.jsx)(b,{variant:s,contentSx:{p:2,"&:last-child":{pb:2}},sx:c,...l,children:(0,S.jsxs)(p,{sx:{display:`flex`,justifyContent:`space-between`,alignItems:`flex-start`},children:[(0,S.jsx)(p,{children:a?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(y,{width:80,height:16}),(0,S.jsx)(y,{width:50,height:32,sx:{mt:.5}})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(_,{variant:`caption`,sx:{fontWeight:600,color:`text.secondary`,textTransform:`uppercase`,letterSpacing:.5},children:e}),(0,S.jsx)(_,{variant:`h4`,sx:{fontWeight:700,color:`${i}.main`,mt:.5},children:t}),n!==void 0&&(0,S.jsxs)(_,{variant:`caption`,color:u?`success.main`:d?`error.main`:`text.secondary`,sx:{fontWeight:500,mt:.5,display:`block`},children:[u?`+`:``,n,`%`]}),o&&(0,S.jsx)(_,{variant:`caption`,sx:{color:`text.secondary`},children:o})]})}),r&&!a&&(0,S.jsx)(p,{sx:{color:`${i}.main`},children:r})]})})}var S,C;function w(){return(w=e((()=>{l(),u(),c(),d(),o(),g(),v(),a(),r(),S=t(),C=i(m,{shouldForwardProp:e=>e!==`ownerState`})(({theme:e,ownerState:t})=>{let{variant:r}=t,i=typeof e.shape.borderRadius==`number`?e.shape.borderRadius:4,a={border:`none`,boxShadow:`none`,backgroundColor:n(e.palette.grey[500],.08)};return{position:`relative`,borderRadius:i*2,...r===`soft`&&a,...r===`outlined`&&{boxShadow:`none`}}})})))()}export{x as n,w as r,b as t};
1
+ import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{t}from"./react-BN8qLIAi.js";import{Vt as n,Yt as r}from"./mui-BTN91yBK.js";import{dn as i,un as a}from"./mui-Bdr6Ks5j.js";import{A as o,D as s,E as c,H as l,M as u,O as d,T as f,V as p,j as m,k as h}from"./mui-SNRRJ_vi.js";import{B as g,z as _}from"./mui-B3fJdIMc.js";import{S as v,x as y}from"./mui-CPEkFAPo.js";function b({variant:e=`elevation`,title:t,subheader:n,headerAction:r,headerSx:i,contentSx:a,actions:o,actionsSx:c,disablePadding:l,children:u,sx:d,ref:p,...m}){let g={variant:e},_=t||n||r;return(0,S.jsxs)(C,{ref:p,ownerState:g,variant:e===`outlined`?`outlined`:`elevation`,sx:d,...m,children:[_&&(0,S.jsx)(f,{title:t,subheader:n,action:r,sx:i}),u&&(0,S.jsx)(s,{sx:{...l&&{p:0,"&:last-child":{pb:0}},...a},children:u}),o&&(0,S.jsx)(h,{sx:c,children:o})]})}function x({label:e,value:t,change:n,icon:r,color:i=`primary`,loading:a,subtitle:o,variant:s=`outlined`,sx:c,...l}){let u=n&&n>0,d=n&&n<0;return(0,S.jsx)(b,{variant:s,contentSx:{p:2,"&:last-child":{pb:2}},sx:c,...l,children:(0,S.jsxs)(p,{sx:{display:`flex`,justifyContent:`space-between`,alignItems:`flex-start`},children:[(0,S.jsx)(p,{children:a?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(y,{width:80,height:16}),(0,S.jsx)(y,{width:50,height:32,sx:{mt:.5}})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(_,{variant:`caption`,sx:{fontWeight:600,color:`text.secondary`,textTransform:`uppercase`,letterSpacing:.5},children:e}),(0,S.jsx)(_,{variant:`h4`,sx:{fontWeight:700,color:`${i}.main`,mt:.5},children:t}),n!==void 0&&(0,S.jsxs)(_,{variant:`caption`,color:u?`success.main`:d?`error.main`:`text.secondary`,sx:{fontWeight:500,mt:.5,display:`block`},children:[u?`+`:``,n,`%`]}),o&&(0,S.jsx)(_,{variant:`caption`,sx:{color:`text.secondary`},children:o})]})}),r&&!a&&(0,S.jsx)(p,{sx:{color:`${i}.main`},children:r})]})})}var S,C;function w(){return(w=e((()=>{l(),u(),c(),d(),o(),g(),v(),a(),r(),S=t(),C=i(m,{shouldForwardProp:e=>e!==`ownerState`})(({theme:e,ownerState:t})=>{let{variant:r}=t,i=typeof e.shape.borderRadius==`number`?e.shape.borderRadius:4,a={border:`none`,boxShadow:`none`,backgroundColor:n(e.palette.grey[500],.08)};return{position:`relative`,borderRadius:i*2,...r===`soft`&&a,...r===`outlined`&&{boxShadow:`none`}}})})))()}export{x as n,w as r,b as t};
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/react-apexcharts.esm-DoOt-pu4.js","assets/rolldown-runtime-CNOWq4Kh.js","assets/react-BN8qLIAi.js","assets/charts-BY7qI6s2.js","assets/charts-CpBdHU_A.js"])))=>i.map(i=>d[i]);
2
- import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{a as r,i}from"./services-BddvcFi8.js";import{dn as a,un as o}from"./mui-CdB_p2lt.js";import{H as s,V as c}from"./mui-BXSXx9c9.js";import{S as l,x as u}from"./mui-BwsIrivo.js";import{n as d,t as f}from"./preload-helper-DzCYNvzR.js";function p(e){return`${h}__${e}`}var m,h;function g(){return(g=e((()=>{m=`prism`,h=m})))()}function _(...e){return i(e)}function v(){return(v=e((()=>{r()})))()}var y;function b(){return(b=e((()=>{g(),y={root:p(`chart__root`),loading:p(`chart__loading`),legends:{root:p(`chart__legends__root`),item:{wrap:p(`chart__legends__item__wrap`),root:p(`chart__legends__item__root`),dot:p(`chart__legends__item__dot`),icon:p(`chart__legends__item__icon`),label:p(`chart__legends__item__label`),value:p(`chart__legends__item__value`)}}}})))()}function x({sx:e,className:t,type:n,...r}){let i=n&&C.includes(n);return(0,S.jsx)(c,{className:_(y.loading,t),sx:[{top:0,left:0,width:1,zIndex:9,height:1,p:`inherit`,overflow:`hidden`,alignItems:`center`,position:`absolute`,borderRadius:`inherit`,justifyContent:`center`,display:`flex`},...Array.isArray(e)?e:[e]],...r,children:(0,S.jsx)(u,{variant:`circular`,sx:{width:1,height:1,borderRadius:`inherit`,...i&&{borderRadius:`50%`}}})})}var S,C;function w(){return(w=e((()=>{s(),l(),v(),b(),S=n(),C=[`donut`,`radialBar`,`pie`,`polarArea`]})))()}function T({type:e,series:t,options:n,width:r=`100%`,height:i=`100%`,slotProps:a,className:o,sx:s,...c}){let[l,u]=(0,E.useState)(!1);(0,E.useEffect)(()=>{u(!0)},[]);let d=()=>(0,D.jsx)(x,{type:e,sx:a?.loading});return(0,D.jsx)(k,{dir:`ltr`,className:_(y.root,o),sx:[{minHeight:typeof i==`number`?i:void 0},...Array.isArray(s)?s:[s]],...c,children:l?(0,D.jsx)(E.Suspense,{fallback:d(),children:(0,D.jsx)(O,{type:e,series:t,options:n,width:r,height:i})}):d()})}var E,D,O,k;function A(){return(A=e((()=>{E=t(),o(),v(),b(),w(),D=n(),d(),O=(0,E.lazy)(()=>f(()=>import(`./react-apexcharts.esm-DoOt-pu4.js`).then(e=>({default:e.default})),__vite__mapDeps([0,1,2,3,4]))),k=a(`div`)(({theme:e})=>({"--prism-chart-text":e.vars?.palette.text.primary??e.palette.text.primary,"--prism-chart-muted":e.vars?.palette.text.secondary??e.palette.text.secondary,"--prism-chart-background":e.vars?.palette.background.paper??e.palette.background.paper,"--prism-chart-neutral":e.vars?.palette.background.default??e.palette.background.default,"--prism-chart-divider":e.vars?.palette.divider??e.palette.divider,"--prism-chart-shadow":e.shadows[8],width:`100%`,minWidth:0,maxWidth:`100%`,flexShrink:0,position:`relative`,borderRadius:Number(e.shape.borderRadius)*1.5}))})))()}export{A as n,T as t};
2
+ import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{a as r,i}from"./services-BddvcFi8.js";import{dn as a,un as o}from"./mui-Bdr6Ks5j.js";import{H as s,V as c}from"./mui-SNRRJ_vi.js";import{S as l,x as u}from"./mui-CPEkFAPo.js";import{n as d,t as f}from"./preload-helper-DzCYNvzR.js";function p(e){return`${h}__${e}`}var m,h;function g(){return(g=e((()=>{m=`prism`,h=m})))()}function _(...e){return i(e)}function v(){return(v=e((()=>{r()})))()}var y;function b(){return(b=e((()=>{g(),y={root:p(`chart__root`),loading:p(`chart__loading`),legends:{root:p(`chart__legends__root`),item:{wrap:p(`chart__legends__item__wrap`),root:p(`chart__legends__item__root`),dot:p(`chart__legends__item__dot`),icon:p(`chart__legends__item__icon`),label:p(`chart__legends__item__label`),value:p(`chart__legends__item__value`)}}}})))()}function x({sx:e,className:t,type:n,...r}){let i=n&&C.includes(n);return(0,S.jsx)(c,{className:_(y.loading,t),sx:[{top:0,left:0,width:1,zIndex:9,height:1,p:`inherit`,overflow:`hidden`,alignItems:`center`,position:`absolute`,borderRadius:`inherit`,justifyContent:`center`,display:`flex`},...Array.isArray(e)?e:[e]],...r,children:(0,S.jsx)(u,{variant:`circular`,sx:{width:1,height:1,borderRadius:`inherit`,...i&&{borderRadius:`50%`}}})})}var S,C;function w(){return(w=e((()=>{s(),l(),v(),b(),S=n(),C=[`donut`,`radialBar`,`pie`,`polarArea`]})))()}function T({type:e,series:t,options:n,width:r=`100%`,height:i=`100%`,slotProps:a,className:o,sx:s,...c}){let[l,u]=(0,E.useState)(!1);(0,E.useEffect)(()=>{u(!0)},[]);let d=()=>(0,D.jsx)(x,{type:e,sx:a?.loading});return(0,D.jsx)(k,{dir:`ltr`,className:_(y.root,o),sx:[{minHeight:typeof i==`number`?i:void 0},...Array.isArray(s)?s:[s]],...c,children:l?(0,D.jsx)(E.Suspense,{fallback:d(),children:(0,D.jsx)(O,{type:e,series:t,options:n,width:r,height:i})}):d()})}var E,D,O,k;function A(){return(A=e((()=>{E=t(),o(),v(),b(),w(),D=n(),d(),O=(0,E.lazy)(()=>f(()=>import(`./react-apexcharts.esm-DoOt-pu4.js`).then(e=>({default:e.default})),__vite__mapDeps([0,1,2,3,4]))),k=a(`div`)(({theme:e})=>({"--prism-chart-text":e.vars?.palette.text.primary??e.palette.text.primary,"--prism-chart-muted":e.vars?.palette.text.secondary??e.palette.text.secondary,"--prism-chart-background":e.vars?.palette.background.paper??e.palette.background.paper,"--prism-chart-neutral":e.vars?.palette.background.default??e.palette.background.default,"--prism-chart-divider":e.vars?.palette.divider??e.palette.divider,"--prism-chart-shadow":e.shadows[8],width:`100%`,minWidth:0,maxWidth:`100%`,flexShrink:0,position:`relative`,borderRadius:Number(e.shape.borderRadius)*1.5}))})))()}export{A as n,T as t};