@camstack/addon-admin-ui 1.1.17 → 1.1.19

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 (89) hide show
  1. package/dist/assets/{AddLocationWizard-De3OH3BA.js → AddLocationWizard-DlIuy7PK.js} +1 -1
  2. package/dist/assets/AddonCollectionPage-B4YZsZ2N.js +1 -0
  3. package/dist/assets/Addons-CF3JeZJs.js +1 -0
  4. package/dist/assets/{AdminTabs-BLDdMbDp.js → AdminTabs-Cyrx86NX.js} +1 -1
  5. package/dist/assets/{BrokerForm-CHT85u8S.js → BrokerForm-BU7fpWoT.js} +1 -1
  6. package/dist/assets/{Capabilities-CWSz22IU.js → Capabilities-BEyROSgm.js} +1 -1
  7. package/dist/assets/CapabilityBadges-C7OuLfh8.js +1 -0
  8. package/dist/assets/{Cluster-Dm1OfkO8.js → Cluster-tcDpGJRa.js} +1 -1
  9. package/dist/assets/{Dashboard-74nlj88E.js → Dashboard-DOxZXqyK.js} +1 -1
  10. package/dist/assets/Data-t_YbtZxL.js +1 -0
  11. package/dist/assets/{DetectionIntelligence-DF7k0elO.js → DetectionIntelligence-DqOJ15Er.js} +1 -1
  12. package/dist/assets/DeviceDetail-DQbwOLvC.js +2 -0
  13. package/dist/assets/{Devices-CiAnAbkx.js → Devices-C3jy25Bw.js} +1 -1
  14. package/dist/assets/{EmbedPlayerPage-CyYqKvzV.js → EmbedPlayerPage-C4PqItRF.js} +1 -1
  15. package/dist/assets/{FormBuilder-D-ezbWNd.js → FormBuilder-B7tUioUm.js} +1 -1
  16. package/dist/assets/Identity-BEvc1UzE.js +1 -0
  17. package/dist/assets/IntegrationDetail-lPxvINqs.js +1 -0
  18. package/dist/assets/{Integrations-DoIHoArK.js → Integrations-CNJgYeN5.js} +1 -1
  19. package/dist/assets/Integrations-DsYPT3r2.js +1 -0
  20. package/dist/assets/{Logs-DvGvvP5Z.js → Logs-5bYEoeMq.js} +1 -1
  21. package/dist/assets/{MotionZonesSettings-CNwUKjaX.js → MotionZonesSettings-DpdNJlNH.js} +1 -1
  22. package/dist/assets/{MyAccess-C2G8_tjD.js → MyAccess-0WTyoQQ1.js} +1 -1
  23. package/dist/assets/Network-BggdRVzo.js +1 -0
  24. package/dist/assets/{NodeAddonsSettingsPanel-BSbcWPHw.js → NodeAddonsSettingsPanel-oVi7MC28.js} +1 -1
  25. package/dist/assets/NotificationTargets-CI-nn-rf.js +1 -0
  26. package/dist/assets/Pipeline-BI2SWq0a.js +1 -0
  27. package/dist/assets/{PrivacyMaskSettings-BAIHn-Jd.js → PrivacyMaskSettings-CrOgd9eg.js} +1 -1
  28. package/dist/assets/{ProviderIcon-ByJzvHx3.js → ProviderIcon-BlnoCop3.js} +1 -1
  29. package/dist/assets/{ScanNetworkModal-qGKzYgmh.js → ScanNetworkModal-CxjeMDho.js} +1 -1
  30. package/dist/assets/{Settings-DPyr9u-Z.js → Settings-5VzV0eVZ.js} +1 -1
  31. package/dist/assets/{Showroom-BkKKQUzx.js → Showroom-DrEy5G_m.js} +1 -1
  32. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DG132vac.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-CLDXRGbV.js} +1 -1
  33. package/dist/assets/circle-check-big-MfDWxk9K.js +1 -0
  34. package/dist/assets/{copy-2VNbi88i.js → copy-C4G6c4Ys.js} +1 -1
  35. package/dist/assets/dist-DK88lvvz.js +6 -0
  36. package/dist/assets/{dist-5K2h46ov.js → dist-LQLUbjed.js} +1 -1
  37. package/dist/assets/{download-DWoalB9v.js → download-BXqeElYK.js} +1 -1
  38. package/dist/assets/{esm-BVPK0LJc.js → esm-C86u2nhh.js} +1 -1
  39. package/dist/assets/{hostInit-B-lZK20S.js → hostInit-eCexcRoY.js} +1 -1
  40. package/dist/assets/index-DP9bur77.css +2 -0
  41. package/dist/assets/index-idVLv2oj.js +4 -0
  42. package/dist/assets/{key-round-BGY3fL7G.js → key-round-BNduVRhj.js} +1 -1
  43. package/dist/assets/{mf-entry-bootstrap-0-5e39788b.js → mf-entry-bootstrap-0-62a708e5.js} +2 -2
  44. package/dist/assets/{pencil-BGBgmKc0.js → pencil-x4bNLykx.js} +1 -1
  45. package/dist/assets/{player-overlays-DGBZRYiK.js → player-overlays-BK-_BrgW.js} +1 -1
  46. package/dist/assets/plus-ByEqM_KR.js +1 -0
  47. package/dist/assets/{radio-HF3KnLA1.js → radio-D7QKOm_q.js} +1 -1
  48. package/dist/assets/{refresh-cw-Czwx0733.js → refresh-cw-sAaM2a8A.js} +1 -1
  49. package/dist/assets/remoteEntry-CorFK6mn.js +1 -0
  50. package/dist/assets/{rotate-ccw-3Ic1gnxi.js → rotate-ccw-DmmfCbwP.js} +1 -1
  51. package/dist/assets/rotate-cw-Dq3dsGth.js +1 -0
  52. package/dist/assets/search-Cbx2Urnx.js +1 -0
  53. package/dist/assets/{server-uUITwvVh.js → server-9jJq82Vu.js} +1 -1
  54. package/dist/assets/{sparkles-B0yQ4EeK.js → sparkles-Cf43SJhp.js} +1 -1
  55. package/dist/assets/square-C0pQT5rA.js +1 -0
  56. package/dist/assets/{square-check-big-9jkfBiTg.js → square-check-big-CKe1iFeG.js} +1 -1
  57. package/dist/assets/{src-BRShKZTM.js → src-B7BVQkY2.js} +9 -9
  58. package/dist/assets/src-D7qnpDWK.js +6 -0
  59. package/dist/assets/{upload-B8xrbQiZ.js → upload-DeGWObu4.js} +1 -1
  60. package/dist/assets/useDevice-D_sz9YbZ.js +1 -0
  61. package/dist/assets/{useEventInvalidation-B9IpXgJV.js → useEventInvalidation-BMv3kB-_.js} +1 -1
  62. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-Ik2hWu_w.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_--tYWwZy7.js} +2 -2
  63. package/dist/assets/{wifi-BK_gB5Ar.js → wifi-dLfxxYcz.js} +1 -1
  64. package/dist/assets/{zap-BGpwXyqM.js → zap-lXnTrd14.js} +1 -1
  65. package/dist/index.html +6 -6
  66. package/dist/server/addon.js +229 -17
  67. package/package.json +1 -1
  68. package/dist/assets/AddonCollectionPage-Bi6cdmvV.js +0 -1
  69. package/dist/assets/Addons-Bex0KMZH.js +0 -1
  70. package/dist/assets/CapabilityBadges-XM24OO0d.js +0 -1
  71. package/dist/assets/Data-CLrum3c8.js +0 -1
  72. package/dist/assets/DeviceDetail-CC4bF6mC.js +0 -2
  73. package/dist/assets/Identity-D2zpCZ98.js +0 -1
  74. package/dist/assets/IntegrationDetail-CQda9U22.js +0 -1
  75. package/dist/assets/Integrations-CKgGTskT.js +0 -1
  76. package/dist/assets/Network-B_6HUnJi.js +0 -1
  77. package/dist/assets/Pipeline-DGTMnamR.js +0 -1
  78. package/dist/assets/bell-Cr8Qhoyl.js +0 -1
  79. package/dist/assets/circle-check-big-CXt-xo-F.js +0 -1
  80. package/dist/assets/dist-DnV5to_k.js +0 -2
  81. package/dist/assets/index-CGhDR20N.css +0 -2
  82. package/dist/assets/index-CfF7gHyZ.js +0 -4
  83. package/dist/assets/plus-B27j2LN4.js +0 -1
  84. package/dist/assets/remoteEntry-BWW_eFd4.js +0 -1
  85. package/dist/assets/rotate-cw-Cewee2ld.js +0 -1
  86. package/dist/assets/search-ZUWjHFq0.js +0 -1
  87. package/dist/assets/square-DT7MGW4Y.js +0 -1
  88. package/dist/assets/src-DRUh_aq8.js +0 -2
  89. package/dist/assets/useDevice-BoxV1nVZ.js +0 -1
@@ -4629,7 +4629,7 @@ function _instanceof(cls, params = {}) {
4629
4629
  return inst;
4630
4630
  }
4631
4631
  //#endregion
4632
- //#region ../types/dist/sleep-C2M2zF7x.mjs
4632
+ //#region ../types/dist/sleep-MHm--th-.mjs
4633
4633
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
4634
4634
  EventCategory["SystemBoot"] = "system.boot";
4635
4635
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -5891,6 +5891,7 @@ var CamStreamKindSchema = _enum([
5891
5891
  "pull-rtsp",
5892
5892
  "pull-rtmp",
5893
5893
  "pull-http",
5894
+ "pull-flv",
5894
5895
  "pull-rfc4571",
5895
5896
  "push-annexb",
5896
5897
  "derived"
@@ -13197,7 +13198,7 @@ var AddBrokerInputSchema = object({
13197
13198
  });
13198
13199
  var AddBrokerResultSchema = object({ id: string() });
13199
13200
  var IdInputSchema = object({ id: string() });
13200
- var TestResultSchema = discriminatedUnion("ok", [object({
13201
+ var TestResultSchema$1 = discriminatedUnion("ok", [object({
13201
13202
  ok: literal(true),
13202
13203
  latencyMs: number()
13203
13204
  }), object({
@@ -13220,7 +13221,7 @@ var StatusSchema = object({
13220
13221
  brokerCount: number(),
13221
13222
  embeddedRunning: boolean()
13222
13223
  });
13223
- method(_void(), array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnectionDetailsSchema), method(AddBrokerInputSchema, AddBrokerResultSchema, { kind: "mutation" }), method(IdInputSchema, _void(), { kind: "mutation" }), method(IdInputSchema, TestResultSchema, { kind: "mutation" }), method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, { kind: "mutation" }), method(IdInputSchema, _void(), { kind: "mutation" }), method(_void(), StatusSchema);
13224
+ method(_void(), array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnectionDetailsSchema), method(AddBrokerInputSchema, AddBrokerResultSchema, { kind: "mutation" }), method(IdInputSchema, _void(), { kind: "mutation" }), method(IdInputSchema, TestResultSchema$1, { kind: "mutation" }), method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, { kind: "mutation" }), method(IdInputSchema, _void(), { kind: "mutation" }), method(_void(), StatusSchema);
13224
13225
  var NetworkEndpointSchema = object({
13225
13226
  url: string(),
13226
13227
  hostname: string(),
@@ -13254,23 +13255,198 @@ var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
13254
13255
  sourcePort: number().optional()
13255
13256
  });
13256
13257
  method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
13257
- method(object({
13258
- title: string(),
13258
+ /**
13259
+ * notification-output — canonical, capability-gated notification delivery.
13260
+ *
13261
+ * Apprise-derived model (see
13262
+ * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
13263
+ * callers emit ONE canonical `Notification`; each provider declares a
13264
+ * per-kind capability descriptor (`TargetKind`), and the pure degrade
13265
+ * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
13266
+ * message to what the kind supports — callers never special-case a service.
13267
+ *
13268
+ * DESIGN DECISIONS (locked):
13269
+ * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
13270
+ * `setTargetEnabled`), each provider persisting via the `settings-store`
13271
+ * cap. Rationale: the admin UI needs one uniform surface across the
13272
+ * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
13273
+ * alternative would fork the UI per addon and cannot host the
13274
+ * discovery→adopt flow.
13275
+ * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
13276
+ * the generated cap-mount auto-`concatCollection`-fans them across every
13277
+ * registered provider (notifiers addon + HA addon) so one catalog is
13278
+ * routable. `send` / `testTarget` / CRUD route to ONE provider by the
13279
+ * `addonId` the generated collection router extracts from the call input.
13280
+ * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
13281
+ * transformer) + UDS MsgPack both round-trip typed arrays — already used by
13282
+ * `storage` / `storage-provider` / `recording` caps over the same path. No
13283
+ * base64 fallback needed.
13284
+ *
13285
+ * TODO (deferred, closed-set change — separate decision): add
13286
+ * `providerKind: 'notify'` so notification providers surface on the unified
13287
+ * admin "Integrations" page.
13288
+ */
13289
+ /**
13290
+ * Zentik-derived typed-media enum — the superset across every kind. Each
13291
+ * adapter picks what it supports and the degrade engine filters the rest.
13292
+ */
13293
+ var AttachmentMediaTypeSchema = _enum([
13294
+ "image",
13295
+ "video",
13296
+ "gif",
13297
+ "audio",
13298
+ "icon"
13299
+ ]);
13300
+ /**
13301
+ * A single attachment. Exactly one of `url` (remote source, most adapters
13302
+ * prefer this) or `bytes` (inline source; required for Pushover-style
13303
+ * bytes-only kinds) MUST be present — the degrade engine expresses a
13304
+ * url→bytes fetch as a `needsFetch` directive the adapter executes.
13305
+ */
13306
+ var AttachmentSchema = object({
13307
+ mediaType: AttachmentMediaTypeSchema,
13308
+ url: string().optional(),
13309
+ bytes: _instanceof(Uint8Array).optional(),
13310
+ mime: string().optional(),
13311
+ name: string().optional()
13312
+ }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
13313
+ var NotificationFormatSchema = _enum([
13314
+ "text",
13315
+ "markdown",
13316
+ "html"
13317
+ ]);
13318
+ /** A single tap-through action button. */
13319
+ var NotificationActionSchema = object({
13320
+ id: string(),
13321
+ label: string(),
13322
+ url: string().optional()
13323
+ });
13324
+ /**
13325
+ * The canonical notification. `body` is the only hard field (Apprise model).
13326
+ * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
13327
+ * NOT a fixed severity enum — each kind declares its own `caps.levels` and
13328
+ * the adapter maps this ordinal onto its native level. `level?` is an
13329
+ * optional kind-native level id (`emergency`, `silent`, …) that overrides
13330
+ * `priority` for that one target.
13331
+ */
13332
+ var NotificationSchema = object({
13259
13333
  body: string(),
13260
- imageUrl: string().optional(),
13334
+ title: string().optional(),
13335
+ format: NotificationFormatSchema.default("text"),
13336
+ priority: number().int().min(1).max(5).default(3),
13337
+ level: string().optional(),
13338
+ attachments: array(AttachmentSchema).optional(),
13339
+ clickUrl: string().optional(),
13340
+ actions: array(NotificationActionSchema).optional(),
13341
+ sound: string().optional(),
13342
+ ttl: number().optional(),
13343
+ tag: string().optional(),
13261
13344
  deviceId: number().optional(),
13262
13345
  eventId: string().optional(),
13263
- priority: _enum([
13264
- "low",
13265
- "normal",
13266
- "high",
13267
- "critical"
13268
- ]).default("normal"),
13269
13346
  metadata: record(string(), unknown()).optional()
13270
- }), _void(), { kind: "mutation" }), method(_void(), object({
13347
+ });
13348
+ /** One declared native severity/priority level for a kind. */
13349
+ var TargetKindLevelSchema = object({
13350
+ id: string(),
13351
+ label: string(),
13352
+ /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
13353
+ ordinal: number().int().min(1).max(5).nullable(),
13354
+ flags: object({
13355
+ critical: boolean().optional(),
13356
+ silent: boolean().optional(),
13357
+ noPush: boolean().optional()
13358
+ }).optional(),
13359
+ /** e.g. Pushover `emergency` requires `retry` / `expire`. */
13360
+ requires: array(string()).optional(),
13361
+ description: string().optional()
13362
+ });
13363
+ /** The full capability block consulted before dispatch. */
13364
+ var TargetKindCapsSchema = object({
13365
+ attachments: object({
13366
+ mediaTypes: array(AttachmentMediaTypeSchema),
13367
+ mode: _enum([
13368
+ "url",
13369
+ "bytes",
13370
+ "both"
13371
+ ]),
13372
+ max: number().int().nonnegative(),
13373
+ maxBytes: number().int().positive().optional()
13374
+ }),
13375
+ /** Max action buttons (0 = none). */
13376
+ actions: number().int().nonnegative(),
13377
+ levels: array(TargetKindLevelSchema),
13378
+ format: array(NotificationFormatSchema),
13379
+ clickUrl: boolean(),
13380
+ sound: boolean(),
13381
+ ttl: boolean(),
13382
+ bodyMaxLen: number().int().positive()
13383
+ });
13384
+ /**
13385
+ * `configSchema` is a `ConfigUISchema` tree passed through to the admin
13386
+ * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
13387
+ * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
13388
+ * the union is large and not meant for runtime validation here; the exported
13389
+ * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
13390
+ */
13391
+ var ConfigSchemaPassthrough = unknown();
13392
+ var TargetKindSchema = object({
13393
+ kind: string(),
13394
+ label: string(),
13395
+ icon: string(),
13396
+ /** Stamped by each provider so the concat-fanned catalog stays routable. */
13397
+ addonId: string(),
13398
+ configSchema: ConfigSchemaPassthrough,
13399
+ supportsDiscovery: boolean(),
13400
+ caps: TargetKindCapsSchema
13401
+ });
13402
+ /**
13403
+ * A persisted target. `config` holds secrets; providers REDACT secret fields
13404
+ * (return a presence marker only) when serving `listTargets` — never
13405
+ * round-trip a stored secret to the UI.
13406
+ */
13407
+ var TargetSchema = object({
13408
+ id: string(),
13409
+ name: string(),
13410
+ kind: string(),
13411
+ addonId: string(),
13412
+ enabled: boolean(),
13413
+ config: record(string(), unknown())
13414
+ });
13415
+ /** A discovery-surfaced candidate (config is partial + non-secret). */
13416
+ var DiscoveredTargetSchema = object({
13417
+ kind: string(),
13418
+ suggestedName: string(),
13419
+ config: record(string(), unknown())
13420
+ });
13421
+ /** The degrade engine's report — what was resolved / dropped / degraded. */
13422
+ var RenderedAsSchema = object({
13423
+ level: string(),
13424
+ format: NotificationFormatSchema,
13425
+ attachmentsSent: number().int().nonnegative(),
13426
+ actionsSent: number().int().nonnegative(),
13427
+ truncated: boolean(),
13428
+ dropped: array(string())
13429
+ });
13430
+ var SendResultSchema = object({
13271
13431
  success: boolean(),
13272
- error: string().optional()
13273
- }), { kind: "mutation" });
13432
+ error: string().optional(),
13433
+ renderedAs: RenderedAsSchema.optional()
13434
+ });
13435
+ /** Same shape as SendResult — kept as a distinct name for the test panel. */
13436
+ var TestResultSchema = SendResultSchema;
13437
+ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
13438
+ kind: string(),
13439
+ config: record(string(), unknown()).optional()
13440
+ }), array(DiscoveredTargetSchema)), method(object({
13441
+ targetId: string(),
13442
+ notification: NotificationSchema
13443
+ }), SendResultSchema, { kind: "mutation" }), method(object({
13444
+ targetId: string(),
13445
+ sample: NotificationSchema.optional()
13446
+ }), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
13447
+ targetId: string(),
13448
+ enabled: boolean()
13449
+ }), _void(), { kind: "mutation" });
13274
13450
  /**
13275
13451
  * Zod schemas for persisted record types.
13276
13452
  *
@@ -19265,13 +19441,49 @@ Object.freeze({
19265
19441
  addonId: null,
19266
19442
  access: "create"
19267
19443
  },
19444
+ "notificationOutput.deleteTarget": {
19445
+ capName: "notification-output",
19446
+ capScope: "system",
19447
+ addonId: null,
19448
+ access: "delete"
19449
+ },
19450
+ "notificationOutput.discoverTargets": {
19451
+ capName: "notification-output",
19452
+ capScope: "system",
19453
+ addonId: null,
19454
+ access: "view"
19455
+ },
19456
+ "notificationOutput.listTargetKinds": {
19457
+ capName: "notification-output",
19458
+ capScope: "system",
19459
+ addonId: null,
19460
+ access: "view"
19461
+ },
19462
+ "notificationOutput.listTargets": {
19463
+ capName: "notification-output",
19464
+ capScope: "system",
19465
+ addonId: null,
19466
+ access: "view"
19467
+ },
19268
19468
  "notificationOutput.send": {
19269
19469
  capName: "notification-output",
19270
19470
  capScope: "system",
19271
19471
  addonId: null,
19272
19472
  access: "create"
19273
19473
  },
19274
- "notificationOutput.sendTest": {
19474
+ "notificationOutput.setTargetEnabled": {
19475
+ capName: "notification-output",
19476
+ capScope: "system",
19477
+ addonId: null,
19478
+ access: "create"
19479
+ },
19480
+ "notificationOutput.testTarget": {
19481
+ capName: "notification-output",
19482
+ capScope: "system",
19483
+ addonId: null,
19484
+ access: "create"
19485
+ },
19486
+ "notificationOutput.upsertTarget": {
19275
19487
  capName: "notification-output",
19276
19488
  capScope: "system",
19277
19489
  addonId: null,
@@ -21275,7 +21487,7 @@ var AdminUIAddon = class extends BaseAddon {
21275
21487
  capability: adminUiCapability,
21276
21488
  provider: {
21277
21489
  getStaticDir: async () => ({ staticDir: resolveAdminUiDistDir() }),
21278
- getVersion: async () => ({ version: "1.1.17" })
21490
+ getVersion: async () => ({ version: "1.1.19" })
21279
21491
  }
21280
21492
  }];
21281
21493
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-admin-ui",
3
- "version": "1.1.17",
3
+ "version": "1.1.19",
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{Hi as e,Ui as t,ba as n,d as r,g as i,ht as a,m as o,ut as s,va as c}from"./src-BRShKZTM.js";import{K as l,S as u,Z as d,o as f,x as p,z as m}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CCjPq1YD.js";import{t as h}from"./bell-Cr8Qhoyl.js";import{t as g}from"./plus-B27j2LN4.js";import{t as _}from"./refresh-cw-Czwx0733.js";import{t as v}from"./square-DT7MGW4Y.js";import{B as y,P as b,V as x,p as S,x as C}from"./index-CfF7gHyZ.js";import{t as w}from"./AdminPage-vtcsGqRq.js";import{t as T}from"./NodeAddonsSettingsPanel-BSbcWPHw.js";var E=y(`play`,[[`polygon`,{points:`6 3 20 12 6 21 6 3`,key:`1oa8hb`}]]);d();function D({addonId:e,fallback:t,tileClassName:n,iconPath:r=`assets/icon.svg`}){let[i,a]=l(!1),o=`/api/addon-assets/${e}/${r}`;return p(`div`,{className:`h-10 w-10 rounded-lg flex items-center justify-center shrink-0 ${n}`,children:i?p(t,{className:`h-5 w-5`}):p(`img`,{src:o,alt:e,className:`h-7 w-7 rounded-md bg-white p-1 ring-1 ring-black/5`,onError:()=>a(!0)})})}d();function O({addonId:e,defaultActivity:t,showActivity:n=!0,maxHeight:r=`max-h-64`,defaultTab:a,capability:s}){let[c,d]=l(t??(a===`events`?`events`:`logs`));return u(`div`,{className:`flex flex-col gap-4`,children:[p(T,{nodeId:`hub`,addonIds:[e],level:`global`,capability:s}),n&&u(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[u(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border bg-surface-hover/20`,children:[p(`span`,{className:`text-[11px] font-semibold text-foreground-subtle uppercase tracking-wide`,children:`Activity`}),u(`div`,{className:`flex items-center gap-1`,children:[p(k,{kind:`logs`,active:c===`logs`,onClick:()=>d(`logs`)}),p(k,{kind:`events`,active:c===`events`,onClick:()=>d(`events`)})]})]}),c===`logs`?p(i,{addonId:e,maxHeight:r,showFilters:!1}):p(o,{addonId:e,category:`addon.*`,maxHeight:r})]})]})}function k({kind:e,active:t,onClick:n}){return u(`button`,{onClick:n,className:`inline-flex items-center gap-1 rounded px-2 py-0.5 text-[11px] font-medium transition-colors ${t?`bg-primary/10 text-primary`:`text-foreground-subtle hover:text-foreground hover:bg-surface-hover`}`,children:[p(e===`logs`?S:h,{className:`h-3 w-3`}),e===`logs`?`Logs`:`Events`]})}d();function A(r){let{title:i,subtitle:a,pageIcon:o,itemIcon:s,capability:d,installButtonLabel:f=`Add addon`,items:h,isLoading:_,emptyTitle:v=`No addons installed for this capability`,emptyDescription:y,itemIconColor:S,renderStatusBadges:C,renderPrimaryAction:T,itemError:E,renderExpandedPanel:k,workspaceMaxHeight:A=`max-h-72`,trailing:P,showChrome:F=!1}=r,I=h.length>1,[L,R]=l(()=>h[0]?.addonId??null);m(()=>{L&&(h.some(e=>e.addonId===L)||R(h[0]?.addonId??null))},[h,L]);let z=e=>R(t=>t===e?null:e),B=`/system/addons?capability=${encodeURIComponent(d)}`;return p(w,{icon:F?o:void 0,title:F?i:void 0,subtitle:F?a:void 0,actions:F?p(x,{to:B,children:u(n,{variant:`primary`,size:`sm`,children:[p(g,{className:`h-3.5 w-3.5 mr-1`}),f]})}):void 0,children:_?p(c,{children:p(`div`,{className:`p-6 text-sm text-foreground-subtle`,children:`Loading…`})}):h.length===0?p(c,{children:p(t,{title:v,description:y??`Install an addon that declares the "${d}" capability to get started.`,action:F?p(x,{to:B,children:u(n,{variant:`primary`,size:`sm`,children:[p(g,{className:`h-3.5 w-3.5 mr-1`}),f]})}):void 0})}):u(`div`,{className:`flex flex-col gap-4`,children:[h.map(t=>{let n=!I||L===t.addonId,r=S?.(t)??(t.isActive?`bg-emerald-500/15 text-emerald-700 dark:text-emerald-300`:`bg-foreground-subtle/15 text-foreground-subtle`),i=E?.(t)??null;return u(c,{children:[u(`div`,{className:`flex flex-col gap-3 p-4 sm:flex-row sm:items-center ${n?`border-b border-border`:``}`,children:[u(`div`,{className:`flex items-center gap-3 flex-1 min-w-0`,children:[I&&p(`button`,{type:`button`,onClick:()=>z(t.addonId),"aria-label":n?`Collapse`:`Expand`,className:`shrink-0 p-1 rounded hover:bg-foreground-subtle/10 transition-colors`,children:p(b,{className:`h-4 w-4 text-foreground-subtle transition-transform ${n?`rotate-180`:``}`})}),u(`button`,{type:`button`,onClick:()=>I&&z(t.addonId),className:`flex items-center gap-4 flex-1 min-w-0 text-left ${I?`hover:opacity-80 transition-opacity`:``}`,disabled:!I,children:[p(D,{addonId:t.addonId,fallback:s,tileClassName:r}),u(`div`,{className:`flex-1 min-w-0`,children:[u(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[p(`span`,{className:`font-semibold text-foreground`,children:t.displayName}),p(j,{isActive:t.isActive}),C?.(t)]}),u(`div`,{className:`text-xs text-foreground-subtle mt-1 font-mono break-all`,children:[`@camstack/addon-`,t.addonId]})]})]})]}),u(`div`,{className:`flex items-center gap-1 shrink-0 flex-wrap justify-end`,children:[T?.(t),p(M,{capName:d,addonId:t.addonId,isActive:t.isActive}),p(N,{addonId:t.addonId,displayName:t.displayName})]})]}),n&&u(`div`,{className:`p-4 flex flex-col gap-3`,children:[i!==null&&p(e,{message:i}),k?.(t),p(O,{addonId:t.addonId,maxHeight:A,capability:d})]})]},t.addonId)}),P]})})}function j({isActive:e}){return p(`span`,{className:`text-[10px] rounded-full px-2 py-0.5 font-medium ${e?`bg-emerald-500/15 text-emerald-700 dark:text-emerald-300`:`bg-foreground-subtle/15 text-foreground-subtle`}`,children:e?`Enabled`:`Disabled`})}function M({capName:e,addonId:t,isActive:r}){let i=f(),o=a({onSuccess:()=>{i.invalidateQueries({queryKey:[[`addons`,`listCapabilityProviders`]]})}}),s=o.isPending;return u(n,{size:`sm`,variant:r?`secondary`:`primary`,disabled:s,onClick:()=>o.mutate({capName:e,addonId:t,enabled:!r}),children:[s?p(C,{className:`h-3 w-3 animate-spin`}):p(r?v:E,{className:`h-3 w-3`}),r?`Disable`:`Enable`]})}function N({addonId:e,displayName:t}){let n=f(),i=s({onSuccess:()=>{n.invalidateQueries({queryKey:[[`addons`,`listCapabilityProviders`]]})}});return p(r,{label:`Restart`,icon:_,size:`sm`,title:`Restart "${t}"?`,description:`Restarting the addon bounces its subprocess — the provider will briefly drop and reconnect automatically.`,confirmLabel:`Restart`,triggerVariant:`ghost`,confirmVariant:`danger`,disabled:i.isPending,action:()=>i.mutateAsync({addonId:e})})}export{E as n,A as t};
@@ -1 +0,0 @@
1
- import{$ as e,Q as t,Sr as n,Vi as r,Wi as i,_t as a,at as o,ct as s,et as c,ft as l,g as u,gr as d,gt as f,it as ee,lt as p,m,mt as h,nt as g,pt as _,rt as v,st as y,tt as b,ut as te,v as ne,vt as x,yt as re}from"./src-BRShKZTM.js";import{G as S,I as C,K as w,R as T,S as E,W as D,Z as O,b as k,o as ie,x as A,z as j}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CCjPq1YD.js";import{p as M}from"./player-overlays-DGBZRYiK.js";import{t as N}from"./download-DWoalB9v.js";import{t as ae}from"./plus-B27j2LN4.js";import{t as P}from"./refresh-cw-Czwx0733.js";import{t as oe}from"./search-ZUWjHFq0.js";import{t as F}from"./upload-B8xrbQiZ.js";import{A as I,B as L,F as R,H as z,P as se,W as B,f as V,h as H,i as ce,o as U,p as le,s as ue,x as W}from"./index-CfF7gHyZ.js";import{t as G}from"./AdminPage-vtcsGqRq.js";import{t as de}from"./NodeAddonsSettingsPanel-BSbcWPHw.js";var fe=L(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),K=L(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16 14`,key:`68esgv`}]]),q=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`}]]),pe=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`}]]);O();function me({packageName:e,currentVersion:t,installSource:n,onInstall:r,onClose:i}){let a=n===`upload`||n===`local`,{data:o,isLoading:s}=v({name:e});return E(`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:[E(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border`,children:[A(`span`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle font-medium`,children:`Versions`}),A(`button`,{type:`button`,onClick:i,className:`text-foreground-subtle hover:text-foreground`,children:A(ce,{className:`h-3 w-3`})})]}),a&&E(`div`,{className:`flex items-start gap-2 px-3 py-2 border-b border-border bg-cyan-500/10 text-[10px]`,children:[A(F,{className:`h-3 w-3 mt-0.5 text-cyan-500 shrink-0`}),E(`div`,{className:`text-cyan-700 dark:text-cyan-200`,children:[E(`span`,{className:`font-semibold`,children:[n===`upload`?`Uploaded copy`:`Local copy`,` in place.`]}),` `,`Re-install `,A(`span`,{className:`font-mono`,children:t}),` from npm to track upstream releases again.`]})]}),s&&E(`div`,{className:`flex items-center justify-center gap-2 py-6 text-[10px] text-foreground-subtle`,children:[A(W,{className:`h-3.5 w-3.5 animate-spin`}),`Loading versions...`]}),o&&A(`div`,{className:`max-h-64 overflow-auto divide-y divide-border`,children:o.map(e=>{let n=e.version===t,i=/-(alpha|beta|rc|dev|canary|next)/i.test(e.version);return E(`div`,{className:`flex items-center gap-2 px-3 py-2 text-[11px] ${n?`bg-primary/5`:`hover:bg-surface-hover`} transition-colors`,children:[A(`span`,{className:`font-mono flex-1 ${n?`text-primary font-semibold`:i?`text-amber-400`:`text-foreground`}`,children:e.version}),e.distTags.map(e=>A(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium ${e===`latest`?`bg-emerald-500/15 text-emerald-400`:e===`beta`?`bg-amber-500/15 text-amber-400`:`bg-gray-500/15 text-gray-400`}`,children:e},e)),e.deprecated&&A(`span`,{className:`text-[9px] text-red-400 line-through`,children:`deprecated`}),A(`span`,{className:`text-[9px] text-foreground-subtle shrink-0`,children:new Date(e.publishedAt).toLocaleDateString()}),n&&!a?A(R,{className:`h-3 w-3 text-primary shrink-0`}):A(`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:A(N,{className:`h-3 w-3`})})]},e.version)})}),o&&o.length===0&&A(`div`,{className:`py-4 text-center text-[10px] text-foreground-subtle`,children:`No versions found`})]})}var J={queued:{icon:K,bg:`bg-muted text-foreground-subtle`,label:`queued`},updating:{icon:W,bg:`bg-primary/10 text-primary`,label:`updating`,spin:!0},"done-pending-restart":{icon:P,bg:`bg-amber-500/10 text-amber-700`,label:`pending restart`},done:{icon:R,bg:`bg-success/10 text-success`,label:`done`},failed:{icon:q,bg:`bg-danger/10 text-danger`,label:`failed`}};function he({item:e}){let t=J[e.status],n=t.icon;return E(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded ${t.bg}`,title:e.error,children:[A(n,{className:`w-2.5 h-2.5 ${t.spin?`animate-spin`:``}`}),t.label]})}var Y=`device-export`;function ge(e){return e.capabilities.some(e=>(typeof e==`string`?e:e.name)===Y)}function _e({isBundle:e,installSource:t,addonId:n,iconPath:r,color:i}){let[a,o]=w(!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 E(`div`,{className:`relative flex-shrink-0`,children:[A(`div`,{className:`h-9 w-9 rounded-lg flex items-center justify-center ${s?``:c}`,style:s,children:u?A(`img`,{src:l,alt:n,className:`h-5 w-5`,onError:()=>o(!0)}):A(e?pe:H,{className:`h-4 w-4`})}),t===`local`&&A(`span`,{className:`absolute -top-1.5 -left-1.5 text-[7px] font-bold leading-none bg-orange-500 text-white px-1 py-0.5 rounded -rotate-12 shadow-sm`,children:`DEV`}),t===`npm`&&A(`span`,{className:`absolute -top-1 -left-1 w-4 h-4 rounded bg-[#cb3837] flex items-center justify-center -rotate-12 shadow-sm`,children:A(`svg`,{viewBox:`0 0 780 250`,className:`w-[11px] h-[11px]`,children:A(`path`,{fill:`#fff`,d:`M240 250h100V50h100v200h340V0H0v250z`})})}),t===`upload`&&A(`span`,{className:`absolute -top-1.5 -left-1.5 flex items-center justify-center h-4 w-4 rounded bg-cyan-500 -rotate-12 shadow-sm`,children:A(F,{className:`h-2.5 w-2.5 text-white`})})]})}function ve({version:e,availableUpdate:t,isUpdating:n,installSource:r,disabled:i,onActivate:a,onOpenPicker:o,children:s}){return n?E(`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:[A(W,{className:`h-3 w-3 animate-spin`}),`Updating…`]}):E(`div`,{className:`relative inline-flex items-center gap-1 shrink-0`,children:[E(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),a()},disabled:i,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`,r===`local`?`border-orange-500/30 bg-orange-500/10 text-orange-400 hover:bg-orange-500/20`:t?`border-amber-500/40 bg-amber-500/15 text-amber-500 hover:bg-amber-500/25 animate-pulse`:`border-emerald-500/30 bg-emerald-500/10 text-emerald-400 hover:bg-emerald-500/20`].join(` `),title:t?`Update available (${t}) — tap to update. Current ${e}.`:`Version ${e} — tap to view all versions`,children:[t&&A(N,{className:`h-3 w-3`}),e,!t&&A(se,{className:`h-3 w-3 opacity-50`})]}),t&&A(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),o()},disabled:i,className:`hidden sm:inline-flex items-center rounded-md px-1 py-1 text-foreground-subtle border border-border hover:bg-surface-hover disabled:opacity-50`,title:`View all versions`,"aria-label":`View all versions`,children:A(se,{className:`h-3 w-3`})}),s]})}function ye({addonId:e}){let t=ie(),{data:n=`inherit`}=c({addonId:e}),r=h({onSuccess:()=>{t.invalidateQueries({queryKey:[[`addons`,`getAddonAutoUpdate`]]})}});return A(`div`,{className:`flex rounded-lg border border-border overflow-hidden text-[10px] font-medium`,children:[`inherit`,`off`,`latest`,`beta`].map(t=>A(`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 be({addon:e,agents:t=[],clusterStatus:n,hideVersion:i,availableUpdate:o,onUpdate:s,isUpdating:c,bundle:d,bulkItem:f,disabledByBulk:p,isSystem:h}){let[g,_]=w(!1),[v,y]=w(!1),[b,x]=w(!1),[re,S]=w(!1),[C,T]=w(!1),[D,O]=w(`logs`),j=ie(),N=M(),oe=z(),F=r(),{manifest:I}=e,L=e.installedOn??[],R=!d&&!I.protected&&I.removable!==!1,B=!!d,H=d?.displayName??I.name,U=d?.packageName??I.packageName,W=d?.version??I.packageVersion??I.version,G=d?.installSource??e.installSource,K=d?d.bundle?.description??d.addons[0]?.manifest.description:I.description,J=a({onSuccess:()=>{j.invalidateQueries({queryKey:[[`addons`]]}),j.invalidateQueries({queryKey:[[`addonPages`]]}),j.invalidateQueries({queryKey:[[`capabilities`]]})}}),Y=te({onSuccess:()=>{j.invalidateQueries({queryKey:[[`addons`]]})}}),xe=ee({onSuccess:()=>{j.invalidateQueries({queryKey:[[`addons`]]}),j.invalidateQueries({queryKey:[[`addonPages`]]}),j.invalidateQueries({queryKey:[[`capabilities`]]}),j.invalidateQueries({queryKey:[[`integrations`]]})}}),Se=l({onSuccess:()=>{j.invalidateQueries({queryKey:[[`addons`]]}),j.invalidateQueries({queryKey:[[`alerts`]]})}}),X=e.health,Z=X?.phase===`failed`&&!X.inGracePeriod,Ce=Z&&X?.nextRetryAt&&!X.retrying;return E(`div`,{className:`rounded-lg border bg-surface overflow-hidden ${Z?`border-red-500/50`:`border-border`}`,children:[Z&&X&&E(`div`,{className:`bg-danger/10 border-b border-danger/30 px-4 py-2.5 flex items-start gap-2.5`,children:[A(q,{className:`h-4 w-4 text-danger shrink-0 mt-0.5`}),E(`div`,{className:`flex-1 min-w-0`,children:[E(`div`,{className:`text-xs font-semibold text-danger`,children:[`Failed to load (attempt #`,X.retryCount,`)`]}),A(`div`,{className:`text-[11px] text-foreground mt-0.5 break-words font-mono`,children:X.lastError?.message??`Unknown error`}),Ce&&X.nextRetryAt&&E(`div`,{className:`text-[10px] text-foreground-subtle mt-1`,children:[`Auto-retry at `,new Date(X.nextRetryAt).toLocaleTimeString()]})]}),E(`button`,{type:`button`,disabled:Se.isPending||X.retrying,onClick:e=>{e.stopPropagation(),Se.mutate({packageName:U})},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:[A(P,{className:`h-3 w-3 ${Se.isPending||X.retrying?`animate-spin`:``}`}),`Retry now`]})]}),E(`div`,{className:`flex items-start gap-3 px-4 py-3`,children:[A(_e,{isBundle:B||!!I.components&&I.components.length>1,installSource:G,addonId:B?d.addons[0]?.manifest.id:I.id,iconPath:B?d.bundle?.icon??d.addons[0]?.manifest.icon:I.icon,color:B?d.addons[0]?.manifest.color:I.color}),E(`div`,{className:`flex-1 min-w-0`,children:[E(`div`,{className:`flex items-start justify-between gap-2`,children:[A(`span`,{className:`text-sm font-semibold text-foreground truncate min-w-0`,children:H}),!i&&A(ve,{version:W,availableUpdate:o,isUpdating:c,installSource:G,disabled:p,onActivate:()=>{o&&s?s():x(e=>!e)},onOpenPicker:()=>x(e=>!e),children:b&&A(me,{packageName:U,currentVersion:W,...G?{installSource:G}:{},onInstall:e=>{x(!1),xe.mutate({packageName:U,version:e})},onClose:()=>x(!1)})})]}),E(`div`,{className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 mt-0.5`,children:[U!==H&&A(`span`,{className:`text-[10px] text-foreground-subtle font-mono truncate max-w-full`,children:U}),B&&E(`span`,{className:`text-[10px] rounded-full bg-primary/10 text-primary px-2 py-0.5 font-medium shrink-0 inline-flex items-center gap-1`,children:[A(pe,{className:`h-3 w-3`}),d.addons.length]}),h&&E(`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:[A(P,{className:`h-3 w-3`}),`System`]}),f!=null&&A(he,{item:f})]}),K&&A(`p`,{className:`text-[10px] text-foreground-subtle mt-1 line-clamp-1`,children:K}),!B&&e.process&&E(`div`,{className:`flex flex-wrap items-center gap-1.5 mt-1`,children:[A(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium ${e.process.mode===`forked`?`bg-blue-500/15 text-blue-400`:`bg-gray-500/15 text-gray-400`}`,children:e.process.mode===`forked`?`forked`:`in-process`}),e.process.pid!=null&&E(`span`,{className:`text-[9px] font-mono text-foreground-subtle`,children:[`PID `,e.process.pid]}),A(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium ${e.process.state===`running`?`bg-emerald-500/15 text-emerald-400`: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})]})]})]}),!B&&E(`div`,{className:`flex items-center gap-1 px-4 py-1.5 border-t border-border/50 bg-surface-hover/20`,children:[E(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),Y.mutate({addonId:I.id})},disabled:Y.isPending||p,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:[A(P,{className:`h-3 w-3 ${Y.isPending?`animate-spin`:``}`}),`Restart`]}),E(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),S(e=>!e)},className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border transition-colors ${re?`border-primary/30 bg-primary/10 text-primary`:`border-border text-foreground-subtle hover:text-foreground hover:border-primary/30 hover:bg-primary/10`}`,children:[A(le,{className:`h-3 w-3`}),`Logs`]}),!B&&E(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),T(!0)},className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border transition-colors ${C?`border-primary/30 bg-primary/10 text-primary`:`border-border text-foreground-subtle hover:text-foreground hover:border-primary/30 hover:bg-primary/10`}`,children:[A(V,{className:`h-3 w-3`}),`Settings`]}),A(`div`,{className:`flex-1`}),R&&E(`button`,{type:`button`,onClick:async e=>{e.stopPropagation(),await F({title:`Uninstall ${I.name}?`,message:`This will remove the addon package and all its data. This action cannot be undone.`,confirmLabel:`Uninstall`,variant:`danger`})&&J.mutate({packageName:I.packageName})},disabled:J.isPending||p,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:[A(ue,{className:`h-3 w-3`}),J.isPending?`Removing...`:`Uninstall`]})]}),n&&n.nodes.length>1&&!B&&E(`div`,{className:`border-t border-border px-4 py-2 bg-muted/10`,children:[A(`div`,{className:`text-[10px] font-medium text-foreground-subtle mb-1.5`,children:`Cluster Deployment`}),A(`div`,{className:`space-y-1`,children:n.nodes.map(e=>E(`div`,{className:`flex items-center gap-2 text-[10px]`,children:[A(`div`,{className:`h-1.5 w-1.5 rounded-full shrink-0 ${e.status===`offline`?`bg-muted-foreground/30`:e.synced?`bg-success`:`bg-amber-500`}`}),A(`span`,{className:`font-medium text-foreground min-w-[60px]`,children:e.name}),A(`span`,{className:`font-mono text-foreground-subtle`,children:e.version}),!e.synced&&e.status!==`offline`&&A(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-amber-500/10 text-amber-400 border border-amber-500/20`,children:`outdated`}),e.status===`offline`&&A(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-muted text-muted-foreground`,children:`offline`}),e.synced&&e.status!==`offline`&&A(`span`,{className:`text-[9px] text-success`,children:`synced`})]},e.nodeId))})]}),re&&!B&&E(`div`,{className:`border-t border-border`,children:[E(`div`,{className:`flex items-center px-4 py-1 bg-surface-hover/20 border-b border-border/50`,children:[E(`div`,{className:`flex rounded border border-border overflow-hidden text-[9px]`,children:[A(`button`,{type:`button`,onClick:()=>O(`logs`),className:`px-2 py-0.5 transition-colors ${D===`logs`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:`Logs`}),A(`button`,{type:`button`,onClick:()=>O(`events`),className:`px-2 py-0.5 border-l border-border transition-colors ${D===`events`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:`Events`})]}),A(`div`,{className:`flex-1`}),A(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),S(!1)},className:`text-foreground-subtle hover:text-foreground`,children:A(ce,{className:`h-3.5 w-3.5`})})]}),D===`logs`&&A(u,{addonId:I.id,maxHeight:`max-h-64`,showFilters:!1}),D===`events`&&A(m,{addonId:I.id,category:`addon.*`,maxHeight:`max-h-64`})]}),B&&E(k,{children:[A(`button`,{type:`button`,onClick:()=>_(e=>!e),className:`w-full flex items-center justify-center border-t border-border py-1 hover:bg-surface-hover/50 transition-colors`,children:A(g?fe:se,{className:`h-3.5 w-3.5 text-foreground-subtle`})}),g&&A(`div`,{className:`border-t border-border px-3 py-2 space-y-2`,children:d.addons.map(e=>A(be,{addon:e,agents:t,hideVersion:!0},e.manifest.id))})]}),C&&!B&&A(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4`,onClick:()=>T(!1),children:E(`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:[E(`div`,{className:`flex items-center justify-between px-5 py-3 border-b border-border flex-shrink-0`,children:[E(`div`,{className:`flex items-center gap-2`,children:[A(V,{className:`h-4 w-4 text-primary`}),E(`h2`,{className:`text-sm font-semibold text-foreground`,children:[H,` Settings`]})]}),A(`button`,{onClick:()=>T(!1),className:`text-foreground-subtle hover:text-foreground transition-colors p-1 rounded`,children:A(ce,{className:`h-4 w-4`})})]}),E(`div`,{className:`flex-1 overflow-y-auto px-5 py-4 space-y-4`,children:[A(de,{nodeId:`hub`,addonIds:[I.id],level:`global`}),ge(I)&&E(`div`,{children:[A(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:`Device export`}),A(ne,{addonId:I.id,trpc:N.trpcClient,onOpenDevice:e=>oe(`/devices/${e}`)})]}),G===`npm`&&E(`div`,{children:[A(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:`Auto-Update`}),A(ye,{addonId:I.id})]}),I.components&&I.components.length>0&&E(`div`,{children:[E(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:[`Components (`,I.components.length,`)`]}),A(`div`,{className:`flex flex-wrap gap-1`,children:I.components.map(e=>A(`span`,{className:`text-[10px] rounded bg-background border border-border px-1.5 py-0.5 text-foreground-subtle font-mono`,children:e},e))})]}),t.length>=2&&E(`div`,{children:[A(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:`Installed on`}),E(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[L.length===0&&A(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Hub (local)`}),L.map(e=>A(`span`,{className:`rounded-full bg-surface-hover border border-border px-2 py-0.5 text-[10px] text-foreground-subtle`,children:e},e)),E(`div`,{className:`relative`,children:[E(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),y(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:[A(ae,{className:`h-3 w-3`}),`Add agent`]}),v&&E(`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&&!L.includes(e.name)).map(e=>A(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),y(!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&&!L.includes(e.name)).length===0&&A(`div`,{className:`px-3 py-1.5 text-[10px] text-foreground-subtle`,children:`No available agents`})]})]})]})]})]}),A(`div`,{className:`flex items-center justify-end px-5 py-3 border-t border-border flex-shrink-0`,children:A(`button`,{type:`button`,onClick:()=>T(!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`})})]})})]})}O();var xe=`.tgz,.tar.gz,.zip`;function Se({onUploadSuccess:e}){let[t,n]=w(!1),r=S(null),i=C(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 E(k,{children:[A(`input`,{ref:r,type:`file`,accept:xe,onChange:C(e=>{let t=e.target.files?.[0];t&&i(t),e.target.value=``},[i]),className:`hidden`}),E(`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?A(W,{className:`w-3.5 h-3.5 animate-spin`}):A(F,{className:`w-3.5 h-3.5`}),t?`Uploading...`:`Upload`]})]})}function X({pending:e,onCancel:t,onConfirm:n,isPending:r,error:i}){return A(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60`,children:E(`div`,{className:`bg-surface border border-border rounded-md shadow-xl p-5 max-w-md w-full mx-4 space-y-3`,children:[E(`div`,{className:`flex items-center gap-2`,children:[A(U,{className:`w-4 h-4 text-amber-700`}),A(`h3`,{className:`text-sm font-medium text-foreground`,children:`Update system package?`})]}),E(`div`,{className:`space-y-2 text-[11px] text-foreground-subtle`,children:[E(`div`,{children:[A(`span`,{className:`font-mono text-foreground`,children:e.packageName}),A(`span`,{className:`mx-1`,children:`·`}),E(`span`,{className:`font-mono`,children:[`v`,e.fromVersion]}),A(`span`,{className:`mx-1`,children:`→`}),E(`span`,{className:`font-mono text-amber-700`,children:[`v`,e.toVersion]})]}),A(`div`,{className:`rounded border border-amber-500/30 bg-amber-500/10 p-2 text-amber-800`,children:`The hub will restart immediately after the install. Any in-flight requests will be dropped. The reconnect typically takes ~10 seconds.`}),i!==null&&A(`div`,{className:`rounded border border-danger/40 bg-danger/10 p-2 text-danger`,children:i})]}),E(`div`,{className:`flex justify-end gap-2 pt-1`,children:[A(`button`,{type:`button`,onClick:t,disabled:r,className:`px-3 py-1.5 text-[11px] rounded bg-surface hover:bg-surface-hover border border-border disabled:opacity-50`,children:`Cancel`}),E(`button`,{type:`button`,onClick:n,disabled:r,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-[11px] rounded bg-amber-500/20 text-amber-800 hover:bg-amber-500/30 border border-amber-500/40 font-medium disabled:opacity-50`,children:[r?A(W,{className:`w-3 h-3 animate-spin`}):A(N,{className:`w-3 h-3`}),`Update & restart`]})]})]})})}O();function Z(e,t){let n=e??`hub-only`;return n===`any-node`?!0:n===`hub-only`?t:!t}function Ce(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 we(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 Q(e){return`bundle`in e}function Te({addons:e,clusterStatus:n,selectedNode:i,onRefresh:a,isRefreshing:o}){let c=ie(),[l,u]=w(``),d=T(l),[p,m]=w(!1),h=S(null);j(()=>{if(!p)return;let e=e=>{h.current&&!h.current.contains(e.target)&&m(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[p]);let{data:v}=s({nodeId:i.id}),te=D(()=>{let e=new Map;for(let t of v??[])e.set(t.name,t.latestVersion);return e},[v]),[ne,O]=w(null),[k,M]=w(null),ae=re({onMutate:e=>{O(e.name),M(null)},onSuccess:(e,t)=>{O(null);let n=e;if(n&&n.success===!1){M({name:t.name,message:n.error??`Update failed (no error message returned by server)`});return}c.invalidateQueries({queryKey:[[`addons`]]}),c.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]})},onError:(e,t)=>{O(null),M({name:t.name,message:e instanceof Error?e.message:String(e)})}}),{data:F}=b(void 0),L=t({onSuccess:()=>{c.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),{data:z,isFetching:se}=_({query:d||void 0},{enabled:p}),V=f(),{data:H}=g(void 0),ce=H?.requestedAt,[U,le]=w(null),[ue,G]=w(!1);j(()=>{if(H?.kind===`framework-bulk-update`&&H.requestedAt!==U){le(H.requestedAt),G(!0);let e=window.setTimeout(()=>G(!1),6e3);return()=>window.clearTimeout(e)}},[ce,U,H]);let{data:de}=y(void 0),fe=D(()=>new Map((de??[]).map(e=>[e.packageName,e])),[de]),[K,q]=w(null),[pe,me]=w(null),J=x({onSuccess:()=>{q(null),c.invalidateQueries({queryKey:[[`addons`]]})},onError:e=>{me(e instanceof Error?e.message:String(e))}}),he=r(),Y=C(async()=>{let e=v??[];e.length!==0&&(e.some(e=>e.isSystem)&&!await he({title:`Update all — includes a system package`,message:`This batch updates a system package (@camstack/system). The hub will restart automatically once the framework update completes. In-flight requests are dropped; reconnect typically takes ~10 seconds.`,confirmLabel:`Update all & restart`,variant:`warning`})||await V.mutateAsync({kind:`update`,targets:e.map(e=>({name:e.name,version:e.latestVersion})),nodeIds:[i.id]}))},[v,i.id,V,he]),ge=ee({onSuccess:()=>{c.invalidateQueries({queryKey:[[`addons`]]}),c.invalidateQueries({queryKey:[[`addonPages`]]}),c.invalidateQueries({queryKey:[[`capabilities`]]}),c.invalidateQueries({queryKey:[[`integrations`]]})}}),[_e,ve]=w(`type`),[ye,xe]=w(()=>typeof window>`u`?`grouped`:window.localStorage.getItem(`camstack.addons.viewMode`)===`flat`?`flat`:`grouped`),Ce=e=>{xe(e),typeof window<`u`&&window.localStorage.setItem(`camstack.addons.viewMode`,e)},[Te,Ee]=B(),$=Te.get(`capability`),De=D(()=>{let t=i.isHub?e:e.filter(e=>Z(e.placement,i.isHub));return $&&(t=t.filter(e=>(e.manifest.capabilities??[]).some(e=>(typeof e==`string`?e:e.name)===$))),t},[e,i.isHub,$]),Oe=()=>{let e=new URLSearchParams(Te);e.delete(`capability`),Ee(e,{replace:!0})},ke=ye===`flat`?De:we(De),Ae=D(()=>{let e=[...ke];switch(_e){case`type`:e.sort((e,t)=>{let n=+!Q(e),r=+!Q(t);if(n!==r)return n-r;let i=Q(e)?e.bundle.displayName:e.manifest.name,a=Q(t)?t.bundle.displayName:t.manifest.name;return i.localeCompare(a)});break;case`name`:e.sort((e,t)=>{let n=Q(e)?e.bundle.displayName:e.manifest.name,r=Q(t)?t.bundle.displayName:t.manifest.name;return n.localeCompare(r)});break;case`source`:e.sort((e,t)=>{let n=Q(e)?e.bundle.installSource??``:e.installSource??``,r=Q(t)?t.bundle.installSource??``:t.installSource??``;return n.localeCompare(r)});break}return e},[ke,_e]);return E(`div`,{className:`space-y-4`,children:[k&&A(`div`,{className:`rounded-md border border-danger/30 bg-danger/5 px-3 py-2 text-[11px]`,children:E(`div`,{className:`flex items-start justify-between gap-3`,children:[E(`div`,{className:`space-y-0.5`,children:[E(`div`,{className:`font-medium text-danger`,children:[`Failed to update `,k.name]}),A(`div`,{className:`text-foreground-subtle font-mono`,children:k.message})]}),A(`button`,{type:`button`,onClick:()=>M(null),className:`text-foreground-subtle hover:text-foreground text-[10px]`,children:`dismiss`})]})}),E(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[E(`div`,{className:`flex items-center gap-1.5`,children:[A(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Sort:`}),E(`select`,{value:_e,onChange:e=>ve(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:[A(`option`,{value:`type`,children:`Bundles first`}),A(`option`,{value:`name`,children:`Name`}),A(`option`,{value:`source`,children:`Install source`})]})]}),E(`div`,{className:`flex items-center gap-1.5`,children:[A(`span`,{className:`text-[10px] text-foreground-subtle`,children:`View:`}),A(`div`,{className:`flex rounded-md border border-border overflow-hidden text-[10px] font-medium`,children:[`grouped`,`flat`].map(e=>A(`button`,{type:`button`,onClick:()=>Ce(e),className:`px-2.5 py-1.5 transition-colors capitalize ${ye===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))})]}),i.isHub&&E(`div`,{className:`flex items-center gap-1.5`,children:[A(P,{className:`h-3 w-3 text-foreground-subtle`}),A(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Auto-Update:`}),A(`div`,{className:`flex rounded-md border border-border overflow-hidden text-[10px] font-medium`,children:[`off`,`latest`,`beta`].map(e=>A(`button`,{type:`button`,onClick:()=>L.mutate({channel:e}),disabled:L.isPending,className:`px-2.5 py-1.5 transition-colors capitalize ${F?.channel===e?e===`off`?`bg-gray-700 text-gray-200`:e===`latest`?`bg-blue-500/20 text-blue-400`:`bg-amber-500/20 text-amber-400`:`bg-transparent text-foreground-subtle hover:bg-surface-hover`} ${e===`off`?``:`border-l border-border`}`,children:e},e))})]}),(v?.length??0)>0&&E(`button`,{type:`button`,onClick:()=>void Y(),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?A(W,{className:`w-3 h-3 animate-spin`}):A(N,{className:`w-3 h-3`}),V.isPending?`Updating…`:`Update All (${v.length})`]}),E(`button`,{type:`button`,onClick:a,disabled:o||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:[A(P,{className:`w-3 h-3 ${o?`animate-spin`:``}`}),`Refresh`]})]}),E(`div`,{className:`flex items-center gap-3`,children:[E(`div`,{className:`relative flex-1 min-w-[200px]`,ref:h,children:[A(oe,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-foreground-subtle`}),A(`input`,{type:`text`,value:l,onChange:e=>{u(e.target.value),m(!0)},onFocus:()=>m(!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`}),se&&A(W,{className:`absolute right-2.5 top-1/2 -translate-y-1/2 h-3 w-3 text-foreground-subtle animate-spin`}),p&&z&&z.length>0&&E(`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&&E(`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&&A(`div`,{className:`max-h-72 overflow-auto divide-y divide-border`,children:z.map(e=>E(`div`,{className:`flex items-center gap-3 px-3 py-2 hover:bg-surface-hover transition-colors`,children:[A(`div`,{className:`w-6 h-6 rounded-md bg-primary/10 flex items-center justify-center text-primary text-[9px] font-bold shrink-0`,children:e.name.replace(`@camstack/addon-`,``).charAt(0).toUpperCase()}),E(`div`,{className:`flex-1 min-w-0`,children:[E(`div`,{className:`flex items-center gap-2`,children:[A(`span`,{className:`text-[11px] font-semibold truncate`,children:e.name}),E(`span`,{className:`text-[10px] text-foreground-subtle`,children:[`v`,e.version]})]}),e.description&&A(`div`,{className:`text-[10px] text-foreground-subtle truncate`,children:e.description})]}),e.installed?E(`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:[A(R,{className:`h-3 w-3`}),e.installedVersion??`Installed`]}):E(`button`,{type:`button`,onClick:()=>ge.mutate({packageName:e.name}),disabled:ge.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:[ge.isPending?A(W,{className:`h-3 w-3 animate-spin`}):A(N,{className:`h-3 w-3`}),`Install`]})]},e.name))})]})]}),A(Se,{onUploadSuccess:()=>{c.invalidateQueries({queryKey:[[`addons`]]}),a()}})]}),$&&E(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-lg bg-primary/10 border border-primary/30 text-sm`,children:[A(`span`,{className:`text-foreground-subtle`,children:`Filtering by capability:`}),A(`span`,{className:`font-mono text-primary font-semibold`,children:$}),A(`button`,{type:`button`,onClick:Oe,className:`ml-auto text-xs text-foreground-subtle hover:text-foreground underline`,children:`Clear`})]}),ue&&E(`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:[A(I,{className:`w-4 h-4 shrink-0 mt-0.5 text-green-400`}),E(`div`,{children:[A(`div`,{className:`text-[11px] font-semibold text-foreground`,children:`Bulk update completed`}),A(`div`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:`System packages updated — hub restarted successfully.`})]})]}),De.length===0&&A(`div`,{className:`text-xs text-foreground-subtle`,children:e.length===0?`No addons installed`:$?`No installed addons declare the "${$}" capability. Browse the npm catalog above to find a compatible addon.`:`No addons compatible with ${i.name} (placement filter active)`}),A(`div`,{className:`space-y-2`,children:Ae.map(e=>{let t=Q(e)?e.bundle.packageName:e.manifest.packageName,r=te.get(t),a=Q(e)?e.representative:e,o=fe.has(t),s=r?o?()=>q({packageName:t,fromVersion:fe.get(t)?.currentVersion??a.manifest.packageVersion??a.manifest.version,toVersion:r}):()=>ae.mutate({name:t,version:r,nodeId:i.id}):void 0;return A(be,{addon:a,clusterStatus:n?.[a.manifest.id],bundle:Q(e)?e.bundle:void 0,availableUpdate:r,isUpdating:ne===t,onUpdate:s,isSystem:o,disabledByBulk:V.isPending},Q(e)?t:e.manifest.id)})}),K!==null&&A(X,{pending:K,onCancel:()=>{q(null),me(null)},onConfirm:()=>{me(null),J.mutate({packageName:K.packageName,version:K.toVersion})},isPending:J.isPending,error:pe})]})}function Ee(){let t=ie(),{data:r,isLoading:a,isError:s}=o(),{data:c}=d(void 0),{data:l}=n(void 0,{refetchInterval:1e4}),u=D(()=>{let e=new Map;e.set(`hub`,{id:`hub`,name:`Hub`,isHub:!0});for(let t of l??[]){let n=String(t.id??``);n&&e.set(n,{id:n,name:String(t.name??n),isHub:!!t.isHub})}return[...e.values()]},[l]),[f,ee]=w(`hub`),m=u.find(e=>e.id===f)??u[0],h=e(),g=p(),_=h.isPending||g.isPending,v=async()=>{await h.mutateAsync({nodeId:f}),await g.mutateAsync(),t.invalidateQueries({queryKey:[[`addons`]]})},y=S(h);y.current=h,j(()=>{y.current.mutate({nodeId:`hub`})},[]);let b=(r??[]).map(Ce).filter(e=>e!==null);return E(G,{children:[E(`div`,{className:`flex items-center justify-between gap-3 flex-wrap`,children:[A(i,{selectedNodeId:f,onSelect:ee}),E(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[!a&&!s&&E(`span`,{className:`text-[10px] rounded-full bg-primary/10 text-primary px-2 py-0.5 font-medium`,children:[b.length,` installed`]}),E(`button`,{type:`button`,onClick:()=>void v(),disabled:_,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:[A(P,{className:`w-3 h-3 ${_?`animate-spin`:``}`}),`Check for updates`]})]})]}),!m.isHub&&E(`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`,` `,A(`span`,{className:`font-medium text-foreground`,children:m.name}),` — agents only run`,` `,A(`code`,{className:`font-mono`,children:`agent-only`}),` and`,` `,A(`code`,{className:`font-mono`,children:`any-node`}),` addons. Install / uninstall is hub-driven; agents auto-sync from the hub.`]}),a&&A(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading…`}),s&&A(`div`,{className:`text-xs text-danger`,children:`Failed to load addons`}),!a&&!s&&A(Te,{addons:b,clusterStatus:c,selectedNode:m,onRefresh:()=>void v(),isRefreshing:_})]})}export{Ee as AddonsPage};
@@ -1 +0,0 @@
1
- import{S as e,x as t}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CCjPq1YD.js";import{t as n}from"./bell-Cr8Qhoyl.js";import{n as r,r as i,t as a}from"./zap-BGpwXyqM.js";import{t as o}from"./radio-HF3KnLA1.js";import{t as s}from"./refresh-cw-Czwx0733.js";import{t as c}from"./sparkles-B0yQ4EeK.js";import{B as l,I as u,L as d,T as f,f as p,k as m}from"./index-CfF7gHyZ.js";var h=l(`battery-full`,[[`rect`,{width:`16`,height:`10`,x:`2`,y:`7`,rx:`2`,ry:`2`,key:`1w10f2`}],[`line`,{x1:`22`,x2:`22`,y1:`11`,y2:`13`,key:`4dh1rd`}],[`line`,{x1:`6`,x2:`6`,y1:`11`,y2:`13`,key:`1wd6dw`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`13`,key:`haxvl5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`13`,key:`c6fn6x`}]]),g=l(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),_=l(`grid-2x2`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]),v=l(`map`,[[`path`,{d:`M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z`,key:`169xi5`}],[`path`,{d:`M15 5.764v15`,key:`1pn4in`}],[`path`,{d:`M9 3.236v15`,key:`1uimfh`}]]),y=l(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),b={streaming:{icon:r,label:`Streaming`},detection:{icon:f,label:`Detection`},recording:{icon:g,label:`Recording`},audio:{icon:i,label:`Audio`},snapshot:{icon:u,label:`Snapshot`},motion:{icon:a,label:`Motion`},ptz:{icon:p,label:`PTZ`},webrtc:{icon:o,label:`WebRTC`},onvif:{icon:y,label:`ONVIF`},analytics:{icon:m,label:`Analytics`},"battery-operated":{icon:h,label:`Battery`},"native-snapshot":{icon:u,label:`Native Snapshot`},"pan-tilt-zoom":{icon:p,label:`PTZ`},"two-way-audio":{icon:i,label:`Two-way Audio`},"doorbell-button":{icon:n,label:`Doorbell`},rebootable:{icon:s,label:`Rebootable`},"vacuum-has-map":{icon:v,label:`Map`},"vacuum-has-ai":{icon:c,label:`AI Obstacle`},"mower-has-map":{icon:v,label:`Map`},"mower-has-targeted-mowing":{icon:_,label:`Targeted Mowing`}},x=d;function S({capabilities:n,showLabels:r=!1}){return t(`div`,{className:`flex items-center gap-1 flex-wrap`,children:n.map(n=>{let i=b[n],a=i?.icon??x,o=i?.label??n;return e(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] text-foreground-subtle`,title:o,children:[t(a,{className:`h-3 w-3`}),r&&t(`span`,{children:o})]},n)})})}export{S as t};
@@ -1 +0,0 @@
1
- import{At as e,Dt as t,Ft as n,Mt as r,Nt as i,Ot as a,Pt as o,Vi as s,di as c,dt as l,fi as u,hi as d,jt as f,kt as p,pi as m,qi as h}from"./src-BRShKZTM.js";import{I as g,K as _,S as v,W as y,Z as b,b as x,o as S,x as C,z as w}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CCjPq1YD.js";import{D as T}from"./src-DRUh_aq8.js";import{t as E}from"./download-DWoalB9v.js";import{i as D,n as O,r as k,t as A}from"./AddLocationWizard-De3OH3BA.js";import{t as j}from"./plus-B27j2LN4.js";import{t as M}from"./rotate-cw-Cewee2ld.js";import{B as N,M as P,P as F,R as ee,i as I,s as L,x as R}from"./index-CfF7gHyZ.js";import{t as z}from"./AdminPage-vtcsGqRq.js";import{t as B}from"./format-size-CO9d3C3-.js";import{t as V}from"./AdminTabs-BLDdMbDp.js";var H=N(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),te=N(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),ne=N(`calendar-clock`,[[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M17.5 17.5 16 16.3V14`,key:`akvzfd`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]);b();function U(){let e=S(),t=s(),{data:n,isLoading:r,isError:i}=m({}),a=u(),o=y(()=>a.data??[],[a.data]),[l,f]=_(null),[p,h]=_(null),g=c({onSuccess:()=>{e.invalidateQueries({queryKey:[[`storage`,`listLocations`]]})}}),b=d({onSuccess:()=>{e.invalidateQueries({queryKey:[[`storage`,`listLocations`]]})}}),x=e=>{e.isDefault||b.mutate({id:e.id,type:e.type,providerId:e.providerId,displayName:e.displayName,config:e.config,isDefault:!0})},w=async e=>{if(e.isDefault){await t({title:`Cannot delete default location`,message:`"${e.displayName}" is the default for type "${e.type}". Mark another location as default first, then delete this one.`,confirmLabel:`OK`,variant:`warning`});return}await t({title:`Delete location "${e.displayName}"?`,message:`This removes the location record. Files on disk are not deleted; the underlying directory or remote path stays untouched.`,confirmLabel:`Delete`,variant:`danger`})&&g.mutate({id:e.id})},T=y(()=>{let e=new Map;for(let t of n??[]){let n=e.get(t.type);n?n.push(t):e.set(t.type,[t])}return e},[n]),E=r||a.isLoading,D=i||a.isError;return v(z,{children:[E&&C(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading locations…`}),D&&C(`div`,{className:`text-xs text-danger`,children:`Failed to load storage locations.`}),!E&&!D&&v(`div`,{className:`space-y-3`,children:[o.length===0&&C(`div`,{className:`rounded-lg border border-border bg-surface px-3 py-4 text-center text-[11px] text-foreground-subtle italic`,children:`No storage locations declared by any installed addon.`}),o.map(e=>C(k,{type:e.id,displayName:e.displayName,description:e.description,cardinality:e.cardinality,locations:T.get(e.id)??[],onAdd:e=>f(e),onEdit:e=>h(e),onDelete:e=>{w(e)},onSetDefault:e=>x(e)},e.id))]}),l!==null&&C(A,{initialType:l,onClose:()=>f(null),onCreated:()=>{e.invalidateQueries({queryKey:[[`storage`,`listLocations`]]}),f(null)}}),p!==null&&C(O,{location:p,onClose:()=>h(null),onSaved:()=>{e.invalidateQueries({queryKey:[[`storage`,`listLocations`]]}),h(null)}})]})}b();var W=[[`backup`,`listDestinations`]],G=[`backup`,`listArchives`];function K({destinationId:e,restoreSupported:n,onOpenRestoreWizard:r}){let i=S(),a=s(),{data:o,isLoading:c,isError:l}=p({destinationId:e}),u=o??[],d=t({onSuccess:()=>{i.invalidateQueries({queryKey:[[...G]]}),i.invalidateQueries({queryKey:W})}}),f=g(async t=>{await a({title:`Delete this archive?`,message:`Permanently deletes "${t.label??t.id}" and frees ${B(t.sizeBytes)}.`,confirmLabel:`Delete`,variant:`danger`})&&d.mutate({destinationId:e,backupId:t.id})},[a,e,d]),[m,h]=_(null),b=g(async t=>{h(t.id);try{let n=localStorage.getItem(`camstack_admin_token`),r={};n&&(r.Authorization=`Bearer ${n}`);let i=await fetch(q(e,t.id),{headers:r});if(!i.ok)throw Error(`download failed: ${i.status} ${i.statusText}`);let a=await i.blob(),o=URL.createObjectURL(a),s=document.createElement(`a`);s.href=o,s.download=`${t.label??t.id}.tar.gz`,document.body.appendChild(s),s.click(),s.remove(),URL.revokeObjectURL(o)}finally{h(null)}},[e]),x=y(()=>[...u].toSorted((e,t)=>t.createdAt-e.createdAt),[u]);return c?C(`div`,{className:`text-xs text-foreground-subtle animate-pulse py-2`,children:`Loading archives…`}):l?C(`div`,{className:`text-xs text-danger py-2`,children:`Failed to read manifest for this destination`}):x.length===0?C(`div`,{className:`text-xs text-foreground-subtle italic py-2`,children:`No archives at this destination yet.`}):C(`div`,{className:`rounded border border-border bg-surface overflow-x-auto`,children:v(`table`,{className:`w-full text-xs min-w-[640px]`,children:[C(`thead`,{children:v(`tr`,{className:`text-foreground-subtle bg-background/30`,children:[C(`th`,{className:`text-left px-3 py-1.5 font-medium`,children:`When`}),C(`th`,{className:`text-left px-3 py-1.5 font-medium`,children:`Label`}),C(`th`,{className:`text-left px-3 py-1.5 font-medium`,children:`Includes`}),C(`th`,{className:`text-right px-3 py-1.5 font-medium`,children:`Size`}),C(`th`,{className:`text-right px-3 py-1.5 font-medium w-52`,children:`Actions`})]})}),C(`tbody`,{children:x.map(t=>v(`tr`,{className:`border-t border-border hover:bg-primary/5`,children:[C(`td`,{className:`px-3 py-1.5 text-foreground tabular-nums`,children:J(t.createdAt)}),C(`td`,{className:`px-3 py-1.5 text-foreground`,children:t.label??C(`span`,{className:`text-foreground-subtle italic`,children:`—`})}),C(`td`,{className:`px-3 py-1.5 text-foreground-subtle`,children:t.locations.join(`, `)}),C(`td`,{className:`px-3 py-1.5 text-foreground text-right tabular-nums`,children:B(t.sizeBytes)}),C(`td`,{className:`px-3 py-1.5`,children:v(`div`,{className:`flex items-center justify-end gap-1`,children:[v(`button`,{onClick:()=>{b(t)},disabled:m===t.id,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-foreground-subtle hover:text-foreground hover:bg-primary/10 disabled:opacity-50`,title:`Download archive`,children:[m===t.id?C(R,{className:`h-3 w-3 animate-spin`}):C(E,{className:`h-3 w-3`}),`Download`]}),n&&r&&v(`button`,{onClick:()=>r({destinationId:e,archiveId:t.id}),className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-primary hover:bg-primary/10`,title:`Restore from this archive`,children:[C(M,{className:`h-3 w-3`}),`Restore`]}),C(`button`,{onClick:()=>{f(t)},disabled:d.isPending,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-danger hover:bg-danger/10 disabled:opacity-50`,title:`Delete archive`,children:d.isPending?C(R,{className:`h-3 w-3 animate-spin`}):C(L,{className:`h-3 w-3`})})]})})]},t.id))})]})})}function q(e,t){return`/api/backup/download/${encodeURIComponent(e)}/${encodeURIComponent(t)}`}function J(e){return new Date(e).toLocaleString(void 0,{day:`2-digit`,month:`short`,year:`numeric`,hour:`2-digit`,minute:`2-digit`})}b();var Y=[{id:`manual`,label:`Manual only`,cron:``},{id:`hourly`,label:`Every hour`,cron:`0 * * * *`,description:`On the hour`},{id:`every-3h`,label:`Every 3 hours`,cron:`0 */3 * * *`,description:`00:00, 03:00, 06:00, 09:00 …`},{id:`every-6h`,label:`Every 6 hours`,cron:`0 */6 * * *`,description:`00:00, 06:00, 12:00, 18:00`},{id:`daily-3am`,label:`Daily at 03:00`,cron:`0 3 * * *`,description:`Every night at 3 AM`},{id:`weekly-sun`,label:`Weekly Sunday 03:00`,cron:`0 3 * * 0`,description:`Sunday morning at 3 AM`}];function X(e){let t=e.trim();for(let e of Y)if(e.cron===t)return e.id;return`custom`}function Z({value:e,onChange:t,previewCount:n=5,disabled:i=!1}){let a=X(e),[o,s]=_(a===`custom`);w(()=>{a!==`custom`&&s(!1)},[a]);let c=ae(e,250),l=r({cron:c,count:n},{enabled:c.trim().length>0}),u=l.data??null,d=e=>{s(!1),t(e.cron)},f=o||a===`custom`;return v(`div`,{className:`space-y-3`,children:[v(`div`,{className:`space-y-1`,children:[C(`div`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Schedule preset`}),v(`div`,{className:`flex flex-wrap gap-1.5`,children:[Y.map(e=>C(`button`,{type:`button`,onClick:()=>d(e),disabled:i,className:`rounded border px-2 py-1 text-[11px] transition-colors disabled:opacity-50 `+(!o&&a===e.id?`border-primary bg-primary/10 text-primary`:`border-border bg-background text-foreground-subtle hover:bg-primary/5 hover:text-foreground`),title:e.description??e.label,children:e.label},e.id)),C(`button`,{type:`button`,onClick:()=>{s(!0),e.trim().length===0&&t(`0 3 * * *`)},disabled:i,className:`rounded border px-2 py-1 text-[11px] transition-colors disabled:opacity-50 `+(f?`border-primary bg-primary/10 text-primary`:`border-border bg-background text-foreground-subtle hover:bg-primary/5 hover:text-foreground`),children:`Custom…`})]})]}),f&&v(`div`,{className:`space-y-1`,children:[C(`div`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Cron expression (5-field POSIX)`}),C(`input`,{type:`text`,value:e,onChange:e=>t(e.target.value),disabled:i,placeholder:`0 3 * * *`,spellCheck:!1,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs font-mono text-foreground placeholder:text-foreground-subtle focus:outline-none focus:ring-1 focus:ring-primary`}),v(`p`,{className:`text-[10px] text-foreground-subtle`,children:[`Format: `,C(`span`,{className:`font-mono`,children:`minute hour day-of-month month day-of-week`}),` · all times server-local`]})]}),C(re,{cron:c,preview:u,loading:l.isFetching})]})}function re({cron:e,preview:t,loading:n}){return n&&t===null?v(`div`,{className:`flex items-center gap-2 rounded border border-border bg-background/40 px-3 py-2 text-[11px] text-foreground-subtle`,children:[C(R,{className:`h-3 w-3 animate-spin`}),`Validating…`]}):t===null?null:t.ok?t.nextRuns.length===0?C(`div`,{className:`rounded border border-border bg-background/40 px-3 py-2 text-[11px] text-foreground-subtle`,children:`No future runs match this expression.`}):v(`div`,{className:`space-y-1`,children:[C(`div`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Next runs`}),C(`ul`,{className:`rounded border border-border bg-background/40 divide-y divide-border`,children:t.nextRuns.map((e,t)=>v(`li`,{className:`flex items-center justify-between px-3 py-1.5 text-[11px]`,children:[C(`span`,{className:`text-foreground tabular-nums`,children:new Date(e).toLocaleString()}),C(`span`,{className:`text-foreground-subtle text-[10px] tabular-nums`,children:ie(e)})]},`${e}-${t}`))})]}):C(`div`,{className:`rounded border border-danger/40 bg-danger/10 px-3 py-2 text-[11px] text-danger`,children:t.error??`Invalid cron expression`})}function ie(e){let t=e-Date.now();if(t<=0)return`now`;let n=Math.floor(t/1e3);if(n<60)return`in ${n}s`;let r=Math.floor(n/60);if(r<60)return`in ${r}m`;let i=Math.floor(r/60);return i<24?`in ${i}h`:`in ${Math.floor(i/24)}d`}function ae(e,t){let[n,r]=_(e),i=y(()=>e,[e]);return w(()=>{let e=setTimeout(()=>r(i),t);return()=>clearTimeout(e)},[i,t]),n}b();var oe=[[`backup`,`listDestinations`]];function se({onCreateAt:t,onOpenRestoreWizard:n}){let{data:r,isLoading:i,isError:a}=e(),o=r??[],[s,c]=_(null),l=e=>{c(t=>t===e?null:e)},u=fe();return i?C(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading destinations…`}):a?C(`div`,{className:`text-xs text-danger`,children:`Failed to load destinations`}):o.length===0?C(`div`,{className:`rounded-lg border border-border bg-surface px-4 py-8 text-center`,children:C(`p`,{className:`text-xs text-foreground-subtle`,children:"No `backups`-typed storage locations registered. Add one in Settings → Storage to begin."})}):C(`div`,{className:`rounded-lg border border-border bg-surface overflow-x-auto`,children:v(`table`,{className:`w-full text-xs min-w-[720px]`,children:[C(`thead`,{children:v(`tr`,{className:`text-foreground-subtle border-b border-border bg-background/40`,children:[C(`th`,{className:`text-left px-3 py-2 font-medium w-6`}),C(`th`,{className:`text-left px-3 py-2 font-medium`,children:`Destination`}),C(`th`,{className:`text-left px-3 py-2 font-medium w-20`,children:`Enabled`}),C(`th`,{className:`text-left px-3 py-2 font-medium w-28`,children:`Retention`}),C(`th`,{className:`text-left px-3 py-2 font-medium w-56`,children:`Schedule`}),C(`th`,{className:`text-left px-3 py-2 font-medium w-44`,children:`Last success`}),C(`th`,{className:`text-right px-3 py-2 font-medium w-44`,children:`Actions`})]})}),C(`tbody`,{children:o.map(e=>{let r=u.get(e.id);return C(ce,{row:e,isOpen:s===e.id,onToggle:()=>l(e.id),onCreateAt:t,liveLastSuccessAt:r?.at,liveLastSuccessSizeBytes:r?.sizeBytes,...n?{onOpenRestoreWizard:n}:{}},e.id)})})]})})}function ce({row:e,isOpen:t,onToggle:r,onCreateAt:i,onOpenRestoreWizard:a,liveLastSuccessAt:o,liveLastSuccessSizeBytes:s}){let c=S(),l=n({onSuccess:()=>{c.invalidateQueries({queryKey:oe})}}),[u,d]=_(String(e.retentionCount));w(()=>{d(String(e.retentionCount))},[e.retentionCount]);let[f,p]=_(!1),m=g(t=>{l.mutate({locationId:e.id,enabled:t,retentionCount:e.retentionCount,...e.label===void 0?{}:{label:e.label},...e.cron===void 0?{}:{cron:e.cron}})},[l,e.id,e.retentionCount,e.label,e.cron]),h=g(()=>{let t=Number.parseInt(u,10);if(Number.isNaN(t)||t<1){d(String(e.retentionCount));return}t!==e.retentionCount&&l.mutate({locationId:e.id,enabled:e.enabled,retentionCount:t,...e.label===void 0?{}:{label:e.label},...e.cron===void 0?{}:{cron:e.cron}})},[l,u,e.id,e.enabled,e.retentionCount,e.label,e.cron]),y=g(t=>{l.mutate({locationId:e.id,enabled:e.enabled,retentionCount:e.retentionCount,...e.label===void 0?{}:{label:e.label},cron:t},{onSuccess:()=>{p(!1)}})},[l,e.id,e.enabled,e.retentionCount,e.label]);return v(x,{children:[v(`tr`,{className:`border-t border-border first:border-t-0 hover:bg-primary/5`,children:[C(`td`,{className:`px-2 py-2`,children:C(`button`,{onClick:r,className:`inline-flex items-center justify-center rounded p-1 text-foreground-subtle hover:bg-primary/10 hover:text-foreground`,title:t?`Hide archives`:`Show archives`,children:C(t?F:P,{className:`h-3.5 w-3.5`})})}),C(`td`,{className:`px-3 py-2`,children:v(`button`,{onClick:r,className:`text-left hover:underline focus:outline-none`,title:`View archives`,children:[C(`div`,{className:`text-foreground font-medium`,children:e.displayName}),v(`div`,{className:`flex items-center gap-1.5 mt-0.5`,children:[C(`span`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle bg-background border border-border rounded px-1.5 py-0.5`,children:e.kind}),C(`span`,{className:`text-[10px] text-foreground-subtle font-mono`,children:e.id})]})]})}),C(`td`,{className:`px-3 py-2`,children:C(`label`,{className:`inline-flex items-center cursor-pointer`,children:C(`input`,{type:`checkbox`,className:`accent-primary`,checked:e.enabled,disabled:l.isPending,onChange:e=>m(e.target.checked)})})}),C(`td`,{className:`px-3 py-2`,children:C(`input`,{type:`number`,min:1,max:1e3,value:u,disabled:l.isPending,onChange:e=>d(e.target.value),onBlur:h,onKeyDown:t=>{t.key===`Enter`&&t.target.blur(),t.key===`Escape`&&d(String(e.retentionCount))},className:`w-16 rounded border border-border bg-background px-2 py-1 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`})}),C(`td`,{className:`px-3 py-2`,children:C(le,{cron:e.cron,nextRunAt:e.nextRunAt,onEdit:()=>p(!0),disabled:l.isPending})}),C(`td`,{className:`px-3 py-2 text-foreground-subtle`,children:(()=>{let t=pe(o,e.lastSuccessAt),n=t===o?s:e.lastSuccessSizeBytes;return t===void 0?C(`span`,{className:`italic`,children:`Never`}):C(me,{at:t,sizeBytes:n})})()}),C(`td`,{className:`px-3 py-2`,children:C(`div`,{className:`flex items-center justify-end gap-1.5`,children:e.triggerSupported&&v(`button`,{onClick:()=>i(e),className:`inline-flex items-center gap-1 rounded bg-primary px-2 py-1 text-[11px] font-medium text-primary-foreground hover:bg-primary/90`,children:[C(j,{className:`h-3 w-3`}),`Create here`]})})})]}),t&&C(`tr`,{className:`border-t border-border bg-background/30`,children:C(`td`,{colSpan:7,className:`px-4 py-3`,children:C(K,{destinationId:e.id,restoreSupported:e.restoreSupported,...a?{onOpenRestoreWizard:a}:{}})})}),f&&C(de,{destinationName:e.displayName,currentCron:e.cron??``,onSave:y,onClose:()=>p(!1),saving:l.isPending,saveError:l.error instanceof Error?l.error.message:null})]})}function le({cron:e,nextRunAt:t,onEdit:n,disabled:r}){let i=typeof e==`string`&&e.trim().length>0;return v(`button`,{type:`button`,onClick:n,disabled:r,className:`group flex flex-col items-start gap-0.5 text-left rounded px-1.5 py-1 -mx-1.5 hover:bg-primary/5 disabled:opacity-50`,title:`Edit schedule`,children:[v(`div`,{className:`flex items-center gap-1.5`,children:[C(ne,{className:`h-3 w-3 text-foreground-subtle group-hover:text-foreground`}),C(`span`,{className:i?`font-mono text-foreground`:`italic text-foreground-subtle`,children:i?e:`Manual`})]}),i&&t!==void 0&&v(`span`,{className:`text-[10px] text-foreground-subtle tabular-nums`,children:[`next `,ue(t)]})]})}function ue(e){let t=e-Date.now();if(t<=0)return`imminent`;let n=Math.floor(t/1e3);if(n<60)return`in ${n}s`;let r=Math.floor(n/60);if(r<60)return`in ${r}m`;let i=Math.floor(r/60);return i<24?`in ${i}h`:`in ${Math.floor(i/24)}d`}function de({destinationName:e,currentCron:t,onSave:n,onClose:r,saving:i,saveError:a}){let[o,s]=_(t);return C(`tr`,{children:C(`td`,{colSpan:7,className:`p-0`,children:C(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm`,onClick:r,children:v(`div`,{className:`w-full max-w-lg rounded-xl border border-border bg-surface shadow-2xl`,onClick:e=>e.stopPropagation(),children:[v(`div`,{className:`flex items-start justify-between border-b border-border px-4 py-3`,children:[v(`div`,{className:`space-y-0.5`,children:[C(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Schedule`}),v(`p`,{className:`text-xs text-foreground-subtle`,children:[`→ `,e]})]}),C(`button`,{onClick:r,className:`text-foreground-subtle hover:text-foreground`,title:`Close`,children:C(I,{className:`h-4 w-4`})})]}),v(`div`,{className:`p-4`,children:[C(Z,{value:o,onChange:s,disabled:i}),a!==null&&C(`div`,{className:`mt-3 rounded border border-danger/40 bg-danger/10 px-3 py-2 text-[11px] text-danger`,children:a})]}),v(`div`,{className:`flex justify-end gap-2 border-t border-border px-4 py-3`,children:[C(`button`,{onClick:r,disabled:i,className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground disabled:opacity-50`,children:`Cancel`}),C(`button`,{onClick:()=>n(o.trim()),disabled:i||o.trim()===t.trim(),className:`inline-flex items-center gap-1.5 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:i?`Saving…`:`Save`})]})]})})})})}function fe(){let{map:e}=h(T.BackupCompleted,e=>e.destinationId);return y(()=>{let t=new Map;for(let[n,r]of e)t.set(n,{at:Date.now(),sizeBytes:r.sizeMB*1024*1024});return t},[e])}function pe(e,t){return e===void 0?t:t===void 0||e>t?e:t}function me({at:e,sizeBytes:t}){let n=he(e);return v(`span`,{title:y(()=>new Date(e).toLocaleString(),[e]),className:`text-foreground tabular-nums`,children:[n,t!==void 0&&v(`span`,{className:`ml-1 text-foreground-subtle`,children:[`· `,B(t)]})]})}function he(e){let[,t]=_(0);return w(()=>{let e=setInterval(()=>t(e=>e+1),3e4);return()=>clearInterval(e)},[]),ge(e)}function ge(e){let t=Math.max(0,Date.now()-e),n=Math.floor(t/1e3);if(n<60)return`${n}s ago`;let r=Math.floor(n/60);if(r<60)return`${r}m ago`;let i=Math.floor(r/60);if(i<24)return`${i}h ago`;let a=Math.floor(i/24);if(a<30)return`${a}d ago`;let o=Math.floor(a/30);return o<12?`${o}mo ago`:`${Math.floor(a/365)}y ago`}b();var _e=[[`backup`,`list`]];function ve({initialDestinationId:t,initialArchiveId:n,onClose:r,onScheduled:o}){let s=S(),[c,l]=_(t&&n?2:1),[u,d]=_(t),[f,m]=_(n),[h,g]=_(new Set),{data:b}=e(),x=b??[],{data:T,isLoading:E}=p({destinationId:u??``},{enabled:!!u}),D=T??[];w(()=>{if(u!==void 0)return;let e=x.filter(e=>e.restoreSupported);e.length===1&&d(e[0].id)},[u,x]);let{data:O}=a({destinationId:u??``,backupId:f??``},{enabled:!!u&&!!f}),k=y(()=>O?.locations??[],[O]);w(()=>{k.length!==0&&g(e=>e.size===0?new Set(k):e)},[k]);let A=i({onSuccess:()=>{s.invalidateQueries({queryKey:_e}),o(),r()}}),j=e=>{g(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},N=!!u&&!!f,P=h.size>0,F=N&&P&&!A.isPending,L=()=>{!u||!f||A.mutate({destinationId:u,backupId:f,locations:[...h]})};return C(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm`,onClick:r,children:v(`div`,{className:`w-full max-w-md rounded-xl border border-border bg-surface shadow-2xl`,onClick:e=>e.stopPropagation(),children:[v(`div`,{className:`flex items-start justify-between border-b border-border px-4 py-3`,children:[v(`div`,{className:`space-y-0.5`,children:[C(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Restore Backup`}),v(`p`,{className:`text-xs text-foreground-subtle`,children:[`Step `,c,` of 3 —`,` `,c===1?`pick source`:c===2?`pick locations`:`confirm`]})]}),C(`button`,{onClick:r,className:`text-foreground-subtle hover:text-foreground`,children:C(I,{className:`h-4 w-4`})})]}),c===1&&C(ye,{destinations:x,destinationId:u,onPickDestination:e=>{d(e),m(void 0),g(new Set)},archives:D,archivesLoading:E,archiveId:f,onPickArchive:m}),c===2&&C(be,{locations:k,picked:h,onToggle:j}),c===3&&C(xe,{destinationName:x.find(e=>e.id===u)?.displayName??u??``,archive:D.find(e=>e.id===f),picked:[...h]}),v(`div`,{className:`flex justify-between gap-2 border-t border-border px-4 py-3`,children:[C(`div`,{children:c>1&&v(`button`,{onClick:()=>l(e=>e===3?2:1),className:`inline-flex items-center gap-1 rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:[C(ee,{className:`h-3 w-3`}),`Back`]})}),v(`div`,{className:`flex items-center gap-2`,children:[C(`button`,{onClick:r,className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:`Cancel`}),c<3?v(`button`,{disabled:c===1&&!N||c===2&&!P,onClick:()=>l(e=>e===1?2:3),className:`inline-flex items-center gap-1 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:[`Next`,C(te,{className:`h-3 w-3`})]}):v(`button`,{onClick:L,disabled:!F,className:`inline-flex items-center gap-1.5 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:[A.isPending?C(R,{className:`h-3.5 w-3.5 animate-spin`}):C(M,{className:`h-3.5 w-3.5`}),`Schedule Restore`]})]})]})]})})}function ye({destinations:e,destinationId:t,onPickDestination:n,archives:r,archivesLoading:i,archiveId:a,onPickArchive:o}){let s=e.filter(e=>e.restoreSupported);return v(`div`,{className:`p-4 space-y-3`,children:[v(`div`,{className:`space-y-1.5`,children:[C(`label`,{className:`text-[10px] text-foreground-subtle uppercase tracking-wide`,children:`Destination`}),v(`select`,{value:t??``,onChange:e=>n(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`,children:[C(`option`,{value:``,disabled:!0,children:`Select destination…`}),s.map(e=>v(`option`,{value:e.id,children:[e.displayName,` (`,e.kind,`)`]},e.id))]})]}),v(`div`,{className:`space-y-1.5`,children:[C(`label`,{className:`text-[10px] text-foreground-subtle uppercase tracking-wide`,children:`Archive`}),!t&&C(`div`,{className:`text-xs text-foreground-subtle italic`,children:`Pick a destination first.`}),t&&i&&C(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Reading archives…`}),t&&!i&&r.length===0&&C(`div`,{className:`text-xs text-foreground-subtle italic`,children:`No archives available at this destination.`}),t&&r.length>0&&C(`div`,{className:`rounded border border-border bg-background divide-y divide-border max-h-64 overflow-y-auto`,children:r.map(e=>{let t=a===e.id;return v(`label`,{className:`flex items-center justify-between px-3 py-2 text-xs cursor-pointer ${t?`bg-primary/10`:`hover:bg-primary/5`}`,children:[v(`div`,{className:`flex items-center gap-2`,children:[C(`input`,{type:`radio`,name:`archive`,checked:t,onChange:()=>o(e.id),className:`accent-primary`}),v(`div`,{children:[C(`div`,{className:`font-medium text-foreground`,children:e.label??e.id}),C(`div`,{className:`text-[10px] text-foreground-subtle`,children:new Date(e.createdAt).toLocaleString()})]})]}),C(`span`,{className:`text-[10px] text-foreground-subtle tabular-nums`,children:B(e.sizeBytes)})]},e.id)})})]})]})}function be({locations:e,picked:t,onToggle:n}){return e.length===0?C(`div`,{className:`p-4`,children:C(`div`,{className:`text-xs text-foreground-subtle`,children:`Loading archive manifest… If this persists, the archive may predate manifests — restoring will apply everything in the tarball.`})}):v(`div`,{className:`p-4 space-y-3`,children:[C(`div`,{className:`rounded border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-[11px] text-amber-700 dark:text-amber-300`,children:`Selected entries will overwrite live data on the next server restart. Unchecked entries stay current.`}),v(`div`,{className:`space-y-1.5`,children:[C(`label`,{className:`text-[10px] text-foreground-subtle uppercase tracking-wide`,children:`Apply`}),C(`div`,{className:`rounded border border-border bg-background divide-y divide-border max-h-64 overflow-y-auto`,children:e.map(e=>v(`label`,{className:`flex items-center gap-2 px-3 py-2 text-xs hover:bg-primary/5 cursor-pointer`,children:[C(`input`,{type:`checkbox`,checked:t.has(e),onChange:()=>n(e),className:`accent-primary`}),C(`span`,{className:`font-mono text-foreground`,children:e}),C(`span`,{className:`ml-auto text-[10px] text-foreground-subtle`,children:Ce(e)})]},e))})]})]})}function xe({destinationName:e,archive:t,picked:n}){return v(`div`,{className:`p-4 space-y-3 text-xs`,children:[C(`div`,{className:`rounded border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-amber-700 dark:text-amber-300`,children:`Restore is applied at next server boot. Active connections will drop when you restart.`}),v(`dl`,{className:`space-y-1.5`,children:[C(Q,{term:`Destination`,value:e}),C(Q,{term:`Archive`,value:t?.label??t?.id??`—`}),t&&C(Q,{term:`Created`,value:`${new Date(t.createdAt).toLocaleString()} · ${B(t.sizeBytes)}`}),C(Q,{term:`Locations`,value:n.length>0?n.join(`, `):`— (full archive)`})]})]})}function Q({term:e,value:t}){return v(`div`,{className:`flex justify-between gap-3`,children:[C(`dt`,{className:`text-foreground-subtle`,children:e}),C(`dd`,{className:`text-foreground font-mono text-right truncate`,children:t})]})}var Se={db:`Database`,addons:`Addon configs`,"addons-data":`Addon data`,tls:`TLS certificates`,cache:`Cache`,data:`Top-level data`};function Ce(e){return Se[e]??``}b();var $=[[`backup`,`list`]],we=[[`backup`,`listLocations`]];function Te(){let e=S(),t=s(),{data:n}=f(),r=o({onSuccess:()=>{e.invalidateQueries({queryKey:$}),e.invalidateQueries({queryKey:[[`backup`,`listDestinations`]]}),e.invalidateQueries({queryKey:[[`backup`,`listArchives`]]})}}),i=l(),[a,c]=_(null),[u,d]=_(null),[p,m]=_(!1),[h,g]=_(!1),[y,b]=_(!1),x=async()=>{await t({title:`Restart server now?`,message:`Active connections will drop and the apply-backup hook will run before boot.`,confirmLabel:`Restart`,variant:`warning`})&&i.mutate({confirm:!0})};return v(z,{children:[v(`div`,{className:`flex items-center justify-end gap-2 flex-wrap`,children:[v(`button`,{onClick:()=>m(!0),className:`inline-flex items-center gap-1.5 rounded-lg bg-surface border border-border px-3 py-1.5 text-xs font-medium text-foreground hover:bg-primary/5 hover:border-primary/30`,children:[C(M,{className:`h-3.5 w-3.5`}),`Restore…`]}),v(`button`,{onClick:()=>b(!0),className:`inline-flex items-center gap-1.5 rounded-lg bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90`,children:[C(j,{className:`h-3.5 w-3.5`}),`Add destination`]})]}),h&&C(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2.5 text-xs text-amber-700 dark:text-amber-300`,children:v(`div`,{className:`flex items-center justify-between gap-3`,children:[v(`div`,{className:`flex items-center gap-2`,children:[C(M,{className:`h-3.5 w-3.5`}),C(`span`,{children:`Restore scheduled. Restart the server to apply.`})]}),v(`button`,{onClick:()=>{x()},disabled:i.isPending,className:`inline-flex items-center gap-1.5 rounded bg-amber-500/20 px-2 py-1 font-medium text-amber-800 dark:text-amber-200 hover:bg-amber-500/30 disabled:opacity-50`,children:[i.isPending?C(R,{className:`h-3.5 w-3.5 animate-spin`}):C(M,{className:`h-3.5 w-3.5`}),`Restart Now`]})]})}),C(se,{onCreateAt:e=>c(e),onOpenRestoreWizard:e=>d(e)}),a&&C(Ee,{destination:a,locations:n??[],onClose:()=>c(null),onSubmit:(t,n)=>{r.mutate({destinations:[a.id],locations:t,label:n||void 0},{onSuccess:()=>{c(null),e.invalidateQueries({queryKey:we})}})},submitting:r.isPending}),(u||p)&&C(ve,{...u?{initialDestinationId:u.destinationId,initialArchiveId:u.archiveId}:{},onClose:()=>{d(null),m(!1)},onScheduled:()=>g(!0)}),y&&C(A,{initialType:`backups`,onClose:()=>b(!1),onCreated:()=>{b(!1),e.invalidateQueries({queryKey:[[`backup`,`listDestinations`]]})}})]})}function Ee({destination:e,locations:t,onClose:n,onSubmit:r,submitting:i}){let a=t.filter(e=>e.present),[o,s]=_(``),[c,l]=_(()=>new Set(a.map(e=>e.name))),u=e=>{l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};return C(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm`,onClick:n,children:v(`div`,{className:`w-full max-w-md rounded-xl border border-border bg-surface shadow-2xl`,onClick:e=>e.stopPropagation(),children:[v(`div`,{className:`flex items-start justify-between border-b border-border px-4 py-3`,children:[v(`div`,{className:`space-y-0.5`,children:[C(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Create Backup`}),v(`p`,{className:`text-xs text-foreground-subtle`,children:[`→ `,e.displayName]})]}),C(`button`,{onClick:n,className:`text-foreground-subtle hover:text-foreground`,children:C(I,{className:`h-4 w-4`})})]}),v(`div`,{className:`p-4 space-y-3`,children:[v(`div`,{className:`space-y-1`,children:[C(`label`,{className:`text-[10px] text-foreground-subtle uppercase tracking-wide`,children:`Label (optional)`}),C(`input`,{type:`text`,value:o,onChange:e=>s(e.target.value),placeholder:`pre-upgrade`,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground placeholder:text-foreground-subtle focus:outline-none focus:ring-1 focus:ring-primary`})]}),v(`div`,{className:`space-y-1.5`,children:[C(`label`,{className:`text-[10px] text-foreground-subtle uppercase tracking-wide`,children:`Include`}),v(`div`,{className:`rounded border border-border bg-background divide-y divide-border max-h-64 overflow-y-auto`,children:[a.length===0&&C(`div`,{className:`px-3 py-2 text-xs text-foreground-subtle italic`,children:`Nothing to back up.`}),a.map(e=>v(`label`,{className:`flex items-center justify-between px-3 py-2 text-xs hover:bg-primary/5 cursor-pointer`,children:[v(`div`,{className:`flex items-center gap-2`,children:[C(`input`,{type:`checkbox`,checked:c.has(e.name),onChange:()=>u(e.name),className:`accent-primary`}),C(`span`,{className:`font-mono text-foreground`,children:e.name})]}),v(`div`,{className:`text-[10px] text-foreground-subtle tabular-nums`,children:[B(e.sizeBytes),` · `,e.fileCount,` files`]})]},e.name))]})]})]}),v(`div`,{className:`flex justify-end gap-2 border-t border-border px-4 py-3`,children:[C(`button`,{onClick:n,className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:`Cancel`}),v(`button`,{onClick:()=>r(Array.from(c),o.trim()),disabled:i||c.size===0,className:`inline-flex items-center gap-1.5 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:[i?C(R,{className:`h-3.5 w-3.5 animate-spin`}):C(H,{className:`h-3.5 w-3.5`}),i?`Creating…`:`Create`]})]})]})})}function De(){return C(`div`,{className:`flex flex-col p-4`,children:C(V,{tabs:[{id:`storage`,label:`Storage`,icon:D,content:C(U,{})},{id:`backup`,label:`Backup`,icon:H,content:C(Te,{})}]})})}export{De as DataPage};