@camstack/addon-osd-manager 0.1.223 → 0.1.224
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/_stub.js +212 -195
- package/package.json +1 -1
package/dist/_stub.js
CHANGED
|
@@ -19113,10 +19113,26 @@ function dS(e) {
|
|
|
19113
19113
|
function fS(e) {
|
|
19114
19114
|
return e.binding === null ? lS() : e.binding.conditions?.devices === void 0 ? e.binding : {
|
|
19115
19115
|
...e.binding,
|
|
19116
|
-
conditions:
|
|
19116
|
+
conditions: IS(e.binding.conditions, "devices")
|
|
19117
19117
|
};
|
|
19118
19118
|
}
|
|
19119
|
-
function pS(e) {
|
|
19119
|
+
function pS(e, t) {
|
|
19120
|
+
return JSON.stringify(e) === JSON.stringify(t);
|
|
19121
|
+
}
|
|
19122
|
+
function mS(e, t, n) {
|
|
19123
|
+
let r = [];
|
|
19124
|
+
for (let i of e) {
|
|
19125
|
+
let e = t[i];
|
|
19126
|
+
if (e === void 0) continue;
|
|
19127
|
+
let a = n[i];
|
|
19128
|
+
a !== void 0 && pS(e, a) || r.push({
|
|
19129
|
+
slotId: i,
|
|
19130
|
+
binding: e
|
|
19131
|
+
});
|
|
19132
|
+
}
|
|
19133
|
+
return r;
|
|
19134
|
+
}
|
|
19135
|
+
function hS(e) {
|
|
19120
19136
|
if (e !== void 0) {
|
|
19121
19137
|
if (e.valueType === "boolean") return {
|
|
19122
19138
|
true: "ON",
|
|
@@ -19125,21 +19141,21 @@ function pS(e) {
|
|
|
19125
19141
|
if (e.valueType === "enum" && e.enumValues && e.enumValues.length > 0) return Object.fromEntries(e.enumValues.map((e) => [e, e]));
|
|
19126
19142
|
}
|
|
19127
19143
|
}
|
|
19128
|
-
function
|
|
19144
|
+
function gS(e, t) {
|
|
19129
19145
|
if (e === t) return !0;
|
|
19130
19146
|
if (e === void 0 || t === void 0) return !1;
|
|
19131
19147
|
let n = Object.keys(e), r = Object.keys(t);
|
|
19132
19148
|
return n.length === r.length ? n.every((n) => e[n] === t[n]) : !1;
|
|
19133
19149
|
}
|
|
19134
|
-
function
|
|
19150
|
+
function _S(e, t) {
|
|
19135
19151
|
if (e === void 0) return !0;
|
|
19136
19152
|
let n = Object.entries(e);
|
|
19137
|
-
return !!(n.length === 0 || n.every(([e, t]) => e === t) || t !== void 0 &&
|
|
19153
|
+
return !!(n.length === 0 || n.every(([e, t]) => e === t) || t !== void 0 && gS(e, t));
|
|
19138
19154
|
}
|
|
19139
|
-
function
|
|
19155
|
+
function vS(e, t) {
|
|
19140
19156
|
if (!(t.deviceId <= 0 || t.capName === "" || t.valuePath === "")) return e.find((e) => e.deviceId === t.deviceId && e.capName === t.capName && e.valuePath === t.valuePath);
|
|
19141
19157
|
}
|
|
19142
|
-
function
|
|
19158
|
+
function yS(e, t) {
|
|
19143
19159
|
if (e === null) return "Unbound";
|
|
19144
19160
|
let n = e.source;
|
|
19145
19161
|
if (n.kind === "none") return "None";
|
|
@@ -19152,54 +19168,54 @@ function _S(e, t) {
|
|
|
19152
19168
|
}
|
|
19153
19169
|
return `${n.capName} · ${n.valuePath}`;
|
|
19154
19170
|
}
|
|
19155
|
-
function
|
|
19171
|
+
function bS(e, t) {
|
|
19156
19172
|
if (!e) return "unsupported";
|
|
19157
19173
|
let n = t.filter((e) => !e.readOnly);
|
|
19158
19174
|
if (n.length === 0) return "disabled";
|
|
19159
19175
|
let r = n.filter((e) => e.binding?.enabled === !0).length;
|
|
19160
19176
|
return r === 0 ? "disabled" : r === n.length ? "enabled" : "partial";
|
|
19161
19177
|
}
|
|
19162
|
-
var
|
|
19178
|
+
var xS = {
|
|
19163
19179
|
unsupported: "Unsupported",
|
|
19164
19180
|
disabled: "Disabled",
|
|
19165
19181
|
partial: "Partial",
|
|
19166
19182
|
enabled: "Enabled"
|
|
19167
19183
|
};
|
|
19168
|
-
function
|
|
19169
|
-
return
|
|
19184
|
+
function SS(e) {
|
|
19185
|
+
return xS[e];
|
|
19170
19186
|
}
|
|
19171
|
-
var
|
|
19187
|
+
var CS = {
|
|
19172
19188
|
unsupported: "default",
|
|
19173
19189
|
disabled: "default",
|
|
19174
19190
|
partial: "warning",
|
|
19175
19191
|
enabled: "success"
|
|
19176
19192
|
};
|
|
19177
|
-
function
|
|
19178
|
-
return
|
|
19193
|
+
function wS(e) {
|
|
19194
|
+
return CS[e];
|
|
19179
19195
|
}
|
|
19180
|
-
function
|
|
19196
|
+
function TS(e) {
|
|
19181
19197
|
return e.readOnly ? "readonly" : e.binding === null ? "unbound" : "bound";
|
|
19182
19198
|
}
|
|
19183
|
-
var
|
|
19199
|
+
var ES = {
|
|
19184
19200
|
bound: "bound",
|
|
19185
19201
|
unbound: "unbound",
|
|
19186
19202
|
readonly: "readonly"
|
|
19187
19203
|
};
|
|
19188
|
-
function
|
|
19189
|
-
return
|
|
19204
|
+
function DS(e) {
|
|
19205
|
+
return ES[e];
|
|
19190
19206
|
}
|
|
19191
|
-
function
|
|
19207
|
+
function OS(e) {
|
|
19192
19208
|
return e.filter((e) => !e.readOnly);
|
|
19193
19209
|
}
|
|
19194
|
-
function
|
|
19210
|
+
function kS(e) {
|
|
19195
19211
|
return (e.find((e) => !e.readOnly) ?? e[0])?.slotId;
|
|
19196
19212
|
}
|
|
19197
|
-
function
|
|
19213
|
+
function AS(e, t, n = /* @__PURE__ */ new Map()) {
|
|
19198
19214
|
let r = /* @__PURE__ */ new Map();
|
|
19199
19215
|
for (let i of e) {
|
|
19200
19216
|
let e = i.binding;
|
|
19201
19217
|
if (e === null || !e.enabled) continue;
|
|
19202
|
-
let [a, o] =
|
|
19218
|
+
let [a, o] = jS(e.source, t, n);
|
|
19203
19219
|
r.set(a, o);
|
|
19204
19220
|
}
|
|
19205
19221
|
return [...r.entries()].map(([e, t]) => ({
|
|
@@ -19207,7 +19223,7 @@ function OS(e, t, n = /* @__PURE__ */ new Map()) {
|
|
|
19207
19223
|
label: t
|
|
19208
19224
|
}));
|
|
19209
19225
|
}
|
|
19210
|
-
function
|
|
19226
|
+
function jS(e, t, n) {
|
|
19211
19227
|
if (e.kind === "none") return ["none", "None"];
|
|
19212
19228
|
if (e.kind === "static") return ["static", "Static text"];
|
|
19213
19229
|
if (e.kind === "clock") return ["clock", "Clock"];
|
|
@@ -19220,7 +19236,7 @@ function kS(e, t, n) {
|
|
|
19220
19236
|
let r = t.get(e.deviceId);
|
|
19221
19237
|
return [`device-state:${e.deviceId}`, r === void 0 ? "Linked device" : `Linked: ${r}`];
|
|
19222
19238
|
}
|
|
19223
|
-
var
|
|
19239
|
+
var MS = {
|
|
19224
19240
|
written: "Written",
|
|
19225
19241
|
unchanged: "Unchanged",
|
|
19226
19242
|
gated: "Gated (condition closed)",
|
|
@@ -19229,10 +19245,10 @@ var AS = {
|
|
|
19229
19245
|
unbound: "Unbound",
|
|
19230
19246
|
failed: "Write failed"
|
|
19231
19247
|
};
|
|
19232
|
-
function
|
|
19233
|
-
return
|
|
19248
|
+
function NS(e) {
|
|
19249
|
+
return MS[e];
|
|
19234
19250
|
}
|
|
19235
|
-
var
|
|
19251
|
+
var PS = {
|
|
19236
19252
|
written: "success",
|
|
19237
19253
|
unchanged: "success",
|
|
19238
19254
|
gated: "warning",
|
|
@@ -19241,10 +19257,10 @@ var MS = {
|
|
|
19241
19257
|
unbound: "default",
|
|
19242
19258
|
failed: "danger"
|
|
19243
19259
|
};
|
|
19244
|
-
function
|
|
19245
|
-
return
|
|
19260
|
+
function FS(e) {
|
|
19261
|
+
return PS[e];
|
|
19246
19262
|
}
|
|
19247
|
-
function
|
|
19263
|
+
function IS(e, t) {
|
|
19248
19264
|
if (e === void 0) return;
|
|
19249
19265
|
let { [t]: n, ...r } = e;
|
|
19250
19266
|
return Object.keys(r).length === 0 ? void 0 : r;
|
|
@@ -19252,7 +19268,7 @@ function PS(e, t) {
|
|
|
19252
19268
|
//#endregion
|
|
19253
19269
|
//#region src/components/DuplicateIntoAction.tsx
|
|
19254
19270
|
t();
|
|
19255
|
-
function
|
|
19271
|
+
function LS({ source: e, destinations: t, onDuplicated: n }) {
|
|
19256
19272
|
let [r, i] = a(!1), [o, s] = a(void 0), [c, l] = a(void 0), [u, d] = a(void 0), f = Ji();
|
|
19257
19273
|
if (t.length === 0) return null;
|
|
19258
19274
|
function p() {
|
|
@@ -19350,7 +19366,7 @@ function FS({ source: e, destinations: t, onDuplicated: n }) {
|
|
|
19350
19366
|
}
|
|
19351
19367
|
//#endregion
|
|
19352
19368
|
//#region src/adaptive-field.ts
|
|
19353
|
-
function
|
|
19369
|
+
function RS(e, t) {
|
|
19354
19370
|
let n = e.filter((e) => e.deviceId === t);
|
|
19355
19371
|
return n.length === 0 ? {
|
|
19356
19372
|
mode: "empty",
|
|
@@ -19366,7 +19382,7 @@ function IS(e, t) {
|
|
|
19366
19382
|
auto: void 0
|
|
19367
19383
|
};
|
|
19368
19384
|
}
|
|
19369
|
-
function
|
|
19385
|
+
function zS(e) {
|
|
19370
19386
|
if (e.length === 0) return;
|
|
19371
19387
|
let t = e.find((e) => e.valuePath === "value" || e.valuePath.endsWith(".value"));
|
|
19372
19388
|
if (t !== void 0) return t;
|
|
@@ -19387,7 +19403,7 @@ function LS(e) {
|
|
|
19387
19403
|
}
|
|
19388
19404
|
//#endregion
|
|
19389
19405
|
//#region src/state-leaves.ts
|
|
19390
|
-
function
|
|
19406
|
+
function BS(e, t) {
|
|
19391
19407
|
let n = e;
|
|
19392
19408
|
for (let e of t.split(".")) {
|
|
19393
19409
|
if (typeof n != "object" || !n || Array.isArray(n) || !Object.hasOwn(n, e)) return;
|
|
@@ -19397,16 +19413,16 @@ function RS(e, t) {
|
|
|
19397
19413
|
}
|
|
19398
19414
|
//#endregion
|
|
19399
19415
|
//#region src/osd-source-fields.ts
|
|
19400
|
-
var
|
|
19401
|
-
function
|
|
19402
|
-
return e == null ? !0 : !
|
|
19416
|
+
var VS = new Set(["container"]);
|
|
19417
|
+
function HS(e) {
|
|
19418
|
+
return e == null ? !0 : !VS.has(e);
|
|
19403
19419
|
}
|
|
19404
|
-
function
|
|
19420
|
+
function US(e) {
|
|
19405
19421
|
return e === "container";
|
|
19406
19422
|
}
|
|
19407
19423
|
//#endregion
|
|
19408
19424
|
//#region src/osd-picker-devices.ts
|
|
19409
|
-
function
|
|
19425
|
+
function WS(e) {
|
|
19410
19426
|
return e.map((e) => ({
|
|
19411
19427
|
id: e.id,
|
|
19412
19428
|
name: e.name,
|
|
@@ -19415,20 +19431,20 @@ function HS(e) {
|
|
|
19415
19431
|
parentDeviceId: e.parentDeviceId ?? null
|
|
19416
19432
|
}));
|
|
19417
19433
|
}
|
|
19418
|
-
function
|
|
19419
|
-
return t.filter((t) => t.parentDeviceId === e &&
|
|
19434
|
+
function GS(e, t, n) {
|
|
19435
|
+
return t.filter((t) => t.parentDeviceId === e && HS(t.type) && n.has(t.id)).toSorted((e, t) => e.name.localeCompare(t.name));
|
|
19420
19436
|
}
|
|
19421
|
-
function
|
|
19437
|
+
function KS(e, t) {
|
|
19422
19438
|
return e.find((e) => e.id === t);
|
|
19423
19439
|
}
|
|
19424
19440
|
//#endregion
|
|
19425
19441
|
//#region src/unit-display.ts
|
|
19426
|
-
function
|
|
19442
|
+
function qS(e) {
|
|
19427
19443
|
if (e === void 0) return;
|
|
19428
19444
|
let t = oe(e);
|
|
19429
19445
|
if (t !== void 0) return k(t);
|
|
19430
19446
|
}
|
|
19431
|
-
function
|
|
19447
|
+
function JS(e, t, n) {
|
|
19432
19448
|
let r = t === void 0 ? void 0 : oe(t), i = n === void 0 ? void 0 : oe(n);
|
|
19433
19449
|
if (r === void 0 || i === void 0 || r === i) return {
|
|
19434
19450
|
value: e,
|
|
@@ -19443,7 +19459,7 @@ function KS(e, t, n) {
|
|
|
19443
19459
|
unit: i
|
|
19444
19460
|
};
|
|
19445
19461
|
}
|
|
19446
|
-
function
|
|
19462
|
+
function YS(e, t) {
|
|
19447
19463
|
if (typeof e != "object" || !e || Array.isArray(e)) return;
|
|
19448
19464
|
let n = { ...e }, r = t.split(".");
|
|
19449
19465
|
if (r.length >= 1) {
|
|
@@ -19465,7 +19481,7 @@ function qS(e, t) {
|
|
|
19465
19481
|
}
|
|
19466
19482
|
//#endregion
|
|
19467
19483
|
//#region src/components/ValueMapEditor.tsx
|
|
19468
|
-
function
|
|
19484
|
+
function XS({ valueMap: e, onChange: t }) {
|
|
19469
19485
|
let n = Object.entries(e ?? {});
|
|
19470
19486
|
function r(e) {
|
|
19471
19487
|
if (e.length === 0) {
|
|
@@ -19526,7 +19542,7 @@ function JS({ valueMap: e, onChange: t }) {
|
|
|
19526
19542
|
//#endregion
|
|
19527
19543
|
//#region src/components/DeviceStatePickBlock.tsx
|
|
19528
19544
|
t();
|
|
19529
|
-
function
|
|
19545
|
+
function ZS(e) {
|
|
19530
19546
|
return e.map((e) => ({
|
|
19531
19547
|
id: e.id,
|
|
19532
19548
|
name: e.name,
|
|
@@ -19535,7 +19551,7 @@ function YS(e) {
|
|
|
19535
19551
|
parentDeviceId: "parentDeviceId" in e && typeof e.parentDeviceId == "number" ? e.parentDeviceId : null
|
|
19536
19552
|
}));
|
|
19537
19553
|
}
|
|
19538
|
-
function
|
|
19554
|
+
function QS(e, t, n) {
|
|
19539
19555
|
return {
|
|
19540
19556
|
...e,
|
|
19541
19557
|
...e.containerId === void 0 ? {} : { containerId: e.containerId },
|
|
@@ -19543,17 +19559,17 @@ function XS(e, t, n) {
|
|
|
19543
19559
|
...n === void 0 ? {} : { valueMap: n }
|
|
19544
19560
|
};
|
|
19545
19561
|
}
|
|
19546
|
-
function
|
|
19547
|
-
return
|
|
19562
|
+
function $S(e, t, n) {
|
|
19563
|
+
return _S(e, hS(t)) ? hS(n) : e;
|
|
19548
19564
|
}
|
|
19549
|
-
function
|
|
19550
|
-
let d = l(() =>
|
|
19565
|
+
function eC({ value: e, sources: t, pickerDevices: n, listState: r, stateByDevice: i, testIdPrefix: o, onChange: s, maxDecimals: c, onMaxDecimalsChange: u }) {
|
|
19566
|
+
let d = l(() => ZS(n), [n]), f = l(() => new Set(t.map((e) => e.deviceId)), [t]), [p, h] = a(e.containerId);
|
|
19551
19567
|
m(() => {
|
|
19552
19568
|
h(e.containerId);
|
|
19553
19569
|
}, [e.containerId, e.deviceId]);
|
|
19554
|
-
let g = e.deviceId > 0 ? e.deviceId : void 0, _ = p ?? g, v = p !== void 0 &&
|
|
19555
|
-
let a =
|
|
19556
|
-
O(
|
|
19570
|
+
let g = e.deviceId > 0 ? e.deviceId : void 0, _ = p ?? g, v = p !== void 0 && US(KS(d, p)?.type) ? p : void 0, y = v === void 0 ? [] : GS(v, d, f), b = g === void 0 ? void 0 : RS(t, g), x = g === void 0 ? void 0 : KS(d, g), S = e.containerId === void 0 ? void 0 : KS(d, e.containerId), C = v !== void 0 && g === void 0 ? `${KS(d, v)?.name ?? `#${v}`} › …` : S === void 0 ? x?.name ?? (g === void 0 ? "No device" : `#${e.deviceId}`) : `${S.name} › ${x?.name ?? `#${e.deviceId}`}`, w = YS(g === void 0 || i === void 0 ? void 0 : i.get(g)?.[e.capName], e.valuePath), T = qS(w), E = vS(t, e), D = E?.valueType === "boolean" || E?.valueType === "enum", O = (e) => s(e), ee = (n, r, i) => {
|
|
19571
|
+
let a = vS(t, e), o = $S(e.valueMap, a, i);
|
|
19572
|
+
O(QS({
|
|
19557
19573
|
deviceId: n,
|
|
19558
19574
|
...r === void 0 ? {} : { containerId: r },
|
|
19559
19575
|
capName: i?.capName ?? "",
|
|
@@ -19579,16 +19595,16 @@ function QS({ value: e, sources: t, pickerDevices: n, listState: r, stateByDevic
|
|
|
19579
19595
|
onChange: (n) => {
|
|
19580
19596
|
let r = n.length === 0 ? void 0 : n.length === 1 ? n[0] : n.find((e) => e !== _) ?? n[n.length - 1];
|
|
19581
19597
|
if (r === void 0) {
|
|
19582
|
-
h(void 0), O(
|
|
19598
|
+
h(void 0), O(QS({
|
|
19583
19599
|
deviceId: 0,
|
|
19584
19600
|
capName: "",
|
|
19585
19601
|
valuePath: ""
|
|
19586
19602
|
}, e.displayUnit, void 0));
|
|
19587
19603
|
return;
|
|
19588
19604
|
}
|
|
19589
|
-
let i =
|
|
19590
|
-
if (i !== void 0 &&
|
|
19591
|
-
h(r), O(
|
|
19605
|
+
let i = KS(d, r);
|
|
19606
|
+
if (i !== void 0 && US(i.type)) {
|
|
19607
|
+
h(r), O(QS({
|
|
19592
19608
|
deviceId: 0,
|
|
19593
19609
|
containerId: r,
|
|
19594
19610
|
capName: "",
|
|
@@ -19597,8 +19613,8 @@ function QS({ value: e, sources: t, pickerDevices: n, listState: r, stateByDevic
|
|
|
19597
19613
|
return;
|
|
19598
19614
|
}
|
|
19599
19615
|
h(void 0);
|
|
19600
|
-
let a =
|
|
19601
|
-
ee(r, void 0, a.auto ??
|
|
19616
|
+
let a = RS(t, r);
|
|
19617
|
+
ee(r, void 0, a.auto ?? zS(a.fields));
|
|
19602
19618
|
},
|
|
19603
19619
|
noun: "device",
|
|
19604
19620
|
emptyLabel: "Pick a device",
|
|
@@ -19628,8 +19644,8 @@ function QS({ value: e, sources: t, pickerDevices: n, listState: r, stateByDevic
|
|
|
19628
19644
|
onChange: (e) => {
|
|
19629
19645
|
let n = Number(e.target.value);
|
|
19630
19646
|
if (!Number.isFinite(n) || n <= 0) return;
|
|
19631
|
-
let r =
|
|
19632
|
-
ee(n, v, r.auto ??
|
|
19647
|
+
let r = RS(t, n);
|
|
19648
|
+
ee(n, v, r.auto ?? zS(r.fields));
|
|
19633
19649
|
}
|
|
19634
19650
|
})]
|
|
19635
19651
|
}),
|
|
@@ -19651,8 +19667,8 @@ function QS({ value: e, sources: t, pickerDevices: n, listState: r, stateByDevic
|
|
|
19651
19667
|
onChange: (n) => {
|
|
19652
19668
|
let r = b.fields.find((e) => `${e.capName}:${e.valuePath}` === n.target.value);
|
|
19653
19669
|
if (!r) return;
|
|
19654
|
-
let i =
|
|
19655
|
-
O(
|
|
19670
|
+
let i = vS(t, e), a = $S(e.valueMap, i, r);
|
|
19671
|
+
O(QS({
|
|
19656
19672
|
deviceId: g ?? e.deviceId,
|
|
19657
19673
|
...e.containerId === void 0 ? {} : { containerId: e.containerId },
|
|
19658
19674
|
capName: r.capName,
|
|
@@ -19665,7 +19681,7 @@ function QS({ value: e, sources: t, pickerDevices: n, listState: r, stateByDevic
|
|
|
19665
19681
|
children: [/* @__PURE__ */ F("div", { children: [/* @__PURE__ */ P($a, { children: "Unit source" }), /* @__PURE__ */ P(iS, {
|
|
19666
19682
|
dimension: T,
|
|
19667
19683
|
value: e.displayUnit ?? "",
|
|
19668
|
-
onChange: (t) => O(
|
|
19684
|
+
onChange: (t) => O(QS({
|
|
19669
19685
|
deviceId: e.deviceId,
|
|
19670
19686
|
...e.containerId === void 0 ? {} : { containerId: e.containerId },
|
|
19671
19687
|
capName: e.capName,
|
|
@@ -19689,9 +19705,9 @@ function QS({ value: e, sources: t, pickerDevices: n, listState: r, stateByDevic
|
|
|
19689
19705
|
}),
|
|
19690
19706
|
D ? /* @__PURE__ */ P("div", {
|
|
19691
19707
|
"data-testid": `${o}-value-map`,
|
|
19692
|
-
children: /* @__PURE__ */ P(
|
|
19708
|
+
children: /* @__PURE__ */ P(XS, {
|
|
19693
19709
|
valueMap: e.valueMap,
|
|
19694
|
-
onChange: (t) => O(
|
|
19710
|
+
onChange: (t) => O(QS({
|
|
19695
19711
|
deviceId: e.deviceId,
|
|
19696
19712
|
...e.containerId === void 0 ? {} : { containerId: e.containerId },
|
|
19697
19713
|
capName: e.capName,
|
|
@@ -19705,7 +19721,7 @@ function QS({ value: e, sources: t, pickerDevices: n, listState: r, stateByDevic
|
|
|
19705
19721
|
//#endregion
|
|
19706
19722
|
//#region src/components/SourceEditor.tsx
|
|
19707
19723
|
t();
|
|
19708
|
-
var
|
|
19724
|
+
var tC = [
|
|
19709
19725
|
{
|
|
19710
19726
|
value: "none",
|
|
19711
19727
|
label: "None"
|
|
@@ -19731,7 +19747,7 @@ var $S = [
|
|
|
19731
19747
|
label: "Named template"
|
|
19732
19748
|
}
|
|
19733
19749
|
];
|
|
19734
|
-
function
|
|
19750
|
+
function nC({ source: e, sources: t, pickerDevices: n, listState: r, templates: i, valueMap: a, maxDecimals: o, onChange: s, onValueMapChange: c, onMaxDecimalsChange: u }) {
|
|
19735
19751
|
let d = l(() => i.map((e) => ({
|
|
19736
19752
|
value: e.id,
|
|
19737
19753
|
label: e.name || e.id
|
|
@@ -19745,7 +19761,7 @@ function eC({ source: e, sources: t, pickerDevices: n, listState: r, templates:
|
|
|
19745
19761
|
}), /* @__PURE__ */ P(Li, {
|
|
19746
19762
|
id: "osd-source-kind",
|
|
19747
19763
|
value: e.kind,
|
|
19748
|
-
options:
|
|
19764
|
+
options: tC,
|
|
19749
19765
|
onChange: (e) => {
|
|
19750
19766
|
let t = e.target.value;
|
|
19751
19767
|
if (t === "none") s({ kind: "none" }), c(void 0);
|
|
@@ -19822,7 +19838,7 @@ function eC({ source: e, sources: t, pickerDevices: n, listState: r, templates:
|
|
|
19822
19838
|
})
|
|
19823
19839
|
})] })]
|
|
19824
19840
|
}),
|
|
19825
|
-
e.kind === "device-state" && /* @__PURE__ */ P(
|
|
19841
|
+
e.kind === "device-state" && /* @__PURE__ */ P(rC, {
|
|
19826
19842
|
source: e,
|
|
19827
19843
|
sources: t,
|
|
19828
19844
|
pickerDevices: n,
|
|
@@ -19869,12 +19885,12 @@ function eC({ source: e, sources: t, pickerDevices: n, listState: r, templates:
|
|
|
19869
19885
|
]
|
|
19870
19886
|
});
|
|
19871
19887
|
}
|
|
19872
|
-
function
|
|
19888
|
+
function rC({ source: e, sources: t, pickerDevices: n, listState: r, valueMap: i, maxDecimals: a, onChange: o, onValueMapChange: s, onMaxDecimalsChange: c }) {
|
|
19873
19889
|
let u = e.deviceId, d = Hi({ deviceId: u ?? 0 }, { enabled: u !== void 0 }), f = l(() => {
|
|
19874
19890
|
let e = /* @__PURE__ */ new Map();
|
|
19875
19891
|
return u !== void 0 && d.data !== void 0 && e.set(u, d.data), e;
|
|
19876
19892
|
}, [u, d.data]);
|
|
19877
|
-
return /* @__PURE__ */ P(
|
|
19893
|
+
return /* @__PURE__ */ P(eC, {
|
|
19878
19894
|
value: {
|
|
19879
19895
|
deviceId: u ?? 0,
|
|
19880
19896
|
capName: e.capName,
|
|
@@ -19912,7 +19928,7 @@ function tC({ source: e, sources: t, pickerDevices: n, listState: r, valueMap: i
|
|
|
19912
19928
|
//#endregion
|
|
19913
19929
|
//#region src/components/SlotEditor.tsx
|
|
19914
19930
|
t();
|
|
19915
|
-
function
|
|
19931
|
+
function iC() {
|
|
19916
19932
|
return /* @__PURE__ */ F(bo, {
|
|
19917
19933
|
"data-testid": "osd-slot-content-tabs",
|
|
19918
19934
|
children: [/* @__PURE__ */ P(xo, {
|
|
@@ -19924,7 +19940,7 @@ function nC() {
|
|
|
19924
19940
|
})]
|
|
19925
19941
|
});
|
|
19926
19942
|
}
|
|
19927
|
-
function
|
|
19943
|
+
function aC({ deviceId: e, slot: t, binding: n, onBindingChange: r, sources: i, pickerDevices: o, listState: s, templates: c, onRefreshCurrent: u, refreshingCurrent: d = !1 }) {
|
|
19928
19944
|
let [f, p] = a(void 0), [h, g] = a(t.cameraEnabled), _ = Yi(), v = qi(), y = _.isPending || v.isPending, b = _.error ?? v.error;
|
|
19929
19945
|
m(() => {
|
|
19930
19946
|
v.isPending || g(t.cameraEnabled);
|
|
@@ -20031,8 +20047,8 @@ function rC({ deviceId: e, slot: t, binding: n, onBindingChange: r, sources: i,
|
|
|
20031
20047
|
f ? /* @__PURE__ */ F("div", {
|
|
20032
20048
|
className: "flex items-center gap-2 text-xs",
|
|
20033
20049
|
children: [/* @__PURE__ */ P(ta, {
|
|
20034
|
-
variant:
|
|
20035
|
-
children:
|
|
20050
|
+
variant: FS(f.outcome),
|
|
20051
|
+
children: NS(f.outcome)
|
|
20036
20052
|
}), /* @__PURE__ */ P("span", {
|
|
20037
20053
|
className: "text-foreground-muted",
|
|
20038
20054
|
children: f.text ? `"${f.text}"` : "(blank)"
|
|
@@ -20053,7 +20069,7 @@ function rC({ deviceId: e, slot: t, binding: n, onBindingChange: r, sources: i,
|
|
|
20053
20069
|
className: "text-[11px] text-foreground-subtle",
|
|
20054
20070
|
children: "Where the text comes from and how it is formatted."
|
|
20055
20071
|
}),
|
|
20056
|
-
/* @__PURE__ */ P(
|
|
20072
|
+
/* @__PURE__ */ P(nC, {
|
|
20057
20073
|
source: n.source,
|
|
20058
20074
|
sources: i,
|
|
20059
20075
|
pickerDevices: o,
|
|
@@ -20085,7 +20101,7 @@ function rC({ deviceId: e, slot: t, binding: n, onBindingChange: r, sources: i,
|
|
|
20085
20101
|
placeholder: "${value} ${unit}",
|
|
20086
20102
|
testId: "osd-slot-template",
|
|
20087
20103
|
maxLength: 96
|
|
20088
|
-
}), D ? /* @__PURE__ */ P(
|
|
20104
|
+
}), D ? /* @__PURE__ */ P(XS, {
|
|
20089
20105
|
valueMap: n.valueMap,
|
|
20090
20106
|
onChange: (e) => r({
|
|
20091
20107
|
...n,
|
|
@@ -20098,7 +20114,7 @@ function rC({ deviceId: e, slot: t, binding: n, onBindingChange: r, sources: i,
|
|
|
20098
20114
|
//#endregion
|
|
20099
20115
|
//#region src/components/CameraOsdRow.tsx
|
|
20100
20116
|
t();
|
|
20101
|
-
function
|
|
20117
|
+
function oC({ cameraId: e, supportsOsd: t, onRefetchReady: n }) {
|
|
20102
20118
|
let r = Wi({ deviceId: e }, { enabled: t });
|
|
20103
20119
|
if (m(() => {
|
|
20104
20120
|
t && n(e, () => void r.refetch());
|
|
@@ -20107,13 +20123,13 @@ function iC({ cameraId: e, supportsOsd: t, onRefetchReady: n }) {
|
|
|
20107
20123
|
t,
|
|
20108
20124
|
r.refetch
|
|
20109
20125
|
]), t && r.isLoading) return /* @__PURE__ */ P(Tt, { className: "h-3 w-3 animate-spin text-foreground-subtle" });
|
|
20110
|
-
let i =
|
|
20126
|
+
let i = bS(t, r.data?.slots ?? []);
|
|
20111
20127
|
return /* @__PURE__ */ P(ta, {
|
|
20112
|
-
variant:
|
|
20113
|
-
children:
|
|
20128
|
+
variant: wS(i),
|
|
20129
|
+
children: SS(i)
|
|
20114
20130
|
});
|
|
20115
20131
|
}
|
|
20116
|
-
function
|
|
20132
|
+
function sC({ cameraId: e, supportsOsd: t, deviceNameById: n, templateNameById: r }) {
|
|
20117
20133
|
let i = Wi({ deviceId: e }, { enabled: t });
|
|
20118
20134
|
if (!t) return /* @__PURE__ */ P("span", {
|
|
20119
20135
|
className: "text-xs text-foreground-subtle",
|
|
@@ -20123,7 +20139,7 @@ function aC({ cameraId: e, supportsOsd: t, deviceNameById: n, templateNameById:
|
|
|
20123
20139
|
className: "text-xs text-foreground-subtle",
|
|
20124
20140
|
children: "Loading…"
|
|
20125
20141
|
});
|
|
20126
|
-
let a =
|
|
20142
|
+
let a = AS(i.data?.slots ?? [], n, r);
|
|
20127
20143
|
if (a.length === 0) return /* @__PURE__ */ P("span", {
|
|
20128
20144
|
className: "text-xs text-foreground-subtle",
|
|
20129
20145
|
children: "No active sources"
|
|
@@ -20135,7 +20151,7 @@ function aC({ cameraId: e, supportsOsd: t, deviceNameById: n, templateNameById:
|
|
|
20135
20151
|
children: o
|
|
20136
20152
|
});
|
|
20137
20153
|
}
|
|
20138
|
-
function
|
|
20154
|
+
function cC({ cameraId: e, supportsOsd: t, onRendered: n }) {
|
|
20139
20155
|
let r = Xi();
|
|
20140
20156
|
return t ? /* @__PURE__ */ F(W, {
|
|
20141
20157
|
type: "button",
|
|
@@ -20149,25 +20165,25 @@ function oC({ cameraId: e, supportsOsd: t, onRendered: n }) {
|
|
|
20149
20165
|
children: [r.isPending ? /* @__PURE__ */ P(Tt, { className: "h-3.5 w-3.5 animate-spin" }) : null, "Render now"]
|
|
20150
20166
|
}) : null;
|
|
20151
20167
|
}
|
|
20152
|
-
function
|
|
20153
|
-
let h = Wi({ deviceId: e.id }, { enabled: e.supportsOsd }), g = h.data?.slots ?? [], _ = l(() =>
|
|
20168
|
+
function lC({ camera: e, pickerDevices: t, listState: r, templates: i, onRefetchReady: s, activeSlotId: c, onActiveSlotIdChange: u, contentPanel: d, onContentPanelChange: f, onClose: p }) {
|
|
20169
|
+
let h = Wi({ deviceId: e.id }, { enabled: e.supportsOsd }), g = h.data?.slots ?? [], _ = l(() => OS(g), [g]), v = l(() => c !== null && _.some((e) => e.slotId === c) ? c : kS(_), [c, _]), y = _.find((e) => e.slotId === v), [b, x] = a({}), [S, C] = a({}), [w, T] = a(null), E = Ki(), D = E.isPending, O = l(() => {
|
|
20154
20170
|
if (h.data === void 0) return null;
|
|
20155
|
-
let t =
|
|
20171
|
+
let t = OS(h.data.slots), n = {};
|
|
20156
20172
|
for (let e of t) n[e.slotId] = fS(e);
|
|
20157
20173
|
return {
|
|
20158
20174
|
key: `${e.id}:${t.map((e) => `${e.slotId}:${JSON.stringify(e.binding)}`).join("|")}`,
|
|
20159
20175
|
drafts: n
|
|
20160
20176
|
};
|
|
20161
|
-
}, [e.id, h.data]),
|
|
20162
|
-
|
|
20163
|
-
let t =
|
|
20177
|
+
}, [e.id, h.data]), ee = o(O);
|
|
20178
|
+
ee.current = O, m(() => {
|
|
20179
|
+
let t = ee.current;
|
|
20164
20180
|
if (!e.supportsOsd || t === null) {
|
|
20165
|
-
x((e) => Object.keys(e).length === 0 ? e : {});
|
|
20181
|
+
x((e) => Object.keys(e).length === 0 ? e : {}), C((e) => Object.keys(e).length === 0 ? e : {});
|
|
20166
20182
|
return;
|
|
20167
20183
|
}
|
|
20168
|
-
x(t.drafts), C(null);
|
|
20169
|
-
}, [e.supportsOsd,
|
|
20170
|
-
let
|
|
20184
|
+
x(t.drafts), C(t.drafts), T(null);
|
|
20185
|
+
}, [e.supportsOsd, O?.key]);
|
|
20186
|
+
let te = Gi({ deviceId: e.id }, { enabled: e.supportsOsd && y !== void 0 });
|
|
20171
20187
|
m(() => {
|
|
20172
20188
|
e.supportsOsd && s(e.id, () => void h.refetch());
|
|
20173
20189
|
}, [
|
|
@@ -20175,29 +20191,30 @@ function sC({ camera: e, pickerDevices: t, listState: r, templates: i, onRefetch
|
|
|
20175
20191
|
e.supportsOsd,
|
|
20176
20192
|
h.refetch
|
|
20177
20193
|
]);
|
|
20178
|
-
let
|
|
20179
|
-
|
|
20194
|
+
let ne = l(() => mS(_.map((e) => e.slotId), b, S), [
|
|
20195
|
+
S,
|
|
20196
|
+
b,
|
|
20197
|
+
_
|
|
20198
|
+
]), re = n(async () => {
|
|
20199
|
+
T(null);
|
|
20180
20200
|
try {
|
|
20181
|
-
for (let t of
|
|
20182
|
-
|
|
20183
|
-
|
|
20184
|
-
|
|
20185
|
-
|
|
20186
|
-
|
|
20187
|
-
});
|
|
20188
|
-
}
|
|
20189
|
-
h.refetch(), p();
|
|
20201
|
+
for (let { slotId: t, binding: n } of ne) await E.mutateAsync({
|
|
20202
|
+
deviceId: e.id,
|
|
20203
|
+
slotId: t,
|
|
20204
|
+
binding: n
|
|
20205
|
+
});
|
|
20206
|
+
C(b), h.refetch(), p();
|
|
20190
20207
|
} catch (e) {
|
|
20191
|
-
|
|
20208
|
+
T(e instanceof Error ? e.message : String(e));
|
|
20192
20209
|
}
|
|
20193
20210
|
}, [
|
|
20194
20211
|
e.id,
|
|
20195
20212
|
b,
|
|
20196
|
-
_,
|
|
20197
20213
|
p,
|
|
20198
20214
|
h,
|
|
20199
|
-
|
|
20200
|
-
|
|
20215
|
+
ne,
|
|
20216
|
+
E
|
|
20217
|
+
]), ie = !D && ne.length > 0, ae = h.error ?? te.error, oe = (() => {
|
|
20201
20218
|
if (!e.supportsOsd) return /* @__PURE__ */ P("p", {
|
|
20202
20219
|
className: "text-xs text-foreground-subtle",
|
|
20203
20220
|
children: "This camera does not expose writable text-overlay slots."
|
|
@@ -20206,8 +20223,8 @@ function sC({ camera: e, pickerDevices: t, listState: r, templates: i, onRefetch
|
|
|
20206
20223
|
className: "flex items-center gap-2 text-xs text-foreground-subtle",
|
|
20207
20224
|
children: [/* @__PURE__ */ P(Tt, { className: "h-3.5 w-3.5 animate-spin" }), "Loading overlay slots…"]
|
|
20208
20225
|
});
|
|
20209
|
-
if (
|
|
20210
|
-
message:
|
|
20226
|
+
if (ae) return /* @__PURE__ */ P(pa, {
|
|
20227
|
+
message: ae.message,
|
|
20211
20228
|
title: `Could not load ${e.name}`
|
|
20212
20229
|
});
|
|
20213
20230
|
if (h.data?.supported && _.length === 0) return /* @__PURE__ */ P("p", {
|
|
@@ -20216,7 +20233,7 @@ function sC({ camera: e, pickerDevices: t, listState: r, templates: i, onRefetch
|
|
|
20216
20233
|
});
|
|
20217
20234
|
if (v === void 0 || y === void 0) return null;
|
|
20218
20235
|
let n = b[y.slotId];
|
|
20219
|
-
return n === void 0 ? null : /* @__PURE__ */ P(
|
|
20236
|
+
return n === void 0 ? null : /* @__PURE__ */ P(uC, {
|
|
20220
20237
|
cameraId: e.id,
|
|
20221
20238
|
slot: y,
|
|
20222
20239
|
binding: n,
|
|
@@ -20224,14 +20241,14 @@ function sC({ camera: e, pickerDevices: t, listState: r, templates: i, onRefetch
|
|
|
20224
20241
|
...t,
|
|
20225
20242
|
[y.slotId]: e
|
|
20226
20243
|
})),
|
|
20227
|
-
sources:
|
|
20244
|
+
sources: te.data?.sources ?? [],
|
|
20228
20245
|
pickerDevices: t,
|
|
20229
20246
|
listState: r,
|
|
20230
20247
|
templates: i,
|
|
20231
20248
|
refreshingCurrent: h.isFetching,
|
|
20232
20249
|
onRefreshCurrent: () => h.refetch()
|
|
20233
20250
|
});
|
|
20234
|
-
})(),
|
|
20251
|
+
})(), k = e.supportsOsd && !h.isLoading && ae === null && _.length > 0, se = k && y !== void 0 && !y.readOnly;
|
|
20235
20252
|
return /* @__PURE__ */ P(yo, {
|
|
20236
20253
|
appearance: "pills",
|
|
20237
20254
|
value: d,
|
|
@@ -20245,15 +20262,15 @@ function sC({ camera: e, pickerDevices: t, listState: r, templates: i, onRefetch
|
|
|
20245
20262
|
icon: Nt,
|
|
20246
20263
|
width: "xl",
|
|
20247
20264
|
testId: "osd-camera-editor",
|
|
20248
|
-
error:
|
|
20249
|
-
beforeBody:
|
|
20265
|
+
error: w,
|
|
20266
|
+
beforeBody: k ? /* @__PURE__ */ F("div", {
|
|
20250
20267
|
className: "space-y-2",
|
|
20251
20268
|
children: [/* @__PURE__ */ P("div", {
|
|
20252
20269
|
"data-testid": "osd-slot-tabs",
|
|
20253
20270
|
role: "tablist",
|
|
20254
20271
|
className: "flex flex-row overflow-x-auto overflow-y-hidden border-b border-border-subtle",
|
|
20255
20272
|
children: _.map((e) => {
|
|
20256
|
-
let t = e.slotId === v, n =
|
|
20273
|
+
let t = e.slotId === v, n = TS(e);
|
|
20257
20274
|
return /* @__PURE__ */ F("button", {
|
|
20258
20275
|
type: "button",
|
|
20259
20276
|
role: "tab",
|
|
@@ -20263,25 +20280,25 @@ function sC({ camera: e, pickerDevices: t, listState: r, templates: i, onRefetch
|
|
|
20263
20280
|
onClick: () => u(e.slotId),
|
|
20264
20281
|
children: [e.slotId, /* @__PURE__ */ P("span", {
|
|
20265
20282
|
className: "ml-1.5 text-[10px] text-foreground-subtle",
|
|
20266
|
-
children:
|
|
20283
|
+
children: DS(n)
|
|
20267
20284
|
})]
|
|
20268
20285
|
}, e.slotId);
|
|
20269
20286
|
})
|
|
20270
|
-
}),
|
|
20287
|
+
}), se ? /* @__PURE__ */ P(iC, {}) : null]
|
|
20271
20288
|
}) : null,
|
|
20272
|
-
footer:
|
|
20289
|
+
footer: se ? /* @__PURE__ */ P(W, {
|
|
20273
20290
|
type: "button",
|
|
20274
20291
|
size: "sm",
|
|
20275
|
-
disabled: !
|
|
20292
|
+
disabled: !ie,
|
|
20276
20293
|
"data-testid": "osd-camera-save",
|
|
20277
|
-
onClick: () => void
|
|
20278
|
-
children:
|
|
20294
|
+
onClick: () => void re(),
|
|
20295
|
+
children: D ? "Saving…" : "Save"
|
|
20279
20296
|
}) : null,
|
|
20280
|
-
children:
|
|
20297
|
+
children: oe
|
|
20281
20298
|
})
|
|
20282
20299
|
});
|
|
20283
20300
|
}
|
|
20284
|
-
function
|
|
20301
|
+
function uC({ cameraId: e, slot: t, binding: n, onBindingChange: r, sources: i, pickerDevices: a, listState: o, templates: s, onRefreshCurrent: c, refreshingCurrent: u }) {
|
|
20285
20302
|
let d = l(() => new Map(s.map((e) => [e.id, e.name])), [s]);
|
|
20286
20303
|
return t.readOnly ? /* @__PURE__ */ F("div", {
|
|
20287
20304
|
"data-testid": "osd-slot-readonly",
|
|
@@ -20306,10 +20323,10 @@ function cC({ cameraId: e, slot: t, binding: n, onBindingChange: r, sources: i,
|
|
|
20306
20323
|
}),
|
|
20307
20324
|
/* @__PURE__ */ P("p", {
|
|
20308
20325
|
className: "text-xs text-foreground-subtle",
|
|
20309
|
-
children:
|
|
20326
|
+
children: yS(t.binding, d)
|
|
20310
20327
|
})
|
|
20311
20328
|
]
|
|
20312
|
-
}) : /* @__PURE__ */ P(
|
|
20329
|
+
}) : /* @__PURE__ */ P(aC, {
|
|
20313
20330
|
deviceId: e,
|
|
20314
20331
|
slot: t,
|
|
20315
20332
|
binding: n,
|
|
@@ -20325,13 +20342,13 @@ function cC({ cameraId: e, slot: t, binding: n, onBindingChange: r, sources: i,
|
|
|
20325
20342
|
//#endregion
|
|
20326
20343
|
//#region src/components/CameraOsdTable.tsx
|
|
20327
20344
|
t();
|
|
20328
|
-
var
|
|
20345
|
+
var dC = {
|
|
20329
20346
|
searchPlaceholder: "Search cameras",
|
|
20330
20347
|
searchLabel: "Search cameras",
|
|
20331
20348
|
facetsLabel: "Capability",
|
|
20332
20349
|
clearLabel: "Clear filters"
|
|
20333
20350
|
};
|
|
20334
|
-
function
|
|
20351
|
+
function fC({ cameras: e, osdCapableIds: t, allDevices: n, pickerDevices: r, listState: i, templates: a }) {
|
|
20335
20352
|
let s = Cb({ editKey: "device" }), [c, u] = Sb("slot"), [d, f] = Sb("panel"), p = uS(d), h = (e) => {
|
|
20336
20353
|
f(e === "layer" ? null : e);
|
|
20337
20354
|
}, g = o(/* @__PURE__ */ new Map()), _ = o(!1), v = l(() => new Map(n.map((e) => [e.id, e.name])), [n]), y = l(() => new Map(a.map((e) => [e.id, e.name])), [a]), b = l(() => e.map((e) => ({
|
|
@@ -20376,7 +20393,7 @@ function uC({ cameras: e, osdCapableIds: t, allDevices: n, pickerDevices: r, lis
|
|
|
20376
20393
|
key: "status",
|
|
20377
20394
|
header: "Status",
|
|
20378
20395
|
notSortableReason: "Live probe",
|
|
20379
|
-
render: (e) => /* @__PURE__ */ P(
|
|
20396
|
+
render: (e) => /* @__PURE__ */ P(oC, {
|
|
20380
20397
|
cameraId: e.id,
|
|
20381
20398
|
supportsOsd: e.supportsOsd,
|
|
20382
20399
|
onRefetchReady: S
|
|
@@ -20387,7 +20404,7 @@ function uC({ cameras: e, osdCapableIds: t, allDevices: n, pickerDevices: r, lis
|
|
|
20387
20404
|
header: "Active sources",
|
|
20388
20405
|
notSortableReason: "Live probe",
|
|
20389
20406
|
nowrap: !0,
|
|
20390
|
-
render: (e) => /* @__PURE__ */ P(
|
|
20407
|
+
render: (e) => /* @__PURE__ */ P(sC, {
|
|
20391
20408
|
cameraId: e.id,
|
|
20392
20409
|
supportsOsd: e.supportsOsd,
|
|
20393
20410
|
deviceNameById: v,
|
|
@@ -20403,12 +20420,12 @@ function uC({ cameras: e, osdCapableIds: t, allDevices: n, pickerDevices: r, lis
|
|
|
20403
20420
|
render: (e) => /* @__PURE__ */ F("div", {
|
|
20404
20421
|
className: "flex justify-end gap-1",
|
|
20405
20422
|
children: [
|
|
20406
|
-
/* @__PURE__ */ P(
|
|
20423
|
+
/* @__PURE__ */ P(cC, {
|
|
20407
20424
|
cameraId: e.id,
|
|
20408
20425
|
supportsOsd: e.supportsOsd,
|
|
20409
20426
|
onRendered: () => C(e.id)
|
|
20410
20427
|
}),
|
|
20411
|
-
e.supportsOsd ? /* @__PURE__ */ P(
|
|
20428
|
+
e.supportsOsd ? /* @__PURE__ */ P(LS, {
|
|
20412
20429
|
source: e,
|
|
20413
20430
|
destinations: b.filter((t) => t.id !== e.id && t.supportsOsd),
|
|
20414
20431
|
onDuplicated: (e) => C(e)
|
|
@@ -20441,7 +20458,7 @@ function uC({ cameras: e, osdCapableIds: t, allDevices: n, pickerDevices: r, lis
|
|
|
20441
20458
|
children: /* @__PURE__ */ P(as, {
|
|
20442
20459
|
state: x.state,
|
|
20443
20460
|
facets: x.facets,
|
|
20444
|
-
labels:
|
|
20461
|
+
labels: dC,
|
|
20445
20462
|
onSearch: x.setSearch,
|
|
20446
20463
|
onToggleFacet: x.toggleFacet,
|
|
20447
20464
|
onClear: x.clear
|
|
@@ -20461,7 +20478,7 @@ function uC({ cameras: e, osdCapableIds: t, allDevices: n, pickerDevices: r, lis
|
|
|
20461
20478
|
dir: "asc"
|
|
20462
20479
|
}
|
|
20463
20480
|
}),
|
|
20464
|
-
E === null ? null : /* @__PURE__ */ P(
|
|
20481
|
+
E === null ? null : /* @__PURE__ */ P(lC, {
|
|
20465
20482
|
camera: E,
|
|
20466
20483
|
pickerDevices: r,
|
|
20467
20484
|
listState: i,
|
|
@@ -20478,7 +20495,7 @@ function uC({ cameras: e, osdCapableIds: t, allDevices: n, pickerDevices: r, lis
|
|
|
20478
20495
|
}
|
|
20479
20496
|
//#endregion
|
|
20480
20497
|
//#region src/format.ts
|
|
20481
|
-
function
|
|
20498
|
+
function pC(e, t) {
|
|
20482
20499
|
if (!Number.isFinite(e)) return "";
|
|
20483
20500
|
if (t <= 0) return String(Math.trunc(e));
|
|
20484
20501
|
let n = 10 ** t, r = Math.trunc(e * n) / n;
|
|
@@ -20486,39 +20503,39 @@ function dC(e, t) {
|
|
|
20486
20503
|
}
|
|
20487
20504
|
//#endregion
|
|
20488
20505
|
//#region src/template-tokens.ts
|
|
20489
|
-
function
|
|
20506
|
+
function mC(e, t = "full") {
|
|
20490
20507
|
return t === "full" ? `{${e}}` : `{${e}.${t}}`;
|
|
20491
20508
|
}
|
|
20492
|
-
function
|
|
20509
|
+
function hC(e) {
|
|
20493
20510
|
return `{${e}.full}`;
|
|
20494
20511
|
}
|
|
20495
|
-
function
|
|
20512
|
+
function gC(e) {
|
|
20496
20513
|
let t = e.alias;
|
|
20497
20514
|
return [
|
|
20498
20515
|
{
|
|
20499
20516
|
id: `${t}.value`,
|
|
20500
20517
|
label: `${t} · value`,
|
|
20501
|
-
token:
|
|
20518
|
+
token: mC(t, "value"),
|
|
20502
20519
|
kind: "value"
|
|
20503
20520
|
},
|
|
20504
20521
|
{
|
|
20505
20522
|
id: `${t}.unit`,
|
|
20506
20523
|
label: `${t} · unit`,
|
|
20507
|
-
token:
|
|
20524
|
+
token: mC(t, "unit"),
|
|
20508
20525
|
kind: "unit"
|
|
20509
20526
|
},
|
|
20510
20527
|
{
|
|
20511
20528
|
id: `${t}.full`,
|
|
20512
20529
|
label: `${t} · value+unit`,
|
|
20513
|
-
token:
|
|
20530
|
+
token: hC(t),
|
|
20514
20531
|
kind: "full"
|
|
20515
20532
|
}
|
|
20516
20533
|
];
|
|
20517
20534
|
}
|
|
20518
|
-
function
|
|
20535
|
+
function _C(e, t, n) {
|
|
20519
20536
|
return e.replaceAll(t, n);
|
|
20520
20537
|
}
|
|
20521
|
-
function
|
|
20538
|
+
function vC(e, t, n = "b") {
|
|
20522
20539
|
let r = e.trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "").replace(/^(\d)/, "a$1").slice(0, 24), i = r.length > 0 ? r : n;
|
|
20523
20540
|
if (!t.has(i)) return i;
|
|
20524
20541
|
for (let e = 2; e < 1e3; e += 1) {
|
|
@@ -20529,88 +20546,88 @@ function gC(e, t, n = "b") {
|
|
|
20529
20546
|
}
|
|
20530
20547
|
//#endregion
|
|
20531
20548
|
//#region src/named-template-render.ts
|
|
20532
|
-
function
|
|
20549
|
+
function yC(e, t, n) {
|
|
20533
20550
|
if (n === "value") return e;
|
|
20534
20551
|
if (n === "unit") return t;
|
|
20535
20552
|
let r = e.trim(), i = t.trim();
|
|
20536
20553
|
return r === "" ? i : i === "" ? r : `${r}${i}`;
|
|
20537
20554
|
}
|
|
20538
|
-
function
|
|
20555
|
+
function bC(e, t) {
|
|
20539
20556
|
let n = e.pick.deviceId, r = t.stateByDevice.get(n);
|
|
20540
20557
|
if (r === void 0) return { reason: `no state mirrored for device ${n}` };
|
|
20541
20558
|
let i = r[e.capName];
|
|
20542
20559
|
if (i === void 0) return { reason: `device ${n} publishes no "${e.capName}" state` };
|
|
20543
|
-
let a =
|
|
20560
|
+
let a = BS(i, e.valuePath);
|
|
20544
20561
|
if (a === void 0) return { reason: `"${e.capName}.${e.valuePath}" is absent on device ${n}` };
|
|
20545
20562
|
let o = e.valueMap?.[String(a)];
|
|
20546
20563
|
if (o !== void 0) return {
|
|
20547
20564
|
value: o,
|
|
20548
20565
|
unit: "",
|
|
20549
|
-
formatted:
|
|
20566
|
+
formatted: yC(o, "", "full")
|
|
20550
20567
|
};
|
|
20551
20568
|
let s, c = "";
|
|
20552
20569
|
if (typeof a == "number") {
|
|
20553
|
-
let t =
|
|
20554
|
-
s =
|
|
20570
|
+
let t = JS(a, YS(i, e.valuePath), e.displayUnit);
|
|
20571
|
+
s = pC(t.value, e.maxDecimals), c = t.unit;
|
|
20555
20572
|
} else s = typeof a == "boolean" ? a ? "ON" : "OFF" : a === null ? "" : String(a);
|
|
20556
20573
|
return {
|
|
20557
20574
|
value: s,
|
|
20558
20575
|
unit: c,
|
|
20559
|
-
formatted:
|
|
20576
|
+
formatted: yC(s, c, "full")
|
|
20560
20577
|
};
|
|
20561
20578
|
}
|
|
20562
|
-
function
|
|
20579
|
+
function xC(e, t, n) {
|
|
20563
20580
|
let r = e;
|
|
20564
|
-
return r =
|
|
20581
|
+
return r = _C(r, hC(t), n.formatted), r = _C(r, mC(t, "value"), n.value), r = _C(r, mC(t, "unit"), n.unit), r = _C(r, mC(t, "full"), n.formatted), r;
|
|
20565
20582
|
}
|
|
20566
|
-
function
|
|
20583
|
+
function SC(e, t) {
|
|
20567
20584
|
let n = e.parser;
|
|
20568
20585
|
if (e.bindings.length === 0) return n.trim() === "" ? { reason: `template "${e.id}" has no bindings` } : { text: n };
|
|
20569
20586
|
for (let r of e.bindings) {
|
|
20570
|
-
let e =
|
|
20587
|
+
let e = bC(r, t);
|
|
20571
20588
|
if ("reason" in e) return e;
|
|
20572
|
-
n =
|
|
20589
|
+
n = xC(n, r.alias, e);
|
|
20573
20590
|
}
|
|
20574
20591
|
return { text: n };
|
|
20575
20592
|
}
|
|
20576
20593
|
//#endregion
|
|
20577
20594
|
//#region src/template-id.ts
|
|
20578
|
-
function
|
|
20595
|
+
function CC() {
|
|
20579
20596
|
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `tpl-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
|
20580
20597
|
}
|
|
20581
20598
|
//#endregion
|
|
20582
20599
|
//#region src/components/TemplatesPanel.tsx
|
|
20583
20600
|
t();
|
|
20584
|
-
var
|
|
20585
|
-
function
|
|
20601
|
+
var wC = 0;
|
|
20602
|
+
function TC(e, t) {
|
|
20586
20603
|
let n = /* @__PURE__ */ new Set();
|
|
20587
20604
|
for (let r = 0; r < e.length; r += 1) r !== t && n.add(e[r].alias);
|
|
20588
20605
|
return n;
|
|
20589
20606
|
}
|
|
20590
|
-
function
|
|
20607
|
+
function EC() {
|
|
20591
20608
|
return {
|
|
20592
20609
|
alias: "",
|
|
20593
|
-
pick: { deviceId:
|
|
20610
|
+
pick: { deviceId: wC },
|
|
20594
20611
|
capName: "",
|
|
20595
20612
|
valuePath: "",
|
|
20596
20613
|
maxDecimals: 1
|
|
20597
20614
|
};
|
|
20598
20615
|
}
|
|
20599
|
-
function
|
|
20616
|
+
function DC(e) {
|
|
20600
20617
|
return e.pick.deviceId > 0 && e.capName !== "" && e.valuePath !== "" && e.alias !== "";
|
|
20601
20618
|
}
|
|
20602
|
-
function
|
|
20619
|
+
function OC() {
|
|
20603
20620
|
return {
|
|
20604
|
-
id:
|
|
20621
|
+
id: CC(),
|
|
20605
20622
|
name: "New template",
|
|
20606
20623
|
bindings: [],
|
|
20607
20624
|
parser: ""
|
|
20608
20625
|
};
|
|
20609
20626
|
}
|
|
20610
|
-
function
|
|
20627
|
+
function kC({ createRequested: e = !1, onCreateConsumed: t }) {
|
|
20611
20628
|
let n = Zi({}), r = zi({ projection: "slim" }), i = Qi(), o = $i(), s = Cb(), c = la(), [u, d] = a(null), f = n.data?.templates ?? [];
|
|
20612
20629
|
m(() => {
|
|
20613
|
-
e && (d(
|
|
20630
|
+
e && (d(OC()), s.openNew(), t?.());
|
|
20614
20631
|
}, [e]), m(() => {
|
|
20615
20632
|
let e = s.state;
|
|
20616
20633
|
if (e.mode === "closed") {
|
|
@@ -20618,13 +20635,13 @@ function DC({ createRequested: e = !1, onCreateConsumed: t }) {
|
|
|
20618
20635
|
return;
|
|
20619
20636
|
}
|
|
20620
20637
|
if (e.mode === "new") {
|
|
20621
|
-
d((e) => e !== null && !f.some((t) => t.id === e.id) ? e :
|
|
20638
|
+
d((e) => e !== null && !f.some((t) => t.id === e.id) ? e : OC());
|
|
20622
20639
|
return;
|
|
20623
20640
|
}
|
|
20624
20641
|
let t = f.find((t) => t.id === e.id);
|
|
20625
20642
|
t !== void 0 && d(t);
|
|
20626
20643
|
}, [s.state, f]);
|
|
20627
|
-
let p = l(() =>
|
|
20644
|
+
let p = l(() => WS(r.data ?? []), [r.data]), h = r.isError ? "failed" : r.isSuccess ? "answered" : "pending", g = n.error ?? i.error ?? o.error, _ = l(() => [
|
|
20628
20645
|
{
|
|
20629
20646
|
key: "name",
|
|
20630
20647
|
header: "Name",
|
|
@@ -20675,7 +20692,7 @@ function DC({ createRequested: e = !1, onCreateConsumed: t }) {
|
|
|
20675
20692
|
onClick: (t) => {
|
|
20676
20693
|
t.stopPropagation(), d({
|
|
20677
20694
|
...e,
|
|
20678
|
-
id:
|
|
20695
|
+
id: CC(),
|
|
20679
20696
|
name: `${e.name} (copy)`
|
|
20680
20697
|
}), s.openNew();
|
|
20681
20698
|
},
|
|
@@ -20760,14 +20777,14 @@ function DC({ createRequested: e = !1, onCreateConsumed: t }) {
|
|
|
20760
20777
|
children: /* @__PURE__ */ P(W, {
|
|
20761
20778
|
type: "button",
|
|
20762
20779
|
size: "sm",
|
|
20763
|
-
disabled: i.isPending || u.name.trim().length === 0 || !u.bindings.every(
|
|
20780
|
+
disabled: i.isPending || u.name.trim().length === 0 || !u.bindings.every(DC),
|
|
20764
20781
|
onClick: () => void (async () => {
|
|
20765
20782
|
await i.mutateAsync({ template: u }), await n.refetch(), s.close(), x(null), d(null);
|
|
20766
20783
|
})(),
|
|
20767
20784
|
children: "Save template"
|
|
20768
20785
|
})
|
|
20769
20786
|
}),
|
|
20770
|
-
children: /* @__PURE__ */ P(
|
|
20787
|
+
children: /* @__PURE__ */ P(AC, {
|
|
20771
20788
|
draft: u,
|
|
20772
20789
|
pickerDevices: p,
|
|
20773
20790
|
listState: h,
|
|
@@ -20778,10 +20795,10 @@ function DC({ createRequested: e = !1, onCreateConsumed: t }) {
|
|
|
20778
20795
|
]
|
|
20779
20796
|
});
|
|
20780
20797
|
}
|
|
20781
|
-
function
|
|
20782
|
-
let i = t.find((e) => !
|
|
20798
|
+
function AC({ draft: e, pickerDevices: t, listState: n, onChange: r }) {
|
|
20799
|
+
let i = t.find((e) => !US(e.type))?.id ?? 0, a = Gi({ deviceId: i }, { enabled: i > 0 }).data?.sources ?? [], o = l(() => e.bindings.filter(DC).flatMap((e) => gC(e)), [e.bindings]), s = MC(e.bindings), c = l(() => SC({
|
|
20783
20800
|
...e,
|
|
20784
|
-
bindings: e.bindings.filter(
|
|
20801
|
+
bindings: e.bindings.filter(DC)
|
|
20785
20802
|
}, { stateByDevice: s }), [e, s]);
|
|
20786
20803
|
return /* @__PURE__ */ F(I, { children: [/* @__PURE__ */ F(So, {
|
|
20787
20804
|
value: "template",
|
|
@@ -20854,7 +20871,7 @@ function OC({ draft: e, pickerDevices: t, listState: n, onChange: r }) {
|
|
|
20854
20871
|
onClick: () => {
|
|
20855
20872
|
r({
|
|
20856
20873
|
...e,
|
|
20857
|
-
bindings: [...e.bindings,
|
|
20874
|
+
bindings: [...e.bindings, EC()]
|
|
20858
20875
|
});
|
|
20859
20876
|
},
|
|
20860
20877
|
children: "Add binding"
|
|
@@ -20864,7 +20881,7 @@ function OC({ draft: e, pickerDevices: t, listState: n, onChange: r }) {
|
|
|
20864
20881
|
className: "text-xs text-foreground-muted",
|
|
20865
20882
|
children: "No bindings yet — add one to start."
|
|
20866
20883
|
}),
|
|
20867
|
-
e.bindings.map((i, o) => /* @__PURE__ */ P(
|
|
20884
|
+
e.bindings.map((i, o) => /* @__PURE__ */ P(jC, {
|
|
20868
20885
|
binding: i,
|
|
20869
20886
|
index: o,
|
|
20870
20887
|
draft: e,
|
|
@@ -20877,8 +20894,8 @@ function OC({ draft: e, pickerDevices: t, listState: n, onChange: r }) {
|
|
|
20877
20894
|
]
|
|
20878
20895
|
})] });
|
|
20879
20896
|
}
|
|
20880
|
-
function
|
|
20881
|
-
let c =
|
|
20897
|
+
function jC({ binding: e, index: t, draft: n, pickerDevices: r, listState: i, sources: a, stateByDevice: o, onChange: s }) {
|
|
20898
|
+
let c = DC(e) ? bC(e, { stateByDevice: o }) : { reason: "Pick a device and field" }, l = {
|
|
20882
20899
|
deviceId: e.pick.deviceId,
|
|
20883
20900
|
...e.pick.containerId === void 0 ? {} : { containerId: e.pick.containerId },
|
|
20884
20901
|
capName: e.capName,
|
|
@@ -20893,15 +20910,15 @@ function kC({ binding: e, index: t, draft: n, pickerDevices: r, listState: i, so
|
|
|
20893
20910
|
e.alias === "" ? null : /* @__PURE__ */ F("p", {
|
|
20894
20911
|
className: "text-right font-mono text-[10px] text-foreground-muted",
|
|
20895
20912
|
children: [
|
|
20896
|
-
|
|
20913
|
+
mC(e.alias),
|
|
20897
20914
|
" · ",
|
|
20898
|
-
|
|
20915
|
+
mC(e.alias, "value"),
|
|
20899
20916
|
" ·",
|
|
20900
20917
|
" ",
|
|
20901
|
-
|
|
20918
|
+
mC(e.alias, "unit")
|
|
20902
20919
|
]
|
|
20903
20920
|
}),
|
|
20904
|
-
/* @__PURE__ */ P(
|
|
20921
|
+
/* @__PURE__ */ P(eC, {
|
|
20905
20922
|
value: l,
|
|
20906
20923
|
sources: a,
|
|
20907
20924
|
pickerDevices: r,
|
|
@@ -20909,7 +20926,7 @@ function kC({ binding: e, index: t, draft: n, pickerDevices: r, listState: i, so
|
|
|
20909
20926
|
stateByDevice: o,
|
|
20910
20927
|
testIdPrefix: `osd-tpl-${t}`,
|
|
20911
20928
|
onChange: (i) => {
|
|
20912
|
-
let a = i.deviceId !== e.pick.deviceId, o = i.deviceId > 0 ?
|
|
20929
|
+
let a = i.deviceId !== e.pick.deviceId, o = i.deviceId > 0 ? KS(r, i.deviceId) : void 0, c = TC(n.bindings, t), l = a && i.deviceId > 0 ? vC(o?.name ?? (i.valuePath === "" ? "sensor" : i.valuePath), c) : e.alias, u = e.alias, { displayUnit: d, valueMap: f, ...p } = e, m = {
|
|
20913
20930
|
...p,
|
|
20914
20931
|
alias: l,
|
|
20915
20932
|
pick: i.containerId === void 0 ? { deviceId: i.deviceId } : {
|
|
@@ -20936,7 +20953,7 @@ function kC({ binding: e, index: t, draft: n, pickerDevices: r, listState: i, so
|
|
|
20936
20953
|
value: e.alias,
|
|
20937
20954
|
maxLength: 32,
|
|
20938
20955
|
onChange: (r) => {
|
|
20939
|
-
let i = r.target.value, a =
|
|
20956
|
+
let i = r.target.value, a = TC(n.bindings, t);
|
|
20940
20957
|
i !== "" && a.has(i) || s({
|
|
20941
20958
|
...n,
|
|
20942
20959
|
bindings: n.bindings.map((n, r) => r === t ? {
|
|
@@ -20986,7 +21003,7 @@ function kC({ binding: e, index: t, draft: n, pickerDevices: r, listState: i, so
|
|
|
20986
21003
|
]
|
|
20987
21004
|
});
|
|
20988
21005
|
}
|
|
20989
|
-
function
|
|
21006
|
+
function MC(e) {
|
|
20990
21007
|
let t = l(() => new Set(e.map((e) => e.pick.deviceId).filter((e) => e > 0)), [e]), n = Ui({}, {
|
|
20991
21008
|
enabled: t.size > 0,
|
|
20992
21009
|
refetchInterval: 5e3
|
|
@@ -21004,17 +21021,17 @@ function AC(e) {
|
|
|
21004
21021
|
//#endregion
|
|
21005
21022
|
//#region src/page.tsx
|
|
21006
21023
|
t();
|
|
21007
|
-
function
|
|
21024
|
+
function NC(e) {
|
|
21008
21025
|
return e === "templates" ? "templates" : "cameras";
|
|
21009
21026
|
}
|
|
21010
|
-
function
|
|
21011
|
-
let [t, r] = Sb("tab"), [, i] = Sb("device"), [, o] = Sb("slot"), [, s] = Sb("panel"), [, c] = Sb("edit"), [, u] = Sb("new"), d =
|
|
21027
|
+
function PC(e) {
|
|
21028
|
+
let [t, r] = Sb("tab"), [, i] = Sb("device"), [, o] = Sb("slot"), [, s] = Sb("panel"), [, c] = Sb("edit"), [, u] = Sb("new"), d = NC(t), [f, p] = a(!1), m = zi({ projection: "slim" }), h = Vi({}), g = Zi({}), _ = l(() => (m.data ?? []).filter((e) => e.isCamera).map((e) => ({
|
|
21012
21029
|
id: e.id,
|
|
21013
21030
|
name: e.name
|
|
21014
21031
|
})).toSorted((e, t) => e.name.localeCompare(t.name)), [m.data]), v = l(() => (m.data ?? []).map((e) => ({
|
|
21015
21032
|
id: e.id,
|
|
21016
21033
|
name: e.name
|
|
21017
|
-
})), [m.data]), y = l(() =>
|
|
21034
|
+
})), [m.data]), y = l(() => WS(m.data ?? []), [m.data]), b = m.isError ? "failed" : m.isSuccess ? "answered" : "pending", x = l(() => new Set((h.data ?? []).filter((e) => e.entries.some((e) => e.capName === "osd")).map((e) => e.deviceId)), [h.data]), S = m.error ?? h.error ?? g.error, C = m.isLoading || h.isLoading, w = C ? "Loading cameras…" : `${_.length} cameras · ${x.size} expose writable overlays · ${g.data?.templates.length ?? 0} templates`, T = n((e, t) => {
|
|
21018
21035
|
for (let e of t) e === "device" ? i(null) : e === "slot" ? o(null) : e === "panel" ? s(null) : e === "edit" ? c(null) : e === "new" && u(null);
|
|
21019
21036
|
r(e === "cameras" ? null : e);
|
|
21020
21037
|
}, [
|
|
@@ -21033,7 +21050,7 @@ function MC(e) {
|
|
|
21033
21050
|
}) : _.length === 0 ? /* @__PURE__ */ P("div", {
|
|
21034
21051
|
className: "flex flex-1 items-center justify-center py-16 text-xs text-foreground-subtle",
|
|
21035
21052
|
children: "No cameras are registered."
|
|
21036
|
-
}) : /* @__PURE__ */ P(
|
|
21053
|
+
}) : /* @__PURE__ */ P(fC, {
|
|
21037
21054
|
cameras: _,
|
|
21038
21055
|
osdCapableIds: x,
|
|
21039
21056
|
allDevices: v,
|
|
@@ -21073,7 +21090,7 @@ function MC(e) {
|
|
|
21073
21090
|
"new",
|
|
21074
21091
|
"panel"
|
|
21075
21092
|
],
|
|
21076
|
-
content: /* @__PURE__ */ P(
|
|
21093
|
+
content: /* @__PURE__ */ P(kC, {
|
|
21077
21094
|
createRequested: f,
|
|
21078
21095
|
onCreateConsumed: () => p(!1)
|
|
21079
21096
|
})
|
|
@@ -21081,4 +21098,4 @@ function MC(e) {
|
|
|
21081
21098
|
});
|
|
21082
21099
|
}
|
|
21083
21100
|
//#endregion
|
|
21084
|
-
export {
|
|
21101
|
+
export { PC as default };
|