iobroker.agent-dvr 0.7.0 → 0.8.1

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.
@@ -0,0 +1,256 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/ioBroker/web-components/main/schemas/manifest.json",
3
+ "manifestVersion": 1,
4
+ "tag": "iob-agent-dvr-overview",
5
+ "name": {
6
+ "en": "Agent DVR live overview",
7
+ "de": "Agent DVR Live-Übersicht"
8
+ },
9
+ "description": {
10
+ "en": "Live tiles of all cameras of an instance: with the adapter settings or set up here",
11
+ "de": "Live-Kacheln aller Kameras einer Instanz: mit den Adapter-Einstellungen oder hier eingestellt"
12
+ },
13
+ "icon": "../agent-dvr.png",
14
+ "module": "agent-dvr-overview.js",
15
+ "size": {
16
+ "width": 640,
17
+ "height": 420
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
+ "instance": {
47
+ "type": "instance",
48
+ "adapter": "agent-dvr",
49
+ "label": {
50
+ "en": "Instance",
51
+ "de": "Instanz"
52
+ },
53
+ "default": "agent-dvr.0"
54
+ },
55
+ "follow": {
56
+ "type": "checkbox",
57
+ "label": {
58
+ "en": "Use the colors of the visualization",
59
+ "de": "Farben der Visualisierung übernehmen"
60
+ },
61
+ "default": false,
62
+ "help": {
63
+ "en": "Tiles, badges, player and accent in the colors of the theme instead of the widget colors",
64
+ "de": "Kacheln, Badges, Player und Akzent in den Farben des Themes statt der Widget-Farben"
65
+ }
66
+ },
67
+ "fit": {
68
+ "type": "checkbox",
69
+ "label": {
70
+ "en": "Fit to the widget size",
71
+ "de": "An die Widget-Größe anpassen"
72
+ },
73
+ "default": true,
74
+ "help": {
75
+ "en": "All cameras fill the widget without scrolling: column count and tile size follow the available space (thumbnail size is ignored)",
76
+ "de": "Alle Kameras füllen das Widget ohne Scrollen: Spaltenzahl und Kachelgröße richten sich nach dem Platz (Thumbnail-Größe wird ignoriert)"
77
+ }
78
+ },
79
+ "hLive": {
80
+ "type": "header",
81
+ "text": {
82
+ "en": "Live Widget",
83
+ "de": "Live-Widget"
84
+ },
85
+ "size": 5,
86
+ "hidden": "data.mode !== 'custom'"
87
+ },
88
+ "liveAspect": {
89
+ "type": "text",
90
+ "label": {
91
+ "en": "Live tile aspect ratio (e.g. 16/9)",
92
+ "de": "Seitenverhältnis Live-Kachel (z. B. 16/9)"
93
+ },
94
+ "default": "",
95
+ "hidden": "data.mode !== 'custom'",
96
+ "help": {
97
+ "en": "Used when the adapter could not detect the resolution of the camera. Empty = automatic",
98
+ "de": "Gilt, wenn der Adapter die Auflösung der Kamera nicht erkennen konnte. Leer = automatisch"
99
+ }
100
+ },
101
+ "liveRefreshSec": {
102
+ "type": "number",
103
+ "label": {
104
+ "en": "Snapshot refresh interval (s, 0 = never)",
105
+ "de": "Aktualisierung Vorschaubild (s, 0 = nie)"
106
+ },
107
+ "min": 0,
108
+ "max": 3600,
109
+ "default": 0,
110
+ "hidden": "data.mode !== 'custom'",
111
+ "help": {
112
+ "en": "Only the image is refreshed in the browser – an open player never closes",
113
+ "de": "Nur das Bild wird im Browser erneuert – ein offener Player schließt sich nie"
114
+ }
115
+ },
116
+ "thumbSize": {
117
+ "type": "select",
118
+ "label": {
119
+ "en": "Thumbnail size",
120
+ "de": "Thumbnail-Größe"
121
+ },
122
+ "default": "medium",
123
+ "hidden": "(data.mode !== 'custom') || data.fit !== false",
124
+ "help": {
125
+ "en": "Width of preview images (overrides min. column width)",
126
+ "de": "Breite der Vorschaubilder (überschreibt Min. Spaltenbreite)"
127
+ },
128
+ "options": [
129
+ {
130
+ "value": "small",
131
+ "label": {
132
+ "en": "Small (120 px)",
133
+ "de": "Klein (120 px)"
134
+ }
135
+ },
136
+ {
137
+ "value": "medium",
138
+ "label": {
139
+ "en": "Medium (180 px)",
140
+ "de": "Mittel (180 px)"
141
+ }
142
+ },
143
+ {
144
+ "value": "large",
145
+ "label": {
146
+ "en": "Large (240 px)",
147
+ "de": "Groß (240 px)"
148
+ }
149
+ },
150
+ {
151
+ "value": "custom",
152
+ "label": {
153
+ "en": "Min. column width below",
154
+ "de": "Min. Spaltenbreite unten"
155
+ }
156
+ }
157
+ ]
158
+ },
159
+ "minCol": {
160
+ "type": "number",
161
+ "label": {
162
+ "en": "Min. column width (px)",
163
+ "de": "Min. Spaltenbreite (px)"
164
+ },
165
+ "min": 80,
166
+ "max": 600,
167
+ "default": 150,
168
+ "hidden": "(data.mode !== 'custom' || data.thumbSize !== 'custom') || data.fit !== false"
169
+ },
170
+ "compact": {
171
+ "type": "checkbox",
172
+ "label": {
173
+ "en": "Compact layout",
174
+ "de": "Kompaktes Layout"
175
+ },
176
+ "default": false,
177
+ "hidden": "data.mode !== 'custom'",
178
+ "help": {
179
+ "en": "Smaller spacing and font – more entries at a glance",
180
+ "de": "Kleinere Abstände und Schrift – mehr Einträge auf einen Blick"
181
+ }
182
+ },
183
+ "maxModalWidth": {
184
+ "type": "number",
185
+ "label": {
186
+ "en": "Max. player width (px)",
187
+ "de": "Max. Player-Breite (px)"
188
+ },
189
+ "min": 300,
190
+ "max": 2000,
191
+ "default": 900,
192
+ "hidden": "data.mode !== 'custom'"
193
+ },
194
+ "hColors": {
195
+ "type": "header",
196
+ "text": {
197
+ "en": "Colors & Design",
198
+ "de": "Farben & Design"
199
+ },
200
+ "size": 5,
201
+ "hidden": "data.mode !== 'custom'"
202
+ },
203
+ "colorCardBg": {
204
+ "type": "color",
205
+ "label": {
206
+ "en": "Tile background",
207
+ "de": "Kachel-Hintergrund"
208
+ },
209
+ "default": "rgba(127,127,127,0.15)",
210
+ "hidden": "data.mode !== 'custom' || data.follow"
211
+ },
212
+ "colorTagBg": {
213
+ "type": "color",
214
+ "label": {
215
+ "en": "Tag badge background",
216
+ "de": "Tag-Badge-Hintergrund"
217
+ },
218
+ "default": "rgba(0,0,0,0.55)",
219
+ "hidden": "data.mode !== 'custom' || data.follow"
220
+ },
221
+ "colorTagText": {
222
+ "type": "color",
223
+ "label": {
224
+ "en": "Tag badge text color",
225
+ "de": "Tag-Badge-Textfarbe"
226
+ },
227
+ "default": "#ffffff",
228
+ "hidden": "data.mode !== 'custom' || data.follow"
229
+ },
230
+ "colorModalBg": {
231
+ "type": "color",
232
+ "label": {
233
+ "en": "Modal background",
234
+ "de": "Modal-Hintergrund"
235
+ },
236
+ "default": "#1c1c1e",
237
+ "hidden": "data.mode !== 'custom' || data.follow"
238
+ },
239
+ "borderRadius": {
240
+ "type": "number",
241
+ "label": {
242
+ "en": "Border radius (px)",
243
+ "de": "Eckenradius (px)"
244
+ },
245
+ "min": 0,
246
+ "max": 32,
247
+ "default": 8,
248
+ "hidden": "data.mode !== 'custom'",
249
+ "help": {
250
+ "en": "Corner radius of the tiles (0 = square)",
251
+ "de": "Abrundungsradius der Kacheln (0 = eckig)"
252
+ }
253
+ }
254
+ }
255
+ }
256
+ }
@@ -0,0 +1,36 @@
1
+ var Ie=Object.defineProperty;var ue=n=>{throw TypeError(n)};var Re=(n,t,e)=>t in n?Ie(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var Q=(n,t,e)=>Re(n,typeof t!="symbol"?t+"":t,e),ee=(n,t,e)=>t.has(n)||ue("Cannot "+e);var c=(n,t,e)=>(ee(n,t,"read from private field"),e?e.call(n):t.get(n)),y=(n,t,e)=>t.has(n)?ue("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,e),v=(n,t,e,i)=>(ee(n,t,"write to private field"),i?i.call(n,e):t.set(n,e),e),u=(n,t,e)=>(ee(n,t,"access private method"),e);var he="iob-dialog-close";var ge="iob-change";function U(n){return!!n.form}var me=["header","staticText","divider"];function w(n,t){return n==null?"":typeof n=="object"?n[t]||n.en||Object.values(n).find(e=>!!e)||"":String(n)}function K(n){let t={};for(let[e,i]of Object.entries(n.items||{}))i&&!me.includes(i.type)&&(t[e]=i.type);return t}function be(n){return typeof n=="string"?n:typeof n=="number"||typeof n=="boolean"?n.toString():JSON.stringify(n)}function De(n,t){if(t!=null)switch(n){case"number":case"slider":{if(typeof t=="number")return Number.isFinite(t)?t:void 0;let e=be(t).trim().replace(",",".");if(!e)return;let i=Number(e);return Number.isFinite(i)?i:void 0}case"checkbox":return t===!0||t==="true"||t===1||t==="1";default:return be(t)}}function q(n,t){let e={};for(let[i,r]of Object.entries(n)){let o=De(r,t[i]);o!==void 0&&(e[i]=o)}return e}var ve='"Roboto", "Helvetica", "Arial", sans-serif',Be=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:ve,fontSize:14,borderRadius:4}),Pe=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:ve,fontSize:14,borderRadius:4}),te=["primary","primaryContrast","secondary","secondaryContrast","background","paper","text","textSecondary","divider","error","warning","info","success","fontFamily"],ne=["fontSize","borderRadius"];function xe(n){return{...n==="dark"?Pe:Be}}function R(n){if(!n||typeof n!="object")return xe(typeof n=="string"?n:"light");let t=n,e=xe(typeof t.type=="string"?t.type:"light");for(let i of te){let r=t[i];typeof r=="string"&&r.trim()&&(e[i]=r.trim())}for(let i of ne){let r=t[i],o=typeof r=="string"?parseFloat(r):r;typeof o=="number"&&Number.isFinite(o)&&o>=0&&(e[i]=o)}return e}function we(n,t){return n.type===t.type&&te.every(e=>n[e]===t[e])&&ne.every(e=>n[e]===t[e])}function ye(n){return`--iob-${n.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function J(n){let t={};for(let e of te)t[ye(e)]=n[e];for(let e of ne)t[ye(e)]=`${n[e]}px`;return t["color-scheme"]=n.type,t}var Se={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"}},Ve=`
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 Ee(n){if(!n)return null;try{let t=new Function("data",`return (${n});`);return e=>{try{return!!t(e)}catch{return!1}}}catch{return null}}function ie(n){return typeof n=="string"?n:typeof n=="number"||typeof n=="boolean"?String(n):""}function He(n){let{input:t,setting:e}=n;if(t)return t instanceof HTMLInputElement&&t.type==="checkbox"?t.checked:t instanceof HTMLSelectElement?e.options?.[t.selectedIndex]?.value:t.value}function We(n,t,e,i,r){let o={name:t,setting:e,box:n.createElement("div"),hidden:Ee(e.hidden),disabled:Ee(e.disabled)},h=w(e.label,r);switch(e.type){case"header":return o.box=n.createElement("h3"),o.box.textContent=w(e.text,r)||h,o;case"staticText":return o.box=n.createElement("p"),o.box.textContent=w(e.text,r)||h,o;case"divider":return o.box=n.createElement("hr"),o;default:break}let p=n.createElement("label");o.box=p;let l=n.createElement("span");if(l.textContent=h||t,e.type==="checkbox"){let s=n.createElement("input");s.type="checkbox",s.checked=i===!0||i==="true",p.className="check",p.append(s,l),o.input=s}else if(e.type==="select"){let s=n.createElement("select");for(let a of e.options||[]){let b=n.createElement("option");b.textContent=w(a.label,r),s.append(b)}let f=(e.options||[]).findIndex(a=>String(a.value)===ie(i));s.selectedIndex=f===-1?0:f,p.append(l,s),o.input=s}else if(e.type==="text"&&(e.minRows||1)>1){let s=n.createElement("textarea");s.rows=e.minRows||2,s.value=ie(i),p.append(l,s),o.input=s}else{let s=n.createElement("input"),f=ie(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 a=n.createElement("output");a.textContent=s.value,s.addEventListener("input",()=>a.textContent=s.value),l.append(": ",a)}p.append(l,s),o.input=s}if(e.help){let s=n.createElement("span");s.className="help",s.textContent=w(e.help,r),p.append(s)}return o}function $e(n,t={}){let e=t.lang||"en",i=document,r=F=>Se[F][e]||Se[F].en||F,o=i.createElement("div");o.setAttribute("data-iob-dialog","");let h=o.attachShadow({mode:"open"}),p=i.createElement("style");p.textContent=Ve;let l=i.createElement("dialog"),s=R(t.theme);l.className=s.type==="dark"?"dark":"";for(let[F,V]of Object.entries(J(s)))l.style.setProperty(F,V);n.width&&(l.style.width=`${n.width}px`),n.height&&(l.style.height=`${n.height}px`);let f=i.createElement("form"),a=i.createElement("header"),b=i.createElement("span");b.textContent=w(n.title,e);let S=i.createElement("button");S.type="button",S.className="close",S.title=r("close"),S.setAttribute("aria-label",r("close")),S.textContent="\xD7",a.append(b,S);let P=i.createElement("div");return P.className="body",f.append(a,P),l.append(f),h.append(p,l),new Promise(F=>{let V=!1,I=C=>{V||(V=!0,l.open&&l.close(),o.remove(),F(C))};if(S.addEventListener("click",()=>I(null)),l.addEventListener("close",()=>I(null)),f.addEventListener("submit",C=>C.preventDefault()),U(n)){let C={},H=[];for(let[x,E]of Object.entries(n.form.items||{})){let Me=n.data?.[x]??E.default,fe=We(i,x,E,Me,e);H.push(fe),P.append(fe.box)}let le=()=>{for(let x of H)x.input&&(C[x.name]=He(x));return C},Z=()=>{let x=le();for(let E of H)E.box.hidden=E.hidden?E.hidden(x):!1,E.input&&(E.input.disabled=E.disabled?E.disabled(x):!1)};f.addEventListener("input",Z),f.addEventListener("change",Z),Z();let de=H.find(x=>x.input&&!x.box.hidden&&!x.input.disabled);de?.input&&(de.input.autofocus=!0);let pe=i.createElement("footer"),W=i.createElement("button");W.type="button",W.textContent=w(n.cancel,e)||r("cancel"),W.addEventListener("click",()=>I(null));let G=i.createElement("button");G.type="submit",G.className="primary",G.textContent=w(n.ok,e)||r("ok"),pe.append(W,G),f.append(pe),f.addEventListener("submit",()=>I(q(K(n.form),le())))}else P.append(n.element),l.addEventListener(he,C=>I(C.detail??null));i.body.append(o),l.showModal(),(!h.activeElement||h.activeElement===S)&&(l.tabIndex=-1,l.focus())})}function ke(n){return[...new Set(n.filter(t=>typeof t=="string"&&!!t))]}var Ge=["socket","dialogs","theme","editMode","settings","value"],$,j,T,k,L,z,m,N,M,B,d,re,A,D,Ce,_e,oe,se,_,X=class extends HTMLElement{constructor(){super(...arguments);y(this,d);Q(this,"states",{});Q(this,"objects",{});y(this,$,null);y(this,j,{});y(this,T,R("light"));y(this,k,!1);y(this,L,null);y(this,z);y(this,m,null);y(this,N,!1);y(this,M,(e,i)=>{c(this,m)?.states.includes(e)&&(this.states[e]=i||null,u(this,d,_).call(this))});y(this,B,(e,i)=>{c(this,m)?.objects.includes(e)&&(this.objects[e]=i||null,u(this,d,A).call(this))})}get socket(){return c(this,$)}set socket(e){v(this,$,e||null),u(this,d,A).call(this)}get settings(){return c(this,j)}set settings(e){v(this,j,e||{}),u(this,d,A).call(this)}get theme(){return c(this,T)}set theme(e){let i=R(e);we(i,c(this,T))||(v(this,T,i),u(this,d,re).call(this),u(this,d,_).call(this))}get editMode(){return c(this,k)}set editMode(e){let i=!!e;i!==c(this,k)&&(v(this,k,i),u(this,d,_).call(this))}get dialogs(){return c(this,L)}set dialogs(e){v(this,L,e||null)}get value(){return c(this,z)}set value(e){e!==c(this,z)&&(v(this,z,e),u(this,d,_).call(this))}connectedCallback(){for(let e of Ge)if(Object.prototype.hasOwnProperty.call(this,e)){let i=this[e];delete this[e],this[e]=i}u(this,d,re).call(this),u(this,d,A).call(this)}disconnectedCallback(){u(this,d,se).call(this)}getStateIds(e){return[]}getObjectIds(e){return[]}get systemLang(){return c(this,$)?.systemLang||"en"}text(e){return w(e,this.systemLang)}setState(e,i){return c(this,$)&&!c(this,k)?c(this,$).setState(e,i):Promise.resolve()}changeValue(e){return c(this,k)||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(c(this,k))return null;let i=c(this,L)?await c(this,L).open(e):await $e(e,{lang:this.systemLang,theme:c(this,T)});return U(e)?i&&typeof i=="object"?q(K(e.form),i):null:i??null}};$=new WeakMap,j=new WeakMap,T=new WeakMap,k=new WeakMap,L=new WeakMap,z=new WeakMap,m=new WeakMap,N=new WeakMap,M=new WeakMap,B=new WeakMap,d=new WeakSet,re=function(){for(let[e,i]of Object.entries(J(c(this,T))))this.style.setProperty(e,i)},A=function(){if(!this.isConnected)return;let e=c(this,$),i=e?ke(this.getStateIds(c(this,j))):[],r=e?ke(this.getObjectIds(c(this,j))):[];c(this,m)&&c(this,m).socket!==e&&u(this,d,se).call(this);let o=c(this,m)?.states||[],h=c(this,m)?.objects||[],p=o.filter(a=>!i.includes(a)),l=h.filter(a=>!r.includes(a)),s=i.filter(a=>!o.includes(a)),f=r.filter(a=>!h.includes(a));e&&p.length&&e.unsubscribeState(p,c(this,M)),e&&l.length&&u(this,d,oe).call(this,e,l);for(let a of p)delete this.states[a];for(let a of[...p,...l])!i.includes(a)&&!r.includes(a)&&delete this.objects[a];v(this,m,e&&(i.length||r.length)?{socket:e,states:i,objects:r}:null),e&&s.length&&u(this,d,Ce).call(this,e,s),e&&f.length&&u(this,d,_e).call(this,e,f),u(this,d,_).call(this)},D=function(e,i,r){return c(this,m)?.socket===e&&c(this,m)[i].includes(r)},Ce=function(e,i){e.subscribeState(i,c(this,M)).catch(r=>console.warn(`<${this.localName}>: cannot subscribe ${i.join(", ")}: ${r}`));for(let r of i)e.getState(r).then(o=>{u(this,d,D).call(this,e,"states",r)&&this.states[r]===void 0&&(this.states[r]=o||null,u(this,d,_).call(this))}).catch(()=>{}),e.getObject(r).then(o=>{u(this,d,D).call(this,e,"states",r)&&!u(this,d,D).call(this,e,"objects",r)&&(this.objects[r]=o||null,u(this,d,_).call(this))}).catch(()=>{})},_e=function(e,i){e.subscribeObject(i,c(this,B)).catch(r=>console.warn(`<${this.localName}>: cannot subscribe the objects ${i.join(", ")}: ${r}`));for(let r of i)e.getObject(r).then(o=>{u(this,d,D).call(this,e,"objects",r)&&(this.objects[r]=o||null,u(this,d,A).call(this))}).catch(()=>{})},oe=function(e,i){e.unsubscribeObject(i,c(this,B)).catch(()=>{})},se=function(){if(c(this,m)){let{socket:e,states:i,objects:r}=c(this,m);i.length&&e.unsubscribeState(i,c(this,M)),r.length&&u(this,d,oe).call(this,e,r),v(this,m,null)}this.states={},this.objects={}},_=function(){c(this,N)||(v(this,N,!0),queueMicrotask(()=>{v(this,N,!1),this.isConnected&&this.render()}))};function Te(n,t){let e=typeof n=="string"?n:n.tag;customElements.get(e)||customElements.define(e,t)}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},Ue={small:120,medium:180,large:240},Y={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"}},Fe={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 g(n){return String(n??"").replace(/[&<>"]/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[t])}function je(n){let t=String(n||"").replace(/^system\.adapter\./,"").split(".");return{instance:t.length>=2?`${t[0]}.${t[1]}`:"",camera:t.length>=3&&/^cam_/.test(t[2])?t[2]:""}}function ae(n){let t=n&&n.val;if(typeof t!="string"||!t)return null;try{return JSON.parse(t)}catch{return null}}function Le(n,t){if(n.mode==="custom"){let e={...O};for(let[i,r]of Object.entries(n))r!=null&&(e[i]=r);return e.minCol=Ue[e.thumbSize]||Number(e.minCol)||150,e}return!t||!t.settings?null:{...O,...t.settings}}function Oe(n,t){return{...Fe[t]||Fe.en,...n&&n.labels||{}}}function Ae(n,t,e){let i=n.compact?6:12,r=`${Math.max(0,Number(n.borderRadius)||0)}px`,o=t?{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:n.colorCardBg||O.colorCardBg,tagBg:n.colorTagBg||O.colorTagBg,tagText:n.colorTagText||O.colorTagText,accent:n.colorAccent||O.colorAccent,modal:n.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:${t?"var(--iob-primary-contrast)":"#fff"};border-color:var(--adv-accent)}.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(${Number(n.minCol)||150}px,1fr));gap:${i}px}.fitted{overflow:hidden;display:flex;align-items:center;justify-content:center}.fitted .grid{justify-content:center;align-content:center}.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:${n.compact?".65rem":".72rem"};margin-top:${n.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(n.maxModalWidth)||900}px);width:min(92vw,${Number(n.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 ze(n){let t=document.createElement("dialog");t.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=t.querySelector("video"),i=t.querySelector(".info"),r=()=>t.open&&t.close();return t.querySelector(".close").addEventListener("click",r),t.addEventListener("click",o=>o.target===t&&r()),t.addEventListener("close",()=>{try{e.pause()}catch{}e.removeAttribute("src"),e.removeAttribute("style");try{e.load()}catch{}}),n.appendChild(t),{el:t,open(o,h,p){p&&(e.style.aspectRatio=p.replace("/"," / "),e.style.objectFit="fill"),e.setAttribute("src",o),i.innerHTML=h,t.open||t.showModal(),e.play&&e.play().catch(()=>{})}}}function Ne(n,t){let e=encodeURIComponent,i=n.replace(/{video}/g,e(t.video)).replace(/{videoRaw}/g,t.video).replace(/{fn}/g,e(t.fn||"")).replace(/{date}/g,e(t.date)).replace(/{time}/g,e(t.time)).replace(/{duration}/g,e(t.dur)).replace(/{size}/g,e(String(t.size))).replace(/{tags}/g,e(t.tag||""));window.open(i,"_blank","noopener")}var ce=class extends X{constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML='<style></style><div class="root"></div>',this._player=ze(this.shadowRoot),this._view={q:"",tag:null},this._key="",this._items=[],this._cfg=null,this._labels={}}_target(t){return je(t.mode==="custom"?t.camera:t.widget)}getStateIds(t){let e=this._target(t);return e.instance&&e.camera?[`${e.instance}.widget_config`,`${e.instance}.${e.camera}.widget_data`]:[]}render(){let t=this.settings||{},e=this._target(t),i=this.shadowRoot.querySelector(".root"),r=e.instance?ae(this.states[`${e.instance}.widget_config`]):null,o=Le(t,r),h=this.shadowRoot.querySelector("style"),p=Ae(o||{},!!t.follow,this.editMode);if(h.textContent!==p&&(h.textContent=p),!e.instance||!e.camera)return this._key="",this._msg(i,this.text(t.mode==="custom"?Y.pickCamera:Y.pickWidget));let l=ae(this.states[`${e.instance}.${e.camera}.widget_data`]);if(!o||!l)return this._key="",this._msg(i,this.text(Y.waiting));let s=JSON.stringify([o,this.states[`${e.instance}.${e.camera}.widget_data`]?.ts,this.systemLang]);if(s===this._key)return;let f=!this._cfg||JSON.stringify(this._cfg)!==JSON.stringify(o);this._key=s,this._cfg=o,this._labels=Oe(r,this.systemLang);let a=(Array.isArray(l.recordings)?l.recordings:[]).slice(0,Math.max(1,Number(o.count)||50));o.sortNewest===!1&&(a=a.reverse()),this._items=a,f&&(this._view={q:"",tag:null}),this._draw(i)}_msg(t,e){t.innerHTML=`<div class="msg">${g(e)}</div>`}_draw(t){let e=this._cfg,i=this._labels,r=e.widgetMode==="js",o="";if(r){this._view.tag===null&&(this._view.tag=String(e.defaultTag||"").trim());let p=new Set;for(let a of this._items)String(a.tag||"").split(/[,\s]+/).forEach(b=>b&&p.add(b));let l=(a,b)=>`<button class="tagbtn${this._view.tag===b?" on":""}" data-tag="${g(b)}">${g(a)}</button>`,s=e.showTags&&p.size?l(i.all,"")+[...p].map(a=>l(a,a)).join(""):"",f=e.showSearch!==!1?`<input class="search" type="text" placeholder="${g(i.search)}" value="${g(this._view.q)}">`:"";(f||s)&&(o=`<div class="bar">${f}<div class="tags">${s}</div></div>`)}t.innerHTML=`${o}<div class="grid"></div>`;let h=t.querySelector(".search");h&&h.addEventListener("input",()=>{this._view.q=h.value,this._drawGrid(t)});for(let p of t.querySelectorAll(".tagbtn"))p.addEventListener("click",()=>{let l=p.getAttribute("data-tag")||"";this._view.tag=this._view.tag===l?"":l;for(let s of t.querySelectorAll(".tagbtn"))s.classList.toggle("on",(s.getAttribute("data-tag")||"")===this._view.tag);this._drawGrid(t)});this._drawGrid(t)}_drawGrid(t){let e=this._cfg,i=this._labels,r=e.widgetMode==="js",o=r?this._view.q.toLowerCase():"",h=r?String(this._view.tag||"").toLowerCase():"",p=String(e.tagPosition||"bottom-left").split("-"),l="";this._items.forEach((a,b)=>{if(h&&String(a.tag||"").toLowerCase().indexOf(h)<0||o&&`${a.date||""} ${a.time||""} ${a.tag||""}`.toLowerCase().indexOf(o)<0)return;let S=e.showTags&&a.tag?`<span class="tag" style="${p[0]}:5px;${p[1]}:5px">${g(a.tag)}</span>`:"";l+=`<div class="cell" data-i="${b}"><span class="img"><img loading="lazy" alt="" src="${g(a.thumb)}">${S}<span class="play"></span></span><span class="cap">${g(a.date)} ${g(a.time)}<br>${g(a.dur)}s &middot; ${g(a.size)} MB</span></div>`});let s=t.querySelector(".grid");if(!l){s.outerHTML=`<div class="grid"></div><div class="empty">${g(i.noRecordings)}</div>`;return}let f=t.querySelector(".empty");f&&f.remove(),s.innerHTML=l;for(let a of s.querySelectorAll(".cell"))a.addEventListener("click",()=>this._open(this._items[Number(a.getAttribute("data-i"))]))}_open(t){if(!t||this.editMode)return;let e=this._cfg;if(e.playerUrl)return Ne(String(e.playerUrl),t);let i=`${g(t.date)} ${g(t.time)}${t.dur?` &middot; ${g(t.dur)}s`:""}${t.size!=null?` &middot; ${g(t.size)} MB`:""}${t.tag?` &middot; ${g(t.tag)}`:""} &middot; <a href="${g(t.video)}" download target="_blank" rel="noopener">${g(this._labels.download)}</a>`;this._player.open(t.video,i)}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),this._player.el.open&&this._player.el.close()}};Te("iob-agent-dvr-recordings",ce);