@camstack/addon-admin-ui 1.2.634 → 1.2.635

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 (161) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/assets/Addons-it-7xyWO.js +5 -0
  3. package/dist/assets/{AdminPage-CPPoleZA.js → AdminPage-C28MWSEJ.js} +1 -1
  4. package/dist/assets/{AdminSectionedPage-C_DLslGH.js → AdminSectionedPage-N7ZzoaCA.js} +1 -1
  5. package/dist/assets/AiProfiles-DvvGmPqc.js +3 -0
  6. package/dist/assets/Authentication-CdkAuFpQ.js +1 -0
  7. package/dist/assets/Build-Dj-J_LDL.js +39 -0
  8. package/dist/assets/Calendars-Bl2YxKcY.js +1 -0
  9. package/dist/assets/{CameraGrids-CIJubNTN.js → CameraGrids-BmuQfQwD.js} +1 -1
  10. package/dist/assets/Cluster-BHVazygn.js +1 -0
  11. package/dist/assets/CompositionBlockEditor-BJo6-Hg-.js +2 -0
  12. package/dist/assets/{CompositionEditorPage-jP0e8vX8.js → CompositionEditorPage-CSgC3j3b.js} +1 -1
  13. package/dist/assets/Data-DMpGwsud.js +2 -0
  14. package/dist/assets/DeviceDetail-C5qPLFqX.js +2 -0
  15. package/dist/assets/{Devices-Ddhmovvw.js → Devices-DfUS0XHQ.js} +1 -1
  16. package/dist/assets/{EmbedPlayerPage-B9wkgcPc.js → EmbedPlayerPage-CXqkku3M.js} +1 -1
  17. package/dist/assets/History-Bu9dClRP.js +1 -0
  18. package/dist/assets/Identity-P-9FfQY9.js +1 -0
  19. package/dist/assets/InstancesTable-D2wYEpEv.js +1 -0
  20. package/dist/assets/IntegrationDetail-Ckv-pM-X.js +1 -0
  21. package/dist/assets/Integrations-BAN_fC9m.js +1 -0
  22. package/dist/assets/Integrations-DM8ICLWP.js +2 -0
  23. package/dist/assets/{Library-COZVDG1J.js → Library-Boz_glAa.js} +1 -1
  24. package/dist/assets/Locations-G2ggYLH1.js +3 -0
  25. package/dist/assets/{Logs-_Lymv-hK.js → Logs-BUWUMnM2.js} +1 -1
  26. package/dist/assets/{MaskShapeCanvas-Dkn9mTx5.js → MaskShapeCanvas-GSzxL0sb.js} +1 -1
  27. package/dist/assets/{MotionZonesSettings-DbJd1q0y.js → MotionZonesSettings-zuXI8WDy.js} +1 -1
  28. package/dist/assets/MyAccess-BEvsl84G.js +2 -0
  29. package/dist/assets/Network-Q3AVjSDy.js +1 -0
  30. package/dist/assets/NodeAddonsSettingsPanel-DY9KrknX.js +1 -0
  31. package/dist/assets/Notifications-B09FRQLf.js +1 -0
  32. package/dist/assets/{Pipeline-CBIucM6P.js → Pipeline-DzMkRdB8.js} +1 -1
  33. package/dist/assets/{PrivacyMaskSettings-B7mOaiDG.js → PrivacyMaskSettings-B4NUHvPx.js} +1 -1
  34. package/dist/assets/Recordings-d918Fao6.js +1 -0
  35. package/dist/assets/{ScanSubnetEditor-g4rMYaaa.js → ScanSubnetEditor-C7Np_Myd.js} +1 -1
  36. package/dist/assets/{SceneMonitorEditor-B99BtkWG.js → SceneMonitorEditor-D5EfTLG4.js} +1 -1
  37. package/dist/assets/SessionsList--ByXUdry.js +2 -0
  38. package/dist/assets/{Showroom-BlMJHK6P.js → Showroom-CpQU2YYQ.js} +1 -1
  39. package/dist/assets/{StorageLocationsTable-BCc20Y-P.js → StorageLocationsTable-Cb-zvsAa.js} +1 -1
  40. package/dist/assets/{System-_om1Qy_Z.js → System-c-od2eUi.js} +1 -1
  41. package/dist/assets/{Templates-ClUtf6zo.js → Templates-DbOHcEoP.js} +1 -1
  42. package/dist/assets/{Terminal-CK-OPJi8.js → Terminal-vgjKTZ6i.js} +3 -3
  43. package/dist/assets/{TrainingProviders-CMfEG1p0.js → TrainingProviders-DwApoYD1.js} +1 -1
  44. package/dist/assets/{Viewer-D8ErfEDa.js → Viewer-wmQSDFx4.js} +1 -1
  45. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-D5EjGbog.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-BJYMJYN7.js} +1 -1
  46. package/dist/assets/{action-draft-BF1Yv5wJ.js → action-draft-SrqFGFVW.js} +1 -1
  47. package/dist/assets/{ai-page.helpers-7-YKMWA7.js → ai-page.helpers-C_Yr1xBa.js} +1 -1
  48. package/dist/assets/{archive-WByIhorf.js → archive-CnD3EIbI.js} +1 -1
  49. package/dist/assets/{assignment-candidates-CerZJluZ.js → assignment-candidates-JnnkKMNk.js} +1 -1
  50. package/dist/assets/{authed-media-vTZUQ8BO.js → authed-media-b_KsU6o6.js} +1 -1
  51. package/dist/assets/{bell-off-HUbueWAa.js → bell-off-DXoIeft3.js} +1 -1
  52. package/dist/assets/{board-model-BeY6U40R.js → board-model-Dhq6ifuR.js} +1 -1
  53. package/dist/assets/{boxes-Sn1wqpgK.js → boxes-2HiFvbRi.js} +1 -1
  54. package/dist/assets/{calendar-clock-TWIEL7Fd.js → calendar-clock-BdVpCjGZ.js} +1 -1
  55. package/dist/assets/{circle-arrow-up-BZb1tft0.js → circle-arrow-up-DtE1a3jK.js} +1 -1
  56. package/dist/assets/circle-slash-DD5DGeBE.js +1 -0
  57. package/dist/assets/client-DtixJSIH.js +839 -0
  58. package/dist/assets/create-composition-CdHcgM5T.js +2 -0
  59. package/dist/assets/crop-DtJsKDRR.js +1 -0
  60. package/dist/assets/{database-zap-DDQJWo1I.js → database-zap-hwvWqFAr.js} +1 -1
  61. package/dist/assets/{device-integration-icon-BEojiV6j.js → device-integration-icon-JcbJW-sx.js} +1 -1
  62. package/dist/assets/device-picker-model-BhZ3nUKX.js +1 -0
  63. package/dist/assets/dist-DN98Ncd8.js +839 -0
  64. package/dist/assets/{dist-BAkSt7-o.js → dist-DtXy-_hV.js} +1 -1
  65. package/dist/assets/{eraser-BXfY9g0S.js → eraser-0igUeEn4.js} +1 -1
  66. package/dist/assets/{file-up-CGHZOKg0.js → file-up-Bim5lEKk.js} +1 -1
  67. package/dist/assets/{format-C6WZEo_1.js → format-ClefNnBA.js} +1 -1
  68. package/dist/assets/{framework-packages-DoBKjjer.js → framework-packages-B0ugw-Ay.js} +1 -1
  69. package/dist/assets/{hard-drive-download-B12jnOmz.js → hard-drive-download-BqaDoqeT.js} +1 -1
  70. package/dist/assets/{hostInit-DvgZnKz2.js → hostInit-Zt1c3yOY.js} +1 -1
  71. package/dist/assets/i18n-xBJb_nV7.js +1 -0
  72. package/dist/assets/icons-DWvhrrHw.js +1 -0
  73. package/dist/assets/index-BZIzoUuI.css +2 -0
  74. package/dist/assets/index-IUYaCNr3.js +4 -0
  75. package/dist/assets/{key-C7vcpiqV.js → key-OpPYfUdn.js} +1 -1
  76. package/dist/assets/{languages-NIG6fIsC.js → languages-NKFv36FH.js} +1 -1
  77. package/dist/assets/{layers-igKznkhu.js → layers-BYYEeSk8.js} +1 -1
  78. package/dist/assets/{link-2-off-ViXG09ia.js → link-2-off-BQUSK1Q1.js} +1 -1
  79. package/dist/assets/{linked-devices-model-Coihabk7.js → linked-devices-model-CNibZiAj.js} +1 -1
  80. package/dist/assets/{memory-stick-Cb3rfsma.js → memory-stick-FrjSgbSx.js} +1 -1
  81. package/dist/assets/{message-square-plus-MY_vmmYC.js → message-square-plus-R1KzFT_3.js} +1 -1
  82. package/dist/assets/{mf-entry-bootstrap-0-bf765b1e.js → mf-entry-bootstrap-0-b11ec2f0.js} +2 -2
  83. package/dist/assets/{mic-off-DQbHj0Dp.js → mic-off-D-uv270W.js} +1 -1
  84. package/dist/assets/{monitor-off-KvLmRgXm.js → monitor-off-23GJfNCk.js} +1 -1
  85. package/dist/assets/{monitor-smartphone-wbkRUoUy.js → monitor-smartphone-Bv9btLO7.js} +1 -1
  86. package/dist/assets/mount-BhZ3nUKX.js +1 -0
  87. package/dist/assets/{notification-rule-status-DSPA2LGi.js → notification-rule-status-CSdUF_tS.js} +1 -1
  88. package/dist/assets/{player-overlays-D2iM_dnq.js → player-overlays-DS6dT7SD.js} +1 -1
  89. package/dist/assets/remoteEntry-C8Nu6Wkp.js +1 -0
  90. package/dist/assets/{ruler-Cnh0qH1K.js → ruler-B5-PAq3K.js} +1 -1
  91. package/dist/assets/{scan-eye-B57MjUsN.js → scan-eye-B6Jzl98g.js} +1 -1
  92. package/dist/assets/{scissors-jk6_pSRI.js → scissors-DSuf9Nu7.js} +1 -1
  93. package/dist/assets/{search-x-KiZ1cgFX.js → search-x-DikQGG4z.js} +1 -1
  94. package/dist/assets/{send-DAC8bZ9x.js → send-DjOMX7BE.js} +1 -1
  95. package/dist/assets/{settings-2-B5Wblm0D.js → settings-2-RGt6KSqH.js} +1 -1
  96. package/dist/assets/{shapes-C877FMvu.js → shapes-C2fW7MJb.js} +1 -1
  97. package/dist/assets/{sigma-48mqbKtS.js → sigma-BhKqPZ7F.js} +1 -1
  98. package/dist/assets/src-D1sUPCi1.js +169 -0
  99. package/dist/assets/{sso-popup-zJECU9yL.js → sso-popup-C1hR2YBu.js} +1 -1
  100. package/dist/assets/{step-inspector-model-flcREGWU.js → step-inspector-model-BuQhYJra.js} +1 -1
  101. package/dist/assets/{table-2-Dcc8x9NW.js → table-2-CMyjawoR.js} +1 -1
  102. package/dist/assets/{timer-reset-DPB7Vi_P.js → timer-reset-B7vcTXYk.js} +1 -1
  103. package/dist/assets/{ungroup-CaRYV5oo.js → ungroup-cZrrI4SI.js} +1 -1
  104. package/dist/assets/{unlink-B1jawH2n.js → unlink-CU8i3fPe.js} +1 -1
  105. package/dist/assets/{usb-B566yDR8.js → usb-CZTccxRm.js} +1 -1
  106. package/dist/assets/{use-scenes-feed-Cv3Lv9tp.js → use-scenes-feed-DzJr-F4l.js} +1 -1
  107. package/dist/assets/{use-stationary-objects-DPdFLI4G.js → use-stationary-objects-DWdYOvvX.js} +1 -1
  108. package/dist/assets/{useAdminDeviceRemoval-CK79vXvY.js → useAdminDeviceRemoval-BRmWRglP.js} +1 -1
  109. package/dist/assets/useEventInvalidation-BhZ3nUKX.js +1 -0
  110. package/dist/assets/useNodeUrlSelection-BHycntFj.js +1 -0
  111. package/dist/assets/useTemplateSave-BIt_84s3.js +1 -0
  112. package/dist/assets/user-round-Cdt6x46z.js +1 -0
  113. package/dist/assets/{user-x-Dalx5dz-.js → user-x-C8J-JEQi.js} +1 -1
  114. package/dist/assets/{variable-CxFXQLx9.js → variable-B1tjLNN5.js} +1 -1
  115. package/dist/assets/{video-DFWp1_fo.js → video-lKXIQOeO.js} +1 -1
  116. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-Dbfg8wPM.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-aKVCr1TV.js} +2 -2
  117. package/dist/index.html +10 -10
  118. package/dist/server/addon.js +302 -14
  119. package/package.json +2 -2
  120. package/dist/assets/Addons-Cng9jF6c.js +0 -5
  121. package/dist/assets/AiProfiles-B6Xt0CM1.js +0 -3
  122. package/dist/assets/Authentication-CkLg9Az9.js +0 -1
  123. package/dist/assets/Build-DMEXJqf9.js +0 -39
  124. package/dist/assets/Calendars-BHc1dbvk.js +0 -1
  125. package/dist/assets/Cluster-CSTB-np5.js +0 -1
  126. package/dist/assets/CompositionBlockEditor-B4WN_aXq.js +0 -2
  127. package/dist/assets/Data-DJFzG2dC.js +0 -2
  128. package/dist/assets/DeviceDetail-3P3i5bd9.js +0 -2
  129. package/dist/assets/History-Cv6TryZt.js +0 -1
  130. package/dist/assets/Identity-Dmwp8J7o.js +0 -1
  131. package/dist/assets/InstanceSwitchCell-xSu6VGOy.js +0 -1
  132. package/dist/assets/InstancesTable-dSeWjA48.js +0 -1
  133. package/dist/assets/IntegrationDetail-oEpvT757.js +0 -1
  134. package/dist/assets/IntegrationHub-CIVmSeKd.js +0 -1
  135. package/dist/assets/Integrations-C5BzsIy2.js +0 -2
  136. package/dist/assets/Integrations-zlHqQ0X9.js +0 -1
  137. package/dist/assets/Locations-CpG6tIMC.js +0 -3
  138. package/dist/assets/MyAccess-3IH5sTuq.js +0 -2
  139. package/dist/assets/Network-DNJ2W_md.js +0 -1
  140. package/dist/assets/NodeAddonsSettingsPanel-BleYmajR.js +0 -1
  141. package/dist/assets/Notifications-C5S8_cBI.js +0 -1
  142. package/dist/assets/Recordings-Dzfu0JHh.js +0 -1
  143. package/dist/assets/SessionsList-DB9t5c5h.js +0 -2
  144. package/dist/assets/circle-slash-Yb1HMMEU.js +0 -1
  145. package/dist/assets/client-BT1qTuWk.js +0 -839
  146. package/dist/assets/create-composition-BCz5rteK.js +0 -2
  147. package/dist/assets/crop-Rp-pMXj8.js +0 -1
  148. package/dist/assets/device-picker-model-DxRFIJt2.js +0 -1
  149. package/dist/assets/dist-MZVzWw2Y.js +0 -839
  150. package/dist/assets/i18n-DO003gOw.js +0 -1
  151. package/dist/assets/icons-CSB91nWL.js +0 -1
  152. package/dist/assets/index-BtIAcMod.js +0 -4
  153. package/dist/assets/index-W6guS92q.css +0 -2
  154. package/dist/assets/key-square-wAKOa45w.js +0 -1
  155. package/dist/assets/mount-DxRFIJt2.js +0 -1
  156. package/dist/assets/remoteEntry-CjzR4ng6.js +0 -1
  157. package/dist/assets/src-Djs5D3BM.js +0 -169
  158. package/dist/assets/useEventInvalidation-DxRFIJt2.js +0 -1
  159. package/dist/assets/useNodeUrlSelection-B4V72DKj.js +0 -1
  160. package/dist/assets/useTemplateSave-sDhvqUj4.js +0 -1
  161. package/dist/assets/user-round-gyXn4SEe.js +0 -1
@@ -5894,7 +5894,7 @@ var ZodIssueCode = {
5894
5894
  var ZodFirstPartyTypeKind;
5895
5895
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5896
5896
  //#endregion
5897
- //#region ../types/dist/sleep-Dz1P6--1.mjs
5897
+ //#region ../types/dist/sleep-Cw1uUXvl.mjs
5898
5898
  /**
5899
5899
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5900
5900
  * window to float samples (D455).
@@ -14125,6 +14125,7 @@ var SYSTEM_CAP_VOCABULARY = {
14125
14125
  backup: system("system backups — run and restored from the Backups page"),
14126
14126
  broker: system("message-broker connections — configured, not actuated"),
14127
14127
  "calendar-source": system(INTERNAL),
14128
+ "cluster-update": system(CLUSTER),
14128
14129
  calendars: system("calendars feed schedules and conditions, not device actions"),
14129
14130
  composer: system("device composition — an authoring tool, not an action"),
14130
14131
  "core-blocks": system(INTERNAL),
@@ -14410,6 +14411,7 @@ var CAP_NAMES = Object.freeze([
14410
14411
  "camera-streams",
14411
14412
  "carbon-monoxide",
14412
14413
  "climate-control",
14414
+ "cluster-update",
14413
14415
  "color",
14414
14416
  "composer",
14415
14417
  "connectivity",
@@ -47675,6 +47677,140 @@ DeviceType.Thermostat, DeviceType.Climate, method(object({
47675
47677
  auth: "protected"
47676
47678
  });
47677
47679
  /**
47680
+ * cluster-update — the ONE flow that brings the whole cluster to a release
47681
+ * (planning#493). Hub-provided (`server-provided`), hub-only: the hub runs
47682
+ * the sequence itself, so the admin UI, the MCP and the CLI all start the same
47683
+ * job and read the same report instead of each driving their own loop.
47684
+ *
47685
+ * 1. backup (`backup.trigger`) — skipped only when the caller says so
47686
+ * 2. the hub's server closure (`applyServerUpdate`); the hub restarts and the
47687
+ * job RESUMES on the new boot, verified against the hub's running version
47688
+ * 3. every online agent behind the target, one at a time, verified: runs the
47689
+ * target, settled, online, and its capabilities registered (D848) — an
47690
+ * agent that comes back capless is a FAILED step, never a done one
47691
+ * 4. every stale addon on the hub (`addons.updatePackage`); agents follow by
47692
+ * reconciliation, which is verified, never pushed
47693
+ *
47694
+ * The job stops on the first failed step with a typed reason (D877). Its state
47695
+ * is durable on the hub and read by RPC (`getClusterUpdateJob`) — events are
47696
+ * telemetry and never carry it (D8, D11).
47697
+ */
47698
+ /** The steps, in the order they run. */
47699
+ var ClusterUpdateStepKindSchema = _enum([
47700
+ "backup",
47701
+ "hub-server",
47702
+ "agent-server",
47703
+ "addons"
47704
+ ]);
47705
+ /**
47706
+ * - `pending` — not reached yet.
47707
+ * - `running` — in progress (for `hub-server`: possibly across the restart).
47708
+ * - `ok` — done AND verified.
47709
+ * - `failed` — did not land; `reason` + `detail` say why. Stops the job.
47710
+ * - `skipped` — not run: nothing to do, opted out, the node is offline, or a
47711
+ * step before it failed. `detail` says which.
47712
+ */
47713
+ var ClusterUpdateStepStatusSchema = _enum([
47714
+ "pending",
47715
+ "running",
47716
+ "ok",
47717
+ "failed",
47718
+ "skipped"
47719
+ ]);
47720
+ /**
47721
+ * Why a step (and with it the job) failed. Stable, greppable; `detail` carries
47722
+ * the prose.
47723
+ */
47724
+ var ClusterUpdateFailureReasonSchema = _enum([
47725
+ "backup-unavailable",
47726
+ "backup-failed",
47727
+ "server-refused",
47728
+ "server-not-on-target",
47729
+ "node-capless",
47730
+ "status-unreadable",
47731
+ "addon-update-failed",
47732
+ "addons-not-converged",
47733
+ "interrupted"
47734
+ ]);
47735
+ var ClusterUpdateStepSchema = object({
47736
+ kind: ClusterUpdateStepKindSchema,
47737
+ /** The node the step acts on; absent for `backup` and `addons`. */
47738
+ nodeId: string().optional(),
47739
+ status: ClusterUpdateStepStatusSchema,
47740
+ /** One line for the operator: what happened, or why not. */
47741
+ detail: string(),
47742
+ reason: ClusterUpdateFailureReasonSchema.optional(),
47743
+ /** `hub-server` / `agent-server`: the version the node ran before. */
47744
+ fromVersion: string().nullable().optional(),
47745
+ /** `addons`: the packages this step updates, `name from -> to`. */
47746
+ packages: array(string()).readonly().optional(),
47747
+ startedAt: number$1().optional(),
47748
+ finishedAt: number$1().optional()
47749
+ });
47750
+ var ClusterUpdateJobStateSchema = _enum([
47751
+ "running",
47752
+ "succeeded",
47753
+ "failed"
47754
+ ]);
47755
+ var ClusterUpdateJobSchema = object({
47756
+ id: string(),
47757
+ state: ClusterUpdateJobStateSchema,
47758
+ /** The server version every node is brought to. */
47759
+ targetVersion: string(),
47760
+ /** Who started it (the user name, or `system`). */
47761
+ requestedBy: string(),
47762
+ startedAt: number$1(),
47763
+ finishedAt: number$1().optional(),
47764
+ /** Every step, in run order; later steps stay `pending` while it runs. */
47765
+ steps: array(ClusterUpdateStepSchema).readonly(),
47766
+ /** On `failed`: the step that stopped it (`nodeId` or the step kind). */
47767
+ stoppedAt: string().optional(),
47768
+ reason: ClusterUpdateFailureReasonSchema.optional(),
47769
+ /** Agents offline when the plan was read: never touched. */
47770
+ skippedOffline: array(string()).readonly()
47771
+ });
47772
+ var ClusterUpdateOptionsSchema = object({
47773
+ /** Explicit server target; omitted = the hub's latest registry check. */
47774
+ version: string().optional(),
47775
+ /** Update the addons too (default true). */
47776
+ addons: boolean().optional(),
47777
+ /**
47778
+ * Back up before touching anything (default true). `false` is an explicit
47779
+ * operator opt-out; a missing backup provider is otherwise a failure.
47780
+ */
47781
+ backup: boolean().optional()
47782
+ });
47783
+ /** Why a plan cannot start. */
47784
+ var ClusterUpdateBlockerSchema = _enum([
47785
+ "no-target",
47786
+ "node-busy",
47787
+ "job-running",
47788
+ "nothing-to-do",
47789
+ "status-unreadable"
47790
+ ]);
47791
+ var ClusterUpdatePlanSchema = object({
47792
+ /** `null` when no target could be resolved (`blocker: 'no-target'`). */
47793
+ targetVersion: string().nullable(),
47794
+ /** The steps the job WOULD run, all `pending` (or `skipped` with a reason). */
47795
+ steps: array(ClusterUpdateStepSchema).readonly(),
47796
+ skippedOffline: array(string()).readonly(),
47797
+ /** `null` = the plan can start. */
47798
+ blocker: ClusterUpdateBlockerSchema.nullable(),
47799
+ /** Prose for `blocker`. */
47800
+ blockerDetail: string().nullable()
47801
+ });
47802
+ var StartClusterUpdateResultSchema = object({
47803
+ accepted: boolean(),
47804
+ /** The job to follow with `getClusterUpdateJob`; `null` when refused. */
47805
+ jobId: string().nullable(),
47806
+ blocker: ClusterUpdateBlockerSchema.nullable(),
47807
+ message: string()
47808
+ });
47809
+ method(ClusterUpdateOptionsSchema, ClusterUpdatePlanSchema, { auth: "admin" }), method(ClusterUpdateOptionsSchema, StartClusterUpdateResultSchema, {
47810
+ kind: "mutation",
47811
+ auth: "admin"
47812
+ }), method(object({ jobId: string().optional() }), ClusterUpdateJobSchema.nullable(), { auth: "admin" });
47813
+ /**
47678
47814
  * Color-light cap. Coexists with `switch` (on/off) and `brightness`
47679
47815
  * (level) on the same device — `switch` toggles the bulb, `brightness`
47680
47816
  * sets the dim level, this cap sets the chromaticity.
@@ -50587,6 +50723,90 @@ var SiteZoneSchema = object({
50587
50723
  * the ones that most want grouping. */
50588
50724
  locationKeys: array(string())
50589
50725
  });
50726
+ var DeviceSearchRequiresSchema = object({
50727
+ /** Capability names the field wants a value of. */
50728
+ caps: array(string()).readonly(),
50729
+ /** `any` (default): a device with one of them is compatible. `all`: it must hold every one. */
50730
+ mode: _enum(["any", "all"]).optional()
50731
+ });
50732
+ var DeviceSearchFiltersSchema = object({
50733
+ locations: array(string()).readonly().optional(),
50734
+ integrationIds: array(string()).readonly().optional(),
50735
+ types: array(string()).readonly().optional()
50736
+ });
50737
+ var DeviceSearchInputSchema = object({
50738
+ /** Matches name, location, type, integration (id and label) and id. Case-insensitive. */
50739
+ text: string().optional(),
50740
+ requires: DeviceSearchRequiresSchema.optional(),
50741
+ filters: DeviceSearchFiltersSchema.optional(),
50742
+ /** List the devices that do not provide the required cap too (greyed, not pickable). */
50743
+ includeIncompatible: boolean().optional(),
50744
+ /** The device the field belongs to: its location drives `suggested`. */
50745
+ contextDeviceId: number$1().optional(),
50746
+ /**
50747
+ * Resolve exactly these devices, regardless of every filter, so a picked
50748
+ * value can be rendered. When given, `items` is these devices in the order
50749
+ * asked (no paging, `nextCursor` null) and the ones that do not exist are
50750
+ * listed in `missingIds`.
50751
+ */
50752
+ ids: array(number$1()).readonly().optional(),
50753
+ cursor: string().nullable().optional(),
50754
+ limit: number$1().int().min(1).max(200).optional()
50755
+ });
50756
+ var DeviceValueOptionSchema = object({
50757
+ cap: string(),
50758
+ /** Status-schema field path inside the cap (same paths as `getWireableFields`). */
50759
+ path: string(),
50760
+ label: string(),
50761
+ /** The current value as text; `null` when it is unknown or the read FAILED — never `0`. */
50762
+ reading: string().nullable(),
50763
+ unit: string().nullable().optional(),
50764
+ /** The field's measured quantity, when the cap declares one, so a client can format the reading. */
50765
+ quantity: ReadingQuantitySchema.optional()
50766
+ });
50767
+ var DeviceSearchItemSchema = object({
50768
+ id: number$1(),
50769
+ name: string(),
50770
+ type: _enum(DeviceType),
50771
+ location: string().nullable(),
50772
+ integrationId: string().nullable(),
50773
+ integrationLabel: string().nullable(),
50774
+ online: boolean().nullable(),
50775
+ disabled: boolean(),
50776
+ compatible: boolean(),
50777
+ /** Only the required caps' fields; empty when nothing was required or the device is incompatible. */
50778
+ values: array(DeviceValueOptionSchema).readonly()
50779
+ });
50780
+ var DeviceSearchFacetValueSchema = object({
50781
+ value: string(),
50782
+ count: number$1()
50783
+ });
50784
+ var DeviceSearchFacetIntegrationSchema = object({
50785
+ id: string(),
50786
+ label: string(),
50787
+ count: number$1()
50788
+ });
50789
+ var DeviceSearchFacetsSchema = object({
50790
+ locations: array(DeviceSearchFacetValueSchema).readonly(),
50791
+ integrations: array(DeviceSearchFacetIntegrationSchema).readonly(),
50792
+ types: array(DeviceSearchFacetValueSchema).readonly()
50793
+ });
50794
+ var DeviceSearchResultSchema = object({
50795
+ items: array(DeviceSearchItemSchema).readonly(),
50796
+ nextCursor: string().nullable(),
50797
+ /** Devices listed by this query across all pages (filters + text applied; incompatible counted only when `includeIncompatible`). */
50798
+ total: number$1(),
50799
+ /** Compatible devices after filters + text. */
50800
+ compatibleTotal: number$1(),
50801
+ /** Every device the caller's fleet holds, before anything is applied. */
50802
+ fleetTotal: number$1(),
50803
+ /** Incompatible devices after filters + text — the K of "show the K that don't". */
50804
+ hiddenIncompatible: number$1(),
50805
+ facets: DeviceSearchFacetsSchema,
50806
+ /** Same location as `contextDeviceId`; first page only. */
50807
+ suggested: array(DeviceSearchItemSchema).readonly(),
50808
+ missingIds: array(number$1()).readonly()
50809
+ });
50590
50810
  var ProviderStatusSchema = object({
50591
50811
  connected: boolean(),
50592
50812
  deviceCount: number$1(),
@@ -50979,6 +51199,9 @@ var DeviceInfoSchema = object({
50979
51199
  * named accordion sections (with optional intra-section order). See
50980
51200
  * `DeviceMeta.childLayout`. Absent ⇒ no layout declared. */
50981
51201
  childLayout: array(ChildLayoutEntrySchema).readonly().optional(),
51202
+ /** The children a container stands for, most preferred first, by accessory
51203
+ * `childKey`. Provider-declared. See `DeviceMeta.primaryChildPreference`. */
51204
+ primaryChildPreference: array(string()).readonly().optional(),
50982
51205
  /** Operator-authored per-device display override. See `DeviceMeta.display`. */
50983
51206
  display: DeviceDisplayOverrideSchema.optional()
50984
51207
  });
@@ -51127,6 +51350,9 @@ var DeviceMetaSchema = object({
51127
51350
  * accordion sections (with optional intra-section order). See
51128
51351
  * `DeviceMeta.childLayout`. Absent ⇒ no layout declared. */
51129
51352
  childLayout: array(ChildLayoutEntrySchema).readonly().optional(),
51353
+ /** The children a container stands for, most preferred first, by accessory
51354
+ * `childKey`. Provider-declared. See `DeviceMeta.primaryChildPreference`. */
51355
+ primaryChildPreference: array(string()).readonly().optional(),
51130
51356
  /** Semantic role string (`DeviceRole`) — propagated from the spawn pre-seed.
51131
51357
  * Optional: only present for accessory children that carry a known role. */
51132
51358
  role: string().nullable().optional(),
@@ -51342,6 +51568,12 @@ method(object({
51342
51568
  }), _void(), {
51343
51569
  kind: "mutation",
51344
51570
  auth: "admin"
51571
+ }), method(object({
51572
+ deviceId: number$1(),
51573
+ primaryChildPreference: array(string()).readonly()
51574
+ }), _void(), {
51575
+ kind: "mutation",
51576
+ auth: "admin"
51345
51577
  }), method(object({
51346
51578
  deviceId: number$1(),
51347
51579
  display: DeviceDisplayOverrideSchema.nullable()
@@ -51479,7 +51711,7 @@ method(object({
51479
51711
  * it answers today and the caller filters as it already does.
51480
51712
  */
51481
51713
  deviceIds: array(number$1()).optional()
51482
- }), array(DeviceInfoSchema), { role: "viewer" }), method(object({ deviceId: number$1() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number$1() }), array(DeviceInfoSchema), { role: "viewer" }), method(object({ parentDeviceIds: array(number$1()).max(256) }), record(string(), array(DeviceInfoSchema))), method(object({ deviceId: number$1() }), object({
51714
+ }), array(DeviceInfoSchema), { role: "viewer" }), method(DeviceSearchInputSchema, DeviceSearchResultSchema, { role: "viewer" }), method(object({ deviceId: number$1() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number$1() }), array(DeviceInfoSchema), { role: "viewer" }), method(object({ parentDeviceIds: array(number$1()).max(256) }), record(string(), array(DeviceInfoSchema))), method(object({ deviceId: number$1() }), object({
51483
51715
  mode: LinkedDevicesModeSchema,
51484
51716
  devices: array(LinkedDeviceSchema)
51485
51717
  }), { role: "viewer" }), method(object({ deviceIds: array(number$1()) }), array(LinkedDevicesForDeviceSchema), { role: "viewer" }), method(object({ deviceId: number$1() }), array(StreamSourceEntrySchema$1)), method(object({ deviceId: number$1() }), array(ConfigEntrySchema)), method(object({ deviceId: number$1() }), ConfigUISchemaOutput), method(object({
@@ -54564,6 +54796,8 @@ var HeroPillSchema = object({
54564
54796
  });
54565
54797
  var HeroRowSchema = object({
54566
54798
  id: HeroRowIdSchema,
54799
+ /** `scene`: the row's action and slider controls are drawn on the scene. Absent: an ordinary row. */
54800
+ placement: _enum(["row", "scene"]).optional(),
54567
54801
  /** The row's own name when the kind's label would not tell rows of one kind apart (a circuit's label). */
54568
54802
  label: HeroTextSchema.optional(),
54569
54803
  /** A group header drawn above the row when it differs from the previous row's ("System"). */
@@ -65504,13 +65738,23 @@ var NcRuleTargetSchema = object({
65504
65738
  */
65505
65739
  params: record(string(), unknown()).optional()
65506
65740
  });
65741
+ /** Which picture kind one target receives (#487). */
65742
+ var NcTargetAttachmentSchema = _enum([
65743
+ "none",
65744
+ "image",
65745
+ "clip",
65746
+ "gif"
65747
+ ]);
65507
65748
  var NcTargetOverrideSchema = object({
65508
65749
  template: object({
65509
65750
  title: string().max(500).optional(),
65510
65751
  body: string().max(2e3).optional()
65511
65752
  }).optional(),
65512
65753
  schedule: NcScheduleSchema.optional(),
65513
- priority: number$1().int().min(1).max(5).optional()
65754
+ priority: number$1().int().min(1).max(5).optional(),
65755
+ attachment: NcTargetAttachmentSchema.optional(),
65756
+ /** `false` = no buttons for this target; `true` is the same as absent. */
65757
+ actions: boolean().optional()
65514
65758
  });
65515
65759
  /** Per-target settings keyed by target id (#487). */
65516
65760
  var NcTargetOverridesSchema = record(string(), NcTargetOverrideSchema);
@@ -69189,15 +69433,15 @@ object({
69189
69433
  });
69190
69434
  DeviceType.Gateway, DeviceType.Hub, DeviceType.Camera, DeviceType.Sensor, DeviceType.MediaPlayer, DeviceType.Vacuum, DeviceType.Generic, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.PetFountain, DeviceType.Fan, DeviceType.Humidifier, DeviceType.Climate, DeviceType.WaterHeater;
69191
69435
  var deviceInput$1 = object({ deviceId: number$1().int().nonnegative() });
69192
- systemMethod(deviceInput$1, PowerSourceInfoSchema, { auth: "admin" }), systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
69436
+ systemMethod(deviceInput$1, PowerSourceInfoSchema, { auth: "protected" }), systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
69193
69437
  kind: "mutation",
69194
- auth: "admin"
69438
+ auth: "protected"
69195
69439
  }), systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
69196
69440
  kind: "mutation",
69197
- auth: "admin"
69441
+ auth: "protected"
69198
69442
  }), systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
69199
69443
  kind: "mutation",
69200
- auth: "admin"
69444
+ auth: "protected"
69201
69445
  });
69202
69446
  /**
69203
69447
  * Presence cap. Models HA `person.*` and `device_tracker.*` entities
@@ -81081,6 +81325,27 @@ Object.freeze({
81081
81325
  access: "create",
81082
81326
  role: "viewer"
81083
81327
  },
81328
+ "clusterUpdate.getClusterUpdateJob": {
81329
+ capName: "cluster-update",
81330
+ capScope: "system",
81331
+ addonId: null,
81332
+ access: "view",
81333
+ role: "admin"
81334
+ },
81335
+ "clusterUpdate.previewClusterUpdate": {
81336
+ capName: "cluster-update",
81337
+ capScope: "system",
81338
+ addonId: null,
81339
+ access: "view",
81340
+ role: "admin"
81341
+ },
81342
+ "clusterUpdate.startClusterUpdate": {
81343
+ capName: "cluster-update",
81344
+ capScope: "system",
81345
+ addonId: null,
81346
+ access: "create",
81347
+ role: "admin"
81348
+ },
81084
81349
  "color.getStatus": {
81085
81350
  capName: "color",
81086
81351
  capScope: "device",
@@ -82453,6 +82718,13 @@ Object.freeze({
82453
82718
  access: "create",
82454
82719
  role: "admin"
82455
82720
  },
82721
+ "deviceManager.search": {
82722
+ capName: "device-manager",
82723
+ capScope: "system",
82724
+ addonId: null,
82725
+ access: "view",
82726
+ role: "viewer"
82727
+ },
82456
82728
  "deviceManager.setAlias": {
82457
82729
  capName: "device-manager",
82458
82730
  capScope: "system",
@@ -82544,6 +82816,13 @@ Object.freeze({
82544
82816
  access: "create",
82545
82817
  role: "admin"
82546
82818
  },
82819
+ "deviceManager.setPrimaryChildPreference": {
82820
+ capName: "device-manager",
82821
+ capScope: "system",
82822
+ addonId: null,
82823
+ access: "create",
82824
+ role: "admin"
82825
+ },
82547
82826
  "deviceManager.setRole": {
82548
82827
  capName: "device-manager",
82549
82828
  capScope: "system",
@@ -87183,28 +87462,28 @@ Object.freeze({
87183
87462
  capScope: "device",
87184
87463
  addonId: null,
87185
87464
  access: "create",
87186
- role: "admin"
87465
+ role: "viewer"
87187
87466
  },
87188
87467
  "powerSource.getStatus": {
87189
87468
  capName: "power-source",
87190
87469
  capScope: "device",
87191
87470
  addonId: null,
87192
87471
  access: "view",
87193
- role: "admin"
87472
+ role: "viewer"
87194
87473
  },
87195
87474
  "powerSource.powerOff": {
87196
87475
  capName: "power-source",
87197
87476
  capScope: "device",
87198
87477
  addonId: null,
87199
87478
  access: "create",
87200
- role: "admin"
87479
+ role: "viewer"
87201
87480
  },
87202
87481
  "powerSource.powerOn": {
87203
87482
  capName: "power-source",
87204
87483
  capScope: "device",
87205
87484
  addonId: null,
87206
87485
  access: "create",
87207
- role: "admin"
87486
+ role: "viewer"
87208
87487
  },
87209
87488
  "presence.getStatus": {
87210
87489
  capName: "presence",
@@ -91068,6 +91347,11 @@ Object.freeze({
91068
91347
  form: "single",
91069
91348
  optional: false
91070
91349
  }],
91350
+ "deviceManager.setPrimaryChildPreference": [{
91351
+ name: "deviceId",
91352
+ form: "single",
91353
+ optional: false
91354
+ }],
91071
91355
  "deviceManager.setRole": [{
91072
91356
  name: "deviceId",
91073
91357
  form: "single",
@@ -94536,7 +94820,9 @@ var TimelapseRuleInputSchema = object({
94536
94820
  /** Classes the notification counts — see {@link ReportClassesField}. */
94537
94821
  reportClasses: ReportClassesField.optional(),
94538
94822
  /** Canonical notification priority ordinal (1..5); per-target overridable. */
94539
- priority: PriorityField.default(3)
94823
+ priority: PriorityField.default(3),
94824
+ /** Per-target settings keyed by target id (D1032) — absent = every target follows the rule. */
94825
+ targetOverrides: NcTargetOverridesSchema.optional()
94540
94826
  });
94541
94827
  object({
94542
94828
  name: NameField.optional(),
@@ -94552,7 +94838,9 @@ object({
94552
94838
  previewText: PreviewTextField.optional(),
94553
94839
  previewMode: PreviewModeField.optional(),
94554
94840
  reportClasses: ReportClassesField.optional(),
94555
- priority: PriorityField.optional()
94841
+ priority: PriorityField.optional(),
94842
+ /** Per-target settings keyed by target id (D1032) — absent = every target follows the rule. */
94843
+ targetOverrides: NcTargetOverridesSchema.optional()
94556
94844
  });
94557
94845
  TimelapseRuleInputSchema.extend({
94558
94846
  id: string(),
@@ -94805,7 +95093,7 @@ var AdminUIAddon = class extends BaseAddon {
94805
95093
  capability: adminUiCapability,
94806
95094
  provider: {
94807
95095
  getStaticDir: async () => ({ staticDir: resolveAdminUiDistDir() }),
94808
- getVersion: async () => ({ version: "1.2.634" })
95096
+ getVersion: async () => ({ version: "1.2.635" })
94809
95097
  }
94810
95098
  }];
94811
95099
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-admin-ui",
3
- "version": "1.2.634",
3
+ "version": "1.2.635",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Admin UI — Vite frontend build and server-side addon",
@@ -50,7 +50,7 @@
50
50
  }
51
51
  ],
52
52
  "requires": {
53
- "server": ">=1.2.827"
53
+ "server": ">=1.2.829"
54
54
  }
55
55
  },
56
56
  "scripts": {
@@ -1,5 +0,0 @@
1
- import{B as e,C as t,J as n,K as r,R as i,S as a,V as o,Y as s,et as c,o as l,x as u}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Bt as d,En as f,Hi as p,Kt as m,Ni as h,On as g,Q as _,Ri as v,St as y,Ti as b,Tr as x,Vi as S,Wn as C,Yt as w,ct as ee,hn as T,kn as te,li as E,ot as ne,rr as re,ut as D,zn as O}from"./player-overlays-D2iM_dnq.js";import{Hs as k}from"./client-BT1qTuWk.js";import{a as A,p as ie}from"./video-DFWp1_fo.js";import{$c as ae,Bf as oe,Ca as se,Da as ce,Dn as le,En as ue,Gr as de,Ii as fe,Jr as pe,Kr as me,Lf as j,Oa as M,Oi as N,Pt as he,Sa as P,Ta as F,Wr as ge,Wt as I,Xr as L,Yr as _e,_a as ve,aa as R,ba as ye,ca as z,da as B,dr as be,fa as V,fr as H,ga as U,hr as xe,ka as Se,la as W,ma as G,mf as Ce,pa as we,pr as K,sa as Te,sc as Ee,ua as De,ur as Oe,va as ke,wa as Ae,ya as je}from"./src-Djs5D3BM.js";import{t as q}from"./useTranslation-BJr-n0es.js";import"./mount-DxRFIJt2.js";import{Hr as Me,Rr as J,Wr as Ne}from"./index-BtIAcMod.js";import{t as Y}from"./AdminPage-CPPoleZA.js";import{i as Pe,r as Fe,t as Ie}from"./addon-kind-filter-CEGKkC1O.js";import{t as Le}from"./framework-packages-DoBKjjer.js";import{t as X}from"./NodeAddonsSettingsPanel-BleYmajR.js";import{n as Re,t as ze}from"./useNodeUrlSelection-B4V72DKj.js";function Be(e){if(e===void 0)return null;switch(e.state){case`failed`:case`refused`:case`missing`:case`crashed`:return{kind:e.state,...e.reason===void 0?{}:{reason:e.reason}};default:return null}}c();var Z={queued:{icon:b,bg:`bg-muted text-foreground-subtle`,labelKey:`addons.addonRowBadge.queued`},updating:{icon:x,bg:`bg-primary/10 text-primary`,labelKey:`addons.addonRowBadge.updating`,spin:!0},"done-pending-restart":{icon:O,bg:`bg-amber-500/10 text-amber-700`,labelKey:`addons.addonRowBadge.pendingRestart`},done:{icon:p,bg:`bg-success/10 text-success`,labelKey:`addons.addonRowBadge.done`},failed:{icon:A,bg:`bg-danger/10 text-danger`,labelKey:`addons.addonRowBadge.failed`}};function Q({item:e}){let{t:n}=q(),r=Z[e.status],i=r.icon;return t(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded ${r.bg}`,title:e.error,children:[a(i,{className:`w-2.5 h-2.5 ${r.spin?`animate-spin`:``}`}),n(r.labelKey)]})}var Ve=new Set([`completed`,`failed`,`partially-failed`,`cancelled`]),He=new Set([`done`,`failed`,`skipped`]);function Ue(e){return!He.has(e.phase)&&!Ve.has(e.jobState)}function We(e,t){let n=new Map,r=[...e].sort((e,t)=>e.createdAtMs-t.createdAtMs);for(let e of r){let r=Ve.has(e.state);for(let i of e.tasks)r&&i.finishedAtMs!==null&&t-i.finishedAtMs>6e4||n.set(i.packageName,{jobId:e.jobId,packageName:i.packageName,phase:i.phase,fromVersion:i.fromVersion,toVersion:i.toVersion,error:i.error,jobState:e.state,finishedAtMs:i.finishedAtMs})}return n}function Ge(){let{data:e}=ve({activeOnly:!0},{refetchOnWindowFocus:!1,refetchInterval:e=>(e.state.data?.length??0)>0?3e3:!1}),{map:t}=oe(k.AddonsJobProgress,e=>e.job.jobId);return r(()=>{let n=new Map;for(let t of e??[])n.set(t.jobId,t);for(let[e,r]of t)n.set(e,r.job);return We([...n.values()],Date.now())},[e,t])}var Ke={queued:{icon:b,cls:`bg-muted text-foreground-subtle`,labelKey:`addons.jobProgress.queued`},fetching:{icon:x,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.fetching`,spin:!0},staged:{icon:x,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.staged`,spin:!0},validating:{icon:x,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.validating`,spin:!0},applying:{icon:x,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.applying`,spin:!0},restarting:{icon:x,cls:`bg-amber-500/10 text-amber-600 dark:text-amber-400`,labelKey:`addons.jobProgress.restarting`,spin:!0},applied:{icon:x,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.finalizing`,spin:!0},done:{icon:p,cls:`bg-success/10 text-success`,labelKey:`addons.jobProgress.updated`},failed:{icon:A,cls:`bg-danger/10 text-danger`,labelKey:`addons.jobProgress.failed`},skipped:{icon:T,cls:`bg-muted text-foreground-subtle`,labelKey:`addons.jobProgress.skipped`}};function qe({progress:e}){let{t:n}=q(),r=Ke[e.phase],i=r.icon,o=e.error??`${e.packageName}: ${e.fromVersion??`?`} → ${e.toVersion}`;return t(`span`,{"data-testid":`addon-job-progress`,className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded shrink-0 ${r.cls}`,title:o,children:[a(i,{className:`w-2.5 h-2.5 ${r.spin?`animate-spin`:``}`}),n(r.labelKey),t(`span`,{className:`font-mono`,children:[`→ `,e.toVersion]})]})}function Je(e,t){return e.filter(e=>e.packageName===t).slice().sort((e,t)=>e.isHub===t.isHub?e.nodeName.localeCompare(t.nodeName):e.isHub?-1:1)}function Ye(e){let t=e.version===null?``:` ${e.version}`,n=e.isOnline?``:` (offline: removed when it reconnects)`;return`- ${e.nodeName}${t}${n}`}function Xe(e,t,n){let r=[`${e} will be uninstalled from ${t.length} node(s). Its runners stop, its capabilities are deregistered and its code is deleted:`,...t.map(Ye)];return n.length>0&&r.push(`Could not ask: ${n.join(`, `)} — not included.`),r.push(`This cannot be undone.`),r.join(`
2
- `)}function Ze(e,t,n){let r=[`${e} will be uninstalled from ${t}: its runners stop and its code is deleted.`];return n.length>0&&r.push(`It stays installed on: ${n.map(e=>e.nodeName).join(`, `)}. Use "Everywhere" to remove it from every node.`),r.push(`This cannot be undone.`),r.join(`
3
- `)}var Qe={uninstalled:`uninstalled`,"not-installed":`was not installed`,refused:`REFUSED`,failed:`FAILED`,"pending-reconnect":`offline — removed when it reconnects`};function $e(e,t){let n=[];for(let r of e.results){let e=r.runnersStopped.length>0?` (stopped ${r.runnersStopped.join(`, `)})`:``;n.push(`${t(r.nodeId)}: ${Qe[r.outcome]}${e}`),r.error!==void 0&&n.push(` ${r.error}`);for(let e of r.warnings)n.push(` ${e}`)}return n.join(`
4
- `)}var et={},tt=3e4,nt=`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border border-border text-foreground-subtle hover:text-red-400 hover:border-red-500/30 hover:bg-red-500/10 disabled:opacity-50 transition-colors`;function rt({packageName:e,displayName:n,selectedNode:r,hideNodeAction:i,disabled:o}){let{t:s}=q(),c=l(),u=ee(),d=ne(),f=U(et,{staleTime:tt}),p=f.data?.installations??[],m=(f.data?.unreachable??[]).map(e=>e.nodeId),h=Je(p,e),g=e=>h.find(t=>t.nodeId===e)?.nodeName??(e===r.id?r.name:e),_=M({onSettled:()=>{c.invalidateQueries({queryKey:[[`addons`]]}),c.invalidateQueries({queryKey:[[`addonPages`]]}),c.invalidateQueries({queryKey:[[`capabilities`]]}),c.invalidateQueries({queryKey:[[`nodes`]]})}}),v=async e=>{await d({title:e.success?s(`addons.addonUninstallControls.uninstalled`,`{{displayName}} uninstalled`,{displayName:n}):s(`addons.addonUninstallControls.notEveryNodeWasCleaned`,`{{displayName}}: not every node was cleaned`,{displayName:n}),message:$e(e,g),variant:e.success?`default`:`danger`})},y=async t=>{try{await v(await _.mutateAsync({packageName:e,...t}))}catch(e){await d({title:s(`addons.addonUninstallControls.uninstallFailed`,`Uninstall {{displayName}} failed`,{displayName:n}),message:e instanceof Error?e.message:String(e),variant:`danger`})}},b=async()=>{let e=h.filter(e=>e.nodeId!==r.id);await u({title:s(`addons.addonUninstallControls.uninstallFrom`,`Uninstall {{displayName}} from {{name}}?`,{displayName:n,name:r.name}),message:Ze(n,r.name,e),confirmLabel:s(`addons.addonUninstallControls.uninstall`,`Uninstall`),variant:`danger`})&&await y(r.isHub?{}:{nodeId:r.id})},x=async()=>{let t=(await f.refetch()).data;if(t===void 0){await d({title:s(`addons.addonUninstallControls.cannotListTheNodes`,`Cannot list the nodes`),message:s(`addons.addonUninstallControls.theHubDidNotAnswer`,`The hub did not answer which nodes have this package — nothing was removed.`),variant:`danger`});return}let r=Je(t.installations,e);await u({title:s(`addons.addonUninstallControls.uninstallEverywhere`,`Uninstall {{displayName}} everywhere?`,{displayName:n}),message:Xe(n,r,t.unreachable.map(e=>e.nodeId)),confirmLabel:s(`addons.addonUninstallControls.uninstallFromNodeS`,`Uninstall from {{length}} node(s)`,{length:r.length}),variant:`danger`})&&await y({everywhere:!0})},S=_.isPending||o===!0;return t(`div`,{className:`flex items-center gap-1.5`,children:[i!==!0&&t(N,{variant:`unstyled`,type:`button`,onClick:e=>{e.stopPropagation(),b()},disabled:S,className:nt,title:s(`addons.addonUninstallControls.uninstallFrom2`,`Uninstall from {{name}}`,{name:r.name}),children:[a(w,{className:`h-3 w-3`}),_.isPending?s(`addons.addonUninstallControls.removing`,`Removing...`):s(`addons.addonUninstallControls.uninstall`,`Uninstall`)]}),(h.length>1||i===!0||m.length>0)&&t(N,{variant:`unstyled`,type:`button`,onClick:e=>{e.stopPropagation(),x()},disabled:S,className:nt,title:s(`addons.addonUninstallControls.uninstallFromEveryNodeThat`,`Uninstall from every node that has it`),children:[a(ie,{className:`h-3 w-3`}),h.length>0?s(`addons.uninstallControls.everywhereCount`,{count:h.length}):s(`addons.uninstallControls.everywhere`)]})]})}function it(e){return typeof e.deprecated==`string`&&e.deprecated.length>0}function at(e,t){return t?e:e.filter(e=>e.distTags.includes(`latest`)||!it(e))}function ot(e){return e.length-at(e,!1).length}c();function st({packageName:e,currentVersion:n,installSource:r,onInstall:i,onClose:o,onSelect:c,selectedVersion:l}){let{t:f}=q(),m=r===`upload`||r===`local`,[h,g]=s(!1),{data:_,isLoading:v,isError:b}=V({name:e}),S=_?at(_,h):[],C=_?ot(_):0;return t(`div`,{className:`fixed z-50 w-72 rounded-lg border border-border bg-surface shadow-xl overflow-hidden`,style:{top:`auto`,bottom:`auto`},ref:e=>{if(!e)return;let t=e.parentElement?.getBoundingClientRect();if(!t)return;let n=window.innerHeight-t.bottom,r=t.top;n<280&&r>n?(e.style.bottom=`${window.innerHeight-t.top+4}px`,e.style.top=`auto`):(e.style.top=`${t.bottom+4}px`,e.style.bottom=`auto`),e.style.right=`${window.innerWidth-t.right}px`},onClick:e=>e.stopPropagation(),children:[t(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border`,children:[a(`span`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle font-medium`,children:f(`addons.versionPicker.versions`,`Versions`)}),a(N,{variant:`unstyled`,type:`button`,onClick:o,className:`text-foreground-subtle hover:text-foreground`,children:a(y,{className:`h-3 w-3`})})]}),m&&t(`div`,{className:`flex items-start gap-2 px-3 py-2 border-b border-border bg-cyan-500/10 text-[10px]`,children:[a(d,{className:`h-3 w-3 mt-0.5 text-cyan-500 shrink-0`}),t(`div`,{className:`text-cyan-700 dark:text-cyan-200`,children:[a(`span`,{className:`font-semibold`,children:f(`addons.versionPicker.inPlace`,{kind:r===`upload`?f(`addons.versionPicker.uploadedCopy`,`Uploaded copy`):f(`addons.versionPicker.localCopy`,`Local copy`)})}),` `,a(J,{i18nKey:`addons.versionPicker.reinstall`,values:{version:n},components:{mono:a(`span`,{className:`font-mono`})}})]})]}),v&&t(`div`,{className:`flex items-center justify-center gap-2 py-6 text-[10px] text-foreground-subtle`,children:[a(x,{className:`h-3.5 w-3.5 animate-spin`}),f(`addons.versionPicker.loadingVersions`,`Loading versions...`)]}),b&&a(`div`,{className:`px-3 py-4 text-center text-[10px] text-danger`,children:f(`addons.versionPicker.registryError`,`Could not load versions from the registry.`)}),S.length>0&&a(`div`,{className:`max-h-64 overflow-auto divide-y divide-border`,children:S.map(e=>{let r=e.version===n,o=c!==void 0&&e.version===l,s=/-(alpha|beta|rc|dev|canary|next)/i.test(e.version),d=t(u,{children:[a(`span`,{className:`font-mono flex-1 text-left ${r?`text-primary font-semibold`:s?`text-amber-400`:`text-foreground`}`,children:e.version}),r&&a(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium bg-primary/10 text-primary`,children:f(`common.current`)}),e.distTags.map(e=>a(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium ${e===`latest`?`bg-emerald-500/15 text-emerald-400`:e===`beta`?`bg-amber-500/15 text-amber-400`:`bg-gray-500/15 text-gray-400`}`,children:e},e)),it(e)&&a(`span`,{className:`text-[9px] text-red-400 line-through`,children:f(`common.deprecated`)}),a(`span`,{className:`text-[9px] text-foreground-subtle shrink-0`,children:new Date(e.publishedAt).toLocaleDateString()})]});return c?t(N,{variant:`unstyled`,type:`button`,"aria-label":f(`addons.versionPicker.select`,`Select {{version}}`,{version:e.version}),onClick:()=>c(e.version),className:`w-full flex items-center gap-2 px-3 py-2 text-[11px] ${o?`bg-primary/5`:`hover:bg-surface-hover`} transition-colors`,children:[d,o?a(p,{className:`h-3 w-3 text-primary shrink-0`}):a(`span`,{className:`w-3 shrink-0`})]},e.version):t(`div`,{className:`flex items-center gap-2 px-3 py-2 text-[11px] ${r?`bg-primary/5`:`hover:bg-surface-hover`} transition-colors`,children:[d,a(N,{variant:`unstyled`,type:`button`,onClick:()=>i(e.version),className:`shrink-0 rounded p-0.5 hover:bg-primary/20 text-foreground-subtle hover:text-primary transition-colors`,title:r?f(`addons.versionPicker.reInstallFromNpm`,`Re-install {{version}} from npm`,{version:e.version}):f(`addons.versionPicker.install`,`Install {{version}}`,{version:e.version}),children:a(E,{className:`h-3 w-3`})})]},e.version)})}),!v&&!b&&_&&_.length===0&&a(`div`,{className:`py-4 text-center text-[10px] text-foreground-subtle`,children:f(`addons.versionPicker.noVersionsFound`,`No versions found`)}),C>0&&a(N,{type:`button`,variant:`ghost`,size:`sm`,className:`h-auto w-full justify-start rounded-none border-t border-border px-3 py-2 text-left text-[10px] font-normal text-foreground-subtle`,onClick:()=>g(e=>!e),children:h?f(`addons.versionPicker.hideOlder`,`Hide older versions`):f(`addons.versionPicker.showOlder`,`Show older versions ({{count}})`,{count:C})})]})}c();var ct=`device-export`;function lt(e){return e.capabilities.some(e=>(typeof e==`string`?e:e.name)===ct)}function ut(e){return e!==`local`&&e!==`upload`}function dt({isBundle:e,installSource:n,addonId:r,iconPath:i,color:o}){let[c,l]=s(!1),u=o?{backgroundColor:`${o.startsWith(`#`)?o:`#${o}`}26`}:void 0,f=e?`bg-indigo-500/20 text-indigo-700 dark:text-indigo-300`:`bg-purple-500/20 text-purple-700 dark:text-purple-300`,p=r&&i?_(`/api/addon-assets/${r}/${i}`):null,m=!!p&&!c;return t(`div`,{className:`relative flex-shrink-0`,children:[a(`div`,{className:`h-8 w-8 rounded-md flex items-center justify-center ${u?``:f}`,style:u,children:m?a(`img`,{src:p,alt:r,className:`h-4 w-4`,onError:()=>l(!0)}):a(e?re:C,{className:`h-3.5 w-3.5`})}),n===`local`&&a(`span`,{className:`absolute -top-1.5 -left-1.5 text-[7px] font-bold leading-none bg-orange-500 text-white px-1 py-0.5 rounded -rotate-12 shadow-sm`,children:`DEV`}),ut(n)&&a(`span`,{className:`absolute -top-1 -left-1 w-4 h-4 rounded bg-[#cb3837] flex items-center justify-center -rotate-12 shadow-sm`,children:a(`svg`,{viewBox:`0 0 780 250`,className:`w-[11px] h-[11px]`,children:a(`path`,{fill:`#fff`,d:`M240 250h100V50h100v200h340V0H0v250z`})})}),n===`upload`&&a(`span`,{className:`absolute -top-1.5 -left-1.5 flex items-center justify-center h-4 w-4 rounded bg-cyan-500 -rotate-12 shadow-sm`,children:a(d,{className:`h-2.5 w-2.5 text-white`})})]})}function ft({version:e,availableUpdate:n,selectedVersion:r,isUpdating:i,installSource:o,disabled:s,onUpdate:c,onOpenPicker:l,children:u}){let{t:d}=q();if(i)return t(`span`,{className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-medium border border-blue-500/30 bg-blue-500/10 text-blue-400 shrink-0`,children:[a(x,{className:`h-3 w-3 animate-spin`}),d(`addons.addonCard.updating`,`Updating…`)]});if(n){let i=r??n;return t(`div`,{className:`relative inline-flex items-center gap-1 shrink-0`,children:[c&&t(N,{variant:`unstyled`,type:`button`,onClick:e=>{e.stopPropagation(),c()},disabled:s,className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-semibold border border-blue-500/30 bg-blue-500/10 text-blue-400 hover:bg-blue-500/20 disabled:opacity-50 disabled:cursor-not-allowed transition-colors`,title:d(`addons.addonCard.updateTo`,`Update to {{target}}`,{target:i}),children:[a(E,{className:`h-3 w-3`}),d(`addons.addonCard.update`,`Update`)]}),t(N,{variant:`unstyled`,type:`button`,onClick:e=>{e.stopPropagation(),l()},disabled:s,"aria-label":d(`addons.addonCard.selectVersionToInstall`,`Select version to install`),title:d(`addons.addonCard.installedUpdateAvailableSelectedTap`,`Installed {{version}} — update available. Selected {{target}}; tap to choose another version.`,{version:e,target:i}),className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-bold font-mono border border-amber-500/40 bg-amber-500/15 text-amber-500 hover:bg-amber-500/25 animate-pulse disabled:opacity-50 disabled:cursor-not-allowed transition-colors`,children:[a(`span`,{className:`font-normal opacity-70`,children:e}),a(`span`,{className:`font-normal opacity-70`,children:`→`}),i,a(S,{className:`h-3 w-3`})]}),u]})}return t(`div`,{className:`relative inline-flex items-center gap-1 shrink-0`,children:[t(N,{variant:`unstyled`,type:`button`,onClick:e=>{e.stopPropagation(),l()},disabled:s,className:[`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-bold font-mono border transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,o===`local`?`border-orange-500/30 bg-orange-500/10 text-orange-400 hover:bg-orange-500/20`:`border-emerald-500/30 bg-emerald-500/10 text-emerald-400 hover:bg-emerald-500/20`].join(` `),title:d(`addons.addonCard.versionTapToViewAll`,`Version {{version}} — tap to view all versions`,{version:e}),children:[e,a(S,{className:`h-3 w-3 opacity-50`})]}),u]})}function pt({addonId:e}){let t=l(),{data:n=`inherit`}=z({addonId:e}),r=Ae({onSuccess:()=>{t.invalidateQueries({queryKey:[[`addons`,`getAddonAutoUpdate`]]})}});return a(`div`,{className:`flex rounded-lg border border-border overflow-hidden text-[10px] font-medium`,children:[`inherit`,`off`,`latest`,`beta`].map(t=>a(N,{variant:`unstyled`,type:`button`,onClick:n=>{n.stopPropagation(),r.mutate({addonId:e,channel:t})},disabled:r.isPending,className:`px-2.5 py-1 transition-colors capitalize ${n===t?t===`inherit`?`bg-gray-700/50 text-gray-700 dark:text-gray-300`:t===`off`?`bg-gray-700 text-gray-700 dark:text-gray-300`:t===`latest`?`bg-blue-500/20 text-blue-400`:`bg-amber-500/20 text-amber-400`:`bg-transparent text-foreground-subtle hover:bg-surface-hover`} ${t===`inherit`?``:`border-l border-border`}`,children:t},t))})}var mt={id:`hub`,name:`Hub`,isHub:!0};function ht({addon:e,clusterStatus:n,hideVersion:r,availableUpdate:i,blockedUpdate:c,onUpdate:d,isUpdating:p,jobProgress:m,bundle:h,bulkItem:g,disabledByBulk:_,isSystem:b,selectedNode:x}){let{t:C}=q(),[w,ee]=s(!1),[T,E]=s(!1),[ne,D]=s(null);o(()=>{D(null)},[i]);let k=ne??i,[ie,ae]=s(!1),[oe,se]=s(!1),[ce,j]=s(`logs`),M=l(),he=Me(),{manifest:F}=e,ve=!h&&!F.protected&&F.removable!==!1,R=!!h,z=h?.displayName??F.name,B=h?.packageName??F.packageName,be=h?.version??F.packageVersion??F.version,V=h?.installSource??e.installSource,H=h?h.bundle?.description??h.addons[0]?.manifest.description:F.description,U=ye({onSuccess:()=>{M.invalidateQueries({queryKey:[[`addons`]]})}}),xe=we({onSuccess:()=>{M.invalidateQueries({queryKey:[[`addons`]]}),M.invalidateQueries({queryKey:[[`addonPages`]]}),M.invalidateQueries({queryKey:[[`capabilities`]]}),M.invalidateQueries({queryKey:[[`integrations`]]})}}),Se=P({onSuccess:()=>{M.invalidateQueries({queryKey:[[`addons`]]}),M.invalidateQueries({queryKey:[[`alerts`]]})}}),W=e.health,G=W?.phase===`failed`&&!W.inGracePeriod,Ce=G&&W?.nextRetryAt&&!W.retrying,K=Be(e.process);return t(`div`,{className:`rounded-md border bg-surface overflow-hidden ${G?`border-red-500/50`:`border-border`}`,children:[G&&W&&t(`div`,{className:`bg-danger/10 border-b border-danger/30 px-3 py-2 flex items-start gap-2`,children:[a(A,{className:`h-4 w-4 text-danger shrink-0 mt-0.5`}),t(`div`,{className:`flex-1 min-w-0`,children:[a(`div`,{className:`text-xs font-semibold text-danger`,children:C(`addons.addonCard.failedToLoad`,{attempt:W.retryCount})}),a(`div`,{className:`text-[11px] text-foreground mt-0.5 break-words font-mono`,children:W.lastError?.message??C(`addons.addonCard.unknownError`,`Unknown error`)}),Ce&&W.nextRetryAt&&a(`div`,{className:`text-[10px] text-foreground-subtle mt-1`,children:C(`addons.addonCard.autoRetryAt`,{time:new Date(W.nextRetryAt).toLocaleTimeString()})})]}),t(N,{variant:`unstyled`,type:`button`,disabled:Se.isPending||W.retrying,onClick:e=>{e.stopPropagation(),Se.mutate({packageName:B})},className:`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1 text-[11px] font-semibold border border-red-400/40 bg-red-400/10 text-red-700 dark:text-red-300 hover:bg-red-400/20 disabled:opacity-50 disabled:cursor-not-allowed transition-colors shrink-0`,title:C(`addons.addonCard.resetRetryCounterAndForce`,`Reset retry counter and force immediate reload`),children:[a(O,{className:`h-3 w-3 ${Se.isPending||W.retrying?`animate-spin`:``}`}),C(`addons.addonCard.retryNow`,`Retry now`)]})]}),K!==null&&t(`div`,{className:`bg-danger/10 border-b border-danger/30 px-3 py-2 flex items-start gap-2`,children:[a(A,{className:`h-4 w-4 text-danger shrink-0 mt-0.5`}),t(`div`,{className:`flex-1 min-w-0`,children:[a(`div`,{className:`text-xs font-semibold text-danger`,children:C(`addons.addonCard.processProblem.${K.kind}`)}),K.reason!==void 0&&a(`div`,{className:`text-[11px] text-foreground mt-0.5 break-words font-mono`,children:K.reason})]})]}),t(`div`,{className:`flex items-start gap-2.5 px-3 py-2`,children:[a(dt,{isBundle:R||!!F.components&&F.components.length>1,installSource:V,addonId:R?h.addons[0]?.manifest.id:F.id,iconPath:R?h.bundle?.icon??h.addons[0]?.manifest.icon:F.icon,color:R?h.addons[0]?.manifest.color:F.color}),t(`div`,{className:`flex-1 min-w-0`,children:[t(`div`,{className:`flex items-start justify-between gap-2`,children:[a(`span`,{className:`text-xs font-semibold text-foreground truncate min-w-0`,children:z}),!r&&a(ft,{version:be,availableUpdate:i,...k===void 0?{}:{selectedVersion:k},isUpdating:p,installSource:V,disabled:_,...d&&k!==void 0?{onUpdate:()=>d(k)}:{},onOpenPicker:()=>E(e=>!e),children:T&&a(st,{packageName:B,currentVersion:be,...V?{installSource:V}:{},...i!==void 0&&k!==void 0?{selectedVersion:k,onSelect:e=>{D(e),E(!1)}}:{},onInstall:e=>{E(!1),xe.mutate({packageName:B,version:e})},onClose:()=>E(!1)})})]}),t(`div`,{className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 mt-0.5`,children:[B!==z&&a(`span`,{className:`text-[10px] text-foreground-subtle font-mono truncate max-w-full`,children:B}),R&&t(`span`,{className:`text-[10px] rounded-full bg-primary/10 text-primary px-2 py-0.5 font-medium shrink-0 inline-flex items-center gap-1`,children:[a(re,{className:`h-3 w-3`}),h.addons.length]}),b&&t(`span`,{className:`text-[10px] rounded-full bg-amber-500/15 text-amber-700 dark:text-amber-300 px-2 py-0.5 font-medium shrink-0 inline-flex items-center gap-1`,title:C(`addons.addonCard.systemPackageUpdatingRestartsThe`,`System package — updating restarts the hub`),children:[a(O,{className:`h-3 w-3`}),C(`addons.addonCard.system`,`System`)]}),g!=null&&a(Q,{item:g}),c!==void 0&&a(fe,{variant:`warning`,title:C(`addons.addonCard.updateHeldTitle`,{defaultValue:`{{latest}} is held until the server is {{required}} or newer`,latest:c.latestVersion,required:c.requiredServer}),children:C(`addons.addonCard.requiresServer`,{defaultValue:`requires server ≥ {{version}}`,version:c.requiredServer})}),m!=null&&a(qe,{progress:m})]}),H&&a(`p`,{className:`text-[10px] text-foreground-subtle mt-1 line-clamp-1`,children:H}),!R&&e.process&&t(`div`,{className:`flex flex-wrap items-center gap-1.5 mt-1`,children:[a(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium ${e.process.mode===`forked`?`bg-blue-500/15 text-blue-400`:`bg-gray-500/15 text-gray-400`}`,children:e.process.mode===`forked`?C(`addons.addonCard.forked`):C(`addons.addonCard.inProcess`)}),e.process.pid!=null&&t(`span`,{className:`text-[9px] font-mono text-foreground-subtle`,children:[`PID `,e.process.pid]}),a(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium ${e.process.state===`running`?`bg-emerald-500/15 text-emerald-400`:K===null?`bg-gray-500/15 text-gray-400`:`bg-red-500/15 text-red-400`}`,children:e.process.state})]})]})]}),!R&&t(`div`,{className:`flex items-center gap-1 px-3 py-1 border-t border-border/50 bg-surface-hover/20`,children:[t(N,{variant:`unstyled`,type:`button`,onClick:e=>{e.stopPropagation(),U.mutate({addonId:F.id})},disabled:U.isPending||_,className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-medium border border-border text-foreground-subtle hover:text-blue-400 hover:border-blue-500/30 hover:bg-blue-500/10 disabled:opacity-50 transition-colors`,children:[a(O,{className:`h-3 w-3 ${U.isPending?`animate-spin`:``}`}),C(`addons.addonCard.restart`,`Restart`)]}),t(N,{variant:`unstyled`,type:`button`,onClick:e=>{e.stopPropagation(),ae(e=>!e)},className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-medium border transition-colors ${ie?`border-primary/30 bg-primary/10 text-primary`:`border-border text-foreground-subtle hover:text-foreground hover:border-primary/30 hover:bg-primary/10`}`,children:[a(te,{className:`h-3 w-3`}),C(`addons.addonCard.logs`,`Logs`)]}),!R&&t(N,{variant:`unstyled`,type:`button`,onClick:e=>{e.stopPropagation(),se(!0)},className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-medium border transition-colors ${oe?`border-primary/30 bg-primary/10 text-primary`:`border-border text-foreground-subtle hover:text-foreground hover:border-primary/30 hover:bg-primary/10`}`,children:[a(f,{className:`h-3 w-3`}),C(`addons.addonCard.settings`,`Settings`)]}),a(`div`,{className:`flex-1`}),ve&&a(rt,{packageName:F.packageName,displayName:F.name,selectedNode:x??mt,disabled:_})]}),n&&n.nodes.length>1&&!R&&t(`div`,{className:`border-t border-border px-3 py-1.5 bg-muted/10`,children:[a(`div`,{className:`text-[10px] font-medium text-foreground-subtle mb-1.5`,children:C(`addons.addonCard.clusterDeployment`,`Cluster Deployment`)}),a(`div`,{className:`space-y-1`,children:n.nodes.map(e=>t(`div`,{className:`flex items-center gap-2 text-[10px]`,children:[a(`div`,{className:`h-1.5 w-1.5 rounded-full shrink-0 ${e.status===`offline`?`bg-muted-foreground/30`:e.synced?`bg-success`:`bg-amber-500`}`}),a(`span`,{className:`font-medium text-foreground min-w-[60px]`,children:e.name}),a(`span`,{className:`font-mono text-foreground-subtle`,children:e.version}),!e.synced&&e.status!==`offline`&&a(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-amber-500/10 text-amber-400 border border-amber-500/20`,children:C(`addons.addonCard.outdated`)}),e.status===`offline`&&a(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-muted text-muted-foreground`,children:C(`common.offline`)}),e.synced&&e.status!==`offline`&&a(`span`,{className:`text-[9px] text-success`,children:C(`common.synced`)})]},e.nodeId))})]}),ie&&!R&&t(`div`,{className:`border-t border-border`,children:[t(`div`,{className:`flex items-center px-3 py-0.5 bg-surface-hover/20 border-b border-border/50`,children:[t(`div`,{className:`flex rounded border border-border overflow-hidden text-[9px]`,children:[a(N,{variant:`unstyled`,type:`button`,onClick:()=>j(`logs`),className:`px-2 py-0.5 transition-colors ${ce===`logs`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:C(`addons.addonCard.logs`,`Logs`)}),a(N,{variant:`unstyled`,type:`button`,onClick:()=>j(`events`),className:`px-2 py-0.5 border-l border-border transition-colors ${ce===`events`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:C(`addons.addonCard.events`,`Events`)})]}),a(`div`,{className:`flex-1`}),a(N,{variant:`unstyled`,type:`button`,onClick:e=>{e.stopPropagation(),ae(!1)},className:`text-foreground-subtle hover:text-foreground`,children:a(y,{className:`h-3.5 w-3.5`})})]}),ce===`logs`&&a(le,{addonId:F.id,maxHeight:`max-h-64`,showFilters:!1}),ce===`events`&&a(ue,{addonId:F.id,category:`addon.*`,maxHeight:`max-h-64`})]}),R&&t(u,{children:[a(N,{variant:`unstyled`,type:`button`,onClick:()=>ee(e=>!e),className:`w-full flex items-center justify-center border-t border-border py-1 hover:bg-surface-hover/50 transition-colors`,children:a(w?v:S,{className:`h-3.5 w-3.5 text-foreground-subtle`})}),w&&a(`div`,{className:`border-t border-border px-2.5 py-1.5 space-y-1.5`,children:h.addons.map(e=>a(ht,{addon:e,hideVersion:!0},e.manifest.id))})]}),oe&&!R&&a(ge,{open:!0,onOpenChange:e=>!e&&se(!1),children:t(me,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,children:[a(_e,{children:t(L,{className:`flex items-center gap-2`,children:[a(f,{className:`h-4 w-4 text-primary`}),C(`addons.addonCard.settingsTitle`,{name:z})]})}),t(de,{className:`space-y-4`,children:[a(`div`,{className:`text-[10px] text-foreground-subtle mb-2`,children:C(`addons.addonCard.clusterWideSettingsOneValue`,`Cluster-wide settings — one value for every node. Per-node settings live under Cluster → the node → Settings.`)}),a(X,{nodeId:null,addonIds:[F.id],level:`global`,fieldScope:`cluster`,emptyMessage:C(`addons.addonCard.thisAddonExposesNoCluster`,`This addon exposes no cluster-wide settings. Anything it can configure is per-node — open it from Cluster → the node → Settings.`)}),lt(F)&&t(`div`,{children:[a(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:C(`addons.addonCard.deviceExport`,`Device export`)}),a(I,{addonId:F.id,onOpenDevice:e=>he(`/devices/${e}`)})]}),ut(V)&&t(`div`,{children:[a(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:C(`addons.addonCard.autoUpdate`,`Auto-Update`)}),a(pt,{addonId:F.id})]}),F.components&&F.components.length>0&&t(`div`,{children:[a(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:C(`addons.addonCard.components`,{count:F.components.length})}),a(`div`,{className:`flex flex-wrap gap-1`,children:F.components.map(e=>a(`span`,{className:`text-[10px] rounded bg-background border border-border px-1.5 py-0.5 text-foreground-subtle font-mono`,children:e},e))})]})]}),a(pe,{children:a(N,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>se(!1),children:C(`common.close`,`Close`)})})]})})]})}c();var gt=`.tgz,.tar.gz,.zip`;function _t({onUploadSuccess:e}){let{t:r}=q(),[o,c]=s(!1),l=n(null),f=i(async t=>{c(!0);let n=new FormData;n.append(`file`,t);let r=localStorage.getItem(`camstack_admin_token`)??``;try{(await(await fetch(_(`/api/addons/upload`),{method:`POST`,headers:{Authorization:`Bearer ${r}`},body:n})).json()).success&&e()}finally{c(!1)}},[e]);return t(u,{children:[a(xe,{ref:l,accept:gt,onChange:i(e=>{let t=e.target.files?.[0];t&&f(t),e.target.value=``},[f]),className:`hidden`}),t(N,{variant:`unstyled`,type:`button`,onClick:()=>l.current?.click(),disabled:o,className:`flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-md bg-surface hover:bg-surface-hover border border-border disabled:opacity-50 transition-colors`,children:[o?a(x,{className:`w-3.5 h-3.5 animate-spin`}):a(d,{className:`w-3.5 h-3.5`}),o?r(`addons.addonUploadZone.uploading`,`Uploading...`):r(`addons.addonUploadZone.upload`,`Upload`)]})]})}var vt=/```[^\n]*\n([\s\S]*?)```/g;function yt(e){let t=[],n=0;for(let r of e.matchAll(vt)){let i=r.index??0;i>n&&t.push({kind:`text`,body:e.slice(n,i)}),t.push({kind:`code`,body:r[1]??``}),n=i+r[0].length}return n<e.length&&t.push({kind:`text`,body:e.slice(n)}),t}function bt(e){let t=e.trim();return t.startsWith(`https://`)||t.startsWith(`http://`)?t:null}function xt(e,t){let n=[],r=/(\*\*[^*]+\*\*|`[^`]+`|\[[^\]]+\]\([^)]+\))/g,i=0,o=0;for(let s of e.matchAll(r)){let r=s.index??0;r>i&&n.push(e.slice(i,r));let c=s[0],l=`${t}-${o}`;if(o+=1,c.startsWith(`**`))n.push(a(`strong`,{children:c.slice(2,-2)},l));else if(c.startsWith("`"))n.push(a(`code`,{className:`font-mono text-[0.9em]`,children:c.slice(1,-1)},l));else{let e=/^\[([^\]]+)\]\(([^)]+)\)$/.exec(c),t=e?.[1]??c,r=e?bt(e[2]??``):null;n.push(r?a(`a`,{href:r,target:`_blank`,rel:`noreferrer noopener`,className:`text-primary underline`,children:t},l):a(`span`,{children:t},l))}i=r+c.length}return i<e.length&&n.push(e.slice(i)),n}function St(e,t){let n=e.split(`
5
- `),r=[],i=[],o=[],s=0,c=()=>{if(i.length===0)return;let e=i.join(` `).trim();i=[],e.length!==0&&(r.push(a(`p`,{className:`mb-2 last:mb-0`,children:xt(e,`${t}-p-${s}`)},`${t}-p-${s}`)),s+=1)},l=()=>{if(o.length===0)return;let e=o;o=[],r.push(a(`ul`,{className:`mb-2 list-disc pl-4 last:mb-0`,children:e.map((e,n)=>a(`li`,{children:xt(e,`${t}-li-${s}-${n}`)},`${t}-li-${s}-${n}`))},`${t}-ul-${s}`)),s+=1};for(let e of n){let n=/^(#{1,3})\s+(.*)$/.exec(e),u=/^\s*[-*]\s+(.*)$/.exec(e);if(n){c(),l();let e=n[1]?.length??1,i=xt(n[2]??``,`${t}-h-${s}`),o=e===1?`text-sm font-semibold mb-2`:`text-xs font-semibold mb-1.5 mt-2`;r.push(a(e===1?`h3`:`h4`,{className:o,children:i},`${t}-h-${s}`)),s+=1;continue}if(u){c(),o=[...o,u[1]??``];continue}if(e.trim().length===0){c(),l();continue}l(),i=[...i,e.trim()]}return c(),l(),r}function Ct({markdown:e}){return a(`div`,{className:`text-xs text-foreground leading-relaxed`,children:yt(e).map((e,t)=>e.kind===`code`?a(`pre`,{className:`mb-2 overflow-auto rounded-md bg-surface-hover p-2 font-mono text-[10px] last:mb-0`,children:e.body.replace(/\n$/,``)},`code-${t}`):a(`div`,{children:St(e.body,`b${t}`)},`text-${t}`))})}c();function wt(e){return e.replace(/^@camstack\/(addon-)?/,``)}function Tt(e,t,n){let r=at(e,n);return r.some(e=>e.version===t)?r:[{version:t,distTags:[],deprecated:void 0},...r]}function Et({pending:e,failed:n,body:r,missing:i}){let{t:o}=q();return e?t(`div`,{className:`flex items-center gap-2 py-6 text-xs text-foreground-subtle`,children:[a(x,{className:`h-3.5 w-3.5 animate-spin`}),o(`addons.installDialog.loadingDocument`,`Loading…`)]}):n||r===void 0?a(`p`,{className:`py-4 text-xs text-danger`,children:o(`addons.installDialog.couldNotLoadDocument`,`Could not load this file from the registry.`)}):r.status===`ok`&&r.markdown!==void 0?a(Ct,{markdown:r.markdown}):r.status===`error`?a(`p`,{className:`py-4 text-xs text-danger`,children:o(`addons.installDialog.documentError`,`Could not load this file. {{message}}`,{message:r.message??``})}):a(`p`,{className:`py-4 text-xs text-foreground-subtle`,children:i})}function Dt({target:e,installing:n,installError:r,onClose:i,onInstall:o}){let{t:c}=q(),[l,u]=s(e.version),[d,f]=s(!1),p=V({name:e.name}),m=B({name:e.name,version:l}),h=p.data??[],g=ot(h),_=Tt(h,l,d),v=m.data;return a(ge,{open:!0,onOpenChange:e=>!e&&i(),children:t(me,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,children:[a(_e,{children:a(L,{children:c(`addons.installDialog.title`,`Install {{name}}`,{name:wt(e.name)})})}),t(de,{className:`space-y-3`,children:[a(`p`,{className:`font-mono text-[10px] text-foreground-subtle`,children:e.name}),e.description.length>0&&a(`p`,{className:`text-xs text-foreground`,children:e.description}),t(`div`,{className:`space-y-1.5`,children:[a(`span`,{className:`text-[10px] text-foreground-subtle`,children:c(`addons.installDialog.version`,`Version`)}),a(D,{"aria-label":c(`addons.installDialog.version`,`Version`),value:l,options:_.map(e=>({value:e.version,label:it(e)?c(`addons.installDialog.deprecatedVersion`,`{{version}} (deprecated)`,{version:e.version}):e.version})),onChange:e=>u(e.target.value)}),p.isError&&a(`p`,{className:`text-[10px] text-danger`,children:c(`addons.versionPicker.registryError`,`Could not load versions from the registry.`)}),g>0&&a(N,{type:`button`,variant:`ghost`,size:`sm`,className:`h-auto justify-start px-0 text-[10px] font-normal text-foreground-subtle underline`,onClick:()=>f(e=>!e),children:d?c(`addons.versionPicker.hideOlder`,`Hide older versions`):c(`addons.versionPicker.showOlder`,`Show older versions ({{count}})`,{count:g})})]}),t(Oe,{defaultValue:`readme`,children:[t(H,{children:[a(K,{value:`readme`,children:c(`addons.installDialog.readme`,`README`)}),a(K,{value:`changelog`,children:c(`addons.installDialog.changelog`,`CHANGELOG`)})]}),a(be,{value:`readme`,children:a(`div`,{className:`max-h-80 overflow-auto rounded-md border border-border bg-background p-3`,children:a(Et,{pending:m.isPending,failed:m.isError,body:v?.readme,missing:c(`addons.installDialog.missingReadme`,`This package has no README.`)})})}),a(be,{value:`changelog`,children:a(`div`,{className:`max-h-80 overflow-auto rounded-md border border-border bg-background p-3`,children:a(Et,{pending:m.isPending,failed:m.isError,body:v?.changelog,missing:c(`addons.installDialog.missingChangelog`,`This package has no CHANGELOG.`)})})})]}),r!=null&&r.length>0&&a(`p`,{className:`text-xs text-danger`,children:r})]}),t(pe,{children:[a(N,{type:`button`,variant:`outline`,size:`sm`,onClick:i,children:c(`common.cancel`,`Cancel`)}),a(N,{type:`button`,size:`sm`,disabled:n||l.length===0,onClick:()=>o(e.name,l),children:n?a(x,{className:`h-3.5 w-3.5 animate-spin`}):c(`addons.installDialog.install`,`Install`)})]})]})})}var Ot=new Set([`@camstack/server`,`@camstack/types`,`@camstack/sdk`,`@camstack/ui-library`,`@camstack/addon-agent-ui`]);function kt(e,t){let n=new Map;for(let r of e){if(r.isHub||r.onHub||Ot.has(r.packageName)||!t.isHub&&r.nodeId!==t.id)continue;let e=n.get(r.packageName)??[];e.push(r),n.set(r.packageName,e)}return[...n].map(([e,t])=>({packageName:e,rows:t})).sort((e,t)=>e.packageName.localeCompare(t.packageName))}function At({selectedNode:e}){let{t:n}=q(),{data:r}=U(et,{staleTime:tt});if(r===void 0)return null;let i=kt(r.installations,e),o=r.unreachable.filter(t=>e.isHub||t.nodeId===e.id);return i.length===0&&o.length===0?null:t(`div`,{className:`rounded-lg border border-warning/30 bg-warning/5 px-3 py-2.5 space-y-2`,children:[t(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold text-foreground`,children:[a(m,{className:`h-3.5 w-3.5 text-warning`}),e.isHub?n(`addons.nodeOnlyPackagesPanel.installedOnAgentsButNot`,`Installed on agents but not on the hub`):n(`addons.nodeOnlyPackagesPanel.installedOnButNotOn`,`Installed on {{name}} but not on the hub`,{name:e.name})]}),o.length>0&&a(`div`,{className:`text-[10px] text-foreground-subtle`,children:n(`addons.nodeOnlyPackagesPanel.unreachable`,{nodes:o.map(e=>e.nodeId).join(`, `)})}),i.map(n=>t(`div`,{className:`flex items-center justify-between gap-3 flex-wrap rounded-md border border-border bg-surface px-3 py-2`,children:[t(`div`,{className:`min-w-0`,children:[a(`div`,{className:`text-xs font-mono text-foreground break-all`,children:n.packageName}),a(`div`,{className:`text-[10px] text-foreground-subtle`,children:n.rows.map(e=>`${e.nodeName}${e.version===null?``:` ${e.version}`}${e.isOnline?``:` (offline)`}`).join(` · `)})]}),a(rt,{packageName:n.packageName,displayName:n.packageName,selectedNode:e,hideNodeAction:e.isHub})]},n.packageName))]})}function jt({addon:e,installing:n,onInstall:r}){let{t:i}=q();return t(`div`,{className:`flex items-center gap-3 px-3 py-2 hover:bg-surface-hover transition-colors`,children:[a(`div`,{className:`w-6 h-6 rounded-md bg-primary/10 flex items-center justify-center text-primary text-[9px] font-bold shrink-0`,children:e.name.replace(`@camstack/addon-`,``).charAt(0).toUpperCase()}),t(`div`,{className:`flex-1 min-w-0`,children:[t(`div`,{className:`flex items-baseline gap-2 min-w-0`,children:[a(`span`,{className:`text-[11px] font-semibold break-words`,children:e.name.replace(/^@camstack\/(addon-)?/,``)}),t(`span`,{className:`text-[10px] text-foreground-subtle shrink-0`,children:[`v`,e.version]})]}),a(`div`,{className:`font-mono text-[9px] text-foreground-subtle/80 truncate`,children:e.name}),e.description&&a(`div`,{className:`text-[10px] text-foreground-subtle truncate`,children:e.description})]}),e.installed?a(fe,{variant:`success`,icon:a(p,{className:`h-3 w-3`}),children:e.installedVersion??i(`system.capabilityCatalog.installed`,`Installed`)}):t(N,{size:`sm`,onClick:()=>r(e),disabled:n,className:`shrink-0`,children:[n?a(x,{className:`h-3 w-3 animate-spin`}):a(E,{className:`h-3 w-3`}),i(`system.capabilityCatalog.install`,`Install`)]})]})}function Mt({capability:e,installing:n,onInstall:r}){let{t:i}=q(),{data:o,isPending:s,isError:c}=se({capability:e}),l;if(c)l=a(`div`,{className:`px-3 py-2 text-xs text-danger`,children:i(`system.capabilityCatalog.couldNotSearchTheNpm`,`Could not search the npm catalog right now. Try again in a moment.`)});else if(s||o===void 0)l=t(`div`,{className:`flex items-center gap-2 px-3 py-2 text-xs text-foreground-subtle`,children:[a(x,{className:`h-3 w-3 animate-spin`}),i(`system.capabilityCatalog.searchingTheNpmCatalog`,`Searching the npm catalog…`)]});else{let t=o.filter(e=>!e.installed);l=t.length===0?a(`div`,{className:`px-3 py-2 text-xs text-foreground-subtle`,children:o.length===0?i(`system.capabilityCatalog.noPublishedAddonDeclaresThe`,`No published addon declares the "{{capability}}" capability.`,{capability:e}):i(`system.capabilityCatalog.everyPublishedAddonThatDeclares`,`Every published addon that declares "{{capability}}" is already installed.`,{capability:e})}):a(`div`,{className:`divide-y divide-border`,children:t.map(e=>a(jt,{addon:e,installing:n,onInstall:r},e.name))})}return t(`section`,{className:`rounded-md border border-border bg-surface overflow-hidden`,"aria-label":i(`system.capabilityCatalog.availableToInstall`,`Available to install`),children:[a(`h2`,{className:`px-3 py-1.5 text-[10px] uppercase tracking-wide text-foreground-subtle border-b border-border`,children:i(`system.capabilityCatalog.availableToInstall`,`Available to install`)}),l]})}c();function Nt(e){return e===`npm`||e===`dev`?e:null}var Pt=`rounded-full border border-primary bg-primary/10 px-2 py-0.5 text-[10px] text-foreground`,Ft=`rounded-full border border-border px-2 py-0.5 text-[10px] text-foreground-muted hover:bg-surface-hover`,It=[{seconds:900,label:`15m`},{seconds:3600,label:`1h`},{seconds:21600,label:`6h`},{seconds:43200,label:`12h`},{seconds:86400,label:`24h`}],Lt={id:`hub`,name:`Hub`,isHub:!0,isOnline:!0};function Rt(e,t){let n=e??`hub-only`;return n===`any-node`?!0:n===`hub-only`?t:!t}function zt(e){return e===`local`?`dev`:`npm`}function Bt(e){let t=e;if(!t?.manifest)return null;let n={...t.manifest,name:t.manifest.name??t.manifest.id,version:t.manifest.version??`0.0.0`,capabilities:t.manifest.capabilities??[]},r=t.process,i=r?{pid:r.pid,mode:r.mode===`forked`?`forked`:`in-process`,state:r.state??`unknown`,...r.reason===void 0?{}:{reason:r.reason}}:void 0,a=t.health,o=t.declaration?.execution,s=t.manifest.execution,c=o?.placement??s?.placement;return{manifest:n,enabled:!0,source:t.source,installSource:t.installSource,installedOn:[],...i?{process:i}:{},hasBackup:t.hasBackup,...a?{health:a}:{},...c?{placement:c}:{}}}function Vt(e){let t=new Map,n=[];for(let r of e){let e=r.manifest.packageName;if(!e){n.push(r);continue}let i=t.get(e);if(i)i.addons.push(r);else{let n=r.manifest.bundle,i={packageName:e,displayName:n?.displayName??r.manifest.packageDisplayName??r.manifest.name,version:r.manifest.packageVersion,addons:[r],...r.installSource===void 0?{}:{installSource:r.installSource},...n===void 0?{}:{bundle:n}};t.set(e,i)}}let r=[];for(let e of t.values())e.bundle!==void 0||e.addons.length>=2?r.push({bundle:e,representative:e.addons[0]}):r.push(e.addons[0]);return r.push(...n),r}function $(e){return`bundle`in e}function Ht({addons:c,clusterStatus:u,selectedNode:d,onRefresh:f,listPhase:p}){let{t:m}=q(),_=l(),[v,y]=s(``),b=e(v),[S,C]=s(!1),w=n(null);o(()=>{if(!S)return;let e=e=>{w.current&&!w.current.contains(e.target)&&C(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[S]);let{data:T}=ke({nodeId:d.id}),te=r(()=>{let e=new Map;for(let t of T??[])t.blockedBy===void 0&&e.set(t.name,t.latestVersion);return e},[T]),ne=r(()=>{let e=new Map;for(let t of T??[]){let n=t.blockedBy?.find(e=>e.kind===`server-too-old`);n!==void 0&&e.set(t.name,{latestVersion:t.latestVersion,requiredServer:n.required})}return e},[T]),re=r(()=>(T??[]).filter(e=>!e.isSystem&&e.blockedBy===void 0).length,[T]),[k,A]=s(()=>new Set),[ie,ae]=s(()=>new Map),oe=i(e=>{A(t=>new Set(t).add(e))},[]),le=i(e=>{A(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n})},[]),ue=i((e,t)=>{ae(n=>new Map(n).set(e,t))},[]),de=i(e=>{ae(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),fe=Se({onMutate:e=>{oe(e.name),de(e.name)},onSuccess:(e,t)=>{le(t.name);let n=e;if(n&&n.success===!1){ue(t.name,n.error??`Update failed (no error message returned by server)`);return}_.invalidateQueries({queryKey:[[`addons`]]}),_.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]})},onError:(e,t)=>{le(t.name),ue(t.name,e instanceof Error?e.message:String(e))}}),pe=Ge(),me=n(new Set);o(()=>{let e=new Set;for(let[t,n]of pe)Ue(n)&&e.add(t);let t=[...me.current].some(t=>!e.has(t));me.current=e,t&&(_.invalidateQueries({queryKey:[[`addons`]]}),_.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]}))},[pe,_]);let{data:j}=W(void 0),M=R({onSuccess:()=>{_.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),he=F({onSuccess:()=>{_.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),{data:P,isFetching:ge}=se({query:b||void 0},{enabled:S}),I=ce(),{data:L}=De(void 0),_e=L?.requestedAt,[ve,ye]=s(null),[z,B]=s(!1);o(()=>{if(L?.kind===`framework-bulk-update`&&L.requestedAt!==ve){ye(L.requestedAt),B(!0);let e=window.setTimeout(()=>B(!1),6e3);return()=>window.clearTimeout(e)}},[_e,ve,L]),ee();let be=i(async()=>{let e=(T??[]).filter(e=>!e.isSystem&&e.blockedBy===void 0);if(e.length!==0){if(!d.isHub){for(let t of e)await fe.mutateAsync({name:t.name,version:t.latestVersion,nodeId:d.id});return}await I.mutateAsync({kind:`update`,targets:e.map(e=>({name:e.name,version:e.latestVersion})),nodeIds:[d.id]})}},[T,d.id,d.isHub,I,fe]),[V,H]=s(null),[U,xe]=s(null),G=e=>{xe(null),H(e)},K=we({onSuccess:()=>{H(null),xe(null),_.invalidateQueries({queryKey:[[`addons`]]}),_.invalidateQueries({queryKey:[[`addonPages`]]}),_.invalidateQueries({queryKey:[[`capabilities`]]}),_.invalidateQueries({queryKey:[[`integrations`]]})},onError:e=>{xe(e instanceof Error?e.message:`Install failed`)}}),[Te,Oe]=s(`type`),[Ae,je]=s(()=>typeof window>`u`?`grouped`:window.localStorage.getItem(`camstack.addons.viewMode`)===`flat`?`flat`:`grouped`),Me=e=>{je(e),typeof window<`u`&&window.localStorage.setItem(`camstack.addons.viewMode`,e)},[J,Y]=Ne(),X=J.get(`capability`),Re=J.get(`updatable`)===`1`,ze=J.get(`error`)===`1`,Z=Nt(J.get(`source`)),Q=Pe(J.get(Ie))===`integration`,{data:Ve}=Ee(void 0,{enabled:Q}),He=r(()=>Ve===void 0?null:new Set(Ve.map(e=>e.addonId)),[Ve]),We=i(e=>{let t=new URLSearchParams(J);e?t.set(Ie,`integration`):t.delete(Ie),Y(t,{replace:!0})},[J,Y]),Ke=i(e=>{let t=new URLSearchParams(J);e?t.set(`updatable`,`1`):t.delete(`updatable`),Y(t,{replace:!0})},[J,Y]),qe=i(e=>{let t=new URLSearchParams(J);e?t.set(`error`,`1`):t.delete(`error`),Y(t,{replace:!0})},[J,Y]),Je=i(e=>{let t=new URLSearchParams(J);e===null?t.delete(`source`):t.set(`source`,e),Y(t,{replace:!0})},[J,Y]),Ye=r(()=>c.filter(e=>Be(e.process)!==null).length,[c]),Xe=r(()=>{let e=c.filter(e=>!Le(e.manifest.packageName));return d.isHub||(e=e.filter(e=>Rt(e.placement,d.isHub))),X&&(e=e.filter(e=>(e.manifest.capabilities??[]).some(e=>(typeof e==`string`?e:e.name)===X))),Q&&(e=[...Fe(e,He)]),Re&&(e=e.filter(e=>{let t=e.manifest.packageName;return t!==void 0&&te.has(t)})),Z!==null&&(e=e.filter(e=>zt(e.installSource)===Z)),ze&&(e=e.filter(e=>Be(e.process)!==null)),e},[c,d.isHub,X,Re,Z,ze,Q,He,te]),Ze=()=>{let e=new URLSearchParams(J);e.delete(`capability`),Y(e,{replace:!0})},Qe=Ae===`flat`?Xe:Vt(Xe),$e=r(()=>{let e=[...Qe];switch(Te){case`type`:e.sort((e,t)=>{let n=+!$(e),r=+!$(t);if(n!==r)return n-r;let i=$(e)?e.bundle.displayName:e.manifest.name,a=$(t)?t.bundle.displayName:t.manifest.name;return i.localeCompare(a)});break;case`name`:e.sort((e,t)=>{let n=$(e)?e.bundle.displayName:e.manifest.name,r=$(t)?t.bundle.displayName:t.manifest.name;return n.localeCompare(r)});break;case`source`:e.sort((e,t)=>{let n=$(e)?e.bundle.installSource??``:e.installSource??``,r=$(t)?t.bundle.installSource??``:t.installSource??``;return n.localeCompare(r)});break}return e},[Qe,Te]);return t(`div`,{className:`space-y-3`,children:[[...ie.entries()].map(([e,n])=>a(`div`,{className:`rounded-md border border-danger/30 bg-danger/5 px-2.5 py-1.5 text-[11px]`,children:t(`div`,{className:`flex items-start justify-between gap-3`,children:[t(`div`,{className:`space-y-0.5`,children:[a(`div`,{className:`font-medium text-danger`,children:m(`systemPage.addons.updateFailed`,{name:e})}),a(`div`,{className:`text-foreground-subtle font-mono`,children:n})]}),a(N,{variant:`unstyled`,type:`button`,onClick:()=>de(e),className:`text-foreground-subtle hover:text-foreground text-[10px]`,children:m(`common.dismiss`)})]})},e)),t(`div`,{className:`flex items-center gap-x-2 gap-y-1.5 flex-wrap`,children:[t(`div`,{className:`flex items-center gap-1.5`,children:[a(`span`,{className:`text-[10px] text-foreground-subtle`,children:m(`admin.system.addons.sort`,`Sort:`)}),t(D,{wrapperClassName:`inline-block w-auto`,value:Te,onChange:e=>Oe(e.target.value),children:[a(`option`,{value:`type`,children:m(`admin.system.addons.bundlesFirst`,`Bundles first`)}),a(`option`,{value:`name`,children:m(`admin.system.addons.name`,`Name`)}),a(`option`,{value:`source`,children:m(`admin.system.addons.installSource`,`Install source`)})]})]}),t(`div`,{className:`flex items-center gap-1.5`,children:[a(`span`,{className:`text-[10px] text-foreground-subtle`,children:m(`admin.system.addons.view`,`View:`)}),a(`div`,{className:`flex rounded-md border border-border overflow-hidden text-[10px] font-medium`,children:[`grouped`,`flat`].map(e=>a(N,{variant:`unstyled`,type:`button`,onClick:()=>Me(e),className:`px-2 py-1 transition-colors capitalize ${Ae===e?`bg-primary/10 text-primary`:`bg-transparent text-foreground-subtle hover:bg-surface-hover`}`,title:e===`grouped`?m(`admin.system.addons.groupMultiAddonPackagesInto`,`Group multi-addon packages into a bundle card`):m(`admin.system.addons.showEveryAddonAsIts`,`Show every addon as its own card`),children:e},e))})]}),d.isHub&&t(`div`,{className:`flex items-center gap-1.5`,children:[a(O,{className:`h-3 w-3 text-foreground-subtle`}),a(`span`,{className:`text-[10px] text-foreground-subtle`,children:m(`admin.system.addons.autoUpdate`,`Auto-Update:`)}),a(`div`,{className:`flex rounded-md border border-border overflow-hidden text-[10px] font-medium`,children:[`off`,`latest`,`beta`].map(e=>a(N,{variant:`unstyled`,type:`button`,onClick:()=>M.mutate({channel:e}),disabled:M.isPending,className:`px-2 py-1 transition-colors capitalize ${j?.channel===e?e===`off`?`bg-gray-700 text-gray-200`:e===`latest`?`bg-blue-500/20 text-blue-400`:`bg-amber-500/20 text-amber-400`:`bg-transparent text-foreground-subtle hover:bg-surface-hover`} ${e===`off`?``:`border-l border-border`}`,children:e},e))})]}),d.isHub&&t(`div`,{className:`flex items-center gap-1.5`,children:[a(`span`,{className:`text-[10px] text-foreground-subtle`,children:m(`admin.system.addons.checkEvery`,`Check every:`)}),a(D,{wrapperClassName:`inline-block w-auto`,className:`font-medium text-foreground-subtle`,value:j?.updateCheckIntervalSeconds??21600,disabled:he.isPending||j===void 0,onChange:e=>{j!==void 0&&he.mutate({channel:j.channel,updateCheckIntervalSeconds:Number(e.target.value)})},children:It.map(e=>a(`option`,{value:e.seconds,children:e.label},e.seconds))})]}),re>0&&t(N,{variant:`unstyled`,type:`button`,onClick:()=>void be(),disabled:I.isPending,className:`flex items-center gap-1 px-2 py-1 text-[11px] rounded-md bg-blue-500/10 text-blue-400 hover:bg-blue-500/20 border border-blue-500/30 disabled:opacity-50 transition-colors font-medium`,children:[I.isPending?a(x,{className:`w-3 h-3 animate-spin`}):a(E,{className:`w-3 h-3`}),I.isPending?m(`admin.system.addons.updating`,`Updating…`):m(`admin.system.addons.updateAll`,`Update All ({{nonSystemUpdateCount}})`,{nonSystemUpdateCount:re})]})]}),t(`div`,{className:`flex flex-wrap items-center gap-1.5`,role:`group`,"aria-label":m(`admin.system.addons.filterInstalledAddons`,`Filter installed addons`),children:[a(`span`,{className:`text-[10px] text-foreground-subtle`,children:m(`admin.system.addons.filter`,`Filter:`)}),[{id:`integrations`,label:m(`admin.system.addons.integrations`,`Integrations`),pressed:Q,toggle:()=>We(!Q)},{id:`updatable`,label:m(`admin.system.addons.updatable`,`Updatable`),pressed:Re,toggle:()=>Ke(!Re)},{id:`error`,label:m(`admin.system.addons.inError`,`In error ({{count}})`,{count:Ye}),pressed:ze,toggle:()=>qe(!ze)},{id:`npm`,label:`npm`,pressed:Z===`npm`,toggle:()=>Je(Z===`npm`?null:`npm`)},{id:`dev`,label:m(`admin.system.addons.dev`,`Dev`),pressed:Z===`dev`,toggle:()=>Je(Z===`dev`?null:`dev`)}].map(e=>a(N,{variant:`unstyled`,type:`button`,"aria-pressed":e.pressed,onClick:e.toggle,className:e.pressed?Pt:Ft,children:e.label},e.id))]}),t(`div`,{className:`flex flex-col gap-1.5 sm:flex-row sm:items-center sm:gap-2`,children:[t(`div`,{className:`relative flex-1 min-w-0 sm:min-w-[200px]`,ref:w,children:[a(Ce,{type:`text`,searchHotkey:!0,value:v,onChange:e=>{y(e.target.value),C(!0)},onFocus:()=>C(!0),placeholder:m(`admin.system.addons.searchAddonsOnNpm`,`Search addons on npm...`),"aria-label":m(`admin.system.addons.searchAddonsOnNpm2`,`Search addons on npm`),disabled:I.isPending,leftSlot:a(g,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),rightSlot:ge?a(x,{className:`h-3 w-3 animate-spin`}):void 0}),S&&P&&P.length>0&&t(`div`,{className:`absolute left-0 right-0 top-full mt-1 z-40 rounded-md border border-border bg-surface shadow-xl overflow-hidden`,children:[P.length>0&&a(`div`,{className:`px-3 py-1.5 text-[10px] uppercase tracking-wide text-foreground-subtle border-b border-border`,children:m(`systemPage.addons.npmResults`,{count:P.length})}),P&&P.length>0&&a(`div`,{className:`max-h-72 overflow-auto divide-y divide-border`,children:P.map(e=>a(jt,{addon:e,installing:K.isPending,onInstall:e=>G({name:e.name,version:e.version,description:e.description})},e.name))})]})]}),a(_t,{onUploadSuccess:()=>{_.invalidateQueries({queryKey:[[`addons`]]}),f()}})]}),X&&t(`div`,{className:`flex items-center gap-2 px-2.5 py-1.5 rounded-md bg-primary/10 border border-primary/30 text-xs`,children:[a(`span`,{className:`text-foreground-subtle`,children:m(`admin.system.addons.filteringByCapability`,`Filtering by capability:`)}),a(`span`,{className:`font-mono text-primary font-semibold`,children:X}),a(N,{variant:`unstyled`,type:`button`,onClick:Ze,className:`ml-auto text-xs text-foreground-subtle hover:text-foreground underline`,children:m(`admin.system.addons.clear`,`Clear`)})]}),X&&a(Mt,{capability:X,installing:K.isPending,onInstall:e=>G({name:e.name,version:e.version,description:e.description})}),X&&Xe.length>0&&a(`h2`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:m(`admin.system.addons.installed`,`Installed`)}),z&&t(`div`,{className:`fixed top-[calc(env(safe-area-inset-top)+1rem)] right-[calc(env(safe-area-inset-right)+1rem)] z-50 flex items-start gap-2 px-3 py-2.5 rounded-md border border-green-500/30 bg-green-500/10 shadow-lg max-w-sm pointer-events-auto`,children:[a(h,{className:`w-4 h-4 shrink-0 mt-0.5 text-green-400`}),t(`div`,{children:[a(`div`,{className:`text-[11px] font-semibold text-foreground`,children:m(`admin.system.addons.bulkUpdateCompleted`,`Bulk update completed`)}),a(`div`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:m(`admin.system.addons.systemPackagesUpdatedHubRestarted`,`System packages updated — hub restarted successfully.`)})]})]}),p===`pending`&&t(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[a(x,{className:`h-3 w-3 animate-spin`}),m(`admin.system.addons.loadingInstalled`,`Loading installed addons…`)]}),p===`error`&&a(`div`,{className:`text-xs text-danger`,children:m(`admin.system.addons.failedToLoadAddons`,`Failed to load addons`)}),p===`ready`&&Xe.length===0&&a(`div`,{className:`text-xs text-foreground-subtle`,children:c.length===0?m(`admin.system.addons.noAddonsInstalled`,`No addons installed`):X?m(`admin.system.addons.noInstalledAddonDeclaresThe`,`No installed addon declares the "{{capabilityFilter}}" capability. Any addon you can install appears under "Available to install" above.`,{capabilityFilter:X}):m(`admin.system.addons.noAddonsCompatibleWithPlacement`,`No addons compatible with {{name}} (placement filter active)`,{name:d.name})}),a(`div`,{className:`space-y-1.5`,children:p===`ready`&&$e.map(e=>{let t=$(e)?e.bundle.packageName:e.manifest.packageName,n=te.get(t),r=ne.get(t),i=$(e)?e.representative:e,o=n?e=>fe.mutate({name:t,version:e,nodeId:d.id}):void 0,s=pe.get(t)??null,c=s!==null&&Ue(s);return a(ht,{addon:i,clusterStatus:u?.[i.manifest.id],bundle:$(e)?e.bundle:void 0,availableUpdate:n,...r===void 0?{}:{blockedUpdate:r},isUpdating:k.has(t)||c,jobProgress:s,onUpdate:o,disabledByBulk:I.isPending,selectedNode:d},$(e)?t:e.manifest.id)})}),V!==null&&a(Dt,{target:V,installing:K.isPending,installError:U,onClose:()=>H(null),onInstall:(e,t)=>K.mutate({packageName:e,version:t})})]})}function Ut(){let{t:e}=q(),r=l(),{data:i}=ae(void 0),{nodes:s}=j(),{selection:c,selectNode:u,requestedNodeId:d}=ze(s.length>0?s:[Lt]),f=c.node??Lt,p=f.id,m=s.length>0?c.staleNodeId:null,{data:h,isLoading:g,isError:_}=G({nodeId:p}),v=Te(),y=je(),b=v.isPending||y.isPending,x=async()=>{await v.mutateAsync({nodeId:p}),await y.mutateAsync(),r.invalidateQueries({queryKey:[[`addons`]]})},S=n(v);S.current=v;let C=n(d??`hub`);o(()=>{S.current.mutate({nodeId:C.current})},[]);let w=(h??[]).map(Bt).filter(e=>e!==null);return t(Y,{children:[t(`div`,{className:`flex items-center justify-between gap-2 flex-wrap`,children:[a(he,{selectedNodeId:p,onSelect:u}),t(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[!g&&!_&&a(`span`,{className:`text-[10px] rounded-full bg-primary/10 text-primary px-2 py-0.5 font-medium`,children:e(`systemPage.addons.installedCount`,{count:w.length})}),t(N,{variant:`unstyled`,type:`button`,onClick:()=>void x(),disabled:b,className:`inline-flex items-center gap-1 px-2 py-1 text-[11px] rounded-md bg-surface hover:bg-surface-hover border border-border disabled:opacity-50 transition-colors`,title:e(`admin.system.addons.reFetchAddonsCheckNpm`,`Re-fetch addons + check npm for new versions`),children:[a(O,{className:`w-3 h-3 ${b?`animate-spin`:``}`}),e(`admin.system.addons.checkForUpdates`,`Check for updates`)]})]})]}),a(Re,{staleNodeId:m,shownNodeName:f.name}),a(At,{selectedNode:f}),a(Ht,{addons:w,clusterStatus:i,selectedNode:f,onRefresh:()=>void x(),listPhase:g?`pending`:_?`error`:`ready`})]})}export{Ut as AddonsPage};