@camstack/addon-pipeline-orchestrator 0.1.20 → 0.1.21
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/@mf-types/compiled-types/widgets/motion-zones/MotionZonesTab.d.ts.map +1 -1
- package/dist/@mf-types.zip +0 -0
- package/dist/_stub.js +196 -201
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/_stub.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { _ as t, a as
|
|
2
|
-
import { _ as
|
|
3
|
-
import { _ as
|
|
4
|
-
import { a as
|
|
1
|
+
import { _ as t, a as u, b as be } from "./__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.mjs-Cg6QsnjR.mjs";
|
|
2
|
+
import { _ as je } from "./__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.mjs-DoWbefqS.mjs";
|
|
3
|
+
import { _ as _e, a as Be, b as qe, c as ae, d as le, e as Ue, f as ye, g as he, h as He, i as xe, j as Ie, k as ze, l as Ve, m as re, n as oe, o as se, p as Ze, q as Ge, r as Ye, s as Xe, t as J, u as Ke, v as Qe } from "./__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.mjs-DPoup41Y.mjs";
|
|
4
|
+
import { a as $e, b as ge, c as U, d as L, e as X, f as Ae, g as Y, h as P } from "./__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react__loadShare__.mjs-0qpbQxoV.mjs";
|
|
5
5
|
import { _ as Je } from "./__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.mjs-UNj4rttw.mjs";
|
|
6
6
|
import { _ as G, a as et, b as de, c as ue, d as tt, e as nt, f as fe } from "./__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react_mf_2_konva__loadShare__.mjs-DSZIXeAx.mjs";
|
|
7
7
|
/**
|
|
@@ -13,10 +13,10 @@ import { _ as G, a as et, b as de, c as ue, d as tt, e as nt, f as fe } from "./
|
|
|
13
13
|
const rt = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), ot = (e) => e.replace(
|
|
14
14
|
/^([A-Z])|[\s-_]+(\w)/g,
|
|
15
15
|
(o, r, l) => l ? l.toUpperCase() : r.toLowerCase()
|
|
16
|
-
),
|
|
16
|
+
), ke = (e) => {
|
|
17
17
|
const o = ot(e);
|
|
18
18
|
return o.charAt(0).toUpperCase() + o.slice(1);
|
|
19
|
-
},
|
|
19
|
+
}, Pe = (...e) => e.filter((o, r, l) => !!o && o.trim() !== "" && l.indexOf(o) === r).join(" ").trim(), st = (e) => {
|
|
20
20
|
for (const o in e)
|
|
21
21
|
if (o.startsWith("aria-") || o === "role" || o === "title")
|
|
22
22
|
return !0;
|
|
@@ -44,7 +44,7 @@ var it = {
|
|
|
44
44
|
* This source code is licensed under the ISC license.
|
|
45
45
|
* See the LICENSE file in the root directory of this source tree.
|
|
46
46
|
*/
|
|
47
|
-
const at =
|
|
47
|
+
const at = $e(
|
|
48
48
|
({
|
|
49
49
|
color: e = "currentColor",
|
|
50
50
|
size: o = 24,
|
|
@@ -63,7 +63,7 @@ const at = Re(
|
|
|
63
63
|
height: o,
|
|
64
64
|
stroke: e,
|
|
65
65
|
strokeWidth: l ? Number(r) * 24 / Number(o) : r,
|
|
66
|
-
className:
|
|
66
|
+
className: Pe("lucide", p),
|
|
67
67
|
...!i && !st(s) && { "aria-hidden": "true" },
|
|
68
68
|
...s
|
|
69
69
|
},
|
|
@@ -80,19 +80,19 @@ const at = Re(
|
|
|
80
80
|
* See the LICENSE file in the root directory of this source tree.
|
|
81
81
|
*/
|
|
82
82
|
const j = (e, o) => {
|
|
83
|
-
const r =
|
|
83
|
+
const r = $e(
|
|
84
84
|
({ className: l, ...p }, i) => ge(at, {
|
|
85
85
|
ref: i,
|
|
86
86
|
iconNode: o,
|
|
87
|
-
className:
|
|
88
|
-
`lucide-${rt(
|
|
87
|
+
className: Pe(
|
|
88
|
+
`lucide-${rt(ke(e))}`,
|
|
89
89
|
`lucide-${e}`,
|
|
90
90
|
l
|
|
91
91
|
),
|
|
92
92
|
...p
|
|
93
93
|
})
|
|
94
94
|
);
|
|
95
|
-
return r.displayName =
|
|
95
|
+
return r.displayName = ke(e), r;
|
|
96
96
|
};
|
|
97
97
|
/**
|
|
98
98
|
* @license lucide-react v0.511.0 - ISC
|
|
@@ -225,7 +225,7 @@ const Dt = [
|
|
|
225
225
|
["path", { d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2", key: "v07s0e" }],
|
|
226
226
|
["line", { x1: "10", x2: "10", y1: "11", y2: "17", key: "1uufr5" }],
|
|
227
227
|
["line", { x1: "14", x2: "14", y1: "11", y2: "17", key: "xtxkd" }]
|
|
228
|
-
],
|
|
228
|
+
], ve = j("trash-2", Dt);
|
|
229
229
|
/**
|
|
230
230
|
* @license lucide-react v0.511.0 - ISC
|
|
231
231
|
*
|
|
@@ -235,35 +235,35 @@ const Dt = [
|
|
|
235
235
|
const St = [
|
|
236
236
|
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
237
237
|
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
238
|
-
],
|
|
238
|
+
], Ee = j("x", St);
|
|
239
239
|
function Mt(e) {
|
|
240
240
|
return e.deviceId === void 0 ? /* @__PURE__ */ t("div", { className: "rounded-lg border border-warning/30 bg-warning/10 px-3 py-2 text-xs text-warning", children: "PipelineQuickStats requires a deviceId" }) : /* @__PURE__ */ t(It, { deviceId: e.deviceId });
|
|
241
241
|
}
|
|
242
242
|
function It({ deviceId: e }) {
|
|
243
|
-
|
|
243
|
+
_e(
|
|
244
244
|
["pipelineOrchestrator", "getPipelineAssignment"],
|
|
245
245
|
["pipeline.camera-assigned", "pipeline.camera-unassigned", "pipeline.camera-updated"]
|
|
246
|
-
),
|
|
246
|
+
), _e(
|
|
247
247
|
["pipelineRunner", "getCameraMetrics"],
|
|
248
248
|
["pipeline.camera-metrics-snapshot"]
|
|
249
249
|
);
|
|
250
|
-
const { data: o } =
|
|
250
|
+
const { data: o } = Be(
|
|
251
251
|
{ deviceId: e },
|
|
252
252
|
{ staleTime: 3e4 }
|
|
253
|
-
), r = o?.agentNodeId ?? null, p = typeof r == "string" && r.length > 0 && !r.startsWith("addon:") ? r : void 0, { data: i } =
|
|
253
|
+
), r = o?.agentNodeId ?? null, p = typeof r == "string" && r.length > 0 && !r.startsWith("addon:") ? r : void 0, { data: i } = qe(
|
|
254
254
|
{
|
|
255
255
|
deviceId: e,
|
|
256
256
|
...p ? { nodeId: p } : {}
|
|
257
257
|
},
|
|
258
258
|
{ staleTime: 2e3, retry: !1 }
|
|
259
|
-
), c = ae(), s = le(c.trpcClient, e), { data: h } =
|
|
259
|
+
), c = ae(), s = le(c.trpcClient, e), { data: h } = je({
|
|
260
260
|
queryKey: ["device", e, "pipelineAnalytics.getActiveTracks"],
|
|
261
261
|
queryFn: () => s?.pipelineAnalytics?.getActiveTracks({}) ?? [],
|
|
262
262
|
enabled: !!s,
|
|
263
263
|
refetchInterval: 5e3,
|
|
264
264
|
retry: !1
|
|
265
|
-
}), n = i?.phase ?? null, S = i?.detectionMode ?? null,
|
|
266
|
-
return /* @__PURE__ */ t("div", { className: "@container", style: { containerType: "inline-size" }, children: /* @__PURE__ */
|
|
265
|
+
}), n = i?.phase ?? null, S = i?.detectionMode ?? null, d = Number(i?.actualFps ?? 0), Z = Number(i?.configuredFps ?? 0), b = Number(i?.avgInferenceTimeMs ?? 0), m = Number(i?.queueDepth ?? 0), w = Number(i?.droppedFrames ?? 0), _ = Ue(n ?? "watching"), M = h?.length ?? 0;
|
|
266
|
+
return /* @__PURE__ */ t("div", { className: "@container", style: { containerType: "inline-size" }, children: /* @__PURE__ */ u("div", { className: "grid grid-cols-1 @[360px]:grid-cols-2 @[720px]:grid-cols-4 gap-3", children: [
|
|
267
267
|
/* @__PURE__ */ t(
|
|
268
268
|
ie,
|
|
269
269
|
{
|
|
@@ -279,7 +279,7 @@ function It({ deviceId: e }) {
|
|
|
279
279
|
{
|
|
280
280
|
icon: bt,
|
|
281
281
|
label: "Detection FPS",
|
|
282
|
-
value: `${
|
|
282
|
+
value: `${d.toFixed(1)}`,
|
|
283
283
|
subtext: Z > 0 ? `target: ${Z}` : void 0
|
|
284
284
|
}
|
|
285
285
|
),
|
|
@@ -304,8 +304,8 @@ function It({ deviceId: e }) {
|
|
|
304
304
|
] }) });
|
|
305
305
|
}
|
|
306
306
|
function ie({ icon: e, label: o, value: r, subtext: l, color: p }) {
|
|
307
|
-
return /* @__PURE__ */
|
|
308
|
-
/* @__PURE__ */
|
|
307
|
+
return /* @__PURE__ */ u("div", { className: "rounded-lg border border-border bg-surface p-3 min-w-0", children: [
|
|
308
|
+
/* @__PURE__ */ u("div", { className: "flex items-center gap-1.5 mb-1 min-w-0", children: [
|
|
309
309
|
/* @__PURE__ */ t(e, { className: "h-3.5 w-3.5 text-foreground-subtle flex-shrink-0" }),
|
|
310
310
|
/* @__PURE__ */ t(
|
|
311
311
|
"span",
|
|
@@ -343,8 +343,8 @@ function At({
|
|
|
343
343
|
onStartDraw: i,
|
|
344
344
|
onCancelDraw: c
|
|
345
345
|
}) {
|
|
346
|
-
return /* @__PURE__ */
|
|
347
|
-
/* @__PURE__ */ t("div", { className: "flex items-center gap-1", children: r ? /* @__PURE__ */
|
|
346
|
+
return /* @__PURE__ */ u("div", { className: "flex flex-col gap-2", children: [
|
|
347
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-1", children: r ? /* @__PURE__ */ u(
|
|
348
348
|
"button",
|
|
349
349
|
{
|
|
350
350
|
type: "button",
|
|
@@ -352,11 +352,11 @@ function At({
|
|
|
352
352
|
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",
|
|
353
353
|
title: "Cancel drawing",
|
|
354
354
|
children: [
|
|
355
|
-
/* @__PURE__ */ t(
|
|
355
|
+
/* @__PURE__ */ t(Ee, { className: "h-3.5 w-3.5" }),
|
|
356
356
|
/* @__PURE__ */ t("span", { children: "Cancel" })
|
|
357
357
|
]
|
|
358
358
|
}
|
|
359
|
-
) : /* @__PURE__ */
|
|
359
|
+
) : /* @__PURE__ */ u(be, { children: [
|
|
360
360
|
/* @__PURE__ */ t(
|
|
361
361
|
"button",
|
|
362
362
|
{
|
|
@@ -382,7 +382,7 @@ function At({
|
|
|
382
382
|
] }) }),
|
|
383
383
|
e.length === 0 ? /* @__PURE__ */ t("p", { className: "text-center text-[10px] text-foreground-subtle py-3 leading-tight", children: 'No zones yet — pick "Zone" or "Tripwire" to draw.' }) : /* @__PURE__ */ t("div", { className: "flex flex-col gap-1", children: e.map((s) => {
|
|
384
384
|
const h = s.id === o;
|
|
385
|
-
return /* @__PURE__ */
|
|
385
|
+
return /* @__PURE__ */ u(
|
|
386
386
|
"div",
|
|
387
387
|
{
|
|
388
388
|
className: [
|
|
@@ -415,7 +415,7 @@ function At({
|
|
|
415
415
|
onClick: (n) => {
|
|
416
416
|
n.stopPropagation(), p(s.id);
|
|
417
417
|
},
|
|
418
|
-
children: /* @__PURE__ */ t(
|
|
418
|
+
children: /* @__PURE__ */ t(ve, { className: "h-3 w-3" })
|
|
419
419
|
}
|
|
420
420
|
)
|
|
421
421
|
]
|
|
@@ -445,8 +445,8 @@ const Pt = [
|
|
|
445
445
|
];
|
|
446
446
|
function Et({ zone: e, onSave: o, onDiscard: r, onDelete: l }) {
|
|
447
447
|
const p = ye(), i = (s) => p?.updateDraft({ name: s }), c = (s) => p?.updateDraft({ color: s });
|
|
448
|
-
return /* @__PURE__ */
|
|
449
|
-
/* @__PURE__ */
|
|
448
|
+
return /* @__PURE__ */ u("div", { className: "flex flex-col gap-2", children: [
|
|
449
|
+
/* @__PURE__ */ u("div", { className: "flex items-center justify-between", children: [
|
|
450
450
|
/* @__PURE__ */ t("h3", { className: "text-[10px] font-semibold text-foreground-subtle uppercase tracking-wider", children: "Editing" }),
|
|
451
451
|
/* @__PURE__ */ t("span", { 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", children: e.kind === "tripwire" ? "Tripwire" : "Polygon" })
|
|
452
452
|
] }),
|
|
@@ -478,7 +478,7 @@ function Et({ zone: e, onSave: o, onDiscard: r, onDelete: l }) {
|
|
|
478
478
|
},
|
|
479
479
|
s
|
|
480
480
|
)) }),
|
|
481
|
-
/* @__PURE__ */
|
|
481
|
+
/* @__PURE__ */ u("div", { className: "flex items-center gap-1.5", children: [
|
|
482
482
|
/* @__PURE__ */ t(
|
|
483
483
|
"input",
|
|
484
484
|
{
|
|
@@ -499,12 +499,12 @@ function Et({ zone: e, onSave: o, onDiscard: r, onDelete: l }) {
|
|
|
499
499
|
}
|
|
500
500
|
)
|
|
501
501
|
] }),
|
|
502
|
-
/* @__PURE__ */
|
|
502
|
+
/* @__PURE__ */ u("p", { className: "text-[9px] text-foreground-subtle leading-tight", children: [
|
|
503
503
|
e.kind === "tripwire" ? "2 points" : `${e.points.length} pts`,
|
|
504
504
|
e.points.length > 0 && " · drag handles to reshape"
|
|
505
505
|
] }),
|
|
506
|
-
/* @__PURE__ */
|
|
507
|
-
/* @__PURE__ */
|
|
506
|
+
/* @__PURE__ */ u("div", { className: "flex items-center gap-1.5", children: [
|
|
507
|
+
/* @__PURE__ */ u(
|
|
508
508
|
"button",
|
|
509
509
|
{
|
|
510
510
|
type: "button",
|
|
@@ -517,7 +517,7 @@ function Et({ zone: e, onSave: o, onDiscard: r, onDelete: l }) {
|
|
|
517
517
|
]
|
|
518
518
|
}
|
|
519
519
|
),
|
|
520
|
-
/* @__PURE__ */
|
|
520
|
+
/* @__PURE__ */ u(
|
|
521
521
|
"button",
|
|
522
522
|
{
|
|
523
523
|
type: "button",
|
|
@@ -525,20 +525,20 @@ function Et({ zone: e, onSave: o, onDiscard: r, onDelete: l }) {
|
|
|
525
525
|
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",
|
|
526
526
|
title: "Discard changes (Esc)",
|
|
527
527
|
children: [
|
|
528
|
-
/* @__PURE__ */ t(
|
|
528
|
+
/* @__PURE__ */ t(Ee, { className: "h-3 w-3" }),
|
|
529
529
|
"Discard"
|
|
530
530
|
]
|
|
531
531
|
}
|
|
532
532
|
)
|
|
533
533
|
] }),
|
|
534
|
-
/* @__PURE__ */
|
|
534
|
+
/* @__PURE__ */ u(
|
|
535
535
|
"button",
|
|
536
536
|
{
|
|
537
537
|
type: "button",
|
|
538
538
|
onClick: l,
|
|
539
|
-
className: `${
|
|
539
|
+
className: `${He} w-full`,
|
|
540
540
|
children: [
|
|
541
|
-
/* @__PURE__ */ t(
|
|
541
|
+
/* @__PURE__ */ t(ve, { className: "h-3 w-3" }),
|
|
542
542
|
"Delete"
|
|
543
543
|
]
|
|
544
544
|
}
|
|
@@ -567,11 +567,11 @@ function Ft(e) {
|
|
|
567
567
|
};
|
|
568
568
|
return e.name && (o.name = e.name), e.classFilter.length > 0 && (o.classFilter = e.classFilter), o;
|
|
569
569
|
}
|
|
570
|
-
function
|
|
570
|
+
function we({ dev: e, stage: o, zones: r, title: l }) {
|
|
571
571
|
const p = xe(e?.state.zoneRules), i = U(
|
|
572
572
|
() => p?.[o] ?? [],
|
|
573
573
|
[p, o]
|
|
574
|
-
), [c, s] = L([]), [h, n] = L(!1), [S,
|
|
574
|
+
), [c, s] = L([]), [h, n] = L(!1), [S, d] = L(!1), [Z, b] = L(null);
|
|
575
575
|
X(() => {
|
|
576
576
|
h || s(i.map(Lt));
|
|
577
577
|
}, [i, h]);
|
|
@@ -609,27 +609,27 @@ function Ne({ dev: e, stage: o, zones: r, title: l }) {
|
|
|
609
609
|
s((f) => f.map((g, F) => F === v ? { ...g, ...N } : g)), n(!0);
|
|
610
610
|
}, x = async () => {
|
|
611
611
|
if (e?.zoneRules) {
|
|
612
|
-
|
|
612
|
+
d(!0), b(null);
|
|
613
613
|
try {
|
|
614
614
|
await e.zoneRules.setRules({ stage: o, rules: c.map(Ft) }), n(!1);
|
|
615
615
|
} catch (v) {
|
|
616
616
|
b(v instanceof Error ? v.message : String(v));
|
|
617
617
|
} finally {
|
|
618
|
-
|
|
618
|
+
d(!1);
|
|
619
619
|
}
|
|
620
620
|
}
|
|
621
621
|
}, V = h && !!e?.zoneRules && !S;
|
|
622
|
-
return /* @__PURE__ */
|
|
623
|
-
/* @__PURE__ */
|
|
624
|
-
/* @__PURE__ */ t("h3", { className: `${
|
|
625
|
-
/* @__PURE__ */
|
|
626
|
-
/* @__PURE__ */
|
|
622
|
+
return /* @__PURE__ */ u("div", { className: "rounded-md border border-border bg-surface/40 p-2.5", children: [
|
|
623
|
+
/* @__PURE__ */ u("div", { className: "flex items-center justify-between mb-2 gap-2", children: [
|
|
624
|
+
/* @__PURE__ */ t("h3", { className: `${Ie} truncate`, children: l ?? `${o === "motion" ? "Motion" : "Detection"} Rules` }),
|
|
625
|
+
/* @__PURE__ */ u("div", { className: "flex items-center gap-1 flex-shrink-0", children: [
|
|
626
|
+
/* @__PURE__ */ u(
|
|
627
627
|
"button",
|
|
628
628
|
{
|
|
629
629
|
type: "button",
|
|
630
630
|
onClick: m,
|
|
631
631
|
disabled: r.length === 0 || !e,
|
|
632
|
-
className:
|
|
632
|
+
className: ze,
|
|
633
633
|
title: "Add rule",
|
|
634
634
|
children: [
|
|
635
635
|
/* @__PURE__ */ t(wt, { className: "h-2.5 w-2.5" }),
|
|
@@ -637,7 +637,7 @@ function Ne({ dev: e, stage: o, zones: r, title: l }) {
|
|
|
637
637
|
]
|
|
638
638
|
}
|
|
639
639
|
),
|
|
640
|
-
/* @__PURE__ */
|
|
640
|
+
/* @__PURE__ */ u(
|
|
641
641
|
"button",
|
|
642
642
|
{
|
|
643
643
|
type: "button",
|
|
@@ -645,7 +645,7 @@ function Ne({ dev: e, stage: o, zones: r, title: l }) {
|
|
|
645
645
|
x();
|
|
646
646
|
},
|
|
647
647
|
disabled: !V,
|
|
648
|
-
className:
|
|
648
|
+
className: Ve,
|
|
649
649
|
children: [
|
|
650
650
|
/* @__PURE__ */ t(Ct, { className: "h-2.5 w-2.5" }),
|
|
651
651
|
S ? "…" : "Save"
|
|
@@ -654,12 +654,12 @@ function Ne({ dev: e, stage: o, zones: r, title: l }) {
|
|
|
654
654
|
)
|
|
655
655
|
] })
|
|
656
656
|
] }),
|
|
657
|
-
c.length === 0 ? /* @__PURE__ */ t("p", { className: "text-[10px] text-foreground-subtle italic px-1 py-1.5 leading-tight", children: r.length === 0 ? "Define a zone first — rules reference zone ids." : "No rules — every detection at this stage passes through." }) : /* @__PURE__ */ t("div", { className: "flex flex-col gap-1.5", children: c.map((v, N) => /* @__PURE__ */
|
|
657
|
+
c.length === 0 ? /* @__PURE__ */ t("p", { className: "text-[10px] text-foreground-subtle italic px-1 py-1.5 leading-tight", children: r.length === 0 ? "Define a zone first — rules reference zone ids." : "No rules — every detection at this stage passes through." }) : /* @__PURE__ */ t("div", { className: "flex flex-col gap-1.5", children: c.map((v, N) => /* @__PURE__ */ u(
|
|
658
658
|
"div",
|
|
659
659
|
{
|
|
660
660
|
className: "rounded border border-border/50 bg-background/40 px-2 py-1.5 flex flex-col gap-1.5 overflow-hidden",
|
|
661
661
|
children: [
|
|
662
|
-
/* @__PURE__ */
|
|
662
|
+
/* @__PURE__ */ u("div", { className: "grid grid-cols-[auto_1fr_auto] items-center gap-1.5", children: [
|
|
663
663
|
/* @__PURE__ */ t(
|
|
664
664
|
"button",
|
|
665
665
|
{
|
|
@@ -701,11 +701,11 @@ function Ne({ dev: e, stage: o, zones: r, title: l }) {
|
|
|
701
701
|
"aria-label": "Remove rule",
|
|
702
702
|
onClick: () => M(N),
|
|
703
703
|
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",
|
|
704
|
-
children: /* @__PURE__ */ t(
|
|
704
|
+
children: /* @__PURE__ */ t(ve, { className: "h-3.5 w-3.5" })
|
|
705
705
|
}
|
|
706
706
|
)
|
|
707
707
|
] }),
|
|
708
|
-
/* @__PURE__ */
|
|
708
|
+
/* @__PURE__ */ u("div", { className: "flex items-center gap-1.5 flex-wrap", children: [
|
|
709
709
|
/* @__PURE__ */ t("span", { className: "text-[9px] uppercase tracking-wider text-foreground-subtle w-12 sm:w-14 flex-shrink-0", children: "Mode" }),
|
|
710
710
|
/* @__PURE__ */ t(
|
|
711
711
|
"button",
|
|
@@ -726,11 +726,11 @@ function Ne({ dev: e, stage: o, zones: r, title: l }) {
|
|
|
726
726
|
}
|
|
727
727
|
)
|
|
728
728
|
] }),
|
|
729
|
-
/* @__PURE__ */
|
|
729
|
+
/* @__PURE__ */ u("div", { className: "flex items-center gap-1.5 flex-wrap", children: [
|
|
730
730
|
/* @__PURE__ */ t("span", { className: "text-[9px] uppercase tracking-wider text-foreground-subtle w-12 sm:w-14 flex-shrink-0", children: "Zones" }),
|
|
731
731
|
r.length === 0 ? /* @__PURE__ */ t("span", { className: "text-[10px] text-foreground-subtle italic", children: "none" }) : r.map((f) => {
|
|
732
732
|
const g = v.zoneIds.includes(f.id);
|
|
733
|
-
return /* @__PURE__ */
|
|
733
|
+
return /* @__PURE__ */ u(
|
|
734
734
|
"button",
|
|
735
735
|
{
|
|
736
736
|
type: "button",
|
|
@@ -751,7 +751,7 @@ function Ne({ dev: e, stage: o, zones: r, title: l }) {
|
|
|
751
751
|
);
|
|
752
752
|
})
|
|
753
753
|
] }),
|
|
754
|
-
/* @__PURE__ */
|
|
754
|
+
/* @__PURE__ */ u("div", { className: "flex items-center gap-1.5 flex-wrap", children: [
|
|
755
755
|
/* @__PURE__ */ t("span", { className: "text-[9px] uppercase tracking-wider text-foreground-subtle w-12 sm:w-14 flex-shrink-0", children: "Class" }),
|
|
756
756
|
Rt.map((f) => {
|
|
757
757
|
const g = v.classFilter.includes(f.id);
|
|
@@ -781,13 +781,13 @@ function Q(e, o, r) {
|
|
|
781
781
|
function pe(e, o, r) {
|
|
782
782
|
return { x: e.x / o, y: e.y / r };
|
|
783
783
|
}
|
|
784
|
-
function
|
|
784
|
+
function Ne(e, o, r) {
|
|
785
785
|
return e.flatMap((l) => [l.x * o, l.y * r]);
|
|
786
786
|
}
|
|
787
787
|
function Tt(e, o) {
|
|
788
788
|
return e.color;
|
|
789
789
|
}
|
|
790
|
-
const Ot = "33", Wt = "66",
|
|
790
|
+
const Ot = "33", Wt = "66", Ce = 16, De = 9;
|
|
791
791
|
function jt({
|
|
792
792
|
zones: e,
|
|
793
793
|
selectedZoneId: o,
|
|
@@ -798,7 +798,7 @@ function jt({
|
|
|
798
798
|
backdrop: c,
|
|
799
799
|
transparent: s = !1
|
|
800
800
|
}) {
|
|
801
|
-
const h = Y(null), [n, S] = L({ w: 800, h: 450 }), [
|
|
801
|
+
const h = Y(null), [n, S] = L({ w: 800, h: 450 }), [d, Z] = L([]), [b, m] = L(null), [w, _] = L(null), [M, k] = L(null);
|
|
802
802
|
X(() => {
|
|
803
803
|
if (!M) return;
|
|
804
804
|
const a = e.find((D) => D.id === M.zoneId);
|
|
@@ -838,12 +838,12 @@ function jt({
|
|
|
838
838
|
const D = y.getPointerPosition();
|
|
839
839
|
if (!D) return;
|
|
840
840
|
const C = pe(D, n.w, n.h), T = i === "tripwire";
|
|
841
|
-
if (
|
|
841
|
+
if (d.length === 0) {
|
|
842
842
|
Z([C]);
|
|
843
843
|
return;
|
|
844
844
|
}
|
|
845
|
-
if (T &&
|
|
846
|
-
const O = [...
|
|
845
|
+
if (T && d.length === 1) {
|
|
846
|
+
const O = [...d, C], H = {
|
|
847
847
|
id: crypto.randomUUID(),
|
|
848
848
|
name: "Tripwire",
|
|
849
849
|
kind: "tripwire",
|
|
@@ -853,15 +853,15 @@ function jt({
|
|
|
853
853
|
p(H), Z([]);
|
|
854
854
|
return;
|
|
855
855
|
}
|
|
856
|
-
if (
|
|
857
|
-
const O = Q(
|
|
856
|
+
if (d.length >= 3 && !T) {
|
|
857
|
+
const O = Q(d[0], n.w, n.h);
|
|
858
858
|
if (Math.hypot(D.x - O.x, D.y - O.y) < 12) {
|
|
859
859
|
const ee = {
|
|
860
860
|
id: crypto.randomUUID(),
|
|
861
861
|
name: "Zone",
|
|
862
862
|
kind: "polygon",
|
|
863
863
|
color: "#3b82f6",
|
|
864
|
-
points:
|
|
864
|
+
points: d
|
|
865
865
|
};
|
|
866
866
|
p(ee), Z([]);
|
|
867
867
|
return;
|
|
@@ -869,21 +869,21 @@ function jt({
|
|
|
869
869
|
}
|
|
870
870
|
Z((O) => [...O, C]);
|
|
871
871
|
},
|
|
872
|
-
[x,
|
|
872
|
+
[x, d, n, i, p, r]
|
|
873
873
|
), v = P(
|
|
874
874
|
(a) => {
|
|
875
|
-
if (!x || i === "tripwire" ||
|
|
875
|
+
if (!x || i === "tripwire" || d.length < 3) return;
|
|
876
876
|
a.cancelBubble = !0;
|
|
877
877
|
const y = {
|
|
878
878
|
id: crypto.randomUUID(),
|
|
879
879
|
name: "Zone",
|
|
880
880
|
kind: "polygon",
|
|
881
881
|
color: "#3b82f6",
|
|
882
|
-
points:
|
|
882
|
+
points: d
|
|
883
883
|
};
|
|
884
884
|
p(y), Z([]);
|
|
885
885
|
},
|
|
886
|
-
[x, i,
|
|
886
|
+
[x, i, d, p]
|
|
887
887
|
), N = Y(null), f = Y(null);
|
|
888
888
|
X(() => () => {
|
|
889
889
|
N.current !== null && cancelAnimationFrame(N.current);
|
|
@@ -901,20 +901,20 @@ function jt({
|
|
|
901
901
|
[x]
|
|
902
902
|
), F = [];
|
|
903
903
|
if (!s) {
|
|
904
|
-
for (let a = 1; a <
|
|
905
|
-
const y = n.w /
|
|
904
|
+
for (let a = 1; a < Ce; a++) {
|
|
905
|
+
const y = n.w / Ce * a;
|
|
906
906
|
F.push(
|
|
907
907
|
/* @__PURE__ */ t(G, { points: [y, 0, y, n.h], stroke: "#ffffff", strokeWidth: 0.5, opacity: 0.08 }, `gv-${a}`)
|
|
908
908
|
);
|
|
909
909
|
}
|
|
910
|
-
for (let a = 1; a <
|
|
911
|
-
const y = n.h /
|
|
910
|
+
for (let a = 1; a < De; a++) {
|
|
911
|
+
const y = n.h / De * a;
|
|
912
912
|
F.push(
|
|
913
913
|
/* @__PURE__ */ t(G, { points: [0, y, n.w, y], stroke: "#ffffff", strokeWidth: 0.5, opacity: 0.08 }, `gh-${a}`)
|
|
914
914
|
);
|
|
915
915
|
}
|
|
916
916
|
}
|
|
917
|
-
return /* @__PURE__ */
|
|
917
|
+
return /* @__PURE__ */ u(
|
|
918
918
|
"div",
|
|
919
919
|
{
|
|
920
920
|
ref: h,
|
|
@@ -929,7 +929,7 @@ function jt({
|
|
|
929
929
|
children: c
|
|
930
930
|
}
|
|
931
931
|
) : null,
|
|
932
|
-
/* @__PURE__ */
|
|
932
|
+
/* @__PURE__ */ u(
|
|
933
933
|
et,
|
|
934
934
|
{
|
|
935
935
|
width: n.w,
|
|
@@ -938,26 +938,26 @@ function jt({
|
|
|
938
938
|
onDblClick: v,
|
|
939
939
|
onMouseMove: g,
|
|
940
940
|
children: [
|
|
941
|
-
/* @__PURE__ */
|
|
941
|
+
/* @__PURE__ */ u(de, { listening: !1, children: [
|
|
942
942
|
/* @__PURE__ */ t(G, { points: [0, 0, n.w, 0, n.w, n.h, 0, n.h, 0, 0], stroke: "transparent", strokeWidth: 0 }),
|
|
943
943
|
F
|
|
944
944
|
] }),
|
|
945
945
|
/* @__PURE__ */ t(de, { children: e.map((a) => {
|
|
946
|
-
const y = a.id === o, D = Tt(a), C = M && M.zoneId === a.id ? M.points : a.points, T =
|
|
947
|
-
return /* @__PURE__ */
|
|
946
|
+
const y = a.id === o, D = Tt(a), C = M && M.zoneId === a.id ? M.points : a.points, T = Ne(C, n.w, n.h), O = a.kind === "tripwire", H = y && !x, ee = w === a.id, te = C.map((I) => I.x * n.w), ne = C.map((I) => I.y * n.h), Re = te.length > 0 ? Math.min(...te) : 0, Le = te.length > 0 ? Math.max(...te) : 0, Fe = ne.length > 0 ? Math.min(...ne) : 0, Te = ne.length > 0 ? Math.max(...ne) : 0;
|
|
947
|
+
return /* @__PURE__ */ u(
|
|
948
948
|
ue,
|
|
949
949
|
{
|
|
950
950
|
onClick: (I) => {
|
|
951
951
|
I.cancelBubble = !0, x || r(a.id);
|
|
952
952
|
},
|
|
953
953
|
children: [
|
|
954
|
-
/* @__PURE__ */
|
|
954
|
+
/* @__PURE__ */ u(
|
|
955
955
|
ue,
|
|
956
956
|
{
|
|
957
957
|
draggable: H,
|
|
958
958
|
dragBoundFunc: H ? (I) => ({
|
|
959
|
-
x: Math.max(-
|
|
960
|
-
y: Math.max(-
|
|
959
|
+
x: Math.max(-Re, Math.min(n.w - Le, I.x)),
|
|
960
|
+
y: Math.max(-Fe, Math.min(n.h - Te, I.y))
|
|
961
961
|
}) : void 0,
|
|
962
962
|
onDragStart: H ? () => {
|
|
963
963
|
_(a.id);
|
|
@@ -1039,7 +1039,7 @@ function jt({
|
|
|
1039
1039
|
onDragMove: (E) => {
|
|
1040
1040
|
const R = pe({ x: E.target.x(), y: E.target.y() }, n.w, n.h);
|
|
1041
1041
|
k((A) => {
|
|
1042
|
-
const ce = (A && A.zoneId === a.id ? A.points : a.points).map((
|
|
1042
|
+
const ce = (A && A.zoneId === a.id ? A.points : a.points).map((Oe, We) => We === $ ? R : Oe);
|
|
1043
1043
|
return { zoneId: a.id, points: ce };
|
|
1044
1044
|
});
|
|
1045
1045
|
},
|
|
@@ -1098,23 +1098,23 @@ function jt({
|
|
|
1098
1098
|
a.id
|
|
1099
1099
|
);
|
|
1100
1100
|
}) }),
|
|
1101
|
-
/* @__PURE__ */ t(de, { listening: !1, children: x &&
|
|
1102
|
-
|
|
1101
|
+
/* @__PURE__ */ t(de, { listening: !1, children: x && d.length > 0 && /* @__PURE__ */ u(ue, { children: [
|
|
1102
|
+
d.length >= 2 && i !== "tripwire" && /* @__PURE__ */ t(
|
|
1103
1103
|
G,
|
|
1104
1104
|
{
|
|
1105
|
-
points:
|
|
1105
|
+
points: Ne(d, n.w, n.h),
|
|
1106
1106
|
stroke: "#6366f1",
|
|
1107
1107
|
strokeWidth: 1.5,
|
|
1108
1108
|
dash: [6, 3],
|
|
1109
1109
|
opacity: 0.8
|
|
1110
1110
|
}
|
|
1111
1111
|
),
|
|
1112
|
-
|
|
1112
|
+
d.length === 1 && i === "tripwire" && b && /* @__PURE__ */ t(
|
|
1113
1113
|
G,
|
|
1114
1114
|
{
|
|
1115
1115
|
points: [
|
|
1116
|
-
|
|
1117
|
-
|
|
1116
|
+
d[0].x * n.w,
|
|
1117
|
+
d[0].y * n.h,
|
|
1118
1118
|
b.x,
|
|
1119
1119
|
b.y
|
|
1120
1120
|
],
|
|
@@ -1124,12 +1124,12 @@ function jt({
|
|
|
1124
1124
|
opacity: 0.7
|
|
1125
1125
|
}
|
|
1126
1126
|
),
|
|
1127
|
-
b &&
|
|
1127
|
+
b && d.length >= 1 && i !== "tripwire" && /* @__PURE__ */ t(
|
|
1128
1128
|
G,
|
|
1129
1129
|
{
|
|
1130
1130
|
points: [
|
|
1131
|
-
|
|
1132
|
-
|
|
1131
|
+
d[d.length - 1].x * n.w,
|
|
1132
|
+
d[d.length - 1].y * n.h,
|
|
1133
1133
|
b.x,
|
|
1134
1134
|
b.y
|
|
1135
1135
|
],
|
|
@@ -1139,15 +1139,15 @@ function jt({
|
|
|
1139
1139
|
opacity: 0.5
|
|
1140
1140
|
}
|
|
1141
1141
|
),
|
|
1142
|
-
|
|
1142
|
+
d.map((a, y) => {
|
|
1143
1143
|
const D = Q(a, n.w, n.h), C = y === 0;
|
|
1144
1144
|
return /* @__PURE__ */ t(
|
|
1145
1145
|
fe,
|
|
1146
1146
|
{
|
|
1147
1147
|
x: D.x,
|
|
1148
1148
|
y: D.y,
|
|
1149
|
-
radius: C &&
|
|
1150
|
-
fill: C &&
|
|
1149
|
+
radius: C && d.length >= 3 ? 7 : 4,
|
|
1150
|
+
fill: C && d.length >= 3 ? "#6366f1" : "#ffffff",
|
|
1151
1151
|
stroke: "#6366f1",
|
|
1152
1152
|
strokeWidth: 1.5,
|
|
1153
1153
|
opacity: 0.9
|
|
@@ -1159,12 +1159,12 @@ function jt({
|
|
|
1159
1159
|
]
|
|
1160
1160
|
}
|
|
1161
1161
|
),
|
|
1162
|
-
x ? /* @__PURE__ */ t("div", { className: "px-3 py-1.5 bg-zinc-800/80 text-[11px] text-zinc-400 border-t border-zinc-700", children: i === "tripwire" ? "Click to set start point, click again to complete the tripwire" :
|
|
1162
|
+
x ? /* @__PURE__ */ t("div", { className: "px-3 py-1.5 bg-zinc-800/80 text-[11px] text-zinc-400 border-t border-zinc-700", children: i === "tripwire" ? "Click to set start point, click again to complete the tripwire" : d.length < 3 ? "Click to add points (min 3). Double-click or click first point to close." : "Continue adding points. Double-click or click first point to close." }) : null
|
|
1163
1163
|
]
|
|
1164
1164
|
}
|
|
1165
1165
|
);
|
|
1166
1166
|
}
|
|
1167
|
-
const Bt =
|
|
1167
|
+
const Bt = Ae(jt), qt = "#3b82f6", me = [
|
|
1168
1168
|
"#3b82f6",
|
|
1169
1169
|
"#10b981",
|
|
1170
1170
|
"#f59e0b",
|
|
@@ -1191,7 +1191,7 @@ function Ht(e) {
|
|
|
1191
1191
|
points: [...e.polygon]
|
|
1192
1192
|
};
|
|
1193
1193
|
}
|
|
1194
|
-
function
|
|
1194
|
+
function Se(e) {
|
|
1195
1195
|
return {
|
|
1196
1196
|
id: e.id,
|
|
1197
1197
|
name: e.name,
|
|
@@ -1211,14 +1211,14 @@ function zt({ deviceId: e }) {
|
|
|
1211
1211
|
async (b) => {
|
|
1212
1212
|
const m = { ...b, color: Ut(n) };
|
|
1213
1213
|
try {
|
|
1214
|
-
await r?.zones?.addZone({ zone:
|
|
1214
|
+
await r?.zones?.addZone({ zone: Se(m) });
|
|
1215
1215
|
} catch (w) {
|
|
1216
1216
|
console.error("zones.addZone failed", w);
|
|
1217
1217
|
}
|
|
1218
1218
|
i?.setSelectedZoneId(m.id), i?.setDrawingKind(null);
|
|
1219
1219
|
},
|
|
1220
1220
|
[r, n, i]
|
|
1221
|
-
),
|
|
1221
|
+
), d = P(
|
|
1222
1222
|
async (b, m) => {
|
|
1223
1223
|
if (h && h.id === b) {
|
|
1224
1224
|
i?.updateDraft({ points: m });
|
|
@@ -1227,7 +1227,7 @@ function zt({ deviceId: e }) {
|
|
|
1227
1227
|
const w = n.find((_) => _.id === b);
|
|
1228
1228
|
if (w)
|
|
1229
1229
|
try {
|
|
1230
|
-
await r?.zones?.updateZone({ zone:
|
|
1230
|
+
await r?.zones?.updateZone({ zone: Se({ ...w, points: m }) });
|
|
1231
1231
|
} catch (_) {
|
|
1232
1232
|
console.error("zones.updateZone failed", _);
|
|
1233
1233
|
}
|
|
@@ -1260,14 +1260,14 @@ function zt({ deviceId: e }) {
|
|
|
1260
1260
|
zones: n,
|
|
1261
1261
|
selectedZoneId: s,
|
|
1262
1262
|
onSelectZone: Z,
|
|
1263
|
-
onZonePointsChange:
|
|
1263
|
+
onZonePointsChange: d,
|
|
1264
1264
|
onZoneComplete: S,
|
|
1265
1265
|
drawingKind: c,
|
|
1266
1266
|
transparent: !0
|
|
1267
1267
|
}
|
|
1268
1268
|
);
|
|
1269
1269
|
}
|
|
1270
|
-
const Vt =
|
|
1270
|
+
const Vt = Ae(zt), Gt = "#3b82f6";
|
|
1271
1271
|
function Yt(e) {
|
|
1272
1272
|
return {
|
|
1273
1273
|
id: e.id,
|
|
@@ -1297,7 +1297,7 @@ function Kt({ deviceId: e }) {
|
|
|
1297
1297
|
[e]
|
|
1298
1298
|
);
|
|
1299
1299
|
Ze(S);
|
|
1300
|
-
const
|
|
1300
|
+
const d = P(
|
|
1301
1301
|
(k) => {
|
|
1302
1302
|
if (k === null) {
|
|
1303
1303
|
c?.discardDraft(), c?.setSelectedZoneId(null);
|
|
@@ -1357,30 +1357,30 @@ function Kt({ deviceId: e }) {
|
|
|
1357
1357
|
color: n.color,
|
|
1358
1358
|
points: [...n.points]
|
|
1359
1359
|
}, [i, n]);
|
|
1360
|
-
return /* @__PURE__ */
|
|
1361
|
-
/* @__PURE__ */
|
|
1362
|
-
/* @__PURE__ */ t("div", { className:
|
|
1363
|
-
/* @__PURE__ */ t("h2", { className:
|
|
1364
|
-
/* @__PURE__ */
|
|
1360
|
+
return /* @__PURE__ */ u("div", { className: Ge, children: [
|
|
1361
|
+
/* @__PURE__ */ u("div", { className: Ye, children: [
|
|
1362
|
+
/* @__PURE__ */ t("div", { className: Xe, children: /* @__PURE__ */ u("div", { className: "min-w-0", children: [
|
|
1363
|
+
/* @__PURE__ */ t("h2", { className: Ie, children: "Detection Zones" }),
|
|
1364
|
+
/* @__PURE__ */ u("p", { className: `${J} mt-0.5 leading-tight`, children: [
|
|
1365
1365
|
"Pick a shape below or use the ",
|
|
1366
1366
|
/* @__PURE__ */ t("strong", { className: "text-foreground", children: "Zones" }),
|
|
1367
1367
|
" button on the live frame to draw new polygons or tripwires. Behaviour is set per-stage in the rules editors below — a zone with no rule is observed by analytics but never filters."
|
|
1368
1368
|
] })
|
|
1369
1369
|
] }) }),
|
|
1370
|
-
/* @__PURE__ */
|
|
1370
|
+
/* @__PURE__ */ u("div", { className: `${Ke} flex flex-col gap-3`, children: [
|
|
1371
1371
|
/* @__PURE__ */ t(
|
|
1372
1372
|
At,
|
|
1373
1373
|
{
|
|
1374
1374
|
zones: i,
|
|
1375
1375
|
selectedZoneId: h,
|
|
1376
1376
|
drawingKind: s,
|
|
1377
|
-
onSelectZone:
|
|
1377
|
+
onSelectZone: d,
|
|
1378
1378
|
onDeleteZone: m,
|
|
1379
1379
|
onStartDraw: w,
|
|
1380
1380
|
onCancelDraw: _
|
|
1381
1381
|
}
|
|
1382
1382
|
),
|
|
1383
|
-
M && /* @__PURE__ */
|
|
1383
|
+
M && /* @__PURE__ */ u(be, { children: [
|
|
1384
1384
|
/* @__PURE__ */ t("div", { className: "border-t border-border" }),
|
|
1385
1385
|
/* @__PURE__ */ t(
|
|
1386
1386
|
Et,
|
|
@@ -1394,9 +1394,9 @@ function Kt({ deviceId: e }) {
|
|
|
1394
1394
|
] })
|
|
1395
1395
|
] })
|
|
1396
1396
|
] }),
|
|
1397
|
-
/* @__PURE__ */
|
|
1398
|
-
/* @__PURE__ */ t(
|
|
1399
|
-
/* @__PURE__ */ t(
|
|
1397
|
+
/* @__PURE__ */ u("div", { className: `grid grid-cols-1 2xl:grid-cols-2 ${Qe}`, children: [
|
|
1398
|
+
/* @__PURE__ */ t(we, { dev: r, stage: "motion", zones: p }),
|
|
1399
|
+
/* @__PURE__ */ t(we, { dev: r, stage: "detection", zones: p })
|
|
1400
1400
|
] })
|
|
1401
1401
|
] });
|
|
1402
1402
|
}
|
|
@@ -1412,7 +1412,7 @@ function Jt({ options: e, cells: o, onCellsChange: r }) {
|
|
|
1412
1412
|
_.length = i, _[m] = w, r(_);
|
|
1413
1413
|
},
|
|
1414
1414
|
[o, i, r]
|
|
1415
|
-
),
|
|
1415
|
+
), d = P(
|
|
1416
1416
|
(m) => (w) => {
|
|
1417
1417
|
w.preventDefault();
|
|
1418
1418
|
const _ = !o[m];
|
|
@@ -1445,7 +1445,7 @@ function Jt({ options: e, cells: o, onCellsChange: r }) {
|
|
|
1445
1445
|
type: "button",
|
|
1446
1446
|
"aria-label": `motion cell ${String(w)}`,
|
|
1447
1447
|
"aria-pressed": _,
|
|
1448
|
-
onPointerDown:
|
|
1448
|
+
onPointerDown: d(w),
|
|
1449
1449
|
onPointerEnter: Z(w),
|
|
1450
1450
|
className: _ ? "border border-primary/40 bg-primary/30 hover:bg-primary/40 transition-colors" : "border border-white/15 bg-transparent hover:bg-white/10 transition-colors"
|
|
1451
1451
|
},
|
|
@@ -1459,7 +1459,7 @@ function en(e) {
|
|
|
1459
1459
|
const o = e instanceof Error ? e.message : String(e);
|
|
1460
1460
|
return o.includes("provider not available") || o.includes("motion-zones");
|
|
1461
1461
|
}
|
|
1462
|
-
function
|
|
1462
|
+
function Me(e, o) {
|
|
1463
1463
|
const r = o.gridWidth * o.gridHeight, l = new Array(r);
|
|
1464
1464
|
for (let p = 0; p < r; p += 1) l[p] = e[p] === !0;
|
|
1465
1465
|
return l;
|
|
@@ -1470,7 +1470,7 @@ function tn(e, o) {
|
|
|
1470
1470
|
return !0;
|
|
1471
1471
|
}
|
|
1472
1472
|
function nn({ deviceId: e }) {
|
|
1473
|
-
const o = ae(), r = le(o.trpcClient, e), [l, p] = L(null), [i, c] = L(!1), [s, h] = L(null), [n, S] = L(null), [
|
|
1473
|
+
const o = ae(), r = le(o.trpcClient, e), [l, p] = L(null), [i, c] = L(!1), [s, h] = L(null), [n, S] = L(null), [d, Z] = L(!1), b = Y(!1);
|
|
1474
1474
|
X(() => {
|
|
1475
1475
|
if (!r) return;
|
|
1476
1476
|
let f = !1;
|
|
@@ -1481,7 +1481,7 @@ function nn({ deviceId: e }) {
|
|
|
1481
1481
|
const F = await r.motionZones?.getStatus({});
|
|
1482
1482
|
if (f || !F) return;
|
|
1483
1483
|
b.current = !0;
|
|
1484
|
-
const K =
|
|
1484
|
+
const K = Me(F.cells, g);
|
|
1485
1485
|
S(K), h(K);
|
|
1486
1486
|
} catch (g) {
|
|
1487
1487
|
if (f) return;
|
|
@@ -1510,7 +1510,7 @@ function nn({ deviceId: e }) {
|
|
|
1510
1510
|
await r.motionZones.setZone({ patch: { cells: [...s] } });
|
|
1511
1511
|
const f = await r.motionZones.getStatus({});
|
|
1512
1512
|
if (f) {
|
|
1513
|
-
const g =
|
|
1513
|
+
const g = Me(f.cells, l);
|
|
1514
1514
|
S(g), h(g);
|
|
1515
1515
|
}
|
|
1516
1516
|
} catch (f) {
|
|
@@ -1528,84 +1528,79 @@ function nn({ deviceId: e }) {
|
|
|
1528
1528
|
} : null,
|
|
1529
1529
|
[i, l, s]
|
|
1530
1530
|
);
|
|
1531
|
-
Ze(v)
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
"
|
|
1531
|
+
return Ze(v), /* @__PURE__ */ t("div", { className: "flex flex-col gap-3", children: i ? /* @__PURE__ */ t("p", { className: `${J} leading-relaxed`, children: "This camera doesn't expose an on-board motion-detection grid." }) : !i && l !== null && s !== null ? /* @__PURE__ */ u(be, { children: [
|
|
1532
|
+
/* @__PURE__ */ u("p", { className: `${J} leading-relaxed`, children: [
|
|
1533
|
+
"Click or drag cells on the live frame to paint the region the camera watches for motion, then",
|
|
1534
|
+
" ",
|
|
1535
|
+
/* @__PURE__ */ t("strong", { className: "text-foreground", children: "Save" }),
|
|
1536
|
+
" to push the mask to the camera. Detection on/off and sensitivity are set in the",
|
|
1537
|
+
" ",
|
|
1538
|
+
/* @__PURE__ */ t("strong", { className: "text-foreground", children: "On-camera motion" }),
|
|
1539
|
+
" section."
|
|
1540
|
+
] }),
|
|
1541
|
+
/* @__PURE__ */ u("div", { className: "flex items-center gap-2 flex-wrap", children: [
|
|
1542
|
+
/* @__PURE__ */ t(
|
|
1543
|
+
"button",
|
|
1544
|
+
{
|
|
1545
|
+
type: "button",
|
|
1546
|
+
onClick: () => M(!0),
|
|
1547
|
+
disabled: d,
|
|
1548
|
+
className: "rounded-md border border-border bg-surface px-2 py-1 text-[11px] font-medium text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors",
|
|
1549
|
+
children: "All on"
|
|
1550
|
+
}
|
|
1551
|
+
),
|
|
1552
|
+
/* @__PURE__ */ t(
|
|
1553
|
+
"button",
|
|
1554
|
+
{
|
|
1555
|
+
type: "button",
|
|
1556
|
+
onClick: () => M(!1),
|
|
1557
|
+
disabled: d,
|
|
1558
|
+
className: "rounded-md border border-border bg-surface px-2 py-1 text-[11px] font-medium text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors",
|
|
1559
|
+
children: "All off"
|
|
1560
|
+
}
|
|
1561
|
+
),
|
|
1562
|
+
/* @__PURE__ */ t(
|
|
1563
|
+
"button",
|
|
1564
|
+
{
|
|
1565
|
+
type: "button",
|
|
1566
|
+
onClick: k,
|
|
1567
|
+
disabled: d,
|
|
1568
|
+
className: "rounded-md border border-border bg-surface px-2 py-1 text-[11px] font-medium text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors",
|
|
1569
|
+
children: "Invert"
|
|
1570
|
+
}
|
|
1571
|
+
),
|
|
1572
|
+
/* @__PURE__ */ u("span", { className: `${J} ml-1 tabular-nums`, children: [
|
|
1573
|
+
w,
|
|
1574
|
+
" / ",
|
|
1575
|
+
_,
|
|
1576
|
+
" cells · ",
|
|
1577
|
+
l.gridWidth,
|
|
1578
|
+
"×",
|
|
1579
|
+
l.gridHeight
|
|
1544
1580
|
] }),
|
|
1545
|
-
/* @__PURE__ */
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
{
|
|
1569
|
-
type: "button",
|
|
1570
|
-
onClick: k,
|
|
1571
|
-
disabled: u,
|
|
1572
|
-
className: "rounded-md border border-border bg-surface px-2 py-1 text-[11px] font-medium text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors",
|
|
1573
|
-
children: "Invert"
|
|
1574
|
-
}
|
|
1575
|
-
),
|
|
1576
|
-
/* @__PURE__ */ d("span", { className: `${J} ml-1 tabular-nums`, children: [
|
|
1577
|
-
w,
|
|
1578
|
-
" / ",
|
|
1579
|
-
_,
|
|
1580
|
-
" cells · ",
|
|
1581
|
-
l.gridWidth,
|
|
1582
|
-
"×",
|
|
1583
|
-
l.gridHeight
|
|
1584
|
-
] }),
|
|
1585
|
-
/* @__PURE__ */ t("span", { className: "flex-1" }),
|
|
1586
|
-
/* @__PURE__ */ t(
|
|
1587
|
-
"button",
|
|
1588
|
-
{
|
|
1589
|
-
type: "button",
|
|
1590
|
-
onClick: x,
|
|
1591
|
-
disabled: u || !m,
|
|
1592
|
-
className: "rounded-md border border-border bg-surface px-2 py-1 text-[11px] text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors",
|
|
1593
|
-
children: "Revert"
|
|
1594
|
-
}
|
|
1595
|
-
),
|
|
1596
|
-
/* @__PURE__ */ t(
|
|
1597
|
-
"button",
|
|
1598
|
-
{
|
|
1599
|
-
type: "button",
|
|
1600
|
-
onClick: () => void V(),
|
|
1601
|
-
disabled: u || !m,
|
|
1602
|
-
className: "rounded-md border border-primary/50 bg-primary/15 px-2.5 py-1 text-[11px] font-medium text-primary hover:bg-primary/25 disabled:opacity-40 transition-colors",
|
|
1603
|
-
children: u ? "Saving…" : "Save"
|
|
1604
|
-
}
|
|
1605
|
-
)
|
|
1606
|
-
] })
|
|
1607
|
-
] }) : /* @__PURE__ */ t("p", { className: `${J} leading-relaxed`, children: "Loading the camera's motion grid…" }) })
|
|
1608
|
-
] }) });
|
|
1581
|
+
/* @__PURE__ */ t("span", { className: "flex-1" }),
|
|
1582
|
+
/* @__PURE__ */ t(
|
|
1583
|
+
"button",
|
|
1584
|
+
{
|
|
1585
|
+
type: "button",
|
|
1586
|
+
onClick: x,
|
|
1587
|
+
disabled: d || !m,
|
|
1588
|
+
className: "rounded-md border border-border bg-surface px-2 py-1 text-[11px] text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors",
|
|
1589
|
+
children: "Revert"
|
|
1590
|
+
}
|
|
1591
|
+
),
|
|
1592
|
+
/* @__PURE__ */ t(
|
|
1593
|
+
"button",
|
|
1594
|
+
{
|
|
1595
|
+
type: "button",
|
|
1596
|
+
onClick: () => void V(),
|
|
1597
|
+
disabled: d || !m,
|
|
1598
|
+
className: "rounded-md border border-primary/50 bg-primary/15 px-2.5 py-1 text-[11px] font-medium text-primary hover:bg-primary/25 disabled:opacity-40 transition-colors",
|
|
1599
|
+
children: d ? "Saving…" : "Save"
|
|
1600
|
+
}
|
|
1601
|
+
)
|
|
1602
|
+
] })
|
|
1603
|
+
] }) : /* @__PURE__ */ t("p", { className: `${J} leading-relaxed`, children: "Loading the camera's motion grid…" }) });
|
|
1609
1604
|
}
|
|
1610
1605
|
function rn(e) {
|
|
1611
1606
|
return e.deviceId === void 0 ? /* @__PURE__ */ t("div", { className: "rounded-lg border border-warning/30 bg-warning/10 px-3 py-2 text-xs text-warning", children: "MotionZonesEditor requires a deviceId" }) : /* @__PURE__ */ t(nn, { deviceId: e.deviceId });
|