@camstack/addon-osd-manager 0.1.236 → 0.1.238
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-CU-mFCnh.mjs → MaskShapeCanvas-BFhkWNJD.mjs} +2330 -2329
- package/dist/MotionZonesSettings-BU-acK9Z.mjs +309 -0
- package/dist/PrivacyMaskSettings-DMXiC1dM.mjs +368 -0
- package/dist/SceneMonitorEditor-ePI2t_wT.mjs +846 -0
- package/dist/_stub.js +6978 -6349
- package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_osd_manager_page-BPgZSZ-3.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_osd_manager_page-0ArFGpGl.mjs} +4 -4
- package/dist/_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DkfPNoLU.mjs +26 -0
- package/dist/{_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare__react__loadShare__.js-BbmIfQSr.mjs → _virtual_mf___mfe_internal__addon_osd_manager_page__loadShare__react__loadShare__.js-C-pbjC7c.mjs} +1 -1
- package/dist/addon-osd-manager.css +1 -1
- package/dist/{hostInit-iQV7js-A.mjs → hostInit-BdkaT5Cp.mjs} +3 -3
- package/dist/index.js +199 -5
- package/dist/index.mjs +199 -5
- package/dist/player-overlays-B4efNR1A.mjs +44 -0
- package/dist/remoteEntry.js +1 -1
- package/dist/{responsive-BP2NYfOi.mjs → responsive-CvSyX7h3.mjs} +35 -35
- package/dist/scene-monitor-copy-QAemI7ef.mjs +227 -0
- package/dist/{square-BHCEqr7g.mjs → square-BG-oZkZc.mjs} +1 -1
- package/dist/{trash-2-BGZFyowm.mjs → trash-2-DvemWMy7.mjs} +1 -1
- package/dist/ui-text-BitwQ50T.mjs +34 -0
- package/dist/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_osd_manager_page__remoteEntry_js-Ch_9U0JF.mjs → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_osd_manager_page__remoteEntry_js-CnEfWp78.mjs} +1 -1
- package/package.json +1 -1
- package/dist/MotionZonesSettings--WB2aUGD.mjs +0 -310
- package/dist/PrivacyMaskSettings-TGecGZ1J.mjs +0 -377
- package/dist/SceneMonitorEditor-Cq3bsqmJ.mjs +0 -831
- package/dist/_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DVHQfCvU.mjs +0 -26
- package/dist/player-overlays-D0twFHMl.mjs +0 -44
- package/dist/scene-monitor-copy-DYchveQT.mjs +0 -187
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { S as e, g as t, l as n, v as r } from "./_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare__react__loadShare__.js-C-pbjC7c.mjs";
|
|
2
|
+
import { n as i } from "./ui-text-BitwQ50T.mjs";
|
|
3
|
+
import { l as a } from "./responsive-CvSyX7h3.mjs";
|
|
4
|
+
var o = a("camera", [["path", {
|
|
5
|
+
d: "M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",
|
|
6
|
+
key: "18u6gg"
|
|
7
|
+
}], ["circle", {
|
|
8
|
+
cx: "12",
|
|
9
|
+
cy: "13",
|
|
10
|
+
r: "3",
|
|
11
|
+
key: "1vg3eu"
|
|
12
|
+
}]]), s = a("image-off", [
|
|
13
|
+
["line", {
|
|
14
|
+
x1: "2",
|
|
15
|
+
x2: "22",
|
|
16
|
+
y1: "2",
|
|
17
|
+
y2: "22",
|
|
18
|
+
key: "a6p6uj"
|
|
19
|
+
}],
|
|
20
|
+
["path", {
|
|
21
|
+
d: "M10.41 10.41a2 2 0 1 1-2.83-2.83",
|
|
22
|
+
key: "1bzlo9"
|
|
23
|
+
}],
|
|
24
|
+
["line", {
|
|
25
|
+
x1: "13.5",
|
|
26
|
+
x2: "6",
|
|
27
|
+
y1: "13.5",
|
|
28
|
+
y2: "21",
|
|
29
|
+
key: "1q0aeu"
|
|
30
|
+
}],
|
|
31
|
+
["line", {
|
|
32
|
+
x1: "18",
|
|
33
|
+
x2: "21",
|
|
34
|
+
y1: "12",
|
|
35
|
+
y2: "15",
|
|
36
|
+
key: "5mozeu"
|
|
37
|
+
}],
|
|
38
|
+
["path", {
|
|
39
|
+
d: "M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59",
|
|
40
|
+
key: "mmje98"
|
|
41
|
+
}],
|
|
42
|
+
["path", {
|
|
43
|
+
d: "M21 15V5a2 2 0 0 0-2-2H9",
|
|
44
|
+
key: "43el77"
|
|
45
|
+
}]
|
|
46
|
+
]), c = a("rotate-ccw", [["path", {
|
|
47
|
+
d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",
|
|
48
|
+
key: "1357e3"
|
|
49
|
+
}], ["path", {
|
|
50
|
+
d: "M3 3v5h5",
|
|
51
|
+
key: "1xhq8a"
|
|
52
|
+
}]]);
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region ../ui-library/src/lib/hub-mount.ts
|
|
55
|
+
e();
|
|
56
|
+
var l = "camstack-mount", u = /^\/(?:[A-Za-z0-9_\-.]+\/)*$/, d = null;
|
|
57
|
+
function f(e) {
|
|
58
|
+
if (e == null || e === "") return null;
|
|
59
|
+
let t = e.endsWith("/") ? e : `${e}/`;
|
|
60
|
+
return !u.test(t) || t.includes("/../") || t.includes("/./") ? null : t;
|
|
61
|
+
}
|
|
62
|
+
function p() {
|
|
63
|
+
if (typeof document > "u") return "/";
|
|
64
|
+
let e = f(document.querySelector(`meta[name="${l}"]`)?.getAttribute("content"));
|
|
65
|
+
if (e !== null) return e;
|
|
66
|
+
if (document.querySelector("base[href]") !== null) try {
|
|
67
|
+
let e = new URL(document.baseURI);
|
|
68
|
+
if (e.origin === window.location.origin) {
|
|
69
|
+
let t = f(e.pathname);
|
|
70
|
+
if (t !== null) return t;
|
|
71
|
+
}
|
|
72
|
+
} catch {}
|
|
73
|
+
return "/";
|
|
74
|
+
}
|
|
75
|
+
function m() {
|
|
76
|
+
return d === null && (d = p()), d;
|
|
77
|
+
}
|
|
78
|
+
function h() {
|
|
79
|
+
return m().replace(/\/$/, "");
|
|
80
|
+
}
|
|
81
|
+
function g(e) {
|
|
82
|
+
return /^[a-z][a-z0-9+.-]*:/i.test(e) || e.startsWith("//");
|
|
83
|
+
}
|
|
84
|
+
function _(e) {
|
|
85
|
+
if (g(e)) return e;
|
|
86
|
+
let t = m(), n = e.replace(/^\/+/, "");
|
|
87
|
+
return t !== "/" && (e === h() || e.startsWith(t)) ? e : `${t}${n}`;
|
|
88
|
+
}
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region ../ui-library/src/hooks/use-device-snapshot.ts
|
|
91
|
+
var v = "/addon/snapshot/media";
|
|
92
|
+
function y(e, i = {}) {
|
|
93
|
+
let { width: a, baseUrl: o } = i, [s, c] = r(0);
|
|
94
|
+
return {
|
|
95
|
+
src: t(() => {
|
|
96
|
+
if (e === null || e <= 0) return null;
|
|
97
|
+
let t = o === void 0 ? h() : o.replace(/\/+$/, ""), n = new URLSearchParams();
|
|
98
|
+
a !== void 0 && Number.isInteger(a) && a > 0 && n.set("w", String(a)), s > 0 && (n.set("force", "1"), n.set("r", String(s)));
|
|
99
|
+
let r = n.toString();
|
|
100
|
+
return `${t}${v}/${String(e)}.jpg${r.length > 0 ? `?${r}` : ""}`;
|
|
101
|
+
}, [
|
|
102
|
+
e,
|
|
103
|
+
a,
|
|
104
|
+
o,
|
|
105
|
+
s
|
|
106
|
+
]),
|
|
107
|
+
loading: !1,
|
|
108
|
+
refresh: n(() => {
|
|
109
|
+
c((e) => e + 1);
|
|
110
|
+
}, [])
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region ../ui-library/src/composites/cap-settings/scene-monitor-copy.ts
|
|
115
|
+
var b = ["day", "ir"], x = {
|
|
116
|
+
day: {
|
|
117
|
+
labelKey: "uiLibrary.sceneMonitor.variant.day",
|
|
118
|
+
labelFallback: "Daylight"
|
|
119
|
+
},
|
|
120
|
+
ir: {
|
|
121
|
+
labelKey: "uiLibrary.sceneMonitor.variant.ir",
|
|
122
|
+
labelFallback: "Night (IR)"
|
|
123
|
+
},
|
|
124
|
+
night: {
|
|
125
|
+
labelKey: "uiLibrary.sceneMonitor.variant.night",
|
|
126
|
+
labelFallback: "Night"
|
|
127
|
+
},
|
|
128
|
+
dawn: {
|
|
129
|
+
labelKey: "uiLibrary.sceneMonitor.variant.dawn",
|
|
130
|
+
labelFallback: "Dawn"
|
|
131
|
+
},
|
|
132
|
+
dusk: {
|
|
133
|
+
labelKey: "uiLibrary.sceneMonitor.variant.dusk",
|
|
134
|
+
labelFallback: "Dusk"
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
function S(e, t = i) {
|
|
138
|
+
let n = x[e];
|
|
139
|
+
return n === void 0 ? e : t(n.labelKey, n.labelFallback);
|
|
140
|
+
}
|
|
141
|
+
function C(e, t = i) {
|
|
142
|
+
let n = new Set(e.coveredConditions), r = b.map((e) => `${S(e, t)} ${n.has(e) ? "✓" : "✗"}`), a = [...n].filter((e) => !b.some((t) => t === e));
|
|
143
|
+
for (let e of a) r.push(`${S(e, t)} ✓`);
|
|
144
|
+
let o = b.filter((e) => !n.has(e));
|
|
145
|
+
if (o.length === 0) return r.join(" · ");
|
|
146
|
+
if (n.size === 0) return t("uiLibrary.sceneMonitor.coverage.empty", "{{parts}} — nothing captured yet, so this scene is not watching.", { parts: r.join(" · ") });
|
|
147
|
+
let [s = "", c] = o.map((e) => S(e, t).toLowerCase()), l = c === void 0 ? s : t("uiLibrary.sceneMonitor.coverage.namesJoin", "{{first}} and {{second}}", {
|
|
148
|
+
first: s,
|
|
149
|
+
second: c
|
|
150
|
+
}), u = {
|
|
151
|
+
parts: r.join(" · "),
|
|
152
|
+
names: l
|
|
153
|
+
};
|
|
154
|
+
return e.onUncoveredCondition === "judge-anyway" ? t("uiLibrary.sceneMonitor.coverage.judgeAnyway", "{{parts}} — {{names}} judged against the references you do have.", u) : t("uiLibrary.sceneMonitor.coverage.skip", "{{parts}} — optional; checks in {{names}} are skipped.", u);
|
|
155
|
+
}
|
|
156
|
+
function w(e, t = i) {
|
|
157
|
+
return e.suspendedCondition === null ? null : t("uiLibrary.sceneMonitor.suspension", "Paused — nothing was captured in {{light}}, so checks are on hold until the light changes back. Capture {{light}} if you want it watched around the clock.", { light: S(e.suspendedCondition, t).toLowerCase() });
|
|
158
|
+
}
|
|
159
|
+
var T = {
|
|
160
|
+
"no-reference-for-condition": {
|
|
161
|
+
key: "uiLibrary.sceneMonitor.unavailable.no_reference_for_condition",
|
|
162
|
+
fallback: "can’t tell — nothing has been captured for this scene yet. Press “Capture daylight” to photograph what normal looks like."
|
|
163
|
+
},
|
|
164
|
+
"view-shifted": {
|
|
165
|
+
key: "uiLibrary.sceneMonitor.unavailable.view_shifted",
|
|
166
|
+
fallback: "can’t tell — the camera view has moved since the reference was captured. Re-capture it."
|
|
167
|
+
},
|
|
168
|
+
"no-vision-profile": {
|
|
169
|
+
key: "uiLibrary.sceneMonitor.unavailable.no_vision_profile",
|
|
170
|
+
fallback: "can’t tell — the vision model is unreachable, so the change is on hold."
|
|
171
|
+
},
|
|
172
|
+
"encoder-model-changed": {
|
|
173
|
+
key: "uiLibrary.sceneMonitor.unavailable.encoder_model_changed",
|
|
174
|
+
fallback: "can’t tell — the embedding model changed, so the stored references are unreadable. Re-capture them."
|
|
175
|
+
},
|
|
176
|
+
"no-snapshot": {
|
|
177
|
+
key: "uiLibrary.sceneMonitor.unavailable.no_snapshot",
|
|
178
|
+
fallback: "can’t tell — this camera did not return a frame."
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
function E(e, t, n = i) {
|
|
182
|
+
if (e.states.length === 0) return n("uiLibrary.sceneMonitor.status.notArmed", "Not armed yet — capture the initial state to start watching.");
|
|
183
|
+
if (e.verdict === "unknown") {
|
|
184
|
+
if (e.unavailable === null) return n("uiLibrary.sceneMonitor.status.cantTellNow", "can’t tell right now.");
|
|
185
|
+
let t = T[e.unavailable];
|
|
186
|
+
return n(t.key, t.fallback);
|
|
187
|
+
}
|
|
188
|
+
let r = e.verdict === "diverged" ? e.divergedAt : e.armedAt, a = r === null ? "" : ` ${n("uiLibrary.sceneMonitor.status.heldFor", "for {{duration}}", { duration: A(Math.max(0, t - r)) })}`;
|
|
189
|
+
if (e.latched) return e.verdict === "diverged" ? n("uiLibrary.sceneMonitor.status.changedLatched", "CHANGED{{held}} — press Reset when you have dealt with it.", { held: a }) : n("uiLibrary.sceneMonitor.status.backToNormal", "Back to normal, but still flagged as changed{{held}}. Press Reset to clear it.", { held: a });
|
|
190
|
+
let o = w(e, n);
|
|
191
|
+
return o === null ? e.verdict === "diverged" ? n("uiLibrary.sceneMonitor.status.changed", "CHANGED{{held}}", { held: a }) : n("uiLibrary.sceneMonitor.status.normal", "Normal{{held}}", { held: a }) : o;
|
|
192
|
+
}
|
|
193
|
+
function D(e, t = i) {
|
|
194
|
+
return e.states.length === 0 ? {
|
|
195
|
+
text: t("uiLibrary.sceneMonitor.badge.notArmed", "Not armed"),
|
|
196
|
+
tone: "unknown"
|
|
197
|
+
} : e.latched ? {
|
|
198
|
+
text: t("uiLibrary.sceneMonitor.badge.changed", "Changed"),
|
|
199
|
+
tone: "alarm"
|
|
200
|
+
} : e.suspendedCondition === null ? e.verdict === "unknown" ? {
|
|
201
|
+
text: t("uiLibrary.sceneMonitor.badge.cantTell", "Can’t tell"),
|
|
202
|
+
tone: "unknown"
|
|
203
|
+
} : e.verdict === "diverged" ? {
|
|
204
|
+
text: t("uiLibrary.sceneMonitor.badge.changed", "Changed"),
|
|
205
|
+
tone: "alarm"
|
|
206
|
+
} : {
|
|
207
|
+
text: t("uiLibrary.sceneMonitor.badge.normal", "Normal"),
|
|
208
|
+
tone: "ok"
|
|
209
|
+
} : {
|
|
210
|
+
text: t("uiLibrary.sceneMonitor.badge.paused", "Paused"),
|
|
211
|
+
tone: "unknown"
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
var O = .4;
|
|
215
|
+
function k(e) {
|
|
216
|
+
return e.width * e.height > O;
|
|
217
|
+
}
|
|
218
|
+
function A(e) {
|
|
219
|
+
let t = Math.floor(e / 1e3);
|
|
220
|
+
if (t < 60) return `${t}s`;
|
|
221
|
+
let n = Math.floor(t / 60);
|
|
222
|
+
if (n < 60) return `${n}m`;
|
|
223
|
+
let r = Math.floor(n / 60);
|
|
224
|
+
return r < 48 ? `${r}h` : `${Math.floor(r / 24)}d`;
|
|
225
|
+
}
|
|
226
|
+
//#endregion
|
|
227
|
+
export { E as a, _ as c, o as d, k as i, c as l, D as n, S as o, C as r, y as s, b as t, s as u };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { S as e, f as t, n, t as r, u as i } from "./_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare__react__loadShare__.js-C-pbjC7c.mjs";
|
|
2
|
+
import { n as a, t as o } from "./_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-DalfdIDw.mjs";
|
|
3
|
+
//#region ../ui-library/src/contexts/ui-text.tsx
|
|
4
|
+
e();
|
|
5
|
+
var s = /\{\{\s*(\w+)\s*\}\}/g;
|
|
6
|
+
function c(e, t) {
|
|
7
|
+
return typeof e == "string" ? e : t === 1 ? e.one : e.other;
|
|
8
|
+
}
|
|
9
|
+
var l = (e, t, n) => {
|
|
10
|
+
let r = c(t, n?.count);
|
|
11
|
+
return n ? r.replace(s, (e, t) => {
|
|
12
|
+
let r = n[t];
|
|
13
|
+
return r == null ? e : String(r);
|
|
14
|
+
}) : r;
|
|
15
|
+
}, u = n(l);
|
|
16
|
+
function d() {
|
|
17
|
+
return i(u);
|
|
18
|
+
}
|
|
19
|
+
var f = /<(\d+)>([\s\S]*?)<\/\1>/g;
|
|
20
|
+
function p(e, t) {
|
|
21
|
+
let n = [], i = 0;
|
|
22
|
+
for (let a of e.matchAll(f)) {
|
|
23
|
+
let o = a.index ?? 0;
|
|
24
|
+
o > i && n.push(e.slice(i, o));
|
|
25
|
+
let s = t[Number(a[1])];
|
|
26
|
+
n.push(s ? r(s, void 0, a[2] ?? "") : a[2] ?? ""), i = o + a[0].length;
|
|
27
|
+
}
|
|
28
|
+
return i < e.length && n.push(e.slice(i)), n;
|
|
29
|
+
}
|
|
30
|
+
function m({ uiKey: e, fallback: n, components: r = [], values: i }) {
|
|
31
|
+
return /* @__PURE__ */ a(o, { children: p(d()(e, n, i), r).map((e, n) => /* @__PURE__ */ a(t, { children: e }, n)) });
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { l as n, d as r, m as t };
|
|
@@ -2753,7 +2753,7 @@ async function rr(e) {
|
|
|
2753
2753
|
}
|
|
2754
2754
|
}
|
|
2755
2755
|
async function ir() {
|
|
2756
|
-
return tr ||= rr(() => import("./_virtual_mf-localSharedImportMap___mfe_internal__addon_osd_manager_page-
|
|
2756
|
+
return tr ||= rr(() => import("./_virtual_mf-localSharedImportMap___mfe_internal__addon_osd_manager_page-0ArFGpGl.mjs")).catch((e) => {
|
|
2757
2757
|
throw tr = void 0, e;
|
|
2758
2758
|
}), tr;
|
|
2759
2759
|
}
|
package/package.json
CHANGED
|
@@ -1,310 +0,0 @@
|
|
|
1
|
-
import { b as e, c as t, g as n, h as r, m as i, u as a } from "./_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare__react__loadShare__.js-BbmIfQSr.mjs";
|
|
2
|
-
import { c as o, d as s, l as c, p as l, s as u } from "./responsive-BP2NYfOi.mjs";
|
|
3
|
-
import { n as d, t as f } from "./player-overlays-D0twFHMl.mjs";
|
|
4
|
-
import { n as p, r as m, t as ee } from "./_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-DalfdIDw.mjs";
|
|
5
|
-
import { MaskShapeCanvas as h } from "./MaskShapeCanvas-CU-mFCnh.mjs";
|
|
6
|
-
var g = l("grid-2x2", [
|
|
7
|
-
["path", {
|
|
8
|
-
d: "M12 3v18",
|
|
9
|
-
key: "108xh3"
|
|
10
|
-
}],
|
|
11
|
-
["path", {
|
|
12
|
-
d: "M3 12h18",
|
|
13
|
-
key: "1i2n21"
|
|
14
|
-
}],
|
|
15
|
-
["rect", {
|
|
16
|
-
x: "3",
|
|
17
|
-
y: "3",
|
|
18
|
-
width: "18",
|
|
19
|
-
height: "18",
|
|
20
|
-
rx: "2",
|
|
21
|
-
key: "h1oib"
|
|
22
|
-
}]
|
|
23
|
-
]);
|
|
24
|
-
//#endregion
|
|
25
|
-
//#region ../ui-library/src/composites/cap-settings/MotionZonesSettings.tsx
|
|
26
|
-
e();
|
|
27
|
-
var te = 110, _ = "motion-zones", v = 0, ne = [
|
|
28
|
-
1,
|
|
29
|
-
2,
|
|
30
|
-
3
|
|
31
|
-
], y = 1, b = "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", x = "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";
|
|
32
|
-
function S(e, t, n) {
|
|
33
|
-
let r = t * n, i = Array.from({ length: r });
|
|
34
|
-
for (let t = 0; t < r; t += 1) i[t] = e[t] === !0;
|
|
35
|
-
return i;
|
|
36
|
-
}
|
|
37
|
-
function re(e, t) {
|
|
38
|
-
if (e.length !== t.length) return !1;
|
|
39
|
-
for (let n = 0; n < e.length; n += 1) if (e[n] !== t[n]) return !1;
|
|
40
|
-
return !0;
|
|
41
|
-
}
|
|
42
|
-
function C(e, t) {
|
|
43
|
-
return Math.ceil(e / t);
|
|
44
|
-
}
|
|
45
|
-
function w(e, t, n) {
|
|
46
|
-
return Math.min(n - 1, Math.floor((e + .5) / t * n));
|
|
47
|
-
}
|
|
48
|
-
function T(e, t, n, r) {
|
|
49
|
-
let i = C(t, r), a = C(n, r), o = Array.from({ length: i * a }, () => !1);
|
|
50
|
-
for (let r = 0; r < n; r += 1) {
|
|
51
|
-
let s = w(r, n, a);
|
|
52
|
-
for (let n = 0; n < t; n += 1) e[r * t + n] === !0 && (o[s * i + w(n, t, i)] = !0);
|
|
53
|
-
}
|
|
54
|
-
return o;
|
|
55
|
-
}
|
|
56
|
-
function E(e, t, n, r) {
|
|
57
|
-
let i = C(t, r), a = C(n, r), o = Array.from({ length: t * n }, () => !1);
|
|
58
|
-
for (let r = 0; r < n; r += 1) {
|
|
59
|
-
let s = w(r, n, a);
|
|
60
|
-
for (let n = 0; n < t; n += 1) o[r * t + n] = e[s * i + w(n, t, i)] === !0;
|
|
61
|
-
}
|
|
62
|
-
return o;
|
|
63
|
-
}
|
|
64
|
-
function D({ deviceId: e }) {
|
|
65
|
-
let l = c(s().trpcClient, e), [w, D] = n(null), [O, k] = n(!1), [A, j] = n(null), [M, N] = n(null), [P, F] = n(y), [I, L] = n(!1), [R, z] = n(!1), B = r(!1);
|
|
66
|
-
a(() => {
|
|
67
|
-
if (!l) return;
|
|
68
|
-
let e = !1;
|
|
69
|
-
return B.current = !1, D(null), k(!1), j(null), N(null), F(y), z(!1), (async () => {
|
|
70
|
-
try {
|
|
71
|
-
let t = await l.motionZones?.getOptions({});
|
|
72
|
-
if (e) return;
|
|
73
|
-
if (!t) throw Error("device proxy not ready");
|
|
74
|
-
if (D(t), B.current) return;
|
|
75
|
-
let n = await l.motionZones?.getStatus({});
|
|
76
|
-
if (e) return;
|
|
77
|
-
if (!n) throw Error("device proxy not ready");
|
|
78
|
-
B.current = !0;
|
|
79
|
-
let r = n.regions.find((e) => e.shape.kind === "grid"), i = S(r ? r.shape.cells : [], t.grid.width, t.grid.height);
|
|
80
|
-
N(i), j(T(i, t.grid.width, t.grid.height, y));
|
|
81
|
-
} catch (t) {
|
|
82
|
-
if (e) return;
|
|
83
|
-
o(t) ? k(!0) : console.error("Motion Zones load failed", t);
|
|
84
|
-
}
|
|
85
|
-
})(), () => {
|
|
86
|
-
e = !0;
|
|
87
|
-
};
|
|
88
|
-
}, [l]);
|
|
89
|
-
let V = w ? w.grid.width : 0, H = w ? w.grid.height : 0, U = C(V, P), W = C(H, P), G = i(() => A && w ? E(A, V, H, P) : null, [
|
|
90
|
-
A,
|
|
91
|
-
w,
|
|
92
|
-
V,
|
|
93
|
-
H,
|
|
94
|
-
P
|
|
95
|
-
]), K = i(() => G !== null && M !== null && !re(G, M), [G, M]), q = i(() => G ? G.reduce((e, t) => t ? e + 1 : e, 0) : 0, [G]), J = V * H, Y = U * W, X = t((e) => {
|
|
96
|
-
Y > 0 && j(Array.from({ length: Y }, () => e));
|
|
97
|
-
}, [Y]), ie = t(() => {
|
|
98
|
-
j((e) => e && e.map((e) => !e));
|
|
99
|
-
}, []), Z = t(() => {
|
|
100
|
-
M && w && j(T(M, V, H, P));
|
|
101
|
-
}, [
|
|
102
|
-
M,
|
|
103
|
-
w,
|
|
104
|
-
V,
|
|
105
|
-
H,
|
|
106
|
-
P
|
|
107
|
-
]), ae = t((e) => {
|
|
108
|
-
e === P || !w || j((t) => {
|
|
109
|
-
if (!t) return F(e), t;
|
|
110
|
-
let n = T(E(t, V, H, P), V, H, e);
|
|
111
|
-
return F(e), n;
|
|
112
|
-
});
|
|
113
|
-
}, [
|
|
114
|
-
P,
|
|
115
|
-
w,
|
|
116
|
-
V,
|
|
117
|
-
H
|
|
118
|
-
]), Q = i(() => w && A ? [{
|
|
119
|
-
id: v,
|
|
120
|
-
shape: {
|
|
121
|
-
kind: "grid",
|
|
122
|
-
gridWidth: U,
|
|
123
|
-
gridHeight: W,
|
|
124
|
-
cells: [...A]
|
|
125
|
-
}
|
|
126
|
-
}] : [], [
|
|
127
|
-
w,
|
|
128
|
-
A,
|
|
129
|
-
U,
|
|
130
|
-
W
|
|
131
|
-
]), $ = t((e, t) => {
|
|
132
|
-
t.kind === "grid" && j(t.cells);
|
|
133
|
-
}, []), oe = t(async () => {
|
|
134
|
-
if (!(!l || !A || !w)) {
|
|
135
|
-
L(!0);
|
|
136
|
-
try {
|
|
137
|
-
let e = E(A, w.grid.width, w.grid.height, P), t = {
|
|
138
|
-
kind: "grid",
|
|
139
|
-
gridWidth: w.grid.width,
|
|
140
|
-
gridHeight: w.grid.height,
|
|
141
|
-
cells: e
|
|
142
|
-
};
|
|
143
|
-
await l.motionZones?.setZone({ patch: { regions: [{
|
|
144
|
-
id: v,
|
|
145
|
-
enabled: !0,
|
|
146
|
-
shape: t
|
|
147
|
-
}] } });
|
|
148
|
-
let n = await l.motionZones?.getStatus({});
|
|
149
|
-
if (n) {
|
|
150
|
-
let e = n.regions.find((e) => e.shape.kind === "grid"), t = S(e ? e.shape.cells : [], w.grid.width, w.grid.height);
|
|
151
|
-
N(t), j(T(t, w.grid.width, w.grid.height, P));
|
|
152
|
-
}
|
|
153
|
-
} catch (e) {
|
|
154
|
-
console.error("Motion Zones save failed", e);
|
|
155
|
-
} finally {
|
|
156
|
-
L(!1);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}, [
|
|
160
|
-
l,
|
|
161
|
-
A,
|
|
162
|
-
w,
|
|
163
|
-
P
|
|
164
|
-
]);
|
|
165
|
-
return f(i(() => R && !O && w && A ? {
|
|
166
|
-
id: _,
|
|
167
|
-
order: te,
|
|
168
|
-
node: /* @__PURE__ */ p(h, {
|
|
169
|
-
transparent: !0,
|
|
170
|
-
items: Q,
|
|
171
|
-
supportedShapes: ["grid"],
|
|
172
|
-
grid: {
|
|
173
|
-
width: U,
|
|
174
|
-
height: W
|
|
175
|
-
},
|
|
176
|
-
selectedId: v,
|
|
177
|
-
onSelect: () => {},
|
|
178
|
-
onShapeChange: $,
|
|
179
|
-
onDrawComplete: () => {},
|
|
180
|
-
drawingKind: null
|
|
181
|
-
})
|
|
182
|
-
} : null, [
|
|
183
|
-
R,
|
|
184
|
-
O,
|
|
185
|
-
w,
|
|
186
|
-
A,
|
|
187
|
-
Q,
|
|
188
|
-
$,
|
|
189
|
-
U,
|
|
190
|
-
W
|
|
191
|
-
])), l ? /* @__PURE__ */ p(d, {
|
|
192
|
-
title: "Motion Zones",
|
|
193
|
-
icon: /* @__PURE__ */ p(g, { className: "h-3.5 w-3.5 text-foreground-subtle" }),
|
|
194
|
-
children: /* @__PURE__ */ p("div", {
|
|
195
|
-
className: "flex flex-col gap-3",
|
|
196
|
-
children: O ? /* @__PURE__ */ p("p", {
|
|
197
|
-
className: `${u} leading-relaxed`,
|
|
198
|
-
children: "This camera doesn't expose an on-board motion zones grid."
|
|
199
|
-
}) : !O && w !== null && A !== null ? /* @__PURE__ */ m(ee, { children: [/* @__PURE__ */ m("p", {
|
|
200
|
-
className: `${u} leading-relaxed`,
|
|
201
|
-
children: [
|
|
202
|
-
"Toggle ",
|
|
203
|
-
/* @__PURE__ */ p("strong", {
|
|
204
|
-
className: "text-foreground",
|
|
205
|
-
children: "Edit grid"
|
|
206
|
-
}),
|
|
207
|
-
" to paint the region directly on the live frame, then ",
|
|
208
|
-
/* @__PURE__ */ p("strong", {
|
|
209
|
-
className: "text-foreground",
|
|
210
|
-
children: "Save"
|
|
211
|
-
}),
|
|
212
|
-
" to push the mask to the camera. Pick a bigger",
|
|
213
|
-
" ",
|
|
214
|
-
/* @__PURE__ */ p("strong", {
|
|
215
|
-
className: "text-foreground",
|
|
216
|
-
children: "Cell size"
|
|
217
|
-
}),
|
|
218
|
-
" for quicker, broad-stroke painting — it's resampled to the camera's native ",
|
|
219
|
-
w.grid.width,
|
|
220
|
-
"×",
|
|
221
|
-
w.grid.height,
|
|
222
|
-
" grid on save (×1 is the finest)."
|
|
223
|
-
]
|
|
224
|
-
}), /* @__PURE__ */ m("div", {
|
|
225
|
-
className: "flex items-center gap-2 flex-wrap",
|
|
226
|
-
children: [
|
|
227
|
-
/* @__PURE__ */ p("button", {
|
|
228
|
-
type: "button",
|
|
229
|
-
onClick: () => z((e) => !e),
|
|
230
|
-
disabled: I,
|
|
231
|
-
"aria-pressed": R,
|
|
232
|
-
className: R ? x : b,
|
|
233
|
-
children: R ? "Done editing" : "Edit grid"
|
|
234
|
-
}),
|
|
235
|
-
/* @__PURE__ */ p("button", {
|
|
236
|
-
type: "button",
|
|
237
|
-
onClick: () => X(!0),
|
|
238
|
-
disabled: I,
|
|
239
|
-
className: b,
|
|
240
|
-
children: "All on"
|
|
241
|
-
}),
|
|
242
|
-
/* @__PURE__ */ p("button", {
|
|
243
|
-
type: "button",
|
|
244
|
-
onClick: () => X(!1),
|
|
245
|
-
disabled: I,
|
|
246
|
-
className: b,
|
|
247
|
-
children: "All off"
|
|
248
|
-
}),
|
|
249
|
-
/* @__PURE__ */ p("button", {
|
|
250
|
-
type: "button",
|
|
251
|
-
onClick: ie,
|
|
252
|
-
disabled: I,
|
|
253
|
-
className: b,
|
|
254
|
-
children: "Invert"
|
|
255
|
-
}),
|
|
256
|
-
/* @__PURE__ */ m("div", {
|
|
257
|
-
className: "flex items-center gap-1 ml-1",
|
|
258
|
-
role: "group",
|
|
259
|
-
"aria-label": "Cell size",
|
|
260
|
-
children: [/* @__PURE__ */ p("span", {
|
|
261
|
-
className: `${u} mr-0.5`,
|
|
262
|
-
children: "Cell size"
|
|
263
|
-
}), ne.map((e) => /* @__PURE__ */ m("button", {
|
|
264
|
-
type: "button",
|
|
265
|
-
onClick: () => ae(e),
|
|
266
|
-
disabled: I,
|
|
267
|
-
"aria-pressed": P === e,
|
|
268
|
-
title: e === 1 ? `Camera grid ${V}×${H} (finest)` : `${C(V, e)}×${C(H, e)} painting grid · cells ×${e} bigger`,
|
|
269
|
-
className: P === e ? x : b,
|
|
270
|
-
children: ["×", e]
|
|
271
|
-
}, e))]
|
|
272
|
-
}),
|
|
273
|
-
/* @__PURE__ */ m("span", {
|
|
274
|
-
className: `${u} ml-1 tabular-nums`,
|
|
275
|
-
children: [
|
|
276
|
-
q,
|
|
277
|
-
" / ",
|
|
278
|
-
J,
|
|
279
|
-
" cells · ",
|
|
280
|
-
w.grid.width,
|
|
281
|
-
"×",
|
|
282
|
-
w.grid.height,
|
|
283
|
-
P === 1 ? "" : ` · paint ${U}×${W}`
|
|
284
|
-
]
|
|
285
|
-
}),
|
|
286
|
-
/* @__PURE__ */ p("span", { className: "flex-1" }),
|
|
287
|
-
/* @__PURE__ */ p("button", {
|
|
288
|
-
type: "button",
|
|
289
|
-
onClick: Z,
|
|
290
|
-
disabled: I || !K,
|
|
291
|
-
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",
|
|
292
|
-
children: "Revert"
|
|
293
|
-
}),
|
|
294
|
-
/* @__PURE__ */ p("button", {
|
|
295
|
-
type: "button",
|
|
296
|
-
onClick: () => void oe(),
|
|
297
|
-
disabled: I || !K,
|
|
298
|
-
className: x,
|
|
299
|
-
children: I ? "Saving…" : "Save"
|
|
300
|
-
})
|
|
301
|
-
]
|
|
302
|
-
})] }) : /* @__PURE__ */ p("p", {
|
|
303
|
-
className: `${u} leading-relaxed`,
|
|
304
|
-
children: "Loading the camera's grid…"
|
|
305
|
-
})
|
|
306
|
-
})
|
|
307
|
-
}) : null;
|
|
308
|
-
}
|
|
309
|
-
//#endregion
|
|
310
|
-
export { D as MotionZonesSettings };
|