@camstack/addon-pipeline-orchestrator 1.2.305 → 1.2.307
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/_stub.js +231 -256
- package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-Qp373r5j.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-CZLvY1zc.mjs} +2 -2
- package/dist/{_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-CKdeRNKv.mjs → _virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-7VlhjGC0.mjs} +1 -1
- package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-DkIDoSSe.mjs +26 -0
- package/dist/{hostInit-BIX23iiw.mjs → hostInit-E8avk1A0.mjs} +2 -2
- package/dist/index.js +72 -8
- package/dist/index.mjs +72 -8
- package/dist/remoteEntry.js +1 -1
- package/package.json +1 -1
- package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-BME8XtGw.mjs +0 -26
package/dist/_stub.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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-7VlhjGC0.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 { C as f,
|
|
5
|
-
import { n as
|
|
4
|
+
import { C as f, E as p, S as m, T as h, _ as g, a as _, b as v, c as y, d as b, f as x, g as S, h as C, i as w, l as T, m as E, n as D, o as O, p as k, r as A, s as j, t as ee, u as M, v as N, w as P, x as F, y as I } from "./_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-DkIDoSSe.mjs";
|
|
5
|
+
import { n as L, r as R, t as z } 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
|
|
7
|
+
var B = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), V = (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()), H = (e) => {
|
|
8
8
|
let t = te(e);
|
|
9
9
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
10
10
|
}, ne = {
|
|
@@ -27,24 +27,24 @@ var R = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
27
27
|
height: t,
|
|
28
28
|
stroke: e,
|
|
29
29
|
strokeWidth: r ? Number(n) * 24 / Number(t) : n,
|
|
30
|
-
className:
|
|
30
|
+
className: B("lucide", i),
|
|
31
31
|
...!a && !re(s) && { "aria-hidden": "true" },
|
|
32
32
|
...s
|
|
33
|
-
}, [...o.map(([e, t]) => d(e, t)), ...Array.isArray(a) ? a : [a]])),
|
|
33
|
+
}, [...o.map(([e, t]) => d(e, t)), ...Array.isArray(a) ? a : [a]])), U = (e, t) => {
|
|
34
34
|
let n = s(({ className: n, ...r }, i) => d(ie, {
|
|
35
35
|
ref: i,
|
|
36
36
|
iconNode: t,
|
|
37
|
-
className:
|
|
37
|
+
className: B(`lucide-${V(H(e))}`, `lucide-${e}`, n),
|
|
38
38
|
...r
|
|
39
39
|
}));
|
|
40
|
-
return n.displayName =
|
|
41
|
-
}, ae =
|
|
40
|
+
return n.displayName = H(e), n;
|
|
41
|
+
}, ae = U("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
|
-
}]]), oe =
|
|
44
|
+
}]]), oe = U("check", [["path", {
|
|
45
45
|
d: "M20 6 9 17l-5-5",
|
|
46
46
|
key: "1gmf2c"
|
|
47
|
-
}]]),
|
|
47
|
+
}]]), W = U("cpu", [
|
|
48
48
|
["path", {
|
|
49
49
|
d: "M12 20v2",
|
|
50
50
|
key: "1lh1kg"
|
|
@@ -109,7 +109,7 @@ var R = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
109
109
|
rx: "1",
|
|
110
110
|
key: "z9xiuo"
|
|
111
111
|
}]
|
|
112
|
-
]),
|
|
112
|
+
]), G = U("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 R = (...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
|
+
}]]), K = U("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
|
+
}]]), q = U("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
|
+
}]]), se = U("minus", [["path", {
|
|
130
130
|
d: "M5 12h14",
|
|
131
131
|
key: "1ays0h"
|
|
132
|
-
}]]),
|
|
132
|
+
}]]), ce = U("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
|
+
}]]), le = U("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 R = (...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 = U("trash-2", [
|
|
152
152
|
["path", {
|
|
153
153
|
d: "M10 11v6",
|
|
154
154
|
key: "nco0om"
|
|
@@ -169,7 +169,7 @@ var R = (...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
|
+
]), ue = U("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 R = (...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
|
+
}]]), de = U("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,7 +192,7 @@ var R = (...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 = U("x", [["path", {
|
|
196
196
|
d: "M18 6 6 18",
|
|
197
197
|
key: "1bl5f8"
|
|
198
198
|
}], ["path", {
|
|
@@ -201,25 +201,25 @@ var R = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
201
201
|
}]]);
|
|
202
202
|
//#endregion
|
|
203
203
|
//#region src/widgets/PipelineQuickStats.tsx
|
|
204
|
-
function
|
|
205
|
-
return e.deviceId === void 0 ? /* @__PURE__ */
|
|
204
|
+
function fe(e) {
|
|
205
|
+
return e.deviceId === void 0 ? /* @__PURE__ */ L("div", {
|
|
206
206
|
className: "rounded-lg border border-warning/30 bg-warning/10 px-3 py-2 text-xs text-warning",
|
|
207
207
|
children: "PipelineQuickStats requires a deviceId"
|
|
208
|
-
}) : /* @__PURE__ */
|
|
208
|
+
}) : /* @__PURE__ */ L(pe, { deviceId: e.deviceId });
|
|
209
209
|
}
|
|
210
|
-
function
|
|
211
|
-
|
|
210
|
+
function pe({ deviceId: n }) {
|
|
211
|
+
p(["pipelineOrchestrator", "getPipelineAssignment"], [
|
|
212
212
|
"pipeline.camera-assigned",
|
|
213
213
|
"pipeline.camera-unassigned",
|
|
214
214
|
"pipeline.camera-updated"
|
|
215
|
-
]),
|
|
216
|
-
let { data: r } =
|
|
215
|
+
]), p(["pipelineRunner", "getCameraMetrics"], ["pipeline.camera-metrics-snapshot"]);
|
|
216
|
+
let { data: r } = ee({ deviceId: n }, { staleTime: 3e4 }), i = r?.agentNodeId ?? null, a = typeof i == "string" && i.length > 0 && !i.startsWith("addon:") ? i : void 0, { data: o } = w({
|
|
217
217
|
deviceId: n,
|
|
218
218
|
...a ? { nodeId: a } : {}
|
|
219
219
|
}, {
|
|
220
220
|
staleTime: 2e3,
|
|
221
221
|
retry: !1
|
|
222
|
-
}), s =
|
|
222
|
+
}), s = M(), c = P(s.trpcClient, n), { data: l } = e({
|
|
223
223
|
queryKey: [
|
|
224
224
|
"device",
|
|
225
225
|
n,
|
|
@@ -244,12 +244,12 @@ function fe({ deviceId: n }) {
|
|
|
244
244
|
queryFn: async () => await s.trpcClient.recordingArchive.getStatus.query({ deviceId: n }),
|
|
245
245
|
refetchInterval: 5e3,
|
|
246
246
|
retry: !1
|
|
247
|
-
}), { data:
|
|
247
|
+
}), { data: m } = e({
|
|
248
248
|
queryKey: ["recordingArchive.getDeviceConfig", n],
|
|
249
249
|
queryFn: async () => await s.trpcClient.recordingArchive.getDeviceConfig.query({ deviceId: n }),
|
|
250
250
|
staleTime: 3e4,
|
|
251
251
|
retry: !1
|
|
252
|
-
}), { data:
|
|
252
|
+
}), { data: h } = e({
|
|
253
253
|
queryKey: [
|
|
254
254
|
"device",
|
|
255
255
|
n,
|
|
@@ -261,51 +261,51 @@ function fe({ deviceId: n }) {
|
|
|
261
261
|
}),
|
|
262
262
|
staleTime: 3e4,
|
|
263
263
|
retry: !1
|
|
264
|
-
}),
|
|
265
|
-
return /* @__PURE__ */
|
|
266
|
-
className:
|
|
264
|
+
}), g = t(h, "detectionMode"), v = typeof g == "string" ? g : null, y = o?.phase ?? null, b = v, x = Number(o?.actualFps ?? 0), S = Number(o?.configuredFps ?? 0), C = Number(o?.avgInferenceTimeMs ?? 0), T = Number(o?.queueDepth ?? 0), E = Number(o?.droppedFrames ?? 0), D = f(y ?? "watching"), O = l?.length ?? 0, k = u?.level.dbfs ?? null, A = typeof k == "number" ? `${k.toFixed(1)} dBFS` : "—", j = d?.enabled ?? !1, N = d?.activeMode ?? "off", F = j && N !== "off", z = j ? N === "off" ? "Idle" : N === "continuous" ? "Continuous" : N === "onMotion" ? "On motion" : N === "onAudioThreshold" ? "On audio" : N : "Disabled", B = (m?.profiles ?? []).join(", "), V = d ? `${me(d.storageBytes ?? 0)}${B ? ` · ${B}` : ""}` : void 0;
|
|
265
|
+
return /* @__PURE__ */ R("div", {
|
|
266
|
+
className: _,
|
|
267
267
|
children: [
|
|
268
|
-
/* @__PURE__ */
|
|
268
|
+
/* @__PURE__ */ L(I, {
|
|
269
269
|
icon: ae,
|
|
270
270
|
label: "Phase",
|
|
271
|
-
value:
|
|
272
|
-
|
|
273
|
-
subtext:
|
|
271
|
+
value: D.label,
|
|
272
|
+
valueClassName: D.textColor,
|
|
273
|
+
subtext: b ?? void 0
|
|
274
274
|
}),
|
|
275
|
-
/* @__PURE__ */
|
|
276
|
-
icon:
|
|
275
|
+
/* @__PURE__ */ L(I, {
|
|
276
|
+
icon: K,
|
|
277
277
|
label: "Detection FPS",
|
|
278
|
-
value: `${
|
|
279
|
-
subtext:
|
|
278
|
+
value: `${x.toFixed(1)}`,
|
|
279
|
+
subtext: S > 0 ? `target: ${S}` : void 0
|
|
280
280
|
}),
|
|
281
|
-
/* @__PURE__ */
|
|
282
|
-
icon:
|
|
281
|
+
/* @__PURE__ */ L(I, {
|
|
282
|
+
icon: W,
|
|
283
283
|
label: "Inference",
|
|
284
|
-
value: `${
|
|
285
|
-
subtext:
|
|
284
|
+
value: `${C.toFixed(1)} ms`,
|
|
285
|
+
subtext: T > 0 ? `queue: ${T}` : void 0
|
|
286
286
|
}),
|
|
287
|
-
/* @__PURE__ */
|
|
288
|
-
icon:
|
|
287
|
+
/* @__PURE__ */ L(I, {
|
|
288
|
+
icon: G,
|
|
289
289
|
label: "Active Tracks",
|
|
290
|
-
value: String(
|
|
291
|
-
subtext:
|
|
290
|
+
value: String(O),
|
|
291
|
+
subtext: E > 0 ? `dropped: ${E}` : void 0
|
|
292
292
|
}),
|
|
293
|
-
/* @__PURE__ */
|
|
294
|
-
icon:
|
|
293
|
+
/* @__PURE__ */ L(I, {
|
|
294
|
+
icon: de,
|
|
295
295
|
label: "Current dB",
|
|
296
|
-
value:
|
|
296
|
+
value: A
|
|
297
297
|
}),
|
|
298
|
-
/* @__PURE__ */
|
|
299
|
-
icon:
|
|
298
|
+
/* @__PURE__ */ L(I, {
|
|
299
|
+
icon: ue,
|
|
300
300
|
label: "Recording",
|
|
301
|
-
value:
|
|
302
|
-
|
|
303
|
-
subtext:
|
|
301
|
+
value: z,
|
|
302
|
+
valueClassName: F ? "text-success" : void 0,
|
|
303
|
+
subtext: V
|
|
304
304
|
})
|
|
305
305
|
]
|
|
306
306
|
});
|
|
307
307
|
}
|
|
308
|
-
function
|
|
308
|
+
function me(e) {
|
|
309
309
|
if (!Number.isFinite(e) || e <= 0) return "0 B";
|
|
310
310
|
let t = [
|
|
311
311
|
"B",
|
|
@@ -316,97 +316,72 @@ function pe(e) {
|
|
|
316
316
|
], n = Math.min(t.length - 1, Math.floor(Math.log(e) / Math.log(1024))), r = e / 1024 ** n;
|
|
317
317
|
return `${n === 0 ? Math.round(r) : r.toFixed(1)} ${t[n]}`;
|
|
318
318
|
}
|
|
319
|
-
function Y({ icon: e, label: t, value: n, subtext: r, color: i }) {
|
|
320
|
-
return /* @__PURE__ */ I("div", {
|
|
321
|
-
className: "rounded-lg border border-border bg-surface p-3 min-w-0",
|
|
322
|
-
children: [
|
|
323
|
-
/* @__PURE__ */ I("div", {
|
|
324
|
-
className: "flex items-center gap-1.5 mb-1 min-w-0",
|
|
325
|
-
children: [/* @__PURE__ */ F(e, { className: "h-3.5 w-3.5 text-foreground-subtle flex-shrink-0" }), /* @__PURE__ */ F("span", {
|
|
326
|
-
className: "text-[10px] text-foreground-subtle uppercase tracking-wider truncate",
|
|
327
|
-
title: t,
|
|
328
|
-
children: t
|
|
329
|
-
})]
|
|
330
|
-
}),
|
|
331
|
-
/* @__PURE__ */ F("p", {
|
|
332
|
-
className: `text-lg font-semibold leading-tight truncate ${i ?? "text-foreground"}`,
|
|
333
|
-
title: n,
|
|
334
|
-
children: n
|
|
335
|
-
}),
|
|
336
|
-
r && /* @__PURE__ */ F("p", {
|
|
337
|
-
className: "text-[10px] text-foreground-subtle mt-0.5 truncate",
|
|
338
|
-
title: r,
|
|
339
|
-
children: r
|
|
340
|
-
})
|
|
341
|
-
]
|
|
342
|
-
});
|
|
343
|
-
}
|
|
344
319
|
//#endregion
|
|
345
320
|
//#region src/widgets/zone-editor/ZoneList.tsx
|
|
346
|
-
var
|
|
321
|
+
var he = {
|
|
347
322
|
polygon: "Polygon",
|
|
348
323
|
tripwire: "Tripwire"
|
|
349
|
-
},
|
|
324
|
+
}, ge = {
|
|
350
325
|
polygon: "bg-info/10 text-info",
|
|
351
326
|
tripwire: "bg-warning/10 text-warning"
|
|
352
327
|
};
|
|
353
|
-
function
|
|
354
|
-
return /* @__PURE__ */
|
|
328
|
+
function _e({ zones: e, selectedZoneId: t, drawingKind: n, onSelectZone: r, onDeleteZone: i, onStartDraw: a, onCancelDraw: o }) {
|
|
329
|
+
return /* @__PURE__ */ R("div", {
|
|
355
330
|
className: "flex flex-col gap-2",
|
|
356
|
-
children: [/* @__PURE__ */
|
|
331
|
+
children: [/* @__PURE__ */ L("div", {
|
|
357
332
|
className: "flex items-center gap-1",
|
|
358
|
-
children: n ? /* @__PURE__ */
|
|
333
|
+
children: n ? /* @__PURE__ */ R("button", {
|
|
359
334
|
type: "button",
|
|
360
335
|
onClick: o,
|
|
361
336
|
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",
|
|
362
337
|
title: "Cancel drawing",
|
|
363
|
-
children: [/* @__PURE__ */
|
|
364
|
-
}) : /* @__PURE__ */
|
|
338
|
+
children: [/* @__PURE__ */ L(Y, { className: "h-3.5 w-3.5" }), /* @__PURE__ */ L("span", { children: "Cancel" })]
|
|
339
|
+
}) : /* @__PURE__ */ R(z, { children: [/* @__PURE__ */ L("button", {
|
|
365
340
|
type: "button",
|
|
366
341
|
onClick: () => a("polygon"),
|
|
367
342
|
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",
|
|
368
343
|
title: "Add polygon zone",
|
|
369
344
|
"aria-label": "Add polygon zone",
|
|
370
|
-
children: /* @__PURE__ */
|
|
371
|
-
}), /* @__PURE__ */
|
|
345
|
+
children: /* @__PURE__ */ L(q, { className: "h-4 w-4" })
|
|
346
|
+
}), /* @__PURE__ */ L("button", {
|
|
372
347
|
type: "button",
|
|
373
348
|
onClick: () => a("tripwire"),
|
|
374
349
|
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",
|
|
375
350
|
title: "Add tripwire",
|
|
376
351
|
"aria-label": "Add tripwire",
|
|
377
|
-
children: /* @__PURE__ */
|
|
352
|
+
children: /* @__PURE__ */ L(se, { className: "h-5 w-5 stroke-[2.5]" })
|
|
378
353
|
})] })
|
|
379
|
-
}), e.length === 0 ? /* @__PURE__ */
|
|
354
|
+
}), e.length === 0 ? /* @__PURE__ */ L("p", {
|
|
380
355
|
className: "text-center text-[10px] text-foreground-subtle py-3 leading-tight",
|
|
381
356
|
children: "No zones yet — pick \"Zone\" or \"Tripwire\" to draw."
|
|
382
|
-
}) : /* @__PURE__ */
|
|
357
|
+
}) : /* @__PURE__ */ L("div", {
|
|
383
358
|
className: "flex flex-col gap-1",
|
|
384
359
|
children: e.map((e) => {
|
|
385
360
|
let n = e.id === t;
|
|
386
|
-
return /* @__PURE__ */
|
|
361
|
+
return /* @__PURE__ */ R("div", {
|
|
387
362
|
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(" "),
|
|
388
363
|
onClick: () => r(n ? null : e.id),
|
|
389
364
|
children: [
|
|
390
|
-
/* @__PURE__ */
|
|
365
|
+
/* @__PURE__ */ L("div", {
|
|
391
366
|
className: "h-2.5 w-2.5 rounded-sm flex-shrink-0",
|
|
392
367
|
style: { backgroundColor: e.color }
|
|
393
368
|
}),
|
|
394
|
-
/* @__PURE__ */
|
|
369
|
+
/* @__PURE__ */ L("span", {
|
|
395
370
|
className: "flex-1 truncate text-[11px] font-medium text-foreground",
|
|
396
371
|
children: e.name
|
|
397
372
|
}),
|
|
398
|
-
/* @__PURE__ */
|
|
399
|
-
className: `inline-flex items-center rounded-full px-1.5 py-0.5 text-[9px] font-medium flex-shrink-0 ${
|
|
400
|
-
children:
|
|
373
|
+
/* @__PURE__ */ L("span", {
|
|
374
|
+
className: `inline-flex items-center rounded-full px-1.5 py-0.5 text-[9px] font-medium flex-shrink-0 ${ge[e.kind]}`,
|
|
375
|
+
children: he[e.kind]
|
|
401
376
|
}),
|
|
402
|
-
/* @__PURE__ */
|
|
377
|
+
/* @__PURE__ */ L("button", {
|
|
403
378
|
type: "button",
|
|
404
379
|
title: "Delete zone",
|
|
405
380
|
className: "p-0.5 text-foreground-subtle hover:text-danger rounded transition-colors flex-shrink-0",
|
|
406
381
|
onClick: (t) => {
|
|
407
382
|
t.stopPropagation(), i(e.id);
|
|
408
383
|
},
|
|
409
|
-
children: /* @__PURE__ */
|
|
384
|
+
children: /* @__PURE__ */ L(J, { className: "h-3 w-3" })
|
|
410
385
|
})
|
|
411
386
|
]
|
|
412
387
|
}, e.id);
|
|
@@ -416,7 +391,7 @@ function ge({ zones: e, selectedZoneId: t, drawingKind: n, onSelectZone: r, onDe
|
|
|
416
391
|
}
|
|
417
392
|
//#endregion
|
|
418
393
|
//#region src/widgets/zone-editor/ZoneForm.tsx
|
|
419
|
-
var
|
|
394
|
+
var ve = [
|
|
420
395
|
"#3b82f6",
|
|
421
396
|
"#10b981",
|
|
422
397
|
"#f59e0b",
|
|
@@ -426,24 +401,24 @@ var _e = [
|
|
|
426
401
|
"#f97316",
|
|
427
402
|
"#ec4899"
|
|
428
403
|
];
|
|
429
|
-
function
|
|
430
|
-
let i =
|
|
431
|
-
return /* @__PURE__ */
|
|
404
|
+
function X({ zone: e, onSave: t, onDiscard: n, onDelete: r }) {
|
|
405
|
+
let i = b(), a = (e) => i?.updateDraft({ name: e }), o = (e) => i?.updateDraft({ color: e });
|
|
406
|
+
return /* @__PURE__ */ R("div", {
|
|
432
407
|
className: "flex flex-col gap-2",
|
|
433
408
|
children: [
|
|
434
|
-
/* @__PURE__ */
|
|
409
|
+
/* @__PURE__ */ R("div", {
|
|
435
410
|
className: "flex items-center justify-between",
|
|
436
|
-
children: [/* @__PURE__ */
|
|
411
|
+
children: [/* @__PURE__ */ L("h3", {
|
|
437
412
|
className: "text-[10px] font-semibold text-foreground-subtle uppercase tracking-wider",
|
|
438
413
|
children: "Editing"
|
|
439
|
-
}), /* @__PURE__ */
|
|
414
|
+
}), /* @__PURE__ */ L("span", {
|
|
440
415
|
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",
|
|
441
416
|
children: e.kind === "tripwire" ? "Tripwire" : "Polygon"
|
|
442
417
|
})]
|
|
443
418
|
}),
|
|
444
|
-
/* @__PURE__ */
|
|
419
|
+
/* @__PURE__ */ L("input", {
|
|
445
420
|
type: "text",
|
|
446
|
-
className:
|
|
421
|
+
className: y,
|
|
447
422
|
value: e.name,
|
|
448
423
|
autoFocus: !0,
|
|
449
424
|
onChange: (e) => a(e.target.value),
|
|
@@ -452,9 +427,9 @@ function ve({ zone: e, onSave: t, onDiscard: n, onDelete: r }) {
|
|
|
452
427
|
},
|
|
453
428
|
placeholder: "Zone name"
|
|
454
429
|
}),
|
|
455
|
-
/* @__PURE__ */
|
|
430
|
+
/* @__PURE__ */ L("div", {
|
|
456
431
|
className: "flex flex-wrap gap-1",
|
|
457
|
-
children:
|
|
432
|
+
children: ve.map((t) => /* @__PURE__ */ L("button", {
|
|
458
433
|
type: "button",
|
|
459
434
|
title: t,
|
|
460
435
|
className: ["h-4 w-4 rounded border-2 cursor-pointer transition-transform hover:scale-110", e.color === t ? "border-white scale-110" : "border-transparent"].join(" "),
|
|
@@ -462,46 +437,46 @@ function ve({ zone: e, onSave: t, onDiscard: n, onDelete: r }) {
|
|
|
462
437
|
onClick: () => o(t)
|
|
463
438
|
}, t))
|
|
464
439
|
}),
|
|
465
|
-
/* @__PURE__ */
|
|
440
|
+
/* @__PURE__ */ R("div", {
|
|
466
441
|
className: "flex items-center gap-1.5",
|
|
467
|
-
children: [/* @__PURE__ */
|
|
442
|
+
children: [/* @__PURE__ */ L("input", {
|
|
468
443
|
type: "color",
|
|
469
444
|
className: "h-6 w-6 rounded border border-border bg-background cursor-pointer p-0.5",
|
|
470
445
|
value: e.color,
|
|
471
446
|
onChange: (e) => o(e.target.value)
|
|
472
|
-
}), /* @__PURE__ */
|
|
447
|
+
}), /* @__PURE__ */ L("input", {
|
|
473
448
|
type: "text",
|
|
474
|
-
className: `${
|
|
449
|
+
className: `${y} font-mono`,
|
|
475
450
|
value: e.color,
|
|
476
451
|
placeholder: "#000000",
|
|
477
452
|
onChange: (e) => o(e.target.value)
|
|
478
453
|
})]
|
|
479
454
|
}),
|
|
480
|
-
/* @__PURE__ */
|
|
455
|
+
/* @__PURE__ */ R("p", {
|
|
481
456
|
className: "text-[9px] text-foreground-subtle leading-tight",
|
|
482
457
|
children: [e.kind === "tripwire" ? "2 points" : `${e.points.length} pts`, e.points.length > 0 && " · drag handles to reshape"]
|
|
483
458
|
}),
|
|
484
|
-
/* @__PURE__ */
|
|
459
|
+
/* @__PURE__ */ R("div", {
|
|
485
460
|
className: "flex items-center gap-1.5",
|
|
486
|
-
children: [/* @__PURE__ */
|
|
461
|
+
children: [/* @__PURE__ */ R("button", {
|
|
487
462
|
type: "button",
|
|
488
463
|
onClick: t,
|
|
489
464
|
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",
|
|
490
465
|
title: "Save changes (Enter)",
|
|
491
|
-
children: [/* @__PURE__ */
|
|
492
|
-
}), /* @__PURE__ */
|
|
466
|
+
children: [/* @__PURE__ */ L(oe, { className: "h-3 w-3" }), "Save"]
|
|
467
|
+
}), /* @__PURE__ */ R("button", {
|
|
493
468
|
type: "button",
|
|
494
469
|
onClick: n,
|
|
495
470
|
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",
|
|
496
471
|
title: "Discard changes (Esc)",
|
|
497
|
-
children: [/* @__PURE__ */
|
|
472
|
+
children: [/* @__PURE__ */ L(Y, { className: "h-3 w-3" }), "Discard"]
|
|
498
473
|
})]
|
|
499
474
|
}),
|
|
500
|
-
/* @__PURE__ */
|
|
475
|
+
/* @__PURE__ */ R("button", {
|
|
501
476
|
type: "button",
|
|
502
477
|
onClick: r,
|
|
503
|
-
className: `${
|
|
504
|
-
children: [/* @__PURE__ */
|
|
478
|
+
className: `${j} w-full`,
|
|
479
|
+
children: [/* @__PURE__ */ L(J, { className: "h-3 w-3" }), "Delete"]
|
|
505
480
|
})
|
|
506
481
|
]
|
|
507
482
|
});
|
|
@@ -548,8 +523,8 @@ function Te(e) {
|
|
|
548
523
|
};
|
|
549
524
|
return e.name && (t.name = e.name), e.classFilter.length > 0 && (t.classFilter = e.classFilter), t;
|
|
550
525
|
}
|
|
551
|
-
function
|
|
552
|
-
let a =
|
|
526
|
+
function Z({ dev: e, stage: t, zones: n, title: r }) {
|
|
527
|
+
let a = h(e?.state.zoneRules), o = c(() => a?.[t] ?? [], [a, t]), [s, l] = u([]), [d, f] = u(!1), [p, _] = u(!1), [b, x] = u(null), S = Se(t);
|
|
553
528
|
i(() => {
|
|
554
529
|
d || l(o.map(we));
|
|
555
530
|
}, [o, d]);
|
|
@@ -561,7 +536,7 @@ function X({ dev: e, stage: t, zones: n, title: r }) {
|
|
|
561
536
|
mode: "exclude",
|
|
562
537
|
classFilter: [],
|
|
563
538
|
enabled: !0
|
|
564
|
-
}]),
|
|
539
|
+
}]), f(!0);
|
|
565
540
|
}, w = (e, t) => {
|
|
566
541
|
l((n) => n.map((n, r) => {
|
|
567
542
|
if (r !== e) return n;
|
|
@@ -570,7 +545,7 @@ function X({ dev: e, stage: t, zones: n, title: r }) {
|
|
|
570
545
|
...n,
|
|
571
546
|
classFilter: i
|
|
572
547
|
};
|
|
573
|
-
})),
|
|
548
|
+
})), f(!0);
|
|
574
549
|
}, E = (e, t) => {
|
|
575
550
|
l((n) => n.map((n, r) => {
|
|
576
551
|
if (r !== e) return n;
|
|
@@ -579,150 +554,150 @@ function X({ dev: e, stage: t, zones: n, title: r }) {
|
|
|
579
554
|
...n,
|
|
580
555
|
zoneIds: i
|
|
581
556
|
};
|
|
582
|
-
})),
|
|
583
|
-
},
|
|
584
|
-
l((t) => t.filter((t, n) => n !== e)),
|
|
585
|
-
},
|
|
557
|
+
})), f(!0);
|
|
558
|
+
}, O = (e) => {
|
|
559
|
+
l((t) => t.filter((t, n) => n !== e)), f(!0);
|
|
560
|
+
}, k = (e, t) => {
|
|
586
561
|
l((n) => n.map((n, r) => r === e ? {
|
|
587
562
|
...n,
|
|
588
563
|
...t
|
|
589
|
-
} : n)),
|
|
564
|
+
} : n)), f(!0);
|
|
590
565
|
}, A = async () => {
|
|
591
566
|
if (e?.zoneRules) {
|
|
592
|
-
|
|
567
|
+
_(!0), x(null);
|
|
593
568
|
try {
|
|
594
569
|
await e.zoneRules.setRules({
|
|
595
570
|
stage: t,
|
|
596
571
|
rules: s.map(Te)
|
|
597
|
-
}),
|
|
572
|
+
}), f(!1);
|
|
598
573
|
} catch (e) {
|
|
599
574
|
x(e instanceof Error ? e.message : String(e));
|
|
600
575
|
} finally {
|
|
601
|
-
|
|
576
|
+
_(!1);
|
|
602
577
|
}
|
|
603
578
|
}
|
|
604
|
-
}, j = d && !!e?.zoneRules && !
|
|
605
|
-
return /* @__PURE__ */
|
|
579
|
+
}, j = d && !!e?.zoneRules && !p;
|
|
580
|
+
return /* @__PURE__ */ R("div", {
|
|
606
581
|
className: "rounded-md border border-border bg-surface/40 p-2.5",
|
|
607
582
|
children: [
|
|
608
|
-
/* @__PURE__ */
|
|
583
|
+
/* @__PURE__ */ R("div", {
|
|
609
584
|
className: "flex items-center justify-between mb-2 gap-2",
|
|
610
|
-
children: [/* @__PURE__ */
|
|
611
|
-
className: `${
|
|
585
|
+
children: [/* @__PURE__ */ L("h3", {
|
|
586
|
+
className: `${m} truncate`,
|
|
612
587
|
children: r ?? be(t)
|
|
613
|
-
}), /* @__PURE__ */
|
|
588
|
+
}), /* @__PURE__ */ R("div", {
|
|
614
589
|
className: "flex items-center gap-1 flex-shrink-0",
|
|
615
|
-
children: [/* @__PURE__ */
|
|
590
|
+
children: [/* @__PURE__ */ R("button", {
|
|
616
591
|
type: "button",
|
|
617
592
|
onClick: C,
|
|
618
593
|
disabled: n.length === 0 || !e,
|
|
619
|
-
className:
|
|
594
|
+
className: D,
|
|
620
595
|
title: "Add rule",
|
|
621
|
-
children: [/* @__PURE__ */
|
|
622
|
-
}), /* @__PURE__ */
|
|
596
|
+
children: [/* @__PURE__ */ L(ce, { className: "h-2.5 w-2.5" }), " Add"]
|
|
597
|
+
}), /* @__PURE__ */ R("button", {
|
|
623
598
|
type: "button",
|
|
624
599
|
onClick: () => {
|
|
625
600
|
A();
|
|
626
601
|
},
|
|
627
602
|
disabled: !j,
|
|
628
|
-
className:
|
|
629
|
-
children: [/* @__PURE__ */
|
|
603
|
+
className: T,
|
|
604
|
+
children: [/* @__PURE__ */ L(le, { className: "h-2.5 w-2.5" }), p ? "…" : "Save"]
|
|
630
605
|
})]
|
|
631
606
|
})]
|
|
632
607
|
}),
|
|
633
|
-
s.length === 0 ? /* @__PURE__ */
|
|
608
|
+
s.length === 0 ? /* @__PURE__ */ L("p", {
|
|
634
609
|
className: "text-[10px] text-foreground-subtle italic px-1 py-1.5 leading-tight",
|
|
635
610
|
children: n.length === 0 ? "Define a zone first — rules reference zone ids." : "No rules — every detection at this stage passes through."
|
|
636
|
-
}) : /* @__PURE__ */
|
|
611
|
+
}) : /* @__PURE__ */ L("div", {
|
|
637
612
|
className: "flex flex-col gap-1.5",
|
|
638
|
-
children: s.map((e, t) => /* @__PURE__ */
|
|
613
|
+
children: s.map((e, t) => /* @__PURE__ */ R("div", {
|
|
639
614
|
className: "rounded border border-border/50 bg-background/40 px-2 py-1.5 flex flex-col gap-1.5 overflow-hidden",
|
|
640
615
|
children: [
|
|
641
|
-
/* @__PURE__ */
|
|
616
|
+
/* @__PURE__ */ R("div", {
|
|
642
617
|
className: "grid grid-cols-[auto_1fr_auto] items-center gap-1.5",
|
|
643
618
|
children: [
|
|
644
|
-
/* @__PURE__ */
|
|
619
|
+
/* @__PURE__ */ L("button", {
|
|
645
620
|
type: "button",
|
|
646
621
|
role: "switch",
|
|
647
622
|
"aria-checked": e.enabled,
|
|
648
623
|
"aria-label": e.enabled ? "Disable rule" : "Enable rule",
|
|
649
624
|
title: e.enabled ? "Rule is active — click to disable" : "Rule is disabled — click to enable",
|
|
650
|
-
onClick: () =>
|
|
625
|
+
onClick: () => k(t, { enabled: !e.enabled }),
|
|
651
626
|
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(" "),
|
|
652
|
-
children: /* @__PURE__ */
|
|
627
|
+
children: /* @__PURE__ */ L("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(" ") })
|
|
653
628
|
}),
|
|
654
|
-
/* @__PURE__ */
|
|
655
|
-
className: `${
|
|
629
|
+
/* @__PURE__ */ L("input", {
|
|
630
|
+
className: `${y} min-w-0`,
|
|
656
631
|
placeholder: "Rule name (optional)",
|
|
657
632
|
value: e.name,
|
|
658
|
-
onChange: (e) =>
|
|
633
|
+
onChange: (e) => k(t, { name: e.target.value })
|
|
659
634
|
}),
|
|
660
|
-
/* @__PURE__ */
|
|
635
|
+
/* @__PURE__ */ L("button", {
|
|
661
636
|
type: "button",
|
|
662
637
|
title: "Remove rule",
|
|
663
638
|
"aria-label": "Remove rule",
|
|
664
|
-
onClick: () =>
|
|
639
|
+
onClick: () => O(t),
|
|
665
640
|
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",
|
|
666
|
-
children: /* @__PURE__ */
|
|
641
|
+
children: /* @__PURE__ */ L(J, { className: "h-3.5 w-3.5" })
|
|
667
642
|
})
|
|
668
643
|
]
|
|
669
644
|
}),
|
|
670
|
-
/* @__PURE__ */
|
|
645
|
+
/* @__PURE__ */ R("div", {
|
|
671
646
|
className: "flex items-center gap-1.5 flex-wrap",
|
|
672
647
|
children: [
|
|
673
|
-
/* @__PURE__ */
|
|
648
|
+
/* @__PURE__ */ L("span", {
|
|
674
649
|
className: "text-[9px] uppercase tracking-wider text-foreground-subtle w-12 sm:w-14 flex-shrink-0",
|
|
675
650
|
children: "Mode"
|
|
676
651
|
}),
|
|
677
|
-
/* @__PURE__ */
|
|
652
|
+
/* @__PURE__ */ L("button", {
|
|
678
653
|
type: "button",
|
|
679
|
-
onClick: () =>
|
|
680
|
-
className: `${
|
|
654
|
+
onClick: () => k(t, { mode: "include" }),
|
|
655
|
+
className: `${N} ${e.mode === "include" ? g : v}`,
|
|
681
656
|
children: "Include"
|
|
682
657
|
}),
|
|
683
|
-
/* @__PURE__ */
|
|
658
|
+
/* @__PURE__ */ L("button", {
|
|
684
659
|
type: "button",
|
|
685
|
-
onClick: () =>
|
|
686
|
-
className: `${
|
|
660
|
+
onClick: () => k(t, { mode: "exclude" }),
|
|
661
|
+
className: `${N} ${e.mode === "exclude" ? g : v}`,
|
|
687
662
|
children: "Exclude"
|
|
688
663
|
})
|
|
689
664
|
]
|
|
690
665
|
}),
|
|
691
|
-
/* @__PURE__ */
|
|
666
|
+
/* @__PURE__ */ R("div", {
|
|
692
667
|
className: "flex items-center gap-1.5 flex-wrap",
|
|
693
|
-
children: [/* @__PURE__ */
|
|
668
|
+
children: [/* @__PURE__ */ L("span", {
|
|
694
669
|
className: "text-[9px] uppercase tracking-wider text-foreground-subtle w-12 sm:w-14 flex-shrink-0",
|
|
695
670
|
children: "Zones"
|
|
696
|
-
}), n.length === 0 ? /* @__PURE__ */
|
|
671
|
+
}), n.length === 0 ? /* @__PURE__ */ L("span", {
|
|
697
672
|
className: "text-[10px] text-foreground-subtle italic",
|
|
698
673
|
children: "none"
|
|
699
|
-
}) : n.map((n) => /* @__PURE__ */
|
|
674
|
+
}) : n.map((n) => /* @__PURE__ */ R("button", {
|
|
700
675
|
type: "button",
|
|
701
676
|
onClick: () => E(t, n.id),
|
|
702
|
-
className: `${
|
|
703
|
-
children: [/* @__PURE__ */
|
|
677
|
+
className: `${N} ${e.zoneIds.includes(n.id) ? g : v}`,
|
|
678
|
+
children: [/* @__PURE__ */ L("span", {
|
|
704
679
|
className: "h-2 w-2 rounded-sm",
|
|
705
680
|
style: { backgroundColor: n.color || "#3b82f6" }
|
|
706
|
-
}), /* @__PURE__ */
|
|
681
|
+
}), /* @__PURE__ */ L("span", {
|
|
707
682
|
className: "truncate max-w-[7rem]",
|
|
708
683
|
children: n.name || n.id
|
|
709
684
|
})]
|
|
710
685
|
}, n.id))]
|
|
711
686
|
}),
|
|
712
|
-
S && /* @__PURE__ */
|
|
687
|
+
S && /* @__PURE__ */ R("div", {
|
|
713
688
|
className: "flex items-center gap-1.5 flex-wrap",
|
|
714
689
|
children: [
|
|
715
|
-
/* @__PURE__ */
|
|
690
|
+
/* @__PURE__ */ L("span", {
|
|
716
691
|
className: "text-[9px] uppercase tracking-wider text-foreground-subtle w-12 sm:w-14 flex-shrink-0",
|
|
717
692
|
children: "Class"
|
|
718
693
|
}),
|
|
719
|
-
Ce.map((n) => /* @__PURE__ */
|
|
694
|
+
Ce.map((n) => /* @__PURE__ */ L("button", {
|
|
720
695
|
type: "button",
|
|
721
696
|
onClick: () => w(t, n.id),
|
|
722
|
-
className: `${
|
|
697
|
+
className: `${N} ${e.classFilter.includes(n.id) ? g : v}`,
|
|
723
698
|
children: n.label
|
|
724
699
|
}, n.id)),
|
|
725
|
-
e.classFilter.length === 0 && /* @__PURE__ */
|
|
700
|
+
e.classFilter.length === 0 && /* @__PURE__ */ L("span", {
|
|
726
701
|
className: "text-[10px] text-foreground-subtle italic ml-1",
|
|
727
702
|
children: "any"
|
|
728
703
|
})
|
|
@@ -731,9 +706,9 @@ function X({ dev: e, stage: t, zones: n, title: r }) {
|
|
|
731
706
|
]
|
|
732
707
|
}, e.id))
|
|
733
708
|
}),
|
|
734
|
-
|
|
709
|
+
b && /* @__PURE__ */ L("p", {
|
|
735
710
|
className: "mt-2 text-[10px] text-danger",
|
|
736
|
-
children:
|
|
711
|
+
children: b
|
|
737
712
|
})
|
|
738
713
|
]
|
|
739
714
|
});
|
|
@@ -763,7 +738,7 @@ function Oe(e) {
|
|
|
763
738
|
}
|
|
764
739
|
//#endregion
|
|
765
740
|
//#region src/widgets/zone-editor/ZoneOverlay.tsx
|
|
766
|
-
var ke = "#3b82f6",
|
|
741
|
+
var ke = "#3b82f6", Ae = ["polygon", "line"], Q = [
|
|
767
742
|
"#3b82f6",
|
|
768
743
|
"#10b981",
|
|
769
744
|
"#f59e0b",
|
|
@@ -775,12 +750,12 @@ var ke = "#3b82f6", Z = ["polygon", "line"], Q = [
|
|
|
775
750
|
"#8b5cf6",
|
|
776
751
|
"#14b8a6"
|
|
777
752
|
];
|
|
778
|
-
function
|
|
753
|
+
function je(e) {
|
|
779
754
|
let t = new Set(e.map((e) => (e.color ?? "").toLowerCase()));
|
|
780
755
|
for (let e of Q) if (!t.has(e.toLowerCase())) return e;
|
|
781
756
|
return Q[e.length % Q.length];
|
|
782
757
|
}
|
|
783
|
-
function
|
|
758
|
+
function Me(e) {
|
|
784
759
|
return {
|
|
785
760
|
id: e.id,
|
|
786
761
|
name: e.name,
|
|
@@ -798,20 +773,20 @@ function $(e) {
|
|
|
798
773
|
color: e.color
|
|
799
774
|
};
|
|
800
775
|
}
|
|
801
|
-
function
|
|
802
|
-
let t =
|
|
776
|
+
function Ne({ deviceId: e }) {
|
|
777
|
+
let t = P(M().trpcClient, e), n = h(t?.state.zones), r = c(() => n?.zones ?? [], [n]), i = b(), s = i?.drawingKind ?? null, l = i?.selectedZoneId ?? null, u = i?.editingDraft ?? null, d = c(() => r.map((e) => u && u.id === e.id ? {
|
|
803
778
|
id: u.id,
|
|
804
779
|
name: u.name,
|
|
805
780
|
kind: u.kind,
|
|
806
781
|
color: u.color,
|
|
807
782
|
points: [...u.points]
|
|
808
|
-
} :
|
|
783
|
+
} : Me(e)), [r, u]), f = c(() => d.map(Ee), [d]), p = o(async (e) => {
|
|
809
784
|
if (e.kind !== "polygon" && e.kind !== "line") return;
|
|
810
785
|
let n = {
|
|
811
786
|
id: crypto.randomUUID(),
|
|
812
787
|
name: "",
|
|
813
788
|
kind: De(e.kind),
|
|
814
|
-
color:
|
|
789
|
+
color: je(d),
|
|
815
790
|
points: [...e.points]
|
|
816
791
|
};
|
|
817
792
|
try {
|
|
@@ -824,7 +799,7 @@ function Me({ deviceId: e }) {
|
|
|
824
799
|
t,
|
|
825
800
|
d,
|
|
826
801
|
i
|
|
827
|
-
]),
|
|
802
|
+
]), m = o(async (e, n) => {
|
|
828
803
|
let r = n.map((e) => ({
|
|
829
804
|
x: e.x,
|
|
830
805
|
y: e.y
|
|
@@ -847,9 +822,9 @@ function Me({ deviceId: e }) {
|
|
|
847
822
|
d,
|
|
848
823
|
u,
|
|
849
824
|
i
|
|
850
|
-
]),
|
|
851
|
-
typeof e == "string" && (t.kind !== "polygon" && t.kind !== "line" ||
|
|
852
|
-
}, [
|
|
825
|
+
]), g = o((e, t) => {
|
|
826
|
+
typeof e == "string" && (t.kind !== "polygon" && t.kind !== "line" || m(e, t.points));
|
|
827
|
+
}, [m]), _ = o((e) => {
|
|
853
828
|
if (e === null) {
|
|
854
829
|
i?.discardDraft(), i?.setSelectedZoneId(null);
|
|
855
830
|
return;
|
|
@@ -868,33 +843,33 @@ function Me({ deviceId: e }) {
|
|
|
868
843
|
points: t.points
|
|
869
844
|
});
|
|
870
845
|
}, [d, i]);
|
|
871
|
-
return d.length === 0 && s === null ? null : /* @__PURE__ */
|
|
846
|
+
return d.length === 0 && s === null ? null : /* @__PURE__ */ L(a, {
|
|
872
847
|
fallback: null,
|
|
873
|
-
children: /* @__PURE__ */
|
|
848
|
+
children: /* @__PURE__ */ L(x, {
|
|
874
849
|
transparent: !0,
|
|
875
|
-
items:
|
|
876
|
-
supportedShapes:
|
|
850
|
+
items: f,
|
|
851
|
+
supportedShapes: Ae,
|
|
877
852
|
selectedId: l,
|
|
878
|
-
onSelect:
|
|
879
|
-
onShapeChange:
|
|
853
|
+
onSelect: _,
|
|
854
|
+
onShapeChange: g,
|
|
880
855
|
onDrawComplete: (e) => {
|
|
881
|
-
|
|
856
|
+
p(e);
|
|
882
857
|
},
|
|
883
858
|
drawingKind: s === null ? null : Oe(s)
|
|
884
859
|
})
|
|
885
860
|
});
|
|
886
861
|
}
|
|
887
|
-
var
|
|
888
|
-
function
|
|
862
|
+
var Pe = l(Ne), Fe = "#3b82f6";
|
|
863
|
+
function Ie(e) {
|
|
889
864
|
return {
|
|
890
865
|
id: e.id,
|
|
891
866
|
name: e.name,
|
|
892
867
|
kind: e.kind,
|
|
893
|
-
color: e.color ||
|
|
868
|
+
color: e.color || Fe,
|
|
894
869
|
points: [...e.polygon]
|
|
895
870
|
};
|
|
896
871
|
}
|
|
897
|
-
function
|
|
872
|
+
function Le(e) {
|
|
898
873
|
return {
|
|
899
874
|
id: e.id,
|
|
900
875
|
name: e.name,
|
|
@@ -903,12 +878,12 @@ function Ie(e) {
|
|
|
903
878
|
color: e.color
|
|
904
879
|
};
|
|
905
880
|
}
|
|
906
|
-
function
|
|
907
|
-
let t =
|
|
908
|
-
|
|
881
|
+
function Re({ deviceId: e }) {
|
|
882
|
+
let t = P(M().trpcClient, e), n = h(t?.state.zones), r = c(() => n?.zones ?? [], [n]), i = c(() => r.map(Ie), [r]), a = b(), s = a?.drawingKind ?? null, l = a?.selectedZoneId ?? null, u = a?.editingDraft ?? null;
|
|
883
|
+
O(c(() => ({
|
|
909
884
|
id: "zones",
|
|
910
885
|
order: 100,
|
|
911
|
-
node: /* @__PURE__ */
|
|
886
|
+
node: /* @__PURE__ */ L(Pe, { deviceId: e })
|
|
912
887
|
}), [e]));
|
|
913
888
|
let d = o((e) => {
|
|
914
889
|
if (e === null) {
|
|
@@ -923,11 +898,11 @@ function Le({ deviceId: e }) {
|
|
|
923
898
|
color: t.color,
|
|
924
899
|
points: t.points
|
|
925
900
|
});
|
|
926
|
-
}, [i, a]),
|
|
901
|
+
}, [i, a]), f = o(async () => {
|
|
927
902
|
let e = a?.editingDraft;
|
|
928
903
|
if (e) {
|
|
929
904
|
try {
|
|
930
|
-
await t?.zones?.updateZone({ zone:
|
|
905
|
+
await t?.zones?.updateZone({ zone: Le({
|
|
931
906
|
id: e.id,
|
|
932
907
|
kind: e.kind,
|
|
933
908
|
name: e.name,
|
|
@@ -939,42 +914,42 @@ function Le({ deviceId: e }) {
|
|
|
939
914
|
}
|
|
940
915
|
a?.discardDraft(), a?.setSelectedZoneId(null);
|
|
941
916
|
}
|
|
942
|
-
}, [t, a]),
|
|
917
|
+
}, [t, a]), p = o(() => {
|
|
943
918
|
a?.discardDraft(), a?.setSelectedZoneId(null);
|
|
944
|
-
}, [a]),
|
|
919
|
+
}, [a]), g = o(async (e) => {
|
|
945
920
|
try {
|
|
946
921
|
await t?.zones?.removeZone({ zoneId: e });
|
|
947
922
|
} catch (e) {
|
|
948
923
|
console.error("zones.removeZone failed", e);
|
|
949
924
|
}
|
|
950
925
|
a?.selectedZoneId === e && a.setSelectedZoneId(null), a?.editingDraft?.id === e && a.discardDraft();
|
|
951
|
-
}, [t, a]),
|
|
926
|
+
}, [t, a]), _ = o((e) => {
|
|
952
927
|
a?.startDrawing(e);
|
|
953
|
-
}, [a]),
|
|
928
|
+
}, [a]), v = o(() => {
|
|
954
929
|
a?.setDrawingKind(null);
|
|
955
|
-
}, [a]),
|
|
930
|
+
}, [a]), y = c(() => !u || !i.find((e) => e.id === u.id) ? null : {
|
|
956
931
|
id: u.id,
|
|
957
932
|
kind: u.kind,
|
|
958
933
|
name: u.name,
|
|
959
934
|
color: u.color,
|
|
960
935
|
points: [...u.points]
|
|
961
936
|
}, [i, u]);
|
|
962
|
-
return /* @__PURE__ */
|
|
963
|
-
className:
|
|
964
|
-
children: [/* @__PURE__ */
|
|
965
|
-
className:
|
|
966
|
-
children: [/* @__PURE__ */
|
|
967
|
-
className:
|
|
968
|
-
children: /* @__PURE__ */
|
|
937
|
+
return /* @__PURE__ */ R("div", {
|
|
938
|
+
className: S,
|
|
939
|
+
children: [/* @__PURE__ */ R("div", {
|
|
940
|
+
className: E,
|
|
941
|
+
children: [/* @__PURE__ */ L("div", {
|
|
942
|
+
className: C,
|
|
943
|
+
children: /* @__PURE__ */ R("div", {
|
|
969
944
|
className: "min-w-0",
|
|
970
|
-
children: [/* @__PURE__ */
|
|
971
|
-
className:
|
|
945
|
+
children: [/* @__PURE__ */ L("h2", {
|
|
946
|
+
className: m,
|
|
972
947
|
children: "Detection Zones"
|
|
973
|
-
}), /* @__PURE__ */
|
|
974
|
-
className: `${
|
|
948
|
+
}), /* @__PURE__ */ R("p", {
|
|
949
|
+
className: `${F} mt-0.5 leading-tight`,
|
|
975
950
|
children: [
|
|
976
951
|
"Pick a shape below or use the ",
|
|
977
|
-
/* @__PURE__ */
|
|
952
|
+
/* @__PURE__ */ L("strong", {
|
|
978
953
|
className: "text-foreground",
|
|
979
954
|
children: "Zones"
|
|
980
955
|
}),
|
|
@@ -983,37 +958,37 @@ function Le({ deviceId: e }) {
|
|
|
983
958
|
]
|
|
984
959
|
})]
|
|
985
960
|
})
|
|
986
|
-
}), /* @__PURE__ */
|
|
987
|
-
className: `${
|
|
988
|
-
children: [/* @__PURE__ */
|
|
961
|
+
}), /* @__PURE__ */ R("div", {
|
|
962
|
+
className: `${k} flex flex-col gap-3`,
|
|
963
|
+
children: [/* @__PURE__ */ L(_e, {
|
|
989
964
|
zones: i,
|
|
990
965
|
selectedZoneId: l,
|
|
991
966
|
drawingKind: s,
|
|
992
967
|
onSelectZone: d,
|
|
993
|
-
onDeleteZone:
|
|
994
|
-
onStartDraw:
|
|
995
|
-
onCancelDraw:
|
|
996
|
-
}),
|
|
997
|
-
zone:
|
|
998
|
-
onSave:
|
|
999
|
-
onDiscard:
|
|
1000
|
-
onDelete: () =>
|
|
968
|
+
onDeleteZone: g,
|
|
969
|
+
onStartDraw: _,
|
|
970
|
+
onCancelDraw: v
|
|
971
|
+
}), y && /* @__PURE__ */ R(z, { children: [/* @__PURE__ */ L("div", { className: "border-t border-border" }), /* @__PURE__ */ L(X, {
|
|
972
|
+
zone: y,
|
|
973
|
+
onSave: f,
|
|
974
|
+
onDiscard: p,
|
|
975
|
+
onDelete: () => g(y.id)
|
|
1001
976
|
})] })]
|
|
1002
977
|
})]
|
|
1003
|
-
}), /* @__PURE__ */
|
|
1004
|
-
className: `grid grid-cols-1 2xl:grid-cols-2 ${
|
|
978
|
+
}), /* @__PURE__ */ R("div", {
|
|
979
|
+
className: `grid grid-cols-1 2xl:grid-cols-2 ${A}`,
|
|
1005
980
|
children: [
|
|
1006
|
-
/* @__PURE__ */
|
|
981
|
+
/* @__PURE__ */ L(Z, {
|
|
1007
982
|
dev: t,
|
|
1008
983
|
stage: "motion",
|
|
1009
984
|
zones: r
|
|
1010
985
|
}),
|
|
1011
|
-
/* @__PURE__ */
|
|
986
|
+
/* @__PURE__ */ L(Z, {
|
|
1012
987
|
dev: t,
|
|
1013
988
|
stage: "detection",
|
|
1014
989
|
zones: r
|
|
1015
990
|
}),
|
|
1016
|
-
/* @__PURE__ */
|
|
991
|
+
/* @__PURE__ */ L(Z, {
|
|
1017
992
|
dev: t,
|
|
1018
993
|
stage: "package",
|
|
1019
994
|
zones: r
|
|
@@ -1024,17 +999,17 @@ function Le({ deviceId: e }) {
|
|
|
1024
999
|
}
|
|
1025
1000
|
//#endregion
|
|
1026
1001
|
//#region src/widgets/ZoneEditor.tsx
|
|
1027
|
-
function
|
|
1028
|
-
return e.deviceId === void 0 ? /* @__PURE__ */
|
|
1002
|
+
function ze(e) {
|
|
1003
|
+
return e.deviceId === void 0 ? /* @__PURE__ */ L("div", {
|
|
1029
1004
|
className: "rounded-lg border border-warning/30 bg-warning/10 px-3 py-2 text-xs text-warning",
|
|
1030
1005
|
children: "ZoneEditor requires a deviceId"
|
|
1031
|
-
}) : /* @__PURE__ */
|
|
1006
|
+
}) : /* @__PURE__ */ L(Re, { deviceId: e.deviceId });
|
|
1032
1007
|
}
|
|
1033
1008
|
//#endregion
|
|
1034
1009
|
//#region src/widgets/index.tsx
|
|
1035
|
-
var
|
|
1036
|
-
"pipeline-quick-stats":
|
|
1037
|
-
"zone-editor":
|
|
1010
|
+
var Be = {
|
|
1011
|
+
"pipeline-quick-stats": fe,
|
|
1012
|
+
"zone-editor": ze
|
|
1038
1013
|
};
|
|
1039
1014
|
//#endregion
|
|
1040
|
-
export {
|
|
1015
|
+
export { Be as default };
|