@camstack/addon-admin-ui 1.2.83 → 1.2.85

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 (116) hide show
  1. package/dist/assets/{AddLocationWizard-De7ns5QL.js → AddLocationWizard-CwreWITW.js} +1 -1
  2. package/dist/assets/{AddonCollectionPage-DXsxDYkh.js → AddonCollectionPage-B_yz8bA0.js} +1 -1
  3. package/dist/assets/Addons-ByS1wyLr.js +1 -0
  4. package/dist/assets/{AdminTabs-Ea5QF5Xy.js → AdminTabs-BNPrEU-u.js} +1 -1
  5. package/dist/assets/{AiProfiles-Cf11u16h.js → AiProfiles-BOhYahU1.js} +2 -2
  6. package/dist/assets/{BrokerForm-B-sL3dqC.js → BrokerForm-B45_C-11.js} +1 -1
  7. package/dist/assets/{Build-_kPogt2B.js → Build-DBt1hX43.js} +4 -4
  8. package/dist/assets/{Capabilities-D-_vyuUw.js → Capabilities-D3ydTf8a.js} +1 -1
  9. package/dist/assets/{CapabilityBadges-DVcflr6z.js → CapabilityBadges-BsNvOYxI.js} +1 -1
  10. package/dist/assets/{Cluster-CP-cfGdm.js → Cluster-Be75yEy8.js} +1 -1
  11. package/dist/assets/{Data-D3-pzcKz.js → Data-DjH9RwP1.js} +1 -1
  12. package/dist/assets/DetectionIntelligence-Bxil3Kqd.js +1 -0
  13. package/dist/assets/{DeviceAggregateSection-CZPFsC_N.js → DeviceAggregateSection-CmeOZSZb.js} +1 -1
  14. package/dist/assets/DeviceDetail-CLZxugdc.js +2 -0
  15. package/dist/assets/{Devices-CQEzT4CH.js → Devices-BiaI1wtk.js} +1 -1
  16. package/dist/assets/EmbedPlayerPage-BFMqluKF.js +1 -0
  17. package/dist/assets/Events-2Mew-AL7.js +1 -0
  18. package/dist/assets/FormBuilder-BDA9-uL2.js +1 -0
  19. package/dist/assets/Identity-DYj1lU6G.js +1 -0
  20. package/dist/assets/IntegrationDetail-DkP04o_o.js +1 -0
  21. package/dist/assets/{Integrations-Bs6_6m2A.js → Integrations-DypneOCC.js} +1 -1
  22. package/dist/assets/Integrations-Q2IXumNM.js +1 -0
  23. package/dist/assets/{Logs-CJEauzfn.js → Logs-DCGZ4xft.js} +1 -1
  24. package/dist/assets/{MotionZonesSettings-CrtWFnAG.js → MotionZonesSettings-D2OfXg-s.js} +1 -1
  25. package/dist/assets/{MyAccess-MG2HC7n3.js → MyAccess-DiZ_NQ8Q.js} +1 -1
  26. package/dist/assets/{Network-DaZHubTl.js → Network-D6Jjjglj.js} +1 -1
  27. package/dist/assets/{NodeAddonsSettingsPanel-Cm3hCWxL.js → NodeAddonsSettingsPanel-iynDrGDY.js} +1 -1
  28. package/dist/assets/NodeInferenceDevices-kA005bIs.js +1 -0
  29. package/dist/assets/Notifications-3VV4lesM.js +1 -0
  30. package/dist/assets/Pipeline-Cvq_ZK2N.js +1 -0
  31. package/dist/assets/{Plates-CdlwAHjB.js → Plates-Mq7_V44B.js} +1 -1
  32. package/dist/assets/{PrivacyMaskSettings-1sJg0nCf.js → PrivacyMaskSettings-DegFwke0.js} +1 -1
  33. package/dist/assets/{ProviderIcon-CIB9wAOh.js → ProviderIcon-BRIZHtNP.js} +1 -1
  34. package/dist/assets/Recordings-GWbTxHDj.js +1 -0
  35. package/dist/assets/{ScanNetworkModal-QJjU9tvg.js → ScanNetworkModal-h2wgb-9T.js} +1 -1
  36. package/dist/assets/{SceneMonitorEditor-B_qhxMl3.js → SceneMonitorEditor-DtUM6j78.js} +1 -1
  37. package/dist/assets/{Scenes-S26M2qHR.js → Scenes-CXbQ1BC3.js} +1 -1
  38. package/dist/assets/{Settings-BgvNkBP1.js → Settings-CezuMxyz.js} +1 -1
  39. package/dist/assets/{Showroom-GHOpXZqD.js → Showroom-HltZNDXE.js} +1 -1
  40. package/dist/assets/{Terminal-B0ibWMEy.js → Terminal-9BMEBt8x.js} +2 -2
  41. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-BxzyL6ky.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-CLXUGt-W.js} +1 -1
  42. package/dist/assets/{bell-ring-C1CDDXf4.js → bell-ring-BOKJStq_.js} +1 -1
  43. package/dist/assets/{boxes-D1jLdgix.js → boxes-BvnEYalC.js} +1 -1
  44. package/dist/assets/{build-cluster-graph-C4jX8n1A.js → build-cluster-graph-BVmcPlKM.js} +2 -2
  45. package/dist/assets/circle-check-big-H_sRGszZ.js +1 -0
  46. package/dist/assets/{circle-x-CJJu15h-.js → circle-x-De9Atcex.js} +1 -1
  47. package/dist/assets/clock-DmdPTuLe.js +1 -0
  48. package/dist/assets/{copy-CCWWm0Zr.js → copy-DPSVazs5.js} +1 -1
  49. package/dist/assets/{debounced-invalidate-Bo_vaBxo.js → debounced-invalidate-CaNNRf1N.js} +1 -1
  50. package/dist/assets/{dist-B7jD-S4H.js → dist-DHHyyJUp.js} +1 -1
  51. package/dist/assets/dist-DtzZqioA.js +349 -0
  52. package/dist/assets/{download-BkhXjXOx.js → download-D0TL4kvK.js} +1 -1
  53. package/dist/assets/{face-bbox-BOyxoUe0.js → face-bbox-DHOml3XL.js} +1 -1
  54. package/dist/assets/{hard-drive-fVjmkYpz.js → hard-drive-E6KB7P74.js} +1 -1
  55. package/dist/assets/{hostInit-CFYQGKqd.js → hostInit-CJNRBgTm.js} +1 -1
  56. package/dist/assets/index-BVmc_EOb.js +4 -0
  57. package/dist/assets/{index-BppWvbJe.css → index-DR0aGe9s.css} +1 -1
  58. package/dist/assets/{key-round-BWUCyF0a.js → key-round-DCkVCgVU.js} +1 -1
  59. package/dist/assets/{mf-entry-bootstrap-0-8a7c339b.js → mf-entry-bootstrap-0-b0b43084.js} +2 -2
  60. package/dist/assets/{pencil-BOy-rDbD.js → pencil-CCigTGBs.js} +1 -1
  61. package/dist/assets/play-CAbyx0Ik.js +1 -0
  62. package/dist/assets/{player-overlays-UTlrOH4s.js → player-overlays-Cce7zLVf.js} +1 -1
  63. package/dist/assets/plus-CkMMGkZS.js +1 -0
  64. package/dist/assets/power-CFTIVgET.js +1 -0
  65. package/dist/assets/{radio-DKuDbOsT.js → radio-DH4YapvY.js} +1 -1
  66. package/dist/assets/{refresh-cw-BRs_7wGu.js → refresh-cw-7BWEDRql.js} +1 -1
  67. package/dist/assets/remoteEntry-ee3nHxW_.js +1 -0
  68. package/dist/assets/rotate-ccw-CvT7yFgt.js +1 -0
  69. package/dist/assets/rotate-cw-CHBtKezc.js +1 -0
  70. package/dist/assets/search-LiVSlZYd.js +1 -0
  71. package/dist/assets/{send-DSafmQi_.js → send-BxN-W44d.js} +1 -1
  72. package/dist/assets/{server-wq15CL48.js → server-MPW5E9Je.js} +1 -1
  73. package/dist/assets/square-BGhxv6lU.js +1 -0
  74. package/dist/assets/{square-check-big-DO81u3O2.js → square-check-big-KUDADp7C.js} +1 -1
  75. package/dist/assets/src-BQU93IBQ.js +349 -0
  76. package/dist/assets/src-CLcW_gk2.js +67 -0
  77. package/dist/assets/{star-Docf4EYZ.js → star-DgpioIxR.js} +1 -1
  78. package/dist/assets/{undo-2-LIqqVOPk.js → undo-2-Dx5lBXZW.js} +1 -1
  79. package/dist/assets/{upload-D4XiPM-V.js → upload-C_Z1HY8V.js} +1 -1
  80. package/dist/assets/{use-scenes-feed-BdUI8ZzS.js → use-scenes-feed-7qe4q2V7.js} +1 -1
  81. package/dist/assets/useEventInvalidation-B1u2ACO8.js +1 -0
  82. package/dist/assets/{video-DdJ2lmUL.js → video-CDs4hw5_.js} +1 -1
  83. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-cD-zqb5y.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-BZfm1F7n.js} +2 -2
  84. package/dist/assets/{wifi-Dx0-akbW.js → wifi-C6eU8xw2.js} +1 -1
  85. package/dist/assets/{zap-BLI50LGc.js → zap-CosjZI2Q.js} +1 -1
  86. package/dist/index.html +6 -6
  87. package/dist/server/addon.js +139 -57
  88. package/package.json +1 -1
  89. package/dist/assets/Addons-iB8Jj8Wa.js +0 -1
  90. package/dist/assets/DetectionIntelligence-B914KqGk.js +0 -1
  91. package/dist/assets/DeviceDetail-Cz70xnHl.js +0 -2
  92. package/dist/assets/EmbedPlayerPage-BQ1dgL2t.js +0 -1
  93. package/dist/assets/Events-B9-2qvUg.js +0 -1
  94. package/dist/assets/FormBuilder-ERsdhqXU.js +0 -1
  95. package/dist/assets/Identity-BNMnBiNq.js +0 -1
  96. package/dist/assets/IntegrationDetail-CY-7m0wv.js +0 -1
  97. package/dist/assets/Integrations-CbfIXyMv.js +0 -1
  98. package/dist/assets/NodeInferenceDevices-2-PPLG4L.js +0 -1
  99. package/dist/assets/Notifications-DMPhSkZ8.js +0 -1
  100. package/dist/assets/Pipeline-D4RLE8zf.js +0 -1
  101. package/dist/assets/Recordings-D4KRWthc.js +0 -1
  102. package/dist/assets/circle-check-big-Be_uVG-B.js +0 -1
  103. package/dist/assets/clock-9WRXwSMf.js +0 -1
  104. package/dist/assets/dist-Cpz6pXi5.js +0 -345
  105. package/dist/assets/index-DM4pp8Vx.js +0 -4
  106. package/dist/assets/play-tYEpmInf.js +0 -1
  107. package/dist/assets/plus-uTnAmy5n.js +0 -1
  108. package/dist/assets/power-DLJJxxZ5.js +0 -1
  109. package/dist/assets/remoteEntry-B-TTgn5K.js +0 -1
  110. package/dist/assets/rotate-ccw-CZY9UuXq.js +0 -1
  111. package/dist/assets/rotate-cw-rDbUnEsj.js +0 -1
  112. package/dist/assets/search-BGsNM6IN.js +0 -1
  113. package/dist/assets/square-BFMdi_Qm.js +0 -1
  114. package/dist/assets/src-C9CFJqET.js +0 -345
  115. package/dist/assets/src-DVZrqMsD.js +0 -67
  116. package/dist/assets/useEventInvalidation-DLMOtAJP.js +0 -1
@@ -7560,7 +7560,7 @@ var RecordingBandSchema = object({
7560
7560
  postBufferSec: number().min(0).optional()
7561
7561
  });
7562
7562
  ({
7563
- preBufferSec: 10,
7563
+ preBufferSec: 15,
7564
7564
  postBufferSec: 30
7565
7565
  }).postBufferSec * 1e3;
7566
7566
  /**
@@ -13499,128 +13499,103 @@ var COCO_TO_MACRO = {
13499
13499
  var AUDIO_MACRO_LABELS = [
13500
13500
  {
13501
13501
  id: "speech",
13502
- name: "Speech",
13503
- icon: "🗣️"
13502
+ name: "Speech"
13504
13503
  },
13505
13504
  {
13506
13505
  id: "scream",
13507
- name: "Scream / Shout",
13508
- icon: "😱"
13506
+ name: "Scream / Shout"
13509
13507
  },
13510
13508
  {
13511
13509
  id: "crying",
13512
- name: "Crying / Baby",
13513
- icon: "😢"
13510
+ name: "Crying / Baby"
13514
13511
  },
13515
13512
  {
13516
13513
  id: "laughter",
13517
- name: "Laughter",
13518
- icon: "😂"
13514
+ name: "Laughter"
13519
13515
  },
13520
13516
  {
13521
13517
  id: "music",
13522
- name: "Music",
13523
- icon: "🎵"
13518
+ name: "Music"
13524
13519
  },
13525
13520
  {
13526
13521
  id: "dog",
13527
- name: "Dog",
13528
- icon: "🐕"
13522
+ name: "Dog"
13529
13523
  },
13530
13524
  {
13531
13525
  id: "cat",
13532
- name: "Cat",
13533
- icon: "🐈"
13526
+ name: "Cat"
13534
13527
  },
13535
13528
  {
13536
13529
  id: "bird",
13537
- name: "Bird",
13538
- icon: "🐦"
13530
+ name: "Bird"
13539
13531
  },
13540
13532
  {
13541
13533
  id: "animal",
13542
- name: "Animal (other)",
13543
- icon: "🐾"
13534
+ name: "Animal (other)"
13544
13535
  },
13545
13536
  {
13546
13537
  id: "alarm",
13547
- name: "Alarm / Siren",
13548
- icon: "🚨"
13538
+ name: "Alarm / Siren"
13549
13539
  },
13550
13540
  {
13551
13541
  id: "doorbell",
13552
- name: "Doorbell / Knock",
13553
- icon: "🔔"
13542
+ name: "Doorbell / Knock"
13554
13543
  },
13555
13544
  {
13556
13545
  id: "glass_breaking",
13557
- name: "Glass Breaking",
13558
- icon: "💥"
13546
+ name: "Glass Breaking"
13559
13547
  },
13560
13548
  {
13561
13549
  id: "gunshot",
13562
- name: "Gunshot / Explosion",
13563
- icon: "💣"
13550
+ name: "Gunshot / Explosion"
13564
13551
  },
13565
13552
  {
13566
13553
  id: "vehicle",
13567
- name: "Vehicle",
13568
- icon: "🚗"
13554
+ name: "Vehicle"
13569
13555
  },
13570
13556
  {
13571
13557
  id: "siren",
13572
- name: "Emergency Siren",
13573
- icon: "🚑"
13558
+ name: "Emergency Siren"
13574
13559
  },
13575
13560
  {
13576
13561
  id: "fire",
13577
- name: "Fire / Smoke",
13578
- icon: "🔥"
13562
+ name: "Fire / Smoke"
13579
13563
  },
13580
13564
  {
13581
13565
  id: "water",
13582
- name: "Water",
13583
- icon: "💧"
13566
+ name: "Water"
13584
13567
  },
13585
13568
  {
13586
13569
  id: "wind",
13587
- name: "Wind / Weather",
13588
- icon: "🌬️"
13570
+ name: "Wind / Weather"
13589
13571
  },
13590
13572
  {
13591
13573
  id: "door",
13592
- name: "Door",
13593
- icon: "🚪"
13574
+ name: "Door"
13594
13575
  },
13595
13576
  {
13596
13577
  id: "footsteps",
13597
- name: "Footsteps",
13598
- icon: "👣"
13578
+ name: "Footsteps"
13599
13579
  },
13600
13580
  {
13601
13581
  id: "crowd",
13602
- name: "Crowd / Chatter",
13603
- icon: "👥"
13582
+ name: "Crowd / Chatter"
13604
13583
  },
13605
13584
  {
13606
13585
  id: "telephone",
13607
- name: "Telephone",
13608
- icon: "📞"
13586
+ name: "Telephone"
13609
13587
  },
13610
13588
  {
13611
13589
  id: "engine",
13612
- name: "Engine / Motor",
13613
- icon: "⚙️"
13590
+ name: "Engine / Motor"
13614
13591
  },
13615
13592
  {
13616
13593
  id: "tools",
13617
- name: "Tools / Construction",
13618
- icon: "🔨"
13594
+ name: "Tools / Construction"
13619
13595
  },
13620
13596
  {
13621
13597
  id: "silence",
13622
- name: "Silence",
13623
- icon: "🤫"
13598
+ name: "Silence"
13624
13599
  }
13625
13600
  ];
13626
13601
  var YAMNET_TO_MACRO = {
@@ -16084,7 +16059,7 @@ var TrackEnvelopeSchema = object({
16084
16059
  * `snapshots[]` references — megabytes across a page of tracks. `slim`
16085
16060
  * keeps every scalar the list surfaces actually render (ids, class(es),
16086
16061
  * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
16087
- * zonesVisited, bestEventId, envelope, hasFace, hasRider) and returns `positions` /
16062
+ * zonesVisited, bestEventId, envelope, hasFace, hasEmbeddedFace, hasRider) and returns `positions` /
16088
16063
  * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
16089
16064
  * `getTrack`. Mirrors the event-store `projection` convention
16090
16065
  * (`getObjectEvents` et al.).
@@ -16379,6 +16354,35 @@ var TrackSchema = object({
16379
16354
  */
16380
16355
  hasFace: boolean().optional(),
16381
16356
  /**
16357
+ * This track has a face row IN THE GALLERY: a crop **and** an embedding — a
16358
+ * face an operator could ASSIGN to an identity.
16359
+ *
16360
+ * The STRICT twin of {@link hasFace}, and the pair only earns its keep
16361
+ * because the two disagree. `hasFace` is stamped at the TOP of the face
16362
+ * branch, before every gate, and means no more than "a face detector produced
16363
+ * a face detail". This one is stamped at the single moment the gallery row
16364
+ * LANDS — after `FaceRecognizer.onTrackEnd` successfully persists it, i.e.
16365
+ * past the embedding-magnitude verdict, the `minFacePx` detection gate, the
16366
+ * candidate gate, the imageless-track drop (no crop was ever captured) and
16367
+ * the crop-store drop. Everything between the detector and that insert can
16368
+ * legitimately refuse the face, so a flag written any earlier promises the
16369
+ * operator something to assign and delivers nothing.
16370
+ *
16371
+ * **Independent of recognition.** A face collected but never auto-matched is
16372
+ * still assignable — it is in fact the face an operator most wants to reach —
16373
+ * so this is NOT gated on `recognizedIdentityId`. Recognition lands in
16374
+ * `subLabel`; this says only that the raw material exists.
16375
+ *
16376
+ * **Set once, never cleared.** A track that produced a gallery row produced
16377
+ * one; deleting the row later is the gallery's business, not this flag's.
16378
+ *
16379
+ * **Absent ≠ false**, the same rule as {@link hasFace}: every row written
16380
+ * before the column omits it, and so does every server that predates the
16381
+ * field. A consumer must test `=== true` and render nothing otherwise —
16382
+ * never infer "no assignable face".
16383
+ */
16384
+ hasEmbeddedFace: boolean().optional(),
16385
+ /**
16382
16386
  * This subject CONTAINS a folded rider — a person the rider-pairing step
16383
16387
  * ([D34](../decisions/adr-0034.md)) removed from the frame BEFORE the tracker,
16384
16388
  * so the passage is tracked once and as a VEHICLE.
@@ -17728,6 +17732,32 @@ var DetailResultSchema = object({
17728
17732
  /** FRAME-space bbox (already mapped back from crop space). */
17729
17733
  bbox: NativeCropBboxSchema.optional(),
17730
17734
  embedding: string().optional(),
17735
+ /**
17736
+ * L2 magnitude of the RAW pre-normalization embedding. Additive and optional
17737
+ * so an older runner that does not send it degrades to "unmeasurable", which
17738
+ * the consuming gate treats as accept — never as reject.
17739
+ */
17740
+ embeddingMagnitude: number().optional(),
17741
+ /**
17742
+ * Model that produced `embedding` — the SAME contract `labelModelId` has for
17743
+ * `label`, and for the same reason: the producing node is the only side that
17744
+ * knows which model actually ran, and re-deriving it downstream is exactly
17745
+ * the inference this model exists to forbid.
17746
+ *
17747
+ * Additive and optional, so a runner that predates it degrades to
17748
+ * "unmeasurable" rather than to a wrong answer — the consumer falls back to
17749
+ * its previous assumption instead of refusing.
17750
+ *
17751
+ * Its absence was not cosmetic. `FaceRecognizer` needs the probe's model id
17752
+ * to use `face-matcher`'s same-model gate (`sample.modelId !== probe.modelId`);
17753
+ * with nothing on the wire it took the id from the GALLERY, so the gate
17754
+ * compared the gallery against itself and could never fire. That turned the
17755
+ * one guard protecting the face feature space into a tautology, and it is
17756
+ * why swapping `face-embedding`'s model would NOT have stranded the enrolled
17757
+ * gallery as the catalog comment predicts — it would have scored the new
17758
+ * model's vectors against the old model's samples in one cosine space.
17759
+ */
17760
+ embeddingModelId: string().optional(),
17731
17761
  label: string().optional(),
17732
17762
  /**
17733
17763
  * The tier `label` occupies, copied VERBATIM from the producing step's
@@ -19138,6 +19168,7 @@ DeviceType.Camera, method(object({
19138
19168
  isBattery: boolean(),
19139
19169
  reason: _enum([
19140
19170
  "disabled",
19171
+ "offline",
19141
19172
  "sleeping",
19142
19173
  "unreachable",
19143
19174
  "waking"
@@ -19183,9 +19214,17 @@ targets: array(object({
19183
19214
  sleeping: boolean(),
19184
19215
  /** Current device state rendered over the cached frame. State images
19185
19216
  * remain authoritative even when their photographic background is
19186
- * old; null means the link must carry a current camera frame. */
19217
+ * old; null means the link must carry a current camera frame.
19218
+ *
19219
+ * **This is the ONLY source a surface may derive an inactive tile
19220
+ * from.** A client that reads a device's `online`/`disabled` flags and
19221
+ * draws its own verdict will disagree with the pixels it is painting
19222
+ * — the frame comes from here, and so must the sentence over it
19223
+ * (D190). Pair with `ageMs` for the age of the photograph behind the
19224
+ * state. */
19187
19225
  stateReason: _enum([
19188
19226
  "disabled",
19227
+ "offline",
19189
19228
  "sleeping",
19190
19229
  "unreachable",
19191
19230
  "waking"
@@ -33371,7 +33410,6 @@ var NC_AUDIO_DEFAULTS = {
33371
33410
  hitPercent: 60,
33372
33411
  samplingSeconds: 10
33373
33412
  };
33374
- new Map(AUDIO_MACRO_LABELS.flatMap((macro) => macro.icon === void 0 ? [] : [[macro.id, macro.icon]]));
33375
33413
  new Set(["devices", "classes"]);
33376
33414
  NC_AUDIO_DEFAULTS.hitPercent, NC_AUDIO_DEFAULTS.samplingSeconds;
33377
33415
  /**
@@ -33605,6 +33643,39 @@ TimelapseRuleInputSchema.extend({
33605
33643
  createdAt: number(),
33606
33644
  updatedAt: number()
33607
33645
  });
33646
+ Object.freeze(Object.fromEntries([{
33647
+ stepId: "face-embedding",
33648
+ label: "Face recognition model",
33649
+ defaultModelId: "arcface-r100",
33650
+ indexName: "the enrolled face gallery",
33651
+ options: [
33652
+ {
33653
+ id: "arcface-r100",
33654
+ label: "ArcFace (ResNet34)"
33655
+ },
33656
+ {
33657
+ id: "auraface-r100",
33658
+ label: "AuraFace R100"
33659
+ },
33660
+ {
33661
+ id: "inception-resnet-v1",
33662
+ label: "Inception ResNet V1"
33663
+ }
33664
+ ]
33665
+ }, {
33666
+ stepId: "clip-embedding",
33667
+ label: "Semantic search model",
33668
+ defaultModelId: "mobileclip-s1",
33669
+ indexName: "the object semantic-search index",
33670
+ options: [{
33671
+ id: "mobileclip-s1",
33672
+ label: "MobileCLIP S1"
33673
+ }, {
33674
+ id: "mobileclip-s2",
33675
+ label: "MobileCLIP S2"
33676
+ }]
33677
+ }].map((s) => [s.stepId, s.defaultModelId])));
33678
+ string().min(1);
33608
33679
  object({
33609
33680
  /**
33610
33681
  * Fraction of the box's own size added on EACH side before cutting.
@@ -33625,10 +33696,21 @@ object({
33625
33696
  */
33626
33697
  square: boolean()
33627
33698
  });
33628
- ({
33699
+ /**
33700
+ * The convention in force when nobody has configured one — byte-for-byte the
33701
+ * behaviour of the pre-unification LIVE path (`DETAIL_CROP_PADDING_RATIO`).
33702
+ */
33703
+ var DEFAULT_DETAIL_CROP_CONVENTION = {
33629
33704
  paddingRatio: .15,
33630
33705
  square: false
33631
- }).paddingRatio;
33706
+ };
33707
+ Object.freeze({
33708
+ x: 0,
33709
+ y: 0,
33710
+ w: 1,
33711
+ h: 1
33712
+ });
33713
+ DEFAULT_DETAIL_CROP_CONVENTION.paddingRatio;
33632
33714
  /**
33633
33715
  * WHICH delivered frames the decode worker retains a native copy of.
33634
33716
  *
@@ -33762,7 +33844,7 @@ var AdminUIAddon = class extends BaseAddon {
33762
33844
  capability: adminUiCapability,
33763
33845
  provider: {
33764
33846
  getStaticDir: async () => ({ staticDir: resolveAdminUiDistDir() }),
33765
- getVersion: async () => ({ version: "1.2.83" })
33847
+ getVersion: async () => ({ version: "1.2.85" })
33766
33848
  }
33767
33849
  }];
33768
33850
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-admin-ui",
3
- "version": "1.2.83",
3
+ "version": "1.2.85",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Admin UI — Vite frontend build and server-side addon",
@@ -1 +0,0 @@
1
- import{I as e,K as t,Q as n,R as r,S as i,W as a,b as o,o as s,q as c,x as l,z as u}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{Z as d}from"./player-overlays-UTlrOH4s.js";import{An as f,Cn as p,Dn as m,Fn as h,J as g,Ln as _,Mn as ee,Nn as v,On as y,Pn as b,Rn as x,Sn as te,T as ne,Tn as S,Wi as C,X as re,Xi as w,bn as ie,dn as ae,g as T,kn as oe,ks as E,vn as D,wn as se,xn as ce,yn as O,zn as le}from"./src-DVZrqMsD.js";import{Pt as k}from"./src-C9CFJqET.js";import{t as A}from"./clock-9WRXwSMf.js";import{t as j}from"./download-BkhXjXOx.js";import{t as ue}from"./plus-uTnAmy5n.js";import{t as M}from"./refresh-cw-BRs_7wGu.js";import{t as N}from"./search-BGsNM6IN.js";import{t as P}from"./upload-D4XiPM-V.js";import{C as F,J as de,K as I,P as L,R,X as z,_ as fe,i as B,m as V,p as pe,s as H,z as U}from"./index-DM4pp8Vx.js";import{t as W}from"./AdminPage-CCD07UMs.js";import{t as me}from"./NodeAddonsSettingsPanel-Cm3hCWxL.js";var he=I(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),ge=I(`octagon-alert`,[[`path`,{d:`M12 16h.01`,key:`1drbdi`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z`,key:`1fd625`}]]),_e=I(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),G=I(`skip-forward`,[[`polygon`,{points:`5 4 15 12 5 20 5 4`,key:`16p6eg`}],[`line`,{x1:`19`,x2:`19`,y1:`5`,y2:`19`,key:`futhcm`}]]);n();var K=new Set([`completed`,`failed`,`partially-failed`,`cancelled`]),q=new Set([`done`,`failed`,`skipped`]);function ve(e){return!q.has(e.phase)&&!K.has(e.jobState)}function J(e,t){let n=new Map,r=[...e].sort((e,t)=>e.createdAtMs-t.createdAtMs);for(let e of r){let r=K.has(e.state);for(let i of e.tasks)r&&i.finishedAtMs!==null&&t-i.finishedAtMs>6e4||n.set(i.packageName,{jobId:e.jobId,packageName:i.packageName,phase:i.phase,fromVersion:i.fromVersion,toVersion:i.toVersion,error:i.error,jobState:e.state,finishedAtMs:i.finishedAtMs})}return n}function ye(){let{data:e}=m({activeOnly:!0},{refetchOnWindowFocus:!1,refetchInterval:e=>(e.state.data?.length??0)>0?3e3:!1}),{map:t}=E(k.AddonsJobProgress,e=>e.job.jobId);return a(()=>{let n=new Map;for(let t of e??[])n.set(t.jobId,t);for(let[e,r]of t)n.set(e,r.job);return J([...n.values()],Date.now())},[e,t])}var be={queued:{icon:A,cls:`bg-muted text-foreground-subtle`,label:`queued`},fetching:{icon:F,cls:`bg-primary/10 text-primary`,label:`fetching`,spin:!0},staged:{icon:F,cls:`bg-primary/10 text-primary`,label:`staged`,spin:!0},validating:{icon:F,cls:`bg-primary/10 text-primary`,label:`validating`,spin:!0},applying:{icon:F,cls:`bg-primary/10 text-primary`,label:`applying`,spin:!0},restarting:{icon:F,cls:`bg-amber-500/10 text-amber-600 dark:text-amber-400`,label:`restarting`,spin:!0},applied:{icon:F,cls:`bg-primary/10 text-primary`,label:`finalizing`,spin:!0},done:{icon:U,cls:`bg-success/10 text-success`,label:`updated`},failed:{icon:ge,cls:`bg-danger/10 text-danger`,label:`failed`},skipped:{icon:G,cls:`bg-muted text-foreground-subtle`,label:`skipped`}};function xe({progress:e}){let t=be[e.phase],n=t.icon,r=e.error??`${e.packageName}: ${e.fromVersion??`?`} → ${e.toVersion}`;return i(`span`,{"data-testid":`addon-job-progress`,className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded shrink-0 ${t.cls}`,title:r,children:[l(n,{className:`w-2.5 h-2.5 ${t.spin?`animate-spin`:``}`}),t.label,i(`span`,{className:`font-mono`,children:[`→ `,e.toVersion]})]})}function Se({packageName:e,currentVersion:t,installSource:n,onInstall:r,onClose:a,onSelect:s,selectedVersion:c}){let u=n===`upload`||n===`local`,{data:d,isLoading:f}=p({name:e});return i(`div`,{className:`fixed z-50 w-72 rounded-lg border border-border bg-surface shadow-xl overflow-hidden`,style:{top:`auto`,bottom:`auto`},ref:e=>{if(!e)return;let t=e.parentElement?.getBoundingClientRect();if(!t)return;let n=window.innerHeight-t.bottom,r=t.top;n<280&&r>n?(e.style.bottom=`${window.innerHeight-t.top+4}px`,e.style.top=`auto`):(e.style.top=`${t.bottom+4}px`,e.style.bottom=`auto`),e.style.right=`${window.innerWidth-t.right}px`},onClick:e=>e.stopPropagation(),children:[i(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border`,children:[l(`span`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle font-medium`,children:`Versions`}),l(`button`,{type:`button`,onClick:a,className:`text-foreground-subtle hover:text-foreground`,children:l(B,{className:`h-3 w-3`})})]}),u&&i(`div`,{className:`flex items-start gap-2 px-3 py-2 border-b border-border bg-cyan-500/10 text-[10px]`,children:[l(P,{className:`h-3 w-3 mt-0.5 text-cyan-500 shrink-0`}),i(`div`,{className:`text-cyan-700 dark:text-cyan-200`,children:[i(`span`,{className:`font-semibold`,children:[n===`upload`?`Uploaded copy`:`Local copy`,` in place.`]}),` `,`Re-install `,l(`span`,{className:`font-mono`,children:t}),` from npm to track upstream releases again.`]})]}),f&&i(`div`,{className:`flex items-center justify-center gap-2 py-6 text-[10px] text-foreground-subtle`,children:[l(F,{className:`h-3.5 w-3.5 animate-spin`}),`Loading versions...`]}),d&&l(`div`,{className:`max-h-64 overflow-auto divide-y divide-border`,children:d.map(e=>{let n=e.version===t,a=s!==void 0&&e.version===c,d=/-(alpha|beta|rc|dev|canary|next)/i.test(e.version),f=i(o,{children:[l(`span`,{className:`font-mono flex-1 text-left ${n?`text-primary font-semibold`:d?`text-amber-400`:`text-foreground`}`,children:e.version}),n&&l(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium bg-primary/10 text-primary`,children:`current`}),e.distTags.map(e=>l(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium ${e===`latest`?`bg-emerald-500/15 text-emerald-400`:e===`beta`?`bg-amber-500/15 text-amber-400`:`bg-gray-500/15 text-gray-400`}`,children:e},e)),e.deprecated&&l(`span`,{className:`text-[9px] text-red-400 line-through`,children:`deprecated`}),l(`span`,{className:`text-[9px] text-foreground-subtle shrink-0`,children:new Date(e.publishedAt).toLocaleDateString()})]});return s?i(`button`,{type:`button`,"aria-label":`Select ${e.version}`,onClick:()=>s(e.version),className:`w-full flex items-center gap-2 px-3 py-2 text-[11px] ${a?`bg-primary/5`:`hover:bg-surface-hover`} transition-colors`,children:[f,a?l(U,{className:`h-3 w-3 text-primary shrink-0`}):l(`span`,{className:`w-3 shrink-0`})]},e.version):i(`div`,{className:`flex items-center gap-2 px-3 py-2 text-[11px] ${n?`bg-primary/5`:`hover:bg-surface-hover`} transition-colors`,children:[f,n&&!u?l(U,{className:`h-3 w-3 text-primary shrink-0`}):l(`button`,{type:`button`,onClick:()=>r(e.version),className:`shrink-0 rounded p-0.5 hover:bg-primary/20 text-foreground-subtle hover:text-primary transition-colors`,title:n?`Re-install ${e.version} from npm`:`Install ${e.version}`,children:l(j,{className:`h-3 w-3`})})]},e.version)})}),d&&d.length===0&&l(`div`,{className:`py-4 text-center text-[10px] text-foreground-subtle`,children:`No versions found`})]})}var Y={queued:{icon:A,bg:`bg-muted text-foreground-subtle`,label:`queued`},updating:{icon:F,bg:`bg-primary/10 text-primary`,label:`updating`,spin:!0},"done-pending-restart":{icon:M,bg:`bg-amber-500/10 text-amber-700`,label:`pending restart`},done:{icon:U,bg:`bg-success/10 text-success`,label:`done`},failed:{icon:ge,bg:`bg-danger/10 text-danger`,label:`failed`}};function Ce({item:e}){let t=Y[e.status],n=t.icon;return i(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded ${t.bg}`,title:e.error,children:[l(n,{className:`w-2.5 h-2.5 ${t.spin?`animate-spin`:``}`}),t.label]})}n();var X=`device-export`;function Z(e){return e.capabilities.some(e=>(typeof e==`string`?e:e.name)===X)}function we({isBundle:e,installSource:t,addonId:n,iconPath:r,color:a}){let[o,s]=c(!1),u=a?{backgroundColor:`${a.startsWith(`#`)?a:`#${a}`}26`}:void 0,d=e?`bg-indigo-500/20 text-indigo-700 dark:text-indigo-300`:`bg-purple-500/20 text-purple-700 dark:text-purple-300`,f=n&&r?`/api/addon-assets/${n}/${r}`:null,p=!!f&&!o;return i(`div`,{className:`relative flex-shrink-0`,children:[l(`div`,{className:`h-9 w-9 rounded-lg flex items-center justify-center ${u?``:d}`,style:u,children:p?l(`img`,{src:f,alt:n,className:`h-5 w-5`,onError:()=>s(!0)}):l(e?_e:fe,{className:`h-4 w-4`})}),t===`local`&&l(`span`,{className:`absolute -top-1.5 -left-1.5 text-[7px] font-bold leading-none bg-orange-500 text-white px-1 py-0.5 rounded -rotate-12 shadow-sm`,children:`DEV`}),t===`npm`&&l(`span`,{className:`absolute -top-1 -left-1 w-4 h-4 rounded bg-[#cb3837] flex items-center justify-center -rotate-12 shadow-sm`,children:l(`svg`,{viewBox:`0 0 780 250`,className:`w-[11px] h-[11px]`,children:l(`path`,{fill:`#fff`,d:`M240 250h100V50h100v200h340V0H0v250z`})})}),t===`upload`&&l(`span`,{className:`absolute -top-1.5 -left-1.5 flex items-center justify-center h-4 w-4 rounded bg-cyan-500 -rotate-12 shadow-sm`,children:l(P,{className:`h-2.5 w-2.5 text-white`})})]})}function Te({version:e,availableUpdate:t,selectedVersion:n,isUpdating:r,installSource:a,disabled:o,onUpdate:s,onOpenPicker:c,children:u}){if(r)return i(`span`,{className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border border-blue-500/30 bg-blue-500/10 text-blue-400 shrink-0`,children:[l(F,{className:`h-3 w-3 animate-spin`}),`Updating…`]});if(t){let r=n??t;return i(`div`,{className:`relative inline-flex items-center gap-1 shrink-0`,children:[s&&i(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),s()},disabled:o,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-semibold border border-blue-500/30 bg-blue-500/10 text-blue-400 hover:bg-blue-500/20 disabled:opacity-50 disabled:cursor-not-allowed transition-colors`,title:`Update to ${r}`,children:[l(j,{className:`h-3 w-3`}),`Update`]}),i(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),c()},disabled:o,"aria-label":`Select version to install`,title:`Installed ${e} — update available. Selected ${r}; tap to choose another version.`,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-bold font-mono border border-amber-500/40 bg-amber-500/15 text-amber-500 hover:bg-amber-500/25 animate-pulse disabled:opacity-50 disabled:cursor-not-allowed transition-colors`,children:[l(`span`,{className:`font-normal opacity-70`,children:e}),l(`span`,{className:`font-normal opacity-70`,children:`→`}),r,l(R,{className:`h-3 w-3`})]}),u]})}return i(`div`,{className:`relative inline-flex items-center gap-1 shrink-0`,children:[i(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),c()},disabled:o,className:[`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-bold font-mono border transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,a===`local`?`border-orange-500/30 bg-orange-500/10 text-orange-400 hover:bg-orange-500/20`:`border-emerald-500/30 bg-emerald-500/10 text-emerald-400 hover:bg-emerald-500/20`].join(` `),title:`Version ${e} — tap to view all versions`,children:[e,l(R,{className:`h-3 w-3 opacity-50`})]}),u]})}function Ee({addonId:e}){let t=s(),{data:n=`inherit`}=ie({addonId:e}),r=b({onSuccess:()=>{t.invalidateQueries({queryKey:[[`addons`,`getAddonAutoUpdate`]]})}});return l(`div`,{className:`flex rounded-lg border border-border overflow-hidden text-[10px] font-medium`,children:[`inherit`,`off`,`latest`,`beta`].map(t=>l(`button`,{type:`button`,onClick:n=>{n.stopPropagation(),r.mutate({addonId:e,channel:t})},disabled:r.isPending,className:`px-2.5 py-1 transition-colors capitalize ${n===t?t===`inherit`?`bg-gray-700/50 text-gray-700 dark:text-gray-300`:t===`off`?`bg-gray-700 text-gray-700 dark:text-gray-300`:t===`latest`?`bg-blue-500/20 text-blue-400`:`bg-amber-500/20 text-amber-400`:`bg-transparent text-foreground-subtle hover:bg-surface-hover`} ${t===`inherit`?``:`border-l border-border`}`,children:t},t))})}function De({addon:e,agents:t=[],clusterStatus:n,hideVersion:r,availableUpdate:a,onUpdate:p,isUpdating:m,jobProgress:h,bundle:_,bulkItem:v,disabledByBulk:y,isSystem:b}){let[te,S]=c(!1),[C,w]=c(!1),[ie,T]=c(!1),[oe,E]=c(null);u(()=>{E(null)},[a]);let D=oe??a,[ce,O]=c(!1),[le,k]=c(!1),[A,j]=c(`logs`),N=s(),P=d(),F=de(),I=ae(),{manifest:L}=e,z=e.installedOn??[],fe=!_&&!L.protected&&L.removable!==!1,U=!!_,W=_?.displayName??L.name,G=_?.packageName??L.packageName,K=_?.version??L.packageVersion??L.version,q=_?.installSource??e.installSource,ve=_?_.bundle?.description??_.addons[0]?.manifest.description:L.description,J=x({onSuccess:()=>{N.invalidateQueries({queryKey:[[`addons`]]}),N.invalidateQueries({queryKey:[[`addonPages`]]}),N.invalidateQueries({queryKey:[[`capabilities`]]})}}),ye=f({onSuccess:()=>{N.invalidateQueries({queryKey:[[`addons`]]})}}),be=se({onSuccess:()=>{N.invalidateQueries({queryKey:[[`addons`]]}),N.invalidateQueries({queryKey:[[`addonPages`]]}),N.invalidateQueries({queryKey:[[`capabilities`]]}),N.invalidateQueries({queryKey:[[`integrations`]]})}}),Y=ee({onSuccess:()=>{N.invalidateQueries({queryKey:[[`addons`]]}),N.invalidateQueries({queryKey:[[`alerts`]]})}}),X=e.health,Q=X?.phase===`failed`&&!X.inGracePeriod,Oe=Q&&X?.nextRetryAt&&!X.retrying;return i(`div`,{className:`rounded-lg border bg-surface overflow-hidden ${Q?`border-red-500/50`:`border-border`}`,children:[Q&&X&&i(`div`,{className:`bg-danger/10 border-b border-danger/30 px-4 py-2.5 flex items-start gap-2.5`,children:[l(ge,{className:`h-4 w-4 text-danger shrink-0 mt-0.5`}),i(`div`,{className:`flex-1 min-w-0`,children:[i(`div`,{className:`text-xs font-semibold text-danger`,children:[`Failed to load (attempt #`,X.retryCount,`)`]}),l(`div`,{className:`text-[11px] text-foreground mt-0.5 break-words font-mono`,children:X.lastError?.message??`Unknown error`}),Oe&&X.nextRetryAt&&i(`div`,{className:`text-[10px] text-foreground-subtle mt-1`,children:[`Auto-retry at `,new Date(X.nextRetryAt).toLocaleTimeString()]})]}),i(`button`,{type:`button`,disabled:Y.isPending||X.retrying,onClick:e=>{e.stopPropagation(),Y.mutate({packageName:G})},className:`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1 text-[11px] font-semibold border border-red-400/40 bg-red-400/10 text-red-700 dark:text-red-300 hover:bg-red-400/20 disabled:opacity-50 disabled:cursor-not-allowed transition-colors shrink-0`,title:`Reset retry counter and force immediate reload`,children:[l(M,{className:`h-3 w-3 ${Y.isPending||X.retrying?`animate-spin`:``}`}),`Retry now`]})]}),i(`div`,{className:`flex items-start gap-3 px-4 py-3`,children:[l(we,{isBundle:U||!!L.components&&L.components.length>1,installSource:q,addonId:U?_.addons[0]?.manifest.id:L.id,iconPath:U?_.bundle?.icon??_.addons[0]?.manifest.icon:L.icon,color:U?_.addons[0]?.manifest.color:L.color}),i(`div`,{className:`flex-1 min-w-0`,children:[i(`div`,{className:`flex items-start justify-between gap-2`,children:[l(`span`,{className:`text-sm font-semibold text-foreground truncate min-w-0`,children:W}),!r&&l(Te,{version:K,availableUpdate:a,...D===void 0?{}:{selectedVersion:D},isUpdating:m,installSource:q,disabled:y,...p&&D!==void 0?{onUpdate:()=>p(D)}:{},onOpenPicker:()=>T(e=>!e),children:ie&&l(Se,{packageName:G,currentVersion:K,...q?{installSource:q}:{},...a!==void 0&&D!==void 0?{selectedVersion:D,onSelect:e=>{E(e),T(!1)}}:{},onInstall:e=>{T(!1),be.mutate({packageName:G,version:e})},onClose:()=>T(!1)})})]}),i(`div`,{className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 mt-0.5`,children:[G!==W&&l(`span`,{className:`text-[10px] text-foreground-subtle font-mono truncate max-w-full`,children:G}),U&&i(`span`,{className:`text-[10px] rounded-full bg-primary/10 text-primary px-2 py-0.5 font-medium shrink-0 inline-flex items-center gap-1`,children:[l(_e,{className:`h-3 w-3`}),_.addons.length]}),b&&i(`span`,{className:`text-[10px] rounded-full bg-amber-500/15 text-amber-700 dark:text-amber-300 px-2 py-0.5 font-medium shrink-0 inline-flex items-center gap-1`,title:`System package — updating restarts the hub`,children:[l(M,{className:`h-3 w-3`}),`System`]}),v!=null&&l(Ce,{item:v}),h!=null&&l(xe,{progress:h})]}),ve&&l(`p`,{className:`text-[10px] text-foreground-subtle mt-1 line-clamp-1`,children:ve}),!U&&e.process&&i(`div`,{className:`flex flex-wrap items-center gap-1.5 mt-1`,children:[l(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium ${e.process.mode===`forked`?`bg-blue-500/15 text-blue-400`:`bg-gray-500/15 text-gray-400`}`,children:e.process.mode===`forked`?`forked`:`in-process`}),e.process.pid!=null&&i(`span`,{className:`text-[9px] font-mono text-foreground-subtle`,children:[`PID `,e.process.pid]}),l(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium ${e.process.state===`running`?`bg-emerald-500/15 text-emerald-400`:e.process.state===`crashed`||e.process.state===`failed`?`bg-red-500/15 text-red-400`:`bg-gray-500/15 text-gray-400`}`,children:e.process.state})]})]})]}),!U&&i(`div`,{className:`flex items-center gap-1 px-4 py-1.5 border-t border-border/50 bg-surface-hover/20`,children:[i(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),ye.mutate({addonId:L.id})},disabled:ye.isPending||y,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border border-border text-foreground-subtle hover:text-blue-400 hover:border-blue-500/30 hover:bg-blue-500/10 disabled:opacity-50 transition-colors`,children:[l(M,{className:`h-3 w-3 ${ye.isPending?`animate-spin`:``}`}),`Restart`]}),i(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),O(e=>!e)},className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border transition-colors ${ce?`border-primary/30 bg-primary/10 text-primary`:`border-border text-foreground-subtle hover:text-foreground hover:border-primary/30 hover:bg-primary/10`}`,children:[l(V,{className:`h-3 w-3`}),`Logs`]}),!U&&i(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),k(!0)},className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border transition-colors ${le?`border-primary/30 bg-primary/10 text-primary`:`border-border text-foreground-subtle hover:text-foreground hover:border-primary/30 hover:bg-primary/10`}`,children:[l(pe,{className:`h-3 w-3`}),`Settings`]}),l(`div`,{className:`flex-1`}),fe&&i(`button`,{type:`button`,onClick:async e=>{e.stopPropagation(),await I({title:`Uninstall ${L.name}?`,message:`This will remove the addon package and all its data. This action cannot be undone.`,confirmLabel:`Uninstall`,variant:`danger`})&&J.mutate({packageName:L.packageName})},disabled:J.isPending||y,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border border-border text-foreground-subtle hover:text-red-400 hover:border-red-500/30 hover:bg-red-500/10 disabled:opacity-50 transition-colors`,children:[l(H,{className:`h-3 w-3`}),J.isPending?`Removing...`:`Uninstall`]})]}),n&&n.nodes.length>1&&!U&&i(`div`,{className:`border-t border-border px-4 py-2 bg-muted/10`,children:[l(`div`,{className:`text-[10px] font-medium text-foreground-subtle mb-1.5`,children:`Cluster Deployment`}),l(`div`,{className:`space-y-1`,children:n.nodes.map(e=>i(`div`,{className:`flex items-center gap-2 text-[10px]`,children:[l(`div`,{className:`h-1.5 w-1.5 rounded-full shrink-0 ${e.status===`offline`?`bg-muted-foreground/30`:e.synced?`bg-success`:`bg-amber-500`}`}),l(`span`,{className:`font-medium text-foreground min-w-[60px]`,children:e.name}),l(`span`,{className:`font-mono text-foreground-subtle`,children:e.version}),!e.synced&&e.status!==`offline`&&l(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-amber-500/10 text-amber-400 border border-amber-500/20`,children:`outdated`}),e.status===`offline`&&l(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-muted text-muted-foreground`,children:`offline`}),e.synced&&e.status!==`offline`&&l(`span`,{className:`text-[9px] text-success`,children:`synced`})]},e.nodeId))})]}),ce&&!U&&i(`div`,{className:`border-t border-border`,children:[i(`div`,{className:`flex items-center px-4 py-1 bg-surface-hover/20 border-b border-border/50`,children:[i(`div`,{className:`flex rounded border border-border overflow-hidden text-[9px]`,children:[l(`button`,{type:`button`,onClick:()=>j(`logs`),className:`px-2 py-0.5 transition-colors ${A===`logs`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:`Logs`}),l(`button`,{type:`button`,onClick:()=>j(`events`),className:`px-2 py-0.5 border-l border-border transition-colors ${A===`events`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:`Events`})]}),l(`div`,{className:`flex-1`}),l(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),O(!1)},className:`text-foreground-subtle hover:text-foreground`,children:l(B,{className:`h-3.5 w-3.5`})})]}),A===`logs`&&l(re,{addonId:L.id,maxHeight:`max-h-64`,showFilters:!1}),A===`events`&&l(g,{addonId:L.id,category:`addon.*`,maxHeight:`max-h-64`})]}),U&&i(o,{children:[l(`button`,{type:`button`,onClick:()=>S(e=>!e),className:`w-full flex items-center justify-center border-t border-border py-1 hover:bg-surface-hover/50 transition-colors`,children:l(te?he:R,{className:`h-3.5 w-3.5 text-foreground-subtle`})}),te&&l(`div`,{className:`border-t border-border px-3 py-2 space-y-2`,children:_.addons.map(e=>l(De,{addon:e,agents:t,hideVersion:!0},e.manifest.id))})]}),le&&!U&&l(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4`,onClick:()=>k(!1),children:i(`div`,{className:`w-full max-w-lg max-h-[80vh] rounded-xl border border-border bg-surface shadow-2xl flex flex-col overflow-hidden`,onClick:e=>e.stopPropagation(),children:[i(`div`,{className:`flex items-center justify-between px-5 py-3 border-b border-border flex-shrink-0`,children:[i(`div`,{className:`flex items-center gap-2`,children:[l(pe,{className:`h-4 w-4 text-primary`}),i(`h2`,{className:`text-sm font-semibold text-foreground`,children:[W,` Settings`]})]}),l(`button`,{onClick:()=>k(!1),className:`text-foreground-subtle hover:text-foreground transition-colors p-1 rounded`,children:l(B,{className:`h-4 w-4`})})]}),i(`div`,{className:`flex-1 overflow-y-auto px-5 py-4 space-y-4`,children:[l(me,{nodeId:`hub`,addonIds:[L.id],level:`global`}),Z(L)&&i(`div`,{children:[l(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:`Device export`}),l(ne,{addonId:L.id,trpc:P.trpcClient,onOpenDevice:e=>F(`/devices/${e}`)})]}),q===`npm`&&i(`div`,{children:[l(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:`Auto-Update`}),l(Ee,{addonId:L.id})]}),L.components&&L.components.length>0&&i(`div`,{children:[i(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:[`Components (`,L.components.length,`)`]}),l(`div`,{className:`flex flex-wrap gap-1`,children:L.components.map(e=>l(`span`,{className:`text-[10px] rounded bg-background border border-border px-1.5 py-0.5 text-foreground-subtle font-mono`,children:e},e))})]}),t.length>=2&&i(`div`,{children:[l(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:`Installed on`}),i(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[z.length===0&&l(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Hub (local)`}),z.map(e=>l(`span`,{className:`rounded-full bg-surface-hover border border-border px-2 py-0.5 text-[10px] text-foreground-subtle`,children:e},e)),i(`div`,{className:`relative`,children:[i(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),w(e=>!e)},className:`inline-flex items-center gap-1 rounded-full border border-dashed border-border px-2 py-0.5 text-[10px] text-foreground-subtle hover:text-foreground hover:border-primary transition-colors`,title:`Install on more agents`,children:[l(ue,{className:`h-3 w-3`}),`Add agent`]}),C&&i(`div`,{className:`absolute left-0 top-full mt-1 z-10 min-w-[160px] rounded-md border border-border bg-surface shadow-lg overflow-hidden`,children:[t.filter(e=>!e.isHub&&!z.includes(e.name)).map(e=>l(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),w(!1)},className:`w-full text-left px-3 py-1.5 text-[10px] text-foreground hover:bg-surface-hover transition-colors`,children:e.name},e.id)),t.filter(e=>!e.isHub&&!z.includes(e.name)).length===0&&l(`div`,{className:`px-3 py-1.5 text-[10px] text-foreground-subtle`,children:`No available agents`})]})]})]})]})]}),l(`div`,{className:`flex items-center justify-end px-5 py-3 border-t border-border flex-shrink-0`,children:l(`button`,{type:`button`,onClick:()=>k(!1),className:`rounded-lg border border-border px-3 py-1.5 text-xs font-medium text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors`,children:`Close`})})]})})]})}n();var Q=`.tgz,.tar.gz,.zip`;function Oe({onUploadSuccess:n}){let[r,a]=c(!1),s=t(null),u=e(async e=>{a(!0);let t=new FormData;t.append(`file`,e);let r=localStorage.getItem(`camstack_admin_token`)??``;try{(await(await fetch(`/api/addons/upload`,{method:`POST`,headers:{Authorization:`Bearer ${r}`},body:t})).json()).success&&n()}finally{a(!1)}},[n]);return i(o,{children:[l(`input`,{ref:s,type:`file`,accept:Q,onChange:e(e=>{let t=e.target.files?.[0];t&&u(t),e.target.value=``},[u]),className:`hidden`}),i(`button`,{type:`button`,onClick:()=>s.current?.click(),disabled:r,className:`flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-md bg-surface hover:bg-surface-hover border border-border disabled:opacity-50 transition-colors`,children:[r?l(F,{className:`w-3.5 h-3.5 animate-spin`}):l(P,{className:`w-3.5 h-3.5`}),r?`Uploading...`:`Upload`]})]})}n();var ke=[{seconds:900,label:`15m`},{seconds:3600,label:`1h`},{seconds:21600,label:`6h`},{seconds:43200,label:`12h`},{seconds:86400,label:`24h`}],Ae=new Set([`@camstack/system`,`@camstack/types`,`@camstack/sdk`,`@camstack/shm-ring`,`@camstack/ui-library`]);function je(e){return e!==void 0&&Ae.has(e)}function Me(e,t){let n=e??`hub-only`;return n===`any-node`?!0:n===`hub-only`?t:!t}function Ne(e){let t=e;if(!t?.manifest)return null;let n={...t.manifest,name:t.manifest.name??t.manifest.id,version:t.manifest.version??`0.0.0`,capabilities:t.manifest.capabilities??[]},r=t.process,i=r?{pid:r.pid,mode:r.mode===`forked`?`forked`:`in-process`,state:r.state??`unknown`}:void 0,a=t.health,o=t.declaration?.execution,s=t.manifest.execution,c=o?.placement??s?.placement;return{manifest:n,enabled:!0,source:t.source,installSource:t.installSource,installedOn:[],...i?{process:i}:{},hasBackup:t.hasBackup,...a?{health:a}:{},...c?{placement:c}:{}}}function Pe(e){let t=new Map,n=[];for(let r of e){let e=r.manifest.packageName;if(!e){n.push(r);continue}let i=t.get(e);if(i)i.addons.push(r);else{let n=r.manifest.bundle,i={packageName:e,displayName:n?.displayName??r.manifest.packageDisplayName??r.manifest.name,version:r.manifest.packageVersion,addons:[r],...r.installSource===void 0?{}:{installSource:r.installSource},...n===void 0?{}:{bundle:n}};t.set(e,i)}}let r=[];for(let e of t.values())e.bundle!==void 0||e.addons.length>=2?r.push({bundle:e,representative:e.addons[0]}):r.push(e.addons[0]);return r.push(...n),r}function $(e){return`bundle`in e}function Fe({addons:n,clusterStatus:o,selectedNode:d,onRefresh:f,isRefreshing:p}){let m=s(),[g,ee]=c(``),b=r(g),[x,ne]=c(!1),S=t(null);u(()=>{if(!x)return;let e=e=>{S.current&&!S.current.contains(e.target)&&ne(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[x]);let{data:C}=y({nodeId:d.id}),re=a(()=>{let e=new Map;for(let t of C??[])e.set(t.name,t.latestVersion);return e},[C]),w=a(()=>(C??[]).filter(e=>!e.isSystem).length,[C]),[ie,T]=c(()=>new Set),[oe,E]=c(()=>new Map),O=e(e=>{T(t=>new Set(t).add(e))},[]),k=e(e=>{T(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n})},[]),A=e((e,t)=>{E(n=>new Map(n).set(e,t))},[]),ue=e(e=>{E(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),P=le({onMutate:e=>{O(e.name),ue(e.name)},onSuccess:(e,t)=>{k(t.name);let n=e;if(n&&n.success===!1){A(t.name,n.error??`Update failed (no error message returned by server)`);return}m.invalidateQueries({queryKey:[[`addons`]]}),m.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]})},onError:(e,t)=>{k(t.name),A(t.name,e instanceof Error?e.message:String(e))}}),de=ye(),I=t(new Set);u(()=>{let e=new Set;for(let[t,n]of de)ve(n)&&e.add(t);let t=[...I.current].some(t=>!e.has(t));I.current=e,t&&(m.invalidateQueries({queryKey:[[`addons`]]}),m.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]}))},[de,m]);let{data:R}=ce(void 0),fe=D({onSuccess:()=>{m.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),B=h({onSuccess:()=>{m.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),{data:V,isFetching:pe}=v({query:b||void 0},{enabled:x}),H=_(),{data:W}=te(void 0),me=W?.requestedAt,[he,ge]=c(null),[_e,G]=c(!1);u(()=>{if(W?.kind===`framework-bulk-update`&&W.requestedAt!==he){ge(W.requestedAt),G(!0);let e=window.setTimeout(()=>G(!1),6e3);return()=>window.clearTimeout(e)}},[me,he,W]),ae();let K=e(async()=>{let e=(C??[]).filter(e=>!e.isSystem);if(e.length!==0){if(!d.isHub){for(let t of e)await P.mutateAsync({name:t.name,version:t.latestVersion,nodeId:d.id});return}await H.mutateAsync({kind:`update`,targets:e.map(e=>({name:e.name,version:e.latestVersion})),nodeIds:[d.id]})}},[C,d.id,d.isHub,H,P]),q=se({onSuccess:()=>{m.invalidateQueries({queryKey:[[`addons`]]}),m.invalidateQueries({queryKey:[[`addonPages`]]}),m.invalidateQueries({queryKey:[[`capabilities`]]}),m.invalidateQueries({queryKey:[[`integrations`]]})}}),[J,be]=c(`type`),[xe,Se]=c(()=>typeof window>`u`?`grouped`:window.localStorage.getItem(`camstack.addons.viewMode`)===`flat`?`flat`:`grouped`),Y=e=>{Se(e),typeof window<`u`&&window.localStorage.setItem(`camstack.addons.viewMode`,e)},[Ce,X]=z(),Z=Ce.get(`capability`),we=a(()=>{let e=n.filter(e=>!je(e.manifest.packageName));return d.isHub||(e=e.filter(e=>Me(e.placement,d.isHub))),Z&&(e=e.filter(e=>(e.manifest.capabilities??[]).some(e=>(typeof e==`string`?e:e.name)===Z))),e},[n,d.isHub,Z]),Te=()=>{let e=new URLSearchParams(Ce);e.delete(`capability`),X(e,{replace:!0})},Ee=xe===`flat`?we:Pe(we),Q=a(()=>{let e=[...Ee];switch(J){case`type`:e.sort((e,t)=>{let n=+!$(e),r=+!$(t);if(n!==r)return n-r;let i=$(e)?e.bundle.displayName:e.manifest.name,a=$(t)?t.bundle.displayName:t.manifest.name;return i.localeCompare(a)});break;case`name`:e.sort((e,t)=>{let n=$(e)?e.bundle.displayName:e.manifest.name,r=$(t)?t.bundle.displayName:t.manifest.name;return n.localeCompare(r)});break;case`source`:e.sort((e,t)=>{let n=$(e)?e.bundle.installSource??``:e.installSource??``,r=$(t)?t.bundle.installSource??``:t.installSource??``;return n.localeCompare(r)});break}return e},[Ee,J]);return i(`div`,{className:`space-y-4`,children:[[...oe.entries()].map(([e,t])=>l(`div`,{className:`rounded-md border border-danger/30 bg-danger/5 px-3 py-2 text-[11px]`,children:i(`div`,{className:`flex items-start justify-between gap-3`,children:[i(`div`,{className:`space-y-0.5`,children:[i(`div`,{className:`font-medium text-danger`,children:[`Failed to update `,e]}),l(`div`,{className:`text-foreground-subtle font-mono`,children:t})]}),l(`button`,{type:`button`,onClick:()=>ue(e),className:`text-foreground-subtle hover:text-foreground text-[10px]`,children:`dismiss`})]})},e)),i(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[i(`div`,{className:`flex items-center gap-1.5`,children:[l(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Sort:`}),i(`select`,{value:J,onChange:e=>be(e.target.value),className:`rounded-md border border-border bg-surface px-2 py-1.5 text-[11px] text-foreground focus:outline-none focus:border-primary/50`,children:[l(`option`,{value:`type`,children:`Bundles first`}),l(`option`,{value:`name`,children:`Name`}),l(`option`,{value:`source`,children:`Install source`})]})]}),i(`div`,{className:`flex items-center gap-1.5`,children:[l(`span`,{className:`text-[10px] text-foreground-subtle`,children:`View:`}),l(`div`,{className:`flex rounded-md border border-border overflow-hidden text-[10px] font-medium`,children:[`grouped`,`flat`].map(e=>l(`button`,{type:`button`,onClick:()=>Y(e),className:`px-2.5 py-1.5 transition-colors capitalize ${xe===e?`bg-primary/10 text-primary`:`bg-transparent text-foreground-subtle hover:bg-surface-hover`}`,title:e===`grouped`?`Group multi-addon packages into a bundle card`:`Show every addon as its own card`,children:e},e))})]}),d.isHub&&i(`div`,{className:`flex items-center gap-1.5`,children:[l(M,{className:`h-3 w-3 text-foreground-subtle`}),l(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Auto-Update:`}),l(`div`,{className:`flex rounded-md border border-border overflow-hidden text-[10px] font-medium`,children:[`off`,`latest`,`beta`].map(e=>l(`button`,{type:`button`,onClick:()=>fe.mutate({channel:e}),disabled:fe.isPending,className:`px-2.5 py-1.5 transition-colors capitalize ${R?.channel===e?e===`off`?`bg-gray-700 text-gray-200`:e===`latest`?`bg-blue-500/20 text-blue-400`:`bg-amber-500/20 text-amber-400`:`bg-transparent text-foreground-subtle hover:bg-surface-hover`} ${e===`off`?``:`border-l border-border`}`,children:e},e))})]}),d.isHub&&i(`div`,{className:`flex items-center gap-1.5`,children:[l(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Check every:`}),l(`select`,{className:`rounded-md border border-border bg-transparent px-1.5 py-1 text-[10px] font-medium text-foreground-subtle`,value:R?.updateCheckIntervalSeconds??21600,disabled:B.isPending||R===void 0,onChange:e=>{R!==void 0&&B.mutate({channel:R.channel,updateCheckIntervalSeconds:Number(e.target.value)})},children:ke.map(e=>l(`option`,{value:e.seconds,children:e.label},e.seconds))})]}),w>0&&i(`button`,{type:`button`,onClick:()=>void K(),disabled:H.isPending,className:`flex items-center gap-1.5 px-2.5 py-1.5 text-[11px] rounded-md bg-blue-500/10 text-blue-400 hover:bg-blue-500/20 border border-blue-500/30 disabled:opacity-50 transition-colors font-medium`,children:[H.isPending?l(F,{className:`w-3 h-3 animate-spin`}):l(j,{className:`w-3 h-3`}),H.isPending?`Updating…`:`Update All (${w})`]}),i(`button`,{type:`button`,onClick:f,disabled:p||H.isPending,className:`flex items-center gap-1.5 px-2.5 py-1.5 text-[11px] rounded-md bg-surface hover:bg-surface-hover border border-border disabled:opacity-50 transition-colors`,children:[l(M,{className:`w-3 h-3 ${p?`animate-spin`:``}`}),`Refresh`]})]}),i(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3`,children:[i(`div`,{className:`relative flex-1 min-w-0 sm:min-w-[200px]`,ref:S,children:[l(N,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-foreground-subtle`}),l(`input`,{type:`text`,value:g,onChange:e=>{ee(e.target.value),ne(!0)},onFocus:()=>ne(!0),placeholder:`Search addons on npm...`,disabled:H.isPending,className:`w-full rounded-lg border border-border bg-background pl-9 pr-3 py-2 text-xs text-foreground placeholder:text-foreground-subtle focus:outline-none focus:ring-1 focus:ring-primary disabled:opacity-50 disabled:cursor-not-allowed`}),pe&&l(F,{className:`absolute right-2.5 top-1/2 -translate-y-1/2 h-3 w-3 text-foreground-subtle animate-spin`}),x&&V&&V.length>0&&i(`div`,{className:`absolute left-0 right-0 top-full mt-1 z-40 rounded-lg border border-border bg-surface shadow-xl overflow-hidden`,children:[V.length>0&&i(`div`,{className:`px-3 py-1.5 text-[10px] uppercase tracking-wide text-foreground-subtle border-b border-border`,children:[`npm results (`,V.length,`)`]}),V&&V.length>0&&l(`div`,{className:`max-h-72 overflow-auto divide-y divide-border`,children:V.map(e=>i(`div`,{className:`flex items-center gap-3 px-3 py-2 hover:bg-surface-hover transition-colors`,children:[l(`div`,{className:`w-6 h-6 rounded-md bg-primary/10 flex items-center justify-center text-primary text-[9px] font-bold shrink-0`,children:e.name.replace(`@camstack/addon-`,``).charAt(0).toUpperCase()}),i(`div`,{className:`flex-1 min-w-0`,children:[i(`div`,{className:`flex items-baseline gap-2 min-w-0`,children:[l(`span`,{className:`text-[11px] font-semibold break-words`,children:e.name.replace(/^@camstack\/(addon-)?/,``)}),i(`span`,{className:`text-[10px] text-foreground-subtle shrink-0`,children:[`v`,e.version]})]}),l(`div`,{className:`font-mono text-[9px] text-foreground-subtle/80 truncate`,children:e.name}),e.description&&l(`div`,{className:`text-[10px] text-foreground-subtle truncate`,children:e.description})]}),e.installed?i(`span`,{className:`inline-flex items-center gap-1 px-2 py-1 text-[10px] font-medium rounded-md border border-emerald-500/30 bg-emerald-500/10 text-emerald-400 shrink-0`,children:[l(U,{className:`h-3 w-3`}),e.installedVersion??`Installed`]}):i(`button`,{type:`button`,onClick:()=>q.mutate({packageName:e.name}),disabled:q.isPending,className:`inline-flex items-center gap-1 px-2 py-1 text-[10px] font-medium rounded-md bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 transition-colors shrink-0`,children:[q.isPending?l(F,{className:`h-3 w-3 animate-spin`}):l(j,{className:`h-3 w-3`}),`Install`]})]},e.name))})]})]}),l(Oe,{onUploadSuccess:()=>{m.invalidateQueries({queryKey:[[`addons`]]}),f()}})]}),Z&&i(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-lg bg-primary/10 border border-primary/30 text-sm`,children:[l(`span`,{className:`text-foreground-subtle`,children:`Filtering by capability:`}),l(`span`,{className:`font-mono text-primary font-semibold`,children:Z}),l(`button`,{type:`button`,onClick:Te,className:`ml-auto text-xs text-foreground-subtle hover:text-foreground underline`,children:`Clear`})]}),_e&&i(`div`,{className:`fixed top-[calc(env(safe-area-inset-top)+1rem)] right-[calc(env(safe-area-inset-right)+1rem)] z-50 flex items-start gap-2 px-3 py-2.5 rounded-md border border-green-500/30 bg-green-500/10 shadow-lg backdrop-blur-sm max-w-sm pointer-events-auto`,children:[l(L,{className:`w-4 h-4 shrink-0 mt-0.5 text-green-400`}),i(`div`,{children:[l(`div`,{className:`text-[11px] font-semibold text-foreground`,children:`Bulk update completed`}),l(`div`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:`System packages updated — hub restarted successfully.`})]})]}),we.length===0&&l(`div`,{className:`text-xs text-foreground-subtle`,children:n.length===0?`No addons installed`:Z?`No installed addons declare the "${Z}" capability. Browse the npm catalog above to find a compatible addon.`:`No addons compatible with ${d.name} (placement filter active)`}),l(`div`,{className:`space-y-2`,children:Q.map(e=>{let t=$(e)?e.bundle.packageName:e.manifest.packageName,n=re.get(t),r=$(e)?e.representative:e,i=n?e=>P.mutate({name:t,version:e,nodeId:d.id}):void 0,a=de.get(t)??null,s=a!==null&&ve(a);return l(De,{addon:r,clusterStatus:o?.[r.manifest.id],bundle:$(e)?e.bundle:void 0,availableUpdate:n,isUpdating:ie.has(t)||s,jobProgress:a,onUpdate:i,disabledByBulk:H.isPending},$(e)?t:e.manifest.id)})})]})}function Ie(){let e=s(),{data:n,isLoading:r,isError:o}=S(),{data:d}=C(void 0),{data:f}=w(void 0,{refetchInterval:1e4}),p=a(()=>{let e=new Map;e.set(`hub`,{id:`hub`,name:`Hub`,isHub:!0});for(let t of f??[]){let n=String(t.id??``);n&&e.set(n,{id:n,name:String(t.name??n),isHub:!!t.isHub})}return[...e.values()]},[f]),[m,h]=c(`hub`),g=p.find(e=>e.id===m)??p[0],_=O(),ee=oe(),v=_.isPending||ee.isPending,y=async()=>{await _.mutateAsync({nodeId:m}),await ee.mutateAsync(),e.invalidateQueries({queryKey:[[`addons`]]})},b=t(_);b.current=_,u(()=>{b.current.mutate({nodeId:`hub`})},[]);let x=(n??[]).map(Ne).filter(e=>e!==null);return i(W,{children:[i(`div`,{className:`flex items-center justify-between gap-3 flex-wrap`,children:[l(T,{selectedNodeId:m,onSelect:h}),i(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[!r&&!o&&i(`span`,{className:`text-[10px] rounded-full bg-primary/10 text-primary px-2 py-0.5 font-medium`,children:[x.length,` installed`]}),i(`button`,{type:`button`,onClick:()=>void y(),disabled:v,className:`inline-flex items-center gap-1.5 px-2.5 py-1.5 text-[11px] rounded-md bg-surface hover:bg-surface-hover border border-border disabled:opacity-50 transition-colors`,title:`Re-fetch addons + check npm for new versions`,children:[l(M,{className:`w-3 h-3 ${v?`animate-spin`:``}`}),`Check for updates`]})]})]}),!g.isHub&&i(`div`,{className:`rounded-md border border-warning/30 bg-warning/5 px-3 py-2 text-[11px] text-foreground-subtle`,children:[`Showing only addons compatible with`,` `,l(`span`,{className:`font-medium text-foreground`,children:g.name}),` — agents only run`,` `,l(`code`,{className:`font-mono`,children:`agent-only`}),` and`,` `,l(`code`,{className:`font-mono`,children:`any-node`}),` addons. Install / uninstall is hub-driven; agents auto-sync from the hub.`]}),r&&l(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading…`}),o&&l(`div`,{className:`text-xs text-danger`,children:`Failed to load addons`}),!r&&!o&&l(Fe,{addons:x,clusterStatus:d,selectedNode:g,onRefresh:()=>void y(),isRefreshing:v})]})}export{Ie as AddonsPage};
@@ -1 +0,0 @@
1
- import{K 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{As as l,At as u,Et as d,It as f,Mt as p,Ot as m,Rt as h,ai as g,ci as _,di as v,dn as y,ei as b,fi as x,ii as S,jt as C,kt as w,li as T,ni as E,oi as D,ri as O,si as k,ti as A,ui as j,zr as ee,zt as M}from"./src-DVZrqMsD.js";import{Pt as N}from"./src-C9CFJqET.js";import{a as P,i as F,n as I,r as te,t as L}from"./face-bbox-BOyxoUe0.js";import{a as ne,c as re,f as R,i as ie,l as ae,m as z,n as B,o as oe,p as V,r as se,s as ce,t as le,u as ue}from"./debounced-invalidate-Bo_vaBxo.js";import{t as H}from"./pencil-BOy-rDbD.js";import{t as U}from"./plus-uTnAmy5n.js";import{t as de}from"./refresh-cw-BRs_7wGu.js";import{t as W}from"./square-check-big-DO81u3O2.js";import{t as G}from"./square-BFMdi_Qm.js";import{t as K}from"./undo-2-LIqqVOPk.js";import{C as q,I as J,K as fe,R as pe,h as me,i as Y,l as he,s as X,z as Z}from"./index-DM4pp8Vx.js";import{t as Q}from"./AdminPage-CCD07UMs.js";import{r as ge,t as _e}from"./authed-media-BPd_L9jr.js";var ve=fe(`user-round`,[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]]);t();var $=[[`faceGallery`]];function ye({identityId:e}){let t=a(),{data:r,isLoading:i}=D({identityId:e}),o=_();function c(n){o.mutate({identityId:e,sampleId:n.id},{onSettled:()=>{t.invalidateQueries({queryKey:$})}})}return i?n(`div`,{className:`flex items-center gap-2 py-3 text-xs text-foreground-subtle`,children:[s(q,{className:`h-3.5 w-3.5 animate-spin`}),`Loading samples…`]}):!r||r.length===0?s(`p`,{className:`py-2 text-xs text-foreground-subtle`,children:`No samples yet.`}):s(`div`,{className:`mt-2 grid grid-cols-4 gap-2 sm:grid-cols-6 md:grid-cols-8`,children:r.map(e=>n(`div`,{className:`group relative aspect-square overflow-hidden rounded-md border border-border bg-surface`,children:[e.base64?s(`img`,{src:`data:image/jpeg;base64,${e.base64}`,alt:`Sample`,className:`h-full w-full object-cover`}):s(`div`,{className:`flex h-full w-full items-center justify-center text-foreground-subtle`,children:s(ve,{className:`h-6 w-6`})}),s(`button`,{type:`button`,onClick:()=>c(e),disabled:o.isPending,className:`absolute inset-0 flex items-center justify-center bg-black/50 opacity-0 transition-opacity group-hover:opacity-100 disabled:cursor-not-allowed`,"aria-label":`Remove sample`,children:s(Y,{className:`h-4 w-4 text-white`})})]},e.id))})}function be({identity:e,expanded:t,onToggle:r}){let c=a(),[l,g]=o(``),[_,v]=o(!1),[y,b]=o(!1),x=T(),S=O();function E(){g(e.name),v(!0)}function D(){v(!1),g(``)}function k(){let t=l.trim();if(!t||t===e.name){D();return}x.mutate({id:e.id,name:t},{onSettled:()=>{c.invalidateQueries({queryKey:$}),D()}})}function A(){S.mutate({id:e.id},{onSettled:()=>{c.invalidateQueries({queryKey:$}),b(!1)}})}return n(`div`,{className:`rounded-md border border-border bg-surface`,children:[n(`div`,{className:`flex items-center gap-2 px-3 py-2`,children:[s(`div`,{className:`h-8 w-8 shrink-0 overflow-hidden rounded-full border border-border bg-surface-hover`,children:e.coverBase64?s(`img`,{src:`data:image/jpeg;base64,${e.coverBase64}`,alt:e.name,className:`h-full w-full object-cover`}):s(`div`,{className:`flex h-full w-full items-center justify-center`,children:s(ve,{className:`h-4 w-4 text-foreground-subtle`})})}),s(`div`,{className:`flex flex-1 min-w-0 items-center gap-2`,children:_?n(i,{children:[s(f,{value:l,onChange:e=>g(e.target.value),onKeyDown:e=>{e.key===`Enter`&&k(),e.key===`Escape`&&D()},className:`h-6 text-xs`,autoFocus:!0}),s(`button`,{type:`button`,onClick:k,disabled:x.isPending,className:`text-success hover:text-success/80 disabled:opacity-50`,"aria-label":`Confirm rename`,children:s(Z,{className:`h-3.5 w-3.5`})}),s(`button`,{type:`button`,onClick:D,className:`text-foreground-subtle hover:text-foreground`,"aria-label":`Cancel rename`,children:s(Y,{className:`h-3.5 w-3.5`})})]}):s(`span`,{className:`truncate text-sm font-medium text-foreground`,children:e.name})}),s(h,{variant:`default`,className:`text-[10px]`,children:e.sampleCount}),!_&&n(`div`,{className:`flex items-center gap-1`,children:[s(`button`,{type:`button`,onClick:E,className:`p-1 rounded hover:bg-surface-hover text-foreground-subtle hover:text-foreground`,"aria-label":`Rename`,children:s(H,{className:`h-3.5 w-3.5`})}),s(`button`,{type:`button`,onClick:()=>b(!0),className:`p-1 rounded hover:bg-danger/10 text-foreground-subtle hover:text-danger`,"aria-label":`Delete`,children:s(X,{className:`h-3.5 w-3.5`})})]}),s(`button`,{type:`button`,onClick:r,className:`p-1 rounded hover:bg-surface-hover text-foreground-subtle`,"aria-label":t?`Collapse`:`Expand`,children:s(t?pe:J,{className:`h-3.5 w-3.5`})})]}),t&&s(`div`,{className:`border-t border-border px-3 pb-3 pt-2`,children:s(ye,{identityId:e.id})}),s(d,{open:y,onOpenChange:e=>!e&&b(!1),children:n(m,{children:[n(C,{children:[s(p,{children:`Delete person`}),n(w,{children:[`Delete `,s(`strong`,{children:e.name}),` and all their samples? This cannot be undone.`]})]}),n(u,{children:[s(M,{variant:`secondary`,onClick:()=>b(!1),children:`Cancel`}),n(M,{variant:`danger`,onClick:A,disabled:S.isPending,children:[S.isPending?s(q,{className:`h-3.5 w-3.5 animate-spin`}):null,`Delete`]})]})]})})]})}function xe(){let e=a(),[t,r]=o(``),i=A();function c(){let n=t.trim();n&&i.mutate({name:n},{onSettled:()=>{e.invalidateQueries({queryKey:$}),r(``)}})}return n(`div`,{className:`flex items-center gap-2 pt-2`,children:[s(f,{placeholder:`New person name…`,value:t,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&c()},className:`h-7 text-xs flex-1`}),n(M,{variant:`primary`,size:`sm`,onClick:c,disabled:i.isPending||!t.trim(),children:[i.isPending?s(q,{className:`h-3.5 w-3.5 animate-spin`}):s(U,{className:`h-3.5 w-3.5`}),`Add`]})]})}function Se(){let{data:e,isLoading:t}=g(),[r,i]=o(null);function a(e){i(t=>t===e?null:e)}return t?n(`div`,{className:`flex items-center gap-2 py-4 text-xs text-foreground-subtle`,children:[s(q,{className:`h-4 w-4 animate-spin`}),`Loading people…`]}):n(`div`,{className:`space-y-2`,children:[(!e||e.length===0)&&s(`p`,{className:`py-2 text-xs text-foreground-subtle`,children:`No people enrolled yet. Add one below.`}),e?.map(e=>s(be,{identity:e,expanded:r===e.id,onToggle:()=>a(e.id)},e.id)),s(xe,{})]})}function Ce(e){let t=e.cropUrl!==void 0&&e.cropUrl.length>0,n=e.base64!==void 0&&e.base64.length>0;return!t&&!n}function we(e){return e.filter(Ce).map(e=>e.faceId)}function Te(e){let t=0;for(let n of e)Ce(n)&&(t+=1);return t}function Ee(e){return e==null?null:e.cropUrl!==void 0&&e.cropUrl.length>0?e.cropUrl:e.base64!==void 0&&e.base64.length>0?`data:image/jpeg;base64,${e.base64}`:null}t();var De=[[`faceGallery`]];function Oe({faceIds:e,identities:t,onDone:r}){let i=a(),c=b(),l=A(),[h,g]=o(``),[_,v]=o(!1),[y,x]=o(null),S=e!==null&&e.length>0,T=e?.length??0;function E(){v(!1),g(``),x(null)}function D(){E(),r()}function O(t){!e||e.length===0||c.mutate({faceIds:[...e],identityId:t},{onSettled:()=>{i.invalidateQueries({queryKey:De}),D()}})}function k(){!e||!h.trim()||l.mutate({name:h.trim()},{onSuccess:e=>{e?.id&&O(e.id)},onError:()=>{i.invalidateQueries({queryKey:De}),D()}})}let j=c.isPending||l.isPending;return s(d,{open:S,onOpenChange:e=>!e&&D(),children:n(m,{children:[n(C,{children:[s(p,{children:T>1?`Assign ${String(T)} faces to person`:`Assign face to person`}),s(w,{children:`Select an existing person or create a new one.`})]}),s(`div`,{className:`space-y-1 max-h-56 overflow-y-auto`,children:t.map(e=>n(`button`,{type:`button`,onClick:()=>x(e.id),className:`w-full rounded-md px-3 py-2 text-left text-xs transition-colors ${y===e.id?`bg-primary/12 text-primary`:`hover:bg-surface-hover text-foreground`}`,children:[s(`span`,{className:`font-medium`,children:e.name}),n(`span`,{className:`ml-2 text-foreground-subtle`,children:[e.sampleCount,` samples`]})]},e.id))}),_?s(`div`,{className:`flex items-center gap-2 pt-2 border-t border-border`,children:s(f,{placeholder:`New person name…`,value:h,onChange:e=>g(e.target.value),onKeyDown:e=>{e.key===`Enter`&&k()},autoFocus:!0,className:`flex-1`})}):s(`button`,{type:`button`,onClick:()=>{x(null),v(!0)},className:`mt-2 w-full rounded-md border border-dashed border-border px-3 py-2 text-left text-xs text-foreground-subtle hover:border-primary hover:text-primary transition-colors`,children:`+ New person…`}),n(u,{children:[s(M,{variant:`secondary`,onClick:D,disabled:j,children:`Cancel`}),_?n(M,{variant:`primary`,onClick:k,disabled:j||!h.trim(),children:[j&&s(q,{className:`h-3.5 w-3.5 animate-spin`}),`Create & assign`]}):n(M,{variant:`primary`,onClick:()=>y&&O(y),disabled:j||!y,children:[j&&s(q,{className:`h-3.5 w-3.5 animate-spin`}),`Assign`,T>1?` ${String(T)}`:``]})]})]})})}t();function ke(e){let[t,n]=o(null),[r,i]=o(null),[a,s]=o(!1);return c(()=>{if(n(null),i(null),s(!1),!e)return;let t=!1,r=null;return(async()=>{try{let i=await ge(`${_e}/${encodeURIComponent(e)}`);if(t)return;r=URL.createObjectURL(i),n(r)}catch{t||s(!0)}})(),()=>{t=!0,r&&URL.revokeObjectURL(r)}},[e]),c(()=>{if(!t)return;let e=new Image;return e.onload=()=>i({width:e.naturalWidth,height:e.naturalHeight}),e.onerror=()=>s(!0),e.src=t,()=>{e.onload=null,e.onerror=null}},[t]),{frameSrc:t,naturalWidth:r?.width??null,naturalHeight:r?.height??null,failed:a}}function Ae(e){let t=e.filter(e=>e.base64.length>0);return t.length===0?null:t.find(e=>/crop|face/i.test(e.kind))??t[0]}function je({label:e,value:t}){return n(`div`,{className:`flex items-baseline justify-between gap-3 py-1.5 border-b border-border/60 last:border-0`,children:[s(`span`,{className:`shrink-0 text-[11px] uppercase tracking-wide text-foreground-subtle`,children:e}),s(`span`,{className:`min-w-0 truncate text-right text-xs font-medium text-foreground`,children:t})]})}function Me({box:e}){return s(`div`,{className:`pointer-events-none absolute rounded-[3px] border-2 border-primary shadow-[0_0_0_9999px_rgba(0,0,0,0.28)]`,style:{left:`${String(e.x*100)}%`,top:`${String(e.y*100)}%`,width:`${String(e.width*100)}%`,height:`${String(e.height*100)}%`},children:s(`span`,{className:`absolute -top-4 left-0 rounded bg-primary px-1 text-[9px] font-semibold uppercase tracking-wide text-white`,children:`Face`})})}function Ne({face:e,cameraName:t,onClose:i,onAssign:a,onUnassign:c,onDelete:l,actionsPending:u}){let{data:f,isFetching:p}=S({faceId:e?.faceId??``},{enabled:e!==null}),[h,g]=o(`frame`),{frameSrc:_,naturalWidth:v,naturalHeight:y,failed:b}=ke(e?.keyFrameMediaKey),x=r(()=>{let t=Ae(f??[]);return t?`data:image/jpeg;base64,${t.base64}`:Ee(e)},[f,e]),C=r(()=>!e?.faceBbox||v===null||y===null?null:L(e.faceBbox,v,y),[e?.faceBbox,v,y]);if(e===null)return null;let w=typeof e.keyFrameMediaKey==`string`&&e.keyFrameMediaKey.length>0&&!b,T=w&&h===`frame`,E=e.assigned?e.identityName??`Assigned`:e.recognizedIdentityId?`${e.identityName??`Recognized`} (suggested)`:`Unassigned`;return s(d,{open:!0,onOpenChange:e=>!e&&i(),children:n(m,{width:`lg`,placement:`sheet-on-mobile`,"aria-label":`Face detail`,className:`flex max-h-[92dvh] flex-col gap-0 overflow-hidden p-0 bottom-0 left-0 right-0 top-auto w-full max-w-full translate-x-0 translate-y-0 rounded-b-none md:bottom-auto md:left-1/2 md:right-auto md:top-1/2 md:w-[calc(100vw-2rem)] md:max-w-xl md:-translate-x-1/2 md:-translate-y-1/2 md:rounded-lg md:max-h-[calc(100dvh-2rem)]`,children:[n(`header`,{className:`flex shrink-0 items-start justify-between gap-2 border-b border-border px-4 py-3`,children:[n(`div`,{className:`min-w-0`,children:[s(`div`,{className:`truncate text-sm font-semibold text-foreground`,children:`Face detail`}),s(`div`,{className:`mt-0.5 truncate text-[11px] text-foreground-subtle`,children:t})]}),s(`button`,{type:`button`,onClick:i,className:`rounded p-1 text-foreground-subtle hover:bg-surface-hover hover:text-foreground`,"aria-label":`Close`,children:s(Y,{className:`h-4 w-4`})})]}),n(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto overscroll-contain px-4 py-3`,children:[w&&n(`div`,{className:`flex items-center gap-1 rounded-md border border-border p-0.5 text-xs`,children:[n(`button`,{type:`button`,onClick:()=>g(`frame`),className:`flex flex-1 items-center justify-center gap-1 rounded px-2 py-1 transition-colors ${h===`frame`?`bg-primary/12 font-medium text-primary`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground`}`,children:[s(F,{className:`h-3.5 w-3.5`}),` Full frame`]}),n(`button`,{type:`button`,onClick:()=>g(`crop`),className:`flex flex-1 items-center justify-center gap-1 rounded px-2 py-1 transition-colors ${h===`crop`?`bg-primary/12 font-medium text-primary`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground`}`,children:[s(P,{className:`h-3.5 w-3.5`}),` Crop`]})]}),T&&_?s(`div`,{className:`overflow-hidden rounded-lg border border-border bg-background`,children:s(B,{src:_,alt:`Full frame with detected face`,fit:`natural`,className:`w-full`,overlay:C?s(Me,{box:C}):void 0})}):x?n(`div`,{className:`relative aspect-square w-full overflow-hidden rounded-lg border border-border`,children:[s(B,{src:x,alt:`Detected face`,className:`h-full w-full`}),p&&s(`div`,{className:`absolute right-2 top-2 rounded-full bg-black/50 p-1 text-white`,children:s(q,{className:`h-3.5 w-3.5 animate-spin`})})]}):n(`div`,{className:`flex aspect-square w-full flex-col items-center justify-center gap-1.5 rounded-lg border border-border bg-warning/5 text-foreground-subtle`,children:[s(z,{className:`h-8 w-8 text-warning/70`}),s(`span`,{className:`text-[11px] font-medium uppercase tracking-wide text-warning/80`,children:`No image`}),s(`span`,{className:`px-6 text-center text-[10px] text-foreground-subtle`,children:`The crop media for this face could not be resolved (a pre-fix orphan). Safe to delete.`})]}),n(`div`,{className:`rounded-lg border border-border bg-surface px-3 py-1`,children:[s(je,{label:`Camera`,value:t}),s(je,{label:`Captured`,value:V(e.timestamp)}),s(je,{label:`Track`,value:e.trackId}),s(je,{label:`Identity`,value:E})]})]}),n(`footer`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-border px-4 py-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]`,children:[e.assigned?n(M,{variant:`secondary`,onClick:()=>c(e.faceId),disabled:u,children:[s(I,{className:`h-3.5 w-3.5`}),` Detach`]}):n(M,{variant:`primary`,onClick:()=>a(e.faceId),disabled:u,children:[s(te,{className:`h-3.5 w-3.5`}),` Assign`]}),n(M,{variant:`secondary`,onClick:()=>l(e.faceId),disabled:u,children:[s(X,{className:`h-3.5 w-3.5`}),` Delete`]})]})]})})}function Pe(e,t){let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n}function Fe(e,t){return e.faceIds.filter(e=>!t.has(e))}function Ie(e,t){return e.faceIds.filter(e=>t(e))}t();var Le=[[`faceGallery`]],Re=20,ze=.3,Be=.9,Ve=.05,He=.5,Ue=2,We=10,Ge=2;function Ke({cluster:e,face:t,active:r,onSelect:i}){let a=Ee(t);return n(`button`,{type:`button`,onClick:i,className:`flex shrink-0 flex-col items-center gap-1.5 rounded-md border p-2 text-center transition-colors md:w-full md:flex-row md:gap-2.5 md:text-left ${r?`border-primary bg-primary/8`:`border-border bg-surface hover:bg-surface-hover`}`,children:[s(`div`,{className:`h-24 w-24 shrink-0 overflow-hidden rounded bg-surface-hover`,children:a===null?s(z,{className:`h-24 w-24 p-6 text-foreground-subtle`}):s(`img`,{src:a,alt:``,loading:`lazy`,decoding:`async`,className:`h-24 w-24 object-cover`})}),n(`span`,{className:`w-24 text-[11px] leading-tight text-foreground-subtle md:w-auto`,children:[e.size,` faces · `,Math.round(e.cohesion*100),`% alike`]})]})}function qe({face:e,cameraName:t,nowMs:r,excluded:i,onToggleExclude:a,onDelete:o,deletePending:c}){let l=Ee(e);return n(`div`,{className:`relative flex flex-col rounded-md border bg-surface overflow-hidden transition-opacity ${i?`border-border opacity-40 grayscale`:`border-border`}`,children:[n(`div`,{className:`aspect-square relative overflow-hidden bg-surface-hover`,children:[l===null?n(`div`,{className:`flex h-full w-full flex-col items-center justify-center gap-1 bg-warning/5 text-foreground-subtle`,children:[s(z,{className:`h-7 w-7 text-warning/70`}),s(`span`,{className:`text-[9px] font-medium uppercase tracking-wide text-warning/80`,children:`No crop`})]}):s(B,{src:l,alt:`Face from ${t}`,className:`h-full w-full`}),s(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),a()},className:`absolute right-1 top-1 z-10 rounded-full bg-black/50 p-1.5 text-white hover:bg-black/70`,"aria-label":i?`Include face`:`Exclude face`,title:i?`Include`:`Exclude`,children:s(i?K:Y,{className:`h-3.5 w-3.5`})})]}),n(`div`,{className:`min-w-0 px-2 pt-1.5 space-y-0.5`,children:[s(`p`,{className:`text-[10px] font-medium text-foreground truncate`,title:t,children:t}),s(`p`,{className:`text-[10px] text-foreground-subtle truncate`,children:R(e.timestamp,r)})]}),s(`div`,{className:`mt-1 flex items-center justify-end border-t border-border/60 px-1 py-0.5`,children:s(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),o()},disabled:c,className:`rounded p-1.5 text-foreground-subtle transition-colors hover:bg-danger/10 hover:text-danger disabled:opacity-40`,"aria-label":`Delete face`,title:`Delete face`,children:c?s(q,{className:`h-4 w-4 animate-spin`}):s(X,{className:`h-4 w-4`})})})]})}function Je({open:e,onClose:t,byId:l,cameraName:u,nowMs:f,identities:p,selectMany:h}){let g=a(),_=y(),v=E(),[b,x]=o(He),[S,C]=o(Ge),[w,T]=o(null),[D,O]=o({}),[k,A]=o(null),{data:ee,isFetching:N,refetch:P}=j({threshold:b,minClusterSize:S,limit:Re},{enabled:e}),F=ee??[];c(()=>{O({})},[b,S]),c(()=>{if(F.length===0){T(null);return}F.some(e=>e.representativeFaceId===w)||T(F[0]?.representativeFaceId??null)},[F]);let I=r(()=>F.find(e=>e.representativeFaceId===w)??null,[F,w]),L=I?D[I.representativeFaceId]??new Set:new Set,ne=r(()=>I?Ie(I,e=>l.has(e)):[],[I,l]),re=I?I.faceIds.length-ne.length:0,R=I?Fe({...I,faceIds:ne},L):[];function ie(e){if(!I)return;let t=I.representativeFaceId;O(n=>({...n,[t]:Pe(n[t]??new Set,e)}))}function ae(){g.invalidateQueries({queryKey:Le})}async function z(e){await _({title:`Delete face`,message:`Permanently deletes this face crop. This cannot be undone.`,confirmLabel:`Delete`,variant:`danger`})&&v.mutate({faceId:e},{onSettled:ae})}function B(){A(null),t()}function oe(){R.length!==0&&(h(R),B())}return n(d,{open:e,onOpenChange:e=>!e&&B(),children:[n(m,{placement:`sheet-on-mobile`,width:`lg`,"aria-label":`Look-alike groups`,className:`flex max-h-[92dvh] flex-col gap-0 overflow-hidden p-0 md:max-w-4xl`,children:[n(`header`,{className:`flex shrink-0 flex-col gap-2 border-b border-border px-4 py-3`,children:[n(`div`,{className:`flex items-center justify-between gap-2`,children:[n(`div`,{className:`flex items-center gap-1.5 text-sm font-semibold text-foreground`,children:[s(he,{className:`h-4 w-4 text-primary`}),` Look-alike groups`]}),s(`button`,{type:`button`,onClick:B,className:`rounded p-1 text-foreground-subtle hover:bg-surface-hover hover:text-foreground`,"aria-label":`Close`,children:s(Y,{className:`h-4 w-4`})})]}),n(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[n(`label`,{className:`flex items-center gap-2 text-[11px] text-foreground-subtle`,children:[`Threshold`,s(`input`,{type:`range`,min:ze,max:Be,step:Ve,value:b,onChange:e=>x(Number(e.target.value)),className:`h-1.5 w-28 cursor-pointer accent-primary`}),s(`span`,{className:`w-8 shrink-0 text-right font-mono text-[11px] tabular-nums text-foreground`,children:b.toFixed(2)})]}),n(`label`,{className:`flex items-center gap-2 text-[11px] text-foreground-subtle`,children:[`Min size`,s(`input`,{type:`number`,min:Ue,max:We,step:1,value:S,onChange:e=>C(Math.min(We,Math.max(Ue,Number(e.target.value)||Ue))),className:`w-12 rounded border border-border bg-background px-1.5 py-0.5 text-xs text-foreground`})]}),n(M,{variant:`secondary`,onClick:()=>{O({}),P()},disabled:N,children:[N?s(q,{className:`h-3.5 w-3.5 animate-spin`}):s(de,{className:`h-3.5 w-3.5`}),`Re-analyze`]})]})]}),s(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-hidden px-4 py-3 md:flex-row`,children:N&&F.length===0?n(`div`,{className:`flex flex-1 items-center justify-center gap-2 py-8 text-xs text-foreground-subtle`,children:[s(q,{className:`h-4 w-4 animate-spin`}),` Finding similar faces…`]}):F.length===0?s(`div`,{className:`flex flex-1 items-center justify-center py-8 text-xs text-foreground-subtle`,children:`No look-alike groups at this threshold.`}):n(i,{children:[s(`div`,{className:`flex gap-2 overflow-x-auto pb-1 md:hidden`,children:F.map(e=>s(Ke,{cluster:e,face:l.get(e.representativeFaceId),active:e.representativeFaceId===w,onSelect:()=>T(e.representativeFaceId)},e.representativeFaceId))}),s(`div`,{className:`hidden shrink-0 flex-col gap-2 overflow-y-auto md:flex md:w-56`,children:F.map(e=>s(Ke,{cluster:e,face:l.get(e.representativeFaceId),active:e.representativeFaceId===w,onSelect:()=>T(e.representativeFaceId)},e.representativeFaceId))}),s(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:I&&n(i,{children:[re>0&&n(`p`,{className:`mb-2 text-[11px] text-foreground-subtle`,children:[re,` not loaded — excluded from actions`]}),s(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(13rem,1fr))] gap-2`,children:ne.map(e=>{let t=l.get(e);return t?s(qe,{face:t,cameraName:u(t.deviceId),nowMs:f,excluded:L.has(e),onToggleExclude:()=>ie(e),onDelete:()=>void z(e),deletePending:v.isPending&&v.variables?.faceId===e},e):null})})]})})]})}),n(`footer`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-border px-4 py-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]`,children:[s(M,{variant:`secondary`,onClick:oe,disabled:R.length===0,children:`Select in gallery`}),n(M,{variant:`primary`,onClick:()=>A(R),disabled:R.length===0,children:[s(te,{className:`h-3.5 w-3.5`}),` Adopt (`,R.length,`)`]})]})]}),s(Oe,{faceIds:k,identities:p,onDone:()=>A(null)})]})}t();var Ye=[[`faceGallery`]],Xe=500,Ze=120;function Qe({face:e,cameraName:t,nowMs:r,selected:i,onToggleSelect:o,onAssign:c,onOpenDetail:l}){let u=a(),d=v(),f=E(),p=()=>{u.invalidateQueries({queryKey:Ye})},m=()=>l(e.faceId),h=Ee(e);return n(`div`,{className:`relative flex flex-col rounded-md border bg-surface overflow-hidden ${i?`border-primary ring-1 ring-primary`:`border-border`}`,children:[n(`div`,{className:`aspect-square relative overflow-hidden bg-surface-hover`,children:[h===null?n(`button`,{type:`button`,onClick:m,className:`flex h-full w-full flex-col items-center justify-center gap-1 bg-warning/5 text-foreground-subtle`,title:`No crop image — the face's crop media is missing (a pre-fix orphan). Safe to delete.`,children:[s(z,{className:`h-7 w-7 text-warning/70`}),s(`span`,{className:`text-[9px] font-medium uppercase tracking-wide text-warning/80`,children:`No crop`})]}):s(`img`,{src:h,alt:`Face from ${t}`,onClick:m,loading:`lazy`,decoding:`async`,className:`h-full w-full cursor-zoom-in object-cover`}),s(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),o(e.faceId)},className:`absolute left-0 top-0 z-10 rounded-br-md bg-black/50 p-1.5 text-white hover:bg-black/70`,"aria-label":i?`Deselect`:`Select`,children:i?s(W,{className:`h-4 w-4 text-primary`}):s(G,{className:`h-4 w-4`})})]}),n(`div`,{className:`min-w-0 px-2 pt-1.5 space-y-0.5`,children:[s(`p`,{className:`text-[10px] font-medium text-foreground truncate`,title:t,children:t}),s(`p`,{className:`text-[10px] text-foreground-subtle truncate`,children:R(e.timestamp,r)}),e.identityName&&s(`p`,{className:`text-[10px] font-medium text-primary truncate`,title:e.identityName,children:e.identityName})]}),n(`div`,{className:`mt-1 flex items-center gap-0.5 border-t border-border/60 px-1 py-0.5`,children:[e.assigned?s(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),d.mutate({faceId:e.faceId},{onSettled:p})},disabled:d.isPending,className:`rounded p-1.5 text-foreground-subtle transition-colors hover:bg-warning/10 hover:text-warning disabled:opacity-40`,"aria-label":`Detach face`,title:`Detach`,children:d.isPending?s(q,{className:`h-4 w-4 animate-spin`}):s(I,{className:`h-4 w-4`})}):s(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),c(e.faceId)},className:`rounded p-1.5 text-foreground-subtle transition-colors hover:bg-primary/10 hover:text-primary`,"aria-label":`Assign face to person`,title:`Assign to person`,children:s(te,{className:`h-4 w-4`})}),s(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),f.mutate({faceId:e.faceId},{onSettled:p})},disabled:f.isPending,className:`ml-auto rounded p-1.5 text-foreground-subtle transition-colors hover:bg-danger/10 hover:text-danger disabled:opacity-40`,"aria-label":`Delete face`,title:`Delete face`,children:f.isPending?s(q,{className:`h-4 w-4 animate-spin`}):s(X,{className:`h-4 w-4`})})]})]})}var $e=[{label:`All`,value:`all`},{label:`Unassigned`,value:`unassigned`},{label:`Recognized`,value:`recognized`}];function et(){let e=a(),[t,c]=o(`all`),[l,u]=o(ce),[d,f]=o(new Set),[p,m]=o(new Set),[h,_]=o(null),[y,S]=o(!1),[C,w]=o(null),{data:T,isLoading:D}=k({limit:Xe,filter:t,includeCrops:!1},{refetchInterval:3e4}),{data:O=[]}=g(),{data:A}=ee({}),j=b(),N=v(),P=x(),F=E(),L=Date.now(),R=T??[],B=r(()=>{let e=new Map;for(let t of A??[])e.set(t.id,t.name);return e},[A]),V=e=>B.get(e)??`Camera #${String(e)}`,le=r(()=>re(R).map(e=>({id:e,name:V(e)})).sort((e,t)=>e.name.localeCompare(t.name)),[R,B]),H=r(()=>ae(ue(R,l),d),[R,l,d]),U=oe(H,Ze,r(()=>JSON.stringify([t,l.fromMs,l.toMs,[...d].sort((e,t)=>e-t)]),[t,l.fromMs,l.toMs,d])),de=r(()=>new Map(R.map(e=>[e.faceId,e])),[R]),W=r(()=>Te(H),[H]),G=C===null?null:de.get(C)??null,K=()=>{e.invalidateQueries({queryKey:Ye})},J=()=>m(new Set);function fe(e){m(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function pe(e){m(t=>{let n=new Set(t);for(let t of e)n.add(t);return n})}function me(){pe(we(H))}let Z=[...p],Q=j.isPending||P.isPending||F.isPending,ge=N.isPending||F.isPending;function _e(){Z.length!==0&&P.mutate({faceIds:Z},{onSettled:()=>{K(),J()}})}function ve(){Z.length!==0&&Promise.allSettled(Z.map(e=>F.mutateAsync({faceId:e}))).then(()=>{K(),J()})}function $(e){w(null),_([e])}function ye(e){N.mutate({faceId:e},{onSettled:K}),w(null)}function be(e){F.mutate({faceId:e},{onSettled:K}),w(null)}let xe=H.length!==R.length;return n(`div`,{className:`relative space-y-3`,children:[n(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[s(`div`,{className:`flex items-center gap-1`,children:$e.map(e=>s(`button`,{type:`button`,onClick:()=>c(e.value),className:`rounded-md px-2.5 py-1 text-xs transition-colors ${t===e.value?`bg-primary/12 text-primary font-medium`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground`}`,children:e.label},e.value))}),s(se,{onChange:u}),s(ie,{cameras:le,selected:d,onChange:f}),n(`button`,{type:`button`,onClick:()=>S(!0),className:`flex items-center gap-1 rounded-md px-2.5 py-1 text-xs transition-colors ${y?`bg-primary/12 text-primary font-medium`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground`}`,children:[s(he,{className:`h-3.5 w-3.5`}),` Similar groups`]}),!D&&W>0&&n(`button`,{type:`button`,onClick:me,className:`ml-auto flex items-center gap-1 rounded-md px-2.5 py-1 text-xs text-warning/90 transition-colors hover:bg-warning/10`,title:`Select every visible face whose crop image is missing so you can delete the orphans in one pass`,children:[s(z,{className:`h-3.5 w-3.5`}),` Select `,W,` crop-less`]}),!D&&s(`span`,{className:`text-[10px] text-foreground-subtle ${W>0?`ml-2`:`ml-auto`}`,children:xe?`${String(H.length)} of ${String(R.length)} faces`:`${String(H.length)} face${H.length===1?``:`s`}`})]}),p.size>0&&n(`div`,{className:`flex flex-wrap items-center gap-2 rounded-md border border-primary/40 bg-primary/8 px-3 py-2`,children:[n(`span`,{className:`text-xs font-medium text-foreground`,children:[p.size,` selected`]}),n(`div`,{className:`ml-auto flex flex-wrap items-center gap-1.5`,children:[n(M,{variant:`primary`,onClick:()=>_(Z),disabled:Q,children:[s(te,{className:`h-3.5 w-3.5`}),` Assign`]}),n(M,{variant:`secondary`,onClick:_e,disabled:Q,children:[P.isPending?s(q,{className:`h-3.5 w-3.5 animate-spin`}):s(I,{className:`h-3.5 w-3.5`}),` `,`Detach`]}),n(M,{variant:`secondary`,onClick:ve,disabled:Q,children:[s(X,{className:`h-3.5 w-3.5`}),` Delete`]}),s(M,{variant:`ghost`,onClick:J,disabled:Q,children:s(Y,{className:`h-3.5 w-3.5`})})]})]}),D&&n(`div`,{className:`flex items-center gap-2 py-4 text-xs text-foreground-subtle`,children:[s(q,{className:`h-4 w-4 animate-spin`}),` Loading faces…`]}),!D&&H.length===0&&s(`p`,{className:`py-4 text-xs text-foreground-subtle`,children:R.length>0?`No faces match the current date / camera filters.`:`No faces found for this filter.`}),!D&&H.length>0&&n(i,{children:[s(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(6.5rem,1fr))] gap-2`,children:U.pageItems.map(e=>s(Qe,{face:e,cameraName:V(e.deviceId),nowMs:L,selected:p.has(e.faceId),onToggleSelect:fe,onAssign:e=>_([e]),onOpenDetail:w},e.faceId))}),s(ne,{currentPage:U.page,totalItems:U.totalItems,pageSize:U.pageSize,onPageChange:U.setPage,itemNoun:`faces`})]}),s(Ne,{face:G,cameraName:G?V(G.deviceId):``,onClose:()=>w(null),onAssign:$,onUnassign:ye,onDelete:be,actionsPending:ge}),s(Oe,{faceIds:h,identities:O,onDone:()=>{_(null),J()}}),s(Je,{open:y,onClose:()=>S(!1),byId:de,cameraName:V,nowMs:L,identities:O,selectMany:pe})]})}t();var tt=[[`faceGallery`]],nt=2e3;function rt(){let t=a(),n=e(t);n.current=t;let r=e(void 0);r.current||=le({delayMs:nt,invalidate:()=>{n.current.invalidateQueries({queryKey:tt})}}),c(()=>()=>r.current?.cancel(),[]),l(N.PipelineAnalyticsFaceGalleryChanged,()=>{r.current?.trigger()})}function it(){return rt(),s(Q,{icon:me,title:`Faces`,subtitle:`Manage enrolled identities and assign detected face crops to people.`,children:n(`section`,{className:`space-y-3`,children:[n(`div`,{children:[s(`h2`,{className:`text-sm font-semibold text-foreground mb-1`,children:`People`}),s(`p`,{className:`text-xs text-foreground-subtle mb-3`,children:`Enrolled identities used for face recognition. Expand a row to view or remove training samples.`}),s(Se,{})]}),n(`div`,{className:`pt-4 border-t border-border`,children:[s(`h2`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Recent detected faces`}),s(`p`,{className:`text-xs text-foreground-subtle mb-3`,children:`Face crops captured by the detection pipeline. Assign them to a person to build recognition training data.`}),s(et,{})]})]})})}export{it as DetectionIntelligencePage};