@camstack/addon-admin-ui 1.2.99 → 1.2.100

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 (114) hide show
  1. package/dist/assets/{AddLocationWizard-BoMdcUqK.js → AddLocationWizard-ww2FaZ1E.js} +1 -1
  2. package/dist/assets/{AddonCollectionPage-BeuyrbPU.js → AddonCollectionPage-2an6cPDR.js} +1 -1
  3. package/dist/assets/Addons-Dnc-RXgM.js +1 -0
  4. package/dist/assets/{AdminTabs-CX9dEC2O.js → AdminTabs-Bp6VWjqO.js} +1 -1
  5. package/dist/assets/AiProfiles-DpS2g7XY.js +3 -0
  6. package/dist/assets/{BrokerForm-B7hzX8rb.js → BrokerForm-MO0zLICQ.js} +1 -1
  7. package/dist/assets/{Build-tE4EhSaT.js → Build-C6grDXZj.js} +3 -3
  8. package/dist/assets/Capabilities-C1oKrOiJ.js +1 -0
  9. package/dist/assets/{CapabilityBadges-emVPX4I2.js → CapabilityBadges-CQ8iNKjJ.js} +1 -1
  10. package/dist/assets/{Cluster-JUwg2dkP.js → Cluster-BlBr9mrc.js} +1 -1
  11. package/dist/assets/{Data-Cxg1mPBE.js → Data-CbSER22j.js} +1 -1
  12. package/dist/assets/{DetectionIntelligence-CbKPyUop.js → DetectionIntelligence-CZyeSCJf.js} +1 -1
  13. package/dist/assets/{DeviceAggregateSection-waoppD0W.js → DeviceAggregateSection-DJUAmzyp.js} +1 -1
  14. package/dist/assets/{DeviceDetail-Dci5cbpv.js → DeviceDetail-DmgBCV4a.js} +2 -2
  15. package/dist/assets/{Devices-D9II1LJb.js → Devices-BrElFvY3.js} +1 -1
  16. package/dist/assets/{EmbedPlayerPage-BttmGIA6.js → EmbedPlayerPage-4Ay_8z3U.js} +1 -1
  17. package/dist/assets/Events-KnLsawMq.js +1 -0
  18. package/dist/assets/FormBuilder-CEw554z0.js +1 -0
  19. package/dist/assets/{Identity-BdTuPuKv.js → Identity-bGGI1QWE.js} +1 -1
  20. package/dist/assets/IntegrationDetail-eQjr_VZf.js +1 -0
  21. package/dist/assets/Integrations-CDOiRBS9.js +1 -0
  22. package/dist/assets/{Integrations-B5uZQ_hG.js → Integrations-R6vGB8m2.js} +1 -1
  23. package/dist/assets/{Logs-ClnZCjgz.js → Logs-It8Tm5s9.js} +1 -1
  24. package/dist/assets/{MotionZonesSettings-BcBzi-j4.js → MotionZonesSettings-DwzHsRPk.js} +1 -1
  25. package/dist/assets/MyAccess-Bo811JUn.js +2 -0
  26. package/dist/assets/Network-B6zVgaCe.js +1 -0
  27. package/dist/assets/{NodeAddonsSettingsPanel-ptvTM4Ri.js → NodeAddonsSettingsPanel-hGBeOFYH.js} +1 -1
  28. package/dist/assets/{NodeInferenceDevices-BOyHlH5j.js → NodeInferenceDevices-BCmCXC5y.js} +1 -1
  29. package/dist/assets/Notifications-DSAFFXJr.js +1 -0
  30. package/dist/assets/{Pipeline-tifFVNvD.js → Pipeline-BbnF9Ozb.js} +1 -1
  31. package/dist/assets/{Plates-DS0aJWI5.js → Plates-Ck6zc0jT.js} +1 -1
  32. package/dist/assets/{PrivacyMaskSettings-CWQfl1TC.js → PrivacyMaskSettings-B_z0irSV.js} +1 -1
  33. package/dist/assets/{ProviderIcon-BYY3__KP.js → ProviderIcon-DupRG1e9.js} +1 -1
  34. package/dist/assets/Recordings-BmEupF3w.js +1 -0
  35. package/dist/assets/{ScanNetworkModal-B8lG3NsX.js → ScanNetworkModal-D0r0hQ_h.js} +1 -1
  36. package/dist/assets/{SceneMonitorEditor-Bqwf_0qV.js → SceneMonitorEditor-CGXIUSVs.js} +1 -1
  37. package/dist/assets/{Scenes-Cwmh_GbN.js → Scenes-BNeqc2nK.js} +1 -1
  38. package/dist/assets/{Settings-D_2-xI9-.js → Settings-Bh1XKvEL.js} +1 -1
  39. package/dist/assets/{Showroom-Cl7eIhbG.js → Showroom-BzVgVZC7.js} +1 -1
  40. package/dist/assets/{Terminal-CFwukkqI.js → Terminal-B58p5WIp.js} +4 -4
  41. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-CI4I2cYP.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-TBqHL73f.js} +1 -1
  42. package/dist/assets/{bell-ring-CsQYceF5.js → bell-ring-DTczejZ4.js} +1 -1
  43. package/dist/assets/{boxes-6foKhsHw.js → boxes-C985Wrl0.js} +1 -1
  44. package/dist/assets/{build-cluster-graph-Ccj9w__U.js → build-cluster-graph-CipaA_oB.js} +2 -2
  45. package/dist/assets/circle-check-big-Bj2tv0Uy.js +1 -0
  46. package/dist/assets/{circle-x-Bf5Kcelv.js → circle-x-CDQw-Oki.js} +1 -1
  47. package/dist/assets/clock-BcKuptwD.js +1 -0
  48. package/dist/assets/{copy-B4N78LE2.js → copy-CAOXjD5r.js} +1 -1
  49. package/dist/assets/{debounced-invalidate-BvcuJvDz.js → debounced-invalidate-DpIEFwPp.js} +1 -1
  50. package/dist/assets/dist-BHaLZy2_.js +349 -0
  51. package/dist/assets/{dist-D-Jc8U0i.js → dist-CI4L7l-2.js} +1 -1
  52. package/dist/assets/{download-BsBZ8S8R.js → download-CAJNFrAB.js} +1 -1
  53. package/dist/assets/{face-bbox-CG7h6fE-.js → face-bbox-BFgt9EZy.js} +1 -1
  54. package/dist/assets/{hostInit-D01Z23QG.js → hostInit-CAD--nfI.js} +1 -1
  55. package/dist/assets/index-9YoL1cUW.css +2 -0
  56. package/dist/assets/index-KHEomj2t.js +4 -0
  57. package/dist/assets/{key-round-B46YLw7m.js → key-round-D_sH_q8V.js} +1 -1
  58. package/dist/assets/{mf-entry-bootstrap-0-063874c6.js → mf-entry-bootstrap-0-c4e36f72.js} +2 -2
  59. package/dist/assets/{pencil-BQJAwzya.js → pencil-CqqsHO49.js} +1 -1
  60. package/dist/assets/play-I3HZudQM.js +1 -0
  61. package/dist/assets/{player-overlays-BDZbxeCH.js → player-overlays-bbH94q-C.js} +1 -1
  62. package/dist/assets/plus-CJqabi49.js +1 -0
  63. package/dist/assets/power-txJcg2ZI.js +1 -0
  64. package/dist/assets/{radio-DpeKwLzo.js → radio-Cug4imoO.js} +1 -1
  65. package/dist/assets/{refresh-cw-DLQxYBTF.js → refresh-cw-BGCphjMn.js} +1 -1
  66. package/dist/assets/remoteEntry-BG1pNM_r.js +1 -0
  67. package/dist/assets/rotate-ccw-h1d3r46-.js +1 -0
  68. package/dist/assets/rotate-cw-Bfa_vcNi.js +1 -0
  69. package/dist/assets/{send-SvrrXT_D.js → send-C5aDTEjJ.js} +1 -1
  70. package/dist/assets/{server-ZhEvwONi.js → server-3wNyeBU4.js} +1 -1
  71. package/dist/assets/{shield-4rMaNiMB.js → shield-DplCqcL2.js} +1 -1
  72. package/dist/assets/square-BTe4gnO3.js +1 -0
  73. package/dist/assets/{square-check-big-B3-8gxk1.js → square-check-big-DH3-Pa_W.js} +1 -1
  74. package/dist/assets/src-CEeJOwlR.js +349 -0
  75. package/dist/assets/src-D7V1-vUs.js +67 -0
  76. package/dist/assets/{star-BwlNFxIs.js → star-Y4-10BmL.js} +1 -1
  77. package/dist/assets/{undo-2-DqcWKrwk.js → undo-2-DEYHOb0E.js} +1 -1
  78. package/dist/assets/{upload-C7vU_A2m.js → upload-BtP3VBCU.js} +1 -1
  79. package/dist/assets/{use-scenes-feed-8dvuhS6R.js → use-scenes-feed-BXzv1F4x.js} +1 -1
  80. package/dist/assets/useEventInvalidation-Bzw3MDRD.js +1 -0
  81. package/dist/assets/{video-CWHO5MEy.js → video-CXx7eETO.js} +1 -1
  82. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-CBSniS6c.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-DyH01HQs.js} +2 -2
  83. package/dist/assets/{wifi-BUxK1DpB.js → wifi-ClKydJp-.js} +1 -1
  84. package/dist/assets/{zap-C6IN4srQ.js → zap-Dnj7qxTO.js} +1 -1
  85. package/dist/index.html +6 -6
  86. package/dist/server/addon.js +192 -51
  87. package/package.json +1 -1
  88. package/dist/assets/Addons-BHwAi_Ds.js +0 -1
  89. package/dist/assets/AiProfiles-DlwniNcN.js +0 -3
  90. package/dist/assets/Capabilities-DxVvgAzD.js +0 -1
  91. package/dist/assets/Events-BjaKZpZf.js +0 -1
  92. package/dist/assets/FormBuilder-1r_2pkuu.js +0 -1
  93. package/dist/assets/IntegrationDetail-CvxZbTm2.js +0 -1
  94. package/dist/assets/Integrations-Dm_ug2n_.js +0 -1
  95. package/dist/assets/MyAccess-D27HsjNA.js +0 -2
  96. package/dist/assets/Network-BpaCiAzG.js +0 -1
  97. package/dist/assets/Notifications-BNZyRpU4.js +0 -1
  98. package/dist/assets/Recordings-DZSmzuAc.js +0 -1
  99. package/dist/assets/circle-check-big-B8rnDG8h.js +0 -1
  100. package/dist/assets/clock-DnzOV8EI.js +0 -1
  101. package/dist/assets/dist-CXnx4jTF.js +0 -349
  102. package/dist/assets/index-CUen2nrR.js +0 -4
  103. package/dist/assets/index-DM8saR4E.css +0 -2
  104. package/dist/assets/play-DoOoBM0P.js +0 -1
  105. package/dist/assets/plus-DDGOU54V.js +0 -1
  106. package/dist/assets/power-DmlMC-7S.js +0 -1
  107. package/dist/assets/remoteEntry-Dm-Wta47.js +0 -1
  108. package/dist/assets/rotate-ccw-wXYD6bC7.js +0 -1
  109. package/dist/assets/rotate-cw-ClC0Tfzf.js +0 -1
  110. package/dist/assets/search-C1UMvnoJ.js +0 -1
  111. package/dist/assets/square-ookqWTBx.js +0 -1
  112. package/dist/assets/src-BO2615nJ.js +0 -67
  113. package/dist/assets/src-BgxUlUk-.js +0 -349
  114. package/dist/assets/useEventInvalidation-BEgRNMRl.js +0 -1
@@ -6631,7 +6631,7 @@ function method(input, output, options) {
6631
6631
  input,
6632
6632
  output,
6633
6633
  kind: options?.kind ?? "query",
6634
- auth: options?.auth ?? "protected",
6634
+ ...options?.auth !== void 0 ? { auth: options.auth } : {},
6635
6635
  ...options?.access !== void 0 ? { access: options.access } : {},
6636
6636
  ...options?.caller !== void 0 ? { caller: options.caller } : {},
6637
6637
  timeoutMs: options?.timeoutMs
@@ -6657,8 +6657,17 @@ var adminUiCapability = {
6657
6657
  mode: "singleton",
6658
6658
  internal: true,
6659
6659
  methods: {
6660
- getStaticDir: method(_void(), StaticDirOutputSchema$1),
6661
- getVersion: method(_void(), VersionOutputSchema$1)
6660
+ /**
6661
+ * `internal: true` did not gate the mount (see the 2026-08-26 note on
6662
+ * `data-store-provider`) — both methods were reachable on the AppRouter
6663
+ * by ANY authenticated session at the default `auth: 'protected'`, and
6664
+ * `getStaticDir` leaks a hub filesystem path. The only caller is
6665
+ * `main.ts`'s static-file bootstrap, via `capRegistry.getSingletonForNode`
6666
+ * — never tRPC — so `auth: 'admin'` costs it nothing. The actual admin-ui
6667
+ * SPA assets are served as plain static files, unaffected by this gate.
6668
+ */
6669
+ getStaticDir: method(_void(), StaticDirOutputSchema$1, { auth: "admin" }),
6670
+ getVersion: method(_void(), VersionOutputSchema$1, { auth: "admin" })
6662
6671
  }
6663
6672
  };
6664
6673
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
@@ -6981,7 +6990,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
6981
6990
  }({});
6982
6991
  var StaticDirOutputSchema = object({ staticDir: string() });
6983
6992
  var VersionOutputSchema = object({ version: string() });
6984
- method(_void(), StaticDirOutputSchema), method(_void(), VersionOutputSchema);
6993
+ method(_void(), StaticDirOutputSchema, { auth: "admin" }), method(_void(), VersionOutputSchema, { auth: "admin" });
6985
6994
  /**
6986
6995
  * device-ops — device-scoped cap that unifies the per-IDevice operations
6987
6996
  * previously routed through the `.device-ops` Moleculer bridge service.
@@ -7705,10 +7714,11 @@ var RelocateFootageInputSchema = object({
7705
7714
  * `RecordingConfig.enabled` or camera wrapper bindings. */
7706
7715
  var StorageMigrationLeaseInputSchema = object({ leaseId: string().min(1) });
7707
7716
  var StorageMigrationFootageMoveInputSchema = RelocateFootageInputSchema.extend({ leaseId: string().min(1) });
7708
- var StorageMigrationMediaMoveInputSchema = object({
7717
+ var RelocateMediaInputSchema = object({
7709
7718
  toLocationId: string(),
7710
7719
  throttleMbps: number().min(1).max(1e3).optional()
7711
- }).extend({ leaseId: string().min(1) });
7720
+ });
7721
+ var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
7712
7722
  /** The independently selectable logical storage classes. `recordings`
7713
7723
  * encompasses the high and mid segment profiles; `recordingsLow` is low
7714
7724
  * segments; `eventMedia` is post-analysis blobs. */
@@ -8003,7 +8013,26 @@ var LabelDefinitionSchema = object({
8003
8013
  description: string().optional(),
8004
8014
  icon: string().optional()
8005
8015
  });
8006
- var ClassMapDefinitionSchema = object({
8016
+ /**
8017
+ * Wire schema for a per-model CATALOG classMap override
8018
+ * (`ModelCatalogEntry.classMap` / `ModelConvertMetadata.classMap`) —
8019
+ * restricted to {@link CLASS_MAP_MACRO_TARGETS}, the only macros the
8020
+ * detection pipeline executor actually routes.
8021
+ *
8022
+ * This is deliberately a DIFFERENT, narrower shape than the general-purpose
8023
+ * `ClassMapDefinition` interface above (e.g. `IDetectionAddon.getClassMap()`
8024
+ * and the audio `YAMNET_TO_MACRO` catalog both use macro targets outside this
8025
+ * enum) — the two used to share the name `ClassMapDefinition`/
8026
+ * `ClassMapDefinitionSchema`, which made the schema-type-twin guard
8027
+ * (`scripts/check-schema-type-twins.ts`) flag them as a duplicated shape. They
8028
+ * are not: it is two different concepts colliding on a name. Keep this type
8029
+ * under its own name rather than reusing `ClassMapDefinition` — reusing it
8030
+ * would either narrow every `ClassMapDefinition` consumer to the four
8031
+ * detection macros (breaking `YAMNET_TO_MACRO`) or drop the validation this
8032
+ * schema exists for (see the "rejects a classMap whose target is not a
8033
+ * detection macro" test in `model-catalog-schema.test.ts`).
8034
+ */
8035
+ var DetectionCatalogClassMapSchema = object({
8007
8036
  mapping: record(string(), _enum([
8008
8037
  "person",
8009
8038
  "vehicle",
@@ -8208,7 +8237,7 @@ var ModelCatalogEntrySchema = object({
8208
8237
  * applies (Frigate / COCO public catalog). Set on a custom model whose raw
8209
8238
  * labels already ARE the CamStack macros (Scrypted identity map).
8210
8239
  */
8211
- classMap: ClassMapDefinitionSchema.optional()
8240
+ classMap: DetectionCatalogClassMapSchema.optional()
8212
8241
  });
8213
8242
  var ConvertTargetSchema = discriminatedUnion("format", [object({
8214
8243
  format: literal("openvino"),
@@ -8238,7 +8267,7 @@ var ModelConvertMetadataSchema = object({
8238
8267
  "segmentation"
8239
8268
  ]),
8240
8269
  faceAlignment: boolean().optional(),
8241
- classMap: ClassMapDefinitionSchema.optional()
8270
+ classMap: DetectionCatalogClassMapSchema.optional()
8242
8271
  });
8243
8272
  var ConvertResultSchema = object({
8244
8273
  entry: ModelCatalogEntrySchema,
@@ -9101,7 +9130,7 @@ var AddonPageDeclarationSchema = object({
9101
9130
  /** Display label for a CUSTOM `section` id (ignored for well-known ids). */
9102
9131
  sectionLabel: string().optional()
9103
9132
  });
9104
- method(_void(), array(AddonPageDeclarationSchema).readonly());
9133
+ method(_void(), array(AddonPageDeclarationSchema).readonly(), { auth: "admin" });
9105
9134
  var AddonHttpRouteSchema = object({
9106
9135
  method: _enum([
9107
9136
  "GET",
@@ -9336,7 +9365,7 @@ var WidgetMetadataSchema = object({
9336
9365
  defaultColumns: number().int().min(1).max(12).default(6),
9337
9366
  defaultRows: number().int().min(1).max(12).default(1)
9338
9367
  });
9339
- method(_void(), array(WidgetMetadataSchema).readonly());
9368
+ method(_void(), array(WidgetMetadataSchema).readonly(), { auth: "admin" });
9340
9369
  /**
9341
9370
  * `addon-widgets` — system-scoped singleton aggregator cap. Public-facing
9342
9371
  * surface that admin-ui consumes through `useAddonWidgetsListWidgets()`.
@@ -10858,7 +10887,7 @@ var CustomModelDescriptorSchema = object({
10858
10887
  stepId: string(),
10859
10888
  entry: ModelCatalogEntrySchema
10860
10889
  });
10861
- method(_void(), array(CustomModelDescriptorSchema).readonly());
10890
+ method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" });
10862
10891
  /**
10863
10892
  * Query filter for settings-store collections.
10864
10893
  */
@@ -11009,56 +11038,87 @@ var EngineInfoSchema = object({
11009
11038
  kind: _enum(["relational", "vector"]),
11010
11039
  displayName: string()
11011
11040
  });
11012
- method(_void(), EngineInfoSchema), method(object({
11041
+ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
11013
11042
  namespace: string().optional(),
11014
11043
  collection: string(),
11015
11044
  key: string()
11016
- }), unknown()), method(object({
11045
+ }), unknown(), { auth: "admin" }), method(object({
11017
11046
  namespace: string().optional(),
11018
11047
  collection: string(),
11019
11048
  key: string(),
11020
11049
  value: unknown()
11021
- }), _void(), { kind: "mutation" }), method(object({
11050
+ }), _void(), {
11051
+ kind: "mutation",
11052
+ auth: "admin"
11053
+ }), method(object({
11022
11054
  namespace: string().optional(),
11023
11055
  collection: string(),
11024
11056
  filter: QueryFilterSchema.optional(),
11025
11057
  /**
11026
11058
  * SQL-level column projection — MUST mirror `settings-store.query`.
11027
11059
  *
11028
- * This is the second schema the same call passes through, and Zod
11029
- * objects STRIP what they do not declare: a field present on the door
11030
- * and absent here does not error, it silently disappears one hop before
11031
- * the engine, and the caller concludes the projection does nothing.
11032
- * `data-door-schema-parity.spec.ts` is what keeps the two in step.
11060
+ * An earlier version of this comment blamed Zod stripping, and that
11061
+ * was wrong corrected 2026-08-26 after the hop map
11062
+ * (`docs/design/2026-08-26-mappa-hop-argomenti.md`) traced the path.
11063
+ * There is **no Zod parse at all** between the door and the engine: the
11064
+ * dispatcher forwards the payload verbatim and UDS carries it whole. A
11065
+ * field declared here reaches `SqliteSettingsBackend` either way.
11066
+ *
11067
+ * What actually lost `columns` was the THIRD declaration of this shape:
11068
+ * `SettingsQueryInput` in `interfaces/storage.ts`, a hand-written TS
11069
+ * interface the engine destructures from. The field existed on both
11070
+ * schemas and the engine still never read it, because nothing checks a
11071
+ * registered provider against `InferProvider<cap>` —
11072
+ * `ProviderRegistration.provider` is typed `object`.
11073
+ *
11074
+ * It is declared here anyway, and must stay in step with
11075
+ * `settings-store.query`: a caller reading only the cap definitions has
11076
+ * to be able to see that this call carries a projection.
11077
+ * `data-door-schema-parity.spec.ts` keeps the two aligned.
11033
11078
  */
11034
11079
  columns: array(string()).readonly().optional()
11035
- }), array(SettingsRecordSchema).readonly()), method(object({
11080
+ }), array(SettingsRecordSchema).readonly(), { auth: "admin" }), method(object({
11036
11081
  namespace: string().optional(),
11037
11082
  collection: string(),
11038
11083
  record: SettingsRecordSchema
11039
- }), _void(), { kind: "mutation" }), method(object({
11084
+ }), _void(), {
11085
+ kind: "mutation",
11086
+ auth: "admin"
11087
+ }), method(object({
11040
11088
  namespace: string().optional(),
11041
11089
  collection: string(),
11042
11090
  id: string(),
11043
11091
  data: record(string(), unknown())
11044
- }), _void(), { kind: "mutation" }), method(object({
11092
+ }), _void(), {
11093
+ kind: "mutation",
11094
+ auth: "admin"
11095
+ }), method(object({
11045
11096
  namespace: string().optional(),
11046
11097
  collection: string(),
11047
11098
  key: string()
11048
- }), _void(), { kind: "mutation" }), method(object({
11099
+ }), _void(), {
11100
+ kind: "mutation",
11101
+ auth: "admin"
11102
+ }), method(object({
11049
11103
  namespace: string().optional(),
11050
11104
  collection: string(),
11051
11105
  filter: MutationFilterSchema
11052
- }), object({ deleted: number().int() }), { kind: "mutation" }), method(object({
11106
+ }), object({ deleted: number().int() }), {
11107
+ kind: "mutation",
11108
+ auth: "admin"
11109
+ }), method(object({
11053
11110
  namespace: string().optional(),
11054
11111
  collection: string(),
11055
11112
  filter: MutationFilterSchema,
11056
11113
  data: record(string(), unknown())
11057
- }), object({ updated: number().int() }), { kind: "mutation" }), method(object({
11114
+ }), object({ updated: number().int() }), {
11115
+ kind: "mutation",
11116
+ auth: "admin"
11117
+ }), method(object({
11058
11118
  namespace: string().optional(),
11059
11119
  collection: string(),
11060
11120
  filter: QueryFilterSchema.optional()
11061
- }), number()), method(object({
11121
+ }), number(), { auth: "admin" }), method(object({
11062
11122
  namespace: string().optional(),
11063
11123
  collection: string(),
11064
11124
  field: string(),
@@ -11068,15 +11128,18 @@ method(_void(), EngineInfoSchema), method(object({
11068
11128
  }), array(object({
11069
11129
  bucket: number().int(),
11070
11130
  count: number().int()
11071
- })).readonly()), method(object({
11131
+ })).readonly(), { auth: "admin" }), method(object({
11072
11132
  namespace: string().optional(),
11073
11133
  collection: string()
11074
- }), boolean()), method(object({
11134
+ }), boolean(), { auth: "admin" }), method(object({
11075
11135
  namespace: string().optional(),
11076
11136
  collection: string(),
11077
11137
  columns: array(CollectionColumnSchema).readonly(),
11078
11138
  indexes: array(CollectionIndexSchema).readonly().optional()
11079
- }), _void(), { kind: "mutation" });
11139
+ }), _void(), {
11140
+ kind: "mutation",
11141
+ auth: "admin"
11142
+ });
11080
11143
  /**
11081
11144
  * shm ring usage stats for a `frameSink: 'shm'` decoder session —
11082
11145
  * exposed via `decoder.getShmStats` so downstream consumers can
@@ -12204,7 +12267,7 @@ method(object({
12204
12267
  crop: _instanceof(Uint8Array),
12205
12268
  width: number(),
12206
12269
  height: number()
12207
- }), EmbeddingResultSchema), method(object({ text: string() }), EmbeddingResultSchema), method(_void(), EmbeddingInfoSchema);
12270
+ }), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
12208
12271
  /**
12209
12272
  * filesystem-browse — per-node capability for browsing the node's local
12210
12273
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
@@ -12497,19 +12560,22 @@ method(LlmGenerateBaseInputSchema.extend({
12497
12560
  runtime: ManagedRuntimeConfigSchema,
12498
12561
  /** The managed profile's timeout, threaded by the hub provider. */
12499
12562
  timeoutMs: number().int().positive().optional()
12500
- }), LlmGenerateResultSchema, { kind: "mutation" }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
12563
+ }), LlmGenerateResultSchema, {
12564
+ kind: "mutation",
12565
+ auth: "admin"
12566
+ }), method(object({ runtime: ManagedRuntimeConfigSchema }), LlmRuntimeStatusSchema, {
12501
12567
  kind: "mutation",
12502
12568
  auth: "admin"
12503
12569
  }), method(object({}), _void(), {
12504
12570
  kind: "mutation",
12505
12571
  auth: "admin"
12506
- }), method(object({}), LlmRuntimeStatusSchema), method(object({ model: ManagedModelRefSchema }), _void(), {
12572
+ }), method(object({}), LlmRuntimeStatusSchema, { auth: "admin" }), method(object({ model: ManagedModelRefSchema }), _void(), {
12507
12573
  kind: "mutation",
12508
12574
  auth: "admin"
12509
12575
  }), method(object({ file: string() }), _void(), {
12510
12576
  kind: "mutation",
12511
12577
  auth: "admin"
12512
- }), method(object({}), array(LlmNodeModelSchema)), method(object({}), LlmRuntimeDiskUsageSchema);
12578
+ }), method(object({}), array(LlmNodeModelSchema), { auth: "admin" }), method(object({}), LlmRuntimeDiskUsageSchema, { auth: "admin" });
12513
12579
  /**
12514
12580
  * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
12515
12581
  * methods concat-fan across providers; single-row methods route to ONE
@@ -15982,7 +16048,7 @@ var OauthIntegrationDescriptorSchema = object({
15982
16048
  */
15983
16049
  refreshTokenTtlSec: union([number().int().positive(), literal("never")]).optional()
15984
16050
  });
15985
- method(_void(), OauthIntegrationDescriptorSchema);
16051
+ method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
15986
16052
  /**
15987
16053
  * pipeline-analytics — device-scoped wrapper cap. Refines raw
15988
16054
  * per-frame detections emitted by the pipeline runner into tracked
@@ -17177,6 +17243,15 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
17177
17243
  }), method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
17178
17244
  kind: "mutation",
17179
17245
  auth: "admin"
17246
+ }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
17247
+ kind: "mutation",
17248
+ auth: "admin"
17249
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
17250
+ kind: "query",
17251
+ auth: "admin"
17252
+ }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
17253
+ kind: "mutation",
17254
+ auth: "admin"
17180
17255
  }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
17181
17256
  kind: "query",
17182
17257
  auth: "admin"
@@ -17331,6 +17406,11 @@ object({
17331
17406
  "jpeg"
17332
17407
  ])
17333
17408
  });
17409
+ /**
17410
+ * Process-local frame identity. It is serializable so it can ride an in-process
17411
+ * capability call, but `registryId` deliberately prevents resolution in any
17412
+ * other process or execution group.
17413
+ */
17334
17414
  var FrameRefSchema = object({
17335
17415
  registryId: string().min(1),
17336
17416
  id: string().min(1),
@@ -19496,7 +19576,7 @@ method(object({
19496
19576
  * linking rather than produce an eternal token.
19497
19577
  */
19498
19578
  ttlSec: union([number().int().positive(), literal("never")]).optional()
19499
- }), object({ token: string() })), method(object({ token: string() }), SsoBridgeClaimsSchema.nullable());
19579
+ }), object({ token: string() }), { auth: "admin" }), method(object({ token: string() }), SsoBridgeClaimsSchema.nullable(), { auth: "admin" });
19500
19580
  var ProviderListEntrySchema = discriminatedUnion("shouldSaveDiskSpace", [object({
19501
19581
  providerId: string().min(1),
19502
19582
  displayName: string().min(1),
@@ -19591,10 +19671,13 @@ var EvictResultSchema = object({
19591
19671
  /** True when the provider has nothing left it is willing to drop on this location. */
19592
19672
  exhausted: boolean()
19593
19673
  });
19594
- method(object({ locationId: string() }), EvictableUsageSchema), method(object({
19674
+ method(object({ locationId: string() }), EvictableUsageSchema, { auth: "admin" }), method(object({
19595
19675
  locationId: string(),
19596
19676
  targetBytes: number().int().positive()
19597
- }), EvictResultSchema, { kind: "mutation" });
19677
+ }), EvictResultSchema, {
19678
+ kind: "mutation",
19679
+ auth: "admin"
19680
+ });
19598
19681
  method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin" }), method(StorageMigrationInputSchema, object({ jobId: string() }), {
19599
19682
  kind: "mutation",
19600
19683
  auth: "admin"
@@ -19654,26 +19737,50 @@ var ReadChunkInputSchema = object({
19654
19737
  length: number()
19655
19738
  });
19656
19739
  var EndDownloadInputSchema = object({ downloadId: string() });
19657
- method(_void(), ProviderInfoSchema), method(object({ config: record(string(), unknown()) }), TestLocationResultSchema, { auth: "admin" }), method(object({
19740
+ method(_void(), ProviderInfoSchema, { auth: "admin" }), method(object({ config: record(string(), unknown()) }), TestLocationResultSchema, { auth: "admin" }), method(object({
19658
19741
  location: StorageLocationSchema,
19659
19742
  relativePath: string()
19660
- }), string()), method(object({
19743
+ }), string(), { auth: "admin" }), method(object({
19661
19744
  location: StorageLocationSchema,
19662
19745
  relativePath: string(),
19663
19746
  data: _instanceof(Uint8Array)
19664
- }), _void(), { kind: "mutation" }), method(object({
19747
+ }), _void(), {
19748
+ kind: "mutation",
19749
+ auth: "admin"
19750
+ }), method(object({
19665
19751
  location: StorageLocationSchema,
19666
19752
  relativePath: string()
19667
- }), _instanceof(Uint8Array)), method(object({
19753
+ }), _instanceof(Uint8Array), { auth: "admin" }), method(object({
19668
19754
  location: StorageLocationSchema,
19669
19755
  relativePath: string()
19670
- }), boolean()), method(object({
19756
+ }), boolean(), { auth: "admin" }), method(object({
19671
19757
  location: StorageLocationSchema,
19672
19758
  prefix: string().optional()
19673
- }), array(string()).readonly()), method(object({
19759
+ }), array(string()).readonly(), { auth: "admin" }), method(object({
19674
19760
  location: StorageLocationSchema,
19675
19761
  relativePath: string()
19676
- }), _void(), { kind: "mutation" }), method(object({ location: StorageLocationSchema }), number().nullable()), method(BeginUploadInputSchema, BeginUploadResultSchema, { kind: "mutation" }), method(WriteChunkInputSchema, _void(), { kind: "mutation" }), method(FinalizeUploadInputSchema, _void(), { kind: "mutation" }), method(AbortUploadInputSchema, _void(), { kind: "mutation" }), method(BeginDownloadInputSchema, BeginDownloadResultSchema, { kind: "mutation" }), method(ReadChunkInputSchema, _instanceof(Uint8Array)), method(EndDownloadInputSchema, _void(), { kind: "mutation" });
19762
+ }), _void(), {
19763
+ kind: "mutation",
19764
+ auth: "admin"
19765
+ }), method(object({ location: StorageLocationSchema }), number().nullable(), { auth: "admin" }), method(BeginUploadInputSchema, BeginUploadResultSchema, {
19766
+ kind: "mutation",
19767
+ auth: "admin"
19768
+ }), method(WriteChunkInputSchema, _void(), {
19769
+ kind: "mutation",
19770
+ auth: "admin"
19771
+ }), method(FinalizeUploadInputSchema, _void(), {
19772
+ kind: "mutation",
19773
+ auth: "admin"
19774
+ }), method(AbortUploadInputSchema, _void(), {
19775
+ kind: "mutation",
19776
+ auth: "admin"
19777
+ }), method(BeginDownloadInputSchema, BeginDownloadResultSchema, {
19778
+ kind: "mutation",
19779
+ auth: "admin"
19780
+ }), method(ReadChunkInputSchema, _instanceof(Uint8Array), { auth: "admin" }), method(EndDownloadInputSchema, _void(), {
19781
+ kind: "mutation",
19782
+ auth: "admin"
19783
+ });
19677
19784
  /** Profile-exported FormBuilder schema. Shape is ConfigUISchema at the UI. */
19678
19785
  var ProfileSettingsSchemaBridge = unknown().nullable();
19679
19786
  var ProfileSettingsBagSchema = record(string(), unknown());
@@ -19931,7 +20038,8 @@ method(object({
19931
20038
  access: "create"
19932
20039
  }), method(object({ userId: string().optional() }), object({ optionsJSON: record(string(), unknown()) }), {
19933
20040
  kind: "mutation",
19934
- access: "view"
20041
+ access: "view",
20042
+ auth: "admin"
19935
20043
  }), method(object({
19936
20044
  /** Required — the user the assertion belongs to (verified). */
19937
20045
  userId: string(),
@@ -19939,10 +20047,12 @@ method(object({
19939
20047
  response: record(string(), unknown())
19940
20048
  }), object({ verified: boolean() }), {
19941
20049
  kind: "mutation",
19942
- access: "view"
20050
+ access: "view",
20051
+ auth: "admin"
19943
20052
  }), method(object({}), object({ optionsJSON: record(string(), unknown()) }), {
19944
20053
  kind: "mutation",
19945
- access: "view"
20054
+ access: "view",
20055
+ auth: "admin"
19946
20056
  }), method(object({
19947
20057
  /** AuthenticationResponseJSON from the browser. */
19948
20058
  response: record(string(), unknown()) }), object({
@@ -19950,7 +20060,8 @@ response: record(string(), unknown()) }), object({
19950
20060
  userId: string().nullable()
19951
20061
  }), {
19952
20062
  kind: "mutation",
19953
- access: "view"
20063
+ access: "view",
20064
+ auth: "admin"
19954
20065
  }), method(object({ userId: string() }), array(PasskeySummarySchema), { auth: "admin" }), method(object({
19955
20066
  userId: string(),
19956
20067
  credentialId: string()
@@ -20122,7 +20233,19 @@ var VectorStatsResultSchema = object({
20122
20233
  /** False when the backend ranks approximately. */
20123
20234
  exact: boolean()
20124
20235
  });
20125
- method(VectorDeclareIndexInputSchema, _void(), { kind: "mutation" }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, { kind: "mutation" }), method(VectorQueryInputSchema, VectorQueryResultSchema), method(VectorGetInputSchema, VectorGetResultSchema), method(VectorDeleteInputSchema, VectorDeleteResultSchema, { kind: "mutation" }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, { kind: "mutation" }), method(VectorStatsInputSchema, VectorStatsResultSchema);
20236
+ method(VectorDeclareIndexInputSchema, _void(), {
20237
+ kind: "mutation",
20238
+ auth: "admin"
20239
+ }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
20240
+ kind: "mutation",
20241
+ auth: "admin"
20242
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
20243
+ kind: "mutation",
20244
+ auth: "admin"
20245
+ }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
20246
+ kind: "mutation",
20247
+ auth: "admin"
20248
+ }), method(VectorStatsInputSchema, VectorStatsResultSchema, { auth: "admin" });
20126
20249
  var ClipSchema = object({
20127
20250
  /** Opaque, provider-namespaced id. The default provider encodes the time
20128
20251
  * window so `getClipPlayback` is self-contained (no event re-query). */
@@ -29459,6 +29582,12 @@ Object.freeze({
29459
29582
  addonId: null,
29460
29583
  access: "create"
29461
29584
  },
29585
+ "pipelineAnalytics.cancelRelocateMedia": {
29586
+ capName: "pipeline-analytics",
29587
+ capScope: "device",
29588
+ addonId: null,
29589
+ access: "create"
29590
+ },
29462
29591
  "pipelineAnalytics.cancelStorageMigrationMove": {
29463
29592
  capName: "pipeline-analytics",
29464
29593
  capScope: "device",
@@ -29633,6 +29762,12 @@ Object.freeze({
29633
29762
  addonId: null,
29634
29763
  access: "view"
29635
29764
  },
29765
+ "pipelineAnalytics.listRelocateMediaJobs": {
29766
+ capName: "pipeline-analytics",
29767
+ capScope: "device",
29768
+ addonId: null,
29769
+ access: "view"
29770
+ },
29636
29771
  "pipelineAnalytics.listRetrainAnnotations": {
29637
29772
  capName: "pipeline-analytics",
29638
29773
  capScope: "device",
@@ -29711,6 +29846,12 @@ Object.freeze({
29711
29846
  addonId: null,
29712
29847
  access: "create"
29713
29848
  },
29849
+ "pipelineAnalytics.relocateMedia": {
29850
+ capName: "pipeline-analytics",
29851
+ capScope: "device",
29852
+ addonId: null,
29853
+ access: "create"
29854
+ },
29714
29855
  "pipelineAnalytics.restageRetrainTrack": {
29715
29856
  capName: "pipeline-analytics",
29716
29857
  capScope: "device",
@@ -34334,7 +34475,7 @@ var AdminUIAddon = class extends BaseAddon {
34334
34475
  capability: adminUiCapability,
34335
34476
  provider: {
34336
34477
  getStaticDir: async () => ({ staticDir: resolveAdminUiDistDir() }),
34337
- getVersion: async () => ({ version: "1.2.99" })
34478
+ getVersion: async () => ({ version: "1.2.100" })
34338
34479
  }
34339
34480
  }];
34340
34481
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-admin-ui",
3
- "version": "1.2.99",
3
+ "version": "1.2.100",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Admin UI — Vite frontend build and server-side addon",
@@ -1 +0,0 @@
1
- import{I as e,K as t,Q as n,R as r,S as i,W as a,b as o,o as s,q as c,x as l,z as u}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{Z as d}from"./player-overlays-BDZbxeCH.js";import{An as f,Bn as p,C as m,Cn as h,En as g,Fn as _,In as v,J as y,K as ee,Nn as b,On as x,Pn as S,Ps as C,Rn as te,Sn as ne,Tn as re,Zi as w,bn as T,g as ie,jn as ae,kn as oe,ln as se,ra as E,wn as D,xn as O,yn as ce,zn as le}from"./src-BO2615nJ.js";import{Rt as k}from"./src-BgxUlUk-.js";import{t as A}from"./clock-DnzOV8EI.js";import{t as j}from"./download-BsBZ8S8R.js";import{t as ue}from"./plus-DDGOU54V.js";import{t as M}from"./refresh-cw-DLQxYBTF.js";import{t as N}from"./search-C1UMvnoJ.js";import{t as P}from"./upload-C7vU_A2m.js";import{C as F,J as de,K as I,P as L,R,X as z,_ as fe,i as B,m as V,p as pe,s as H,z as U}from"./index-CUen2nrR.js";import{t as W}from"./AdminPage-CCD07UMs.js";import{t as me}from"./NodeAddonsSettingsPanel-ptvTM4Ri.js";var he=I(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),ge=I(`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`}]]),_e=I(`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`}]]),G=I(`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`}]]);n();var K=new Set([`completed`,`failed`,`partially-failed`,`cancelled`]),q=new Set([`done`,`failed`,`skipped`]);function ve(e){return!q.has(e.phase)&&!K.has(e.jobState)}function J(e,t){let n=new Map,r=[...e].sort((e,t)=>e.createdAtMs-t.createdAtMs);for(let e of r){let r=K.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 ye(){let{data:e}=x({activeOnly:!0},{refetchOnWindowFocus:!1,refetchInterval:e=>(e.state.data?.length??0)>0?3e3:!1}),{map:t}=C(k.AddonsJobProgress,e=>e.job.jobId);return a(()=>{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 J([...n.values()],Date.now())},[e,t])}var be={queued:{icon:A,cls:`bg-muted text-foreground-subtle`,label:`queued`},fetching:{icon:F,cls:`bg-primary/10 text-primary`,label:`fetching`,spin:!0},staged:{icon:F,cls:`bg-primary/10 text-primary`,label:`staged`,spin:!0},validating:{icon:F,cls:`bg-primary/10 text-primary`,label:`validating`,spin:!0},applying:{icon:F,cls:`bg-primary/10 text-primary`,label:`applying`,spin:!0},restarting:{icon:F,cls:`bg-amber-500/10 text-amber-600 dark:text-amber-400`,label:`restarting`,spin:!0},applied:{icon:F,cls:`bg-primary/10 text-primary`,label:`finalizing`,spin:!0},done:{icon:U,cls:`bg-success/10 text-success`,label:`updated`},failed:{icon:ge,cls:`bg-danger/10 text-danger`,label:`failed`},skipped:{icon:G,cls:`bg-muted text-foreground-subtle`,label:`skipped`}};function xe({progress:e}){let t=be[e.phase],n=t.icon,r=e.error??`${e.packageName}: ${e.fromVersion??`?`} → ${e.toVersion}`;return i(`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:[l(n,{className:`w-2.5 h-2.5 ${t.spin?`animate-spin`:``}`}),t.label,i(`span`,{className:`font-mono`,children:[`→ `,e.toVersion]})]})}function Se({packageName:e,currentVersion:t,installSource:n,onInstall:r,onClose:a,onSelect:s,selectedVersion:c}){let u=n===`upload`||n===`local`,{data:d,isLoading:f}=D({name:e});return i(`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:[i(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border`,children:[l(`span`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle font-medium`,children:`Versions`}),l(`button`,{type:`button`,onClick:a,className:`text-foreground-subtle hover:text-foreground`,children:l(B,{className:`h-3 w-3`})})]}),u&&i(`div`,{className:`flex items-start gap-2 px-3 py-2 border-b border-border bg-cyan-500/10 text-[10px]`,children:[l(P,{className:`h-3 w-3 mt-0.5 text-cyan-500 shrink-0`}),i(`div`,{className:`text-cyan-700 dark:text-cyan-200`,children:[i(`span`,{className:`font-semibold`,children:[n===`upload`?`Uploaded copy`:`Local copy`,` in place.`]}),` `,`Re-install `,l(`span`,{className:`font-mono`,children:t}),` from npm to track upstream releases again.`]})]}),f&&i(`div`,{className:`flex items-center justify-center gap-2 py-6 text-[10px] text-foreground-subtle`,children:[l(F,{className:`h-3.5 w-3.5 animate-spin`}),`Loading versions...`]}),d&&l(`div`,{className:`max-h-64 overflow-auto divide-y divide-border`,children:d.map(e=>{let n=e.version===t,a=s!==void 0&&e.version===c,d=/-(alpha|beta|rc|dev|canary|next)/i.test(e.version),f=i(o,{children:[l(`span`,{className:`font-mono flex-1 text-left ${n?`text-primary font-semibold`:d?`text-amber-400`:`text-foreground`}`,children:e.version}),n&&l(`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=>l(`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&&l(`span`,{className:`text-[9px] text-red-400 line-through`,children:`deprecated`}),l(`span`,{className:`text-[9px] text-foreground-subtle shrink-0`,children:new Date(e.publishedAt).toLocaleDateString()})]});return s?i(`button`,{type:`button`,"aria-label":`Select ${e.version}`,onClick:()=>s(e.version),className:`w-full flex items-center gap-2 px-3 py-2 text-[11px] ${a?`bg-primary/5`:`hover:bg-surface-hover`} transition-colors`,children:[f,a?l(U,{className:`h-3 w-3 text-primary shrink-0`}):l(`span`,{className:`w-3 shrink-0`})]},e.version):i(`div`,{className:`flex items-center gap-2 px-3 py-2 text-[11px] ${n?`bg-primary/5`:`hover:bg-surface-hover`} transition-colors`,children:[f,n&&!u?l(U,{className:`h-3 w-3 text-primary shrink-0`}):l(`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:l(j,{className:`h-3 w-3`})})]},e.version)})}),d&&d.length===0&&l(`div`,{className:`py-4 text-center text-[10px] text-foreground-subtle`,children:`No versions found`})]})}var Y={queued:{icon:A,bg:`bg-muted text-foreground-subtle`,label:`queued`},updating:{icon:F,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:U,bg:`bg-success/10 text-success`,label:`done`},failed:{icon:ge,bg:`bg-danger/10 text-danger`,label:`failed`}};function Ce({item:e}){let t=Y[e.status],n=t.icon;return i(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded ${t.bg}`,title:e.error,children:[l(n,{className:`w-2.5 h-2.5 ${t.spin?`animate-spin`:``}`}),t.label]})}n();var X=`device-export`;function Z(e){return e.capabilities.some(e=>(typeof e==`string`?e:e.name)===X)}function we({isBundle:e,installSource:t,addonId:n,iconPath:r,color:a}){let[o,s]=c(!1),u=a?{backgroundColor:`${a.startsWith(`#`)?a:`#${a}`}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`,f=n&&r?`/api/addon-assets/${n}/${r}`:null,p=!!f&&!o;return i(`div`,{className:`relative flex-shrink-0`,children:[l(`div`,{className:`h-9 w-9 rounded-lg flex items-center justify-center ${u?``:d}`,style:u,children:p?l(`img`,{src:f,alt:n,className:`h-5 w-5`,onError:()=>s(!0)}):l(e?_e:fe,{className:`h-4 w-4`})}),t===`local`&&l(`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`&&l(`span`,{className:`absolute -top-1 -left-1 w-4 h-4 rounded bg-[#cb3837] flex items-center justify-center -rotate-12 shadow-sm`,children:l(`svg`,{viewBox:`0 0 780 250`,className:`w-[11px] h-[11px]`,children:l(`path`,{fill:`#fff`,d:`M240 250h100V50h100v200h340V0H0v250z`})})}),t===`upload`&&l(`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:l(P,{className:`h-2.5 w-2.5 text-white`})})]})}function Te({version:e,availableUpdate:t,selectedVersion:n,isUpdating:r,installSource:a,disabled:o,onUpdate:s,onOpenPicker:c,children:u}){if(r)return i(`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:[l(F,{className:`h-3 w-3 animate-spin`}),`Updating…`]});if(t){let r=n??t;return i(`div`,{className:`relative inline-flex items-center gap-1 shrink-0`,children:[s&&i(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),s()},disabled:o,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:[l(j,{className:`h-3 w-3`}),`Update`]}),i(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),c()},disabled:o,"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:[l(`span`,{className:`font-normal opacity-70`,children:e}),l(`span`,{className:`font-normal opacity-70`,children:`→`}),r,l(R,{className:`h-3 w-3`})]}),u]})}return i(`div`,{className:`relative inline-flex items-center gap-1 shrink-0`,children:[i(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),c()},disabled:o,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`,a===`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,l(R,{className:`h-3 w-3 opacity-50`})]}),u]})}function Ee({addonId:e}){let t=s(),{data:n=`inherit`}=O({addonId:e}),r=_({onSuccess:()=>{t.invalidateQueries({queryKey:[[`addons`,`getAddonAutoUpdate`]]})}});return l(`div`,{className:`flex rounded-lg border border-border overflow-hidden text-[10px] font-medium`,children:[`inherit`,`off`,`latest`,`beta`].map(t=>l(`button`,{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))})}function De({addon:e,agents:t=[],clusterStatus:n,hideVersion:r,availableUpdate:a,onUpdate:f,isUpdating:p,jobProgress:h,bundle:g,bulkItem:_,disabledByBulk:v,isSystem:x}){let[S,C]=c(!1),[te,ne]=c(!1),[w,T]=c(!1),[ie,oe]=c(null);u(()=>{oe(null)},[a]);let E=ie??a,[D,O]=c(!1),[ce,k]=c(!1),[A,j]=c(`logs`),N=s(),P=d(),F=de(),I=se(),{manifest:L}=e,z=e.installedOn??[],fe=!g&&!L.protected&&L.removable!==!1,U=!!g,W=g?.displayName??L.name,G=g?.packageName??L.packageName,K=g?.version??L.packageVersion??L.version,q=g?.installSource??e.installSource,ve=g?g.bundle?.description??g.addons[0]?.manifest.description:L.description,J=le({onSuccess:()=>{N.invalidateQueries({queryKey:[[`addons`]]}),N.invalidateQueries({queryKey:[[`addonPages`]]}),N.invalidateQueries({queryKey:[[`capabilities`]]})}}),ye=ae({onSuccess:()=>{N.invalidateQueries({queryKey:[[`addons`]]})}}),be=re({onSuccess:()=>{N.invalidateQueries({queryKey:[[`addons`]]}),N.invalidateQueries({queryKey:[[`addonPages`]]}),N.invalidateQueries({queryKey:[[`capabilities`]]}),N.invalidateQueries({queryKey:[[`integrations`]]})}}),Y=b({onSuccess:()=>{N.invalidateQueries({queryKey:[[`addons`]]}),N.invalidateQueries({queryKey:[[`alerts`]]})}}),X=e.health,Q=X?.phase===`failed`&&!X.inGracePeriod,Oe=Q&&X?.nextRetryAt&&!X.retrying;return i(`div`,{className:`rounded-lg border bg-surface overflow-hidden ${Q?`border-red-500/50`:`border-border`}`,children:[Q&&X&&i(`div`,{className:`bg-danger/10 border-b border-danger/30 px-4 py-2.5 flex items-start gap-2.5`,children:[l(ge,{className:`h-4 w-4 text-danger shrink-0 mt-0.5`}),i(`div`,{className:`flex-1 min-w-0`,children:[i(`div`,{className:`text-xs font-semibold text-danger`,children:[`Failed to load (attempt #`,X.retryCount,`)`]}),l(`div`,{className:`text-[11px] text-foreground mt-0.5 break-words font-mono`,children:X.lastError?.message??`Unknown error`}),Oe&&X.nextRetryAt&&i(`div`,{className:`text-[10px] text-foreground-subtle mt-1`,children:[`Auto-retry at `,new Date(X.nextRetryAt).toLocaleTimeString()]})]}),i(`button`,{type:`button`,disabled:Y.isPending||X.retrying,onClick:e=>{e.stopPropagation(),Y.mutate({packageName:G})},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:[l(M,{className:`h-3 w-3 ${Y.isPending||X.retrying?`animate-spin`:``}`}),`Retry now`]})]}),i(`div`,{className:`flex items-start gap-3 px-4 py-3`,children:[l(we,{isBundle:U||!!L.components&&L.components.length>1,installSource:q,addonId:U?g.addons[0]?.manifest.id:L.id,iconPath:U?g.bundle?.icon??g.addons[0]?.manifest.icon:L.icon,color:U?g.addons[0]?.manifest.color:L.color}),i(`div`,{className:`flex-1 min-w-0`,children:[i(`div`,{className:`flex items-start justify-between gap-2`,children:[l(`span`,{className:`text-sm font-semibold text-foreground truncate min-w-0`,children:W}),!r&&l(Te,{version:K,availableUpdate:a,...E===void 0?{}:{selectedVersion:E},isUpdating:p,installSource:q,disabled:v,...f&&E!==void 0?{onUpdate:()=>f(E)}:{},onOpenPicker:()=>T(e=>!e),children:w&&l(Se,{packageName:G,currentVersion:K,...q?{installSource:q}:{},...a!==void 0&&E!==void 0?{selectedVersion:E,onSelect:e=>{oe(e),T(!1)}}:{},onInstall:e=>{T(!1),be.mutate({packageName:G,version:e})},onClose:()=>T(!1)})})]}),i(`div`,{className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 mt-0.5`,children:[G!==W&&l(`span`,{className:`text-[10px] text-foreground-subtle font-mono truncate max-w-full`,children:G}),U&&i(`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:[l(_e,{className:`h-3 w-3`}),g.addons.length]}),x&&i(`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:[l(M,{className:`h-3 w-3`}),`System`]}),_!=null&&l(Ce,{item:_}),h!=null&&l(xe,{progress:h})]}),ve&&l(`p`,{className:`text-[10px] text-foreground-subtle mt-1 line-clamp-1`,children:ve}),!U&&e.process&&i(`div`,{className:`flex flex-wrap items-center gap-1.5 mt-1`,children:[l(`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`?`forked`:`in-process`}),e.process.pid!=null&&i(`span`,{className:`text-[9px] font-mono text-foreground-subtle`,children:[`PID `,e.process.pid]}),l(`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`:e.process.state===`crashed`||e.process.state===`failed`?`bg-red-500/15 text-red-400`:`bg-gray-500/15 text-gray-400`}`,children:e.process.state})]})]})]}),!U&&i(`div`,{className:`flex items-center gap-1 px-4 py-1.5 border-t border-border/50 bg-surface-hover/20`,children:[i(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),ye.mutate({addonId:L.id})},disabled:ye.isPending||v,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:[l(M,{className:`h-3 w-3 ${ye.isPending?`animate-spin`:``}`}),`Restart`]}),i(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),O(e=>!e)},className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border transition-colors ${D?`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:[l(V,{className:`h-3 w-3`}),`Logs`]}),!U&&i(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),k(!0)},className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border transition-colors ${ce?`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:[l(pe,{className:`h-3 w-3`}),`Settings`]}),l(`div`,{className:`flex-1`}),fe&&i(`button`,{type:`button`,onClick:async e=>{e.stopPropagation(),await I({title:`Uninstall ${L.name}?`,message:`This will remove the addon package and all its data. This action cannot be undone.`,confirmLabel:`Uninstall`,variant:`danger`})&&J.mutate({packageName:L.packageName})},disabled:J.isPending||v,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:[l(H,{className:`h-3 w-3`}),J.isPending?`Removing...`:`Uninstall`]})]}),n&&n.nodes.length>1&&!U&&i(`div`,{className:`border-t border-border px-4 py-2 bg-muted/10`,children:[l(`div`,{className:`text-[10px] font-medium text-foreground-subtle mb-1.5`,children:`Cluster Deployment`}),l(`div`,{className:`space-y-1`,children:n.nodes.map(e=>i(`div`,{className:`flex items-center gap-2 text-[10px]`,children:[l(`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`}`}),l(`span`,{className:`font-medium text-foreground min-w-[60px]`,children:e.name}),l(`span`,{className:`font-mono text-foreground-subtle`,children:e.version}),!e.synced&&e.status!==`offline`&&l(`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`&&l(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-muted text-muted-foreground`,children:`offline`}),e.synced&&e.status!==`offline`&&l(`span`,{className:`text-[9px] text-success`,children:`synced`})]},e.nodeId))})]}),D&&!U&&i(`div`,{className:`border-t border-border`,children:[i(`div`,{className:`flex items-center px-4 py-1 bg-surface-hover/20 border-b border-border/50`,children:[i(`div`,{className:`flex rounded border border-border overflow-hidden text-[9px]`,children:[l(`button`,{type:`button`,onClick:()=>j(`logs`),className:`px-2 py-0.5 transition-colors ${A===`logs`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:`Logs`}),l(`button`,{type:`button`,onClick:()=>j(`events`),className:`px-2 py-0.5 border-l border-border transition-colors ${A===`events`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:`Events`})]}),l(`div`,{className:`flex-1`}),l(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),O(!1)},className:`text-foreground-subtle hover:text-foreground`,children:l(B,{className:`h-3.5 w-3.5`})})]}),A===`logs`&&l(y,{addonId:L.id,maxHeight:`max-h-64`,showFilters:!1}),A===`events`&&l(ee,{addonId:L.id,category:`addon.*`,maxHeight:`max-h-64`})]}),U&&i(o,{children:[l(`button`,{type:`button`,onClick:()=>C(e=>!e),className:`w-full flex items-center justify-center border-t border-border py-1 hover:bg-surface-hover/50 transition-colors`,children:l(S?he:R,{className:`h-3.5 w-3.5 text-foreground-subtle`})}),S&&l(`div`,{className:`border-t border-border px-3 py-2 space-y-2`,children:g.addons.map(e=>l(De,{addon:e,agents:t,hideVersion:!0},e.manifest.id))})]}),ce&&!U&&l(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4`,onClick:()=>k(!1),children:i(`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:[i(`div`,{className:`flex items-center justify-between px-5 py-3 border-b border-border flex-shrink-0`,children:[i(`div`,{className:`flex items-center gap-2`,children:[l(pe,{className:`h-4 w-4 text-primary`}),i(`h2`,{className:`text-sm font-semibold text-foreground`,children:[W,` Settings`]})]}),l(`button`,{onClick:()=>k(!1),className:`text-foreground-subtle hover:text-foreground transition-colors p-1 rounded`,children:l(B,{className:`h-4 w-4`})})]}),i(`div`,{className:`flex-1 overflow-y-auto px-5 py-4 space-y-4`,children:[l(me,{nodeId:`hub`,addonIds:[L.id],level:`global`}),Z(L)&&i(`div`,{children:[l(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:`Device export`}),l(m,{addonId:L.id,trpc:P.trpcClient,onOpenDevice:e=>F(`/devices/${e}`)})]}),q===`npm`&&i(`div`,{children:[l(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:`Auto-Update`}),l(Ee,{addonId:L.id})]}),L.components&&L.components.length>0&&i(`div`,{children:[i(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:[`Components (`,L.components.length,`)`]}),l(`div`,{className:`flex flex-wrap gap-1`,children:L.components.map(e=>l(`span`,{className:`text-[10px] rounded bg-background border border-border px-1.5 py-0.5 text-foreground-subtle font-mono`,children:e},e))})]}),t.length>=2&&i(`div`,{children:[l(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:`Installed on`}),i(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[z.length===0&&l(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Hub (local)`}),z.map(e=>l(`span`,{className:`rounded-full bg-surface-hover border border-border px-2 py-0.5 text-[10px] text-foreground-subtle`,children:e},e)),i(`div`,{className:`relative`,children:[i(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),ne(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:[l(ue,{className:`h-3 w-3`}),`Add agent`]}),te&&i(`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:[t.filter(e=>!e.isHub&&!z.includes(e.name)).map(e=>l(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),ne(!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)),t.filter(e=>!e.isHub&&!z.includes(e.name)).length===0&&l(`div`,{className:`px-3 py-1.5 text-[10px] text-foreground-subtle`,children:`No available agents`})]})]})]})]})]}),l(`div`,{className:`flex items-center justify-end px-5 py-3 border-t border-border flex-shrink-0`,children:l(`button`,{type:`button`,onClick:()=>k(!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`})})]})})]})}n();var Q=`.tgz,.tar.gz,.zip`;function Oe({onUploadSuccess:n}){let[r,a]=c(!1),s=t(null),u=e(async e=>{a(!0);let t=new FormData;t.append(`file`,e);let r=localStorage.getItem(`camstack_admin_token`)??``;try{(await(await fetch(`/api/addons/upload`,{method:`POST`,headers:{Authorization:`Bearer ${r}`},body:t})).json()).success&&n()}finally{a(!1)}},[n]);return i(o,{children:[l(`input`,{ref:s,type:`file`,accept:Q,onChange:e(e=>{let t=e.target.files?.[0];t&&u(t),e.target.value=``},[u]),className:`hidden`}),i(`button`,{type:`button`,onClick:()=>s.current?.click(),disabled:r,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:[r?l(F,{className:`w-3.5 h-3.5 animate-spin`}):l(P,{className:`w-3.5 h-3.5`}),r?`Uploading...`:`Upload`]})]})}n();var ke=[{seconds:900,label:`15m`},{seconds:3600,label:`1h`},{seconds:21600,label:`6h`},{seconds:43200,label:`12h`},{seconds:86400,label:`24h`}],Ae=new Set([`@camstack/system`,`@camstack/types`,`@camstack/sdk`,`@camstack/shm-ring`,`@camstack/ui-library`]);function je(e){return e!==void 0&&Ae.has(e)}function Me(e,t){let n=e??`hub-only`;return n===`any-node`?!0:n===`hub-only`?t:!t}function Ne(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 Pe(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 Fe({addons:n,clusterStatus:o,selectedNode:d,onRefresh:f,isRefreshing:m}){let g=s(),[_,y]=c(``),ee=r(_),[b,x]=c(!1),C=t(null);u(()=>{if(!b)return;let e=e=>{C.current&&!C.current.contains(e.target)&&x(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[b]);let{data:w}=oe({nodeId:d.id}),T=a(()=>{let e=new Map;for(let t of w??[])e.set(t.name,t.latestVersion);return e},[w]),ie=a(()=>(w??[]).filter(e=>!e.isSystem).length,[w]),[ae,E]=c(()=>new Set),[D,O]=c(()=>new Map),le=e(e=>{E(t=>new Set(t).add(e))},[]),k=e(e=>{E(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n})},[]),A=e((e,t)=>{O(n=>new Map(n).set(e,t))},[]),ue=e(e=>{O(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),P=p({onMutate:e=>{le(e.name),ue(e.name)},onSuccess:(e,t)=>{k(t.name);let n=e;if(n&&n.success===!1){A(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)=>{k(t.name),A(t.name,e instanceof Error?e.message:String(e))}}),de=ye(),I=t(new Set);u(()=>{let e=new Set;for(let[t,n]of de)ve(n)&&e.add(t);let t=[...I.current].some(t=>!e.has(t));I.current=e,t&&(g.invalidateQueries({queryKey:[[`addons`]]}),g.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]}))},[de,g]);let{data:R}=ne(void 0),fe=ce({onSuccess:()=>{g.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),B=v({onSuccess:()=>{g.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),{data:V,isFetching:pe}=S({query:ee||void 0},{enabled:b}),H=te(),{data:W}=h(void 0),me=W?.requestedAt,[he,ge]=c(null),[_e,G]=c(!1);u(()=>{if(W?.kind===`framework-bulk-update`&&W.requestedAt!==he){ge(W.requestedAt),G(!0);let e=window.setTimeout(()=>G(!1),6e3);return()=>window.clearTimeout(e)}},[me,he,W]),se();let K=e(async()=>{let e=(w??[]).filter(e=>!e.isSystem);if(e.length!==0){if(!d.isHub){for(let t of e)await P.mutateAsync({name:t.name,version:t.latestVersion,nodeId:d.id});return}await H.mutateAsync({kind:`update`,targets:e.map(e=>({name:e.name,version:e.latestVersion})),nodeIds:[d.id]})}},[w,d.id,d.isHub,H,P]),q=re({onSuccess:()=>{g.invalidateQueries({queryKey:[[`addons`]]}),g.invalidateQueries({queryKey:[[`addonPages`]]}),g.invalidateQueries({queryKey:[[`capabilities`]]}),g.invalidateQueries({queryKey:[[`integrations`]]})}}),[J,be]=c(`type`),[xe,Se]=c(()=>typeof window>`u`?`grouped`:window.localStorage.getItem(`camstack.addons.viewMode`)===`flat`?`flat`:`grouped`),Y=e=>{Se(e),typeof window<`u`&&window.localStorage.setItem(`camstack.addons.viewMode`,e)},[Ce,X]=z(),Z=Ce.get(`capability`),we=a(()=>{let e=n.filter(e=>!je(e.manifest.packageName));return d.isHub||(e=e.filter(e=>Me(e.placement,d.isHub))),Z&&(e=e.filter(e=>(e.manifest.capabilities??[]).some(e=>(typeof e==`string`?e:e.name)===Z))),e},[n,d.isHub,Z]),Te=()=>{let e=new URLSearchParams(Ce);e.delete(`capability`),X(e,{replace:!0})},Ee=xe===`flat`?we:Pe(we),Q=a(()=>{let e=[...Ee];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},[Ee,J]);return i(`div`,{className:`space-y-4`,children:[[...D.entries()].map(([e,t])=>l(`div`,{className:`rounded-md border border-danger/30 bg-danger/5 px-3 py-2 text-[11px]`,children:i(`div`,{className:`flex items-start justify-between gap-3`,children:[i(`div`,{className:`space-y-0.5`,children:[i(`div`,{className:`font-medium text-danger`,children:[`Failed to update `,e]}),l(`div`,{className:`text-foreground-subtle font-mono`,children:t})]}),l(`button`,{type:`button`,onClick:()=>ue(e),className:`text-foreground-subtle hover:text-foreground text-[10px]`,children:`dismiss`})]})},e)),i(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[i(`div`,{className:`flex items-center gap-1.5`,children:[l(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Sort:`}),i(`select`,{value:J,onChange:e=>be(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:[l(`option`,{value:`type`,children:`Bundles first`}),l(`option`,{value:`name`,children:`Name`}),l(`option`,{value:`source`,children:`Install source`})]})]}),i(`div`,{className:`flex items-center gap-1.5`,children:[l(`span`,{className:`text-[10px] text-foreground-subtle`,children:`View:`}),l(`div`,{className:`flex rounded-md border border-border overflow-hidden text-[10px] font-medium`,children:[`grouped`,`flat`].map(e=>l(`button`,{type:`button`,onClick:()=>Y(e),className:`px-2.5 py-1.5 transition-colors capitalize ${xe===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))})]}),d.isHub&&i(`div`,{className:`flex items-center gap-1.5`,children:[l(M,{className:`h-3 w-3 text-foreground-subtle`}),l(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Auto-Update:`}),l(`div`,{className:`flex rounded-md border border-border overflow-hidden text-[10px] font-medium`,children:[`off`,`latest`,`beta`].map(e=>l(`button`,{type:`button`,onClick:()=>fe.mutate({channel:e}),disabled:fe.isPending,className:`px-2.5 py-1.5 transition-colors capitalize ${R?.channel===e?e===`off`?`bg-gray-700 text-gray-200`:e===`latest`?`bg-blue-500/20 text-blue-400`:`bg-amber-500/20 text-amber-400`:`bg-transparent text-foreground-subtle hover:bg-surface-hover`} ${e===`off`?``:`border-l border-border`}`,children:e},e))})]}),d.isHub&&i(`div`,{className:`flex items-center gap-1.5`,children:[l(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Check every:`}),l(`select`,{className:`rounded-md border border-border bg-transparent px-1.5 py-1 text-[10px] font-medium text-foreground-subtle`,value:R?.updateCheckIntervalSeconds??21600,disabled:B.isPending||R===void 0,onChange:e=>{R!==void 0&&B.mutate({channel:R.channel,updateCheckIntervalSeconds:Number(e.target.value)})},children:ke.map(e=>l(`option`,{value:e.seconds,children:e.label},e.seconds))})]}),ie>0&&i(`button`,{type:`button`,onClick:()=>void K(),disabled:H.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:[H.isPending?l(F,{className:`w-3 h-3 animate-spin`}):l(j,{className:`w-3 h-3`}),H.isPending?`Updating…`:`Update All (${ie})`]}),i(`button`,{type:`button`,onClick:f,disabled:m||H.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:[l(M,{className:`w-3 h-3 ${m?`animate-spin`:``}`}),`Refresh`]})]}),i(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3`,children:[i(`div`,{className:`relative flex-1 min-w-0 sm:min-w-[200px]`,ref:C,children:[l(N,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-foreground-subtle`}),l(`input`,{type:`text`,value:_,onChange:e=>{y(e.target.value),x(!0)},onFocus:()=>x(!0),placeholder:`Search addons on npm...`,disabled:H.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`}),pe&&l(F,{className:`absolute right-2.5 top-1/2 -translate-y-1/2 h-3 w-3 text-foreground-subtle animate-spin`}),b&&V&&V.length>0&&i(`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:[V.length>0&&i(`div`,{className:`px-3 py-1.5 text-[10px] uppercase tracking-wide text-foreground-subtle border-b border-border`,children:[`npm results (`,V.length,`)`]}),V&&V.length>0&&l(`div`,{className:`max-h-72 overflow-auto divide-y divide-border`,children:V.map(e=>i(`div`,{className:`flex items-center gap-3 px-3 py-2 hover:bg-surface-hover transition-colors`,children:[l(`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()}),i(`div`,{className:`flex-1 min-w-0`,children:[i(`div`,{className:`flex items-baseline gap-2 min-w-0`,children:[l(`span`,{className:`text-[11px] font-semibold break-words`,children:e.name.replace(/^@camstack\/(addon-)?/,``)}),i(`span`,{className:`text-[10px] text-foreground-subtle shrink-0`,children:[`v`,e.version]})]}),l(`div`,{className:`font-mono text-[9px] text-foreground-subtle/80 truncate`,children:e.name}),e.description&&l(`div`,{className:`text-[10px] text-foreground-subtle truncate`,children:e.description})]}),e.installed?i(`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:[l(U,{className:`h-3 w-3`}),e.installedVersion??`Installed`]}):i(`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?l(F,{className:`h-3 w-3 animate-spin`}):l(j,{className:`h-3 w-3`}),`Install`]})]},e.name))})]})]}),l(Oe,{onUploadSuccess:()=>{g.invalidateQueries({queryKey:[[`addons`]]}),f()}})]}),Z&&i(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-lg bg-primary/10 border border-primary/30 text-sm`,children:[l(`span`,{className:`text-foreground-subtle`,children:`Filtering by capability:`}),l(`span`,{className:`font-mono text-primary font-semibold`,children:Z}),l(`button`,{type:`button`,onClick:Te,className:`ml-auto text-xs text-foreground-subtle hover:text-foreground underline`,children:`Clear`})]}),_e&&i(`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 backdrop-blur-sm max-w-sm pointer-events-auto`,children:[l(L,{className:`w-4 h-4 shrink-0 mt-0.5 text-green-400`}),i(`div`,{children:[l(`div`,{className:`text-[11px] font-semibold text-foreground`,children:`Bulk update completed`}),l(`div`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:`System packages updated — hub restarted successfully.`})]})]}),we.length===0&&l(`div`,{className:`text-xs text-foreground-subtle`,children:n.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 ${d.name} (placement filter active)`}),l(`div`,{className:`space-y-2`,children:Q.map(e=>{let t=$(e)?e.bundle.packageName:e.manifest.packageName,n=T.get(t),r=$(e)?e.representative:e,i=n?e=>P.mutate({name:t,version:e,nodeId:d.id}):void 0,a=de.get(t)??null,s=a!==null&&ve(a);return l(De,{addon:r,clusterStatus:o?.[r.manifest.id],bundle:$(e)?e.bundle:void 0,availableUpdate:n,isUpdating:ae.has(t)||s,jobProgress:a,onUpdate:i,disabledByBulk:H.isPending},$(e)?t:e.manifest.id)})})]})}function Ie(){let e=s(),{data:n,isLoading:r,isError:o}=g(),{data:d}=w(void 0),{data:p}=E(void 0,{refetchInterval:1e4}),m=a(()=>{let e=new Map;e.set(`hub`,{id:`hub`,name:`Hub`,isHub:!0});for(let t of p??[]){let n=String(t.id??``);n&&e.set(n,{id:n,name:String(t.name??n),isHub:!!t.isHub})}return[...e.values()]},[p]),[h,_]=c(`hub`),v=m.find(e=>e.id===h)??m[0],y=T(),ee=f(),b=y.isPending||ee.isPending,x=async()=>{await y.mutateAsync({nodeId:h}),await ee.mutateAsync(),e.invalidateQueries({queryKey:[[`addons`]]})},S=t(y);S.current=y,u(()=>{S.current.mutate({nodeId:`hub`})},[]);let C=(n??[]).map(Ne).filter(e=>e!==null);return i(W,{children:[i(`div`,{className:`flex items-center justify-between gap-3 flex-wrap`,children:[l(ie,{selectedNodeId:h,onSelect:_}),i(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[!r&&!o&&i(`span`,{className:`text-[10px] rounded-full bg-primary/10 text-primary px-2 py-0.5 font-medium`,children:[C.length,` installed`]}),i(`button`,{type:`button`,onClick:()=>void x(),disabled:b,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:[l(M,{className:`w-3 h-3 ${b?`animate-spin`:``}`}),`Check for updates`]})]})]}),!v.isHub&&i(`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`,` `,l(`span`,{className:`font-medium text-foreground`,children:v.name}),` — agents only run`,` `,l(`code`,{className:`font-mono`,children:`agent-only`}),` and`,` `,l(`code`,{className:`font-mono`,children:`any-node`}),` addons. Install / uninstall is hub-driven; agents auto-sync from the hub.`]}),r&&l(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading…`}),o&&l(`div`,{className:`text-xs text-danger`,children:`Failed to load addons`}),!r&&!o&&l(Fe,{addons:C,clusterStatus:d,selectedNode:v,onRefresh:()=>void x(),isRefreshing:b})]})}export{Ie as AddonsPage};