@camstack/addon-pipeline-orchestrator 1.2.663 → 1.2.665
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/CHANGELOG.md +12 -0
- package/dist/_stub.js +246 -246
- package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-CbbVC-1B.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-B7k80ISv.mjs} +3 -3
- package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DfqFDwlL.mjs +26 -0
- package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-DxiHs-74.mjs +26 -0
- package/dist/{hostInit-BQJRnhiE.mjs → hostInit-Bk7YaEnm.mjs} +3 -3
- package/dist/index.js +1357 -1277
- package/dist/index.mjs +1357 -1277
- package/dist/remoteEntry.js +1 -1
- package/package.json +2 -2
- package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-r0TW-BbW.mjs +0 -26
- package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-DkP-6xmg.mjs +0 -26
package/dist/_stub.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { t as e } from "./_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-BiLBDmU5.mjs";
|
|
2
|
-
import { n as t, r as n, t as r } from "./_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-
|
|
2
|
+
import { n as t, r as n, t as r } from "./_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DfqFDwlL.mjs";
|
|
3
3
|
import { a as i, c as a, i as o, n as s, o as c, r as l, s as u, t as d } from "./_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react__loadShare__.js-a8tvh93M.mjs";
|
|
4
|
-
import { A as f, C as p, D as m, E as h, O as g, S as _, T as v, _ as y, a as b, b as x, c as S, d as C, f as w, g as T, h as E, i as D, k as O, l as k, m as A, n as j, o as M, p as N, r as P, s as F, t as I, u as L, v as R, w as z, x as
|
|
5
|
-
import { n as
|
|
4
|
+
import { A as f, C as p, D as m, E as h, O as g, S as _, T as v, _ as y, a as b, b as x, c as S, d as C, f as w, g as T, h as E, i as D, k as O, l as k, m as A, n as j, o as M, p as N, r as P, s as F, t as I, u as L, v as R, w as z, x as B, y as V } from "./_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-DxiHs-74.mjs";
|
|
5
|
+
import { n as H, r as U, t as W } from "./_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-yD-rMaFX.mjs";
|
|
6
6
|
//#region ../../node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.js
|
|
7
|
-
var
|
|
8
|
-
let t =
|
|
7
|
+
var G = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), ee = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), te = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), K = (e) => {
|
|
8
|
+
let t = te(e);
|
|
9
9
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
10
|
-
},
|
|
10
|
+
}, ne = {
|
|
11
11
|
xmlns: "http://www.w3.org/2000/svg",
|
|
12
12
|
width: 24,
|
|
13
13
|
height: 24,
|
|
@@ -17,34 +17,34 @@ var W = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
17
17
|
strokeWidth: 2,
|
|
18
18
|
strokeLinecap: "round",
|
|
19
19
|
strokeLinejoin: "round"
|
|
20
|
-
},
|
|
20
|
+
}, re = (e) => {
|
|
21
21
|
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
|
22
22
|
return !1;
|
|
23
|
-
},
|
|
23
|
+
}, ie = s(({ color: e = "currentColor", size: t = 24, strokeWidth: n = 2, absoluteStrokeWidth: r, className: i = "", children: a, iconNode: o, ...s }, c) => d("svg", {
|
|
24
24
|
ref: c,
|
|
25
|
-
...
|
|
25
|
+
...ne,
|
|
26
26
|
width: t,
|
|
27
27
|
height: t,
|
|
28
28
|
stroke: e,
|
|
29
29
|
strokeWidth: r ? Number(n) * 24 / Number(t) : n,
|
|
30
|
-
className:
|
|
31
|
-
...!a && !
|
|
30
|
+
className: G("lucide", i),
|
|
31
|
+
...!a && !re(s) && { "aria-hidden": "true" },
|
|
32
32
|
...s
|
|
33
|
-
}, [...o.map(([e, t]) => d(e, t)), ...Array.isArray(a) ? a : [a]])),
|
|
34
|
-
let n = s(({ className: n, ...r }, i) => d(
|
|
33
|
+
}, [...o.map(([e, t]) => d(e, t)), ...Array.isArray(a) ? a : [a]])), q = (e, t) => {
|
|
34
|
+
let n = s(({ className: n, ...r }, i) => d(ie, {
|
|
35
35
|
ref: i,
|
|
36
36
|
iconNode: t,
|
|
37
|
-
className:
|
|
37
|
+
className: G(`lucide-${ee(K(e))}`, `lucide-${e}`, n),
|
|
38
38
|
...r
|
|
39
39
|
}));
|
|
40
|
-
return n.displayName =
|
|
41
|
-
},
|
|
40
|
+
return n.displayName = K(e), n;
|
|
41
|
+
}, ae = q("activity", [["path", {
|
|
42
42
|
d: "M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",
|
|
43
43
|
key: "169zse"
|
|
44
|
-
}]]),
|
|
44
|
+
}]]), oe = q("check", [["path", {
|
|
45
45
|
d: "M20 6 9 17l-5-5",
|
|
46
46
|
key: "1gmf2c"
|
|
47
|
-
}]]),
|
|
47
|
+
}]]), se = q("cpu", [
|
|
48
48
|
["path", {
|
|
49
49
|
d: "M12 20v2",
|
|
50
50
|
key: "1lh1kg"
|
|
@@ -109,7 +109,7 @@ var W = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
109
109
|
rx: "1",
|
|
110
110
|
key: "z9xiuo"
|
|
111
111
|
}]
|
|
112
|
-
]),
|
|
112
|
+
]), ce = q("eye", [["path", {
|
|
113
113
|
d: "M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",
|
|
114
114
|
key: "1nclc0"
|
|
115
115
|
}], ["circle", {
|
|
@@ -117,25 +117,25 @@ var W = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
117
117
|
cy: "12",
|
|
118
118
|
r: "3",
|
|
119
119
|
key: "1v7zrd"
|
|
120
|
-
}]]),
|
|
120
|
+
}]]), le = q("gauge", [["path", {
|
|
121
121
|
d: "m12 14 4-4",
|
|
122
122
|
key: "9kzdfg"
|
|
123
123
|
}], ["path", {
|
|
124
124
|
d: "M3.34 19a10 10 0 1 1 17.32 0",
|
|
125
125
|
key: "19p75a"
|
|
126
|
-
}]]),
|
|
126
|
+
}]]), ue = q("hexagon", [["path", {
|
|
127
127
|
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",
|
|
128
128
|
key: "yt0hxn"
|
|
129
|
-
}]]),
|
|
129
|
+
}]]), de = q("minus", [["path", {
|
|
130
130
|
d: "M5 12h14",
|
|
131
131
|
key: "1ays0h"
|
|
132
|
-
}]]),
|
|
132
|
+
}]]), fe = q("plus", [["path", {
|
|
133
133
|
d: "M5 12h14",
|
|
134
134
|
key: "1ays0h"
|
|
135
135
|
}], ["path", {
|
|
136
136
|
d: "M12 5v14",
|
|
137
137
|
key: "s699le"
|
|
138
|
-
}]]),
|
|
138
|
+
}]]), pe = q("save", [
|
|
139
139
|
["path", {
|
|
140
140
|
d: "M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",
|
|
141
141
|
key: "1c8476"
|
|
@@ -148,7 +148,7 @@ var W = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
148
148
|
d: "M7 3v4a1 1 0 0 0 1 1h7",
|
|
149
149
|
key: "t51u73"
|
|
150
150
|
}]
|
|
151
|
-
]),
|
|
151
|
+
]), J = q("trash-2", [
|
|
152
152
|
["path", {
|
|
153
153
|
d: "M10 11v6",
|
|
154
154
|
key: "nco0om"
|
|
@@ -169,7 +169,7 @@ var W = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
169
169
|
d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",
|
|
170
170
|
key: "e791ji"
|
|
171
171
|
}]
|
|
172
|
-
]),
|
|
172
|
+
]), me = q("video", [["path", {
|
|
173
173
|
d: "m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",
|
|
174
174
|
key: "ftymec"
|
|
175
175
|
}], ["rect", {
|
|
@@ -179,7 +179,7 @@ var W = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
179
179
|
height: "12",
|
|
180
180
|
rx: "2",
|
|
181
181
|
key: "158x01"
|
|
182
|
-
}]]),
|
|
182
|
+
}]]), he = q("volume-2", [
|
|
183
183
|
["path", {
|
|
184
184
|
d: "M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",
|
|
185
185
|
key: "uqj9uw"
|
|
@@ -192,13 +192,13 @@ var W = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
192
192
|
d: "M19.364 18.364a9 9 0 0 0 0-12.728",
|
|
193
193
|
key: "ijwkga"
|
|
194
194
|
}]
|
|
195
|
-
]),
|
|
195
|
+
]), Y = q("x", [["path", {
|
|
196
196
|
d: "M18 6 6 18",
|
|
197
197
|
key: "1bl5f8"
|
|
198
198
|
}], ["path", {
|
|
199
199
|
d: "m6 6 12 12",
|
|
200
200
|
key: "d8bk6v"
|
|
201
|
-
}]]), { useT:
|
|
201
|
+
}]]), { useT: X, Trans: ge, translate: Z } = O("pipeline-orchestrator", {
|
|
202
202
|
en: {
|
|
203
203
|
quickStats: {
|
|
204
204
|
requiresDevice: "PipelineQuickStats requires a deviceId",
|
|
@@ -360,15 +360,15 @@ var W = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
360
360
|
});
|
|
361
361
|
//#endregion
|
|
362
362
|
//#region src/widgets/PipelineQuickStats.tsx
|
|
363
|
-
function
|
|
364
|
-
let { t } =
|
|
365
|
-
return e.deviceId === void 0 ? /* @__PURE__ */
|
|
363
|
+
function _e(e) {
|
|
364
|
+
let { t } = X();
|
|
365
|
+
return e.deviceId === void 0 ? /* @__PURE__ */ H("div", {
|
|
366
366
|
className: "rounded-lg border border-warning/30 bg-warning/10 px-3 py-2 text-xs text-warning",
|
|
367
367
|
children: t("quickStats.requiresDevice")
|
|
368
|
-
}) : /* @__PURE__ */
|
|
368
|
+
}) : /* @__PURE__ */ H(ve, { deviceId: e.deviceId });
|
|
369
369
|
}
|
|
370
|
-
function
|
|
371
|
-
let { t: r } =
|
|
370
|
+
function ve({ deviceId: t }) {
|
|
371
|
+
let { t: r } = X(), i = S();
|
|
372
372
|
P(["pipelineOrchestrator", "getPipelineAssignment"], [
|
|
373
373
|
"pipeline.camera-assigned",
|
|
374
374
|
"pipeline.camera-unassigned",
|
|
@@ -422,51 +422,51 @@ function ye({ deviceId: t }) {
|
|
|
422
422
|
}),
|
|
423
423
|
staleTime: 3e4,
|
|
424
424
|
retry: !1
|
|
425
|
-
}), v = n(g, "detectionMode"), y = typeof v == "string" ? v : null, x = c?.phase ?? null, w = y, T = Number(c?.actualFps ?? 0), E = Number(c?.configuredFps ?? 0), O = Number(c?.avgInferenceTimeMs ?? 0), k = Number(c?.queueDepth ?? 0), A = Number(c?.droppedFrames ?? 0), j = f(x ?? "watching", i), M = d?.length ?? 0, N = p?.level.dbfs ?? null, L = typeof N == "number" ? `${N.toFixed(1)} dBFS` : "—", R = m?.enabled ?? !1, z = m?.activeMode ?? "off",
|
|
426
|
-
return /* @__PURE__ */
|
|
425
|
+
}), v = n(g, "detectionMode"), y = typeof v == "string" ? v : null, x = c?.phase ?? null, w = y, T = Number(c?.actualFps ?? 0), E = Number(c?.configuredFps ?? 0), O = Number(c?.avgInferenceTimeMs ?? 0), k = Number(c?.queueDepth ?? 0), A = Number(c?.droppedFrames ?? 0), j = f(x ?? "watching", i), M = d?.length ?? 0, N = p?.level.dbfs ?? null, L = typeof N == "number" ? `${N.toFixed(1)} dBFS` : "—", R = m?.enabled ?? !1, z = m?.activeMode ?? "off", B = R && z !== "off", V = R ? z === "off" ? r("quickStats.rec.idle") : z === "continuous" ? r("quickStats.rec.continuous") : z === "onMotion" ? r("quickStats.rec.onMotion") : z === "onAudioThreshold" ? r("quickStats.rec.onAudio") : z : r("quickStats.rec.disabled"), W = (h?.profiles ?? []).join(", "), G = m ? `${ye(m.storageBytes ?? 0)}${W ? ` · ${W}` : ""}` : void 0;
|
|
426
|
+
return /* @__PURE__ */ U("div", {
|
|
427
427
|
className: C,
|
|
428
428
|
children: [
|
|
429
|
-
/* @__PURE__ */
|
|
430
|
-
icon:
|
|
429
|
+
/* @__PURE__ */ H(_, {
|
|
430
|
+
icon: ae,
|
|
431
431
|
label: r("quickStats.phase"),
|
|
432
432
|
value: j.label,
|
|
433
433
|
valueClassName: j.textColor,
|
|
434
434
|
subtext: w ?? void 0
|
|
435
435
|
}),
|
|
436
|
-
/* @__PURE__ */
|
|
437
|
-
icon:
|
|
436
|
+
/* @__PURE__ */ H(_, {
|
|
437
|
+
icon: le,
|
|
438
438
|
label: r("quickStats.detectionFps"),
|
|
439
439
|
value: `${T.toFixed(1)}`,
|
|
440
440
|
subtext: E > 0 ? r("quickStats.target", { value: E }) : void 0
|
|
441
441
|
}),
|
|
442
|
-
/* @__PURE__ */
|
|
443
|
-
icon:
|
|
442
|
+
/* @__PURE__ */ H(_, {
|
|
443
|
+
icon: se,
|
|
444
444
|
label: r("quickStats.inference"),
|
|
445
445
|
value: `${O.toFixed(1)} ms`,
|
|
446
446
|
subtext: k > 0 ? r("quickStats.queue", { value: k }) : void 0
|
|
447
447
|
}),
|
|
448
|
-
/* @__PURE__ */
|
|
449
|
-
icon:
|
|
448
|
+
/* @__PURE__ */ H(_, {
|
|
449
|
+
icon: ce,
|
|
450
450
|
label: r("quickStats.activeTracks"),
|
|
451
451
|
value: String(M),
|
|
452
452
|
subtext: A > 0 ? r("quickStats.dropped", { value: A }) : void 0
|
|
453
453
|
}),
|
|
454
|
-
/* @__PURE__ */
|
|
455
|
-
icon:
|
|
454
|
+
/* @__PURE__ */ H(_, {
|
|
455
|
+
icon: he,
|
|
456
456
|
label: r("quickStats.currentDb"),
|
|
457
457
|
value: L
|
|
458
458
|
}),
|
|
459
|
-
/* @__PURE__ */
|
|
460
|
-
icon:
|
|
459
|
+
/* @__PURE__ */ H(_, {
|
|
460
|
+
icon: me,
|
|
461
461
|
label: r("quickStats.recording"),
|
|
462
|
-
value:
|
|
463
|
-
valueClassName:
|
|
464
|
-
subtext:
|
|
462
|
+
value: V,
|
|
463
|
+
valueClassName: B ? "text-success" : void 0,
|
|
464
|
+
subtext: G
|
|
465
465
|
})
|
|
466
466
|
]
|
|
467
467
|
});
|
|
468
468
|
}
|
|
469
|
-
function
|
|
469
|
+
function ye(e) {
|
|
470
470
|
if (!Number.isFinite(e) || e <= 0) return "0 B";
|
|
471
471
|
let t = [
|
|
472
472
|
"B",
|
|
@@ -479,64 +479,64 @@ function be(e) {
|
|
|
479
479
|
}
|
|
480
480
|
//#endregion
|
|
481
481
|
//#region src/widgets/zone-editor/ZoneList.tsx
|
|
482
|
-
var
|
|
482
|
+
var be = {
|
|
483
483
|
polygon: "bg-info/10 text-info",
|
|
484
484
|
tripwire: "bg-warning/10 text-warning"
|
|
485
485
|
};
|
|
486
|
-
function
|
|
487
|
-
let { t: s } =
|
|
488
|
-
return /* @__PURE__ */
|
|
486
|
+
function xe({ zones: e, selectedZoneId: t, drawingKind: n, onSelectZone: r, onDeleteZone: i, onStartDraw: a, onCancelDraw: o }) {
|
|
487
|
+
let { t: s } = X();
|
|
488
|
+
return /* @__PURE__ */ U("div", {
|
|
489
489
|
className: "flex flex-col gap-2",
|
|
490
|
-
children: [/* @__PURE__ */
|
|
490
|
+
children: [/* @__PURE__ */ H("div", {
|
|
491
491
|
className: "flex items-center gap-1",
|
|
492
|
-
children: n ? /* @__PURE__ */
|
|
492
|
+
children: n ? /* @__PURE__ */ U(p, {
|
|
493
493
|
variant: "unstyled",
|
|
494
494
|
type: "button",
|
|
495
495
|
onClick: o,
|
|
496
496
|
className: "inline-flex items-center justify-center gap-1 rounded border border-amber-500/30 bg-amber-500/10 text-amber-400 hover:bg-amber-500/20 transition-colors h-8 px-3 text-[11px] font-medium",
|
|
497
497
|
title: s("zoneList.cancelDrawing"),
|
|
498
|
-
children: [/* @__PURE__ */
|
|
499
|
-
}) : /* @__PURE__ */
|
|
498
|
+
children: [/* @__PURE__ */ H(Y, { className: "h-3.5 w-3.5" }), /* @__PURE__ */ H("span", { children: s("zoneList.cancel") })]
|
|
499
|
+
}) : /* @__PURE__ */ U(W, { children: [/* @__PURE__ */ H(p, {
|
|
500
500
|
variant: "unstyled",
|
|
501
501
|
type: "button",
|
|
502
502
|
onClick: () => a("polygon"),
|
|
503
503
|
className: "inline-flex items-center justify-center rounded border border-border bg-surface text-foreground-subtle hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors h-8 w-8",
|
|
504
504
|
title: s("zoneList.addPolygon"),
|
|
505
505
|
"aria-label": s("zoneList.addPolygon"),
|
|
506
|
-
children: /* @__PURE__ */
|
|
507
|
-
}), /* @__PURE__ */
|
|
506
|
+
children: /* @__PURE__ */ H(ue, { className: "h-4 w-4" })
|
|
507
|
+
}), /* @__PURE__ */ H(p, {
|
|
508
508
|
variant: "unstyled",
|
|
509
509
|
type: "button",
|
|
510
510
|
onClick: () => a("tripwire"),
|
|
511
511
|
className: "inline-flex items-center justify-center rounded border border-border bg-surface text-foreground-subtle hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors h-8 w-8",
|
|
512
512
|
title: s("zoneList.addTripwire"),
|
|
513
513
|
"aria-label": s("zoneList.addTripwire"),
|
|
514
|
-
children: /* @__PURE__ */
|
|
514
|
+
children: /* @__PURE__ */ H(de, { className: "h-5 w-5 stroke-[2.5]" })
|
|
515
515
|
})] })
|
|
516
|
-
}), e.length === 0 ? /* @__PURE__ */
|
|
516
|
+
}), e.length === 0 ? /* @__PURE__ */ H("p", {
|
|
517
517
|
className: "text-center text-[10px] text-foreground-subtle py-3 leading-tight",
|
|
518
518
|
children: s("zoneList.empty")
|
|
519
|
-
}) : /* @__PURE__ */
|
|
519
|
+
}) : /* @__PURE__ */ H("div", {
|
|
520
520
|
className: "flex flex-col gap-1",
|
|
521
521
|
children: e.map((e) => {
|
|
522
522
|
let n = e.id === t;
|
|
523
|
-
return /* @__PURE__ */
|
|
523
|
+
return /* @__PURE__ */ U("div", {
|
|
524
524
|
className: ["flex items-center gap-1.5 rounded border px-1.5 py-1 cursor-pointer transition-colors", n ? "border-primary/50 bg-primary/10" : "border-border bg-surface hover:bg-surface-hover"].join(" "),
|
|
525
525
|
onClick: () => r(n ? null : e.id),
|
|
526
526
|
children: [
|
|
527
|
-
/* @__PURE__ */
|
|
527
|
+
/* @__PURE__ */ H("div", {
|
|
528
528
|
className: "h-2.5 w-2.5 rounded-sm flex-shrink-0",
|
|
529
529
|
style: { backgroundColor: e.color }
|
|
530
530
|
}),
|
|
531
|
-
/* @__PURE__ */
|
|
531
|
+
/* @__PURE__ */ H("span", {
|
|
532
532
|
className: "flex-1 truncate text-[11px] font-medium text-foreground",
|
|
533
533
|
children: e.name
|
|
534
534
|
}),
|
|
535
|
-
/* @__PURE__ */
|
|
536
|
-
className: `inline-flex items-center rounded-full px-1.5 py-0.5 text-[9px] font-medium flex-shrink-0 ${
|
|
535
|
+
/* @__PURE__ */ H("span", {
|
|
536
|
+
className: `inline-flex items-center rounded-full px-1.5 py-0.5 text-[9px] font-medium flex-shrink-0 ${be[e.kind]}`,
|
|
537
537
|
children: e.kind === "tripwire" ? s("zone.kind.tripwire") : s("zone.kind.polygon")
|
|
538
538
|
}),
|
|
539
|
-
/* @__PURE__ */
|
|
539
|
+
/* @__PURE__ */ H(p, {
|
|
540
540
|
variant: "unstyled",
|
|
541
541
|
type: "button",
|
|
542
542
|
title: s("zoneList.deleteZone"),
|
|
@@ -544,7 +544,7 @@ function Se({ zones: e, selectedZoneId: t, drawingKind: n, onSelectZone: r, onDe
|
|
|
544
544
|
onClick: (t) => {
|
|
545
545
|
t.stopPropagation(), i(e.id);
|
|
546
546
|
},
|
|
547
|
-
children: /* @__PURE__ */
|
|
547
|
+
children: /* @__PURE__ */ H(J, { className: "h-3 w-3" })
|
|
548
548
|
})
|
|
549
549
|
]
|
|
550
550
|
}, e.id);
|
|
@@ -554,7 +554,7 @@ function Se({ zones: e, selectedZoneId: t, drawingKind: n, onSelectZone: r, onDe
|
|
|
554
554
|
}
|
|
555
555
|
//#endregion
|
|
556
556
|
//#region src/widgets/zone-editor/ZoneForm.tsx
|
|
557
|
-
var
|
|
557
|
+
var Se = [
|
|
558
558
|
"#3b82f6",
|
|
559
559
|
"#10b981",
|
|
560
560
|
"#f59e0b",
|
|
@@ -564,22 +564,22 @@ var Ce = [
|
|
|
564
564
|
"#f97316",
|
|
565
565
|
"#ec4899"
|
|
566
566
|
];
|
|
567
|
-
function
|
|
568
|
-
let { t: i } =
|
|
569
|
-
return /* @__PURE__ */
|
|
567
|
+
function Ce({ zone: e, onSave: t, onDiscard: n, onDelete: r }) {
|
|
568
|
+
let { t: i } = X(), a = k(), o = (e) => a?.updateDraft({ name: e }), s = (e) => a?.updateDraft({ color: e });
|
|
569
|
+
return /* @__PURE__ */ U("div", {
|
|
570
570
|
className: "flex flex-col gap-2",
|
|
571
571
|
children: [
|
|
572
|
-
/* @__PURE__ */
|
|
572
|
+
/* @__PURE__ */ U("div", {
|
|
573
573
|
className: "flex items-center justify-between",
|
|
574
|
-
children: [/* @__PURE__ */
|
|
574
|
+
children: [/* @__PURE__ */ H("h3", {
|
|
575
575
|
className: "text-[10px] font-semibold text-foreground-subtle uppercase tracking-wider",
|
|
576
576
|
children: i("zoneForm.editing")
|
|
577
|
-
}), /* @__PURE__ */
|
|
577
|
+
}), /* @__PURE__ */ H("span", {
|
|
578
578
|
className: "inline-flex items-center rounded-full px-1.5 py-0.5 text-[9px] font-medium bg-surface border border-border text-foreground-subtle",
|
|
579
579
|
children: e.kind === "tripwire" ? i("zone.kind.tripwire") : i("zone.kind.polygon")
|
|
580
580
|
})]
|
|
581
581
|
}),
|
|
582
|
-
/* @__PURE__ */
|
|
582
|
+
/* @__PURE__ */ H(T, {
|
|
583
583
|
type: "text",
|
|
584
584
|
className: E,
|
|
585
585
|
value: e.name,
|
|
@@ -590,9 +590,9 @@ function we({ zone: e, onSave: t, onDiscard: n, onDelete: r }) {
|
|
|
590
590
|
},
|
|
591
591
|
placeholder: i("zoneForm.namePlaceholder")
|
|
592
592
|
}),
|
|
593
|
-
/* @__PURE__ */
|
|
593
|
+
/* @__PURE__ */ H("div", {
|
|
594
594
|
className: "flex flex-wrap gap-1",
|
|
595
|
-
children:
|
|
595
|
+
children: Se.map((t) => /* @__PURE__ */ H(p, {
|
|
596
596
|
variant: "unstyled",
|
|
597
597
|
type: "button",
|
|
598
598
|
title: t,
|
|
@@ -601,14 +601,14 @@ function we({ zone: e, onSave: t, onDiscard: n, onDelete: r }) {
|
|
|
601
601
|
onClick: () => s(t)
|
|
602
602
|
}, t))
|
|
603
603
|
}),
|
|
604
|
-
/* @__PURE__ */
|
|
604
|
+
/* @__PURE__ */ U("div", {
|
|
605
605
|
className: "flex items-center gap-1.5",
|
|
606
|
-
children: [/* @__PURE__ */
|
|
606
|
+
children: [/* @__PURE__ */ H(T, {
|
|
607
607
|
type: "color",
|
|
608
608
|
className: "h-6 w-6 rounded border border-border bg-background cursor-pointer p-0.5",
|
|
609
609
|
value: e.color,
|
|
610
610
|
onChange: (e) => s(e.target.value)
|
|
611
|
-
}), /* @__PURE__ */
|
|
611
|
+
}), /* @__PURE__ */ H(T, {
|
|
612
612
|
type: "text",
|
|
613
613
|
className: `${E} font-mono`,
|
|
614
614
|
value: e.color,
|
|
@@ -616,57 +616,57 @@ function we({ zone: e, onSave: t, onDiscard: n, onDelete: r }) {
|
|
|
616
616
|
onChange: (e) => s(e.target.value)
|
|
617
617
|
})]
|
|
618
618
|
}),
|
|
619
|
-
/* @__PURE__ */
|
|
619
|
+
/* @__PURE__ */ U("p", {
|
|
620
620
|
className: "text-[9px] text-foreground-subtle leading-tight",
|
|
621
621
|
children: [e.kind === "tripwire" ? i("zoneForm.twoPoints") : i("zoneForm.pointCount", { count: e.points.length }), e.points.length > 0 && ` ${i("zoneForm.dragHint")}`]
|
|
622
622
|
}),
|
|
623
|
-
/* @__PURE__ */
|
|
623
|
+
/* @__PURE__ */ U("div", {
|
|
624
624
|
className: "flex items-center gap-1.5",
|
|
625
|
-
children: [/* @__PURE__ */
|
|
625
|
+
children: [/* @__PURE__ */ U(p, {
|
|
626
626
|
variant: "unstyled",
|
|
627
627
|
type: "button",
|
|
628
628
|
onClick: t,
|
|
629
629
|
className: "inline-flex items-center justify-center gap-1 rounded border border-primary/40 bg-primary/10 text-primary hover:bg-primary/20 transition-colors h-7 flex-1 text-[11px] font-medium",
|
|
630
630
|
title: i("zoneForm.saveTitle"),
|
|
631
|
-
children: [/* @__PURE__ */
|
|
632
|
-
}), /* @__PURE__ */
|
|
631
|
+
children: [/* @__PURE__ */ H(oe, { className: "h-3 w-3" }), i("zoneForm.save")]
|
|
632
|
+
}), /* @__PURE__ */ U(p, {
|
|
633
633
|
variant: "unstyled",
|
|
634
634
|
type: "button",
|
|
635
635
|
onClick: n,
|
|
636
636
|
className: "inline-flex items-center justify-center gap-1 rounded border border-border bg-surface text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors h-7 px-3 text-[11px] font-medium",
|
|
637
637
|
title: i("zoneForm.discardTitle"),
|
|
638
|
-
children: [/* @__PURE__ */
|
|
638
|
+
children: [/* @__PURE__ */ H(Y, { className: "h-3 w-3" }), i("zoneForm.discard")]
|
|
639
639
|
})]
|
|
640
640
|
}),
|
|
641
|
-
/* @__PURE__ */
|
|
641
|
+
/* @__PURE__ */ U(p, {
|
|
642
642
|
variant: "unstyled",
|
|
643
643
|
type: "button",
|
|
644
644
|
onClick: r,
|
|
645
645
|
className: `${N} w-full`,
|
|
646
|
-
children: [/* @__PURE__ */
|
|
646
|
+
children: [/* @__PURE__ */ H(J, { className: "h-3 w-3" }), i("zoneForm.delete")]
|
|
647
647
|
})
|
|
648
648
|
]
|
|
649
649
|
});
|
|
650
650
|
}
|
|
651
651
|
//#endregion
|
|
652
652
|
//#region src/widgets/zone-editor/zone-rule-stage.ts
|
|
653
|
-
function
|
|
653
|
+
function we(e) {
|
|
654
654
|
switch (e) {
|
|
655
|
-
case "motion": return
|
|
656
|
-
case "detection": return
|
|
657
|
-
case "package": return
|
|
655
|
+
case "motion": return Z("rules.title.motion");
|
|
656
|
+
case "detection": return Z("rules.title.detection");
|
|
657
|
+
case "package": return Z("rules.title.package");
|
|
658
658
|
}
|
|
659
659
|
}
|
|
660
660
|
t.options;
|
|
661
661
|
//#endregion
|
|
662
662
|
//#region src/widgets/zone-editor/zone-rule-class-filter.ts
|
|
663
|
-
var
|
|
664
|
-
function
|
|
665
|
-
return
|
|
663
|
+
var Te = new Set(["detection"]);
|
|
664
|
+
function Ee(e) {
|
|
665
|
+
return Te.has(e);
|
|
666
666
|
}
|
|
667
667
|
//#endregion
|
|
668
668
|
//#region src/widgets/zone-editor/types.ts
|
|
669
|
-
function
|
|
669
|
+
function De(e) {
|
|
670
670
|
let t = e.kind === "tripwire" ? {
|
|
671
671
|
kind: "line",
|
|
672
672
|
points: e.points
|
|
@@ -681,13 +681,13 @@ function Oe(e) {
|
|
|
681
681
|
shape: t
|
|
682
682
|
};
|
|
683
683
|
}
|
|
684
|
-
function
|
|
684
|
+
function Oe(e) {
|
|
685
685
|
return e === "line" ? "tripwire" : "polygon";
|
|
686
686
|
}
|
|
687
|
-
function
|
|
687
|
+
function ke(e) {
|
|
688
688
|
return e === "tripwire" ? "line" : "polygon";
|
|
689
689
|
}
|
|
690
|
-
function
|
|
690
|
+
function Ae() {
|
|
691
691
|
if (typeof crypto.randomUUID == "function") return crypto.randomUUID();
|
|
692
692
|
let e = crypto.getRandomValues(new Uint8Array(16));
|
|
693
693
|
e[6] = e[6] & 15 | 64, e[8] = e[8] & 63 | 128;
|
|
@@ -696,11 +696,11 @@ function je() {
|
|
|
696
696
|
}
|
|
697
697
|
//#endregion
|
|
698
698
|
//#region src/widgets/zone-editor/ZoneRulesEditor.tsx
|
|
699
|
-
var
|
|
699
|
+
var je = r.map((e) => ({
|
|
700
700
|
id: e.id,
|
|
701
701
|
label: e.name
|
|
702
702
|
}));
|
|
703
|
-
function
|
|
703
|
+
function Me(e) {
|
|
704
704
|
return {
|
|
705
705
|
id: e.id,
|
|
706
706
|
name: e.name ?? "",
|
|
@@ -712,7 +712,7 @@ function Ne(e) {
|
|
|
712
712
|
confirmWithLlm: e.confirmWithLlm === !0
|
|
713
713
|
};
|
|
714
714
|
}
|
|
715
|
-
function
|
|
715
|
+
function Ne(e, t) {
|
|
716
716
|
return {
|
|
717
717
|
id: e.id,
|
|
718
718
|
zoneIds: e.zoneIds,
|
|
@@ -726,10 +726,10 @@ function Pe(e, t) {
|
|
|
726
726
|
} : {}
|
|
727
727
|
};
|
|
728
728
|
}
|
|
729
|
-
function
|
|
730
|
-
return /* @__PURE__ */
|
|
729
|
+
function Pe({ on: e, label: t, hint: n, onToggle: r }) {
|
|
730
|
+
return /* @__PURE__ */ U("div", {
|
|
731
731
|
className: "flex items-center gap-1.5",
|
|
732
|
-
children: [/* @__PURE__ */
|
|
732
|
+
children: [/* @__PURE__ */ H("button", {
|
|
733
733
|
type: "button",
|
|
734
734
|
role: "switch",
|
|
735
735
|
"aria-checked": e,
|
|
@@ -737,21 +737,21 @@ function Fe({ on: e, label: t, hint: n, onToggle: r }) {
|
|
|
737
737
|
title: n,
|
|
738
738
|
onClick: r,
|
|
739
739
|
className: ["inline-flex items-center justify-center h-5 w-9 rounded-full border transition-colors flex-shrink-0", e ? "border-primary/50 bg-primary/20 text-primary" : "border-border bg-surface text-foreground-subtle"].join(" "),
|
|
740
|
-
children: /* @__PURE__ */
|
|
741
|
-
}), /* @__PURE__ */
|
|
740
|
+
children: /* @__PURE__ */ H("span", { className: ["h-3 w-3 rounded-full transition-transform", e ? "translate-x-1.5 bg-primary" : "-translate-x-1.5 bg-foreground-subtle"].join(" ") })
|
|
741
|
+
}), /* @__PURE__ */ H("span", {
|
|
742
742
|
className: "text-[10px] text-foreground leading-tight",
|
|
743
743
|
children: t
|
|
744
744
|
})]
|
|
745
745
|
});
|
|
746
746
|
}
|
|
747
|
-
function
|
|
748
|
-
let { t: o } =
|
|
747
|
+
function Q({ dev: e, deviceId: t, stage: n, zones: r, title: a }) {
|
|
748
|
+
let { t: o } = X(), s = F(), l = j(e?.state.zoneRules), d = c(() => l?.[n] ?? [], [l, n]), [f, _] = u([]), [y, b] = u(!1), [x, S] = u(!1), [C, D] = u(null), O = Ee(n);
|
|
749
749
|
i(() => {
|
|
750
|
-
|
|
751
|
-
}, [d,
|
|
752
|
-
let
|
|
753
|
-
|
|
754
|
-
id:
|
|
750
|
+
y || _(d.map(Me));
|
|
751
|
+
}, [d, y]);
|
|
752
|
+
let k = () => {
|
|
753
|
+
_((e) => [...e, {
|
|
754
|
+
id: Ae(),
|
|
755
755
|
name: "",
|
|
756
756
|
zoneIds: r[0] ? [r[0].id] : [],
|
|
757
757
|
mode: "exclude",
|
|
@@ -759,193 +759,193 @@ function Z({ dev: e, deviceId: t, stage: n, zones: r, title: a }) {
|
|
|
759
759
|
enabled: !0,
|
|
760
760
|
detectBySceneDifference: !1,
|
|
761
761
|
confirmWithLlm: !1
|
|
762
|
-
}]),
|
|
763
|
-
},
|
|
764
|
-
|
|
762
|
+
}]), b(!0);
|
|
763
|
+
}, M = (e, t) => {
|
|
764
|
+
_((n) => n.map((n, r) => {
|
|
765
765
|
if (r !== e) return n;
|
|
766
766
|
let i = n.classFilter.includes(t) ? n.classFilter.filter((e) => e !== t) : [...n.classFilter, t];
|
|
767
767
|
return {
|
|
768
768
|
...n,
|
|
769
769
|
classFilter: i
|
|
770
770
|
};
|
|
771
|
-
})),
|
|
772
|
-
},
|
|
773
|
-
|
|
771
|
+
})), b(!0);
|
|
772
|
+
}, N = (e, t) => {
|
|
773
|
+
_((n) => n.map((n, r) => {
|
|
774
774
|
if (r !== e) return n;
|
|
775
775
|
let i = n.zoneIds.includes(t) ? n.zoneIds.filter((e) => e !== t) : [...n.zoneIds, t];
|
|
776
776
|
return {
|
|
777
777
|
...n,
|
|
778
778
|
zoneIds: i
|
|
779
779
|
};
|
|
780
|
-
})),
|
|
781
|
-
},
|
|
782
|
-
|
|
783
|
-
},
|
|
784
|
-
|
|
780
|
+
})), b(!0);
|
|
781
|
+
}, P = (e) => {
|
|
782
|
+
_((t) => t.filter((t, n) => n !== e)), b(!0);
|
|
783
|
+
}, I = (e, t) => {
|
|
784
|
+
_((n) => n.map((n, r) => r === e ? {
|
|
785
785
|
...n,
|
|
786
786
|
...t
|
|
787
|
-
} : n)),
|
|
788
|
-
},
|
|
789
|
-
|
|
787
|
+
} : n)), b(!0);
|
|
788
|
+
}, L = async () => {
|
|
789
|
+
S(!0), D(null);
|
|
790
790
|
try {
|
|
791
791
|
await s.trpcClient.zoneRules.setRules.mutate({
|
|
792
792
|
deviceId: t,
|
|
793
793
|
stage: n,
|
|
794
|
-
rules: f.map((e) =>
|
|
795
|
-
}),
|
|
794
|
+
rules: f.map((e) => Ne(e, n))
|
|
795
|
+
}), b(!1);
|
|
796
796
|
} catch (e) {
|
|
797
|
-
|
|
797
|
+
D(e instanceof Error ? e.message : String(e));
|
|
798
798
|
} finally {
|
|
799
|
-
|
|
799
|
+
S(!1);
|
|
800
800
|
}
|
|
801
|
-
},
|
|
802
|
-
return /* @__PURE__ */
|
|
801
|
+
}, R = y && !x;
|
|
802
|
+
return /* @__PURE__ */ U("div", {
|
|
803
803
|
className: "rounded-md border border-border bg-surface/40 p-2.5",
|
|
804
804
|
children: [
|
|
805
|
-
/* @__PURE__ */
|
|
805
|
+
/* @__PURE__ */ U("div", {
|
|
806
806
|
className: "flex items-center justify-between mb-2 gap-2",
|
|
807
|
-
children: [/* @__PURE__ */
|
|
808
|
-
className: `${
|
|
809
|
-
children: a ??
|
|
810
|
-
}), /* @__PURE__ */
|
|
807
|
+
children: [/* @__PURE__ */ H("h3", {
|
|
808
|
+
className: `${v} truncate`,
|
|
809
|
+
children: a ?? we(n)
|
|
810
|
+
}), /* @__PURE__ */ U("div", {
|
|
811
811
|
className: "flex items-center gap-1 flex-shrink-0",
|
|
812
|
-
children: [/* @__PURE__ */
|
|
812
|
+
children: [/* @__PURE__ */ U(p, {
|
|
813
813
|
variant: "unstyled",
|
|
814
814
|
type: "button",
|
|
815
|
-
onClick:
|
|
815
|
+
onClick: k,
|
|
816
816
|
disabled: r.length === 0 || !e,
|
|
817
817
|
className: w,
|
|
818
818
|
title: o("rules.add"),
|
|
819
819
|
children: [
|
|
820
|
-
/* @__PURE__ */
|
|
820
|
+
/* @__PURE__ */ H(fe, { className: "h-2.5 w-2.5" }),
|
|
821
821
|
" ",
|
|
822
822
|
o("rules.addShort")
|
|
823
823
|
]
|
|
824
|
-
}), /* @__PURE__ */
|
|
824
|
+
}), /* @__PURE__ */ U(p, {
|
|
825
825
|
variant: "unstyled",
|
|
826
826
|
type: "button",
|
|
827
827
|
onClick: () => {
|
|
828
|
-
|
|
828
|
+
L();
|
|
829
829
|
},
|
|
830
|
-
disabled: !
|
|
830
|
+
disabled: !R,
|
|
831
831
|
className: A,
|
|
832
|
-
children: [/* @__PURE__ */
|
|
832
|
+
children: [/* @__PURE__ */ H(pe, { className: "h-2.5 w-2.5" }), x ? "…" : o("rules.save")]
|
|
833
833
|
})]
|
|
834
834
|
})]
|
|
835
835
|
}),
|
|
836
|
-
f.length === 0 ? /* @__PURE__ */
|
|
836
|
+
f.length === 0 ? /* @__PURE__ */ H("p", {
|
|
837
837
|
className: "text-[10px] text-foreground-subtle italic px-1 py-1.5 leading-tight",
|
|
838
838
|
children: r.length === 0 ? o("rules.noZones") : o("rules.empty")
|
|
839
|
-
}) : /* @__PURE__ */
|
|
839
|
+
}) : /* @__PURE__ */ H("div", {
|
|
840
840
|
className: "flex flex-col gap-1.5",
|
|
841
|
-
children: f.map((e, t) => /* @__PURE__ */
|
|
841
|
+
children: f.map((e, t) => /* @__PURE__ */ U("div", {
|
|
842
842
|
className: "rounded border border-border/50 bg-background/40 px-2 py-1.5 flex flex-col gap-1.5 overflow-hidden",
|
|
843
843
|
children: [
|
|
844
|
-
/* @__PURE__ */
|
|
844
|
+
/* @__PURE__ */ U("div", {
|
|
845
845
|
className: "grid grid-cols-[auto_1fr_auto] items-center gap-1.5",
|
|
846
846
|
children: [
|
|
847
|
-
/* @__PURE__ */
|
|
847
|
+
/* @__PURE__ */ H(p, {
|
|
848
848
|
variant: "unstyled",
|
|
849
849
|
type: "button",
|
|
850
850
|
role: "switch",
|
|
851
851
|
"aria-checked": e.enabled,
|
|
852
852
|
"aria-label": e.enabled ? o("rules.disable") : o("rules.enable"),
|
|
853
853
|
title: e.enabled ? o("rules.activeTitle") : o("rules.disabledTitle"),
|
|
854
|
-
onClick: () =>
|
|
854
|
+
onClick: () => I(t, { enabled: !e.enabled }),
|
|
855
855
|
className: ["inline-flex items-center justify-center h-5 w-9 rounded-full border transition-colors flex-shrink-0", e.enabled ? "border-primary/50 bg-primary/20 text-primary" : "border-border bg-surface text-foreground-subtle"].join(" "),
|
|
856
|
-
children: /* @__PURE__ */
|
|
856
|
+
children: /* @__PURE__ */ H("span", { className: ["h-3 w-3 rounded-full transition-transform", e.enabled ? "translate-x-1.5 bg-primary" : "-translate-x-1.5 bg-foreground-subtle"].join(" ") })
|
|
857
857
|
}),
|
|
858
|
-
/* @__PURE__ */
|
|
858
|
+
/* @__PURE__ */ H(T, {
|
|
859
859
|
className: `${E} min-w-0`,
|
|
860
860
|
placeholder: o("rules.namePlaceholder"),
|
|
861
861
|
value: e.name,
|
|
862
|
-
onChange: (e) =>
|
|
862
|
+
onChange: (e) => I(t, { name: e.target.value })
|
|
863
863
|
}),
|
|
864
|
-
/* @__PURE__ */
|
|
864
|
+
/* @__PURE__ */ H(p, {
|
|
865
865
|
variant: "unstyled",
|
|
866
866
|
type: "button",
|
|
867
867
|
title: o("rules.remove"),
|
|
868
868
|
"aria-label": o("rules.remove"),
|
|
869
|
-
onClick: () =>
|
|
869
|
+
onClick: () => P(t),
|
|
870
870
|
className: "flex items-center justify-center h-6 w-6 rounded text-foreground-subtle hover:text-danger hover:bg-danger/10 transition-colors flex-shrink-0",
|
|
871
|
-
children: /* @__PURE__ */
|
|
871
|
+
children: /* @__PURE__ */ H(J, { className: "h-3.5 w-3.5" })
|
|
872
872
|
})
|
|
873
873
|
]
|
|
874
874
|
}),
|
|
875
|
-
/* @__PURE__ */
|
|
875
|
+
/* @__PURE__ */ U("div", {
|
|
876
876
|
className: "flex items-center gap-1.5 flex-wrap",
|
|
877
877
|
children: [
|
|
878
|
-
/* @__PURE__ */
|
|
878
|
+
/* @__PURE__ */ H("span", {
|
|
879
879
|
className: "text-[9px] uppercase tracking-wider text-foreground-subtle w-12 sm:w-14 flex-shrink-0",
|
|
880
880
|
children: o("rules.mode")
|
|
881
881
|
}),
|
|
882
|
-
/* @__PURE__ */
|
|
882
|
+
/* @__PURE__ */ H(p, {
|
|
883
883
|
variant: "unstyled",
|
|
884
884
|
type: "button",
|
|
885
|
-
onClick: () =>
|
|
885
|
+
onClick: () => I(t, { mode: "include" }),
|
|
886
886
|
className: `${m} ${e.mode === "include" ? h : g}`,
|
|
887
887
|
children: o("rules.include")
|
|
888
888
|
}),
|
|
889
|
-
/* @__PURE__ */
|
|
889
|
+
/* @__PURE__ */ H(p, {
|
|
890
890
|
variant: "unstyled",
|
|
891
891
|
type: "button",
|
|
892
|
-
onClick: () =>
|
|
892
|
+
onClick: () => I(t, { mode: "exclude" }),
|
|
893
893
|
className: `${m} ${e.mode === "exclude" ? h : g}`,
|
|
894
894
|
children: o("rules.exclude")
|
|
895
895
|
})
|
|
896
896
|
]
|
|
897
897
|
}),
|
|
898
|
-
/* @__PURE__ */
|
|
898
|
+
/* @__PURE__ */ U("div", {
|
|
899
899
|
className: "flex items-center gap-1.5 flex-wrap",
|
|
900
|
-
children: [/* @__PURE__ */
|
|
900
|
+
children: [/* @__PURE__ */ H("span", {
|
|
901
901
|
className: "text-[9px] uppercase tracking-wider text-foreground-subtle w-12 sm:w-14 flex-shrink-0",
|
|
902
902
|
children: o("rules.zones")
|
|
903
|
-
}), r.length === 0 ? /* @__PURE__ */
|
|
903
|
+
}), r.length === 0 ? /* @__PURE__ */ H("span", {
|
|
904
904
|
className: "text-[10px] text-foreground-subtle italic",
|
|
905
905
|
children: o("rules.noneZones")
|
|
906
|
-
}) : r.map((n) => /* @__PURE__ */
|
|
906
|
+
}) : r.map((n) => /* @__PURE__ */ U(p, {
|
|
907
907
|
variant: "unstyled",
|
|
908
908
|
type: "button",
|
|
909
|
-
onClick: () =>
|
|
909
|
+
onClick: () => N(t, n.id),
|
|
910
910
|
className: `${m} ${e.zoneIds.includes(n.id) ? h : g}`,
|
|
911
|
-
children: [/* @__PURE__ */
|
|
911
|
+
children: [/* @__PURE__ */ H("span", {
|
|
912
912
|
className: "h-2 w-2 rounded-sm",
|
|
913
913
|
style: { backgroundColor: n.color || "#3b82f6" }
|
|
914
|
-
}), /* @__PURE__ */
|
|
914
|
+
}), /* @__PURE__ */ H("span", {
|
|
915
915
|
className: "truncate max-w-[7rem]",
|
|
916
916
|
children: n.name || n.id
|
|
917
917
|
})]
|
|
918
918
|
}, n.id))]
|
|
919
919
|
}),
|
|
920
|
-
n === "package" && /* @__PURE__ */
|
|
920
|
+
n === "package" && /* @__PURE__ */ U("div", {
|
|
921
921
|
className: "flex flex-col gap-1",
|
|
922
|
-
children: [/* @__PURE__ */
|
|
922
|
+
children: [/* @__PURE__ */ H(Pe, {
|
|
923
923
|
on: e.detectBySceneDifference,
|
|
924
924
|
label: o("rules.sceneDifference"),
|
|
925
925
|
hint: o("rules.sceneDifferenceHint"),
|
|
926
|
-
onToggle: () =>
|
|
927
|
-
}), /* @__PURE__ */
|
|
926
|
+
onToggle: () => I(t, { detectBySceneDifference: !e.detectBySceneDifference })
|
|
927
|
+
}), /* @__PURE__ */ H(Pe, {
|
|
928
928
|
on: e.confirmWithLlm,
|
|
929
929
|
label: o("rules.confirmLlm"),
|
|
930
930
|
hint: o("rules.confirmLlmHint"),
|
|
931
|
-
onToggle: () =>
|
|
931
|
+
onToggle: () => I(t, { confirmWithLlm: !e.confirmWithLlm })
|
|
932
932
|
})]
|
|
933
933
|
}),
|
|
934
|
-
|
|
934
|
+
O && /* @__PURE__ */ U("div", {
|
|
935
935
|
className: "flex items-center gap-1.5 flex-wrap",
|
|
936
936
|
children: [
|
|
937
|
-
/* @__PURE__ */
|
|
937
|
+
/* @__PURE__ */ H("span", {
|
|
938
938
|
className: "text-[9px] uppercase tracking-wider text-foreground-subtle w-12 sm:w-14 flex-shrink-0",
|
|
939
939
|
children: o("rules.class")
|
|
940
940
|
}),
|
|
941
|
-
|
|
941
|
+
je.map((n) => /* @__PURE__ */ H(p, {
|
|
942
942
|
variant: "unstyled",
|
|
943
943
|
type: "button",
|
|
944
|
-
onClick: () =>
|
|
944
|
+
onClick: () => M(t, n.id),
|
|
945
945
|
className: `${m} ${e.classFilter.includes(n.id) ? h : g}`,
|
|
946
946
|
children: n.label
|
|
947
947
|
}, n.id)),
|
|
948
|
-
e.classFilter.length === 0 && /* @__PURE__ */
|
|
948
|
+
e.classFilter.length === 0 && /* @__PURE__ */ H("span", {
|
|
949
949
|
className: "text-[10px] text-foreground-subtle italic ml-1",
|
|
950
950
|
children: o("rules.anyClass")
|
|
951
951
|
})
|
|
@@ -954,16 +954,16 @@ function Z({ dev: e, deviceId: t, stage: n, zones: r, title: a }) {
|
|
|
954
954
|
]
|
|
955
955
|
}, e.id))
|
|
956
956
|
}),
|
|
957
|
-
|
|
957
|
+
C && /* @__PURE__ */ H("p", {
|
|
958
958
|
className: "mt-2 text-[10px] text-danger",
|
|
959
|
-
children:
|
|
959
|
+
children: C
|
|
960
960
|
})
|
|
961
961
|
]
|
|
962
962
|
});
|
|
963
963
|
}
|
|
964
964
|
//#endregion
|
|
965
965
|
//#region src/widgets/zone-editor/ZoneOverlay.tsx
|
|
966
|
-
var
|
|
966
|
+
var Fe = "#3b82f6", Ie = ["polygon", "line"], $ = [
|
|
967
967
|
"#3b82f6",
|
|
968
968
|
"#10b981",
|
|
969
969
|
"#f59e0b",
|
|
@@ -975,21 +975,21 @@ var Ie = "#3b82f6", Le = ["polygon", "line"], Q = [
|
|
|
975
975
|
"#8b5cf6",
|
|
976
976
|
"#14b8a6"
|
|
977
977
|
];
|
|
978
|
-
function
|
|
978
|
+
function Le(e) {
|
|
979
979
|
let t = new Set(e.map((e) => (e.color ?? "").toLowerCase()));
|
|
980
|
-
for (let e of
|
|
981
|
-
return
|
|
980
|
+
for (let e of $) if (!t.has(e.toLowerCase())) return e;
|
|
981
|
+
return $[e.length % $.length];
|
|
982
982
|
}
|
|
983
|
-
function
|
|
983
|
+
function Re(e) {
|
|
984
984
|
return {
|
|
985
985
|
id: e.id,
|
|
986
986
|
name: e.name,
|
|
987
987
|
kind: e.kind,
|
|
988
|
-
color: e.color ||
|
|
988
|
+
color: e.color || Fe,
|
|
989
989
|
points: [...e.polygon]
|
|
990
990
|
};
|
|
991
991
|
}
|
|
992
|
-
function
|
|
992
|
+
function ze(e) {
|
|
993
993
|
return {
|
|
994
994
|
id: e.id,
|
|
995
995
|
name: e.name,
|
|
@@ -1005,20 +1005,20 @@ function Be({ deviceId: e }) {
|
|
|
1005
1005
|
kind: d.kind,
|
|
1006
1006
|
color: d.color,
|
|
1007
1007
|
points: [...d.points]
|
|
1008
|
-
} :
|
|
1008
|
+
} : Re(e)), [r, d]), p = c(() => f.map(De), [f]), [m, h] = u(null), g = o(async (n) => {
|
|
1009
1009
|
if (n.kind !== "polygon" && n.kind !== "line") return;
|
|
1010
1010
|
let r = {
|
|
1011
|
-
id:
|
|
1011
|
+
id: Ae(),
|
|
1012
1012
|
name: "",
|
|
1013
|
-
kind:
|
|
1014
|
-
color:
|
|
1013
|
+
kind: Oe(n.kind),
|
|
1014
|
+
color: Le(f),
|
|
1015
1015
|
points: [...n.points]
|
|
1016
1016
|
};
|
|
1017
1017
|
h(null);
|
|
1018
1018
|
try {
|
|
1019
1019
|
await t.trpcClient.zones.addZone.mutate({
|
|
1020
1020
|
deviceId: e,
|
|
1021
|
-
zone:
|
|
1021
|
+
zone: ze(r)
|
|
1022
1022
|
}), i?.enterDraft({
|
|
1023
1023
|
id: r.id,
|
|
1024
1024
|
kind: r.kind,
|
|
@@ -1048,7 +1048,7 @@ function Be({ deviceId: e }) {
|
|
|
1048
1048
|
if (o) try {
|
|
1049
1049
|
await t.trpcClient.zones.updateZone.mutate({
|
|
1050
1050
|
deviceId: e,
|
|
1051
|
-
zone:
|
|
1051
|
+
zone: ze({
|
|
1052
1052
|
...o,
|
|
1053
1053
|
points: a
|
|
1054
1054
|
})
|
|
@@ -1083,20 +1083,20 @@ function Be({ deviceId: e }) {
|
|
|
1083
1083
|
points: t.points
|
|
1084
1084
|
});
|
|
1085
1085
|
}, [f, i]);
|
|
1086
|
-
return f.length === 0 && s === null && m === null ? null : /* @__PURE__ */
|
|
1086
|
+
return f.length === 0 && s === null && m === null ? null : /* @__PURE__ */ U(a, {
|
|
1087
1087
|
fallback: null,
|
|
1088
|
-
children: [/* @__PURE__ */
|
|
1088
|
+
children: [/* @__PURE__ */ H(y, {
|
|
1089
1089
|
transparent: !0,
|
|
1090
1090
|
items: p,
|
|
1091
|
-
supportedShapes:
|
|
1091
|
+
supportedShapes: Ie,
|
|
1092
1092
|
selectedId: l,
|
|
1093
1093
|
onSelect: b,
|
|
1094
1094
|
onShapeChange: v,
|
|
1095
1095
|
onDrawComplete: (e) => {
|
|
1096
1096
|
g(e);
|
|
1097
1097
|
},
|
|
1098
|
-
drawingKind: s === null ? null :
|
|
1099
|
-
}), m !== null && /* @__PURE__ */
|
|
1098
|
+
drawingKind: s === null ? null : ke(s)
|
|
1099
|
+
}), m !== null && /* @__PURE__ */ H("p", {
|
|
1100
1100
|
role: "alert",
|
|
1101
1101
|
className: "absolute inset-x-2 bottom-2 rounded-md border border-danger/40 bg-background-elevated px-2 py-1 text-xs text-danger",
|
|
1102
1102
|
children: m
|
|
@@ -1123,13 +1123,13 @@ function We(e) {
|
|
|
1123
1123
|
};
|
|
1124
1124
|
}
|
|
1125
1125
|
function Ge({ deviceId: e }) {
|
|
1126
|
-
let { t } =
|
|
1126
|
+
let { t } = X(), n = F(), r = I(n.trpcClient, e), i = j(r?.state.zones), a = c(() => i?.zones ?? [], [i]), s = c(() => a.map(Ue), [a]), [l, d] = u(null), f = k(), p = f?.drawingKind ?? null, m = f?.selectedZoneId ?? null, h = f?.editingDraft ?? null;
|
|
1127
1127
|
M(c(() => ({
|
|
1128
1128
|
id: "zones",
|
|
1129
1129
|
order: 100,
|
|
1130
|
-
node: /* @__PURE__ */
|
|
1130
|
+
node: /* @__PURE__ */ H(Ve, { deviceId: e })
|
|
1131
1131
|
}), [e]));
|
|
1132
|
-
let
|
|
1132
|
+
let g = o((e) => {
|
|
1133
1133
|
if (e === null) {
|
|
1134
1134
|
f?.discardDraft(), f?.setSelectedZoneId(null);
|
|
1135
1135
|
return;
|
|
@@ -1142,7 +1142,7 @@ function Ge({ deviceId: e }) {
|
|
|
1142
1142
|
color: t.color,
|
|
1143
1143
|
points: t.points
|
|
1144
1144
|
});
|
|
1145
|
-
}, [s, f]),
|
|
1145
|
+
}, [s, f]), _ = o(async () => {
|
|
1146
1146
|
let t = f?.editingDraft;
|
|
1147
1147
|
if (t) {
|
|
1148
1148
|
try {
|
|
@@ -1185,73 +1185,73 @@ function Ge({ deviceId: e }) {
|
|
|
1185
1185
|
f?.startDrawing(e);
|
|
1186
1186
|
}, [f]), C = o(() => {
|
|
1187
1187
|
f?.setDrawingKind(null);
|
|
1188
|
-
}, [f]), w = c(() => !
|
|
1189
|
-
id:
|
|
1190
|
-
kind:
|
|
1191
|
-
name:
|
|
1192
|
-
color:
|
|
1193
|
-
points: [...
|
|
1194
|
-
}, [s,
|
|
1195
|
-
return /* @__PURE__ */
|
|
1196
|
-
className:
|
|
1197
|
-
children: [/* @__PURE__ */
|
|
1198
|
-
className:
|
|
1199
|
-
children: [/* @__PURE__ */
|
|
1188
|
+
}, [f]), w = c(() => !h || !s.find((e) => e.id === h.id) ? null : {
|
|
1189
|
+
id: h.id,
|
|
1190
|
+
kind: h.kind,
|
|
1191
|
+
name: h.name,
|
|
1192
|
+
color: h.color,
|
|
1193
|
+
points: [...h.points]
|
|
1194
|
+
}, [s, h]);
|
|
1195
|
+
return /* @__PURE__ */ U("div", {
|
|
1196
|
+
className: B,
|
|
1197
|
+
children: [/* @__PURE__ */ U("div", {
|
|
1198
|
+
className: V,
|
|
1199
|
+
children: [/* @__PURE__ */ H("div", {
|
|
1200
1200
|
className: x,
|
|
1201
|
-
children: /* @__PURE__ */
|
|
1201
|
+
children: /* @__PURE__ */ U("div", {
|
|
1202
1202
|
className: "min-w-0",
|
|
1203
|
-
children: [/* @__PURE__ */
|
|
1204
|
-
className:
|
|
1203
|
+
children: [/* @__PURE__ */ H("h2", {
|
|
1204
|
+
className: v,
|
|
1205
1205
|
children: t("zonesTab.title")
|
|
1206
|
-
}), /* @__PURE__ */
|
|
1207
|
-
className: `${
|
|
1208
|
-
children: /* @__PURE__ */
|
|
1206
|
+
}), /* @__PURE__ */ H("p", {
|
|
1207
|
+
className: `${z} mt-0.5 leading-tight`,
|
|
1208
|
+
children: /* @__PURE__ */ H(ge, {
|
|
1209
1209
|
i18nKey: "zonesTab.hint",
|
|
1210
|
-
components: { b: /* @__PURE__ */
|
|
1210
|
+
components: { b: /* @__PURE__ */ H("strong", { className: "text-foreground" }) }
|
|
1211
1211
|
})
|
|
1212
1212
|
})]
|
|
1213
1213
|
})
|
|
1214
|
-
}), /* @__PURE__ */
|
|
1214
|
+
}), /* @__PURE__ */ U("div", {
|
|
1215
1215
|
className: `${R} flex flex-col gap-3`,
|
|
1216
1216
|
children: [
|
|
1217
|
-
/* @__PURE__ */
|
|
1217
|
+
/* @__PURE__ */ H(xe, {
|
|
1218
1218
|
zones: s,
|
|
1219
|
-
selectedZoneId:
|
|
1220
|
-
drawingKind:
|
|
1221
|
-
onSelectZone:
|
|
1219
|
+
selectedZoneId: m,
|
|
1220
|
+
drawingKind: p,
|
|
1221
|
+
onSelectZone: g,
|
|
1222
1222
|
onDeleteZone: b,
|
|
1223
1223
|
onStartDraw: S,
|
|
1224
1224
|
onCancelDraw: C
|
|
1225
1225
|
}),
|
|
1226
|
-
l !== null && /* @__PURE__ */
|
|
1226
|
+
l !== null && /* @__PURE__ */ H("p", {
|
|
1227
1227
|
role: "alert",
|
|
1228
1228
|
className: "text-xs text-danger",
|
|
1229
1229
|
children: l
|
|
1230
1230
|
}),
|
|
1231
|
-
w && /* @__PURE__ */
|
|
1231
|
+
w && /* @__PURE__ */ U(W, { children: [/* @__PURE__ */ H("div", { className: "border-t border-border" }), /* @__PURE__ */ H(Ce, {
|
|
1232
1232
|
zone: w,
|
|
1233
|
-
onSave:
|
|
1233
|
+
onSave: _,
|
|
1234
1234
|
onDiscard: y,
|
|
1235
1235
|
onDelete: () => b(w.id)
|
|
1236
1236
|
})] })
|
|
1237
1237
|
]
|
|
1238
1238
|
})]
|
|
1239
|
-
}), /* @__PURE__ */
|
|
1239
|
+
}), /* @__PURE__ */ U("div", {
|
|
1240
1240
|
className: `grid grid-cols-1 2xl:grid-cols-2 ${L}`,
|
|
1241
1241
|
children: [
|
|
1242
|
-
/* @__PURE__ */
|
|
1242
|
+
/* @__PURE__ */ H(Q, {
|
|
1243
1243
|
dev: r,
|
|
1244
1244
|
deviceId: e,
|
|
1245
1245
|
stage: "motion",
|
|
1246
1246
|
zones: a
|
|
1247
1247
|
}),
|
|
1248
|
-
/* @__PURE__ */
|
|
1248
|
+
/* @__PURE__ */ H(Q, {
|
|
1249
1249
|
dev: r,
|
|
1250
1250
|
deviceId: e,
|
|
1251
1251
|
stage: "detection",
|
|
1252
1252
|
zones: a
|
|
1253
1253
|
}),
|
|
1254
|
-
/* @__PURE__ */
|
|
1254
|
+
/* @__PURE__ */ H(Q, {
|
|
1255
1255
|
dev: r,
|
|
1256
1256
|
deviceId: e,
|
|
1257
1257
|
stage: "package",
|
|
@@ -1264,16 +1264,16 @@ function Ge({ deviceId: e }) {
|
|
|
1264
1264
|
//#endregion
|
|
1265
1265
|
//#region src/widgets/ZoneEditor.tsx
|
|
1266
1266
|
function Ke(e) {
|
|
1267
|
-
let { t } =
|
|
1268
|
-
return e.deviceId === void 0 ? /* @__PURE__ */
|
|
1267
|
+
let { t } = X();
|
|
1268
|
+
return e.deviceId === void 0 ? /* @__PURE__ */ H("div", {
|
|
1269
1269
|
className: "rounded-lg border border-warning/30 bg-warning/10 px-3 py-2 text-xs text-warning",
|
|
1270
1270
|
children: t("zoneEditor.requiresDevice")
|
|
1271
|
-
}) : /* @__PURE__ */
|
|
1271
|
+
}) : /* @__PURE__ */ H(Ge, { deviceId: e.deviceId });
|
|
1272
1272
|
}
|
|
1273
1273
|
//#endregion
|
|
1274
1274
|
//#region src/widgets/index.tsx
|
|
1275
1275
|
var qe = {
|
|
1276
|
-
"pipeline-quick-stats":
|
|
1276
|
+
"pipeline-quick-stats": _e,
|
|
1277
1277
|
"zone-editor": Ke
|
|
1278
1278
|
};
|
|
1279
1279
|
//#endregion
|