feat: add fresh-water cascades with independent stations and buffer links

This commit is contained in:
jhartworks committed 2026-11-12 16:16:01 +01:00
1 parent a2a119d3ee
commit 992c3e18f2
30 files changed
+2199 -1578

No files matched your search

File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -1,7 +1,7 @@
/*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */
var Z=globalThis,J=Z.ShadowRoot&&(Z.ShadyCSS===void 0||Z.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Q=Symbol(),yt=new WeakMap,U=class{constructor(t,n,e){if(this._$cssResult$=!0,e!==Q)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=n}get styleSheet(){let t=this.o,n=this.t;if(J&&t===void 0){let e=n!==void 0&&n.length===1;e&&(t=yt.get(n)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&yt.set(n,t))}return t}toString(){return this.cssText}},vt=i=>new U(typeof i=="string"?i:i+"",void 0,Q),x=(i,...t)=>{let n=i.length===1?i[0]:t.reduce((e,r,s)=>e+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+i[s+1],i[0]);return new U(n,i,Q)},xt=(i,t)=>{if(J)i.adoptedStyleSheets=t.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(let n of t){let e=document.createElement("style"),r=Z.litNonce;r!==void 0&&e.setAttribute("nonce",r),e.textContent=n.cssText,i.appendChild(e)}},tt=J?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let n="";for(let e of t.cssRules)n+=e.cssText;return vt(n)})(i):i;var{is:It,defineProperty:Wt,getOwnPropertyDescriptor:Kt,getOwnPropertyNames:qt,getOwnPropertySymbols:Zt,getPrototypeOf:Jt}=Object,Y=globalThis,$t=Y.trustedTypes,Yt=$t?$t.emptyScript:"",Xt=Y.reactiveElementPolyfillSupport,z=(i,t)=>i,et={toAttribute(i,t){switch(t){case Boolean:i=i?Yt:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let n=i;switch(t){case Boolean:n=i!==null;break;case Number:n=i===null?null:Number(i);break;case Object:case Array:try{n=JSON.parse(i)}catch{n=null}}return n}},wt=(i,t)=>!It(i,t),_t={attribute:!0,type:String,converter:et,reflect:!1,useDefault:!1,hasChanged:wt};Symbol.metadata??=Symbol("metadata"),Y.litPropertyMetadata??=new WeakMap;var w=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,n=_t){if(n.state&&(n.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((n=Object.create(n)).wrapped=!0),this.elementProperties.set(t,n),!n.noAccessor){let e=Symbol(),r=this.getPropertyDescriptor(t,e,n);r!==void 0&&Wt(this.prototype,t,r)}}static getPropertyDescriptor(t,n,e){let{get:r,set:s}=Kt(this.prototype,t)??{get(){return this[n]},set(o){this[n]=o}};return{get:r,set(o){let c=r?.call(this);s?.call(this,o),this.requestUpdate(t,c,e)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??_t}static _$Ei(){if(this.hasOwnProperty(z("elementProperties")))return;let t=Jt(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(z("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(z("properties"))){let n=this.properties,e=[...qt(n),...Zt(n)];for(let r of e)this.createProperty(r,n[r])}let t=this[Symbol.metadata];if(t!==null){let n=litPropertyMetadata.get(t);if(n!==void 0)for(let[e,r]of n)this.elementProperties.set(e,r)}this._$Eh=new Map;for(let[n,e]of this.elementProperties){let r=this._$Eu(n,e);r!==void 0&&this._$Eh.set(r,n)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let n=[];if(Array.isArray(t)){let e=new Set(t.flat(1/0).reverse());for(let r of e)n.unshift(tt(r))}else t!==void 0&&n.push(tt(t));return n}static _$Eu(t,n){let e=n.attribute;return e===!1?void 0:typeof e=="string"?e:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,n=this.constructor.elementProperties;for(let e of n.keys())this.hasOwnProperty(e)&&(t.set(e,this[e]),delete this[e]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return xt(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,n,e){this._$AK(t,e)}_$ET(t,n){let e=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,e);if(r!==void 0&&e.reflect===!0){let s=(e.converter?.toAttribute!==void 0?e.converter:et).toAttribute(n,e.type);this._$Em=t,s==null?this.removeAttribute(r):this.setAttributeLine truncated
\f\r]`,L=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Et=/-->/g,kt=/>/g,S=RegExp(`>|${nt}(?:([^\\s"'>=/]+)(${nt}*=${nt}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ht=/'/g,Ct=/"/g,Mt=/^(?:script|style|textarea|title)$/i,dt=i=>(t,...n)=>({_$litType$:i,strings:t,values:n}),p=dt(1),pe=dt(2),fe=dt(3),H=Symbol.for("lit-noChange"),a=Symbol.for("lit-nothing"),Rt=new WeakMap,E=k.createTreeWalker(k,129);function Ot(i,t){if(!ct(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return St!==void 0?St.createHTML(t):t}var te=(i,t)=>{let n=i.length-1,e=[],r,s=t===2?"<svg>":t===3?"<math>":"",o=L;for(let c=0;c<n;c++){let l=i[c],u,h,d=-1,f=0;for(;f<l.length&&(o.lastIndex=f,h=o.exec(l),h!==null);)f=o.lastIndex,o===L?h[1]==="!--"?o=Et:h[1]!==void 0?o=kt:h[2]!==void 0?(Mt.test(h[2])&&(r=RegExp("</"+h[2],"g")),o=S):h[3]!==void 0&&(o=S):o===S?h[0]===">"?(o=r??L,d=-1):h[1]===void 0?d=-2:(d=o.lastIndex-h[2].length,u=h[1],o=h[3]===void 0?S:h[3]==='"'?Ct:Ht):o===Ct||o===Ht?o=S:o===Et||o===kt?o=L:(o=S,r=void 0);let v=o===S&&i[c+1].startsWith("/>")?" ":"";s+=o===L?l+Gt:d>=0?(e.push(u),l.slice(0,d)+Pt+l.slice(d)+A+v):l+A+(d===-2?c:v)}return[Ot(i,s+(i[n]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),e]},j=class i{constructor({strings:t,_$litType$:n},e){let r;this.parts=[];let s=0,o=0,c=t.length-1,l=this.parts,[u,h]=te(t,n);if(this.el=i.createElement(u,e),E.currentNode=this.el.content,n===2||n===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(r=E.nextNode())!==null&&l.length<c;){if(r.nodeType===1){if(r.hasAttributes())for(let d of r.getAttributeNames())if(d.endsWith(Pt)){let f=h[o++],v=r.getAttribute(d).split(A),_=/([.?@])?(.*)/.exec(f);l.push({type:1,index:s,name:_[2],strings:v,ctor:_[1]==="."?rt:_[1]==="?"?st:_[1]==="@"?ot:P}),r.removeAttribute(d)}else d.startsWith(A)&&(l.push({type:6,index:s}),r.removeAttribute(d));if(Mt.test(r.tagName)){let d=r.textContent.split(A),f=d.length-1;if(f>0){r.textContent=X?X.emptyScript:"";for(let v=0;v<f;v++)r.append(d[v],D()),E.nextNode(),l.push({type:2,index:++s});r.append(d[f],D())}}}else if(r.nodeType===8)if(r.data===Nt)l.push({type:2,index:s});else{let d=-1;for(;(d=r.data.indexOf(A,d+1))!==-1;)l.push({type:7,index:s}),d+=A.length-1}s++}}static createElement(t,n){let e=k.createElement("template");return e.innerHTML=t,e}};function R(i,t,n=i,e){if(t===H)return t;let r=e!==void 0?n._$Co?.[e]:n._$Cl,s=F(t)?void 0:t._$litDirective$;return r?.constructor!==s&&(r?._$AO?.(!1),s===void 0?r=void 0:(r=new s(i),r._$AT(i,n,e)),e!==void 0?(n._$Co??=[])[e]=r:n._$Cl=r),r!==void 0&&(t=R(i,r._$AS(i,t.values),r,e)),t}var it=class{constructor(t,n){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=n}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:n},parts:e}=this._$AD,r=(t?.creationScope??k).importNode(n,!0);E.currentNode=r;let s=E.nextNode(),o=0,c=0,l=e[0];for(;l!==void 0;){if(o===l.index){let u;l.type===2?u=new V(s,s.nextSibling,this,t):l.type===1?u=new l.ctor(s,l.name,l.strings,this,t):l.type===6&&(u=new at(s,this,t)),this._$AV.push(u),l=e[++c]}o!==l?.index&&(s=E.nextNode(),o++)}return E.currentNode=k,r}p(t){let n=0;for(let e of this._$AV)e!==void 0&&(e.strings!==void 0?(e._$AI(t,e,n),n+=e.strings.length-2):e._$AI(t[n])),n++}},V=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,n,e,r){this.type=2,this._$AH=a,this._$AN=void 0,this._$AA=t,this._$AB=n,this._$AM=e,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,n=this._$AM;return n!==void 0&&t?.nodeType===11&&(t=n.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,n=this){t=R(this,t,n),F(t)?t===a||t==null||t===""?(this._$AH!==a&&this._$AR(),this._$AH=a):t!==this._$AH&&t!==H&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Qt(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==a&&F(this._$AH)?this._$AA.nextSibling.data=t:this.T(k.createTextNode(t)),this._$AH=t}$(t){let{values:n,_$litType$:e}=t,r=typeof e=="number"?this._$AC(t):(e.el===void 0&&(e.el=j.createElement(Ot(e.h,e.h[0]),this.options)),e);if(this._$AH?._$AD===r)this._$AH.p(n);else{let s=new it(r,this),o=s.u(this.options);s.p(n),this.T(o),this._$AH=s}}_$AC(t){let n=Rt.get(t.strings);return n===void 0&&Rt.set(t.strings,n=new j(t)),n}k(t){ct(this._$AH)||(this._$AH=[],this._$AR());let n=this._$AH,e,r=0;for(let s of t)r===n.length?n.push(e=new i(this.O(D()),this.O(D()),this,this.options)):e=n[r],e._$AI(s),r++;r<n.length&&(this._$AR(e&&e._$AB.nextSibling,r),n.length=r)}_$AR(t=this._$AA.nextSibling,n){for(this._$AP?.(!1,!0,n);t!==this._$AB;){let e=At(t).nextSibling;At(t).remove(),t=e}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},P=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,n,e,r,s){this.type=1,this._$AH=a,this._$AN=void 0,this.element=t,this.name=n,this._$AM=r,this.options=s,e.length>2||e[0]!==""||e[1]!==""?(this._$AH=Array(e.length-1).fill(new String),this.strings=e)Line truncated
var Y=globalThis,G=Y.ShadowRoot&&(Y.ShadyCSS===void 0||Y.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,nt=Symbol(),_t=new WeakMap,D=class{constructor(t,n,i){if(this._$cssResult$=!0,i!==nt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=n}get styleSheet(){let t=this.o,n=this.t;if(G&&t===void 0){let i=n!==void 0&&n.length===1;i&&(t=_t.get(n)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&_t.set(n,t))}return t}toString(){return this.cssText}},wt=r=>new D(typeof r=="string"?r:r+"",void 0,nt),y=(r,...t)=>{let n=r.length===1?r[0]:t.reduce((i,e,o)=>i+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(e)+r[o+1],r[0]);return new D(n,r,nt)},St=(r,t)=>{if(G)r.adoptedStyleSheets=t.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(let n of t){let i=document.createElement("style"),e=Y.litNonce;e!==void 0&&i.setAttribute("nonce",e),i.textContent=n.cssText,r.appendChild(i)}},it=G?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let n="";for(let i of t.cssRules)n+=i.cssText;return wt(n)})(r):r;var{is:Jt,defineProperty:Xt,getOwnPropertyDescriptor:Yt,getOwnPropertyNames:Gt,getOwnPropertySymbols:Qt,getPrototypeOf:te}=Object,Q=globalThis,At=Q.trustedTypes,ee=At?At.emptyScript:"",ne=Q.reactiveElementPolyfillSupport,V=(r,t)=>r,rt={toAttribute(r,t){switch(t){case Boolean:r=r?ee:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,t){let n=r;switch(t){case Boolean:n=r!==null;break;case Number:n=r===null?null:Number(r);break;case Object:case Array:try{n=JSON.parse(r)}catch{n=null}}return n}},Ht=(r,t)=>!Jt(r,t),Et={attribute:!0,type:String,converter:rt,reflect:!1,useDefault:!1,hasChanged:Ht};Symbol.metadata??=Symbol("metadata"),Q.litPropertyMetadata??=new WeakMap;var w=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,n=Et){if(n.state&&(n.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((n=Object.create(n)).wrapped=!0),this.elementProperties.set(t,n),!n.noAccessor){let i=Symbol(),e=this.getPropertyDescriptor(t,i,n);e!==void 0&&Xt(this.prototype,t,e)}}static getPropertyDescriptor(t,n,i){let{get:e,set:o}=Yt(this.prototype,t)??{get(){return this[n]},set(s){this[n]=s}};return{get:e,set(s){let c=e?.call(this);o?.call(this,s),this.requestUpdate(t,c,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Et}static _$Ei(){if(this.hasOwnProperty(V("elementProperties")))return;let t=te(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(V("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(V("properties"))){let n=this.properties,i=[...Gt(n),...Qt(n)];for(let e of i)this.createProperty(e,n[e])}let t=this[Symbol.metadata];if(t!==null){let n=litPropertyMetadata.get(t);if(n!==void 0)for(let[i,e]of n)this.elementProperties.set(i,e)}this._$Eh=new Map;for(let[n,i]of this.elementProperties){let e=this._$Eu(n,i);e!==void 0&&this._$Eh.set(e,n)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let n=[];if(Array.isArray(t)){let i=new Set(t.flat(1/0).reverse());for(let e of i)n.unshift(it(e))}else t!==void 0&&n.push(it(t));return n}static _$Eu(t,n){let i=n.attribute;return i===!1?void 0:typeof i=="string"?i:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,n=this.constructor.elementProperties;for(let i of n.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return St(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,n,i){this._$AK(t,i)}_$ET(t,n){let i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(e!==void 0&&i.reflect===!0){let o=(i.converter?.toAttribute!==void 0?i.converter:rt).toAttribute(n,i.type);this._$Em=t,o==null?this.removeAttribute(e):this.setAttriLine truncated
\f\r]`,j=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Rt=/-->/g,Nt=/>/g,k=RegExp(`>|${ot}(?:([^\\s"'>=/]+)(${ot}*=${ot}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),Pt=/'/g,Mt=/"/g,zt=/^(?:script|style|textarea|title)$/i,pt=r=>(t,...n)=>({_$litType$:r,strings:t,values:n}),d=pt(1),ye=pt(2),ve=pt(3),N=Symbol.for("lit-noChange"),a=Symbol.for("lit-nothing"),Tt=new WeakMap,C=R.createTreeWalker(R,129);function Ut(r,t){if(!ht(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ct!==void 0?Ct.createHTML(t):t}var oe=(r,t)=>{let n=r.length-1,i=[],e,o=t===2?"<svg>":t===3?"<math>":"",s=j;for(let c=0;c<n;c++){let l=r[c],h,p,u=-1,m=0;for(;m<l.length&&(s.lastIndex=m,p=s.exec(l),p!==null);)m=s.lastIndex,s===j?p[1]==="!--"?s=Rt:p[1]!==void 0?s=Nt:p[2]!==void 0?(zt.test(p[2])&&(e=RegExp("</"+p[2],"g")),s=k):p[3]!==void 0&&(s=k):s===k?p[0]===">"?(s=e??j,u=-1):p[1]===void 0?u=-2:(u=s.lastIndex-p[2].length,h=p[1],s=p[3]===void 0?k:p[3]==='"'?Mt:Pt):s===Mt||s===Pt?s=k:s===Rt||s===Nt?s=j:(s=k,e=void 0);let $=s===k&&r[c+1].startsWith("/>")?" ":"";o+=s===j?l+ie:u>=0?(i.push(h),l.slice(0,u)+Ot+l.slice(u)+A+$):l+A+(u===-2?c:$)}return[Ut(r,o+(r[n]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),i]},K=class r{constructor({strings:t,_$litType$:n},i){let e;this.parts=[];let o=0,s=0,c=t.length-1,l=this.parts,[h,p]=oe(t,n);if(this.el=r.createElement(h,i),C.currentNode=this.el.content,n===2||n===3){let u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(e=C.nextNode())!==null&&l.length<c;){if(e.nodeType===1){if(e.hasAttributes())for(let u of e.getAttributeNames())if(u.endsWith(Ot)){let m=p[s++],$=e.getAttribute(u).split(A),_=/([.?@])?(.*)/.exec(m);l.push({type:1,index:o,name:_[2],strings:$,ctor:_[1]==="."?at:_[1]==="?"?lt:_[1]==="@"?ct:M}),e.removeAttribute(u)}else u.startsWith(A)&&(l.push({type:6,index:o}),e.removeAttribute(u));if(zt.test(e.tagName)){let u=e.textContent.split(A),m=u.length-1;if(m>0){e.textContent=tt?tt.emptyScript:"";for(let $=0;$<m;$++)e.append(u[$],B()),C.nextNode(),l.push({type:2,index:++o});e.append(u[m],B())}}}else if(e.nodeType===8)if(e.data===Ft)l.push({type:2,index:o});else{let u=-1;for(;(u=e.data.indexOf(A,u+1))!==-1;)l.push({type:7,index:o}),u+=A.length-1}o++}}static createElement(t,n){let i=R.createElement("template");return i.innerHTML=t,i}};function P(r,t,n=r,i){if(t===N)return t;let e=i!==void 0?n._$Co?.[i]:n._$Cl,o=I(t)?void 0:t._$litDirective$;return e?.constructor!==o&&(e?._$AO?.(!1),o===void 0?e=void 0:(e=new o(r),e._$AT(r,n,i)),i!==void 0?(n._$Co??=[])[i]=e:n._$Cl=e),e!==void 0&&(t=P(r,e._$AS(r,t.values),e,i)),t}var st=class{constructor(t,n){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=n}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:n},parts:i}=this._$AD,e=(t?.creationScope??R).importNode(n,!0);C.currentNode=e;let o=C.nextNode(),s=0,c=0,l=i[0];for(;l!==void 0;){if(s===l.index){let h;l.type===2?h=new W(o,o.nextSibling,this,t):l.type===1?h=new l.ctor(o,l.name,l.strings,this,t):l.type===6&&(h=new ut(o,this,t)),this._$AV.push(h),l=i[++c]}s!==l?.index&&(o=C.nextNode(),s++)}return C.currentNode=R,e}p(t){let n=0;for(let i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,n),n+=i.strings.length-2):i._$AI(t[n])),n++}},W=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,n,i,e){this.type=2,this._$AH=a,this._$AN=void 0,this._$AA=t,this._$AB=n,this._$AM=i,this.options=e,this._$Cv=e?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,n=this._$AM;return n!==void 0&&t?.nodeType===11&&(t=n.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,n=this){t=P(this,t,n),I(t)?t===a||t==null||t===""?(this._$AH!==a&&this._$AR(),this._$AH=a):t!==this._$AH&&t!==N&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):re(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==a&&I(this._$AH)?this._$AA.nextSibling.data=t:this.T(R.createTextNode(t)),this._$AH=t}$(t){let{values:n,_$litType$:i}=t,e=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=K.createElement(Ut(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===e)this._$AH.p(n);else{let o=new st(e,this),s=o.u(this.options);o.p(n),this.T(s),this._$AH=o}}_$AC(t){let n=Tt.get(t.strings);return n===void 0&&Tt.set(t.strings,n=new K(t)),n}k(t){ht(this._$AH)||(this._$AH=[],this._$AR());let n=this._$AH,i,e=0;for(let o of t)e===n.length?n.push(i=new r(this.O(B()),this.O(B()),this,this.options)):i=n[e],i._$AI(o),e++;e<n.length&&(this._$AR(i&&i._$AB.nextSibling,e),n.length=e)}_$AR(t=this._$AA.nextSibling,n){for(this._$AP?.(!1,!0,n);t!==this._$AB;){let i=kt(t).nextSibling;kt(t).remove(),t=i}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},M=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,n,i,e,o){this.type=1,this._$AH=a,this._$AN=void 0,this.element=t,this.name=n,this._$AM=e,this.options=o,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=Line truncated
:host {
--nf-text: var(--primary-text-color, #e1e1e1);
--nf-muted: var(--secondary-text-color, #9b9b9b);
@@ -29,7 +29,7 @@ var Z=globalThis,J=Z.ShadowRoot&&(Z.ShadyCSS===void 0||Z.ShadyCSS.nativeShadow)&
font-family: var(--nf-font);
color: var(--nf-text);
}
`,Me=x`
`,Ve=y`
:host([readable]) {
--secondary-text-color: var(--primary-text-color, #e1e1e1);
--divider-color: color-mix(in srgb, var(--primary-text-color, #e1e1e1) 40%, transparent);
@@ -40,7 +40,7 @@ var Z=globalThis,J=Z.ShadowRoot&&(Z.ShadyCSS===void 0||Z.ShadyCSS.nativeShadow)&
:host([readable]) .nf-overlay {
zoom: 1.2;
}
`,Oe=x`
`,je=y`
/* a group of switches: one rounded pill, the active one tinted with the accent */
.nf-seg {
display: inline-flex;
@@ -203,30 +203,32 @@ var Z=globalThis,J=Z.ShadowRoot&&(Z.ShadyCSS===void 0||Z.ShadyCSS.nativeShadow)&
min-height: 40px;
}
}
`;function pt(i,t){let n=new Set;return t.flatMap(e=>{let r=String(i?.states[e]?.attributes.symcon_source_entity||e),s=i?.states[r]?.attributes,o=Number(s?.symcon_id);return!o||!s?.symcon_archive||n.has(o)?[]:(n.add(o),[r])})}var zt,ft=class extends b{static properties={hass:{attribute:!1},ids:{attribute:!1},label:{attribute:!1},busy:{state:!0},error:{state:!0}};constructor(){super(),this.ids=[],this.label="",this.busy=!1,this.error=""}async open(t){t.stopPropagation(),this.busy=!0,this.error="";try{let n=new URL("./nextfloor-trend.js?v=84417e0b2573",import.meta.url).href;await(await(zt??=import(n).catch(r=>{throw zt=void 0,r}))).openTrend(this.hass,this.ids,this.label)}catch(n){this.error=n instanceof Error?n.message:String(n)}finally{this.busy=!1}}render(){if(!pt(this.hass,this.ids).length)return a;let t=this.label?`Trend anzeigen: ${this.label}`:"Trend anzeigen";return p`<button type="button" title=${t} aria-label=${t} aria-haspopup="dialog" ?disabled=${this.busy} @pointerdown=${n=>n.stopPropagation()} @click=${n=>{this.open(n)}}>
`;function gt(r,t){let n=new Set;return t.flatMap(i=>{let e=String(r?.states[i]?.attributes.symcon_source_entity||i),o=r?.states[e]?.attributes,s=Number(o?.symcon_id);return!s||!o?.symcon_archive||n.has(s)?[]:(n.add(s),[e])})}var Vt,bt=class extends v{static properties={hass:{attribute:!1},ids:{attribute:!1},label:{attribute:!1},busy:{state:!0},error:{state:!0}};constructor(){super(),this.ids=[],this.label="",this.busy=!1,this.error=""}async open(t){t.stopPropagation(),this.busy=!0,this.error="";try{let n=new URL("./nextfloor-trend.js?v=84417e0b2573",import.meta.url).href;await(await(Vt??=import(n).catch(e=>{throw Vt=void 0,e}))).openTrend(this.hass,this.ids,this.label)}catch(n){this.error=n instanceof Error?n.message:String(n)}finally{this.busy=!1}}render(){if(!gt(this.hass,this.ids).length)return a;let t=this.label?`Trend anzeigen: ${this.label}`:"Trend anzeigen";return d`<button type="button" title=${t} aria-label=${t} aria-haspopup="dialog" ?disabled=${this.busy} @pointerdown=${n=>n.stopPropagation()} @click=${n=>{this.open(n)}}>
<svg width="12" height="12" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M3 2v15h15M5 13l4-5 4 2 4-6"/></svg>
</button>${this.error?p`<span role="alert">${this.error}</span>`:a}`}static styles=x`:host{position:relative;display:inline-flex;flex:0 0 18px;width:18px;height:18px;vertical-align:middle;margin-left:3px;font-weight:normal;line-height:0}button{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:18px;height:18px;padding:2px;border:0;border-radius:3px;background:transparent;color:var(--nf-accent,#40c8ff);opacity:.8;cursor:pointer}svg{display:block;flex-shrink:0}button:hover,button:focus-visible{opacity:1;background:#40c8ff18}button:focus-visible{outline:1px solid currentColor;outline-offset:1px}button:disabled{opacity:.4}span{position:absolute;right:0;top:22px;z-index:10;box-sizing:border-box;width:200px;padding:8px;border:1px solid #ff9b9b50;border-radius:6px;background:var(--nf-chrome-solid,#1c1c1c);font:12px/1.4 system-ui;color:#ff9b9b;white-space:normal}`};customElements.get("nf-trend-button")||customElements.define("nf-trend-button",ft);function G(i,t,n=""){let e=pt(i,t);return e.length?p`<nf-trend-button .hass=${i} .ids=${e} .label=${n}></nf-trend-button>`:a}var ae={heating_manifold:"Heiz-/K\xFChlkreisverteiler",buffer_tank:"Pufferspeicher",freshwater_station:"Frischwasserstation"},Dt=i=>i.name||ae[i.type],Ft=i=>i.name||{heating:"Heizkreis",cooling:"K\xFChlkreis",changeover:"Heizen / K\xFChlen",pump:"Vorschubpumpe"}[i.kind],jt=(i,t)=>t.kind==="pump"?"Pumpenkreis":t.kind==="cooling"?"K\xFChlen":t.kind==="heating"?"Heizen":m(t.mode_entity)&&g(i.states[t.mode_entity])===null?"Betriebsart \u2013":Number(m(t.mode_entity)?g(i.states[t.mode_entity]):0)===(t.cooling_value??1)?"K\xFChlen":"Heizen",bt=(i,t,n)=>[$(i,"Vorlauf",t),$(i,"R\xFCcklauf",n)].filter(e=>e!==null),Lt=(i,t,n)=>{let e=C(i,t),r=C(i,n);return e===null||r===null?a:p`<div class="reading delta"><span>ΔT · VL − RL</span><b>${(e-r).toLocaleString(i.language,{maximumFractionDigits:1})} K</b></div>`};function Vt(i,t){let n=N(t),e=bt(i,n.flow,n.return);if(t.type==="buffer_tank"&&e.unshift(...[...n.sensors??[]].sort((r,s)=>s.level-r.level).flatMap(r=>{let s=$(i,r.name||"F\xFChler",r.entity);return s?[s]:[]})),t.type==="freshwater_station")for(let[r,s]of[["Zirkulation",n.circulation_temperature],["Trinkwarmwasser",n.hot_water]]){let o=$(i,r,s);o&&e.push(o)}for(let r of t.values??[]){let s=$(i,r.label||String(r.entity&&i.states[r.entity]?.attributes.friendly_name||"Wert"),r.entity);s&&e.push({...s,icon:r.icon})}return e}var T=(i,t)=>p`<div class="reading" data-source=${t.id}><span>${t.icon?.startsWith("mdi:")?p`<ha-icon icon=${t.icon}></ha-icon>`:t.icon||a} ${t.label}</span><b>${t.text}${G(i,[t.id],t.label)}</b></div>`;function q(i,t,n){let e=O(i,n);return e.id?p`<div class="reading" data-source=${e.id}><span>${t}<small>${e.feedback?"Ist":"Soll"}</small></span><b><i class="lamp" style=${`background:${e.running===null?"#888":e.running?"#6fe1a2":"#465361"}`}></i>${K(i.states[e.id])}${G(i,[e.id],t)}</b></div>`:a}var Bt=x`
</button>${this.error?d`<span role="alert">${this.error}</span>`:a}`}static styles=y`:host{position:relative;display:inline-flex;flex:0 0 18px;width:18px;height:18px;vertical-align:middle;margin-left:3px;font-weight:normal;line-height:0}button{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:18px;height:18px;padding:2px;border:0;border-radius:3px;background:transparent;color:var(--nf-accent,#40c8ff);opacity:.8;cursor:pointer}svg{display:block;flex-shrink:0}button:hover,button:focus-visible{opacity:1;background:#40c8ff18}button:focus-visible{outline:1px solid currentColor;outline-offset:1px}button:disabled{opacity:.4}span{position:absolute;right:0;top:22px;z-index:10;box-sizing:border-box;width:200px;padding:8px;border:1px solid #ff9b9b50;border-radius:6px;background:var(--nf-chrome-solid,#1c1c1c);font:12px/1.4 system-ui;color:#ff9b9b;white-space:normal}`};customElements.get("nf-trend-button")||customElements.define("nf-trend-button",bt);function X(r,t,n=""){let i=gt(r,t);return i.length?d`<nf-trend-button .hass=${r} .ids=${i} .label=${n}></nf-trend-button>`:a}var pe={heating_manifold:"Heiz-/K\xFChlkreisverteiler",buffer_tank:"Pufferspeicher",freshwater_station:"Frischwasserstation"},Bt=r=>r.name||pe[r.type],It=r=>r.name||{heating:"Heizkreis",cooling:"K\xFChlkreis",changeover:"Heizen / K\xFChlen",pump:"Vorschubpumpe"}[r.kind],Kt=(r,t)=>t.kind==="pump"?"Pumpenkreis":t.kind==="cooling"?"K\xFChlen":t.kind==="heating"?"Heizen":g(t.mode_entity)&&b(r.states[t.mode_entity])===null?"Betriebsart \u2013":Number(g(t.mode_entity)?b(r.states[t.mode_entity]):0)===(t.cooling_value??1)?"K\xFChlen":"Heizen",et=(r,t,n)=>[f(r,"Vorlauf",t),f(r,"R\xFCcklauf",n)].filter(i=>i!==null),yt=(r,t,n)=>{let i=E(r,t),e=E(r,n);return i===null||e===null?a:d`<div class="reading delta"><span>ΔT · VL − RL</span><b>${(i-e).toLocaleString(r.language,{maximumFractionDigits:1})} K</b></div>`};function Wt(r,t){let n=F(t),i=t.type==="freshwater_station"?[]:et(r,n.flow,n.return);if(t.type==="buffer_tank"&&i.unshift(...[...n.sensors??[]].sort((e,o)=>o.level-e.level).flatMap(e=>{let o=f(r,e.name||"F\xFChler",e.entity);return o?[o]:[]})),t.type==="freshwater_station"){let e=f(r,"Zirkulation",n.circulation_temperature);e&&i.push(e)}for(let e of t.values??[]){let o=f(r,e.label||String(e.entity&&r.states[e.entity]?.attributes.friendly_name||"Wert"),e.entity);o&&i.push({...o,icon:e.icon})}return i}function qt(r,t){return[...et(r,t.flow,t.return),...[["Kaltwasser",t.cold_water],["Trinkwarmwasser",t.hot_water],["Pumpenleistung",t.power]].flatMap(([n,i])=>{let e=f(r,n,i);return e?[e]:[]})]}var vt=(r,t)=>`K${t+1} \xB7 ${r.name||`Station ${t+1}`}`,H=(r,t)=>d`<div class="reading" data-source=${t.id}><span>${t.icon?.startsWith("mdi:")?d`<ha-icon icon=${t.icon}></ha-icon>`:t.icon||a} ${t.label}</span><b>${t.text}${X(r,[t.id],t.label)}</b></div>`;function L(r,t,n){let i=S(r,n);return i.id?d`<div class="reading" data-source=${i.id}><span>${t}<small>${i.feedback?"Ist":"Soll"}</small></span><b><i class="lamp" style=${`background:${i.running===null?"#888":i.running?"#6fe1a2":"#465361"}`}></i>${U(r.states[i.id])}${X(r,[i.id],t)}</b></div>`:a}var Zt=y`
:host{display:block;color:var(--nf-text);font:12px/1.4 system-ui,sans-serif;min-width:170px;max-width:300px}
button{font:inherit;color:inherit;background:var(--nf-fill,#ffffff10);border:1px solid var(--nf-line);border-radius:7px;padding:5px 8px;cursor:pointer}button:disabled,input:disabled{opacity:.45;cursor:default}button:focus-visible,input:focus-visible{outline:2px solid var(--nf-accent);outline-offset:2px}
.title{display:block;width:100%;padding:0 0 5px;border:0;background:none;font-weight:600;text-align:left;white-space:normal}.content{max-height:250px;overflow:auto;overscroll-behavior:contain}.circuit{border-top:1px solid var(--nf-line);padding:5px 0}.circuit-name{font-size:11px;font-weight:600;margin-bottom:3px}.reading{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;align-items:center;min-height:22px}.reading>span{color:var(--nf-muted);white-space:normal}.reading b{display:flex;align-items:center;justify-content:flex-end;white-space:nowrap;font-variant-numeric:tabular-nums;font-weight:500}.reading small{font-size:9px;margin-left:5px;opacity:.75}.delta{font-size:10px}.lamp{display:inline-block;flex:none;width:6px;height:6px;border-radius:50%;margin-right:5px}.empty{color:var(--nf-muted);font-size:11px;white-space:normal;margin:5px 0}nf-trend-button{margin-left:3px}
.circuit-name small,h3 small{font-size:10px;color:var(--nf-muted);font-weight:normal;margin-left:5px}
ha-icon{--mdc-icon-size:13px;width:13px;height:13px;vertical-align:middle}
dialog{box-sizing:border-box;width:min(620px,calc(100vw - 24px));max-width:none;max-height:calc(100dvh - 24px);padding:0;color:var(--nf-text);background:var(--nf-chrome-solid,#1c1c1c);border:1px solid var(--nf-line);border-radius:14px;box-shadow:0 20px 70px #0008;font:13px/1.4 system-ui,sans-serif}dialog::backdrop{background:#050b16a6;backdrop-filter:blur(3px)}header{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:14px 18px;border-bottom:1px solid var(--nf-line)}h2{font-size:17px;margin:0}.body{padding:12px 18px;max-height:calc(100dvh - 120px);overflow:auto;overscroll-behavior:contain}h3{font-size:13px;margin:12px 0 7px}fieldset{min-width:0;margin:8px 0;padding:10px;border:1px solid var(--nf-line);border-radius:9px}legend{font-size:12px;color:var(--nf-muted)}.command{display:flex;align-items:center;gap:12px;margin-top:8px}.command input[type=range]{flex:1;min-width:0;accent-color:var(--nf-accent)}.command input[type=number]{width:90px;box-sizing:border-box;background:var(--nf-fill,#ffffff10);border:1px solid var(--nf-line);border-radius:6px;color:inherit;padding:5px}.command output{font-variant-numeric:tabular-nums;min-width:45px;text-align:right}.error{color:#ff9b9b}.readonly{color:var(--nf-muted);font-size:11px;margin:4px 0}.body .reading{padding:4px 0}.body .circuit{padding-bottom:12px}
`,mt=class extends b{static properties={hass:{attribute:!1},item:{attribute:!1},readOnly:{type:Boolean}};render(){if(!this.hass||!this.item)return a;let t=N(this.item),n=Vt(this.hass,this.item);return p`<button class="title" @click=${()=>le(this.hass,this.item,this.readOnly)} aria-haspopup="dialog">${Dt(this.item)} ⚙</button><div class="content">
${this.item.type==="heating_manifold"?(t.circuits??[]).map(e=>p`<section class="circuit"><div class="circuit-name">${Ft(e)} <small>${jt(this.hass,e)}</small></div>${B(e)?q(this.hass,"Pumpe",e.pump):a}${I(e)?q(this.hass,"Ventil",e.valve):a}${bt(this.hass,e.flow,e.return).map(r=>T(this.hass,r))}${$(this.hass,"Leistung",e.power)?T(this.hass,$(this.hass,"Leistung",e.power)):a}</section>`):a}
${n.map(e=>T(this.hass,e))}${this.item.type==="freshwater_station"?p`${q(this.hass,"Ladepumpe",t.pump)}${q(this.hass,"Zirkulationspumpe",t.circulation)}`:a}
${this.item.type!=="heating_manifold"&&!n.length?p`<p class="empty">Noch keine Fühler verknüpft</p>`:a}
</div>`}static styles=[ht,Bt]},gt=class extends b{static properties={hass:{attribute:!1},item:{attribute:!1},readOnly:{type:Boolean},pending:{state:!0},error:{state:!0}};constructor(){super(),this.pending=new Set,this.error="",this.readOnly=!1}async show(){await this.updateComplete,this.shadowRoot.querySelector("dialog").showModal()}async send(t,n){let e=this.hass.states[t];if(!(this.readOnly||!e?.attributes.symcon_has_action||g(e)===null||this.pending.has(t))){this.pending=new Set([...this.pending,t]),this.error="";try{await this.hass.callService("symcon","set_value",{entity_id:t,value:n})}catch(r){this.error=r instanceof Error?r.message:String(r)}finally{this.pending=new Set([...this.pending].filter(r=>r!==t))}}}control(t,n){if(!m(n?.command)&&!m(n?.feedback))return a;let e=m(n?.command)?n.command:null,r=e?this.hass.states[e]:void 0,s=r?.attributes,o=g(r),c=!!e&&!!s?.symcon_has_action&&o!==null&&!this.readOnly&&!this.pending.has(e),l=Number(s?.symcon_min??0),u=Number(s?.symcon_max??100),h=Number(s?.symcon_step||(s?.symcon_variable_type===1?1:.1)),d=M(r),f=v=>{let _=v.target;e&&_.value.trim()&&_.checkValidity()&&Number.isFinite(_.valueAsNumber)&&this.send(e,_.valueAsNumber)};return p`<fieldset data-control=${t}><legend>${t}</legend>${q(this.hass,t,n)}
${e?p`<div class="reading"><span>Befehl / Sollwert</span><b>${K(r)}${G(this.hass,[e],`${t} \xB7 Sollwert`)}</b></div>
${s?.symcon_variable_type===0?p`<div class="command"><button data-command=${e} ?disabled=${!c} @click=${()=>{this.send(e,!W(r))}}>${W(r)?"Ausschalten / Schlie\xDFen":"Einschalten / \xD6ffnen"}</button></div>`:[1,2].includes(Number(s?.symcon_variable_type))?p`<div class="command"><input type="range" aria-label=${`${t} Sollwert`} data-command=${e} min=${l} max=${u} step=${h} .value=${String(d??l)} ?disabled=${!c} @change=${f}/><input type="number" aria-label=${`${t} nativer Sollwert`} min=${l} max=${u} step=${h} .value=${d===null?"":String(d)} ?disabled=${!c} @change=${f}/></div>`:a}
${this.readOnly?p`<p class="readonly">Historische Ansicht · nur Anzeige</p>`:s?.symcon_has_action?a:p`<p class="readonly">Nur Anzeige · keine Symcon-Schaltaktion hinterlegt</p>`}`:a}
</fieldset>`}render(){if(!this.hass||!this.item)return a;let t=N(this.item),n=Vt(this.hass,this.item);return p`<dialog @close=${()=>{this.remove(),y===this&&(y=null)}} @keydown=${e=>e.stopPropagation()}><header><h2>${Dt(this.item)}</h2><button aria-label="Schließen" @click=${()=>this.shadowRoot.querySelector("dialog").close()}>×</button></header><div class="body">
${this.item.type==="heating_manifold"?(t.circuits??[]).map(e=>p`<section class="circuit" data-circuit=${e.id}><h3>${Ft(e)} <small>${jt(this.hass,e)}</small></h3>${B(e)?this.control("Pumpe",e.pump):a}${I(e)?this.control("Ventil",e.valve):a}${bt(this.hass,e.flow,e.return).map(r=>T(this.hass,r))}${Lt(this.hass,e.flow,e.return)}${$(this.hass,"Pumpenleistung",e.power)?T(this.hass,$(this.hass,"Pumpenleistung",e.power)):a}</section>`):a}
${n.map(e=>T(this.hass,e))}${this.item.type!=="heating_manifold"?Lt(this.hass,t.flow,t.return):a}
${this.item.type==="freshwater_station"?p`${this.control("Ladepumpe",t.pump)}${this.control("Zirkulationspumpe",t.circulation)}`:a}
${!n.length&&this.item.type!=="heating_manifold"?p`<p class="empty">Die Fühler lassen sich im Editor über den Objektbaum zuweisen.</p>`:a}
${this.error?p`<p class="error" role="alert">${this.error}</p>`:a}
</div></dialog>`}static styles=[ht,Bt,x`:host{max-width:none;min-width:0}`]},y=null;function Ke(){y?.remove(),y=null}async function le(i,t,n=!1){y?.remove();let e=document.createElement("nf-hydronic-dialog");y=e,Object.assign(e,{hass:i,item:t,readOnly:n}),document.body.append(e),await e.show()}function qe(i,t,n=!1){if(!y)return;let e=t.floors.flatMap(r=>r.furniture).find(r=>r.id===y.item.id);if(!e||!Ut(e.type)){y.remove(),y=null;return}Object.assign(y,{hass:i,item:e,readOnly:n})}customElements.get("nf-hydronic-card")||customElements.define("nf-hydronic-card",mt);customElements.get("nf-hydronic-dialog")||customElements.define("nf-hydronic-dialog",gt);export{Ke as closeHydronic,oe as hydronicVisual,le as openHydronic,qe as refreshHydronic};
`,xt=class extends v{static properties={hass:{attribute:!1},item:{attribute:!1},readOnly:{type:Boolean}};render(){if(!this.hass||!this.item)return a;let t=F(this.item),n=Wt(this.hass,this.item),i=this.item.type==="freshwater_station"?O(this.item):[];return d`<button class="title" @click=${()=>jt(this.hass,this.item,this.readOnly)} aria-haspopup="dialog">${Bt(this.item)} ⚙</button><div class="content">
${this.item.type==="heating_manifold"?(t.circuits??[]).map(e=>d`<section class="circuit"><div class="circuit-name">${It(e)} <small>${Kt(this.hass,e)}</small></div>${q(e)?L(this.hass,"Pumpe",e.pump):a}${Z(e)?L(this.hass,"Ventil",e.valve):a}${et(this.hass,e.flow,e.return).map(o=>H(this.hass,o))}${f(this.hass,"Leistung",e.power)?H(this.hass,f(this.hass,"Leistung",e.power)):a}</section>`):a}
${i.length>1?d`<small class="cascade-count">Kaskade · ${i.length} Stationen</small>${i.map((e,o)=>{let s=S(this.hass,e.pump),c=f(this.hass,"Trinkwarmwasser",e.hot_water)||f(this.hass,"Vorlauf",e.flow);return d`<div class="station-summary" data-station=${e.id}><button class="station-name" @click=${()=>jt(this.hass,this.item,this.readOnly,e.id)}><i class="lamp" title=${`Pumpe: ${s.id?U(this.hass.states[s.id]):"\u2013"}`} style=${`background:${s.running===null?"#888":s.running?"#6fe1a2":"#a82638"}`}></i>${vt(e,o)}</button><b>${c?.text||"\u2013"}</b>${c?X(this.hass,[c.id],`${vt(e,o)} \xB7 ${c.label}`):a}</div>`})}`:i.map(e=>d`<section class="circuit">${qt(this.hass,e).map(o=>H(this.hass,o))}${L(this.hass,"Ladepumpe",e.pump)}${T(e)?L(this.hass,"Kaskadenventil",e.valve):a}</section>`)}
${n.map(e=>H(this.hass,e))}${this.item.type==="freshwater_station"?L(this.hass,"Zirkulationspumpe",t.circulation):a}
${this.item.type!=="heating_manifold"&&this.item.type!=="freshwater_station"&&!n.length?d`<p class="empty">Noch keine Fühler verknüpft</p>`:a}
</div>`}static styles=[mt,Zt,y`.cascade-count{color:var(--nf-muted)}.station-summary{display:grid;grid-template-columns:minmax(0,1fr) auto 18px;align-items:center;gap:6px;width:100%;padding:5px 0;font-size:11px}.station-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0;background:none;border:0;text-align:left}.station-summary b{white-space:nowrap;font-variant-numeric:tabular-nums}`]},$t=class extends v{static properties={hass:{attribute:!1},item:{attribute:!1},readOnly:{type:Boolean},focusStation:{attribute:!1},pending:{state:!0},error:{state:!0}};constructor(){super(),this.pending=new Set,this.error="",this.readOnly=!1}async show(){await this.updateComplete,this.shadowRoot.querySelector("dialog").showModal(),this.focusStation&&this.shadowRoot.querySelector(`[data-station="${CSS.escape(this.focusStation)}"]`)?.scrollIntoView({block:"start"})}async send(t,n){let i=this.hass.states[t];if(!(this.readOnly||!i?.attributes.symcon_has_action||b(i)===null||this.pending.has(t))){this.pending=new Set([...this.pending,t]),this.error="";try{await this.hass.callService("symcon","set_value",{entity_id:t,value:n})}catch(e){this.error=e instanceof Error?e.message:String(e)}finally{this.pending=new Set([...this.pending].filter(e=>e!==t))}}}control(t,n){if(!g(n?.command)&&!g(n?.feedback))return a;let i=g(n?.command)?n.command:null,e=i?this.hass.states[i]:void 0,o=e?.attributes,s=b(e),c=!!i&&!!o?.symcon_has_action&&s!==null&&!this.readOnly&&!this.pending.has(i),l=Number(o?.symcon_min??0),h=Number(o?.symcon_max??100),p=Number(o?.symcon_step||(o?.symcon_variable_type===1?1:.1)),u=z(e),m=$=>{let _=$.target;i&&_.value.trim()&&_.checkValidity()&&Number.isFinite(_.valueAsNumber)&&this.send(i,_.valueAsNumber)};return d`<fieldset data-control=${t}><legend>${t}</legend>${L(this.hass,t,n)}
${i?d`<div class="reading"><span>Befehl / Sollwert</span><b>${U(e)}${X(this.hass,[i],`${t} \xB7 Sollwert`)}</b></div>
${o?.symcon_variable_type===0?d`<div class="command"><button data-command=${i} ?disabled=${!c} @click=${()=>{this.send(i,!J(e))}}>${J(e)?"Ausschalten / Schlie\xDFen":"Einschalten / \xD6ffnen"}</button></div>`:[1,2].includes(Number(o?.symcon_variable_type))?d`<div class="command"><input type="range" aria-label=${`${t} Sollwert`} data-command=${i} min=${l} max=${h} step=${p} .value=${String(u??l)} ?disabled=${!c} @change=${m}/><input type="number" aria-label=${`${t} nativer Sollwert`} min=${l} max=${h} step=${p} .value=${u===null?"":String(u)} ?disabled=${!c} @change=${m}/></div>`:a}
${this.readOnly?d`<p class="readonly">Historische Ansicht · nur Anzeige</p>`:o?.symcon_has_action?a:d`<p class="readonly">Nur Anzeige · keine Symcon-Schaltaktion hinterlegt</p>`}`:a}
</fieldset>`}render(){if(!this.hass||!this.item)return a;let t=F(this.item),n=Wt(this.hass,this.item),i=this.item.type==="freshwater_station"?O(this.item):[];return d`<dialog @close=${()=>{this.remove(),x===this&&(x=null)}} @keydown=${e=>e.stopPropagation()}><header><h2>${Bt(this.item)}</h2><button aria-label="Schließen" @click=${()=>this.shadowRoot.querySelector("dialog").close()}>×</button></header><div class="body">
${this.item.type==="heating_manifold"?(t.circuits??[]).map(e=>d`<section class="circuit" data-circuit=${e.id}><h3>${It(e)} <small>${Kt(this.hass,e)}</small></h3>${q(e)?this.control("Pumpe",e.pump):a}${Z(e)?this.control("Ventil",e.valve):a}${et(this.hass,e.flow,e.return).map(o=>H(this.hass,o))}${yt(this.hass,e.flow,e.return)}${f(this.hass,"Pumpenleistung",e.power)?H(this.hass,f(this.hass,"Pumpenleistung",e.power)):a}</section>`):a}
${i.map((e,o)=>d`<details class="freshwater-unit" data-station=${e.id} ?open=${o===0||this.focusStation===e.id}><summary>${vt(e,o)}</summary>${qt(this.hass,e).map(s=>H(this.hass,s))}${yt(this.hass,e.flow,e.return)}${this.control("Ladepumpe",e.pump)}${T(e)?this.control("Kaskadenventil",e.valve):a}</details>`)}
${n.map(e=>H(this.hass,e))}${this.item.type==="buffer_tank"?yt(this.hass,t.flow,t.return):a}
${this.item.type==="freshwater_station"?this.control("Zirkulationspumpe",t.circulation):a}
${!n.length&&this.item.type!=="heating_manifold"&&this.item.type!=="freshwater_station"?d`<p class="empty">Die Fühler lassen sich im Editor über den Objektbaum zuweisen.</p>`:a}
${this.error?d`<p class="error" role="alert">${this.error}</p>`:a}
</div></dialog>`}static styles=[mt,Zt,y`:host{max-width:none;min-width:0}.freshwater-unit{border-bottom:1px solid var(--nf-line);padding:8px 0}.freshwater-unit>summary{cursor:pointer;font-weight:600;padding:4px 0}`]},x=null;function en(){x?.remove(),x=null}async function jt(r,t,n=!1,i){x?.remove();let e=document.createElement("nf-hydronic-dialog");x=e,Object.assign(e,{hass:r,item:t,readOnly:n,focusStation:i}),document.body.append(e),await e.show()}function nn(r,t,n=!1){if(!x)return;let i=t.floors.flatMap(e=>e.furniture).find(e=>e.id===x.item.id);if(!i||!Dt(i.type)){x.remove(),x=null;return}Object.assign(x,{hass:r,item:i,readOnly:n})}customElements.get("nf-hydronic-card")||customElements.define("nf-hydronic-card",xt);customElements.get("nf-hydronic-dialog")||customElements.define("nf-hydronic-dialog",$t);export{en as closeHydronic,he as hydronicVisual,jt as openHydronic,nn as refreshHydronic};
/*! Bundled license information:
@lit/reactive-element/css-tag.js:
+115 -115
View File
@@ -1,13 +1,13 @@
/*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */
var w={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",fr:"6312d0f61ebf",hu:"27ba348531dc",it:"1b705e76dd00",nb:"c5ea24fb9ef6",nl:"b64142c67c2e",pl:"8527a4930402",pt:"31857a2d2277",ro:"e3cb5f449f0f",sk:"320611594db0",sl:"8071691ceda3",sv:"711b911ec8da",tr:"7c83ce1c3372",zh:"50518d9f494e"};Array.prototype.at||Object.defineProperty(Array.prototype,"at",{configurable:!0,writable:!0,value:function(e){let t=Math.trunc(e)||0;return this[t<0?this.length+t:t]}});typeof globalThis.structuredClone!="function"&&(globalThis.structuredClone=n=>n===void 0?n:JSON.parse(JSON.stringify(n)));var Gn=globalThis,Un=Gn.ShadowRoot&&(Gn.ShadyCSS===void 0||Gn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,pi=Symbol(),ds=new WeakMap,nn=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==pi)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Un&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=ds.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&ds.set(t,e))}return e}toString(){return this.cssText}},hs=n=>new nn(typeof n=="string"?n:n+"",void 0,pi),J=(n,...e)=>{let t=n.length===1?n[0]:e.reduce((r,i,o)=>r+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+n[o+1],n[0]);return new nn(t,n,pi)},ms=(n,e)=>{if(Un)n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),i=Gn.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=t.cssText,n.appendChild(r)}},fi=Un?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return hs(t)})(n):n;var{is:md,defineProperty:pd,getOwnPropertyDescriptor:fd,getOwnPropertyNames:gd,getOwnPropertySymbols:_d,getPrototypeOf:bd}=Object,jn=globalThis,ps=jn.trustedTypes,vd=ps?ps.emptyScript:"",yd=jn.reactiveElementPolyfillSupport,rn=(n,e)=>n,gi={toAttribute(n,e){switch(e){case Boolean:n=n?vd:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch{t=null}}return t}},gs=(n,e)=>!md(n,e),fs={attribute:!0,type:String,converter:gi,reflect:!1,useDefault:!1,hasChanged:gs};Symbol.metadata??=Symbol("metadata"),jn.litPropertyMetadata??=new WeakMap;var Le=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=fs){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(e,r,t);i!==void 0&&pd(this.prototype,e,i)}}static getPropertyDescriptor(e,t,r){let{get:i,set:o}=fd(this.prototype,e)??{get(){return this[t]},set(s){this[t]=s}};return{get:i,set(s){let a=i?.call(this);o?.call(this,s),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??fs}static _$Ei(){if(this.hasOwnProperty(rn("elementProperties")))return;let e=bd(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(rn("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(rn("properties"))){let t=this.properties,r=[...gd(t),..._d(t)];for(let i of r)this.createProperty(i,t[i])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[r,i]of t)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[t,r]of this.elementProperties){let i=this._$Eu(t,r);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let i of r)t.unshift(fi(i))}else e!==void 0&&t.push(fi(e));return t}static _$Eu(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadLine truncated
\f\r]`,on=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,vs=/-->/g,ys=/>/g,ct=RegExp(`>|${_i}(?:([^\\s"'>=/]+)(${_i}*=${_i}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),ws=/'/g,xs=/"/g,Ms=/^(?:script|style|textarea|title)$/i,$i=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),p=$i(1),ne=$i(2),hg=$i(3),mt=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),ks=new WeakMap,dt=ht.createTreeWalker(ht,129);function As(n,e){if(!Si(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return bs!==void 0?bs.createHTML(e):e}var kd=(n,e)=>{let t=n.length-1,r=[],i,o=e===2?"<svg>":e===3?"<math>":"",s=on;for(let a=0;a<t;a++){let l=n[a],u,c,h=-1,m=0;for(;m<l.length&&(s.lastIndex=m,c=s.exec(l),c!==null);)m=s.lastIndex,s===on?c[1]==="!--"?s=vs:c[1]!==void 0?s=ys:c[2]!==void 0?(Ms.test(c[2])&&(i=RegExp("</"+c[2],"g")),s=ct):c[3]!==void 0&&(s=ct):s===ct?c[0]===">"?(s=i??on,h=-1):c[1]===void 0?h=-2:(h=s.lastIndex-c[2].length,u=c[1],s=c[3]===void 0?ct:c[3]==='"'?xs:ws):s===xs||s===ws?s=ct:s===vs||s===ys?s=on:(s=ct,i=void 0);let d=s===ct&&n[a+1].startsWith("/>")?" ":"";o+=s===on?l+wd:h>=0?(r.push(u),l.slice(0,h)+Ss+l.slice(h)+tt+d):l+tt+(h===-2?a:d)}return[As(n,o+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},ln=class n{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let o=0,s=0,a=e.length-1,l=this.parts,[u,c]=kd(e,t);if(this.el=n.createElement(u,r),dt.currentNode=this.el.content,t===2||t===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(i=dt.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let h of i.getAttributeNames())if(h.endsWith(Ss)){let m=c[s++],d=i.getAttribute(h).split(tt),g=/([.?@])?(.*)/.exec(m);l.push({type:1,index:o,name:g[2],strings:d,ctor:g[1]==="."?vi:g[1]==="?"?yi:g[1]==="@"?wi:At}),i.removeAttribute(h)}else h.startsWith(tt)&&(l.push({type:6,index:o}),i.removeAttribute(h));if(Ms.test(i.tagName)){let h=i.textContent.split(tt),m=h.length-1;if(m>0){i.textContent=qn?qn.emptyScript:"";for(let d=0;d<m;d++)i.append(h[d],sn()),dt.nextNode(),l.push({type:2,index:++o});i.append(h[m],sn())}}}else if(i.nodeType===8)if(i.data===$s)l.push({type:2,index:o});else{let h=-1;for(;(h=i.data.indexOf(tt,h+1))!==-1;)l.push({type:7,index:o}),h+=tt.length-1}o++}}static createElement(e,t){let r=ht.createElement("template");return r.innerHTML=e,r}};function Mt(n,e,t=n,r){if(e===mt)return e;let i=r!==void 0?t._$Co?.[r]:t._$Cl,o=an(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(n),i._$AT(n,t,r)),r!==void 0?(t._$Co??=[])[r]=i:t._$Cl=i),i!==void 0&&(e=Mt(n,i._$AS(n,e.values),i,r)),e}var bi=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,i=(e?.creationScope??ht).importNode(t,!0);dt.currentNode=i;let o=dt.nextNode(),s=0,a=0,l=r[0];for(;l!==void 0;){if(s===l.index){let u;l.type===2?u=new un(o,o.nextSibling,this,e):l.type===1?u=new l.ctor(o,l.name,l.strings,this,e):l.type===6&&(u=new xi(o,this,e)),this._$AV.push(u),l=r[++a]}s!==l?.index&&(o=dt.nextNode(),s++)}return dt.currentNode=ht,i}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},un=class n{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,i){this.type=2,this._$AH=f,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Mt(this,e,t),an(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==mt&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):xd(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==f&&an(this._$AH)?this._$AA.nextSibling.data=e:this.T(ht.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,i=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=ln.createElement(As(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(t);else{let o=new bi(i,this),s=o.u(this.options);o.p(t),this.T(s),this._$AH=o}}_$AC(e){let t=ks.get(e.strings);return t===void 0&&ks.set(e.strings,t=new ln(e)),t}k(e){Si(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,i=0;for(let o of e)i===t.length?t.push(r=new n(this.O(sn()),this.O(sn()),this,this.options)):r=t[i],r._$AI(o),i++;i<t.length&&(this._$AR(r&&r._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let r=_s(e).nextSibling;_s(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},At=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,i,o){this.type=1,this._$AH=f,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=o,r.length>2||r[0]!==""||r[1]!==""?(this.Line truncated
var w={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",fr:"6312d0f61ebf",hu:"27ba348531dc",it:"1b705e76dd00",nb:"c5ea24fb9ef6",nl:"b64142c67c2e",pl:"8527a4930402",pt:"31857a2d2277",ro:"e3cb5f449f0f",sk:"320611594db0",sl:"8071691ceda3",sv:"711b911ec8da",tr:"7c83ce1c3372",zh:"50518d9f494e"};Array.prototype.at||Object.defineProperty(Array.prototype,"at",{configurable:!0,writable:!0,value:function(e){let t=Math.trunc(e)||0;return this[t<0?this.length+t:t]}});typeof globalThis.structuredClone!="function"&&(globalThis.structuredClone=n=>n===void 0?n:JSON.parse(JSON.stringify(n)));var Un=globalThis,jn=Un.ShadowRoot&&(Un.ShadyCSS===void 0||Un.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,fi=Symbol(),hs=new WeakMap,nn=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==fi)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(jn&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=hs.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&hs.set(t,e))}return e}toString(){return this.cssText}},ms=n=>new nn(typeof n=="string"?n:n+"",void 0,fi),J=(n,...e)=>{let t=n.length===1?n[0]:e.reduce((r,i,o)=>r+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+n[o+1],n[0]);return new nn(t,n,fi)},ps=(n,e)=>{if(jn)n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),i=Un.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=t.cssText,n.appendChild(r)}},gi=jn?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return ms(t)})(n):n;var{is:fd,defineProperty:gd,getOwnPropertyDescriptor:_d,getOwnPropertyNames:bd,getOwnPropertySymbols:vd,getPrototypeOf:yd}=Object,qn=globalThis,fs=qn.trustedTypes,wd=fs?fs.emptyScript:"",xd=qn.reactiveElementPolyfillSupport,rn=(n,e)=>n,_i={toAttribute(n,e){switch(e){case Boolean:n=n?wd:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch{t=null}}return t}},_s=(n,e)=>!fd(n,e),gs={attribute:!0,type:String,converter:_i,reflect:!1,useDefault:!1,hasChanged:_s};Symbol.metadata??=Symbol("metadata"),qn.litPropertyMetadata??=new WeakMap;var Le=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=gs){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(e,r,t);i!==void 0&&gd(this.prototype,e,i)}}static getPropertyDescriptor(e,t,r){let{get:i,set:o}=_d(this.prototype,e)??{get(){return this[t]},set(s){this[t]=s}};return{get:i,set(s){let a=i?.call(this);o?.call(this,s),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??gs}static _$Ei(){if(this.hasOwnProperty(rn("elementProperties")))return;let e=yd(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(rn("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(rn("properties"))){let t=this.properties,r=[...bd(t),...vd(t)];for(let i of r)this.createProperty(i,t[i])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[r,i]of t)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[t,r]of this.elementProperties){let i=this._$Eu(t,r);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let i of r)t.unshift(gi(i))}else e!==void 0&&t.push(gi(e));return t}static _$Eu(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadLine truncated
\f\r]`,on=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ys=/-->/g,ws=/>/g,ct=RegExp(`>|${bi}(?:([^\\s"'>=/]+)(${bi}*=${bi}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),xs=/'/g,ks=/"/g,As=/^(?:script|style|textarea|title)$/i,Mi=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),p=Mi(1),ne=Mi(2),fg=Mi(3),mt=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),Ss=new WeakMap,dt=ht.createTreeWalker(ht,129);function Es(n,e){if(!$i(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return vs!==void 0?vs.createHTML(e):e}var $d=(n,e)=>{let t=n.length-1,r=[],i,o=e===2?"<svg>":e===3?"<math>":"",s=on;for(let a=0;a<t;a++){let l=n[a],u,c,h=-1,m=0;for(;m<l.length&&(s.lastIndex=m,c=s.exec(l),c!==null);)m=s.lastIndex,s===on?c[1]==="!--"?s=ys:c[1]!==void 0?s=ws:c[2]!==void 0?(As.test(c[2])&&(i=RegExp("</"+c[2],"g")),s=ct):c[3]!==void 0&&(s=ct):s===ct?c[0]===">"?(s=i??on,h=-1):c[1]===void 0?h=-2:(h=s.lastIndex-c[2].length,u=c[1],s=c[3]===void 0?ct:c[3]==='"'?ks:xs):s===ks||s===xs?s=ct:s===ys||s===ws?s=on:(s=ct,i=void 0);let d=s===ct&&n[a+1].startsWith("/>")?" ":"";o+=s===on?l+kd:h>=0?(r.push(u),l.slice(0,h)+$s+l.slice(h)+tt+d):l+tt+(h===-2?a:d)}return[Es(n,o+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},ln=class n{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let o=0,s=0,a=e.length-1,l=this.parts,[u,c]=$d(e,t);if(this.el=n.createElement(u,r),dt.currentNode=this.el.content,t===2||t===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(i=dt.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let h of i.getAttributeNames())if(h.endsWith($s)){let m=c[s++],d=i.getAttribute(h).split(tt),g=/([.?@])?(.*)/.exec(m);l.push({type:1,index:o,name:g[2],strings:d,ctor:g[1]==="."?yi:g[1]==="?"?wi:g[1]==="@"?xi:At}),i.removeAttribute(h)}else h.startsWith(tt)&&(l.push({type:6,index:o}),i.removeAttribute(h));if(As.test(i.tagName)){let h=i.textContent.split(tt),m=h.length-1;if(m>0){i.textContent=Zn?Zn.emptyScript:"";for(let d=0;d<m;d++)i.append(h[d],sn()),dt.nextNode(),l.push({type:2,index:++o});i.append(h[m],sn())}}}else if(i.nodeType===8)if(i.data===Ms)l.push({type:2,index:o});else{let h=-1;for(;(h=i.data.indexOf(tt,h+1))!==-1;)l.push({type:7,index:o}),h+=tt.length-1}o++}}static createElement(e,t){let r=ht.createElement("template");return r.innerHTML=e,r}};function Mt(n,e,t=n,r){if(e===mt)return e;let i=r!==void 0?t._$Co?.[r]:t._$Cl,o=an(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(n),i._$AT(n,t,r)),r!==void 0?(t._$Co??=[])[r]=i:t._$Cl=i),i!==void 0&&(e=Mt(n,i._$AS(n,e.values),i,r)),e}var vi=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,i=(e?.creationScope??ht).importNode(t,!0);dt.currentNode=i;let o=dt.nextNode(),s=0,a=0,l=r[0];for(;l!==void 0;){if(s===l.index){let u;l.type===2?u=new un(o,o.nextSibling,this,e):l.type===1?u=new l.ctor(o,l.name,l.strings,this,e):l.type===6&&(u=new ki(o,this,e)),this._$AV.push(u),l=r[++a]}s!==l?.index&&(o=dt.nextNode(),s++)}return dt.currentNode=ht,i}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},un=class n{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,i){this.type=2,this._$AH=f,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Mt(this,e,t),an(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==mt&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Sd(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==f&&an(this._$AH)?this._$AA.nextSibling.data=e:this.T(ht.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,i=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=ln.createElement(Es(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(t);else{let o=new vi(i,this),s=o.u(this.options);o.p(t),this.T(s),this._$AH=o}}_$AC(e){let t=Ss.get(e.strings);return t===void 0&&Ss.set(e.strings,t=new ln(e)),t}k(e){$i(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,i=0;for(let o of e)i===t.length?t.push(r=new n(this.O(sn()),this.O(sn()),this,this.options)):r=t[i],r._$AI(o),i++;i<t.length&&(this._$AR(r&&r._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let r=bs(e).nextSibling;bs(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},At=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,i,o){this.type=1,this._$AH=f,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=o,r.length>2||r[0]!==""||r[1]!==""?(this.Line truncated
Ein Plugin l\xE4uft mit denselben Rechten wie NextFloor in deinem Browser. Die Datei wurde gepr\xFCft, ihr Inhalt ist festgelegt:
{url}`,manual:"Anleitung",manual_more:"Mehr erfahren",feature_text_energy:"Energieteilchen fliegen in B\xF6gen von den Solarfeldern zum Wechselrichter, zwischen Haus, Akku, Netz und Verbrauchern \u2013 schneller und dichter, je mehr Strom flie\xDFt. Die Module funkeln mit ihrer Produktion, eine Glaskarte \xFCber dem Dach zeigt die Bilanz und wie autark das Haus gerade ist.",live_autarky:"autark",live_fold:"Karte verkleinern",live_unfold:"Karte aufklappen",live_day_hint:"Die letzten 24 Stunden: Solar (Fl\xE4che) und Verbrauch (Linie)",live_week_hint:"Die letzten 7 Tage: Sonne {solar} kWh, Verbrauch {use} kWh (gelb: Sonne, hell: Verbrauch)",live_days:"Tage",live_car_away:"Unterwegs",live_car_charging:"L\xE4dt",live_car_plugged:"Eingesteckt",live_car_lock:"Verriegeln",live_car_unlock:"Entriegeln",live_car_unlock_confirm:"{name} wirklich entriegeln?",live_car_climate:"Klimatisierung",live_car_charge:"Laden starten/stoppen",live_media_prev:"Zur\xFCck",live_media_playpause:"Abspielen/Pause",live_media_next:"Weiter",live_media_volume:"Lautst\xE4rke",live_car_device:"Auto (eine Entit\xE4t des Autos)",live_car_device_hint:"Ladestand, Reichweite, Laden, Stecker, Schloss und Klima findet NextFloor selbst am Ger\xE4t des Autos. Ohne Angabe nimmt es den Anwesenheitssensor des Stellplatzes.",live_car_departure_entity:"Abfahrtszeit (optional)",live_car_departure:"Abfahrt {time}",live_car_open:"Offen: {parts}",printer_printing:"druckt",printer_done:"fertig",printer_paused:"pausiert",printer_error:"Fehler",printer_idle:"bereit",printer_done_at:"fertig um {time}",printer_layer:"Schicht",printer_nozzle:"D\xFCse",printer_bed:"Bett",heatpump_heating:"heizt",heatpump_water:"macht Warmwasser",heatpump_cooling:"k\xFChlt",heatpump_defrost:"taut ab",heatpump_idle:"in Ruhe",heatpump_flow_return:"Vor- \u2192 R\xFCcklauf",heatpump_heat:"W\xE4rme",heatpump_power:"Strom",heatpump_outside:"au\xDFen",pack_missing_item:"M\xF6bel aus entferntem Pack",back_to_room:"Zur\xFCck zu {room}",back_to_floor:"Zur\xFCck zur Etage",hint_furniture:"Raum antippen, dann rechts ein M\xF6belst\xFCck w\xE4hlen \xB7 M\xF6bel ziehen, an den Ecken die Gr\xF6\xDFe \xE4ndern",furniture_into:"Neue M\xF6bel kommen in die Mitte von \u201E{room}\u201C.",furniture_pick_room:"Tipp: Erst einen Raum antippen \u2013 dann landen neue M\xF6bel in seiner Mitte.",flows:"Stromfluss",flows_hint:"Energieb\xF6gen zwischen Solarfeldern, Wechselrichter, Akku, Netz und Verbrauchern ein- oder ausblenden",chk_title:"Einrichtung",chk_hint:"Was der Energiefluss braucht. Antippen springt an die Stelle.",chk_solar:"Solarfeld angelegt",chk_solar_add:"Ein Solarfeld aufs Dach legen",chk_meter:"Stromz\xE4hler mit Netzsensor",chk_meter_sensor:"Stromz\xE4hler: Netzsensor (W) fehlt",chk_meter_add:"Stromz\xE4hler anlegen",chk_inverter:"Wechselrichter mit Leistungssensor",chk_inverter_sensor:"Wechselrichter: Leistungssensor fehlt",chk_inverter_add:"Wechselrichter anlegen",chk_battery:"Stromspeicher mit Leistung und Ladestand",chk_battery_sensor:"Stromspeicher: Leistung oder Ladestand fehlt",chk_battery_opt:"Stromspeicher (optional)",chk_grid:"Netzanschluss gesetzt",chk_grid_opt:"Netzanschluss (optional, sonst automatisch)",energy_sign_grid:"Das Haus zeigt Einspeisung, obwohl die Sonne nichts liefert. Der Netzsensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_battery:"Der Speicher l\xE4dt ohne Sonne und ohne Netzbezug. Sein Sensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_flip:"Vorzeichen umkehren",help_title:"Hilfe und R\xFCckmeldung",help_hint:"Fehler bitte als Issue auf GitHub, W\xFCnsche als Diskussion \u2013 so geht nichts verloren, und alle sehen den Stand.",help_issue:"Problem melden",help_idea:"Idee vorschlagen",furn_name:"Name (optional)",furn_mirror:"Spiegeln",furn_mirror_hint:"Links und rechts vertauschen \u2013 das L-Sofa andersherum, der Schrank mit der T\xFCr auf der anderen Seite, die K\xFCchenzeile gespiegelt.",hint_opening:"Auf eine Wand tippen, um eine T\xFCr oder ein Fenster einzusetzen \u2013 die Art w\xE4hlst du danach rechts",preset_door:"T\xFCr",preset_door_double:"Doppelt\xFCr",preset_window:"Fenster",preset_window_double:"Fenster 2-fl\xFCgelig",preset_terrace:"Terrassent\xFCr",preset_terrace_double:"Terrassent\xFCr 2-fl\xFCgelig",preset_lift_slide:"Hebe-Schiebet\xFCr",preset_garage:"Garagentor",preset_front:"Haust\xFCr",opening_style:"Stil",sidelight_auto:"automatisch",sidelight_hinge:"Seitenteil an der Anschlagseite",sidelight_hinge_hint:"Das Seitenteil sitzt sonst gegen\xFCber dem Anschlag; mit Haken neben den B\xE4ndern.",sidelight_width:"Breite Seitenteil (m)",sidelight_width_left:"Seitenteil links (m)",sidelight_width_right:"Seitenteil rechts (m)",style_auto:"Automatisch ({style})",style_interior:"Zimmert\xFCr",style_front:"Haust\xFCr",style_front_glass:"Haust\xFCr mit Glasausschnitt",style_sidelight:"Haust\xFCr mit Seitenteil",style_sidelights:"Haust\xFCr mit 2 Seitenteilen",style_glass:"Glast\xFCr",style_sliding:"Schiebet\xFCr",style_p Line truncated
{url}`,manual:"Anleitung",manual_more:"Mehr erfahren",feature_text_energy:"Energieteilchen fliegen in B\xF6gen von den Solarfeldern zum Wechselrichter, zwischen Haus, Akku, Netz und Verbrauchern \u2013 schneller und dichter, je mehr Strom flie\xDFt. Die Module funkeln mit ihrer Produktion, eine Glaskarte \xFCber dem Dach zeigt die Bilanz und wie autark das Haus gerade ist.",live_autarky:"autark",live_fold:"Karte verkleinern",live_unfold:"Karte aufklappen",live_day_hint:"Die letzten 24 Stunden: Solar (Fl\xE4che) und Verbrauch (Linie)",live_week_hint:"Die letzten 7 Tage: Sonne {solar} kWh, Verbrauch {use} kWh (gelb: Sonne, hell: Verbrauch)",live_days:"Tage",live_car_away:"Unterwegs",live_car_charging:"L\xE4dt",live_car_plugged:"Eingesteckt",live_car_lock:"Verriegeln",live_car_unlock:"Entriegeln",live_car_unlock_confirm:"{name} wirklich entriegeln?",live_car_climate:"Klimatisierung",live_car_charge:"Laden starten/stoppen",live_media_prev:"Zur\xFCck",live_media_playpause:"Abspielen/Pause",live_media_next:"Weiter",live_media_volume:"Lautst\xE4rke",live_car_device:"Auto (eine Entit\xE4t des Autos)",live_car_device_hint:"Ladestand, Reichweite, Laden, Stecker, Schloss und Klima findet NextFloor selbst am Ger\xE4t des Autos. Ohne Angabe nimmt es den Anwesenheitssensor des Stellplatzes.",live_car_departure_entity:"Abfahrtszeit (optional)",live_car_departure:"Abfahrt {time}",live_car_open:"Offen: {parts}",printer_printing:"druckt",printer_done:"fertig",printer_paused:"pausiert",printer_error:"Fehler",printer_idle:"bereit",printer_done_at:"fertig um {time}",printer_layer:"Schicht",printer_nozzle:"D\xFCse",printer_bed:"Bett",heatpump_heating:"heizt",heatpump_water:"macht Warmwasser",heatpump_cooling:"k\xFChlt",heatpump_defrost:"taut ab",heatpump_idle:"in Ruhe",heatpump_flow_return:"Vor- \u2192 R\xFCcklauf",heatpump_heat:"W\xE4rme",heatpump_power:"Strom",heatpump_outside:"au\xDFen",pack_missing_item:"M\xF6bel aus entferntem Pack",back_to_room:"Zur\xFCck zu {room}",back_to_floor:"Zur\xFCck zur Etage",hint_furniture:"Raum antippen, dann rechts ein M\xF6belst\xFCck w\xE4hlen \xB7 M\xF6bel ziehen, an den Ecken die Gr\xF6\xDFe \xE4ndern",furniture_into:"Neue M\xF6bel kommen in die Mitte von \u201E{room}\u201C.",furniture_pick_room:"Tipp: Erst einen Raum antippen \u2013 dann landen neue M\xF6bel in seiner Mitte.",flows:"Stromfluss",flows_hint:"Energieb\xF6gen zwischen Solarfeldern, Wechselrichter, Akku, Netz und Verbrauchern ein- oder ausblenden",chk_title:"Einrichtung",chk_hint:"Was der Energiefluss braucht. Antippen springt an die Stelle.",chk_solar:"Solarfeld angelegt",chk_solar_add:"Ein Solarfeld aufs Dach legen",chk_meter:"Stromz\xE4hler mit Netzsensor",chk_meter_sensor:"Stromz\xE4hler: Netzsensor (W) fehlt",chk_meter_add:"Stromz\xE4hler anlegen",chk_inverter:"Wechselrichter mit Leistungssensor",chk_inverter_sensor:"Wechselrichter: Leistungssensor fehlt",chk_inverter_add:"Wechselrichter anlegen",chk_battery:"Stromspeicher mit Leistung und Ladestand",chk_battery_sensor:"Stromspeicher: Leistung oder Ladestand fehlt",chk_battery_opt:"Stromspeicher (optional)",chk_grid:"Netzanschluss gesetzt",chk_grid_opt:"Netzanschluss (optional, sonst automatisch)",energy_sign_grid:"Das Haus zeigt Einspeisung, obwohl die Sonne nichts liefert. Der Netzsensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_battery:"Der Speicher l\xE4dt ohne Sonne und ohne Netzbezug. Sein Sensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_flip:"Vorzeichen umkehren",help_title:"Hilfe und R\xFCckmeldung",help_hint:"Fehler bitte als Issue auf GitHub, W\xFCnsche als Diskussion \u2013 so geht nichts verloren, und alle sehen den Stand.",help_issue:"Problem melden",help_idea:"Idee vorschlagen",furn_name:"Name (optional)",furn_mirror:"Spiegeln",furn_mirror_hint:"Links und rechts vertauschen \u2013 das L-Sofa andersherum, der Schrank mit der T\xFCr auf der anderen Seite, die K\xFCchenzeile gespiegelt.",hint_opening:"Auf eine Wand tippen, um eine T\xFCr oder ein Fenster einzusetzen \u2013 die Art w\xE4hlst du danach rechts",preset_door:"T\xFCr",preset_door_double:"Doppelt\xFCr",preset_window:"Fenster",preset_window_double:"Fenster 2-fl\xFCgelig",preset_terrace:"Terrassent\xFCr",preset_terrace_double:"Terrassent\xFCr 2-fl\xFCgelig",preset_lift_slide:"Hebe-Schiebet\xFCr",preset_garage:"Garagentor",preset_front:"Haust\xFCr",opening_style:"Stil",sidelight_auto:"automatisch",sidelight_hinge:"Seitenteil an der Anschlagseite",sidelight_hinge_hint:"Das Seitenteil sitzt sonst gegen\xFCber dem Anschlag; mit Haken neben den B\xE4ndern.",sidelight_width:"Breite Seitenteil (m)",sidelight_width_left:"Seitenteil links (m)",sidelight_width_right:"Seitenteil rechts (m)",style_auto:"Automatisch ({style})",style_interior:"Zimmert\xFCr",style_front:"Haust\xFCr",style_front_glass:"Haust\xFCr mit Glasausschnitt",style_sidelight:"Haust\xFCr mit Seitenteil",style_sidelights:"Haust\xFCr mit 2 Seitenteilen",style_glass:"Glast\xFCr",style_sliding:"Schiebet\xFCr",style_p Line truncated
A plugin runs with the same rights as NextFloor in your browser. The file has been reviewed and its content is fixed:
{url}`,manual:"Manual",manual_more:"Learn more",feature_text_energy:"Energy particles fly in arcs from the solar fields to the inverter, between house, battery, grid and consumers \u2013 faster and denser the more power flows. The modules sparkle with their production, a glass card over the roof shows the balance and how self-sufficient the house is right now.",live_autarky:"self-sufficient",live_fold:"Make the card small",live_unfold:"Open the card",live_day_hint:"The last 24 hours: solar (area) and consumption (line)",live_week_hint:"The last 7 days: sun {solar} kWh, use {use} kWh (yellow: sun, light: use)",live_days:"days",live_car_away:"On the road",live_car_charging:"Charging",live_car_plugged:"Plugged in",live_car_lock:"Lock",live_car_unlock:"Unlock",live_car_unlock_confirm:"Really unlock {name}?",live_car_climate:"Climate",live_car_charge:"Start/stop charging",live_media_prev:"Previous",live_media_playpause:"Play/pause",live_media_next:"Next",live_media_volume:"Volume",live_car_device:"Car (any entity of the car)",live_car_device_hint:"Charge, range, charging, plug, lock and climate are found by NextFloor on the car's device. Without one it takes the spot's presence sensor.",live_car_departure_entity:"Departure time (optional)",live_car_departure:"Departs {time}",live_car_open:"Open: {parts}",printer_printing:"printing",printer_done:"done",printer_paused:"paused",printer_error:"error",printer_idle:"idle",printer_done_at:"done at {time}",printer_layer:"Layer",printer_nozzle:"Nozzle",printer_bed:"Bed",heatpump_heating:"heating",heatpump_water:"making hot water",heatpump_cooling:"cooling",heatpump_defrost:"defrosting",heatpump_idle:"resting",heatpump_flow_return:"Flow \u2192 return",heatpump_heat:"Heat",heatpump_power:"Power",heatpump_outside:"outside",pack_missing_item:"Furniture of a removed pack",back_to_room:"Back to {room}",back_to_floor:"Back to the floor",hint_furniture:"Tap a room, then pick an item on the right \xB7 drag items, resize them by their corners",furniture_into:"New items go into the middle of \u201C{room}\u201D.",furniture_pick_room:"Tip: tap a room first \u2013 new items then land in its middle.",flows:"Power flow",flows_hint:"Show or hide the energy arcs between solar fields, inverter, battery, grid and consumers",chk_title:"Setup",chk_hint:"What the energy flow needs. Tap a row to jump there.",chk_solar:"Solar field in place",chk_solar_add:"Put a solar field on the roof",chk_meter:"Meter with grid sensor",chk_meter_sensor:"Meter: grid sensor (W) missing",chk_meter_add:"Add the meter",chk_inverter:"Inverter with power sensor",chk_inverter_sensor:"Inverter: power sensor missing",chk_inverter_add:"Add an inverter",chk_battery:"Home battery with power and charge",chk_battery_sensor:"Home battery: power or charge missing",chk_battery_opt:"Home battery (optional)",chk_grid:"Grid connection set",chk_grid_opt:"Grid connection (optional, else automatic)",energy_sign_grid:"The house shows export while the sun produces nothing. The grid sensor probably has its sign reversed.",energy_sign_battery:"The battery charges with no sun and no grid draw. Its sensor probably has its sign reversed.",energy_sign_flip:"Flip the sign",help_title:"Help and feedback",help_hint:"Please report problems as a GitHub issue and wishes as a discussion \u2013 nothing gets lost, and everyone sees the state.",help_issue:"Report a problem",help_idea:"Propose an idea",furn_name:"Name (optional)",furn_mirror:"Mirror",furn_mirror_hint:"Swap left and right \u2013 the L-sofa the other way round, the cabinet with its door on the other side, the kitchen run mirrored.",hint_opening:"Tap a wall to add a door or window \u2013 choose its kind on the right afterwards",preset_door:"Door",preset_door_double:"Double door",preset_window:"Window",preset_window_double:"Double window",preset_terrace:"Terrace door",preset_terrace_double:"French doors",preset_lift_slide:"Lift-and-slide door",preset_garage:"Garage door",preset_front:"Front door",opening_style:"Style",sidelight_auto:"automatic",sidelight_hinge:"Sidelight on the hinge side",sidelight_hinge_hint:"The sidelight sits opposite the hinge otherwise; ticked, it sits next to the hinges.",sidelight_width:"Sidelight width (m)",sidelight_width_left:"Left sidelight (m)",sidelight_width_right:"Right sidelight (m)",style_auto:"Automatic ({style})",style_interior:"Room door",style_front:"Front door",style_front_glass:"Front door with glass",style_sidelight:"Front door with sidelight",style_sidelights:"Front door with two sidelights",style_glass:"Glass door",style_sliding:"Sliding door",style_passage:"Opening (no door)",style_standard:"Standard",style_bars:"With glazing bars",style_glass_wall:"Glass wall (fixed)",preset_glass_wall:"Glass wall",glass_panes:"Panes",glass_panes_auto:"automatic (about 0.9 m)",glass_panes_hint:"0 = one single pane without mullions, empty = about every 0.9 m",flip_hinge:"Swap hinge side",flip_main_leaf:"Swap main leaf",flip_hinge_hint:"Hinges to the other side" Line truncated
{url}`,manual:"Manual",manual_more:"Learn more",feature_text_energy:"Energy particles fly in arcs from the solar fields to the inverter, between house, battery, grid and consumers \u2013 faster and denser the more power flows. The modules sparkle with their production, a glass card over the roof shows the balance and how self-sufficient the house is right now.",live_autarky:"self-sufficient",live_fold:"Make the card small",live_unfold:"Open the card",live_day_hint:"The last 24 hours: solar (area) and consumption (line)",live_week_hint:"The last 7 days: sun {solar} kWh, use {use} kWh (yellow: sun, light: use)",live_days:"days",live_car_away:"On the road",live_car_charging:"Charging",live_car_plugged:"Plugged in",live_car_lock:"Lock",live_car_unlock:"Unlock",live_car_unlock_confirm:"Really unlock {name}?",live_car_climate:"Climate",live_car_charge:"Start/stop charging",live_media_prev:"Previous",live_media_playpause:"Play/pause",live_media_next:"Next",live_media_volume:"Volume",live_car_device:"Car (any entity of the car)",live_car_device_hint:"Charge, range, charging, plug, lock and climate are found by NextFloor on the car's device. Without one it takes the spot's presence sensor.",live_car_departure_entity:"Departure time (optional)",live_car_departure:"Departs {time}",live_car_open:"Open: {parts}",printer_printing:"printing",printer_done:"done",printer_paused:"paused",printer_error:"error",printer_idle:"idle",printer_done_at:"done at {time}",printer_layer:"Layer",printer_nozzle:"Nozzle",printer_bed:"Bed",heatpump_heating:"heating",heatpump_water:"making hot water",heatpump_cooling:"cooling",heatpump_defrost:"defrosting",heatpump_idle:"resting",heatpump_flow_return:"Flow \u2192 return",heatpump_heat:"Heat",heatpump_power:"Power",heatpump_outside:"outside",pack_missing_item:"Furniture of a removed pack",back_to_room:"Back to {room}",back_to_floor:"Back to the floor",hint_furniture:"Tap a room, then pick an item on the right \xB7 drag items, resize them by their corners",furniture_into:"New items go into the middle of \u201C{room}\u201D.",furniture_pick_room:"Tip: tap a room first \u2013 new items then land in its middle.",flows:"Power flow",flows_hint:"Show or hide the energy arcs between solar fields, inverter, battery, grid and consumers",chk_title:"Setup",chk_hint:"What the energy flow needs. Tap a row to jump there.",chk_solar:"Solar field in place",chk_solar_add:"Put a solar field on the roof",chk_meter:"Meter with grid sensor",chk_meter_sensor:"Meter: grid sensor (W) missing",chk_meter_add:"Add the meter",chk_inverter:"Inverter with power sensor",chk_inverter_sensor:"Inverter: power sensor missing",chk_inverter_add:"Add an inverter",chk_battery:"Home battery with power and charge",chk_battery_sensor:"Home battery: power or charge missing",chk_battery_opt:"Home battery (optional)",chk_grid:"Grid connection set",chk_grid_opt:"Grid connection (optional, else automatic)",energy_sign_grid:"The house shows export while the sun produces nothing. The grid sensor probably has its sign reversed.",energy_sign_battery:"The battery charges with no sun and no grid draw. Its sensor probably has its sign reversed.",energy_sign_flip:"Flip the sign",help_title:"Help and feedback",help_hint:"Please report problems as a GitHub issue and wishes as a discussion \u2013 nothing gets lost, and everyone sees the state.",help_issue:"Report a problem",help_idea:"Propose an idea",furn_name:"Name (optional)",furn_mirror:"Mirror",furn_mirror_hint:"Swap left and right \u2013 the L-sofa the other way round, the cabinet with its door on the other side, the kitchen run mirrored.",hint_opening:"Tap a wall to add a door or window \u2013 choose its kind on the right afterwards",preset_door:"Door",preset_door_double:"Double door",preset_window:"Window",preset_window_double:"Double window",preset_terrace:"Terrace door",preset_terrace_double:"French doors",preset_lift_slide:"Lift-and-slide door",preset_garage:"Garage door",preset_front:"Front door",opening_style:"Style",sidelight_auto:"automatic",sidelight_hinge:"Sidelight on the hinge side",sidelight_hinge_hint:"The sidelight sits opposite the hinge otherwise; ticked, it sits next to the hinges.",sidelight_width:"Sidelight width (m)",sidelight_width_left:"Left sidelight (m)",sidelight_width_right:"Right sidelight (m)",style_auto:"Automatic ({style})",style_interior:"Room door",style_front:"Front door",style_front_glass:"Front door with glass",style_sidelight:"Front door with sidelight",style_sidelights:"Front door with two sidelights",style_glass:"Glass door",style_sliding:"Sliding door",style_passage:"Opening (no door)",style_standard:"Standard",style_bars:"With glazing bars",style_glass_wall:"Glass wall (fixed)",preset_glass_wall:"Glass wall",glass_panes:"Panes",glass_panes_auto:"automatic (about 0.9 m)",glass_panes_hint:"0 = one single pane without mullions, empty = about every 0.9 m",flip_hinge:"Swap hinge side",flip_main_leaf:"Swap main leaf",flip_hinge_hint:"Hinges to the other side" Line truncated
:host {
--nf-text: var(--primary-text-color, #e1e1e1);
--nf-muted: var(--secondary-text-color, #9b9b9b);
@@ -35,7 +35,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
font-family: var(--nf-font);
color: var(--nf-text);
}
`,Rr=J`
`,zr=J`
:host([readable]) {
--secondary-text-color: var(--primary-text-color, #e1e1e1);
--divider-color: color-mix(in srgb, var(--primary-text-color, #e1e1e1) 40%, transparent);
@@ -209,9 +209,9 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
min-height: 40px;
}
}
`;function zr(n){return n?.themes?.darkMode===!1?"light":"dark"}function vn(n,e){let t=new Set;return e.flatMap(r=>{let i=String(n?.states[r]?.attributes.symcon_source_entity||r),o=n?.states[i]?.attributes,s=Number(o?.symcon_id);return!s||!o?.symcon_archive||t.has(s)?[]:(t.add(s),[i])})}var hl,io=class extends Q{static properties={hass:{attribute:!1},ids:{attribute:!1},label:{attribute:!1},busy:{state:!0},error:{state:!0}};constructor(){super(),this.ids=[],this.label="",this.busy=!1,this.error=""}async open(e){e.stopPropagation(),this.busy=!0,this.error="";try{let t=new URL("./nextfloor-trend.js?v=84417e0b2573",import.meta.url).href;await(await(hl??=import(t).catch(i=>{throw hl=void 0,i}))).openTrend(this.hass,this.ids,this.label)}catch(t){this.error=t instanceof Error?t.message:String(t)}finally{this.busy=!1}}render(){if(!vn(this.hass,this.ids).length)return f;let e=this.label?`Trend anzeigen: ${this.label}`:"Trend anzeigen";return p`<button type="button" title=${e} aria-label=${e} aria-haspopup="dialog" ?disabled=${this.busy} @pointerdown=${t=>t.stopPropagation()} @click=${t=>{this.open(t)}}>
`;function Tr(n){return n?.themes?.darkMode===!1?"light":"dark"}function vn(n,e){let t=new Set;return e.flatMap(r=>{let i=String(n?.states[r]?.attributes.symcon_source_entity||r),o=n?.states[i]?.attributes,s=Number(o?.symcon_id);return!s||!o?.symcon_archive||t.has(s)?[]:(t.add(s),[i])})}var ml,oo=class extends Q{static properties={hass:{attribute:!1},ids:{attribute:!1},label:{attribute:!1},busy:{state:!0},error:{state:!0}};constructor(){super(),this.ids=[],this.label="",this.busy=!1,this.error=""}async open(e){e.stopPropagation(),this.busy=!0,this.error="";try{let t=new URL("./nextfloor-trend.js?v=84417e0b2573",import.meta.url).href;await(await(ml??=import(t).catch(i=>{throw ml=void 0,i}))).openTrend(this.hass,this.ids,this.label)}catch(t){this.error=t instanceof Error?t.message:String(t)}finally{this.busy=!1}}render(){if(!vn(this.hass,this.ids).length)return f;let e=this.label?`Trend anzeigen: ${this.label}`:"Trend anzeigen";return p`<button type="button" title=${e} aria-label=${e} aria-haspopup="dialog" ?disabled=${this.busy} @pointerdown=${t=>t.stopPropagation()} @click=${t=>{this.open(t)}}>
<svg width="12" height="12" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M3 2v15h15M5 13l4-5 4 2 4-6"/></svg>
</button>${this.error?p`<span role="alert">${this.error}</span>`:f}`}static styles=J`:host{position:relative;display:inline-flex;flex:0 0 18px;width:18px;height:18px;vertical-align:middle;margin-left:3px;font-weight:normal;line-height:0}button{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:18px;height:18px;padding:2px;border:0;border-radius:3px;background:transparent;color:var(--nf-accent,#40c8ff);opacity:.8;cursor:pointer}svg{display:block;flex-shrink:0}button:hover,button:focus-visible{opacity:1;background:#40c8ff18}button:focus-visible{outline:1px solid currentColor;outline-offset:1px}button:disabled{opacity:.4}span{position:absolute;right:0;top:22px;z-index:10;box-sizing:border-box;width:200px;padding:8px;border:1px solid #ff9b9b50;border-radius:6px;background:var(--nf-chrome-solid,#1c1c1c);font:12px/1.4 system-ui;color:#ff9b9b;white-space:normal}`};customElements.get("nf-trend-button")||customElements.define("nf-trend-button",io);function G(n,e,t=""){let r=vn(n,e);return r.length?p`<nf-trend-button .hass=${n} .ids=${r} .label=${t}></nf-trend-button>`:f}var oo=class extends Q{static properties={hass:{attribute:!1},room:{attribute:!1},_pending:{state:!0},_error:{state:!0}};constructor(){super(),this._pending=new Set,this._error=""}async send(e,t,r,i){this._pending=new Set([...this._pending,e]),this._error="";try{await this.hass.callService(t,r,{entity_id:e,...i})}catch(o){this._error=o instanceof Error?o.message:String(o)}finally{this._pending=new Set([...this._pending].filter(o=>o!==e))}}value(e,t,r){let i=this.hass.states[t],o=fe(i),s=i?.attributes,a=r&&!!s?.symcon_has_action&&o!==null&&!this._pending.has(t);return p`<div class="value"><span>${e}</span><b>${Fe(i)}${G(this.hass,[t],e)}</b>
</button>${this.error?p`<span role="alert">${this.error}</span>`:f}`}static styles=J`:host{position:relative;display:inline-flex;flex:0 0 18px;width:18px;height:18px;vertical-align:middle;margin-left:3px;font-weight:normal;line-height:0}button{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:18px;height:18px;padding:2px;border:0;border-radius:3px;background:transparent;color:var(--nf-accent,#40c8ff);opacity:.8;cursor:pointer}svg{display:block;flex-shrink:0}button:hover,button:focus-visible{opacity:1;background:#40c8ff18}button:focus-visible{outline:1px solid currentColor;outline-offset:1px}button:disabled{opacity:.4}span{position:absolute;right:0;top:22px;z-index:10;box-sizing:border-box;width:200px;padding:8px;border:1px solid #ff9b9b50;border-radius:6px;background:var(--nf-chrome-solid,#1c1c1c);font:12px/1.4 system-ui;color:#ff9b9b;white-space:normal}`};customElements.get("nf-trend-button")||customElements.define("nf-trend-button",oo);function G(n,e,t=""){let r=vn(n,e);return r.length?p`<nf-trend-button .hass=${n} .ids=${r} .label=${t}></nf-trend-button>`:f}var so=class extends Q{static properties={hass:{attribute:!1},room:{attribute:!1},_pending:{state:!0},_error:{state:!0}};constructor(){super(),this._pending=new Set,this._error=""}async send(e,t,r,i){this._pending=new Set([...this._pending,e]),this._error="";try{await this.hass.callService(t,r,{entity_id:e,...i})}catch(o){this._error=o instanceof Error?o.message:String(o)}finally{this._pending=new Set([...this._pending].filter(o=>o!==e))}}value(e,t,r){let i=this.hass.states[t],o=fe(i),s=i?.attributes,a=r&&!!s?.symcon_has_action&&o!==null&&!this._pending.has(t);return p`<div class="value"><span>${e}</span><b>${Fe(i)}${G(this.hass,[t],e)}</b>
${r&&s?.symcon_has_action&&s.symcon_variable_type===0?p`<button class="nf-chip" aria-pressed=${le(i)===!0} ?disabled=${!a} @click=${()=>{this.send(t,"symcon","set_value",{value:!le(i)})}}>${le(i)?"Ein":"Aus"}</button>`:r&&s?.symcon_has_action&&[1,2].includes(Number(s.symcon_variable_type))?p`<input type="number" aria-label=${e} .value=${String(ge(i)??"")} min=${String(s.symcon_min??0)} max=${String(s.symcon_max??100)} step=${String(s.symcon_step||(s.symcon_variable_type===1?1:.1))} ?disabled=${!a}
@change=${l=>{let u=l.target;u.value.trim()&&u.checkValidity()&&this.send(t,"symcon","set_value",{value:Number(u.value)})}} />`:f}
</div>`}schedule(e){let t=this.hass.states[e];if(!t?.attributes.symcon_schedule)return p`<p class="missing">Schaltuhr nicht verfügbar</p>`;let r=t.attributes.actions??[],i=t.attributes.groups??[],o=Number(t.attributes.next_run??0),s=r.find(u=>u.id===t.attributes.next_action),a=["Mo","Di","Mi","Do","Fr","Sa","So"],l=u=>`${String(u.hour).padStart(2,"0")}:${String(u.minute).padStart(2,"0")}${u.second?`:${String(u.second).padStart(2,"0")}`:""}`;return p`<details class="schedule"><summary>${String(t.attributes.friendly_name??"Schaltuhr")}</summary>
@@ -220,7 +220,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${i.length?i.map(u=>p`<div class="schedule-group"><b>${a.filter((c,h)=>u.days&1<<h).join(" \xB7 ")}</b><div class="points">
${[...u.points].sort((c,h)=>c.hour*3600+c.minute*60+c.second-(h.hour*3600+h.minute*60+h.second)).map(c=>{let h=r.find(m=>m.id===c.action);return p`<span class="point"><time>${l(c)}</time><span class="dot" style=${`background:#${Number(h?.color??8885929).toString(16).padStart(6,"0").slice(-6)}`}></span>${h?.name||"Aktion"}</span>`})}
</div></div>`):p`<p class="missing">Keine Schaltpunkte vorhanden.</p>`}
</details>`}render(){if(!this.hass||!this.room)return f;let e=dl.filter(i=>i.key!=="status"&&this.room.hvac?.[i.key]&&this.room.hvac[i.key]!=="none"),t=this.room.hvac?.schedules??[],r=this.room.floor_heating&&this.room.floor_heating!=="none"?this.room.floor_heating:null;return p`${r||e.length?p`<section><h3>Raumklima</h3>${r?this.value("Fu\xDFbodenheizung",r,!0):f}${e.map(i=>this.value(i.label,this.room.hvac[i.key],!!i.control))}</section>`:f}
</details>`}render(){if(!this.hass||!this.room)return f;let e=hl.filter(i=>i.key!=="status"&&this.room.hvac?.[i.key]&&this.room.hvac[i.key]!=="none"),t=this.room.hvac?.schedules??[],r=this.room.floor_heating&&this.room.floor_heating!=="none"?this.room.floor_heating:null;return p`${r||e.length?p`<section><h3>Raumklima</h3>${r?this.value("Fu\xDFbodenheizung",r,!0):f}${e.map(i=>this.value(i.label,this.room.hvac[i.key],!!i.control))}</section>`:f}
${t.length?p`<section><h3>Schaltuhren</h3>${t.map(i=>this.schedule(i))}</section>`:f}
${this._error?p`<p role="alert" class="error">${this._error}</p>`:f}`}static styles=[ve,He,J`
:host { display:block; }
@@ -240,8 +240,8 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.point time { font-variant-numeric:tabular-nums; }
.dot { width:8px; height:8px; border-radius:50%; }
.error { color:var(--nf-danger,#ff6b7a); font-size:12px; }
`]};customElements.get("nf-room-hvac")||customElements.define("nf-room-hvac",oo);var om=new Set(["on","home","open","true","active","playing","heat","heating"]);function Ue(n,e){let t=e.show_when;if(!t?.entity||!n)return!0;let r=n.states[t.entity];if(!r||C(r))return!0;let i=String(r.state).toLowerCase(),o=(t.state??"").split(",").map(a=>a.trim().toLowerCase()).filter(Boolean),s=o.length?o.includes(i):om.has(i)||Number.isFinite(Number(i))&&Number(i)>0;return t.invert?!s:s}function so(n,e){let t=[];for(let r of e.floors)for(let i of r.furniture)Ue(n,i)||t.push(i.id);return t.sort()}function ml(n,e){if(!e.length)return n;let t=new Set(e);return{...n,floors:n.floors.map(r=>r.furniture.some(i=>t.has(i.id))?{...r,furniture:r.furniture.filter(i=>!t.has(i.id))}:r)}}function ae(n,e){if(!Hi(e))return $(n,`furn_${e}`);let t=X(e);return t?sm(t,e,n?.language??navigator.language):$(n,"pack_missing_item")}function sm(n,e,t){return n.name[t.split("-")[0]]??qa(t,e)??Xs(n,t)}var ee=(n,e)=>[n[0]-e[0],n[1]-e[1]],Pe=(n,e)=>[n[0]+e[0],n[1]+e[1]],Se=(n,e)=>[n[0]*e,n[1]*e],ce=(n,e)=>n[0]*e[0]+n[1]*e[1],je=(n,e)=>n[0]*e[1]-n[1]*e[0],qe=n=>Math.hypot(n[0],n[1]),$e=n=>{let e=qe(n)||1;return[n[0]/e,n[1]/e]},ao=n=>[-n[1],n[0]],lo=n=>[n[1],-n[0]];function pl(n){let e=n.heightEnd!==void 0;return{...n,a:n.b,b:n.a,left:n.right,right:n.left,roomLeft:n.roomRight,roomRight:n.roomLeft,height:e?n.heightEnd:n.height,heightEnd:e?n.height:void 0}}function am(n,e){let t=n.map(r=>({...r}));for(let r of e){let i=t.find(o=>o.room_id===r.room_id&&o.edge===r.edge&&(Math.abs(o.t1-r.t0)<1e-6||Math.abs(r.t1-o.t0)<1e-6));i?(i.t0=Math.min(i.t0,r.t0),i.t1=Math.max(i.t1,r.t1)):t.push({...r})}return t}function lm(n,e,t){if(n.a===e.b)return!1;let r=$e(ee(t[n.b],t[n.a])),i=$e(ee(t[e.b],t[e.a]));return Math.abs(je(r,i))>1e-6||ce(r,i)<=0||n.free||e.free||n.heightEnd!==void 0||e.heightEnd!==void 0?!1:n.height===e.height&&n.exterior===e.exterior&&n.roomLeft===e.roomLeft&&n.roomRight===e.roomRight&&Math.abs(n.left-e.left)<=1e-9&&Math.abs(n.right-e.right)<=1e-9}function fl(n,e,t=new Set){let r=n.slice();for(;;){let i=new Map;r.forEach((s,a)=>{for(let l of[s.a,s.b])i.set(l,[...i.get(l)??[],a])});let o=null;for(let[s,a]of i){if(a.length!==2||t.has(s))continue;let l=r[a[0]].b===s?r[a[0]]:pl(r[a[0]]),u=r[a[1]].a===s?r[a[1]]:pl(r[a[1]]);if(!lm(l,u,e))continue;let c={...l,b:u.b,sources:am(l.sources,u.sources)};o=[...r.filter((h,m)=>m!==a[0]&&m!==a[1]),c];break}if(!o)return r;r=o}}function gl(n,e){let t=new Map;n.forEach((i,o)=>{let s=$e(ee(e[i.b],e[i.a])),a=[[i.a,{key:`${o}:a`,d:s,left:i.left,right:i.right,angle:Math.atan2(s[1],s[0])}],[i.b,{key:`${o}:b`,d:Se(s,-1),left:i.right,right:i.left,angle:Math.atan2(-s[1],-s[0])}]];for(let[l,u]of a)t.set(l,[...t.get(l)??[],u])});let r=new Map;for(let[i,o]of t){let s=e[i];o.sort((l,u)=>l.angle-u.angle);for(let l of o)r.set(l.key,{left:Pe(s,Se(ao(l.d),l.left)),right:Pe(s,Se(lo(l.d),l.right))});if(o.length<2)continue;let a=4*Math.max(...o.map(l=>Math.max(l.left,l.right)))+1e-9;o.forEach((l,u)=>{let c=o[(u+1)%o.length],h=Pe(s,Se(ao(l.d),l.left)),m=Pe(s,Se(lo(c.d),c.right)),d=je(l.d,c.d);if(Math.abs(d)<1e-4)return;let g=Pe(h,Se(l.d,je(ee(m,h),c.d)/d));qe(ee(g,s))>a||(r.get(l.key).left=g,r.get(c.key).right=g)})}return r}function _l(n,e){let t=n.filter((r,i)=>qe(ee(r,n[(i+1)%n.length]))>e);for(;;){if(t.length<=3)return t;let r=t.findIndex((i,o)=>{let s=t[(o+t.length-1)%t.length],a=t[(o+1)%t.length],[l,u]=[ee(i,s),ee(a,i)];return Math.abs(je($e(l),$e(u)))<1e-7&&ce(l,u)>0});if(r===-1)return t;t=t.filter((i,o)=>o!==r)}}function um(n){let e=[];return{points:e,idOf(t){let r=e.findIndex(i=>Math.abs(i[0]-t[0])<=n&&Math.abs(i[1]-t[1])<=n);return r>=0?r:(e.push([t[0],t[1]]),e.length-1)}}}function cm(n,e){let t=[];for(let r of n){let i=r.points;if(i.length<3||Math.abs(gt(i))<1e-6)continue;let o=gt(i)>0,s=i.map(a=>e.idOf(a));s.forEach((a,l)=>{let u=s[(l+1)%s.length];a!==u&&t.push(o?{u:a,v:u,room:r.id,edge:l,forward:!0}:{u,v:a,room:r.id,edge:l,forward:!1})})}return t}function dm(n,e,t){let r=[];for(let i of n){let[o,s]=[e[i.u],e[i.v]],a=ee(s,o),l=qe(a),u=Se(a,1/l),c=e.map((m,d)=>({id:d,rel:ee(m,o)})).filter(({id:m,rel:d})=>m!==i.u&&m!==i.v&&ce(d,u)>t&&ce(d,u)<l-t&&Math.abs(je(u,d))<=t).map(({id:m,rel:d})=>({t:ce(d,u),id:m})).sort((m,d)=>m.t-d.t),h=[{t:0,id:i.u},...c,{t:l,id:i.v}];for(let m=0;m+1<h.length;m++){let[d,g]=[h[m],h[m+1]];r.push({u:d.id,v:g.id,room:i.room,edge:i.edge,t0:i.forward?d.t:l-g.t,t1:i.forward?g.t:l-d.t,forward:i.forward})}}return r}var bl=n=>({room_id:n.room,edge:n.edge,t0:n.t0,t1:n.t1});function hm(n,e){let t=new Map(n.map(a=>[a.id,a])),r=new Map;for(let a of e){let l=`${a.room}:${a.edge}`;r.set(l,[...r.get(l)??[],a.t0].sort((u,c)=>u-c))}let i=a=>{let l=t.get(a.room)?.wall_heights?.[a.edge];return Array.isArray(l)?l[(r.get(`${a.room}:${a.edge}`)??[]).indexOf(a.t0)]??null:l},o=a=>{let l=t.get(a.room),[u,c]=[l?.wall_heights?.[a.edge],l?.wall_slopes?.[a.edge]];if(!l||typeof u!="number"||typeof c!="number"||u<=0||c<=0)return null;le Line truncated
<h4>${$n[e]} ${Ie[e]}</h4>
`]};customElements.get("nf-room-hvac")||customElements.define("nf-room-hvac",so);var am=new Set(["on","home","open","true","active","playing","heat","heating"]);function Ue(n,e){let t=e.show_when;if(!t?.entity||!n)return!0;let r=n.states[t.entity];if(!r||C(r))return!0;let i=String(r.state).toLowerCase(),o=(t.state??"").split(",").map(a=>a.trim().toLowerCase()).filter(Boolean),s=o.length?o.includes(i):am.has(i)||Number.isFinite(Number(i))&&Number(i)>0;return t.invert?!s:s}function ao(n,e){let t=[];for(let r of e.floors)for(let i of r.furniture)Ue(n,i)||t.push(i.id);return t.sort()}function pl(n,e){if(!e.length)return n;let t=new Set(e);return{...n,floors:n.floors.map(r=>r.furniture.some(i=>t.has(i.id))?{...r,furniture:r.furniture.filter(i=>!t.has(i.id))}:r)}}function ae(n,e){if(!Pi(e))return $(n,`furn_${e}`);let t=X(e);return t?lm(t,e,n?.language??navigator.language):$(n,"pack_missing_item")}function lm(n,e,t){return n.name[t.split("-")[0]]??Za(t,e)??ea(n,t)}var ee=(n,e)=>[n[0]-e[0],n[1]-e[1]],Pe=(n,e)=>[n[0]+e[0],n[1]+e[1]],Se=(n,e)=>[n[0]*e,n[1]*e],ce=(n,e)=>n[0]*e[0]+n[1]*e[1],je=(n,e)=>n[0]*e[1]-n[1]*e[0],qe=n=>Math.hypot(n[0],n[1]),$e=n=>{let e=qe(n)||1;return[n[0]/e,n[1]/e]},lo=n=>[-n[1],n[0]],uo=n=>[n[1],-n[0]];function fl(n){let e=n.heightEnd!==void 0;return{...n,a:n.b,b:n.a,left:n.right,right:n.left,roomLeft:n.roomRight,roomRight:n.roomLeft,height:e?n.heightEnd:n.height,heightEnd:e?n.height:void 0}}function um(n,e){let t=n.map(r=>({...r}));for(let r of e){let i=t.find(o=>o.room_id===r.room_id&&o.edge===r.edge&&(Math.abs(o.t1-r.t0)<1e-6||Math.abs(r.t1-o.t0)<1e-6));i?(i.t0=Math.min(i.t0,r.t0),i.t1=Math.max(i.t1,r.t1)):t.push({...r})}return t}function cm(n,e,t){if(n.a===e.b)return!1;let r=$e(ee(t[n.b],t[n.a])),i=$e(ee(t[e.b],t[e.a]));return Math.abs(je(r,i))>1e-6||ce(r,i)<=0||n.free||e.free||n.heightEnd!==void 0||e.heightEnd!==void 0?!1:n.height===e.height&&n.exterior===e.exterior&&n.roomLeft===e.roomLeft&&n.roomRight===e.roomRight&&Math.abs(n.left-e.left)<=1e-9&&Math.abs(n.right-e.right)<=1e-9}function gl(n,e,t=new Set){let r=n.slice();for(;;){let i=new Map;r.forEach((s,a)=>{for(let l of[s.a,s.b])i.set(l,[...i.get(l)??[],a])});let o=null;for(let[s,a]of i){if(a.length!==2||t.has(s))continue;let l=r[a[0]].b===s?r[a[0]]:fl(r[a[0]]),u=r[a[1]].a===s?r[a[1]]:fl(r[a[1]]);if(!cm(l,u,e))continue;let c={...l,b:u.b,sources:um(l.sources,u.sources)};o=[...r.filter((h,m)=>m!==a[0]&&m!==a[1]),c];break}if(!o)return r;r=o}}function _l(n,e){let t=new Map;n.forEach((i,o)=>{let s=$e(ee(e[i.b],e[i.a])),a=[[i.a,{key:`${o}:a`,d:s,left:i.left,right:i.right,angle:Math.atan2(s[1],s[0])}],[i.b,{key:`${o}:b`,d:Se(s,-1),left:i.right,right:i.left,angle:Math.atan2(-s[1],-s[0])}]];for(let[l,u]of a)t.set(l,[...t.get(l)??[],u])});let r=new Map;for(let[i,o]of t){let s=e[i];o.sort((l,u)=>l.angle-u.angle);for(let l of o)r.set(l.key,{left:Pe(s,Se(lo(l.d),l.left)),right:Pe(s,Se(uo(l.d),l.right))});if(o.length<2)continue;let a=4*Math.max(...o.map(l=>Math.max(l.left,l.right)))+1e-9;o.forEach((l,u)=>{let c=o[(u+1)%o.length],h=Pe(s,Se(lo(l.d),l.left)),m=Pe(s,Se(uo(c.d),c.right)),d=je(l.d,c.d);if(Math.abs(d)<1e-4)return;let g=Pe(h,Se(l.d,je(ee(m,h),c.d)/d));qe(ee(g,s))>a||(r.get(l.key).left=g,r.get(c.key).right=g)})}return r}function bl(n,e){let t=n.filter((r,i)=>qe(ee(r,n[(i+1)%n.length]))>e);for(;;){if(t.length<=3)return t;let r=t.findIndex((i,o)=>{let s=t[(o+t.length-1)%t.length],a=t[(o+1)%t.length],[l,u]=[ee(i,s),ee(a,i)];return Math.abs(je($e(l),$e(u)))<1e-7&&ce(l,u)>0});if(r===-1)return t;t=t.filter((i,o)=>o!==r)}}function dm(n){let e=[];return{points:e,idOf(t){let r=e.findIndex(i=>Math.abs(i[0]-t[0])<=n&&Math.abs(i[1]-t[1])<=n);return r>=0?r:(e.push([t[0],t[1]]),e.length-1)}}}function hm(n,e){let t=[];for(let r of n){let i=r.points;if(i.length<3||Math.abs(gt(i))<1e-6)continue;let o=gt(i)>0,s=i.map(a=>e.idOf(a));s.forEach((a,l)=>{let u=s[(l+1)%s.length];a!==u&&t.push(o?{u:a,v:u,room:r.id,edge:l,forward:!0}:{u,v:a,room:r.id,edge:l,forward:!1})})}return t}function mm(n,e,t){let r=[];for(let i of n){let[o,s]=[e[i.u],e[i.v]],a=ee(s,o),l=qe(a),u=Se(a,1/l),c=e.map((m,d)=>({id:d,rel:ee(m,o)})).filter(({id:m,rel:d})=>m!==i.u&&m!==i.v&&ce(d,u)>t&&ce(d,u)<l-t&&Math.abs(je(u,d))<=t).map(({id:m,rel:d})=>({t:ce(d,u),id:m})).sort((m,d)=>m.t-d.t),h=[{t:0,id:i.u},...c,{t:l,id:i.v}];for(let m=0;m+1<h.length;m++){let[d,g]=[h[m],h[m+1]];r.push({u:d.id,v:g.id,room:i.room,edge:i.edge,t0:i.forward?d.t:l-g.t,t1:i.forward?g.t:l-d.t,forward:i.forward})}}return r}var vl=n=>({room_id:n.room,edge:n.edge,t0:n.t0,t1:n.t1});function pm(n,e){let t=new Map(n.map(a=>[a.id,a])),r=new Map;for(let a of e){let l=`${a.room}:${a.edge}`;r.set(l,[...r.get(l)??[],a.t0].sort((u,c)=>u-c))}let i=a=>{let l=t.get(a.room)?.wall_heights?.[a.edge];return Array.isArray(l)?l[(r.get(`${a.room}:${a.edge}`)??[]).indexOf(a.t0)]??null:l},o=a=>{let l=t.get(a.room),[u,c]=[l?.wall_heights?.[a.edge],l?.wall_slopes?.[a.edge]];if(!l||typeof u!="number"||typeof c!="number"||u<=0||c<=0)return null;le Line truncated
<h4>${Mn[e]} ${Ie[e]}</h4>
${this.readings.filter(t=>t.kind===e).map(t=>p`<div class="reading" title=${`${t.manual?"Eigener Z\xE4hler":"Bereichsz\xE4hler"}${t.incomplete?" \xB7 Err: Mindestens ein Wert fehlt; angezeigt wird die Summe der verf\xFCgbaren Werte.":""}
${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states[r]?.attributes.friendly_name||r).join(`
`)}`}>
@@ -256,12 +256,12 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.reading span { color:var(--nf-muted,#aaa); }
b { white-space:nowrap; font-variant-numeric:tabular-nums; }
small { font-size:.85em; }
`};customElements.get("nf-utility-report")||customElements.define("nf-utility-report",go);var bo=Math.PI/180,Nl=3,Ll=.1,_o=1/6,Ol=(n,e)=>[Math.sin((e+n)*bo),-Math.cos((e+n)*bo)],Rm=["N","NE","E","SE","S","SW","W","NW"];function zm(n,e,t){return Wl(n,e,t).map(r=>r.normal)}function Wl(n,e,t){let r=[];for(let i of n.openings){if(i.room_id!==e.id||i.type==="garage")continue;let o=wl(i,n.rooms,n.walls??[]),s=o?kl(t,i,o):null;if(!s||!s.wall.exterior)continue;let{wall:a}=s,l=Math.hypot(a.b[0]-a.a[0],a.b[1]-a.a[1]);if(l<1e-6)continue;let u=[-(a.b[1]-a.a[1])/l,(a.b[0]-a.a[0])/l],c=a.roomLeft===e.id?u:[-u[0],-u[1]];r.push({opening:i,normal:[-c[0],-c[1]]})}return r}function Tm(n,e){let t=((Math.atan2(n[0],-n[1])/bo-e)%360+360)%360;return Rm[Math.round(t/45)%8]}var Il=new WeakMap;function Bl(n,e){let t=Il.get(e);return t||(t=Lt(e.rooms,{exterior:n.settings.wall_exterior,interior:n.settings.wall_interior},e.walls??[]).walls,Il.set(e,t)),t}var Cl=new WeakMap;function Kt(n,e,t,r,i=new Date){let o=`${t.id}|${i.toISOString().slice(0,10)}|${n.settings.north??0}|${r.latitude},${r.longitude},${r.zone??""}`,s=Cl.get(e);s||Cl.set(e,s=new Map);let a=s.get(o);if(a)return a;let l=Dm(n,e,t,r,i);return s.set(o,l),l}function Dm(n,e,t,r,i){let o=n.settings.north??0,s=zm(e,t,Bl(n,e)),a=[...new Set(s.map(u=>Tm(u,o)))];if(!s.length)return{hours:0,facing:a};let l=0;for(let u=_o/2;u<24;u+=_o){let c=ft(Et(u,r.zone,i),r.latitude,r.longitude);if(c.elevation<Nl)continue;let h=Ol(c.azimuth,o);s.some(m=>m[0]*h[0]+m[1]*h[1]>Ll)&&l++}return{hours:Math.round(l*_o*10)/10,facing:a}}function Vl(n,e,t,r,i=new Date().getFullYear()){return Array.from({length:12},(o,s)=>Kt(n,e,t,r,new Date(Date.UTC(i,s,15,12))).hours)}function Kl(n,e,t,r,i=new Date){let o=ft(i,r.latitude,r.longitude);if(o.elevation<Nl)return[];let s=Ol(o.azimuth,n.settings.north??0);return Wl(e,t,Bl(n,e)).filter(a=>a.normal[0]*s[0]+a.normal[1]*s[1]>Ll).map(a=>a.opening)}var Gl=n=>6.112*Math.exp(17.62*n/(243.12+n));function Gt(n,e,t=4){if(n===null||e===null)return null;let r=Math.min(100,e*Gl(n)/Gl(n-t));return Math.round(Math.min(100,Math.max(0,(r-65)/20*100)))}function Or(n,e,t){return t!==null&&t>=70?"mould":n!==null&&n>=1e3?"co2":e!==null&&e>=65?"humidity":null}function yt(n=new Date,e=50){let t=n.getMonth(),r=t>=4&&t<=8;return e<0?!r:r}function Wr(n,e,t,r=!1){let i=[];if(n!==null){let[s,a]=r?[22,26]:[20,23],l=n<s?s-n:n>a?n-a:0;i.push(Math.max(0,100-l*15))}if(e!==null){let s=e<40?40-e:e>60?e-60:0;i.push(Math.max(0,100-s*4))}if(t!==null&&i.push(Math.max(0,Math.min(100,100-(t-800)/600*100))),!i.length)return null;let o=i.reduce((s,a)=>s+a,0)/i.length;return Math.round(Math.min(o,Math.min(...i)+30))}var Fm={temperature:{deviceClass:"temperature",unit:"\xB0C",stops:[[16,[.2,.45,1]],[20,[.15,.85,.75]],[22.5,[.95,.8,.3]],[26,[1,.28,.18]]]},humidity:{deviceClass:"humidity",unit:"%",stops:[[30,[.95,.6,.2]],[45,[.3,.88,.5]],[60,[.2,.78,1]],[75,[.32,.4,.98]]]},co2:{deviceClass:"carbon_dioxide",unit:"ppm",stops:[[450,[.3,.88,.5]],[800,[.98,.84,.3]],[1200,[1,.5,.2]],[1600,[.98,.25,.25]]]},mould:{deviceClass:"",unit:"%",stops:[[0,[.3,.88,.5]],[40,[.98,.84,.3]],[70,[1,.5,.2]],[100,[.75,.2,.55]]]},comfort:{deviceClass:"",unit:"",stops:[[0,[.98,.25,.25]],[40,[1,.5,.2]],[65,[.98,.84,.3]],[85,[.3,.88,.5]],[100,[.2,.8,.7]]]},power:{deviceClass:"power",unit:"W",stops:[[0,[.25,.4,.6]],[100,[.3,.88,.5]],[500,[.98,.84,.3]],[1500,[1,.5,.2]],[3e3,[.98,.25,.25]]]},sun:{deviceClass:"",unit:"h",stops:[[0,[.22,.3,.55]],[2,[.35,.6,.85]],[4,[.98,.84,.3]],[7,[1,.62,.2]],[10,[1,.42,.25]]]}},Hm={deviceClass:"temperature",unit:"\xB0C",stops:[[19,[.2,.45,1]],[22.5,[.15,.85,.75]],[25.5,[.95,.8,.3]],[29,[1,.28,.18]]]};function Br(n,e=!1){return n==="temperature"&&e?Hm:Fm[n]}var Pm=(n,e,t)=>[n[0]+(e[0]-n[0])*t,n[1]+(e[1]-n[1])*t,n[2]+(e[2]-n[2])*t];function Ul(n,e,t=!1){let{stops:r}=Br(n,t),i=r.findIndex(([u])=>e<=u);if(i===-1)return r[r.length-1][1];if(i===0)return r[0][1];let[o,s]=r[i-1],[a,l]=r[i];return Pm(s,l,(e-o)/(a-o))}function vo(n,e,t,r){let i=Wt(n,r,e.floors?.flatMap(s=>s.rooms)??t.rooms).filter(s=>s.kind==="electricity"&&s.metric==="power");if(i.length)return i.find(s=>s.unit==="W")?.value??null;let o=null;for(let s of yo(n,e,t,r)){let a=q(n.states[s]);a!==null&&(o=(o??0)+Math.max(0,a))}return o}function yo(n,e,t,r){let i=Wt(n,r,e.floors?.flatMap(h=>h.rooms)??t.rooms).filter(h=>h.kind==="electricity"&&h.metric==="power");if(i.length)return i.filter(h=>h.unit==="W").flatMap(h=>h.sources);let{grid:o,solar:s,battery:a}=e.energy,l=new Set([o,s,a].filter(Boolean)),u=new Set,c=(h,m)=>r.points.length>=3&&H([h,m],r.points);for(let h of t.placements){let m=c(h.x,h.z)?ye(n,h.entity_id):null;m&&u.add(m)}for(let h of t.furniture){if(!c(h.x,h.z))continue;let m=h.power&&h.power!=="none"?h.power:h.entity&&h.entity!=="none"?ye(n,h.entity):null;m&&u.add(m);for(let d of h.gang_entities??[]){let g=d&&d!=="none"?ye(n,d):null;g&&u.add(g)}}return[...u].filter(h=>!l.has(h))}function jl(n,e,t){let r=new Map;for(let i of e.floors)for( Line truncated
<path d=${$r(n)} />
</svg>`,Ur={previous:"M6 6h2v12H6zM20 6v12l-10-6z",play:"M8 5v14l11-7z",pause:"M7 5h4v14H7zM13 5h4v14h-4z",next:"M16 6h2v12h-2zM4 6v12l10-6z"},ko=n=>p`<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d=${n} /></svg>`,up=24,cp=10,So=class extends Q{static properties={hass:{attribute:!1},room:{attribute:!1},floor:{attribute:!1},confirmEntities:{attribute:!1},phrases:{attribute:!1},outside:{attribute:!1},_showAll:{state:!0},_said:{state:!0},_folded:{state:!0},_curve:{state:!0},_moodName:{state:!0},_undo:{state:!0},_energy:{state:!0},_sunYear:{state:!0},rooms:{attribute:!1},building:{attribute:!1}};saidTimer;memo=null;curveFor="";undoTimer;constructor(){super(),this.room=null,this.floor=null,this.phrases=null,this.outside=null,this._said=null,this._showAll=!1,this._folded=!1,this._curve=null,this._moodName=null,this._undo=null,this._energy=null,this._sunYear=!1,this.rooms=null,this.building=null}fireMoods(e,t){this.dispatchEvent(new CustomEvent("mood-change",{detail:{roomId:e.id,moods:t},bubbles:!0,composed:!0}))}runMood(e){for(let t of Kr(e))this.call("light",t.service,t.data)}renderMoods(e,t){let r=e.moods??[],i=!!this.rooms&&!!this.hass.user?.is_admin;if(!r.length&&!i)return f;let o=(this.rooms??[]).filter(l=>l.id!==e.id&&l.area_id),s=l=>U(this.hass,l).filter(u=>u.startsWith("light.")),a=()=>{let l=(this._moodName??"").trim()||this.t("mood_new");this.fireMoods(e,[...r,{id:`mood_${Date.now().toString(36)}`,name:l,lights:t.map(Vr)}]),this._moodName=null};return p`<div class="nf-rp-moods">
`};customElements.get("nf-utility-report")||customElements.define("nf-utility-report",_o);var vo=Math.PI/180,Ol=3,Wl=.1,bo=1/6,Bl=(n,e)=>[Math.sin((e+n)*vo),-Math.cos((e+n)*vo)],Dm=["N","NE","E","SE","S","SW","W","NW"];function Fm(n,e,t){return Vl(n,e,t).map(r=>r.normal)}function Vl(n,e,t){let r=[];for(let i of n.openings){if(i.room_id!==e.id||i.type==="garage")continue;let o=xl(i,n.rooms,n.walls??[]),s=o?Sl(t,i,o):null;if(!s||!s.wall.exterior)continue;let{wall:a}=s,l=Math.hypot(a.b[0]-a.a[0],a.b[1]-a.a[1]);if(l<1e-6)continue;let u=[-(a.b[1]-a.a[1])/l,(a.b[0]-a.a[0])/l],c=a.roomLeft===e.id?u:[-u[0],-u[1]];r.push({opening:i,normal:[-c[0],-c[1]]})}return r}function Hm(n,e){let t=((Math.atan2(n[0],-n[1])/vo-e)%360+360)%360;return Dm[Math.round(t/45)%8]}var Nl=new WeakMap;function Kl(n,e){let t=Nl.get(e);return t||(t=Lt(e.rooms,{exterior:n.settings.wall_exterior,interior:n.settings.wall_interior},e.walls??[]).walls,Nl.set(e,t)),t}var Ll=new WeakMap;function Kt(n,e,t,r,i=new Date){let o=`${t.id}|${i.toISOString().slice(0,10)}|${n.settings.north??0}|${r.latitude},${r.longitude},${r.zone??""}`,s=Ll.get(e);s||Ll.set(e,s=new Map);let a=s.get(o);if(a)return a;let l=Pm(n,e,t,r,i);return s.set(o,l),l}function Pm(n,e,t,r,i){let o=n.settings.north??0,s=Fm(e,t,Kl(n,e)),a=[...new Set(s.map(u=>Hm(u,o)))];if(!s.length)return{hours:0,facing:a};let l=0;for(let u=bo/2;u<24;u+=bo){let c=ft(Et(u,r.zone,i),r.latitude,r.longitude);if(c.elevation<Ol)continue;let h=Bl(c.azimuth,o);s.some(m=>m[0]*h[0]+m[1]*h[1]>Wl)&&l++}return{hours:Math.round(l*bo*10)/10,facing:a}}function Gl(n,e,t,r,i=new Date().getFullYear()){return Array.from({length:12},(o,s)=>Kt(n,e,t,r,new Date(Date.UTC(i,s,15,12))).hours)}function Ul(n,e,t,r,i=new Date){let o=ft(i,r.latitude,r.longitude);if(o.elevation<Ol)return[];let s=Bl(o.azimuth,n.settings.north??0);return Vl(e,t,Kl(n,e)).filter(a=>a.normal[0]*s[0]+a.normal[1]*s[1]>Wl).map(a=>a.opening)}var jl=n=>6.112*Math.exp(17.62*n/(243.12+n));function Gt(n,e,t=4){if(n===null||e===null)return null;let r=Math.min(100,e*jl(n)/jl(n-t));return Math.round(Math.min(100,Math.max(0,(r-65)/20*100)))}function Wr(n,e,t){return t!==null&&t>=70?"mould":n!==null&&n>=1e3?"co2":e!==null&&e>=65?"humidity":null}function yt(n=new Date,e=50){let t=n.getMonth(),r=t>=4&&t<=8;return e<0?!r:r}function Br(n,e,t,r=!1){let i=[];if(n!==null){let[s,a]=r?[22,26]:[20,23],l=n<s?s-n:n>a?n-a:0;i.push(Math.max(0,100-l*15))}if(e!==null){let s=e<40?40-e:e>60?e-60:0;i.push(Math.max(0,100-s*4))}if(t!==null&&i.push(Math.max(0,Math.min(100,100-(t-800)/600*100))),!i.length)return null;let o=i.reduce((s,a)=>s+a,0)/i.length;return Math.round(Math.min(o,Math.min(...i)+30))}var Im={temperature:{deviceClass:"temperature",unit:"\xB0C",stops:[[16,[.2,.45,1]],[20,[.15,.85,.75]],[22.5,[.95,.8,.3]],[26,[1,.28,.18]]]},humidity:{deviceClass:"humidity",unit:"%",stops:[[30,[.95,.6,.2]],[45,[.3,.88,.5]],[60,[.2,.78,1]],[75,[.32,.4,.98]]]},co2:{deviceClass:"carbon_dioxide",unit:"ppm",stops:[[450,[.3,.88,.5]],[800,[.98,.84,.3]],[1200,[1,.5,.2]],[1600,[.98,.25,.25]]]},mould:{deviceClass:"",unit:"%",stops:[[0,[.3,.88,.5]],[40,[.98,.84,.3]],[70,[1,.5,.2]],[100,[.75,.2,.55]]]},comfort:{deviceClass:"",unit:"",stops:[[0,[.98,.25,.25]],[40,[1,.5,.2]],[65,[.98,.84,.3]],[85,[.3,.88,.5]],[100,[.2,.8,.7]]]},power:{deviceClass:"power",unit:"W",stops:[[0,[.25,.4,.6]],[100,[.3,.88,.5]],[500,[.98,.84,.3]],[1500,[1,.5,.2]],[3e3,[.98,.25,.25]]]},sun:{deviceClass:"",unit:"h",stops:[[0,[.22,.3,.55]],[2,[.35,.6,.85]],[4,[.98,.84,.3]],[7,[1,.62,.2]],[10,[1,.42,.25]]]}},Cm={deviceClass:"temperature",unit:"\xB0C",stops:[[19,[.2,.45,1]],[22.5,[.15,.85,.75]],[25.5,[.95,.8,.3]],[29,[1,.28,.18]]]};function Vr(n,e=!1){return n==="temperature"&&e?Cm:Im[n]}var Nm=(n,e,t)=>[n[0]+(e[0]-n[0])*t,n[1]+(e[1]-n[1])*t,n[2]+(e[2]-n[2])*t];function ql(n,e,t=!1){let{stops:r}=Vr(n,t),i=r.findIndex(([u])=>e<=u);if(i===-1)return r[r.length-1][1];if(i===0)return r[0][1];let[o,s]=r[i-1],[a,l]=r[i];return Nm(s,l,(e-o)/(a-o))}function yo(n,e,t,r){let i=Wt(n,r,e.floors?.flatMap(s=>s.rooms)??t.rooms).filter(s=>s.kind==="electricity"&&s.metric==="power");if(i.length)return i.find(s=>s.unit==="W")?.value??null;let o=null;for(let s of wo(n,e,t,r)){let a=q(n.states[s]);a!==null&&(o=(o??0)+Math.max(0,a))}return o}function wo(n,e,t,r){let i=Wt(n,r,e.floors?.flatMap(h=>h.rooms)??t.rooms).filter(h=>h.kind==="electricity"&&h.metric==="power");if(i.length)return i.filter(h=>h.unit==="W").flatMap(h=>h.sources);let{grid:o,solar:s,battery:a}=e.energy,l=new Set([o,s,a].filter(Boolean)),u=new Set,c=(h,m)=>r.points.length>=3&&H([h,m],r.points);for(let h of t.placements){let m=c(h.x,h.z)?ye(n,h.entity_id):null;m&&u.add(m)}for(let h of t.furniture){if(!c(h.x,h.z))continue;let m=h.power&&h.power!=="none"?h.power:h.entity&&h.entity!=="none"?ye(n,h.entity):null;m&&u.add(m);for(let d of h.gang_entities??[]){let g=d&&d!=="none"?ye(n,d):null;g&&u.add(g)}}return[...u].filter(h=>!l.has(h))}function Zl(n,e,t){let r=new Map;for(let i of e.floors)for( Line truncated
<path d=${Mr(n)} />
</svg>`,jr={previous:"M6 6h2v12H6zM20 6v12l-10-6z",play:"M8 5v14l11-7z",pause:"M7 5h4v14H7zM13 5h4v14h-4z",next:"M16 6h2v12h-2zM4 6v12l10-6z"},So=n=>p`<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d=${n} /></svg>`,hp=24,mp=10,$o=class extends Q{static properties={hass:{attribute:!1},room:{attribute:!1},floor:{attribute:!1},confirmEntities:{attribute:!1},phrases:{attribute:!1},outside:{attribute:!1},_showAll:{state:!0},_said:{state:!0},_folded:{state:!0},_curve:{state:!0},_moodName:{state:!0},_undo:{state:!0},_energy:{state:!0},_sunYear:{state:!0},rooms:{attribute:!1},building:{attribute:!1}};saidTimer;memo=null;curveFor="";undoTimer;constructor(){super(),this.room=null,this.floor=null,this.phrases=null,this.outside=null,this._said=null,this._showAll=!1,this._folded=!1,this._curve=null,this._moodName=null,this._undo=null,this._energy=null,this._sunYear=!1,this.rooms=null,this.building=null}fireMoods(e,t){this.dispatchEvent(new CustomEvent("mood-change",{detail:{roomId:e.id,moods:t},bubbles:!0,composed:!0}))}runMood(e){for(let t of Gr(e))this.call("light",t.service,t.data)}renderMoods(e,t){let r=e.moods??[],i=!!this.rooms&&!!this.hass.user?.is_admin;if(!r.length&&!i)return f;let o=(this.rooms??[]).filter(l=>l.id!==e.id&&l.area_id),s=l=>U(this.hass,l).filter(u=>u.startsWith("light.")),a=()=>{let l=(this._moodName??"").trim()||this.t("mood_new");this.fireMoods(e,[...r,{id:`mood_${Date.now().toString(36)}`,name:l,lights:t.map(Kr)}]),this._moodName=null};return p`<div class="nf-rp-moods">
${r.map(l=>p`<span class="nf-rp-mood">
<button class="nf-btn" title=${this.t("mood_set")} @click=${()=>this.runMood(l.lights)}>✨ ${l.name}</button>
${o.length?p`<select class="nf-rp-mood-to" aria-label=${this.t("mood_carry")} title=${this.t("mood_carry")} @change=${u=>{let c=u.target,h=o.find(m=>m.id===c.value);c.value="",h&&this.runMood(su(l,s(h)))}}>
${o.length?p`<select class="nf-rp-mood-to" aria-label=${this.t("mood_carry")} title=${this.t("mood_carry")} @change=${u=>{let c=u.target,h=o.find(m=>m.id===c.value);c.value="",h&&this.runMood(lu(l,s(h)))}}>
<option value="">→</option>
${o.map(u=>p`<option value=${u.id}>${u.name}</option>`)}
</select>`:f}
@@ -271,33 +271,33 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
><input type="text" maxlength="40" placeholder=${this.t("mood_new")} .value=${this._moodName} @input=${l=>this._moodName=l.target.value} @keydown=${l=>l.key==="Enter"&&a()} />
<button class="nf-btn" @click=${a}>${this.t("mood_save")}</button></span
>`:f}
</div>`}async loadCurve(e){let t=be(this.hass,this.floor,e,"temperature"),r=t.length?t:U(this.hass,e).filter(s=>s.startsWith("climate."));if(!r.length)return;let i=Date.now(),o=i-24*36e5;try{let s=await En(this.hass,r,o,i,!!t.length);if(this.room?.id!==e.id)return;let a=[];for(let l=1;l<=96;l++){let u=Ut(this.hass,s,o+(i-o)*l/96),c=r.map(h=>h.startsWith("climate.")?Number(u.states[h]?.attributes.current_temperature):Number(u.states[h]?.state)).filter(Number.isFinite);a.push(c.length?c.reduce((h,m)=>h+m,0)/c.length:null)}this._curve=a.some(l=>l!==null)?a:null}catch{this._curve=null}}async loadEnergy(e){if(!this.floor||!this.building)return;if(V(this.hass)){this._energy=null;return}let t=yo(this.hass,this.building,this.floor,e);try{let r=await Jl(this.hass,t);this.room?.id===e.id&&(this._energy=r)}catch{this._energy=null}}renderEmptyLights(e,t){if(!t.length||!this.room)return f;let r=U(this.hass,e).map(s=>this.hass.states[s]).filter(s=>!!s&&s.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(s.attributes.device_class)));if(!r.length||r.some(s=>s.state!=="off"))return f;let i=Math.max(...r.map(s=>Date.parse(String(s.last_changed??""))||0)),o=Math.floor((Date.now()-i)/6e4);return!i||o<cp?f:p`<div class="nf-rp-shade">
</div>`}async loadCurve(e){let t=be(this.hass,this.floor,e,"temperature"),r=t.length?t:U(this.hass,e).filter(s=>s.startsWith("climate."));if(!r.length)return;let i=Date.now(),o=i-24*36e5;try{let s=await Rn(this.hass,r,o,i,!!t.length);if(this.room?.id!==e.id)return;let a=[];for(let l=1;l<=96;l++){let u=Ut(this.hass,s,o+(i-o)*l/96),c=r.map(h=>h.startsWith("climate.")?Number(u.states[h]?.attributes.current_temperature):Number(u.states[h]?.state)).filter(Number.isFinite);a.push(c.length?c.reduce((h,m)=>h+m,0)/c.length:null)}this._curve=a.some(l=>l!==null)?a:null}catch{this._curve=null}}async loadEnergy(e){if(!this.floor||!this.building)return;if(V(this.hass)){this._energy=null;return}let t=wo(this.hass,this.building,this.floor,e);try{let r=await Xl(this.hass,t);this.room?.id===e.id&&(this._energy=r)}catch{this._energy=null}}renderEmptyLights(e,t){if(!t.length||!this.room)return f;let r=U(this.hass,e).map(s=>this.hass.states[s]).filter(s=>!!s&&s.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(s.attributes.device_class)));if(!r.length||r.some(s=>s.state!=="off"))return f;let i=Math.max(...r.map(s=>Date.parse(String(s.last_changed??""))||0)),o=Math.floor((Date.now()-i)/6e4);return!i||o<mp?f:p`<div class="nf-rp-shade">
<span>💡 ${this.t("empty_lights_hint",{n:t.length,min:o})}</span>
<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_off",{entity_id:t.map(s=>s.entity_id)})}>${this.t("empty_lights_off")}</button>
</div>`}renderOpenWhileHeating(e){let t=this.room;if(!t||!this.floor)return f;let r=e.filter(a=>a.attributes.hvac_action==="heating"||a.state==="heat"&&a.attributes.hvac_action===void 0);if(!r.length)return f;let i=a=>!!a&&a!=="none"&&this.hass.states[a]?.state==="on",o=this.floor.openings.filter(a=>a.room_id===t.id&&[a.contact,a.contact2,a.tilt,a.tilt2].some(i));if(!o.length)return f;let s=()=>{for(let a of r)(a.attributes.hvac_modes??[]).includes("off")?this.call("climate","set_hvac_mode",{entity_id:a.entity_id,hvac_mode:"off"}):typeof a.attributes.min_temp=="number"&&this.call("climate","set_temperature",{entity_id:a.entity_id,temperature:a.attributes.min_temp})};return p`<div class="nf-rp-shade nf-rp-open-heat">
<span>🪟 ${this.t("open_heating_hint",{n:o.length})}</span>
<button class="nf-btn nf-rp-small" @click=${s}>${this.t("open_heating_off")}</button>
</div>`}renderShade(){let e=this.room,{latitude:t,longitude:r}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||r===void 0)return f;let i=Z(this.hass,this.floor,e,"temperature");if(i===null||i<up)return f;let o=a=>{let l=a&&a!=="none"?this.hass.states[a]:void 0;if(!l||C(l))return!1;let u=l.attributes.current_position;return typeof u=="number"?u>30:l.state==="open"},s=[...new Set(Kl(this.building,this.floor,e,{latitude:t,longitude:r}).flatMap(a=>[a.cover,a.cover2].filter(o)))];return s.length?p`<div class="nf-rp-shade">
</div>`}renderShade(){let e=this.room,{latitude:t,longitude:r}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||r===void 0)return f;let i=Z(this.hass,this.floor,e,"temperature");if(i===null||i<hp)return f;let o=a=>{let l=a&&a!=="none"?this.hass.states[a]:void 0;if(!l||C(l))return!1;let u=l.attributes.current_position;return typeof u=="number"?u>30:l.state==="open"},s=[...new Set(Ul(this.building,this.floor,e,{latitude:t,longitude:r}).flatMap(a=>[a.cover,a.cover2].filter(o)))];return s.length?p`<div class="nf-rp-shade">
<span>☀ ${this.t("shade_hint",{n:s.length,temp:`${L(this.hass,ue(this.hass,i),1)} ${re(this.hass)}`})}</span>
<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:s})}>${this.t("shade_close")}</button>
</div>`:f}renderSunYear(){let e=this.room,{latitude:t,longitude:r}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||r===void 0)return f;let i={latitude:t,longitude:r};if(!Kt(this.building,this.floor,e,{...i,zone:this.hass.config?.time_zone}).facing.length)return f;let s=p`<button class="nf-rp-sun-year" aria-expanded=${this._sunYear} title=${this.t("room_sun_year_hint")} @click=${()=>this._sunYear=!this._sunYear}>
☀ ${this.t("room_sun_year")}
</button>`;if(!this._sunYear)return s;let a=Vl(this.building,this.floor,e,i),l=Math.max(1,...a),u=Array.from({length:12},(c,h)=>new Date(2026,h,15).toLocaleDateString(this.hass.language,{month:"narrow"}));return p`${s}
</button>`;if(!this._sunYear)return s;let a=Gl(this.building,this.floor,e,i),l=Math.max(1,...a),u=Array.from({length:12},(c,h)=>new Date(2026,h,15).toLocaleDateString(this.hass.language,{month:"narrow"}));return p`${s}
<div class="nf-rp-sun-bars" role="img" aria-label=${a.map((c,h)=>`${u[h]} ${L(this.hass,c,1)} h`).join(", ")}>
${a.map((c,h)=>p`<span title=${`${L(this.hass,c,1)} h`}><i style=${`height:${Math.round(c/l*100)}%`}></i><b>${u[h]}</b></span>`)}
</div>`}renderEnergy(){let e=this._energy;if(!e||e.month<=0)return f;let t=this.building?.energy.tariff,r=t?this.hass.states[t]:void 0,i=r?{value:Number(r.state),unit:String(r.attributes.unit_of_measurement??"")}:null,o=Ql(e.month,i),s=a=>`${L(this.hass,a,a<10?2:1)} kWh`;return p`<p class="nf-rp-facts nf-rp-energy" title=${this.t("room_energy_hint")}>
</div>`}renderEnergy(){let e=this._energy;if(!e||e.month<=0)return f;let t=this.building?.energy.tariff,r=t?this.hass.states[t]:void 0,i=r?{value:Number(r.state),unit:String(r.attributes.unit_of_measurement??"")}:null,o=eu(e.month,i),s=a=>`${L(this.hass,a,a<10?2:1)} kWh`;return p`<p class="nf-rp-facts nf-rp-energy" title=${this.t("room_energy_hint")}>
⚡ ${this.t("room_energy",{today:s(e.today),month:s(e.month)})}${o?` \xB7 ${L(this.hass,o.value,2)} ${o.currency}`:""}
</p>`}renderCurve(){let e=this._curve;if(!e)return f;let t=e.filter(u=>u!==null),r=Math.min(...t),i=Math.max(...t),o=Math.max(1,i-r),s=e.map(u=>u===null?null:u-r+o*.1),a=Rn(s,220,36,o*1.2),l=u=>`${L(this.hass,ue(this.hass,u),1)}\xB0`;return p`<div class="nf-rp-curve" title=${this.t("room_curve_hint")}>
</p>`}renderCurve(){let e=this._curve;if(!e)return f;let t=e.filter(u=>u!==null),r=Math.min(...t),i=Math.max(...t),o=Math.max(1,i-r),s=e.map(u=>u===null?null:u-r+o*.1),a=zn(s,220,36,o*1.2),l=u=>`${L(this.hass,ue(this.hass,u),1)}\xB0`;return p`<div class="nf-rp-curve" title=${this.t("room_curve_hint")}>
<svg viewBox="0 0 220 36" preserveAspectRatio="none" aria-hidden="true">${ne`<path d=${a}></path>`}</svg>
<span>24 h · ${l(r)} – ${l(i)}</span>
</div>`}willUpdate(e){let t=e.get("room");e.has("room")&&t?.id!==this.room?.id&&(this._folded=!1,this._undo=null),this.room&&this.hass&&this.curveFor!==this.room.id&&(this.curveFor=this.room.id,this._curve=null,this._energy=null,this.loadCurve(this.room),this.loadEnergy(this.room))}updated(e){e.has("_folded")&&this.toggleAttribute("folded",this._folded)}t(e,t){return $(this.hass,e,t)}call(e,t,r){this.hass.callService(e,t,r)}renderClean(e){let t=e.clean_entity,r=t?this.hass.states[t]:void 0;if(!t||!r)return f;let i=t.slice(0,t.indexOf(".")),o=()=>i==="script"?this.call("script","turn_on",{entity_id:t}):this.call(i,"press",{entity_id:t});return p`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" ?disabled=${C(r)} title=${this.t("room_clean_run_hint")} @click=${o}>🧹 ${this.t("room_clean_run")}</button></div>`}allOff(e){let t=An(e);for(let r of t.off)this.call(r.domain,r.service,r.data);this._undo=t.undo,clearTimeout(this.undoTimer),this.undoTimer=setTimeout(()=>this._undo=null,1e4)}undoAllOff(){for(let e of this._undo??[])this.call(e.domain,e.service,e.data);this._undo=null,clearTimeout(this.undoTimer)}renderAllOff(e){if(this._undo)return p`<div class="nf-rp-alloff"><span>${this.t("all_off_done")}</span><button class="nf-btn nf-rp-small" @click=${()=>this.undoAllOff()}>↶ ${this.t("all_off_undo")}</button></div>`;let{count:t}=An(e);return t<2?f:p`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" title=${this.t("all_off_hint")} @click=${()=>this.allOff(e)}>⏻ ${this.t("all_off_n",{n:t})}</button></div>`}get areaName(){return this.room?.area_id?this.hass.areas?.[this.room.area_id]?.name:void 0}placedAs(e){for(let t of this.building?.floors??[])for(let r of t.placements)if(r.entity_id===e)return r}name(e){return this.placedAs(e)?.name?.trim()||O(this.hass,e,this.areaName)}nameButton(e){return p`<button class="nf-rp-name" title=${this.t("details")} @click=${()=>ke(this,e)}>${this.name(e)}</button>`}askFor(e){return!this.confirmEntities?.has(e)||confirm(this.t("confirm_switch",{name:this.name(e)}))}toggle(e,t,r){let i=()=>{this.confirmEntities?.has(e.entity_id)&&!confirm(this.t("confirm_switch",{name:this.name(e.entity_id)}))||r()};return p`<button
</div>`}willUpdate(e){let t=e.get("room");e.has("room")&&t?.id!==this.room?.id&&(this._folded=!1,this._undo=null),this.room&&this.hass&&this.curveFor!==this.room.id&&(this.curveFor=this.room.id,this._curve=null,this._energy=null,this.loadCurve(this.room),this.loadEnergy(this.room))}updated(e){e.has("_folded")&&this.toggleAttribute("folded",this._folded)}t(e,t){return $(this.hass,e,t)}call(e,t,r){this.hass.callService(e,t,r)}renderClean(e){let t=e.clean_entity,r=t?this.hass.states[t]:void 0;if(!t||!r)return f;let i=t.slice(0,t.indexOf(".")),o=()=>i==="script"?this.call("script","turn_on",{entity_id:t}):this.call(i,"press",{entity_id:t});return p`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" ?disabled=${C(r)} title=${this.t("room_clean_run_hint")} @click=${o}>🧹 ${this.t("room_clean_run")}</button></div>`}allOff(e){let t=En(e);for(let r of t.off)this.call(r.domain,r.service,r.data);this._undo=t.undo,clearTimeout(this.undoTimer),this.undoTimer=setTimeout(()=>this._undo=null,1e4)}undoAllOff(){for(let e of this._undo??[])this.call(e.domain,e.service,e.data);this._undo=null,clearTimeout(this.undoTimer)}renderAllOff(e){if(this._undo)return p`<div class="nf-rp-alloff"><span>${this.t("all_off_done")}</span><button class="nf-btn nf-rp-small" @click=${()=>this.undoAllOff()}>↶ ${this.t("all_off_undo")}</button></div>`;let{count:t}=En(e);return t<2?f:p`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" title=${this.t("all_off_hint")} @click=${()=>this.allOff(e)}>⏻ ${this.t("all_off_n",{n:t})}</button></div>`}get areaName(){return this.room?.area_id?this.hass.areas?.[this.room.area_id]?.name:void 0}placedAs(e){for(let t of this.building?.floors??[])for(let r of t.placements)if(r.entity_id===e)return r}name(e){return this.placedAs(e)?.name?.trim()||O(this.hass,e,this.areaName)}nameButton(e){return p`<button class="nf-rp-name" title=${this.t("details")} @click=${()=>ke(this,e)}>${this.name(e)}</button>`}askFor(e){return!this.confirmEntities?.has(e)||confirm(this.t("confirm_switch",{name:this.name(e)}))}toggle(e,t,r){let i=()=>{this.confirmEntities?.has(e.entity_id)&&!confirm(this.t("confirm_switch",{name:this.name(e.entity_id)}))||r()};return p`<button
class="nf-switch"
role="switch"
aria-checked=${t?"true":"false"}
aria-label=${this.name(e.entity_id)}
?disabled=${C(e)}
@click=${i}
></button>`}outsideRoom=null;render(){let e=!this.room&&this.outside?this.outside:null;e&&!this.outsideRoom&&(this.outsideRoom={id:"nf-outside",name:this.t("outside_area"),area_id:null,points:[],floor_material:"grass"});let t=this.room??(e?this.outsideRoom:null);if(!t||!this.hass)return f;let r=e??U(this.hass,t),i=this.memo,{shown:o,more:s}=e?{shown:e,more:[]}:i&&i.entities===this.hass.entities&&i.floor===this.floor&&i.room===t?i:this.memo={entities:this.hass.entities,floor:this.floor,room:t,...this.floor?Ha(this.hass,this.floor,t):{shown:r,more:[]}},a=Ki(this.hass,s).map(R=>R.primary),l=a.length,u=[t.floor_heating,...Object.values(t.hvac??{}).flat()].filter(R=>!!R&&R!=="none"),c=new Set(u.map(R=>this.hass.states[R]?.attributes.symcon_id).filter(Boolean)),h=(this._showAll?[...o,...a]:o).filter(R=>!V(this.hass)||!c.has(this.hass.states[R]?.attributes.symcon_id)),m=R=>h.filter(F=>R.includes(P(F))).map(F=>this.hass.states[F]),d=m(["light"]),g=m(["cover"]),_=m(["climate"]),b=m(["media"]),v=m(["switch","fan","lock"]),S=m(["sensor","binary"]),k=m(["scene","script"]),M=this.facts(_),z=d.filter(R=>R.state==="on");return p`<section class="nf-rp" aria-label=${t.name}>
></button>`}outsideRoom=null;render(){let e=!this.room&&this.outside?this.outside:null;e&&!this.outsideRoom&&(this.outsideRoom={id:"nf-outside",name:this.t("outside_area"),area_id:null,points:[],floor_material:"grass"});let t=this.room??(e?this.outsideRoom:null);if(!t||!this.hass)return f;let r=e??U(this.hass,t),i=this.memo,{shown:o,more:s}=e?{shown:e,more:[]}:i&&i.entities===this.hass.entities&&i.floor===this.floor&&i.room===t?i:this.memo={entities:this.hass.entities,floor:this.floor,room:t,...this.floor?Pa(this.hass,this.floor,t):{shown:r,more:[]}},a=Gi(this.hass,s).map(R=>R.primary),l=a.length,u=[t.floor_heating,...Object.values(t.hvac??{}).flat()].filter(R=>!!R&&R!=="none"),c=new Set(u.map(R=>this.hass.states[R]?.attributes.symcon_id).filter(Boolean)),h=(this._showAll?[...o,...a]:o).filter(R=>!V(this.hass)||!c.has(this.hass.states[R]?.attributes.symcon_id)),m=R=>h.filter(F=>R.includes(P(F))).map(F=>this.hass.states[F]),d=m(["light"]),g=m(["cover"]),_=m(["climate"]),b=m(["media"]),v=m(["switch","fan","lock"]),S=m(["sensor","binary"]),k=m(["scene","script"]),M=this.facts(_),z=d.filter(R=>R.state==="on");return p`<section class="nf-rp" aria-label=${t.name}>
<header class="nf-rp-head">
<div>
<h2>${t.name}</h2>
@@ -331,9 +331,9 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
</button>`:f}${z.length?p`<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_off",{entity_id:z.map(R=>R.entity_id)})}>
${this.t("panel_all_off")}
</button>`:f}`):f}
${g.length?this.section("panel_covers",g.map(R=>this.coverRow(R)),g.length>1&&dr(g,this.confirmEntities).length?p`<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","open_cover",{entity_id:dr(g,this.confirmEntities)})}>
${g.length?this.section("panel_covers",g.map(R=>this.coverRow(R)),g.length>1&&hr(g,this.confirmEntities).length?p`<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","open_cover",{entity_id:hr(g,this.confirmEntities)})}>
${this.t("panel_all_open")}</button
><button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:dr(g,this.confirmEntities)})}>
><button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:hr(g,this.confirmEntities)})}>
${this.t("panel_all_close")}
</button>`:f):f}
${V(this.hass)?p`<nf-room-hvac .hass=${this.hass} .room=${t}></nf-room-hvac>`:f}
@@ -342,18 +342,18 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${v.length?this.section("panel_switches",v.map(R=>this.switchRow(R))):f}
${S.length?this.section("panel_sensors",S.map(R=>this.sensorRow(R))):f}
${this.extraValues(t)}
${!V(this.hass)&&ul(this.hass)&&ll(this.hass,this.floor,t)?this.announceSection(t):f}
${!V(this.hass)&&cl(this.hass)&&ul(this.hass,this.floor,t)?this.announceSection(t):f}
${this.pluginSections(t,h)}
${l?p`<button class="nf-btn nf-rp-small nf-rp-more" @click=${()=>this._showAll=!this._showAll}>
${this._showAll?this.t("panel_less"):this.t("panel_more",{n:l})}
</button>`:f}
</div>
</section>`}extraValues(e){if(!this.floor)return f;let t=[...this.floor.placements.filter(r=>!r.outside&&H([r.x,r.z],e.points)).map(r=>({name:r.name||O(this.hass,r.entity_id),rows:Mr(this.hass,r.values)})),...this.floor.furniture.filter(r=>H([r.x,r.z],e.points)).map(r=>({name:r.name||(r.entity&&r.entity!=="none"?O(this.hass,r.entity):ae(this.hass,r.type)),rows:[...Gr(this.hass,r),...Mr(this.hass,r.values)]}))].filter(r=>r.rows.length);return t.length?this.section("device_values",t.map(r=>p`<div class="nf-extra-values"><b>${r.name}</b>${r.rows.map(i=>p`<div class="nf-rp-row"><span class="nf-rp-icon">${i.icon}</span><span class="nf-rp-name">${i.label}</span><b class="nf-rp-state">${i.text}${G(this.hass,[i.entity],i.label)}</b></div>`)}</div>`)):f}facts(e){let t=[],r=this.room;if(!r)return t;let i=(T,E)=>{let A=Z(this.hass,this.floor,r,T);if(A===null)return null;if(T==="temperature")return`${L(this.hass,ue(this.hass,A),1)} ${re(this.hass)}`;let I=be(this.hass,this.floor,r,T)[0],N=this.hass.states[I]?.attributes.unit_of_measurement??E;return`${L(this.hass,A,1)} ${N}`},o=e.find(T=>typeof T.attributes.current_temperature=="number"),s=i("temperature","\xB0C");s?t.push(p`${s}${G(this.hass,be(this.hass,this.floor,r,"temperature"),"Temperatur")}`):o&&r.climate?.temperature!=="none"&&t.push(p`${L(this.hass,o.attributes.current_temperature,1)} ${re(this.hass)}${G(this.hass,[o.entity_id],"Temperatur")}`);let a=i("humidity","%");a&&t.push(p`${a}${G(this.hass,be(this.hass,this.floor,r,"humidity"),"Luftfeuchte")}`);let l=Z(this.hass,this.floor??null,r,"illuminance");l!==null&&t.push(p`☀ ${L(this.hass,l,0)} lx${G(this.hass,be(this.hass,this.floor,r,"illuminance"),"Helligkeit")}`);let u=Wt(this.hass,r,this.building?.floors.flatMap(T=>T.rooms)).find(T=>T.kind==="electricity"&&T.metric==="power"&&T.unit==="W"),c=!u&&this.floor&&this.building?vo(this.hass,this.building,this.floor,r):null;u?t.push(p`⚡ ${Ne(this.hass,u)}${G(this.hass,u.sources,"Leistung")}`):c!==null&&t.push(`\u26A1 ${wt(this.hass,c)}`);let h=this.floor?this.floor.openings.filter(T=>T.room_id===r.id).flatMap(T=>[T.contact,T.contact2,T.tilt,T.tilt2]).map(T=>T&&T!=="none"?this.hass.states[T]:void 0).filter(T=>T?.state==="on").map(T=>Date.parse(String(T.last_changed??""))).filter(Number.isFinite):[];h.length&&t.push(`\u{1FA9F} ${this.t("open_since",{time:wo(Date.now()-Math.min(...h))})}`);let m=U(this.hass,r).map(T=>this.hass.states[T]).filter(T=>!!T&&T.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(T.attributes.device_class)));if(m.length)if(m.some(T=>T.state==="on"))t.push(`\u{1F6B6} ${this.t("presence_now")}`);else{let T=Math.max(...m.map(E=>Date.parse(String(E.last_changed??""))||0));T>0&&t.push(`\u{1F6B6} ${this.t("presence_last",{time:wo(Date.now()-T)})}`)}let d=this.building?tu(this.hass,this.building).filter(T=>T.roomId===r.id&&T.level<eu):[];d.length&&t.push(`\u{1FAAB} ${this.t("battery_low_n",{n:d.length,names:d.map(T=>`${this.name(T.entity)} ${Math.round(T.level)} %`).join(", ")})}`);let g=(this.building?.settings.circuits??[]).filter(T=>T.rooms.includes(r.id)).map(T=>T.name),_=this.building?.settings.room_facts_off??[];g.length&&!_.includes("circuits")&&t.push(`\u{1F50C} ${g.join(", ")}`);let{latitude:b,longitude:v,time_zone:S}=this.hass.config??{};if(this.floor&&b!==void 0&&v!==void 0&&this.building&&!_.includes("sun")){let T=Kt(this.building,this.floor,r,{latitude:b,longitude:v,zone:S});T.facing.length&&t.push(`\u2600 ${this.t("room_sun_hours",{h:L(this.hass,T.hours,1),facing:T.facing.join(", ")})}`)}let k=Z(this.hass,this.floor,r,"temperature"),M=Z(this.hass,this.floor,r,"humidity"),z=Or(Z(this.hass,this.floor,r,"co2"),M,Gt(k,M));z&&!_.includes("air")&&t.push(`\u{1F4A8} ${this.t(`air_${z}`)}`);let R=Wr(k,M,Z(this.hass,this.floor,r,"co2"),yt(new Date,this.hass.config?.latitude)),F=r.hvac?.status;return F&&F!=="none"?t.push(p`${Fe(this.hass.states[F])}${G(this.hass,[F],"Raumstatus")}`):R!==null&&(k!==null||M!==null)&&!_.includes("comfort")&&t.push(`\u{1F60A} ${this.t("comfort_n",{n:R})}`),t}announceSection(e){let t=this.phrases?.length?this.phrases:[1,2,3,4,5].map(o=>this.t(`announce_phrase_${o}`)),r=o=>{let s=o.trim();s&&(clearTimeout(this.saidTimer),this.hass.callService("nextfloor","announce",{message:s,rooms:[e.id],on_screens:!1}).then(()=>this._said={text:this.t("announce_sent",{message:s}),failed:!1},a=>this._said={text:this.t("announce_failed",{error:a?.message??String(a)}),failed:!0}),this.saidTimer=setTimeout(()=>this._said=null,6e3))},i=o=>{o.preventDefault();let s=o.currentTarget.querySelector("input");r(s.value),s.value=""};return this.section("panel_announce",[p`<div class="nf-rp-scenes">${t.map(o=>p`<button class="nf-btn" @click=${()=>r(o)}>${o}</button>`)}</div>
</section>`}extraValues(e){if(!this.floor)return f;let t=[...this.floor.placements.filter(r=>!r.outside&&H([r.x,r.z],e.points)).map(r=>({name:r.name||O(this.hass,r.entity_id),rows:Ar(this.hass,r.values)})),...this.floor.furniture.filter(r=>H([r.x,r.z],e.points)).map(r=>({name:r.name||(r.entity&&r.entity!=="none"?O(this.hass,r.entity):ae(this.hass,r.type)),rows:[...Ur(this.hass,r),...Ar(this.hass,r.values)]}))].filter(r=>r.rows.length);return t.length?this.section("device_values",t.map(r=>p`<div class="nf-extra-values"><b>${r.name}</b>${r.rows.map(i=>p`<div class="nf-rp-row"><span class="nf-rp-icon">${i.icon}</span><span class="nf-rp-name">${i.label}</span><b class="nf-rp-state">${i.text}${G(this.hass,[i.entity],i.label)}</b></div>`)}</div>`)):f}facts(e){let t=[],r=this.room;if(!r)return t;let i=(T,E)=>{let A=Z(this.hass,this.floor,r,T);if(A===null)return null;if(T==="temperature")return`${L(this.hass,ue(this.hass,A),1)} ${re(this.hass)}`;let I=be(this.hass,this.floor,r,T)[0],N=this.hass.states[I]?.attributes.unit_of_measurement??E;return`${L(this.hass,A,1)} ${N}`},o=e.find(T=>typeof T.attributes.current_temperature=="number"),s=i("temperature","\xB0C");s?t.push(p`${s}${G(this.hass,be(this.hass,this.floor,r,"temperature"),"Temperatur")}`):o&&r.climate?.temperature!=="none"&&t.push(p`${L(this.hass,o.attributes.current_temperature,1)} ${re(this.hass)}${G(this.hass,[o.entity_id],"Temperatur")}`);let a=i("humidity","%");a&&t.push(p`${a}${G(this.hass,be(this.hass,this.floor,r,"humidity"),"Luftfeuchte")}`);let l=Z(this.hass,this.floor??null,r,"illuminance");l!==null&&t.push(p`☀ ${L(this.hass,l,0)} lx${G(this.hass,be(this.hass,this.floor,r,"illuminance"),"Helligkeit")}`);let u=Wt(this.hass,r,this.building?.floors.flatMap(T=>T.rooms)).find(T=>T.kind==="electricity"&&T.metric==="power"&&T.unit==="W"),c=!u&&this.floor&&this.building?yo(this.hass,this.building,this.floor,r):null;u?t.push(p`⚡ ${Ne(this.hass,u)}${G(this.hass,u.sources,"Leistung")}`):c!==null&&t.push(`\u26A1 ${wt(this.hass,c)}`);let h=this.floor?this.floor.openings.filter(T=>T.room_id===r.id).flatMap(T=>[T.contact,T.contact2,T.tilt,T.tilt2]).map(T=>T&&T!=="none"?this.hass.states[T]:void 0).filter(T=>T?.state==="on").map(T=>Date.parse(String(T.last_changed??""))).filter(Number.isFinite):[];h.length&&t.push(`\u{1FA9F} ${this.t("open_since",{time:xo(Date.now()-Math.min(...h))})}`);let m=U(this.hass,r).map(T=>this.hass.states[T]).filter(T=>!!T&&T.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(T.attributes.device_class)));if(m.length)if(m.some(T=>T.state==="on"))t.push(`\u{1F6B6} ${this.t("presence_now")}`);else{let T=Math.max(...m.map(E=>Date.parse(String(E.last_changed??""))||0));T>0&&t.push(`\u{1F6B6} ${this.t("presence_last",{time:xo(Date.now()-T)})}`)}let d=this.building?ru(this.hass,this.building).filter(T=>T.roomId===r.id&&T.level<nu):[];d.length&&t.push(`\u{1FAAB} ${this.t("battery_low_n",{n:d.length,names:d.map(T=>`${this.name(T.entity)} ${Math.round(T.level)} %`).join(", ")})}`);let g=(this.building?.settings.circuits??[]).filter(T=>T.rooms.includes(r.id)).map(T=>T.name),_=this.building?.settings.room_facts_off??[];g.length&&!_.includes("circuits")&&t.push(`\u{1F50C} ${g.join(", ")}`);let{latitude:b,longitude:v,time_zone:S}=this.hass.config??{};if(this.floor&&b!==void 0&&v!==void 0&&this.building&&!_.includes("sun")){let T=Kt(this.building,this.floor,r,{latitude:b,longitude:v,zone:S});T.facing.length&&t.push(`\u2600 ${this.t("room_sun_hours",{h:L(this.hass,T.hours,1),facing:T.facing.join(", ")})}`)}let k=Z(this.hass,this.floor,r,"temperature"),M=Z(this.hass,this.floor,r,"humidity"),z=Wr(Z(this.hass,this.floor,r,"co2"),M,Gt(k,M));z&&!_.includes("air")&&t.push(`\u{1F4A8} ${this.t(`air_${z}`)}`);let R=Br(k,M,Z(this.hass,this.floor,r,"co2"),yt(new Date,this.hass.config?.latitude)),F=r.hvac?.status;return F&&F!=="none"?t.push(p`${Fe(this.hass.states[F])}${G(this.hass,[F],"Raumstatus")}`):R!==null&&(k!==null||M!==null)&&!_.includes("comfort")&&t.push(`\u{1F60A} ${this.t("comfort_n",{n:R})}`),t}announceSection(e){let t=this.phrases?.length?this.phrases:[1,2,3,4,5].map(o=>this.t(`announce_phrase_${o}`)),r=o=>{let s=o.trim();s&&(clearTimeout(this.saidTimer),this.hass.callService("nextfloor","announce",{message:s,rooms:[e.id],on_screens:!1}).then(()=>this._said={text:this.t("announce_sent",{message:s}),failed:!1},a=>this._said={text:this.t("announce_failed",{error:a?.message??String(a)}),failed:!0}),this.saidTimer=setTimeout(()=>this._said=null,6e3))},i=o=>{o.preventDefault();let s=o.currentTarget.querySelector("input");r(s.value),s.value=""};return this.section("panel_announce",[p`<div class="nf-rp-scenes">${t.map(o=>p`<button class="nf-btn" @click=${()=>r(o)}>${o}</button>`)}</div>
<form class="nf-rp-say" @submit=${i}>
<input type="text" maxlength="500" placeholder=${this.t("announce_placeholder")} aria-label=${this.t("announce_placeholder")} />
<button class="nf-btn nf-primary" type="submit">${this.t("announce_send")}</button>
</form>
${this._said?p`<p class="nf-rp-note ${this._said.failed?"nf-rp-fail":""}" role="status">${this._said.text}</p>`:f}`])}pluginSections(e,t){return Gs({hass:this.hass,room:{id:e.id,name:e.name,area_id:e.area_id??null},entities:t}).map(i=>p`<div class="nf-rp-sec nf-rp-plugin" data-plugin=${i.key}>
${this._said?p`<p class="nf-rp-note ${this._said.failed?"nf-rp-fail":""}" role="status">${this._said.text}</p>`:f}`])}pluginSections(e,t){return Us({hass:this.hass,room:{id:e.id,name:e.name,area_id:e.area_id??null},entities:t}).map(i=>p`<div class="nf-rp-sec nf-rp-plugin" data-plugin=${i.key}>
<div class="nf-rp-sec-head"><h3>${i.title}</h3></div>
${typeof i.content=="string"?p`<p class="nf-rp-note">${i.content}</p>`:i.content}
</div>`)}section(e,t,r=f){return p`<div class="nf-rp-sec">
@@ -384,23 +384,23 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
@change=${d=>this.call("light","turn_on",{entity_id:h,color_temp_kelvin:Number(d.target.value)})}
/></label>`:f}
${r&&a&&!m?p`<div class="nf-rp-swatches" role="group" aria-label=${this.t("color")}>
${lp.map(d=>p`<button
${dp.map(d=>p`<button
class="nf-rp-swatch"
style="--c: rgb(${d.join(",")})"
aria-label="rgb(${d.join(", ")})"
@click=${()=>this.call("light","turn_on",{entity_id:h,rgb_color:d})}
></button>`)}
</div>`:f}
</div>`}coverRow(e){let t=wr(this.hass,this.building?.floors??[],e.entity_id);e=xr(this.hass,e,t);let r=e.attributes,i=r.supported_features??0,o=e.entity_id,s=C(e)&&!mn(e);return p`<div class="nf-rp-row">
</div>`}coverRow(e){let t=xr(this.hass,this.building?.floors??[],e.entity_id);e=kr(this.hass,e,t);let r=e.attributes,i=r.supported_features??0,o=e.entity_id,s=C(e)&&!mn(e);return p`<div class="nf-rp-row">
<span class="nf-rp-icon">${qt("cover")}</span>
${this.nameButton(o)}
<span class="nf-rp-state">${this.stateOf(e)}${G(this.hass,[e.entity_id])}</span>
<div class="nf-rp-buttons">
<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.askFor(o)&&this.call("cover","open_cover",{entity_id:o})}>${this.t("cover_open")}</button>
${i&ap?p`<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.call("cover","stop_cover",{entity_id:o})}>${this.t("cover_stop")}</button>`:f}
${i&cp?p`<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.call("cover","stop_cover",{entity_id:o})}>${this.t("cover_stop")}</button>`:f}
<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.askFor(o)&&this.call("cover","close_cover",{entity_id:o})}>${this.t("cover_close")}</button>
</div>
${i&sp&&typeof r.current_position=="number"?p`<label class="nf-rp-slider"
${i&up&&typeof r.current_position=="number"?p`<label class="nf-rp-slider"
><span>${this.t("position")}</span>
<input
type="range"
@@ -448,13 +448,13 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${o?p`<p class="nf-rp-media nf-rp-wide">${o}</p>`:f}
<div class="nf-rp-buttons nf-rp-wide">
<button class="nf-btn nf-rp-small" aria-label=${this.t("previous")} ?disabled=${i} @click=${()=>this.call("media_player","media_previous_track",{entity_id:r})}>
${ko(Ur.previous)}
${So(jr.previous)}
</button>
<button class="nf-btn nf-rp-small" aria-label=${this.t("play_pause")} ?disabled=${C(e)} @click=${()=>this.call("media_player","media_play_pause",{entity_id:r})}>
${ko(e.state==="playing"?Ur.pause:Ur.play)}
${So(e.state==="playing"?jr.pause:jr.play)}
</button>
<button class="nf-btn nf-rp-small" aria-label=${this.t("next")} ?disabled=${i} @click=${()=>this.call("media_player","media_next_track",{entity_id:r})}>
${ko(Ur.next)}
${So(jr.next)}
</button>
</div>
${typeof t.volume_level=="number"?p`<label class="nf-rp-slider"
@@ -856,32 +856,32 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
outline: 2px solid var(--nf-accent);
outline-offset: 2px;
}
`]};customElements.get("nf-room-panel")||customElements.define("nf-room-panel",So);function gu(n){if(!n)return"";let e=Math.min(.8,Math.max(0,n.dim??.35)),t=n.image&&/^(https:\/\/|\/local\/|\/api\/)[^"'()\\\s]+$/.test(n.image)?n.image:null,r=n.color&&/^#[0-9a-f]{6}$/i.test(n.color)?n.color:null;return t?`;background:linear-gradient(rgba(0,0,0,${e}),rgba(0,0,0,${e})),center / cover no-repeat url("${t}")${r?` ${r}`:""}`:r?`;background:${r}`:""}var dp=[[/spotify/i,[30,215,96]],[/netflix/i,[229,9,20]],[/youtube/i,[255,0,51]],[/prime|amazon/i,[0,168,225]],[/disney/i,[17,60,207]],[/apple ?music|itunes/i,[250,45,72]],[/apple ?tv/i,[200,200,210]],[/plex/i,[229,160,13]],[/tidal/i,[0,255,255]],[/deezer/i,[162,56,255]],[/radio|tunein/i,[255,140,60]]],_u=[34,211,238];function $o(n){return n?dp.find(([e])=>e.test(n))?.[1]??_u:_u}function Mo(n){if(n.state==="playing"||n.state==="paused")return!0;let e=t=>typeof n.attributes[t]=="string"&&n.attributes[t]!=="";return n.state==="on"&&(e("media_title")||e("media_channel")||e("source")||e("app_name"))}var Ao=n=>n.state==="playing"||n.state==="on"&&Mo(n);function bu(n,e){let t=[],r=new Set;for(let i of e){if(!i.entity.startsWith("media_player.")||r.has(i.entity))continue;r.add(i.entity);let o=n.states[i.entity];if(!o)continue;let s=o.attributes,a=c=>typeof s[c]=="string"?s[c]:"",l=a("app_name")||a("source")||a("app_id")||null,u=typeof s.volume_level=="number"?s.volume_level:null;t.push({entity:i.entity,name:i.name,at:i.at,playing:Ao(o),title:a("media_title")||a("media_channel")||l||"",artist:a("media_artist")||a("media_album_name")||a("media_series_title"),picture:a("entity_picture")||null,volume:u,color:$o(l),app:l,group:Array.isArray(s.group_members)?s.group_members.filter(c=>typeof c=="string"&&c!==i.entity):[],rings:i.rings??1})}return t}function vu(n){let e=new Map(n.filter(i=>i.playing).map(i=>[i.entity,i])),t=[],r=new Set;for(let i of e.values())for(let o of i.group){let s=e.get(o),a=[i.entity,o].sort().join("|");s&&!r.has(a)&&(r.add(a),t.push([i,s]))}return t}var hp=3;function yu(n,e,t){let r=[];for(let i of e.floors)for(let o of i.furniture){if(!o.type.endsWith(":sprinkler"))continue;let s=t?.get(o.id)?.entity??null;!s||!te(n.states[s])||r.push({id:o.id,at:{floorId:i.id,x:o.x,y:oe(i,o)+o.h,z:o.z},reach:Math.min(15,Math.max(.5,o.spray??hp))})}return r}var jr=n=>n&&n!=="none"?n:null,wu=n=>Math.min(1,Math.max(0,n));function xu(n,e){let t=new Map;for(let r of e.settings.roof?.windows??[]){let i=Ve(n,{cover:jr(r.cover),contact:jr(r.contact),tilt:jr(r.tilt)},"window"),o=jr(r.window),s=o?n.states[o]:void 0,a=i.open;if(s&&!C(s)){let l=s.attributes.current_position;a=typeof l=="number"?wu(l/100):s.state==="open"||s.state==="opening"?1:0}t.set(r.id,{open:a,tilt:i.tilt,cover:i.cover??0})}return t}function mp(n,e){let t=i=>Math.hypot(i.x-e.x,i.z-e.z);return n.placements.filter(i=>i.entity_id.startsWith("media_player.")&&t(i)<Math.max(2,e.w)).sort((i,o)=>t(i)-t(o))[0]?.entity_id??null}var st=(n,e)=>typeof n[e]=="string"?n[e]:"";function ku(n,e,t){let r=[];for(let i of e.floors)for(let o of i.furniture){if(!br(o.type))continue;let s=t?.get(o.id)?.entity??null,a=s?.startsWith("media_player.")?s:mp(i,o),l=a?n.states[a]:void 0;if(!l||!Mo(l))continue;let u=l.attributes,c=st(u,"app_name")||st(u,"source")||null;r.push({id:o.id,furnitureId:o.id,floorId:i.id,color:$o(c),title:st(u,"media_title")||st(u,"media_channel")||c||"",subtitle:st(u,"media_artist")||st(u,"media_series_title")||st(u,"media_album_name"),app:c,picture:st(u,"entity_picture")||null,playing:Ao(l),ambilight:o.ambilight??1})}return r}function Su(n){let e=n.states["sun.sun"]?.attributes;return typeof e?.elevation=="number"&&typeof e.azimuth=="number"?{elevation:e.elevation,azimuth:e.azimuth}:null}function $u(n,e){return(n===null?0:wu((n+4)/16))*(1-.45*e)}function at(n,e){return n.states["weather.nextfloor_symcon"]?"weather.nextfloor_symcon":e&&n.states[e]?e:Object.keys(n.states).filter(t=>t.startsWith("weather.")).sort()[0]??null}var qr=new Set(["contact_lost","unlocked_night","own"]);function pp(n,e){let t=n.states[e.entity];if(!t||["unavailable","unknown"].includes(t.state))return!1;let r=(e.state??"on").trim(),i=/^([<>])\s*(-?\d+(?:[.,]\d+)?)$/.exec(r);if(i){let o=Number(t.state),s=Number(i[2].replace(",","."));return Number.isFinite(o)&&(i[1]==="<"?o<s:o>s)}return r.split(",").map(o=>o.trim().toLowerCase()).filter(Boolean).includes(String(t.state).toLowerCase())}var fp=600*1e3,gp=new Set(["rainy","pouring","lightning-rainy","hail","snowy-rainy"]),_p=new Map([["smoke","smoke"],["gas","gas"],["carbon_monoxide","co"],["moisture","water"]]),Mu=(n,e)=>{if(e.startsWith("binary_sensor."))return _p.get(String(n.states[e]?.attributes.device_class))};function bp(n,e){let t=new Set,r=[];for(let i of n.floors)for(let o of i.openings){let s=e.get(o.id);for(let a of s?[s.contact,s.contact2,s.tilt,s.tilt2]:[])!a||t.has(a)||(t.add(a),r.push({floorId:i.id,roomId:o.room_id,entity:a}))}return r}function Au(n,e,t,r){let i=[];for(let a o Line truncated
`]};customElements.get("nf-room-panel")||customElements.define("nf-room-panel",$o);function bu(n){if(!n)return"";let e=Math.min(.8,Math.max(0,n.dim??.35)),t=n.image&&/^(https:\/\/|\/local\/|\/api\/)[^"'()\\\s]+$/.test(n.image)?n.image:null,r=n.color&&/^#[0-9a-f]{6}$/i.test(n.color)?n.color:null;return t?`;background:linear-gradient(rgba(0,0,0,${e}),rgba(0,0,0,${e})),center / cover no-repeat url("${t}")${r?` ${r}`:""}`:r?`;background:${r}`:""}var pp=[[/spotify/i,[30,215,96]],[/netflix/i,[229,9,20]],[/youtube/i,[255,0,51]],[/prime|amazon/i,[0,168,225]],[/disney/i,[17,60,207]],[/apple ?music|itunes/i,[250,45,72]],[/apple ?tv/i,[200,200,210]],[/plex/i,[229,160,13]],[/tidal/i,[0,255,255]],[/deezer/i,[162,56,255]],[/radio|tunein/i,[255,140,60]]],vu=[34,211,238];function Mo(n){return n?pp.find(([e])=>e.test(n))?.[1]??vu:vu}function Ao(n){if(n.state==="playing"||n.state==="paused")return!0;let e=t=>typeof n.attributes[t]=="string"&&n.attributes[t]!=="";return n.state==="on"&&(e("media_title")||e("media_channel")||e("source")||e("app_name"))}var Eo=n=>n.state==="playing"||n.state==="on"&&Ao(n);function yu(n,e){let t=[],r=new Set;for(let i of e){if(!i.entity.startsWith("media_player.")||r.has(i.entity))continue;r.add(i.entity);let o=n.states[i.entity];if(!o)continue;let s=o.attributes,a=c=>typeof s[c]=="string"?s[c]:"",l=a("app_name")||a("source")||a("app_id")||null,u=typeof s.volume_level=="number"?s.volume_level:null;t.push({entity:i.entity,name:i.name,at:i.at,playing:Eo(o),title:a("media_title")||a("media_channel")||l||"",artist:a("media_artist")||a("media_album_name")||a("media_series_title"),picture:a("entity_picture")||null,volume:u,color:Mo(l),app:l,group:Array.isArray(s.group_members)?s.group_members.filter(c=>typeof c=="string"&&c!==i.entity):[],rings:i.rings??1})}return t}function wu(n){let e=new Map(n.filter(i=>i.playing).map(i=>[i.entity,i])),t=[],r=new Set;for(let i of e.values())for(let o of i.group){let s=e.get(o),a=[i.entity,o].sort().join("|");s&&!r.has(a)&&(r.add(a),t.push([i,s]))}return t}var fp=3;function xu(n,e,t){let r=[];for(let i of e.floors)for(let o of i.furniture){if(!o.type.endsWith(":sprinkler"))continue;let s=t?.get(o.id)?.entity??null;!s||!te(n.states[s])||r.push({id:o.id,at:{floorId:i.id,x:o.x,y:oe(i,o)+o.h,z:o.z},reach:Math.min(15,Math.max(.5,o.spray??fp))})}return r}var qr=n=>n&&n!=="none"?n:null,ku=n=>Math.min(1,Math.max(0,n));function Su(n,e){let t=new Map;for(let r of e.settings.roof?.windows??[]){let i=Ve(n,{cover:qr(r.cover),contact:qr(r.contact),tilt:qr(r.tilt)},"window"),o=qr(r.window),s=o?n.states[o]:void 0,a=i.open;if(s&&!C(s)){let l=s.attributes.current_position;a=typeof l=="number"?ku(l/100):s.state==="open"||s.state==="opening"?1:0}t.set(r.id,{open:a,tilt:i.tilt,cover:i.cover??0})}return t}function gp(n,e){let t=i=>Math.hypot(i.x-e.x,i.z-e.z);return n.placements.filter(i=>i.entity_id.startsWith("media_player.")&&t(i)<Math.max(2,e.w)).sort((i,o)=>t(i)-t(o))[0]?.entity_id??null}var st=(n,e)=>typeof n[e]=="string"?n[e]:"";function $u(n,e,t){let r=[];for(let i of e.floors)for(let o of i.furniture){if(!vr(o.type))continue;let s=t?.get(o.id)?.entity??null,a=s?.startsWith("media_player.")?s:gp(i,o),l=a?n.states[a]:void 0;if(!l||!Ao(l))continue;let u=l.attributes,c=st(u,"app_name")||st(u,"source")||null;r.push({id:o.id,furnitureId:o.id,floorId:i.id,color:Mo(c),title:st(u,"media_title")||st(u,"media_channel")||c||"",subtitle:st(u,"media_artist")||st(u,"media_series_title")||st(u,"media_album_name"),app:c,picture:st(u,"entity_picture")||null,playing:Eo(l),ambilight:o.ambilight??1})}return r}function Mu(n){let e=n.states["sun.sun"]?.attributes;return typeof e?.elevation=="number"&&typeof e.azimuth=="number"?{elevation:e.elevation,azimuth:e.azimuth}:null}function Au(n,e){return(n===null?0:ku((n+4)/16))*(1-.45*e)}function at(n,e){return n.states["weather.nextfloor_symcon"]?"weather.nextfloor_symcon":e&&n.states[e]?e:Object.keys(n.states).filter(t=>t.startsWith("weather.")).sort()[0]??null}var Zr=new Set(["contact_lost","unlocked_night","own"]);function _p(n,e){let t=n.states[e.entity];if(!t||["unavailable","unknown"].includes(t.state))return!1;let r=(e.state??"on").trim(),i=/^([<>])\s*(-?\d+(?:[.,]\d+)?)$/.exec(r);if(i){let o=Number(t.state),s=Number(i[2].replace(",","."));return Number.isFinite(o)&&(i[1]==="<"?o<s:o>s)}return r.split(",").map(o=>o.trim().toLowerCase()).filter(Boolean).includes(String(t.state).toLowerCase())}var bp=600*1e3,vp=new Set(["rainy","pouring","lightning-rainy","hail","snowy-rainy"]),yp=new Map([["smoke","smoke"],["gas","gas"],["carbon_monoxide","co"],["moisture","water"]]),Eu=(n,e)=>{if(e.startsWith("binary_sensor."))return yp.get(String(n.states[e]?.attributes.device_class))};function wp(n,e){let t=new Set,r=[];for(let i of n.floors)for(let o of i.openings){let s=e.get(o.id);for(let a of s?[s.contact,s.contact2,s.tilt,s.tilt2]:[])!a||t.has(a)||(t.add(a),r.push({floorId:i.id,roomId:o.room_id,entity:a}))}return r}function Ru(n,e,t,r){let i=[];for(let a o Line truncated
${ne`<circle cx="27" cy="27" r=${22} class="live-ring-bg"></circle>
<circle cx="27" cy="27" r=${22} stroke=${e} stroke-dasharray=${`${(r*Math.max(0,Math.min(1,n))).toFixed(1)} ${r.toFixed(1)}`} transform="rotate(-90 27 27)" class="live-ring-fg"></circle>`}
</svg>`}function Ef(n,e,t,r){let i=e.summary,o=u=>$(n,u),s=e.autarky,a=r?p`<button class="live-fold" title=${o(r.folded?"live_unfold":"live_fold")} aria-label=${o(r.folded?"live_unfold":"live_fold")} aria-expanded=${!r.folded} @click=${r.toggle}>${r.folded?"+":"\u2212"}</button>`:f;if(r?.folded){let u=i.solar!==null?`\u2600 ${ze(n,i.solar)}`:i.consumption!==null?`\u2302 ${ze(n,i.consumption)}`:null;return p`<div class="live-card live-card-house live-folded" data-i=${t}>
${s!==null?p`<div class="live-own">${Ln(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)}%</b></div></div>`:f}
</svg>`}function Tf(n,e,t,r){let i=e.summary,o=u=>$(n,u),s=e.autarky,a=r?p`<button class="live-fold" title=${o(r.folded?"live_unfold":"live_fold")} aria-label=${o(r.folded?"live_unfold":"live_fold")} aria-expanded=${!r.folded} @click=${r.toggle}>${r.folded?"+":"\u2212"}</button>`:f;if(r?.folded){let u=i.solar!==null?`\u2600 ${ze(n,i.solar)}`:i.consumption!==null?`\u2302 ${ze(n,i.consumption)}`:null;return p`<div class="live-card live-card-house live-folded" data-i=${t}>
${s!==null?p`<div class="live-own">${On(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)}%</b></div></div>`:f}
${u?p`<b>${u}</b>`:s===null?p`<b>⌂</b>`:f}
${a}
</div>`}let l=[];if(i.solar!==null&&l.push(p`<div class="live-row live-solar"><span>☀ ${o("energy_solar")}</span><b>${ze(n,i.solar)}</b></div>`),i.consumption!==null&&l.push(p`<div class="live-row live-house"><span>⌂ ${o("energy_consumption")}</span><b>${ze(n,i.consumption)}</b></div>`),i.rest!==void 0&&i.rest!==null&&l.push(p`<div class="live-row live-house"><span>⌂ ${o("energy_rest")}</span><b>${ze(n,i.rest)}</b></div>`),i.battery!==null||i.soc!==null){let u=i.battery===null||Math.abs(i.battery)<15?"":i.battery>0?" \u2193":" \u2191";l.push(p`<div class="live-row live-battery"><span>▮ ${o("energy_battery")}${u}</span><b>${i.soc!==null?`${Math.round(i.soc)} %`:""}${i.battery!==null&&Math.abs(i.battery)>=15?` \xB7 ${ze(n,i.battery)}`:""}</b></div>`)}if(i.grid!==null){let u=i.grid<-15;l.push(p`<div class="live-row ${u?"live-export":"live-import"}"><span>⇄ ${o(u?"energy_grid_export":"energy_grid_import")}</span><b>${ze(n,i.grid)}</b></div>`)}for(let u of e.meters??[])l.push(p`<div class="live-row live-meter"><span>${u.icon} ${u.label}</span><b>${u.value}</b></div>`);return p`<div class="live-card live-card-house" data-i=${t}>
${a}
${s!==null?p`<div class="live-own">${Ln(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)} %</b><span>${o("live_autarky")}</span></div></div>`:f}
${s!==null?p`<div class="live-own">${On(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)} %</b><span>${o("live_autarky")}</span></div></div>`:f}
<div class="live-rows">${l}</div>
${zf(n,e.curves)} ${Rf(n,e.week)}
</div>`}function Rf(n,e){if(!e)return f;let t=[...e.solar,...e.use].filter(u=>u!==null&&u>0);if(!t.length)return f;let r=Math.max(...t)*1.1||1,[i,o]=[150,30],s=i/7,a=(u,c,h)=>u===null||u<=0?f:ne`<rect x=${c.toFixed(1)} y=${(o-u/r*o).toFixed(1)} width=${(s*.36).toFixed(1)} height=${(u/r*o).toFixed(1)} class=${h}></rect>`,l=u=>u.reduce((c,h)=>c+(h??0),0);return p`<div class="live-day live-week" title=${$(n,"live_week_hint",{solar:L(n,l(e.solar),0),use:L(n,l(e.use),0)})}>
${Ff(n,e.curves)} ${Df(n,e.week)}
</div>`}function Df(n,e){if(!e)return f;let t=[...e.solar,...e.use].filter(u=>u!==null&&u>0);if(!t.length)return f;let r=Math.max(...t)*1.1||1,[i,o]=[150,30],s=i/7,a=(u,c,h)=>u===null||u<=0?f:ne`<rect x=${c.toFixed(1)} y=${(o-u/r*o).toFixed(1)} width=${(s*.36).toFixed(1)} height=${(u/r*o).toFixed(1)} class=${h}></rect>`,l=u=>u.reduce((c,h)=>c+(h??0),0);return p`<div class="live-day live-week" title=${$(n,"live_week_hint",{solar:L(n,l(e.solar),0),use:L(n,l(e.use),0)})}>
<svg viewBox=${`0 0 ${i} ${o}`} preserveAspectRatio="none" aria-hidden="true">
${e.days.map((u,c)=>ne`${a(e.solar[c],c*s+s*.1,"live-week-solar")}${a(e.use[c],c*s+s*.5,"live-week-use")}`)}
</svg>
<span>7 ${$(n,"live_days")}</span>
</div>`}function zf(n,e){if(!e)return f;let t=[...e.solar,...e.use].filter(l=>l!==null);if(t.length<4)return f;let r=Math.max(...t)*1.08||1,[i,o]=[150,34],s=Rn(e.solar,i,o,r),a=Rn(e.use,i,o,r);return p`<div class="live-day" title=${$(n,"live_day_hint")}>
</div>`}function Ff(n,e){if(!e)return f;let t=[...e.solar,...e.use].filter(l=>l!==null);if(t.length<4)return f;let r=Math.max(...t)*1.08||1,[i,o]=[150,34],s=zn(e.solar,i,o,r),a=zn(e.use,i,o,r);return p`<div class="live-day" title=${$(n,"live_day_hint")}>
<svg viewBox=${`0 0 ${i} ${o}`} preserveAspectRatio="none" aria-hidden="true">
${s?ne`<path d=${`${s}L${i},${o}L0,${o}Z`} class="live-day-solar"></path>`:f}
${a?ne`<path d=${a} class="live-day-use"></path>`:f}
</svg>
<span>24 h</span>
</div>`}function Tf(n,e,t,r){let i=e.car,o=(c,h)=>$(n,c,h),s=wc(i.soc),a=i.home?i.charging?`\u26A1 ${o("live_car_charging")}${i.chargingW?` \xB7 ${ze(n,i.chargingW)}`:""}`:i.plugged?`\u{1F50C} ${o("live_car_plugged")}`:"":`${o("live_car_away")}${i.where?` \xB7 ${i.where}`:""}${i.distance!==null?` \xB7 ${L(n,i.distance,i.distance<10?1:0)} km`:""}`,l=i.entities,u=(c,h,m,d)=>p`<button class="live-btn ${c?"live-on":""}" title=${h} aria-label=${h} aria-pressed=${c??!1} @click=${g=>(g.stopPropagation(),d())}>${m}</button>`;return p`<div class="live-card live-card-car ${i.charging?"live-charging":""} ${i.home?"":"live-away"}" data-i=${t} style=${`--live-soc:${s}`}>
</div>`}function Hf(n,e,t,r){let i=e.car,o=(c,h)=>$(n,c,h),s=kc(i.soc),a=i.home?i.charging?`\u26A1 ${o("live_car_charging")}${i.chargingW?` \xB7 ${ze(n,i.chargingW)}`:""}`:i.plugged?`\u{1F50C} ${o("live_car_plugged")}`:"":`${o("live_car_away")}${i.where?` \xB7 ${i.where}`:""}${i.distance!==null?` \xB7 ${L(n,i.distance,i.distance<10?1:0)} km`:""}`,l=i.entities,u=(c,h,m,d)=>p`<button class="live-btn ${c?"live-on":""}" title=${h} aria-label=${h} aria-pressed=${c??!1} @click=${g=>(g.stopPropagation(),d())}>${m}</button>`;return p`<div class="live-card live-card-car ${i.charging?"live-charging":""} ${i.home?"":"live-away"}" data-i=${t} style=${`--live-soc:${s}`}>
<div class="live-own">
${Ln((i.soc??0)/100,s)}
${On((i.soc??0)/100,s)}
<div class="live-own-text"><b>${i.soc!==null?`${Math.round(i.soc)} %`:"\u2013"}</b><span>${i.range!==null?`${Math.round(i.range)} ${i.rangeUnit}`:""}</span></div>
</div>
<div class="live-rows">
@@ -896,7 +896,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${l.charge&&i.home?u(i.charging,o("live_car_charge"),"\u26A1",()=>r(l.charge.split(".")[0],"toggle",l.charge)):f}
</div>
</div>
</div>`}function Df(n,e,t,r){let i=e.media,o=l=>$(n,l),s=`rgb(${i.color.join(",")})`,a=(l,u,c)=>p`<button class="live-btn" title=${l} aria-label=${l} @click=${h=>(h.stopPropagation(),r("media_player",c,i.entity))}>${u}</button>`;return p`<div class="live-card live-card-media" data-i=${t} style=${`--live-soc:${s}`} @click=${l=>l.currentTarget.classList.toggle("live-open")}>
</div>`}function Pf(n,e,t,r){let i=e.media,o=l=>$(n,l),s=`rgb(${i.color.join(",")})`,a=(l,u,c)=>p`<button class="live-btn" title=${l} aria-label=${l} @click=${h=>(h.stopPropagation(),r("media_player",c,i.entity))}>${u}</button>`;return p`<div class="live-card live-card-media" data-i=${t} style=${`--live-soc:${s}`} @click=${l=>l.currentTarget.classList.toggle("live-open")}>
${i.picture?p`<img class="live-cover" src=${i.picture} alt="" loading="lazy" />`:p`<div class="live-cover live-cover-none">♪</div>`}
<div class="live-rows">
<div class="live-title" title=${i.title}>${i.title||i.name}</div>
@@ -915,9 +915,9 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
/>`:f}
</div>
</div>
</div>`}function xc(n){let e=[...n.querySelectorAll(".live-card")].filter(s=>s.style.visibility!=="hidden"&&s.offsetWidth>0),t=[],r=e[0]?.parentElement?.clientWidth??0,i=e[0]?.parentElement?.clientHeight??0,o=e.map(s=>{let[a,l]=[Number(s.dataset.x),s.offsetWidth],u=r?r>l+16?Math.min(Math.max(a,l/2+8),r-l/2-8):r/2:a;return s.style.setProperty("--live-dx",`${Math.round(a-u)}px`),{el:s,x:u,y:Number(s.dataset.y),w:l,h:s.offsetHeight}}).sort((s,a)=>Number(a.el.dataset.priority||0)-Number(s.el.dataset.priority||0)||a.y-s.y);for(let s of o){let a=s.y;if((s.el.classList.contains("live-card-hydronic")||s.el.classList.contains("live-card-charging"))&&r>s.w+16&&i>s.h+16){let h=[s.x,s.w/2+8,r-s.w/2-8,...t.flatMap(g=>[g.x0-s.w/2-8,g.x1+s.w/2+8])].filter(g=>g>=s.w/2+8&&g<=r-s.w/2-8).sort((g,_)=>Math.abs(g-s.x)-Math.abs(_-s.x)),m=[Math.max(s.h+8,Math.min(i-8,a)),...t.flatMap(g=>[g.y0-8,g.y1+s.h+8])].filter(g=>g>=s.h+8&&g<=i-8),d;for(let g of m){for(let _ of h)if(!t.some(b=>_-s.w/2<b.x1+6&&_+s.w/2>b.x0-6&&g-s.h<b.y1+6&&g>b.y0-6)){d={x:_,y:g};break}if(d)break}d&&(s.x=d.x,a=d.y)}for(let h=0;h<12;h++){let m={x0:s.x-s.w/2,x1:s.x+s.w/2,y0:a-s.h,y1:a},d=t.find(g=>m.x0<g.x1+6&&m.x1>g.x0-6&&m.y0<g.y1+6&&m.y1>g.y0-6);if(!d)break;a=d.y0-8}let l=s.y-a,u=!s.el.classList.contains("live-card-house")&&!s.el.classList.contains("live-card-roomclimate")&&s.el.dataset.focused!=="1",c=s.el.classList.contains("live-card-hydronic")||s.el.classList.contains("live-card-charging");if(u&&i>0&&(a-s.h<8||a>i-8||!c&&Math.abs(l)>Math.max(100,Math.min(180,i*.25)))){s.el.style.visibility="hidden";continue}t.push({x0:s.x-s.w/2,x1:s.x+s.w/2,y0:a-s.h,y1:a}),s.el.style.setProperty("--live-dx",`${Math.round(Number(s.el.dataset.x)-s.x)}px`),s.el.style.transform=`translate(${Math.round(s.x)}px, ${Math.round(a)}px) translate(-50%, -100%)`,s.el.style.setProperty("--live-thread",`${Math.round(18+l)}px`)}}function Ff(n,e,t){let r=e.printer,i=(u,c)=>$(n,u,c),o=r.progress??0,s=u=>new Intl.DateTimeFormat(n?.language??navigator.language,{hour:"2-digit",minute:"2-digit"}).format(new Date(u)),a=r.remaining!==null?r.remaining>=60?`${Math.floor(r.remaining/60)} h ${Math.round(r.remaining%60)} min`:`${Math.round(r.remaining)} min`:null,l=[r.nozzle!==null?`${i("printer_nozzle")} ${Math.round(r.nozzle)}\xB0`:null,r.bed!==null?`${i("printer_bed")} ${Math.round(r.bed)}\xB0`:null].filter(Boolean).join(" \xB7 ");return p`<div class="live-card live-card-printer ${r.printing?"live-charging":""}" data-i=${t}>
</div>`}function Sc(n){let e=[...n.querySelectorAll(".live-card")].filter(s=>s.style.visibility!=="hidden"&&s.offsetWidth>0),t=[],r=e[0]?.parentElement?.clientWidth??0,i=e[0]?.parentElement?.clientHeight??0,o=e.map(s=>{let[a,l]=[Number(s.dataset.x),s.offsetWidth],u=r?r>l+16?Math.min(Math.max(a,l/2+8),r-l/2-8):r/2:a;return s.style.setProperty("--live-dx",`${Math.round(a-u)}px`),{el:s,x:u,y:Number(s.dataset.y),w:l,h:s.offsetHeight}}).sort((s,a)=>Number(a.el.dataset.priority||0)-Number(s.el.dataset.priority||0)||a.y-s.y);for(let s of o){let a=s.y;if((s.el.classList.contains("live-card-hydronic")||s.el.classList.contains("live-card-charging"))&&r>s.w+16&&i>s.h+16){let h=[s.x,s.w/2+8,r-s.w/2-8,...t.flatMap(g=>[g.x0-s.w/2-8,g.x1+s.w/2+8])].filter(g=>g>=s.w/2+8&&g<=r-s.w/2-8).sort((g,_)=>Math.abs(g-s.x)-Math.abs(_-s.x)),m=[Math.max(s.h+8,Math.min(i-8,a)),...t.flatMap(g=>[g.y0-8,g.y1+s.h+8])].filter(g=>g>=s.h+8&&g<=i-8),d;for(let g of m){for(let _ of h)if(!t.some(b=>_-s.w/2<b.x1+6&&_+s.w/2>b.x0-6&&g-s.h<b.y1+6&&g>b.y0-6)){d={x:_,y:g};break}if(d)break}d&&(s.x=d.x,a=d.y)}for(let h=0;h<12;h++){let m={x0:s.x-s.w/2,x1:s.x+s.w/2,y0:a-s.h,y1:a},d=t.find(g=>m.x0<g.x1+6&&m.x1>g.x0-6&&m.y0<g.y1+6&&m.y1>g.y0-6);if(!d)break;a=d.y0-8}let l=s.y-a,u=!s.el.classList.contains("live-card-house")&&!s.el.classList.contains("live-card-roomclimate")&&s.el.dataset.focused!=="1",c=s.el.classList.contains("live-card-hydronic")||s.el.classList.contains("live-card-charging");if(u&&i>0&&(a-s.h<8||a>i-8||!c&&Math.abs(l)>Math.max(100,Math.min(180,i*.25)))){s.el.style.visibility="hidden";continue}t.push({x0:s.x-s.w/2,x1:s.x+s.w/2,y0:a-s.h,y1:a}),s.el.style.setProperty("--live-dx",`${Math.round(Number(s.el.dataset.x)-s.x)}px`),s.el.style.transform=`translate(${Math.round(s.x)}px, ${Math.round(a)}px) translate(-50%, -100%)`,s.el.style.setProperty("--live-thread",`${Math.round(18+l)}px`)}}function If(n,e,t){let r=e.printer,i=(u,c)=>$(n,u,c),o=r.progress??0,s=u=>new Intl.DateTimeFormat(n?.language??navigator.language,{hour:"2-digit",minute:"2-digit"}).format(new Date(u)),a=r.remaining!==null?r.remaining>=60?`${Math.floor(r.remaining/60)} h ${Math.round(r.remaining%60)} min`:`${Math.round(r.remaining)} min`:null,l=[r.nozzle!==null?`${i("printer_nozzle")} ${Math.round(r.nozzle)}\xB0`:null,r.bed!==null?`${i("printer_bed")} ${Math.round(r.bed)}\xB0`:null].filter(Boolean).join(" \xB7 ");return p`<div class="live-card live-card-printer ${r.printing?"live-charging":""}" data-i=${t}>
<div class="live-own">
${r.picture?p`<img class="live-print-pic" src=${r.picture} alt="" />`:Ln(o/100,r.printing?"#38bdf8":"#8aa0c8")}
${r.picture?p`<img class="live-print-pic" src=${r.picture} alt="" />`:On(o/100,r.printing?"#38bdf8":"#8aa0c8")}
<div class="live-own-text"><b>${r.progress!==null?`${Math.round(o)} %`:"\u2013"}</b><span>${i(`printer_${r.printing?"printing":/finish|complete|fertig/.test(r.status)?"done":/pause/.test(r.status)?"paused":/error|fail/.test(r.status)?"error":"idle"}`)}</span></div>
</div>
<div class="live-rows">
@@ -928,9 +928,9 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${l?p`<div class="live-status">🌡 ${l}</div>`:f}
${r.filaments.length?p`<div class="live-filaments">${r.filaments.map(u=>p`<i style=${`background:${u}`}></i>`)}</div>`:f}
</div>
</div>`}function Hf(n,e,t){let r=e.pump,i=a=>$(n,a),o=a=>a===null?"\u2013":`${L(n,a,1)}\xB0`,s={heating:"\u{1F525}",water:"\u{1F6BF}",cooling:"\u2744",defrost:"\u{1F9CA}",idle:"\u23F8"}[r.mode];return p`<div class="live-card live-card-heatpump ${r.mode==="idle"?"":"live-charging"}" data-i=${t}>
</div>`}function Cf(n,e,t){let r=e.pump,i=a=>$(n,a),o=a=>a===null?"\u2013":`${L(n,a,1)}\xB0`,s={heating:"\u{1F525}",water:"\u{1F6BF}",cooling:"\u2744",defrost:"\u{1F9CA}",idle:"\u23F8"}[r.mode];return p`<div class="live-card live-card-heatpump ${r.mode==="idle"?"":"live-charging"}" data-i=${t}>
<div class="live-own">
${Ln(Math.min(1,(r.cop??0)/6),(r.cop??0)>=3.5?"#4ade80":(r.cop??0)>=2.5?"#facc15":"#fb923c")}
${On(Math.min(1,(r.cop??0)/6),(r.cop??0)>=3.5?"#4ade80":(r.cop??0)>=2.5?"#facc15":"#fb923c")}
<div class="live-own-text"><b>${r.cop!==null?L(n,r.cop,1):s}</b><span>${r.cop!==null?"COP":""}</span></div>
</div>
<div class="live-rows">
@@ -941,17 +941,17 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${r.power!==null?p`<div class="live-row live-house"><span>${i("heatpump_power")}</span><b>${ze(n,r.power)}</b></div>`:f}
${r.outside!==null?p`<div class="live-status">🌡 ${i("heatpump_outside")} ${o(r.outside)}</div>`:f}
</div>
</div>`}function Pf(n,e,t){let r=(o,s,a)=>o===null?"\u2013":`${L(n,o,s)} ${a}`,i=Object.values(e.sources??{}).some(o=>vn(n,o).length>0);return p`<div class="live-card live-card-roomclimate ${i?"live-climate-trends":""}" data-i=${t} data-room=${e.roomId} role="group" aria-label=${`${e.name||$(n,"room")} \xB7 ${$(n,"climate")}`}>
</div>`}function Nf(n,e,t){let r=(o,s,a)=>o===null?"\u2013":`${L(n,o,s)} ${a}`,i=Object.values(e.sources??{}).some(o=>vn(n,o).length>0);return p`<div class="live-card live-card-roomclimate ${i?"live-climate-trends":""}" data-i=${t} data-room=${e.roomId} role="group" aria-label=${`${e.name||$(n,"room")} \xB7 ${$(n,"climate")}`}>
${e.showTemperature?p`<div class="live-row live-climate-temperature"><span title=${$(n,"climate_temperature")} aria-label=${$(n,"climate_temperature")}>🌡</span><b>${r(e.temperature===null?null:n?ue(n,e.temperature):e.temperature,1,n?re(n):"\xB0C")}</b>${G(n,e.sources?.temperature??[],$(n,"climate_temperature"))}</div>`:f}
${e.showHumidity?p`<div class="live-row live-climate-humidity"><span title=${$(n,"climate_humidity")} aria-label=${$(n,"climate_humidity")}>💧</span><b>${r(e.humidity,0,"%")}</b>${G(n,e.sources?.humidity??[],$(n,"climate_humidity"))}</div>`:f}
${e.showCo2?p`<div class="live-row live-climate-co2"><span title=${$(n,"climate_co2")} aria-label=${$(n,"climate_co2")}>☁</span><b>${r(e.co2,0,"ppm")}</b>${G(n,e.sources?.co2??[],$(n,"climate_co2"))}</div>`:f}
${e.showIlluminance?p`<div class="live-row live-climate-illuminance"><span title=${$(n,"climate_illuminance")} aria-label=${$(n,"climate_illuminance")}>☀</span><b>${r(e.illuminance,0,"lx")}</b>${G(n,e.sources?.illuminance??[],$(n,"climate_illuminance"))}</div>`:f}
</div>`}function If(n,e,t){let r=e.power===null?"\u2013":`${e.power<0?"\u2212":""}${ze(n,e.power)}`;return p`<div class="live-card live-card-power ${(e.readings??[]).length?"live-card-charging":""}" data-i=${t} data-furniture=${e.id} role="group" aria-label=${e.name}>
</div>`}function Lf(n,e,t){let r=e.power===null?"\u2013":`${e.power<0?"\u2212":""}${ze(n,e.power)}`;return p`<div class="live-card live-card-power ${(e.readings??[]).length?"live-card-charging":""}" data-i=${t} data-furniture=${e.id} role="group" aria-label=${e.name}>
<div class="live-power-name">${e.name}</div>${e.powerEntity?p`<div class="live-row"><span aria-hidden="true">⚡</span><b>${r}</b>${G(n,[e.powerEntity],e.name)}</div>`:f}
${(e.readings??[]).map(i=>p`<div class="live-row live-charging-row" data-reading=${i.id}><span class="live-charging-label" title=${i.label}><span aria-hidden="true">${i.icon}</span> ${i.label}</span><b title=${i.text}>${i.text}</b>${G(n,[i.entity],i.label)}</div>`)}
</div>`}function kc(n,e,t,r,i=!1){return e.length?p`<div class="live-cards">
${e.map((o,s)=>o.kind==="roomclimate"?Pf(n,o,s):o.kind==="power"?If(n,o,s):o.kind==="hydronic"?p`<div class="live-card live-card-hydronic" data-i=${s} data-furniture=${o.item.id}><nf-hydronic-card .hass=${n} .item=${o.item} .readOnly=${o.readOnly}></nf-hydronic-card></div>`:i?f:o.kind==="house"?Ef(n,o,s,r):o.kind==="car"?Tf(n,o,s,t):o.kind==="printer"?Ff(n,o,s):o.kind==="heatpump"?Hf(n,o,s):Df(n,o,s,t))}
</div>`:f}var Sc=J`
</div>`}function $c(n,e,t,r,i=!1){return e.length?p`<div class="live-cards">
${e.map((o,s)=>o.kind==="roomclimate"?Nf(n,o,s):o.kind==="power"?Lf(n,o,s):o.kind==="hydronic"?p`<div class="live-card live-card-hydronic" data-i=${s} data-furniture=${o.item.id}><nf-hydronic-card .hass=${n} .item=${o.item} .readOnly=${o.readOnly}></nf-hydronic-card></div>`:i?f:o.kind==="house"?Tf(n,o,s,r):o.kind==="car"?Hf(n,o,s,t):o.kind==="printer"?If(n,o,s):o.kind==="heatpump"?Cf(n,o,s):Pf(n,o,s,t))}
</div>`:f}var Mc=J`
.live-card.live-card-power { display:grid; gap:4px; min-width:90px; max-width:220px; box-sizing:border-box; }
.live-power-name { font-size:11px; color:var(--nf-muted); overflow:hidden; text-overflow:ellipsis; }
.live-card-power .live-row { align-items:center; gap:6px; }
@@ -1298,7 +1298,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
text-transform: uppercase;
letter-spacing: 0.04em;
}
`;function qo(n){switch(n.kind){case"house":return{density:0,priority:100};case"roomclimate":return{density:24,priority:80};case"hydronic":return{density:42,priority:45};case"power":return n.power!==null&&Math.abs(n.power)>1?{density:48,priority:60}:n.readings?.length?{density:56,priority:30}:{density:n.power===null?64:72,priority:20};case"car":return{density:n.car.charging?36:60,priority:n.car.charging?60:20};case"printer":return{density:n.printer.printing?36:60,priority:n.printer.printing?60:20};case"heatpump":return{density:n.pump.mode!=="idle"?36:60,priority:n.pump.mode!=="idle"?60:20};case"media":return{density:48,priority:40}}}function $c(n,e,t){let r=qo(n).density;return r?Number.isFinite(e)&&e>=r*(t?.88:1.12):!0}function ai(n){return n.toLocaleLowerCase().normalize("NFD").replace(new RegExp("\\p{M}","gu"),"")}var Zo=n=>n.points.length>=3;function Mc(n,e,t){return n.rooms.filter(Zo).find(r=>H([e,t],r.points))}function Cf(n,e,t,r){let i=[];for(let a of e.rooms.filter(Zo)){let[l,u]=Te(a.points);i.push({kind:"room",name:a.name,where:r?e.name:"",floorId:e.id,roomId:a.id,entity:null,icon:null,x:l,z:u,y:0})}let o=new Set,s=(a,l,u,c)=>{if(o.has(a)||!(a in n.states))return;o.add(a);let h=Mc(e,l,u),m=[h?.name,r?e.name:void 0].filter(d=>!!d).join(" \xB7 ");i.push({kind:"device",name:O(n,a),where:m,floorId:e.id,roomId:h?.id??null,entity:a,icon:P(a),x:l,z:u,y:c})};for(let a of e.placements){let l=a.y??Ht(P(a.entity_id)??"sensor",xe(e,a.x,a.z),a.mount);s(a.entity_id,a.x,a.z,l)}for(let a of e.furniture){let l=t.get(a.id),u=l?.entity??l?.power;if(!u)continue;let c=xe(e,a.x,a.z)-.3;s(u,a.x,a.z,Math.min(c,Math.max(.5,a.h)))}for(let a of e.notes??[]){if(!a.text)continue;let l=Mc(e,a.x,a.z),u=[l?.name,r?e.name:void 0].filter(c=>!!c).join(" \xB7 ");i.push({kind:"note",name:`\u270E ${a.text.length>60?`${a.text.slice(0,59)}\u2026`:a.text}`,where:u,floorId:e.id,roomId:l?.id??null,entity:null,icon:null,x:a.x,z:a.z,y:1.3})}return i}function Ac(n,e){let t=Ke(n,e.floors),r=e.floors.length>1,i=e.floors.flatMap(o=>Cf(n,o,t,r));for(let o of e.settings.circuits??[]){let s=e.floors.flatMap(h=>h.rooms.filter(m=>o.rooms.includes(m.id)&&Zo(m)).map(m=>({f:h,r:m})));if(!s.length)continue;let[{f:a,r:l}]=s,[u,c]=Te(l.points);i.push({kind:"circuit",name:`\u{1F50C} ${o.name}`,where:s.map(h=>h.r.name).join(", "),floorId:a.id,roomId:l.id,entity:null,icon:null,x:u,z:c,y:0})}return i}function Nf(n,e){return(ai(n.name).startsWith(e)?0:2)+(n.kind==="room"?0:1)}function Ec(n,e,t=8){let r=ai(e).split(/\s+/).filter(Boolean);if(r.length===0)return[];let i=ai(e.trim());return n.filter(o=>{let s=ai([o.name,o.where,o.entity].filter(Boolean).join(" "));return r.every(a=>s.includes(a))}).map(o=>({item:o,cost:Nf(o,i)})).sort((o,s)=>o.cost-s.cost||o.item.name.localeCompare(s.item.name)).slice(0,t).map(o=>o.item)}var Lf=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[190,90,255],[255,95,210],[255,70,70],[120,255,150]],Of=[2200,2700,3200,4e3,5e3,6500],Wf=["hs","rgb","rgbw","rgbww","xy"],Bf=4,Rc=16,zc=32,Vf=128;function Jo(n){let e=n.attributes.supported_color_modes??[],t=e.some(r=>Wf.includes(r));return{dim:e.some(r=>r!=="onoff"),color:t,temp:e.includes("color_temp")}}function Qo(n){return((n.attributes.supported_features??0)&Bf)!==0&&typeof n.attributes.current_position=="number"}var Yo=class extends Q{static properties={hass:{attribute:!1},entity:{attribute:!1},car:{attribute:!1},presets:{attribute:!1},confirmSwitch:{type:Boolean},myPosition:{attribute:!1},tiltEntity:{attribute:!1},low:{type:Boolean,reflect:!0}};t(e,t){return $(this.hass,e,t)}ask(){return!this.confirmSwitch||confirm(this.t("confirm_switch",{name:O(this.hass,this.entity)}))}call(e,t,r={}){this.hass.callService(e,t,{entity_id:this.entity,...r})}close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}details(){ke(this,this.entity),this.close()}ring(e){let t=e.length;return e.map((r,i)=>{let o=i/t*Math.PI*2-Math.PI/2;return p`<div class="qm-at" style="left:${50+Math.cos(o)*39}%;top:${50+Math.sin(o)*39}%">${r}</div>`})}renderLight(e){let t=Jo(e),r=e.state==="on",i=r&&typeof e.attributes.brightness=="number"?Math.round(e.attributes.brightness/2.55):r?100:0,o=t.color?Lf.map(s=>p`<button class="qm-swatch" style="background:rgb(${s.join(",")})" aria-label=${`RGB ${s.join(", ")}`} @click=${()=>this.call("light","turn_on",{rgb_color:s})}></button>`):t.temp?Of.map(s=>p`<button class="qm-swatch" style="background:${Kf(s)}" aria-label=${`${s} K`} @click=${()=>this.call("light","turn_on",{color_temp_kelvin:s})}></button>`):[];return p`<div class="qm-ring ${o.length?"":"qm-ring-small"}">
`;function Zo(n){switch(n.kind){case"house":return{density:0,priority:100};case"roomclimate":return{density:24,priority:80};case"hydronic":return{density:42,priority:45};case"power":return n.power!==null&&Math.abs(n.power)>1?{density:48,priority:60}:n.readings?.length?{density:56,priority:30}:{density:n.power===null?64:72,priority:20};case"car":return{density:n.car.charging?36:60,priority:n.car.charging?60:20};case"printer":return{density:n.printer.printing?36:60,priority:n.printer.printing?60:20};case"heatpump":return{density:n.pump.mode!=="idle"?36:60,priority:n.pump.mode!=="idle"?60:20};case"media":return{density:48,priority:40}}}function Ac(n,e,t){let r=Zo(n).density;return r?Number.isFinite(e)&&e>=r*(t?.88:1.12):!0}function li(n){return n.toLocaleLowerCase().normalize("NFD").replace(new RegExp("\\p{M}","gu"),"")}var Yo=n=>n.points.length>=3;function Ec(n,e,t){return n.rooms.filter(Yo).find(r=>H([e,t],r.points))}function Of(n,e,t,r){let i=[];for(let a of e.rooms.filter(Yo)){let[l,u]=Te(a.points);i.push({kind:"room",name:a.name,where:r?e.name:"",floorId:e.id,roomId:a.id,entity:null,icon:null,x:l,z:u,y:0})}let o=new Set,s=(a,l,u,c)=>{if(o.has(a)||!(a in n.states))return;o.add(a);let h=Ec(e,l,u),m=[h?.name,r?e.name:void 0].filter(d=>!!d).join(" \xB7 ");i.push({kind:"device",name:O(n,a),where:m,floorId:e.id,roomId:h?.id??null,entity:a,icon:P(a),x:l,z:u,y:c})};for(let a of e.placements){let l=a.y??Ht(P(a.entity_id)??"sensor",xe(e,a.x,a.z),a.mount);s(a.entity_id,a.x,a.z,l)}for(let a of e.furniture){let l=t.get(a.id),u=l?.entity??l?.power;if(!u)continue;let c=xe(e,a.x,a.z)-.3;s(u,a.x,a.z,Math.min(c,Math.max(.5,a.h)))}for(let a of e.notes??[]){if(!a.text)continue;let l=Ec(e,a.x,a.z),u=[l?.name,r?e.name:void 0].filter(c=>!!c).join(" \xB7 ");i.push({kind:"note",name:`\u270E ${a.text.length>60?`${a.text.slice(0,59)}\u2026`:a.text}`,where:u,floorId:e.id,roomId:l?.id??null,entity:null,icon:null,x:a.x,z:a.z,y:1.3})}return i}function Rc(n,e){let t=Ke(n,e.floors),r=e.floors.length>1,i=e.floors.flatMap(o=>Of(n,o,t,r));for(let o of e.settings.circuits??[]){let s=e.floors.flatMap(h=>h.rooms.filter(m=>o.rooms.includes(m.id)&&Yo(m)).map(m=>({f:h,r:m})));if(!s.length)continue;let[{f:a,r:l}]=s,[u,c]=Te(l.points);i.push({kind:"circuit",name:`\u{1F50C} ${o.name}`,where:s.map(h=>h.r.name).join(", "),floorId:a.id,roomId:l.id,entity:null,icon:null,x:u,z:c,y:0})}return i}function Wf(n,e){return(li(n.name).startsWith(e)?0:2)+(n.kind==="room"?0:1)}function zc(n,e,t=8){let r=li(e).split(/\s+/).filter(Boolean);if(r.length===0)return[];let i=li(e.trim());return n.filter(o=>{let s=li([o.name,o.where,o.entity].filter(Boolean).join(" "));return r.every(a=>s.includes(a))}).map(o=>({item:o,cost:Wf(o,i)})).sort((o,s)=>o.cost-s.cost||o.item.name.localeCompare(s.item.name)).slice(0,t).map(o=>o.item)}var Bf=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[190,90,255],[255,95,210],[255,70,70],[120,255,150]],Vf=[2200,2700,3200,4e3,5e3,6500],Kf=["hs","rgb","rgbw","rgbww","xy"],Gf=4,Tc=16,Dc=32,Uf=128;function Qo(n){let e=n.attributes.supported_color_modes??[],t=e.some(r=>Kf.includes(r));return{dim:e.some(r=>r!=="onoff"),color:t,temp:e.includes("color_temp")}}function Xo(n){return((n.attributes.supported_features??0)&Gf)!==0&&typeof n.attributes.current_position=="number"}var Jo=class extends Q{static properties={hass:{attribute:!1},entity:{attribute:!1},car:{attribute:!1},presets:{attribute:!1},confirmSwitch:{type:Boolean},myPosition:{attribute:!1},tiltEntity:{attribute:!1},low:{type:Boolean,reflect:!0}};t(e,t){return $(this.hass,e,t)}ask(){return!this.confirmSwitch||confirm(this.t("confirm_switch",{name:O(this.hass,this.entity)}))}call(e,t,r={}){this.hass.callService(e,t,{entity_id:this.entity,...r})}close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}details(){ke(this,this.entity),this.close()}ring(e){let t=e.length;return e.map((r,i)=>{let o=i/t*Math.PI*2-Math.PI/2;return p`<div class="qm-at" style="left:${50+Math.cos(o)*39}%;top:${50+Math.sin(o)*39}%">${r}</div>`})}renderLight(e){let t=Qo(e),r=e.state==="on",i=r&&typeof e.attributes.brightness=="number"?Math.round(e.attributes.brightness/2.55):r?100:0,o=t.color?Bf.map(s=>p`<button class="qm-swatch" style="background:rgb(${s.join(",")})" aria-label=${`RGB ${s.join(", ")}`} @click=${()=>this.call("light","turn_on",{rgb_color:s})}></button>`):t.temp?Vf.map(s=>p`<button class="qm-swatch" style="background:${jf(s)}" aria-label=${`${s} K`} @click=${()=>this.call("light","turn_on",{color_temp_kelvin:s})}></button>`):[];return p`<div class="qm-ring ${o.length?"":"qm-ring-small"}">
${this.ring(o)}
<button class="qm-power ${r?"qm-on":""}" aria-pressed=${r} @click=${()=>this.ask()&&this.call("light","toggle")}>
<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M12 3v8M6.3 6.8a8 8 0 1 0 11.4 0" /></svg>
@@ -1313,7 +1313,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.value=${String(Math.max(1,i))}
aria-label=${this.t("brightness")}
@change=${s=>this.call("light","turn_on",{brightness_pct:Number(s.target.value)})}
/>`:f}`}renderCover(e){e=xr(this.hass,e,this.tiltEntity);let t=typeof e.attributes.current_position=="number"?e.attributes.current_position:null,r=e.state==="opening"||e.state==="closing",i=Qo(e),o=(c,h,m,d=!1)=>p`<button class="qm-swatch qm-slot ${d?"qm-slot-on":""}" aria-label=${h} @click=${m}>${c}</button>`,s=c=>t!==null&&Math.abs(t-c)<3,a=[o("\u25B2",this.t("cover_open"),()=>this.ask()&&this.call("cover","open_cover"),s(100)),...i?[75,50].map(c=>o(`${c}`,`${c} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:c}),s(c))):[],o("\u25BC",this.t("cover_close"),()=>this.ask()&&this.call("cover","close_cover"),s(0)),...i?[25].map(c=>o(`${c}`,`${c} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:c}),s(c))):[],...Number(e.attributes.supported_features??0)&8?[o("\u25A0",this.t("cover_stop"),()=>this.call("cover","stop_cover"),r)]:[],...this.myPosition!=null&&(i||Number(e.attributes.supported_features??0)&8)?[o("My",this.t("cover_my_go",{p:this.myPosition}),()=>this.ask()&&(i?this.call("cover","set_cover_position",{position:this.myPosition}):this.call("cover","stop_cover")),s(this.myPosition))]:[]],l=t===null?e.state==="closed"?100:0:100-t,u=t!==null||r||e.state==="open"||e.state==="closed";return p`<div class="qm-ring">
/>`:f}`}renderCover(e){e=kr(this.hass,e,this.tiltEntity);let t=typeof e.attributes.current_position=="number"?e.attributes.current_position:null,r=e.state==="opening"||e.state==="closing",i=Xo(e),o=(c,h,m,d=!1)=>p`<button class="qm-swatch qm-slot ${d?"qm-slot-on":""}" aria-label=${h} @click=${m}>${c}</button>`,s=c=>t!==null&&Math.abs(t-c)<3,a=[o("\u25B2",this.t("cover_open"),()=>this.ask()&&this.call("cover","open_cover"),s(100)),...i?[75,50].map(c=>o(`${c}`,`${c} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:c}),s(c))):[],o("\u25BC",this.t("cover_close"),()=>this.ask()&&this.call("cover","close_cover"),s(0)),...i?[25].map(c=>o(`${c}`,`${c} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:c}),s(c))):[],...Number(e.attributes.supported_features??0)&8?[o("\u25A0",this.t("cover_stop"),()=>this.call("cover","stop_cover"),r)]:[],...this.myPosition!=null&&(i||Number(e.attributes.supported_features??0)&8)?[o("My",this.t("cover_my_go",{p:this.myPosition}),()=>this.ask()&&(i?this.call("cover","set_cover_position",{position:this.myPosition}):this.call("cover","stop_cover")),s(this.myPosition))]:[]],l=t===null?e.state==="closed"?100:0:100-t,u=t!==null||r||e.state==="open"||e.state==="closed";return p`<div class="qm-ring">
${this.ring(a)}
<button
class="qm-power qm-blind ${u&&l<100?"qm-on":""}"
@@ -1335,7 +1335,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
aria-label=${this.t("position")}
@change=${c=>this.call("cover","set_cover_position",{position:Number(c.target.value)})}
/>`:f}
${this.renderTilt(e)}`}renderTilt(e){let t=(e.attributes.supported_features??0)|0,r=typeof e.attributes.current_tilt_position=="number"?e.attributes.current_tilt_position:null;return t&Vf&&r!==null?p`<label class="qm-tilt"
${this.renderTilt(e)}`}renderTilt(e){let t=(e.attributes.supported_features??0)|0,r=typeof e.attributes.current_tilt_position=="number"?e.attributes.current_tilt_position:null;return t&Uf&&r!==null?p`<label class="qm-tilt"
><span>${this.t("cover_tilt")} · ${Math.round(r)} %</span>
<input
class="qm-slider"
@@ -1345,9 +1345,9 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.value=${String(r)}
aria-label=${this.t("cover_tilt")}
@change=${i=>this.call("cover","set_cover_tilt_position",{entity_id:e.attributes.nf_cover_control?this.entity:this.tiltEntity||this.entity,tilt_position:Number(i.target.value)})}
/></label>`:t&(Rc|zc)?p`<div class="qm-tilt-buttons">
${t&Rc?p`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","open_cover_tilt")}>${this.t("cover_tilt_open")}</button>`:f}
${t&zc?p`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","close_cover_tilt")}>${this.t("cover_tilt_close")}</button>`:f}
/></label>`:t&(Tc|Dc)?p`<div class="qm-tilt-buttons">
${t&Tc?p`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","open_cover_tilt")}>${this.t("cover_tilt_open")}</button>`:f}
${t&Dc?p`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","close_cover_tilt")}>${this.t("cover_tilt_close")}</button>`:f}
</div>`:f}renderToggle(e){let t=e.state==="on"||e.state==="unlocked"||e.state==="playing",r=e.entity_id.split(".")[0];return p`<div class="qm-ring qm-ring-small">
<button
class="qm-power ${t?"qm-on":""}"
@@ -1616,7 +1616,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.qm-note {
color: var(--nf-muted);
}
`]};function Kf(n){let e=Math.min(1,Math.max(0,(n-2200)/4300)),t=(r,i)=>Math.round(r+(i-r)*e);return`rgb(${t(255,200)},${t(170,225)},${t(80,255)})`}customElements.get("nf-quick-menu")||customElements.define("nf-quick-menu",Yo);var Gf=new URL(import.meta.url),Uf=new URL("./nextfloor-3d.js?v=6ac3f0e66302",Gf).href,Tc;function Dc(){return Tc??=import(Uf),Tc}function Fc(n){if(!n||n.state!=="on")return 0;let e=typeof n.attributes.percentage=="number"?n.attributes.percentage:60;return e<=0?0:.2+.6*Math.min(100,e)/100}var Hc="weather.nextfloor_symcon",Ic={condition:"Wetterzustand",temperature:"Au\xDFentemperatur",humidity:"Au\xDFenluftfeuchte",pressure:"Luftdruck",wind_speed:"Windgeschwindigkeit",wind_gust_speed:"Windb\xF6en",wind_bearing:"Windrichtung",cloud_coverage:"Bew\xF6lkung",precipitation:"Niederschlagsrate",precipitation_total:"Niederschlagsmenge",illuminance:"Au\xDFenhelligkeit",uv_index:"UV-Index",visibility:"Sichtweite",snow:"Schnee",fog:"Nebel",lightning:"Gewitter"},Pc=new WeakMap;function jf(n){let e=n.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").trim();return["sunny","clear-night","partlycloudy","cloudy","fog","rainy","pouring","lightning-rainy","lightning","hail","snowy","snowy-rainy","windy","windy-variant"].includes(e)?e:/kein regen|trocken|wolkenlos|klar|sonnig/.test(e)?"sunny":/gewitter|blitz/.test(e)?"lightning-rainy":/schneeregen/.test(e)?"snowy-rainy":/schnee/.test(e)?"snowy":/hagel/.test(e)?"hail":/starkregen/.test(e)?"pouring":/regen|niesel/.test(e)?"rainy":/nebel/.test(e)?"fog":/teil.*wolk|heiter|leicht.*wolk/.test(e)?"partlycloudy":/wolk|bedeckt/.test(e)?"cloudy":/wind|sturm/.test(e)?"windy":null}function li(n,e){if(!V(n))return n;let t=e.weather_variables??{};if(!e.rain_sensor&&!Object.values(t).some(d=>d&&d!=="none"))return n;let r=Pc.get(n)??new WeakMap;Pc.set(n,r);let i=r.get(e);if(i)return i;let o={friendly_name:"Wetter",nf_symcon_weather:!0},s=d=>t[d]&&t[d]!=="none"?n.states[t[d]]:void 0;for(let d of["temperature","humidity","pressure","cloud_coverage","precipitation","precipitation_total","illuminance","uv_index","visibility"]){let g=s(d),_=ge(g);_!==null&&(o[d]=d==="cloud_coverage"&&g?.attributes.symcon_max===1?_*100:_),g?.attributes.unit_of_measurement&&(o[`${d}_unit`]=g.attributes.unit_of_measurement)}for(let d of["wind_speed","wind_gust_speed"]){let g=s(d),_=ge(g);_!==null&&(o[d]=Xr(_,g?.attributes.unit_of_measurement))}o.wind_speed_unit="km/h";let a=fe(s("wind_bearing"));a!==null&&(o.wind_bearing=a);let l=jf(Fe(s("condition"))),u=e.rain_sensor?n.states[e.rain_sensor]:void 0,c=le(u);c!==null&&e.rain_sensor_inverted&&(c=!c),c===null&&typeof o.precipitation=="number"&&(c=o.precipitation>0),le(s("lightning"))?l=c?"lightning-rainy":"lightning":le(s("snow"))?l=c?"snowy-rainy":"snowy":le(s("fog"))?l="fog":c===!0?l=Number(o.precipitation??0)>=8?"pouring":"rainy":c===!1&&l&&/rain|pouring/.test(l)&&(l=null),!l&&typeof o.cloud_coverage=="number"&&(l=o.cloud_coverage>70?"cloudy":o.cloud_coverage>20?"partlycloudy":"sunny"),!l&&c===!1&&(l="sunny");let h={entity_id:Hc,state:l??"unknown",attributes:o},m={...n,states:{...n.states,[Hc]:h}};return r.set(e,m),m}var Xo=class extends Q{static properties={hass:{attribute:!1},floors:{attribute:!1},floorId:{attribute:!1},inline:{type:Boolean,reflect:!0},compact:{type:Boolean},folded:{state:!0}};constructor(){super(),this.floors=[],this.floorId=null,this.inline=!1,this.compact=!1,this.folded=null}value(e){return e?p`<span class="value" title=${`${Vt(e)}${e.manual?" \xB7 eigener Z\xE4hler":""}`}><b>${Ne(this.hass,e)}</b>${e.period!=="total"?p`<small>${{day:"heute",month:"Monat",year:"Jahr"}[e.period]}</small>`:f}${G(this.hass,e.sources,`${Ie[e.kind]} \xB7 ${Vt(e)}`)}</span>`:f}open(e,t){this.dispatchEvent(new CustomEvent("utility-open",{detail:{floorId:t?this.floorId:e,roomId:t?e:null},bubbles:!0,composed:!0}))}rows(e){return Oe.map(t=>{let r=e.filter(o=>o.kind===t&&o.metric==="power"),i=e.filter(o=>o.kind===t&&o.metric==="energy");return Array.from({length:Math.max(r.length,i.length)},(o,s)=>p`<div class="row"><span class="kind" title=${Ie[t]}>${s?"":`${$n[t]} ${Ie[t]}`}</span>${r[s]?this.value(r[s]):p`<span></span>`}${i[s]?this.value(i[s]):p`<span></span>`}</div>`)})}render(){if(!this.hass)return f;let e=this.floors.flatMap(s=>s.rooms),t=this.floors.find(s=>s.id===this.floorId);if(this.inline){let s=t?Ce(this.hass,t,e):Hl(this.hass,this.floors);return p`${Oe.map(a=>{let l=s.filter(u=>u.kind===a);return l.length?p`<div class="meter" aria-label=${`${t?.name||"Gesamtgeb\xE4ude"} \xB7 ${Ie[a]}`}><span class="medium" title=${t?.name||"Gesamtgeb\xE4ude"}>${$n[a]} ${Ie[a]}</span><div class="values">${l.map(u=>this.value(u))}</div></div>`:f})}`}let i=(t?Bt(this.hass,t,e,!0).map(s=>({...s,hasDetails:s.rooms.length>0})):[...this.floors].sort((s,a)=>a.elevation-s.elevation).map(s=>({id:s.id,name:s.name,path:"",readings:Ce(this.hass,s,e),rooms:[],hasDetails:Bt(this.hass,s,e,!0).length>0}))).filter(s=>s.readings.length||s.hasDetails);if(!i.lLine truncated
`]};function jf(n){let e=Math.min(1,Math.max(0,(n-2200)/4300)),t=(r,i)=>Math.round(r+(i-r)*e);return`rgb(${t(255,200)},${t(170,225)},${t(80,255)})`}customElements.get("nf-quick-menu")||customElements.define("nf-quick-menu",Jo);var qf=new URL(import.meta.url),Zf=new URL("./nextfloor-3d.js?v=d2200bd8fd8b",qf).href,Fc;function Hc(){return Fc??=import(Zf),Fc}function Pc(n){if(!n||n.state!=="on")return 0;let e=typeof n.attributes.percentage=="number"?n.attributes.percentage:60;return e<=0?0:.2+.6*Math.min(100,e)/100}var Ic="weather.nextfloor_symcon",Nc={condition:"Wetterzustand",temperature:"Au\xDFentemperatur",humidity:"Au\xDFenluftfeuchte",pressure:"Luftdruck",wind_speed:"Windgeschwindigkeit",wind_gust_speed:"Windb\xF6en",wind_bearing:"Windrichtung",cloud_coverage:"Bew\xF6lkung",precipitation:"Niederschlagsrate",precipitation_total:"Niederschlagsmenge",illuminance:"Au\xDFenhelligkeit",uv_index:"UV-Index",visibility:"Sichtweite",snow:"Schnee",fog:"Nebel",lightning:"Gewitter"},Cc=new WeakMap;function Yf(n){let e=n.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").trim();return["sunny","clear-night","partlycloudy","cloudy","fog","rainy","pouring","lightning-rainy","lightning","hail","snowy","snowy-rainy","windy","windy-variant"].includes(e)?e:/kein regen|trocken|wolkenlos|klar|sonnig/.test(e)?"sunny":/gewitter|blitz/.test(e)?"lightning-rainy":/schneeregen/.test(e)?"snowy-rainy":/schnee/.test(e)?"snowy":/hagel/.test(e)?"hail":/starkregen/.test(e)?"pouring":/regen|niesel/.test(e)?"rainy":/nebel/.test(e)?"fog":/teil.*wolk|heiter|leicht.*wolk/.test(e)?"partlycloudy":/wolk|bedeckt/.test(e)?"cloudy":/wind|sturm/.test(e)?"windy":null}function ui(n,e){if(!V(n))return n;let t=e.weather_variables??{};if(!e.rain_sensor&&!Object.values(t).some(d=>d&&d!=="none"))return n;let r=Cc.get(n)??new WeakMap;Cc.set(n,r);let i=r.get(e);if(i)return i;let o={friendly_name:"Wetter",nf_symcon_weather:!0},s=d=>t[d]&&t[d]!=="none"?n.states[t[d]]:void 0;for(let d of["temperature","humidity","pressure","cloud_coverage","precipitation","precipitation_total","illuminance","uv_index","visibility"]){let g=s(d),_=ge(g);_!==null&&(o[d]=d==="cloud_coverage"&&g?.attributes.symcon_max===1?_*100:_),g?.attributes.unit_of_measurement&&(o[`${d}_unit`]=g.attributes.unit_of_measurement)}for(let d of["wind_speed","wind_gust_speed"]){let g=s(d),_=ge(g);_!==null&&(o[d]=ei(_,g?.attributes.unit_of_measurement))}o.wind_speed_unit="km/h";let a=fe(s("wind_bearing"));a!==null&&(o.wind_bearing=a);let l=Yf(Fe(s("condition"))),u=e.rain_sensor?n.states[e.rain_sensor]:void 0,c=le(u);c!==null&&e.rain_sensor_inverted&&(c=!c),c===null&&typeof o.precipitation=="number"&&(c=o.precipitation>0),le(s("lightning"))?l=c?"lightning-rainy":"lightning":le(s("snow"))?l=c?"snowy-rainy":"snowy":le(s("fog"))?l="fog":c===!0?l=Number(o.precipitation??0)>=8?"pouring":"rainy":c===!1&&l&&/rain|pouring/.test(l)&&(l=null),!l&&typeof o.cloud_coverage=="number"&&(l=o.cloud_coverage>70?"cloudy":o.cloud_coverage>20?"partlycloudy":"sunny"),!l&&c===!1&&(l="sunny");let h={entity_id:Ic,state:l??"unknown",attributes:o},m={...n,states:{...n.states,[Ic]:h}};return r.set(e,m),m}var es=class extends Q{static properties={hass:{attribute:!1},floors:{attribute:!1},floorId:{attribute:!1},inline:{type:Boolean,reflect:!0},compact:{type:Boolean},folded:{state:!0}};constructor(){super(),this.floors=[],this.floorId=null,this.inline=!1,this.compact=!1,this.folded=null}value(e){return e?p`<span class="value" title=${`${Vt(e)}${e.manual?" \xB7 eigener Z\xE4hler":""}`}><b>${Ne(this.hass,e)}</b>${e.period!=="total"?p`<small>${{day:"heute",month:"Monat",year:"Jahr"}[e.period]}</small>`:f}${G(this.hass,e.sources,`${Ie[e.kind]} \xB7 ${Vt(e)}`)}</span>`:f}open(e,t){this.dispatchEvent(new CustomEvent("utility-open",{detail:{floorId:t?this.floorId:e,roomId:t?e:null},bubbles:!0,composed:!0}))}rows(e){return Oe.map(t=>{let r=e.filter(o=>o.kind===t&&o.metric==="power"),i=e.filter(o=>o.kind===t&&o.metric==="energy");return Array.from({length:Math.max(r.length,i.length)},(o,s)=>p`<div class="row"><span class="kind" title=${Ie[t]}>${s?"":`${Mn[t]} ${Ie[t]}`}</span>${r[s]?this.value(r[s]):p`<span></span>`}${i[s]?this.value(i[s]):p`<span></span>`}</div>`)})}render(){if(!this.hass)return f;let e=this.floors.flatMap(s=>s.rooms),t=this.floors.find(s=>s.id===this.floorId);if(this.inline){let s=t?Ce(this.hass,t,e):Il(this.hass,this.floors);return p`${Oe.map(a=>{let l=s.filter(u=>u.kind===a);return l.length?p`<div class="meter" aria-label=${`${t?.name||"Gesamtgeb\xE4ude"} \xB7 ${Ie[a]}`}><span class="medium" title=${t?.name||"Gesamtgeb\xE4ude"}>${Mn[a]} ${Ie[a]}</span><div class="values">${l.map(u=>this.value(u))}</div></div>`:f})}`}let i=(t?Bt(this.hass,t,e,!0).map(s=>({...s,hasDetails:s.rooms.length>0})):[...this.floors].sort((s,a)=>a.elevation-s.elevation).map(s=>({id:s.id,name:s.name,path:"",readings:Ce(this.hass,s,e),rooms:[],hasDetails:Bt(this.hass,s,e,!0).length>0}))).filter(s=>s.readings.length||s.hasDetails);if(!i.lLine truncated
<button class="heading" aria-expanded=${!o} @click=${()=>{this.folded=!o}}><span>${t?"Bereiche":"Stockwerke"}<small>${t?.name||"Gesamtgeb\xE4ude"}</small></span><span aria-hidden="true">${o?"+":"\u2212"}</span></button>
${o?f:p`<div class="entries"><div class="columns"><span></span><span title="Leistung bzw. Durchfluss">Leistung</span><span>Energie / Verbrauch</span></div>
${i.map(s=>p`<section class="entry" data-area=${t?s.id:f}>
@@ -1660,9 +1660,9 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.kind { color:var(--nf-muted); font-size:10px; white-space:nowrap; }
.row .value b { font-size:11px; font-weight:normal; }
@media(max-width:600px) { .entries { max-height:32vh; } }
`};customElements.get("nf-utility-overview")||customElements.define("nf-utility-overview",Xo);var Cc="image:";function es(n,e,t){let r=(e??"").trim();if(!r)return null;if(r.startsWith(Cc))return t(r.slice(Cc.length));if(/^(https?:\/\/|\/)/.test(r))return r;if(/^[a-z_]+\.[a-z0-9_]+$/.test(r)){let i=n?.states[r]?.attributes.entity_picture;return typeof i=="string"&&i?i:null}return null}var On=n=>Number(n);function Bn(n){if(Array.isArray(n)){let[o,s]=[On(n[0]),On(n[1])];return Number.isFinite(o)&&Number.isFinite(s)?[o,s]:null}if(!n||typeof n!="object")return null;let{x:e,y:t}=n,[r,i]=[On(e),On(t)];return Number.isFinite(r)&&Number.isFinite(i)?[r,i]:null}function Nc(n){return n?Bn(n.charger)??Bn(n.charger_position):null}function Lc(n){for(let[e,t]of Object.entries(n.states))if(e.startsWith("camera.")&&(Bn(t.attributes?.vacuum_position)??Nc(t.attributes)))return e;return null}var qf=n=>Array.isArray(n)?typeof n[0]=="number":!!n&&typeof n=="object",Wn=(n,e)=>e?[n[0],-n[1]]:n;function Zf(n){if(!n)return null;let e=n.mirror===!0,[t,r]=Wn(n.ga,e),[i,o]=Wn(n.gb,e),[s,a]=n.a,[l,u]=n.b,[c,h]=[i-t,o-r],[m,d]=[l-s,u-a],g=Math.hypot(c,h),_=Math.hypot(m,d);if(!(g>1e-6)||!(_>1e-6))return null;let b=_/g,v=Math.atan2(d,m)-Math.atan2(h,c),[S,k]=[Math.cos(v),Math.sin(v)];return M=>{let z=Wn(M,e),[R,F]=[z[0]-t,z[1]-r];return[s+b*(R*S-F*k),a+b*(R*k+F*S)]}}function Yf(n){if(!n)return null;let e=n.mirror===!0,[t,r]=Wn(n.ga,e),[i,o]=Wn(n.gb,e),s=Math.atan2(n.b[1]-n.a[1],n.b[0]-n.a[0])-Math.atan2(o-r,i-t);return Number.isFinite(s)?s:null}function Oc(n,e,t){if(!e)return null;let r=n.states[e]?.attributes;if(!r)return null;let i=Zf(t)??(g=>g),o=Yf(t)??0,s=t?.mirror===!0?-1:1,a=r.vacuum_position,l=Bn(a),u=l?(()=>{let[g,_]=i(l),b=On(a?.a)*s;if(!Number.isFinite(b))return{x:g,z:_,heading:0};let v=b*Math.PI/180+o;return{x:g,z:_,heading:Math.atan2(Math.cos(v),Math.sin(v))}})():null,c=Nc(r),h=Array.isArray(r.path)?r.path:[],m=h.length>0&&qf(h[0])?[h]:h,d=[];for(let g of m){let _=[];for(let b of Array.isArray(g)?g:[]){let v=Bn(b);v&&_.push(i(v))}_.length>1&&d.push(_)}return!u&&!c&&!d.length?null:{pose:u,charger:c?i(c):null,path:d}}var Wc="nextfloor.lock3d",Bc=520,ns=class extends Q{static properties={hass:{attribute:!1},building:{attribute:!1},floorId:{attribute:!1},roomId:{attribute:!1},wallMode:{attribute:!1},solidWalls:{attribute:!1},glassWalls:{attribute:!1},explode:{type:Boolean},keepRoof:{attribute:!1},markerMode:{attribute:!1},markerNames:{attribute:!1},markersOutside:{attribute:!1},tapInRoom:{type:Boolean},roomDoubleTap:{attribute:!1},heatMode:{attribute:!1},theme:{attribute:!1},accent:{attribute:!1},furnitureColors:{attribute:!1},packs:{attribute:!1},showEnergy:{attribute:!1},flows:{attribute:!1},holograms:{attribute:!1},furnish:{type:Boolean},surfaceGrab:{attribute:!1},furnishTypes:{attribute:!1},weather:{type:Boolean},weatherEntityId:{attribute:!1},weatherDensity:{attribute:!1},timeOfDay:{attribute:!1},selectedFurniture:{attribute:!1},selectedDevice:{attribute:!1},_sky:{state:!0},quality:{attribute:!1},showStats:{type:Boolean},_stats:{state:!0},_error:{state:!0},_energy:{state:!0},_flows:{state:!0},_liveEnergy:{state:!0},_liveCards:{state:!0},_liveCardOn:{state:!0},_houseFolded:{state:!0},_utilityOverviewVisible:{state:!0},_swipe:{state:!0},_menu:{state:!0},_pluginWindow:{state:!0},_plate:{state:!0},_blend:{state:!0},_wallBig:{state:!0},_find:{state:!0},_central:{state:!0},_thumbsCompact:{state:!0},_armed:{state:!0},central:{attribute:!1},centralOpen:{attribute:!1},keepCamera:{attribute:!1},plain:{attribute:!1},rightBack:{attribute:!1},templateName:{attribute:!1},readable:{type:Boolean,reflect:!0},today:{attribute:!1},_todayOpen:{state:!0},_todayItems:{state:!0},_forecast:{state:!0},zoom:{attribute:!1},buttons:{attribute:!1},_thumbs:{state:!0},floorThumbs:{attribute:!1},clean:{attribute:!1},cleanButton:{attribute:!1},clock:{attribute:!1},lockButton:{attribute:!1},walkButton:{attribute:!1},travelButton:{attribute:!1},_travel:{state:!0},_walking:{state:!0},_stick:{state:!0},_locked:{state:!0},_now:{state:!0},roomLabels:{attribute:!1},roomNamesButton:{attribute:!1},floorStack:{attribute:!1},panelOpen:{attribute:!1},alerts:{attribute:!1},alertJump:{attribute:!1},scenes:{attribute:!1},announcements:{attribute:!1},sensorBar:{attribute:!1},screenName:{attribute:!1},_announcement:{state:!0},dimmed:{attribute:!1},autoOrbit:{attribute:!1},startView:{attribute:!1},outsideOpen:{attribute:!1},_low:{state:!0},_narrowStage:{state:!0},_shortStage:{state:!0},_phoneStage:{state:!0},_alerts:{state:!0},_sceneFired:{state:!0}};stopAnnouncements=null;announceTimer;get liveCardsOn(){return this.holograms??this._liveCardOn}cloud=0;confirmSet=new Set;shownStartView;placementInfo=new Map;live=null;travelTimer;dayCurves=null;curvesAt=0;clockTimer;stopPlugins=null;pluginsDirty=!1;resizeObs=null;alertSrc=null;alertTimer;contactTimer;seenAlerts=new Set;roomFlash=null;findIndex=null;tintSig="";thumbTimer;thumbSig="";thumbsAt=0;armTimer;forecastAt=0;forecastKey Line truncated
`};customElements.get("nf-utility-overview")||customElements.define("nf-utility-overview",es);var Lc="image:";function ts(n,e,t){let r=(e??"").trim();if(!r)return null;if(r.startsWith(Lc))return t(r.slice(Lc.length));if(/^(https?:\/\/|\/)/.test(r))return r;if(/^[a-z_]+\.[a-z0-9_]+$/.test(r)){let i=n?.states[r]?.attributes.entity_picture;return typeof i=="string"&&i?i:null}return null}var Wn=n=>Number(n);function Vn(n){if(Array.isArray(n)){let[o,s]=[Wn(n[0]),Wn(n[1])];return Number.isFinite(o)&&Number.isFinite(s)?[o,s]:null}if(!n||typeof n!="object")return null;let{x:e,y:t}=n,[r,i]=[Wn(e),Wn(t)];return Number.isFinite(r)&&Number.isFinite(i)?[r,i]:null}function Oc(n){return n?Vn(n.charger)??Vn(n.charger_position):null}function Wc(n){for(let[e,t]of Object.entries(n.states))if(e.startsWith("camera.")&&(Vn(t.attributes?.vacuum_position)??Oc(t.attributes)))return e;return null}var Jf=n=>Array.isArray(n)?typeof n[0]=="number":!!n&&typeof n=="object",Bn=(n,e)=>e?[n[0],-n[1]]:n;function Qf(n){if(!n)return null;let e=n.mirror===!0,[t,r]=Bn(n.ga,e),[i,o]=Bn(n.gb,e),[s,a]=n.a,[l,u]=n.b,[c,h]=[i-t,o-r],[m,d]=[l-s,u-a],g=Math.hypot(c,h),_=Math.hypot(m,d);if(!(g>1e-6)||!(_>1e-6))return null;let b=_/g,v=Math.atan2(d,m)-Math.atan2(h,c),[S,k]=[Math.cos(v),Math.sin(v)];return M=>{let z=Bn(M,e),[R,F]=[z[0]-t,z[1]-r];return[s+b*(R*S-F*k),a+b*(R*k+F*S)]}}function Xf(n){if(!n)return null;let e=n.mirror===!0,[t,r]=Bn(n.ga,e),[i,o]=Bn(n.gb,e),s=Math.atan2(n.b[1]-n.a[1],n.b[0]-n.a[0])-Math.atan2(o-r,i-t);return Number.isFinite(s)?s:null}function Bc(n,e,t){if(!e)return null;let r=n.states[e]?.attributes;if(!r)return null;let i=Qf(t)??(g=>g),o=Xf(t)??0,s=t?.mirror===!0?-1:1,a=r.vacuum_position,l=Vn(a),u=l?(()=>{let[g,_]=i(l),b=Wn(a?.a)*s;if(!Number.isFinite(b))return{x:g,z:_,heading:0};let v=b*Math.PI/180+o;return{x:g,z:_,heading:Math.atan2(Math.cos(v),Math.sin(v))}})():null,c=Oc(r),h=Array.isArray(r.path)?r.path:[],m=h.length>0&&Jf(h[0])?[h]:h,d=[];for(let g of m){let _=[];for(let b of Array.isArray(g)?g:[]){let v=Vn(b);v&&_.push(i(v))}_.length>1&&d.push(_)}return!u&&!c&&!d.length?null:{pose:u,charger:c?i(c):null,path:d}}var Vc="nextfloor.lock3d",Kc=520,rs=class extends Q{static properties={hass:{attribute:!1},building:{attribute:!1},floorId:{attribute:!1},roomId:{attribute:!1},wallMode:{attribute:!1},solidWalls:{attribute:!1},glassWalls:{attribute:!1},explode:{type:Boolean},keepRoof:{attribute:!1},markerMode:{attribute:!1},markerNames:{attribute:!1},markersOutside:{attribute:!1},tapInRoom:{type:Boolean},roomDoubleTap:{attribute:!1},heatMode:{attribute:!1},theme:{attribute:!1},accent:{attribute:!1},furnitureColors:{attribute:!1},packs:{attribute:!1},showEnergy:{attribute:!1},flows:{attribute:!1},holograms:{attribute:!1},furnish:{type:Boolean},surfaceGrab:{attribute:!1},furnishTypes:{attribute:!1},weather:{type:Boolean},weatherEntityId:{attribute:!1},weatherDensity:{attribute:!1},timeOfDay:{attribute:!1},selectedFurniture:{attribute:!1},selectedDevice:{attribute:!1},_sky:{state:!0},quality:{attribute:!1},showStats:{type:Boolean},_stats:{state:!0},_error:{state:!0},_energy:{state:!0},_flows:{state:!0},_liveEnergy:{state:!0},_liveCards:{state:!0},_liveCardOn:{state:!0},_houseFolded:{state:!0},_utilityOverviewVisible:{state:!0},_swipe:{state:!0},_menu:{state:!0},_pluginWindow:{state:!0},_plate:{state:!0},_blend:{state:!0},_wallBig:{state:!0},_find:{state:!0},_central:{state:!0},_thumbsCompact:{state:!0},_armed:{state:!0},central:{attribute:!1},centralOpen:{attribute:!1},keepCamera:{attribute:!1},plain:{attribute:!1},rightBack:{attribute:!1},templateName:{attribute:!1},readable:{type:Boolean,reflect:!0},today:{attribute:!1},_todayOpen:{state:!0},_todayItems:{state:!0},_forecast:{state:!0},zoom:{attribute:!1},buttons:{attribute:!1},_thumbs:{state:!0},floorThumbs:{attribute:!1},clean:{attribute:!1},cleanButton:{attribute:!1},clock:{attribute:!1},lockButton:{attribute:!1},walkButton:{attribute:!1},travelButton:{attribute:!1},_travel:{state:!0},_walking:{state:!0},_stick:{state:!0},_locked:{state:!0},_now:{state:!0},roomLabels:{attribute:!1},roomNamesButton:{attribute:!1},floorStack:{attribute:!1},panelOpen:{attribute:!1},alerts:{attribute:!1},alertJump:{attribute:!1},scenes:{attribute:!1},announcements:{attribute:!1},sensorBar:{attribute:!1},screenName:{attribute:!1},_announcement:{state:!0},dimmed:{attribute:!1},autoOrbit:{attribute:!1},startView:{attribute:!1},outsideOpen:{attribute:!1},_low:{state:!0},_narrowStage:{state:!0},_shortStage:{state:!0},_phoneStage:{state:!0},_alerts:{state:!0},_sceneFired:{state:!0}};stopAnnouncements=null;announceTimer;get liveCardsOn(){return this.holograms??this._liveCardOn}cloud=0;confirmSet=new Set;shownStartView;placementInfo=new Map;live=null;travelTimer;dayCurves=null;curvesAt=0;clockTimer;stopPlugins=null;pluginsDirty=!1;resizeObs=null;alertSrc=null;alertTimer;contactTimer;seenAlerts=new Set;roomFlash=null;findIndex=null;tintSig="";thumbTimer;thumbSig="";thumbsAt=0;armTimer;forecastAt=0;forecastKey Line truncated
${e.map(t=>p`<button class="nf-chip" aria-pressed=${!this.hiddenLayers.has(t.id)} @click=${()=>this.toggleLayer(t.id)}>${this.hiddenLayers.has(t.id)?"\u25CC":"\u{1F441}"} ${t.name}</button>`)}
</div>`}syncDevices(e){let t=this.viewer,r=this.building;if(!t||!r||!this.hass)return;let i=this._travel,o=i&&!i.loading?Ut(this.hass,i.history,i.t):this.hass;if((e||!this.openingLinks||this.linkedRegistry!==o.entities)&&(this.openingLinks=Be(o,r.floors),this.furnitureLinks=Ke(o,r.floors),this.linkedRegistry=o.entities,this.findIndex=null,this.alertSrc=this.alerts?Au(o,r,this.weatherEntityId,this.openingLinks):null,this.watched=Hu({hass:o,building:r,openingLinks:this.openingLinks,furnitureLinks:this.furnitureLinks,needsRoomSensors:this.heatMode!=="none"||this.roomLabels,alertSources:this.alertSrc,weatherEntityId:this.weatherEntityId}),e=!0),!(e||this.watched.some(y=>this.shownStates.get(y)!==o.states[y])))return;so(o,r).join(",")!==this.shownFor?.key&&t.setBuilding(this.shownBuilding(o)),this.shownStates=new Map(this.watched.map(y=>[y,o.states[y]])),this.syncHydronics(t,r,o),this.refreshToday(r),this.refreshForecast(r);let a=kn(o,r),l=Qa(o,r.floors.some(y=>y.layer&&this.hiddenLayers.has(y.id))?this.shownBuilding(o):r);this.placementInfo=new Map(l.map(y=>[y.id,{floorId:y.floorId,roomId:y.roomId,x:y.x,z:y.z,y:y.y,rotation:y.rotation??0}]));let u=this.furnitureMarkers(o,r,new Set(l.map(y=>y.id)),new Set(a.map(y=>y.powerEntity)));a.push(...u.consumers);let c=Sn(o,r,a,Ze(r,y=>this.furnitureLinks?.get(y.id)?.power??null)),h=new Map(a.filter(y=>y.id!==y.powerEntity).map(y=>[y.id,y.power]));this.confirmSet=bt(o,r.floors);let m=new Set(this.liveCardsOn?this._liveCards.flatMap(y=>y.kind==="media"?[y.media.entity]:y.kind==="car"?[y.spot]:[]):[]);for(let y of r.floors)for(let x of y.outdoor??[]){if(!x.area_id&&!x.temp_entity&&!x.pump_entity)continue;let B=x.temp_entity?o.states[x.temp_entity]:void 0,D=x.pump_entity?o.states[x.pump_entity]:void 0,[W,_e]=Te(x.points),ut=B&&Number.isFinite(Number(B.state))?`${L(o,ue(o,mr(Number(B.state),B.attributes.unit_of_measurement)),1)} ${re(o)}`:"",$t=!!D&&te(D);l.push({id:x.area_id?`outdoor:${x.id}`:x.pump_entity??x.temp_entity,floorId:y.id,roomId:null,x:W,z:_e,y:ar(y,x,W,_e)+.7,icon:De(x.type==="pool"?"pool":x.type==="terrace"?"table-chair":"tree-outline"),name:x.area_id&&o.areas?.[x.area_id]?.name||$(o,`out_${x.type}`),text:[ut,$t?$(o,"pool_pump_on"):""].filter(Boolean).join(" \xB7 "),active:$t,unavailable:!1,glow:null,show:"always"})}let d=new Map;for(let y of r.floors){for(let x of y.placements)x.pin_offset&&d.set(`${y.id}:${x.entity_id}`,x.pin_offset);for(let x of y.furniture)x.pin_offset&&d.set(`f:${x.id}`,x.pin_offset)}let g=y=>{let x=y.lamp?void 0:(y.furnitureId?d.get(`f:${y.furnitureId}`):void 0)??d.get(`${y.floorId}:${y.id}`);return x?{...y,x:y.x+(x.x??0),z:y.z+(x.z??0),y:y.y+(x.y??0)}:y};t.setDevices([...[...l,...u.markers].map(g).map(y=>{let x=y.show==="no_power"||"energyDevice"in y&&y.energyDevice?null:h.get(y.id)??null,B={...y,power:x,powerText:x===null?void 0:he(o,x),effect:this.dimmed?void 0:y.effect,text:this.subMeterText(o,r,c,y.furnitureId)??y.text},D=y.ownName&&(y.showName||this.markerNames)?y.ownName:"",W=m.has(y.id)||!!y.furnitureId&&m.has(y.furnitureId);return{...B,pin:this.showPin(B)&&!W,full:y.show==="always",caption:D}})]),t.setPickTargets(u.targets,this.openingTargets(),this.secondBlinds()),t.setScreens(u.screens),t.setFridgeDoors(Fa(o,r.floors)),t.setCovers(Ka(o,r)),t.setRobots(this.robotInfos(o,r));let _=new Map;for(let y of r.floors)for(let x of y.furniture)!X(x.type)?.pet||!x.room_sensor||x.room_sensor==="none"||_.set(x.id,ji(o,y.rooms.filter(B=>B.points.length>=3),null,x.room_sensor)?.id??null);_.size&&t.setPetRooms(_),t.setRoofWindows(xu(o,r)),t.setParked(To(o,r)),t.setGateStates(Ou(o,r));let b=new Map(r.floors.flatMap(y=>y.openings.map(x=>[x.id,x.type]))),v=new Map([...this.openingLinks].map(([y,x])=>[y,Ve(o,x,b.get(y))]));t.setOpeningStates(v),this.setAlerts(this.alertSrc?Eo(o,r,this.alertSrc,this.openingLinks):[]),this.watchLostContacts(o);let S=[...l,...u.markers].map(y=>`${y.id}:${y.glow?`${y.glow.level.toFixed(1)}/${y.glow.color.map(x=>x.toFixed(1)).join("/")}`:0}`).join(";")+"|"+[...v].map(([y,x])=>`${y}:${x.open}:${x.cover===null?"-":x.cover.toFixed(1)}`).join(";");if(S!==this.thumbSig){let y=this.thumbSig==="";this.thumbSig=S,y||this.scheduleThumbs(1500)}let k=ec(o,r,a,r.energy.advanced?y=>this.furnitureLinks?.get(y.id)?.power??null:void 0),M=this.liveCars(o,r);for(let y of M){if(!y.car.home||!y.car.charging&&!y.car.plugged)continue;let x=r.floors.flatMap(W=>W.furniture.filter(_e=>_e.type==="wallbox").map(_e=>({floorId:W.id,x:_e.x,z:_e.z,y:1}))).sort((W,_e)=>Math.hypot(W.x-y.at.x,W.z-y.at.z)-Math.hypot(_e.x-y.at.x,_e.z-y.at.z))[0],B=x&&x.floorId===y.at.floorId&&Math.hypot(x.x-y.at.x,x.z-y.at.z)<9,D=x??In(r);!D||!y.car.charging&&!B||k.arcs.push({key:`car:${y.spot}`,from:D,to:{...y.at,y:.8},power:y.car.charging?y.car.chargingW??7e3:0,color:[80,175,255],...B?{via:[{...D,y:.35},{floorId:y.at.floorId,x:(D.x+y.at.x)/2,z:(D.z+y.at.z)/2,y:.08},{...y.at,y:.5}],cable:!0}:{}})}let z=In(r);for(let y of this.liveHeatPumps(r)){let x=y.pump.heat??(y.Line truncated
</div>`}syncDevices(e){let t=this.viewer,r=this.building;if(!t||!r||!this.hass)return;let i=this._travel,o=i&&!i.loading?Ut(this.hass,i.history,i.t):this.hass;if((e||!this.openingLinks||this.linkedRegistry!==o.entities)&&(this.openingLinks=Be(o,r.floors),this.furnitureLinks=Ke(o,r.floors),this.linkedRegistry=o.entities,this.findIndex=null,this.alertSrc=this.alerts?Ru(o,r,this.weatherEntityId,this.openingLinks):null,this.watched=Iu({hass:o,building:r,openingLinks:this.openingLinks,furnitureLinks:this.furnitureLinks,needsRoomSensors:this.heatMode!=="none"||this.roomLabels,alertSources:this.alertSrc,weatherEntityId:this.weatherEntityId}),e=!0),!(e||this.watched.some(y=>this.shownStates.get(y)!==o.states[y])))return;ao(o,r).join(",")!==this.shownFor?.key&&t.setBuilding(this.shownBuilding(o)),this.shownStates=new Map(this.watched.map(y=>[y,o.states[y]])),this.syncHydronics(t,r,o),this.refreshToday(r),this.refreshForecast(r);let a=kn(o,r),l=Xa(o,r.floors.some(y=>y.layer&&this.hiddenLayers.has(y.id))?this.shownBuilding(o):r);this.placementInfo=new Map(l.map(y=>[y.id,{floorId:y.floorId,roomId:y.roomId,x:y.x,z:y.z,y:y.y,rotation:y.rotation??0}]));let u=this.furnitureMarkers(o,r,new Set(l.map(y=>y.id)),new Set(a.map(y=>y.powerEntity)));a.push(...u.consumers);let c=Sn(o,r,a,Ze(r,y=>this.furnitureLinks?.get(y.id)?.power??null)),h=new Map(a.filter(y=>y.id!==y.powerEntity).map(y=>[y.id,y.power]));this.confirmSet=bt(o,r.floors);let m=new Set(this.liveCardsOn?this._liveCards.flatMap(y=>y.kind==="media"?[y.media.entity]:y.kind==="car"?[y.spot]:[]):[]);for(let y of r.floors)for(let x of y.outdoor??[]){if(!x.area_id&&!x.temp_entity&&!x.pump_entity)continue;let B=x.temp_entity?o.states[x.temp_entity]:void 0,D=x.pump_entity?o.states[x.pump_entity]:void 0,[W,_e]=Te(x.points),ut=B&&Number.isFinite(Number(B.state))?`${L(o,ue(o,pr(Number(B.state),B.attributes.unit_of_measurement)),1)} ${re(o)}`:"",$t=!!D&&te(D);l.push({id:x.area_id?`outdoor:${x.id}`:x.pump_entity??x.temp_entity,floorId:y.id,roomId:null,x:W,z:_e,y:lr(y,x,W,_e)+.7,icon:De(x.type==="pool"?"pool":x.type==="terrace"?"table-chair":"tree-outline"),name:x.area_id&&o.areas?.[x.area_id]?.name||$(o,`out_${x.type}`),text:[ut,$t?$(o,"pool_pump_on"):""].filter(Boolean).join(" \xB7 "),active:$t,unavailable:!1,glow:null,show:"always"})}let d=new Map;for(let y of r.floors){for(let x of y.placements)x.pin_offset&&d.set(`${y.id}:${x.entity_id}`,x.pin_offset);for(let x of y.furniture)x.pin_offset&&d.set(`f:${x.id}`,x.pin_offset)}let g=y=>{let x=y.lamp?void 0:(y.furnitureId?d.get(`f:${y.furnitureId}`):void 0)??d.get(`${y.floorId}:${y.id}`);return x?{...y,x:y.x+(x.x??0),z:y.z+(x.z??0),y:y.y+(x.y??0)}:y};t.setDevices([...[...l,...u.markers].map(g).map(y=>{let x=y.show==="no_power"||"energyDevice"in y&&y.energyDevice?null:h.get(y.id)??null,B={...y,power:x,powerText:x===null?void 0:he(o,x),effect:this.dimmed?void 0:y.effect,text:this.subMeterText(o,r,c,y.furnitureId)??y.text},D=y.ownName&&(y.showName||this.markerNames)?y.ownName:"",W=m.has(y.id)||!!y.furnitureId&&m.has(y.furnitureId);return{...B,pin:this.showPin(B)&&!W,full:y.show==="always",caption:D}})]),t.setPickTargets(u.targets,this.openingTargets(),this.secondBlinds()),t.setScreens(u.screens),t.setFridgeDoors(Ha(o,r.floors)),t.setCovers(Ga(o,r)),t.setRobots(this.robotInfos(o,r));let _=new Map;for(let y of r.floors)for(let x of y.furniture)!X(x.type)?.pet||!x.room_sensor||x.room_sensor==="none"||_.set(x.id,qi(o,y.rooms.filter(B=>B.points.length>=3),null,x.room_sensor)?.id??null);_.size&&t.setPetRooms(_),t.setRoofWindows(Su(o,r)),t.setParked(Do(o,r)),t.setGateStates(Bu(o,r));let b=new Map(r.floors.flatMap(y=>y.openings.map(x=>[x.id,x.type]))),v=new Map([...this.openingLinks].map(([y,x])=>[y,Ve(o,x,b.get(y))]));t.setOpeningStates(v),this.setAlerts(this.alertSrc?Ro(o,r,this.alertSrc,this.openingLinks):[]),this.watchLostContacts(o);let S=[...l,...u.markers].map(y=>`${y.id}:${y.glow?`${y.glow.level.toFixed(1)}/${y.glow.color.map(x=>x.toFixed(1)).join("/")}`:0}`).join(";")+"|"+[...v].map(([y,x])=>`${y}:${x.open}:${x.cover===null?"-":x.cover.toFixed(1)}`).join(";");if(S!==this.thumbSig){let y=this.thumbSig==="";this.thumbSig=S,y||this.scheduleThumbs(1500)}let k=nc(o,r,a,r.energy.advanced?y=>this.furnitureLinks?.get(y.id)?.power??null:void 0),M=this.liveCars(o,r);for(let y of M){if(!y.car.home||!y.car.charging&&!y.car.plugged)continue;let x=r.floors.flatMap(W=>W.furniture.filter(_e=>_e.type==="wallbox").map(_e=>({floorId:W.id,x:_e.x,z:_e.z,y:1}))).sort((W,_e)=>Math.hypot(W.x-y.at.x,W.z-y.at.z)-Math.hypot(_e.x-y.at.x,_e.z-y.at.z))[0],B=x&&x.floorId===y.at.floorId&&Math.hypot(x.x-y.at.x,x.z-y.at.z)<9,D=x??Cn(r);!D||!y.car.charging&&!B||k.arcs.push({key:`car:${y.spot}`,from:D,to:{...y.at,y:.8},power:y.car.charging?y.car.chargingW??7e3:0,color:[80,175,255],...B?{via:[{...D,y:.35},{floorId:y.at.floorId,x:(D.x+y.at.x)/2,z:(D.z+y.at.z)/2,y:.08},{...y.at,y:.5}],cable:!0}:{}})}let z=Cn(r);for(let y of this.liveHeatPumps(r)){let x=y.pump.heat??(y.Line truncated
<button class="nf-thumbs-fold" title=${$(this.hass,r?"thumbs_show":"thumbs_fold")} aria-label=${$(this.hass,r?"thumbs_show":"thumbs_fold")} @click=${i}>${r?"\u25B8":"\u25C2"}</button>
<button class="nf-thumb nf-thumb-house" aria-pressed=${this.floorId===null} @click=${()=>this.fire("floor-tap",{floorId:null})}>
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"><path d="M3 11l9-7 9 7M5 10v10h14V10" /></svg>
@@ -1672,16 +1672,16 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${r?f:p`<img src=${o.url} alt="" />`}
<span>${e.get(o.floorId)??""}</span>
</button>`)}
</nav>`}onDeviceHold(e,t,r){let i=P(e);i==="light"||i==="cover"||i==="switch"||i==="fan"||i==="lock"?this._menu={entity:e,x:t,y:r}:ke(this,e)}onDeviceSwipe(e,t,r,i,o){let s=this.hass?.states[e];if(t==="start"){if(!s||C(s)||this.confirmSet.has(e))return!1;let l=P(e);if(l==="light"&&Jo(s).dim){let u=s.state==="on"?typeof s.attributes.brightness=="number"?Math.round(s.attributes.brightness/2.55):100:0;return this._swipe={entity:e,kind:"light",start:u,value:u,x:i,y:o},!0}if(l==="fan"&&typeof s.attributes.percentage_step=="number"){let u=s.state==="on"&&typeof s.attributes.percentage=="number"?s.attributes.percentage:0;return this._swipe={entity:e,kind:"fan",start:u,value:u,x:i,y:o},!0}if(l==="cover"&&Qo(s)){let u=s.attributes.current_position;return this._swipe={entity:e,kind:"cover",start:u,value:u,x:i,y:o},!0}return!1}let a=this._swipe;if(!a||a.entity!==e)return!1;if(t==="move"){let l=Math.round(Math.min(100,Math.max(0,a.start-r/220*100)));l!==a.value&&(this._swipe={...a,value:l});let u=performance.now();u-this.swipeSent>350&&(this.swipeSent=u,this.applySwipe())}else this.applySwipe(),clearTimeout(this.swipeTimer),this.swipeTimer=setTimeout(()=>this._swipe=null,700);return!0}applySwipe(){let e=this._swipe;!e||!this.hass||(e.kind==="light"?e.value<=0?this.hass.callService("light","turn_off",{entity_id:e.entity}):this.hass.callService("light","turn_on",{entity_id:e.entity,brightness_pct:e.value}):e.kind==="fan"?e.value<=0?this.hass.callService("fan","turn_off",{entity_id:e.entity}):this.hass.callService("fan","set_percentage",{entity_id:e.entity,percentage:e.value}):this.hass.callService("cover","set_cover_position",{entity_id:e.entity,position:e.value}))}openRoom(e,t){this.floorId===e&&this.roomId===t||(this.floorId!==e?(this.fire("floor-tap",{floorId:e}),setTimeout(()=>this.fire("room-tap",{floorId:e,roomId:t}),60)):this.fire("room-tap",{floorId:e,roomId:t}))}goTo(e){if(this._find=null,e.kind==="room"||e.kind==="circuit"){e.roomId&&this.openRoom(e.floorId,e.roomId);return}this.floorId!==e.floorId&&this.fire("floor-tap",{floorId:e.floorId}),setTimeout(()=>this.viewer?.focus(e.floorId,e.x,e.z,e.y,e.entity),120)}listenToAnnouncements(e){if(!e){this.stopAnnouncements?.(),this.stopAnnouncements=null,clearTimeout(this.announceTimer);return}if(this.stopAnnouncements)return;let t=!1;this.stopAnnouncements=()=>t=!0,al(this.hass,r=>this.announce(r)).then(r=>{t?r():this.stopAnnouncements=r})}announce(e){let t=e;if(t?.reload===!0){(!t.template||t.template===this.templateName)&&setTimeout(()=>location.reload(),500+Math.random()*6e3);return}if(typeof e?.message!="string"||!e.message.trim()||!rl(e,this.screenName)||!il(e))return;let r=ol(e.message);this._announcement={message:e.message,until:Date.now()+r},clearTimeout(this.announceTimer),this.announceTimer=setTimeout(()=>this._announcement=null,r),sl(this.hass,e)}renderAnnouncement(){let e=this._announcement;return e?p`<button class="nf-announcement" role="alert" title=${$(this.hass,"close")} @click=${()=>this._announcement=null}>
</nav>`}onDeviceHold(e,t,r){let i=P(e);i==="light"||i==="cover"||i==="switch"||i==="fan"||i==="lock"?this._menu={entity:e,x:t,y:r}:ke(this,e)}onDeviceSwipe(e,t,r,i,o){let s=this.hass?.states[e];if(t==="start"){if(!s||C(s)||this.confirmSet.has(e))return!1;let l=P(e);if(l==="light"&&Qo(s).dim){let u=s.state==="on"?typeof s.attributes.brightness=="number"?Math.round(s.attributes.brightness/2.55):100:0;return this._swipe={entity:e,kind:"light",start:u,value:u,x:i,y:o},!0}if(l==="fan"&&typeof s.attributes.percentage_step=="number"){let u=s.state==="on"&&typeof s.attributes.percentage=="number"?s.attributes.percentage:0;return this._swipe={entity:e,kind:"fan",start:u,value:u,x:i,y:o},!0}if(l==="cover"&&Xo(s)){let u=s.attributes.current_position;return this._swipe={entity:e,kind:"cover",start:u,value:u,x:i,y:o},!0}return!1}let a=this._swipe;if(!a||a.entity!==e)return!1;if(t==="move"){let l=Math.round(Math.min(100,Math.max(0,a.start-r/220*100)));l!==a.value&&(this._swipe={...a,value:l});let u=performance.now();u-this.swipeSent>350&&(this.swipeSent=u,this.applySwipe())}else this.applySwipe(),clearTimeout(this.swipeTimer),this.swipeTimer=setTimeout(()=>this._swipe=null,700);return!0}applySwipe(){let e=this._swipe;!e||!this.hass||(e.kind==="light"?e.value<=0?this.hass.callService("light","turn_off",{entity_id:e.entity}):this.hass.callService("light","turn_on",{entity_id:e.entity,brightness_pct:e.value}):e.kind==="fan"?e.value<=0?this.hass.callService("fan","turn_off",{entity_id:e.entity}):this.hass.callService("fan","set_percentage",{entity_id:e.entity,percentage:e.value}):this.hass.callService("cover","set_cover_position",{entity_id:e.entity,position:e.value}))}openRoom(e,t){this.floorId===e&&this.roomId===t||(this.floorId!==e?(this.fire("floor-tap",{floorId:e}),setTimeout(()=>this.fire("room-tap",{floorId:e,roomId:t}),60)):this.fire("room-tap",{floorId:e,roomId:t}))}goTo(e){if(this._find=null,e.kind==="room"||e.kind==="circuit"){e.roomId&&this.openRoom(e.floorId,e.roomId);return}this.floorId!==e.floorId&&this.fire("floor-tap",{floorId:e.floorId}),setTimeout(()=>this.viewer?.focus(e.floorId,e.x,e.z,e.y,e.entity),120)}listenToAnnouncements(e){if(!e){this.stopAnnouncements?.(),this.stopAnnouncements=null,clearTimeout(this.announceTimer);return}if(this.stopAnnouncements)return;let t=!1;this.stopAnnouncements=()=>t=!0,ll(this.hass,r=>this.announce(r)).then(r=>{t?r():this.stopAnnouncements=r})}announce(e){let t=e;if(t?.reload===!0){(!t.template||t.template===this.templateName)&&setTimeout(()=>location.reload(),500+Math.random()*6e3);return}if(typeof e?.message!="string"||!e.message.trim()||!il(e,this.screenName)||!ol(e))return;let r=sl(e.message);this._announcement={message:e.message,until:Date.now()+r},clearTimeout(this.announceTimer),this.announceTimer=setTimeout(()=>this._announcement=null,r),al(this.hass,e)}renderAnnouncement(){let e=this._announcement;return e?p`<button class="nf-announcement" role="alert" title=${$(this.hass,"close")} @click=${()=>this._announcement=null}>
<span class="nf-announcement-icon" aria-hidden="true">📢</span><span class="nf-announcement-text">${e.message}</span>
</button>`:f}renderAlerts(){let e=this.building;if(!this._alerts.length||!e)return f;let t=this._alerts.slice(0,3);return p`<div class="nf-alert-banner" role="alert">
${t.map(r=>p`<button class="nf-alert nf-alert-${r.kind}" style=${r.color?`border-left-color:${r.color}`:""} title=${Ro(this.hass,e,r)} @click=${()=>this.jumpTo(r)}>${Ro(this.hass,e,r)}</button>`)}
${t.map(r=>p`<button class="nf-alert nf-alert-${r.kind}" style=${r.color?`border-left-color:${r.color}`:""} title=${zo(this.hass,e,r)} @click=${()=>this.jumpTo(r)}>${zo(this.hass,e,r)}</button>`)}
${this._alerts.length>3?p`<span class="nf-alert-more">+${this._alerts.length-3}</span>`:f}
</div>`}renderScenes(){let e=this.building;if(!this.scenes||!this.roomId||this.panelOpen||!e||!this.hass)return f;let t=e.floors.flatMap(o=>o.rooms).find(o=>o.id===this.roomId),r=t?U(this.hass,t).filter(o=>P(o)==="scene"||P(o)==="script").slice(0,6):[];if(!r.length)return f;let i=t?.area_id?this.hass.areas?.[t.area_id]?.name:void 0;return p`<div class="nf-scenes">
${r.map(o=>p`<button class="nf-chip" aria-pressed=${this._sceneFired===o} @click=${()=>this.runScene(o)}>${O(this.hass,o,i)}</button>`)}
</div>`}renderFind(){let e=this.building;if(!e||!this.hass)return f;if(this._find===null)return p`<button class="nf-find-btn" title=${$(this.hass,"find")} aria-label=${$(this.hass,"find")} @click=${()=>this._find=""}>
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="6.5" /><path d="M16 16l4.5 4.5" /></svg>
</button>`;let t=Ec(this.findIndex??=Ac(this.hass,e),this._find);return p`<div class="nf-find">
</button>`;let t=zc(this.findIndex??=Rc(this.hass,e),this._find);return p`<div class="nf-find">
<input
type="search"
placeholder=${$(this.hass,"find_placeholder")}
@@ -1692,7 +1692,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
<button class="nf-find-close" aria-label=${$(this.hass,"close")} @click=${()=>this._find=null}>✕</button>
${this._find.trim()?p`<div class="nf-find-list">
${t.length?t.map(r=>p`<button @click=${()=>this.goTo(r)}>
<span class="nf-find-icon"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d=${r.icon?$r(r.icon):"M4 10l8-6 8 6v10H4z"} /></svg></span>
<span class="nf-find-icon"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d=${r.icon?Mr(r.icon):"M4 10l8-6 8 6v10H4z"} /></svg></span>
<span><b>${r.name}</b>${r.where?p`<small>${r.where}</small>`:f}</span>
</button>`):p`<p>${$(this.hass,"find_none")}</p>`}
</div>`:f}
@@ -1704,7 +1704,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
@click=${()=>{this._central=!this._central,this._armed=null}}
>
<svg viewBox="0 0 24 24" width="19" height="19" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linejoin="round"><path d="M12 3.5l2.6 5.3 5.9.9-4.3 4.1 1 5.8L12 16.9l-5.2 2.7 1-5.8-4.3-4.1 5.9-.9z" /></svg>
</button>`;if(!this._central)return i;let o=this.floorId?e.floors.find(b=>b.id===this.floorId):void 0,s=o?[o]:e.floors,a=s.flatMap(b=>qi(t,b).lights),l=s.flatMap(b=>qi(t,b).covers),u=a.filter(b=>t.states[b]?.state==="on").length,c=!o,h=(b,v,S,k)=>{if(k.length){if(c&&this._armed!==b){this._armed=b,clearTimeout(this.armTimer),this.armTimer=setTimeout(()=>this._armed=null,3500);return}this._armed=null,t.callService(v,S,{entity_id:k})}},m=(b,v,S,k,M)=>p`<button class="nf-btn ${this._armed===b?"nf-central-armed":""}" ?disabled=${!M.length} @click=${()=>h(b,S,k,M)}>
</button>`;if(!this._central)return i;let o=this.floorId?e.floors.find(b=>b.id===this.floorId):void 0,s=o?[o]:e.floors,a=s.flatMap(b=>Zi(t,b).lights),l=s.flatMap(b=>Zi(t,b).covers),u=a.filter(b=>t.states[b]?.state==="on").length,c=!o,h=(b,v,S,k)=>{if(k.length){if(c&&this._armed!==b){this._armed=b,clearTimeout(this.armTimer),this.armTimer=setTimeout(()=>this._armed=null,3500);return}this._armed=null,t.callService(v,S,{entity_id:k})}},m=(b,v,S,k,M)=>p`<button class="nf-btn ${this._armed===b?"nf-central-armed":""}" ?disabled=${!M.length} @click=${()=>h(b,S,k,M)}>
${this._armed===b?r("central_sure"):r(v)}
</button>`,d=e.settings.favorite_floors??{},g=(e.settings.favorites??[]).filter(b=>t.states[b]&&(!d[b]||!o||d[b]===o.id)),_=this.buttons??e.settings.buttons??[];return p`${i}
<div class="nf-central ${this.centralOpen?"nf-central-big":""}" role="dialog" aria-label=${r("central")}>
@@ -1721,7 +1721,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
</div>`:f}
<b>${r("central_favorites")}</b>
${g.length?p`<div class="nf-central-favs">
${g.map(b=>{let[v,S]=Na(b),k=t.states[b],M=v==="homeassistant"&&k?.state==="on";return p`<button
${g.map(b=>{let[v,S]=La(b),k=t.states[b],M=v==="homeassistant"&&k?.state==="on";return p`<button
class="nf-chip"
aria-pressed=${M||this._sceneFired===b}
?disabled=${C(k)}
@@ -1733,13 +1733,13 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${_.length?p`<div class="nf-central-favs">
${_.map(b=>p`<button
class="nf-chip nf-own-btn"
aria-pressed=${La(t,b)}
@click=${v=>{Zi(t,v.currentTarget,b),b.action!=="service"&&(this._central=!1)}}
aria-pressed=${Oa(t,b)}
@click=${v=>{Yi(t,v.currentTarget,b),b.action!=="service"&&(this._central=!1)}}
>
${b.icon?p`<ha-icon .icon=${b.icon.startsWith("mdi:")?b.icon:`mdi:${b.icon}`}></ha-icon>`:f}${b.label}
</button>`)}
</div>`:f}
</div>`}toggleLock(){this._locked=!this._locked;try{localStorage.setItem(Wc,this._locked?"1":"0")}catch{}}async openTravel(e){if(clearInterval(this.travelTimer),this.travelTimer=void 0,e===null||!this.hass){this._travel=null,this.syncDevices(!0);return}let t=Date.now(),r=t-e*36e5;this._travel={history:new Map,from:r,to:t,t:r,playing:!1,speed:e>24?3600:600,hours:e,moments:[],loading:!0};try{let i=await En(this.hass,lu(this.watched),r,t);if(!this._travel||this._travel.from!==r)return;this._travel={...this._travel,history:i,moments:uu(i,r,t),loading:!1}}catch{this._travel=null,this._error=$(this.hass,"travel_failed");return}this.syncDevices(!0)}travelTo(e){let t=this._travel;t&&(this._travel={...t,t:Math.min(t.to,Math.max(t.from,e))},this.syncDevices(!0))}playTravel(e){let t=this._travel;t&&(clearInterval(this.travelTimer),this.travelTimer=void 0,this._travel={...t,playing:e,t:e&&t.t>=t.to?t.from:t.t},e&&(this.travelTimer=setInterval(()=>{let r=this._travel;if(!r)return;let i=r.t+250*r.speed;i>=r.to&&this.playTravel(!1),this.travelTo(i)},250)))}renderTravel(){if(!this.hass||this.clean)return f;let e=a=>$(this.hass,a),t=this._travel;if(!t)return this.travelButton?p`<button class="nf-travel-btn" title=${e("travel")} aria-label=${e("travel")} @click=${()=>{this.openTravel(24)}}>⏪</button>`:f;let r=this.hass.language??navigator.language,i=new Intl.DateTimeFormat(r,{weekday:"short",hour:"2-digit",minute:"2-digit"}).format(new Date(t.t)),o=t.to-t.from||1,s=[[60,"travel_speed_min"],[600,"travel_speed_10min"],[3600,"travel_speed_hour"]];return p`<div class="nf-travel" role="group" aria-label=${e("travel")}>
</div>`}toggleLock(){this._locked=!this._locked;try{localStorage.setItem(Vc,this._locked?"1":"0")}catch{}}async openTravel(e){if(clearInterval(this.travelTimer),this.travelTimer=void 0,e===null||!this.hass){this._travel=null,this.syncDevices(!0);return}let t=Date.now(),r=t-e*36e5;this._travel={history:new Map,from:r,to:t,t:r,playing:!1,speed:e>24?3600:600,hours:e,moments:[],loading:!0};try{let i=await Rn(this.hass,cu(this.watched),r,t);if(!this._travel||this._travel.from!==r)return;this._travel={...this._travel,history:i,moments:du(i,r,t),loading:!1}}catch{this._travel=null,this._error=$(this.hass,"travel_failed");return}this.syncDevices(!0)}travelTo(e){let t=this._travel;t&&(this._travel={...t,t:Math.min(t.to,Math.max(t.from,e))},this.syncDevices(!0))}playTravel(e){let t=this._travel;t&&(clearInterval(this.travelTimer),this.travelTimer=void 0,this._travel={...t,playing:e,t:e&&t.t>=t.to?t.from:t.t},e&&(this.travelTimer=setInterval(()=>{let r=this._travel;if(!r)return;let i=r.t+250*r.speed;i>=r.to&&this.playTravel(!1),this.travelTo(i)},250)))}renderTravel(){if(!this.hass||this.clean)return f;let e=a=>$(this.hass,a),t=this._travel;if(!t)return this.travelButton?p`<button class="nf-travel-btn" title=${e("travel")} aria-label=${e("travel")} @click=${()=>{this.openTravel(24)}}>⏪</button>`:f;let r=this.hass.language??navigator.language,i=new Intl.DateTimeFormat(r,{weekday:"short",hour:"2-digit",minute:"2-digit"}).format(new Date(t.t)),o=t.to-t.from||1,s=[[60,"travel_speed_min"],[600,"travel_speed_10min"],[3600,"travel_speed_hour"]];return p`<div class="nf-travel" role="group" aria-label=${e("travel")}>
<button class="nf-travel-play" aria-label=${e(t.playing?"travel_pause":"travel_play")} ?disabled=${t.loading} @click=${()=>this.playTravel(!t.playing)}>${t.playing?"\u23F8":"\u25B6"}</button>
<b class="nf-travel-when">${t.loading?e("travel_loading"):i}</b>
<div class="nf-travel-track">
@@ -1775,7 +1775,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
<span>${O(this.hass,e.entity)}</span>
<b>${t?$(this.hass,"swipe_off"):`${e.value} %`}</b>
<i><em style="height:${e.value}%"></em></i>
</div>`}tapPlate(e,t,r){let i=this.building?.floors.flatMap(s=>s.furniture).find(s=>s.id===e),o=i?Yi(i.gang_entities,X(i.type)?.gangs??0):[];if(o.length===1)return this.onDeviceTap(o[0],t,r);o.length>1&&(this._plate={ids:o,x:t,y:r})}renderPlate(){let e=this._plate;if(!e||!this.hass)return f;let t=this.hass,r=()=>this._plate=null;return p`<div class="nf-menu-backdrop" @click=${r}></div>
</div>`}tapPlate(e,t,r){let i=this.building?.floors.flatMap(s=>s.furniture).find(s=>s.id===e),o=i?Ji(i.gang_entities,X(i.type)?.gangs??0):[];if(o.length===1)return this.onDeviceTap(o[0],t,r);o.length>1&&(this._plate={ids:o,x:t,y:r})}renderPlate(){let e=this._plate;if(!e||!this.hass)return f;let t=this.hass,r=()=>this._plate=null;return p`<div class="nf-menu-backdrop" @click=${r}></div>
<div class="nf-plate-menu" style="left:${Math.max(8,e.x-110)}px;top:${Math.max(8,e.y-20-e.ids.length*46)}px" role="menu">
${e.ids.map((i,o)=>{let s=t.states[i],a=te(s)||s?.state==="on";return p`<button role="menuitem" class=${a?"on":""} @click=${()=>{r(),this.onDeviceTap(i,e.x,e.y)}}><b>${o+1}</b><span>${O(t,i)}</span><i>${s?se(t,s):"\u2013"}</i></button>`})}
</div>`}renderMenu(){let e=this._menu;if(!e||!this.hass)return f;let t=this.renderRoot.querySelector(".nf-stage"),r=t?.clientWidth??800,i=t?.clientHeight??600,o=Math.max(8,Math.min(r-240,e.x-116)),s=Math.max(8,Math.min(i-360,e.y-170));return p`<div class="nf-menu-backdrop" @click=${()=>this._menu=null}></div>
@@ -1788,12 +1788,12 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.presets=${(this.building?.settings.media_presets??[]).filter(a=>!a.speakers?.length||a.speakers.includes(e.entity))}
?confirmSwitch=${this.confirmSet.has(e.entity)}
.myPosition=${this.myPositionOf(e.entity)}
.tiltEntity=${wr(this.hass,this.building?.floors??[],e.entity)}
.tiltEntity=${xr(this.hass,this.building?.floors??[],e.entity)}
@close=${()=>this._menu=null}
></nf-quick-menu>`}myPositionOf(e){for(let t of this.building?.floors??[])for(let r of t.openings){let i=this.openingLinks?.get(r.id);if(r.my_position!=null&&(i?.cover===e||i?.cover2===e))return r.my_position}return null}onDeviceTap(e,t=0,r=0){if(e.startsWith("lamp:")||this._travel)return;if(e.startsWith("hydronic:")){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===e.slice(9));s&&this.hass&&Vo().then(a=>{if(this.isConnected&&this.hass)return this.hydronicModule=a,a.openHydronic(this.hass,s)}).catch(a=>{this._error=String(a)});return}let i=e.startsWith("tap:")?e.slice(4):this.tapPins.get(e);if(i){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===i);s?.tap&&Zi(this.hass,this,s.tap);return}if(this.pluginTapped(e))return;if(e.startsWith("gang:"))return this.tapPlate(e.slice(5),t,r);if(e.startsWith("outdoor:")){this.fire("room-tap",{floorId:null,roomId:"nf-outside"});return}if(e==="grid"){let s=this.building,a=s?s.energy.grid??Ze(s,l=>this.furnitureLinks?.get(l.id)?.power??null).grid:null;a&&ke(this,a);return}let o=P(e);if(o==="cover"||o==="media"){this._menu={entity:e,x:t,y:r};return}if(o==="lock"){let s=Gi(this.hass,e),a=O(this.hass,e);confirm($(this.hass,s?"lock_confirm_lock":"lock_confirm_unlock",{name:a}))&&this.hass.callService("lock",s?"lock":"unlock",{entity_id:e});return}if(o&&da.has(o)){if(this.confirmSet.has(e)&&!confirm($(this.hass,"confirm_switch",{name:O(this.hass,e)})))return;el(this.hass,e)}else ke(this,e)}pluginTapped(e){let t=this.hass?.states[e],r=this.placementInfo.get(e);if(!t||!r)return!1;let i=this.building?.floors.find(o=>o.id===r.floorId)?.placements.find(o=>o.entity_id===e);return Ks({hass:this.hass,entityId:e,state:t},r,i?.plugin??void 0,{showWindow:(o,s)=>{o&&"hass"in o&&(o.hass=this.hass),this._pluginWindow=o?{node:o,title:s?.title??""}:null},moreInfo:o=>ke(this,o??e)})}renderPluginWindow(){let e=this._pluginWindow;return e?p`<div class="nf-plugin-window" @pointerdown=${t=>t.stopPropagation()}>
></nf-quick-menu>`}myPositionOf(e){for(let t of this.building?.floors??[])for(let r of t.openings){let i=this.openingLinks?.get(r.id);if(r.my_position!=null&&(i?.cover===e||i?.cover2===e))return r.my_position}return null}onDeviceTap(e,t=0,r=0){if(e.startsWith("lamp:")||this._travel)return;if(e.startsWith("hydronic:")){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===e.slice(9));s&&this.hass&&Ko().then(a=>{if(this.isConnected&&this.hass)return this.hydronicModule=a,a.openHydronic(this.hass,s)}).catch(a=>{this._error=String(a)});return}let i=e.startsWith("tap:")?e.slice(4):this.tapPins.get(e);if(i){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===i);s?.tap&&Yi(this.hass,this,s.tap);return}if(this.pluginTapped(e))return;if(e.startsWith("gang:"))return this.tapPlate(e.slice(5),t,r);if(e.startsWith("outdoor:")){this.fire("room-tap",{floorId:null,roomId:"nf-outside"});return}if(e==="grid"){let s=this.building,a=s?s.energy.grid??Ze(s,l=>this.furnitureLinks?.get(l.id)?.power??null).grid:null;a&&ke(this,a);return}let o=P(e);if(o==="cover"||o==="media"){this._menu={entity:e,x:t,y:r};return}if(o==="lock"){let s=Ui(this.hass,e),a=O(this.hass,e);confirm($(this.hass,s?"lock_confirm_lock":"lock_confirm_unlock",{name:a}))&&this.hass.callService("lock",s?"lock":"unlock",{entity_id:e});return}if(o&&ha.has(o)){if(this.confirmSet.has(e)&&!confirm($(this.hass,"confirm_switch",{name:O(this.hass,e)})))return;tl(this.hass,e)}else ke(this,e)}pluginTapped(e){let t=this.hass?.states[e],r=this.placementInfo.get(e);if(!t||!r)return!1;let i=this.building?.floors.find(o=>o.id===r.floorId)?.placements.find(o=>o.entity_id===e);return Gs({hass:this.hass,entityId:e,state:t},r,i?.plugin??void 0,{showWindow:(o,s)=>{o&&"hass"in o&&(o.hass=this.hass),this._pluginWindow=o?{node:o,title:s?.title??""}:null},moreInfo:o=>ke(this,o??e)})}renderPluginWindow(){let e=this._pluginWindow;return e?p`<div class="nf-plugin-window" @pointerdown=${t=>t.stopPropagation()}>
<div class="nf-pw-head"><span>${e.title}</span><button class="nf-pw-close" aria-label=${$(this.hass,"close")} @click=${()=>this._pluginWindow=null}>✕</button></div>
<div class="nf-pw-body">${e.node}</div>
</div>`:f}startViewOf(){return this.startView??this.building?.settings.start_view??null}currentView(){return this.viewer?.currentView()??null}resetView(){this.viewer?.resetView()}fire(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}toggleFlows(){this._flows=!this._flows;try{localStorage.setItem("nextfloor.flows",this._flows?"1":"0")}catch{}this.syncDevices(!0)}liveHeatPumps(e){let t=this.hass;if(!t)return[];let r=[];for(let i of e.floors)for(let o of i.furniture){if(!fc(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=pc(t,s?.entity??s?.power??null);a&&r.push({id:o.id,name:o.name||ae(t,o.type),floorId:i.id,x:o.x,z:o.z,at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+o.h+.5},pump:a})}return r}livePrinters(e){let t=this.hass,r=[];if(!t)return r;for(let i of e.floors)for(let o of i.furniture){if(!Go(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=Ko(t,s?.entity??s?.power??null);!a||!a.printing&&!/pause|finish|complete|error/.test(a.status)||r.push({id:o.id,name:o.name||ae(t,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+o.h+.5},printer:a})}return r}liveCars(e,t){let r=[];for(let i of t.floors)for(let o of i.furniture){if(o.type!=="parking")continue;let s=yc(e,o);if(!s||s.soc===null&&s.range===null&&s.locked===null&&s.climateOn===null)continue;let a=zo(e,o),l=a?Fu(o,a):null,u=o.name||(a?ae(e,a):ae(e,o.type));r.push({spot:o.id,name:u,at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+(l?.h??.2)+.6},car:s})}return r}liveMedia(e,t){let r=[];for(let i of t.floors){for(let o of i.furniture){let s=this.furnitureLinks?.get(o.id)?.entity;s?.startsWith("media_player.")&&r.push({entity:s,name:o.name||ae(e,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+o.h+.15},rings:o.sound_rings})}for(let o of i.placements)o.entity_id.startsWith("media_player.")&&r.push({entity:o.entity_id,name:o.name||O(e,o.entity_id),at:{floorId:i.id,x:o.x,z:o.z,y:(o.y??1.1)+.15},rings:o.sound_rings})}return bu(e,r)}refreshToday(e){let t=this.hass,r=e.settings.calendars??[],i=Math.max(1,Math.min(7,e.settings.today_days??1)),o=`${new Date().toDateString()}|${i}`;!t||!r.length||Date.now()-this.todayAt<9e5&&o===this.todayDay||(this.todayAt=Date.now(),this.todayDay=o,uc(t,r,i).then(s=>this._todayItems=s))}refreshForecast(e){let t=this.hass,r=e.settings.forecast&&t?at(t,this.weatherEntityId??e.settings.weather_entity):null;if(!t||!r)return;let i=`${r}|${new Date().toDateString()}`;Date.now()-this.forecastAt<18e5&&i===this.forecastKey||(this.forecastAt=Date.now(),this.forecastKey=i,hc(t,r).then(o=>this._forecast=o))}renderForecast(e){let t=this.building,r=this.hass,i=t?.settings.forecast;if(!t||!r||!i||i.corner!==e||this.clean)return f;if(e==="top_right"&&(this.roomId||this.panelOpen))return f;let o=dc(this._forecast,Math.max(1,Math.min(7,i.days)));if(!o.length)return f;let s=at(r,this.weatherEntityId??t.settings.weather_entity),a=s?r.states[s]?.attributes:void 0,l=String(a?.temperature_unit??"\xB0"),u=String(a?.precipitation_unit??"mm"),c=r.language??navigator.language,h=new Intl.DateTimeFormat(c,{weekday:"short"}),m=d=>d===null?"\u2013":`${Math.round(d)}\xB0`;return p`<section class="nf-forecast" aria-label=${$(r,"forecast")}>
</div>`:f}startViewOf(){return this.startView??this.building?.settings.start_view??null}currentView(){return this.viewer?.currentView()??null}resetView(){this.viewer?.resetView()}fire(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}toggleFlows(){this._flows=!this._flows;try{localStorage.setItem("nextfloor.flows",this._flows?"1":"0")}catch{}this.syncDevices(!0)}liveHeatPumps(e){let t=this.hass;if(!t)return[];let r=[];for(let i of e.floors)for(let o of i.furniture){if(!_c(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=gc(t,s?.entity??s?.power??null);a&&r.push({id:o.id,name:o.name||ae(t,o.type),floorId:i.id,x:o.x,z:o.z,at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+o.h+.5},pump:a})}return r}livePrinters(e){let t=this.hass,r=[];if(!t)return r;for(let i of e.floors)for(let o of i.furniture){if(!Uo(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=Go(t,s?.entity??s?.power??null);!a||!a.printing&&!/pause|finish|complete|error/.test(a.status)||r.push({id:o.id,name:o.name||ae(t,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+o.h+.5},printer:a})}return r}liveCars(e,t){let r=[];for(let i of t.floors)for(let o of i.furniture){if(o.type!=="parking")continue;let s=xc(e,o);if(!s||s.soc===null&&s.range===null&&s.locked===null&&s.climateOn===null)continue;let a=To(e,o),l=a?Pu(o,a):null,u=o.name||(a?ae(e,a):ae(e,o.type));r.push({spot:o.id,name:u,at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+(l?.h??.2)+.6},car:s})}return r}liveMedia(e,t){let r=[];for(let i of t.floors){for(let o of i.furniture){let s=this.furnitureLinks?.get(o.id)?.entity;s?.startsWith("media_player.")&&r.push({entity:s,name:o.name||ae(e,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+o.h+.15},rings:o.sound_rings})}for(let o of i.placements)o.entity_id.startsWith("media_player.")&&r.push({entity:o.entity_id,name:o.name||O(e,o.entity_id),at:{floorId:i.id,x:o.x,z:o.z,y:(o.y??1.1)+.15},rings:o.sound_rings})}return yu(e,r)}refreshToday(e){let t=this.hass,r=e.settings.calendars??[],i=Math.max(1,Math.min(7,e.settings.today_days??1)),o=`${new Date().toDateString()}|${i}`;!t||!r.length||Date.now()-this.todayAt<9e5&&o===this.todayDay||(this.todayAt=Date.now(),this.todayDay=o,dc(t,r,i).then(s=>this._todayItems=s))}refreshForecast(e){let t=this.hass,r=e.settings.forecast&&t?at(t,this.weatherEntityId??e.settings.weather_entity):null;if(!t||!r)return;let i=`${r}|${new Date().toDateString()}`;Date.now()-this.forecastAt<18e5&&i===this.forecastKey||(this.forecastAt=Date.now(),this.forecastKey=i,pc(t,r).then(o=>this._forecast=o))}renderForecast(e){let t=this.building,r=this.hass,i=t?.settings.forecast;if(!t||!r||!i||i.corner!==e||this.clean)return f;if(e==="top_right"&&(this.roomId||this.panelOpen))return f;let o=mc(this._forecast,Math.max(1,Math.min(7,i.days)));if(!o.length)return f;let s=at(r,this.weatherEntityId??t.settings.weather_entity),a=s?r.states[s]?.attributes:void 0,l=String(a?.temperature_unit??"\xB0"),u=String(a?.precipitation_unit??"mm"),c=r.language??navigator.language,h=new Intl.DateTimeFormat(c,{weekday:"short"}),m=d=>d===null?"\u2013":`${Math.round(d)}\xB0`;return p`<section class="nf-forecast" aria-label=${$(r,"forecast")}>
<ul>
${o.map((d,g)=>p`<li>
<span class="nf-fc-day">${g===0?$(r,"today"):h.format(new Date(d.day))}</span>
@@ -1802,14 +1802,14 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
<span class="nf-fc-rain">${d.rain!==null&&d.rain>0?`\u{1F4A7}${d.rain.toLocaleString(c,{maximumFractionDigits:1})} ${u}`:d.chance!==null&&d.chance>0?`\u{1F4A7}${Math.round(d.chance)} %`:""}</span>
</li>`)}
</ul>
</section>`}renderToday(e){let t=this.building,r=this.hass;if(!t||!r||this.clean||this.roomId||this.panelOpen)return f;let i=this.renderForecast("top_right"),o=this.today===!1?f:this.renderTodayCard(t,r);return o===f&&i===f&&e===f?f:p`<div class="nf-right-col ${e!==f?"nf-utility-right":""}" style=${this.clock==="top_right"?"top: 78px":""}>${e}${o}${i}</div>`}renderTodayCard(e,t){let r=ac(t,e,Date.now(),{today:$(t,"care_bin_today"),tomorrow:$(t,"care_bin_tomorrow")}),i=lc([...r,...this._todayItems??[]]);if(!i.length&&!(e.settings.calendars??[]).length)return f;let o=this._todayOpen!==!1,s=new Intl.DateTimeFormat(t.language??navigator.language,{weekday:"long",day:"numeric",month:"long"}).format(new Date),a=t.language??navigator.language,l=c=>{if(c===1)return $(t,"tomorrow");let h=new Date;return h.setDate(h.getDate()+c),new Intl.DateTimeFormat(a,{weekday:"long",day:"numeric",month:"numeric"}).format(h)},u=i.flatMap((c,h)=>[(c.day??0)>0&&(i[h-1]?.day??0)!==c.day?p`<li class="nf-today-day">${l(c.day??0)}</li>`:f,p`<li class=${c.past?"nf-today-past":""}><time>${c.kind==="bin"?"\u{1F5D1}":c.time||"\u25CF"}</time><span>${c.title}<small>${c.source}</small></span></li>`]);return p`<section class="nf-today ${o?"":"nf-today-folded"}" aria-label=${$(t,"today")}>
</section>`}renderToday(e){let t=this.building,r=this.hass;if(!t||!r||this.clean||this.roomId||this.panelOpen)return f;let i=this.renderForecast("top_right"),o=this.today===!1?f:this.renderTodayCard(t,r);return o===f&&i===f&&e===f?f:p`<div class="nf-right-col ${e!==f?"nf-utility-right":""}" style=${this.clock==="top_right"?"top: 78px":""}>${e}${o}${i}</div>`}renderTodayCard(e,t){let r=uc(t,e,Date.now(),{today:$(t,"care_bin_today"),tomorrow:$(t,"care_bin_tomorrow")}),i=cc([...r,...this._todayItems??[]]);if(!i.length&&!(e.settings.calendars??[]).length)return f;let o=this._todayOpen!==!1,s=new Intl.DateTimeFormat(t.language??navigator.language,{weekday:"long",day:"numeric",month:"long"}).format(new Date),a=t.language??navigator.language,l=c=>{if(c===1)return $(t,"tomorrow");let h=new Date;return h.setDate(h.getDate()+c),new Intl.DateTimeFormat(a,{weekday:"long",day:"numeric",month:"numeric"}).format(h)},u=i.flatMap((c,h)=>[(c.day??0)>0&&(i[h-1]?.day??0)!==c.day?p`<li class="nf-today-day">${l(c.day??0)}</li>`:f,p`<li class=${c.past?"nf-today-past":""}><time>${c.kind==="bin"?"\u{1F5D1}":c.time||"\u25CF"}</time><span>${c.title}<small>${c.source}</small></span></li>`]);return p`<section class="nf-today ${o?"":"nf-today-folded"}" aria-label=${$(t,"today")}>
<button class="nf-today-head" aria-expanded=${o} @click=${()=>this._todayOpen=!o}>
<b>📅 ${$(t,"today")}</b><span>${s}</span>
</button>
${o?i.length?p`<ul>
${u}
</ul>`:p`<p class="nf-today-none">${$(t,"today_none")}</p>`:f}
</section>`}week=null;weekAt=0;refreshWeek(e){let t=this.hass;if(!t||this._travel||Date.now()-this.weekAt<36e5)return;this.weekAt=Date.now();let r=Ze(e,s=>this.furnitureLinks?.get(s.id)?.power??null),i=e.energy,o={solar:i.solar?[i.solar]:r.solar,grid:i.grid??r.grid,gridInvert:!!i.grid_invert,battery:i.battery?[i.battery]:r.battery,batteryInvert:!!i.battery_invert,consumption:i.consumption};Zl(t,o).then(s=>{this.week=s,this.syncDevices(!0)}).catch(()=>this.week=null)}meterRows(e,t=null){let r=this.hass,i=[],o=this.floorId?e.floors.find(l=>l.id===this.floorId):void 0,s=o&&V(r)?Ce(r,o,e.floors.flatMap(l=>l.rooms)).find(l=>l.kind==="electricity"&&l.metric==="power"&&l.unit==="W"):void 0,a=V(r)?s?.value??null:o?.power_entity?q(r?.states[o.power_entity]):null;if(o&&(s||a!==null)){let l=!s?.incomplete&&a!==null&&t&&t>0?` \xB7 ${$(r,"floor_power_share",{n:Math.round(Math.max(0,a)/t*100)})}`:"";i.push({icon:"\u26A1",label:o.name,value:`${s?Ne(r,s):wt(r,a)}${l}`})}for(let[l,u,c]of[["gas","\u{1F525}","energy_gas_short"],["water","\u{1F4A7}","energy_water_short"]]){let h=e.energy[l],m=h?r?.states[h]:void 0;m&&!C(m)&&i.push({icon:u,label:$(r,c),value:se(r,m)})}return i}refreshDayCurves(e){let t=this.hass;if(!t||this._travel||Date.now()-this.curvesAt<6e5)return;this.curvesAt=Date.now();let r=a=>Sn(a,e,kn(a,e),Ze(e,l=>this.furnitureLinks?.get(l.id)?.power??null)),i=cu(t,r),o=Date.now(),s=o-24*36e5;En(t,i,s,o,!0).then(a=>{this.dayCurves=du(t,a,s,o,r),this.syncDevices(!0)}).catch(()=>this.dayCurves=null)}syncHydronics(e,t,r){let i=++this.hydronicGeneration,o=this.shownBuilding(r).floors.filter(s=>!this.floorId||s.id===this.floorId).flatMap(s=>s.furniture.filter(a=>ot(a.type)).map(a=>({floor:s,item:a})));if(!o.length){e.setHydronics([]),this.hydronicModule?.refreshHydronic(r,t,!!this._travel);return}Vo().then(s=>{i!==this.hydronicGeneration||this.viewer!==e||!this.isConnected||(this.hydronicModule=s,e.setHydronics(o.map(({floor:a,item:l})=>({...s.hydronicVisual(r,l,a.id,oe(a,l)),animate:!this.dimmed&&!this._travel}))),s.refreshHydronic(r,t,!!this._travel))}).catch(s=>{this._error=String(s)})}syncLhCards(e,t,r,i,o,s){let a=[],l=r.summary,u=l.solar!==null||l.grid!==null||l.battery!==null||l.consumption!==null,c=In(t),h=(this.floorId?t.floors.find(m=>m.id===this.floorId):void 0)??[...t.floors].sort((m,d)=>d.elevation-m.elevation)[0];if(this.liveCardsOn&&!this.dimmed&&!this.roomId&&u&&c&&h){let m=0,d=0,g=0;for(let _ of h.rooms)for(let[b,v]of _.points)m+=b,d+=v,g++;a.push({kind:"house",at:{floorId:h.id,x:g?m/g:c.x,z:g?d/g:c.z,y:h.height+(this.floorId?1.2:3.2)},summary:l,autarky:r.autarky,curves:this.dayCurves??void 0,week:this.week??void 0,meters:this.meterRows(t,l.consumption)}),this.refreshDayCurves(t),this.refreshWeek(t)}if(this.liveCardsOn&&!this.dimmed&&!this.roomId){for(let m of i)a.push({kind:"car",at:m.at,spot:m.spot,name:m.name,car:m.car});for(let m of this.livePrinters(t))a.push({kind:"printer",at:m.at,name:m.name,printer:m.printer});for(let m of this.liveHeatPumps(t))a.push({kind:"heatpump",at:m.at,name:m.name,pump:m.pump});for(let m of o)a.push({kind:"media",at:{...m.at,y:m.at.y+.5},media:m})}if(this.liveCardsOn&&!this.dimmed){a.push(...tc(s,t,this.floorId,this.roomId)),a.push(...nc(s,t,this.furnitureLinks??new Map,this.floorId,this.roomId));for(let m of t.floors)for(let d of m.furniture){if(!ot(d.type)||d.hydronic?.card===!1||this.floorId&&m.id!==this.floorId||!Ue(s,d))continue;let g=this.roomId?m.rooms.find(_=>_.id===this.roomId):null;this.roomId&&(!g||!H([d.x,d.z],g.points))||a.push({kind:"hydronic",item:d,readOnly:!!this._travel,at:{floorId:m.id,x:d.x+(d.pin_offset?.x??0),z:d.z+(d.pin_offset?.z??0),y:oe(m,d)+d.h+.3+(d.pin_offset?.y??0)}})}}JSON.stringify(a)!==JSON.stringify(this._liveCards)&&(this._liveCards=a),e.setLiveAnchors(a.map(m=>m.at),a.length?(m,d,g,_,b)=>this.placeLhCard(m,d,g,_,b):null)}placeLhCard(e,t,r,i,o){let s=this.renderRoot.querySelector(`.live-card[data-i="${e}"]`);if(!s)return;let a=this._liveCards[e],l=`${a.kind}:${a.at.floorId}:${a.at.x}:${a.at.z}`,u=s.dataset.zoomKey===l&&s.dataset.zoomVisible==="1",c=this.shadowRoot?.activeElement,h=!!c&&s.contains(c),m=h||$c(a,o,u);s.dataset.zoomKey=l,s.dataset.zoomVisible=m?"1":"0",s.dataset.density=String(Math.round(o)),s.dataset.priority=String(h?110:qo(a).priority),s.dataset.focused=h?"1":"0",s.dataset.x=String(t),s.dataset.y=String(r),s.style.visibility=i&&m?"visible":"hidden",e===this._liveCards.length-1&&xc(this.renderRoot)}toggleHouseFold(){this._houseFolded=!this._houseFolded;try{localStorage.setItem("nextfloor.house_card_folded",this._houseFolded?"1":"0")}catch{}}toggleLhCards(){this._liveCardOn=!this._liveCardOn;try{localStorage.setItem("nextfloor.cards",this._liveCardOn?"1":"0")}catch{}this.syncDevices(!0)}renderTopLeft(){let e=this.clean?f:this.renderLhEnergy(),t=this.renderForecast("top_left");return this.clock!=="top_left"&&t===f||!this.hass?e:p`<div class="nf-topleft">${this.clock==="top_left"?this.renderClock(!0):f}${e}${t}</div>`}renLine truncated
</section>`}week=null;weekAt=0;refreshWeek(e){let t=this.hass;if(!t||this._travel||Date.now()-this.weekAt<36e5)return;this.weekAt=Date.now();let r=Ze(e,s=>this.furnitureLinks?.get(s.id)?.power??null),i=e.energy,o={solar:i.solar?[i.solar]:r.solar,grid:i.grid??r.grid,gridInvert:!!i.grid_invert,battery:i.battery?[i.battery]:r.battery,batteryInvert:!!i.battery_invert,consumption:i.consumption};Jl(t,o).then(s=>{this.week=s,this.syncDevices(!0)}).catch(()=>this.week=null)}meterRows(e,t=null){let r=this.hass,i=[],o=this.floorId?e.floors.find(l=>l.id===this.floorId):void 0,s=o&&V(r)?Ce(r,o,e.floors.flatMap(l=>l.rooms)).find(l=>l.kind==="electricity"&&l.metric==="power"&&l.unit==="W"):void 0,a=V(r)?s?.value??null:o?.power_entity?q(r?.states[o.power_entity]):null;if(o&&(s||a!==null)){let l=!s?.incomplete&&a!==null&&t&&t>0?` \xB7 ${$(r,"floor_power_share",{n:Math.round(Math.max(0,a)/t*100)})}`:"";i.push({icon:"\u26A1",label:o.name,value:`${s?Ne(r,s):wt(r,a)}${l}`})}for(let[l,u,c]of[["gas","\u{1F525}","energy_gas_short"],["water","\u{1F4A7}","energy_water_short"]]){let h=e.energy[l],m=h?r?.states[h]:void 0;m&&!C(m)&&i.push({icon:u,label:$(r,c),value:se(r,m)})}return i}refreshDayCurves(e){let t=this.hass;if(!t||this._travel||Date.now()-this.curvesAt<6e5)return;this.curvesAt=Date.now();let r=a=>Sn(a,e,kn(a,e),Ze(e,l=>this.furnitureLinks?.get(l.id)?.power??null)),i=hu(t,r),o=Date.now(),s=o-24*36e5;Rn(t,i,s,o,!0).then(a=>{this.dayCurves=mu(t,a,s,o,r),this.syncDevices(!0)}).catch(()=>this.dayCurves=null)}syncHydronics(e,t,r){let i=++this.hydronicGeneration,o=this.shownBuilding(r).floors.filter(s=>!this.floorId||s.id===this.floorId).flatMap(s=>s.furniture.filter(a=>ot(a.type)).map(a=>({floor:s,item:a})));if(!o.length){e.setHydronics([]),this.hydronicModule?.refreshHydronic(r,t,!!this._travel);return}Ko().then(s=>{i!==this.hydronicGeneration||this.viewer!==e||!this.isConnected||(this.hydronicModule=s,e.setHydronics(o.map(({floor:a,item:l})=>({...s.hydronicVisual(r,l,a.id,oe(a,l)),animate:!this.dimmed&&!this._travel}))),s.refreshHydronic(r,t,!!this._travel))}).catch(s=>{this._error=String(s)})}syncLhCards(e,t,r,i,o,s){let a=[],l=r.summary,u=l.solar!==null||l.grid!==null||l.battery!==null||l.consumption!==null,c=Cn(t),h=(this.floorId?t.floors.find(m=>m.id===this.floorId):void 0)??[...t.floors].sort((m,d)=>d.elevation-m.elevation)[0];if(this.liveCardsOn&&!this.dimmed&&!this.roomId&&u&&c&&h){let m=0,d=0,g=0;for(let _ of h.rooms)for(let[b,v]of _.points)m+=b,d+=v,g++;a.push({kind:"house",at:{floorId:h.id,x:g?m/g:c.x,z:g?d/g:c.z,y:h.height+(this.floorId?1.2:3.2)},summary:l,autarky:r.autarky,curves:this.dayCurves??void 0,week:this.week??void 0,meters:this.meterRows(t,l.consumption)}),this.refreshDayCurves(t),this.refreshWeek(t)}if(this.liveCardsOn&&!this.dimmed&&!this.roomId){for(let m of i)a.push({kind:"car",at:m.at,spot:m.spot,name:m.name,car:m.car});for(let m of this.livePrinters(t))a.push({kind:"printer",at:m.at,name:m.name,printer:m.printer});for(let m of this.liveHeatPumps(t))a.push({kind:"heatpump",at:m.at,name:m.name,pump:m.pump});for(let m of o)a.push({kind:"media",at:{...m.at,y:m.at.y+.5},media:m})}if(this.liveCardsOn&&!this.dimmed){a.push(...rc(s,t,this.floorId,this.roomId)),a.push(...ic(s,t,this.furnitureLinks??new Map,this.floorId,this.roomId));for(let m of t.floors)for(let d of m.furniture){if(!ot(d.type)||d.hydronic?.card===!1||this.floorId&&m.id!==this.floorId||!Ue(s,d))continue;let g=this.roomId?m.rooms.find(_=>_.id===this.roomId):null;this.roomId&&(!g||!H([d.x,d.z],g.points))||a.push({kind:"hydronic",item:d,readOnly:!!this._travel,at:{floorId:m.id,x:d.x+(d.pin_offset?.x??0),z:d.z+(d.pin_offset?.z??0),y:oe(m,d)+d.h+.3+(d.pin_offset?.y??0)}})}}JSON.stringify(a)!==JSON.stringify(this._liveCards)&&(this._liveCards=a),e.setLiveAnchors(a.map(m=>m.at),a.length?(m,d,g,_,b)=>this.placeLhCard(m,d,g,_,b):null)}placeLhCard(e,t,r,i,o){let s=this.renderRoot.querySelector(`.live-card[data-i="${e}"]`);if(!s)return;let a=this._liveCards[e],l=`${a.kind}:${a.at.floorId}:${a.at.x}:${a.at.z}`,u=s.dataset.zoomKey===l&&s.dataset.zoomVisible==="1",c=this.shadowRoot?.activeElement,h=!!c&&s.contains(c),m=h||Ac(a,o,u);s.dataset.zoomKey=l,s.dataset.zoomVisible=m?"1":"0",s.dataset.density=String(Math.round(o)),s.dataset.priority=String(h?110:Zo(a).priority),s.dataset.focused=h?"1":"0",s.dataset.x=String(t),s.dataset.y=String(r),s.style.visibility=i&&m?"visible":"hidden",e===this._liveCards.length-1&&Sc(this.renderRoot)}toggleHouseFold(){this._houseFolded=!this._houseFolded;try{localStorage.setItem("nextfloor.house_card_folded",this._houseFolded?"1":"0")}catch{}}toggleLhCards(){this._liveCardOn=!this._liveCardOn;try{localStorage.setItem("nextfloor.cards",this._liveCardOn?"1":"0")}catch{}this.syncDevices(!0)}renderTopLeft(){let e=this.clean?f:this.renderLhEnergy(),t=this.renderForecast("top_left");return this.clock!=="top_left"&&t===f||!this.hass?e:p`<div class="nf-topleft">${this.clock==="top_left"?this.renderClock(!0):f}${e}${t}</div>`}renLine truncated
${s}
${this.liveCardsOn&&this._liveCards.some(u=>u.kind==="house")?f:l.map(u=>p`<div class="nf-energy-item nf-energy-${u.cls}"><span>${u.label}</span><b>${u.value}</b></div>`)}
${this.flows!==null?f:p`<button class="nf-energy-item nf-flow-toggle" aria-pressed=${this._flows} title=${a("flows_hint")} aria-label=${a("flows")} @click=${()=>this.toggleFlows()}>
@@ -1820,26 +1820,26 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
</div>`}renderCardToggle(){return this.holograms!==null?f:p`<button class="nf-energy-item nf-flow-toggle nf-card-toggle" aria-pressed=${this._liveCardOn} title=${$(this.hass,"holos_hint")} aria-label=${$(this.hass,"holos")} @click=${()=>this.toggleLhCards()}>
<span>${$(this.hass,"holos")}</span><b>◫</b>
</button>`}utilityOverview(e){let t=this.building;if(!t||!V(this.hass)||!this.showEnergy||this.clean||this.roomId||this.panelOpen||!e&&!this._utilityOverviewVisible)return f;let r=t.floors.flatMap(o=>o.rooms);return(this.floorId?t.floors.filter(o=>o.id===this.floorId):t.floors).some(o=>Ce(this.hass,o,r).length||Bt(this.hass,o,r,!0).length)?p`<nf-utility-overview ?inline=${e} .hass=${this.hass} .floors=${t.floors} .floorId=${this.floorId} .compact=${this._narrowStage}
@utility-open=${o=>{o.stopPropagation(),o.detail.roomId?this.openRoom(o.detail.floorId,o.detail.roomId):this.fire("floor-tap",{floorId:o.detail.floorId})}}></nf-utility-overview>`:f}ownSensors(){let e=this.utilityOverview(!0),t=e===f?f:p`<button class="nf-energy-item nf-flow-toggle nf-utility-overview-toggle" aria-label="Rechte Übersicht" aria-pressed=${this._utilityOverviewVisible} title=${this._utilityOverviewVisible?"Rechte \xDCbersicht ausblenden":"Rechte \xDCbersicht einblenden"} @click=${()=>{this._utilityOverviewVisible=!this._utilityOverviewVisible;try{localStorage.setItem("nextfloor.utility_overview",this._utilityOverviewVisible?"1":"0")}catch{}}}><span>Übersicht</span><b aria-hidden="true"><svg width="18" height="16" viewBox="0 0 20 16" fill="none" stroke="currentColor" stroke-width="1.3"><rect x="1" y="1" width="18" height="14" rx="2"/><path d="M12 1v14m2-10h3m-3 3h3m-3 3h3"/></svg></b></button>`,r=this.sensorBar&&this.hass?this.building?.settings.status_entities??[]:[],i=V(this.hass)?(this.building?.presence??[]).filter(u=>cl(this.hass,u.person,[0])).map(u=>p`<div class="nf-energy-item nf-presence-state"><span>${u.name||O(this.hass,u.person)}</span><b>${le(this.hass.states[u.person])===null?"\u2013":le(this.hass.states[u.person])?"Anwesend":"Abwesend"}${G(this.hass,[u.person],u.name||"Anwesenheit")}</b></div>`):[],o=V(this.hass)?Object.entries(this.building?.settings.weather_variables??{}).filter(u=>!!u[1]&&u[1]!=="none").map(([u,c])=>[Ic[u]||u,c]):[];V(this.hass)&&this.building?.settings.rain_sensor&&this.building.settings.rain_sensor!=="none"&&o.push(["Regensensor",this.building.settings.rain_sensor]);let s=o.length?p`<button class="nf-energy-item nf-flow-toggle nf-weather-values" aria-label="Wetterwerte anzeigen" title="Wetterwerte anzeigen" aria-haspopup="dialog" @click=${()=>this.renderRoot.querySelector(".nf-weather-dialog")?.showModal()}><span>Wetter</span><b aria-hidden="true">⛅</b></button>
@utility-open=${o=>{o.stopPropagation(),o.detail.roomId?this.openRoom(o.detail.floorId,o.detail.roomId):this.fire("floor-tap",{floorId:o.detail.floorId})}}></nf-utility-overview>`:f}ownSensors(){let e=this.utilityOverview(!0),t=e===f?f:p`<button class="nf-energy-item nf-flow-toggle nf-utility-overview-toggle" aria-label="Rechte Übersicht" aria-pressed=${this._utilityOverviewVisible} title=${this._utilityOverviewVisible?"Rechte \xDCbersicht ausblenden":"Rechte \xDCbersicht einblenden"} @click=${()=>{this._utilityOverviewVisible=!this._utilityOverviewVisible;try{localStorage.setItem("nextfloor.utility_overview",this._utilityOverviewVisible?"1":"0")}catch{}}}><span>Übersicht</span><b aria-hidden="true"><svg width="18" height="16" viewBox="0 0 20 16" fill="none" stroke="currentColor" stroke-width="1.3"><rect x="1" y="1" width="18" height="14" rx="2"/><path d="M12 1v14m2-10h3m-3 3h3m-3 3h3"/></svg></b></button>`,r=this.sensorBar&&this.hass?this.building?.settings.status_entities??[]:[],i=V(this.hass)?(this.building?.presence??[]).filter(u=>dl(this.hass,u.person,[0])).map(u=>p`<div class="nf-energy-item nf-presence-state"><span>${u.name||O(this.hass,u.person)}</span><b>${le(this.hass.states[u.person])===null?"\u2013":le(this.hass.states[u.person])?"Anwesend":"Abwesend"}${G(this.hass,[u.person],u.name||"Anwesenheit")}</b></div>`):[],o=V(this.hass)?Object.entries(this.building?.settings.weather_variables??{}).filter(u=>!!u[1]&&u[1]!=="none").map(([u,c])=>[Nc[u]||u,c]):[];V(this.hass)&&this.building?.settings.rain_sensor&&this.building.settings.rain_sensor!=="none"&&o.push(["Regensensor",this.building.settings.rain_sensor]);let s=o.length?p`<button class="nf-energy-item nf-flow-toggle nf-weather-values" aria-label="Wetterwerte anzeigen" title="Wetterwerte anzeigen" aria-haspopup="dialog" @click=${()=>this.renderRoot.querySelector(".nf-weather-dialog")?.showModal()}><span>Wetter</span><b aria-hidden="true">⛅</b></button>
<dialog class="nf-weather-dialog" aria-label="Wetterwerte" @keydown=${u=>u.stopPropagation()}><header><b>Wetter</b><button type="button" class="nf-chip" aria-label="Schließen" @click=${()=>this.renderRoot.querySelector(".nf-weather-dialog")?.close()}>×</button></header>${o.map(([u,c])=>p`<p><span>${u}</span><b>${Fe(this.hass.states[c])}${G(this.hass,[c],u)}</b></p>`)}</dialog>`:f,a=V(this.hass)?(this.building?.floors??[]).filter(u=>!this.floorId||u.id===this.floorId).map(u=>({floor:u,readings:Ce(this.hass,u,this.building?.floors.flatMap(c=>c.rooms))})).filter(u=>u.readings.length):[],l=a.length?p`<button class="nf-energy-item nf-flow-toggle nf-utility-toggle" aria-label="Stockwerkszähler anzeigen" title="Stockwerkszähler anzeigen" aria-haspopup="dialog" @click=${()=>this.renderRoot.querySelector(".nf-utility-dialog")?.showModal()}><span>Stockwerkszähler</span><b aria-hidden="true">⚡ 💧</b></button>
<dialog class="nf-weather-dialog nf-utility-dialog" aria-label="Stockwerkszähler" @keydown=${u=>u.stopPropagation()}><header><b>Stockwerkszähler</b><button type="button" class="nf-chip" aria-label="Schließen" @click=${()=>this.renderRoot.querySelector(".nf-utility-dialog")?.close()}>×</button></header>${a.map(({floor:u,readings:c})=>p`<h3>${u.name}</h3><nf-utility-report .hass=${this.hass} .readings=${c}></nf-utility-report>`)}</dialog>`:f;return[t,e,...i,s,l,...r.filter(u=>this.hass.states[u]).map(u=>p`<button class="nf-energy-item nf-own-sensor" title=${O(this.hass,u)} @click=${()=>ke(this,u)}>
<span>${O(this.hass,u)}</span><b>${se(this.hass,this.hass.states[u])}</b>
</button>${G(this.hass,[u],O(this.hass,u))}`)]}renderMapCredit(){let e=this.building?.settings.map;return Lu(e)?p`<a class="nf-map-credit" href=${Fo(e).href} target="_blank" rel="noopener">${Fo(e).text}</a>`:f}renderLegend(){if(this.heatMode==="wifi")return this.renderWifiLegend();if(this.heatMode==="none"||this.heatMode==="values")return f;let e=yt(new Date,this.hass?.config?.latitude??50),t=Br(this.heatMode,e),r=this.heatMode==="temperature",i=r?ue(this.hass,t.stops[0][0]):t.stops[0][0],o=r?ue(this.hass,t.stops[t.stops.length-1][0]):t.stops[t.stops.length-1][0],s=r?re(this.hass):t.unit,a=l=>$(this.hass,l);return p`<div class="nf-legend">
</button>${G(this.hass,[u],O(this.hass,u))}`)]}renderMapCredit(){let e=this.building?.settings.map;return Wu(e)?p`<a class="nf-map-credit" href=${Ho(e).href} target="_blank" rel="noopener">${Ho(e).text}</a>`:f}renderLegend(){if(this.heatMode==="wifi")return this.renderWifiLegend();if(this.heatMode==="none"||this.heatMode==="values")return f;let e=yt(new Date,this.hass?.config?.latitude??50),t=Vr(this.heatMode,e),r=this.heatMode==="temperature",i=r?ue(this.hass,t.stops[0][0]):t.stops[0][0],o=r?ue(this.hass,t.stops[t.stops.length-1][0]):t.stops[t.stops.length-1][0],s=r?re(this.hass):t.unit,a=l=>$(this.hass,l);return p`<div class="nf-legend">
<b>${a(`heat_${this.heatMode}`)}${this.heatMode==="temperature"?p` <small>${a(e?"heat_summer":"heat_winter")}</small>`:f}</b>
<span class="nf-legend-bar" style="background:${ql(this.heatMode,e)}"></span>
<span class="nf-legend-bar" style="background:${Yl(this.heatMode,e)}"></span>
<span class="nf-legend-range"><span>${L(this.hass,i,0)} ${s}</span><span>${L(this.hass,o,0)} ${s}</span></span>
${this.heatValues.size?f:p`<span class="nf-legend-none">${a("heat_none_found")}</span>`}
</div>`}renderWifiLegend(){let e=this.hass,t=this.building;if(!e||!t)return f;let r=(u,c)=>$(e,u,c),i=t.floors.flatMap(u=>u.furniture.filter(c=>Uo(c.type)).map(c=>jo(e,this.furnitureLinks?.get(c.id)?.entity??this.furnitureLinks?.get(c.id)?.power??null))),s=i.filter(u=>!!u).reduce((u,c)=>u+(c.clients??0),0),a=t.floors.flatMap(u=>u.placements.map(c=>e.states[c.entity_id])),l=bc(a);return p`<div class="nf-legend">
</div>`}renderWifiLegend(){let e=this.hass,t=this.building;if(!e||!t)return f;let r=(u,c)=>$(e,u,c),i=t.floors.flatMap(u=>u.furniture.filter(c=>jo(c.type)).map(c=>qo(e,this.furnitureLinks?.get(c.id)?.entity??this.furnitureLinks?.get(c.id)?.power??null))),s=i.filter(u=>!!u).reduce((u,c)=>u+(c.clients??0),0),a=t.floors.flatMap(u=>u.placements.map(c=>e.states[c.entity_id])),l=yc(a);return p`<div class="nf-legend">
<b>📶 ${r("heat_wifi")}</b>
<span>${r("wifi_aps",{n:i.length,clients:s})}</span>
${l.online+l.offline.length?p`<span>${r("wifi_network",{online:l.online,offline:l.offline.length})}</span>`:f}
${l.offline.length?p`<span class="nf-legend-none">${l.offline.slice(0,4).join(", ")}</span>`:f}
${i.length?f:p`<span class="nf-legend-none">${r("wifi_none")}</span>`}
</div>`}skyColor(){let e=zn[this.theme]??zn.neon,t=this._sky;return e.night[0].map((r,i)=>Math.round(r+(e.day[0][i]-r)*t))}render(){let e=this.utilityOverview(!1),t=this._sky,r=(s,a)=>`rgb(${s.map((l,u)=>Math.round(l+(a[u]-l)*t)).join(",")})`,i=zn[this.theme]??zn.neon,o=`--nf-sky:${r(i.night[0],i.day[0])};--nf-ground:${r(i.night[1],i.day[1])}`+gu(this.building?.settings.backdrop);return p`<div
</div>`}skyColor(){let e=Tn[this.theme]??Tn.neon,t=this._sky;return e.night[0].map((r,i)=>Math.round(r+(e.day[0][i]-r)*t))}render(){let e=this.utilityOverview(!1),t=this._sky,r=(s,a)=>`rgb(${s.map((l,u)=>Math.round(l+(a[u]-l)*t)).join(",")})`,i=Tn[this.theme]??Tn.neon,o=`--nf-sky:${r(i.night[0],i.day[0])};--nf-ground:${r(i.night[1],i.day[1])}`+bu(this.building?.settings.backdrop);return p`<div
class="nf-stage ${this.roomLabels?"":"nf-no-room-names"} ${this._low?"nf-low":""} ${this.panelOpen?"nf-panel-open":""} ${this._alerts.length?"nf-has-alerts":""} ${this._narrowStage?"nf-narrow":""} ${e!==f?"nf-has-utility-overview":""}"
style=${o}
>
${this._error?p`<p class="nf-error">${this._error}</p>`:f} ${this.renderTopLeft()} ${kc(this.hass,this._liveCards,(s,a,l,u)=>this.hass?.callService(s,a,{entity_id:l,...u}),{folded:this._houseFolded,toggle:()=>this.toggleHouseFold()},!!this.roomId||this.panelOpen)} ${this.clean?f:this.renderLegend()} ${this.renderMapCredit()}
${this._error?p`<p class="nf-error">${this._error}</p>`:f} ${this.renderTopLeft()} ${$c(this.hass,this._liveCards,(s,a,l,u)=>this.hass?.callService(s,a,{entity_id:l,...u}),{folded:this._houseFolded,toggle:()=>this.toggleHouseFold()},!!this.roomId||this.panelOpen)} ${this.clean?f:this.renderLegend()} ${this.renderMapCredit()}
${this.renderAlerts()} ${this.renderAnnouncement()} ${this.clean?f:p`${this.renderThumbs()} ${this.renderScenes()} ${this.renderFind()} ${this.renderCentral()}`} ${this.renderSwipe()}
${this.renderMenu()} ${this.renderPlate()} ${this.renderEye()} ${this.renderLock()} ${this.renderWalk()} ${this.renderTravel()} ${this.renderClock()} ${this.renderToday(e)} ${this.renderLayers()} ${this.renderPluginWindow()}
${this.showStats&&this._stats?p`<span class="nf-stats"
@@ -1848,7 +1848,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${$(this.hass,"stats",{calls:this._stats.calls,tris:this._stats.triangles.toLocaleString()})} ·
${$(this.hass,this._stats.low?"stats_low":"stats_full",{r:L(this.hass,this._stats.pixelRatio,2)})}</span
>`:f}
</div>`}static styles=[ve,He,Sc,J`
</div>`}static styles=[ve,He,Mc,J`
:host {
display: block;
position: relative;
@@ -3449,26 +3449,26 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
inset: auto 16px 16px;
color: var(--nf-danger);
}
`]};customElements.get("nf-view3d")||customElements.define("nf-view3d",ns);function he(n,e){return Math.abs(e)>=1e3?`${L(n,e/1e3,1)} kW`:`${Math.round(e)} W`}function ts(n){return n.type==="tv_board"?n.h+.9:n.type==="tv_wall"||n.type==="kitchen_wall"?n.h+.25:n.h+.35}function Qf(n,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:se(n,e)}var Vc;function Kc(){let n=new URL("./nextfloor-editor.js?v=b2a26935cefb",new URL(import.meta.url)).href;return Vc??=import(n),Vc}var Xf=.25,Gc=n=>Math.round(n*1e3)/1e3,Uc=(n,e,t)=>n.rooms.find(r=>r.points.length>=3&&H([e,t],r.points));function is(n,e,t,r,i){let o=Uc(n,e,t);if(!o)return[r,i];let s=(a,l)=>H([a,l],o.points);return s(r,i)?[r,i]:s(r,t)?[r,t]:s(e,i)?[e,i]:[e,t]}function eg(n,e,t,r){return n.rooms.some(i=>i.id!==e.id&&i.points.some((o,s)=>{let a=i.points[(s+1)%i.points.length];return Math.abs(ce(ee(o,t),r))<.02&&Math.abs(ce(ee(a,t),r))<.02}))}var rs=(n,e)=>Math.abs((n-e+540)%360-180);function jc(n,e,t,r=Xf){let i=Uc(n,e.x,e.z);if(!i)return null;let o=i.points,s=gt(o)>=0?1:-1,a=null;return o.forEach((l,u)=>{let c=o[(u+1)%o.length],h=qe(ee(c,l));if(h<.3)return;let m=[(c[0]-l[0])/h,(c[1]-l[1])/h],d=[-m[1]*s,m[0]*s],g=ce(ee([e.x,e.z],l),m);if(g<0||g>h)return;let _=eg(n,i,l,d)?t/2:0,b=ce(ee([e.x,e.z],l),d)-_,v=Math.atan2(-d[0],d[1])*180/Math.PI,k=[{rotation:v,extent:e.d/2},{rotation:v+90,extent:e.w/2},{rotation:v-90,extent:e.w/2}].reduce((z,R)=>rs(e.rotation,R.rotation)<rs(e.rotation,z.rotation)?R:z);if(rs(e.rotation,k.rotation)>50)return;let M=b-k.extent;Math.abs(M)>r||a&&Math.abs(M)>=Math.abs(a.gap)||(a={x:Gc(e.x-d[0]*M),z:Gc(e.z-d[1]*M),rotation:(Math.round(k.rotation)%360+360)%360,gap:M})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function ui(n,e,t){let r=structuredClone(n);for(let i of r.floors){let o=i.furniture.find(s=>s.id===e);o&&t(o,i)}return r}function ci(n,e,t){let r=structuredClone(n);for(let i of r.floors){let o=i.placements.find(s=>s.entity_id===e);o&&t(o,i)}return r}function qc(n,e){let t=structuredClone(n);for(let r of t.floors)r.furniture=r.furniture.filter(i=>i.id!==e);return t}function Zc(n,e){let t=structuredClone(n);for(let r of t.floors)r.placements=r.placements.filter(i=>i.entity_id!==e);return t}function Yc(n,e,t,r){return ci(n,e,(i,o)=>{[i.x,i.z]=is(o,i.x,i.z,t,r)})}function Jc(n,e,t,r){let i=n.settings.wall_interior??.12;return ui(n,e,(o,s)=>{[o.x,o.z]=is(s,o.x,o.z,t,r);let a=jc(s,o,i);a&&Object.assign(o,a)})}var os=(n,e)=>((n+e)%360+360)%360,Qc=n=>Number.parseFloat(n.replace(",",".")),Vn=(n,e)=>Math.round(n*10**e)/10**e;function ss(n){let{min:e,max:t,accepts:r=()=>!0}=n,i=o=>{let s=Qc(o.target.value);!Number.isFinite(s)||!r(s)||n.apply(t===void 0?s:Math.min(t,Math.max(e,s)))};return p`<label class="nf-size" title=${n.title}
`]};customElements.get("nf-view3d")||customElements.define("nf-view3d",rs);function he(n,e){return Math.abs(e)>=1e3?`${L(n,e/1e3,1)} kW`:`${Math.round(e)} W`}function ns(n){return n.type==="tv_board"?n.h+.9:n.type==="tv_wall"||n.type==="kitchen_wall"?n.h+.25:n.h+.35}function tg(n,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:se(n,e)}var Gc;function Uc(){let n=new URL("./nextfloor-editor.js?v=b932c2605f2b",new URL(import.meta.url)).href;return Gc??=import(n),Gc}var ng=.25,jc=n=>Math.round(n*1e3)/1e3,qc=(n,e,t)=>n.rooms.find(r=>r.points.length>=3&&H([e,t],r.points));function os(n,e,t,r,i){let o=qc(n,e,t);if(!o)return[r,i];let s=(a,l)=>H([a,l],o.points);return s(r,i)?[r,i]:s(r,t)?[r,t]:s(e,i)?[e,i]:[e,t]}function rg(n,e,t,r){return n.rooms.some(i=>i.id!==e.id&&i.points.some((o,s)=>{let a=i.points[(s+1)%i.points.length];return Math.abs(ce(ee(o,t),r))<.02&&Math.abs(ce(ee(a,t),r))<.02}))}var is=(n,e)=>Math.abs((n-e+540)%360-180);function Zc(n,e,t,r=ng){let i=qc(n,e.x,e.z);if(!i)return null;let o=i.points,s=gt(o)>=0?1:-1,a=null;return o.forEach((l,u)=>{let c=o[(u+1)%o.length],h=qe(ee(c,l));if(h<.3)return;let m=[(c[0]-l[0])/h,(c[1]-l[1])/h],d=[-m[1]*s,m[0]*s],g=ce(ee([e.x,e.z],l),m);if(g<0||g>h)return;let _=rg(n,i,l,d)?t/2:0,b=ce(ee([e.x,e.z],l),d)-_,v=Math.atan2(-d[0],d[1])*180/Math.PI,k=[{rotation:v,extent:e.d/2},{rotation:v+90,extent:e.w/2},{rotation:v-90,extent:e.w/2}].reduce((z,R)=>is(e.rotation,R.rotation)<is(e.rotation,z.rotation)?R:z);if(is(e.rotation,k.rotation)>50)return;let M=b-k.extent;Math.abs(M)>r||a&&Math.abs(M)>=Math.abs(a.gap)||(a={x:jc(e.x-d[0]*M),z:jc(e.z-d[1]*M),rotation:(Math.round(k.rotation)%360+360)%360,gap:M})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function ci(n,e,t){let r=structuredClone(n);for(let i of r.floors){let o=i.furniture.find(s=>s.id===e);o&&t(o,i)}return r}function di(n,e,t){let r=structuredClone(n);for(let i of r.floors){let o=i.placements.find(s=>s.entity_id===e);o&&t(o,i)}return r}function Yc(n,e){let t=structuredClone(n);for(let r of t.floors)r.furniture=r.furniture.filter(i=>i.id!==e);return t}function Jc(n,e){let t=structuredClone(n);for(let r of t.floors)r.placements=r.placements.filter(i=>i.entity_id!==e);return t}function Qc(n,e,t,r){return di(n,e,(i,o)=>{[i.x,i.z]=os(o,i.x,i.z,t,r)})}function Xc(n,e,t,r){let i=n.settings.wall_interior??.12;return ci(n,e,(o,s)=>{[o.x,o.z]=os(s,o.x,o.z,t,r);let a=Zc(s,o,i);a&&Object.assign(o,a)})}var ss=(n,e)=>((n+e)%360+360)%360,ed=n=>Number.parseFloat(n.replace(",",".")),Kn=(n,e)=>Math.round(n*10**e)/10**e;function as(n){let{min:e,max:t,accepts:r=()=>!0}=n,i=o=>{let s=ed(o.target.value);!Number.isFinite(s)||!r(s)||n.apply(t===void 0?s:Math.min(t,Math.max(e,s)))};return p`<label class="nf-size" title=${n.title}
>${n.label}
<input type="number" inputmode="decimal" step=${n.step} min=${e} max=${t??f} .value=${String(Vn(n.value,2))} @change=${i} />
</label>`}var ed=(n,e)=>p`<button class="nf-chip" @click=${e}>${n.t("height_auto")}</button>`,Xc=(n,e)=>p`<button class="nf-chip" @click=${()=>e(-n)}>↺ ${n}°</button><button class="nf-chip" @click=${()=>e(n)}>↻ ${n}°</button>`;function tg(n,e){let t=n.building.floors.find(s=>s.furniture.some(a=>a.id===e)),r=t?.furniture.find(s=>s.id===e);if(!t||!r)return f;let i=(s,a)=>ss({label:n.t(a),title:n.t(`size_${s}`),value:r[s],step:.05,min:.05,accepts:l=>l>0,apply:l=>n.editFurniture(e,u=>u[s]=Vn(l,3))}),o=sa(r)?p`${ss({label:"\u2195",title:n.t("mount_height"),value:r.mount_y??oe(t,r),step:.05,min:0,accepts:s=>s>=0,apply:s=>n.editFurniture(e,a=>a.mount_y=Vn(s,3))})}
${r.mount_y!=null?ed(n,()=>n.editFurniture(e,s=>s.mount_y=null)):f}`:f;return p`${i("w","size_short_w")}${i("d","size_short_d")}${i("h","size_short_h")} ${o}`}function ng(n,e){let t=n.building.floors.find(l=>l.placements.some(u=>u.entity_id===e)),r=t?.placements.find(l=>l.entity_id===e);if(!t||!r)return f;let i=P(e),o=(l,u,c)=>p`<select class="nf-size-select" title=${n.t(l)} @change=${h=>n.editDevice(e,m=>Object.assign(m,{mount:h.target.value,y:null}))}>
<input type="number" inputmode="decimal" step=${n.step} min=${e} max=${t??f} .value=${String(Kn(n.value,2))} @change=${i} />
</label>`}var nd=(n,e)=>p`<button class="nf-chip" @click=${e}>${n.t("height_auto")}</button>`,td=(n,e)=>p`<button class="nf-chip" @click=${()=>e(-n)}>↺ ${n}°</button><button class="nf-chip" @click=${()=>e(n)}>↻ ${n}°</button>`;function ig(n,e){let t=n.building.floors.find(s=>s.furniture.some(a=>a.id===e)),r=t?.furniture.find(s=>s.id===e);if(!t||!r)return f;let i=(s,a)=>as({label:n.t(a),title:n.t(`size_${s}`),value:r[s],step:.05,min:.05,accepts:l=>l>0,apply:l=>n.editFurniture(e,u=>u[s]=Kn(l,3))}),o=aa(r)?p`${as({label:"\u2195",title:n.t("mount_height"),value:r.mount_y??oe(t,r),step:.05,min:0,accepts:s=>s>=0,apply:s=>n.editFurniture(e,a=>a.mount_y=Kn(s,3))})}
${r.mount_y!=null?nd(n,()=>n.editFurniture(e,s=>s.mount_y=null)):f}`:f;return p`${i("w","size_short_w")}${i("d","size_short_d")}${i("h","size_short_h")} ${o}`}function og(n,e){let t=n.building.floors.find(l=>l.placements.some(u=>u.entity_id===e)),r=t?.placements.find(l=>l.entity_id===e);if(!t||!r)return f;let i=P(e),o=(l,u,c)=>p`<select class="nf-size-select" title=${n.t(l)} @change=${h=>n.editDevice(e,m=>Object.assign(m,{mount:h.target.value,y:null}))}>
${u.map(([h,m])=>p`<option value=${h} ?selected=${h===c}>${m}</option>`)}
</select>`,s=["ceiling","floor","table","wall"].map(l=>[l,n.t(`lamp_${l}`)]),a=i?Ht(i,xe(t,r.x,r.z),i==="light"?r.mount??"ceiling":null):1;return p`${i==="light"?o("lamp_mount",s,r.mount??"ceiling"):f}
${ss({label:n.t("size_short_h"),title:n.t("marker_height"),value:r.y??a,step:.05,min:0,accepts:l=>l>=0,apply:l=>n.editDevice(e,u=>u.y=Vn(l,3))})}
${r.y!==null?ed(n,()=>n.editDevice(e,l=>l.y=null)):f}`}function td(n,e,t){let r=n.t,i;if(e){let o=n.building.floors.flatMap(s=>s.furniture).find(s=>s.id===e)?.type;i=p`<span>${o?ae(n.hass,o):""}</span>
${tg(n,e)} ${Xc(45,s=>n.turnFurniture(e,s))}
${as({label:n.t("size_short_h"),title:n.t("marker_height"),value:r.y??a,step:.05,min:0,accepts:l=>l>=0,apply:l=>n.editDevice(e,u=>u.y=Kn(l,3))})}
${r.y!==null?nd(n,()=>n.editDevice(e,l=>l.y=null)):f}`}function rd(n,e,t){let r=n.t,i;if(e){let o=n.building.floors.flatMap(s=>s.furniture).find(s=>s.id===e)?.type;i=p`<span>${o?ae(n.hass,o):""}</span>
${ig(n,e)} ${td(45,s=>n.turnFurniture(e,s))}
<button class="nf-chip" title=${r("furn_mirror_hint")} @click=${()=>n.editFurniture(e,s=>s.mirror=!s.mirror)}>⇋ ${r("furn_mirror")}</button>
<button class="nf-chip nf-danger-chip" @click=${()=>n.removeFurniture(e)}>${r("delete")}</button>`}else t?i=p`<span>${O(n.hass,t)}</span>
${ng(n,t)} ${Xc(45,o=>n.turnDevice(t,o))}
<button class="nf-chip nf-danger-chip" @click=${()=>n.removeDevice(t)}>${r("delete")}</button>`:i=p`<span>${r("furnish_hint")}</span>`;return p`<div class="nf-furnish-bar">${i}<button class="nf-chip nf-chip-on" @click=${()=>n.finish()}>${r("done")}</button></div>`}var nd=ne`<svg class="nf-mark" viewBox="60 40 392 420" aria-hidden="true">
${og(n,t)} ${td(45,o=>n.turnDevice(t,o))}
<button class="nf-chip nf-danger-chip" @click=${()=>n.removeDevice(t)}>${r("delete")}</button>`:i=p`<span>${r("furnish_hint")}</span>`;return p`<div class="nf-furnish-bar">${i}<button class="nf-chip nf-chip-on" @click=${()=>n.finish()}>${r("done")}</button></div>`}var id=ne`<svg class="nf-mark" viewBox="60 40 392 420" aria-hidden="true">
<polygon points="106,150 256,66 406,150 256,234" fill="none" stroke="currentColor" stroke-opacity=".55" stroke-width="12" stroke-dasharray="6 22" stroke-linecap="round"/>
<polygon points="106,382 256,466 256,488 106,404" fill="#34507d"/><polygon points="406,382 256,466 256,488 406,404" fill="#2a4068"/><polygon points="106,382 256,298 406,382 256,466" fill="#5f7fb6"/>
<polygon points="106,310 256,394 256,416 106,332" fill="#4a72b8"/><polygon points="406,310 256,394 256,416 406,332" fill="#3b5c98"/><polygon points="106,310 256,226 406,310 256,394" fill="#8ab6f5"/>
<polygon points="106,238 256,322 256,344 106,260" fill="#2a74d8"/><polygon points="406,238 256,322 256,344 406,260" fill="#2161b8"/><polygon points="106,238 256,154 406,238 256,322" fill="#4fb6ff"/>
<circle cx="256" cy="236" r="16" fill="#ffe08a"/>
</svg>`;var me=(n,e)=>({name:n,fallback:e,read:t=>e?t!=="0":t==="1",write:t=>t?"1":"0"}),en=(n,e,t)=>({name:n,fallback:t,read:r=>e.find(i=>i===r)??t,write:r=>r}),as={explode:me("explode",!0),keepRoof:me("roof",!1),solidWalls:me("solid_walls",!1),quality:en("quality",["auto","low","high"],"auto"),stats:me("stats",!1),markers:en("markers",["none","important","all"],"important"),heat:en("heat",["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],"none"),theme:en("theme",Yr,"neon"),clock:en("clock",["none","top_left","top_right","bottom_left","bottom_right"],"none"),accent:{name:"accent",fallback:null,read:n=>/^#[0-9a-f]{6}$/i.test(n)?n:null,write:n=>n??""},floorStack:en("floor_stack",["dim","stacked","single"],"dim"),roomNames:me("room_names",!0),clean:me("clean",!1),navWrap:me("nav_wrap",!1),weather:me("weather",!0),timeSlider:me("time_slider",!1),menuOpen:me("menu_open",!1),keepCamera:me("keep_camera",!1),readable:me("readable",!1),plain:me("plain",!1),rightBack:me("right_back",!1),zoom:{name:"zoom",fallback:100,read:n=>/^\d{2,3}$/.test(n)?Math.min(250,Math.max(60,Number(n))):100,write:n=>String(Math.round(Math.min(250,Math.max(60,n))))},screenName:{name:"screen_name",fallback:"",read:n=>n.slice(0,60),write:n=>n.trim().slice(0,60)},announceMuted:me("announce_muted",!1),glassWalls:{name:"glass_walls",fallback:20,read:n=>/^\d{1,3}$/.test(n)?Math.min(100,Number(n)):20,write:n=>String(Math.round(Math.min(100,Math.max(0,n))))}};function rd(n=hi()){try{return n?.getItem("nextfloor.screen_name")?.trim()||null}catch{return null}}function id(n=hi()){try{return n?.getItem("nextfloor.announce_muted")==="1"}catch{return!1}}function hi(){try{return localStorage}catch{return null}}var di=class{storage;constructor(e){this.storage=e}raw(e){try{return this.storage?.getItem(`nextfloor.${e}`)??null}catch{return null}}load(e=""){let t={};for(let r of Object.keys(as)){let i=as[r],o=this.raw(i.name);t[r]=o===null?i.fallback:i.read(o)}return new URLSearchParams(e).has("nf_stats")&&(t.stats=!0),t}save(e,t){let r=as[e];try{this.storage?.setItem(`nextfloor.${r.name}`,r.write(t))}catch{}}};var od=J`
</svg>`;var me=(n,e)=>({name:n,fallback:e,read:t=>e?t!=="0":t==="1",write:t=>t?"1":"0"}),en=(n,e,t)=>({name:n,fallback:t,read:r=>e.find(i=>i===r)??t,write:r=>r}),ls={explode:me("explode",!0),keepRoof:me("roof",!1),solidWalls:me("solid_walls",!1),quality:en("quality",["auto","low","high"],"auto"),stats:me("stats",!1),markers:en("markers",["none","important","all"],"important"),heat:en("heat",["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],"none"),theme:en("theme",Jr,"neon"),clock:en("clock",["none","top_left","top_right","bottom_left","bottom_right"],"none"),accent:{name:"accent",fallback:null,read:n=>/^#[0-9a-f]{6}$/i.test(n)?n:null,write:n=>n??""},floorStack:en("floor_stack",["dim","stacked","single"],"dim"),roomNames:me("room_names",!0),clean:me("clean",!1),navWrap:me("nav_wrap",!1),weather:me("weather",!0),timeSlider:me("time_slider",!1),menuOpen:me("menu_open",!1),keepCamera:me("keep_camera",!1),readable:me("readable",!1),plain:me("plain",!1),rightBack:me("right_back",!1),zoom:{name:"zoom",fallback:100,read:n=>/^\d{2,3}$/.test(n)?Math.min(250,Math.max(60,Number(n))):100,write:n=>String(Math.round(Math.min(250,Math.max(60,n))))},screenName:{name:"screen_name",fallback:"",read:n=>n.slice(0,60),write:n=>n.trim().slice(0,60)},announceMuted:me("announce_muted",!1),glassWalls:{name:"glass_walls",fallback:20,read:n=>/^\d{1,3}$/.test(n)?Math.min(100,Number(n)):20,write:n=>String(Math.round(Math.min(100,Math.max(0,n))))}};function od(n=mi()){try{return n?.getItem("nextfloor.screen_name")?.trim()||null}catch{return null}}function sd(n=mi()){try{return n?.getItem("nextfloor.announce_muted")==="1"}catch{return!1}}function mi(){try{return localStorage}catch{return null}}var hi=class{storage;constructor(e){this.storage=e}raw(e){try{return this.storage?.getItem(`nextfloor.${e}`)??null}catch{return null}}load(e=""){let t={};for(let r of Object.keys(ls)){let i=ls[r],o=this.raw(i.name);t[r]=o===null?i.fallback:i.read(o)}return new URLSearchParams(e).has("nf_stats")&&(t.stats=!0),t}save(e,t){let r=ls[e];try{this.storage?.setItem(`nextfloor.${r.name}`,r.write(t))}catch{}}};var ad=J`
.nf-dot {
display: inline-block;
width: 8px;
@@ -3960,11 +3960,11 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
gap: 12px;
margin: auto;
}
`;var sd=new WeakMap,ad=new WeakMap;function St(n,e){let t=ad.get(n)??n,r=sd.get(t)??new WeakMap;sd.set(t,r);let i=r.get(e);if(i)return i;let o=new Map;for(let l of e)for(let u of l.placements)u.entity_id.startsWith("cover.")&&o.set(u.entity_id,{tilt:u.cover_tilt==="none"?null:u.cover_tilt,position:u.position});for(let l of Be(t,e).values())l.cover&&!o.has(l.cover)&&o.set(l.cover,{tilt:l.coverTilt,position:l.position}),l.cover2&&!o.has(l.cover2)&&o.set(l.cover2,{tilt:l.cover2Tilt});let s={...t.states};for(let[l,u]of o){let c=t.states[l];if(!c)continue;let h={...c.attributes,nf_cover_control:!0},m=Pt(t,u.position);m===null&&(m=typeof c.attributes.current_position=="number"?c.attributes.current_position:null),m!==null&&(h.current_position=m);let d=u.tilt?t.states[u.tilt]:c,g=typeof d?.attributes.current_tilt_position=="number"?d.attributes.current_tilt_position:u.tilt?Pt(t,u.tilt):null;g!==null&&(h.current_tilt_position=g,h.supported_features=Number(h.supported_features??0)|128);let _=c.state;typeof h.current_position=="number"&&_!=="unavailable"&&_!=="unknown"&&_!=="opening"&&_!=="closing"&&(_=h.current_position>0?"open":"closed"),s[l]={...c,state:_,attributes:h}}let a={...t,states:s,callService:async(l,u,c={})=>{if(l!=="cover")return t.callService(l,u,c);let h=Array.isArray(c.entity_id)?c.entity_id:[c.entity_id],m=async d=>{let g=typeof d=="string"?o.get(d):void 0;if(!g)return t.callService(l,u,{...c,entity_id:d});let _={...c,entity_id:d},b=u;(b==="toggle"||b==="toggle_cover")&&(b=s[String(d)]?.state==="closed"?"open_cover":"close_cover");let v=b.includes("tilt");v&&g.tilt&&(_.entity_id=g.tilt);let S=g.tilt?t.states[g.tilt]:void 0;return v&&g.tilt&&!S?.attributes.symcon_id&&typeof S?.attributes.current_tilt_position!="number"&&(b==="set_cover_tilt_position"?(b="set_cover_position",_.position=_.tilt_position,delete _.tilt_position):b==="open_cover_tilt"?b="open_cover":b==="close_cover_tilt"&&(b="close_cover")),t.callService(l,b,_)};return Array.isArray(c.entity_id)?Promise.all(h.map(m)):m(h[0])}};return ad.set(a,t),r.set(e,a),a}var ls=class extends Q{static properties={hass:{attribute:!1},narrow:{type:Boolean},route:{attribute:!1},panel:{attribute:!1},_mode:{state:!0},_editorReady:{state:!0},_floorId:{state:!0},_roomId:{state:!0},_wallMode:{state:!0},_prefs:{state:!0},_furnish:{state:!0},_selFurniture:{state:!0},_selDevice:{state:!0},_optsOpen:{state:!0},_switchesOpen:{state:!0},_timeOfDay:{state:!0},_outside:{state:!0},_timeDrag:{state:!0},_floorUndo:{state:!0},_variablesLoading:{state:!0},_variablesNotice:{state:!0},_variablesError:{state:!0}};outsideMemo=null;floorUndoTimer;data=new Ft(this);store=new di(hi());constructor(){super(),this.narrow=!1,this._mode="view",this._editorReady=!!customElements.get("nf-editor"),this._floorId=null,this._roomId=null,this._wallMode="auto",this._prefs=this.store.load(location.search),this._furnish=!1,this._selFurniture=null,this._selDevice=null,this._optsOpen=!1,this._switchesOpen=!1,this._timeOfDay=null,this._outside=!1,this._timeDrag=null,this._floorUndo=null,this._variablesLoading=!1,this._variablesNotice="",this._variablesError=!1}toggleTimeSlider(e){this.setPref("timeSlider",e),e||([this._timeOfDay,this._timeDrag]=[null,null])}sunState(){let e=this.hass?.config;return this._timeOfDay===null||e?.latitude===void 0||e.longitude===void 0?this.hass?.states["sun.sun"]?.state:ft(Et(this._timeOfDay,e.time_zone),e.latitude,e.longitude).elevation>0?"above_horizon":"below_horizon"}renderTimeOfDay(){let e=this.t;if(this.hass?.config?.latitude===void 0)return f;let t=this._timeDrag??this._timeOfDay,r=o=>`${String(Math.floor(o)).padStart(2,"0")}:${String(Math.round(o%1*60)).padStart(2,"0")}`,i=()=>{let o=new Date;return Math.round((o.getHours()+o.getMinutes()/60)*4)/4};return p`<button class="nf-chip" aria-pressed=${t!==null} title=${e("time_of_day_hint")} @click=${()=>(this._timeDrag=null,this._timeOfDay=t===null?i():null)}>☀ ${t===null?e("time_of_day"):r(t)}</button>
`;var ld=new WeakMap,ud=new WeakMap;function St(n,e){let t=ud.get(n)??n,r=ld.get(t)??new WeakMap;ld.set(t,r);let i=r.get(e);if(i)return i;let o=new Map;for(let l of e)for(let u of l.placements)u.entity_id.startsWith("cover.")&&o.set(u.entity_id,{tilt:u.cover_tilt==="none"?null:u.cover_tilt,position:u.position});for(let l of Be(t,e).values())l.cover&&!o.has(l.cover)&&o.set(l.cover,{tilt:l.coverTilt,position:l.position}),l.cover2&&!o.has(l.cover2)&&o.set(l.cover2,{tilt:l.cover2Tilt});let s={...t.states};for(let[l,u]of o){let c=t.states[l];if(!c)continue;let h={...c.attributes,nf_cover_control:!0},m=Pt(t,u.position);m===null&&(m=typeof c.attributes.current_position=="number"?c.attributes.current_position:null),m!==null&&(h.current_position=m);let d=u.tilt?t.states[u.tilt]:c,g=typeof d?.attributes.current_tilt_position=="number"?d.attributes.current_tilt_position:u.tilt?Pt(t,u.tilt):null;g!==null&&(h.current_tilt_position=g,h.supported_features=Number(h.supported_features??0)|128);let _=c.state;typeof h.current_position=="number"&&_!=="unavailable"&&_!=="unknown"&&_!=="opening"&&_!=="closing"&&(_=h.current_position>0?"open":"closed"),s[l]={...c,state:_,attributes:h}}let a={...t,states:s,callService:async(l,u,c={})=>{if(l!=="cover")return t.callService(l,u,c);let h=Array.isArray(c.entity_id)?c.entity_id:[c.entity_id],m=async d=>{let g=typeof d=="string"?o.get(d):void 0;if(!g)return t.callService(l,u,{...c,entity_id:d});let _={...c,entity_id:d},b=u;(b==="toggle"||b==="toggle_cover")&&(b=s[String(d)]?.state==="closed"?"open_cover":"close_cover");let v=b.includes("tilt");v&&g.tilt&&(_.entity_id=g.tilt);let S=g.tilt?t.states[g.tilt]:void 0;return v&&g.tilt&&!S?.attributes.symcon_id&&typeof S?.attributes.current_tilt_position!="number"&&(b==="set_cover_tilt_position"?(b="set_cover_position",_.position=_.tilt_position,delete _.tilt_position):b==="open_cover_tilt"?b="open_cover":b==="close_cover_tilt"&&(b="close_cover")),t.callService(l,b,_)};return Array.isArray(c.entity_id)?Promise.all(h.map(m)):m(h[0])}};return ud.set(a,t),r.set(e,a),a}var us=class extends Q{static properties={hass:{attribute:!1},narrow:{type:Boolean},route:{attribute:!1},panel:{attribute:!1},_mode:{state:!0},_editorReady:{state:!0},_floorId:{state:!0},_roomId:{state:!0},_wallMode:{state:!0},_prefs:{state:!0},_furnish:{state:!0},_selFurniture:{state:!0},_selDevice:{state:!0},_optsOpen:{state:!0},_switchesOpen:{state:!0},_timeOfDay:{state:!0},_outside:{state:!0},_timeDrag:{state:!0},_floorUndo:{state:!0},_variablesLoading:{state:!0},_variablesNotice:{state:!0},_variablesError:{state:!0}};outsideMemo=null;floorUndoTimer;data=new Ft(this);store=new hi(mi());constructor(){super(),this.narrow=!1,this._mode="view",this._editorReady=!!customElements.get("nf-editor"),this._floorId=null,this._roomId=null,this._wallMode="auto",this._prefs=this.store.load(location.search),this._furnish=!1,this._selFurniture=null,this._selDevice=null,this._optsOpen=!1,this._switchesOpen=!1,this._timeOfDay=null,this._outside=!1,this._timeDrag=null,this._floorUndo=null,this._variablesLoading=!1,this._variablesNotice="",this._variablesError=!1}toggleTimeSlider(e){this.setPref("timeSlider",e),e||([this._timeOfDay,this._timeDrag]=[null,null])}sunState(){let e=this.hass?.config;return this._timeOfDay===null||e?.latitude===void 0||e.longitude===void 0?this.hass?.states["sun.sun"]?.state:ft(Et(this._timeOfDay,e.time_zone),e.latitude,e.longitude).elevation>0?"above_horizon":"below_horizon"}renderTimeOfDay(){let e=this.t;if(this.hass?.config?.latitude===void 0)return f;let t=this._timeDrag??this._timeOfDay,r=o=>`${String(Math.floor(o)).padStart(2,"0")}:${String(Math.round(o%1*60)).padStart(2,"0")}`,i=()=>{let o=new Date;return Math.round((o.getHours()+o.getMinutes()/60)*4)/4};return p`<button class="nf-chip" aria-pressed=${t!==null} title=${e("time_of_day_hint")} @click=${()=>(this._timeDrag=null,this._timeOfDay=t===null?i():null)}>☀ ${t===null?e("time_of_day"):r(t)}</button>
${t!==null?p`<label class="nf-chip nf-time-slider"
><input type="range" min="0" max="23.75" step="0.25" .value=${String(t)} aria-label=${e("time_of_day")} @input=${o=>this._timeDrag=Number(o.target.value)}
@change=${o=>(this._timeDrag=null,this._timeOfDay=Number(o.target.value))}
/></label>`:f}`}t=(e,t)=>$(this.hass,e,t);setPref(e,t){this._prefs={...this._prefs,[e]:t},this.store.save(e,t)}willUpdate(e){this.toggleAttribute("readable",!!this._prefs?.readable),e.has("hass")&&this.hass&&(this.style.colorScheme=zr(this.hass),this.data.setHass(this.hass));let t=this.data.building;t&&this._floorId&&!t.floors.some(r=>r.id===this._floorId)&&(this._floorId=null,this._roomId=null)}get isAdmin(){return this.hass?.user?.is_admin??!1}setMode(e){e!==this._mode&&(e==="view"&&this.data.flush(),this._mode=e)}openFloor(e){this._floorId=e,this._roomId=null,this._outside=!1}outsideIds(e){let t=this.outsideMemo;if(t&&t.building===e&&t.entities===this.hass.entities)return t.ids;let r=gn(this.hass,e.floors,e.settings.outside_hidden);return this.outsideMemo={building:e,entities:this.hass.entities,ids:r},r}openOutside(){let e=!this._outside;this.openFloor(null),this._outside=e}onRoomTap(e){let{floorId:t,roomId:r}=e.detail;if(r==="nf-outside")return this.openOutside();if((this.data.building?.floors.length??0)>1&&t&&this._floorId!==t)return this.openFloor(t);r&&(this._roomId=r===this._roomId?null:r,this._outside=!1)}furnishHost={hass:void 0,building:void 0,t:this.t,editFurniture:(e,t)=>this.applyEdit(r=>ui(r,e,t)),editDevice:(e,t)=>this.applyEdit(r=>ci(r,e,t)),turnFurniture:(e,t)=>this.applyEdit(r=>ui(r,e,i=>i.rotation=os(i.rotation,t))),turnDevice:(e,t)=>this.applyEdit(r=>ci(r,e,i=>i.rotation=os(i.rotation??0,t))),removeFurniture:e=>{this.applyEdit(t=>qc(t,e)),this._selFurniture=null},removeDevice:e=>{this.applyEdit(t=>Zc(t,e)),this._selDevice=null},finish:()=>{this._furnish=!1,this._selFurniture=null,this._selDevice=null}};saveMoods(e,t){this.applyEdit(r=>({...r,floors:r.floors.map(i=>({...i,rooms:i.rooms.map(o=>o.id===e?{...o,moods:t.length?t:void 0}:o)}))}))}applyEdit(e){let t=this.data.building;t&&this.data.edit(e(t))}view3d(){return this.renderRoot.querySelector("nf-view3d")}back(){this._outside?this._outside=!1:this._roomId?this._roomId=null:this._floorId&&(this.data.building?.floors.length??0)>1?this._floorId=null:this.view3d()?.resetView()}onKey=e=>{e.key!=="Escape"||this._mode!=="view"||(this._prefs.clean?this.setPref("clean",!1):this.back())};connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this.onKey)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this.onKey)}render(){if(this.hass&&Sr(this.hass,this))return f;let e=this.data.building,t=this._prefs.clean&&this._mode==="view",r=f;return e&&(this._mode==="editor"&&this.isAdmin?r=this.renderEditor(e):this._mode==="extensions"&&this.isAdmin?r=this.renderExtensions():r=this.renderView(e)),p`<div class="nf-app ${t?"nf-clean":""}" style=${this._prefs.accent?`--nf-accent:${this._prefs.accent}`:""}>
/></label>`:f}`}t=(e,t)=>$(this.hass,e,t);setPref(e,t){this._prefs={...this._prefs,[e]:t},this.store.save(e,t)}willUpdate(e){this.toggleAttribute("readable",!!this._prefs?.readable),e.has("hass")&&this.hass&&(this.style.colorScheme=Tr(this.hass),this.data.setHass(this.hass));let t=this.data.building;t&&this._floorId&&!t.floors.some(r=>r.id===this._floorId)&&(this._floorId=null,this._roomId=null)}get isAdmin(){return this.hass?.user?.is_admin??!1}setMode(e){e!==this._mode&&(e==="view"&&this.data.flush(),this._mode=e)}openFloor(e){this._floorId=e,this._roomId=null,this._outside=!1}outsideIds(e){let t=this.outsideMemo;if(t&&t.building===e&&t.entities===this.hass.entities)return t.ids;let r=gn(this.hass,e.floors,e.settings.outside_hidden);return this.outsideMemo={building:e,entities:this.hass.entities,ids:r},r}openOutside(){let e=!this._outside;this.openFloor(null),this._outside=e}onRoomTap(e){let{floorId:t,roomId:r}=e.detail;if(r==="nf-outside")return this.openOutside();if((this.data.building?.floors.length??0)>1&&t&&this._floorId!==t)return this.openFloor(t);r&&(this._roomId=r===this._roomId?null:r,this._outside=!1)}furnishHost={hass:void 0,building:void 0,t:this.t,editFurniture:(e,t)=>this.applyEdit(r=>ci(r,e,t)),editDevice:(e,t)=>this.applyEdit(r=>di(r,e,t)),turnFurniture:(e,t)=>this.applyEdit(r=>ci(r,e,i=>i.rotation=ss(i.rotation,t))),turnDevice:(e,t)=>this.applyEdit(r=>di(r,e,i=>i.rotation=ss(i.rotation??0,t))),removeFurniture:e=>{this.applyEdit(t=>Yc(t,e)),this._selFurniture=null},removeDevice:e=>{this.applyEdit(t=>Jc(t,e)),this._selDevice=null},finish:()=>{this._furnish=!1,this._selFurniture=null,this._selDevice=null}};saveMoods(e,t){this.applyEdit(r=>({...r,floors:r.floors.map(i=>({...i,rooms:i.rooms.map(o=>o.id===e?{...o,moods:t.length?t:void 0}:o)}))}))}applyEdit(e){let t=this.data.building;t&&this.data.edit(e(t))}view3d(){return this.renderRoot.querySelector("nf-view3d")}back(){this._outside?this._outside=!1:this._roomId?this._roomId=null:this._floorId&&(this.data.building?.floors.length??0)>1?this._floorId=null:this.view3d()?.resetView()}onKey=e=>{e.key!=="Escape"||this._mode!=="view"||(this._prefs.clean?this.setPref("clean",!1):this.back())};connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this.onKey)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this.onKey)}render(){if(this.hass&&$r(this.hass,this))return f;let e=this.data.building,t=this._prefs.clean&&this._mode==="view",r=f;return e&&(this._mode==="editor"&&this.isAdmin?r=this.renderEditor(e):this._mode==="extensions"&&this.isAdmin?r=this.renderExtensions():r=this.renderView(e)),p`<div class="nf-app ${t?"nf-clean":""}" style=${this._prefs.accent?`--nf-accent:${this._prefs.accent}`:""}>
${t?f:p`${this.renderHeader(e)}${this.renderNotices()}`}
${this.data.error&&!e?p`<p class="nf-message">${this.t("load_error")}: ${this.data.error}</p>`:f}
${!e&&!this.data.error?p`<p class="nf-message">${this.t("loading")}</p>`:f}
@@ -3977,7 +3977,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
</label>`}renderViewOptions(){let e=this._prefs;return p`<button class="nf-opts-btn" aria-expanded=${this._optsOpen} title=${this.t("view_options")} aria-label=${this.t("view_options")} @click=${()=>this._optsOpen=!this._optsOpen}>⚙</button>
<div class="nf-view-opts ${this._optsOpen?"nf-opts-open":""}">
${this.choiceRow("quality",["auto","low","high"],e.quality,t=>this.t(`quality_${t}`),t=>this.setPref("quality",t))}
${this.choiceRow("theme",Yr,e.theme,t=>this.t(`theme_${t}`),t=>this.setPref("theme",t),this.accentPicker())}
${this.choiceRow("theme",Jr,e.theme,t=>this.t(`theme_${t}`),t=>this.setPref("theme",t),this.accentPicker())}
${this.choiceRow("markers",["none","important","all"],e.markers,t=>this.t(`markers_${t}`),t=>this.setPref("markers",t))}
<label class="nf-seg nf-clock-pick" title=${this.t("clock")}
>🕒
@@ -4016,7 +4016,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
</div>
</div>`}async reloadVariables(){if(!(this._variablesLoading||!this.hass.symconRefresh)){this._variablesLoading=!0,this._variablesNotice="",this._variablesError=!1;try{await this.hass.symconRefresh(),this._variablesNotice=this.t("symcon_variables_loaded")}catch(e){this._variablesError=!0,this._variablesNotice=this.t("symcon_variables_error",{error:e instanceof Error?e.message:String(e)})}finally{this._variablesLoading=!1}}}renderHeader(e){let t=this.hass?.symconTitle?.trim()||"NextFloor",r=this.data.saveState,i=(s,a,l="")=>p`<button role="tab" class=${l} aria-pressed=${this._mode===s} @click=${()=>this.setMode(s)}>${a}</button>`,o=r==="saving"?"saving":r==="saved"?"saved":"save_error";return p`<header class="nf-header">
<ha-menu-button .hass=${this.hass} .narrow=${this.narrow}></ha-menu-button>
<h1 title=${t}>${nd}<span class="nf-view-title">${t}</span></h1>
<h1 title=${t}>${id}<span class="nf-view-title">${t}</span></h1>
${this.isAdmin?p`<div class="nf-seg" role="tablist">${i("view",this.t("view"))}${i("editor",this.t("editor"))}${i("extensions",`\u2726 ${this.t("ext_tab")}`,"nf-tab-ext")}</div>`:f}
<span class="nf-grow"></span>
${this._mode==="view"&&e?.floors.some(s=>s.rooms.length)?p`<button class="nf-chip nf-room-names-toggle" aria-pressed=${this._prefs.roomNames} title=${this.t("room_names_toggle_hint")} @click=${()=>this.setPref("roomNames",!this._prefs.roomNames)}>${this.t("room_names_short")}</button>`:f}
@@ -4031,7 +4031,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
<span>${this.t("draft_found",{time:r})}</span>
<button class="nf-btn nf-primary" @click=${()=>e.restoreDraft()}>${this.t("draft_restore")}</button>
<button class="nf-btn" @click=${()=>e.discardDraft()}>${this.t("draft_discard")}</button>
</div>`)}return t.length>0?p`<div class="nf-notices">${t}</div>`:f}whenEditorLoaded(e){return this._editorReady?e():(Kc().then(()=>this._editorReady=!0,t=>this.data.error=String(t)),p`<div class="nf-empty"><p>${this.t("loading")}</p></div>`)}renderExtensions(){return this.whenEditorLoaded(()=>p`<nf-extensions class="nf-body" .hass=${this.hass} .packs=${this.data.packs} .plugins=${this.data.building?.settings.plugins??[]}
</div>`)}return t.length>0?p`<div class="nf-notices">${t}</div>`:f}whenEditorLoaded(e){return this._editorReady?e():(Uc().then(()=>this._editorReady=!0,t=>this.data.error=String(t)),p`<div class="nf-empty"><p>${this.t("loading")}</p></div>`)}renderExtensions(){return this.whenEditorLoaded(()=>p`<nf-extensions class="nf-body" .hass=${this.hass} .packs=${this.data.packs} .plugins=${this.data.building?.settings.plugins??[]}
@packs-changed=${()=>{this.data.reloadPacks()}}
@plugins-changed=${e=>this.applyEdit(t=>({...t,settings:{...t.settings,plugins:e.detail}}))}></nf-extensions>`)}renderEditor(e){return this.whenEditorLoaded(()=>p`<nf-editor
class="nf-body"
@@ -4041,10 +4041,10 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.roomLabels=${this._prefs.roomNames}
@room-names-change=${t=>this.setPref("roomNames",t.detail.value)}
.packs=${this.data.packs}
.loadCardEditor=${Zn}
.loadCardEditor=${Yn}
@packs-changed=${()=>{this.data.reloadPacks()}}
@building-changed=${t=>this.data.edit(t.detail.building)}
></nf-editor>`)}onNavWheel=e=>{if(this._prefs.navWrap||!e.deltaY||e.deltaX)return;let t=e.currentTarget;t.scrollWidth<=t.clientWidth||(t.scrollLeft+=e.deltaY,e.preventDefault())};allOffChip(e){let t=this._floorId?e.floors.find(i=>i.id===this._floorId):e.floors.length===1?e.floors[0]:void 0;if(!t||!this.hass)return f;if(this._floorUndo){let i=this._floorUndo;return p`<button class="nf-chip" aria-pressed="true" @click=${()=>{for(let o of i)this.hass.callService(o.domain,o.service,o.data);this._floorUndo=null,clearTimeout(this.floorUndoTimer)}}>↶ ${this.t("all_off_undo")}</button>`}let r=An(au(t).map(i=>this.hass.states[i]));return r.count<2?f:p`<button class="nf-chip" title=${this.t("all_off_floor",{floor:t.name,n:r.count})} @click=${()=>{for(let i of r.off)this.hass.callService(i.domain,i.service,i.data);this._floorUndo=r.undo,clearTimeout(this.floorUndoTimer),this.floorUndoTimer=setTimeout(()=>this._floorUndo=null,1e4)}}>⏻ ${r.count}</button>`}renderNav(e){let t=e.floors.filter(u=>!this._floorId||u.id===this._floorId),r=e.floors.length>1,i=this._prefs.navWrap,o=this.outsideIds(e).length?p`<button class="nf-chip" aria-pressed=${this._outside} title=${this.t("outside_area_hint")} @click=${()=>this.openOutside()}>🌳 ${this.t("outside_area")}</button>`:f,s=r?p`<button class="nf-chip" aria-pressed=${this._floorId===null} @click=${()=>this.openFloor(null)}>${this.t("all_floors")}</button>
></nf-editor>`)}onNavWheel=e=>{if(this._prefs.navWrap||!e.deltaY||e.deltaX)return;let t=e.currentTarget;t.scrollWidth<=t.clientWidth||(t.scrollLeft+=e.deltaY,e.preventDefault())};allOffChip(e){let t=this._floorId?e.floors.find(i=>i.id===this._floorId):e.floors.length===1?e.floors[0]:void 0;if(!t||!this.hass)return f;if(this._floorUndo){let i=this._floorUndo;return p`<button class="nf-chip" aria-pressed="true" @click=${()=>{for(let o of i)this.hass.callService(o.domain,o.service,o.data);this._floorUndo=null,clearTimeout(this.floorUndoTimer)}}>↶ ${this.t("all_off_undo")}</button>`}let r=En(uu(t).map(i=>this.hass.states[i]));return r.count<2?f:p`<button class="nf-chip" title=${this.t("all_off_floor",{floor:t.name,n:r.count})} @click=${()=>{for(let i of r.off)this.hass.callService(i.domain,i.service,i.data);this._floorUndo=r.undo,clearTimeout(this.floorUndoTimer),this.floorUndoTimer=setTimeout(()=>this._floorUndo=null,1e4)}}>⏻ ${r.count}</button>`}renderNav(e){let t=e.floors.filter(u=>!this._floorId||u.id===this._floorId),r=e.floors.length>1,i=this._prefs.navWrap,o=this.outsideIds(e).length?p`<button class="nf-chip" aria-pressed=${this._outside} title=${this.t("outside_area_hint")} @click=${()=>this.openOutside()}>🌳 ${this.t("outside_area")}</button>`:f,s=r?p`<button class="nf-chip" aria-pressed=${this._floorId===null} @click=${()=>this.openFloor(null)}>${this.t("all_floors")}</button>
${[...e.floors].reverse().map(u=>p`<button class="nf-chip" aria-pressed=${u.id===this._floorId} @click=${()=>this.openFloor(u.id)}>${u.name}</button>`)}
${o} ${this.allOffChip(e)}
<span class="nf-sep"></span>`:p`${o} ${this.allOffChip(e)}`,a=t.flatMap(u=>[t.length>1&&u.rooms.length?p`<span class="nf-nav-floor">${u.name}</span>`:f,...u.rooms.map(c=>p`<button
@@ -4085,7 +4085,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
<div class="nf-stage-wrap ${this._roomId?"nf-room-open":""}">
<nf-view3d
class="nf-body"
.hass=${li(St(this.hass,e.floors),e.settings)}
.hass=${ui(St(this.hass,e.floors),e.settings)}
.building=${e}
.packs=${this.data.packs}
.floorStack=${t.floorStack}
@@ -4104,7 +4104,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.keepRoof=${t.keepRoof}
.markerMode=${t.markers}
.heatMode=${t.heat}
.theme=${Jr(t.theme,this.sunState())}
.theme=${Qr(t.theme,this.sunState())}
.timeOfDay=${this._timeOfDay}
.clock=${t.clock==="none"?null:t.clock}
.announcements=${!V(this.hass)&&!t.announceMuted}
@@ -4123,9 +4123,9 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
?furnish=${this._furnish}
.selectedFurniture=${this._selFurniture}
@furniture-select=${i=>this._selFurniture=i.detail.id}
@furniture-move=${i=>this.applyEdit(o=>Jc(o,i.detail.id,i.detail.x,i.detail.z))}
@furniture-move=${i=>this.applyEdit(o=>Xc(o,i.detail.id,i.detail.x,i.detail.z))}
@device-select=${i=>this._selDevice=i.detail.id}
@device-move=${i=>this.applyEdit(o=>Yc(o,i.detail.id,i.detail.x,i.detail.z))}
@device-move=${i=>this.applyEdit(o=>Qc(o,i.detail.id,i.detail.x,i.detail.z))}
.quality=${t.quality}
?showStats=${t.stats}
@room-tap=${this.onRoomTap}
@@ -4154,9 +4154,9 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
@close=${()=>this._outside=!1}
></nf-room-panel>`:f}
${t.clean?f:this.renderOverlay(e)}
${this._furnish?td(this.furnishHost,this._selFurniture,this._selDevice):f}
${this._furnish?rd(this.furnishHost,this._selFurniture,this._selDevice):f}
</div>
`}static styles=[ve,He,od,Rr]};customElements.get("nextfloor-panel")||customElements.define("nextfloor-panel",ls);var rg=/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/,ld=(n,e)=>Number(n)*60+Number(e);function Kn(n,e,t=new Date){if(!n||n==="off")return!1;if(n==="sun")return e?.states["sun.sun"]?.state==="below_horizon";let r=rg.exec(n.trim());if(!r)return!1;let i=ld(r[1],r[2]),o=ld(r[3],r[4]),s=t.getHours()*60+t.getMinutes();return i>o?s>=i||s<o:s>=i&&s<o}var mi=class{host;cleanTimer;idleTimer;nightTimer;constructor(e){this.host=e}armClean(e=!1){clearTimeout(this.cleanTimer);let t=this.host.config()?.controls_hide_after??0;t>0&&(e&&this.host.isClean()&&this.host.setClean(!1),this.cleanTimer=setTimeout(()=>this.host.setClean(!0),t*1e3))}stopClean(){clearTimeout(this.cleanTimer)}armIdle(){clearTimeout(this.idleTimer);let e=this.host.config()?.idle_return??0;e>0&&(this.idleTimer=setTimeout(()=>this.host.goHome(),e*1e3))}touched(){this.host.isOrbit()&&this.host.setOrbit(!1),this.armIdle(),this.armClean(!0)}start(){this.armIdle(),this.nightTimer=setInterval(()=>this.host.setNight(Kn(this.host.config()?.night,this.host.hass())),6e4)}stop(){clearTimeout(this.cleanTimer),clearTimeout(this.idleTimer),clearInterval(this.nightTimer)}};function ud(n,e){return n?n.floors.filter(t=>(e===null||t.id===e)&&t.rooms.length>0).map(t=>({floorId:t.id,floorName:t.name,rooms:t.rooms.map(r=>({id:r.id,name:r.name||"\u2013",floorId:t.id}))})):[]}var cd=J`
`}static styles=[ve,He,ad,zr]};customElements.get("nextfloor-panel")||customElements.define("nextfloor-panel",us);var sg=/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/,cd=(n,e)=>Number(n)*60+Number(e);function Gn(n,e,t=new Date){if(!n||n==="off")return!1;if(n==="sun")return e?.states["sun.sun"]?.state==="below_horizon";let r=sg.exec(n.trim());if(!r)return!1;let i=cd(r[1],r[2]),o=cd(r[3],r[4]),s=t.getHours()*60+t.getMinutes();return i>o?s>=i||s<o:s>=i&&s<o}var pi=class{host;cleanTimer;idleTimer;nightTimer;constructor(e){this.host=e}armClean(e=!1){clearTimeout(this.cleanTimer);let t=this.host.config()?.controls_hide_after??0;t>0&&(e&&this.host.isClean()&&this.host.setClean(!1),this.cleanTimer=setTimeout(()=>this.host.setClean(!0),t*1e3))}stopClean(){clearTimeout(this.cleanTimer)}armIdle(){clearTimeout(this.idleTimer);let e=this.host.config()?.idle_return??0;e>0&&(this.idleTimer=setTimeout(()=>this.host.goHome(),e*1e3))}touched(){this.host.isOrbit()&&this.host.setOrbit(!1),this.armIdle(),this.armClean(!0)}start(){this.armIdle(),this.nightTimer=setInterval(()=>this.host.setNight(Gn(this.host.config()?.night,this.host.hass())),6e4)}stop(){clearTimeout(this.cleanTimer),clearTimeout(this.idleTimer),clearInterval(this.nightTimer)}};function dd(n,e){return n?n.floors.filter(t=>(e===null||t.id===e)&&t.rooms.length>0).map(t=>({floorId:t.id,floorName:t.name,rooms:t.rooms.map(r=>({id:r.id,name:r.name||"\u2013",floorId:t.id}))})):[]}var hd=J`
ha-card {
overflow: hidden;
background: var(--nf-bg);
@@ -4280,12 +4280,12 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
justify-content: flex-end;
}
}
`;function us(n,e){let t=n.template,r=t?e?.[t]:void 0;if(!r)return n;let{type:i,template:o,...s}=r;return{...s,...n}}function dd(n,e){let t=new Set(e),r=[];for(let o of n.floors){let s=o.rooms.filter(u=>t.has(u.id));if(!s.length)continue;let a=(u,c)=>s.some(h=>h.points.length>=3&&H([u,c],h.points)),l=new Set(s.map(u=>u.id));r.push({...o,rooms:s,openings:o.openings.filter(u=>l.has(u.room_id)),furniture:o.furniture.filter(u=>a(u.x,u.z)),placements:o.placements.filter(u=>a(u.x,u.z)),walls:(o.walls??[]).filter(u=>a((u.a[0]+u.b[0])/2,(u.a[1]+u.b[1])/2)),outdoor:[]})}let i={...n.settings.roof,type:"none",sections:[],solar:[]};return{...n,floors:r,settings:{...n.settings,roof:i}}}var tn="nf-outside",cs=class extends Q{static properties={hass:{attribute:!1},_config:{state:!0},_roomId:{state:!0},_floorId:{state:!0},_walls:{state:!0},_heat:{state:!0},_explode:{state:!0},_fullscreen:{state:!0},_clean:{state:!0},_night:{state:!0},_orbit:{state:!0},_roomNames:{state:!0}};_own=null;templatesSeen;roomApplied=!1;data=new Ft(this);kiosk=new mi({config:()=>this._config,hass:()=>this.hass,setClean:e=>this._clean=e,isClean:()=>this._clean,setOrbit:e=>this._orbit=e,isOrbit:()=>this._orbit,setNight:e=>this._night=e,goHome:()=>this.returnHome()});constructor(){super(),this._roomId=null,this._floorId=void 0,this._walls=null,this._heat=null,this._explode=null,this._fullscreen=!1,this._clean=!1,this._night=!1,this._orbit=!1,this._roomNames=null}view3d(){return this.shadowRoot?.querySelector("nf-view3d")}returnHome(){this._roomId=this._config?.room??null,this._floorId=void 0,this.view3d()?.resetView(),this._config?.idle_orbit&&(this._orbit=!0)}openDashboard(e){history.pushState(null,"",e),window.dispatchEvent(new CustomEvent("location-changed",{bubbles:!0,composed:!0,detail:{replace:!1}}))}onFullscreen=()=>this._fullscreen=!!document.fullscreenElement&&this.shadowRoot?.contains(document.fullscreenElement)===!0;connectedCallback(){super.connectedCallback(),document.addEventListener("fullscreenchange",this.onFullscreen),this.kiosk.start()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("fullscreenchange",this.onFullscreen),this.kiosk.stop()}toggleFullscreen(){document.fullscreenElement?document.exitFullscreen():this.shadowRoot?.querySelector("ha-card")?.requestFullscreen?.()}static async getConfigElement(){return await Zn(),document.createElement("nextfloor-card-editor")}static getStubConfig(){return{type:"custom:nextfloor-card"}}setConfig(e){if(e.height!==void 0&&!(e.height>100))throw new Error("height must be a number of pixels above 100");this._roomNames=null,this._own=e,this._config=us(e,this.data.building?.settings.card_templates),this._floorId=void 0,this._walls=null,this._heat=null,this._explode=null,this._orbit=!1,this._night=Kn(e.night,this.hass),this._clean=e.controls_hidden===!0,this.kiosk.armClean(),this.kiosk.armIdle()}getCardSize(){return Math.ceil((this._config?.height??420)/50)}getGridOptions(){return{columns:"full",rows:this._config?.fill?12:Math.ceil((this._config?.height??420)/56),min_rows:4}}willUpdate(e){let t=this.data.building?.settings.card_templates;if(this._own?.template&&t!==this.templatesSeen&&(this.templatesSeen=t,this._config=us(this._own,t)),this.toggleAttribute("readable",this._config?.readable===!0),e.has("hass")&&(this.style.colorScheme=zr(this.hass)),!e.has("hass")||!this.hass)return;this.data.setHass(this.hass);let r=Kn(this._config?.night,this.hass);r!==this._night&&(this._night=r)}get canSwitch(){return!this._config?.floor||this.thumbs}get thumbs(){return this._config?.floor_thumbs??!this._config?.floor}back(){this._roomId?this._roomId=null:this.canSwitch&&(this._floorId=null)}roomsMemo=null;plan(){let e=this.data.building??null,t=this._config?.rooms;if(!e||!t?.length)return e;let r=t.join(",");return(!this.roomsMemo||this.roomsMemo.source!==e||this.roomsMemo.ids!==r)&&(this.roomsMemo={source:e,ids:r,result:dd(e,t)}),this.roomsMemo.result}t=e=>$(this.hass,e);stage(){let e=this.plan(),t=this._config,r=this._floorId===void 0?t?.floor??null:this._floorId,i=e&&e.floors.length===1?e.floors[0].id:e?.floors.some(a=>a.id===r)?r:null,o=!!this._roomId&&t?.room_panel!==!1,s=!!this._roomId&&t?.room_panel===!1||!this.thumbs&&this.canSwitch&&!this._roomId&&!!i&&(e?.floors.length??0)>1;return{floorId:i,walls:this._walls??t?.walls??"auto",heat:this._heat??t?.heatmap??"none",explode:this._explode??t?.explode??!0,canGoBack:s,showBar:!!e&&!this._clean&&(s||!!t?.controls&&!o)}}shows(e){let t=this._config?.controls;return t===!0||Array.isArray(t)&&t.includes(e)}renderBar(e){let t=this.plan(),r=this.t,i=["temperature","humidity","co2"].filter(s=>this.shows(s)),o=(s,a)=>p`<div class="nf-seg" role=${s?"group":f} aria-label=${s??f}>${a.map(([l,u,c])=>p`<button aria-pressed=${l} @click=${u}>${c}</button>`)}</div>`;return p`<div class="nf-card-controls">
`;function cs(n,e){let t=n.template,r=t?e?.[t]:void 0;if(!r)return n;let{type:i,template:o,...s}=r;return{...s,...n}}function md(n,e){let t=new Set(e),r=[];for(let o of n.floors){let s=o.rooms.filter(u=>t.has(u.id));if(!s.length)continue;let a=(u,c)=>s.some(h=>h.points.length>=3&&H([u,c],h.points)),l=new Set(s.map(u=>u.id));r.push({...o,rooms:s,openings:o.openings.filter(u=>l.has(u.room_id)),furniture:o.furniture.filter(u=>a(u.x,u.z)),placements:o.placements.filter(u=>a(u.x,u.z)),walls:(o.walls??[]).filter(u=>a((u.a[0]+u.b[0])/2,(u.a[1]+u.b[1])/2)),outdoor:[]})}let i={...n.settings.roof,type:"none",sections:[],solar:[]};return{...n,floors:r,settings:{...n.settings,roof:i}}}var tn="nf-outside",ds=class extends Q{static properties={hass:{attribute:!1},_config:{state:!0},_roomId:{state:!0},_floorId:{state:!0},_walls:{state:!0},_heat:{state:!0},_explode:{state:!0},_fullscreen:{state:!0},_clean:{state:!0},_night:{state:!0},_orbit:{state:!0},_roomNames:{state:!0}};_own=null;templatesSeen;roomApplied=!1;data=new Ft(this);kiosk=new pi({config:()=>this._config,hass:()=>this.hass,setClean:e=>this._clean=e,isClean:()=>this._clean,setOrbit:e=>this._orbit=e,isOrbit:()=>this._orbit,setNight:e=>this._night=e,goHome:()=>this.returnHome()});constructor(){super(),this._roomId=null,this._floorId=void 0,this._walls=null,this._heat=null,this._explode=null,this._fullscreen=!1,this._clean=!1,this._night=!1,this._orbit=!1,this._roomNames=null}view3d(){return this.shadowRoot?.querySelector("nf-view3d")}returnHome(){this._roomId=this._config?.room??null,this._floorId=void 0,this.view3d()?.resetView(),this._config?.idle_orbit&&(this._orbit=!0)}openDashboard(e){history.pushState(null,"",e),window.dispatchEvent(new CustomEvent("location-changed",{bubbles:!0,composed:!0,detail:{replace:!1}}))}onFullscreen=()=>this._fullscreen=!!document.fullscreenElement&&this.shadowRoot?.contains(document.fullscreenElement)===!0;connectedCallback(){super.connectedCallback(),document.addEventListener("fullscreenchange",this.onFullscreen),this.kiosk.start()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("fullscreenchange",this.onFullscreen),this.kiosk.stop()}toggleFullscreen(){document.fullscreenElement?document.exitFullscreen():this.shadowRoot?.querySelector("ha-card")?.requestFullscreen?.()}static async getConfigElement(){return await Yn(),document.createElement("nextfloor-card-editor")}static getStubConfig(){return{type:"custom:nextfloor-card"}}setConfig(e){if(e.height!==void 0&&!(e.height>100))throw new Error("height must be a number of pixels above 100");this._roomNames=null,this._own=e,this._config=cs(e,this.data.building?.settings.card_templates),this._floorId=void 0,this._walls=null,this._heat=null,this._explode=null,this._orbit=!1,this._night=Gn(e.night,this.hass),this._clean=e.controls_hidden===!0,this.kiosk.armClean(),this.kiosk.armIdle()}getCardSize(){return Math.ceil((this._config?.height??420)/50)}getGridOptions(){return{columns:"full",rows:this._config?.fill?12:Math.ceil((this._config?.height??420)/56),min_rows:4}}willUpdate(e){let t=this.data.building?.settings.card_templates;if(this._own?.template&&t!==this.templatesSeen&&(this.templatesSeen=t,this._config=cs(this._own,t)),this.toggleAttribute("readable",this._config?.readable===!0),e.has("hass")&&(this.style.colorScheme=Tr(this.hass)),!e.has("hass")||!this.hass)return;this.data.setHass(this.hass);let r=Gn(this._config?.night,this.hass);r!==this._night&&(this._night=r)}get canSwitch(){return!this._config?.floor||this.thumbs}get thumbs(){return this._config?.floor_thumbs??!this._config?.floor}back(){this._roomId?this._roomId=null:this.canSwitch&&(this._floorId=null)}roomsMemo=null;plan(){let e=this.data.building??null,t=this._config?.rooms;if(!e||!t?.length)return e;let r=t.join(",");return(!this.roomsMemo||this.roomsMemo.source!==e||this.roomsMemo.ids!==r)&&(this.roomsMemo={source:e,ids:r,result:md(e,t)}),this.roomsMemo.result}t=e=>$(this.hass,e);stage(){let e=this.plan(),t=this._config,r=this._floorId===void 0?t?.floor??null:this._floorId,i=e&&e.floors.length===1?e.floors[0].id:e?.floors.some(a=>a.id===r)?r:null,o=!!this._roomId&&t?.room_panel!==!1,s=!!this._roomId&&t?.room_panel===!1||!this.thumbs&&this.canSwitch&&!this._roomId&&!!i&&(e?.floors.length??0)>1;return{floorId:i,walls:this._walls??t?.walls??"auto",heat:this._heat??t?.heatmap??"none",explode:this._explode??t?.explode??!0,canGoBack:s,showBar:!!e&&!this._clean&&(s||!!t?.controls&&!o)}}shows(e){let t=this._config?.controls;return t===!0||Array.isArray(t)&&t.includes(e)}renderBar(e){let t=this.plan(),r=this.t,i=["temperature","humidity","co2"].filter(s=>this.shows(s)),o=(s,a)=>p`<div class="nf-seg" role=${s?"group":f} aria-label=${s??f}>${a.map(([l,u,c])=>p`<button aria-pressed=${l} @click=${u}>${c}</button>`)}</div>`;return p`<div class="nf-card-controls">
${e.canGoBack?p`<button class="nf-chip" @click=${()=>this.back()}>${r("back")}</button>`:f}
${this.shows("walls")?o(void 0,[[e.walls==="auto",()=>this._walls="auto",r("walls_auto")],[e.walls==="cut",()=>this._walls="cut",r("walls_cut")],[e.walls==="slope",()=>this._walls="slope",r("walls_slope")]]):f}
${this.shows("floors")&&t.floors.length>1&&!e.floorId?o(void 0,[[e.explode,()=>this._explode=!0,r("floors_apart")],[!e.explode,()=>this._explode=!1,r("floors_stacked")]]):f}
${i.length>0?o(r("heatmap"),["none",...i].map(s=>[e.heat===s,()=>this._heat=s,r(s==="none"?"heat_off":`heat_short_${s}`)])):f}
</div>`}renderRoomButtons(e){let t=this.plan();if(!this._config?.room_buttons||!t||this._clean)return f;let r=ud(t,e.floorId);if(!r.length)return f;let i=r.length>1,o=(l,u)=>{this.canSwitch&&l!==e.floorId&&(this._floorId=l),this._roomId=u===this._roomId?null:u},s=gn(this.hass,t.floors).length>0,a=()=>{this.canSwitch&&(this._floorId=null),this._roomId=this._roomId===tn?null:tn};return p`<div class="nf-card-rooms ${this._roomId&&this._config?.room_panel!==!1?"nf-card-rooms-beside":""}" role="group" aria-label=${this.t("card_room_buttons")}>
</div>`}renderRoomButtons(e){let t=this.plan();if(!this._config?.room_buttons||!t||this._clean)return f;let r=dd(t,e.floorId);if(!r.length)return f;let i=r.length>1,o=(l,u)=>{this.canSwitch&&l!==e.floorId&&(this._floorId=l),this._roomId=u===this._roomId?null:u},s=gn(this.hass,t.floors).length>0,a=()=>{this.canSwitch&&(this._floorId=null),this._roomId=this._roomId===tn?null:tn};return p`<div class="nf-card-rooms ${this._roomId&&this._config?.room_panel!==!1?"nf-card-rooms-beside":""}" role="group" aria-label=${this.t("card_room_buttons")}>
${r.map(l=>p`${i?p`<span class="nf-card-rooms-floor">${l.floorName}</span>`:f}${l.rooms.map(u=>p`<button class="nf-chip" aria-pressed=${u.id===this._roomId} @click=${()=>o(l.floorId,u.id)}>${u.name}</button>`)}`)}
${s?p`<button class="nf-chip" aria-pressed=${this._roomId===tn} title=${this.t("outside_area_hint")} @click=${a}>🌳 ${this.t("outside_area")}</button>`:f}
</div>`}renderCorners(){let e=this._config,t=this.t,r=this._clean||!!this._roomId&&e?.room_panel!==!1;return p`${e?.fullscreen_button&&!r?p`<button class="nf-card-full" title=${t(this._fullscreen?"fullscreen_exit":"fullscreen")} aria-label=${t(this._fullscreen?"fullscreen_exit":"fullscreen")} @click=${()=>this.toggleFullscreen()}>
@@ -4294,7 +4294,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${e?.dashboard&&!r?p`<button class="nf-card-full nf-card-dash ${e.fullscreen_button?"nf-card-dash-2":""}" title=${e.dashboard_label||e.dashboard} aria-label=${e.dashboard_label||e.dashboard} @click=${()=>this.openDashboard(e.dashboard)}>
${e.dashboard_label?p`<span>${e.dashboard_label}</span>`:"\u2302"}
</button>`:f}`}renderStage(e){let t=this.plan(),r=this._config,i=()=>{this._clean=!this._clean,this._clean?this.kiosk.stopClean():this.kiosk.armClean()},o=r?.controls_hidden!==void 0||(r?.controls_hide_after??0)>0;return p`<nf-view3d
.hass=${li(St(this.hass,t.floors),t.settings)}
.hass=${ui(St(this.hass,t.floors),t.settings)}
.building=${t}
.packs=${this.data.packs}
.floorId=${e.floorId}
@@ -4322,7 +4322,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.zoom=${typeof r?.zoom=="number"?r.zoom:1}
.buttons=${r?.buttons?.map((s,a)=>({id:`card_${a}`,...s}))??null}
.heatMode=${e.heat}
.theme=${Jr(r?.theme,this.hass?.states["sun.sun"]?.state)}
.theme=${Qr(r?.theme,this.hass?.states["sun.sun"]?.state)}
.clock=${r?.clock&&r.clock!=="none"?r.clock:null}
.lockButton=${r?.lock_button!==!1}
.walkButton=${r?.walk_button!==!1}
@@ -4340,10 +4340,10 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.panelOpen=${!!this._roomId&&r?.room_panel!==!1}
.alerts=${r?.alerts!==!1}
.alertJump=${!!r?.alert_jump}
.announcements=${!V(this.hass)&&r?.announcements!==!1&&!id()}
.announcements=${!V(this.hass)&&r?.announcements!==!1&&!sd()}
.sensorBar=${r?.sensor_bar!==!1}
.glassWalls=${typeof r?.glass_walls=="number"?Math.min(100,Math.max(0,r.glass_walls)):null}
.screenName=${r?.screen_name??rd()}
.screenName=${r?.screen_name??od()}
.scenes=${r?.scenes!==!1}
.clean=${this._clean}
.cleanButton=${o}
@@ -4368,7 +4368,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.confirmEntities=${bt(this.hass,e.floors)}
.phrases=${e.settings.announce_phrases??null}
@close=${()=>this._roomId=null}
></nf-room-panel>`}render(){if(this.hass&&Sr(this.hass,this))return f;let e=this.plan(),t=this._config;!this.roomApplied&&e&&t?.room&&(this.roomApplied=!0,e.floors.some(a=>a.rooms.some(l=>l.id===t.room))&&(this._roomId=t.room));let r=this.stage(),i=this._fullscreen?"100vh":t?.fill?"calc(100vh - var(--header-height, 56px) - 16px)":`${t?.height??420}px`,o=/^#[0-9a-f]{6}$/i.test(t?.accent??"")?t.accent:null,s=()=>this.kiosk.touched();return p`<ha-card class=${this._night?"nf-night":""} style=${o?`--nf-accent:${o}`:""} @pointerdown=${s} @keydown=${s} @wheel=${s}>
></nf-room-panel>`}render(){if(this.hass&&$r(this.hass,this))return f;let e=this.plan(),t=this._config;!this.roomApplied&&e&&t?.room&&(this.roomApplied=!0,e.floors.some(a=>a.rooms.some(l=>l.id===t.room))&&(this._roomId=t.room));let r=this.stage(),i=this._fullscreen?"100vh":t?.fill?"calc(100vh - var(--header-height, 56px) - 16px)":`${t?.height??420}px`,o=/^#[0-9a-f]{6}$/i.test(t?.accent??"")?t.accent:null,s=()=>this.kiosk.touched();return p`<ha-card class=${this._night?"nf-night":""} style=${o?`--nf-accent:${o}`:""} @pointerdown=${s} @keydown=${s} @wheel=${s}>
<div class="nf-card-body" style="height:${i}">
${e&&e.floors.some(a=>a.rooms.length)?this.renderStage(r):p`<p class="nf-card-msg">${this.data.error??(e?$(this.hass,"no_building"):$(this.hass,"loading"))}</p>`}
${this._roomId&&e&&t?.room_panel!==!1?this.renderRoomPanel():f}
@@ -4376,7 +4376,7 @@ ${t.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${r.showBar&&e?this.renderBar(r):f}
${this.renderCorners()}
</div>
</ha-card>`}static styles=[ve,He,cd,Rr]};if(!customElements.get("nextfloor-card")){customElements.define("nextfloor-card",cs);let n=window;n.customCards=n.customCards??[],n.customCards.push({type:"nextfloor-card",name:$(void 0,"card_name"),description:$(void 0,"card_description"),preview:!1})}Di();
</ha-card>`}static styles=[ve,He,hd,zr]};if(!customElements.get("nextfloor-card")){customElements.define("nextfloor-card",ds);let n=window;n.customCards=n.customCards??[],n.customCards.push({type:"nextfloor-card",name:$(void 0,"card_name"),description:$(void 0,"card_description"),preview:!1})}Fi();
/*! Bundled license information:
@lit/reactive-element/css-tag.js: