@camstack/addon-osd-manager 0.1.9 → 0.1.11
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/MotionZonesSettings-Cq0OFaxs.mjs +310 -0
- package/dist/PrivacyMaskSettings-C0jj3SDp.mjs +370 -0
- package/dist/SceneMonitorEditor-B25bY2v0.mjs +828 -0
- package/dist/_stub.js +12899 -12924
- package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_osd_manager_page-BLRTZ4RM.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_osd_manager_page-U1DYRszQ.mjs} +4 -4
- package/dist/_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-rUObp2Qg.mjs +26 -0
- package/dist/addon-osd-manager.css +1 -1
- package/dist/{hostInit-N1Y97Zzt.mjs → hostInit-UKaIppAV.mjs} +3 -3
- package/dist/index.js +2852 -97
- package/dist/index.mjs +2852 -97
- package/dist/player-overlays-Dfe_rxmA.mjs +44 -0
- package/dist/remoteEntry.js +1 -1
- package/dist/responsive-CWwNAY3j.mjs +122 -0
- package/dist/{trash-2-6DuTY6Z3.mjs → square-ax5XLFv8.mjs} +3 -24
- package/dist/trash-2-CWfC2FLD.mjs +25 -0
- package/dist/use-device-snapshot-Z9dNOZFk.mjs +149 -0
- package/dist/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_osd_manager_page__remoteEntry_js-Bzaw9YeG.mjs → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_osd_manager_page__remoteEntry_js-DEpr9uky.mjs} +1 -1
- package/package.json +1 -1
- package/dist/MotionZonesSettings-CvRjAHsj.mjs +0 -309
- package/dist/PrivacyMaskSettings-LV8_5mQk.mjs +0 -368
- package/dist/_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-BHektQkr.mjs +0 -26
- package/dist/player-overlays-Cb0QIiJ0.mjs +0 -163
|
@@ -1,309 +0,0 @@
|
|
|
1
|
-
import { c as e, h as t, m as n, p as r, u as i, y as a } from "./_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare__react__loadShare__.js-Bs1t18EM.mjs";
|
|
2
|
-
import { n as o, r as s, t as c } from "./_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-DalfdIDw.mjs";
|
|
3
|
-
import { a as l, l as u, n as ee, r as d, s as f, t as p, u as m } from "./player-overlays-Cb0QIiJ0.mjs";
|
|
4
|
-
import { MaskShapeCanvas as h } from "./MaskShapeCanvas-BEVxAjNq.mjs";
|
|
5
|
-
var te = f("grid-2x2", [
|
|
6
|
-
["path", {
|
|
7
|
-
d: "M12 3v18",
|
|
8
|
-
key: "108xh3"
|
|
9
|
-
}],
|
|
10
|
-
["path", {
|
|
11
|
-
d: "M3 12h18",
|
|
12
|
-
key: "1i2n21"
|
|
13
|
-
}],
|
|
14
|
-
["rect", {
|
|
15
|
-
x: "3",
|
|
16
|
-
y: "3",
|
|
17
|
-
width: "18",
|
|
18
|
-
height: "18",
|
|
19
|
-
rx: "2",
|
|
20
|
-
key: "h1oib"
|
|
21
|
-
}]
|
|
22
|
-
]);
|
|
23
|
-
//#endregion
|
|
24
|
-
//#region ../ui-library/src/composites/cap-settings/MotionZonesSettings.tsx
|
|
25
|
-
a();
|
|
26
|
-
var ne = 110, g = "motion-zones", _ = 0, re = [
|
|
27
|
-
1,
|
|
28
|
-
2,
|
|
29
|
-
3
|
|
30
|
-
], 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";
|
|
31
|
-
function x(e, t, n) {
|
|
32
|
-
let r = t * n, i = Array.from({ length: r });
|
|
33
|
-
for (let t = 0; t < r; t += 1) i[t] = e[t] === !0;
|
|
34
|
-
return i;
|
|
35
|
-
}
|
|
36
|
-
function S(e, t) {
|
|
37
|
-
if (e.length !== t.length) return !1;
|
|
38
|
-
for (let n = 0; n < e.length; n += 1) if (e[n] !== t[n]) return !1;
|
|
39
|
-
return !0;
|
|
40
|
-
}
|
|
41
|
-
function C(e, t) {
|
|
42
|
-
return Math.ceil(e / t);
|
|
43
|
-
}
|
|
44
|
-
function w(e, t, n) {
|
|
45
|
-
return Math.min(n - 1, Math.floor((e + .5) / t * n));
|
|
46
|
-
}
|
|
47
|
-
function T(e, t, n, r) {
|
|
48
|
-
let i = C(t, r), a = C(n, r), o = Array.from({ length: i * a }, () => !1);
|
|
49
|
-
for (let r = 0; r < n; r += 1) {
|
|
50
|
-
let s = w(r, n, a);
|
|
51
|
-
for (let n = 0; n < t; n += 1) e[r * t + n] === !0 && (o[s * i + w(n, t, i)] = !0);
|
|
52
|
-
}
|
|
53
|
-
return o;
|
|
54
|
-
}
|
|
55
|
-
function E(e, t, n, r) {
|
|
56
|
-
let i = C(t, r), a = C(n, r), o = Array.from({ length: t * n }, () => !1);
|
|
57
|
-
for (let r = 0; r < n; r += 1) {
|
|
58
|
-
let s = w(r, n, a);
|
|
59
|
-
for (let n = 0; n < t; n += 1) o[r * t + n] = e[s * i + w(n, t, i)] === !0;
|
|
60
|
-
}
|
|
61
|
-
return o;
|
|
62
|
-
}
|
|
63
|
-
function D({ deviceId: a }) {
|
|
64
|
-
let f = d(l().trpcClient, a), [w, D] = t(null), [O, k] = t(!1), [A, j] = t(null), [M, N] = t(null), [P, F] = t(v), [I, L] = t(!1), [R, z] = t(!1), B = n(!1);
|
|
65
|
-
i(() => {
|
|
66
|
-
if (!f) return;
|
|
67
|
-
let e = !1;
|
|
68
|
-
return B.current = !1, D(null), k(!1), j(null), N(null), F(v), z(!1), (async () => {
|
|
69
|
-
try {
|
|
70
|
-
let t = await f.motionZones?.getOptions({});
|
|
71
|
-
if (e) return;
|
|
72
|
-
if (!t) throw Error("device proxy not ready");
|
|
73
|
-
if (D(t), B.current) return;
|
|
74
|
-
let n = await f.motionZones?.getStatus({});
|
|
75
|
-
if (e) return;
|
|
76
|
-
if (!n) throw Error("device proxy not ready");
|
|
77
|
-
B.current = !0;
|
|
78
|
-
let r = n.regions.find((e) => e.shape.kind === "grid"), i = x(r ? r.shape.cells : [], t.grid.width, t.grid.height);
|
|
79
|
-
N(i), j(T(i, t.grid.width, t.grid.height, v));
|
|
80
|
-
} catch (t) {
|
|
81
|
-
if (e) return;
|
|
82
|
-
m(t) ? k(!0) : console.error("Motion Zones load failed", t);
|
|
83
|
-
}
|
|
84
|
-
})(), () => {
|
|
85
|
-
e = !0;
|
|
86
|
-
};
|
|
87
|
-
}, [f]);
|
|
88
|
-
let V = w ? w.grid.width : 0, H = w ? w.grid.height : 0, U = C(V, P), W = C(H, P), G = r(() => A && w ? E(A, V, H, P) : null, [
|
|
89
|
-
A,
|
|
90
|
-
w,
|
|
91
|
-
V,
|
|
92
|
-
H,
|
|
93
|
-
P
|
|
94
|
-
]), K = r(() => G !== null && M !== null && !S(G, M), [G, M]), q = r(() => G ? G.reduce((e, t) => t ? e + 1 : e, 0) : 0, [G]), J = V * H, Y = U * W, X = e((e) => {
|
|
95
|
-
Y > 0 && j(Array.from({ length: Y }, () => e));
|
|
96
|
-
}, [Y]), Z = e(() => {
|
|
97
|
-
j((e) => e && e.map((e) => !e));
|
|
98
|
-
}, []), ie = e(() => {
|
|
99
|
-
M && w && j(T(M, V, H, P));
|
|
100
|
-
}, [
|
|
101
|
-
M,
|
|
102
|
-
w,
|
|
103
|
-
V,
|
|
104
|
-
H,
|
|
105
|
-
P
|
|
106
|
-
]), ae = e((e) => {
|
|
107
|
-
e === P || !w || j((t) => {
|
|
108
|
-
if (!t) return F(e), t;
|
|
109
|
-
let n = T(E(t, V, H, P), V, H, e);
|
|
110
|
-
return F(e), n;
|
|
111
|
-
});
|
|
112
|
-
}, [
|
|
113
|
-
P,
|
|
114
|
-
w,
|
|
115
|
-
V,
|
|
116
|
-
H
|
|
117
|
-
]), Q = r(() => w && A ? [{
|
|
118
|
-
id: _,
|
|
119
|
-
shape: {
|
|
120
|
-
kind: "grid",
|
|
121
|
-
gridWidth: U,
|
|
122
|
-
gridHeight: W,
|
|
123
|
-
cells: [...A]
|
|
124
|
-
}
|
|
125
|
-
}] : [], [
|
|
126
|
-
w,
|
|
127
|
-
A,
|
|
128
|
-
U,
|
|
129
|
-
W
|
|
130
|
-
]), $ = e((e, t) => {
|
|
131
|
-
t.kind === "grid" && j(t.cells);
|
|
132
|
-
}, []), oe = e(async () => {
|
|
133
|
-
if (!(!f || !A || !w)) {
|
|
134
|
-
L(!0);
|
|
135
|
-
try {
|
|
136
|
-
let e = E(A, w.grid.width, w.grid.height, P), t = {
|
|
137
|
-
kind: "grid",
|
|
138
|
-
gridWidth: w.grid.width,
|
|
139
|
-
gridHeight: w.grid.height,
|
|
140
|
-
cells: e
|
|
141
|
-
};
|
|
142
|
-
await f.motionZones?.setZone({ patch: { regions: [{
|
|
143
|
-
id: _,
|
|
144
|
-
enabled: !0,
|
|
145
|
-
shape: t
|
|
146
|
-
}] } });
|
|
147
|
-
let n = await f.motionZones?.getStatus({});
|
|
148
|
-
if (n) {
|
|
149
|
-
let e = n.regions.find((e) => e.shape.kind === "grid"), t = x(e ? e.shape.cells : [], w.grid.width, w.grid.height);
|
|
150
|
-
N(t), j(T(t, w.grid.width, w.grid.height, P));
|
|
151
|
-
}
|
|
152
|
-
} catch (e) {
|
|
153
|
-
console.error("Motion Zones save failed", e);
|
|
154
|
-
} finally {
|
|
155
|
-
L(!1);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}, [
|
|
159
|
-
f,
|
|
160
|
-
A,
|
|
161
|
-
w,
|
|
162
|
-
P
|
|
163
|
-
]);
|
|
164
|
-
return p(r(() => R && !O && w && A ? {
|
|
165
|
-
id: g,
|
|
166
|
-
order: ne,
|
|
167
|
-
node: /* @__PURE__ */ o(h, {
|
|
168
|
-
transparent: !0,
|
|
169
|
-
items: Q,
|
|
170
|
-
supportedShapes: ["grid"],
|
|
171
|
-
grid: {
|
|
172
|
-
width: U,
|
|
173
|
-
height: W
|
|
174
|
-
},
|
|
175
|
-
selectedId: _,
|
|
176
|
-
onSelect: () => {},
|
|
177
|
-
onShapeChange: $,
|
|
178
|
-
onDrawComplete: () => {},
|
|
179
|
-
drawingKind: null
|
|
180
|
-
})
|
|
181
|
-
} : null, [
|
|
182
|
-
R,
|
|
183
|
-
O,
|
|
184
|
-
w,
|
|
185
|
-
A,
|
|
186
|
-
Q,
|
|
187
|
-
$,
|
|
188
|
-
U,
|
|
189
|
-
W
|
|
190
|
-
])), f ? /* @__PURE__ */ o(ee, {
|
|
191
|
-
title: "Motion Zones",
|
|
192
|
-
icon: /* @__PURE__ */ o(te, { className: "h-3.5 w-3.5 text-foreground-subtle" }),
|
|
193
|
-
children: /* @__PURE__ */ o("div", {
|
|
194
|
-
className: "flex flex-col gap-3",
|
|
195
|
-
children: O ? /* @__PURE__ */ o("p", {
|
|
196
|
-
className: `${u} leading-relaxed`,
|
|
197
|
-
children: "This camera doesn't expose an on-board motion zones grid."
|
|
198
|
-
}) : !O && w !== null && A !== null ? /* @__PURE__ */ s(c, { children: [/* @__PURE__ */ s("p", {
|
|
199
|
-
className: `${u} leading-relaxed`,
|
|
200
|
-
children: [
|
|
201
|
-
"Toggle ",
|
|
202
|
-
/* @__PURE__ */ o("strong", {
|
|
203
|
-
className: "text-foreground",
|
|
204
|
-
children: "Edit grid"
|
|
205
|
-
}),
|
|
206
|
-
" to paint the region directly on the live frame, then ",
|
|
207
|
-
/* @__PURE__ */ o("strong", {
|
|
208
|
-
className: "text-foreground",
|
|
209
|
-
children: "Save"
|
|
210
|
-
}),
|
|
211
|
-
" to push the mask to the camera. Pick a bigger",
|
|
212
|
-
" ",
|
|
213
|
-
/* @__PURE__ */ o("strong", {
|
|
214
|
-
className: "text-foreground",
|
|
215
|
-
children: "Cell size"
|
|
216
|
-
}),
|
|
217
|
-
" for quicker, broad-stroke painting — it's resampled to the camera's native ",
|
|
218
|
-
w.grid.width,
|
|
219
|
-
"×",
|
|
220
|
-
w.grid.height,
|
|
221
|
-
" grid on save (×1 is the finest)."
|
|
222
|
-
]
|
|
223
|
-
}), /* @__PURE__ */ s("div", {
|
|
224
|
-
className: "flex items-center gap-2 flex-wrap",
|
|
225
|
-
children: [
|
|
226
|
-
/* @__PURE__ */ o("button", {
|
|
227
|
-
type: "button",
|
|
228
|
-
onClick: () => z((e) => !e),
|
|
229
|
-
disabled: I,
|
|
230
|
-
"aria-pressed": R,
|
|
231
|
-
className: R ? b : y,
|
|
232
|
-
children: R ? "Done editing" : "Edit grid"
|
|
233
|
-
}),
|
|
234
|
-
/* @__PURE__ */ o("button", {
|
|
235
|
-
type: "button",
|
|
236
|
-
onClick: () => X(!0),
|
|
237
|
-
disabled: I,
|
|
238
|
-
className: y,
|
|
239
|
-
children: "All on"
|
|
240
|
-
}),
|
|
241
|
-
/* @__PURE__ */ o("button", {
|
|
242
|
-
type: "button",
|
|
243
|
-
onClick: () => X(!1),
|
|
244
|
-
disabled: I,
|
|
245
|
-
className: y,
|
|
246
|
-
children: "All off"
|
|
247
|
-
}),
|
|
248
|
-
/* @__PURE__ */ o("button", {
|
|
249
|
-
type: "button",
|
|
250
|
-
onClick: Z,
|
|
251
|
-
disabled: I,
|
|
252
|
-
className: y,
|
|
253
|
-
children: "Invert"
|
|
254
|
-
}),
|
|
255
|
-
/* @__PURE__ */ s("div", {
|
|
256
|
-
className: "flex items-center gap-1 ml-1",
|
|
257
|
-
role: "group",
|
|
258
|
-
"aria-label": "Cell size",
|
|
259
|
-
children: [/* @__PURE__ */ o("span", {
|
|
260
|
-
className: `${u} mr-0.5`,
|
|
261
|
-
children: "Cell size"
|
|
262
|
-
}), re.map((e) => /* @__PURE__ */ s("button", {
|
|
263
|
-
type: "button",
|
|
264
|
-
onClick: () => ae(e),
|
|
265
|
-
disabled: I,
|
|
266
|
-
"aria-pressed": P === e,
|
|
267
|
-
title: e === 1 ? `Camera grid ${V}×${H} (finest)` : `${C(V, e)}×${C(H, e)} painting grid · cells ×${e} bigger`,
|
|
268
|
-
className: P === e ? b : y,
|
|
269
|
-
children: ["×", e]
|
|
270
|
-
}, e))]
|
|
271
|
-
}),
|
|
272
|
-
/* @__PURE__ */ s("span", {
|
|
273
|
-
className: `${u} ml-1 tabular-nums`,
|
|
274
|
-
children: [
|
|
275
|
-
q,
|
|
276
|
-
" / ",
|
|
277
|
-
J,
|
|
278
|
-
" cells · ",
|
|
279
|
-
w.grid.width,
|
|
280
|
-
"×",
|
|
281
|
-
w.grid.height,
|
|
282
|
-
P === 1 ? "" : ` · paint ${U}×${W}`
|
|
283
|
-
]
|
|
284
|
-
}),
|
|
285
|
-
/* @__PURE__ */ o("span", { className: "flex-1" }),
|
|
286
|
-
/* @__PURE__ */ o("button", {
|
|
287
|
-
type: "button",
|
|
288
|
-
onClick: ie,
|
|
289
|
-
disabled: I || !K,
|
|
290
|
-
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",
|
|
291
|
-
children: "Revert"
|
|
292
|
-
}),
|
|
293
|
-
/* @__PURE__ */ o("button", {
|
|
294
|
-
type: "button",
|
|
295
|
-
onClick: () => void oe(),
|
|
296
|
-
disabled: I || !K,
|
|
297
|
-
className: b,
|
|
298
|
-
children: I ? "Saving…" : "Save"
|
|
299
|
-
})
|
|
300
|
-
]
|
|
301
|
-
})] }) : /* @__PURE__ */ o("p", {
|
|
302
|
-
className: `${u} leading-relaxed`,
|
|
303
|
-
children: "Loading the camera's grid…"
|
|
304
|
-
})
|
|
305
|
-
})
|
|
306
|
-
}) : null;
|
|
307
|
-
}
|
|
308
|
-
//#endregion
|
|
309
|
-
export { D as MotionZonesSettings };
|
|
@@ -1,368 +0,0 @@
|
|
|
1
|
-
import { c as e, h as t, m as n, p as r, u as i, y as a } from "./_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare__react__loadShare__.js-Bs1t18EM.mjs";
|
|
2
|
-
import { n as o, r as s, t as ee } from "./_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-DalfdIDw.mjs";
|
|
3
|
-
import { a as c, l, n as u, r as te, s as d, t as ne, u as re } from "./player-overlays-Cb0QIiJ0.mjs";
|
|
4
|
-
import { i as ie, n as ae, r as f, t as p } from "./trash-2-6DuTY6Z3.mjs";
|
|
5
|
-
import { MaskShapeCanvas as oe } from "./MaskShapeCanvas-BEVxAjNq.mjs";
|
|
6
|
-
var se = d("hexagon", [["path", {
|
|
7
|
-
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",
|
|
8
|
-
key: "yt0hxn"
|
|
9
|
-
}]]), ce = d("mic-off", [
|
|
10
|
-
["path", {
|
|
11
|
-
d: "M12 19v3",
|
|
12
|
-
key: "npa21l"
|
|
13
|
-
}],
|
|
14
|
-
["path", {
|
|
15
|
-
d: "M15 9.34V5a3 3 0 0 0-5.68-1.33",
|
|
16
|
-
key: "1gzdoj"
|
|
17
|
-
}],
|
|
18
|
-
["path", {
|
|
19
|
-
d: "M16.95 16.95A7 7 0 0 1 5 12v-2",
|
|
20
|
-
key: "cqa7eg"
|
|
21
|
-
}],
|
|
22
|
-
["path", {
|
|
23
|
-
d: "M18.89 13.23A7 7 0 0 0 19 12v-2",
|
|
24
|
-
key: "16hl24"
|
|
25
|
-
}],
|
|
26
|
-
["path", {
|
|
27
|
-
d: "m2 2 20 20",
|
|
28
|
-
key: "1ooewy"
|
|
29
|
-
}],
|
|
30
|
-
["path", {
|
|
31
|
-
d: "M9 9v3a3 3 0 0 0 5.12 2.12",
|
|
32
|
-
key: "r2i35w"
|
|
33
|
-
}]
|
|
34
|
-
]);
|
|
35
|
-
//#endregion
|
|
36
|
-
//#region ../ui-library/src/composites/cap-settings/privacy-mask-audio.ts
|
|
37
|
-
a();
|
|
38
|
-
var m = "Microphone", h = "The camera encodes no audio at all — live view, recordings, exports and the audio analyzer are all silent.";
|
|
39
|
-
function le(e) {
|
|
40
|
-
let t = e.supportsAudioMute === !0, n = t ? e.audioEnabled : null, r = e.pendingOn ?? null;
|
|
41
|
-
return {
|
|
42
|
-
label: m,
|
|
43
|
-
supported: t,
|
|
44
|
-
on: n === null ? null : r ?? n,
|
|
45
|
-
available: t && n !== null,
|
|
46
|
-
costWhenOff: h
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
function ue(e) {
|
|
50
|
-
return !e.available || e.on === null ? null : { enabled: !e.on };
|
|
51
|
-
}
|
|
52
|
-
//#endregion
|
|
53
|
-
//#region ../ui-library/src/composites/cap-settings/PrivacyMaskSettings.tsx
|
|
54
|
-
var de = 120, fe = "privacy-mask", g = "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", _ = "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";
|
|
55
|
-
function v(e) {
|
|
56
|
-
return e.kind === "rect" || e.kind === "polygon" ? e : null;
|
|
57
|
-
}
|
|
58
|
-
function y(e) {
|
|
59
|
-
let t = new Set(e.map((e) => e.id)), n = 0;
|
|
60
|
-
for (; t.has(n);) n += 1;
|
|
61
|
-
return n;
|
|
62
|
-
}
|
|
63
|
-
function b(e, t) {
|
|
64
|
-
if (e.length !== t.length) return !1;
|
|
65
|
-
for (let n = 0; n < e.length; n += 1) if (JSON.stringify(e[n]) !== JSON.stringify(t[n])) return !1;
|
|
66
|
-
return !0;
|
|
67
|
-
}
|
|
68
|
-
function x({ deviceId: a }) {
|
|
69
|
-
let d = te(c().trpcClient, a), [m, h] = t(null), [x, S] = t(!1), [C, w] = t(null), [T, E] = t(null), [D, O] = t(!1), [k, A] = t(!1), [j, M] = t(null), [N, P] = t(null), [pe, F] = t(null), [I, L] = t(null), [R, z] = t(null), B = n(!1);
|
|
70
|
-
i(() => {
|
|
71
|
-
if (!d) return;
|
|
72
|
-
let e = !1;
|
|
73
|
-
return B.current = !1, h(null), S(!1), w(null), E(null), A(!1), M(null), P(null), F(null), L(null), z(null), (async () => {
|
|
74
|
-
try {
|
|
75
|
-
let t = await d.privacyMask?.getOptions({});
|
|
76
|
-
if (e) return;
|
|
77
|
-
if (!t) throw Error("device proxy not ready");
|
|
78
|
-
if (h(t), B.current) return;
|
|
79
|
-
let n = await d.privacyMask?.getStatus({});
|
|
80
|
-
if (e) return;
|
|
81
|
-
if (!n) throw Error("device proxy not ready");
|
|
82
|
-
B.current = !0;
|
|
83
|
-
let r = {
|
|
84
|
-
enabled: n.enabled,
|
|
85
|
-
regions: n.regions
|
|
86
|
-
};
|
|
87
|
-
E(r), w(r), F(n.audioEnabled);
|
|
88
|
-
} catch (t) {
|
|
89
|
-
if (e) return;
|
|
90
|
-
re(t) ? S(!0) : console.error("Privacy Mask load failed", t);
|
|
91
|
-
}
|
|
92
|
-
})(), () => {
|
|
93
|
-
e = !0;
|
|
94
|
-
};
|
|
95
|
-
}, [d]);
|
|
96
|
-
let V = r(() => C !== null && T !== null && (C.enabled !== T.enabled || !b(C.regions, T.regions)), [C, T]), H = C ? C.regions.length : 0, U = m ? m.maxRegions : 0, W = n(0);
|
|
97
|
-
i(() => {
|
|
98
|
-
W.current = U;
|
|
99
|
-
}, [U]);
|
|
100
|
-
let G = U > 0 && H >= U, me = e(() => {
|
|
101
|
-
w((e) => e && {
|
|
102
|
-
...e,
|
|
103
|
-
enabled: !e.enabled
|
|
104
|
-
});
|
|
105
|
-
}, []), K = e((e) => {
|
|
106
|
-
M(typeof e == "number" ? e : null);
|
|
107
|
-
}, []), q = r(() => C ? C.regions.map((e) => ({
|
|
108
|
-
id: e.id,
|
|
109
|
-
shape: e.shape,
|
|
110
|
-
enabled: e.enabled,
|
|
111
|
-
label: `Zone ${String(e.id)}`
|
|
112
|
-
})) : [], [C]), J = e((e, t) => {
|
|
113
|
-
let n = v(t);
|
|
114
|
-
n && w((t) => t && {
|
|
115
|
-
...t,
|
|
116
|
-
regions: t.regions.map((t) => t.id === e ? {
|
|
117
|
-
...t,
|
|
118
|
-
shape: n
|
|
119
|
-
} : t)
|
|
120
|
-
});
|
|
121
|
-
}, []), Y = e((e) => {
|
|
122
|
-
let t = v(e);
|
|
123
|
-
t && (P(null), w((e) => {
|
|
124
|
-
if (!e) return e;
|
|
125
|
-
let n = W.current;
|
|
126
|
-
if (n > 0 && e.regions.length >= n) return e;
|
|
127
|
-
let r = y(e.regions), i = {
|
|
128
|
-
id: r,
|
|
129
|
-
enabled: !0,
|
|
130
|
-
shape: t
|
|
131
|
-
};
|
|
132
|
-
return M(r), {
|
|
133
|
-
...e,
|
|
134
|
-
regions: [...e.regions, i]
|
|
135
|
-
};
|
|
136
|
-
}));
|
|
137
|
-
}, []), X = e((e) => {
|
|
138
|
-
A(!0), M(null), P(e);
|
|
139
|
-
}, []), he = e((e) => {
|
|
140
|
-
A(!0), P(null), M(e);
|
|
141
|
-
}, []), ge = e((e) => {
|
|
142
|
-
M((t) => t === e ? null : t), w((t) => t && {
|
|
143
|
-
...t,
|
|
144
|
-
regions: t.regions.filter((t) => t.id !== e)
|
|
145
|
-
});
|
|
146
|
-
}, []), _e = e(() => {
|
|
147
|
-
P(null), M(null), T && w({
|
|
148
|
-
enabled: T.enabled,
|
|
149
|
-
regions: T.regions
|
|
150
|
-
});
|
|
151
|
-
}, [T]), ve = e(async () => {
|
|
152
|
-
if (!(!d || !C)) {
|
|
153
|
-
O(!0);
|
|
154
|
-
try {
|
|
155
|
-
await d.privacyMask?.setMask({ patch: {
|
|
156
|
-
enabled: C.enabled,
|
|
157
|
-
regions: [...C.regions]
|
|
158
|
-
} });
|
|
159
|
-
let e = await d.privacyMask?.getStatus({});
|
|
160
|
-
if (e) {
|
|
161
|
-
let t = {
|
|
162
|
-
enabled: e.enabled,
|
|
163
|
-
regions: e.regions
|
|
164
|
-
};
|
|
165
|
-
E(t), w(t);
|
|
166
|
-
}
|
|
167
|
-
} catch (e) {
|
|
168
|
-
console.error("Privacy Mask save failed", e);
|
|
169
|
-
} finally {
|
|
170
|
-
O(!1);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}, [d, C]), Z = le({
|
|
174
|
-
supportsAudioMute: m === null ? null : m.supportsAudioMute,
|
|
175
|
-
audioEnabled: pe,
|
|
176
|
-
pendingOn: I
|
|
177
|
-
}), ye = e(async () => {
|
|
178
|
-
let e = ue(Z);
|
|
179
|
-
if (!(!d || e === null)) {
|
|
180
|
-
L(e.enabled), z(null);
|
|
181
|
-
try {
|
|
182
|
-
await d.privacyMask?.setAudioEnabled(e);
|
|
183
|
-
let t = await d.privacyMask?.getStatus({});
|
|
184
|
-
t && F(t.audioEnabled);
|
|
185
|
-
} catch (e) {
|
|
186
|
-
console.error("Privacy microphone write failed — reverting", e), z(e instanceof Error ? e.message : String(e));
|
|
187
|
-
} finally {
|
|
188
|
-
L(null);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}, [d, Z]), be = e(() => {
|
|
192
|
-
A((e) => (e && (P(null), M(null)), !e));
|
|
193
|
-
}, []), Q = m?.supportedShapes ?? [];
|
|
194
|
-
ne(r(() => k && !x && m && C ? {
|
|
195
|
-
id: fe,
|
|
196
|
-
order: de,
|
|
197
|
-
node: /* @__PURE__ */ o(oe, {
|
|
198
|
-
transparent: !0,
|
|
199
|
-
items: q,
|
|
200
|
-
supportedShapes: Q,
|
|
201
|
-
polygonVertices: m.polygonVertices,
|
|
202
|
-
selectedId: j,
|
|
203
|
-
onSelect: K,
|
|
204
|
-
onShapeChange: J,
|
|
205
|
-
onDrawComplete: Y,
|
|
206
|
-
drawingKind: N
|
|
207
|
-
})
|
|
208
|
-
} : null, [
|
|
209
|
-
k,
|
|
210
|
-
x,
|
|
211
|
-
m,
|
|
212
|
-
C,
|
|
213
|
-
q,
|
|
214
|
-
Q,
|
|
215
|
-
j,
|
|
216
|
-
K,
|
|
217
|
-
J,
|
|
218
|
-
Y,
|
|
219
|
-
N
|
|
220
|
-
]));
|
|
221
|
-
let xe = m?.supportedShapes.includes("rect") ?? !1, Se = m?.supportedShapes.includes("polygon") ?? !1, $ = m !== null && (m.maxRegions <= 0 || m.supportedShapes.length === 0);
|
|
222
|
-
return d ? /* @__PURE__ */ o(u, {
|
|
223
|
-
title: "Privacy Mask",
|
|
224
|
-
icon: /* @__PURE__ */ o(ie, { className: "h-3.5 w-3.5 text-foreground-subtle" }),
|
|
225
|
-
children: /* @__PURE__ */ s("div", {
|
|
226
|
-
className: "flex flex-col gap-3",
|
|
227
|
-
children: [x || $ ? /* @__PURE__ */ o("p", {
|
|
228
|
-
className: `${l} leading-relaxed`,
|
|
229
|
-
children: "This camera doesn't support an on-board privacy mask."
|
|
230
|
-
}) : !x && !$ && m !== null && C !== null ? /* @__PURE__ */ s(ee, { children: [
|
|
231
|
-
/* @__PURE__ */ s("p", {
|
|
232
|
-
className: `${l} leading-relaxed`,
|
|
233
|
-
children: [
|
|
234
|
-
"Toggle ",
|
|
235
|
-
/* @__PURE__ */ o("strong", {
|
|
236
|
-
className: "text-foreground",
|
|
237
|
-
children: "Edit mask"
|
|
238
|
-
}),
|
|
239
|
-
" to draw blanked-out zones on the live frame, then ",
|
|
240
|
-
/* @__PURE__ */ o("strong", {
|
|
241
|
-
className: "text-foreground",
|
|
242
|
-
children: "Save"
|
|
243
|
-
}),
|
|
244
|
-
" to push them to the camera. Drag a rectangle to move, its corner to resize; drag polygon vertices, click an edge midpoint to add one, or right-click a vertex to remove it."
|
|
245
|
-
]
|
|
246
|
-
}),
|
|
247
|
-
/* @__PURE__ */ s("div", {
|
|
248
|
-
className: "flex items-center gap-2 flex-wrap",
|
|
249
|
-
children: [
|
|
250
|
-
/* @__PURE__ */ o("button", {
|
|
251
|
-
type: "button",
|
|
252
|
-
onClick: be,
|
|
253
|
-
disabled: D,
|
|
254
|
-
"aria-pressed": k,
|
|
255
|
-
className: k ? _ : g,
|
|
256
|
-
children: k ? "Done editing" : "Edit mask"
|
|
257
|
-
}),
|
|
258
|
-
/* @__PURE__ */ o("button", {
|
|
259
|
-
type: "button",
|
|
260
|
-
onClick: me,
|
|
261
|
-
disabled: D,
|
|
262
|
-
"aria-pressed": C.enabled,
|
|
263
|
-
className: C.enabled ? _ : g,
|
|
264
|
-
children: C.enabled ? "Mask on" : "Mask off"
|
|
265
|
-
}),
|
|
266
|
-
xe && /* @__PURE__ */ o("button", {
|
|
267
|
-
type: "button",
|
|
268
|
-
onClick: () => X("rect"),
|
|
269
|
-
disabled: D || G,
|
|
270
|
-
"aria-pressed": N === "rect",
|
|
271
|
-
className: N === "rect" ? _ : g,
|
|
272
|
-
title: G ? "Maximum zones reached" : "Add a rectangle zone",
|
|
273
|
-
children: "+ Rect"
|
|
274
|
-
}),
|
|
275
|
-
Se && /* @__PURE__ */ o("button", {
|
|
276
|
-
type: "button",
|
|
277
|
-
onClick: () => X("polygon"),
|
|
278
|
-
disabled: D || G,
|
|
279
|
-
"aria-pressed": N === "polygon",
|
|
280
|
-
className: N === "polygon" ? _ : g,
|
|
281
|
-
title: G ? "Maximum zones reached" : "Add a polygon zone",
|
|
282
|
-
children: "+ Polygon"
|
|
283
|
-
}),
|
|
284
|
-
/* @__PURE__ */ s("span", {
|
|
285
|
-
className: `${l} ml-1 tabular-nums`,
|
|
286
|
-
children: [
|
|
287
|
-
H,
|
|
288
|
-
" / ",
|
|
289
|
-
U,
|
|
290
|
-
" zones"
|
|
291
|
-
]
|
|
292
|
-
}),
|
|
293
|
-
/* @__PURE__ */ o("span", { className: "flex-1" }),
|
|
294
|
-
/* @__PURE__ */ o("button", {
|
|
295
|
-
type: "button",
|
|
296
|
-
onClick: _e,
|
|
297
|
-
disabled: D || !V,
|
|
298
|
-
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",
|
|
299
|
-
children: "Revert"
|
|
300
|
-
}),
|
|
301
|
-
/* @__PURE__ */ o("button", {
|
|
302
|
-
type: "button",
|
|
303
|
-
onClick: () => void ve(),
|
|
304
|
-
disabled: D || !V,
|
|
305
|
-
className: _,
|
|
306
|
-
children: D ? "Saving…" : "Save"
|
|
307
|
-
})
|
|
308
|
-
]
|
|
309
|
-
}),
|
|
310
|
-
H > 0 ? /* @__PURE__ */ o("div", {
|
|
311
|
-
className: "flex flex-col gap-1",
|
|
312
|
-
children: C.regions.map((e) => {
|
|
313
|
-
let t = j === e.id, n = e.shape.kind === "polygon" ? se : ae;
|
|
314
|
-
return /* @__PURE__ */ s("div", {
|
|
315
|
-
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"}`,
|
|
316
|
-
children: [/* @__PURE__ */ s("button", {
|
|
317
|
-
type: "button",
|
|
318
|
-
onClick: () => he(e.id),
|
|
319
|
-
disabled: D,
|
|
320
|
-
className: "flex flex-1 items-center gap-2 text-left text-[11px] font-medium text-foreground-subtle hover:text-foreground disabled:opacity-40 transition-colors",
|
|
321
|
-
children: [
|
|
322
|
-
/* @__PURE__ */ o(n, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
323
|
-
/* @__PURE__ */ s("span", { children: ["Zone ", e.id] }),
|
|
324
|
-
/* @__PURE__ */ o("span", {
|
|
325
|
-
className: "text-foreground-faint capitalize",
|
|
326
|
-
children: e.shape.kind
|
|
327
|
-
})
|
|
328
|
-
]
|
|
329
|
-
}), /* @__PURE__ */ o("button", {
|
|
330
|
-
type: "button",
|
|
331
|
-
onClick: () => ge(e.id),
|
|
332
|
-
disabled: D,
|
|
333
|
-
"aria-label": `Delete zone ${String(e.id)}`,
|
|
334
|
-
title: "Delete zone",
|
|
335
|
-
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",
|
|
336
|
-
children: /* @__PURE__ */ o(p, { className: "h-3.5 w-3.5" })
|
|
337
|
-
})]
|
|
338
|
-
}, e.id);
|
|
339
|
-
})
|
|
340
|
-
}) : null
|
|
341
|
-
] }) : /* @__PURE__ */ o("p", {
|
|
342
|
-
className: `${l} leading-relaxed`,
|
|
343
|
-
children: "Loading the camera's privacy mask…"
|
|
344
|
-
}), Z.supported && /* @__PURE__ */ s("div", {
|
|
345
|
-
className: "flex items-start gap-3 rounded-md border border-border bg-surface px-2 py-2",
|
|
346
|
-
children: [/* @__PURE__ */ o("button", {
|
|
347
|
-
type: "button",
|
|
348
|
-
role: "switch",
|
|
349
|
-
"aria-label": Z.label,
|
|
350
|
-
"aria-checked": Z.on === !0,
|
|
351
|
-
disabled: !Z.available || I !== null,
|
|
352
|
-
onClick: () => void ye(),
|
|
353
|
-
title: Z.on === null ? "Microphone — state unknown; the camera did not answer." : Z.on ? `The camera is capturing sound. Turning it off: ${Z.costWhenOff}` : `The camera is silent. ${Z.costWhenOff}`,
|
|
354
|
-
className: Z.on === !1 || Z.on === null ? g : _,
|
|
355
|
-
children: /* @__PURE__ */ s("span", {
|
|
356
|
-
className: "inline-flex items-center gap-1.5",
|
|
357
|
-
children: [Z.on === !1 ? /* @__PURE__ */ o(ce, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ o(f, { className: "h-3.5 w-3.5" }), Z.on === null ? "Microphone unknown" : Z.on ? "Microphone on" : "Microphone off"]
|
|
358
|
-
})
|
|
359
|
-
}), /* @__PURE__ */ o("p", {
|
|
360
|
-
className: "text-[10px] text-foreground-subtle flex-1 leading-relaxed",
|
|
361
|
-
children: R === null ? Z.on === null ? "The camera did not report its microphone, so this state is unknown." : Z.costWhenOff : `Write failed: ${R}`
|
|
362
|
-
})]
|
|
363
|
-
})]
|
|
364
|
-
})
|
|
365
|
-
}) : null;
|
|
366
|
-
}
|
|
367
|
-
//#endregion
|
|
368
|
-
export { x as PrivacyMaskSettings };
|