@camstack/addon-admin-ui 1.2.697 → 1.2.699

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/assets/{AccessSection-DdGWzCNU.js → AccessSection-Cg9rzCY6.js} +1 -1
  3. package/dist/assets/Addons-qxSwlXcz.js +5 -0
  4. package/dist/assets/{AdminPage-CdTTxNI2.js → AdminPage-BrYobKfu.js} +1 -1
  5. package/dist/assets/{AdminSectionedPage-naipwiRu.js → AdminSectionedPage-DMt3db7_.js} +1 -1
  6. package/dist/assets/AiProfiles-DOg54XLu.js +3 -0
  7. package/dist/assets/Archive-CVAb7ii-.js +1 -0
  8. package/dist/assets/{BootstrapSettingsForm-DFMtetlU.js → BootstrapSettingsForm-X9cZi_Nt.js} +1 -1
  9. package/dist/assets/{Build-DxY2TX10.js → Build-DxgTHExF.js} +4 -4
  10. package/dist/assets/{Calendars-CP8C8VtZ.js → Calendars-D6WsgvTf.js} +1 -1
  11. package/dist/assets/Cluster-RtxW2bKJ.js +1 -0
  12. package/dist/assets/{CompositionBlockEditor-MQKfvO2_.js → CompositionBlockEditor-Cg3OItJ7.js} +2 -2
  13. package/dist/assets/CompositionEditorPage-Ber-Qx5p.js +1 -0
  14. package/dist/assets/Data-Cwpzr7cR.js +2 -0
  15. package/dist/assets/DeviceDetail-Folb0FGW.js +1 -0
  16. package/dist/assets/{Devices-utVd78jI.js → Devices-DMIjJ196.js} +1 -1
  17. package/dist/assets/{EmbedDevicePage-CB8RtuTi.js → EmbedDevicePage-Caafl7ZH.js} +1 -1
  18. package/dist/assets/{EmbedPlayerPage-BR-eSBu0.js → EmbedPlayerPage-Bi76rC5b.js} +1 -1
  19. package/dist/assets/{History-tKHh0cHS.js → History-CP79jWzy.js} +1 -1
  20. package/dist/assets/Identity-HvzyOfT2.js +1 -0
  21. package/dist/assets/InstancesTable-fl42p6i3.js +1 -0
  22. package/dist/assets/IntegrationDetail-CMMEdEjA.js +1 -0
  23. package/dist/assets/{Integrations-BFnupnaS.js → Integrations-CYaklItX.js} +2 -2
  24. package/dist/assets/Integrations-hvwXjb_k.js +1 -0
  25. package/dist/assets/Library-Opn5-0Wj.js +1 -0
  26. package/dist/assets/Locations-Db8-OTso.js +3 -0
  27. package/dist/assets/{Logs-D72884eX.js → Logs-B9zTepXX.js} +1 -1
  28. package/dist/assets/{MaskShapeCanvas-FsP-Pqfm.js → MaskShapeCanvas-CeHsVkFB.js} +1 -1
  29. package/dist/assets/{MotionZonesSettings-DWnvsLfI.js → MotionZonesSettings-adkc7eLP.js} +1 -1
  30. package/dist/assets/{MyAccess-CaeqS22Q.js → MyAccess-BPDq5d45.js} +1 -1
  31. package/dist/assets/{Network-IA4ekRza.js → Network-jSuufX_m.js} +1 -1
  32. package/dist/assets/{NewExportModal-5HfHutIX.js → NewExportModal-BwmdfSbv.js} +1 -1
  33. package/dist/assets/NodeAddonsSettingsPanel-BcvIFJ-x.js +1 -0
  34. package/dist/assets/{Notifications-ClpQwHYS.js → Notifications-DUibmZHJ.js} +1 -1
  35. package/dist/assets/{PanelContent-CvEORG5m.js → PanelContent-BCIeD6_U.js} +2 -2
  36. package/dist/assets/{Pipeline-BsG-C_sg.js → Pipeline-BvgwYZ8u.js} +1 -1
  37. package/dist/assets/{PrivacyMaskSettings-DCyzjqzQ.js → PrivacyMaskSettings-zs9fc3hQ.js} +1 -1
  38. package/dist/assets/{SceneMonitorEditor-CV82fzoU.js → SceneMonitorEditor-C3LeCTYJ.js} +1 -1
  39. package/dist/assets/{SessionsList-PTKo0Lkj.js → SessionsList-CLCT23El.js} +2 -2
  40. package/dist/assets/{Showroom-BQd-Ik5x.js → Showroom-DrLRL9I1.js} +1 -1
  41. package/dist/assets/StorageLocationsTable-Bz9GAV5K.js +1 -0
  42. package/dist/assets/{System-mDTNPf2A.js → System-BbRrxjUU.js} +2 -2
  43. package/dist/assets/{TemplateEditorDialog-CEGwmxkN.js → TemplateEditorDialog-22h0K3yb.js} +1 -1
  44. package/dist/assets/{Terminal-f3U9kOJ9.js → Terminal-BTsnnLaP.js} +5 -5
  45. package/dist/assets/{TrainingProviders-RkzNtyQH.js → TrainingProviders-YTsR5lC5.js} +1 -1
  46. package/dist/assets/{Viewer-5BTY7nR7.js → Viewer-wJAA7rtL.js} +1 -1
  47. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-Bjw5Y-ao.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-C29DsQaz.js} +1 -1
  48. package/dist/assets/{action-draft-ClaKheRp.js → action-draft-LMoJNqJ2.js} +1 -1
  49. package/dist/assets/{ai-page.helpers-UE-kLqk-.js → ai-page.helpers-MSr4oAOr.js} +1 -1
  50. package/dist/assets/{assignment-candidates-4DJypkPw.js → assignment-candidates-lemE0qmp.js} +1 -1
  51. package/dist/assets/{authed-media-HuCfJg8e.js → authed-media-CJkTsStS.js} +1 -1
  52. package/dist/assets/{board-model-BiC_AOnT.js → board-model-BjTxORes.js} +1 -1
  53. package/dist/assets/{camera-block-model-g3cq_EI_.js → camera-block-model-D98qHpXa.js} +1 -1
  54. package/dist/assets/client-DVowZZ0s.js +1122 -0
  55. package/dist/assets/{command-vocab-9mWzh5PF.js → command-vocab-BecctZqm.js} +1 -1
  56. package/dist/assets/{device-detail-YfGCWj8t.js → device-detail-D7Mllu4s.js} +1 -1
  57. package/dist/assets/{device-integration-icon-DM6LkNcP.js → device-integration-icon-BR10V6ne.js} +1 -1
  58. package/dist/assets/device-picker-model-DccEEZ6A.js +1 -0
  59. package/dist/assets/{dist-CVN4KkB9.js → dist-DO0_AccE.js} +1 -1
  60. package/dist/assets/dist-DhsssUoX.js +1122 -0
  61. package/dist/assets/{format-BFqaqsZF.js → format-D6kgFpER.js} +1 -1
  62. package/dist/assets/{hostInit-D0OCyJdS.js → hostInit-CdUb3qyd.js} +1 -1
  63. package/dist/assets/i18n-CQiAPXio.js +1 -0
  64. package/dist/assets/{icons-DWGskgV4.js → icons-S17PAUwl.js} +1 -1
  65. package/dist/assets/index-BFLHRK9f.js +6 -0
  66. package/dist/assets/index-CgTEWhcQ.css +2 -0
  67. package/dist/assets/{linked-devices-model-BzrCMmaN.js → linked-devices-model-E6YzvEnL.js} +1 -1
  68. package/dist/assets/{mf-entry-bootstrap-0-fadd666d.js → mf-entry-bootstrap-0-26099898.js} +2 -2
  69. package/dist/assets/mount-DccEEZ6A.js +1 -0
  70. package/dist/assets/{notification-rule-status-DUgKlnjE.js → notification-rule-status-Rco24I6e.js} +1 -1
  71. package/dist/assets/{player-overlays-BwkSi_4-.js → player-overlays-DNV0OF87.js} +1 -1
  72. package/dist/assets/remoteEntry-CLeDuWWL.js +1 -0
  73. package/dist/assets/src-Dv0B4lHJ.js +279 -0
  74. package/dist/assets/{sso-popup-Dgqs_a8a.js → sso-popup-F-KRTc0f.js} +1 -1
  75. package/dist/assets/{step-inspector-model-D61dFKRl.js → step-inspector-model-drjYN2J-.js} +1 -1
  76. package/dist/assets/{use-scenes-feed-BhsIhVzS.js → use-scenes-feed-jdmupAkZ.js} +1 -1
  77. package/dist/assets/{useAdminDeviceRemoval-5dMFC-df.js → useAdminDeviceRemoval-CB-W9jkR.js} +1 -1
  78. package/dist/assets/useEventInvalidation-DccEEZ6A.js +1 -0
  79. package/dist/assets/{useNodeUrlSelection-DOGBUYEz.js → useNodeUrlSelection-BfsFEu9Z.js} +1 -1
  80. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-IXviF-_2.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-CSeKpPd2.js} +2 -2
  81. package/dist/index.html +9 -9
  82. package/dist/server/addon.js +300 -7
  83. package/package.json +2 -2
  84. package/dist/assets/Addons-B0bqL6tU.js +0 -5
  85. package/dist/assets/AiProfiles-DNb_fYYp.js +0 -3
  86. package/dist/assets/Archive-7CE6jZjq.js +0 -1
  87. package/dist/assets/Cluster-C4FhspzG.js +0 -1
  88. package/dist/assets/CompositionEditorPage-BTZJ1SGJ.js +0 -1
  89. package/dist/assets/Data-C6KNxbbA.js +0 -2
  90. package/dist/assets/DeviceDetail-Osm-Rh6F.js +0 -1
  91. package/dist/assets/Identity-6rJA2fNv.js +0 -1
  92. package/dist/assets/InstancesTable-Gj2icd8R.js +0 -1
  93. package/dist/assets/IntegrationDetail-C5mkMk4l.js +0 -1
  94. package/dist/assets/Integrations-DWhc4Sc8.js +0 -1
  95. package/dist/assets/Library-FLyCVVDD.js +0 -1
  96. package/dist/assets/Locations-D-ZRoAVT.js +0 -3
  97. package/dist/assets/NodeAddonsSettingsPanel-DEfnyzvR.js +0 -1
  98. package/dist/assets/StorageLocationsTable-CQpdu3Aj.js +0 -1
  99. package/dist/assets/client-jwdAAPeF.js +0 -1122
  100. package/dist/assets/device-picker-model-CS9GUXwM.js +0 -1
  101. package/dist/assets/dist-DkjIIXcA.js +0 -1122
  102. package/dist/assets/i18n-CZf--AlM.js +0 -1
  103. package/dist/assets/index-BAoWvnYw.js +0 -6
  104. package/dist/assets/index-Cdqk-EuE.css +0 -2
  105. package/dist/assets/mount-CS9GUXwM.js +0 -1
  106. package/dist/assets/remoteEntry-DmNGDfRG.js +0 -1
  107. package/dist/assets/src-CTVIVqdZ.js +0 -279
  108. package/dist/assets/useEventInvalidation-CS9GUXwM.js +0 -1
@@ -1,6 +1,6 @@
1
1
  import path from "node:path";
2
2
  import { fileURLToPath } from "node:url";
3
- //#region ../types/dist/event-category-CY27-fF0.mjs
3
+ //#region ../types/dist/event-category-7P4A3bYA.mjs
4
4
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
5
5
  EventCategory["SystemBoot"] = "system.boot";
6
6
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -231,6 +231,20 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
231
231
  * dropped) — consumers MUST also gate on the device record's `probed` flag.
232
232
  */
233
233
  EventCategory["DeviceReady"] = "device.ready";
234
+ /**
235
+ * An identity link (D1063) became `linked` — auto on strong evidence or
236
+ * confirmed by the operator — or a confirmed link's evidence came back. Telemetry: the `identity-links` record is the
237
+ * truth, and core-blocks reconciles its contributions from it as well.
238
+ * Payload: `IdentityLinkEventPayload`.
239
+ */
240
+ EventCategory["IdentityLinkCreated"] = "identity-link.created";
241
+ /**
242
+ * A `linked` identity link stopped acting: its evidence is gone (an auto link
243
+ * is deleted; an operator-confirmed one stays `linked`, flagged
244
+ * `evidenceGone`, and no longer acts), a side was removed, or the operator
245
+ * unlinked it. Payload: `IdentityLinkEventPayload` with `reason`.
246
+ */
247
+ EventCategory["IdentityLinkLost"] = "identity-link.lost";
234
248
  EventCategory["IntegrationEnabled"] = "integration.enabled";
235
249
  EventCategory["IntegrationDisabled"] = "integration.disabled";
236
250
  EventCategory["IntegrationDeleted"] = "integration.deleted";
@@ -5973,7 +5987,7 @@ var ZodIssueCode = {
5973
5987
  var ZodFirstPartyTypeKind;
5974
5988
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5975
5989
  //#endregion
5976
- //#region ../types/dist/sleep-dgC2VKW4.mjs
5990
+ //#region ../types/dist/sleep-C9eelFbV.mjs
5977
5991
  /**
5978
5992
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5979
5993
  * window to float samples (D455).
@@ -16814,6 +16828,17 @@ var CAP_VOCABULARY_BY_NAME = {
16814
16828
  },
16815
16829
  notOperatorFacing: { resync: "device adoption — re-aligning a device with its source is an onboarding step, not an automation action" }
16816
16830
  },
16831
+ "device-state-refresh": {
16832
+ scope: "device",
16833
+ noun: {
16834
+ en: "State refresh",
16835
+ it: "Aggiornamento dello stato"
16836
+ },
16837
+ notOperatorFacing: {
16838
+ refresh: "the core schedules state refreshes itself; an operator never asks for one",
16839
+ resubscribe: "the core schedules state refreshes itself; an operator never asks for one"
16840
+ }
16841
+ },
16817
16842
  "recording": {
16818
16843
  scope: "device",
16819
16844
  noun: {
@@ -19787,6 +19812,7 @@ var CAP_NAMES = Object.freeze([
19787
19812
  "device-removal-hook",
19788
19813
  "device-runs",
19789
19814
  "device-state",
19815
+ "device-state-refresh",
19790
19816
  "device-status",
19791
19817
  "device-transitions",
19792
19818
  "dishwasher",
@@ -22245,7 +22271,7 @@ Object.freeze({
22245
22271
  }
22246
22272
  });
22247
22273
  //#endregion
22248
- //#region ../types/dist/implemented-methods-k3KProJd.mjs
22274
+ //#region ../types/dist/implemented-methods-DXeNAPAS.mjs
22249
22275
  /**
22250
22276
  * The ffmpeg build every CamStack node downloads, per platform and arch.
22251
22277
  *
@@ -23405,6 +23431,8 @@ var CompositionItemEntrySchema = object({
23405
23431
  */
23406
23432
  reset: CompositionForwardCommandSchema.optional()
23407
23433
  });
23434
+ /** Which identity link added a feature (D1063). */
23435
+ var CompositionContributedBySchema = object({ linkId: string().min(1) });
23408
23436
  var CompositionFeatureSchema = discriminatedUnion("kind", [object({
23409
23437
  kind: literal("fields"),
23410
23438
  cap: string().min(1),
@@ -23416,7 +23444,14 @@ var CompositionFeatureSchema = discriminatedUnion("kind", [object({
23416
23444
  */
23417
23445
  items: record(string().regex(COMPOSITION_ITEM_KEY_RE), CompositionItemEntrySchema).refine((items) => Object.keys(items).length <= 16, { message: `at most 16 items` }).optional(),
23418
23446
  /** Method name → what serves it. Only a BUILT capability takes commands (D967). */
23419
- commands: record(string().min(1), CompositionCommandTargetSchema).optional()
23447
+ commands: record(string().min(1), CompositionCommandTargetSchema).optional(),
23448
+ /**
23449
+ * Provenance only (D1063): the identity link that added this feature. The
23450
+ * source ref stays in `fields`; `enabled` stays the operator's switch. An
23451
+ * operator edit of the source drops the stamp and the feature becomes the
23452
+ * operator's; a lost link removes only stamped features.
23453
+ */
23454
+ contributedBy: CompositionContributedBySchema.optional()
23420
23455
  }), object({
23421
23456
  kind: literal("passthrough"),
23422
23457
  cap: string().min(1),
@@ -55617,7 +55652,8 @@ var CompositionProblemSchema = object({
55617
55652
  "command-source-unknown",
55618
55653
  "command-input-unknown",
55619
55654
  "command-input-missing",
55620
- "power-source-is-actuator"
55655
+ "power-source-is-actuator",
55656
+ "link-contribution-removed"
55621
55657
  ]),
55622
55658
  path: string(),
55623
55659
  message: string()
@@ -57403,7 +57439,9 @@ var PowerSourceRefusalReasonSchema = _enum([
57403
57439
  "switch-call-failed",
57404
57440
  "switch-options-unreadable",
57405
57441
  "not-settable",
57406
- "switch-is-actuator"
57442
+ "switch-is-actuator",
57443
+ "link-lost",
57444
+ "link-unknown"
57407
57445
  ]);
57408
57446
  var PowerSourceActionResultSchema = discriminatedUnion("accepted", [object({ accepted: literal(true) }), object({
57409
57447
  accepted: literal(false),
@@ -59009,6 +59047,79 @@ var IdentityCandidatesSchema = discriminatedUnion("status", [object({
59009
59047
  pairs: array(IdentityCandidatePairSchema).readonly(),
59010
59048
  undeclaredDeviceIds: array(number$1().int()).readonly()
59011
59049
  })]);
59050
+ var IdentityLinkKindSchema = _enum(["same-device", "poe-power"]);
59051
+ /**
59052
+ * - `proposed` — one strong key matched: waits for the operator;
59053
+ * - `linked` — confirmed by the operator, or auto-linked on strong evidence;
59054
+ * - `dismissed` — the operator said no (or unlinked): sticky, never re-proposed.
59055
+ */
59056
+ var IdentityLinkStateSchema = _enum([
59057
+ "proposed",
59058
+ "linked",
59059
+ "dismissed"
59060
+ ]);
59061
+ /** Who decided the current state: the matcher (`auto`) or the operator. */
59062
+ var IdentityLinkOriginSchema = _enum(["auto", "operator"]);
59063
+ /** One side: the device ref that survives re-registration, plus its current numeric id. */
59064
+ var IdentityLinkSideSchema = object({
59065
+ addonId: string().min(1),
59066
+ stableId: string().min(1),
59067
+ deviceId: number$1().int()
59068
+ });
59069
+ var IdentityLinkSchema = object({
59070
+ kind: IdentityLinkKindSchema,
59071
+ a: IdentityLinkSideSchema,
59072
+ b: IdentityLinkSideSchema,
59073
+ state: IdentityLinkStateSchema,
59074
+ origin: IdentityLinkOriginSchema,
59075
+ /** The identifiers that matched when the link was last evaluated, ordered by key then value. */
59076
+ evidence: array(IdentityMatchedKeySchema).readonly(),
59077
+ /** An operator-confirmed link whose evidence no longer matches: kept, flagged. */
59078
+ evidenceGone: literal(true).optional(),
59079
+ createdAt: number$1().int().nonnegative(),
59080
+ decidedAt: number$1().int().nonnegative().optional()
59081
+ }).extend({ id: string().min(1) });
59082
+ DeviceRole.PoePort;
59083
+ /**
59084
+ * The answer of `device-manager.listIdentityLinks`. `not-loaded` until the
59085
+ * links have been read — never an empty list (D315).
59086
+ */
59087
+ var IdentityLinksReadSchema = discriminatedUnion("status", [object({
59088
+ status: literal("not-loaded"),
59089
+ reason: string()
59090
+ }), object({
59091
+ status: literal("answered"),
59092
+ links: array(IdentityLinkSchema).readonly()
59093
+ })]);
59094
+ /** Why an operator decision on a link was refused. */
59095
+ var IdentityLinkDecisionRefusalSchema = _enum([
59096
+ "not-loaded",
59097
+ "unknown-link",
59098
+ "wrong-state"
59099
+ ]);
59100
+ /** The answer of `confirmIdentityLink` / `dismissIdentityLink` / `unlinkIdentity`. */
59101
+ var IdentityLinkDecisionSchema = discriminatedUnion("ok", [object({
59102
+ ok: literal(true),
59103
+ link: IdentityLinkSchema
59104
+ }), object({
59105
+ ok: literal(false),
59106
+ reason: IdentityLinkDecisionRefusalSchema,
59107
+ message: string()
59108
+ })]);
59109
+ /** Why a link was lost. */
59110
+ var IdentityLinkLostReasonSchema = _enum([
59111
+ "evidence-gone",
59112
+ "device-removed",
59113
+ "operator-unlinked"
59114
+ ]);
59115
+ object({
59116
+ linkId: string(),
59117
+ kind: IdentityLinkKindSchema,
59118
+ aDeviceId: number$1().int(),
59119
+ bDeviceId: number$1().int(),
59120
+ origin: IdentityLinkOriginSchema,
59121
+ reason: IdentityLinkLostReasonSchema.optional()
59122
+ });
59012
59123
  var DeviceSearchRequiresSchema = object({
59013
59124
  /** Capability names the field wants a value of. Absent when the field wants actions only. */
59014
59125
  caps: array(string()).readonly().optional(),
@@ -59481,6 +59592,11 @@ var DeviceInfoSchema = object({
59481
59592
  * the owning provider via `setIdentifiers`; read-only for the operator.
59482
59593
  * Absent ⇒ the provider declared none. */
59483
59594
  identifiers: DeviceIdentifiersSchema.optional(),
59595
+ /** The identity of the device at the far end of this device's physical
59596
+ * link (D1059 amended by D1063) — a PoE port's wired client. Written only by
59597
+ * the owning provider via `setAttachedIdentifiers`; it never makes the two
59598
+ * devices the same device. Absent ⇒ none declared. */
59599
+ attachedIdentifiers: DeviceIdentifiersSchema.optional(),
59484
59600
  /** Optional upstream-system identity + rendering envelope. See
59485
59601
  * `SourceInfo` in `packages/types/src/device/source-info.ts`. */
59486
59602
  sourceInfo: SourceInfoSchema.optional(),
@@ -59634,6 +59750,8 @@ var DeviceMetaSchema = object({
59634
59750
  metadata: record(string(), unknown()).nullable().optional(),
59635
59751
  /** Provider-declared identifiers (D1059). See `DeviceMeta.identifiers`. */
59636
59752
  identifiers: DeviceIdentifiersSchema.optional(),
59753
+ /** The far end of the device's physical link (D1063). See `DeviceMeta.attachedIdentifiers`. */
59754
+ attachedIdentifiers: DeviceIdentifiersSchema.optional(),
59637
59755
  /** Optional upstream-system identity + rendering envelope. See
59638
59756
  * `SourceInfo`. Present when the device has been persisted with a
59639
59757
  * non-synthetic source identifier (HA entities, vendor MAC, …);
@@ -59958,6 +60076,26 @@ method(object({
59958
60076
  }), method(object({}), IdentityCandidatesSchema, {
59959
60077
  kind: "query",
59960
60078
  auth: "admin"
60079
+ }), method(object({
60080
+ deviceId: number$1(),
60081
+ identifiers: DeviceIdentifiersSchema.nullable(),
60082
+ /** Kinds the provider tried to read and could not: their stored value is kept. */
60083
+ unread: array(DeviceIdentifierKeySchema).optional()
60084
+ }), _void(), {
60085
+ kind: "mutation",
60086
+ auth: "admin"
60087
+ }), method(object({ deviceId: number$1().int().optional() }), IdentityLinksReadSchema, {
60088
+ kind: "query",
60089
+ auth: "admin"
60090
+ }), method(object({ linkId: string().min(1) }), IdentityLinkDecisionSchema, {
60091
+ kind: "mutation",
60092
+ auth: "admin"
60093
+ }), method(object({ linkId: string().min(1) }), IdentityLinkDecisionSchema, {
60094
+ kind: "mutation",
60095
+ auth: "admin"
60096
+ }), method(object({ linkId: string().min(1) }), IdentityLinkDecisionSchema, {
60097
+ kind: "mutation",
60098
+ auth: "admin"
59961
60099
  }), method(_void(), array(string())), method(object({ name: string() }), _void(), {
59962
60100
  kind: "mutation",
59963
60101
  auth: "admin"
@@ -60951,6 +61089,88 @@ confirmed: boolean().optional() }), record(string(), record(string(), record(str
60951
61089
  slice: record(string(), unknown())
60952
61090
  }));
60953
61091
  /**
61092
+ * Server-driven device state refresh (D1062): the core decides WHEN a device is
61093
+ * re-read, the integration only knows HOW.
61094
+ *
61095
+ * A provider states its policy where it registers the device's
61096
+ * `device-state-refresh` cap (`ctx.registerNativeCap(cap, provider, {
61097
+ * stateRefresh })`). It reaches the hub by the road the command-hold options
61098
+ * take (D1061): written directly in-process, carried on a forked child's cap
61099
+ * descriptors otherwise. Plain data, wire-safe.
61100
+ */
61101
+ /** Why the core asks for a refresh. */
61102
+ var StateRefreshReasonSchema = _enum([
61103
+ "schedule",
61104
+ "command",
61105
+ "burst"
61106
+ ]);
61107
+ /**
61108
+ * What arrives without asking: `none` (everything is read), `partial` (some
61109
+ * fields arrive by push, the rest is read on the schedule), `full` (everything
61110
+ * arrives by push — never read on a schedule).
61111
+ */
61112
+ var StateRefreshPushSchema = _enum([
61113
+ "none",
61114
+ "partial",
61115
+ "full"
61116
+ ]);
61117
+ object({
61118
+ /**
61119
+ * The integration instance the device belongs to. Devices of one instance
61120
+ * share one schedule group: a batching provider is asked once for all of
61121
+ * them, and the heartbeat is judged across them.
61122
+ */
61123
+ integrationId: string().min(1),
61124
+ /** The fastest interval the integration can afford for its devices. The core polls at it by default. */
61125
+ minIntervalMs: number$1().int().min(1e3),
61126
+ /**
61127
+ * The operator's per-integration setting, when there is one. It can only SLOW
61128
+ * the cadence: the core polls at `max(minIntervalMs, intervalMs)`.
61129
+ */
61130
+ intervalMs: number$1().int().positive().optional(),
61131
+ /** One `refresh` call can read every device of the integration at once. */
61132
+ batch: boolean(),
61133
+ push: StateRefreshPushSchema,
61134
+ /** Longest silence a push integration may keep before the core re-reads it and asks it to resubscribe. */
61135
+ heartbeatMs: number$1().int().positive().optional(),
61136
+ /**
61137
+ * Bumped by the provider each time its push subscription reconnected on its
61138
+ * own. A change makes the core re-read every device of the integration
61139
+ * (pushes lost while it was down; events may be dropped, D8).
61140
+ */
61141
+ connectionEpoch: number$1().int().nonnegative().optional()
61142
+ });
61143
+ /**
61144
+ * device-state-refresh — the HOW of a device's state refresh, called by the
61145
+ * core, which owns the WHEN (D1062).
61146
+ *
61147
+ * The provider registers it per device with its policy
61148
+ * (`registerNativeCap(cap, provider, { stateRefresh })`). The hub's scheduler
61149
+ * calls `refresh` on the schedule, after a command and in the burst that
61150
+ * follows it, and `resubscribe` when a push integration fell silent. The
61151
+ * provider re-reads and writes the slices it already writes; nothing is
61152
+ * returned but completion.
61153
+ */
61154
+ var DeviceStateRefreshInputSchema = object({
61155
+ /** The device the call is routed by (one of `deviceIds`). */
61156
+ deviceId: number$1().int().nonnegative(),
61157
+ /** Every device to re-read: one, or the integration's whole set when the provider batches. */
61158
+ deviceIds: array(number$1().int().nonnegative()).min(1),
61159
+ reason: StateRefreshReasonSchema
61160
+ });
61161
+ var DeviceStateResubscribeInputSchema = object({ deviceId: number$1().int().nonnegative() });
61162
+ var DeviceStateRefreshResultSchema = object({ ok: literal(true) });
61163
+ var NOT_OPERATOR_FACING = "the core schedules state refreshes itself; an operator never asks for one";
61164
+ method(DeviceStateRefreshInputSchema, DeviceStateRefreshResultSchema, {
61165
+ kind: "mutation",
61166
+ auth: "admin",
61167
+ notOperatorFacing: NOT_OPERATOR_FACING
61168
+ }), method(DeviceStateResubscribeInputSchema, DeviceStateRefreshResultSchema, {
61169
+ kind: "mutation",
61170
+ auth: "admin",
61171
+ notOperatorFacing: NOT_OPERATOR_FACING
61172
+ });
61173
+ /**
60954
61174
  * Generic device-level status snapshot. Auto-registered by `BaseDevice`
60955
61175
  * for every device, regardless of provider — the kernel needs a uniform
60956
61176
  * cap-keyed slice for the basic device flags every consumer expects to
@@ -94142,6 +94362,13 @@ Object.freeze({
94142
94362
  access: "create",
94143
94363
  role: "admin"
94144
94364
  },
94365
+ "deviceManager.confirmIdentityLink": {
94366
+ capName: "device-manager",
94367
+ capScope: "system",
94368
+ addonId: null,
94369
+ access: "create",
94370
+ role: "admin"
94371
+ },
94145
94372
  "deviceManager.createDevice": {
94146
94373
  capName: "device-manager",
94147
94374
  capScope: "system",
@@ -94191,6 +94418,13 @@ Object.freeze({
94191
94418
  access: "create",
94192
94419
  role: "admin"
94193
94420
  },
94421
+ "deviceManager.dismissIdentityLink": {
94422
+ capName: "device-manager",
94423
+ capScope: "system",
94424
+ addonId: null,
94425
+ access: "create",
94426
+ role: "admin"
94427
+ },
94194
94428
  "deviceManager.enable": {
94195
94429
  capName: "device-manager",
94196
94430
  capScope: "system",
@@ -94387,6 +94621,13 @@ Object.freeze({
94387
94621
  access: "view",
94388
94622
  role: "admin"
94389
94623
  },
94624
+ "deviceManager.listIdentityLinks": {
94625
+ capName: "device-manager",
94626
+ capScope: "system",
94627
+ addonId: null,
94628
+ access: "view",
94629
+ role: "admin"
94630
+ },
94390
94631
  "deviceManager.listLocationDescriptions": {
94391
94632
  capName: "device-manager",
94392
94633
  capScope: "system",
@@ -94583,6 +94824,13 @@ Object.freeze({
94583
94824
  access: "create",
94584
94825
  role: "admin"
94585
94826
  },
94827
+ "deviceManager.setAttachedIdentifiers": {
94828
+ capName: "device-manager",
94829
+ capScope: "system",
94830
+ addonId: null,
94831
+ access: "create",
94832
+ role: "admin"
94833
+ },
94586
94834
  "deviceManager.setChildLayout": {
94587
94835
  capName: "device-manager",
94588
94836
  capScope: "system",
@@ -94744,6 +94992,13 @@ Object.freeze({
94744
94992
  access: "create",
94745
94993
  role: "admin"
94746
94994
  },
94995
+ "deviceManager.unlinkIdentity": {
94996
+ capName: "device-manager",
94997
+ capScope: "system",
94998
+ addonId: null,
94999
+ access: "delete",
95000
+ role: "admin"
95001
+ },
94747
95002
  "deviceManager.updateConfig": {
94748
95003
  capName: "device-manager",
94749
95004
  capScope: "system",
@@ -95024,6 +95279,20 @@ Object.freeze({
95024
95279
  access: "create",
95025
95280
  role: "admin"
95026
95281
  },
95282
+ "deviceStateRefresh.refresh": {
95283
+ capName: "device-state-refresh",
95284
+ capScope: "device",
95285
+ addonId: null,
95286
+ access: "create",
95287
+ role: "admin"
95288
+ },
95289
+ "deviceStateRefresh.resubscribe": {
95290
+ capName: "device-state-refresh",
95291
+ capScope: "device",
95292
+ addonId: null,
95293
+ access: "create",
95294
+ role: "admin"
95295
+ },
95027
95296
  "deviceStatus.getStatus": {
95028
95297
  capName: "device-status",
95029
95298
  capScope: "device",
@@ -103290,6 +103559,11 @@ Object.freeze({
103290
103559
  form: "array",
103291
103560
  optional: true
103292
103561
  }],
103562
+ "deviceManager.listIdentityLinks": [{
103563
+ name: "deviceId",
103564
+ form: "single",
103565
+ optional: true
103566
+ }],
103293
103567
  "deviceManager.loadConfig": [{
103294
103568
  name: "deviceId",
103295
103569
  form: "single",
@@ -103340,6 +103614,11 @@ Object.freeze({
103340
103614
  form: "single",
103341
103615
  optional: false
103342
103616
  }],
103617
+ "deviceManager.setAttachedIdentifiers": [{
103618
+ name: "deviceId",
103619
+ form: "single",
103620
+ optional: false
103621
+ }],
103343
103622
  "deviceManager.setChildLayout": [{
103344
103623
  name: "deviceId",
103345
103624
  form: "single",
@@ -103534,6 +103813,20 @@ Object.freeze({
103534
103813
  form: "single",
103535
103814
  optional: false
103536
103815
  }],
103816
+ "deviceStateRefresh.refresh": [{
103817
+ name: "deviceId",
103818
+ form: "single",
103819
+ optional: false
103820
+ }, {
103821
+ name: "deviceIds",
103822
+ form: "array",
103823
+ optional: false
103824
+ }],
103825
+ "deviceStateRefresh.resubscribe": [{
103826
+ name: "deviceId",
103827
+ form: "single",
103828
+ optional: false
103829
+ }],
103537
103830
  "deviceStatus.getStatus": [{
103538
103831
  name: "deviceId",
103539
103832
  form: "single",
@@ -107342,7 +107635,7 @@ var AdminUIAddon = class extends BaseAddon {
107342
107635
  capability: adminUiCapability,
107343
107636
  provider: {
107344
107637
  getStaticDir: async () => ({ staticDir: resolveAdminUiDistDir() }),
107345
- getVersion: async () => ({ version: "1.2.697" })
107638
+ getVersion: async () => ({ version: "1.2.699" })
107346
107639
  }
107347
107640
  }];
107348
107641
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-admin-ui",
3
- "version": "1.2.697",
3
+ "version": "1.2.699",
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.898"
53
+ "server": ">=1.2.900"
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{Bn as d,Gt as f,Hi as p,In as m,Q as h,Tn as g,Tt as _,Vn as v,Xi as y,Yn as b,Zt as x,ct as ee,er as S,ft as C,hr as te,ia as ne,ot as w,sa as T,tn as E,wi as D,zr as O}from"./player-overlays-BwkSi_4-.js";import{cl as k}from"./client-jwdAAPeF.js";import{t as re}from"./chevron-down-CBb-F8DT.js";import{i as A,u as j}from"./terminal-DZ5OZpgC.js";import{Eo as ie,Gi as ae,Gp as oe,Hp as se,Ji as ce,So as le,To as M,Ui as ue,Wi as de,Yi as fe,Zl as N,_o as pe,_p as P,ai as F,ao as I,bo as me,ci as L,co as R,ct as z,do as B,go as V,ho as he,io as ge,ka as _e,lo as ve,lp as H,mi as ye,mo as U,mr as be,no as xe,oi as Se,oo as W,po as Ce,pr as we,qi as Te,rl as Ee,si as De,so as Oe,uo as ke,vt as Ae,wo as je,xo as Me,yo as Ne}from"./src-CTVIVqdZ.js";import{t as G}from"./useTranslation-BJr-n0es.js";import"./mount-CS9GUXwM.js";import{Si as Pe,bi as Fe,gi as Ie,mt as Le,pt as Re}from"./index-BAoWvnYw.js";import{t as K}from"./NodeAddonsSettingsPanel-DEfnyzvR.js";import{t as q}from"./AdminPage-CdTTxNI2.js";import{i as ze,r as Be,t as Ve}from"./addon-kind-filter-CEGKkC1O.js";import{n as J,r as He,t as Ue}from"./useNodeUrlSelection-DOGBUYEz.js";function We(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 Y=`a singleton role: Roles & nodes is the one picker for it`,X=[{cap:`pipeline-orchestrator`,addonId:`pipeline-orchestrator`,surface:`pipeline`,sectionIds:[`cluster-step-models`,`face-rescore`,`detail-crop`,`native-lease`,`load`,`failover`]},{cap:`pipeline-orchestrator`,addonId:`pipeline-orchestrator`,surface:`pipeline-roles`,fieldKeys:[`ingestNode`,`audioNode`,`motionNode`],reason:Y},{cap:`face-gallery`,addonId:`pipeline-analytics`,surface:`pipeline`},{cap:`stream-broker`,addonId:`stream-broker`,surface:`pipeline`},{cap:`snapshot`,addonId:`snapshot`,surface:`pipeline`},{cap:`recording`,addonId:`recorder`,surface:`pipeline`},{cap:`recording`,addonId:`recorder`,surface:`pipeline-roles`,fieldKeys:[`recordingNodeId`],reason:Y},{cap:`embedding-encoder`,addonId:`embedding-encoder`,surface:`pipeline`},{cap:`device-history`,addonId:`device-history`,surface:`history`},{cap:`alerts`,addonId:`alert-center`,surface:`notifications`},{cap:`metrics-provider`,addonId:`metrics-native`,surface:`nodes`},{cap:`login-method`,addonId:`auth-webauthn`,surface:`provider-page`},{cap:`llm`,addonId:`ai`,surface:`provider-page`},{cap:`log-destination`,addonId:`console-logging`,surface:`provider-page`},{cap:`core-blocks`,addonId:`core-blocks`,surface:`provider-page`},{cap:`custom-model-registry`,addonId:`model-studio`,surface:`addon-card`},{cap:`osd-manager`,addonId:`osd-manager`,surface:`addon-card`},{cap:`pipeline-analytics`,addonId:`pipeline-analytics`,surface:`addon-card`},{cap:`pipeline-analytics`,addonId:`pipeline-analytics`,surface:`pipeline-roles`,fieldKeys:[`postProcessingNodeId`],reason:Y},{cap:`detection-pipeline`,addonId:`detection-pipeline`,surface:`addon-card`}],Z={pipeline:`/system/pipeline?view=nodes&node=__cluster__&ctab=settings`,"pipeline-roles":`/system/pipeline?view=nodes&node=__cluster__&ctab=roles-nodes`,history:`/system/history`,notifications:`/system/notifications?tab=settings`,nodes:`/system/nodes`};function Ge(e){return e.sectionIds===void 0&&e.fieldKeys===void 0}function Ke(e){return X.filter(t=>t.addonId===e&&Z[t.surface]!==void 0)}function qe(e){let t=X.filter(t=>t.addonId===e),n=new Set(t.filter(e=>e.surface===`addon-card`&&Ge(e)).map(e=>e.cap));return{capabilities:[...new Set(t.map(e=>e.cap))].filter(e=>!n.has(e)),fieldKeys:t.filter(e=>n.has(e.cap)&&e.surface!==`addon-card`).flatMap(e=>e.fieldKeys??[])}}function Je({addonId:e,onOpen:n}){let{t:r}=G(),i=qe(e),o=Ke(e).length>0;return t(u,{children:[a(Ye,{addonId:e,onOpen:n}),a(K,{nodeId:null,addonIds:[e],level:`global`,fieldScope:`cluster`,omitCapabilities:i.capabilities,omitFieldKeys:i.fieldKeys,emptyMessage:o?r(`addons.addonCard.allClusterSettingsElsewhere`,`Its cluster-wide settings are on the page linked above.`):r(`addons.addonCard.thisAddonExposesNoCluster`,`This addon exposes no cluster-wide settings. Anything it can configure is per-node — open it from Cluster → the node → Settings.`)})]})}function Ye({addonId:e,onOpen:n}){let{t:r}=G(),i=[...new Set(Ke(e).map(e=>e.surface))];if(i.length===0)return null;let o=e=>{switch(e){case`pipeline`:return r(`addons.addonCard.surface.pipeline`,`Pipeline → Settings`);case`pipeline-roles`:return r(`addons.addonCard.surface.pipelineRoles`,`Pipeline → Roles & nodes`);case`history`:return r(`addons.addonCard.surface.history`,`History`);case`notifications`:return r(`addons.addonCard.surface.notifications`,`Notifications → Settings`);case`nodes`:return r(`addons.addonCard.surface.nodes`,`Nodes`);default:return e}};return t(`div`,{className:`mb-2 flex flex-wrap items-center gap-2 text-[10px] text-foreground-subtle`,children:[a(`span`,{children:r(`addons.addonCard.settingsElsewhere`,`More of this addon's settings are on:`)}),i.map(e=>{let t=Z[e];return t===void 0?null:a(H,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>n(t),children:o(e)},e)})]})}var Xe={queued:{icon:p,bg:`bg-muted text-foreground-subtle`,labelKey:`addons.addonRowBadge.queued`},updating:{icon:O,bg:`bg-primary/10 text-primary`,labelKey:`addons.addonRowBadge.updating`,spin:!0},"done-pending-restart":{icon:b,bg:`bg-amber-500/10 text-amber-700`,labelKey:`addons.addonRowBadge.pendingRestart`},done:{icon:T,bg:`bg-success/10 text-success`,labelKey:`addons.addonRowBadge.done`},failed:{icon:A,bg:`bg-danger/10 text-danger`,labelKey:`addons.addonRowBadge.failed`}};function Ze({item:e}){let{t:n}=G(),r=Xe[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 Q=new Set([`completed`,`failed`,`partially-failed`,`cancelled`]),Qe=new Set([`done`,`failed`,`skipped`]);function $e(e){return!Qe.has(e.phase)&&!Q.has(e.jobState)}function et(e,t){let n=new Map,r=[...e].sort((e,t)=>e.createdAtMs-t.createdAtMs);for(let e of r){let r=Q.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 tt(){let{data:e}=U({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 et([...n.values()],Date.now())},[e,t])}var nt={queued:{icon:p,cls:`bg-muted text-foreground-subtle`,labelKey:`addons.jobProgress.queued`},fetching:{icon:O,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.fetching`,spin:!0},staged:{icon:O,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.staged`,spin:!0},validating:{icon:O,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.validating`,spin:!0},applying:{icon:O,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.applying`,spin:!0},restarting:{icon:O,cls:`bg-amber-500/10 text-amber-600 dark:text-amber-400`,labelKey:`addons.jobProgress.restarting`,spin:!0},applied:{icon:O,cls:`bg-primary/10 text-primary`,labelKey:`addons.jobProgress.finalizing`,spin:!0},done:{icon:T,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:g,cls:`bg-muted text-foreground-subtle`,labelKey:`addons.jobProgress.skipped`}};function rt({progress:e}){let{t:n}=G(),r=nt[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 it(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 at(e){let t=e.version===null?``:` ${e.version}`,n=e.isOnline?``:` (offline: removed when it reconnects)`;return`- ${e.nodeName}${t}${n}`}function ot(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(at)];return n.length>0&&r.push(`Could not ask: ${n.join(`, `)} — not included.`),r.push(`This cannot be undone.`),r.join(`
2
- `)}function st(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 ct={uninstalled:`uninstalled`,"not-installed":`was not installed`,refused:`REFUSED`,failed:`FAILED`,"pending-reconnect":`offline — removed when it reconnects`};function lt(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)}: ${ct[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 ut={},dt=3e4,ft=`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 pt({packageName:e,displayName:n,selectedNode:r,hideNodeAction:i,disabled:o}){let{t:s}=G(),c=l(),u=ee(),d=w(),f=Ce(ut,{staleTime:dt}),p=f.data?.installations??[],m=(f.data?.unreachable??[]).map(e=>e.nodeId),h=it(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:lt(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:st(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=it(t.installations,e);await u({title:s(`addons.addonUninstallControls.uninstallEverywhere`,`Uninstall {{displayName}} everywhere?`,{displayName:n}),message:ot(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(H,{variant:`unstyled`,type:`button`,onClick:e=>{e.stopPropagation(),b()},disabled:S,className:ft,title:s(`addons.addonUninstallControls.uninstallFrom2`,`Uninstall from {{name}}`,{name:r.name}),children:[a(E,{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(H,{variant:`unstyled`,type:`button`,onClick:e=>{e.stopPropagation(),x()},disabled:S,className:ft,title:s(`addons.addonUninstallControls.uninstallFromEveryNodeThat`,`Uninstall from every node that has it`),children:[a(j,{className:`h-3 w-3`}),h.length>0?s(`addons.uninstallControls.everywhereCount`,{count:h.length}):s(`addons.uninstallControls.everywhere`)]})]})}function mt(e){return typeof e.deprecated==`string`&&e.deprecated.length>0}function ht(e,t){return t?e:e.filter(e=>e.distTags.includes(`latest`)||!mt(e))}function gt(e){return e.length-ht(e,!1).length}c();function _t({packageName:e,currentVersion:n,installSource:r,onInstall:i,onClose:o,onSelect:c,selectedVersion:l}){let{t:d}=G(),p=r===`upload`||r===`local`,[m,h]=s(!1),{data:g,isLoading:v,isError:y}=ve({name:e}),b=g?ht(g,m):[],x=g?gt(g):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:d(`addons.versionPicker.versions`,`Versions`)}),a(H,{variant:`unstyled`,type:`button`,onClick:o,className:`text-foreground-subtle hover:text-foreground`,children:a(_,{className:`h-3 w-3`})})]}),p&&t(`div`,{className:`flex items-start gap-2 px-3 py-2 border-b border-border bg-cyan-500/10 text-[10px]`,children:[a(f,{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:d(`addons.versionPicker.inPlace`,{kind:r===`upload`?d(`addons.versionPicker.uploadedCopy`,`Uploaded copy`):d(`addons.versionPicker.localCopy`,`Local copy`)})}),` `,a(Ie,{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(O,{className:`h-3.5 w-3.5 animate-spin`}),d(`addons.versionPicker.loadingVersions`,`Loading versions...`)]}),y&&a(`div`,{className:`px-3 py-4 text-center text-[10px] text-danger`,children:d(`addons.versionPicker.registryError`,`Could not load versions from the registry.`)}),b.length>0&&a(`div`,{className:`max-h-64 overflow-auto divide-y divide-border`,children:b.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),f=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:d(`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)),mt(e)&&a(`span`,{className:`text-[9px] text-red-400 line-through`,children:d(`common.deprecated`)}),a(`span`,{className:`text-[9px] text-foreground-subtle shrink-0`,children:new Date(e.publishedAt).toLocaleDateString()})]});return c?t(H,{variant:`unstyled`,type:`button`,"aria-label":d(`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:[f,o?a(T,{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:[f,a(H,{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?d(`addons.versionPicker.reInstallFromNpm`,`Re-install {{version}} from npm`,{version:e.version}):d(`addons.versionPicker.install`,`Install {{version}}`,{version:e.version}),children:a(D,{className:`h-3 w-3`})})]},e.version)})}),!v&&!y&&g&&g.length===0&&a(`div`,{className:`py-4 text-center text-[10px] text-foreground-subtle`,children:d(`addons.versionPicker.noVersionsFound`,`No versions found`)}),x>0&&a(H,{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:()=>h(e=>!e),children:m?d(`addons.versionPicker.hideOlder`,`Hide older versions`):d(`addons.versionPicker.showOlder`,`Show older versions ({{count}})`,{count:x})})]})}c();var vt=`device-export`;function yt(e){return e.capabilities.some(e=>(typeof e==`string`?e:e.name)===vt)}function bt(e){return e!==`local`&&e!==`upload`}function xt({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,d=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?h(`/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?``:d}`,style:u,children:m?a(`img`,{src:p,alt:r,className:`h-4 w-4`,onError:()=>l(!0)}):a(e?te:S,{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`}),bt(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(f,{className:`h-2.5 w-2.5 text-white`})})]})}function St({version:e,availableUpdate:n,selectedVersion:r,isUpdating:i,installSource:o,disabled:s,onUpdate:c,onOpenPicker:l,children:u}){let{t:d}=G();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(O,{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(H,{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(D,{className:`h-3 w-3`}),d(`addons.addonCard.update`,`Update`)]}),t(H,{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(re,{className:`h-3 w-3`})]}),u]})}return t(`div`,{className:`relative inline-flex items-center gap-1 shrink-0`,children:[t(H,{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(re,{className:`h-3 w-3 opacity-50`})]}),u]})}function Ct({addonId:e}){let t=l(),{data:n=`inherit`}=I({addonId:e}),r=Me({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(H,{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 wt={id:`hub`,name:`Hub`,isHub:!0};function Tt({addon:e,clusterStatus:n,hideVersion:r,availableUpdate:i,blockedUpdate:c,onUpdateServer:d,onUpdate:f,isUpdating:p,jobProgress:h,bundle:g,bulkItem:y,disabledByBulk:x,isSystem:ee,selectedNode:S}){let{t:C}=G(),[w,T]=s(!1),[E,D]=s(!1),[O,k]=s(null);o(()=>{k(null)},[i]);let j=O??i,[ie,oe]=s(!1),[se,le]=s(!1),[M,N]=s(`logs`),P=l(),F=Fe(),{manifest:I}=e,me=!g&&!I.protected&&I.removable!==!1,L=!!g,R=g?.displayName??I.name,z=g?.packageName??I.packageName,B=g?.version??I.packageVersion??I.version,V=g?.installSource??e.installSource,he=g?g.bundle?.description??g.addons[0]?.manifest.description:I.description,ge=pe({onSuccess:()=>{P.invalidateQueries({queryKey:[[`addons`]]})}}),ve=ke({onSuccess:()=>{P.invalidateQueries({queryKey:[[`addons`]]}),P.invalidateQueries({queryKey:[[`addonPages`]]}),P.invalidateQueries({queryKey:[[`capabilities`]]}),P.invalidateQueries({queryKey:[[`integrations`]]})}}),ye=Ne({onSuccess:()=>{P.invalidateQueries({queryKey:[[`addons`]]}),P.invalidateQueries({queryKey:[[`alerts`]]})}}),U=e.health,xe=U?.phase===`failed`&&!U.inGracePeriod,Se=xe&&U?.nextRetryAt&&!U.retrying,W=We(e.process);return t(`div`,{className:`rounded-md border bg-surface overflow-hidden ${xe?`border-red-500/50`:`border-border`}`,children:[xe&&U&&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:U.retryCount})}),a(`div`,{className:`text-[11px] text-foreground mt-0.5 break-words font-mono`,children:U.lastError?.message??C(`addons.addonCard.unknownError`,`Unknown error`)}),Se&&U.nextRetryAt&&a(`div`,{className:`text-[10px] text-foreground-subtle mt-1`,children:C(`addons.addonCard.autoRetryAt`,{time:new Date(U.nextRetryAt).toLocaleTimeString()})})]}),t(H,{variant:`unstyled`,type:`button`,disabled:ye.isPending||U.retrying,onClick:e=>{e.stopPropagation(),ye.mutate({packageName:z})},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(b,{className:`h-3 w-3 ${ye.isPending||U.retrying?`animate-spin`:``}`}),C(`addons.addonCard.retryNow`,`Retry now`)]})]}),W!==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.${W.kind}`)}),W.reason!==void 0&&a(`div`,{className:`text-[11px] text-foreground mt-0.5 break-words font-mono`,children:W.reason})]})]}),t(`div`,{className:`flex items-start gap-2.5 px-3 py-2`,children:[a(xt,{isBundle:L||!!I.components&&I.components.length>1,installSource:V,addonId:L?g.addons[0]?.manifest.id:I.id,iconPath:L?g.bundle?.icon??g.addons[0]?.manifest.icon:I.icon,color:L?g.addons[0]?.manifest.color:I.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:R}),!r&&a(St,{version:B,availableUpdate:i,...j===void 0?{}:{selectedVersion:j},isUpdating:p,installSource:V,disabled:x,...f&&j!==void 0?{onUpdate:()=>f(j)}:{},onOpenPicker:()=>D(e=>!e),children:E&&a(_t,{packageName:z,currentVersion:B,...V?{installSource:V}:{},...i!==void 0&&j!==void 0?{selectedVersion:j,onSelect:e=>{k(e),D(!1)}}:{},onInstall:e=>{D(!1),ve.mutate({packageName:z,version:e})},onClose:()=>D(!1)})})]}),t(`div`,{className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 mt-0.5`,children:[z!==R&&a(`span`,{className:`text-[10px] text-foreground-subtle font-mono truncate max-w-full`,children:z}),L&&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(te,{className:`h-3 w-3`}),g.addons.length]}),ee&&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(b,{className:`h-3 w-3`}),C(`addons.addonCard.system`,`System`)]}),y!=null&&a(Ze,{item:y}),c!==void 0&&a(_e,{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})}),c!==void 0&&d!==void 0&&a(H,{type:`button`,size:`sm`,variant:`secondary`,onClick:d,children:C(`clusterUpdate.updateServer`,`Update server`)}),h!=null&&a(rt,{progress:h})]}),he&&a(`p`,{className:`text-[10px] text-foreground-subtle mt-1 line-clamp-1`,children:he}),!L&&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`:W===null?`bg-gray-500/15 text-gray-400`:`bg-red-500/15 text-red-400`}`,children:e.process.state})]})]})]}),!L&&t(`div`,{className:`flex items-center gap-1 px-3 py-1 border-t border-border/50 bg-surface-hover/20`,children:[t(H,{variant:`unstyled`,type:`button`,onClick:e=>{e.stopPropagation(),ge.mutate({addonId:I.id})},disabled:ge.isPending||x,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(b,{className:`h-3 w-3 ${ge.isPending?`animate-spin`:``}`}),C(`addons.addonCard.restart`,`Restart`)]}),t(H,{variant:`unstyled`,type:`button`,onClick:e=>{e.stopPropagation(),oe(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(v,{className:`h-3 w-3`}),C(`addons.addonCard.logs`,`Logs`)]}),!L&&t(H,{variant:`unstyled`,type:`button`,onClick:e=>{e.stopPropagation(),le(!0)},className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-medium border transition-colors ${se?`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(m,{className:`h-3 w-3`}),C(`addons.addonCard.settings`,`Settings`)]}),a(`div`,{className:`flex-1`}),me&&a(pt,{packageName:I.packageName,displayName:I.name,selectedNode:S??wt,disabled:x})]}),n&&n.nodes.length>1&&!L&&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&&!L&&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(H,{variant:`unstyled`,type:`button`,onClick:()=>N(`logs`),className:`px-2 py-0.5 transition-colors ${M===`logs`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:C(`addons.addonCard.logs`,`Logs`)}),a(H,{variant:`unstyled`,type:`button`,onClick:()=>N(`events`),className:`px-2 py-0.5 border-l border-border transition-colors ${M===`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(H,{variant:`unstyled`,type:`button`,onClick:e=>{e.stopPropagation(),oe(!1)},className:`text-foreground-subtle hover:text-foreground`,children:a(_,{className:`h-3.5 w-3.5`})})]}),M===`logs`&&a(be,{addonId:I.id,maxHeight:`max-h-64`,showFilters:!1}),M===`events`&&a(we,{addonId:I.id,category:`addon.*`,maxHeight:`max-h-64`})]}),L&&t(u,{children:[a(H,{variant:`unstyled`,type:`button`,onClick:()=>T(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?ne:re,{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:g.addons.map(e=>a(Tt,{addon:e,hideVersion:!0},e.manifest.id))})]}),se&&!L&&a(ue,{open:!0,onOpenChange:e=>!e&&le(!1),children:t(ae,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,children:[a(ce,{children:t(fe,{className:`flex items-center gap-2`,children:[a(m,{className:`h-4 w-4 text-primary`}),C(`addons.addonCard.settingsTitle`,{name:R})]})}),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(Je,{addonId:I.id,onOpen:e=>F(e)}),yt(I)&&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(Ae,{addonId:I.id,onOpenDevice:e=>F(`/devices/${e}`)})]}),bt(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(Ct,{addonId:I.id})]}),I.components&&I.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:I.components.length})}),a(`div`,{className:`flex flex-wrap gap-1`,children:I.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(Te,{children:a(H,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>le(!1),children:C(`common.close`,`Close`)})})]})})]})}c();var Et=`.tgz,.tar.gz,.zip`;function Dt({onUploadSuccess:e}){let{t:r}=G(),[o,c]=s(!1),l=n(null),d=i(async t=>{c(!0);let n=new FormData;n.append(`file`,t);let r=localStorage.getItem(`camstack_admin_token`)??``;try{(await(await fetch(h(`/api/addons/upload`),{method:`POST`,headers:{Authorization:`Bearer ${r}`},body:n})).json()).success&&e()}finally{c(!1)}},[e]);return t(u,{children:[a(ye,{ref:l,accept:Et,onChange:i(e=>{let t=e.target.files?.[0];t&&d(t),e.target.value=``},[d]),className:`hidden`}),t(H,{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(O,{className:`w-3.5 h-3.5 animate-spin`}):a(f,{className:`w-3.5 h-3.5`}),o?r(`addons.addonUploadZone.uploading`,`Uploading...`):r(`addons.addonUploadZone.upload`,`Upload`)]})]})}var Ot=/```[^\n]*\n([\s\S]*?)```/g;function kt(e){let t=[],n=0;for(let r of e.matchAll(Ot)){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 At(e){let t=e.trim();return t.startsWith(`https://`)||t.startsWith(`http://`)?t:null}function jt(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?At(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 Mt(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:jt(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:jt(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=jt(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 Nt({markdown:e}){return a(`div`,{className:`text-xs text-foreground leading-relaxed`,children:kt(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:Mt(e.body,`b${t}`)},`text-${t}`))})}c();function Pt(e){return e.replace(/^@camstack\/(addon-)?/,``)}function Ft(e,t,n){let r=ht(e,n);return r.some(e=>e.version===t)?r:[{version:t,distTags:[],deprecated:void 0},...r]}function It({pending:e,failed:n,body:r,missing:i}){let{t:o}=G();return e?t(`div`,{className:`flex items-center gap-2 py-6 text-xs text-foreground-subtle`,children:[a(O,{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(Nt,{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 Lt({target:e,installing:n,installError:r,onClose:i,onInstall:o}){let{t:c}=G(),[l,u]=s(e.version),[d,f]=s(!1),p=ve({name:e.name}),m=R({name:e.name,version:l}),h=p.data??[],g=gt(h),_=Ft(h,l,d),v=m.data;return a(ue,{open:!0,onOpenChange:e=>!e&&i(),children:t(ae,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,children:[a(ce,{children:a(fe,{children:c(`addons.installDialog.title`,`Install {{name}}`,{name:Pt(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(C,{"aria-label":c(`addons.installDialog.version`,`Version`),value:l,options:_.map(e=>({value:e.version,label:mt(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(H,{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(F,{defaultValue:`readme`,children:[t(De,{children:[a(L,{value:`readme`,children:c(`addons.installDialog.readme`,`README`)}),a(L,{value:`changelog`,children:c(`addons.installDialog.changelog`,`CHANGELOG`)})]}),a(Se,{value:`readme`,children:a(`div`,{className:`max-h-80 overflow-auto rounded-md border border-border bg-background p-3`,children:a(It,{pending:m.isPending,failed:m.isError,body:v?.readme,missing:c(`addons.installDialog.missingReadme`,`This package has no README.`)})})}),a(Se,{value:`changelog`,children:a(`div`,{className:`max-h-80 overflow-auto rounded-md border border-border bg-background p-3`,children:a(It,{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(Te,{children:[a(H,{type:`button`,variant:`outline`,size:`sm`,onClick:i,children:c(`common.cancel`,`Cancel`)}),a(H,{type:`button`,size:`sm`,disabled:n||l.length===0,onClick:()=>o(e.name,l),children:n?a(O,{className:`h-3.5 w-3.5 animate-spin`}):c(`addons.installDialog.install`,`Install`)})]})]})})}function Rt(e,t){let n=new Map;for(let r of e){if(r.isHub||r.onHub||Le(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 zt({selectedNode:e}){let{t:n}=G(),{data:r}=Ce(ut,{staleTime:dt});if(r===void 0)return null;let i=Rt(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(x,{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(pt,{packageName:n.packageName,displayName:n.packageName,selectedNode:e,hideNodeAction:e.isHub})]},n.packageName))]})}function Bt({addon:e,installing:n,onInstall:r}){let{t:i}=G();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(_e,{variant:`success`,icon:a(T,{className:`h-3 w-3`}),children:e.installedVersion??i(`system.capabilityCatalog.installed`,`Installed`)}):t(H,{size:`sm`,onClick:()=>r(e),disabled:n,className:`shrink-0`,children:[n?a(O,{className:`h-3 w-3 animate-spin`}):a(D,{className:`h-3 w-3`}),i(`system.capabilityCatalog.install`,`Install`)]})]})}function Vt({capability:e,installing:n,onInstall:r}){let{t:i}=G(),{data:o,isPending:s,isError:c}=me({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(O,{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(Bt,{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 Ht(e){return e===`npm`||e===`dev`?e:null}var Ut=`rounded-full border border-primary bg-primary/10 px-2 py-0.5 text-[10px] text-foreground`,Wt=`rounded-full border border-border px-2 py-0.5 text-[10px] text-foreground-muted hover:bg-surface-hover`,Gt=[{seconds:900,label:`15m`},{seconds:3600,label:`1h`},{seconds:21600,label:`6h`},{seconds:43200,label:`12h`},{seconds:86400,label:`24h`}],Kt={id:`hub`,name:`Hub`,isHub:!0,isOnline:!0};function qt(e,t){let n=e??`hub-only`;return n===`any-node`?!0:n===`hub-only`?t:!t}function Jt(e){return e===`local`?`dev`:`npm`}function Yt(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 Xt(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 Zt({addons:c,clusterStatus:u,selectedNode:f,onRefresh:p,listPhase:m}){let{t:h}=G(),g=l(),[_,v]=s(``),[x,S]=s(!1),te=e(_),[ne,w]=s(!1),T=n(null);o(()=>{if(!ne)return;let e=e=>{T.current&&!T.current.contains(e.target)&&w(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[ne]);let{data:E}=he({nodeId:f.id}),k=r(()=>{let e=new Map;for(let t of E??[])t.blockedBy===void 0&&e.set(t.name,t.latestVersion);return e},[E]),re=r(()=>{let e=new Map;for(let t of E??[]){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},[E]),A=r(()=>(E??[]).filter(e=>!e.isSystem&&e.blockedBy===void 0).length,[E]),[j,ae]=s(()=>new Set),[oe,se]=s(()=>new Map),ce=i(e=>{ae(t=>new Set(t).add(e))},[]),M=i(e=>{ae(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n})},[]),ue=i((e,t)=>{se(n=>new Map(n).set(e,t))},[]),de=i(e=>{se(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),fe=ie({onMutate:e=>{ce(e.name),de(e.name)},onSuccess:(e,t)=>{M(t.name);let n=e;if(n&&n.success===!1){ue(t.name,n.error??`Update failed (no error message returned by server)`);return}g.invalidateQueries({queryKey:[[`addons`]]}),g.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]})},onError:(e,t)=>{M(t.name),ue(t.name,e instanceof Error?e.message:String(e))}}),N=tt(),pe=n(new Set);o(()=>{let e=new Set;for(let[t,n]of N)$e(n)&&e.add(t);let t=[...pe.current].some(t=>!e.has(t));pe.current=e,t&&(g.invalidateQueries({queryKey:[[`addons`]]}),g.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]}))},[N,g]);let{data:F}=W(void 0),I=xe({onSuccess:()=>{g.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),L=le({onSuccess:()=>{g.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),{data:R,isFetching:z}=me({query:te||void 0},{enabled:ne}),B=je(),{data:V}=Oe(void 0),ge=V?.requestedAt,[_e,ve]=s(null),[ye,U]=s(!1);o(()=>{if(V?.kind===`framework-bulk-update`&&V.requestedAt!==_e){ve(V.requestedAt),U(!0);let e=window.setTimeout(()=>U(!1),6e3);return()=>window.clearTimeout(e)}},[ge,_e,V]),ee();let be=i(async()=>{let e=(E??[]).filter(e=>!e.isSystem&&e.blockedBy===void 0);if(e.length!==0){if(!f.isHub){for(let t of e)await fe.mutateAsync({name:t.name,version:t.latestVersion,nodeId:f.id});return}await B.mutateAsync({kind:`update`,targets:e.map(e=>({name:e.name,version:e.latestVersion})),nodeIds:[f.id]})}},[E,f.id,f.isHub,B,fe]),[Se,Ce]=s(null),[we,Te]=s(null),De=e=>{Te(null),Ce(e)},Ae=ke({onSuccess:()=>{Ce(null),Te(null),g.invalidateQueries({queryKey:[[`addons`]]}),g.invalidateQueries({queryKey:[[`addonPages`]]}),g.invalidateQueries({queryKey:[[`capabilities`]]}),g.invalidateQueries({queryKey:[[`integrations`]]})},onError:e=>{Te(e instanceof Error?e.message:`Install failed`)}}),[Me,Ne]=s(`type`),[Fe,Ie]=s(()=>typeof window>`u`?`grouped`:window.localStorage.getItem(`camstack.addons.viewMode`)===`flat`?`flat`:`grouped`),Le=e=>{Ie(e),typeof window<`u`&&window.localStorage.setItem(`camstack.addons.viewMode`,e)},[K,q]=Pe(),J=K.get(`capability`),Ue=K.get(`updatable`)===`1`,Y=K.get(`error`)===`1`,X=Ht(K.get(`source`)),Z=ze(K.get(Ve))===`integration`,{data:Ge}=Ee(void 0,{enabled:Z}),Ke=r(()=>Ge===void 0?null:new Set(Ge.map(e=>e.addonId)),[Ge]),qe=i(e=>{let t=new URLSearchParams(K);e?t.set(Ve,`integration`):t.delete(Ve),q(t,{replace:!0})},[K,q]),Je=i(e=>{let t=new URLSearchParams(K);e?t.set(`updatable`,`1`):t.delete(`updatable`),q(t,{replace:!0})},[K,q]),Ye=i(e=>{let t=new URLSearchParams(K);e?t.set(`error`,`1`):t.delete(`error`),q(t,{replace:!0})},[K,q]),Xe=i(e=>{let t=new URLSearchParams(K);e===null?t.delete(`source`):t.set(`source`,e),q(t,{replace:!0})},[K,q]),Ze=r(()=>c.filter(e=>We(e.process)!==null).length,[c]),Q=r(()=>{let e=c.filter(e=>!Re(e.manifest.packageName));return f.isHub||(e=e.filter(e=>qt(e.placement,f.isHub))),J&&(e=e.filter(e=>(e.manifest.capabilities??[]).some(e=>(typeof e==`string`?e:e.name)===J))),Z&&(e=[...Be(e,Ke)]),Ue&&(e=e.filter(e=>{let t=e.manifest.packageName;return t!==void 0&&k.has(t)})),X!==null&&(e=e.filter(e=>Jt(e.installSource)===X)),Y&&(e=e.filter(e=>We(e.process)!==null)),e},[c,f.isHub,J,Ue,X,Y,Z,Ke,k]),Qe=()=>{let e=new URLSearchParams(K);e.delete(`capability`),q(e,{replace:!0})},et=Fe===`flat`?Q:Xt(Q),nt=r(()=>{let e=[...et];switch(Me){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},[et,Me]);return t(`div`,{className:`space-y-3`,children:[a(He,{open:x,onOpenChange:S}),[...oe.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:h(`systemPage.addons.updateFailed`,{name:e})}),a(`div`,{className:`text-foreground-subtle font-mono`,children:n})]}),a(H,{variant:`unstyled`,type:`button`,onClick:()=>de(e),className:`text-foreground-subtle hover:text-foreground text-[10px]`,children:h(`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:h(`admin.system.addons.sort`,`Sort:`)}),t(C,{wrapperClassName:`inline-block w-auto`,value:Me,onChange:e=>Ne(e.target.value),children:[a(`option`,{value:`type`,children:h(`admin.system.addons.bundlesFirst`,`Bundles first`)}),a(`option`,{value:`name`,children:h(`admin.system.addons.name`,`Name`)}),a(`option`,{value:`source`,children:h(`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:h(`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(H,{variant:`unstyled`,type:`button`,onClick:()=>Le(e),className:`px-2 py-1 transition-colors capitalize ${Fe===e?`bg-primary/10 text-primary`:`bg-transparent text-foreground-subtle hover:bg-surface-hover`}`,title:e===`grouped`?h(`admin.system.addons.groupMultiAddonPackagesInto`,`Group multi-addon packages into a bundle card`):h(`admin.system.addons.showEveryAddonAsIts`,`Show every addon as its own card`),children:e},e))})]}),f.isHub&&t(`div`,{className:`flex items-center gap-1.5`,children:[a(b,{className:`h-3 w-3 text-foreground-subtle`}),a(`span`,{className:`text-[10px] text-foreground-subtle`,children:h(`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(H,{variant:`unstyled`,type:`button`,onClick:()=>I.mutate({channel:e}),disabled:I.isPending,className:`px-2 py-1 transition-colors capitalize ${F?.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))})]}),f.isHub&&t(`div`,{className:`flex items-center gap-1.5`,children:[a(`span`,{className:`text-[10px] text-foreground-subtle`,children:h(`admin.system.addons.checkEvery`,`Check every:`)}),a(C,{wrapperClassName:`inline-block w-auto`,className:`font-medium text-foreground-subtle`,value:F?.updateCheckIntervalSeconds??21600,disabled:L.isPending||F===void 0,onChange:e=>{F!==void 0&&L.mutate({channel:F.channel,updateCheckIntervalSeconds:Number(e.target.value)})},children:Gt.map(e=>a(`option`,{value:e.seconds,children:e.label},e.seconds))})]}),A>0&&t(H,{variant:`unstyled`,type:`button`,onClick:()=>void be(),disabled:B.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:[B.isPending?a(O,{className:`w-3 h-3 animate-spin`}):a(D,{className:`w-3 h-3`}),B.isPending?h(`admin.system.addons.updating`,`Updating…`):h(`admin.system.addons.updateAll`,`Update All ({{nonSystemUpdateCount}})`,{nonSystemUpdateCount:A})]})]}),t(`div`,{className:`flex flex-wrap items-center gap-1.5`,role:`group`,"aria-label":h(`admin.system.addons.filterInstalledAddons`,`Filter installed addons`),children:[a(`span`,{className:`text-[10px] text-foreground-subtle`,children:h(`admin.system.addons.filter`,`Filter:`)}),[{id:`integrations`,label:h(`admin.system.addons.integrations`,`Integrations`),pressed:Z,toggle:()=>qe(!Z)},{id:`updatable`,label:h(`admin.system.addons.updatable`,`Updatable`),pressed:Ue,toggle:()=>Je(!Ue)},{id:`error`,label:h(`admin.system.addons.inError`,`In error ({{count}})`,{count:Ze}),pressed:Y,toggle:()=>Ye(!Y)},{id:`npm`,label:`npm`,pressed:X===`npm`,toggle:()=>Xe(X===`npm`?null:`npm`)},{id:`dev`,label:h(`admin.system.addons.dev`,`Dev`),pressed:X===`dev`,toggle:()=>Xe(X===`dev`?null:`dev`)}].map(e=>a(H,{variant:`unstyled`,type:`button`,"aria-pressed":e.pressed,onClick:e.toggle,className:e.pressed?Ut:Wt,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:T,children:[a(P,{type:`text`,searchHotkey:!0,value:_,onChange:e=>{v(e.target.value),w(!0)},onFocus:()=>w(!0),placeholder:h(`admin.system.addons.searchAddonsOnNpm`,`Search addons on npm...`),"aria-label":h(`admin.system.addons.searchAddonsOnNpm2`,`Search addons on npm`),disabled:B.isPending,leftSlot:a(d,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),rightSlot:z?a(O,{className:`h-3 w-3 animate-spin`}):void 0}),ne&&R&&R.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:[R.length>0&&a(`div`,{className:`px-3 py-1.5 text-[10px] uppercase tracking-wide text-foreground-subtle border-b border-border`,children:h(`systemPage.addons.npmResults`,{count:R.length})}),R&&R.length>0&&a(`div`,{className:`max-h-72 overflow-auto divide-y divide-border`,children:R.map(e=>a(Bt,{addon:e,installing:Ae.isPending,onInstall:e=>De({name:e.name,version:e.version,description:e.description})},e.name))})]})]}),a(Dt,{onUploadSuccess:()=>{g.invalidateQueries({queryKey:[[`addons`]]}),p()}})]}),J&&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:h(`admin.system.addons.filteringByCapability`,`Filtering by capability:`)}),a(`span`,{className:`font-mono text-primary font-semibold`,children:J}),a(H,{variant:`unstyled`,type:`button`,onClick:Qe,className:`ml-auto text-xs text-foreground-subtle hover:text-foreground underline`,children:h(`admin.system.addons.clear`,`Clear`)})]}),J&&a(Vt,{capability:J,installing:Ae.isPending,onInstall:e=>De({name:e.name,version:e.version,description:e.description})}),J&&Q.length>0&&a(`h2`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:h(`admin.system.addons.installed`,`Installed`)}),ye&&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(y,{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:h(`admin.system.addons.bulkUpdateCompleted`,`Bulk update completed`)}),a(`div`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:h(`admin.system.addons.systemPackagesUpdatedHubRestarted`,`System packages updated — hub restarted successfully.`)})]})]}),m===`pending`&&t(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[a(O,{className:`h-3 w-3 animate-spin`}),h(`admin.system.addons.loadingInstalled`,`Loading installed addons…`)]}),m===`error`&&a(`div`,{className:`text-xs text-danger`,children:h(`admin.system.addons.failedToLoadAddons`,`Failed to load addons`)}),m===`ready`&&Q.length===0&&a(`div`,{className:`text-xs text-foreground-subtle`,children:c.length===0?h(`admin.system.addons.noAddonsInstalled`,`No addons installed`):J?h(`admin.system.addons.noInstalledAddonDeclaresThe`,`No installed addon declares the "{{capabilityFilter}}" capability. Any addon you can install appears under "Available to install" above.`,{capabilityFilter:J}):h(`admin.system.addons.noAddonsCompatibleWithPlacement`,`No addons compatible with {{name}} (placement filter active)`,{name:f.name})}),a(`div`,{className:`space-y-1.5`,children:m===`ready`&&nt.map(e=>{let t=$(e)?e.bundle.packageName:e.manifest.packageName,n=k.get(t),r=re.get(t),i=$(e)?e.representative:e,o=n?e=>fe.mutate({name:t,version:e,nodeId:f.id}):void 0,s=N.get(t)??null,c=s!==null&&$e(s);return a(Tt,{addon:i,clusterStatus:u?.[i.manifest.id],bundle:$(e)?e.bundle:void 0,availableUpdate:n,...r===void 0?{}:{blockedUpdate:r},...r===void 0?{}:{onUpdateServer:()=>S(!0)},isUpdating:j.has(t)||c,jobProgress:s,onUpdate:o,disabledByBulk:B.isPending,selectedNode:f},$(e)?t:e.manifest.id)})}),Se!==null&&a(Lt,{target:Se,installing:Ae.isPending,installError:we,onClose:()=>Ce(null),onInstall:(e,t)=>Ae.mutate({packageName:e,version:t})})]})}function Qt(){let{t:e}=G(),r=l(),{data:i}=N(void 0),{nodes:s}=se(),{selection:c,selectNode:u,requestedNodeId:d}=Ue(s.length>0?s:[Kt]),f=c.node??Kt,p=f.id,m=s.length>0?c.staleNodeId:null,{data:h,isLoading:g,isError:_}=B({nodeId:p}),v=ge(),y=V(),x=v.isPending||y.isPending,ee=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 te=(h??[]).map(Yt).filter(e=>e!==null);return t(q,{children:[t(`div`,{className:`flex items-center justify-between gap-2 flex-wrap`,children:[a(z,{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:te.length})}),t(H,{variant:`unstyled`,type:`button`,onClick:()=>void ee(),disabled:x,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(b,{className:`w-3 h-3 ${x?`animate-spin`:``}`}),e(`admin.system.addons.checkForUpdates`,`Check for updates`)]})]})]}),a(J,{staleNodeId:m,shownNodeName:f.name}),a(zt,{selectedNode:f}),a(Zt,{addons:te,clusterStatus:i,selectedNode:f,onRefresh:()=>void ee(),listPhase:g?`pending`:_?`error`:`ready`})]})}export{Qt as AddonsPage};