@dominevo/addon-pipeline-orchestrator 0.1.5 → 0.1.6
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 +6 -0
- package/dist/_stub.js +231 -231
- package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-DwR335Eq.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-aT2eterZ.mjs} +2 -2
- package/dist/{_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_dominevo_mf_1_types__loadShare__.js-C1DvduyH.mjs → _virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_dominevo_mf_1_types__loadShare__.js--6admDN-.mjs} +1 -1
- package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_dominevo_mf_1_ui_mf_2_library__loadShare__.js-BhU7d62u.mjs +26 -0
- package/dist/{hostInit-B5mo_XqS.mjs → hostInit-CHdmtLkC.mjs} +2 -2
- package/dist/index.js +42 -33
- package/dist/index.mjs +42 -33
- package/dist/remoteEntry.js +1 -1
- package/package.json +2 -2
- package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_dominevo_mf_1_ui_mf_2_library__loadShare__.js-DlWicp8q.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_dominevo_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_dominevo_mf_1_types__loadShare__.js--6admDN-.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, M as g, O as _, S as v, T as y, _ as b, a as x, b as S, c as C, d as w, f as T, g as E, h as D, i as O, j as k, k as A, l as j, m as
|
|
5
|
-
import { n as
|
|
4
|
+
import { A as f, C as p, D as m, E as h, M as g, O as _, S as v, T as y, _ as b, a as x, b as S, c as C, d as w, f as T, g as E, h as D, i as O, j as k, k as A, l as j, m as M, n as N, o as P, p as F, r as I, s as L, t as R, u as z, v as B, w as V, x as H, y as U } from "./_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_dominevo_mf_1_ui_mf_2_library__loadShare__.js-BhU7d62u.mjs";
|
|
5
|
+
import { n as W, r as G, t as K } 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 q = (...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()), ne = (e) => {
|
|
8
|
+
let t = te(e);
|
|
9
9
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
10
|
-
},
|
|
10
|
+
}, re = {
|
|
11
11
|
xmlns: "http://www.w3.org/2000/svg",
|
|
12
12
|
width: 24,
|
|
13
13
|
height: 24,
|
|
@@ -17,34 +17,34 @@ var G = (...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
|
+
}, ie = (e) => {
|
|
21
21
|
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
|
22
22
|
return !1;
|
|
23
|
-
},
|
|
23
|
+
}, ae = 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
|
+
...re,
|
|
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: q("lucide", i),
|
|
31
|
+
...!a && !ie(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]])), J = (e, t) => {
|
|
34
|
+
let n = s(({ className: n, ...r }, i) => d(ae, {
|
|
35
35
|
ref: i,
|
|
36
36
|
iconNode: t,
|
|
37
|
-
className:
|
|
37
|
+
className: q(`lucide-${ee(ne(e))}`, `lucide-${e}`, n),
|
|
38
38
|
...r
|
|
39
39
|
}));
|
|
40
|
-
return n.displayName =
|
|
41
|
-
},
|
|
40
|
+
return n.displayName = ne(e), n;
|
|
41
|
+
}, oe = J("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
|
+
}]]), se = J("check", [["path", {
|
|
45
45
|
d: "M20 6 9 17l-5-5",
|
|
46
46
|
key: "1gmf2c"
|
|
47
|
-
}]]),
|
|
47
|
+
}]]), ce = J("cpu", [
|
|
48
48
|
["path", {
|
|
49
49
|
d: "M12 20v2",
|
|
50
50
|
key: "1lh1kg"
|
|
@@ -109,7 +109,7 @@ var G = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
109
109
|
rx: "1",
|
|
110
110
|
key: "z9xiuo"
|
|
111
111
|
}]
|
|
112
|
-
]),
|
|
112
|
+
]), le = J("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 G = (...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
|
+
}]]), ue = J("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
|
+
}]]), de = J("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
|
+
}]]), fe = J("minus", [["path", {
|
|
130
130
|
d: "M5 12h14",
|
|
131
131
|
key: "1ays0h"
|
|
132
|
-
}]]),
|
|
132
|
+
}]]), pe = J("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
|
+
}]]), me = J("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 G = (...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
|
+
]), Y = J("trash-2", [
|
|
152
152
|
["path", {
|
|
153
153
|
d: "M10 11v6",
|
|
154
154
|
key: "nco0om"
|
|
@@ -169,7 +169,7 @@ var G = (...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
|
+
]), he = J("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 G = (...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
|
+
}]]), ge = J("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 G = (...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
|
+
]), _e = J("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: X, Trans: ve, translate: Z } =
|
|
201
|
+
}]]), { useT: X, Trans: ve, translate: Z } = I("pipeline-orchestrator", {
|
|
202
202
|
en: {
|
|
203
203
|
quickStats: {
|
|
204
204
|
requiresDevice: "PipelineQuickStats requires a deviceId",
|
|
@@ -362,25 +362,25 @@ var G = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
362
362
|
//#region src/widgets/PipelineQuickStats.tsx
|
|
363
363
|
function ye(e) {
|
|
364
364
|
let { t } = X();
|
|
365
|
-
return e.deviceId === void 0 ? /* @__PURE__ */
|
|
365
|
+
return e.deviceId === void 0 ? /* @__PURE__ */ W("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__ */ W(be, { deviceId: e.deviceId });
|
|
369
369
|
}
|
|
370
370
|
function be({ deviceId: t }) {
|
|
371
|
-
let { t: r } = X(), i =
|
|
372
|
-
|
|
371
|
+
let { t: r } = X(), i = T();
|
|
372
|
+
L(["pipelineOrchestrator", "getPipelineAssignment"], [
|
|
373
373
|
"pipeline.camera-assigned",
|
|
374
374
|
"pipeline.camera-unassigned",
|
|
375
375
|
"pipeline.camera-updated"
|
|
376
|
-
]),
|
|
377
|
-
let { data: a } =
|
|
376
|
+
]), L(["pipelineRunner", "getCameraMetrics"], ["pipeline.camera-metrics-snapshot"]);
|
|
377
|
+
let { data: a } = C({ deviceId: t }, { staleTime: 3e4 }), o = a?.agentNodeId ?? null, s = typeof o == "string" && o.length > 0 && !o.startsWith("addon:") ? o : void 0, { data: c } = j({
|
|
378
378
|
deviceId: t,
|
|
379
379
|
...s ? { nodeId: s } : {}
|
|
380
380
|
}, {
|
|
381
381
|
staleTime: 2e3,
|
|
382
382
|
retry: !1
|
|
383
|
-
}), l =
|
|
383
|
+
}), l = w(), u = x(l.trpcClient, t), { data: d } = e({
|
|
384
384
|
queryKey: [
|
|
385
385
|
"device",
|
|
386
386
|
t,
|
|
@@ -405,12 +405,12 @@ function be({ deviceId: t }) {
|
|
|
405
405
|
queryFn: async () => await l.trpcClient.recordingArchive.getStatus.query({ deviceId: t }),
|
|
406
406
|
refetchInterval: 5e3,
|
|
407
407
|
retry: !1
|
|
408
|
-
}), { data:
|
|
408
|
+
}), { data: h } = e({
|
|
409
409
|
queryKey: ["recordingArchive.getDeviceConfig", t],
|
|
410
410
|
queryFn: async () => await l.trpcClient.recordingArchive.getDeviceConfig.query({ deviceId: t }),
|
|
411
411
|
staleTime: 3e4,
|
|
412
412
|
retry: !1
|
|
413
|
-
}), { data:
|
|
413
|
+
}), { data: g } = e({
|
|
414
414
|
queryKey: [
|
|
415
415
|
"device",
|
|
416
416
|
t,
|
|
@@ -422,46 +422,46 @@ function be({ deviceId: t }) {
|
|
|
422
422
|
}),
|
|
423
423
|
staleTime: 3e4,
|
|
424
424
|
retry: !1
|
|
425
|
-
}),
|
|
426
|
-
return /* @__PURE__ */
|
|
427
|
-
className:
|
|
425
|
+
}), _ = n(g, "detectionMode"), v = typeof _ == "string" ? _ : null, y = c?.phase ?? null, b = v, S = Number(c?.actualFps ?? 0), D = Number(c?.configuredFps ?? 0), k = Number(c?.avgInferenceTimeMs ?? 0), A = Number(c?.queueDepth ?? 0), M = Number(c?.droppedFrames ?? 0), N = O(y ?? "watching", i), P = d?.length ?? 0, F = f?.level.dbfs ?? null, I = typeof F == "number" ? `${F.toFixed(1)} dBFS` : "—", R = p?.enabled ?? !1, z = p?.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"), H = (h?.profiles ?? []).join(", "), U = p ? `${xe(p.storageBytes ?? 0)}${H ? ` · ${H}` : ""}` : void 0;
|
|
426
|
+
return /* @__PURE__ */ G("div", {
|
|
427
|
+
className: E,
|
|
428
428
|
children: [
|
|
429
|
-
/* @__PURE__ */
|
|
430
|
-
icon:
|
|
429
|
+
/* @__PURE__ */ W(m, {
|
|
430
|
+
icon: oe,
|
|
431
431
|
label: r("quickStats.phase"),
|
|
432
|
-
value:
|
|
433
|
-
valueClassName:
|
|
432
|
+
value: N.label,
|
|
433
|
+
valueClassName: N.textColor,
|
|
434
434
|
subtext: b ?? void 0
|
|
435
435
|
}),
|
|
436
|
-
/* @__PURE__ */
|
|
437
|
-
icon:
|
|
436
|
+
/* @__PURE__ */ W(m, {
|
|
437
|
+
icon: ue,
|
|
438
438
|
label: r("quickStats.detectionFps"),
|
|
439
439
|
value: `${S.toFixed(1)}`,
|
|
440
|
-
subtext:
|
|
440
|
+
subtext: D > 0 ? r("quickStats.target", { value: D }) : void 0
|
|
441
441
|
}),
|
|
442
|
-
/* @__PURE__ */
|
|
443
|
-
icon:
|
|
442
|
+
/* @__PURE__ */ W(m, {
|
|
443
|
+
icon: ce,
|
|
444
444
|
label: r("quickStats.inference"),
|
|
445
|
-
value: `${
|
|
446
|
-
subtext:
|
|
445
|
+
value: `${k.toFixed(1)} ms`,
|
|
446
|
+
subtext: A > 0 ? r("quickStats.queue", { value: A }) : void 0
|
|
447
447
|
}),
|
|
448
|
-
/* @__PURE__ */
|
|
449
|
-
icon:
|
|
448
|
+
/* @__PURE__ */ W(m, {
|
|
449
|
+
icon: le,
|
|
450
450
|
label: r("quickStats.activeTracks"),
|
|
451
|
-
value: String(
|
|
452
|
-
subtext:
|
|
451
|
+
value: String(P),
|
|
452
|
+
subtext: M > 0 ? r("quickStats.dropped", { value: M }) : void 0
|
|
453
453
|
}),
|
|
454
|
-
/* @__PURE__ */
|
|
455
|
-
icon:
|
|
454
|
+
/* @__PURE__ */ W(m, {
|
|
455
|
+
icon: ge,
|
|
456
456
|
label: r("quickStats.currentDb"),
|
|
457
|
-
value:
|
|
457
|
+
value: I
|
|
458
458
|
}),
|
|
459
|
-
/* @__PURE__ */
|
|
460
|
-
icon:
|
|
459
|
+
/* @__PURE__ */ W(m, {
|
|
460
|
+
icon: he,
|
|
461
461
|
label: r("quickStats.recording"),
|
|
462
|
-
value:
|
|
463
|
-
valueClassName:
|
|
464
|
-
subtext:
|
|
462
|
+
value: V,
|
|
463
|
+
valueClassName: B ? "text-success" : void 0,
|
|
464
|
+
subtext: U
|
|
465
465
|
})
|
|
466
466
|
]
|
|
467
467
|
});
|
|
@@ -485,58 +485,58 @@ var Se = {
|
|
|
485
485
|
};
|
|
486
486
|
function Ce({ zones: e, selectedZoneId: t, drawingKind: n, onSelectZone: r, onDeleteZone: i, onStartDraw: a, onCancelDraw: o }) {
|
|
487
487
|
let { t: s } = X();
|
|
488
|
-
return /* @__PURE__ */
|
|
488
|
+
return /* @__PURE__ */ G("div", {
|
|
489
489
|
className: "flex flex-col gap-2",
|
|
490
|
-
children: [/* @__PURE__ */
|
|
490
|
+
children: [/* @__PURE__ */ W("div", {
|
|
491
491
|
className: "flex items-center gap-1",
|
|
492
|
-
children: n ? /* @__PURE__ */
|
|
492
|
+
children: n ? /* @__PURE__ */ G(f, {
|
|
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__ */ W(_e, { className: "h-3.5 w-3.5" }), /* @__PURE__ */ W("span", { children: s("zoneList.cancel") })]
|
|
499
|
+
}) : /* @__PURE__ */ G(K, { children: [/* @__PURE__ */ W(f, {
|
|
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__ */ W(de, { className: "h-4 w-4" })
|
|
507
|
+
}), /* @__PURE__ */ W(f, {
|
|
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__ */ W(fe, { className: "h-5 w-5 stroke-[2.5]" })
|
|
515
515
|
})] })
|
|
516
|
-
}), e.length === 0 ? /* @__PURE__ */
|
|
516
|
+
}), e.length === 0 ? /* @__PURE__ */ W("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__ */ W("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__ */ G("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__ */ W("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__ */ W("span", {
|
|
532
532
|
className: "flex-1 truncate text-[11px] font-medium text-foreground",
|
|
533
533
|
children: e.name
|
|
534
534
|
}),
|
|
535
|
-
/* @__PURE__ */
|
|
535
|
+
/* @__PURE__ */ W("span", {
|
|
536
536
|
className: `inline-flex items-center rounded-full px-1.5 py-0.5 text-[9px] font-medium flex-shrink-0 ${Se[e.kind]}`,
|
|
537
537
|
children: e.kind === "tripwire" ? s("zone.kind.tripwire") : s("zone.kind.polygon")
|
|
538
538
|
}),
|
|
539
|
-
/* @__PURE__ */
|
|
539
|
+
/* @__PURE__ */ W(f, {
|
|
540
540
|
variant: "unstyled",
|
|
541
541
|
type: "button",
|
|
542
542
|
title: s("zoneList.deleteZone"),
|
|
@@ -544,7 +544,7 @@ function Ce({ 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__ */ W(Y, { className: "h-3 w-3" })
|
|
548
548
|
})
|
|
549
549
|
]
|
|
550
550
|
}, e.id);
|
|
@@ -565,23 +565,23 @@ var we = [
|
|
|
565
565
|
"#ec4899"
|
|
566
566
|
];
|
|
567
567
|
function Te({ zone: e, onSave: t, onDiscard: n, onDelete: r }) {
|
|
568
|
-
let { t: i } = X(), a =
|
|
569
|
-
return /* @__PURE__ */
|
|
568
|
+
let { t: i } = X(), a = F(), o = (e) => a?.updateDraft({ name: e }), s = (e) => a?.updateDraft({ color: e });
|
|
569
|
+
return /* @__PURE__ */ G("div", {
|
|
570
570
|
className: "flex flex-col gap-2",
|
|
571
571
|
children: [
|
|
572
|
-
/* @__PURE__ */
|
|
572
|
+
/* @__PURE__ */ G("div", {
|
|
573
573
|
className: "flex items-center justify-between",
|
|
574
|
-
children: [/* @__PURE__ */
|
|
574
|
+
children: [/* @__PURE__ */ W("h3", {
|
|
575
575
|
className: "text-[10px] font-semibold text-foreground-subtle uppercase tracking-wider",
|
|
576
576
|
children: i("zoneForm.editing")
|
|
577
|
-
}), /* @__PURE__ */
|
|
577
|
+
}), /* @__PURE__ */ W("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__ */ W(B, {
|
|
583
583
|
type: "text",
|
|
584
|
-
className:
|
|
584
|
+
className: b,
|
|
585
585
|
value: e.name,
|
|
586
586
|
autoFocus: !0,
|
|
587
587
|
onChange: (e) => o(e.target.value),
|
|
@@ -590,9 +590,9 @@ function Te({ zone: e, onSave: t, onDiscard: n, onDelete: r }) {
|
|
|
590
590
|
},
|
|
591
591
|
placeholder: i("zoneForm.namePlaceholder")
|
|
592
592
|
}),
|
|
593
|
-
/* @__PURE__ */
|
|
593
|
+
/* @__PURE__ */ W("div", {
|
|
594
594
|
className: "flex flex-wrap gap-1",
|
|
595
|
-
children: we.map((t) => /* @__PURE__ */
|
|
595
|
+
children: we.map((t) => /* @__PURE__ */ W(f, {
|
|
596
596
|
variant: "unstyled",
|
|
597
597
|
type: "button",
|
|
598
598
|
title: t,
|
|
@@ -601,49 +601,49 @@ function Te({ zone: e, onSave: t, onDiscard: n, onDelete: r }) {
|
|
|
601
601
|
onClick: () => s(t)
|
|
602
602
|
}, t))
|
|
603
603
|
}),
|
|
604
|
-
/* @__PURE__ */
|
|
604
|
+
/* @__PURE__ */ G("div", {
|
|
605
605
|
className: "flex items-center gap-1.5",
|
|
606
|
-
children: [/* @__PURE__ */
|
|
606
|
+
children: [/* @__PURE__ */ W(B, {
|
|
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__ */ W(B, {
|
|
612
612
|
type: "text",
|
|
613
|
-
className: `${
|
|
613
|
+
className: `${b} font-mono`,
|
|
614
614
|
value: e.color,
|
|
615
615
|
placeholder: "#000000",
|
|
616
616
|
onChange: (e) => s(e.target.value)
|
|
617
617
|
})]
|
|
618
618
|
}),
|
|
619
|
-
/* @__PURE__ */
|
|
619
|
+
/* @__PURE__ */ G("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__ */ G("div", {
|
|
624
624
|
className: "flex items-center gap-1.5",
|
|
625
|
-
children: [/* @__PURE__ */
|
|
625
|
+
children: [/* @__PURE__ */ G(f, {
|
|
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__ */ W(se, { className: "h-3 w-3" }), i("zoneForm.save")]
|
|
632
|
+
}), /* @__PURE__ */ G(f, {
|
|
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__ */ W(_e, { className: "h-3 w-3" }), i("zoneForm.discard")]
|
|
639
639
|
})]
|
|
640
640
|
}),
|
|
641
|
-
/* @__PURE__ */
|
|
641
|
+
/* @__PURE__ */ G(f, {
|
|
642
642
|
variant: "unstyled",
|
|
643
643
|
type: "button",
|
|
644
644
|
onClick: r,
|
|
645
|
-
className: `${
|
|
646
|
-
children: [/* @__PURE__ */
|
|
645
|
+
className: `${S} w-full`,
|
|
646
|
+
children: [/* @__PURE__ */ W(Y, { className: "h-3 w-3" }), i("zoneForm.delete")]
|
|
647
647
|
})
|
|
648
648
|
]
|
|
649
649
|
});
|
|
@@ -712,9 +712,9 @@ function Pe(e, t) {
|
|
|
712
712
|
};
|
|
713
713
|
}
|
|
714
714
|
function Fe({ on: e, label: t, hint: n, onToggle: r }) {
|
|
715
|
-
return /* @__PURE__ */
|
|
715
|
+
return /* @__PURE__ */ G("div", {
|
|
716
716
|
className: "flex items-center gap-1.5",
|
|
717
|
-
children: [/* @__PURE__ */
|
|
717
|
+
children: [/* @__PURE__ */ W("button", {
|
|
718
718
|
type: "button",
|
|
719
719
|
role: "switch",
|
|
720
720
|
"aria-checked": e,
|
|
@@ -722,20 +722,20 @@ function Fe({ on: e, label: t, hint: n, onToggle: r }) {
|
|
|
722
722
|
title: n,
|
|
723
723
|
onClick: r,
|
|
724
724
|
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(" "),
|
|
725
|
-
children: /* @__PURE__ */
|
|
726
|
-
}), /* @__PURE__ */
|
|
725
|
+
children: /* @__PURE__ */ W("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(" ") })
|
|
726
|
+
}), /* @__PURE__ */ W("span", {
|
|
727
727
|
className: "text-[10px] text-foreground leading-tight",
|
|
728
728
|
children: t
|
|
729
729
|
})]
|
|
730
730
|
});
|
|
731
731
|
}
|
|
732
732
|
function Q({ dev: e, deviceId: t, stage: n, zones: r, title: a }) {
|
|
733
|
-
let { t: o } = X(), s =
|
|
733
|
+
let { t: o } = X(), s = w(), l = P(e?.state.zoneRules), d = c(() => l?.[n] ?? [], [l, n]), [p, m] = u([]), [h, g] = u(!1), [_, y] = u(!1), [x, S] = u(null), C = Oe(n);
|
|
734
734
|
i(() => {
|
|
735
|
-
|
|
736
|
-
}, [d,
|
|
735
|
+
h || m(d.map(Ne));
|
|
736
|
+
}, [d, h]);
|
|
737
737
|
let T = () => {
|
|
738
|
-
|
|
738
|
+
m((e) => [...e, {
|
|
739
739
|
id: je(),
|
|
740
740
|
name: "",
|
|
741
741
|
zoneIds: r[0] ? [r[0].id] : [],
|
|
@@ -744,193 +744,193 @@ function Q({ dev: e, deviceId: t, stage: n, zones: r, title: a }) {
|
|
|
744
744
|
enabled: !0,
|
|
745
745
|
detectBySceneDifference: !1,
|
|
746
746
|
confirmWithLlm: !1
|
|
747
|
-
}]),
|
|
748
|
-
},
|
|
749
|
-
|
|
747
|
+
}]), g(!0);
|
|
748
|
+
}, E = (e, t) => {
|
|
749
|
+
m((n) => n.map((n, r) => {
|
|
750
750
|
if (r !== e) return n;
|
|
751
751
|
let i = n.classFilter.includes(t) ? n.classFilter.filter((e) => e !== t) : [...n.classFilter, t];
|
|
752
752
|
return {
|
|
753
753
|
...n,
|
|
754
754
|
classFilter: i
|
|
755
755
|
};
|
|
756
|
-
})),
|
|
757
|
-
},
|
|
758
|
-
|
|
756
|
+
})), g(!0);
|
|
757
|
+
}, D = (e, t) => {
|
|
758
|
+
m((n) => n.map((n, r) => {
|
|
759
759
|
if (r !== e) return n;
|
|
760
760
|
let i = n.zoneIds.includes(t) ? n.zoneIds.filter((e) => e !== t) : [...n.zoneIds, t];
|
|
761
761
|
return {
|
|
762
762
|
...n,
|
|
763
763
|
zoneIds: i
|
|
764
764
|
};
|
|
765
|
-
})),
|
|
766
|
-
},
|
|
767
|
-
|
|
768
|
-
},
|
|
769
|
-
|
|
765
|
+
})), g(!0);
|
|
766
|
+
}, O = (e) => {
|
|
767
|
+
m((t) => t.filter((t, n) => n !== e)), g(!0);
|
|
768
|
+
}, j = (e, t) => {
|
|
769
|
+
m((n) => n.map((n, r) => r === e ? {
|
|
770
770
|
...n,
|
|
771
771
|
...t
|
|
772
|
-
} : n)),
|
|
773
|
-
},
|
|
774
|
-
|
|
772
|
+
} : n)), g(!0);
|
|
773
|
+
}, M = async () => {
|
|
774
|
+
y(!0), S(null);
|
|
775
775
|
try {
|
|
776
776
|
await s.trpcClient.zoneRules.setRules.mutate({
|
|
777
777
|
deviceId: t,
|
|
778
778
|
stage: n,
|
|
779
779
|
rules: p.map((e) => Pe(e, n))
|
|
780
|
-
}),
|
|
780
|
+
}), g(!1);
|
|
781
781
|
} catch (e) {
|
|
782
|
-
|
|
782
|
+
S(e instanceof Error ? e.message : String(e));
|
|
783
783
|
} finally {
|
|
784
|
-
|
|
784
|
+
y(!1);
|
|
785
785
|
}
|
|
786
|
-
},
|
|
787
|
-
return /* @__PURE__ */
|
|
786
|
+
}, F = h && !_;
|
|
787
|
+
return /* @__PURE__ */ G("div", {
|
|
788
788
|
className: "rounded-md border border-border bg-surface/40 p-2.5",
|
|
789
789
|
children: [
|
|
790
|
-
/* @__PURE__ */
|
|
790
|
+
/* @__PURE__ */ G("div", {
|
|
791
791
|
className: "flex items-center justify-between mb-2 gap-2",
|
|
792
|
-
children: [/* @__PURE__ */
|
|
793
|
-
className: `${
|
|
792
|
+
children: [/* @__PURE__ */ W("h3", {
|
|
793
|
+
className: `${A} truncate`,
|
|
794
794
|
children: a ?? Ee(n)
|
|
795
|
-
}), /* @__PURE__ */
|
|
795
|
+
}), /* @__PURE__ */ G("div", {
|
|
796
796
|
className: "flex items-center gap-1 flex-shrink-0",
|
|
797
|
-
children: [/* @__PURE__ */
|
|
797
|
+
children: [/* @__PURE__ */ G(f, {
|
|
798
798
|
variant: "unstyled",
|
|
799
799
|
type: "button",
|
|
800
800
|
onClick: T,
|
|
801
801
|
disabled: r.length === 0 || !e,
|
|
802
|
-
className:
|
|
802
|
+
className: U,
|
|
803
803
|
title: o("rules.add"),
|
|
804
804
|
children: [
|
|
805
|
-
/* @__PURE__ */
|
|
805
|
+
/* @__PURE__ */ W(pe, { className: "h-2.5 w-2.5" }),
|
|
806
806
|
" ",
|
|
807
807
|
o("rules.addShort")
|
|
808
808
|
]
|
|
809
|
-
}), /* @__PURE__ */
|
|
809
|
+
}), /* @__PURE__ */ G(f, {
|
|
810
810
|
variant: "unstyled",
|
|
811
811
|
type: "button",
|
|
812
812
|
onClick: () => {
|
|
813
|
-
|
|
813
|
+
M();
|
|
814
814
|
},
|
|
815
|
-
disabled: !
|
|
816
|
-
className:
|
|
817
|
-
children: [/* @__PURE__ */
|
|
815
|
+
disabled: !F,
|
|
816
|
+
className: v,
|
|
817
|
+
children: [/* @__PURE__ */ W(me, { className: "h-2.5 w-2.5" }), _ ? "…" : o("rules.save")]
|
|
818
818
|
})]
|
|
819
819
|
})]
|
|
820
820
|
}),
|
|
821
|
-
p.length === 0 ? /* @__PURE__ */
|
|
821
|
+
p.length === 0 ? /* @__PURE__ */ W("p", {
|
|
822
822
|
className: "text-[10px] text-foreground-subtle italic px-1 py-1.5 leading-tight",
|
|
823
823
|
children: r.length === 0 ? o("rules.noZones") : o("rules.empty")
|
|
824
|
-
}) : /* @__PURE__ */
|
|
824
|
+
}) : /* @__PURE__ */ W("div", {
|
|
825
825
|
className: "flex flex-col gap-1.5",
|
|
826
|
-
children: p.map((e, t) => /* @__PURE__ */
|
|
826
|
+
children: p.map((e, t) => /* @__PURE__ */ G("div", {
|
|
827
827
|
className: "rounded border border-border/50 bg-background/40 px-2 py-1.5 flex flex-col gap-1.5 overflow-hidden",
|
|
828
828
|
children: [
|
|
829
|
-
/* @__PURE__ */
|
|
829
|
+
/* @__PURE__ */ G("div", {
|
|
830
830
|
className: "grid grid-cols-[auto_1fr_auto] items-center gap-1.5",
|
|
831
831
|
children: [
|
|
832
|
-
/* @__PURE__ */
|
|
832
|
+
/* @__PURE__ */ W(f, {
|
|
833
833
|
variant: "unstyled",
|
|
834
834
|
type: "button",
|
|
835
835
|
role: "switch",
|
|
836
836
|
"aria-checked": e.enabled,
|
|
837
837
|
"aria-label": e.enabled ? o("rules.disable") : o("rules.enable"),
|
|
838
838
|
title: e.enabled ? o("rules.activeTitle") : o("rules.disabledTitle"),
|
|
839
|
-
onClick: () =>
|
|
839
|
+
onClick: () => j(t, { enabled: !e.enabled }),
|
|
840
840
|
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(" "),
|
|
841
|
-
children: /* @__PURE__ */
|
|
841
|
+
children: /* @__PURE__ */ W("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(" ") })
|
|
842
842
|
}),
|
|
843
|
-
/* @__PURE__ */
|
|
844
|
-
className: `${
|
|
843
|
+
/* @__PURE__ */ W(B, {
|
|
844
|
+
className: `${b} min-w-0`,
|
|
845
845
|
placeholder: o("rules.namePlaceholder"),
|
|
846
846
|
value: e.name,
|
|
847
|
-
onChange: (e) =>
|
|
847
|
+
onChange: (e) => j(t, { name: e.target.value })
|
|
848
848
|
}),
|
|
849
|
-
/* @__PURE__ */
|
|
849
|
+
/* @__PURE__ */ W(f, {
|
|
850
850
|
variant: "unstyled",
|
|
851
851
|
type: "button",
|
|
852
852
|
title: o("rules.remove"),
|
|
853
853
|
"aria-label": o("rules.remove"),
|
|
854
|
-
onClick: () =>
|
|
854
|
+
onClick: () => O(t),
|
|
855
855
|
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",
|
|
856
|
-
children: /* @__PURE__ */
|
|
856
|
+
children: /* @__PURE__ */ W(Y, { className: "h-3.5 w-3.5" })
|
|
857
857
|
})
|
|
858
858
|
]
|
|
859
859
|
}),
|
|
860
|
-
/* @__PURE__ */
|
|
860
|
+
/* @__PURE__ */ G("div", {
|
|
861
861
|
className: "flex items-center gap-1.5 flex-wrap",
|
|
862
862
|
children: [
|
|
863
|
-
/* @__PURE__ */
|
|
863
|
+
/* @__PURE__ */ W("span", {
|
|
864
864
|
className: "text-[9px] uppercase tracking-wider text-foreground-subtle w-12 sm:w-14 flex-shrink-0",
|
|
865
865
|
children: o("rules.mode")
|
|
866
866
|
}),
|
|
867
|
-
/* @__PURE__ */
|
|
867
|
+
/* @__PURE__ */ W(f, {
|
|
868
868
|
variant: "unstyled",
|
|
869
869
|
type: "button",
|
|
870
|
-
onClick: () =>
|
|
871
|
-
className: `${
|
|
870
|
+
onClick: () => j(t, { mode: "include" }),
|
|
871
|
+
className: `${R} ${e.mode === "include" ? k : N}`,
|
|
872
872
|
children: o("rules.include")
|
|
873
873
|
}),
|
|
874
|
-
/* @__PURE__ */
|
|
874
|
+
/* @__PURE__ */ W(f, {
|
|
875
875
|
variant: "unstyled",
|
|
876
876
|
type: "button",
|
|
877
|
-
onClick: () =>
|
|
878
|
-
className: `${
|
|
877
|
+
onClick: () => j(t, { mode: "exclude" }),
|
|
878
|
+
className: `${R} ${e.mode === "exclude" ? k : N}`,
|
|
879
879
|
children: o("rules.exclude")
|
|
880
880
|
})
|
|
881
881
|
]
|
|
882
882
|
}),
|
|
883
|
-
/* @__PURE__ */
|
|
883
|
+
/* @__PURE__ */ G("div", {
|
|
884
884
|
className: "flex items-center gap-1.5 flex-wrap",
|
|
885
|
-
children: [/* @__PURE__ */
|
|
885
|
+
children: [/* @__PURE__ */ W("span", {
|
|
886
886
|
className: "text-[9px] uppercase tracking-wider text-foreground-subtle w-12 sm:w-14 flex-shrink-0",
|
|
887
887
|
children: o("rules.zones")
|
|
888
|
-
}), r.length === 0 ? /* @__PURE__ */
|
|
888
|
+
}), r.length === 0 ? /* @__PURE__ */ W("span", {
|
|
889
889
|
className: "text-[10px] text-foreground-subtle italic",
|
|
890
890
|
children: o("rules.noneZones")
|
|
891
|
-
}) : r.map((n) => /* @__PURE__ */
|
|
891
|
+
}) : r.map((n) => /* @__PURE__ */ G(f, {
|
|
892
892
|
variant: "unstyled",
|
|
893
893
|
type: "button",
|
|
894
|
-
onClick: () =>
|
|
895
|
-
className: `${
|
|
896
|
-
children: [/* @__PURE__ */
|
|
894
|
+
onClick: () => D(t, n.id),
|
|
895
|
+
className: `${R} ${e.zoneIds.includes(n.id) ? k : N}`,
|
|
896
|
+
children: [/* @__PURE__ */ W("span", {
|
|
897
897
|
className: "h-2 w-2 rounded-sm",
|
|
898
898
|
style: { backgroundColor: n.color || "#3b82f6" }
|
|
899
|
-
}), /* @__PURE__ */
|
|
899
|
+
}), /* @__PURE__ */ W("span", {
|
|
900
900
|
className: "truncate max-w-[7rem]",
|
|
901
901
|
children: n.name || n.id
|
|
902
902
|
})]
|
|
903
903
|
}, n.id))]
|
|
904
904
|
}),
|
|
905
|
-
n === "package" && /* @__PURE__ */
|
|
905
|
+
n === "package" && /* @__PURE__ */ G("div", {
|
|
906
906
|
className: "flex flex-col gap-1",
|
|
907
|
-
children: [/* @__PURE__ */
|
|
907
|
+
children: [/* @__PURE__ */ W(Fe, {
|
|
908
908
|
on: e.detectBySceneDifference,
|
|
909
909
|
label: o("rules.sceneDifference"),
|
|
910
910
|
hint: o("rules.sceneDifferenceHint"),
|
|
911
|
-
onToggle: () =>
|
|
912
|
-
}), /* @__PURE__ */
|
|
911
|
+
onToggle: () => j(t, { detectBySceneDifference: !e.detectBySceneDifference })
|
|
912
|
+
}), /* @__PURE__ */ W(Fe, {
|
|
913
913
|
on: e.confirmWithLlm,
|
|
914
914
|
label: o("rules.confirmLlm"),
|
|
915
915
|
hint: o("rules.confirmLlmHint"),
|
|
916
|
-
onToggle: () =>
|
|
916
|
+
onToggle: () => j(t, { confirmWithLlm: !e.confirmWithLlm })
|
|
917
917
|
})]
|
|
918
918
|
}),
|
|
919
|
-
|
|
919
|
+
C && /* @__PURE__ */ G("div", {
|
|
920
920
|
className: "flex items-center gap-1.5 flex-wrap",
|
|
921
921
|
children: [
|
|
922
|
-
/* @__PURE__ */
|
|
922
|
+
/* @__PURE__ */ W("span", {
|
|
923
923
|
className: "text-[9px] uppercase tracking-wider text-foreground-subtle w-12 sm:w-14 flex-shrink-0",
|
|
924
924
|
children: o("rules.class")
|
|
925
925
|
}),
|
|
926
|
-
Me.map((n) => /* @__PURE__ */
|
|
926
|
+
Me.map((n) => /* @__PURE__ */ W(f, {
|
|
927
927
|
variant: "unstyled",
|
|
928
928
|
type: "button",
|
|
929
|
-
onClick: () =>
|
|
930
|
-
className: `${
|
|
929
|
+
onClick: () => E(t, n.id),
|
|
930
|
+
className: `${R} ${e.classFilter.includes(n.id) ? k : N}`,
|
|
931
931
|
children: n.label
|
|
932
932
|
}, n.id)),
|
|
933
|
-
e.classFilter.length === 0 && /* @__PURE__ */
|
|
933
|
+
e.classFilter.length === 0 && /* @__PURE__ */ W("span", {
|
|
934
934
|
className: "text-[10px] text-foreground-subtle italic ml-1",
|
|
935
935
|
children: o("rules.anyClass")
|
|
936
936
|
})
|
|
@@ -939,9 +939,9 @@ function Q({ dev: e, deviceId: t, stage: n, zones: r, title: a }) {
|
|
|
939
939
|
]
|
|
940
940
|
}, e.id))
|
|
941
941
|
}),
|
|
942
|
-
|
|
942
|
+
x && /* @__PURE__ */ W("p", {
|
|
943
943
|
className: "mt-2 text-[10px] text-danger",
|
|
944
|
-
children:
|
|
944
|
+
children: x
|
|
945
945
|
})
|
|
946
946
|
]
|
|
947
947
|
});
|
|
@@ -975,13 +975,13 @@ function Re(e) {
|
|
|
975
975
|
};
|
|
976
976
|
}
|
|
977
977
|
function ze({ deviceId: e }) {
|
|
978
|
-
let t =
|
|
978
|
+
let t = w(), n = P(x(t.trpcClient, e)?.state.zones), r = c(() => n?.zones ?? [], [n]), i = F(), s = i?.drawingKind ?? null, l = i?.selectedZoneId ?? null, d = i?.editingDraft ?? null, f = c(() => r.map((e) => d && d.id === e.id ? {
|
|
979
979
|
id: d.id,
|
|
980
980
|
name: d.name,
|
|
981
981
|
kind: d.kind,
|
|
982
982
|
color: d.color,
|
|
983
983
|
points: [...d.points]
|
|
984
|
-
} : g(e)), [r, d]), p = c(() => f.map(
|
|
984
|
+
} : g(e)), [r, d]), p = c(() => f.map(M), [f]), [m, h] = u(null), _ = o(async (n) => {
|
|
985
985
|
if (n.kind !== "polygon" && n.kind !== "line") return;
|
|
986
986
|
let r = {
|
|
987
987
|
id: je(),
|
|
@@ -1059,9 +1059,9 @@ function ze({ deviceId: e }) {
|
|
|
1059
1059
|
points: t.points
|
|
1060
1060
|
});
|
|
1061
1061
|
}, [f, i]);
|
|
1062
|
-
return f.length === 0 && s === null && m === null ? null : /* @__PURE__ */
|
|
1062
|
+
return f.length === 0 && s === null && m === null ? null : /* @__PURE__ */ G(a, {
|
|
1063
1063
|
fallback: null,
|
|
1064
|
-
children: [/* @__PURE__ */ H
|
|
1064
|
+
children: [/* @__PURE__ */ W(H, {
|
|
1065
1065
|
transparent: !0,
|
|
1066
1066
|
items: p,
|
|
1067
1067
|
supportedShapes: Ie,
|
|
@@ -1072,7 +1072,7 @@ function ze({ deviceId: e }) {
|
|
|
1072
1072
|
_(e);
|
|
1073
1073
|
},
|
|
1074
1074
|
drawingKind: s === null ? null : Ae(s)
|
|
1075
|
-
}), m !== null && /* @__PURE__ */
|
|
1075
|
+
}), m !== null && /* @__PURE__ */ W("p", {
|
|
1076
1076
|
role: "alert",
|
|
1077
1077
|
className: "absolute inset-x-2 bottom-2 rounded-md border border-danger/40 bg-background-elevated px-2 py-1 text-xs text-danger",
|
|
1078
1078
|
children: m
|
|
@@ -1099,12 +1099,12 @@ function Ue(e) {
|
|
|
1099
1099
|
};
|
|
1100
1100
|
}
|
|
1101
1101
|
function We({ deviceId: e }) {
|
|
1102
|
-
let { t } = X(), n =
|
|
1103
|
-
|
|
1102
|
+
let { t } = X(), n = w(), r = x(n.trpcClient, e), i = P(r?.state.zones), a = c(() => i?.zones ?? [], [i]), s = c(() => a.map(He), [a]), [l, d] = u(null), f = F(), m = f?.drawingKind ?? null, g = f?.selectedZoneId ?? null, v = f?.editingDraft ?? null;
|
|
1103
|
+
z(c(() => ({
|
|
1104
1104
|
id: "zones",
|
|
1105
1105
|
order: 100,
|
|
1106
1106
|
placement: "image",
|
|
1107
|
-
node: /* @__PURE__ */
|
|
1107
|
+
node: /* @__PURE__ */ W(Be, { deviceId: e })
|
|
1108
1108
|
}), [e]));
|
|
1109
1109
|
let b = o((e) => {
|
|
1110
1110
|
if (e === null) {
|
|
@@ -1119,7 +1119,7 @@ function We({ deviceId: e }) {
|
|
|
1119
1119
|
color: t.color,
|
|
1120
1120
|
points: t.points
|
|
1121
1121
|
});
|
|
1122
|
-
}, [s, f]),
|
|
1122
|
+
}, [s, f]), S = o(async () => {
|
|
1123
1123
|
let t = f?.editingDraft;
|
|
1124
1124
|
if (t) {
|
|
1125
1125
|
try {
|
|
@@ -1142,7 +1142,7 @@ function We({ deviceId: e }) {
|
|
|
1142
1142
|
n,
|
|
1143
1143
|
e,
|
|
1144
1144
|
f
|
|
1145
|
-
]),
|
|
1145
|
+
]), C = o(() => {
|
|
1146
1146
|
f?.discardDraft(), f?.setSelectedZoneId(null);
|
|
1147
1147
|
}, [f]), T = o(async (t) => {
|
|
1148
1148
|
try {
|
|
@@ -1160,75 +1160,75 @@ function We({ deviceId: e }) {
|
|
|
1160
1160
|
f
|
|
1161
1161
|
]), E = o((e) => {
|
|
1162
1162
|
f?.startDrawing(e);
|
|
1163
|
-
}, [f]),
|
|
1163
|
+
}, [f]), O = o(() => {
|
|
1164
1164
|
f?.setDrawingKind(null);
|
|
1165
|
-
}, [f]), k = c(() => !
|
|
1166
|
-
id:
|
|
1167
|
-
kind:
|
|
1168
|
-
name:
|
|
1169
|
-
color:
|
|
1170
|
-
points: [...
|
|
1171
|
-
}, [s,
|
|
1172
|
-
return /* @__PURE__ */
|
|
1173
|
-
className:
|
|
1174
|
-
children: [/* @__PURE__ */
|
|
1175
|
-
className:
|
|
1176
|
-
children: [/* @__PURE__ */
|
|
1177
|
-
className:
|
|
1178
|
-
children: /* @__PURE__ */
|
|
1165
|
+
}, [f]), k = c(() => !v || !s.find((e) => e.id === v.id) ? null : {
|
|
1166
|
+
id: v.id,
|
|
1167
|
+
kind: v.kind,
|
|
1168
|
+
name: v.name,
|
|
1169
|
+
color: v.color,
|
|
1170
|
+
points: [...v.points]
|
|
1171
|
+
}, [s, v]);
|
|
1172
|
+
return /* @__PURE__ */ G("div", {
|
|
1173
|
+
className: h,
|
|
1174
|
+
children: [/* @__PURE__ */ G("div", {
|
|
1175
|
+
className: V,
|
|
1176
|
+
children: [/* @__PURE__ */ W("div", {
|
|
1177
|
+
className: y,
|
|
1178
|
+
children: /* @__PURE__ */ G("div", {
|
|
1179
1179
|
className: "min-w-0",
|
|
1180
|
-
children: [/* @__PURE__ */
|
|
1181
|
-
className:
|
|
1180
|
+
children: [/* @__PURE__ */ W("h2", {
|
|
1181
|
+
className: A,
|
|
1182
1182
|
children: t("zonesTab.title")
|
|
1183
|
-
}), /* @__PURE__ */
|
|
1184
|
-
className: `${
|
|
1185
|
-
children: /* @__PURE__ */
|
|
1183
|
+
}), /* @__PURE__ */ W("p", {
|
|
1184
|
+
className: `${_} mt-0.5 leading-tight`,
|
|
1185
|
+
children: /* @__PURE__ */ W(ve, {
|
|
1186
1186
|
i18nKey: "zonesTab.hint",
|
|
1187
|
-
components: { b: /* @__PURE__ */
|
|
1187
|
+
components: { b: /* @__PURE__ */ W("strong", { className: "text-foreground" }) }
|
|
1188
1188
|
})
|
|
1189
1189
|
})]
|
|
1190
1190
|
})
|
|
1191
|
-
}), /* @__PURE__ */
|
|
1192
|
-
className: `${
|
|
1191
|
+
}), /* @__PURE__ */ G("div", {
|
|
1192
|
+
className: `${p} flex flex-col gap-3`,
|
|
1193
1193
|
children: [
|
|
1194
|
-
/* @__PURE__ */
|
|
1194
|
+
/* @__PURE__ */ W(Ce, {
|
|
1195
1195
|
zones: s,
|
|
1196
|
-
selectedZoneId:
|
|
1197
|
-
drawingKind:
|
|
1196
|
+
selectedZoneId: g,
|
|
1197
|
+
drawingKind: m,
|
|
1198
1198
|
onSelectZone: b,
|
|
1199
1199
|
onDeleteZone: T,
|
|
1200
1200
|
onStartDraw: E,
|
|
1201
|
-
onCancelDraw:
|
|
1201
|
+
onCancelDraw: O
|
|
1202
1202
|
}),
|
|
1203
|
-
l !== null && /* @__PURE__ */
|
|
1203
|
+
l !== null && /* @__PURE__ */ W("p", {
|
|
1204
1204
|
role: "alert",
|
|
1205
1205
|
className: "text-xs text-danger",
|
|
1206
1206
|
children: l
|
|
1207
1207
|
}),
|
|
1208
|
-
k && /* @__PURE__ */
|
|
1208
|
+
k && /* @__PURE__ */ G(K, { children: [/* @__PURE__ */ W("div", { className: "border-t border-border" }), /* @__PURE__ */ W(Te, {
|
|
1209
1209
|
zone: k,
|
|
1210
|
-
onSave:
|
|
1211
|
-
onDiscard:
|
|
1210
|
+
onSave: S,
|
|
1211
|
+
onDiscard: C,
|
|
1212
1212
|
onDelete: () => T(k.id)
|
|
1213
1213
|
})] })
|
|
1214
1214
|
]
|
|
1215
1215
|
})]
|
|
1216
|
-
}), /* @__PURE__ */
|
|
1217
|
-
className: `grid grid-cols-1 2xl:grid-cols-2 ${
|
|
1216
|
+
}), /* @__PURE__ */ G("div", {
|
|
1217
|
+
className: `grid grid-cols-1 2xl:grid-cols-2 ${D}`,
|
|
1218
1218
|
children: [
|
|
1219
|
-
/* @__PURE__ */
|
|
1219
|
+
/* @__PURE__ */ W(Q, {
|
|
1220
1220
|
dev: r,
|
|
1221
1221
|
deviceId: e,
|
|
1222
1222
|
stage: "motion",
|
|
1223
1223
|
zones: a
|
|
1224
1224
|
}),
|
|
1225
|
-
/* @__PURE__ */
|
|
1225
|
+
/* @__PURE__ */ W(Q, {
|
|
1226
1226
|
dev: r,
|
|
1227
1227
|
deviceId: e,
|
|
1228
1228
|
stage: "detection",
|
|
1229
1229
|
zones: a
|
|
1230
1230
|
}),
|
|
1231
|
-
/* @__PURE__ */
|
|
1231
|
+
/* @__PURE__ */ W(Q, {
|
|
1232
1232
|
dev: r,
|
|
1233
1233
|
deviceId: e,
|
|
1234
1234
|
stage: "package",
|
|
@@ -1242,10 +1242,10 @@ function We({ deviceId: e }) {
|
|
|
1242
1242
|
//#region src/widgets/ZoneEditor.tsx
|
|
1243
1243
|
function Ge(e) {
|
|
1244
1244
|
let { t } = X();
|
|
1245
|
-
return e.deviceId === void 0 ? /* @__PURE__ */
|
|
1245
|
+
return e.deviceId === void 0 ? /* @__PURE__ */ W("div", {
|
|
1246
1246
|
className: "rounded-lg border border-warning/30 bg-warning/10 px-3 py-2 text-xs text-warning",
|
|
1247
1247
|
children: t("zoneEditor.requiresDevice")
|
|
1248
|
-
}) : /* @__PURE__ */
|
|
1248
|
+
}) : /* @__PURE__ */ W(We, { deviceId: e.deviceId });
|
|
1249
1249
|
}
|
|
1250
1250
|
//#endregion
|
|
1251
1251
|
//#region src/widgets/index.tsx
|