@camstack/addon-pipeline-orchestrator 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/_stub.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import { t as e } from "./_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-BiLBDmU5.mjs";
2
- import { a as t, i as n, n as r, o as i, r as a, s as o, t as s } from "./_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react__loadShare__.js-CBokMOYQ.mjs";
3
- import { C as c, S as l, _ as u, a as d, b as f, c as p, d as m, f as h, g, h as _, i as v, l as y, m as b, n as x, o as S, p as C, r as w, s as T, t as E, u as D, v as O, w as k, x as A, y as j } from "./_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-CnELcfi3.mjs";
4
- import { n as M, r as N, t as P } from "./_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-yD-rMaFX.mjs";
5
- import { t as F } from "./_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DTMQMZQR.mjs";
2
+ import { a as t, c as n, i as r, n as i, o as a, r as o, s, t as c } from "./_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react__loadShare__.js-a8tvh93M.mjs";
3
+ import { C as l, S as u, _ as d, a as f, b as p, c as m, d as h, f as g, g as _, h as v, i as y, l as b, m as x, n as S, o as C, p as w, r as T, s as E, t as D, u as O, v as k, w as A, x as j, y as M } from "./_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-DVwAHhw9.mjs";
4
+ import { n as N, r as P, t as F } from "./_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-yD-rMaFX.mjs";
5
+ import { t as I } from "./_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DTMQMZQR.mjs";
6
6
  //#region ../../node_modules/lucide-react/dist/esm/shared/src/utils.js
7
- var I = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), ee = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), L = (e) => {
8
- let t = ee(e);
7
+ var ee = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), te = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), L = (e) => {
8
+ let t = te(e);
9
9
  return t.charAt(0).toUpperCase() + t.slice(1);
10
- }, R = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), z = (e) => {
10
+ }, R = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), ne = (e) => {
11
11
  for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
12
- }, te = {
12
+ }, re = {
13
13
  xmlns: "http://www.w3.org/2000/svg",
14
14
  width: 24,
15
15
  height: 24,
@@ -19,31 +19,31 @@ var I = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), ee = (e)
19
19
  strokeWidth: 2,
20
20
  strokeLinecap: "round",
21
21
  strokeLinejoin: "round"
22
- }, ne = r(({ color: e = "currentColor", size: t = 24, strokeWidth: n = 2, absoluteStrokeWidth: r, className: i = "", children: a, iconNode: o, ...c }, l) => s("svg", {
22
+ }, ie = i(({ color: e = "currentColor", size: t = 24, strokeWidth: n = 2, absoluteStrokeWidth: r, className: i = "", children: a, iconNode: o, ...s }, l) => c("svg", {
23
23
  ref: l,
24
- ...te,
24
+ ...re,
25
25
  width: t,
26
26
  height: t,
27
27
  stroke: e,
28
28
  strokeWidth: r ? Number(n) * 24 / Number(t) : n,
29
29
  className: R("lucide", i),
30
- ...!a && !z(c) && { "aria-hidden": "true" },
31
- ...c
32
- }, [...o.map(([e, t]) => s(e, t)), ...Array.isArray(a) ? a : [a]])), B = (e, t) => {
33
- let n = r(({ className: n, ...r }, i) => s(ne, {
30
+ ...!a && !ne(s) && { "aria-hidden": "true" },
31
+ ...s
32
+ }, [...o.map(([e, t]) => c(e, t)), ...Array.isArray(a) ? a : [a]])), z = (e, t) => {
33
+ let n = i(({ className: n, ...r }, i) => c(ie, {
34
34
  ref: i,
35
35
  iconNode: t,
36
- className: R(`lucide-${I(L(e))}`, `lucide-${e}`, n),
36
+ className: R(`lucide-${ee(L(e))}`, `lucide-${e}`, n),
37
37
  ...r
38
38
  }));
39
39
  return n.displayName = L(e), n;
40
- }, re = B("activity", [["path", {
40
+ }, ae = z("activity", [["path", {
41
41
  d: "M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",
42
42
  key: "169zse"
43
- }]]), ie = B("check", [["path", {
43
+ }]]), oe = z("check", [["path", {
44
44
  d: "M20 6 9 17l-5-5",
45
45
  key: "1gmf2c"
46
- }]]), ae = B("cpu", [
46
+ }]]), B = z("cpu", [
47
47
  ["path", {
48
48
  d: "M12 20v2",
49
49
  key: "1lh1kg"
@@ -108,7 +108,7 @@ var I = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), ee = (e)
108
108
  rx: "1",
109
109
  key: "z9xiuo"
110
110
  }]
111
- ]), oe = B("eye", [["path", {
111
+ ]), V = z("eye", [["path", {
112
112
  d: "M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",
113
113
  key: "1nclc0"
114
114
  }], ["circle", {
@@ -116,25 +116,25 @@ var I = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), ee = (e)
116
116
  cy: "12",
117
117
  r: "3",
118
118
  key: "1v7zrd"
119
- }]]), V = B("gauge", [["path", {
119
+ }]]), H = z("gauge", [["path", {
120
120
  d: "m12 14 4-4",
121
121
  key: "9kzdfg"
122
122
  }], ["path", {
123
123
  d: "M3.34 19a10 10 0 1 1 17.32 0",
124
124
  key: "19p75a"
125
- }]]), H = B("hexagon", [["path", {
125
+ }]]), U = z("hexagon", [["path", {
126
126
  d: "M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",
127
127
  key: "yt0hxn"
128
- }]]), U = B("minus", [["path", {
128
+ }]]), W = z("minus", [["path", {
129
129
  d: "M5 12h14",
130
130
  key: "1ays0h"
131
- }]]), W = B("plus", [["path", {
131
+ }]]), G = z("plus", [["path", {
132
132
  d: "M5 12h14",
133
133
  key: "1ays0h"
134
134
  }], ["path", {
135
135
  d: "M12 5v14",
136
136
  key: "s699le"
137
- }]]), G = B("save", [
137
+ }]]), K = z("save", [
138
138
  ["path", {
139
139
  d: "M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",
140
140
  key: "1c8476"
@@ -147,7 +147,7 @@ var I = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), ee = (e)
147
147
  d: "M7 3v4a1 1 0 0 0 1 1h7",
148
148
  key: "t51u73"
149
149
  }]
150
- ]), K = B("trash-2", [
150
+ ]), q = z("trash-2", [
151
151
  ["path", {
152
152
  d: "M3 6h18",
153
153
  key: "d0wm0j"
@@ -174,7 +174,7 @@ var I = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), ee = (e)
174
174
  y2: "17",
175
175
  key: "xtxkd"
176
176
  }]
177
- ]), q = B("video", [["path", {
177
+ ]), se = z("video", [["path", {
178
178
  d: "m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",
179
179
  key: "ftymec"
180
180
  }], ["rect", {
@@ -184,7 +184,7 @@ var I = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), ee = (e)
184
184
  height: "12",
185
185
  rx: "2",
186
186
  key: "158x01"
187
- }]]), se = B("volume-2", [
187
+ }]]), ce = z("volume-2", [
188
188
  ["path", {
189
189
  d: "M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",
190
190
  key: "uqj9uw"
@@ -197,7 +197,7 @@ var I = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), ee = (e)
197
197
  d: "M19.364 18.364a9 9 0 0 0 0-12.728",
198
198
  key: "ijwkga"
199
199
  }]
200
- ]), J = B("x", [["path", {
200
+ ]), J = z("x", [["path", {
201
201
  d: "M18 6 6 18",
202
202
  key: "1bl5f8"
203
203
  }], ["path", {
@@ -206,25 +206,25 @@ var I = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), ee = (e)
206
206
  }]]);
207
207
  //#endregion
208
208
  //#region src/widgets/PipelineQuickStats.tsx
209
- function ce(e) {
210
- return e.deviceId === void 0 ? /* @__PURE__ */ M("div", {
209
+ function le(e) {
210
+ return e.deviceId === void 0 ? /* @__PURE__ */ N("div", {
211
211
  className: "rounded-lg border border-warning/30 bg-warning/10 px-3 py-2 text-xs text-warning",
212
212
  children: "PipelineQuickStats requires a deviceId"
213
- }) : /* @__PURE__ */ M(le, { deviceId: e.deviceId });
213
+ }) : /* @__PURE__ */ N(ue, { deviceId: e.deviceId });
214
214
  }
215
- function le({ deviceId: t }) {
216
- f(["pipelineOrchestrator", "getPipelineAssignment"], [
215
+ function ue({ deviceId: t }) {
216
+ p(["pipelineOrchestrator", "getPipelineAssignment"], [
217
217
  "pipeline.camera-assigned",
218
218
  "pipeline.camera-unassigned",
219
219
  "pipeline.camera-updated"
220
- ]), f(["pipelineRunner", "getCameraMetrics"], ["pipeline.camera-metrics-snapshot"]);
221
- let { data: n } = A({ deviceId: t }, { staleTime: 3e4 }), r = n?.agentNodeId ?? null, i = typeof r == "string" && r.length > 0 && !r.startsWith("addon:") ? r : void 0, { data: a } = l({
220
+ ]), p(["pipelineRunner", "getCameraMetrics"], ["pipeline.camera-metrics-snapshot"]);
221
+ let { data: n } = j({ deviceId: t }, { staleTime: 3e4 }), r = n?.agentNodeId ?? null, i = typeof r == "string" && r.length > 0 && !r.startsWith("addon:") ? r : void 0, { data: a } = u({
222
222
  deviceId: t,
223
223
  ...i ? { nodeId: i } : {}
224
224
  }, {
225
225
  staleTime: 2e3,
226
226
  retry: !1
227
- }), o = k(), s = O(o.trpcClient, t), { data: c } = e({
227
+ }), o = A(), s = k(o.trpcClient, t), { data: c } = e({
228
228
  queryKey: [
229
229
  "device",
230
230
  t,
@@ -234,7 +234,7 @@ function le({ deviceId: t }) {
234
234
  enabled: !!s,
235
235
  refetchInterval: 5e3,
236
236
  retry: !1
237
- }), { data: d } = e({
237
+ }), { data: l } = e({
238
238
  queryKey: [
239
239
  "device",
240
240
  t,
@@ -244,7 +244,7 @@ function le({ deviceId: t }) {
244
244
  enabled: !!s,
245
245
  refetchInterval: 2e3,
246
246
  retry: !1
247
- }), { data: p } = e({
247
+ }), { data: f } = e({
248
248
  queryKey: ["recording.getStatus", t],
249
249
  queryFn: async () => await o.trpcClient.recording.getStatus.query({ deviceId: t }),
250
250
  refetchInterval: 5e3,
@@ -254,51 +254,51 @@ function le({ deviceId: t }) {
254
254
  queryFn: async () => await o.trpcClient.recording.getDeviceConfig.query({ deviceId: t }),
255
255
  staleTime: 3e4,
256
256
  retry: !1
257
- }), h = a?.phase ?? null, g = a?.detectionMode ?? null, _ = Number(a?.actualFps ?? 0), v = Number(a?.configuredFps ?? 0), y = Number(a?.avgInferenceTimeMs ?? 0), b = Number(a?.queueDepth ?? 0), x = Number(a?.droppedFrames ?? 0), S = u(h ?? "watching"), C = c?.length ?? 0, w = d?.level.dbfs ?? null, T = typeof w == "number" ? `${w.toFixed(1)} dBFS` : "—", E = p?.enabled ?? !1, D = p?.activeMode ?? "off", j = E && D !== "off", P = E ? D === "off" ? "Idle" : D === "continuous" ? "Continuous" : D === "onMotion" ? "On motion" : D === "onAudioThreshold" ? "On audio" : D : "Disabled", F = (m?.profiles ?? []).join(", "), I = p ? `${ue(p.storageBytes ?? 0)}${F ? ` · ${F}` : ""}` : void 0;
258
- return /* @__PURE__ */ N("div", {
257
+ }), h = a?.phase ?? null, g = a?.detectionMode ?? null, _ = Number(a?.actualFps ?? 0), v = Number(a?.configuredFps ?? 0), y = Number(a?.avgInferenceTimeMs ?? 0), b = Number(a?.queueDepth ?? 0), x = Number(a?.droppedFrames ?? 0), S = d(h ?? "watching"), C = c?.length ?? 0, w = l?.level.dbfs ?? null, T = typeof w == "number" ? `${w.toFixed(1)} dBFS` : "—", E = f?.enabled ?? !1, D = f?.activeMode ?? "off", O = E && D !== "off", M = E ? D === "off" ? "Idle" : D === "continuous" ? "Continuous" : D === "onMotion" ? "On motion" : D === "onAudioThreshold" ? "On audio" : D : "Disabled", F = (m?.profiles ?? []).join(", "), I = f ? `${de(f.storageBytes ?? 0)}${F ? ` · ${F}` : ""}` : void 0;
258
+ return /* @__PURE__ */ P("div", {
259
259
  className: "grid grid-cols-[repeat(auto-fit,minmax(180px,1fr))] gap-3",
260
260
  children: [
261
- /* @__PURE__ */ M(Y, {
262
- icon: re,
261
+ /* @__PURE__ */ N(Y, {
262
+ icon: ae,
263
263
  label: "Phase",
264
264
  value: S.label,
265
265
  color: S.textColor,
266
266
  subtext: g ?? void 0
267
267
  }),
268
- /* @__PURE__ */ M(Y, {
269
- icon: V,
268
+ /* @__PURE__ */ N(Y, {
269
+ icon: H,
270
270
  label: "Detection FPS",
271
271
  value: `${_.toFixed(1)}`,
272
272
  subtext: v > 0 ? `target: ${v}` : void 0
273
273
  }),
274
- /* @__PURE__ */ M(Y, {
275
- icon: ae,
274
+ /* @__PURE__ */ N(Y, {
275
+ icon: B,
276
276
  label: "Inference",
277
277
  value: `${y.toFixed(1)} ms`,
278
278
  subtext: b > 0 ? `queue: ${b}` : void 0
279
279
  }),
280
- /* @__PURE__ */ M(Y, {
281
- icon: oe,
280
+ /* @__PURE__ */ N(Y, {
281
+ icon: V,
282
282
  label: "Active Tracks",
283
283
  value: String(C),
284
284
  subtext: x > 0 ? `dropped: ${x}` : void 0
285
285
  }),
286
- /* @__PURE__ */ M(Y, {
287
- icon: se,
286
+ /* @__PURE__ */ N(Y, {
287
+ icon: ce,
288
288
  label: "Current dB",
289
289
  value: T
290
290
  }),
291
- /* @__PURE__ */ M(Y, {
292
- icon: q,
291
+ /* @__PURE__ */ N(Y, {
292
+ icon: se,
293
293
  label: "Recording",
294
- value: P,
295
- color: j ? "text-success" : void 0,
294
+ value: M,
295
+ color: O ? "text-success" : void 0,
296
296
  subtext: I
297
297
  })
298
298
  ]
299
299
  });
300
300
  }
301
- function ue(e) {
301
+ function de(e) {
302
302
  if (!Number.isFinite(e) || e <= 0) return "0 B";
303
303
  let t = [
304
304
  "B",
@@ -310,23 +310,23 @@ function ue(e) {
310
310
  return `${n === 0 ? Math.round(r) : r.toFixed(1)} ${t[n]}`;
311
311
  }
312
312
  function Y({ icon: e, label: t, value: n, subtext: r, color: i }) {
313
- return /* @__PURE__ */ N("div", {
313
+ return /* @__PURE__ */ P("div", {
314
314
  className: "rounded-lg border border-border bg-surface p-3 min-w-0",
315
315
  children: [
316
- /* @__PURE__ */ N("div", {
316
+ /* @__PURE__ */ P("div", {
317
317
  className: "flex items-center gap-1.5 mb-1 min-w-0",
318
- children: [/* @__PURE__ */ M(e, { className: "h-3.5 w-3.5 text-foreground-subtle flex-shrink-0" }), /* @__PURE__ */ M("span", {
318
+ children: [/* @__PURE__ */ N(e, { className: "h-3.5 w-3.5 text-foreground-subtle flex-shrink-0" }), /* @__PURE__ */ N("span", {
319
319
  className: "text-[10px] text-foreground-subtle uppercase tracking-wider truncate",
320
320
  title: t,
321
321
  children: t
322
322
  })]
323
323
  }),
324
- /* @__PURE__ */ M("p", {
324
+ /* @__PURE__ */ N("p", {
325
325
  className: `text-lg font-semibold leading-tight truncate ${i ?? "text-foreground"}`,
326
326
  title: n,
327
327
  children: n
328
328
  }),
329
- r && /* @__PURE__ */ M("p", {
329
+ r && /* @__PURE__ */ N("p", {
330
330
  className: "text-[10px] text-foreground-subtle mt-0.5 truncate",
331
331
  title: r,
332
332
  children: r
@@ -336,70 +336,70 @@ function Y({ icon: e, label: t, value: n, subtext: r, color: i }) {
336
336
  }
337
337
  //#endregion
338
338
  //#region src/widgets/zone-editor/ZoneList.tsx
339
- var de = {
339
+ var fe = {
340
340
  polygon: "Polygon",
341
341
  tripwire: "Tripwire"
342
- }, fe = {
342
+ }, pe = {
343
343
  polygon: "bg-info/10 text-info",
344
344
  tripwire: "bg-warning/10 text-warning"
345
345
  };
346
- function pe({ zones: e, selectedZoneId: t, drawingKind: n, onSelectZone: r, onDeleteZone: i, onStartDraw: a, onCancelDraw: o }) {
347
- return /* @__PURE__ */ N("div", {
346
+ function me({ zones: e, selectedZoneId: t, drawingKind: n, onSelectZone: r, onDeleteZone: i, onStartDraw: a, onCancelDraw: o }) {
347
+ return /* @__PURE__ */ P("div", {
348
348
  className: "flex flex-col gap-2",
349
- children: [/* @__PURE__ */ M("div", {
349
+ children: [/* @__PURE__ */ N("div", {
350
350
  className: "flex items-center gap-1",
351
- children: n ? /* @__PURE__ */ N("button", {
351
+ children: n ? /* @__PURE__ */ P("button", {
352
352
  type: "button",
353
353
  onClick: o,
354
354
  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",
355
355
  title: "Cancel drawing",
356
- children: [/* @__PURE__ */ M(J, { className: "h-3.5 w-3.5" }), /* @__PURE__ */ M("span", { children: "Cancel" })]
357
- }) : /* @__PURE__ */ N(P, { children: [/* @__PURE__ */ M("button", {
356
+ children: [/* @__PURE__ */ N(J, { className: "h-3.5 w-3.5" }), /* @__PURE__ */ N("span", { children: "Cancel" })]
357
+ }) : /* @__PURE__ */ P(F, { children: [/* @__PURE__ */ N("button", {
358
358
  type: "button",
359
359
  onClick: () => a("polygon"),
360
360
  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",
361
361
  title: "Add polygon zone",
362
362
  "aria-label": "Add polygon zone",
363
- children: /* @__PURE__ */ M(H, { className: "h-4 w-4" })
364
- }), /* @__PURE__ */ M("button", {
363
+ children: /* @__PURE__ */ N(U, { className: "h-4 w-4" })
364
+ }), /* @__PURE__ */ N("button", {
365
365
  type: "button",
366
366
  onClick: () => a("tripwire"),
367
367
  className: "inline-flex items-center justify-center rounded border border-border bg-surface text-foreground-subtle hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors h-8 w-8",
368
368
  title: "Add tripwire",
369
369
  "aria-label": "Add tripwire",
370
- children: /* @__PURE__ */ M(U, { className: "h-5 w-5 stroke-[2.5]" })
370
+ children: /* @__PURE__ */ N(W, { className: "h-5 w-5 stroke-[2.5]" })
371
371
  })] })
372
- }), e.length === 0 ? /* @__PURE__ */ M("p", {
372
+ }), e.length === 0 ? /* @__PURE__ */ N("p", {
373
373
  className: "text-center text-[10px] text-foreground-subtle py-3 leading-tight",
374
374
  children: "No zones yet — pick \"Zone\" or \"Tripwire\" to draw."
375
- }) : /* @__PURE__ */ M("div", {
375
+ }) : /* @__PURE__ */ N("div", {
376
376
  className: "flex flex-col gap-1",
377
377
  children: e.map((e) => {
378
378
  let n = e.id === t;
379
- return /* @__PURE__ */ N("div", {
379
+ return /* @__PURE__ */ P("div", {
380
380
  className: ["flex items-center gap-1.5 rounded border px-1.5 py-1 cursor-pointer transition-colors", n ? "border-primary/50 bg-primary/10" : "border-border bg-surface hover:bg-surface-hover"].join(" "),
381
381
  onClick: () => r(n ? null : e.id),
382
382
  children: [
383
- /* @__PURE__ */ M("div", {
383
+ /* @__PURE__ */ N("div", {
384
384
  className: "h-2.5 w-2.5 rounded-sm flex-shrink-0",
385
385
  style: { backgroundColor: e.color }
386
386
  }),
387
- /* @__PURE__ */ M("span", {
387
+ /* @__PURE__ */ N("span", {
388
388
  className: "flex-1 truncate text-[11px] font-medium text-foreground",
389
389
  children: e.name
390
390
  }),
391
- /* @__PURE__ */ M("span", {
392
- className: `inline-flex items-center rounded-full px-1.5 py-0.5 text-[9px] font-medium flex-shrink-0 ${fe[e.kind]}`,
393
- children: de[e.kind]
391
+ /* @__PURE__ */ N("span", {
392
+ className: `inline-flex items-center rounded-full px-1.5 py-0.5 text-[9px] font-medium flex-shrink-0 ${pe[e.kind]}`,
393
+ children: fe[e.kind]
394
394
  }),
395
- /* @__PURE__ */ M("button", {
395
+ /* @__PURE__ */ N("button", {
396
396
  type: "button",
397
397
  title: "Delete zone",
398
398
  className: "p-0.5 text-foreground-subtle hover:text-danger rounded transition-colors flex-shrink-0",
399
399
  onClick: (t) => {
400
400
  t.stopPropagation(), i(e.id);
401
401
  },
402
- children: /* @__PURE__ */ M(K, { className: "h-3 w-3" })
402
+ children: /* @__PURE__ */ N(q, { className: "h-3 w-3" })
403
403
  })
404
404
  ]
405
405
  }, e.id);
@@ -409,7 +409,7 @@ function pe({ zones: e, selectedZoneId: t, drawingKind: n, onSelectZone: r, onDe
409
409
  }
410
410
  //#endregion
411
411
  //#region src/widgets/zone-editor/ZoneForm.tsx
412
- var me = [
412
+ var he = [
413
413
  "#3b82f6",
414
414
  "#10b981",
415
415
  "#f59e0b",
@@ -419,24 +419,24 @@ var me = [
419
419
  "#f97316",
420
420
  "#ec4899"
421
421
  ];
422
- function he({ zone: e, onSave: t, onDiscard: n, onDelete: r }) {
423
- let i = w(), a = (e) => i?.updateDraft({ name: e }), o = (e) => i?.updateDraft({ color: e });
424
- return /* @__PURE__ */ N("div", {
422
+ function ge({ zone: e, onSave: t, onDiscard: n, onDelete: r }) {
423
+ let i = T(), a = (e) => i?.updateDraft({ name: e }), o = (e) => i?.updateDraft({ color: e });
424
+ return /* @__PURE__ */ P("div", {
425
425
  className: "flex flex-col gap-2",
426
426
  children: [
427
- /* @__PURE__ */ N("div", {
427
+ /* @__PURE__ */ P("div", {
428
428
  className: "flex items-center justify-between",
429
- children: [/* @__PURE__ */ M("h3", {
429
+ children: [/* @__PURE__ */ N("h3", {
430
430
  className: "text-[10px] font-semibold text-foreground-subtle uppercase tracking-wider",
431
431
  children: "Editing"
432
- }), /* @__PURE__ */ M("span", {
432
+ }), /* @__PURE__ */ N("span", {
433
433
  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",
434
434
  children: e.kind === "tripwire" ? "Tripwire" : "Polygon"
435
435
  })]
436
436
  }),
437
- /* @__PURE__ */ M("input", {
437
+ /* @__PURE__ */ N("input", {
438
438
  type: "text",
439
- className: d,
439
+ className: f,
440
440
  value: e.name,
441
441
  autoFocus: !0,
442
442
  onChange: (e) => a(e.target.value),
@@ -445,9 +445,9 @@ function he({ zone: e, onSave: t, onDiscard: n, onDelete: r }) {
445
445
  },
446
446
  placeholder: "Zone name"
447
447
  }),
448
- /* @__PURE__ */ M("div", {
448
+ /* @__PURE__ */ N("div", {
449
449
  className: "flex flex-wrap gap-1",
450
- children: me.map((t) => /* @__PURE__ */ M("button", {
450
+ children: he.map((t) => /* @__PURE__ */ N("button", {
451
451
  type: "button",
452
452
  title: t,
453
453
  className: ["h-4 w-4 rounded border-2 cursor-pointer transition-transform hover:scale-110", e.color === t ? "border-white scale-110" : "border-transparent"].join(" "),
@@ -455,57 +455,57 @@ function he({ zone: e, onSave: t, onDiscard: n, onDelete: r }) {
455
455
  onClick: () => o(t)
456
456
  }, t))
457
457
  }),
458
- /* @__PURE__ */ N("div", {
458
+ /* @__PURE__ */ P("div", {
459
459
  className: "flex items-center gap-1.5",
460
- children: [/* @__PURE__ */ M("input", {
460
+ children: [/* @__PURE__ */ N("input", {
461
461
  type: "color",
462
462
  className: "h-6 w-6 rounded border border-border bg-background cursor-pointer p-0.5",
463
463
  value: e.color,
464
464
  onChange: (e) => o(e.target.value)
465
- }), /* @__PURE__ */ M("input", {
465
+ }), /* @__PURE__ */ N("input", {
466
466
  type: "text",
467
- className: `${d} font-mono`,
467
+ className: `${f} font-mono`,
468
468
  value: e.color,
469
469
  placeholder: "#000000",
470
470
  onChange: (e) => o(e.target.value)
471
471
  })]
472
472
  }),
473
- /* @__PURE__ */ N("p", {
473
+ /* @__PURE__ */ P("p", {
474
474
  className: "text-[9px] text-foreground-subtle leading-tight",
475
475
  children: [e.kind === "tripwire" ? "2 points" : `${e.points.length} pts`, e.points.length > 0 && " · drag handles to reshape"]
476
476
  }),
477
- /* @__PURE__ */ N("div", {
477
+ /* @__PURE__ */ P("div", {
478
478
  className: "flex items-center gap-1.5",
479
- children: [/* @__PURE__ */ N("button", {
479
+ children: [/* @__PURE__ */ P("button", {
480
480
  type: "button",
481
481
  onClick: t,
482
482
  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",
483
483
  title: "Save changes (Enter)",
484
- children: [/* @__PURE__ */ M(ie, { className: "h-3 w-3" }), "Save"]
485
- }), /* @__PURE__ */ N("button", {
484
+ children: [/* @__PURE__ */ N(oe, { className: "h-3 w-3" }), "Save"]
485
+ }), /* @__PURE__ */ P("button", {
486
486
  type: "button",
487
487
  onClick: n,
488
488
  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",
489
489
  title: "Discard changes (Esc)",
490
- children: [/* @__PURE__ */ M(J, { className: "h-3 w-3" }), "Discard"]
490
+ children: [/* @__PURE__ */ N(J, { className: "h-3 w-3" }), "Discard"]
491
491
  })]
492
492
  }),
493
- /* @__PURE__ */ N("button", {
493
+ /* @__PURE__ */ P("button", {
494
494
  type: "button",
495
495
  onClick: r,
496
- className: `${v} w-full`,
497
- children: [/* @__PURE__ */ M(K, { className: "h-3 w-3" }), "Delete"]
496
+ className: `${y} w-full`,
497
+ children: [/* @__PURE__ */ N(q, { className: "h-3 w-3" }), "Delete"]
498
498
  })
499
499
  ]
500
500
  });
501
501
  }
502
502
  //#endregion
503
503
  //#region src/widgets/zone-editor/ZoneRulesEditor.tsx
504
- var ge = F.map((e) => ({
504
+ var _e = I.map((e) => ({
505
505
  id: e.id,
506
506
  label: e.name
507
507
  }));
508
- function _e(e) {
508
+ function ve(e) {
509
509
  return {
510
510
  id: e.id,
511
511
  name: e.name ?? "",
@@ -515,7 +515,7 @@ function _e(e) {
515
515
  enabled: e.enabled !== !1
516
516
  };
517
517
  }
518
- function ve(e) {
518
+ function ye(e) {
519
519
  let t = {
520
520
  id: e.id,
521
521
  zoneIds: e.zoneIds,
@@ -524,12 +524,12 @@ function ve(e) {
524
524
  };
525
525
  return e.name && (t.name = e.name), e.classFilter.length > 0 && (t.classFilter = e.classFilter), t;
526
526
  }
527
- function X({ dev: e, stage: n, zones: r, title: a }) {
528
- let s = j(e?.state.zoneRules), c = i(() => s?.[n] ?? [], [s, n]), [l, u] = o([]), [f, p] = o(!1), [m, h] = o(!1), [v, y] = o(null);
527
+ function X({ dev: e, stage: n, zones: r, title: i }) {
528
+ let o = M(e?.state.zoneRules), c = a(() => o?.[n] ?? [], [o, n]), [l, u] = s([]), [d, p] = s(!1), [m, h] = s(!1), [g, y] = s(null);
529
529
  t(() => {
530
- f || u(c.map(_e));
531
- }, [c, f]);
532
- let x = () => {
530
+ d || u(c.map(ve));
531
+ }, [c, d]);
532
+ let b = () => {
533
533
  u((e) => [...e, {
534
534
  id: crypto.randomUUID(),
535
535
  name: "",
@@ -538,7 +538,7 @@ function X({ dev: e, stage: n, zones: r, title: a }) {
538
538
  classFilter: [],
539
539
  enabled: !0
540
540
  }]), p(!0);
541
- }, w = (e, t) => {
541
+ }, S = (e, t) => {
542
542
  u((n) => n.map((n, r) => {
543
543
  if (r !== e) return n;
544
544
  let i = n.classFilter.includes(t) ? n.classFilter.filter((e) => e !== t) : [...n.classFilter, t];
@@ -556,7 +556,7 @@ function X({ dev: e, stage: n, zones: r, title: a }) {
556
556
  zoneIds: i
557
557
  };
558
558
  })), p(!0);
559
- }, D = (e) => {
559
+ }, E = (e) => {
560
560
  u((t) => t.filter((t, n) => n !== e)), p(!0);
561
561
  }, O = (e, t) => {
562
562
  u((n) => n.map((n, r) => r === e ? {
@@ -569,7 +569,7 @@ function X({ dev: e, stage: n, zones: r, title: a }) {
569
569
  try {
570
570
  await e.zoneRules.setRules({
571
571
  stage: n,
572
- rules: l.map(ve)
572
+ rules: l.map(ye)
573
573
  }), p(!1);
574
574
  } catch (e) {
575
575
  y(e instanceof Error ? e.message : String(e));
@@ -577,47 +577,47 @@ function X({ dev: e, stage: n, zones: r, title: a }) {
577
577
  h(!1);
578
578
  }
579
579
  }
580
- }, A = f && !!e?.zoneRules && !m;
581
- return /* @__PURE__ */ N("div", {
580
+ }, A = d && !!e?.zoneRules && !m;
581
+ return /* @__PURE__ */ P("div", {
582
582
  className: "rounded-md border border-border bg-surface/40 p-2.5",
583
583
  children: [
584
- /* @__PURE__ */ N("div", {
584
+ /* @__PURE__ */ P("div", {
585
585
  className: "flex items-center justify-between mb-2 gap-2",
586
- children: [/* @__PURE__ */ M("h3", {
587
- className: `${C} truncate`,
588
- children: a ?? `${n === "motion" ? "Motion" : "Detection"} Rules`
589
- }), /* @__PURE__ */ N("div", {
586
+ children: [/* @__PURE__ */ N("h3", {
587
+ className: `${w} truncate`,
588
+ children: i ?? `${n === "motion" ? "Motion" : "Detection"} Rules`
589
+ }), /* @__PURE__ */ P("div", {
590
590
  className: "flex items-center gap-1 flex-shrink-0",
591
- children: [/* @__PURE__ */ N("button", {
591
+ children: [/* @__PURE__ */ P("button", {
592
592
  type: "button",
593
- onClick: x,
593
+ onClick: b,
594
594
  disabled: r.length === 0 || !e,
595
- className: E,
595
+ className: D,
596
596
  title: "Add rule",
597
- children: [/* @__PURE__ */ M(W, { className: "h-2.5 w-2.5" }), " Add"]
598
- }), /* @__PURE__ */ N("button", {
597
+ children: [/* @__PURE__ */ N(G, { className: "h-2.5 w-2.5" }), " Add"]
598
+ }), /* @__PURE__ */ P("button", {
599
599
  type: "button",
600
600
  onClick: () => {
601
601
  k();
602
602
  },
603
603
  disabled: !A,
604
- className: S,
605
- children: [/* @__PURE__ */ M(G, { className: "h-2.5 w-2.5" }), m ? "…" : "Save"]
604
+ className: C,
605
+ children: [/* @__PURE__ */ N(K, { className: "h-2.5 w-2.5" }), m ? "…" : "Save"]
606
606
  })]
607
607
  })]
608
608
  }),
609
- l.length === 0 ? /* @__PURE__ */ M("p", {
609
+ l.length === 0 ? /* @__PURE__ */ N("p", {
610
610
  className: "text-[10px] text-foreground-subtle italic px-1 py-1.5 leading-tight",
611
611
  children: r.length === 0 ? "Define a zone first — rules reference zone ids." : "No rules — every detection at this stage passes through."
612
- }) : /* @__PURE__ */ M("div", {
612
+ }) : /* @__PURE__ */ N("div", {
613
613
  className: "flex flex-col gap-1.5",
614
- children: l.map((e, t) => /* @__PURE__ */ N("div", {
614
+ children: l.map((e, t) => /* @__PURE__ */ P("div", {
615
615
  className: "rounded border border-border/50 bg-background/40 px-2 py-1.5 flex flex-col gap-1.5 overflow-hidden",
616
616
  children: [
617
- /* @__PURE__ */ N("div", {
617
+ /* @__PURE__ */ P("div", {
618
618
  className: "grid grid-cols-[auto_1fr_auto] items-center gap-1.5",
619
619
  children: [
620
- /* @__PURE__ */ M("button", {
620
+ /* @__PURE__ */ N("button", {
621
621
  type: "button",
622
622
  role: "switch",
623
623
  "aria-checked": e.enabled,
@@ -625,80 +625,80 @@ function X({ dev: e, stage: n, zones: r, title: a }) {
625
625
  title: e.enabled ? "Rule is active — click to disable" : "Rule is disabled — click to enable",
626
626
  onClick: () => O(t, { enabled: !e.enabled }),
627
627
  className: ["inline-flex items-center justify-center h-5 w-9 rounded-full border transition-colors flex-shrink-0", e.enabled ? "border-primary/50 bg-primary/20 text-primary" : "border-border bg-surface text-foreground-subtle"].join(" "),
628
- children: /* @__PURE__ */ M("span", { className: ["h-3 w-3 rounded-full transition-transform", e.enabled ? "translate-x-1.5 bg-primary" : "-translate-x-1.5 bg-foreground-subtle"].join(" ") })
628
+ children: /* @__PURE__ */ N("span", { className: ["h-3 w-3 rounded-full transition-transform", e.enabled ? "translate-x-1.5 bg-primary" : "-translate-x-1.5 bg-foreground-subtle"].join(" ") })
629
629
  }),
630
- /* @__PURE__ */ M("input", {
631
- className: `${d} min-w-0`,
630
+ /* @__PURE__ */ N("input", {
631
+ className: `${f} min-w-0`,
632
632
  placeholder: "Rule name (optional)",
633
633
  value: e.name,
634
634
  onChange: (e) => O(t, { name: e.target.value })
635
635
  }),
636
- /* @__PURE__ */ M("button", {
636
+ /* @__PURE__ */ N("button", {
637
637
  type: "button",
638
638
  title: "Remove rule",
639
639
  "aria-label": "Remove rule",
640
- onClick: () => D(t),
640
+ onClick: () => E(t),
641
641
  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",
642
- children: /* @__PURE__ */ M(K, { className: "h-3.5 w-3.5" })
642
+ children: /* @__PURE__ */ N(q, { className: "h-3.5 w-3.5" })
643
643
  })
644
644
  ]
645
645
  }),
646
- /* @__PURE__ */ N("div", {
646
+ /* @__PURE__ */ P("div", {
647
647
  className: "flex items-center gap-1.5 flex-wrap",
648
648
  children: [
649
- /* @__PURE__ */ M("span", {
649
+ /* @__PURE__ */ N("span", {
650
650
  className: "text-[9px] uppercase tracking-wider text-foreground-subtle w-12 sm:w-14 flex-shrink-0",
651
651
  children: "Mode"
652
652
  }),
653
- /* @__PURE__ */ M("button", {
653
+ /* @__PURE__ */ N("button", {
654
654
  type: "button",
655
655
  onClick: () => O(t, { mode: "include" }),
656
- className: `${_} ${e.mode === "include" ? b : g}`,
656
+ className: `${v} ${e.mode === "include" ? x : _}`,
657
657
  children: "Include"
658
658
  }),
659
- /* @__PURE__ */ M("button", {
659
+ /* @__PURE__ */ N("button", {
660
660
  type: "button",
661
661
  onClick: () => O(t, { mode: "exclude" }),
662
- className: `${_} ${e.mode === "exclude" ? b : g}`,
662
+ className: `${v} ${e.mode === "exclude" ? x : _}`,
663
663
  children: "Exclude"
664
664
  })
665
665
  ]
666
666
  }),
667
- /* @__PURE__ */ N("div", {
667
+ /* @__PURE__ */ P("div", {
668
668
  className: "flex items-center gap-1.5 flex-wrap",
669
- children: [/* @__PURE__ */ M("span", {
669
+ children: [/* @__PURE__ */ N("span", {
670
670
  className: "text-[9px] uppercase tracking-wider text-foreground-subtle w-12 sm:w-14 flex-shrink-0",
671
671
  children: "Zones"
672
- }), r.length === 0 ? /* @__PURE__ */ M("span", {
672
+ }), r.length === 0 ? /* @__PURE__ */ N("span", {
673
673
  className: "text-[10px] text-foreground-subtle italic",
674
674
  children: "none"
675
- }) : r.map((n) => /* @__PURE__ */ N("button", {
675
+ }) : r.map((n) => /* @__PURE__ */ P("button", {
676
676
  type: "button",
677
677
  onClick: () => T(t, n.id),
678
- className: `${_} ${e.zoneIds.includes(n.id) ? b : g}`,
679
- children: [/* @__PURE__ */ M("span", {
678
+ className: `${v} ${e.zoneIds.includes(n.id) ? x : _}`,
679
+ children: [/* @__PURE__ */ N("span", {
680
680
  className: "h-2 w-2 rounded-sm",
681
681
  style: { backgroundColor: n.color || "#3b82f6" }
682
- }), /* @__PURE__ */ M("span", {
682
+ }), /* @__PURE__ */ N("span", {
683
683
  className: "truncate max-w-[7rem]",
684
684
  children: n.name || n.id
685
685
  })]
686
686
  }, n.id))]
687
687
  }),
688
- /* @__PURE__ */ N("div", {
688
+ /* @__PURE__ */ P("div", {
689
689
  className: "flex items-center gap-1.5 flex-wrap",
690
690
  children: [
691
- /* @__PURE__ */ M("span", {
691
+ /* @__PURE__ */ N("span", {
692
692
  className: "text-[9px] uppercase tracking-wider text-foreground-subtle w-12 sm:w-14 flex-shrink-0",
693
693
  children: "Class"
694
694
  }),
695
- ge.map((n) => /* @__PURE__ */ M("button", {
695
+ _e.map((n) => /* @__PURE__ */ N("button", {
696
696
  type: "button",
697
- onClick: () => w(t, n.id),
698
- className: `${_} ${e.classFilter.includes(n.id) ? b : g}`,
697
+ onClick: () => S(t, n.id),
698
+ className: `${v} ${e.classFilter.includes(n.id) ? x : _}`,
699
699
  children: n.label
700
700
  }, n.id)),
701
- e.classFilter.length === 0 && /* @__PURE__ */ M("span", {
701
+ e.classFilter.length === 0 && /* @__PURE__ */ N("span", {
702
702
  className: "text-[10px] text-foreground-subtle italic ml-1",
703
703
  children: "any"
704
704
  })
@@ -707,16 +707,16 @@ function X({ dev: e, stage: n, zones: r, title: a }) {
707
707
  ]
708
708
  }, e.id))
709
709
  }),
710
- v && /* @__PURE__ */ M("p", {
710
+ g && /* @__PURE__ */ N("p", {
711
711
  className: "mt-2 text-[10px] text-danger",
712
- children: v
712
+ children: g
713
713
  })
714
714
  ]
715
715
  });
716
716
  }
717
717
  //#endregion
718
718
  //#region src/widgets/zone-editor/types.ts
719
- function ye(e) {
719
+ function be(e) {
720
720
  let t = e.kind === "tripwire" ? {
721
721
  kind: "line",
722
722
  points: e.points
@@ -731,15 +731,15 @@ function ye(e) {
731
731
  shape: t
732
732
  };
733
733
  }
734
- function be(e) {
734
+ function xe(e) {
735
735
  return e === "line" ? "tripwire" : "polygon";
736
736
  }
737
- function xe(e) {
737
+ function Se(e) {
738
738
  return e === "tripwire" ? "line" : "polygon";
739
739
  }
740
740
  //#endregion
741
741
  //#region src/widgets/zone-editor/ZoneOverlay.tsx
742
- var Se = "#3b82f6", Z = ["polygon", "line"], Q = [
742
+ var Ce = "#3b82f6", we = ["polygon", "line"], Z = [
743
743
  "#3b82f6",
744
744
  "#10b981",
745
745
  "#f59e0b",
@@ -751,21 +751,21 @@ var Se = "#3b82f6", Z = ["polygon", "line"], Q = [
751
751
  "#8b5cf6",
752
752
  "#14b8a6"
753
753
  ];
754
- function Ce(e) {
754
+ function Te(e) {
755
755
  let t = new Set(e.map((e) => (e.color ?? "").toLowerCase()));
756
- for (let e of Q) if (!t.has(e.toLowerCase())) return e;
757
- return Q[e.length % Q.length];
756
+ for (let e of Z) if (!t.has(e.toLowerCase())) return e;
757
+ return Z[e.length % Z.length];
758
758
  }
759
- function we(e) {
759
+ function Ee(e) {
760
760
  return {
761
761
  id: e.id,
762
762
  name: e.name,
763
763
  kind: e.kind,
764
- color: e.color || Se,
764
+ color: e.color || Ce,
765
765
  points: [...e.polygon]
766
766
  };
767
767
  }
768
- function $(e) {
768
+ function Q(e) {
769
769
  return {
770
770
  id: e.id,
771
771
  name: e.name,
@@ -774,44 +774,44 @@ function $(e) {
774
774
  color: e.color
775
775
  };
776
776
  }
777
- function Te({ deviceId: e }) {
778
- let t = O(k().trpcClient, e), r = j(t?.state.zones), a = i(() => r?.zones ?? [], [r]), o = w(), s = o?.drawingKind ?? null, c = o?.selectedZoneId ?? null, l = o?.editingDraft ?? null, u = i(() => a.map((e) => l && l.id === e.id ? {
779
- id: l.id,
780
- name: l.name,
781
- kind: l.kind,
782
- color: l.color,
783
- points: [...l.points]
784
- } : we(e)), [a, l]), d = i(() => u.map(ye), [u]), f = n(async (e) => {
777
+ function De({ deviceId: e }) {
778
+ let t = k(A().trpcClient, e), i = M(t?.state.zones), o = a(() => i?.zones ?? [], [i]), s = T(), c = s?.drawingKind ?? null, l = s?.selectedZoneId ?? null, u = s?.editingDraft ?? null, d = a(() => o.map((e) => u && u.id === e.id ? {
779
+ id: u.id,
780
+ name: u.name,
781
+ kind: u.kind,
782
+ color: u.color,
783
+ points: [...u.points]
784
+ } : Ee(e)), [o, u]), f = a(() => d.map(be), [d]), p = r(async (e) => {
785
785
  if (e.kind !== "polygon" && e.kind !== "line") return;
786
786
  let n = {
787
787
  id: crypto.randomUUID(),
788
788
  name: "",
789
- kind: be(e.kind),
790
- color: Ce(u),
789
+ kind: xe(e.kind),
790
+ color: Te(d),
791
791
  points: [...e.points]
792
792
  };
793
793
  try {
794
- await t?.zones?.addZone({ zone: $(n) });
794
+ await t?.zones?.addZone({ zone: Q(n) });
795
795
  } catch (e) {
796
796
  console.error("zones.addZone failed", e);
797
797
  }
798
- o?.setSelectedZoneId(n.id), o?.setDrawingKind(null);
798
+ s?.setSelectedZoneId(n.id), s?.setDrawingKind(null);
799
799
  }, [
800
800
  t,
801
- u,
802
- o
803
- ]), p = n(async (e, n) => {
801
+ d,
802
+ s
803
+ ]), m = r(async (e, n) => {
804
804
  let r = n.map((e) => ({
805
805
  x: e.x,
806
806
  y: e.y
807
807
  }));
808
- if (l && l.id === e) {
809
- o?.updateDraft({ points: r });
808
+ if (u && u.id === e) {
809
+ s?.updateDraft({ points: r });
810
810
  return;
811
811
  }
812
- let i = u.find((t) => t.id === e);
812
+ let i = d.find((t) => t.id === e);
813
813
  if (i) try {
814
- await t?.zones?.updateZone({ zone: $({
814
+ await t?.zones?.updateZone({ zone: Q({
815
815
  ...i,
816
816
  points: r
817
817
  }) });
@@ -820,54 +820,57 @@ function Te({ deviceId: e }) {
820
820
  }
821
821
  }, [
822
822
  t,
823
+ d,
823
824
  u,
824
- l,
825
- o
826
- ]), m = n((e, t) => {
827
- typeof e == "string" && (t.kind !== "polygon" && t.kind !== "line" || p(e, t.points));
828
- }, [p]), h = n((e) => {
825
+ s
826
+ ]), h = r((e, t) => {
827
+ typeof e == "string" && (t.kind !== "polygon" && t.kind !== "line" || m(e, t.points));
828
+ }, [m]), g = r((e) => {
829
829
  if (e === null) {
830
- o?.discardDraft(), o?.setSelectedZoneId(null);
830
+ s?.discardDraft(), s?.setSelectedZoneId(null);
831
831
  return;
832
832
  }
833
833
  if (typeof e != "string") return;
834
- let t = u.find((t) => t.id === e);
834
+ let t = d.find((t) => t.id === e);
835
835
  if (!t) {
836
- o?.setSelectedZoneId(e);
836
+ s?.setSelectedZoneId(e);
837
837
  return;
838
838
  }
839
- o?.enterDraft({
839
+ s?.enterDraft({
840
840
  id: t.id,
841
841
  kind: t.kind,
842
842
  name: t.name,
843
843
  color: t.color,
844
844
  points: t.points
845
845
  });
846
- }, [u, o]);
847
- return u.length === 0 && s === null ? null : /* @__PURE__ */ M(T, {
848
- transparent: !0,
849
- items: d,
850
- supportedShapes: Z,
851
- selectedId: c,
852
- onSelect: h,
853
- onShapeChange: m,
854
- onDrawComplete: (e) => {
855
- f(e);
856
- },
857
- drawingKind: s === null ? null : xe(s)
846
+ }, [d, s]);
847
+ return d.length === 0 && c === null ? null : /* @__PURE__ */ N(n, {
848
+ fallback: null,
849
+ children: /* @__PURE__ */ N(E, {
850
+ transparent: !0,
851
+ items: f,
852
+ supportedShapes: we,
853
+ selectedId: l,
854
+ onSelect: g,
855
+ onShapeChange: h,
856
+ onDrawComplete: (e) => {
857
+ p(e);
858
+ },
859
+ drawingKind: c === null ? null : Se(c)
860
+ })
858
861
  });
859
862
  }
860
- var Ee = a(Te), De = "#3b82f6";
861
- function Oe(e) {
863
+ var $ = o(De), Oe = "#3b82f6";
864
+ function ke(e) {
862
865
  return {
863
866
  id: e.id,
864
867
  name: e.name,
865
868
  kind: e.kind,
866
- color: e.color || De,
869
+ color: e.color || Oe,
867
870
  points: [...e.polygon]
868
871
  };
869
872
  }
870
- function ke(e) {
873
+ function Ae(e) {
871
874
  return {
872
875
  id: e.id,
873
876
  name: e.name,
@@ -876,14 +879,14 @@ function ke(e) {
876
879
  color: e.color
877
880
  };
878
881
  }
879
- function Ae({ deviceId: e }) {
880
- let t = O(k().trpcClient, e), r = j(t?.state.zones), a = i(() => r?.zones ?? [], [r]), o = i(() => a.map(Oe), [a]), s = w(), l = s?.drawingKind ?? null, u = s?.selectedZoneId ?? null, d = s?.editingDraft ?? null;
881
- c(i(() => ({
882
+ function je({ deviceId: e }) {
883
+ let t = k(A().trpcClient, e), n = M(t?.state.zones), i = a(() => n?.zones ?? [], [n]), o = a(() => i.map(ke), [i]), s = T(), c = s?.drawingKind ?? null, u = s?.selectedZoneId ?? null, d = s?.editingDraft ?? null;
884
+ l(a(() => ({
882
885
  id: "zones",
883
886
  order: 100,
884
- node: /* @__PURE__ */ M(Ee, { deviceId: e })
887
+ node: /* @__PURE__ */ N($, { deviceId: e })
885
888
  }), [e]));
886
- let f = n((e) => {
889
+ let f = r((e) => {
887
890
  if (e === null) {
888
891
  s?.discardDraft(), s?.setSelectedZoneId(null);
889
892
  return;
@@ -896,11 +899,11 @@ function Ae({ deviceId: e }) {
896
899
  color: t.color,
897
900
  points: t.points
898
901
  });
899
- }, [o, s]), g = n(async () => {
902
+ }, [o, s]), p = r(async () => {
900
903
  let e = s?.editingDraft;
901
904
  if (e) {
902
905
  try {
903
- await t?.zones?.updateZone({ zone: ke({
906
+ await t?.zones?.updateZone({ zone: Ae({
904
907
  id: e.id,
905
908
  kind: e.kind,
906
909
  name: e.name,
@@ -912,42 +915,42 @@ function Ae({ deviceId: e }) {
912
915
  }
913
916
  s?.discardDraft(), s?.setSelectedZoneId(null);
914
917
  }
915
- }, [t, s]), _ = n(() => {
918
+ }, [t, s]), _ = r(() => {
916
919
  s?.discardDraft(), s?.setSelectedZoneId(null);
917
- }, [s]), v = n(async (e) => {
920
+ }, [s]), v = r(async (e) => {
918
921
  try {
919
922
  await t?.zones?.removeZone({ zoneId: e });
920
923
  } catch (e) {
921
924
  console.error("zones.removeZone failed", e);
922
925
  }
923
926
  s?.selectedZoneId === e && s.setSelectedZoneId(null), s?.editingDraft?.id === e && s.discardDraft();
924
- }, [t, s]), b = n((e) => {
927
+ }, [t, s]), y = r((e) => {
925
928
  s?.startDrawing(e);
926
- }, [s]), S = n(() => {
929
+ }, [s]), x = r(() => {
927
930
  s?.setDrawingKind(null);
928
- }, [s]), T = i(() => !d || !o.find((e) => e.id === d.id) ? null : {
931
+ }, [s]), C = a(() => !d || !o.find((e) => e.id === d.id) ? null : {
929
932
  id: d.id,
930
933
  kind: d.kind,
931
934
  name: d.name,
932
935
  color: d.color,
933
936
  points: [...d.points]
934
937
  }, [o, d]);
935
- return /* @__PURE__ */ N("div", {
936
- className: m,
937
- children: [/* @__PURE__ */ N("div", {
938
- className: y,
939
- children: [/* @__PURE__ */ M("div", {
940
- className: D,
941
- children: /* @__PURE__ */ N("div", {
938
+ return /* @__PURE__ */ P("div", {
939
+ className: h,
940
+ children: [/* @__PURE__ */ P("div", {
941
+ className: b,
942
+ children: [/* @__PURE__ */ N("div", {
943
+ className: O,
944
+ children: /* @__PURE__ */ P("div", {
942
945
  className: "min-w-0",
943
- children: [/* @__PURE__ */ M("h2", {
944
- className: C,
946
+ children: [/* @__PURE__ */ N("h2", {
947
+ className: w,
945
948
  children: "Detection Zones"
946
- }), /* @__PURE__ */ N("p", {
947
- className: `${h} mt-0.5 leading-tight`,
949
+ }), /* @__PURE__ */ P("p", {
950
+ className: `${g} mt-0.5 leading-tight`,
948
951
  children: [
949
952
  "Pick a shape below or use the ",
950
- /* @__PURE__ */ M("strong", {
953
+ /* @__PURE__ */ N("strong", {
951
954
  className: "text-foreground",
952
955
  children: "Zones"
953
956
  }),
@@ -956,50 +959,50 @@ function Ae({ deviceId: e }) {
956
959
  ]
957
960
  })]
958
961
  })
959
- }), /* @__PURE__ */ N("div", {
960
- className: `${p} flex flex-col gap-3`,
961
- children: [/* @__PURE__ */ M(pe, {
962
+ }), /* @__PURE__ */ P("div", {
963
+ className: `${m} flex flex-col gap-3`,
964
+ children: [/* @__PURE__ */ N(me, {
962
965
  zones: o,
963
966
  selectedZoneId: u,
964
- drawingKind: l,
967
+ drawingKind: c,
965
968
  onSelectZone: f,
966
969
  onDeleteZone: v,
967
- onStartDraw: b,
968
- onCancelDraw: S
969
- }), T && /* @__PURE__ */ N(P, { children: [/* @__PURE__ */ M("div", { className: "border-t border-border" }), /* @__PURE__ */ M(he, {
970
- zone: T,
971
- onSave: g,
970
+ onStartDraw: y,
971
+ onCancelDraw: x
972
+ }), C && /* @__PURE__ */ P(F, { children: [/* @__PURE__ */ N("div", { className: "border-t border-border" }), /* @__PURE__ */ N(ge, {
973
+ zone: C,
974
+ onSave: p,
972
975
  onDiscard: _,
973
- onDelete: () => v(T.id)
976
+ onDelete: () => v(C.id)
974
977
  })] })]
975
978
  })]
976
- }), /* @__PURE__ */ N("div", {
977
- className: `grid grid-cols-1 2xl:grid-cols-2 ${x}`,
978
- children: [/* @__PURE__ */ M(X, {
979
+ }), /* @__PURE__ */ P("div", {
980
+ className: `grid grid-cols-1 2xl:grid-cols-2 ${S}`,
981
+ children: [/* @__PURE__ */ N(X, {
979
982
  dev: t,
980
983
  stage: "motion",
981
- zones: a
982
- }), /* @__PURE__ */ M(X, {
984
+ zones: i
985
+ }), /* @__PURE__ */ N(X, {
983
986
  dev: t,
984
987
  stage: "detection",
985
- zones: a
988
+ zones: i
986
989
  })]
987
990
  })]
988
991
  });
989
992
  }
990
993
  //#endregion
991
994
  //#region src/widgets/ZoneEditor.tsx
992
- function je(e) {
993
- return e.deviceId === void 0 ? /* @__PURE__ */ M("div", {
995
+ function Me(e) {
996
+ return e.deviceId === void 0 ? /* @__PURE__ */ N("div", {
994
997
  className: "rounded-lg border border-warning/30 bg-warning/10 px-3 py-2 text-xs text-warning",
995
998
  children: "ZoneEditor requires a deviceId"
996
- }) : /* @__PURE__ */ M(Ae, { deviceId: e.deviceId });
999
+ }) : /* @__PURE__ */ N(je, { deviceId: e.deviceId });
997
1000
  }
998
1001
  //#endregion
999
1002
  //#region src/widgets/index.tsx
1000
- var Me = {
1001
- "pipeline-quick-stats": ce,
1002
- "zone-editor": je
1003
+ var Ne = {
1004
+ "pipeline-quick-stats": le,
1005
+ "zone-editor": Me
1003
1006
  };
1004
1007
  //#endregion
1005
- export { Me as default };
1008
+ export { Ne as default };