@camstack/addon-training 0.1.23 → 0.1.26
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/MaskShapeCanvas-Kfg9dl6B.mjs +686 -0
- package/dist/MotionZonesSettings-0RO2vXPR.mjs +292 -0
- package/dist/{PrivacyMaskSettings-CM_WsrKB.mjs → PrivacyMaskSettings-DQUoMnuu.mjs} +45 -70
- package/dist/ReactKonva-DGuYUN0L.mjs +5416 -0
- package/dist/{SceneMonitorEditor-B-sAJ--C.mjs → SceneMonitorEditor-C3FOjEom.mjs} +311 -311
- package/dist/_stub.js +16427 -6989
- package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_training_page-DKblQaAP.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_training_page-CkXUIAzx.mjs} +3 -3
- package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-OmGE1nuE.mjs +26 -0
- package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DpjirGmB.mjs +89 -0
- package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare___mf_0_trpc_mf_1_client__loadShare__.js-CFCVuRAs.mjs +58 -0
- package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.js-BkvDudqY.mjs +62 -0
- package/dist/{_virtual_mf___mfe_internal__addon_training_page__loadShare__react__loadShare__.js-BT_wL8s3.mjs → _virtual_mf___mfe_internal__addon_training_page__loadShare__react__loadShare__.js-DeDbF7NI.mjs} +1 -1
- package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-DnrbBvrw.mjs +34 -0
- package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare__react_mf_2_dom__loadShare__.js-DAZkHxxU.mjs +45 -0
- package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-CHqN9NLt.mjs +34 -0
- package/dist/{dist-DwF1P1v7.js → dist-5IcZ6clu.js} +22 -22
- package/dist/{dist-CVDWIKl7.mjs → dist-BT11nKlQ.mjs} +22 -22
- package/dist/grid-2x2-Dip9973H.mjs +21 -0
- package/dist/{hostInit-Di0tDODX.mjs → hostInit-CRpxjzVt.mjs} +2 -2
- package/dist/index.js +1 -1
- package/dist/lib-CVGFTwe0.mjs +7770 -0
- package/dist/orchestrator/training.addon.js +1 -1
- package/dist/orchestrator/training.addon.mjs +1 -1
- package/dist/{player-overlays-BFAqW2L1.mjs → player-overlays-ChonJUSb.mjs} +32 -10
- package/dist/providers/modal/training-modal.addon.js +113 -27
- package/dist/providers/modal/training-modal.addon.mjs +113 -27
- package/dist/remoteEntry.js +1 -1
- package/dist/{responsive-BBlQWFFi.mjs → responsive-vGH-n9E5.mjs} +42 -38
- package/dist/{scene-monitor-copy-D5mKGqt0.mjs → scene-monitor-copy-Bv7SdZp4.mjs} +4 -4
- package/dist/{square-D0FYSm8b.mjs → square-CT7zu_EB.mjs} +29 -4
- package/dist/{trash-2-DdjGvgDw.mjs → trash-2-JjHVW2_2.mjs} +1 -1
- package/dist/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_training_page__remoteEntry_js-Dw400Y0a.mjs → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_training_page__remoteEntry_js-C_ftN9dQ.mjs} +399 -390
- package/package.json +1 -1
- package/dist/MaskShapeCanvas-BokARvOj.mjs +0 -13806
- package/dist/MotionZonesSettings-CwGjtvsX.mjs +0 -310
- package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-ff7X-Xlf.mjs +0 -26
- package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-BSOdwqcC.mjs +0 -26
- package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare___mf_0_trpc_mf_1_client__loadShare__.js-B3rryujf.mjs +0 -25
- package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.js-nL4MGFRP.mjs +0 -26
- package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-DDBEvLdo.mjs +0 -26
- package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare__react_mf_2_dom__loadShare__.js-CK-LlgOt.mjs +0 -26
- package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-gTIQrhKs.mjs +0 -25
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import { S as e, _ as t, c as n, g as r, m as i, u as a } from "./_virtual_mf___mfe_internal__addon_training_page__loadShare__react__loadShare__.js-DeDbF7NI.mjs";
|
|
2
|
+
import { f as o, h as s, m as ee, v as te } from "./responsive-vGH-n9E5.mjs";
|
|
3
|
+
import { r as c, t as l } from "./player-overlays-ChonJUSb.mjs";
|
|
4
|
+
import { t as ne } from "./grid-2x2-Dip9973H.mjs";
|
|
5
|
+
import { n as u, r as d, t as f } from "./_virtual_mf___mfe_internal__addon_training_page__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-DnrbBvrw.mjs";
|
|
6
|
+
import { MaskShapeCanvas as p } from "./MaskShapeCanvas-Kfg9dl6B.mjs";
|
|
7
|
+
//#region ../ui-library/src/composites/cap-settings/MotionZonesSettings.tsx
|
|
8
|
+
e();
|
|
9
|
+
var m = 110, h = "motion-zones", g = 0, _ = [
|
|
10
|
+
1,
|
|
11
|
+
2,
|
|
12
|
+
3
|
|
13
|
+
], v = 1, y = "rounded-md border border-border bg-surface px-2 py-1 text-[11px] font-medium text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors", b = "rounded-md border border-primary/50 bg-primary/15 px-2.5 py-1 text-[11px] font-medium text-primary hover:bg-primary/25 disabled:opacity-40 transition-colors";
|
|
14
|
+
function x(e, t, n) {
|
|
15
|
+
let r = t * n, i = Array.from({ length: r });
|
|
16
|
+
for (let t = 0; t < r; t += 1) i[t] = e[t] === !0;
|
|
17
|
+
return i;
|
|
18
|
+
}
|
|
19
|
+
function S(e, t) {
|
|
20
|
+
if (e.length !== t.length) return !1;
|
|
21
|
+
for (let n = 0; n < e.length; n += 1) if (e[n] !== t[n]) return !1;
|
|
22
|
+
return !0;
|
|
23
|
+
}
|
|
24
|
+
function C(e, t) {
|
|
25
|
+
return Math.ceil(e / t);
|
|
26
|
+
}
|
|
27
|
+
function w(e, t, n) {
|
|
28
|
+
return Math.min(n - 1, Math.floor((e + .5) / t * n));
|
|
29
|
+
}
|
|
30
|
+
function T(e, t, n, r) {
|
|
31
|
+
let i = C(t, r), a = C(n, r), o = Array.from({ length: i * a }, () => !1);
|
|
32
|
+
for (let r = 0; r < n; r += 1) {
|
|
33
|
+
let s = w(r, n, a);
|
|
34
|
+
for (let n = 0; n < t; n += 1) e[r * t + n] === !0 && (o[s * i + w(n, t, i)] = !0);
|
|
35
|
+
}
|
|
36
|
+
return o;
|
|
37
|
+
}
|
|
38
|
+
function E(e, t, n, r) {
|
|
39
|
+
let i = C(t, r), a = C(n, r), o = Array.from({ length: t * n }, () => !1);
|
|
40
|
+
for (let r = 0; r < n; r += 1) {
|
|
41
|
+
let s = w(r, n, a);
|
|
42
|
+
for (let n = 0; n < t; n += 1) o[r * t + n] = e[s * i + w(n, t, i)] === !0;
|
|
43
|
+
}
|
|
44
|
+
return o;
|
|
45
|
+
}
|
|
46
|
+
function D({ deviceId: e }) {
|
|
47
|
+
let w = s(te().trpcClient, e), [D, O] = t(null), [k, A] = t(!1), [j, M] = t(null), [N, P] = t(null), [F, I] = t(v), [L, R] = t(!1), [z, B] = t(!1), V = r(!1);
|
|
48
|
+
a(() => {
|
|
49
|
+
if (!w) return;
|
|
50
|
+
let e = !1;
|
|
51
|
+
return V.current = !1, O(null), A(!1), M(null), P(null), I(v), B(!1), (async () => {
|
|
52
|
+
try {
|
|
53
|
+
let t = await w.motionZones?.getOptions({});
|
|
54
|
+
if (e) return;
|
|
55
|
+
if (!t) throw Error("device proxy not ready");
|
|
56
|
+
if (O(t), V.current) return;
|
|
57
|
+
let n = await w.motionZones?.getStatus({});
|
|
58
|
+
if (e) return;
|
|
59
|
+
if (!n) throw Error("device proxy not ready");
|
|
60
|
+
V.current = !0;
|
|
61
|
+
let r = n.regions.find((e) => e.shape.kind === "grid"), i = x(r ? r.shape.cells : [], t.grid.width, t.grid.height);
|
|
62
|
+
P(i), M(T(i, t.grid.width, t.grid.height, v));
|
|
63
|
+
} catch (t) {
|
|
64
|
+
if (e) return;
|
|
65
|
+
ee(t) ? A(!0) : console.error("Motion Zones load failed", t);
|
|
66
|
+
}
|
|
67
|
+
})(), () => {
|
|
68
|
+
e = !0;
|
|
69
|
+
};
|
|
70
|
+
}, [w]);
|
|
71
|
+
let H = D ? D.grid.width : 0, U = D ? D.grid.height : 0, W = C(H, F), G = C(U, F), K = i(() => j && D ? E(j, H, U, F) : null, [
|
|
72
|
+
j,
|
|
73
|
+
D,
|
|
74
|
+
H,
|
|
75
|
+
U,
|
|
76
|
+
F
|
|
77
|
+
]), q = i(() => K !== null && N !== null && !S(K, N), [K, N]), J = i(() => K ? K.reduce((e, t) => t ? e + 1 : e, 0) : 0, [K]), Y = H * U, X = W * G, Z = n((e) => {
|
|
78
|
+
X > 0 && M(Array.from({ length: X }, () => e));
|
|
79
|
+
}, [X]), re = n(() => {
|
|
80
|
+
M((e) => e && e.map((e) => !e));
|
|
81
|
+
}, []), ie = n(() => {
|
|
82
|
+
N && D && M(T(N, H, U, F));
|
|
83
|
+
}, [
|
|
84
|
+
N,
|
|
85
|
+
D,
|
|
86
|
+
H,
|
|
87
|
+
U,
|
|
88
|
+
F
|
|
89
|
+
]), ae = n((e) => {
|
|
90
|
+
e === F || !D || M((t) => {
|
|
91
|
+
if (!t) return I(e), t;
|
|
92
|
+
let n = T(E(t, H, U, F), H, U, e);
|
|
93
|
+
return I(e), n;
|
|
94
|
+
});
|
|
95
|
+
}, [
|
|
96
|
+
F,
|
|
97
|
+
D,
|
|
98
|
+
H,
|
|
99
|
+
U
|
|
100
|
+
]), Q = i(() => D && j ? [{
|
|
101
|
+
id: g,
|
|
102
|
+
shape: {
|
|
103
|
+
kind: "grid",
|
|
104
|
+
gridWidth: W,
|
|
105
|
+
gridHeight: G,
|
|
106
|
+
cells: [...j]
|
|
107
|
+
}
|
|
108
|
+
}] : [], [
|
|
109
|
+
D,
|
|
110
|
+
j,
|
|
111
|
+
W,
|
|
112
|
+
G
|
|
113
|
+
]), $ = n((e, t) => {
|
|
114
|
+
t.kind === "grid" && M(t.cells);
|
|
115
|
+
}, []), oe = n(async () => {
|
|
116
|
+
if (!(!w || !j || !D)) {
|
|
117
|
+
R(!0);
|
|
118
|
+
try {
|
|
119
|
+
let e = E(j, D.grid.width, D.grid.height, F), t = {
|
|
120
|
+
kind: "grid",
|
|
121
|
+
gridWidth: D.grid.width,
|
|
122
|
+
gridHeight: D.grid.height,
|
|
123
|
+
cells: e
|
|
124
|
+
};
|
|
125
|
+
await w.motionZones?.setZone({ patch: { regions: [{
|
|
126
|
+
id: g,
|
|
127
|
+
enabled: !0,
|
|
128
|
+
shape: t
|
|
129
|
+
}] } });
|
|
130
|
+
let n = await w.motionZones?.getStatus({});
|
|
131
|
+
if (n) {
|
|
132
|
+
let e = n.regions.find((e) => e.shape.kind === "grid"), t = x(e ? e.shape.cells : [], D.grid.width, D.grid.height);
|
|
133
|
+
P(t), M(T(t, D.grid.width, D.grid.height, F));
|
|
134
|
+
}
|
|
135
|
+
} catch (e) {
|
|
136
|
+
console.error("Motion Zones save failed", e);
|
|
137
|
+
} finally {
|
|
138
|
+
R(!1);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}, [
|
|
142
|
+
w,
|
|
143
|
+
j,
|
|
144
|
+
D,
|
|
145
|
+
F
|
|
146
|
+
]);
|
|
147
|
+
return l(i(() => z && !k && D && j ? {
|
|
148
|
+
id: h,
|
|
149
|
+
order: m,
|
|
150
|
+
node: /* @__PURE__ */ u(p, {
|
|
151
|
+
transparent: !0,
|
|
152
|
+
items: Q,
|
|
153
|
+
supportedShapes: ["grid"],
|
|
154
|
+
grid: {
|
|
155
|
+
width: W,
|
|
156
|
+
height: G
|
|
157
|
+
},
|
|
158
|
+
selectedId: g,
|
|
159
|
+
onSelect: () => {},
|
|
160
|
+
onShapeChange: $,
|
|
161
|
+
onDrawComplete: () => {},
|
|
162
|
+
drawingKind: null
|
|
163
|
+
})
|
|
164
|
+
} : null, [
|
|
165
|
+
z,
|
|
166
|
+
k,
|
|
167
|
+
D,
|
|
168
|
+
j,
|
|
169
|
+
Q,
|
|
170
|
+
$,
|
|
171
|
+
W,
|
|
172
|
+
G
|
|
173
|
+
])), w ? /* @__PURE__ */ u(c, {
|
|
174
|
+
title: "Motion Zones",
|
|
175
|
+
icon: /* @__PURE__ */ u(ne, { className: "h-3.5 w-3.5 text-foreground-subtle" }),
|
|
176
|
+
children: /* @__PURE__ */ u("div", {
|
|
177
|
+
className: "flex flex-col gap-3",
|
|
178
|
+
children: k ? /* @__PURE__ */ u("p", {
|
|
179
|
+
className: `${o} leading-relaxed`,
|
|
180
|
+
children: "This camera doesn't expose an on-board motion zones grid."
|
|
181
|
+
}) : !k && D !== null && j !== null ? /* @__PURE__ */ d(f, { children: [/* @__PURE__ */ d("p", {
|
|
182
|
+
className: `${o} leading-relaxed`,
|
|
183
|
+
children: [
|
|
184
|
+
"Toggle ",
|
|
185
|
+
/* @__PURE__ */ u("strong", {
|
|
186
|
+
className: "text-foreground",
|
|
187
|
+
children: "Edit grid"
|
|
188
|
+
}),
|
|
189
|
+
" to paint the region directly on the live frame, then ",
|
|
190
|
+
/* @__PURE__ */ u("strong", {
|
|
191
|
+
className: "text-foreground",
|
|
192
|
+
children: "Save"
|
|
193
|
+
}),
|
|
194
|
+
" to push the mask to the camera. Pick a bigger",
|
|
195
|
+
" ",
|
|
196
|
+
/* @__PURE__ */ u("strong", {
|
|
197
|
+
className: "text-foreground",
|
|
198
|
+
children: "Cell size"
|
|
199
|
+
}),
|
|
200
|
+
" for quicker, broad-stroke painting — it's resampled to the camera's native ",
|
|
201
|
+
D.grid.width,
|
|
202
|
+
"×",
|
|
203
|
+
D.grid.height,
|
|
204
|
+
" grid on save (×1 is the finest)."
|
|
205
|
+
]
|
|
206
|
+
}), /* @__PURE__ */ d("div", {
|
|
207
|
+
className: "flex items-center gap-2 flex-wrap",
|
|
208
|
+
children: [
|
|
209
|
+
/* @__PURE__ */ u("button", {
|
|
210
|
+
type: "button",
|
|
211
|
+
onClick: () => B((e) => !e),
|
|
212
|
+
disabled: L,
|
|
213
|
+
"aria-pressed": z,
|
|
214
|
+
className: z ? b : y,
|
|
215
|
+
children: z ? "Done editing" : "Edit grid"
|
|
216
|
+
}),
|
|
217
|
+
/* @__PURE__ */ u("button", {
|
|
218
|
+
type: "button",
|
|
219
|
+
onClick: () => Z(!0),
|
|
220
|
+
disabled: L,
|
|
221
|
+
className: y,
|
|
222
|
+
children: "All on"
|
|
223
|
+
}),
|
|
224
|
+
/* @__PURE__ */ u("button", {
|
|
225
|
+
type: "button",
|
|
226
|
+
onClick: () => Z(!1),
|
|
227
|
+
disabled: L,
|
|
228
|
+
className: y,
|
|
229
|
+
children: "All off"
|
|
230
|
+
}),
|
|
231
|
+
/* @__PURE__ */ u("button", {
|
|
232
|
+
type: "button",
|
|
233
|
+
onClick: re,
|
|
234
|
+
disabled: L,
|
|
235
|
+
className: y,
|
|
236
|
+
children: "Invert"
|
|
237
|
+
}),
|
|
238
|
+
/* @__PURE__ */ d("div", {
|
|
239
|
+
className: "flex items-center gap-1 ml-1",
|
|
240
|
+
role: "group",
|
|
241
|
+
"aria-label": "Cell size",
|
|
242
|
+
children: [/* @__PURE__ */ u("span", {
|
|
243
|
+
className: `${o} mr-0.5`,
|
|
244
|
+
children: "Cell size"
|
|
245
|
+
}), _.map((e) => /* @__PURE__ */ d("button", {
|
|
246
|
+
type: "button",
|
|
247
|
+
onClick: () => ae(e),
|
|
248
|
+
disabled: L,
|
|
249
|
+
"aria-pressed": F === e,
|
|
250
|
+
title: e === 1 ? `Camera grid ${H}×${U} (finest)` : `${C(H, e)}×${C(U, e)} painting grid · cells ×${e} bigger`,
|
|
251
|
+
className: F === e ? b : y,
|
|
252
|
+
children: ["×", e]
|
|
253
|
+
}, e))]
|
|
254
|
+
}),
|
|
255
|
+
/* @__PURE__ */ d("span", {
|
|
256
|
+
className: `${o} ml-1 tabular-nums`,
|
|
257
|
+
children: [
|
|
258
|
+
J,
|
|
259
|
+
" / ",
|
|
260
|
+
Y,
|
|
261
|
+
" cells · ",
|
|
262
|
+
D.grid.width,
|
|
263
|
+
"×",
|
|
264
|
+
D.grid.height,
|
|
265
|
+
F === 1 ? "" : ` · paint ${W}×${G}`
|
|
266
|
+
]
|
|
267
|
+
}),
|
|
268
|
+
/* @__PURE__ */ u("span", { className: "flex-1" }),
|
|
269
|
+
/* @__PURE__ */ u("button", {
|
|
270
|
+
type: "button",
|
|
271
|
+
onClick: ie,
|
|
272
|
+
disabled: L || !q,
|
|
273
|
+
className: "rounded-md border border-border bg-surface px-2 py-1 text-[11px] text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors",
|
|
274
|
+
children: "Revert"
|
|
275
|
+
}),
|
|
276
|
+
/* @__PURE__ */ u("button", {
|
|
277
|
+
type: "button",
|
|
278
|
+
onClick: () => void oe(),
|
|
279
|
+
disabled: L || !q,
|
|
280
|
+
className: b,
|
|
281
|
+
children: L ? "Saving…" : "Save"
|
|
282
|
+
})
|
|
283
|
+
]
|
|
284
|
+
})] }) : /* @__PURE__ */ u("p", {
|
|
285
|
+
className: `${o} leading-relaxed`,
|
|
286
|
+
children: "Loading the camera's grid…"
|
|
287
|
+
})
|
|
288
|
+
})
|
|
289
|
+
}) : null;
|
|
290
|
+
}
|
|
291
|
+
//#endregion
|
|
292
|
+
export { D as MotionZonesSettings };
|
|
@@ -1,39 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { t as
|
|
6
|
-
import { n as l, r as u, t as
|
|
7
|
-
import { MaskShapeCanvas as
|
|
8
|
-
var
|
|
1
|
+
import { S as e, _ as t, c as n, g as r, m as i, u as a } from "./_virtual_mf___mfe_internal__addon_training_page__loadShare__react__loadShare__.js-DeDbF7NI.mjs";
|
|
2
|
+
import { b as o, f as s, h as ee, m as te, v as ne } from "./responsive-vGH-n9E5.mjs";
|
|
3
|
+
import { r as re, t as ie } from "./player-overlays-ChonJUSb.mjs";
|
|
4
|
+
import { i as ae, n as oe, r as se, t as c } from "./square-CT7zu_EB.mjs";
|
|
5
|
+
import { t as ce } from "./trash-2-JjHVW2_2.mjs";
|
|
6
|
+
import { n as l, r as u, t as le } from "./_virtual_mf___mfe_internal__addon_training_page__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-DnrbBvrw.mjs";
|
|
7
|
+
import { MaskShapeCanvas as ue } from "./MaskShapeCanvas-Kfg9dl6B.mjs";
|
|
8
|
+
var de = o("hexagon", [["path", {
|
|
9
9
|
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",
|
|
10
10
|
key: "yt0hxn"
|
|
11
|
-
}]])
|
|
12
|
-
["path", {
|
|
13
|
-
d: "M12 19v3",
|
|
14
|
-
key: "npa21l"
|
|
15
|
-
}],
|
|
16
|
-
["path", {
|
|
17
|
-
d: "M15 9.34V5a3 3 0 0 0-5.68-1.33",
|
|
18
|
-
key: "1gzdoj"
|
|
19
|
-
}],
|
|
20
|
-
["path", {
|
|
21
|
-
d: "M16.95 16.95A7 7 0 0 1 5 12v-2",
|
|
22
|
-
key: "cqa7eg"
|
|
23
|
-
}],
|
|
24
|
-
["path", {
|
|
25
|
-
d: "M18.89 13.23A7 7 0 0 0 19 12v-2",
|
|
26
|
-
key: "16hl24"
|
|
27
|
-
}],
|
|
28
|
-
["path", {
|
|
29
|
-
d: "m2 2 20 20",
|
|
30
|
-
key: "1ooewy"
|
|
31
|
-
}],
|
|
32
|
-
["path", {
|
|
33
|
-
d: "M9 9v3a3 3 0 0 0 5.12 2.12",
|
|
34
|
-
key: "r2i35w"
|
|
35
|
-
}]
|
|
36
|
-
]);
|
|
11
|
+
}]]);
|
|
37
12
|
//#endregion
|
|
38
13
|
//#region ../ui-library/src/composites/cap-settings/privacy-mask-audio.ts
|
|
39
14
|
e();
|
|
@@ -68,17 +43,17 @@ function he(e, t) {
|
|
|
68
43
|
return !0;
|
|
69
44
|
}
|
|
70
45
|
function v({ deviceId: e }) {
|
|
71
|
-
let
|
|
46
|
+
let o = ee(ne().trpcClient, e), [d, f] = t(null), [v, y] = t(!1), [b, x] = t(!1), [S, C] = t(null), [w, T] = t(null), [E, D] = t(!1), [O, k] = t(!1), [A, j] = t(null), [M, N] = t(null), [ge, P] = t(null), [F, I] = t(null), [L, R] = t(null), z = r(!1);
|
|
72
47
|
a(() => {
|
|
73
|
-
if (!
|
|
48
|
+
if (!o) return;
|
|
74
49
|
let e = !1;
|
|
75
50
|
return z.current = !1, f(null), y(!1), x(!1), C(null), T(null), k(!1), j(null), N(null), P(null), I(null), R(null), (async () => {
|
|
76
51
|
try {
|
|
77
|
-
let t = await
|
|
52
|
+
let t = await o.privacyMask?.getOptions({});
|
|
78
53
|
if (e) return;
|
|
79
54
|
if (!t) throw Error("device proxy not ready");
|
|
80
55
|
if (f(t), z.current) return;
|
|
81
|
-
let n = await
|
|
56
|
+
let n = await o.privacyMask?.getStatus({});
|
|
82
57
|
if (e) return;
|
|
83
58
|
if (!n) throw Error("device proxy not ready");
|
|
84
59
|
if (n.regions === null) {
|
|
@@ -93,29 +68,29 @@ function v({ deviceId: e }) {
|
|
|
93
68
|
T(r), C(r), P(n.audioEnabled);
|
|
94
69
|
} catch (t) {
|
|
95
70
|
if (e) return;
|
|
96
|
-
|
|
71
|
+
te(t) ? y(!0) : console.error("Privacy Mask load failed", t);
|
|
97
72
|
}
|
|
98
73
|
})(), () => {
|
|
99
74
|
e = !0;
|
|
100
75
|
};
|
|
101
|
-
}, [
|
|
76
|
+
}, [o]);
|
|
102
77
|
let B = i(() => S !== null && w !== null && (S.enabled !== w.enabled || !he(S.regions, w.regions)), [S, w]), V = S ? S.regions.length : 0, H = d ? d.maxRegions : 0, U = r(0);
|
|
103
78
|
a(() => {
|
|
104
79
|
U.current = H;
|
|
105
80
|
}, [H]);
|
|
106
|
-
let W = H > 0 && V >= H, _e =
|
|
81
|
+
let W = H > 0 && V >= H, _e = n(() => {
|
|
107
82
|
C((e) => e && {
|
|
108
83
|
...e,
|
|
109
84
|
enabled: !e.enabled
|
|
110
85
|
});
|
|
111
|
-
}, []), G =
|
|
86
|
+
}, []), G = n((e) => {
|
|
112
87
|
j(typeof e == "number" ? e : null);
|
|
113
88
|
}, []), K = i(() => S ? S.regions.map((e) => ({
|
|
114
89
|
id: e.id,
|
|
115
90
|
shape: e.shape,
|
|
116
91
|
enabled: e.enabled,
|
|
117
92
|
label: `Zone ${String(e.id)}`
|
|
118
|
-
})) : [], [S]), q =
|
|
93
|
+
})) : [], [S]), q = n((e, t) => {
|
|
119
94
|
let n = _(t);
|
|
120
95
|
n && C((t) => t && {
|
|
121
96
|
...t,
|
|
@@ -124,7 +99,7 @@ function v({ deviceId: e }) {
|
|
|
124
99
|
shape: n
|
|
125
100
|
} : t)
|
|
126
101
|
});
|
|
127
|
-
}, []), J =
|
|
102
|
+
}, []), J = n((e) => {
|
|
128
103
|
let t = _(e);
|
|
129
104
|
t && (N(null), C((e) => {
|
|
130
105
|
if (!e) return e;
|
|
@@ -140,29 +115,29 @@ function v({ deviceId: e }) {
|
|
|
140
115
|
regions: [...e.regions, i]
|
|
141
116
|
};
|
|
142
117
|
}));
|
|
143
|
-
}, []), Y =
|
|
118
|
+
}, []), Y = n((e) => {
|
|
144
119
|
k(!0), j(null), N(e);
|
|
145
|
-
}, []), ve =
|
|
120
|
+
}, []), ve = n((e) => {
|
|
146
121
|
k(!0), N(null), j(e);
|
|
147
|
-
}, []), X =
|
|
122
|
+
}, []), X = n((e) => {
|
|
148
123
|
j((t) => t === e ? null : t), C((t) => t && {
|
|
149
124
|
...t,
|
|
150
125
|
regions: t.regions.filter((t) => t.id !== e)
|
|
151
126
|
});
|
|
152
|
-
}, []), ye =
|
|
127
|
+
}, []), ye = n(() => {
|
|
153
128
|
N(null), j(null), w && C({
|
|
154
129
|
enabled: w.enabled,
|
|
155
130
|
regions: w.regions
|
|
156
131
|
});
|
|
157
|
-
}, [w]), be =
|
|
158
|
-
if (!(!
|
|
132
|
+
}, [w]), be = n(async () => {
|
|
133
|
+
if (!(!o || !S)) {
|
|
159
134
|
D(!0);
|
|
160
135
|
try {
|
|
161
|
-
await
|
|
136
|
+
await o.privacyMask?.setMask({ patch: {
|
|
162
137
|
enabled: S.enabled,
|
|
163
138
|
regions: [...S.regions]
|
|
164
139
|
} });
|
|
165
|
-
let e = await
|
|
140
|
+
let e = await o.privacyMask?.getStatus({});
|
|
166
141
|
if (e && e.regions !== null) {
|
|
167
142
|
let t = {
|
|
168
143
|
enabled: e.enabled,
|
|
@@ -176,17 +151,17 @@ function v({ deviceId: e }) {
|
|
|
176
151
|
D(!1);
|
|
177
152
|
}
|
|
178
153
|
}
|
|
179
|
-
}, [
|
|
154
|
+
}, [o, S]), Z = p({
|
|
180
155
|
supportsAudioMute: d === null ? null : d.supportsAudioMute,
|
|
181
156
|
audioEnabled: ge,
|
|
182
157
|
pendingOn: F
|
|
183
|
-
}), xe =
|
|
158
|
+
}), xe = n(async () => {
|
|
184
159
|
let e = m(Z);
|
|
185
|
-
if (!(!
|
|
160
|
+
if (!(!o || e === null)) {
|
|
186
161
|
I(e.enabled), R(null);
|
|
187
162
|
try {
|
|
188
|
-
await
|
|
189
|
-
let t = await
|
|
163
|
+
await o.privacyMask?.setAudioEnabled(e);
|
|
164
|
+
let t = await o.privacyMask?.getStatus({});
|
|
190
165
|
t && P(t.audioEnabled);
|
|
191
166
|
} catch (e) {
|
|
192
167
|
console.error("Privacy microphone write failed — reverting", e), R(e instanceof Error ? e.message : String(e));
|
|
@@ -194,13 +169,13 @@ function v({ deviceId: e }) {
|
|
|
194
169
|
I(null);
|
|
195
170
|
}
|
|
196
171
|
}
|
|
197
|
-
}, [
|
|
172
|
+
}, [o, Z]), Se = n(() => {
|
|
198
173
|
k((e) => (e && (N(null), j(null)), !e));
|
|
199
174
|
}, []), Q = d?.supportedShapes ?? [];
|
|
200
175
|
ie(i(() => O && !v && d && S ? {
|
|
201
176
|
id: pe,
|
|
202
177
|
order: fe,
|
|
203
|
-
node: /* @__PURE__ */ l(
|
|
178
|
+
node: /* @__PURE__ */ l(ue, {
|
|
204
179
|
transparent: !0,
|
|
205
180
|
items: K,
|
|
206
181
|
supportedShapes: Q,
|
|
@@ -225,20 +200,20 @@ function v({ deviceId: e }) {
|
|
|
225
200
|
M
|
|
226
201
|
]));
|
|
227
202
|
let Ce = d?.supportedShapes.includes("rect") ?? !1, we = d?.supportedShapes.includes("polygon") ?? !1, $ = d !== null && (d.maxRegions <= 0 || d.supportedShapes.length === 0);
|
|
228
|
-
return
|
|
203
|
+
return o ? /* @__PURE__ */ l(re, {
|
|
229
204
|
title: "Privacy Mask",
|
|
230
|
-
icon: /* @__PURE__ */ l(
|
|
205
|
+
icon: /* @__PURE__ */ l(ae, { className: "h-3.5 w-3.5 text-foreground-subtle" }),
|
|
231
206
|
children: /* @__PURE__ */ u("div", {
|
|
232
207
|
className: "flex flex-col gap-3",
|
|
233
208
|
children: [v || $ ? /* @__PURE__ */ l("p", {
|
|
234
|
-
className: `${
|
|
209
|
+
className: `${s} leading-relaxed`,
|
|
235
210
|
children: "This camera doesn't support an on-board privacy mask."
|
|
236
211
|
}) : b ? /* @__PURE__ */ l("p", {
|
|
237
|
-
className: `${
|
|
212
|
+
className: `${s} leading-relaxed`,
|
|
238
213
|
children: "This camera hasn't answered, so what it currently masks is unknown — the editor stays closed rather than showing an empty frame you could save over. A battery camera answers once it wakes; otherwise check that it is reachable."
|
|
239
|
-
}) : !v && !$ && !b && d !== null && S !== null ? /* @__PURE__ */ u(
|
|
214
|
+
}) : !v && !$ && !b && d !== null && S !== null ? /* @__PURE__ */ u(le, { children: [
|
|
240
215
|
/* @__PURE__ */ u("p", {
|
|
241
|
-
className: `${
|
|
216
|
+
className: `${s} leading-relaxed`,
|
|
242
217
|
children: [
|
|
243
218
|
"Toggle ",
|
|
244
219
|
/* @__PURE__ */ l("strong", {
|
|
@@ -291,7 +266,7 @@ function v({ deviceId: e }) {
|
|
|
291
266
|
children: "+ Polygon"
|
|
292
267
|
}),
|
|
293
268
|
/* @__PURE__ */ u("span", {
|
|
294
|
-
className: `${
|
|
269
|
+
className: `${s} ml-1 tabular-nums`,
|
|
295
270
|
children: [
|
|
296
271
|
V,
|
|
297
272
|
" / ",
|
|
@@ -319,7 +294,7 @@ function v({ deviceId: e }) {
|
|
|
319
294
|
V > 0 ? /* @__PURE__ */ l("div", {
|
|
320
295
|
className: "flex flex-col gap-1",
|
|
321
296
|
children: S.regions.map((e) => {
|
|
322
|
-
let t = A === e.id, n = e.shape.kind === "polygon" ?
|
|
297
|
+
let t = A === e.id, n = e.shape.kind === "polygon" ? de : c;
|
|
323
298
|
return /* @__PURE__ */ u("div", {
|
|
324
299
|
className: `flex items-center gap-2 rounded-md border px-2 py-1 transition-colors ${t ? "border-primary/50 bg-primary/10" : "border-border bg-surface"}`,
|
|
325
300
|
children: [/* @__PURE__ */ u("button", {
|
|
@@ -342,13 +317,13 @@ function v({ deviceId: e }) {
|
|
|
342
317
|
"aria-label": `Delete zone ${String(e.id)}`,
|
|
343
318
|
title: "Delete zone",
|
|
344
319
|
className: "inline-flex h-6 w-6 items-center justify-center rounded border border-border bg-surface text-foreground-subtle hover:border-red-400/40 hover:bg-red-500/10 hover:text-red-400 disabled:opacity-40 transition-colors",
|
|
345
|
-
children: /* @__PURE__ */ l(
|
|
320
|
+
children: /* @__PURE__ */ l(ce, { className: "h-3.5 w-3.5" })
|
|
346
321
|
})]
|
|
347
322
|
}, e.id);
|
|
348
323
|
})
|
|
349
324
|
}) : null
|
|
350
325
|
] }) : /* @__PURE__ */ l("p", {
|
|
351
|
-
className: `${
|
|
326
|
+
className: `${s} leading-relaxed`,
|
|
352
327
|
children: "Loading the camera's privacy mask…"
|
|
353
328
|
}), Z.supported && /* @__PURE__ */ u("div", {
|
|
354
329
|
className: "flex items-start gap-3 rounded-md border border-border bg-surface px-2 py-2",
|
|
@@ -363,7 +338,7 @@ function v({ deviceId: e }) {
|
|
|
363
338
|
className: Z.on === !1 || Z.on === null ? h : g,
|
|
364
339
|
children: /* @__PURE__ */ u("span", {
|
|
365
340
|
className: "inline-flex items-center gap-1.5",
|
|
366
|
-
children: [Z.on === !1 ? /* @__PURE__ */ l(
|
|
341
|
+
children: [Z.on === !1 ? /* @__PURE__ */ l(se, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ l(oe, { className: "h-3.5 w-3.5" }), Z.on === null ? "Microphone unknown" : Z.on ? "Microphone on" : "Microphone off"]
|
|
367
342
|
})
|
|
368
343
|
}), /* @__PURE__ */ l("p", {
|
|
369
344
|
className: "text-[10px] text-foreground-subtle flex-1 leading-relaxed",
|