@camstack/addon-benchmark 1.2.79 → 1.2.81

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.
@@ -1,10 +1,10 @@
1
1
  import { c as e, g as t, h as n, p as r, u as i, x as a } from "./_virtual_mf___mfe_internal__addon_benchmark_page__loadShare__react__loadShare__.js-GeuxDuzQ.mjs";
2
2
  import { a as o, c as s, n as c, o as l, r as u, t as d } from "./responsive-7v9yGyBs.mjs";
3
- import { a as f, c as p, i as m, l as h, n as ee, o as te, r as g, s as _, t as v, u as y } from "./use-device-snapshot-CYhIptV5.mjs";
4
- import { t as b } from "./trash-2-DrZYv_-G.mjs";
5
- import { n as x, r as S, t as C } from "./_virtual_mf___mfe_internal__addon_benchmark_page__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-SOU_VnTj.mjs";
6
- import { MaskShapeCanvas as ne } from "./MaskShapeCanvas-BDvrLf-K.mjs";
7
- var re = s("settings-2", [
3
+ import { a as f, d as p, f as ee, i as m, l as h, n as g, o as te, r as _, s as v, t as ne, u as re } from "./use-device-snapshot-XtO-hagD.mjs";
4
+ import { t as y } from "./trash-2-DrZYv_-G.mjs";
5
+ import { n as b, r as x, t as S } from "./_virtual_mf___mfe_internal__addon_benchmark_page__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-SOU_VnTj.mjs";
6
+ import { MaskShapeCanvas as ie } from "./MaskShapeCanvas-BDvrLf-K.mjs";
7
+ var C = s("settings-2", [
8
8
  ["path", {
9
9
  d: "M14 17H5",
10
10
  key: "gfn3mx"
@@ -29,7 +29,7 @@ var re = s("settings-2", [
29
29
  //#endregion
30
30
  //#region ../ui-library/src/composites/cap-settings/SceneReferenceGallery.tsx
31
31
  a();
32
- var w = "/addon/pipeline-analytics/event-media";
32
+ var w = h("/addon/pipeline-analytics/event-media");
33
33
  function T(e) {
34
34
  let t = /* @__PURE__ */ new Map();
35
35
  for (let n of e.states) n.references.forEach((e, r) => {
@@ -51,37 +51,37 @@ function E(e) {
51
51
  var D = "rounded border border-danger/50 bg-danger/10 px-1 py-0.5 text-[10px] font-medium text-danger hover:bg-danger/20 disabled:opacity-40 transition-colors";
52
52
  function O({ monitor: e, disabled: n, onDelete: r }) {
53
53
  let i = T(e), a = E(e), [o, s] = t(null);
54
- return i.length === 0 ? /* @__PURE__ */ x("p", {
54
+ return i.length === 0 ? /* @__PURE__ */ b("p", {
55
55
  className: `${d} leading-relaxed`,
56
56
  children: "No photographs captured yet. Press “Capture daylight” to take the one this scene will judge everything against."
57
- }) : /* @__PURE__ */ x("div", {
57
+ }) : /* @__PURE__ */ b("div", {
58
58
  className: "flex flex-col gap-2",
59
- children: i.map((e) => /* @__PURE__ */ S("div", {
59
+ children: i.map((e) => /* @__PURE__ */ x("div", {
60
60
  className: "flex flex-col gap-1",
61
- children: [/* @__PURE__ */ S("p", {
61
+ children: [/* @__PURE__ */ x("p", {
62
62
  className: "text-[10px] font-semibold uppercase tracking-wide text-foreground-subtle",
63
63
  children: [
64
- _(e.condition),
64
+ v(e.condition),
65
65
  " · ",
66
66
  e.tiles.length
67
67
  ]
68
- }), /* @__PURE__ */ x("ul", {
68
+ }), /* @__PURE__ */ b("ul", {
69
69
  className: "flex flex-wrap gap-1.5",
70
70
  children: e.tiles.map((t) => {
71
71
  let i = `${t.stateId}:${String(t.index)}`, c = a === 1, l = o === i;
72
- return /* @__PURE__ */ S("li", {
72
+ return /* @__PURE__ */ x("li", {
73
73
  className: "flex w-24 flex-col gap-1 rounded-md border border-border p-1",
74
74
  children: [
75
- /* @__PURE__ */ x(k, { reference: t.reference }),
76
- /* @__PURE__ */ x("span", {
75
+ /* @__PURE__ */ b(k, { reference: t.reference }),
76
+ /* @__PURE__ */ b("span", {
77
77
  className: `${d} tabular-nums`,
78
78
  children: A(t.reference.capturedAt)
79
79
  }),
80
- /* @__PURE__ */ S("button", {
80
+ /* @__PURE__ */ x("button", {
81
81
  type: "button",
82
82
  className: D,
83
83
  disabled: n,
84
- "aria-label": `Delete the ${_(e.condition).toLowerCase()} photograph from ${A(t.reference.capturedAt)}`,
84
+ "aria-label": `Delete the ${v(e.condition).toLowerCase()} photograph from ${A(t.reference.capturedAt)}`,
85
85
  onClick: () => {
86
86
  if (c && !l) {
87
87
  s(i);
@@ -92,9 +92,9 @@ function O({ monitor: e, disabled: n, onDelete: r }) {
92
92
  index: t.index
93
93
  });
94
94
  },
95
- children: [/* @__PURE__ */ x(b, { className: "mr-1 inline h-3 w-3" }), l ? "Confirm" : "Delete"]
95
+ children: [/* @__PURE__ */ b(y, { className: "mr-1 inline h-3 w-3" }), l ? "Confirm" : "Delete"]
96
96
  }),
97
- l && /* @__PURE__ */ x("p", {
97
+ l && /* @__PURE__ */ b("p", {
98
98
  className: "text-[10px] leading-snug text-warning",
99
99
  children: "This is the only photograph this scene has. Delete it and the scene no longer knows what normal looks like — it stops judging until you capture again."
100
100
  })
@@ -107,14 +107,14 @@ function O({ monitor: e, disabled: n, onDelete: r }) {
107
107
  }
108
108
  function k({ reference: e }) {
109
109
  let [n, r] = t(!1), i = e.thumbnailMediaId;
110
- return i === void 0 || n ? /* @__PURE__ */ S("div", {
110
+ return i === void 0 || n ? /* @__PURE__ */ x("div", {
111
111
  className: "flex h-16 w-full flex-col items-center justify-center gap-0.5 rounded bg-surface text-foreground-subtle",
112
112
  title: "The picture for this reference is no longer stored. The reference itself is intact and still being scored against.",
113
- children: [/* @__PURE__ */ x(h, { className: "h-4 w-4" }), /* @__PURE__ */ x("span", {
113
+ children: [/* @__PURE__ */ b(p, { className: "h-4 w-4" }), /* @__PURE__ */ b("span", {
114
114
  className: "text-[9px]",
115
115
  children: "no picture"
116
116
  })]
117
- }) : /* @__PURE__ */ x("img", {
117
+ }) : /* @__PURE__ */ b("img", {
118
118
  src: `${w}/${encodeURIComponent(i)}`,
119
119
  alt: "",
120
120
  loading: "lazy",
@@ -166,22 +166,22 @@ function B({ monitor: e, disabled: n, onPatch: r }) {
166
166
  ...e.check,
167
167
  hysteresisCount: t.hysteresisCount ?? e.check.hysteresisCount
168
168
  }, f = e.confirm?.enabled === !0, p = e.check.mode === "similarity" ? e.check.threshold : null;
169
- return /* @__PURE__ */ S("div", {
169
+ return /* @__PURE__ */ x("div", {
170
170
  className: "flex flex-col gap-2",
171
171
  children: [
172
- /* @__PURE__ */ S("div", {
172
+ /* @__PURE__ */ x("div", {
173
173
  className: N,
174
174
  children: [
175
- /* @__PURE__ */ x("p", {
175
+ /* @__PURE__ */ b("p", {
176
176
  className: P,
177
177
  children: "What it watches"
178
178
  }),
179
- /* @__PURE__ */ S("label", {
179
+ /* @__PURE__ */ x("label", {
180
180
  className: "flex flex-col gap-1",
181
- children: [/* @__PURE__ */ x("span", {
181
+ children: [/* @__PURE__ */ b("span", {
182
182
  className: M,
183
183
  children: "Name"
184
- }), /* @__PURE__ */ x("input", {
184
+ }), /* @__PURE__ */ b("input", {
185
185
  type: "text",
186
186
  value: a.label,
187
187
  disabled: n,
@@ -197,28 +197,28 @@ function B({ monitor: e, disabled: n, onPatch: r }) {
197
197
  }
198
198
  })]
199
199
  }),
200
- /* @__PURE__ */ S("label", {
200
+ /* @__PURE__ */ x("label", {
201
201
  className: "flex items-center gap-2",
202
- children: [/* @__PURE__ */ x("input", {
202
+ children: [/* @__PURE__ */ b("input", {
203
203
  type: "checkbox",
204
204
  checked: e.enabled,
205
205
  disabled: n,
206
206
  onChange: (e) => l({ enabled: e.target.checked })
207
- }), /* @__PURE__ */ x("span", {
207
+ }), /* @__PURE__ */ b("span", {
208
208
  className: M,
209
209
  children: "Watching"
210
210
  })]
211
211
  }),
212
- /* @__PURE__ */ x("p", {
212
+ /* @__PURE__ */ b("p", {
213
213
  className: d,
214
214
  children: "Turned off, the scene keeps its region, its references and its flag — it simply stops checking. Nothing is lost by pausing one for a while."
215
215
  }),
216
- /* @__PURE__ */ S("label", {
216
+ /* @__PURE__ */ x("label", {
217
217
  className: "flex flex-col gap-1",
218
- children: [/* @__PURE__ */ x("span", {
218
+ children: [/* @__PURE__ */ b("span", {
219
219
  className: M,
220
220
  children: "When to look"
221
- }), /* @__PURE__ */ S("select", {
221
+ }), /* @__PURE__ */ x("select", {
222
222
  value: e.triggerMode,
223
223
  disabled: n,
224
224
  className: j,
@@ -227,31 +227,31 @@ function B({ monitor: e, disabled: n, onPatch: r }) {
227
227
  (t === "periodic" || t === "on-motion" || t === "both") && l({ triggerMode: t });
228
228
  },
229
229
  children: [
230
- /* @__PURE__ */ x("option", {
230
+ /* @__PURE__ */ b("option", {
231
231
  value: "both",
232
232
  children: "On the clock and after motion settles"
233
233
  }),
234
- /* @__PURE__ */ x("option", {
234
+ /* @__PURE__ */ b("option", {
235
235
  value: "periodic",
236
236
  children: "On the clock only"
237
237
  }),
238
- /* @__PURE__ */ x("option", {
238
+ /* @__PURE__ */ b("option", {
239
239
  value: "on-motion",
240
240
  children: "After motion settles only"
241
241
  })
242
242
  ]
243
243
  })]
244
244
  }),
245
- /* @__PURE__ */ x("p", {
245
+ /* @__PURE__ */ b("p", {
246
246
  className: d,
247
247
  children: L[e.triggerMode]
248
248
  }),
249
- /* @__PURE__ */ S("label", {
249
+ /* @__PURE__ */ x("label", {
250
250
  className: "flex flex-col gap-1",
251
- children: [/* @__PURE__ */ x("span", {
251
+ children: [/* @__PURE__ */ b("span", {
252
252
  className: M,
253
253
  children: "Check every (seconds)"
254
- }), /* @__PURE__ */ x("input", {
254
+ }), /* @__PURE__ */ b("input", {
255
255
  type: "number",
256
256
  min: F,
257
257
  max: I,
@@ -269,28 +269,28 @@ function B({ monitor: e, disabled: n, onPatch: r }) {
269
269
  }
270
270
  })]
271
271
  }),
272
- /* @__PURE__ */ x("p", {
272
+ /* @__PURE__ */ b("p", {
273
273
  className: d,
274
274
  children: "60 s suits “is the bin still out”. Every check costs one photograph and one encode, so going below about 30 s buys latency you almost never need and multiplies the cost by the number of scenes you own."
275
275
  })
276
276
  ]
277
277
  }),
278
- /* @__PURE__ */ S("div", {
278
+ /* @__PURE__ */ x("div", {
279
279
  className: N,
280
280
  children: [
281
- /* @__PURE__ */ x("p", {
281
+ /* @__PURE__ */ b("p", {
282
282
  className: P,
283
283
  children: "How sure it has to be"
284
284
  }),
285
- e.check.mode === "similarity" && /* @__PURE__ */ S(C, { children: [/* @__PURE__ */ S("label", {
285
+ e.check.mode === "similarity" && /* @__PURE__ */ x(S, { children: [/* @__PURE__ */ x("label", {
286
286
  className: "flex flex-col gap-1",
287
- children: [/* @__PURE__ */ S("span", {
287
+ children: [/* @__PURE__ */ x("span", {
288
288
  className: M,
289
- children: ["Match threshold — ", /* @__PURE__ */ x("span", {
289
+ children: ["Match threshold — ", /* @__PURE__ */ b("span", {
290
290
  className: "tabular-nums",
291
291
  children: a.threshold.toFixed(2)
292
292
  })]
293
- }), /* @__PURE__ */ x("input", {
293
+ }), /* @__PURE__ */ b("input", {
294
294
  type: "range",
295
295
  min: .3,
296
296
  max: .99,
@@ -309,16 +309,16 @@ function B({ monitor: e, disabled: n, onPatch: r }) {
309
309
  a.threshold === p ? c(!1) : l({ check: u({ threshold: a.threshold }) });
310
310
  }
311
311
  })]
312
- }), /* @__PURE__ */ x("p", {
312
+ }), /* @__PURE__ */ b("p", {
313
313
  className: "text-[10px] text-foreground-subtle",
314
314
  children: "How closely the region still has to resemble the photograph to count as unchanged. Higher means fussier: at 0.95 a passing cloud can read as a change; at 0.60 the bin can be taken and the scene will shrug. 0.80 is a sensible start — if it cries wolf, lower it; if it misses the thing you care about, raise it."
315
315
  })] }),
316
- /* @__PURE__ */ S("label", {
316
+ /* @__PURE__ */ x("label", {
317
317
  className: "flex flex-col gap-1",
318
- children: [/* @__PURE__ */ x("span", {
318
+ children: [/* @__PURE__ */ b("span", {
319
319
  className: M,
320
320
  children: "Agreeing checks before it changes its mind"
321
- }), /* @__PURE__ */ x("input", {
321
+ }), /* @__PURE__ */ b("input", {
322
322
  type: "number",
323
323
  min: 1,
324
324
  max: 10,
@@ -336,16 +336,16 @@ function B({ monitor: e, disabled: n, onPatch: r }) {
336
336
  }
337
337
  })]
338
338
  }),
339
- /* @__PURE__ */ x("p", {
339
+ /* @__PURE__ */ b("p", {
340
340
  className: d,
341
341
  children: "One bad photograph must never be able to flip a scene. 3 agreeing checks at 60 s is about four minutes of latency and is what makes the answer trustworthy — leaving a state costs exactly the same as entering one."
342
342
  }),
343
- /* @__PURE__ */ S("label", {
343
+ /* @__PURE__ */ x("label", {
344
344
  className: "flex flex-col gap-1",
345
- children: [/* @__PURE__ */ x("span", {
345
+ children: [/* @__PURE__ */ b("span", {
346
346
  className: M,
347
347
  children: "Quiet for (seconds) before a check counts"
348
- }), /* @__PURE__ */ x("input", {
348
+ }), /* @__PURE__ */ b("input", {
349
349
  type: "number",
350
350
  min: 0,
351
351
  max: 3600,
@@ -363,16 +363,16 @@ function B({ monitor: e, disabled: n, onPatch: r }) {
363
363
  }
364
364
  })]
365
365
  }),
366
- /* @__PURE__ */ x("p", {
366
+ /* @__PURE__ */ b("p", {
367
367
  className: d,
368
368
  children: "A check taken while something is moving is a photograph of the van parked in front of the bin, so it is discarded rather than merely delayed. 0 disables the gate."
369
369
  }),
370
- /* @__PURE__ */ S("label", {
370
+ /* @__PURE__ */ x("label", {
371
371
  className: "flex flex-col gap-1",
372
- children: [/* @__PURE__ */ x("span", {
372
+ children: [/* @__PURE__ */ b("span", {
373
373
  className: M,
374
374
  children: "Minimum gap between counted checks (seconds)"
375
- }), /* @__PURE__ */ x("input", {
375
+ }), /* @__PURE__ */ b("input", {
376
376
  type: "number",
377
377
  min: 0,
378
378
  max: 3600,
@@ -390,25 +390,25 @@ function B({ monitor: e, disabled: n, onPatch: r }) {
390
390
  }
391
391
  })]
392
392
  }),
393
- /* @__PURE__ */ x("p", {
393
+ /* @__PURE__ */ b("p", {
394
394
  className: d,
395
395
  children: "Spreads the agreeing checks over real time instead of letting three adjacent polls inside one long occlusion be mistaken for three independent opinions."
396
396
  })
397
397
  ]
398
398
  }),
399
- /* @__PURE__ */ S("div", {
399
+ /* @__PURE__ */ x("div", {
400
400
  className: N,
401
401
  children: [
402
- /* @__PURE__ */ x("p", {
402
+ /* @__PURE__ */ b("p", {
403
403
  className: P,
404
404
  children: "Lighting"
405
405
  }),
406
- /* @__PURE__ */ S("label", {
406
+ /* @__PURE__ */ x("label", {
407
407
  className: "flex flex-col gap-1",
408
- children: [/* @__PURE__ */ x("span", {
408
+ children: [/* @__PURE__ */ b("span", {
409
409
  className: M,
410
410
  children: "When a light has no reference of its own"
411
- }), /* @__PURE__ */ S("select", {
411
+ }), /* @__PURE__ */ x("select", {
412
412
  value: e.onUncoveredCondition,
413
413
  disabled: n,
414
414
  className: j,
@@ -416,34 +416,34 @@ function B({ monitor: e, disabled: n, onPatch: r }) {
416
416
  let t = e.target.value;
417
417
  (t === "skip" || t === "judge-anyway") && l({ onUncoveredCondition: t });
418
418
  },
419
- children: [/* @__PURE__ */ x("option", {
419
+ children: [/* @__PURE__ */ b("option", {
420
420
  value: "skip",
421
421
  children: "Skip the check (recommended)"
422
- }), /* @__PURE__ */ x("option", {
422
+ }), /* @__PURE__ */ b("option", {
423
423
  value: "judge-anyway",
424
424
  children: "Judge against the other light anyway"
425
425
  })]
426
426
  })]
427
427
  }),
428
- /* @__PURE__ */ x("p", {
428
+ /* @__PURE__ */ b("p", {
429
429
  className: d,
430
430
  children: R[e.onUncoveredCondition]
431
431
  })
432
432
  ]
433
433
  }),
434
- /* @__PURE__ */ S("div", {
434
+ /* @__PURE__ */ x("div", {
435
435
  className: N,
436
436
  children: [
437
- /* @__PURE__ */ x("p", {
437
+ /* @__PURE__ */ b("p", {
438
438
  className: P,
439
439
  children: "What you get told"
440
440
  }),
441
- /* @__PURE__ */ S("label", {
441
+ /* @__PURE__ */ x("label", {
442
442
  className: "flex flex-col gap-1",
443
- children: [/* @__PURE__ */ x("span", {
443
+ children: [/* @__PURE__ */ b("span", {
444
444
  className: M,
445
445
  children: "Notifications follow"
446
- }), /* @__PURE__ */ S("select", {
446
+ }), /* @__PURE__ */ x("select", {
447
447
  value: e.emit,
448
448
  disabled: n,
449
449
  className: j,
@@ -451,47 +451,47 @@ function B({ monitor: e, disabled: n, onPatch: r }) {
451
451
  let t = e.target.value;
452
452
  (t === "latched" || t === "live") && l({ emit: t });
453
453
  },
454
- children: [/* @__PURE__ */ x("option", {
454
+ children: [/* @__PURE__ */ b("option", {
455
455
  value: "latched",
456
456
  children: "The flag — told once, still visible at breakfast"
457
- }), /* @__PURE__ */ x("option", {
457
+ }), /* @__PURE__ */ b("option", {
458
458
  value: "live",
459
459
  children: "The live state — follows the region as it changes"
460
460
  })]
461
461
  })]
462
462
  }),
463
- /* @__PURE__ */ x("p", {
463
+ /* @__PURE__ */ b("p", {
464
464
  className: d,
465
465
  children: "“Is the bin gone” is a flag: you want to be told once and still see it later. “Is the gate open” is a live state."
466
466
  }),
467
- /* @__PURE__ */ S("label", {
467
+ /* @__PURE__ */ x("label", {
468
468
  className: "flex items-center gap-2",
469
- children: [/* @__PURE__ */ x("input", {
469
+ children: [/* @__PURE__ */ b("input", {
470
470
  type: "checkbox",
471
471
  checked: e.autoRestore,
472
472
  disabled: n,
473
473
  onChange: (e) => l({ autoRestore: e.target.checked })
474
- }), /* @__PURE__ */ x("span", {
474
+ }), /* @__PURE__ */ b("span", {
475
475
  className: M,
476
476
  children: "Clear the flag by itself when things look normal again"
477
477
  })]
478
478
  }),
479
- /* @__PURE__ */ x("p", {
479
+ /* @__PURE__ */ b("p", {
480
480
  className: d,
481
481
  children: "Off by default, so an alarm never silently clears itself. The “back to normal” moment is recorded either way, so an automation can still react to it."
482
482
  })
483
483
  ]
484
484
  }),
485
- /* @__PURE__ */ S("div", {
485
+ /* @__PURE__ */ x("div", {
486
486
  className: N,
487
487
  children: [
488
- /* @__PURE__ */ x("p", {
488
+ /* @__PURE__ */ b("p", {
489
489
  className: P,
490
490
  children: "AI double-check"
491
491
  }),
492
- /* @__PURE__ */ S("label", {
492
+ /* @__PURE__ */ x("label", {
493
493
  className: "flex items-center gap-2",
494
- children: [/* @__PURE__ */ x("input", {
494
+ children: [/* @__PURE__ */ b("input", {
495
495
  type: "checkbox",
496
496
  checked: f,
497
497
  disabled: n || a.confirmPrompt.trim().length === 0,
@@ -499,17 +499,17 @@ function B({ monitor: e, disabled: n, onPatch: r }) {
499
499
  ...H(a.confirmPrompt.trim()),
500
500
  enabled: !0
501
501
  } } : { confirm: null })
502
- }), /* @__PURE__ */ x("span", {
502
+ }), /* @__PURE__ */ b("span", {
503
503
  className: M,
504
504
  children: "Ask a vision model before changing the answer"
505
505
  })]
506
506
  }),
507
- /* @__PURE__ */ S("label", {
507
+ /* @__PURE__ */ x("label", {
508
508
  className: "flex flex-col gap-1",
509
- children: [/* @__PURE__ */ x("span", {
509
+ children: [/* @__PURE__ */ b("span", {
510
510
  className: M,
511
511
  children: "The question to ask"
512
- }), /* @__PURE__ */ x("input", {
512
+ }), /* @__PURE__ */ b("input", {
513
513
  type: "text",
514
514
  value: a.confirmPrompt,
515
515
  placeholder: "e.g. Is the wheelie bin still there?",
@@ -529,11 +529,11 @@ function B({ monitor: e, disabled: n, onPatch: r }) {
529
529
  }
530
530
  })]
531
531
  }),
532
- /* @__PURE__ */ S("p", {
532
+ /* @__PURE__ */ x("p", {
533
533
  className: d,
534
534
  children: [
535
535
  "The model is asked ",
536
- /* @__PURE__ */ x("strong", { children: "only" }),
536
+ /* @__PURE__ */ b("strong", { children: "only" }),
537
537
  " when the region has already changed enough to flip the answer — roughly twice a week for a bin, not once a minute. It reasons about the object rather than the pixels, so rain, shadows and a repositioned bin stop counting as the thing being taken. If it cannot be reached, the change is held rather than announced."
538
538
  ]
539
539
  })
@@ -561,9 +561,9 @@ var U = "rounded-md border border-border bg-surface px-2 py-1 text-[11px] font-m
561
561
  alarm: "border-danger/50 bg-danger/15 text-danger",
562
562
  ok: "border-success/50 bg-success/15 text-success",
563
563
  unknown: "border-border bg-surface text-foreground-subtle"
564
- }, q = .8, ie = 3;
565
- function J({ deviceId: a }) {
566
- let s = u(l().trpcClient, a), h = o(s?.state.sceneMonitor), w = v(a, { width: 640 }), [T, E] = t(null), [D, k] = t(!1), [A, j] = t(null), [M, N] = t(null), [P, F] = t(null), [I, L] = t(null), [R, z] = t(!1), [V, H] = t(null), [J, Y] = t(""), X = n(!0);
564
+ }, q = .8, J = 3;
565
+ function Y({ deviceId: a }) {
566
+ let s = u(l().trpcClient, a), p = o(s?.state.sceneMonitor), h = ne(a, { width: 640 }), [w, T] = t(null), [E, D] = t(!1), [k, A] = t(null), [j, M] = t(null), [N, P] = t(null), [F, I] = t(null), [L, R] = t(!1), [z, V] = t(null), [H, Y] = t(""), X = n(!0);
567
567
  i(() => (X.current = !0, () => {
568
568
  X.current = !1;
569
569
  }), []);
@@ -571,23 +571,23 @@ function J({ deviceId: a }) {
571
571
  if (s) try {
572
572
  let e = await s.sceneMonitor?.listScenes({});
573
573
  if (!X.current) return;
574
- e && E(e);
574
+ e && T(e);
575
575
  } catch (e) {
576
576
  if (!X.current) return;
577
- c(e) ? k(!0) : N(e instanceof Error ? e.message : String(e));
577
+ c(e) ? D(!0) : M(e instanceof Error ? e.message : String(e));
578
578
  }
579
579
  }, [s]);
580
580
  i(() => {
581
- E(null), k(!1), N(null), Z();
581
+ T(null), D(!1), M(null), Z();
582
582
  }, [Z]);
583
- let Q = h?.monitors ?? T?.monitors ?? [], ae = Date.now(), $ = e(async (e, t) => {
584
- j(e), N(null);
583
+ let Q = p?.monitors ?? w?.monitors ?? [], ae = Date.now(), $ = e(async (e, t) => {
584
+ A(e), M(null);
585
585
  try {
586
586
  await t(), await Z();
587
587
  } catch (e) {
588
- X.current && N(e instanceof Error ? e.message : String(e));
588
+ X.current && M(e instanceof Error ? e.message : String(e));
589
589
  } finally {
590
- X.current && j(null);
590
+ X.current && A(null);
591
591
  }
592
592
  }, [Z]), oe = r(() => {
593
593
  let e = Q.map((e) => ({
@@ -596,15 +596,15 @@ function J({ deviceId: a }) {
596
596
  label: e.label,
597
597
  enabled: e.enabled
598
598
  }));
599
- return V === null ? e : [...e, {
599
+ return z === null ? e : [...e, {
600
600
  id: "__draft__",
601
- shape: V,
601
+ shape: z,
602
602
  label: "New scene"
603
603
  }];
604
- }, [Q, V]), se = e((e, t) => {
604
+ }, [Q, z]), se = e((e, t) => {
605
605
  if (t.kind === "rect") {
606
606
  if (e === "__draft__") {
607
- H(t);
607
+ V(t);
608
608
  return;
609
609
  }
610
610
  $(`roi-${String(e)}`, async () => s?.sceneMonitor?.updateScene({
@@ -613,205 +613,205 @@ function J({ deviceId: a }) {
613
613
  }));
614
614
  }
615
615
  }, [s, $]), ce = e((e) => {
616
- e.kind === "rect" && H(e);
616
+ e.kind === "rect" && V(e);
617
617
  }, []), le = e(async () => {
618
- V === null || J.trim().length === 0 || (await $("create", async () => {
618
+ z === null || H.trim().length === 0 || (await $("create", async () => {
619
619
  await s?.sceneMonitor?.createScene({
620
- label: J.trim(),
621
- roi: V,
620
+ label: H.trim(),
621
+ roi: z,
622
622
  check: {
623
623
  mode: "similarity",
624
624
  threshold: q,
625
- hysteresisCount: ie
625
+ hysteresisCount: J
626
626
  }
627
627
  });
628
- }), H(null), Y(""), z(!1));
628
+ }), V(null), Y(""), R(!1));
629
629
  }, [
630
630
  s,
631
- V,
632
- J,
631
+ z,
632
+ H,
633
633
  $
634
634
  ]);
635
- return s ? /* @__PURE__ */ x("div", {
635
+ return s ? /* @__PURE__ */ b("div", {
636
636
  className: "flex flex-col gap-3",
637
- children: D ? /* @__PURE__ */ x("p", {
637
+ children: E ? /* @__PURE__ */ b("p", {
638
638
  className: `${d} leading-relaxed`,
639
639
  children: "Scene monitoring is not available for this camera."
640
- }) : /* @__PURE__ */ S(C, { children: [
641
- /* @__PURE__ */ x("p", {
640
+ }) : /* @__PURE__ */ x(S, { children: [
641
+ /* @__PURE__ */ b("p", {
642
642
  className: `${d} leading-relaxed`,
643
643
  children: "A scene watches one region of this camera and tells you when it stops looking like the picture you captured. Draw a box around the thing you care about — a wheelie bin, a gate, a parking space — then capture what “normal” looks like. Daylight is enough to start: the night reference is optional, and without it the scene simply sits the infrared hours out instead of reporting a problem."
644
644
  }),
645
- /* @__PURE__ */ x("div", {
645
+ /* @__PURE__ */ b("div", {
646
646
  className: "relative overflow-hidden rounded-md border border-border",
647
- children: /* @__PURE__ */ x(ne, {
647
+ children: /* @__PURE__ */ b(ie, {
648
648
  items: oe,
649
649
  supportedShapes: ["rect"],
650
- selectedId: P ?? (V === null ? null : "__draft__"),
651
- onSelect: (e) => F(e === null ? null : String(e)),
650
+ selectedId: N ?? (z === null ? null : "__draft__"),
651
+ onSelect: (e) => P(e === null ? null : String(e)),
652
652
  onShapeChange: se,
653
653
  onDrawComplete: ce,
654
- drawingKind: R && V === null ? "rect" : null,
655
- backdrop: w.src === null ? null : /* @__PURE__ */ x("img", {
656
- src: w.src,
654
+ drawingKind: L && z === null ? "rect" : null,
655
+ backdrop: h.src === null ? null : /* @__PURE__ */ b("img", {
656
+ src: h.src,
657
657
  alt: "",
658
658
  className: "h-full w-full object-contain",
659
659
  draggable: !1
660
660
  })
661
661
  })
662
662
  }),
663
- /* @__PURE__ */ S("div", {
663
+ /* @__PURE__ */ x("div", {
664
664
  className: "flex flex-wrap items-center gap-2",
665
- children: [/* @__PURE__ */ x("button", {
665
+ children: [/* @__PURE__ */ b("button", {
666
666
  type: "button",
667
- className: R ? W : U,
668
- "aria-pressed": R,
667
+ className: L ? W : U,
668
+ "aria-pressed": L,
669
669
  onClick: () => {
670
- z((e) => !e), H(null);
670
+ R((e) => !e), V(null);
671
671
  },
672
- disabled: A !== null,
673
- children: R ? "Cancel" : "+ New scene"
674
- }), /* @__PURE__ */ x("button", {
672
+ disabled: k !== null,
673
+ children: L ? "Cancel" : "+ New scene"
674
+ }), /* @__PURE__ */ b("button", {
675
675
  type: "button",
676
676
  className: U,
677
- onClick: w.refresh,
678
- disabled: A !== null,
677
+ onClick: h.refresh,
678
+ disabled: k !== null,
679
679
  children: "Refresh frame"
680
680
  })]
681
681
  }),
682
- R && /* @__PURE__ */ S("div", {
682
+ L && /* @__PURE__ */ x("div", {
683
683
  className: "flex flex-col gap-2 rounded-md border border-border bg-surface p-2",
684
684
  children: [
685
- /* @__PURE__ */ x("p", {
685
+ /* @__PURE__ */ b("p", {
686
686
  className: "text-[10px] text-foreground-subtle",
687
- children: V === null ? "Click on the frame to drop a box, then drag its corner to fit it around the thing you want watched." : "Name it, then create. You capture what “normal” looks like next."
687
+ children: z === null ? "Click on the frame to drop a box, then drag its corner to fit it around the thing you want watched." : "Name it, then create. You capture what “normal” looks like next."
688
688
  }),
689
- V !== null && f(V) && /* @__PURE__ */ x("p", {
689
+ z !== null && f(z) && /* @__PURE__ */ b("p", {
690
690
  className: "text-[11px] leading-relaxed text-warning",
691
691
  children: "That box covers most of the frame. A scene that big is dominated by the weather, the sky and passing cars — it will quietly stop noticing the thing you actually care about. Draw it tighter."
692
692
  }),
693
- /* @__PURE__ */ S("div", {
693
+ /* @__PURE__ */ x("div", {
694
694
  className: "flex items-center gap-2",
695
- children: [/* @__PURE__ */ x("input", {
695
+ children: [/* @__PURE__ */ b("input", {
696
696
  type: "text",
697
- value: J,
697
+ value: H,
698
698
  onChange: (e) => Y(e.target.value),
699
699
  placeholder: "e.g. Immondizia prelevata",
700
700
  className: "flex-1 rounded-md border border-border bg-surface px-2 py-1 text-[12px] text-foreground"
701
- }), /* @__PURE__ */ x("button", {
701
+ }), /* @__PURE__ */ b("button", {
702
702
  type: "button",
703
703
  className: W,
704
704
  onClick: () => void le(),
705
- disabled: V === null || J.trim().length === 0 || A !== null,
705
+ disabled: z === null || H.trim().length === 0 || k !== null,
706
706
  children: "Create"
707
707
  })]
708
708
  })
709
709
  ]
710
710
  }),
711
- M !== null && /* @__PURE__ */ x("p", {
711
+ j !== null && /* @__PURE__ */ b("p", {
712
712
  className: "text-[11px] leading-relaxed text-danger",
713
- children: M
713
+ children: j
714
714
  }),
715
- Q.length === 0 ? /* @__PURE__ */ x("p", {
715
+ Q.length === 0 ? /* @__PURE__ */ b("p", {
716
716
  className: `${d} leading-relaxed`,
717
717
  children: "No scenes on this camera yet."
718
- }) : /* @__PURE__ */ x("ul", {
718
+ }) : /* @__PURE__ */ b("ul", {
719
719
  className: "flex flex-col gap-2",
720
720
  children: Q.map((e) => {
721
- let t = g(e);
722
- return /* @__PURE__ */ S("li", {
723
- className: `flex flex-col gap-1.5 rounded-md border p-2 ${P === e.id ? "border-primary/50" : "border-border"}`,
721
+ let t = _(e);
722
+ return /* @__PURE__ */ x("li", {
723
+ className: `flex flex-col gap-1.5 rounded-md border p-2 ${N === e.id ? "border-primary/50" : "border-border"}`,
724
724
  children: [
725
- /* @__PURE__ */ S("div", {
725
+ /* @__PURE__ */ x("div", {
726
726
  className: "flex items-center gap-2",
727
- children: [/* @__PURE__ */ x("button", {
727
+ children: [/* @__PURE__ */ b("button", {
728
728
  type: "button",
729
729
  className: "flex-1 text-left text-[12px] font-medium text-foreground",
730
- onClick: () => F(e.id),
730
+ onClick: () => P(e.id),
731
731
  children: e.label
732
- }), /* @__PURE__ */ x("span", {
732
+ }), /* @__PURE__ */ b("span", {
733
733
  className: `rounded border px-1.5 py-0.5 text-[10px] font-medium ${K[t.tone]}`,
734
734
  children: t.text
735
735
  })]
736
736
  }),
737
- /* @__PURE__ */ x("p", {
737
+ /* @__PURE__ */ b("p", {
738
738
  className: `${d} leading-relaxed`,
739
739
  children: te(e, ae)
740
740
  }),
741
- /* @__PURE__ */ x("p", {
741
+ /* @__PURE__ */ b("p", {
742
742
  className: `${d} tabular-nums`,
743
743
  children: m(e)
744
744
  }),
745
- /* @__PURE__ */ x(O, {
745
+ /* @__PURE__ */ b(O, {
746
746
  monitor: e,
747
- disabled: A !== null,
747
+ disabled: k !== null,
748
748
  onDelete: ({ stateId: t, index: n }) => void $(`refdel-${e.id}-${t}-${String(n)}`, async () => s.sceneMonitor?.deleteReference({
749
749
  monitorId: e.id,
750
750
  stateId: t,
751
751
  index: n
752
752
  }))
753
753
  }),
754
- /* @__PURE__ */ S("div", {
754
+ /* @__PURE__ */ x("div", {
755
755
  className: "flex flex-wrap items-center gap-1.5",
756
756
  children: [
757
- ee.map((t) => {
757
+ g.map((t) => {
758
758
  let n = t === "ir";
759
- return /* @__PURE__ */ S("button", {
759
+ return /* @__PURE__ */ x("button", {
760
760
  type: "button",
761
761
  className: U,
762
- disabled: A !== null,
763
- title: n ? "Optional. Without a night reference the checks in infrared are simply skipped — the scene keeps working in daylight and nothing is reported as broken." : `Take a fresh photo now and store it as the ${_(t).toLowerCase()} reference`,
762
+ disabled: k !== null,
763
+ title: n ? "Optional. Without a night reference the checks in infrared are simply skipped — the scene keeps working in daylight and nothing is reported as broken." : `Take a fresh photo now and store it as the ${v(t).toLowerCase()} reference`,
764
764
  onClick: () => void $(`cap-${e.id}-${t}`, async () => s.sceneMonitor?.captureReference({
765
765
  monitorId: e.id,
766
766
  condition: t
767
767
  })),
768
768
  children: [
769
- /* @__PURE__ */ x(y, { className: "mr-1 inline h-3 w-3" }),
769
+ /* @__PURE__ */ b(ee, { className: "mr-1 inline h-3 w-3" }),
770
770
  "Capture ",
771
- _(t).toLowerCase(),
772
- n && /* @__PURE__ */ x("span", {
771
+ v(t).toLowerCase(),
772
+ n && /* @__PURE__ */ b("span", {
773
773
  className: "ml-1 text-foreground-subtle/70",
774
774
  children: "(optional)"
775
775
  })
776
776
  ]
777
777
  }, t);
778
778
  }),
779
- /* @__PURE__ */ S("button", {
779
+ /* @__PURE__ */ x("button", {
780
780
  type: "button",
781
781
  className: W,
782
- disabled: A !== null || e.states.length === 0,
782
+ disabled: k !== null || e.states.length === 0,
783
783
  title: "Clear the flag and re-photograph what normal looks like right now",
784
784
  onClick: () => void $(`reset-${e.id}`, async () => s.sceneMonitor?.resetScene({ monitorId: e.id })),
785
- children: [/* @__PURE__ */ x(p, { className: "mr-1 inline h-3 w-3" }), "Reset"]
785
+ children: [/* @__PURE__ */ b(re, { className: "mr-1 inline h-3 w-3" }), "Reset"]
786
786
  }),
787
- /* @__PURE__ */ x("button", {
787
+ /* @__PURE__ */ b("button", {
788
788
  type: "button",
789
789
  className: U,
790
- disabled: A !== null,
790
+ disabled: k !== null,
791
791
  onClick: () => void $(`check-${e.id}`, async () => s.sceneMonitor?.recheckNow({ monitorId: e.id })),
792
792
  children: "Check now"
793
793
  }),
794
- /* @__PURE__ */ S("button", {
794
+ /* @__PURE__ */ x("button", {
795
795
  type: "button",
796
- className: I === e.id ? W : U,
797
- "aria-pressed": I === e.id,
796
+ className: F === e.id ? W : U,
797
+ "aria-pressed": F === e.id,
798
798
  "aria-label": `Settings for ${e.label}`,
799
- disabled: A !== null,
800
- onClick: () => L((t) => t === e.id ? null : e.id),
801
- children: [/* @__PURE__ */ x(re, { className: "mr-1 inline h-3 w-3" }), "Settings"]
799
+ disabled: k !== null,
800
+ onClick: () => I((t) => t === e.id ? null : e.id),
801
+ children: [/* @__PURE__ */ b(C, { className: "mr-1 inline h-3 w-3" }), "Settings"]
802
802
  }),
803
- /* @__PURE__ */ x("button", {
803
+ /* @__PURE__ */ b("button", {
804
804
  type: "button",
805
805
  className: G,
806
- disabled: A !== null,
806
+ disabled: k !== null,
807
807
  onClick: () => void $(`del-${e.id}`, async () => s.sceneMonitor?.deleteScene({ monitorId: e.id })),
808
- children: /* @__PURE__ */ x(b, { className: "h-3 w-3" })
808
+ children: /* @__PURE__ */ b(y, { className: "h-3 w-3" })
809
809
  })
810
810
  ]
811
811
  }),
812
- I === e.id && /* @__PURE__ */ x(B, {
812
+ F === e.id && /* @__PURE__ */ b(B, {
813
813
  monitor: e,
814
- disabled: A !== null,
814
+ disabled: k !== null,
815
815
  onPatch: (t) => void $(`tune-${e.id}`, async () => s.sceneMonitor?.updateScene({
816
816
  monitorId: e.id,
817
817
  patch: t
@@ -825,4 +825,4 @@ function J({ deviceId: a }) {
825
825
  }) : null;
826
826
  }
827
827
  //#endregion
828
- export { J as SceneMonitorEditor };
828
+ export { Y as SceneMonitorEditor };