@camstack/addon-pipeline-orchestrator 0.1.28 → 0.2.0

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