@camstack/addon-admin-ui 1.1.57 → 1.1.58
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.
- package/dist/assets/{AddLocationWizard-DH1wlM9N.js → AddLocationWizard-CVNjYxtc.js} +1 -1
- package/dist/assets/{AddonCollectionPage-gxmNQdYf.js → AddonCollectionPage-ocTXpvOZ.js} +1 -1
- package/dist/assets/Addons-7Vjs9zfK.js +1 -0
- package/dist/assets/{AdminTabs-64haXSm8.js → AdminTabs-ti8-1m5K.js} +1 -1
- package/dist/assets/{AiProfiles-lT3bBnEd.js → AiProfiles-CrEp6OFD.js} +1 -1
- package/dist/assets/{BrokerForm-CZUCzvy_.js → BrokerForm-DtpQ8uTP.js} +1 -1
- package/dist/assets/{Capabilities-DUB8wW7w.js → Capabilities-t4Kv7n1W.js} +1 -1
- package/dist/assets/{CapabilityBadges-U24jV_WE.js → CapabilityBadges-mdL66YzR.js} +1 -1
- package/dist/assets/{Cluster-Bxxn3HqZ.js → Cluster-Cm9cMLcE.js} +1 -1
- package/dist/assets/{ClusterRecordingTab-CDJWutAl.js → ClusterRecordingTab-CaOKHEeI.js} +1 -1
- package/dist/assets/{Dashboard-CbHaQer3.js → Dashboard-CpYJcmr_.js} +1 -1
- package/dist/assets/{Data-BFaoxXrd.js → Data-4IVm8wg4.js} +1 -1
- package/dist/assets/{DetectionIntelligence-DLUsO5v8.js → DetectionIntelligence-BdB98iCp.js} +1 -1
- package/dist/assets/DeviceDetail-CQyDvbFg.js +2 -0
- package/dist/assets/{Devices-DNl54HUl.js → Devices-C_6aVGD7.js} +1 -1
- package/dist/assets/{EmbedPlayerPage-DZ-C5bEy.js → EmbedPlayerPage-CcGFTaVD.js} +1 -1
- package/dist/assets/Events-DaR_UKkQ.js +1 -0
- package/dist/assets/{FormBuilder-CJkx2iwL.js → FormBuilder-Dc0ym63B.js} +1 -1
- package/dist/assets/Identity-DJyNRncE.js +1 -0
- package/dist/assets/IntegrationDetail-BM--jjoS.js +1 -0
- package/dist/assets/{Integrations-C4Fhw2Kw.js → Integrations-Cf9xW5df.js} +1 -1
- package/dist/assets/{Integrations-BDwXdSy2.js → Integrations-DzxZVoSV.js} +1 -1
- package/dist/assets/{Logs-D0CulDHV.js → Logs-CcOsniV2.js} +1 -1
- package/dist/assets/{MotionZonesSettings-BZw2TDN9.js → MotionZonesSettings-CokOBQSP.js} +1 -1
- package/dist/assets/{MyAccess-D8IdACgd.js → MyAccess-CX_ow6J1.js} +1 -1
- package/dist/assets/Network-DUc2RoeT.js +1 -0
- package/dist/assets/{NodeAddonsSettingsPanel-C3zABIO-.js → NodeAddonsSettingsPanel-9-LKLy9X.js} +1 -1
- package/dist/assets/{NotificationTargets-DcFuhDqZ.js → NotificationTargets-BhtcVTrY.js} +1 -1
- package/dist/assets/Pipeline-DovdUqqp.js +1 -0
- package/dist/assets/{Plates-c6NUMI7y.js → Plates-CGw20xsK.js} +1 -1
- package/dist/assets/{PrivacyMaskSettings-eInalxMC.js → PrivacyMaskSettings-6vOAMZvp.js} +1 -1
- package/dist/assets/{ProviderIcon-DATRMz_4.js → ProviderIcon-B3eTSPH9.js} +1 -1
- package/dist/assets/{Recordings-BGuRRQDk.js → Recordings-B_jTro7W.js} +1 -1
- package/dist/assets/{ScanNetworkModal-BCgaSgkz.js → ScanNetworkModal-BXLlQxmE.js} +1 -1
- package/dist/assets/{Settings-BfPc5iI3.js → Settings-ciNE8s7I.js} +1 -1
- package/dist/assets/{Showroom-BmVwl5hS.js → Showroom-DZhEfAVz.js} +1 -1
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DN_gpCZX.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-WPoOdk8K.js} +1 -1
- package/dist/assets/{build-cluster-graph-BogKchI7.js → build-cluster-graph-DF6vXFuz.js} +1 -1
- package/dist/assets/circle-check-big-CpW47sKH.js +1 -0
- package/dist/assets/clock-B2DLn9V8.js +1 -0
- package/dist/assets/{copy-Btgalvzu.js → copy-CTAB7ETk.js} +1 -1
- package/dist/assets/{debounced-invalidate-BqE6Y6Cb.js → debounced-invalidate-BO1jeGCV.js} +1 -1
- package/dist/assets/{dist-D6gYz5eb.js → dist-DfX3QEHj.js} +1 -1
- package/dist/assets/dist-hBxf_PpM.js +7 -0
- package/dist/assets/{download-3MyUU9xN.js → download-BUxKBqKH.js} +1 -1
- package/dist/assets/{face-bbox-DaP1CzYT.js → face-bbox-CMdVS6x4.js} +1 -1
- package/dist/assets/{hostInit-GN_uwc3e.js → hostInit-YBm54NBK.js} +1 -1
- package/dist/assets/index-bh7u7Hyq.js +4 -0
- package/dist/assets/{key-round-DpPTl6y7.js → key-round-uhUyoLEA.js} +1 -1
- package/dist/assets/{mf-entry-bootstrap-0-fd1d728a.js → mf-entry-bootstrap-0-d890d3a5.js} +2 -2
- package/dist/assets/{pencil-CN8dLhGr.js → pencil-DvE-pDJv.js} +1 -1
- package/dist/assets/{player-overlays-D5hi-tM5.js → player-overlays-Xmuz6PYc.js} +1 -1
- package/dist/assets/plus-ZqwElRGO.js +1 -0
- package/dist/assets/{radio-Byqiemme.js → radio-Bb4Ca-oO.js} +1 -1
- package/dist/assets/{refresh-cw-C3Kqp48w.js → refresh-cw-wdTE-h5_.js} +1 -1
- package/dist/assets/remoteEntry-DaFl2uRt.js +1 -0
- package/dist/assets/{rotate-ccw-C_ZoPS5E.js → rotate-ccw-BQvhpDZw.js} +1 -1
- package/dist/assets/rotate-cw-D3gOk0zM.js +1 -0
- package/dist/assets/search-DfF0SYZN.js +1 -0
- package/dist/assets/{send-SktyBExi.js → send-QP1-cyTt.js} +1 -1
- package/dist/assets/{server-DCfbXoOB.js → server-DduF17Ok.js} +1 -1
- package/dist/assets/square-Bj4oAYL4.js +1 -0
- package/dist/assets/{square-check-big-BID2eFDb.js → square-check-big-dYbuq7N5.js} +1 -1
- package/dist/assets/src-BXsSzH8t.js +67 -0
- package/dist/assets/src-Cghq8X9g.js +7 -0
- package/dist/assets/{upload-D7qGw-ta.js → upload-CBWYeFKA.js} +1 -1
- package/dist/assets/useDevice-CPjIwHzA.js +1 -0
- package/dist/assets/{useEventInvalidation-CHCtNbeW.js → useEventInvalidation-DyNr0T5f.js} +1 -1
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-DS3hFa8s.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-BXXE9AlJ.js} +2 -2
- package/dist/assets/{wifi-xf1SEAla.js → wifi-BGDzRUYW.js} +1 -1
- package/dist/assets/{zap-BrvxTYmV.js → zap-IAmUubjw.js} +1 -1
- package/dist/index.html +5 -5
- package/dist/server/addon.js +368 -2
- package/package.json +1 -1
- package/dist/assets/Addons-Be4CVuvJ.js +0 -1
- package/dist/assets/DeviceDetail-BEb0V9yJ.js +0 -2
- package/dist/assets/Events-BlNjN0KW.js +0 -1
- package/dist/assets/Identity-BCh6oPue.js +0 -1
- package/dist/assets/IntegrationDetail-C_qtX56l.js +0 -1
- package/dist/assets/Network-B5TmDUnp.js +0 -1
- package/dist/assets/Pipeline-D3EKV42x.js +0 -1
- package/dist/assets/circle-check-big-C_b3omdN.js +0 -1
- package/dist/assets/clock-B7aZhS6D.js +0 -1
- package/dist/assets/dist-CeDr-VKi.js +0 -7
- package/dist/assets/index-CWSgkLh-.js +0 -4
- package/dist/assets/plus-BQmF7mQK.js +0 -1
- package/dist/assets/remoteEntry-C9o3ROsQ.js +0 -1
- package/dist/assets/rotate-cw-C2Olcfdi.js +0 -1
- package/dist/assets/search-BEneuVmL.js +0 -1
- package/dist/assets/square-Dvd0pOn9.js +0 -1
- package/dist/assets/src-BFcFmkR9.js +0 -67
- package/dist/assets/src-t4LDC_AO.js +0 -7
- package/dist/assets/useDevice-6M3fnopa.js +0 -1
package/dist/server/addon.js
CHANGED
|
@@ -7637,6 +7637,160 @@ var EncodeProfileSchema = object({
|
|
|
7637
7637
|
*/
|
|
7638
7638
|
outputArgs: array(string()).optional()
|
|
7639
7639
|
});
|
|
7640
|
+
var COCO_TO_MACRO = {
|
|
7641
|
+
mapping: {
|
|
7642
|
+
person: "person",
|
|
7643
|
+
bicycle: "vehicle",
|
|
7644
|
+
car: "vehicle",
|
|
7645
|
+
motorcycle: "vehicle",
|
|
7646
|
+
airplane: "vehicle",
|
|
7647
|
+
bus: "vehicle",
|
|
7648
|
+
train: "vehicle",
|
|
7649
|
+
truck: "vehicle",
|
|
7650
|
+
boat: "vehicle",
|
|
7651
|
+
bird: "animal",
|
|
7652
|
+
cat: "animal",
|
|
7653
|
+
dog: "animal",
|
|
7654
|
+
horse: "animal",
|
|
7655
|
+
sheep: "animal",
|
|
7656
|
+
cow: "animal",
|
|
7657
|
+
elephant: "animal",
|
|
7658
|
+
bear: "animal",
|
|
7659
|
+
zebra: "animal",
|
|
7660
|
+
giraffe: "animal",
|
|
7661
|
+
suitcase: "package",
|
|
7662
|
+
backpack: "package",
|
|
7663
|
+
handbag: "package"
|
|
7664
|
+
},
|
|
7665
|
+
preserveOriginal: false
|
|
7666
|
+
};
|
|
7667
|
+
var AUDIO_MACRO_LABELS = [
|
|
7668
|
+
{
|
|
7669
|
+
id: "speech",
|
|
7670
|
+
name: "Speech",
|
|
7671
|
+
icon: "🗣️"
|
|
7672
|
+
},
|
|
7673
|
+
{
|
|
7674
|
+
id: "scream",
|
|
7675
|
+
name: "Scream / Shout",
|
|
7676
|
+
icon: "😱"
|
|
7677
|
+
},
|
|
7678
|
+
{
|
|
7679
|
+
id: "crying",
|
|
7680
|
+
name: "Crying / Baby",
|
|
7681
|
+
icon: "😢"
|
|
7682
|
+
},
|
|
7683
|
+
{
|
|
7684
|
+
id: "laughter",
|
|
7685
|
+
name: "Laughter",
|
|
7686
|
+
icon: "😂"
|
|
7687
|
+
},
|
|
7688
|
+
{
|
|
7689
|
+
id: "music",
|
|
7690
|
+
name: "Music",
|
|
7691
|
+
icon: "🎵"
|
|
7692
|
+
},
|
|
7693
|
+
{
|
|
7694
|
+
id: "dog",
|
|
7695
|
+
name: "Dog",
|
|
7696
|
+
icon: "🐕"
|
|
7697
|
+
},
|
|
7698
|
+
{
|
|
7699
|
+
id: "cat",
|
|
7700
|
+
name: "Cat",
|
|
7701
|
+
icon: "🐈"
|
|
7702
|
+
},
|
|
7703
|
+
{
|
|
7704
|
+
id: "bird",
|
|
7705
|
+
name: "Bird",
|
|
7706
|
+
icon: "🐦"
|
|
7707
|
+
},
|
|
7708
|
+
{
|
|
7709
|
+
id: "animal",
|
|
7710
|
+
name: "Animal (other)",
|
|
7711
|
+
icon: "🐾"
|
|
7712
|
+
},
|
|
7713
|
+
{
|
|
7714
|
+
id: "alarm",
|
|
7715
|
+
name: "Alarm / Siren",
|
|
7716
|
+
icon: "🚨"
|
|
7717
|
+
},
|
|
7718
|
+
{
|
|
7719
|
+
id: "doorbell",
|
|
7720
|
+
name: "Doorbell / Knock",
|
|
7721
|
+
icon: "🔔"
|
|
7722
|
+
},
|
|
7723
|
+
{
|
|
7724
|
+
id: "glass_breaking",
|
|
7725
|
+
name: "Glass Breaking",
|
|
7726
|
+
icon: "💥"
|
|
7727
|
+
},
|
|
7728
|
+
{
|
|
7729
|
+
id: "gunshot",
|
|
7730
|
+
name: "Gunshot / Explosion",
|
|
7731
|
+
icon: "💣"
|
|
7732
|
+
},
|
|
7733
|
+
{
|
|
7734
|
+
id: "vehicle",
|
|
7735
|
+
name: "Vehicle",
|
|
7736
|
+
icon: "🚗"
|
|
7737
|
+
},
|
|
7738
|
+
{
|
|
7739
|
+
id: "siren",
|
|
7740
|
+
name: "Emergency Siren",
|
|
7741
|
+
icon: "🚑"
|
|
7742
|
+
},
|
|
7743
|
+
{
|
|
7744
|
+
id: "fire",
|
|
7745
|
+
name: "Fire / Smoke",
|
|
7746
|
+
icon: "🔥"
|
|
7747
|
+
},
|
|
7748
|
+
{
|
|
7749
|
+
id: "water",
|
|
7750
|
+
name: "Water",
|
|
7751
|
+
icon: "💧"
|
|
7752
|
+
},
|
|
7753
|
+
{
|
|
7754
|
+
id: "wind",
|
|
7755
|
+
name: "Wind / Weather",
|
|
7756
|
+
icon: "🌬️"
|
|
7757
|
+
},
|
|
7758
|
+
{
|
|
7759
|
+
id: "door",
|
|
7760
|
+
name: "Door",
|
|
7761
|
+
icon: "🚪"
|
|
7762
|
+
},
|
|
7763
|
+
{
|
|
7764
|
+
id: "footsteps",
|
|
7765
|
+
name: "Footsteps",
|
|
7766
|
+
icon: "👣"
|
|
7767
|
+
},
|
|
7768
|
+
{
|
|
7769
|
+
id: "crowd",
|
|
7770
|
+
name: "Crowd / Chatter",
|
|
7771
|
+
icon: "👥"
|
|
7772
|
+
},
|
|
7773
|
+
{
|
|
7774
|
+
id: "telephone",
|
|
7775
|
+
name: "Telephone",
|
|
7776
|
+
icon: "📞"
|
|
7777
|
+
},
|
|
7778
|
+
{
|
|
7779
|
+
id: "engine",
|
|
7780
|
+
name: "Engine / Motor",
|
|
7781
|
+
icon: "⚙️"
|
|
7782
|
+
},
|
|
7783
|
+
{
|
|
7784
|
+
id: "tools",
|
|
7785
|
+
name: "Tools / Construction",
|
|
7786
|
+
icon: "🔨"
|
|
7787
|
+
},
|
|
7788
|
+
{
|
|
7789
|
+
id: "silence",
|
|
7790
|
+
name: "Silence",
|
|
7791
|
+
icon: "🤫"
|
|
7792
|
+
}
|
|
7793
|
+
];
|
|
7640
7794
|
var YAMNET_TO_MACRO = {
|
|
7641
7795
|
mapping: {
|
|
7642
7796
|
Speech: "speech",
|
|
@@ -7903,6 +8057,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
|
|
|
7903
8057
|
for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
|
|
7904
8058
|
for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
|
|
7905
8059
|
/**
|
|
8060
|
+
* Unified event-kind taxonomy — THE single source of truth for
|
|
8061
|
+
* `kind → { parentKind, category, level, color, iconId, labelKey, label,
|
|
8062
|
+
* icon }`.
|
|
8063
|
+
*
|
|
8064
|
+
* This dictionary folds together what used to be scattered across four
|
|
8065
|
+
* copies:
|
|
8066
|
+
* - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
|
|
8067
|
+
* - `addon-post-analysis/.../services/event-kinds.ts`
|
|
8068
|
+
* (MOTION/PERSON/VEHICLE… _COLOR constants)
|
|
8069
|
+
* - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
|
|
8070
|
+
* - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
|
|
8071
|
+
* - the COCO / audio class maps (macro ↔ sub relationships)
|
|
8072
|
+
*
|
|
8073
|
+
* The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
|
|
8074
|
+
* `@camstack/types`. The UI-side mapping `iconId → lucide component` and
|
|
8075
|
+
* `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
|
|
8076
|
+
* color or an icon: they read this dictionary (server descriptors carry the
|
|
8077
|
+
* fields inline; the client resolves color/icon/label from `iconId`/`kind`).
|
|
8078
|
+
*
|
|
8079
|
+
* Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
|
|
8080
|
+
*/
|
|
8081
|
+
var TAXONOMY_COLORS = {
|
|
8082
|
+
motion: "#f59e0b",
|
|
8083
|
+
audio: "#06b6d4",
|
|
8084
|
+
person: "#22c55e",
|
|
8085
|
+
vehicle: "#3b82f6",
|
|
8086
|
+
animal: "#f97316",
|
|
8087
|
+
package: "#a855f7",
|
|
8088
|
+
sensor: "#8b5cf6",
|
|
8089
|
+
control: "#10b981",
|
|
8090
|
+
genericDetection: "#64748b"
|
|
8091
|
+
};
|
|
8092
|
+
var DETECTION_SUB_COLORS = {
|
|
8093
|
+
car: "#f59e0b",
|
|
8094
|
+
truck: "#d97706",
|
|
8095
|
+
bus: "#b45309",
|
|
8096
|
+
motorcycle: "#eab308",
|
|
8097
|
+
bicycle: "#ca8a04",
|
|
8098
|
+
airplane: "#60a5fa",
|
|
8099
|
+
boat: "#2563eb",
|
|
8100
|
+
train: "#1d4ed8",
|
|
8101
|
+
bird: "#14b8a6",
|
|
8102
|
+
dog: "#84cc16",
|
|
8103
|
+
cat: "#f97316",
|
|
8104
|
+
horse: "#a16207",
|
|
8105
|
+
sheep: "#a3a3a3",
|
|
8106
|
+
cow: "#78716c",
|
|
8107
|
+
elephant: "#6b7280",
|
|
8108
|
+
bear: "#7c2d12",
|
|
8109
|
+
zebra: "#404040",
|
|
8110
|
+
giraffe: "#d4a373"
|
|
8111
|
+
};
|
|
8112
|
+
function titleCase(id) {
|
|
8113
|
+
return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
|
|
8114
|
+
}
|
|
8115
|
+
var entries = /* @__PURE__ */ new Map();
|
|
8116
|
+
function macro(kind, category, color, iconId, label) {
|
|
8117
|
+
entries.set(kind, {
|
|
8118
|
+
kind,
|
|
8119
|
+
parentKind: null,
|
|
8120
|
+
level: "macro",
|
|
8121
|
+
category,
|
|
8122
|
+
color,
|
|
8123
|
+
iconId,
|
|
8124
|
+
labelKey: `eventKind.${kind}`,
|
|
8125
|
+
label
|
|
8126
|
+
});
|
|
8127
|
+
}
|
|
8128
|
+
function sub(kind, parentKind, category, color, iconId, label) {
|
|
8129
|
+
entries.set(kind, {
|
|
8130
|
+
kind,
|
|
8131
|
+
parentKind,
|
|
8132
|
+
level: "sub",
|
|
8133
|
+
category,
|
|
8134
|
+
color,
|
|
8135
|
+
iconId,
|
|
8136
|
+
labelKey: `eventKind.${kind}`,
|
|
8137
|
+
label
|
|
8138
|
+
});
|
|
8139
|
+
}
|
|
8140
|
+
macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
|
|
8141
|
+
macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
|
|
8142
|
+
macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
|
|
8143
|
+
macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
|
|
8144
|
+
macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
|
|
8145
|
+
macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
|
|
8146
|
+
macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
|
|
8147
|
+
macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
|
|
8148
|
+
for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
|
|
8149
|
+
if (macroClass !== "vehicle" && macroClass !== "animal") continue;
|
|
8150
|
+
if (entries.has(cocoClass)) continue;
|
|
8151
|
+
sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
|
|
8152
|
+
}
|
|
8153
|
+
sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
|
|
8154
|
+
sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
|
|
8155
|
+
sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
|
|
8156
|
+
sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
|
|
8157
|
+
sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
|
|
8158
|
+
sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
|
|
8159
|
+
sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
|
|
8160
|
+
sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
|
|
8161
|
+
sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
|
|
8162
|
+
sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
|
|
8163
|
+
sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
|
|
8164
|
+
sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
|
|
8165
|
+
sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
|
|
8166
|
+
sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
|
|
8167
|
+
sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
|
|
8168
|
+
sub("siren", "control", "control", "#dc2626", "siren", "Siren");
|
|
8169
|
+
sub("button", "control", "control", "#10b981", "button", "Button");
|
|
8170
|
+
sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
|
|
8171
|
+
for (const l of AUDIO_MACRO_LABELS) {
|
|
8172
|
+
const kind = `audio-${l.id}`;
|
|
8173
|
+
if (entries.has(kind)) continue;
|
|
8174
|
+
sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
|
|
8175
|
+
}
|
|
8176
|
+
/** The complete taxonomy dictionary, keyed by kind. */
|
|
8177
|
+
var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
|
|
8178
|
+
/**
|
|
7906
8179
|
* Error types for the safe expression engine. Two distinct classes so callers
|
|
7907
8180
|
* can tell a compile-time (grammar) failure from a runtime (evaluation)
|
|
7908
8181
|
* failure — both are non-fatal to the host: read paths degrade to "skip link".
|
|
@@ -15852,17 +16125,30 @@ var EventKindCategorySchema = _enum([
|
|
|
15852
16125
|
"audio",
|
|
15853
16126
|
"detection",
|
|
15854
16127
|
"sensor",
|
|
16128
|
+
"control",
|
|
15855
16129
|
"custom",
|
|
15856
16130
|
"package"
|
|
15857
16131
|
]);
|
|
16132
|
+
/** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
|
|
16133
|
+
var EventKindLevelSchema = _enum(["macro", "sub"]);
|
|
15858
16134
|
var EventKindDescriptorSchema = object({
|
|
15859
|
-
/** Stable kind id (e.g. 'motion', '
|
|
16135
|
+
/** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
|
|
15860
16136
|
kind: string(),
|
|
16137
|
+
/** i18n key resolved on the UI side; `label` is the English fallback. */
|
|
16138
|
+
labelKey: string(),
|
|
16139
|
+
/** English fallback label (kept for clients that don't translate). */
|
|
15861
16140
|
label: string(),
|
|
15862
16141
|
/** Hex color for timeline/legend rendering. */
|
|
15863
16142
|
color: string(),
|
|
16143
|
+
/** Dictionary id → lucide component on the UI side. */
|
|
16144
|
+
iconId: string(),
|
|
16145
|
+
/** Legacy closed-vocab glyph — fallback for `iconId`. */
|
|
15864
16146
|
icon: EventKindIconSchema,
|
|
15865
16147
|
category: EventKindCategorySchema,
|
|
16148
|
+
/** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
|
|
16149
|
+
parentKind: string().nullable(),
|
|
16150
|
+
/** Derived from `parentKind`, explicit for the client tree. */
|
|
16151
|
+
level: EventKindLevelSchema,
|
|
15866
16152
|
/** Which cap + device contributes this kind. For built-ins the camera
|
|
15867
16153
|
* itself; for sensor kinds the LINKED source device. */
|
|
15868
16154
|
source: object({
|
|
@@ -15935,11 +16221,21 @@ var TrackAudioLabelSchema = object({
|
|
|
15935
16221
|
firstAt: number(),
|
|
15936
16222
|
lastAt: number()
|
|
15937
16223
|
});
|
|
16224
|
+
/**
|
|
16225
|
+
* How a track was produced. `pipeline` (default / absent) = the spatial
|
|
16226
|
+
* detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
|
|
16227
|
+
* linked sensor/control state change (no positions; carries a snapshot). The
|
|
16228
|
+
* spatial subsystems (tracker association, occupancy count, re-id/embedding,
|
|
16229
|
+
* resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
|
|
16230
|
+
*/
|
|
16231
|
+
var TrackSourceSchema = _enum(["pipeline", "sensor"]);
|
|
15938
16232
|
var TrackSchema = object({
|
|
15939
16233
|
trackId: string(),
|
|
15940
16234
|
deviceId: number(),
|
|
15941
16235
|
className: string(),
|
|
15942
16236
|
label: string().optional(),
|
|
16237
|
+
/** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
|
|
16238
|
+
source: TrackSourceSchema.optional(),
|
|
15943
16239
|
firstSeen: number(),
|
|
15944
16240
|
lastSeen: number(),
|
|
15945
16241
|
/** Frame-rate position history (subject to maxPositionHistory cap). */
|
|
@@ -16316,6 +16612,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
16316
16612
|
eventId: string(),
|
|
16317
16613
|
timestamp: number()
|
|
16318
16614
|
});
|
|
16615
|
+
/**
|
|
16616
|
+
* Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
|
|
16617
|
+
* `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
|
|
16618
|
+
* caps into per-camera event-kind descriptors.
|
|
16619
|
+
*
|
|
16620
|
+
* The descriptor DATA (color / iconId / labelKey / parentKind / category)
|
|
16621
|
+
* is NOT duplicated here — every entry is derived from the single
|
|
16622
|
+
* `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
|
|
16623
|
+
* ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
|
|
16624
|
+
* control cap means adding one line here (and a taxonomy entry); the anti-
|
|
16625
|
+
* drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
|
|
16626
|
+
* eventful cap is missing.
|
|
16627
|
+
*/
|
|
16628
|
+
/** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
|
|
16629
|
+
var LEGACY_ICON = {
|
|
16630
|
+
motion: "motion",
|
|
16631
|
+
audio: "audio",
|
|
16632
|
+
person: "person",
|
|
16633
|
+
vehicle: "vehicle",
|
|
16634
|
+
animal: "animal",
|
|
16635
|
+
package: "package",
|
|
16636
|
+
door: "door",
|
|
16637
|
+
pir: "pir",
|
|
16638
|
+
smoke: "smoke",
|
|
16639
|
+
water: "water",
|
|
16640
|
+
button: "button",
|
|
16641
|
+
generic: "generic",
|
|
16642
|
+
gas: "smoke",
|
|
16643
|
+
vibration: "generic",
|
|
16644
|
+
tamper: "generic",
|
|
16645
|
+
presence: "person",
|
|
16646
|
+
lock: "generic",
|
|
16647
|
+
siren: "generic",
|
|
16648
|
+
switch: "generic",
|
|
16649
|
+
doorbell: "button"
|
|
16650
|
+
};
|
|
16651
|
+
function legacyIcon(iconId) {
|
|
16652
|
+
return LEGACY_ICON[iconId] ?? "generic";
|
|
16653
|
+
}
|
|
16654
|
+
/**
|
|
16655
|
+
* Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
|
|
16656
|
+
* The anti-drift guard cross-checks this against the eventful caps declared
|
|
16657
|
+
* in `packages/types/src/capabilities/*.cap.ts`.
|
|
16658
|
+
*/
|
|
16659
|
+
var CAP_TO_KIND = {
|
|
16660
|
+
contact: "contact",
|
|
16661
|
+
motion: "motion-sensor",
|
|
16662
|
+
smoke: "smoke",
|
|
16663
|
+
flood: "flood",
|
|
16664
|
+
gas: "gas",
|
|
16665
|
+
"carbon-monoxide": "carbon-monoxide",
|
|
16666
|
+
vibration: "vibration",
|
|
16667
|
+
tamper: "tamper",
|
|
16668
|
+
presence: "presence",
|
|
16669
|
+
"enum-sensor": "enum-sensor",
|
|
16670
|
+
"event-emitter": "device-event",
|
|
16671
|
+
"lock-control": "lock",
|
|
16672
|
+
switch: "switch",
|
|
16673
|
+
button: "button",
|
|
16674
|
+
doorbell: "doorbell"
|
|
16675
|
+
};
|
|
16676
|
+
function buildDescriptor(capName, kind) {
|
|
16677
|
+
const t = EVENT_TAXONOMY[kind];
|
|
16678
|
+
if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
|
|
16679
|
+
return {
|
|
16680
|
+
...t,
|
|
16681
|
+
icon: legacyIcon(t.iconId)
|
|
16682
|
+
};
|
|
16683
|
+
}
|
|
16684
|
+
Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
16319
16685
|
var CameraPipelineConfigSchema = object({
|
|
16320
16686
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
16321
16687
|
steps: array(PipelineStepInputSchema).readonly(),
|
|
@@ -24824,7 +25190,7 @@ var AdminUIAddon = class extends BaseAddon {
|
|
|
24824
25190
|
capability: adminUiCapability,
|
|
24825
25191
|
provider: {
|
|
24826
25192
|
getStaticDir: async () => ({ staticDir: resolveAdminUiDistDir() }),
|
|
24827
|
-
getVersion: async () => ({ version: "1.1.
|
|
25193
|
+
getVersion: async () => ({ version: "1.1.58" })
|
|
24828
25194
|
}
|
|
24829
25195
|
}];
|
|
24830
25196
|
}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{At as e,Ct as t,Dt as n,Et as r,Ia as i,Na as a,Nr as o,St as s,Tt as c,_t as l,bt as u,dt as ee,ft as d,g as f,gt as p,ht as m,jt as h,kt as g,m as _,mt as v,pt as y,v as te,vt as ne,xt as re,za as ie,zr as b}from"./src-BFcFmkR9.js";import{I as x,K as S,Q as C,R as ae,S as w,W as T,b as E,o as D,q as O,x as k,z as A}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js";import{H as oe}from"./src-t4LDC_AO.js";import{p as se}from"./player-overlays-D5hi-tM5.js";import{t as j}from"./clock-B7aZhS6D.js";import{t as M}from"./download-3MyUU9xN.js";import{t as ce}from"./plus-BQmF7mQK.js";import{t as N}from"./refresh-cw-C3Kqp48w.js";import{t as le}from"./search-BEneuVmL.js";import{t as P}from"./upload-D7qGw-ta.js";import{I as F,J as ue,K as de,L as I,M as fe,S as L,W as R,g as z,i as B,m as pe,p as V,s as H}from"./index-CWSgkLh-.js";import{t as U}from"./AdminPage-BwmGKnRf.js";import{t as me}from"./NodeAddonsSettingsPanel-C3zABIO-.js";var he=R(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),W=R(`octagon-alert`,[[`path`,{d:`M12 16h.01`,key:`1drbdi`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z`,key:`1fd625`}]]),G=R(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),K=R(`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`}]]);C();var q=new Set([`completed`,`failed`,`partially-failed`,`cancelled`]),J=new Set([`done`,`failed`,`skipped`]);function Y(e){return!J.has(e.phase)&&!q.has(e.jobState)}function ge(e,t){let n=new Map,r=[...e].sort((e,t)=>e.createdAtMs-t.createdAtMs);for(let e of r){let r=q.has(e.state);for(let i of e.tasks)r&&i.finishedAtMs!==null&&t-i.finishedAtMs>6e4||n.set(i.packageName,{jobId:e.jobId,packageName:i.packageName,phase:i.phase,fromVersion:i.fromVersion,toVersion:i.toVersion,error:i.error,jobState:e.state,finishedAtMs:i.finishedAtMs})}return n}function _e(){let{data:e}=u({activeOnly:!0},{refetchOnWindowFocus:!1,refetchInterval:e=>(e.state.data?.length??0)>0?3e3:!1}),{map:t}=ie(oe.AddonsJobProgress,e=>e.job.jobId);return T(()=>{let n=new Map;for(let t of e??[])n.set(t.jobId,t);for(let[e,r]of t)n.set(e,r.job);return ge([...n.values()],Date.now())},[e,t])}var X={queued:{icon:j,cls:`bg-muted text-foreground-subtle`,label:`queued`},fetching:{icon:L,cls:`bg-primary/10 text-primary`,label:`fetching`,spin:!0},staged:{icon:L,cls:`bg-primary/10 text-primary`,label:`staged`,spin:!0},validating:{icon:L,cls:`bg-primary/10 text-primary`,label:`validating`,spin:!0},applying:{icon:L,cls:`bg-primary/10 text-primary`,label:`applying`,spin:!0},restarting:{icon:L,cls:`bg-amber-500/10 text-amber-600 dark:text-amber-400`,label:`restarting`,spin:!0},applied:{icon:L,cls:`bg-primary/10 text-primary`,label:`finalizing`,spin:!0},done:{icon:I,cls:`bg-success/10 text-success`,label:`updated`},failed:{icon:W,cls:`bg-danger/10 text-danger`,label:`failed`},skipped:{icon:K,cls:`bg-muted text-foreground-subtle`,label:`skipped`}};function ve({progress:e}){let t=X[e.phase],n=t.icon,r=e.error??`${e.packageName}: ${e.fromVersion??`?`} → ${e.toVersion}`;return w(`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:[k(n,{className:`w-2.5 h-2.5 ${t.spin?`animate-spin`:``}`}),t.label,w(`span`,{className:`font-mono`,children:[`→ `,e.toVersion]})]})}function ye({packageName:e,currentVersion:t,installSource:n,onInstall:r,onClose:i,onSelect:a,selectedVersion:o}){let s=n===`upload`||n===`local`,{data:c,isLoading:l}=p({name:e});return w(`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:[w(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border`,children:[k(`span`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle font-medium`,children:`Versions`}),k(`button`,{type:`button`,onClick:i,className:`text-foreground-subtle hover:text-foreground`,children:k(B,{className:`h-3 w-3`})})]}),s&&w(`div`,{className:`flex items-start gap-2 px-3 py-2 border-b border-border bg-cyan-500/10 text-[10px]`,children:[k(P,{className:`h-3 w-3 mt-0.5 text-cyan-500 shrink-0`}),w(`div`,{className:`text-cyan-700 dark:text-cyan-200`,children:[w(`span`,{className:`font-semibold`,children:[n===`upload`?`Uploaded copy`:`Local copy`,` in place.`]}),` `,`Re-install `,k(`span`,{className:`font-mono`,children:t}),` from npm to track upstream releases again.`]})]}),l&&w(`div`,{className:`flex items-center justify-center gap-2 py-6 text-[10px] text-foreground-subtle`,children:[k(L,{className:`h-3.5 w-3.5 animate-spin`}),`Loading versions...`]}),c&&k(`div`,{className:`max-h-64 overflow-auto divide-y divide-border`,children:c.map(e=>{let n=e.version===t,i=a!==void 0&&e.version===o,c=/-(alpha|beta|rc|dev|canary|next)/i.test(e.version),l=w(E,{children:[k(`span`,{className:`font-mono flex-1 text-left ${n?`text-primary font-semibold`:c?`text-amber-400`:`text-foreground`}`,children:e.version}),n&&k(`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=>k(`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&&k(`span`,{className:`text-[9px] text-red-400 line-through`,children:`deprecated`}),k(`span`,{className:`text-[9px] text-foreground-subtle shrink-0`,children:new Date(e.publishedAt).toLocaleDateString()})]});return a?w(`button`,{type:`button`,"aria-label":`Select ${e.version}`,onClick:()=>a(e.version),className:`w-full flex items-center gap-2 px-3 py-2 text-[11px] ${i?`bg-primary/5`:`hover:bg-surface-hover`} transition-colors`,children:[l,i?k(I,{className:`h-3 w-3 text-primary shrink-0`}):k(`span`,{className:`w-3 shrink-0`})]},e.version):w(`div`,{className:`flex items-center gap-2 px-3 py-2 text-[11px] ${n?`bg-primary/5`:`hover:bg-surface-hover`} transition-colors`,children:[l,n&&!s?k(I,{className:`h-3 w-3 text-primary shrink-0`}):k(`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:k(M,{className:`h-3 w-3`})})]},e.version)})}),c&&c.length===0&&k(`div`,{className:`py-4 text-center text-[10px] text-foreground-subtle`,children:`No versions found`})]})}var be={queued:{icon:j,bg:`bg-muted text-foreground-subtle`,label:`queued`},updating:{icon:L,bg:`bg-primary/10 text-primary`,label:`updating`,spin:!0},"done-pending-restart":{icon:N,bg:`bg-amber-500/10 text-amber-700`,label:`pending restart`},done:{icon:I,bg:`bg-success/10 text-success`,label:`done`},failed:{icon:W,bg:`bg-danger/10 text-danger`,label:`failed`}};function xe({item:e}){let t=be[e.status],n=t.icon;return w(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded ${t.bg}`,title:e.error,children:[k(n,{className:`w-2.5 h-2.5 ${t.spin?`animate-spin`:``}`}),t.label]})}C();var Z=`device-export`;function Se(e){return e.capabilities.some(e=>(typeof e==`string`?e:e.name)===Z)}function Ce({isBundle:e,installSource:t,addonId:n,iconPath:r,color:i}){let[a,o]=O(!1),s=i?{backgroundColor:`${i.startsWith(`#`)?i:`#${i}`}26`}:void 0,c=e?`bg-indigo-500/20 text-indigo-700 dark:text-indigo-300`:`bg-purple-500/20 text-purple-700 dark:text-purple-300`,l=n&&r?`/api/addon-assets/${n}/${r}`:null,u=!!l&&!a;return w(`div`,{className:`relative flex-shrink-0`,children:[k(`div`,{className:`h-9 w-9 rounded-lg flex items-center justify-center ${s?``:c}`,style:s,children:u?k(`img`,{src:l,alt:n,className:`h-5 w-5`,onError:()=>o(!0)}):k(e?G:z,{className:`h-4 w-4`})}),t===`local`&&k(`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`&&k(`span`,{className:`absolute -top-1 -left-1 w-4 h-4 rounded bg-[#cb3837] flex items-center justify-center -rotate-12 shadow-sm`,children:k(`svg`,{viewBox:`0 0 780 250`,className:`w-[11px] h-[11px]`,children:k(`path`,{fill:`#fff`,d:`M240 250h100V50h100v200h340V0H0v250z`})})}),t===`upload`&&k(`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:k(P,{className:`h-2.5 w-2.5 text-white`})})]})}function we({version:e,availableUpdate:t,selectedVersion:n,isUpdating:r,installSource:i,disabled:a,onUpdate:o,onOpenPicker:s,children:c}){if(r)return w(`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:[k(L,{className:`h-3 w-3 animate-spin`}),`Updating…`]});if(t){let r=n??t;return w(`div`,{className:`relative inline-flex items-center gap-1 shrink-0`,children:[o&&w(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),o()},disabled:a,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-semibold border border-blue-500/30 bg-blue-500/10 text-blue-400 hover:bg-blue-500/20 disabled:opacity-50 disabled:cursor-not-allowed transition-colors`,title:`Update to ${r}`,children:[k(M,{className:`h-3 w-3`}),`Update`]}),w(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),s()},disabled:a,"aria-label":`Select version to install`,title:`Installed ${e} — update available. Selected ${r}; tap to choose another version.`,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-bold font-mono border border-amber-500/40 bg-amber-500/15 text-amber-500 hover:bg-amber-500/25 animate-pulse disabled:opacity-50 disabled:cursor-not-allowed transition-colors`,children:[k(`span`,{className:`font-normal opacity-70`,children:e}),k(`span`,{className:`font-normal opacity-70`,children:`→`}),r,k(F,{className:`h-3 w-3`})]}),c]})}return w(`div`,{className:`relative inline-flex items-center gap-1 shrink-0`,children:[w(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),s()},disabled:a,className:[`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-bold font-mono border transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,i===`local`?`border-orange-500/30 bg-orange-500/10 text-orange-400 hover:bg-orange-500/20`:`border-emerald-500/30 bg-emerald-500/10 text-emerald-400 hover:bg-emerald-500/20`].join(` `),title:`Version ${e} — tap to view all versions`,children:[e,k(F,{className:`h-3 w-3 opacity-50`})]}),c]})}function Te({addonId:e}){let t=D(),{data:r=`inherit`}=y({addonId:e}),i=n({onSuccess:()=>{t.invalidateQueries({queryKey:[[`addons`,`getAddonAutoUpdate`]]})}});return k(`div`,{className:`flex rounded-lg border border-border overflow-hidden text-[10px] font-medium`,children:[`inherit`,`off`,`latest`,`beta`].map(t=>k(`button`,{type:`button`,onClick:n=>{n.stopPropagation(),i.mutate({addonId:e,channel:t})},disabled:i.isPending,className:`px-2.5 py-1 transition-colors capitalize ${r===t?t===`inherit`?`bg-gray-700/50 text-gray-700 dark:text-gray-300`:t===`off`?`bg-gray-700 text-gray-700 dark:text-gray-300`:t===`latest`?`bg-blue-500/20 text-blue-400`:`bg-amber-500/20 text-amber-400`:`bg-transparent text-foreground-subtle hover:bg-surface-hover`} ${t===`inherit`?``:`border-l border-border`}`,children:t},t))})}function Ee({addon:n,agents:r=[],clusterStatus:i,hideVersion:o,availableUpdate:s,onUpdate:u,isUpdating:ee,jobProgress:d,bundle:p,bulkItem:m,disabledByBulk:h,isSystem:g}){let[v,y]=O(!1),[ne,re]=O(!1),[ie,b]=O(!1),[x,S]=O(null);A(()=>{S(null)},[s]);let C=x??s,[ae,T]=O(!1),[oe,j]=O(!1),[M,le]=O(`logs`),P=D(),ue=se(),I=de(),fe=a(),{manifest:L}=n,R=n.installedOn??[],z=!p&&!L.protected&&L.removable!==!1,U=!!p,K=p?.displayName??L.name,q=p?.packageName??L.packageName,J=p?.version??L.packageVersion??L.version,Y=p?.installSource??n.installSource,ge=p?p.bundle?.description??p.addons[0]?.manifest.description:L.description,_e=e({onSuccess:()=>{P.invalidateQueries({queryKey:[[`addons`]]}),P.invalidateQueries({queryKey:[[`addonPages`]]}),P.invalidateQueries({queryKey:[[`capabilities`]]})}}),X=t({onSuccess:()=>{P.invalidateQueries({queryKey:[[`addons`]]})}}),be=l({onSuccess:()=>{P.invalidateQueries({queryKey:[[`addons`]]}),P.invalidateQueries({queryKey:[[`addonPages`]]}),P.invalidateQueries({queryKey:[[`capabilities`]]}),P.invalidateQueries({queryKey:[[`integrations`]]})}}),Z=c({onSuccess:()=>{P.invalidateQueries({queryKey:[[`addons`]]}),P.invalidateQueries({queryKey:[[`alerts`]]})}}),Q=n.health,De=Q?.phase===`failed`&&!Q.inGracePeriod,Oe=De&&Q?.nextRetryAt&&!Q.retrying;return w(`div`,{className:`rounded-lg border bg-surface overflow-hidden ${De?`border-red-500/50`:`border-border`}`,children:[De&&Q&&w(`div`,{className:`bg-danger/10 border-b border-danger/30 px-4 py-2.5 flex items-start gap-2.5`,children:[k(W,{className:`h-4 w-4 text-danger shrink-0 mt-0.5`}),w(`div`,{className:`flex-1 min-w-0`,children:[w(`div`,{className:`text-xs font-semibold text-danger`,children:[`Failed to load (attempt #`,Q.retryCount,`)`]}),k(`div`,{className:`text-[11px] text-foreground mt-0.5 break-words font-mono`,children:Q.lastError?.message??`Unknown error`}),Oe&&Q.nextRetryAt&&w(`div`,{className:`text-[10px] text-foreground-subtle mt-1`,children:[`Auto-retry at `,new Date(Q.nextRetryAt).toLocaleTimeString()]})]}),w(`button`,{type:`button`,disabled:Z.isPending||Q.retrying,onClick:e=>{e.stopPropagation(),Z.mutate({packageName:q})},className:`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1 text-[11px] font-semibold border border-red-400/40 bg-red-400/10 text-red-700 dark:text-red-300 hover:bg-red-400/20 disabled:opacity-50 disabled:cursor-not-allowed transition-colors shrink-0`,title:`Reset retry counter and force immediate reload`,children:[k(N,{className:`h-3 w-3 ${Z.isPending||Q.retrying?`animate-spin`:``}`}),`Retry now`]})]}),w(`div`,{className:`flex items-start gap-3 px-4 py-3`,children:[k(Ce,{isBundle:U||!!L.components&&L.components.length>1,installSource:Y,addonId:U?p.addons[0]?.manifest.id:L.id,iconPath:U?p.bundle?.icon??p.addons[0]?.manifest.icon:L.icon,color:U?p.addons[0]?.manifest.color:L.color}),w(`div`,{className:`flex-1 min-w-0`,children:[w(`div`,{className:`flex items-start justify-between gap-2`,children:[k(`span`,{className:`text-sm font-semibold text-foreground truncate min-w-0`,children:K}),!o&&k(we,{version:J,availableUpdate:s,...C===void 0?{}:{selectedVersion:C},isUpdating:ee,installSource:Y,disabled:h,...u&&C!==void 0?{onUpdate:()=>u(C)}:{},onOpenPicker:()=>b(e=>!e),children:ie&&k(ye,{packageName:q,currentVersion:J,...Y?{installSource:Y}:{},...s!==void 0&&C!==void 0?{selectedVersion:C,onSelect:e=>{S(e),b(!1)}}:{},onInstall:e=>{b(!1),be.mutate({packageName:q,version:e})},onClose:()=>b(!1)})})]}),w(`div`,{className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 mt-0.5`,children:[q!==K&&k(`span`,{className:`text-[10px] text-foreground-subtle font-mono truncate max-w-full`,children:q}),U&&w(`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:[k(G,{className:`h-3 w-3`}),p.addons.length]}),g&&w(`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:[k(N,{className:`h-3 w-3`}),`System`]}),m!=null&&k(xe,{item:m}),d!=null&&k(ve,{progress:d})]}),ge&&k(`p`,{className:`text-[10px] text-foreground-subtle mt-1 line-clamp-1`,children:ge}),!U&&n.process&&w(`div`,{className:`flex flex-wrap items-center gap-1.5 mt-1`,children:[k(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium ${n.process.mode===`forked`?`bg-blue-500/15 text-blue-400`:`bg-gray-500/15 text-gray-400`}`,children:n.process.mode===`forked`?`forked`:`in-process`}),n.process.pid!=null&&w(`span`,{className:`text-[9px] font-mono text-foreground-subtle`,children:[`PID `,n.process.pid]}),k(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium ${n.process.state===`running`?`bg-emerald-500/15 text-emerald-400`:n.process.state===`crashed`||n.process.state===`failed`?`bg-red-500/15 text-red-400`:`bg-gray-500/15 text-gray-400`}`,children:n.process.state})]})]})]}),!U&&w(`div`,{className:`flex items-center gap-1 px-4 py-1.5 border-t border-border/50 bg-surface-hover/20`,children:[w(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),X.mutate({addonId:L.id})},disabled:X.isPending||h,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:[k(N,{className:`h-3 w-3 ${X.isPending?`animate-spin`:``}`}),`Restart`]}),w(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),T(e=>!e)},className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border transition-colors ${ae?`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:[k(pe,{className:`h-3 w-3`}),`Logs`]}),!U&&w(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),j(!0)},className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border transition-colors ${oe?`border-primary/30 bg-primary/10 text-primary`:`border-border text-foreground-subtle hover:text-foreground hover:border-primary/30 hover:bg-primary/10`}`,children:[k(V,{className:`h-3 w-3`}),`Settings`]}),k(`div`,{className:`flex-1`}),z&&w(`button`,{type:`button`,onClick:async e=>{e.stopPropagation(),await fe({title:`Uninstall ${L.name}?`,message:`This will remove the addon package and all its data. This action cannot be undone.`,confirmLabel:`Uninstall`,variant:`danger`})&&_e.mutate({packageName:L.packageName})},disabled:_e.isPending||h,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:[k(H,{className:`h-3 w-3`}),_e.isPending?`Removing...`:`Uninstall`]})]}),i&&i.nodes.length>1&&!U&&w(`div`,{className:`border-t border-border px-4 py-2 bg-muted/10`,children:[k(`div`,{className:`text-[10px] font-medium text-foreground-subtle mb-1.5`,children:`Cluster Deployment`}),k(`div`,{className:`space-y-1`,children:i.nodes.map(e=>w(`div`,{className:`flex items-center gap-2 text-[10px]`,children:[k(`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`}`}),k(`span`,{className:`font-medium text-foreground min-w-[60px]`,children:e.name}),k(`span`,{className:`font-mono text-foreground-subtle`,children:e.version}),!e.synced&&e.status!==`offline`&&k(`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`&&k(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-muted text-muted-foreground`,children:`offline`}),e.synced&&e.status!==`offline`&&k(`span`,{className:`text-[9px] text-success`,children:`synced`})]},e.nodeId))})]}),ae&&!U&&w(`div`,{className:`border-t border-border`,children:[w(`div`,{className:`flex items-center px-4 py-1 bg-surface-hover/20 border-b border-border/50`,children:[w(`div`,{className:`flex rounded border border-border overflow-hidden text-[9px]`,children:[k(`button`,{type:`button`,onClick:()=>le(`logs`),className:`px-2 py-0.5 transition-colors ${M===`logs`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:`Logs`}),k(`button`,{type:`button`,onClick:()=>le(`events`),className:`px-2 py-0.5 border-l border-border transition-colors ${M===`events`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:`Events`})]}),k(`div`,{className:`flex-1`}),k(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),T(!1)},className:`text-foreground-subtle hover:text-foreground`,children:k(B,{className:`h-3.5 w-3.5`})})]}),M===`logs`&&k(f,{addonId:L.id,maxHeight:`max-h-64`,showFilters:!1}),M===`events`&&k(_,{addonId:L.id,category:`addon.*`,maxHeight:`max-h-64`})]}),U&&w(E,{children:[k(`button`,{type:`button`,onClick:()=>y(e=>!e),className:`w-full flex items-center justify-center border-t border-border py-1 hover:bg-surface-hover/50 transition-colors`,children:k(v?he:F,{className:`h-3.5 w-3.5 text-foreground-subtle`})}),v&&k(`div`,{className:`border-t border-border px-3 py-2 space-y-2`,children:p.addons.map(e=>k(Ee,{addon:e,agents:r,hideVersion:!0},e.manifest.id))})]}),oe&&!U&&k(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4`,onClick:()=>j(!1),children:w(`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:[w(`div`,{className:`flex items-center justify-between px-5 py-3 border-b border-border flex-shrink-0`,children:[w(`div`,{className:`flex items-center gap-2`,children:[k(V,{className:`h-4 w-4 text-primary`}),w(`h2`,{className:`text-sm font-semibold text-foreground`,children:[K,` Settings`]})]}),k(`button`,{onClick:()=>j(!1),className:`text-foreground-subtle hover:text-foreground transition-colors p-1 rounded`,children:k(B,{className:`h-4 w-4`})})]}),w(`div`,{className:`flex-1 overflow-y-auto px-5 py-4 space-y-4`,children:[k(me,{nodeId:`hub`,addonIds:[L.id],level:`global`}),Se(L)&&w(`div`,{children:[k(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:`Device export`}),k(te,{addonId:L.id,trpc:ue.trpcClient,onOpenDevice:e=>I(`/devices/${e}`)})]}),Y===`npm`&&w(`div`,{children:[k(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:`Auto-Update`}),k(Te,{addonId:L.id})]}),L.components&&L.components.length>0&&w(`div`,{children:[w(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:[`Components (`,L.components.length,`)`]}),k(`div`,{className:`flex flex-wrap gap-1`,children:L.components.map(e=>k(`span`,{className:`text-[10px] rounded bg-background border border-border px-1.5 py-0.5 text-foreground-subtle font-mono`,children:e},e))})]}),r.length>=2&&w(`div`,{children:[k(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:`Installed on`}),w(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[R.length===0&&k(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Hub (local)`}),R.map(e=>k(`span`,{className:`rounded-full bg-surface-hover border border-border px-2 py-0.5 text-[10px] text-foreground-subtle`,children:e},e)),w(`div`,{className:`relative`,children:[w(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),re(e=>!e)},className:`inline-flex items-center gap-1 rounded-full border border-dashed border-border px-2 py-0.5 text-[10px] text-foreground-subtle hover:text-foreground hover:border-primary transition-colors`,title:`Install on more agents`,children:[k(ce,{className:`h-3 w-3`}),`Add agent`]}),ne&&w(`div`,{className:`absolute left-0 top-full mt-1 z-10 min-w-[160px] rounded-md border border-border bg-surface shadow-lg overflow-hidden`,children:[r.filter(e=>!e.isHub&&!R.includes(e.name)).map(e=>k(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),re(!1)},className:`w-full text-left px-3 py-1.5 text-[10px] text-foreground hover:bg-surface-hover transition-colors`,children:e.name},e.id)),r.filter(e=>!e.isHub&&!R.includes(e.name)).length===0&&k(`div`,{className:`px-3 py-1.5 text-[10px] text-foreground-subtle`,children:`No available agents`})]})]})]})]})]}),k(`div`,{className:`flex items-center justify-end px-5 py-3 border-t border-border flex-shrink-0`,children:k(`button`,{type:`button`,onClick:()=>j(!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`})})]})})]})}C();var Q=`.tgz,.tar.gz,.zip`;function De({onUploadSuccess:e}){let[t,n]=O(!1),r=S(null),i=x(async t=>{n(!0);let r=new FormData;r.append(`file`,t);let i=localStorage.getItem(`camstack_admin_token`)??``;try{(await(await fetch(`/api/addons/upload`,{method:`POST`,headers:{Authorization:`Bearer ${i}`},body:r})).json()).success&&e()}finally{n(!1)}},[e]);return w(E,{children:[k(`input`,{ref:r,type:`file`,accept:Q,onChange:x(e=>{let t=e.target.files?.[0];t&&i(t),e.target.value=``},[i]),className:`hidden`}),w(`button`,{type:`button`,onClick:()=>r.current?.click(),disabled:t,className:`flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-md bg-surface hover:bg-surface-hover border border-border disabled:opacity-50 transition-colors`,children:[t?k(L,{className:`w-3.5 h-3.5 animate-spin`}):k(P,{className:`w-3.5 h-3.5`}),t?`Uploading...`:`Upload`]})]})}C();var Oe=new Set([`@camstack/system`,`@camstack/types`,`@camstack/sdk`,`@camstack/shm-ring`,`@camstack/ui-library`]);function ke(e){return e!==void 0&&Oe.has(e)}function Ae(e,t){let n=e??`hub-only`;return n===`any-node`?!0:n===`hub-only`?t:!t}function je(e){let t=e;if(!t?.manifest)return null;let n={...t.manifest,name:t.manifest.name??t.manifest.id,version:t.manifest.version??`0.0.0`,capabilities:t.manifest.capabilities??[]},r=t.process,i=r?{pid:r.pid,mode:r.mode===`forked`?`forked`:`in-process`,state:r.state??`unknown`}:void 0,a=t.health,o=t.declaration?.execution,s=t.manifest.execution,c=o?.placement??s?.placement;return{manifest:n,enabled:!0,source:t.source,installSource:t.installSource,installedOn:[],...i?{process:i}:{},hasBackup:t.hasBackup,...a?{health:a}:{},...c?{placement:c}:{}}}function Me(e){let t=new Map,n=[];for(let r of e){let e=r.manifest.packageName;if(!e){n.push(r);continue}let i=t.get(e);if(i)i.addons.push(r);else{let n=r.manifest.bundle,i={packageName:e,displayName:n?.displayName??r.manifest.packageDisplayName??r.manifest.name,version:r.manifest.packageVersion,addons:[r],...r.installSource===void 0?{}:{installSource:r.installSource},...n===void 0?{}:{bundle:n}};t.set(e,i)}}let r=[];for(let e of t.values())e.bundle!==void 0||e.addons.length>=2?r.push({bundle:e,representative:e.addons[0]}):r.push(e.addons[0]);return r.push(...n),r}function $(e){return`bundle`in e}function Ne({addons:e,clusterStatus:t,selectedNode:n,onRefresh:i,isRefreshing:o}){let s=D(),[c,u]=O(``),d=ae(c),[f,p]=O(!1),_=S(null);A(()=>{if(!f)return;let e=e=>{_.current&&!_.current.contains(e.target)&&p(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[f]);let{data:y}=re({nodeId:n.id}),te=T(()=>{let e=new Map;for(let t of y??[])e.set(t.name,t.latestVersion);return e},[y]),ne=T(()=>(y??[]).filter(e=>!e.isSystem).length,[y]),[ie,b]=O(()=>new Set),[C,E]=O(()=>new Map),oe=x(e=>{b(t=>new Set(t).add(e))},[]),se=x(e=>{b(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n})},[]),j=x((e,t)=>{E(n=>new Map(n).set(e,t))},[]),ce=x(e=>{E(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),P=h({onMutate:e=>{oe(e.name),ce(e.name)},onSuccess:(e,t)=>{se(t.name);let n=e;if(n&&n.success===!1){j(t.name,n.error??`Update failed (no error message returned by server)`);return}s.invalidateQueries({queryKey:[[`addons`]]}),s.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]})},onError:(e,t)=>{se(t.name),j(t.name,e instanceof Error?e.message:String(e))}}),F=_e(),de=S(new Set);A(()=>{let e=new Set;for(let[t,n]of F)Y(n)&&e.add(t);let t=[...de.current].some(t=>!e.has(t));de.current=e,t&&(s.invalidateQueries({queryKey:[[`addons`]]}),s.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]}))},[F,s]);let{data:R}=v(void 0),z=ee({onSuccess:()=>{s.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),{data:B,isFetching:pe}=r({query:d||void 0},{enabled:f}),V=g(),{data:H}=m(void 0),U=H?.requestedAt,[me,he]=O(null),[W,G]=O(!1);A(()=>{if(H?.kind===`framework-bulk-update`&&H.requestedAt!==me){he(H.requestedAt),G(!0);let e=window.setTimeout(()=>G(!1),6e3);return()=>window.clearTimeout(e)}},[U,me,H]),a();let K=x(async()=>{let e=(y??[]).filter(e=>!e.isSystem);e.length!==0&&await V.mutateAsync({kind:`update`,targets:e.map(e=>({name:e.name,version:e.latestVersion})),nodeIds:[n.id]})},[y,n.id,V]),q=l({onSuccess:()=>{s.invalidateQueries({queryKey:[[`addons`]]}),s.invalidateQueries({queryKey:[[`addonPages`]]}),s.invalidateQueries({queryKey:[[`capabilities`]]}),s.invalidateQueries({queryKey:[[`integrations`]]})}}),[J,ge]=O(`type`),[X,ve]=O(()=>typeof window>`u`?`grouped`:window.localStorage.getItem(`camstack.addons.viewMode`)===`flat`?`flat`:`grouped`),ye=e=>{ve(e),typeof window<`u`&&window.localStorage.setItem(`camstack.addons.viewMode`,e)},[be,xe]=ue(),Z=be.get(`capability`),Se=T(()=>{let t=e.filter(e=>!ke(e.manifest.packageName));return n.isHub||(t=t.filter(e=>Ae(e.placement,n.isHub))),Z&&(t=t.filter(e=>(e.manifest.capabilities??[]).some(e=>(typeof e==`string`?e:e.name)===Z))),t},[e,n.isHub,Z]),Ce=()=>{let e=new URLSearchParams(be);e.delete(`capability`),xe(e,{replace:!0})},we=X===`flat`?Se:Me(Se),Te=T(()=>{let e=[...we];switch(J){case`type`:e.sort((e,t)=>{let n=+!$(e),r=+!$(t);if(n!==r)return n-r;let i=$(e)?e.bundle.displayName:e.manifest.name,a=$(t)?t.bundle.displayName:t.manifest.name;return i.localeCompare(a)});break;case`name`:e.sort((e,t)=>{let n=$(e)?e.bundle.displayName:e.manifest.name,r=$(t)?t.bundle.displayName:t.manifest.name;return n.localeCompare(r)});break;case`source`:e.sort((e,t)=>{let n=$(e)?e.bundle.installSource??``:e.installSource??``,r=$(t)?t.bundle.installSource??``:t.installSource??``;return n.localeCompare(r)});break}return e},[we,J]);return w(`div`,{className:`space-y-4`,children:[[...C.entries()].map(([e,t])=>k(`div`,{className:`rounded-md border border-danger/30 bg-danger/5 px-3 py-2 text-[11px]`,children:w(`div`,{className:`flex items-start justify-between gap-3`,children:[w(`div`,{className:`space-y-0.5`,children:[w(`div`,{className:`font-medium text-danger`,children:[`Failed to update `,e]}),k(`div`,{className:`text-foreground-subtle font-mono`,children:t})]}),k(`button`,{type:`button`,onClick:()=>ce(e),className:`text-foreground-subtle hover:text-foreground text-[10px]`,children:`dismiss`})]})},e)),w(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[w(`div`,{className:`flex items-center gap-1.5`,children:[k(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Sort:`}),w(`select`,{value:J,onChange:e=>ge(e.target.value),className:`rounded-md border border-border bg-surface px-2 py-1.5 text-[11px] text-foreground focus:outline-none focus:border-primary/50`,children:[k(`option`,{value:`type`,children:`Bundles first`}),k(`option`,{value:`name`,children:`Name`}),k(`option`,{value:`source`,children:`Install source`})]})]}),w(`div`,{className:`flex items-center gap-1.5`,children:[k(`span`,{className:`text-[10px] text-foreground-subtle`,children:`View:`}),k(`div`,{className:`flex rounded-md border border-border overflow-hidden text-[10px] font-medium`,children:[`grouped`,`flat`].map(e=>k(`button`,{type:`button`,onClick:()=>ye(e),className:`px-2.5 py-1.5 transition-colors capitalize ${X===e?`bg-primary/10 text-primary`:`bg-transparent text-foreground-subtle hover:bg-surface-hover`}`,title:e===`grouped`?`Group multi-addon packages into a bundle card`:`Show every addon as its own card`,children:e},e))})]}),n.isHub&&w(`div`,{className:`flex items-center gap-1.5`,children:[k(N,{className:`h-3 w-3 text-foreground-subtle`}),k(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Auto-Update:`}),k(`div`,{className:`flex rounded-md border border-border overflow-hidden text-[10px] font-medium`,children:[`off`,`latest`,`beta`].map(e=>k(`button`,{type:`button`,onClick:()=>z.mutate({channel:e}),disabled:z.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))})]}),ne>0&&w(`button`,{type:`button`,onClick:()=>void K(),disabled:V.isPending,className:`flex items-center gap-1.5 px-2.5 py-1.5 text-[11px] rounded-md bg-blue-500/10 text-blue-400 hover:bg-blue-500/20 border border-blue-500/30 disabled:opacity-50 transition-colors font-medium`,children:[V.isPending?k(L,{className:`w-3 h-3 animate-spin`}):k(M,{className:`w-3 h-3`}),V.isPending?`Updating…`:`Update All (${ne})`]}),w(`button`,{type:`button`,onClick:i,disabled:o||V.isPending,className:`flex items-center gap-1.5 px-2.5 py-1.5 text-[11px] rounded-md bg-surface hover:bg-surface-hover border border-border disabled:opacity-50 transition-colors`,children:[k(N,{className:`w-3 h-3 ${o?`animate-spin`:``}`}),`Refresh`]})]}),w(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3`,children:[w(`div`,{className:`relative flex-1 min-w-0 sm:min-w-[200px]`,ref:_,children:[k(le,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-foreground-subtle`}),k(`input`,{type:`text`,value:c,onChange:e=>{u(e.target.value),p(!0)},onFocus:()=>p(!0),placeholder:`Search addons on npm...`,disabled:V.isPending,className:`w-full rounded-lg border border-border bg-background pl-9 pr-3 py-2 text-xs text-foreground placeholder:text-foreground-subtle focus:outline-none focus:ring-1 focus:ring-primary disabled:opacity-50 disabled:cursor-not-allowed`}),pe&&k(L,{className:`absolute right-2.5 top-1/2 -translate-y-1/2 h-3 w-3 text-foreground-subtle animate-spin`}),f&&B&&B.length>0&&w(`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:[B.length>0&&w(`div`,{className:`px-3 py-1.5 text-[10px] uppercase tracking-wide text-foreground-subtle border-b border-border`,children:[`npm results (`,B.length,`)`]}),B&&B.length>0&&k(`div`,{className:`max-h-72 overflow-auto divide-y divide-border`,children:B.map(e=>w(`div`,{className:`flex items-center gap-3 px-3 py-2 hover:bg-surface-hover transition-colors`,children:[k(`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()}),w(`div`,{className:`flex-1 min-w-0`,children:[w(`div`,{className:`flex items-baseline gap-2 min-w-0`,children:[k(`span`,{className:`text-[11px] font-semibold break-words`,children:e.name.replace(/^@camstack\/(addon-)?/,``)}),w(`span`,{className:`text-[10px] text-foreground-subtle shrink-0`,children:[`v`,e.version]})]}),k(`div`,{className:`font-mono text-[9px] text-foreground-subtle/80 truncate`,children:e.name}),e.description&&k(`div`,{className:`text-[10px] text-foreground-subtle truncate`,children:e.description})]}),e.installed?w(`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:[k(I,{className:`h-3 w-3`}),e.installedVersion??`Installed`]}):w(`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?k(L,{className:`h-3 w-3 animate-spin`}):k(M,{className:`h-3 w-3`}),`Install`]})]},e.name))})]})]}),k(De,{onUploadSuccess:()=>{s.invalidateQueries({queryKey:[[`addons`]]}),i()}})]}),Z&&w(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-lg bg-primary/10 border border-primary/30 text-sm`,children:[k(`span`,{className:`text-foreground-subtle`,children:`Filtering by capability:`}),k(`span`,{className:`font-mono text-primary font-semibold`,children:Z}),k(`button`,{type:`button`,onClick:Ce,className:`ml-auto text-xs text-foreground-subtle hover:text-foreground underline`,children:`Clear`})]}),W&&w(`div`,{className:`fixed top-4 right-4 z-50 flex items-start gap-2 px-3 py-2.5 rounded-md border border-green-500/30 bg-green-500/10 shadow-lg backdrop-blur-sm max-w-sm pointer-events-auto`,children:[k(fe,{className:`w-4 h-4 shrink-0 mt-0.5 text-green-400`}),w(`div`,{children:[k(`div`,{className:`text-[11px] font-semibold text-foreground`,children:`Bulk update completed`}),k(`div`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:`System packages updated — hub restarted successfully.`})]})]}),Se.length===0&&k(`div`,{className:`text-xs text-foreground-subtle`,children:e.length===0?`No addons installed`:Z?`No installed addons declare the "${Z}" capability. Browse the npm catalog above to find a compatible addon.`:`No addons compatible with ${n.name} (placement filter active)`}),k(`div`,{className:`space-y-2`,children:Te.map(e=>{let r=$(e)?e.bundle.packageName:e.manifest.packageName,i=te.get(r),a=$(e)?e.representative:e,o=i?e=>P.mutate({name:r,version:e,nodeId:n.id}):void 0,s=F.get(r)??null,c=s!==null&&Y(s);return k(Ee,{addon:a,clusterStatus:t?.[a.manifest.id],bundle:$(e)?e.bundle:void 0,availableUpdate:i,isUpdating:ie.has(r)||c,jobProgress:s,onUpdate:o,disabledByBulk:V.isPending},$(e)?r:e.manifest.id)})})]})}function Pe(){let e=D(),{data:t,isLoading:n,isError:r}=ne(),{data:a}=o(void 0),{data:c}=b(void 0,{refetchInterval:1e4}),l=T(()=>{let e=new Map;e.set(`hub`,{id:`hub`,name:`Hub`,isHub:!0});for(let t of c??[]){let n=String(t.id??``);n&&e.set(n,{id:n,name:String(t.name??n),isHub:!!t.isHub})}return[...e.values()]},[c]),[u,ee]=O(`hub`),f=l.find(e=>e.id===u)??l[0],p=d(),m=s(),h=p.isPending||m.isPending,g=async()=>{await p.mutateAsync({nodeId:u}),await m.mutateAsync(),e.invalidateQueries({queryKey:[[`addons`]]})},_=S(p);_.current=p,A(()=>{_.current.mutate({nodeId:`hub`})},[]);let v=(t??[]).map(je).filter(e=>e!==null);return w(U,{children:[w(`div`,{className:`flex items-center justify-between gap-3 flex-wrap`,children:[k(i,{selectedNodeId:u,onSelect:ee}),w(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[!n&&!r&&w(`span`,{className:`text-[10px] rounded-full bg-primary/10 text-primary px-2 py-0.5 font-medium`,children:[v.length,` installed`]}),w(`button`,{type:`button`,onClick:()=>void g(),disabled:h,className:`inline-flex items-center gap-1.5 px-2.5 py-1.5 text-[11px] rounded-md bg-surface hover:bg-surface-hover border border-border disabled:opacity-50 transition-colors`,title:`Re-fetch addons + check npm for new versions`,children:[k(N,{className:`w-3 h-3 ${h?`animate-spin`:``}`}),`Check for updates`]})]})]}),!f.isHub&&w(`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`,` `,k(`span`,{className:`font-medium text-foreground`,children:f.name}),` — agents only run`,` `,k(`code`,{className:`font-mono`,children:`agent-only`}),` and`,` `,k(`code`,{className:`font-mono`,children:`any-node`}),` addons. Install / uninstall is hub-driven; agents auto-sync from the hub.`]}),n&&k(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading…`}),r&&k(`div`,{className:`text-xs text-danger`,children:`Failed to load addons`}),!n&&!r&&k(Ne,{addons:v,clusterStatus:a,selectedNode:f,onRefresh:()=>void g(),isRefreshing:h})]})}export{Pe as AddonsPage};
|