@camstack/addon-pipeline-orchestrator 0.1.27 → 0.1.28

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.
Files changed (30) hide show
  1. package/dist/@mf-types.zip +0 -0
  2. package/dist/{ReactKonva-BpqYt5jc.mjs → ReactKonva-Rg9MNR62.mjs} +2 -2
  3. package/dist/{__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_sdk__loadShare__.mjs-h5aXOPSA.mjs → __mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_sdk__loadShare__.mjs-lantnv8e.mjs} +1 -1
  4. package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.mjs-C507UJJC.mjs +30 -0
  5. package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.mjs-Bau3YeQq.mjs +35 -0
  6. package/dist/{__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react__loadShare__.mjs-ZXZUECVq.mjs → __mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react__loadShare__.mjs-B9__gOco.mjs} +2 -1
  7. package/dist/{__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react__loadShare__.mjs_commonjs-proxy-WhBt7NtJ.mjs → __mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react__loadShare__.mjs_commonjs-proxy-7px_s7lQ.mjs} +1 -1
  8. package/dist/{__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react_mf_2_dom__loadShare__.mjs_commonjs-proxy-DF7SvkCe.mjs → __mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react_mf_2_dom__loadShare__.mjs_commonjs-proxy-BP356DyI.mjs} +1 -1
  9. package/dist/_stub.js +337 -296
  10. package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-zq9nTFza.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-LTEdXGaz.mjs} +6 -6
  11. package/dist/{client-BOhSywdX.mjs → client-DRnvBKkB.mjs} +2 -2
  12. package/dist/{hostInit-Cn3hiNRr.mjs → hostInit-I-qi78F9.mjs} +13 -13
  13. package/dist/{index-kp_mtnZv.mjs → index-B7LnRgSE.mjs} +1 -1
  14. package/dist/{index-C_khSbT0.mjs → index-BRAmQOXI.mjs} +253 -267
  15. package/dist/{index-3tmcVweY.mjs → index-CSDhxUNV.mjs} +1 -1
  16. package/dist/index-Dhyr_mtg.mjs +52894 -0
  17. package/dist/{index-Dy2V7VOm.mjs → index-DtOI1aTU.mjs} +10112 -5987
  18. package/dist/{index-D4m79gq7.mjs → index-DujcNO2E.mjs} +1 -1
  19. package/dist/{index-Bx39JFVr.mjs → index-LZ9uQOMe.mjs} +1 -1
  20. package/dist/index.js +4194 -931
  21. package/dist/index.js.map +1 -1
  22. package/dist/index.mjs +4194 -931
  23. package/dist/index.mjs.map +1 -1
  24. package/dist/{jsx-runtime-ChcQDQxt.mjs → jsx-runtime-C5ymGPwR.mjs} +1 -1
  25. package/dist/remoteEntry.js +1 -1
  26. package/dist/{schemas-ClCuS4qa.mjs → schemas-B7L0qZtq.mjs} +411 -406
  27. package/package.json +1 -1
  28. package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.mjs-CP1zJ0aB.mjs +0 -20
  29. package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.mjs-B1VWqPID.mjs +0 -35
  30. package/dist/index-D_QOQy3W.mjs +0 -22990
package/dist/_stub.js CHANGED
@@ -1,8 +1,8 @@
1
- import { _ as t, a as i, b as X } from "./__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.mjs-Cg6QsnjR.mjs";
2
- import { _ as B } from "./__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.mjs-DoWbefqS.mjs";
3
- import { _ as V, a as re, b as oe, c as O, d as q, e as ae, f as U, g as P, h as se, i as z, j as J, k as ie, l as le, m as A, n as F, o as T, p as ce, q as de, r as ue, s as pe, t as me, u as fe, v as he, w as ge } from "./__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.mjs-B1VWqPID.mjs";
4
- import { a as Y, b as K, c as Z, d as R, e as be, f as xe, g as w } from "./__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react__loadShare__.mjs-ZXZUECVq.mjs";
5
- import { _ as ye } from "./__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.mjs-CP1zJ0aB.mjs";
1
+ import { _ as t, a as i, b as J } from "./__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.mjs-Cg6QsnjR.mjs";
2
+ import { _ as T } from "./__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.mjs-DoWbefqS.mjs";
3
+ import { _ as Q, a as re, b as oe, c as B, d as U, e as ae, f as z, g as K, h as se, i as V, j as Y, k as ie, l as le, m as R, n as E, o as L, p as ce, q as de, r as ue, s as pe, t as me, u as fe, v as he, w as ge } from "./__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.mjs-Bau3YeQq.mjs";
4
+ import { a as ee, b as O, c as M, d as j, e as be, f as ye, g as w } from "./__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react__loadShare__.mjs-B9__gOco.mjs";
5
+ import { _ as xe } from "./__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.mjs-C507UJJC.mjs";
6
6
  /**
7
7
  * @license lucide-react v0.511.0 - ISC
8
8
  *
@@ -11,11 +11,11 @@ import { _ as ye } from "./__mfe_internal__addon_pipeline_orchestrator_widgets__
11
11
  */
12
12
  const _e = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), ve = (e) => e.replace(
13
13
  /^([A-Z])|[\s-_]+(\w)/g,
14
- (o, n, p) => p ? p.toUpperCase() : n.toLowerCase()
15
- ), Q = (e) => {
14
+ (o, n, d) => d ? d.toUpperCase() : n.toLowerCase()
15
+ ), W = (e) => {
16
16
  const o = ve(e);
17
17
  return o.charAt(0).toUpperCase() + o.slice(1);
18
- }, ee = (...e) => e.filter((o, n, p) => !!o && o.trim() !== "" && p.indexOf(o) === n).join(" ").trim(), ke = (e) => {
18
+ }, te = (...e) => e.filter((o, n, d) => !!o && o.trim() !== "" && d.indexOf(o) === n).join(" ").trim(), ke = (e) => {
19
19
  for (const o in e)
20
20
  if (o.startsWith("aria-") || o === "role" || o === "title")
21
21
  return !0;
@@ -43,32 +43,32 @@ var we = {
43
43
  * This source code is licensed under the ISC license.
44
44
  * See the LICENSE file in the root directory of this source tree.
45
45
  */
46
- const Ne = Y(
46
+ const Ne = ee(
47
47
  ({
48
48
  color: e = "currentColor",
49
49
  size: o = 24,
50
50
  strokeWidth: n = 2,
51
- absoluteStrokeWidth: p,
52
- className: m = "",
53
- children: a,
54
- iconNode: s,
51
+ absoluteStrokeWidth: d,
52
+ className: f = "",
53
+ children: s,
54
+ iconNode: a,
55
55
  ...r
56
- }, f) => K(
56
+ }, h) => O(
57
57
  "svg",
58
58
  {
59
- ref: f,
59
+ ref: h,
60
60
  ...we,
61
61
  width: o,
62
62
  height: o,
63
63
  stroke: e,
64
- strokeWidth: p ? Number(n) * 24 / Number(o) : n,
65
- className: ee("lucide", m),
66
- ...!a && !ke(r) && { "aria-hidden": "true" },
64
+ strokeWidth: d ? Number(n) * 24 / Number(o) : n,
65
+ className: te("lucide", f),
66
+ ...!s && !ke(r) && { "aria-hidden": "true" },
67
67
  ...r
68
68
  },
69
69
  [
70
- ...s.map(([l, k]) => K(l, k)),
71
- ...Array.isArray(a) ? a : [a]
70
+ ...a.map(([l, v]) => O(l, v)),
71
+ ...Array.isArray(s) ? s : [s]
72
72
  ]
73
73
  )
74
74
  );
@@ -78,20 +78,20 @@ const Ne = Y(
78
78
  * This source code is licensed under the ISC license.
79
79
  * See the LICENSE file in the root directory of this source tree.
80
80
  */
81
- const v = (e, o) => {
82
- const n = Y(
83
- ({ className: p, ...m }, a) => K(Ne, {
84
- ref: a,
81
+ const k = (e, o) => {
82
+ const n = ee(
83
+ ({ className: d, ...f }, s) => O(Ne, {
84
+ ref: s,
85
85
  iconNode: o,
86
- className: ee(
87
- `lucide-${_e(Q(e))}`,
86
+ className: te(
87
+ `lucide-${_e(W(e))}`,
88
88
  `lucide-${e}`,
89
- p
89
+ d
90
90
  ),
91
- ...m
91
+ ...f
92
92
  })
93
93
  );
94
- return n.displayName = Q(e), n;
94
+ return n.displayName = W(e), n;
95
95
  };
96
96
  /**
97
97
  * @license lucide-react v0.511.0 - ISC
@@ -107,14 +107,14 @@ const Ce = [
107
107
  key: "169zse"
108
108
  }
109
109
  ]
110
- ], De = v("activity", Ce);
110
+ ], De = k("activity", Ce);
111
111
  /**
112
112
  * @license lucide-react v0.511.0 - ISC
113
113
  *
114
114
  * This source code is licensed under the ISC license.
115
115
  * See the LICENSE file in the root directory of this source tree.
116
116
  */
117
- const Se = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]], Ze = v("check", Se);
117
+ const Se = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]], Me = k("check", Se);
118
118
  /**
119
119
  * @license lucide-react v0.511.0 - ISC
120
120
  *
@@ -136,14 +136,14 @@ const $e = [
136
136
  ["path", { d: "M7 2v2", key: "1i4yhu" }],
137
137
  ["rect", { x: "4", y: "4", width: "16", height: "16", rx: "2", key: "1vbyd7" }],
138
138
  ["rect", { x: "8", y: "8", width: "8", height: "8", rx: "1", key: "z9xiuo" }]
139
- ], Ie = v("cpu", $e);
139
+ ], Ze = k("cpu", $e);
140
140
  /**
141
141
  * @license lucide-react v0.511.0 - ISC
142
142
  *
143
143
  * This source code is licensed under the ISC license.
144
144
  * See the LICENSE file in the root directory of this source tree.
145
145
  */
146
- const Me = [
146
+ const Ie = [
147
147
  [
148
148
  "path",
149
149
  {
@@ -152,7 +152,7 @@ const Me = [
152
152
  }
153
153
  ],
154
154
  ["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
155
- ], Ae = v("eye", Me);
155
+ ], Ae = k("eye", Ie);
156
156
  /**
157
157
  * @license lucide-react v0.511.0 - ISC
158
158
  *
@@ -162,7 +162,7 @@ const Me = [
162
162
  const Fe = [
163
163
  ["path", { d: "m12 14 4-4", key: "9kzdfg" }],
164
164
  ["path", { d: "M3.34 19a10 10 0 1 1 17.32 0", key: "19p75a" }]
165
- ], Te = v("gauge", Fe);
165
+ ], Te = k("gauge", Fe);
166
166
  /**
167
167
  * @license lucide-react v0.511.0 - ISC
168
168
  *
@@ -177,14 +177,14 @@ const Re = [
177
177
  key: "yt0hxn"
178
178
  }
179
179
  ]
180
- ], Ee = v("hexagon", Re);
180
+ ], Ee = k("hexagon", Re);
181
181
  /**
182
182
  * @license lucide-react v0.511.0 - ISC
183
183
  *
184
184
  * This source code is licensed under the ISC license.
185
185
  * See the LICENSE file in the root directory of this source tree.
186
186
  */
187
- const je = [["path", { d: "M5 12h14", key: "1ays0h" }]], Le = v("minus", je);
187
+ const Le = [["path", { d: "M5 12h14", key: "1ays0h" }]], je = k("minus", Le);
188
188
  /**
189
189
  * @license lucide-react v0.511.0 - ISC
190
190
  *
@@ -194,14 +194,14 @@ const je = [["path", { d: "M5 12h14", key: "1ays0h" }]], Le = v("minus", je);
194
194
  const Pe = [
195
195
  ["path", { d: "M5 12h14", key: "1ays0h" }],
196
196
  ["path", { d: "M12 5v14", key: "s699le" }]
197
- ], Ke = v("plus", Pe);
197
+ ], qe = k("plus", Pe);
198
198
  /**
199
199
  * @license lucide-react v0.511.0 - ISC
200
200
  *
201
201
  * This source code is licensed under the ISC license.
202
202
  * See the LICENSE file in the root directory of this source tree.
203
203
  */
204
- const Oe = [
204
+ const Ke = [
205
205
  [
206
206
  "path",
207
207
  {
@@ -211,27 +211,43 @@ const Oe = [
211
211
  ],
212
212
  ["path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7", key: "1ydtos" }],
213
213
  ["path", { d: "M7 3v4a1 1 0 0 0 1 1h7", key: "t51u73" }]
214
- ], qe = v("save", Oe);
214
+ ], Oe = k("save", Ke);
215
215
  /**
216
216
  * @license lucide-react v0.511.0 - ISC
217
217
  *
218
218
  * This source code is licensed under the ISC license.
219
219
  * See the LICENSE file in the root directory of this source tree.
220
220
  */
221
- const Ue = [
221
+ const Be = [
222
222
  ["path", { d: "M3 6h18", key: "d0wm0j" }],
223
223
  ["path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6", key: "4alrt4" }],
224
224
  ["path", { d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2", key: "v07s0e" }],
225
225
  ["line", { x1: "10", x2: "10", y1: "11", y2: "17", key: "1uufr5" }],
226
226
  ["line", { x1: "14", x2: "14", y1: "11", y2: "17", key: "xtxkd" }]
227
- ], H = v("trash-2", Ue);
227
+ ], H = k("trash-2", Be);
228
+ /**
229
+ * @license lucide-react v0.511.0 - ISC
230
+ *
231
+ * This source code is licensed under the ISC license.
232
+ * See the LICENSE file in the root directory of this source tree.
233
+ */
234
+ const Ue = [
235
+ [
236
+ "path",
237
+ {
238
+ d: "m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",
239
+ key: "ftymec"
240
+ }
241
+ ],
242
+ ["rect", { x: "2", y: "6", width: "14", height: "12", rx: "2", key: "158x01" }]
243
+ ], ze = k("video", Ue);
228
244
  /**
229
245
  * @license lucide-react v0.511.0 - ISC
230
246
  *
231
247
  * This source code is licensed under the ISC license.
232
248
  * See the LICENSE file in the root directory of this source tree.
233
249
  */
234
- const ze = [
250
+ const Ve = [
235
251
  [
236
252
  "path",
237
253
  {
@@ -241,99 +257,124 @@ const ze = [
241
257
  ],
242
258
  ["path", { d: "M16 9a5 5 0 0 1 0 6", key: "1q6k2b" }],
243
259
  ["path", { d: "M19.364 18.364a9 9 0 0 0 0-12.728", key: "ijwkga" }]
244
- ], He = v("volume-2", ze);
260
+ ], He = k("volume-2", Ve);
245
261
  /**
246
262
  * @license lucide-react v0.511.0 - ISC
247
263
  *
248
264
  * This source code is licensed under the ISC license.
249
265
  * See the LICENSE file in the root directory of this source tree.
250
266
  */
251
- const Be = [
267
+ const Qe = [
252
268
  ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
253
269
  ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
254
- ], te = v("x", Be);
255
- function Ve(e) {
256
- 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(Qe, { deviceId: e.deviceId });
270
+ ], ne = k("x", Qe);
271
+ function We(e) {
272
+ 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(Ge, { deviceId: e.deviceId });
257
273
  }
258
- function Qe({ deviceId: e }) {
259
- V(
274
+ function Ge({ deviceId: e }) {
275
+ Q(
260
276
  ["pipelineOrchestrator", "getPipelineAssignment"],
261
277
  ["pipeline.camera-assigned", "pipeline.camera-unassigned", "pipeline.camera-updated"]
262
- ), V(
278
+ ), Q(
263
279
  ["pipelineRunner", "getCameraMetrics"],
264
280
  ["pipeline.camera-metrics-snapshot"]
265
281
  );
266
282
  const { data: o } = re(
267
283
  { deviceId: e },
268
284
  { staleTime: 3e4 }
269
- ), n = o?.agentNodeId ?? null, m = typeof n == "string" && n.length > 0 && !n.startsWith("addon:") ? n : void 0, { data: a } = oe(
285
+ ), n = o?.agentNodeId ?? null, f = typeof n == "string" && n.length > 0 && !n.startsWith("addon:") ? n : void 0, { data: s } = oe(
270
286
  {
271
287
  deviceId: e,
272
- ...m ? { nodeId: m } : {}
288
+ ...f ? { nodeId: f } : {}
273
289
  },
274
290
  { staleTime: 2e3, retry: !1 }
275
- ), s = O(), r = q(s.trpcClient, e), { data: f } = B({
291
+ ), a = B(), r = U(a.trpcClient, e), { data: h } = T({
276
292
  queryKey: ["device", e, "pipelineAnalytics.getActiveTracks"],
277
293
  queryFn: () => r?.pipelineAnalytics?.getActiveTracks({}) ?? [],
278
294
  enabled: !!r,
279
295
  refetchInterval: 5e3,
280
296
  retry: !1
281
- }), { data: l } = B({
297
+ }), { data: l } = T({
282
298
  queryKey: ["device", e, "audioMetrics.getCurrentSnapshot"],
283
299
  queryFn: () => r?.audioMetrics?.getCurrentSnapshot({}) ?? null,
284
300
  enabled: !!r,
285
301
  refetchInterval: 2e3,
286
302
  retry: !1
287
- }), k = a?.phase ?? null, D = a?.detectionMode ?? null, N = Number(a?.actualFps ?? 0), C = Number(a?.configuredFps ?? 0), S = Number(a?.avgInferenceTimeMs ?? 0), c = Number(a?.queueDepth ?? 0), g = Number(a?.droppedFrames ?? 0), _ = ae(k ?? "watching"), u = f?.length ?? 0, h = l?.level.dbfs ?? null, $ = typeof h == "number" ? `${h.toFixed(1)} dBFS` : "—";
303
+ }), { data: v } = T({
304
+ queryKey: ["recording.getStatus", e],
305
+ queryFn: async () => await a.trpcClient.recording.getStatus.query({ deviceId: e }),
306
+ refetchInterval: 5e3,
307
+ retry: !1
308
+ }), { data: C } = T({
309
+ queryKey: ["recording.getDeviceConfig", e],
310
+ queryFn: async () => await a.trpcClient.recording.getDeviceConfig.query({ deviceId: e }),
311
+ staleTime: 3e4,
312
+ retry: !1
313
+ }), N = s?.phase ?? null, D = s?.detectionMode ?? null, S = Number(s?.actualFps ?? 0), u = Number(s?.configuredFps ?? 0), y = Number(s?.avgInferenceTimeMs ?? 0), _ = Number(s?.queueDepth ?? 0), p = Number(s?.droppedFrames ?? 0), g = ae(N ?? "watching"), A = h?.length ?? 0, c = l?.level.dbfs ?? null, x = typeof c == "number" ? `${c.toFixed(1)} dBFS` : "—", b = v?.enabled ?? !1, m = v?.activeMode ?? "off", $ = b && m !== "off", P = b ? m === "off" ? "Idle" : m === "continuous" ? "Continuous" : m === "onMotion" ? "On motion" : m === "onAudioThreshold" ? "On audio" : m : "Disabled", Z = (C?.profiles ?? []).join(", "), F = v ? `${Xe(v.storageBytes ?? 0)}${Z ? ` · ${Z}` : ""}` : void 0;
288
314
  return /* @__PURE__ */ i("div", { className: "grid grid-cols-[repeat(auto-fit,minmax(180px,1fr))] gap-3", children: [
289
315
  /* @__PURE__ */ t(
290
- M,
316
+ I,
291
317
  {
292
318
  icon: De,
293
319
  label: "Phase",
294
- value: _.label,
295
- color: _.textColor,
320
+ value: g.label,
321
+ color: g.textColor,
296
322
  subtext: D ?? void 0
297
323
  }
298
324
  ),
299
325
  /* @__PURE__ */ t(
300
- M,
326
+ I,
301
327
  {
302
328
  icon: Te,
303
329
  label: "Detection FPS",
304
- value: `${N.toFixed(1)}`,
305
- subtext: C > 0 ? `target: ${C}` : void 0
330
+ value: `${S.toFixed(1)}`,
331
+ subtext: u > 0 ? `target: ${u}` : void 0
306
332
  }
307
333
  ),
308
334
  /* @__PURE__ */ t(
309
- M,
335
+ I,
310
336
  {
311
- icon: Ie,
337
+ icon: Ze,
312
338
  label: "Inference",
313
- value: `${S.toFixed(1)} ms`,
314
- subtext: c > 0 ? `queue: ${c}` : void 0
339
+ value: `${y.toFixed(1)} ms`,
340
+ subtext: _ > 0 ? `queue: ${_}` : void 0
315
341
  }
316
342
  ),
317
343
  /* @__PURE__ */ t(
318
- M,
344
+ I,
319
345
  {
320
346
  icon: Ae,
321
347
  label: "Active Tracks",
322
- value: String(u),
323
- subtext: g > 0 ? `dropped: ${g}` : void 0
348
+ value: String(A),
349
+ subtext: p > 0 ? `dropped: ${p}` : void 0
324
350
  }
325
351
  ),
326
352
  /* @__PURE__ */ t(
327
- M,
353
+ I,
328
354
  {
329
355
  icon: He,
330
356
  label: "Current dB",
331
- value: $
357
+ value: x
358
+ }
359
+ ),
360
+ /* @__PURE__ */ t(
361
+ I,
362
+ {
363
+ icon: ze,
364
+ label: "Recording",
365
+ value: P,
366
+ color: $ ? "text-success" : void 0,
367
+ subtext: F
332
368
  }
333
369
  )
334
370
  ] });
335
371
  }
336
- function M({ icon: e, label: o, value: n, subtext: p, color: m }) {
372
+ function Xe(e) {
373
+ if (!Number.isFinite(e) || e <= 0) return "0 B";
374
+ const o = ["B", "KB", "MB", "GB", "TB"], n = Math.min(o.length - 1, Math.floor(Math.log(e) / Math.log(1024))), d = e / 1024 ** n;
375
+ return `${n === 0 ? Math.round(d) : d.toFixed(1)} ${o[n]}`;
376
+ }
377
+ function I({ icon: e, label: o, value: n, subtext: d, color: f }) {
337
378
  return /* @__PURE__ */ i("div", { className: "rounded-lg border border-border bg-surface p-3 min-w-0", children: [
338
379
  /* @__PURE__ */ i("div", { className: "flex items-center gap-1.5 mb-1 min-w-0", children: [
339
380
  /* @__PURE__ */ t(e, { className: "h-3.5 w-3.5 text-foreground-subtle flex-shrink-0" }),
@@ -349,49 +390,49 @@ function M({ icon: e, label: o, value: n, subtext: p, color: m }) {
349
390
  /* @__PURE__ */ t(
350
391
  "p",
351
392
  {
352
- className: `text-lg font-semibold leading-tight truncate ${m ?? "text-foreground"}`,
393
+ className: `text-lg font-semibold leading-tight truncate ${f ?? "text-foreground"}`,
353
394
  title: n,
354
395
  children: n
355
396
  }
356
397
  ),
357
- p && /* @__PURE__ */ t("p", { className: "text-[10px] text-foreground-subtle mt-0.5 truncate", title: p, children: p })
398
+ d && /* @__PURE__ */ t("p", { className: "text-[10px] text-foreground-subtle mt-0.5 truncate", title: d, children: d })
358
399
  ] });
359
400
  }
360
- const We = {
401
+ const Je = {
361
402
  polygon: "Polygon",
362
403
  tripwire: "Tripwire"
363
- }, Ge = {
404
+ }, Ye = {
364
405
  polygon: "bg-info/10 text-info",
365
406
  tripwire: "bg-warning/10 text-warning"
366
407
  };
367
- function Xe({
408
+ function et({
368
409
  zones: e,
369
410
  selectedZoneId: o,
370
411
  drawingKind: n,
371
- onSelectZone: p,
372
- onDeleteZone: m,
373
- onStartDraw: a,
374
- onCancelDraw: s
412
+ onSelectZone: d,
413
+ onDeleteZone: f,
414
+ onStartDraw: s,
415
+ onCancelDraw: a
375
416
  }) {
376
417
  return /* @__PURE__ */ i("div", { className: "flex flex-col gap-2", children: [
377
418
  /* @__PURE__ */ t("div", { className: "flex items-center gap-1", children: n ? /* @__PURE__ */ i(
378
419
  "button",
379
420
  {
380
421
  type: "button",
381
- onClick: s,
422
+ onClick: a,
382
423
  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",
383
424
  title: "Cancel drawing",
384
425
  children: [
385
- /* @__PURE__ */ t(te, { className: "h-3.5 w-3.5" }),
426
+ /* @__PURE__ */ t(ne, { className: "h-3.5 w-3.5" }),
386
427
  /* @__PURE__ */ t("span", { children: "Cancel" })
387
428
  ]
388
429
  }
389
- ) : /* @__PURE__ */ i(X, { children: [
430
+ ) : /* @__PURE__ */ i(J, { children: [
390
431
  /* @__PURE__ */ t(
391
432
  "button",
392
433
  {
393
434
  type: "button",
394
- onClick: () => a("polygon"),
435
+ onClick: () => s("polygon"),
395
436
  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",
396
437
  title: "Add polygon zone",
397
438
  "aria-label": "Add polygon zone",
@@ -402,24 +443,24 @@ function Xe({
402
443
  "button",
403
444
  {
404
445
  type: "button",
405
- onClick: () => a("tripwire"),
446
+ onClick: () => s("tripwire"),
406
447
  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",
407
448
  title: "Add tripwire",
408
449
  "aria-label": "Add tripwire",
409
- children: /* @__PURE__ */ t(Le, { className: "h-5 w-5 stroke-[2.5]" })
450
+ children: /* @__PURE__ */ t(je, { className: "h-5 w-5 stroke-[2.5]" })
410
451
  }
411
452
  )
412
453
  ] }) }),
413
454
  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((r) => {
414
- const f = r.id === o;
455
+ const h = r.id === o;
415
456
  return /* @__PURE__ */ i(
416
457
  "div",
417
458
  {
418
459
  className: [
419
460
  "flex items-center gap-1.5 rounded border px-1.5 py-1 cursor-pointer transition-colors",
420
- f ? "border-primary/50 bg-primary/10" : "border-border bg-surface hover:bg-surface-hover"
461
+ h ? "border-primary/50 bg-primary/10" : "border-border bg-surface hover:bg-surface-hover"
421
462
  ].join(" "),
422
- onClick: () => p(f ? null : r.id),
463
+ onClick: () => d(h ? null : r.id),
423
464
  children: [
424
465
  /* @__PURE__ */ t(
425
466
  "div",
@@ -432,8 +473,8 @@ function Xe({
432
473
  /* @__PURE__ */ t(
433
474
  "span",
434
475
  {
435
- className: `inline-flex items-center rounded-full px-1.5 py-0.5 text-[9px] font-medium flex-shrink-0 ${Ge[r.kind]}`,
436
- children: We[r.kind]
476
+ className: `inline-flex items-center rounded-full px-1.5 py-0.5 text-[9px] font-medium flex-shrink-0 ${Ye[r.kind]}`,
477
+ children: Je[r.kind]
437
478
  }
438
479
  ),
439
480
  /* @__PURE__ */ t(
@@ -443,7 +484,7 @@ function Xe({
443
484
  title: "Delete zone",
444
485
  className: "p-0.5 text-foreground-subtle hover:text-danger rounded transition-colors flex-shrink-0",
445
486
  onClick: (l) => {
446
- l.stopPropagation(), m(r.id);
487
+ l.stopPropagation(), f(r.id);
447
488
  },
448
489
  children: /* @__PURE__ */ t(H, { className: "h-3 w-3" })
449
490
  }
@@ -455,7 +496,7 @@ function Xe({
455
496
  }) })
456
497
  ] });
457
498
  }
458
- const Je = [
499
+ const tt = [
459
500
  "#3b82f6",
460
501
  // blue
461
502
  "#10b981",
@@ -473,8 +514,8 @@ const Je = [
473
514
  "#ec4899"
474
515
  // pink
475
516
  ];
476
- function Ye({ zone: e, onSave: o, onDiscard: n, onDelete: p }) {
477
- const m = U(), a = (r) => m?.updateDraft({ name: r }), s = (r) => m?.updateDraft({ color: r });
517
+ function nt({ zone: e, onSave: o, onDiscard: n, onDelete: d }) {
518
+ const f = z(), s = (r) => f?.updateDraft({ name: r }), a = (r) => f?.updateDraft({ color: r });
478
519
  return /* @__PURE__ */ i("div", { className: "flex flex-col gap-2", children: [
479
520
  /* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: [
480
521
  /* @__PURE__ */ t("h3", { className: "text-[10px] font-semibold text-foreground-subtle uppercase tracking-wider", children: "Editing" }),
@@ -484,17 +525,17 @@ function Ye({ zone: e, onSave: o, onDiscard: n, onDelete: p }) {
484
525
  "input",
485
526
  {
486
527
  type: "text",
487
- className: P,
528
+ className: K,
488
529
  value: e.name,
489
530
  autoFocus: !0,
490
- onChange: (r) => a(r.target.value),
531
+ onChange: (r) => s(r.target.value),
491
532
  onKeyDown: (r) => {
492
533
  r.key === "Enter" ? (r.preventDefault(), o()) : r.key === "Escape" && (r.preventDefault(), n());
493
534
  },
494
535
  placeholder: "Zone name"
495
536
  }
496
537
  ),
497
- /* @__PURE__ */ t("div", { className: "flex flex-wrap gap-1", children: Je.map((r) => /* @__PURE__ */ t(
538
+ /* @__PURE__ */ t("div", { className: "flex flex-wrap gap-1", children: tt.map((r) => /* @__PURE__ */ t(
498
539
  "button",
499
540
  {
500
541
  type: "button",
@@ -504,7 +545,7 @@ function Ye({ zone: e, onSave: o, onDiscard: n, onDelete: p }) {
504
545
  e.color === r ? "border-white scale-110" : "border-transparent"
505
546
  ].join(" "),
506
547
  style: { backgroundColor: r },
507
- onClick: () => s(r)
548
+ onClick: () => a(r)
508
549
  },
509
550
  r
510
551
  )) }),
@@ -515,17 +556,17 @@ function Ye({ zone: e, onSave: o, onDiscard: n, onDelete: p }) {
515
556
  type: "color",
516
557
  className: "h-6 w-6 rounded border border-border bg-background cursor-pointer p-0.5",
517
558
  value: e.color,
518
- onChange: (r) => s(r.target.value)
559
+ onChange: (r) => a(r.target.value)
519
560
  }
520
561
  ),
521
562
  /* @__PURE__ */ t(
522
563
  "input",
523
564
  {
524
565
  type: "text",
525
- className: `${P} font-mono`,
566
+ className: `${K} font-mono`,
526
567
  value: e.color,
527
568
  placeholder: "#000000",
528
- onChange: (r) => s(r.target.value)
569
+ onChange: (r) => a(r.target.value)
529
570
  }
530
571
  )
531
572
  ] }),
@@ -542,7 +583,7 @@ function Ye({ zone: e, onSave: o, onDiscard: n, onDelete: p }) {
542
583
  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",
543
584
  title: "Save changes (Enter)",
544
585
  children: [
545
- /* @__PURE__ */ t(Ze, { className: "h-3 w-3" }),
586
+ /* @__PURE__ */ t(Me, { className: "h-3 w-3" }),
546
587
  "Save"
547
588
  ]
548
589
  }
@@ -555,7 +596,7 @@ function Ye({ zone: e, onSave: o, onDiscard: n, onDelete: p }) {
555
596
  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",
556
597
  title: "Discard changes (Esc)",
557
598
  children: [
558
- /* @__PURE__ */ t(te, { className: "h-3 w-3" }),
599
+ /* @__PURE__ */ t(ne, { className: "h-3 w-3" }),
559
600
  "Discard"
560
601
  ]
561
602
  }
@@ -565,7 +606,7 @@ function Ye({ zone: e, onSave: o, onDiscard: n, onDelete: p }) {
565
606
  "button",
566
607
  {
567
608
  type: "button",
568
- onClick: p,
609
+ onClick: d,
569
610
  className: `${se} w-full`,
570
611
  children: [
571
612
  /* @__PURE__ */ t(H, { className: "h-3 w-3" }),
@@ -575,10 +616,10 @@ function Ye({ zone: e, onSave: o, onDiscard: n, onDelete: p }) {
575
616
  )
576
617
  ] });
577
618
  }
578
- const et = ye.map(
619
+ const rt = xe.map(
579
620
  (e) => ({ id: e.id, label: e.name })
580
621
  );
581
- function tt(e) {
622
+ function ot(e) {
582
623
  return {
583
624
  id: e.id,
584
625
  name: e.name ?? "",
@@ -588,7 +629,7 @@ function tt(e) {
588
629
  enabled: e.enabled !== !1
589
630
  };
590
631
  }
591
- function nt(e) {
632
+ function at(e) {
592
633
  const o = {
593
634
  id: e.id,
594
635
  zoneIds: e.zoneIds,
@@ -597,17 +638,17 @@ function nt(e) {
597
638
  };
598
639
  return e.name && (o.name = e.name), e.classFilter.length > 0 && (o.classFilter = e.classFilter), o;
599
640
  }
600
- function W({ dev: e, stage: o, zones: n, title: p }) {
601
- const m = z(e?.state.zoneRules), a = Z(
602
- () => m?.[o] ?? [],
603
- [m, o]
604
- ), [s, r] = R([]), [f, l] = R(!1), [k, D] = R(!1), [N, C] = R(null);
641
+ function G({ dev: e, stage: o, zones: n, title: d }) {
642
+ const f = V(e?.state.zoneRules), s = M(
643
+ () => f?.[o] ?? [],
644
+ [f, o]
645
+ ), [a, r] = j([]), [h, l] = j(!1), [v, C] = j(!1), [N, D] = j(null);
605
646
  be(() => {
606
- f || r(a.map(tt));
607
- }, [a, f]);
647
+ h || r(s.map(ot));
648
+ }, [s, h]);
608
649
  const S = () => {
609
- r((d) => [
610
- ...d,
650
+ r((c) => [
651
+ ...c,
611
652
  {
612
653
  id: crypto.randomUUID(),
613
654
  name: "",
@@ -617,41 +658,41 @@ function W({ dev: e, stage: o, zones: n, title: p }) {
617
658
  enabled: !0
618
659
  }
619
660
  ]), l(!0);
620
- }, c = (d, y) => {
661
+ }, u = (c, x) => {
621
662
  r(
622
- (b) => b.map((x, I) => {
623
- if (I !== d) return x;
624
- const E = x.classFilter.includes(y) ? x.classFilter.filter((j) => j !== y) : [...x.classFilter, y];
625
- return { ...x, classFilter: E };
663
+ (b) => b.map((m, $) => {
664
+ if ($ !== c) return m;
665
+ const Z = m.classFilter.includes(x) ? m.classFilter.filter((F) => F !== x) : [...m.classFilter, x];
666
+ return { ...m, classFilter: Z };
626
667
  })
627
668
  ), l(!0);
628
- }, g = (d, y) => {
669
+ }, y = (c, x) => {
629
670
  r(
630
- (b) => b.map((x, I) => {
631
- if (I !== d) return x;
632
- const E = x.zoneIds.includes(y) ? x.zoneIds.filter((j) => j !== y) : [...x.zoneIds, y];
633
- return { ...x, zoneIds: E };
671
+ (b) => b.map((m, $) => {
672
+ if ($ !== c) return m;
673
+ const Z = m.zoneIds.includes(x) ? m.zoneIds.filter((F) => F !== x) : [...m.zoneIds, x];
674
+ return { ...m, zoneIds: Z };
634
675
  })
635
676
  ), l(!0);
636
- }, _ = (d) => {
637
- r((y) => y.filter((b, x) => x !== d)), l(!0);
638
- }, u = (d, y) => {
639
- r((b) => b.map((x, I) => I === d ? { ...x, ...y } : x)), l(!0);
640
- }, h = async () => {
677
+ }, _ = (c) => {
678
+ r((x) => x.filter((b, m) => m !== c)), l(!0);
679
+ }, p = (c, x) => {
680
+ r((b) => b.map((m, $) => $ === c ? { ...m, ...x } : m)), l(!0);
681
+ }, g = async () => {
641
682
  if (e?.zoneRules) {
642
- D(!0), C(null);
683
+ C(!0), D(null);
643
684
  try {
644
- await e.zoneRules.setRules({ stage: o, rules: s.map(nt) }), l(!1);
645
- } catch (d) {
646
- C(d instanceof Error ? d.message : String(d));
685
+ await e.zoneRules.setRules({ stage: o, rules: a.map(at) }), l(!1);
686
+ } catch (c) {
687
+ D(c instanceof Error ? c.message : String(c));
647
688
  } finally {
648
- D(!1);
689
+ C(!1);
649
690
  }
650
691
  }
651
- }, $ = f && !!e?.zoneRules && !k;
692
+ }, A = h && !!e?.zoneRules && !v;
652
693
  return /* @__PURE__ */ i("div", { className: "rounded-md border border-border bg-surface/40 p-2.5", children: [
653
694
  /* @__PURE__ */ i("div", { className: "flex items-center justify-between mb-2 gap-2", children: [
654
- /* @__PURE__ */ t("h3", { className: `${J} truncate`, children: p ?? `${o === "motion" ? "Motion" : "Detection"} Rules` }),
695
+ /* @__PURE__ */ t("h3", { className: `${Y} truncate`, children: d ?? `${o === "motion" ? "Motion" : "Detection"} Rules` }),
655
696
  /* @__PURE__ */ i("div", { className: "flex items-center gap-1 flex-shrink-0", children: [
656
697
  /* @__PURE__ */ i(
657
698
  "button",
@@ -662,7 +703,7 @@ function W({ dev: e, stage: o, zones: n, title: p }) {
662
703
  className: ie,
663
704
  title: "Add rule",
664
705
  children: [
665
- /* @__PURE__ */ t(Ke, { className: "h-2.5 w-2.5" }),
706
+ /* @__PURE__ */ t(qe, { className: "h-2.5 w-2.5" }),
666
707
  " Add"
667
708
  ]
668
709
  }
@@ -672,19 +713,19 @@ function W({ dev: e, stage: o, zones: n, title: p }) {
672
713
  {
673
714
  type: "button",
674
715
  onClick: () => {
675
- h();
716
+ g();
676
717
  },
677
- disabled: !$,
718
+ disabled: !A,
678
719
  className: le,
679
720
  children: [
680
- /* @__PURE__ */ t(qe, { className: "h-2.5 w-2.5" }),
681
- k ? "…" : "Save"
721
+ /* @__PURE__ */ t(Oe, { className: "h-2.5 w-2.5" }),
722
+ v ? "…" : "Save"
682
723
  ]
683
724
  }
684
725
  )
685
726
  ] })
686
727
  ] }),
687
- s.length === 0 ? /* @__PURE__ */ t("p", { className: "text-[10px] text-foreground-subtle italic px-1 py-1.5 leading-tight", children: n.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: s.map((d, y) => /* @__PURE__ */ i(
728
+ a.length === 0 ? /* @__PURE__ */ t("p", { className: "text-[10px] text-foreground-subtle italic px-1 py-1.5 leading-tight", children: n.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: a.map((c, x) => /* @__PURE__ */ i(
688
729
  "div",
689
730
  {
690
731
  className: "rounded border border-border/50 bg-background/40 px-2 py-1.5 flex flex-col gap-1.5 overflow-hidden",
@@ -695,20 +736,20 @@ function W({ dev: e, stage: o, zones: n, title: p }) {
695
736
  {
696
737
  type: "button",
697
738
  role: "switch",
698
- "aria-checked": d.enabled,
699
- "aria-label": d.enabled ? "Disable rule" : "Enable rule",
700
- title: d.enabled ? "Rule is active — click to disable" : "Rule is disabled — click to enable",
701
- onClick: () => u(y, { enabled: !d.enabled }),
739
+ "aria-checked": c.enabled,
740
+ "aria-label": c.enabled ? "Disable rule" : "Enable rule",
741
+ title: c.enabled ? "Rule is active — click to disable" : "Rule is disabled — click to enable",
742
+ onClick: () => p(x, { enabled: !c.enabled }),
702
743
  className: [
703
744
  "inline-flex items-center justify-center h-5 w-9 rounded-full border transition-colors flex-shrink-0",
704
- d.enabled ? "border-primary/50 bg-primary/20 text-primary" : "border-border bg-surface text-foreground-subtle"
745
+ c.enabled ? "border-primary/50 bg-primary/20 text-primary" : "border-border bg-surface text-foreground-subtle"
705
746
  ].join(" "),
706
747
  children: /* @__PURE__ */ t(
707
748
  "span",
708
749
  {
709
750
  className: [
710
751
  "h-3 w-3 rounded-full transition-transform",
711
- d.enabled ? "translate-x-1.5 bg-primary" : "-translate-x-1.5 bg-foreground-subtle"
752
+ c.enabled ? "translate-x-1.5 bg-primary" : "-translate-x-1.5 bg-foreground-subtle"
712
753
  ].join(" ")
713
754
  }
714
755
  )
@@ -717,10 +758,10 @@ function W({ dev: e, stage: o, zones: n, title: p }) {
717
758
  /* @__PURE__ */ t(
718
759
  "input",
719
760
  {
720
- className: `${P} min-w-0`,
761
+ className: `${K} min-w-0`,
721
762
  placeholder: "Rule name (optional)",
722
- value: d.name,
723
- onChange: (b) => u(y, { name: b.target.value })
763
+ value: c.name,
764
+ onChange: (b) => p(x, { name: b.target.value })
724
765
  }
725
766
  ),
726
767
  /* @__PURE__ */ t(
@@ -729,7 +770,7 @@ function W({ dev: e, stage: o, zones: n, title: p }) {
729
770
  type: "button",
730
771
  title: "Remove rule",
731
772
  "aria-label": "Remove rule",
732
- onClick: () => _(y),
773
+ onClick: () => _(x),
733
774
  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",
734
775
  children: /* @__PURE__ */ t(H, { className: "h-3.5 w-3.5" })
735
776
  }
@@ -741,8 +782,8 @@ function W({ dev: e, stage: o, zones: n, title: p }) {
741
782
  "button",
742
783
  {
743
784
  type: "button",
744
- onClick: () => u(y, { mode: "include" }),
745
- className: `${A} ${d.mode === "include" ? F : T}`,
785
+ onClick: () => p(x, { mode: "include" }),
786
+ className: `${R} ${c.mode === "include" ? E : L}`,
746
787
  children: "Include"
747
788
  }
748
789
  ),
@@ -750,8 +791,8 @@ function W({ dev: e, stage: o, zones: n, title: p }) {
750
791
  "button",
751
792
  {
752
793
  type: "button",
753
- onClick: () => u(y, { mode: "exclude" }),
754
- className: `${A} ${d.mode === "exclude" ? F : T}`,
794
+ onClick: () => p(x, { mode: "exclude" }),
795
+ className: `${R} ${c.mode === "exclude" ? E : L}`,
755
796
  children: "Exclude"
756
797
  }
757
798
  )
@@ -759,13 +800,13 @@ function W({ dev: e, stage: o, zones: n, title: p }) {
759
800
  /* @__PURE__ */ i("div", { className: "flex items-center gap-1.5 flex-wrap", children: [
760
801
  /* @__PURE__ */ t("span", { className: "text-[9px] uppercase tracking-wider text-foreground-subtle w-12 sm:w-14 flex-shrink-0", children: "Zones" }),
761
802
  n.length === 0 ? /* @__PURE__ */ t("span", { className: "text-[10px] text-foreground-subtle italic", children: "none" }) : n.map((b) => {
762
- const x = d.zoneIds.includes(b.id);
803
+ const m = c.zoneIds.includes(b.id);
763
804
  return /* @__PURE__ */ i(
764
805
  "button",
765
806
  {
766
807
  type: "button",
767
- onClick: () => g(y, b.id),
768
- className: `${A} ${x ? F : T}`,
808
+ onClick: () => y(x, b.id),
809
+ className: `${R} ${m ? E : L}`,
769
810
  children: [
770
811
  /* @__PURE__ */ t(
771
812
  "span",
@@ -783,39 +824,39 @@ function W({ dev: e, stage: o, zones: n, title: p }) {
783
824
  ] }),
784
825
  /* @__PURE__ */ i("div", { className: "flex items-center gap-1.5 flex-wrap", children: [
785
826
  /* @__PURE__ */ t("span", { className: "text-[9px] uppercase tracking-wider text-foreground-subtle w-12 sm:w-14 flex-shrink-0", children: "Class" }),
786
- et.map((b) => {
787
- const x = d.classFilter.includes(b.id);
827
+ rt.map((b) => {
828
+ const m = c.classFilter.includes(b.id);
788
829
  return /* @__PURE__ */ t(
789
830
  "button",
790
831
  {
791
832
  type: "button",
792
- onClick: () => c(y, b.id),
793
- className: `${A} ${x ? F : T}`,
833
+ onClick: () => u(x, b.id),
834
+ className: `${R} ${m ? E : L}`,
794
835
  children: b.label
795
836
  },
796
837
  b.id
797
838
  );
798
839
  }),
799
- d.classFilter.length === 0 && /* @__PURE__ */ t("span", { className: "text-[10px] text-foreground-subtle italic ml-1", children: "any" })
840
+ c.classFilter.length === 0 && /* @__PURE__ */ t("span", { className: "text-[10px] text-foreground-subtle italic ml-1", children: "any" })
800
841
  ] })
801
842
  ]
802
843
  },
803
- d.id
844
+ c.id
804
845
  )) }),
805
846
  N && /* @__PURE__ */ t("p", { className: "mt-2 text-[10px] text-danger", children: N })
806
847
  ] });
807
848
  }
808
- function rt(e) {
849
+ function st(e) {
809
850
  const o = e.kind === "tripwire" ? { kind: "line", points: e.points } : { kind: "polygon", points: e.points };
810
851
  return { id: e.id, label: e.name, color: e.color, shape: o };
811
852
  }
812
- function ot(e) {
853
+ function it(e) {
813
854
  return e === "line" ? "tripwire" : "polygon";
814
855
  }
815
- function at(e) {
856
+ function lt(e) {
816
857
  return e === "tripwire" ? "line" : "polygon";
817
858
  }
818
- const st = "#3b82f6", it = ["polygon", "line"], L = [
859
+ const ct = "#3b82f6", dt = ["polygon", "line"], q = [
819
860
  "#3b82f6",
820
861
  "#10b981",
821
862
  "#f59e0b",
@@ -827,22 +868,22 @@ const st = "#3b82f6", it = ["polygon", "line"], L = [
827
868
  "#8b5cf6",
828
869
  "#14b8a6"
829
870
  ];
830
- function lt(e) {
871
+ function ut(e) {
831
872
  const o = new Set(e.map((n) => (n.color ?? "").toLowerCase()));
832
- for (const n of L)
873
+ for (const n of q)
833
874
  if (!o.has(n.toLowerCase())) return n;
834
- return L[e.length % L.length];
875
+ return q[e.length % q.length];
835
876
  }
836
- function ct(e) {
877
+ function pt(e) {
837
878
  return {
838
879
  id: e.id,
839
880
  name: e.name,
840
881
  kind: e.kind,
841
- color: e.color || st,
882
+ color: e.color || ct,
842
883
  points: [...e.polygon]
843
884
  };
844
885
  }
845
- function G(e) {
886
+ function X(e) {
846
887
  return {
847
888
  id: e.id,
848
889
  name: e.name,
@@ -851,101 +892,101 @@ function G(e) {
851
892
  color: e.color
852
893
  };
853
894
  }
854
- function dt({ deviceId: e }) {
855
- const o = O(), n = q(o.trpcClient, e), p = z(n?.state.zones), m = Z(() => p?.zones ?? [], [p]), a = U(), s = a?.drawingKind ?? null, r = a?.selectedZoneId ?? null, f = a?.editingDraft ?? null, l = Z(() => m.map((c) => f && f.id === c.id ? {
856
- id: f.id,
857
- name: f.name,
858
- kind: f.kind,
859
- color: f.color,
860
- points: [...f.points]
861
- } : ct(c)), [m, f]), k = Z(() => l.map(rt), [l]), D = w(
862
- async (c) => {
863
- if (c.kind !== "polygon" && c.kind !== "line") return;
864
- const g = {
895
+ function mt({ deviceId: e }) {
896
+ const o = B(), n = U(o.trpcClient, e), d = V(n?.state.zones), f = M(() => d?.zones ?? [], [d]), s = z(), a = s?.drawingKind ?? null, r = s?.selectedZoneId ?? null, h = s?.editingDraft ?? null, l = M(() => f.map((u) => h && h.id === u.id ? {
897
+ id: h.id,
898
+ name: h.name,
899
+ kind: h.kind,
900
+ color: h.color,
901
+ points: [...h.points]
902
+ } : pt(u)), [f, h]), v = M(() => l.map(st), [l]), C = w(
903
+ async (u) => {
904
+ if (u.kind !== "polygon" && u.kind !== "line") return;
905
+ const y = {
865
906
  id: crypto.randomUUID(),
866
907
  name: "",
867
- kind: ot(c.kind),
868
- color: lt(l),
869
- points: [...c.points]
908
+ kind: it(u.kind),
909
+ color: ut(l),
910
+ points: [...u.points]
870
911
  };
871
912
  try {
872
- await n?.zones?.addZone({ zone: G(g) });
913
+ await n?.zones?.addZone({ zone: X(y) });
873
914
  } catch (_) {
874
915
  console.error("zones.addZone failed", _);
875
916
  }
876
- a?.setSelectedZoneId(g.id), a?.setDrawingKind(null);
917
+ s?.setSelectedZoneId(y.id), s?.setDrawingKind(null);
877
918
  },
878
- [n, l, a]
919
+ [n, l, s]
879
920
  ), N = w(
880
- async (c, g) => {
881
- const _ = g.map((h) => ({ x: h.x, y: h.y }));
882
- if (f && f.id === c) {
883
- a?.updateDraft({ points: _ });
921
+ async (u, y) => {
922
+ const _ = y.map((g) => ({ x: g.x, y: g.y }));
923
+ if (h && h.id === u) {
924
+ s?.updateDraft({ points: _ });
884
925
  return;
885
926
  }
886
- const u = l.find((h) => h.id === c);
887
- if (u)
927
+ const p = l.find((g) => g.id === u);
928
+ if (p)
888
929
  try {
889
- await n?.zones?.updateZone({ zone: G({ ...u, points: _ }) });
890
- } catch (h) {
891
- console.error("zones.updateZone failed", h);
930
+ await n?.zones?.updateZone({ zone: X({ ...p, points: _ }) });
931
+ } catch (g) {
932
+ console.error("zones.updateZone failed", g);
892
933
  }
893
934
  },
894
- [n, l, f, a]
895
- ), C = w(
896
- (c, g) => {
897
- typeof c == "string" && (g.kind !== "polygon" && g.kind !== "line" || N(c, g.points));
935
+ [n, l, h, s]
936
+ ), D = w(
937
+ (u, y) => {
938
+ typeof u == "string" && (y.kind !== "polygon" && y.kind !== "line" || N(u, y.points));
898
939
  },
899
940
  [N]
900
941
  ), S = w(
901
- (c) => {
902
- if (c === null) {
903
- a?.discardDraft(), a?.setSelectedZoneId(null);
942
+ (u) => {
943
+ if (u === null) {
944
+ s?.discardDraft(), s?.setSelectedZoneId(null);
904
945
  return;
905
946
  }
906
- if (typeof c != "string") return;
907
- const g = l.find((_) => _.id === c);
908
- if (!g) {
909
- a?.setSelectedZoneId(c);
947
+ if (typeof u != "string") return;
948
+ const y = l.find((_) => _.id === u);
949
+ if (!y) {
950
+ s?.setSelectedZoneId(u);
910
951
  return;
911
952
  }
912
- a?.enterDraft({
913
- id: g.id,
914
- kind: g.kind,
915
- name: g.name,
916
- color: g.color,
917
- points: g.points
953
+ s?.enterDraft({
954
+ id: y.id,
955
+ kind: y.kind,
956
+ name: y.name,
957
+ color: y.color,
958
+ points: y.points
918
959
  });
919
960
  },
920
- [l, a]
961
+ [l, s]
921
962
  );
922
- return l.length === 0 && s === null ? null : /* @__PURE__ */ t(
963
+ return l.length === 0 && a === null ? null : /* @__PURE__ */ t(
923
964
  ce,
924
965
  {
925
966
  transparent: !0,
926
- items: k,
927
- supportedShapes: it,
967
+ items: v,
968
+ supportedShapes: dt,
928
969
  selectedId: r,
929
970
  onSelect: S,
930
- onShapeChange: C,
931
- onDrawComplete: (c) => {
932
- D(c);
971
+ onShapeChange: D,
972
+ onDrawComplete: (u) => {
973
+ C(u);
933
974
  },
934
- drawingKind: s === null ? null : at(s)
975
+ drawingKind: a === null ? null : lt(a)
935
976
  }
936
977
  );
937
978
  }
938
- const ut = xe(dt), pt = "#3b82f6";
939
- function mt(e) {
979
+ const ft = ye(mt), ht = "#3b82f6";
980
+ function gt(e) {
940
981
  return {
941
982
  id: e.id,
942
983
  name: e.name,
943
984
  kind: e.kind,
944
- color: e.color || pt,
985
+ color: e.color || ht,
945
986
  points: [...e.polygon]
946
987
  };
947
988
  }
948
- function ft(e) {
989
+ function bt(e) {
949
990
  return {
950
991
  id: e.id,
951
992
  name: e.name,
@@ -954,81 +995,81 @@ function ft(e) {
954
995
  color: e.color
955
996
  };
956
997
  }
957
- function ht({ deviceId: e }) {
958
- const o = O(), n = q(o.trpcClient, e), p = z(n?.state.zones), m = Z(() => p?.zones ?? [], [p]), a = Z(() => m.map(mt), [m]), s = U(), r = s?.drawingKind ?? null, f = s?.selectedZoneId ?? null, l = s?.editingDraft ?? null, k = Z(
998
+ function yt({ deviceId: e }) {
999
+ const o = B(), n = U(o.trpcClient, e), d = V(n?.state.zones), f = M(() => d?.zones ?? [], [d]), s = M(() => f.map(gt), [f]), a = z(), r = a?.drawingKind ?? null, h = a?.selectedZoneId ?? null, l = a?.editingDraft ?? null, v = M(
959
1000
  () => ({
960
1001
  id: "zones",
961
1002
  order: 100,
962
1003
  // above PTZ overlay (order 0) so handles aren't occluded
963
- node: /* @__PURE__ */ t(ut, { deviceId: e })
1004
+ node: /* @__PURE__ */ t(ft, { deviceId: e })
964
1005
  }),
965
1006
  [e]
966
1007
  );
967
- de(k);
968
- const D = w(
969
- (u) => {
970
- if (u === null) {
971
- s?.discardDraft(), s?.setSelectedZoneId(null);
1008
+ de(v);
1009
+ const C = w(
1010
+ (p) => {
1011
+ if (p === null) {
1012
+ a?.discardDraft(), a?.setSelectedZoneId(null);
972
1013
  return;
973
1014
  }
974
- const h = a.find(($) => $.id === u);
975
- h && s?.enterDraft({
976
- id: h.id,
977
- kind: h.kind,
978
- name: h.name,
979
- color: h.color,
980
- points: h.points
1015
+ const g = s.find((A) => A.id === p);
1016
+ g && a?.enterDraft({
1017
+ id: g.id,
1018
+ kind: g.kind,
1019
+ name: g.name,
1020
+ color: g.color,
1021
+ points: g.points
981
1022
  });
982
1023
  },
983
- [a, s]
1024
+ [s, a]
984
1025
  ), N = w(async () => {
985
- const u = s?.editingDraft;
986
- if (u) {
1026
+ const p = a?.editingDraft;
1027
+ if (p) {
987
1028
  try {
988
1029
  await n?.zones?.updateZone({
989
- zone: ft({
990
- id: u.id,
991
- kind: u.kind,
992
- name: u.name,
993
- color: u.color,
994
- points: [...u.points]
1030
+ zone: bt({
1031
+ id: p.id,
1032
+ kind: p.kind,
1033
+ name: p.name,
1034
+ color: p.color,
1035
+ points: [...p.points]
995
1036
  })
996
1037
  });
997
- } catch (h) {
998
- console.error("zones.updateZone failed", h);
1038
+ } catch (g) {
1039
+ console.error("zones.updateZone failed", g);
999
1040
  }
1000
- s?.discardDraft(), s?.setSelectedZoneId(null);
1041
+ a?.discardDraft(), a?.setSelectedZoneId(null);
1001
1042
  }
1002
- }, [n, s]), C = w(() => {
1003
- s?.discardDraft(), s?.setSelectedZoneId(null);
1004
- }, [s]), S = w(
1005
- async (u) => {
1043
+ }, [n, a]), D = w(() => {
1044
+ a?.discardDraft(), a?.setSelectedZoneId(null);
1045
+ }, [a]), S = w(
1046
+ async (p) => {
1006
1047
  try {
1007
- await n?.zones?.removeZone({ zoneId: u });
1008
- } catch (h) {
1009
- console.error("zones.removeZone failed", h);
1048
+ await n?.zones?.removeZone({ zoneId: p });
1049
+ } catch (g) {
1050
+ console.error("zones.removeZone failed", g);
1010
1051
  }
1011
- s?.selectedZoneId === u && s.setSelectedZoneId(null), s?.editingDraft?.id === u && s.discardDraft();
1052
+ a?.selectedZoneId === p && a.setSelectedZoneId(null), a?.editingDraft?.id === p && a.discardDraft();
1012
1053
  },
1013
- [n, s]
1014
- ), c = w(
1015
- (u) => {
1016
- s?.startDrawing(u);
1054
+ [n, a]
1055
+ ), u = w(
1056
+ (p) => {
1057
+ a?.startDrawing(p);
1017
1058
  },
1018
- [s]
1019
- ), g = w(() => {
1020
- s?.setDrawingKind(null);
1021
- }, [s]), _ = Z(() => !l || !a.find((h) => h.id === l.id) ? null : {
1059
+ [a]
1060
+ ), y = w(() => {
1061
+ a?.setDrawingKind(null);
1062
+ }, [a]), _ = M(() => !l || !s.find((g) => g.id === l.id) ? null : {
1022
1063
  id: l.id,
1023
1064
  kind: l.kind,
1024
1065
  name: l.name,
1025
1066
  color: l.color,
1026
1067
  points: [...l.points]
1027
- }, [a, l]);
1068
+ }, [s, l]);
1028
1069
  return /* @__PURE__ */ i("div", { className: ue, children: [
1029
1070
  /* @__PURE__ */ i("div", { className: pe, children: [
1030
1071
  /* @__PURE__ */ t("div", { className: me, children: /* @__PURE__ */ i("div", { className: "min-w-0", children: [
1031
- /* @__PURE__ */ t("h2", { className: J, children: "Detection Zones" }),
1072
+ /* @__PURE__ */ t("h2", { className: Y, children: "Detection Zones" }),
1032
1073
  /* @__PURE__ */ i("p", { className: `${fe} mt-0.5 leading-tight`, children: [
1033
1074
  "Pick a shape below or use the ",
1034
1075
  /* @__PURE__ */ t("strong", { className: "text-foreground", children: "Zones" }),
@@ -1037,25 +1078,25 @@ function ht({ deviceId: e }) {
1037
1078
  ] }) }),
1038
1079
  /* @__PURE__ */ i("div", { className: `${he} flex flex-col gap-3`, children: [
1039
1080
  /* @__PURE__ */ t(
1040
- Xe,
1081
+ et,
1041
1082
  {
1042
- zones: a,
1043
- selectedZoneId: f,
1083
+ zones: s,
1084
+ selectedZoneId: h,
1044
1085
  drawingKind: r,
1045
- onSelectZone: D,
1086
+ onSelectZone: C,
1046
1087
  onDeleteZone: S,
1047
- onStartDraw: c,
1048
- onCancelDraw: g
1088
+ onStartDraw: u,
1089
+ onCancelDraw: y
1049
1090
  }
1050
1091
  ),
1051
- _ && /* @__PURE__ */ i(X, { children: [
1092
+ _ && /* @__PURE__ */ i(J, { children: [
1052
1093
  /* @__PURE__ */ t("div", { className: "border-t border-border" }),
1053
1094
  /* @__PURE__ */ t(
1054
- Ye,
1095
+ nt,
1055
1096
  {
1056
1097
  zone: _,
1057
1098
  onSave: N,
1058
- onDiscard: C,
1099
+ onDiscard: D,
1059
1100
  onDelete: () => S(_.id)
1060
1101
  }
1061
1102
  )
@@ -1063,18 +1104,18 @@ function ht({ deviceId: e }) {
1063
1104
  ] })
1064
1105
  ] }),
1065
1106
  /* @__PURE__ */ i("div", { className: `grid grid-cols-1 2xl:grid-cols-2 ${ge}`, children: [
1066
- /* @__PURE__ */ t(W, { dev: n, stage: "motion", zones: m }),
1067
- /* @__PURE__ */ t(W, { dev: n, stage: "detection", zones: m })
1107
+ /* @__PURE__ */ t(G, { dev: n, stage: "motion", zones: f }),
1108
+ /* @__PURE__ */ t(G, { dev: n, stage: "detection", zones: f })
1068
1109
  ] })
1069
1110
  ] });
1070
1111
  }
1071
- function gt(e) {
1072
- 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: "ZoneEditor requires a deviceId" }) : /* @__PURE__ */ t(ht, { deviceId: e.deviceId });
1112
+ function xt(e) {
1113
+ 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: "ZoneEditor requires a deviceId" }) : /* @__PURE__ */ t(yt, { deviceId: e.deviceId });
1073
1114
  }
1074
- const kt = {
1075
- "pipeline-quick-stats": Ve,
1076
- "zone-editor": gt
1115
+ const Ct = {
1116
+ "pipeline-quick-stats": We,
1117
+ "zone-editor": xt
1077
1118
  };
1078
1119
  export {
1079
- kt as default
1120
+ Ct as default
1080
1121
  };