@camstack/addon-agent-ui 1.2.262 → 1.2.264
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/addon.js +184 -96
- package/dist/assets/{MotionZonesSettings-DH5gddBu.js → MotionZonesSettings-DipnNSI1.js} +1 -1
- package/dist/assets/{PrivacyMaskSettings-CG6g0FLm.js → PrivacyMaskSettings-B9SuP4eL.js} +1 -1
- package/dist/assets/{SceneMonitorEditor-CtRqChIw.js → SceneMonitorEditor-BjyTwtI_.js} +1 -1
- package/dist/assets/index-1hdxo5Nk.css +2 -0
- package/dist/assets/index-B7wsVbUT.js +112 -0
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/dist/assets/index-2QEC5xoI.js +0 -112
- package/dist/assets/index-DVzo-8Se.css +0 -2
package/dist/addon.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
|
-
//#region ../types/dist/event-category-
|
|
3
|
+
//#region ../types/dist/event-category-Ceif8n-v.mjs
|
|
4
4
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
5
5
|
EventCategory["SystemBoot"] = "system.boot";
|
|
6
6
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -472,6 +472,10 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
472
472
|
* on the device detail page.
|
|
473
473
|
*/
|
|
474
474
|
EventCategory["DoorbellOnPressed"] = "doorbell.onPressed";
|
|
475
|
+
/** Mirrors `runningStateCapability.events.onStarted`. */
|
|
476
|
+
EventCategory["RunningStarted"] = "running.started";
|
|
477
|
+
/** Mirrors `runningStateCapability.events.onFinished`. */
|
|
478
|
+
EventCategory["RunningFinished"] = "running.finished";
|
|
475
479
|
/**
|
|
476
480
|
* Cap event fired by every device that registers the `event-emitter`
|
|
477
481
|
* capability. Mirrors `eventEmitterCapability.events.onEvent`. Carries
|
|
@@ -5431,7 +5435,7 @@ var ZodIssueCode = {
|
|
|
5431
5435
|
var ZodFirstPartyTypeKind;
|
|
5432
5436
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5433
5437
|
//#endregion
|
|
5434
|
-
//#region ../types/dist/sleep-
|
|
5438
|
+
//#region ../types/dist/sleep-CYfIZzGv.mjs
|
|
5435
5439
|
/**
|
|
5436
5440
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5437
5441
|
* window to float samples (D455).
|
|
@@ -5770,7 +5774,7 @@ Object.fromEntries([
|
|
|
5770
5774
|
* `hydrateSchema` to skip the `value` injection for structural-only fields.
|
|
5771
5775
|
*/
|
|
5772
5776
|
function isValuelessField(field) {
|
|
5773
|
-
return field.type === "separator" || field.type === "info" || field.type === "qr-code" || field.type === "button" || field.type === "object-array" || field.type === "widget" || field.type === "addon-action-button" || field.type === "device-action-button";
|
|
5777
|
+
return field.type === "separator" || field.type === "info" || field.type === "qr-code" || field.type === "button" || field.type === "object-array" || field.type === "widget" || field.type === "addon-action-button" || field.type === "device-action-button" || field.type === "account-sign-in" || field.type === "secret-presence";
|
|
5774
5778
|
}
|
|
5775
5779
|
function hydrateSchema(schema, values, options = {}) {
|
|
5776
5780
|
return {
|
|
@@ -8749,7 +8753,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
|
|
|
8749
8753
|
return DeviceRole;
|
|
8750
8754
|
}({});
|
|
8751
8755
|
//#endregion
|
|
8752
|
-
//#region ../types/dist/composition-
|
|
8756
|
+
//#region ../types/dist/composition-xz-ud5EQ.mjs
|
|
8753
8757
|
/**
|
|
8754
8758
|
* The ffmpeg build every CamStack node downloads, per platform and arch.
|
|
8755
8759
|
*
|
|
@@ -9050,6 +9054,20 @@ var table = {
|
|
|
9050
9054
|
apply: () => {
|
|
9051
9055
|
throw new ExpressionEvalError("count: stateful evaluation context is required");
|
|
9052
9056
|
}
|
|
9057
|
+
},
|
|
9058
|
+
dwell: {
|
|
9059
|
+
minArgs: 3,
|
|
9060
|
+
maxArgs: 3,
|
|
9061
|
+
apply: () => {
|
|
9062
|
+
throw new ExpressionEvalError("dwell: stateful evaluation context is required");
|
|
9063
|
+
}
|
|
9064
|
+
},
|
|
9065
|
+
latchedAt: {
|
|
9066
|
+
minArgs: 1,
|
|
9067
|
+
maxArgs: 1,
|
|
9068
|
+
apply: () => {
|
|
9069
|
+
throw new ExpressionEvalError("latchedAt: stateful evaluation context is required");
|
|
9070
|
+
}
|
|
9053
9071
|
}
|
|
9054
9072
|
};
|
|
9055
9073
|
Object.freeze(Object.assign(Object.create(null), table));
|
|
@@ -15893,7 +15911,15 @@ Object.freeze({
|
|
|
15893
15911
|
kind: "fixed",
|
|
15894
15912
|
result: ["number", "null"]
|
|
15895
15913
|
},
|
|
15896
|
-
count: NUMBER
|
|
15914
|
+
count: NUMBER,
|
|
15915
|
+
dwell: {
|
|
15916
|
+
kind: "fixed",
|
|
15917
|
+
result: ["boolean", "null"]
|
|
15918
|
+
},
|
|
15919
|
+
latchedAt: {
|
|
15920
|
+
kind: "fixed",
|
|
15921
|
+
result: ["number", "null"]
|
|
15922
|
+
}
|
|
15897
15923
|
});
|
|
15898
15924
|
`${COMPOSED_DEVICE_STABLE_ID_PREFIX}`;
|
|
15899
15925
|
/**
|
|
@@ -42087,9 +42113,6 @@ var NcSystemEventKindSchema = _enum([
|
|
|
42087
42113
|
"device-battery-normal",
|
|
42088
42114
|
"device-consumable-low",
|
|
42089
42115
|
"device-consumable-normal",
|
|
42090
|
-
"device-tank-low",
|
|
42091
|
-
"device-tank-full",
|
|
42092
|
-
"device-tank-normal",
|
|
42093
42116
|
"stream-online",
|
|
42094
42117
|
"stream-offline",
|
|
42095
42118
|
"node-online",
|
|
@@ -42136,13 +42159,14 @@ var NcSystemEventKindSchema = _enum([
|
|
|
42136
42159
|
"camera-enabled"
|
|
42137
42160
|
]);
|
|
42138
42161
|
/** The legacy tail of {@link NcSystemEventKindSchema} — see its docblock. */
|
|
42139
|
-
var NC_LEGACY_SYSTEM_EVENT_KINDS =
|
|
42162
|
+
var NC_LEGACY_SYSTEM_EVENT_KINDS = [
|
|
42140
42163
|
"camera-online",
|
|
42141
42164
|
"camera-offline",
|
|
42142
42165
|
"camera-disabled",
|
|
42143
42166
|
"camera-enabled"
|
|
42144
|
-
]
|
|
42145
|
-
|
|
42167
|
+
];
|
|
42168
|
+
var NC_LEGACY_SYSTEM_EVENT_KIND_SET = new Set(NC_LEGACY_SYSTEM_EVENT_KINDS);
|
|
42169
|
+
NcSystemEventKindSchema.options.filter((kind) => !NC_LEGACY_SYSTEM_EVENT_KIND_SET.has(kind));
|
|
42146
42170
|
/**
|
|
42147
42171
|
* The panel's transitions, as ONE list.
|
|
42148
42172
|
*
|
|
@@ -43261,18 +43285,11 @@ var NcRuleSchema = NcRuleInputSchema.extend({
|
|
|
43261
43285
|
*/
|
|
43262
43286
|
disabledTargetIds: array(string()).default([])
|
|
43263
43287
|
});
|
|
43264
|
-
/**
|
|
43265
|
-
* The state-summary SECTIONS (D647 / D698 / D708): the D637 kind groups that
|
|
43266
|
-
* report a still-true state. `addons` is the crash-looped addons only and
|
|
43267
|
-
* `addon-updates` the addons that are behind (D708 split them). `backups-exports` and `alarm` are not sections — a completed
|
|
43268
|
-
* job is not an open state, and the alarm stays instant.
|
|
43269
|
-
*/
|
|
43270
43288
|
var NcStateSummarySectionIdSchema = _enum([
|
|
43271
43289
|
"device-state",
|
|
43272
43290
|
"streams",
|
|
43273
43291
|
"battery",
|
|
43274
43292
|
"consumables",
|
|
43275
|
-
"tanks",
|
|
43276
43293
|
"detection-blind",
|
|
43277
43294
|
"nodes",
|
|
43278
43295
|
"addons",
|
|
@@ -44573,6 +44590,18 @@ Object.freeze({
|
|
|
44573
44590
|
reason: "camera sensor mappings not loaded"
|
|
44574
44591
|
});
|
|
44575
44592
|
/**
|
|
44593
|
+
* What the vision model must answer before a package event is emitted
|
|
44594
|
+
* when a packages rule has "Confirm with the LLM" on.
|
|
44595
|
+
*
|
|
44596
|
+
* `package` is the verdict. `confidence` is 0..1. `reason` is the model's
|
|
44597
|
+
* one-line explanation, stored on the event so a drop is not silent.
|
|
44598
|
+
*/
|
|
44599
|
+
var PackageLlmVerdictSchema = object({
|
|
44600
|
+
package: boolean(),
|
|
44601
|
+
confidence: number().min(0).max(1),
|
|
44602
|
+
reason: string().min(1)
|
|
44603
|
+
});
|
|
44604
|
+
/**
|
|
44576
44605
|
* A model choice has a SCOPE, and a scope change has a workflow.
|
|
44577
44606
|
*
|
|
44578
44607
|
* ## The two scopes
|
|
@@ -45509,6 +45538,21 @@ var ObjectEventSchema = object({
|
|
|
45509
45538
|
* pick-up written before D684 — UNKNOWN, never 0 and never `timestamp`.
|
|
45510
45539
|
*/
|
|
45511
45540
|
observedAt: number().optional(),
|
|
45541
|
+
/**
|
|
45542
|
+
* The delivery was emitted without a vision-model yes (D931).
|
|
45543
|
+
*
|
|
45544
|
+
* Set only when the packages rule asked for an LLM confirm and the model
|
|
45545
|
+
* was unreachable, timed out, or answered something that did not parse.
|
|
45546
|
+
* A notification reads it so it can say "possible" instead of a definite
|
|
45547
|
+
* delivery. Absent on every other row, and on a confirm that said yes.
|
|
45548
|
+
*/
|
|
45549
|
+
packagePossible: boolean().optional(),
|
|
45550
|
+
/**
|
|
45551
|
+
* The vision model's verdict, when a packages rule asked for one and the
|
|
45552
|
+
* model answered the schema (D931). A "no" never becomes a row — the
|
|
45553
|
+
* detector drops it and logs the reason. Present on a yes.
|
|
45554
|
+
*/
|
|
45555
|
+
packageLlmVerdict: PackageLlmVerdictSchema.optional(),
|
|
45512
45556
|
/** The parent track's key-event importance [0,1], propagated to every object
|
|
45513
45557
|
* event of the track (so an event row can be sorted by importance without a
|
|
45514
45558
|
* track join). Absent on legacy rows / before the track was scored. */
|
|
@@ -47716,11 +47760,18 @@ var KeptReasonSchema = _enum(["custom-pin"]);
|
|
|
47716
47760
|
* Where a choice's latency came from (D791): this node's own benchmark
|
|
47717
47761
|
* result, or the hardware-class table. Measured on the node beats the table.
|
|
47718
47762
|
*/
|
|
47719
|
-
var LatencySourceSchema = discriminatedUnion("kind", [
|
|
47720
|
-
kind: literal("
|
|
47721
|
-
|
|
47722
|
-
|
|
47723
|
-
|
|
47763
|
+
var LatencySourceSchema = discriminatedUnion("kind", [
|
|
47764
|
+
object({ kind: literal("table") }),
|
|
47765
|
+
object({
|
|
47766
|
+
kind: literal("node-benchmark"),
|
|
47767
|
+
resultId: string(),
|
|
47768
|
+
measuredAtMs: number()
|
|
47769
|
+
}),
|
|
47770
|
+
object({
|
|
47771
|
+
kind: literal("estimated"),
|
|
47772
|
+
estimatedFrom: HardwareClassIdSchema
|
|
47773
|
+
})
|
|
47774
|
+
]);
|
|
47724
47775
|
var DeviceModelChoiceSchema = object({
|
|
47725
47776
|
modelId: string(),
|
|
47726
47777
|
p50Ms: number(),
|
|
@@ -47728,6 +47779,11 @@ var DeviceModelChoiceSchema = object({
|
|
|
47728
47779
|
measured: boolean(),
|
|
47729
47780
|
/** Absent on a plan from before D791 — read as the table. */
|
|
47730
47781
|
source: LatencySourceSchema.optional(),
|
|
47782
|
+
/**
|
|
47783
|
+
* The measured class this latency was scaled from (D930). Absent when the
|
|
47784
|
+
* cell is the table or a node benchmark.
|
|
47785
|
+
*/
|
|
47786
|
+
estimatedFrom: HardwareClassIdSchema.optional(),
|
|
47731
47787
|
/** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
|
|
47732
47788
|
capacitySessions: number(),
|
|
47733
47789
|
personRecall: number()
|
|
@@ -57957,6 +58013,30 @@ includeCrops: boolean().optional() }).optional(), array(VehicleSchema).readonly(
|
|
|
57957
58013
|
kind: "mutation",
|
|
57958
58014
|
auth: "admin"
|
|
57959
58015
|
});
|
|
58016
|
+
var CORE_ULTRA_265K_IGPU_CLOCK_MHZ = 2e3;
|
|
58017
|
+
var positiveOrNull = number().nullable().transform((value) => value !== null && Number.isFinite(value) && value > 0 ? value : null);
|
|
58018
|
+
var textOrNull = string().nullable().transform((value) => value !== null && value.trim() !== "" ? value : null);
|
|
58019
|
+
var PrecisionGopsSchema = object({
|
|
58020
|
+
int8: positiveOrNull,
|
|
58021
|
+
fp16: positiveOrNull
|
|
58022
|
+
});
|
|
58023
|
+
/** What one accelerator device reported. Every failed query is null. */
|
|
58024
|
+
var AcceleratorComputeSchema = object({
|
|
58025
|
+
deviceKey: string(),
|
|
58026
|
+
fullDeviceName: textOrNull,
|
|
58027
|
+
executionUnits: positiveOrNull,
|
|
58028
|
+
clockMHz: positiveOrNull,
|
|
58029
|
+
gops: PrecisionGopsSchema.nullable(),
|
|
58030
|
+
architecture: textOrNull,
|
|
58031
|
+
npuName: textOrNull,
|
|
58032
|
+
tops: positiveOrNull,
|
|
58033
|
+
vendor: textOrNull,
|
|
58034
|
+
webgpuArchitecture: textOrNull,
|
|
58035
|
+
webgpuDevice: textOrNull,
|
|
58036
|
+
computeUnits: positiveOrNull
|
|
58037
|
+
});
|
|
58038
|
+
object({ accelerators: array(AcceleratorComputeSchema).nullable() });
|
|
58039
|
+
64 * CORE_ULTRA_265K_IGPU_CLOCK_MHZ;
|
|
57960
58040
|
var ModelFormatSchema = _enum(MODEL_FORMATS);
|
|
57961
58041
|
var HwAccelBackendInputSchema = _enum([
|
|
57962
58042
|
"videotoolbox",
|
|
@@ -58070,7 +58150,12 @@ var HardwareInfoSchema = object({
|
|
|
58070
58150
|
availableRAM_MB: number(),
|
|
58071
58151
|
gpu: GpuInfoSchema.nullable(),
|
|
58072
58152
|
npu: NpuInfoSchema.nullable(),
|
|
58073
|
-
coral: CoralInfoSchema.nullable().optional()
|
|
58153
|
+
coral: CoralInfoSchema.nullable().optional(),
|
|
58154
|
+
/**
|
|
58155
|
+
* Per-accelerator compute (D930). Omitted by a node that has not probed it.
|
|
58156
|
+
* `null` fields inside an entry are a failed query, never a zero.
|
|
58157
|
+
*/
|
|
58158
|
+
accelerators: array(AcceleratorComputeSchema).readonly().optional()
|
|
58074
58159
|
});
|
|
58075
58160
|
var PlatformScoreSchema = object({
|
|
58076
58161
|
runtime: literal("python"),
|
|
@@ -58603,6 +58688,22 @@ DeviceType.Camera, method(object({ deviceId: number() }), PtzAutotrackStatusSche
|
|
|
58603
58688
|
deviceId: number(),
|
|
58604
58689
|
status: PtzAutotrackStatusSchema
|
|
58605
58690
|
});
|
|
58691
|
+
var RunningStateSourceSchema = _enum(["native", "assigned"]);
|
|
58692
|
+
object({
|
|
58693
|
+
/** null = unknown — never coerced to false (D393). */
|
|
58694
|
+
running: boolean().nullable(),
|
|
58695
|
+
/** Epoch ms the current boolean began; null while `running` is null. */
|
|
58696
|
+
since: number().nullable(),
|
|
58697
|
+
source: RunningStateSourceSchema,
|
|
58698
|
+
phase: string().nullable(),
|
|
58699
|
+
lastFetchedAt: number()
|
|
58700
|
+
});
|
|
58701
|
+
object({
|
|
58702
|
+
deviceId: number(),
|
|
58703
|
+
since: number().nullable(),
|
|
58704
|
+
phase: string().nullable()
|
|
58705
|
+
});
|
|
58706
|
+
Object.values(DeviceType);
|
|
58606
58707
|
DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
|
|
58607
58708
|
kind: "mutation",
|
|
58608
58709
|
auth: "admin"
|
|
@@ -60442,7 +60543,20 @@ var ZoneRuleSchema = object({
|
|
|
60442
60543
|
* Defaults to `true` so operators creating a rule via the UI
|
|
60443
60544
|
* see it active immediately.
|
|
60444
60545
|
*/
|
|
60445
|
-
enabled: boolean().default(true)
|
|
60546
|
+
enabled: boolean().default(true),
|
|
60547
|
+
/**
|
|
60548
|
+
* Package stage only. When true, a package candidate may open from a
|
|
60549
|
+
* scene difference in this rule's zone after a person leaves. The
|
|
60550
|
+
* package model, when it boxes something overlapping, is extra evidence
|
|
60551
|
+
* and is not the gate. Absent or false keeps today's model path.
|
|
60552
|
+
*/
|
|
60553
|
+
detectBySceneDifference: boolean().optional(),
|
|
60554
|
+
/**
|
|
60555
|
+
* Package stage only. When true, a promoted package is shown to the
|
|
60556
|
+
* `llm` cap before the delivery event is emitted. Absent or false emits
|
|
60557
|
+
* as today. Usable with or without `detectBySceneDifference`.
|
|
60558
|
+
*/
|
|
60559
|
+
confirmWithLlm: boolean().optional()
|
|
60446
60560
|
});
|
|
60447
60561
|
array(ZoneRuleSchema).readonly();
|
|
60448
60562
|
object({
|
|
@@ -69884,6 +69998,13 @@ Object.freeze({
|
|
|
69884
69998
|
access: "create",
|
|
69885
69999
|
role: "admin"
|
|
69886
70000
|
},
|
|
70001
|
+
"runningState.getStatus": {
|
|
70002
|
+
capName: "running-state",
|
|
70003
|
+
capScope: "device",
|
|
70004
|
+
addonId: null,
|
|
70005
|
+
access: "view",
|
|
70006
|
+
role: "viewer"
|
|
70007
|
+
},
|
|
69887
70008
|
"sceneMonitor.captureReference": {
|
|
69888
70009
|
capName: "scene-monitor",
|
|
69889
70010
|
capScope: "device",
|
|
@@ -74598,6 +74719,32 @@ var APPLIANCE_CAP_VOCABULARY = {
|
|
|
74598
74719
|
}],
|
|
74599
74720
|
events: { onSent: { notOperatorFacing: "a delivery receipt of a send this system made — not a fact about the world" } }
|
|
74600
74721
|
},
|
|
74722
|
+
"running-state": {
|
|
74723
|
+
scope: "device",
|
|
74724
|
+
noun: t("Running", "In funzione"),
|
|
74725
|
+
state: [{
|
|
74726
|
+
kind: "boolean",
|
|
74727
|
+
field: "running",
|
|
74728
|
+
label: t("Running", "In funzione"),
|
|
74729
|
+
whenTrue: t("When {device} starts", "Quando {device} inizia"),
|
|
74730
|
+
whenFalse: t("When {device} finishes", "Quando {device} finisce"),
|
|
74731
|
+
icon: "play"
|
|
74732
|
+
}],
|
|
74733
|
+
events: {
|
|
74734
|
+
onStarted: {
|
|
74735
|
+
category: EventCategory.RunningStarted,
|
|
74736
|
+
label: t("Started running", "Ha iniziato a funzionare"),
|
|
74737
|
+
phrase: t("When {device} starts running", "Quando {device} inizia a funzionare"),
|
|
74738
|
+
icon: "play"
|
|
74739
|
+
},
|
|
74740
|
+
onFinished: {
|
|
74741
|
+
category: EventCategory.RunningFinished,
|
|
74742
|
+
label: t("Finished", "Ha finito"),
|
|
74743
|
+
phrase: t("When {device} finishes", "Quando {device} finisce"),
|
|
74744
|
+
icon: "square"
|
|
74745
|
+
}
|
|
74746
|
+
}
|
|
74747
|
+
},
|
|
74601
74748
|
update: {
|
|
74602
74749
|
scope: "device",
|
|
74603
74750
|
noun: t("Firmware update", "Aggiornamento firmware"),
|
|
@@ -78138,6 +78285,11 @@ Object.freeze({
|
|
|
78138
78285
|
form: "single",
|
|
78139
78286
|
optional: true
|
|
78140
78287
|
}],
|
|
78288
|
+
"runningState.getStatus": [{
|
|
78289
|
+
name: "deviceId",
|
|
78290
|
+
form: "single",
|
|
78291
|
+
optional: false
|
|
78292
|
+
}],
|
|
78141
78293
|
"sceneMonitor.captureReference": [{
|
|
78142
78294
|
name: "deviceId",
|
|
78143
78295
|
form: "single",
|
|
@@ -78688,40 +78840,7 @@ var NC_AUDIO_DEFAULTS = {
|
|
|
78688
78840
|
samplingSeconds: 10
|
|
78689
78841
|
};
|
|
78690
78842
|
new Set(["devices", "classes"]);
|
|
78691
|
-
|
|
78692
|
-
* WHICH narrowing filter speaks about WHICH system-event kind — one predicate,
|
|
78693
|
-
* consumed by the rule ENGINE and by every rule EDITOR.
|
|
78694
|
-
*
|
|
78695
|
-
* ── The failure this file exists for ───────────────────────────────────────
|
|
78696
|
-
* `NcSystemEventConditionSchema` carries four optional narrowing lists
|
|
78697
|
-
* (`deviceIds`, `deviceTypes`, `nodeIds`, `packageNames`) beside a required
|
|
78698
|
-
* `kinds` gate. They are not four filters over one vocabulary: each belongs to
|
|
78699
|
-
* a FAMILY of kinds and is meaningless outside it. A node going away has no
|
|
78700
|
-
* device type; a completed export has no package; `stream-offline` deliberately
|
|
78701
|
-
* carries no device type at all (a stream belongs to a camera by construction).
|
|
78702
|
-
*
|
|
78703
|
-
* The engine applied all four to every kind, so a filter from one family failed
|
|
78704
|
-
* a kind from another family CLOSED. The operator's live rule "Eventi di
|
|
78705
|
-
* sistema" selected eleven kinds and set `deviceTypes: ['camera']` — the only
|
|
78706
|
-
* way to say "only my cameras" about the two liveness kinds — and NINE of the
|
|
78707
|
-
* eleven silently stopped being deliverable. Four days of history contained
|
|
78708
|
-
* `device-online` and `device-offline` and nothing else, across a window in
|
|
78709
|
-
* which agents were restarted and addons were updated.
|
|
78710
|
-
*
|
|
78711
|
-
* Both editors already computed this scoping, to decide which filter boxes to
|
|
78712
|
-
* render; the cap's own docblock already promised it ("Narrow a `device-*` kind
|
|
78713
|
-
* to these device TYPES"). Only the engine disagreed, and it disagreed in the
|
|
78714
|
-
* destructive direction. So the rule is stated ONCE, here, and the engine and
|
|
78715
|
-
* the editors are readers of it rather than three independent authors.
|
|
78716
|
-
*
|
|
78717
|
-
* ── The direction ─────────────────────────────────────────────────────────
|
|
78718
|
-
* Out of family ⇒ the filter is IGNORED, never fail-closed. An editor that
|
|
78719
|
-
* hides a box has already told the operator this filter does not speak about
|
|
78720
|
-
* these kinds, so honouring it as an exclusion contradicts the only
|
|
78721
|
-
* explanation the operator was ever given. Inside its family the filter still
|
|
78722
|
-
* narrows, and still fails CLOSED on a subject that cannot produce the identity
|
|
78723
|
-
* it tests (a device the mirror cannot name is not evidence of a camera).
|
|
78724
|
-
*/
|
|
78843
|
+
new Set(NC_LEGACY_SYSTEM_EVENT_KINDS);
|
|
78725
78844
|
/**
|
|
78726
78845
|
* Every filter, for the callers that must cover all of them (guards, tests).
|
|
78727
78846
|
*
|
|
@@ -78747,9 +78866,6 @@ new Map(Object.entries({
|
|
|
78747
78866
|
"device-battery-normal": "device-events",
|
|
78748
78867
|
"device-consumable-low": "device-events",
|
|
78749
78868
|
"device-consumable-normal": "device-events",
|
|
78750
|
-
"device-tank-low": "device-events",
|
|
78751
|
-
"device-tank-full": "device-events",
|
|
78752
|
-
"device-tank-normal": "device-events",
|
|
78753
78869
|
"stream-online": "device-events",
|
|
78754
78870
|
"stream-offline": "device-events",
|
|
78755
78871
|
"detection-blind": "device-events",
|
|
@@ -78826,16 +78942,6 @@ var NC_SYSTEM_EVENT_KIND_GROUP_SPECS = [
|
|
|
78826
78942
|
label: "Consumables",
|
|
78827
78943
|
kinds: ["device-consumable-low", "device-consumable-normal"]
|
|
78828
78944
|
},
|
|
78829
|
-
{
|
|
78830
|
-
id: "tanks",
|
|
78831
|
-
family: "device-events",
|
|
78832
|
-
label: "Tanks",
|
|
78833
|
-
kinds: [
|
|
78834
|
-
"device-tank-low",
|
|
78835
|
-
"device-tank-full",
|
|
78836
|
-
"device-tank-normal"
|
|
78837
|
-
]
|
|
78838
|
-
},
|
|
78839
78945
|
{
|
|
78840
78946
|
id: "detection-blind",
|
|
78841
78947
|
family: "device-events",
|
|
@@ -78993,11 +79099,6 @@ var RULE_BODY_ONLY = ["body"];
|
|
|
78993
79099
|
var RULE_TEXT = ["title", "body"];
|
|
78994
79100
|
var BATTERY = ["device-battery-low", "device-battery-normal"];
|
|
78995
79101
|
var CONSUMABLE = ["device-consumable-low", "device-consumable-normal"];
|
|
78996
|
-
var TANK = [
|
|
78997
|
-
"device-tank-low",
|
|
78998
|
-
"device-tank-full",
|
|
78999
|
-
"device-tank-normal"
|
|
79000
|
-
];
|
|
79001
79102
|
var ALERT_EPISODE = [
|
|
79002
79103
|
"alert-critical",
|
|
79003
79104
|
"alert-error",
|
|
@@ -79029,7 +79130,6 @@ var DEVICE_EVENTS = [
|
|
|
79029
79130
|
"device-enabled",
|
|
79030
79131
|
...BATTERY,
|
|
79031
79132
|
...CONSUMABLE,
|
|
79032
|
-
...TANK,
|
|
79033
79133
|
"stream-online",
|
|
79034
79134
|
"stream-offline",
|
|
79035
79135
|
"detection-blind",
|
|
@@ -79075,12 +79175,6 @@ var STATE_SUMMARY_SECTION_VARS = [
|
|
|
79075
79175
|
example: "Robot — filter 10 %",
|
|
79076
79176
|
kinds: CONSUMABLE
|
|
79077
79177
|
},
|
|
79078
|
-
{
|
|
79079
|
-
name: "summaryTanks",
|
|
79080
|
-
label: "Summary: tanks",
|
|
79081
|
-
example: "Robot — clean water low",
|
|
79082
|
-
kinds: TANK
|
|
79083
|
-
},
|
|
79084
79178
|
{
|
|
79085
79179
|
name: "summaryDetection",
|
|
79086
79180
|
label: "Summary: cameras detecting nothing",
|
|
@@ -79196,8 +79290,7 @@ var STATE_SUMMARY_VARS = [
|
|
|
79196
79290
|
([...RULE_TEXT], [...COMBINED_ALARM]),
|
|
79197
79291
|
([...RULE_TEXT], [...DEVICE_EVENTS]),
|
|
79198
79292
|
([...RULE_TEXT], [...BATTERY, ...CONSUMABLE]),
|
|
79199
|
-
([...RULE_TEXT], [...CONSUMABLE
|
|
79200
|
-
([...RULE_TEXT], [...TANK]),
|
|
79293
|
+
([...RULE_TEXT], [...CONSUMABLE]),
|
|
79201
79294
|
[...RULE_TEXT],
|
|
79202
79295
|
([...RULE_TEXT], [...UPDATES, ...ALERT_EPISODE]),
|
|
79203
79296
|
([...RULE_TEXT], [...UPDATES, ...ALERT_EPISODE]),
|
|
@@ -79301,15 +79394,6 @@ new Map([
|
|
|
79301
79394
|
snapshotLabel: "Consumables low now",
|
|
79302
79395
|
snapshotSection: "consumables"
|
|
79303
79396
|
},
|
|
79304
|
-
{
|
|
79305
|
-
id: "tanks",
|
|
79306
|
-
family: "device-events",
|
|
79307
|
-
label: "Tanks (low or full / back to normal)",
|
|
79308
|
-
bad: ["device-tank-low", "device-tank-full"],
|
|
79309
|
-
recovery: ["device-tank-normal"],
|
|
79310
|
-
snapshotLabel: "Tanks low or full now",
|
|
79311
|
-
snapshotSection: "tanks"
|
|
79312
|
-
},
|
|
79313
79397
|
{
|
|
79314
79398
|
id: "motion-noise",
|
|
79315
79399
|
family: "device-events",
|
|
@@ -79711,6 +79795,10 @@ TimelapseRuleInputSchema.extend({
|
|
|
79711
79795
|
updatedAt: number()
|
|
79712
79796
|
});
|
|
79713
79797
|
MotionOnMotionChangedDataSchema.omit({ triggeredBy: true });
|
|
79798
|
+
Object.freeze({
|
|
79799
|
+
person: .8,
|
|
79800
|
+
vehicle: .8
|
|
79801
|
+
});
|
|
79714
79802
|
object({
|
|
79715
79803
|
/**
|
|
79716
79804
|
* Fraction of the box's own size added on EACH side before cutting.
|
|
@@ -79914,7 +80002,7 @@ var AgentUIAddon = class extends BaseAddon {
|
|
|
79914
80002
|
capability: adminUiCapability,
|
|
79915
80003
|
provider: {
|
|
79916
80004
|
getStaticDir: async () => ({ staticDir: path.resolve(__dirname) }),
|
|
79917
|
-
getVersion: async () => ({ version: "1.2.
|
|
80005
|
+
getVersion: async () => ({ version: "1.2.264" })
|
|
79918
80006
|
}
|
|
79919
80007
|
}];
|
|
79920
80008
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,i as t,l as n,n as r,o as i}from"./scheduler-0XZJE03d.js";import{C as a,c as o,d as s,h as c,l,p as u,t as ee}from"./index-
|
|
1
|
+
import{a as e,i as t,l as n,n as r,o as i}from"./scheduler-0XZJE03d.js";import{C as a,c as o,d as s,h as c,l,p as u,t as ee}from"./index-B7wsVbUT.js";import{MaskShapeCanvas as d}from"./MaskShapeCanvas-BTvl6Rin.js";var f=a(`grid-2x2`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]),p=n(i(),1),m=n(e(),1),h=110,g=`motion-zones`,_=0,te=[1,2,3],v=1,y=`rounded-md border border-border bg-surface px-2 py-1 text-[11px] font-medium text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors`,b=`rounded-md border border-primary/50 bg-primary/15 px-2.5 py-1 text-[11px] font-medium text-primary hover:bg-primary/25 disabled:opacity-40 transition-colors`;function x(e,t,n){let r=t*n,i=Array.from({length:r});for(let t=0;t<r;t+=1)i[t]=e[t]===!0;return i}function S(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function C(e,t){return Math.ceil(e/t)}function w(e,t,n){return Math.min(n-1,Math.floor((e+.5)/t*n))}function T(e,t,n,r){let i=C(t,r),a=C(n,r),o=Array.from({length:i*a},()=>!1);for(let r=0;r<n;r+=1){let s=w(r,n,a);for(let n=0;n<t;n+=1)e[r*t+n]===!0&&(o[s*i+w(n,t,i)]=!0)}return o}function E(e,t,n,r){let i=C(t,r),a=C(n,r),o=Array.from({length:t*n},()=>!1);for(let r=0;r<n;r+=1){let s=w(r,n,a);for(let n=0;n<t;n+=1)o[r*t+n]=e[s*i+w(n,t,i)]===!0}return o}function D({deviceId:e}){let n=t(),i=s(c().trpcClient,e),[a,w]=(0,p.useState)(null),[D,O]=(0,p.useState)(!1),[k,A]=(0,p.useState)(null),[j,M]=(0,p.useState)(null),[N,P]=(0,p.useState)(v),[F,I]=(0,p.useState)(!1),[L,R]=(0,p.useState)(!1),z=(0,p.useRef)(!1);(0,p.useEffect)(()=>{if(!i)return;let e=!1;return z.current=!1,w(null),O(!1),A(null),M(null),P(v),R(!1),(async()=>{try{let t=await i.motionZones?.getOptions({});if(e)return;if(!t)throw Error(`device proxy not ready`);if(w(t),z.current)return;let n=await i.motionZones?.getStatus({});if(e)return;if(!n)throw Error(`device proxy not ready`);z.current=!0;let r=n.regions.find(e=>e.shape.kind===`grid`),a=x(r?r.shape.cells:[],t.grid.width,t.grid.height);M(a),A(T(a,t.grid.width,t.grid.height,v))}catch(t){if(e)return;l(t)?O(!0):console.error(`Motion Zones load failed`,t)}})(),()=>{e=!0}},[i]);let B=a?a.grid.width:0,V=a?a.grid.height:0,H=C(B,N),U=C(V,N),W=(0,p.useMemo)(()=>k&&a?E(k,B,V,N):null,[k,a,B,V,N]),G=(0,p.useMemo)(()=>W!==null&&j!==null&&!S(W,j),[W,j]),K=(0,p.useMemo)(()=>W?W.reduce((e,t)=>t?e+1:e,0):0,[W]),q=B*V,J=H*U,Y=(0,p.useCallback)(e=>{J>0&&A(Array.from({length:J},()=>e))},[J]),X=(0,p.useCallback)(()=>{A(e=>e&&e.map(e=>!e))},[]),Z=(0,p.useCallback)(()=>{j&&a&&A(T(j,B,V,N))},[j,a,B,V,N]),ne=(0,p.useCallback)(e=>{e===N||!a||A(t=>{if(!t)return P(e),t;let n=T(E(t,B,V,N),B,V,e);return P(e),n})},[N,a,B,V]),Q=(0,p.useMemo)(()=>a&&k?[{id:_,shape:{kind:`grid`,gridWidth:H,gridHeight:U,cells:[...k]}}]:[],[a,k,H,U]),$=(0,p.useCallback)((e,t)=>{t.kind===`grid`&&A(t.cells)},[]),re=(0,p.useCallback)(async()=>{if(!(!i||!k||!a)){I(!0);try{let e=E(k,a.grid.width,a.grid.height,N),t={kind:`grid`,gridWidth:a.grid.width,gridHeight:a.grid.height,cells:e};await i.motionZones?.setZone({patch:{regions:[{id:_,enabled:!0,shape:t}]}});let n=await i.motionZones?.getStatus({});if(n){let e=n.regions.find(e=>e.shape.kind===`grid`),t=x(e?e.shape.cells:[],a.grid.width,a.grid.height);M(t),A(T(t,a.grid.width,a.grid.height,N))}}catch(e){console.error(`Motion Zones save failed`,e)}finally{I(!1)}}},[i,k,a,N]);ee((0,p.useMemo)(()=>L&&!D&&a&&k?{id:g,order:h,node:(0,m.jsx)(d,{transparent:!0,items:Q,supportedShapes:[`grid`],grid:{width:H,height:U},selectedId:_,onSelect:()=>{},onShapeChange:$,onDrawComplete:()=>{},drawingKind:null})}:null,[L,D,a,k,Q,$,H,U]));let ie=!D&&a!==null&&k!==null;return i?(0,m.jsx)(u,{title:n(`uiLibrary.motionZones.title`,`Motion Zones`),icon:(0,m.jsx)(f,{className:`h-3.5 w-3.5 text-foreground-subtle`}),children:(0,m.jsx)(`div`,{className:`flex flex-col gap-3`,children:D?(0,m.jsx)(`p`,{className:`${o} leading-relaxed`,children:n(`uiLibrary.motionZones.unsupported`,`This camera doesn't expose an on-board motion zones grid.`)}):ie?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`p`,{className:`${o} leading-relaxed`,children:(0,m.jsx)(r,{uiKey:`uiLibrary.motionZones.intro`,fallback:`Toggle <0>Edit grid</0> to paint the region directly on the live frame, then <1>Save</1> to push the mask to the camera. Pick a bigger <2>Cell size</2> for quicker, broad-stroke painting — it's resampled to the camera's native {{width}}×{{height}} grid on save (×1 is the finest).`,components:[(0,m.jsx)(`strong`,{className:`text-foreground`},`e`),(0,m.jsx)(`strong`,{className:`text-foreground`},`s`),(0,m.jsx)(`strong`,{className:`text-foreground`},`c`)],values:{width:a.grid.width,height:a.grid.height}})}),(0,m.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,m.jsx)(`button`,{type:`button`,onClick:()=>R(e=>!e),disabled:F,"aria-pressed":L,className:L?b:y,children:L?n(`uiLibrary.motionZones.doneEditing`,`Done editing`):n(`uiLibrary.motionZones.editGrid`,`Edit grid`)}),(0,m.jsx)(`button`,{type:`button`,onClick:()=>Y(!0),disabled:F,className:y,children:n(`uiLibrary.motionZones.allOn`,`All on`)}),(0,m.jsx)(`button`,{type:`button`,onClick:()=>Y(!1),disabled:F,className:y,children:n(`uiLibrary.motionZones.allOff`,`All off`)}),(0,m.jsx)(`button`,{type:`button`,onClick:X,disabled:F,className:y,children:n(`uiLibrary.motionZones.invert`,`Invert`)}),(0,m.jsxs)(`div`,{className:`flex items-center gap-1 ml-1`,role:`group`,"aria-label":n(`uiLibrary.motionZones.cellSize`,`Cell size`),children:[(0,m.jsx)(`span`,{className:`${o} mr-0.5`,children:n(`uiLibrary.motionZones.cellSize`,`Cell size`)}),te.map(e=>(0,m.jsxs)(`button`,{type:`button`,onClick:()=>ne(e),disabled:F,"aria-pressed":N===e,title:e===1?n(`uiLibrary.motionZones.cameraGrid`,`Camera grid {{width}}×{{height}} (finest)`,{width:B,height:V}):n(`uiLibrary.motionZones.paintingGrid`,`{{width}}×{{height}} painting grid · cells ×{{factor}} bigger`,{width:C(B,e),height:C(V,e),factor:e}),className:N===e?b:y,children:[`×`,e]},e))]}),(0,m.jsxs)(`span`,{className:`${o} ml-1 tabular-nums`,children:[n(`uiLibrary.motionZones.cells`,`{{active}} / {{total}} cells · {{width}}×{{height}}`,{active:K,total:q,width:a.grid.width,height:a.grid.height}),N===1?``:n(`uiLibrary.motionZones.paintSuffix`,` · paint {{width}}×{{height}}`,{width:H,height:U})]}),(0,m.jsx)(`span`,{className:`flex-1`}),(0,m.jsx)(`button`,{type:`button`,onClick:Z,disabled:F||!G,className:`rounded-md border border-border bg-surface px-2 py-1 text-[11px] text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors`,children:n(`uiLibrary.motionZones.revert`,`Revert`)}),(0,m.jsx)(`button`,{type:`button`,onClick:()=>void re(),disabled:F||!G,className:b,children:F?n(`uiLibrary.motionZones.saving`,`Saving…`):n(`uiLibrary.motionZones.save`,`Save`)})]})]}):(0,m.jsx)(`p`,{className:`${o} leading-relaxed`,children:n(`uiLibrary.motionZones.loading`,`Loading the camera's grid…`)})})}):null}export{D as MotionZonesSettings};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,i as t,l as n,n as r,o as i}from"./scheduler-0XZJE03d.js";import{C as a,_ as ee,c as o,d as te,g as ne,h as s,l as c,p as re,t as l,x as u,y as d}from"./index-2QEC5xoI.js";import{MaskShapeCanvas as ie}from"./MaskShapeCanvas-BTvl6Rin.js";var ae=a(`hexagon`,[[`path`,{d:`M21 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.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z`,key:`yt0hxn`}]]),oe=a(`mic-off`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M15 9.34V5a3 3 0 0 0-5.68-1.33`,key:`1gzdoj`}],[`path`,{d:`M16.95 16.95A7 7 0 0 1 5 12v-2`,key:`cqa7eg`}],[`path`,{d:`M18.89 13.23A7 7 0 0 0 19 12v-2`,key:`16hl24`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v3a3 3 0 0 0 5.12 2.12`,key:`r2i35w`}]]),f=n(i(),1),p=`Microphone`,m=`The camera encodes no audio at all — live view, recordings, exports and the audio analyzer are all silent.`;function se(e){let t=e.supportsAudioMute===!0,n=t?e.audioEnabled:null,r=e.pendingOn??null;return{label:p,supported:t,on:n===null?null:r??n,available:t&&n!==null,costWhenOff:m}}function ce(e){return!e.available||e.on===null?null:{enabled:!e.on}}var h=n(e(),1),le=120,ue=`privacy-mask`,g=`rounded-md border border-border bg-surface px-2 py-1 text-[11px] font-medium text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors`,_=`rounded-md border border-primary/50 bg-primary/15 px-2.5 py-1 text-[11px] font-medium text-primary hover:bg-primary/25 disabled:opacity-40 transition-colors`;function v(e){return e.kind===`rect`||e.kind===`polygon`?e:null}function de(e){let t=new Set(e.map(e=>e.id)),n=0;for(;t.has(n);)n+=1;return n}function fe(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(JSON.stringify(e[n])!==JSON.stringify(t[n]))return!1;return!0}function y({deviceId:e}){let n=t(),i=te(s().trpcClient,e),[a,p]=(0,f.useState)(null),[m,y]=(0,f.useState)(!1),[b,x]=(0,f.useState)(!1),[S,C]=(0,f.useState)(null),[w,T]=(0,f.useState)(null),[E,D]=(0,f.useState)(!1),[O,k]=(0,f.useState)(!1),[A,j]=(0,f.useState)(null),[M,N]=(0,f.useState)(null),[pe,P]=(0,f.useState)(null),[F,I]=(0,f.useState)(null),[L,R]=(0,f.useState)(null),z=(0,f.useRef)(!1);(0,f.useEffect)(()=>{if(!i)return;let e=!1;return z.current=!1,p(null),y(!1),x(!1),C(null),T(null),k(!1),j(null),N(null),P(null),I(null),R(null),(async()=>{try{let t=await i.privacyMask?.getOptions({});if(e)return;if(!t)throw Error(`device proxy not ready`);if(p(t),z.current)return;let n=await i.privacyMask?.getStatus({});if(e)return;if(!n)throw Error(`device proxy not ready`);if(n.regions===null){x(!0),P(n.audioEnabled);return}z.current=!0;let r={enabled:n.enabled,regions:n.regions};T(r),C(r),P(n.audioEnabled)}catch(t){if(e)return;c(t)?y(!0):console.error(`Privacy Mask load failed`,t)}})(),()=>{e=!0}},[i]);let B=(0,f.useMemo)(()=>S!==null&&w!==null&&(S.enabled!==w.enabled||!fe(S.regions,w.regions)),[S,w]),V=S?S.regions.length:0,H=a?a.maxRegions:0,U=(0,f.useRef)(0);(0,f.useEffect)(()=>{U.current=H},[H]);let W=H>0&&V>=H,me=(0,f.useCallback)(()=>{C(e=>e&&{...e,enabled:!e.enabled})},[]),G=(0,f.useCallback)(e=>{j(typeof e==`number`?e:null)},[]),K=(0,f.useMemo)(()=>S?S.regions.map(e=>({id:e.id,shape:e.shape,enabled:e.enabled,label:n(`uiLibrary.privacyMaskSettings.zoneN`,`Zone {{id}}`,{id:e.id})})):[],[S,n]),q=(0,f.useCallback)((e,t)=>{let n=v(t);n&&C(t=>t&&{...t,regions:t.regions.map(t=>t.id===e?{...t,shape:n}:t)})},[]),J=(0,f.useCallback)(e=>{let t=v(e);t&&(N(null),C(e=>{if(!e)return e;let n=U.current;if(n>0&&e.regions.length>=n)return e;let r=de(e.regions),i={id:r,enabled:!0,shape:t};return j(r),{...e,regions:[...e.regions,i]}}))},[]),Y=(0,f.useCallback)(e=>{k(!0),j(null),N(e)},[]),he=(0,f.useCallback)(e=>{k(!0),N(null),j(e)},[]),ge=(0,f.useCallback)(e=>{j(t=>t===e?null:t),C(t=>t&&{...t,regions:t.regions.filter(t=>t.id!==e)})},[]),_e=(0,f.useCallback)(()=>{N(null),j(null),w&&C({enabled:w.enabled,regions:w.regions})},[w]),X=(0,f.useCallback)(async()=>{if(!(!i||!S)){D(!0);try{await i.privacyMask?.setMask({patch:{enabled:S.enabled,regions:[...S.regions]}});let e=await i.privacyMask?.getStatus({});if(e&&e.regions!==null){let t={enabled:e.enabled,regions:e.regions};T(t),C(t)}}catch(e){console.error(`Privacy Mask save failed`,e)}finally{D(!1)}}},[i,S]),Z=se({supportsAudioMute:a===null?null:a.supportsAudioMute,audioEnabled:pe,pendingOn:F}),ve=(0,f.useCallback)(async()=>{let e=ce(Z);if(!(!i||e===null)){I(e.enabled),R(null);try{await i.privacyMask?.setAudioEnabled(e);let t=await i.privacyMask?.getStatus({});t&&P(t.audioEnabled)}catch(e){console.error(`Privacy microphone write failed — reverting`,e),R(e instanceof Error?e.message:String(e))}finally{I(null)}}},[i,Z]),ye=(0,f.useCallback)(()=>{k(e=>(e&&(N(null),j(null)),!e))},[]),Q=a?.supportedShapes??[];l((0,f.useMemo)(()=>O&&!m&&a&&S?{id:ue,order:le,node:(0,h.jsx)(ie,{transparent:!0,items:K,supportedShapes:Q,polygonVertices:a.polygonVertices,selectedId:A,onSelect:G,onShapeChange:q,onDrawComplete:J,drawingKind:M})}:null,[O,m,a,S,K,Q,A,G,q,J,M]));let be=a?.supportedShapes.includes(`rect`)??!1,xe=a?.supportedShapes.includes(`polygon`)??!1,$=a!==null&&(a.maxRegions<=0||a.supportedShapes.length===0),Se=!m&&!$&&!b&&a!==null&&S!==null;return i?(0,h.jsx)(re,{title:n(`uiLibrary.privacyMaskSettings.title`,`Privacy Mask`),icon:(0,h.jsx)(u,{className:`h-3.5 w-3.5 text-foreground-subtle`}),children:(0,h.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[m||$?(0,h.jsx)(`p`,{className:`${o} leading-relaxed`,children:n(`uiLibrary.privacyMaskSettings.unsupported`,`This camera doesn't support an on-board privacy mask.`)}):b?(0,h.jsx)(`p`,{className:`${o} leading-relaxed`,children:n(`uiLibrary.privacyMaskSettings.unreadable`,`This camera hasn't answered, so what it currently masks is unknown — the editor stays closed rather than showing an empty frame you could save over. A battery camera answers once it wakes; otherwise check that it is reachable.`)}):Se?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`p`,{className:`${o} leading-relaxed`,children:(0,h.jsx)(r,{uiKey:`uiLibrary.privacyMaskSettings.help`,fallback:`Toggle <0>Edit mask</0> to draw blanked-out zones on the live frame, then <1>Save</1> to push them to the camera. Drag a rectangle to move, its corner to resize; drag polygon vertices, click an edge midpoint to add one, or right-click a vertex to remove it.`,components:[(0,h.jsx)(`strong`,{className:`text-foreground`},`edit`),(0,h.jsx)(`strong`,{className:`text-foreground`},`save`)]})}),(0,h.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,h.jsx)(`button`,{type:`button`,onClick:ye,disabled:E,"aria-pressed":O,className:O?_:g,children:O?n(`uiLibrary.privacyMaskSettings.doneEditing`,`Done editing`):n(`uiLibrary.privacyMaskSettings.editMask`,`Edit mask`)}),(0,h.jsx)(`button`,{type:`button`,onClick:me,disabled:E,"aria-pressed":S.enabled,className:S.enabled?_:g,children:S.enabled?n(`uiLibrary.privacyMaskSettings.maskOn`,`Mask on`):n(`uiLibrary.privacyMaskSettings.maskOff`,`Mask off`)}),be&&(0,h.jsx)(`button`,{type:`button`,onClick:()=>Y(`rect`),disabled:E||W,"aria-pressed":M===`rect`,className:M===`rect`?_:g,title:W?n(`uiLibrary.privacyMaskSettings.maxZones`,`Maximum zones reached`):n(`uiLibrary.privacyMaskSettings.addRect`,`Add a rectangle zone`),children:n(`uiLibrary.privacyMaskSettings.rectButton`,`+ Rect`)}),xe&&(0,h.jsx)(`button`,{type:`button`,onClick:()=>Y(`polygon`),disabled:E||W,"aria-pressed":M===`polygon`,className:M===`polygon`?_:g,title:W?n(`uiLibrary.privacyMaskSettings.maxZones`,`Maximum zones reached`):n(`uiLibrary.privacyMaskSettings.addPolygon`,`Add a polygon zone`),children:n(`uiLibrary.privacyMaskSettings.polygonButton`,`+ Polygon`)}),(0,h.jsx)(`span`,{className:`${o} ml-1 tabular-nums`,children:n(`uiLibrary.privacyMaskSettings.zoneCount`,`{{active}} / {{max}} zones`,{active:V,max:H})}),(0,h.jsx)(`span`,{className:`flex-1`}),(0,h.jsx)(`button`,{type:`button`,onClick:_e,disabled:E||!B,className:`rounded-md border border-border bg-surface px-2 py-1 text-[11px] text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors`,children:n(`uiLibrary.privacyMaskSettings.revert`,`Revert`)}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>void X(),disabled:E||!B,className:_,children:E?n(`uiLibrary.privacyMaskSettings.saving`,`Saving…`):n(`uiLibrary.privacyMaskSettings.save`,`Save`)})]}),V>0?(0,h.jsx)(`div`,{className:`flex flex-col gap-1`,children:S.regions.map(e=>{let t=A===e.id,r=e.shape.kind===`polygon`?ae:ee;return(0,h.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border px-2 py-1 transition-colors ${t?`border-primary/50 bg-primary/10`:`border-border bg-surface`}`,children:[(0,h.jsxs)(`button`,{type:`button`,onClick:()=>he(e.id),disabled:E,className:`flex flex-1 items-center gap-2 text-left text-[11px] font-medium text-foreground-subtle hover:text-foreground disabled:opacity-40 transition-colors`,children:[(0,h.jsx)(r,{className:`h-3.5 w-3.5 shrink-0`}),(0,h.jsx)(`span`,{children:n(`uiLibrary.privacyMaskSettings.zoneN`,`Zone {{id}}`,{id:e.id})}),(0,h.jsx)(`span`,{className:`text-foreground-faint capitalize`,children:e.shape.kind})]}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>ge(e.id),disabled:E,"aria-label":n(`uiLibrary.privacyMaskSettings.deleteZoneN`,`Delete zone {{id}}`,{id:e.id}),title:n(`uiLibrary.privacyMaskSettings.deleteZone`,`Delete zone`),className:`inline-flex h-6 w-6 items-center justify-center rounded border border-border bg-surface text-foreground-subtle hover:border-red-400/40 hover:bg-red-500/10 hover:text-red-400 disabled:opacity-40 transition-colors`,children:(0,h.jsx)(ne,{className:`h-3.5 w-3.5`})})]},e.id)})}):null]}):(0,h.jsx)(`p`,{className:`${o} leading-relaxed`,children:n(`uiLibrary.privacyMaskSettings.loading`,`Loading the camera's privacy mask…`)}),Z.supported&&(0,h.jsxs)(`div`,{className:`flex items-start gap-3 rounded-md border border-border bg-surface px-2 py-2`,children:[(0,h.jsx)(`button`,{type:`button`,role:`switch`,"aria-label":Z.label,"aria-checked":Z.on===!0,disabled:!Z.available||F!==null,onClick:()=>void ve(),title:Z.on===null?n(`uiLibrary.privacyMaskSettings.micTitleUnknown`,`Microphone — state unknown; the camera did not answer.`):Z.on?n(`uiLibrary.privacyMaskSettings.micTitleOn`,`The camera is capturing sound. Turning it off: {{cost}}`,{cost:Z.costWhenOff}):n(`uiLibrary.privacyMaskSettings.micTitleOff`,`The camera is silent. {{cost}}`,{cost:Z.costWhenOff}),className:Z.on===!1||Z.on===null?g:_,children:(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[Z.on===!1?(0,h.jsx)(oe,{className:`h-3.5 w-3.5`}):(0,h.jsx)(d,{className:`h-3.5 w-3.5`}),Z.on===null?n(`uiLibrary.privacyMaskSettings.micUnknown`,`Microphone unknown`):Z.on?n(`uiLibrary.privacyMaskSettings.micOn`,`Microphone on`):n(`uiLibrary.privacyMaskSettings.micOff`,`Microphone off`)]})}),(0,h.jsx)(`p`,{className:`text-[10px] text-foreground-subtle flex-1 leading-relaxed`,children:L===null?Z.on===null?n(`uiLibrary.privacyMaskSettings.micNotReported`,`The camera did not report its microphone, so this state is unknown.`):Z.costWhenOff:n(`uiLibrary.privacyMaskSettings.writeFailed`,`Write failed: {{reason}}`,{reason:L})})]})]})}):null}export{y as PrivacyMaskSettings};
|
|
1
|
+
import{a as e,i as t,l as n,n as r,o as i}from"./scheduler-0XZJE03d.js";import{C as a,_ as ee,c as o,d as te,g as ne,h as s,l as c,p as re,t as l,x as u,y as d}from"./index-B7wsVbUT.js";import{MaskShapeCanvas as ie}from"./MaskShapeCanvas-BTvl6Rin.js";var ae=a(`hexagon`,[[`path`,{d:`M21 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.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z`,key:`yt0hxn`}]]),oe=a(`mic-off`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M15 9.34V5a3 3 0 0 0-5.68-1.33`,key:`1gzdoj`}],[`path`,{d:`M16.95 16.95A7 7 0 0 1 5 12v-2`,key:`cqa7eg`}],[`path`,{d:`M18.89 13.23A7 7 0 0 0 19 12v-2`,key:`16hl24`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v3a3 3 0 0 0 5.12 2.12`,key:`r2i35w`}]]),f=n(i(),1),p=`Microphone`,m=`The camera encodes no audio at all — live view, recordings, exports and the audio analyzer are all silent.`;function se(e){let t=e.supportsAudioMute===!0,n=t?e.audioEnabled:null,r=e.pendingOn??null;return{label:p,supported:t,on:n===null?null:r??n,available:t&&n!==null,costWhenOff:m}}function ce(e){return!e.available||e.on===null?null:{enabled:!e.on}}var h=n(e(),1),le=120,ue=`privacy-mask`,g=`rounded-md border border-border bg-surface px-2 py-1 text-[11px] font-medium text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors`,_=`rounded-md border border-primary/50 bg-primary/15 px-2.5 py-1 text-[11px] font-medium text-primary hover:bg-primary/25 disabled:opacity-40 transition-colors`;function v(e){return e.kind===`rect`||e.kind===`polygon`?e:null}function de(e){let t=new Set(e.map(e=>e.id)),n=0;for(;t.has(n);)n+=1;return n}function fe(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(JSON.stringify(e[n])!==JSON.stringify(t[n]))return!1;return!0}function y({deviceId:e}){let n=t(),i=te(s().trpcClient,e),[a,p]=(0,f.useState)(null),[m,y]=(0,f.useState)(!1),[b,x]=(0,f.useState)(!1),[S,C]=(0,f.useState)(null),[w,T]=(0,f.useState)(null),[E,D]=(0,f.useState)(!1),[O,k]=(0,f.useState)(!1),[A,j]=(0,f.useState)(null),[M,N]=(0,f.useState)(null),[pe,P]=(0,f.useState)(null),[F,I]=(0,f.useState)(null),[L,R]=(0,f.useState)(null),z=(0,f.useRef)(!1);(0,f.useEffect)(()=>{if(!i)return;let e=!1;return z.current=!1,p(null),y(!1),x(!1),C(null),T(null),k(!1),j(null),N(null),P(null),I(null),R(null),(async()=>{try{let t=await i.privacyMask?.getOptions({});if(e)return;if(!t)throw Error(`device proxy not ready`);if(p(t),z.current)return;let n=await i.privacyMask?.getStatus({});if(e)return;if(!n)throw Error(`device proxy not ready`);if(n.regions===null){x(!0),P(n.audioEnabled);return}z.current=!0;let r={enabled:n.enabled,regions:n.regions};T(r),C(r),P(n.audioEnabled)}catch(t){if(e)return;c(t)?y(!0):console.error(`Privacy Mask load failed`,t)}})(),()=>{e=!0}},[i]);let B=(0,f.useMemo)(()=>S!==null&&w!==null&&(S.enabled!==w.enabled||!fe(S.regions,w.regions)),[S,w]),V=S?S.regions.length:0,H=a?a.maxRegions:0,U=(0,f.useRef)(0);(0,f.useEffect)(()=>{U.current=H},[H]);let W=H>0&&V>=H,me=(0,f.useCallback)(()=>{C(e=>e&&{...e,enabled:!e.enabled})},[]),G=(0,f.useCallback)(e=>{j(typeof e==`number`?e:null)},[]),K=(0,f.useMemo)(()=>S?S.regions.map(e=>({id:e.id,shape:e.shape,enabled:e.enabled,label:n(`uiLibrary.privacyMaskSettings.zoneN`,`Zone {{id}}`,{id:e.id})})):[],[S,n]),q=(0,f.useCallback)((e,t)=>{let n=v(t);n&&C(t=>t&&{...t,regions:t.regions.map(t=>t.id===e?{...t,shape:n}:t)})},[]),J=(0,f.useCallback)(e=>{let t=v(e);t&&(N(null),C(e=>{if(!e)return e;let n=U.current;if(n>0&&e.regions.length>=n)return e;let r=de(e.regions),i={id:r,enabled:!0,shape:t};return j(r),{...e,regions:[...e.regions,i]}}))},[]),Y=(0,f.useCallback)(e=>{k(!0),j(null),N(e)},[]),he=(0,f.useCallback)(e=>{k(!0),N(null),j(e)},[]),ge=(0,f.useCallback)(e=>{j(t=>t===e?null:t),C(t=>t&&{...t,regions:t.regions.filter(t=>t.id!==e)})},[]),_e=(0,f.useCallback)(()=>{N(null),j(null),w&&C({enabled:w.enabled,regions:w.regions})},[w]),X=(0,f.useCallback)(async()=>{if(!(!i||!S)){D(!0);try{await i.privacyMask?.setMask({patch:{enabled:S.enabled,regions:[...S.regions]}});let e=await i.privacyMask?.getStatus({});if(e&&e.regions!==null){let t={enabled:e.enabled,regions:e.regions};T(t),C(t)}}catch(e){console.error(`Privacy Mask save failed`,e)}finally{D(!1)}}},[i,S]),Z=se({supportsAudioMute:a===null?null:a.supportsAudioMute,audioEnabled:pe,pendingOn:F}),ve=(0,f.useCallback)(async()=>{let e=ce(Z);if(!(!i||e===null)){I(e.enabled),R(null);try{await i.privacyMask?.setAudioEnabled(e);let t=await i.privacyMask?.getStatus({});t&&P(t.audioEnabled)}catch(e){console.error(`Privacy microphone write failed — reverting`,e),R(e instanceof Error?e.message:String(e))}finally{I(null)}}},[i,Z]),ye=(0,f.useCallback)(()=>{k(e=>(e&&(N(null),j(null)),!e))},[]),Q=a?.supportedShapes??[];l((0,f.useMemo)(()=>O&&!m&&a&&S?{id:ue,order:le,node:(0,h.jsx)(ie,{transparent:!0,items:K,supportedShapes:Q,polygonVertices:a.polygonVertices,selectedId:A,onSelect:G,onShapeChange:q,onDrawComplete:J,drawingKind:M})}:null,[O,m,a,S,K,Q,A,G,q,J,M]));let be=a?.supportedShapes.includes(`rect`)??!1,xe=a?.supportedShapes.includes(`polygon`)??!1,$=a!==null&&(a.maxRegions<=0||a.supportedShapes.length===0),Se=!m&&!$&&!b&&a!==null&&S!==null;return i?(0,h.jsx)(re,{title:n(`uiLibrary.privacyMaskSettings.title`,`Privacy Mask`),icon:(0,h.jsx)(u,{className:`h-3.5 w-3.5 text-foreground-subtle`}),children:(0,h.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[m||$?(0,h.jsx)(`p`,{className:`${o} leading-relaxed`,children:n(`uiLibrary.privacyMaskSettings.unsupported`,`This camera doesn't support an on-board privacy mask.`)}):b?(0,h.jsx)(`p`,{className:`${o} leading-relaxed`,children:n(`uiLibrary.privacyMaskSettings.unreadable`,`This camera hasn't answered, so what it currently masks is unknown — the editor stays closed rather than showing an empty frame you could save over. A battery camera answers once it wakes; otherwise check that it is reachable.`)}):Se?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`p`,{className:`${o} leading-relaxed`,children:(0,h.jsx)(r,{uiKey:`uiLibrary.privacyMaskSettings.help`,fallback:`Toggle <0>Edit mask</0> to draw blanked-out zones on the live frame, then <1>Save</1> to push them to the camera. Drag a rectangle to move, its corner to resize; drag polygon vertices, click an edge midpoint to add one, or right-click a vertex to remove it.`,components:[(0,h.jsx)(`strong`,{className:`text-foreground`},`edit`),(0,h.jsx)(`strong`,{className:`text-foreground`},`save`)]})}),(0,h.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,h.jsx)(`button`,{type:`button`,onClick:ye,disabled:E,"aria-pressed":O,className:O?_:g,children:O?n(`uiLibrary.privacyMaskSettings.doneEditing`,`Done editing`):n(`uiLibrary.privacyMaskSettings.editMask`,`Edit mask`)}),(0,h.jsx)(`button`,{type:`button`,onClick:me,disabled:E,"aria-pressed":S.enabled,className:S.enabled?_:g,children:S.enabled?n(`uiLibrary.privacyMaskSettings.maskOn`,`Mask on`):n(`uiLibrary.privacyMaskSettings.maskOff`,`Mask off`)}),be&&(0,h.jsx)(`button`,{type:`button`,onClick:()=>Y(`rect`),disabled:E||W,"aria-pressed":M===`rect`,className:M===`rect`?_:g,title:W?n(`uiLibrary.privacyMaskSettings.maxZones`,`Maximum zones reached`):n(`uiLibrary.privacyMaskSettings.addRect`,`Add a rectangle zone`),children:n(`uiLibrary.privacyMaskSettings.rectButton`,`+ Rect`)}),xe&&(0,h.jsx)(`button`,{type:`button`,onClick:()=>Y(`polygon`),disabled:E||W,"aria-pressed":M===`polygon`,className:M===`polygon`?_:g,title:W?n(`uiLibrary.privacyMaskSettings.maxZones`,`Maximum zones reached`):n(`uiLibrary.privacyMaskSettings.addPolygon`,`Add a polygon zone`),children:n(`uiLibrary.privacyMaskSettings.polygonButton`,`+ Polygon`)}),(0,h.jsx)(`span`,{className:`${o} ml-1 tabular-nums`,children:n(`uiLibrary.privacyMaskSettings.zoneCount`,`{{active}} / {{max}} zones`,{active:V,max:H})}),(0,h.jsx)(`span`,{className:`flex-1`}),(0,h.jsx)(`button`,{type:`button`,onClick:_e,disabled:E||!B,className:`rounded-md border border-border bg-surface px-2 py-1 text-[11px] text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors`,children:n(`uiLibrary.privacyMaskSettings.revert`,`Revert`)}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>void X(),disabled:E||!B,className:_,children:E?n(`uiLibrary.privacyMaskSettings.saving`,`Saving…`):n(`uiLibrary.privacyMaskSettings.save`,`Save`)})]}),V>0?(0,h.jsx)(`div`,{className:`flex flex-col gap-1`,children:S.regions.map(e=>{let t=A===e.id,r=e.shape.kind===`polygon`?ae:ee;return(0,h.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border px-2 py-1 transition-colors ${t?`border-primary/50 bg-primary/10`:`border-border bg-surface`}`,children:[(0,h.jsxs)(`button`,{type:`button`,onClick:()=>he(e.id),disabled:E,className:`flex flex-1 items-center gap-2 text-left text-[11px] font-medium text-foreground-subtle hover:text-foreground disabled:opacity-40 transition-colors`,children:[(0,h.jsx)(r,{className:`h-3.5 w-3.5 shrink-0`}),(0,h.jsx)(`span`,{children:n(`uiLibrary.privacyMaskSettings.zoneN`,`Zone {{id}}`,{id:e.id})}),(0,h.jsx)(`span`,{className:`text-foreground-faint capitalize`,children:e.shape.kind})]}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>ge(e.id),disabled:E,"aria-label":n(`uiLibrary.privacyMaskSettings.deleteZoneN`,`Delete zone {{id}}`,{id:e.id}),title:n(`uiLibrary.privacyMaskSettings.deleteZone`,`Delete zone`),className:`inline-flex h-6 w-6 items-center justify-center rounded border border-border bg-surface text-foreground-subtle hover:border-red-400/40 hover:bg-red-500/10 hover:text-red-400 disabled:opacity-40 transition-colors`,children:(0,h.jsx)(ne,{className:`h-3.5 w-3.5`})})]},e.id)})}):null]}):(0,h.jsx)(`p`,{className:`${o} leading-relaxed`,children:n(`uiLibrary.privacyMaskSettings.loading`,`Loading the camera's privacy mask…`)}),Z.supported&&(0,h.jsxs)(`div`,{className:`flex items-start gap-3 rounded-md border border-border bg-surface px-2 py-2`,children:[(0,h.jsx)(`button`,{type:`button`,role:`switch`,"aria-label":Z.label,"aria-checked":Z.on===!0,disabled:!Z.available||F!==null,onClick:()=>void ve(),title:Z.on===null?n(`uiLibrary.privacyMaskSettings.micTitleUnknown`,`Microphone — state unknown; the camera did not answer.`):Z.on?n(`uiLibrary.privacyMaskSettings.micTitleOn`,`The camera is capturing sound. Turning it off: {{cost}}`,{cost:Z.costWhenOff}):n(`uiLibrary.privacyMaskSettings.micTitleOff`,`The camera is silent. {{cost}}`,{cost:Z.costWhenOff}),className:Z.on===!1||Z.on===null?g:_,children:(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[Z.on===!1?(0,h.jsx)(oe,{className:`h-3.5 w-3.5`}):(0,h.jsx)(d,{className:`h-3.5 w-3.5`}),Z.on===null?n(`uiLibrary.privacyMaskSettings.micUnknown`,`Microphone unknown`):Z.on?n(`uiLibrary.privacyMaskSettings.micOn`,`Microphone on`):n(`uiLibrary.privacyMaskSettings.micOff`,`Microphone off`)]})}),(0,h.jsx)(`p`,{className:`text-[10px] text-foreground-subtle flex-1 leading-relaxed`,children:L===null?Z.on===null?n(`uiLibrary.privacyMaskSettings.micNotReported`,`The camera did not report its microphone, so this state is unknown.`):Z.costWhenOff:n(`uiLibrary.privacyMaskSettings.writeFailed`,`Write failed: {{reason}}`,{reason:L})})]})]})}):null}export{y as PrivacyMaskSettings};
|