@camstack/addon-admin-ui 1.1.53 → 1.1.55

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 (94) hide show
  1. package/dist/assets/{AddLocationWizard-B2-uyYmP.js → AddLocationWizard-DKMFqTvZ.js} +1 -1
  2. package/dist/assets/{AddonCollectionPage-FU3E6QGz.js → AddonCollectionPage-B7r7RnCS.js} +1 -1
  3. package/dist/assets/Addons-DjQMioo-.js +1 -0
  4. package/dist/assets/{AdminTabs-CICieyaN.js → AdminTabs-DsU1olLw.js} +1 -1
  5. package/dist/assets/{AiProfiles-BRTUYeoH.js → AiProfiles-DbcBYG7x.js} +1 -1
  6. package/dist/assets/{BrokerForm-CuIg_iOf.js → BrokerForm-Bof3-RsO.js} +1 -1
  7. package/dist/assets/{Capabilities-CEZc9Dcc.js → Capabilities-CpM6R2iG.js} +1 -1
  8. package/dist/assets/{CapabilityBadges-DDSnGBgk.js → CapabilityBadges-CrG_Gpq2.js} +1 -1
  9. package/dist/assets/{Cluster-DjZVaBCZ.js → Cluster-DGYFlvd-.js} +1 -1
  10. package/dist/assets/{Dashboard-CLWVhKF4.js → Dashboard-BLwnF4KK.js} +1 -1
  11. package/dist/assets/{Data-aqRyEVJp.js → Data-mjlU3tOI.js} +1 -1
  12. package/dist/assets/{DetectionIntelligence-Bvw_e-lH.js → DetectionIntelligence-BF7VOXIn.js} +1 -1
  13. package/dist/assets/DeviceDetail-DHxFHQzX.js +2 -0
  14. package/dist/assets/{Devices-CZ_Moh5w.js → Devices-1MpXBj6n.js} +1 -1
  15. package/dist/assets/{EmbedPlayerPage-DAeQe0Bf.js → EmbedPlayerPage-BG2XDJsy.js} +1 -1
  16. package/dist/assets/{Events-OajEJc_n.js → Events-cycfxpUn.js} +1 -1
  17. package/dist/assets/FormBuilder-1_hLh6UD.js +1 -0
  18. package/dist/assets/Identity-DIIHY4_I.js +1 -0
  19. package/dist/assets/IntegrationDetail-ByT41Y57.js +1 -0
  20. package/dist/assets/{Integrations-CMT2Jroo.js → Integrations-D2UQlymQ.js} +1 -1
  21. package/dist/assets/Integrations-uUU6I8AA.js +1 -0
  22. package/dist/assets/{Logs-BTWVO572.js → Logs-DklB9pQr.js} +1 -1
  23. package/dist/assets/{MotionZonesSettings-BWhNWsPJ.js → MotionZonesSettings-Cv4ArwMh.js} +1 -1
  24. package/dist/assets/{MyAccess-CJLeYWfN.js → MyAccess-DreWB3nL.js} +1 -1
  25. package/dist/assets/Network-WAC7AOhT.js +1 -0
  26. package/dist/assets/{NodeAddonsSettingsPanel-BQWXa7vq.js → NodeAddonsSettingsPanel-adQJWpFA.js} +1 -1
  27. package/dist/assets/{NotificationTargets-DqrqQvJN.js → NotificationTargets-BqY-ixcT.js} +1 -1
  28. package/dist/assets/Pipeline-8ill1YGg.js +1 -0
  29. package/dist/assets/{Plates-Cy7kPDK4.js → Plates-BDN77UjR.js} +1 -1
  30. package/dist/assets/{PrivacyMaskSettings-DTEI02Vz.js → PrivacyMaskSettings-DtvQVzUm.js} +1 -1
  31. package/dist/assets/{ProviderIcon-Ba4DQXPs.js → ProviderIcon-BvqTmUAe.js} +1 -1
  32. package/dist/assets/ScanNetworkModal-7FD7LPU3.js +1 -0
  33. package/dist/assets/{Settings-BxK0kuED.js → Settings-Bal6O--f.js} +1 -1
  34. package/dist/assets/{Showroom-BLBcs7XJ.js → Showroom-CRdx2BE1.js} +1 -1
  35. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-jFLPXlhw.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-ByenDxWa.js} +1 -1
  36. package/dist/assets/{build-cluster-graph-CIiqGgZL.js → build-cluster-graph-DGTSGb1I.js} +2 -2
  37. package/dist/assets/circle-check-big-CxoqUJ4a.js +1 -0
  38. package/dist/assets/clock-ByHlQpk3.js +1 -0
  39. package/dist/assets/{copy-CTAQpm07.js → copy-BFZ5D4BJ.js} +1 -1
  40. package/dist/assets/{debounced-invalidate-DZ3oxQDl.js → debounced-invalidate-B_KsAVGD.js} +1 -1
  41. package/dist/assets/{dist-BMrXztkM.js → dist-CqgNHN-E.js} +1 -1
  42. package/dist/assets/dist-DcJZn370.js +7 -0
  43. package/dist/assets/{download-DjYX33pK.js → download-5vnInJfp.js} +1 -1
  44. package/dist/assets/{face-bbox-vlSxiLet.js → face-bbox-VcgOLkvN.js} +1 -1
  45. package/dist/assets/{film-lIXZ0TIf.js → film-FBIr-9R4.js} +1 -1
  46. package/dist/assets/{hostInit-BhKkSxQn.js → hostInit-BKkxJ9TG.js} +1 -1
  47. package/dist/assets/index-B0VBnS5H.js +4 -0
  48. package/dist/assets/{key-round-D6koQlXg.js → key-round-76xRX3g6.js} +1 -1
  49. package/dist/assets/{mf-entry-bootstrap-0-1af432ca.js → mf-entry-bootstrap-0-4ee9f7b7.js} +2 -2
  50. package/dist/assets/{pencil-CUVzuL3L.js → pencil-Gs6QSg5F.js} +1 -1
  51. package/dist/assets/{player-overlays-BrjDKJA9.js → player-overlays-DArwlTAt.js} +1 -1
  52. package/dist/assets/plus-ByGzrFiA.js +1 -0
  53. package/dist/assets/{radio-_KFBV9h-.js → radio-B4tiKZeo.js} +1 -1
  54. package/dist/assets/{refresh-cw-BM18Lfvw.js → refresh-cw-dvjeQnSv.js} +1 -1
  55. package/dist/assets/remoteEntry-BOwRpCPu.js +1 -0
  56. package/dist/assets/{rotate-ccw-EdLXWeWN.js → rotate-ccw-CdvaSzic.js} +1 -1
  57. package/dist/assets/rotate-cw-QbVLxhT1.js +1 -0
  58. package/dist/assets/search-BWa4jUVz.js +1 -0
  59. package/dist/assets/{send-C5a5_8YJ.js → send-Cn2E54X0.js} +1 -1
  60. package/dist/assets/{server-CTi1sPfP.js → server-Cgdp4E__.js} +1 -1
  61. package/dist/assets/square-B8uQd9s9.js +1 -0
  62. package/dist/assets/{square-check-big-DqE0lyuf.js → square-check-big-j_FMW3NH.js} +1 -1
  63. package/dist/assets/src-7HDrFEPH.js +7 -0
  64. package/dist/assets/src-BhRH3dxa.js +67 -0
  65. package/dist/assets/{upload-CBvWlRd4.js → upload-BkHF_KcS.js} +1 -1
  66. package/dist/assets/useDevice-CNEnCHst.js +1 -0
  67. package/dist/assets/{useEventInvalidation-BgQYjLEl.js → useEventInvalidation-zuVyeFVc.js} +1 -1
  68. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-BzCJlGIx.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-BktxCRjD.js} +2 -2
  69. package/dist/assets/{wifi-D9LNVG6Y.js → wifi-CaslRhpX.js} +1 -1
  70. package/dist/assets/{zap-CjGIHi-s.js → zap-1sJN7Bvb.js} +1 -1
  71. package/dist/index.html +5 -5
  72. package/dist/server/addon.js +203 -14
  73. package/package.json +1 -1
  74. package/dist/assets/Addons-DU5z1ZvU.js +0 -1
  75. package/dist/assets/DeviceDetail-Bt08IJis.js +0 -2
  76. package/dist/assets/FormBuilder-B69YBaq9.js +0 -1
  77. package/dist/assets/Identity-DWgcf-tI.js +0 -1
  78. package/dist/assets/IntegrationDetail-BOTeJU5I.js +0 -1
  79. package/dist/assets/Integrations-nY6HlQUf.js +0 -1
  80. package/dist/assets/Network-DTQVXNuu.js +0 -1
  81. package/dist/assets/Pipeline-BZPrco_d.js +0 -1
  82. package/dist/assets/ScanNetworkModal-CbDd4Bl9.js +0 -1
  83. package/dist/assets/circle-check-big-B-tT2CHM.js +0 -1
  84. package/dist/assets/clock-cwKSxYZs.js +0 -1
  85. package/dist/assets/dist-tu4iBgMD.js +0 -7
  86. package/dist/assets/index-Cdp6OaKK.js +0 -4
  87. package/dist/assets/plus-CTLCXGgQ.js +0 -1
  88. package/dist/assets/remoteEntry-xwnWPwER.js +0 -1
  89. package/dist/assets/rotate-cw-CE0Ns6Fz.js +0 -1
  90. package/dist/assets/search-mDjJzMoX.js +0 -1
  91. package/dist/assets/square-CfQwX-85.js +0 -1
  92. package/dist/assets/src-BIAY4cjr.js +0 -7
  93. package/dist/assets/src-Bx1PCCWV.js +0 -67
  94. package/dist/assets/useDevice-CRWDjGkB.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-CFZs3jI4.mjs
3
+ //#region ../types/dist/event-category-H4AVePnn.mjs
4
4
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
5
5
  EventCategory["SystemBoot"] = "system.boot";
6
6
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -150,6 +150,9 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
150
150
  EventCategory["RecordingSegmentWritten"] = "recording.segment.written";
151
151
  EventCategory["RecordingPolicyFallback"] = "recording.policy.fallback";
152
152
  EventCategory["RecordingRetentionCompleted"] = "recording.retention.completed";
153
+ /** Runner-sampled scrub thumbnail (~1/5 s/camera). Telemetry (D8): a lost
154
+ * thumb is a scrub gap the recorder's keyframe backfill covers. */
155
+ EventCategory["RecordingThumbSampled"] = "recording.thumb-sampled";
153
156
  EventCategory["DetectionEvent"] = "detection.event";
154
157
  EventCategory["SessionTrackNew"] = "session.track.new";
155
158
  EventCategory["SessionTrackExpired"] = "session.track.expired";
@@ -7228,6 +7231,24 @@ var RecordingRetentionSchema = object({
7228
7231
  maxSizeGb: number().min(0).optional()
7229
7232
  });
7230
7233
  /**
7234
+ * Scrub-thumbnail fidelity preset — the single per-camera selector bundling the
7235
+ * sprite tile RESOLUTION + JPEG QUALITY the recorder packs timeline-scrub
7236
+ * previews at. Five graduated steps; absent on a config = `standard` (the
7237
+ * shipped default, matching `sheet-geometry`/`sheet-composer`).
7238
+ *
7239
+ * Existing sheets are IMMUTABLE — a changed preset applies to NEW windows only.
7240
+ * Each window's index sidecar carries its own tile dims, so a camera whose
7241
+ * preset changed over time renders every historical window at the dims it was
7242
+ * written with.
7243
+ */
7244
+ var ScrubThumbnailPresetSchema = _enum([
7245
+ "minimal",
7246
+ "low",
7247
+ "standard",
7248
+ "high",
7249
+ "max"
7250
+ ]);
7251
+ /**
7231
7252
  * The full per-camera recording intent — the wire shape of a RecordingTarget.
7232
7253
  *
7233
7254
  * `mode` is the authoritative storage choice; `schedule`/`triggers`/`pre`/`post`
@@ -7264,7 +7285,14 @@ var RecordingConfigSchema = object({
7264
7285
  * derived into bands once via `migrateConfigToBands`.
7265
7286
  */
7266
7287
  bands: array(RecordingBandSchema).optional(),
7267
- retention: RecordingRetentionSchema.optional()
7288
+ retention: RecordingRetentionSchema.optional(),
7289
+ /**
7290
+ * Per-camera scrub-thumbnail fidelity preset (resolution + JPEG quality for
7291
+ * timeline-scrub sprite previews). Absent = `standard`. Applies to NEW
7292
+ * windows only — existing sheets are immutable, and each window's index
7293
+ * carries its own tile dims so mixed-preset history renders correctly.
7294
+ */
7295
+ scrubThumbnails: ScrubThumbnailPresetSchema.optional()
7268
7296
  });
7269
7297
  /**
7270
7298
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
@@ -9823,7 +9851,7 @@ object({
9823
9851
  deviceId: number(),
9824
9852
  timestamp: number()
9825
9853
  });
9826
- DeviceType.Button;
9854
+ DeviceType.Button, DeviceType.Camera;
9827
9855
  /**
9828
9856
  * Enum-state sensor — a string value picked from a finite option set.
9829
9857
  * Drives HA `sensor` entries with `state_class: enum` (HVAC action
@@ -14193,6 +14221,14 @@ var ConfigEntrySchema = object({
14193
14221
  value: unknown(),
14194
14222
  description: string().optional()
14195
14223
  });
14224
+ var DeviceLinkModeSchema = _enum(["auto", "manual"]);
14225
+ /** One resolved linked device — the compact projection consumers need. */
14226
+ var LinkedDeviceSchema = object({
14227
+ deviceId: number(),
14228
+ name: string(),
14229
+ location: string().nullable(),
14230
+ features: array(string())
14231
+ });
14196
14232
  var SavedDeviceRowSchema = object({
14197
14233
  /** Numeric id reserved at allocateDeviceId time. */
14198
14234
  id: number(),
@@ -14414,7 +14450,10 @@ method(object({
14414
14450
  }), _void(), {
14415
14451
  kind: "mutation",
14416
14452
  auth: "admin"
14417
- }), method(object({ addonId: string() }), array(SavedDeviceRowSchema)), method(object({ addonId: string().optional() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), array(StreamSourceEntrySchema$1)), method(object({ deviceId: number() }), array(ConfigEntrySchema)), method(object({ deviceId: number() }), ConfigUISchemaOutput), method(object({
14453
+ }), method(object({ addonId: string() }), array(SavedDeviceRowSchema)), method(object({ addonId: string().optional() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), object({
14454
+ mode: DeviceLinkModeSchema,
14455
+ devices: array(LinkedDeviceSchema)
14456
+ })), method(object({ deviceId: number() }), array(StreamSourceEntrySchema$1)), method(object({ deviceId: number() }), array(ConfigEntrySchema)), method(object({ deviceId: number() }), ConfigUISchemaOutput), method(object({
14418
14457
  deviceId: number(),
14419
14458
  values: record(string(), unknown())
14420
14459
  }), object({ success: literal(true) }), {
@@ -15683,6 +15722,61 @@ var EventKindSchema = _enum([
15683
15722
  "object",
15684
15723
  "audio"
15685
15724
  ]);
15725
+ /**
15726
+ * Spatial filter for `listTracks` — the rect + polygon variants of the shared
15727
+ * MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
15728
+ * of the camera frame (top-left origin), matching the drawing-plane editor.
15729
+ */
15730
+ var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
15731
+ /** Closed icon vocabulary so clients render a known glyph per kind. */
15732
+ var EventKindIconSchema = _enum([
15733
+ "motion",
15734
+ "audio",
15735
+ "person",
15736
+ "vehicle",
15737
+ "animal",
15738
+ "door",
15739
+ "pir",
15740
+ "smoke",
15741
+ "water",
15742
+ "button",
15743
+ "generic"
15744
+ ]);
15745
+ var EventKindCategorySchema = _enum([
15746
+ "motion",
15747
+ "audio",
15748
+ "detection",
15749
+ "sensor",
15750
+ "custom"
15751
+ ]);
15752
+ var EventKindDescriptorSchema = object({
15753
+ /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
15754
+ kind: string(),
15755
+ label: string(),
15756
+ /** Hex color for timeline/legend rendering. */
15757
+ color: string(),
15758
+ icon: EventKindIconSchema,
15759
+ category: EventKindCategorySchema,
15760
+ /** Which cap + device contributes this kind. For built-ins the camera
15761
+ * itself; for sensor kinds the LINKED source device. */
15762
+ source: object({
15763
+ capName: string(),
15764
+ deviceId: number()
15765
+ })
15766
+ });
15767
+ var SensorEventSchema = object({
15768
+ id: string(),
15769
+ /** The CAMERA the event is attributed to (a sensor linked to N cameras
15770
+ * yields N rows, one per camera). */
15771
+ deviceId: number(),
15772
+ /** The linked sensor device whose state changed. */
15773
+ sourceDeviceId: number(),
15774
+ /** Event kind id — matches an `EventKindDescriptor.kind`. */
15775
+ kind: string(),
15776
+ /** Snapshot of the sensor cap's runtime-state slice at the change. */
15777
+ value: record(string(), unknown()).nullable(),
15778
+ timestamp: number()
15779
+ });
15686
15780
  var TrackPositionSchema = object({
15687
15781
  x: number(),
15688
15782
  y: number(),
@@ -15696,6 +15790,30 @@ var TrackSnapshotSchema = object({
15696
15790
  mediaKey: string()
15697
15791
  });
15698
15792
  /**
15793
+ * Normalized 0..1 trajectory envelope (min/max over every position bbox,
15794
+ * divided by the track's detection-frame dims), computed at persist time.
15795
+ * Absent when the frame dims were unknown when the track was persisted
15796
+ * (legacy rows / dims-less sources) and on active (in-RAM) tracks.
15797
+ */
15798
+ var TrackEnvelopeSchema = object({
15799
+ minX: number(),
15800
+ minY: number(),
15801
+ maxX: number(),
15802
+ maxY: number()
15803
+ });
15804
+ /**
15805
+ * Row projection for track list queries. `full` (default) returns the
15806
+ * complete Track including the frame-rate `positions[]` history and the
15807
+ * `snapshots[]` references — megabytes across a page of tracks. `slim`
15808
+ * keeps every scalar the list surfaces actually render (ids, class(es),
15809
+ * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
15810
+ * zonesVisited, bestEventId, envelope) and returns `positions` /
15811
+ * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
15812
+ * `getTrack`. Mirrors the event-store `projection` convention
15813
+ * (`getObjectEvents` et al.).
15814
+ */
15815
+ var TrackProjectionSchema = _enum(["full", "slim"]);
15816
+ /**
15699
15817
  * One audio-classification label heard on the track's camera while the
15700
15818
  * track was alive, aggregated per label. An "episode" is one persisted
15701
15819
  * audio event (the confident-classification path: score ≥ the device's
@@ -15746,7 +15864,11 @@ var TrackSchema = object({
15746
15864
  /** Audio-classification labels heard on the camera during the track's
15747
15865
  * life (score ≥ device `classificationMinScore`), aggregated per label.
15748
15866
  * Absent on legacy rows / tracks with no confident audio. */
15749
- audioLabels: array(TrackAudioLabelSchema).readonly().optional()
15867
+ audioLabels: array(TrackAudioLabelSchema).readonly().optional(),
15868
+ /** Normalized 0..1 trajectory envelope (see {@link TrackEnvelopeSchema}).
15869
+ * Populated from the persisted envelope columns on historical reads;
15870
+ * absent on legacy rows, dims-less tracks and active (in-RAM) tracks. */
15871
+ envelope: TrackEnvelopeSchema.optional()
15750
15872
  });
15751
15873
  var BaseEventFields = {
15752
15874
  id: string(),
@@ -15856,11 +15978,13 @@ var MediaFileSchema = object({
15856
15978
  sizeBytes: number(),
15857
15979
  timestamp: number()
15858
15980
  });
15981
+ var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
15982
+ var MAX_EVENT_QUERY_LIMIT = 5e3;
15859
15983
  var DeviceEventQueryInput = object({
15860
15984
  deviceId: number(),
15861
15985
  since: number().optional(),
15862
15986
  until: number().optional(),
15863
- limit: number().int().min(1).max(5e3).default(1e3),
15987
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
15864
15988
  /** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
15865
15989
  * optional `mediaUrl` (populated by B5). `full` (default) keeps today's
15866
15990
  * exact behaviour. Callers may omit this field — the store defaults to
@@ -15868,6 +15992,27 @@ var DeviceEventQueryInput = object({
15868
15992
  projection: _enum(["full", "slim"]).optional()
15869
15993
  });
15870
15994
  var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
15995
+ var RecentTracksQueryInput = object({
15996
+ /** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
15997
+ deviceIds: array(number()),
15998
+ /** Window lower bound on `lastSeen` (inclusive). */
15999
+ since: number().optional(),
16000
+ /** Window upper bound on `lastSeen` (inclusive). */
16001
+ until: number().optional(),
16002
+ /** Page size. Default 200, max 1000. */
16003
+ limit: number().int().min(1).max(1e3).default(200),
16004
+ /** Opaque continuation cursor from a previous page's `nextCursor`.
16005
+ * Encodes the (lastSeen, trackId) sort position — treat as opaque. */
16006
+ cursor: string().optional(),
16007
+ /** See {@link TrackProjectionSchema}. Default `full`. */
16008
+ projection: TrackProjectionSchema.optional()
16009
+ });
16010
+ var RecentTracksPageSchema = object({
16011
+ /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
16012
+ tracks: array(TrackSchema).readonly(),
16013
+ /** Cursor for the next page, or null when this page is the last. */
16014
+ nextCursor: string().nullable()
16015
+ });
15871
16016
  var KeyEventQueryInput = object({
15872
16017
  deviceId: number(),
15873
16018
  /** Window lower bound (track firstSeen ≥ since). */
@@ -15950,11 +16095,25 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
15950
16095
  deviceId: number(),
15951
16096
  since: number().optional(),
15952
16097
  until: number().optional(),
15953
- limit: number().optional()
15954
- }), array(TrackSchema).readonly()), method(object({ deviceId: number() }), _void(), {
15955
- kind: "mutation",
15956
- auth: "admin"
15957
- }), method(DeviceEventQueryInput, array(MotionEventSchema).readonly()), method(ObjectEventQueryInput, array(ObjectEventSchema).readonly()), method(DeviceEventQueryInput, array(AudioEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
16098
+ limit: number().optional(),
16099
+ /** Spatial filter only tracks whose trajectory intersects the zone
16100
+ * (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
16101
+ * envelope columns, then precisely tested per position. Tracks with
16102
+ * an unknown envelope (no frame dims at persist time) always match. */
16103
+ zone: TrackZoneFilterSchema.optional(),
16104
+ /** See {@link TrackProjectionSchema}. Default `full` (backward
16105
+ * compatible — omitting the field keeps today's exact behaviour). */
16106
+ projection: TrackProjectionSchema.optional()
16107
+ }), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(object({ deviceId: number() }), _void(), {
16108
+ kind: "mutation",
16109
+ auth: "admin"
16110
+ }), method(DeviceEventQueryInput, array(MotionEventSchema).readonly()), method(ObjectEventQueryInput, array(ObjectEventSchema).readonly()), method(DeviceEventQueryInput, array(AudioEventSchema).readonly()), method(object({ deviceId: number() }), array(EventKindDescriptorSchema).readonly()), method(object({
16111
+ deviceId: number(),
16112
+ since: number().optional(),
16113
+ until: number().optional(),
16114
+ kinds: array(string()).optional(),
16115
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
16116
+ }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
15958
16117
  deviceId: number(),
15959
16118
  since: number(),
15960
16119
  until: number(),
@@ -19155,7 +19314,12 @@ var RecordingStorageUsageSchema = object({
19155
19314
  /**
19156
19315
  * Result of locating footage at a wall-clock instant for one device/profile.
19157
19316
  * `segment` carries the covering segment's window; `gap` reports the forward
19158
- * nearest covered edge (`null` past the end of footage / when none exists).
19317
+ * nearest covered edge (`null` past the end of footage / when none exists)
19318
+ * and the backward covered edge `prevEndMs` (exclusive end of the nearest
19319
+ * footage behind the epoch; `null` when none — optional so older providers
19320
+ * that omit it stay valid). `prevEndMs` lets a backward frame-step hop the
19321
+ * small inter-segment cracks (durMs under-covers the span to the next
19322
+ * startMs by ~11-17 ms) instead of no-opping at a segment head.
19159
19323
  */
19160
19324
  var LocateSegmentResultSchema = discriminatedUnion("kind", [object({
19161
19325
  kind: literal("segment"),
@@ -19164,7 +19328,8 @@ var LocateSegmentResultSchema = discriminatedUnion("kind", [object({
19164
19328
  bytes: number()
19165
19329
  }), object({
19166
19330
  kind: literal("gap"),
19167
- nearestEdgeMs: number().nullable()
19331
+ nearestEdgeMs: number().nullable(),
19332
+ prevEndMs: number().nullable().optional()
19168
19333
  })]);
19169
19334
  /** Raw bytes of one finalized footage segment (read off disk on the recording node). */
19170
19335
  var ReadSegmentBytesResultSchema = object({ data: _instanceof(Uint8Array) });
@@ -20733,6 +20898,12 @@ Object.freeze({
20733
20898
  addonId: null,
20734
20899
  access: "view"
20735
20900
  },
20901
+ "deviceManager.getLinkedDevices": {
20902
+ capName: "device-manager",
20903
+ capScope: "system",
20904
+ addonId: null,
20905
+ access: "view"
20906
+ },
20736
20907
  "deviceManager.getRoleDisplayDefaults": {
20737
20908
  capName: "device-manager",
20738
20909
  capScope: "system",
@@ -22287,6 +22458,12 @@ Object.freeze({
22287
22458
  addonId: null,
22288
22459
  access: "view"
22289
22460
  },
22461
+ "pipelineAnalytics.getSensorEvents": {
22462
+ capName: "pipeline-analytics",
22463
+ capScope: "device",
22464
+ addonId: null,
22465
+ access: "view"
22466
+ },
22290
22467
  "pipelineAnalytics.getTrack": {
22291
22468
  capName: "pipeline-analytics",
22292
22469
  capScope: "device",
@@ -22299,6 +22476,18 @@ Object.freeze({
22299
22476
  addonId: null,
22300
22477
  access: "view"
22301
22478
  },
22479
+ "pipelineAnalytics.listEventKinds": {
22480
+ capName: "pipeline-analytics",
22481
+ capScope: "device",
22482
+ addonId: null,
22483
+ access: "view"
22484
+ },
22485
+ "pipelineAnalytics.listRecentTracks": {
22486
+ capName: "pipeline-analytics",
22487
+ capScope: "device",
22488
+ addonId: null,
22489
+ access: "view"
22490
+ },
22302
22491
  "pipelineAnalytics.listTracks": {
22303
22492
  capName: "pipeline-analytics",
22304
22493
  capScope: "device",
@@ -24304,7 +24493,7 @@ var AdminUIAddon = class extends BaseAddon {
24304
24493
  capability: adminUiCapability,
24305
24494
  provider: {
24306
24495
  getStaticDir: async () => ({ staticDir: resolveAdminUiDistDir() }),
24307
- getVersion: async () => ({ version: "1.1.53" })
24496
+ getVersion: async () => ({ version: "1.1.55" })
24308
24497
  }
24309
24498
  }];
24310
24499
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-admin-ui",
3
- "version": "1.1.53",
3
+ "version": "1.1.55",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "CamStack Admin UI — Vite frontend build and server-side addon",
@@ -1 +0,0 @@
1
- import{At as e,Ct as t,Da as n,Dt as r,Et as i,Mr as a,Rr as o,St as s,Tt as c,_t as l,bt as u,dt as ee,ft as d,g as f,gt as p,ht as m,jt as h,kt as g,m as _,mt as v,pt as te,v as ne,vt as re,wa as ie,xa as ae,xt as y}from"./src-Bx1PCCWV.js";import{I as b,K as x,Q as S,R as oe,S as C,W as w,b as T,o as E,q as D,x as O,z as k}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js";import{R as se}from"./src-BIAY4cjr.js";import{p as ce}from"./player-overlays-BrjDKJA9.js";import{t as A}from"./clock-cwKSxYZs.js";import{t as j}from"./download-DjYX33pK.js";import{t as le}from"./plus-CTLCXGgQ.js";import{t as M}from"./refresh-cw-BM18Lfvw.js";import{t as ue}from"./search-mDjJzMoX.js";import{t as N}from"./upload-CBvWlRd4.js";import{F as P,G as de,I as F,S as I,U as L,g as R,i as z,j as B,m as fe,p as V,q as pe,s as H}from"./index-Cdp6OaKK.js";import{t as U}from"./AdminPage-BwmGKnRf.js";import{t as me}from"./NodeAddonsSettingsPanel-BQWXa7vq.js";var he=L(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),W=L(`octagon-alert`,[[`path`,{d:`M12 16h.01`,key:`1drbdi`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z`,key:`1fd625`}]]),G=L(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),K=L(`skip-forward`,[[`polygon`,{points:`5 4 15 12 5 20 5 4`,key:`16p6eg`}],[`line`,{x1:`19`,x2:`19`,y1:`5`,y2:`19`,key:`futhcm`}]]);S();var q=new Set([`completed`,`failed`,`partially-failed`,`cancelled`]),J=new Set([`done`,`failed`,`skipped`]);function Y(e){return!J.has(e.phase)&&!q.has(e.jobState)}function ge(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 _e(){let{data:e}=u({activeOnly:!0},{refetchOnWindowFocus:!1,refetchInterval:e=>(e.state.data?.length??0)>0?3e3:!1}),{map:t}=n(se.AddonsJobProgress,e=>e.job.jobId);return w(()=>{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 ge([...n.values()],Date.now())},[e,t])}var X={queued:{icon:A,cls:`bg-muted text-foreground-subtle`,label:`queued`},fetching:{icon:I,cls:`bg-primary/10 text-primary`,label:`fetching`,spin:!0},staged:{icon:I,cls:`bg-primary/10 text-primary`,label:`staged`,spin:!0},validating:{icon:I,cls:`bg-primary/10 text-primary`,label:`validating`,spin:!0},applying:{icon:I,cls:`bg-primary/10 text-primary`,label:`applying`,spin:!0},restarting:{icon:I,cls:`bg-amber-500/10 text-amber-600 dark:text-amber-400`,label:`restarting`,spin:!0},applied:{icon:I,cls:`bg-primary/10 text-primary`,label:`finalizing`,spin:!0},done:{icon:F,cls:`bg-success/10 text-success`,label:`updated`},failed:{icon:W,cls:`bg-danger/10 text-danger`,label:`failed`},skipped:{icon:K,cls:`bg-muted text-foreground-subtle`,label:`skipped`}};function ve({progress:e}){let t=X[e.phase],n=t.icon,r=e.error??`${e.packageName}: ${e.fromVersion??`?`} → ${e.toVersion}`;return C(`span`,{"data-testid":`addon-job-progress`,className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded shrink-0 ${t.cls}`,title:r,children:[O(n,{className:`w-2.5 h-2.5 ${t.spin?`animate-spin`:``}`}),t.label,C(`span`,{className:`font-mono`,children:[`→ `,e.toVersion]})]})}function ye({packageName:e,currentVersion:t,installSource:n,onInstall:r,onClose:i,onSelect:a,selectedVersion:o}){let s=n===`upload`||n===`local`,{data:c,isLoading:l}=p({name:e});return C(`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:[C(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border`,children:[O(`span`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle font-medium`,children:`Versions`}),O(`button`,{type:`button`,onClick:i,className:`text-foreground-subtle hover:text-foreground`,children:O(z,{className:`h-3 w-3`})})]}),s&&C(`div`,{className:`flex items-start gap-2 px-3 py-2 border-b border-border bg-cyan-500/10 text-[10px]`,children:[O(N,{className:`h-3 w-3 mt-0.5 text-cyan-500 shrink-0`}),C(`div`,{className:`text-cyan-700 dark:text-cyan-200`,children:[C(`span`,{className:`font-semibold`,children:[n===`upload`?`Uploaded copy`:`Local copy`,` in place.`]}),` `,`Re-install `,O(`span`,{className:`font-mono`,children:t}),` from npm to track upstream releases again.`]})]}),l&&C(`div`,{className:`flex items-center justify-center gap-2 py-6 text-[10px] text-foreground-subtle`,children:[O(I,{className:`h-3.5 w-3.5 animate-spin`}),`Loading versions...`]}),c&&O(`div`,{className:`max-h-64 overflow-auto divide-y divide-border`,children:c.map(e=>{let n=e.version===t,i=a!==void 0&&e.version===o,c=/-(alpha|beta|rc|dev|canary|next)/i.test(e.version),l=C(T,{children:[O(`span`,{className:`font-mono flex-1 text-left ${n?`text-primary font-semibold`:c?`text-amber-400`:`text-foreground`}`,children:e.version}),n&&O(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium bg-primary/10 text-primary`,children:`current`}),e.distTags.map(e=>O(`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)),e.deprecated&&O(`span`,{className:`text-[9px] text-red-400 line-through`,children:`deprecated`}),O(`span`,{className:`text-[9px] text-foreground-subtle shrink-0`,children:new Date(e.publishedAt).toLocaleDateString()})]});return a?C(`button`,{type:`button`,"aria-label":`Select ${e.version}`,onClick:()=>a(e.version),className:`w-full flex items-center gap-2 px-3 py-2 text-[11px] ${i?`bg-primary/5`:`hover:bg-surface-hover`} transition-colors`,children:[l,i?O(F,{className:`h-3 w-3 text-primary shrink-0`}):O(`span`,{className:`w-3 shrink-0`})]},e.version):C(`div`,{className:`flex items-center gap-2 px-3 py-2 text-[11px] ${n?`bg-primary/5`:`hover:bg-surface-hover`} transition-colors`,children:[l,n&&!s?O(F,{className:`h-3 w-3 text-primary shrink-0`}):O(`button`,{type:`button`,onClick:()=>r(e.version),className:`shrink-0 rounded p-0.5 hover:bg-primary/20 text-foreground-subtle hover:text-primary transition-colors`,title:n?`Re-install ${e.version} from npm`:`Install ${e.version}`,children:O(j,{className:`h-3 w-3`})})]},e.version)})}),c&&c.length===0&&O(`div`,{className:`py-4 text-center text-[10px] text-foreground-subtle`,children:`No versions found`})]})}var be={queued:{icon:A,bg:`bg-muted text-foreground-subtle`,label:`queued`},updating:{icon:I,bg:`bg-primary/10 text-primary`,label:`updating`,spin:!0},"done-pending-restart":{icon:M,bg:`bg-amber-500/10 text-amber-700`,label:`pending restart`},done:{icon:F,bg:`bg-success/10 text-success`,label:`done`},failed:{icon:W,bg:`bg-danger/10 text-danger`,label:`failed`}};function xe({item:e}){let t=be[e.status],n=t.icon;return C(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded ${t.bg}`,title:e.error,children:[O(n,{className:`w-2.5 h-2.5 ${t.spin?`animate-spin`:``}`}),t.label]})}S();var Z=`device-export`;function Se(e){return e.capabilities.some(e=>(typeof e==`string`?e:e.name)===Z)}function Ce({isBundle:e,installSource:t,addonId:n,iconPath:r,color:i}){let[a,o]=D(!1),s=i?{backgroundColor:`${i.startsWith(`#`)?i:`#${i}`}26`}:void 0,c=e?`bg-indigo-500/20 text-indigo-700 dark:text-indigo-300`:`bg-purple-500/20 text-purple-700 dark:text-purple-300`,l=n&&r?`/api/addon-assets/${n}/${r}`:null,u=!!l&&!a;return C(`div`,{className:`relative flex-shrink-0`,children:[O(`div`,{className:`h-9 w-9 rounded-lg flex items-center justify-center ${s?``:c}`,style:s,children:u?O(`img`,{src:l,alt:n,className:`h-5 w-5`,onError:()=>o(!0)}):O(e?G:R,{className:`h-4 w-4`})}),t===`local`&&O(`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`}),t===`npm`&&O(`span`,{className:`absolute -top-1 -left-1 w-4 h-4 rounded bg-[#cb3837] flex items-center justify-center -rotate-12 shadow-sm`,children:O(`svg`,{viewBox:`0 0 780 250`,className:`w-[11px] h-[11px]`,children:O(`path`,{fill:`#fff`,d:`M240 250h100V50h100v200h340V0H0v250z`})})}),t===`upload`&&O(`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:O(N,{className:`h-2.5 w-2.5 text-white`})})]})}function we({version:e,availableUpdate:t,selectedVersion:n,isUpdating:r,installSource:i,disabled:a,onUpdate:o,onOpenPicker:s,children:c}){if(r)return C(`span`,{className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border border-blue-500/30 bg-blue-500/10 text-blue-400 shrink-0`,children:[O(I,{className:`h-3 w-3 animate-spin`}),`Updating…`]});if(t){let r=n??t;return C(`div`,{className:`relative inline-flex items-center gap-1 shrink-0`,children:[o&&C(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),o()},disabled:a,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 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:`Update to ${r}`,children:[O(j,{className:`h-3 w-3`}),`Update`]}),C(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),s()},disabled:a,"aria-label":`Select version to install`,title:`Installed ${e} — update available. Selected ${r}; tap to choose another version.`,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 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:[O(`span`,{className:`font-normal opacity-70`,children:e}),O(`span`,{className:`font-normal opacity-70`,children:`→`}),r,O(P,{className:`h-3 w-3`})]}),c]})}return C(`div`,{className:`relative inline-flex items-center gap-1 shrink-0`,children:[C(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),s()},disabled:a,className:[`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-bold font-mono border transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,i===`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:`Version ${e} — tap to view all versions`,children:[e,O(P,{className:`h-3 w-3 opacity-50`})]}),c]})}function Te({addonId:e}){let t=E(),{data:n=`inherit`}=te({addonId:e}),i=r({onSuccess:()=>{t.invalidateQueries({queryKey:[[`addons`,`getAddonAutoUpdate`]]})}});return O(`div`,{className:`flex rounded-lg border border-border overflow-hidden text-[10px] font-medium`,children:[`inherit`,`off`,`latest`,`beta`].map(t=>O(`button`,{type:`button`,onClick:n=>{n.stopPropagation(),i.mutate({addonId:e,channel:t})},disabled:i.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))})}function Ee({addon:n,agents:r=[],clusterStatus:i,hideVersion:a,availableUpdate:o,onUpdate:s,isUpdating:u,jobProgress:ee,bundle:d,bulkItem:p,disabledByBulk:m,isSystem:h}){let[g,v]=D(!1),[te,re]=D(!1),[ie,y]=D(!1),[b,x]=D(null);k(()=>{x(null)},[o]);let S=b??o,[oe,w]=D(!1),[se,A]=D(!1),[j,ue]=D(`logs`),N=E(),F=ce(),I=de(),L=ae(),{manifest:R}=n,B=n.installedOn??[],pe=!d&&!R.protected&&R.removable!==!1,U=!!d,K=d?.displayName??R.name,q=d?.packageName??R.packageName,J=d?.version??R.packageVersion??R.version,Y=d?.installSource??n.installSource,ge=d?d.bundle?.description??d.addons[0]?.manifest.description:R.description,_e=e({onSuccess:()=>{N.invalidateQueries({queryKey:[[`addons`]]}),N.invalidateQueries({queryKey:[[`addonPages`]]}),N.invalidateQueries({queryKey:[[`capabilities`]]})}}),X=t({onSuccess:()=>{N.invalidateQueries({queryKey:[[`addons`]]})}}),be=l({onSuccess:()=>{N.invalidateQueries({queryKey:[[`addons`]]}),N.invalidateQueries({queryKey:[[`addonPages`]]}),N.invalidateQueries({queryKey:[[`capabilities`]]}),N.invalidateQueries({queryKey:[[`integrations`]]})}}),Z=c({onSuccess:()=>{N.invalidateQueries({queryKey:[[`addons`]]}),N.invalidateQueries({queryKey:[[`alerts`]]})}}),Q=n.health,De=Q?.phase===`failed`&&!Q.inGracePeriod,Oe=De&&Q?.nextRetryAt&&!Q.retrying;return C(`div`,{className:`rounded-lg border bg-surface overflow-hidden ${De?`border-red-500/50`:`border-border`}`,children:[De&&Q&&C(`div`,{className:`bg-danger/10 border-b border-danger/30 px-4 py-2.5 flex items-start gap-2.5`,children:[O(W,{className:`h-4 w-4 text-danger shrink-0 mt-0.5`}),C(`div`,{className:`flex-1 min-w-0`,children:[C(`div`,{className:`text-xs font-semibold text-danger`,children:[`Failed to load (attempt #`,Q.retryCount,`)`]}),O(`div`,{className:`text-[11px] text-foreground mt-0.5 break-words font-mono`,children:Q.lastError?.message??`Unknown error`}),Oe&&Q.nextRetryAt&&C(`div`,{className:`text-[10px] text-foreground-subtle mt-1`,children:[`Auto-retry at `,new Date(Q.nextRetryAt).toLocaleTimeString()]})]}),C(`button`,{type:`button`,disabled:Z.isPending||Q.retrying,onClick:e=>{e.stopPropagation(),Z.mutate({packageName:q})},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:`Reset retry counter and force immediate reload`,children:[O(M,{className:`h-3 w-3 ${Z.isPending||Q.retrying?`animate-spin`:``}`}),`Retry now`]})]}),C(`div`,{className:`flex items-start gap-3 px-4 py-3`,children:[O(Ce,{isBundle:U||!!R.components&&R.components.length>1,installSource:Y,addonId:U?d.addons[0]?.manifest.id:R.id,iconPath:U?d.bundle?.icon??d.addons[0]?.manifest.icon:R.icon,color:U?d.addons[0]?.manifest.color:R.color}),C(`div`,{className:`flex-1 min-w-0`,children:[C(`div`,{className:`flex items-start justify-between gap-2`,children:[O(`span`,{className:`text-sm font-semibold text-foreground truncate min-w-0`,children:K}),!a&&O(we,{version:J,availableUpdate:o,...S===void 0?{}:{selectedVersion:S},isUpdating:u,installSource:Y,disabled:m,...s&&S!==void 0?{onUpdate:()=>s(S)}:{},onOpenPicker:()=>y(e=>!e),children:ie&&O(ye,{packageName:q,currentVersion:J,...Y?{installSource:Y}:{},...o!==void 0&&S!==void 0?{selectedVersion:S,onSelect:e=>{x(e),y(!1)}}:{},onInstall:e=>{y(!1),be.mutate({packageName:q,version:e})},onClose:()=>y(!1)})})]}),C(`div`,{className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 mt-0.5`,children:[q!==K&&O(`span`,{className:`text-[10px] text-foreground-subtle font-mono truncate max-w-full`,children:q}),U&&C(`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:[O(G,{className:`h-3 w-3`}),d.addons.length]}),h&&C(`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:`System package — updating restarts the hub`,children:[O(M,{className:`h-3 w-3`}),`System`]}),p!=null&&O(xe,{item:p}),ee!=null&&O(ve,{progress:ee})]}),ge&&O(`p`,{className:`text-[10px] text-foreground-subtle mt-1 line-clamp-1`,children:ge}),!U&&n.process&&C(`div`,{className:`flex flex-wrap items-center gap-1.5 mt-1`,children:[O(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium ${n.process.mode===`forked`?`bg-blue-500/15 text-blue-400`:`bg-gray-500/15 text-gray-400`}`,children:n.process.mode===`forked`?`forked`:`in-process`}),n.process.pid!=null&&C(`span`,{className:`text-[9px] font-mono text-foreground-subtle`,children:[`PID `,n.process.pid]}),O(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium ${n.process.state===`running`?`bg-emerald-500/15 text-emerald-400`:n.process.state===`crashed`||n.process.state===`failed`?`bg-red-500/15 text-red-400`:`bg-gray-500/15 text-gray-400`}`,children:n.process.state})]})]})]}),!U&&C(`div`,{className:`flex items-center gap-1 px-4 py-1.5 border-t border-border/50 bg-surface-hover/20`,children:[C(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),X.mutate({addonId:R.id})},disabled:X.isPending||m,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 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:[O(M,{className:`h-3 w-3 ${X.isPending?`animate-spin`:``}`}),`Restart`]}),C(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),w(e=>!e)},className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border transition-colors ${oe?`border-primary/30 bg-primary/10 text-primary`:`border-border text-foreground-subtle hover:text-foreground hover:border-primary/30 hover:bg-primary/10`}`,children:[O(fe,{className:`h-3 w-3`}),`Logs`]}),!U&&C(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),A(!0)},className:`inline-flex items-center gap-1 rounded-md px-2 py-1 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:[O(V,{className:`h-3 w-3`}),`Settings`]}),O(`div`,{className:`flex-1`}),pe&&C(`button`,{type:`button`,onClick:async e=>{e.stopPropagation(),await L({title:`Uninstall ${R.name}?`,message:`This will remove the addon package and all its data. This action cannot be undone.`,confirmLabel:`Uninstall`,variant:`danger`})&&_e.mutate({packageName:R.packageName})},disabled:_e.isPending||m,className:`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`,children:[O(H,{className:`h-3 w-3`}),_e.isPending?`Removing...`:`Uninstall`]})]}),i&&i.nodes.length>1&&!U&&C(`div`,{className:`border-t border-border px-4 py-2 bg-muted/10`,children:[O(`div`,{className:`text-[10px] font-medium text-foreground-subtle mb-1.5`,children:`Cluster Deployment`}),O(`div`,{className:`space-y-1`,children:i.nodes.map(e=>C(`div`,{className:`flex items-center gap-2 text-[10px]`,children:[O(`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`}`}),O(`span`,{className:`font-medium text-foreground min-w-[60px]`,children:e.name}),O(`span`,{className:`font-mono text-foreground-subtle`,children:e.version}),!e.synced&&e.status!==`offline`&&O(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-amber-500/10 text-amber-400 border border-amber-500/20`,children:`outdated`}),e.status===`offline`&&O(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-muted text-muted-foreground`,children:`offline`}),e.synced&&e.status!==`offline`&&O(`span`,{className:`text-[9px] text-success`,children:`synced`})]},e.nodeId))})]}),oe&&!U&&C(`div`,{className:`border-t border-border`,children:[C(`div`,{className:`flex items-center px-4 py-1 bg-surface-hover/20 border-b border-border/50`,children:[C(`div`,{className:`flex rounded border border-border overflow-hidden text-[9px]`,children:[O(`button`,{type:`button`,onClick:()=>ue(`logs`),className:`px-2 py-0.5 transition-colors ${j===`logs`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:`Logs`}),O(`button`,{type:`button`,onClick:()=>ue(`events`),className:`px-2 py-0.5 border-l border-border transition-colors ${j===`events`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:`Events`})]}),O(`div`,{className:`flex-1`}),O(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),w(!1)},className:`text-foreground-subtle hover:text-foreground`,children:O(z,{className:`h-3.5 w-3.5`})})]}),j===`logs`&&O(f,{addonId:R.id,maxHeight:`max-h-64`,showFilters:!1}),j===`events`&&O(_,{addonId:R.id,category:`addon.*`,maxHeight:`max-h-64`})]}),U&&C(T,{children:[O(`button`,{type:`button`,onClick:()=>v(e=>!e),className:`w-full flex items-center justify-center border-t border-border py-1 hover:bg-surface-hover/50 transition-colors`,children:O(g?he:P,{className:`h-3.5 w-3.5 text-foreground-subtle`})}),g&&O(`div`,{className:`border-t border-border px-3 py-2 space-y-2`,children:d.addons.map(e=>O(Ee,{addon:e,agents:r,hideVersion:!0},e.manifest.id))})]}),se&&!U&&O(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4`,onClick:()=>A(!1),children:C(`div`,{className:`w-full max-w-lg max-h-[80vh] rounded-xl border border-border bg-surface shadow-2xl flex flex-col overflow-hidden`,onClick:e=>e.stopPropagation(),children:[C(`div`,{className:`flex items-center justify-between px-5 py-3 border-b border-border flex-shrink-0`,children:[C(`div`,{className:`flex items-center gap-2`,children:[O(V,{className:`h-4 w-4 text-primary`}),C(`h2`,{className:`text-sm font-semibold text-foreground`,children:[K,` Settings`]})]}),O(`button`,{onClick:()=>A(!1),className:`text-foreground-subtle hover:text-foreground transition-colors p-1 rounded`,children:O(z,{className:`h-4 w-4`})})]}),C(`div`,{className:`flex-1 overflow-y-auto px-5 py-4 space-y-4`,children:[O(me,{nodeId:`hub`,addonIds:[R.id],level:`global`}),Se(R)&&C(`div`,{children:[O(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:`Device export`}),O(ne,{addonId:R.id,trpc:F.trpcClient,onOpenDevice:e=>I(`/devices/${e}`)})]}),Y===`npm`&&C(`div`,{children:[O(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:`Auto-Update`}),O(Te,{addonId:R.id})]}),R.components&&R.components.length>0&&C(`div`,{children:[C(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:[`Components (`,R.components.length,`)`]}),O(`div`,{className:`flex flex-wrap gap-1`,children:R.components.map(e=>O(`span`,{className:`text-[10px] rounded bg-background border border-border px-1.5 py-0.5 text-foreground-subtle font-mono`,children:e},e))})]}),r.length>=2&&C(`div`,{children:[O(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:`Installed on`}),C(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[B.length===0&&O(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Hub (local)`}),B.map(e=>O(`span`,{className:`rounded-full bg-surface-hover border border-border px-2 py-0.5 text-[10px] text-foreground-subtle`,children:e},e)),C(`div`,{className:`relative`,children:[C(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),re(e=>!e)},className:`inline-flex items-center gap-1 rounded-full border border-dashed border-border px-2 py-0.5 text-[10px] text-foreground-subtle hover:text-foreground hover:border-primary transition-colors`,title:`Install on more agents`,children:[O(le,{className:`h-3 w-3`}),`Add agent`]}),te&&C(`div`,{className:`absolute left-0 top-full mt-1 z-10 min-w-[160px] rounded-md border border-border bg-surface shadow-lg overflow-hidden`,children:[r.filter(e=>!e.isHub&&!B.includes(e.name)).map(e=>O(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),re(!1)},className:`w-full text-left px-3 py-1.5 text-[10px] text-foreground hover:bg-surface-hover transition-colors`,children:e.name},e.id)),r.filter(e=>!e.isHub&&!B.includes(e.name)).length===0&&O(`div`,{className:`px-3 py-1.5 text-[10px] text-foreground-subtle`,children:`No available agents`})]})]})]})]})]}),O(`div`,{className:`flex items-center justify-end px-5 py-3 border-t border-border flex-shrink-0`,children:O(`button`,{type:`button`,onClick:()=>A(!1),className:`rounded-lg border border-border px-3 py-1.5 text-xs font-medium text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors`,children:`Close`})})]})})]})}S();var Q=`.tgz,.tar.gz,.zip`;function De({onUploadSuccess:e}){let[t,n]=D(!1),r=x(null),i=b(async t=>{n(!0);let r=new FormData;r.append(`file`,t);let i=localStorage.getItem(`camstack_admin_token`)??``;try{(await(await fetch(`/api/addons/upload`,{method:`POST`,headers:{Authorization:`Bearer ${i}`},body:r})).json()).success&&e()}finally{n(!1)}},[e]);return C(T,{children:[O(`input`,{ref:r,type:`file`,accept:Q,onChange:b(e=>{let t=e.target.files?.[0];t&&i(t),e.target.value=``},[i]),className:`hidden`}),C(`button`,{type:`button`,onClick:()=>r.current?.click(),disabled:t,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:[t?O(I,{className:`w-3.5 h-3.5 animate-spin`}):O(N,{className:`w-3.5 h-3.5`}),t?`Uploading...`:`Upload`]})]})}S();var Oe=new Set([`@camstack/system`,`@camstack/types`,`@camstack/sdk`,`@camstack/shm-ring`,`@camstack/ui-library`]);function ke(e){return e!==void 0&&Oe.has(e)}function Ae(e,t){let n=e??`hub-only`;return n===`any-node`?!0:n===`hub-only`?t:!t}function je(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`}: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 Me(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 Ne({addons:e,clusterStatus:t,selectedNode:n,onRefresh:r,isRefreshing:a}){let o=E(),[s,c]=D(``),u=oe(s),[d,f]=D(!1),p=x(null);k(()=>{if(!d)return;let e=e=>{p.current&&!p.current.contains(e.target)&&f(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[d]);let{data:_}=y({nodeId:n.id}),te=w(()=>{let e=new Map;for(let t of _??[])e.set(t.name,t.latestVersion);return e},[_]),ne=w(()=>(_??[]).filter(e=>!e.isSystem).length,[_]),[re,ie]=D(()=>new Set),[S,T]=D(()=>new Map),se=b(e=>{ie(t=>new Set(t).add(e))},[]),ce=b(e=>{ie(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n})},[]),A=b((e,t)=>{T(n=>new Map(n).set(e,t))},[]),le=b(e=>{T(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),N=h({onMutate:e=>{se(e.name),le(e.name)},onSuccess:(e,t)=>{ce(t.name);let n=e;if(n&&n.success===!1){A(t.name,n.error??`Update failed (no error message returned by server)`);return}o.invalidateQueries({queryKey:[[`addons`]]}),o.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]})},onError:(e,t)=>{ce(t.name),A(t.name,e instanceof Error?e.message:String(e))}}),P=_e(),de=x(new Set);k(()=>{let e=new Set;for(let[t,n]of P)Y(n)&&e.add(t);let t=[...de.current].some(t=>!e.has(t));de.current=e,t&&(o.invalidateQueries({queryKey:[[`addons`]]}),o.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]}))},[P,o]);let{data:L}=v(void 0),R=ee({onSuccess:()=>{o.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),{data:z,isFetching:fe}=i({query:u||void 0},{enabled:d}),V=g(),{data:H}=m(void 0),U=H?.requestedAt,[me,he]=D(null),[W,G]=D(!1);k(()=>{if(H?.kind===`framework-bulk-update`&&H.requestedAt!==me){he(H.requestedAt),G(!0);let e=window.setTimeout(()=>G(!1),6e3);return()=>window.clearTimeout(e)}},[U,me,H]),ae();let K=b(async()=>{let e=(_??[]).filter(e=>!e.isSystem);e.length!==0&&await V.mutateAsync({kind:`update`,targets:e.map(e=>({name:e.name,version:e.latestVersion})),nodeIds:[n.id]})},[_,n.id,V]),q=l({onSuccess:()=>{o.invalidateQueries({queryKey:[[`addons`]]}),o.invalidateQueries({queryKey:[[`addonPages`]]}),o.invalidateQueries({queryKey:[[`capabilities`]]}),o.invalidateQueries({queryKey:[[`integrations`]]})}}),[J,ge]=D(`type`),[X,ve]=D(()=>typeof window>`u`?`grouped`:window.localStorage.getItem(`camstack.addons.viewMode`)===`flat`?`flat`:`grouped`),ye=e=>{ve(e),typeof window<`u`&&window.localStorage.setItem(`camstack.addons.viewMode`,e)},[be,xe]=pe(),Z=be.get(`capability`),Se=w(()=>{let t=e.filter(e=>!ke(e.manifest.packageName));return n.isHub||(t=t.filter(e=>Ae(e.placement,n.isHub))),Z&&(t=t.filter(e=>(e.manifest.capabilities??[]).some(e=>(typeof e==`string`?e:e.name)===Z))),t},[e,n.isHub,Z]),Ce=()=>{let e=new URLSearchParams(be);e.delete(`capability`),xe(e,{replace:!0})},we=X===`flat`?Se:Me(Se),Te=w(()=>{let e=[...we];switch(J){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},[we,J]);return C(`div`,{className:`space-y-4`,children:[[...S.entries()].map(([e,t])=>O(`div`,{className:`rounded-md border border-danger/30 bg-danger/5 px-3 py-2 text-[11px]`,children:C(`div`,{className:`flex items-start justify-between gap-3`,children:[C(`div`,{className:`space-y-0.5`,children:[C(`div`,{className:`font-medium text-danger`,children:[`Failed to update `,e]}),O(`div`,{className:`text-foreground-subtle font-mono`,children:t})]}),O(`button`,{type:`button`,onClick:()=>le(e),className:`text-foreground-subtle hover:text-foreground text-[10px]`,children:`dismiss`})]})},e)),C(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[C(`div`,{className:`flex items-center gap-1.5`,children:[O(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Sort:`}),C(`select`,{value:J,onChange:e=>ge(e.target.value),className:`rounded-md border border-border bg-surface px-2 py-1.5 text-[11px] text-foreground focus:outline-none focus:border-primary/50`,children:[O(`option`,{value:`type`,children:`Bundles first`}),O(`option`,{value:`name`,children:`Name`}),O(`option`,{value:`source`,children:`Install source`})]})]}),C(`div`,{className:`flex items-center gap-1.5`,children:[O(`span`,{className:`text-[10px] text-foreground-subtle`,children:`View:`}),O(`div`,{className:`flex rounded-md border border-border overflow-hidden text-[10px] font-medium`,children:[`grouped`,`flat`].map(e=>O(`button`,{type:`button`,onClick:()=>ye(e),className:`px-2.5 py-1.5 transition-colors capitalize ${X===e?`bg-primary/10 text-primary`:`bg-transparent text-foreground-subtle hover:bg-surface-hover`}`,title:e===`grouped`?`Group multi-addon packages into a bundle card`:`Show every addon as its own card`,children:e},e))})]}),n.isHub&&C(`div`,{className:`flex items-center gap-1.5`,children:[O(M,{className:`h-3 w-3 text-foreground-subtle`}),O(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Auto-Update:`}),O(`div`,{className:`flex rounded-md border border-border overflow-hidden text-[10px] font-medium`,children:[`off`,`latest`,`beta`].map(e=>O(`button`,{type:`button`,onClick:()=>R.mutate({channel:e}),disabled:R.isPending,className:`px-2.5 py-1.5 transition-colors capitalize ${L?.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))})]}),ne>0&&C(`button`,{type:`button`,onClick:()=>void K(),disabled:V.isPending,className:`flex items-center gap-1.5 px-2.5 py-1.5 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:[V.isPending?O(I,{className:`w-3 h-3 animate-spin`}):O(j,{className:`w-3 h-3`}),V.isPending?`Updating…`:`Update All (${ne})`]}),C(`button`,{type:`button`,onClick:r,disabled:a||V.isPending,className:`flex items-center gap-1.5 px-2.5 py-1.5 text-[11px] rounded-md bg-surface hover:bg-surface-hover border border-border disabled:opacity-50 transition-colors`,children:[O(M,{className:`w-3 h-3 ${a?`animate-spin`:``}`}),`Refresh`]})]}),C(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3`,children:[C(`div`,{className:`relative flex-1 min-w-0 sm:min-w-[200px]`,ref:p,children:[O(ue,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-foreground-subtle`}),O(`input`,{type:`text`,value:s,onChange:e=>{c(e.target.value),f(!0)},onFocus:()=>f(!0),placeholder:`Search addons on npm...`,disabled:V.isPending,className:`w-full rounded-lg border border-border bg-background pl-9 pr-3 py-2 text-xs text-foreground placeholder:text-foreground-subtle focus:outline-none focus:ring-1 focus:ring-primary disabled:opacity-50 disabled:cursor-not-allowed`}),fe&&O(I,{className:`absolute right-2.5 top-1/2 -translate-y-1/2 h-3 w-3 text-foreground-subtle animate-spin`}),d&&z&&z.length>0&&C(`div`,{className:`absolute left-0 right-0 top-full mt-1 z-40 rounded-lg border border-border bg-surface shadow-xl overflow-hidden`,children:[z.length>0&&C(`div`,{className:`px-3 py-1.5 text-[10px] uppercase tracking-wide text-foreground-subtle border-b border-border`,children:[`npm results (`,z.length,`)`]}),z&&z.length>0&&O(`div`,{className:`max-h-72 overflow-auto divide-y divide-border`,children:z.map(e=>C(`div`,{className:`flex items-center gap-3 px-3 py-2 hover:bg-surface-hover transition-colors`,children:[O(`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()}),C(`div`,{className:`flex-1 min-w-0`,children:[C(`div`,{className:`flex items-baseline gap-2 min-w-0`,children:[O(`span`,{className:`text-[11px] font-semibold break-words`,children:e.name.replace(/^@camstack\/(addon-)?/,``)}),C(`span`,{className:`text-[10px] text-foreground-subtle shrink-0`,children:[`v`,e.version]})]}),O(`div`,{className:`font-mono text-[9px] text-foreground-subtle/80 truncate`,children:e.name}),e.description&&O(`div`,{className:`text-[10px] text-foreground-subtle truncate`,children:e.description})]}),e.installed?C(`span`,{className:`inline-flex items-center gap-1 px-2 py-1 text-[10px] font-medium rounded-md border border-emerald-500/30 bg-emerald-500/10 text-emerald-400 shrink-0`,children:[O(F,{className:`h-3 w-3`}),e.installedVersion??`Installed`]}):C(`button`,{type:`button`,onClick:()=>q.mutate({packageName:e.name}),disabled:q.isPending,className:`inline-flex items-center gap-1 px-2 py-1 text-[10px] font-medium rounded-md bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 transition-colors shrink-0`,children:[q.isPending?O(I,{className:`h-3 w-3 animate-spin`}):O(j,{className:`h-3 w-3`}),`Install`]})]},e.name))})]})]}),O(De,{onUploadSuccess:()=>{o.invalidateQueries({queryKey:[[`addons`]]}),r()}})]}),Z&&C(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-lg bg-primary/10 border border-primary/30 text-sm`,children:[O(`span`,{className:`text-foreground-subtle`,children:`Filtering by capability:`}),O(`span`,{className:`font-mono text-primary font-semibold`,children:Z}),O(`button`,{type:`button`,onClick:Ce,className:`ml-auto text-xs text-foreground-subtle hover:text-foreground underline`,children:`Clear`})]}),W&&C(`div`,{className:`fixed top-4 right-4 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 backdrop-blur-sm max-w-sm pointer-events-auto`,children:[O(B,{className:`w-4 h-4 shrink-0 mt-0.5 text-green-400`}),C(`div`,{children:[O(`div`,{className:`text-[11px] font-semibold text-foreground`,children:`Bulk update completed`}),O(`div`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:`System packages updated — hub restarted successfully.`})]})]}),Se.length===0&&O(`div`,{className:`text-xs text-foreground-subtle`,children:e.length===0?`No addons installed`:Z?`No installed addons declare the "${Z}" capability. Browse the npm catalog above to find a compatible addon.`:`No addons compatible with ${n.name} (placement filter active)`}),O(`div`,{className:`space-y-2`,children:Te.map(e=>{let r=$(e)?e.bundle.packageName:e.manifest.packageName,i=te.get(r),a=$(e)?e.representative:e,o=i?e=>N.mutate({name:r,version:e,nodeId:n.id}):void 0,s=P.get(r)??null,c=s!==null&&Y(s);return O(Ee,{addon:a,clusterStatus:t?.[a.manifest.id],bundle:$(e)?e.bundle:void 0,availableUpdate:i,isUpdating:re.has(r)||c,jobProgress:s,onUpdate:o,disabledByBulk:V.isPending},$(e)?r:e.manifest.id)})})]})}function Pe(){let e=E(),{data:t,isLoading:n,isError:r}=re(),{data:i}=a(void 0),{data:c}=o(void 0,{refetchInterval:1e4}),l=w(()=>{let e=new Map;e.set(`hub`,{id:`hub`,name:`Hub`,isHub:!0});for(let t of c??[]){let n=String(t.id??``);n&&e.set(n,{id:n,name:String(t.name??n),isHub:!!t.isHub})}return[...e.values()]},[c]),[u,ee]=D(`hub`),f=l.find(e=>e.id===u)??l[0],p=d(),m=s(),h=p.isPending||m.isPending,g=async()=>{await p.mutateAsync({nodeId:u}),await m.mutateAsync(),e.invalidateQueries({queryKey:[[`addons`]]})},_=x(p);_.current=p,k(()=>{_.current.mutate({nodeId:`hub`})},[]);let v=(t??[]).map(je).filter(e=>e!==null);return C(U,{children:[C(`div`,{className:`flex items-center justify-between gap-3 flex-wrap`,children:[O(ie,{selectedNodeId:u,onSelect:ee}),C(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[!n&&!r&&C(`span`,{className:`text-[10px] rounded-full bg-primary/10 text-primary px-2 py-0.5 font-medium`,children:[v.length,` installed`]}),C(`button`,{type:`button`,onClick:()=>void g(),disabled:h,className:`inline-flex items-center gap-1.5 px-2.5 py-1.5 text-[11px] rounded-md bg-surface hover:bg-surface-hover border border-border disabled:opacity-50 transition-colors`,title:`Re-fetch addons + check npm for new versions`,children:[O(M,{className:`w-3 h-3 ${h?`animate-spin`:``}`}),`Check for updates`]})]})]}),!f.isHub&&C(`div`,{className:`rounded-md border border-warning/30 bg-warning/5 px-3 py-2 text-[11px] text-foreground-subtle`,children:[`Showing only addons compatible with`,` `,O(`span`,{className:`font-medium text-foreground`,children:f.name}),` — agents only run`,` `,O(`code`,{className:`font-mono`,children:`agent-only`}),` and`,` `,O(`code`,{className:`font-mono`,children:`any-node`}),` addons. Install / uninstall is hub-driven; agents auto-sync from the hub.`]}),n&&O(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading…`}),r&&O(`div`,{className:`text-xs text-danger`,children:`Failed to load addons`}),!n&&!r&&O(Ne,{addons:v,clusterStatus:i,selectedNode:f,onRefresh:()=>void g(),isRefreshing:h})]})}export{Pe as AddonsPage};