@camstack/addon-post-analysis 1.2.244 → 1.2.245
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/{dist-C-1xTyB-.mjs → dist-BI5QyFCV.mjs} +118 -3
- package/dist/{dist-DxZAf0Hs.js → dist-CzmhHYgz.js} +123 -2
- package/dist/embedding-encoder/index.js +1 -1
- package/dist/embedding-encoder/index.mjs +1 -1
- package/dist/pipeline-analytics/_stub.js +279 -272
- package/dist/pipeline-analytics/{_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-DqVUwKib.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-CAhLu0ft.mjs} +2 -2
- package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DyF1G0bN.mjs +26 -0
- package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-CSOvIfGa.mjs +26 -0
- package/dist/pipeline-analytics/{hostInit-Bn-3U_Qz.mjs → hostInit-CVs1ATjt.mjs} +2 -2
- package/dist/pipeline-analytics/index.js +60 -9
- package/dist/pipeline-analytics/index.mjs +60 -9
- package/dist/pipeline-analytics/remoteEntry.js +1 -1
- package/package.json +1 -1
- package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-BgA_MUQb.mjs +0 -26
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { a as e, i as t, n, o as r, r as i, t as a } from "./_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare__react__loadShare__.js-C0AuF9av.mjs";
|
|
2
2
|
import { t as o } from "./_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-B3Wx5J80.mjs";
|
|
3
|
-
import { a as s, i as c, n as l, o as u, r as d, s as f, t as p } from "./_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-
|
|
3
|
+
import { a as s, i as c, n as l, o as u, r as d, s as f, t as p } from "./_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-CSOvIfGa.mjs";
|
|
4
4
|
import { n as m, r as h, t as g } from "./_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-Bm-iyjmq.mjs";
|
|
5
|
+
import { t as _ } from "./_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DyF1G0bN.mjs";
|
|
5
6
|
//#region ../../node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.js
|
|
6
|
-
var
|
|
7
|
-
let t =
|
|
7
|
+
var v = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), y = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), b = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), x = (e) => {
|
|
8
|
+
let t = b(e);
|
|
8
9
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
9
|
-
},
|
|
10
|
+
}, S = {
|
|
10
11
|
xmlns: "http://www.w3.org/2000/svg",
|
|
11
12
|
width: 24,
|
|
12
13
|
height: 24,
|
|
@@ -16,31 +17,31 @@ var _ = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
16
17
|
strokeWidth: 2,
|
|
17
18
|
strokeLinecap: "round",
|
|
18
19
|
strokeLinejoin: "round"
|
|
19
|
-
},
|
|
20
|
+
}, C = (e) => {
|
|
20
21
|
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
|
21
22
|
return !1;
|
|
22
|
-
},
|
|
23
|
+
}, w = n(({ color: e = "currentColor", size: t = 24, strokeWidth: n = 2, absoluteStrokeWidth: r, className: i = "", children: o, iconNode: s, ...c }, l) => a("svg", {
|
|
23
24
|
ref: l,
|
|
24
|
-
...
|
|
25
|
+
...S,
|
|
25
26
|
width: t,
|
|
26
27
|
height: t,
|
|
27
28
|
stroke: e,
|
|
28
29
|
strokeWidth: r ? Number(n) * 24 / Number(t) : n,
|
|
29
|
-
className:
|
|
30
|
-
...!o && !
|
|
30
|
+
className: v("lucide", i),
|
|
31
|
+
...!o && !C(c) && { "aria-hidden": "true" },
|
|
31
32
|
...c
|
|
32
|
-
}, [...s.map(([e, t]) => a(e, t)), ...Array.isArray(o) ? o : [o]])),
|
|
33
|
-
let r = n(({ className: n, ...r }, i) => a(
|
|
33
|
+
}, [...s.map(([e, t]) => a(e, t)), ...Array.isArray(o) ? o : [o]])), T = (e, t) => {
|
|
34
|
+
let r = n(({ className: n, ...r }, i) => a(w, {
|
|
34
35
|
ref: i,
|
|
35
36
|
iconNode: t,
|
|
36
|
-
className:
|
|
37
|
+
className: v(`lucide-${y(x(e))}`, `lucide-${e}`, n),
|
|
37
38
|
...r
|
|
38
39
|
}));
|
|
39
|
-
return r.displayName =
|
|
40
|
-
},
|
|
40
|
+
return r.displayName = x(e), r;
|
|
41
|
+
}, E = T("activity", [["path", {
|
|
41
42
|
d: "M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",
|
|
42
43
|
key: "169zse"
|
|
43
|
-
}]]),
|
|
44
|
+
}]]), D = T("boxes", [
|
|
44
45
|
["path", {
|
|
45
46
|
d: "M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",
|
|
46
47
|
key: "lc1i9w"
|
|
@@ -89,7 +90,7 @@ var _ = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
89
90
|
d: "M12 13.5V8",
|
|
90
91
|
key: "1io7kd"
|
|
91
92
|
}]
|
|
92
|
-
]),
|
|
93
|
+
]), O = T("eye", [["path", {
|
|
93
94
|
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",
|
|
94
95
|
key: "1nclc0"
|
|
95
96
|
}], ["circle", {
|
|
@@ -97,7 +98,7 @@ var _ = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
97
98
|
cy: "12",
|
|
98
99
|
r: "3",
|
|
99
100
|
key: "1v7zrd"
|
|
100
|
-
}]]),
|
|
101
|
+
}]]), k = T("layers", [
|
|
101
102
|
["path", {
|
|
102
103
|
d: "M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",
|
|
103
104
|
key: "zw3jo"
|
|
@@ -110,7 +111,7 @@ var _ = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
110
111
|
d: "M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",
|
|
111
112
|
key: "kqbvx6"
|
|
112
113
|
}]
|
|
113
|
-
]),
|
|
114
|
+
]), A = T("map-pin-off", [
|
|
114
115
|
["path", {
|
|
115
116
|
d: "M12.75 7.09a3 3 0 0 1 2.16 2.16",
|
|
116
117
|
key: "1d4wjd"
|
|
@@ -131,7 +132,7 @@ var _ = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
131
132
|
d: "M9.13 9.13a3 3 0 0 0 3.74 3.74",
|
|
132
133
|
key: "13wojd"
|
|
133
134
|
}]
|
|
134
|
-
]),
|
|
135
|
+
]), j = T("mic-off", [
|
|
135
136
|
["path", {
|
|
136
137
|
d: "M12 19v3",
|
|
137
138
|
key: "npa21l"
|
|
@@ -156,7 +157,7 @@ var _ = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
156
157
|
d: "M9 9v3a3 3 0 0 0 5.12 2.12",
|
|
157
158
|
key: "r2i35w"
|
|
158
159
|
}]
|
|
159
|
-
]),
|
|
160
|
+
]), M = T("mic", [
|
|
160
161
|
["path", {
|
|
161
162
|
d: "M12 19v3",
|
|
162
163
|
key: "npa21l"
|
|
@@ -176,7 +177,7 @@ var _ = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
176
177
|
]);
|
|
177
178
|
//#endregion
|
|
178
179
|
//#region src/pipeline-analytics/widgets/chart-utils.tsx
|
|
179
|
-
function
|
|
180
|
+
function N({ presets: e, value: t, onChange: n }) {
|
|
180
181
|
return /* @__PURE__ */ m("div", {
|
|
181
182
|
className: "flex items-center gap-1 border border-border rounded-md p-0.5 bg-background",
|
|
182
183
|
children: e.map(({ id: e, label: r }) => /* @__PURE__ */ m("button", {
|
|
@@ -187,7 +188,7 @@ function M({ presets: e, value: t, onChange: n }) {
|
|
|
187
188
|
}, e))
|
|
188
189
|
});
|
|
189
190
|
}
|
|
190
|
-
function
|
|
191
|
+
function P(t = 0) {
|
|
191
192
|
let n = e(null), [a, o] = r(0);
|
|
192
193
|
return i(() => {
|
|
193
194
|
let e = n.current;
|
|
@@ -201,11 +202,11 @@ function N(t = 0) {
|
|
|
201
202
|
return i.observe(e), () => i.disconnect();
|
|
202
203
|
}, [t]), [n, a];
|
|
203
204
|
}
|
|
204
|
-
function
|
|
205
|
+
function F(e, t) {
|
|
205
206
|
let n = new Date(e), r = String(n.getHours()).padStart(2, "0"), i = String(n.getMinutes()).padStart(2, "0");
|
|
206
207
|
return t <= 1440 * 60 * 1e3 ? `${r}:${i}` : `${String(n.getDate()).padStart(2, "0")}/${String(n.getMonth() + 1).padStart(2, "0")} ${r}:${i}`;
|
|
207
208
|
}
|
|
208
|
-
function
|
|
209
|
+
function ee(e, t, n, r, i) {
|
|
209
210
|
if (t <= 1) return r;
|
|
210
211
|
let a = n - r - i;
|
|
211
212
|
return r + e / (t - 1) * a;
|
|
@@ -217,12 +218,12 @@ function te(e, t, n, r, i, a) {
|
|
|
217
218
|
let n = t / Math.max(1, a - 1), i = e + o * n;
|
|
218
219
|
s.push({
|
|
219
220
|
x: r + n * c,
|
|
220
|
-
label:
|
|
221
|
+
label: F(i, o)
|
|
221
222
|
});
|
|
222
223
|
}
|
|
223
224
|
return s;
|
|
224
225
|
}
|
|
225
|
-
var
|
|
226
|
+
var ne = [
|
|
226
227
|
"#3b82f6",
|
|
227
228
|
"#a855f7",
|
|
228
229
|
"#10b981",
|
|
@@ -232,8 +233,8 @@ var F = [
|
|
|
232
233
|
"#6366f1",
|
|
233
234
|
"#ef4444"
|
|
234
235
|
];
|
|
235
|
-
function
|
|
236
|
-
return
|
|
236
|
+
function re(e) {
|
|
237
|
+
return ne[e % ne.length] ?? "#64748b";
|
|
237
238
|
}
|
|
238
239
|
function I() {
|
|
239
240
|
let [e, t] = r(null);
|
|
@@ -289,7 +290,7 @@ function L({ state: e, containerWidth: t }) {
|
|
|
289
290
|
}
|
|
290
291
|
//#endregion
|
|
291
292
|
//#region src/pipeline-analytics/widgets/AudioHistoryChart.tsx
|
|
292
|
-
var
|
|
293
|
+
var ie = {
|
|
293
294
|
"5m": {
|
|
294
295
|
label: "5 min",
|
|
295
296
|
windowSec: 300,
|
|
@@ -308,25 +309,25 @@ var re = {
|
|
|
308
309
|
sampleEveryMs: 6e4,
|
|
309
310
|
pollIntervalMs: 3e5
|
|
310
311
|
}
|
|
311
|
-
},
|
|
312
|
+
}, ae = [
|
|
312
313
|
{
|
|
313
314
|
id: "5m",
|
|
314
|
-
label:
|
|
315
|
+
label: ie["5m"].label
|
|
315
316
|
},
|
|
316
317
|
{
|
|
317
318
|
id: "1h",
|
|
318
|
-
label:
|
|
319
|
+
label: ie["1h"].label
|
|
319
320
|
},
|
|
320
321
|
{
|
|
321
322
|
id: "24h",
|
|
322
|
-
label:
|
|
323
|
+
label: ie["24h"].label
|
|
323
324
|
}
|
|
324
325
|
], R = 140, z = {
|
|
325
326
|
top: 16,
|
|
326
327
|
right: 12,
|
|
327
328
|
bottom: 24,
|
|
328
329
|
left: 38
|
|
329
|
-
},
|
|
330
|
+
}, oe = {
|
|
330
331
|
speech: "#3b82f6",
|
|
331
332
|
music: "#a855f7",
|
|
332
333
|
dog_bark: "#ec4899",
|
|
@@ -334,11 +335,11 @@ var re = {
|
|
|
334
335
|
alarm: "#f59e0b",
|
|
335
336
|
baby_cry: "#10b981"
|
|
336
337
|
};
|
|
337
|
-
function
|
|
338
|
-
return e ?
|
|
338
|
+
function se(e) {
|
|
339
|
+
return e ? oe[e.toLowerCase()] ?? "#6366f1" : "#71717a";
|
|
339
340
|
}
|
|
340
|
-
function
|
|
341
|
-
let i = s(l().trpcClient, n), [a, c] = r("5m"), u =
|
|
341
|
+
function ce({ deviceId: n }) {
|
|
342
|
+
let i = s(l().trpcClient, n), [a, c] = r("5m"), u = ie[a], [d, f] = P(), p = I(), _ = e(null), v = (e) => {
|
|
342
343
|
let t = _.current;
|
|
343
344
|
if (!t) return e;
|
|
344
345
|
let n = t.getBoundingClientRect();
|
|
@@ -357,27 +358,27 @@ function se({ deviceId: n }) {
|
|
|
357
358
|
enabled: !!i,
|
|
358
359
|
refetchInterval: u.pollIntervalMs,
|
|
359
360
|
staleTime: Math.max(1e3, u.pollIntervalMs / 2)
|
|
360
|
-
}), b = y.data, x = b?.points ?? [], S = t(() =>
|
|
361
|
+
}), b = y.data, x = b?.points ?? [], S = t(() => pe(x), [x]), C = t(() => de(x, f, S), [
|
|
361
362
|
x,
|
|
362
363
|
f,
|
|
363
364
|
S
|
|
364
|
-
]), w = t(() =>
|
|
365
|
+
]), w = t(() => fe(x, f, S), [
|
|
365
366
|
x,
|
|
366
367
|
f,
|
|
367
368
|
S
|
|
368
|
-
]),
|
|
369
|
+
]), T = t(() => me(S), [S]), D = t(() => he(x, f), [x, f]);
|
|
369
370
|
return /* @__PURE__ */ h("div", {
|
|
370
371
|
className: "rounded-lg border border-border bg-surface overflow-hidden",
|
|
371
372
|
children: [/* @__PURE__ */ h("div", {
|
|
372
373
|
className: "border-b border-border px-4 py-2 flex items-center justify-between gap-3",
|
|
373
374
|
children: [/* @__PURE__ */ h("div", {
|
|
374
375
|
className: "flex items-center gap-1.5",
|
|
375
|
-
children: [/* @__PURE__ */ m(
|
|
376
|
+
children: [/* @__PURE__ */ m(E, { className: "h-3.5 w-3.5 text-foreground-subtle" }), /* @__PURE__ */ m("h2", {
|
|
376
377
|
className: "text-xs font-semibold text-foreground uppercase tracking-wider",
|
|
377
378
|
children: "Audio Level History"
|
|
378
379
|
})]
|
|
379
|
-
}), /* @__PURE__ */ m(
|
|
380
|
-
presets:
|
|
380
|
+
}), /* @__PURE__ */ m(N, {
|
|
381
|
+
presets: ae,
|
|
381
382
|
value: a,
|
|
382
383
|
onChange: c
|
|
383
384
|
})]
|
|
@@ -398,7 +399,7 @@ function se({ deviceId: n }) {
|
|
|
398
399
|
className: "block",
|
|
399
400
|
onMouseLeave: () => p.bindHover(null),
|
|
400
401
|
children: [
|
|
401
|
-
|
|
402
|
+
T.map(({ y: e, label: t }, n) => /* @__PURE__ */ h("g", { children: [/* @__PURE__ */ m("line", {
|
|
402
403
|
x1: z.left,
|
|
403
404
|
x2: f - z.right,
|
|
404
405
|
y1: e,
|
|
@@ -437,15 +438,15 @@ function se({ deviceId: n }) {
|
|
|
437
438
|
}),
|
|
438
439
|
x.map((e, t) => e.topClass === null ? null : /* @__PURE__ */ m("circle", {
|
|
439
440
|
cx: B(t, x.length, f),
|
|
440
|
-
cy:
|
|
441
|
+
cy: le(e.dbfs, S),
|
|
441
442
|
r: 3,
|
|
442
|
-
fill:
|
|
443
|
+
fill: se(e.topClass),
|
|
443
444
|
stroke: "#000",
|
|
444
445
|
strokeOpacity: .3,
|
|
445
446
|
strokeWidth: .5
|
|
446
447
|
}, `dot-${t}`)),
|
|
447
448
|
x.map((e, t) => {
|
|
448
|
-
let n = B(t, x.length, f), r =
|
|
449
|
+
let n = B(t, x.length, f), r = le(e.dbfs, S), i = R - z.top - z.bottom, a = x.length > 1 ? (f - z.left - z.right) / (x.length - 1) : 24;
|
|
449
450
|
return /* @__PURE__ */ m("rect", {
|
|
450
451
|
x: n - a / 2,
|
|
451
452
|
y: z.top,
|
|
@@ -456,7 +457,7 @@ function se({ deviceId: n }) {
|
|
|
456
457
|
p.bindHover({
|
|
457
458
|
anchorX: v(n),
|
|
458
459
|
anchorY: r,
|
|
459
|
-
title: `${
|
|
460
|
+
title: `${ge(e.ts)} · ${e.dbfs?.toFixed(1) ?? "—"} dB`,
|
|
460
461
|
rows: [
|
|
461
462
|
{
|
|
462
463
|
label: "peak (window)",
|
|
@@ -469,7 +470,7 @@ function se({ deviceId: n }) {
|
|
|
469
470
|
...e.topClass === null ? [] : [{
|
|
470
471
|
label: e.topClass,
|
|
471
472
|
value: e.topScore == null ? "—" : `${(e.topScore * 100).toFixed(0)}%`,
|
|
472
|
-
colour:
|
|
473
|
+
colour: se(e.topClass)
|
|
473
474
|
}]
|
|
474
475
|
]
|
|
475
476
|
});
|
|
@@ -501,32 +502,32 @@ function B(e, t, n) {
|
|
|
501
502
|
let r = n - z.left - z.right;
|
|
502
503
|
return z.left + e / (t - 1) * r;
|
|
503
504
|
}
|
|
504
|
-
function ce(e, t) {
|
|
505
|
-
return le(e === null || !Number.isFinite(e) ? t.min : Math.max(t.min, Math.min(t.max, e)), t);
|
|
506
|
-
}
|
|
507
505
|
function le(e, t) {
|
|
506
|
+
return ue(e === null || !Number.isFinite(e) ? t.min : Math.max(t.min, Math.min(t.max, e)), t);
|
|
507
|
+
}
|
|
508
|
+
function ue(e, t) {
|
|
508
509
|
let n = R - z.top - z.bottom, r = Math.max(1, t.max - t.min), i = (e - t.min) / r;
|
|
509
510
|
return z.top + (1 - i) * n;
|
|
510
511
|
}
|
|
511
|
-
function
|
|
512
|
+
function de(e, t, n) {
|
|
512
513
|
if (e.length === 0) return null;
|
|
513
514
|
let r = [];
|
|
514
515
|
for (let i = 0; i < e.length; i++) {
|
|
515
|
-
let a = B(i, e.length, t), o =
|
|
516
|
+
let a = B(i, e.length, t), o = le(e[i].dbfs, n);
|
|
516
517
|
r.push(`${i === 0 ? "M" : "L"} ${a.toFixed(1)} ${o.toFixed(1)}`);
|
|
517
518
|
}
|
|
518
519
|
return r.join(" ");
|
|
519
520
|
}
|
|
520
|
-
function
|
|
521
|
+
function fe(e, t, n) {
|
|
521
522
|
if (e.length === 0) return null;
|
|
522
523
|
let r = [];
|
|
523
524
|
for (let i = 0; i < e.length; i++) {
|
|
524
|
-
let a = B(i, e.length, t), o =
|
|
525
|
+
let a = B(i, e.length, t), o = ue(Math.max(n.min, Math.min(n.max, e[i].peakDbfs)), n);
|
|
525
526
|
r.push(`${i === 0 ? "M" : "L"} ${a.toFixed(1)} ${o.toFixed(1)}`);
|
|
526
527
|
}
|
|
527
528
|
return r.join(" ");
|
|
528
529
|
}
|
|
529
|
-
function
|
|
530
|
+
function pe(e) {
|
|
530
531
|
if (e.length === 0) return {
|
|
531
532
|
min: -80,
|
|
532
533
|
max: -40
|
|
@@ -543,62 +544,62 @@ function fe(e) {
|
|
|
543
544
|
max: i
|
|
544
545
|
};
|
|
545
546
|
}
|
|
546
|
-
function
|
|
547
|
+
function me(e) {
|
|
547
548
|
let t = [];
|
|
548
549
|
for (let n = 0; n < 4; n++) {
|
|
549
550
|
let r = n / 3, i = e.min + (e.max - e.min) * r;
|
|
550
551
|
t.push({
|
|
551
|
-
y:
|
|
552
|
+
y: ue(i, e),
|
|
552
553
|
label: `${Math.round(i)}`
|
|
553
554
|
});
|
|
554
555
|
}
|
|
555
556
|
return t;
|
|
556
557
|
}
|
|
557
|
-
function
|
|
558
|
+
function he(e, t) {
|
|
558
559
|
if (e.length === 0) return [];
|
|
559
560
|
let n = e[0], r = e[e.length - 1], i = [], a = Math.min(5, e.length);
|
|
560
561
|
for (let e = 0; e < a; e++) {
|
|
561
562
|
let o = e / Math.max(1, a - 1), s = n.ts + (r.ts - n.ts) * o;
|
|
562
563
|
i.push({
|
|
563
564
|
x: z.left + o * (t - z.left - z.right),
|
|
564
|
-
label:
|
|
565
|
+
label: ge(s)
|
|
565
566
|
});
|
|
566
567
|
}
|
|
567
568
|
return i;
|
|
568
569
|
}
|
|
569
|
-
function
|
|
570
|
+
function ge(e) {
|
|
570
571
|
let t = new Date(e);
|
|
571
572
|
return `${String(t.getHours()).padStart(2, "0")}:${String(t.getMinutes()).padStart(2, "0")}`;
|
|
572
573
|
}
|
|
573
574
|
//#endregion
|
|
574
575
|
//#region src/pipeline-analytics/widgets/AudioMetricsPanel.tsx
|
|
575
|
-
function
|
|
576
|
+
function _e(e) {
|
|
576
577
|
return !Number.isFinite(e) || e <= 0 ? 60 : Math.round(e > 600 ? e / 1e3 : e);
|
|
577
578
|
}
|
|
578
|
-
function
|
|
579
|
+
function ve({ dev: e, deviceId: t, title: n = "Audio Metrics", variant: r = "full" }) {
|
|
579
580
|
let i = u(l().trpcClient, e === void 0 && t !== void 0 ? t : null, (e) => e.audioMetrics), a = f(e ? e.state.audioMetrics : void 0), o = e === void 0 ? i : a;
|
|
580
|
-
return o ? /* @__PURE__ */ m(
|
|
581
|
+
return o ? /* @__PURE__ */ m(ye, {
|
|
581
582
|
title: n,
|
|
582
583
|
variant: r,
|
|
583
584
|
ts: o.ts,
|
|
584
585
|
children: /* @__PURE__ */ h("div", {
|
|
585
586
|
className: r === "compact" ? "space-y-2" : "grid grid-cols-1 2xl:grid-cols-3 gap-3",
|
|
586
587
|
children: [
|
|
587
|
-
/* @__PURE__ */ m(be, { snapshot: o }),
|
|
588
588
|
/* @__PURE__ */ m(xe, { snapshot: o }),
|
|
589
|
-
/* @__PURE__ */ m(Se, { snapshot: o })
|
|
589
|
+
/* @__PURE__ */ m(Se, { snapshot: o }),
|
|
590
|
+
/* @__PURE__ */ m(Ce, { snapshot: o })
|
|
590
591
|
]
|
|
591
592
|
})
|
|
592
|
-
}) : /* @__PURE__ */ m(
|
|
593
|
+
}) : /* @__PURE__ */ m(ye, {
|
|
593
594
|
title: n,
|
|
594
595
|
variant: r,
|
|
595
|
-
children: /* @__PURE__ */ m(
|
|
596
|
-
icon: /* @__PURE__ */ m(
|
|
596
|
+
children: /* @__PURE__ */ m(be, {
|
|
597
|
+
icon: /* @__PURE__ */ m(j, { className: "h-5 w-5 mb-2 opacity-30" }),
|
|
597
598
|
message: e || t !== void 0 ? "No audio data yet — analytics pipeline must be active and audio enabled for this device." : "Resolving device…"
|
|
598
599
|
})
|
|
599
600
|
});
|
|
600
601
|
}
|
|
601
|
-
function
|
|
602
|
+
function ye({ title: e, variant: t, ts: n, children: r }) {
|
|
602
603
|
let i = n ? Math.max(0, Math.floor((Date.now() - n) / 1e3)) : null;
|
|
603
604
|
return /* @__PURE__ */ h("div", {
|
|
604
605
|
className: t === "compact" ? "rounded-md border border-border/60 bg-surface/60 p-3" : "rounded-lg border border-border bg-surface overflow-hidden",
|
|
@@ -617,7 +618,7 @@ function ve({ title: e, variant: t, ts: n, children: r }) {
|
|
|
617
618
|
})]
|
|
618
619
|
});
|
|
619
620
|
}
|
|
620
|
-
function
|
|
621
|
+
function be({ icon: e, message: t }) {
|
|
621
622
|
return /* @__PURE__ */ h("div", {
|
|
622
623
|
className: "px-4 py-6 flex flex-col items-center text-center text-foreground-subtle",
|
|
623
624
|
children: [e, /* @__PURE__ */ m("p", {
|
|
@@ -626,7 +627,7 @@ function ye({ icon: e, message: t }) {
|
|
|
626
627
|
})]
|
|
627
628
|
});
|
|
628
629
|
}
|
|
629
|
-
function
|
|
630
|
+
function xe({ snapshot: e }) {
|
|
630
631
|
let { dbfs: t } = e.level, n = Math.max(-80, Math.min(0, Number.isFinite(t) ? t : -80)), r = (n + 80) / 80 * 100, i = n > -10 ? "bg-danger" : n > -25 ? "bg-warning" : "bg-primary";
|
|
631
632
|
return /* @__PURE__ */ h("div", {
|
|
632
633
|
className: "rounded-md border border-border/60 bg-background/40 px-3 py-2",
|
|
@@ -634,7 +635,7 @@ function be({ snapshot: e }) {
|
|
|
634
635
|
/* @__PURE__ */ h("div", {
|
|
635
636
|
className: "flex items-center gap-1.5 mb-1.5 text-[11px] uppercase tracking-wider text-foreground-subtle",
|
|
636
637
|
children: [
|
|
637
|
-
/* @__PURE__ */ m(
|
|
638
|
+
/* @__PURE__ */ m(E, { className: "h-3.5 w-3.5" }),
|
|
638
639
|
/* @__PURE__ */ m("span", { children: "Level" }),
|
|
639
640
|
/* @__PURE__ */ m("span", {
|
|
640
641
|
className: "ml-auto text-base font-semibold text-foreground tabular-nums normal-case tracking-normal",
|
|
@@ -662,19 +663,19 @@ function be({ snapshot: e }) {
|
|
|
662
663
|
e.avgDbfs.toFixed(1),
|
|
663
664
|
" dB"
|
|
664
665
|
] }),
|
|
665
|
-
/* @__PURE__ */ h("span", { children: [
|
|
666
|
+
/* @__PURE__ */ h("span", { children: [_e(e.windowSec), "s window"] })
|
|
666
667
|
]
|
|
667
668
|
})
|
|
668
669
|
]
|
|
669
670
|
});
|
|
670
671
|
}
|
|
671
|
-
function
|
|
672
|
+
function Se({ snapshot: e }) {
|
|
672
673
|
let { current: t } = e;
|
|
673
674
|
return /* @__PURE__ */ h("div", {
|
|
674
675
|
className: "rounded-md border border-border/60 bg-background/40 px-3 py-2",
|
|
675
676
|
children: [/* @__PURE__ */ h("div", {
|
|
676
677
|
className: "flex items-center gap-1.5 mb-1.5 text-[11px] uppercase tracking-wider text-foreground-subtle",
|
|
677
|
-
children: [/* @__PURE__ */ m(
|
|
678
|
+
children: [/* @__PURE__ */ m(M, { className: "h-3.5 w-3.5" }), /* @__PURE__ */ m("span", { children: "Now" })]
|
|
678
679
|
}), t ? /* @__PURE__ */ h("div", {
|
|
679
680
|
className: "flex flex-col gap-1",
|
|
680
681
|
children: [/* @__PURE__ */ m("span", {
|
|
@@ -697,14 +698,14 @@ function xe({ snapshot: e }) {
|
|
|
697
698
|
})]
|
|
698
699
|
});
|
|
699
700
|
}
|
|
700
|
-
function
|
|
701
|
+
function Ce({ snapshot: e }) {
|
|
701
702
|
return e.byClass.length === 0 ? /* @__PURE__ */ h("div", {
|
|
702
703
|
className: "rounded-md border border-border/40 bg-background/20 px-3 py-2",
|
|
703
704
|
children: [/* @__PURE__ */ h("div", {
|
|
704
705
|
className: "flex items-center gap-1.5 mb-1.5 text-[11px] uppercase tracking-wider text-foreground-subtle",
|
|
705
|
-
children: [/* @__PURE__ */ m(
|
|
706
|
+
children: [/* @__PURE__ */ m(E, { className: "h-3.5 w-3.5" }), /* @__PURE__ */ h("span", { children: [
|
|
706
707
|
"Last ",
|
|
707
|
-
|
|
708
|
+
_e(e.windowSec),
|
|
708
709
|
"s"
|
|
709
710
|
] })]
|
|
710
711
|
}), /* @__PURE__ */ m("span", {
|
|
@@ -716,10 +717,10 @@ function Se({ snapshot: e }) {
|
|
|
716
717
|
children: [/* @__PURE__ */ h("div", {
|
|
717
718
|
className: "px-3 py-1.5 border-b border-border/40 flex items-center gap-1.5 text-[11px] uppercase tracking-wider text-foreground-subtle",
|
|
718
719
|
children: [
|
|
719
|
-
/* @__PURE__ */ m(
|
|
720
|
+
/* @__PURE__ */ m(E, { className: "h-3.5 w-3.5" }),
|
|
720
721
|
/* @__PURE__ */ h("span", { children: [
|
|
721
722
|
"Last ",
|
|
722
|
-
|
|
723
|
+
_e(e.windowSec),
|
|
723
724
|
"s"
|
|
724
725
|
] }),
|
|
725
726
|
/* @__PURE__ */ m("span", {
|
|
@@ -747,37 +748,43 @@ function Se({ snapshot: e }) {
|
|
|
747
748
|
}
|
|
748
749
|
//#endregion
|
|
749
750
|
//#region src/pipeline-analytics/widgets/OccupancyHistoryChart.tsx
|
|
750
|
-
var V = {
|
|
751
|
-
"5m": {
|
|
752
|
-
label: "5 min",
|
|
753
|
-
windowMs: 5 * 6e4,
|
|
754
|
-
resolution: "minute",
|
|
755
|
-
pollIntervalMs: 5e3
|
|
756
|
-
},
|
|
757
|
-
"30m": {
|
|
758
|
-
label: "30 min",
|
|
759
|
-
windowMs: 30 * 6e4,
|
|
760
|
-
resolution: "minute",
|
|
761
|
-
pollIntervalMs: 15e3
|
|
762
|
-
},
|
|
751
|
+
var we = 5 * 6e4, V = {
|
|
763
752
|
"1h": {
|
|
764
753
|
label: "1 h",
|
|
765
754
|
windowMs: 60 * 6e4,
|
|
766
|
-
resolution: "5min",
|
|
767
755
|
pollIntervalMs: 3e4
|
|
756
|
+
},
|
|
757
|
+
"6h": {
|
|
758
|
+
label: "6 h",
|
|
759
|
+
windowMs: 360 * 6e4,
|
|
760
|
+
pollIntervalMs: 6e4
|
|
761
|
+
},
|
|
762
|
+
"24h": {
|
|
763
|
+
label: "24 h",
|
|
764
|
+
windowMs: 1440 * 6e4,
|
|
765
|
+
pollIntervalMs: 12e4
|
|
766
|
+
},
|
|
767
|
+
"7d": {
|
|
768
|
+
label: "7 d",
|
|
769
|
+
windowMs: 10080 * 6e4,
|
|
770
|
+
pollIntervalMs: 3e5
|
|
768
771
|
}
|
|
769
|
-
},
|
|
772
|
+
}, Te = [
|
|
770
773
|
{
|
|
771
|
-
id: "
|
|
772
|
-
label: V["
|
|
774
|
+
id: "1h",
|
|
775
|
+
label: V["1h"].label
|
|
773
776
|
},
|
|
774
777
|
{
|
|
775
|
-
id: "
|
|
776
|
-
label: V["
|
|
778
|
+
id: "6h",
|
|
779
|
+
label: V["6h"].label
|
|
777
780
|
},
|
|
778
781
|
{
|
|
779
|
-
id: "
|
|
780
|
-
label: V["
|
|
782
|
+
id: "24h",
|
|
783
|
+
label: V["24h"].label
|
|
784
|
+
},
|
|
785
|
+
{
|
|
786
|
+
id: "7d",
|
|
787
|
+
label: V["7d"].label
|
|
781
788
|
}
|
|
782
789
|
], H = 140, U = {
|
|
783
790
|
top: 14,
|
|
@@ -785,68 +792,71 @@ var V = {
|
|
|
785
792
|
bottom: 24,
|
|
786
793
|
left: 32
|
|
787
794
|
}, W = "__all__";
|
|
788
|
-
function
|
|
789
|
-
let a = s(l().trpcClient, n), [c, u] = r("
|
|
790
|
-
let t =
|
|
795
|
+
function Ee({ deviceId: n }) {
|
|
796
|
+
let a = s(l().trpcClient, n), [c, u] = r("24h"), [d, p] = r(W), v = V[c], [y, b] = P(), x = I(), S = e(null), C = (e) => {
|
|
797
|
+
let t = S.current;
|
|
791
798
|
if (!t) return e;
|
|
792
799
|
let n = t.getBoundingClientRect();
|
|
793
|
-
return n.width === 0 ? e : e /
|
|
794
|
-
},
|
|
800
|
+
return n.width === 0 ? e : e / b * n.width;
|
|
801
|
+
}, w = f(a?.state.zoneAnalytics), T = t(() => {
|
|
795
802
|
let e = /* @__PURE__ */ new Set();
|
|
796
|
-
if (
|
|
797
|
-
if (
|
|
803
|
+
if (w?.frame.byClass) for (let t of Object.keys(w.frame.byClass)) e.add(t);
|
|
804
|
+
if (w?.zones) for (let t of w.zones) for (let n of Object.keys(t.byClass)) e.add(n);
|
|
798
805
|
return [...e].toSorted();
|
|
799
|
-
}, [
|
|
806
|
+
}, [w]);
|
|
800
807
|
i(() => {
|
|
801
|
-
d !== W && !
|
|
802
|
-
}, [d,
|
|
803
|
-
let
|
|
808
|
+
d !== W && !T.includes(d) && p(W);
|
|
809
|
+
}, [d, T]);
|
|
810
|
+
let E = o({
|
|
804
811
|
queryKey: [
|
|
805
|
-
"
|
|
812
|
+
"pipeline-analytics",
|
|
806
813
|
n,
|
|
807
|
-
"
|
|
814
|
+
"occupancyLts",
|
|
808
815
|
c,
|
|
809
816
|
d
|
|
810
817
|
],
|
|
811
818
|
queryFn: async () => {
|
|
812
819
|
if (!a) return [];
|
|
813
|
-
let e = Date.now();
|
|
814
|
-
return await a.
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
}) ?? []
|
|
820
|
+
let e = Date.now(), t = Math.floor((e - v.windowMs) / we) * we;
|
|
821
|
+
return (await a.pipelineAnalytics?.readLongTermSeries({
|
|
822
|
+
series: "occupancy",
|
|
823
|
+
scope: d === W ? _() : _(void 0, d),
|
|
824
|
+
from: t,
|
|
825
|
+
to: e
|
|
826
|
+
}) ?? []).map((e) => ({
|
|
827
|
+
ts: e.bucketStart,
|
|
828
|
+
count: e.max
|
|
829
|
+
}));
|
|
820
830
|
},
|
|
821
831
|
enabled: !!a,
|
|
822
|
-
refetchInterval:
|
|
823
|
-
staleTime: Math.max(1e3,
|
|
824
|
-
}),
|
|
825
|
-
if (
|
|
826
|
-
let e =
|
|
832
|
+
refetchInterval: v.pollIntervalMs,
|
|
833
|
+
staleTime: Math.max(1e3, v.pollIntervalMs / 2)
|
|
834
|
+
}), D = E.data ?? [], O = E.dataUpdatedAt > 0 ? E.dataUpdatedAt : Date.now(), A = O - v.windowMs, j = t(() => {
|
|
835
|
+
if (D.length === 0) return 1;
|
|
836
|
+
let e = D.reduce((e, t) => Math.max(e, t.count), 0);
|
|
827
837
|
return Math.max(1, Math.ceil(e * 1.15));
|
|
828
|
-
}, [
|
|
829
|
-
E,
|
|
830
|
-
y,
|
|
831
|
-
A
|
|
832
|
-
]), ee = t(() => te(k, D, y, U.left, U.right, 5), [
|
|
833
|
-
k,
|
|
838
|
+
}, [D]), M = t(() => Oe(D, b, j), [
|
|
834
839
|
D,
|
|
835
|
-
|
|
836
|
-
|
|
840
|
+
b,
|
|
841
|
+
j
|
|
842
|
+
]), F = t(() => te(A, O, b, U.left, U.right, 5), [
|
|
843
|
+
A,
|
|
844
|
+
O,
|
|
845
|
+
b
|
|
846
|
+
]), ne = t(() => ke(j), [j]);
|
|
837
847
|
return /* @__PURE__ */ h("div", {
|
|
838
848
|
className: "rounded-lg border border-border bg-surface overflow-hidden",
|
|
839
849
|
children: [/* @__PURE__ */ h("div", {
|
|
840
850
|
className: "border-b border-border px-4 py-2 flex items-center justify-between gap-3",
|
|
841
851
|
children: [/* @__PURE__ */ h("div", {
|
|
842
852
|
className: "flex items-center gap-1.5",
|
|
843
|
-
children: [/* @__PURE__ */ m(
|
|
853
|
+
children: [/* @__PURE__ */ m(k, { className: "h-3.5 w-3.5 text-foreground-subtle" }), /* @__PURE__ */ m("h2", {
|
|
844
854
|
className: "text-xs font-semibold text-foreground uppercase tracking-wider",
|
|
845
855
|
children: "Occupancy History"
|
|
846
856
|
})]
|
|
847
857
|
}), /* @__PURE__ */ h("div", {
|
|
848
858
|
className: "flex items-center gap-2",
|
|
849
|
-
children: [
|
|
859
|
+
children: [T.length > 0 && /* @__PURE__ */ h("select", {
|
|
850
860
|
value: d,
|
|
851
861
|
onChange: (e) => p(e.target.value),
|
|
852
862
|
className: "text-[10px] px-1.5 py-0.5 rounded border border-border bg-background text-foreground focus:outline-none focus:ring-1 focus:ring-primary/40",
|
|
@@ -854,36 +864,36 @@ function we({ deviceId: n }) {
|
|
|
854
864
|
children: [/* @__PURE__ */ m("option", {
|
|
855
865
|
value: W,
|
|
856
866
|
children: "All classes"
|
|
857
|
-
}),
|
|
867
|
+
}), T.map((e) => /* @__PURE__ */ m("option", {
|
|
858
868
|
value: e,
|
|
859
869
|
children: e
|
|
860
870
|
}, e))]
|
|
861
|
-
}), /* @__PURE__ */ m(
|
|
862
|
-
presets:
|
|
871
|
+
}), /* @__PURE__ */ m(N, {
|
|
872
|
+
presets: Te,
|
|
863
873
|
value: c,
|
|
864
874
|
onChange: u
|
|
865
875
|
})]
|
|
866
876
|
})]
|
|
867
877
|
}), /* @__PURE__ */ h("div", {
|
|
868
|
-
ref:
|
|
878
|
+
ref: y,
|
|
869
879
|
className: "p-3 min-w-0 relative",
|
|
870
|
-
children: [
|
|
880
|
+
children: [D.length === 0 ? /* @__PURE__ */ m("div", {
|
|
871
881
|
className: "flex items-center justify-center h-32 text-[11px] text-foreground-subtle italic",
|
|
872
|
-
children:
|
|
873
|
-
}) :
|
|
874
|
-
ref:
|
|
882
|
+
children: E.isLoading ? "Loading…" : "No occupancy history yet — analytics pipeline must be active."
|
|
883
|
+
}) : b === 0 ? /* @__PURE__ */ m("div", { className: "h-32" }) : /* @__PURE__ */ h(g, { children: [/* @__PURE__ */ h("svg", {
|
|
884
|
+
ref: S,
|
|
875
885
|
role: "img",
|
|
876
886
|
"aria-label": "Frame occupancy history",
|
|
877
887
|
width: "100%",
|
|
878
888
|
height: H,
|
|
879
|
-
viewBox: `0 0 ${
|
|
889
|
+
viewBox: `0 0 ${b} ${H}`,
|
|
880
890
|
preserveAspectRatio: "none",
|
|
881
891
|
className: "block",
|
|
882
|
-
onMouseLeave: () =>
|
|
892
|
+
onMouseLeave: () => x.bindHover(null),
|
|
883
893
|
children: [
|
|
884
|
-
|
|
894
|
+
ne.map(({ y: e, label: t }, n) => /* @__PURE__ */ h("g", { children: [/* @__PURE__ */ m("line", {
|
|
885
895
|
x1: U.left,
|
|
886
|
-
x2:
|
|
896
|
+
x2: b - U.right,
|
|
887
897
|
y1: e,
|
|
888
898
|
y2: e,
|
|
889
899
|
stroke: "currentColor",
|
|
@@ -896,22 +906,22 @@ function we({ deviceId: n }) {
|
|
|
896
906
|
className: "text-[9px] fill-foreground-subtle",
|
|
897
907
|
children: t
|
|
898
908
|
})] }, `y-${n}`)),
|
|
899
|
-
|
|
909
|
+
F.map(({ x: e, label: t }, n) => /* @__PURE__ */ m("text", {
|
|
900
910
|
x: e,
|
|
901
911
|
y: H - U.bottom + 12,
|
|
902
912
|
textAnchor: "middle",
|
|
903
913
|
className: "text-[9px] fill-foreground-subtle",
|
|
904
914
|
children: t
|
|
905
915
|
}, `x-${n}`)),
|
|
906
|
-
|
|
907
|
-
d:
|
|
916
|
+
M && /* @__PURE__ */ m("path", {
|
|
917
|
+
d: M,
|
|
908
918
|
fill: "none",
|
|
909
919
|
stroke: "currentColor",
|
|
910
920
|
className: "text-primary",
|
|
911
921
|
strokeWidth: 1.5
|
|
912
922
|
}),
|
|
913
|
-
|
|
914
|
-
let n =
|
|
923
|
+
D.map((e, t) => {
|
|
924
|
+
let n = ee(t, D.length, b, U.left, U.right), r = De(e.count, j), i = H - U.top - U.bottom, a = D.length > 1 ? (b - U.left - U.right) / (D.length - 1) : 24;
|
|
915
925
|
return /* @__PURE__ */ h("g", { children: [/* @__PURE__ */ m("circle", {
|
|
916
926
|
cx: n,
|
|
917
927
|
cy: r,
|
|
@@ -925,16 +935,16 @@ function we({ deviceId: n }) {
|
|
|
925
935
|
height: i,
|
|
926
936
|
fill: "transparent",
|
|
927
937
|
onMouseEnter: () => {
|
|
928
|
-
|
|
929
|
-
anchorX:
|
|
938
|
+
x.bindHover({
|
|
939
|
+
anchorX: C(n),
|
|
930
940
|
anchorY: r,
|
|
931
|
-
title: `${
|
|
941
|
+
title: `${Ae(e.ts)} · ${e.count} object${e.count === 1 ? "" : "s"}`,
|
|
932
942
|
rows: [{
|
|
933
943
|
label: "Class",
|
|
934
944
|
value: d === W ? "all" : d
|
|
935
945
|
}, {
|
|
936
946
|
label: "Bucket",
|
|
937
|
-
value:
|
|
947
|
+
value: "5 min"
|
|
938
948
|
}]
|
|
939
949
|
});
|
|
940
950
|
}
|
|
@@ -942,41 +952,38 @@ function we({ deviceId: n }) {
|
|
|
942
952
|
})
|
|
943
953
|
]
|
|
944
954
|
}), /* @__PURE__ */ m(L, {
|
|
945
|
-
state:
|
|
946
|
-
containerWidth:
|
|
947
|
-
})] }),
|
|
955
|
+
state: x.state,
|
|
956
|
+
containerWidth: b
|
|
957
|
+
})] }), D.length > 0 && /* @__PURE__ */ h("div", {
|
|
948
958
|
className: "flex items-center justify-between text-[10px] text-foreground-subtle mt-1",
|
|
949
959
|
children: [/* @__PURE__ */ h("span", { children: [
|
|
950
|
-
|
|
960
|
+
D.length,
|
|
951
961
|
" bucket",
|
|
952
|
-
|
|
953
|
-
" · "
|
|
954
|
-
_.resolution,
|
|
955
|
-
" ",
|
|
956
|
-
"resolution"
|
|
962
|
+
D.length === 1 ? "" : "s",
|
|
963
|
+
" · 5 min resolution"
|
|
957
964
|
] }), /* @__PURE__ */ h("span", { children: [
|
|
958
965
|
"peak ",
|
|
959
|
-
|
|
966
|
+
D.reduce((e, t) => Math.max(e, t.count), 0),
|
|
960
967
|
" obj"
|
|
961
968
|
] })]
|
|
962
969
|
})]
|
|
963
970
|
})]
|
|
964
971
|
});
|
|
965
972
|
}
|
|
966
|
-
function
|
|
973
|
+
function De(e, t) {
|
|
967
974
|
let n = H - U.top - U.bottom, r = Math.min(1, e / t);
|
|
968
975
|
return U.top + (1 - r) * n;
|
|
969
976
|
}
|
|
970
|
-
function
|
|
977
|
+
function Oe(e, t, n) {
|
|
971
978
|
if (e.length === 0) return null;
|
|
972
979
|
let r = [];
|
|
973
980
|
for (let i = 0; i < e.length; i++) {
|
|
974
|
-
let a =
|
|
981
|
+
let a = ee(i, e.length, t, U.left, U.right), o = De(e[i].count, n);
|
|
975
982
|
r.push(`${i === 0 ? "M" : "L"} ${a.toFixed(1)} ${o.toFixed(1)}`);
|
|
976
983
|
}
|
|
977
984
|
return r.join(" ");
|
|
978
985
|
}
|
|
979
|
-
function
|
|
986
|
+
function ke(e) {
|
|
980
987
|
let t = [];
|
|
981
988
|
for (let n = 0; n < 4; n++) {
|
|
982
989
|
let r = n / 3, i = Math.round(e * r), a = H - U.top - U.bottom;
|
|
@@ -987,7 +994,7 @@ function De(e) {
|
|
|
987
994
|
}
|
|
988
995
|
return t;
|
|
989
996
|
}
|
|
990
|
-
function
|
|
997
|
+
function Ae(e) {
|
|
991
998
|
let t = new Date(e);
|
|
992
999
|
return `${String(t.getHours()).padStart(2, "0")}:${String(t.getMinutes()).padStart(2, "0")}`;
|
|
993
1000
|
}
|
|
@@ -1012,7 +1019,7 @@ var G = {
|
|
|
1012
1019
|
bucketMs: 15 * 6e4,
|
|
1013
1020
|
pollIntervalMs: 3e5
|
|
1014
1021
|
}
|
|
1015
|
-
},
|
|
1022
|
+
}, je = [
|
|
1016
1023
|
{
|
|
1017
1024
|
id: "1h",
|
|
1018
1025
|
label: G["1h"].label
|
|
@@ -1025,14 +1032,14 @@ var G = {
|
|
|
1025
1032
|
id: "24h",
|
|
1026
1033
|
label: G["24h"].label
|
|
1027
1034
|
}
|
|
1028
|
-
],
|
|
1035
|
+
], Me = 5e3, K = 140, q = {
|
|
1029
1036
|
top: 14,
|
|
1030
1037
|
right: 12,
|
|
1031
1038
|
bottom: 24,
|
|
1032
1039
|
left: 32
|
|
1033
1040
|
};
|
|
1034
|
-
function
|
|
1035
|
-
let i = s(l().trpcClient, n), [a, c] = r("1h"), u = G[a], [d, f] =
|
|
1041
|
+
function Ne({ deviceId: n }) {
|
|
1042
|
+
let i = s(l().trpcClient, n), [a, c] = r("1h"), u = G[a], [d, f] = P(), p = I(), _ = e(null), v = (e) => {
|
|
1036
1043
|
let t = _.current;
|
|
1037
1044
|
if (!t) return e;
|
|
1038
1045
|
let n = t.getBoundingClientRect();
|
|
@@ -1049,13 +1056,13 @@ function je({ deviceId: n }) {
|
|
|
1049
1056
|
let e = Date.now() - u.windowMs;
|
|
1050
1057
|
return await i.pipelineAnalytics?.getMotionEvents({
|
|
1051
1058
|
since: e,
|
|
1052
|
-
limit:
|
|
1059
|
+
limit: Me
|
|
1053
1060
|
}) ?? [];
|
|
1054
1061
|
},
|
|
1055
1062
|
enabled: !!i,
|
|
1056
1063
|
refetchInterval: u.pollIntervalMs,
|
|
1057
1064
|
staleTime: Math.max(1e3, u.pollIntervalMs / 2)
|
|
1058
|
-
}), b = y.data ?? [], x = y.dataUpdatedAt > 0 ? y.dataUpdatedAt : Date.now(), S = x - u.windowMs, C = t(() =>
|
|
1065
|
+
}), b = y.data ?? [], x = y.dataUpdatedAt > 0 ? y.dataUpdatedAt : Date.now(), S = x - u.windowMs, C = t(() => Pe(b, S, x, u.bucketMs), [
|
|
1059
1066
|
b,
|
|
1060
1067
|
S,
|
|
1061
1068
|
x,
|
|
@@ -1064,23 +1071,23 @@ function je({ deviceId: n }) {
|
|
|
1064
1071
|
if (C.length === 0) return 1;
|
|
1065
1072
|
let e = C.reduce((e, t) => Math.max(e, t.count), 0);
|
|
1066
1073
|
return Math.max(1, Math.ceil(e * 1.15));
|
|
1067
|
-
}, [C]),
|
|
1074
|
+
}, [C]), T = t(() => te(S, x, f, q.left, q.right, 5), [
|
|
1068
1075
|
S,
|
|
1069
1076
|
x,
|
|
1070
1077
|
f
|
|
1071
|
-
]), D = t(() =>
|
|
1078
|
+
]), D = t(() => Ie(w), [w]), O = b.length;
|
|
1072
1079
|
return /* @__PURE__ */ h("div", {
|
|
1073
1080
|
className: "rounded-lg border border-border bg-surface overflow-hidden",
|
|
1074
1081
|
children: [/* @__PURE__ */ h("div", {
|
|
1075
1082
|
className: "border-b border-border px-4 py-2 flex items-center justify-between gap-3",
|
|
1076
1083
|
children: [/* @__PURE__ */ h("div", {
|
|
1077
1084
|
className: "flex items-center gap-1.5",
|
|
1078
|
-
children: [/* @__PURE__ */ m(
|
|
1085
|
+
children: [/* @__PURE__ */ m(E, { className: "h-3.5 w-3.5 text-foreground-subtle" }), /* @__PURE__ */ m("h2", {
|
|
1079
1086
|
className: "text-xs font-semibold text-foreground uppercase tracking-wider",
|
|
1080
1087
|
children: "Motion History"
|
|
1081
1088
|
})]
|
|
1082
|
-
}), /* @__PURE__ */ m(
|
|
1083
|
-
presets:
|
|
1089
|
+
}), /* @__PURE__ */ m(N, {
|
|
1090
|
+
presets: je,
|
|
1084
1091
|
value: a,
|
|
1085
1092
|
onChange: c
|
|
1086
1093
|
})]
|
|
@@ -1116,7 +1123,7 @@ function je({ deviceId: n }) {
|
|
|
1116
1123
|
className: "text-[9px] fill-foreground-subtle",
|
|
1117
1124
|
children: t
|
|
1118
1125
|
})] }, `y-${n}`)),
|
|
1119
|
-
|
|
1126
|
+
T.map(({ x: e, label: t }, n) => /* @__PURE__ */ m("text", {
|
|
1120
1127
|
x: e,
|
|
1121
1128
|
y: K - q.bottom + 12,
|
|
1122
1129
|
textAnchor: "middle",
|
|
@@ -1124,7 +1131,7 @@ function je({ deviceId: n }) {
|
|
|
1124
1131
|
children: t
|
|
1125
1132
|
}, `x-${n}`)),
|
|
1126
1133
|
C.map((e, t) => {
|
|
1127
|
-
let { x: n, w: r } =
|
|
1134
|
+
let { x: n, w: r } = Fe(e.bucketStart, u.bucketMs, S, x, f), i = K - q.top - q.bottom, a = e.count / w * i, o = q.top + (i - a), s = e.bucketStart + u.bucketMs;
|
|
1128
1135
|
return /* @__PURE__ */ h("g", { children: [e.count > 0 && /* @__PURE__ */ m("rect", {
|
|
1129
1136
|
x: n,
|
|
1130
1137
|
y: o,
|
|
@@ -1143,10 +1150,10 @@ function je({ deviceId: n }) {
|
|
|
1143
1150
|
p.bindHover({
|
|
1144
1151
|
anchorX: v(n + r / 2),
|
|
1145
1152
|
anchorY: o,
|
|
1146
|
-
title: `${
|
|
1153
|
+
title: `${Le(e.bucketStart, s)} · ${e.count} event${e.count === 1 ? "" : "s"}`,
|
|
1147
1154
|
rows: [{
|
|
1148
1155
|
label: "Bucket",
|
|
1149
|
-
value:
|
|
1156
|
+
value: Re(u.bucketMs)
|
|
1150
1157
|
}, {
|
|
1151
1158
|
label: "Count",
|
|
1152
1159
|
value: `${e.count}`
|
|
@@ -1166,7 +1173,7 @@ function je({ deviceId: n }) {
|
|
|
1166
1173
|
" event",
|
|
1167
1174
|
O === 1 ? "" : "s",
|
|
1168
1175
|
" · ",
|
|
1169
|
-
|
|
1176
|
+
Re(u.bucketMs),
|
|
1170
1177
|
" ",
|
|
1171
1178
|
"buckets"
|
|
1172
1179
|
] }), /* @__PURE__ */ h("span", { children: [
|
|
@@ -1178,7 +1185,7 @@ function je({ deviceId: n }) {
|
|
|
1178
1185
|
})]
|
|
1179
1186
|
});
|
|
1180
1187
|
}
|
|
1181
|
-
function
|
|
1188
|
+
function Pe(e, t, n, r) {
|
|
1182
1189
|
if (n <= t) return [];
|
|
1183
1190
|
let i = Math.floor(t / r) * r, a = Math.floor(n / r) * r, o = /* @__PURE__ */ new Map();
|
|
1184
1191
|
for (let e = i; e <= a; e += r) o.set(e, 0);
|
|
@@ -1192,14 +1199,14 @@ function Me(e, t, n, r) {
|
|
|
1192
1199
|
count: t
|
|
1193
1200
|
}));
|
|
1194
1201
|
}
|
|
1195
|
-
function
|
|
1202
|
+
function Fe(e, t, n, r, i) {
|
|
1196
1203
|
let a = Math.max(1, r - n), o = i - q.left - q.right;
|
|
1197
1204
|
return {
|
|
1198
1205
|
x: q.left + (e - n) / a * o,
|
|
1199
1206
|
w: t / a * o
|
|
1200
1207
|
};
|
|
1201
1208
|
}
|
|
1202
|
-
function
|
|
1209
|
+
function Ie(e) {
|
|
1203
1210
|
let t = [];
|
|
1204
1211
|
for (let n = 0; n < 4; n++) {
|
|
1205
1212
|
let r = n / 3, i = Math.round(e * r), a = K - q.top - q.bottom;
|
|
@@ -1210,14 +1217,14 @@ function Pe(e) {
|
|
|
1210
1217
|
}
|
|
1211
1218
|
return t;
|
|
1212
1219
|
}
|
|
1213
|
-
function
|
|
1220
|
+
function Le(e, t) {
|
|
1214
1221
|
let n = (e) => {
|
|
1215
1222
|
let t = new Date(e);
|
|
1216
1223
|
return `${String(t.getHours()).padStart(2, "0")}:${String(t.getMinutes()).padStart(2, "0")}`;
|
|
1217
1224
|
};
|
|
1218
1225
|
return `${n(e)}–${n(t)}`;
|
|
1219
1226
|
}
|
|
1220
|
-
function
|
|
1227
|
+
function Re(e) {
|
|
1221
1228
|
return e >= 60 * 6e4 ? `${Math.round(e / 6e4 / 60)}h` : e >= 6e4 ? `${Math.round(e / 6e4)}m` : `${Math.round(e / 1e3)}s`;
|
|
1222
1229
|
}
|
|
1223
1230
|
//#endregion
|
|
@@ -1241,7 +1248,7 @@ var J = {
|
|
|
1241
1248
|
bucketMs: 15 * 6e4,
|
|
1242
1249
|
pollIntervalMs: 3e5
|
|
1243
1250
|
}
|
|
1244
|
-
},
|
|
1251
|
+
}, ze = [
|
|
1245
1252
|
{
|
|
1246
1253
|
id: "1h",
|
|
1247
1254
|
label: J["1h"].label
|
|
@@ -1254,14 +1261,14 @@ var J = {
|
|
|
1254
1261
|
id: "24h",
|
|
1255
1262
|
label: J["24h"].label
|
|
1256
1263
|
}
|
|
1257
|
-
],
|
|
1264
|
+
], Be = 5e3, Ve = 4, Y = "__other__", X = "__all__", Z = 160, Q = {
|
|
1258
1265
|
top: 14,
|
|
1259
1266
|
right: 12,
|
|
1260
1267
|
bottom: 24,
|
|
1261
1268
|
left: 32
|
|
1262
1269
|
};
|
|
1263
|
-
function
|
|
1264
|
-
let a = s(l().trpcClient, n), [c, u] = r("1h"), [d, f] = r(X), p = J[c], [_, v] =
|
|
1270
|
+
function He({ deviceId: n }) {
|
|
1271
|
+
let a = s(l().trpcClient, n), [c, u] = r("1h"), [d, f] = r(X), p = J[c], [_, v] = P(), y = I(), b = e(null), x = o({
|
|
1265
1272
|
queryKey: [
|
|
1266
1273
|
"pipeline-analytics",
|
|
1267
1274
|
n,
|
|
@@ -1273,7 +1280,7 @@ function Be({ deviceId: n }) {
|
|
|
1273
1280
|
let e = Date.now() - p.windowMs;
|
|
1274
1281
|
return await a.pipelineAnalytics?.getObjectEvents({
|
|
1275
1282
|
since: e,
|
|
1276
|
-
limit:
|
|
1283
|
+
limit: Be
|
|
1277
1284
|
}) ?? [];
|
|
1278
1285
|
},
|
|
1279
1286
|
enabled: !!a,
|
|
@@ -1291,12 +1298,12 @@ function Be({ deviceId: n }) {
|
|
|
1291
1298
|
S,
|
|
1292
1299
|
E
|
|
1293
1300
|
]);
|
|
1294
|
-
let
|
|
1301
|
+
let D = t(() => Ue(C, Ve), [C]), k = t(() => We(C, T, w, p.bucketMs, D), [
|
|
1295
1302
|
C,
|
|
1296
1303
|
T,
|
|
1297
1304
|
w,
|
|
1298
1305
|
p.bucketMs,
|
|
1299
|
-
|
|
1306
|
+
D
|
|
1300
1307
|
]), A = t(() => {
|
|
1301
1308
|
if (k.length === 0) return 1;
|
|
1302
1309
|
let e = k.reduce((e, t) => Math.max(e, t.total), 0);
|
|
@@ -1305,10 +1312,10 @@ function Be({ deviceId: n }) {
|
|
|
1305
1312
|
T,
|
|
1306
1313
|
w,
|
|
1307
1314
|
v
|
|
1308
|
-
]),
|
|
1309
|
-
let e =
|
|
1310
|
-
return C.some((e) => !
|
|
1311
|
-
}, [C,
|
|
1315
|
+
]), M = t(() => Ke(A), [A]), F = t(() => {
|
|
1316
|
+
let e = D.map((e) => e.className);
|
|
1317
|
+
return C.some((e) => !D.some((t) => t.className === e.className)) && e.push(Y), e;
|
|
1318
|
+
}, [C, D]), ee = (e) => {
|
|
1312
1319
|
let t = b.current;
|
|
1313
1320
|
if (!t) return e;
|
|
1314
1321
|
let n = t.getBoundingClientRect();
|
|
@@ -1320,7 +1327,7 @@ function Be({ deviceId: n }) {
|
|
|
1320
1327
|
className: "border-b border-border px-4 py-2 flex items-center justify-between gap-3",
|
|
1321
1328
|
children: [/* @__PURE__ */ h("div", {
|
|
1322
1329
|
className: "flex items-center gap-1.5",
|
|
1323
|
-
children: [/* @__PURE__ */ m(
|
|
1330
|
+
children: [/* @__PURE__ */ m(O, { className: "h-3.5 w-3.5 text-foreground-subtle" }), /* @__PURE__ */ m("h2", {
|
|
1324
1331
|
className: "text-xs font-semibold text-foreground uppercase tracking-wider",
|
|
1325
1332
|
children: "Detection History"
|
|
1326
1333
|
})]
|
|
@@ -1338,8 +1345,8 @@ function Be({ deviceId: n }) {
|
|
|
1338
1345
|
value: e,
|
|
1339
1346
|
children: e
|
|
1340
1347
|
}, e))]
|
|
1341
|
-
}), /* @__PURE__ */ m(
|
|
1342
|
-
presets:
|
|
1348
|
+
}), /* @__PURE__ */ m(N, {
|
|
1349
|
+
presets: ze,
|
|
1343
1350
|
value: c,
|
|
1344
1351
|
onChange: u
|
|
1345
1352
|
})]
|
|
@@ -1362,7 +1369,7 @@ function Be({ deviceId: n }) {
|
|
|
1362
1369
|
className: "block",
|
|
1363
1370
|
onMouseLeave: () => y.bindHover(null),
|
|
1364
1371
|
children: [
|
|
1365
|
-
|
|
1372
|
+
M.map(({ y: e, label: t }, n) => /* @__PURE__ */ h("g", { children: [/* @__PURE__ */ m("line", {
|
|
1366
1373
|
x1: Q.left,
|
|
1367
1374
|
x2: v - Q.right,
|
|
1368
1375
|
y1: e,
|
|
@@ -1386,12 +1393,12 @@ function Be({ deviceId: n }) {
|
|
|
1386
1393
|
}, `x-${n}`)),
|
|
1387
1394
|
k.map((e, t) => {
|
|
1388
1395
|
if (e.total === 0) return null;
|
|
1389
|
-
let { x: n, w: r } =
|
|
1396
|
+
let { x: n, w: r } = Ge(e.bucketStart, p.bucketMs, T, w, v), i = Z - Q.top - Q.bottom, a = e.total / A * i, o = Q.top + (i - a), s = 0, c = F.map((t, a) => {
|
|
1390
1397
|
let o = e.byClass[t] ?? 0;
|
|
1391
1398
|
if (o === 0) return null;
|
|
1392
1399
|
let c = o / A * i, l = Q.top + (i - s - c);
|
|
1393
1400
|
s += c;
|
|
1394
|
-
let u = t === Y ? "#94a3b8" :
|
|
1401
|
+
let u = t === Y ? "#94a3b8" : re(a);
|
|
1395
1402
|
return /* @__PURE__ */ m("rect", {
|
|
1396
1403
|
x: n,
|
|
1397
1404
|
y: l,
|
|
@@ -1409,15 +1416,15 @@ function Be({ deviceId: n }) {
|
|
|
1409
1416
|
fill: "transparent",
|
|
1410
1417
|
onMouseEnter: () => {
|
|
1411
1418
|
y.bindHover({
|
|
1412
|
-
anchorX:
|
|
1419
|
+
anchorX: ee(n + r / 2),
|
|
1413
1420
|
anchorY: o,
|
|
1414
|
-
title: `${
|
|
1415
|
-
rows:
|
|
1421
|
+
title: `${qe(e.bucketStart, l, p.bucketMs)} · ${e.total} detection${e.total === 1 ? "" : "s"}`,
|
|
1422
|
+
rows: F.map((t, n) => {
|
|
1416
1423
|
let r = e.byClass[t] ?? 0;
|
|
1417
1424
|
return r === 0 ? null : {
|
|
1418
1425
|
label: t === Y ? "other" : t,
|
|
1419
1426
|
value: `${r}`,
|
|
1420
|
-
colour: t === Y ? "#94a3b8" :
|
|
1427
|
+
colour: t === Y ? "#94a3b8" : re(n)
|
|
1421
1428
|
};
|
|
1422
1429
|
}).filter((e) => e !== null)
|
|
1423
1430
|
});
|
|
@@ -1430,7 +1437,7 @@ function Be({ deviceId: n }) {
|
|
|
1430
1437
|
state: y.state,
|
|
1431
1438
|
containerWidth: v
|
|
1432
1439
|
}),
|
|
1433
|
-
/* @__PURE__ */ m(
|
|
1440
|
+
/* @__PURE__ */ m(Ye, { stackOrder: F })
|
|
1434
1441
|
] }), C.length > 0 && /* @__PURE__ */ h("div", {
|
|
1435
1442
|
className: "flex items-center justify-between text-[10px] text-foreground-subtle mt-1",
|
|
1436
1443
|
children: [/* @__PURE__ */ h("span", { children: [
|
|
@@ -1439,7 +1446,7 @@ function Be({ deviceId: n }) {
|
|
|
1439
1446
|
C.length === 1 ? "" : "s",
|
|
1440
1447
|
" ·",
|
|
1441
1448
|
" ",
|
|
1442
|
-
|
|
1449
|
+
Je(p.bucketMs),
|
|
1443
1450
|
" buckets"
|
|
1444
1451
|
] }), /* @__PURE__ */ h("span", { children: [
|
|
1445
1452
|
"peak ",
|
|
@@ -1450,7 +1457,7 @@ function Be({ deviceId: n }) {
|
|
|
1450
1457
|
})]
|
|
1451
1458
|
});
|
|
1452
1459
|
}
|
|
1453
|
-
function
|
|
1460
|
+
function Ue(e, t) {
|
|
1454
1461
|
let n = /* @__PURE__ */ new Map();
|
|
1455
1462
|
for (let t of e) n.set(t.className, (n.get(t.className) ?? 0) + 1);
|
|
1456
1463
|
return [...n.entries()].toSorted(([, e], [, t]) => t - e).slice(0, t).map(([e, t]) => ({
|
|
@@ -1458,7 +1465,7 @@ function Ve(e, t) {
|
|
|
1458
1465
|
count: t
|
|
1459
1466
|
}));
|
|
1460
1467
|
}
|
|
1461
|
-
function
|
|
1468
|
+
function We(e, t, n, r, i) {
|
|
1462
1469
|
if (n <= t) return [];
|
|
1463
1470
|
let a = new Set(i.map((e) => e.className)), o = Math.floor(t / r) * r, s = Math.floor(n / r) * r, c = /* @__PURE__ */ new Map();
|
|
1464
1471
|
for (let e = o; e <= s; e += r) c.set(e, {
|
|
@@ -1479,14 +1486,14 @@ function He(e, t, n, r, i) {
|
|
|
1479
1486
|
byClass: t.byClass
|
|
1480
1487
|
}));
|
|
1481
1488
|
}
|
|
1482
|
-
function
|
|
1489
|
+
function Ge(e, t, n, r, i) {
|
|
1483
1490
|
let a = Math.max(1, r - n), o = i - Q.left - Q.right;
|
|
1484
1491
|
return {
|
|
1485
1492
|
x: Q.left + (e - n) / a * o,
|
|
1486
1493
|
w: t / a * o
|
|
1487
1494
|
};
|
|
1488
1495
|
}
|
|
1489
|
-
function
|
|
1496
|
+
function Ke(e) {
|
|
1490
1497
|
let t = [];
|
|
1491
1498
|
for (let n = 0; n < 4; n++) {
|
|
1492
1499
|
let r = n / 3, i = Math.round(e * r), a = Z - Q.top - Q.bottom;
|
|
@@ -1497,48 +1504,48 @@ function We(e) {
|
|
|
1497
1504
|
}
|
|
1498
1505
|
return t;
|
|
1499
1506
|
}
|
|
1500
|
-
function
|
|
1507
|
+
function qe(e, t, n) {
|
|
1501
1508
|
let r = (e) => `${String(e.getHours()).padStart(2, "0")}:${String(e.getMinutes()).padStart(2, "0")}`;
|
|
1502
1509
|
return `${r(new Date(e))}–${r(new Date(t))}`;
|
|
1503
1510
|
}
|
|
1504
|
-
function
|
|
1511
|
+
function Je(e) {
|
|
1505
1512
|
return e >= 60 * 6e4 ? `${Math.round(e / 6e4 / 60)}h` : e >= 6e4 ? `${Math.round(e / 6e4)}m` : `${Math.round(e / 1e3)}s`;
|
|
1506
1513
|
}
|
|
1507
|
-
function
|
|
1514
|
+
function Ye({ stackOrder: e }) {
|
|
1508
1515
|
return e.length === 0 ? null : /* @__PURE__ */ m("div", {
|
|
1509
1516
|
className: "flex flex-wrap gap-2 mt-2 px-1",
|
|
1510
1517
|
children: e.map((e, t) => /* @__PURE__ */ h("span", {
|
|
1511
1518
|
className: "inline-flex items-center gap-1 text-[10px] text-foreground-subtle",
|
|
1512
1519
|
children: [/* @__PURE__ */ m("span", {
|
|
1513
1520
|
className: "inline-block h-2 w-2 rounded-sm",
|
|
1514
|
-
style: { backgroundColor: e === Y ? "#94a3b8" :
|
|
1521
|
+
style: { backgroundColor: e === Y ? "#94a3b8" : re(t) }
|
|
1515
1522
|
}), /* @__PURE__ */ m("span", { children: e === Y ? "other" : e })]
|
|
1516
1523
|
}, e))
|
|
1517
1524
|
});
|
|
1518
1525
|
}
|
|
1519
1526
|
//#endregion
|
|
1520
1527
|
//#region src/pipeline-analytics/widgets/OccupancyPanel.tsx
|
|
1521
|
-
function
|
|
1528
|
+
function Xe({ dev: e, deviceId: t, title: n = "Live Occupancy", variant: r = "full" }) {
|
|
1522
1529
|
let i = s(l().trpcClient, e === void 0 && t !== void 0 ? t : null), a = e ?? i, o = f(a?.state.zoneAnalytics);
|
|
1523
|
-
return o ? /* @__PURE__ */ m(
|
|
1530
|
+
return o ? /* @__PURE__ */ m(Ze, {
|
|
1524
1531
|
title: n,
|
|
1525
1532
|
variant: r,
|
|
1526
1533
|
ts: o.ts,
|
|
1527
1534
|
children: /* @__PURE__ */ h("div", {
|
|
1528
1535
|
className: r === "compact" ? "space-y-2" : "grid grid-cols-1 2xl:grid-cols-3 gap-3",
|
|
1529
1536
|
children: [
|
|
1530
|
-
/* @__PURE__ */ m(
|
|
1531
|
-
/* @__PURE__ */ m(
|
|
1532
|
-
/* @__PURE__ */ m(
|
|
1537
|
+
/* @__PURE__ */ m($e, { frame: o.frame }),
|
|
1538
|
+
/* @__PURE__ */ m(tt, { snapshot: o }),
|
|
1539
|
+
/* @__PURE__ */ m(et, { unzoned: o.unzoned })
|
|
1533
1540
|
]
|
|
1534
1541
|
})
|
|
1535
|
-
}) : /* @__PURE__ */ m(
|
|
1542
|
+
}) : /* @__PURE__ */ m(Ze, {
|
|
1536
1543
|
title: n,
|
|
1537
1544
|
variant: r,
|
|
1538
|
-
children: /* @__PURE__ */ m(
|
|
1545
|
+
children: /* @__PURE__ */ m(Qe, { message: a ? "No occupancy data yet — analytics pipeline must be active for this device." : "Resolving device…" })
|
|
1539
1546
|
});
|
|
1540
1547
|
}
|
|
1541
|
-
function
|
|
1548
|
+
function Ze({ title: e, variant: t, ts: n, children: r }) {
|
|
1542
1549
|
let i = n ? Math.max(0, Math.floor((Date.now() - n) / 1e3)) : null;
|
|
1543
1550
|
return /* @__PURE__ */ h("div", {
|
|
1544
1551
|
className: t === "compact" ? "rounded-md border border-border/60 bg-surface/60 p-3" : "rounded-lg border border-border bg-surface overflow-hidden",
|
|
@@ -1557,36 +1564,36 @@ function Ye({ title: e, variant: t, ts: n, children: r }) {
|
|
|
1557
1564
|
})]
|
|
1558
1565
|
});
|
|
1559
1566
|
}
|
|
1560
|
-
function
|
|
1567
|
+
function Qe({ message: e }) {
|
|
1561
1568
|
return /* @__PURE__ */ h("div", {
|
|
1562
1569
|
className: "px-4 py-6 flex flex-col items-center text-center text-foreground-subtle",
|
|
1563
|
-
children: [/* @__PURE__ */ m(
|
|
1570
|
+
children: [/* @__PURE__ */ m(k, { className: "h-5 w-5 mb-2 opacity-30" }), /* @__PURE__ */ m("p", {
|
|
1564
1571
|
className: "text-[11px]",
|
|
1565
1572
|
children: e
|
|
1566
1573
|
})]
|
|
1567
1574
|
});
|
|
1568
1575
|
}
|
|
1569
|
-
function
|
|
1570
|
-
return /* @__PURE__ */ m(
|
|
1571
|
-
icon: /* @__PURE__ */ m(
|
|
1576
|
+
function $e({ frame: e }) {
|
|
1577
|
+
return /* @__PURE__ */ m(nt, {
|
|
1578
|
+
icon: /* @__PURE__ */ m(D, { className: "h-3.5 w-3.5" }),
|
|
1572
1579
|
label: "Frame total",
|
|
1573
1580
|
total: e.totalObjects,
|
|
1574
1581
|
byClass: e.byClass,
|
|
1575
1582
|
tone: "default"
|
|
1576
1583
|
});
|
|
1577
1584
|
}
|
|
1578
|
-
function
|
|
1579
|
-
return /* @__PURE__ */ m(
|
|
1580
|
-
icon: /* @__PURE__ */ m(
|
|
1585
|
+
function et({ unzoned: e }) {
|
|
1586
|
+
return /* @__PURE__ */ m(nt, {
|
|
1587
|
+
icon: /* @__PURE__ */ m(A, { className: "h-3.5 w-3.5" }),
|
|
1581
1588
|
label: "Outside any zone",
|
|
1582
1589
|
total: e.totalObjects,
|
|
1583
1590
|
byClass: e.byClass,
|
|
1584
1591
|
tone: "muted"
|
|
1585
1592
|
});
|
|
1586
1593
|
}
|
|
1587
|
-
function
|
|
1588
|
-
return e.zones.length === 0 ? /* @__PURE__ */ m(
|
|
1589
|
-
icon: /* @__PURE__ */ m(
|
|
1594
|
+
function tt({ snapshot: e }) {
|
|
1595
|
+
return e.zones.length === 0 ? /* @__PURE__ */ m(nt, {
|
|
1596
|
+
icon: /* @__PURE__ */ m(k, { className: "h-3.5 w-3.5" }),
|
|
1590
1597
|
label: "Per-zone",
|
|
1591
1598
|
total: 0,
|
|
1592
1599
|
byClass: {},
|
|
@@ -1597,7 +1604,7 @@ function $e({ snapshot: e }) {
|
|
|
1597
1604
|
children: [/* @__PURE__ */ h("div", {
|
|
1598
1605
|
className: "px-3 py-1.5 border-b border-border/40 flex items-center gap-1.5 text-[11px] uppercase tracking-wider text-foreground-subtle",
|
|
1599
1606
|
children: [
|
|
1600
|
-
/* @__PURE__ */ m(
|
|
1607
|
+
/* @__PURE__ */ m(k, { className: "h-3.5 w-3.5" }),
|
|
1601
1608
|
/* @__PURE__ */ m("span", { children: "Per-zone" }),
|
|
1602
1609
|
/* @__PURE__ */ m("span", {
|
|
1603
1610
|
className: "ml-auto text-[10px] normal-case tracking-normal",
|
|
@@ -1617,12 +1624,12 @@ function $e({ snapshot: e }) {
|
|
|
1617
1624
|
className: "rounded-full px-2 py-0.5 text-[10px] font-medium bg-foreground-subtle/10 text-foreground-subtle border border-border",
|
|
1618
1625
|
children: e.totalObjects
|
|
1619
1626
|
})]
|
|
1620
|
-
}), /* @__PURE__ */ m(
|
|
1627
|
+
}), /* @__PURE__ */ m(rt, { byClass: e.byClass })]
|
|
1621
1628
|
}, e.zoneId))
|
|
1622
1629
|
})]
|
|
1623
1630
|
});
|
|
1624
1631
|
}
|
|
1625
|
-
function
|
|
1632
|
+
function nt({ icon: e, label: t, total: n, byClass: r, tone: i, emptyMessage: a }) {
|
|
1626
1633
|
let o = Object.keys(r).length;
|
|
1627
1634
|
return /* @__PURE__ */ h("div", {
|
|
1628
1635
|
className: i === "muted" ? "rounded-md border border-border/40 bg-background/20 px-3 py-2" : "rounded-md border border-border/60 bg-background/40 px-3 py-2",
|
|
@@ -1639,10 +1646,10 @@ function et({ icon: e, label: t, total: n, byClass: r, tone: i, emptyMessage: a
|
|
|
1639
1646
|
}), o === 0 ? /* @__PURE__ */ m("span", {
|
|
1640
1647
|
className: "text-[10px] text-foreground-subtle italic",
|
|
1641
1648
|
children: a ?? "no objects"
|
|
1642
|
-
}) : /* @__PURE__ */ m(
|
|
1649
|
+
}) : /* @__PURE__ */ m(rt, { byClass: r })]
|
|
1643
1650
|
});
|
|
1644
1651
|
}
|
|
1645
|
-
function
|
|
1652
|
+
function rt({ byClass: e }) {
|
|
1646
1653
|
let n = t(() => Object.entries(e).sort(([, e], [, t]) => t - e), [e]);
|
|
1647
1654
|
return n.length === 0 ? /* @__PURE__ */ m("span", {
|
|
1648
1655
|
className: "text-[10px] text-foreground-subtle italic",
|
|
@@ -1660,7 +1667,7 @@ function tt({ byClass: e }) {
|
|
|
1660
1667
|
}
|
|
1661
1668
|
//#endregion
|
|
1662
1669
|
//#region src/pipeline-analytics/widgets/LiveStatsTab.tsx
|
|
1663
|
-
function
|
|
1670
|
+
function it({ deviceId: e }) {
|
|
1664
1671
|
return /* @__PURE__ */ h("div", {
|
|
1665
1672
|
className: d,
|
|
1666
1673
|
children: [
|
|
@@ -1708,35 +1715,35 @@ function $({ name: e }) {
|
|
|
1708
1715
|
children: [e, " requires a deviceId"]
|
|
1709
1716
|
});
|
|
1710
1717
|
}
|
|
1711
|
-
function rt(e) {
|
|
1712
|
-
return e.deviceId === void 0 ? /* @__PURE__ */ m($, { name: "AudioHistoryChart" }) : /* @__PURE__ */ m(se, { deviceId: e.deviceId });
|
|
1713
|
-
}
|
|
1714
|
-
function it(e) {
|
|
1715
|
-
return e.deviceId === void 0 ? /* @__PURE__ */ m($, { name: "AudioMetricsPanel" }) : /* @__PURE__ */ m(_e, { deviceId: e.deviceId });
|
|
1716
|
-
}
|
|
1717
1718
|
function at(e) {
|
|
1718
|
-
return e.deviceId === void 0 ? /* @__PURE__ */ m($, { name: "
|
|
1719
|
+
return e.deviceId === void 0 ? /* @__PURE__ */ m($, { name: "AudioHistoryChart" }) : /* @__PURE__ */ m(ce, { deviceId: e.deviceId });
|
|
1719
1720
|
}
|
|
1720
1721
|
function ot(e) {
|
|
1721
|
-
return e.deviceId === void 0 ? /* @__PURE__ */ m($, { name: "
|
|
1722
|
+
return e.deviceId === void 0 ? /* @__PURE__ */ m($, { name: "AudioMetricsPanel" }) : /* @__PURE__ */ m(ve, { deviceId: e.deviceId });
|
|
1722
1723
|
}
|
|
1723
1724
|
function st(e) {
|
|
1724
|
-
return e.deviceId === void 0 ? /* @__PURE__ */ m($, { name: "
|
|
1725
|
+
return e.deviceId === void 0 ? /* @__PURE__ */ m($, { name: "OccupancyHistoryChart" }) : /* @__PURE__ */ m(Ee, { deviceId: e.deviceId });
|
|
1725
1726
|
}
|
|
1726
1727
|
function ct(e) {
|
|
1727
|
-
return e.deviceId === void 0 ? /* @__PURE__ */ m($, { name: "
|
|
1728
|
+
return e.deviceId === void 0 ? /* @__PURE__ */ m($, { name: "MotionHistoryChart" }) : /* @__PURE__ */ m(Ne, { deviceId: e.deviceId });
|
|
1728
1729
|
}
|
|
1729
1730
|
function lt(e) {
|
|
1730
|
-
return e.deviceId === void 0 ? /* @__PURE__ */ m($, { name: "
|
|
1731
|
+
return e.deviceId === void 0 ? /* @__PURE__ */ m($, { name: "DetectionHistoryChart" }) : /* @__PURE__ */ m(He, { deviceId: e.deviceId });
|
|
1732
|
+
}
|
|
1733
|
+
function ut(e) {
|
|
1734
|
+
return e.deviceId === void 0 ? /* @__PURE__ */ m($, { name: "LiveOccupancyPanel" }) : /* @__PURE__ */ m(Xe, { deviceId: e.deviceId });
|
|
1735
|
+
}
|
|
1736
|
+
function dt(e) {
|
|
1737
|
+
return e.deviceId === void 0 ? /* @__PURE__ */ m($, { name: "LiveStats" }) : /* @__PURE__ */ m(it, { deviceId: e.deviceId });
|
|
1731
1738
|
}
|
|
1732
|
-
var
|
|
1733
|
-
"audio-history-chart":
|
|
1734
|
-
"audio-metrics-panel":
|
|
1735
|
-
"occupancy-history-chart":
|
|
1736
|
-
"motion-history-chart":
|
|
1737
|
-
"detection-history-chart":
|
|
1738
|
-
"live-occupancy-panel":
|
|
1739
|
-
"live-stats":
|
|
1739
|
+
var ft = {
|
|
1740
|
+
"audio-history-chart": at,
|
|
1741
|
+
"audio-metrics-panel": ot,
|
|
1742
|
+
"occupancy-history-chart": st,
|
|
1743
|
+
"motion-history-chart": ct,
|
|
1744
|
+
"detection-history-chart": lt,
|
|
1745
|
+
"live-occupancy-panel": ut,
|
|
1746
|
+
"live-stats": dt
|
|
1740
1747
|
};
|
|
1741
1748
|
//#endregion
|
|
1742
|
-
export {
|
|
1749
|
+
export { ft as default };
|