iobroker.agent-dvr 0.7.0 → 0.8.0

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/README.de.md CHANGED
@@ -16,6 +16,17 @@ Verbindet ioBroker mit [AgentDVR](https://www.ispyconnect.com): erkennt automati
16
16
  - ioBroker mit `iobroker.web` Adapter
17
17
  - **AgentDVR ≥ 7.8.0.0** — ältere Versionen haben eine Regression im `streamFile.cgi`-Endpunkt (fehlerhafte Chunked-Kodierung, falscher MIME-Typ), die die Wiedergabe von Aufzeichnungen im integrierten Dashboard verhindert. Der Entwickler hat bestätigt, dass der Fix in Version 7.8.0.0 enthalten ist.
18
18
 
19
+ ## Highlights
20
+
21
+ ### Web-Komponenten für AURA, vis-2 und devices
22
+ Aufnahmen-Galerie, Live-Kachel und Live-Übersicht gibt es auch als Web-Komponenten (`@iobroker/web-components`). AURA (ab 0.106.0, empfohlen ab 0.112.0), vis-2 (ab 2.20.7) und der Geräte-Adapter devices (ab 4.3.0) bieten sie in ihrer Widget-Auswahl an – ohne HTML-Bindung. Sie zeichnen direkt im Browser statt die HTML-Datenpunkte anzuzeigen, ein Aktualisieren schließt daher nie einen offenen Player.
23
+ - **Agent DVR Aufnahmen** – die Aufnahmen-Galerie einer Kamera, mit Suche und Tag-Filter, eingebautem Player oder externer Player-URL
24
+ - **Agent DVR Live-Kamera** – die Live-Kachel einer Kamera; das Vorschaubild erneuert sich im Browser, ein Klick öffnet den Livestream
25
+ - **Agent DVR Live-Übersicht** – die Live-Kacheln aller Kameras einer Instanz
26
+ - **Quelle**: entweder *Widget aus den Adapter-Einstellungen* (alle Einstellungen des Widget-Tabs der Instanz) oder *Eigene Einstellungen hier* – jede Widget-Einstellung der Instanz (Modus, Anzahl, Thumbnail-Größe, Tags, Sortierung, Suche, Standard-Tag, kompaktes Layout, Player, Seitenverhältnis, Aktualisierungsintervall, Farben, Eckenradius) pro Widget
27
+ - übernimmt auf Wunsch die Farben aus dem Theme der Visualisierung
28
+ - braucht keine Zugangsdaten: Bilder und Videos nutzen dieselben AgentDVR-Links wie die HTML-Widgets; die Daten kommen aus `widget_config` und `<cam>.widget_data`
29
+
19
30
  ## Funktionen
20
31
 
21
32
  - Automatische Erkennung aller AgentDVR-Kameras beim Start (Mikrofone ausgenommen)
@@ -385,6 +396,7 @@ Dieser Adapter speichert deine AgentDVR-Admin-Zugangsdaten und stellt `system.co
385
396
  | `<cam>.events.*` | verschieden | R | Metadaten der letzten Aufnahme — erfordert „Ereignis-Datenpunkte" |
386
397
  | `<cam>.widget_recordings` | string | R | HTML-Aufnahmegalerie — erfordert „Galerie-Widget" |
387
398
  | `<cam>.widget_live` | string | R | HTML-Live-Einzelkachel der Kamera — erfordert „Galerie-Widget"; Standbild wird bei jedem Adapter-Poll aktualisiert |
399
+ | `<cam>.widget_data` | string | R | Aufnahmen als JSON für die Web-Komponenten (die letzten 500) — erfordert „Galerie-Widget" oder „Ereignis-Datenpunkte" |
388
400
 
389
401
  ## Webhook
390
402
 
@@ -432,6 +444,7 @@ Dateien: `<namespace>/<cam>/grab1.jpg` … `grab3.jpg` (z. B. `agent-dvr.0/cam_8
432
444
  | Datenpunkt | Typ | R/W | Beschreibung |
433
445
  |-----------|-----|-----|-------------|
434
446
  | `widget_live_overview` | string | R | HTML-Kachelraster aller Kameras — Standbilder werden bei jedem Adapter-Poll aktualisiert |
447
+ | `widget_config` | string | R | Widget-Einstellungen, Kameras und Texte als JSON für die Web-Komponenten (immer geschrieben, ohne Zugangsdaten) |
435
448
 
436
449
  ## Bilder für VIS und Skripte
437
450
 
@@ -457,6 +470,8 @@ Die URLs aus `urls.*` und `events.last.*` zeigen direkt auf AgentDVR. Sie funkti
457
470
  | `<cam>.events.new` | neue Aufnahme gelistet | Vorschaubild der Aufnahme |
458
471
  | `<cam>.events.detected_<tag>` | KI-Tag einer neuen Aufnahme, z. B. `detected_people` — auch wenn AgentDVR den Tag erst später ergänzt | nur bei Personen benachrichtigen |
459
472
 
473
+ > **`events.webhook` nicht für das gespeicherte Alarmfoto verwenden.** Der Webhook-Puls kommt, *bevor* das neue Foto abgeholt und gespeichert ist. In diesem Moment zeigen `alertPhotos.grab1` / `uri1` / `url1` noch auf das Foto des **vorherigen** Alarms — ein Fernseher oder eine Telegram-Nachricht zeigt dann ein altes Bild (unter Umständen Stunden alt). Für alles, was `alertPhotos.*` nutzt, immer auf `alertPhotos.ts1` triggern. `events.webhook` ist nur für Skripte gedacht, die sich in diesem Moment selbst ein Bild holen (z. B. `urls.photo` oder einen eigenen Kamera-Snapshot).
474
+
460
475
  Als Bedingung **„größer als letzter“** (Blockly) bzw. `change: 'gt'` verwenden. Der Adapter schreibt seine Datenpunkte bei jedem Poll neu, „wurde aktualisiert“ löst deshalb bei jedem Poll aus. `status.alerted` ist meist zu kurz, um von einem Poll gesehen zu werden, und taugt nicht als Trigger.
461
476
 
462
477
  ### Telegram
@@ -486,7 +501,7 @@ Die Alarmfotos liefert die Web-Instanz aus — der fertige Link steht in `<cam>.
486
501
  http://<iobroker>:<webport>/agent-dvr.0/photos/<cam>/grab1.jpg
487
502
  ```
488
503
 
489
- z. B. `http://192.168.1.10:8082/agent-dvr.0/photos/cam_8_Reolink/grab1.jpg` (ebenso `grab2.jpg`, `grab3.jpg`). In einem Bild-Widget verwenden und bei Änderung von `alertPhotos.ts1` neu laden. Für ein Livebild `urls.snapshot` oder `urls.photo` mit Aktualisierungsintervall nehmen.
504
+ z. B. `http://192.168.1.10:8082/agent-dvr.0/photos/cam_8_Reolink/grab1.jpg` (ebenso `grab2.jpg`, `grab3.jpg`). In einem Bild-Widget verwenden und bei Änderung von `alertPhotos.ts1` neu laden. Das gilt auch, wenn der Link an einen Fernseher oder eine andere App geschickt wird: auf `alertPhotos.ts1` senden, nicht auf `events.webhook` — sonst lädt die App das vorherige Foto. Für ein Livebild `urls.snapshot` oder `urls.photo` mit Aktualisierungsintervall nehmen.
490
505
 
491
506
  ## Changelog
492
507
 
@@ -494,6 +509,9 @@ z. B. `http://192.168.1.10:8082/agent-dvr.0/photos/cam_8_Reolink/grab1.jpg` (ebe
494
509
  Placeholder for the next version (at the beginning of the line):
495
510
  ### **WORK IN PROGRESS**
496
511
  -->
512
+ ### 0.8.0 (2026-11-12)
513
+ * (ipod86) feat: Web-Komponenten für AURA (ab 0.106.0), vis-2 (ab 2.20.7) und devices (ab 4.3.0) – Aufnahmen-Galerie, Live-Kachel und Live-Übersicht, mit den Widget-Einstellungen des Adapters oder eigenen
514
+
497
515
  ### 0.7.0 (2026-10-29)
498
516
  * (ipod86) feat: `alertPhotos.url1–3` mit festem http(s)-Link zu jedem Foto, für TV-/Kiosk-Apps, die nur Web-Links annehmen; Web-Instanz wählbar, Links folgen Änderungen an den Web-Instanzen
499
517
  * (ipod86) feat: `<cam>.events.webhookParams` mit allen Parametern des letzten Webhook-Aufrufs als JSON
package/README.md CHANGED
@@ -21,6 +21,17 @@ Connects ioBroker to [AgentDVR](https://www.ispyconnect.com): auto-discovers all
21
21
  - ioBroker with `iobroker.web` adapter
22
22
  - **AgentDVR ≥ 7.8.0.0** — earlier versions have a regression in the `streamFile.cgi` endpoint (malformed chunked encoding, wrong MIME type) that prevents recording playback in the built-in dashboard. The developer has confirmed the fix is included in 7.8.0.0.
23
23
 
24
+ ## Highlights
25
+
26
+ ### Web components for AURA, vis-2 and devices
27
+ The recordings gallery, the live tile and the live overview are also available as web components (`@iobroker/web-components`). AURA (0.106.0+, 0.112.0+ recommended), vis-2 (2.20.7+) and the devices adapter (4.3.0+) list them in their widget palette — no HTML binding needed. They draw natively in the browser instead of showing the HTML data points, so a refresh never closes an open player.
28
+ - **Agent DVR recordings** — the recordings gallery of a camera, with search and tag filter, built-in player or external player URL
29
+ - **Agent DVR live camera** — the live tile of one camera; the snapshot refreshes in the browser, a click opens the live stream
30
+ - **Agent DVR live overview** — the live tiles of all cameras of an instance
31
+ - **Source**: either *Widget from the adapter settings* (all settings of the Widget tab of the instance) or *Own settings here* — every widget setting of the instance (mode, count, thumbnail size, tags, sort, search, default tag, compact layout, player, aspect ratio, refresh interval, colors, border radius) per widget
32
+ - optionally takes the colors of the visualization's theme
33
+ - needs no credentials: the images and videos use the same AgentDVR links as the HTML widgets; data comes from `widget_config` and `<cam>.widget_data`
34
+
24
35
  ## Features
25
36
 
26
37
  - Auto-discovery of all AgentDVR cameras on startup (microphones excluded)
@@ -390,6 +401,7 @@ This adapter stores your AgentDVR admin credentials and exposes `system.control.
390
401
  | `<cam>.events.*` | various | R | Latest recording metadata — requires "Event data points" |
391
402
  | `<cam>.widget_recordings` | string | R | HTML recording gallery — requires "Gallery widget" |
392
403
  | `<cam>.widget_live` | string | R | HTML single-camera live tile — requires "Gallery widget"; snapshot refreshes on each adapter poll |
404
+ | `<cam>.widget_data` | string | R | Recordings as JSON for the web components (latest 500) — requires "Gallery widget" or "Event data points" |
393
405
 
394
406
  ## Webhook
395
407
 
@@ -437,6 +449,7 @@ Files: `<namespace>/<cam>/grab1.jpg` … `grab3.jpg` (e.g. `agent-dvr.0/cam_8_Re
437
449
  | Data point | Type | R/W | Description |
438
450
  |-----------|------|-----|-------------|
439
451
  | `widget_live_overview` | string | R | HTML tile grid of all cameras — snapshot refreshes on each adapter poll |
452
+ | `widget_config` | string | R | Widget settings, cameras and texts as JSON for the web components (always written, no credentials) |
440
453
 
441
454
  ## Getting images for VIS and scripts
442
455
 
@@ -462,6 +475,8 @@ The `urls.*` and `events.last.*` URLs point directly to AgentDVR. They work in t
462
475
  | `<cam>.events.new` | new recording listed | thumbnail of the recording |
463
476
  | `<cam>.events.detected_<tag>` | AI tag of a new recording, e.g. `detected_people` — also when AgentDVR adds the tag later | notify on persons only |
464
477
 
478
+ > **Do not use `events.webhook` for the stored alert photo.** The webhook pulse comes *before* the new photo is fetched and saved. At that moment `alertPhotos.grab1` / `uri1` / `url1` still point to the photo of the **previous** alert — a TV or Telegram message then shows an old image (possibly hours old). For anything that uses `alertPhotos.*` always trigger on `alertPhotos.ts1`. `events.webhook` is only meant for scripts that fetch an image themselves at that moment (e.g. `urls.photo` or their own camera snapshot).
479
+
465
480
  Use **"greater than previous"** (Blockly) or `change: 'gt'` as condition. The adapter rewrites its states on every poll, so "was updated" fires every poll. `status.alerted` is usually too short to be seen by a poll and is not a reliable trigger.
466
481
 
467
482
  ### Telegram
@@ -491,14 +506,18 @@ The alert photos are served by the web instance — the ready-made link is in `<
491
506
  http://<iobroker>:<webport>/agent-dvr.0/photos/<cam>/grab1.jpg
492
507
  ```
493
508
 
494
- e.g. `http://192.168.1.10:8082/agent-dvr.0/photos/cam_8_Reolink/grab1.jpg` (also `grab2.jpg`, `grab3.jpg`). Use it in an image widget and refresh it on changes of `alertPhotos.ts1`. For a live image use `urls.snapshot` or `urls.photo` with a refresh interval.
509
+ e.g. `http://192.168.1.10:8082/agent-dvr.0/photos/cam_8_Reolink/grab1.jpg` (also `grab2.jpg`, `grab3.jpg`). Use it in an image widget and refresh it on changes of `alertPhotos.ts1`. The same applies when you push the link to a TV or another app: send it on `alertPhotos.ts1`, not on `events.webhook` — otherwise the app loads the previous photo. For a live image use `urls.snapshot` or `urls.photo` with a refresh interval.
495
510
 
496
511
  ## Changelog
512
+ ### 0.8.0 (2026-11-12)
513
+ * (ipod86) feat: web components for AURA (0.106.0+), vis-2 (2.20.7+) and devices (4.3.0+) – recordings gallery, live tile and live overview, with the adapter's widget settings or own ones
514
+
497
515
  ### 0.7.0 (2026-10-29)
498
516
  * (ipod86) feat: `alertPhotos.url1–3` with a fixed http(s) link to each photo, for TV/kiosk apps that only accept web links; web instance selectable, links follow changes of the web instances
499
517
  * (ipod86) feat: `<cam>.events.webhookParams` with all parameters of the latest webhook call as JSON
500
518
 
501
519
  <!-- markdownlint-disable-next-line MD024 -->
520
+
502
521
  ### 0.6.0 (2026-10-29)
503
522
  * (ipod86) chore: clearer adapter title ("Agent DVR – Cameras & Recordings") and keywords
504
523
  * (ipod86) fix: `events.detected_*` now also fires when AgentDVR adds the AI tag (e.g. `people`) to a recording after it was first listed
@@ -508,6 +527,7 @@ e.g. `http://192.168.1.10:8082/agent-dvr.0/photos/cam_8_Reolink/grab1.jpg` (also
508
527
  * (ipod86) feat: `alertPhotos.uri1–3` with the `iobfile://` URI of each photo, sendable directly with Telegram 6
509
528
 
510
529
  <!-- markdownlint-disable-next-line MD024 -->
530
+
511
531
  ### 0.5.5 (2026-10-08)
512
532
  * (ipod86) fix: live preview video no longer gets stretched/distorted — AgentDVR's live stream squishes the full picture into a fixed container format regardless of the camera's actual aspect ratio; now corrected (`object-fit:fill`) instead of shown distorted
513
533
  * (ipod86) feat: configurable live-tile refresh interval (`widgetLiveRefreshSec`) — trade thumbnail freshness against keeping an open video modal open, since rewriting the widget's HTML state resets it
@@ -524,9 +544,6 @@ e.g. `http://192.168.1.10:8082/agent-dvr.0/photos/cam_8_Reolink/grab1.jpg` (also
524
544
 
525
545
  <!-- markdownlint-disable-next-line MD024 -->
526
546
 
527
- ### 0.5.3 (2026-10-04)
528
- * (ipod86) fix: clear ensuredFolders cache on object deletion to prevent stale "no existing object" warnings for rediscovered drives/cameras
529
-
530
547
  [Older changelog entries in CHANGELOG_OLD.md](CHANGELOG_OLD.md)
531
548
 
532
549
  ## License
@@ -0,0 +1,36 @@
1
+ var De=Object.defineProperty;var he=t=>{throw TypeError(t)};var Be=(t,n,e)=>n in t?De(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e;var te=(t,n,e)=>Be(t,typeof n!="symbol"?n+"":n,e),ne=(t,n,e)=>n.has(t)||he("Cannot "+e);var a=(t,n,e)=>(ne(t,n,"read from private field"),e?e.call(t):n.get(t)),x=(t,n,e)=>n.has(t)?he("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(t):n.set(t,e),y=(t,n,e,i)=>(ne(t,n,"write to private field"),i?i.call(t,e):n.set(t,e),e),p=(t,n,e)=>(ne(t,n,"access private method"),e);var me="iob-dialog-close";var ge="iob-change";function K(t){return!!t.form}var be=["header","staticText","divider"];function v(t,n){return t==null?"":typeof t=="object"?t[n]||t.en||Object.values(t).find(e=>!!e)||"":String(t)}function X(t){let n={};for(let[e,i]of Object.entries(t.items||{}))i&&!be.includes(i.type)&&(n[e]=i.type);return n}function xe(t){return typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"?t.toString():JSON.stringify(t)}function Pe(t,n){if(n!=null)switch(t){case"number":case"slider":{if(typeof n=="number")return Number.isFinite(n)?n:void 0;let e=xe(n).trim().replace(",",".");if(!e)return;let i=Number(e);return Number.isFinite(i)?i:void 0}case"checkbox":return n===!0||n==="true"||n===1||n==="1";default:return xe(n)}}function J(t,n){let e={};for(let[i,r]of Object.entries(t)){let o=Pe(r,n[i]);o!==void 0&&(e[i]=o)}return e}var we='"Roboto", "Helvetica", "Arial", sans-serif',Ve=Object.freeze({type:"light",primary:"#3399CC",primaryContrast:"#FFFFFF",secondary:"#164477",secondaryContrast:"#FFFFFF",background:"#FFFFFF",paper:"#FFFFFF",text:"rgba(0, 0, 0, 0.87)",textSecondary:"rgba(0, 0, 0, 0.6)",divider:"rgba(0, 0, 0, 0.12)",error:"#D32F2F",warning:"#ED6C02",info:"#0288D1",success:"#2E7D32",fontFamily:we,fontSize:14,borderRadius:4}),He=Object.freeze({type:"dark",primary:"#4DABF5",primaryContrast:"rgba(0, 0, 0, 0.87)",secondary:"#436A93",secondaryContrast:"#FFFFFF",background:"#121212",paper:"#121212",text:"#FFFFFF",textSecondary:"rgba(255, 255, 255, 0.7)",divider:"rgba(255, 255, 255, 0.12)",error:"#F44336",warning:"#FFA726",info:"#29B6F6",success:"#66BB6A",fontFamily:we,fontSize:14,borderRadius:4}),ie=["primary","primaryContrast","secondary","secondaryContrast","background","paper","text","textSecondary","divider","error","warning","info","success","fontFamily"],re=["fontSize","borderRadius"];function ye(t){return{...t==="dark"?He:Ve}}function D(t){if(!t||typeof t!="object")return ye(typeof t=="string"?t:"light");let n=t,e=ye(typeof n.type=="string"?n.type:"light");for(let i of ie){let r=n[i];typeof r=="string"&&r.trim()&&(e[i]=r.trim())}for(let i of re){let r=n[i],o=typeof r=="string"?parseFloat(r):r;typeof o=="number"&&Number.isFinite(o)&&o>=0&&(e[i]=o)}return e}function Se(t,n){return t.type===n.type&&ie.every(e=>t[e]===n[e])&&re.every(e=>t[e]===n[e])}function ve(t){return`--iob-${t.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`)}`}function Y(t){let n={};for(let e of ie)n[ve(e)]=t[e];for(let e of re)n[ve(e)]=`${t[e]}px`;return n["color-scheme"]=t.type,n}var Ee={ok:{en:"OK","zh-cn":"\u786E\u5B9A"},cancel:{en:"Cancel",de:"Abbrechen",ru:"\u041E\u0442\u043C\u0435\u043D\u0430",pt:"Cancelar",nl:"Annuleren",fr:"Annuler",it:"Annulla",es:"Cancelar",pl:"Anuluj",uk:"\u0421\u043A\u0430\u0441\u0443\u0432\u0430\u0442\u0438","zh-cn":"\u53D6\u6D88"},close:{en:"Close",de:"Schlie\xDFen",ru:"\u0417\u0430\u043A\u0440\u044B\u0442\u044C",pt:"Fechar",nl:"Sluiten",fr:"Fermer",it:"Chiudi",es:"Cerrar",pl:"Zamknij",uk:"\u0417\u0430\u043A\u0440\u0438\u0442\u0438","zh-cn":"\u5173\u95ED"}},We=`
2
+ dialog {
3
+ box-sizing: border-box;
4
+ width: 480px;
5
+ max-width: calc(100vw - 32px);
6
+ max-height: calc(100vh - 32px);
7
+ padding: 0;
8
+ border: 0;
9
+ border-radius: calc(var(--iob-border-radius) * 2);
10
+ background: var(--iob-paper);
11
+ color: var(--iob-text);
12
+ font-family: var(--iob-font-family);
13
+ font-size: var(--iob-font-size);
14
+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
15
+ }
16
+ /* as the dialogs of MUI: a dark paper gets lighter the higher it lies */
17
+ dialog.dark { background-image: linear-gradient(rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.16)); }
18
+ dialog::backdrop { background: rgba(0, 0, 0, 0.5); }
19
+ dialog:focus { outline: none; }
20
+ form { display: flex; flex-direction: column; height: 100%; max-height: inherit; margin: 0; }
21
+ header { display: flex; align-items: center; gap: 8px; padding: 12px 8px 12px 16px; font-size: 1.15em; font-weight: 500; }
22
+ header span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
23
+ .body { flex: 1; min-height: 0; padding: 0 16px 16px; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
24
+ footer { display: flex; justify-content: flex-end; gap: 8px; padding: 0 16px 16px; }
25
+ button { font: inherit; padding: 6px 16px; border-radius: var(--iob-border-radius); border: 1px solid var(--iob-primary); background: transparent; color: var(--iob-primary); cursor: pointer; }
26
+ button.primary { background: var(--iob-primary); color: var(--iob-primary-contrast); }
27
+ button.close { border: 0; padding: 2px 8px; font-size: 1.4em; line-height: 1; color: var(--iob-text-secondary); }
28
+ label { display: flex; flex-direction: column; gap: 4px; }
29
+ label.check { flex-direction: row; align-items: center; gap: 8px; }
30
+ input, select, textarea { font: inherit; accent-color: var(--iob-primary); }
31
+ .help { color: var(--iob-text-secondary); font-size: 0.85em; }
32
+ h3 { margin: 4px 0 0; font-size: 1em; }
33
+ p { margin: 0; }
34
+ hr { width: 100%; border: 0; border-top: 1px solid var(--iob-divider); margin: 0; }
35
+ [hidden] { display: none !important; }
36
+ `;function ke(t){if(!t)return null;try{let n=new Function("data",`return (${t});`);return e=>{try{return!!n(e)}catch{return!1}}}catch{return null}}function oe(t){return typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"?String(t):""}function Ge(t){let{input:n,setting:e}=t;if(n)return n instanceof HTMLInputElement&&n.type==="checkbox"?n.checked:n instanceof HTMLSelectElement?e.options?.[n.selectedIndex]?.value:n.value}function Ue(t,n,e,i,r){let o={name:n,setting:e,box:t.createElement("div"),hidden:ke(e.hidden),disabled:ke(e.disabled)},m=v(e.label,r);switch(e.type){case"header":return o.box=t.createElement("h3"),o.box.textContent=v(e.text,r)||m,o;case"staticText":return o.box=t.createElement("p"),o.box.textContent=v(e.text,r)||m,o;case"divider":return o.box=t.createElement("hr"),o;default:break}let u=t.createElement("label");o.box=u;let l=t.createElement("span");if(l.textContent=m||n,e.type==="checkbox"){let s=t.createElement("input");s.type="checkbox",s.checked=i===!0||i==="true",u.className="check",u.append(s,l),o.input=s}else if(e.type==="select"){let s=t.createElement("select");for(let d of e.options||[]){let h=t.createElement("option");h.textContent=v(d.label,r),s.append(h)}let f=(e.options||[]).findIndex(d=>String(d.value)===oe(i));s.selectedIndex=f===-1?0:f,u.append(l,s),o.input=s}else if(e.type==="text"&&(e.minRows||1)>1){let s=t.createElement("textarea");s.rows=e.minRows||2,s.value=oe(i),u.append(l,s),o.input=s}else{let s=t.createElement("input"),f=oe(i);switch(e.type){case"number":case"slider":s.type=e.type==="slider"?"range":"number",e.min!==void 0&&(s.min=String(e.min)),e.max!==void 0&&(s.max=String(e.max)),s.step=e.step!==void 0?String(e.step):"any";break;case"password":s.type="password";break;case"color":s.type=!f||/^#[0-9a-f]{6}$/i.test(f)?"color":"text";break;default:s.type="text";break}if(s.value=f,s.type==="range"){let d=t.createElement("output");d.textContent=s.value,s.addEventListener("input",()=>d.textContent=s.value),l.append(": ",d)}u.append(l,s),o.input=s}if(e.help){let s=t.createElement("span");s.className="help",s.textContent=v(e.help,r),u.append(s)}return o}function Ce(t,n={}){let e=n.lang||"en",i=document,r=$=>Ee[$][e]||Ee[$].en||$,o=i.createElement("div");o.setAttribute("data-iob-dialog","");let m=o.attachShadow({mode:"open"}),u=i.createElement("style");u.textContent=We;let l=i.createElement("dialog"),s=D(n.theme);l.className=s.type==="dark"?"dark":"";for(let[$,H]of Object.entries(Y(s)))l.style.setProperty($,H);t.width&&(l.style.width=`${t.width}px`),t.height&&(l.style.height=`${t.height}px`);let f=i.createElement("form"),d=i.createElement("header"),h=i.createElement("span");h.textContent=v(t.title,e);let C=i.createElement("button");C.type="button",C.className="close",C.title=r("close"),C.setAttribute("aria-label",r("close")),C.textContent="\xD7",d.append(h,C);let V=i.createElement("div");return V.className="body",f.append(d,V),l.append(f),m.append(u,l),new Promise($=>{let H=!1,M=T=>{H||(H=!0,l.open&&l.close(),o.remove(),$(T))};if(C.addEventListener("click",()=>M(null)),l.addEventListener("close",()=>M(null)),f.addEventListener("submit",T=>T.preventDefault()),K(t)){let T={},W=[];for(let[b,w]of Object.entries(t.form.items||{})){let Me=t.data?.[b]??w.default,fe=Ue(i,b,w,Me,e);W.push(fe),V.append(fe.box)}let de=()=>{for(let b of W)b.input&&(T[b.name]=Ge(b));return T},ee=()=>{let b=de();for(let w of W)w.box.hidden=w.hidden?w.hidden(b):!1,w.input&&(w.input.disabled=w.disabled?w.disabled(b):!1)};f.addEventListener("input",ee),f.addEventListener("change",ee),ee();let pe=W.find(b=>b.input&&!b.box.hidden&&!b.input.disabled);pe?.input&&(pe.input.autofocus=!0);let ue=i.createElement("footer"),G=i.createElement("button");G.type="button",G.textContent=v(t.cancel,e)||r("cancel"),G.addEventListener("click",()=>M(null));let U=i.createElement("button");U.type="submit",U.className="primary",U.textContent=v(t.ok,e)||r("ok"),ue.append(G,U),f.append(ue),f.addEventListener("submit",()=>M(J(X(t.form),de())))}else V.append(t.element),l.addEventListener(me,T=>M(T.detail??null));i.body.append(o),l.showModal(),(!m.activeElement||m.activeElement===C)&&(l.tabIndex=-1,l.focus())})}function Te(t){return[...new Set(t.filter(n=>typeof n=="string"&&!!n))]}var Ke=["socket","dialogs","theme","editMode","settings","value"],S,A,j,E,L,N,g,R,I,P,c,se,z,B,Fe,je,ae,ce,F,Z=class extends HTMLElement{constructor(){super(...arguments);x(this,c);te(this,"states",{});te(this,"objects",{});x(this,S,null);x(this,A,{});x(this,j,D("light"));x(this,E,!1);x(this,L,null);x(this,N);x(this,g,null);x(this,R,!1);x(this,I,(e,i)=>{a(this,g)?.states.includes(e)&&(this.states[e]=i||null,p(this,c,F).call(this))});x(this,P,(e,i)=>{a(this,g)?.objects.includes(e)&&(this.objects[e]=i||null,p(this,c,z).call(this))})}get socket(){return a(this,S)}set socket(e){y(this,S,e||null),p(this,c,z).call(this)}get settings(){return a(this,A)}set settings(e){y(this,A,e||{}),p(this,c,z).call(this)}get theme(){return a(this,j)}set theme(e){let i=D(e);Se(i,a(this,j))||(y(this,j,i),p(this,c,se).call(this),p(this,c,F).call(this))}get editMode(){return a(this,E)}set editMode(e){let i=!!e;i!==a(this,E)&&(y(this,E,i),p(this,c,F).call(this))}get dialogs(){return a(this,L)}set dialogs(e){y(this,L,e||null)}get value(){return a(this,N)}set value(e){e!==a(this,N)&&(y(this,N,e),p(this,c,F).call(this))}connectedCallback(){for(let e of Ke)if(Object.prototype.hasOwnProperty.call(this,e)){let i=this[e];delete this[e],this[e]=i}p(this,c,se).call(this),p(this,c,z).call(this)}disconnectedCallback(){p(this,c,ce).call(this)}getStateIds(e){return[]}getObjectIds(e){return[]}get systemLang(){return a(this,S)?.systemLang||"en"}text(e){return v(e,this.systemLang)}setState(e,i){return a(this,S)&&!a(this,E)?a(this,S).setState(e,i):Promise.resolve()}changeValue(e){return a(this,E)||this.emit(ge,e)?!1:(this.value=e,!0)}emit(e,i){return this.dispatchEvent(new CustomEvent(e,{detail:i,bubbles:!0,composed:!0,cancelable:!0}))}async openDialog(e){if(a(this,E))return null;let i=a(this,L)?await a(this,L).open(e):await Ce(e,{lang:this.systemLang,theme:a(this,j)});return K(e)?i&&typeof i=="object"?J(X(e.form),i):null:i??null}};S=new WeakMap,A=new WeakMap,j=new WeakMap,E=new WeakMap,L=new WeakMap,N=new WeakMap,g=new WeakMap,R=new WeakMap,I=new WeakMap,P=new WeakMap,c=new WeakSet,se=function(){for(let[e,i]of Object.entries(Y(a(this,j))))this.style.setProperty(e,i)},z=function(){if(!this.isConnected)return;let e=a(this,S),i=e?Te(this.getStateIds(a(this,A))):[],r=e?Te(this.getObjectIds(a(this,A))):[];a(this,g)&&a(this,g).socket!==e&&p(this,c,ce).call(this);let o=a(this,g)?.states||[],m=a(this,g)?.objects||[],u=o.filter(d=>!i.includes(d)),l=m.filter(d=>!r.includes(d)),s=i.filter(d=>!o.includes(d)),f=r.filter(d=>!m.includes(d));e&&u.length&&e.unsubscribeState(u,a(this,I)),e&&l.length&&p(this,c,ae).call(this,e,l);for(let d of u)delete this.states[d];for(let d of[...u,...l])!i.includes(d)&&!r.includes(d)&&delete this.objects[d];y(this,g,e&&(i.length||r.length)?{socket:e,states:i,objects:r}:null),e&&s.length&&p(this,c,Fe).call(this,e,s),e&&f.length&&p(this,c,je).call(this,e,f),p(this,c,F).call(this)},B=function(e,i,r){return a(this,g)?.socket===e&&a(this,g)[i].includes(r)},Fe=function(e,i){e.subscribeState(i,a(this,I)).catch(r=>console.warn(`<${this.localName}>: cannot subscribe ${i.join(", ")}: ${r}`));for(let r of i)e.getState(r).then(o=>{p(this,c,B).call(this,e,"states",r)&&this.states[r]===void 0&&(this.states[r]=o||null,p(this,c,F).call(this))}).catch(()=>{}),e.getObject(r).then(o=>{p(this,c,B).call(this,e,"states",r)&&!p(this,c,B).call(this,e,"objects",r)&&(this.objects[r]=o||null,p(this,c,F).call(this))}).catch(()=>{})},je=function(e,i){e.subscribeObject(i,a(this,P)).catch(r=>console.warn(`<${this.localName}>: cannot subscribe the objects ${i.join(", ")}: ${r}`));for(let r of i)e.getObject(r).then(o=>{p(this,c,B).call(this,e,"objects",r)&&(this.objects[r]=o||null,p(this,c,z).call(this))}).catch(()=>{})},ae=function(e,i){e.unsubscribeObject(i,a(this,P)).catch(()=>{})},ce=function(){if(a(this,g)){let{socket:e,states:i,objects:r}=a(this,g);i.length&&e.unsubscribeState(i,a(this,I)),r.length&&p(this,c,ae).call(this,e,r),y(this,g,null)}this.states={},this.objects={}},F=function(){a(this,R)||(y(this,R,!0),queueMicrotask(()=>{y(this,R,!1),this.isConnected&&this.render()}))};function _e(t,n){let e=typeof t=="string"?t:t.tag;customElements.get(e)||customElements.define(e,n)}var O={widgetMode:"nojs",count:50,thumbSize:"medium",minCol:150,maxModalWidth:900,showTags:!0,tagPosition:"bottom-left",sortNewest:!0,showSearch:!0,defaultTag:"",compact:!1,playerUrl:"",liveAspect:"",liveRefreshSec:0,colorCardBg:"rgba(127,127,127,0.15)",colorTagBg:"rgba(0,0,0,0.55)",colorTagText:"#ffffff",colorAccent:"#8ab4f8",colorModalBg:"#1c1c1e",borderRadius:8},Xe={small:120,medium:180,large:240},_={pickWidget:{en:"Please choose a widget in the settings.",de:"Bitte in den Einstellungen ein Widget ausw\xE4hlen."},pickCamera:{en:"Please choose a camera in the settings.",de:"Bitte in den Einstellungen eine Kamera ausw\xE4hlen."},pickInstance:{en:"Please choose an agent-dvr instance in the settings.",de:"Bitte in den Einstellungen eine agent-dvr-Instanz ausw\xE4hlen."},waiting:{en:"Waiting for data of the adapter \u2026",de:"Warte auf Daten des Adapters \u2026"},noCamera:{en:"Camera not found",de:"Kamera nicht gefunden"},noCameras:{en:"No cameras",de:"Keine Kameras"}},$e={en:{noRecordings:"No recordings",search:"Search \u2026",all:"All",download:"Download",live:"LIVE"},de:{noRecordings:"Keine Aufnahmen",search:"Suche \u2026",all:"Alle",download:"Herunterladen",live:"LIVE"}};function k(t){return String(t??"").replace(/[&<>"]/g,n=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[n])}function Ae(t){let n=String(t||"").replace(/^system\.adapter\./,"").split(".");return{instance:n.length>=2?`${n[0]}.${n[1]}`:"",camera:n.length>=3&&/^cam_/.test(n[2])?n[2]:""}}function Le(t){let n=t&&t.val;if(typeof n!="string"||!n)return null;try{return JSON.parse(n)}catch{return null}}function Oe(t,n){if(t.mode==="custom"){let e={...O};for(let[i,r]of Object.entries(t))r!=null&&(e[i]=r);return e.minCol=Xe[e.thumbSize]||Number(e.minCol)||150,e}return!n||!n.settings?null:{...O,...n.settings}}function ze(t,n){return{...$e[n]||$e.en,...t&&t.labels||{}}}function Ne(t,n,e){let i=t.compact?6:12,r=`${Math.max(0,Number(t.borderRadius)||0)}px`,o=n?{card:"color-mix(in srgb, var(--iob-text, currentColor) 10%, transparent)",tagBg:"var(--iob-primary)",tagText:"var(--iob-primary-contrast)",accent:"var(--iob-primary)",modal:"var(--iob-paper)",info:"var(--iob-text)"}:{card:t.colorCardBg||O.colorCardBg,tagBg:t.colorTagBg||O.colorTagBg,tagText:t.colorTagText||O.colorTagText,accent:t.colorAccent||O.colorAccent,modal:t.colorModalBg||O.colorModalBg,info:"#fff"};return`:host{display:block;width:100%;height:100%;overflow:hidden;color:inherit;font:inherit}.root{--adv-card-bg:${o.card};--adv-tag-bg:${o.tagBg};--adv-tag-color:${o.tagText};--adv-accent:${o.accent};--adv-radius:${r};width:100%;height:100%;box-sizing:border-box;overflow:auto;${e?"pointer-events:none;":""}}.bar{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin-bottom:10px}.search{flex:1 1 160px;min-width:120px;padding:6px 10px;border-radius:8px;border:1px solid rgba(127,127,127,.4);background:rgba(127,127,127,.08);color:inherit;font:inherit}.tags{display:flex;flex-wrap:wrap;gap:6px}.tagbtn{padding:4px 10px;border-radius:999px;border:1px solid rgba(127,127,127,.4);background:transparent;color:inherit;cursor:pointer;font:inherit;font-size:.8rem}.tagbtn.on{background:var(--adv-accent);color:${n?"var(--iob-primary-contrast)":"#fff"};border-color:var(--adv-accent)}.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(${Number(t.minCol)||150}px,1fr));gap:${i}px}.cell{display:flex;flex-direction:column;cursor:pointer;min-width:0}.img{position:relative;display:block;border-radius:var(--adv-radius);overflow:hidden;background:var(--adv-card-bg)}.img img{width:100%;height:auto;display:block}.img.fix img{height:100%;object-fit:cover}.tag{position:absolute;background:var(--adv-tag-bg);color:var(--adv-tag-color);font-size:.6rem;padding:2px 4px;border-radius:3px;line-height:1;max-width:85%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.play{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;opacity:0;transition:opacity .15s;background:rgba(0,0,0,.2)}.play::before{content:"";border-style:solid;border-width:11px 0 11px 18px;border-color:transparent transparent transparent #fff;filter:drop-shadow(0 1px 2px rgba(0,0,0,.6))}.cell:hover .play{opacity:1}.cap{font-size:${t.compact?".65rem":".72rem"};margin-top:${t.compact?2:4}px;line-height:1.25;opacity:.85;overflow:hidden;text-overflow:ellipsis}.empty,.msg{padding:24px;text-align:center;opacity:.7}.single{height:100%;display:flex;flex-direction:column}.single .cell{flex:1 1 auto;min-height:0}.single .img{flex:1 1 auto;min-height:0}.single .img img{width:100%;height:100%;object-fit:contain}dialog{border:0;padding:12px;border-radius:14px;background:${o.modal};max-width:min(92vw,${Number(t.maxModalWidth)||900}px);width:min(92vw,${Number(t.maxModalWidth)||900}px);box-sizing:border-box;box-shadow:0 16px 48px rgba(0,0,0,.55),0 0 0 1px rgba(255,255,255,.08);overflow:visible}dialog::backdrop{background:rgba(0,0,0,.35)}.box{position:relative;display:flex;flex-direction:column;gap:8px}video{width:100%;max-height:80vh;border-radius:8px;background:#000;display:block;object-fit:contain}.close{position:absolute;top:6px;right:6px;width:32px;height:32px;border-radius:50%;background:rgba(0,0,0,.65);color:#fff;display:flex;align-items:center;justify-content:center;cursor:pointer;font-size:15px;z-index:2;border:2px solid rgba(255,255,255,.35)}.info{color:${o.info};font-size:.8rem;text-align:center}.info a{color:var(--adv-accent)}`}function Re(t){let n=document.createElement("dialog");n.innerHTML='<div class="box"><span class="close" role="button" aria-label="close">&#10005;</span><video controls preload="none" playsinline></video><div class="info"></div></div>';let e=n.querySelector("video"),i=n.querySelector(".info"),r=()=>n.open&&n.close();return n.querySelector(".close").addEventListener("click",r),n.addEventListener("click",o=>o.target===n&&r()),n.addEventListener("close",()=>{try{e.pause()}catch{}e.removeAttribute("src"),e.removeAttribute("style");try{e.load()}catch{}}),t.appendChild(n),{el:n,open(o,m,u){u&&(e.style.aspectRatio=u.replace("/"," / "),e.style.objectFit="fill"),e.setAttribute("src",o),i.innerHTML=m,n.open||n.showModal(),e.play&&e.play().catch(()=>{})}}}function Ie(t,n,e){let i=t.aspect||n.liveAspect||"",r=i?String(i).replace("/"," / "):"";return`<div class="cell" data-cam="${k(t.id)}"><span class="img${r?" fix":""}"${r?` style="aspect-ratio:${k(r)}"`:""}><img class="snap" alt="" src="${k(`${t.snapshot}&ts=${Date.now()}`)}" data-base="${k(t.snapshot)}"><span class="tag" style="top:5px;left:5px">&#9679; ${k(e.live)}</span><span class="play"></span></span><span class="cap">${k(t.name)}</span></div>`}var Q=class{constructor(n){this.root=n,this.timer=null,this.sec=0}set(n){n=Math.max(0,Number(n)||0),!(n===this.sec&&(this.timer||!n))&&(this.stop(),this.sec=n,n>0&&(this.timer=setInterval(()=>{for(let e of this.root.querySelectorAll("img.snap")){let i=e.getAttribute("data-base");i&&(e.src=`${i}&ts=${Date.now()}`)}},n*1e3)))}stop(){clearInterval(this.timer),this.timer=null,this.sec=0}};var q=class extends Z{constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML='<style></style><div class="root"></div>',this._player=Re(this.shadowRoot),this._timer=new Q(this.shadowRoot),this._key="",this._cams=[],this._cfg=null}_target(n){return{instance:"",camera:"",missing:_.pickInstance}}_single(){return!1}getStateIds(n){let e=this._target(n);return e.instance?[`${e.instance}.widget_config`]:[]}render(){let n=this.settings||{},e=this._target(n),i=this.shadowRoot.querySelector(".root"),r=e.instance?Le(this.states[`${e.instance}.widget_config`]):null,o=Oe(n,r),m=this.shadowRoot.querySelector("style"),u=Ne(o||{},!!n.follow,this.editMode);if(m.textContent!==u&&(m.textContent=u),e.missing)return this._msg(i,this.text(e.missing));if(!o||!r||!Array.isArray(r.cameras))return this._msg(i,this.text(_.waiting));let l=e.camera?r.cameras.filter(h=>h.id===e.camera):r.cameras,s=JSON.stringify([o,l,r.labels,this.systemLang]);if(this._timer.set(o.liveRefreshSec),s===this._key)return;if(this._key=s,this._cfg=o,this._cams=l,!l.length)return this._msg(i,this.text(e.camera?_.noCamera:_.noCameras));let f=ze(r,this.systemLang),d=l.map(h=>Ie(h,o,f)).join("");if(i.innerHTML=this._single()?`<div class="single">${d}</div>`:`<div class="grid">${d}</div>`,this._single()){let h=i.querySelector(".img");h&&h.removeAttribute("style"),h&&h.classList.remove("fix")}for(let h of i.querySelectorAll(".cell"))h.addEventListener("click",()=>this._open(h.getAttribute("data-cam")))}_msg(n,e){this._key="",this._timer.stop(),n.innerHTML=`<div class="msg">${k(e)}</div>`}_open(n){let e=this._cams.find(i=>i.id===n);!e||this.editMode||this._player.open(e.live,`${k(e.name)} &middot; Live`,e.aspect||this._cfg.liveAspect||"")}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._key=""}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),this._timer.stop(),this._player.el.open&&this._player.el.close()}};var le=class extends q{_target(n){let e=Ae(n.mode==="custom"?n.camera:n.widget),i=e.instance&&e.camera?null:n.mode==="custom"?_.pickCamera:_.pickWidget;return{...e,missing:i}}_single(){return!0}};_e("iob-agent-dvr-live",le);
@@ -0,0 +1,209 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/ioBroker/web-components/main/schemas/manifest.json",
3
+ "manifestVersion": 1,
4
+ "tag": "iob-agent-dvr-live",
5
+ "name": {
6
+ "en": "Agent DVR live camera",
7
+ "de": "Agent DVR Live-Kamera"
8
+ },
9
+ "description": {
10
+ "en": "Live tile of a camera, opens the live stream: from the adapter settings or set up here",
11
+ "de": "Live-Kachel einer Kamera, öffnet den Livestream: aus den Adapter-Einstellungen oder hier eingestellt"
12
+ },
13
+ "icon": "../agent-dvr.png",
14
+ "module": "agent-dvr-live.js",
15
+ "size": {
16
+ "width": 400,
17
+ "height": 260
18
+ },
19
+ "settings": {
20
+ "type": "panel",
21
+ "items": {
22
+ "mode": {
23
+ "type": "select",
24
+ "label": {
25
+ "en": "Source",
26
+ "de": "Quelle"
27
+ },
28
+ "default": "adapter",
29
+ "options": [
30
+ {
31
+ "value": "adapter",
32
+ "label": {
33
+ "en": "Widget from the adapter settings",
34
+ "de": "Widget aus den Adapter-Einstellungen"
35
+ }
36
+ },
37
+ {
38
+ "value": "custom",
39
+ "label": {
40
+ "en": "Own settings here",
41
+ "de": "Eigene Einstellungen hier"
42
+ }
43
+ }
44
+ ]
45
+ },
46
+ "widget": {
47
+ "type": "objectId",
48
+ "types": "state",
49
+ "root": "agent-dvr",
50
+ "label": {
51
+ "en": "Widget",
52
+ "de": "Widget"
53
+ },
54
+ "help": {
55
+ "en": "The live widget of a camera, e.g. agent-dvr.0.cam_8_Garden.widget_live",
56
+ "de": "Live-Widget einer Kamera, z. B. agent-dvr.0.cam_8_Garten.widget_live"
57
+ },
58
+ "hidden": "data.mode === 'custom'"
59
+ },
60
+ "camera": {
61
+ "type": "objectId",
62
+ "types": "device",
63
+ "root": "agent-dvr",
64
+ "label": {
65
+ "en": "Camera",
66
+ "de": "Kamera"
67
+ },
68
+ "help": {
69
+ "en": "Choose the camera, e.g. agent-dvr.0.cam_8_Garden",
70
+ "de": "Kamera wählen, z. B. agent-dvr.0.cam_8_Garten"
71
+ },
72
+ "hidden": "data.mode !== 'custom'"
73
+ },
74
+ "follow": {
75
+ "type": "checkbox",
76
+ "label": {
77
+ "en": "Use the colors of the visualization",
78
+ "de": "Farben der Visualisierung übernehmen"
79
+ },
80
+ "default": false,
81
+ "help": {
82
+ "en": "Tiles, badges, player and accent in the colors of the theme instead of the widget colors",
83
+ "de": "Kacheln, Badges, Player und Akzent in den Farben des Themes statt der Widget-Farben"
84
+ }
85
+ },
86
+ "hLive": {
87
+ "type": "header",
88
+ "text": {
89
+ "en": "Live Widget",
90
+ "de": "Live-Widget"
91
+ },
92
+ "size": 5,
93
+ "hidden": "data.mode !== 'custom'"
94
+ },
95
+ "liveAspect": {
96
+ "type": "text",
97
+ "label": {
98
+ "en": "Live tile aspect ratio (e.g. 16/9)",
99
+ "de": "Seitenverhältnis Live-Kachel (z. B. 16/9)"
100
+ },
101
+ "default": "",
102
+ "hidden": "data.mode !== 'custom'",
103
+ "help": {
104
+ "en": "Used when the adapter could not detect the resolution of the camera. Empty = automatic",
105
+ "de": "Gilt, wenn der Adapter die Auflösung der Kamera nicht erkennen konnte. Leer = automatisch"
106
+ }
107
+ },
108
+ "liveRefreshSec": {
109
+ "type": "number",
110
+ "label": {
111
+ "en": "Snapshot refresh interval (s, 0 = never)",
112
+ "de": "Aktualisierung Vorschaubild (s, 0 = nie)"
113
+ },
114
+ "min": 0,
115
+ "max": 3600,
116
+ "default": 0,
117
+ "hidden": "data.mode !== 'custom'",
118
+ "help": {
119
+ "en": "Only the image is refreshed in the browser – an open player never closes",
120
+ "de": "Nur das Bild wird im Browser erneuert – ein offener Player schließt sich nie"
121
+ }
122
+ },
123
+ "compact": {
124
+ "type": "checkbox",
125
+ "label": {
126
+ "en": "Compact layout",
127
+ "de": "Kompaktes Layout"
128
+ },
129
+ "default": false,
130
+ "hidden": "data.mode !== 'custom'",
131
+ "help": {
132
+ "en": "Smaller spacing and font – more entries at a glance",
133
+ "de": "Kleinere Abstände und Schrift – mehr Einträge auf einen Blick"
134
+ }
135
+ },
136
+ "maxModalWidth": {
137
+ "type": "number",
138
+ "label": {
139
+ "en": "Max. player width (px)",
140
+ "de": "Max. Player-Breite (px)"
141
+ },
142
+ "min": 300,
143
+ "max": 2000,
144
+ "default": 900,
145
+ "hidden": "data.mode !== 'custom'"
146
+ },
147
+ "hColors": {
148
+ "type": "header",
149
+ "text": {
150
+ "en": "Colors & Design",
151
+ "de": "Farben & Design"
152
+ },
153
+ "size": 5,
154
+ "hidden": "data.mode !== 'custom'"
155
+ },
156
+ "colorCardBg": {
157
+ "type": "color",
158
+ "label": {
159
+ "en": "Tile background",
160
+ "de": "Kachel-Hintergrund"
161
+ },
162
+ "default": "rgba(127,127,127,0.15)",
163
+ "hidden": "data.mode !== 'custom' || data.follow"
164
+ },
165
+ "colorTagBg": {
166
+ "type": "color",
167
+ "label": {
168
+ "en": "Tag badge background",
169
+ "de": "Tag-Badge-Hintergrund"
170
+ },
171
+ "default": "rgba(0,0,0,0.55)",
172
+ "hidden": "data.mode !== 'custom' || data.follow"
173
+ },
174
+ "colorTagText": {
175
+ "type": "color",
176
+ "label": {
177
+ "en": "Tag badge text color",
178
+ "de": "Tag-Badge-Textfarbe"
179
+ },
180
+ "default": "#ffffff",
181
+ "hidden": "data.mode !== 'custom' || data.follow"
182
+ },
183
+ "colorModalBg": {
184
+ "type": "color",
185
+ "label": {
186
+ "en": "Modal background",
187
+ "de": "Modal-Hintergrund"
188
+ },
189
+ "default": "#1c1c1e",
190
+ "hidden": "data.mode !== 'custom' || data.follow"
191
+ },
192
+ "borderRadius": {
193
+ "type": "number",
194
+ "label": {
195
+ "en": "Border radius (px)",
196
+ "de": "Eckenradius (px)"
197
+ },
198
+ "min": 0,
199
+ "max": 32,
200
+ "default": 8,
201
+ "hidden": "data.mode !== 'custom'",
202
+ "help": {
203
+ "en": "Corner radius of the tiles (0 = square)",
204
+ "de": "Abrundungsradius der Kacheln (0 = eckig)"
205
+ }
206
+ }
207
+ }
208
+ }
209
+ }
@@ -0,0 +1,36 @@
1
+ var De=Object.defineProperty;var he=t=>{throw TypeError(t)};var Be=(t,n,e)=>n in t?De(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e;var te=(t,n,e)=>Be(t,typeof n!="symbol"?n+"":n,e),ne=(t,n,e)=>n.has(t)||he("Cannot "+e);var a=(t,n,e)=>(ne(t,n,"read from private field"),e?e.call(t):n.get(t)),x=(t,n,e)=>n.has(t)?he("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(t):n.set(t,e),y=(t,n,e,i)=>(ne(t,n,"write to private field"),i?i.call(t,e):n.set(t,e),e),p=(t,n,e)=>(ne(t,n,"access private method"),e);var me="iob-dialog-close";var ge="iob-change";function K(t){return!!t.form}var be=["header","staticText","divider"];function v(t,n){return t==null?"":typeof t=="object"?t[n]||t.en||Object.values(t).find(e=>!!e)||"":String(t)}function X(t){let n={};for(let[e,i]of Object.entries(t.items||{}))i&&!be.includes(i.type)&&(n[e]=i.type);return n}function xe(t){return typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"?t.toString():JSON.stringify(t)}function Pe(t,n){if(n!=null)switch(t){case"number":case"slider":{if(typeof n=="number")return Number.isFinite(n)?n:void 0;let e=xe(n).trim().replace(",",".");if(!e)return;let i=Number(e);return Number.isFinite(i)?i:void 0}case"checkbox":return n===!0||n==="true"||n===1||n==="1";default:return xe(n)}}function J(t,n){let e={};for(let[i,r]of Object.entries(t)){let o=Pe(r,n[i]);o!==void 0&&(e[i]=o)}return e}var we='"Roboto", "Helvetica", "Arial", sans-serif',Ve=Object.freeze({type:"light",primary:"#3399CC",primaryContrast:"#FFFFFF",secondary:"#164477",secondaryContrast:"#FFFFFF",background:"#FFFFFF",paper:"#FFFFFF",text:"rgba(0, 0, 0, 0.87)",textSecondary:"rgba(0, 0, 0, 0.6)",divider:"rgba(0, 0, 0, 0.12)",error:"#D32F2F",warning:"#ED6C02",info:"#0288D1",success:"#2E7D32",fontFamily:we,fontSize:14,borderRadius:4}),He=Object.freeze({type:"dark",primary:"#4DABF5",primaryContrast:"rgba(0, 0, 0, 0.87)",secondary:"#436A93",secondaryContrast:"#FFFFFF",background:"#121212",paper:"#121212",text:"#FFFFFF",textSecondary:"rgba(255, 255, 255, 0.7)",divider:"rgba(255, 255, 255, 0.12)",error:"#F44336",warning:"#FFA726",info:"#29B6F6",success:"#66BB6A",fontFamily:we,fontSize:14,borderRadius:4}),ie=["primary","primaryContrast","secondary","secondaryContrast","background","paper","text","textSecondary","divider","error","warning","info","success","fontFamily"],re=["fontSize","borderRadius"];function ye(t){return{...t==="dark"?He:Ve}}function D(t){if(!t||typeof t!="object")return ye(typeof t=="string"?t:"light");let n=t,e=ye(typeof n.type=="string"?n.type:"light");for(let i of ie){let r=n[i];typeof r=="string"&&r.trim()&&(e[i]=r.trim())}for(let i of re){let r=n[i],o=typeof r=="string"?parseFloat(r):r;typeof o=="number"&&Number.isFinite(o)&&o>=0&&(e[i]=o)}return e}function Se(t,n){return t.type===n.type&&ie.every(e=>t[e]===n[e])&&re.every(e=>t[e]===n[e])}function ve(t){return`--iob-${t.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`)}`}function Y(t){let n={};for(let e of ie)n[ve(e)]=t[e];for(let e of re)n[ve(e)]=`${t[e]}px`;return n["color-scheme"]=t.type,n}var Ee={ok:{en:"OK","zh-cn":"\u786E\u5B9A"},cancel:{en:"Cancel",de:"Abbrechen",ru:"\u041E\u0442\u043C\u0435\u043D\u0430",pt:"Cancelar",nl:"Annuleren",fr:"Annuler",it:"Annulla",es:"Cancelar",pl:"Anuluj",uk:"\u0421\u043A\u0430\u0441\u0443\u0432\u0430\u0442\u0438","zh-cn":"\u53D6\u6D88"},close:{en:"Close",de:"Schlie\xDFen",ru:"\u0417\u0430\u043A\u0440\u044B\u0442\u044C",pt:"Fechar",nl:"Sluiten",fr:"Fermer",it:"Chiudi",es:"Cerrar",pl:"Zamknij",uk:"\u0417\u0430\u043A\u0440\u0438\u0442\u0438","zh-cn":"\u5173\u95ED"}},We=`
2
+ dialog {
3
+ box-sizing: border-box;
4
+ width: 480px;
5
+ max-width: calc(100vw - 32px);
6
+ max-height: calc(100vh - 32px);
7
+ padding: 0;
8
+ border: 0;
9
+ border-radius: calc(var(--iob-border-radius) * 2);
10
+ background: var(--iob-paper);
11
+ color: var(--iob-text);
12
+ font-family: var(--iob-font-family);
13
+ font-size: var(--iob-font-size);
14
+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
15
+ }
16
+ /* as the dialogs of MUI: a dark paper gets lighter the higher it lies */
17
+ dialog.dark { background-image: linear-gradient(rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.16)); }
18
+ dialog::backdrop { background: rgba(0, 0, 0, 0.5); }
19
+ dialog:focus { outline: none; }
20
+ form { display: flex; flex-direction: column; height: 100%; max-height: inherit; margin: 0; }
21
+ header { display: flex; align-items: center; gap: 8px; padding: 12px 8px 12px 16px; font-size: 1.15em; font-weight: 500; }
22
+ header span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
23
+ .body { flex: 1; min-height: 0; padding: 0 16px 16px; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
24
+ footer { display: flex; justify-content: flex-end; gap: 8px; padding: 0 16px 16px; }
25
+ button { font: inherit; padding: 6px 16px; border-radius: var(--iob-border-radius); border: 1px solid var(--iob-primary); background: transparent; color: var(--iob-primary); cursor: pointer; }
26
+ button.primary { background: var(--iob-primary); color: var(--iob-primary-contrast); }
27
+ button.close { border: 0; padding: 2px 8px; font-size: 1.4em; line-height: 1; color: var(--iob-text-secondary); }
28
+ label { display: flex; flex-direction: column; gap: 4px; }
29
+ label.check { flex-direction: row; align-items: center; gap: 8px; }
30
+ input, select, textarea { font: inherit; accent-color: var(--iob-primary); }
31
+ .help { color: var(--iob-text-secondary); font-size: 0.85em; }
32
+ h3 { margin: 4px 0 0; font-size: 1em; }
33
+ p { margin: 0; }
34
+ hr { width: 100%; border: 0; border-top: 1px solid var(--iob-divider); margin: 0; }
35
+ [hidden] { display: none !important; }
36
+ `;function ke(t){if(!t)return null;try{let n=new Function("data",`return (${t});`);return e=>{try{return!!n(e)}catch{return!1}}}catch{return null}}function oe(t){return typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"?String(t):""}function Ge(t){let{input:n,setting:e}=t;if(n)return n instanceof HTMLInputElement&&n.type==="checkbox"?n.checked:n instanceof HTMLSelectElement?e.options?.[n.selectedIndex]?.value:n.value}function Ue(t,n,e,i,r){let o={name:n,setting:e,box:t.createElement("div"),hidden:ke(e.hidden),disabled:ke(e.disabled)},m=v(e.label,r);switch(e.type){case"header":return o.box=t.createElement("h3"),o.box.textContent=v(e.text,r)||m,o;case"staticText":return o.box=t.createElement("p"),o.box.textContent=v(e.text,r)||m,o;case"divider":return o.box=t.createElement("hr"),o;default:break}let f=t.createElement("label");o.box=f;let l=t.createElement("span");if(l.textContent=m||n,e.type==="checkbox"){let s=t.createElement("input");s.type="checkbox",s.checked=i===!0||i==="true",f.className="check",f.append(s,l),o.input=s}else if(e.type==="select"){let s=t.createElement("select");for(let d of e.options||[]){let h=t.createElement("option");h.textContent=v(d.label,r),s.append(h)}let u=(e.options||[]).findIndex(d=>String(d.value)===oe(i));s.selectedIndex=u===-1?0:u,f.append(l,s),o.input=s}else if(e.type==="text"&&(e.minRows||1)>1){let s=t.createElement("textarea");s.rows=e.minRows||2,s.value=oe(i),f.append(l,s),o.input=s}else{let s=t.createElement("input"),u=oe(i);switch(e.type){case"number":case"slider":s.type=e.type==="slider"?"range":"number",e.min!==void 0&&(s.min=String(e.min)),e.max!==void 0&&(s.max=String(e.max)),s.step=e.step!==void 0?String(e.step):"any";break;case"password":s.type="password";break;case"color":s.type=!u||/^#[0-9a-f]{6}$/i.test(u)?"color":"text";break;default:s.type="text";break}if(s.value=u,s.type==="range"){let d=t.createElement("output");d.textContent=s.value,s.addEventListener("input",()=>d.textContent=s.value),l.append(": ",d)}f.append(l,s),o.input=s}if(e.help){let s=t.createElement("span");s.className="help",s.textContent=v(e.help,r),f.append(s)}return o}function Ce(t,n={}){let e=n.lang||"en",i=document,r=_=>Ee[_][e]||Ee[_].en||_,o=i.createElement("div");o.setAttribute("data-iob-dialog","");let m=o.attachShadow({mode:"open"}),f=i.createElement("style");f.textContent=We;let l=i.createElement("dialog"),s=D(n.theme);l.className=s.type==="dark"?"dark":"";for(let[_,H]of Object.entries(Y(s)))l.style.setProperty(_,H);t.width&&(l.style.width=`${t.width}px`),t.height&&(l.style.height=`${t.height}px`);let u=i.createElement("form"),d=i.createElement("header"),h=i.createElement("span");h.textContent=v(t.title,e);let C=i.createElement("button");C.type="button",C.className="close",C.title=r("close"),C.setAttribute("aria-label",r("close")),C.textContent="\xD7",d.append(h,C);let V=i.createElement("div");return V.className="body",u.append(d,V),l.append(u),m.append(f,l),new Promise(_=>{let H=!1,M=T=>{H||(H=!0,l.open&&l.close(),o.remove(),_(T))};if(C.addEventListener("click",()=>M(null)),l.addEventListener("close",()=>M(null)),u.addEventListener("submit",T=>T.preventDefault()),K(t)){let T={},W=[];for(let[b,w]of Object.entries(t.form.items||{})){let Me=t.data?.[b]??w.default,ue=Ue(i,b,w,Me,e);W.push(ue),V.append(ue.box)}let de=()=>{for(let b of W)b.input&&(T[b.name]=Ge(b));return T},ee=()=>{let b=de();for(let w of W)w.box.hidden=w.hidden?w.hidden(b):!1,w.input&&(w.input.disabled=w.disabled?w.disabled(b):!1)};u.addEventListener("input",ee),u.addEventListener("change",ee),ee();let pe=W.find(b=>b.input&&!b.box.hidden&&!b.input.disabled);pe?.input&&(pe.input.autofocus=!0);let fe=i.createElement("footer"),G=i.createElement("button");G.type="button",G.textContent=v(t.cancel,e)||r("cancel"),G.addEventListener("click",()=>M(null));let U=i.createElement("button");U.type="submit",U.className="primary",U.textContent=v(t.ok,e)||r("ok"),fe.append(G,U),u.append(fe),u.addEventListener("submit",()=>M(J(X(t.form),de())))}else V.append(t.element),l.addEventListener(me,T=>M(T.detail??null));i.body.append(o),l.showModal(),(!m.activeElement||m.activeElement===C)&&(l.tabIndex=-1,l.focus())})}function Te(t){return[...new Set(t.filter(n=>typeof n=="string"&&!!n))]}var Ke=["socket","dialogs","theme","editMode","settings","value"],S,$,j,E,L,N,g,R,I,P,c,se,z,B,Fe,je,ae,ce,F,Z=class extends HTMLElement{constructor(){super(...arguments);x(this,c);te(this,"states",{});te(this,"objects",{});x(this,S,null);x(this,$,{});x(this,j,D("light"));x(this,E,!1);x(this,L,null);x(this,N);x(this,g,null);x(this,R,!1);x(this,I,(e,i)=>{a(this,g)?.states.includes(e)&&(this.states[e]=i||null,p(this,c,F).call(this))});x(this,P,(e,i)=>{a(this,g)?.objects.includes(e)&&(this.objects[e]=i||null,p(this,c,z).call(this))})}get socket(){return a(this,S)}set socket(e){y(this,S,e||null),p(this,c,z).call(this)}get settings(){return a(this,$)}set settings(e){y(this,$,e||{}),p(this,c,z).call(this)}get theme(){return a(this,j)}set theme(e){let i=D(e);Se(i,a(this,j))||(y(this,j,i),p(this,c,se).call(this),p(this,c,F).call(this))}get editMode(){return a(this,E)}set editMode(e){let i=!!e;i!==a(this,E)&&(y(this,E,i),p(this,c,F).call(this))}get dialogs(){return a(this,L)}set dialogs(e){y(this,L,e||null)}get value(){return a(this,N)}set value(e){e!==a(this,N)&&(y(this,N,e),p(this,c,F).call(this))}connectedCallback(){for(let e of Ke)if(Object.prototype.hasOwnProperty.call(this,e)){let i=this[e];delete this[e],this[e]=i}p(this,c,se).call(this),p(this,c,z).call(this)}disconnectedCallback(){p(this,c,ce).call(this)}getStateIds(e){return[]}getObjectIds(e){return[]}get systemLang(){return a(this,S)?.systemLang||"en"}text(e){return v(e,this.systemLang)}setState(e,i){return a(this,S)&&!a(this,E)?a(this,S).setState(e,i):Promise.resolve()}changeValue(e){return a(this,E)||this.emit(ge,e)?!1:(this.value=e,!0)}emit(e,i){return this.dispatchEvent(new CustomEvent(e,{detail:i,bubbles:!0,composed:!0,cancelable:!0}))}async openDialog(e){if(a(this,E))return null;let i=a(this,L)?await a(this,L).open(e):await Ce(e,{lang:this.systemLang,theme:a(this,j)});return K(e)?i&&typeof i=="object"?J(X(e.form),i):null:i??null}};S=new WeakMap,$=new WeakMap,j=new WeakMap,E=new WeakMap,L=new WeakMap,N=new WeakMap,g=new WeakMap,R=new WeakMap,I=new WeakMap,P=new WeakMap,c=new WeakSet,se=function(){for(let[e,i]of Object.entries(Y(a(this,j))))this.style.setProperty(e,i)},z=function(){if(!this.isConnected)return;let e=a(this,S),i=e?Te(this.getStateIds(a(this,$))):[],r=e?Te(this.getObjectIds(a(this,$))):[];a(this,g)&&a(this,g).socket!==e&&p(this,c,ce).call(this);let o=a(this,g)?.states||[],m=a(this,g)?.objects||[],f=o.filter(d=>!i.includes(d)),l=m.filter(d=>!r.includes(d)),s=i.filter(d=>!o.includes(d)),u=r.filter(d=>!m.includes(d));e&&f.length&&e.unsubscribeState(f,a(this,I)),e&&l.length&&p(this,c,ae).call(this,e,l);for(let d of f)delete this.states[d];for(let d of[...f,...l])!i.includes(d)&&!r.includes(d)&&delete this.objects[d];y(this,g,e&&(i.length||r.length)?{socket:e,states:i,objects:r}:null),e&&s.length&&p(this,c,Fe).call(this,e,s),e&&u.length&&p(this,c,je).call(this,e,u),p(this,c,F).call(this)},B=function(e,i,r){return a(this,g)?.socket===e&&a(this,g)[i].includes(r)},Fe=function(e,i){e.subscribeState(i,a(this,I)).catch(r=>console.warn(`<${this.localName}>: cannot subscribe ${i.join(", ")}: ${r}`));for(let r of i)e.getState(r).then(o=>{p(this,c,B).call(this,e,"states",r)&&this.states[r]===void 0&&(this.states[r]=o||null,p(this,c,F).call(this))}).catch(()=>{}),e.getObject(r).then(o=>{p(this,c,B).call(this,e,"states",r)&&!p(this,c,B).call(this,e,"objects",r)&&(this.objects[r]=o||null,p(this,c,F).call(this))}).catch(()=>{})},je=function(e,i){e.subscribeObject(i,a(this,P)).catch(r=>console.warn(`<${this.localName}>: cannot subscribe the objects ${i.join(", ")}: ${r}`));for(let r of i)e.getObject(r).then(o=>{p(this,c,B).call(this,e,"objects",r)&&(this.objects[r]=o||null,p(this,c,z).call(this))}).catch(()=>{})},ae=function(e,i){e.unsubscribeObject(i,a(this,P)).catch(()=>{})},ce=function(){if(a(this,g)){let{socket:e,states:i,objects:r}=a(this,g);i.length&&e.unsubscribeState(i,a(this,I)),r.length&&p(this,c,ae).call(this,e,r),y(this,g,null)}this.states={},this.objects={}},F=function(){a(this,R)||(y(this,R,!0),queueMicrotask(()=>{y(this,R,!1),this.isConnected&&this.render()}))};function _e(t,n){let e=typeof t=="string"?t:t.tag;customElements.get(e)||customElements.define(e,n)}var A={widgetMode:"nojs",count:50,thumbSize:"medium",minCol:150,maxModalWidth:900,showTags:!0,tagPosition:"bottom-left",sortNewest:!0,showSearch:!0,defaultTag:"",compact:!1,playerUrl:"",liveAspect:"",liveRefreshSec:0,colorCardBg:"rgba(127,127,127,0.15)",colorTagBg:"rgba(0,0,0,0.55)",colorTagText:"#ffffff",colorAccent:"#8ab4f8",colorModalBg:"#1c1c1e",borderRadius:8},Xe={small:120,medium:180,large:240},O={pickWidget:{en:"Please choose a widget in the settings.",de:"Bitte in den Einstellungen ein Widget ausw\xE4hlen."},pickCamera:{en:"Please choose a camera in the settings.",de:"Bitte in den Einstellungen eine Kamera ausw\xE4hlen."},pickInstance:{en:"Please choose an agent-dvr instance in the settings.",de:"Bitte in den Einstellungen eine agent-dvr-Instanz ausw\xE4hlen."},waiting:{en:"Waiting for data of the adapter \u2026",de:"Warte auf Daten des Adapters \u2026"},noCamera:{en:"Camera not found",de:"Kamera nicht gefunden"},noCameras:{en:"No cameras",de:"Keine Kameras"}},$e={en:{noRecordings:"No recordings",search:"Search \u2026",all:"All",download:"Download",live:"LIVE"},de:{noRecordings:"Keine Aufnahmen",search:"Suche \u2026",all:"Alle",download:"Herunterladen",live:"LIVE"}};function k(t){return String(t??"").replace(/[&<>"]/g,n=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[n])}function Le(t){let n=String(t||"").replace(/^system\.adapter\./,"");return/^\d+$/.test(n)?`agent-dvr.${n}`:/^[^.]+\.\d+$/.test(n)?n:""}function Ae(t){let n=t&&t.val;if(typeof n!="string"||!n)return null;try{return JSON.parse(n)}catch{return null}}function Oe(t,n){if(t.mode==="custom"){let e={...A};for(let[i,r]of Object.entries(t))r!=null&&(e[i]=r);return e.minCol=Xe[e.thumbSize]||Number(e.minCol)||150,e}return!n||!n.settings?null:{...A,...n.settings}}function ze(t,n){return{...$e[n]||$e.en,...t&&t.labels||{}}}function Ne(t,n,e){let i=t.compact?6:12,r=`${Math.max(0,Number(t.borderRadius)||0)}px`,o=n?{card:"color-mix(in srgb, var(--iob-text, currentColor) 10%, transparent)",tagBg:"var(--iob-primary)",tagText:"var(--iob-primary-contrast)",accent:"var(--iob-primary)",modal:"var(--iob-paper)",info:"var(--iob-text)"}:{card:t.colorCardBg||A.colorCardBg,tagBg:t.colorTagBg||A.colorTagBg,tagText:t.colorTagText||A.colorTagText,accent:t.colorAccent||A.colorAccent,modal:t.colorModalBg||A.colorModalBg,info:"#fff"};return`:host{display:block;width:100%;height:100%;overflow:hidden;color:inherit;font:inherit}.root{--adv-card-bg:${o.card};--adv-tag-bg:${o.tagBg};--adv-tag-color:${o.tagText};--adv-accent:${o.accent};--adv-radius:${r};width:100%;height:100%;box-sizing:border-box;overflow:auto;${e?"pointer-events:none;":""}}.bar{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin-bottom:10px}.search{flex:1 1 160px;min-width:120px;padding:6px 10px;border-radius:8px;border:1px solid rgba(127,127,127,.4);background:rgba(127,127,127,.08);color:inherit;font:inherit}.tags{display:flex;flex-wrap:wrap;gap:6px}.tagbtn{padding:4px 10px;border-radius:999px;border:1px solid rgba(127,127,127,.4);background:transparent;color:inherit;cursor:pointer;font:inherit;font-size:.8rem}.tagbtn.on{background:var(--adv-accent);color:${n?"var(--iob-primary-contrast)":"#fff"};border-color:var(--adv-accent)}.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(${Number(t.minCol)||150}px,1fr));gap:${i}px}.cell{display:flex;flex-direction:column;cursor:pointer;min-width:0}.img{position:relative;display:block;border-radius:var(--adv-radius);overflow:hidden;background:var(--adv-card-bg)}.img img{width:100%;height:auto;display:block}.img.fix img{height:100%;object-fit:cover}.tag{position:absolute;background:var(--adv-tag-bg);color:var(--adv-tag-color);font-size:.6rem;padding:2px 4px;border-radius:3px;line-height:1;max-width:85%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.play{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;opacity:0;transition:opacity .15s;background:rgba(0,0,0,.2)}.play::before{content:"";border-style:solid;border-width:11px 0 11px 18px;border-color:transparent transparent transparent #fff;filter:drop-shadow(0 1px 2px rgba(0,0,0,.6))}.cell:hover .play{opacity:1}.cap{font-size:${t.compact?".65rem":".72rem"};margin-top:${t.compact?2:4}px;line-height:1.25;opacity:.85;overflow:hidden;text-overflow:ellipsis}.empty,.msg{padding:24px;text-align:center;opacity:.7}.single{height:100%;display:flex;flex-direction:column}.single .cell{flex:1 1 auto;min-height:0}.single .img{flex:1 1 auto;min-height:0}.single .img img{width:100%;height:100%;object-fit:contain}dialog{border:0;padding:12px;border-radius:14px;background:${o.modal};max-width:min(92vw,${Number(t.maxModalWidth)||900}px);width:min(92vw,${Number(t.maxModalWidth)||900}px);box-sizing:border-box;box-shadow:0 16px 48px rgba(0,0,0,.55),0 0 0 1px rgba(255,255,255,.08);overflow:visible}dialog::backdrop{background:rgba(0,0,0,.35)}.box{position:relative;display:flex;flex-direction:column;gap:8px}video{width:100%;max-height:80vh;border-radius:8px;background:#000;display:block;object-fit:contain}.close{position:absolute;top:6px;right:6px;width:32px;height:32px;border-radius:50%;background:rgba(0,0,0,.65);color:#fff;display:flex;align-items:center;justify-content:center;cursor:pointer;font-size:15px;z-index:2;border:2px solid rgba(255,255,255,.35)}.info{color:${o.info};font-size:.8rem;text-align:center}.info a{color:var(--adv-accent)}`}function Re(t){let n=document.createElement("dialog");n.innerHTML='<div class="box"><span class="close" role="button" aria-label="close">&#10005;</span><video controls preload="none" playsinline></video><div class="info"></div></div>';let e=n.querySelector("video"),i=n.querySelector(".info"),r=()=>n.open&&n.close();return n.querySelector(".close").addEventListener("click",r),n.addEventListener("click",o=>o.target===n&&r()),n.addEventListener("close",()=>{try{e.pause()}catch{}e.removeAttribute("src"),e.removeAttribute("style");try{e.load()}catch{}}),t.appendChild(n),{el:n,open(o,m,f){f&&(e.style.aspectRatio=f.replace("/"," / "),e.style.objectFit="fill"),e.setAttribute("src",o),i.innerHTML=m,n.open||n.showModal(),e.play&&e.play().catch(()=>{})}}}function Ie(t,n,e){let i=t.aspect||n.liveAspect||"",r=i?String(i).replace("/"," / "):"";return`<div class="cell" data-cam="${k(t.id)}"><span class="img${r?" fix":""}"${r?` style="aspect-ratio:${k(r)}"`:""}><img class="snap" alt="" src="${k(`${t.snapshot}&ts=${Date.now()}`)}" data-base="${k(t.snapshot)}"><span class="tag" style="top:5px;left:5px">&#9679; ${k(e.live)}</span><span class="play"></span></span><span class="cap">${k(t.name)}</span></div>`}var Q=class{constructor(n){this.root=n,this.timer=null,this.sec=0}set(n){n=Math.max(0,Number(n)||0),!(n===this.sec&&(this.timer||!n))&&(this.stop(),this.sec=n,n>0&&(this.timer=setInterval(()=>{for(let e of this.root.querySelectorAll("img.snap")){let i=e.getAttribute("data-base");i&&(e.src=`${i}&ts=${Date.now()}`)}},n*1e3)))}stop(){clearInterval(this.timer),this.timer=null,this.sec=0}};var q=class extends Z{constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML='<style></style><div class="root"></div>',this._player=Re(this.shadowRoot),this._timer=new Q(this.shadowRoot),this._key="",this._cams=[],this._cfg=null}_target(n){return{instance:"",camera:"",missing:O.pickInstance}}_single(){return!1}getStateIds(n){let e=this._target(n);return e.instance?[`${e.instance}.widget_config`]:[]}render(){let n=this.settings||{},e=this._target(n),i=this.shadowRoot.querySelector(".root"),r=e.instance?Ae(this.states[`${e.instance}.widget_config`]):null,o=Oe(n,r),m=this.shadowRoot.querySelector("style"),f=Ne(o||{},!!n.follow,this.editMode);if(m.textContent!==f&&(m.textContent=f),e.missing)return this._msg(i,this.text(e.missing));if(!o||!r||!Array.isArray(r.cameras))return this._msg(i,this.text(O.waiting));let l=e.camera?r.cameras.filter(h=>h.id===e.camera):r.cameras,s=JSON.stringify([o,l,r.labels,this.systemLang]);if(this._timer.set(o.liveRefreshSec),s===this._key)return;if(this._key=s,this._cfg=o,this._cams=l,!l.length)return this._msg(i,this.text(e.camera?O.noCamera:O.noCameras));let u=ze(r,this.systemLang),d=l.map(h=>Ie(h,o,u)).join("");if(i.innerHTML=this._single()?`<div class="single">${d}</div>`:`<div class="grid">${d}</div>`,this._single()){let h=i.querySelector(".img");h&&h.removeAttribute("style"),h&&h.classList.remove("fix")}for(let h of i.querySelectorAll(".cell"))h.addEventListener("click",()=>this._open(h.getAttribute("data-cam")))}_msg(n,e){this._key="",this._timer.stop(),n.innerHTML=`<div class="msg">${k(e)}</div>`}_open(n){let e=this._cams.find(i=>i.id===n);!e||this.editMode||this._player.open(e.live,`${k(e.name)} &middot; Live`,e.aspect||this._cfg.liveAspect||"")}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._key=""}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),this._timer.stop(),this._player.el.open&&this._player.el.close()}};var le=class extends q{_target(n){let e=Le(n.instance);return{instance:e,camera:"",missing:e?null:O.pickInstance}}};_e("iob-agent-dvr-overview",le);