@camstack/addon-admin-ui 1.2.160 → 1.2.161

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 (113) hide show
  1. package/dist/assets/AddLocationWizard-CIBAcYT0.js +1 -0
  2. package/dist/assets/{AddonCollectionPage-BDi0kO22.js → AddonCollectionPage-DidOeHML.js} +1 -1
  3. package/dist/assets/{Addons-DckDU3mb.js → Addons-DAphv28g.js} +1 -1
  4. package/dist/assets/{AdminTabs-CveKvUPm.js → AdminTabs-BuvG675m.js} +1 -1
  5. package/dist/assets/{AiProfiles-CrGxIYmh.js → AiProfiles-D1dR_sqs.js} +1 -1
  6. package/dist/assets/{BrokerForm-CiblpYTb.js → BrokerForm-CtbBzViq.js} +1 -1
  7. package/dist/assets/{Build-BWrwcHgy.js → Build-Bbum-nbd.js} +1 -1
  8. package/dist/assets/{Capabilities-DN32LWQE.js → Capabilities-CsxF-Gn_.js} +1 -1
  9. package/dist/assets/{CapabilityBadges-IRI6JdeN.js → CapabilityBadges-DLUwjJr2.js} +1 -1
  10. package/dist/assets/{Cluster-D1TxDS2t.js → Cluster-CxCe9uzt.js} +1 -1
  11. package/dist/assets/{Data-OEdqVCtI.js → Data-BmG_RLtJ.js} +1 -1
  12. package/dist/assets/{DetectionIntelligence-fkvVLUh9.js → DetectionIntelligence-sbqjk-yr.js} +1 -1
  13. package/dist/assets/{DeviceAggregateSection-xrpkizdx.js → DeviceAggregateSection-DkMW7Y6S.js} +1 -1
  14. package/dist/assets/{DeviceDetail-pbSEj_Yy.js → DeviceDetail-BFk09QwZ.js} +1 -1
  15. package/dist/assets/{Devices-D1GSH47H.js → Devices-XZJ7r7_6.js} +1 -1
  16. package/dist/assets/{EmbedPlayerPage-B--02ZrY.js → EmbedPlayerPage-N1Oosdec.js} +1 -1
  17. package/dist/assets/{Events-BB4LciGV.js → Events-7PpoZh7-.js} +1 -1
  18. package/dist/assets/{FormBuilder-Cby6uaJs.js → FormBuilder-zSYeM7J8.js} +1 -1
  19. package/dist/assets/{Identity-B7SGwMLS.js → Identity-DZjt_Wrn.js} +1 -1
  20. package/dist/assets/{IntegrationDetail-s6-Uw4EY.js → IntegrationDetail-UUegoTAF.js} +1 -1
  21. package/dist/assets/{Integrations-Bpx3Po3K.js → Integrations-DNbOs-De.js} +1 -1
  22. package/dist/assets/{Integrations-XdSwDFZK.js → Integrations-DgYRJOFv.js} +1 -1
  23. package/dist/assets/{Locations-Dmuf6b1k.js → Locations-BTelaF3N.js} +1 -1
  24. package/dist/assets/{Logs-FAZBoc5m.js → Logs-_-ID7Fdl.js} +1 -1
  25. package/dist/assets/{MotionZonesSettings-BxotgjxV.js → MotionZonesSettings-hZLAwZ2W.js} +1 -1
  26. package/dist/assets/{MyAccess-9ZlxXVSn.js → MyAccess-dn3KK8AG.js} +1 -1
  27. package/dist/assets/{Network-CRwpfMJ8.js → Network-BupEsuu1.js} +1 -1
  28. package/dist/assets/{NodeAddonsSettingsPanel-CYRQHBjB.js → NodeAddonsSettingsPanel-ATtf2WFw.js} +1 -1
  29. package/dist/assets/{NodeInferenceDevices-DkVG64vb.js → NodeInferenceDevices-BjaoWmuP.js} +1 -1
  30. package/dist/assets/{Notifications-CqRzGcZM.js → Notifications-W8uDm8ag.js} +1 -1
  31. package/dist/assets/{Pipeline-ktAba7H4.js → Pipeline-CHn2KqD1.js} +1 -1
  32. package/dist/assets/{Plates-CULIFHR_.js → Plates-tj2bL1rV.js} +1 -1
  33. package/dist/assets/{PrivacyMaskSettings-CqseimbL.js → PrivacyMaskSettings-B8FJYDAv.js} +1 -1
  34. package/dist/assets/{ProviderIcon-yQVhpU8Z.js → ProviderIcon-CAViJ2Dr.js} +1 -1
  35. package/dist/assets/Recordings-tfYyBWxI.js +1 -0
  36. package/dist/assets/{ScanNetworkModal-DxjQClUC.js → ScanNetworkModal-XNhTZKaX.js} +1 -1
  37. package/dist/assets/{SceneMonitorEditor-DkCdm2Tr.js → SceneMonitorEditor-CjHRTg_l.js} +1 -1
  38. package/dist/assets/{Scenes-BJoeFE5N.js → Scenes-C8wxTMOt.js} +1 -1
  39. package/dist/assets/{Settings-D27ia0Ys.js → Settings-CkbRyWnS.js} +1 -1
  40. package/dist/assets/{Showroom-DXB4IWSk.js → Showroom-sQREXKKD.js} +1 -1
  41. package/dist/assets/{StorageLocationsPanel-tbX04-HC.js → StorageLocationsPanel-BCrJ-KE-.js} +1 -1
  42. package/dist/assets/{Terminal-vBGGGzEA.js → Terminal-YqbXnKWi.js} +1 -1
  43. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-BefwEKW7.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-BcpL5OWo.js} +1 -1
  44. package/dist/assets/{authed-media-DEMM8rN-.js → authed-media-C_PsHBLq.js} +1 -1
  45. package/dist/assets/{bell-off-O3iPYBLt.js → bell-off-C1SI77dR.js} +1 -1
  46. package/dist/assets/{bell-ring-BGot39PW.js → bell-ring-CEOIAQ_I.js} +1 -1
  47. package/dist/assets/{boxes-Dl8zd-Iy.js → boxes-BjoWl-1D.js} +1 -1
  48. package/dist/assets/circle-check-big-DYmHmeTq.js +1 -0
  49. package/dist/assets/circle-dot-DvdQwPzL.js +1 -0
  50. package/dist/assets/circle-slash-CC_EyKGU.js +1 -0
  51. package/dist/assets/{circle-x-dNLn8ufL.js → circle-x-CdNO4ICk.js} +1 -1
  52. package/dist/assets/clock-c2VrWbaA.js +1 -0
  53. package/dist/assets/{copy-BokFLxVN.js → copy-zlgjIyja.js} +1 -1
  54. package/dist/assets/{debounced-invalidate-u8WtysZY.js → debounced-invalidate-zayf7SMn.js} +1 -1
  55. package/dist/assets/{dist-fG-yHcpK.js → dist-Cw5oxpBU.js} +1 -1
  56. package/dist/assets/dist-DIx7N8Rl.js +349 -0
  57. package/dist/assets/{download-CuisOyZ6.js → download-LIPHDFGv.js} +1 -1
  58. package/dist/assets/{face-bbox-KhMSbYvQ.js → face-bbox-CAtHizcF.js} +1 -1
  59. package/dist/assets/{flame-DuR_10OR.js → flame-D_ZDAfQ6.js} +1 -1
  60. package/dist/assets/{hard-drive-B07Oww46.js → hard-drive-BEeZwDeK.js} +1 -1
  61. package/dist/assets/{hard-drive-download-Ddof9L_G.js → hard-drive-download-DczrA-Ph.js} +1 -1
  62. package/dist/assets/{hostInit-akHYWpNQ.js → hostInit-C55-jO9M.js} +1 -1
  63. package/dist/assets/{index-BklHyIal.js → index-DQCNw_qF.js} +3 -3
  64. package/dist/assets/{key-round-k1Gujee5.js → key-round-L0G7sh0Z.js} +1 -1
  65. package/dist/assets/{layers-MK6u8uVU.js → layers-BkYY4MNu.js} +1 -1
  66. package/dist/assets/{mf-entry-bootstrap-0-210c2eee.js → mf-entry-bootstrap-0-bf638123.js} +2 -2
  67. package/dist/assets/{pencil-v2P1AEH5.js → pencil-Cps28G9t.js} +1 -1
  68. package/dist/assets/play-DDyMYk4f.js +1 -0
  69. package/dist/assets/{player-overlays-CxnHC7sY.js → player-overlays-Du1iI4WG.js} +1 -1
  70. package/dist/assets/plus-BvgeGRAR.js +1 -0
  71. package/dist/assets/power-BEgQFTDk.js +1 -0
  72. package/dist/assets/{radio-R56V_r6g.js → radio-rt3AQulI.js} +1 -1
  73. package/dist/assets/{refresh-cw-CXKfzi_J.js → refresh-cw-DTN9sVzg.js} +1 -1
  74. package/dist/assets/remoteEntry-CSOuPVx0.js +1 -0
  75. package/dist/assets/rotate-ccw-Bb4xxMsL.js +1 -0
  76. package/dist/assets/rotate-cw-mNYvr-AK.js +1 -0
  77. package/dist/assets/{send-DQUJR0vc.js → send-HigTgqVo.js} +1 -1
  78. package/dist/assets/{server-CmlNUL8C.js → server-BXK4SJIE.js} +1 -1
  79. package/dist/assets/{shield-MZZGGMzf.js → shield-DX4_WDm1.js} +1 -1
  80. package/dist/assets/{shield-alert-rbSDihUT.js → shield-alert-Cg07ChHl.js} +1 -1
  81. package/dist/assets/square-BFKD6b_V.js +1 -0
  82. package/dist/assets/{square-check-big-CSlARdJs.js → square-check-big-ZG3qcTd3.js} +1 -1
  83. package/dist/assets/src-HONjyNN8.js +349 -0
  84. package/dist/assets/{src-Bx6lUScl.js → src-JHeBPIaR.js} +17 -17
  85. package/dist/assets/{undo-2-AaMxVZOq.js → undo-2-B6Jfg7mO.js} +1 -1
  86. package/dist/assets/{use-scenes-feed-BRYAkNrr.js → use-scenes-feed-C8d0V984.js} +1 -1
  87. package/dist/assets/useEventInvalidation-CXT1xiua.js +1 -0
  88. package/dist/assets/{useNodeUrlSelection-DDch3u6A.js → useNodeUrlSelection-BbnkfJaA.js} +1 -1
  89. package/dist/assets/user-round-C8ooFPmf.js +1 -0
  90. package/dist/assets/{video-B8ONQTGR.js → video-CTn28SZY.js} +1 -1
  91. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-DYGm7E8p.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-dmY2bJ_7.js} +2 -2
  92. package/dist/assets/{wifi-OmF28Vw4.js → wifi-DlsXlPzT.js} +1 -1
  93. package/dist/assets/{zap-CgfbQhJZ.js → zap-BP77MpPC.js} +1 -1
  94. package/dist/index.html +5 -5
  95. package/dist/server/addon.js +126 -128
  96. package/package.json +1 -1
  97. package/dist/assets/AddLocationWizard-DZGKTCio.js +0 -1
  98. package/dist/assets/Recordings-DeG3Hgrm.js +0 -1
  99. package/dist/assets/circle-check-big-DQPHbnu7.js +0 -1
  100. package/dist/assets/circle-dot-9gDaQtZD.js +0 -1
  101. package/dist/assets/circle-slash-DnE0R9_Q.js +0 -1
  102. package/dist/assets/clock-ClLxm7-h.js +0 -1
  103. package/dist/assets/dist-Davo3ZyC.js +0 -349
  104. package/dist/assets/play-CEY_2y9h.js +0 -1
  105. package/dist/assets/plus-D4lVENRG.js +0 -1
  106. package/dist/assets/power-BjiRWY2g.js +0 -1
  107. package/dist/assets/remoteEntry-BcjiM6Md.js +0 -1
  108. package/dist/assets/rotate-ccw-bzd2PVak.js +0 -1
  109. package/dist/assets/rotate-cw-B9URuo-5.js +0 -1
  110. package/dist/assets/square-XVm3-E9p.js +0 -1
  111. package/dist/assets/src-C-Iybm4d.js +0 -349
  112. package/dist/assets/useEventInvalidation-CuSCKAt_.js +0 -1
  113. package/dist/assets/user-round-C2qxJpN_.js +0 -1
@@ -7618,111 +7618,6 @@ var CameraSwitchGroupSchema = object({
7618
7618
  fetchedAt: number()
7619
7619
  });
7620
7620
  /**
7621
- * Per-component log CHANNELS — the gate a hot path consults, and the registry
7622
- * an addon declares its channels in.
7623
- *
7624
- * ## Two axes, deliberately separated
7625
- *
7626
- * - **DECLARATION** — which channels exist. Only the addon knows:
7627
- * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
7628
- * baichuan/handshake. A hand-wired central list rots at the first addition,
7629
- * and rots silently. So a channel is declared where it is consulted, and the
7630
- * `log-channels` capability enumerates the declarations.
7631
- * - **VALUE** — at which level, for which scope, until when. That stays ONE
7632
- * thing: the logging settings document on the `system` cap. Two authorities
7633
- * over the values is the exact defect
7634
- * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
7635
- * remove; re-introducing it from the cure side would be grotesque.
7636
- *
7637
- * Nothing in this file reads a clock, an env var or a store. The registry is
7638
- * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
7639
- * the hot path with a value somebody actually read, and by
7640
- * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
7641
- * never reaches here, so it can neither disarm an armed channel nor arm a
7642
- * disarmed one (D49).
7643
- *
7644
- * ## The canonical call shape
7645
- *
7646
- * ```ts
7647
- * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
7648
- * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
7649
- * }
7650
- * ```
7651
- *
7652
- * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
7653
- * read. Disarmed, a call site costs one load and one branch, and the `extras`
7654
- * object literal is never constructed because it lives inside the branch. It
7655
- * is the same shape already proven in production at `stream-broker.ts:1650`,
7656
- * and the same discipline `LoggingGate.allowsDestination` uses for the
7657
- * destination floor (measured at 1.93 ns/call when off).
7658
- *
7659
- * ## Why a channel emits at `info`
7660
- *
7661
- * `loki-logging.addon.ts` pins the destination default at `info` and
7662
- * `loki-destination.ts` drops everything below it, so a line emitted at
7663
- * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
7664
- * minutes. A diagnostic that cannot be read an hour later is worse than no
7665
- * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
7666
- * emits at the channel's declared level, whose schema floor is `info`.
7667
- */
7668
- /**
7669
- * The level a channel writes at once armed.
7670
- *
7671
- * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
7672
- * not leave the process for Loki, and the whole point of arming a channel is
7673
- * to read it later.
7674
- */
7675
- var LogChannelLevelSchema = _enum([
7676
- "info",
7677
- "warn",
7678
- "error"
7679
- ]);
7680
- /**
7681
- * What an addon declares about one channel. No value, no state — a
7682
- * declaration is inert.
7683
- */
7684
- var LogChannelDescriptorSchema = object({
7685
- /**
7686
- * Dotted `area.thing`, unique across the workspace. `area` is conventionally
7687
- * the addon's short name so an operator reading a channel list can tell who
7688
- * owns it without a second lookup.
7689
- */
7690
- name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
7691
- /** One sentence: what the operator will SEE after arming it. */
7692
- description: string().min(1),
7693
- /** The level its lines are emitted at. Never below `info`. */
7694
- defaultLevel: LogChannelLevelSchema,
7695
- /**
7696
- * Whether this channel can be narrowed to a camera.
7697
- *
7698
- * `true` is a PROMISE with two halves, and both must hold: the gate is
7699
- * consulted with the numeric device id, AND every line the channel admits
7700
- * carries `tags: { deviceId }` with that same numeric id. The second half is
7701
- * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
7702
- * keeps `deviceId` out of the stream labels for cardinality, so the tag in
7703
- * the body is the only way to filter.
7704
- *
7705
- * A channel whose lines carry the device only in `meta` (or not at all) is
7706
- * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
7707
- * the operator narrows to one camera, sees nothing, and concludes the code
7708
- * path was never taken.
7709
- */
7710
- perDevice: boolean()
7711
- });
7712
- /**
7713
- * An armed window over one channel, as the document hands it to a mirror.
7714
- *
7715
- * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
7716
- * expires by itself, which is the one failure a boolean cannot avoid.
7717
- */
7718
- var LogChannelWindowSchema = object({
7719
- channel: string().min(1),
7720
- /** Epoch ms the window closes at. */
7721
- armedUntilMs: number(),
7722
- /** `null` = every camera. A non-empty list narrows to those numeric ids. */
7723
- deviceIds: array(number().int()).readonly().nullable()
7724
- });
7725
- /**
7726
7621
  * Ops-log — the durable, append-only operations audit shared by the
7727
7622
  * recordings and events management surfaces.
7728
7623
  *
@@ -8668,8 +8563,11 @@ var StorageLocationTypeSchema = string().regex(/^[a-z][a-zA-Z0-9-]*$/);
8668
8563
  * `STORAGE_LOCATION_CARDINALITY` map has been removed.
8669
8564
  *
8670
8565
  * `id` is a stable namespaced string of the form `<type>:<slug>`.
8671
- * The default location for a type uses `id === <type>:default` by
8672
- * convention (the bare type ref like `'backups'` resolves to it).
8566
+ * The seed names its first instance `<type>:default` — a NAME, not a flag.
8567
+ * There is no default location any more (D383): `enabled` is the whole write
8568
+ * model, and a bare type ref resolves to the sole location of the type, or —
8569
+ * transitionally, only while legacy NULL-stamped rows exist — to the row whose
8570
+ * slug is `default`.
8673
8571
  *
8674
8572
  * `isSystem` is a legacy persisted flag. Seed still creates the initial
8675
8573
  * `<type>:default` locations; the flag is no longer a lock, a badge, or a
@@ -8690,21 +8588,20 @@ var StorageLocationSchema = object({
8690
8588
  * flag at upsert time, not here (the schema is provider-agnostic).
8691
8589
  */
8692
8590
  nodeId: string().optional(),
8693
- isDefault: boolean().default(false),
8694
8591
  isSystem: boolean().default(false),
8695
8592
  /**
8696
- * Operator opt-in: whether consumers that BALANCE across several locations
8697
- * of a type may write here. Recordings reads it today; event media and
8698
- * backups are the next consumers, which is why the flag lives on the
8699
- * location rather than in any one addon's store nothing has to be
8700
- * extended to add the next consumer.
8593
+ * THE write switch, and the only one (D383). `enabled: true` means every
8594
+ * consumer that chooses a write target for this type may write here, and all
8595
+ * enabled locations of a type are used TOGETHER; `false` means read-only
8596
+ * still read, still played back, still age-swept, still drained, never
8597
+ * written.
8701
8598
  *
8702
- * OPTIONAL, and ABSENT MEANS ACTIVE. Every location persisted before the
8703
- * flag existed reads back with no flag and keeps working exactly as before;
8704
- * that is the whole compat story, and it is why no migration ships with it.
8705
- * A newly CREATED sibling is stamped `false` by the orchestrator (creating a
8706
- * disk must not silently start writing to it); the default of a type is
8707
- * always stamped `true`.
8599
+ * OPTIONAL only for the wire: an upsert that omits it means "leave what is
8600
+ * stored" on an update and "born inert unless it is the first location of its
8601
+ * type" on a create. On a PERSISTED row absence is legacy and it means
8602
+ * enabled {@link isLocationEnabled} is the one place that says so, and the
8603
+ * orchestrator stamps every flagless row `true` once at hydrate so absence
8604
+ * stops existing rather than being re-derived on every read.
8708
8605
  */
8709
8606
  enabled: boolean().optional(),
8710
8607
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
@@ -8717,10 +8614,12 @@ var StorageLocationSchema = object({
8717
8614
  createdAt: number(),
8718
8615
  updatedAt: number()
8719
8616
  });
8617
+ object({ isDefault: boolean().optional() });
8720
8618
  /**
8721
8619
  * Reference accepted by consumer-facing `api.storage.*` calls.
8722
8620
  * Either:
8723
- * - a `StorageLocationType` (e.g. `'backups'`) → orchestrator resolves to the default of that type
8621
+ * - a `StorageLocationType` (e.g. `'backups'`) → the sole location of that type
8622
+ * (transitionally, the `<type>:default`-slugged row when several exist)
8724
8623
  * - a fully-qualified id (e.g. `'backups:nas-01'`) → addresses a specific instance
8725
8624
  *
8726
8625
  * The orchestrator's `resolveRef(ref)` handles both cases.
@@ -8896,6 +8795,111 @@ var DecoderSessionConfigSchema = object({
8896
8795
  */
8897
8796
  debug: boolean().optional()
8898
8797
  });
8798
+ /**
8799
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
8800
+ * an addon declares its channels in.
8801
+ *
8802
+ * ## Two axes, deliberately separated
8803
+ *
8804
+ * - **DECLARATION** — which channels exist. Only the addon knows:
8805
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
8806
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
8807
+ * and rots silently. So a channel is declared where it is consulted, and the
8808
+ * `log-channels` capability enumerates the declarations.
8809
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
8810
+ * thing: the logging settings document on the `system` cap. Two authorities
8811
+ * over the values is the exact defect
8812
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
8813
+ * remove; re-introducing it from the cure side would be grotesque.
8814
+ *
8815
+ * Nothing in this file reads a clock, an env var or a store. The registry is
8816
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
8817
+ * the hot path with a value somebody actually read, and by
8818
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
8819
+ * never reaches here, so it can neither disarm an armed channel nor arm a
8820
+ * disarmed one (D49).
8821
+ *
8822
+ * ## The canonical call shape
8823
+ *
8824
+ * ```ts
8825
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
8826
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
8827
+ * }
8828
+ * ```
8829
+ *
8830
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
8831
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
8832
+ * object literal is never constructed because it lives inside the branch. It
8833
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
8834
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
8835
+ * destination floor (measured at 1.93 ns/call when off).
8836
+ *
8837
+ * ## Why a channel emits at `info`
8838
+ *
8839
+ * `loki-logging.addon.ts` pins the destination default at `info` and
8840
+ * `loki-destination.ts` drops everything below it, so a line emitted at
8841
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
8842
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
8843
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
8844
+ * emits at the channel's declared level, whose schema floor is `info`.
8845
+ */
8846
+ /**
8847
+ * The level a channel writes at once armed.
8848
+ *
8849
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
8850
+ * not leave the process for Loki, and the whole point of arming a channel is
8851
+ * to read it later.
8852
+ */
8853
+ var LogChannelLevelSchema = _enum([
8854
+ "info",
8855
+ "warn",
8856
+ "error"
8857
+ ]);
8858
+ /**
8859
+ * What an addon declares about one channel. No value, no state — a
8860
+ * declaration is inert.
8861
+ */
8862
+ var LogChannelDescriptorSchema = object({
8863
+ /**
8864
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
8865
+ * the addon's short name so an operator reading a channel list can tell who
8866
+ * owns it without a second lookup.
8867
+ */
8868
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
8869
+ /** One sentence: what the operator will SEE after arming it. */
8870
+ description: string().min(1),
8871
+ /** The level its lines are emitted at. Never below `info`. */
8872
+ defaultLevel: LogChannelLevelSchema,
8873
+ /**
8874
+ * Whether this channel can be narrowed to a camera.
8875
+ *
8876
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
8877
+ * consulted with the numeric device id, AND every line the channel admits
8878
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
8879
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
8880
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
8881
+ * the body is the only way to filter.
8882
+ *
8883
+ * A channel whose lines carry the device only in `meta` (or not at all) is
8884
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
8885
+ * the operator narrows to one camera, sees nothing, and concludes the code
8886
+ * path was never taken.
8887
+ */
8888
+ perDevice: boolean()
8889
+ });
8890
+ /**
8891
+ * An armed window over one channel, as the document hands it to a mirror.
8892
+ *
8893
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
8894
+ * expires by itself, which is the one failure a boolean cannot avoid.
8895
+ */
8896
+ var LogChannelWindowSchema = object({
8897
+ channel: string().min(1),
8898
+ /** Epoch ms the window closes at. */
8899
+ armedUntilMs: number(),
8900
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
8901
+ deviceIds: array(number().int()).readonly().nullable()
8902
+ });
8899
8903
  var MODEL_FORMATS = [
8900
8904
  "onnx",
8901
8905
  "coreml",
@@ -21560,7 +21564,7 @@ method(object({
21560
21564
  downloadId: string(),
21561
21565
  offset: number(),
21562
21566
  length: number()
21563
- }), _instanceof(Uint8Array)), method(object({ downloadId: string() }), _void(), { kind: "mutation" }), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(object({ type: StorageLocationTypeSchema }), StorageLocationSchema.nullable()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(StorageLocationSchema.omit({
21567
+ }), _instanceof(Uint8Array)), method(object({ downloadId: string() }), _void(), { kind: "mutation" }), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(StorageLocationSchema.omit({
21564
21568
  createdAt: true,
21565
21569
  updatedAt: true
21566
21570
  }), StorageLocationSchema, {
@@ -34409,12 +34413,6 @@ Object.freeze({
34409
34413
  addonId: null,
34410
34414
  access: "view"
34411
34415
  },
34412
- "storage.getDefaultLocation": {
34413
- capName: "storage",
34414
- capScope: "system",
34415
- addonId: null,
34416
- access: "view"
34417
- },
34418
34416
  "storage.list": {
34419
34417
  capName: "storage",
34420
34418
  capScope: "system",
@@ -37964,7 +37962,7 @@ var AdminUIAddon = class extends BaseAddon {
37964
37962
  capability: adminUiCapability,
37965
37963
  provider: {
37966
37964
  getStaticDir: async () => ({ staticDir: resolveAdminUiDistDir() }),
37967
- getVersion: async () => ({ version: "1.2.160" })
37965
+ getVersion: async () => ({ version: "1.2.161" })
37968
37966
  }
37969
37967
  }];
37970
37968
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-admin-ui",
3
- "version": "1.2.160",
3
+ "version": "1.2.161",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Admin UI — Vite frontend build and server-side addon",
@@ -1 +0,0 @@
1
- import{I as e,Q as t,S as n,W as r,a as i,o as a,q as o,x as s,z as c}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{at as l}from"./player-overlays-CxnHC7sY.js";import{Qo as u,g as d,sn as f,us as p,wn as m}from"./src-Bx6lUScl.js";import{t as h}from"./pencil-v2P1AEH5.js";import{t as g}from"./plus-D4lVENRG.js";import{t as _}from"./power-BjiRWY2g.js";import{C as v,J as y,L as b,o as x,r as S,w as C}from"./index-BklHyIal.js";import{t as w}from"./FormBuilder-Cby6uaJs.js";var T=y(`eraser`,[[`path`,{d:`m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21`,key:`182aya`}],[`path`,{d:`M22 21H7`,key:`t4ddhn`}],[`path`,{d:`m5 11 9 9`,key:`1mo9qw`}]]);t();function E(e){return e.enabled!==!1}function D(e){return e.config.readOnly===!0}function O(e,t){return D(e)?!1:!t.some(t=>t.id!==e.id&&t.config.readOnly!==!0)}function k(e,t,n){return!(n===`single`||t.length<=1||E(e)&&t.filter(e=>E(e)).length<=1)}function A(e,t){let n={...e.config};t.readOnly===!0?n={...n,readOnly:!0}:t.readOnly===!1&&(n={...n},delete n.readOnly);let r={id:e.id,type:e.type,displayName:t.displayName??e.displayName,providerId:e.providerId,config:n,isDefault:t.isDefault??e.isDefault,isSystem:e.isSystem},i=e.nodeId===void 0?r:{...r,nodeId:e.nodeId},a=t.enabled??e.enabled;return a===void 0?i:{...i,enabled:a}}var j={eventMedia:[`events`],recordingsLow:[`low`],recordings:[`high`,`mid`]},M={eventMedia:`pipeline-analytics`,recordingsLow:`recorder`,recordings:`recorder`},N=`storage.discardLocation`,P=`storage.discardLocationStatus`,F=`storage.discardLocationCancel`;function I(e){return j[e]??null}function L(e){return M[e]??null}function R(e){return!E(e)||D(e)}function z(e,t){return I(e.type)===null||!R(e)?!1:t.some(t=>t.id!==e.id&&E(t)&&!D(t))}var B=new Set([`idle`,`scanning`,`wiping-fs`,`wiping-db`,`cascading`,`complete`,`cancelled`,`error`]);function V(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function H(e){return typeof e==`string`?e:null}function U(e){if(typeof e!=`object`||!e)return null;let t=e;if(typeof t.running!=`boolean`)return null;let n=t.phase;if(typeof n!=`string`||!B.has(n))return null;let r=V(t.camerasTotal),i=V(t.camerasDone),a=V(t.foldersRemoved),o=V(t.dbRowsDeleted),s=V(t.ownersCascaded);return r===null||i===null||a===null||o===null||s===null?null:{running:t.running,locationId:H(t.locationId),jobId:H(t.jobId),phase:n,camerasTotal:r,camerasDone:i,foldersRemoved:a,dbRowsDeleted:o,ownersCascaded:s,detail:H(t.detail)??``,startedAtMs:V(t.startedAtMs),finishedAtMs:V(t.finishedAtMs),error:H(t.error)}}function W(e){if(e.phase===`complete`)return 100;if(e.phase===`cancelled`||e.phase===`error`||e.phase===`idle`)return e.camerasTotal>0?Math.min(99,Math.round(e.camerasDone/e.camerasTotal*100)):0;if(e.camerasTotal>0){let t=e.camerasDone/e.camerasTotal*85;return e.phase===`wiping-db`?Math.min(95,Math.round(t+8)):e.phase===`cascading`?Math.min(99,Math.round(t+12)):Math.min(85,Math.round(t))}return e.phase===`scanning`?2:5}var G=2e3;function K({location:e,siblings:t}){return z(e,t)?s(q,{location:e}):null}function q({location:e}){let t=f(),r=m(),i=L(e.type),[a,l]=o(null),[u,d]=o(null),[p,h]=o(!1);if(c(()=>{if(i===null)return;let e=!1,t=async()=>{try{let t=await r.mutateAsync({addonId:i,action:P,input:{}});if(e)return;l(U(t))}catch{}};t();let n=setInterval(()=>void t(),G);return()=>{e=!0,clearInterval(n)}},[i,e.id]),i===null)return null;let g=a!==null&&a.locationId===e.id,_=g&&a.running,v=g&&a.phase!==`idle`,y=async()=>{if(await t({title:`Discard leftovers on "${e.displayName}"?`,message:`Permanently deletes leftover files and records on this location. Other locations are not affected. This cannot be undone and may take hours.`,confirmLabel:`Discard leftovers`,variant:`danger`})){d(null),h(!0);try{await r.mutateAsync({addonId:i,action:N,input:{locationId:e.id}}),l(U(await r.mutateAsync({addonId:i,action:P,input:{}})))}catch(e){d(e instanceof Error?e.message:String(e))}finally{h(!1)}}},b=async()=>{try{await r.mutateAsync({addonId:i,action:F,input:{}})}catch(e){d(e instanceof Error?e.message:String(e))}};return n(`div`,{className:`flex flex-col gap-1 min-w-[9rem] max-w-[16rem]`,children:[_?n(`button`,{type:`button`,onClick:()=>void b(),className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-danger border border-danger/40 hover:bg-danger/10`,children:[s(S,{className:`h-3 w-3`}),`Cancel`]}):n(`button`,{type:`button`,onClick:()=>void y(),disabled:p,title:`Permanently delete leftover files on this location. Other locations are not affected.`,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-danger border border-danger/40 hover:bg-danger/10 disabled:opacity-50`,children:[p?s(C,{className:`h-3 w-3 animate-spin`}):s(T,{className:`h-3 w-3`}),`Discard leftovers`]}),v&&a!==null&&n(`div`,{className:`space-y-0.5`,children:[s(`div`,{className:`h-1 rounded bg-border overflow-hidden`,children:s(`div`,{className:`h-full bg-primary transition-[width] duration-300`,style:{width:`${W(a)}%`}})}),n(`p`,{className:`text-[10px] text-foreground-subtle leading-tight`,children:[a.phase,a.camerasTotal>0?` · ${a.camerasDone}/${a.camerasTotal} cam`:``,a.dbRowsDeleted>0?` · ${a.dbRowsDeleted} rows`:``,a.detail?` · ${a.detail}`:``]})]}),(u||g&&a?.error)&&s(`p`,{className:`text-[10px] text-danger leading-tight`,children:u??a?.error})]})}function J(e){return`${(e/1024**3).toFixed(e>=100*1024**3?0:1)} GB`}function Y({location:e}){let t=e.capacity;return t==null?null:n(`span`,{className:`text-[10px] text-foreground-subtle tabular-nums`,children:[J(t.availableBytes),` free of `,J(t.totalBytes)]})}function ee(e){let t=e.basePath;if(typeof t==`string`&&t.length>0)return t;let n=Object.keys(e);return n.length===0?``:n.join(`, `)}function te({location:e,onEdit:t,onDelete:r,onToggleEnabled:i,onToggleReadOnly:a,canSetReadOnly:o,canDelete:c,siblings:l=[]}){let u=ee(e.config),d=E(e),f=D(e);return n(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2 px-3 py-2 border-t border-border first:border-t-0 hover:bg-primary/5`,children:[n(`div`,{className:`flex flex-wrap items-center gap-2 min-w-0 flex-1 basis-64`,children:[s(`span`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle bg-background border border-border rounded px-1.5 py-0.5 font-mono`,children:e.providerId}),!d&&s(`span`,{className:`text-[10px] uppercase tracking-wide text-warning bg-warning/10 border border-warning/30 rounded px-1.5 py-0.5`,title:`Disabled — nothing new is written here. Existing data stays readable and is still pruned by age.`,children:`disabled`}),f&&s(`span`,{className:`text-[10px] uppercase tracking-wide text-warning bg-warning/10 border border-warning/30 rounded px-1.5 py-0.5`,title:`Drain mode — reads and age retention continue; nothing new is written here and disk-pressure eviction skips it`,children:`read-only`}),n(`div`,{className:`min-w-0`,children:[s(`div`,{className:`text-xs font-medium text-foreground truncate`,children:e.displayName}),n(`div`,{className:`flex flex-wrap items-center gap-x-2`,children:[u&&s(`span`,{className:`text-[10px] text-foreground-subtle truncate font-mono`,children:u}),s(Y,{location:e})]})]})]}),n(`div`,{className:`flex flex-wrap items-center gap-1 shrink-0`,children:[s(K,{location:e,siblings:l}),n(`button`,{type:`button`,role:`switch`,"aria-label":`Read-only drain`,"aria-checked":f,disabled:!o&&!f,onClick:()=>{!o&&!f||a(e,!f)},title:!o&&!f?`Blocked: this is the last writable location of its type — new footage would have nowhere to go.`:f?`Read-only (drain) — reads and age retention continue; nothing new is written here and disk-pressure eviction skips it. Click to allow writes again.`:`Writable — new data and disk-pressure eviction may use this location. Click to set drain (read-only).`,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium border ${!o&&!f?`border-border text-foreground-subtle cursor-not-allowed`:f?`border-warning/40 text-warning hover:bg-warning/10`:`border-border text-foreground-subtle hover:text-foreground hover:bg-primary/10`}`,children:[s(v,{className:`h-3 w-3`}),f?`Read-only`:`Writable`]}),n(`button`,{type:`button`,role:`switch`,"aria-label":`Writes enabled`,"aria-checked":d,onClick:()=>i(e,!d),title:d?`Enabled — balancing consumers may write new data here. Click to stop new writes.`:`Disabled — no new data is written here. Existing data stays readable. Click to enable.`,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium border disabled:cursor-not-allowed ${d?`border-success/30 text-success hover:bg-success/10`:`border-warning/40 text-warning hover:bg-warning/10`}`,children:[s(_,{className:`h-3 w-3`}),d?`Enabled`:`Disabled`]}),n(`button`,{onClick:()=>t(e),className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-foreground-subtle border border-border hover:text-foreground hover:bg-primary/10`,children:[s(h,{className:`h-3 w-3`}),`Edit`]}),c&&s(`button`,{onClick:()=>r(e),className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-danger hover:bg-danger/10`,title:`Delete location`,children:s(x,{className:`h-3 w-3`})})]})]})}t();function ne({type:e,displayName:t,description:i,cardinality:a,locations:o,onAdd:c,onEdit:l,onDelete:u,onToggleEnabled:d,onToggleReadOnly:f}){let p=r(()=>{let e=[...o];return e.sort((e,t)=>{let n=e.enabled!==!1;return n===(t.enabled!==!1)?e.displayName.localeCompare(t.displayName):n?-1:1}),e},[o]);return n(`div`,{className:`rounded-lg border border-border bg-surface`,children:[n(`div`,{className:`flex items-start justify-between border-b border-border px-3 py-2`,children:[n(`div`,{className:`space-y-0.5`,children:[n(`div`,{className:`flex items-center gap-2`,children:[s(`span`,{className:`text-sm font-semibold text-foreground capitalize`,children:t}),s(`span`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle bg-background border border-border rounded px-1.5 py-0.5 font-mono`,children:e})]}),i&&s(`p`,{className:`text-[11px] text-foreground-subtle`,children:i}),a===`single`&&s(`p`,{className:`text-[10px] text-foreground-subtle italic`,children:`Single — one location per type. Edit the existing entry; it can't be split.`})]}),a===`multi`&&n(`button`,{onClick:()=>c(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:[s(g,{className:`h-3 w-3`}),`Add`]})]}),p.length===0?s(`div`,{className:`px-3 py-4 text-center text-[11px] text-foreground-subtle italic`,children:a===`multi`?`No location registered. Click "Add" to register one.`:`No location registered yet — should be auto-seeded at next boot.`}):s(`div`,{children:p.map(e=>s(te,{location:e,cardinality:a,canDelete:k(e,p,a),onEdit:l,onDelete:u,onToggleEnabled:d,onToggleReadOnly:f,canSetReadOnly:!O(e,p),siblings:p},e.id))})]})}var re=new Set([`proc`,`sys`,`dev`,`run`,`boot`,`lost+found`,`snap`,`bin`,`sbin`,`lib`,`lib32`,`lib64`,`libx32`,`usr`,`etc`,`var`,`opt`,`tmp`,`srv`,`root`,`System`,`Library`,`Applications`,`cores`,`private`]),X=[`recordings`,`data`,`mnt`,`media`,`Volumes`];function Z(e){let t=X.findIndex(t=>t===`recordings`?e.startsWith(t):e===t);return t===-1?X.length:t}function ie(e){return e.filter(e=>!e.name.startsWith(`.`)&&!re.has(e.name)).toSorted((e,t)=>{let n=Z(e.name)-Z(t.name);return n===0?e.name.localeCompare(t.name):n}).map(e=>e.path)}t();function Q({nodeId:t,value:r,onChange:i}){let a=l().trpcClient,[u,d]=o([]),[f,p]=o(r),[m,h]=o(null),[g,_]=o(null),[v,y]=o(``),b=e(async(e,n)=>{_(null);try{let r=await a.filesystemBrowse.browse.query({nodeId:t,path:e});h(r),p(r.path),n&&i(r.path)}catch(e){_(e instanceof Error?e.message:`browse failed`)}},[a,t,i]);c(()=>{p(r),(async()=>{let e=await a.filesystemBrowse.browse.query({nodeId:t,path:`/`}).then(e=>e).catch(()=>null);if(e){d(ie(e.entries)),await b(r.startsWith(`/`)?r:`/`,!1);return}try{let e=await a.filesystemBrowse.listAllowedRoots.query({nodeId:t});d(e),await b(r&&e.some(e=>r.startsWith(e))?r:e[0]??``,!1)}catch(e){d([]),h(null),_(e instanceof Error&&/not available on node/i.test(e.message)?`This node can't be browsed remotely. Enter the path manually.`:e instanceof Error?e.message:`browse unavailable`)}})()},[t]);let x=async()=>{if(!(!v.trim()||!m)){_(null);try{let e=`${m.path.replace(/\/+$/,``)}/${v.trim()}`;await a.filesystemBrowse.createDir.mutate({nodeId:t,path:e}),y(``),await b(m.path,!0)}catch(e){_(e instanceof Error?e.message:`create failed`)}}},S=e=>`${(e/1e9).toFixed(1)} GB`;return n(`div`,{className:`space-y-2 rounded border border-border p-2`,children:[s(`div`,{className:`flex flex-wrap gap-1`,children:u.map(e=>s(`button`,{onClick:()=>void b(e,!0),className:`rounded border border-border px-2 py-0.5 text-[10px] font-mono hover:border-primary/40`,children:e},e))}),s(`input`,{value:f,onChange:e=>{p(e.target.value),i(e.target.value)},placeholder:`/absolute/path`,className:`w-full rounded border border-border bg-background px-2 py-1 text-[11px] font-mono`}),m&&n(`div`,{className:`text-[10px] text-foreground-subtle`,children:[S(m.freeBytes),` free / `,S(m.totalBytes)]}),s(`div`,{className:`max-h-40 space-y-0.5 overflow-y-auto`,children:m?.entries.map(e=>n(`button`,{onClick:()=>void b(e.path,!0),className:`block w-full truncate rounded px-2 py-1 text-left text-xs hover:bg-primary/5`,children:[`📁 `,e.name]},e.path))}),n(`div`,{className:`flex gap-1`,children:[s(`input`,{value:v,onChange:e=>y(e.target.value),placeholder:`new folder`,className:`flex-1 rounded border border-border bg-background px-2 py-1 text-xs`}),s(`button`,{onClick:()=>void x(),className:`rounded border border-border px-2 py-1 text-xs hover:border-primary/40`,children:`Create`})]}),g&&s(`div`,{className:`text-[10px] text-red-400`,children:g})]})}t();function ae({location:e,onClose:t,onSaved:c}){let f=a(),m=l().trpcClient,[h,g]=o({...e.config}),[_,v]=o(e.displayName),[y,b]=o(null),[x,T]=o(!1),E=u(),D=r(()=>{let t=E.data;return Array.isArray(t)?t.find(t=>t.providerId===e.providerId)??null:null},[E.data,e.providerId]),k=p({onSuccess:()=>{f.invalidateQueries({queryKey:[[`storage`,`listLocations`]]}),c()}}),A=D?.shouldSaveDiskSpace===!0,j=D?.nodeLocal===!0,[M,N]=o(typeof e.nodeId==`string`?e.nodeId:`hub`),P=typeof h.basePath==`string`?h.basePath:``,F=e=>g(t=>({...t,basePath:e})),I=h.readOnly===!0,L=i({queryKey:[`storage`,`listLocations`,`ro-guard`],queryFn:()=>m.storage.listLocations.query({})}),R=(L.data??[]).filter(t=>t.type===e.type),z=L.data!==void 0&&O({id:e.id,config:h},R),B=e=>g(t=>{let n={...t};return delete n.readOnly,e?{...n,readOnly:!0}:n}),V=typeof h.maxUsedGb==`number`?h.maxUsedGb:``,H=e=>{let t=e.trim(),n=t===``?void 0:Number(t);g(e=>{let t={...e};return n===void 0||!Number.isFinite(n)||n<=0?delete t.maxUsedGb:t.maxUsedGb=n,t})},U=typeof h.minFreePercent==`number`?h.minFreePercent:``,W=e=>{let t=e.trim(),n=t===``?void 0:Number(t);g(e=>{let t={...e};return n===void 0||!Number.isFinite(n)?delete t.minFreePercent:t.minFreePercent=Math.min(100,Math.max(0,n)),t})},G=async()=>{T(!0),b(null);try{b(await(e=>m.storage.testConfig.query(e))({providerId:e.providerId,locationId:e.id,config:h}))}catch(e){b({ok:!1,error:e instanceof Error?e.message:String(e)})}finally{T(!1)}};return s(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm`,onClick:t,children:n(`div`,{className:`w-full max-w-md rounded-xl border border-border bg-surface shadow-2xl`,onClick:e=>e.stopPropagation(),children:[n(`div`,{className:`flex items-start justify-between border-b border-border px-4 py-3`,children:[n(`div`,{className:`space-y-0.5`,children:[n(`h2`,{className:`text-sm font-semibold text-foreground`,children:[`Edit `,e.displayName]}),n(`p`,{className:`text-xs text-foreground-subtle`,children:[s(`span`,{className:`font-mono`,children:e.id}),` ·`,` `,D?.displayName??e.providerId]})]}),s(`button`,{onClick:t,className:`text-foreground-subtle hover:text-foreground`,children:s(S,{className:`h-4 w-4`})})]}),n(`div`,{className:`p-4 space-y-3 max-h-[60vh] overflow-y-auto`,children:[n(`div`,{className:`space-y-1`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Display name`}),s(`input`,{type:`text`,value:_,onChange:e=>v(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`})]}),D&&s(w,{schema:D.configSchema,values:h,onChange:g}),n(`div`,{className:`space-y-1`,children:[n(`label`,{className:`flex items-center gap-2 text-xs ${z?`text-foreground-subtle cursor-not-allowed`:`text-foreground cursor-pointer`}`,children:[s(`input`,{type:`checkbox`,checked:I,disabled:z,onChange:e=>B(e.target.checked),className:`accent-primary`}),`Read-only (drain mode)`]}),s(`p`,{className:`text-[10px] text-foreground-subtle`,children:z?`Blocked: this is the last writable location of its type — new footage would have nowhere to go.`:`Reads and age-based retention continue; nothing new is written here and disk-pressure eviction skips it. Use it to slowly decommission a disk.`})]}),j&&n(`div`,{className:`space-y-2`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Node`}),s(d,{selectedNodeId:M,onSelect:N,alwaysShow:!0}),s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Path`}),s(Q,{nodeId:M,value:P,onChange:F})]}),A&&n(`div`,{className:`space-y-1`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Min free disk %`}),s(`input`,{type:`number`,min:0,max:100,value:U,placeholder:D?.minFreePercent==null?``:String(D.minFreePercent),onChange:e=>W(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`}),n(`p`,{className:`text-[10px] text-foreground-subtle`,children:[`When free space on this volume drops below this %, the oldest data stored here is evicted to reclaim space.`,D?.minFreePercent==null?` Empty = use the default.`:` Empty = use the default (${D.minFreePercent}%).`]}),s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Max used (GB)`}),s(`input`,{type:`number`,min:1,value:V,placeholder:`unlimited`,onChange:e=>H(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`}),s(`p`,{className:`text-[10px] text-foreground-subtle`,children:`Hard cap on the TOTAL bytes evictable data (recordings) may occupy on this location, independent of disk free space — oldest footage is evicted past it. Empty = unlimited.`})]}),!D&&!E.isLoading&&n(`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:[`Provider `,s(`code`,{className:`font-mono`,children:e.providerId}),` is no longer registered. Field schema unavailable; raw config is preserved on save.`]}),y&&s(`div`,{className:`rounded border px-3 py-2 text-[11px] ${y.ok?`border-success/30 bg-success/5 text-success`:`border-danger/30 bg-danger/5 text-danger`}`,children:y.ok?`Connection OK.`:`Test failed: ${y.error??`unknown error`}`}),k.isError&&s(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px]`,children:k.error instanceof Error?k.error.message:String(k.error)})]}),n(`div`,{className:`flex items-center justify-between gap-2 border-t border-border px-4 py-3`,children:[s(`button`,{onClick:t,className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:`Cancel`}),n(`div`,{className:`flex items-center gap-2`,children:[s(`button`,{onClick:()=>{G()},disabled:x||!D,className:`rounded border border-border px-3 py-1.5 text-xs text-foreground hover:bg-primary/10 disabled:opacity-50`,children:x?`Testing…`:`Test connection`}),n(`button`,{onClick:()=>{k.mutate({id:e.id,type:e.type,providerId:e.providerId,isDefault:e.isDefault,displayName:_.trim(),config:h,nodeId:j?M:void 0})},disabled:k.isPending||_.trim().length===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:[k.isPending?s(C,{className:`h-3.5 w-3.5 animate-spin`}):null,k.isPending?`Saving…`:`Save`]})]})]})]})})}function oe(e){let t=e.trim().toLowerCase();return t.length===0?``:t.replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}function $(e,t){let n=oe(t);return`${e}:${n.length>0?n:`default`}`}t();function se({initialType:e,onClose:t,onCreated:i}){let c=a(),f=l().trpcClient,[m,h]=o(`picker`),[g,_]=o(e),[v,y]=o(null),[x,T]=o({}),[E,D]=o(``),[O,k]=o(null),[A,j]=o(!1),[M,N]=o(`hub`),[P,F]=o(null),[I,L]=o(!1),R=e=>T(t=>({...t,basePath:e})),z=typeof x.basePath==`string`?x.basePath:``,B=u(),V=r(()=>{let e=B.data;return Array.isArray(e)?e:[]},[B.data]),H=B.isLoading,U=p({onSuccess:()=>{c.invalidateQueries({queryKey:[[`storage`,`listLocations`]]}),i()}}),W=r(()=>O!==null&&O.length>0?O:$(g,E),[g,E,O]),G=async()=>{if(v){L(!0),F(null);try{F(await(e=>f.storage.testConfig.query(e))({providerId:v.providerId,config:x}))}catch(e){F({ok:!1,error:e instanceof Error?e.message:String(e)})}finally{L(!1)}}};return s(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm`,onClick:t,children:n(`div`,{className:`w-full max-w-md rounded-xl border border-border bg-surface shadow-2xl`,onClick:e=>e.stopPropagation(),children:[n(`div`,{className:`flex items-start justify-between border-b border-border px-4 py-3`,children:[n(`div`,{className:`space-y-0.5`,children:[s(`h2`,{className:`text-sm font-semibold text-foreground`,children:{picker:`Add Location — Pick provider`,config:`Add Location — ${v?.displayName??``}`,naming:`Add Location — Name`}[m]}),n(`p`,{className:`text-xs text-foreground-subtle`,children:[`Type: `,s(`span`,{className:`font-mono`,children:g})]})]}),s(`button`,{onClick:t,className:`text-foreground-subtle hover:text-foreground`,children:s(S,{className:`h-4 w-4`})})]}),m===`picker`&&n(`div`,{className:`p-4 space-y-2`,children:[H&&s(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading providers…`}),!H&&V.length===0&&n(`div`,{className:`rounded border border-border bg-background px-3 py-4 text-center text-xs text-foreground-subtle`,children:[`No storage-provider supports type "`,g,`". Install a compatible addon (e.g.`,` `,s(`code`,{className:`font-mono`,children:`remote-storage`}),`) to enable it.`]}),V.map(e=>n(`button`,{onClick:()=>{y(e),h(`config`)},className:`flex w-full items-center gap-3 rounded-lg border border-border bg-background p-3 text-left hover:border-primary/40 hover:bg-primary/5 transition-colors`,children:[n(`div`,{className:`flex-1 min-w-0`,children:[s(`p`,{className:`text-xs font-semibold text-foreground`,children:e.displayName}),s(`p`,{className:`text-[10px] text-foreground-subtle font-mono mt-0.5 truncate`,children:e.providerId})]}),s(b,{className:`h-4 w-4 text-foreground-subtle flex-shrink-0`})]},e.providerId))]}),m===`config`&&v&&n(`div`,{className:`p-4 space-y-3 max-h-[60vh] overflow-y-auto`,children:[s(w,{schema:v.configSchema,values:x,onChange:T}),v.nodeLocal&&n(`div`,{className:`space-y-2`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Node`}),s(d,{selectedNodeId:M,onSelect:N,alwaysShow:!0}),s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Path`}),s(Q,{nodeId:M,value:z,onChange:R})]}),P&&s(`div`,{className:`rounded border px-3 py-2 text-[11px] ${P.ok?`border-success/30 bg-success/5 text-success`:`border-danger/30 bg-danger/5 text-danger`}`,children:P.ok?`Connection OK.`:`Test failed: ${P.error??`unknown error`}`}),n(`div`,{className:`flex items-center justify-between pt-1`,children:[s(`button`,{onClick:()=>h(`picker`),className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:`Back`}),n(`div`,{className:`flex items-center gap-2`,children:[s(`button`,{onClick:()=>{G()},disabled:I,className:`rounded border border-border px-3 py-1.5 text-xs text-foreground hover:bg-primary/10 disabled:opacity-50`,children:I?`Testing…`:`Test connection`}),s(`button`,{onClick:()=>h(`naming`),className:`rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90`,children:`Next`})]})]})]}),m===`naming`&&v&&n(`div`,{className:`p-4 space-y-3`,children:[n(`div`,{className:`space-y-1`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Display name`}),s(`input`,{type:`text`,value:E,onChange:e=>D(e.target.value),placeholder:`${g} on ${v.displayName}`,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`})]}),n(`div`,{className:`space-y-1`,children:[n(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:[`Id`,` `,s(`span`,{className:`lowercase tracking-normal text-foreground-subtle`,children:`— auto-derived; override if needed`})]}),s(`input`,{type:`text`,value:W,onChange:e=>k(e.target.value),placeholder:$(g,E),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground font-mono focus:outline-none focus:ring-1 focus:ring-primary`}),n(`p`,{className:`text-[10px] text-foreground-subtle`,children:[`Format: `,s(`code`,{className:`font-mono`,children:`<type>:<slug>`}),`. Lowercase letters, digits, and hyphens only.`]})]}),n(`label`,{className:`flex items-start gap-2 rounded border border-border bg-background px-3 py-2 cursor-pointer hover:bg-primary/5`,children:[s(`input`,{type:`checkbox`,checked:A,onChange:e=>j(e.target.checked),className:`accent-primary mt-0.5`}),n(`div`,{className:`space-y-0.5`,children:[s(`div`,{className:`text-xs font-medium text-foreground`,children:`Enable immediately`}),s(`div`,{className:`text-[10px] text-foreground-subtle`,children:`A disabled location receives no writes until enabled — reads and age-based retention still work, nothing new lands here. Leave this off to register the disk now and start using it later.`})]})]}),U.isError&&s(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px]`,children:U.error instanceof Error?U.error.message:String(U.error)}),n(`div`,{className:`flex items-center justify-between pt-1`,children:[s(`button`,{onClick:()=>h(`config`),className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:`Back`}),n(`div`,{className:`flex items-center gap-2`,children:[s(`button`,{onClick:()=>{_(e),y(null),T({}),D(``),k(null),j(!1),F(null),h(`picker`)},className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:`Reset`}),n(`button`,{onClick:()=>{v&&U.mutate({id:W,type:g,displayName:E.trim(),providerId:v.providerId,config:x,isDefault:!1,enabled:A,nodeId:v.nodeLocal?M:void 0})},disabled:U.isPending||E.trim().length===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:[U.isPending?s(C,{className:`h-3.5 w-3.5 animate-spin`}):null,U.isPending?`Saving…`:`Save`]})]})]})]})]})})}export{A as i,ae as n,ne as r,se as t};
@@ -1 +0,0 @@
1
- import{I as e,Q as t,S as n,W as r,b as i,o as a,q as o,x as s,z as c}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{J as l,at as u}from"./player-overlays-CxnHC7sY.js";import{$a as d,$o as f,Aa as p,Fo as m,Ho as h,Io as g,Jr as _,Lo as v,Ro as y,Sn as b,Uo as x,Vo as S,Yt as C,Zo as w,Zs as T,as as E,cs as D,ec as O,es as k,ga as A,is as j,ls as ee,nc as M,ns as te,nt as N,os as ne,rn as re,ro as ie,rs as ae,rt as oe,sn as P,ss as se,ts as ce,wa as le,ya as ue,yn as de,zo as fe}from"./src-Bx6lUScl.js";import{Gt as F}from"./src-C-Iybm4d.js";import{t as pe}from"./circle-x-dNLn8ufL.js";import{t as me}from"./download-CuisOyZ6.js";import{t as I}from"./hard-drive-B07Oww46.js";import{H as L,J as R,N as z,a as B,k as V,o as H,q as U,r as W,w as G}from"./index-BklHyIal.js";import{t as he}from"./AdminPage-CCD07UMs.js";import{i as ge}from"./authed-media-DEMM8rN-.js";import{t as _e}from"./DeviceAggregateSection-xrpkizdx.js";import{t as ve}from"./AdminTabs-CveKvUPm.js";import{t as ye}from"./StorageLocationsPanel-tbX04-HC.js";import{t as K}from"./format-size-DIxKXxtj.js";var be=R(`arrow-right-left`,[[`path`,{d:`m16 3 4 4-4 4`,key:`1x1c3m`}],[`path`,{d:`M20 7H4`,key:`zbl0bi`}],[`path`,{d:`m8 21-4-4 4-4`,key:`h9nckh`}],[`path`,{d:`M4 17h16`,key:`g4d7ey`}]]),xe=R(`scissors`,[[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M8.12 8.12 12 12`,key:`1alkpv`}],[`path`,{d:`M20 4 8.12 15.88`,key:`xgtan2`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M14.8 14.8 20 20`,key:`ptml3r`}]]),Se=R(`settings-2`,[[`path`,{d:`M20 7h-9`,key:`3s1dr2`}],[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]);t();var Ce=[{value:`all`,label:`All`},{value:`recording`,label:`Recordings`},{value:`events`,label:`Events`}],we={recording:`bg-primary/10 text-primary`,events:`bg-violet-500/10 text-violet-400`},Te={columnKey:`at`,dir:`desc`};function Ee(e){return new Date(e).toLocaleString()}function De(){let[e,t]=o(`all`),{data:a,isLoading:c,isError:l}=h({},{refetchOnWindowFocus:!1}),{data:u,isLoading:d,isError:f}=le({},{refetchOnWindowFocus:!1}),{data:p}=_({isCamera:!0,projection:`slim`}),m=r(()=>{let e=new Map;for(let t of p??[])e.set(t.id,t.name);return e},[p]),g=r(()=>{let t=[...a??[],...u??[]];return(e===`all`?t:t.filter(t=>t.domain===e)).toSorted((e,t)=>t.at-e.at)},[a,u,e]),v=r(()=>{let t=[];return l&&e!==`events`&&t.push(`Recordings`),f&&e!==`recording`&&t.push(`Events`),t},[l,f,e]),y=r(()=>[{key:`at`,header:`When`,nowrap:!0,sortValue:e=>e.at,render:e=>s(`span`,{className:`text-foreground-subtle tabular-nums`,children:Ee(e.at)})},{key:`domain`,header:`Domain`,sortValue:e=>e.domain,render:e=>s(`span`,{className:`inline-flex rounded px-1.5 py-0.5 text-[10px] font-medium ${we[e.domain]}`,children:e.domain})},{key:`op`,header:`Operation`,sortValue:e=>e.op,render:e=>s(`span`,{className:`text-foreground`,children:e.op})},{key:`reason`,header:`Reason`,sortValue:e=>e.reason,render:e=>s(`span`,{className:`text-foreground-subtle`,children:e.reason})},{key:`device`,header:`Camera`,sortValue:e=>e.deviceId===null?`cluster`:m.get(e.deviceId)??`#${String(e.deviceId)}`,render:e=>e.deviceId===null?s(`span`,{className:`text-foreground-subtle`,children:`cluster`}):s(`span`,{className:`text-foreground`,children:m.get(e.deviceId)??`#${String(e.deviceId)}`})},{key:`items`,header:`Items`,align:`right`,nowrap:!0,sortValue:e=>e.itemsAffected,render:e=>s(`span`,{className:`tabular-nums`,children:e.itemsAffected.toLocaleString()})},{key:`bytes`,header:`Reclaimed`,align:`right`,nowrap:!0,sortValue:e=>e.bytesReclaimed,render:e=>s(`span`,{className:`tabular-nums`,children:e.bytesReclaimed>0?K(e.bytesReclaimed):`—`})}],[m]),b=c||d;return n(`div`,{className:`flex flex-col gap-4`,children:[s(`div`,{className:`flex items-center gap-1`,children:Ce.map(n=>s(`button`,{onClick:()=>t(n.value),className:`rounded px-2 py-1 text-xs font-medium ${e===n.value?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-muted`}`,children:n.label},n.value))}),b&&g.length===0?n(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[s(G,{className:`h-4 w-4 animate-spin`}),`Loading activity…`]}):g.length===0?v.length>0?s(C,{icon:B,title:`Activity could not be read`,description:`The ${v.join(` and `)} ops log did not answer. This is not "nothing happened" — retry, or check the node that owns it.`}):s(C,{icon:U,title:`No activity yet`,description:`Prune, delete and rescan operations across recordings and events show up here.`}):n(i,{children:[v.length>0&&n(`p`,{className:`flex items-center gap-1.5 text-[11px] text-amber-500`,children:[s(B,{className:`h-3 w-3 shrink-0`}),v.join(` and `),` did not answer — rows from`,` `,v.length===1?`that domain`:`those domains`,` are missing below.`]}),s(N,{columns:y,rows:g,rowKey:e=>e.id,minWidthPx:720,mobileMode:`scroll`,maxBodyHeight:oe,defaultSort:Te})]})]})}t();function Oe(){let e=_({isCamera:!0,projection:`slim`}),t=r(()=>(e.data??[]).toSorted((e,t)=>e.name.localeCompare(t.name)),[e.data]),[i,a]=o(null),c=i??t[0]?.id??null;return!e.isLoading&&t.length===0?s(C,{icon:L,title:`No cameras`,description:`Add a camera first.`}):n(`div`,{className:`space-y-3`,children:[n(`div`,{children:[s(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Per-camera recording & retention`}),s(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`Recording mode, schedule bands and the retention policy for one camera — the same controls as the camera's own Recording tab. Retention is one policy over footage and analytics; per-camera event deletion lives on the Events tab.`})]}),n(`div`,{className:`flex items-center gap-2`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Camera`}),s(`select`,{value:c??``,onChange:e=>a(Number(e.target.value)),className:`rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`,children:t.map(e=>s(`option`,{value:e.id,children:e.name},e.id))})]}),c!==null&&s(re,{deviceId:c,children:s(_e,{deviceId:c,sectionFilter:e=>e.location===`top-tab`&&e.tab===`recording`})},c)]})}t();var ke=`pipeline-analytics`;function Ae(e){for(let t of e?.sections??[])for(let e of t.fields??[])if(e.key===`postProcessingNodeId`&&typeof e.value==`string`)return e.value;return`hub`}function je(){let e=a(),{nodes:t}=T(),{data:i,isLoading:o}=de({addonId:ke}),c=Ae(i),l=b({onSuccess:()=>{e.invalidateQueries({queryKey:[[`addonSettings`,`getGlobalSettings`]]})}}),u=r(()=>{let e=t.filter(e=>e.isOnline).map(e=>e.id);return[...new Set([`hub`,c,...e])].filter(Boolean)},[t,c]);return n(`div`,{className:`flex flex-col gap-6`,children:[n(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[s(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Post-processing node`}),s(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`The single node that runs detection post-processing (events, media, audio & motion). Every other node stays inert — no multi-node balancing. Takes effect on addon restart.`}),n(`div`,{className:`mt-3 flex items-center gap-2`,children:[o?s(G,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):s(`select`,{value:c,onChange:e=>{e.target.value!==c&&l.mutate({addonId:ke,patch:{postProcessingNodeId:e.target.value}})},disabled:l.isPending,className:`rounded-md border border-border bg-surface px-2 py-1 text-xs text-foreground`,children:u.map(e=>s(`option`,{value:e,children:e===`hub`?`hub (default)`:e},e))}),l.isPending&&s(G,{className:`h-4 w-4 animate-spin text-primary`})]})]}),n(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[s(`h3`,{className:`mb-1 text-sm font-semibold text-foreground`,children:`Events folder`}),s(`p`,{className:`mb-3 text-[11px] text-foreground-subtle`,children:`Where event crops / full frames are stored. A single folder — no collection / equal-splitting.`}),s(ye,{types:[`eventMedia`]})]})]})}t();var Me=[[`pipelineAnalytics`]],Ne=1440*60*1e3;function Pe(e,t){return t.get(e)??`Removed camera #${String(e)}`}var Fe=[{days:1,label:`1 day`},{days:7,label:`7 days`},{days:30,label:`30 days`},{days:90,label:`90 days`}];function Ie(){let t=a(),i=P(),[c,u]=o(30),[d,f]=o(null),{data:m,isLoading:h}=ue({},{refetchOnWindowFocus:!1}),{data:g}=_({isCamera:!0,projection:`slim`}),v=r(()=>{let e=new Map;for(let t of g??[])e.set(t.id,t.name);return e},[g]),y=e(()=>{t.invalidateQueries({queryKey:Me})},[t]),b=p({onSuccess:y}),x=A(),S=e(async()=>{await i({title:`Prune events older than ${String(c)} day${c===1?``:`s`}?`,message:`Permanently deletes every event (motion / object / audio) older than the cutoff across all cameras, and their media. This cannot be undone.`,confirmLabel:`Prune events`,variant:`danger`})&&b.mutate({olderThanMs:Date.now()-c*Ne,reason:`retention`})},[i,b,c]),w=e(async e=>{let t=Pe(e.deviceId,v);if(await i({title:`Delete all events for ${t}?`,message:`Permanently deletes ${String(e.rows)} event${e.rows===1?``:`s`} (${K(e.bytes)} of media) for this camera. This cannot be undone.`,confirmLabel:`Delete events`,variant:`danger`})){f(null);try{let n=await x.mutateAsync({deviceId:e.deviceId});y();let r=n.motion+n.object+n.audio;if(r===0&&e.bytes>0){f(`0 events deleted for ${t}. Media still listed (${K(e.bytes)}) — those blobs are not event rows; use Management → Count leftovers or Disk reconcile.`);return}f(`Deleted ${String(r)} event${r===1?``:`s`} for ${t}.`)}catch(e){f(e instanceof Error?e.message:String(e))}}},[i,x,v,y]),T=r(()=>[{key:`camera`,header:`Camera`,render:e=>s(`span`,{className:`text-foreground`,children:Pe(e.deviceId,v)})},{key:`rows`,header:`Events`,align:`right`,nowrap:!0,render:e=>s(`span`,{className:`tabular-nums`,children:e.rows.toLocaleString()})},{key:`bytes`,header:`Media`,align:`right`,nowrap:!0,render:e=>s(`span`,{className:`tabular-nums`,children:K(e.bytes)})},{key:`actions`,header:``,align:`right`,render:e=>n(`button`,{onClick:()=>{w(e)},disabled:x.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 all events for this camera`,children:[s(H,{className:`h-3 w-3`}),`Delete`]})}],[v,w,x.isPending]);return h&&!m?n(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[s(G,{className:`h-4 w-4 animate-spin`}),`Loading event-store footprint…`]}):m?n(`div`,{className:`flex flex-col gap-6`,children:[n(`section`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[s(l,{label:`Total events`,icon:s(z,{className:`h-3 w-3`}),footer:`across ${String(m.devices.length)} camera${m.devices.length===1?``:`s`}`,children:m.totalRows.toLocaleString()}),s(l,{label:`Event media on disk`,children:K(m.totalBytes)})]}),n(`section`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[s(`span`,{className:`text-foreground-subtle`,children:`Prune events older than`}),s(`select`,{value:c,onChange:e=>u(Number(e.target.value)),className:`rounded-md border border-border bg-surface px-2 py-1 text-xs text-foreground`,children:Fe.map(e=>s(`option`,{value:e.days,children:e.label},e.days))}),n(`button`,{onClick:()=>{S()},disabled:b.isPending,className:`inline-flex items-center gap-1 rounded border border-border px-2 py-1 text-xs font-medium text-foreground-subtle hover:bg-amber-500/10 hover:text-amber-500 disabled:opacity-50`,children:[b.isPending?s(G,{className:`h-3 w-3 animate-spin`}):s(xe,{className:`h-3 w-3`}),`Prune now`]})]}),m.devices.length===0?s(C,{icon:z,title:`No stored events`,description:`No camera has persisted events yet.`}):s(N,{columns:T,rows:[...m.devices],rowKey:e=>e.deviceId,minWidthPx:480}),d===null?null:s(`p`,{className:d.startsWith(`Deleted `)?`text-[11px] text-foreground-subtle`:`text-[11px] text-destructive`,children:d})]}):s(C,{icon:z,title:`No event data`,description:`Pipeline analytics has not reported any event-store footprint yet.`})}function Le(){return n(`div`,{className:`flex flex-col gap-8`,children:[n(`div`,{children:[s(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Event store`}),s(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`What the durable event store occupies, per camera, with fleet-wide prune-by-age and delete-all-events.`}),s(`div`,{className:`mt-3`,children:s(Ie,{})})]}),n(`div`,{children:[s(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Post-processing node & folders`}),s(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`The single node that writes event crops, and the storage location they land in.`}),s(`div`,{className:`mt-3`,children:s(je,{})})]})]})}t();var Re=[`high`,`mid`,`low`],ze=[{value:1,label:`Real time (1×)`},{value:2,label:`2×`},{value:4,label:`4×`},{value:8,label:`8×`},{value:16,label:`16×`}],Be=10080*60*1e3;function Ve(e){let t=new Date(Date.now()-e*6e4),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function He({onClose:e,onCreated:t}){let i=_({isCamera:!0,projection:`slim`}),a=r(()=>(i.data??[]).toSorted((e,t)=>e.name.localeCompare(t.name)),[i.data]),[c,l]=o(``),[u,d]=o(`high`),[f,p]=o(Ve(60)),[m,h]=o(Ve(0)),[g,y]=o(1),[b,x]=o(!0),[S,C]=o(``),[w,T]=o(null),E=c===``?a[0]?.id??null:c,D=new Date(f).getTime(),O=new Date(m).getTime(),k=Number.isFinite(D)&&Number.isFinite(O)&&D<O,A=v({onSuccess:()=>{t(),e()},onError:e=>T(e instanceof Error?e.message:String(e))});return s(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm`,onClick:e,children:n(`div`,{className:`w-full max-w-md rounded-xl border border-border bg-surface shadow-2xl`,onClick:e=>e.stopPropagation(),children:[n(`div`,{className:`flex items-start justify-between border-b border-border px-4 py-3`,children:[n(`h2`,{className:`flex items-center gap-1.5 text-sm font-semibold text-foreground`,children:[s(V,{className:`h-3.5 w-3.5`}),`New export`]}),s(`button`,{onClick:e,className:`text-foreground-subtle hover:text-foreground`,children:s(W,{className:`h-4 w-4`})})]}),n(`div`,{className:`p-4 space-y-3`,children:[n(`div`,{className:`grid grid-cols-2 gap-3`,children:[n(`div`,{className:`space-y-1`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Camera`}),s(`select`,{value:E??``,onChange:e=>l(Number(e.target.value)),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`,children:a.map(e=>s(`option`,{value:e.id,children:e.name},e.id))})]}),n(`div`,{className:`space-y-1`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Profile`}),s(`select`,{value:u,onChange:e=>d(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`,children:Re.map(e=>s(`option`,{value:e,children:e},e))})]})]}),n(`div`,{className:`grid grid-cols-2 gap-3`,children:[n(`div`,{className:`space-y-1`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`From`}),s(`input`,{type:`datetime-local`,value:f,onChange:e=>p(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`})]}),n(`div`,{className:`space-y-1`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`To`}),s(`input`,{type:`datetime-local`,value:m,onChange:e=>h(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`})]})]}),n(`div`,{className:`grid grid-cols-2 gap-3`,children:[n(`div`,{className:`space-y-1`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Speed`}),s(`select`,{value:g,onChange:e=>y(Number(e.target.value)),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`,children:ze.map(e=>s(`option`,{value:e.value,children:e.label},e.value))})]}),n(`div`,{className:`space-y-1`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Title (optional)`}),s(`input`,{type:`text`,value:S,onChange:e=>C(e.target.value),placeholder:`e.g. courier at the gate`,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground placeholder:text-foreground-subtle`})]})]}),n(`label`,{className:`flex items-center gap-2 text-xs text-foreground cursor-pointer`,children:[s(`input`,{type:`checkbox`,checked:b,disabled:g!==1,onChange:e=>x(e.target.checked),className:`accent-primary`}),`Include audio`,g===1?``:` (real-time only)`]}),!k&&s(`p`,{className:`text-[11px] text-danger`,children:`"From" must be before "To".`}),w&&s(`p`,{className:`text-[11px] text-danger`,children:w})]}),n(`div`,{className:`flex justify-end gap-2 border-t border-border px-4 py-3`,children:[s(`button`,{onClick:e,className:`rounded border border-border px-3 py-1.5 text-xs text-foreground-subtle hover:text-foreground`,children:`Cancel`}),s(`button`,{onClick:()=>{if(E===null||!k)return;T(null);let e=S.trim();A.mutate({deviceId:E,profile:u,fromMs:D,toMs:O,options:{includeAudio:b,maxLifeMs:Be,deleteAfterDownload:!1,...g===1?{}:{speed:g},...e.length>0?{title:e}:{}}})},disabled:E===null||!k||A.isPending,className:`rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground disabled:opacity-50`,children:A.isPending?`Queuing…`:`Create export`})]})]})})}function Ue(e){let t=[];return e.timelapse?t.push(`timelapse ${String(e.timelapse.everyMs/1e3)}s`):(t.push(`${String(e.speed??1)}×`),e.includeAudio&&t.push(`+ audio`)),t.join(` `)}function We(e){return new Date(e).toLocaleString(void 0,{day:`2-digit`,month:`short`,hour:`2-digit`,minute:`2-digit`})}function Ge(e,t){let n=Math.max(0,Math.round((t-e)/1e3)),r=Math.floor(n/3600),i=Math.floor(n%3600/60),a=n%60,o=r>0?`${String(r)}:${String(i).padStart(2,`0`)}:${String(a).padStart(2,`0`)}`:`${String(i)}:${String(a).padStart(2,`0`)}`;return`${We(e)} · ${o}`}function Ke(e,t){let n=e-t;if(n<=0)return`expired`;let r=Math.floor(n/6e4);if(r<60)return`in ${String(r)}m`;let i=Math.floor(r/60);return i<24?`in ${String(i)}h`:`in ${String(Math.floor(i/24))}d`}function qe(e,t,n,r){return e.map(e=>{if(e.state===`expired`||e.state===`deleted`)return e;let i=r.get(e.id);if(i)return{...e,state:`failed`,error:i.error,progressPct:null};let a=n.get(e.id);if(a)return{...e,state:`ready`,fileBytes:a.fileBytes,progressPct:100};let o=t.get(e.id);return o&&(e.state===`queued`||e.state===`rendering`)?{...e,state:`rendering`,progressPct:o.progressPct}:e})}t();var Je=[[`recordingExport`]],Ye={queued:{cls:`bg-muted text-foreground-subtle`,label:`queued`},rendering:{cls:`bg-primary/10 text-primary`,label:`rendering`,spin:!0},ready:{cls:`bg-success/10 text-success`,label:`ready`},failed:{cls:`bg-danger/10 text-danger`,label:`failed`},expired:{cls:`bg-muted text-foreground-subtle`,label:`expired`},deleted:{cls:`bg-muted text-foreground-subtle`,label:`deleted`}};function Xe(){let{data:e,isLoading:t}=fe({},{refetchOnWindowFocus:!1,refetchInterval:e=>(e.state.data??[]).some(e=>e.state===`queued`||e.state===`rendering`)?3e3:!1}),{map:n}=O(F.RecordingExportProgress,e=>e.exportId),{map:i}=O(F.RecordingExportCompleted,e=>e.exportId),{map:a}=O(F.RecordingExportFailed,e=>e.exportId);return{rows:r(()=>qe(e??[],n,i,a),[e,n,i,a]),isLoading:t}}function Ze(e){let[t,n]=o(()=>Date.now());return c(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function Qe(){let t=a(),[i,c]=o(!1),l=()=>{t.invalidateQueries({queryKey:[[`recordingExport`,`listExports`]]})},d=P(),f=u().trpcClient,p=Ze(6e4),{rows:m,isLoading:h}=Xe(),{data:v}=_({isCamera:!0,projection:`slim`}),b=r(()=>{let e=new Map;for(let t of v??[])e.set(t.id,t.name);return e},[v]),x=e(()=>{t.invalidateQueries({queryKey:Je})},[t]),S=g({onSuccess:x}),w=y({onSuccess:x}),[T,E]=o(null),D=e(async e=>{E(e.id);try{let{url:t}=await f.recordingExport.getDownloadUrl.query({exportId:e.id}),n=await ge(t),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`${e.options.title??e.id}.mp4`,document.body.appendChild(i),i.click(),i.remove(),URL.revokeObjectURL(r),x()}finally{E(null)}},[f,x]),O=e(async e=>{await d({title:`Cancel this export?`,message:`Stops the render. The partial file is discarded.`,confirmLabel:`Cancel export`,variant:`danger`})&&S.mutate({exportId:e.id})},[d,S]),k=e(async e=>{await d({title:`Delete this export?`,message:`Permanently removes the rendered file and its history row.`,confirmLabel:`Delete`,variant:`danger`})&&w.mutate({exportId:e.id})},[d,w]),A=r(()=>[{key:`camera`,header:`Camera`,render:e=>s(`span`,{className:`text-foreground`,children:b.get(e.deviceId)??`#${String(e.deviceId)}`})},{key:`range`,header:`Range`,nowrap:!0,render:e=>s(`span`,{className:`tabular-nums`,children:Ge(e.fromMs,e.toMs)})},{key:`variant`,header:`Variant`,render:e=>s(`span`,{className:`text-foreground-subtle`,children:Ue(e.options)})},{key:`state`,header:`State`,render:e=>{let t=Ye[e.state];return n(`span`,{className:`inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium ${t.cls}`,children:[t.spin&&s(G,{className:`h-2.5 w-2.5 animate-spin`}),t.label,e.state===`rendering`&&e.progressPct!==null&&n(`span`,{className:`tabular-nums`,children:[e.progressPct,`%`]})]})}},{key:`expiry`,header:`Expires`,nowrap:!0,render:e=>e.state===`deleted`?s(`span`,{className:`text-foreground-subtle`,children:`—`}):s(`span`,{className:`text-foreground-subtle tabular-nums`,children:Ke(e.expiresAt,p)})},{key:`size`,header:`Size`,align:`right`,nowrap:!0,render:e=>s(`span`,{className:`tabular-nums`,children:e.fileBytes===null?`—`:K(e.fileBytes)})},{key:`actions`,header:``,align:`right`,render:e=>{let t=e.state===`ready`,r=e.state===`queued`||e.state===`rendering`,i=e.state!==`deleted`;return n(`div`,{className:`flex items-center justify-end gap-1`,children:[t&&n(`button`,{onClick:()=>{D(e)},disabled:T===e.id,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-foreground-subtle hover:bg-primary/10 hover:text-foreground disabled:opacity-50`,title:`Download MP4`,children:[T===e.id?s(G,{className:`h-3 w-3 animate-spin`}):s(me,{className:`h-3 w-3`}),`Download`]}),r&&n(`button`,{onClick:()=>{O(e)},disabled:S.isPending,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-foreground-subtle hover:bg-amber-500/10 hover:text-amber-500 disabled:opacity-50`,title:`Cancel render`,children:[s(pe,{className:`h-3 w-3`}),`Cancel`]}),i&&s(`button`,{onClick:()=>{k(e)},disabled:w.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 export`,children:s(H,{className:`h-3 w-3`})})]})}}],[b,p,T,S.isPending,w.isPending,D,O,k]);return h&&m.length===0?n(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[s(G,{className:`h-4 w-4 animate-spin`}),`Loading exports…`]}):n(`div`,{className:`space-y-3`,children:[s(`div`,{className:`flex justify-end`,children:n(`button`,{onClick:()=>c(!0),className:`inline-flex items-center gap-1.5 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground`,children:[s(V,{className:`h-3.5 w-3.5`}),`New export`]})}),m.length===0?s(C,{icon:V,title:`No exports yet`,description:`Create one here (New export) or from a camera's timeline in the viewer. Rendered clips show up here to download or manage.`}):s(N,{columns:A,rows:m,rowKey:e=>e.id,minWidthPx:720}),i&&s(He,{onClose:()=>c(!1),onCreated:l})]})}var $e=`inline-flex w-fit items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[11px] font-medium border border-border text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50`;function et(e){return e===null?`absent`:e.providers.length>0?`present`:`absent`}function tt(e){let t=M.capabilities.getCapability.useQuery({name:e});return t.status===`pending`?`pending`:t.status===`error`?`unknown`:et(t.data)}t();var nt=`storage-migration`,rt=new Set([`orphans`,`debug-media`,`ghost-ledger`]);function it(e){return[`${e.orphansReclaimed} orphan rows (${K(e.orphanBytesReclaimed)})`,e.includeDebugMedia?`${e.debugMediaReclaimed} debug files (${K(e.debugMediaBytesReclaimed)})`:null,`${e.ghostsForgotten} ghost rows (${K(e.ghostBytesForgotten)})`].filter(e=>e!==null).join(` · `)}function at(){return tt(nt)===`present`?s(ot,{}):null}function ot(){let e=P(),[t,r]=o(!1),[i,a]=o(null),c=te({},{refetchInterval:2e3}),l=c.data??null,u=l!==null&&rt.has(l.phase),d=ce(),f=k(),p=async()=>{if(await e({title:`Run storage cleanup?`,message:t?`Reclaims leftover analytics rows and files, debug stills/filmstrips, and ghost footage rows on frozen locations. Safe to re-run.`:`Reclaims leftover analytics rows and files, and ghost footage rows on frozen locations. Debug stills are left alone. Safe to re-run.`,confirmLabel:`Run cleanup`,variant:`danger`})){a(null);try{await d.mutateAsync({includeDebugMedia:t}),await c.refetch()}catch(e){a(e instanceof Error?e.message:String(e))}}},m=async()=>{if(l&&await e({title:`Cancel cleanup?`,message:`Stops after the current step. Work already done stays done.`,confirmLabel:`Cancel cleanup`,variant:`danger`}))try{await f.mutateAsync({jobId:l.jobId}),await c.refetch()}catch{}};return n(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[s(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Cleanup`}),s(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`One pass over leftover analytics (database + files) and ghost footage rows on frozen locations. Does not time out — progress updates here until it finishes.`}),n(`label`,{className:`mt-3 flex items-start gap-2 text-[11px] text-foreground`,children:[s(`input`,{type:`checkbox`,checked:t,disabled:u,onChange:e=>{r(e.target.checked)},className:`mt-0.5 h-3.5 w-3.5 accent-primary`}),s(`span`,{children:`Also remove debug media (motion stills and track filmstrips)`})]}),n(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[n(`button`,{type:`button`,disabled:u||d.isPending,onClick:()=>{p()},className:$e,children:[(u||d.isPending)&&s(G,{className:`h-3 w-3 animate-spin`}),s(H,{className:`h-3 w-3`}),`Run cleanup`]}),u&&s(`button`,{type:`button`,onClick:()=>{m()},className:`inline-flex items-center gap-1 rounded border border-border px-2 py-1 text-[10px] font-medium text-danger hover:bg-danger/10`,children:`Cancel`})]}),i&&s(`p`,{className:`mt-2 text-[11px] text-danger`,children:i}),l&&n(`div`,{className:`mt-3 space-y-1 rounded-md border border-border px-2.5 py-2`,children:[n(`p`,{className:`text-xs text-foreground`,children:[`Phase: `,s(`span`,{className:`font-medium`,children:l.phase}),u&&s(G,{className:`ml-2 inline h-3 w-3 animate-spin text-primary`})]}),l.detail&&s(`p`,{className:`text-[11px] text-foreground-subtle`,children:l.detail}),s(`p`,{className:`text-[11px] text-foreground-subtle`,children:it(l)}),l.error&&s(`p`,{className:`text-[11px] text-danger`,children:l.error})]})]})}t();var st=2e3;function ct(){let e=P(),t=a(),r=ie(),i=d(void 0,{refetchInterval:e=>e.state.data?.state===`running`?st:!1}),o=i.data,l=o?.state===`running`,u=l||r.isPending;c(()=>{o?.state!==`done`||o.finishedAtMs===null||(t.invalidateQueries({queryKey:[[`recording`]]}),t.invalidateQueries({queryKey:[[`pipelineAnalytics`]]}))},[o?.state,o?.finishedAtMs,t]);let f=async()=>{await e({title:`Reconcile storage from disk?`,message:`Makes the database match the filesystem: recordings index, tracks, events and media whose files are gone. Favourited tracks without files are deleted. Snapshot-less motion/audio events are deleted. Enrolled identities stay. This cannot be undone.`,confirmLabel:`Reconcile`,variant:`warning`})&&(await r.mutateAsync(),await i.refetch())},p=l?o.total>0?`Reconciling ${String(o.completed)}/${String(o.total)}…`:`Reconciling…`:r.isPending?`Reconciling…`:`Reconcile from disk`;return n(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[s(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Disk reconcile`}),s(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`Deletes database rows whose files are gone. Enrolled identities stay.`}),n(`div`,{className:`mt-3 flex flex-col gap-2`,children:[n(`button`,{type:`button`,onClick:()=>void f(),disabled:u,className:`inline-flex w-fit items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[11px] font-medium border border-border text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50`,children:[u?s(G,{className:`h-3.5 w-3.5 animate-spin`}):s(I,{className:`h-3.5 w-3.5`}),p]}),o?.state===`done`?n(`p`,{className:`text-[11px] text-foreground-subtle`,children:[`Last run: `,String(o.completed),` camera(s) — dropped `,String(o.tracks),` tracks,`,` `,String(o.events),` events, `,String(o.mediaDropped),` media`,o.failed.length>0?`, ${String(o.failed.length)} failed (${o.failed.join(`, `)})`:``,`.`]}):null,o?.state===`error`&&o.error!==null?n(`p`,{className:`text-[11px] text-destructive`,children:[`Reconcile failed: `,o.error]}):null]})]})}var q=1e3,J=60*q,Y=60*J;function X(e){return e.toLocaleString(`en-US`)}function lt(e){if(!Number.isFinite(e)||e<0)return`—`;if(e>=Y){let t=Math.floor(e/Y),n=Math.round(e%Y/J);return`${t.toString()}h ${n.toString()}m`}if(e>=J){let t=Math.floor(e/J),n=Math.round(e%J/q);return`${t.toString()}m ${n.toString()}s`}return`${Math.max(0,Math.round(e/q)).toString()}s`}function ut(e){let t=Math.max(0,e.observedAt-e.startedAt),n=e.filesTotal===null?`${X(e.filesMoved)} files`:`${X(e.filesMoved)} / ${X(e.filesTotal)} files`,r=e.filesTotal===null||e.filesTotal===0?null:Math.min(1,e.filesMoved/e.filesTotal),i=t>0&&e.filesMoved>0,a=i?`${K(e.bytesMoved/t*q)}/s`:null,o=e.filesTotal===null?null:e.filesTotal-e.filesMoved,s=!i||o===null||o<=0?null:`~${lt(o*t/e.filesMoved)} left`;return{counted:n,fraction:r,moved:`${K(e.bytesMoved)} moved`,rate:a,eta:s}}function dt(e){let t=ut(e);return[t.counted,t.moved,t.rate,t.eta].filter(e=>e!==null).join(` · `)}t();var ft=`storage-migration`,Z=[{id:`recordings`,label:`Recordings`,locationType:`recordings`},{id:`recordingsLow`,label:`Low-res recordings`,locationType:`recordingsLow`},{id:`eventMedia`,label:`Event media`,locationType:`eventMedia`}],pt=new Set([`planning`,`sealing`,`pausing`,`moving`,`draining`,`verifying`,`repointing`,`refreshing`,`resuming`]);function mt(){let e=tt(ft);return e===`pending`?n(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[s(G,{className:`h-4 w-4 animate-spin`}),`Checking whether storage migration is installed…`]}):e===`unknown`?s(C,{icon:B,title:`Couldn't check whether storage migration is installed`,description:`The capability registry did not answer, so this panel has nothing to report either way — it is not a statement that the capability is missing. Reload to ask again.`}):e===`absent`?s(C,{icon:be,title:`Storage migration not installed`,description:`The capability registry answered: no addon in this cluster provides storage-migration. Once one is deployed, this panel moves recordings, low-res recordings and event media to new storage locations in one coordinated, verified operation.`}):s(ht,{})}function ht(){let e=P(),{data:t}=w({}),[i,a]=o({}),[c,l]=o({}),[u,d]=o(null),[p,m]=o(null),h=r(()=>{let e=new Map;for(let n of t??[]){let t=e.get(n.type);t?t.push(n):e.set(n.type,[n])}return e},[t]),g=r(()=>{let e=new Map;for(let n of t??[])n.isDefault&&e.set(n.type,n.id);return e},[t]),_=ee({},{refetchInterval:2e3}),v=_.data??null,y=v!==null&&pt.has(v.phase),b=r(()=>{let e={};for(let t of Z){let n=i[t.id];n&&(e[t.id]=n)}return Object.keys(e).length>0?e:void 0},[i]),x=r(()=>{let e={};for(let t of Z){if(!i[t.id])continue;let n=c[t.id]??g.get(t.locationType);n&&(e[t.id]=n)}return Object.keys(e).length>0?e:void 0},[i,c,g]),S=r(()=>({destinations:b??{},...x?{sources:x}:{}}),[b,x]),C=ne(S,{enabled:!1,retry:!1}),T=D(),E=f(),O=async()=>{if(!b)return;m(null);let e=await C.refetch();if(e.error){m(e.error instanceof Error?e.error.message:String(e.error));return}d(e.data??null)},k=async()=>{if(b&&await e({title:`Start storage migration?`,message:`Copies the selected classes from the chosen source to the destination, verifies, then either makes the destination the default (if the source was) or disables the source. Safe to re-run if interrupted.`,confirmLabel:`Start migration`,variant:`danger`})){m(null);try{await T.mutateAsync(S),d(null),await _.refetch()}catch(e){m(e instanceof Error?e.message:String(e))}}},A=async()=>{if(v&&await e({title:`Cancel migration?`,message:`Stops the in-progress migration. Data already moved and verified stays at the destination; anything already repointed is not reverted.`,confirmLabel:`Cancel migration`,variant:`danger`}))try{await E.mutateAsync({jobId:v.jobId}),await _.refetch()}catch{}};return n(`div`,{className:`flex flex-col gap-6`,children:[n(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[n(`h3`,{className:`flex items-center gap-1.5 text-sm font-semibold text-foreground`,children:[s(be,{className:`h-3.5 w-3.5`}),`Storage migration`]}),s(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`Move recordings, low-res recordings and/or event media from one location to another: copies via the recorder / pipeline-analytics movers, verifies, then either repoints the default (when the source was the default) or disables the source (when it was not). Skip a class with an empty destination.`}),s(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-3`,children:Z.map(e=>{let t=h.get(e.locationType)??[],r=g.get(e.locationType)??``;return n(`div`,{className:`space-y-2`,children:[s(`div`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:e.label}),n(`div`,{className:`space-y-1`,children:[n(`label`,{htmlFor:`migration-from-${e.id}`,className:`text-[10px] text-foreground-subtle`,children:[e.label,` from`]}),s(`select`,{id:`migration-from-${e.id}`,value:c[e.id]??r,onChange:t=>{let n=t.target.value;l(t=>({...t,[e.id]:n}))},disabled:y,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground disabled:opacity-50`,children:t.map(e=>n(`option`,{value:e.id,children:[e.displayName,e.isDefault?` (default)`:``]},e.id))})]}),n(`div`,{className:`space-y-1`,children:[n(`label`,{htmlFor:`migration-dest-${e.id}`,className:`text-[10px] text-foreground-subtle`,children:[e.label,` to`]}),n(`select`,{id:`migration-dest-${e.id}`,value:i[e.id]??``,onChange:t=>{let n=t.target.value;a(t=>({...t,[e.id]:n}))},disabled:y,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground disabled:opacity-50`,children:[s(`option`,{value:``,children:`— skip —`}),t.map(e=>s(`option`,{value:e.id,children:e.displayName},e.id))]})]})]},e.id)})}),p&&s(`p`,{className:`mt-2 text-[11px] text-danger`,children:p}),n(`div`,{className:`mt-3 flex items-center gap-2`,children:[n(`button`,{type:`button`,onClick:()=>{O()},disabled:!b||C.isFetching||y,className:`inline-flex items-center gap-1.5 rounded border border-border px-2.5 py-1.5 text-xs font-medium text-foreground-subtle hover:text-foreground hover:bg-surface-hover disabled:opacity-50`,children:[C.isFetching&&s(G,{className:`h-3 w-3 animate-spin`}),`Plan`]}),n(`button`,{type:`button`,onClick:()=>{k()},disabled:!b||T.isPending||y,className:`inline-flex items-center gap-1.5 rounded bg-primary px-2.5 py-1.5 text-xs font-medium text-primary-foreground disabled:opacity-50`,children:[T.isPending&&s(G,{className:`h-3 w-3 animate-spin`}),`Start migration`]})]}),u&&s(`div`,{className:`mt-3 divide-y divide-border rounded-md border border-border`,children:u.moves.length===0?s(`p`,{className:`px-2.5 py-1.5 text-[11px] text-foreground-subtle`,children:`Nothing to move — selected destinations match the current defaults.`}):u.moves.map(e=>n(`div`,{className:`px-2.5 py-1.5 text-[11px] text-foreground`,children:[e.storageClass,`: `,e.fromLocationId,` → `,e.toLocationId]},`${e.storageClass}-${e.toLocationId}`))}),v&&n(`div`,{className:`mt-4 border-t border-border pt-3`,children:[n(`div`,{className:`flex items-center justify-between`,children:[s(`h4`,{className:`text-xs font-semibold text-foreground`,children:`Migration status`}),y&&n(`button`,{type:`button`,onClick:()=>{A()},className:`inline-flex items-center gap-1 rounded border border-border px-2 py-1 text-[10px] font-medium text-danger hover:bg-danger/10`,children:[s(W,{className:`h-3 w-3`}),`Cancel`]})]}),n(`p`,{className:`mt-1 text-xs text-foreground`,children:[`Phase: `,s(`span`,{className:`font-medium`,children:v.phase}),y&&s(G,{className:`ml-2 inline h-3 w-3 animate-spin text-primary`})]}),v.error&&s(`p`,{className:`mt-1 text-[11px] text-danger`,children:v.error}),v.pausedParticipants.length>0&&n(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:[`Paused: `,v.pausedParticipants.join(`, `)]}),s(`div`,{className:`mt-2 divide-y divide-border rounded-md border border-border`,children:v.moves.map(e=>s(gt,{move:e},`${e.storageClass}-${e.fromLocationId}`))})]}),s(_t,{})]}),s(vt,{running:y}),s(bt,{})]})}function gt({move:e}){let t=e.progress===null?null:ut(e.progress);return n(`div`,{className:`px-2.5 py-1.5 text-[11px]`,children:[n(`div`,{className:`flex items-center justify-between`,children:[n(`span`,{className:`text-foreground`,children:[e.storageClass,`: `,e.fromLocationId,` → `,e.toLocationId]}),n(`span`,{className:`text-foreground-subtle`,children:[e.state??`pending`,e.error?` (${e.error})`:``]})]}),e.progress!==null&&n(`div`,{className:`mt-1 space-y-1`,children:[t!==null&&t.fraction!==null&&s(`div`,{className:`h-1 w-full overflow-hidden rounded bg-border`,children:s(`div`,{className:`h-full bg-primary`,style:{width:`${(t.fraction*100).toFixed(1)}%`}})}),s(`p`,{className:`text-[10px] text-foreground-subtle`,children:dt(e.progress)})]})]})}function _t(){let{data:e}=j({});return!e||e.length===0?null:n(`div`,{className:`mt-4 border-t border-border pt-3`,children:[s(`h4`,{className:`text-xs font-semibold text-foreground`,children:`Migration history`}),s(`div`,{className:`mt-2 divide-y divide-border rounded-md border border-border`,children:e.map(e=>n(`div`,{className:`px-2.5 py-1.5 text-[11px] text-foreground-subtle`,children:[s(`span`,{className:`font-medium text-foreground`,children:e.phase}),` · `,Object.entries(e.destinations).filter(e=>typeof e[1]==`string`).map(([e,t])=>`${e} → ${t}`).join(`, `),` · `,new Date(e.startedAt).toLocaleString()]},e.jobId))})]})}function vt({running:e}){let t=P(),r=se({},{staleTime:1/0,refetchOnWindowFocus:!1}),i=ae(),[a,c]=o(null),l=r.data??[];if(l.length===0)return null;let u=async e=>{if(await t({title:`Drain remaining ${e.storageClass}?`,message:`Moves what is still on ${e.fromLocationId} to ${e.toLocationId}. Nothing is paused and no default is changed — this is the second half of a migration, run on its own. It is resumable: cancelling leaves everything readable from both locations.`,confirmLabel:`Drain remaining`,variant:`danger`})){c(null);try{await i.mutateAsync({classes:[e.storageClass]}),await r.refetch()}catch(e){c(e instanceof Error?e.message:String(e))}}};return n(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[n(`div`,{className:`flex items-start justify-between gap-2`,children:[s(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Left on the old location`}),n(`div`,{className:`flex shrink-0 items-center gap-2`,children:[s(`span`,{className:`text-[10px] text-foreground-subtle`,children:r.dataUpdatedAt>0?`Measured ${new Date(r.dataUpdatedAt).toLocaleTimeString()}`:`Measured — never`}),s(`button`,{type:`button`,onClick:()=>{r.refetch()},disabled:r.isFetching,className:`rounded border border-border px-2 py-1 text-[10px] font-medium text-foreground-subtle hover:bg-surface-hover hover:text-foreground disabled:opacity-50`,children:r.isFetching?`Counting…`:`Refresh`})]})]}),s(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`A migration repoints first and drains behind. If the drain was cancelled, failed, or was interrupted by a restart, the data below is still on the source — readable, but not where the defaults now point. Draining moves it; it changes no default and pauses nothing.`}),s(`p`,{className:`mt-1 text-[10px] text-foreground-subtle`,children:`This count is taken on demand: measuring it walks the whole media collection, so it is not refreshed on a timer. Press Refresh after a drain finishes.`}),a&&s(`p`,{className:`mt-2 text-[11px] text-danger`,children:a}),s(`div`,{className:`mt-2 divide-y divide-border rounded-md border border-border`,children:l.map(t=>n(`div`,{className:`flex items-center justify-between gap-2 px-2.5 py-1.5 text-[11px]`,children:[n(`span`,{className:`text-foreground`,children:[t.storageClass,`: `,t.fromLocationId,` → `,t.toLocationId,s(`span`,{className:`ml-2 text-foreground-subtle`,children:yt(t)})]}),s(`button`,{type:`button`,onClick:()=>{u(t)},disabled:e||i.isPending,className:`shrink-0 rounded border border-border px-2 py-1 text-[10px] font-medium text-foreground-subtle hover:bg-surface-hover hover:text-foreground disabled:opacity-50`,children:`Drain remaining`})]},`${t.storageClass}-${t.fromLocationId}`))})]})}function yt(e){if(e.items===null)return`amount unknown — the archive could not be read`;let t=e.items.toLocaleString(`en-US`);return e.bytes===null?`${t} rows`:`${t} segments · ${K(e.bytes)}`}function bt(){let{data:e}=E({},{refetchInterval:2e3}),t=(e??[]).filter(e=>e.migrationJobId===null&&e.job.state===`running`);return t.length===0?null:n(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[s(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Movers running outside a migration`}),s(`div`,{className:`mt-2 divide-y divide-border rounded-md border border-border`,children:t.map(e=>n(`div`,{className:`px-2.5 py-1.5 text-[11px]`,children:[n(`div`,{className:`text-foreground`,children:[e.lane,`: `,e.job.fromLocationId,` → `,e.job.toLocationId]}),s(`p`,{className:`mt-1 text-[10px] text-foreground-subtle`,children:dt({filesMoved:e.job.filesMoved,filesTotal:e.job.filesTotal,bytesMoved:e.job.bytesMoved,startedAt:e.job.startedAt,observedAt:e.observedAt})})]},e.job.jobId))})]})}function xt(){return n(`div`,{className:`flex flex-col gap-4`,children:[s(at,{}),s(ct,{}),n(`section`,{children:[s(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Move storage`}),s(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`Copy recordings, low-res recordings or event media to a new location, verify, then repoint the default. Applies to every camera.`}),s(`div`,{className:`mt-3`,children:s(mt,{})})]})]})}t();var St=`recorder`;function Ct(e,t,n){for(let n of e?.sections??[])for(let e of n.fields??[])if(e.key===t&&typeof e.value==`string`)return e.value;return n}function wt(){let e=a(),{nodes:t}=T(),{data:i,isLoading:o}=de({addonId:St}),c=Ct(i,`recordingNodeId`,`hub`),l=b({onSuccess:()=>{e.invalidateQueries({queryKey:[[`addonSettings`,`getGlobalSettings`]]})}}),u=r(()=>{let e=t.filter(e=>e.isOnline).map(e=>e.id);return[...new Set([`hub`,c,...e])].filter(Boolean)},[t,c]);return n(`div`,{className:`flex flex-col gap-6`,children:[n(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[s(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Recording node`}),s(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`The single node that records (continuous & events) and serves playback. Every other node stays inert — no multi-node balancing. Takes effect on addon restart.`}),n(`div`,{className:`mt-3 flex items-center gap-2`,children:[o?s(G,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):s(`select`,{value:c,onChange:e=>{e.target.value!==c&&l.mutate({addonId:St,patch:{recordingNodeId:e.target.value}})},disabled:l.isPending,className:`rounded-md border border-border bg-surface px-2 py-1 text-xs text-foreground`,children:u.map(e=>s(`option`,{value:e,children:e===`hub`?`hub (default)`:e},e))}),l.isPending&&s(G,{className:`h-4 w-4 animate-spin text-primary`})]}),c!==`hub`&&n(`p`,{className:`mt-2 text-[11px] text-amber-500`,children:[`The stream-broker is hub-only — an agent recorder pulls streams from the hub over the network. The hub's RTSP restream port must be reachable from`,` `,s(`span`,{className:`font-medium`,children:c}),`. If the auto-derived host doesn't work, set the recorder's`,s(`span`,{className:`font-medium`,children:` recordingHubHostname`}),` global setting.`]})]}),n(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[s(`h3`,{className:`mb-1 text-sm font-semibold text-foreground`,children:`Recordings folders`}),s(`p`,{className:`mb-3 text-[11px] text-foreground-subtle`,children:`Where recordings are stored. Multi-location collections — segments are split across the locations of a type. Add a location to grow capacity; mark one default per type.`}),s(ye,{types:[`recordings`,`recordingsLow`]})]})]})}function Tt(e){return e.locationIds!==void 0&&e.locationIds.length>0?e.locationIds:e.locationId===null?[]:[e.locationId]}function Et(e,t){let n=Tt(e);return n.length===0?`default root`:n.map(e=>t.get(e)??e).join(` + `)}function Dt(e,t,n){if(e.length===0)return null;let r=e[0];if(e.length===1&&r!==void 0)return{label:Et(r,t),exact:!0};if(n===null)return null;let i=e.find(e=>Tt(e).includes(n));return i===void 0?null:{label:Et(i,t),exact:!1}}var Q=[`ok`,`warn`,`critical`];function Ot(e){return e>=.95?`critical`:e>=.85?`warn`:`ok`}function kt(e){return Math.min(1,Math.max(0,e))}function At(e){let{availableBytes:t,totalBytes:n}=e;if(n===null||n<=0||t===null)return null;let r=kt((n-t)/n);return{fraction:r,severity:Ot(r),recordingsFraction:kt(e.usedBytes/n),freeBytes:t,totalBytes:n}}function jt(e){if(e.length===0)return null;let t=0,n=0,r=0,i=0,a=null;for(let o of e){let e=At(o);if(e===null){n+=1;continue}t+=1,r+=e.totalBytes,i+=e.freeBytes,(a===null||Q.indexOf(e.severity)>Q.indexOf(a))&&(a=e.severity)}return{knownVolumes:t,unknownVolumes:n,totalBytes:r,freeBytes:i,severity:a}}t();var Mt=[[`recording`]],Nt=[{value:`retention`,label:`Retention policy`},{value:`quota`,label:`Quota / disk pressure`},{value:`operator`,label:`Operator`}],Pt={ok:`bg-primary`,warn:`bg-amber-500`,critical:`bg-danger`},Ft={ok:`text-foreground-subtle`,warn:`text-amber-500`,critical:`text-danger`};function $(e){return`${String(Math.round(e*100))}%`}function It(e,t){let n=e.locationIds??(e.locationId===null?[]:[e.locationId]),r=n.map(e=>t.get(e)).filter(e=>e!==void 0);return r.length>0?r.join(` + `):e.root===void 0?n.length>0?n.join(` + `):`default root`:e.root}function Lt(){let t=a(),i=P(),[c,u]=o(`retention`),{data:d,isLoading:f}=S({},{refetchOnWindowFocus:!1}),{data:p}=_({isCamera:!0,projection:`slim`}),{data:h}=w({}),g=r(()=>{let e=new Map;for(let t of p??[])e.set(t.id,t.name);return e},[p]),v=r(()=>{let e=new Map;for(let t of h??[])e.set(t.id,t.displayName);return e},[h]),y=r(()=>{let e=h??[];return e.find(e=>e.type===`recordings`&&e.enabled!==!1)?.id??e.find(e=>e.type===`recordings`)?.id??null},[h]),b=r(()=>d?.locations??[],[d?.locations]),T=r(()=>Dt(b,v,y),[b,v,y]),E=r(()=>jt(b),[b]),D=e(()=>{t.invalidateQueries({queryKey:Mt})},[t]),O=x({onSuccess:D}),k=m({onSuccess:D}),A=e(async e=>{await i({title:`Prune ${g.get(e.deviceId)??`#${String(e.deviceId)}`}?`,message:`Applies the retention policy now (reason: ${c}). Footage beyond the policy is permanently deleted.`,confirmLabel:`Prune now`,variant:`danger`})&&O.mutate({deviceId:e.deviceId,reason:c})},[i,O,c,g]),j=e(async e=>{await i({title:`Delete all footage for ${g.get(e.deviceId)??`#${String(e.deviceId)}`}?`,message:`Permanently deletes ${K(e.usedBytes)} of recorded footage for this camera. This cannot be undone.`,confirmLabel:`Delete ${K(e.usedBytes)}`,variant:`danger`})&&k.mutate({deviceId:e.deviceId})},[i,k,g]),ee=r(()=>[{key:`camera`,header:`Camera`,render:e=>s(`span`,{className:`text-foreground`,children:g.get(e.deviceId)??`#${String(e.deviceId)}`})},{key:`disk`,header:`Disk`,nowrap:!0,render:()=>T===null?s(`span`,{className:`text-foreground-subtle`,children:`—`}):n(`span`,{className:T.exact?`text-foreground`:`text-foreground-subtle`,title:T.exact?`The only recordings volume on this node — this camera can only be here.`:`The recordings DEFAULT. This node has several recordings volumes and the per-camera placement is not reported by recording.getStorageUsage, so this is where footage lands by default rather than a per-camera fact.`,children:[T.label,!T.exact&&s(`span`,{className:`ml-1 text-foreground-subtle`,children:`(default)`})]})},{key:`used`,header:`Used`,align:`right`,nowrap:!0,render:e=>s(`span`,{className:`tabular-nums`,children:K(e.usedBytes)})},{key:`actions`,header:``,align:`right`,render:e=>n(`div`,{className:`flex items-center justify-end gap-1`,children:[n(`button`,{onClick:()=>{A(e)},disabled:O.isPending,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-foreground-subtle hover:bg-amber-500/10 hover:text-amber-500 disabled:opacity-50`,title:`Apply retention policy now`,children:[s(xe,{className:`h-3 w-3`}),`Prune`]}),n(`button`,{onClick:()=>{j(e)},disabled:k.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 all footage`,children:[s(H,{className:`h-3 w-3`}),`Delete`]})]})}],[g,T,A,j,O.isPending,k.isPending]);if(f&&!d)return n(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[s(G,{className:`h-4 w-4 animate-spin`}),`Loading storage usage…`]});if(!d)return s(C,{icon:I,title:`No storage data`,description:`The recording node has not reported any storage usage yet.`});let M=d.devices.length;return n(`div`,{className:`flex flex-col gap-6`,children:[n(`section`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:[s(l,{label:`Total used`,icon:s(I,{className:`h-3 w-3`}),footer:`${String(M)} camera${M===1?``:`s`} on ${d.nodeId}`,children:K(d.totalUsedBytes)}),E!==null&&E.severity!==null&&s(l,{label:`Free on recordings volumes`,icon:s(I,{className:`h-3 w-3`}),footer:`across ${String(E.knownVolumes)} volume${E.knownVolumes===1?``:`s`} of ${K(E.totalBytes)}`+(E.unknownVolumes>0?` · ${String(E.unknownVolumes)} did not report capacity`:``),children:s(`span`,{className:`tabular-nums ${Ft[E.severity]}`,children:K(E.freeBytes)})}),b.map(e=>{let t=At(e),r=e.locationId??e.root??`default`;return s(l,{label:`Disk: ${It(e,v)}`,footer:t===null?`${K(e.usedBytes)} of recordings · volume capacity unknown`:`${K(t.freeBytes)} free of ${K(t.totalBytes)} · ${K(e.usedBytes)} recordings (${$(t.recordingsFraction)})`,children:t===null?s(`span`,{className:`tabular-nums`,children:K(e.usedBytes)}):n(`div`,{className:`flex items-center gap-2`,title:`Volume fill — everything on the disk, not only recordings. Warn at 85%, critical at 95%.`,children:[s(`div`,{className:`h-2 flex-1 overflow-hidden rounded bg-muted`,children:s(`div`,{className:`h-full rounded ${Pt[t.severity]}`,style:{width:$(t.fraction)}})}),s(`span`,{className:`tabular-nums text-xs ${Ft[t.severity]}`,children:$(t.fraction)})]})},r)})]}),n(`section`,{className:`flex items-center gap-2 text-xs`,children:[s(`label`,{htmlFor:`prune-reason`,className:`text-foreground-subtle`,children:`Prune reason`}),s(`select`,{id:`prune-reason`,value:c,onChange:e=>{let t=Nt.find(t=>t.value===e.target.value);t&&u(t.value)},className:`rounded-md border border-border bg-surface px-2 py-1 text-xs text-foreground`,children:Nt.map(e=>s(`option`,{value:e.value,children:e.label},e.value))})]}),M===0?s(C,{icon:I,title:`No recorded footage`,description:`No camera has recorded footage on this node yet.`}):s(N,{columns:ee,rows:[...d.devices],rowKey:e=>e.deviceId,minWidthPx:480})]})}function Rt(){return n(`div`,{className:`flex flex-col gap-8`,children:[n(`div`,{children:[s(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Footage on disk`}),s(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`What recorded footage occupies, per camera and per volume, with prune-by-policy and delete-all-footage.`}),s(`div`,{className:`mt-3`,children:s(Lt,{})})]}),n(`div`,{children:[s(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Recording node & folders`}),s(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`The single node that records and serves playback, and the storage locations footage is written to.`}),s(`div`,{className:`mt-3`,children:s(wt,{})})]})]})}function zt(){return s(he,{icon:V,title:`Recordings`,subtitle:`Recorded footage and the durable event store — what each occupies, where it is written, and the operations that move or reconcile both.`,children:s(ve,{tabs:[{id:`storage`,label:`Recordings`,icon:I,content:s(Rt,{})},{id:`events`,label:`Events`,icon:z,content:s(Le,{})},{id:`cameras`,label:`Cameras`,icon:L,content:s(Oe,{})},{id:`exports`,label:`Export`,icon:V,content:s(Qe,{})},{id:`activity`,label:`Activity`,icon:U,content:s(De,{})},{id:`management`,label:`Management`,icon:Se,content:s(xt,{})}]})})}export{zt as RecordingsPage};
@@ -1 +0,0 @@
1
- import{J as e}from"./index-BklHyIal.js";var t=e(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]);export{t};
@@ -1 +0,0 @@
1
- import{J as e}from"./index-BklHyIal.js";var t=e(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]);export{t};
@@ -1 +0,0 @@
1
- import{J as e}from"./index-BklHyIal.js";var t=e(`circle-slash`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]);export{t};
@@ -1 +0,0 @@
1
- import{J as e}from"./index-BklHyIal.js";var t=e(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16 14`,key:`68esgv`}]]);export{t};