feat: discover Symcon room utility meters and sum floor consumption

This commit is contained in:
jhartworks committed 2026-11-11 09:55:26 +01:00
1 parent f0be3d2cb4
commit 2e965fa7ea
6 files changed
+923 -863

No files matched your search

+226 -208
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 */ /*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */
var x={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=r=>r===void 0?r:JSON.parse(JSON.stringify(r)));var Tn=globalThis,Dn=Tn.ShadowRoot&&(Tn.ShadyCSS===void 0||Tn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,qr=Symbol(),Po=new WeakMap,Vt=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==qr)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(Dn&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=Po.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Po.set(t,e))}return e}toString(){return this.cssText}},Io=r=>new Vt(typeof r=="string"?r:r+"",void 0,qr),X=(r,...e)=>{let t=r.length===1?r[0]:e.reduce((n,i,o)=>n+(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)+r[o+1],r[0]);return new Vt(t,r,qr)},Co=(r,e)=>{if(Dn)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),i=Tn.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},Zr=Dn?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return Io(t)})(r):r;var{is:yu,defineProperty:xu,getOwnPropertyDescriptor:ku,getOwnPropertyNames:Su,getOwnPropertySymbols:$u,getPrototypeOf:Mu}=Object,Fn=globalThis,No=Fn.trustedTypes,Au=No?No.emptyScript:"",Eu=Fn.reactiveElementPolyfillSupport,Kt=(r,e)=>r,Yr={toAttribute(r,e){switch(e){case Boolean:r=r?Au:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},Oo=(r,e)=>!yu(r,e),Wo={attribute:!0,type:String,converter:Yr,reflect:!1,useDefault:!1,hasChanged:Oo};Symbol.metadata??=Symbol("metadata"),Fn.litPropertyMetadata??=new WeakMap;var ze=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=Wo){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 n=Symbol(),i=this.getPropertyDescriptor(e,n,t);i!==void 0&&xu(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){let{get:i,set:o}=ku(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,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Wo}static _$Ei(){if(this.hasOwnProperty(Kt("elementProperties")))return;let e=Mu(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Kt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Kt("properties"))){let t=this.properties,n=[...Su(t),...$u(t)];for(let i of n)this.createProperty(i,t[i])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[n,i]of t)this.elementProperties.set(n,i)}this._$Eh=new Map;for(let[t,n]of this.elementProperties){let i=this._$Eu(t,n);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let i of n)t.unshift(Zr(i))}else e!==void 0&&t.push(Zr(e));return t}static _$Eu(e,t){let n=t.attribute;return n===!1?void 0:typeof n=="string"?n: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 n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadLine truncated var x={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=r=>r===void 0?r:JSON.parse(JSON.stringify(r)));var Hn=globalThis,Pn=Hn.ShadowRoot&&(Hn.ShadyCSS===void 0||Hn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Jr=Symbol(),Ko=new WeakMap,Kt=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Jr)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(Pn&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=Ko.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Ko.set(t,e))}return e}toString(){return this.cssText}},Go=r=>new Kt(typeof r=="string"?r:r+"",void 0,Jr),Q=(r,...e)=>{let t=r.length===1?r[0]:e.reduce((n,i,o)=>n+(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)+r[o+1],r[0]);return new Kt(t,r,Jr)},Uo=(r,e)=>{if(Pn)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),i=Hn.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},Qr=Pn?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return Go(t)})(r):r;var{is:Ou,defineProperty:Lu,getOwnPropertyDescriptor:Bu,getOwnPropertyNames:Vu,getOwnPropertySymbols:Ku,getPrototypeOf:Gu}=Object,In=globalThis,jo=In.trustedTypes,Uu=jo?jo.emptyScript:"",ju=In.reactiveElementPolyfillSupport,Gt=(r,e)=>r,Xr={toAttribute(r,e){switch(e){case Boolean:r=r?Uu:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},Zo=(r,e)=>!Ou(r,e),qo={attribute:!0,type:String,converter:Xr,reflect:!1,useDefault:!1,hasChanged:Zo};Symbol.metadata??=Symbol("metadata"),In.litPropertyMetadata??=new WeakMap;var ze=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=qo){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 n=Symbol(),i=this.getPropertyDescriptor(e,n,t);i!==void 0&&Lu(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){let{get:i,set:o}=Bu(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,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??qo}static _$Ei(){if(this.hasOwnProperty(Gt("elementProperties")))return;let e=Gu(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Gt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Gt("properties"))){let t=this.properties,n=[...Vu(t),...Ku(t)];for(let i of n)this.createProperty(i,t[i])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[n,i]of t)this.elementProperties.set(n,i)}this._$Eh=new Map;for(let[t,n]of this.elementProperties){let i=this._$Eu(t,n);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let i of n)t.unshift(Qr(i))}else e!==void 0&&t.push(Qr(e));return t}static _$Eu(e,t){let n=t.attribute;return n===!1?void 0:typeof n=="string"?n: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 n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadLine truncated
\f\r]`,Gt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Vo=/-->/g,Ko=/>/g,tt=RegExp(`>|${Jr}(?:([^\\s"'>=/]+)(${Jr}*=${Jr}*(?:[^ \f\r]`,Ut=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Qo=/-->/g,Xo=/>/g,nt=RegExp(`>|${ei}(?:([^\\s"'>=/]+)(${ei}*=${ei}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),Go=/'/g,Uo=/"/g,Yo=/^(?:script|style|textarea|title)$/i,oi=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),p=oi(1),ee=oi(2),mf=oi(3),it=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),jo=new WeakMap,nt=rt.createTreeWalker(rt,129);function Jo(r,e){if(!ii(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Bo!==void 0?Bo.createHTML(e):e}var Tu=(r,e)=>{let t=r.length-1,n=[],i,o=e===2?"<svg>":e===3?"<math>":"",s=Gt;for(let a=0;a<t;a++){let l=r[a],c,u,h=-1,m=0;for(;m<l.length&&(s.lastIndex=m,u=s.exec(l),u!==null);)m=s.lastIndex,s===Gt?u[1]==="!--"?s=Vo:u[1]!==void 0?s=Ko:u[2]!==void 0?(Yo.test(u[2])&&(i=RegExp("</"+u[2],"g")),s=tt):u[3]!==void 0&&(s=tt):s===tt?u[0]===">"?(s=i??Gt,h=-1):u[1]===void 0?h=-2:(h=s.lastIndex-u[2].length,c=u[1],s=u[3]===void 0?tt:u[3]==='"'?Uo:Go):s===Uo||s===Go?s=tt:s===Vo||s===Ko?s=Gt:(s=tt,i=void 0);let d=s===tt&&r[a+1].startsWith("/>")?" ":"";o+=s===Gt?l+Ru:h>=0?(n.push(c),l.slice(0,h)+qo+l.slice(h)+Ke+d):l+Ke+(h===-2?a:d)}return[Jo(r,o+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},qt=class r{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let o=0,s=0,a=e.length-1,l=this.parts,[c,u]=Tu(e,t);if(this.el=r.createElement(c,n),nt.currentNode=this.el.content,t===2||t===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(i=nt.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let h of i.getAttributeNames())if(h.endsWith(qo)){let m=u[s++],d=i.getAttribute(h).split(Ke),g=/([.?@])?(.*)/.exec(m);l.push({type:1,index:o,name:g[2],strings:d,ctor:g[1]==="."?Xr:g[1]==="?"?ei:g[1]==="@"?ti:bt}),i.removeAttribute(h)}else h.startsWith(Ke)&&(l.push({type:6,index:o}),i.removeAttribute(h));if(Yo.test(i.tagName)){let h=i.textContent.split(Ke),m=h.length-1;if(m>0){i.textContent=Hn?Hn.emptyScript:"";for(let d=0;d<m;d++)i.append(h[d],Ut()),nt.nextNode(),l.push({type:2,index:++o});i.append(h[m],Ut())}}}else if(i.nodeType===8)if(i.data===Zo)l.push({type:2,index:o});else{let h=-1;for(;(h=i.data.indexOf(Ke,h+1))!==-1;)l.push({type:7,index:o}),h+=Ke.length-1}o++}}static createElement(e,t){let n=rt.createElement("template");return n.innerHTML=e,n}};function _t(r,e,t=r,n){if(e===it)return e;let i=n!==void 0?t._$Co?.[n]:t._$Cl,o=jt(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(r),i._$AT(r,t,n)),n!==void 0?(t._$Co??=[])[n]=i:t._$Cl=i),i!==void 0&&(e=_t(r,i._$AS(r,e.values),i,n)),e}var Qr=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:n}=this._$AD,i=(e?.creationScope??rt).importNode(t,!0);nt.currentNode=i;let o=nt.nextNode(),s=0,a=0,l=n[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new Zt(o,o.nextSibling,this,e):l.type===1?c=new l.ctor(o,l.name,l.strings,this,e):l.type===6&&(c=new ni(o,this,e)),this._$AV.push(c),l=n[++a]}s!==l?.index&&(o=nt.nextNode(),s++)}return nt.currentNode=rt,i}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},Zt=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=f,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,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=_t(this,e,t),jt(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==it&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):zu(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&&jt(this._$AH)?this._$AA.nextSibling.data=e:this.T(rt.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,i=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=qt.createElement(Jo(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(t);else{let o=new Qr(i,this),s=o.u(this.options);o.p(t),this.T(s),this._$AH=o}}_$AC(e){let t=jo.get(e.strings);return t===void 0&&jo.set(e.strings,t=new qt(e)),t}k(e){ii(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,i=0;for(let o of e)i===t.length?t.push(n=new r(this.O(Ut()),this.O(Ut()),this,this.options)):n=t[i],n._$AI(o),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let n=Lo(e).nextSibling;Lo(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},bt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,o){this.type=1,this._$AH=f,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=o,n.length>2||n[0]!==""||n[1]!==""?(this.Line truncated \f\r"'\`<>=]|("|')|))|$)`,"g"),es=/'/g,ts=/"/g,os=/^(?:script|style|textarea|title)$/i,li=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),p=li(1),te=li(2),If=li(3),ot=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),ns=new WeakMap,rt=it.createTreeWalker(it,129);function ss(r,e){if(!ai(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Jo!==void 0?Jo.createHTML(e):e}var Yu=(r,e)=>{let t=r.length-1,n=[],i,o=e===2?"<svg>":e===3?"<math>":"",s=Ut;for(let a=0;a<t;a++){let l=r[a],c,u,d=-1,m=0;for(;m<l.length&&(s.lastIndex=m,u=s.exec(l),u!==null);)m=s.lastIndex,s===Ut?u[1]==="!--"?s=Qo:u[1]!==void 0?s=Xo:u[2]!==void 0?(os.test(u[2])&&(i=RegExp("</"+u[2],"g")),s=nt):u[3]!==void 0&&(s=nt):s===nt?u[0]===">"?(s=i??Ut,d=-1):u[1]===void 0?d=-2:(d=s.lastIndex-u[2].length,c=u[1],s=u[3]===void 0?nt:u[3]==='"'?ts:es):s===ts||s===es?s=nt:s===Qo||s===Xo?s=Ut:(s=nt,i=void 0);let h=s===nt&&r[a+1].startsWith("/>")?" ":"";o+=s===Ut?l+qu:d>=0?(n.push(c),l.slice(0,d)+rs+l.slice(d)+Ge+h):l+Ge+(d===-2?a:h)}return[ss(r,o+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},Zt=class r{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let o=0,s=0,a=e.length-1,l=this.parts,[c,u]=Yu(e,t);if(this.el=r.createElement(c,n),rt.currentNode=this.el.content,t===2||t===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(i=rt.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let d of i.getAttributeNames())if(d.endsWith(rs)){let m=u[s++],h=i.getAttribute(d).split(Ge),g=/([.?@])?(.*)/.exec(m);l.push({type:1,index:o,name:g[2],strings:h,ctor:g[1]==="."?ni:g[1]==="?"?ri:g[1]==="@"?ii:vt}),i.removeAttribute(d)}else d.startsWith(Ge)&&(l.push({type:6,index:o}),i.removeAttribute(d));if(os.test(i.tagName)){let d=i.textContent.split(Ge),m=d.length-1;if(m>0){i.textContent=Cn?Cn.emptyScript:"";for(let h=0;h<m;h++)i.append(d[h],jt()),rt.nextNode(),l.push({type:2,index:++o});i.append(d[m],jt())}}}else if(i.nodeType===8)if(i.data===is)l.push({type:2,index:o});else{let d=-1;for(;(d=i.data.indexOf(Ge,d+1))!==-1;)l.push({type:7,index:o}),d+=Ge.length-1}o++}}static createElement(e,t){let n=it.createElement("template");return n.innerHTML=e,n}};function bt(r,e,t=r,n){if(e===ot)return e;let i=n!==void 0?t._$Co?.[n]:t._$Cl,o=qt(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(r),i._$AT(r,t,n)),n!==void 0?(t._$Co??=[])[n]=i:t._$Cl=i),i!==void 0&&(e=bt(r,i._$AS(r,e.values),i,n)),e}var ti=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:n}=this._$AD,i=(e?.creationScope??it).importNode(t,!0);rt.currentNode=i;let o=rt.nextNode(),s=0,a=0,l=n[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new Yt(o,o.nextSibling,this,e):l.type===1?c=new l.ctor(o,l.name,l.strings,this,e):l.type===6&&(c=new oi(o,this,e)),this._$AV.push(c),l=n[++a]}s!==l?.index&&(o=rt.nextNode(),s++)}return rt.currentNode=it,i}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},Yt=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=f,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,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=bt(this,e,t),qt(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==ot&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Zu(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&&qt(this._$AH)?this._$AA.nextSibling.data=e:this.T(it.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,i=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=Zt.createElement(ss(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(t);else{let o=new ti(i,this),s=o.u(this.options);o.p(t),this.T(s),this._$AH=o}}_$AC(e){let t=ns.get(e.strings);return t===void 0&&ns.set(e.strings,t=new Zt(e)),t}k(e){ai(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,i=0;for(let o of e)i===t.length?t.push(n=new r(this.O(jt()),this.O(jt()),this,this.options)):n=t[i],n._$AI(o),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let n=Yo(e).nextSibling;Yo(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},vt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,o){this.type=1,this._$AH=f,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=o,n.length>2||n[0]!==""||n[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: 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: 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 { :host {
--nf-text: var(--primary-text-color, #e1e1e1); --nf-text: var(--primary-text-color, #e1e1e1);
--nf-muted: var(--secondary-text-color, #9b9b9b); --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); font-family: var(--nf-font);
color: var(--nf-text); color: var(--nf-text);
} }
`,fr=X` `,br=Q`
:host([readable]) { :host([readable]) {
--secondary-text-color: var(--primary-text-color, #e1e1e1); --secondary-text-color: var(--primary-text-color, #e1e1e1);
--divider-color: color-mix(in srgb, var(--primary-text-color, #e1e1e1) 40%, transparent); --divider-color: color-mix(in srgb, var(--primary-text-color, #e1e1e1) 40%, transparent);
@@ -46,7 +46,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
:host([readable]) .nf-overlay { :host([readable]) .nf-overlay {
zoom: 1.2; zoom: 1.2;
} }
`,Ae=X` `,Ae=Q`
/* a group of switches: one rounded pill, the active one tinted with the accent */ /* a group of switches: one rounded pill, the active one tinted with the accent */
.nf-seg { .nf-seg {
display: inline-flex; display: inline-flex;
@@ -209,18 +209,18 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
min-height: 40px; min-height: 40px;
} }
} }
`;function gr(r){return r?.themes?.darkMode===!1?"light":"dark"}var Wi=class extends re{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,n,i){this._pending=new Set([...this._pending,e]),this._error="";try{await this.hass.callService(t,n,{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,n){let i=this.hass.states[t],o=Ze(i),s=i?.attributes,a=n&&!!s?.symcon_has_action&&o!==null&&!this._pending.has(t);return p`<div class="value"><span>${e}</span><b>${Ye(i)}</b> `;function vr(r){return r?.themes?.darkMode===!1?"light":"dark"}var Bi=class extends X{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,n,i){this._pending=new Set([...this._pending,e]),this._error="";try{await this.hass.callService(t,n,{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,n){let i=this.hass.states[t],o=Ye(i),s=i?.attributes,a=n&&!!s?.symcon_has_action&&o!==null&&!this._pending.has(t);return p`<div class="value"><span>${e}</span><b>${Je(i)}</b>
${n&&s?.symcon_has_action&&s.symcon_variable_type===0?p`<button class="nf-chip" aria-pressed=${oe(i)===!0} ?disabled=${!a} @click=${()=>{this.send(t,"symcon","set_value",{value:!oe(i)})}}>${oe(i)?"Ein":"Aus"}</button>`:n&&s?.symcon_has_action&&[1,2].includes(Number(s.symcon_variable_type))?p`<input type="number" aria-label=${e} .value=${String(sn(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} ${n&&s?.symcon_has_action&&s.symcon_variable_type===0?p`<button class="nf-chip" aria-pressed=${oe(i)===!0} ?disabled=${!a} @click=${()=>{this.send(t,"symcon","set_value",{value:!oe(i)})}}>${oe(i)?"Ein":"Aus"}</button>`:n&&s?.symcon_has_action&&[1,2].includes(Number(s.symcon_variable_type))?p`<input type="number" aria-label=${e} .value=${String(Pe(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 c=l.target;c.value.trim()&&c.checkValidity()&&this.send(t,"symcon","set_value",{value:Number(c.value)})}} />`:f} @change=${l=>{let c=l.target;c.value.trim()&&c.checkValidity()&&this.send(t,"symcon","set_value",{value:Number(c.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 n=t.attributes.actions??[],i=t.attributes.groups??[],o=Number(t.attributes.next_run??0),s=n.find(c=>c.id===t.attributes.next_action),a=["Mo","Di","Mi","Do","Fr","Sa","So"],l=c=>`${String(c.hour).padStart(2,"0")}:${String(c.minute).padStart(2,"0")}${c.second?`:${String(c.second).padStart(2,"0")}`:""}`;return p`<details class="schedule"><summary>${String(t.attributes.friendly_name??"Schaltuhr")}</summary> </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 n=t.attributes.actions??[],i=t.attributes.groups??[],o=Number(t.attributes.next_run??0),s=n.find(c=>c.id===t.attributes.next_action),a=["Mo","Di","Mi","Do","Fr","Sa","So"],l=c=>`${String(c.hour).padStart(2,"0")}:${String(c.minute).padStart(2,"0")}${c.second?`:${String(c.second).padStart(2,"0")}`:""}`;return p`<details class="schedule"><summary>${String(t.attributes.friendly_name??"Schaltuhr")}</summary>
<label class="nf-check"><input type="checkbox" .checked=${t.state==="on"} ?disabled=${this._pending.has(e)} @change=${c=>{this.send(e,"schedule","set_active",{active:c.target.checked})}} /> Aktiv</label> <label class="nf-check"><input type="checkbox" .checked=${t.state==="on"} ?disabled=${this._pending.has(e)} @change=${c=>{this.send(e,"schedule","set_active",{active:c.target.checked})}} /> Aktiv</label>
${o>0?p`<p class="next">Nächster Schaltpunkt: ${new Date(o*1e3).toLocaleString(this.hass.language)}${s?` \xB7 ${s.name}`:""}</p>`:f} ${o>0?p`<p class="next">Nächster Schaltpunkt: ${new Date(o*1e3).toLocaleString(this.hass.language)}${s?` \xB7 ${s.name}`:""}</p>`:f}
${i.length?i.map(c=>p`<div class="schedule-group"><b>${a.filter((u,h)=>c.days&1<<h).join(" \xB7 ")}</b><div class="points"> ${i.length?i.map(c=>p`<div class="schedule-group"><b>${a.filter((u,d)=>c.days&1<<d).join(" \xB7 ")}</b><div class="points">
${[...c.points].sort((u,h)=>u.hour*3600+u.minute*60+u.second-(h.hour*3600+h.minute*60+h.second)).map(u=>{let h=n.find(m=>m.id===u.action);return p`<span class="point"><time>${l(u)}</time><span class="dot" style=${`background:#${Number(h?.color??8885929).toString(16).padStart(6,"0").slice(-6)}`}></span>${h?.name||"Aktion"}</span>`})} ${[...c.points].sort((u,d)=>u.hour*3600+u.minute*60+u.second-(d.hour*3600+d.minute*60+d.second)).map(u=>{let d=n.find(m=>m.id===u.action);return p`<span class="point"><time>${l(u)}</time><span class="dot" style=${`background:#${Number(d?.color??8885929).toString(16).padStart(6,"0").slice(-6)}`}></span>${d?.name||"Aktion"}</span>`})}
</div></div>`):p`<p class="missing">Keine Schaltpunkte vorhanden.</p>`} </div></div>`):p`<p class="missing">Keine Schaltpunkte vorhanden.</p>`}
</details>`}render(){if(!this.hass||!this.room)return f;let e=Pa.filter(i=>i.key!=="status"&&this.room.hvac?.[i.key]&&this.room.hvac[i.key]!=="none"),t=this.room.hvac?.schedules??[],n=this.room.floor_heating&&this.room.floor_heating!=="none"?this.room.floor_heating:null;return p`${n||e.length?p`<section><h3>Raumklima</h3>${n?this.value("Fu\xDFbodenheizung",n,!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=Ka.filter(i=>i.key!=="status"&&this.room.hvac?.[i.key]&&this.room.hvac[i.key]!=="none"),t=this.room.hvac?.schedules??[],n=this.room.floor_heating&&this.room.floor_heating!=="none"?this.room.floor_heating:null;return p`${n||e.length?p`<section><h3>Raumklima</h3>${n?this.value("Fu\xDFbodenheizung",n,!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} ${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=[pe,Ae,X` ${this._error?p`<p role="alert" class="error">${this._error}</p>`:f}`}static styles=[pe,Ae,Q`
:host { display:block; } :host { display:block; }
section { margin:18px 0; } section { margin:18px 0; }
h3 { font-size:12px; text-transform:uppercase; letter-spacing:.05em; color:var(--nf-muted); margin:0 0 8px; } h3 { font-size:12px; text-transform:uppercase; letter-spacing:.05em; color:var(--nf-muted); margin:0 0 8px; }
@@ -238,12 +238,28 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.point time { font-variant-numeric:tabular-nums; } .point time { font-variant-numeric:tabular-nums; }
.dot { width:8px; height:8px; border-radius:50%; } .dot { width:8px; height:8px; border-radius:50%; }
.error { color:var(--nf-danger,#ff6b7a); font-size:12px; } .error { color:var(--nf-danger,#ff6b7a); font-size:12px; }
`]};customElements.get("nf-room-hvac")||customElements.define("nf-room-hvac",Wi);var Y=(r,e)=>[r[0]-e[0],r[1]-e[1]],Ee=(r,e)=>[r[0]+e[0],r[1]+e[1]],ve=(r,e)=>[r[0]*e,r[1]*e],ae=(r,e)=>r[0]*e[0]+r[1]*e[1],Pe=(r,e)=>r[0]*e[1]-r[1]*e[0],Ie=r=>Math.hypot(r[0],r[1]),we=r=>{let e=Ie(r)||1;return[r[0]/e,r[1]/e]},Oi=r=>[-r[1],r[0]],Li=r=>[r[1],-r[0]];function Ia(r){let e=r.heightEnd!==void 0;return{...r,a:r.b,b:r.a,left:r.right,right:r.left,roomLeft:r.roomRight,roomRight:r.roomLeft,height:e?r.heightEnd:r.height,heightEnd:e?r.height:void 0}}function mh(r,e){let t=r.map(n=>({...n}));for(let n of e){let i=t.find(o=>o.room_id===n.room_id&&o.edge===n.edge&&(Math.abs(o.t1-n.t0)<1e-6||Math.abs(n.t1-o.t0)<1e-6));i?(i.t0=Math.min(i.t0,n.t0),i.t1=Math.max(i.t1,n.t1)):t.push({...n})}return t}function ph(r,e,t){if(r.a===e.b)return!1;let n=we(Y(t[r.b],t[r.a])),i=we(Y(t[e.b],t[e.a]));return Math.abs(Pe(n,i))>1e-6||ae(n,i)<=0||r.free||e.free||r.heightEnd!==void 0||e.heightEnd!==void 0?!1:r.height===e.height&&r.exterior===e.exterior&&r.roomLeft===e.roomLeft&&r.roomRight===e.roomRight&&Math.abs(r.left-e.left)<=1e-9&&Math.abs(r.right-e.right)<=1e-9}function Ca(r,e,t=new Set){let n=r.slice();for(;;){let i=new Map;n.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=n[a[0]].b===s?n[a[0]]:Ia(n[a[0]]),c=n[a[1]].a===s?n[a[1]]:Ia(n[a[1]]);if(!ph(l,c,e))continue;let u={...l,b:c.b,sources:mh(l.sources,c.sources)};o=[...n.filter((h,m)=>m!==a[0]&&m!==a[1]),u];break}if(!o)return n;n=o}}function Na(r,e){let t=new Map;r.forEach((i,o)=>{let s=we(Y(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:ve(s,-1),left:i.right,right:i.left,angle:Math.atan2(-s[1],-s[0])}]];for(let[l,c]of a)t.set(l,[...t.get(l)??[],c])});let n=new Map;for(let[i,o]of t){let s=e[i];o.sort((l,c)=>l.angle-c.angle);for(let l of o)n.set(l.key,{left:Ee(s,ve(Oi(l.d),l.left)),right:Ee(s,ve(Li(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,c)=>{let u=o[(c+1)%o.length],h=Ee(s,ve(Oi(l.d),l.left)),m=Ee(s,ve(Li(u.d),u.right)),d=Pe(l.d,u.d);if(Math.abs(d)<1e-4)return;let g=Ee(h,ve(l.d,Pe(Y(m,h),u.d)/d));Ie(Y(g,s))>a||(n.get(l.key).left=g,n.get(u.key).right=g)})}return n}function Wa(r,e){let t=r.filter((n,i)=>Ie(Y(n,r[(i+1)%r.length]))>e);for(;;){if(t.length<=3)return t;let n=t.findIndex((i,o)=>{let s=t[(o+t.length-1)%t.length],a=t[(o+1)%t.length],[l,c]=[Y(i,s),Y(a,i)];return Math.abs(Pe(we(l),we(c)))<1e-7&&ae(l,c)>0});if(n===-1)return t;t=t.filter((i,o)=>o!==n)}}function fh(r){let e=[];return{points:e,idOf(t){let n=e.findIndex(i=>Math.abs(i[0]-t[0])<=r&&Math.abs(i[1]-t[1])<=r);return n>=0?n:(e.push([t[0],t[1]]),e.length-1)}}}function gh(r,e){let t=[];for(let n of r){let i=n.points;if(i.length<3||Math.abs(at(i))<1e-6)continue;let o=at(i)>0,s=i.map(a=>e.idOf(a));s.forEach((a,l)=>{let c=s[(l+1)%s.length];a!==c&&t.push(o?{u:a,v:c,room:n.id,edge:l,forward:!0}:{u:c,v:a,room:n.id,edge:l,forward:!1})})}return t}function _h(r,e,t){let n=[];for(let i of r){let[o,s]=[e[i.u],e[i.v]],a=Y(s,o),l=Ie(a),c=ve(a,1/l),u=e.map((m,d)=>({id:d,rel:Y(m,o)})).filter(({id:m,rel:d})=>m!==i.u&&m!==i.v&&ae(d,c)>t&&ae(d,c)<l-t&&Math.abs(Pe(c,d))<=t).map(({id:m,rel:d})=>({t:ae(d,c),id:m})).sort((m,d)=>m.t-d.t),h=[{t:0,id:i.u},...u,{t:l,id:i.v}];for(let m=0;m+1<h.length;m++){let[d,g]=[h[m],h[m+1]];n.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 n}var Oa=r=>({room_id:r.room,edge:r.edge,t0:r.t0,t1:r.t1});function bh(r,e){let t=new Map(r.map(a=>[a.id,a])),n=new Map;for(let a of e){let l=`${a.room}:${a.edge}`;n.set(l,[...n.get(l)??[],a.t0].sort((c,u)=>c-u))}let i=a=>{let l=t.get(a.room)?.wall_heights?.[a.edge];return Array.isArray(l)?l[(n.get(`${a.room}:${a.edge}`)??[]).indexOf(a.t0)]??null:l},o=a=>{let l=t.get(a.room),[c,u]=[l?.wall_heights?.[a.edge],l?.wall_slopes?.[a.edge]];if(!l||typeof c!="number"||typeof u!="number"||c<=0||u<=0)return null;let[h,m]=[l.points[a.edge],l.points[(a.edge+1)%l.points.length]];return{from:c,to:u,length:Math.hypot(m[0]-h[0],m[1]-h[1])}},s=a=>{let l=o(a);if(!l||l.length<1e-9){let u=i(a);return typeof u=="number"&&u>0?[u,u]:[null,null]}let c=u=>l.from+(l.to-l.from)*u/l.length;return a.forward?[c(a.t0),c(a.t1)]:[c(a.t1),c(a.t0)]};return{heightsOf(a){let[l,c]=[1/0,1/0];for(let h of a){let[m,d]=s(h),[g,_]=h===a[0]?[m,d]:[d,m];g!==null&&(l=Math.min(l,g)),_!==null&&(c=Math.min(c,_))}let u=a.map(h=>t.get(h.room)?.ceiling);if(u.every(h=>typeof h=="number"&&h>0)){let h=Math.max(...u);l===1/0&&(l=h),c===1/0&&(c=h)}return{...l<1/0?{a:l}:{},...c<1/0?{b:c}:{}}},thicknessOf(a){let l=a.map(c=>{let u=t.get(c.room)?.wall_thickness?.[c.edge];return Array.isArray(u)?u[(n.get(`${c.room}:${c.edge}`)??[]).indexOf(c.t0)]:u}).filter(c=>typeof c=="number"&&c>0);return l.length?Math.max(...l):void 0},hasNoWall:a=>a.some(l=>i( Line truncated `]};customElements.get("nf-room-hvac")||customElements.define("nf-room-hvac",Bi);var Ki={electricity:"Strom",water:"Wasser",gas:"Gas",heating:"Heizen",cooling:"K\xFChlen"},qa={electricity:"\u26A1",water:"\u{1F4A7}",gas:"\u{1F525}",heating:"\u2668",cooling:"\u2744"},Gi=r=>r.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/ß/g,"ss").replace(/[^a-z0-9]+/g," ").trim(),Dh="{485D0419-BE97-4548-AA9C-C083EB82E61E}",Fh=r=>r.object_type!==0&&!(r.object_type===1&&r.module_id?.toUpperCase()===Dh)?null:{elektro:"electricity",strom:"electricity","elektro strom":"electricity","strom elektro":"electricity",wasser:"water",gas:"gas",heizen:"heating",heizung:"heating",warme:"heating",waerme:"heating",kuhlen:"cooling",kuehlen:"cooling",kuhlung:"cooling",kuehlung:"cooling",kalte:"cooling",kaelte:"cooling"}[Gi(r.name)]??null,Ga=r=>/^symcon-category-(\d+)$/.exec(r??"")?.[1],Za=r=>/\b(heute|tag|tagesverbrauch|today|daily)\b/.test(r)?"day":/monat|month/.test(r)?"month":/jahr|year/.test(r)?"year":"total",Ui=(r,e)=>String(r.states[e]?.attributes.symcon_source_entity||e);function Ya(r){let e=String(r?.attributes.unit_of_measurement??"").trim(),t=e.replace(/[³]/g,"3").replace(/[²]/g,"2").replace(/\s+/g,"").toLowerCase();return["w","kw","mw"].includes(t)?{metric:"power",unit:"W",factor:e==="mW"?.001:t==="kw"?1e3:t==="mw"?1e6:1}:["wh","kwh","mwh","j","kj","mj","gj"].includes(t)?{metric:"energy",unit:"kWh",factor:{wh:.001,kwh:1,mwh:1e3,j:1/36e5,kj:1/3600,mj:1/3.6,gj:1e3/3.6}[t]}:["m3/h","m3h","m3/min","m3/s","l/h","l/min","l/s","liter/h","liter/min"].includes(t)?{metric:"power",unit:"m\xB3/h",factor:{"m3/h":1,m3h:1,"m3/min":60,"m3/s":3600,"l/h":.001,"l/min":.06,"l/s":3.6,"liter/h":.001,"liter/min":.06}[t]}:["m3","l","liter"].includes(t)?{metric:"energy",unit:"m\xB3",factor:t==="m3"?1:.001}:null}function Hh(r,e){if(!e.entity_id||e.object_type!==2&&e.object_type!==6)return null;let t=Ui(r,e.entity_id),n=r.states[t];if(!n||![1,2].includes(Number(n.attributes.symcon_variable_type)))return null;let i=Gi(e.name),o=Ya(n),s=/^(leistung|wirkleistung|gesamtleistung|aktuelle leistung|durchfluss|volumenstrom)(\b|$)/.test(i),a=/^(verbrauch|energie|energieverbrauch|gesamtverbrauch|gesamtenergie|zahlerstand|zaehlerstand|arbeit)(\b|$)/.test(i),l=o?.metric??(s?"power":a?"energy":null);if(!l)return null;let c=l==="power"?/^(leistung|wirkleistung|gesamtleistung|durchfluss|volumenstrom)$/.test(i):/^(verbrauch|energie|energieverbrauch|gesamtverbrauch|gesamtenergie|zahlerstand|zaehlerstand|arbeit)$/.test(i),u=l==="energy"?Za(i):"total";return{metric:l,source:t,period:u,group:`${l}|${o?.unit??String(n.attributes.unit_of_measurement??"")}|${u}`,score:/^gesamt(leistung|verbrauch|energie)$/.test(i)?110:c?100:(l==="power"?s:a)?70:20}}var Ua=new WeakMap,ja=new WeakMap;function Ph(r){let e=Ua.get(r);if(e)return e;let t={nodes:new Map(r.map(n=>[n.object_id,n])),children:new Map};for(let n of r){let i=t.children.get(n.parent_id)??[];i.push(n),t.children.set(n.parent_id,i)}return Ua.set(r,t),t}function ji(r,e,t){if(!U(r))return[];let n=[e.area_id,...e.sub_areas??[]].map(Ga).filter(m=>!!m);if(!n.length)return[];let i=new Set(t.filter(m=>m.id!==e.id).flatMap(m=>[m.area_id,...m.sub_areas??[]]).map(Ga).filter(m=>!!m&&!n.includes(m))),o=`${n.join(",")}|${[...i].sort().join(",")}`,s=ja.get(r)??new Map;ja.set(r,s);let a=s.get(o);if(a)return a;let l=Ph(r.symconObjects),c=[],u=new Set,d=(m,h,g)=>{if(u.has(m)||i.has(String(m)))return;u.add(m);let _=l.nodes.get(m);if(!_)return;let b=Fh(_),v=b??h,k=new Set(b&&b!==h?[]:g),S=l.children.get(m)??[];if(v){let M=S.map(T=>Hh(r,T)).filter(T=>T!==null);for(let T of new Set(M.map(z=>z.group))){if(k.has(T))continue;let z=M.filter(E=>E.group===T),$=Math.max(...z.map(E=>E.score)),C=z.filter(E=>E.score===$);for(let E of $>=100?C.slice(0,1):C)c.push({kind:v,metric:E.metric,id:E.source,period:E.period});k.add(T)}}for(let M of S)(M.object_type===0||M.object_type===1)&&d(M.object_id,v,k)};for(let m of n)d(Number(m),null,new Set);return s.set(o,c),c}function Ja(r,e,t=!1){let n=new Map,i=new Set;for(let o of e){let s=Ui(r,o.id),a=`${o.kind}|${o.metric}|${s}`;if(i.has(a))continue;i.add(a);let l=r.states[s],c=Ya(l),u=c?.metric===o.metric?c.unit:String(l?.attributes.unit_of_measurement??"").trim(),d=`${o.kind}|${o.metric}|${u}|${o.period}`,m=n.get(d)??{kind:o.kind,metric:o.metric,unit:u,value:0,period:o.period,sources:[],manual:t,incomplete:!1},h=Pe(l);h===null?m.incomplete=!0:m.value+=h*(c?.metric===o.metric?c.factor:1),m.sources.push(s),n.set(d,m)}return[...n.values()].map(o=>o.incomplete?{...o,value:null}:o)}function ln(r,e,t=[]){return Ja(r,ji(r,e,t))}function Vi(r,e,t,n){let i=e.utility_meters?.[t],o=i&&Object.prototype.hasOwnProperty.call(i,n)?i[n]:t==="electricity"&&n==="power"?e.power_entity:null;return o&&o!=="none"?Ui(r,o):null}function cn(r,e,t=e.rooms){let n=e.rooms.flatMap(o=>ji(r,o,t)),i=[];for(let o of Qt)for(let s of["power","energy"]){let a=Vi(r,e,o,s);i.push(...Ja(r,a?[{kind:o,metric:s,id:a,period:s==="energy Line truncated
<path d=${dr(r)} /> <h4>${qa[e]} ${Ki[e]}</h4>
</svg>`,Sr={previous:"M6 6h2v12H6zM20 6v12l-10-6z",play:"M8 5v14l11-7z",pause:"M7 5h4v14H7zM13 5h4v14h-4z",next:"M16 6h2v12h-2zM4 6v12l10-6z"},ji=r=>p`<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d=${r} /></svg>`,om=24,sm=10,qi=class extends re{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 n=e.moods??[],i=!!this.rooms&&!!this.hass.user?.is_admin;if(!n.length&&!i)return f;let o=(this.rooms??[]).filter(l=>l.id!==e.id&&l.area_id),s=l=>K(this.hass,l).filter(c=>c.startsWith("light.")),a=()=>{let l=(this._moodName??"").trim()||this.t("mood_new");this.fireMoods(e,[...n,{id:`mood_${Date.now().toString(36)}`,name:l,lights:t.map(xr)}]),this._moodName=null};return p`<div class="nf-rp-moods"> ${this.readings.filter(t=>t.kind===e).map(t=>p`<div class="reading" title=${`${t.manual?"Stockwerksz\xE4hler":"Bereichsz\xE4hler"}${t.incomplete?" \xB7 Wert nicht verf\xFCgbar":""}
${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states[n]?.attributes.friendly_name||n).join(`
`)}`}>
<span>${Xa(t)}${t.manual?p` <small>· Zähler</small>`:""}</span><b>${el(this.hass,t)}</b>
</div>`)}
</section>`)}`}static styles=Q`
:host { display:block; color:var(--nf-text); font:inherit; }
section { padding:10px 0; border-bottom:1px solid var(--nf-line,#ffffff20); }
section:last-child { border:0; }
h4 { font:inherit; font-weight:600; margin:0 0 6px; }
.reading { display:flex; justify-content:space-between; gap:16px; margin:4px 0; }
.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",qi);var J=(r,e)=>[r[0]-e[0],r[1]-e[1]],Ee=(r,e)=>[r[0]+e[0],r[1]+e[1]],ve=(r,e)=>[r[0]*e,r[1]*e],ae=(r,e)=>r[0]*e[0]+r[1]*e[1],Ie=(r,e)=>r[0]*e[1]-r[1]*e[0],Ce=r=>Math.hypot(r[0],r[1]),ye=r=>{let e=Ce(r)||1;return[r[0]/e,r[1]/e]},Zi=r=>[-r[1],r[0]],Yi=r=>[r[1],-r[0]];function tl(r){let e=r.heightEnd!==void 0;return{...r,a:r.b,b:r.a,left:r.right,right:r.left,roomLeft:r.roomRight,roomRight:r.roomLeft,height:e?r.heightEnd:r.height,heightEnd:e?r.height:void 0}}function Ih(r,e){let t=r.map(n=>({...n}));for(let n of e){let i=t.find(o=>o.room_id===n.room_id&&o.edge===n.edge&&(Math.abs(o.t1-n.t0)<1e-6||Math.abs(n.t1-o.t0)<1e-6));i?(i.t0=Math.min(i.t0,n.t0),i.t1=Math.max(i.t1,n.t1)):t.push({...n})}return t}function Ch(r,e,t){if(r.a===e.b)return!1;let n=ye(J(t[r.b],t[r.a])),i=ye(J(t[e.b],t[e.a]));return Math.abs(Ie(n,i))>1e-6||ae(n,i)<=0||r.free||e.free||r.heightEnd!==void 0||e.heightEnd!==void 0?!1:r.height===e.height&&r.exterior===e.exterior&&r.roomLeft===e.roomLeft&&r.roomRight===e.roomRight&&Math.abs(r.left-e.left)<=1e-9&&Math.abs(r.right-e.right)<=1e-9}function nl(r,e,t=new Set){let n=r.slice();for(;;){let i=new Map;n.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=n[a[0]].b===s?n[a[0]]:tl(n[a[0]]),c=n[a[1]].a===s?n[a[1]]:tl(n[a[1]]);if(!Ch(l,c,e))continue;let u={...l,b:c.b,sources:Ih(l.sources,c.sources)};o=[...n.filter((d,m)=>m!==a[0]&&m!==a[1]),u];break}if(!o)return n;n=o}}function rl(r,e){let t=new Map;r.forEach((i,o)=>{let s=ye(J(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:ve(s,-1),left:i.right,right:i.left,angle:Math.atan2(-s[1],-s[0])}]];for(let[l,c]of a)t.set(l,[...t.get(l)??[],c])});let n=new Map;for(let[i,o]of t){let s=e[i];o.sort((l,c)=>l.angle-c.angle);for(let l of o)n.set(l.key,{left:Ee(s,ve(Zi(l.d),l.left)),right:Ee(s,ve(Yi(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,c)=>{let u=o[(c+1)%o.length],d=Ee(s,ve(Zi(l.d),l.left)),m=Ee(s,ve(Yi(u.d),u.right)),h=Ie(l.d,u.d);if(Math.abs(h)<1e-4)return;let g=Ee(d,ve(l.d,Ie(J(m,d),u.d)/h));Ce(J(g,s))>a||(n.get(l.key).left=g,n.get(u.key).right=g)})}return n}function il(r,e){let t=r.filter((n,i)=>Ce(J(n,r[(i+1)%r.length]))>e);for(;;){if(t.length<=3)return t;let n=t.findIndex((i,o)=>{let s=t[(o+t.length-1)%t.length],a=t[(o+1)%t.length],[l,c]=[J(i,s),J(a,i)];return Math.abs(Ie(ye(l),ye(c)))<1e-7&&ae(l,c)>0});if(n===-1)return t;t=t.filter((i,o)=>o!==n)}}function Nh(r){let e=[];return{points:e,idOf(t){let n=e.findIndex(i=>Math.abs(i[0]-t[0])<=r&&Math.abs(i[1]-t[1])<=r);return n>=0?n:(e.push([t[0],t[1]]),e.length-1)}}}function Wh(r,e){let t=[];for(let n of r){let i=n.points;if(i.length<3||Math.abs(lt(i))<1e-6)continue;let o=lt(i)>0,s=i.map(a=>e.idOf(a));s.forEach((a,l)=>{let c=s[(l+1)%s.length];a!==c&&t.push(o?{u:a,v:c,room:n.id,edge:l,forward:!0}:{u:c,v:a,room:n.id,edge:l,forward:!1})})}return t}function Oh(r,e,t){let n=[];for(let i of r){let[o,s]=[e[i.u],e[i.v]],a=J(s,o),l=Ce(a),c=ve(a,1/l),u=e.map((m,h)=>({id:h,rel:J(m,o)})).filter(({id:m,rel:h})=>m!==i.u&&m!==i.v&&ae(h,c)>t&&ae(h,c)<l-t&&Math.abs(Ie(c,h))<=t).map(({id:m,rel:h})=>({t:ae(h,c),id:m})).sort((m,h)=>m.t-h.t),d=[{t:0,id:i.u},...u,{t:l,id:i.v}];for(let m=0;m+1<d.length;m++){let[h,g]=[d[m],d[m+1]];n.push({u:h.id,v:g.id,room:i.room,edge:i.edge,t0:i.forward?h.t:l-g.t,t1:i.forward?g.t:l-h.t,forward:i.forward})}}return n}var ol=r=>({room_id:r.room,edge:r.edge,t0:r.t0,t1:r.t1});function Lh(r,e){let t=new Map(r.map(a=>[a.id,a])),n=new Map;for(let a of e){let l=`${a.room}:${a.edge}`;n.set(l,[...n.get(l)??[],a.t0].sort((c,u)=>c-u))}let i=a=>{let l=t.get(a.room)?.wall_heights?.[a.edge];return Array.isArray(l)?l[(n.get(`${a.room}:${a.edge}`)??[]).indexOf(a.t0)]??null:l},o=a=>{let l=t.get(a.room),[c,u]=[l?.wall_heights?.[a.edge],l?.wall_slopes?.[a.edge]];if(!l||typeof c!="number"||typeof u!="number"||c<=0||u<=0)return null;let[d,m]=[l.points[a.edge],l.points[(a.edge+1)%l.points.length]];return{from:c,to:u,length:Math.hypot(m[0]-d[0],m[1]-d[1])}},s=a=>{let l=o(a);if(!l||l.length<1e-9){let u=i(a);return typeof u=="number"&&u>0?[u,u]:[null,null]}let c=u=>l.from+(l.to-l.from)*u/l.length;return a.forward?[c(a.t0),c(a.t1)]:[c(a.t1),c(a.t0)]};return{heightsOf(a){let[l,c]=[1/0,1/0];for(let d of a){let[m,h]=s(d),[g,_]=d===a[0]?[m,h]:[h,m];g!==null&&(l=Math.min(l,g)),_!==null&&(c=Math.min(c,_))}let u=a.map(d=>t.get(d.room)?.ceiling);if(u.every(d=>typeof d=="number"&&d>0)){let d=Math.max(...u);l===1/0&&(l=d),c===1/0&&(c=d)}return{...l<1/0?{a:l}:{},...c<1/0?{b:c}:{}}},thicknessOf(a){let l=a.map(c=>{let u=t.get(c.room)?.wall_thickness?.[c.edge];return Array.isArray(u)?u[(n.get(`${c.room}:${c.edge}`)??[]).indexOf(c.t0)]:u}).filter(c=>typeof c=="number"&&c>0);return l.length?Math.max(...l):void 0},hasNoWall:a=>a.s Line truncated
<path d=${pr(r)} />
</svg>`,Ar={previous:"M6 6h2v12H6zM20 6v12l-10-6z",play:"M8 5v14l11-7z",pause:"M7 5h4v14H7zM13 5h4v14h-4z",next:"M16 6h2v12h-2zM4 6v12l10-6z"},no=r=>p`<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d=${r} /></svg>`,Em=24,Rm=10,ro=class extends X{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 Mr(e))this.call("light",t.service,t.data)}renderMoods(e,t){let n=e.moods??[],i=!!this.rooms&&!!this.hass.user?.is_admin;if(!n.length&&!i)return f;let o=(this.rooms??[]).filter(l=>l.id!==e.id&&l.area_id),s=l=>K(this.hass,l).filter(c=>c.startsWith("light.")),a=()=>{let l=(this._moodName??"").trim()||this.t("mood_new");this.fireMoods(e,[...n,{id:`mood_${Date.now().toString(36)}`,name:l,lights:t.map($r)}]),this._moodName=null};return p`<div class="nf-rp-moods">
${n.map(l=>p`<span class="nf-rp-mood"> ${n.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> <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=${c=>{let u=c.target,h=o.find(m=>m.id===u.value);u.value="",h&&this.runMood(wl(l,s(h)))}}> ${o.length?p`<select class="nf-rp-mood-to" aria-label=${this.t("mood_carry")} title=${this.t("mood_carry")} @change=${c=>{let u=c.target,d=o.find(m=>m.id===u.value);u.value="",d&&this.runMood(Wl(l,s(d)))}}>
<option value="">→</option> <option value="">→</option>
${o.map(c=>p`<option value=${c.id}>${c.name}</option>`)} ${o.map(c=>p`<option value=${c.id}>${c.name}</option>`)}
</select>`:f} </select>`:f}
@@ -253,51 +269,52 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
><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()} /> ><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 <button class="nf-btn" @click=${a}>${this.t("mood_save")}</button></span
>`:f} >`:f}
</div>`}async loadCurve(e){let t=Ue(this.hass,this.floor,e,"temperature"),n=t.length?t:K(this.hass,e).filter(s=>s.startsWith("climate."));if(!n.length)return;let i=Date.now(),o=i-24*36e5;try{let s=await pn(this.hass,n,o,i,!!t.length);if(this.room?.id!==e.id)return;let a=[];for(let l=1;l<=96;l++){let c=Ft(this.hass,s,o+(i-o)*l/96),u=n.map(h=>h.startsWith("climate.")?Number(c.states[h]?.attributes.current_temperature):Number(c.states[h]?.state)).filter(Number.isFinite);a.push(u.length?u.reduce((h,m)=>h+m,0)/u.length:null)}this._curve=a.some(l=>l!==null)?a:null}catch{this._curve=null}}async loadEnergy(e){if(!this.floor||!this.building)return;let t=Gi(this.hass,this.building,this.floor,e);try{let n=await dl(this.hass,t);this.room?.id===e.id&&(this._energy=n)}catch{this._energy=null}}renderEmptyLights(e,t){if(!t.length||!this.room)return f;let n=K(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(!n.length||n.some(s=>s.state!=="off"))return f;let i=Math.max(...n.map(s=>Date.parse(String(s.last_changed??""))||0)),o=Math.floor((Date.now()-i)/6e4);return!i||o<sm?f:p`<div class="nf-rp-shade"> </div>`}async loadCurve(e){let t=je(this.hass,this.floor,e,"temperature"),n=t.length?t:K(this.hass,e).filter(s=>s.startsWith("climate."));if(!n.length)return;let i=Date.now(),o=i-24*36e5;try{let s=await _n(this.hass,n,o,i,!!t.length);if(this.room?.id!==e.id)return;let a=[];for(let l=1;l<=96;l++){let c=Ht(this.hass,s,o+(i-o)*l/96),u=n.map(d=>d.startsWith("climate.")?Number(c.states[d]?.attributes.current_temperature):Number(c.states[d]?.state)).filter(Number.isFinite);a.push(u.length?u.reduce((d,m)=>d+m,0)/u.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(U(this.hass)){this._energy=null;return}let t=eo(this.hass,this.building,this.floor,e);try{let n=await zl(this.hass,t);this.room?.id===e.id&&(this._energy=n)}catch{this._energy=null}}renderEmptyLights(e,t){if(!t.length||!this.room)return f;let n=K(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(!n.length||n.some(s=>s.state!=="off"))return f;let i=Math.max(...n.map(s=>Date.parse(String(s.last_changed??""))||0)),o=Math.floor((Date.now()-i)/6e4);return!i||o<Rm?f:p`<div class="nf-rp-shade">
<span>💡 ${this.t("empty_lights_hint",{n:t.length,min:o})}</span> <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> <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 n=e.filter(a=>a.attributes.hvac_action==="heating"||a.state==="heat"&&a.attributes.hvac_action===void 0);if(!n.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 n)(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"> </div>`}renderOpenWhileHeating(e){let t=this.room;if(!t||!this.floor)return f;let n=e.filter(a=>a.attributes.hvac_action==="heating"||a.state==="heat"&&a.attributes.hvac_action===void 0);if(!n.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 n)(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> <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> <button class="nf-btn nf-rp-small" @click=${s}>${this.t("open_heating_off")}</button>
</div>`}renderShade(){let e=this.room,{latitude:t,longitude:n}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||n===void 0)return f;let i=U(this.hass,this.floor,e,"temperature");if(i===null||i<om)return f;let o=a=>{let l=a&&a!=="none"?this.hass.states[a]:void 0;if(!l||I(l))return!1;let c=l.attributes.current_position;return typeof c=="number"?c>30:l.state==="open"},s=[...new Set(il(this.building,this.floor,e,{latitude:t,longitude:n}).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:n}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||n===void 0)return f;let i=j(this.hass,this.floor,e,"temperature");if(i===null||i<Em)return f;let o=a=>{let l=a&&a!=="none"?this.hass.states[a]:void 0;if(!l||I(l))return!1;let c=l.attributes.current_position;return typeof c=="number"?c>30:l.state==="open"},s=[...new Set(kl(this.building,this.floor,e,{latitude:t,longitude:n}).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:`${W(this.hass,se(this.hass,i),1)} ${te(this.hass)}`})}</span> <span>☀ ${this.t("shade_hint",{n:s.length,temp:`${W(this.hass,se(this.hass,i),1)} ${ne(this.hass)}`})}</span>
<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:s})}>${this.t("shade_close")}</button> <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:n}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||n===void 0)return f;let i={latitude:t,longitude:n};if(!Tt(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}> </div>`:f}renderSunYear(){let e=this.room,{latitude:t,longitude:n}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||n===void 0)return f;let i={latitude:t,longitude:n};if(!Dt(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")} ☀ ${this.t("room_sun_year")}
</button>`;if(!this._sunYear)return s;let a=rl(this.building,this.floor,e,i),l=Math.max(1,...a),c=Array.from({length:12},(u,h)=>new Date(2026,h,15).toLocaleDateString(this.hass.language,{month:"narrow"}));return p`${s} </button>`;if(!this._sunYear)return s;let a=xl(this.building,this.floor,e,i),l=Math.max(1,...a),c=Array.from({length:12},(u,d)=>new Date(2026,d,15).toLocaleDateString(this.hass.language,{month:"narrow"}));return p`${s}
<div class="nf-rp-sun-bars" role="img" aria-label=${a.map((u,h)=>`${c[h]} ${W(this.hass,u,1)} h`).join(", ")}> <div class="nf-rp-sun-bars" role="img" aria-label=${a.map((u,d)=>`${c[d]} ${W(this.hass,u,1)} h`).join(", ")}>
${a.map((u,h)=>p`<span title=${`${W(this.hass,u,1)} h`}><i style=${`height:${Math.round(u/l*100)}%`}></i><b>${c[h]}</b></span>`)} ${a.map((u,d)=>p`<span title=${`${W(this.hass,u,1)} h`}><i style=${`height:${Math.round(u/l*100)}%`}></i><b>${c[d]}</b></span>`)}
</div>`}renderEnergy(){let e=this._energy;if(!e||e.month<=0)return f;let t=this.building?.energy.tariff,n=t?this.hass.states[t]:void 0,i=n?{value:Number(n.state),unit:String(n.attributes.unit_of_measurement??"")}:null,o=hl(e.month,i),s=a=>`${W(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,n=t?this.hass.states[t]:void 0,i=n?{value:Number(n.state),unit:String(n.attributes.unit_of_measurement??"")}:null,o=Tl(e.month,i),s=a=>`${W(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 ${W(this.hass,o.value,2)} ${o.currency}`:""} ⚡ ${this.t("room_energy",{today:s(e.today),month:s(e.month)})}${o?` \xB7 ${W(this.hass,o.value,2)} ${o.currency}`:""}
</p>`}renderCurve(){let e=this._curve;if(!e)return f;let t=e.filter(c=>c!==null),n=Math.min(...t),i=Math.max(...t),o=Math.max(1,i-n),s=e.map(c=>c===null?null:c-n+o*.1),a=fn(s,220,36,o*1.2),l=c=>`${W(this.hass,se(this.hass,c),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(c=>c!==null),n=Math.min(...t),i=Math.max(...t),o=Math.max(1,i-n),s=e.map(c=>c===null?null:c-n+o*.1),a=bn(s,220,36,o*1.2),l=c=>`${W(this.hass,se(this.hass,c),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">${ee`<path d=${a}></path>`}</svg> <svg viewBox="0 0 220 36" preserveAspectRatio="none" aria-hidden="true">${te`<path d=${a}></path>`}</svg>
<span>24 h · ${l(n)} – ${l(i)}</span> <span>24 h · ${l(n)} – ${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 M(this.hass,e,t)}call(e,t,n){this.hass.callService(e,t,n)}renderClean(e){let t=e.clean_entity,n=t?this.hass.states[t]:void 0;if(!t||!n)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=${I(n)} title=${this.t("room_clean_run_hint")} @click=${o}>🧹 ${this.t("room_clean_run")}</button></div>`}allOff(e){let t=mn(e);for(let n of t.off)this.call(n.domain,n.service,n.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}=mn(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 n of t.placements)if(n.entity_id===e)return n}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=${()=>be(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,n){let i=()=>{this.confirmEntities?.has(e.entity_id)&&!confirm(this.t("confirm_switch",{name:this.name(e.entity_id)}))||n()};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 A(this.hass,e,t)}call(e,t,n){this.hass.callService(e,t,n)}renderClean(e){let t=e.clean_entity,n=t?this.hass.states[t]:void 0;if(!t||!n)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=${I(n)} title=${this.t("room_clean_run_hint")} @click=${o}>🧹 ${this.t("room_clean_run")}</button></div>`}allOff(e){let t=gn(e);for(let n of t.off)this.call(n.domain,n.service,n.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}=gn(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 n of t.placements)if(n.entity_id===e)return n}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=${()=>be(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,n){let i=()=>{this.confirmEntities?.has(e.entity_id)&&!confirm(this.t("confirm_switch",{name:this.name(e.entity_id)}))||n()};return p`<button
class="nf-switch" class="nf-switch"
role="switch" role="switch"
aria-checked=${t?"true":"false"} aria-checked=${t?"true":"false"}
aria-label=${this.name(e.entity_id)} aria-label=${this.name(e.entity_id)}
?disabled=${I(e)} ?disabled=${I(e)}
@click=${i} @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 n=e??K(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?ia(this.hass,this.floor,t):{shown:n,more:[]}},a=Si(this.hass,s).map(z=>z.primary),l=a.length,c=[t.floor_heating,...Object.values(t.hvac??{}).flat()].filter(z=>!!z&&z!=="none"),u=new Set(c.map(z=>this.hass.states[z]?.attributes.symcon_id).filter(Boolean)),h=(this._showAll?[...o,...a]:o).filter(z=>!J(this.hass)||!u.has(this.hass.states[z]?.attributes.symcon_id)),m=z=>h.filter($=>z.includes(F($))).map($=>this.hass.states[$]),d=m(["light"]),g=m(["cover"]),_=m(["climate"]),b=m(["media"]),v=m(["switch","fan","lock"]),k=m(["sensor","binary"]),S=m(["scene","script"]),E=this.facts(_),T=d.filter(z=>z.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 n=e??K(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?ma(this.hass,this.floor,t):{shown:n,more:[]}},a=Ai(this.hass,s).map(z=>z.primary),l=a.length,c=[t.floor_heating,...Object.values(t.hvac??{}).flat()].filter(z=>!!z&&z!=="none"),u=new Set(c.map(z=>this.hass.states[z]?.attributes.symcon_id).filter(Boolean)),d=(this._showAll?[...o,...a]:o).filter(z=>!U(this.hass)||!u.has(this.hass.states[z]?.attributes.symcon_id)),m=z=>d.filter($=>z.includes(F($))).map($=>this.hass.states[$]),h=m(["light"]),g=m(["cover"]),_=m(["climate"]),b=m(["media"]),v=m(["switch","fan","lock"]),k=m(["sensor","binary"]),S=m(["scene","script"]),M=this.facts(_),T=h.filter(z=>z.state==="on");return p`<section class="nf-rp" aria-label=${t.name}>
<header class="nf-rp-head"> <header class="nf-rp-head">
<div> <div>
<h2>${t.name}</h2> <h2>${t.name}</h2>
${E.length?p`<p class="nf-rp-facts">${E.join(" \xB7 ")}</p>`:f} ${this.renderEnergy()} ${this.renderSunYear()} ${this.renderShade()} ${M.length?p`<p class="nf-rp-facts">${M.join(" \xB7 ")}</p>`:f} ${this.renderEnergy()} ${this.renderSunYear()} ${this.renderShade()}
${this.renderOpenWhileHeating(_)} ${this.renderEmptyLights(t,T)} ${this.renderOpenWhileHeating(_)} ${this.renderEmptyLights(t,T)}
${this.renderCurve()} ${this.renderCurve()}
</div> </div>
<button class="nf-rp-close" aria-label=${this.t(this._folded?"panel_unfold":"panel_fold")} title=${this.t(this._folded?"panel_unfold":"panel_fold")} aria-expanded=${this._folded?"false":"true"} @click=${()=>this._folded=!this._folded}> <button class="nf-rp-close" aria-label=${this.t(this._folded?"panel_unfold":"panel_fold")} title=${this.t(this._folded?"panel_unfold":"panel_fold")} aria-expanded=${this._folded?"false":"true"} @click=${()=>this._folded=!this._folded}>
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${this._folded?ee`<path d="M6 14l6-6 6 6" />`:ee`<path d="M6 12h12" />`}</svg> <svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${this._folded?te`<path d="M6 14l6-6 6 6" />`:te`<path d="M6 12h12" />`}</svg>
</button> </button>
<button class="nf-rp-close" aria-label=${this.t("close")} @click=${()=>this.fire("close")}> <button class="nf-rp-close" aria-label=${this.t("close")} @click=${()=>this.fire("close")}>
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M6 6l12 12M18 6L6 18" /></svg> <svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M6 6l12 12M18 6L6 18" /></svg>
</button> </button>
</header> </header>
<div class="nf-rp-body" ?hidden=${this._folded}> <div class="nf-rp-body" ?hidden=${this._folded}>
${this.renderAllOff([...d,...b,...v])} <nf-utility-report .hass=${this.hass} .readings=${ln(this.hass,t,this.building?.floors.flatMap(z=>z.rooms))}></nf-utility-report>
${this.renderAllOff([...h,...b,...v])}
${this.renderClean(t)} ${this.renderClean(t)}
${!t.area_id&&!e&&!(J(this.hass)&&c.length)?p`<p class="nf-rp-note">${this.t("panel_no_area")}</p>`:!h.length&&!(J(this.hass)&&c.length)?p`<p class="nf-rp-note">${this.t("panel_empty")}</p>`:f} ${!t.area_id&&!e&&!(U(this.hass)&&c.length)?p`<p class="nf-rp-note">${this.t("panel_no_area")}</p>`:!d.length&&!(U(this.hass)&&c.length)?p`<p class="nf-rp-note">${this.t("panel_empty")}</p>`:f}
${S.length?this.section("panel_scenes",[p`<div class="nf-rp-scenes"> ${S.length?this.section("panel_scenes",[p`<div class="nf-rp-scenes">
${S.map(z=>p`<button ${S.map(z=>p`<button
class="nf-btn" class="nf-btn"
@@ -307,44 +324,44 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${this.name(z.entity_id)} ${this.name(z.entity_id)}
</button>`)} </button>`)}
</div>`]):f} </div>`]):f}
${d.length?this.section("panel_lights",[...d.map(z=>this.lightRow(z)),...t?[this.renderMoods(t,d)]:[]],p`${T.length<d.length?p`<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_on",{entity_id:d.filter(z=>!I(z)).map(z=>z.entity_id)})}> ${h.length?this.section("panel_lights",[...h.map(z=>this.lightRow(z)),...t?[this.renderMoods(t,h)]:[]],p`${T.length<h.length?p`<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_on",{entity_id:h.filter(z=>!I(z)).map(z=>z.entity_id)})}>
${this.t("panel_all_on")} ${this.t("panel_all_on")}
</button>`:f}${T.length?p`<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_off",{entity_id:T.map(z=>z.entity_id)})}> </button>`:f}${T.length?p`<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_off",{entity_id:T.map(z=>z.entity_id)})}>
${this.t("panel_all_off")} ${this.t("panel_all_off")}
</button>`:f}`):f} </button>`:f}`):f}
${g.length?this.section("panel_covers",g.map(z=>this.coverRow(z)),g.length>1&&Jn(g,this.confirmEntities).length?p`<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","open_cover",{entity_id:Jn(g,this.confirmEntities)})}> ${g.length?this.section("panel_covers",g.map(z=>this.coverRow(z)),g.length>1&&er(g,this.confirmEntities).length?p`<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","open_cover",{entity_id:er(g,this.confirmEntities)})}>
${this.t("panel_all_open")}</button ${this.t("panel_all_open")}</button
><button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:Jn(g,this.confirmEntities)})}> ><button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:er(g,this.confirmEntities)})}>
${this.t("panel_all_close")} ${this.t("panel_all_close")}
</button>`:f):f} </button>`:f):f}
${J(this.hass)?p`<nf-room-hvac .hass=${this.hass} .room=${t}></nf-room-hvac>`:f} ${U(this.hass)?p`<nf-room-hvac .hass=${this.hass} .room=${t}></nf-room-hvac>`:f}
${_.length?this.section("panel_climate",_.map(z=>this.climateRow(z))):f} ${_.length?this.section("panel_climate",_.map(z=>this.climateRow(z))):f}
${b.length?this.section("panel_media",b.map(z=>this.mediaRow(z))):f} ${b.length?this.section("panel_media",b.map(z=>this.mediaRow(z))):f}
${v.length?this.section("panel_switches",v.map(z=>this.switchRow(z))):f} ${v.length?this.section("panel_switches",v.map(z=>this.switchRow(z))):f}
${k.length?this.section("panel_sensors",k.map(z=>this.sensorRow(z))):f} ${k.length?this.section("panel_sensors",k.map(z=>this.sensorRow(z))):f}
${this.extraValues(t)} ${this.extraValues(t)}
${!J(this.hass)&&Fa(this.hass)&&Da(this.hass,this.floor,t)?this.announceSection(t):f} ${!U(this.hass)&&Ba(this.hass)&&La(this.hass,this.floor,t)?this.announceSection(t):f}
${this.pluginSections(t,h)} ${this.pluginSections(t,d)}
${l?p`<button class="nf-btn nf-rp-small nf-rp-more" @click=${()=>this._showAll=!this._showAll}> ${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})} ${this._showAll?this.t("panel_less"):this.t("panel_more",{n:l})}
</button>`:f} </button>`:f}
</div> </div>
</section>`}extraValues(e){if(!this.floor)return f;let t=[...this.floor.placements.filter(n=>!n.outside&&P([n.x,n.z],e.points)).map(n=>({name:n.name||O(this.hass,n.entity_id),rows:hr(this.hass,n.values)})),...this.floor.furniture.filter(n=>P([n.x,n.z],e.points)).map(n=>({name:n.name||(n.entity&&n.entity!=="none"?O(this.hass,n.entity):this.t("device")),rows:hr(this.hass,n.values)}))].filter(n=>n.rows.length);return t.length?this.section("device_values",t.map(n=>p`<div class="nf-extra-values"><b>${n.name}</b>${n.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}</b></div>`)}</div>`)):f}facts(e){let t=[],n=this.room;if(!n)return t;let i=($,C)=>{let R=U(this.hass,this.floor,n,$);if(R===null)return null;if($==="temperature")return`${W(this.hass,se(this.hass,R),1)} ${te(this.hass)}`;let A=Ue(this.hass,this.floor,n,$)[0],H=this.hass.states[A]?.attributes.unit_of_measurement??C;return`${W(this.hass,R,1)} ${H}`},o=e.find($=>typeof $.attributes.current_temperature=="number"),s=i("temperature","\xB0C");s?t.push(s):o&&n.climate?.temperature!=="none"&&t.push(`${W(this.hass,o.attributes.current_temperature,1)} ${te(this.hass)}`);let a=i("humidity","%");a&&t.push(a);let l=U(this.hass,this.floor??null,n,"illuminance");l!==null&&t.push(`\u2600 ${W(this.hass,l,0)} lx`);let c=this.floor&&this.building?Ki(this.hass,this.building,this.floor,n):null;c!==null&&t.push(`\u26A1 ${ht(this.hass,c)}`);let u=this.floor?this.floor.openings.filter($=>$.room_id===n.id).flatMap($=>[$.contact,$.contact2,$.tilt,$.tilt2]).map($=>$&&$!=="none"?this.hass.states[$]:void 0).filter($=>$?.state==="on").map($=>Date.parse(String($.last_changed??""))).filter(Number.isFinite):[];u.length&&t.push(`\u{1FA9F} ${this.t("open_since",{time:Ui(Date.now()-Math.min(...u))})}`);let h=K(this.hass,n).map($=>this.hass.states[$]).filter($=>!!$&&$.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String($.attributes.device_class)));if(h.length)if(h.some($=>$.state==="on"))t.push(`\u{1F6B6} ${this.t("presence_now")}`);else{let $=Math.max(...h.map(C=>Date.parse(String(C.last_changed??""))||0));$>0&&t.push(`\u{1F6B6} ${this.t("presence_last",{time:Ui(Date.now()-$)})}`)}let m=this.building?fl(this.hass,this.building).filter($=>$.roomId===n.id&&$.level<pl):[];m.length&&t.push(`\u{1FAAB} ${this.t("battery_low_n",{n:m.length,names:m.map($=>`${this.name($.entity)} ${Math.round($.level)} %`).join(", ")})}`);let d=(this.building?.settings.circuits??[]).filter($=>$.rooms.includes(n.id)).map($=>$.name),g=this.building?.settings.room_facts_off??[];d.length&&!g.includes("circuits")&&t.push(`\u{1F50C} ${d.join(", ")}`);let{latitude:_,longitude:b,time_zone:v}=this.hass.config??{};if(this.floor&&_!==void 0&&b!==void 0&&this.building&&!g.includes("sun")){let $=Tt(this.building,this.floor,n,{latitude:_,longitude:b,zone:v});$.facing.length&&t.push(`\u2600 ${this.t("room_sun_hours",{h:W(this.hass,$.hours,1),facing:$.facing.join(", ")})}`)}let k=U(this.hass,this.floor,n,"temperature"),S=U(this.hass,this.floor,n,"humidity"),E=vr(U(this.hass,this.floor,n,"co2"),S,Dt(k,S));E&&!g.includes("air")&&t.push(`\u{1F4A8} ${this.t(`air_${E}`)}`);let T=wr(k,S,U(this.hass,this.floor,n,"co2"),dt(new Date,this.hass.config?.latitude)),z=n.hvac?.status;return z&&z!=="none"?t.push(Ye(this.hass.states[z])):T!==null&&(k!==null||S!==null)&&!g.includes("comfort")&&t.push(`\u{1F60A} ${this.t("comfort_n",{n:T})}`),t}announceSection(e){let t=this.phrases?.length?this.phrases:[1,2,3,4,5].map(o=>this.t(`announce_phrase_${o}`)),n=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");n(s.value),s.value=""};return this.section("panel_announce",[p`<div class="nf-rp-scenes">${t.map(o=>p`<button class="nf-btn" @click=${()=>n(o)}>${o}</button>`)}</div> </section>`}extraValues(e){if(!this.floor)return f;let t=[...this.floor.placements.filter(n=>!n.outside&&P([n.x,n.z],e.points)).map(n=>({name:n.name||O(this.hass,n.entity_id),rows:fr(this.hass,n.values)})),...this.floor.furniture.filter(n=>P([n.x,n.z],e.points)).map(n=>({name:n.name||(n.entity&&n.entity!=="none"?O(this.hass,n.entity):this.t("device")),rows:fr(this.hass,n.values)}))].filter(n=>n.rows.length);return t.length?this.section("device_values",t.map(n=>p`<div class="nf-extra-values"><b>${n.name}</b>${n.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}</b></div>`)}</div>`)):f}facts(e){let t=[],n=this.room;if(!n)return t;let i=($,C)=>{let E=j(this.hass,this.floor,n,$);if(E===null)return null;if($==="temperature")return`${W(this.hass,se(this.hass,E),1)} ${ne(this.hass)}`;let R=je(this.hass,this.floor,n,$)[0],H=this.hass.states[R]?.attributes.unit_of_measurement??C;return`${W(this.hass,E,1)} ${H}`},o=e.find($=>typeof $.attributes.current_temperature=="number"),s=i("temperature","\xB0C");s?t.push(s):o&&n.climate?.temperature!=="none"&&t.push(`${W(this.hass,o.attributes.current_temperature,1)} ${ne(this.hass)}`);let a=i("humidity","%");a&&t.push(a);let l=j(this.hass,this.floor??null,n,"illuminance");l!==null&&t.push(`\u2600 ${W(this.hass,l,0)} lx`);let c=this.floor&&this.building?Xi(this.hass,this.building,this.floor,n):null;c!==null&&t.push(`\u26A1 ${mt(this.hass,c)}`);let u=this.floor?this.floor.openings.filter($=>$.room_id===n.id).flatMap($=>[$.contact,$.contact2,$.tilt,$.tilt2]).map($=>$&&$!=="none"?this.hass.states[$]:void 0).filter($=>$?.state==="on").map($=>Date.parse(String($.last_changed??""))).filter(Number.isFinite):[];u.length&&t.push(`\u{1FA9F} ${this.t("open_since",{time:to(Date.now()-Math.min(...u))})}`);let d=K(this.hass,n).map($=>this.hass.states[$]).filter($=>!!$&&$.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String($.attributes.device_class)));if(d.length)if(d.some($=>$.state==="on"))t.push(`\u{1F6B6} ${this.t("presence_now")}`);else{let $=Math.max(...d.map(C=>Date.parse(String(C.last_changed??""))||0));$>0&&t.push(`\u{1F6B6} ${this.t("presence_last",{time:to(Date.now()-$)})}`)}let m=this.building?Hl(this.hass,this.building).filter($=>$.roomId===n.id&&$.level<Fl):[];m.length&&t.push(`\u{1FAAB} ${this.t("battery_low_n",{n:m.length,names:m.map($=>`${this.name($.entity)} ${Math.round($.level)} %`).join(", ")})}`);let h=(this.building?.settings.circuits??[]).filter($=>$.rooms.includes(n.id)).map($=>$.name),g=this.building?.settings.room_facts_off??[];h.length&&!g.includes("circuits")&&t.push(`\u{1F50C} ${h.join(", ")}`);let{latitude:_,longitude:b,time_zone:v}=this.hass.config??{};if(this.floor&&_!==void 0&&b!==void 0&&this.building&&!g.includes("sun")){let $=Dt(this.building,this.floor,n,{latitude:_,longitude:b,zone:v});$.facing.length&&t.push(`\u2600 ${this.t("room_sun_hours",{h:W(this.hass,$.hours,1),facing:$.facing.join(", ")})}`)}let k=j(this.hass,this.floor,n,"temperature"),S=j(this.hass,this.floor,n,"humidity"),M=xr(j(this.hass,this.floor,n,"co2"),S,Ft(k,S));M&&!g.includes("air")&&t.push(`\u{1F4A8} ${this.t(`air_${M}`)}`);let T=kr(k,S,j(this.hass,this.floor,n,"co2"),ht(new Date,this.hass.config?.latitude)),z=n.hvac?.status;return z&&z!=="none"?t.push(Je(this.hass.states[z])):T!==null&&(k!==null||S!==null)&&!g.includes("comfort")&&t.push(`\u{1F60A} ${this.t("comfort_n",{n:T})}`),t}announceSection(e){let t=this.phrases?.length?this.phrases:[1,2,3,4,5].map(o=>this.t(`announce_phrase_${o}`)),n=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");n(s.value),s.value=""};return this.section("panel_announce",[p`<div class="nf-rp-scenes">${t.map(o=>p`<button class="nf-btn" @click=${()=>n(o)}>${o}</button>`)}</div>
<form class="nf-rp-say" @submit=${i}> <form class="nf-rp-say" @submit=${i}>
<input type="text" maxlength="500" placeholder=${this.t("announce_placeholder")} aria-label=${this.t("announce_placeholder")} /> <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> <button class="nf-btn nf-primary" type="submit">${this.t("announce_send")}</button>
</form> </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 fs({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 Ss({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> <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} ${typeof i.content=="string"?p`<p class="nf-rp-note">${i.content}</p>`:i.content}
</div>`)}section(e,t,n=f){return p`<div class="nf-rp-sec"> </div>`)}section(e,t,n=f){return p`<div class="nf-rp-sec">
<div class="nf-rp-sec-head"><h3>${this.t(e)}</h3>${n}</div> <div class="nf-rp-sec-head"><h3>${this.t(e)}</h3>${n}</div>
${t} ${t}
</div>`}lightRow(e){let t=e.attributes,n=e.state==="on",i=t.supported_color_modes??[],o=i.some(d=>d!=="onoff"),s=i.includes("color_temp"),a=i.some(d=>["hs","rgb","rgbw","rgbww","xy"].includes(d)),l=typeof t.brightness=="number"?Math.round(t.brightness/255*100):100,c=t.min_color_temp_kelvin??2200,u=t.max_color_temp_kelvin??6500,h=e.entity_id,m=!!this.placedAs(h)?.simple;return p`<div class="nf-rp-row"> </div>`}lightRow(e){let t=e.attributes,n=e.state==="on",i=t.supported_color_modes??[],o=i.some(h=>h!=="onoff"),s=i.includes("color_temp"),a=i.some(h=>["hs","rgb","rgbw","rgbww","xy"].includes(h)),l=typeof t.brightness=="number"?Math.round(t.brightness/255*100):100,c=t.min_color_temp_kelvin??2200,u=t.max_color_temp_kelvin??6500,d=e.entity_id,m=!!this.placedAs(d)?.simple;return p`<div class="nf-rp-row">
<span class="nf-rp-icon ${n?"nf-rp-on":""}">${Ht("light")}</span> <span class="nf-rp-icon ${n?"nf-rp-on":""}">${Pt("light")}</span>
${this.nameButton(h)} ${this.nameButton(d)}
<span class="nf-rp-state">${this.stateOf(e)}</span> <span class="nf-rp-state">${this.stateOf(e)}</span>
${this.toggle(e,n,()=>this.call("light","toggle",{entity_id:h}))} ${this.toggle(e,n,()=>this.call("light","toggle",{entity_id:d}))}
${o&&!m?p`<label class="nf-rp-slider" ${o&&!m?p`<label class="nf-rp-slider"
><span>${this.t("brightness")}</span> ><span>${this.t("brightness")}</span>
<input <input
@@ -352,7 +369,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
min="1" min="1"
max="100" max="100"
.value=${String(l)} .value=${String(l)}
@change=${d=>this.call("light","turn_on",{entity_id:h,brightness_pct:Number(d.target.value)})} @change=${h=>this.call("light","turn_on",{entity_id:d,brightness_pct:Number(h.target.value)})}
/></label>`:f} /></label>`:f}
${n&&s&&!m?p`<label class="nf-rp-slider nf-rp-ct" ${n&&s&&!m?p`<label class="nf-rp-slider nf-rp-ct"
><span>${this.t("color_temp")}</span> ><span>${this.t("color_temp")}</span>
@@ -362,26 +379,26 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
max=${u} max=${u}
step="50" step="50"
.value=${String(t.color_temp_kelvin??c)} .value=${String(t.color_temp_kelvin??c)}
@change=${d=>this.call("light","turn_on",{entity_id:h,color_temp_kelvin:Number(d.target.value)})} @change=${h=>this.call("light","turn_on",{entity_id:d,color_temp_kelvin:Number(h.target.value)})}
/></label>`:f} /></label>`:f}
${n&&a&&!m?p`<div class="nf-rp-swatches" role="group" aria-label=${this.t("color")}> ${n&&a&&!m?p`<div class="nf-rp-swatches" role="group" aria-label=${this.t("color")}>
${im.map(d=>p`<button ${Am.map(h=>p`<button
class="nf-rp-swatch" class="nf-rp-swatch"
style="--c: rgb(${d.join(",")})" style="--c: rgb(${h.join(",")})"
aria-label="rgb(${d.join(", ")})" aria-label="rgb(${h.join(", ")})"
@click=${()=>this.call("light","turn_on",{entity_id:h,rgb_color:d})} @click=${()=>this.call("light","turn_on",{entity_id:d,rgb_color:h})}
></button>`)} ></button>`)}
</div>`:f} </div>`:f}
</div>`}coverRow(e){let t=ar(this.hass,this.building?.floors??[],e.entity_id);e=lr(this.hass,e,t);let n=e.attributes,i=n.supported_features??0,o=e.entity_id,s=I(e)&&!Xt(e);return p`<div class="nf-rp-row"> </div>`}coverRow(e){let t=ur(this.hass,this.building?.floors??[],e.entity_id);e=dr(this.hass,e,t);let n=e.attributes,i=n.supported_features??0,o=e.entity_id,s=I(e)&&!tn(e);return p`<div class="nf-rp-row">
<span class="nf-rp-icon">${Ht("cover")}</span> <span class="nf-rp-icon">${Pt("cover")}</span>
${this.nameButton(o)} ${this.nameButton(o)}
<span class="nf-rp-state">${this.stateOf(e)}</span> <span class="nf-rp-state">${this.stateOf(e)}</span>
<div class="nf-rp-buttons"> <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> <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&rm?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&Mm?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> <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> </div>
${i&nm&&typeof n.current_position=="number"?p`<label class="nf-rp-slider" ${i&$m&&typeof n.current_position=="number"?p`<label class="nf-rp-slider"
><span>${this.t("position")}</span> ><span>${this.t("position")}</span>
<input <input
type="range" type="range"
@@ -405,12 +422,12 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${i&32?p`<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.call("cover","close_cover_tilt",{entity_id:o})}>${this.t("cover_tilt_close")}</button>`:f} ${i&32?p`<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.call("cover","close_cover_tilt",{entity_id:o})}>${this.t("cover_tilt_close")}</button>`:f}
</div>`:f} </div>`:f}
</div>`}climateRow(e){let t=e.attributes,n=e.entity_id,i=typeof t.temperature=="number"?t.temperature:null,o=t.target_temp_step??.5,s=t.min_temp??5,a=t.max_temp??30,l=t.hvac_modes??[],c=u=>this.call("climate","set_temperature",{entity_id:n,temperature:Math.min(a,Math.max(s,Math.round(u/o)*o))});return p`<div class="nf-rp-row"> </div>`}climateRow(e){let t=e.attributes,n=e.entity_id,i=typeof t.temperature=="number"?t.temperature:null,o=t.target_temp_step??.5,s=t.min_temp??5,a=t.max_temp??30,l=t.hvac_modes??[],c=u=>this.call("climate","set_temperature",{entity_id:n,temperature:Math.min(a,Math.max(s,Math.round(u/o)*o))});return p`<div class="nf-rp-row">
<span class="nf-rp-icon ${t.hvac_action==="heating"?"nf-rp-on":""}">${Ht("climate")}</span> <span class="nf-rp-icon ${t.hvac_action==="heating"?"nf-rp-on":""}">${Pt("climate")}</span>
${this.nameButton(n)} ${this.nameButton(n)}
<span class="nf-rp-state">${this.stateOf(e)}</span> <span class="nf-rp-state">${this.stateOf(e)}</span>
${i!==null?p`<div class="nf-rp-stepper nf-rp-wide"> ${i!==null?p`<div class="nf-rp-stepper nf-rp-wide">
<button class="nf-btn" aria-label=${this.t("temp_down")} @click=${()=>c(i-o)}>−</button> <button class="nf-btn" aria-label=${this.t("temp_down")} @click=${()=>c(i-o)}>−</button>
<span><small>${this.t("target_temp")}</small> ${W(this.hass,i,1)} ${te(this.hass)}</span> <span><small>${this.t("target_temp")}</small> ${W(this.hass,i,1)} ${ne(this.hass)}</span>
<button class="nf-btn" aria-label=${this.t("temp_up")} @click=${()=>c(i+o)}>+</button> <button class="nf-btn" aria-label=${this.t("temp_up")} @click=${()=>c(i+o)}>+</button>
</div>`:f} </div>`:f}
${l.length>1?p`<div class="nf-rp-chips"> ${l.length>1?p`<div class="nf-rp-chips">
@@ -423,19 +440,19 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
</button>`)} </button>`)}
</div>`:f} </div>`:f}
</div>`}stateOf(e,t=ie(this.hass,e)){if(this.room?.no_state?.includes(e.entity_id))return"";let n=F(e.entity_id);return e.state==="unknown"&&n!=="sensor"&&n!=="binary"?"":t}stateLabel(e){let t=`state_${e}`,n=this.t(t);return n===t?e:n}mediaRow(e){let t=e.attributes,n=e.entity_id,i=I(e)||e.state==="off",o=[t.media_title,t.media_artist].filter(s=>typeof s=="string"&&s).join(" \xB7 ");return p`<div class="nf-rp-row"> </div>`}stateOf(e,t=ie(this.hass,e)){if(this.room?.no_state?.includes(e.entity_id))return"";let n=F(e.entity_id);return e.state==="unknown"&&n!=="sensor"&&n!=="binary"?"":t}stateLabel(e){let t=`state_${e}`,n=this.t(t);return n===t?e:n}mediaRow(e){let t=e.attributes,n=e.entity_id,i=I(e)||e.state==="off",o=[t.media_title,t.media_artist].filter(s=>typeof s=="string"&&s).join(" \xB7 ");return p`<div class="nf-rp-row">
<span class="nf-rp-icon ${e.state==="playing"?"nf-rp-on":""}">${Ht("media")}</span> <span class="nf-rp-icon ${e.state==="playing"?"nf-rp-on":""}">${Pt("media")}</span>
${this.nameButton(n)} ${this.nameButton(n)}
<span class="nf-rp-state">${this.stateOf(e,this.stateLabel(e.state))}</span> <span class="nf-rp-state">${this.stateOf(e,this.stateLabel(e.state))}</span>
${o?p`<p class="nf-rp-media nf-rp-wide">${o}</p>`:f} ${o?p`<p class="nf-rp-media nf-rp-wide">${o}</p>`:f}
<div class="nf-rp-buttons nf-rp-wide"> <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:n})}> <button class="nf-btn nf-rp-small" aria-label=${this.t("previous")} ?disabled=${i} @click=${()=>this.call("media_player","media_previous_track",{entity_id:n})}>
${ji(Sr.previous)} ${no(Ar.previous)}
</button> </button>
<button class="nf-btn nf-rp-small" aria-label=${this.t("play_pause")} ?disabled=${I(e)} @click=${()=>this.call("media_player","media_play_pause",{entity_id:n})}> <button class="nf-btn nf-rp-small" aria-label=${this.t("play_pause")} ?disabled=${I(e)} @click=${()=>this.call("media_player","media_play_pause",{entity_id:n})}>
${ji(e.state==="playing"?Sr.pause:Sr.play)} ${no(e.state==="playing"?Ar.pause:Ar.play)}
</button> </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:n})}> <button class="nf-btn nf-rp-small" aria-label=${this.t("next")} ?disabled=${i} @click=${()=>this.call("media_player","media_next_track",{entity_id:n})}>
${ji(Sr.next)} ${no(Ar.next)}
</button> </button>
</div> </div>
${typeof t.volume_level=="number"?p`<label class="nf-rp-slider" ${typeof t.volume_level=="number"?p`<label class="nf-rp-slider"
@@ -447,16 +464,16 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.value=${String(Math.round(t.volume_level*100))} .value=${String(Math.round(t.volume_level*100))}
@change=${s=>this.call("media_player","volume_set",{entity_id:n,volume_level:Number(s.target.value)/100})} @change=${s=>this.call("media_player","volume_set",{entity_id:n,volume_level:Number(s.target.value)/100})}
/></label>`:f} /></label>`:f}
</div>`}switchRow(e){let t=e.entity_id,n=F(t),i=t.slice(0,t.indexOf(".")),o=n==="lock"?e.state==="unlocked"||e.state==="open":Q(e),s=()=>n==="lock"?this.call("lock",o?"lock":"unlock",{entity_id:t}):this.call(i,"toggle",{entity_id:t});return p`<div class="nf-rp-row"> </div>`}switchRow(e){let t=e.entity_id,n=F(t),i=t.slice(0,t.indexOf(".")),o=n==="lock"?e.state==="unlocked"||e.state==="open":ee(e),s=()=>n==="lock"?this.call("lock",o?"lock":"unlock",{entity_id:t}):this.call(i,"toggle",{entity_id:t});return p`<div class="nf-rp-row">
<span class="nf-rp-icon ${o?"nf-rp-on":""}">${Ht(n)}</span> <span class="nf-rp-icon ${o?"nf-rp-on":""}">${Pt(n)}</span>
${this.nameButton(t)} ${this.nameButton(t)}
<span class="nf-rp-state">${this.stateOf(e)}</span> <span class="nf-rp-state">${this.stateOf(e)}</span>
${this.toggle(e,o,s)} ${this.toggle(e,o,s)}
</div>`}sensorRow(e){let t=F(e.entity_id),n=t==="binary"&&e.state==="on";return p`<div class="nf-rp-row"> </div>`}sensorRow(e){let t=F(e.entity_id),n=t==="binary"&&e.state==="on";return p`<div class="nf-rp-row">
<span class="nf-rp-icon ${n?"nf-rp-on":""}">${Ht(t)}</span> <span class="nf-rp-icon ${n?"nf-rp-on":""}">${Pt(t)}</span>
${this.nameButton(e.entity_id)} ${this.nameButton(e.entity_id)}
<span class="nf-rp-state">${this.stateOf(e)}</span> <span class="nf-rp-state">${this.stateOf(e)}</span>
</div>`}fire(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))}static styles=[pe,Ae,X` </div>`}fire(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))}static styles=[pe,Ae,Q`
:host { :host {
display: block; display: block;
} }
@@ -837,32 +854,32 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
outline: 2px solid var(--nf-accent); outline: 2px solid var(--nf-accent);
outline-offset: 2px; outline-offset: 2px;
} }
`]};customElements.get("nf-room-panel")||customElements.define("nf-room-panel",qi);function Ml(r){if(!r)return"";let e=Math.min(.8,Math.max(0,r.dim??.35)),t=r.image&&/^(https:\/\/|\/local\/|\/api\/)[^"'()\\\s]+$/.test(r.image)?r.image:null,n=r.color&&/^#[0-9a-f]{6}$/i.test(r.color)?r.color:null;return t?`;background:linear-gradient(rgba(0,0,0,${e}),rgba(0,0,0,${e})),center / cover no-repeat url("${t}")${n?` ${n}`:""}`:n?`;background:${n}`:""}var am=[[/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]]],Al=[34,211,238];function Zi(r){return r?am.find(([e])=>e.test(r))?.[1]??Al:Al}function Yi(r){if(r.state==="playing"||r.state==="paused")return!0;let e=t=>typeof r.attributes[t]=="string"&&r.attributes[t]!=="";return r.state==="on"&&(e("media_title")||e("media_channel")||e("source")||e("app_name"))}var Ji=r=>r.state==="playing"||r.state==="on"&&Yi(r);function El(r,e){let t=[],n=new Set;for(let i of e){if(!i.entity.startsWith("media_player.")||n.has(i.entity))continue;n.add(i.entity);let o=r.states[i.entity];if(!o)continue;let s=o.attributes,a=u=>typeof s[u]=="string"?s[u]:"",l=a("app_name")||a("source")||a("app_id")||null,c=typeof s.volume_level=="number"?s.volume_level:null;t.push({entity:i.entity,name:i.name,at:i.at,playing:Ji(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:c,color:Zi(l),app:l,group:Array.isArray(s.group_members)?s.group_members.filter(u=>typeof u=="string"&&u!==i.entity):[],rings:i.rings??1})}return t}function Rl(r){let e=new Map(r.filter(i=>i.playing).map(i=>[i.entity,i])),t=[],n=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&&!n.has(a)&&(n.add(a),t.push([i,s]))}return t}var lm=3;function zl(r,e,t){let n=[];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||!Q(r.states[s])||n.push({id:o.id,at:{floorId:i.id,x:o.x,y:de(i,o)+o.h,z:o.z},reach:Math.min(15,Math.max(.5,o.spray??lm))})}return n}var $r=r=>r&&r!=="none"?r:null,Tl=r=>Math.min(1,Math.max(0,r));function Dl(r,e){let t=new Map;for(let n of e.settings.roof?.windows??[]){let i=Fe(r,{cover:$r(n.cover),contact:$r(n.contact),tilt:$r(n.tilt)},"window"),o=$r(n.window),s=o?r.states[o]:void 0,a=i.open;if(s&&!I(s)){let l=s.attributes.current_position;a=typeof l=="number"?Tl(l/100):s.state==="open"||s.state==="opening"?1:0}t.set(n.id,{open:a,tilt:i.tilt,cover:i.cover??0})}return t}function cm(r,e){let t=i=>Math.hypot(i.x-e.x,i.z-e.z);return r.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 Je=(r,e)=>typeof r[e]=="string"?r[e]:"";function Fl(r,e,t){let n=[];for(let i of e.floors)for(let o of i.furniture){if(!ir(o.type))continue;let s=t?.get(o.id)?.entity??null,a=s?.startsWith("media_player.")?s:cm(i,o),l=a?r.states[a]:void 0;if(!l||!Yi(l))continue;let c=l.attributes,u=Je(c,"app_name")||Je(c,"source")||null;n.push({id:o.id,furnitureId:o.id,floorId:i.id,color:Zi(u),title:Je(c,"media_title")||Je(c,"media_channel")||u||"",subtitle:Je(c,"media_artist")||Je(c,"media_series_title")||Je(c,"media_album_name"),app:u,picture:Je(c,"entity_picture")||null,playing:Ji(l),ambilight:o.ambilight??1})}return n}function Hl(r){let e=r.states["sun.sun"]?.attributes;return typeof e?.elevation=="number"&&typeof e.azimuth=="number"?{elevation:e.elevation,azimuth:e.azimuth}:null}function Pl(r,e){return(r===null?0:Tl((r+4)/16))*(1-.45*e)}function Qe(r,e){return r.states["weather.nextfloor_symcon"]?"weather.nextfloor_symcon":e&&r.states[e]?e:Object.keys(r.states).filter(t=>t.startsWith("weather.")).sort()[0]??null}var Mr=new Set(["contact_lost","unlocked_night","own"]);function um(r,e){let t=r.states[e.entity];if(!t||["unavailable","unknown"].includes(t.state))return!1;let n=(e.state??"on").trim(),i=/^([<>])\s*(-?\d+(?:[.,]\d+)?)$/.exec(n);if(i){let o=Number(t.state),s=Number(i[2].replace(",","."));return Number.isFinite(o)&&(i[1]==="<"?o<s:o>s)}return n.split(",").map(o=>o.trim().toLowerCase()).filter(Boolean).includes(String(t.state).toLowerCase())}var dm=600*1e3,hm=new Set(["rainy","pouring","lightning-rainy","hail","snowy-rainy"]),mm=new Map([["smoke","smoke"],["gas","gas"],["carbon_monoxide","co"],["moisture","water"]]),Il=(r,e)=>{if(e.startsWith("binary_sensor."))return mm.get(String(r.states[e]?.attributes.device_class))};function pm(r,e){let t=new Set,n=[];for(let i of r.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),n.push({floorId:i.id,roomId:o.room_id,entity:a}))}return n}function Cl(r,e,t,n){let i=[];for(let a of Line truncated `]};customElements.get("nf-room-panel")||customElements.define("nf-room-panel",ro);function Gl(r){if(!r)return"";let e=Math.min(.8,Math.max(0,r.dim??.35)),t=r.image&&/^(https:\/\/|\/local\/|\/api\/)[^"'()\\\s]+$/.test(r.image)?r.image:null,n=r.color&&/^#[0-9a-f]{6}$/i.test(r.color)?r.color:null;return t?`;background:linear-gradient(rgba(0,0,0,${e}),rgba(0,0,0,${e})),center / cover no-repeat url("${t}")${n?` ${n}`:""}`:n?`;background:${n}`:""}var zm=[[/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]]],Ul=[34,211,238];function io(r){return r?zm.find(([e])=>e.test(r))?.[1]??Ul:Ul}function oo(r){if(r.state==="playing"||r.state==="paused")return!0;let e=t=>typeof r.attributes[t]=="string"&&r.attributes[t]!=="";return r.state==="on"&&(e("media_title")||e("media_channel")||e("source")||e("app_name"))}var so=r=>r.state==="playing"||r.state==="on"&&oo(r);function jl(r,e){let t=[],n=new Set;for(let i of e){if(!i.entity.startsWith("media_player.")||n.has(i.entity))continue;n.add(i.entity);let o=r.states[i.entity];if(!o)continue;let s=o.attributes,a=u=>typeof s[u]=="string"?s[u]:"",l=a("app_name")||a("source")||a("app_id")||null,c=typeof s.volume_level=="number"?s.volume_level:null;t.push({entity:i.entity,name:i.name,at:i.at,playing:so(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:c,color:io(l),app:l,group:Array.isArray(s.group_members)?s.group_members.filter(u=>typeof u=="string"&&u!==i.entity):[],rings:i.rings??1})}return t}function ql(r){let e=new Map(r.filter(i=>i.playing).map(i=>[i.entity,i])),t=[],n=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&&!n.has(a)&&(n.add(a),t.push([i,s]))}return t}var Tm=3;function Zl(r,e,t){let n=[];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||!ee(r.states[s])||n.push({id:o.id,at:{floorId:i.id,x:o.x,y:de(i,o)+o.h,z:o.z},reach:Math.min(15,Math.max(.5,o.spray??Tm))})}return n}var Er=r=>r&&r!=="none"?r:null,Yl=r=>Math.min(1,Math.max(0,r));function Jl(r,e){let t=new Map;for(let n of e.settings.roof?.windows??[]){let i=Fe(r,{cover:Er(n.cover),contact:Er(n.contact),tilt:Er(n.tilt)},"window"),o=Er(n.window),s=o?r.states[o]:void 0,a=i.open;if(s&&!I(s)){let l=s.attributes.current_position;a=typeof l=="number"?Yl(l/100):s.state==="open"||s.state==="opening"?1:0}t.set(n.id,{open:a,tilt:i.tilt,cover:i.cover??0})}return t}function Dm(r,e){let t=i=>Math.hypot(i.x-e.x,i.z-e.z);return r.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 Qe=(r,e)=>typeof r[e]=="string"?r[e]:"";function Ql(r,e,t){let n=[];for(let i of e.floors)for(let o of i.furniture){if(!ar(o.type))continue;let s=t?.get(o.id)?.entity??null,a=s?.startsWith("media_player.")?s:Dm(i,o),l=a?r.states[a]:void 0;if(!l||!oo(l))continue;let c=l.attributes,u=Qe(c,"app_name")||Qe(c,"source")||null;n.push({id:o.id,furnitureId:o.id,floorId:i.id,color:io(u),title:Qe(c,"media_title")||Qe(c,"media_channel")||u||"",subtitle:Qe(c,"media_artist")||Qe(c,"media_series_title")||Qe(c,"media_album_name"),app:u,picture:Qe(c,"entity_picture")||null,playing:so(l),ambilight:o.ambilight??1})}return n}function Xl(r){let e=r.states["sun.sun"]?.attributes;return typeof e?.elevation=="number"&&typeof e.azimuth=="number"?{elevation:e.elevation,azimuth:e.azimuth}:null}function ec(r,e){return(r===null?0:Yl((r+4)/16))*(1-.45*e)}function Xe(r,e){return r.states["weather.nextfloor_symcon"]?"weather.nextfloor_symcon":e&&r.states[e]?e:Object.keys(r.states).filter(t=>t.startsWith("weather.")).sort()[0]??null}var Rr=new Set(["contact_lost","unlocked_night","own"]);function Fm(r,e){let t=r.states[e.entity];if(!t||["unavailable","unknown"].includes(t.state))return!1;let n=(e.state??"on").trim(),i=/^([<>])\s*(-?\d+(?:[.,]\d+)?)$/.exec(n);if(i){let o=Number(t.state),s=Number(i[2].replace(",","."));return Number.isFinite(o)&&(i[1]==="<"?o<s:o>s)}return n.split(",").map(o=>o.trim().toLowerCase()).filter(Boolean).includes(String(t.state).toLowerCase())}var Hm=600*1e3,Pm=new Set(["rainy","pouring","lightning-rainy","hail","snowy-rainy"]),Im=new Map([["smoke","smoke"],["gas","gas"],["carbon_monoxide","co"],["moisture","water"]]),tc=(r,e)=>{if(e.startsWith("binary_sensor."))return Im.get(String(r.states[e]?.attributes.device_class))};function Cm(r,e){let t=new Set,n=[];for(let i of r.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),n.push({floorId:i.id,roomId:o.room_id,entity:a}))}return n}function nc(r,e,t,n){let i=[];for(let a o Line truncated
${ee`<circle cx="27" cy="27" r=${22} class="live-ring-bg"></circle> ${te`<circle cx="27" cy="27" r=${22} class="live-ring-bg"></circle>
<circle cx="27" cy="27" r=${22} stroke=${e} stroke-dasharray=${`${(n*Math.max(0,Math.min(1,r))).toFixed(1)} ${n.toFixed(1)}`} transform="rotate(-90 27 27)" class="live-ring-fg"></circle>`} <circle cx="27" cy="27" r=${22} stroke=${e} stroke-dasharray=${`${(n*Math.max(0,Math.min(1,r))).toFixed(1)} ${n.toFixed(1)}`} transform="rotate(-90 27 27)" class="live-ring-fg"></circle>`}
</svg>`}function Sp(r,e,t,n){let i=e.summary,o=c=>M(r,c),s=e.autarky,a=n?p`<button class="live-fold" title=${o(n.folded?"live_unfold":"live_fold")} aria-label=${o(n.folded?"live_unfold":"live_fold")} aria-expanded=${!n.folded} @click=${n.toggle}>${n.folded?"+":"\u2212"}</button>`:f;if(n?.folded){let c=i.solar!==null?`\u2600 ${Re(r,i.solar)}`:i.consumption!==null?`\u2302 ${Re(r,i.consumption)}`:null;return p`<div class="live-card live-card-house live-folded" data-i=${t}> </svg>`}function jp(r,e,t,n){let i=e.summary,o=c=>A(r,c),s=e.autarky,a=n?p`<button class="live-fold" title=${o(n.folded?"live_unfold":"live_fold")} aria-label=${o(n.folded?"live_unfold":"live_fold")} aria-expanded=${!n.folded} @click=${n.toggle}>${n.folded?"+":"\u2212"}</button>`:f;if(n?.folded){let c=i.solar!==null?`\u2600 ${Re(r,i.solar)}`:i.consumption!==null?`\u2302 ${Re(r,i.consumption)}`:null;return p`<div class="live-card live-card-house live-folded" data-i=${t}>
${s!==null?p`<div class="live-own">${$n(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)}%</b></div></div>`:f} ${s!==null?p`<div class="live-own">${En(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)}%</b></div></div>`:f}
${c?p`<b>${c}</b>`:s===null?p`<b>⌂</b>`:f} ${c?p`<b>${c}</b>`:s===null?p`<b>⌂</b>`:f}
${a} ${a}
</div>`}let l=[];if(i.solar!==null&&l.push(p`<div class="live-row live-solar"><span>☀ ${o("energy_solar")}</span><b>${Re(r,i.solar)}</b></div>`),i.consumption!==null&&l.push(p`<div class="live-row live-house"><span>⌂ ${o("energy_consumption")}</span><b>${Re(r,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>${Re(r,i.rest)}</b></div>`),i.battery!==null||i.soc!==null){let c=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")}${c}</span><b>${i.soc!==null?`${Math.round(i.soc)} %`:""}${i.battery!==null&&Math.abs(i.battery)>=15?` \xB7 ${Re(r,i.battery)}`:""}</b></div>`)}if(i.grid!==null){let c=i.grid<-15;l.push(p`<div class="live-row ${c?"live-export":"live-import"}"><span>⇄ ${o(c?"energy_grid_export":"energy_grid_import")}</span><b>${Re(r,i.grid)}</b></div>`)}for(let c of e.meters??[])l.push(p`<div class="live-row live-meter"><span>${c.icon} ${c.label}</span><b>${c.value}</b></div>`);return p`<div class="live-card live-card-house" data-i=${t}> </div>`}let l=[];if(i.solar!==null&&l.push(p`<div class="live-row live-solar"><span>☀ ${o("energy_solar")}</span><b>${Re(r,i.solar)}</b></div>`),i.consumption!==null&&l.push(p`<div class="live-row live-house"><span>⌂ ${o("energy_consumption")}</span><b>${Re(r,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>${Re(r,i.rest)}</b></div>`),i.battery!==null||i.soc!==null){let c=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")}${c}</span><b>${i.soc!==null?`${Math.round(i.soc)} %`:""}${i.battery!==null&&Math.abs(i.battery)>=15?` \xB7 ${Re(r,i.battery)}`:""}</b></div>`)}if(i.grid!==null){let c=i.grid<-15;l.push(p`<div class="live-row ${c?"live-export":"live-import"}"><span>⇄ ${o(c?"energy_grid_export":"energy_grid_import")}</span><b>${Re(r,i.grid)}</b></div>`)}for(let c of e.meters??[])l.push(p`<div class="live-row live-meter"><span>${c.icon} ${c.label}</span><b>${c.value}</b></div>`);return p`<div class="live-card live-card-house" data-i=${t}>
${a} ${a}
${s!==null?p`<div class="live-own">${$n(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">${En(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> <div class="live-rows">${l}</div>
${Mp(r,e.curves)} ${$p(r,e.week)} ${Zp(r,e.curves)} ${qp(r,e.week)}
</div>`}function $p(r,e){if(!e)return f;let t=[...e.solar,...e.use].filter(c=>c!==null&&c>0);if(!t.length)return f;let n=Math.max(...t)*1.1||1,[i,o]=[150,30],s=i/7,a=(c,u,h)=>c===null||c<=0?f:ee`<rect x=${u.toFixed(1)} y=${(o-c/n*o).toFixed(1)} width=${(s*.36).toFixed(1)} height=${(c/n*o).toFixed(1)} class=${h}></rect>`,l=c=>c.reduce((u,h)=>u+(h??0),0);return p`<div class="live-day live-week" title=${M(r,"live_week_hint",{solar:W(r,l(e.solar),0),use:W(r,l(e.use),0)})}> </div>`}function qp(r,e){if(!e)return f;let t=[...e.solar,...e.use].filter(c=>c!==null&&c>0);if(!t.length)return f;let n=Math.max(...t)*1.1||1,[i,o]=[150,30],s=i/7,a=(c,u,d)=>c===null||c<=0?f:te`<rect x=${u.toFixed(1)} y=${(o-c/n*o).toFixed(1)} width=${(s*.36).toFixed(1)} height=${(c/n*o).toFixed(1)} class=${d}></rect>`,l=c=>c.reduce((u,d)=>u+(d??0),0);return p`<div class="live-day live-week" title=${A(r,"live_week_hint",{solar:W(r,l(e.solar),0),use:W(r,l(e.use),0)})}>
<svg viewBox=${`0 0 ${i} ${o}`} preserveAspectRatio="none" aria-hidden="true"> <svg viewBox=${`0 0 ${i} ${o}`} preserveAspectRatio="none" aria-hidden="true">
${e.days.map((c,u)=>ee`${a(e.solar[u],u*s+s*.1,"live-week-solar")}${a(e.use[u],u*s+s*.5,"live-week-use")}`)} ${e.days.map((c,u)=>te`${a(e.solar[u],u*s+s*.1,"live-week-solar")}${a(e.use[u],u*s+s*.5,"live-week-use")}`)}
</svg> </svg>
<span>7 ${M(r,"live_days")}</span> <span>7 ${A(r,"live_days")}</span>
</div>`}function Mp(r,e){if(!e)return f;let t=[...e.solar,...e.use].filter(l=>l!==null);if(t.length<4)return f;let n=Math.max(...t)*1.08||1,[i,o]=[150,34],s=fn(e.solar,i,o,n),a=fn(e.use,i,o,n);return p`<div class="live-day" title=${M(r,"live_day_hint")}> </div>`}function Zp(r,e){if(!e)return f;let t=[...e.solar,...e.use].filter(l=>l!==null);if(t.length<4)return f;let n=Math.max(...t)*1.08||1,[i,o]=[150,34],s=bn(e.solar,i,o,n),a=bn(e.use,i,o,n);return p`<div class="live-day" title=${A(r,"live_day_hint")}>
<svg viewBox=${`0 0 ${i} ${o}`} preserveAspectRatio="none" aria-hidden="true"> <svg viewBox=${`0 0 ${i} ${o}`} preserveAspectRatio="none" aria-hidden="true">
${s?ee`<path d=${`${s}L${i},${o}L0,${o}Z`} class="live-day-solar"></path>`:f} ${s?te`<path d=${`${s}L${i},${o}L0,${o}Z`} class="live-day-solar"></path>`:f}
${a?ee`<path d=${a} class="live-day-use"></path>`:f} ${a?te`<path d=${a} class="live-day-use"></path>`:f}
</svg> </svg>
<span>24 h</span> <span>24 h</span>
</div>`}function Ap(r,e,t,n){let i=e.car,o=(u,h)=>M(r,u,h),s=Rc(i.soc),a=i.home?i.charging?`\u26A1 ${o("live_car_charging")}${i.chargingW?` \xB7 ${Re(r,i.chargingW)}`:""}`:i.plugged?`\u{1F50C} ${o("live_car_plugged")}`:"":`${o("live_car_away")}${i.where?` \xB7 ${i.where}`:""}${i.distance!==null?` \xB7 ${W(r,i.distance,i.distance<10?1:0)} km`:""}`,l=i.entities,c=(u,h,m,d)=>p`<button class="live-btn ${u?"live-on":""}" title=${h} aria-label=${h} aria-pressed=${u??!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 Yp(r,e,t,n){let i=e.car,o=(u,d)=>A(r,u,d),s=qc(i.soc),a=i.home?i.charging?`\u26A1 ${o("live_car_charging")}${i.chargingW?` \xB7 ${Re(r,i.chargingW)}`:""}`:i.plugged?`\u{1F50C} ${o("live_car_plugged")}`:"":`${o("live_car_away")}${i.where?` \xB7 ${i.where}`:""}${i.distance!==null?` \xB7 ${W(r,i.distance,i.distance<10?1:0)} km`:""}`,l=i.entities,c=(u,d,m,h)=>p`<button class="live-btn ${u?"live-on":""}" title=${d} aria-label=${d} aria-pressed=${u??!1} @click=${g=>(g.stopPropagation(),h())}>${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"> <div class="live-own">
${$n((i.soc??0)/100,s)} ${En((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 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>
<div class="live-rows"> <div class="live-rows">
@@ -877,7 +894,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${l.charge&&i.home?c(i.charging,o("live_car_charge"),"\u26A1",()=>n(l.charge.split(".")[0],"toggle",l.charge)):f} ${l.charge&&i.home?c(i.charging,o("live_car_charge"),"\u26A1",()=>n(l.charge.split(".")[0],"toggle",l.charge)):f}
</div> </div>
</div> </div>
</div>`}function Ep(r,e,t,n){let i=e.media,o=l=>M(r,l),s=`rgb(${i.color.join(",")})`,a=(l,c,u)=>p`<button class="live-btn" title=${l} aria-label=${l} @click=${h=>(h.stopPropagation(),n("media_player",u,i.entity))}>${c}</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 Jp(r,e,t,n){let i=e.media,o=l=>A(r,l),s=`rgb(${i.color.join(",")})`,a=(l,c,u)=>p`<button class="live-btn" title=${l} aria-label=${l} @click=${d=>(d.stopPropagation(),n("media_player",u,i.entity))}>${c}</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>`} ${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-rows">
<div class="live-title" title=${i.title}>${i.title||i.name}</div> <div class="live-title" title=${i.title}>${i.title||i.name}</div>
@@ -896,9 +913,9 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
/>`:f} />`:f}
</div> </div>
</div> </div>
</div>`}function zc(r){let e=[...r.querySelectorAll(".live-card")].filter(o=>o.style.visibility!=="hidden"),t=[],n=e[0]?.parentElement?.clientWidth??0,i=e.map(o=>{let[s,a]=[Number(o.dataset.x),o.offsetWidth],l=n?n>a+16?Math.min(Math.max(s,a/2+8),n-a/2-8):n/2:s;return o.style.setProperty("--live-dx",`${Math.round(s-l)}px`),{el:o,x:l,y:Number(o.dataset.y),w:a,h:o.offsetHeight}}).sort((o,s)=>s.y-o.y);for(let o of i){let s=o.y;for(let l=0;l<12;l++){let c={x0:o.x-o.w/2,x1:o.x+o.w/2,y0:s-o.h,y1:s},u=t.find(h=>c.x0<h.x1+6&&c.x1>h.x0-6&&c.y0<h.y1+6&&c.y1>h.y0-6);if(!u)break;s=u.y0-8}t.push({x0:o.x-o.w/2,x1:o.x+o.w/2,y0:s-o.h,y1:s});let a=o.y-s;o.el.style.transform=`translate(${Math.round(o.x)}px, ${Math.round(s)}px) translate(-50%, -100%)`,o.el.style.setProperty("--live-thread",`${Math.round(18+a)}px`)}}function Rp(r,e,t){let n=e.printer,i=(c,u)=>M(r,c,u),o=n.progress??0,s=c=>new Intl.DateTimeFormat(r?.language??navigator.language,{hour:"2-digit",minute:"2-digit"}).format(new Date(c)),a=n.remaining!==null?n.remaining>=60?`${Math.floor(n.remaining/60)} h ${Math.round(n.remaining%60)} min`:`${Math.round(n.remaining)} min`:null,l=[n.nozzle!==null?`${i("printer_nozzle")} ${Math.round(n.nozzle)}\xB0`:null,n.bed!==null?`${i("printer_bed")} ${Math.round(n.bed)}\xB0`:null].filter(Boolean).join(" \xB7 ");return p`<div class="live-card live-card-printer ${n.printing?"live-charging":""}" data-i=${t}> </div>`}function Zc(r){let e=[...r.querySelectorAll(".live-card")].filter(o=>o.style.visibility!=="hidden"),t=[],n=e[0]?.parentElement?.clientWidth??0,i=e.map(o=>{let[s,a]=[Number(o.dataset.x),o.offsetWidth],l=n?n>a+16?Math.min(Math.max(s,a/2+8),n-a/2-8):n/2:s;return o.style.setProperty("--live-dx",`${Math.round(s-l)}px`),{el:o,x:l,y:Number(o.dataset.y),w:a,h:o.offsetHeight}}).sort((o,s)=>s.y-o.y);for(let o of i){let s=o.y;for(let l=0;l<12;l++){let c={x0:o.x-o.w/2,x1:o.x+o.w/2,y0:s-o.h,y1:s},u=t.find(d=>c.x0<d.x1+6&&c.x1>d.x0-6&&c.y0<d.y1+6&&c.y1>d.y0-6);if(!u)break;s=u.y0-8}t.push({x0:o.x-o.w/2,x1:o.x+o.w/2,y0:s-o.h,y1:s});let a=o.y-s;o.el.style.transform=`translate(${Math.round(o.x)}px, ${Math.round(s)}px) translate(-50%, -100%)`,o.el.style.setProperty("--live-thread",`${Math.round(18+a)}px`)}}function Qp(r,e,t){let n=e.printer,i=(c,u)=>A(r,c,u),o=n.progress??0,s=c=>new Intl.DateTimeFormat(r?.language??navigator.language,{hour:"2-digit",minute:"2-digit"}).format(new Date(c)),a=n.remaining!==null?n.remaining>=60?`${Math.floor(n.remaining/60)} h ${Math.round(n.remaining%60)} min`:`${Math.round(n.remaining)} min`:null,l=[n.nozzle!==null?`${i("printer_nozzle")} ${Math.round(n.nozzle)}\xB0`:null,n.bed!==null?`${i("printer_bed")} ${Math.round(n.bed)}\xB0`:null].filter(Boolean).join(" \xB7 ");return p`<div class="live-card live-card-printer ${n.printing?"live-charging":""}" data-i=${t}>
<div class="live-own"> <div class="live-own">
${n.picture?p`<img class="live-print-pic" src=${n.picture} alt="" />`:$n(o/100,n.printing?"#38bdf8":"#8aa0c8")} ${n.picture?p`<img class="live-print-pic" src=${n.picture} alt="" />`:En(o/100,n.printing?"#38bdf8":"#8aa0c8")}
<div class="live-own-text"><b>${n.progress!==null?`${Math.round(o)} %`:"\u2013"}</b><span>${i(`printer_${n.printing?"printing":/finish|complete|fertig/.test(n.status)?"done":/pause/.test(n.status)?"paused":/error|fail/.test(n.status)?"error":"idle"}`)}</span></div> <div class="live-own-text"><b>${n.progress!==null?`${Math.round(o)} %`:"\u2013"}</b><span>${i(`printer_${n.printing?"printing":/finish|complete|fertig/.test(n.status)?"done":/pause/.test(n.status)?"paused":/error|fail/.test(n.status)?"error":"idle"}`)}</span></div>
</div> </div>
<div class="live-rows"> <div class="live-rows">
@@ -909,9 +926,9 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${l?p`<div class="live-status">🌡 ${l}</div>`:f} ${l?p`<div class="live-status">🌡 ${l}</div>`:f}
${n.filaments.length?p`<div class="live-filaments">${n.filaments.map(c=>p`<i style=${`background:${c}`}></i>`)}</div>`:f} ${n.filaments.length?p`<div class="live-filaments">${n.filaments.map(c=>p`<i style=${`background:${c}`}></i>`)}</div>`:f}
</div> </div>
</div>`}function zp(r,e,t){let n=e.pump,i=a=>M(r,a),o=a=>a===null?"\u2013":`${W(r,a,1)}\xB0`,s={heating:"\u{1F525}",water:"\u{1F6BF}",cooling:"\u2744",defrost:"\u{1F9CA}",idle:"\u23F8"}[n.mode];return p`<div class="live-card live-card-heatpump ${n.mode==="idle"?"":"live-charging"}" data-i=${t}> </div>`}function Xp(r,e,t){let n=e.pump,i=a=>A(r,a),o=a=>a===null?"\u2013":`${W(r,a,1)}\xB0`,s={heating:"\u{1F525}",water:"\u{1F6BF}",cooling:"\u2744",defrost:"\u{1F9CA}",idle:"\u23F8"}[n.mode];return p`<div class="live-card live-card-heatpump ${n.mode==="idle"?"":"live-charging"}" data-i=${t}>
<div class="live-own"> <div class="live-own">
${$n(Math.min(1,(n.cop??0)/6),(n.cop??0)>=3.5?"#4ade80":(n.cop??0)>=2.5?"#facc15":"#fb923c")} ${En(Math.min(1,(n.cop??0)/6),(n.cop??0)>=3.5?"#4ade80":(n.cop??0)>=2.5?"#facc15":"#fb923c")}
<div class="live-own-text"><b>${n.cop!==null?W(r,n.cop,1):s}</b><span>${n.cop!==null?"COP":""}</span></div> <div class="live-own-text"><b>${n.cop!==null?W(r,n.cop,1):s}</b><span>${n.cop!==null?"COP":""}</span></div>
</div> </div>
<div class="live-rows"> <div class="live-rows">
@@ -922,14 +939,14 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${n.power!==null?p`<div class="live-row live-house"><span>${i("heatpump_power")}</span><b>${Re(r,n.power)}</b></div>`:f} ${n.power!==null?p`<div class="live-row live-house"><span>${i("heatpump_power")}</span><b>${Re(r,n.power)}</b></div>`:f}
${n.outside!==null?p`<div class="live-status">🌡 ${i("heatpump_outside")} ${o(n.outside)}</div>`:f} ${n.outside!==null?p`<div class="live-status">🌡 ${i("heatpump_outside")} ${o(n.outside)}</div>`:f}
</div> </div>
</div>`}function Tp(r,e,t){let n=(i,o,s)=>i===null?"\u2013":`${W(r,i,o)} ${s}`;return p`<div class="live-card live-card-roomclimate" data-i=${t} data-room=${e.roomId} role="group" aria-label=${`${e.name||M(r,"room")} \xB7 ${M(r,"climate")}`}> </div>`}function ef(r,e,t){let n=(i,o,s)=>i===null?"\u2013":`${W(r,i,o)} ${s}`;return p`<div class="live-card live-card-roomclimate" data-i=${t} data-room=${e.roomId} role="group" aria-label=${`${e.name||A(r,"room")} \xB7 ${A(r,"climate")}`}>
${e.showTemperature?p`<div class="live-row live-climate-temperature"><span title=${M(r,"climate_temperature")} aria-label=${M(r,"climate_temperature")}>🌡</span><b>${n(e.temperature===null?null:r?se(r,e.temperature):e.temperature,1,r?te(r):"\xB0C")}</b></div>`:f} ${e.showTemperature?p`<div class="live-row live-climate-temperature"><span title=${A(r,"climate_temperature")} aria-label=${A(r,"climate_temperature")}>🌡</span><b>${n(e.temperature===null?null:r?se(r,e.temperature):e.temperature,1,r?ne(r):"\xB0C")}</b></div>`:f}
${e.showHumidity?p`<div class="live-row live-climate-humidity"><span title=${M(r,"climate_humidity")} aria-label=${M(r,"climate_humidity")}>💧</span><b>${n(e.humidity,0,"%")}</b></div>`:f} ${e.showHumidity?p`<div class="live-row live-climate-humidity"><span title=${A(r,"climate_humidity")} aria-label=${A(r,"climate_humidity")}>💧</span><b>${n(e.humidity,0,"%")}</b></div>`:f}
${e.showCo2?p`<div class="live-row live-climate-co2"><span title=${M(r,"climate_co2")} aria-label=${M(r,"climate_co2")}>☁</span><b>${n(e.co2,0,"ppm")}</b></div>`:f} ${e.showCo2?p`<div class="live-row live-climate-co2"><span title=${A(r,"climate_co2")} aria-label=${A(r,"climate_co2")}>☁</span><b>${n(e.co2,0,"ppm")}</b></div>`:f}
${e.showIlluminance?p`<div class="live-row live-climate-illuminance"><span title=${M(r,"climate_illuminance")} aria-label=${M(r,"climate_illuminance")}>☀</span><b>${n(e.illuminance,0,"lx")}</b></div>`:f} ${e.showIlluminance?p`<div class="live-row live-climate-illuminance"><span title=${A(r,"climate_illuminance")} aria-label=${A(r,"climate_illuminance")}>☀</span><b>${n(e.illuminance,0,"lx")}</b></div>`:f}
</div>`}function Tc(r,e,t,n,i=!1){return e.length?p`<div class="live-cards"> </div>`}function Yc(r,e,t,n,i=!1){return e.length?p`<div class="live-cards">
${e.map((o,s)=>o.kind==="roomclimate"?Tp(r,o,s):i?f:o.kind==="house"?Sp(r,o,s,n):o.kind==="car"?Ap(r,o,s,t):o.kind==="printer"?Rp(r,o,s):o.kind==="heatpump"?zp(r,o,s):Ep(r,o,s,t))} ${e.map((o,s)=>o.kind==="roomclimate"?ef(r,o,s):i?f:o.kind==="house"?jp(r,o,s,n):o.kind==="car"?Yp(r,o,s,t):o.kind==="printer"?Qp(r,o,s):o.kind==="heatpump"?Xp(r,o,s):Jp(r,o,s,t))}
</div>`:f}var Dc=X` </div>`:f}var Jc=Q`
.live-cards { .live-cards {
position: absolute; position: absolute;
inset: 0; inset: 0;
@@ -1249,7 +1266,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
text-transform: uppercase; text-transform: uppercase;
letter-spacing: 0.04em; letter-spacing: 0.04em;
} }
`;function Wr(r){return r.toLocaleLowerCase().normalize("NFD").replace(new RegExp("\\p{M}","gu"),"")}var bo=r=>r.points.length>=3;function Fc(r,e,t){return r.rooms.filter(bo).find(n=>P([e,t],n.points))}function Dp(r,e,t,n){let i=[];for(let a of e.rooms.filter(bo)){let[l,c]=$e(a.points);i.push({kind:"room",name:a.name,where:n?e.name:"",floorId:e.id,roomId:a.id,entity:null,icon:null,x:l,z:c,y:0})}let o=new Set,s=(a,l,c,u)=>{if(o.has(a)||!(a in r.states))return;o.add(a);let h=Fc(e,l,c),m=[h?.name,n?e.name:void 0].filter(d=>!!d).join(" \xB7 ");i.push({kind:"device",name:O(r,a),where:m,floorId:e.id,roomId:h?.id??null,entity:a,icon:F(a),x:l,z:c,y:u})};for(let a of e.placements){let l=a.y??$t(F(a.entity_id)??"sensor",_e(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),c=l?.entity??l?.power;if(!c)continue;let u=_e(e,a.x,a.z)-.3;s(c,a.x,a.z,Math.min(u,Math.max(.5,a.h)))}for(let a of e.notes??[]){if(!a.text)continue;let l=Fc(e,a.x,a.z),c=[l?.name,n?e.name:void 0].filter(u=>!!u).join(" \xB7 ");i.push({kind:"note",name:`\u270E ${a.text.length>60?`${a.text.slice(0,59)}\u2026`:a.text}`,where:c,floorId:e.id,roomId:l?.id??null,entity:null,icon:null,x:a.x,z:a.z,y:1.3})}return i}function Hc(r,e){let t=ct(r,e.floors),n=e.floors.length>1,i=e.floors.flatMap(o=>Dp(r,o,t,n));for(let o of e.settings.circuits??[]){let s=e.floors.flatMap(h=>h.rooms.filter(m=>o.rooms.includes(m.id)&&bo(m)).map(m=>({f:h,r:m})));if(!s.length)continue;let[{f:a,r:l}]=s,[c,u]=$e(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:c,z:u,y:0})}return i}function Fp(r,e){return(Wr(r.name).startsWith(e)?0:2)+(r.kind==="room"?0:1)}function Pc(r,e,t=8){let n=Wr(e).split(/\s+/).filter(Boolean);if(n.length===0)return[];let i=Wr(e.trim());return r.filter(o=>{let s=Wr([o.name,o.where,o.entity].filter(Boolean).join(" "));return n.every(a=>s.includes(a))}).map(o=>({item:o,cost:Fp(o,i)})).sort((o,s)=>o.cost-s.cost||o.item.name.localeCompare(s.item.name)).slice(0,t).map(o=>o.item)}var Hp=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[190,90,255],[255,95,210],[255,70,70],[120,255,150]],Pp=[2200,2700,3200,4e3,5e3,6500],Ip=["hs","rgb","rgbw","rgbww","xy"],Cp=4,Ic=16,Cc=32,Np=128;function wo(r){let e=r.attributes.supported_color_modes??[],t=e.some(n=>Ip.includes(n));return{dim:e.some(n=>n!=="onoff"),color:t,temp:e.includes("color_temp")}}function yo(r){return((r.attributes.supported_features??0)&Cp)!==0&&typeof r.attributes.current_position=="number"}var vo=class extends re{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 M(this.hass,e,t)}ask(){return!this.confirmSwitch||confirm(this.t("confirm_switch",{name:O(this.hass,this.entity)}))}call(e,t,n={}){this.hass.callService(e,t,{entity_id:this.entity,...n})}close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}details(){be(this,this.entity),this.close()}ring(e){let t=e.length;return e.map((n,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}%">${n}</div>`})}renderLight(e){let t=wo(e),n=e.state==="on",i=n&&typeof e.attributes.brightness=="number"?Math.round(e.attributes.brightness/2.55):n?100:0,o=t.color?Hp.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?Pp.map(s=>p`<button class="qm-swatch" style="background:${Wp(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 Br(r){return r.toLocaleLowerCase().normalize("NFD").replace(new RegExp("\\p{M}","gu"),"")}var Ao=r=>r.points.length>=3;function Qc(r,e,t){return r.rooms.filter(Ao).find(n=>P([e,t],n.points))}function tf(r,e,t,n){let i=[];for(let a of e.rooms.filter(Ao)){let[l,c]=$e(a.points);i.push({kind:"room",name:a.name,where:n?e.name:"",floorId:e.id,roomId:a.id,entity:null,icon:null,x:l,z:c,y:0})}let o=new Set,s=(a,l,c,u)=>{if(o.has(a)||!(a in r.states))return;o.add(a);let d=Qc(e,l,c),m=[d?.name,n?e.name:void 0].filter(h=>!!h).join(" \xB7 ");i.push({kind:"device",name:O(r,a),where:m,floorId:e.id,roomId:d?.id??null,entity:a,icon:F(a),x:l,z:c,y:u})};for(let a of e.placements){let l=a.y??Mt(F(a.entity_id)??"sensor",_e(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),c=l?.entity??l?.power;if(!c)continue;let u=_e(e,a.x,a.z)-.3;s(c,a.x,a.z,Math.min(u,Math.max(.5,a.h)))}for(let a of e.notes??[]){if(!a.text)continue;let l=Qc(e,a.x,a.z),c=[l?.name,n?e.name:void 0].filter(u=>!!u).join(" \xB7 ");i.push({kind:"note",name:`\u270E ${a.text.length>60?`${a.text.slice(0,59)}\u2026`:a.text}`,where:c,floorId:e.id,roomId:l?.id??null,entity:null,icon:null,x:a.x,z:a.z,y:1.3})}return i}function Xc(r,e){let t=ut(r,e.floors),n=e.floors.length>1,i=e.floors.flatMap(o=>tf(r,o,t,n));for(let o of e.settings.circuits??[]){let s=e.floors.flatMap(d=>d.rooms.filter(m=>o.rooms.includes(m.id)&&Ao(m)).map(m=>({f:d,r:m})));if(!s.length)continue;let[{f:a,r:l}]=s,[c,u]=$e(l.points);i.push({kind:"circuit",name:`\u{1F50C} ${o.name}`,where:s.map(d=>d.r.name).join(", "),floorId:a.id,roomId:l.id,entity:null,icon:null,x:c,z:u,y:0})}return i}function nf(r,e){return(Br(r.name).startsWith(e)?0:2)+(r.kind==="room"?0:1)}function eu(r,e,t=8){let n=Br(e).split(/\s+/).filter(Boolean);if(n.length===0)return[];let i=Br(e.trim());return r.filter(o=>{let s=Br([o.name,o.where,o.entity].filter(Boolean).join(" "));return n.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 rf=[[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],sf=["hs","rgb","rgbw","rgbww","xy"],af=4,tu=16,nu=32,lf=128;function Ro(r){let e=r.attributes.supported_color_modes??[],t=e.some(n=>sf.includes(n));return{dim:e.some(n=>n!=="onoff"),color:t,temp:e.includes("color_temp")}}function zo(r){return((r.attributes.supported_features??0)&af)!==0&&typeof r.attributes.current_position=="number"}var Eo=class extends X{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 A(this.hass,e,t)}ask(){return!this.confirmSwitch||confirm(this.t("confirm_switch",{name:O(this.hass,this.entity)}))}call(e,t,n={}){this.hass.callService(e,t,{entity_id:this.entity,...n})}close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}details(){be(this,this.entity),this.close()}ring(e){let t=e.length;return e.map((n,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}%">${n}</div>`})}renderLight(e){let t=Ro(e),n=e.state==="on",i=n&&typeof e.attributes.brightness=="number"?Math.round(e.attributes.brightness/2.55):n?100:0,o=t.color?rf.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:${cf(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)} ${this.ring(o)}
<button class="qm-power ${n?"qm-on":""}" aria-pressed=${n} @click=${()=>this.ask()&&this.call("light","toggle")}> <button class="qm-power ${n?"qm-on":""}" aria-pressed=${n} @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> <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>
@@ -1264,7 +1281,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.value=${String(Math.max(1,i))} .value=${String(Math.max(1,i))}
aria-label=${this.t("brightness")} aria-label=${this.t("brightness")}
@change=${s=>this.call("light","turn_on",{brightness_pct:Number(s.target.value)})} @change=${s=>this.call("light","turn_on",{brightness_pct:Number(s.target.value)})}
/>`:f}`}renderCover(e){e=lr(this.hass,e,this.tiltEntity);let t=typeof e.attributes.current_position=="number"?e.attributes.current_position:null,n=e.state==="opening"||e.state==="closing",i=yo(e),o=(u,h,m,d=!1)=>p`<button class="qm-swatch qm-slot ${d?"qm-slot-on":""}" aria-label=${h} @click=${m}>${u}</button>`,s=u=>t!==null&&Math.abs(t-u)<3,a=[o("\u25B2",this.t("cover_open"),()=>this.ask()&&this.call("cover","open_cover"),s(100)),...i?[75,50].map(u=>o(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],o("\u25BC",this.t("cover_close"),()=>this.ask()&&this.call("cover","close_cover"),s(0)),...i?[25].map(u=>o(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],...Number(e.attributes.supported_features??0)&8?[o("\u25A0",this.t("cover_stop"),()=>this.call("cover","stop_cover"),n)]:[],...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,c=t!==null||n||e.state==="open"||e.state==="closed";return p`<div class="qm-ring"> />`:f}`}renderCover(e){e=dr(this.hass,e,this.tiltEntity);let t=typeof e.attributes.current_position=="number"?e.attributes.current_position:null,n=e.state==="opening"||e.state==="closing",i=zo(e),o=(u,d,m,h=!1)=>p`<button class="qm-swatch qm-slot ${h?"qm-slot-on":""}" aria-label=${d} @click=${m}>${u}</button>`,s=u=>t!==null&&Math.abs(t-u)<3,a=[o("\u25B2",this.t("cover_open"),()=>this.ask()&&this.call("cover","open_cover"),s(100)),...i?[75,50].map(u=>o(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],o("\u25BC",this.t("cover_close"),()=>this.ask()&&this.call("cover","close_cover"),s(0)),...i?[25].map(u=>o(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],...Number(e.attributes.supported_features??0)&8?[o("\u25A0",this.t("cover_stop"),()=>this.call("cover","stop_cover"),n)]:[],...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,c=t!==null||n||e.state==="open"||e.state==="closed";return p`<div class="qm-ring">
${this.ring(a)} ${this.ring(a)}
<button <button
class="qm-power qm-blind ${c&&l<100?"qm-on":""}" class="qm-power qm-blind ${c&&l<100?"qm-on":""}"
@@ -1286,7 +1303,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
aria-label=${this.t("position")} aria-label=${this.t("position")}
@change=${u=>this.call("cover","set_cover_position",{position:Number(u.target.value)})} @change=${u=>this.call("cover","set_cover_position",{position:Number(u.target.value)})}
/>`:f} />`:f}
${this.renderTilt(e)}`}renderTilt(e){let t=(e.attributes.supported_features??0)|0,n=typeof e.attributes.current_tilt_position=="number"?e.attributes.current_tilt_position:null;return t&Np&&n!==null?p`<label class="qm-tilt" ${this.renderTilt(e)}`}renderTilt(e){let t=(e.attributes.supported_features??0)|0,n=typeof e.attributes.current_tilt_position=="number"?e.attributes.current_tilt_position:null;return t&lf&&n!==null?p`<label class="qm-tilt"
><span>${this.t("cover_tilt")} · ${Math.round(n)} %</span> ><span>${this.t("cover_tilt")} · ${Math.round(n)} %</span>
<input <input
class="qm-slider" class="qm-slider"
@@ -1296,9 +1313,9 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.value=${String(n)} .value=${String(n)}
aria-label=${this.t("cover_tilt")} 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)})} @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&(Ic|Cc)?p`<div class="qm-tilt-buttons"> /></label>`:t&(tu|nu)?p`<div class="qm-tilt-buttons">
${t&Ic?p`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","open_cover_tilt")}>${this.t("cover_tilt_open")}</button>`:f} ${t&tu?p`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","open_cover_tilt")}>${this.t("cover_tilt_open")}</button>`:f}
${t&Cc?p`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","close_cover_tilt")}>${this.t("cover_tilt_close")}</button>`:f} ${t&nu?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",n=e.entity_id.split(".")[0];return p`<div class="qm-ring qm-ring-small"> </div>`:f}renderToggle(e){let t=e.state==="on"||e.state==="unlocked"||e.state==="playing",n=e.entity_id.split(".")[0];return p`<div class="qm-ring qm-ring-small">
<button <button
class="qm-power ${t?"qm-on":""}" class="qm-power ${t?"qm-on":""}"
@@ -1308,7 +1325,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
<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> <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>
<b>${ie(this.hass,e)}</b> <b>${ie(this.hass,e)}</b>
</button> </button>
</div>`}renderMedia(e){let t=!["off","standby","unavailable","unknown"].includes(e.state),n=e.state==="playing",i=e.attributes,o=typeof i.volume_level=="number"?Math.round(i.volume_level*100):null,s=Array.isArray(i.source_list)?i.source_list.slice(0,24):[],a=[i.media_title,i.media_artist].filter(h=>typeof h=="string"&&h).join(" \xB7 "),l=h=>p`<svg viewBox="0 0 24 24" width="18" height="18" fill="currentColor"><path d=${h} /></svg>`,c=(h,m,d,g=!1)=>p`<button class="qm-swatch qm-slot ${g?"qm-slot-on":""}" aria-label=${m} title=${m} @click=${d}>${h}</button>`,u=t?[c(l(n?"M6 5h4v14H6zM14 5h4v14h-4z":"M8 5v14l11-7z"),this.t(n?"media_pause":"media_play"),()=>this.call("media_player","media_play_pause"),n),c(l("M6 6h2v12H6zm3.5 6 8.5 6V6z"),this.t("media_previous"),()=>this.call("media_player","media_previous_track")),c(l("M16 6h2v12h-2zM6 18l8.5-6L6 6z"),this.t("media_next"),()=>this.call("media_player","media_next_track"))]:[];return p`<div class="qm-ring ${u.length?"":"qm-ring-small"}"> </div>`}renderMedia(e){let t=!["off","standby","unavailable","unknown"].includes(e.state),n=e.state==="playing",i=e.attributes,o=typeof i.volume_level=="number"?Math.round(i.volume_level*100):null,s=Array.isArray(i.source_list)?i.source_list.slice(0,24):[],a=[i.media_title,i.media_artist].filter(d=>typeof d=="string"&&d).join(" \xB7 "),l=d=>p`<svg viewBox="0 0 24 24" width="18" height="18" fill="currentColor"><path d=${d} /></svg>`,c=(d,m,h,g=!1)=>p`<button class="qm-swatch qm-slot ${g?"qm-slot-on":""}" aria-label=${m} title=${m} @click=${h}>${d}</button>`,u=t?[c(l(n?"M6 5h4v14H6zM14 5h4v14h-4z":"M8 5v14l11-7z"),this.t(n?"media_pause":"media_play"),()=>this.call("media_player","media_play_pause"),n),c(l("M6 6h2v12H6zm3.5 6 8.5 6V6z"),this.t("media_previous"),()=>this.call("media_player","media_previous_track")),c(l("M16 6h2v12h-2zM6 18l8.5-6L6 6z"),this.t("media_next"),()=>this.call("media_player","media_next_track"))]:[];return p`<div class="qm-ring ${u.length?"":"qm-ring-small"}">
${this.ring(u)} ${this.ring(u)}
<button class="qm-power ${t?"qm-on":""}" aria-pressed=${t} @click=${()=>this.ask()&&this.call("media_player",t?"turn_off":"turn_on")}> <button class="qm-power ${t?"qm-on":""}" aria-pressed=${t} @click=${()=>this.ask()&&this.call("media_player",t?"turn_off":"turn_on")}>
<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> <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>
@@ -1316,15 +1333,15 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
</button> </button>
</div> </div>
${a?p`<div class="qm-media-title">${a}</div>`:f} ${a?p`<div class="qm-media-title">${a}</div>`:f}
${o!==null?p`<input class="qm-slider" type="range" min="0" max="100" .value=${String(o)} aria-label=${this.t("media_volume")} @change=${h=>this.call("media_player","volume_set",{volume_level:Number(h.target.value)/100})} />`:f} ${o!==null?p`<input class="qm-slider" type="range" min="0" max="100" .value=${String(o)} aria-label=${this.t("media_volume")} @change=${d=>this.call("media_player","volume_set",{volume_level:Number(d.target.value)/100})} />`:f}
${s.length?p`<div class="qm-play-head">${this.t("media_sources")}</div> ${s.length?p`<div class="qm-play-head">${this.t("media_sources")}</div>
<div class="qm-play">${s.map(h=>p`<button class="qm-chip ${i.source===h?"qm-chip-on":""}" @click=${()=>this.call("media_player","select_source",{source:h})}>${h}</button>`)}</div>`:f} <div class="qm-play">${s.map(d=>p`<button class="qm-chip ${i.source===d?"qm-chip-on":""}" @click=${()=>this.call("media_player","select_source",{source:d})}>${d}</button>`)}</div>`:f}
${this.presets?.length?p`<div class="qm-play-head">${this.t("presets")}</div> ${this.presets?.length?p`<div class="qm-play-head">${this.t("presets")}</div>
<div class="qm-play">${this.presets.map(h=>p`<button class="qm-chip" @click=${()=>this.call("media_player","play_media",{media_content_type:h.type,media_content_id:h.content})}>${h.label}</button>`)}</div>`:f}`}render(){let e=this.hass?.states[this.entity];if(!e)return f;let t=F(this.entity),n=I(e)&&!Xt(e)?p`<p class="qm-note">${ie(this.hass,e)}</p>`:t==="light"?this.renderLight(e):t==="cover"?this.renderCover(e):t==="media"?this.renderMedia(e):this.renderToggle(e);return p`<div class="qm" role="dialog" aria-label=${O(this.hass,this.entity)}> <div class="qm-play">${this.presets.map(d=>p`<button class="qm-chip" @click=${()=>this.call("media_player","play_media",{media_content_type:d.type,media_content_id:d.content})}>${d.label}</button>`)}</div>`:f}`}render(){let e=this.hass?.states[this.entity];if(!e)return f;let t=F(this.entity),n=I(e)&&!tn(e)?p`<p class="qm-note">${ie(this.hass,e)}</p>`:t==="light"?this.renderLight(e):t==="cover"?this.renderCover(e):t==="media"?this.renderMedia(e):this.renderToggle(e);return p`<div class="qm" role="dialog" aria-label=${O(this.hass,this.entity)}>
<div class="qm-title">${O(this.hass,this.entity)}</div> <div class="qm-title">${O(this.hass,this.entity)}</div>
${n} ${n}
<button class="qm-details" @click=${()=>this.details()}>${this.t("details")} …</button> <button class="qm-details" @click=${()=>this.details()}>${this.t("details")} …</button>
</div>`}static styles=[pe,X` </div>`}static styles=[pe,Q`
.qm-play-head { .qm-play-head {
margin: 10px 0 4px; margin: 10px 0 4px;
font-size: 11px; font-size: 11px;
@@ -1567,43 +1584,43 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.qm-note { .qm-note {
color: var(--nf-muted); color: var(--nf-muted);
} }
`]};function Wp(r){let e=Math.min(1,Math.max(0,(r-2200)/4300)),t=(n,i)=>Math.round(n+(i-n)*e);return`rgb(${t(255,200)},${t(170,225)},${t(80,255)})`}customElements.get("nf-quick-menu")||customElements.define("nf-quick-menu",vo);var Op=new URL(import.meta.url),Lp=new URL("./nextfloor-3d.js?v=74227cd20cc3",Op).href,Nc;function Wc(){return Nc??=import(Lp),Nc}function Oc(r){if(!r||r.state!=="on")return 0;let e=typeof r.attributes.percentage=="number"?r.attributes.percentage:60;return e<=0?0:.2+.6*Math.min(100,e)/100}var Lc="weather.nextfloor_symcon",Vc={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"},Bc=new WeakMap;function Bp(r){let e=r.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 Or(r,e){if(!J(r))return r;let t=e.weather_variables??{};if(!e.rain_sensor&&!Object.values(t).some(d=>d&&d!=="none"))return r;let n=Bc.get(r)??new WeakMap;Bc.set(r,n);let i=n.get(e);if(i)return i;let o={friendly_name:"Wetter",nf_symcon_weather:!0},s=d=>t[d]&&t[d]!=="none"?r.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),_=sn(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),_=sn(g);_!==null&&(o[d]=Tr(_,g?.attributes.unit_of_measurement))}o.wind_speed_unit="km/h";let a=Ze(s("wind_bearing"));a!==null&&(o.wind_bearing=a);let l=Bp(Ye(s("condition"))),c=e.rain_sensor?r.states[e.rain_sensor]:void 0,u=oe(c);u!==null&&e.rain_sensor_inverted&&(u=!u),u===null&&typeof o.precipitation=="number"&&(u=o.precipitation>0),oe(s("lightning"))?l=u?"lightning-rainy":"lightning":oe(s("snow"))?l=u?"snowy-rainy":"snowy":oe(s("fog"))?l="fog":u===!0?l=Number(o.precipitation??0)>=8?"pouring":"rainy":u===!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&&u===!1&&(l="sunny");let h={entity_id:Lc,state:l??"unknown",attributes:o},m={...r,states:{...r.states,[Lc]:h}};return n.set(e,m),m}var Vp=new Set(["on","home","open","true","active","playing","heat","heating"]);function Lr(r,e){let t=e.show_when;if(!t?.entity||!r)return!0;let n=r.states[t.entity];if(!n||I(n))return!0;let i=String(n.state).toLowerCase(),o=(t.state??"").split(",").map(a=>a.trim().toLowerCase()).filter(Boolean),s=o.length?o.includes(i):Vp.has(i)||Number.isFinite(Number(i))&&Number(i)>0;return t.invert?!s:s}function xo(r,e){let t=[];for(let n of e.floors)for(let i of n.furniture)Lr(r,i)||t.push(i.id);return t.sort()}function Kc(r,e){if(!e.length)return r;let t=new Set(e);return{...r,floors:r.floors.map(n=>n.furniture.some(i=>t.has(i.id))?{...n,furniture:n.furniture.filter(i=>!t.has(i.id))}:n)}}var Gc="image:";function ko(r,e,t){let n=(e??"").trim();if(!n)return null;if(n.startsWith(Gc))return t(n.slice(Gc.length));if(/^(https?:\/\/|\/)/.test(n))return n;if(/^[a-z_]+\.[a-z0-9_]+$/.test(n)){let i=r?.states[n]?.attributes.entity_picture;return typeof i=="string"&&i?i:null}return null}var Mn=r=>Number(r);function En(r){if(Array.isArray(r)){let[o,s]=[Mn(r[0]),Mn(r[1])];return Number.isFinite(o)&&Number.isFinite(s)?[o,s]:null}if(!r||typeof r!="object")return null;let{x:e,y:t}=r,[n,i]=[Mn(e),Mn(t)];return Number.isFinite(n)&&Number.isFinite(i)?[n,i]:null}function Uc(r){return r?En(r.charger)??En(r.charger_position):null}function jc(r){for(let[e,t]of Object.entries(r.states))if(e.startsWith("camera.")&&(En(t.attributes?.vacuum_position)??Uc(t.attributes)))return e;return null}var Kp=r=>Array.isArray(r)?typeof r[0]=="number":!!r&&typeof r=="object",An=(r,e)=>e?[r[0],-r[1]]:r;function Gp(r){if(!r)return null;let e=r.mirror===!0,[t,n]=An(r.ga,e),[i,o]=An(r.gb,e),[s,a]=r.a,[l,c]=r.b,[u,h]=[i-t,o-n],[m,d]=[l-s,c-a],g=Math.hypot(u,h),_=Math.hypot(m,d);if(!(g>1e-6)||!(_>1e-6))return null;let b=_/g,v=Math.atan2(d,m)-Math.atan2(h,u),[k,S]=[Math.cos( Line truncated `]};function cf(r){let e=Math.min(1,Math.max(0,(r-2200)/4300)),t=(n,i)=>Math.round(n+(i-n)*e);return`rgb(${t(255,200)},${t(170,225)},${t(80,255)})`}customElements.get("nf-quick-menu")||customElements.define("nf-quick-menu",Eo);var uf=new URL(import.meta.url),df=new URL("./nextfloor-3d.js?v=74227cd20cc3",uf).href,ru;function iu(){return ru??=import(df),ru}function ou(r){if(!r||r.state!=="on")return 0;let e=typeof r.attributes.percentage=="number"?r.attributes.percentage:60;return e<=0?0:.2+.6*Math.min(100,e)/100}var su="weather.nextfloor_symcon",lu={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"},au=new WeakMap;function hf(r){let e=r.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 Vr(r,e){if(!U(r))return r;let t=e.weather_variables??{};if(!e.rain_sensor&&!Object.values(t).some(h=>h&&h!=="none"))return r;let n=au.get(r)??new WeakMap;au.set(r,n);let i=n.get(e);if(i)return i;let o={friendly_name:"Wetter",nf_symcon_weather:!0},s=h=>t[h]&&t[h]!=="none"?r.states[t[h]]:void 0;for(let h of["temperature","humidity","pressure","cloud_coverage","precipitation","precipitation_total","illuminance","uv_index","visibility"]){let g=s(h),_=Pe(g);_!==null&&(o[h]=h==="cloud_coverage"&&g?.attributes.symcon_max===1?_*100:_),g?.attributes.unit_of_measurement&&(o[`${h}_unit`]=g.attributes.unit_of_measurement)}for(let h of["wind_speed","wind_gust_speed"]){let g=s(h),_=Pe(g);_!==null&&(o[h]=Hr(_,g?.attributes.unit_of_measurement))}o.wind_speed_unit="km/h";let a=Ye(s("wind_bearing"));a!==null&&(o.wind_bearing=a);let l=hf(Je(s("condition"))),c=e.rain_sensor?r.states[e.rain_sensor]:void 0,u=oe(c);u!==null&&e.rain_sensor_inverted&&(u=!u),u===null&&typeof o.precipitation=="number"&&(u=o.precipitation>0),oe(s("lightning"))?l=u?"lightning-rainy":"lightning":oe(s("snow"))?l=u?"snowy-rainy":"snowy":oe(s("fog"))?l="fog":u===!0?l=Number(o.precipitation??0)>=8?"pouring":"rainy":u===!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&&u===!1&&(l="sunny");let d={entity_id:su,state:l??"unknown",attributes:o},m={...r,states:{...r.states,[su]:d}};return n.set(e,m),m}var mf=new Set(["on","home","open","true","active","playing","heat","heating"]);function Kr(r,e){let t=e.show_when;if(!t?.entity||!r)return!0;let n=r.states[t.entity];if(!n||I(n))return!0;let i=String(n.state).toLowerCase(),o=(t.state??"").split(",").map(a=>a.trim().toLowerCase()).filter(Boolean),s=o.length?o.includes(i):mf.has(i)||Number.isFinite(Number(i))&&Number(i)>0;return t.invert?!s:s}function To(r,e){let t=[];for(let n of e.floors)for(let i of n.furniture)Kr(r,i)||t.push(i.id);return t.sort()}function cu(r,e){if(!e.length)return r;let t=new Set(e);return{...r,floors:r.floors.map(n=>n.furniture.some(i=>t.has(i.id))?{...n,furniture:n.furniture.filter(i=>!t.has(i.id))}:n)}}var uu="image:";function Do(r,e,t){let n=(e??"").trim();if(!n)return null;if(n.startsWith(uu))return t(n.slice(uu.length));if(/^(https?:\/\/|\/)/.test(n))return n;if(/^[a-z_]+\.[a-z0-9_]+$/.test(n)){let i=r?.states[n]?.attributes.entity_picture;return typeof i=="string"&&i?i:null}return null}var Rn=r=>Number(r);function Tn(r){if(Array.isArray(r)){let[o,s]=[Rn(r[0]),Rn(r[1])];return Number.isFinite(o)&&Number.isFinite(s)?[o,s]:null}if(!r||typeof r!="object")return null;let{x:e,y:t}=r,[n,i]=[Rn(e),Rn(t)];return Number.isFinite(n)&&Number.isFinite(i)?[n,i]:null}function du(r){return r?Tn(r.charger)??Tn(r.charger_position):null}function hu(r){for(let[e,t]of Object.entries(r.states))if(e.startsWith("camera.")&&(Tn(t.attributes?.vacuum_position)??du(t.attributes)))return e;return null}var pf=r=>Array.isArray(r)?typeof r[0]=="number":!!r&&typeof r=="object",zn=(r,e)=>e?[r[0],-r[1]]:r;function ff(r){if(!r)return null;let e=r.mirror===!0,[t,n]=zn(r.ga,e),[i,o]=zn(r.gb,e),[s,a]=r.a,[l,c]=r.b,[u,d]=[i-t,o-n],[m,h]=[l-s,c-a],g=Math.hypot(u,d),_=Math.hypot(m,h);if(!(g>1e-6)||!(_>1e-6))return null;let b=_/g,v=Math.atan2(h,m)-Math.atan2(d,u),[k,S]=[Math.cos( 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>`)} ${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,n=this.building;if(!t||!n||!this.hass)return;let i=this._travel,o=i&&!i.loading?Ft(this.hass,i.history,i.t):this.hass;if((e||!this.openingLinks||this.linkedRegistry!==o.entities)&&(this.openingLinks=De(o,n.floors),this.furnitureLinks=ct(o,n.floors),this.linkedRegistry=o.entities,this.findIndex=null,this.alertSrc=this.alerts?Cl(o,n,this.weatherEntityId,this.openingLinks):null,this.watched=Kl({hass:o,building:n,openingLinks:this.openingLinks,furnitureLinks:this.furnitureLinks,needsRoomSensors:this.heatMode!=="none"||this.roomLabels,alertSources:this.alertSrc,weatherEntityId:this.weatherEntityId}),e=!0),!(e||this.watched.some(w=>this.shownStates.get(w)!==o.states[w])))return;xo(o,n).join(",")!==this.shownFor?.key&&t.setBuilding(this.shownBuilding(o)),this.shownStates=new Map(this.watched.map(w=>[w,o.states[w]])),this.refreshToday(n),this.refreshForecast(n);let a=un(o,n),l=xa(o,n.floors.some(w=>w.layer&&this.hiddenLayers.has(w.id))?this.shownBuilding(o):n);this.placementInfo=new Map(l.map(w=>[w.id,{floorId:w.floorId,roomId:w.roomId,x:w.x,z:w.z,y:w.y,rotation:w.rotation??0}]));let c=this.furnitureMarkers(o,n,new Set(l.map(w=>w.id)),new Set(a.map(w=>w.powerEntity)));a.push(...c.consumers);let u=dn(o,n,a,Ce(n,w=>this.furnitureLinks?.get(w.id)?.power??null)),h=new Map(a.filter(w=>w.id!==w.powerEntity).map(w=>[w.id,w.power]));this.confirmSet=ut(o,n.floors);let m=new Set(this.liveCardsOn?this._liveCards.flatMap(w=>w.kind==="media"?[w.media.entity]:w.kind==="car"?[w.spot]:[]):[]);for(let w of n.floors)for(let y of w.outdoor??[]){if(!y.area_id&&!y.temp_entity&&!y.pump_entity)continue;let B=y.temp_entity?o.states[y.temp_entity]:void 0,D=y.pump_entity?o.states[y.pump_entity]:void 0,[L,me]=$e(y.points),et=B&&Number.isFinite(Number(B.state))?`${W(o,se(o,Xn(Number(B.state),B.attributes.unit_of_measurement)),1)} ${te(o)}`:"",gt=!!D&&Q(D);l.push({id:y.area_id?`outdoor:${y.id}`:y.pump_entity??y.temp_entity,floorId:w.id,roomId:null,x:L,z:me,y:jn(w,y,L,me)+.7,icon:Me(y.type==="pool"?"pool":y.type==="terrace"?"table-chair":"tree-outline"),name:y.area_id&&o.areas?.[y.area_id]?.name||M(o,`out_${y.type}`),text:[et,gt?M(o,"pool_pump_on"):""].filter(Boolean).join(" \xB7 "),active:gt,unavailable:!1,glow:null,show:"always"})}let d=new Map;for(let w of n.floors){for(let y of w.placements)y.pin_offset&&d.set(`${w.id}:${y.entity_id}`,y.pin_offset);for(let y of w.furniture)y.pin_offset&&d.set(`f:${y.id}`,y.pin_offset)}let g=w=>{let y=w.lamp?void 0:(w.furnitureId?d.get(`f:${w.furnitureId}`):void 0)??d.get(`${w.floorId}:${w.id}`);return y?{...w,x:w.x+(y.x??0),z:w.z+(y.z??0),y:w.y+(y.y??0)}:w};t.setDevices([...[...l,...c.markers].map(g).map(w=>{let y=w.show==="no_power"||"energyDevice"in w&&w.energyDevice?null:h.get(w.id)??null,B={...w,power:y,powerText:y===null?void 0:ce(o,y),effect:this.dimmed?void 0:w.effect,text:this.subMeterText(o,n,u,w.furnitureId)??w.text},D=w.ownName&&(w.showName||this.markerNames)?w.ownName:"",L=m.has(w.id)||!!w.furnitureId&&m.has(w.furnitureId);return{...B,pin:this.showPin(B)&&!L,full:w.show==="always",caption:D}})]),t.setPickTargets(c.targets,this.openingTargets(),this.secondBlinds()),t.setScreens(c.screens),t.setFridgeDoors(ra(o,n.floors)),t.setCovers(pa(o,n)),t.setRobots(this.robotInfos(o,n));let _=new Map;for(let w of n.floors)for(let y of w.furniture)!Z(y.type)?.pet||!y.room_sensor||y.room_sensor==="none"||_.set(y.id,Ei(o,w.rooms.filter(B=>B.points.length>=3),null,y.room_sensor)?.id??null);_.size&&t.setPetRooms(_),t.setRoofWindows(Dl(o,n)),t.setParked(to(o,n)),t.setGateStates(Yl(o,n));let b=new Map(n.floors.flatMap(w=>w.openings.map(y=>[y.id,y.type]))),v=new Map([...this.openingLinks].map(([w,y])=>[w,Fe(o,y,b.get(w))]));t.setOpeningStates(v),this.setAlerts(this.alertSrc?Qi(o,n,this.alertSrc,this.openingLinks):[]),this.watchLostContacts(o);let k=[...l,...c.markers].map(w=>`${w.id}:${w.glow?`${w.glow.level.toFixed(1)}/${w.glow.color.map(y=>y.toFixed(1)).join("/")}`:0}`).join(";")+"|"+[...v].map(([w,y])=>`${w}:${y.open}:${y.cover===null?"-":y.cover.toFixed(1)}`).join(";");if(k!==this.thumbSig){let w=this.thumbSig==="";this.thumbSig=k,w||this.scheduleThumbs(1500)}let S=uc(o,n,a,n.energy.advanced?w=>this.furnitureLinks?.get(w.id)?.power??null:void 0),E=this.liveCars(o,n);for(let w of E){if(!w.car.home||!w.car.charging&&!w.car.plugged)continue;let y=n.floors.flatMap(L=>L.furniture.filter(me=>me.type==="wallbox").map(me=>({floorId:L.id,x:me.x,z:me.z,y:1}))).sort((L,me)=>Math.hypot(L.x-w.at.x,L.z-w.at.z)-Math.hypot(me.x-w.at.x,me.z-w.at.z))[0],B=y&&y.floorId===w.at.floorId&&Math.hypot(y.x-w.at.x,y.z-w.at.z)<9,D=y??xn(n);!D||!w.car.charging&&!B||S.arcs.push({key:`car:${w.spot}`,from:D,to:{...w.at,y:.8},power:w.car.charging?w.car.chargingW??7e3:0,color:[80,175,255],...B?{via:[{...D,y:.35},{floorId:w.at.floorId,x:(D.x+w.at.x)/2,z:(D.z+w.at.z)/2,y:.08},{...w.at,y:.5}],cable:!0}:{}})}let T=xn(n);for(let w of this.liveHeatPumps(n)){let y=w.pump.heat??(w.pump.mode==="heating"||w.puLine truncated </div>`}syncDevices(e){let t=this.viewer,n=this.building;if(!t||!n||!this.hass)return;let i=this._travel,o=i&&!i.loading?Ht(this.hass,i.history,i.t):this.hass;if((e||!this.openingLinks||this.linkedRegistry!==o.entities)&&(this.openingLinks=De(o,n.floors),this.furnitureLinks=ut(o,n.floors),this.linkedRegistry=o.entities,this.findIndex=null,this.alertSrc=this.alerts?nc(o,n,this.weatherEntityId,this.openingLinks):null,this.watched=cc({hass:o,building:n,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;To(o,n).join(",")!==this.shownFor?.key&&t.setBuilding(this.shownBuilding(o)),this.shownStates=new Map(this.watched.map(y=>[y,o.states[y]])),this.refreshToday(n),this.refreshForecast(n);let a=mn(o,n),l=Ta(o,n.floors.some(y=>y.layer&&this.hiddenLayers.has(y.id))?this.shownBuilding(o):n);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 c=this.furnitureMarkers(o,n,new Set(l.map(y=>y.id)),new Set(a.map(y=>y.powerEntity)));a.push(...c.consumers);let u=pn(o,n,a,Ne(n,y=>this.furnitureLinks?.get(y.id)?.power??null)),d=new Map(a.filter(y=>y.id!==y.powerEntity).map(y=>[y.id,y.power]));this.confirmSet=dt(o,n.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 n.floors)for(let w of y.outdoor??[]){if(!w.area_id&&!w.temp_entity&&!w.pump_entity)continue;let B=w.temp_entity?o.states[w.temp_entity]:void 0,D=w.pump_entity?o.states[w.pump_entity]:void 0,[L,me]=$e(w.points),tt=B&&Number.isFinite(Number(B.state))?`${W(o,se(o,nr(Number(B.state),B.attributes.unit_of_measurement)),1)} ${ne(o)}`:"",_t=!!D&&ee(D);l.push({id:w.area_id?`outdoor:${w.id}`:w.pump_entity??w.temp_entity,floorId:y.id,roomId:null,x:L,z:me,y:Yn(y,w,L,me)+.7,icon:Me(w.type==="pool"?"pool":w.type==="terrace"?"table-chair":"tree-outline"),name:w.area_id&&o.areas?.[w.area_id]?.name||A(o,`out_${w.type}`),text:[tt,_t?A(o,"pool_pump_on"):""].filter(Boolean).join(" \xB7 "),active:_t,unavailable:!1,glow:null,show:"always"})}let h=new Map;for(let y of n.floors){for(let w of y.placements)w.pin_offset&&h.set(`${y.id}:${w.entity_id}`,w.pin_offset);for(let w of y.furniture)w.pin_offset&&h.set(`f:${w.id}`,w.pin_offset)}let g=y=>{let w=y.lamp?void 0:(y.furnitureId?h.get(`f:${y.furnitureId}`):void 0)??h.get(`${y.floorId}:${y.id}`);return w?{...y,x:y.x+(w.x??0),z:y.z+(w.z??0),y:y.y+(w.y??0)}:y};t.setDevices([...[...l,...c.markers].map(g).map(y=>{let w=y.show==="no_power"||"energyDevice"in y&&y.energyDevice?null:d.get(y.id)??null,B={...y,power:w,powerText:w===null?void 0:ce(o,w),effect:this.dimmed?void 0:y.effect,text:this.subMeterText(o,n,u,y.furnitureId)??y.text},D=y.ownName&&(y.showName||this.markerNames)?y.ownName:"",L=m.has(y.id)||!!y.furnitureId&&m.has(y.furnitureId);return{...B,pin:this.showPin(B)&&!L,full:y.show==="always",caption:D}})]),t.setPickTargets(c.targets,this.openingTargets(),this.secondBlinds()),t.setScreens(c.screens),t.setFridgeDoors(ha(o,n.floors)),t.setCovers(ka(o,n)),t.setRobots(this.robotInfos(o,n));let _=new Map;for(let y of n.floors)for(let w of y.furniture)!Y(w.type)?.pet||!w.room_sensor||w.room_sensor==="none"||_.set(w.id,Ti(o,y.rooms.filter(B=>B.points.length>=3),null,w.room_sensor)?.id??null);_.size&&t.setPetRooms(_),t.setRoofWindows(Jl(o,n)),t.setParked(uo(o,n)),t.setGateStates(fc(o,n));let b=new Map(n.floors.flatMap(y=>y.openings.map(w=>[w.id,w.type]))),v=new Map([...this.openingLinks].map(([y,w])=>[y,Fe(o,w,b.get(y))]));t.setOpeningStates(v),this.setAlerts(this.alertSrc?ao(o,n,this.alertSrc,this.openingLinks):[]),this.watchLostContacts(o);let k=[...l,...c.markers].map(y=>`${y.id}:${y.glow?`${y.glow.level.toFixed(1)}/${y.glow.color.map(w=>w.toFixed(1)).join("/")}`:0}`).join(";")+"|"+[...v].map(([y,w])=>`${y}:${w.open}:${w.cover===null?"-":w.cover.toFixed(1)}`).join(";");if(k!==this.thumbSig){let y=this.thumbSig==="";this.thumbSig=k,y||this.scheduleThumbs(1500)}let S=Rc(o,n,a,n.energy.advanced?y=>this.furnitureLinks?.get(y.id)?.power??null:void 0),M=this.liveCars(o,n);for(let y of M){if(!y.car.home||!y.car.charging&&!y.car.plugged)continue;let w=n.floors.flatMap(L=>L.furniture.filter(me=>me.type==="wallbox").map(me=>({floorId:L.id,x:me.x,z:me.z,y:1}))).sort((L,me)=>Math.hypot(L.x-y.at.x,L.z-y.at.z)-Math.hypot(me.x-y.at.x,me.z-y.at.z))[0],B=w&&w.floorId===y.at.floorId&&Math.hypot(w.x-y.at.x,w.z-y.at.z)<9,D=w??$n(n);!D||!y.car.charging&&!B||S.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 T=$n(n);for(let y of this.liveHeatPumps(n)){let w=y.pump.heat??(y.pump.mode==="heating"||y.pLine truncated
<button class="nf-thumbs-fold" title=${M(this.hass,n?"thumbs_show":"thumbs_fold")} aria-label=${M(this.hass,n?"thumbs_show":"thumbs_fold")} @click=${i}>${n?"\u25B8":"\u25C2"}</button> <button class="nf-thumbs-fold" title=${A(this.hass,n?"thumbs_show":"thumbs_fold")} aria-label=${A(this.hass,n?"thumbs_show":"thumbs_fold")} @click=${i}>${n?"\u25B8":"\u25C2"}</button>
<button class="nf-thumb nf-thumb-house" aria-pressed=${this.floorId===null} @click=${()=>this.fire("floor-tap",{floorId:null})}> <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> <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>
<span>${M(this.hass,"all_floors")}</span> <span>${A(this.hass,"all_floors")}</span>
</button> </button>
${t.map(o=>p`<button class="nf-thumb" aria-pressed=${this.floorId===o.floorId} @click=${()=>this.fire("floor-tap",{floorId:o.floorId})}> ${t.map(o=>p`<button class="nf-thumb" aria-pressed=${this.floorId===o.floorId} @click=${()=>this.fire("floor-tap",{floorId:o.floorId})}>
${n?f:p`<img src=${o.url} alt="" />`} ${n?f:p`<img src=${o.url} alt="" />`}
<span>${e.get(o.floorId)??""}</span> <span>${e.get(o.floorId)??""}</span>
</button>`)} </button>`)}
</nav>`}onDeviceHold(e,t,n){let i=F(e);i==="light"||i==="cover"||i==="switch"||i==="fan"||i==="lock"?this._menu={entity:e,x:t,y:n}:be(this,e)}onDeviceSwipe(e,t,n,i,o){let s=this.hass?.states[e];if(t==="start"){if(!s||I(s)||this.confirmSet.has(e))return!1;let l=F(e);if(l==="light"&&wo(s).dim){let c=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:c,value:c,x:i,y:o},!0}if(l==="fan"&&typeof s.attributes.percentage_step=="number"){let c=s.state==="on"&&typeof s.attributes.percentage=="number"?s.attributes.percentage:0;return this._swipe={entity:e,kind:"fan",start:c,value:c,x:i,y:o},!0}if(l==="cover"&&yo(s)){let c=s.attributes.current_position;return this._swipe={entity:e,kind:"cover",start:c,value:c,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-n/220*100)));l!==a.value&&(this._swipe={...a,value:l});let c=performance.now();c-this.swipeSent>350&&(this.swipeSent=c,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,Ta(this.hass,n=>this.announce(n)).then(n=>{t?n():this.stopAnnouncements=n})}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()||!Aa(e,this.screenName)||!Ea(e))return;let n=Ra(e.message);this._announcement={message:e.message,until:Date.now()+n},clearTimeout(this.announceTimer),this.announceTimer=setTimeout(()=>this._announcement=null,n),za(this.hass,e)}renderAnnouncement(){let e=this._announcement;return e?p`<button class="nf-announcement" role="alert" title=${M(this.hass,"close")} @click=${()=>this._announcement=null}> </nav>`}onDeviceHold(e,t,n){let i=F(e);i==="light"||i==="cover"||i==="switch"||i==="fan"||i==="lock"?this._menu={entity:e,x:t,y:n}:be(this,e)}onDeviceSwipe(e,t,n,i,o){let s=this.hass?.states[e];if(t==="start"){if(!s||I(s)||this.confirmSet.has(e))return!1;let l=F(e);if(l==="light"&&Ro(s).dim){let c=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:c,value:c,x:i,y:o},!0}if(l==="fan"&&typeof s.attributes.percentage_step=="number"){let c=s.state==="on"&&typeof s.attributes.percentage=="number"?s.attributes.percentage:0;return this._swipe={entity:e,kind:"fan",start:c,value:c,x:i,y:o},!0}if(l==="cover"&&zo(s)){let c=s.attributes.current_position;return this._swipe={entity:e,kind:"cover",start:c,value:c,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-n/220*100)));l!==a.value&&(this._swipe={...a,value:l});let c=performance.now();c-this.swipeSent>350&&(this.swipeSent=c,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,Oa(this.hass,n=>this.announce(n)).then(n=>{t?n():this.stopAnnouncements=n})}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()||!Ia(e,this.screenName)||!Ca(e))return;let n=Na(e.message);this._announcement={message:e.message,until:Date.now()+n},clearTimeout(this.announceTimer),this.announceTimer=setTimeout(()=>this._announcement=null,n),Wa(this.hass,e)}renderAnnouncement(){let e=this._announcement;return e?p`<button class="nf-announcement" role="alert" title=${A(this.hass,"close")} @click=${()=>this._announcement=null}>
<span class="nf-announcement-icon" aria-hidden="true">📢</span><span class="nf-announcement-text">${e.message}</span> <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"> </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(n=>p`<button class="nf-alert nf-alert-${n.kind}" style=${n.color?`border-left-color:${n.color}`:""} title=${Xi(this.hass,e,n)} @click=${()=>this.jumpTo(n)}>${Xi(this.hass,e,n)}</button>`)} ${t.map(n=>p`<button class="nf-alert nf-alert-${n.kind}" style=${n.color?`border-left-color:${n.color}`:""} title=${lo(this.hass,e,n)} @click=${()=>this.jumpTo(n)}>${lo(this.hass,e,n)}</button>`)}
${this._alerts.length>3?p`<span class="nf-alert-more">+${this._alerts.length-3}</span>`:f} ${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),n=t?K(this.hass,t).filter(o=>F(o)==="scene"||F(o)==="script").slice(0,6):[];if(!n.length)return f;let i=t?.area_id?this.hass.areas?.[t.area_id]?.name:void 0;return p`<div class="nf-scenes"> </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),n=t?K(this.hass,t).filter(o=>F(o)==="scene"||F(o)==="script").slice(0,6):[];if(!n.length)return f;let i=t?.area_id?this.hass.areas?.[t.area_id]?.name:void 0;return p`<div class="nf-scenes">
${n.map(o=>p`<button class="nf-chip" aria-pressed=${this._sceneFired===o} @click=${()=>this.runScene(o)}>${O(this.hass,o,i)}</button>`)} ${n.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=${M(this.hass,"find")} aria-label=${M(this.hass,"find")} @click=${()=>this._find=""}> </div>`}renderFind(){let e=this.building;if(!e||!this.hass)return f;if(this._find===null)return p`<button class="nf-find-btn" title=${A(this.hass,"find")} aria-label=${A(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> <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=Pc(this.findIndex??=Hc(this.hass,e),this._find);return p`<div class="nf-find"> </button>`;let t=eu(this.findIndex??=Xc(this.hass,e),this._find);return p`<div class="nf-find">
<input <input
type="search" type="search"
placeholder=${M(this.hass,"find_placeholder")} placeholder=${A(this.hass,"find_placeholder")}
.value=${this._find} .value=${this._find}
@input=${n=>this._find=n.target.value} @input=${n=>this._find=n.target.value}
@keydown=${n=>{n.key==="Escape"&&(this._find=null),n.key==="Enter"&&t[0]&&this.goTo(t[0])}} @keydown=${n=>{n.key==="Escape"&&(this._find=null),n.key==="Enter"&&t[0]&&this.goTo(t[0])}}
/> />
<button class="nf-find-close" aria-label=${M(this.hass,"close")} @click=${()=>this._find=null}>✕</button> <button class="nf-find-close" aria-label=${A(this.hass,"close")} @click=${()=>this._find=null}>✕</button>
${this._find.trim()?p`<div class="nf-find-list"> ${this._find.trim()?p`<div class="nf-find-list">
${t.length?t.map(n=>p`<button @click=${()=>this.goTo(n)}> ${t.length?t.map(n=>p`<button @click=${()=>this.goTo(n)}>
<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=${n.icon?dr(n.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=${n.icon?pr(n.icon):"M4 10l8-6 8 6v10H4z"} /></svg></span>
<span><b>${n.name}</b>${n.where?p`<small>${n.where}</small>`:f}</span> <span><b>${n.name}</b>${n.where?p`<small>${n.where}</small>`:f}</span>
</button>`):p`<p>${M(this.hass,"find_none")}</p>`} </button>`):p`<p>${A(this.hass,"find_none")}</p>`}
</div>`:f} </div>`:f}
</div>`}renderCentral(){let e=this.building,t=this.hass;if(!e||!t||!this.central||this._find!==null)return f;let n=(b,v)=>M(t,b,v),i=p`<button </div>`}renderCentral(){let e=this.building,t=this.hass;if(!e||!t||!this.central||this._find!==null)return f;let n=(b,v)=>A(t,b,v),i=p`<button
class="nf-central-btn ${this._central?"nf-central-on":""}" class="nf-central-btn ${this._central?"nf-central-on":""}"
title=${n("central")} title=${n("central")}
aria-label=${n("central")} aria-label=${n("central")}
@@ -1611,9 +1628,9 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
@click=${()=>{this._central=!this._central,this._armed=null}} @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> <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=>Ri(t,b).lights),l=s.flatMap(b=>Ri(t,b).covers),c=a.filter(b=>t.states[b]?.state==="on").length,u=!o,h=(b,v,k,S)=>{if(S.length){if(u&&this._armed!==b){this._armed=b,clearTimeout(this.armTimer),this.armTimer=setTimeout(()=>this._armed=null,3500);return}this._armed=null,t.callService(v,k,{entity_id:S})}},m=(b,v,k,S,E)=>p`<button class="nf-btn ${this._armed===b?"nf-central-armed":""}" ?disabled=${!E.length} @click=${()=>h(b,k,S,E)}> </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=>Di(t,b).lights),l=s.flatMap(b=>Di(t,b).covers),c=a.filter(b=>t.states[b]?.state==="on").length,u=!o,d=(b,v,k,S)=>{if(S.length){if(u&&this._armed!==b){this._armed=b,clearTimeout(this.armTimer),this.armTimer=setTimeout(()=>this._armed=null,3500);return}this._armed=null,t.callService(v,k,{entity_id:S})}},m=(b,v,k,S,M)=>p`<button class="nf-btn ${this._armed===b?"nf-central-armed":""}" ?disabled=${!M.length} @click=${()=>d(b,k,S,M)}>
${this._armed===b?n("central_sure"):n(v)} ${this._armed===b?n("central_sure"):n(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} </button>`,h=e.settings.favorite_floors??{},g=(e.settings.favorites??[]).filter(b=>t.states[b]&&(!h[b]||!o||h[b]===o.id)),_=this.buttons??e.settings.buttons??[];return p`${i}
<div class="nf-central ${this.centralOpen?"nf-central-big":""}" role="dialog" aria-label=${n("central")}> <div class="nf-central ${this.centralOpen?"nf-central-big":""}" role="dialog" aria-label=${n("central")}>
<b>${o?o.name:n("central_house")}</b> <b>${o?o.name:n("central_house")}</b>
<div class="nf-central-row"> <div class="nf-central-row">
@@ -1628,9 +1645,9 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
</div>`:f} </div>`:f}
<b>${n("central_favorites")}</b> <b>${n("central_favorites")}</b>
${g.length?p`<div class="nf-central-favs"> ${g.length?p`<div class="nf-central-favs">
${g.map(b=>{let[v,k]=la(b),S=t.states[b],E=v==="homeassistant"&&S?.state==="on";return p`<button ${g.map(b=>{let[v,k]=_a(b),S=t.states[b],M=v==="homeassistant"&&S?.state==="on";return p`<button
class="nf-chip" class="nf-chip"
aria-pressed=${E||this._sceneFired===b} aria-pressed=${M||this._sceneFired===b}
?disabled=${I(S)} ?disabled=${I(S)}
@click=${()=>{t.callService(v,k,{entity_id:b}),this._sceneFired=b,setTimeout(()=>this._sceneFired=null,600)}} @click=${()=>{t.callService(v,k,{entity_id:b}),this._sceneFired=b,setTimeout(()=>this._sceneFired=null,600)}}
> >
@@ -1640,17 +1657,17 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${_.length?p`<div class="nf-central-favs"> ${_.length?p`<div class="nf-central-favs">
${_.map(b=>p`<button ${_.map(b=>p`<button
class="nf-chip nf-own-btn" class="nf-chip nf-own-btn"
aria-pressed=${ca(t,b)} aria-pressed=${ba(t,b)}
@click=${v=>{zi(t,v.currentTarget,b),b.action!=="service"&&(this._central=!1)}} @click=${v=>{Fi(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} ${b.icon?p`<ha-icon .icon=${b.icon.startsWith("mdi:")?b.icon:`mdi:${b.icon}`}></ha-icon>`:f}${b.label}
</button>`)} </button>`)}
</div>`:f} </div>`:f}
</div>`}toggleLock(){this._locked=!this._locked;try{localStorage.setItem(Zc,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(),n=t-e*36e5;this._travel={history:new Map,from:n,to:t,t:n,playing:!1,speed:e>24?3600:600,hours:e,moments:[],loading:!0};try{let i=await pn(this.hass,xl(this.watched),n,t);if(!this._travel||this._travel.from!==n)return;this._travel={...this._travel,history:i,moments:kl(i,n,t),loading:!1}}catch{this._travel=null,this._error=M(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 n=this._travel;if(!n)return;let i=n.t+250*n.speed;i>=n.to&&this.playTravel(!1),this.travelTo(i)},250)))}renderTravel(){if(!this.hass||this.clean)return f;let e=a=>M(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 n=this.hass.language??navigator.language,i=new Intl.DateTimeFormat(n,{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(pu,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(),n=t-e*36e5;this._travel={history:new Map,from:n,to:t,t:n,playing:!1,speed:e>24?3600:600,hours:e,moments:[],loading:!0};try{let i=await _n(this.hass,Ll(this.watched),n,t);if(!this._travel||this._travel.from!==n)return;this._travel={...this._travel,history:i,moments:Bl(i,n,t),loading:!1}}catch{this._travel=null,this._error=A(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 n=this._travel;if(!n)return;let i=n.t+250*n.speed;i>=n.to&&this.playTravel(!1),this.travelTo(i)},250)))}renderTravel(){if(!this.hass||this.clean)return f;let e=a=>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 n=this.hass.language??navigator.language,i=new Intl.DateTimeFormat(n,{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> <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> <b class="nf-travel-when">${t.loading?e("travel_loading"):i}</b>
<div class="nf-travel-track"> <div class="nf-travel-track">
<svg viewBox="0 0 1000 10" preserveAspectRatio="none" aria-hidden="true">${t.moments.map(a=>ee`<rect x=${(a-t.from)/o*1e3} y="0" width="1.6" height="10" />`)}</svg> <svg viewBox="0 0 1000 10" preserveAspectRatio="none" aria-hidden="true">${t.moments.map(a=>te`<rect x=${(a-t.from)/o*1e3} y="0" width="1.6" height="10" />`)}</svg>
<input type="range" min=${t.from} max=${t.to} step="60000" .value=${String(t.t)} ?disabled=${t.loading} aria-label=${e("travel")} @input=${a=>this.travelTo(Number(a.target.value))} /> <input type="range" min=${t.from} max=${t.to} step="60000" .value=${String(t.t)} ?disabled=${t.loading} aria-label=${e("travel")} @input=${a=>this.travelTo(Number(a.target.value))} />
</div> </div>
<select aria-label=${e("travel_speed")} @change=${a=>this._travel={...t,speed:Number(a.target.value)}}> <select aria-label=${e("travel_speed")} @change=${a=>this._travel={...t,speed:Number(a.target.value)}}>
@@ -1659,32 +1676,32 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
<button class="nf-travel-span" aria-pressed=${t.hours===24} @click=${()=>{this.openTravel(24)}}>24 h</button> <button class="nf-travel-span" aria-pressed=${t.hours===24} @click=${()=>{this.openTravel(24)}}>24 h</button>
<button class="nf-travel-span" aria-pressed=${t.hours===168} @click=${()=>{this.openTravel(168)}}>7 ${e("travel_days")}</button> <button class="nf-travel-span" aria-pressed=${t.hours===168} @click=${()=>{this.openTravel(168)}}>7 ${e("travel_days")}</button>
<button class="nf-travel-live" @click=${()=>{this.openTravel(null)}}>● ${e("travel_live")}</button> <button class="nf-travel-live" @click=${()=>{this.openTravel(null)}}>● ${e("travel_live")}</button>
</div>`}toggleWalk(){let e=this.viewer;e&&(this._walking?(e.stopWalk(),this._walking=!1):this._walking=e.startWalk()!==null,this._stick=null)}stickMove(e,t=!1){let n=e.currentTarget;if(t)n.setPointerCapture(e.pointerId);else if(!this._stick)return;let i=n.getBoundingClientRect(),o=i.width/2,[s,a]=[(e.clientX-i.left-o)/o,(e.clientY-i.top-o)/o],l=Math.hypot(s,a);l>1&&([s,a]=[s/l,a/l]),this._stick=[s,a],this.viewer?.setWalkStick(Math.abs(s)<.12?0:s,Math.abs(a)<.12?0:a)}stickEnd(){this._stick=null,this.viewer?.setWalkStick(0,0)}renderWalk(){if(!this.hass||this.clean||!this.walkButton&&!this._walking)return f;let e=n=>M(this.hass,n),t=this._stick??[0,0];return p`<button class="nf-walk-btn ${this._walking?"nf-walk-on":""}" title=${e(this._walking?"walk_stop":"walk")} aria-label=${e(this._walking?"walk_stop":"walk")} aria-pressed=${this._walking} @click=${()=>this.toggleWalk()}> </div>`}toggleWalk(){let e=this.viewer;e&&(this._walking?(e.stopWalk(),this._walking=!1):this._walking=e.startWalk()!==null,this._stick=null)}stickMove(e,t=!1){let n=e.currentTarget;if(t)n.setPointerCapture(e.pointerId);else if(!this._stick)return;let i=n.getBoundingClientRect(),o=i.width/2,[s,a]=[(e.clientX-i.left-o)/o,(e.clientY-i.top-o)/o],l=Math.hypot(s,a);l>1&&([s,a]=[s/l,a/l]),this._stick=[s,a],this.viewer?.setWalkStick(Math.abs(s)<.12?0:s,Math.abs(a)<.12?0:a)}stickEnd(){this._stick=null,this.viewer?.setWalkStick(0,0)}renderWalk(){if(!this.hass||this.clean||!this.walkButton&&!this._walking)return f;let e=n=>A(this.hass,n),t=this._stick??[0,0];return p`<button class="nf-walk-btn ${this._walking?"nf-walk-on":""}" title=${e(this._walking?"walk_stop":"walk")} aria-label=${e(this._walking?"walk_stop":"walk")} aria-pressed=${this._walking} @click=${()=>this.toggleWalk()}>
${this._walking?"\u2715":ee`<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="13" cy="4" r="2" /><path d="M10 21l2-6 3 3v5M9 12l1-4 4 1 3 3M8 9l-2 4" /></svg>`} ${this._walking?"\u2715":te`<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="13" cy="4" r="2" /><path d="M10 21l2-6 3 3v5M9 12l1-4 4 1 3 3M8 9l-2 4" /></svg>`}
</button> </button>
${this._walking?p`<div class="nf-stick" @pointerdown=${n=>this.stickMove(n,!0)} @pointermove=${n=>this.stickMove(n)} @pointerup=${()=>this.stickEnd()} @pointercancel=${()=>this.stickEnd()}> ${this._walking?p`<div class="nf-stick" @pointerdown=${n=>this.stickMove(n,!0)} @pointermove=${n=>this.stickMove(n)} @pointerup=${()=>this.stickEnd()} @pointercancel=${()=>this.stickEnd()}>
<span style="transform:translate(${t[0]*34}px, ${t[1]*34}px)"></span> <span style="transform:translate(${t[0]*34}px, ${t[1]*34}px)"></span>
</div> </div>
<p class="nf-walk-hint">${e("walk_hint")}</p>`:f}`}renderLock(){if(!this.lockButton||!this.hass||this.clean)return f;let e=M(this.hass,this._locked?"lock3d_off":"lock3d_on");return p`<button class="nf-lock3d ${this._locked?"nf-lock3d-on":""}" title=${e} aria-label=${e} aria-pressed=${this._locked} @click=${()=>this.toggleLock()}> <p class="nf-walk-hint">${e("walk_hint")}</p>`:f}`}renderLock(){if(!this.lockButton||!this.hass||this.clean)return f;let e=A(this.hass,this._locked?"lock3d_off":"lock3d_on");return p`<button class="nf-lock3d ${this._locked?"nf-lock3d-on":""}" title=${e} aria-label=${e} aria-pressed=${this._locked} @click=${()=>this.toggleLock()}>
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="5" y="11" width="14" height="9" rx="2" /> <rect x="5" y="11" width="14" height="9" rx="2" />
${this._locked?ee`<path d="M8 11V8a4 4 0 0 1 8 0v3" />`:ee`<path d="M8 11V8a4 4 0 0 1 7.5-2" />`} ${this._locked?te`<path d="M8 11V8a4 4 0 0 1 8 0v3" />`:te`<path d="M8 11V8a4 4 0 0 1 7.5-2" />`}
</svg> </svg>
</button>`}renderClock(e=!1){if(!this.clock||!this.hass||this.clock==="top_left"&&!e)return f;let t=this.hass.language??navigator.language,n=new Date(this._now),i=new Intl.DateTimeFormat(t,{hour:"2-digit",minute:"2-digit"}).format(n),o=new Intl.DateTimeFormat(t,{weekday:"long",day:"numeric",month:"long"}).format(n);return p`<div class="nf-clock nf-clock-${this.clock}" aria-hidden="true"><b>${i}</b><span>${o}</span></div>`}renderEye(){if(!this.cleanButton||!this.hass||this._find!==null&&!this.clean)return f;let e=M(this.hass,this.clean?"controls_show":"controls_hide");return p`<button </button>`}renderClock(e=!1){if(!this.clock||!this.hass||this.clock==="top_left"&&!e)return f;let t=this.hass.language??navigator.language,n=new Date(this._now),i=new Intl.DateTimeFormat(t,{hour:"2-digit",minute:"2-digit"}).format(n),o=new Intl.DateTimeFormat(t,{weekday:"long",day:"numeric",month:"long"}).format(n);return p`<div class="nf-clock nf-clock-${this.clock}" aria-hidden="true"><b>${i}</b><span>${o}</span></div>`}renderEye(){if(!this.cleanButton||!this.hass||this._find!==null&&!this.clean)return f;let e=A(this.hass,this.clean?"controls_show":"controls_hide");return p`<button
class="nf-eye ${this.clean?"nf-eye-clean":""}" class="nf-eye ${this.clean?"nf-eye-clean":""}"
title=${e} title=${e}
aria-label=${e} aria-label=${e}
aria-pressed=${this.clean} aria-pressed=${this.clean}
@click=${()=>this.dispatchEvent(new CustomEvent("clean-toggle",{bubbles:!0,composed:!0}))} @click=${()=>this.dispatchEvent(new CustomEvent("clean-toggle",{bubbles:!0,composed:!0}))}
> >
${this.clean?ee`<svg viewBox="0 0 24 24" width="20" height="20"><path fill="currentColor" d="M12 6a9.8 9.8 0 0 1 9 6 9.8 9.8 0 0 1-9 6 9.8 9.8 0 0 1-9-6 9.8 9.8 0 0 1 9-6m0 2a4 4 0 1 0 0 8 4 4 0 0 0 0-8m0 2a2 2 0 1 1 0 4 2 2 0 0 1 0-4" /></svg>`:ee`<svg viewBox="0 0 24 24" width="20" height="20"><path fill="currentColor" d="M2.4 3.8 3.8 2.4l17.8 17.8-1.4 1.4-3.3-3.3A10.5 10.5 0 0 1 12 19a9.8 9.8 0 0 1-9-6 10.3 10.3 0 0 1 3.6-4.3L2.4 3.8M12 7a4 4 0 0 1 4 4c0 .5-.1 1-.3 1.5l-5.2-5.2c.5-.2 1-.3 1.5-.3m-4 4a4 4 0 0 0 5.5 3.7l-5.2-5.2c-.2.5-.3 1-.3 1.5m4-7a9.8 9.8 0 0 1 9 6 10 10 0 0 1-2.6 3.6l-1.4-1.4A8 8 0 0 0 18.8 12 8 8 0 0 0 9.6 7.2L8 5.6A10.3 10.3 0 0 1 12 4" /></svg>`} ${this.clean?te`<svg viewBox="0 0 24 24" width="20" height="20"><path fill="currentColor" d="M12 6a9.8 9.8 0 0 1 9 6 9.8 9.8 0 0 1-9 6 9.8 9.8 0 0 1-9-6 9.8 9.8 0 0 1 9-6m0 2a4 4 0 1 0 0 8 4 4 0 0 0 0-8m0 2a2 2 0 1 1 0 4 2 2 0 0 1 0-4" /></svg>`:te`<svg viewBox="0 0 24 24" width="20" height="20"><path fill="currentColor" d="M2.4 3.8 3.8 2.4l17.8 17.8-1.4 1.4-3.3-3.3A10.5 10.5 0 0 1 12 19a9.8 9.8 0 0 1-9-6 10.3 10.3 0 0 1 3.6-4.3L2.4 3.8M12 7a4 4 0 0 1 4 4c0 .5-.1 1-.3 1.5l-5.2-5.2c.5-.2 1-.3 1.5-.3m-4 4a4 4 0 0 0 5.5 3.7l-5.2-5.2c-.2.5-.3 1-.3 1.5m4-7a9.8 9.8 0 0 1 9 6 10 10 0 0 1-2.6 3.6l-1.4-1.4A8 8 0 0 0 18.8 12 8 8 0 0 0 9.6 7.2L8 5.6A10.3 10.3 0 0 1 12 4" /></svg>`}
</button>`}renderSwipe(){let e=this._swipe;if(!e||!this.hass)return f;let t=e.kind==="light"&&e.value<=0;return p`<div class="nf-swipe" style="left:${e.x}px;top:${e.y}px"> </button>`}renderSwipe(){let e=this._swipe;if(!e||!this.hass)return f;let t=e.kind==="light"&&e.value<=0;return p`<div class="nf-swipe" style="left:${e.x}px;top:${e.y}px">
<span>${O(this.hass,e.entity)}</span> <span>${O(this.hass,e.entity)}</span>
<b>${t?M(this.hass,"swipe_off"):`${e.value} %`}</b> <b>${t?A(this.hass,"swipe_off"):`${e.value} %`}</b>
<i><em style="height:${e.value}%"></em></i> <i><em style="height:${e.value}%"></em></i>
</div>`}tapPlate(e,t,n){let i=this.building?.floors.flatMap(s=>s.furniture).find(s=>s.id===e),o=i?Ti(i.gang_entities,Z(i.type)?.gangs??0):[];if(o.length===1)return this.onDeviceTap(o[0],t,n);o.length>1&&(this._plate={ids:o,x:t,y:n})}renderPlate(){let e=this._plate;if(!e||!this.hass)return f;let t=this.hass,n=()=>this._plate=null;return p`<div class="nf-menu-backdrop" @click=${n}></div> </div>`}tapPlate(e,t,n){let i=this.building?.floors.flatMap(s=>s.furniture).find(s=>s.id===e),o=i?Hi(i.gang_entities,Y(i.type)?.gangs??0):[];if(o.length===1)return this.onDeviceTap(o[0],t,n);o.length>1&&(this._plate={ids:o,x:t,y:n})}renderPlate(){let e=this._plate;if(!e||!this.hass)return f;let t=this.hass,n=()=>this._plate=null;return p`<div class="nf-menu-backdrop" @click=${n}></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"> <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=Q(s)||s?.state==="on";return p`<button role="menuitem" class=${a?"on":""} @click=${()=>{n(),this.onDeviceTap(i,e.x,e.y)}}><b>${o+1}</b><span>${O(t,i)}</span><i>${s?ie(t,s):"\u2013"}</i></button>`})} ${e.ids.map((i,o)=>{let s=t.states[i],a=ee(s)||s?.state==="on";return p`<button role="menuitem" class=${a?"on":""} @click=${()=>{n(),this.onDeviceTap(i,e.x,e.y)}}><b>${o+1}</b><span>${O(t,i)}</span><i>${s?ie(t,s):"\u2013"}</i></button>`})}
</div>`}renderMenu(){let e=this._menu;if(!e||!this.hass)return f;let t=this.renderRoot.querySelector(".nf-stage"),n=t?.clientWidth??800,i=t?.clientHeight??600,o=Math.max(8,Math.min(n-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> </div>`}renderMenu(){let e=this._menu;if(!e||!this.hass)return f;let t=this.renderRoot.querySelector(".nf-stage"),n=t?.clientWidth??800,i=t?.clientHeight??600,o=Math.max(8,Math.min(n-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>
<nf-quick-menu <nf-quick-menu
style="left:${o}px;top:${s}px" style="left:${o}px;top:${s}px"
@@ -1695,28 +1712,28 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.presets=${(this.building?.settings.media_presets??[]).filter(a=>!a.speakers?.length||a.speakers.includes(e.entity))} .presets=${(this.building?.settings.media_presets??[]).filter(a=>!a.speakers?.length||a.speakers.includes(e.entity))}
?confirmSwitch=${this.confirmSet.has(e.entity)} ?confirmSwitch=${this.confirmSet.has(e.entity)}
.myPosition=${this.myPositionOf(e.entity)} .myPosition=${this.myPositionOf(e.entity)}
.tiltEntity=${ar(this.hass,this.building?.floors??[],e.entity)} .tiltEntity=${ur(this.hass,this.building?.floors??[],e.entity)}
@close=${()=>this._menu=null} @close=${()=>this._menu=null}
></nf-quick-menu>`}myPositionOf(e){for(let t of this.building?.floors??[])for(let n of t.openings){let i=this.openingLinks?.get(n.id);if(n.my_position!=null&&(i?.cover===e||i?.cover2===e))return n.my_position}return null}onDeviceTap(e,t=0,n=0){if(e.startsWith("lamp:")||this._travel)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,n);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??Ce(s,l=>this.furnitureLinks?.get(l.id)?.power??null).grid:null;a&&be(this,a);return}let o=F(e);if(o==="cover"||o==="media"){this._menu={entity:e,x:t,y:n};return}if(o==="lock"){let s=Mi(this.hass,e),a=O(this.hass,e);confirm(M(this.hass,s?"lock_confirm_lock":"lock_confirm_unlock",{name:a}))&&this.hass.callService("lock",s?"lock":"unlock",{entity_id:e});return}if(o&&Ps.has(o)){if(this.confirmSet.has(e)&&!confirm(M(this.hass,"confirm_switch",{name:O(this.hass,e)})))return;Sa(this.hass,e)}else be(this,e)}pluginTapped(e){let t=this.hass?.states[e],n=this.placementInfo.get(e);if(!t||!n)return!1;let i=this.building?.floors.find(o=>o.id===n.floorId)?.placements.find(o=>o.entity_id===e);return ps({hass:this.hass,entityId:e,state:t},n,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=>be(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 n of t.openings){let i=this.openingLinks?.get(n.id);if(n.my_position!=null&&(i?.cover===e||i?.cover2===e))return n.my_position}return null}onDeviceTap(e,t=0,n=0){if(e.startsWith("lamp:")||this._travel)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&&Fi(this.hass,this,s.tap);return}if(this.pluginTapped(e))return;if(e.startsWith("gang:"))return this.tapPlate(e.slice(5),t,n);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??Ne(s,l=>this.furnitureLinks?.get(l.id)?.power??null).grid:null;a&&be(this,a);return}let o=F(e);if(o==="cover"||o==="media"){this._menu={entity:e,x:t,y:n};return}if(o==="lock"){let s=Ri(this.hass,e),a=O(this.hass,e);confirm(A(this.hass,s?"lock_confirm_lock":"lock_confirm_unlock",{name:a}))&&this.hass.callService("lock",s?"lock":"unlock",{entity_id:e});return}if(o&&Ks.has(o)){if(this.confirmSet.has(e)&&!confirm(A(this.hass,"confirm_switch",{name:O(this.hass,e)})))return;Fa(this.hass,e)}else be(this,e)}pluginTapped(e){let t=this.hass?.states[e],n=this.placementInfo.get(e);if(!t||!n)return!1;let i=this.building?.floors.find(o=>o.id===n.floorId)?.placements.find(o=>o.entity_id===e);return ks({hass:this.hass,entityId:e,state:t},n,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=>be(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=${M(this.hass,"close")} @click=${()=>this._pluginWindow=null}>✕</button></div> <div class="nf-pw-head"><span>${e.title}</span><button class="nf-pw-close" aria-label=${A(this.hass,"close")} @click=${()=>this._pluginWindow=null}>✕</button></div>
<div class="nf-pw-body">${e.node}</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 n=[];for(let i of e.floors)for(let o of i.furniture){if(!kc(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=xc(t,s?.entity??s?.power??null);a&&n.push({id:o.id,name:o.name||fe(t,o.type),floorId:i.id,x:o.x,z:o.z,at:{floorId:i.id,x:o.x,z:o.z,y:de(i,o)+o.h+.5},pump:a})}return n}livePrinters(e){let t=this.hass,n=[];if(!t)return n;for(let i of e.floors)for(let o of i.furniture){if(!fo(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=po(t,s?.entity??s?.power??null);!a||!a.printing&&!/pause|finish|complete|error/.test(a.status)||n.push({id:o.id,name:o.name||fe(t,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:de(i,o)+o.h+.5},printer:a})}return n}liveCars(e,t){let n=[];for(let i of t.floors)for(let o of i.furniture){if(o.type!=="parking")continue;let s=Ec(e,o);if(!s||s.soc===null&&s.range===null&&s.locked===null&&s.climateOn===null)continue;let a=eo(e,o),l=a?Vl(o,a):null,c=o.name||(a?fe(e,a):fe(e,o.type));n.push({spot:o.id,name:c,at:{floorId:i.id,x:o.x,z:o.z,y:de(i,o)+(l?.h??.2)+.6},car:s})}return n}liveMedia(e,t){let n=[];for(let i of t.floors){for(let o of i.furniture){let s=this.furnitureLinks?.get(o.id)?.entity;s?.startsWith("media_player.")&&n.push({entity:s,name:o.name||fe(e,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:de(i,o)+o.h+.15},rings:o.sound_rings})}for(let o of i.placements)o.entity_id.startsWith("media_player.")&&n.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 El(e,n)}refreshToday(e){let t=this.hass,n=e.settings.calendars??[],i=Math.max(1,Math.min(7,e.settings.today_days??1)),o=`${new Date().toDateString()}|${i}`;!t||!n.length||Date.now()-this.todayAt<9e5&&o===this.todayDay||(this.todayAt=Date.now(),this.todayDay=o,_c(t,n,i).then(s=>this._todayItems=s))}refreshForecast(e){let t=this.hass,n=e.settings.forecast&&t?Qe(t,this.weatherEntityId??e.settings.weather_entity):null;if(!t||!n)return;let i=`${n}|${new Date().toDateString()}`;Date.now()-this.forecastAt<18e5&&i===this.forecastKey||(this.forecastAt=Date.now(),this.forecastKey=i,wc(t,n).then(o=>this._forecast=o))}renderForecast(e){let t=this.building,n=this.hass,i=t?.settings.forecast;if(!t||!n||!i||i.corner!==e||this.clean)return f;if(e==="top_right"&&(this.roomId||this.panelOpen))return f;let o=vc(this._forecast,Math.max(1,Math.min(7,i.days)));if(!o.length)return f;let s=Qe(n,this.weatherEntityId??t.settings.weather_entity),a=s?n.states[s]?.attributes:void 0,l=String(a?.temperature_unit??"\xB0"),c=String(a?.precipitation_unit??"mm"),u=n.language??navigator.language,h=new Intl.DateTimeFormat(u,{weekday:"short"}),m=d=>d===null?"\u2013":`${Math.round(d)}\xB0`;return p`<section class="nf-forecast" aria-label=${M(n,"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 n=[];for(let i of e.floors)for(let o of i.furniture){if(!Bc(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=Lc(t,s?.entity??s?.power??null);a&&n.push({id:o.id,name:o.name||fe(t,o.type),floorId:i.id,x:o.x,z:o.z,at:{floorId:i.id,x:o.x,z:o.z,y:de(i,o)+o.h+.5},pump:a})}return n}livePrinters(e){let t=this.hass,n=[];if(!t)return n;for(let i of e.floors)for(let o of i.furniture){if(!So(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)||n.push({id:o.id,name:o.name||fe(t,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:de(i,o)+o.h+.5},printer:a})}return n}liveCars(e,t){let n=[];for(let i of t.floors)for(let o of i.furniture){if(o.type!=="parking")continue;let s=jc(e,o);if(!s||s.soc===null&&s.range===null&&s.locked===null&&s.climateOn===null)continue;let a=co(e,o),l=a?lc(o,a):null,c=o.name||(a?fe(e,a):fe(e,o.type));n.push({spot:o.id,name:c,at:{floorId:i.id,x:o.x,z:o.z,y:de(i,o)+(l?.h??.2)+.6},car:s})}return n}liveMedia(e,t){let n=[];for(let i of t.floors){for(let o of i.furniture){let s=this.furnitureLinks?.get(o.id)?.entity;s?.startsWith("media_player.")&&n.push({entity:s,name:o.name||fe(e,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:de(i,o)+o.h+.15},rings:o.sound_rings})}for(let o of i.placements)o.entity_id.startsWith("media_player.")&&n.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 jl(e,n)}refreshToday(e){let t=this.hass,n=e.settings.calendars??[],i=Math.max(1,Math.min(7,e.settings.today_days??1)),o=`${new Date().toDateString()}|${i}`;!t||!n.length||Date.now()-this.todayAt<9e5&&o===this.todayDay||(this.todayAt=Date.now(),this.todayDay=o,Ic(t,n,i).then(s=>this._todayItems=s))}refreshForecast(e){let t=this.hass,n=e.settings.forecast&&t?Xe(t,this.weatherEntityId??e.settings.weather_entity):null;if(!t||!n)return;let i=`${n}|${new Date().toDateString()}`;Date.now()-this.forecastAt<18e5&&i===this.forecastKey||(this.forecastAt=Date.now(),this.forecastKey=i,Wc(t,n).then(o=>this._forecast=o))}renderForecast(e){let t=this.building,n=this.hass,i=t?.settings.forecast;if(!t||!n||!i||i.corner!==e||this.clean)return f;if(e==="top_right"&&(this.roomId||this.panelOpen))return f;let o=Nc(this._forecast,Math.max(1,Math.min(7,i.days)));if(!o.length)return f;let s=Xe(n,this.weatherEntityId??t.settings.weather_entity),a=s?n.states[s]?.attributes:void 0,l=String(a?.temperature_unit??"\xB0"),c=String(a?.precipitation_unit??"mm"),u=n.language??navigator.language,d=new Intl.DateTimeFormat(u,{weekday:"short"}),m=h=>h===null?"\u2013":`${Math.round(h)}\xB0`;return p`<section class="nf-forecast" aria-label=${A(n,"forecast")}>
<ul> <ul>
${o.map((d,g)=>p`<li> ${o.map((h,g)=>p`<li>
<span class="nf-fc-day">${g===0?M(n,"today"):h.format(new Date(d.day))}</span> <span class="nf-fc-day">${g===0?A(n,"today"):d.format(new Date(h.day))}</span>
<span class="nf-fc-icon" aria-hidden="true">${d.icon}</span> <span class="nf-fc-icon" aria-hidden="true">${h.icon}</span>
<span class="nf-fc-temp" title=${l}><b>${m(d.high)}</b> <small>${m(d.low)}</small></span> <span class="nf-fc-temp" title=${l}><b>${m(h.high)}</b> <small>${m(h.low)}</small></span>
<span class="nf-fc-rain">${d.rain!==null&&d.rain>0?`\u{1F4A7}${d.rain.toLocaleString(u,{maximumFractionDigits:1})} ${c}`:d.chance!==null&&d.chance>0?`\u{1F4A7}${Math.round(d.chance)} %`:""}</span> <span class="nf-fc-rain">${h.rain!==null&&h.rain>0?`\u{1F4A7}${h.rain.toLocaleString(u,{maximumFractionDigits:1})} ${c}`:h.chance!==null&&h.chance>0?`\u{1F4A7}${Math.round(h.chance)} %`:""}</span>
</li>`)} </li>`)}
</ul> </ul>
</section>`}renderToday(){let e=this.building,t=this.hass;if(!e||!t||this.clean||this.roomId||this.panelOpen)return f;let n=this.renderForecast("top_right"),i=this.today===!1?f:this.renderTodayCard(e,t);return i===f&&n===f?f:p`<div class="nf-right-col" style=${this.clock==="top_right"?"top: 78px":""}>${i}${n}</div>`}renderTodayCard(e,t){let n=fc(t,e,Date.now(),{today:M(t,"care_bin_today"),tomorrow:M(t,"care_bin_tomorrow")}),i=gc([...n,...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=u=>{if(u===1)return M(t,"tomorrow");let h=new Date;return h.setDate(h.getDate()+u),new Intl.DateTimeFormat(a,{weekday:"long",day:"numeric",month:"numeric"}).format(h)},c=i.flatMap((u,h)=>[(u.day??0)>0&&(i[h-1]?.day??0)!==u.day?p`<li class="nf-today-day">${l(u.day??0)}</li>`:f,p`<li class=${u.past?"nf-today-past":""}><time>${u.kind==="bin"?"\u{1F5D1}":u.time||"\u25CF"}</time><span>${u.title}<small>${u.source}</small></span></li>`]);return p`<section class="nf-today ${o?"":"nf-today-folded"}" aria-label=${M(t,"today")}> </section>`}renderToday(){let e=this.building,t=this.hass;if(!e||!t||this.clean||this.roomId||this.panelOpen)return f;let n=this.renderForecast("top_right"),i=this.today===!1?f:this.renderTodayCard(e,t);return i===f&&n===f?f:p`<div class="nf-right-col" style=${this.clock==="top_right"?"top: 78px":""}>${i}${n}</div>`}renderTodayCard(e,t){let n=Hc(t,e,Date.now(),{today:A(t,"care_bin_today"),tomorrow:A(t,"care_bin_tomorrow")}),i=Pc([...n,...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=u=>{if(u===1)return A(t,"tomorrow");let d=new Date;return d.setDate(d.getDate()+u),new Intl.DateTimeFormat(a,{weekday:"long",day:"numeric",month:"numeric"}).format(d)},c=i.flatMap((u,d)=>[(u.day??0)>0&&(i[d-1]?.day??0)!==u.day?p`<li class="nf-today-day">${l(u.day??0)}</li>`:f,p`<li class=${u.past?"nf-today-past":""}><time>${u.kind==="bin"?"\u{1F5D1}":u.time||"\u25CF"}</time><span>${u.title}<small>${u.source}</small></span></li>`]);return p`<section class="nf-today ${o?"":"nf-today-folded"}" aria-label=${A(t,"today")}>
<button class="nf-today-head" aria-expanded=${o} @click=${()=>this._todayOpen=!o}> <button class="nf-today-head" aria-expanded=${o} @click=${()=>this._todayOpen=!o}>
<b>📅 ${M(t,"today")}</b><span>${s}</span> <b>📅 ${A(t,"today")}</b><span>${s}</span>
</button> </button>
${o?i.length?p`<ul> ${o?i.length?p`<ul>
${c} ${c}
</ul>`:p`<p class="nf-today-none">${M(t,"today_none")}</p>`:f} </ul>`:p`<p class="nf-today-none">${A(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 n=Ce(e,s=>this.furnitureLinks?.get(s.id)?.power??null),i=e.energy,o={solar:i.solar?[i.solar]:n.solar,grid:i.grid??n.grid,gridInvert:!!i.grid_invert,battery:i.battery?[i.battery]:n.battery,batteryInvert:!!i.battery_invert,consumption:i.consumption};cl(t,o).then(s=>{this.week=s,this.syncDevices(!0)}).catch(()=>this.week=null)}meterRows(e,t=null){let n=this.hass,i=[],o=this.floorId?e.floors.find(a=>a.id===this.floorId):void 0,s=o?.power_entity?q(n?.states[o.power_entity]):null;if(o&&s!==null){let a=t&&t>0?` \xB7 ${M(n,"floor_power_share",{n:Math.round(Math.max(0,s)/t*100)})}`:"";i.push({icon:"\u26A1",label:o.name,value:`${ht(n,s)}${a}`})}for(let[a,l,c]of[["gas","\u{1F525}","energy_gas_short"],["water","\u{1F4A7}","energy_water_short"]]){let u=e.energy[a],h=u?n?.states[u]:void 0;h&&!I(h)&&i.push({icon:l,label:M(n,c),value:ie(n,h)})}return i}refreshDayCurves(e){let t=this.hass;if(!t||this._travel||Date.now()-this.curvesAt<6e5)return;this.curvesAt=Date.now();let n=a=>dn(a,e,un(a,e),Ce(e,l=>this.furnitureLinks?.get(l.id)?.power??null)),i=Sl(t,n),o=Date.now(),s=o-24*36e5;pn(t,i,s,o,!0).then(a=>{this.dayCurves=$l(t,a,s,o,n),this.syncDevices(!0)}).catch(()=>this.dayCurves=null)}syncLhCards(e,t,n,i,o,s){let a=[],l=n.summary,c=l.solar!==null||l.grid!==null||l.battery!==null||l.consumption!==null,u=xn(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&&c&&u&&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:u.x,z:g?d/g:u.z,y:h.height+(this.floorId?1.2:3.2)},summary:l,autarky:n.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})}this.liveCardsOn&&!this.dimmed&&a.push(...dc(s,t,this.floorId,this.roomId)),JSON.stringify(a)!==JSON.stringify(this._liveCards)&&(this._liveCards=a),e.setLiveAnchors(a.map(m=>m.at),a.length?(m,d,g,_)=>this.placeLhCard(m,d,g,_):null)}placeLhCard(e,t,n,i){let o=this.renderRoot.querySelector(`.live-card[data-i="${e}"]`);o&&(o.dataset.x=String(t),o.dataset.y=String(n),o.style.visibility=i?"visible":"hidden",e===this._liveCards.length-1&&zc(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>`}renderLhEnergy(){let e=this.ownSensors(),t=this._liveEnergy?.summary,n=!!t&&!this.roomId&&this.showEnergy&&!!this.hass&&!(t.consumption===null&&t.grid===null&&t.solar===null&&t.battery===null),o=this.building?.floors.some(c=>c.rooms.some(u=>u.climate_card))?this.renderCardToggle():f,s=this.roomNamesButton?p`<button class="nf-energy-item nf-flow-toggle nf-room-names-toggle" aria-pressed=${this.roomLabels} title=${M(this.hass,"room_names_toggle_hint")} @click=${()=>{this.roomLabels=!this.roomLabels,this.dispatchEvent(new CustomEvent("room-names-change",{detail:{value:this.roomLabels},bubbles:!0,composed:!0}))}}><span>${M(this.hass,"room_names_short")}</span><b aria-hidden="true">Aa</b></button>`:f;if(!n)return e.length||o!==f||s!==f?p`<div class="nf-energy" aria-live="off">${s}${e}${o}</div>`:f;let a=c=>M(this.hass,c),l=[];if(t.solar!==null&&l.push({cls:"solar",label:a("energy_solar"),value:ce(this.hass,t.solar)}),t.consumption!==null&&l.push({cls:"total",label:a("energy_consumption"),value:ce(this.hass,t.consumption)}),t.rest!==void 0&&t.rest!==null&&l.push({cls:"total",label:a("energy_rest"),value:ce(this.hass,t.rest)}),t.battery!==null||t.soc!==null){let c=[t.battery!==null?ce(this.hass,Math.abs(t.battery)):null,t.soc!==null?`${Math.round(t.soc)} %`:null].filter(Boolean);l.push({cls:"battery",label:a("energy_battery"),value:c.join(" \xB7 ")})}if(t.grid!==null){let c=t.grid<0;l.push({cls:c?"export":"grid",label:a(c?"energy_grid_export":"energy_grid_import"),value:ce(this.hass,Math.abs(t.grid))})}if(t.tariff&&l.push({cls:"tariff",label:a("energy_tariff"),value:`${W(this.hass,t.tariff.value,3)} ${t.tariff.unit}`.trim()}),thiLine 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 n=Ne(e,s=>this.furnitureLinks?.get(s.id)?.power??null),i=e.energy,o={solar:i.solar?[i.solar]:n.solar,grid:i.grid??n.grid,gridInvert:!!i.grid_invert,battery:i.battery?[i.battery]:n.battery,batteryInvert:!!i.battery_invert,consumption:i.consumption};El(t,o).then(s=>{this.week=s,this.syncDevices(!0)}).catch(()=>this.week=null)}meterRows(e,t=null){let n=this.hass,i=[],o=this.floorId?e.floors.find(a=>a.id===this.floorId):void 0,s=o&&U(n)?cn(n,o,e.floors.flatMap(a=>a.rooms)).find(a=>a.kind==="electricity"&&a.metric==="power"&&a.unit==="W")?.value??null:o?.power_entity?Z(n?.states[o.power_entity]):null;if(o&&s!==null){let a=t&&t>0?` \xB7 ${A(n,"floor_power_share",{n:Math.round(Math.max(0,s)/t*100)})}`:"";i.push({icon:"\u26A1",label:o.name,value:`${mt(n,s)}${a}`})}for(let[a,l,c]of[["gas","\u{1F525}","energy_gas_short"],["water","\u{1F4A7}","energy_water_short"]]){let u=e.energy[a],d=u?n?.states[u]:void 0;d&&!I(d)&&i.push({icon:l,label:A(n,c),value:ie(n,d)})}return i}refreshDayCurves(e){let t=this.hass;if(!t||this._travel||Date.now()-this.curvesAt<6e5)return;this.curvesAt=Date.now();let n=a=>pn(a,e,mn(a,e),Ne(e,l=>this.furnitureLinks?.get(l.id)?.power??null)),i=Vl(t,n),o=Date.now(),s=o-24*36e5;_n(t,i,s,o,!0).then(a=>{this.dayCurves=Kl(t,a,s,o,n),this.syncDevices(!0)}).catch(()=>this.dayCurves=null)}syncLhCards(e,t,n,i,o,s){let a=[],l=n.summary,c=l.solar!==null||l.grid!==null||l.battery!==null||l.consumption!==null,u=$n(t),d=(this.floorId?t.floors.find(m=>m.id===this.floorId):void 0)??[...t.floors].sort((m,h)=>h.elevation-m.elevation)[0];if(this.liveCardsOn&&!this.dimmed&&!this.roomId&&c&&u&&d){let m=0,h=0,g=0;for(let _ of d.rooms)for(let[b,v]of _.points)m+=b,h+=v,g++;a.push({kind:"house",at:{floorId:d.id,x:g?m/g:u.x,z:g?h/g:u.z,y:d.height+(this.floorId?1.2:3.2)},summary:l,autarky:n.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})}this.liveCardsOn&&!this.dimmed&&a.push(...zc(s,t,this.floorId,this.roomId)),JSON.stringify(a)!==JSON.stringify(this._liveCards)&&(this._liveCards=a),e.setLiveAnchors(a.map(m=>m.at),a.length?(m,h,g,_)=>this.placeLhCard(m,h,g,_):null)}placeLhCard(e,t,n,i){let o=this.renderRoot.querySelector(`.live-card[data-i="${e}"]`);o&&(o.dataset.x=String(t),o.dataset.y=String(n),o.style.visibility=i?"visible":"hidden",e===this._liveCards.length-1&&Zc(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>`}renderLhEnergy(){let e=this.ownSensors(),t=this._liveEnergy?.summary,n=!!t&&!this.roomId&&this.showEnergy&&!!this.hass&&!(t.consumption===null&&t.grid===null&&t.solar===null&&t.battery===null),o=this.building?.floors.some(c=>c.rooms.some(u=>u.climate_card))?this.renderCardToggle():f,s=this.roomNamesButton?p`<button class="nf-energy-item nf-flow-toggle nf-room-names-toggle" aria-pressed=${this.roomLabels} title=${A(this.hass,"room_names_toggle_hint")} @click=${()=>{this.roomLabels=!this.roomLabels,this.dispatchEvent(new CustomEvent("room-names-change",{detail:{value:this.roomLabels},bubbles:!0,composed:!0}))}}><span>${A(this.hass,"room_names_short")}</span><b aria-hidden="true">Aa</b></button>`:f;if(!n)return e.length||o!==f||s!==f?p`<div class="nf-energy" aria-live="off">${s}${e}${o}</div>`:f;let a=c=>A(this.hass,c),l=[];if(t.solar!==null&&l.push({cls:"solar",label:a("energy_solar"),value:ce(this.hass,t.solar)}),t.consumption!==null&&l.push({cls:"total",label:a("energy_consumption"),value:ce(this.hass,t.consumption)}),t.rest!==void 0&&t.rest!==null&&l.push({cls:"total",label:a("energy_rest"),value:ce(this.hass,t.rest)}),t.battery!==null||t.soc!==null){let c=[t.battery!==null?ce(this.hass,Math.abs(t.battery)):null,t.soc!==null?`${Math.round(t.soc)} %`:null].filter(Boolean);l.push({cls:"battery",label:a("energy_battery"),value:c.join(" \xB7 ")})}if(t.grid!==null){let c=t.grid<0;l.push({cls:c?"export":"grid",label:a(c?"energy_grid_export":"energy_grid_import"),value:ce(this.hass,Math.abs(t.grid))})}if(t.Line truncated
${s} ${s}
${this.liveCardsOn&&this._liveCards.some(c=>c.kind==="house")?f:l.map(c=>p`<div class="nf-energy-item nf-energy-${c.cls}"><span>${c.label}</span><b>${c.value}</b></div>`)} ${this.liveCardsOn&&this._liveCards.some(c=>c.kind==="house")?f:l.map(c=>p`<div class="nf-energy-item nf-energy-${c.cls}"><span>${c.label}</span><b>${c.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()}> ${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()}>
@@ -1724,36 +1741,37 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
</button>`} </button>`}
${this.renderCardToggle()} ${this.renderCardToggle()}
${e} ${e}
</div>`}renderCardToggle(){return this.holograms!==null?f:p`<button class="nf-energy-item nf-flow-toggle nf-card-toggle" aria-pressed=${this._liveCardOn} title=${M(this.hass,"holos_hint")} aria-label=${M(this.hass,"holos")} @click=${()=>this.toggleLhCards()}> </div>`}renderCardToggle(){return this.holograms!==null?f:p`<button class="nf-energy-item nf-flow-toggle nf-card-toggle" aria-pressed=${this._liveCardOn} title=${A(this.hass,"holos_hint")} aria-label=${A(this.hass,"holos")} @click=${()=>this.toggleLhCards()}>
<span>${M(this.hass,"holos")}</span><b>◫</b> <span>${A(this.hass,"holos")}</span><b>◫</b>
</button>`}ownSensors(){let e=this.sensorBar&&this.hass?this.building?.settings.status_entities??[]:[],t=J(this.hass)?(this.building?.presence??[]).filter(o=>Ha(this.hass,o.person,[0])).map(o=>p`<div class="nf-energy-item nf-presence-state"><span>${o.name||O(this.hass,o.person)}</span><b>${oe(this.hass.states[o.person])===null?"\u2013":oe(this.hass.states[o.person])?"Anwesend":"Abwesend"}</b></div>`):[],n=J(this.hass)?Object.entries(this.building?.settings.weather_variables??{}).filter(o=>!!o[1]&&o[1]!=="none").map(([o,s])=>[Vc[o]||o,s]):[];J(this.hass)&&this.building?.settings.rain_sensor&&this.building.settings.rain_sensor!=="none"&&n.push(["Regensensor",this.building.settings.rain_sensor]);let i=n.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> </button>`}ownSensors(){let e=this.sensorBar&&this.hass?this.building?.settings.status_entities??[]:[],t=U(this.hass)?(this.building?.presence??[]).filter(a=>Va(this.hass,a.person,[0])).map(a=>p`<div class="nf-energy-item nf-presence-state"><span>${a.name||O(this.hass,a.person)}</span><b>${oe(this.hass.states[a.person])===null?"\u2013":oe(this.hass.states[a.person])?"Anwesend":"Abwesend"}</b></div>`):[],n=U(this.hass)?Object.entries(this.building?.settings.weather_variables??{}).filter(a=>!!a[1]&&a[1]!=="none").map(([a,l])=>[lu[a]||a,l]):[];U(this.hass)&&this.building?.settings.rain_sensor&&this.building.settings.rain_sensor!=="none"&&n.push(["Regensensor",this.building.settings.rain_sensor]);let i=n.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=${o=>o.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>${n.map(([o,s])=>p`<p><span>${o}</span><b>${Ye(this.hass.states[s])}</b></p>`)}</dialog>`:f;return[...t,i,...e.filter(o=>this.hass.states[o]).map(o=>p`<button class="nf-energy-item nf-own-sensor" title=${O(this.hass,o)} @click=${()=>be(this,o)}> <dialog class="nf-weather-dialog" aria-label="Wetterwerte" @keydown=${a=>a.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>${n.map(([a,l])=>p`<p><span>${a}</span><b>${Je(this.hass.states[l])}</b></p>`)}</dialog>`:f,o=U(this.hass)?(this.building?.floors??[]).filter(a=>!this.floorId||a.id===this.floorId).map(a=>({floor:a,readings:cn(this.hass,a,this.building?.floors.flatMap(l=>l.rooms))})).filter(a=>a.readings.length):[],s=o.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>
<span>${O(this.hass,o)}</span><b>${ie(this.hass,this.hass.states[o])}</b> <dialog class="nf-weather-dialog nf-utility-dialog" aria-label="Stockwerkszähler" @keydown=${a=>a.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>${o.map(({floor:a,readings:l})=>p`<h3>${a.name}</h3><nf-utility-report .hass=${this.hass} .readings=${l}></nf-utility-report>`)}</dialog>`:f;return[...t,i,s,...e.filter(a=>this.hass.states[a]).map(a=>p`<button class="nf-energy-item nf-own-sensor" title=${O(this.hass,a)} @click=${()=>be(this,a)}>
</button>`)]}renderMapCredit(){let e=this.building?.settings.map;return Zl(e)?p`<a class="nf-map-credit" href=${ro(e).href} target="_blank" rel="noopener">${ro(e).text}</a>`:f}renderLegend(){if(this.heatMode==="wifi")return this.renderWifiLegend();if(this.heatMode==="none"||this.heatMode==="values")return f;let e=dt(new Date,this.hass?.config?.latitude??50),t=yr(this.heatMode,e),n=this.heatMode==="temperature",i=n?se(this.hass,t.stops[0][0]):t.stops[0][0],o=n?se(this.hass,t.stops[t.stops.length-1][0]):t.stops[t.stops.length-1][0],s=n?te(this.hass):t.unit,a=l=>M(this.hass,l);return p`<div class="nf-legend"> <span>${O(this.hass,a)}</span><b>${ie(this.hass,this.hass.states[a])}</b>
</button>`)]}renderMapCredit(){let e=this.building?.settings.map;return pc(e)?p`<a class="nf-map-credit" href=${mo(e).href} target="_blank" rel="noopener">${mo(e).text}</a>`:f}renderLegend(){if(this.heatMode==="wifi")return this.renderWifiLegend();if(this.heatMode==="none"||this.heatMode==="values")return f;let e=ht(new Date,this.hass?.config?.latitude??50),t=Sr(this.heatMode,e),n=this.heatMode==="temperature",i=n?se(this.hass,t.stops[0][0]):t.stops[0][0],o=n?se(this.hass,t.stops[t.stops.length-1][0]):t.stops[t.stops.length-1][0],s=n?ne(this.hass):t.unit,a=l=>A(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> <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:${ll(this.heatMode,e)}"></span> <span class="nf-legend-bar" style="background:${Al(this.heatMode,e)}"></span>
<span class="nf-legend-range"><span>${W(this.hass,i,0)} ${s}</span><span>${W(this.hass,o,0)} ${s}</span></span> <span class="nf-legend-range"><span>${W(this.hass,i,0)} ${s}</span><span>${W(this.hass,o,0)} ${s}</span></span>
${this.heatValues.size?f:p`<span class="nf-legend-none">${a("heat_none_found")}</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 n=(c,u)=>M(e,c,u),i=t.floors.flatMap(c=>c.furniture.filter(u=>go(u.type)).map(u=>_o(e,this.furnitureLinks?.get(u.id)?.entity??this.furnitureLinks?.get(u.id)?.power??null))),s=i.filter(c=>!!c).reduce((c,u)=>c+(u.clients??0),0),a=t.floors.flatMap(c=>c.placements.map(u=>e.states[u.entity_id])),l=Mc(a);return p`<div class="nf-legend"> </div>`}renderWifiLegend(){let e=this.hass,t=this.building;if(!e||!t)return f;let n=(c,u)=>A(e,c,u),i=t.floors.flatMap(c=>c.furniture.filter(u=>$o(u.type)).map(u=>Mo(e,this.furnitureLinks?.get(u.id)?.entity??this.furnitureLinks?.get(u.id)?.power??null))),s=i.filter(c=>!!c).reduce((c,u)=>c+(u.clients??0),0),a=t.floors.flatMap(c=>c.placements.map(u=>e.states[u.entity_id])),l=Gc(a);return p`<div class="nf-legend">
<b>📶 ${n("heat_wifi")}</b> <b>📶 ${n("heat_wifi")}</b>
<span>${n("wifi_aps",{n:i.length,clients:s})}</span> <span>${n("wifi_aps",{n:i.length,clients:s})}</span>
${l.online+l.offline.length?p`<span>${n("wifi_network",{online:l.online,offline:l.offline.length})}</span>`:f} ${l.online+l.offline.length?p`<span>${n("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} ${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">${n("wifi_none")}</span>`} ${i.length?f:p`<span class="nf-legend-none">${n("wifi_none")}</span>`}
</div>`}skyColor(){let e=gn[this.theme]??gn.neon,t=this._sky;return e.night[0].map((n,i)=>Math.round(n+(e.day[0][i]-n)*t))}render(){let e=this._sky,t=(o,s)=>`rgb(${o.map((a,l)=>Math.round(a+(s[l]-a)*e)).join(",")})`,n=gn[this.theme]??gn.neon,i=`--nf-sky:${t(n.night[0],n.day[0])};--nf-ground:${t(n.night[1],n.day[1])}`+Ml(this.building?.settings.backdrop);return p`<div </div>`}skyColor(){let e=vn[this.theme]??vn.neon,t=this._sky;return e.night[0].map((n,i)=>Math.round(n+(e.day[0][i]-n)*t))}render(){let e=this._sky,t=(o,s)=>`rgb(${o.map((a,l)=>Math.round(a+(s[l]-a)*e)).join(",")})`,n=vn[this.theme]??vn.neon,i=`--nf-sky:${t(n.night[0],n.day[0])};--nf-ground:${t(n.night[1],n.day[1])}`+Gl(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":""}" 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":""}"
style=${i} style=${i}
> >
${this._error?p`<p class="nf-error">${this._error}</p>`:f} ${this.renderTopLeft()} ${Tc(this.hass,this._liveCards,(o,s,a,l)=>this.hass?.callService(o,s,{entity_id:a,...l}),{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()} ${Yc(this.hass,this._liveCards,(o,s,a,l)=>this.hass?.callService(o,s,{entity_id:a,...l}),{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.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()} ${this.renderLayers()} ${this.renderPluginWindow()} ${this.renderMenu()} ${this.renderPlate()} ${this.renderEye()} ${this.renderLock()} ${this.renderWalk()} ${this.renderTravel()} ${this.renderClock()} ${this.renderToday()} ${this.renderLayers()} ${this.renderPluginWindow()}
${this.showStats&&this._stats?p`<span class="nf-stats" ${this.showStats&&this._stats?p`<span class="nf-stats"
><b>${this._stats.fps?M(this.hass,"stats_fps",{fps:this._stats.fps,ms:this._stats.worstMs}):M(this.hass,"stats_idle")}</b> ><b>${this._stats.fps?A(this.hass,"stats_fps",{fps:this._stats.fps,ms:this._stats.worstMs}):A(this.hass,"stats_idle")}</b>
${this._stats.busy.length?p`(${this._stats.busy.map(o=>M(this.hass,`stats_busy_${o}`)).join(", ")})`:f} · ${this._stats.busy.length?p`(${this._stats.busy.map(o=>A(this.hass,`stats_busy_${o}`)).join(", ")})`:f} ·
${M(this.hass,"stats",{calls:this._stats.calls,tris:this._stats.triangles.toLocaleString()})} · ${A(this.hass,"stats",{calls:this._stats.calls,tris:this._stats.triangles.toLocaleString()})} ·
${M(this.hass,this._stats.low?"stats_low":"stats_full",{r:W(this.hass,this._stats.pixelRatio,2)})}</span ${A(this.hass,this._stats.low?"stats_low":"stats_full",{r:W(this.hass,this._stats.pixelRatio,2)})}</span
>`:f} >`:f}
</div>`}static styles=[pe,Ae,Dc,X` </div>`}static styles=[pe,Ae,Jc,Q`
:host { :host {
display: block; display: block;
position: relative; position: relative;
@@ -3336,26 +3354,26 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
inset: auto 16px 16px; inset: auto 16px 16px;
color: var(--nf-danger); color: var(--nf-danger);
} }
`]};customElements.get("nf-view3d")||customElements.define("nf-view3d",$o);function ce(r,e){return Math.abs(e)>=1e3?`${W(r,e/1e3,1)} kW`:`${Math.round(e)} W`}function So(r){return r.type==="tv_board"?r.h+.9:r.type==="tv_wall"||r.type==="kitchen_wall"?r.h+.25:r.h+.35}function qp(r,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:ie(r,e)}var Jc;function Qc(){let r=new URL("./nextfloor-editor.js?v=4c16ed7c4e64",new URL(import.meta.url)).href;return Jc??=import(r),Jc}var Zp=.25,Xc=r=>Math.round(r*1e3)/1e3,eu=(r,e,t)=>r.rooms.find(n=>n.points.length>=3&&P([e,t],n.points));function Ao(r,e,t,n,i){let o=eu(r,e,t);if(!o)return[n,i];let s=(a,l)=>P([a,l],o.points);return s(n,i)?[n,i]:s(n,t)?[n,t]:s(e,i)?[e,i]:[e,t]}function Yp(r,e,t,n){return r.rooms.some(i=>i.id!==e.id&&i.points.some((o,s)=>{let a=i.points[(s+1)%i.points.length];return Math.abs(ae(Y(o,t),n))<.02&&Math.abs(ae(Y(a,t),n))<.02}))}var Mo=(r,e)=>Math.abs((r-e+540)%360-180);function tu(r,e,t,n=Zp){let i=eu(r,e.x,e.z);if(!i)return null;let o=i.points,s=at(o)>=0?1:-1,a=null;return o.forEach((l,c)=>{let u=o[(c+1)%o.length],h=Ie(Y(u,l));if(h<.3)return;let m=[(u[0]-l[0])/h,(u[1]-l[1])/h],d=[-m[1]*s,m[0]*s],g=ae(Y([e.x,e.z],l),m);if(g<0||g>h)return;let _=Yp(r,i,l,d)?t/2:0,b=ae(Y([e.x,e.z],l),d)-_,v=Math.atan2(-d[0],d[1])*180/Math.PI,S=[{rotation:v,extent:e.d/2},{rotation:v+90,extent:e.w/2},{rotation:v-90,extent:e.w/2}].reduce((T,z)=>Mo(e.rotation,z.rotation)<Mo(e.rotation,T.rotation)?z:T);if(Mo(e.rotation,S.rotation)>50)return;let E=b-S.extent;Math.abs(E)>n||a&&Math.abs(E)>=Math.abs(a.gap)||(a={x:Xc(e.x-d[0]*E),z:Xc(e.z-d[1]*E),rotation:(Math.round(S.rotation)%360+360)%360,gap:E})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function Br(r,e,t){let n=structuredClone(r);for(let i of n.floors){let o=i.furniture.find(s=>s.id===e);o&&t(o,i)}return n}function Vr(r,e,t){let n=structuredClone(r);for(let i of n.floors){let o=i.placements.find(s=>s.entity_id===e);o&&t(o,i)}return n}function nu(r,e){let t=structuredClone(r);for(let n of t.floors)n.furniture=n.furniture.filter(i=>i.id!==e);return t}function ru(r,e){let t=structuredClone(r);for(let n of t.floors)n.placements=n.placements.filter(i=>i.entity_id!==e);return t}function iu(r,e,t,n){return Vr(r,e,(i,o)=>{[i.x,i.z]=Ao(o,i.x,i.z,t,n)})}function ou(r,e,t,n){let i=r.settings.wall_interior??.12;return Br(r,e,(o,s)=>{[o.x,o.z]=Ao(s,o.x,o.z,t,n);let a=tu(s,o,i);a&&Object.assign(o,a)})}var Eo=(r,e)=>((r+e)%360+360)%360,su=r=>Number.parseFloat(r.replace(",",".")),Rn=(r,e)=>Math.round(r*10**e)/10**e;function Ro(r){let{min:e,max:t,accepts:n=()=>!0}=r,i=o=>{let s=su(o.target.value);!Number.isFinite(s)||!n(s)||r.apply(t===void 0?s:Math.min(t,Math.max(e,s)))};return p`<label class="nf-size" title=${r.title} `]};customElements.get("nf-view3d")||customElements.define("nf-view3d",Ho);function ce(r,e){return Math.abs(e)>=1e3?`${W(r,e/1e3,1)} kW`:`${Math.round(e)} W`}function Fo(r){return r.type==="tv_board"?r.h+.9:r.type==="tv_wall"||r.type==="kitchen_wall"?r.h+.25:r.h+.35}function bf(r,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:ie(r,e)}var gu;function _u(){let r=new URL("./nextfloor-editor.js?v=4fd9c94342a9",new URL(import.meta.url)).href;return gu??=import(r),gu}var vf=.25,bu=r=>Math.round(r*1e3)/1e3,vu=(r,e,t)=>r.rooms.find(n=>n.points.length>=3&&P([e,t],n.points));function Io(r,e,t,n,i){let o=vu(r,e,t);if(!o)return[n,i];let s=(a,l)=>P([a,l],o.points);return s(n,i)?[n,i]:s(n,t)?[n,t]:s(e,i)?[e,i]:[e,t]}function yf(r,e,t,n){return r.rooms.some(i=>i.id!==e.id&&i.points.some((o,s)=>{let a=i.points[(s+1)%i.points.length];return Math.abs(ae(J(o,t),n))<.02&&Math.abs(ae(J(a,t),n))<.02}))}var Po=(r,e)=>Math.abs((r-e+540)%360-180);function yu(r,e,t,n=vf){let i=vu(r,e.x,e.z);if(!i)return null;let o=i.points,s=lt(o)>=0?1:-1,a=null;return o.forEach((l,c)=>{let u=o[(c+1)%o.length],d=Ce(J(u,l));if(d<.3)return;let m=[(u[0]-l[0])/d,(u[1]-l[1])/d],h=[-m[1]*s,m[0]*s],g=ae(J([e.x,e.z],l),m);if(g<0||g>d)return;let _=yf(r,i,l,h)?t/2:0,b=ae(J([e.x,e.z],l),h)-_,v=Math.atan2(-h[0],h[1])*180/Math.PI,S=[{rotation:v,extent:e.d/2},{rotation:v+90,extent:e.w/2},{rotation:v-90,extent:e.w/2}].reduce((T,z)=>Po(e.rotation,z.rotation)<Po(e.rotation,T.rotation)?z:T);if(Po(e.rotation,S.rotation)>50)return;let M=b-S.extent;Math.abs(M)>n||a&&Math.abs(M)>=Math.abs(a.gap)||(a={x:bu(e.x-h[0]*M),z:bu(e.z-h[1]*M),rotation:(Math.round(S.rotation)%360+360)%360,gap:M})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function Gr(r,e,t){let n=structuredClone(r);for(let i of n.floors){let o=i.furniture.find(s=>s.id===e);o&&t(o,i)}return n}function Ur(r,e,t){let n=structuredClone(r);for(let i of n.floors){let o=i.placements.find(s=>s.entity_id===e);o&&t(o,i)}return n}function wu(r,e){let t=structuredClone(r);for(let n of t.floors)n.furniture=n.furniture.filter(i=>i.id!==e);return t}function xu(r,e){let t=structuredClone(r);for(let n of t.floors)n.placements=n.placements.filter(i=>i.entity_id!==e);return t}function ku(r,e,t,n){return Ur(r,e,(i,o)=>{[i.x,i.z]=Io(o,i.x,i.z,t,n)})}function Su(r,e,t,n){let i=r.settings.wall_interior??.12;return Gr(r,e,(o,s)=>{[o.x,o.z]=Io(s,o.x,o.z,t,n);let a=yu(s,o,i);a&&Object.assign(o,a)})}var Co=(r,e)=>((r+e)%360+360)%360,$u=r=>Number.parseFloat(r.replace(",",".")),Dn=(r,e)=>Math.round(r*10**e)/10**e;function No(r){let{min:e,max:t,accepts:n=()=>!0}=r,i=o=>{let s=$u(o.target.value);!Number.isFinite(s)||!n(s)||r.apply(t===void 0?s:Math.min(t,Math.max(e,s)))};return p`<label class="nf-size" title=${r.title}
>${r.label} >${r.label}
<input type="number" inputmode="decimal" step=${r.step} min=${e} max=${t??f} .value=${String(Rn(r.value,2))} @change=${i} /> <input type="number" inputmode="decimal" step=${r.step} min=${e} max=${t??f} .value=${String(Dn(r.value,2))} @change=${i} />
</label>`}var lu=(r,e)=>p`<button class="nf-chip" @click=${e}>${r.t("height_auto")}</button>`,au=(r,e)=>p`<button class="nf-chip" @click=${()=>e(-r)}>↺ ${r}°</button><button class="nf-chip" @click=${()=>e(r)}>↻ ${r}°</button>`;function Jp(r,e){let t=r.building.floors.find(s=>s.furniture.some(a=>a.id===e)),n=t?.furniture.find(s=>s.id===e);if(!t||!n)return f;let i=(s,a)=>Ro({label:r.t(a),title:r.t(`size_${s}`),value:n[s],step:.05,min:.05,accepts:l=>l>0,apply:l=>r.editFurniture(e,c=>c[s]=Rn(l,3))}),o=zs(n)?p`${Ro({label:"\u2195",title:r.t("mount_height"),value:n.mount_y??de(t,n),step:.05,min:0,accepts:s=>s>=0,apply:s=>r.editFurniture(e,a=>a.mount_y=Rn(s,3))})} </label>`}var Au=(r,e)=>p`<button class="nf-chip" @click=${e}>${r.t("height_auto")}</button>`,Mu=(r,e)=>p`<button class="nf-chip" @click=${()=>e(-r)}>↺ ${r}°</button><button class="nf-chip" @click=${()=>e(r)}>↻ ${r}°</button>`;function wf(r,e){let t=r.building.floors.find(s=>s.furniture.some(a=>a.id===e)),n=t?.furniture.find(s=>s.id===e);if(!t||!n)return f;let i=(s,a)=>No({label:r.t(a),title:r.t(`size_${s}`),value:n[s],step:.05,min:.05,accepts:l=>l>0,apply:l=>r.editFurniture(e,c=>c[s]=Dn(l,3))}),o=Ws(n)?p`${No({label:"\u2195",title:r.t("mount_height"),value:n.mount_y??de(t,n),step:.05,min:0,accepts:s=>s>=0,apply:s=>r.editFurniture(e,a=>a.mount_y=Dn(s,3))})}
${n.mount_y!=null?lu(r,()=>r.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 Qp(r,e){let t=r.building.floors.find(l=>l.placements.some(c=>c.entity_id===e)),n=t?.placements.find(l=>l.entity_id===e);if(!t||!n)return f;let i=F(e),o=(l,c,u)=>p`<select class="nf-size-select" title=${r.t(l)} @change=${h=>r.editDevice(e,m=>Object.assign(m,{mount:h.target.value,y:null}))}> ${n.mount_y!=null?Au(r,()=>r.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 xf(r,e){let t=r.building.floors.find(l=>l.placements.some(c=>c.entity_id===e)),n=t?.placements.find(l=>l.entity_id===e);if(!t||!n)return f;let i=F(e),o=(l,c,u)=>p`<select class="nf-size-select" title=${r.t(l)} @change=${d=>r.editDevice(e,m=>Object.assign(m,{mount:d.target.value,y:null}))}>
${c.map(([h,m])=>p`<option value=${h} ?selected=${h===u}>${m}</option>`)} ${c.map(([d,m])=>p`<option value=${d} ?selected=${d===u}>${m}</option>`)}
</select>`,s=["ceiling","floor","table","wall"].map(l=>[l,r.t(`lamp_${l}`)]),a=i?$t(i,_e(t,n.x,n.z),i==="light"?n.mount??"ceiling":null):1;return p`${i==="light"?o("lamp_mount",s,n.mount??"ceiling"):f} </select>`,s=["ceiling","floor","table","wall"].map(l=>[l,r.t(`lamp_${l}`)]),a=i?Mt(i,_e(t,n.x,n.z),i==="light"?n.mount??"ceiling":null):1;return p`${i==="light"?o("lamp_mount",s,n.mount??"ceiling"):f}
${Ro({label:r.t("size_short_h"),title:r.t("marker_height"),value:n.y??a,step:.05,min:0,accepts:l=>l>=0,apply:l=>r.editDevice(e,c=>c.y=Rn(l,3))})} ${No({label:r.t("size_short_h"),title:r.t("marker_height"),value:n.y??a,step:.05,min:0,accepts:l=>l>=0,apply:l=>r.editDevice(e,c=>c.y=Dn(l,3))})}
${n.y!==null?lu(r,()=>r.editDevice(e,l=>l.y=null)):f}`}function cu(r,e,t){let n=r.t,i;if(e){let o=r.building.floors.flatMap(s=>s.furniture).find(s=>s.id===e)?.type;i=p`<span>${o?fe(r.hass,o):""}</span> ${n.y!==null?Au(r,()=>r.editDevice(e,l=>l.y=null)):f}`}function Eu(r,e,t){let n=r.t,i;if(e){let o=r.building.floors.flatMap(s=>s.furniture).find(s=>s.id===e)?.type;i=p`<span>${o?fe(r.hass,o):""}</span>
${Jp(r,e)} ${au(45,s=>r.turnFurniture(e,s))} ${wf(r,e)} ${Mu(45,s=>r.turnFurniture(e,s))}
<button class="nf-chip" title=${n("furn_mirror_hint")} @click=${()=>r.editFurniture(e,s=>s.mirror=!s.mirror)}>⇋ ${n("furn_mirror")}</button> <button class="nf-chip" title=${n("furn_mirror_hint")} @click=${()=>r.editFurniture(e,s=>s.mirror=!s.mirror)}>⇋ ${n("furn_mirror")}</button>
<button class="nf-chip nf-danger-chip" @click=${()=>r.removeFurniture(e)}>${n("delete")}</button>`}else t?i=p`<span>${O(r.hass,t)}</span> <button class="nf-chip nf-danger-chip" @click=${()=>r.removeFurniture(e)}>${n("delete")}</button>`}else t?i=p`<span>${O(r.hass,t)}</span>
${Qp(r,t)} ${au(45,o=>r.turnDevice(t,o))} ${xf(r,t)} ${Mu(45,o=>r.turnDevice(t,o))}
<button class="nf-chip nf-danger-chip" @click=${()=>r.removeDevice(t)}>${n("delete")}</button>`:i=p`<span>${n("furnish_hint")}</span>`;return p`<div class="nf-furnish-bar">${i}<button class="nf-chip nf-chip-on" @click=${()=>r.finish()}>${n("done")}</button></div>`}var uu=ee`<svg class="nf-mark" viewBox="60 40 392 420" aria-hidden="true"> <button class="nf-chip nf-danger-chip" @click=${()=>r.removeDevice(t)}>${n("delete")}</button>`:i=p`<span>${n("furnish_hint")}</span>`;return p`<div class="nf-furnish-bar">${i}<button class="nf-chip nf-chip-on" @click=${()=>r.finish()}>${n("done")}</button></div>`}var Ru=te`<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,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,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,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"/> <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"/> <circle cx="256" cy="236" r="16" fill="#ffe08a"/>
</svg>`;var ue=(r,e)=>({name:r,fallback:e,read:t=>e?t!=="0":t==="1",write:t=>t?"1":"0"}),Ot=(r,e,t)=>({name:r,fallback:t,read:n=>e.find(i=>i===n)??t,write:n=>n}),zo={explode:ue("explode",!0),keepRoof:ue("roof",!1),solidWalls:ue("solid_walls",!1),quality:Ot("quality",["auto","low","high"],"auto"),stats:ue("stats",!1),markers:Ot("markers",["none","important","all"],"important"),heat:Ot("heat",["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],"none"),theme:Ot("theme",Er,"neon"),clock:Ot("clock",["none","top_left","top_right","bottom_left","bottom_right"],"none"),accent:{name:"accent",fallback:null,read:r=>/^#[0-9a-f]{6}$/i.test(r)?r:null,write:r=>r??""},floorStack:Ot("floor_stack",["dim","stacked","single"],"dim"),roomNames:ue("room_names",!0),clean:ue("clean",!1),navWrap:ue("nav_wrap",!1),weather:ue("weather",!0),timeSlider:ue("time_slider",!1),menuOpen:ue("menu_open",!1),keepCamera:ue("keep_camera",!1),readable:ue("readable",!1),plain:ue("plain",!1),rightBack:ue("right_back",!1),zoom:{name:"zoom",fallback:100,read:r=>/^\d{2,3}$/.test(r)?Math.min(250,Math.max(60,Number(r))):100,write:r=>String(Math.round(Math.min(250,Math.max(60,r))))},screenName:{name:"screen_name",fallback:"",read:r=>r.slice(0,60),write:r=>r.trim().slice(0,60)},announceMuted:ue("announce_muted",!1),glassWalls:{name:"glass_walls",fallback:20,read:r=>/^\d{1,3}$/.test(r)?Math.min(100,Number(r)):20,write:r=>String(Math.round(Math.min(100,Math.max(0,r))))}};function du(r=Gr()){try{return r?.getItem("nextfloor.screen_name")?.trim()||null}catch{return null}}function hu(r=Gr()){try{return r?.getItem("nextfloor.announce_muted")==="1"}catch{return!1}}function Gr(){try{return localStorage}catch{return null}}var Kr=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 n of Object.keys(zo)){let i=zo[n],o=this.raw(i.name);t[n]=o===null?i.fallback:i.read(o)}return new URLSearchParams(e).has("nf_stats")&&(t.stats=!0),t}save(e,t){let n=zo[e];try{this.storage?.setItem(`nextfloor.${n.name}`,n.write(t))}catch{}}};var mu=X` </svg>`;var ue=(r,e)=>({name:r,fallback:e,read:t=>e?t!=="0":t==="1",write:t=>t?"1":"0"}),Lt=(r,e,t)=>({name:r,fallback:t,read:n=>e.find(i=>i===n)??t,write:n=>n}),Wo={explode:ue("explode",!0),keepRoof:ue("roof",!1),solidWalls:ue("solid_walls",!1),quality:Lt("quality",["auto","low","high"],"auto"),stats:ue("stats",!1),markers:Lt("markers",["none","important","all"],"important"),heat:Lt("heat",["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],"none"),theme:Lt("theme",Tr,"neon"),clock:Lt("clock",["none","top_left","top_right","bottom_left","bottom_right"],"none"),accent:{name:"accent",fallback:null,read:r=>/^#[0-9a-f]{6}$/i.test(r)?r:null,write:r=>r??""},floorStack:Lt("floor_stack",["dim","stacked","single"],"dim"),roomNames:ue("room_names",!0),clean:ue("clean",!1),navWrap:ue("nav_wrap",!1),weather:ue("weather",!0),timeSlider:ue("time_slider",!1),menuOpen:ue("menu_open",!1),keepCamera:ue("keep_camera",!1),readable:ue("readable",!1),plain:ue("plain",!1),rightBack:ue("right_back",!1),zoom:{name:"zoom",fallback:100,read:r=>/^\d{2,3}$/.test(r)?Math.min(250,Math.max(60,Number(r))):100,write:r=>String(Math.round(Math.min(250,Math.max(60,r))))},screenName:{name:"screen_name",fallback:"",read:r=>r.slice(0,60),write:r=>r.trim().slice(0,60)},announceMuted:ue("announce_muted",!1),glassWalls:{name:"glass_walls",fallback:20,read:r=>/^\d{1,3}$/.test(r)?Math.min(100,Number(r)):20,write:r=>String(Math.round(Math.min(100,Math.max(0,r))))}};function zu(r=qr()){try{return r?.getItem("nextfloor.screen_name")?.trim()||null}catch{return null}}function Tu(r=qr()){try{return r?.getItem("nextfloor.announce_muted")==="1"}catch{return!1}}function qr(){try{return localStorage}catch{return null}}var jr=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 n of Object.keys(Wo)){let i=Wo[n],o=this.raw(i.name);t[n]=o===null?i.fallback:i.read(o)}return new URLSearchParams(e).has("nf_stats")&&(t.stats=!0),t}save(e,t){let n=Wo[e];try{this.storage?.setItem(`nextfloor.${n.name}`,n.write(t))}catch{}}};var Du=Q`
.nf-dot { .nf-dot {
display: inline-block; display: inline-block;
width: 8px; width: 8px;
@@ -3847,11 +3865,11 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
gap: 12px; gap: 12px;
margin: auto; margin: auto;
} }
`;var pu=new WeakMap,fu=new WeakMap;function ft(r,e){let t=fu.get(r)??r,n=pu.get(t)??new WeakMap;pu.set(t,n);let i=n.get(e);if(i)return i;let o=new Map;for(let l of e)for(let c of l.placements)c.entity_id.startsWith("cover.")&&o.set(c.entity_id,{tilt:c.cover_tilt==="none"?null:c.cover_tilt,position:c.position});for(let l of De(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,c]of o){let u=t.states[l];if(!u)continue;let h={...u.attributes,nf_cover_control:!0},m=Mt(t,c.position);m===null&&(m=typeof u.attributes.current_position=="number"?u.attributes.current_position:null),m!==null&&(h.current_position=m);let d=c.tilt?t.states[c.tilt]:u,g=typeof d?.attributes.current_tilt_position=="number"?d.attributes.current_tilt_position:c.tilt?Mt(t,c.tilt):null;g!==null&&(h.current_tilt_position=g,h.supported_features=Number(h.supported_features??0)|128);let _=u.state;typeof h.current_position=="number"&&_!=="unavailable"&&_!=="unknown"&&_!=="opening"&&_!=="closing"&&(_=h.current_position>0?"open":"closed"),s[l]={...u,state:_,attributes:h}}let a={...t,states:s,callService:async(l,c,u={})=>{if(l!=="cover")return t.callService(l,c,u);let h=Array.isArray(u.entity_id)?u.entity_id:[u.entity_id],m=async d=>{let g=typeof d=="string"?o.get(d):void 0;if(!g)return t.callService(l,c,{...u,entity_id:d});let _={...u,entity_id:d},b=c;(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 k=g.tilt?t.states[g.tilt]:void 0;return v&&g.tilt&&!k?.attributes.symcon_id&&typeof k?.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(u.entity_id)?Promise.all(h.map(m)):m(h[0])}};return fu.set(a,t),n.set(e,a),a}var To=class extends re{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 St(this);store=new Kr(Gr());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:st(vt(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,n=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"):n(t)}</button> `;var Fu=new WeakMap,Hu=new WeakMap;function gt(r,e){let t=Hu.get(r)??r,n=Fu.get(t)??new WeakMap;Fu.set(t,n);let i=n.get(e);if(i)return i;let o=new Map;for(let l of e)for(let c of l.placements)c.entity_id.startsWith("cover.")&&o.set(c.entity_id,{tilt:c.cover_tilt==="none"?null:c.cover_tilt,position:c.position});for(let l of De(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,c]of o){let u=t.states[l];if(!u)continue;let d={...u.attributes,nf_cover_control:!0},m=At(t,c.position);m===null&&(m=typeof u.attributes.current_position=="number"?u.attributes.current_position:null),m!==null&&(d.current_position=m);let h=c.tilt?t.states[c.tilt]:u,g=typeof h?.attributes.current_tilt_position=="number"?h.attributes.current_tilt_position:c.tilt?At(t,c.tilt):null;g!==null&&(d.current_tilt_position=g,d.supported_features=Number(d.supported_features??0)|128);let _=u.state;typeof d.current_position=="number"&&_!=="unavailable"&&_!=="unknown"&&_!=="opening"&&_!=="closing"&&(_=d.current_position>0?"open":"closed"),s[l]={...u,state:_,attributes:d}}let a={...t,states:s,callService:async(l,c,u={})=>{if(l!=="cover")return t.callService(l,c,u);let d=Array.isArray(u.entity_id)?u.entity_id:[u.entity_id],m=async h=>{let g=typeof h=="string"?o.get(h):void 0;if(!g)return t.callService(l,c,{...u,entity_id:h});let _={...u,entity_id:h},b=c;(b==="toggle"||b==="toggle_cover")&&(b=s[String(h)]?.state==="closed"?"open_cover":"close_cover");let v=b.includes("tilt");v&&g.tilt&&(_.entity_id=g.tilt);let k=g.tilt?t.states[g.tilt]:void 0;return v&&g.tilt&&!k?.attributes.symcon_id&&typeof k?.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(u.entity_id)?Promise.all(d.map(m)):m(d[0])}};return Hu.set(a,t),n.set(e,a),a}var Oo=class extends X{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 $t(this);store=new jr(qr());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:at(yt(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,n=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"):n(t)}</button>
${t!==null?p`<label class="nf-chip nf-time-slider" ${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)} ><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))} @change=${o=>(this._timeDrag=null,this._timeOfDay=Number(o.target.value))}
/></label>`:f}`}t=(e,t)=>M(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=gr(this.hass),this.data.setHass(this.hass));let t=this.data.building;t&&this._floorId&&!t.floors.some(n=>n.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 n=nn(this.hass,e.floors,e.settings.outside_hidden);return this.outsideMemo={building:e,entities:this.hass.entities,ids:n},n}openOutside(){let e=!this._outside;this.openFloor(null),this._outside=e}onRoomTap(e){let{floorId:t,roomId:n}=e.detail;if(n==="nf-outside")return this.openOutside();if((this.data.building?.floors.length??0)>1&&t&&this._floorId!==t)return this.openFloor(t);n&&(this._roomId=n===this._roomId?null:n,this._outside=!1)}furnishHost={hass:void 0,building:void 0,t:this.t,editFurniture:(e,t)=>this.applyEdit(n=>Br(n,e,t)),editDevice:(e,t)=>this.applyEdit(n=>Vr(n,e,t)),turnFurniture:(e,t)=>this.applyEdit(n=>Br(n,e,i=>i.rotation=Eo(i.rotation,t))),turnDevice:(e,t)=>this.applyEdit(n=>Vr(n,e,i=>i.rotation=Eo(i.rotation??0,t))),removeFurniture:e=>{this.applyEdit(t=>nu(t,e)),this._selFurniture=null},removeDevice:e=>{this.applyEdit(t=>ru(t,e)),this._selDevice=null},finish:()=>{this._furnish=!1,this._selFurniture=null,this._selDevice=null}};saveMoods(e,t){this.applyEdit(n=>({...n,floors:n.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&&ur(this.hass,this))return f;let e=this.data.building,t=this._prefs.clean&&this._mode==="view",n=f;return e&&(this._mode==="editor"&&this.isAdmin?n=this.renderEditor(e):this._mode==="extensions"&&this.isAdmin?n=this.renderExtensions():n=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)=>A(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=vr(this.hass),this.data.setHass(this.hass));let t=this.data.building;t&&this._floorId&&!t.floors.some(n=>n.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 n=on(this.hass,e.floors,e.settings.outside_hidden);return this.outsideMemo={building:e,entities:this.hass.entities,ids:n},n}openOutside(){let e=!this._outside;this.openFloor(null),this._outside=e}onRoomTap(e){let{floorId:t,roomId:n}=e.detail;if(n==="nf-outside")return this.openOutside();if((this.data.building?.floors.length??0)>1&&t&&this._floorId!==t)return this.openFloor(t);n&&(this._roomId=n===this._roomId?null:n,this._outside=!1)}furnishHost={hass:void 0,building:void 0,t:this.t,editFurniture:(e,t)=>this.applyEdit(n=>Gr(n,e,t)),editDevice:(e,t)=>this.applyEdit(n=>Ur(n,e,t)),turnFurniture:(e,t)=>this.applyEdit(n=>Gr(n,e,i=>i.rotation=Co(i.rotation,t))),turnDevice:(e,t)=>this.applyEdit(n=>Ur(n,e,i=>i.rotation=Co(i.rotation??0,t))),removeFurniture:e=>{this.applyEdit(t=>wu(t,e)),this._selFurniture=null},removeDevice:e=>{this.applyEdit(t=>xu(t,e)),this._selDevice=null},finish:()=>{this._furnish=!1,this._selFurniture=null,this._selDevice=null}};saveMoods(e,t){this.applyEdit(n=>({...n,floors:n.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&&mr(this.hass,this))return f;let e=this.data.building,t=this._prefs.clean&&this._mode==="view",n=f;return e&&(this._mode==="editor"&&this.isAdmin?n=this.renderEditor(e):this._mode==="extensions"&&this.isAdmin?n=this.renderExtensions():n=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()}`} ${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} ${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} ${!e&&!this.data.error?p`<p class="nf-message">${this.t("loading")}</p>`:f}
@@ -3864,7 +3882,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
</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> </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":""}"> <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("quality",["auto","low","high"],e.quality,t=>this.t(`quality_${t}`),t=>this.setPref("quality",t))}
${this.choiceRow("theme",Er,e.theme,t=>this.t(`theme_${t}`),t=>this.setPref("theme",t),this.accentPicker())} ${this.choiceRow("theme",Tr,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))} ${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")} <label class="nf-seg nf-clock-pick" title=${this.t("clock")}
>🕒 >🕒
@@ -3880,7 +3898,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
>${this.t("glass_walls")} >${this.t("glass_walls")}
<input type="range" min="0" max="100" step="5" .value=${String(e.glassWalls)} aria-label=${this.t("glass_walls")} @input=${t=>this.setPref("glassWalls",Number(t.target.value))} /> <input type="range" min="0" max="100" step="5" .value=${String(e.glassWalls)} aria-label=${this.t("glass_walls")} @input=${t=>this.setPref("glassWalls",Number(t.target.value))} />
</label> </label>
${J(this.hass)?f:p`<details class="nf-seg nf-screen-pick"> ${U(this.hass)?f:p`<details class="nf-seg nf-screen-pick">
<summary title=${this.t(e.announceMuted?"announce_muted":"announce_on")} aria-label=${this.t(e.announceMuted?"announce_muted":"announce_on")}>${e.announceMuted?"\u{1F507}":"\u{1F4E2}"}</summary> <summary title=${this.t(e.announceMuted?"announce_muted":"announce_on")} aria-label=${this.t(e.announceMuted?"announce_muted":"announce_on")}>${e.announceMuted?"\u{1F507}":"\u{1F4E2}"}</summary>
<div class="nf-screen-menu"> <div class="nf-screen-menu">
<label class="nf-check"><input type="checkbox" .checked=${!e.announceMuted} @change=${t=>this.setPref("announceMuted",!t.target.checked)} /> ${this.t("announce_on")}</label> <label class="nf-check"><input type="checkbox" .checked=${!e.announceMuted} @change=${t=>this.setPref("announceMuted",!t.target.checked)} /> ${this.t("announce_on")}</label>
@@ -3903,7 +3921,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
</div> </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",n=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=n==="saving"?"saving":n==="saved"?"saved":"save_error";return p`<header class="nf-header"> </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",n=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=n==="saving"?"saving":n==="saved"?"saved":"save_error";return p`<header class="nf-header">
<ha-menu-button .hass=${this.hass} .narrow=${this.narrow}></ha-menu-button> <ha-menu-button .hass=${this.hass} .narrow=${this.narrow}></ha-menu-button>
<h1 title=${t}>${uu}<span class="nf-view-title">${t}</span></h1> <h1 title=${t}>${Ru}<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} ${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> <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} ${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}
@@ -3918,7 +3936,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
<span>${this.t("draft_found",{time:n})}</span> <span>${this.t("draft_found",{time:n})}</span>
<button class="nf-btn nf-primary" @click=${()=>e.restoreDraft()}>${this.t("draft_restore")}</button> <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> <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():(Qc().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():(_u().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()}} @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 @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" class="nf-body"
@@ -3928,10 +3946,10 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.roomLabels=${this._prefs.roomNames} .roomLabels=${this._prefs.roomNames}
@room-names-change=${t=>this.setPref("roomNames",t.detail.value)} @room-names-change=${t=>this.setPref("roomNames",t.detail.value)}
.packs=${this.data.packs} .packs=${this.data.packs}
.loadCardEditor=${Pn} .loadCardEditor=${Nn}
@packs-changed=${()=>{this.data.reloadPacks()}} @packs-changed=${()=>{this.data.reloadPacks()}}
@building-changed=${t=>this.data.edit(t.detail.building)} @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 n=mn(yl(t).map(i=>this.hass.states[i]));return n.count<2?f:p`<button class="nf-chip" title=${this.t("all_off_floor",{floor:t.name,n:n.count})} @click=${()=>{for(let i of n.off)this.hass.callService(i.domain,i.service,i.data);this._floorUndo=n.undo,clearTimeout(this.floorUndoTimer),this.floorUndoTimer=setTimeout(()=>this._floorUndo=null,1e4)}}>⏻ ${n.count}</button>`}renderNav(e){let t=e.floors.filter(c=>!this._floorId||c.id===this._floorId),n=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=n?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 n=gn(Ol(t).map(i=>this.hass.states[i]));return n.count<2?f:p`<button class="nf-chip" title=${this.t("all_off_floor",{floor:t.name,n:n.count})} @click=${()=>{for(let i of n.off)this.hass.callService(i.domain,i.service,i.data);this._floorUndo=n.undo,clearTimeout(this.floorUndoTimer),this.floorUndoTimer=setTimeout(()=>this._floorUndo=null,1e4)}}>⏻ ${n.count}</button>`}renderNav(e){let t=e.floors.filter(c=>!this._floorId||c.id===this._floorId),n=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=n?p`<button class="nf-chip" aria-pressed=${this._floorId===null} @click=${()=>this.openFloor(null)}>${this.t("all_floors")}</button>
${[...e.floors].reverse().map(c=>p`<button class="nf-chip" aria-pressed=${c.id===this._floorId} @click=${()=>this.openFloor(c.id)}>${c.name}</button>`)} ${[...e.floors].reverse().map(c=>p`<button class="nf-chip" aria-pressed=${c.id===this._floorId} @click=${()=>this.openFloor(c.id)}>${c.name}</button>`)}
${o} ${this.allOffChip(e)} ${o} ${this.allOffChip(e)}
<span class="nf-sep"></span>`:p`${o} ${this.allOffChip(e)}`,a=t.flatMap(c=>[t.length>1&&c.rooms.length?p`<span class="nf-nav-floor">${c.name}</span>`:f,...c.rooms.map(u=>p`<button <span class="nf-sep"></span>`:p`${o} ${this.allOffChip(e)}`,a=t.flatMap(c=>[t.length>1&&c.rooms.length?p`<span class="nf-nav-floor">${c.name}</span>`:f,...c.rooms.map(u=>p`<button
@@ -3943,7 +3961,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
</button>`)]),l=this.t(i?"nav_row":"nav_wrap");return p`<nav class="nf-nav ${i?"nf-nav-wrap":""}" @wheel=${this.onNavWheel}> </button>`)]),l=this.t(i?"nav_row":"nav_wrap");return p`<nav class="nf-nav ${i?"nf-nav-wrap":""}" @wheel=${this.onNavWheel}>
${s}${a} ${s}${a}
<button class="nf-chip nf-nav-toggle" title=${l} aria-label=${l} aria-pressed=${i} @click=${()=>this.setPref("navWrap",!i)}>${i?"\u2194":"\u2261"}</button> <button class="nf-chip nf-nav-toggle" title=${l} aria-label=${l} aria-pressed=${i} @click=${()=>this.setPref("navWrap",!i)}>${i?"\u2194":"\u2261"}</button>
</nav>`}toggleChip(e,t,n){return p`<button class="nf-chip" aria-pressed=${this._prefs[e]} title=${n?this.t(n):f} @click=${()=>this.setPref(e,!this._prefs[e])}>${this.t(t)}</button>`}renderOverlay(e){let t=this._prefs,n=this.t,i=(u,h)=>p`<div class="nf-seg">${[u,h].map(([m,d,g])=>p`<button aria-pressed=${m} @click=${d}>${g}</button>`)}</div>`,o=["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],s=["dim","stacked","single"],a=e.floors.length>1,l=this._roomId||this._floorId&&a?p`<button class="nf-chip" @click=${()=>this.back()}>${n("back")}</button>`:f,c=p`<button class="nf-chip" aria-haspopup="true" aria-expanded=${this._switchesOpen} @click=${()=>this._switchesOpen=!this._switchesOpen}>☰ ${n("bars_unfold")} <span class="nf-caret">${this._switchesOpen?"\u25BE":"\u25B4"}</span></button>`;return this._switchesOpen?p`<div class="nf-overlay"> </nav>`}toggleChip(e,t,n){return p`<button class="nf-chip" aria-pressed=${this._prefs[e]} title=${n?this.t(n):f} @click=${()=>this.setPref(e,!this._prefs[e])}>${this.t(t)}</button>`}renderOverlay(e){let t=this._prefs,n=this.t,i=(u,d)=>p`<div class="nf-seg">${[u,d].map(([m,h,g])=>p`<button aria-pressed=${m} @click=${h}>${g}</button>`)}</div>`,o=["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],s=["dim","stacked","single"],a=e.floors.length>1,l=this._roomId||this._floorId&&a?p`<button class="nf-chip" @click=${()=>this.back()}>${n("back")}</button>`:f,c=p`<button class="nf-chip" aria-haspopup="true" aria-expanded=${this._switchesOpen} @click=${()=>this._switchesOpen=!this._switchesOpen}>☰ ${n("bars_unfold")} <span class="nf-caret">${this._switchesOpen?"\u25BE":"\u25B4"}</span></button>`;return this._switchesOpen?p`<div class="nf-overlay">
<div class="nf-switches-veil" @click=${()=>this._switchesOpen=!1}></div> <div class="nf-switches-veil" @click=${()=>this._switchesOpen=!1}></div>
<div class="nf-switches" role="group" aria-label=${n("bars_unfold")} @keydown=${u=>u.key==="Escape"&&(this._switchesOpen=!1)}> <div class="nf-switches" role="group" aria-label=${n("bars_unfold")} @keydown=${u=>u.key==="Escape"&&(this._switchesOpen=!1)}>
<div class="nf-seg"> <div class="nf-seg">
@@ -3972,7 +3990,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
<div class="nf-stage-wrap ${this._roomId?"nf-room-open":""}"> <div class="nf-stage-wrap ${this._roomId?"nf-room-open":""}">
<nf-view3d <nf-view3d
class="nf-body" class="nf-body"
.hass=${Or(ft(this.hass,e.floors),e.settings)} .hass=${Vr(gt(this.hass,e.floors),e.settings)}
.building=${e} .building=${e}
.packs=${this.data.packs} .packs=${this.data.packs}
.floorStack=${t.floorStack} .floorStack=${t.floorStack}
@@ -3991,10 +4009,10 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.keepRoof=${t.keepRoof} .keepRoof=${t.keepRoof}
.markerMode=${t.markers} .markerMode=${t.markers}
.heatMode=${t.heat} .heatMode=${t.heat}
.theme=${Rr(t.theme,this.sunState())} .theme=${Dr(t.theme,this.sunState())}
.timeOfDay=${this._timeOfDay} .timeOfDay=${this._timeOfDay}
.clock=${t.clock==="none"?null:t.clock} .clock=${t.clock==="none"?null:t.clock}
.announcements=${!J(this.hass)&&!t.announceMuted} .announcements=${!U(this.hass)&&!t.announceMuted}
.glassWalls=${t.glassWalls} .glassWalls=${t.glassWalls}
.screenName=${t.screenName||null} .screenName=${t.screenName||null}
.lockButton=${!0} .lockButton=${!0}
@@ -4010,9 +4028,9 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
?furnish=${this._furnish} ?furnish=${this._furnish}
.selectedFurniture=${this._selFurniture} .selectedFurniture=${this._selFurniture}
@furniture-select=${i=>this._selFurniture=i.detail.id} @furniture-select=${i=>this._selFurniture=i.detail.id}
@furniture-move=${i=>this.applyEdit(o=>ou(o,i.detail.id,i.detail.x,i.detail.z))} @furniture-move=${i=>this.applyEdit(o=>Su(o,i.detail.id,i.detail.x,i.detail.z))}
@device-select=${i=>this._selDevice=i.detail.id} @device-select=${i=>this._selDevice=i.detail.id}
@device-move=${i=>this.applyEdit(o=>iu(o,i.detail.id,i.detail.x,i.detail.z))} @device-move=${i=>this.applyEdit(o=>ku(o,i.detail.id,i.detail.x,i.detail.z))}
.quality=${t.quality} .quality=${t.quality}
?showStats=${t.stats} ?showStats=${t.stats}
@room-tap=${this.onRoomTap} @room-tap=${this.onRoomTap}
@@ -4022,10 +4040,10 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${n?p`<nf-room-panel ${n?p`<nf-room-panel
.building=${this.data.building??null} .building=${this.data.building??null}
class="nf-room-panel" class="nf-room-panel"
.hass=${ft(this.hass,e.floors)} .hass=${gt(this.hass,e.floors)}
.room=${n} .room=${n}
.floor=${e.floors.find(i=>i.rooms.some(o=>o.id===this._roomId))??null} .floor=${e.floors.find(i=>i.rooms.some(o=>o.id===this._roomId))??null}
.confirmEntities=${ut(this.hass,e.floors)} .confirmEntities=${dt(this.hass,e.floors)}
.phrases=${e.settings.announce_phrases??null} .phrases=${e.settings.announce_phrases??null}
.rooms=${e.floors.flatMap(i=>i.rooms)} .rooms=${e.floors.flatMap(i=>i.rooms)}
@mood-change=${i=>this.saveMoods(i.detail.roomId,i.detail.moods)} @mood-change=${i=>this.saveMoods(i.detail.roomId,i.detail.moods)}
@@ -4033,17 +4051,17 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
></nf-room-panel>`:this._outside?p`<nf-room-panel ></nf-room-panel>`:this._outside?p`<nf-room-panel
.building=${this.data.building??null} .building=${this.data.building??null}
class="nf-room-panel" class="nf-room-panel"
.hass=${ft(this.hass,e.floors)} .hass=${gt(this.hass,e.floors)}
.room=${null} .room=${null}
.outside=${this.outsideIds(e)} .outside=${this.outsideIds(e)}
.confirmEntities=${ut(this.hass,e.floors)} .confirmEntities=${dt(this.hass,e.floors)}
.phrases=${e.settings.announce_phrases??null} .phrases=${e.settings.announce_phrases??null}
@close=${()=>this._outside=!1} @close=${()=>this._outside=!1}
></nf-room-panel>`:f} ></nf-room-panel>`:f}
${t.clean?f:this.renderOverlay(e)} ${t.clean?f:this.renderOverlay(e)}
${this._furnish?cu(this.furnishHost,this._selFurniture,this._selDevice):f} ${this._furnish?Eu(this.furnishHost,this._selFurniture,this._selDevice):f}
</div> </div>
`}static styles=[pe,Ae,mu,fr]};customElements.get("nextfloor-panel")||customElements.define("nextfloor-panel",To);var Xp=/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/,gu=(r,e)=>Number(r)*60+Number(e);function zn(r,e,t=new Date){if(!r||r==="off")return!1;if(r==="sun")return e?.states["sun.sun"]?.state==="below_horizon";let n=Xp.exec(r.trim());if(!n)return!1;let i=gu(n[1],n[2]),o=gu(n[3],n[4]),s=t.getHours()*60+t.getMinutes();return i>o?s>=i||s<o:s>=i&&s<o}var Ur=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(zn(this.host.config()?.night,this.host.hass())),6e4)}stop(){clearTimeout(this.cleanTimer),clearTimeout(this.idleTimer),clearInterval(this.nightTimer)}};function _u(r,e){return r?r.floors.filter(t=>(e===null||t.id===e)&&t.rooms.length>0).map(t=>({floorId:t.id,floorName:t.name,rooms:t.rooms.map(n=>({id:n.id,name:n.name||"\u2013",floorId:t.id}))})):[]}var bu=X` `}static styles=[pe,Ae,Du,br]};customElements.get("nextfloor-panel")||customElements.define("nextfloor-panel",Oo);var kf=/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/,Pu=(r,e)=>Number(r)*60+Number(e);function Fn(r,e,t=new Date){if(!r||r==="off")return!1;if(r==="sun")return e?.states["sun.sun"]?.state==="below_horizon";let n=kf.exec(r.trim());if(!n)return!1;let i=Pu(n[1],n[2]),o=Pu(n[3],n[4]),s=t.getHours()*60+t.getMinutes();return i>o?s>=i||s<o:s>=i&&s<o}var Zr=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(Fn(this.host.config()?.night,this.host.hass())),6e4)}stop(){clearTimeout(this.cleanTimer),clearTimeout(this.idleTimer),clearInterval(this.nightTimer)}};function Iu(r,e){return r?r.floors.filter(t=>(e===null||t.id===e)&&t.rooms.length>0).map(t=>({floorId:t.id,floorName:t.name,rooms:t.rooms.map(n=>({id:n.id,name:n.name||"\u2013",floorId:t.id}))})):[]}var Cu=Q`
ha-card { ha-card {
overflow: hidden; overflow: hidden;
background: var(--nf-bg); background: var(--nf-bg);
@@ -4167,26 +4185,26 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
justify-content: flex-end; justify-content: flex-end;
} }
} }
`;function Do(r,e){let t=r.template,n=t?e?.[t]:void 0;if(!n)return r;let{type:i,template:o,...s}=n;return{...s,...r}}function vu(r,e){let t=new Set(e),n=[];for(let o of r.floors){let s=o.rooms.filter(c=>t.has(c.id));if(!s.length)continue;let a=(c,u)=>s.some(h=>h.points.length>=3&&P([c,u],h.points)),l=new Set(s.map(c=>c.id));n.push({...o,rooms:s,openings:o.openings.filter(c=>l.has(c.room_id)),furniture:o.furniture.filter(c=>a(c.x,c.z)),placements:o.placements.filter(c=>a(c.x,c.z)),walls:(o.walls??[]).filter(c=>a((c.a[0]+c.b[0])/2,(c.a[1]+c.b[1])/2)),outdoor:[]})}let i={...r.settings.roof,type:"none",sections:[],solar:[]};return{...r,floors:n,settings:{...r.settings,roof:i}}}var Lt="nf-outside",Fo=class extends re{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 St(this);kiosk=new Ur({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 Pn(),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=Do(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=zn(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=Do(this._own,t)),this.toggleAttribute("readable",this._config?.readable===!0),e.has("hass")&&(this.style.colorScheme=gr(this.hass)),!e.has("hass")||!this.hass)return;this.data.setHass(this.hass);let n=zn(this._config?.night,this.hass);n!==this._night&&(this._night=n)}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 n=t.join(",");return(!this.roomsMemo||this.roomsMemo.source!==e||this.roomsMemo.ids!==n)&&(this.roomsMemo={source:e,ids:n,result:vu(e,t)}),this.roomsMemo.result}t=e=>M(this.hass,e);stage(){let e=this.plan(),t=this._config,n=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===n)?n: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(),n=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,c,u])=>p`<button aria-pressed=${l} @click=${c}>${u}</button>`)}</div>`;return p`<div class="nf-card-controls"> `;function Lo(r,e){let t=r.template,n=t?e?.[t]:void 0;if(!n)return r;let{type:i,template:o,...s}=n;return{...s,...r}}function Nu(r,e){let t=new Set(e),n=[];for(let o of r.floors){let s=o.rooms.filter(c=>t.has(c.id));if(!s.length)continue;let a=(c,u)=>s.some(d=>d.points.length>=3&&P([c,u],d.points)),l=new Set(s.map(c=>c.id));n.push({...o,rooms:s,openings:o.openings.filter(c=>l.has(c.room_id)),furniture:o.furniture.filter(c=>a(c.x,c.z)),placements:o.placements.filter(c=>a(c.x,c.z)),walls:(o.walls??[]).filter(c=>a((c.a[0]+c.b[0])/2,(c.a[1]+c.b[1])/2)),outdoor:[]})}let i={...r.settings.roof,type:"none",sections:[],solar:[]};return{...r,floors:n,settings:{...r.settings,roof:i}}}var Bt="nf-outside",Bo=class extends X{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 $t(this);kiosk=new Zr({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 Nn(),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=Lo(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=Fn(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=Lo(this._own,t)),this.toggleAttribute("readable",this._config?.readable===!0),e.has("hass")&&(this.style.colorScheme=vr(this.hass)),!e.has("hass")||!this.hass)return;this.data.setHass(this.hass);let n=Fn(this._config?.night,this.hass);n!==this._night&&(this._night=n)}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 n=t.join(",");return(!this.roomsMemo||this.roomsMemo.source!==e||this.roomsMemo.ids!==n)&&(this.roomsMemo={source:e,ids:n,result:Nu(e,t)}),this.roomsMemo.result}t=e=>A(this.hass,e);stage(){let e=this.plan(),t=this._config,n=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===n)?n: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(),n=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,c,u])=>p`<button aria-pressed=${l} @click=${c}>${u}</button>`)}</div>`;return p`<div class="nf-card-controls">
${e.canGoBack?p`<button class="nf-chip" @click=${()=>this.back()}>${n("back")}</button>`:f} ${e.canGoBack?p`<button class="nf-chip" @click=${()=>this.back()}>${n("back")}</button>`:f}
${this.shows("walls")?o(void 0,[[e.walls==="auto",()=>this._walls="auto",n("walls_auto")],[e.walls==="cut",()=>this._walls="cut",n("walls_cut")],[e.walls==="slope",()=>this._walls="slope",n("walls_slope")]]):f} ${this.shows("walls")?o(void 0,[[e.walls==="auto",()=>this._walls="auto",n("walls_auto")],[e.walls==="cut",()=>this._walls="cut",n("walls_cut")],[e.walls==="slope",()=>this._walls="slope",n("walls_slope")]]):f}
${this.shows("floors")&&t.floors.length>1&&!e.floorId?o(void 0,[[e.explode,()=>this._explode=!0,n("floors_apart")],[!e.explode,()=>this._explode=!1,n("floors_stacked")]]):f} ${this.shows("floors")&&t.floors.length>1&&!e.floorId?o(void 0,[[e.explode,()=>this._explode=!0,n("floors_apart")],[!e.explode,()=>this._explode=!1,n("floors_stacked")]]):f}
${i.length>0?o(n("heatmap"),["none",...i].map(s=>[e.heat===s,()=>this._heat=s,n(s==="none"?"heat_off":`heat_short_${s}`)])):f} ${i.length>0?o(n("heatmap"),["none",...i].map(s=>[e.heat===s,()=>this._heat=s,n(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 n=_u(t,e.floorId);if(!n.length)return f;let i=n.length>1,o=(l,c)=>{this.canSwitch&&l!==e.floorId&&(this._floorId=l),this._roomId=c===this._roomId?null:c},s=nn(this.hass,t.floors).length>0,a=()=>{this.canSwitch&&(this._floorId=null),this._roomId=this._roomId===Lt?null:Lt};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 n=Iu(t,e.floorId);if(!n.length)return f;let i=n.length>1,o=(l,c)=>{this.canSwitch&&l!==e.floorId&&(this._floorId=l),this._roomId=c===this._roomId?null:c},s=on(this.hass,t.floors).length>0,a=()=>{this.canSwitch&&(this._floorId=null),this._roomId=this._roomId===Bt?null:Bt};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")}>
${n.map(l=>p`${i?p`<span class="nf-card-rooms-floor">${l.floorName}</span>`:f}${l.rooms.map(c=>p`<button class="nf-chip" aria-pressed=${c.id===this._roomId} @click=${()=>o(l.floorId,c.id)}>${c.name}</button>`)}`)} ${n.map(l=>p`${i?p`<span class="nf-card-rooms-floor">${l.floorName}</span>`:f}${l.rooms.map(c=>p`<button class="nf-chip" aria-pressed=${c.id===this._roomId} @click=${()=>o(l.floorId,c.id)}>${c.name}</button>`)}`)}
${s?p`<button class="nf-chip" aria-pressed=${this._roomId===Lt} title=${this.t("outside_area_hint")} @click=${a}>🌳 ${this.t("outside_area")}</button>`:f} ${s?p`<button class="nf-chip" aria-pressed=${this._roomId===Bt} title=${this.t("outside_area_hint")} @click=${a}>🌳 ${this.t("outside_area")}</button>`:f}
</div>`}renderCorners(){let e=this._config,t=this.t,n=this._clean||!!this._roomId&&e?.room_panel!==!1;return p`${e?.fullscreen_button&&!n?p`<button class="nf-card-full" title=${t(this._fullscreen?"fullscreen_exit":"fullscreen")} aria-label=${t(this._fullscreen?"fullscreen_exit":"fullscreen")} @click=${()=>this.toggleFullscreen()}> </div>`}renderCorners(){let e=this._config,t=this.t,n=this._clean||!!this._roomId&&e?.room_panel!==!1;return p`${e?.fullscreen_button&&!n?p`<button class="nf-card-full" title=${t(this._fullscreen?"fullscreen_exit":"fullscreen")} aria-label=${t(this._fullscreen?"fullscreen_exit":"fullscreen")} @click=${()=>this.toggleFullscreen()}>
${this._fullscreen?"\u2715":"\u26F6"} ${this._fullscreen?"\u2715":"\u26F6"}
</button>`:f} </button>`:f}
${e?.dashboard&&!n?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&&!n?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"} ${e.dashboard_label?p`<span>${e.dashboard_label}</span>`:"\u2302"}
</button>`:f}`}renderStage(e){let t=this.plan(),n=this._config,i=()=>{this._clean=!this._clean,this._clean?this.kiosk.stopClean():this.kiosk.armClean()},o=n?.controls_hidden!==void 0||(n?.controls_hide_after??0)>0;return p`<nf-view3d </button>`:f}`}renderStage(e){let t=this.plan(),n=this._config,i=()=>{this._clean=!this._clean,this._clean?this.kiosk.stopClean():this.kiosk.armClean()},o=n?.controls_hidden!==void 0||(n?.controls_hide_after??0)>0;return p`<nf-view3d
.hass=${Or(ft(this.hass,t.floors),t.settings)} .hass=${Vr(gt(this.hass,t.floors),t.settings)}
.building=${t} .building=${t}
.packs=${this.data.packs} .packs=${this.data.packs}
.floorId=${e.floorId} .floorId=${e.floorId}
.roomId=${this._roomId===Lt?null:this._roomId} .roomId=${this._roomId===Bt?null:this._roomId}
.outsideOpen=${this._roomId===Lt} .outsideOpen=${this._roomId===Bt}
.wallMode=${e.walls} .wallMode=${e.walls}
.solidWalls=${n?.solid_walls===!0} .solidWalls=${n?.solid_walls===!0}
.explode=${e.explode} .explode=${e.explode}
@@ -4209,7 +4227,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.zoom=${typeof n?.zoom=="number"?n.zoom:1} .zoom=${typeof n?.zoom=="number"?n.zoom:1}
.buttons=${n?.buttons?.map((s,a)=>({id:`card_${a}`,...s}))??null} .buttons=${n?.buttons?.map((s,a)=>({id:`card_${a}`,...s}))??null}
.heatMode=${e.heat} .heatMode=${e.heat}
.theme=${Rr(n?.theme,this.hass?.states["sun.sun"]?.state)} .theme=${Dr(n?.theme,this.hass?.states["sun.sun"]?.state)}
.clock=${n?.clock&&n.clock!=="none"?n.clock:null} .clock=${n?.clock&&n.clock!=="none"?n.clock:null}
.lockButton=${n?.lock_button!==!1} .lockButton=${n?.lock_button!==!1}
.walkButton=${n?.walk_button!==!1} .walkButton=${n?.walk_button!==!1}
@@ -4227,10 +4245,10 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.panelOpen=${!!this._roomId&&n?.room_panel!==!1} .panelOpen=${!!this._roomId&&n?.room_panel!==!1}
.alerts=${n?.alerts!==!1} .alerts=${n?.alerts!==!1}
.alertJump=${!!n?.alert_jump} .alertJump=${!!n?.alert_jump}
.announcements=${!J(this.hass)&&n?.announcements!==!1&&!hu()} .announcements=${!U(this.hass)&&n?.announcements!==!1&&!Tu()}
.sensorBar=${n?.sensor_bar!==!1} .sensorBar=${n?.sensor_bar!==!1}
.glassWalls=${typeof n?.glass_walls=="number"?Math.min(100,Math.max(0,n.glass_walls)):null} .glassWalls=${typeof n?.glass_walls=="number"?Math.min(100,Math.max(0,n.glass_walls)):null}
.screenName=${n?.screen_name??du()} .screenName=${n?.screen_name??zu()}
.scenes=${n?.scenes!==!1} .scenes=${n?.scenes!==!1}
.clean=${this._clean} .clean=${this._clean}
.cleanButton=${o} .cleanButton=${o}
@@ -4248,22 +4266,22 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
></nf-view3d>`}renderRoomPanel(){let e=this.plan();return p`<nf-room-panel ></nf-view3d>`}renderRoomPanel(){let e=this.plan();return p`<nf-room-panel
.building=${this.plan()??null} .building=${this.plan()??null}
class="nf-card-panel" class="nf-card-panel"
.hass=${ft(this.hass,e.floors)} .hass=${gt(this.hass,e.floors)}
.room=${e.floors.flatMap(t=>t.rooms).find(t=>t.id===this._roomId)??null} .room=${e.floors.flatMap(t=>t.rooms).find(t=>t.id===this._roomId)??null}
.floor=${e.floors.find(t=>t.rooms.some(n=>n.id===this._roomId))??null} .floor=${e.floors.find(t=>t.rooms.some(n=>n.id===this._roomId))??null}
.outside=${this._roomId===Lt?nn(this.hass,e.floors):null} .outside=${this._roomId===Bt?on(this.hass,e.floors):null}
.confirmEntities=${ut(this.hass,e.floors)} .confirmEntities=${dt(this.hass,e.floors)}
.phrases=${e.settings.announce_phrases??null} .phrases=${e.settings.announce_phrases??null}
@close=${()=>this._roomId=null} @close=${()=>this._roomId=null}
></nf-room-panel>`}render(){if(this.hass&&ur(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 n=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&&mr(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 n=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}"> <div class="nf-card-body" style="height:${i}">
${e&&e.floors.some(a=>a.rooms.length)?this.renderStage(n):p`<p class="nf-card-msg">${this.data.error??(e?M(this.hass,"no_building"):M(this.hass,"loading"))}</p>`} ${e&&e.floors.some(a=>a.rooms.length)?this.renderStage(n):p`<p class="nf-card-msg">${this.data.error??(e?A(this.hass,"no_building"):A(this.hass,"loading"))}</p>`}
${this._roomId&&e&&t?.room_panel!==!1?this.renderRoomPanel():f} ${this._roomId&&e&&t?.room_panel!==!1?this.renderRoomPanel():f}
${this.renderRoomButtons(n)} ${this.renderRoomButtons(n)}
${n.showBar&&e?this.renderBar(n):f} ${n.showBar&&e?this.renderBar(n):f}
${this.renderCorners()} ${this.renderCorners()}
</div> </div>
</ha-card>`}static styles=[pe,Ae,bu,fr]};if(!customElements.get("nextfloor-card")){customElements.define("nextfloor-card",Fo);let r=window;r.customCards=r.customCards??[],r.customCards.push({type:"nextfloor-card",name:M(void 0,"card_name"),description:M(void 0,"card_description"),preview:!1})}hi();var ef="nextfloor-chunks-v1";async function Ho(r,e,t){let n=await fetch(`${r.endpoint}/api?token=${encodeURIComponent(r.token)}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},credentials:"same-origin",body:JSON.stringify({...t,action:e,transport:ef})}),i=await n.text(),o;try{o=JSON.parse(i)}catch{throw/Output-Buffer exceeds Limit/i.test(i)?new Error("Symcon hat die Antwort wegen seiner Ausgabebegrenzung abgebrochen. Bitte das NextFloor-Modul aktualisieren und den Designer neu laden."):new Error(`Symcon liefert ${i.trim()?"kein g\xFCltiges JSON":"eine leere Antwort"} f\xFCr \u201E${e}\u201C (HTTP ${n.status}).`)}if(!n.ok||!o||typeof o!="object"||"error"in o){let s=o&&typeof o=="object"&&"error"in o?o.error:`HTTP ${n.status}`;throw new Error(String(s))}return o}async function Bt(r,e,t={}){let n=await Ho(r,e,t);if(!("_nextfloor_transfer"in n))return n;let i=n._nextfloor_transfer;if(!i||!/^[a-f0-9]{32}$/.test(i.id)||!Number.isSafeInteger(i.bytes)||i.bytes<=0||i.bytes>67108864||!Number.isSafeInteger(i.chunk_bytes)||i.chunk_bytes<=0||i.chunk_bytes>128*1024||i.chunks!==Math.ceil(i.bytes/i.chunk_bytes)||i.chunks>512)throw new Error("Symcon hat eine ung\xFCltige Daten\xFCbertragung angek\xFCndigt.");try{let o=new TextDecoder("utf-8",{fatal:!0}),s=[];for(let a=0;a<i.chunks;a++){let l=await Ho(r,"transport/read",{transfer_id:i.id,index:a});if(l.index!==a||typeof l.data!="string")throw new Error("Ein Symcon-Datenpaket fehlt oder ist ung\xFCltig.");let c=Uint8Array.from(atob(l.data),u=>u.charCodeAt(0));if(c.length!==Math.min(i.chunk_bytes,i.bytes-a*i.chunk_bytes))throw new Error("Ein Symcon-Datenpaket wurde unvollst\xE4ndig \xFCbertragen.");s.push(o.decode(c,{stream:!0}))}return s.push(o.decode()),JSON.parse(s.join(""))}finally{await Ho(r,"transport/release",{transfer_id:i.id}).catch(()=>{})}}function tf(){let r=window.__NEXTFLOOR_SYMCON__;if(!r?.endpoint||!r.token)throw new Error("NextFloor Symcon host configuration is missing");return r}var jr=class{settings=tf();changeListeners=new Set;buildingListeners=new Set;timer;stateRevision=-1;buildingRevision=-1;objectsSignature="";refreshTask;states={};entities={};areas={};facade={language:this.settings.language||navigator.language||"de",user:{is_admin:!0,name:this.settings.title||"IP-Symcon"},states:this.states,entities:this.entities,areas:this.areas,symconObjects:[],symconTitle:this.settings.title?.trim()||"NextFloor",symconRefresh:()=>this.refresh(!0),config:{unit_system:{temperature:"\xB0C"}},themes:{darkMode:window.matchMedia?.("(prefers-color-scheme: dark)").matches??!0},services:{},connection:{subscribeMessage:async(e,t)=>{if(t.type==="nextfloor/building/subscribe"){let n=i=>e({revision:i});return this.buildingListeners.add(n),async()=>{this.buildingListeners.delete(n)}}return async()=>{}}},callWS:e=>this.callWS(e),callService:(e,t,n)=>this.callService(e,t,n),fetchWithAuth:(e,t)=>this.fetchWithToken(e,t),hassUrl:(e="")=>new URL(e,window.location.origin).href};async start(){let e=await Bt(this.settings,"bootstrap");return this.apply(e),this.stateRevision=e.state_revision,this.buildingRevision=e.building_revision,this.timer=setInterval(()=>{this.refresh().catch(()=>{})},800),this.snapshot()}stop(){this.timer&&clearInterval(this.timer),this.timer=void 0}onChange(e){return this.changeListeners.add(e),()=>this.changeListeners.delete(e)}snapshot(){return{...this.facade,states:{...this.states},entities:{...this.entities},areas:{...this.areas}}}refresh(e=!1){if(this.refreshTask)return e?this.refreshTask.catch(()=>{}).then(()=>this.refresh(!0)):this.refreshTask;let t=this.loadSnapshot(e).finally(()=>{this.refreshTask===t&&(this.refreshTask=void 0)});return this.refreshTask=t,t}async loadSnapshot(e){let t=e?await Bt(this.settings,"bootstrap"):await Bt(this.settings,"variables/snapshot",{revision:this.stateRevision});if((e||t.state_revision!==this.stateRevision)&&t.variables){this.stateRevision=t.state_revision,this.apply({variables:t.variables,areas:t.areas,objects:t.objects});for(let n of this.changeListeners)n()}if(t.building_revision!==this.buildingRevision){this.buildingRevision=t.building_revision;for(let n of this.buildingListeners)n(t.building_revision)}}apply(e){this.states=Object.fromEntries(e.variables.map(t=>[t.entity_id,{entity_id:t.entity_id,state:t.state,attributes:{...t.attributes,friendly_name:t.name,symcon_path:t.path}}])),this.entities=Object.fromEntries(e.variables.map(t=>[t.entity_id,{entity_id:t.entity_id,name:t.name,area_id:t.area_id??null,device_id:t.device_id??null}]));for(let t of Object.values(this.states))for(let n of["light","cover"]){let i=Bs(t,n);!i||i.entity_id===t.entity_id||this.states[i.entity_id]||(this.staLine truncated </ha-card>`}static styles=[pe,Ae,Cu,br]};if(!customElements.get("nextfloor-card")){customElements.define("nextfloor-card",Bo);let r=window;r.customCards=r.customCards??[],r.customCards.push({type:"nextfloor-card",name:A(void 0,"card_name"),description:A(void 0,"card_description"),preview:!1})}fi();var Sf="nextfloor-chunks-v1";async function Vo(r,e,t){let n=await fetch(`${r.endpoint}/api?token=${encodeURIComponent(r.token)}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},credentials:"same-origin",body:JSON.stringify({...t,action:e,transport:Sf})}),i=await n.text(),o;try{o=JSON.parse(i)}catch{throw/Output-Buffer exceeds Limit/i.test(i)?new Error("Symcon hat die Antwort wegen seiner Ausgabebegrenzung abgebrochen. Bitte das NextFloor-Modul aktualisieren und den Designer neu laden."):new Error(`Symcon liefert ${i.trim()?"kein g\xFCltiges JSON":"eine leere Antwort"} f\xFCr \u201E${e}\u201C (HTTP ${n.status}).`)}if(!n.ok||!o||typeof o!="object"||"error"in o){let s=o&&typeof o=="object"&&"error"in o?o.error:`HTTP ${n.status}`;throw new Error(String(s))}return o}async function Vt(r,e,t={}){let n=await Vo(r,e,t);if(!("_nextfloor_transfer"in n))return n;let i=n._nextfloor_transfer;if(!i||!/^[a-f0-9]{32}$/.test(i.id)||!Number.isSafeInteger(i.bytes)||i.bytes<=0||i.bytes>67108864||!Number.isSafeInteger(i.chunk_bytes)||i.chunk_bytes<=0||i.chunk_bytes>128*1024||i.chunks!==Math.ceil(i.bytes/i.chunk_bytes)||i.chunks>512)throw new Error("Symcon hat eine ung\xFCltige Daten\xFCbertragung angek\xFCndigt.");try{let o=new TextDecoder("utf-8",{fatal:!0}),s=[];for(let a=0;a<i.chunks;a++){let l=await Vo(r,"transport/read",{transfer_id:i.id,index:a});if(l.index!==a||typeof l.data!="string")throw new Error("Ein Symcon-Datenpaket fehlt oder ist ung\xFCltig.");let c=Uint8Array.from(atob(l.data),u=>u.charCodeAt(0));if(c.length!==Math.min(i.chunk_bytes,i.bytes-a*i.chunk_bytes))throw new Error("Ein Symcon-Datenpaket wurde unvollst\xE4ndig \xFCbertragen.");s.push(o.decode(c,{stream:!0}))}return s.push(o.decode()),JSON.parse(s.join(""))}finally{await Vo(r,"transport/release",{transfer_id:i.id}).catch(()=>{})}}function $f(){let r=window.__NEXTFLOOR_SYMCON__;if(!r?.endpoint||!r.token)throw new Error("NextFloor Symcon host configuration is missing");return r}var Yr=class{settings=$f();changeListeners=new Set;buildingListeners=new Set;timer;stateRevision=-1;buildingRevision=-1;objectsSignature="";refreshTask;states={};entities={};areas={};facade={language:this.settings.language||navigator.language||"de",user:{is_admin:!0,name:this.settings.title||"IP-Symcon"},states:this.states,entities:this.entities,areas:this.areas,symconObjects:[],symconTitle:this.settings.title?.trim()||"NextFloor",symconRefresh:()=>this.refresh(!0),config:{unit_system:{temperature:"\xB0C"}},themes:{darkMode:window.matchMedia?.("(prefers-color-scheme: dark)").matches??!0},services:{},connection:{subscribeMessage:async(e,t)=>{if(t.type==="nextfloor/building/subscribe"){let n=i=>e({revision:i});return this.buildingListeners.add(n),async()=>{this.buildingListeners.delete(n)}}return async()=>{}}},callWS:e=>this.callWS(e),callService:(e,t,n)=>this.callService(e,t,n),fetchWithAuth:(e,t)=>this.fetchWithToken(e,t),hassUrl:(e="")=>new URL(e,window.location.origin).href};async start(){let e=await Vt(this.settings,"bootstrap");return this.apply(e),this.stateRevision=e.state_revision,this.buildingRevision=e.building_revision,this.timer=setInterval(()=>{this.refresh().catch(()=>{})},800),this.snapshot()}stop(){this.timer&&clearInterval(this.timer),this.timer=void 0}onChange(e){return this.changeListeners.add(e),()=>this.changeListeners.delete(e)}snapshot(){return{...this.facade,states:{...this.states},entities:{...this.entities},areas:{...this.areas}}}refresh(e=!1){if(this.refreshTask)return e?this.refreshTask.catch(()=>{}).then(()=>this.refresh(!0)):this.refreshTask;let t=this.loadSnapshot(e).finally(()=>{this.refreshTask===t&&(this.refreshTask=void 0)});return this.refreshTask=t,t}async loadSnapshot(e){let t=e?await Vt(this.settings,"bootstrap"):await Vt(this.settings,"variables/snapshot",{revision:this.stateRevision});if((e||t.state_revision!==this.stateRevision)&&t.variables){this.stateRevision=t.state_revision,this.apply({variables:t.variables,areas:t.areas,objects:t.objects});for(let n of this.changeListeners)n()}if(t.building_revision!==this.buildingRevision){this.buildingRevision=t.building_revision;for(let n of this.buildingListeners)n(t.building_revision)}}apply(e){this.states=Object.fromEntries(e.variables.map(t=>[t.entity_id,{entity_id:t.entity_id,state:t.state,attributes:{...t.attributes,friendly_name:t.name,symcon_path:t.path}}])),this.entities=Object.fromEntries(e.variables.map(t=>[t.entity_id,{entity_id:t.entity_id,name:t.name,area_id:t.area_id??null,device_id:t.device_id??null}]));for(let t of Object.values(this.states))for(let n of["light","cover"]){let i=Js(t,n);!i||i.entity_id===t.entity_id||this.states[i.entity_id]||(this.staLine truncated
/*! Bundled license information: /*! Bundled license information:
@lit/reactive-element/css-tag.js: @lit/reactive-element/css-tag.js:
File diff suppressed because it is too large. Load diff
+3 -1
View File
@@ -419,7 +419,9 @@ class NextFloor extends IPSModuleStrict
'icon' => (string) $object['ObjectIcon'] 'icon' => (string) $object['ObjectIcon']
]; ];
if ($type === 1) { // OBJECTTYPE_INSTANCE: the logical console view separates system modules. if ($type === 1) { // OBJECTTYPE_INSTANCE: the logical console view separates system modules.
$node['module_type'] = (int) IPS_GetInstance($objectID)['ModuleInfo']['ModuleType']; $module = IPS_GetInstance($objectID)['ModuleInfo'];
$node['module_type'] = (int) $module['ModuleType'];
$node['module_id'] = (string) ($module['ModuleID'] ?? '');
} }
if ($type === 0) { // OBJECTTYPE_CATEGORY if ($type === 0) { // OBJECTTYPE_CATEGORY
$nearestCategory = $objectID; $nearestCategory = $objectID;
+18 -1
View File
@@ -16,7 +16,7 @@ In **Kerninstanzen → Modules** wird dieses Repository verwendet:
Im Zahnrad des Eintrags den Branch **`symcon`** wählen und auf Aktualisierungen prüfen. Im Zahnrad des Eintrags den Branch **`symcon`** wählen und auf Aktualisierungen prüfen.
`main` enthält die Quellen für die Entwicklung, `symcon` die installierbare Bibliothek. `main` enthält die Quellen für die Entwicklung, `symcon` die installierbare Bibliothek.
Nach der Aktualisierung auf **0.2.13 / Build 16** die Konsole neu laden. Unter Nach der Aktualisierung auf **0.2.14 / Build 17** die Konsole neu laden. Unter
**Instanz hinzufügen → Hersteller NextFloor** erscheint **„NextFloor Designer und 3D-Kachel“**. **Instanz hinzufügen → Hersteller NextFloor** erscheint **„NextFloor Designer und 3D-Kachel“**.
### Für die Entwicklung ### Für die Entwicklung
@@ -46,6 +46,23 @@ Die Dateien unter `NextFloor/assets/` und `NextFloor/packs/` werden durch
Der Build prüft anschließend die Modulmetadaten und die installierbare Verzeichnisstruktur. Der Build prüft anschließend die Modulmetadaten und die installierbare Verzeichnisstruktur.
Dieselbe Prüfung lässt sich separat mit `node symcon/tests/validate-package.mjs` ausführen. Dieselbe Prüfung lässt sich separat mit `node symcon/tests/validate-package.mjs` ausführen.
## Änderungen in 0.2.14
- Verknüpfte Raum-Bereichskategorien werden einschließlich ausgeblendeter Objekte
nach Kategorien und Dummy-Modulen namens **Elektro/Strom, Wasser, Gas, Heizen
und Kühlen** durchsucht. Daraus werden **Leistung/Durchfluss** und
**Energie/Verbrauch** aus numerischen Variablen gelesen und im Raummenü angezeigt.
Passende Einheiten werden umgerechnet; verschiedene Einheiten und Tages-,
Monats-, Jahres- und Gesamtverbräuche bleiben getrennt. Ein übergeordneter
Zählerstand ersetzt seine Unterzähler; Variablenlinks zählen nicht doppelt.
- Der Knopf **Stockwerkszähler** in der 3D-Ansicht zeigt die Raumsummen je Medium.
Unter **Stockwerke → Stockwerkszähler** können für jedes Medium eigene
Leistungs-/Durchfluss- und Energie-/Verbrauchszähler aus dem Objektbaum gewählt
werden. Jeder eigene Zähler ersetzt nur die entsprechende Raumsumme. **×**
kehrt zur automatischen Summe zurück; bestehende Stockwerks-Leistungszähler
bleiben verknüpft. Nicht verfügbare Quellen ergeben keine scheinbar vollständige
Teilsumme. Die Stromleistung wird auch in Raum- und Stockwerksanzeigen genutzt.
## Änderungen in 0.2.13 ## Änderungen in 0.2.13
- Im Raum liegt **Fußbodenheizung** unter **Raumklima**. Dort lassen sich auch - Im Raum liegt **Fußbodenheizung** unter **Raumklima**. Dort lassen sich auch
+2 -2
View File
@@ -6,7 +6,7 @@
"compatibility": { "compatibility": {
"version": "9.0" "version": "9.0"
}, },
"version": "0.2.13", "version": "0.2.14",
"build": 16, "build": 17,
"date": 1794384000 "date": 1794384000
} }
+2 -1
View File
@@ -25,7 +25,7 @@ $objects = [
function IPS_GetChildrenIDs(int $id): array { global $objects; return array_keys(array_filter($objects, static fn(array $object): bool => $object['ParentID'] === $id)); } function IPS_GetChildrenIDs(int $id): array { global $objects; return array_keys(array_filter($objects, static fn(array $object): bool => $object['ParentID'] === $id)); }
function IPS_ObjectExists(int $id): bool { global $objects; return isset($objects[$id]); } function IPS_ObjectExists(int $id): bool { global $objects; return isset($objects[$id]); }
function IPS_GetObject(int $id): array { global $objects; return [...$objects[$id], 'ObjectIsHidden' => in_array($id, [10, 12], true), 'ObjectIcon' => 'Temperature']; } function IPS_GetObject(int $id): array { global $objects; return [...$objects[$id], 'ObjectIsHidden' => in_array($id, [10, 12], true), 'ObjectIcon' => 'Temperature']; }
function IPS_GetInstance(int $id): array { return ['ModuleInfo' => ['ModuleType' => [18 => 1, 20 => 0, 21 => 2, 22 => 4, 23 => 5, 24 => 6][$id] ?? 3]]; } function IPS_GetInstance(int $id): array { return ['ModuleInfo' => ['ModuleType' => [18 => 1, 20 => 0, 21 => 2, 22 => 4, 23 => 5, 24 => 6][$id] ?? 3, 'ModuleID' => $id === 11 ? '{485D0419-BE97-4548-AA9C-C083EB82E61E}' : '{OTHER}']]; }
function IPS_GetName(int $id): string { global $objects; return $objects[$id]['ObjectName']; } function IPS_GetName(int $id): string { global $objects; return $objects[$id]['ObjectName']; }
function IPS_GetLink(int $id): array { return ['TargetID' => 12]; } function IPS_GetLink(int $id): array { return ['TargetID' => 12]; }
function IPS_GetVariable(int $id): array { return ['VariableType' => 2, 'VariableProfile' => '', 'VariableCustomProfile' => '', 'VariableCustomAction' => 0, 'VariableAction' => 0]; } function IPS_GetVariable(int $id): array { return ['VariableType' => 2, 'VariableProfile' => '', 'VariableCustomProfile' => '', 'VariableCustomAction' => 0, 'VariableAction' => 0]; }
@@ -48,4 +48,5 @@ check(!isset($nodes[16]['entity_id']), 'Scripts are visible but are not variable
check($nodes[10]['hidden'] === true && $nodes[11]['parent_id'] === 10, 'Hidden categories and all their children must be exported'); check($nodes[10]['hidden'] === true && $nodes[11]['parent_id'] === 10, 'Hidden categories and all their children must be exported');
check(array_column(array_intersect_key($nodes, array_flip([18, 20, 21, 22, 23, 24])), 'module_type') === [1, 0, 2, 4, 5, 6], 'Export real module types for logical system grouping'); check(array_column(array_intersect_key($nodes, array_flip([18, 20, 21, 22, 23, 24])), 'module_type') === [1, 0, 2, 4, 5, 6], 'Export real module types for logical system grouping');
check($nodes[11]['module_type'] === 3 && $nodes[19]['parent_id'] === 18, 'Keep devices and system-variable parents unchanged in native export'); check($nodes[11]['module_type'] === 3 && $nodes[19]['parent_id'] === 18, 'Keep devices and system-variable parents unchanged in native export');
check($nodes[11]['module_id'] === '{485D0419-BE97-4548-AA9C-C083EB82E61E}', 'Export the real module ID so dummy utility containers can be recognized');
echo "OK: full native object hierarchy, positions, hidden nodes and variable links\n"; echo "OK: full native object hierarchy, positions, hidden nodes and variable links\n";